From: Andrea Bianco Date: Fri, 9 Oct 2020 09:57:54 +0000 (+0200) Subject: Built motion from commit (unavailable).|2.5.4 X-Git-Url: http://repos.xcallymotion.com/base/%22angular-material.themes.css/%22javascript:;//%22%7B%7Blicense.chat?a=commitdiff_plain;h=5c5db13519abfad0256be6fe1d1e1e04fcb3c9f9;p=motion2.git Built motion from commit (unavailable).|2.5.4 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 86aa883..8e4f20a 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2020-10-09T09:23:21.931Z", + "time": "2020-10-09T09:46:25.620Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index c392af5..669593d 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2020-10-09T09:23:21.931Z", + "time": "2020-10-09T09:46:25.620Z", "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 a09e18a..465dbaf 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 _0x119b=['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]','motionbar[NULL,NULL,WinAppArguments]','TEXT','VIRTUAL','getDataValue','action','STRING','contactManager','integration','motionbar','urlForward','bot'];(function(_0x44fef1,_0x132cf4){var _0x3c3a04=function(_0x175a90){while(--_0x175a90){_0x44fef1['push'](_0x44fef1['shift']());}};_0x3c3a04(++_0x132cf4);}(_0x119b,0x11d));var _0xb119=function(_0x146837,_0x2aa6a2){_0x146837=_0x146837-0x0;var _0x3d7e60=_0x119b[_0x146837];return _0x3d7e60;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xb119('0x0')],'get':function(_0x2b31d8){return this[_0xb119('0x1')](_0xb119('0x2'));}},'action':{'type':Sequelize[_0xb119('0x3')],'allowNull':![],'validate':{'isIn':{'args':[[_0xb119('0x4'),_0xb119('0x5'),_0xb119('0x6'),'jscripty',_0xb119('0x7'),'browser',_0xb119('0x8'),'script']],'msg':_0xb119('0x9')}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'},'data1':{'type':Sequelize[_0xb119('0x3')](0x1000),'comment':_0xb119('0xa')},'data2':{'type':Sequelize[_0xb119('0x3')](0x1000),'comment':_0xb119('0xb')},'data3':{'type':Sequelize[_0xb119('0x3')](0x1000),'comment':_0xb119('0xc')},'data4':{'type':Sequelize[_0xb119('0x3')](0x1000)},'data5':{'type':Sequelize['STRING'](0x1000)},'data6':{'type':Sequelize[_0xb119('0x3')]},'data7':{'type':Sequelize[_0xb119('0xd')]}}; \ No newline at end of file +var _0x7679=['exports','VIRTUAL','getDataValue','contactManager','integration','motionbar','jscripty','urlForward','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','STRING','integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]','TEXT'];(function(_0x358374,_0x80ccda){var _0x2a9f9b=function(_0x3e2ae2){while(--_0x3e2ae2){_0x358374['push'](_0x358374['shift']());}};_0x2a9f9b(++_0x80ccda);}(_0x7679,0x1c7));var _0x9767=function(_0x14e516,_0x4e8745){_0x14e516=_0x14e516-0x0;var _0x40f834=_0x7679[_0x14e516];return _0x40f834;};'use strict';var Sequelize=require('sequelize');module[_0x9767('0x0')]={'name':{'type':Sequelize[_0x9767('0x1')],'get':function(_0x5b88a9){return this[_0x9767('0x2')]('action');}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[[_0x9767('0x3'),_0x9767('0x4'),_0x9767('0x5'),_0x9767('0x6'),_0x9767('0x7'),'browser','bot',_0x9767('0x8')]],'msg':_0x9767('0x9')}},'comment':_0x9767('0x9')},'data1':{'type':Sequelize[_0x9767('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[_0x9767('0xa')](0x1000),'comment':_0x9767('0xb')},'data3':{'type':Sequelize[_0x9767('0xa')](0x1000),'comment':'motionbar[NULL,NULL,WinAppArguments]'},'data4':{'type':Sequelize[_0x9767('0xa')](0x1000)},'data5':{'type':Sequelize['STRING'](0x1000)},'data6':{'type':Sequelize['STRING']},'data7':{'type':Sequelize[_0x9767('0xc')]}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index a1f657a..020a1ef 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 _0x474e=['limit','set','Content-Range','reject','save','then','end','stack','name','send','body','Action','find','catch','destroy','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x474e,0xf1));var _0xe474=function(_0x2b1e2d,_0x26511c){_0x2b1e2d=_0x2b1e2d-0x0;var _0x460559=_0x474e[_0x2b1e2d];return _0x460559;};'use strict';var pdf=require(_0xe474('0x0'));var emlformat=require(_0xe474('0x1'));var rimraf=require(_0xe474('0x2'));var zipdir=require(_0xe474('0x3'));var jsonpatch=require(_0xe474('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe474('0x5'));var util=require(_0xe474('0x6'));var path=require(_0xe474('0x7'));var sox=require(_0xe474('0x8'));var csv=require(_0xe474('0x9'));var ejs=require(_0xe474('0xa'));var fs=require('fs');var _=require(_0xe474('0xb'));var squel=require(_0xe474('0xc'));var crypto=require('crypto');var jsforce=require(_0xe474('0xd'));var deskjs=require(_0xe474('0xe'));var toCsv=require(_0xe474('0x9'));var querystring=require(_0xe474('0xf'));var Papa=require(_0xe474('0x10'));var Redis=require(_0xe474('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xe474('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe474('0x13'));var logger=require(_0xe474('0x14'))('api');var utils=require(_0xe474('0x15'));var config=require(_0xe474('0x16'));var db=require(_0xe474('0x17'))['db'];function respondWithStatusCode(_0x3fbbd5,_0x263aee){_0x263aee=_0x263aee||0xcc;return function(_0x3698dc){if(_0x3698dc){return _0x3fbbd5[_0xe474('0x18')](_0x263aee);}return _0x3fbbd5[_0xe474('0x19')](_0x263aee)['end']();};}function respondWithResult(_0x174f48,_0x25e56b){_0x25e56b=_0x25e56b||0xc8;return function(_0x362820){if(_0x362820){return _0x174f48[_0xe474('0x19')](_0x25e56b)[_0xe474('0x1a')](_0x362820);}};}function respondWithFilteredResult(_0x208d91,_0x22a7df){return function(_0x5ae611){if(_0x5ae611){var _0x18075e=_0x5ae611[_0xe474('0x1b')],_0x530d26=_0x22a7df[_0xe474('0x1c')],_0x60addf=_0x22a7df['offset']+_0x22a7df[_0xe474('0x1d')],_0xbe95c7;if(_0x60addf>=_0x18075e){_0x60addf=_0x18075e;_0xbe95c7=0xc8;}else{_0xbe95c7=0xce;}_0x208d91[_0xe474('0x19')](_0xbe95c7);return _0x208d91[_0xe474('0x1e')](_0xe474('0x1f'),_0x530d26+'-'+_0x60addf+'/'+_0x18075e)[_0xe474('0x1a')](_0x5ae611);}return null;};}function patchUpdates(_0x1623d2){return function(_0x2dd9d0){try{jsonpatch['apply'](_0x2dd9d0,_0x1623d2,!![]);}catch(_0x50513b){return BPromise[_0xe474('0x20')](_0x50513b);}return _0x2dd9d0[_0xe474('0x21')]();};}function saveUpdates(_0x219e51,_0x29c95e){return function(_0x6b2602){if(_0x6b2602){return _0x6b2602['update'](_0x219e51)[_0xe474('0x22')](function(_0x4e74bc){return _0x4e74bc;});}return null;};}function removeEntity(_0xfdb321,_0x3e23c8){return function(_0x47a831){if(_0x47a831){return _0x47a831['destroy']()[_0xe474('0x22')](function(){_0xfdb321[_0xe474('0x19')](0xcc)[_0xe474('0x23')]();});}};}function handleEntityNotFound(_0x2908f6,_0xfc7cf8){return function(_0x27db5c){if(!_0x27db5c){_0x2908f6[_0xe474('0x18')](0x194);}return _0x27db5c;};}function handleError(_0xb8aaf3,_0x37c5d8){_0x37c5d8=_0x37c5d8||0x1f4;return function(_0xbd3532){logger['error'](_0xbd3532[_0xe474('0x24')]);if(_0xbd3532[_0xe474('0x25')]){delete _0xbd3532[_0xe474('0x25')];}_0xb8aaf3['status'](_0x37c5d8)[_0xe474('0x26')](_0xbd3532);};}exports['update']=function(_0x3000be,_0x3adfb3){if(_0x3000be['body']['id']){delete _0x3000be[_0xe474('0x27')]['id'];}return db[_0xe474('0x28')][_0xe474('0x29')]({'where':{'id':_0x3000be['params']['id']}})[_0xe474('0x22')](handleEntityNotFound(_0x3adfb3,null))[_0xe474('0x22')](saveUpdates(_0x3000be[_0xe474('0x27')],null))[_0xe474('0x22')](respondWithResult(_0x3adfb3,null))[_0xe474('0x2a')](handleError(_0x3adfb3,null));};exports[_0xe474('0x2b')]=function(_0x3d7729,_0x2796fe){return db[_0xe474('0x28')]['find']({'where':{'id':_0x3d7729[_0xe474('0x2c')]['id']}})[_0xe474('0x22')](handleEntityNotFound(_0x2796fe,null))[_0xe474('0x22')](removeEntity(_0x2796fe,null))['catch'](handleError(_0x2796fe,null));}; \ No newline at end of file +var _0x0a56=['Content-Range','apply','reject','save','then','destroy','error','stack','name','send','update','body','Action','find','catch','params','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','../../config/license/hardware','api','../../config/environment','sendStatus','status','json','count','offset','limit','set'];(function(_0x48c2ae,_0x4cea90){var _0x8f7531=function(_0x126458){while(--_0x126458){_0x48c2ae['push'](_0x48c2ae['shift']());}};_0x8f7531(++_0x4cea90);}(_0x0a56,0x19c));var _0x60a5=function(_0x39603b,_0x478df9){_0x39603b=_0x39603b-0x0;var _0x361169=_0x0a56[_0x39603b];return _0x361169;};'use strict';var pdf=require(_0x60a5('0x0'));var emlformat=require(_0x60a5('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x60a5('0x2'));var jsonpatch=require(_0x60a5('0x3'));var rp=require(_0x60a5('0x4'));var moment=require(_0x60a5('0x5'));var BPromise=require(_0x60a5('0x6'));var Mustache=require('mustache');var util=require(_0x60a5('0x7'));var path=require(_0x60a5('0x8'));var sox=require(_0x60a5('0x9'));var csv=require(_0x60a5('0xa'));var ejs=require(_0x60a5('0xb'));var fs=require('fs');var _=require(_0x60a5('0xc'));var squel=require(_0x60a5('0xd'));var crypto=require(_0x60a5('0xe'));var jsforce=require(_0x60a5('0xf'));var deskjs=require(_0x60a5('0x10'));var toCsv=require(_0x60a5('0xa'));var querystring=require(_0x60a5('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x60a5('0x12'));var logger=require('../../config/logger')(_0x60a5('0x13'));var utils=require('../../config/utils');var config=require(_0x60a5('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3d3180,_0x74b539){_0x74b539=_0x74b539||0xcc;return function(_0x199c7e){if(_0x199c7e){return _0x3d3180[_0x60a5('0x15')](_0x74b539);}return _0x3d3180[_0x60a5('0x16')](_0x74b539)['end']();};}function respondWithResult(_0x58b460,_0x2f71bf){_0x2f71bf=_0x2f71bf||0xc8;return function(_0x37a54f){if(_0x37a54f){return _0x58b460[_0x60a5('0x16')](_0x2f71bf)[_0x60a5('0x17')](_0x37a54f);}};}function respondWithFilteredResult(_0x5d1ee4,_0x348e0b){return function(_0x39eb0b){if(_0x39eb0b){var _0x448ac6=_0x39eb0b[_0x60a5('0x18')],_0x4cdb29=_0x348e0b[_0x60a5('0x19')],_0x55b04e=_0x348e0b[_0x60a5('0x19')]+_0x348e0b[_0x60a5('0x1a')],_0x3ac5b4;if(_0x55b04e>=_0x448ac6){_0x55b04e=_0x448ac6;_0x3ac5b4=0xc8;}else{_0x3ac5b4=0xce;}_0x5d1ee4[_0x60a5('0x16')](_0x3ac5b4);return _0x5d1ee4[_0x60a5('0x1b')](_0x60a5('0x1c'),_0x4cdb29+'-'+_0x55b04e+'/'+_0x448ac6)[_0x60a5('0x17')](_0x39eb0b);}return null;};}function patchUpdates(_0x29a872){return function(_0x4c0036){try{jsonpatch[_0x60a5('0x1d')](_0x4c0036,_0x29a872,!![]);}catch(_0x1d1672){return BPromise[_0x60a5('0x1e')](_0x1d1672);}return _0x4c0036[_0x60a5('0x1f')]();};}function saveUpdates(_0xa2719c,_0x3b4c55){return function(_0x936d8e){if(_0x936d8e){return _0x936d8e['update'](_0xa2719c)[_0x60a5('0x20')](function(_0x59ee49){return _0x59ee49;});}return null;};}function removeEntity(_0x208fb1,_0x3148b1){return function(_0x5c1097){if(_0x5c1097){return _0x5c1097[_0x60a5('0x21')]()[_0x60a5('0x20')](function(){_0x208fb1[_0x60a5('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x465989,_0x18362b){return function(_0x4f3509){if(!_0x4f3509){_0x465989[_0x60a5('0x15')](0x194);}return _0x4f3509;};}function handleError(_0x3c4c4f,_0x24b8ab){_0x24b8ab=_0x24b8ab||0x1f4;return function(_0x426c45){logger[_0x60a5('0x22')](_0x426c45[_0x60a5('0x23')]);if(_0x426c45[_0x60a5('0x24')]){delete _0x426c45[_0x60a5('0x24')];}_0x3c4c4f['status'](_0x24b8ab)[_0x60a5('0x25')](_0x426c45);};}exports[_0x60a5('0x26')]=function(_0x5f2ffd,_0x41f83e){if(_0x5f2ffd['body']['id']){delete _0x5f2ffd[_0x60a5('0x27')]['id'];}return db[_0x60a5('0x28')][_0x60a5('0x29')]({'where':{'id':_0x5f2ffd['params']['id']}})[_0x60a5('0x20')](handleEntityNotFound(_0x41f83e,null))[_0x60a5('0x20')](saveUpdates(_0x5f2ffd[_0x60a5('0x27')],null))[_0x60a5('0x20')](respondWithResult(_0x41f83e,null))[_0x60a5('0x2a')](handleError(_0x41f83e,null));};exports[_0x60a5('0x21')]=function(_0x19e181,_0x20fbd1){return db['Action']['find']({'where':{'id':_0x19e181[_0x60a5('0x2b')]['id']}})[_0x60a5('0x20')](handleEntityNotFound(_0x20fbd1,null))[_0x60a5('0x20')](removeEntity(_0x20fbd1,null))[_0x60a5('0x2a')](handleError(_0x20fbd1,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index df5c2cb..56c232b 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 _0xf5ab=['path','rimraf','../../config/environment','./action.attributes','define','lodash','util','api','moment','bluebird'];(function(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0xf5ab,0x7d));var _0xbf5a=function(_0xd0c6f1,_0x5c6a47){_0xd0c6f1=_0xd0c6f1-0x0;var _0x20389b=_0xf5ab[_0xd0c6f1];return _0x20389b;};'use strict';var _=require(_0xbf5a('0x0'));var util=require(_0xbf5a('0x1'));var logger=require('../../config/logger')(_0xbf5a('0x2'));var moment=require(_0xbf5a('0x3'));var BPromise=require(_0xbf5a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbf5a('0x5'));var rimraf=require(_0xbf5a('0x6'));var config=require(_0xbf5a('0x7'));var attributes=require(_0xbf5a('0x8'));module['exports']=function(_0xe36c69,_0x4db9c9){return _0xe36c69[_0xbf5a('0x9')]('Action',attributes,{'tableName':'tools_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x17ad=['../../config/environment','exports','Action','tools_actions','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x470839,_0x505acc){var _0x36932d=function(_0xf95b06){while(--_0xf95b06){_0x470839['push'](_0x470839['shift']());}};_0x36932d(++_0x505acc);}(_0x17ad,0x1c0));var _0xd17a=function(_0x55b336,_0x4ecce9){_0x55b336=_0x55b336-0x0;var _0x352a84=_0x17ad[_0x55b336];return _0x352a84;};'use strict';var _=require(_0xd17a('0x0'));var util=require(_0xd17a('0x1'));var logger=require(_0xd17a('0x2'))('api');var moment=require(_0xd17a('0x3'));var BPromise=require(_0xd17a('0x4'));var rp=require(_0xd17a('0x5'));var fs=require('fs');var path=require(_0xd17a('0x6'));var rimraf=require(_0xd17a('0x7'));var config=require(_0xd17a('0x8'));var attributes=require('./action.attributes');module[_0xd17a('0x9')]=function(_0x10d1bc,_0x4c8847){return _0x10d1bc['define'](_0xd17a('0xa'),attributes,{'tableName':_0xd17a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/action/action.rpc.js b/server/api/action/action.rpc.js index 7e7ba0b..b179afb 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 _0xcb91=['stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s'];(function(_0x479ae9,_0x5d1056){var _0x31b9c8=function(_0x24555d){while(--_0x24555d){_0x479ae9['push'](_0x479ae9['shift']());}};_0x31b9c8(++_0x5d1056);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x10291b,_0x518773){_0x10291b=_0x10291b-0x0;var _0x1d5fbe=_0xcb91[_0x10291b];return _0x1d5fbe;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1cb9('0x0'));var BPromise=require(_0x1cb9('0x1'));var rs=require(_0x1cb9('0x2'));var fs=require('fs');var Redis=require(_0x1cb9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1cb9('0x4'));var logger=require(_0x1cb9('0x5'))('rpc');var config=require(_0x1cb9('0x6'));var jayson=require(_0x1cb9('0x7'));var client=jayson['client'][_0x1cb9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f7deb,_0x4ffe20,_0x38737d){return new BPromise(function(_0x12567c,_0x59d1be){return client[_0x1cb9('0x9')](_0x3f7deb,_0x38737d)['then'](function(_0x567139){logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,_0x1cb9('0xc'));logger[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x4ffe20,'request\x20sent',JSON[_0x1cb9('0xf')](_0x567139));if(_0x567139[_0x1cb9('0x10')]){if(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x11')]===0x1f4){logger[_0x1cb9('0x10')]('Action,\x20%s,\x20%s',_0x4ffe20,_0x567139['error']['message']);return _0x59d1be(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x567139['error'][_0x1cb9('0x12')]);return _0x12567c(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}else{logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,'request\x20sent');_0x12567c(_0x567139['result'][_0x1cb9('0x12')]);}})[_0x1cb9('0x13')](function(_0x3904b7){logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x3904b7);_0x59d1be(_0x3904b7);});});} \ No newline at end of file +var _0xcb91=['stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s'];(function(_0xeeb3ce,_0x7cf128){var _0x408d77=function(_0x151b47){while(--_0x151b47){_0xeeb3ce['push'](_0xeeb3ce['shift']());}};_0x408d77(++_0x7cf128);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x456fb1,_0x859a1d){_0x456fb1=_0x456fb1-0x0;var _0x4083d6=_0xcb91[_0x456fb1];return _0x4083d6;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1cb9('0x0'));var BPromise=require(_0x1cb9('0x1'));var rs=require(_0x1cb9('0x2'));var fs=require('fs');var Redis=require(_0x1cb9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1cb9('0x4'));var logger=require(_0x1cb9('0x5'))('rpc');var config=require(_0x1cb9('0x6'));var jayson=require(_0x1cb9('0x7'));var client=jayson['client'][_0x1cb9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f7deb,_0x4ffe20,_0x38737d){return new BPromise(function(_0x12567c,_0x59d1be){return client[_0x1cb9('0x9')](_0x3f7deb,_0x38737d)['then'](function(_0x567139){logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,_0x1cb9('0xc'));logger[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x4ffe20,'request\x20sent',JSON[_0x1cb9('0xf')](_0x567139));if(_0x567139[_0x1cb9('0x10')]){if(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x11')]===0x1f4){logger[_0x1cb9('0x10')]('Action,\x20%s,\x20%s',_0x4ffe20,_0x567139['error']['message']);return _0x59d1be(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x567139['error'][_0x1cb9('0x12')]);return _0x12567c(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}else{logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,'request\x20sent');_0x12567c(_0x567139['result'][_0x1cb9('0x12')]);}})[_0x1cb9('0x13')](function(_0x3904b7){logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x3904b7);_0x59d1be(_0x3904b7);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 3b9577d..c70a669 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 _0x9d73=['../../components/auth/service','../../config/environment','./action.controller','put','isAuthenticated','update','/:id','destroy','exports','util','express','Router'];(function(_0x29c2fb,_0x498f25){var _0x2515b5=function(_0x4365fc){while(--_0x4365fc){_0x29c2fb['push'](_0x29c2fb['shift']());}};_0x2515b5(++_0x498f25);}(_0x9d73,0x1ad));var _0x39d7=function(_0x538c52,_0x24cbca){_0x538c52=_0x538c52-0x0;var _0x298c33=_0x9d73[_0x538c52];return _0x298c33;};'use strict';var multer=require('multer');var util=require(_0x39d7('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x39d7('0x1'));var router=express[_0x39d7('0x2')]();var auth=require(_0x39d7('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x39d7('0x4'));var controller=require(_0x39d7('0x5'));router[_0x39d7('0x6')]('/:id',auth[_0x39d7('0x7')](),controller[_0x39d7('0x8')]);router['delete'](_0x39d7('0x9'),auth[_0x39d7('0x7')](),controller[_0x39d7('0xa')]);module[_0x39d7('0xb')]=router; \ No newline at end of file +var _0xf940=['express','Router','../../config/environment','put','delete','/:id','isAuthenticated','exports','multer','connect-timeout'];(function(_0x5d6520,_0x341d46){var _0x26017b=function(_0x5212b2){while(--_0x5212b2){_0x5d6520['push'](_0x5d6520['shift']());}};_0x26017b(++_0x341d46);}(_0xf940,0xd0));var _0x0f94=function(_0x334688,_0xf68c2c){_0x334688=_0x334688-0x0;var _0x42dc15=_0xf940[_0x334688];return _0x42dc15;};'use strict';var multer=require(_0x0f94('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x0f94('0x1'));var express=require(_0x0f94('0x2'));var router=express[_0x0f94('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x0f94('0x4'));var controller=require('./action.controller');router[_0x0f94('0x5')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x0f94('0x6')](_0x0f94('0x7'),auth[_0x0f94('0x8')](),controller['destroy']);module[_0x0f94('0x9')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 6eb5d58..4436bff 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 _0x4371=['exports','STRING','sequelize'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0x4371,0xd4));var _0x1437=function(_0x2a0e59,_0x586fcb){_0x2a0e59=_0x2a0e59-0x0;var _0x562b26=_0x4371[_0x2a0e59];return _0x562b26;};'use strict';var Sequelize=require(_0x1437('0x0'));module[_0x1437('0x1')]={'name':{'type':Sequelize[_0x1437('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x1437('0x2')]},'parent':{'type':Sequelize[_0x1437('0x2')]},'table':{'type':Sequelize[_0x1437('0x2')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x2f96=['STRING','TEXT','sequelize'];(function(_0x5664ea,_0x4cb50b){var _0x23152c=function(_0x5625a9){while(--_0x5625a9){_0x5664ea['push'](_0x5664ea['shift']());}};_0x23152c(++_0x4cb50b);}(_0x2f96,0x137));var _0x62f9=function(_0x66994b,_0x3d1f1f){_0x66994b=_0x66994b-0x0;var _0x3b43c8=_0x2f96[_0x66994b];return _0x3b43c8;};'use strict';var Sequelize=require(_0x62f9('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x62f9('0x1')]},'parent':{'type':Sequelize[_0x62f9('0x1')]},'table':{'type':Sequelize[_0x62f9('0x1')]},'conditions':{'type':Sequelize[_0x62f9('0x2')]},'joins':{'type':Sequelize[_0x62f9('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index d1216ac..5ca2c9c 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 _0xe43c=['condition','value','getFields','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','table','MetricId','replace','format','orderBy','alias','joins','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','parentKey','conditions','Limited\x20Query:','sequelize','toString','QueryTypes','SELECT','join','left_join','right_join','cross_join','SUM(%s)','AVG(%s)','DATE(%s)','UNIX_TIMESTAMP(%s)','IS\x20NULL','operator','metric','function','groupBy','parse','clone','debug','Sequelize','No\x20available\x20data','output','web','fullPath','%s-%s.%s','generate','csv','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','from','countTable','COUNT(*)','run','runReport','GROUP_CONCAT(%s)','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','lodash','crypto','desk.js','papaparse','ioredis','../../config/license/hardware','api','../../config/environment','../../mysqldb','dbH','sendStatus','status','offset','limit','Content-Range','json','apply','save','update','then','destroy','get','UserProfileResource','end','stack','name','index','AnalyticCustomReport','rawAttributes','fieldName','type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','merge','where','VIRTUAL','options','count','includeAll','findAll','catch','show','params','keys','include','create','user','UserProfileSection','find','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','preview','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','HOUR(%s)','ROUND(%s)','includes','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','group','field'];(function(_0x2389fb,_0x18c3e6){var _0x5160db=function(_0x3a8080){while(--_0x3a8080){_0x2389fb['push'](_0x2389fb['shift']());}};_0x5160db(++_0x18c3e6);}(_0xe43c,0x180));var _0xce43=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0xe43c[_0x11005e];return _0x29338f;};'use strict';var pdf=require(_0xce43('0x0'));var emlformat=require(_0xce43('0x1'));var rimraf=require(_0xce43('0x2'));var zipdir=require(_0xce43('0x3'));var jsonpatch=require(_0xce43('0x4'));var rp=require(_0xce43('0x5'));var moment=require('moment');var BPromise=require(_0xce43('0x6'));var Mustache=require('mustache');var util=require(_0xce43('0x7'));var path=require(_0xce43('0x8'));var sox=require(_0xce43('0x9'));var csv=require(_0xce43('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xce43('0xb'));var squel=require('squel');var crypto=require(_0xce43('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xce43('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xce43('0xe'));var Redis=require(_0xce43('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xce43('0x10'));var logger=require('../../config/logger')(_0xce43('0x11'));var utils=require('../../config/utils');var config=require(_0xce43('0x12'));var db=require('../../mysqldb')['db'];var dbH=require(_0xce43('0x13'))[_0xce43('0x14')];function respondWithStatusCode(_0x4c092b,_0x226f21){_0x226f21=_0x226f21||0xcc;return function(_0x1a74bf){if(_0x1a74bf){return _0x4c092b[_0xce43('0x15')](_0x226f21);}return _0x4c092b[_0xce43('0x16')](_0x226f21)['end']();};}function respondWithResult(_0x3034c7,_0x607d92){_0x607d92=_0x607d92||0xc8;return function(_0x3cd0f7){if(_0x3cd0f7){return _0x3034c7[_0xce43('0x16')](_0x607d92)['json'](_0x3cd0f7);}};}function respondWithFilteredResult(_0x588ddb,_0x3c0948){return function(_0x3e4218){if(_0x3e4218){var _0x2eb70b=_0x3e4218['count'],_0x2a9cb4=_0x3c0948[_0xce43('0x17')],_0xd5282=_0x3c0948[_0xce43('0x17')]+_0x3c0948[_0xce43('0x18')],_0x3f79bd;if(_0xd5282>=_0x2eb70b){_0xd5282=_0x2eb70b;_0x3f79bd=0xc8;}else{_0x3f79bd=0xce;}_0x588ddb[_0xce43('0x16')](_0x3f79bd);return _0x588ddb['set'](_0xce43('0x19'),_0x2a9cb4+'-'+_0xd5282+'/'+_0x2eb70b)[_0xce43('0x1a')](_0x3e4218);}return null;};}function patchUpdates(_0x1976eb){return function(_0x2506de){try{jsonpatch[_0xce43('0x1b')](_0x2506de,_0x1976eb,!![]);}catch(_0x3318a0){return BPromise['reject'](_0x3318a0);}return _0x2506de[_0xce43('0x1c')]();};}function saveUpdates(_0x383f69,_0x5973b9){return function(_0xe2ff3f){if(_0xe2ff3f){return _0xe2ff3f[_0xce43('0x1d')](_0x383f69)[_0xce43('0x1e')](function(_0x5a5bd1){return _0x5a5bd1;});}return null;};}function removeEntity(_0x57dcd4,_0x37b34e){return function(_0x30f5a1){if(_0x30f5a1){return _0x30f5a1[_0xce43('0x1f')]()[_0xce43('0x1e')](function(){var _0x2d8f7d=_0x30f5a1[_0xce43('0x20')]({'plain':!![]});var _0x118a89='CustomReports';return db[_0xce43('0x21')][_0xce43('0x1f')]({'where':{'type':_0x118a89,'resourceId':_0x2d8f7d['id']}})[_0xce43('0x1e')](function(){return _0x30f5a1;});})[_0xce43('0x1e')](function(){_0x57dcd4['status'](0xcc)[_0xce43('0x22')]();});}};}function handleEntityNotFound(_0x45fec7,_0x117ac1){return function(_0x1bb63f){if(!_0x1bb63f){_0x45fec7[_0xce43('0x15')](0x194);}return _0x1bb63f;};}function handleError(_0x272b45,_0x49e958){_0x49e958=_0x49e958||0x1f4;return function(_0x371985){logger['error'](_0x371985[_0xce43('0x23')]);if(_0x371985[_0xce43('0x24')]){delete _0x371985[_0xce43('0x24')];}_0x272b45[_0xce43('0x16')](_0x49e958)['send'](_0x371985);};}exports[_0xce43('0x25')]=function(_0x4402f8,_0x2a2d1d){var _0x44ac56={},_0x4b966a={},_0x6a9458={'count':0x0,'rows':[]};var _0x345eaf=_['map'](db[_0xce43('0x26')][_0xce43('0x27')],function(_0x124776){return{'name':_0x124776[_0xce43('0x28')],'type':_0x124776[_0xce43('0x29')][_0xce43('0x2a')]};});_0x4b966a['model']=_['map'](_0x345eaf,_0xce43('0x24'));_0x4b966a[_0xce43('0x2b')]=_['keys'](_0x4402f8[_0xce43('0x2b')]);_0x4b966a[_0xce43('0x2c')]=_[_0xce43('0x2d')](_0x4b966a[_0xce43('0x2e')],_0x4b966a[_0xce43('0x2b')]);_0x44ac56['attributes']=_[_0xce43('0x2d')](_0x4b966a[_0xce43('0x2e')],qs[_0xce43('0x2f')](_0x4402f8[_0xce43('0x2b')][_0xce43('0x2f')]));_0x44ac56[_0xce43('0x30')]=_0x44ac56[_0xce43('0x30')][_0xce43('0x31')]?_0x44ac56[_0xce43('0x30')]:_0x4b966a[_0xce43('0x2e')];if(!_0x4402f8[_0xce43('0x2b')][_0xce43('0x32')](_0xce43('0x33'))){_0x44ac56[_0xce43('0x18')]=qs[_0xce43('0x18')](_0x4402f8[_0xce43('0x2b')][_0xce43('0x18')]);_0x44ac56[_0xce43('0x17')]=qs['offset'](_0x4402f8[_0xce43('0x2b')][_0xce43('0x17')]);}_0x44ac56[_0xce43('0x34')]=qs[_0xce43('0x35')](_0x4402f8[_0xce43('0x2b')][_0xce43('0x35')]);_0x44ac56['where']=qs[_0xce43('0x2c')](_[_0xce43('0x36')](_0x4402f8[_0xce43('0x2b')],_0x4b966a[_0xce43('0x2c')]),_0x345eaf);if(_0x4402f8[_0xce43('0x2b')]['filter']){_0x44ac56['where']=_[_0xce43('0x37')](_0x44ac56[_0xce43('0x38')],{'$or':_['map'](_0x345eaf,function(_0x338c54){if(_0x338c54[_0xce43('0x29')]!==_0xce43('0x39')){var _0x2fcb62={};_0x2fcb62[_0x338c54['name']]={'$like':'%'+_0x4402f8[_0xce43('0x2b')]['filter']+'%'};return _0x2fcb62;}})});}_0x44ac56=_[_0xce43('0x37')]({},_0x44ac56,_0x4402f8[_0xce43('0x3a')]);var _0x522853={'where':_0x44ac56[_0xce43('0x38')]};return db[_0xce43('0x26')][_0xce43('0x3b')](_0x522853)['then'](function(_0x486c51){_0x6a9458[_0xce43('0x3b')]=_0x486c51;if(_0x4402f8[_0xce43('0x2b')][_0xce43('0x3c')]){_0x44ac56['include']=[{'all':!![]}];}return db[_0xce43('0x26')][_0xce43('0x3d')](_0x44ac56);})[_0xce43('0x1e')](function(_0x41565a){_0x6a9458['rows']=_0x41565a;return _0x6a9458;})[_0xce43('0x1e')](respondWithFilteredResult(_0x2a2d1d,_0x44ac56))[_0xce43('0x3e')](handleError(_0x2a2d1d,null));};exports[_0xce43('0x3f')]=function(_0xc55921,_0x3d8734){var _0x51f1f7={'raw':![],'where':{'id':_0xc55921[_0xce43('0x40')]['id']}},_0x2f6e23={};_0x2f6e23[_0xce43('0x2e')]=_['keys'](db['AnalyticCustomReport'][_0xce43('0x27')]);_0x2f6e23[_0xce43('0x2b')]=_[_0xce43('0x41')](_0xc55921[_0xce43('0x2b')]);_0x2f6e23[_0xce43('0x2c')]=_[_0xce43('0x2d')](_0x2f6e23[_0xce43('0x2e')],_0x2f6e23[_0xce43('0x2b')]);_0x51f1f7[_0xce43('0x30')]=_[_0xce43('0x2d')](_0x2f6e23[_0xce43('0x2e')],qs[_0xce43('0x2f')](_0xc55921[_0xce43('0x2b')][_0xce43('0x2f')]));_0x51f1f7[_0xce43('0x30')]=_0x51f1f7[_0xce43('0x30')][_0xce43('0x31')]?_0x51f1f7[_0xce43('0x30')]:_0x2f6e23['model'];if(_0xc55921[_0xce43('0x2b')][_0xce43('0x3c')]){_0x51f1f7[_0xce43('0x42')]=[{'all':!![]}];}_0x51f1f7=_['merge']({},_0x51f1f7,_0xc55921['options']);return db[_0xce43('0x26')]['find'](_0x51f1f7)['then'](handleEntityNotFound(_0x3d8734,null))['then'](respondWithResult(_0x3d8734,null))['catch'](handleError(_0x3d8734,null));};exports[_0xce43('0x43')]=function(_0x1b37ab,_0x5c177d){return db[_0xce43('0x26')]['create'](_0x1b37ab['body'],{})[_0xce43('0x1e')](function(_0x562963){var _0x55181e=_0x1b37ab[_0xce43('0x44')][_0xce43('0x20')]({'plain':!![]});if(!_0x55181e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x55181e['role']===_0xce43('0x44')){var _0x4a5f2d=_0x562963[_0xce43('0x20')]({'plain':!![]});var _0x19458a='Reports';return db[_0xce43('0x45')][_0xce43('0x46')]({'where':{'name':_0x19458a,'userProfileId':_0x55181e[_0xce43('0x47')]},'raw':!![]})[_0xce43('0x1e')](function(_0x24a969){if(_0x24a969&&_0x24a969[_0xce43('0x48')]===0x0){return db[_0xce43('0x21')][_0xce43('0x43')]({'name':_0x4a5f2d[_0xce43('0x24')],'resourceId':_0x4a5f2d['id'],'type':'CustomReports','sectionId':_0x24a969['id']},{})['then'](function(){return _0x562963;});}else{return _0x562963;}})[_0xce43('0x3e')](function(_0x25fb99){logger[_0xce43('0x49')](_0xce43('0x4a'),_0x25fb99);throw _0x25fb99;});}return _0x562963;})[_0xce43('0x1e')](respondWithResult(_0x5c177d,0xc9))[_0xce43('0x3e')](handleError(_0x5c177d,null));};exports['update']=function(_0x3f7f21,_0x360ff6){if(_0x3f7f21[_0xce43('0x4b')]['id']){delete _0x3f7f21[_0xce43('0x4b')]['id'];}return db[_0xce43('0x26')][_0xce43('0x46')]({'where':{'id':_0x3f7f21[_0xce43('0x40')]['id']}})[_0xce43('0x1e')](handleEntityNotFound(_0x360ff6,null))[_0xce43('0x1e')](saveUpdates(_0x3f7f21[_0xce43('0x4b')],null))[_0xce43('0x1e')](respondWithResult(_0x360ff6,null))['catch'](handleError(_0x360ff6,null));};exports[_0xce43('0x1f')]=function(_0x680111,_0x3789ef){return db['AnalyticCustomReport'][_0xce43('0x46')]({'where':{'id':_0x680111[_0xce43('0x40')]['id']}})[_0xce43('0x1e')](handleEntityNotFound(_0x3789ef,null))['then'](removeEntity(_0x3789ef,null))['catch'](handleError(_0x3789ef,null));};exports[_0xce43('0x4c')]=function(_0x509e8b,_0x3c4df5){var _0x2a7d36=0xa;var _0x44e351=['join','left_join','right_join','cross_join'];var _0x507c85={'SUM':'SUM(%s)','COUNT':_0xce43('0x4d'),'COUNT DISTINCT':_0xce43('0x4e'),'MAX':_0xce43('0x4f'),'MIN':_0xce43('0x50'),'AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xce43('0x51'),'GROUP_CONCAT DESC':_0xce43('0x52')};var _0x3b26ac={'SEC_TO_TIME':_0xce43('0x53'),'DATE':'DATE(%s)','HOUR':_0xce43('0x54'),'ROUND':_0xce43('0x55'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x34fb0d=function(_0x3737e8){return!_[_0xce43('0x56')](['IS\x20NULL',_0xce43('0x57'),_0xce43('0x58'),_0xce43('0x59')],_0x3737e8);};var _0x509c2d=function(_0x4c8296){if(!_0x4c8296||!_0x4c8296[_0xce43('0x5a')]['length']){return'';}for(var _0x40e11b='(',_0x4a0ad1=0x0;_0x4a0ad1<_0x4c8296[_0xce43('0x5a')]['length'];_0x4a0ad1+=0x1){_0x4a0ad1>0x0&&(_0x40e11b+='\x20'+_0x4c8296['operator']+'\x20');_0x40e11b+=_0x4c8296[_0xce43('0x5a')][_0x4a0ad1]['group']?_0x509c2d(_0x4c8296[_0xce43('0x5a')][_0x4a0ad1][_0xce43('0x5b')]):_0x4c8296[_0xce43('0x5a')][_0x4a0ad1][_0xce43('0x5c')]+'\x20'+_0x4c8296[_0xce43('0x5a')][_0x4a0ad1][_0xce43('0x5d')]+(_0x34fb0d(_0x4c8296[_0xce43('0x5a')][_0x4a0ad1][_0xce43('0x5d')])?'\x20'+_0x4c8296[_0xce43('0x5a')][_0x4a0ad1][_0xce43('0x5e')]:'');}return _0x40e11b+')';};var _0x806287={'where':{'id':_0x509e8b[_0xce43('0x40')]['id']}},_0x494f10,_0x282f24,_0x3fee60,_0x25b2a8,_0x286d08;_0x806287=_[_0xce43('0x37')]({},_0x806287,_0x509e8b[_0xce43('0x3a')]);return db[_0xce43('0x26')]['find'](_0x806287)['then'](function(_0x22d277){if(_0x22d277){_0x494f10=_0x22d277;return _0x22d277[_0xce43('0x5f')]();}return null;})['then'](function(_0x1b46fb){if(_0x1b46fb){if(!_0x1b46fb['length']){throw new db['Sequelize'][(_0xce43('0x60'))](_0xce43('0x61'),0x193);}_0x282f24=_0x1b46fb;return db[_0xce43('0x62')][_0xce43('0x3d')]({'raw':!![]});}return null;})[_0xce43('0x1e')](function(_0x4b1f4e){if(_0x4b1f4e){_0x3fee60=_[_0xce43('0x63')](_0x4b1f4e,'id');var _0x3b83b3;var _0x49d33e=squel[_0xce43('0x64')]();_0x49d33e['from'](_0x494f10[_0xce43('0x65')]);for(var _0x31c96e=0x0;_0x31c96e<_0x282f24[_0xce43('0x31')];_0x31c96e+=0x1){_0x3b83b3=_0x282f24[_0x31c96e]['MetricId']?_0x3fee60[_0x282f24[_0x31c96e][_0xce43('0x66')]]['metric']:_0x282f24[_0x31c96e][_0xce43('0x5c')];_0x3b83b3=_0x282f24[_0x31c96e]['function']?_[_0xce43('0x67')](_0x507c85[_0x282f24[_0x31c96e]['function']],'%s',_0x3b83b3):_0x3b83b3;_0x3b83b3=_0x282f24[_0x31c96e]['format']?_['replace'](_0x3b26ac[_0x282f24[_0x31c96e][_0xce43('0x68')]],'%s',_0x3b83b3):_0x3b83b3;if(_0x282f24[_0x31c96e]['groupBy']){_0x49d33e['group'](_0x3b83b3);}_0x282f24[_0x31c96e][_0xce43('0x69')]&&_0x49d33e[_0xce43('0x34')](_0x3b83b3,_0x282f24[_0x31c96e][_0xce43('0x69')]==='DESC'?![]:!![]);_0x49d33e[_0xce43('0x5c')](_0x3b83b3,_0x282f24[_0x31c96e][_0xce43('0x6a')]||_0x3b83b3);}if(_0x494f10[_0xce43('0x6b')]){_0x494f10[_0xce43('0x6b')]=JSON['parse'](_0x494f10['joins']);for(var _0x1b4b62=0x0;_0x1b4b62<_0x494f10[_0xce43('0x6b')][_0xce43('0x31')];_0x1b4b62+=0x1){if(_0x494f10[_0xce43('0x6b')][_0x1b4b62]['type']&&_[_0xce43('0x56')](_0x44e351,_0x494f10[_0xce43('0x6b')][_0x1b4b62]['type'])&&_0x494f10[_0xce43('0x6b')][_0x1b4b62]['parentKey']&&_0x494f10[_0xce43('0x6b')][_0x1b4b62][_0xce43('0x6c')]&&_0x494f10[_0xce43('0x6b')][_0x1b4b62][_0xce43('0x6d')]){_0x49d33e[_0x494f10[_0xce43('0x6b')][_0x1b4b62][_0xce43('0x29')]](_0x494f10[_0xce43('0x6b')][_0x1b4b62][_0xce43('0x6c')],null,util[_0xce43('0x68')](_0xce43('0x6e'),_0x494f10[_0xce43('0x65')],_0x494f10[_0xce43('0x6b')][_0x1b4b62][_0xce43('0x6f')],_0x494f10[_0xce43('0x6b')][_0x1b4b62]['foreignTable'],_0x494f10['joins'][_0x1b4b62][_0xce43('0x6d')]));}}}if(_0x494f10[_0xce43('0x70')]){_0x494f10[_0xce43('0x70')]=JSON['parse'](_0x494f10[_0xce43('0x70')]);_0x49d33e['where'](_0x509c2d(_0x494f10[_0xce43('0x70')][_0xce43('0x5b')]));}_0x286d08=_0x49d33e['clone']();_0x49d33e[_0xce43('0x18')](_0x2a7d36);_0x49d33e[_0xce43('0x17')](0x0);logger['debug'](_0xce43('0x71'),_0x49d33e['toString']());return db[_0xce43('0x72')][_0xce43('0x2b')](_0x49d33e[_0xce43('0x73')](),{'type':db[_0xce43('0x72')][_0xce43('0x74')][_0xce43('0x75')]});}})[_0xce43('0x1e')](respondWithResult(_0x3c4df5,null))[_0xce43('0x3e')](handleError(_0x3c4df5,null));};function runReport(_0x393552,_0x3c1c6d,_0x2b2599){var _0x561dab=_0x3c1c6d['name'];var _0x5c2865=0xa;var _0x3a44cf=[_0xce43('0x76'),_0xce43('0x77'),_0xce43('0x78'),_0xce43('0x79')];var _0x3bedeb={'SUM':_0xce43('0x7a'),'COUNT':_0xce43('0x4d'),'COUNT DISTINCT':_0xce43('0x4e'),'MAX':_0xce43('0x4f'),'MIN':'MIN(%s)','AVG':_0xce43('0x7b'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xce43('0x52')};var _0x3694b3={'SEC_TO_TIME':_0xce43('0x53'),'DATE':_0xce43('0x7c'),'HOUR':_0xce43('0x54'),'ROUND':_0xce43('0x55'),'UNIX_TIMESTAMP':_0xce43('0x7d')};var _0x13f712=function(_0x437045){return!_[_0xce43('0x56')]([_0xce43('0x7e'),_0xce43('0x57'),_0xce43('0x58'),'IS\x20NOT\x20EMPTY'],_0x437045);};var _0x302704=function(_0x9d4a47){if(!_0x9d4a47||!_0x9d4a47['rules'][_0xce43('0x31')]){return'';}for(var _0x213c62='(',_0x8d10df=0x0;_0x8d10df<_0x9d4a47['rules'][_0xce43('0x31')];_0x8d10df+=0x1){_0x8d10df>0x0&&(_0x213c62+='\x20'+_0x9d4a47[_0xce43('0x7f')]+'\x20');_0x213c62+=_0x9d4a47[_0xce43('0x5a')][_0x8d10df][_0xce43('0x5b')]?_0x302704(_0x9d4a47['rules'][_0x8d10df]['group']):_0x9d4a47[_0xce43('0x5a')][_0x8d10df][_0xce43('0x5c')]+'\x20'+_0x9d4a47[_0xce43('0x5a')][_0x8d10df][_0xce43('0x5d')]+(_0x13f712(_0x9d4a47[_0xce43('0x5a')][_0x8d10df][_0xce43('0x5d')])?'\x20'+_0x9d4a47[_0xce43('0x5a')][_0x8d10df]['value']:'');}return _0x213c62+')';};var _0x17a9f3={'where':{'id':_0x393552['id']}},_0x43c1ac,_0x33881f,_0x3fe1f8,_0x18cefb,_0x58f5fd;_0x17a9f3=_[_0xce43('0x37')]({},_0x17a9f3,_0x2b2599);return db[_0xce43('0x26')][_0xce43('0x46')](_0x17a9f3)[_0xce43('0x1e')](function(_0x2d3d2d){if(_0x2d3d2d){_0x43c1ac=_0x2d3d2d;return _0x2d3d2d[_0xce43('0x5f')]();}return null;})[_0xce43('0x1e')](function(_0x380dac){if(_0x380dac){if(!_0x380dac[_0xce43('0x31')]){throw new db['Sequelize'][(_0xce43('0x60'))](_0xce43('0x61'),0x193);}_0x33881f=_0x380dac;return db[_0xce43('0x62')]['findAll']({'raw':!![]});}return null;})[_0xce43('0x1e')](function(_0x297172){if(_0x297172){_0x3fe1f8=_['keyBy'](_0x297172,'id');var _0x2ef893;var _0x2e3ab6=squel[_0xce43('0x64')]();_0x2e3ab6['from'](_0x43c1ac[_0xce43('0x65')]);for(var _0x53f9da=0x0;_0x53f9da<_0x33881f[_0xce43('0x31')];_0x53f9da+=0x1){_0x2ef893=_0x33881f[_0x53f9da][_0xce43('0x66')]?_0x3fe1f8[_0x33881f[_0x53f9da][_0xce43('0x66')]][_0xce43('0x80')]:_0x33881f[_0x53f9da][_0xce43('0x5c')];_0x2ef893=_0x33881f[_0x53f9da][_0xce43('0x81')]?_[_0xce43('0x67')](_0x3bedeb[_0x33881f[_0x53f9da][_0xce43('0x81')]],'%s',_0x2ef893):_0x2ef893;_0x2ef893=_0x33881f[_0x53f9da][_0xce43('0x68')]?_['replace'](_0x3694b3[_0x33881f[_0x53f9da][_0xce43('0x68')]],'%s',_0x2ef893):_0x2ef893;if(_0x33881f[_0x53f9da][_0xce43('0x82')]){_0x2e3ab6[_0xce43('0x5b')](_0x2ef893);}_0x33881f[_0x53f9da][_0xce43('0x69')]&&_0x2e3ab6[_0xce43('0x34')](_0x2ef893,_0x33881f[_0x53f9da][_0xce43('0x69')]==='DESC'?![]:!![]);_0x2e3ab6[_0xce43('0x5c')](_0x2ef893,_0x33881f[_0x53f9da][_0xce43('0x6a')]||_0x2ef893);}if(_0x43c1ac[_0xce43('0x6b')]){_0x43c1ac[_0xce43('0x6b')]=JSON[_0xce43('0x83')](_0x43c1ac[_0xce43('0x6b')]);for(var _0x651be4=0x0;_0x651be4<_0x43c1ac[_0xce43('0x6b')][_0xce43('0x31')];_0x651be4+=0x1){if(_0x43c1ac[_0xce43('0x6b')][_0x651be4][_0xce43('0x29')]&&_[_0xce43('0x56')](_0x3a44cf,_0x43c1ac[_0xce43('0x6b')][_0x651be4][_0xce43('0x29')])&&_0x43c1ac[_0xce43('0x6b')][_0x651be4][_0xce43('0x6f')]&&_0x43c1ac[_0xce43('0x6b')][_0x651be4][_0xce43('0x6c')]&&_0x43c1ac['joins'][_0x651be4][_0xce43('0x6d')]){_0x2e3ab6[_0x43c1ac[_0xce43('0x6b')][_0x651be4][_0xce43('0x29')]](_0x43c1ac['joins'][_0x651be4][_0xce43('0x6c')],null,util[_0xce43('0x68')](_0xce43('0x6e'),_0x43c1ac['table'],_0x43c1ac[_0xce43('0x6b')][_0x651be4][_0xce43('0x6f')],_0x43c1ac['joins'][_0x651be4][_0xce43('0x6c')],_0x43c1ac['joins'][_0x651be4][_0xce43('0x6d')]));}}}if(_0x43c1ac[_0xce43('0x70')]){_0x43c1ac[_0xce43('0x70')]=JSON[_0xce43('0x83')](_0x43c1ac[_0xce43('0x70')]);_0x2e3ab6['where'](_0x302704(_0x43c1ac[_0xce43('0x70')][_0xce43('0x5b')]));}_0x58f5fd=_0x2e3ab6[_0xce43('0x84')]();_0x2e3ab6[_0xce43('0x18')](_0x5c2865);_0x2e3ab6['offset'](0x0);logger[_0xce43('0x85')](_0xce43('0x71'),_0x2e3ab6[_0xce43('0x73')]());return db[_0xce43('0x72')][_0xce43('0x2b')](_0x2e3ab6[_0xce43('0x73')](),{'type':db[_0xce43('0x72')][_0xce43('0x74')][_0xce43('0x75')]});}})[_0xce43('0x1e')](function(_0x43af97){if(!_0x43af97[_0xce43('0x31')]){throw new db[(_0xce43('0x86'))]['ValidationErrorItem'](_0xce43('0x87'),0xcc);}if(_0x3c1c6d[_0xce43('0x88')]===_0xce43('0x89')){return null;}var _0x5cfd2f=_[_0xce43('0x37')](_0x3c1c6d,{'name':_0x3c1c6d[_0xce43('0x8a')]||_0x3c1c6d['name']||_0x43c1ac[_0xce43('0x24')],'basename':_0x561dab,'savename':util[_0xce43('0x68')](_0xce43('0x8b'),_0x3c1c6d[_0xce43('0x24')]||_0x43c1ac['name'],require('randomstring')[_0xce43('0x8c')](0x4),_0x3c1c6d['output']||_0xce43('0x8d')),'reportId':_0x43c1ac['id'],'reportType':'custom'});return db['AnalyticExtractedReport'][_0xce43('0x43')](_0x5cfd2f,{'raw':!![]});})['then'](function(_0x34ce6b){if(_0x43c1ac['table']==='cdr'){_0x58f5fd['where'](_0x43c1ac[_0xce43('0x65')]+_0xce43('0x8e'),_0x3c1c6d[_0xce43('0x8f')],_0x3c1c6d[_0xce43('0x90')]);}else{_0x58f5fd[_0xce43('0x38')](_0x43c1ac[_0xce43('0x65')]+_0xce43('0x91'),_0x3c1c6d[_0xce43('0x8f')],_0x3c1c6d['endDate']);}if(_0x34ce6b){logger[_0xce43('0x92')](_0xce43('0x93'),_0x58f5fd[_0xce43('0x73')]());require(_0xce43('0x94'))[_0xce43('0x95')](path['join'](__dirname,_0xce43('0x96'),_0x34ce6b[_0xce43('0x88')]),[_0x34ce6b['id'],_0x58f5fd[_0xce43('0x73')](),path[_0xce43('0x76')](__dirname,_0xce43('0x97'),_0x34ce6b[_0xce43('0x98')]),_0x561dab]);return _0x34ce6b;}else{var _0x159438=squel[_0xce43('0x64')]();_0x159438[_0xce43('0x99')]('('+_0x58f5fd[_0xce43('0x73')]()+')',_0xce43('0x9a'));_0x159438['field'](_0xce43('0x9b'),_0xce43('0x3b'));_0x58f5fd[_0xce43('0x18')](_0x3c1c6d[_0xce43('0x18')]||_0x5c2865);_0x58f5fd[_0xce43('0x17')](_0x3c1c6d['offset']||0x0);return dbH[_0xce43('0x72')][_0xce43('0x2b')](_0x159438[_0xce43('0x73')](),{'type':dbH[_0xce43('0x72')][_0xce43('0x74')][_0xce43('0x75')]})[_0xce43('0x1e')](function(_0x478cea){if(!_0x478cea[_0xce43('0x31')]){_0x18cefb=0x0;}else{_0x18cefb=_0x478cea[0x0][_0xce43('0x3b')]||0x0;}return dbH[_0xce43('0x72')][_0xce43('0x2b')](_0x58f5fd[_0xce43('0x73')](),{'type':dbH[_0xce43('0x72')][_0xce43('0x74')][_0xce43('0x75')]});})[_0xce43('0x1e')](function(_0x130139){return{'rows':_0x130139||[],'count':_0x18cefb};});}});}exports[_0xce43('0x9c')]=function(_0x271da1,_0xd2661f){return runReport(_0x271da1[_0xce43('0x40')],_0x271da1['query'],_0x271da1[_0xce43('0x3a')])['then'](respondWithResult(_0xd2661f,null))[_0xce43('0x3e')](handleError(_0xd2661f,null));};exports[_0xce43('0x9d')]=runReport;exports[_0xce43('0x2b')]=function(_0x5f07d2,_0x519e17){var _0x4914d6=0xa;var _0x260923=[_0xce43('0x76'),_0xce43('0x77'),'right_join',_0xce43('0x79')];var _0x2598d1={'SUM':_0xce43('0x7a'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xce43('0x4e'),'MAX':_0xce43('0x4f'),'MIN':'MIN(%s)','AVG':_0xce43('0x7b'),'GROUP_CONCAT':_0xce43('0x9e'),'GROUP_CONCAT ASC':_0xce43('0x51'),'GROUP_CONCAT DESC':_0xce43('0x52')};var _0x479c03={'SEC_TO_TIME':_0xce43('0x53'),'DATE':_0xce43('0x7c'),'HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xce43('0x7d')};var _0x2a38d7=function(_0x1ff86a){return!_[_0xce43('0x56')](['IS\x20NULL',_0xce43('0x57'),_0xce43('0x58'),_0xce43('0x59')],_0x1ff86a);};var _0x5b8f02=function(_0x42c9b9){if(!_0x42c9b9||!_0x42c9b9['rules'][_0xce43('0x31')]){return'';}for(var _0x20c076='(',_0x5e0db4=0x0;_0x5e0db4<_0x42c9b9[_0xce43('0x5a')]['length'];_0x5e0db4+=0x1){_0x5e0db4>0x0&&(_0x20c076+='\x20'+_0x42c9b9[_0xce43('0x7f')]+'\x20');_0x20c076+=_0x42c9b9[_0xce43('0x5a')][_0x5e0db4]['group']?_0x5b8f02(_0x42c9b9['rules'][_0x5e0db4][_0xce43('0x5b')]):_0x42c9b9['rules'][_0x5e0db4][_0xce43('0x5c')]+'\x20'+_0x42c9b9['rules'][_0x5e0db4]['condition']+(_0x2a38d7(_0x42c9b9[_0xce43('0x5a')][_0x5e0db4]['condition'])?'\x20'+_0x42c9b9[_0xce43('0x5a')][_0x5e0db4]['value']:'');}return _0x20c076+')';};var _0x11c177={'where':{'id':_0x5f07d2[_0xce43('0x40')]['id']}},_0x55455f,_0x41d8fc,_0x59779e,_0x56c721,_0x494280;_0x11c177=_[_0xce43('0x37')]({},_0x11c177,_0x5f07d2['options']);return db[_0xce43('0x26')][_0xce43('0x46')](_0x11c177)[_0xce43('0x1e')](function(_0x4be50b){if(_0x4be50b){_0x55455f=_0x4be50b;return _0x4be50b[_0xce43('0x5f')]();}return null;})[_0xce43('0x1e')](function(_0xfeb8cc){if(_0xfeb8cc){if(!_0xfeb8cc[_0xce43('0x31')]){throw new db['Sequelize'][(_0xce43('0x60'))](_0xce43('0x61'),0x193);}_0x41d8fc=_0xfeb8cc;return db[_0xce43('0x62')]['findAll']({'raw':!![]});}return null;})[_0xce43('0x1e')](function(_0x1ced9f){if(_0x1ced9f){_0x59779e=_[_0xce43('0x63')](_0x1ced9f,'id');var _0x314163;var _0x929532=squel[_0xce43('0x64')]();_0x929532[_0xce43('0x99')](_0x55455f[_0xce43('0x65')]);for(var _0x535a25=0x0;_0x535a25<_0x41d8fc['length'];_0x535a25+=0x1){_0x314163=_0x41d8fc[_0x535a25][_0xce43('0x66')]?_0x59779e[_0x41d8fc[_0x535a25][_0xce43('0x66')]][_0xce43('0x80')]:_0x41d8fc[_0x535a25][_0xce43('0x5c')];_0x314163=_0x41d8fc[_0x535a25][_0xce43('0x81')]?_[_0xce43('0x67')](_0x2598d1[_0x41d8fc[_0x535a25][_0xce43('0x81')]],'%s',_0x314163):_0x314163;_0x314163=_0x41d8fc[_0x535a25]['format']?_['replace'](_0x479c03[_0x41d8fc[_0x535a25][_0xce43('0x68')]],'%s',_0x314163):_0x314163;if(_0x41d8fc[_0x535a25]['groupBy']){_0x929532['group'](_0x314163);}_0x41d8fc[_0x535a25][_0xce43('0x69')]&&_0x929532[_0xce43('0x34')](_0x314163,_0x41d8fc[_0x535a25]['orderBy']==='DESC'?![]:!![]);_0x929532[_0xce43('0x5c')](_0x314163,_0x41d8fc[_0x535a25][_0xce43('0x6a')]||_0x314163);}if(_0x55455f[_0xce43('0x6b')]){_0x55455f['joins']=JSON[_0xce43('0x83')](_0x55455f[_0xce43('0x6b')]);for(var _0x117fad=0x0;_0x117fad<_0x55455f[_0xce43('0x6b')][_0xce43('0x31')];_0x117fad+=0x1){if(_0x55455f['joins'][_0x117fad][_0xce43('0x29')]&&_[_0xce43('0x56')](_0x260923,_0x55455f[_0xce43('0x6b')][_0x117fad][_0xce43('0x29')])&&_0x55455f[_0xce43('0x6b')][_0x117fad][_0xce43('0x6f')]&&_0x55455f[_0xce43('0x6b')][_0x117fad][_0xce43('0x6c')]&&_0x55455f[_0xce43('0x6b')][_0x117fad][_0xce43('0x6d')]){_0x929532[_0x55455f[_0xce43('0x6b')][_0x117fad][_0xce43('0x29')]](_0x55455f[_0xce43('0x6b')][_0x117fad][_0xce43('0x6c')],null,util[_0xce43('0x68')](_0xce43('0x6e'),_0x55455f[_0xce43('0x65')],_0x55455f[_0xce43('0x6b')][_0x117fad][_0xce43('0x6f')],_0x55455f['joins'][_0x117fad]['foreignTable'],_0x55455f[_0xce43('0x6b')][_0x117fad][_0xce43('0x6d')]));}}}if(_0x55455f[_0xce43('0x70')]){_0x55455f[_0xce43('0x70')]=JSON['parse'](_0x55455f[_0xce43('0x70')]);_0x929532[_0xce43('0x38')](_0x5b8f02(_0x55455f[_0xce43('0x70')][_0xce43('0x5b')]));}_0x494280=_0x929532[_0xce43('0x84')]();_0x929532['limit'](_0x4914d6);_0x929532[_0xce43('0x17')](0x0);logger[_0xce43('0x85')](_0xce43('0x71'),_0x929532[_0xce43('0x73')]());return db[_0xce43('0x72')][_0xce43('0x2b')](_0x929532['toString'](),{'type':db[_0xce43('0x72')][_0xce43('0x74')]['SELECT']});}})[_0xce43('0x1e')](function(){return{'sql':_0x494280[_0xce43('0x73')]()};})['then'](respondWithResult(_0x519e17,null))[_0xce43('0x3e')](handleError(_0x519e17,null));}; \ No newline at end of file +var _0x2dae=['MIN(%s)','IS\x20NULL','IS\x20EMPTY','select','metric','DESC','Limited\x20Query:','No\x20available\x20data','output','web','fullPath','%s-%s.%s','randomstring','csv','custom','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','endDate','info','child_process','fork','../../components/export/','../../files/reports','savename','COUNT(*)','UNIX_TIMESTAMP(%s)','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','reject','save','then','destroy','get','UserProfileResource','error','stack','name','index','map','AnalyticCustomReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','catch','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Reports','UserProfileSection','userProfileId','CustomReports','update','preview','join','left_join','right_join','cross_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)','ROUND(%s)','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','from','table','MetricId','function','format','replace','groupBy','orderBy','alias','joins','parse','includes','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','clone','debug','toString','sequelize','QueryTypes'];(function(_0x59e690,_0x4d4827){var _0x149377=function(_0x337ce1){while(--_0x337ce1){_0x59e690['push'](_0x59e690['shift']());}};_0x149377(++_0x4d4827);}(_0x2dae,0xc3));var _0xe2da=function(_0x5712f8,_0x17156b){_0x5712f8=_0x5712f8-0x0;var _0x14a364=_0x2dae[_0x5712f8];return _0x14a364;};'use strict';var pdf=require(_0xe2da('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xe2da('0x1'));var zipdir=require(_0xe2da('0x2'));var jsonpatch=require(_0xe2da('0x3'));var rp=require(_0xe2da('0x4'));var moment=require(_0xe2da('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xe2da('0x6'));var util=require(_0xe2da('0x7'));var path=require(_0xe2da('0x8'));var sox=require(_0xe2da('0x9'));var csv=require('to-csv');var ejs=require(_0xe2da('0xa'));var fs=require('fs');var _=require(_0xe2da('0xb'));var squel=require(_0xe2da('0xc'));var crypto=require(_0xe2da('0xd'));var jsforce=require(_0xe2da('0xe'));var deskjs=require(_0xe2da('0xf'));var toCsv=require(_0xe2da('0x10'));var querystring=require(_0xe2da('0x11'));var Papa=require(_0xe2da('0x12'));var Redis=require('ioredis');var authService=require(_0xe2da('0x13'));var qs=require(_0xe2da('0x14'));var as=require(_0xe2da('0x15'));var hardwareService=require(_0xe2da('0x16'));var logger=require(_0xe2da('0x17'))(_0xe2da('0x18'));var utils=require(_0xe2da('0x19'));var config=require(_0xe2da('0x1a'));var db=require('../../mysqldb')['db'];var dbH=require(_0xe2da('0x1b'))['dbH'];function respondWithStatusCode(_0x4377c6,_0x245ad7){_0x245ad7=_0x245ad7||0xcc;return function(_0x37064e){if(_0x37064e){return _0x4377c6[_0xe2da('0x1c')](_0x245ad7);}return _0x4377c6[_0xe2da('0x1d')](_0x245ad7)[_0xe2da('0x1e')]();};}function respondWithResult(_0x295a86,_0x48584b){_0x48584b=_0x48584b||0xc8;return function(_0x236e7a){if(_0x236e7a){return _0x295a86['status'](_0x48584b)['json'](_0x236e7a);}};}function respondWithFilteredResult(_0x403d1c,_0x3dfc52){return function(_0x33f919){if(_0x33f919){var _0x4dc58b=_0x33f919[_0xe2da('0x1f')],_0x25d4fa=_0x3dfc52['offset'],_0x2c0353=_0x3dfc52[_0xe2da('0x20')]+_0x3dfc52[_0xe2da('0x21')],_0x2ea60e;if(_0x2c0353>=_0x4dc58b){_0x2c0353=_0x4dc58b;_0x2ea60e=0xc8;}else{_0x2ea60e=0xce;}_0x403d1c[_0xe2da('0x1d')](_0x2ea60e);return _0x403d1c[_0xe2da('0x22')](_0xe2da('0x23'),_0x25d4fa+'-'+_0x2c0353+'/'+_0x4dc58b)['json'](_0x33f919);}return null;};}function patchUpdates(_0x56eeb1){return function(_0x2e16b2){try{jsonpatch['apply'](_0x2e16b2,_0x56eeb1,!![]);}catch(_0x1a9324){return BPromise[_0xe2da('0x24')](_0x1a9324);}return _0x2e16b2[_0xe2da('0x25')]();};}function saveUpdates(_0x203d36,_0x336415){return function(_0x3e22de){if(_0x3e22de){return _0x3e22de['update'](_0x203d36)[_0xe2da('0x26')](function(_0x53cc4e){return _0x53cc4e;});}return null;};}function removeEntity(_0x30efdc,_0x191d38){return function(_0x395af6){if(_0x395af6){return _0x395af6[_0xe2da('0x27')]()[_0xe2da('0x26')](function(){var _0x1e45e9=_0x395af6[_0xe2da('0x28')]({'plain':!![]});var _0x221e98='CustomReports';return db[_0xe2da('0x29')][_0xe2da('0x27')]({'where':{'type':_0x221e98,'resourceId':_0x1e45e9['id']}})[_0xe2da('0x26')](function(){return _0x395af6;});})[_0xe2da('0x26')](function(){_0x30efdc[_0xe2da('0x1d')](0xcc)[_0xe2da('0x1e')]();});}};}function handleEntityNotFound(_0x124d93,_0x56c37e){return function(_0x2adc49){if(!_0x2adc49){_0x124d93[_0xe2da('0x1c')](0x194);}return _0x2adc49;};}function handleError(_0x1dc228,_0x38ee5e){_0x38ee5e=_0x38ee5e||0x1f4;return function(_0x36ca43){logger[_0xe2da('0x2a')](_0x36ca43[_0xe2da('0x2b')]);if(_0x36ca43[_0xe2da('0x2c')]){delete _0x36ca43['name'];}_0x1dc228['status'](_0x38ee5e)['send'](_0x36ca43);};}exports[_0xe2da('0x2d')]=function(_0x8c91db,_0x4146ad){var _0x1ab91a={},_0x5de7fb={},_0x490794={'count':0x0,'rows':[]};var _0x356ab4=_[_0xe2da('0x2e')](db[_0xe2da('0x2f')][_0xe2da('0x30')],function(_0x7ab5ee){return{'name':_0x7ab5ee[_0xe2da('0x31')],'type':_0x7ab5ee[_0xe2da('0x32')][_0xe2da('0x33')]};});_0x5de7fb[_0xe2da('0x34')]=_['map'](_0x356ab4,'name');_0x5de7fb[_0xe2da('0x35')]=_[_0xe2da('0x36')](_0x8c91db[_0xe2da('0x35')]);_0x5de7fb[_0xe2da('0x37')]=_[_0xe2da('0x38')](_0x5de7fb[_0xe2da('0x34')],_0x5de7fb[_0xe2da('0x35')]);_0x1ab91a[_0xe2da('0x39')]=_[_0xe2da('0x38')](_0x5de7fb[_0xe2da('0x34')],qs[_0xe2da('0x3a')](_0x8c91db[_0xe2da('0x35')][_0xe2da('0x3a')]));_0x1ab91a[_0xe2da('0x39')]=_0x1ab91a[_0xe2da('0x39')][_0xe2da('0x3b')]?_0x1ab91a[_0xe2da('0x39')]:_0x5de7fb[_0xe2da('0x34')];if(!_0x8c91db['query'][_0xe2da('0x3c')](_0xe2da('0x3d'))){_0x1ab91a[_0xe2da('0x21')]=qs['limit'](_0x8c91db[_0xe2da('0x35')][_0xe2da('0x21')]);_0x1ab91a[_0xe2da('0x20')]=qs['offset'](_0x8c91db['query'][_0xe2da('0x20')]);}_0x1ab91a[_0xe2da('0x3e')]=qs['sort'](_0x8c91db[_0xe2da('0x35')][_0xe2da('0x3f')]);_0x1ab91a[_0xe2da('0x40')]=qs[_0xe2da('0x37')](_[_0xe2da('0x41')](_0x8c91db['query'],_0x5de7fb[_0xe2da('0x37')]),_0x356ab4);if(_0x8c91db['query']['filter']){_0x1ab91a[_0xe2da('0x40')]=_['merge'](_0x1ab91a[_0xe2da('0x40')],{'$or':_[_0xe2da('0x2e')](_0x356ab4,function(_0x54d8a3){if(_0x54d8a3[_0xe2da('0x32')]!==_0xe2da('0x42')){var _0x538f1f={};_0x538f1f[_0x54d8a3['name']]={'$like':'%'+_0x8c91db['query'][_0xe2da('0x43')]+'%'};return _0x538f1f;}})});}_0x1ab91a=_[_0xe2da('0x44')]({},_0x1ab91a,_0x8c91db[_0xe2da('0x45')]);var _0x38c77e={'where':_0x1ab91a[_0xe2da('0x40')]};return db[_0xe2da('0x2f')][_0xe2da('0x1f')](_0x38c77e)['then'](function(_0x3d1fd){_0x490794[_0xe2da('0x1f')]=_0x3d1fd;if(_0x8c91db[_0xe2da('0x35')][_0xe2da('0x46')]){_0x1ab91a[_0xe2da('0x47')]=[{'all':!![]}];}return db['AnalyticCustomReport'][_0xe2da('0x48')](_0x1ab91a);})[_0xe2da('0x26')](function(_0x3da65f){_0x490794['rows']=_0x3da65f;return _0x490794;})[_0xe2da('0x26')](respondWithFilteredResult(_0x4146ad,_0x1ab91a))[_0xe2da('0x49')](handleError(_0x4146ad,null));};exports[_0xe2da('0x4a')]=function(_0x4096c5,_0x2b229f){var _0x26e330={'raw':![],'where':{'id':_0x4096c5[_0xe2da('0x4b')]['id']}},_0x13a4a5={};_0x13a4a5['model']=_[_0xe2da('0x36')](db[_0xe2da('0x2f')][_0xe2da('0x30')]);_0x13a4a5[_0xe2da('0x35')]=_[_0xe2da('0x36')](_0x4096c5['query']);_0x13a4a5[_0xe2da('0x37')]=_[_0xe2da('0x38')](_0x13a4a5[_0xe2da('0x34')],_0x13a4a5[_0xe2da('0x35')]);_0x26e330[_0xe2da('0x39')]=_[_0xe2da('0x38')](_0x13a4a5[_0xe2da('0x34')],qs['fields'](_0x4096c5[_0xe2da('0x35')]['fields']));_0x26e330[_0xe2da('0x39')]=_0x26e330[_0xe2da('0x39')][_0xe2da('0x3b')]?_0x26e330['attributes']:_0x13a4a5[_0xe2da('0x34')];if(_0x4096c5[_0xe2da('0x35')]['includeAll']){_0x26e330[_0xe2da('0x47')]=[{'all':!![]}];}_0x26e330=_[_0xe2da('0x44')]({},_0x26e330,_0x4096c5[_0xe2da('0x45')]);return db['AnalyticCustomReport'][_0xe2da('0x4c')](_0x26e330)['then'](handleEntityNotFound(_0x2b229f,null))['then'](respondWithResult(_0x2b229f,null))[_0xe2da('0x49')](handleError(_0x2b229f,null));};exports['create']=function(_0x3af438,_0x422449){return db['AnalyticCustomReport'][_0xe2da('0x4d')](_0x3af438[_0xe2da('0x4e')],{})['then'](function(_0x4a6d80){var _0x101a46=_0x3af438['user'][_0xe2da('0x28')]({'plain':!![]});if(!_0x101a46)throw new Error(_0xe2da('0x4f'));if(_0x101a46[_0xe2da('0x50')]===_0xe2da('0x51')){var _0x3e46b=_0x4a6d80[_0xe2da('0x28')]({'plain':!![]});var _0x421467=_0xe2da('0x52');return db[_0xe2da('0x53')]['find']({'where':{'name':_0x421467,'userProfileId':_0x101a46[_0xe2da('0x54')]},'raw':!![]})[_0xe2da('0x26')](function(_0x3adab5){if(_0x3adab5&&_0x3adab5['autoAssociation']===0x0){return db[_0xe2da('0x29')][_0xe2da('0x4d')]({'name':_0x3e46b[_0xe2da('0x2c')],'resourceId':_0x3e46b['id'],'type':_0xe2da('0x55'),'sectionId':_0x3adab5['id']},{})[_0xe2da('0x26')](function(){return _0x4a6d80;});}else{return _0x4a6d80;}})[_0xe2da('0x49')](function(_0x246384){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x246384);throw _0x246384;});}return _0x4a6d80;})[_0xe2da('0x26')](respondWithResult(_0x422449,0xc9))[_0xe2da('0x49')](handleError(_0x422449,null));};exports[_0xe2da('0x56')]=function(_0x5cf8db,_0x572690){if(_0x5cf8db[_0xe2da('0x4e')]['id']){delete _0x5cf8db['body']['id'];}return db[_0xe2da('0x2f')][_0xe2da('0x4c')]({'where':{'id':_0x5cf8db[_0xe2da('0x4b')]['id']}})[_0xe2da('0x26')](handleEntityNotFound(_0x572690,null))[_0xe2da('0x26')](saveUpdates(_0x5cf8db[_0xe2da('0x4e')],null))[_0xe2da('0x26')](respondWithResult(_0x572690,null))[_0xe2da('0x49')](handleError(_0x572690,null));};exports[_0xe2da('0x27')]=function(_0x4aa686,_0x26a9f0){return db[_0xe2da('0x2f')][_0xe2da('0x4c')]({'where':{'id':_0x4aa686[_0xe2da('0x4b')]['id']}})['then'](handleEntityNotFound(_0x26a9f0,null))[_0xe2da('0x26')](removeEntity(_0x26a9f0,null))[_0xe2da('0x49')](handleError(_0x26a9f0,null));};exports[_0xe2da('0x57')]=function(_0x56f4b0,_0x394511){var _0x24cd44=0xa;var _0x3e6e98=[_0xe2da('0x58'),_0xe2da('0x59'),_0xe2da('0x5a'),_0xe2da('0x5b')];var _0x377db9={'SUM':_0xe2da('0x5c'),'COUNT':_0xe2da('0x5d'),'COUNT DISTINCT':_0xe2da('0x5e'),'MAX':_0xe2da('0x5f'),'MIN':'MIN(%s)','AVG':_0xe2da('0x60'),'GROUP_CONCAT':_0xe2da('0x61'),'GROUP_CONCAT ASC':_0xe2da('0x62'),'GROUP_CONCAT DESC':_0xe2da('0x63')};var _0x7526bd={'SEC_TO_TIME':_0xe2da('0x64'),'DATE':_0xe2da('0x65'),'HOUR':'HOUR(%s)','ROUND':_0xe2da('0x66'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x3abde9=function(_0x18ff95){return!_['includes'](['IS\x20NULL',_0xe2da('0x67'),'IS\x20EMPTY',_0xe2da('0x68')],_0x18ff95);};var _0x4bf342=function(_0x148615){if(!_0x148615||!_0x148615[_0xe2da('0x69')][_0xe2da('0x3b')]){return'';}for(var _0x4a2d10='(',_0x5610db=0x0;_0x5610db<_0x148615['rules'][_0xe2da('0x3b')];_0x5610db+=0x1){_0x5610db>0x0&&(_0x4a2d10+='\x20'+_0x148615[_0xe2da('0x6a')]+'\x20');_0x4a2d10+=_0x148615[_0xe2da('0x69')][_0x5610db][_0xe2da('0x6b')]?_0x4bf342(_0x148615['rules'][_0x5610db][_0xe2da('0x6b')]):_0x148615[_0xe2da('0x69')][_0x5610db][_0xe2da('0x6c')]+'\x20'+_0x148615[_0xe2da('0x69')][_0x5610db][_0xe2da('0x6d')]+(_0x3abde9(_0x148615[_0xe2da('0x69')][_0x5610db][_0xe2da('0x6d')])?'\x20'+_0x148615['rules'][_0x5610db][_0xe2da('0x6e')]:'');}return _0x4a2d10+')';};var _0x4666b3={'where':{'id':_0x56f4b0['params']['id']}},_0x3f0a4b,_0x1bff50,_0x16537b,_0x4cf58d,_0x841de3;_0x4666b3=_[_0xe2da('0x44')]({},_0x4666b3,_0x56f4b0['options']);return db[_0xe2da('0x2f')]['find'](_0x4666b3)['then'](function(_0x12b911){if(_0x12b911){_0x3f0a4b=_0x12b911;return _0x12b911[_0xe2da('0x6f')]();}return null;})[_0xe2da('0x26')](function(_0x37eccf){if(_0x37eccf){if(!_0x37eccf[_0xe2da('0x3b')]){throw new db[(_0xe2da('0x70'))][(_0xe2da('0x71'))](_0xe2da('0x72'),0x193);}_0x1bff50=_0x37eccf;return db[_0xe2da('0x73')][_0xe2da('0x48')]({'raw':!![]});}return null;})['then'](function(_0x430a65){if(_0x430a65){_0x16537b=_[_0xe2da('0x74')](_0x430a65,'id');var _0x3eb2c3;var _0x346a38=squel['select']();_0x346a38[_0xe2da('0x75')](_0x3f0a4b[_0xe2da('0x76')]);for(var _0x36ed64=0x0;_0x36ed64<_0x1bff50[_0xe2da('0x3b')];_0x36ed64+=0x1){_0x3eb2c3=_0x1bff50[_0x36ed64]['MetricId']?_0x16537b[_0x1bff50[_0x36ed64][_0xe2da('0x77')]]['metric']:_0x1bff50[_0x36ed64][_0xe2da('0x6c')];_0x3eb2c3=_0x1bff50[_0x36ed64][_0xe2da('0x78')]?_['replace'](_0x377db9[_0x1bff50[_0x36ed64][_0xe2da('0x78')]],'%s',_0x3eb2c3):_0x3eb2c3;_0x3eb2c3=_0x1bff50[_0x36ed64][_0xe2da('0x79')]?_[_0xe2da('0x7a')](_0x7526bd[_0x1bff50[_0x36ed64][_0xe2da('0x79')]],'%s',_0x3eb2c3):_0x3eb2c3;if(_0x1bff50[_0x36ed64][_0xe2da('0x7b')]){_0x346a38['group'](_0x3eb2c3);}_0x1bff50[_0x36ed64][_0xe2da('0x7c')]&&_0x346a38['order'](_0x3eb2c3,_0x1bff50[_0x36ed64]['orderBy']==='DESC'?![]:!![]);_0x346a38['field'](_0x3eb2c3,_0x1bff50[_0x36ed64][_0xe2da('0x7d')]||_0x3eb2c3);}if(_0x3f0a4b[_0xe2da('0x7e')]){_0x3f0a4b[_0xe2da('0x7e')]=JSON[_0xe2da('0x7f')](_0x3f0a4b[_0xe2da('0x7e')]);for(var _0x22d1f5=0x0;_0x22d1f5<_0x3f0a4b[_0xe2da('0x7e')][_0xe2da('0x3b')];_0x22d1f5+=0x1){if(_0x3f0a4b[_0xe2da('0x7e')][_0x22d1f5]['type']&&_[_0xe2da('0x80')](_0x3e6e98,_0x3f0a4b[_0xe2da('0x7e')][_0x22d1f5][_0xe2da('0x32')])&&_0x3f0a4b[_0xe2da('0x7e')][_0x22d1f5][_0xe2da('0x81')]&&_0x3f0a4b[_0xe2da('0x7e')][_0x22d1f5][_0xe2da('0x82')]&&_0x3f0a4b[_0xe2da('0x7e')][_0x22d1f5][_0xe2da('0x83')]){_0x346a38[_0x3f0a4b[_0xe2da('0x7e')][_0x22d1f5]['type']](_0x3f0a4b[_0xe2da('0x7e')][_0x22d1f5][_0xe2da('0x82')],null,util[_0xe2da('0x79')](_0xe2da('0x84'),_0x3f0a4b[_0xe2da('0x76')],_0x3f0a4b[_0xe2da('0x7e')][_0x22d1f5][_0xe2da('0x81')],_0x3f0a4b[_0xe2da('0x7e')][_0x22d1f5][_0xe2da('0x82')],_0x3f0a4b[_0xe2da('0x7e')][_0x22d1f5][_0xe2da('0x83')]));}}}if(_0x3f0a4b[_0xe2da('0x85')]){_0x3f0a4b['conditions']=JSON[_0xe2da('0x7f')](_0x3f0a4b['conditions']);_0x346a38[_0xe2da('0x40')](_0x4bf342(_0x3f0a4b[_0xe2da('0x85')][_0xe2da('0x6b')]));}_0x841de3=_0x346a38[_0xe2da('0x86')]();_0x346a38[_0xe2da('0x21')](_0x24cd44);_0x346a38[_0xe2da('0x20')](0x0);logger[_0xe2da('0x87')]('Limited\x20Query:',_0x346a38[_0xe2da('0x88')]());return db[_0xe2da('0x89')][_0xe2da('0x35')](_0x346a38[_0xe2da('0x88')](),{'type':db[_0xe2da('0x89')][_0xe2da('0x8a')]['SELECT']});}})[_0xe2da('0x26')](respondWithResult(_0x394511,null))[_0xe2da('0x49')](handleError(_0x394511,null));};function runReport(_0xd94955,_0x96caa5,_0x2e1930){var _0x3c7119=_0x96caa5[_0xe2da('0x2c')];var _0x4e72b7=0xa;var _0x298511=[_0xe2da('0x58'),_0xe2da('0x59'),_0xe2da('0x5a'),_0xe2da('0x5b')];var _0xc3088a={'SUM':'SUM(%s)','COUNT':_0xe2da('0x5d'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0xe2da('0x8b'),'AVG':_0xe2da('0x60'),'GROUP_CONCAT':_0xe2da('0x61'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xe2da('0x63')};var _0x23daa8={'SEC_TO_TIME':_0xe2da('0x64'),'DATE':_0xe2da('0x65'),'HOUR':'HOUR(%s)','ROUND':_0xe2da('0x66'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x4ccff8=function(_0x423b63){return!_[_0xe2da('0x80')]([_0xe2da('0x8c'),_0xe2da('0x67'),_0xe2da('0x8d'),_0xe2da('0x68')],_0x423b63);};var _0x4990a4=function(_0x761f4d){if(!_0x761f4d||!_0x761f4d[_0xe2da('0x69')][_0xe2da('0x3b')]){return'';}for(var _0x4a1808='(',_0x3a4104=0x0;_0x3a4104<_0x761f4d[_0xe2da('0x69')][_0xe2da('0x3b')];_0x3a4104+=0x1){_0x3a4104>0x0&&(_0x4a1808+='\x20'+_0x761f4d['operator']+'\x20');_0x4a1808+=_0x761f4d[_0xe2da('0x69')][_0x3a4104][_0xe2da('0x6b')]?_0x4990a4(_0x761f4d[_0xe2da('0x69')][_0x3a4104][_0xe2da('0x6b')]):_0x761f4d[_0xe2da('0x69')][_0x3a4104]['field']+'\x20'+_0x761f4d[_0xe2da('0x69')][_0x3a4104][_0xe2da('0x6d')]+(_0x4ccff8(_0x761f4d[_0xe2da('0x69')][_0x3a4104][_0xe2da('0x6d')])?'\x20'+_0x761f4d[_0xe2da('0x69')][_0x3a4104][_0xe2da('0x6e')]:'');}return _0x4a1808+')';};var _0x1fff3f={'where':{'id':_0xd94955['id']}},_0x10d3ed,_0x862f5c,_0x5e6c49,_0x312c7a,_0x38fc64;_0x1fff3f=_['merge']({},_0x1fff3f,_0x2e1930);return db[_0xe2da('0x2f')]['find'](_0x1fff3f)['then'](function(_0x56ce9c){if(_0x56ce9c){_0x10d3ed=_0x56ce9c;return _0x56ce9c[_0xe2da('0x6f')]();}return null;})[_0xe2da('0x26')](function(_0x5f5cca){if(_0x5f5cca){if(!_0x5f5cca[_0xe2da('0x3b')]){throw new db['Sequelize'][(_0xe2da('0x71'))](_0xe2da('0x72'),0x193);}_0x862f5c=_0x5f5cca;return db[_0xe2da('0x73')][_0xe2da('0x48')]({'raw':!![]});}return null;})[_0xe2da('0x26')](function(_0x2dd0d9){if(_0x2dd0d9){_0x5e6c49=_[_0xe2da('0x74')](_0x2dd0d9,'id');var _0x49679a;var _0x5f2971=squel[_0xe2da('0x8e')]();_0x5f2971[_0xe2da('0x75')](_0x10d3ed[_0xe2da('0x76')]);for(var _0xf3a4a8=0x0;_0xf3a4a8<_0x862f5c['length'];_0xf3a4a8+=0x1){_0x49679a=_0x862f5c[_0xf3a4a8][_0xe2da('0x77')]?_0x5e6c49[_0x862f5c[_0xf3a4a8]['MetricId']][_0xe2da('0x8f')]:_0x862f5c[_0xf3a4a8][_0xe2da('0x6c')];_0x49679a=_0x862f5c[_0xf3a4a8][_0xe2da('0x78')]?_[_0xe2da('0x7a')](_0xc3088a[_0x862f5c[_0xf3a4a8][_0xe2da('0x78')]],'%s',_0x49679a):_0x49679a;_0x49679a=_0x862f5c[_0xf3a4a8][_0xe2da('0x79')]?_['replace'](_0x23daa8[_0x862f5c[_0xf3a4a8][_0xe2da('0x79')]],'%s',_0x49679a):_0x49679a;if(_0x862f5c[_0xf3a4a8][_0xe2da('0x7b')]){_0x5f2971[_0xe2da('0x6b')](_0x49679a);}_0x862f5c[_0xf3a4a8][_0xe2da('0x7c')]&&_0x5f2971[_0xe2da('0x3e')](_0x49679a,_0x862f5c[_0xf3a4a8][_0xe2da('0x7c')]===_0xe2da('0x90')?![]:!![]);_0x5f2971[_0xe2da('0x6c')](_0x49679a,_0x862f5c[_0xf3a4a8]['alias']||_0x49679a);}if(_0x10d3ed[_0xe2da('0x7e')]){_0x10d3ed['joins']=JSON[_0xe2da('0x7f')](_0x10d3ed[_0xe2da('0x7e')]);for(var _0x5cc950=0x0;_0x5cc950<_0x10d3ed['joins'][_0xe2da('0x3b')];_0x5cc950+=0x1){if(_0x10d3ed['joins'][_0x5cc950][_0xe2da('0x32')]&&_[_0xe2da('0x80')](_0x298511,_0x10d3ed[_0xe2da('0x7e')][_0x5cc950]['type'])&&_0x10d3ed[_0xe2da('0x7e')][_0x5cc950]['parentKey']&&_0x10d3ed['joins'][_0x5cc950][_0xe2da('0x82')]&&_0x10d3ed[_0xe2da('0x7e')][_0x5cc950]['foreignKey']){_0x5f2971[_0x10d3ed[_0xe2da('0x7e')][_0x5cc950]['type']](_0x10d3ed[_0xe2da('0x7e')][_0x5cc950][_0xe2da('0x82')],null,util[_0xe2da('0x79')](_0xe2da('0x84'),_0x10d3ed[_0xe2da('0x76')],_0x10d3ed['joins'][_0x5cc950][_0xe2da('0x81')],_0x10d3ed[_0xe2da('0x7e')][_0x5cc950][_0xe2da('0x82')],_0x10d3ed['joins'][_0x5cc950][_0xe2da('0x83')]));}}}if(_0x10d3ed[_0xe2da('0x85')]){_0x10d3ed[_0xe2da('0x85')]=JSON[_0xe2da('0x7f')](_0x10d3ed[_0xe2da('0x85')]);_0x5f2971[_0xe2da('0x40')](_0x4990a4(_0x10d3ed[_0xe2da('0x85')][_0xe2da('0x6b')]));}_0x38fc64=_0x5f2971['clone']();_0x5f2971['limit'](_0x4e72b7);_0x5f2971[_0xe2da('0x20')](0x0);logger['debug'](_0xe2da('0x91'),_0x5f2971[_0xe2da('0x88')]());return db[_0xe2da('0x89')][_0xe2da('0x35')](_0x5f2971[_0xe2da('0x88')](),{'type':db[_0xe2da('0x89')][_0xe2da('0x8a')]['SELECT']});}})[_0xe2da('0x26')](function(_0x5c5342){if(!_0x5c5342[_0xe2da('0x3b')]){throw new db['Sequelize']['ValidationErrorItem'](_0xe2da('0x92'),0xcc);}if(_0x96caa5[_0xe2da('0x93')]===_0xe2da('0x94')){return null;}var _0x8ca168=_[_0xe2da('0x44')](_0x96caa5,{'name':_0x96caa5[_0xe2da('0x95')]||_0x96caa5[_0xe2da('0x2c')]||_0x10d3ed['name'],'basename':_0x3c7119,'savename':util[_0xe2da('0x79')](_0xe2da('0x96'),_0x96caa5[_0xe2da('0x2c')]||_0x10d3ed['name'],require(_0xe2da('0x97'))['generate'](0x4),_0x96caa5['output']||_0xe2da('0x98')),'reportId':_0x10d3ed['id'],'reportType':_0xe2da('0x99')});return db['AnalyticExtractedReport']['create'](_0x8ca168,{'raw':!![]});})[_0xe2da('0x26')](function(_0x51653d){if(_0x10d3ed[_0xe2da('0x76')]===_0xe2da('0x9a')){_0x38fc64[_0xe2da('0x40')](_0x10d3ed[_0xe2da('0x76')]+_0xe2da('0x9b'),_0x96caa5[_0xe2da('0x9c')],_0x96caa5['endDate']);}else{_0x38fc64[_0xe2da('0x40')](_0x10d3ed[_0xe2da('0x76')]+_0xe2da('0x9d'),_0x96caa5[_0xe2da('0x9c')],_0x96caa5[_0xe2da('0x9e')]);}if(_0x51653d){logger[_0xe2da('0x9f')]('Run\x20Query:',_0x38fc64[_0xe2da('0x88')]());require(_0xe2da('0xa0'))[_0xe2da('0xa1')](path['join'](__dirname,_0xe2da('0xa2'),_0x51653d[_0xe2da('0x93')]),[_0x51653d['id'],_0x38fc64[_0xe2da('0x88')](),path[_0xe2da('0x58')](__dirname,_0xe2da('0xa3'),_0x51653d[_0xe2da('0xa4')]),_0x3c7119]);return _0x51653d;}else{var _0x4e7789=squel['select']();_0x4e7789[_0xe2da('0x75')]('('+_0x38fc64[_0xe2da('0x88')]()+')','countTable');_0x4e7789['field'](_0xe2da('0xa5'),'count');_0x38fc64[_0xe2da('0x21')](_0x96caa5[_0xe2da('0x21')]||_0x4e72b7);_0x38fc64['offset'](_0x96caa5[_0xe2da('0x20')]||0x0);return dbH[_0xe2da('0x89')][_0xe2da('0x35')](_0x4e7789[_0xe2da('0x88')](),{'type':dbH[_0xe2da('0x89')][_0xe2da('0x8a')]['SELECT']})[_0xe2da('0x26')](function(_0x5ecfa1){if(!_0x5ecfa1[_0xe2da('0x3b')]){_0x312c7a=0x0;}else{_0x312c7a=_0x5ecfa1[0x0][_0xe2da('0x1f')]||0x0;}return dbH[_0xe2da('0x89')]['query'](_0x38fc64[_0xe2da('0x88')](),{'type':dbH['sequelize'][_0xe2da('0x8a')]['SELECT']});})['then'](function(_0x2c00ae){return{'rows':_0x2c00ae||[],'count':_0x312c7a};});}});}exports['run']=function(_0x372e8d,_0x809ab3){return runReport(_0x372e8d[_0xe2da('0x4b')],_0x372e8d[_0xe2da('0x35')],_0x372e8d[_0xe2da('0x45')])[_0xe2da('0x26')](respondWithResult(_0x809ab3,null))[_0xe2da('0x49')](handleError(_0x809ab3,null));};exports['runReport']=runReport;exports['query']=function(_0x369583,_0x2cbca3){var _0x159d83=0xa;var _0xb9832c=[_0xe2da('0x58'),_0xe2da('0x59'),'right_join','cross_join'];var _0x446fe1={'SUM':_0xe2da('0x5c'),'COUNT':_0xe2da('0x5d'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xe2da('0x5f'),'MIN':_0xe2da('0x8b'),'AVG':_0xe2da('0x60'),'GROUP_CONCAT':_0xe2da('0x61'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xe2da('0x63')};var _0x54046d={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xe2da('0x65'),'HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xe2da('0xa6')};var _0x7a762c=function(_0x378852){return!_[_0xe2da('0x80')](['IS\x20NULL',_0xe2da('0x67'),'IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0x378852);};var _0x524626=function(_0x10a155){if(!_0x10a155||!_0x10a155[_0xe2da('0x69')]['length']){return'';}for(var _0xc7be7='(',_0x45eea3=0x0;_0x45eea3<_0x10a155['rules'][_0xe2da('0x3b')];_0x45eea3+=0x1){_0x45eea3>0x0&&(_0xc7be7+='\x20'+_0x10a155[_0xe2da('0x6a')]+'\x20');_0xc7be7+=_0x10a155['rules'][_0x45eea3][_0xe2da('0x6b')]?_0x524626(_0x10a155['rules'][_0x45eea3][_0xe2da('0x6b')]):_0x10a155[_0xe2da('0x69')][_0x45eea3]['field']+'\x20'+_0x10a155['rules'][_0x45eea3][_0xe2da('0x6d')]+(_0x7a762c(_0x10a155[_0xe2da('0x69')][_0x45eea3][_0xe2da('0x6d')])?'\x20'+_0x10a155['rules'][_0x45eea3]['value']:'');}return _0xc7be7+')';};var _0x52906f={'where':{'id':_0x369583[_0xe2da('0x4b')]['id']}},_0x4dfeba,_0x244e96,_0x3fc83f,_0x13f4bb,_0x1d826d;_0x52906f=_[_0xe2da('0x44')]({},_0x52906f,_0x369583[_0xe2da('0x45')]);return db[_0xe2da('0x2f')][_0xe2da('0x4c')](_0x52906f)[_0xe2da('0x26')](function(_0x56e103){if(_0x56e103){_0x4dfeba=_0x56e103;return _0x56e103[_0xe2da('0x6f')]();}return null;})['then'](function(_0x3af398){if(_0x3af398){if(!_0x3af398[_0xe2da('0x3b')]){throw new db['Sequelize'][(_0xe2da('0x71'))](_0xe2da('0x72'),0x193);}_0x244e96=_0x3af398;return db[_0xe2da('0x73')][_0xe2da('0x48')]({'raw':!![]});}return null;})['then'](function(_0xbb9946){if(_0xbb9946){_0x3fc83f=_[_0xe2da('0x74')](_0xbb9946,'id');var _0x17060b;var _0x361e62=squel[_0xe2da('0x8e')]();_0x361e62[_0xe2da('0x75')](_0x4dfeba[_0xe2da('0x76')]);for(var _0x1e1975=0x0;_0x1e1975<_0x244e96[_0xe2da('0x3b')];_0x1e1975+=0x1){_0x17060b=_0x244e96[_0x1e1975][_0xe2da('0x77')]?_0x3fc83f[_0x244e96[_0x1e1975][_0xe2da('0x77')]][_0xe2da('0x8f')]:_0x244e96[_0x1e1975]['field'];_0x17060b=_0x244e96[_0x1e1975][_0xe2da('0x78')]?_[_0xe2da('0x7a')](_0x446fe1[_0x244e96[_0x1e1975][_0xe2da('0x78')]],'%s',_0x17060b):_0x17060b;_0x17060b=_0x244e96[_0x1e1975]['format']?_[_0xe2da('0x7a')](_0x54046d[_0x244e96[_0x1e1975][_0xe2da('0x79')]],'%s',_0x17060b):_0x17060b;if(_0x244e96[_0x1e1975][_0xe2da('0x7b')]){_0x361e62[_0xe2da('0x6b')](_0x17060b);}_0x244e96[_0x1e1975][_0xe2da('0x7c')]&&_0x361e62[_0xe2da('0x3e')](_0x17060b,_0x244e96[_0x1e1975]['orderBy']===_0xe2da('0x90')?![]:!![]);_0x361e62[_0xe2da('0x6c')](_0x17060b,_0x244e96[_0x1e1975][_0xe2da('0x7d')]||_0x17060b);}if(_0x4dfeba[_0xe2da('0x7e')]){_0x4dfeba[_0xe2da('0x7e')]=JSON['parse'](_0x4dfeba['joins']);for(var _0x3b8592=0x0;_0x3b8592<_0x4dfeba[_0xe2da('0x7e')]['length'];_0x3b8592+=0x1){if(_0x4dfeba[_0xe2da('0x7e')][_0x3b8592][_0xe2da('0x32')]&&_[_0xe2da('0x80')](_0xb9832c,_0x4dfeba[_0xe2da('0x7e')][_0x3b8592][_0xe2da('0x32')])&&_0x4dfeba['joins'][_0x3b8592][_0xe2da('0x81')]&&_0x4dfeba[_0xe2da('0x7e')][_0x3b8592]['foreignTable']&&_0x4dfeba['joins'][_0x3b8592]['foreignKey']){_0x361e62[_0x4dfeba[_0xe2da('0x7e')][_0x3b8592]['type']](_0x4dfeba['joins'][_0x3b8592]['foreignTable'],null,util[_0xe2da('0x79')]('%s.%s\x20=\x20%s.%s',_0x4dfeba[_0xe2da('0x76')],_0x4dfeba[_0xe2da('0x7e')][_0x3b8592][_0xe2da('0x81')],_0x4dfeba[_0xe2da('0x7e')][_0x3b8592]['foreignTable'],_0x4dfeba[_0xe2da('0x7e')][_0x3b8592][_0xe2da('0x83')]));}}}if(_0x4dfeba[_0xe2da('0x85')]){_0x4dfeba[_0xe2da('0x85')]=JSON[_0xe2da('0x7f')](_0x4dfeba[_0xe2da('0x85')]);_0x361e62[_0xe2da('0x40')](_0x524626(_0x4dfeba[_0xe2da('0x85')][_0xe2da('0x6b')]));}_0x1d826d=_0x361e62[_0xe2da('0x86')]();_0x361e62[_0xe2da('0x21')](_0x159d83);_0x361e62[_0xe2da('0x20')](0x0);logger[_0xe2da('0x87')](_0xe2da('0x91'),_0x361e62['toString']());return db[_0xe2da('0x89')]['query'](_0x361e62[_0xe2da('0x88')](),{'type':db[_0xe2da('0x89')][_0xe2da('0x8a')]['SELECT']});}})[_0xe2da('0x26')](function(){return{'sql':_0x1d826d[_0xe2da('0x88')]()};})[_0xe2da('0x26')](respondWithResult(_0x2cbca3,null))[_0xe2da('0x49')](handleError(_0x2cbca3,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 0a9b503..955d135 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 _0x7ced=['analytics_custom_reports','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','exports','define'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x7ced,0xb5));var _0xd7ce=function(_0x2820fc,_0x481318){_0x2820fc=_0x2820fc-0x0;var _0x1e1508=_0x7ced[_0x2820fc];return _0x1e1508;};'use strict';var _=require('lodash');var util=require(_0xd7ce('0x0'));var logger=require(_0xd7ce('0x1'))('api');var moment=require(_0xd7ce('0x2'));var BPromise=require(_0xd7ce('0x3'));var rp=require(_0xd7ce('0x4'));var fs=require('fs');var path=require(_0xd7ce('0x5'));var rimraf=require(_0xd7ce('0x6'));var config=require('../../config/environment');var attributes=require('./analyticCustomReport.attributes');module[_0xd7ce('0x7')]=function(_0x4d1f24,_0x2ae024){return _0x4d1f24[_0xd7ce('0x8')]('AnalyticCustomReport',attributes,{'tableName':_0xd7ce('0x9'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1316=['./analyticCustomReport.attributes','define','AnalyticCustomReport','analytics_custom_reports','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x28a05c,_0x577450){var _0x1a24c3=function(_0x58eb04){while(--_0x58eb04){_0x28a05c['push'](_0x28a05c['shift']());}};_0x1a24c3(++_0x577450);}(_0x1316,0x18a));var _0x6131=function(_0x2149c9,_0x158abb){_0x2149c9=_0x2149c9-0x0;var _0x1e7c13=_0x1316[_0x2149c9];return _0x1e7c13;};'use strict';var _=require('lodash');var util=require(_0x6131('0x0'));var logger=require(_0x6131('0x1'))(_0x6131('0x2'));var moment=require(_0x6131('0x3'));var BPromise=require(_0x6131('0x4'));var rp=require(_0x6131('0x5'));var fs=require('fs');var path=require(_0x6131('0x6'));var rimraf=require(_0x6131('0x7'));var config=require(_0x6131('0x8'));var attributes=require(_0x6131('0x9'));module['exports']=function(_0x3e28e4,_0x23afa5){return _0x3e28e4[_0x6131('0xa')](_0x6131('0xb'),attributes,{'tableName':_0x6131('0xc'),'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 529f58d..2b4628d 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 _0xfa41=['info','AnalyticCustomReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x4780f7,_0x28a120){var _0x2c4f7b=function(_0x21de4d){while(--_0x21de4d){_0x4780f7['push'](_0x4780f7['shift']());}};_0x2c4f7b(++_0x28a120);}(_0xfa41,0x66));var _0x1fa4=function(_0x26da89,_0x264785){_0x26da89=_0x26da89-0x0;var _0xc95b7b=_0xfa41[_0x26da89];return _0xc95b7b;};'use strict';var _=require(_0x1fa4('0x0'));var util=require(_0x1fa4('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1fa4('0x2'));var fs=require('fs');var Redis=require(_0x1fa4('0x3'));var db=require(_0x1fa4('0x4'))['db'];var utils=require(_0x1fa4('0x5'));var logger=require(_0x1fa4('0x6'))(_0x1fa4('0x7'));var config=require(_0x1fa4('0x8'));var jayson=require(_0x1fa4('0x9'));var client=jayson[_0x1fa4('0xa')][_0x1fa4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2c0a57,_0x27c6b6,_0xddc02b){return new BPromise(function(_0x4f9535,_0x15a5a6){return client[_0x1fa4('0xc')](_0x2c0a57,_0xddc02b)['then'](function(_0x2fee6e){logger[_0x1fa4('0xd')](_0x1fa4('0xe'),_0x27c6b6,'request\x20sent');logger[_0x1fa4('0xf')]('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0x27c6b6,_0x1fa4('0x10'),JSON[_0x1fa4('0x11')](_0x2fee6e));if(_0x2fee6e['error']){if(_0x2fee6e[_0x1fa4('0x12')][_0x1fa4('0x13')]===0x1f4){logger[_0x1fa4('0x12')]('AnalyticCustomReport,\x20%s,\x20%s',_0x27c6b6,_0x2fee6e[_0x1fa4('0x12')][_0x1fa4('0x14')]);return _0x15a5a6(_0x2fee6e['error']['message']);}logger[_0x1fa4('0x12')](_0x1fa4('0xe'),_0x27c6b6,_0x2fee6e[_0x1fa4('0x12')][_0x1fa4('0x14')]);return _0x4f9535(_0x2fee6e['error'][_0x1fa4('0x14')]);}else{logger[_0x1fa4('0xd')]('AnalyticCustomReport,\x20%s,\x20%s',_0x27c6b6,_0x1fa4('0x10'));_0x4f9535(_0x2fee6e[_0x1fa4('0x15')][_0x1fa4('0x14')]);}})[_0x1fa4('0x16')](function(_0x434499){logger[_0x1fa4('0x12')]('AnalyticCustomReport,\x20%s,\x20%s',_0x27c6b6,_0x434499);_0x15a5a6(_0x434499);});});} \ No newline at end of file +var _0x7b7e=['code','message','info','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x385b7a,_0x3e2418){var _0x3ac2f2=function(_0x4e924c){while(--_0x4e924c){_0x385b7a['push'](_0x385b7a['shift']());}};_0x3ac2f2(++_0x3e2418);}(_0x7b7e,0x17a));var _0xe7b7=function(_0x1dac7a,_0x1828ce){_0x1dac7a=_0x1dac7a-0x0;var _0x4cb363=_0x7b7e[_0x1dac7a];return _0x4cb363;};'use strict';var _=require('lodash');var util=require(_0xe7b7('0x0'));var moment=require('moment');var BPromise=require(_0xe7b7('0x1'));var rs=require(_0xe7b7('0x2'));var fs=require('fs');var Redis=require(_0xe7b7('0x3'));var db=require(_0xe7b7('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xe7b7('0x5'))(_0xe7b7('0x6'));var config=require(_0xe7b7('0x7'));var jayson=require(_0xe7b7('0x8'));var client=jayson[_0xe7b7('0x9')][_0xe7b7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5c333d,_0x4c5cdf,_0x165c06){return new BPromise(function(_0x5d2a7d,_0x18a3a6){return client[_0xe7b7('0xb')](_0x5c333d,_0x165c06)[_0xe7b7('0xc')](function(_0x3ae7e7){logger['info'](_0xe7b7('0xd'),_0x4c5cdf,_0xe7b7('0xe'));logger['debug'](_0xe7b7('0xf'),_0x4c5cdf,_0xe7b7('0xe'),JSON[_0xe7b7('0x10')](_0x3ae7e7));if(_0x3ae7e7[_0xe7b7('0x11')]){if(_0x3ae7e7[_0xe7b7('0x11')][_0xe7b7('0x12')]===0x1f4){logger[_0xe7b7('0x11')](_0xe7b7('0xd'),_0x4c5cdf,_0x3ae7e7[_0xe7b7('0x11')][_0xe7b7('0x13')]);return _0x18a3a6(_0x3ae7e7[_0xe7b7('0x11')][_0xe7b7('0x13')]);}logger['error'](_0xe7b7('0xd'),_0x4c5cdf,_0x3ae7e7[_0xe7b7('0x11')]['message']);return _0x5d2a7d(_0x3ae7e7[_0xe7b7('0x11')][_0xe7b7('0x13')]);}else{logger[_0xe7b7('0x14')](_0xe7b7('0xd'),_0x4c5cdf,_0xe7b7('0xe'));_0x5d2a7d(_0x3ae7e7['result'][_0xe7b7('0x13')]);}})[_0xe7b7('0x15')](function(_0x30dacf){logger[_0xe7b7('0x11')](_0xe7b7('0xd'),_0x4c5cdf,_0x30dacf);_0x18a3a6(_0x30dacf);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index f064f94..2184504 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 _0x3b68=['./analyticCustomReport.controller','get','isAuthenticated','/:id','show','/:id/preview','preview','/:id/run','run','post','create','update','delete','destroy','multer','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x1748c4,_0x5d162b){var _0x40e6bf=function(_0x51a49f){while(--_0x51a49f){_0x1748c4['push'](_0x1748c4['shift']());}};_0x40e6bf(++_0x5d162b);}(_0x3b68,0xd6));var _0x83b6=function(_0x1e8fd7,_0x4e0d97){_0x1e8fd7=_0x1e8fd7-0x0;var _0x4b9de0=_0x3b68[_0x1e8fd7];return _0x4b9de0;};'use strict';var multer=require(_0x83b6('0x0'));var util=require('util');var path=require(_0x83b6('0x1'));var timeout=require(_0x83b6('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x83b6('0x3'));var interaction=require(_0x83b6('0x4'));var config=require(_0x83b6('0x5'));var controller=require(_0x83b6('0x6'));router[_0x83b6('0x7')]('/',auth[_0x83b6('0x8')](),controller['index']);router[_0x83b6('0x7')](_0x83b6('0x9'),auth[_0x83b6('0x8')](),controller[_0x83b6('0xa')]);router['get'](_0x83b6('0xb'),auth['isAuthenticated'](),controller[_0x83b6('0xc')]);router['get'](_0x83b6('0xd'),auth['isAuthenticated'](),controller[_0x83b6('0xe')]);router['get']('/:id/query',auth['isAuthenticated'](),controller['query']);router[_0x83b6('0xf')]('/',auth[_0x83b6('0x8')](),controller[_0x83b6('0x10')]);router['put'](_0x83b6('0x9'),auth[_0x83b6('0x8')](),controller[_0x83b6('0x11')]);router[_0x83b6('0x12')](_0x83b6('0x9'),auth[_0x83b6('0x8')](),controller[_0x83b6('0x13')]);module['exports']=router; \ No newline at end of file +var _0xc795=['multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./analyticCustomReport.controller','get','isAuthenticated','index','show','/:id/preview','/:id/run','run','/:id/query','query','create','put','update','delete','/:id','destroy','exports'];(function(_0x1b62f9,_0x4b21dd){var _0x4dd6fb=function(_0x4910d7){while(--_0x4910d7){_0x1b62f9['push'](_0x1b62f9['shift']());}};_0x4dd6fb(++_0x4b21dd);}(_0xc795,0x1c8));var _0x5c79=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0xc795[_0x413feb];return _0x40ee88;};'use strict';var multer=require(_0x5c79('0x0'));var util=require(_0x5c79('0x1'));var path=require(_0x5c79('0x2'));var timeout=require(_0x5c79('0x3'));var express=require(_0x5c79('0x4'));var router=express['Router']();var auth=require(_0x5c79('0x5'));var interaction=require(_0x5c79('0x6'));var config=require('../../config/environment');var controller=require(_0x5c79('0x7'));router[_0x5c79('0x8')]('/',auth[_0x5c79('0x9')](),controller[_0x5c79('0xa')]);router[_0x5c79('0x8')]('/:id',auth[_0x5c79('0x9')](),controller[_0x5c79('0xb')]);router[_0x5c79('0x8')](_0x5c79('0xc'),auth[_0x5c79('0x9')](),controller['preview']);router[_0x5c79('0x8')](_0x5c79('0xd'),auth['isAuthenticated'](),controller[_0x5c79('0xe')]);router[_0x5c79('0x8')](_0x5c79('0xf'),auth['isAuthenticated'](),controller[_0x5c79('0x10')]);router['post']('/',auth[_0x5c79('0x9')](),controller[_0x5c79('0x11')]);router[_0x5c79('0x12')]('/:id',auth[_0x5c79('0x9')](),controller[_0x5c79('0x13')]);router[_0x5c79('0x14')](_0x5c79('0x15'),auth[_0x5c79('0x9')](),controller[_0x5c79('0x16')]);module[_0x5c79('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 64f1ed4..fdb293d 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 _0x6963=['STRING','TEXT'];(function(_0x37e99d,_0x414af3){var _0x5a7633=function(_0x1dc2d7){while(--_0x1dc2d7){_0x37e99d['push'](_0x37e99d['shift']());}};_0x5a7633(++_0x414af3);}(_0x6963,0xf0));var _0x3696=function(_0x4bb252,_0xc862a7){_0x4bb252=_0x4bb252-0x0;var _0x4c326c=_0x6963[_0x4bb252];return _0x4c326c;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x3696('0x0')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0x3696('0x1')]},'joins':{'type':Sequelize[_0x3696('0x1')]}}; \ No newline at end of file +var _0x9dfc=['TEXT','exports','STRING'];(function(_0x46bd72,_0x154fc5){var _0xd727b4=function(_0x15ac7e){while(--_0x15ac7e){_0x46bd72['push'](_0x46bd72['shift']());}};_0xd727b4(++_0x154fc5);}(_0x9dfc,0x13c));var _0xc9df=function(_0x5a2a42,_0x591831){_0x5a2a42=_0x5a2a42-0x0;var _0x36bb36=_0x9dfc[_0x5a2a42];return _0x36bb36;};'use strict';var Sequelize=require('sequelize');module[_0xc9df('0x0')]={'name':{'type':Sequelize[_0xc9df('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xc9df('0x1')]},'parent':{'type':Sequelize[_0xc9df('0x1')]},'table':{'type':Sequelize[_0xc9df('0x1')]},'conditions':{'type':Sequelize[_0xc9df('0x2')]},'joins':{'type':Sequelize[_0xc9df('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 766852d..6b5edad 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 _0xa647=['hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','Reports','UserProfileSection','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','preview','join','left_join','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','operator','rules','group','field','condition','ValidationErrorItem','keyBy','from','table','MetricId','metric','replace','function','format','groupBy','orderBy','DESC','joins','parse','includes','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','foreignKey','conditions','clone','debug','Limited\x20Query:','sequelize','toString','QueryTypes','COUNT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','UNIX_TIMESTAMP(%s)','getFields','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','select','alias','SELECT','No\x20available\x20data','output','web','fullPath','%s-%s.%s','generate','csv','default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','child_process','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','run','right_join','value','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','dbH','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','DefaultReports','UserProfileResource','stack','name','index','AnalyticDefaultReport','rawAttributes','fieldName','type','key','map','query','filters','intersection','model','fields','attributes','length'];(function(_0xc48b7b,_0xb43390){var _0x10ee44=function(_0xc9bd73){while(--_0xc9bd73){_0xc48b7b['push'](_0xc48b7b['shift']());}};_0x10ee44(++_0xb43390);}(_0xa647,0x11a));var _0x7a64=function(_0x136d79,_0x4577a5){_0x136d79=_0x136d79-0x0;var _0x2da9b2=_0xa647[_0x136d79];return _0x2da9b2;};'use strict';var pdf=require(_0x7a64('0x0'));var emlformat=require(_0x7a64('0x1'));var rimraf=require(_0x7a64('0x2'));var zipdir=require(_0x7a64('0x3'));var jsonpatch=require(_0x7a64('0x4'));var rp=require(_0x7a64('0x5'));var moment=require(_0x7a64('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x7a64('0x7'));var util=require('util');var path=require(_0x7a64('0x8'));var sox=require(_0x7a64('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x7a64('0xa'));var squel=require(_0x7a64('0xb'));var crypto=require(_0x7a64('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x7a64('0xd'));var toCsv=require('to-csv');var querystring=require(_0x7a64('0xe'));var Papa=require(_0x7a64('0xf'));var Redis=require(_0x7a64('0x10'));var authService=require(_0x7a64('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x7a64('0x12'));var hardwareService=require(_0x7a64('0x13'));var logger=require(_0x7a64('0x14'))(_0x7a64('0x15'));var utils=require(_0x7a64('0x16'));var config=require(_0x7a64('0x17'));var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')[_0x7a64('0x18')];function respondWithStatusCode(_0x168897,_0x1420ae){_0x1420ae=_0x1420ae||0xcc;return function(_0x4a9cf1){if(_0x4a9cf1){return _0x168897[_0x7a64('0x19')](_0x1420ae);}return _0x168897['status'](_0x1420ae)[_0x7a64('0x1a')]();};}function respondWithResult(_0x4c5603,_0xed5640){_0xed5640=_0xed5640||0xc8;return function(_0x2475a4){if(_0x2475a4){return _0x4c5603[_0x7a64('0x1b')](_0xed5640)[_0x7a64('0x1c')](_0x2475a4);}};}function respondWithFilteredResult(_0x4afcb6,_0x1ecd51){return function(_0x19d29a){if(_0x19d29a){var _0x3154f1=_0x19d29a[_0x7a64('0x1d')],_0x4c6a1a=_0x1ecd51[_0x7a64('0x1e')],_0x2b8114=_0x1ecd51[_0x7a64('0x1e')]+_0x1ecd51[_0x7a64('0x1f')],_0x474bb1;if(_0x2b8114>=_0x3154f1){_0x2b8114=_0x3154f1;_0x474bb1=0xc8;}else{_0x474bb1=0xce;}_0x4afcb6['status'](_0x474bb1);return _0x4afcb6[_0x7a64('0x20')](_0x7a64('0x21'),_0x4c6a1a+'-'+_0x2b8114+'/'+_0x3154f1)[_0x7a64('0x1c')](_0x19d29a);}return null;};}function patchUpdates(_0x334038){return function(_0x17f039){try{jsonpatch[_0x7a64('0x22')](_0x17f039,_0x334038,!![]);}catch(_0x218544){return BPromise[_0x7a64('0x23')](_0x218544);}return _0x17f039[_0x7a64('0x24')]();};}function saveUpdates(_0x38e608,_0xb28c9e){return function(_0x538730){if(_0x538730){return _0x538730[_0x7a64('0x25')](_0x38e608)[_0x7a64('0x26')](function(_0x502dac){return _0x502dac;});}return null;};}function removeEntity(_0x508850,_0x4eebbb){return function(_0x40a764){if(_0x40a764){return _0x40a764[_0x7a64('0x27')]()[_0x7a64('0x26')](function(){var _0x5ab77e=_0x40a764['get']({'plain':!![]});var _0x39d126=_0x7a64('0x28');return db[_0x7a64('0x29')][_0x7a64('0x27')]({'where':{'type':_0x39d126,'resourceId':_0x5ab77e['id']}})[_0x7a64('0x26')](function(){return _0x40a764;});})[_0x7a64('0x26')](function(){_0x508850[_0x7a64('0x1b')](0xcc)[_0x7a64('0x1a')]();});}};}function handleEntityNotFound(_0x16067d,_0xc993e8){return function(_0x8db51e){if(!_0x8db51e){_0x16067d[_0x7a64('0x19')](0x194);}return _0x8db51e;};}function handleError(_0x15d760,_0x657591){_0x657591=_0x657591||0x1f4;return function(_0x4504f1){logger['error'](_0x4504f1[_0x7a64('0x2a')]);if(_0x4504f1['name']){delete _0x4504f1[_0x7a64('0x2b')];}_0x15d760[_0x7a64('0x1b')](_0x657591)['send'](_0x4504f1);};}exports[_0x7a64('0x2c')]=function(_0x13b0c1,_0x51e8cd){var _0x1558ac={},_0x1b383f={},_0x456eac={'count':0x0,'rows':[]};var _0x2ce8ce=_['map'](db[_0x7a64('0x2d')][_0x7a64('0x2e')],function(_0x29a6fb){return{'name':_0x29a6fb[_0x7a64('0x2f')],'type':_0x29a6fb[_0x7a64('0x30')][_0x7a64('0x31')]};});_0x1b383f['model']=_[_0x7a64('0x32')](_0x2ce8ce,_0x7a64('0x2b'));_0x1b383f[_0x7a64('0x33')]=_['keys'](_0x13b0c1['query']);_0x1b383f[_0x7a64('0x34')]=_[_0x7a64('0x35')](_0x1b383f[_0x7a64('0x36')],_0x1b383f[_0x7a64('0x33')]);_0x1558ac['attributes']=_[_0x7a64('0x35')](_0x1b383f['model'],qs[_0x7a64('0x37')](_0x13b0c1[_0x7a64('0x33')]['fields']));_0x1558ac['attributes']=_0x1558ac[_0x7a64('0x38')][_0x7a64('0x39')]?_0x1558ac[_0x7a64('0x38')]:_0x1b383f[_0x7a64('0x36')];if(!_0x13b0c1[_0x7a64('0x33')][_0x7a64('0x3a')]('nolimit')){_0x1558ac[_0x7a64('0x1f')]=qs[_0x7a64('0x1f')](_0x13b0c1[_0x7a64('0x33')][_0x7a64('0x1f')]);_0x1558ac['offset']=qs[_0x7a64('0x1e')](_0x13b0c1[_0x7a64('0x33')][_0x7a64('0x1e')]);}_0x1558ac[_0x7a64('0x3b')]=qs[_0x7a64('0x3c')](_0x13b0c1[_0x7a64('0x33')]['sort']);_0x1558ac[_0x7a64('0x3d')]=qs[_0x7a64('0x34')](_[_0x7a64('0x3e')](_0x13b0c1[_0x7a64('0x33')],_0x1b383f[_0x7a64('0x34')]),_0x2ce8ce);if(_0x13b0c1[_0x7a64('0x33')][_0x7a64('0x3f')]){_0x1558ac['where']=_[_0x7a64('0x40')](_0x1558ac[_0x7a64('0x3d')],{'$or':_[_0x7a64('0x32')](_0x2ce8ce,function(_0x243484){if(_0x243484[_0x7a64('0x30')]!==_0x7a64('0x41')){var _0x4da612={};_0x4da612[_0x243484['name']]={'$like':'%'+_0x13b0c1[_0x7a64('0x33')][_0x7a64('0x3f')]+'%'};return _0x4da612;}})});}_0x1558ac=_[_0x7a64('0x40')]({},_0x1558ac,_0x13b0c1[_0x7a64('0x42')]);var _0x4c82df={'where':_0x1558ac[_0x7a64('0x3d')]};return db[_0x7a64('0x2d')][_0x7a64('0x1d')](_0x4c82df)[_0x7a64('0x26')](function(_0x2f2136){_0x456eac[_0x7a64('0x1d')]=_0x2f2136;if(_0x13b0c1[_0x7a64('0x33')][_0x7a64('0x43')]){_0x1558ac[_0x7a64('0x44')]=[{'all':!![]}];}return db[_0x7a64('0x2d')][_0x7a64('0x45')](_0x1558ac);})[_0x7a64('0x26')](function(_0x530f21){_0x456eac[_0x7a64('0x46')]=_0x530f21;return _0x456eac;})[_0x7a64('0x26')](respondWithFilteredResult(_0x51e8cd,_0x1558ac))[_0x7a64('0x47')](handleError(_0x51e8cd,null));};exports[_0x7a64('0x48')]=function(_0x15aa2b,_0x504a55){var _0x8f6591={'raw':!![],'where':{'id':_0x15aa2b[_0x7a64('0x49')]['id']}},_0x4cbb72={};_0x4cbb72[_0x7a64('0x36')]=_[_0x7a64('0x4a')](db[_0x7a64('0x2d')][_0x7a64('0x2e')]);_0x4cbb72['query']=_[_0x7a64('0x4a')](_0x15aa2b[_0x7a64('0x33')]);_0x4cbb72[_0x7a64('0x34')]=_[_0x7a64('0x35')](_0x4cbb72['model'],_0x4cbb72[_0x7a64('0x33')]);_0x8f6591[_0x7a64('0x38')]=_['intersection'](_0x4cbb72[_0x7a64('0x36')],qs[_0x7a64('0x37')](_0x15aa2b[_0x7a64('0x33')]['fields']));_0x8f6591['attributes']=_0x8f6591[_0x7a64('0x38')][_0x7a64('0x39')]?_0x8f6591['attributes']:_0x4cbb72[_0x7a64('0x36')];if(_0x15aa2b['query']['includeAll']){_0x8f6591[_0x7a64('0x44')]=[{'all':!![]}];}_0x8f6591=_[_0x7a64('0x40')]({},_0x8f6591,_0x15aa2b[_0x7a64('0x42')]);return db['AnalyticDefaultReport'][_0x7a64('0x4b')](_0x8f6591)[_0x7a64('0x26')](handleEntityNotFound(_0x504a55,null))[_0x7a64('0x26')](respondWithResult(_0x504a55,null))[_0x7a64('0x47')](handleError(_0x504a55,null));};exports[_0x7a64('0x4c')]=function(_0x13da38,_0x3ef031){return db['AnalyticDefaultReport'][_0x7a64('0x4c')](_0x13da38['body'],{})['then'](function(_0x543905){var _0x2cf213=_0x13da38[_0x7a64('0x4d')][_0x7a64('0x4e')]({'plain':!![]});if(!_0x2cf213)throw new Error(_0x7a64('0x4f'));if(_0x2cf213['role']===_0x7a64('0x4d')){var _0x4c5da6=_0x543905[_0x7a64('0x4e')]({'plain':!![]});var _0x4e1402=_0x7a64('0x50');return db[_0x7a64('0x51')][_0x7a64('0x4b')]({'where':{'name':_0x4e1402,'userProfileId':_0x2cf213['userProfileId']},'raw':!![]})[_0x7a64('0x26')](function(_0x23bfd5){if(_0x23bfd5&&_0x23bfd5['autoAssociation']===0x0){return db[_0x7a64('0x29')][_0x7a64('0x4c')]({'name':_0x4c5da6[_0x7a64('0x2b')],'resourceId':_0x4c5da6['id'],'type':_0x7a64('0x28'),'sectionId':_0x23bfd5['id']},{})[_0x7a64('0x26')](function(){return _0x543905;});}else{return _0x543905;}})[_0x7a64('0x47')](function(_0xf68b67){logger[_0x7a64('0x52')](_0x7a64('0x53'),_0xf68b67);throw _0xf68b67;});}return _0x543905;})[_0x7a64('0x26')](respondWithResult(_0x3ef031,0xc9))['catch'](handleError(_0x3ef031,null));};exports[_0x7a64('0x25')]=function(_0x2b2ff8,_0x23923d){if(_0x2b2ff8['body']['id']){delete _0x2b2ff8[_0x7a64('0x54')]['id'];}return db[_0x7a64('0x2d')][_0x7a64('0x4b')]({'where':{'id':_0x2b2ff8['params']['id']}})[_0x7a64('0x26')](handleEntityNotFound(_0x23923d,null))['then'](saveUpdates(_0x2b2ff8['body'],null))[_0x7a64('0x26')](respondWithResult(_0x23923d,null))['catch'](handleError(_0x23923d,null));};exports['destroy']=function(_0x1307b7,_0x251565){return db['AnalyticDefaultReport'][_0x7a64('0x4b')]({'where':{'id':_0x1307b7[_0x7a64('0x49')]['id']}})[_0x7a64('0x26')](handleEntityNotFound(_0x251565,null))[_0x7a64('0x26')](removeEntity(_0x251565,null))[_0x7a64('0x47')](handleError(_0x251565,null));};exports[_0x7a64('0x55')]=function(_0x10e97d,_0x2e4caf){var _0x27cd4a=0xa;var _0x1fc3d5=[_0x7a64('0x56'),_0x7a64('0x57'),'right_join',_0x7a64('0x58')];var _0x21b5ed={'SUM':_0x7a64('0x59'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x7a64('0x5a'),'MAX':_0x7a64('0x5b'),'MIN':_0x7a64('0x5c'),'AVG':_0x7a64('0x5d'),'GROUP_CONCAT':_0x7a64('0x5e'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x7a64('0x5f')};var _0x37e27f={'SEC_TO_TIME':_0x7a64('0x60'),'DATE':_0x7a64('0x61'),'HOUR':_0x7a64('0x62'),'ROUND':_0x7a64('0x63'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x393cf6=function(_0x2fea3a){return!_['includes']([_0x7a64('0x64'),_0x7a64('0x65'),_0x7a64('0x66'),_0x7a64('0x67')],_0x2fea3a);};var _0x448101=function(_0x4e1311){if(!_0x4e1311||!_0x4e1311['rules'][_0x7a64('0x39')]){return'';}for(var _0x32ca6f='(',_0x45dd76=0x0;_0x45dd76<_0x4e1311['rules'][_0x7a64('0x39')];_0x45dd76+=0x1){_0x45dd76>0x0&&(_0x32ca6f+='\x20'+_0x4e1311[_0x7a64('0x68')]+'\x20');_0x32ca6f+=_0x4e1311[_0x7a64('0x69')][_0x45dd76][_0x7a64('0x6a')]?_0x448101(_0x4e1311['rules'][_0x45dd76][_0x7a64('0x6a')]):_0x4e1311[_0x7a64('0x69')][_0x45dd76][_0x7a64('0x6b')]+'\x20'+_0x4e1311[_0x7a64('0x69')][_0x45dd76][_0x7a64('0x6c')]+(_0x393cf6(_0x4e1311[_0x7a64('0x69')][_0x45dd76][_0x7a64('0x6c')])?'\x20'+_0x4e1311[_0x7a64('0x69')][_0x45dd76]['value']:'');}return _0x32ca6f+')';};var _0x3a4cf4={'where':{'id':_0x10e97d[_0x7a64('0x49')]['id']}},_0x5b7d28,_0x5a5fa1,_0x4099c2,_0x5d0a4a,_0x357d35;_0x3a4cf4=_[_0x7a64('0x40')]({},_0x3a4cf4,_0x10e97d[_0x7a64('0x42')]);return db['AnalyticDefaultReport'][_0x7a64('0x4b')](_0x3a4cf4)[_0x7a64('0x26')](function(_0x1f8328){if(_0x1f8328){_0x5b7d28=_0x1f8328;return _0x1f8328['getFields']();}return null;})[_0x7a64('0x26')](function(_0x1aa1e0){if(_0x1aa1e0){if(!_0x1aa1e0[_0x7a64('0x39')]){throw new db['Sequelize'][(_0x7a64('0x6d'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x5a5fa1=_0x1aa1e0;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0x7a64('0x26')](function(_0x1f094d){if(_0x1f094d){_0x4099c2=_[_0x7a64('0x6e')](_0x1f094d,'id');var _0xecb5db;var _0x93d91f=squel['select']();_0x93d91f[_0x7a64('0x6f')](_0x5b7d28[_0x7a64('0x70')]);for(var _0x1d9636=0x0;_0x1d9636<_0x5a5fa1[_0x7a64('0x39')];_0x1d9636+=0x1){_0xecb5db=_0x5a5fa1[_0x1d9636]['MetricId']?_0x4099c2[_0x5a5fa1[_0x1d9636][_0x7a64('0x71')]][_0x7a64('0x72')]:_0x5a5fa1[_0x1d9636]['field'];_0xecb5db=_0x5a5fa1[_0x1d9636]['function']?_[_0x7a64('0x73')](_0x21b5ed[_0x5a5fa1[_0x1d9636][_0x7a64('0x74')]],'%s',_0xecb5db):_0xecb5db;_0xecb5db=_0x5a5fa1[_0x1d9636][_0x7a64('0x75')]?_[_0x7a64('0x73')](_0x37e27f[_0x5a5fa1[_0x1d9636][_0x7a64('0x75')]],'%s',_0xecb5db):_0xecb5db;if(_0x5a5fa1[_0x1d9636][_0x7a64('0x76')]){_0x93d91f['group'](_0xecb5db);}_0x5a5fa1[_0x1d9636]['orderBy']&&_0x93d91f['order'](_0xecb5db,_0x5a5fa1[_0x1d9636][_0x7a64('0x77')]===_0x7a64('0x78')?![]:!![]);_0x93d91f[_0x7a64('0x6b')](_0xecb5db,_0x5a5fa1[_0x1d9636]['alias']||_0xecb5db);}if(_0x5b7d28[_0x7a64('0x79')]){_0x5b7d28['joins']=JSON[_0x7a64('0x7a')](_0x5b7d28[_0x7a64('0x79')]);for(var _0x1696dc=0x0;_0x1696dc<_0x5b7d28[_0x7a64('0x79')]['length'];_0x1696dc+=0x1){if(_0x5b7d28[_0x7a64('0x79')][_0x1696dc][_0x7a64('0x30')]&&_[_0x7a64('0x7b')](_0x1fc3d5,_0x5b7d28[_0x7a64('0x79')][_0x1696dc][_0x7a64('0x30')])&&_0x5b7d28[_0x7a64('0x79')][_0x1696dc][_0x7a64('0x7c')]&&_0x5b7d28[_0x7a64('0x79')][_0x1696dc][_0x7a64('0x7d')]&&_0x5b7d28[_0x7a64('0x79')][_0x1696dc]['foreignKey']){_0x93d91f[_0x5b7d28[_0x7a64('0x79')][_0x1696dc][_0x7a64('0x30')]](_0x5b7d28['joins'][_0x1696dc]['foreignTable'],null,util[_0x7a64('0x75')](_0x7a64('0x7e'),_0x5b7d28[_0x7a64('0x70')],_0x5b7d28[_0x7a64('0x79')][_0x1696dc][_0x7a64('0x7c')],_0x5b7d28[_0x7a64('0x79')][_0x1696dc][_0x7a64('0x7d')],_0x5b7d28[_0x7a64('0x79')][_0x1696dc][_0x7a64('0x7f')]));}}}if(_0x5b7d28[_0x7a64('0x80')]){_0x5b7d28[_0x7a64('0x80')]=JSON[_0x7a64('0x7a')](_0x5b7d28[_0x7a64('0x80')]);_0x93d91f[_0x7a64('0x3d')](_0x448101(_0x5b7d28['conditions']['group']));}_0x357d35=_0x93d91f[_0x7a64('0x81')]();_0x93d91f['limit'](_0x27cd4a);_0x93d91f[_0x7a64('0x1e')](0x0);logger[_0x7a64('0x82')](_0x7a64('0x83'),_0x93d91f['toString']());return db[_0x7a64('0x84')]['query'](_0x93d91f[_0x7a64('0x85')](),{'type':db[_0x7a64('0x84')][_0x7a64('0x86')]['SELECT']});}})[_0x7a64('0x26')](respondWithResult(_0x2e4caf,null))[_0x7a64('0x47')](handleError(_0x2e4caf,null));};function runReport(_0x5f0372,_0x5a9554,_0xa5d063){var _0x330dca=_0x5a9554[_0x7a64('0x2b')];var _0x45299f=0xa;var _0x4d0d8e=[_0x7a64('0x56'),_0x7a64('0x57'),'right_join','cross_join'];var _0x1f5236={'SUM':_0x7a64('0x59'),'COUNT':_0x7a64('0x87'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0x7a64('0x5c'),'AVG':_0x7a64('0x5d'),'GROUP_CONCAT':_0x7a64('0x5e'),'GROUP_CONCAT ASC':_0x7a64('0x88'),'GROUP_CONCAT DESC':_0x7a64('0x5f')};var _0x5efa6a={'SEC_TO_TIME':_0x7a64('0x60'),'DATE':_0x7a64('0x61'),'HOUR':_0x7a64('0x62'),'ROUND':_0x7a64('0x63'),'UNIX_TIMESTAMP':_0x7a64('0x89')};var _0x2c8fdf=function(_0x32e07a){return!_[_0x7a64('0x7b')]([_0x7a64('0x64'),_0x7a64('0x65'),'IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0x32e07a);};var _0x354e97=function(_0x108287){if(!_0x108287||!_0x108287[_0x7a64('0x69')][_0x7a64('0x39')]){return'';}for(var _0x724ac5='(',_0x323ef0=0x0;_0x323ef0<_0x108287[_0x7a64('0x69')]['length'];_0x323ef0+=0x1){_0x323ef0>0x0&&(_0x724ac5+='\x20'+_0x108287['operator']+'\x20');_0x724ac5+=_0x108287[_0x7a64('0x69')][_0x323ef0][_0x7a64('0x6a')]?_0x354e97(_0x108287['rules'][_0x323ef0]['group']):_0x108287[_0x7a64('0x69')][_0x323ef0][_0x7a64('0x6b')]+'\x20'+_0x108287[_0x7a64('0x69')][_0x323ef0]['condition']+(_0x2c8fdf(_0x108287[_0x7a64('0x69')][_0x323ef0][_0x7a64('0x6c')])?'\x20'+_0x108287['rules'][_0x323ef0]['value']:'');}return _0x724ac5+')';};var _0x142f32={'where':{'id':_0x5f0372['id']}},_0x3f0e1b,_0x3cd3c1,_0xff1c61,_0x2f634d,_0x3fd789;_0x142f32=_[_0x7a64('0x40')]({},_0x142f32,_0xa5d063);return db[_0x7a64('0x2d')][_0x7a64('0x4b')](_0x142f32)[_0x7a64('0x26')](function(_0x41aa02){if(_0x41aa02){_0x3f0e1b=_0x41aa02;return _0x41aa02[_0x7a64('0x8a')]();}return null;})['then'](function(_0x7fe5a1){if(_0x7fe5a1){if(!_0x7fe5a1['length']){throw new db[(_0x7a64('0x8b'))][(_0x7a64('0x6d'))](_0x7a64('0x8c'),0x193);}_0x3cd3c1=_0x7fe5a1;return db[_0x7a64('0x8d')][_0x7a64('0x45')]({'raw':!![]});}return null;})[_0x7a64('0x26')](function(_0x11520e){if(_0x11520e){_0xff1c61=_[_0x7a64('0x6e')](_0x11520e,'id');var _0x17e006;var _0x5db847=squel[_0x7a64('0x8e')]();_0x5db847['from'](_0x3f0e1b['table']);for(var _0x500b8c=0x0;_0x500b8c<_0x3cd3c1['length'];_0x500b8c+=0x1){_0x17e006=_0x3cd3c1[_0x500b8c][_0x7a64('0x71')]?_0xff1c61[_0x3cd3c1[_0x500b8c]['MetricId']][_0x7a64('0x72')]:_0x3cd3c1[_0x500b8c]['field'];_0x17e006=_0x3cd3c1[_0x500b8c][_0x7a64('0x74')]?_[_0x7a64('0x73')](_0x1f5236[_0x3cd3c1[_0x500b8c][_0x7a64('0x74')]],'%s',_0x17e006):_0x17e006;_0x17e006=_0x3cd3c1[_0x500b8c]['format']?_[_0x7a64('0x73')](_0x5efa6a[_0x3cd3c1[_0x500b8c][_0x7a64('0x75')]],'%s',_0x17e006):_0x17e006;if(_0x3cd3c1[_0x500b8c][_0x7a64('0x76')]){_0x5db847[_0x7a64('0x6a')](_0x17e006);}_0x3cd3c1[_0x500b8c]['orderBy']&&_0x5db847['order'](_0x17e006,_0x3cd3c1[_0x500b8c][_0x7a64('0x77')]==='DESC'?![]:!![]);_0x5db847[_0x7a64('0x6b')](_0x17e006,_0x3cd3c1[_0x500b8c][_0x7a64('0x8f')]||_0x17e006);}if(_0x3f0e1b[_0x7a64('0x79')]){_0x3f0e1b[_0x7a64('0x79')]=JSON['parse'](_0x3f0e1b[_0x7a64('0x79')]);for(var _0x3667e6=0x0;_0x3667e6<_0x3f0e1b[_0x7a64('0x79')][_0x7a64('0x39')];_0x3667e6+=0x1){if(_0x3f0e1b[_0x7a64('0x79')][_0x3667e6][_0x7a64('0x30')]&&_['includes'](_0x4d0d8e,_0x3f0e1b[_0x7a64('0x79')][_0x3667e6][_0x7a64('0x30')])&&_0x3f0e1b[_0x7a64('0x79')][_0x3667e6][_0x7a64('0x7c')]&&_0x3f0e1b[_0x7a64('0x79')][_0x3667e6][_0x7a64('0x7d')]&&_0x3f0e1b[_0x7a64('0x79')][_0x3667e6][_0x7a64('0x7f')]){_0x5db847[_0x3f0e1b[_0x7a64('0x79')][_0x3667e6]['type']](_0x3f0e1b['joins'][_0x3667e6]['foreignTable'],null,util[_0x7a64('0x75')](_0x7a64('0x7e'),_0x3f0e1b[_0x7a64('0x70')],_0x3f0e1b[_0x7a64('0x79')][_0x3667e6][_0x7a64('0x7c')],_0x3f0e1b[_0x7a64('0x79')][_0x3667e6][_0x7a64('0x7d')],_0x3f0e1b[_0x7a64('0x79')][_0x3667e6][_0x7a64('0x7f')]));}}}if(_0x3f0e1b['conditions']){_0x3f0e1b[_0x7a64('0x80')]=JSON[_0x7a64('0x7a')](_0x3f0e1b[_0x7a64('0x80')]);_0x5db847[_0x7a64('0x3d')](_0x354e97(_0x3f0e1b['conditions'][_0x7a64('0x6a')]));}_0x3fd789=_0x5db847[_0x7a64('0x81')]();_0x5db847[_0x7a64('0x1f')](_0x45299f);_0x5db847[_0x7a64('0x1e')](0x0);logger['debug'](_0x7a64('0x83'),_0x5db847[_0x7a64('0x85')]());return db[_0x7a64('0x84')][_0x7a64('0x33')](_0x5db847[_0x7a64('0x85')](),{'type':db[_0x7a64('0x84')]['QueryTypes'][_0x7a64('0x90')]});}})[_0x7a64('0x26')](function(_0x9743ae){if(!_0x9743ae[_0x7a64('0x39')]){throw new db[(_0x7a64('0x8b'))][(_0x7a64('0x6d'))](_0x7a64('0x91'),0xcc);}if(_0x5a9554[_0x7a64('0x92')]===_0x7a64('0x93')){return null;}var _0x36bc78=_[_0x7a64('0x40')](_0x5a9554,{'name':_0x5a9554[_0x7a64('0x94')]||_0x5a9554[_0x7a64('0x2b')]||_0x3f0e1b[_0x7a64('0x2b')],'basename':_0x330dca,'savename':util['format'](_0x7a64('0x95'),_0x5a9554[_0x7a64('0x2b')]||_0x3f0e1b[_0x7a64('0x2b')],require('randomstring')[_0x7a64('0x96')](0x4),_0x5a9554['output']||_0x7a64('0x97')),'reportId':_0x3f0e1b['id'],'reportType':_0x7a64('0x98')});return db[_0x7a64('0x99')]['create'](_0x36bc78,{'raw':!![]});})['then'](function(_0x2d16d0){if(_0x3f0e1b[_0x7a64('0x70')]===_0x7a64('0x9a')){_0x3fd789[_0x7a64('0x3d')](_0x3f0e1b[_0x7a64('0x70')]+_0x7a64('0x9b'),_0x5a9554[_0x7a64('0x9c')],_0x5a9554[_0x7a64('0x9d')]);}else{_0x3fd789[_0x7a64('0x3d')](_0x3f0e1b[_0x7a64('0x70')]+_0x7a64('0x9e'),_0x5a9554[_0x7a64('0x9c')],_0x5a9554['endDate']);}if(_0x2d16d0){logger[_0x7a64('0x9f')]('Run\x20Query:',_0x3fd789[_0x7a64('0x85')]());require(_0x7a64('0xa0'))[_0x7a64('0xa1')](path[_0x7a64('0x56')](__dirname,_0x7a64('0xa2'),_0x2d16d0[_0x7a64('0x92')]),[_0x2d16d0['id'],_0x3fd789[_0x7a64('0x85')](),path[_0x7a64('0x56')](__dirname,_0x7a64('0xa3'),_0x2d16d0[_0x7a64('0xa4')]),_0x330dca]);return _0x2d16d0;}else{var _0x22a1b8=squel['select']();_0x22a1b8[_0x7a64('0x6f')]('('+_0x3fd789[_0x7a64('0x85')]()+')',_0x7a64('0xa5'));_0x22a1b8['field'](_0x7a64('0xa6'),'count');_0x3fd789[_0x7a64('0x1f')](_0x5a9554['limit']||_0x45299f);_0x3fd789[_0x7a64('0x1e')](_0x5a9554['offset']||0x0);return dbH[_0x7a64('0x84')]['query'](_0x22a1b8[_0x7a64('0x85')](),{'type':dbH[_0x7a64('0x84')][_0x7a64('0x86')][_0x7a64('0x90')]})[_0x7a64('0x26')](function(_0x2daf48){if(!_0x2daf48[_0x7a64('0x39')]){_0x2f634d=0x0;}else{_0x2f634d=_0x2daf48[0x0][_0x7a64('0x1d')]||0x0;}return dbH['sequelize']['query'](_0x3fd789['toString'](),{'type':dbH[_0x7a64('0x84')]['QueryTypes']['SELECT']});})['then'](function(_0x12e381){return{'rows':_0x12e381||[],'count':_0x2f634d};});}});}exports[_0x7a64('0xa7')]=function(_0x1f74bc,_0x12cfed){return runReport(_0x1f74bc[_0x7a64('0x49')],_0x1f74bc['query'],_0x1f74bc[_0x7a64('0x42')])[_0x7a64('0x26')](respondWithResult(_0x12cfed,null))['catch'](handleError(_0x12cfed,null));};exports['runReport']=runReport;exports[_0x7a64('0x33')]=function(_0x2e9fba,_0x9ab759){var _0x3850fc=0xa;var _0x32a2a5=[_0x7a64('0x56'),'left_join',_0x7a64('0xa8'),_0x7a64('0x58')];var _0xd0c9a9={'SUM':_0x7a64('0x59'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x7a64('0x5a'),'MAX':_0x7a64('0x5b'),'MIN':_0x7a64('0x5c'),'AVG':_0x7a64('0x5d'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x7a64('0x5f')};var _0x437481={'SEC_TO_TIME':_0x7a64('0x60'),'DATE':_0x7a64('0x61'),'HOUR':'HOUR(%s)','ROUND':_0x7a64('0x63'),'UNIX_TIMESTAMP':_0x7a64('0x89')};var _0x132b84=function(_0x194c01){return!_['includes'](['IS\x20NULL',_0x7a64('0x65'),_0x7a64('0x66'),_0x7a64('0x67')],_0x194c01);};var _0x546856=function(_0x997f0b){if(!_0x997f0b||!_0x997f0b[_0x7a64('0x69')][_0x7a64('0x39')]){return'';}for(var _0x3bd554='(',_0x3bd48f=0x0;_0x3bd48f<_0x997f0b[_0x7a64('0x69')][_0x7a64('0x39')];_0x3bd48f+=0x1){_0x3bd48f>0x0&&(_0x3bd554+='\x20'+_0x997f0b[_0x7a64('0x68')]+'\x20');_0x3bd554+=_0x997f0b[_0x7a64('0x69')][_0x3bd48f]['group']?_0x546856(_0x997f0b['rules'][_0x3bd48f]['group']):_0x997f0b[_0x7a64('0x69')][_0x3bd48f]['field']+'\x20'+_0x997f0b[_0x7a64('0x69')][_0x3bd48f][_0x7a64('0x6c')]+(_0x132b84(_0x997f0b[_0x7a64('0x69')][_0x3bd48f][_0x7a64('0x6c')])?'\x20'+_0x997f0b[_0x7a64('0x69')][_0x3bd48f][_0x7a64('0xa9')]:'');}return _0x3bd554+')';};var _0x29e29a={'where':{'id':_0x2e9fba[_0x7a64('0x49')]['id']}},_0x544858,_0x4af89e,_0xf43159,_0x1071aa,_0x1740fa;_0x29e29a=_[_0x7a64('0x40')]({},_0x29e29a,_0x2e9fba['options']);return db[_0x7a64('0x2d')][_0x7a64('0x4b')](_0x29e29a)['then'](function(_0x8ed814){if(_0x8ed814){_0x544858=_0x8ed814;return _0x8ed814[_0x7a64('0x8a')]();}return null;})[_0x7a64('0x26')](function(_0x31c979){if(_0x31c979){if(!_0x31c979['length']){throw new db[(_0x7a64('0x8b'))][(_0x7a64('0x6d'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x4af89e=_0x31c979;return db[_0x7a64('0x8d')][_0x7a64('0x45')]({'raw':!![]});}return null;})[_0x7a64('0x26')](function(_0x3be000){if(_0x3be000){_0xf43159=_[_0x7a64('0x6e')](_0x3be000,'id');var _0x3f1f3a;var _0x219342=squel['select']();_0x219342[_0x7a64('0x6f')](_0x544858[_0x7a64('0x70')]);for(var _0x294ab1=0x0;_0x294ab1<_0x4af89e[_0x7a64('0x39')];_0x294ab1+=0x1){_0x3f1f3a=_0x4af89e[_0x294ab1][_0x7a64('0x71')]?_0xf43159[_0x4af89e[_0x294ab1][_0x7a64('0x71')]]['metric']:_0x4af89e[_0x294ab1][_0x7a64('0x6b')];_0x3f1f3a=_0x4af89e[_0x294ab1]['function']?_[_0x7a64('0x73')](_0xd0c9a9[_0x4af89e[_0x294ab1][_0x7a64('0x74')]],'%s',_0x3f1f3a):_0x3f1f3a;_0x3f1f3a=_0x4af89e[_0x294ab1][_0x7a64('0x75')]?_[_0x7a64('0x73')](_0x437481[_0x4af89e[_0x294ab1]['format']],'%s',_0x3f1f3a):_0x3f1f3a;if(_0x4af89e[_0x294ab1][_0x7a64('0x76')]){_0x219342[_0x7a64('0x6a')](_0x3f1f3a);}_0x4af89e[_0x294ab1][_0x7a64('0x77')]&&_0x219342[_0x7a64('0x3b')](_0x3f1f3a,_0x4af89e[_0x294ab1]['orderBy']===_0x7a64('0x78')?![]:!![]);_0x219342['field'](_0x3f1f3a,_0x4af89e[_0x294ab1][_0x7a64('0x8f')]||_0x3f1f3a);}if(_0x544858['joins']){_0x544858[_0x7a64('0x79')]=JSON[_0x7a64('0x7a')](_0x544858['joins']);for(var _0x3f1ae7=0x0;_0x3f1ae7<_0x544858[_0x7a64('0x79')]['length'];_0x3f1ae7+=0x1){if(_0x544858[_0x7a64('0x79')][_0x3f1ae7][_0x7a64('0x30')]&&_[_0x7a64('0x7b')](_0x32a2a5,_0x544858['joins'][_0x3f1ae7][_0x7a64('0x30')])&&_0x544858[_0x7a64('0x79')][_0x3f1ae7]['parentKey']&&_0x544858[_0x7a64('0x79')][_0x3f1ae7][_0x7a64('0x7d')]&&_0x544858[_0x7a64('0x79')][_0x3f1ae7][_0x7a64('0x7f')]){_0x219342[_0x544858['joins'][_0x3f1ae7][_0x7a64('0x30')]](_0x544858[_0x7a64('0x79')][_0x3f1ae7][_0x7a64('0x7d')],null,util['format'](_0x7a64('0x7e'),_0x544858[_0x7a64('0x70')],_0x544858[_0x7a64('0x79')][_0x3f1ae7]['parentKey'],_0x544858[_0x7a64('0x79')][_0x3f1ae7]['foreignTable'],_0x544858['joins'][_0x3f1ae7][_0x7a64('0x7f')]));}}}if(_0x544858[_0x7a64('0x80')]){_0x544858[_0x7a64('0x80')]=JSON[_0x7a64('0x7a')](_0x544858[_0x7a64('0x80')]);_0x219342['where'](_0x546856(_0x544858[_0x7a64('0x80')]['group']));}_0x1740fa=_0x219342['clone']();_0x219342['limit'](_0x3850fc);_0x219342[_0x7a64('0x1e')](0x0);logger[_0x7a64('0x82')]('Limited\x20Query:',_0x219342[_0x7a64('0x85')]());return db['sequelize'][_0x7a64('0x33')](_0x219342[_0x7a64('0x85')](),{'type':db['sequelize'][_0x7a64('0x86')][_0x7a64('0x90')]});}})[_0x7a64('0x26')](function(){return{'sql':_0x1740fa['toString']()};})[_0x7a64('0x26')](respondWithResult(_0x9ab759,null))[_0x7a64('0x47')](handleError(_0x9ab759,null));}; \ No newline at end of file +var _0x418c=['lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','dbH','sendStatus','status','end','json','offset','limit','set','Content-Range','reject','update','then','destroy','get','DefaultReports','UserProfileResource','error','stack','name','index','map','AnalyticDefaultReport','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','right_join','cross_join','COUNT(%s)','COUNT(DISTINCT\x20%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','rules','group','field','condition','value','getFields','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','findAll','keyBy','select','from','table','MetricId','metric','function','replace','format','groupBy','orderBy','DESC','alias','joins','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','foreignKey','conditions','parse','clone','debug','Limited\x20Query:','toString','sequelize','SUM(%s)','MAX(%s)','MIN(%s)','AVG(%s)','UNIX_TIMESTAMP(%s)','IS\x20NOT\x20EMPTY','operator','order','QueryTypes','SELECT','ValidationErrorItem','No\x20available\x20data','output','web','%s-%s.%s','randomstring','generate','csv','default','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','startDate','info','Run\x20Query:','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','run','runReport','GROUP_CONCAT(%s)','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs'];(function(_0x4fec4e,_0x67a8e2){var _0x3a35a9=function(_0x307ca0){while(--_0x307ca0){_0x4fec4e['push'](_0x4fec4e['shift']());}};_0x3a35a9(++_0x67a8e2);}(_0x418c,0x99));var _0xc418=function(_0x4e653c,_0x2773f1){_0x4e653c=_0x4e653c-0x0;var _0x55f519=_0x418c[_0x4e653c];return _0x55f519;};'use strict';var pdf=require(_0xc418('0x0'));var emlformat=require(_0xc418('0x1'));var rimraf=require(_0xc418('0x2'));var zipdir=require(_0xc418('0x3'));var jsonpatch=require(_0xc418('0x4'));var rp=require(_0xc418('0x5'));var moment=require(_0xc418('0x6'));var BPromise=require(_0xc418('0x7'));var Mustache=require(_0xc418('0x8'));var util=require(_0xc418('0x9'));var path=require(_0xc418('0xa'));var sox=require(_0xc418('0xb'));var csv=require(_0xc418('0xc'));var ejs=require(_0xc418('0xd'));var fs=require('fs');var _=require(_0xc418('0xe'));var squel=require(_0xc418('0xf'));var crypto=require('crypto');var jsforce=require(_0xc418('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xc418('0xc'));var querystring=require(_0xc418('0x11'));var Papa=require(_0xc418('0x12'));var Redis=require(_0xc418('0x13'));var authService=require(_0xc418('0x14'));var qs=require(_0xc418('0x15'));var as=require(_0xc418('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc418('0x17'))(_0xc418('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xc418('0x19'))['db'];var dbH=require(_0xc418('0x19'))[_0xc418('0x1a')];function respondWithStatusCode(_0x24982d,_0xde7c50){_0xde7c50=_0xde7c50||0xcc;return function(_0x33e0ae){if(_0x33e0ae){return _0x24982d[_0xc418('0x1b')](_0xde7c50);}return _0x24982d[_0xc418('0x1c')](_0xde7c50)[_0xc418('0x1d')]();};}function respondWithResult(_0x1d903e,_0x4609ff){_0x4609ff=_0x4609ff||0xc8;return function(_0x13daae){if(_0x13daae){return _0x1d903e[_0xc418('0x1c')](_0x4609ff)[_0xc418('0x1e')](_0x13daae);}};}function respondWithFilteredResult(_0x1b24d9,_0x5796c7){return function(_0x4c7197){if(_0x4c7197){var _0x169ee0=_0x4c7197['count'],_0x12393b=_0x5796c7[_0xc418('0x1f')],_0x4f0100=_0x5796c7['offset']+_0x5796c7[_0xc418('0x20')],_0x393082;if(_0x4f0100>=_0x169ee0){_0x4f0100=_0x169ee0;_0x393082=0xc8;}else{_0x393082=0xce;}_0x1b24d9['status'](_0x393082);return _0x1b24d9[_0xc418('0x21')](_0xc418('0x22'),_0x12393b+'-'+_0x4f0100+'/'+_0x169ee0)['json'](_0x4c7197);}return null;};}function patchUpdates(_0xf4d4f2){return function(_0x9dc897){try{jsonpatch['apply'](_0x9dc897,_0xf4d4f2,!![]);}catch(_0x31abd3){return BPromise[_0xc418('0x23')](_0x31abd3);}return _0x9dc897['save']();};}function saveUpdates(_0xc29ee2,_0xfda224){return function(_0x545911){if(_0x545911){return _0x545911[_0xc418('0x24')](_0xc29ee2)[_0xc418('0x25')](function(_0x3a0394){return _0x3a0394;});}return null;};}function removeEntity(_0x29d915,_0x501933){return function(_0x181cdf){if(_0x181cdf){return _0x181cdf[_0xc418('0x26')]()[_0xc418('0x25')](function(){var _0x144489=_0x181cdf[_0xc418('0x27')]({'plain':!![]});var _0x3cba2d=_0xc418('0x28');return db[_0xc418('0x29')]['destroy']({'where':{'type':_0x3cba2d,'resourceId':_0x144489['id']}})['then'](function(){return _0x181cdf;});})['then'](function(){_0x29d915[_0xc418('0x1c')](0xcc)[_0xc418('0x1d')]();});}};}function handleEntityNotFound(_0x4473db,_0x251c62){return function(_0x13cc25){if(!_0x13cc25){_0x4473db[_0xc418('0x1b')](0x194);}return _0x13cc25;};}function handleError(_0x27dda3,_0x3dada6){_0x3dada6=_0x3dada6||0x1f4;return function(_0x37e112){logger[_0xc418('0x2a')](_0x37e112[_0xc418('0x2b')]);if(_0x37e112[_0xc418('0x2c')]){delete _0x37e112[_0xc418('0x2c')];}_0x27dda3[_0xc418('0x1c')](_0x3dada6)['send'](_0x37e112);};}exports[_0xc418('0x2d')]=function(_0x99700c,_0x9fd9c1){var _0x4c0d44={},_0x1fbab9={},_0x448494={'count':0x0,'rows':[]};var _0x2907e8=_[_0xc418('0x2e')](db[_0xc418('0x2f')][_0xc418('0x30')],function(_0x59e1ed){return{'name':_0x59e1ed[_0xc418('0x31')],'type':_0x59e1ed[_0xc418('0x32')][_0xc418('0x33')]};});_0x1fbab9['model']=_[_0xc418('0x2e')](_0x2907e8,'name');_0x1fbab9['query']=_[_0xc418('0x34')](_0x99700c[_0xc418('0x35')]);_0x1fbab9[_0xc418('0x36')]=_[_0xc418('0x37')](_0x1fbab9[_0xc418('0x38')],_0x1fbab9[_0xc418('0x35')]);_0x4c0d44[_0xc418('0x39')]=_[_0xc418('0x37')](_0x1fbab9[_0xc418('0x38')],qs[_0xc418('0x3a')](_0x99700c[_0xc418('0x35')][_0xc418('0x3a')]));_0x4c0d44['attributes']=_0x4c0d44['attributes'][_0xc418('0x3b')]?_0x4c0d44[_0xc418('0x39')]:_0x1fbab9[_0xc418('0x38')];if(!_0x99700c[_0xc418('0x35')]['hasOwnProperty']('nolimit')){_0x4c0d44[_0xc418('0x20')]=qs[_0xc418('0x20')](_0x99700c[_0xc418('0x35')][_0xc418('0x20')]);_0x4c0d44[_0xc418('0x1f')]=qs[_0xc418('0x1f')](_0x99700c['query'][_0xc418('0x1f')]);}_0x4c0d44['order']=qs[_0xc418('0x3c')](_0x99700c['query'][_0xc418('0x3c')]);_0x4c0d44[_0xc418('0x3d')]=qs['filters'](_[_0xc418('0x3e')](_0x99700c['query'],_0x1fbab9[_0xc418('0x36')]),_0x2907e8);if(_0x99700c[_0xc418('0x35')][_0xc418('0x3f')]){_0x4c0d44[_0xc418('0x3d')]=_[_0xc418('0x40')](_0x4c0d44[_0xc418('0x3d')],{'$or':_['map'](_0x2907e8,function(_0x389669){if(_0x389669[_0xc418('0x32')]!==_0xc418('0x41')){var _0x406b2c={};_0x406b2c[_0x389669[_0xc418('0x2c')]]={'$like':'%'+_0x99700c['query'][_0xc418('0x3f')]+'%'};return _0x406b2c;}})});}_0x4c0d44=_['merge']({},_0x4c0d44,_0x99700c[_0xc418('0x42')]);var _0x164566={'where':_0x4c0d44[_0xc418('0x3d')]};return db[_0xc418('0x2f')][_0xc418('0x43')](_0x164566)[_0xc418('0x25')](function(_0x577767){_0x448494[_0xc418('0x43')]=_0x577767;if(_0x99700c[_0xc418('0x35')][_0xc418('0x44')]){_0x4c0d44[_0xc418('0x45')]=[{'all':!![]}];}return db['AnalyticDefaultReport']['findAll'](_0x4c0d44);})[_0xc418('0x25')](function(_0x55e6f2){_0x448494['rows']=_0x55e6f2;return _0x448494;})[_0xc418('0x25')](respondWithFilteredResult(_0x9fd9c1,_0x4c0d44))[_0xc418('0x46')](handleError(_0x9fd9c1,null));};exports[_0xc418('0x47')]=function(_0x3bd078,_0x18b745){var _0x4ad584={'raw':!![],'where':{'id':_0x3bd078[_0xc418('0x48')]['id']}},_0x3f90d0={};_0x3f90d0[_0xc418('0x38')]=_[_0xc418('0x34')](db['AnalyticDefaultReport']['rawAttributes']);_0x3f90d0[_0xc418('0x35')]=_[_0xc418('0x34')](_0x3bd078[_0xc418('0x35')]);_0x3f90d0[_0xc418('0x36')]=_[_0xc418('0x37')](_0x3f90d0[_0xc418('0x38')],_0x3f90d0[_0xc418('0x35')]);_0x4ad584['attributes']=_[_0xc418('0x37')](_0x3f90d0[_0xc418('0x38')],qs[_0xc418('0x3a')](_0x3bd078['query'][_0xc418('0x3a')]));_0x4ad584[_0xc418('0x39')]=_0x4ad584[_0xc418('0x39')][_0xc418('0x3b')]?_0x4ad584[_0xc418('0x39')]:_0x3f90d0[_0xc418('0x38')];if(_0x3bd078[_0xc418('0x35')]['includeAll']){_0x4ad584['include']=[{'all':!![]}];}_0x4ad584=_[_0xc418('0x40')]({},_0x4ad584,_0x3bd078[_0xc418('0x42')]);return db[_0xc418('0x2f')][_0xc418('0x49')](_0x4ad584)[_0xc418('0x25')](handleEntityNotFound(_0x18b745,null))['then'](respondWithResult(_0x18b745,null))[_0xc418('0x46')](handleError(_0x18b745,null));};exports[_0xc418('0x4a')]=function(_0x32b574,_0x8e9587){return db[_0xc418('0x2f')][_0xc418('0x4a')](_0x32b574[_0xc418('0x4b')],{})[_0xc418('0x25')](function(_0x440449){var _0x41f490=_0x32b574[_0xc418('0x4c')][_0xc418('0x27')]({'plain':!![]});if(!_0x41f490)throw new Error(_0xc418('0x4d'));if(_0x41f490[_0xc418('0x4e')]===_0xc418('0x4c')){var _0x55d8e4=_0x440449[_0xc418('0x27')]({'plain':!![]});var _0x391002='Reports';return db[_0xc418('0x4f')][_0xc418('0x49')]({'where':{'name':_0x391002,'userProfileId':_0x41f490['userProfileId']},'raw':!![]})[_0xc418('0x25')](function(_0x42d7db){if(_0x42d7db&&_0x42d7db[_0xc418('0x50')]===0x0){return db[_0xc418('0x29')]['create']({'name':_0x55d8e4[_0xc418('0x2c')],'resourceId':_0x55d8e4['id'],'type':_0xc418('0x28'),'sectionId':_0x42d7db['id']},{})[_0xc418('0x25')](function(){return _0x440449;});}else{return _0x440449;}})['catch'](function(_0x689e3a){logger[_0xc418('0x2a')](_0xc418('0x51'),_0x689e3a);throw _0x689e3a;});}return _0x440449;})['then'](respondWithResult(_0x8e9587,0xc9))[_0xc418('0x46')](handleError(_0x8e9587,null));};exports[_0xc418('0x24')]=function(_0xbae692,_0x2623ab){if(_0xbae692['body']['id']){delete _0xbae692[_0xc418('0x4b')]['id'];}return db[_0xc418('0x2f')][_0xc418('0x49')]({'where':{'id':_0xbae692[_0xc418('0x48')]['id']}})[_0xc418('0x25')](handleEntityNotFound(_0x2623ab,null))['then'](saveUpdates(_0xbae692['body'],null))[_0xc418('0x25')](respondWithResult(_0x2623ab,null))[_0xc418('0x46')](handleError(_0x2623ab,null));};exports[_0xc418('0x26')]=function(_0x108d62,_0x22b5dd){return db['AnalyticDefaultReport'][_0xc418('0x49')]({'where':{'id':_0x108d62[_0xc418('0x48')]['id']}})[_0xc418('0x25')](handleEntityNotFound(_0x22b5dd,null))['then'](removeEntity(_0x22b5dd,null))[_0xc418('0x46')](handleError(_0x22b5dd,null));};exports['preview']=function(_0x119b12,_0x29d42a){var _0x48dab1=0xa;var _0x33e045=[_0xc418('0x52'),'left_join',_0xc418('0x53'),_0xc418('0x54')];var _0x3a3b77={'SUM':'SUM(%s)','COUNT':_0xc418('0x55'),'COUNT DISTINCT':_0xc418('0x56'),'MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xc418('0x57'),'GROUP_CONCAT DESC':_0xc418('0x58')};var _0x3c9ca6={'SEC_TO_TIME':_0xc418('0x59'),'DATE':_0xc418('0x5a'),'HOUR':_0xc418('0x5b'),'ROUND':_0xc418('0x5c'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x1038ec=function(_0x3b4f80){return!_[_0xc418('0x5d')]([_0xc418('0x5e'),_0xc418('0x5f'),_0xc418('0x60'),'IS\x20NOT\x20EMPTY'],_0x3b4f80);};var _0x4cc2e1=function(_0x426f70){if(!_0x426f70||!_0x426f70['rules'][_0xc418('0x3b')]){return'';}for(var _0x1bb347='(',_0x3d48d4=0x0;_0x3d48d4<_0x426f70[_0xc418('0x61')]['length'];_0x3d48d4+=0x1){_0x3d48d4>0x0&&(_0x1bb347+='\x20'+_0x426f70['operator']+'\x20');_0x1bb347+=_0x426f70[_0xc418('0x61')][_0x3d48d4][_0xc418('0x62')]?_0x4cc2e1(_0x426f70[_0xc418('0x61')][_0x3d48d4][_0xc418('0x62')]):_0x426f70['rules'][_0x3d48d4][_0xc418('0x63')]+'\x20'+_0x426f70[_0xc418('0x61')][_0x3d48d4][_0xc418('0x64')]+(_0x1038ec(_0x426f70[_0xc418('0x61')][_0x3d48d4][_0xc418('0x64')])?'\x20'+_0x426f70['rules'][_0x3d48d4][_0xc418('0x65')]:'');}return _0x1bb347+')';};var _0x7e6935={'where':{'id':_0x119b12[_0xc418('0x48')]['id']}},_0x9dc2b6,_0x182f34,_0x301308,_0x2fc84b,_0x26fc82;_0x7e6935=_['merge']({},_0x7e6935,_0x119b12[_0xc418('0x42')]);return db['AnalyticDefaultReport']['find'](_0x7e6935)[_0xc418('0x25')](function(_0x33fc80){if(_0x33fc80){_0x9dc2b6=_0x33fc80;return _0x33fc80[_0xc418('0x66')]();}return null;})[_0xc418('0x25')](function(_0x2edecc){if(_0x2edecc){if(!_0x2edecc[_0xc418('0x3b')]){throw new db[(_0xc418('0x67'))]['ValidationErrorItem'](_0xc418('0x68'),0x193);}_0x182f34=_0x2edecc;return db[_0xc418('0x69')][_0xc418('0x6a')]({'raw':!![]});}return null;})[_0xc418('0x25')](function(_0x44a574){if(_0x44a574){_0x301308=_[_0xc418('0x6b')](_0x44a574,'id');var _0x596ef6;var _0x261e69=squel[_0xc418('0x6c')]();_0x261e69[_0xc418('0x6d')](_0x9dc2b6[_0xc418('0x6e')]);for(var _0x492897=0x0;_0x492897<_0x182f34[_0xc418('0x3b')];_0x492897+=0x1){_0x596ef6=_0x182f34[_0x492897][_0xc418('0x6f')]?_0x301308[_0x182f34[_0x492897][_0xc418('0x6f')]][_0xc418('0x70')]:_0x182f34[_0x492897][_0xc418('0x63')];_0x596ef6=_0x182f34[_0x492897][_0xc418('0x71')]?_[_0xc418('0x72')](_0x3a3b77[_0x182f34[_0x492897]['function']],'%s',_0x596ef6):_0x596ef6;_0x596ef6=_0x182f34[_0x492897][_0xc418('0x73')]?_[_0xc418('0x72')](_0x3c9ca6[_0x182f34[_0x492897][_0xc418('0x73')]],'%s',_0x596ef6):_0x596ef6;if(_0x182f34[_0x492897][_0xc418('0x74')]){_0x261e69['group'](_0x596ef6);}_0x182f34[_0x492897][_0xc418('0x75')]&&_0x261e69['order'](_0x596ef6,_0x182f34[_0x492897][_0xc418('0x75')]===_0xc418('0x76')?![]:!![]);_0x261e69[_0xc418('0x63')](_0x596ef6,_0x182f34[_0x492897][_0xc418('0x77')]||_0x596ef6);}if(_0x9dc2b6[_0xc418('0x78')]){_0x9dc2b6[_0xc418('0x78')]=JSON['parse'](_0x9dc2b6['joins']);for(var _0x53f019=0x0;_0x53f019<_0x9dc2b6['joins']['length'];_0x53f019+=0x1){if(_0x9dc2b6[_0xc418('0x78')][_0x53f019][_0xc418('0x32')]&&_[_0xc418('0x5d')](_0x33e045,_0x9dc2b6[_0xc418('0x78')][_0x53f019][_0xc418('0x32')])&&_0x9dc2b6[_0xc418('0x78')][_0x53f019][_0xc418('0x79')]&&_0x9dc2b6[_0xc418('0x78')][_0x53f019][_0xc418('0x7a')]&&_0x9dc2b6['joins'][_0x53f019]['foreignKey']){_0x261e69[_0x9dc2b6[_0xc418('0x78')][_0x53f019][_0xc418('0x32')]](_0x9dc2b6['joins'][_0x53f019]['foreignTable'],null,util[_0xc418('0x73')](_0xc418('0x7b'),_0x9dc2b6[_0xc418('0x6e')],_0x9dc2b6['joins'][_0x53f019][_0xc418('0x79')],_0x9dc2b6[_0xc418('0x78')][_0x53f019][_0xc418('0x7a')],_0x9dc2b6['joins'][_0x53f019][_0xc418('0x7c')]));}}}if(_0x9dc2b6[_0xc418('0x7d')]){_0x9dc2b6[_0xc418('0x7d')]=JSON[_0xc418('0x7e')](_0x9dc2b6[_0xc418('0x7d')]);_0x261e69[_0xc418('0x3d')](_0x4cc2e1(_0x9dc2b6[_0xc418('0x7d')]['group']));}_0x26fc82=_0x261e69[_0xc418('0x7f')]();_0x261e69[_0xc418('0x20')](_0x48dab1);_0x261e69[_0xc418('0x1f')](0x0);logger[_0xc418('0x80')](_0xc418('0x81'),_0x261e69[_0xc418('0x82')]());return db['sequelize'][_0xc418('0x35')](_0x261e69[_0xc418('0x82')](),{'type':db[_0xc418('0x83')]['QueryTypes']['SELECT']});}})[_0xc418('0x25')](respondWithResult(_0x29d42a,null))[_0xc418('0x46')](handleError(_0x29d42a,null));};function runReport(_0x7b860,_0xa42dbb,_0x179c64){var _0x250e2d=_0xa42dbb[_0xc418('0x2c')];var _0x15c6e8=0xa;var _0x38db7a=[_0xc418('0x52'),'left_join',_0xc418('0x53'),'cross_join'];var _0x1bf7c9={'SUM':_0xc418('0x84'),'COUNT':_0xc418('0x55'),'COUNT DISTINCT':_0xc418('0x56'),'MAX':_0xc418('0x85'),'MIN':_0xc418('0x86'),'AVG':_0xc418('0x87'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xc418('0x58')};var _0xe220e3={'SEC_TO_TIME':_0xc418('0x59'),'DATE':_0xc418('0x5a'),'HOUR':'HOUR(%s)','ROUND':_0xc418('0x5c'),'UNIX_TIMESTAMP':_0xc418('0x88')};var _0xb84642=function(_0x4054db){return!_[_0xc418('0x5d')]([_0xc418('0x5e'),_0xc418('0x5f'),'IS\x20EMPTY',_0xc418('0x89')],_0x4054db);};var _0x2b339b=function(_0x508927){if(!_0x508927||!_0x508927[_0xc418('0x61')][_0xc418('0x3b')]){return'';}for(var _0x549f78='(',_0x34c695=0x0;_0x34c695<_0x508927['rules'][_0xc418('0x3b')];_0x34c695+=0x1){_0x34c695>0x0&&(_0x549f78+='\x20'+_0x508927[_0xc418('0x8a')]+'\x20');_0x549f78+=_0x508927[_0xc418('0x61')][_0x34c695][_0xc418('0x62')]?_0x2b339b(_0x508927[_0xc418('0x61')][_0x34c695]['group']):_0x508927[_0xc418('0x61')][_0x34c695][_0xc418('0x63')]+'\x20'+_0x508927['rules'][_0x34c695][_0xc418('0x64')]+(_0xb84642(_0x508927[_0xc418('0x61')][_0x34c695][_0xc418('0x64')])?'\x20'+_0x508927['rules'][_0x34c695][_0xc418('0x65')]:'');}return _0x549f78+')';};var _0x9d3eeb={'where':{'id':_0x7b860['id']}},_0x237f6b,_0x5b86c2,_0x2eefb8,_0x42883d,_0x27827c;_0x9d3eeb=_['merge']({},_0x9d3eeb,_0x179c64);return db[_0xc418('0x2f')]['find'](_0x9d3eeb)[_0xc418('0x25')](function(_0x174493){if(_0x174493){_0x237f6b=_0x174493;return _0x174493['getFields']();}return null;})[_0xc418('0x25')](function(_0x56ccd5){if(_0x56ccd5){if(!_0x56ccd5[_0xc418('0x3b')]){throw new db[(_0xc418('0x67'))]['ValidationErrorItem'](_0xc418('0x68'),0x193);}_0x5b86c2=_0x56ccd5;return db[_0xc418('0x69')][_0xc418('0x6a')]({'raw':!![]});}return null;})['then'](function(_0x3a0f39){if(_0x3a0f39){_0x2eefb8=_['keyBy'](_0x3a0f39,'id');var _0x12631a;var _0x3796df=squel[_0xc418('0x6c')]();_0x3796df[_0xc418('0x6d')](_0x237f6b[_0xc418('0x6e')]);for(var _0x30ba14=0x0;_0x30ba14<_0x5b86c2[_0xc418('0x3b')];_0x30ba14+=0x1){_0x12631a=_0x5b86c2[_0x30ba14][_0xc418('0x6f')]?_0x2eefb8[_0x5b86c2[_0x30ba14][_0xc418('0x6f')]][_0xc418('0x70')]:_0x5b86c2[_0x30ba14][_0xc418('0x63')];_0x12631a=_0x5b86c2[_0x30ba14]['function']?_[_0xc418('0x72')](_0x1bf7c9[_0x5b86c2[_0x30ba14][_0xc418('0x71')]],'%s',_0x12631a):_0x12631a;_0x12631a=_0x5b86c2[_0x30ba14][_0xc418('0x73')]?_[_0xc418('0x72')](_0xe220e3[_0x5b86c2[_0x30ba14]['format']],'%s',_0x12631a):_0x12631a;if(_0x5b86c2[_0x30ba14][_0xc418('0x74')]){_0x3796df['group'](_0x12631a);}_0x5b86c2[_0x30ba14]['orderBy']&&_0x3796df[_0xc418('0x8b')](_0x12631a,_0x5b86c2[_0x30ba14][_0xc418('0x75')]===_0xc418('0x76')?![]:!![]);_0x3796df[_0xc418('0x63')](_0x12631a,_0x5b86c2[_0x30ba14]['alias']||_0x12631a);}if(_0x237f6b[_0xc418('0x78')]){_0x237f6b[_0xc418('0x78')]=JSON[_0xc418('0x7e')](_0x237f6b[_0xc418('0x78')]);for(var _0x3d4f92=0x0;_0x3d4f92<_0x237f6b[_0xc418('0x78')][_0xc418('0x3b')];_0x3d4f92+=0x1){if(_0x237f6b['joins'][_0x3d4f92][_0xc418('0x32')]&&_['includes'](_0x38db7a,_0x237f6b['joins'][_0x3d4f92][_0xc418('0x32')])&&_0x237f6b['joins'][_0x3d4f92][_0xc418('0x79')]&&_0x237f6b['joins'][_0x3d4f92][_0xc418('0x7a')]&&_0x237f6b[_0xc418('0x78')][_0x3d4f92][_0xc418('0x7c')]){_0x3796df[_0x237f6b[_0xc418('0x78')][_0x3d4f92][_0xc418('0x32')]](_0x237f6b[_0xc418('0x78')][_0x3d4f92]['foreignTable'],null,util[_0xc418('0x73')](_0xc418('0x7b'),_0x237f6b[_0xc418('0x6e')],_0x237f6b[_0xc418('0x78')][_0x3d4f92][_0xc418('0x79')],_0x237f6b[_0xc418('0x78')][_0x3d4f92][_0xc418('0x7a')],_0x237f6b['joins'][_0x3d4f92]['foreignKey']));}}}if(_0x237f6b['conditions']){_0x237f6b[_0xc418('0x7d')]=JSON[_0xc418('0x7e')](_0x237f6b[_0xc418('0x7d')]);_0x3796df[_0xc418('0x3d')](_0x2b339b(_0x237f6b['conditions']['group']));}_0x27827c=_0x3796df[_0xc418('0x7f')]();_0x3796df[_0xc418('0x20')](_0x15c6e8);_0x3796df[_0xc418('0x1f')](0x0);logger['debug'](_0xc418('0x81'),_0x3796df['toString']());return db[_0xc418('0x83')][_0xc418('0x35')](_0x3796df[_0xc418('0x82')](),{'type':db[_0xc418('0x83')][_0xc418('0x8c')][_0xc418('0x8d')]});}})[_0xc418('0x25')](function(_0x2eb5bc){if(!_0x2eb5bc['length']){throw new db['Sequelize'][(_0xc418('0x8e'))](_0xc418('0x8f'),0xcc);}if(_0xa42dbb[_0xc418('0x90')]===_0xc418('0x91')){return null;}var _0x5754ee=_['merge'](_0xa42dbb,{'name':_0xa42dbb['fullPath']||_0xa42dbb['name']||_0x237f6b[_0xc418('0x2c')],'basename':_0x250e2d,'savename':util['format'](_0xc418('0x92'),_0xa42dbb[_0xc418('0x2c')]||_0x237f6b[_0xc418('0x2c')],require(_0xc418('0x93'))[_0xc418('0x94')](0x4),_0xa42dbb['output']||_0xc418('0x95')),'reportId':_0x237f6b['id'],'reportType':_0xc418('0x96')});return db[_0xc418('0x97')][_0xc418('0x4a')](_0x5754ee,{'raw':!![]});})[_0xc418('0x25')](function(_0x3d7522){if(_0x237f6b[_0xc418('0x6e')]==='cdr'){_0x27827c[_0xc418('0x3d')](_0x237f6b['table']+_0xc418('0x98'),_0xa42dbb['startDate'],_0xa42dbb[_0xc418('0x99')]);}else{_0x27827c[_0xc418('0x3d')](_0x237f6b['table']+_0xc418('0x9a'),_0xa42dbb[_0xc418('0x9b')],_0xa42dbb[_0xc418('0x99')]);}if(_0x3d7522){logger[_0xc418('0x9c')](_0xc418('0x9d'),_0x27827c[_0xc418('0x82')]());require('child_process')[_0xc418('0x9e')](path[_0xc418('0x52')](__dirname,_0xc418('0x9f'),_0x3d7522[_0xc418('0x90')]),[_0x3d7522['id'],_0x27827c['toString'](),path['join'](__dirname,_0xc418('0xa0'),_0x3d7522[_0xc418('0xa1')]),_0x250e2d]);return _0x3d7522;}else{var _0x22dcf4=squel[_0xc418('0x6c')]();_0x22dcf4[_0xc418('0x6d')]('('+_0x27827c[_0xc418('0x82')]()+')',_0xc418('0xa2'));_0x22dcf4['field'](_0xc418('0xa3'),'count');_0x27827c['limit'](_0xa42dbb[_0xc418('0x20')]||_0x15c6e8);_0x27827c[_0xc418('0x1f')](_0xa42dbb[_0xc418('0x1f')]||0x0);return dbH['sequelize'][_0xc418('0x35')](_0x22dcf4[_0xc418('0x82')](),{'type':dbH['sequelize'][_0xc418('0x8c')][_0xc418('0x8d')]})[_0xc418('0x25')](function(_0x21cf7f){if(!_0x21cf7f['length']){_0x42883d=0x0;}else{_0x42883d=_0x21cf7f[0x0][_0xc418('0x43')]||0x0;}return dbH[_0xc418('0x83')][_0xc418('0x35')](_0x27827c[_0xc418('0x82')](),{'type':dbH[_0xc418('0x83')][_0xc418('0x8c')][_0xc418('0x8d')]});})[_0xc418('0x25')](function(_0x3a9920){return{'rows':_0x3a9920||[],'count':_0x42883d};});}});}exports[_0xc418('0xa4')]=function(_0x353b25,_0x18638f){return runReport(_0x353b25[_0xc418('0x48')],_0x353b25[_0xc418('0x35')],_0x353b25['options'])[_0xc418('0x25')](respondWithResult(_0x18638f,null))[_0xc418('0x46')](handleError(_0x18638f,null));};exports[_0xc418('0xa5')]=runReport;exports[_0xc418('0x35')]=function(_0x39ba97,_0x5254bd){var _0x1ddf6f=0xa;var _0x31d2b6=[_0xc418('0x52'),'left_join',_0xc418('0x53'),'cross_join'];var _0x1a1f5b={'SUM':_0xc418('0x84'),'COUNT':_0xc418('0x55'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xc418('0x85'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0xc418('0xa6'),'GROUP_CONCAT ASC':_0xc418('0x57'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x764c6c={'SEC_TO_TIME':_0xc418('0x59'),'DATE':_0xc418('0x5a'),'HOUR':_0xc418('0x5b'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x1d4be6=function(_0x12c1db){return!_['includes']([_0xc418('0x5e'),_0xc418('0x5f'),_0xc418('0x60'),_0xc418('0x89')],_0x12c1db);};var _0x575c0b=function(_0x152e26){if(!_0x152e26||!_0x152e26['rules'][_0xc418('0x3b')]){return'';}for(var _0x390737='(',_0x51969f=0x0;_0x51969f<_0x152e26[_0xc418('0x61')][_0xc418('0x3b')];_0x51969f+=0x1){_0x51969f>0x0&&(_0x390737+='\x20'+_0x152e26[_0xc418('0x8a')]+'\x20');_0x390737+=_0x152e26[_0xc418('0x61')][_0x51969f][_0xc418('0x62')]?_0x575c0b(_0x152e26[_0xc418('0x61')][_0x51969f][_0xc418('0x62')]):_0x152e26[_0xc418('0x61')][_0x51969f][_0xc418('0x63')]+'\x20'+_0x152e26[_0xc418('0x61')][_0x51969f][_0xc418('0x64')]+(_0x1d4be6(_0x152e26['rules'][_0x51969f][_0xc418('0x64')])?'\x20'+_0x152e26['rules'][_0x51969f][_0xc418('0x65')]:'');}return _0x390737+')';};var _0x57f076={'where':{'id':_0x39ba97[_0xc418('0x48')]['id']}},_0x42df31,_0x5581c9,_0x19415e,_0x24f48f,_0x29aa7c;_0x57f076=_[_0xc418('0x40')]({},_0x57f076,_0x39ba97[_0xc418('0x42')]);return db[_0xc418('0x2f')][_0xc418('0x49')](_0x57f076)[_0xc418('0x25')](function(_0x4a3a40){if(_0x4a3a40){_0x42df31=_0x4a3a40;return _0x4a3a40[_0xc418('0x66')]();}return null;})[_0xc418('0x25')](function(_0x1b44b1){if(_0x1b44b1){if(!_0x1b44b1[_0xc418('0x3b')]){throw new db[(_0xc418('0x67'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x5581c9=_0x1b44b1;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0xc418('0x25')](function(_0x505cd6){if(_0x505cd6){_0x19415e=_[_0xc418('0x6b')](_0x505cd6,'id');var _0x614326;var _0x52604a=squel[_0xc418('0x6c')]();_0x52604a[_0xc418('0x6d')](_0x42df31[_0xc418('0x6e')]);for(var _0x5267b9=0x0;_0x5267b9<_0x5581c9[_0xc418('0x3b')];_0x5267b9+=0x1){_0x614326=_0x5581c9[_0x5267b9][_0xc418('0x6f')]?_0x19415e[_0x5581c9[_0x5267b9][_0xc418('0x6f')]][_0xc418('0x70')]:_0x5581c9[_0x5267b9][_0xc418('0x63')];_0x614326=_0x5581c9[_0x5267b9][_0xc418('0x71')]?_['replace'](_0x1a1f5b[_0x5581c9[_0x5267b9][_0xc418('0x71')]],'%s',_0x614326):_0x614326;_0x614326=_0x5581c9[_0x5267b9][_0xc418('0x73')]?_['replace'](_0x764c6c[_0x5581c9[_0x5267b9][_0xc418('0x73')]],'%s',_0x614326):_0x614326;if(_0x5581c9[_0x5267b9][_0xc418('0x74')]){_0x52604a[_0xc418('0x62')](_0x614326);}_0x5581c9[_0x5267b9][_0xc418('0x75')]&&_0x52604a['order'](_0x614326,_0x5581c9[_0x5267b9]['orderBy']===_0xc418('0x76')?![]:!![]);_0x52604a[_0xc418('0x63')](_0x614326,_0x5581c9[_0x5267b9][_0xc418('0x77')]||_0x614326);}if(_0x42df31[_0xc418('0x78')]){_0x42df31[_0xc418('0x78')]=JSON['parse'](_0x42df31[_0xc418('0x78')]);for(var _0x10e9b9=0x0;_0x10e9b9<_0x42df31[_0xc418('0x78')][_0xc418('0x3b')];_0x10e9b9+=0x1){if(_0x42df31[_0xc418('0x78')][_0x10e9b9][_0xc418('0x32')]&&_['includes'](_0x31d2b6,_0x42df31[_0xc418('0x78')][_0x10e9b9][_0xc418('0x32')])&&_0x42df31[_0xc418('0x78')][_0x10e9b9]['parentKey']&&_0x42df31[_0xc418('0x78')][_0x10e9b9][_0xc418('0x7a')]&&_0x42df31[_0xc418('0x78')][_0x10e9b9][_0xc418('0x7c')]){_0x52604a[_0x42df31[_0xc418('0x78')][_0x10e9b9][_0xc418('0x32')]](_0x42df31[_0xc418('0x78')][_0x10e9b9][_0xc418('0x7a')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x42df31['table'],_0x42df31[_0xc418('0x78')][_0x10e9b9][_0xc418('0x79')],_0x42df31[_0xc418('0x78')][_0x10e9b9][_0xc418('0x7a')],_0x42df31['joins'][_0x10e9b9][_0xc418('0x7c')]));}}}if(_0x42df31[_0xc418('0x7d')]){_0x42df31['conditions']=JSON[_0xc418('0x7e')](_0x42df31[_0xc418('0x7d')]);_0x52604a[_0xc418('0x3d')](_0x575c0b(_0x42df31[_0xc418('0x7d')][_0xc418('0x62')]));}_0x29aa7c=_0x52604a[_0xc418('0x7f')]();_0x52604a[_0xc418('0x20')](_0x1ddf6f);_0x52604a[_0xc418('0x1f')](0x0);logger[_0xc418('0x80')]('Limited\x20Query:',_0x52604a[_0xc418('0x82')]());return db[_0xc418('0x83')][_0xc418('0x35')](_0x52604a[_0xc418('0x82')](),{'type':db[_0xc418('0x83')][_0xc418('0x8c')]['SELECT']});}})[_0xc418('0x25')](function(){return{'sql':_0x29aa7c[_0xc418('0x82')]()};})[_0xc418('0x25')](respondWithResult(_0x5254bd,null))[_0xc418('0x46')](handleError(_0x5254bd,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index e4b9199..91c298d 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 _0x4dd4=['../../config/logger','bluebird','request-promise','path','../../config/environment','./analyticDefaultReport.attributes','define','AnalyticDefaultReport','analytics_default_reports','lodash','util'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x4dd4,0xcf));var _0x44dd=function(_0x46ff3a,_0x1b16e5){_0x46ff3a=_0x46ff3a-0x0;var _0x25fcf8=_0x4dd4[_0x46ff3a];return _0x25fcf8;};'use strict';var _=require(_0x44dd('0x0'));var util=require(_0x44dd('0x1'));var logger=require(_0x44dd('0x2'))('api');var moment=require('moment');var BPromise=require(_0x44dd('0x3'));var rp=require(_0x44dd('0x4'));var fs=require('fs');var path=require(_0x44dd('0x5'));var rimraf=require('rimraf');var config=require(_0x44dd('0x6'));var attributes=require(_0x44dd('0x7'));module['exports']=function(_0x5e8299,_0x2ba594){return _0x5e8299[_0x44dd('0x8')](_0x44dd('0x9'),attributes,{'tableName':_0x44dd('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2e89=['api','bluebird','request-promise','path','rimraf','./analyticDefaultReport.attributes','define','AnalyticDefaultReport','analytics_default_reports','lodash','util','../../config/logger'];(function(_0x5df2e3,_0x2fe7e7){var _0x4154a6=function(_0xd9f85b){while(--_0xd9f85b){_0x5df2e3['push'](_0x5df2e3['shift']());}};_0x4154a6(++_0x2fe7e7);}(_0x2e89,0x1e9));var _0x92e8=function(_0x1c0ccc,_0x1acabf){_0x1c0ccc=_0x1c0ccc-0x0;var _0x233fcf=_0x2e89[_0x1c0ccc];return _0x233fcf;};'use strict';var _=require(_0x92e8('0x0'));var util=require(_0x92e8('0x1'));var logger=require(_0x92e8('0x2'))(_0x92e8('0x3'));var moment=require('moment');var BPromise=require(_0x92e8('0x4'));var rp=require(_0x92e8('0x5'));var fs=require('fs');var path=require(_0x92e8('0x6'));var rimraf=require(_0x92e8('0x7'));var config=require('../../config/environment');var attributes=require(_0x92e8('0x8'));module['exports']=function(_0x1fc289,_0x5bdac5){return _0x1fc289[_0x92e8('0x9')](_0x92e8('0xa'),attributes,{'tableName':_0x92e8('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 23bab39..2da016d 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 _0x6739=['code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','http','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x591b7d,_0x4544a9){var _0x37dce0=function(_0x15be91){while(--_0x15be91){_0x591b7d['push'](_0x591b7d['shift']());}};_0x37dce0(++_0x4544a9);}(_0x6739,0xd3));var _0x9673=function(_0x21ddb9,_0x2a2195){_0x21ddb9=_0x21ddb9-0x0;var _0x11cc73=_0x6739[_0x21ddb9];return _0x11cc73;};'use strict';var _=require(_0x9673('0x0'));var util=require(_0x9673('0x1'));var moment=require(_0x9673('0x2'));var BPromise=require(_0x9673('0x3'));var rs=require(_0x9673('0x4'));var fs=require('fs');var Redis=require(_0x9673('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x9673('0x6'))('rpc');var config=require(_0x9673('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x9673('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3ad052,_0x3f82df,_0x4981d9){return new BPromise(function(_0x4e1dd5,_0x39b0f0){return client[_0x9673('0x9')](_0x3ad052,_0x4981d9)[_0x9673('0xa')](function(_0x509966){logger[_0x9673('0xb')](_0x9673('0xc'),_0x3f82df,_0x9673('0xd'));logger['debug'](_0x9673('0xe'),_0x3f82df,_0x9673('0xd'),JSON[_0x9673('0xf')](_0x509966));if(_0x509966[_0x9673('0x10')]){if(_0x509966['error'][_0x9673('0x11')]===0x1f4){logger[_0x9673('0x10')](_0x9673('0xc'),_0x3f82df,_0x509966[_0x9673('0x10')]['message']);return _0x39b0f0(_0x509966[_0x9673('0x10')][_0x9673('0x12')]);}logger['error'](_0x9673('0xc'),_0x3f82df,_0x509966[_0x9673('0x10')][_0x9673('0x12')]);return _0x4e1dd5(_0x509966['error'][_0x9673('0x12')]);}else{logger['info'](_0x9673('0xc'),_0x3f82df,'request\x20sent');_0x4e1dd5(_0x509966['result'][_0x9673('0x12')]);}})['catch'](function(_0x3d5642){logger[_0x9673('0x10')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x3f82df,_0x3d5642);_0x39b0f0(_0x3d5642);});});} \ No newline at end of file +var _0x4dd3=['message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x5cff20,_0x4cb415){var _0x584b86=function(_0x44527b){while(--_0x44527b){_0x5cff20['push'](_0x5cff20['shift']());}};_0x584b86(++_0x4cb415);}(_0x4dd3,0xf5));var _0x34dd=function(_0x42bafd,_0x3f0fe3){_0x42bafd=_0x42bafd-0x0;var _0x2ed705=_0x4dd3[_0x42bafd];return _0x2ed705;};'use strict';var _=require(_0x34dd('0x0'));var util=require(_0x34dd('0x1'));var moment=require(_0x34dd('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x34dd('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x34dd('0x4'));var logger=require(_0x34dd('0x5'))(_0x34dd('0x6'));var config=require('../../config/environment');var jayson=require(_0x34dd('0x7'));var client=jayson[_0x34dd('0x8')][_0x34dd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x365482,_0x3a3429,_0x5e8911){return new BPromise(function(_0x4cb036,_0xc0c516){return client[_0x34dd('0xa')](_0x365482,_0x5e8911)[_0x34dd('0xb')](function(_0x4e1bc8){logger[_0x34dd('0xc')](_0x34dd('0xd'),_0x3a3429,_0x34dd('0xe'));logger[_0x34dd('0xf')](_0x34dd('0x10'),_0x3a3429,_0x34dd('0xe'),JSON['stringify'](_0x4e1bc8));if(_0x4e1bc8[_0x34dd('0x11')]){if(_0x4e1bc8[_0x34dd('0x11')][_0x34dd('0x12')]===0x1f4){logger[_0x34dd('0x11')](_0x34dd('0xd'),_0x3a3429,_0x4e1bc8['error']['message']);return _0xc0c516(_0x4e1bc8[_0x34dd('0x11')][_0x34dd('0x13')]);}logger[_0x34dd('0x11')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x3a3429,_0x4e1bc8[_0x34dd('0x11')]['message']);return _0x4cb036(_0x4e1bc8[_0x34dd('0x11')][_0x34dd('0x13')]);}else{logger[_0x34dd('0xc')](_0x34dd('0xd'),_0x3a3429,_0x34dd('0xe'));_0x4cb036(_0x4e1bc8[_0x34dd('0x14')]['message']);}})[_0x34dd('0x15')](function(_0x46d9f5){logger[_0x34dd('0x11')](_0x34dd('0xd'),_0x3a3429,_0x46d9f5);_0xc0c516(_0x46d9f5);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index d315035..717bb79 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 _0xec39=['./analyticDefaultReport.controller','get','isAuthenticated','index','/:id/preview','preview','/:id/run','run','/:id/query','query','post','create','put','/:id','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x3a52d0,_0x5eacbe){var _0x18271b=function(_0x46d1b6){while(--_0x46d1b6){_0x3a52d0['push'](_0x3a52d0['shift']());}};_0x18271b(++_0x5eacbe);}(_0xec39,0xa9));var _0x9ec3=function(_0x63008f,_0x331c3a){_0x63008f=_0x63008f-0x0;var _0x116b26=_0xec39[_0x63008f];return _0x116b26;};'use strict';var multer=require('multer');var util=require(_0x9ec3('0x0'));var path=require(_0x9ec3('0x1'));var timeout=require(_0x9ec3('0x2'));var express=require(_0x9ec3('0x3'));var router=express[_0x9ec3('0x4')]();var auth=require(_0x9ec3('0x5'));var interaction=require(_0x9ec3('0x6'));var config=require('../../config/environment');var controller=require(_0x9ec3('0x7'));router[_0x9ec3('0x8')]('/',auth[_0x9ec3('0x9')](),controller[_0x9ec3('0xa')]);router[_0x9ec3('0x8')]('/:id',auth[_0x9ec3('0x9')](),controller['show']);router[_0x9ec3('0x8')](_0x9ec3('0xb'),auth[_0x9ec3('0x9')](),controller[_0x9ec3('0xc')]);router[_0x9ec3('0x8')](_0x9ec3('0xd'),auth['isAuthenticated'](),controller[_0x9ec3('0xe')]);router['get'](_0x9ec3('0xf'),auth[_0x9ec3('0x9')](),controller[_0x9ec3('0x10')]);router[_0x9ec3('0x11')]('/',auth['isAuthenticated'](),controller[_0x9ec3('0x12')]);router[_0x9ec3('0x13')](_0x9ec3('0x14'),auth[_0x9ec3('0x9')](),controller['update']);router['delete'](_0x9ec3('0x14'),auth[_0x9ec3('0x9')](),controller['destroy']);module[_0x9ec3('0x15')]=router; \ No newline at end of file +var _0xb750=['path','connect-timeout','express','Router','../../components/interaction/service','./analyticDefaultReport.controller','index','get','isAuthenticated','show','preview','/:id/run','run','/:id/query','query','post','create','update','/:id','destroy','exports'];(function(_0x548627,_0x4ec392){var _0x844a84=function(_0x2ffdd2){while(--_0x2ffdd2){_0x548627['push'](_0x548627['shift']());}};_0x844a84(++_0x4ec392);}(_0xb750,0x93));var _0x0b75=function(_0x2a2475,_0xd93f31){_0x2a2475=_0x2a2475-0x0;var _0xfe9dbe=_0xb750[_0x2a2475];return _0xfe9dbe;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x0b75('0x0'));var timeout=require(_0x0b75('0x1'));var express=require(_0x0b75('0x2'));var router=express[_0x0b75('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0b75('0x4'));var config=require('../../config/environment');var controller=require(_0x0b75('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0x0b75('0x6')]);router[_0x0b75('0x7')]('/:id',auth[_0x0b75('0x8')](),controller[_0x0b75('0x9')]);router[_0x0b75('0x7')]('/:id/preview',auth[_0x0b75('0x8')](),controller[_0x0b75('0xa')]);router[_0x0b75('0x7')](_0x0b75('0xb'),auth[_0x0b75('0x8')](),controller[_0x0b75('0xc')]);router[_0x0b75('0x7')](_0x0b75('0xd'),auth[_0x0b75('0x8')](),controller[_0x0b75('0xe')]);router[_0x0b75('0xf')]('/',auth[_0x0b75('0x8')](),controller[_0x0b75('0x10')]);router['put']('/:id',auth[_0x0b75('0x8')](),controller[_0x0b75('0x11')]);router['delete'](_0x0b75('0x12'),auth['isAuthenticated'](),controller[_0x0b75('0x13')]);module[_0x0b75('0x14')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index d4e11d1..6af0c36 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 _0x1ad1=['DATE','Loading','scheduled','manual','INTEGER','UNSIGNED','sequelize','moment','exports','STRING','ENUM','csv','pdf','xlsx'];(function(_0x122e9b,_0x391bf4){var _0x22c247=function(_0x1b2c65){while(--_0x1b2c65){_0x122e9b['push'](_0x122e9b['shift']());}};_0x22c247(++_0x391bf4);}(_0x1ad1,0x1aa));var _0x11ad=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0x1ad1[_0x5d4607];return _0x5e4a86;};'use strict';var Sequelize=require(_0x11ad('0x0'));var moment=require(_0x11ad('0x1'));module[_0x11ad('0x2')]={'name':{'type':Sequelize[_0x11ad('0x3')],'allowNull':![]},'basename':{'type':Sequelize[_0x11ad('0x3')],'allowNull':![]},'output':{'type':Sequelize[_0x11ad('0x4')](_0x11ad('0x5'),_0x11ad('0x6'),_0x11ad('0x7')),'allowNull':![],'defaultValue':'csv'},'savename':{'type':Sequelize[_0x11ad('0x3')],'allowNull':![]},'startDate':{'type':Sequelize[_0x11ad('0x8')]},'endDate':{'type':Sequelize[_0x11ad('0x8')]},'status':{'type':Sequelize[_0x11ad('0x3')],'defaultValue':_0x11ad('0x9')},'type':{'type':Sequelize['ENUM']('manual',_0x11ad('0xa')),'allowNull':![],'defaultValue':_0x11ad('0xb')},'reportId':{'type':Sequelize[_0x11ad('0xc')](0xb)[_0x11ad('0xd')]},'reportType':{'type':Sequelize[_0x11ad('0x3')]}}; \ No newline at end of file +var _0x6e34=['exports','STRING','ENUM','csv','xlsx','DATE','scheduled','manual','INTEGER','UNSIGNED','moment'];(function(_0x225e5b,_0x40da72){var _0x2d88cb=function(_0x1c9e93){while(--_0x1c9e93){_0x225e5b['push'](_0x225e5b['shift']());}};_0x2d88cb(++_0x40da72);}(_0x6e34,0x1cd));var _0x46e3=function(_0x27f8ec,_0x465589){_0x27f8ec=_0x27f8ec-0x0;var _0x211499=_0x6e34[_0x27f8ec];return _0x211499;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x46e3('0x0'));module[_0x46e3('0x1')]={'name':{'type':Sequelize[_0x46e3('0x2')],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize[_0x46e3('0x3')](_0x46e3('0x4'),'pdf',_0x46e3('0x5')),'allowNull':![],'defaultValue':'csv'},'savename':{'type':Sequelize[_0x46e3('0x2')],'allowNull':![]},'startDate':{'type':Sequelize[_0x46e3('0x6')]},'endDate':{'type':Sequelize[_0x46e3('0x6')]},'status':{'type':Sequelize['STRING'],'defaultValue':'Loading'},'type':{'type':Sequelize[_0x46e3('0x3')]('manual',_0x46e3('0x7')),'allowNull':![],'defaultValue':_0x46e3('0x8')},'reportId':{'type':Sequelize[_0x46e3('0x9')](0xb)[_0x46e3('0xa')]},'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 5a29fc5..4dd223b 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 _0x5ac9=['rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','ejs','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','reject','save','then','get','ExtractedReports','UserProfileResource','destroy','stack','name','send','index','map','AnalyticExtractedReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','keys','find','create','user','UserProfileSection','userProfileId','autoAssociation','catch','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','download','basename','savename','output','join','root','server/files/reports','Report\x20not\x20found\x20or\x20empty','exists','%s.%s','toLowerCase','html-pdf','eml-format'];(function(_0x4f2aca,_0x89704d){var _0x184c53=function(_0xa581b0){while(--_0xa581b0){_0x4f2aca['push'](_0x4f2aca['shift']());}};_0x184c53(++_0x89704d);}(_0x5ac9,0x118));var _0x95ac=function(_0x3bad6e,_0x3ce278){_0x3bad6e=_0x3bad6e-0x0;var _0x51b684=_0x5ac9[_0x3bad6e];return _0x51b684;};'use strict';var pdf=require(_0x95ac('0x0'));var emlformat=require(_0x95ac('0x1'));var rimraf=require(_0x95ac('0x2'));var zipdir=require(_0x95ac('0x3'));var jsonpatch=require(_0x95ac('0x4'));var rp=require(_0x95ac('0x5'));var moment=require(_0x95ac('0x6'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x95ac('0x7'));var path=require(_0x95ac('0x8'));var sox=require(_0x95ac('0x9'));var csv=require('to-csv');var ejs=require(_0x95ac('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x95ac('0xb'));var jsforce=require(_0x95ac('0xc'));var deskjs=require(_0x95ac('0xd'));var toCsv=require(_0x95ac('0xe'));var querystring=require(_0x95ac('0xf'));var Papa=require(_0x95ac('0x10'));var Redis=require(_0x95ac('0x11'));var authService=require(_0x95ac('0x12'));var qs=require(_0x95ac('0x13'));var as=require(_0x95ac('0x14'));var hardwareService=require(_0x95ac('0x15'));var logger=require(_0x95ac('0x16'))(_0x95ac('0x17'));var utils=require(_0x95ac('0x18'));var config=require('../../config/environment');var db=require(_0x95ac('0x19'))['db'];function respondWithStatusCode(_0x10dcca,_0x49e1b4){_0x49e1b4=_0x49e1b4||0xcc;return function(_0xacd43c){if(_0xacd43c){return _0x10dcca[_0x95ac('0x1a')](_0x49e1b4);}return _0x10dcca[_0x95ac('0x1b')](_0x49e1b4)[_0x95ac('0x1c')]();};}function respondWithResult(_0x18adc2,_0x58202c){_0x58202c=_0x58202c||0xc8;return function(_0x216f74){if(_0x216f74){return _0x18adc2['status'](_0x58202c)[_0x95ac('0x1d')](_0x216f74);}};}function respondWithFilteredResult(_0x10ae83,_0x2fda41){return function(_0x4d4eb0){if(_0x4d4eb0){var _0x34cd7d=_0x4d4eb0[_0x95ac('0x1e')],_0x113a18=_0x2fda41[_0x95ac('0x1f')],_0x2e9942=_0x2fda41['offset']+_0x2fda41[_0x95ac('0x20')],_0x3e6172;if(_0x2e9942>=_0x34cd7d){_0x2e9942=_0x34cd7d;_0x3e6172=0xc8;}else{_0x3e6172=0xce;}_0x10ae83[_0x95ac('0x1b')](_0x3e6172);return _0x10ae83['set'](_0x95ac('0x21'),_0x113a18+'-'+_0x2e9942+'/'+_0x34cd7d)[_0x95ac('0x1d')](_0x4d4eb0);}return null;};}function patchUpdates(_0x3fb160){return function(_0x308b47){try{jsonpatch['apply'](_0x308b47,_0x3fb160,!![]);}catch(_0x2a51a0){return BPromise[_0x95ac('0x22')](_0x2a51a0);}return _0x308b47[_0x95ac('0x23')]();};}function saveUpdates(_0x10cd92,_0x4734e2){return function(_0x2abd2d){if(_0x2abd2d){return _0x2abd2d['update'](_0x10cd92)[_0x95ac('0x24')](function(_0x1acef4){return _0x1acef4;});}return null;};}function removeEntity(_0x39f7f2,_0x5f575a){return function(_0x1fe34c){if(_0x1fe34c){return _0x1fe34c['destroy']()['then'](function(){var _0x44bfca=_0x1fe34c[_0x95ac('0x25')]({'plain':!![]});var _0x181adf=_0x95ac('0x26');return db[_0x95ac('0x27')][_0x95ac('0x28')]({'where':{'type':_0x181adf,'resourceId':_0x44bfca['id']}})[_0x95ac('0x24')](function(){return _0x1fe34c;});})[_0x95ac('0x24')](function(){_0x39f7f2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2cd5a0,_0x2fcdf6){return function(_0x1c9b4d){if(!_0x1c9b4d){_0x2cd5a0[_0x95ac('0x1a')](0x194);}return _0x1c9b4d;};}function handleError(_0x4402f6,_0x706195){_0x706195=_0x706195||0x1f4;return function(_0x2a9288){logger['error'](_0x2a9288[_0x95ac('0x29')]);if(_0x2a9288[_0x95ac('0x2a')]){delete _0x2a9288[_0x95ac('0x2a')];}_0x4402f6[_0x95ac('0x1b')](_0x706195)[_0x95ac('0x2b')](_0x2a9288);};}exports[_0x95ac('0x2c')]=function(_0x1c151a,_0x4026d1){var _0x4e0c58={},_0x2a8e5a={},_0x3be082={'count':0x0,'rows':[]};var _0x5c48ca=_[_0x95ac('0x2d')](db[_0x95ac('0x2e')][_0x95ac('0x2f')],function(_0x5462d9){return{'name':_0x5462d9[_0x95ac('0x30')],'type':_0x5462d9[_0x95ac('0x31')][_0x95ac('0x32')]};});_0x2a8e5a[_0x95ac('0x33')]=_[_0x95ac('0x2d')](_0x5c48ca,_0x95ac('0x2a'));_0x2a8e5a[_0x95ac('0x34')]=_['keys'](_0x1c151a['query']);_0x2a8e5a[_0x95ac('0x35')]=_[_0x95ac('0x36')](_0x2a8e5a[_0x95ac('0x33')],_0x2a8e5a[_0x95ac('0x34')]);_0x4e0c58[_0x95ac('0x37')]=_['intersection'](_0x2a8e5a[_0x95ac('0x33')],qs[_0x95ac('0x38')](_0x1c151a[_0x95ac('0x34')]['fields']));_0x4e0c58['attributes']=_0x4e0c58['attributes'][_0x95ac('0x39')]?_0x4e0c58['attributes']:_0x2a8e5a[_0x95ac('0x33')];if(!_0x1c151a['query'][_0x95ac('0x3a')](_0x95ac('0x3b'))){_0x4e0c58['limit']=qs['limit'](_0x1c151a['query'][_0x95ac('0x20')]);_0x4e0c58[_0x95ac('0x1f')]=qs[_0x95ac('0x1f')](_0x1c151a['query'][_0x95ac('0x1f')]);}_0x4e0c58['order']=qs[_0x95ac('0x3c')](_0x1c151a[_0x95ac('0x34')]['sort']);_0x4e0c58[_0x95ac('0x3d')]=qs[_0x95ac('0x35')](_['pick'](_0x1c151a[_0x95ac('0x34')],_0x2a8e5a['filters']),_0x5c48ca);if(_0x1c151a[_0x95ac('0x34')][_0x95ac('0x3e')]){_0x4e0c58[_0x95ac('0x3d')]=_[_0x95ac('0x3f')](_0x4e0c58[_0x95ac('0x3d')],{'$or':_[_0x95ac('0x2d')](_0x5c48ca,function(_0x4f007d){if(_0x4f007d[_0x95ac('0x31')]!==_0x95ac('0x40')){var _0x2d82af={};_0x2d82af[_0x4f007d[_0x95ac('0x2a')]]={'$like':'%'+_0x1c151a['query'][_0x95ac('0x3e')]+'%'};return _0x2d82af;}})});}_0x4e0c58=_[_0x95ac('0x3f')]({},_0x4e0c58,_0x1c151a[_0x95ac('0x41')]);var _0x4461c9={'where':_0x4e0c58[_0x95ac('0x3d')]};return db[_0x95ac('0x2e')][_0x95ac('0x1e')](_0x4461c9)['then'](function(_0x1f142b){_0x3be082['count']=_0x1f142b;if(_0x1c151a['query'][_0x95ac('0x42')]){_0x4e0c58[_0x95ac('0x43')]=[{'all':!![]}];}return db[_0x95ac('0x2e')][_0x95ac('0x44')](_0x4e0c58);})[_0x95ac('0x24')](function(_0x19db71){_0x3be082[_0x95ac('0x45')]=_0x19db71;return _0x3be082;})[_0x95ac('0x24')](respondWithFilteredResult(_0x4026d1,_0x4e0c58))['catch'](handleError(_0x4026d1,null));};exports['show']=function(_0x2dc373,_0x4cbca5){var _0x12db39={'raw':!![],'where':{'id':_0x2dc373[_0x95ac('0x46')]['id']}},_0x2c6330={};_0x2c6330['model']=_[_0x95ac('0x47')](db['AnalyticExtractedReport'][_0x95ac('0x2f')]);_0x2c6330[_0x95ac('0x34')]=_[_0x95ac('0x47')](_0x2dc373[_0x95ac('0x34')]);_0x2c6330[_0x95ac('0x35')]=_[_0x95ac('0x36')](_0x2c6330[_0x95ac('0x33')],_0x2c6330[_0x95ac('0x34')]);_0x12db39['attributes']=_[_0x95ac('0x36')](_0x2c6330[_0x95ac('0x33')],qs['fields'](_0x2dc373['query'][_0x95ac('0x38')]));_0x12db39[_0x95ac('0x37')]=_0x12db39[_0x95ac('0x37')][_0x95ac('0x39')]?_0x12db39[_0x95ac('0x37')]:_0x2c6330[_0x95ac('0x33')];if(_0x2dc373['query'][_0x95ac('0x42')]){_0x12db39[_0x95ac('0x43')]=[{'all':!![]}];}_0x12db39=_[_0x95ac('0x3f')]({},_0x12db39,_0x2dc373['options']);return db[_0x95ac('0x2e')][_0x95ac('0x48')](_0x12db39)[_0x95ac('0x24')](handleEntityNotFound(_0x4cbca5,null))['then'](respondWithResult(_0x4cbca5,null))['catch'](handleError(_0x4cbca5,null));};exports[_0x95ac('0x49')]=function(_0x55f63c,_0x5d632c){return db[_0x95ac('0x2e')]['create'](_0x55f63c['body'],{})[_0x95ac('0x24')](function(_0x3f08e3){var _0xed12a7=_0x55f63c[_0x95ac('0x4a')][_0x95ac('0x25')]({'plain':!![]});if(!_0xed12a7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xed12a7['role']==='user'){var _0x5e8880=_0x3f08e3[_0x95ac('0x25')]({'plain':!![]});var _0x223baf=_0x95ac('0x26');return db[_0x95ac('0x4b')][_0x95ac('0x48')]({'where':{'name':_0x223baf,'userProfileId':_0xed12a7[_0x95ac('0x4c')]},'raw':!![]})[_0x95ac('0x24')](function(_0x4398f8){if(_0x4398f8&&_0x4398f8[_0x95ac('0x4d')]===0x0){return db[_0x95ac('0x27')][_0x95ac('0x49')]({'name':_0x5e8880[_0x95ac('0x2a')],'resourceId':_0x5e8880['id'],'type':_0x4398f8[_0x95ac('0x2a')],'sectionId':_0x4398f8['id']},{})[_0x95ac('0x24')](function(){return _0x3f08e3;});}else{return _0x3f08e3;}})[_0x95ac('0x4e')](function(_0xda7634){logger[_0x95ac('0x4f')](_0x95ac('0x50'),_0xda7634);throw _0xda7634;});}return _0x3f08e3;})[_0x95ac('0x24')](respondWithResult(_0x5d632c,0xc9))[_0x95ac('0x4e')](handleError(_0x5d632c,null));};exports[_0x95ac('0x51')]=function(_0x2f79cd,_0x53a544){if(_0x2f79cd['body']['id']){delete _0x2f79cd[_0x95ac('0x52')]['id'];}return db[_0x95ac('0x2e')][_0x95ac('0x48')]({'where':{'id':_0x2f79cd['params']['id']}})[_0x95ac('0x24')](handleEntityNotFound(_0x53a544,null))[_0x95ac('0x24')](saveUpdates(_0x2f79cd[_0x95ac('0x52')],null))[_0x95ac('0x24')](respondWithResult(_0x53a544,null))[_0x95ac('0x4e')](handleError(_0x53a544,null));};exports[_0x95ac('0x28')]=function(_0x2a93b1,_0x4f9180){return db[_0x95ac('0x2e')][_0x95ac('0x48')]({'where':{'id':_0x2a93b1[_0x95ac('0x46')]['id']}})[_0x95ac('0x24')](handleEntityNotFound(_0x4f9180,null))[_0x95ac('0x24')](removeEntity(_0x4f9180,null))['catch'](handleError(_0x4f9180,null));};exports[_0x95ac('0x53')]=function(_0x231171,_0x261ac3,_0x263682){return db[_0x95ac('0x2e')][_0x95ac('0x48')]({'where':{'id':_0x231171['params']['id']},'attributes':['name',_0x95ac('0x54'),_0x95ac('0x55'),_0x95ac('0x56')],'raw':!![]})[_0x95ac('0x24')](handleEntityNotFound(_0x261ac3,null))['then'](function(_0x29aac0){if(_0x29aac0){if(!fs['existsSync'](path[_0x95ac('0x57')](config[_0x95ac('0x58')],_0x95ac('0x59'),_0x29aac0[_0x95ac('0x55')]))){throw new db['Sequelize']['ValidationError'](_0x95ac('0x5a'));}if(_0x231171[_0x95ac('0x34')][_0x95ac('0x5b')]){return _0x261ac3[_0x95ac('0x1a')](0xc8);}return _0x261ac3['download'](path[_0x95ac('0x57')](config['root'],_0x95ac('0x59'),_0x29aac0['savename']),util['format'](_0x95ac('0x5c'),_0x29aac0[_0x95ac('0x54')]||_0x29aac0[_0x95ac('0x2a')],_0x29aac0[_0x95ac('0x56')][_0x95ac('0x5d')]()));}})['catch'](handleError(_0x261ac3,null));}; \ No newline at end of file +var _0x2b4a=['find','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ExtractedReports','UserProfileSection','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','download','output','root','server/files/reports','savename','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','join','format','%s.%s','toLowerCase','rimraf','zip-dir','request-promise','bluebird','mustache','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','get','UserProfileResource','error','stack','name','index','AnalyticExtractedReport','rawAttributes','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','include','findAll','rows','catch','params','includeAll'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x2b4a,0x1de));var _0xa2b4=function(_0x285824,_0x3da647){_0x285824=_0x285824-0x0;var _0x311d7e=_0x2b4a[_0x285824];return _0x311d7e;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xa2b4('0x0'));var zipdir=require(_0xa2b4('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa2b4('0x2'));var moment=require('moment');var BPromise=require(_0xa2b4('0x3'));var Mustache=require(_0xa2b4('0x4'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xa2b4('0x5'));var ejs=require(_0xa2b4('0x6'));var fs=require('fs');var _=require('lodash');var squel=require(_0xa2b4('0x7'));var crypto=require(_0xa2b4('0x8'));var jsforce=require(_0xa2b4('0x9'));var deskjs=require(_0xa2b4('0xa'));var toCsv=require(_0xa2b4('0x5'));var querystring=require(_0xa2b4('0xb'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa2b4('0xc'));var qs=require(_0xa2b4('0xd'));var as=require(_0xa2b4('0xe'));var hardwareService=require(_0xa2b4('0xf'));var logger=require(_0xa2b4('0x10'))(_0xa2b4('0x11'));var utils=require(_0xa2b4('0x12'));var config=require('../../config/environment');var db=require(_0xa2b4('0x13'))['db'];function respondWithStatusCode(_0x110082,_0x5d03d3){_0x5d03d3=_0x5d03d3||0xcc;return function(_0x1bdb65){if(_0x1bdb65){return _0x110082[_0xa2b4('0x14')](_0x5d03d3);}return _0x110082[_0xa2b4('0x15')](_0x5d03d3)[_0xa2b4('0x16')]();};}function respondWithResult(_0x147fd8,_0x33b5b5){_0x33b5b5=_0x33b5b5||0xc8;return function(_0x3a1801){if(_0x3a1801){return _0x147fd8[_0xa2b4('0x15')](_0x33b5b5)[_0xa2b4('0x17')](_0x3a1801);}};}function respondWithFilteredResult(_0x33bd32,_0x2d82b6){return function(_0x4257a9){if(_0x4257a9){var _0x16c4c7=_0x4257a9[_0xa2b4('0x18')],_0x5bb677=_0x2d82b6[_0xa2b4('0x19')],_0x1a1489=_0x2d82b6[_0xa2b4('0x19')]+_0x2d82b6[_0xa2b4('0x1a')],_0x1238ce;if(_0x1a1489>=_0x16c4c7){_0x1a1489=_0x16c4c7;_0x1238ce=0xc8;}else{_0x1238ce=0xce;}_0x33bd32['status'](_0x1238ce);return _0x33bd32[_0xa2b4('0x1b')](_0xa2b4('0x1c'),_0x5bb677+'-'+_0x1a1489+'/'+_0x16c4c7)['json'](_0x4257a9);}return null;};}function patchUpdates(_0x3ce2c7){return function(_0x310e67){try{jsonpatch[_0xa2b4('0x1d')](_0x310e67,_0x3ce2c7,!![]);}catch(_0x4b4eab){return BPromise['reject'](_0x4b4eab);}return _0x310e67[_0xa2b4('0x1e')]();};}function saveUpdates(_0x5c037f,_0xc99c95){return function(_0x4cfaf9){if(_0x4cfaf9){return _0x4cfaf9[_0xa2b4('0x1f')](_0x5c037f)[_0xa2b4('0x20')](function(_0x202452){return _0x202452;});}return null;};}function removeEntity(_0x9470da,_0x30b14d){return function(_0x2f6d1a){if(_0x2f6d1a){return _0x2f6d1a[_0xa2b4('0x21')]()['then'](function(){var _0x15ceb5=_0x2f6d1a[_0xa2b4('0x22')]({'plain':!![]});var _0xe07963='ExtractedReports';return db[_0xa2b4('0x23')][_0xa2b4('0x21')]({'where':{'type':_0xe07963,'resourceId':_0x15ceb5['id']}})['then'](function(){return _0x2f6d1a;});})[_0xa2b4('0x20')](function(){_0x9470da[_0xa2b4('0x15')](0xcc)[_0xa2b4('0x16')]();});}};}function handleEntityNotFound(_0x275366,_0x225fb4){return function(_0x18573f){if(!_0x18573f){_0x275366[_0xa2b4('0x14')](0x194);}return _0x18573f;};}function handleError(_0xdead7f,_0x2d423b){_0x2d423b=_0x2d423b||0x1f4;return function(_0x10d994){logger[_0xa2b4('0x24')](_0x10d994[_0xa2b4('0x25')]);if(_0x10d994[_0xa2b4('0x26')]){delete _0x10d994[_0xa2b4('0x26')];}_0xdead7f[_0xa2b4('0x15')](_0x2d423b)['send'](_0x10d994);};}exports[_0xa2b4('0x27')]=function(_0x11ae82,_0x3cea11){var _0xe9342c={},_0x345a79={},_0x19fde4={'count':0x0,'rows':[]};var _0x701af8=_['map'](db[_0xa2b4('0x28')][_0xa2b4('0x29')],function(_0x1695fc){return{'name':_0x1695fc['fieldName'],'type':_0x1695fc[_0xa2b4('0x2a')]['key']};});_0x345a79[_0xa2b4('0x2b')]=_[_0xa2b4('0x2c')](_0x701af8,_0xa2b4('0x26'));_0x345a79[_0xa2b4('0x2d')]=_[_0xa2b4('0x2e')](_0x11ae82['query']);_0x345a79[_0xa2b4('0x2f')]=_[_0xa2b4('0x30')](_0x345a79[_0xa2b4('0x2b')],_0x345a79[_0xa2b4('0x2d')]);_0xe9342c[_0xa2b4('0x31')]=_[_0xa2b4('0x30')](_0x345a79['model'],qs[_0xa2b4('0x32')](_0x11ae82[_0xa2b4('0x2d')][_0xa2b4('0x32')]));_0xe9342c[_0xa2b4('0x31')]=_0xe9342c['attributes'][_0xa2b4('0x33')]?_0xe9342c[_0xa2b4('0x31')]:_0x345a79[_0xa2b4('0x2b')];if(!_0x11ae82[_0xa2b4('0x2d')][_0xa2b4('0x34')](_0xa2b4('0x35'))){_0xe9342c[_0xa2b4('0x1a')]=qs[_0xa2b4('0x1a')](_0x11ae82[_0xa2b4('0x2d')][_0xa2b4('0x1a')]);_0xe9342c[_0xa2b4('0x19')]=qs['offset'](_0x11ae82[_0xa2b4('0x2d')][_0xa2b4('0x19')]);}_0xe9342c[_0xa2b4('0x36')]=qs[_0xa2b4('0x37')](_0x11ae82[_0xa2b4('0x2d')][_0xa2b4('0x37')]);_0xe9342c['where']=qs[_0xa2b4('0x2f')](_[_0xa2b4('0x38')](_0x11ae82[_0xa2b4('0x2d')],_0x345a79[_0xa2b4('0x2f')]),_0x701af8);if(_0x11ae82[_0xa2b4('0x2d')][_0xa2b4('0x39')]){_0xe9342c[_0xa2b4('0x3a')]=_[_0xa2b4('0x3b')](_0xe9342c[_0xa2b4('0x3a')],{'$or':_[_0xa2b4('0x2c')](_0x701af8,function(_0x294688){if(_0x294688['type']!==_0xa2b4('0x3c')){var _0x3478db={};_0x3478db[_0x294688[_0xa2b4('0x26')]]={'$like':'%'+_0x11ae82[_0xa2b4('0x2d')][_0xa2b4('0x39')]+'%'};return _0x3478db;}})});}_0xe9342c=_[_0xa2b4('0x3b')]({},_0xe9342c,_0x11ae82[_0xa2b4('0x3d')]);var _0x2c3887={'where':_0xe9342c[_0xa2b4('0x3a')]};return db[_0xa2b4('0x28')][_0xa2b4('0x18')](_0x2c3887)[_0xa2b4('0x20')](function(_0x3aa816){_0x19fde4['count']=_0x3aa816;if(_0x11ae82[_0xa2b4('0x2d')]['includeAll']){_0xe9342c[_0xa2b4('0x3e')]=[{'all':!![]}];}return db[_0xa2b4('0x28')][_0xa2b4('0x3f')](_0xe9342c);})[_0xa2b4('0x20')](function(_0xd1d7ed){_0x19fde4[_0xa2b4('0x40')]=_0xd1d7ed;return _0x19fde4;})['then'](respondWithFilteredResult(_0x3cea11,_0xe9342c))[_0xa2b4('0x41')](handleError(_0x3cea11,null));};exports['show']=function(_0x233970,_0x127d04){var _0x192f11={'raw':!![],'where':{'id':_0x233970[_0xa2b4('0x42')]['id']}},_0x50a060={};_0x50a060[_0xa2b4('0x2b')]=_[_0xa2b4('0x2e')](db[_0xa2b4('0x28')][_0xa2b4('0x29')]);_0x50a060['query']=_['keys'](_0x233970[_0xa2b4('0x2d')]);_0x50a060[_0xa2b4('0x2f')]=_[_0xa2b4('0x30')](_0x50a060[_0xa2b4('0x2b')],_0x50a060[_0xa2b4('0x2d')]);_0x192f11[_0xa2b4('0x31')]=_['intersection'](_0x50a060['model'],qs[_0xa2b4('0x32')](_0x233970[_0xa2b4('0x2d')][_0xa2b4('0x32')]));_0x192f11[_0xa2b4('0x31')]=_0x192f11[_0xa2b4('0x31')][_0xa2b4('0x33')]?_0x192f11[_0xa2b4('0x31')]:_0x50a060[_0xa2b4('0x2b')];if(_0x233970[_0xa2b4('0x2d')][_0xa2b4('0x43')]){_0x192f11[_0xa2b4('0x3e')]=[{'all':!![]}];}_0x192f11=_[_0xa2b4('0x3b')]({},_0x192f11,_0x233970[_0xa2b4('0x3d')]);return db[_0xa2b4('0x28')][_0xa2b4('0x44')](_0x192f11)[_0xa2b4('0x20')](handleEntityNotFound(_0x127d04,null))[_0xa2b4('0x20')](respondWithResult(_0x127d04,null))[_0xa2b4('0x41')](handleError(_0x127d04,null));};exports['create']=function(_0x299927,_0x4c466c){return db[_0xa2b4('0x28')]['create'](_0x299927['body'],{})[_0xa2b4('0x20')](function(_0x55f8b2){var _0x3dc4d2=_0x299927[_0xa2b4('0x45')][_0xa2b4('0x22')]({'plain':!![]});if(!_0x3dc4d2)throw new Error(_0xa2b4('0x46'));if(_0x3dc4d2[_0xa2b4('0x47')]==='user'){var _0x58cbca=_0x55f8b2[_0xa2b4('0x22')]({'plain':!![]});var _0x1573db=_0xa2b4('0x48');return db[_0xa2b4('0x49')][_0xa2b4('0x44')]({'where':{'name':_0x1573db,'userProfileId':_0x3dc4d2['userProfileId']},'raw':!![]})[_0xa2b4('0x20')](function(_0x239ce1){if(_0x239ce1&&_0x239ce1[_0xa2b4('0x4a')]===0x0){return db[_0xa2b4('0x23')][_0xa2b4('0x4b')]({'name':_0x58cbca[_0xa2b4('0x26')],'resourceId':_0x58cbca['id'],'type':_0x239ce1[_0xa2b4('0x26')],'sectionId':_0x239ce1['id']},{})['then'](function(){return _0x55f8b2;});}else{return _0x55f8b2;}})['catch'](function(_0x34a3ba){logger[_0xa2b4('0x24')](_0xa2b4('0x4c'),_0x34a3ba);throw _0x34a3ba;});}return _0x55f8b2;})[_0xa2b4('0x20')](respondWithResult(_0x4c466c,0xc9))['catch'](handleError(_0x4c466c,null));};exports[_0xa2b4('0x1f')]=function(_0x78d884,_0xb1dd68){if(_0x78d884[_0xa2b4('0x4d')]['id']){delete _0x78d884[_0xa2b4('0x4d')]['id'];}return db['AnalyticExtractedReport']['find']({'where':{'id':_0x78d884['params']['id']}})[_0xa2b4('0x20')](handleEntityNotFound(_0xb1dd68,null))[_0xa2b4('0x20')](saveUpdates(_0x78d884[_0xa2b4('0x4d')],null))[_0xa2b4('0x20')](respondWithResult(_0xb1dd68,null))[_0xa2b4('0x41')](handleError(_0xb1dd68,null));};exports[_0xa2b4('0x21')]=function(_0x52829c,_0x267874){return db[_0xa2b4('0x28')]['find']({'where':{'id':_0x52829c['params']['id']}})[_0xa2b4('0x20')](handleEntityNotFound(_0x267874,null))[_0xa2b4('0x20')](removeEntity(_0x267874,null))[_0xa2b4('0x41')](handleError(_0x267874,null));};exports[_0xa2b4('0x4e')]=function(_0x2d37e9,_0x13529f,_0x87fa16){return db['AnalyticExtractedReport']['find']({'where':{'id':_0x2d37e9[_0xa2b4('0x42')]['id']},'attributes':[_0xa2b4('0x26'),'basename','savename',_0xa2b4('0x4f')],'raw':!![]})[_0xa2b4('0x20')](handleEntityNotFound(_0x13529f,null))[_0xa2b4('0x20')](function(_0x1fbb8e){if(_0x1fbb8e){if(!fs['existsSync'](path['join'](config[_0xa2b4('0x50')],_0xa2b4('0x51'),_0x1fbb8e[_0xa2b4('0x52')]))){throw new db[(_0xa2b4('0x53'))][(_0xa2b4('0x54'))](_0xa2b4('0x55'));}if(_0x2d37e9['query'][_0xa2b4('0x56')]){return _0x13529f['sendStatus'](0xc8);}return _0x13529f['download'](path[_0xa2b4('0x57')](config['root'],_0xa2b4('0x51'),_0x1fbb8e['savename']),util[_0xa2b4('0x58')](_0xa2b4('0x59'),_0x1fbb8e['basename']||_0x1fbb8e[_0xa2b4('0x26')],_0x1fbb8e[_0xa2b4('0x4f')][_0xa2b4('0x5a')]()));}})[_0xa2b4('0x41')](handleError(_0x13529f,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 7982710..cefc18d 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 _0x08f6=['AnalyticExtractedReport','analytics_extracted_reports','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticExtractedReport.attributes','exports','define'];(function(_0x4d613c,_0x55f220){var _0x301fe3=function(_0x5eec0b){while(--_0x5eec0b){_0x4d613c['push'](_0x4d613c['shift']());}};_0x301fe3(++_0x55f220);}(_0x08f6,0x6a));var _0x608f=function(_0xa9a245,_0x2a0387){_0xa9a245=_0xa9a245-0x0;var _0x2d0eaa=_0x08f6[_0xa9a245];return _0x2d0eaa;};'use strict';var _=require('lodash');var util=require(_0x608f('0x0'));var logger=require('../../config/logger')(_0x608f('0x1'));var moment=require(_0x608f('0x2'));var BPromise=require(_0x608f('0x3'));var rp=require(_0x608f('0x4'));var fs=require('fs');var path=require(_0x608f('0x5'));var rimraf=require(_0x608f('0x6'));var config=require(_0x608f('0x7'));var attributes=require(_0x608f('0x8'));module[_0x608f('0x9')]=function(_0x2bd6e6,_0x586989){return _0x2bd6e6[_0x608f('0xa')](_0x608f('0xb'),attributes,{'tableName':_0x608f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x016f=['util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','define','AnalyticExtractedReport','analytics_extracted_reports'];(function(_0xac6d20,_0x1e7db7){var _0x4fdb85=function(_0xbc33d7){while(--_0xbc33d7){_0xac6d20['push'](_0xac6d20['shift']());}};_0x4fdb85(++_0x1e7db7);}(_0x016f,0x108));var _0xf016=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x016f[_0x6c993a];return _0x27f547;};'use strict';var _=require('lodash');var util=require(_0xf016('0x0'));var logger=require(_0xf016('0x1'))(_0xf016('0x2'));var moment=require(_0xf016('0x3'));var BPromise=require(_0xf016('0x4'));var rp=require(_0xf016('0x5'));var fs=require('fs');var path=require(_0xf016('0x6'));var rimraf=require('rimraf');var config=require(_0xf016('0x7'));var attributes=require('./analyticExtractedReport.attributes');module[_0xf016('0x8')]=function(_0x584d37,_0x4b9c53){return _0x584d37[_0xf016('0x9')](_0xf016('0xa'),attributes,{'tableName':_0xf016('0xb'),'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 044679d..06db358 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 _0xfd39=['http','request','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x1325de,_0x31a502){var _0x1b366d=function(_0x4bc82d){while(--_0x4bc82d){_0x1325de['push'](_0x1325de['shift']());}};_0x1b366d(++_0x31a502);}(_0xfd39,0x1d8));var _0x9fd3=function(_0x2a304f,_0x2d5b5d){_0x2a304f=_0x2a304f-0x0;var _0x44c93e=_0xfd39[_0x2a304f];return _0x44c93e;};'use strict';var _=require(_0x9fd3('0x0'));var util=require(_0x9fd3('0x1'));var moment=require(_0x9fd3('0x2'));var BPromise=require(_0x9fd3('0x3'));var rs=require(_0x9fd3('0x4'));var fs=require('fs');var Redis=require(_0x9fd3('0x5'));var db=require(_0x9fd3('0x6'))['db'];var utils=require(_0x9fd3('0x7'));var logger=require(_0x9fd3('0x8'))(_0x9fd3('0x9'));var config=require('../../config/environment');var jayson=require(_0x9fd3('0xa'));var client=jayson['client'][_0x9fd3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xabda62,_0x471bf6,_0xd679d){return new BPromise(function(_0x43ac87,_0x545a32){return client[_0x9fd3('0xc')](_0xabda62,_0xd679d)['then'](function(_0xd8435d){logger[_0x9fd3('0xd')](_0x9fd3('0xe'),_0x471bf6,_0x9fd3('0xf'));logger[_0x9fd3('0x10')](_0x9fd3('0x11'),_0x471bf6,'request\x20sent',JSON[_0x9fd3('0x12')](_0xd8435d));if(_0xd8435d['error']){if(_0xd8435d['error'][_0x9fd3('0x13')]===0x1f4){logger[_0x9fd3('0x14')](_0x9fd3('0xe'),_0x471bf6,_0xd8435d[_0x9fd3('0x14')][_0x9fd3('0x15')]);return _0x545a32(_0xd8435d[_0x9fd3('0x14')]['message']);}logger[_0x9fd3('0x14')](_0x9fd3('0xe'),_0x471bf6,_0xd8435d[_0x9fd3('0x14')]['message']);return _0x43ac87(_0xd8435d[_0x9fd3('0x14')]['message']);}else{logger[_0x9fd3('0xd')](_0x9fd3('0xe'),_0x471bf6,_0x9fd3('0xf'));_0x43ac87(_0xd8435d[_0x9fd3('0x16')][_0x9fd3('0x15')]);}})['catch'](function(_0x4eddb2){logger[_0x9fd3('0x14')](_0x9fd3('0xe'),_0x471bf6,_0x4eddb2);_0x545a32(_0x4eddb2);});});} \ No newline at end of file +var _0x98dc=['lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x2cfb58,_0x3d9412){var _0xd99951=function(_0x329afa){while(--_0x329afa){_0x2cfb58['push'](_0x2cfb58['shift']());}};_0xd99951(++_0x3d9412);}(_0x98dc,0x1e4));var _0xc98d=function(_0x2ec871,_0x2f137d){_0x2ec871=_0x2ec871-0x0;var _0x434616=_0x98dc[_0x2ec871];return _0x434616;};'use strict';var _=require(_0xc98d('0x0'));var util=require(_0xc98d('0x1'));var moment=require(_0xc98d('0x2'));var BPromise=require(_0xc98d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc98d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc98d('0x5'));var logger=require(_0xc98d('0x6'))(_0xc98d('0x7'));var config=require('../../config/environment');var jayson=require(_0xc98d('0x8'));var client=jayson[_0xc98d('0x9')][_0xc98d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x49c927,_0x2241dc,_0x562f51){return new BPromise(function(_0x114d32,_0x3fd63d){return client[_0xc98d('0xb')](_0x49c927,_0x562f51)[_0xc98d('0xc')](function(_0xb29543){logger[_0xc98d('0xd')](_0xc98d('0xe'),_0x2241dc,_0xc98d('0xf'));logger[_0xc98d('0x10')](_0xc98d('0x11'),_0x2241dc,_0xc98d('0xf'),JSON[_0xc98d('0x12')](_0xb29543));if(_0xb29543[_0xc98d('0x13')]){if(_0xb29543[_0xc98d('0x13')][_0xc98d('0x14')]===0x1f4){logger[_0xc98d('0x13')](_0xc98d('0xe'),_0x2241dc,_0xb29543[_0xc98d('0x13')][_0xc98d('0x15')]);return _0x3fd63d(_0xb29543[_0xc98d('0x13')]['message']);}logger[_0xc98d('0x13')](_0xc98d('0xe'),_0x2241dc,_0xb29543[_0xc98d('0x13')][_0xc98d('0x15')]);return _0x114d32(_0xb29543[_0xc98d('0x13')][_0xc98d('0x15')]);}else{logger[_0xc98d('0xd')](_0xc98d('0xe'),_0x2241dc,_0xc98d('0xf'));_0x114d32(_0xb29543['result'][_0xc98d('0x15')]);}})['catch'](function(_0x432441){logger[_0xc98d('0x13')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x2241dc,_0x432441);_0x3fd63d(_0x432441);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index e266585..e124c9e 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 _0xe0d7=['connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get','isAuthenticated','index','/:id','show','download','post','put','destroy','exports','multer'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe0d7,0xba));var _0x7e0d=function(_0x4be634,_0x2b1a67){_0x4be634=_0x4be634-0x0;var _0x2df900=_0xe0d7[_0x4be634];return _0x2df900;};'use strict';var multer=require(_0x7e0d('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x7e0d('0x1'));var express=require(_0x7e0d('0x2'));var router=express[_0x7e0d('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x7e0d('0x4'));var config=require(_0x7e0d('0x5'));var controller=require(_0x7e0d('0x6'));router[_0x7e0d('0x7')]('/',auth[_0x7e0d('0x8')](),controller[_0x7e0d('0x9')]);router[_0x7e0d('0x7')](_0x7e0d('0xa'),auth[_0x7e0d('0x8')](),controller[_0x7e0d('0xb')]);router['get']('/:id/download',auth['isAuthenticated'](),controller[_0x7e0d('0xc')]);router[_0x7e0d('0xd')]('/',auth[_0x7e0d('0x8')](),controller['create']);router[_0x7e0d('0xe')](_0x7e0d('0xa'),auth[_0x7e0d('0x8')](),controller['update']);router['delete'](_0x7e0d('0xa'),auth[_0x7e0d('0x8')](),controller[_0x7e0d('0xf')]);module[_0x7e0d('0x10')]=router; \ No newline at end of file +var _0x6838=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get','isAuthenticated','index','show','/:id/download','download','post','create','/:id','update','delete','multer','util','express'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x6838,0xa8));var _0x8683=function(_0x340d75,_0x561cb0){_0x340d75=_0x340d75-0x0;var _0x3f1114=_0x6838[_0x340d75];return _0x3f1114;};'use strict';var multer=require(_0x8683('0x0'));var util=require(_0x8683('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x8683('0x2'));var router=express[_0x8683('0x3')]();var auth=require(_0x8683('0x4'));var interaction=require(_0x8683('0x5'));var config=require(_0x8683('0x6'));var controller=require(_0x8683('0x7'));router[_0x8683('0x8')]('/',auth[_0x8683('0x9')](),controller[_0x8683('0xa')]);router[_0x8683('0x8')]('/:id',auth[_0x8683('0x9')](),controller[_0x8683('0xb')]);router[_0x8683('0x8')](_0x8683('0xc'),auth[_0x8683('0x9')](),controller[_0x8683('0xd')]);router[_0x8683('0xe')]('/',auth['isAuthenticated'](),controller[_0x8683('0xf')]);router['put'](_0x8683('0x10'),auth[_0x8683('0x9')](),controller[_0x8683('0x11')]);router[_0x8683('0x12')](_0x8683('0x10'),auth[_0x8683('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 1b56577..d365303 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 _0x7a54=['STRING','BOOLEAN','sequelize','exports','TEXT'];(function(_0x2ab788,_0x5a3591){var _0x1f5860=function(_0x296d4d){while(--_0x296d4d){_0x2ab788['push'](_0x2ab788['shift']());}};_0x1f5860(++_0x5a3591);}(_0x7a54,0x106));var _0x47a5=function(_0x215895,_0xc0c3df){_0x215895=_0x215895-0x0;var _0x2e69c9=_0x7a54[_0x215895];return _0x2e69c9;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'field':{'type':Sequelize[_0x47a5('0x2')]},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize[_0x47a5('0x3')]},'format':{'type':Sequelize[_0x47a5('0x3')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x47a5('0x3')]},'custom':{'type':Sequelize[_0x47a5('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x326f=['STRING','BOOLEAN','sequelize'];(function(_0x67143c,_0x433024){var _0x1dbbc3=function(_0x35a77f){while(--_0x35a77f){_0x67143c['push'](_0x67143c['shift']());}};_0x1dbbc3(++_0x433024);}(_0x326f,0xd1));var _0xf326=function(_0x1d17c4,_0x88f115){_0x1d17c4=_0x1d17c4-0x0;var _0x1ae02f=_0x326f[_0x1d17c4];return _0x1ae02f;};'use strict';var Sequelize=require(_0xf326('0x0'));module['exports']={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize[_0xf326('0x1')]},'function':{'type':Sequelize[_0xf326('0x1')]},'format':{'type':Sequelize[_0xf326('0x1')]},'groupBy':{'type':Sequelize[_0xf326('0x2')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xf326('0x1')]},'custom':{'type':Sequelize[_0xf326('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index ef58f4c..2eb24db 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 _0x7118=['fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','includeAll','include','findAll','rows','catch','show','params','keys','options','find','body','bulkCreate','destroy','bulkDestroy','addFields','AnalyticCustomReport','findOne','transaction','CustomReportId','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','count','offset','limit','apply','save','update','then','error','stack','name','map','AnalyticFieldReport','rawAttributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7118,0x159));var _0x8711=function(_0x30d55f,_0x4207ae){_0x30d55f=_0x30d55f-0x0;var _0x16bf1f=_0x7118[_0x30d55f];return _0x16bf1f;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x8711('0x0'));var zipdir=require(_0x8711('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8711('0x2'));var moment=require(_0x8711('0x3'));var BPromise=require(_0x8711('0x4'));var Mustache=require(_0x8711('0x5'));var util=require(_0x8711('0x6'));var path=require(_0x8711('0x7'));var sox=require(_0x8711('0x8'));var csv=require('to-csv');var ejs=require(_0x8711('0x9'));var fs=require('fs');var _=require(_0x8711('0xa'));var squel=require(_0x8711('0xb'));var crypto=require(_0x8711('0xc'));var jsforce=require(_0x8711('0xd'));var deskjs=require(_0x8711('0xe'));var toCsv=require(_0x8711('0xf'));var querystring=require(_0x8711('0x10'));var Papa=require(_0x8711('0x11'));var Redis=require(_0x8711('0x12'));var authService=require(_0x8711('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8711('0x14'));var logger=require(_0x8711('0x15'))(_0x8711('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x8711('0x17'))['db'];function respondWithStatusCode(_0x89db9a,_0x5d2c38){_0x5d2c38=_0x5d2c38||0xcc;return function(_0x49b241){if(_0x49b241){return _0x89db9a[_0x8711('0x18')](_0x5d2c38);}return _0x89db9a[_0x8711('0x19')](_0x5d2c38)[_0x8711('0x1a')]();};}function respondWithResult(_0x2758ee,_0xc0a891){_0xc0a891=_0xc0a891||0xc8;return function(_0x22f434){if(_0x22f434){return _0x2758ee[_0x8711('0x19')](_0xc0a891)['json'](_0x22f434);}};}function respondWithFilteredResult(_0x30e854,_0x363bcd){return function(_0x13f394){if(_0x13f394){var _0x2e12ec=_0x13f394[_0x8711('0x1b')],_0x3ab905=_0x363bcd[_0x8711('0x1c')],_0x4628e9=_0x363bcd[_0x8711('0x1c')]+_0x363bcd[_0x8711('0x1d')],_0x57fedb;if(_0x4628e9>=_0x2e12ec){_0x4628e9=_0x2e12ec;_0x57fedb=0xc8;}else{_0x57fedb=0xce;}_0x30e854[_0x8711('0x19')](_0x57fedb);return _0x30e854['set']('Content-Range',_0x3ab905+'-'+_0x4628e9+'/'+_0x2e12ec)['json'](_0x13f394);}return null;};}function patchUpdates(_0x26dfb0){return function(_0x3689be){try{jsonpatch[_0x8711('0x1e')](_0x3689be,_0x26dfb0,!![]);}catch(_0x5305c3){return BPromise['reject'](_0x5305c3);}return _0x3689be[_0x8711('0x1f')]();};}function saveUpdates(_0x16e628,_0x1209e0){return function(_0x44b948){if(_0x44b948){return _0x44b948[_0x8711('0x20')](_0x16e628)[_0x8711('0x21')](function(_0x142fa7){return _0x142fa7;});}return null;};}function removeEntity(_0x349fc2,_0xace829){return function(_0x41369d){if(_0x41369d){return _0x41369d['destroy']()[_0x8711('0x21')](function(){_0x349fc2[_0x8711('0x19')](0xcc)[_0x8711('0x1a')]();});}};}function handleEntityNotFound(_0x939ef3,_0x4cf830){return function(_0x27cafd){if(!_0x27cafd){_0x939ef3[_0x8711('0x18')](0x194);}return _0x27cafd;};}function handleError(_0x3e92d4,_0x5ab925){_0x5ab925=_0x5ab925||0x1f4;return function(_0xb20da2){logger[_0x8711('0x22')](_0xb20da2[_0x8711('0x23')]);if(_0xb20da2[_0x8711('0x24')]){delete _0xb20da2[_0x8711('0x24')];}_0x3e92d4['status'](_0x5ab925)['send'](_0xb20da2);};}exports['index']=function(_0x2ad1fa,_0x16ea3b){var _0x2d0901={},_0x15e1b8={},_0x12cfdc={'count':0x0,'rows':[]};var _0x254b35=_[_0x8711('0x25')](db[_0x8711('0x26')][_0x8711('0x27')],function(_0x47e7b7){return{'name':_0x47e7b7[_0x8711('0x28')],'type':_0x47e7b7['type'][_0x8711('0x29')]};});_0x15e1b8[_0x8711('0x2a')]=_[_0x8711('0x25')](_0x254b35,'name');_0x15e1b8[_0x8711('0x2b')]=_['keys'](_0x2ad1fa[_0x8711('0x2b')]);_0x15e1b8[_0x8711('0x2c')]=_[_0x8711('0x2d')](_0x15e1b8['model'],_0x15e1b8['query']);_0x2d0901[_0x8711('0x2e')]=_[_0x8711('0x2d')](_0x15e1b8[_0x8711('0x2a')],qs[_0x8711('0x2f')](_0x2ad1fa[_0x8711('0x2b')][_0x8711('0x2f')]));_0x2d0901[_0x8711('0x2e')]=_0x2d0901[_0x8711('0x2e')][_0x8711('0x30')]?_0x2d0901[_0x8711('0x2e')]:_0x15e1b8['model'];if(!_0x2ad1fa[_0x8711('0x2b')][_0x8711('0x31')](_0x8711('0x32'))){_0x2d0901[_0x8711('0x1d')]=qs[_0x8711('0x1d')](_0x2ad1fa[_0x8711('0x2b')][_0x8711('0x1d')]);_0x2d0901[_0x8711('0x1c')]=qs[_0x8711('0x1c')](_0x2ad1fa[_0x8711('0x2b')]['offset']);}_0x2d0901[_0x8711('0x33')]=qs[_0x8711('0x34')](_0x2ad1fa[_0x8711('0x2b')][_0x8711('0x34')]);_0x2d0901[_0x8711('0x35')]=qs['filters'](_[_0x8711('0x36')](_0x2ad1fa[_0x8711('0x2b')],_0x15e1b8[_0x8711('0x2c')]),_0x254b35);if(_0x2ad1fa['query'][_0x8711('0x37')]){_0x2d0901[_0x8711('0x35')]=_[_0x8711('0x38')](_0x2d0901[_0x8711('0x35')],{'$or':_[_0x8711('0x25')](_0x254b35,function(_0x14922d){if(_0x14922d[_0x8711('0x39')]!=='VIRTUAL'){var _0xd805b9={};_0xd805b9[_0x14922d[_0x8711('0x24')]]={'$like':'%'+_0x2ad1fa[_0x8711('0x2b')][_0x8711('0x37')]+'%'};return _0xd805b9;}})});}_0x2d0901=_['merge']({},_0x2d0901,_0x2ad1fa['options']);var _0x45bf2d={'where':_0x2d0901[_0x8711('0x35')]};return db[_0x8711('0x26')][_0x8711('0x1b')](_0x45bf2d)[_0x8711('0x21')](function(_0x225aa7){_0x12cfdc[_0x8711('0x1b')]=_0x225aa7;if(_0x2ad1fa[_0x8711('0x2b')][_0x8711('0x3a')]){_0x2d0901[_0x8711('0x3b')]=[{'all':!![]}];}return db[_0x8711('0x26')][_0x8711('0x3c')](_0x2d0901);})[_0x8711('0x21')](function(_0x2e98f9){_0x12cfdc[_0x8711('0x3d')]=_0x2e98f9;return _0x12cfdc;})[_0x8711('0x21')](respondWithFilteredResult(_0x16ea3b,_0x2d0901))[_0x8711('0x3e')](handleError(_0x16ea3b,null));};exports[_0x8711('0x3f')]=function(_0xea76d8,_0x45ad44){var _0x2fb5e8={'raw':![],'where':{'id':_0xea76d8[_0x8711('0x40')]['id']}},_0x597b48={};_0x597b48['model']=_[_0x8711('0x41')](db[_0x8711('0x26')][_0x8711('0x27')]);_0x597b48[_0x8711('0x2b')]=_['keys'](_0xea76d8[_0x8711('0x2b')]);_0x597b48[_0x8711('0x2c')]=_[_0x8711('0x2d')](_0x597b48[_0x8711('0x2a')],_0x597b48[_0x8711('0x2b')]);_0x2fb5e8[_0x8711('0x2e')]=_['intersection'](_0x597b48[_0x8711('0x2a')],qs[_0x8711('0x2f')](_0xea76d8[_0x8711('0x2b')][_0x8711('0x2f')]));_0x2fb5e8['attributes']=_0x2fb5e8[_0x8711('0x2e')][_0x8711('0x30')]?_0x2fb5e8[_0x8711('0x2e')]:_0x597b48[_0x8711('0x2a')];if(_0xea76d8[_0x8711('0x2b')]['includeAll']){_0x2fb5e8['include']=[{'all':!![]}];}_0x2fb5e8=_[_0x8711('0x38')]({},_0x2fb5e8,_0xea76d8[_0x8711('0x42')]);return db['AnalyticFieldReport'][_0x8711('0x43')](_0x2fb5e8)[_0x8711('0x21')](handleEntityNotFound(_0x45ad44,null))[_0x8711('0x21')](respondWithResult(_0x45ad44,null))[_0x8711('0x3e')](handleError(_0x45ad44,null));};exports['create']=function(_0x34ef5a,_0x464d7c){return db[_0x8711('0x26')]['create'](_0x34ef5a[_0x8711('0x44')],{})[_0x8711('0x21')](respondWithResult(_0x464d7c,0xc9))['catch'](handleError(_0x464d7c,null));};exports[_0x8711('0x45')]=function(_0x14a815,_0x4abc1c){return db[_0x8711('0x26')][_0x8711('0x45')](_0x14a815['body'],{'raw':![],'individualHooks':!![]})[_0x8711('0x21')](respondWithResult(_0x4abc1c,0xc9))[_0x8711('0x3e')](handleError(_0x4abc1c,null));};exports[_0x8711('0x20')]=function(_0x17a3f5,_0x52be53){if(_0x17a3f5[_0x8711('0x44')]['id']){delete _0x17a3f5[_0x8711('0x44')]['id'];}return db['AnalyticFieldReport'][_0x8711('0x43')]({'where':{'id':_0x17a3f5[_0x8711('0x40')]['id']}})['then'](handleEntityNotFound(_0x52be53,null))['then'](saveUpdates(_0x17a3f5['body'],null))['then'](respondWithResult(_0x52be53,null))[_0x8711('0x3e')](handleError(_0x52be53,null));};exports[_0x8711('0x46')]=function(_0x1c83f7,_0x1cde16){return db[_0x8711('0x26')][_0x8711('0x43')]({'where':{'id':_0x1c83f7[_0x8711('0x40')]['id']}})['then'](handleEntityNotFound(_0x1cde16,null))['then'](removeEntity(_0x1cde16,null))['catch'](handleError(_0x1cde16,null));};exports[_0x8711('0x47')]=function(_0x867599,_0x1bbef4){return db[_0x8711('0x26')][_0x8711('0x46')]({'where':{'id':_0x867599[_0x8711('0x2b')]['ids']||[]},'raw':![],'individualHooks':!![]})[_0x8711('0x21')](respondWithResult(_0x1bbef4,0xcc))[_0x8711('0x3e')](handleError(_0x1bbef4,null));};exports[_0x8711('0x48')]=function(_0x48fb45,_0xfeb0aa,_0x21c194){return db[_0x8711('0x49')][_0x8711('0x4a')]({'where':{'id':_0x48fb45[_0x8711('0x40')]['id']}})[_0x8711('0x21')](handleEntityNotFound(_0xfeb0aa,null))[_0x8711('0x21')](function(_0x171f3f){if(_0x171f3f){return db['sequelize'][_0x8711('0x4b')](function(_0x55d8b7){return db[_0x8711('0x26')]['destroy']({'where':{'CustomReportId':_0x48fb45['params']['id']},'transaction':_0x55d8b7})['then'](function(_0x40cecd){var _0x1ee501=_['map'](_0x48fb45[_0x8711('0x44')],function(_0x4c3eb6){delete _0x4c3eb6['id'];_0x4c3eb6[_0x8711('0x4c')]=_0x48fb45[_0x8711('0x40')]['id'];return _0x4c3eb6;});return db['AnalyticFieldReport'][_0x8711('0x45')](_0x1ee501,{'transaction':_0x55d8b7});});})['then'](function(){return db[_0x8711('0x26')][_0x8711('0x3c')]({'where':{'CustomReportId':_0x48fb45['params']['id']}});});}})['then'](respondWithResult(_0xfeb0aa,null))[_0x8711('0x3e')](handleError(_0xfeb0aa,null));}; \ No newline at end of file +var _0x39c6=['../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','AnalyticFieldReport','rawAttributes','fieldName','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','type','filter','merge','includeAll','findAll','show','keys','include','options','catch','create','body','bulkCreate','find','params','bulkDestroy','ids','addFields','AnalyticCustomReport','findOne','sequelize','transaction','html-pdf','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','ejs','lodash','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x386306,_0x1363c9){var _0xcb23d=function(_0x1fc525){while(--_0x1fc525){_0x386306['push'](_0x386306['shift']());}};_0xcb23d(++_0x1363c9);}(_0x39c6,0x1c0));var _0x639c=function(_0x102d5f,_0xe26c4b){_0x102d5f=_0x102d5f-0x0;var _0x31a38e=_0x39c6[_0x102d5f];return _0x31a38e;};'use strict';var pdf=require(_0x639c('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x639c('0x1'));var rp=require(_0x639c('0x2'));var moment=require(_0x639c('0x3'));var BPromise=require(_0x639c('0x4'));var Mustache=require(_0x639c('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x639c('0x6'));var ejs=require(_0x639c('0x7'));var fs=require('fs');var _=require(_0x639c('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x639c('0x9'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x639c('0xa'));var qs=require(_0x639c('0xb'));var as=require(_0x639c('0xc'));var hardwareService=require(_0x639c('0xd'));var logger=require(_0x639c('0xe'))(_0x639c('0xf'));var utils=require(_0x639c('0x10'));var config=require(_0x639c('0x11'));var db=require(_0x639c('0x12'))['db'];function respondWithStatusCode(_0x657a18,_0x2013cc){_0x2013cc=_0x2013cc||0xcc;return function(_0x226c45){if(_0x226c45){return _0x657a18[_0x639c('0x13')](_0x2013cc);}return _0x657a18[_0x639c('0x14')](_0x2013cc)[_0x639c('0x15')]();};}function respondWithResult(_0x4ffc1b,_0x312c5a){_0x312c5a=_0x312c5a||0xc8;return function(_0x31bb69){if(_0x31bb69){return _0x4ffc1b[_0x639c('0x14')](_0x312c5a)[_0x639c('0x16')](_0x31bb69);}};}function respondWithFilteredResult(_0x40be32,_0x185115){return function(_0x83fa99){if(_0x83fa99){var _0x1a8d06=_0x83fa99[_0x639c('0x17')],_0x169c13=_0x185115['offset'],_0x10ca89=_0x185115[_0x639c('0x18')]+_0x185115[_0x639c('0x19')],_0x2bb92d;if(_0x10ca89>=_0x1a8d06){_0x10ca89=_0x1a8d06;_0x2bb92d=0xc8;}else{_0x2bb92d=0xce;}_0x40be32[_0x639c('0x14')](_0x2bb92d);return _0x40be32[_0x639c('0x1a')](_0x639c('0x1b'),_0x169c13+'-'+_0x10ca89+'/'+_0x1a8d06)['json'](_0x83fa99);}return null;};}function patchUpdates(_0x4048a5){return function(_0x1ee82f){try{jsonpatch['apply'](_0x1ee82f,_0x4048a5,!![]);}catch(_0xd6308f){return BPromise[_0x639c('0x1c')](_0xd6308f);}return _0x1ee82f[_0x639c('0x1d')]();};}function saveUpdates(_0x2911a7,_0x3645ba){return function(_0x861a81){if(_0x861a81){return _0x861a81[_0x639c('0x1e')](_0x2911a7)[_0x639c('0x1f')](function(_0x162714){return _0x162714;});}return null;};}function removeEntity(_0x55a66f,_0x2e73b8){return function(_0x3354b7){if(_0x3354b7){return _0x3354b7[_0x639c('0x20')]()[_0x639c('0x1f')](function(){_0x55a66f[_0x639c('0x14')](0xcc)[_0x639c('0x15')]();});}};}function handleEntityNotFound(_0xf6c6f2,_0x4561e3){return function(_0x2fe338){if(!_0x2fe338){_0xf6c6f2[_0x639c('0x13')](0x194);}return _0x2fe338;};}function handleError(_0x6da1fd,_0x3b9dae){_0x3b9dae=_0x3b9dae||0x1f4;return function(_0x794c1a){logger[_0x639c('0x21')](_0x794c1a[_0x639c('0x22')]);if(_0x794c1a[_0x639c('0x23')]){delete _0x794c1a['name'];}_0x6da1fd[_0x639c('0x14')](_0x3b9dae)[_0x639c('0x24')](_0x794c1a);};}exports['index']=function(_0x4b99ce,_0x39f200){var _0xd64008={},_0x3b1666={},_0x46b66d={'count':0x0,'rows':[]};var _0x361bea=_['map'](db[_0x639c('0x25')][_0x639c('0x26')],function(_0x300e7b){return{'name':_0x300e7b[_0x639c('0x27')],'type':_0x300e7b['type'][_0x639c('0x28')]};});_0x3b1666[_0x639c('0x29')]=_[_0x639c('0x2a')](_0x361bea,_0x639c('0x23'));_0x3b1666[_0x639c('0x2b')]=_['keys'](_0x4b99ce[_0x639c('0x2b')]);_0x3b1666[_0x639c('0x2c')]=_[_0x639c('0x2d')](_0x3b1666[_0x639c('0x29')],_0x3b1666[_0x639c('0x2b')]);_0xd64008[_0x639c('0x2e')]=_[_0x639c('0x2d')](_0x3b1666[_0x639c('0x29')],qs[_0x639c('0x2f')](_0x4b99ce[_0x639c('0x2b')]['fields']));_0xd64008['attributes']=_0xd64008['attributes'][_0x639c('0x30')]?_0xd64008[_0x639c('0x2e')]:_0x3b1666[_0x639c('0x29')];if(!_0x4b99ce['query'][_0x639c('0x31')](_0x639c('0x32'))){_0xd64008[_0x639c('0x19')]=qs[_0x639c('0x19')](_0x4b99ce[_0x639c('0x2b')][_0x639c('0x19')]);_0xd64008[_0x639c('0x18')]=qs[_0x639c('0x18')](_0x4b99ce[_0x639c('0x2b')][_0x639c('0x18')]);}_0xd64008[_0x639c('0x33')]=qs[_0x639c('0x34')](_0x4b99ce[_0x639c('0x2b')]['sort']);_0xd64008[_0x639c('0x35')]=qs[_0x639c('0x2c')](_[_0x639c('0x36')](_0x4b99ce[_0x639c('0x2b')],_0x3b1666[_0x639c('0x2c')]),_0x361bea);if(_0x4b99ce[_0x639c('0x2b')]['filter']){_0xd64008[_0x639c('0x35')]=_['merge'](_0xd64008[_0x639c('0x35')],{'$or':_['map'](_0x361bea,function(_0x2b92a3){if(_0x2b92a3[_0x639c('0x37')]!=='VIRTUAL'){var _0x10ca72={};_0x10ca72[_0x2b92a3[_0x639c('0x23')]]={'$like':'%'+_0x4b99ce[_0x639c('0x2b')][_0x639c('0x38')]+'%'};return _0x10ca72;}})});}_0xd64008=_[_0x639c('0x39')]({},_0xd64008,_0x4b99ce['options']);var _0x501203={'where':_0xd64008['where']};return db[_0x639c('0x25')][_0x639c('0x17')](_0x501203)[_0x639c('0x1f')](function(_0x3b85d1){_0x46b66d[_0x639c('0x17')]=_0x3b85d1;if(_0x4b99ce[_0x639c('0x2b')][_0x639c('0x3a')]){_0xd64008['include']=[{'all':!![]}];}return db[_0x639c('0x25')][_0x639c('0x3b')](_0xd64008);})[_0x639c('0x1f')](function(_0x13727d){_0x46b66d['rows']=_0x13727d;return _0x46b66d;})['then'](respondWithFilteredResult(_0x39f200,_0xd64008))['catch'](handleError(_0x39f200,null));};exports[_0x639c('0x3c')]=function(_0x464a21,_0x13dac0){var _0x99b51b={'raw':![],'where':{'id':_0x464a21['params']['id']}},_0x1506e4={};_0x1506e4[_0x639c('0x29')]=_[_0x639c('0x3d')](db[_0x639c('0x25')][_0x639c('0x26')]);_0x1506e4['query']=_['keys'](_0x464a21['query']);_0x1506e4[_0x639c('0x2c')]=_[_0x639c('0x2d')](_0x1506e4[_0x639c('0x29')],_0x1506e4[_0x639c('0x2b')]);_0x99b51b[_0x639c('0x2e')]=_[_0x639c('0x2d')](_0x1506e4[_0x639c('0x29')],qs['fields'](_0x464a21[_0x639c('0x2b')][_0x639c('0x2f')]));_0x99b51b[_0x639c('0x2e')]=_0x99b51b[_0x639c('0x2e')][_0x639c('0x30')]?_0x99b51b['attributes']:_0x1506e4[_0x639c('0x29')];if(_0x464a21[_0x639c('0x2b')][_0x639c('0x3a')]){_0x99b51b[_0x639c('0x3e')]=[{'all':!![]}];}_0x99b51b=_['merge']({},_0x99b51b,_0x464a21[_0x639c('0x3f')]);return db['AnalyticFieldReport']['find'](_0x99b51b)[_0x639c('0x1f')](handleEntityNotFound(_0x13dac0,null))[_0x639c('0x1f')](respondWithResult(_0x13dac0,null))[_0x639c('0x40')](handleError(_0x13dac0,null));};exports[_0x639c('0x41')]=function(_0x505147,_0x2bf052){return db[_0x639c('0x25')]['create'](_0x505147[_0x639c('0x42')],{})[_0x639c('0x1f')](respondWithResult(_0x2bf052,0xc9))[_0x639c('0x40')](handleError(_0x2bf052,null));};exports[_0x639c('0x43')]=function(_0xa4eaa,_0x39ff74){return db[_0x639c('0x25')][_0x639c('0x43')](_0xa4eaa[_0x639c('0x42')],{'raw':![],'individualHooks':!![]})[_0x639c('0x1f')](respondWithResult(_0x39ff74,0xc9))[_0x639c('0x40')](handleError(_0x39ff74,null));};exports['update']=function(_0x3e0c21,_0x16e1cc){if(_0x3e0c21[_0x639c('0x42')]['id']){delete _0x3e0c21['body']['id'];}return db[_0x639c('0x25')][_0x639c('0x44')]({'where':{'id':_0x3e0c21[_0x639c('0x45')]['id']}})[_0x639c('0x1f')](handleEntityNotFound(_0x16e1cc,null))[_0x639c('0x1f')](saveUpdates(_0x3e0c21[_0x639c('0x42')],null))[_0x639c('0x1f')](respondWithResult(_0x16e1cc,null))[_0x639c('0x40')](handleError(_0x16e1cc,null));};exports[_0x639c('0x20')]=function(_0x532905,_0x24aee){return db[_0x639c('0x25')]['find']({'where':{'id':_0x532905[_0x639c('0x45')]['id']}})['then'](handleEntityNotFound(_0x24aee,null))[_0x639c('0x1f')](removeEntity(_0x24aee,null))[_0x639c('0x40')](handleError(_0x24aee,null));};exports[_0x639c('0x46')]=function(_0x20b967,_0x31c3ed){return db[_0x639c('0x25')][_0x639c('0x20')]({'where':{'id':_0x20b967[_0x639c('0x2b')][_0x639c('0x47')]||[]},'raw':![],'individualHooks':!![]})[_0x639c('0x1f')](respondWithResult(_0x31c3ed,0xcc))[_0x639c('0x40')](handleError(_0x31c3ed,null));};exports[_0x639c('0x48')]=function(_0x5a4b6b,_0x32e08b,_0x5e6f2d){return db[_0x639c('0x49')][_0x639c('0x4a')]({'where':{'id':_0x5a4b6b[_0x639c('0x45')]['id']}})[_0x639c('0x1f')](handleEntityNotFound(_0x32e08b,null))[_0x639c('0x1f')](function(_0x3548ed){if(_0x3548ed){return db[_0x639c('0x4b')][_0x639c('0x4c')](function(_0x143420){return db[_0x639c('0x25')][_0x639c('0x20')]({'where':{'CustomReportId':_0x5a4b6b[_0x639c('0x45')]['id']},'transaction':_0x143420})['then'](function(_0x31260a){var _0x3ecdab=_[_0x639c('0x2a')](_0x5a4b6b[_0x639c('0x42')],function(_0x2ce06c){delete _0x2ce06c['id'];_0x2ce06c['CustomReportId']=_0x5a4b6b[_0x639c('0x45')]['id'];return _0x2ce06c;});return db['AnalyticFieldReport'][_0x639c('0x43')](_0x3ecdab,{'transaction':_0x143420});});})[_0x639c('0x1f')](function(){return db[_0x639c('0x25')][_0x639c('0x3b')]({'where':{'CustomReportId':_0x5a4b6b[_0x639c('0x45')]['id']}});});}})[_0x639c('0x1f')](respondWithResult(_0x32e08b,null))['catch'](handleError(_0x32e08b,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index d32e01e..5639ee6 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 _0x0b17=['request-promise','path','exports','define','lodash','../../config/logger','api','bluebird'];(function(_0xc022f7,_0x8f8108){var _0x2c7f3b=function(_0x281dee){while(--_0x281dee){_0xc022f7['push'](_0xc022f7['shift']());}};_0x2c7f3b(++_0x8f8108);}(_0x0b17,0x1a4));var _0x70b1=function(_0x213c63,_0x420de6){_0x213c63=_0x213c63-0x0;var _0x300bfb=_0x0b17[_0x213c63];return _0x300bfb;};'use strict';var _=require(_0x70b1('0x0'));var util=require('util');var logger=require(_0x70b1('0x1'))(_0x70b1('0x2'));var moment=require('moment');var BPromise=require(_0x70b1('0x3'));var rp=require(_0x70b1('0x4'));var fs=require('fs');var path=require(_0x70b1('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./analyticFieldReport.attributes');module[_0x70b1('0x6')]=function(_0x24866c,_0x1e5dee){return _0x24866c[_0x70b1('0x7')]('AnalyticFieldReport',attributes,{'tableName':'analytics_report_fields','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x33ba=['exports','define','AnalyticFieldReport','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./analyticFieldReport.attributes'];(function(_0x3ab89e,_0xc87bf4){var _0x5589a7=function(_0x40dce4){while(--_0x40dce4){_0x3ab89e['push'](_0x3ab89e['shift']());}};_0x5589a7(++_0xc87bf4);}(_0x33ba,0x6f));var _0xa33b=function(_0x72b60f,_0x44e81d){_0x72b60f=_0x72b60f-0x0;var _0x17656a=_0x33ba[_0x72b60f];return _0x17656a;};'use strict';var _=require(_0xa33b('0x0'));var util=require(_0xa33b('0x1'));var logger=require(_0xa33b('0x2'))('api');var moment=require('moment');var BPromise=require(_0xa33b('0x3'));var rp=require(_0xa33b('0x4'));var fs=require('fs');var path=require(_0xa33b('0x5'));var rimraf=require(_0xa33b('0x6'));var config=require(_0xa33b('0x7'));var attributes=require(_0xa33b('0x8'));module[_0xa33b('0x9')]=function(_0x4fd76b,_0x1980f0){return _0x4fd76b[_0xa33b('0xa')](_0xa33b('0xb'),attributes,{'tableName':'analytics_report_fields','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 9decc49..e9161b8 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 _0x21f5=['debug','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','http','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent'];(function(_0x5853b5,_0x26df51){var _0x6be2e7=function(_0x888f53){while(--_0x888f53){_0x5853b5['push'](_0x5853b5['shift']());}};_0x6be2e7(++_0x26df51);}(_0x21f5,0x11e));var _0x521f=function(_0xf485e0,_0x476be7){_0xf485e0=_0xf485e0-0x0;var _0x2c316d=_0x21f5[_0xf485e0];return _0x2c316d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x521f('0x0'));var BPromise=require(_0x521f('0x1'));var rs=require(_0x521f('0x2'));var fs=require('fs');var Redis=require(_0x521f('0x3'));var db=require(_0x521f('0x4'))['db'];var utils=require(_0x521f('0x5'));var logger=require('../../config/logger')(_0x521f('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x521f('0x7')][_0x521f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1aa8e7,_0x41280b,_0x2acfc2){return new BPromise(function(_0x649718,_0x335840){return client[_0x521f('0x9')](_0x1aa8e7,_0x2acfc2)[_0x521f('0xa')](function(_0x5da38c){logger[_0x521f('0xb')](_0x521f('0xc'),_0x41280b,_0x521f('0xd'));logger[_0x521f('0xe')]('AnalyticFieldReport,\x20%s,\x20%s,\x20%s',_0x41280b,_0x521f('0xd'),JSON['stringify'](_0x5da38c));if(_0x5da38c[_0x521f('0xf')]){if(_0x5da38c[_0x521f('0xf')][_0x521f('0x10')]===0x1f4){logger['error'](_0x521f('0xc'),_0x41280b,_0x5da38c[_0x521f('0xf')][_0x521f('0x11')]);return _0x335840(_0x5da38c[_0x521f('0xf')][_0x521f('0x11')]);}logger[_0x521f('0xf')](_0x521f('0xc'),_0x41280b,_0x5da38c[_0x521f('0xf')][_0x521f('0x11')]);return _0x649718(_0x5da38c['error'][_0x521f('0x11')]);}else{logger[_0x521f('0xb')](_0x521f('0xc'),_0x41280b,_0x521f('0xd'));_0x649718(_0x5da38c[_0x521f('0x12')][_0x521f('0x11')]);}})[_0x521f('0x13')](function(_0x2cf6e3){logger[_0x521f('0xf')]('AnalyticFieldReport,\x20%s,\x20%s',_0x41280b,_0x2cf6e3);_0x335840(_0x2cf6e3);});});} \ No newline at end of file +var _0x62ea=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x674246,_0x25383e){var _0x4981dd=function(_0xd02187){while(--_0xd02187){_0x674246['push'](_0x674246['shift']());}};_0x4981dd(++_0x25383e);}(_0x62ea,0xc9));var _0xa62e=function(_0x6470a2,_0x3b5f44){_0x6470a2=_0x6470a2-0x0;var _0x24ac61=_0x62ea[_0x6470a2];return _0x24ac61;};'use strict';var _=require(_0xa62e('0x0'));var util=require(_0xa62e('0x1'));var moment=require(_0xa62e('0x2'));var BPromise=require(_0xa62e('0x3'));var rs=require(_0xa62e('0x4'));var fs=require('fs');var Redis=require(_0xa62e('0x5'));var db=require(_0xa62e('0x6'))['db'];var utils=require(_0xa62e('0x7'));var logger=require(_0xa62e('0x8'))(_0xa62e('0x9'));var config=require(_0xa62e('0xa'));var jayson=require(_0xa62e('0xb'));var client=jayson[_0xa62e('0xc')][_0xa62e('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x4ce134,_0x9d39a8,_0x25db86){return new BPromise(function(_0x1b1cd0,_0x5e87d8){return client[_0xa62e('0xe')](_0x4ce134,_0x25db86)[_0xa62e('0xf')](function(_0x4d4455){logger[_0xa62e('0x10')](_0xa62e('0x11'),_0x9d39a8,_0xa62e('0x12'));logger[_0xa62e('0x13')]('AnalyticFieldReport,\x20%s,\x20%s,\x20%s',_0x9d39a8,_0xa62e('0x12'),JSON[_0xa62e('0x14')](_0x4d4455));if(_0x4d4455[_0xa62e('0x15')]){if(_0x4d4455[_0xa62e('0x15')][_0xa62e('0x16')]===0x1f4){logger[_0xa62e('0x15')](_0xa62e('0x11'),_0x9d39a8,_0x4d4455[_0xa62e('0x15')]['message']);return _0x5e87d8(_0x4d4455[_0xa62e('0x15')][_0xa62e('0x17')]);}logger['error']('AnalyticFieldReport,\x20%s,\x20%s',_0x9d39a8,_0x4d4455[_0xa62e('0x15')][_0xa62e('0x17')]);return _0x1b1cd0(_0x4d4455[_0xa62e('0x15')][_0xa62e('0x17')]);}else{logger['info'](_0xa62e('0x11'),_0x9d39a8,_0xa62e('0x12'));_0x1b1cd0(_0x4d4455[_0xa62e('0x18')][_0xa62e('0x17')]);}})[_0xa62e('0x19')](function(_0x5eba44){logger[_0xa62e('0x15')](_0xa62e('0x11'),_0x9d39a8,_0x5eba44);_0x5e87d8(_0x5eba44);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 4331c1a..14b635b 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 _0xe14b=['addFields','update','delete','/destroy_many','bulkDestroy','destroy','exports','multer','util','express','Router','../../components/interaction/service','get','isAuthenticated','index','/:id','show','post','/create_many','bulkCreate'];(function(_0x193fc6,_0x5e0f10){var _0x81628f=function(_0x440b2f){while(--_0x440b2f){_0x193fc6['push'](_0x193fc6['shift']());}};_0x81628f(++_0x5e0f10);}(_0xe14b,0x93));var _0xbe14=function(_0x210519,_0x473cba){_0x210519=_0x210519-0x0;var _0x3d6496=_0xe14b[_0x210519];return _0x3d6496;};'use strict';var multer=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbe14('0x2'));var router=express[_0xbe14('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xbe14('0x4'));var config=require('../../config/environment');var controller=require('./analyticFieldReport.controller');router[_0xbe14('0x5')]('/',auth[_0xbe14('0x6')](),controller[_0xbe14('0x7')]);router[_0xbe14('0x5')](_0xbe14('0x8'),auth[_0xbe14('0x6')](),controller[_0xbe14('0x9')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xbe14('0xa')](_0xbe14('0xb'),auth[_0xbe14('0x6')](),controller[_0xbe14('0xc')]);router['post']('/:id/create_many',auth[_0xbe14('0x6')](),controller[_0xbe14('0xd')]);router['put'](_0xbe14('0x8'),auth[_0xbe14('0x6')](),controller[_0xbe14('0xe')]);router[_0xbe14('0xf')](_0xbe14('0x10'),auth[_0xbe14('0x6')](),controller[_0xbe14('0x11')]);router[_0xbe14('0xf')](_0xbe14('0x8'),auth[_0xbe14('0x6')](),controller[_0xbe14('0x12')]);module[_0xbe14('0x13')]=router; \ No newline at end of file +var _0x814b=['../../config/environment','./analyticFieldReport.controller','get','isAuthenticated','index','/:id','post','create','/create_many','bulkCreate','/:id/create_many','addFields','update','delete','/destroy_many','bulkDestroy','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service'];(function(_0x3b01d5,_0xb0742b){var _0x329c0a=function(_0x22ec51){while(--_0x22ec51){_0x3b01d5['push'](_0x3b01d5['shift']());}};_0x329c0a(++_0xb0742b);}(_0x814b,0x1a2));var _0xb814=function(_0x5b3c61,_0x3eb2aa){_0x5b3c61=_0x5b3c61-0x0;var _0x153389=_0x814b[_0x5b3c61];return _0x153389;};'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['show']);router[_0xb814('0xd')]('/',auth[_0xb814('0xa')](),controller[_0xb814('0xe')]);router[_0xb814('0xd')](_0xb814('0xf'),auth[_0xb814('0xa')](),controller[_0xb814('0x10')]);router[_0xb814('0xd')](_0xb814('0x11'),auth[_0xb814('0xa')](),controller[_0xb814('0x12')]);router['put'](_0xb814('0xc'),auth['isAuthenticated'](),controller[_0xb814('0x13')]);router[_0xb814('0x14')](_0xb814('0x15'),auth[_0xb814('0xa')](),controller[_0xb814('0x16')]);router[_0xb814('0x14')](_0xb814('0xc'),auth[_0xb814('0xa')](),controller[_0xb814('0x17')]);module[_0xb814('0x18')]=router; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.attributes.js b/server/api/analyticMetric/analyticMetric.attributes.js index 4dd00c4..3ae56e9 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 _0x7c47=['sequelize','STRING','name','TEXT'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7c47,0x1b8));var _0x77c4=function(_0x1e27d3,_0x542ea6){_0x1e27d3=_0x1e27d3-0x0;var _0x2645d7=_0x7c47[_0x1e27d3];return _0x2645d7;};'use strict';var Sequelize=require(_0x77c4('0x0'));module['exports']={'name':{'type':Sequelize[_0x77c4('0x1')],'allowNull':![],'unique':_0x77c4('0x2')},'table':{'type':Sequelize[_0x77c4('0x1')]},'metric':{'type':Sequelize[_0x77c4('0x3')]},'description':{'type':Sequelize[_0x77c4('0x1')]}}; \ No newline at end of file +var _0xab26=['STRING','TEXT','sequelize','exports'];(function(_0x118afa,_0x4bf0c1){var _0x167d76=function(_0x2c529b){while(--_0x2c529b){_0x118afa['push'](_0x118afa['shift']());}};_0x167d76(++_0x4bf0c1);}(_0xab26,0xd2));var _0x6ab2=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xab26[_0x4565bf];return _0x5610ba;};'use strict';var Sequelize=require(_0x6ab2('0x0'));module[_0x6ab2('0x1')]={'name':{'type':Sequelize[_0x6ab2('0x2')],'allowNull':![],'unique':'name'},'table':{'type':Sequelize[_0x6ab2('0x2')]},'metric':{'type':Sequelize[_0x6ab2('0x3')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 3156f5f..30043db 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 _0x06ef=['nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','options','AnalyticMetric','findAll','rows','params','includeAll','include','create','body','user','role','UserProfileSection','find','autoAssociation','catch','update','rimraf','bluebird','mustache','util','sox','to-csv','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','count','offset','status','set','Content-Range','apply','then','destroy','get','Metrics','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty'];(function(_0x505dfd,_0x19368d){var _0x312dc5=function(_0x4843a5){while(--_0x4843a5){_0x505dfd['push'](_0x505dfd['shift']());}};_0x312dc5(++_0x19368d);}(_0x06ef,0x185));var _0xf06e=function(_0x2e72c7,_0x3cefda){_0x2e72c7=_0x2e72c7-0x0;var _0x12f876=_0x06ef[_0x2e72c7];return _0x12f876;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xf06e('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf06e('0x1'));var Mustache=require(_0xf06e('0x2'));var util=require(_0xf06e('0x3'));var path=require('path');var sox=require(_0xf06e('0x4'));var csv=require(_0xf06e('0x5'));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(_0xf06e('0x6'));var toCsv=require(_0xf06e('0x5'));var querystring=require(_0xf06e('0x7'));var Papa=require(_0xf06e('0x8'));var Redis=require(_0xf06e('0x9'));var authService=require('../../components/auth/service');var qs=require(_0xf06e('0xa'));var as=require(_0xf06e('0xb'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf06e('0xc'))(_0xf06e('0xd'));var utils=require(_0xf06e('0xe'));var config=require(_0xf06e('0xf'));var db=require(_0xf06e('0x10'))['db'];function respondWithStatusCode(_0x7b4c4,_0x49fe5d){_0x49fe5d=_0x49fe5d||0xcc;return function(_0x3daa50){if(_0x3daa50){return _0x7b4c4[_0xf06e('0x11')](_0x49fe5d);}return _0x7b4c4['status'](_0x49fe5d)[_0xf06e('0x12')]();};}function respondWithResult(_0x17ea4f,_0x59f60b){_0x59f60b=_0x59f60b||0xc8;return function(_0x4e6dd8){if(_0x4e6dd8){return _0x17ea4f['status'](_0x59f60b)[_0xf06e('0x13')](_0x4e6dd8);}};}function respondWithFilteredResult(_0x6a8948,_0x36f38f){return function(_0x55dce1){if(_0x55dce1){var _0x3fdacc=_0x55dce1[_0xf06e('0x14')],_0x375f90=_0x36f38f[_0xf06e('0x15')],_0x3629f3=_0x36f38f[_0xf06e('0x15')]+_0x36f38f['limit'],_0xab4288;if(_0x3629f3>=_0x3fdacc){_0x3629f3=_0x3fdacc;_0xab4288=0xc8;}else{_0xab4288=0xce;}_0x6a8948[_0xf06e('0x16')](_0xab4288);return _0x6a8948[_0xf06e('0x17')](_0xf06e('0x18'),_0x375f90+'-'+_0x3629f3+'/'+_0x3fdacc)[_0xf06e('0x13')](_0x55dce1);}return null;};}function patchUpdates(_0x5c1a80){return function(_0x54c08d){try{jsonpatch[_0xf06e('0x19')](_0x54c08d,_0x5c1a80,!![]);}catch(_0x3fbee3){return BPromise['reject'](_0x3fbee3);}return _0x54c08d['save']();};}function saveUpdates(_0x5fcefb,_0x211590){return function(_0x167ad3){if(_0x167ad3){return _0x167ad3['update'](_0x5fcefb)[_0xf06e('0x1a')](function(_0x3ff738){return _0x3ff738;});}return null;};}function removeEntity(_0x5ecd73,_0x3c3796){return function(_0x1ba130){if(_0x1ba130){return _0x1ba130[_0xf06e('0x1b')]()['then'](function(){var _0x1106d2=_0x1ba130[_0xf06e('0x1c')]({'plain':!![]});var _0x9e06b5=_0xf06e('0x1d');return db[_0xf06e('0x1e')]['destroy']({'where':{'type':_0x9e06b5,'resourceId':_0x1106d2['id']}})[_0xf06e('0x1a')](function(){return _0x1ba130;});})['then'](function(){_0x5ecd73[_0xf06e('0x16')](0xcc)[_0xf06e('0x12')]();});}};}function handleEntityNotFound(_0x8d3493,_0x322f4c){return function(_0x1a7f5e){if(!_0x1a7f5e){_0x8d3493[_0xf06e('0x11')](0x194);}return _0x1a7f5e;};}function handleError(_0x5c09e5,_0xc6dfd){_0xc6dfd=_0xc6dfd||0x1f4;return function(_0x169539){logger[_0xf06e('0x1f')](_0x169539[_0xf06e('0x20')]);if(_0x169539[_0xf06e('0x21')]){delete _0x169539['name'];}_0x5c09e5[_0xf06e('0x16')](_0xc6dfd)[_0xf06e('0x22')](_0x169539);};}exports[_0xf06e('0x23')]=function(_0x89a74f,_0x373709){var _0x25bacb={},_0x4b5185={},_0x17c427={'count':0x0,'rows':[]};var _0x7870d6=_[_0xf06e('0x24')](db['AnalyticMetric'][_0xf06e('0x25')],function(_0x11580e){return{'name':_0x11580e[_0xf06e('0x26')],'type':_0x11580e[_0xf06e('0x27')][_0xf06e('0x28')]};});_0x4b5185[_0xf06e('0x29')]=_[_0xf06e('0x24')](_0x7870d6,_0xf06e('0x21'));_0x4b5185[_0xf06e('0x2a')]=_['keys'](_0x89a74f['query']);_0x4b5185[_0xf06e('0x2b')]=_[_0xf06e('0x2c')](_0x4b5185['model'],_0x4b5185[_0xf06e('0x2a')]);_0x25bacb[_0xf06e('0x2d')]=_[_0xf06e('0x2c')](_0x4b5185[_0xf06e('0x29')],qs[_0xf06e('0x2e')](_0x89a74f[_0xf06e('0x2a')]['fields']));_0x25bacb[_0xf06e('0x2d')]=_0x25bacb[_0xf06e('0x2d')][_0xf06e('0x2f')]?_0x25bacb['attributes']:_0x4b5185[_0xf06e('0x29')];if(!_0x89a74f[_0xf06e('0x2a')][_0xf06e('0x30')](_0xf06e('0x31'))){_0x25bacb[_0xf06e('0x32')]=qs[_0xf06e('0x32')](_0x89a74f[_0xf06e('0x2a')]['limit']);_0x25bacb['offset']=qs[_0xf06e('0x15')](_0x89a74f['query'][_0xf06e('0x15')]);}_0x25bacb['order']=qs[_0xf06e('0x33')](_0x89a74f['query'][_0xf06e('0x33')]);_0x25bacb[_0xf06e('0x34')]=qs[_0xf06e('0x2b')](_[_0xf06e('0x35')](_0x89a74f[_0xf06e('0x2a')],_0x4b5185[_0xf06e('0x2b')]),_0x7870d6);if(_0x89a74f['query'][_0xf06e('0x36')]){_0x25bacb[_0xf06e('0x34')]=_[_0xf06e('0x37')](_0x25bacb[_0xf06e('0x34')],{'$or':_[_0xf06e('0x24')](_0x7870d6,function(_0x2e98e9){if(_0x2e98e9[_0xf06e('0x27')]!==_0xf06e('0x38')){var _0xf8828a={};_0xf8828a[_0x2e98e9[_0xf06e('0x21')]]={'$like':'%'+_0x89a74f[_0xf06e('0x2a')]['filter']+'%'};return _0xf8828a;}})});}_0x25bacb=_[_0xf06e('0x37')]({},_0x25bacb,_0x89a74f[_0xf06e('0x39')]);var _0x2dfbb4={'where':_0x25bacb[_0xf06e('0x34')]};return db[_0xf06e('0x3a')][_0xf06e('0x14')](_0x2dfbb4)[_0xf06e('0x1a')](function(_0x5101cc){_0x17c427[_0xf06e('0x14')]=_0x5101cc;if(_0x89a74f[_0xf06e('0x2a')]['includeAll']){_0x25bacb['include']=[{'all':!![]}];}return db[_0xf06e('0x3a')][_0xf06e('0x3b')](_0x25bacb);})[_0xf06e('0x1a')](function(_0x7fc745){_0x17c427[_0xf06e('0x3c')]=_0x7fc745;return _0x17c427;})[_0xf06e('0x1a')](respondWithFilteredResult(_0x373709,_0x25bacb))['catch'](handleError(_0x373709,null));};exports['show']=function(_0x14fe45,_0x563225){var _0x548186={'raw':!![],'where':{'id':_0x14fe45[_0xf06e('0x3d')]['id']}},_0x494974={};_0x494974[_0xf06e('0x29')]=_['keys'](db['AnalyticMetric'][_0xf06e('0x25')]);_0x494974[_0xf06e('0x2a')]=_['keys'](_0x14fe45[_0xf06e('0x2a')]);_0x494974['filters']=_[_0xf06e('0x2c')](_0x494974[_0xf06e('0x29')],_0x494974[_0xf06e('0x2a')]);_0x548186[_0xf06e('0x2d')]=_['intersection'](_0x494974[_0xf06e('0x29')],qs[_0xf06e('0x2e')](_0x14fe45['query'][_0xf06e('0x2e')]));_0x548186[_0xf06e('0x2d')]=_0x548186[_0xf06e('0x2d')][_0xf06e('0x2f')]?_0x548186[_0xf06e('0x2d')]:_0x494974[_0xf06e('0x29')];if(_0x14fe45[_0xf06e('0x2a')][_0xf06e('0x3e')]){_0x548186[_0xf06e('0x3f')]=[{'all':!![]}];}_0x548186=_[_0xf06e('0x37')]({},_0x548186,_0x14fe45[_0xf06e('0x39')]);return db['AnalyticMetric']['find'](_0x548186)[_0xf06e('0x1a')](handleEntityNotFound(_0x563225,null))['then'](respondWithResult(_0x563225,null))['catch'](handleError(_0x563225,null));};exports[_0xf06e('0x40')]=function(_0x3e403e,_0x324aaf){return db[_0xf06e('0x3a')][_0xf06e('0x40')](_0x3e403e[_0xf06e('0x41')],{})[_0xf06e('0x1a')](function(_0x252629){var _0x4f7ce2=_0x3e403e[_0xf06e('0x42')][_0xf06e('0x1c')]({'plain':!![]});if(!_0x4f7ce2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4f7ce2[_0xf06e('0x43')]===_0xf06e('0x42')){var _0x44030c=_0x252629['get']({'plain':!![]});var _0x544319=_0xf06e('0x1d');return db[_0xf06e('0x44')][_0xf06e('0x45')]({'where':{'name':_0x544319,'userProfileId':_0x4f7ce2['userProfileId']},'raw':!![]})[_0xf06e('0x1a')](function(_0x338d1c){if(_0x338d1c&&_0x338d1c[_0xf06e('0x46')]===0x0){return db[_0xf06e('0x1e')]['create']({'name':_0x44030c['name'],'resourceId':_0x44030c['id'],'type':_0x338d1c[_0xf06e('0x21')],'sectionId':_0x338d1c['id']},{})['then'](function(){return _0x252629;});}else{return _0x252629;}})['catch'](function(_0x3b6d4b){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3b6d4b);throw _0x3b6d4b;});}return _0x252629;})[_0xf06e('0x1a')](respondWithResult(_0x324aaf,0xc9))[_0xf06e('0x47')](handleError(_0x324aaf,null));};exports[_0xf06e('0x48')]=function(_0x319dcc,_0x4aca1){if(_0x319dcc[_0xf06e('0x41')]['id']){delete _0x319dcc[_0xf06e('0x41')]['id'];}return db['AnalyticMetric'][_0xf06e('0x45')]({'where':{'id':_0x319dcc['params']['id']}})[_0xf06e('0x1a')](handleEntityNotFound(_0x4aca1,null))['then'](saveUpdates(_0x319dcc[_0xf06e('0x41')],null))[_0xf06e('0x1a')](respondWithResult(_0x4aca1,null))[_0xf06e('0x47')](handleError(_0x4aca1,null));};exports[_0xf06e('0x1b')]=function(_0x321354,_0x437764){return db['AnalyticMetric'][_0xf06e('0x45')]({'where':{'id':_0x321354[_0xf06e('0x3d')]['id']}})['then'](handleEntityNotFound(_0x437764,null))['then'](removeEntity(_0x437764,null))['catch'](handleError(_0x437764,null));}; \ No newline at end of file +var _0xe493=['destroy','end','error','stack','name','map','AnalyticMetric','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Metrics','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','json','count','offset','limit','set','save','update','then','get'];(function(_0x13dac1,_0x5f069a){var _0x2e4992=function(_0x44bcbd){while(--_0x44bcbd){_0x13dac1['push'](_0x13dac1['shift']());}};_0x2e4992(++_0x5f069a);}(_0xe493,0x7e));var _0x3e49=function(_0x1c4d46,_0x1a0e73){_0x1c4d46=_0x1c4d46-0x0;var _0x6166f1=_0xe493[_0x1c4d46];return _0x6166f1;};'use strict';var pdf=require(_0x3e49('0x0'));var emlformat=require(_0x3e49('0x1'));var rimraf=require(_0x3e49('0x2'));var zipdir=require(_0x3e49('0x3'));var jsonpatch=require(_0x3e49('0x4'));var rp=require('request-promise');var moment=require(_0x3e49('0x5'));var BPromise=require(_0x3e49('0x6'));var Mustache=require('mustache');var util=require(_0x3e49('0x7'));var path=require('path');var sox=require(_0x3e49('0x8'));var csv=require(_0x3e49('0x9'));var ejs=require(_0x3e49('0xa'));var fs=require('fs');var _=require(_0x3e49('0xb'));var squel=require(_0x3e49('0xc'));var crypto=require(_0x3e49('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3e49('0xe'));var Papa=require(_0x3e49('0xf'));var Redis=require(_0x3e49('0x10'));var authService=require(_0x3e49('0x11'));var qs=require(_0x3e49('0x12'));var as=require(_0x3e49('0x13'));var hardwareService=require(_0x3e49('0x14'));var logger=require(_0x3e49('0x15'))(_0x3e49('0x16'));var utils=require(_0x3e49('0x17'));var config=require(_0x3e49('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x50f523,_0x3c9410){_0x3c9410=_0x3c9410||0xcc;return function(_0x56114b){if(_0x56114b){return _0x50f523[_0x3e49('0x19')](_0x3c9410);}return _0x50f523[_0x3e49('0x1a')](_0x3c9410)['end']();};}function respondWithResult(_0x127335,_0x40504b){_0x40504b=_0x40504b||0xc8;return function(_0x54463c){if(_0x54463c){return _0x127335[_0x3e49('0x1a')](_0x40504b)[_0x3e49('0x1b')](_0x54463c);}};}function respondWithFilteredResult(_0x19cf9c,_0x238d1b){return function(_0x401e84){if(_0x401e84){var _0x3a9685=_0x401e84[_0x3e49('0x1c')],_0x46d813=_0x238d1b[_0x3e49('0x1d')],_0x469365=_0x238d1b[_0x3e49('0x1d')]+_0x238d1b[_0x3e49('0x1e')],_0x2b1f13;if(_0x469365>=_0x3a9685){_0x469365=_0x3a9685;_0x2b1f13=0xc8;}else{_0x2b1f13=0xce;}_0x19cf9c[_0x3e49('0x1a')](_0x2b1f13);return _0x19cf9c[_0x3e49('0x1f')]('Content-Range',_0x46d813+'-'+_0x469365+'/'+_0x3a9685)[_0x3e49('0x1b')](_0x401e84);}return null;};}function patchUpdates(_0x59bde3){return function(_0x2e160c){try{jsonpatch['apply'](_0x2e160c,_0x59bde3,!![]);}catch(_0x36f844){return BPromise['reject'](_0x36f844);}return _0x2e160c[_0x3e49('0x20')]();};}function saveUpdates(_0x1c51f7,_0x420d7b){return function(_0x5a4e67){if(_0x5a4e67){return _0x5a4e67[_0x3e49('0x21')](_0x1c51f7)['then'](function(_0xace209){return _0xace209;});}return null;};}function removeEntity(_0xa5b12b,_0x323be5){return function(_0x5e0f1d){if(_0x5e0f1d){return _0x5e0f1d['destroy']()[_0x3e49('0x22')](function(){var _0x5083d1=_0x5e0f1d[_0x3e49('0x23')]({'plain':!![]});var _0x1b338b='Metrics';return db['UserProfileResource'][_0x3e49('0x24')]({'where':{'type':_0x1b338b,'resourceId':_0x5083d1['id']}})['then'](function(){return _0x5e0f1d;});})[_0x3e49('0x22')](function(){_0xa5b12b[_0x3e49('0x1a')](0xcc)[_0x3e49('0x25')]();});}};}function handleEntityNotFound(_0x38cbe0,_0x538547){return function(_0xb4a615){if(!_0xb4a615){_0x38cbe0[_0x3e49('0x19')](0x194);}return _0xb4a615;};}function handleError(_0xd573d7,_0x1710e8){_0x1710e8=_0x1710e8||0x1f4;return function(_0x4665b4){logger[_0x3e49('0x26')](_0x4665b4[_0x3e49('0x27')]);if(_0x4665b4[_0x3e49('0x28')]){delete _0x4665b4[_0x3e49('0x28')];}_0xd573d7['status'](_0x1710e8)['send'](_0x4665b4);};}exports['index']=function(_0x1d6680,_0x366c78){var _0x486057={},_0x839880={},_0x4bddb7={'count':0x0,'rows':[]};var _0x1c7633=_[_0x3e49('0x29')](db[_0x3e49('0x2a')][_0x3e49('0x2b')],function(_0x4b4602){return{'name':_0x4b4602[_0x3e49('0x2c')],'type':_0x4b4602['type']['key']};});_0x839880[_0x3e49('0x2d')]=_[_0x3e49('0x29')](_0x1c7633,_0x3e49('0x28'));_0x839880[_0x3e49('0x2e')]=_[_0x3e49('0x2f')](_0x1d6680[_0x3e49('0x2e')]);_0x839880[_0x3e49('0x30')]=_[_0x3e49('0x31')](_0x839880['model'],_0x839880[_0x3e49('0x2e')]);_0x486057[_0x3e49('0x32')]=_[_0x3e49('0x31')](_0x839880[_0x3e49('0x2d')],qs[_0x3e49('0x33')](_0x1d6680[_0x3e49('0x2e')][_0x3e49('0x33')]));_0x486057[_0x3e49('0x32')]=_0x486057[_0x3e49('0x32')][_0x3e49('0x34')]?_0x486057['attributes']:_0x839880[_0x3e49('0x2d')];if(!_0x1d6680[_0x3e49('0x2e')][_0x3e49('0x35')](_0x3e49('0x36'))){_0x486057[_0x3e49('0x1e')]=qs[_0x3e49('0x1e')](_0x1d6680[_0x3e49('0x2e')][_0x3e49('0x1e')]);_0x486057[_0x3e49('0x1d')]=qs[_0x3e49('0x1d')](_0x1d6680['query']['offset']);}_0x486057[_0x3e49('0x37')]=qs[_0x3e49('0x38')](_0x1d6680[_0x3e49('0x2e')][_0x3e49('0x38')]);_0x486057[_0x3e49('0x39')]=qs[_0x3e49('0x30')](_[_0x3e49('0x3a')](_0x1d6680[_0x3e49('0x2e')],_0x839880[_0x3e49('0x30')]),_0x1c7633);if(_0x1d6680['query']['filter']){_0x486057['where']=_[_0x3e49('0x3b')](_0x486057[_0x3e49('0x39')],{'$or':_[_0x3e49('0x29')](_0x1c7633,function(_0x3f42c7){if(_0x3f42c7['type']!==_0x3e49('0x3c')){var _0x58c541={};_0x58c541[_0x3f42c7['name']]={'$like':'%'+_0x1d6680[_0x3e49('0x2e')][_0x3e49('0x3d')]+'%'};return _0x58c541;}})});}_0x486057=_[_0x3e49('0x3b')]({},_0x486057,_0x1d6680[_0x3e49('0x3e')]);var _0x3ff72b={'where':_0x486057[_0x3e49('0x39')]};return db[_0x3e49('0x2a')][_0x3e49('0x1c')](_0x3ff72b)['then'](function(_0x58e1d0){_0x4bddb7[_0x3e49('0x1c')]=_0x58e1d0;if(_0x1d6680[_0x3e49('0x2e')][_0x3e49('0x3f')]){_0x486057['include']=[{'all':!![]}];}return db['AnalyticMetric'][_0x3e49('0x40')](_0x486057);})[_0x3e49('0x22')](function(_0x221c5f){_0x4bddb7[_0x3e49('0x41')]=_0x221c5f;return _0x4bddb7;})[_0x3e49('0x22')](respondWithFilteredResult(_0x366c78,_0x486057))[_0x3e49('0x42')](handleError(_0x366c78,null));};exports[_0x3e49('0x43')]=function(_0x2691cc,_0x38aee2){var _0x25ef29={'raw':!![],'where':{'id':_0x2691cc[_0x3e49('0x44')]['id']}},_0x22b2f6={};_0x22b2f6[_0x3e49('0x2d')]=_[_0x3e49('0x2f')](db[_0x3e49('0x2a')]['rawAttributes']);_0x22b2f6['query']=_[_0x3e49('0x2f')](_0x2691cc[_0x3e49('0x2e')]);_0x22b2f6[_0x3e49('0x30')]=_[_0x3e49('0x31')](_0x22b2f6[_0x3e49('0x2d')],_0x22b2f6['query']);_0x25ef29['attributes']=_['intersection'](_0x22b2f6['model'],qs[_0x3e49('0x33')](_0x2691cc['query'][_0x3e49('0x33')]));_0x25ef29['attributes']=_0x25ef29[_0x3e49('0x32')][_0x3e49('0x34')]?_0x25ef29[_0x3e49('0x32')]:_0x22b2f6[_0x3e49('0x2d')];if(_0x2691cc[_0x3e49('0x2e')][_0x3e49('0x3f')]){_0x25ef29[_0x3e49('0x45')]=[{'all':!![]}];}_0x25ef29=_['merge']({},_0x25ef29,_0x2691cc[_0x3e49('0x3e')]);return db[_0x3e49('0x2a')][_0x3e49('0x46')](_0x25ef29)[_0x3e49('0x22')](handleEntityNotFound(_0x38aee2,null))[_0x3e49('0x22')](respondWithResult(_0x38aee2,null))['catch'](handleError(_0x38aee2,null));};exports[_0x3e49('0x47')]=function(_0xd6b48d,_0x5b600d){return db[_0x3e49('0x2a')][_0x3e49('0x47')](_0xd6b48d[_0x3e49('0x48')],{})[_0x3e49('0x22')](function(_0x107071){var _0x47802f=_0xd6b48d[_0x3e49('0x49')]['get']({'plain':!![]});if(!_0x47802f)throw new Error(_0x3e49('0x4a'));if(_0x47802f[_0x3e49('0x4b')]===_0x3e49('0x49')){var _0x5b896b=_0x107071[_0x3e49('0x23')]({'plain':!![]});var _0x5f3898=_0x3e49('0x4c');return db[_0x3e49('0x4d')]['find']({'where':{'name':_0x5f3898,'userProfileId':_0x47802f[_0x3e49('0x4e')]},'raw':!![]})[_0x3e49('0x22')](function(_0x38e5c9){if(_0x38e5c9&&_0x38e5c9[_0x3e49('0x4f')]===0x0){return db['UserProfileResource'][_0x3e49('0x47')]({'name':_0x5b896b[_0x3e49('0x28')],'resourceId':_0x5b896b['id'],'type':_0x38e5c9[_0x3e49('0x28')],'sectionId':_0x38e5c9['id']},{})[_0x3e49('0x22')](function(){return _0x107071;});}else{return _0x107071;}})['catch'](function(_0x7f5b2c){logger['error'](_0x3e49('0x50'),_0x7f5b2c);throw _0x7f5b2c;});}return _0x107071;})[_0x3e49('0x22')](respondWithResult(_0x5b600d,0xc9))[_0x3e49('0x42')](handleError(_0x5b600d,null));};exports[_0x3e49('0x21')]=function(_0x568d04,_0x3a698f){if(_0x568d04['body']['id']){delete _0x568d04[_0x3e49('0x48')]['id'];}return db[_0x3e49('0x2a')][_0x3e49('0x46')]({'where':{'id':_0x568d04[_0x3e49('0x44')]['id']}})[_0x3e49('0x22')](handleEntityNotFound(_0x3a698f,null))[_0x3e49('0x22')](saveUpdates(_0x568d04['body'],null))[_0x3e49('0x22')](respondWithResult(_0x3a698f,null))['catch'](handleError(_0x3a698f,null));};exports[_0x3e49('0x24')]=function(_0x2e3051,_0x5553d3){return db[_0x3e49('0x2a')][_0x3e49('0x46')]({'where':{'id':_0x2e3051[_0x3e49('0x44')]['id']}})[_0x3e49('0x22')](handleEntityNotFound(_0x5553d3,null))[_0x3e49('0x22')](removeEntity(_0x5553d3,null))['catch'](handleError(_0x5553d3,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 0a956aa..bde608d 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 _0x059f=['./analyticMetric.attributes','exports','define','AnalyticMetric','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x4ec2ea,_0x53482d){var _0x26cf97=function(_0xf8f4f6){while(--_0xf8f4f6){_0x4ec2ea['push'](_0x4ec2ea['shift']());}};_0x26cf97(++_0x53482d);}(_0x059f,0x1a4));var _0xf059=function(_0x37a7c6,_0x3a84b6){_0x37a7c6=_0x37a7c6-0x0;var _0x539905=_0x059f[_0x37a7c6];return _0x539905;};'use strict';var _=require(_0xf059('0x0'));var util=require(_0xf059('0x1'));var logger=require(_0xf059('0x2'))(_0xf059('0x3'));var moment=require(_0xf059('0x4'));var BPromise=require(_0xf059('0x5'));var rp=require(_0xf059('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf059('0x7'));var config=require(_0xf059('0x8'));var attributes=require(_0xf059('0x9'));module[_0xf059('0xa')]=function(_0x31e583,_0x31c96e){return _0x31e583[_0xf059('0xb')](_0xf059('0xc'),attributes,{'tableName':'analytics_metrics','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7491=['analytics_metrics','lodash','../../config/logger','api','moment','request-promise','path','../../config/environment','./analyticMetric.attributes','exports'];(function(_0x3e8512,_0x1a2ac0){var _0x43c3ac=function(_0x55e62c){while(--_0x55e62c){_0x3e8512['push'](_0x3e8512['shift']());}};_0x43c3ac(++_0x1a2ac0);}(_0x7491,0x1b9));var _0x1749=function(_0x1aa291,_0x30dae2){_0x1aa291=_0x1aa291-0x0;var _0x8b2c84=_0x7491[_0x1aa291];return _0x8b2c84;};'use strict';var _=require(_0x1749('0x0'));var util=require('util');var logger=require(_0x1749('0x1'))(_0x1749('0x2'));var moment=require(_0x1749('0x3'));var BPromise=require('bluebird');var rp=require(_0x1749('0x4'));var fs=require('fs');var path=require(_0x1749('0x5'));var rimraf=require('rimraf');var config=require(_0x1749('0x6'));var attributes=require(_0x1749('0x7'));module[_0x1749('0x8')]=function(_0x2d5170,_0xb679b8){return _0x2d5170['define']('AnalyticMetric',attributes,{'tableName':_0x1749('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.rpc.js b/server/api/analyticMetric/analyticMetric.rpc.js index e728ee9..5ca568f 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 _0x54b5=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util'];(function(_0x4bb8e3,_0x907d69){var _0x59af64=function(_0x3825f7){while(--_0x3825f7){_0x4bb8e3['push'](_0x4bb8e3['shift']());}};_0x59af64(++_0x907d69);}(_0x54b5,0x1cc));var _0x554b=function(_0x1c90d4,_0x3957e6){_0x1c90d4=_0x1c90d4-0x0;var _0x214860=_0x54b5[_0x1c90d4];return _0x214860;};'use strict';var _=require(_0x554b('0x0'));var util=require(_0x554b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x554b('0x2'));var fs=require('fs');var Redis=require(_0x554b('0x3'));var db=require(_0x554b('0x4'))['db'];var utils=require(_0x554b('0x5'));var logger=require(_0x554b('0x6'))('rpc');var config=require(_0x554b('0x7'));var jayson=require(_0x554b('0x8'));var client=jayson[_0x554b('0x9')][_0x554b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x50f33a,_0x46e30d,_0x216bd7){return new BPromise(function(_0x359077,_0x138d65){return client[_0x554b('0xb')](_0x50f33a,_0x216bd7)[_0x554b('0xc')](function(_0x42af70){logger[_0x554b('0xd')](_0x554b('0xe'),_0x46e30d,_0x554b('0xf'));logger[_0x554b('0x10')](_0x554b('0x11'),_0x46e30d,_0x554b('0xf'),JSON[_0x554b('0x12')](_0x42af70));if(_0x42af70['error']){if(_0x42af70[_0x554b('0x13')]['code']===0x1f4){logger['error'](_0x554b('0xe'),_0x46e30d,_0x42af70['error'][_0x554b('0x14')]);return _0x138d65(_0x42af70['error'][_0x554b('0x14')]);}logger['error'](_0x554b('0xe'),_0x46e30d,_0x42af70['error'][_0x554b('0x14')]);return _0x359077(_0x42af70[_0x554b('0x13')][_0x554b('0x14')]);}else{logger[_0x554b('0xd')](_0x554b('0xe'),_0x46e30d,_0x554b('0xf'));_0x359077(_0x42af70[_0x554b('0x15')][_0x554b('0x14')]);}})['catch'](function(_0x16fe98){logger[_0x554b('0x13')]('AnalyticMetric,\x20%s,\x20%s',_0x46e30d,_0x16fe98);_0x138d65(_0x16fe98);});});} \ No newline at end of file +var _0xbc13=['info','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','error','AnalyticMetric,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','request','then'];(function(_0x45f405,_0x30ec3a){var _0x595c1a=function(_0x460058){while(--_0x460058){_0x45f405['push'](_0x45f405['shift']());}};_0x595c1a(++_0x30ec3a);}(_0xbc13,0x169));var _0x3bc1=function(_0x5ebf44,_0x4e543e){_0x5ebf44=_0x5ebf44-0x0;var _0x2fef12=_0xbc13[_0x5ebf44];return _0x2fef12;};'use strict';var _=require(_0x3bc1('0x0'));var util=require(_0x3bc1('0x1'));var moment=require(_0x3bc1('0x2'));var BPromise=require(_0x3bc1('0x3'));var rs=require(_0x3bc1('0x4'));var fs=require('fs');var Redis=require(_0x3bc1('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x3bc1('0x6'));var logger=require(_0x3bc1('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x3bc1('0x8'));var client=jayson[_0x3bc1('0x9')][_0x3bc1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3b4d32,_0x5e348a,_0x29a9ff){return new BPromise(function(_0xc2f78b,_0xbdaf38){return client[_0x3bc1('0xb')](_0x3b4d32,_0x29a9ff)[_0x3bc1('0xc')](function(_0x54ded1){logger[_0x3bc1('0xd')]('AnalyticMetric,\x20%s,\x20%s',_0x5e348a,_0x3bc1('0xe'));logger[_0x3bc1('0xf')](_0x3bc1('0x10'),_0x5e348a,_0x3bc1('0xe'),JSON['stringify'](_0x54ded1));if(_0x54ded1['error']){if(_0x54ded1[_0x3bc1('0x11')]['code']===0x1f4){logger['error'](_0x3bc1('0x12'),_0x5e348a,_0x54ded1[_0x3bc1('0x11')][_0x3bc1('0x13')]);return _0xbdaf38(_0x54ded1[_0x3bc1('0x11')][_0x3bc1('0x13')]);}logger[_0x3bc1('0x11')](_0x3bc1('0x12'),_0x5e348a,_0x54ded1[_0x3bc1('0x11')]['message']);return _0xc2f78b(_0x54ded1[_0x3bc1('0x11')][_0x3bc1('0x13')]);}else{logger['info'](_0x3bc1('0x12'),_0x5e348a,_0x3bc1('0xe'));_0xc2f78b(_0x54ded1[_0x3bc1('0x14')][_0x3bc1('0x13')]);}})[_0x3bc1('0x15')](function(_0x44e1df){logger[_0x3bc1('0x11')](_0x3bc1('0x12'),_0x5e348a,_0x44e1df);_0xbdaf38(_0x44e1df);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index df9e486..f8ce3a3 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 _0x187d=['update','delete','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./analyticMetric.controller','get','index','/:id','isAuthenticated','show','post','create'];(function(_0x566bda,_0x1447dc){var _0x4ab467=function(_0x3c3059){while(--_0x3c3059){_0x566bda['push'](_0x566bda['shift']());}};_0x4ab467(++_0x1447dc);}(_0x187d,0x93));var _0xd187=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x187d[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0xd187('0x0'));var util=require('util');var path=require(_0xd187('0x1'));var timeout=require(_0xd187('0x2'));var express=require(_0xd187('0x3'));var router=express[_0xd187('0x4')]();var auth=require(_0xd187('0x5'));var interaction=require(_0xd187('0x6'));var config=require('../../config/environment');var controller=require(_0xd187('0x7'));router[_0xd187('0x8')]('/',auth['isAuthenticated'](),controller[_0xd187('0x9')]);router[_0xd187('0x8')](_0xd187('0xa'),auth[_0xd187('0xb')](),controller[_0xd187('0xc')]);router[_0xd187('0xd')]('/',auth[_0xd187('0xb')](),controller[_0xd187('0xe')]);router['put'](_0xd187('0xa'),auth[_0xd187('0xb')](),controller[_0xd187('0xf')]);router[_0xd187('0x10')](_0xd187('0xa'),auth[_0xd187('0xb')](),controller['destroy']);module[_0xd187('0x11')]=router; \ No newline at end of file +var _0x814b=['multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy'];(function(_0x5f4431,_0x39ea13){var _0x1e9219=function(_0x371736){while(--_0x371736){_0x5f4431['push'](_0x5f4431['shift']());}};_0x1e9219(++_0x39ea13);}(_0x814b,0x1a2));var _0xb814=function(_0xb02766,_0xa37d90){_0xb02766=_0xb02766-0x0;var _0x560e6c=_0x814b[_0xb02766];return _0x560e6c;};'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['show']);router[_0xb814('0xd')]('/',auth[_0xb814('0xa')](),controller[_0xb814('0xe')]);router[_0xb814('0xf')](_0xb814('0xc'),auth[_0xb814('0xa')](),controller[_0xb814('0x10')]);router[_0xb814('0x11')](_0xb814('0xc'),auth[_0xb814('0xa')](),controller[_0xb814('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index afa698f..ea1fa43 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 _0x970a=['TEXT','sequelize','exports'];(function(_0xef54fb,_0x50cc8e){var _0x282068=function(_0x1b336d){while(--_0x1b336d){_0xef54fb['push'](_0xef54fb['shift']());}};_0x282068(++_0x50cc8e);}(_0x970a,0x12d));var _0xa970=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x970a[_0x502c7d];return _0x30b7ed;};'use strict';var Sequelize=require(_0xa970('0x0'));module[_0xa970('0x1')]={'tree':{'type':Sequelize[_0xa970('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x6e13=['sequelize','exports','TEXT'];(function(_0x166742,_0x55520c){var _0xb7814a=function(_0x18feaf){while(--_0x18feaf){_0x166742['push'](_0x166742['shift']());}};_0xb7814a(++_0x55520c);}(_0x6e13,0x7e));var _0x36e1=function(_0x21339f,_0x46a4ac){_0x21339f=_0x21339f-0x0;var _0x211135=_0x6e13[_0x21339f];return _0x211135;};'use strict';var Sequelize=require(_0x36e1('0x0'));module[_0x36e1('0x1')]={'tree':{'type':Sequelize[_0x36e1('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index e171d88..a00d6c9 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 _0x378b=['body','destroy','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','count','offset','limit','set','Content-Range','apply','reject','save','update','then','name','index','map','AnalyticTreeReport','rawAttributes','fieldName','type','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','rows','catch','params','keys','include','find','create'];(function(_0x38a095,_0xc60b67){var _0x2ee277=function(_0x11a7a3){while(--_0x11a7a3){_0x38a095['push'](_0x38a095['shift']());}};_0x2ee277(++_0xc60b67);}(_0x378b,0x160));var _0xb378=function(_0x56a34d,_0x4d7e2a){_0x56a34d=_0x56a34d-0x0;var _0x31e801=_0x378b[_0x56a34d];return _0x31e801;};'use strict';var pdf=require(_0xb378('0x0'));var emlformat=require(_0xb378('0x1'));var rimraf=require(_0xb378('0x2'));var zipdir=require(_0xb378('0x3'));var jsonpatch=require(_0xb378('0x4'));var rp=require(_0xb378('0x5'));var moment=require('moment');var BPromise=require(_0xb378('0x6'));var Mustache=require(_0xb378('0x7'));var util=require(_0xb378('0x8'));var path=require(_0xb378('0x9'));var sox=require('sox');var csv=require(_0xb378('0xa'));var ejs=require(_0xb378('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xb378('0xc'));var jsforce=require(_0xb378('0xd'));var deskjs=require(_0xb378('0xe'));var toCsv=require(_0xb378('0xa'));var querystring=require(_0xb378('0xf'));var Papa=require(_0xb378('0x10'));var Redis=require('ioredis');var authService=require(_0xb378('0x11'));var qs=require(_0xb378('0x12'));var as=require(_0xb378('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb378('0x14'));var utils=require(_0xb378('0x15'));var config=require(_0xb378('0x16'));var db=require(_0xb378('0x17'))['db'];function respondWithStatusCode(_0x4e8410,_0x4de51e){_0x4de51e=_0x4de51e||0xcc;return function(_0x999379){if(_0x999379){return _0x4e8410[_0xb378('0x18')](_0x4de51e);}return _0x4e8410['status'](_0x4de51e)[_0xb378('0x19')]();};}function respondWithResult(_0x327135,_0x1a3cab){_0x1a3cab=_0x1a3cab||0xc8;return function(_0x49902a){if(_0x49902a){return _0x327135[_0xb378('0x1a')](_0x1a3cab)['json'](_0x49902a);}};}function respondWithFilteredResult(_0x533b71,_0x373057){return function(_0x3a277f){if(_0x3a277f){var _0x1487a3=_0x3a277f[_0xb378('0x1b')],_0x5dae15=_0x373057[_0xb378('0x1c')],_0x472b49=_0x373057['offset']+_0x373057[_0xb378('0x1d')],_0x2459d4;if(_0x472b49>=_0x1487a3){_0x472b49=_0x1487a3;_0x2459d4=0xc8;}else{_0x2459d4=0xce;}_0x533b71[_0xb378('0x1a')](_0x2459d4);return _0x533b71[_0xb378('0x1e')](_0xb378('0x1f'),_0x5dae15+'-'+_0x472b49+'/'+_0x1487a3)['json'](_0x3a277f);}return null;};}function patchUpdates(_0x158e5a){return function(_0x502e57){try{jsonpatch[_0xb378('0x20')](_0x502e57,_0x158e5a,!![]);}catch(_0xe130d4){return BPromise[_0xb378('0x21')](_0xe130d4);}return _0x502e57[_0xb378('0x22')]();};}function saveUpdates(_0x21b39b,_0x47f9de){return function(_0x23f24e){if(_0x23f24e){return _0x23f24e[_0xb378('0x23')](_0x21b39b)[_0xb378('0x24')](function(_0x1e1b11){return _0x1e1b11;});}return null;};}function removeEntity(_0x333409,_0x16e0e6){return function(_0x1a2af5){if(_0x1a2af5){return _0x1a2af5['destroy']()[_0xb378('0x24')](function(){_0x333409[_0xb378('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f3c83,_0x2ce02c){return function(_0xa85684){if(!_0xa85684){_0x1f3c83[_0xb378('0x18')](0x194);}return _0xa85684;};}function handleError(_0x47d6f9,_0xcd1d7d){_0xcd1d7d=_0xcd1d7d||0x1f4;return function(_0x597101){logger['error'](_0x597101['stack']);if(_0x597101[_0xb378('0x25')]){delete _0x597101[_0xb378('0x25')];}_0x47d6f9[_0xb378('0x1a')](_0xcd1d7d)['send'](_0x597101);};}exports[_0xb378('0x26')]=function(_0x48fc83,_0x444086){var _0x95de34={},_0x2806a9={},_0x4f5efb={'count':0x0,'rows':[]};var _0x2fea0d=_[_0xb378('0x27')](db[_0xb378('0x28')][_0xb378('0x29')],function(_0x543305){return{'name':_0x543305[_0xb378('0x2a')],'type':_0x543305[_0xb378('0x2b')]['key']};});_0x2806a9[_0xb378('0x2c')]=_[_0xb378('0x27')](_0x2fea0d,_0xb378('0x25'));_0x2806a9['query']=_['keys'](_0x48fc83[_0xb378('0x2d')]);_0x2806a9['filters']=_['intersection'](_0x2806a9[_0xb378('0x2c')],_0x2806a9[_0xb378('0x2d')]);_0x95de34[_0xb378('0x2e')]=_[_0xb378('0x2f')](_0x2806a9[_0xb378('0x2c')],qs[_0xb378('0x30')](_0x48fc83[_0xb378('0x2d')][_0xb378('0x30')]));_0x95de34['attributes']=_0x95de34[_0xb378('0x2e')][_0xb378('0x31')]?_0x95de34[_0xb378('0x2e')]:_0x2806a9[_0xb378('0x2c')];if(!_0x48fc83[_0xb378('0x2d')][_0xb378('0x32')](_0xb378('0x33'))){_0x95de34[_0xb378('0x1d')]=qs[_0xb378('0x1d')](_0x48fc83[_0xb378('0x2d')][_0xb378('0x1d')]);_0x95de34[_0xb378('0x1c')]=qs[_0xb378('0x1c')](_0x48fc83[_0xb378('0x2d')][_0xb378('0x1c')]);}_0x95de34['order']=qs[_0xb378('0x34')](_0x48fc83[_0xb378('0x2d')][_0xb378('0x34')]);_0x95de34['where']=qs[_0xb378('0x35')](_[_0xb378('0x36')](_0x48fc83['query'],_0x2806a9[_0xb378('0x35')]),_0x2fea0d);if(_0x48fc83[_0xb378('0x2d')][_0xb378('0x37')]){_0x95de34[_0xb378('0x38')]=_[_0xb378('0x39')](_0x95de34['where'],{'$or':_[_0xb378('0x27')](_0x2fea0d,function(_0x2d77bc){if(_0x2d77bc[_0xb378('0x2b')]!==_0xb378('0x3a')){var _0x80c5ac={};_0x80c5ac[_0x2d77bc[_0xb378('0x25')]]={'$like':'%'+_0x48fc83['query']['filter']+'%'};return _0x80c5ac;}})});}_0x95de34=_[_0xb378('0x39')]({},_0x95de34,_0x48fc83[_0xb378('0x3b')]);var _0x45e6aa={'where':_0x95de34[_0xb378('0x38')]};return db[_0xb378('0x28')]['count'](_0x45e6aa)['then'](function(_0x1dc8b7){_0x4f5efb[_0xb378('0x1b')]=_0x1dc8b7;if(_0x48fc83[_0xb378('0x2d')][_0xb378('0x3c')]){_0x95de34['include']=[{'all':!![]}];}return db['AnalyticTreeReport']['findAll'](_0x95de34);})[_0xb378('0x24')](function(_0x1b0ecd){_0x4f5efb[_0xb378('0x3d')]=_0x1b0ecd;return _0x4f5efb;})[_0xb378('0x24')](respondWithFilteredResult(_0x444086,_0x95de34))[_0xb378('0x3e')](handleError(_0x444086,null));};exports['show']=function(_0x332dfa,_0x4b2bef){var _0x1ce877={'raw':!![],'where':{'id':_0x332dfa[_0xb378('0x3f')]['id']}},_0x12b429={};_0x12b429[_0xb378('0x2c')]=_[_0xb378('0x40')](db[_0xb378('0x28')][_0xb378('0x29')]);_0x12b429[_0xb378('0x2d')]=_[_0xb378('0x40')](_0x332dfa[_0xb378('0x2d')]);_0x12b429[_0xb378('0x35')]=_[_0xb378('0x2f')](_0x12b429['model'],_0x12b429[_0xb378('0x2d')]);_0x1ce877[_0xb378('0x2e')]=_[_0xb378('0x2f')](_0x12b429['model'],qs[_0xb378('0x30')](_0x332dfa[_0xb378('0x2d')][_0xb378('0x30')]));_0x1ce877['attributes']=_0x1ce877[_0xb378('0x2e')]['length']?_0x1ce877[_0xb378('0x2e')]:_0x12b429[_0xb378('0x2c')];if(_0x332dfa[_0xb378('0x2d')][_0xb378('0x3c')]){_0x1ce877[_0xb378('0x41')]=[{'all':!![]}];}_0x1ce877=_[_0xb378('0x39')]({},_0x1ce877,_0x332dfa[_0xb378('0x3b')]);return db['AnalyticTreeReport'][_0xb378('0x42')](_0x1ce877)[_0xb378('0x24')](handleEntityNotFound(_0x4b2bef,null))[_0xb378('0x24')](respondWithResult(_0x4b2bef,null))['catch'](handleError(_0x4b2bef,null));};exports[_0xb378('0x43')]=function(_0x402866,_0x318f9b){return db[_0xb378('0x28')]['create'](_0x402866[_0xb378('0x44')],{})[_0xb378('0x24')](respondWithResult(_0x318f9b,0xc9))[_0xb378('0x3e')](handleError(_0x318f9b,null));};exports[_0xb378('0x23')]=function(_0x15f733,_0x528053){if(_0x15f733[_0xb378('0x44')]['id']){delete _0x15f733[_0xb378('0x44')]['id'];}return db['AnalyticTreeReport'][_0xb378('0x42')]({'where':{'id':_0x15f733[_0xb378('0x3f')]['id']}})['then'](handleEntityNotFound(_0x528053,null))[_0xb378('0x24')](saveUpdates(_0x15f733[_0xb378('0x44')],null))[_0xb378('0x24')](respondWithResult(_0x528053,null))[_0xb378('0x3e')](handleError(_0x528053,null));};exports[_0xb378('0x45')]=function(_0x1ed999,_0x5a5c32){return db['AnalyticTreeReport'][_0xb378('0x42')]({'where':{'id':_0x1ed999['params']['id']}})[_0xb378('0x24')](handleEntityNotFound(_0x5a5c32,null))[_0xb378('0x24')](removeEntity(_0x5a5c32,null))[_0xb378('0x3e')](handleError(_0x5a5c32,null));}; \ No newline at end of file +var _0x1c9d=['create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','AnalyticTreeReport','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','options','count','includeAll','include','rows','catch','show','params','rawAttributes','intersection','find'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x1c9d,0x126));var _0xd1c9=function(_0x5be695,_0x3df5c8){_0x5be695=_0x5be695-0x0;var _0x4eab0e=_0x1c9d[_0x5be695];return _0x4eab0e;};'use strict';var pdf=require(_0xd1c9('0x0'));var emlformat=require(_0xd1c9('0x1'));var rimraf=require(_0xd1c9('0x2'));var zipdir=require(_0xd1c9('0x3'));var jsonpatch=require(_0xd1c9('0x4'));var rp=require(_0xd1c9('0x5'));var moment=require(_0xd1c9('0x6'));var BPromise=require(_0xd1c9('0x7'));var Mustache=require(_0xd1c9('0x8'));var util=require(_0xd1c9('0x9'));var path=require('path');var sox=require(_0xd1c9('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xd1c9('0xb'));var squel=require(_0xd1c9('0xc'));var crypto=require(_0xd1c9('0xd'));var jsforce=require(_0xd1c9('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xd1c9('0xf'));var querystring=require(_0xd1c9('0x10'));var Papa=require(_0xd1c9('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd1c9('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd1c9('0x13'));var logger=require(_0xd1c9('0x14'))(_0xd1c9('0x15'));var utils=require(_0xd1c9('0x16'));var config=require(_0xd1c9('0x17'));var db=require(_0xd1c9('0x18'))['db'];function respondWithStatusCode(_0x51572f,_0x13f6be){_0x13f6be=_0x13f6be||0xcc;return function(_0x14dd53){if(_0x14dd53){return _0x51572f[_0xd1c9('0x19')](_0x13f6be);}return _0x51572f[_0xd1c9('0x1a')](_0x13f6be)[_0xd1c9('0x1b')]();};}function respondWithResult(_0x251771,_0xee1ac){_0xee1ac=_0xee1ac||0xc8;return function(_0x33b089){if(_0x33b089){return _0x251771[_0xd1c9('0x1a')](_0xee1ac)[_0xd1c9('0x1c')](_0x33b089);}};}function respondWithFilteredResult(_0x56f967,_0x585c3a){return function(_0x29124a){if(_0x29124a){var _0x47badc=_0x29124a['count'],_0x5111ab=_0x585c3a[_0xd1c9('0x1d')],_0xd9c6fc=_0x585c3a[_0xd1c9('0x1d')]+_0x585c3a[_0xd1c9('0x1e')],_0x504551;if(_0xd9c6fc>=_0x47badc){_0xd9c6fc=_0x47badc;_0x504551=0xc8;}else{_0x504551=0xce;}_0x56f967[_0xd1c9('0x1a')](_0x504551);return _0x56f967['set'](_0xd1c9('0x1f'),_0x5111ab+'-'+_0xd9c6fc+'/'+_0x47badc)[_0xd1c9('0x1c')](_0x29124a);}return null;};}function patchUpdates(_0x449e6c){return function(_0x11657d){try{jsonpatch[_0xd1c9('0x20')](_0x11657d,_0x449e6c,!![]);}catch(_0x3cdf88){return BPromise[_0xd1c9('0x21')](_0x3cdf88);}return _0x11657d[_0xd1c9('0x22')]();};}function saveUpdates(_0x54489c,_0x449fd4){return function(_0x437d93){if(_0x437d93){return _0x437d93[_0xd1c9('0x23')](_0x54489c)[_0xd1c9('0x24')](function(_0x22b160){return _0x22b160;});}return null;};}function removeEntity(_0x496365,_0x2fbbea){return function(_0x2b8b81){if(_0x2b8b81){return _0x2b8b81[_0xd1c9('0x25')]()[_0xd1c9('0x24')](function(){_0x496365['status'](0xcc)[_0xd1c9('0x1b')]();});}};}function handleEntityNotFound(_0x266160,_0x33a5cd){return function(_0x19d275){if(!_0x19d275){_0x266160['sendStatus'](0x194);}return _0x19d275;};}function handleError(_0x5209b0,_0x600253){_0x600253=_0x600253||0x1f4;return function(_0x51f43a){logger[_0xd1c9('0x26')](_0x51f43a[_0xd1c9('0x27')]);if(_0x51f43a[_0xd1c9('0x28')]){delete _0x51f43a[_0xd1c9('0x28')];}_0x5209b0[_0xd1c9('0x1a')](_0x600253)['send'](_0x51f43a);};}exports[_0xd1c9('0x29')]=function(_0x658276,_0x5c4ac9){var _0x133fcc={},_0x5e6dd2={},_0x27364a={'count':0x0,'rows':[]};var _0x637366=_[_0xd1c9('0x2a')](db[_0xd1c9('0x2b')]['rawAttributes'],function(_0x567615){return{'name':_0x567615[_0xd1c9('0x2c')],'type':_0x567615[_0xd1c9('0x2d')][_0xd1c9('0x2e')]};});_0x5e6dd2[_0xd1c9('0x2f')]=_[_0xd1c9('0x2a')](_0x637366,_0xd1c9('0x28'));_0x5e6dd2[_0xd1c9('0x30')]=_[_0xd1c9('0x31')](_0x658276[_0xd1c9('0x30')]);_0x5e6dd2[_0xd1c9('0x32')]=_['intersection'](_0x5e6dd2[_0xd1c9('0x2f')],_0x5e6dd2[_0xd1c9('0x30')]);_0x133fcc[_0xd1c9('0x33')]=_['intersection'](_0x5e6dd2[_0xd1c9('0x2f')],qs[_0xd1c9('0x34')](_0x658276['query']['fields']));_0x133fcc[_0xd1c9('0x33')]=_0x133fcc[_0xd1c9('0x33')][_0xd1c9('0x35')]?_0x133fcc[_0xd1c9('0x33')]:_0x5e6dd2[_0xd1c9('0x2f')];if(!_0x658276['query'][_0xd1c9('0x36')](_0xd1c9('0x37'))){_0x133fcc[_0xd1c9('0x1e')]=qs['limit'](_0x658276[_0xd1c9('0x30')]['limit']);_0x133fcc[_0xd1c9('0x1d')]=qs['offset'](_0x658276['query']['offset']);}_0x133fcc['order']=qs[_0xd1c9('0x38')](_0x658276[_0xd1c9('0x30')][_0xd1c9('0x38')]);_0x133fcc[_0xd1c9('0x39')]=qs[_0xd1c9('0x32')](_['pick'](_0x658276[_0xd1c9('0x30')],_0x5e6dd2[_0xd1c9('0x32')]),_0x637366);if(_0x658276[_0xd1c9('0x30')][_0xd1c9('0x3a')]){_0x133fcc['where']=_[_0xd1c9('0x3b')](_0x133fcc[_0xd1c9('0x39')],{'$or':_['map'](_0x637366,function(_0x2568f4){if(_0x2568f4[_0xd1c9('0x2d')]!=='VIRTUAL'){var _0x1e5805={};_0x1e5805[_0x2568f4[_0xd1c9('0x28')]]={'$like':'%'+_0x658276['query'][_0xd1c9('0x3a')]+'%'};return _0x1e5805;}})});}_0x133fcc=_[_0xd1c9('0x3b')]({},_0x133fcc,_0x658276[_0xd1c9('0x3c')]);var _0x333972={'where':_0x133fcc[_0xd1c9('0x39')]};return db['AnalyticTreeReport']['count'](_0x333972)[_0xd1c9('0x24')](function(_0x12cade){_0x27364a[_0xd1c9('0x3d')]=_0x12cade;if(_0x658276[_0xd1c9('0x30')][_0xd1c9('0x3e')]){_0x133fcc[_0xd1c9('0x3f')]=[{'all':!![]}];}return db[_0xd1c9('0x2b')]['findAll'](_0x133fcc);})[_0xd1c9('0x24')](function(_0x3f54ba){_0x27364a[_0xd1c9('0x40')]=_0x3f54ba;return _0x27364a;})[_0xd1c9('0x24')](respondWithFilteredResult(_0x5c4ac9,_0x133fcc))[_0xd1c9('0x41')](handleError(_0x5c4ac9,null));};exports[_0xd1c9('0x42')]=function(_0x157c52,_0x7dd830){var _0x5bf318={'raw':!![],'where':{'id':_0x157c52[_0xd1c9('0x43')]['id']}},_0x5e2878={};_0x5e2878['model']=_[_0xd1c9('0x31')](db[_0xd1c9('0x2b')][_0xd1c9('0x44')]);_0x5e2878[_0xd1c9('0x30')]=_[_0xd1c9('0x31')](_0x157c52[_0xd1c9('0x30')]);_0x5e2878[_0xd1c9('0x32')]=_[_0xd1c9('0x45')](_0x5e2878[_0xd1c9('0x2f')],_0x5e2878[_0xd1c9('0x30')]);_0x5bf318['attributes']=_['intersection'](_0x5e2878['model'],qs[_0xd1c9('0x34')](_0x157c52[_0xd1c9('0x30')][_0xd1c9('0x34')]));_0x5bf318[_0xd1c9('0x33')]=_0x5bf318['attributes'][_0xd1c9('0x35')]?_0x5bf318[_0xd1c9('0x33')]:_0x5e2878[_0xd1c9('0x2f')];if(_0x157c52[_0xd1c9('0x30')][_0xd1c9('0x3e')]){_0x5bf318['include']=[{'all':!![]}];}_0x5bf318=_[_0xd1c9('0x3b')]({},_0x5bf318,_0x157c52[_0xd1c9('0x3c')]);return db['AnalyticTreeReport'][_0xd1c9('0x46')](_0x5bf318)['then'](handleEntityNotFound(_0x7dd830,null))['then'](respondWithResult(_0x7dd830,null))[_0xd1c9('0x41')](handleError(_0x7dd830,null));};exports[_0xd1c9('0x47')]=function(_0x3e1ab1,_0x3c291e){return db[_0xd1c9('0x2b')]['create'](_0x3e1ab1[_0xd1c9('0x48')],{})[_0xd1c9('0x24')](respondWithResult(_0x3c291e,0xc9))['catch'](handleError(_0x3c291e,null));};exports[_0xd1c9('0x23')]=function(_0x355744,_0x1c9451){if(_0x355744[_0xd1c9('0x48')]['id']){delete _0x355744[_0xd1c9('0x48')]['id'];}return db[_0xd1c9('0x2b')][_0xd1c9('0x46')]({'where':{'id':_0x355744[_0xd1c9('0x43')]['id']}})[_0xd1c9('0x24')](handleEntityNotFound(_0x1c9451,null))['then'](saveUpdates(_0x355744[_0xd1c9('0x48')],null))[_0xd1c9('0x24')](respondWithResult(_0x1c9451,null))[_0xd1c9('0x41')](handleError(_0x1c9451,null));};exports[_0xd1c9('0x25')]=function(_0x5179c9,_0x117434){return db['AnalyticTreeReport'][_0xd1c9('0x46')]({'where':{'id':_0x5179c9[_0xd1c9('0x43')]['id']}})['then'](handleEntityNotFound(_0x117434,null))[_0xd1c9('0x24')](removeEntity(_0x117434,null))['catch'](handleError(_0x117434,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 9e4c72b..1c92d17 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 _0x3e0c=['AnalyticTreeReport','analytics_report_trees','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./analyticTreeReport.attributes'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x3e0c,0x16d));var _0xc3e0=function(_0x2dc6eb,_0x439724){_0x2dc6eb=_0x2dc6eb-0x0;var _0x2faaf1=_0x3e0c[_0x2dc6eb];return _0x2faaf1;};'use strict';var _=require(_0xc3e0('0x0'));var util=require(_0xc3e0('0x1'));var logger=require(_0xc3e0('0x2'))('api');var moment=require(_0xc3e0('0x3'));var BPromise=require(_0xc3e0('0x4'));var rp=require(_0xc3e0('0x5'));var fs=require('fs');var path=require(_0xc3e0('0x6'));var rimraf=require(_0xc3e0('0x7'));var config=require('../../config/environment');var attributes=require(_0xc3e0('0x8'));module['exports']=function(_0x4eb2ef,_0x541882){return _0x4eb2ef['define'](_0xc3e0('0x9'),attributes,{'tableName':_0xc3e0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7ee1=['analytics_report_trees','lodash','moment','bluebird','request-promise','rimraf','../../config/environment','./analyticTreeReport.attributes','exports','define'];(function(_0x35b5a9,_0x4f55d3){var _0xb64d1=function(_0x3839d3){while(--_0x3839d3){_0x35b5a9['push'](_0x35b5a9['shift']());}};_0xb64d1(++_0x4f55d3);}(_0x7ee1,0x8d));var _0x17ee=function(_0x28f28a,_0x39f2f8){_0x28f28a=_0x28f28a-0x0;var _0x120eac=_0x7ee1[_0x28f28a];return _0x120eac;};'use strict';var _=require(_0x17ee('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x17ee('0x1'));var BPromise=require(_0x17ee('0x2'));var rp=require(_0x17ee('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x17ee('0x4'));var config=require(_0x17ee('0x5'));var attributes=require(_0x17ee('0x6'));module[_0x17ee('0x7')]=function(_0x5c0617,_0x52b1db){return _0x5c0617[_0x17ee('0x8')]('AnalyticTreeReport',attributes,{'tableName':_0x17ee('0x9'),'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 a58c1cf..eb4326e 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 _0xc5c8=['code','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','then','info','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x29a572,_0x3ebd75){var _0x2ee12f=function(_0x469dac){while(--_0x469dac){_0x29a572['push'](_0x29a572['shift']());}};_0x2ee12f(++_0x3ebd75);}(_0xc5c8,0x1bb));var _0x8c5c=function(_0x374b99,_0x43d40d){_0x374b99=_0x374b99-0x0;var _0x2a8a13=_0xc5c8[_0x374b99];return _0x2a8a13;};'use strict';var _=require(_0x8c5c('0x0'));var util=require(_0x8c5c('0x1'));var moment=require(_0x8c5c('0x2'));var BPromise=require('bluebird');var rs=require(_0x8c5c('0x3'));var fs=require('fs');var Redis=require(_0x8c5c('0x4'));var db=require(_0x8c5c('0x5'))['db'];var utils=require(_0x8c5c('0x6'));var logger=require('../../config/logger')(_0x8c5c('0x7'));var config=require(_0x8c5c('0x8'));var jayson=require(_0x8c5c('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5d7005,_0xd3e06,_0x5c57a2){return new BPromise(function(_0x113937,_0x5cb3be){return client[_0x8c5c('0xa')](_0x5d7005,_0x5c57a2)[_0x8c5c('0xb')](function(_0x469028){logger[_0x8c5c('0xc')](_0x8c5c('0xd'),_0xd3e06,_0x8c5c('0xe'));logger['debug']('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0xd3e06,'request\x20sent',JSON[_0x8c5c('0xf')](_0x469028));if(_0x469028['error']){if(_0x469028[_0x8c5c('0x10')][_0x8c5c('0x11')]===0x1f4){logger[_0x8c5c('0x10')]('AnalyticTreeReport,\x20%s,\x20%s',_0xd3e06,_0x469028[_0x8c5c('0x10')]['message']);return _0x5cb3be(_0x469028['error']['message']);}logger['error'](_0x8c5c('0xd'),_0xd3e06,_0x469028['error'][_0x8c5c('0x12')]);return _0x113937(_0x469028['error'][_0x8c5c('0x12')]);}else{logger['info'](_0x8c5c('0xd'),_0xd3e06,_0x8c5c('0xe'));_0x113937(_0x469028['result'][_0x8c5c('0x12')]);}})[_0x8c5c('0x13')](function(_0x553839){logger['error']('AnalyticTreeReport,\x20%s,\x20%s',_0xd3e06,_0x553839);_0x5cb3be(_0x553839);});});} \ No newline at end of file +var _0x4132=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','debug','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','AnalyticTreeReport,\x20%s,\x20%s','result'];(function(_0x13db01,_0x5676d9){var _0x114446=function(_0x24e779){while(--_0x24e779){_0x13db01['push'](_0x13db01['shift']());}};_0x114446(++_0x5676d9);}(_0x4132,0xa9));var _0x2413=function(_0x1eec91,_0x356569){_0x1eec91=_0x1eec91-0x0;var _0x4c5067=_0x4132[_0x1eec91];return _0x4c5067;};'use strict';var _=require(_0x2413('0x0'));var util=require(_0x2413('0x1'));var moment=require(_0x2413('0x2'));var BPromise=require(_0x2413('0x3'));var rs=require(_0x2413('0x4'));var fs=require('fs');var Redis=require(_0x2413('0x5'));var db=require(_0x2413('0x6'))['db'];var utils=require(_0x2413('0x7'));var logger=require(_0x2413('0x8'))(_0x2413('0x9'));var config=require(_0x2413('0xa'));var jayson=require(_0x2413('0xb'));var client=jayson[_0x2413('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x36e72f,_0x2baef5,_0x3296e0){return new BPromise(function(_0x5ce4f3,_0x5578ee){return client[_0x2413('0xd')](_0x36e72f,_0x3296e0)['then'](function(_0x3c4cd3){logger[_0x2413('0xe')]('AnalyticTreeReport,\x20%s,\x20%s',_0x2baef5,'request\x20sent');logger[_0x2413('0xf')](_0x2413('0x10'),_0x2baef5,_0x2413('0x11'),JSON['stringify'](_0x3c4cd3));if(_0x3c4cd3[_0x2413('0x12')]){if(_0x3c4cd3[_0x2413('0x12')][_0x2413('0x13')]===0x1f4){logger[_0x2413('0x12')]('AnalyticTreeReport,\x20%s,\x20%s',_0x2baef5,_0x3c4cd3[_0x2413('0x12')]['message']);return _0x5578ee(_0x3c4cd3[_0x2413('0x12')][_0x2413('0x14')]);}logger['error'](_0x2413('0x15'),_0x2baef5,_0x3c4cd3[_0x2413('0x12')][_0x2413('0x14')]);return _0x5ce4f3(_0x3c4cd3['error'][_0x2413('0x14')]);}else{logger['info'](_0x2413('0x15'),_0x2baef5,'request\x20sent');_0x5ce4f3(_0x3c4cd3[_0x2413('0x16')][_0x2413('0x14')]);}})[_0x2413('0x17')](function(_0x53da0f){logger[_0x2413('0x12')]('AnalyticTreeReport,\x20%s,\x20%s',_0x2baef5,_0x53da0f);_0x5578ee(_0x53da0f);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 2f0d7a4..c5d6a2c 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 _0x103e=['exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','isAuthenticated','index','get','show','create','put','/:id','update','delete'];(function(_0x2c7d29,_0x519104){var _0x55ec63=function(_0x2e6aad){while(--_0x2e6aad){_0x2c7d29['push'](_0x2c7d29['shift']());}};_0x55ec63(++_0x519104);}(_0x103e,0x1d5));var _0xe103=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x103e[_0x502c7d];return _0x30b7ed;};'use strict';var multer=require(_0xe103('0x0'));var util=require('util');var path=require(_0xe103('0x1'));var timeout=require('connect-timeout');var express=require(_0xe103('0x2'));var router=express[_0xe103('0x3')]();var auth=require(_0xe103('0x4'));var interaction=require(_0xe103('0x5'));var config=require(_0xe103('0x6'));var controller=require(_0xe103('0x7'));router['get']('/',auth[_0xe103('0x8')](),controller[_0xe103('0x9')]);router[_0xe103('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xe103('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0xe103('0xc')]);router[_0xe103('0xd')](_0xe103('0xe'),auth[_0xe103('0x8')](),controller[_0xe103('0xf')]);router[_0xe103('0x10')](_0xe103('0xe'),auth[_0xe103('0x8')](),controller['destroy']);module[_0xe103('0x11')]=router; \ No newline at end of file +var _0x4348=['../../config/environment','./analyticTreeReport.controller','get','isAuthenticated','index','/:id','show','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x37b3e5,_0x33b516){var _0x207f20=function(_0x5237fa){while(--_0x5237fa){_0x37b3e5['push'](_0x37b3e5['shift']());}};_0x207f20(++_0x33b516);}(_0x4348,0x1b0));var _0x8434=function(_0x630ea7,_0x1d7de9){_0x630ea7=_0x630ea7-0x0;var _0x427e3b=_0x4348[_0x630ea7];return _0x427e3b;};'use strict';var multer=require(_0x8434('0x0'));var util=require(_0x8434('0x1'));var path=require(_0x8434('0x2'));var timeout=require(_0x8434('0x3'));var express=require(_0x8434('0x4'));var router=express[_0x8434('0x5')]();var auth=require(_0x8434('0x6'));var interaction=require(_0x8434('0x7'));var config=require(_0x8434('0x8'));var controller=require(_0x8434('0x9'));router[_0x8434('0xa')]('/',auth[_0x8434('0xb')](),controller[_0x8434('0xc')]);router['get'](_0x8434('0xd'),auth[_0x8434('0xb')](),controller[_0x8434('0xe')]);router['post']('/',auth[_0x8434('0xb')](),controller[_0x8434('0xf')]);router[_0x8434('0x10')]('/:id',auth[_0x8434('0xb')](),controller['update']);router[_0x8434('0x11')](_0x8434('0xd'),auth[_0x8434('0xb')](),controller[_0x8434('0x12')]);module[_0x8434('0x13')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 73df365..891ed54 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 _0x434b=['STRING','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x434b,0x1c3));var _0xb434=function(_0x1d3577,_0x17a32e){_0x1d3577=_0x1d3577-0x0;var _0x277d9a=_0x434b[_0x1d3577];return _0x277d9a;};'use strict';var Sequelize=require(_0xb434('0x0'));module['exports']={'name':{'type':Sequelize[_0xb434('0x1')]},'basename':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xb434('0x1')]}}; \ No newline at end of file +var _0x30e0=['sequelize','STRING'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x30e0,0x18c));var _0x030e=function(_0x2e7698,_0x2d1bb8){_0x2e7698=_0x2e7698-0x0;var _0x438792=_0x30e0[_0x2e7698];return _0x438792;};'use strict';var Sequelize=require(_0x030e('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'basename':{'type':Sequelize[_0x030e('0x1')]},'type':{'type':Sequelize[_0x030e('0x1')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 5bdcf1f..05f5083 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 _0x05e0=['order','sort','where','merge','type','options','includeAll','include','rows','catch','show','params','keys','rawAttributes','find','clone','get','omit','createdAt','updatedAt','body','create','file','download','findOne','join','root','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','ejs','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','Attachment','fieldName','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit'];(function(_0x3c0dcc,_0x18c419){var _0x1a224c=function(_0x238ae7){while(--_0x238ae7){_0x3c0dcc['push'](_0x3c0dcc['shift']());}};_0x1a224c(++_0x18c419);}(_0x05e0,0x105));var _0x005e=function(_0x3759fa,_0x4a1baa){_0x3759fa=_0x3759fa-0x0;var _0x4e512e=_0x05e0[_0x3759fa];return _0x4e512e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x005e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x005e('0x1'));var jsonpatch=require(_0x005e('0x2'));var rp=require(_0x005e('0x3'));var moment=require(_0x005e('0x4'));var BPromise=require(_0x005e('0x5'));var Mustache=require('mustache');var util=require(_0x005e('0x6'));var path=require('path');var sox=require(_0x005e('0x7'));var csv=require('to-csv');var ejs=require(_0x005e('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x005e('0x9'));var crypto=require('crypto');var jsforce=require(_0x005e('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x005e('0xb'));var querystring=require(_0x005e('0xc'));var Papa=require(_0x005e('0xd'));var Redis=require(_0x005e('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x005e('0xf'));var hardwareService=require(_0x005e('0x10'));var logger=require(_0x005e('0x11'))(_0x005e('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x52c9b4,_0x17dfa0){_0x17dfa0=_0x17dfa0||0xcc;return function(_0x4fda26){if(_0x4fda26){return _0x52c9b4[_0x005e('0x13')](_0x17dfa0);}return _0x52c9b4[_0x005e('0x14')](_0x17dfa0)[_0x005e('0x15')]();};}function respondWithResult(_0x3c5f4b,_0x2759e5){_0x2759e5=_0x2759e5||0xc8;return function(_0x4cf958){if(_0x4cf958){return _0x3c5f4b[_0x005e('0x14')](_0x2759e5)[_0x005e('0x16')](_0x4cf958);}};}function respondWithFilteredResult(_0x2d0677,_0x3a6986){return function(_0x39bab6){if(_0x39bab6){var _0x44eb3e=_0x39bab6[_0x005e('0x17')],_0x2007d4=_0x3a6986[_0x005e('0x18')],_0x3702fb=_0x3a6986[_0x005e('0x18')]+_0x3a6986['limit'],_0x47fcca;if(_0x3702fb>=_0x44eb3e){_0x3702fb=_0x44eb3e;_0x47fcca=0xc8;}else{_0x47fcca=0xce;}_0x2d0677[_0x005e('0x14')](_0x47fcca);return _0x2d0677[_0x005e('0x19')](_0x005e('0x1a'),_0x2007d4+'-'+_0x3702fb+'/'+_0x44eb3e)[_0x005e('0x16')](_0x39bab6);}return null;};}function patchUpdates(_0x21b4f1){return function(_0x88bc23){try{jsonpatch[_0x005e('0x1b')](_0x88bc23,_0x21b4f1,!![]);}catch(_0x2fdccc){return BPromise[_0x005e('0x1c')](_0x2fdccc);}return _0x88bc23[_0x005e('0x1d')]();};}function saveUpdates(_0x276bae,_0x10d41d){return function(_0x28ec30){if(_0x28ec30){return _0x28ec30[_0x005e('0x1e')](_0x276bae)[_0x005e('0x1f')](function(_0x391edc){return _0x391edc;});}return null;};}function removeEntity(_0x10b183,_0x4d86e2){return function(_0x46c885){if(_0x46c885){return _0x46c885[_0x005e('0x20')]()[_0x005e('0x1f')](function(){_0x10b183[_0x005e('0x14')](0xcc)[_0x005e('0x15')]();});}};}function handleEntityNotFound(_0x142486,_0x188eda){return function(_0x226da8){if(!_0x226da8){_0x142486[_0x005e('0x13')](0x194);}return _0x226da8;};}function handleError(_0xd14858,_0x2704dc){_0x2704dc=_0x2704dc||0x1f4;return function(_0x3bf5c2){logger[_0x005e('0x21')](_0x3bf5c2[_0x005e('0x22')]);if(_0x3bf5c2[_0x005e('0x23')]){delete _0x3bf5c2[_0x005e('0x23')];}_0xd14858[_0x005e('0x14')](_0x2704dc)[_0x005e('0x24')](_0x3bf5c2);};}exports[_0x005e('0x25')]=function(_0x484b3a,_0x7a7128){var _0x36f9ae={},_0x512129={},_0x3eb7f4={'count':0x0,'rows':[]};var _0x19d48f=_[_0x005e('0x26')](db[_0x005e('0x27')]['rawAttributes'],function(_0xd9d137){return{'name':_0xd9d137[_0x005e('0x28')],'type':_0xd9d137['type']['key']};});_0x512129[_0x005e('0x29')]=_['map'](_0x19d48f,'name');_0x512129[_0x005e('0x2a')]=_['keys'](_0x484b3a['query']);_0x512129[_0x005e('0x2b')]=_[_0x005e('0x2c')](_0x512129['model'],_0x512129[_0x005e('0x2a')]);_0x36f9ae[_0x005e('0x2d')]=_['intersection'](_0x512129[_0x005e('0x29')],qs[_0x005e('0x2e')](_0x484b3a[_0x005e('0x2a')][_0x005e('0x2e')]));_0x36f9ae[_0x005e('0x2d')]=_0x36f9ae[_0x005e('0x2d')][_0x005e('0x2f')]?_0x36f9ae[_0x005e('0x2d')]:_0x512129['model'];if(!_0x484b3a[_0x005e('0x2a')][_0x005e('0x30')](_0x005e('0x31'))){_0x36f9ae[_0x005e('0x32')]=qs[_0x005e('0x32')](_0x484b3a[_0x005e('0x2a')]['limit']);_0x36f9ae[_0x005e('0x18')]=qs[_0x005e('0x18')](_0x484b3a[_0x005e('0x2a')][_0x005e('0x18')]);}_0x36f9ae[_0x005e('0x33')]=qs[_0x005e('0x34')](_0x484b3a[_0x005e('0x2a')]['sort']);_0x36f9ae[_0x005e('0x35')]=qs[_0x005e('0x2b')](_['pick'](_0x484b3a['query'],_0x512129['filters']),_0x19d48f);if(_0x484b3a[_0x005e('0x2a')]['filter']){_0x36f9ae[_0x005e('0x35')]=_[_0x005e('0x36')](_0x36f9ae[_0x005e('0x35')],{'$or':_[_0x005e('0x26')](_0x19d48f,function(_0x5c54df){if(_0x5c54df[_0x005e('0x37')]!=='VIRTUAL'){var _0x55868e={};_0x55868e[_0x5c54df['name']]={'$like':'%'+_0x484b3a['query']['filter']+'%'};return _0x55868e;}})});}_0x36f9ae=_[_0x005e('0x36')]({},_0x36f9ae,_0x484b3a[_0x005e('0x38')]);var _0x3a0428={'where':_0x36f9ae[_0x005e('0x35')]};return db[_0x005e('0x27')]['count'](_0x3a0428)[_0x005e('0x1f')](function(_0x2e26ad){_0x3eb7f4[_0x005e('0x17')]=_0x2e26ad;if(_0x484b3a[_0x005e('0x2a')][_0x005e('0x39')]){_0x36f9ae[_0x005e('0x3a')]=[{'all':!![]}];}return db[_0x005e('0x27')]['findAll'](_0x36f9ae);})['then'](function(_0x512e34){_0x3eb7f4[_0x005e('0x3b')]=_0x512e34;return _0x3eb7f4;})[_0x005e('0x1f')](respondWithFilteredResult(_0x7a7128,_0x36f9ae))[_0x005e('0x3c')](handleError(_0x7a7128,null));};exports[_0x005e('0x3d')]=function(_0x28c3ae,_0x447ba9){var _0xebfff={'raw':!![],'where':{'id':_0x28c3ae[_0x005e('0x3e')]['id']}},_0x39ee3c={};_0x39ee3c[_0x005e('0x29')]=_[_0x005e('0x3f')](db['Attachment'][_0x005e('0x40')]);_0x39ee3c[_0x005e('0x2a')]=_[_0x005e('0x3f')](_0x28c3ae[_0x005e('0x2a')]);_0x39ee3c[_0x005e('0x2b')]=_[_0x005e('0x2c')](_0x39ee3c['model'],_0x39ee3c[_0x005e('0x2a')]);_0xebfff[_0x005e('0x2d')]=_['intersection'](_0x39ee3c[_0x005e('0x29')],qs[_0x005e('0x2e')](_0x28c3ae[_0x005e('0x2a')][_0x005e('0x2e')]));_0xebfff[_0x005e('0x2d')]=_0xebfff[_0x005e('0x2d')]['length']?_0xebfff[_0x005e('0x2d')]:_0x39ee3c['model'];if(_0x28c3ae['query'][_0x005e('0x39')]){_0xebfff['include']=[{'all':!![]}];}_0xebfff=_['merge']({},_0xebfff,_0x28c3ae['options']);return db['Attachment'][_0x005e('0x41')](_0xebfff)['then'](handleEntityNotFound(_0x447ba9,null))[_0x005e('0x1f')](respondWithResult(_0x447ba9,null))['catch'](handleError(_0x447ba9,null));};exports[_0x005e('0x42')]=function(_0x509f70,_0x1e0485){var _0x5bb43a={'where':{'id':_0x509f70[_0x005e('0x3e')]['id']}},_0x4caaee={};_0x4caaee[_0x005e('0x29')]=_[_0x005e('0x3f')](db[_0x005e('0x27')][_0x005e('0x40')]);_0x5bb43a[_0x005e('0x2d')]=_[_0x005e('0x2c')](_0x4caaee[_0x005e('0x29')],qs[_0x005e('0x2e')](_0x509f70['query'][_0x005e('0x2e')]));_0x5bb43a[_0x005e('0x2d')]=_0x5bb43a[_0x005e('0x2d')][_0x005e('0x2f')]?_0x5bb43a[_0x005e('0x2d')]:_0x4caaee[_0x005e('0x29')];if(_0x509f70[_0x005e('0x2a')][_0x005e('0x39')]){_0x5bb43a[_0x005e('0x3a')]=[{'all':!![]}];}_0x5bb43a=_[_0x005e('0x36')]({},_0x5bb43a,_0x509f70[_0x005e('0x38')]);return db[_0x005e('0x27')][_0x005e('0x41')](_0x5bb43a)[_0x005e('0x1f')](handleEntityNotFound(_0x1e0485,null))[_0x005e('0x1f')](function(_0x196646){if(_0x196646){var _0x14e8a8=_0x196646[_0x005e('0x43')]({'plain':!![]});_0x14e8a8=qs[_0x005e('0x44')](_0x14e8a8,['id',_0x005e('0x45'),_0x005e('0x46')]);_0x509f70[_0x005e('0x47')]=_[_0x005e('0x44')](_0x509f70[_0x005e('0x47')],['id',_0x005e('0x45'),_0x005e('0x46')]);return db['Attachment']['create'](_[_0x005e('0x36')](_0x14e8a8,_0x509f70['body']),{'include':_0x509f70['query'][_0x005e('0x39')]?[{'all':!![]}]:undefined});}})[_0x005e('0x1f')](respondWithResult(_0x1e0485,0xc9))[_0x005e('0x3c')](handleError(_0x1e0485,null));};exports[_0x005e('0x1e')]=function(_0x54edb9,_0x4d8201){if(_0x54edb9[_0x005e('0x47')]['id']){delete _0x54edb9[_0x005e('0x47')]['id'];}return db[_0x005e('0x27')][_0x005e('0x41')]({'where':{'id':_0x54edb9[_0x005e('0x3e')]['id']}})[_0x005e('0x1f')](handleEntityNotFound(_0x4d8201,null))[_0x005e('0x1f')](saveUpdates(_0x54edb9[_0x005e('0x47')],null))[_0x005e('0x1f')](respondWithResult(_0x4d8201,null))['catch'](handleError(_0x4d8201,null));};exports[_0x005e('0x20')]=function(_0x416933,_0x2271ba){return db[_0x005e('0x27')][_0x005e('0x41')]({'where':{'id':_0x416933[_0x005e('0x3e')]['id']}})[_0x005e('0x1f')](handleEntityNotFound(_0x2271ba,null))[_0x005e('0x1f')](removeEntity(_0x2271ba,null))[_0x005e('0x3c')](handleError(_0x2271ba,null));};exports[_0x005e('0x48')]=function(_0xf8af4f,_0x56ed3f,_0x2b0632){_0xf8af4f[_0x005e('0x47')][_0x005e('0x23')]=_0xf8af4f['file']['originalname'];_0xf8af4f[_0x005e('0x47')]['basename']=_0xf8af4f[_0x005e('0x49')]['filename'];_0xf8af4f[_0x005e('0x47')]['type']=_0xf8af4f['file']['mimetype'];return db[_0x005e('0x27')][_0x005e('0x48')](_0xf8af4f[_0x005e('0x47')])[_0x005e('0x1f')](respondWithResult(_0x56ed3f,0xc9))[_0x005e('0x3c')](handleError(_0x56ed3f,null));};exports[_0x005e('0x4a')]=function(_0x39dabf,_0x23acbb,_0x4db463){return db[_0x005e('0x27')][_0x005e('0x4b')]({'where':{'id':_0x39dabf[_0x005e('0x3e')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x23acbb,null))[_0x005e('0x1f')](function(_0x3380fe){if(_0x3380fe){return _0x23acbb['download'](path[_0x005e('0x4c')](config[_0x005e('0x4d')],'server/files/attachments/',_0x3380fe['basename']));}})[_0x005e('0x3c')](handleError(_0x23acbb,null));}; \ No newline at end of file +var _0xd9b9=['../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','Attachment','rawAttributes','fieldName','model','map','query','filters','intersection','fields','attributes','nolimit','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','rows','show','params','keys','find','catch','clone','length','include','get','omit','createdAt','updatedAt','create','body','file','originalname','basename','download','findOne','join','root','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0xd9b9,0x198));var _0x9d9b=function(_0x3878d0,_0x50403a){_0x3878d0=_0x3878d0-0x0;var _0x52e247=_0xd9b9[_0x3878d0];return _0x52e247;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x9d9b('0x0'));var rimraf=require(_0x9d9b('0x1'));var zipdir=require(_0x9d9b('0x2'));var jsonpatch=require(_0x9d9b('0x3'));var rp=require(_0x9d9b('0x4'));var moment=require(_0x9d9b('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x9d9b('0x6'));var util=require(_0x9d9b('0x7'));var path=require(_0x9d9b('0x8'));var sox=require('sox');var csv=require(_0x9d9b('0x9'));var ejs=require(_0x9d9b('0xa'));var fs=require('fs');var _=require(_0x9d9b('0xb'));var squel=require('squel');var crypto=require(_0x9d9b('0xc'));var jsforce=require(_0x9d9b('0xd'));var deskjs=require(_0x9d9b('0xe'));var toCsv=require(_0x9d9b('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x9d9b('0xf'));var qs=require(_0x9d9b('0x10'));var as=require(_0x9d9b('0x11'));var hardwareService=require(_0x9d9b('0x12'));var logger=require(_0x9d9b('0x13'))(_0x9d9b('0x14'));var utils=require(_0x9d9b('0x15'));var config=require(_0x9d9b('0x16'));var db=require(_0x9d9b('0x17'))['db'];function respondWithStatusCode(_0x41610c,_0x4dacda){_0x4dacda=_0x4dacda||0xcc;return function(_0x42c8f5){if(_0x42c8f5){return _0x41610c[_0x9d9b('0x18')](_0x4dacda);}return _0x41610c[_0x9d9b('0x19')](_0x4dacda)[_0x9d9b('0x1a')]();};}function respondWithResult(_0x237413,_0x54f5de){_0x54f5de=_0x54f5de||0xc8;return function(_0x461f1d){if(_0x461f1d){return _0x237413[_0x9d9b('0x19')](_0x54f5de)[_0x9d9b('0x1b')](_0x461f1d);}};}function respondWithFilteredResult(_0x511c52,_0x13cef6){return function(_0x178117){if(_0x178117){var _0x4ea183=_0x178117[_0x9d9b('0x1c')],_0x40167e=_0x13cef6['offset'],_0x55cd51=_0x13cef6[_0x9d9b('0x1d')]+_0x13cef6['limit'],_0x277361;if(_0x55cd51>=_0x4ea183){_0x55cd51=_0x4ea183;_0x277361=0xc8;}else{_0x277361=0xce;}_0x511c52[_0x9d9b('0x19')](_0x277361);return _0x511c52[_0x9d9b('0x1e')](_0x9d9b('0x1f'),_0x40167e+'-'+_0x55cd51+'/'+_0x4ea183)[_0x9d9b('0x1b')](_0x178117);}return null;};}function patchUpdates(_0xd564fb){return function(_0xb00fdf){try{jsonpatch[_0x9d9b('0x20')](_0xb00fdf,_0xd564fb,!![]);}catch(_0x44c253){return BPromise['reject'](_0x44c253);}return _0xb00fdf[_0x9d9b('0x21')]();};}function saveUpdates(_0x53cc45,_0x35006c){return function(_0x558d8e){if(_0x558d8e){return _0x558d8e[_0x9d9b('0x22')](_0x53cc45)[_0x9d9b('0x23')](function(_0x55d661){return _0x55d661;});}return null;};}function removeEntity(_0x335c2f,_0x32855a){return function(_0x2735fd){if(_0x2735fd){return _0x2735fd[_0x9d9b('0x24')]()[_0x9d9b('0x23')](function(){_0x335c2f[_0x9d9b('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0xbc95ce,_0x361040){return function(_0x36796a){if(!_0x36796a){_0xbc95ce[_0x9d9b('0x18')](0x194);}return _0x36796a;};}function handleError(_0x588b12,_0x5ed1e3){_0x5ed1e3=_0x5ed1e3||0x1f4;return function(_0x2fede7){logger[_0x9d9b('0x25')](_0x2fede7[_0x9d9b('0x26')]);if(_0x2fede7[_0x9d9b('0x27')]){delete _0x2fede7[_0x9d9b('0x27')];}_0x588b12[_0x9d9b('0x19')](_0x5ed1e3)[_0x9d9b('0x28')](_0x2fede7);};}exports[_0x9d9b('0x29')]=function(_0x233fdc,_0x227ba0){var _0x10f8e7={},_0x2c2be3={},_0x4d7047={'count':0x0,'rows':[]};var _0x57535e=_['map'](db[_0x9d9b('0x2a')][_0x9d9b('0x2b')],function(_0x27b148){return{'name':_0x27b148[_0x9d9b('0x2c')],'type':_0x27b148['type']['key']};});_0x2c2be3[_0x9d9b('0x2d')]=_[_0x9d9b('0x2e')](_0x57535e,_0x9d9b('0x27'));_0x2c2be3['query']=_['keys'](_0x233fdc[_0x9d9b('0x2f')]);_0x2c2be3[_0x9d9b('0x30')]=_[_0x9d9b('0x31')](_0x2c2be3[_0x9d9b('0x2d')],_0x2c2be3['query']);_0x10f8e7['attributes']=_['intersection'](_0x2c2be3[_0x9d9b('0x2d')],qs['fields'](_0x233fdc['query'][_0x9d9b('0x32')]));_0x10f8e7[_0x9d9b('0x33')]=_0x10f8e7[_0x9d9b('0x33')]['length']?_0x10f8e7[_0x9d9b('0x33')]:_0x2c2be3[_0x9d9b('0x2d')];if(!_0x233fdc['query']['hasOwnProperty'](_0x9d9b('0x34'))){_0x10f8e7[_0x9d9b('0x35')]=qs[_0x9d9b('0x35')](_0x233fdc[_0x9d9b('0x2f')][_0x9d9b('0x35')]);_0x10f8e7[_0x9d9b('0x1d')]=qs[_0x9d9b('0x1d')](_0x233fdc['query'][_0x9d9b('0x1d')]);}_0x10f8e7[_0x9d9b('0x36')]=qs[_0x9d9b('0x37')](_0x233fdc[_0x9d9b('0x2f')][_0x9d9b('0x37')]);_0x10f8e7[_0x9d9b('0x38')]=qs[_0x9d9b('0x30')](_[_0x9d9b('0x39')](_0x233fdc[_0x9d9b('0x2f')],_0x2c2be3[_0x9d9b('0x30')]),_0x57535e);if(_0x233fdc['query'][_0x9d9b('0x3a')]){_0x10f8e7['where']=_[_0x9d9b('0x3b')](_0x10f8e7[_0x9d9b('0x38')],{'$or':_['map'](_0x57535e,function(_0x4dd044){if(_0x4dd044[_0x9d9b('0x3c')]!==_0x9d9b('0x3d')){var _0x488c08={};_0x488c08[_0x4dd044['name']]={'$like':'%'+_0x233fdc['query'][_0x9d9b('0x3a')]+'%'};return _0x488c08;}})});}_0x10f8e7=_['merge']({},_0x10f8e7,_0x233fdc[_0x9d9b('0x3e')]);var _0x96d9bc={'where':_0x10f8e7[_0x9d9b('0x38')]};return db[_0x9d9b('0x2a')][_0x9d9b('0x1c')](_0x96d9bc)['then'](function(_0xa20ab6){_0x4d7047[_0x9d9b('0x1c')]=_0xa20ab6;if(_0x233fdc['query'][_0x9d9b('0x3f')]){_0x10f8e7['include']=[{'all':!![]}];}return db['Attachment']['findAll'](_0x10f8e7);})[_0x9d9b('0x23')](function(_0x43abf0){_0x4d7047[_0x9d9b('0x40')]=_0x43abf0;return _0x4d7047;})[_0x9d9b('0x23')](respondWithFilteredResult(_0x227ba0,_0x10f8e7))['catch'](handleError(_0x227ba0,null));};exports[_0x9d9b('0x41')]=function(_0x39e6a8,_0x337d04){var _0x5d246a={'raw':!![],'where':{'id':_0x39e6a8[_0x9d9b('0x42')]['id']}},_0x2785a8={};_0x2785a8[_0x9d9b('0x2d')]=_[_0x9d9b('0x43')](db[_0x9d9b('0x2a')][_0x9d9b('0x2b')]);_0x2785a8['query']=_[_0x9d9b('0x43')](_0x39e6a8['query']);_0x2785a8[_0x9d9b('0x30')]=_[_0x9d9b('0x31')](_0x2785a8['model'],_0x2785a8[_0x9d9b('0x2f')]);_0x5d246a[_0x9d9b('0x33')]=_[_0x9d9b('0x31')](_0x2785a8[_0x9d9b('0x2d')],qs[_0x9d9b('0x32')](_0x39e6a8[_0x9d9b('0x2f')]['fields']));_0x5d246a['attributes']=_0x5d246a[_0x9d9b('0x33')]['length']?_0x5d246a['attributes']:_0x2785a8[_0x9d9b('0x2d')];if(_0x39e6a8['query'][_0x9d9b('0x3f')]){_0x5d246a['include']=[{'all':!![]}];}_0x5d246a=_[_0x9d9b('0x3b')]({},_0x5d246a,_0x39e6a8[_0x9d9b('0x3e')]);return db[_0x9d9b('0x2a')][_0x9d9b('0x44')](_0x5d246a)[_0x9d9b('0x23')](handleEntityNotFound(_0x337d04,null))[_0x9d9b('0x23')](respondWithResult(_0x337d04,null))[_0x9d9b('0x45')](handleError(_0x337d04,null));};exports[_0x9d9b('0x46')]=function(_0x16ee2a,_0x501db4){var _0x4aa55d={'where':{'id':_0x16ee2a[_0x9d9b('0x42')]['id']}},_0xc34a={};_0xc34a[_0x9d9b('0x2d')]=_[_0x9d9b('0x43')](db[_0x9d9b('0x2a')]['rawAttributes']);_0x4aa55d['attributes']=_['intersection'](_0xc34a['model'],qs[_0x9d9b('0x32')](_0x16ee2a['query'][_0x9d9b('0x32')]));_0x4aa55d['attributes']=_0x4aa55d[_0x9d9b('0x33')][_0x9d9b('0x47')]?_0x4aa55d[_0x9d9b('0x33')]:_0xc34a['model'];if(_0x16ee2a[_0x9d9b('0x2f')][_0x9d9b('0x3f')]){_0x4aa55d[_0x9d9b('0x48')]=[{'all':!![]}];}_0x4aa55d=_[_0x9d9b('0x3b')]({},_0x4aa55d,_0x16ee2a['options']);return db[_0x9d9b('0x2a')][_0x9d9b('0x44')](_0x4aa55d)['then'](handleEntityNotFound(_0x501db4,null))['then'](function(_0x12ac07){if(_0x12ac07){var _0x42e436=_0x12ac07[_0x9d9b('0x49')]({'plain':!![]});_0x42e436=qs[_0x9d9b('0x4a')](_0x42e436,['id',_0x9d9b('0x4b'),_0x9d9b('0x4c')]);_0x16ee2a['body']=_['omit'](_0x16ee2a['body'],['id',_0x9d9b('0x4b'),_0x9d9b('0x4c')]);return db[_0x9d9b('0x2a')][_0x9d9b('0x4d')](_[_0x9d9b('0x3b')](_0x42e436,_0x16ee2a[_0x9d9b('0x4e')]),{'include':_0x16ee2a[_0x9d9b('0x2f')][_0x9d9b('0x3f')]?[{'all':!![]}]:undefined});}})[_0x9d9b('0x23')](respondWithResult(_0x501db4,0xc9))['catch'](handleError(_0x501db4,null));};exports[_0x9d9b('0x22')]=function(_0x33783a,_0x27e2a4){if(_0x33783a[_0x9d9b('0x4e')]['id']){delete _0x33783a['body']['id'];}return db[_0x9d9b('0x2a')]['find']({'where':{'id':_0x33783a[_0x9d9b('0x42')]['id']}})[_0x9d9b('0x23')](handleEntityNotFound(_0x27e2a4,null))[_0x9d9b('0x23')](saveUpdates(_0x33783a[_0x9d9b('0x4e')],null))[_0x9d9b('0x23')](respondWithResult(_0x27e2a4,null))[_0x9d9b('0x45')](handleError(_0x27e2a4,null));};exports[_0x9d9b('0x24')]=function(_0x46073d,_0x2f11ad){return db['Attachment']['find']({'where':{'id':_0x46073d[_0x9d9b('0x42')]['id']}})[_0x9d9b('0x23')](handleEntityNotFound(_0x2f11ad,null))[_0x9d9b('0x23')](removeEntity(_0x2f11ad,null))[_0x9d9b('0x45')](handleError(_0x2f11ad,null));};exports[_0x9d9b('0x4d')]=function(_0x5a3d05,_0x14e688,_0xce01e2){_0x5a3d05[_0x9d9b('0x4e')][_0x9d9b('0x27')]=_0x5a3d05[_0x9d9b('0x4f')][_0x9d9b('0x50')];_0x5a3d05[_0x9d9b('0x4e')][_0x9d9b('0x51')]=_0x5a3d05[_0x9d9b('0x4f')]['filename'];_0x5a3d05[_0x9d9b('0x4e')]['type']=_0x5a3d05['file']['mimetype'];return db[_0x9d9b('0x2a')]['create'](_0x5a3d05[_0x9d9b('0x4e')])['then'](respondWithResult(_0x14e688,0xc9))[_0x9d9b('0x45')](handleError(_0x14e688,null));};exports[_0x9d9b('0x52')]=function(_0x5268be,_0x56a5ff,_0x1749d4){return db['Attachment'][_0x9d9b('0x53')]({'where':{'id':_0x5268be[_0x9d9b('0x42')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x56a5ff,null))[_0x9d9b('0x23')](function(_0x4f7b4a){if(_0x4f7b4a){return _0x56a5ff[_0x9d9b('0x52')](path[_0x9d9b('0x54')](config[_0x9d9b('0x55')],'server/files/attachments/',_0x4f7b4a[_0x9d9b('0x51')]));}})[_0x9d9b('0x45')](handleError(_0x56a5ff,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index fe59ed3..7597168 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 _0x40ac=['api','moment','bluebird','request-promise','path','rimraf','./attachment.attributes','exports','Attachment','attachments','lodash','../../config/logger'];(function(_0x31624d,_0x5d502b){var _0x5cb843=function(_0x5bb9d4){while(--_0x5bb9d4){_0x31624d['push'](_0x31624d['shift']());}};_0x5cb843(++_0x5d502b);}(_0x40ac,0x1de));var _0xc40a=function(_0xf3768d,_0x4902ff){_0xf3768d=_0xf3768d-0x0;var _0x540bf8=_0x40ac[_0xf3768d];return _0x540bf8;};'use strict';var _=require(_0xc40a('0x0'));var util=require('util');var logger=require(_0xc40a('0x1'))(_0xc40a('0x2'));var moment=require(_0xc40a('0x3'));var BPromise=require(_0xc40a('0x4'));var rp=require(_0xc40a('0x5'));var fs=require('fs');var path=require(_0xc40a('0x6'));var rimraf=require(_0xc40a('0x7'));var config=require('../../config/environment');var attributes=require(_0xc40a('0x8'));module[_0xc40a('0x9')]=function(_0xd6d891,_0x5e179f){return _0xd6d891['define'](_0xc40a('0xa'),attributes,{'tableName':_0xc40a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x390a=['api','bluebird','request-promise','path','rimraf','./attachment.attributes','exports','define','Attachment','lodash','util','../../config/logger'];(function(_0xc8a11,_0x347a33){var _0x55a500=function(_0x288d05){while(--_0x288d05){_0xc8a11['push'](_0xc8a11['shift']());}};_0x55a500(++_0x347a33);}(_0x390a,0xc9));var _0xa390=function(_0x4c2c0b,_0x1d2248){_0x4c2c0b=_0x4c2c0b-0x0;var _0x3b5f0c=_0x390a[_0x4c2c0b];return _0x3b5f0c;};'use strict';var _=require(_0xa390('0x0'));var util=require(_0xa390('0x1'));var logger=require(_0xa390('0x2'))(_0xa390('0x3'));var moment=require('moment');var BPromise=require(_0xa390('0x4'));var rp=require(_0xa390('0x5'));var fs=require('fs');var path=require(_0xa390('0x6'));var rimraf=require(_0xa390('0x7'));var config=require('../../config/environment');var attributes=require(_0xa390('0x8'));module[_0xa390('0x9')]=function(_0x3d7cd7,_0x4ac9f5){return _0x3d7cd7[_0xa390('0xa')](_0xa390('0xb'),attributes,{'tableName':'attachments','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/attachment/attachment.rpc.js b/server/api/attachment/attachment.rpc.js index 5514ba9..9e9bf39 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 _0x9aa2=['http','request','then','info','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','Attachment,\x20%s,\x20%s','message','result','catch','options','raw','CreateAttachment','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x9aa2,0x150));var _0x29aa=function(_0x1d43e0,_0x1d7934){_0x1d43e0=_0x1d43e0-0x0;var _0x3c0983=_0x9aa2[_0x1d43e0];return _0x3c0983;};'use strict';var _=require(_0x29aa('0x0'));var util=require(_0x29aa('0x1'));var moment=require(_0x29aa('0x2'));var BPromise=require(_0x29aa('0x3'));var rs=require(_0x29aa('0x4'));var fs=require('fs');var Redis=require(_0x29aa('0x5'));var db=require(_0x29aa('0x6'))['db'];var utils=require(_0x29aa('0x7'));var logger=require(_0x29aa('0x8'))(_0x29aa('0x9'));var config=require('../../config/environment');var jayson=require(_0x29aa('0xa'));var client=jayson[_0x29aa('0xb')][_0x29aa('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x303dc3,_0x521084,_0x9ab4d3){return new BPromise(function(_0x44258c,_0x75e319){return client[_0x29aa('0xd')](_0x303dc3,_0x9ab4d3)[_0x29aa('0xe')](function(_0xa0e2d5){logger[_0x29aa('0xf')]('Attachment,\x20%s,\x20%s',_0x521084,_0x29aa('0x10'));logger[_0x29aa('0x11')](_0x29aa('0x12'),_0x521084,'request\x20sent',JSON[_0x29aa('0x13')](_0xa0e2d5));if(_0xa0e2d5[_0x29aa('0x14')]){if(_0xa0e2d5['error'][_0x29aa('0x15')]===0x1f4){logger[_0x29aa('0x14')](_0x29aa('0x16'),_0x521084,_0xa0e2d5[_0x29aa('0x14')]['message']);return _0x75e319(_0xa0e2d5[_0x29aa('0x14')]['message']);}logger[_0x29aa('0x14')](_0x29aa('0x16'),_0x521084,_0xa0e2d5['error'][_0x29aa('0x17')]);return _0x44258c(_0xa0e2d5[_0x29aa('0x14')]['message']);}else{logger['info'](_0x29aa('0x16'),_0x521084,'request\x20sent');_0x44258c(_0xa0e2d5[_0x29aa('0x18')][_0x29aa('0x17')]);}})[_0x29aa('0x19')](function(_0x4f94ed){logger['error'](_0x29aa('0x16'),_0x521084,_0x4f94ed);_0x75e319(_0x4f94ed);});});}exports['CreateAttachment']=function(_0x97dc67){var _0x21759f=this;return new Promise(function(_0x5a43dc,_0x19d525){return db['Attachment']['create'](_0x97dc67['body'],{'raw':_0x97dc67[_0x29aa('0x1a')]?_0x97dc67[_0x29aa('0x1a')][_0x29aa('0x1b')]===undefined?!![]:![]:!![]})[_0x29aa('0xe')](function(_0x293d1b){logger[_0x29aa('0xf')](_0x29aa('0x1c'),_0x97dc67);logger[_0x29aa('0x11')](_0x29aa('0x1c'),_0x97dc67,JSON['stringify'](_0x293d1b));_0x5a43dc(_0x293d1b);})[_0x29aa('0x19')](function(_0x22c59f){logger['error'](_0x29aa('0x1c'),_0x22c59f[_0x29aa('0x17')],_0x97dc67);_0x19d525(_0x21759f[_0x29aa('0x14')](0x1f4,_0x22c59f['message']));});});}; \ No newline at end of file +var _0xc731=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','Attachment,\x20%s,\x20%s,\x20%s','error','code','Attachment,\x20%s,\x20%s','message','result','catch','CreateAttachment','Attachment','body','options','raw','debug','lodash','moment'];(function(_0x23292a,_0x1e08ea){var _0x4564f2=function(_0x1ae201){while(--_0x1ae201){_0x23292a['push'](_0x23292a['shift']());}};_0x4564f2(++_0x1e08ea);}(_0xc731,0xc9));var _0x1c73=function(_0x5e1049,_0x58bb85){_0x5e1049=_0x5e1049-0x0;var _0x277bb5=_0xc731[_0x5e1049];return _0x277bb5;};'use strict';var _=require(_0x1c73('0x0'));var util=require('util');var moment=require(_0x1c73('0x1'));var BPromise=require(_0x1c73('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1c73('0x3'));var db=require(_0x1c73('0x4'))['db'];var utils=require(_0x1c73('0x5'));var logger=require(_0x1c73('0x6'))(_0x1c73('0x7'));var config=require(_0x1c73('0x8'));var jayson=require(_0x1c73('0x9'));var client=jayson[_0x1c73('0xa')][_0x1c73('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x52b43e,_0x2b6e6a,_0x5a2f76){return new BPromise(function(_0x2fa42d,_0x12bb4c){return client[_0x1c73('0xc')](_0x52b43e,_0x5a2f76)[_0x1c73('0xd')](function(_0x33910c){logger[_0x1c73('0xe')]('Attachment,\x20%s,\x20%s',_0x2b6e6a,_0x1c73('0xf'));logger['debug'](_0x1c73('0x10'),_0x2b6e6a,_0x1c73('0xf'),JSON['stringify'](_0x33910c));if(_0x33910c[_0x1c73('0x11')]){if(_0x33910c[_0x1c73('0x11')][_0x1c73('0x12')]===0x1f4){logger[_0x1c73('0x11')](_0x1c73('0x13'),_0x2b6e6a,_0x33910c[_0x1c73('0x11')]['message']);return _0x12bb4c(_0x33910c['error'][_0x1c73('0x14')]);}logger[_0x1c73('0x11')](_0x1c73('0x13'),_0x2b6e6a,_0x33910c[_0x1c73('0x11')]['message']);return _0x2fa42d(_0x33910c[_0x1c73('0x11')][_0x1c73('0x14')]);}else{logger[_0x1c73('0xe')](_0x1c73('0x13'),_0x2b6e6a,'request\x20sent');_0x2fa42d(_0x33910c[_0x1c73('0x15')]['message']);}})[_0x1c73('0x16')](function(_0x19527a){logger[_0x1c73('0x11')]('Attachment,\x20%s,\x20%s',_0x2b6e6a,_0x19527a);_0x12bb4c(_0x19527a);});});}exports[_0x1c73('0x17')]=function(_0x275cd7){var _0x43894c=this;return new Promise(function(_0x12e30d,_0x157a5c){return db[_0x1c73('0x18')]['create'](_0x275cd7[_0x1c73('0x19')],{'raw':_0x275cd7[_0x1c73('0x1a')]?_0x275cd7[_0x1c73('0x1a')][_0x1c73('0x1b')]===undefined?!![]:![]:!![]})[_0x1c73('0xd')](function(_0x1e49d4){logger[_0x1c73('0xe')](_0x1c73('0x17'),_0x275cd7);logger[_0x1c73('0x1c')](_0x1c73('0x17'),_0x275cd7,JSON['stringify'](_0x1e49d4));_0x12e30d(_0x1e49d4);})[_0x1c73('0x16')](function(_0x4975e7){logger[_0x1c73('0x11')](_0x1c73('0x17'),_0x4975e7['message'],_0x275cd7);_0x157a5c(_0x43894c[_0x1c73('0x11')](0x1f4,_0x4975e7['message']));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index bd47d3b..87b6f18 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 _0xc26e=['Router','../../components/auth/service','../../components/interaction/service','./attachment.controller','index','get','/:id','/:id/download','isAuthenticated','download','post','/:id/clone','clone','diskStorage','join','server/files/attachments/','format','%s-%s','now','originalname','replace','single','create','update','delete','destroy','exports','path','express'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc26e,0x103));var _0xec26=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc26e[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xec26('0x0'));var timeout=require('connect-timeout');var express=require(_0xec26('0x1'));var router=express[_0xec26('0x2')]();var auth=require(_0xec26('0x3'));var interaction=require(_0xec26('0x4'));var config=require('../../config/environment');var controller=require(_0xec26('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0xec26('0x6')]);router[_0xec26('0x7')](_0xec26('0x8'),auth['isAuthenticated'](),controller['show']);router[_0xec26('0x7')](_0xec26('0x9'),auth[_0xec26('0xa')](),controller[_0xec26('0xb')]);router[_0xec26('0xc')](_0xec26('0xd'),auth[_0xec26('0xa')](),controller[_0xec26('0xe')]);var upload=multer({'storage':multer[_0xec26('0xf')]({'destination':function(_0x1faf39,_0x4bbb5f,_0x5ada9d){_0x5ada9d(null,path[_0xec26('0x10')](config['root'],_0xec26('0x11')));},'filename':function(_0x5b42a9,_0x59ad16,_0x545660){_0x545660(null,util[_0xec26('0x12')](_0xec26('0x13'),Date[_0xec26('0x14')](),_0x59ad16[_0xec26('0x15')][_0xec26('0x16')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xec26('0xc')]('/',upload[_0xec26('0x17')]('file'),controller[_0xec26('0x18')]);router['put'](_0xec26('0x8'),auth[_0xec26('0xa')](),controller[_0xec26('0x19')]);router[_0xec26('0x1a')](_0xec26('0x8'),auth['isAuthenticated'](),controller[_0xec26('0x1b')]);module[_0xec26('0x1c')]=router; \ No newline at end of file +var _0x0554=['format','now','single','file','create','put','update','delete','destroy','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','show','/:id/download','post','/:id/clone','diskStorage','join','root'];(function(_0x1fcf2c,_0x14f8ad){var _0x47fe4a=function(_0x540acd){while(--_0x540acd){_0x1fcf2c['push'](_0x1fcf2c['shift']());}};_0x47fe4a(++_0x14f8ad);}(_0x0554,0x176));var _0x4055=function(_0x236d24,_0x29e80a){_0x236d24=_0x236d24-0x0;var _0x1574cf=_0x0554[_0x236d24];return _0x1574cf;};'use strict';var multer=require(_0x4055('0x0'));var util=require(_0x4055('0x1'));var path=require('path');var timeout=require(_0x4055('0x2'));var express=require('express');var router=express[_0x4055('0x3')]();var auth=require(_0x4055('0x4'));var interaction=require(_0x4055('0x5'));var config=require(_0x4055('0x6'));var controller=require('./attachment.controller');router['get']('/',auth[_0x4055('0x7')](),controller[_0x4055('0x8')]);router['get']('/:id',auth[_0x4055('0x7')](),controller[_0x4055('0x9')]);router['get'](_0x4055('0xa'),auth[_0x4055('0x7')](),controller['download']);router[_0x4055('0xb')](_0x4055('0xc'),auth[_0x4055('0x7')](),controller['clone']);var upload=multer({'storage':multer[_0x4055('0xd')]({'destination':function(_0x49f69b,_0x2dc912,_0x150fe7){_0x150fe7(null,path[_0x4055('0xe')](config[_0x4055('0xf')],'server/files/attachments/'));},'filename':function(_0x5dcc55,_0x44b64b,_0x5b019c){_0x5b019c(null,util[_0x4055('0x10')]('%s-%s',Date[_0x4055('0x11')](),_0x44b64b['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x4055('0xb')]('/',upload[_0x4055('0x12')](_0x4055('0x13')),controller[_0x4055('0x14')]);router[_0x4055('0x15')]('/:id',auth[_0x4055('0x7')](),controller[_0x4055('0x16')]);router[_0x4055('0x17')]('/:id',auth[_0x4055('0x7')](),controller[_0x4055('0x18')]);module[_0x4055('0x19')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index d456558..2966a51 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 _0xbca5=['value','admin','user','agent','then','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blocked','blockedAt','add','blockDuration','clearBlockUser','getLicense','catch','lodash','passport-google-oauth20','../../config/environment','../../components/auth/service','signToken','../../config/utils','login','authenticate','google','/login','email','use','clientSecret','findOne','User','emails'];(function(_0x1f7bc9,_0xd2e513){var _0x4c470b=function(_0x35ed26){while(--_0x35ed26){_0x1f7bc9['push'](_0x1f7bc9['shift']());}};_0x4c470b(++_0xd2e513);}(_0xbca5,0x1dd));var _0x5bca=function(_0x53972e,_0x275c){_0x53972e=_0x53972e-0x0;var _0xc48fcf=_0xbca5[_0x53972e];return _0xc48fcf;};'use strict';var _=require(_0x5bca('0x0'));var passport=require('passport');var GoogleStrategy=require(_0x5bca('0x1'))['Strategy'];var moment=require('moment');var db=require('../../mysqldb')['db'];var config=require(_0x5bca('0x2'));var signToken=require(_0x5bca('0x3'))[_0x5bca('0x4')];var utils=require(_0x5bca('0x5'));exports[_0x5bca('0x6')]=passport[_0x5bca('0x7')](_0x5bca('0x8'),{'failureRedirect':_0x5bca('0x9'),'scope':['profile',_0x5bca('0xa')],'session':![]});exports['callback']=passport[_0x5bca('0x7')](_0x5bca('0x8'),{'failureRedirect':_0x5bca('0x9'),'session':![]});passport[_0x5bca('0xb')](new GoogleStrategy({'clientID':config[_0x5bca('0x8')]?config[_0x5bca('0x8')]['clientID']:'id','clientSecret':config[_0x5bca('0x8')]?config[_0x5bca('0x8')][_0x5bca('0xc')]:'secret','callbackURL':config[_0x5bca('0x8')]?config[_0x5bca('0x8')]['callbackURL']:''},function(_0x1045af,_0x22b08a,_0x3d05f8,_0x157929){var _0x179e18,_0x18d529;return db['Setting'][_0x5bca('0xd')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts','blockDuration'],'raw':!![]})['then'](function(_0x47c128){_0x179e18=_0x47c128;return db[_0x5bca('0xe')]['find']({'where':{'email':_['map'](_0x3d05f8[_0x5bca('0xf')],_0x5bca('0x10')),'role':{'$or':[_0x5bca('0x11'),_0x5bca('0x12'),_0x5bca('0x13')]}}});})[_0x5bca('0x14')](function(_0x46f877){_0x18d529=_0x46f877;if(_0x18d529){if(_0x18d529['disabled']){return _0x157929(_0x5bca('0x15'));}else if(_0x179e18['blockDuration']>0x0){if(_0x18d529[_0x5bca('0x16')]){if(moment(_0x18d529[_0x5bca('0x17')])[_0x5bca('0x18')](_0x179e18[_0x5bca('0x19')],'minutes')>moment()){return _0x157929('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{return utils[_0x5bca('0x1a')](_0x18d529,0x0,![],null)[_0x5bca('0x14')](function(){return utils['getLicense'](_0x18d529);})[_0x5bca('0x14')](function(){return _0x157929(null,_0x18d529);});}}else{return utils[_0x5bca('0x1b')](_0x18d529)[_0x5bca('0x14')](function(){return _0x157929(null,_0x18d529);});}}else{return utils[_0x5bca('0x1b')](_0x18d529)[_0x5bca('0x14')](function(){return _0x157929(null,_0x18d529);});}}return _0x157929('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');})[_0x5bca('0x1c')](function(_0x51ff72){_0x157929(_0x51ff72);});})); \ No newline at end of file +var _0x59a1=['callbackURL','findOne','allowedLoginAttempts','blockDuration','User','find','map','emails','value','admin','user','agent','then','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blocked','blockedAt','add','minutes','clearBlockUser','getLicense','catch','passport','passport-google-oauth20','Strategy','../../mysqldb','../../components/auth/service','signToken','../../config/utils','login','authenticate','google','/login','profile','callback','use','clientID','clientSecret','secret'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0x59a1,0x64));var _0x159a=function(_0x524392,_0x1f1265){_0x524392=_0x524392-0x0;var _0x522255=_0x59a1[_0x524392];return _0x522255;};'use strict';var _=require('lodash');var passport=require(_0x159a('0x0'));var GoogleStrategy=require(_0x159a('0x1'))[_0x159a('0x2')];var moment=require('moment');var db=require(_0x159a('0x3'))['db'];var config=require('../../config/environment');var signToken=require(_0x159a('0x4'))[_0x159a('0x5')];var utils=require(_0x159a('0x6'));exports[_0x159a('0x7')]=passport[_0x159a('0x8')](_0x159a('0x9'),{'failureRedirect':_0x159a('0xa'),'scope':[_0x159a('0xb'),'email'],'session':![]});exports[_0x159a('0xc')]=passport[_0x159a('0x8')](_0x159a('0x9'),{'failureRedirect':_0x159a('0xa'),'session':![]});passport[_0x159a('0xd')](new GoogleStrategy({'clientID':config[_0x159a('0x9')]?config[_0x159a('0x9')][_0x159a('0xe')]:'id','clientSecret':config[_0x159a('0x9')]?config[_0x159a('0x9')][_0x159a('0xf')]:_0x159a('0x10'),'callbackURL':config[_0x159a('0x9')]?config[_0x159a('0x9')][_0x159a('0x11')]:''},function(_0x4b6331,_0x1bdafb,_0x3104f4,_0x39c1ba){var _0x56a322,_0x4739b7;return db['Setting'][_0x159a('0x12')]({'where':{'id':0x1},'attributes':[_0x159a('0x13'),_0x159a('0x14')],'raw':!![]})['then'](function(_0x2be907){_0x56a322=_0x2be907;return db[_0x159a('0x15')][_0x159a('0x16')]({'where':{'email':_[_0x159a('0x17')](_0x3104f4[_0x159a('0x18')],_0x159a('0x19')),'role':{'$or':[_0x159a('0x1a'),_0x159a('0x1b'),_0x159a('0x1c')]}}});})[_0x159a('0x1d')](function(_0x4d80bf){_0x4739b7=_0x4d80bf;if(_0x4739b7){if(_0x4739b7[_0x159a('0x1e')]){return _0x39c1ba(_0x159a('0x1f'));}else if(_0x56a322['blockDuration']>0x0){if(_0x4739b7[_0x159a('0x20')]){if(moment(_0x4739b7[_0x159a('0x21')])[_0x159a('0x22')](_0x56a322[_0x159a('0x14')],_0x159a('0x23'))>moment()){return _0x39c1ba(_0x159a('0x1f'));}else{return utils[_0x159a('0x24')](_0x4739b7,0x0,![],null)[_0x159a('0x1d')](function(){return utils[_0x159a('0x25')](_0x4739b7);})[_0x159a('0x1d')](function(){return _0x39c1ba(null,_0x4739b7);});}}else{return utils[_0x159a('0x25')](_0x4739b7)[_0x159a('0x1d')](function(){return _0x39c1ba(null,_0x4739b7);});}}else{return utils[_0x159a('0x25')](_0x4739b7)['then'](function(){return _0x39c1ba(null,_0x4739b7);});}}return _0x39c1ba(_0x159a('0x1f'));})[_0x159a('0x26')](function(_0x44bc37){_0x39c1ba(_0x44bc37);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 3b42e31..1414b8b 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 _0x581a=['get','login','callback','setTokenCookie','exports','express','passport','./authGoogle.controller','../user/user.controller.js','../../components/auth/service'];(function(_0x9729d7,_0x1b79a8){var _0x3c4ac6=function(_0x401ba6){while(--_0x401ba6){_0x9729d7['push'](_0x9729d7['shift']());}};_0x3c4ac6(++_0x1b79a8);}(_0x581a,0x127));var _0xa581=function(_0x3fab74,_0x5bbebe){_0x3fab74=_0x3fab74-0x0;var _0x4e0112=_0x581a[_0x3fab74];return _0x4e0112;};'use strict';var express=require(_0xa581('0x0'));var passport=require(_0xa581('0x1'));var router=express['Router']();var controller=require(_0xa581('0x2'));var userController=require(_0xa581('0x3'));var authService=require(_0xa581('0x4'));router[_0xa581('0x5')]('/',controller[_0xa581('0x6')]);router['get']('/callback',controller[_0xa581('0x7')],authService['isMiddleware'],userController[_0xa581('0x6')],authService[_0xa581('0x8')]);module[_0xa581('0x9')]=router; \ No newline at end of file +var _0x9ef8=['../../components/auth/service','login','get','setTokenCookie','exports','express','passport','./authGoogle.controller','../user/user.controller.js'];(function(_0x205123,_0x240ebe){var _0x5b69fb=function(_0x488aaf){while(--_0x488aaf){_0x205123['push'](_0x205123['shift']());}};_0x5b69fb(++_0x240ebe);}(_0x9ef8,0x17f));var _0x89ef=function(_0x3a99f4,_0x2a81c1){_0x3a99f4=_0x3a99f4-0x0;var _0xea0b42=_0x9ef8[_0x3a99f4];return _0xea0b42;};'use strict';var express=require(_0x89ef('0x0'));var passport=require(_0x89ef('0x1'));var router=express['Router']();var controller=require(_0x89ef('0x2'));var userController=require(_0x89ef('0x3'));var authService=require(_0x89ef('0x4'));router['get']('/',controller[_0x89ef('0x5')]);router[_0x89ef('0x6')]('/callback',controller['callback'],authService['isMiddleware'],userController[_0x89ef('0x5')],authService[_0x89ef('0x7')]);module[_0x89ef('0x8')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 252b43e..81efdcc 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 _0xd072=['agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','allowedLoginAttempts','add','minutes','clearBlockUser','getLicense','catch','find','MailServerOut','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','Smtp','service','host','port','secure','authentication','auth','merge','\x22%s\x22\x20<%s>','email','error','format','message','stringify','status','send','test','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','forgot','body','Email\x20parameter\x20is\x20missing','generate','trim','toLowerCase','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','save','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','http://','/reset/','Reset\x20Email\x20sent!','reset','User','params','token','now','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','Password\x20reset!','util','passport','passport-local','Strategy','jayson/promise','lodash','randomstring','../../mysqldb','../../components/auth/service','../../config/utils','client','http','Setting','findOne','blockDuration','then','name','password','salt','role','disabled','blocked','blockedAt','loginAttempts','admin','user'];(function(_0x22205c,_0x473493){var _0x3f5efe=function(_0x153dbb){while(--_0x153dbb){_0x22205c['push'](_0x22205c['shift']());}};_0x3f5efe(++_0x473493);}(_0xd072,0x132));var _0x2d07=function(_0x202821,_0x3c1559){_0x202821=_0x202821-0x0;var _0xea50f0=_0xd072[_0x202821];return _0xea50f0;};'use strict';var util=require(_0x2d07('0x0'));var passport=require(_0x2d07('0x1'));var LocalStrategy=require(_0x2d07('0x2'))[_0x2d07('0x3')];var jayson=require(_0x2d07('0x4'));var _=require(_0x2d07('0x5'));var rs=require(_0x2d07('0x6'));var moment=require('moment');var db=require(_0x2d07('0x7'))['db'];var authService=require(_0x2d07('0x8'));var utils=require(_0x2d07('0x9'));var client=jayson[_0x2d07('0xa')][_0x2d07('0xb')]({'port':0x232b});function localAuthenticate(_0x51aae0,_0x1a992a,_0x429d2c,_0x367834){var _0x19d04c,_0x167c61;return db[_0x2d07('0xc')][_0x2d07('0xd')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x2d07('0xe')],'raw':!![]})[_0x2d07('0xf')](function(_0xa67a15){_0x19d04c=_0xa67a15;return _0x51aae0[_0x2d07('0xd')]({'attributes':['id',_0x2d07('0x10'),_0x2d07('0x11'),_0x2d07('0x12'),_0x2d07('0x13'),_0x2d07('0x14'),_0x2d07('0x15'),_0x2d07('0x16'),_0x2d07('0x17')],'where':{'name':_0x1a992a,'role':{'$or':[_0x2d07('0x18'),_0x2d07('0x19'),_0x2d07('0x1a')]}}});})[_0x2d07('0xf')](function(_0xe8f25f){if(!_0xe8f25f||_0xe8f25f&&_0xe8f25f[_0x2d07('0x10')]!==_0x1a992a){throw new Error(_0x2d07('0x1b'));}else{_0x167c61=_0xe8f25f;return _0x167c61;}})[_0x2d07('0xf')](function(){_0x167c61[_0x2d07('0x1c')](_0x429d2c,function(_0x17eb30,_0x2daa2b){var _0x3a9aa5=_0x167c61[_0x2d07('0x17')]+0x1;if(_0x17eb30){return _0x367834(_0x17eb30);}else if(!_0x2daa2b){if(_0x167c61['disabled']){return _0x367834(null,![],{'message':_0x2d07('0x1b')});}else if(_0x19d04c[_0x2d07('0x1d')]>0x0){if(_0x167c61[_0x2d07('0x15')]){if(_0x19d04c[_0x2d07('0xe')]>0x0){if(moment(_0x167c61[_0x2d07('0x16')])[_0x2d07('0x1e')](_0x19d04c[_0x2d07('0xe')],_0x2d07('0x1f'))>moment()){return _0x367834(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x2d07('0x20')](_0x167c61,_0x3a9aa5,![],null)[_0x2d07('0xf')](function(){return _0x367834(null,![],{'message':_0x2d07('0x1b')});});}}else{return _0x367834(null,![],{'message':_0x2d07('0x1b')});}}else{if(_0x3a9aa5>=_0x19d04c['allowedLoginAttempts']){return utils[_0x2d07('0x20')](_0x167c61,0x0,!![],moment())[_0x2d07('0xf')](function(){return _0x367834(null,![],{'message':_0x2d07('0x1b')});});}else{return utils[_0x2d07('0x20')](_0x167c61,_0x3a9aa5,![],null)[_0x2d07('0xf')](function(){return _0x367834(null,![],{'message':_0x2d07('0x1b')});});}}}else{return _0x367834(null,![],{'message':_0x2d07('0x1b')});}}else{if(_0x167c61[_0x2d07('0x14')]){return _0x367834(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x19d04c[_0x2d07('0x1d')]>0x0){if(_0x167c61[_0x2d07('0x15')]){if(_0x19d04c[_0x2d07('0xe')]>0x0){if(moment(_0x167c61['blockedAt'])[_0x2d07('0x1e')](_0x19d04c['blockDuration'],_0x2d07('0x1f'))>moment()){return _0x367834(null,![],{'message':_0x2d07('0x1b')});}else{return utils[_0x2d07('0x20')](_0x167c61,0x0,![],null)['then'](function(){return utils[_0x2d07('0x21')](_0x167c61);})[_0x2d07('0xf')](function(){return _0x367834(null,_0x167c61);});}}else{return _0x367834(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{return utils[_0x2d07('0x20')](_0x167c61,0x0,![],null)['then'](function(){return utils[_0x2d07('0x21')](_0x167c61);})[_0x2d07('0xf')](function(){return _0x367834(null,_0x167c61);})[_0x2d07('0x22')](function(_0x41574e){return _0x367834(null,![],_0x41574e);});}}else{if(_0x167c61['blocked']){return _0x367834(null,![],{'message':_0x2d07('0x1b')});}else{return utils[_0x2d07('0x21')](_0x167c61)[_0x2d07('0xf')](function(){return _0x367834(null,_0x167c61);});}}}});})['catch'](function(_0x16c588){return _0x367834(null,![],_0x16c588);});}function sendServiceMail(_0x550fc5){return db['MailAccount'][_0x2d07('0x23')]({'where':{'service':!![]},'attributes':['id',_0x2d07('0x10'),'email'],'include':[{'model':db[_0x2d07('0x24')],'as':'Smtp'}]})['then'](function(_0x35d885){if(!_0x35d885){throw new Error(_0x2d07('0x25'));}var _0x5ecb9a={'tls':{'rejectUnauthorized':![]}};if(_0x35d885[_0x2d07('0x26')]['service']){_0x5ecb9a[_0x2d07('0x27')]=_0x35d885[_0x2d07('0x26')]['service'];}else{_0x5ecb9a[_0x2d07('0x28')]=_0x35d885['Smtp']['host'];_0x5ecb9a[_0x2d07('0x29')]=_0x35d885['Smtp'][_0x2d07('0x29')];_0x5ecb9a[_0x2d07('0x2a')]=_0x35d885[_0x2d07('0x26')]['secure'];}if(_0x35d885['Smtp'][_0x2d07('0x2b')]){_0x5ecb9a[_0x2d07('0x2c')]={'user':_0x35d885[_0x2d07('0x26')][_0x2d07('0x19')],'pass':_0x35d885['Smtp']['pass']};}var _0x5d03f3={'account':_0x5ecb9a,'message':_[_0x2d07('0x2d')]({'from':util['format'](_0x2d07('0x2e'),_0x35d885[_0x2d07('0x10')],_0x35d885[_0x2d07('0x2f')]||_0x35d885[_0x2d07('0x26')][_0x2d07('0x19')])},_0x550fc5)};return client['request']('SendMail',_0x5d03f3);})[_0x2d07('0xf')](function(_0x2da4aa){if(_0x2da4aa[_0x2d07('0x30')]){throw new Error(util[_0x2d07('0x31')]('SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!',_0x2da4aa[_0x2d07('0x30')][_0x2d07('0x32')]||JSON[_0x2d07('0x33')](_0x2da4aa[_0x2d07('0x30')])));}return!![];});}function handleError(_0x49e754,_0x5706e4,_0x1c88fe){return _0x49e754[_0x2d07('0x34')](_0x5706e4||0x1f4)[_0x2d07('0x35')]({'message':_0x1c88fe?_0x1c88fe['message']||_0x1c88fe:''});}function checkPasswordPattern(_0x4f63c0,_0x63ee18,_0x9f2533){if(_0x9f2533){var _0x18bb24=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x18bb24[_0x2d07('0x36')](_0x63ee18)){return _0x4f63c0;}else{throw new Error(_0x2d07('0x37'));}}else{return _0x4f63c0;}}exports['login']=function(_0x18bcc1,_0x264281,_0x4e892c){passport[_0x2d07('0x1c')]('local',function(_0x3f4e2f,_0x38f138,_0x36ac1e){var _0x10c4ca=_0x3f4e2f||_0x36ac1e;if(_0x10c4ca){return handleError(_0x264281,0x191,_0x10c4ca);}if(!_0x38f138){return handleError(_0x264281,0x194,{'message':_0x2d07('0x38')});}else{var _0x2a9156={'payload':{'id':_0x38f138['id'],'role':_0x38f138['role']},'options':{'expiresIn':0x15180}};return authService[_0x2d07('0x39')](_0x2a9156)[_0x2d07('0xf')](function(_0x250a3f){_0x264281[_0x2d07('0x3a')]({'id':_0x38f138['id'],'token':_0x250a3f,'statusCall':'','isAlreadyLogged':_0x38f138['online']});});}})(_0x18bcc1,_0x264281,_0x4e892c);};exports[_0x2d07('0x3b')]=function(_0x4500bf,_0x3f8bb2,_0x2d76e1){if(!_0x4500bf[_0x2d07('0x3c')]['email']){return handleError(_0x3f8bb2,0x1f4,{'message':_0x2d07('0x3d')});}var _0x42f86f=rs[_0x2d07('0x3e')]();_0x4500bf[_0x2d07('0x3c')][_0x2d07('0x2f')]=_0x4500bf[_0x2d07('0x3c')][_0x2d07('0x2f')][_0x2d07('0x3f')]()[_0x2d07('0x40')]();var _0x1fe5c5;return db[_0x2d07('0xc')][_0x2d07('0xd')]({'where':{'id':0x1},'attributes':[_0x2d07('0x1d'),'blockDuration'],'raw':!![]})[_0x2d07('0xf')](function(_0xf74bee){_0x1fe5c5=_0xf74bee;return db['User'][_0x2d07('0x23')]({'where':{'email':_0x4500bf[_0x2d07('0x3c')][_0x2d07('0x2f')]}});})['then'](function(_0x593f55){if(!_0x593f55){throw new Error(_0x2d07('0x41'));}if(_0x593f55[_0x2d07('0x14')]){throw new Error(_0x2d07('0x42'));}if(_0x593f55['blocked']){if(moment(_0x593f55[_0x2d07('0x16')])[_0x2d07('0x1e')](_0x1fe5c5['blockDuration'],_0x2d07('0x1f'))>moment()){throw new Error(_0x2d07('0x43'));}else{_0x593f55[_0x2d07('0x15')]=![];_0x593f55[_0x2d07('0x16')]=null;}}_0x593f55[_0x2d07('0x44')]=_0x42f86f;_0x593f55[_0x2d07('0x45')]=Date['now']()+0x36ee80;return _0x593f55[_0x2d07('0x46')]();})[_0x2d07('0xf')](function(){return sendServiceMail({'to':_0x4500bf['body'][_0x2d07('0x2f')],'subject':'xCally\x20Motion\x20Password\x20Reset','text':'You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a'+_0x2d07('0x47')+_0x2d07('0x48')+_0x4500bf['headers']['host']+_0x2d07('0x49')+_0x42f86f+'\x0a\x0a'+'If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a'});})[_0x2d07('0xf')](function(){_0x3f8bb2['status'](0xc8)[_0x2d07('0x35')]({'message':_0x2d07('0x4a')});})[_0x2d07('0x22')](function(_0x15a348){return handleError(_0x3f8bb2,0x1f4,_0x15a348);});};exports[_0x2d07('0x4b')]=function(_0x27cf40,_0x3de9fb,_0x3bc115){var _0x9fe3f5;return db[_0x2d07('0x4c')][_0x2d07('0x23')]({'where':{'resetPasswordToken':_0x27cf40[_0x2d07('0x4d')][_0x2d07('0x4e')],'resetPasswordExpires':{'$gt':Date[_0x2d07('0x4f')]()}}})[_0x2d07('0xf')](function(_0x12f196){_0x9fe3f5=_0x12f196;if(!_0x9fe3f5){throw new Error(_0x2d07('0x50'));}return db[_0x2d07('0xc')][_0x2d07('0xd')]({'attributes':['id',_0x2d07('0x51')]});})[_0x2d07('0xf')](function(_0x2383a2){return checkPasswordPattern(_0x2383a2,_0x27cf40[_0x2d07('0x3c')][_0x2d07('0x11')],_0x2383a2[_0x2d07('0x51')]);})['then'](function(){_0x9fe3f5[_0x2d07('0x11')]=_0x27cf40['body'][_0x2d07('0x11')];_0x9fe3f5['resetPasswordToken']=null;_0x9fe3f5[_0x2d07('0x45')]=null;return _0x9fe3f5[_0x2d07('0x46')]();})[_0x2d07('0xf')](function(){_0x3de9fb[_0x2d07('0x34')](0xc8)[_0x2d07('0x35')]({'message':_0x2d07('0x52')});})[_0x2d07('0x22')](function(_0x30be3e){return handleError(_0x3de9fb,0x1f4,_0x30be3e);});};passport['use'](new LocalStrategy({'usernameField':'name','passwordField':'password'},function(_0x452597,_0x363f77,_0x37401a){return localAuthenticate(db[_0x2d07('0x4c')],_0x452597,_0x363f77,_0x37401a);})); \ No newline at end of file +var _0x4f0d=['SendMail','error','message','stringify','status','send','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','local','Something\x20went\x20wrong,\x20please\x20try\x20again.','role','signToken','json','online','body','Email\x20parameter\x20is\x20missing','generate','trim','toLowerCase','User','find','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','save','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','http://','headers','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','reset','params','token','now','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','Password\x20reset!','use','lodash','randomstring','moment','../../components/auth/service','http','Setting','findOne','allowedLoginAttempts','then','password','salt','disabled','blocked','blockedAt','loginAttempts','admin','agent','name','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','blockDuration','add','clearBlockUser','minutes','getLicense','catch','MailAccount','email','MailServerOut','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','host','port','secure','authentication','auth','pass','merge','format','user','request'];(function(_0x368e30,_0x37993d){var _0x3b5a0e=function(_0x4d162a){while(--_0x4d162a){_0x368e30['push'](_0x368e30['shift']());}};_0x3b5a0e(++_0x37993d);}(_0x4f0d,0x1c2));var _0xd4f0=function(_0x4b6847,_0x50c4d6){_0x4b6847=_0x4b6847-0x0;var _0x562863=_0x4f0d[_0x4b6847];return _0x562863;};'use strict';var util=require('util');var passport=require('passport');var LocalStrategy=require('passport-local')['Strategy'];var jayson=require('jayson/promise');var _=require(_0xd4f0('0x0'));var rs=require(_0xd4f0('0x1'));var moment=require(_0xd4f0('0x2'));var db=require('../../mysqldb')['db'];var authService=require(_0xd4f0('0x3'));var utils=require('../../config/utils');var client=jayson['client'][_0xd4f0('0x4')]({'port':0x232b});function localAuthenticate(_0x4da370,_0x16da18,_0x4dd938,_0x50e79f){var _0x19a779,_0x69309d;return db[_0xd4f0('0x5')][_0xd4f0('0x6')]({'where':{'id':0x1},'attributes':[_0xd4f0('0x7'),'blockDuration'],'raw':!![]})[_0xd4f0('0x8')](function(_0x40ed12){_0x19a779=_0x40ed12;return _0x4da370['findOne']({'attributes':['id','name',_0xd4f0('0x9'),_0xd4f0('0xa'),'role',_0xd4f0('0xb'),_0xd4f0('0xc'),_0xd4f0('0xd'),_0xd4f0('0xe')],'where':{'name':_0x16da18,'role':{'$or':[_0xd4f0('0xf'),'user',_0xd4f0('0x10')]}}});})[_0xd4f0('0x8')](function(_0x53e881){if(!_0x53e881||_0x53e881&&_0x53e881[_0xd4f0('0x11')]!==_0x16da18){throw new Error(_0xd4f0('0x12'));}else{_0x69309d=_0x53e881;return _0x69309d;}})[_0xd4f0('0x8')](function(){_0x69309d[_0xd4f0('0x13')](_0x4dd938,function(_0x386f84,_0x89a7a4){var _0x21eb54=_0x69309d[_0xd4f0('0xe')]+0x1;if(_0x386f84){return _0x50e79f(_0x386f84);}else if(!_0x89a7a4){if(_0x69309d[_0xd4f0('0xb')]){return _0x50e79f(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x19a779['allowedLoginAttempts']>0x0){if(_0x69309d[_0xd4f0('0xc')]){if(_0x19a779[_0xd4f0('0x14')]>0x0){if(moment(_0x69309d[_0xd4f0('0xd')])[_0xd4f0('0x15')](_0x19a779['blockDuration'],'minutes')>moment()){return _0x50e79f(null,![],{'message':_0xd4f0('0x12')});}else{return utils[_0xd4f0('0x16')](_0x69309d,_0x21eb54,![],null)[_0xd4f0('0x8')](function(){return _0x50e79f(null,![],{'message':_0xd4f0('0x12')});});}}else{return _0x50e79f(null,![],{'message':_0xd4f0('0x12')});}}else{if(_0x21eb54>=_0x19a779[_0xd4f0('0x7')]){return utils[_0xd4f0('0x16')](_0x69309d,0x0,!![],moment())[_0xd4f0('0x8')](function(){return _0x50e79f(null,![],{'message':_0xd4f0('0x12')});});}else{return utils[_0xd4f0('0x16')](_0x69309d,_0x21eb54,![],null)['then'](function(){return _0x50e79f(null,![],{'message':_0xd4f0('0x12')});});}}}else{return _0x50e79f(null,![],{'message':_0xd4f0('0x12')});}}else{if(_0x69309d[_0xd4f0('0xb')]){return _0x50e79f(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x19a779[_0xd4f0('0x7')]>0x0){if(_0x69309d[_0xd4f0('0xc')]){if(_0x19a779[_0xd4f0('0x14')]>0x0){if(moment(_0x69309d['blockedAt'])[_0xd4f0('0x15')](_0x19a779[_0xd4f0('0x14')],_0xd4f0('0x17'))>moment()){return _0x50e79f(null,![],{'message':_0xd4f0('0x12')});}else{return utils['clearBlockUser'](_0x69309d,0x0,![],null)[_0xd4f0('0x8')](function(){return utils[_0xd4f0('0x18')](_0x69309d);})[_0xd4f0('0x8')](function(){return _0x50e79f(null,_0x69309d);});}}else{return _0x50e79f(null,![],{'message':_0xd4f0('0x12')});}}else{return utils['clearBlockUser'](_0x69309d,0x0,![],null)[_0xd4f0('0x8')](function(){return utils['getLicense'](_0x69309d);})[_0xd4f0('0x8')](function(){return _0x50e79f(null,_0x69309d);})[_0xd4f0('0x19')](function(_0x7552ec){return _0x50e79f(null,![],_0x7552ec);});}}else{if(_0x69309d[_0xd4f0('0xc')]){return _0x50e79f(null,![],{'message':_0xd4f0('0x12')});}else{return utils[_0xd4f0('0x18')](_0x69309d)[_0xd4f0('0x8')](function(){return _0x50e79f(null,_0x69309d);});}}}});})[_0xd4f0('0x19')](function(_0x396db4){return _0x50e79f(null,![],_0x396db4);});}function sendServiceMail(_0x2c1f4f){return db[_0xd4f0('0x1a')]['find']({'where':{'service':!![]},'attributes':['id',_0xd4f0('0x11'),_0xd4f0('0x1b')],'include':[{'model':db[_0xd4f0('0x1c')],'as':_0xd4f0('0x1d')}]})['then'](function(_0x427051){if(!_0x427051){throw new Error(_0xd4f0('0x1e'));}var _0x401a5b={'tls':{'rejectUnauthorized':![]}};if(_0x427051[_0xd4f0('0x1d')]['service']){_0x401a5b[_0xd4f0('0x1f')]=_0x427051[_0xd4f0('0x1d')][_0xd4f0('0x1f')];}else{_0x401a5b[_0xd4f0('0x20')]=_0x427051['Smtp'][_0xd4f0('0x20')];_0x401a5b[_0xd4f0('0x21')]=_0x427051[_0xd4f0('0x1d')][_0xd4f0('0x21')];_0x401a5b[_0xd4f0('0x22')]=_0x427051[_0xd4f0('0x1d')][_0xd4f0('0x22')];}if(_0x427051[_0xd4f0('0x1d')][_0xd4f0('0x23')]){_0x401a5b[_0xd4f0('0x24')]={'user':_0x427051[_0xd4f0('0x1d')]['user'],'pass':_0x427051[_0xd4f0('0x1d')][_0xd4f0('0x25')]};}var _0x210d0a={'account':_0x401a5b,'message':_[_0xd4f0('0x26')]({'from':util[_0xd4f0('0x27')]('\x22%s\x22\x20<%s>',_0x427051[_0xd4f0('0x11')],_0x427051[_0xd4f0('0x1b')]||_0x427051['Smtp'][_0xd4f0('0x28')])},_0x2c1f4f)};return client[_0xd4f0('0x29')](_0xd4f0('0x2a'),_0x210d0a);})['then'](function(_0xf63538){if(_0xf63538['error']){throw new Error(util['format']('SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!',_0xf63538[_0xd4f0('0x2b')][_0xd4f0('0x2c')]||JSON[_0xd4f0('0x2d')](_0xf63538[_0xd4f0('0x2b')])));}return!![];});}function handleError(_0x3fb345,_0x5785ca,_0x536f70){return _0x3fb345[_0xd4f0('0x2e')](_0x5785ca||0x1f4)[_0xd4f0('0x2f')]({'message':_0x536f70?_0x536f70[_0xd4f0('0x2c')]||_0x536f70:''});}function checkPasswordPattern(_0x5cbaeb,_0x400891,_0x9e7549){if(_0x9e7549){var _0x45219e=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x45219e['test'](_0x400891)){return _0x5cbaeb;}else{throw new Error(_0xd4f0('0x30'));}}else{return _0x5cbaeb;}}exports['login']=function(_0x162955,_0x301a85,_0x108c4e){passport[_0xd4f0('0x13')](_0xd4f0('0x31'),function(_0x17e564,_0x50904e,_0x492f27){var _0x30023b=_0x17e564||_0x492f27;if(_0x30023b){return handleError(_0x301a85,0x191,_0x30023b);}if(!_0x50904e){return handleError(_0x301a85,0x194,{'message':_0xd4f0('0x32')});}else{var _0x4bad3c={'payload':{'id':_0x50904e['id'],'role':_0x50904e[_0xd4f0('0x33')]},'options':{'expiresIn':0x15180}};return authService[_0xd4f0('0x34')](_0x4bad3c)[_0xd4f0('0x8')](function(_0x70e86d){_0x301a85[_0xd4f0('0x35')]({'id':_0x50904e['id'],'token':_0x70e86d,'statusCall':'','isAlreadyLogged':_0x50904e[_0xd4f0('0x36')]});});}})(_0x162955,_0x301a85,_0x108c4e);};exports['forgot']=function(_0x77ff47,_0x239b5b,_0x2e59e4){if(!_0x77ff47[_0xd4f0('0x37')][_0xd4f0('0x1b')]){return handleError(_0x239b5b,0x1f4,{'message':_0xd4f0('0x38')});}var _0x5c9245=rs[_0xd4f0('0x39')]();_0x77ff47[_0xd4f0('0x37')]['email']=_0x77ff47['body'][_0xd4f0('0x1b')][_0xd4f0('0x3a')]()[_0xd4f0('0x3b')]();var _0x53f971;return db['Setting'][_0xd4f0('0x6')]({'where':{'id':0x1},'attributes':[_0xd4f0('0x7'),_0xd4f0('0x14')],'raw':!![]})[_0xd4f0('0x8')](function(_0x4429d1){_0x53f971=_0x4429d1;return db[_0xd4f0('0x3c')][_0xd4f0('0x3d')]({'where':{'email':_0x77ff47[_0xd4f0('0x37')][_0xd4f0('0x1b')]}});})[_0xd4f0('0x8')](function(_0x2aa578){if(!_0x2aa578){throw new Error(_0xd4f0('0x3e'));}if(_0x2aa578[_0xd4f0('0xb')]){throw new Error('The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.');}if(_0x2aa578[_0xd4f0('0xc')]){if(moment(_0x2aa578['blockedAt'])[_0xd4f0('0x15')](_0x53f971['blockDuration'],_0xd4f0('0x17'))>moment()){throw new Error(_0xd4f0('0x3f'));}else{_0x2aa578[_0xd4f0('0xc')]=![];_0x2aa578['blockedAt']=null;}}_0x2aa578[_0xd4f0('0x40')]=_0x5c9245;_0x2aa578[_0xd4f0('0x41')]=Date['now']()+0x36ee80;return _0x2aa578[_0xd4f0('0x42')]();})['then'](function(){return sendServiceMail({'to':_0x77ff47[_0xd4f0('0x37')][_0xd4f0('0x1b')],'subject':'xCally\x20Motion\x20Password\x20Reset','text':_0xd4f0('0x43')+_0xd4f0('0x44')+_0xd4f0('0x45')+_0x77ff47[_0xd4f0('0x46')][_0xd4f0('0x20')]+_0xd4f0('0x47')+_0x5c9245+'\x0a\x0a'+_0xd4f0('0x48')});})[_0xd4f0('0x8')](function(){_0x239b5b[_0xd4f0('0x2e')](0xc8)[_0xd4f0('0x2f')]({'message':_0xd4f0('0x49')});})[_0xd4f0('0x19')](function(_0x4e76a5){return handleError(_0x239b5b,0x1f4,_0x4e76a5);});};exports[_0xd4f0('0x4a')]=function(_0x3cb364,_0x85fef0,_0x3359df){var _0x469f39;return db['User'][_0xd4f0('0x3d')]({'where':{'resetPasswordToken':_0x3cb364[_0xd4f0('0x4b')][_0xd4f0('0x4c')],'resetPasswordExpires':{'$gt':Date[_0xd4f0('0x4d')]()}}})[_0xd4f0('0x8')](function(_0x2727e6){_0x469f39=_0x2727e6;if(!_0x469f39){throw new Error(_0xd4f0('0x4e'));}return db[_0xd4f0('0x5')][_0xd4f0('0x6')]({'attributes':['id',_0xd4f0('0x4f')]});})[_0xd4f0('0x8')](function(_0x2c7530){return checkPasswordPattern(_0x2c7530,_0x3cb364[_0xd4f0('0x37')][_0xd4f0('0x9')],_0x2c7530[_0xd4f0('0x4f')]);})['then'](function(){_0x469f39[_0xd4f0('0x9')]=_0x3cb364['body'][_0xd4f0('0x9')];_0x469f39[_0xd4f0('0x40')]=null;_0x469f39[_0xd4f0('0x41')]=null;return _0x469f39['save']();})[_0xd4f0('0x8')](function(){_0x85fef0[_0xd4f0('0x2e')](0xc8)['send']({'message':_0xd4f0('0x50')});})[_0xd4f0('0x19')](function(_0x1290ee){return handleError(_0x85fef0,0x1f4,_0x1290ee);});};passport[_0xd4f0('0x51')](new LocalStrategy({'usernameField':'name','passwordField':_0xd4f0('0x9')},function(_0x569267,_0x382eaf,_0x2bdfa0){return localAuthenticate(db[_0xd4f0('0x3c')],_0x569267,_0x382eaf,_0x2bdfa0);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index dc69ca0..6f28a9d 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 _0xb8b7=['reset','post','/forgot','forgot','/reset/:token'];(function(_0x33aca9,_0x54dc27){var _0x59c757=function(_0x1dc448){while(--_0x1dc448){_0x33aca9['push'](_0x33aca9['shift']());}};_0x59c757(++_0x54dc27);}(_0xb8b7,0x114));var _0x7b8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xb8b7[_0xa464c9];return _0x3d73c4;};'use strict';var express=require('express');var router=express['Router']();var controller=require('./authLocal.controller');router['post']('/',controller['login']);router[_0x7b8b('0x0')](_0x7b8b('0x1'),controller[_0x7b8b('0x2')]);router['post'](_0x7b8b('0x3'),controller[_0x7b8b('0x4')]);module['exports']=router; \ No newline at end of file +var _0xd699=['Router','./authLocal.controller','post','login','/forgot','forgot','/reset/:token','reset','exports','express'];(function(_0xea35d1,_0x302471){var _0x1d7a7c=function(_0x1bc101){while(--_0x1bc101){_0xea35d1['push'](_0xea35d1['shift']());}};_0x1d7a7c(++_0x302471);}(_0xd699,0x13f));var _0x9d69=function(_0x5f309e,_0x66e31){_0x5f309e=_0x5f309e-0x0;var _0x487b5e=_0xd699[_0x5f309e];return _0x487b5e;};'use strict';var express=require(_0x9d69('0x0'));var router=express[_0x9d69('0x1')]();var controller=require(_0x9d69('0x2'));router[_0x9d69('0x3')]('/',controller[_0x9d69('0x4')]);router[_0x9d69('0x3')](_0x9d69('0x5'),controller[_0x9d69('0x6')]);router['post'](_0x9d69('0x7'),controller[_0x9d69('0x8')]);module[_0x9d69('0x9')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index 92d9b9f..c8be8c4 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 _0xb4a3=['INTEGER','sequelize','exports','STRING'];(function(_0x4eecbc,_0x5737e7){var _0x9f7eee=function(_0x46bb7c){while(--_0x46bb7c){_0x4eecbc['push'](_0x4eecbc['shift']());}};_0x9f7eee(++_0x5737e7);}(_0xb4a3,0xe1));var _0x3b4a=function(_0x2fd160,_0x53c0d6){_0x2fd160=_0x2fd160-0x0;var _0x5c2031=_0xb4a3[_0x2fd160];return _0x5c2031;};'use strict';var Sequelize=require(_0x3b4a('0x0'));module[_0x3b4a('0x1')]={'name':{'type':Sequelize[_0x3b4a('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0x3b4a('0x2')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize[_0x3b4a('0x3')],'defaultValue':0xa}}; \ No newline at end of file +var _0x2aae=['exports','STRING','BOOLEAN','INTEGER','sequelize'];(function(_0x4a9fb7,_0x4cbfd7){var _0x40b90e=function(_0x59664c){while(--_0x59664c){_0x4a9fb7['push'](_0x4a9fb7['shift']());}};_0x40b90e(++_0x4cbfd7);}(_0x2aae,0x144));var _0xe2aa=function(_0x5d01a5,_0x57f4d9){_0x5d01a5=_0x5d01a5-0x0;var _0x3c2f1f=_0x2aae[_0x5d01a5];return _0x3c2f1f;};'use strict';var Sequelize=require(_0xe2aa('0x0'));module[_0xe2aa('0x1')]={'name':{'type':Sequelize[_0xe2aa('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0xe2aa('0x2')]},'description':{'type':Sequelize[_0xe2aa('0x2')]},'status':{'type':Sequelize[_0xe2aa('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0xe2aa('0x4')],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index f674c77..997b2ad 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 _0xe979=['pick','filter','merge','VIRTUAL','count','then','includeAll','findAll','rows','catch','show','params','keys','filters','include','options','find','create','body','destroy','addConditions','Condition','ids','getConditions','order','hasOwnProperty','addActions','Action','omit','getActions','findOne','nolimit','eml-format','rimraf','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','Content-Range','apply','reject','save','update','end','error','stack','name','index','map','Automation','rawAttributes','type','model','query','intersection','attributes','fields','length','sort','where'];(function(_0x52f1e6,_0xf70489){var _0x21f104=function(_0xb89f9e){while(--_0xb89f9e){_0x52f1e6['push'](_0x52f1e6['shift']());}};_0x21f104(++_0xf70489);}(_0xe979,0x113));var _0x9e97=function(_0x2d5c0c,_0x38c5a2){_0x2d5c0c=_0x2d5c0c-0x0;var _0x5a0fa4=_0xe979[_0x2d5c0c];return _0x5a0fa4;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x9e97('0x0'));var rimraf=require(_0x9e97('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x9e97('0x2'));var moment=require(_0x9e97('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x9e97('0x4'));var util=require(_0x9e97('0x5'));var path=require(_0x9e97('0x6'));var sox=require(_0x9e97('0x7'));var csv=require(_0x9e97('0x8'));var ejs=require(_0x9e97('0x9'));var fs=require('fs');var _=require(_0x9e97('0xa'));var squel=require(_0x9e97('0xb'));var crypto=require(_0x9e97('0xc'));var jsforce=require(_0x9e97('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x9e97('0x8'));var querystring=require(_0x9e97('0xe'));var Papa=require(_0x9e97('0xf'));var Redis=require(_0x9e97('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x9e97('0x11'));var hardwareService=require(_0x9e97('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x9e97('0x13'));var config=require(_0x9e97('0x14'));var db=require(_0x9e97('0x15'))['db'];function respondWithStatusCode(_0x39cc86,_0x400b14){_0x400b14=_0x400b14||0xcc;return function(_0x333be0){if(_0x333be0){return _0x39cc86[_0x9e97('0x16')](_0x400b14);}return _0x39cc86[_0x9e97('0x17')](_0x400b14)['end']();};}function respondWithResult(_0x8badfe,_0x5ce9a7){_0x5ce9a7=_0x5ce9a7||0xc8;return function(_0x169331){if(_0x169331){return _0x8badfe[_0x9e97('0x17')](_0x5ce9a7)[_0x9e97('0x18')](_0x169331);}};}function respondWithFilteredResult(_0x26a65e,_0x42095d){return function(_0x374181){if(_0x374181){var _0x4f5745=_0x374181['count'],_0x44b0f1=_0x42095d['offset'],_0x5c5393=_0x42095d[_0x9e97('0x19')]+_0x42095d[_0x9e97('0x1a')],_0x2a4db3;if(_0x5c5393>=_0x4f5745){_0x5c5393=_0x4f5745;_0x2a4db3=0xc8;}else{_0x2a4db3=0xce;}_0x26a65e['status'](_0x2a4db3);return _0x26a65e['set'](_0x9e97('0x1b'),_0x44b0f1+'-'+_0x5c5393+'/'+_0x4f5745)[_0x9e97('0x18')](_0x374181);}return null;};}function patchUpdates(_0x261e98){return function(_0x4ff20){try{jsonpatch[_0x9e97('0x1c')](_0x4ff20,_0x261e98,!![]);}catch(_0x75bf1){return BPromise[_0x9e97('0x1d')](_0x75bf1);}return _0x4ff20[_0x9e97('0x1e')]();};}function saveUpdates(_0x2228bc,_0xa19918){return function(_0x49399f){if(_0x49399f){return _0x49399f[_0x9e97('0x1f')](_0x2228bc)['then'](function(_0x264711){return _0x264711;});}return null;};}function removeEntity(_0xc1e7e,_0x179eaa){return function(_0x42e0a5){if(_0x42e0a5){return _0x42e0a5['destroy']()['then'](function(){_0xc1e7e['status'](0xcc)[_0x9e97('0x20')]();});}};}function handleEntityNotFound(_0x597078,_0x2edb64){return function(_0xccac72){if(!_0xccac72){_0x597078[_0x9e97('0x16')](0x194);}return _0xccac72;};}function handleError(_0x20c09b,_0x29433a){_0x29433a=_0x29433a||0x1f4;return function(_0xa26bc3){logger[_0x9e97('0x21')](_0xa26bc3[_0x9e97('0x22')]);if(_0xa26bc3[_0x9e97('0x23')]){delete _0xa26bc3['name'];}_0x20c09b[_0x9e97('0x17')](_0x29433a)['send'](_0xa26bc3);};}exports[_0x9e97('0x24')]=function(_0x55515b,_0x28bb8a){var _0x427759={},_0x4e23d9={},_0x337e78={'count':0x0,'rows':[]};var _0x2b8de3=_[_0x9e97('0x25')](db[_0x9e97('0x26')][_0x9e97('0x27')],function(_0x3ad2ea){return{'name':_0x3ad2ea['fieldName'],'type':_0x3ad2ea[_0x9e97('0x28')]['key']};});_0x4e23d9[_0x9e97('0x29')]=_[_0x9e97('0x25')](_0x2b8de3,'name');_0x4e23d9[_0x9e97('0x2a')]=_['keys'](_0x55515b[_0x9e97('0x2a')]);_0x4e23d9['filters']=_[_0x9e97('0x2b')](_0x4e23d9[_0x9e97('0x29')],_0x4e23d9[_0x9e97('0x2a')]);_0x427759[_0x9e97('0x2c')]=_[_0x9e97('0x2b')](_0x4e23d9[_0x9e97('0x29')],qs['fields'](_0x55515b[_0x9e97('0x2a')][_0x9e97('0x2d')]));_0x427759[_0x9e97('0x2c')]=_0x427759[_0x9e97('0x2c')][_0x9e97('0x2e')]?_0x427759[_0x9e97('0x2c')]:_0x4e23d9[_0x9e97('0x29')];if(!_0x55515b['query']['hasOwnProperty']('nolimit')){_0x427759[_0x9e97('0x1a')]=qs[_0x9e97('0x1a')](_0x55515b[_0x9e97('0x2a')]['limit']);_0x427759['offset']=qs[_0x9e97('0x19')](_0x55515b['query'][_0x9e97('0x19')]);}_0x427759['order']=qs['sort'](_0x55515b[_0x9e97('0x2a')][_0x9e97('0x2f')]);_0x427759[_0x9e97('0x30')]=qs['filters'](_[_0x9e97('0x31')](_0x55515b['query'],_0x4e23d9['filters']),_0x2b8de3);if(_0x55515b[_0x9e97('0x2a')][_0x9e97('0x32')]){_0x427759['where']=_[_0x9e97('0x33')](_0x427759['where'],{'$or':_[_0x9e97('0x25')](_0x2b8de3,function(_0x59f51e){if(_0x59f51e[_0x9e97('0x28')]!==_0x9e97('0x34')){var _0x43ac04={};_0x43ac04[_0x59f51e[_0x9e97('0x23')]]={'$like':'%'+_0x55515b[_0x9e97('0x2a')][_0x9e97('0x32')]+'%'};return _0x43ac04;}})});}_0x427759=_['merge']({},_0x427759,_0x55515b['options']);var _0x339bcb={'where':_0x427759[_0x9e97('0x30')]};return db['Automation'][_0x9e97('0x35')](_0x339bcb)[_0x9e97('0x36')](function(_0x326112){_0x337e78[_0x9e97('0x35')]=_0x326112;if(_0x55515b['query'][_0x9e97('0x37')]){_0x427759['include']=[{'all':!![]}];}return db[_0x9e97('0x26')][_0x9e97('0x38')](_0x427759);})[_0x9e97('0x36')](function(_0x15bf1b){_0x337e78[_0x9e97('0x39')]=_0x15bf1b;return _0x337e78;})[_0x9e97('0x36')](respondWithFilteredResult(_0x28bb8a,_0x427759))[_0x9e97('0x3a')](handleError(_0x28bb8a,null));};exports[_0x9e97('0x3b')]=function(_0x44681c,_0x669074){var _0x1dc3c9={'raw':![],'where':{'id':_0x44681c[_0x9e97('0x3c')]['id']}},_0x231757={};_0x231757[_0x9e97('0x29')]=_[_0x9e97('0x3d')](db['Automation']['rawAttributes']);_0x231757[_0x9e97('0x2a')]=_['keys'](_0x44681c[_0x9e97('0x2a')]);_0x231757[_0x9e97('0x3e')]=_[_0x9e97('0x2b')](_0x231757[_0x9e97('0x29')],_0x231757[_0x9e97('0x2a')]);_0x1dc3c9[_0x9e97('0x2c')]=_[_0x9e97('0x2b')](_0x231757['model'],qs[_0x9e97('0x2d')](_0x44681c['query'][_0x9e97('0x2d')]));_0x1dc3c9[_0x9e97('0x2c')]=_0x1dc3c9[_0x9e97('0x2c')][_0x9e97('0x2e')]?_0x1dc3c9[_0x9e97('0x2c')]:_0x231757['model'];if(_0x44681c[_0x9e97('0x2a')][_0x9e97('0x37')]){_0x1dc3c9[_0x9e97('0x3f')]=[{'all':!![]}];}_0x1dc3c9=_['merge']({},_0x1dc3c9,_0x44681c[_0x9e97('0x40')]);return db[_0x9e97('0x26')][_0x9e97('0x41')](_0x1dc3c9)[_0x9e97('0x36')](handleEntityNotFound(_0x669074,null))[_0x9e97('0x36')](respondWithResult(_0x669074,null))[_0x9e97('0x3a')](handleError(_0x669074,null));};exports[_0x9e97('0x42')]=function(_0x49d692,_0x543a1a){return db[_0x9e97('0x26')][_0x9e97('0x42')](_0x49d692[_0x9e97('0x43')],{})[_0x9e97('0x36')](respondWithResult(_0x543a1a,0xc9))[_0x9e97('0x3a')](handleError(_0x543a1a,null));};exports['update']=function(_0x1c7974,_0x5ec746){if(_0x1c7974[_0x9e97('0x43')]['id']){delete _0x1c7974['body']['id'];}return db[_0x9e97('0x26')]['find']({'where':{'id':_0x1c7974[_0x9e97('0x3c')]['id']}})['then'](handleEntityNotFound(_0x5ec746,null))['then'](saveUpdates(_0x1c7974['body'],null))[_0x9e97('0x36')](respondWithResult(_0x5ec746,null))[_0x9e97('0x3a')](handleError(_0x5ec746,null));};exports[_0x9e97('0x44')]=function(_0x2cc242,_0x30e784){return db[_0x9e97('0x26')][_0x9e97('0x41')]({'where':{'id':_0x2cc242['params']['id']}})[_0x9e97('0x36')](handleEntityNotFound(_0x30e784,null))[_0x9e97('0x36')](removeEntity(_0x30e784,null))[_0x9e97('0x3a')](handleError(_0x30e784,null));};exports[_0x9e97('0x45')]=function(_0x187e4c,_0x47dc84,_0x5a9adf){return db[_0x9e97('0x46')]['find']({'where':{'id':_0x187e4c[_0x9e97('0x3c')]['id']}})['then'](handleEntityNotFound(_0x47dc84,null))[_0x9e97('0x36')](function(_0x56b450){if(_0x56b450){return _0x56b450['addConditions'](_0x187e4c[_0x9e97('0x43')][_0x9e97('0x47')],_['omit'](_0x187e4c['body'],[_0x9e97('0x47'),'id'])||{});}})[_0x9e97('0x36')](respondWithResult(_0x47dc84,null))['catch'](handleError(_0x47dc84,null));};exports[_0x9e97('0x48')]=function(_0x43b2db,_0x2fc8a0,_0x4b1aae){var _0x4d6e75={};var _0x34cba6={};var _0xf635aa;var _0x3972b1;return db['Automation']['findOne']({'where':{'id':_0x43b2db[_0x9e97('0x3c')]['id']}})[_0x9e97('0x36')](handleEntityNotFound(_0x2fc8a0,null))[_0x9e97('0x36')](function(_0x2a1241){if(_0x2a1241){_0xf635aa=_0x2a1241;_0x34cba6[_0x9e97('0x29')]=_[_0x9e97('0x3d')](db['Condition'][_0x9e97('0x27')]);_0x34cba6[_0x9e97('0x2a')]=_[_0x9e97('0x3d')](_0x43b2db[_0x9e97('0x2a')]);_0x34cba6[_0x9e97('0x3e')]=_['intersection'](_0x34cba6[_0x9e97('0x29')],_0x34cba6[_0x9e97('0x2a')]);_0x4d6e75[_0x9e97('0x2c')]=_[_0x9e97('0x2b')](_0x34cba6['model'],qs[_0x9e97('0x2d')](_0x43b2db[_0x9e97('0x2a')]['fields']));_0x4d6e75[_0x9e97('0x2c')]=_0x4d6e75['attributes'][_0x9e97('0x2e')]?_0x4d6e75[_0x9e97('0x2c')]:_0x34cba6[_0x9e97('0x29')];_0x4d6e75[_0x9e97('0x49')]=qs[_0x9e97('0x2f')](_0x43b2db[_0x9e97('0x2a')]['sort']);_0x4d6e75[_0x9e97('0x30')]=qs['filters'](_['pick'](_0x43b2db[_0x9e97('0x2a')],_0x34cba6[_0x9e97('0x3e')]));if(_0x43b2db[_0x9e97('0x2a')][_0x9e97('0x32')]){_0x4d6e75[_0x9e97('0x30')]=_['merge'](_0x4d6e75[_0x9e97('0x30')],{'$or':_['map'](_0x4d6e75[_0x9e97('0x2c')],function(_0x48d790){var _0x494bca={};_0x494bca[_0x48d790]={'$like':'%'+_0x43b2db[_0x9e97('0x2a')][_0x9e97('0x32')]+'%'};return _0x494bca;})});}_0x4d6e75=_['merge']({},_0x4d6e75,_0x43b2db['options']);return _0xf635aa['getConditions'](_0x4d6e75);}})[_0x9e97('0x36')](function(_0xb7e8d9){if(_0xb7e8d9){_0x3972b1=_0xb7e8d9['length'];if(!_0x43b2db['query'][_0x9e97('0x4a')]('nolimit')){_0x4d6e75[_0x9e97('0x1a')]=qs[_0x9e97('0x1a')](_0x43b2db[_0x9e97('0x2a')][_0x9e97('0x1a')]);_0x4d6e75[_0x9e97('0x19')]=qs[_0x9e97('0x19')](_0x43b2db[_0x9e97('0x2a')][_0x9e97('0x19')]);}return _0xf635aa[_0x9e97('0x48')](_0x4d6e75);}})[_0x9e97('0x36')](function(_0x232dd2){if(_0x232dd2){return _0x232dd2?{'count':_0x3972b1,'rows':_0x232dd2}:null;}})[_0x9e97('0x36')](respondWithResult(_0x2fc8a0,null))['catch'](handleError(_0x2fc8a0,null));};exports[_0x9e97('0x4b')]=function(_0x65998f,_0x23e005,_0x51c62d){return db[_0x9e97('0x4c')]['find']({'where':{'id':_0x65998f[_0x9e97('0x3c')]['id']}})[_0x9e97('0x36')](handleEntityNotFound(_0x23e005,null))[_0x9e97('0x36')](function(_0x567012){if(_0x567012){return _0x567012[_0x9e97('0x4b')](_0x65998f[_0x9e97('0x43')][_0x9e97('0x47')],_[_0x9e97('0x4d')](_0x65998f['body'],[_0x9e97('0x47'),'id'])||{});}})[_0x9e97('0x36')](respondWithResult(_0x23e005,null))[_0x9e97('0x3a')](handleError(_0x23e005,null));};exports[_0x9e97('0x4e')]=function(_0x15d297,_0x267f83,_0x15480e){var _0x1e5a28={};var _0x2d2b0e={};var _0x2f12c8;var _0x198849;return db[_0x9e97('0x26')][_0x9e97('0x4f')]({'where':{'id':_0x15d297[_0x9e97('0x3c')]['id']}})[_0x9e97('0x36')](handleEntityNotFound(_0x267f83,null))['then'](function(_0x5bf7e4){if(_0x5bf7e4){_0x2f12c8=_0x5bf7e4;_0x2d2b0e[_0x9e97('0x29')]=_[_0x9e97('0x3d')](db['Action']['rawAttributes']);_0x2d2b0e[_0x9e97('0x2a')]=_['keys'](_0x15d297[_0x9e97('0x2a')]);_0x2d2b0e[_0x9e97('0x3e')]=_[_0x9e97('0x2b')](_0x2d2b0e['model'],_0x2d2b0e[_0x9e97('0x2a')]);_0x1e5a28[_0x9e97('0x2c')]=_[_0x9e97('0x2b')](_0x2d2b0e['model'],qs[_0x9e97('0x2d')](_0x15d297[_0x9e97('0x2a')]['fields']));_0x1e5a28[_0x9e97('0x2c')]=_0x1e5a28[_0x9e97('0x2c')][_0x9e97('0x2e')]?_0x1e5a28[_0x9e97('0x2c')]:_0x2d2b0e[_0x9e97('0x29')];_0x1e5a28[_0x9e97('0x49')]=qs['sort'](_0x15d297[_0x9e97('0x2a')]['sort']);_0x1e5a28['where']=qs['filters'](_['pick'](_0x15d297[_0x9e97('0x2a')],_0x2d2b0e[_0x9e97('0x3e')]));if(_0x15d297[_0x9e97('0x2a')][_0x9e97('0x32')]){_0x1e5a28['where']=_['merge'](_0x1e5a28[_0x9e97('0x30')],{'$or':_[_0x9e97('0x25')](_0x1e5a28[_0x9e97('0x2c')],function(_0xddf1e3){var _0x4eb68f={};_0x4eb68f[_0xddf1e3]={'$like':'%'+_0x15d297[_0x9e97('0x2a')]['filter']+'%'};return _0x4eb68f;})});}_0x1e5a28=_[_0x9e97('0x33')]({},_0x1e5a28,_0x15d297[_0x9e97('0x40')]);return _0x2f12c8[_0x9e97('0x4e')](_0x1e5a28);}})[_0x9e97('0x36')](function(_0x5760cc){if(_0x5760cc){_0x198849=_0x5760cc[_0x9e97('0x2e')];if(!_0x15d297['query'][_0x9e97('0x4a')](_0x9e97('0x50'))){_0x1e5a28[_0x9e97('0x1a')]=qs[_0x9e97('0x1a')](_0x15d297[_0x9e97('0x2a')][_0x9e97('0x1a')]);_0x1e5a28['offset']=qs[_0x9e97('0x19')](_0x15d297[_0x9e97('0x2a')]['offset']);}return _0x2f12c8[_0x9e97('0x4e')](_0x1e5a28);}})[_0x9e97('0x36')](function(_0x3b9515){if(_0x3b9515){return _0x3b9515?{'count':_0x198849,'rows':_0x3b9515}:null;}})[_0x9e97('0x36')](respondWithResult(_0x267f83,null))[_0x9e97('0x3a')](handleError(_0x267f83,null));}; \ No newline at end of file +var _0x8f10=['model','name','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','type','VIRTUAL','merge','options','Automation','includeAll','include','findAll','catch','show','keys','find','create','body','params','addConditions','getConditions','findOne','pick','addActions','omit','ids','getActions','Action','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','then','destroy','error','stack','send','index','map','rawAttributes','fieldName'];(function(_0xa57efb,_0x461e38){var _0x13731f=function(_0x3b888f){while(--_0x3b888f){_0xa57efb['push'](_0xa57efb['shift']());}};_0x13731f(++_0x461e38);}(_0x8f10,0x1c5));var _0x08f1=function(_0x12be33,_0x3e526e){_0x12be33=_0x12be33-0x0;var _0x42a925=_0x8f10[_0x12be33];return _0x42a925;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x08f1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x08f1('0x1'));var jsonpatch=require(_0x08f1('0x2'));var rp=require(_0x08f1('0x3'));var moment=require(_0x08f1('0x4'));var BPromise=require(_0x08f1('0x5'));var Mustache=require('mustache');var util=require(_0x08f1('0x6'));var path=require(_0x08f1('0x7'));var sox=require(_0x08f1('0x8'));var csv=require(_0x08f1('0x9'));var ejs=require(_0x08f1('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x08f1('0xb'));var crypto=require(_0x08f1('0xc'));var jsforce=require(_0x08f1('0xd'));var deskjs=require(_0x08f1('0xe'));var toCsv=require(_0x08f1('0x9'));var querystring=require(_0x08f1('0xf'));var Papa=require(_0x08f1('0x10'));var Redis=require('ioredis');var authService=require(_0x08f1('0x11'));var qs=require(_0x08f1('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x08f1('0x13'))(_0x08f1('0x14'));var utils=require(_0x08f1('0x15'));var config=require(_0x08f1('0x16'));var db=require(_0x08f1('0x17'))['db'];function respondWithStatusCode(_0x34c1e2,_0x380838){_0x380838=_0x380838||0xcc;return function(_0x148eef){if(_0x148eef){return _0x34c1e2[_0x08f1('0x18')](_0x380838);}return _0x34c1e2[_0x08f1('0x19')](_0x380838)[_0x08f1('0x1a')]();};}function respondWithResult(_0x3b0096,_0x32c4a5){_0x32c4a5=_0x32c4a5||0xc8;return function(_0x313d7c){if(_0x313d7c){return _0x3b0096[_0x08f1('0x19')](_0x32c4a5)[_0x08f1('0x1b')](_0x313d7c);}};}function respondWithFilteredResult(_0x11f2a3,_0x4761d8){return function(_0x24a09d){if(_0x24a09d){var _0xdf60=_0x24a09d[_0x08f1('0x1c')],_0x4444a7=_0x4761d8['offset'],_0x3e69f2=_0x4761d8[_0x08f1('0x1d')]+_0x4761d8[_0x08f1('0x1e')],_0x2f88e6;if(_0x3e69f2>=_0xdf60){_0x3e69f2=_0xdf60;_0x2f88e6=0xc8;}else{_0x2f88e6=0xce;}_0x11f2a3['status'](_0x2f88e6);return _0x11f2a3[_0x08f1('0x1f')]('Content-Range',_0x4444a7+'-'+_0x3e69f2+'/'+_0xdf60)[_0x08f1('0x1b')](_0x24a09d);}return null;};}function patchUpdates(_0x481639){return function(_0x264a3b){try{jsonpatch[_0x08f1('0x20')](_0x264a3b,_0x481639,!![]);}catch(_0x5845c5){return BPromise[_0x08f1('0x21')](_0x5845c5);}return _0x264a3b[_0x08f1('0x22')]();};}function saveUpdates(_0x7926a5,_0x1bab18){return function(_0x379c58){if(_0x379c58){return _0x379c58[_0x08f1('0x23')](_0x7926a5)[_0x08f1('0x24')](function(_0x42f420){return _0x42f420;});}return null;};}function removeEntity(_0x478025,_0x18c5b1){return function(_0x51141f){if(_0x51141f){return _0x51141f[_0x08f1('0x25')]()[_0x08f1('0x24')](function(){_0x478025[_0x08f1('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x375f6c,_0x35ffd6){return function(_0x5da5c1){if(!_0x5da5c1){_0x375f6c[_0x08f1('0x18')](0x194);}return _0x5da5c1;};}function handleError(_0x3f9f74,_0x56ae64){_0x56ae64=_0x56ae64||0x1f4;return function(_0x1a0da4){logger[_0x08f1('0x26')](_0x1a0da4[_0x08f1('0x27')]);if(_0x1a0da4['name']){delete _0x1a0da4['name'];}_0x3f9f74['status'](_0x56ae64)[_0x08f1('0x28')](_0x1a0da4);};}exports[_0x08f1('0x29')]=function(_0x1c6bee,_0x100c13){var _0x121ef4={},_0x518b32={},_0x514035={'count':0x0,'rows':[]};var _0x544b3c=_[_0x08f1('0x2a')](db['Automation'][_0x08f1('0x2b')],function(_0x6453dd){return{'name':_0x6453dd[_0x08f1('0x2c')],'type':_0x6453dd['type']['key']};});_0x518b32[_0x08f1('0x2d')]=_[_0x08f1('0x2a')](_0x544b3c,_0x08f1('0x2e'));_0x518b32[_0x08f1('0x2f')]=_['keys'](_0x1c6bee[_0x08f1('0x2f')]);_0x518b32[_0x08f1('0x30')]=_[_0x08f1('0x31')](_0x518b32[_0x08f1('0x2d')],_0x518b32[_0x08f1('0x2f')]);_0x121ef4[_0x08f1('0x32')]=_[_0x08f1('0x31')](_0x518b32[_0x08f1('0x2d')],qs['fields'](_0x1c6bee[_0x08f1('0x2f')][_0x08f1('0x33')]));_0x121ef4[_0x08f1('0x32')]=_0x121ef4[_0x08f1('0x32')][_0x08f1('0x34')]?_0x121ef4['attributes']:_0x518b32[_0x08f1('0x2d')];if(!_0x1c6bee['query'][_0x08f1('0x35')](_0x08f1('0x36'))){_0x121ef4[_0x08f1('0x1e')]=qs[_0x08f1('0x1e')](_0x1c6bee[_0x08f1('0x2f')][_0x08f1('0x1e')]);_0x121ef4[_0x08f1('0x1d')]=qs['offset'](_0x1c6bee[_0x08f1('0x2f')][_0x08f1('0x1d')]);}_0x121ef4[_0x08f1('0x37')]=qs['sort'](_0x1c6bee[_0x08f1('0x2f')][_0x08f1('0x38')]);_0x121ef4[_0x08f1('0x39')]=qs[_0x08f1('0x30')](_['pick'](_0x1c6bee[_0x08f1('0x2f')],_0x518b32[_0x08f1('0x30')]),_0x544b3c);if(_0x1c6bee[_0x08f1('0x2f')][_0x08f1('0x3a')]){_0x121ef4[_0x08f1('0x39')]=_['merge'](_0x121ef4['where'],{'$or':_['map'](_0x544b3c,function(_0x4ebe6a){if(_0x4ebe6a[_0x08f1('0x3b')]!==_0x08f1('0x3c')){var _0x59335e={};_0x59335e[_0x4ebe6a[_0x08f1('0x2e')]]={'$like':'%'+_0x1c6bee['query'][_0x08f1('0x3a')]+'%'};return _0x59335e;}})});}_0x121ef4=_[_0x08f1('0x3d')]({},_0x121ef4,_0x1c6bee[_0x08f1('0x3e')]);var _0x31e8b2={'where':_0x121ef4[_0x08f1('0x39')]};return db[_0x08f1('0x3f')]['count'](_0x31e8b2)['then'](function(_0x16afa2){_0x514035[_0x08f1('0x1c')]=_0x16afa2;if(_0x1c6bee['query'][_0x08f1('0x40')]){_0x121ef4[_0x08f1('0x41')]=[{'all':!![]}];}return db['Automation'][_0x08f1('0x42')](_0x121ef4);})[_0x08f1('0x24')](function(_0x52ccc5){_0x514035['rows']=_0x52ccc5;return _0x514035;})['then'](respondWithFilteredResult(_0x100c13,_0x121ef4))[_0x08f1('0x43')](handleError(_0x100c13,null));};exports[_0x08f1('0x44')]=function(_0x155dca,_0x5da860){var _0x149b8d={'raw':![],'where':{'id':_0x155dca['params']['id']}},_0x41ed35={};_0x41ed35[_0x08f1('0x2d')]=_[_0x08f1('0x45')](db[_0x08f1('0x3f')][_0x08f1('0x2b')]);_0x41ed35[_0x08f1('0x2f')]=_['keys'](_0x155dca[_0x08f1('0x2f')]);_0x41ed35[_0x08f1('0x30')]=_[_0x08f1('0x31')](_0x41ed35[_0x08f1('0x2d')],_0x41ed35['query']);_0x149b8d[_0x08f1('0x32')]=_[_0x08f1('0x31')](_0x41ed35[_0x08f1('0x2d')],qs[_0x08f1('0x33')](_0x155dca[_0x08f1('0x2f')]['fields']));_0x149b8d[_0x08f1('0x32')]=_0x149b8d[_0x08f1('0x32')][_0x08f1('0x34')]?_0x149b8d['attributes']:_0x41ed35[_0x08f1('0x2d')];if(_0x155dca[_0x08f1('0x2f')][_0x08f1('0x40')]){_0x149b8d[_0x08f1('0x41')]=[{'all':!![]}];}_0x149b8d=_[_0x08f1('0x3d')]({},_0x149b8d,_0x155dca['options']);return db[_0x08f1('0x3f')][_0x08f1('0x46')](_0x149b8d)['then'](handleEntityNotFound(_0x5da860,null))[_0x08f1('0x24')](respondWithResult(_0x5da860,null))[_0x08f1('0x43')](handleError(_0x5da860,null));};exports[_0x08f1('0x47')]=function(_0x3499e8,_0x19c1f6){return db[_0x08f1('0x3f')][_0x08f1('0x47')](_0x3499e8[_0x08f1('0x48')],{})['then'](respondWithResult(_0x19c1f6,0xc9))[_0x08f1('0x43')](handleError(_0x19c1f6,null));};exports[_0x08f1('0x23')]=function(_0x5beee9,_0x5a0fcf){if(_0x5beee9[_0x08f1('0x48')]['id']){delete _0x5beee9['body']['id'];}return db['Automation']['find']({'where':{'id':_0x5beee9[_0x08f1('0x49')]['id']}})[_0x08f1('0x24')](handleEntityNotFound(_0x5a0fcf,null))[_0x08f1('0x24')](saveUpdates(_0x5beee9['body'],null))[_0x08f1('0x24')](respondWithResult(_0x5a0fcf,null))[_0x08f1('0x43')](handleError(_0x5a0fcf,null));};exports[_0x08f1('0x25')]=function(_0x4ce5be,_0x501abf){return db['Automation'][_0x08f1('0x46')]({'where':{'id':_0x4ce5be[_0x08f1('0x49')]['id']}})[_0x08f1('0x24')](handleEntityNotFound(_0x501abf,null))['then'](removeEntity(_0x501abf,null))[_0x08f1('0x43')](handleError(_0x501abf,null));};exports[_0x08f1('0x4a')]=function(_0x36a81a,_0x184907,_0x15e4da){return db['Condition']['find']({'where':{'id':_0x36a81a[_0x08f1('0x49')]['id']}})[_0x08f1('0x24')](handleEntityNotFound(_0x184907,null))[_0x08f1('0x24')](function(_0x32b773){if(_0x32b773){return _0x32b773[_0x08f1('0x4a')](_0x36a81a[_0x08f1('0x48')]['ids'],_['omit'](_0x36a81a[_0x08f1('0x48')],['ids','id'])||{});}})[_0x08f1('0x24')](respondWithResult(_0x184907,null))[_0x08f1('0x43')](handleError(_0x184907,null));};exports[_0x08f1('0x4b')]=function(_0x139fc7,_0x4d17aa,_0x1bec3b){var _0x5f44ed={};var _0x1f88d6={};var _0x549d32;var _0x3c7fc8;return db[_0x08f1('0x3f')][_0x08f1('0x4c')]({'where':{'id':_0x139fc7[_0x08f1('0x49')]['id']}})[_0x08f1('0x24')](handleEntityNotFound(_0x4d17aa,null))[_0x08f1('0x24')](function(_0x91baf8){if(_0x91baf8){_0x549d32=_0x91baf8;_0x1f88d6[_0x08f1('0x2d')]=_['keys'](db['Condition'][_0x08f1('0x2b')]);_0x1f88d6['query']=_[_0x08f1('0x45')](_0x139fc7[_0x08f1('0x2f')]);_0x1f88d6[_0x08f1('0x30')]=_[_0x08f1('0x31')](_0x1f88d6[_0x08f1('0x2d')],_0x1f88d6[_0x08f1('0x2f')]);_0x5f44ed[_0x08f1('0x32')]=_[_0x08f1('0x31')](_0x1f88d6['model'],qs[_0x08f1('0x33')](_0x139fc7['query'][_0x08f1('0x33')]));_0x5f44ed[_0x08f1('0x32')]=_0x5f44ed['attributes']['length']?_0x5f44ed[_0x08f1('0x32')]:_0x1f88d6[_0x08f1('0x2d')];_0x5f44ed[_0x08f1('0x37')]=qs[_0x08f1('0x38')](_0x139fc7[_0x08f1('0x2f')][_0x08f1('0x38')]);_0x5f44ed['where']=qs[_0x08f1('0x30')](_[_0x08f1('0x4d')](_0x139fc7['query'],_0x1f88d6[_0x08f1('0x30')]));if(_0x139fc7[_0x08f1('0x2f')][_0x08f1('0x3a')]){_0x5f44ed[_0x08f1('0x39')]=_['merge'](_0x5f44ed['where'],{'$or':_[_0x08f1('0x2a')](_0x5f44ed[_0x08f1('0x32')],function(_0x20d5b6){var _0x464591={};_0x464591[_0x20d5b6]={'$like':'%'+_0x139fc7[_0x08f1('0x2f')][_0x08f1('0x3a')]+'%'};return _0x464591;})});}_0x5f44ed=_['merge']({},_0x5f44ed,_0x139fc7[_0x08f1('0x3e')]);return _0x549d32[_0x08f1('0x4b')](_0x5f44ed);}})[_0x08f1('0x24')](function(_0x5a855b){if(_0x5a855b){_0x3c7fc8=_0x5a855b[_0x08f1('0x34')];if(!_0x139fc7[_0x08f1('0x2f')][_0x08f1('0x35')](_0x08f1('0x36'))){_0x5f44ed[_0x08f1('0x1e')]=qs[_0x08f1('0x1e')](_0x139fc7[_0x08f1('0x2f')]['limit']);_0x5f44ed[_0x08f1('0x1d')]=qs[_0x08f1('0x1d')](_0x139fc7[_0x08f1('0x2f')]['offset']);}return _0x549d32[_0x08f1('0x4b')](_0x5f44ed);}})[_0x08f1('0x24')](function(_0x106c1b){if(_0x106c1b){return _0x106c1b?{'count':_0x3c7fc8,'rows':_0x106c1b}:null;}})['then'](respondWithResult(_0x4d17aa,null))['catch'](handleError(_0x4d17aa,null));};exports[_0x08f1('0x4e')]=function(_0x1a7396,_0x2dc4b8,_0x1896ea){return db['Action'][_0x08f1('0x46')]({'where':{'id':_0x1a7396[_0x08f1('0x49')]['id']}})[_0x08f1('0x24')](handleEntityNotFound(_0x2dc4b8,null))[_0x08f1('0x24')](function(_0x28c108){if(_0x28c108){return _0x28c108[_0x08f1('0x4e')](_0x1a7396[_0x08f1('0x48')]['ids'],_[_0x08f1('0x4f')](_0x1a7396[_0x08f1('0x48')],[_0x08f1('0x50'),'id'])||{});}})[_0x08f1('0x24')](respondWithResult(_0x2dc4b8,null))[_0x08f1('0x43')](handleError(_0x2dc4b8,null));};exports[_0x08f1('0x51')]=function(_0x3fa061,_0x50b1ad,_0x1030ca){var _0xe9d82a={};var _0x150be4={};var _0x6bef02;var _0x2d769c;return db[_0x08f1('0x3f')]['findOne']({'where':{'id':_0x3fa061[_0x08f1('0x49')]['id']}})[_0x08f1('0x24')](handleEntityNotFound(_0x50b1ad,null))[_0x08f1('0x24')](function(_0x4ae586){if(_0x4ae586){_0x6bef02=_0x4ae586;_0x150be4[_0x08f1('0x2d')]=_[_0x08f1('0x45')](db[_0x08f1('0x52')][_0x08f1('0x2b')]);_0x150be4[_0x08f1('0x2f')]=_[_0x08f1('0x45')](_0x3fa061[_0x08f1('0x2f')]);_0x150be4[_0x08f1('0x30')]=_[_0x08f1('0x31')](_0x150be4[_0x08f1('0x2d')],_0x150be4['query']);_0xe9d82a[_0x08f1('0x32')]=_[_0x08f1('0x31')](_0x150be4['model'],qs['fields'](_0x3fa061['query'][_0x08f1('0x33')]));_0xe9d82a[_0x08f1('0x32')]=_0xe9d82a['attributes'][_0x08f1('0x34')]?_0xe9d82a[_0x08f1('0x32')]:_0x150be4['model'];_0xe9d82a[_0x08f1('0x37')]=qs[_0x08f1('0x38')](_0x3fa061[_0x08f1('0x2f')][_0x08f1('0x38')]);_0xe9d82a[_0x08f1('0x39')]=qs['filters'](_[_0x08f1('0x4d')](_0x3fa061[_0x08f1('0x2f')],_0x150be4[_0x08f1('0x30')]));if(_0x3fa061[_0x08f1('0x2f')][_0x08f1('0x3a')]){_0xe9d82a[_0x08f1('0x39')]=_[_0x08f1('0x3d')](_0xe9d82a[_0x08f1('0x39')],{'$or':_[_0x08f1('0x2a')](_0xe9d82a[_0x08f1('0x32')],function(_0x13c8a5){var _0x16d4d1={};_0x16d4d1[_0x13c8a5]={'$like':'%'+_0x3fa061[_0x08f1('0x2f')][_0x08f1('0x3a')]+'%'};return _0x16d4d1;})});}_0xe9d82a=_['merge']({},_0xe9d82a,_0x3fa061[_0x08f1('0x3e')]);return _0x6bef02['getActions'](_0xe9d82a);}})[_0x08f1('0x24')](function(_0xd3a7ca){if(_0xd3a7ca){_0x2d769c=_0xd3a7ca[_0x08f1('0x34')];if(!_0x3fa061[_0x08f1('0x2f')][_0x08f1('0x35')](_0x08f1('0x36'))){_0xe9d82a['limit']=qs['limit'](_0x3fa061[_0x08f1('0x2f')]['limit']);_0xe9d82a[_0x08f1('0x1d')]=qs['offset'](_0x3fa061[_0x08f1('0x2f')][_0x08f1('0x1d')]);}return _0x6bef02[_0x08f1('0x51')](_0xe9d82a);}})['then'](function(_0x521006){if(_0x521006){return _0x521006?{'count':_0x2d769c,'rows':_0x521006}:null;}})[_0x08f1('0x24')](respondWithResult(_0x50b1ad,null))[_0x08f1('0x43')](handleError(_0x50b1ad,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 65d3fce..6d2aea6 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 _0x6c58=['bluebird','rimraf','../../config/environment','./automation.attributes','exports','Automation','tools_automations','lodash','util','../../config/logger','api'];(function(_0x10644f,_0x39f5fc){var _0x3fcaa0=function(_0x261f80){while(--_0x261f80){_0x10644f['push'](_0x10644f['shift']());}};_0x3fcaa0(++_0x39f5fc);}(_0x6c58,0xcd));var _0x86c5=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x6c58[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x86c5('0x0'));var util=require(_0x86c5('0x1'));var logger=require(_0x86c5('0x2'))(_0x86c5('0x3'));var moment=require('moment');var BPromise=require(_0x86c5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x86c5('0x5'));var config=require(_0x86c5('0x6'));var attributes=require(_0x86c5('0x7'));module[_0x86c5('0x8')]=function(_0x2efdc4,_0x3524c3){return _0x2efdc4['define'](_0x86c5('0x9'),attributes,{'tableName':_0x86c5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x95c7=['request-promise','path','exports','define','tools_automations','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x1264d7,_0x4ae13f){var _0x58e827=function(_0x119d81){while(--_0x119d81){_0x1264d7['push'](_0x1264d7['shift']());}};_0x58e827(++_0x4ae13f);}(_0x95c7,0x1a7));var _0x795c=function(_0x21093c,_0xc9022a){_0x21093c=_0x21093c-0x0;var _0x52153b=_0x95c7[_0x21093c];return _0x52153b;};'use strict';var _=require(_0x795c('0x0'));var util=require(_0x795c('0x1'));var logger=require(_0x795c('0x2'))(_0x795c('0x3'));var moment=require(_0x795c('0x4'));var BPromise=require(_0x795c('0x5'));var rp=require(_0x795c('0x6'));var fs=require('fs');var path=require(_0x795c('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./automation.attributes');module[_0x795c('0x8')]=function(_0x539589,_0x1cdcda){return _0x539589[_0x795c('0x9')]('Automation',attributes,{'tableName':_0x795c('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 e740daa..6cc5eb8 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 _0x6fc3=['Automation,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','debug','request\x20sent','stringify','error','code'];(function(_0x40800c,_0x3a3f45){var _0x3761f7=function(_0x3209b0){while(--_0x3209b0){_0x40800c['push'](_0x40800c['shift']());}};_0x3761f7(++_0x3a3f45);}(_0x6fc3,0x1cc));var _0x36fc=function(_0x1a0370,_0x123eb6){_0x1a0370=_0x1a0370-0x0;var _0x54b437=_0x6fc3[_0x1a0370];return _0x54b437;};'use strict';var _=require(_0x36fc('0x0'));var util=require(_0x36fc('0x1'));var moment=require(_0x36fc('0x2'));var BPromise=require(_0x36fc('0x3'));var rs=require(_0x36fc('0x4'));var fs=require('fs');var Redis=require(_0x36fc('0x5'));var db=require(_0x36fc('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x36fc('0x7'))(_0x36fc('0x8'));var config=require(_0x36fc('0x9'));var jayson=require(_0x36fc('0xa'));var client=jayson[_0x36fc('0xb')][_0x36fc('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x365edc,_0xf3b22b,_0x61488){return new BPromise(function(_0x5d0811,_0x20ad34){return client['request'](_0x365edc,_0x61488)[_0x36fc('0xd')](function(_0xf9058f){logger[_0x36fc('0xe')]('Automation,\x20%s,\x20%s',_0xf3b22b,'request\x20sent');logger[_0x36fc('0xf')]('Automation,\x20%s,\x20%s,\x20%s',_0xf3b22b,_0x36fc('0x10'),JSON[_0x36fc('0x11')](_0xf9058f));if(_0xf9058f['error']){if(_0xf9058f[_0x36fc('0x12')][_0x36fc('0x13')]===0x1f4){logger[_0x36fc('0x12')](_0x36fc('0x14'),_0xf3b22b,_0xf9058f['error'][_0x36fc('0x15')]);return _0x20ad34(_0xf9058f['error'][_0x36fc('0x15')]);}logger[_0x36fc('0x12')]('Automation,\x20%s,\x20%s',_0xf3b22b,_0xf9058f[_0x36fc('0x12')][_0x36fc('0x15')]);return _0x5d0811(_0xf9058f[_0x36fc('0x12')][_0x36fc('0x15')]);}else{logger[_0x36fc('0xe')](_0x36fc('0x14'),_0xf3b22b,'request\x20sent');_0x5d0811(_0xf9058f[_0x36fc('0x16')][_0x36fc('0x15')]);}})[_0x36fc('0x17')](function(_0x17344a){logger[_0x36fc('0x12')](_0x36fc('0x14'),_0xf3b22b,_0x17344a);_0x20ad34(_0x17344a);});});} \ No newline at end of file +var _0x0cfe=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','Automation,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','moment','bluebird','randomstring'];(function(_0x129c79,_0x5a4dc5){var _0x153647=function(_0x300c35){while(--_0x300c35){_0x129c79['push'](_0x129c79['shift']());}};_0x153647(++_0x5a4dc5);}(_0x0cfe,0x9c));var _0xe0cf=function(_0x5b2d67,_0x15e4b1){_0x5b2d67=_0x5b2d67-0x0;var _0x2b73a3=_0x0cfe[_0x5b2d67];return _0x2b73a3;};'use strict';var _=require(_0xe0cf('0x0'));var util=require('util');var moment=require(_0xe0cf('0x1'));var BPromise=require(_0xe0cf('0x2'));var rs=require(_0xe0cf('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe0cf('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xe0cf('0x5'))(_0xe0cf('0x6'));var config=require(_0xe0cf('0x7'));var jayson=require(_0xe0cf('0x8'));var client=jayson['client'][_0xe0cf('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2abd29,_0x1985b6,_0x518995){return new BPromise(function(_0x2c4c48,_0x2470c7){return client['request'](_0x2abd29,_0x518995)[_0xe0cf('0xa')](function(_0x2bd78b){logger[_0xe0cf('0xb')](_0xe0cf('0xc'),_0x1985b6,_0xe0cf('0xd'));logger[_0xe0cf('0xe')]('Automation,\x20%s,\x20%s,\x20%s',_0x1985b6,_0xe0cf('0xd'),JSON[_0xe0cf('0xf')](_0x2bd78b));if(_0x2bd78b[_0xe0cf('0x10')]){if(_0x2bd78b[_0xe0cf('0x10')][_0xe0cf('0x11')]===0x1f4){logger[_0xe0cf('0x10')](_0xe0cf('0xc'),_0x1985b6,_0x2bd78b[_0xe0cf('0x10')][_0xe0cf('0x12')]);return _0x2470c7(_0x2bd78b[_0xe0cf('0x10')][_0xe0cf('0x12')]);}logger[_0xe0cf('0x10')]('Automation,\x20%s,\x20%s',_0x1985b6,_0x2bd78b[_0xe0cf('0x10')][_0xe0cf('0x12')]);return _0x2c4c48(_0x2bd78b[_0xe0cf('0x10')][_0xe0cf('0x12')]);}else{logger[_0xe0cf('0xb')]('Automation,\x20%s,\x20%s',_0x1985b6,'request\x20sent');_0x2c4c48(_0x2bd78b[_0xe0cf('0x13')]['message']);}})['catch'](function(_0x1fc244){logger[_0xe0cf('0x10')](_0xe0cf('0xc'),_0x1985b6,_0x1fc244);_0x2470c7(_0x1fc244);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 80fdc2c..cae8ac9 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 _0xf1d6=['/:id/conditions','getConditions','/:id/actions','post','create','addActions','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','get','isAuthenticated','/:id'];(function(_0x25fa5c,_0x421141){var _0x1bade2=function(_0x3faf20){while(--_0x3faf20){_0x25fa5c['push'](_0x25fa5c['shift']());}};_0x1bade2(++_0x421141);}(_0xf1d6,0x135));var _0x6f1d=function(_0x4d69be,_0x1174bf){_0x4d69be=_0x4d69be-0x0;var _0xaa62b3=_0xf1d6[_0x4d69be];return _0xaa62b3;};'use strict';var multer=require(_0x6f1d('0x0'));var util=require(_0x6f1d('0x1'));var path=require(_0x6f1d('0x2'));var timeout=require(_0x6f1d('0x3'));var express=require(_0x6f1d('0x4'));var router=express[_0x6f1d('0x5')]();var auth=require(_0x6f1d('0x6'));var interaction=require(_0x6f1d('0x7'));var config=require(_0x6f1d('0x8'));var controller=require(_0x6f1d('0x9'));router[_0x6f1d('0xa')]('/',auth[_0x6f1d('0xb')](),controller['index']);router[_0x6f1d('0xa')](_0x6f1d('0xc'),auth[_0x6f1d('0xb')](),controller['show']);router['get'](_0x6f1d('0xd'),auth['isAuthenticated'](),controller[_0x6f1d('0xe')]);router[_0x6f1d('0xa')](_0x6f1d('0xf'),auth[_0x6f1d('0xb')](),controller['getActions']);router[_0x6f1d('0x10')]('/',auth['isAuthenticated'](),controller[_0x6f1d('0x11')]);router[_0x6f1d('0x10')](_0x6f1d('0xd'),auth[_0x6f1d('0xb')](),controller['addConditions']);router[_0x6f1d('0x10')]('/:id/actions',auth[_0x6f1d('0xb')](),controller[_0x6f1d('0x12')]);router[_0x6f1d('0x13')](_0x6f1d('0xc'),auth['isAuthenticated'](),controller[_0x6f1d('0x14')]);router[_0x6f1d('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x6f1d('0x16')]);module['exports']=router; \ No newline at end of file +var _0xbe58=['get','isAuthenticated','index','show','/:id/conditions','/:id/actions','getActions','create','addConditions','post','addActions','put','update','destroy','exports','path','Router','../../components/interaction/service','../../config/environment','./automation.controller'];(function(_0x11156a,_0x15e42a){var _0x123f92=function(_0x329a6f){while(--_0x329a6f){_0x11156a['push'](_0x11156a['shift']());}};_0x123f92(++_0x15e42a);}(_0xbe58,0x19f));var _0x8be5=function(_0x13b8f3,_0x442821){_0x13b8f3=_0x13b8f3-0x0;var _0x1a6d06=_0xbe58[_0x13b8f3];return _0x1a6d06;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x8be5('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8be5('0x1')]();var auth=require('../../components/auth/service');var interaction=require(_0x8be5('0x2'));var config=require(_0x8be5('0x3'));var controller=require(_0x8be5('0x4'));router[_0x8be5('0x5')]('/',auth[_0x8be5('0x6')](),controller[_0x8be5('0x7')]);router['get']('/:id',auth[_0x8be5('0x6')](),controller[_0x8be5('0x8')]);router[_0x8be5('0x5')](_0x8be5('0x9'),auth[_0x8be5('0x6')](),controller['getConditions']);router[_0x8be5('0x5')](_0x8be5('0xa'),auth[_0x8be5('0x6')](),controller[_0x8be5('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x8be5('0xc')]);router['post'](_0x8be5('0x9'),auth[_0x8be5('0x6')](),controller[_0x8be5('0xd')]);router[_0x8be5('0xe')](_0x8be5('0xa'),auth['isAuthenticated'](),controller[_0x8be5('0xf')]);router[_0x8be5('0x10')]('/:id',auth[_0x8be5('0x6')](),controller[_0x8be5('0x11')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x8be5('0x12')]);module[_0x8be5('0x13')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index c45e40e..fed9105 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 _0xed51=['always','never','onlyIfOpen','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','exports','STRING','name','ENUM','ivr','BOOLEAN','INTEGER','UNSIGNED','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'];(function(_0x4fc702,_0x590060){var _0x1357d3=function(_0x45a119){while(--_0x45a119){_0x4fc702['push'](_0x4fc702['shift']());}};_0x1357d3(++_0x590060);}(_0xed51,0x137));var _0x1ed5=function(_0x53416b,_0x206ea6){_0x53416b=_0x53416b-0x0;var _0x3b24ce=_0xed51[_0x53416b];return _0x3b24ce;};'use strict';var Sequelize=require('sequelize');module[_0x1ed5('0x0')]={'name':{'type':Sequelize[_0x1ed5('0x1')],'unique':_0x1ed5('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x1ed5('0x3')](_0x1ed5('0x4')),'allowNull':![],'defaultValue':_0x1ed5('0x4')},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x1ed5('0x5')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'limitCalls':{'type':Sequelize[_0x1ed5('0x6')](0x4)[_0x1ed5('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x1ed5('0x8')},'dialOriginateCallerIdName':{'type':Sequelize[_0x1ed5('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x1ed5('0x1')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x1ed5('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1ed5('0x9')},'dialCongestionMaxRetry':{'type':Sequelize[_0x1ed5('0x6')](0x3)[_0x1ed5('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1ed5('0xa')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x1ed5('0x6')](0x5)[_0x1ed5('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1ed5('0xb')},'dialBusyMaxRetry':{'type':Sequelize[_0x1ed5('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1ed5('0xc')},'dialBusyRetryFrequency':{'type':Sequelize[_0x1ed5('0x6')](0x5)[_0x1ed5('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1ed5('0xd')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x1ed5('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0x1ed5('0xe')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x1ed5('0x6')](0x5)[_0x1ed5('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1ed5('0xf')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x1ed5('0x7')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x1ed5('0x10')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x1ed5('0x1')],'defaultValue':'07:00-22:00,*,*,*'},'dialCheckDuplicateType':{'type':Sequelize[_0x1ed5('0x3')](_0x1ed5('0x11'),_0x1ed5('0x12'),_0x1ed5('0x13')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x1ed5('0x6')](0x9)[_0x1ed5('0x7')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x1ed5('0x14')},'dialAMDGreeting':{'type':Sequelize[_0x1ed5('0x6')](0x9)[_0x1ed5('0x7')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x1ed5('0x15')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x1ed5('0x6')](0x9)[_0x1ed5('0x7')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x1ed5('0x16')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0x1ed5('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x1ed5('0x17')},'dialAMDMinWordLength':{'type':Sequelize[_0x1ed5('0x6')](0x9)[_0x1ed5('0x7')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x1ed5('0x18')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x1ed5('0x6')](0x9)[_0x1ed5('0x7')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x1ed5('0x19')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x1ed5('0x6')](0x9)[_0x1ed5('0x7')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x1ed5('0x1a')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x1ed5('0x1b')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x1ed5('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x1ed5('0x1c')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0x1ed5('0x1d'),_0x1ed5('0x1e')),'defaultValue':_0x1ed5('0x1d')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x1ed5('0x6')](0x3)[_0x1ed5('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x1ed5('0x1f')},'dialCutDigit':{'type':Sequelize[_0x1ed5('0x6')](0x3)[_0x1ed5('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x1ed5('0x20')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x1ed5('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1ed5('0x21')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x1ed5('0x6')](0x5)[_0x1ed5('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1ed5('0x22')},'dialDropMaxRetry':{'type':Sequelize[_0x1ed5('0x6')](0x3)[_0x1ed5('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1ed5('0x23')},'dialDropRetryFrequency':{'type':Sequelize[_0x1ed5('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1ed5('0x24')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x1ed5('0x6')](0x3)[_0x1ed5('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x1ed5('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0x1ed5('0x6')](0x3)[_0x1ed5('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1ed5('0x25')},'dialMachineRetryFrequency':{'type':Sequelize[_0x1ed5('0x6')](0x5)[_0x1ed5('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1ed5('0x26')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x1ed5('0x6')](0x3)[_0x1ed5('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1ed5('0x27')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x1ed5('0x6')](0x5)[_0x1ed5('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1ed5('0x28')}}; \ No newline at end of file +var _0x6c4c=['#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','STRING','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','Max\x20200\x20calls.','INTEGER','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','UNSIGNED','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)'];(function(_0x4f02bc,_0x5e6ece){var _0x15278b=function(_0x12fa67){while(--_0x12fa67){_0x4f02bc['push'](_0x4f02bc['shift']());}};_0x15278b(++_0x5e6ece);}(_0x6c4c,0xda));var _0xc6c4=function(_0x390aca,_0x25ea70){_0x390aca=_0x390aca-0x0;var _0x48eeba=_0x6c4c[_0x390aca];return _0x48eeba;};'use strict';var Sequelize=require(_0xc6c4('0x0'));module[_0xc6c4('0x1')]={'name':{'type':Sequelize[_0xc6c4('0x2')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xc6c4('0x3')](_0xc6c4('0x4')),'allowNull':![],'defaultValue':_0xc6c4('0x4')},'description':{'type':Sequelize[_0xc6c4('0x2')]},'active':{'type':Sequelize[_0xc6c4('0x5')],'defaultValue':0x0,'comment':_0xc6c4('0x6')},'limitCalls':{'type':Sequelize['INTEGER'](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xc6c4('0x7')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xc6c4('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0xc6c4('0x8')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc6c4('0x9')},'dialCongestionMaxRetry':{'type':Sequelize[_0xc6c4('0x8')](0x3)[_0xc6c4('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc6c4('0xb')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xc6c4('0x8')](0x5)[_0xc6c4('0xa')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc6c4('0xc')},'dialBusyMaxRetry':{'type':Sequelize[_0xc6c4('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc6c4('0xd')},'dialBusyRetryFrequency':{'type':Sequelize[_0xc6c4('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc6c4('0xe')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xc6c4('0x8')](0x3)[_0xc6c4('0xa')],'defaultValue':0x3,'comment':_0xc6c4('0xf')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xc6c4('0x8')](0x5)[_0xc6c4('0xa')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc6c4('0x10')},'dialGlobalMaxRetry':{'type':Sequelize[_0xc6c4('0x8')](0x3)[_0xc6c4('0xa')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xc6c4('0x11')},'dialTimezone':{'type':Sequelize[_0xc6c4('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xc6c4('0x2')],'defaultValue':_0xc6c4('0x12')},'dialCheckDuplicateType':{'type':Sequelize[_0xc6c4('0x3')](_0xc6c4('0x13'),_0xc6c4('0x14'),_0xc6c4('0x15')),'defaultValue':_0xc6c4('0x13')},'dialAMDActive':{'type':Sequelize[_0xc6c4('0x5')],'defaultValue':0x0,'comment':_0xc6c4('0x16')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0xc6c4('0xa')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xc6c4('0x17')},'dialAMDGreeting':{'type':Sequelize[_0xc6c4('0x8')](0x9)[_0xc6c4('0xa')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xc6c4('0x18')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xc6c4('0x8')](0x9)[_0xc6c4('0xa')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xc6c4('0x19')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xc6c4('0x8')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0xc6c4('0xa')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xc6c4('0x1a')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xc6c4('0x8')](0x9)[_0xc6c4('0xa')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xc6c4('0x1b')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0xc6c4('0xa')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xc6c4('0x1c')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xc6c4('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xc6c4('0x1d')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xc6c4('0x8')](0x9)[_0xc6c4('0xa')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xc6c4('0x1e')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0xc6c4('0x1f'),'ASC'),'defaultValue':_0xc6c4('0x1f')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0xc6c4('0xa')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xc6c4('0x20')},'dialCutDigit':{'type':Sequelize[_0xc6c4('0x8')](0x3)[_0xc6c4('0xa')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xc6c4('0x21')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xc6c4('0x8')](0x3)[_0xc6c4('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc6c4('0x22')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xc6c4('0xa')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc6c4('0x23')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xc6c4('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc6c4('0x24')},'dialDropRetryFrequency':{'type':Sequelize[_0xc6c4('0x8')](0x5)[_0xc6c4('0xa')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc6c4('0x25')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xc6c4('0x8')](0x5)[_0xc6c4('0xa')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc6c4('0x26')},'dialMachineMaxRetry':{'type':Sequelize[_0xc6c4('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc6c4('0x27')},'dialMachineRetryFrequency':{'type':Sequelize[_0xc6c4('0x8')](0x5)[_0xc6c4('0xa')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xc6c4('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc6c4('0x28')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xc6c4('0x8')](0x5)[_0xc6c4('0xa')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc6c4('0x29')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 9b30574..9e42612 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 _0x9460=['moment','bluebird','mustache','util','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','reject','save','update','then','get','IvrCampaigns','destroy','error','stack','name','send','index','map','Campaign','rawAttributes','type','keys','query','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','show','length','find','create','body','user','role','UserProfileSection','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','createdAt','updatedAt','omit','userProfileId','UserProfileResource','getHoppers','findOne','CampaignId','CmHopper','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','rows','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','ids','dialCheckDuplicateType','always','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','field','NOW()','CmListId','toString','ListId','from','cm_contacts','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','select','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen','insert','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','push','sequelize','all','removeLists','addBlackLists','spread','cm_hopper_black','removeBlackLists','rimraf','zip-dir'];(function(_0x5b29da,_0xd60105){var _0x2887e3=function(_0x4d580b){while(--_0x4d580b){_0x5b29da['push'](_0x5b29da['shift']());}};_0x2887e3(++_0xd60105);}(_0x9460,0x10c));var _0x0946=function(_0x33015a,_0x3d3293){_0x33015a=_0x33015a-0x0;var _0x211b7b=_0x9460[_0x33015a];return _0x211b7b;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x0946('0x0'));var zipdir=require(_0x0946('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0946('0x2'));var BPromise=require(_0x0946('0x3'));var Mustache=require(_0x0946('0x4'));var util=require(_0x0946('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x0946('0x6'));var ejs=require(_0x0946('0x7'));var fs=require('fs');var _=require(_0x0946('0x8'));var squel=require('squel');var crypto=require(_0x0946('0x9'));var jsforce=require(_0x0946('0xa'));var deskjs=require(_0x0946('0xb'));var toCsv=require(_0x0946('0x6'));var querystring=require(_0x0946('0xc'));var Papa=require(_0x0946('0xd'));var Redis=require(_0x0946('0xe'));var authService=require(_0x0946('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x0946('0x10'));var hardwareService=require(_0x0946('0x11'));var logger=require(_0x0946('0x12'))(_0x0946('0x13'));var utils=require(_0x0946('0x14'));var config=require(_0x0946('0x15'));var db=require(_0x0946('0x16'))['db'];function respondWithStatusCode(_0x406e85,_0x27f9f0){_0x27f9f0=_0x27f9f0||0xcc;return function(_0x3c6058){if(_0x3c6058){return _0x406e85[_0x0946('0x17')](_0x27f9f0);}return _0x406e85[_0x0946('0x18')](_0x27f9f0)[_0x0946('0x19')]();};}function respondWithResult(_0x17b436,_0x1bd12c){_0x1bd12c=_0x1bd12c||0xc8;return function(_0x34e1f7){if(_0x34e1f7){return _0x17b436[_0x0946('0x18')](_0x1bd12c)['json'](_0x34e1f7);}};}function respondWithFilteredResult(_0x14cabc,_0x295a82){return function(_0x2c8036){if(_0x2c8036){var _0x30ac19=_0x2c8036[_0x0946('0x1a')],_0x2d7d8f=_0x295a82[_0x0946('0x1b')],_0x47bc4d=_0x295a82[_0x0946('0x1b')]+_0x295a82[_0x0946('0x1c')],_0x1cd82e;if(_0x47bc4d>=_0x30ac19){_0x47bc4d=_0x30ac19;_0x1cd82e=0xc8;}else{_0x1cd82e=0xce;}_0x14cabc[_0x0946('0x18')](_0x1cd82e);return _0x14cabc[_0x0946('0x1d')](_0x0946('0x1e'),_0x2d7d8f+'-'+_0x47bc4d+'/'+_0x30ac19)[_0x0946('0x1f')](_0x2c8036);}return null;};}function patchUpdates(_0x252f57){return function(_0x48b1a8){try{jsonpatch['apply'](_0x48b1a8,_0x252f57,!![]);}catch(_0x2b7d6f){return BPromise[_0x0946('0x20')](_0x2b7d6f);}return _0x48b1a8[_0x0946('0x21')]();};}function saveUpdates(_0x114724,_0x43d0c2){return function(_0x42a895){if(_0x42a895){return _0x42a895[_0x0946('0x22')](_0x114724)[_0x0946('0x23')](function(_0x4369c0){return _0x4369c0;});}return null;};}function removeEntity(_0x57e731,_0x379128){return function(_0xcb36b){if(_0xcb36b){return _0xcb36b['destroy']()[_0x0946('0x23')](function(){var _0x583296=_0xcb36b[_0x0946('0x24')]({'plain':!![]});var _0x42358e=_0x0946('0x25');return db['UserProfileResource'][_0x0946('0x26')]({'where':{'type':_0x42358e,'resourceId':_0x583296['id']}})[_0x0946('0x23')](function(){return _0xcb36b;});})[_0x0946('0x23')](function(){_0x57e731[_0x0946('0x18')](0xcc)[_0x0946('0x19')]();});}};}function handleEntityNotFound(_0x1d8113,_0x5b47b9){return function(_0x1616fc){if(!_0x1616fc){_0x1d8113[_0x0946('0x17')](0x194);}return _0x1616fc;};}function handleError(_0x3a60b1,_0x4224ed){_0x4224ed=_0x4224ed||0x1f4;return function(_0x319aa2){logger[_0x0946('0x27')](_0x319aa2[_0x0946('0x28')]);if(_0x319aa2['name']){delete _0x319aa2[_0x0946('0x29')];}_0x3a60b1[_0x0946('0x18')](_0x4224ed)[_0x0946('0x2a')](_0x319aa2);};}exports[_0x0946('0x2b')]=function(_0x2563b7,_0x20f1be){var _0x498707={},_0x49b3e2={},_0x3a3701={'count':0x0,'rows':[]};var _0x527976=_[_0x0946('0x2c')](db[_0x0946('0x2d')][_0x0946('0x2e')],function(_0x38866f){return{'name':_0x38866f['fieldName'],'type':_0x38866f[_0x0946('0x2f')]['key']};});_0x49b3e2['model']=_[_0x0946('0x2c')](_0x527976,_0x0946('0x29'));_0x49b3e2['query']=_[_0x0946('0x30')](_0x2563b7[_0x0946('0x31')]);_0x49b3e2['filters']=_[_0x0946('0x32')](_0x49b3e2[_0x0946('0x33')],_0x49b3e2[_0x0946('0x31')]);_0x498707[_0x0946('0x34')]=_['intersection'](_0x49b3e2[_0x0946('0x33')],qs[_0x0946('0x35')](_0x2563b7[_0x0946('0x31')][_0x0946('0x35')]));_0x498707[_0x0946('0x34')]=_0x498707[_0x0946('0x34')]['length']?_0x498707['attributes']:_0x49b3e2[_0x0946('0x33')];if(!_0x2563b7[_0x0946('0x31')][_0x0946('0x36')](_0x0946('0x37'))){_0x498707[_0x0946('0x1c')]=qs['limit'](_0x2563b7[_0x0946('0x31')][_0x0946('0x1c')]);_0x498707['offset']=qs['offset'](_0x2563b7[_0x0946('0x31')]['offset']);}_0x498707[_0x0946('0x38')]=qs[_0x0946('0x39')](_0x2563b7['query']['sort']);_0x498707['where']=qs[_0x0946('0x3a')](_[_0x0946('0x3b')](_0x2563b7[_0x0946('0x31')],_0x49b3e2['filters']),_0x527976);if(_0x2563b7[_0x0946('0x31')][_0x0946('0x3c')]){_0x498707[_0x0946('0x3d')]=_[_0x0946('0x3e')](_0x498707[_0x0946('0x3d')],{'$or':_[_0x0946('0x2c')](_0x527976,function(_0x461761){if(_0x461761['type']!==_0x0946('0x3f')){var _0x5d9a9d={};_0x5d9a9d[_0x461761['name']]={'$like':'%'+_0x2563b7[_0x0946('0x31')][_0x0946('0x3c')]+'%'};return _0x5d9a9d;}})});}_0x498707=_[_0x0946('0x3e')]({},_0x498707,_0x2563b7[_0x0946('0x40')]);var _0x38b70c={'where':_0x498707[_0x0946('0x3d')]};return db[_0x0946('0x2d')][_0x0946('0x1a')](_0x38b70c)[_0x0946('0x23')](function(_0xc2f1c8){_0x3a3701[_0x0946('0x1a')]=_0xc2f1c8;if(_0x2563b7[_0x0946('0x31')][_0x0946('0x41')]){_0x498707[_0x0946('0x42')]=[{'all':!![]}];}return db['Campaign'][_0x0946('0x43')](_0x498707);})['then'](function(_0x2a5d18){_0x3a3701['rows']=_0x2a5d18;return _0x3a3701;})['then'](respondWithFilteredResult(_0x20f1be,_0x498707))['catch'](handleError(_0x20f1be,null));};exports[_0x0946('0x44')]=function(_0x513f21,_0x5ae0fa){var _0x275fc7={'raw':![],'where':{'id':_0x513f21['params']['id']}},_0x497310={};_0x497310[_0x0946('0x33')]=_[_0x0946('0x30')](db[_0x0946('0x2d')][_0x0946('0x2e')]);_0x497310[_0x0946('0x31')]=_[_0x0946('0x30')](_0x513f21['query']);_0x497310['filters']=_['intersection'](_0x497310[_0x0946('0x33')],_0x497310['query']);_0x275fc7[_0x0946('0x34')]=_['intersection'](_0x497310[_0x0946('0x33')],qs[_0x0946('0x35')](_0x513f21[_0x0946('0x31')][_0x0946('0x35')]));_0x275fc7['attributes']=_0x275fc7[_0x0946('0x34')][_0x0946('0x45')]?_0x275fc7[_0x0946('0x34')]:_0x497310[_0x0946('0x33')];if(_0x513f21['query'][_0x0946('0x41')]){_0x275fc7[_0x0946('0x42')]=[{'all':!![]}];}_0x275fc7=_[_0x0946('0x3e')]({},_0x275fc7,_0x513f21[_0x0946('0x40')]);return db[_0x0946('0x2d')][_0x0946('0x46')](_0x275fc7)[_0x0946('0x23')](handleEntityNotFound(_0x5ae0fa,null))[_0x0946('0x23')](respondWithResult(_0x5ae0fa,null))['catch'](handleError(_0x5ae0fa,null));};exports[_0x0946('0x47')]=function(_0x43df8d,_0x25d898){return db[_0x0946('0x2d')][_0x0946('0x47')](_0x43df8d[_0x0946('0x48')],{})[_0x0946('0x23')](function(_0x3724b0){var _0x134fe1=_0x43df8d[_0x0946('0x49')][_0x0946('0x24')]({'plain':!![]});if(!_0x134fe1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x134fe1[_0x0946('0x4a')]===_0x0946('0x49')){var _0x2d9146=_0x3724b0['get']({'plain':!![]});var _0x41579c=_0x0946('0x25');return db[_0x0946('0x4b')]['find']({'where':{'name':_0x41579c,'userProfileId':_0x134fe1['userProfileId']},'raw':!![]})['then'](function(_0x5ed0da){if(_0x5ed0da&&_0x5ed0da[_0x0946('0x4c')]===0x0){return db['UserProfileResource'][_0x0946('0x47')]({'name':_0x2d9146[_0x0946('0x29')],'resourceId':_0x2d9146['id'],'type':_0x5ed0da['name'],'sectionId':_0x5ed0da['id']},{})[_0x0946('0x23')](function(){return _0x3724b0;});}else{return _0x3724b0;}})[_0x0946('0x4d')](function(_0x1741be){logger[_0x0946('0x27')](_0x0946('0x4e'),_0x1741be);throw _0x1741be;});}return _0x3724b0;})['then'](respondWithResult(_0x25d898,0xc9))[_0x0946('0x4d')](handleError(_0x25d898,null));};exports[_0x0946('0x4f')]=function(_0x23d989,_0x16c5ab){var _0x2e2438={'where':{'id':_0x23d989[_0x0946('0x50')]['id']}},_0x1d75b6={};_0x1d75b6[_0x0946('0x33')]=_[_0x0946('0x30')](db['Campaign'][_0x0946('0x2e')]);_0x2e2438[_0x0946('0x34')]=_[_0x0946('0x32')](_0x1d75b6['model'],qs[_0x0946('0x35')](_0x23d989[_0x0946('0x31')][_0x0946('0x35')]));_0x2e2438[_0x0946('0x34')]=_0x2e2438[_0x0946('0x34')]['length']?_0x2e2438[_0x0946('0x34')]:_0x1d75b6[_0x0946('0x33')];if(_0x23d989[_0x0946('0x31')][_0x0946('0x41')]){_0x2e2438[_0x0946('0x42')]=[{'all':!![]}];}_0x2e2438=_[_0x0946('0x3e')]({},_0x2e2438,_0x23d989['options']);return db[_0x0946('0x2d')][_0x0946('0x46')](_0x2e2438)[_0x0946('0x23')](handleEntityNotFound(_0x16c5ab,null))[_0x0946('0x23')](function(_0x5589af){if(_0x5589af){var _0x1c42ec=_0x5589af[_0x0946('0x24')]({'plain':!![]});_0x1c42ec=qs['omit'](_0x1c42ec,['id',_0x0946('0x51'),_0x0946('0x52')]);_0x23d989[_0x0946('0x48')]=_[_0x0946('0x53')](_0x23d989[_0x0946('0x48')],['id',_0x0946('0x51'),_0x0946('0x52')]);return db[_0x0946('0x2d')][_0x0946('0x47')](_['merge'](_0x1c42ec,_0x23d989[_0x0946('0x48')]),{'include':_0x23d989[_0x0946('0x31')][_0x0946('0x41')]?[{'all':!![]}]:undefined})[_0x0946('0x23')](function(_0x31fed4){var _0x31e485=_0x23d989[_0x0946('0x49')][_0x0946('0x24')]({'plain':!![]});if(!_0x31e485)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x31e485[_0x0946('0x4a')]===_0x0946('0x49')){var _0x397cb9=_0x31fed4[_0x0946('0x24')]({'plain':!![]});var _0x5460a3=_0x0946('0x25');return db['UserProfileSection']['find']({'where':{'name':_0x5460a3,'userProfileId':_0x31e485[_0x0946('0x54')]},'raw':!![]})[_0x0946('0x23')](function(_0x18f8f0){if(_0x18f8f0&&_0x18f8f0['autoAssociation']===0x0){return db[_0x0946('0x55')]['create']({'name':_0x397cb9[_0x0946('0x29')],'resourceId':_0x397cb9['id'],'type':_0x18f8f0[_0x0946('0x29')],'sectionId':_0x18f8f0['id']},{})[_0x0946('0x23')](function(){return _0x31fed4;});}else{return _0x31fed4;}})[_0x0946('0x4d')](function(_0x109055){logger[_0x0946('0x27')](_0x0946('0x4e'),_0x109055);throw _0x109055;});}return _0x31fed4;});}})[_0x0946('0x23')](respondWithResult(_0x16c5ab,0xc9))[_0x0946('0x4d')](handleError(_0x16c5ab,null));};exports['update']=function(_0x1ff3a5,_0x175394){if(_0x1ff3a5[_0x0946('0x48')]['id']){delete _0x1ff3a5[_0x0946('0x48')]['id'];}return db['Campaign']['find']({'where':{'id':_0x1ff3a5[_0x0946('0x50')]['id']}})[_0x0946('0x23')](handleEntityNotFound(_0x175394,null))['then'](saveUpdates(_0x1ff3a5[_0x0946('0x48')],null))[_0x0946('0x23')](respondWithResult(_0x175394,null))[_0x0946('0x4d')](handleError(_0x175394,null));};exports[_0x0946('0x26')]=function(_0x151195,_0x273eca){return db[_0x0946('0x2d')][_0x0946('0x46')]({'where':{'id':_0x151195[_0x0946('0x50')]['id']}})[_0x0946('0x23')](handleEntityNotFound(_0x273eca,null))[_0x0946('0x23')](removeEntity(_0x273eca,null))[_0x0946('0x4d')](handleError(_0x273eca,null));};exports[_0x0946('0x56')]=function(_0x82ef4,_0x425e93,_0x3a6099){var _0x5051cc={'raw':!![],'where':{}};var _0x41c1e7={};var _0x196506={'count':0x0,'rows':[]};return db[_0x0946('0x2d')][_0x0946('0x57')]({'where':{'id':_0x82ef4[_0x0946('0x50')]['id']}})[_0x0946('0x23')](handleEntityNotFound(_0x425e93,null))[_0x0946('0x23')](function(_0x3c0d8d){if(_0x3c0d8d){_0x41c1e7[_0x0946('0x33')]=_[_0x0946('0x30')](db['CmHopper'][_0x0946('0x2e')]);_0x41c1e7['query']=_[_0x0946('0x30')](_0x82ef4[_0x0946('0x31')]);_0x41c1e7[_0x0946('0x3a')]=_['intersection'](_0x41c1e7['model'],_0x41c1e7[_0x0946('0x31')]);_0x5051cc['attributes']=_[_0x0946('0x32')](_0x41c1e7['model'],qs[_0x0946('0x35')](_0x82ef4[_0x0946('0x31')][_0x0946('0x35')]));_0x5051cc[_0x0946('0x34')]=_0x5051cc[_0x0946('0x34')][_0x0946('0x45')]?_0x5051cc[_0x0946('0x34')]:_0x41c1e7[_0x0946('0x33')];if(!_0x82ef4[_0x0946('0x31')][_0x0946('0x36')]('nolimit')){_0x5051cc[_0x0946('0x1c')]=qs[_0x0946('0x1c')](_0x82ef4[_0x0946('0x31')]['limit']);_0x5051cc[_0x0946('0x1b')]=qs[_0x0946('0x1b')](_0x82ef4[_0x0946('0x31')]['offset']);}_0x5051cc[_0x0946('0x38')]=qs[_0x0946('0x39')](_0x82ef4['query'][_0x0946('0x39')]);_0x5051cc[_0x0946('0x3d')]=qs[_0x0946('0x3a')](_[_0x0946('0x3b')](_0x82ef4['query'],_0x41c1e7[_0x0946('0x3a')]));_0x5051cc['where'][_0x0946('0x58')]=_0x3c0d8d['id'];if(_0x82ef4[_0x0946('0x31')][_0x0946('0x3c')]){_0x5051cc[_0x0946('0x3d')]=_['merge'](_0x5051cc[_0x0946('0x3d')],{'$or':_[_0x0946('0x2c')](_0x5051cc[_0x0946('0x34')],function(_0x5717c3){var _0x133285={};_0x133285[_0x5717c3]={'$like':'%'+_0x82ef4[_0x0946('0x31')][_0x0946('0x3c')]+'%'};return _0x133285;})});}_0x5051cc=_[_0x0946('0x3e')]({},_0x5051cc,_0x82ef4['options']);return db['CmHopper'][_0x0946('0x1a')]({'where':_0x5051cc['where']})[_0x0946('0x23')](function(_0x20c704){_0x196506[_0x0946('0x1a')]=_0x20c704;if(_0x82ef4[_0x0946('0x31')]['includeAll']){_0x5051cc[_0x0946('0x42')]=[{'all':!![]}];}return db[_0x0946('0x59')][_0x0946('0x43')](_0x5051cc);})[_0x0946('0x23')](function(_0xc7f89b){_0x196506['rows']=_0xc7f89b;return _0x196506;});}})[_0x0946('0x23')](respondWithFilteredResult(_0x425e93,_0x5051cc))[_0x0946('0x4d')](handleError(_0x425e93,null));};exports[_0x0946('0x5a')]=function(_0x372604,_0x101257,_0x716ece){var _0x5ea9d4={'raw':!![],'where':{}};var _0x33f946={};var _0x359985={'count':0x0,'rows':[]};return db[_0x0946('0x2d')][_0x0946('0x57')]({'where':{'id':_0x372604[_0x0946('0x50')]['id']}})[_0x0946('0x23')](handleEntityNotFound(_0x101257,null))[_0x0946('0x23')](function(_0x11e072){if(_0x11e072){_0x33f946[_0x0946('0x33')]=_['keys'](db[_0x0946('0x5b')]['rawAttributes']);_0x33f946[_0x0946('0x31')]=_[_0x0946('0x30')](_0x372604[_0x0946('0x31')]);_0x33f946[_0x0946('0x3a')]=_['intersection'](_0x33f946['model'],_0x33f946[_0x0946('0x31')]);_0x5ea9d4[_0x0946('0x34')]=_[_0x0946('0x32')](_0x33f946['model'],qs[_0x0946('0x35')](_0x372604['query'][_0x0946('0x35')]));_0x5ea9d4[_0x0946('0x34')]=_0x5ea9d4[_0x0946('0x34')][_0x0946('0x45')]?_0x5ea9d4['attributes']:_0x33f946['model'];if(!_0x372604[_0x0946('0x31')][_0x0946('0x36')](_0x0946('0x37'))){_0x5ea9d4[_0x0946('0x1c')]=qs[_0x0946('0x1c')](_0x372604[_0x0946('0x31')][_0x0946('0x1c')]);_0x5ea9d4[_0x0946('0x1b')]=qs[_0x0946('0x1b')](_0x372604[_0x0946('0x31')]['offset']);}_0x5ea9d4['order']=qs['sort'](_0x372604[_0x0946('0x31')][_0x0946('0x39')]);_0x5ea9d4['where']=qs[_0x0946('0x3a')](_['pick'](_0x372604['query'],_0x33f946['filters']));_0x5ea9d4[_0x0946('0x3d')][_0x0946('0x58')]=_0x11e072['id'];if(_0x372604[_0x0946('0x31')][_0x0946('0x3c')]){_0x5ea9d4[_0x0946('0x3d')]=_[_0x0946('0x3e')](_0x5ea9d4['where'],{'$or':_[_0x0946('0x2c')](_0x5ea9d4['attributes'],function(_0x218ca8){var _0x36e760={};_0x36e760[_0x218ca8]={'$like':'%'+_0x372604[_0x0946('0x31')]['filter']+'%'};return _0x36e760;})});}_0x5ea9d4=_['merge']({},_0x5ea9d4,_0x372604[_0x0946('0x40')]);return db['CmHopperHistory']['count']({'where':_0x5ea9d4[_0x0946('0x3d')]})['then'](function(_0x1fc09f){_0x359985[_0x0946('0x1a')]=_0x1fc09f;if(_0x372604[_0x0946('0x31')][_0x0946('0x41')]){_0x5ea9d4[_0x0946('0x42')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x0946('0x43')](_0x5ea9d4);})[_0x0946('0x23')](function(_0x5dc864){_0x359985['rows']=_0x5dc864;return _0x359985;});}})[_0x0946('0x23')](respondWithFilteredResult(_0x101257,_0x5ea9d4))[_0x0946('0x4d')](handleError(_0x101257,null));};exports[_0x0946('0x5c')]=function(_0x373553,_0xfa9acf,_0x55b432){var _0x34cd2d={'raw':!![],'where':{}};var _0x1c43a9={};var _0x5b1276={'count':0x0,'rows':[]};return db[_0x0946('0x2d')]['findOne']({'where':{'id':_0x373553[_0x0946('0x50')]['id']}})[_0x0946('0x23')](handleEntityNotFound(_0xfa9acf,null))[_0x0946('0x23')](function(_0x5f1f12){if(_0x5f1f12){_0x1c43a9[_0x0946('0x33')]=_['keys'](db[_0x0946('0x5d')][_0x0946('0x2e')]);_0x1c43a9[_0x0946('0x31')]=_['keys'](_0x373553['query']);_0x1c43a9[_0x0946('0x3a')]=_[_0x0946('0x32')](_0x1c43a9[_0x0946('0x33')],_0x1c43a9[_0x0946('0x31')]);_0x34cd2d[_0x0946('0x34')]=_[_0x0946('0x32')](_0x1c43a9['model'],qs[_0x0946('0x35')](_0x373553[_0x0946('0x31')][_0x0946('0x35')]));_0x34cd2d[_0x0946('0x34')]=_0x34cd2d[_0x0946('0x34')][_0x0946('0x45')]?_0x34cd2d[_0x0946('0x34')]:_0x1c43a9['model'];if(!_0x373553[_0x0946('0x31')][_0x0946('0x36')](_0x0946('0x37'))){_0x34cd2d[_0x0946('0x1c')]=qs['limit'](_0x373553[_0x0946('0x31')][_0x0946('0x1c')]);_0x34cd2d[_0x0946('0x1b')]=qs[_0x0946('0x1b')](_0x373553[_0x0946('0x31')][_0x0946('0x1b')]);}_0x34cd2d['order']=qs['sort'](_0x373553[_0x0946('0x31')][_0x0946('0x39')]);_0x34cd2d[_0x0946('0x3d')]=qs[_0x0946('0x3a')](_[_0x0946('0x3b')](_0x373553[_0x0946('0x31')],_0x1c43a9[_0x0946('0x3a')]));_0x34cd2d[_0x0946('0x3d')][_0x0946('0x58')]=_0x5f1f12['id'];if(_0x373553[_0x0946('0x31')]['filter']){_0x34cd2d[_0x0946('0x3d')]=_[_0x0946('0x3e')](_0x34cd2d[_0x0946('0x3d')],{'$or':_[_0x0946('0x2c')](_0x34cd2d[_0x0946('0x34')],function(_0x52a437){var _0x39bdb7={};_0x39bdb7[_0x52a437]={'$like':'%'+_0x373553[_0x0946('0x31')]['filter']+'%'};return _0x39bdb7;})});}_0x34cd2d=_[_0x0946('0x3e')]({},_0x34cd2d,_0x373553[_0x0946('0x40')]);return db['CmHopperFinal'][_0x0946('0x1a')]({'where':_0x34cd2d[_0x0946('0x3d')]})[_0x0946('0x23')](function(_0x29fe94){_0x5b1276[_0x0946('0x1a')]=_0x29fe94;if(_0x373553['query'][_0x0946('0x41')]){_0x34cd2d[_0x0946('0x42')]=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x34cd2d);})[_0x0946('0x23')](function(_0x14fb52){_0x5b1276[_0x0946('0x5e')]=_0x14fb52;return _0x5b1276;});}})['then'](respondWithFilteredResult(_0xfa9acf,_0x34cd2d))['catch'](handleError(_0xfa9acf,null));};exports[_0x0946('0x5f')]=function(_0x2faea8,_0x567de4,_0x3e0d57){var _0x277f63={'raw':!![],'where':{}};var _0x4b28e5={};var _0x3ea9bb={'count':0x0,'rows':[]};return db[_0x0946('0x2d')][_0x0946('0x57')]({'where':{'id':_0x2faea8[_0x0946('0x50')]['id']}})[_0x0946('0x23')](handleEntityNotFound(_0x567de4,null))[_0x0946('0x23')](function(_0xf1f8f5){if(_0xf1f8f5){_0x4b28e5[_0x0946('0x33')]=_[_0x0946('0x30')](db['CmHopperBlack']['rawAttributes']);_0x4b28e5[_0x0946('0x31')]=_[_0x0946('0x30')](_0x2faea8['query']);_0x4b28e5[_0x0946('0x3a')]=_[_0x0946('0x32')](_0x4b28e5[_0x0946('0x33')],_0x4b28e5[_0x0946('0x31')]);_0x277f63[_0x0946('0x34')]=_['intersection'](_0x4b28e5['model'],qs[_0x0946('0x35')](_0x2faea8[_0x0946('0x31')][_0x0946('0x35')]));_0x277f63[_0x0946('0x34')]=_0x277f63[_0x0946('0x34')]['length']?_0x277f63['attributes']:_0x4b28e5[_0x0946('0x33')];if(!_0x2faea8[_0x0946('0x31')][_0x0946('0x36')]('nolimit')){_0x277f63[_0x0946('0x1c')]=qs[_0x0946('0x1c')](_0x2faea8[_0x0946('0x31')][_0x0946('0x1c')]);_0x277f63['offset']=qs[_0x0946('0x1b')](_0x2faea8[_0x0946('0x31')][_0x0946('0x1b')]);}_0x277f63['order']=qs[_0x0946('0x39')](_0x2faea8['query'][_0x0946('0x39')]);_0x277f63[_0x0946('0x3d')]=qs['filters'](_[_0x0946('0x3b')](_0x2faea8['query'],_0x4b28e5['filters']));_0x277f63[_0x0946('0x3d')][_0x0946('0x58')]=_0xf1f8f5['id'];if(_0x2faea8['query'][_0x0946('0x3c')]){_0x277f63[_0x0946('0x3d')]=_['merge'](_0x277f63['where'],{'$or':_['map'](_0x277f63[_0x0946('0x34')],function(_0x367913){var _0x3853e1={};_0x3853e1[_0x367913]={'$like':'%'+_0x2faea8[_0x0946('0x31')]['filter']+'%'};return _0x3853e1;})});}_0x277f63=_[_0x0946('0x3e')]({},_0x277f63,_0x2faea8[_0x0946('0x40')]);return db[_0x0946('0x60')][_0x0946('0x1a')]({'where':_0x277f63[_0x0946('0x3d')]})[_0x0946('0x23')](function(_0x1b73e4){_0x3ea9bb[_0x0946('0x1a')]=_0x1b73e4;if(_0x2faea8[_0x0946('0x31')][_0x0946('0x41')]){_0x277f63[_0x0946('0x42')]=[{'all':!![]}];}return db[_0x0946('0x60')][_0x0946('0x43')](_0x277f63);})[_0x0946('0x23')](function(_0x3000bd){_0x3ea9bb[_0x0946('0x5e')]=_0x3000bd;return _0x3ea9bb;});}})['then'](respondWithFilteredResult(_0x567de4,_0x277f63))['catch'](handleError(_0x567de4,null));};exports[_0x0946('0x61')]=function(_0x169644,_0x55aef0,_0x3f786e){var _0x428cdc={};var _0x4c3239={};var _0x4f4028;var _0x596630;return db[_0x0946('0x2d')][_0x0946('0x57')]({'where':{'id':_0x169644[_0x0946('0x50')]['id']}})[_0x0946('0x23')](handleEntityNotFound(_0x55aef0,null))[_0x0946('0x23')](function(_0x182ef4){if(_0x182ef4){_0x4f4028=_0x182ef4;_0x4c3239[_0x0946('0x33')]=_[_0x0946('0x30')](db[_0x0946('0x62')][_0x0946('0x2e')]);_0x4c3239[_0x0946('0x31')]=_[_0x0946('0x30')](_0x169644[_0x0946('0x31')]);_0x4c3239[_0x0946('0x3a')]=_[_0x0946('0x32')](_0x4c3239['model'],_0x4c3239[_0x0946('0x31')]);_0x428cdc[_0x0946('0x34')]=_['intersection'](_0x4c3239['model'],qs[_0x0946('0x35')](_0x169644['query'][_0x0946('0x35')]));_0x428cdc['attributes']=_0x428cdc[_0x0946('0x34')][_0x0946('0x45')]?_0x428cdc[_0x0946('0x34')]:_0x4c3239[_0x0946('0x33')];_0x428cdc['order']=qs['sort'](_0x169644['query']['sort']);_0x428cdc[_0x0946('0x3d')]=qs[_0x0946('0x3a')](_[_0x0946('0x3b')](_0x169644[_0x0946('0x31')],_0x4c3239[_0x0946('0x3a')]));if(_0x169644[_0x0946('0x31')]['filter']){_0x428cdc['where']=_[_0x0946('0x3e')](_0x428cdc['where'],{'$or':_[_0x0946('0x2c')](_0x428cdc[_0x0946('0x34')],function(_0x31361f){var _0x455619={};_0x455619[_0x31361f]={'$like':'%'+_0x169644[_0x0946('0x31')][_0x0946('0x3c')]+'%'};return _0x455619;})});}_0x428cdc=_[_0x0946('0x3e')]({},_0x428cdc,_0x169644['options']);return _0x4f4028['getLists'](_0x428cdc);}})['then'](function(_0x394db8){if(_0x394db8){_0x596630=_0x394db8[_0x0946('0x45')];if(!_0x169644[_0x0946('0x31')]['hasOwnProperty'](_0x0946('0x37'))){_0x428cdc[_0x0946('0x1c')]=qs[_0x0946('0x1c')](_0x169644[_0x0946('0x31')][_0x0946('0x1c')]);_0x428cdc[_0x0946('0x1b')]=qs[_0x0946('0x1b')](_0x169644[_0x0946('0x31')]['offset']);}return _0x4f4028[_0x0946('0x61')](_0x428cdc);}})[_0x0946('0x23')](function(_0x200e43){if(_0x200e43){return _0x200e43?{'count':_0x596630,'rows':_0x200e43}:null;}})[_0x0946('0x23')](respondWithResult(_0x55aef0,null))['catch'](handleError(_0x55aef0,null));};exports[_0x0946('0x63')]=function(_0x358f35,_0x78c8ea,_0x4716b8){var _0x56924c,_0x55953d;return db[_0x0946('0x2d')][_0x0946('0x46')]({'where':{'id':_0x358f35[_0x0946('0x50')]['id']}})[_0x0946('0x23')](handleEntityNotFound(_0x78c8ea,null))[_0x0946('0x23')](function(_0x289652){if(_0x289652){_0x55953d=_0x289652;return _0x289652[_0x0946('0x63')](_0x358f35['body']['ids'],_[_0x0946('0x53')](_0x358f35[_0x0946('0x48')],[_0x0946('0x64'),'id'])||{});}return null;})['spread'](function(_0x156545){var _0x5099fd;_0x56924c=_0x156545||[];var _0x273092=[];if(_0x156545){for(var _0x30918b=0x0;_0x30918b<_0x156545['length'];_0x30918b+=0x1){var _0x1c2740=_0x156545[_0x30918b][_0x0946('0x24')]({'plain':!![]});_0x55953d[_0x0946('0x65')]=_0x358f35[_0x0946('0x48')][_0x0946('0x65')]?_0x358f35[_0x0946('0x48')][_0x0946('0x65')]:_0x55953d[_0x0946('0x65')];switch(_0x55953d['dialCheckDuplicateType']){case _0x0946('0x66'):_0x5099fd=squel['insert']()[_0x0946('0x67')](_0x0946('0x68'))[_0x0946('0x69')]([_0x0946('0x6a'),_0x0946('0x6b'),_0x0946('0x6c'),'ListId',_0x0946('0x58'),_0x0946('0x51'),_0x0946('0x52')],squel['select']()[_0x0946('0x6d')]('phone',_0x0946('0x6a'))[_0x0946('0x6d')](_0x0946('0x6e'),_0x0946('0x6b'))[_0x0946('0x6d')]('id',_0x0946('0x6c'))[_0x0946('0x6d')](_0x1c2740[_0x0946('0x6f')][_0x0946('0x70')](),_0x0946('0x71'))[_0x0946('0x6d')](_0x358f35['params']['id']['toString'](),_0x0946('0x58'))['field'](_0x0946('0x6e'),_0x0946('0x51'))['field']('NOW()',_0x0946('0x52'))[_0x0946('0x72')](_0x0946('0x73'))[_0x0946('0x3d')]('deletedAt\x20IS\x20NULL')['where']('ListId\x20=\x20?',_0x1c2740[_0x0946('0x6f')][_0x0946('0x70')]())[_0x0946('0x3d')](_0x0946('0x74'))[_0x0946('0x3d')](_0x0946('0x75'),squel[_0x0946('0x76')]()[_0x0946('0x6d')](_0x0946('0x77'))['from'](_0x0946('0x78'))[_0x0946('0x3d')](_0x0946('0x79'),_0x358f35['params']['id']['toString']()))[_0x0946('0x3d')](_0x0946('0x75'),squel[_0x0946('0x76')]()[_0x0946('0x6d')](_0x0946('0x7a'))[_0x0946('0x72')](_0x0946('0x68'))[_0x0946('0x3d')](_0x0946('0x79'),_0x358f35[_0x0946('0x50')]['id'][_0x0946('0x70')]())))['toString']();break;case _0x0946('0x7b'):_0x5099fd=squel[_0x0946('0x7c')]()[_0x0946('0x67')](_0x0946('0x68'))[_0x0946('0x69')]([_0x0946('0x6a'),_0x0946('0x6b'),_0x0946('0x6c'),'ListId',_0x0946('0x58'),_0x0946('0x51'),_0x0946('0x52')],squel[_0x0946('0x76')]()[_0x0946('0x6d')]('phone',_0x0946('0x6a'))['field']('NOW()',_0x0946('0x6b'))[_0x0946('0x6d')]('id',_0x0946('0x6c'))[_0x0946('0x6d')](_0x1c2740[_0x0946('0x6f')]['toString'](),'ListId')[_0x0946('0x6d')](_0x358f35[_0x0946('0x50')]['id'][_0x0946('0x70')](),_0x0946('0x58'))[_0x0946('0x6d')](_0x0946('0x6e'),_0x0946('0x51'))[_0x0946('0x6d')](_0x0946('0x6e'),_0x0946('0x52'))[_0x0946('0x72')](_0x0946('0x73'))[_0x0946('0x3d')](_0x0946('0x7d'))[_0x0946('0x3d')](_0x0946('0x7e'),_0x1c2740[_0x0946('0x6f')][_0x0946('0x70')]())[_0x0946('0x3d')]('phone\x20IS\x20NOT\x20NULL')[_0x0946('0x3d')]('phone\x20NOT\x20IN\x20(?)',squel[_0x0946('0x76')]()[_0x0946('0x6d')]('COALESCE(phone,\x27\x27)')['from'](_0x0946('0x68'))[_0x0946('0x3d')](_0x0946('0x79'),_0x358f35[_0x0946('0x50')]['id'][_0x0946('0x70')]())))[_0x0946('0x70')]();break;default:_0x5099fd=squel[_0x0946('0x7c')]()[_0x0946('0x67')]('cm_hopper')[_0x0946('0x69')]([_0x0946('0x6a'),'scheduledAt',_0x0946('0x6c'),_0x0946('0x71'),'CampaignId',_0x0946('0x51'),_0x0946('0x52')],squel[_0x0946('0x76')]()['field'](_0x0946('0x6a'),_0x0946('0x6a'))['field'](_0x0946('0x6e'),_0x0946('0x6b'))[_0x0946('0x6d')]('id','ContactId')[_0x0946('0x6d')](_0x1c2740[_0x0946('0x6f')][_0x0946('0x70')](),_0x0946('0x71'))['field'](_0x358f35[_0x0946('0x50')]['id'][_0x0946('0x70')](),_0x0946('0x58'))[_0x0946('0x6d')](_0x0946('0x6e'),_0x0946('0x51'))['field']('NOW()',_0x0946('0x52'))['from'](_0x0946('0x73'))['where'](_0x0946('0x7d'))['where'](_0x0946('0x7e'),_0x1c2740[_0x0946('0x6f')][_0x0946('0x70')]())['where'](_0x0946('0x74')))[_0x0946('0x70')]();}_0x273092[_0x0946('0x7f')](db[_0x0946('0x80')][_0x0946('0x31')](_0x5099fd));}return BPromise[_0x0946('0x81')](_0x273092);}})[_0x0946('0x23')](function(){return _0x56924c;})[_0x0946('0x23')](respondWithResult(_0x78c8ea,null))[_0x0946('0x4d')](handleError(_0x78c8ea,null));};exports[_0x0946('0x82')]=function(_0x5da27b,_0x17b2e8,_0x58b77c){return db['Campaign'][_0x0946('0x46')]({'where':{'id':_0x5da27b[_0x0946('0x50')]['id']}})[_0x0946('0x23')](handleEntityNotFound(_0x17b2e8,null))[_0x0946('0x23')](function(_0x3040b2){if(_0x3040b2){return _0x3040b2[_0x0946('0x82')](_0x5da27b[_0x0946('0x31')]['ids']);}})['then'](function(_0x8c18d1){if(_0x8c18d1){return db[_0x0946('0x59')][_0x0946('0x26')]({'where':{'ListId':_0x5da27b[_0x0946('0x31')]['ids'],'CampaignId':_0x5da27b[_0x0946('0x50')]['id']}})[_0x0946('0x23')](function(){return _0x8c18d1;});}})['then'](respondWithStatusCode(_0x17b2e8,null))[_0x0946('0x4d')](handleError(_0x17b2e8,null));};exports['getBlackLists']=function(_0x490110,_0x3886fc,_0x4a5577){var _0x19919b={'raw':!![],'where':{}};var _0x8e8738={};var _0x3b0ad6={'count':0x0,'rows':[]};return db['Campaign'][_0x0946('0x57')]({'where':{'id':_0x490110['params']['id']}})[_0x0946('0x23')](handleEntityNotFound(_0x3886fc,null))[_0x0946('0x23')](function(_0x370009){if(_0x370009){_0x8e8738[_0x0946('0x33')]=_[_0x0946('0x30')](db[_0x0946('0x62')][_0x0946('0x2e')]);_0x8e8738[_0x0946('0x31')]=_[_0x0946('0x30')](_0x490110[_0x0946('0x31')]);_0x8e8738['filters']=_[_0x0946('0x32')](_0x8e8738[_0x0946('0x33')],_0x8e8738[_0x0946('0x31')]);_0x19919b['attributes']=_[_0x0946('0x32')](_0x8e8738[_0x0946('0x33')],qs[_0x0946('0x35')](_0x490110[_0x0946('0x31')][_0x0946('0x35')]));_0x19919b[_0x0946('0x34')]=_0x19919b[_0x0946('0x34')][_0x0946('0x45')]?_0x19919b[_0x0946('0x34')]:_0x8e8738['model'];if(!_0x490110[_0x0946('0x31')][_0x0946('0x36')](_0x0946('0x37'))){_0x19919b['limit']=qs[_0x0946('0x1c')](_0x490110['query'][_0x0946('0x1c')]);_0x19919b[_0x0946('0x1b')]=qs[_0x0946('0x1b')](_0x490110['query'][_0x0946('0x1b')]);}_0x19919b[_0x0946('0x38')]=qs[_0x0946('0x39')](_0x490110[_0x0946('0x31')][_0x0946('0x39')]);_0x19919b[_0x0946('0x3d')]=qs[_0x0946('0x3a')](_['pick'](_0x490110[_0x0946('0x31')],_0x8e8738[_0x0946('0x3a')]));_0x19919b[_0x0946('0x3d')][_0x0946('0x58')]=_0x370009['id'];if(_0x490110[_0x0946('0x31')]['filter']){_0x19919b[_0x0946('0x3d')]=_[_0x0946('0x3e')](_0x19919b['where'],{'$or':_['map'](_0x19919b[_0x0946('0x34')],function(_0x420402){var _0x335201={};_0x335201[_0x420402]={'$like':'%'+_0x490110[_0x0946('0x31')]['filter']+'%'};return _0x335201;})});}_0x19919b=_[_0x0946('0x3e')]({},_0x19919b,_0x490110[_0x0946('0x40')]);return db[_0x0946('0x62')][_0x0946('0x1a')]({'where':_0x19919b[_0x0946('0x3d')]})[_0x0946('0x23')](function(_0x37f162){_0x3b0ad6[_0x0946('0x1a')]=_0x37f162;if(_0x490110[_0x0946('0x31')][_0x0946('0x41')]){_0x19919b[_0x0946('0x42')]=[{'all':!![]}];}return db['CmList'][_0x0946('0x43')](_0x19919b);})['then'](function(_0x4bc3ab){_0x3b0ad6[_0x0946('0x5e')]=_0x4bc3ab;return _0x3b0ad6;});}})[_0x0946('0x23')](respondWithFilteredResult(_0x3886fc,_0x19919b))['catch'](handleError(_0x3886fc,null));};exports[_0x0946('0x83')]=function(_0x310ee7,_0x56bb84,_0x3471f5){var _0x435f22,_0x41d04c;return db[_0x0946('0x2d')][_0x0946('0x46')]({'where':{'id':_0x310ee7['params']['id']}})[_0x0946('0x23')](handleEntityNotFound(_0x56bb84,null))[_0x0946('0x23')](function(_0x54a017){if(_0x54a017){_0x41d04c=_0x54a017;return _0x54a017[_0x0946('0x83')](_0x310ee7[_0x0946('0x48')][_0x0946('0x64')],_[_0x0946('0x53')](_0x310ee7[_0x0946('0x48')],[_0x0946('0x64'),'id'])||{});}return null;})[_0x0946('0x84')](function(_0x4104a2){var _0x7a9d5f;_0x435f22=_0x4104a2||[];var _0x2aaa4f=[];if(_0x4104a2){for(var _0x468267=0x0;_0x468267<_0x4104a2[_0x0946('0x45')];_0x468267+=0x1){var _0x174922=_0x4104a2[_0x468267]['get']({'plain':!![]});_0x7a9d5f=squel[_0x0946('0x7c')]()['into'](_0x0946('0x85'))[_0x0946('0x69')]([_0x0946('0x6a'),'ContactId',_0x0946('0x71'),'CampaignId',_0x0946('0x51'),_0x0946('0x52')],squel[_0x0946('0x76')]()[_0x0946('0x6d')](_0x0946('0x6a'),_0x0946('0x6a'))['field']('id',_0x0946('0x6c'))[_0x0946('0x6d')](_0x174922[_0x0946('0x6f')][_0x0946('0x70')](),_0x0946('0x71'))[_0x0946('0x6d')](_0x310ee7['params']['id'][_0x0946('0x70')](),_0x0946('0x58'))[_0x0946('0x6d')](_0x0946('0x6e'),'createdAt')[_0x0946('0x6d')](_0x0946('0x6e'),_0x0946('0x52'))[_0x0946('0x72')]('cm_contacts')[_0x0946('0x3d')](_0x0946('0x7d'))[_0x0946('0x3d')](_0x0946('0x7e'),_0x174922[_0x0946('0x6f')][_0x0946('0x70')]())[_0x0946('0x3d')]('phone\x20IS\x20NOT\x20NULL'))['toString']();_0x2aaa4f[_0x0946('0x7f')](db[_0x0946('0x80')][_0x0946('0x31')](_0x7a9d5f));}return BPromise[_0x0946('0x81')](_0x2aaa4f);}})[_0x0946('0x23')](function(){return _0x435f22;})[_0x0946('0x23')](respondWithResult(_0x56bb84,null))[_0x0946('0x4d')](handleError(_0x56bb84,null));};exports[_0x0946('0x86')]=function(_0x5cdbd9,_0x2b7c59,_0x3b1a1a){return db['Campaign'][_0x0946('0x46')]({'where':{'id':_0x5cdbd9[_0x0946('0x50')]['id']}})[_0x0946('0x23')](handleEntityNotFound(_0x2b7c59,null))[_0x0946('0x23')](function(_0x6b8463){if(_0x6b8463){return _0x6b8463[_0x0946('0x86')](_0x5cdbd9[_0x0946('0x31')]['ids']);}})['then'](function(_0x484e33){if(_0x484e33){return db[_0x0946('0x60')][_0x0946('0x26')]({'where':{'ListId':_0x5cdbd9[_0x0946('0x31')][_0x0946('0x64')],'CampaignId':_0x5cdbd9['params']['id']}})['then'](function(){return _0x484e33;});}})[_0x0946('0x23')](respondWithStatusCode(_0x2b7c59,null))[_0x0946('0x4d')](handleError(_0x2b7c59,null));}; \ No newline at end of file +var _0x5f43=['update','then','destroy','get','IvrCampaigns','error','stack','name','send','map','rawAttributes','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','where','filters','pick','filter','merge','VIRTUAL','options','count','includeAll','include','Campaign','findAll','rows','catch','params','keys','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','updatedAt','body','omit','createdAt','getHoppers','findOne','CmHopper','sort','getHopperHistories','CmHopperHistory','CampaignId','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','ids','spread','dialCheckDuplicateType','always','into','cm_hopper','scheduledAt','ListId','select','field','phone','NOW()','CmListId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','onlyIfOpen','insert','fromQuery','ContactId','ListId\x20=\x20?','COALESCE(phone,\x27\x27)','push','sequelize','all','removeLists','addBlackLists','cm_hopper_black','removeBlackLists','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','end','status','json','offset','set','Content-Range','apply','save'];(function(_0x20ace5,_0xf957fa){var _0x6b0890=function(_0xe60e2f){while(--_0xe60e2f){_0x20ace5['push'](_0x20ace5['shift']());}};_0x6b0890(++_0xf957fa);}(_0x5f43,0x1f4));var _0x35f4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5f43[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x35f4('0x0'));var emlformat=require(_0x35f4('0x1'));var rimraf=require(_0x35f4('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x35f4('0x3'));var rp=require(_0x35f4('0x4'));var moment=require(_0x35f4('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x35f4('0x6'));var util=require(_0x35f4('0x7'));var path=require(_0x35f4('0x8'));var sox=require('sox');var csv=require(_0x35f4('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x35f4('0xa'));var squel=require(_0x35f4('0xb'));var crypto=require(_0x35f4('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x35f4('0xd'));var toCsv=require(_0x35f4('0x9'));var querystring=require(_0x35f4('0xe'));var Papa=require(_0x35f4('0xf'));var Redis=require(_0x35f4('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x35f4('0x11'));var as=require(_0x35f4('0x12'));var hardwareService=require(_0x35f4('0x13'));var logger=require(_0x35f4('0x14'))(_0x35f4('0x15'));var utils=require(_0x35f4('0x16'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xad58c8,_0x254f0b){_0x254f0b=_0x254f0b||0xcc;return function(_0x5cf3b7){if(_0x5cf3b7){return _0xad58c8[_0x35f4('0x17')](_0x254f0b);}return _0xad58c8['status'](_0x254f0b)[_0x35f4('0x18')]();};}function respondWithResult(_0x54c1da,_0x5ba910){_0x5ba910=_0x5ba910||0xc8;return function(_0x205dcd){if(_0x205dcd){return _0x54c1da[_0x35f4('0x19')](_0x5ba910)[_0x35f4('0x1a')](_0x205dcd);}};}function respondWithFilteredResult(_0x142755,_0x43fe38){return function(_0x4a4496){if(_0x4a4496){var _0x25b244=_0x4a4496['count'],_0x2de8ce=_0x43fe38[_0x35f4('0x1b')],_0x27a103=_0x43fe38[_0x35f4('0x1b')]+_0x43fe38['limit'],_0x35e472;if(_0x27a103>=_0x25b244){_0x27a103=_0x25b244;_0x35e472=0xc8;}else{_0x35e472=0xce;}_0x142755[_0x35f4('0x19')](_0x35e472);return _0x142755[_0x35f4('0x1c')](_0x35f4('0x1d'),_0x2de8ce+'-'+_0x27a103+'/'+_0x25b244)[_0x35f4('0x1a')](_0x4a4496);}return null;};}function patchUpdates(_0x2a1604){return function(_0x6e837c){try{jsonpatch[_0x35f4('0x1e')](_0x6e837c,_0x2a1604,!![]);}catch(_0xdcd5b8){return BPromise['reject'](_0xdcd5b8);}return _0x6e837c[_0x35f4('0x1f')]();};}function saveUpdates(_0x1f4443,_0x5c71c3){return function(_0x20618e){if(_0x20618e){return _0x20618e[_0x35f4('0x20')](_0x1f4443)[_0x35f4('0x21')](function(_0x367e68){return _0x367e68;});}return null;};}function removeEntity(_0x412013,_0x3b4cff){return function(_0x228bb3){if(_0x228bb3){return _0x228bb3[_0x35f4('0x22')]()['then'](function(){var _0x2d0dc8=_0x228bb3[_0x35f4('0x23')]({'plain':!![]});var _0x4f0d5e=_0x35f4('0x24');return db['UserProfileResource'][_0x35f4('0x22')]({'where':{'type':_0x4f0d5e,'resourceId':_0x2d0dc8['id']}})[_0x35f4('0x21')](function(){return _0x228bb3;});})[_0x35f4('0x21')](function(){_0x412013[_0x35f4('0x19')](0xcc)[_0x35f4('0x18')]();});}};}function handleEntityNotFound(_0x39e10a,_0x4dbac6){return function(_0x31e6f){if(!_0x31e6f){_0x39e10a[_0x35f4('0x17')](0x194);}return _0x31e6f;};}function handleError(_0x5b0251,_0x46e0ce){_0x46e0ce=_0x46e0ce||0x1f4;return function(_0x437a00){logger[_0x35f4('0x25')](_0x437a00[_0x35f4('0x26')]);if(_0x437a00[_0x35f4('0x27')]){delete _0x437a00[_0x35f4('0x27')];}_0x5b0251[_0x35f4('0x19')](_0x46e0ce)[_0x35f4('0x28')](_0x437a00);};}exports['index']=function(_0x131cf6,_0x2a27bd){var _0x497643={},_0x1bda8f={},_0x12dd6c={'count':0x0,'rows':[]};var _0x59460c=_[_0x35f4('0x29')](db['Campaign'][_0x35f4('0x2a')],function(_0xb92850){return{'name':_0xb92850['fieldName'],'type':_0xb92850['type'][_0x35f4('0x2b')]};});_0x1bda8f[_0x35f4('0x2c')]=_[_0x35f4('0x29')](_0x59460c,_0x35f4('0x27'));_0x1bda8f[_0x35f4('0x2d')]=_['keys'](_0x131cf6['query']);_0x1bda8f['filters']=_[_0x35f4('0x2e')](_0x1bda8f['model'],_0x1bda8f[_0x35f4('0x2d')]);_0x497643[_0x35f4('0x2f')]=_[_0x35f4('0x2e')](_0x1bda8f['model'],qs['fields'](_0x131cf6[_0x35f4('0x2d')][_0x35f4('0x30')]));_0x497643[_0x35f4('0x2f')]=_0x497643[_0x35f4('0x2f')][_0x35f4('0x31')]?_0x497643[_0x35f4('0x2f')]:_0x1bda8f[_0x35f4('0x2c')];if(!_0x131cf6[_0x35f4('0x2d')][_0x35f4('0x32')](_0x35f4('0x33'))){_0x497643[_0x35f4('0x34')]=qs[_0x35f4('0x34')](_0x131cf6['query'][_0x35f4('0x34')]);_0x497643[_0x35f4('0x1b')]=qs['offset'](_0x131cf6['query']['offset']);}_0x497643[_0x35f4('0x35')]=qs['sort'](_0x131cf6[_0x35f4('0x2d')]['sort']);_0x497643[_0x35f4('0x36')]=qs[_0x35f4('0x37')](_[_0x35f4('0x38')](_0x131cf6[_0x35f4('0x2d')],_0x1bda8f['filters']),_0x59460c);if(_0x131cf6[_0x35f4('0x2d')][_0x35f4('0x39')]){_0x497643['where']=_[_0x35f4('0x3a')](_0x497643[_0x35f4('0x36')],{'$or':_[_0x35f4('0x29')](_0x59460c,function(_0x290723){if(_0x290723['type']!==_0x35f4('0x3b')){var _0x2b4c0b={};_0x2b4c0b[_0x290723[_0x35f4('0x27')]]={'$like':'%'+_0x131cf6[_0x35f4('0x2d')][_0x35f4('0x39')]+'%'};return _0x2b4c0b;}})});}_0x497643=_[_0x35f4('0x3a')]({},_0x497643,_0x131cf6[_0x35f4('0x3c')]);var _0x4b5d7d={'where':_0x497643[_0x35f4('0x36')]};return db['Campaign'][_0x35f4('0x3d')](_0x4b5d7d)[_0x35f4('0x21')](function(_0x14291a){_0x12dd6c[_0x35f4('0x3d')]=_0x14291a;if(_0x131cf6[_0x35f4('0x2d')][_0x35f4('0x3e')]){_0x497643[_0x35f4('0x3f')]=[{'all':!![]}];}return db[_0x35f4('0x40')][_0x35f4('0x41')](_0x497643);})['then'](function(_0x2242f3){_0x12dd6c[_0x35f4('0x42')]=_0x2242f3;return _0x12dd6c;})['then'](respondWithFilteredResult(_0x2a27bd,_0x497643))[_0x35f4('0x43')](handleError(_0x2a27bd,null));};exports['show']=function(_0x14231f,_0x39ffb6){var _0x3da6cc={'raw':![],'where':{'id':_0x14231f[_0x35f4('0x44')]['id']}},_0xb3a5c9={};_0xb3a5c9['model']=_['keys'](db[_0x35f4('0x40')]['rawAttributes']);_0xb3a5c9[_0x35f4('0x2d')]=_[_0x35f4('0x45')](_0x14231f[_0x35f4('0x2d')]);_0xb3a5c9['filters']=_[_0x35f4('0x2e')](_0xb3a5c9[_0x35f4('0x2c')],_0xb3a5c9['query']);_0x3da6cc['attributes']=_['intersection'](_0xb3a5c9[_0x35f4('0x2c')],qs[_0x35f4('0x30')](_0x14231f[_0x35f4('0x2d')][_0x35f4('0x30')]));_0x3da6cc['attributes']=_0x3da6cc[_0x35f4('0x2f')][_0x35f4('0x31')]?_0x3da6cc['attributes']:_0xb3a5c9[_0x35f4('0x2c')];if(_0x14231f[_0x35f4('0x2d')][_0x35f4('0x3e')]){_0x3da6cc['include']=[{'all':!![]}];}_0x3da6cc=_[_0x35f4('0x3a')]({},_0x3da6cc,_0x14231f['options']);return db['Campaign'][_0x35f4('0x46')](_0x3da6cc)[_0x35f4('0x21')](handleEntityNotFound(_0x39ffb6,null))[_0x35f4('0x21')](respondWithResult(_0x39ffb6,null))[_0x35f4('0x43')](handleError(_0x39ffb6,null));};exports[_0x35f4('0x47')]=function(_0x559df3,_0x5be34a){return db['Campaign'][_0x35f4('0x47')](_0x559df3['body'],{})['then'](function(_0x13be0e){var _0x58c30e=_0x559df3[_0x35f4('0x48')][_0x35f4('0x23')]({'plain':!![]});if(!_0x58c30e)throw new Error(_0x35f4('0x49'));if(_0x58c30e[_0x35f4('0x4a')]===_0x35f4('0x48')){var _0x52d539=_0x13be0e[_0x35f4('0x23')]({'plain':!![]});var _0x4ce7e1=_0x35f4('0x24');return db[_0x35f4('0x4b')][_0x35f4('0x46')]({'where':{'name':_0x4ce7e1,'userProfileId':_0x58c30e[_0x35f4('0x4c')]},'raw':!![]})[_0x35f4('0x21')](function(_0x1be268){if(_0x1be268&&_0x1be268[_0x35f4('0x4d')]===0x0){return db[_0x35f4('0x4e')][_0x35f4('0x47')]({'name':_0x52d539[_0x35f4('0x27')],'resourceId':_0x52d539['id'],'type':_0x1be268['name'],'sectionId':_0x1be268['id']},{})[_0x35f4('0x21')](function(){return _0x13be0e;});}else{return _0x13be0e;}})[_0x35f4('0x43')](function(_0x35ff39){logger[_0x35f4('0x25')](_0x35f4('0x4f'),_0x35ff39);throw _0x35ff39;});}return _0x13be0e;})[_0x35f4('0x21')](respondWithResult(_0x5be34a,0xc9))['catch'](handleError(_0x5be34a,null));};exports['clone']=function(_0xc74ea9,_0x576026){var _0x49f7be={'where':{'id':_0xc74ea9[_0x35f4('0x44')]['id']}},_0x5941f1={};_0x5941f1[_0x35f4('0x2c')]=_[_0x35f4('0x45')](db[_0x35f4('0x40')]['rawAttributes']);_0x49f7be['attributes']=_[_0x35f4('0x2e')](_0x5941f1[_0x35f4('0x2c')],qs[_0x35f4('0x30')](_0xc74ea9[_0x35f4('0x2d')][_0x35f4('0x30')]));_0x49f7be[_0x35f4('0x2f')]=_0x49f7be['attributes'][_0x35f4('0x31')]?_0x49f7be[_0x35f4('0x2f')]:_0x5941f1[_0x35f4('0x2c')];if(_0xc74ea9[_0x35f4('0x2d')]['includeAll']){_0x49f7be['include']=[{'all':!![]}];}_0x49f7be=_['merge']({},_0x49f7be,_0xc74ea9[_0x35f4('0x3c')]);return db['Campaign'][_0x35f4('0x46')](_0x49f7be)[_0x35f4('0x21')](handleEntityNotFound(_0x576026,null))[_0x35f4('0x21')](function(_0x181f22){if(_0x181f22){var _0x57a693=_0x181f22[_0x35f4('0x23')]({'plain':!![]});_0x57a693=qs['omit'](_0x57a693,['id','createdAt',_0x35f4('0x50')]);_0xc74ea9[_0x35f4('0x51')]=_[_0x35f4('0x52')](_0xc74ea9[_0x35f4('0x51')],['id',_0x35f4('0x53'),_0x35f4('0x50')]);return db[_0x35f4('0x40')][_0x35f4('0x47')](_[_0x35f4('0x3a')](_0x57a693,_0xc74ea9[_0x35f4('0x51')]),{'include':_0xc74ea9['query'][_0x35f4('0x3e')]?[{'all':!![]}]:undefined})['then'](function(_0x591975){var _0x469647=_0xc74ea9[_0x35f4('0x48')][_0x35f4('0x23')]({'plain':!![]});if(!_0x469647)throw new Error(_0x35f4('0x49'));if(_0x469647[_0x35f4('0x4a')]==='user'){var _0x5ce43b=_0x591975[_0x35f4('0x23')]({'plain':!![]});var _0x4217c8=_0x35f4('0x24');return db[_0x35f4('0x4b')]['find']({'where':{'name':_0x4217c8,'userProfileId':_0x469647[_0x35f4('0x4c')]},'raw':!![]})[_0x35f4('0x21')](function(_0x5a23d5){if(_0x5a23d5&&_0x5a23d5[_0x35f4('0x4d')]===0x0){return db[_0x35f4('0x4e')]['create']({'name':_0x5ce43b[_0x35f4('0x27')],'resourceId':_0x5ce43b['id'],'type':_0x5a23d5[_0x35f4('0x27')],'sectionId':_0x5a23d5['id']},{})[_0x35f4('0x21')](function(){return _0x591975;});}else{return _0x591975;}})['catch'](function(_0x4245b0){logger[_0x35f4('0x25')](_0x35f4('0x4f'),_0x4245b0);throw _0x4245b0;});}return _0x591975;});}})[_0x35f4('0x21')](respondWithResult(_0x576026,0xc9))['catch'](handleError(_0x576026,null));};exports[_0x35f4('0x20')]=function(_0x5b91f1,_0x3c1599){if(_0x5b91f1[_0x35f4('0x51')]['id']){delete _0x5b91f1[_0x35f4('0x51')]['id'];}return db[_0x35f4('0x40')][_0x35f4('0x46')]({'where':{'id':_0x5b91f1['params']['id']}})[_0x35f4('0x21')](handleEntityNotFound(_0x3c1599,null))['then'](saveUpdates(_0x5b91f1['body'],null))[_0x35f4('0x21')](respondWithResult(_0x3c1599,null))[_0x35f4('0x43')](handleError(_0x3c1599,null));};exports[_0x35f4('0x22')]=function(_0x285a8e,_0x4b095e){return db[_0x35f4('0x40')][_0x35f4('0x46')]({'where':{'id':_0x285a8e[_0x35f4('0x44')]['id']}})[_0x35f4('0x21')](handleEntityNotFound(_0x4b095e,null))[_0x35f4('0x21')](removeEntity(_0x4b095e,null))[_0x35f4('0x43')](handleError(_0x4b095e,null));};exports[_0x35f4('0x54')]=function(_0x1db0e0,_0xe23936,_0x3a29e5){var _0x11360e={'raw':!![],'where':{}};var _0x1ead9c={};var _0x4c3346={'count':0x0,'rows':[]};return db[_0x35f4('0x40')][_0x35f4('0x55')]({'where':{'id':_0x1db0e0[_0x35f4('0x44')]['id']}})['then'](handleEntityNotFound(_0xe23936,null))[_0x35f4('0x21')](function(_0x337592){if(_0x337592){_0x1ead9c['model']=_[_0x35f4('0x45')](db[_0x35f4('0x56')][_0x35f4('0x2a')]);_0x1ead9c[_0x35f4('0x2d')]=_[_0x35f4('0x45')](_0x1db0e0[_0x35f4('0x2d')]);_0x1ead9c['filters']=_['intersection'](_0x1ead9c[_0x35f4('0x2c')],_0x1ead9c[_0x35f4('0x2d')]);_0x11360e[_0x35f4('0x2f')]=_[_0x35f4('0x2e')](_0x1ead9c['model'],qs[_0x35f4('0x30')](_0x1db0e0[_0x35f4('0x2d')][_0x35f4('0x30')]));_0x11360e[_0x35f4('0x2f')]=_0x11360e['attributes']['length']?_0x11360e[_0x35f4('0x2f')]:_0x1ead9c[_0x35f4('0x2c')];if(!_0x1db0e0[_0x35f4('0x2d')]['hasOwnProperty'](_0x35f4('0x33'))){_0x11360e[_0x35f4('0x34')]=qs[_0x35f4('0x34')](_0x1db0e0[_0x35f4('0x2d')][_0x35f4('0x34')]);_0x11360e[_0x35f4('0x1b')]=qs['offset'](_0x1db0e0['query'][_0x35f4('0x1b')]);}_0x11360e[_0x35f4('0x35')]=qs[_0x35f4('0x57')](_0x1db0e0[_0x35f4('0x2d')][_0x35f4('0x57')]);_0x11360e[_0x35f4('0x36')]=qs[_0x35f4('0x37')](_[_0x35f4('0x38')](_0x1db0e0[_0x35f4('0x2d')],_0x1ead9c[_0x35f4('0x37')]));_0x11360e[_0x35f4('0x36')]['CampaignId']=_0x337592['id'];if(_0x1db0e0['query'][_0x35f4('0x39')]){_0x11360e[_0x35f4('0x36')]=_[_0x35f4('0x3a')](_0x11360e[_0x35f4('0x36')],{'$or':_[_0x35f4('0x29')](_0x11360e['attributes'],function(_0x201523){var _0x46521e={};_0x46521e[_0x201523]={'$like':'%'+_0x1db0e0[_0x35f4('0x2d')][_0x35f4('0x39')]+'%'};return _0x46521e;})});}_0x11360e=_[_0x35f4('0x3a')]({},_0x11360e,_0x1db0e0[_0x35f4('0x3c')]);return db[_0x35f4('0x56')][_0x35f4('0x3d')]({'where':_0x11360e[_0x35f4('0x36')]})[_0x35f4('0x21')](function(_0x41f799){_0x4c3346[_0x35f4('0x3d')]=_0x41f799;if(_0x1db0e0[_0x35f4('0x2d')]['includeAll']){_0x11360e[_0x35f4('0x3f')]=[{'all':!![]}];}return db[_0x35f4('0x56')][_0x35f4('0x41')](_0x11360e);})[_0x35f4('0x21')](function(_0x27cfee){_0x4c3346[_0x35f4('0x42')]=_0x27cfee;return _0x4c3346;});}})[_0x35f4('0x21')](respondWithFilteredResult(_0xe23936,_0x11360e))['catch'](handleError(_0xe23936,null));};exports[_0x35f4('0x58')]=function(_0x192a4c,_0x1151fb,_0x443532){var _0x8ba10b={'raw':!![],'where':{}};var _0x5c8f3f={};var _0x30be78={'count':0x0,'rows':[]};return db[_0x35f4('0x40')][_0x35f4('0x55')]({'where':{'id':_0x192a4c[_0x35f4('0x44')]['id']}})[_0x35f4('0x21')](handleEntityNotFound(_0x1151fb,null))[_0x35f4('0x21')](function(_0xe07dca){if(_0xe07dca){_0x5c8f3f['model']=_[_0x35f4('0x45')](db[_0x35f4('0x59')][_0x35f4('0x2a')]);_0x5c8f3f[_0x35f4('0x2d')]=_[_0x35f4('0x45')](_0x192a4c[_0x35f4('0x2d')]);_0x5c8f3f['filters']=_[_0x35f4('0x2e')](_0x5c8f3f[_0x35f4('0x2c')],_0x5c8f3f[_0x35f4('0x2d')]);_0x8ba10b[_0x35f4('0x2f')]=_[_0x35f4('0x2e')](_0x5c8f3f[_0x35f4('0x2c')],qs[_0x35f4('0x30')](_0x192a4c['query'][_0x35f4('0x30')]));_0x8ba10b[_0x35f4('0x2f')]=_0x8ba10b[_0x35f4('0x2f')][_0x35f4('0x31')]?_0x8ba10b[_0x35f4('0x2f')]:_0x5c8f3f[_0x35f4('0x2c')];if(!_0x192a4c[_0x35f4('0x2d')]['hasOwnProperty'](_0x35f4('0x33'))){_0x8ba10b['limit']=qs[_0x35f4('0x34')](_0x192a4c[_0x35f4('0x2d')][_0x35f4('0x34')]);_0x8ba10b[_0x35f4('0x1b')]=qs[_0x35f4('0x1b')](_0x192a4c[_0x35f4('0x2d')][_0x35f4('0x1b')]);}_0x8ba10b[_0x35f4('0x35')]=qs['sort'](_0x192a4c[_0x35f4('0x2d')]['sort']);_0x8ba10b[_0x35f4('0x36')]=qs[_0x35f4('0x37')](_[_0x35f4('0x38')](_0x192a4c[_0x35f4('0x2d')],_0x5c8f3f['filters']));_0x8ba10b[_0x35f4('0x36')][_0x35f4('0x5a')]=_0xe07dca['id'];if(_0x192a4c[_0x35f4('0x2d')][_0x35f4('0x39')]){_0x8ba10b[_0x35f4('0x36')]=_[_0x35f4('0x3a')](_0x8ba10b['where'],{'$or':_['map'](_0x8ba10b['attributes'],function(_0x1a1b94){var _0x90bf07={};_0x90bf07[_0x1a1b94]={'$like':'%'+_0x192a4c[_0x35f4('0x2d')]['filter']+'%'};return _0x90bf07;})});}_0x8ba10b=_[_0x35f4('0x3a')]({},_0x8ba10b,_0x192a4c[_0x35f4('0x3c')]);return db[_0x35f4('0x59')][_0x35f4('0x3d')]({'where':_0x8ba10b[_0x35f4('0x36')]})[_0x35f4('0x21')](function(_0x4cb766){_0x30be78[_0x35f4('0x3d')]=_0x4cb766;if(_0x192a4c['query']['includeAll']){_0x8ba10b[_0x35f4('0x3f')]=[{'all':!![]}];}return db[_0x35f4('0x59')][_0x35f4('0x41')](_0x8ba10b);})[_0x35f4('0x21')](function(_0xdc427e){_0x30be78[_0x35f4('0x42')]=_0xdc427e;return _0x30be78;});}})[_0x35f4('0x21')](respondWithFilteredResult(_0x1151fb,_0x8ba10b))[_0x35f4('0x43')](handleError(_0x1151fb,null));};exports[_0x35f4('0x5b')]=function(_0x4ebba8,_0x5d5d04,_0xdf4f30){var _0x2bbdc9={'raw':!![],'where':{}};var _0x38e767={};var _0x156853={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0x4ebba8[_0x35f4('0x44')]['id']}})[_0x35f4('0x21')](handleEntityNotFound(_0x5d5d04,null))[_0x35f4('0x21')](function(_0x2323d6){if(_0x2323d6){_0x38e767['model']=_[_0x35f4('0x45')](db[_0x35f4('0x5c')]['rawAttributes']);_0x38e767[_0x35f4('0x2d')]=_[_0x35f4('0x45')](_0x4ebba8[_0x35f4('0x2d')]);_0x38e767[_0x35f4('0x37')]=_['intersection'](_0x38e767[_0x35f4('0x2c')],_0x38e767[_0x35f4('0x2d')]);_0x2bbdc9['attributes']=_[_0x35f4('0x2e')](_0x38e767['model'],qs[_0x35f4('0x30')](_0x4ebba8[_0x35f4('0x2d')][_0x35f4('0x30')]));_0x2bbdc9[_0x35f4('0x2f')]=_0x2bbdc9[_0x35f4('0x2f')][_0x35f4('0x31')]?_0x2bbdc9['attributes']:_0x38e767[_0x35f4('0x2c')];if(!_0x4ebba8[_0x35f4('0x2d')][_0x35f4('0x32')](_0x35f4('0x33'))){_0x2bbdc9[_0x35f4('0x34')]=qs[_0x35f4('0x34')](_0x4ebba8['query']['limit']);_0x2bbdc9[_0x35f4('0x1b')]=qs[_0x35f4('0x1b')](_0x4ebba8['query'][_0x35f4('0x1b')]);}_0x2bbdc9[_0x35f4('0x35')]=qs['sort'](_0x4ebba8['query'][_0x35f4('0x57')]);_0x2bbdc9[_0x35f4('0x36')]=qs[_0x35f4('0x37')](_[_0x35f4('0x38')](_0x4ebba8['query'],_0x38e767['filters']));_0x2bbdc9[_0x35f4('0x36')][_0x35f4('0x5a')]=_0x2323d6['id'];if(_0x4ebba8[_0x35f4('0x2d')][_0x35f4('0x39')]){_0x2bbdc9[_0x35f4('0x36')]=_[_0x35f4('0x3a')](_0x2bbdc9[_0x35f4('0x36')],{'$or':_['map'](_0x2bbdc9[_0x35f4('0x2f')],function(_0x1cb7ab){var _0x1acd91={};_0x1acd91[_0x1cb7ab]={'$like':'%'+_0x4ebba8[_0x35f4('0x2d')][_0x35f4('0x39')]+'%'};return _0x1acd91;})});}_0x2bbdc9=_[_0x35f4('0x3a')]({},_0x2bbdc9,_0x4ebba8['options']);return db[_0x35f4('0x5c')][_0x35f4('0x3d')]({'where':_0x2bbdc9['where']})[_0x35f4('0x21')](function(_0x186d12){_0x156853[_0x35f4('0x3d')]=_0x186d12;if(_0x4ebba8[_0x35f4('0x2d')]['includeAll']){_0x2bbdc9[_0x35f4('0x3f')]=[{'all':!![]}];}return db[_0x35f4('0x5c')][_0x35f4('0x41')](_0x2bbdc9);})[_0x35f4('0x21')](function(_0x183f90){_0x156853[_0x35f4('0x42')]=_0x183f90;return _0x156853;});}})['then'](respondWithFilteredResult(_0x5d5d04,_0x2bbdc9))[_0x35f4('0x43')](handleError(_0x5d5d04,null));};exports[_0x35f4('0x5d')]=function(_0x5ae9bb,_0x1d3adb,_0x42254c){var _0x54533e={'raw':!![],'where':{}};var _0x540907={};var _0x1248b2={'count':0x0,'rows':[]};return db[_0x35f4('0x40')][_0x35f4('0x55')]({'where':{'id':_0x5ae9bb[_0x35f4('0x44')]['id']}})[_0x35f4('0x21')](handleEntityNotFound(_0x1d3adb,null))['then'](function(_0x3c1581){if(_0x3c1581){_0x540907[_0x35f4('0x2c')]=_[_0x35f4('0x45')](db[_0x35f4('0x5e')][_0x35f4('0x2a')]);_0x540907[_0x35f4('0x2d')]=_['keys'](_0x5ae9bb['query']);_0x540907[_0x35f4('0x37')]=_[_0x35f4('0x2e')](_0x540907[_0x35f4('0x2c')],_0x540907[_0x35f4('0x2d')]);_0x54533e['attributes']=_[_0x35f4('0x2e')](_0x540907['model'],qs['fields'](_0x5ae9bb['query']['fields']));_0x54533e['attributes']=_0x54533e['attributes'][_0x35f4('0x31')]?_0x54533e[_0x35f4('0x2f')]:_0x540907[_0x35f4('0x2c')];if(!_0x5ae9bb[_0x35f4('0x2d')][_0x35f4('0x32')](_0x35f4('0x33'))){_0x54533e[_0x35f4('0x34')]=qs[_0x35f4('0x34')](_0x5ae9bb[_0x35f4('0x2d')]['limit']);_0x54533e[_0x35f4('0x1b')]=qs['offset'](_0x5ae9bb[_0x35f4('0x2d')][_0x35f4('0x1b')]);}_0x54533e[_0x35f4('0x35')]=qs[_0x35f4('0x57')](_0x5ae9bb[_0x35f4('0x2d')][_0x35f4('0x57')]);_0x54533e[_0x35f4('0x36')]=qs['filters'](_[_0x35f4('0x38')](_0x5ae9bb[_0x35f4('0x2d')],_0x540907[_0x35f4('0x37')]));_0x54533e[_0x35f4('0x36')][_0x35f4('0x5a')]=_0x3c1581['id'];if(_0x5ae9bb[_0x35f4('0x2d')][_0x35f4('0x39')]){_0x54533e[_0x35f4('0x36')]=_['merge'](_0x54533e[_0x35f4('0x36')],{'$or':_['map'](_0x54533e[_0x35f4('0x2f')],function(_0x3a0d68){var _0x25db8c={};_0x25db8c[_0x3a0d68]={'$like':'%'+_0x5ae9bb[_0x35f4('0x2d')][_0x35f4('0x39')]+'%'};return _0x25db8c;})});}_0x54533e=_[_0x35f4('0x3a')]({},_0x54533e,_0x5ae9bb[_0x35f4('0x3c')]);return db[_0x35f4('0x5e')][_0x35f4('0x3d')]({'where':_0x54533e[_0x35f4('0x36')]})[_0x35f4('0x21')](function(_0x353c2f){_0x1248b2[_0x35f4('0x3d')]=_0x353c2f;if(_0x5ae9bb['query']['includeAll']){_0x54533e[_0x35f4('0x3f')]=[{'all':!![]}];}return db[_0x35f4('0x5e')][_0x35f4('0x41')](_0x54533e);})[_0x35f4('0x21')](function(_0x241689){_0x1248b2['rows']=_0x241689;return _0x1248b2;});}})[_0x35f4('0x21')](respondWithFilteredResult(_0x1d3adb,_0x54533e))[_0x35f4('0x43')](handleError(_0x1d3adb,null));};exports[_0x35f4('0x5f')]=function(_0x29619e,_0x1e0bbe,_0x3a7c10){var _0x5169ea={};var _0x19adee={};var _0x130deb;var _0x29ff63;return db[_0x35f4('0x40')]['findOne']({'where':{'id':_0x29619e[_0x35f4('0x44')]['id']}})[_0x35f4('0x21')](handleEntityNotFound(_0x1e0bbe,null))[_0x35f4('0x21')](function(_0x5b2d4f){if(_0x5b2d4f){_0x130deb=_0x5b2d4f;_0x19adee[_0x35f4('0x2c')]=_['keys'](db[_0x35f4('0x60')][_0x35f4('0x2a')]);_0x19adee[_0x35f4('0x2d')]=_['keys'](_0x29619e[_0x35f4('0x2d')]);_0x19adee['filters']=_['intersection'](_0x19adee[_0x35f4('0x2c')],_0x19adee[_0x35f4('0x2d')]);_0x5169ea[_0x35f4('0x2f')]=_[_0x35f4('0x2e')](_0x19adee[_0x35f4('0x2c')],qs[_0x35f4('0x30')](_0x29619e['query']['fields']));_0x5169ea['attributes']=_0x5169ea[_0x35f4('0x2f')][_0x35f4('0x31')]?_0x5169ea['attributes']:_0x19adee[_0x35f4('0x2c')];_0x5169ea[_0x35f4('0x35')]=qs[_0x35f4('0x57')](_0x29619e[_0x35f4('0x2d')][_0x35f4('0x57')]);_0x5169ea[_0x35f4('0x36')]=qs[_0x35f4('0x37')](_[_0x35f4('0x38')](_0x29619e[_0x35f4('0x2d')],_0x19adee[_0x35f4('0x37')]));if(_0x29619e['query'][_0x35f4('0x39')]){_0x5169ea[_0x35f4('0x36')]=_[_0x35f4('0x3a')](_0x5169ea[_0x35f4('0x36')],{'$or':_[_0x35f4('0x29')](_0x5169ea[_0x35f4('0x2f')],function(_0x13248f){var _0x22a595={};_0x22a595[_0x13248f]={'$like':'%'+_0x29619e[_0x35f4('0x2d')][_0x35f4('0x39')]+'%'};return _0x22a595;})});}_0x5169ea=_['merge']({},_0x5169ea,_0x29619e[_0x35f4('0x3c')]);return _0x130deb['getLists'](_0x5169ea);}})[_0x35f4('0x21')](function(_0x2abbde){if(_0x2abbde){_0x29ff63=_0x2abbde['length'];if(!_0x29619e['query'][_0x35f4('0x32')](_0x35f4('0x33'))){_0x5169ea[_0x35f4('0x34')]=qs[_0x35f4('0x34')](_0x29619e[_0x35f4('0x2d')][_0x35f4('0x34')]);_0x5169ea[_0x35f4('0x1b')]=qs[_0x35f4('0x1b')](_0x29619e[_0x35f4('0x2d')][_0x35f4('0x1b')]);}return _0x130deb[_0x35f4('0x5f')](_0x5169ea);}})[_0x35f4('0x21')](function(_0x4e2367){if(_0x4e2367){return _0x4e2367?{'count':_0x29ff63,'rows':_0x4e2367}:null;}})[_0x35f4('0x21')](respondWithResult(_0x1e0bbe,null))['catch'](handleError(_0x1e0bbe,null));};exports[_0x35f4('0x61')]=function(_0x370cca,_0xfc4e41,_0x57a7ea){var _0x2aee5e,_0x5f1262;return db['Campaign'][_0x35f4('0x46')]({'where':{'id':_0x370cca['params']['id']}})[_0x35f4('0x21')](handleEntityNotFound(_0xfc4e41,null))[_0x35f4('0x21')](function(_0x5d3a8a){if(_0x5d3a8a){_0x5f1262=_0x5d3a8a;return _0x5d3a8a[_0x35f4('0x61')](_0x370cca['body']['ids'],_['omit'](_0x370cca[_0x35f4('0x51')],[_0x35f4('0x62'),'id'])||{});}return null;})[_0x35f4('0x63')](function(_0x5655ae){var _0xb2d413;_0x2aee5e=_0x5655ae||[];var _0x4ec895=[];if(_0x5655ae){for(var _0xd68134=0x0;_0xd68134<_0x5655ae[_0x35f4('0x31')];_0xd68134+=0x1){var _0x1b8c5d=_0x5655ae[_0xd68134][_0x35f4('0x23')]({'plain':!![]});_0x5f1262[_0x35f4('0x64')]=_0x370cca[_0x35f4('0x51')][_0x35f4('0x64')]?_0x370cca[_0x35f4('0x51')]['dialCheckDuplicateType']:_0x5f1262[_0x35f4('0x64')];switch(_0x5f1262[_0x35f4('0x64')]){case _0x35f4('0x65'):_0xb2d413=squel['insert']()[_0x35f4('0x66')](_0x35f4('0x67'))['fromQuery'](['phone',_0x35f4('0x68'),'ContactId',_0x35f4('0x69'),_0x35f4('0x5a'),_0x35f4('0x53'),_0x35f4('0x50')],squel[_0x35f4('0x6a')]()[_0x35f4('0x6b')]('phone',_0x35f4('0x6c'))['field'](_0x35f4('0x6d'),_0x35f4('0x68'))[_0x35f4('0x6b')]('id','ContactId')[_0x35f4('0x6b')](_0x1b8c5d[_0x35f4('0x6e')][_0x35f4('0x6f')](),_0x35f4('0x69'))[_0x35f4('0x6b')](_0x370cca[_0x35f4('0x44')]['id']['toString'](),_0x35f4('0x5a'))[_0x35f4('0x6b')](_0x35f4('0x6d'),_0x35f4('0x53'))['field'](_0x35f4('0x6d'),_0x35f4('0x50'))[_0x35f4('0x70')](_0x35f4('0x71'))[_0x35f4('0x36')](_0x35f4('0x72'))[_0x35f4('0x36')]('ListId\x20=\x20?',_0x1b8c5d[_0x35f4('0x6e')][_0x35f4('0x6f')]())['where'](_0x35f4('0x73'))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x35f4('0x6a')]()['field'](_0x35f4('0x74'))[_0x35f4('0x70')](_0x35f4('0x75'))[_0x35f4('0x36')](_0x35f4('0x76'),_0x370cca[_0x35f4('0x44')]['id'][_0x35f4('0x6f')]()))[_0x35f4('0x36')](_0x35f4('0x77'),squel['select']()[_0x35f4('0x6b')]('COALESCE(phone,\x27\x27)')[_0x35f4('0x70')]('cm_hopper')[_0x35f4('0x36')](_0x35f4('0x76'),_0x370cca['params']['id'][_0x35f4('0x6f')]())))[_0x35f4('0x6f')]();break;case _0x35f4('0x78'):_0xb2d413=squel[_0x35f4('0x79')]()[_0x35f4('0x66')]('cm_hopper')[_0x35f4('0x7a')]([_0x35f4('0x6c'),'scheduledAt',_0x35f4('0x7b'),_0x35f4('0x69'),_0x35f4('0x5a'),_0x35f4('0x53'),_0x35f4('0x50')],squel['select']()[_0x35f4('0x6b')](_0x35f4('0x6c'),_0x35f4('0x6c'))['field']('NOW()',_0x35f4('0x68'))[_0x35f4('0x6b')]('id','ContactId')['field'](_0x1b8c5d['CmListId']['toString'](),_0x35f4('0x69'))[_0x35f4('0x6b')](_0x370cca['params']['id'][_0x35f4('0x6f')](),_0x35f4('0x5a'))[_0x35f4('0x6b')](_0x35f4('0x6d'),_0x35f4('0x53'))[_0x35f4('0x6b')](_0x35f4('0x6d'),_0x35f4('0x50'))[_0x35f4('0x70')](_0x35f4('0x71'))[_0x35f4('0x36')](_0x35f4('0x72'))[_0x35f4('0x36')](_0x35f4('0x7c'),_0x1b8c5d[_0x35f4('0x6e')][_0x35f4('0x6f')]())[_0x35f4('0x36')](_0x35f4('0x73'))[_0x35f4('0x36')](_0x35f4('0x77'),squel['select']()[_0x35f4('0x6b')](_0x35f4('0x7d'))[_0x35f4('0x70')](_0x35f4('0x67'))[_0x35f4('0x36')](_0x35f4('0x76'),_0x370cca[_0x35f4('0x44')]['id'][_0x35f4('0x6f')]())))['toString']();break;default:_0xb2d413=squel[_0x35f4('0x79')]()[_0x35f4('0x66')](_0x35f4('0x67'))[_0x35f4('0x7a')]([_0x35f4('0x6c'),_0x35f4('0x68'),_0x35f4('0x7b'),_0x35f4('0x69'),'CampaignId',_0x35f4('0x53'),_0x35f4('0x50')],squel[_0x35f4('0x6a')]()['field'](_0x35f4('0x6c'),_0x35f4('0x6c'))[_0x35f4('0x6b')](_0x35f4('0x6d'),_0x35f4('0x68'))[_0x35f4('0x6b')]('id',_0x35f4('0x7b'))[_0x35f4('0x6b')](_0x1b8c5d[_0x35f4('0x6e')]['toString'](),_0x35f4('0x69'))['field'](_0x370cca[_0x35f4('0x44')]['id'][_0x35f4('0x6f')](),_0x35f4('0x5a'))['field'](_0x35f4('0x6d'),_0x35f4('0x53'))[_0x35f4('0x6b')](_0x35f4('0x6d'),_0x35f4('0x50'))['from'](_0x35f4('0x71'))['where']('deletedAt\x20IS\x20NULL')[_0x35f4('0x36')]('ListId\x20=\x20?',_0x1b8c5d[_0x35f4('0x6e')][_0x35f4('0x6f')]())['where'](_0x35f4('0x73')))[_0x35f4('0x6f')]();}_0x4ec895[_0x35f4('0x7e')](db[_0x35f4('0x7f')][_0x35f4('0x2d')](_0xb2d413));}return BPromise[_0x35f4('0x80')](_0x4ec895);}})[_0x35f4('0x21')](function(){return _0x2aee5e;})['then'](respondWithResult(_0xfc4e41,null))['catch'](handleError(_0xfc4e41,null));};exports[_0x35f4('0x81')]=function(_0x54d304,_0x228831,_0x47de4f){return db[_0x35f4('0x40')]['find']({'where':{'id':_0x54d304[_0x35f4('0x44')]['id']}})[_0x35f4('0x21')](handleEntityNotFound(_0x228831,null))['then'](function(_0x57cd5c){if(_0x57cd5c){return _0x57cd5c[_0x35f4('0x81')](_0x54d304[_0x35f4('0x2d')]['ids']);}})[_0x35f4('0x21')](function(_0x41742d){if(_0x41742d){return db[_0x35f4('0x56')][_0x35f4('0x22')]({'where':{'ListId':_0x54d304['query'][_0x35f4('0x62')],'CampaignId':_0x54d304[_0x35f4('0x44')]['id']}})[_0x35f4('0x21')](function(){return _0x41742d;});}})['then'](respondWithStatusCode(_0x228831,null))[_0x35f4('0x43')](handleError(_0x228831,null));};exports['getBlackLists']=function(_0x5ab543,_0x3f7231,_0x12facd){var _0x224461={'raw':!![],'where':{}};var _0x1ca8a6={};var _0xf74b3f={'count':0x0,'rows':[]};return db[_0x35f4('0x40')]['findOne']({'where':{'id':_0x5ab543[_0x35f4('0x44')]['id']}})['then'](handleEntityNotFound(_0x3f7231,null))[_0x35f4('0x21')](function(_0x6a7448){if(_0x6a7448){_0x1ca8a6[_0x35f4('0x2c')]=_[_0x35f4('0x45')](db['CmList'][_0x35f4('0x2a')]);_0x1ca8a6[_0x35f4('0x2d')]=_[_0x35f4('0x45')](_0x5ab543[_0x35f4('0x2d')]);_0x1ca8a6[_0x35f4('0x37')]=_['intersection'](_0x1ca8a6[_0x35f4('0x2c')],_0x1ca8a6['query']);_0x224461[_0x35f4('0x2f')]=_[_0x35f4('0x2e')](_0x1ca8a6[_0x35f4('0x2c')],qs[_0x35f4('0x30')](_0x5ab543[_0x35f4('0x2d')][_0x35f4('0x30')]));_0x224461[_0x35f4('0x2f')]=_0x224461[_0x35f4('0x2f')][_0x35f4('0x31')]?_0x224461[_0x35f4('0x2f')]:_0x1ca8a6[_0x35f4('0x2c')];if(!_0x5ab543[_0x35f4('0x2d')][_0x35f4('0x32')]('nolimit')){_0x224461[_0x35f4('0x34')]=qs[_0x35f4('0x34')](_0x5ab543[_0x35f4('0x2d')][_0x35f4('0x34')]);_0x224461[_0x35f4('0x1b')]=qs[_0x35f4('0x1b')](_0x5ab543[_0x35f4('0x2d')][_0x35f4('0x1b')]);}_0x224461[_0x35f4('0x35')]=qs[_0x35f4('0x57')](_0x5ab543[_0x35f4('0x2d')][_0x35f4('0x57')]);_0x224461[_0x35f4('0x36')]=qs[_0x35f4('0x37')](_[_0x35f4('0x38')](_0x5ab543[_0x35f4('0x2d')],_0x1ca8a6['filters']));_0x224461['where'][_0x35f4('0x5a')]=_0x6a7448['id'];if(_0x5ab543['query'][_0x35f4('0x39')]){_0x224461['where']=_['merge'](_0x224461[_0x35f4('0x36')],{'$or':_[_0x35f4('0x29')](_0x224461[_0x35f4('0x2f')],function(_0x304706){var _0x3520ca={};_0x3520ca[_0x304706]={'$like':'%'+_0x5ab543[_0x35f4('0x2d')][_0x35f4('0x39')]+'%'};return _0x3520ca;})});}_0x224461=_[_0x35f4('0x3a')]({},_0x224461,_0x5ab543['options']);return db[_0x35f4('0x60')]['count']({'where':_0x224461[_0x35f4('0x36')]})[_0x35f4('0x21')](function(_0x461434){_0xf74b3f[_0x35f4('0x3d')]=_0x461434;if(_0x5ab543[_0x35f4('0x2d')]['includeAll']){_0x224461[_0x35f4('0x3f')]=[{'all':!![]}];}return db[_0x35f4('0x60')][_0x35f4('0x41')](_0x224461);})[_0x35f4('0x21')](function(_0x246330){_0xf74b3f['rows']=_0x246330;return _0xf74b3f;});}})['then'](respondWithFilteredResult(_0x3f7231,_0x224461))[_0x35f4('0x43')](handleError(_0x3f7231,null));};exports[_0x35f4('0x82')]=function(_0x4ac706,_0x5f5bd9,_0x6f647f){var _0x136643,_0x47a297;return db['Campaign'][_0x35f4('0x46')]({'where':{'id':_0x4ac706[_0x35f4('0x44')]['id']}})[_0x35f4('0x21')](handleEntityNotFound(_0x5f5bd9,null))[_0x35f4('0x21')](function(_0x2b3bf0){if(_0x2b3bf0){_0x47a297=_0x2b3bf0;return _0x2b3bf0[_0x35f4('0x82')](_0x4ac706[_0x35f4('0x51')][_0x35f4('0x62')],_[_0x35f4('0x52')](_0x4ac706[_0x35f4('0x51')],['ids','id'])||{});}return null;})[_0x35f4('0x63')](function(_0x4dcea4){var _0x4f228f;_0x136643=_0x4dcea4||[];var _0x2e6dc1=[];if(_0x4dcea4){for(var _0x50c10d=0x0;_0x50c10d<_0x4dcea4[_0x35f4('0x31')];_0x50c10d+=0x1){var _0x4dec80=_0x4dcea4[_0x50c10d][_0x35f4('0x23')]({'plain':!![]});_0x4f228f=squel[_0x35f4('0x79')]()[_0x35f4('0x66')](_0x35f4('0x83'))[_0x35f4('0x7a')]([_0x35f4('0x6c'),_0x35f4('0x7b'),'ListId','CampaignId','createdAt',_0x35f4('0x50')],squel[_0x35f4('0x6a')]()[_0x35f4('0x6b')](_0x35f4('0x6c'),'phone')['field']('id','ContactId')[_0x35f4('0x6b')](_0x4dec80[_0x35f4('0x6e')]['toString'](),_0x35f4('0x69'))[_0x35f4('0x6b')](_0x4ac706[_0x35f4('0x44')]['id']['toString'](),_0x35f4('0x5a'))[_0x35f4('0x6b')](_0x35f4('0x6d'),_0x35f4('0x53'))[_0x35f4('0x6b')](_0x35f4('0x6d'),_0x35f4('0x50'))[_0x35f4('0x70')]('cm_contacts')['where'](_0x35f4('0x72'))[_0x35f4('0x36')](_0x35f4('0x7c'),_0x4dec80[_0x35f4('0x6e')][_0x35f4('0x6f')]())['where']('phone\x20IS\x20NOT\x20NULL'))[_0x35f4('0x6f')]();_0x2e6dc1['push'](db['sequelize'][_0x35f4('0x2d')](_0x4f228f));}return BPromise[_0x35f4('0x80')](_0x2e6dc1);}})['then'](function(){return _0x136643;})['then'](respondWithResult(_0x5f5bd9,null))['catch'](handleError(_0x5f5bd9,null));};exports[_0x35f4('0x84')]=function(_0x2c43e8,_0x3e69ab,_0x33404f){return db[_0x35f4('0x40')][_0x35f4('0x46')]({'where':{'id':_0x2c43e8[_0x35f4('0x44')]['id']}})[_0x35f4('0x21')](handleEntityNotFound(_0x3e69ab,null))[_0x35f4('0x21')](function(_0x297502){if(_0x297502){return _0x297502[_0x35f4('0x84')](_0x2c43e8['query'][_0x35f4('0x62')]);}})[_0x35f4('0x21')](function(_0x4cf56d){if(_0x4cf56d){return db[_0x35f4('0x5e')][_0x35f4('0x22')]({'where':{'ListId':_0x2c43e8[_0x35f4('0x2d')][_0x35f4('0x62')],'CampaignId':_0x2c43e8[_0x35f4('0x44')]['id']}})[_0x35f4('0x21')](function(){return _0x4cf56d;});}})[_0x35f4('0x21')](respondWithStatusCode(_0x3e69ab,null))[_0x35f4('0x43')](handleError(_0x3e69ab,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 6343d38..9a6250a 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 _0xde5e=['moment','bluebird','request-promise','rimraf','./campaign.attributes','campaigns','lodash','util','../../config/logger','api'];(function(_0x25278d,_0xcd081c){var _0x58d59f=function(_0x4c5025){while(--_0x4c5025){_0x25278d['push'](_0x25278d['shift']());}};_0x58d59f(++_0xcd081c);}(_0xde5e,0x182));var _0xede5=function(_0x51349a,_0x159c14){_0x51349a=_0x51349a-0x0;var _0x533931=_0xde5e[_0x51349a];return _0x533931;};'use strict';var _=require(_0xede5('0x0'));var util=require(_0xede5('0x1'));var logger=require(_0xede5('0x2'))(_0xede5('0x3'));var moment=require(_0xede5('0x4'));var BPromise=require(_0xede5('0x5'));var rp=require(_0xede5('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xede5('0x7'));var config=require('../../config/environment');var attributes=require(_0xede5('0x8'));module['exports']=function(_0x1060b5,_0x1a303a){return _0x1060b5['define']('Campaign',attributes,{'tableName':_0xede5('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4e04=['bluebird','request-promise','path','rimraf','../../config/environment','./campaign.attributes','define','Campaign','campaigns','lodash','util','../../config/logger'];(function(_0x435452,_0x51aeb1){var _0x5471a8=function(_0x21998a){while(--_0x21998a){_0x435452['push'](_0x435452['shift']());}};_0x5471a8(++_0x51aeb1);}(_0x4e04,0x135));var _0x44e0=function(_0x292f93,_0x2c6e8e){_0x292f93=_0x292f93-0x0;var _0x5a94b1=_0x4e04[_0x292f93];return _0x5a94b1;};'use strict';var _=require(_0x44e0('0x0'));var util=require(_0x44e0('0x1'));var logger=require(_0x44e0('0x2'))('api');var moment=require('moment');var BPromise=require(_0x44e0('0x3'));var rp=require(_0x44e0('0x4'));var fs=require('fs');var path=require(_0x44e0('0x5'));var rimraf=require(_0x44e0('0x6'));var config=require(_0x44e0('0x7'));var attributes=require(_0x44e0('0x8'));module['exports']=function(_0x522686,_0x105f0b){return _0x522686[_0x44e0('0x9')](_0x44e0('0xa'),attributes,{'tableName':_0x44e0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index f800c08..a67446b 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 _0xa9e0=['catch','Campaign','findAll','options','raw','where','attributes','include','map','model','GetCampaign','stringify','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','code','error','message','result'];(function(_0x6046ac,_0x33b4cc){var _0x46137d=function(_0x228042){while(--_0x228042){_0x6046ac['push'](_0x6046ac['shift']());}};_0x46137d(++_0x33b4cc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xa9e0[_0x2b4411];return _0x8e41ef;};'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['GetCampaign']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')]({'raw':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x18')]||null:null,'attributes':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x19')]||null:null,'limit':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')]['limit']||null:null,'include':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x459eb1[_0x0a9e('0x16')]['include'],function(_0xfb6e48){return{'model':db[_0xfb6e48[_0x0a9e('0x1c')]],'as':_0xfb6e48['as'],'attributes':_0xfb6e48[_0x0a9e('0x19')],'include':_0xfb6e48[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0xfb6e48[_0x0a9e('0x1a')],function(_0x16b1ca){return{'model':db[_0x16b1ca['model']],'as':_0x16b1ca['as'],'attributes':_0x16b1ca['attributes'],'include':_0x16b1ca[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x16b1ca[_0x0a9e('0x1a')],function(_0x33161b){return{'model':db[_0x33161b['model']],'as':_0x33161b['as'],'attributes':_0x33161b[_0x0a9e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45a1e7){logger['info'](_0x0a9e('0x1d'),_0x459eb1);logger[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x459eb1,JSON[_0x0a9e('0x1e')](_0x45a1e7));_0x106033(_0x45a1e7);})[_0x0a9e('0x13')](function(_0x1538a4){logger[_0x0a9e('0x10')](_0x0a9e('0x1d'),_0x1538a4['message'],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x1538a4[_0x0a9e('0x11')]));});});}; \ 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(_0x1a1055,_0x4c16cc){var _0x3b62d0=function(_0x1be097){while(--_0x1be097){_0x1a1055['push'](_0x1a1055['shift']());}};_0x3b62d0(++_0x4c16cc);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'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 d39e017..a70b1c6 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 _0x1490=['index','/:id','show','isAuthenticated','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperBlacks','getLists','/:id/blacklists','getBlackLists','post','create','/:id/clone','clone','addBlackLists','update','destroy','delete','/:id/lists','removeLists','multer','connect-timeout','Router','../../components/interaction/service','../../config/environment','./campaign.controller','get'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x1490,0x85));var _0x0149=function(_0x2a5ff2,_0x4b588e){_0x2a5ff2=_0x2a5ff2-0x0;var _0x2a8951=_0x1490[_0x2a5ff2];return _0x2a8951;};'use strict';var multer=require(_0x0149('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x0149('0x1'));var express=require('express');var router=express[_0x0149('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x0149('0x3'));var config=require(_0x0149('0x4'));var controller=require(_0x0149('0x5'));router[_0x0149('0x6')]('/',auth['isAuthenticated'](),controller[_0x0149('0x7')]);router[_0x0149('0x6')](_0x0149('0x8'),auth['isAuthenticated'](),controller[_0x0149('0x9')]);router['get']('/:id/hoppers',auth[_0x0149('0xa')](),controller['getHoppers']);router[_0x0149('0x6')](_0x0149('0xb'),auth[_0x0149('0xa')](),controller[_0x0149('0xc')]);router[_0x0149('0x6')](_0x0149('0xd'),auth['isAuthenticated'](),controller['getHopperFinals']);router['get']('/:id/hopper_black',auth[_0x0149('0xa')](),controller[_0x0149('0xe')]);router['get']('/:id/lists',auth[_0x0149('0xa')](),controller[_0x0149('0xf')]);router['get'](_0x0149('0x10'),auth[_0x0149('0xa')](),controller[_0x0149('0x11')]);router[_0x0149('0x12')]('/',auth['isAuthenticated'](),controller[_0x0149('0x13')]);router['post'](_0x0149('0x14'),auth[_0x0149('0xa')](),controller[_0x0149('0x15')]);router[_0x0149('0x12')]('/:id/lists',auth['isAuthenticated'](),controller['addLists']);router['post'](_0x0149('0x10'),auth[_0x0149('0xa')](),controller[_0x0149('0x16')]);router['put'](_0x0149('0x8'),auth[_0x0149('0xa')](),controller[_0x0149('0x17')]);router['delete'](_0x0149('0x8'),auth[_0x0149('0xa')](),controller[_0x0149('0x18')]);router[_0x0149('0x19')](_0x0149('0x1a'),auth[_0x0149('0xa')](),controller[_0x0149('0x1b')]);router[_0x0149('0x19')](_0x0149('0x10'),auth['isAuthenticated'](),controller['removeBlackLists']);module['exports']=router; \ No newline at end of file +var _0x2f18=['clone','addLists','addBlackLists','put','update','delete','destroy','util','path','connect-timeout','express','../../components/auth/service','./campaign.controller','isAuthenticated','index','get','/:id','show','/:id/hoppers','getHopperHistories','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','/:id/blacklists','getBlackLists','post','create','/:id/clone'];(function(_0x2ae8d1,_0x4b51f5){var _0x354904=function(_0x229540){while(--_0x229540){_0x2ae8d1['push'](_0x2ae8d1['shift']());}};_0x354904(++_0x4b51f5);}(_0x2f18,0xd9));var _0x82f1=function(_0x1e4b61,_0x3afe6b){_0x1e4b61=_0x1e4b61-0x0;var _0x14490e=_0x2f18[_0x1e4b61];return _0x14490e;};'use strict';var multer=require('multer');var util=require(_0x82f1('0x0'));var path=require(_0x82f1('0x1'));var timeout=require(_0x82f1('0x2'));var express=require(_0x82f1('0x3'));var router=express['Router']();var auth=require(_0x82f1('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x82f1('0x5'));router['get']('/',auth[_0x82f1('0x6')](),controller[_0x82f1('0x7')]);router[_0x82f1('0x8')](_0x82f1('0x9'),auth['isAuthenticated'](),controller[_0x82f1('0xa')]);router[_0x82f1('0x8')](_0x82f1('0xb'),auth[_0x82f1('0x6')](),controller['getHoppers']);router['get']('/:id/hopper_histories',auth['isAuthenticated'](),controller[_0x82f1('0xc')]);router[_0x82f1('0x8')]('/:id/hopper_finals',auth['isAuthenticated'](),controller[_0x82f1('0xd')]);router[_0x82f1('0x8')](_0x82f1('0xe'),auth['isAuthenticated'](),controller[_0x82f1('0xf')]);router[_0x82f1('0x8')](_0x82f1('0x10'),auth[_0x82f1('0x6')](),controller[_0x82f1('0x11')]);router[_0x82f1('0x8')](_0x82f1('0x12'),auth[_0x82f1('0x6')](),controller[_0x82f1('0x13')]);router[_0x82f1('0x14')]('/',auth['isAuthenticated'](),controller[_0x82f1('0x15')]);router[_0x82f1('0x14')](_0x82f1('0x16'),auth[_0x82f1('0x6')](),controller[_0x82f1('0x17')]);router[_0x82f1('0x14')](_0x82f1('0x10'),auth[_0x82f1('0x6')](),controller[_0x82f1('0x18')]);router[_0x82f1('0x14')](_0x82f1('0x12'),auth[_0x82f1('0x6')](),controller[_0x82f1('0x19')]);router[_0x82f1('0x1a')]('/:id',auth[_0x82f1('0x6')](),controller[_0x82f1('0x1b')]);router[_0x82f1('0x1c')](_0x82f1('0x9'),auth[_0x82f1('0x6')](),controller[_0x82f1('0x1d')]);router[_0x82f1('0x1c')]('/:id/lists',auth['isAuthenticated'](),controller['removeLists']);router[_0x82f1('0x1c')](_0x82f1('0x12'),auth[_0x82f1('0x6')](),controller['removeBlackLists']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index 629c958..6b877d8 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 _0x9e52=['getDataValue','sequelize','exports','STRING','VIRTUAL'];(function(_0x5e5982,_0x5e9a65){var _0xa20a32=function(_0x5a7900){while(--_0x5a7900){_0x5e5982['push'](_0x5e5982['shift']());}};_0xa20a32(++_0x5e9a65);}(_0x9e52,0x19b));var _0x29e5=function(_0x4178d9,_0x457645){_0x4178d9=_0x4178d9-0x0;var _0x4c0932=_0x9e52[_0x4178d9];return _0x4c0932;};'use strict';var Sequelize=require(_0x29e5('0x0'));module[_0x29e5('0x1')]={'key':{'type':Sequelize[_0x29e5('0x2')],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'allowNull':![]},'description':{'type':Sequelize[_0x29e5('0x2')]},'name':{'type':Sequelize[_0x29e5('0x3')],'get':function(){return this[_0x29e5('0x4')]('key');}}}; \ No newline at end of file +var _0x59cb=['key','exports','STRING','TEXT'];(function(_0x42dd39,_0x558640){var _0x3da7a0=function(_0x436778){while(--_0x436778){_0x42dd39['push'](_0x42dd39['shift']());}};_0x3da7a0(++_0x558640);}(_0x59cb,0xa5));var _0xb59c=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x59cb[_0xfae23b];return _0x200640;};'use strict';var Sequelize=require('sequelize');module[_0xb59c('0x0')]={'key':{'type':Sequelize[_0xb59c('0x1')],'allowNull':![]},'value':{'type':Sequelize[_0xb59c('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xb59c('0x1')]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue'](_0xb59c('0x3'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 67e1fa1..49b1a9d 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 _0xa1ce=['find','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','ValidationError','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','status','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','get','UserProfileResource','sendStatus','error','stack','name','send','index','map','CannedAnswer','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','include','catch','show','params'];(function(_0xc54ea3,_0x580076){var _0x304df0=function(_0x3f866a){while(--_0x3f866a){_0xc54ea3['push'](_0xc54ea3['shift']());}};_0x304df0(++_0x580076);}(_0xa1ce,0x10f));var _0xea1c=function(_0x5e0860,_0x122b5a){_0x5e0860=_0x5e0860-0x0;var _0x53f01e=_0xa1ce[_0x5e0860];return _0x53f01e;};'use strict';var pdf=require(_0xea1c('0x0'));var emlformat=require(_0xea1c('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xea1c('0x2'));var jsonpatch=require(_0xea1c('0x3'));var rp=require(_0xea1c('0x4'));var moment=require(_0xea1c('0x5'));var BPromise=require(_0xea1c('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xea1c('0x7'));var sox=require(_0xea1c('0x8'));var csv=require(_0xea1c('0x9'));var ejs=require(_0xea1c('0xa'));var fs=require('fs');var _=require(_0xea1c('0xb'));var squel=require(_0xea1c('0xc'));var crypto=require(_0xea1c('0xd'));var jsforce=require(_0xea1c('0xe'));var deskjs=require(_0xea1c('0xf'));var toCsv=require(_0xea1c('0x9'));var querystring=require('querystring');var Papa=require(_0xea1c('0x10'));var Redis=require(_0xea1c('0x11'));var authService=require(_0xea1c('0x12'));var qs=require(_0xea1c('0x13'));var as=require(_0xea1c('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xea1c('0x15'))(_0xea1c('0x16'));var utils=require(_0xea1c('0x17'));var config=require(_0xea1c('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x6757cc,_0x20d0c8){_0x20d0c8=_0x20d0c8||0xcc;return function(_0x5642df){if(_0x5642df){return _0x6757cc['sendStatus'](_0x20d0c8);}return _0x6757cc[_0xea1c('0x19')](_0x20d0c8)['end']();};}function respondWithResult(_0x1c3767,_0xa085eb){_0xa085eb=_0xa085eb||0xc8;return function(_0x5881fa){if(_0x5881fa){return _0x1c3767[_0xea1c('0x19')](_0xa085eb)[_0xea1c('0x1a')](_0x5881fa);}};}function respondWithFilteredResult(_0x198870,_0x111b3a){return function(_0x1d923e){if(_0x1d923e){var _0x5d6693=_0x1d923e[_0xea1c('0x1b')],_0x2d13e3=_0x111b3a['offset'],_0x3e1ac4=_0x111b3a[_0xea1c('0x1c')]+_0x111b3a[_0xea1c('0x1d')],_0xc36ed0;if(_0x3e1ac4>=_0x5d6693){_0x3e1ac4=_0x5d6693;_0xc36ed0=0xc8;}else{_0xc36ed0=0xce;}_0x198870[_0xea1c('0x19')](_0xc36ed0);return _0x198870[_0xea1c('0x1e')](_0xea1c('0x1f'),_0x2d13e3+'-'+_0x3e1ac4+'/'+_0x5d6693)['json'](_0x1d923e);}return null;};}function patchUpdates(_0x1973b1){return function(_0x25f784){try{jsonpatch['apply'](_0x25f784,_0x1973b1,!![]);}catch(_0x28fbc1){return BPromise[_0xea1c('0x20')](_0x28fbc1);}return _0x25f784[_0xea1c('0x21')]();};}function saveUpdates(_0x4053b2,_0x4a9611){return function(_0x10810d){if(_0x10810d){return _0x10810d[_0xea1c('0x22')](_0x4053b2)[_0xea1c('0x23')](function(_0x58b305){return _0x58b305;});}return null;};}function removeEntity(_0x519762,_0x50af21){return function(_0x23260a){if(_0x23260a){return _0x23260a[_0xea1c('0x24')]()[_0xea1c('0x23')](function(){var _0x31f355=_0x23260a[_0xea1c('0x25')]({'plain':!![]});var _0x31459f='CannedAnswers';return db[_0xea1c('0x26')]['destroy']({'where':{'type':_0x31459f,'resourceId':_0x31f355['id']}})[_0xea1c('0x23')](function(){return _0x23260a;});})[_0xea1c('0x23')](function(){_0x519762[_0xea1c('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x47f79d,_0x3fcb5d){return function(_0x233ed8){if(!_0x233ed8){_0x47f79d[_0xea1c('0x27')](0x194);}return _0x233ed8;};}function handleError(_0xc08674,_0x30bca5){_0x30bca5=_0x30bca5||0x1f4;return function(_0x43ffc3){logger[_0xea1c('0x28')](_0x43ffc3[_0xea1c('0x29')]);if(_0x43ffc3[_0xea1c('0x2a')]){delete _0x43ffc3[_0xea1c('0x2a')];}_0xc08674[_0xea1c('0x19')](_0x30bca5)[_0xea1c('0x2b')](_0x43ffc3);};}exports[_0xea1c('0x2c')]=function(_0x3260be,_0x232e3f){var _0x177b99={},_0xece098={},_0x4bd03d={'count':0x0,'rows':[]};var _0x516e38=_[_0xea1c('0x2d')](db[_0xea1c('0x2e')][_0xea1c('0x2f')],function(_0x3c92c7){return{'name':_0x3c92c7[_0xea1c('0x30')],'type':_0x3c92c7[_0xea1c('0x31')][_0xea1c('0x32')]};});_0xece098['model']=_[_0xea1c('0x2d')](_0x516e38,'name');_0xece098[_0xea1c('0x33')]=_[_0xea1c('0x34')](_0x3260be[_0xea1c('0x33')]);_0xece098[_0xea1c('0x35')]=_[_0xea1c('0x36')](_0xece098[_0xea1c('0x37')],_0xece098[_0xea1c('0x33')]);_0x177b99[_0xea1c('0x38')]=_[_0xea1c('0x36')](_0xece098[_0xea1c('0x37')],qs[_0xea1c('0x39')](_0x3260be[_0xea1c('0x33')][_0xea1c('0x39')]));_0x177b99[_0xea1c('0x38')]=_0x177b99[_0xea1c('0x38')][_0xea1c('0x3a')]?_0x177b99['attributes']:_0xece098[_0xea1c('0x37')];if(!_0x3260be[_0xea1c('0x33')][_0xea1c('0x3b')]('nolimit')){_0x177b99[_0xea1c('0x1d')]=qs[_0xea1c('0x1d')](_0x3260be[_0xea1c('0x33')]['limit']);_0x177b99['offset']=qs[_0xea1c('0x1c')](_0x3260be[_0xea1c('0x33')][_0xea1c('0x1c')]);}_0x177b99[_0xea1c('0x3c')]=qs[_0xea1c('0x3d')](_0x3260be[_0xea1c('0x33')]['sort']);_0x177b99['where']=qs['filters'](_[_0xea1c('0x3e')](_0x3260be[_0xea1c('0x33')],_0xece098[_0xea1c('0x35')]),_0x516e38);if(_0x3260be[_0xea1c('0x33')][_0xea1c('0x3f')]){_0x177b99['where']=_[_0xea1c('0x40')](_0x177b99[_0xea1c('0x41')],{'$or':_[_0xea1c('0x2d')](_0x516e38,function(_0x28fef7){if(_0x28fef7[_0xea1c('0x31')]!==_0xea1c('0x42')){var _0x40e681={};_0x40e681[_0x28fef7['name']]={'$like':'%'+_0x3260be[_0xea1c('0x33')]['filter']+'%'};return _0x40e681;}})});}_0x177b99=_['merge']({},_0x177b99,_0x3260be[_0xea1c('0x43')]);var _0xb101d1={'where':_0x177b99['where']};return db[_0xea1c('0x2e')][_0xea1c('0x1b')](_0xb101d1)[_0xea1c('0x23')](function(_0x585e2a){_0x4bd03d['count']=_0x585e2a;if(_0x3260be[_0xea1c('0x33')][_0xea1c('0x44')]){_0x177b99[_0xea1c('0x45')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x177b99);})[_0xea1c('0x23')](function(_0x45e57a){_0x4bd03d['rows']=_0x45e57a;return _0x4bd03d;})[_0xea1c('0x23')](respondWithFilteredResult(_0x232e3f,_0x177b99))[_0xea1c('0x46')](handleError(_0x232e3f,null));};exports[_0xea1c('0x47')]=function(_0x5cb494,_0x137511){var _0x36c40e={'raw':!![],'where':{'id':_0x5cb494[_0xea1c('0x48')]['id']}},_0x183b07={};_0x183b07[_0xea1c('0x37')]=_[_0xea1c('0x34')](db[_0xea1c('0x2e')][_0xea1c('0x2f')]);_0x183b07['query']=_[_0xea1c('0x34')](_0x5cb494['query']);_0x183b07['filters']=_[_0xea1c('0x36')](_0x183b07[_0xea1c('0x37')],_0x183b07[_0xea1c('0x33')]);_0x36c40e['attributes']=_[_0xea1c('0x36')](_0x183b07[_0xea1c('0x37')],qs[_0xea1c('0x39')](_0x5cb494[_0xea1c('0x33')][_0xea1c('0x39')]));_0x36c40e[_0xea1c('0x38')]=_0x36c40e[_0xea1c('0x38')]['length']?_0x36c40e[_0xea1c('0x38')]:_0x183b07[_0xea1c('0x37')];if(_0x5cb494[_0xea1c('0x33')]['includeAll']){_0x36c40e[_0xea1c('0x45')]=[{'all':!![]}];}_0x36c40e=_[_0xea1c('0x40')]({},_0x36c40e,_0x5cb494[_0xea1c('0x43')]);return db[_0xea1c('0x2e')][_0xea1c('0x49')](_0x36c40e)['then'](handleEntityNotFound(_0x137511,null))[_0xea1c('0x23')](respondWithResult(_0x137511,null))[_0xea1c('0x46')](handleError(_0x137511,null));};exports[_0xea1c('0x22')]=function(_0x1674e0,_0xf446aa){if(_0x1674e0['body']['id']){delete _0x1674e0[_0xea1c('0x4a')]['id'];}return db[_0xea1c('0x2e')][_0xea1c('0x49')]({'where':{'id':_0x1674e0['params']['id']}})[_0xea1c('0x23')](handleEntityNotFound(_0xf446aa,null))[_0xea1c('0x23')](saveUpdates(_0x1674e0['body'],null))[_0xea1c('0x23')](respondWithResult(_0xf446aa,null))[_0xea1c('0x46')](handleError(_0xf446aa,null));};exports['destroy']=function(_0x5ccc54,_0x216ea2){return db[_0xea1c('0x2e')][_0xea1c('0x49')]({'where':{'id':_0x5ccc54['params']['id']}})[_0xea1c('0x23')](handleEntityNotFound(_0x216ea2,null))[_0xea1c('0x23')](removeEntity(_0x216ea2,null))['catch'](handleError(_0x216ea2,null));};exports[_0xea1c('0x4b')]=function(_0x235f62,_0x4bc455){var _0x5b95ac={'key':_0x235f62['body'][_0xea1c('0x32')]};if(_0x235f62[_0xea1c('0x4a')][_0xea1c('0x4c')]){_0x5b95ac['MailAccountId']=_0x235f62['body'][_0xea1c('0x4c')];}else if(_0x235f62[_0xea1c('0x4a')][_0xea1c('0x4d')]){_0x5b95ac[_0xea1c('0x4d')]=_0x235f62[_0xea1c('0x4a')][_0xea1c('0x4d')];}else if(_0x235f62[_0xea1c('0x4a')][_0xea1c('0x4e')]){_0x5b95ac[_0xea1c('0x4e')]=_0x235f62['body'][_0xea1c('0x4e')];}else if(_0x235f62[_0xea1c('0x4a')][_0xea1c('0x4f')]){_0x5b95ac['ChatWebsiteId']=_0x235f62[_0xea1c('0x4a')][_0xea1c('0x4f')];}return db[_0xea1c('0x2e')][_0xea1c('0x49')]({'where':_0x5b95ac})[_0xea1c('0x23')](function(_0x31c68a){if(_0x31c68a){throw new db['Sequelize'][(_0xea1c('0x50'))]('The\x20inserted\x20key\x20already\x20exists.');}return db[_0xea1c('0x2e')][_0xea1c('0x4b')](_0x235f62[_0xea1c('0x4a')]);})[_0xea1c('0x23')](function(_0x3a8db5){var _0x10efbb=_0x235f62[_0xea1c('0x51')]['get']({'plain':!![]});if(!_0x10efbb)throw new Error(_0xea1c('0x52'));if(_0x10efbb[_0xea1c('0x53')]===_0xea1c('0x51')){var _0x3e6313=_0x3a8db5[_0xea1c('0x25')]({'plain':!![]});return db['UserProfileSection'][_0xea1c('0x49')]({'where':{'name':'CannedAnswers','userProfileId':_0x10efbb[_0xea1c('0x54')]},'raw':!![]})['then'](function(_0x18b55a){if(_0x18b55a&&_0x18b55a[_0xea1c('0x55')]===0x0){return db[_0xea1c('0x26')]['create']({'name':_0x3e6313['name'],'resourceId':_0x3e6313['id'],'type':_0x18b55a['name'],'sectionId':_0x18b55a['id']},{})[_0xea1c('0x23')](function(){return _0x3a8db5;});}else{return _0x3a8db5;}})['catch'](function(_0x4b35da){logger[_0xea1c('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4b35da);throw _0x4b35da;});}return _0x3a8db5;})[_0xea1c('0x23')](respondWithResult(_0x4bc455,0xc9))[_0xea1c('0x46')](handleError(_0x4bc455,null));}; \ No newline at end of file +var _0x9043=['findAll','rows','catch','params','find','body','create','key','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','CannedAnswers','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','limit','set','Content-Range','apply','save','update','then','get','UserProfileResource','destroy','end','error','name','send','map','CannedAnswer','rawAttributes','fieldName','type','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','offset','order','sort','where','pick','filters','filter','VIRTUAL','merge','options','includeAll'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0x9043,0x18a));var _0x3904=function(_0x49cd01,_0x9f3208){_0x49cd01=_0x49cd01-0x0;var _0x1794a5=_0x9043[_0x49cd01];return _0x1794a5;};'use strict';var pdf=require(_0x3904('0x0'));var emlformat=require(_0x3904('0x1'));var rimraf=require(_0x3904('0x2'));var zipdir=require(_0x3904('0x3'));var jsonpatch=require(_0x3904('0x4'));var rp=require(_0x3904('0x5'));var moment=require(_0x3904('0x6'));var BPromise=require(_0x3904('0x7'));var Mustache=require(_0x3904('0x8'));var util=require(_0x3904('0x9'));var path=require('path');var sox=require(_0x3904('0xa'));var csv=require(_0x3904('0xb'));var ejs=require(_0x3904('0xc'));var fs=require('fs');var _=require(_0x3904('0xd'));var squel=require(_0x3904('0xe'));var crypto=require('crypto');var jsforce=require(_0x3904('0xf'));var deskjs=require(_0x3904('0x10'));var toCsv=require(_0x3904('0xb'));var querystring=require(_0x3904('0x11'));var Papa=require(_0x3904('0x12'));var Redis=require(_0x3904('0x13'));var authService=require(_0x3904('0x14'));var qs=require(_0x3904('0x15'));var as=require(_0x3904('0x16'));var hardwareService=require(_0x3904('0x17'));var logger=require(_0x3904('0x18'))(_0x3904('0x19'));var utils=require(_0x3904('0x1a'));var config=require(_0x3904('0x1b'));var db=require(_0x3904('0x1c'))['db'];function respondWithStatusCode(_0x30f04f,_0x17928c){_0x17928c=_0x17928c||0xcc;return function(_0x47f101){if(_0x47f101){return _0x30f04f[_0x3904('0x1d')](_0x17928c);}return _0x30f04f[_0x3904('0x1e')](_0x17928c)['end']();};}function respondWithResult(_0x4f844a,_0x54c95d){_0x54c95d=_0x54c95d||0xc8;return function(_0x40f5ad){if(_0x40f5ad){return _0x4f844a[_0x3904('0x1e')](_0x54c95d)[_0x3904('0x1f')](_0x40f5ad);}};}function respondWithFilteredResult(_0x292a9b,_0x5bd96a){return function(_0x10c29a){if(_0x10c29a){var _0x41745d=_0x10c29a[_0x3904('0x20')],_0xf9c120=_0x5bd96a['offset'],_0x448d36=_0x5bd96a['offset']+_0x5bd96a[_0x3904('0x21')],_0x17cc9b;if(_0x448d36>=_0x41745d){_0x448d36=_0x41745d;_0x17cc9b=0xc8;}else{_0x17cc9b=0xce;}_0x292a9b[_0x3904('0x1e')](_0x17cc9b);return _0x292a9b[_0x3904('0x22')](_0x3904('0x23'),_0xf9c120+'-'+_0x448d36+'/'+_0x41745d)[_0x3904('0x1f')](_0x10c29a);}return null;};}function patchUpdates(_0x5b5be4){return function(_0x49d9a9){try{jsonpatch[_0x3904('0x24')](_0x49d9a9,_0x5b5be4,!![]);}catch(_0x15a1f6){return BPromise['reject'](_0x15a1f6);}return _0x49d9a9[_0x3904('0x25')]();};}function saveUpdates(_0x17c57b,_0x2ef919){return function(_0x54e6d7){if(_0x54e6d7){return _0x54e6d7[_0x3904('0x26')](_0x17c57b)[_0x3904('0x27')](function(_0x4fc81e){return _0x4fc81e;});}return null;};}function removeEntity(_0x4d6b3d,_0x4aacb9){return function(_0x28706d){if(_0x28706d){return _0x28706d['destroy']()[_0x3904('0x27')](function(){var _0xeb2950=_0x28706d[_0x3904('0x28')]({'plain':!![]});var _0x28e15a='CannedAnswers';return db[_0x3904('0x29')][_0x3904('0x2a')]({'where':{'type':_0x28e15a,'resourceId':_0xeb2950['id']}})[_0x3904('0x27')](function(){return _0x28706d;});})[_0x3904('0x27')](function(){_0x4d6b3d[_0x3904('0x1e')](0xcc)[_0x3904('0x2b')]();});}};}function handleEntityNotFound(_0x5f16df,_0xc0f369){return function(_0x53214f){if(!_0x53214f){_0x5f16df[_0x3904('0x1d')](0x194);}return _0x53214f;};}function handleError(_0x1f80da,_0x9e3f80){_0x9e3f80=_0x9e3f80||0x1f4;return function(_0x16ec39){logger[_0x3904('0x2c')](_0x16ec39['stack']);if(_0x16ec39[_0x3904('0x2d')]){delete _0x16ec39[_0x3904('0x2d')];}_0x1f80da[_0x3904('0x1e')](_0x9e3f80)[_0x3904('0x2e')](_0x16ec39);};}exports['index']=function(_0x3cb81c,_0x1d0bc8){var _0x4fb3bf={},_0x3899e3={},_0x16b5df={'count':0x0,'rows':[]};var _0x37bf34=_[_0x3904('0x2f')](db[_0x3904('0x30')][_0x3904('0x31')],function(_0x487d4b){return{'name':_0x487d4b[_0x3904('0x32')],'type':_0x487d4b[_0x3904('0x33')]['key']};});_0x3899e3[_0x3904('0x34')]=_['map'](_0x37bf34,_0x3904('0x2d'));_0x3899e3['query']=_[_0x3904('0x35')](_0x3cb81c[_0x3904('0x36')]);_0x3899e3['filters']=_[_0x3904('0x37')](_0x3899e3['model'],_0x3899e3[_0x3904('0x36')]);_0x4fb3bf['attributes']=_[_0x3904('0x37')](_0x3899e3[_0x3904('0x34')],qs['fields'](_0x3cb81c['query'][_0x3904('0x38')]));_0x4fb3bf[_0x3904('0x39')]=_0x4fb3bf['attributes'][_0x3904('0x3a')]?_0x4fb3bf['attributes']:_0x3899e3[_0x3904('0x34')];if(!_0x3cb81c[_0x3904('0x36')][_0x3904('0x3b')]('nolimit')){_0x4fb3bf[_0x3904('0x21')]=qs[_0x3904('0x21')](_0x3cb81c['query']['limit']);_0x4fb3bf[_0x3904('0x3c')]=qs[_0x3904('0x3c')](_0x3cb81c[_0x3904('0x36')][_0x3904('0x3c')]);}_0x4fb3bf[_0x3904('0x3d')]=qs['sort'](_0x3cb81c[_0x3904('0x36')][_0x3904('0x3e')]);_0x4fb3bf[_0x3904('0x3f')]=qs['filters'](_[_0x3904('0x40')](_0x3cb81c[_0x3904('0x36')],_0x3899e3[_0x3904('0x41')]),_0x37bf34);if(_0x3cb81c[_0x3904('0x36')][_0x3904('0x42')]){_0x4fb3bf[_0x3904('0x3f')]=_['merge'](_0x4fb3bf[_0x3904('0x3f')],{'$or':_[_0x3904('0x2f')](_0x37bf34,function(_0xa22270){if(_0xa22270[_0x3904('0x33')]!==_0x3904('0x43')){var _0x59cefe={};_0x59cefe[_0xa22270[_0x3904('0x2d')]]={'$like':'%'+_0x3cb81c[_0x3904('0x36')][_0x3904('0x42')]+'%'};return _0x59cefe;}})});}_0x4fb3bf=_[_0x3904('0x44')]({},_0x4fb3bf,_0x3cb81c[_0x3904('0x45')]);var _0x42f5b4={'where':_0x4fb3bf[_0x3904('0x3f')]};return db[_0x3904('0x30')][_0x3904('0x20')](_0x42f5b4)[_0x3904('0x27')](function(_0x523611){_0x16b5df['count']=_0x523611;if(_0x3cb81c['query'][_0x3904('0x46')]){_0x4fb3bf['include']=[{'all':!![]}];}return db[_0x3904('0x30')][_0x3904('0x47')](_0x4fb3bf);})[_0x3904('0x27')](function(_0xc8ded9){_0x16b5df[_0x3904('0x48')]=_0xc8ded9;return _0x16b5df;})['then'](respondWithFilteredResult(_0x1d0bc8,_0x4fb3bf))[_0x3904('0x49')](handleError(_0x1d0bc8,null));};exports['show']=function(_0x2416f8,_0x4f0c37){var _0x1b7c9b={'raw':!![],'where':{'id':_0x2416f8[_0x3904('0x4a')]['id']}},_0x11101a={};_0x11101a[_0x3904('0x34')]=_[_0x3904('0x35')](db[_0x3904('0x30')][_0x3904('0x31')]);_0x11101a[_0x3904('0x36')]=_[_0x3904('0x35')](_0x2416f8[_0x3904('0x36')]);_0x11101a[_0x3904('0x41')]=_['intersection'](_0x11101a[_0x3904('0x34')],_0x11101a[_0x3904('0x36')]);_0x1b7c9b[_0x3904('0x39')]=_[_0x3904('0x37')](_0x11101a[_0x3904('0x34')],qs[_0x3904('0x38')](_0x2416f8[_0x3904('0x36')][_0x3904('0x38')]));_0x1b7c9b['attributes']=_0x1b7c9b['attributes'][_0x3904('0x3a')]?_0x1b7c9b[_0x3904('0x39')]:_0x11101a[_0x3904('0x34')];if(_0x2416f8[_0x3904('0x36')][_0x3904('0x46')]){_0x1b7c9b['include']=[{'all':!![]}];}_0x1b7c9b=_[_0x3904('0x44')]({},_0x1b7c9b,_0x2416f8[_0x3904('0x45')]);return db['CannedAnswer'][_0x3904('0x4b')](_0x1b7c9b)[_0x3904('0x27')](handleEntityNotFound(_0x4f0c37,null))[_0x3904('0x27')](respondWithResult(_0x4f0c37,null))[_0x3904('0x49')](handleError(_0x4f0c37,null));};exports[_0x3904('0x26')]=function(_0xda7cf5,_0x46bceb){if(_0xda7cf5[_0x3904('0x4c')]['id']){delete _0xda7cf5[_0x3904('0x4c')]['id'];}return db[_0x3904('0x30')][_0x3904('0x4b')]({'where':{'id':_0xda7cf5['params']['id']}})['then'](handleEntityNotFound(_0x46bceb,null))[_0x3904('0x27')](saveUpdates(_0xda7cf5[_0x3904('0x4c')],null))['then'](respondWithResult(_0x46bceb,null))[_0x3904('0x49')](handleError(_0x46bceb,null));};exports[_0x3904('0x2a')]=function(_0xd90cf2,_0xe15bc1){return db[_0x3904('0x30')][_0x3904('0x4b')]({'where':{'id':_0xd90cf2['params']['id']}})['then'](handleEntityNotFound(_0xe15bc1,null))[_0x3904('0x27')](removeEntity(_0xe15bc1,null))[_0x3904('0x49')](handleError(_0xe15bc1,null));};exports[_0x3904('0x4d')]=function(_0x267382,_0x3556e1){var _0x2b393b={'key':_0x267382[_0x3904('0x4c')][_0x3904('0x4e')]};if(_0x267382[_0x3904('0x4c')]['MailAccountId']){_0x2b393b[_0x3904('0x4f')]=_0x267382[_0x3904('0x4c')]['MailAccountId'];}else if(_0x267382[_0x3904('0x4c')][_0x3904('0x50')]){_0x2b393b['SmsAccountId']=_0x267382[_0x3904('0x4c')][_0x3904('0x50')];}else if(_0x267382[_0x3904('0x4c')]['OpenchannelAccountId']){_0x2b393b[_0x3904('0x51')]=_0x267382['body']['OpenchannelAccountId'];}else if(_0x267382[_0x3904('0x4c')][_0x3904('0x52')]){_0x2b393b[_0x3904('0x52')]=_0x267382[_0x3904('0x4c')][_0x3904('0x52')];}return db['CannedAnswer'][_0x3904('0x4b')]({'where':_0x2b393b})[_0x3904('0x27')](function(_0x380c2c){if(_0x380c2c){throw new db[(_0x3904('0x53'))][(_0x3904('0x54'))](_0x3904('0x55'));}return db[_0x3904('0x30')][_0x3904('0x4d')](_0x267382[_0x3904('0x4c')]);})[_0x3904('0x27')](function(_0x5d78d5){var _0x2849bb=_0x267382['user']['get']({'plain':!![]});if(!_0x2849bb)throw new Error(_0x3904('0x56'));if(_0x2849bb[_0x3904('0x57')]==='user'){var _0x51f791=_0x5d78d5[_0x3904('0x28')]({'plain':!![]});return db[_0x3904('0x58')]['find']({'where':{'name':_0x3904('0x59'),'userProfileId':_0x2849bb[_0x3904('0x5a')]},'raw':!![]})['then'](function(_0x29ac3f){if(_0x29ac3f&&_0x29ac3f[_0x3904('0x5b')]===0x0){return db[_0x3904('0x29')]['create']({'name':_0x51f791[_0x3904('0x2d')],'resourceId':_0x51f791['id'],'type':_0x29ac3f[_0x3904('0x2d')],'sectionId':_0x29ac3f['id']},{})[_0x3904('0x27')](function(){return _0x5d78d5;});}else{return _0x5d78d5;}})[_0x3904('0x49')](function(_0x250fbf){logger[_0x3904('0x2c')](_0x3904('0x5c'),_0x250fbf);throw _0x250fbf;});}return _0x5d78d5;})[_0x3904('0x27')](respondWithResult(_0x3556e1,0xc9))[_0x3904('0x49')](handleError(_0x3556e1,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 3ec1e78..10bc7bc 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 _0xbe85=['../../config/environment','./cannedAnswer.attributes','exports','define','CannedAnswer','tools_canned_answers','utf8mb4','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x4b91c4,_0x23f35f){var _0x25cb80=function(_0x48e283){while(--_0x48e283){_0x4b91c4['push'](_0x4b91c4['shift']());}};_0x25cb80(++_0x23f35f);}(_0xbe85,0x19c));var _0x5be8=function(_0x1820d7,_0x5ef72d){_0x1820d7=_0x1820d7-0x0;var _0x56d616=_0xbe85[_0x1820d7];return _0x56d616;};'use strict';var _=require(_0x5be8('0x0'));var util=require(_0x5be8('0x1'));var logger=require(_0x5be8('0x2'))('api');var moment=require(_0x5be8('0x3'));var BPromise=require(_0x5be8('0x4'));var rp=require(_0x5be8('0x5'));var fs=require('fs');var path=require(_0x5be8('0x6'));var rimraf=require(_0x5be8('0x7'));var config=require(_0x5be8('0x8'));var attributes=require(_0x5be8('0x9'));module[_0x5be8('0xa')]=function(_0x29fadb,_0x40ee6c){return _0x29fadb[_0x5be8('0xb')](_0x5be8('0xc'),attributes,{'tableName':_0x5be8('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5be8('0xe'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xab26=['./cannedAnswer.attributes','exports','define','CannedAnswer','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','rimraf'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xab26,0xd2));var _0x6ab2=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xab26[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x6ab2('0x0'));var util=require(_0x6ab2('0x1'));var logger=require(_0x6ab2('0x2'))('api');var moment=require(_0x6ab2('0x3'));var BPromise=require(_0x6ab2('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6ab2('0x5'));var config=require('../../config/environment');var attributes=require(_0x6ab2('0x6'));module[_0x6ab2('0x7')]=function(_0x31c9f1,_0x56dc80){return _0x31c9f1[_0x6ab2('0x8')](_0x6ab2('0x9'),attributes,{'tableName':'tools_canned_answers','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6ab2('0xa'),'collate':_0x6ab2('0xb')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 28c950c..e76f933 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 _0xe04a=['code','error','CannedAnswer,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','stringify'];(function(_0x533b02,_0x1afe6a){var _0x174eec=function(_0x428c5a){while(--_0x428c5a){_0x533b02['push'](_0x533b02['shift']());}};_0x174eec(++_0x1afe6a);}(_0xe04a,0x150));var _0xae04=function(_0x2c7fdb,_0x1e2c50){_0x2c7fdb=_0x2c7fdb-0x0;var _0x25640d=_0xe04a[_0x2c7fdb];return _0x25640d;};'use strict';var _=require('lodash');var util=require(_0xae04('0x0'));var moment=require(_0xae04('0x1'));var BPromise=require(_0xae04('0x2'));var rs=require(_0xae04('0x3'));var fs=require('fs');var Redis=require(_0xae04('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xae04('0x5'))(_0xae04('0x6'));var config=require(_0xae04('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xae04('0x8')][_0xae04('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xa93b67,_0x138a6d,_0x2e698e){return new BPromise(function(_0x29f6c1,_0x39fb63){return client[_0xae04('0xa')](_0xa93b67,_0x2e698e)[_0xae04('0xb')](function(_0x386f0b){logger[_0xae04('0xc')]('CannedAnswer,\x20%s,\x20%s',_0x138a6d,_0xae04('0xd'));logger[_0xae04('0xe')]('CannedAnswer,\x20%s,\x20%s,\x20%s',_0x138a6d,_0xae04('0xd'),JSON[_0xae04('0xf')](_0x386f0b));if(_0x386f0b['error']){if(_0x386f0b['error'][_0xae04('0x10')]===0x1f4){logger[_0xae04('0x11')](_0xae04('0x12'),_0x138a6d,_0x386f0b[_0xae04('0x11')][_0xae04('0x13')]);return _0x39fb63(_0x386f0b[_0xae04('0x11')]['message']);}logger[_0xae04('0x11')](_0xae04('0x12'),_0x138a6d,_0x386f0b[_0xae04('0x11')]['message']);return _0x29f6c1(_0x386f0b['error'][_0xae04('0x13')]);}else{logger[_0xae04('0xc')](_0xae04('0x12'),_0x138a6d,_0xae04('0xd'));_0x29f6c1(_0x386f0b[_0xae04('0x14')][_0xae04('0x13')]);}})[_0xae04('0x15')](function(_0x1d3188){logger['error'](_0xae04('0x12'),_0x138a6d,_0x1d3188);_0x39fb63(_0x1d3188);});});} \ No newline at end of file +var _0xfd6b=['http','request','then','info','CannedAnswer,\x20%s,\x20%s','request\x20sent','debug','CannedAnswer,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x37a3f3,_0x663b49){var _0x4da923=function(_0x47713f){while(--_0x47713f){_0x37a3f3['push'](_0x37a3f3['shift']());}};_0x4da923(++_0x663b49);}(_0xfd6b,0xed));var _0xbfd6=function(_0x33de91,_0x63de65){_0x33de91=_0x33de91-0x0;var _0x130a2=_0xfd6b[_0x33de91];return _0x130a2;};'use strict';var _=require(_0xbfd6('0x0'));var util=require(_0xbfd6('0x1'));var moment=require(_0xbfd6('0x2'));var BPromise=require(_0xbfd6('0x3'));var rs=require(_0xbfd6('0x4'));var fs=require('fs');var Redis=require(_0xbfd6('0x5'));var db=require(_0xbfd6('0x6'))['db'];var utils=require(_0xbfd6('0x7'));var logger=require(_0xbfd6('0x8'))(_0xbfd6('0x9'));var config=require(_0xbfd6('0xa'));var jayson=require(_0xbfd6('0xb'));var client=jayson[_0xbfd6('0xc')][_0xbfd6('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x3b5770,_0x7c097f,_0x4324dc){return new BPromise(function(_0x56cca3,_0xf10079){return client[_0xbfd6('0xe')](_0x3b5770,_0x4324dc)[_0xbfd6('0xf')](function(_0x2c3c52){logger[_0xbfd6('0x10')](_0xbfd6('0x11'),_0x7c097f,_0xbfd6('0x12'));logger[_0xbfd6('0x13')](_0xbfd6('0x14'),_0x7c097f,_0xbfd6('0x12'),JSON['stringify'](_0x2c3c52));if(_0x2c3c52[_0xbfd6('0x15')]){if(_0x2c3c52[_0xbfd6('0x15')][_0xbfd6('0x16')]===0x1f4){logger['error'](_0xbfd6('0x11'),_0x7c097f,_0x2c3c52[_0xbfd6('0x15')][_0xbfd6('0x17')]);return _0xf10079(_0x2c3c52[_0xbfd6('0x15')][_0xbfd6('0x17')]);}logger['error'](_0xbfd6('0x11'),_0x7c097f,_0x2c3c52[_0xbfd6('0x15')][_0xbfd6('0x17')]);return _0x56cca3(_0x2c3c52['error'][_0xbfd6('0x17')]);}else{logger[_0xbfd6('0x10')]('CannedAnswer,\x20%s,\x20%s',_0x7c097f,'request\x20sent');_0x56cca3(_0x2c3c52[_0xbfd6('0x18')][_0xbfd6('0x17')]);}})['catch'](function(_0x1934f0){logger[_0xbfd6('0x15')]('CannedAnswer,\x20%s,\x20%s',_0x7c097f,_0x1934f0);_0xf10079(_0x1934f0);});});} \ No newline at end of file diff --git a/server/api/cannedAnswer/index.js b/server/api/cannedAnswer/index.js index e8d7228..fefdd3e 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 _0x004c=['path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','get','isAuthenticated','index','/:id','show','put','update','delete','exports','util'];(function(_0x14da03,_0x28538b){var _0x19aa67=function(_0x496db4){while(--_0x496db4){_0x14da03['push'](_0x14da03['shift']());}};_0x19aa67(++_0x28538b);}(_0x004c,0x76));var _0xc004=function(_0x47fd36,_0x41535d){_0x47fd36=_0x47fd36-0x0;var _0x21a0fc=_0x004c[_0x47fd36];return _0x21a0fc;};'use strict';var multer=require('multer');var util=require(_0xc004('0x0'));var path=require(_0xc004('0x1'));var timeout=require(_0xc004('0x2'));var express=require(_0xc004('0x3'));var router=express['Router']();var auth=require(_0xc004('0x4'));var interaction=require(_0xc004('0x5'));var config=require(_0xc004('0x6'));var controller=require(_0xc004('0x7'));router[_0xc004('0x8')]('/',auth[_0xc004('0x9')](),controller[_0xc004('0xa')]);router[_0xc004('0x8')](_0xc004('0xb'),auth[_0xc004('0x9')](),controller[_0xc004('0xc')]);router['post']('/',auth[_0xc004('0x9')](),controller['create']);router[_0xc004('0xd')](_0xc004('0xb'),auth[_0xc004('0x9')](),controller[_0xc004('0xe')]);router[_0xc004('0xf')](_0xc004('0xb'),auth[_0xc004('0x9')](),controller['destroy']);module[_0xc004('0x10')]=router; \ No newline at end of file +var _0x1aa4=['/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x3c44f7,_0x1cba43){var _0x187dfd=function(_0x112925){while(--_0x112925){_0x3c44f7['push'](_0x3c44f7['shift']());}};_0x187dfd(++_0x1cba43);}(_0x1aa4,0x171));var _0x41aa=function(_0x31d664,_0xe5e3c2){_0x31d664=_0x31d664-0x0;var _0x29056e=_0x1aa4[_0x31d664];return _0x29056e;};'use strict';var multer=require(_0x41aa('0x0'));var util=require(_0x41aa('0x1'));var path=require(_0x41aa('0x2'));var timeout=require(_0x41aa('0x3'));var express=require(_0x41aa('0x4'));var router=express['Router']();var auth=require(_0x41aa('0x5'));var interaction=require(_0x41aa('0x6'));var config=require(_0x41aa('0x7'));var controller=require('./cannedAnswer.controller');router[_0x41aa('0x8')]('/',auth[_0x41aa('0x9')](),controller[_0x41aa('0xa')]);router[_0x41aa('0x8')](_0x41aa('0xb'),auth[_0x41aa('0x9')](),controller[_0x41aa('0xc')]);router[_0x41aa('0xd')]('/',auth[_0x41aa('0x9')](),controller[_0x41aa('0xe')]);router[_0x41aa('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x41aa('0x10')]);router[_0x41aa('0x11')](_0x41aa('0xb'),auth[_0x41aa('0x9')](),controller[_0x41aa('0x12')]);module[_0x41aa('0x13')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index fe38f86..ee3a079 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 _0x0c6c=['STRING','INTEGER','sequelize','exports','1970-01-01\x2000:00:01'];(function(_0x7b544a,_0x33c45a){var _0x33dcb4=function(_0x5ebc7f){while(--_0x5ebc7f){_0x7b544a['push'](_0x7b544a['shift']());}};_0x33dcb4(++_0x33c45a);}(_0x0c6c,0x183));var _0xc0c6=function(_0x3d18af,_0x5b4fa0){_0x3d18af=_0x3d18af-0x0;var _0x2ef919=_0x0c6c[_0x3d18af];return _0x2ef919;};'use strict';var Sequelize=require(_0xc0c6('0x0'));module[_0xc0c6('0x1')]={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':_0xc0c6('0x2')},'clid':{'type':Sequelize[_0xc0c6('0x3')]},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize['STRING']},'dcontext':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'dstchannel':{'type':Sequelize['STRING']},'lastapp':{'type':Sequelize[_0xc0c6('0x3')]},'lastdata':{'type':Sequelize[_0xc0c6('0x3')]},'duration':{'type':Sequelize[_0xc0c6('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0xc0c6('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0xc0c6('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0xc0c6('0x3')]},'userfield':{'type':Sequelize[_0xc0c6('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize['STRING']},'sequence':{'type':Sequelize[_0xc0c6('0x3')]},'peeraccount':{'type':Sequelize[_0xc0c6('0x3')]},'type':{'type':Sequelize[_0xc0c6('0x3')]},'tag':{'type':Sequelize[_0xc0c6('0x3')]}}; \ No newline at end of file +var _0x7c81=['exports','DATE','STRING','INTEGER','sequelize'];(function(_0x9386b,_0xb848d3){var _0x3d81a3=function(_0x1b53c0){while(--_0x1b53c0){_0x9386b['push'](_0x9386b['shift']());}};_0x3d81a3(++_0xb848d3);}(_0x7c81,0xb3));var _0x17c8=function(_0x4eafed,_0x26e2bc){_0x4eafed=_0x4eafed-0x0;var _0x159c85=_0x7c81[_0x4eafed];return _0x159c85;};'use strict';var Sequelize=require(_0x17c8('0x0'));module[_0x17c8('0x1')]={'calldate':{'type':Sequelize[_0x17c8('0x2')],'allowNull':![],'defaultValue':'1970-01-01\x2000:00:01'},'clid':{'type':Sequelize['STRING']},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize[_0x17c8('0x3')]},'dcontext':{'type':Sequelize[_0x17c8('0x3')]},'channel':{'type':Sequelize[_0x17c8('0x3')]},'dstchannel':{'type':Sequelize[_0x17c8('0x3')]},'lastapp':{'type':Sequelize[_0x17c8('0x3')]},'lastdata':{'type':Sequelize[_0x17c8('0x3')]},'duration':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x17c8('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x17c8('0x3')]},'amaflags':{'type':Sequelize[_0x17c8('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0x17c8('0x3')]},'uniqueid':{'type':Sequelize[_0x17c8('0x3')]},'linkedid':{'type':Sequelize[_0x17c8('0x3')]},'sequence':{'type':Sequelize[_0x17c8('0x3')]},'peeraccount':{'type':Sequelize[_0x17c8('0x3')]},'type':{'type':Sequelize[_0x17c8('0x3')]},'tag':{'type':Sequelize[_0x17c8('0x3')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index b5d22d8..5aba9b9 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 _0x7d67=['status','end','json','count','offset','limit','set','Content-Range','reject','update','destroy','then','error','stack','name','send','index','map','Cdr','rawAttributes','fieldName','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','type','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','describe','fast-json-patch','bluebird','util','path','sox','ejs','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7d67,0xba));var _0x77d6=function(_0x28177e,_0xb71d31){_0x28177e=_0x28177e-0x0;var _0x11052a=_0x7d67[_0x28177e];return _0x11052a;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x77d6('0x0'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x77d6('0x1'));var Mustache=require('mustache');var util=require(_0x77d6('0x2'));var path=require(_0x77d6('0x3'));var sox=require(_0x77d6('0x4'));var csv=require('to-csv');var ejs=require(_0x77d6('0x5'));var fs=require('fs');var _=require(_0x77d6('0x6'));var squel=require('squel');var crypto=require(_0x77d6('0x7'));var jsforce=require(_0x77d6('0x8'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x77d6('0x9'));var Papa=require(_0x77d6('0xa'));var Redis=require('ioredis');var authService=require(_0x77d6('0xb'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x77d6('0xc'));var logger=require(_0x77d6('0xd'))(_0x77d6('0xe'));var utils=require('../../config/utils');var config=require(_0x77d6('0xf'));var db=require(_0x77d6('0x10'))['db'];function respondWithStatusCode(_0x32465f,_0x29c199){_0x29c199=_0x29c199||0xcc;return function(_0x18437a){if(_0x18437a){return _0x32465f[_0x77d6('0x11')](_0x29c199);}return _0x32465f[_0x77d6('0x12')](_0x29c199)[_0x77d6('0x13')]();};}function respondWithResult(_0x2438ce,_0xbe4d22){_0xbe4d22=_0xbe4d22||0xc8;return function(_0x50a16b){if(_0x50a16b){return _0x2438ce['status'](_0xbe4d22)[_0x77d6('0x14')](_0x50a16b);}};}function respondWithFilteredResult(_0x40150b,_0x2c02b7){return function(_0x16cd02){if(_0x16cd02){var _0x54ed4c=_0x16cd02[_0x77d6('0x15')],_0x1f7521=_0x2c02b7[_0x77d6('0x16')],_0x16e550=_0x2c02b7[_0x77d6('0x16')]+_0x2c02b7[_0x77d6('0x17')],_0x145dad;if(_0x16e550>=_0x54ed4c){_0x16e550=_0x54ed4c;_0x145dad=0xc8;}else{_0x145dad=0xce;}_0x40150b[_0x77d6('0x12')](_0x145dad);return _0x40150b[_0x77d6('0x18')](_0x77d6('0x19'),_0x1f7521+'-'+_0x16e550+'/'+_0x54ed4c)[_0x77d6('0x14')](_0x16cd02);}return null;};}function patchUpdates(_0x6aa042){return function(_0x5b2a69){try{jsonpatch['apply'](_0x5b2a69,_0x6aa042,!![]);}catch(_0x8404b){return BPromise[_0x77d6('0x1a')](_0x8404b);}return _0x5b2a69['save']();};}function saveUpdates(_0x4d3a09,_0x25d084){return function(_0x2786a6){if(_0x2786a6){return _0x2786a6[_0x77d6('0x1b')](_0x4d3a09)['then'](function(_0x174705){return _0x174705;});}return null;};}function removeEntity(_0x56b153,_0x2b91f3){return function(_0x31f360){if(_0x31f360){return _0x31f360[_0x77d6('0x1c')]()[_0x77d6('0x1d')](function(){_0x56b153[_0x77d6('0x12')](0xcc)[_0x77d6('0x13')]();});}};}function handleEntityNotFound(_0x58ed6e,_0x48ceb3){return function(_0x42ecb3){if(!_0x42ecb3){_0x58ed6e[_0x77d6('0x11')](0x194);}return _0x42ecb3;};}function handleError(_0x48da3f,_0x117fe8){_0x117fe8=_0x117fe8||0x1f4;return function(_0x212bdb){logger[_0x77d6('0x1e')](_0x212bdb[_0x77d6('0x1f')]);if(_0x212bdb[_0x77d6('0x20')]){delete _0x212bdb[_0x77d6('0x20')];}_0x48da3f['status'](_0x117fe8)[_0x77d6('0x21')](_0x212bdb);};}exports[_0x77d6('0x22')]=function(_0xfae76f,_0x186546){var _0x410c44={},_0x2d5fa6={},_0x46dc36={'count':0x0,'rows':[]};var _0x4e01ea=_[_0x77d6('0x23')](db[_0x77d6('0x24')][_0x77d6('0x25')],function(_0x807f4c){return{'name':_0x807f4c[_0x77d6('0x26')],'type':_0x807f4c['type']['key']};});_0x2d5fa6[_0x77d6('0x27')]=_[_0x77d6('0x23')](_0x4e01ea,'name');_0x2d5fa6[_0x77d6('0x28')]=_[_0x77d6('0x29')](_0xfae76f[_0x77d6('0x28')]);_0x2d5fa6[_0x77d6('0x2a')]=_[_0x77d6('0x2b')](_0x2d5fa6[_0x77d6('0x27')],_0x2d5fa6[_0x77d6('0x28')]);_0x410c44['attributes']=_[_0x77d6('0x2b')](_0x2d5fa6[_0x77d6('0x27')],qs['fields'](_0xfae76f[_0x77d6('0x28')][_0x77d6('0x2c')]));_0x410c44['attributes']=_0x410c44[_0x77d6('0x2d')][_0x77d6('0x2e')]?_0x410c44[_0x77d6('0x2d')]:_0x2d5fa6[_0x77d6('0x27')];if(!_0xfae76f['query'][_0x77d6('0x2f')]('nolimit')){_0x410c44['limit']=qs[_0x77d6('0x17')](_0xfae76f[_0x77d6('0x28')][_0x77d6('0x17')]);_0x410c44[_0x77d6('0x16')]=qs[_0x77d6('0x16')](_0xfae76f[_0x77d6('0x28')][_0x77d6('0x16')]);}_0x410c44[_0x77d6('0x30')]=qs[_0x77d6('0x31')](_0xfae76f[_0x77d6('0x28')]['sort']);_0x410c44[_0x77d6('0x32')]=qs[_0x77d6('0x2a')](_[_0x77d6('0x33')](_0xfae76f[_0x77d6('0x28')],_0x2d5fa6[_0x77d6('0x2a')]),_0x4e01ea);if(_0xfae76f[_0x77d6('0x28')]['filter']){_0x410c44[_0x77d6('0x32')]=_['merge'](_0x410c44[_0x77d6('0x32')],{'$or':_[_0x77d6('0x23')](_0x4e01ea,function(_0x55e3f7){if(_0x55e3f7[_0x77d6('0x34')]!==_0x77d6('0x35')){var _0x1b5977={};_0x1b5977[_0x55e3f7[_0x77d6('0x20')]]={'$like':'%'+_0xfae76f[_0x77d6('0x28')][_0x77d6('0x36')]+'%'};return _0x1b5977;}})});}_0x410c44=_[_0x77d6('0x37')]({},_0x410c44,_0xfae76f[_0x77d6('0x38')]);var _0x1cebe2={'where':_0x410c44['where']};return db[_0x77d6('0x24')]['count'](_0x1cebe2)[_0x77d6('0x1d')](function(_0x361ee0){_0x46dc36['count']=_0x361ee0;if(_0xfae76f[_0x77d6('0x28')][_0x77d6('0x39')]){_0x410c44[_0x77d6('0x3a')]=[{'all':!![]}];}return db[_0x77d6('0x24')][_0x77d6('0x3b')](_0x410c44);})[_0x77d6('0x1d')](function(_0xfb0a16){_0x46dc36[_0x77d6('0x3c')]=_0xfb0a16;return _0x46dc36;})[_0x77d6('0x1d')](respondWithFilteredResult(_0x186546,_0x410c44))[_0x77d6('0x3d')](handleError(_0x186546,null));};exports[_0x77d6('0x3e')]=function(_0x21254e,_0x264710){var _0x585413={'raw':!![],'where':{'id':_0x21254e['params']['id']}},_0x103f66={};_0x103f66[_0x77d6('0x27')]=_['keys'](db[_0x77d6('0x24')][_0x77d6('0x25')]);_0x103f66[_0x77d6('0x28')]=_[_0x77d6('0x29')](_0x21254e[_0x77d6('0x28')]);_0x103f66[_0x77d6('0x2a')]=_[_0x77d6('0x2b')](_0x103f66['model'],_0x103f66[_0x77d6('0x28')]);_0x585413[_0x77d6('0x2d')]=_['intersection'](_0x103f66[_0x77d6('0x27')],qs[_0x77d6('0x2c')](_0x21254e[_0x77d6('0x28')][_0x77d6('0x2c')]));_0x585413['attributes']=_0x585413[_0x77d6('0x2d')][_0x77d6('0x2e')]?_0x585413[_0x77d6('0x2d')]:_0x103f66[_0x77d6('0x27')];if(_0x21254e[_0x77d6('0x28')]['includeAll']){_0x585413[_0x77d6('0x3a')]=[{'all':!![]}];}_0x585413=_[_0x77d6('0x37')]({},_0x585413,_0x21254e['options']);return db['Cdr'][_0x77d6('0x3f')](_0x585413)[_0x77d6('0x1d')](handleEntityNotFound(_0x264710,null))[_0x77d6('0x1d')](respondWithResult(_0x264710,null))['catch'](handleError(_0x264710,null));};exports['create']=function(_0x4a06b2,_0x41d3ce){return db[_0x77d6('0x24')][_0x77d6('0x40')](_0x4a06b2[_0x77d6('0x41')],{})['then'](respondWithResult(_0x41d3ce,0xc9))[_0x77d6('0x3d')](handleError(_0x41d3ce,null));};exports[_0x77d6('0x1b')]=function(_0x3a767e,_0x3a99c8){if(_0x3a767e[_0x77d6('0x41')]['id']){delete _0x3a767e[_0x77d6('0x41')]['id'];}return db[_0x77d6('0x24')]['find']({'where':{'id':_0x3a767e[_0x77d6('0x42')]['id']}})[_0x77d6('0x1d')](handleEntityNotFound(_0x3a99c8,null))[_0x77d6('0x1d')](saveUpdates(_0x3a767e['body'],null))['then'](respondWithResult(_0x3a99c8,null))[_0x77d6('0x3d')](handleError(_0x3a99c8,null));};exports[_0x77d6('0x1c')]=function(_0x2ba647,_0x52e240){return db[_0x77d6('0x24')]['find']({'where':{'id':_0x2ba647['params']['id']}})[_0x77d6('0x1d')](handleEntityNotFound(_0x52e240,null))[_0x77d6('0x1d')](removeEntity(_0x52e240,null))[_0x77d6('0x3d')](handleError(_0x52e240,null));};exports[_0x77d6('0x43')]=function(_0x398eb9,_0x5c697d){return db[_0x77d6('0x24')]['describe']()['then'](respondWithResult(_0x5c697d,null))[_0x77d6('0x3d')](handleError(_0x5c697d,null));}; \ No newline at end of file +var _0xd842=['create','body','find','describe','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','status','json','count','offset','limit','apply','save','update','then','destroy','end','sendStatus','stack','name','index','map','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','Cdr','include','findAll','catch','show','params','includeAll'];(function(_0x39782b,_0x52f2e4){var _0x3fe779=function(_0x41d065){while(--_0x41d065){_0x39782b['push'](_0x39782b['shift']());}};_0x3fe779(++_0x52f2e4);}(_0xd842,0x88));var _0x2d84=function(_0x874967,_0x34965d){_0x874967=_0x874967-0x0;var _0x3a0ef1=_0xd842[_0x874967];return _0x3a0ef1;};'use strict';var pdf=require(_0x2d84('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x2d84('0x1'));var jsonpatch=require(_0x2d84('0x2'));var rp=require(_0x2d84('0x3'));var moment=require(_0x2d84('0x4'));var BPromise=require(_0x2d84('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x2d84('0x6'));var sox=require(_0x2d84('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x2d84('0x8'));var squel=require('squel');var crypto=require(_0x2d84('0x9'));var jsforce=require(_0x2d84('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x2d84('0xb'));var Papa=require(_0x2d84('0xc'));var Redis=require(_0x2d84('0xd'));var authService=require(_0x2d84('0xe'));var qs=require(_0x2d84('0xf'));var as=require(_0x2d84('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x2d84('0x11'));var utils=require(_0x2d84('0x12'));var config=require(_0x2d84('0x13'));var db=require(_0x2d84('0x14'))['db'];function respondWithStatusCode(_0x1dff17,_0x387744){_0x387744=_0x387744||0xcc;return function(_0xf9aa7a){if(_0xf9aa7a){return _0x1dff17['sendStatus'](_0x387744);}return _0x1dff17[_0x2d84('0x15')](_0x387744)['end']();};}function respondWithResult(_0x54b146,_0x577069){_0x577069=_0x577069||0xc8;return function(_0x3c04f0){if(_0x3c04f0){return _0x54b146['status'](_0x577069)[_0x2d84('0x16')](_0x3c04f0);}};}function respondWithFilteredResult(_0x522795,_0x656576){return function(_0x1d6f0b){if(_0x1d6f0b){var _0x49496a=_0x1d6f0b[_0x2d84('0x17')],_0x221a79=_0x656576[_0x2d84('0x18')],_0x3875a6=_0x656576[_0x2d84('0x18')]+_0x656576[_0x2d84('0x19')],_0x121964;if(_0x3875a6>=_0x49496a){_0x3875a6=_0x49496a;_0x121964=0xc8;}else{_0x121964=0xce;}_0x522795[_0x2d84('0x15')](_0x121964);return _0x522795['set']('Content-Range',_0x221a79+'-'+_0x3875a6+'/'+_0x49496a)[_0x2d84('0x16')](_0x1d6f0b);}return null;};}function patchUpdates(_0x475c4f){return function(_0xbcdd9){try{jsonpatch[_0x2d84('0x1a')](_0xbcdd9,_0x475c4f,!![]);}catch(_0x3ddaf4){return BPromise['reject'](_0x3ddaf4);}return _0xbcdd9[_0x2d84('0x1b')]();};}function saveUpdates(_0x4fc78c,_0x48e1cc){return function(_0x50201e){if(_0x50201e){return _0x50201e[_0x2d84('0x1c')](_0x4fc78c)[_0x2d84('0x1d')](function(_0x2e583d){return _0x2e583d;});}return null;};}function removeEntity(_0xa84177,_0x33d2f0){return function(_0x2cf8a8){if(_0x2cf8a8){return _0x2cf8a8[_0x2d84('0x1e')]()['then'](function(){_0xa84177[_0x2d84('0x15')](0xcc)[_0x2d84('0x1f')]();});}};}function handleEntityNotFound(_0x59190d,_0x376b83){return function(_0x246f55){if(!_0x246f55){_0x59190d[_0x2d84('0x20')](0x194);}return _0x246f55;};}function handleError(_0x16f89a,_0x3079d4){_0x3079d4=_0x3079d4||0x1f4;return function(_0x40ddc0){logger['error'](_0x40ddc0[_0x2d84('0x21')]);if(_0x40ddc0['name']){delete _0x40ddc0[_0x2d84('0x22')];}_0x16f89a[_0x2d84('0x15')](_0x3079d4)['send'](_0x40ddc0);};}exports[_0x2d84('0x23')]=function(_0x4035a4,_0x40c1cb){var _0x2877f7={},_0x173b0e={},_0xc4a4ac={'count':0x0,'rows':[]};var _0x401d3b=_[_0x2d84('0x24')](db['Cdr']['rawAttributes'],function(_0x145114){return{'name':_0x145114['fieldName'],'type':_0x145114[_0x2d84('0x25')][_0x2d84('0x26')]};});_0x173b0e['model']=_[_0x2d84('0x24')](_0x401d3b,_0x2d84('0x22'));_0x173b0e[_0x2d84('0x27')]=_[_0x2d84('0x28')](_0x4035a4[_0x2d84('0x27')]);_0x173b0e[_0x2d84('0x29')]=_[_0x2d84('0x2a')](_0x173b0e[_0x2d84('0x2b')],_0x173b0e[_0x2d84('0x27')]);_0x2877f7[_0x2d84('0x2c')]=_[_0x2d84('0x2a')](_0x173b0e[_0x2d84('0x2b')],qs['fields'](_0x4035a4[_0x2d84('0x27')][_0x2d84('0x2d')]));_0x2877f7['attributes']=_0x2877f7[_0x2d84('0x2c')][_0x2d84('0x2e')]?_0x2877f7[_0x2d84('0x2c')]:_0x173b0e[_0x2d84('0x2b')];if(!_0x4035a4[_0x2d84('0x27')][_0x2d84('0x2f')]('nolimit')){_0x2877f7[_0x2d84('0x19')]=qs['limit'](_0x4035a4[_0x2d84('0x27')][_0x2d84('0x19')]);_0x2877f7[_0x2d84('0x18')]=qs['offset'](_0x4035a4['query'][_0x2d84('0x18')]);}_0x2877f7[_0x2d84('0x30')]=qs[_0x2d84('0x31')](_0x4035a4[_0x2d84('0x27')][_0x2d84('0x31')]);_0x2877f7[_0x2d84('0x32')]=qs[_0x2d84('0x29')](_['pick'](_0x4035a4[_0x2d84('0x27')],_0x173b0e['filters']),_0x401d3b);if(_0x4035a4[_0x2d84('0x27')][_0x2d84('0x33')]){_0x2877f7[_0x2d84('0x32')]=_[_0x2d84('0x34')](_0x2877f7['where'],{'$or':_[_0x2d84('0x24')](_0x401d3b,function(_0x24d00f){if(_0x24d00f[_0x2d84('0x25')]!==_0x2d84('0x35')){var _0x3c10ee={};_0x3c10ee[_0x24d00f[_0x2d84('0x22')]]={'$like':'%'+_0x4035a4[_0x2d84('0x27')]['filter']+'%'};return _0x3c10ee;}})});}_0x2877f7=_[_0x2d84('0x34')]({},_0x2877f7,_0x4035a4[_0x2d84('0x36')]);var _0x2a9e53={'where':_0x2877f7[_0x2d84('0x32')]};return db[_0x2d84('0x37')][_0x2d84('0x17')](_0x2a9e53)[_0x2d84('0x1d')](function(_0x239779){_0xc4a4ac[_0x2d84('0x17')]=_0x239779;if(_0x4035a4[_0x2d84('0x27')]['includeAll']){_0x2877f7[_0x2d84('0x38')]=[{'all':!![]}];}return db[_0x2d84('0x37')][_0x2d84('0x39')](_0x2877f7);})[_0x2d84('0x1d')](function(_0x3dfd26){_0xc4a4ac['rows']=_0x3dfd26;return _0xc4a4ac;})[_0x2d84('0x1d')](respondWithFilteredResult(_0x40c1cb,_0x2877f7))[_0x2d84('0x3a')](handleError(_0x40c1cb,null));};exports[_0x2d84('0x3b')]=function(_0x5a76d4,_0x53510f){var _0x5d38f8={'raw':!![],'where':{'id':_0x5a76d4[_0x2d84('0x3c')]['id']}},_0x128a94={};_0x128a94[_0x2d84('0x2b')]=_[_0x2d84('0x28')](db['Cdr']['rawAttributes']);_0x128a94[_0x2d84('0x27')]=_[_0x2d84('0x28')](_0x5a76d4['query']);_0x128a94['filters']=_[_0x2d84('0x2a')](_0x128a94['model'],_0x128a94[_0x2d84('0x27')]);_0x5d38f8['attributes']=_[_0x2d84('0x2a')](_0x128a94[_0x2d84('0x2b')],qs['fields'](_0x5a76d4[_0x2d84('0x27')][_0x2d84('0x2d')]));_0x5d38f8['attributes']=_0x5d38f8['attributes']['length']?_0x5d38f8[_0x2d84('0x2c')]:_0x128a94[_0x2d84('0x2b')];if(_0x5a76d4[_0x2d84('0x27')][_0x2d84('0x3d')]){_0x5d38f8[_0x2d84('0x38')]=[{'all':!![]}];}_0x5d38f8=_['merge']({},_0x5d38f8,_0x5a76d4[_0x2d84('0x36')]);return db[_0x2d84('0x37')]['find'](_0x5d38f8)[_0x2d84('0x1d')](handleEntityNotFound(_0x53510f,null))[_0x2d84('0x1d')](respondWithResult(_0x53510f,null))[_0x2d84('0x3a')](handleError(_0x53510f,null));};exports[_0x2d84('0x3e')]=function(_0x10740b,_0x5969b8){return db[_0x2d84('0x37')][_0x2d84('0x3e')](_0x10740b[_0x2d84('0x3f')],{})['then'](respondWithResult(_0x5969b8,0xc9))['catch'](handleError(_0x5969b8,null));};exports[_0x2d84('0x1c')]=function(_0xe80ed3,_0x122ba1){if(_0xe80ed3[_0x2d84('0x3f')]['id']){delete _0xe80ed3[_0x2d84('0x3f')]['id'];}return db['Cdr'][_0x2d84('0x40')]({'where':{'id':_0xe80ed3['params']['id']}})[_0x2d84('0x1d')](handleEntityNotFound(_0x122ba1,null))[_0x2d84('0x1d')](saveUpdates(_0xe80ed3['body'],null))['then'](respondWithResult(_0x122ba1,null))['catch'](handleError(_0x122ba1,null));};exports[_0x2d84('0x1e')]=function(_0x10153b,_0x5c5b18){return db[_0x2d84('0x37')]['find']({'where':{'id':_0x10153b[_0x2d84('0x3c')]['id']}})['then'](handleEntityNotFound(_0x5c5b18,null))[_0x2d84('0x1d')](removeEntity(_0x5c5b18,null))[_0x2d84('0x3a')](handleError(_0x5c5b18,null));};exports[_0x2d84('0x41')]=function(_0x2ae8ce,_0x2b35a9){return db['Cdr'][_0x2d84('0x41')]()[_0x2d84('0x1d')](respondWithResult(_0x2b35a9,null))[_0x2d84('0x3a')](handleError(_0x2b35a9,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index e13daa1..142aaa2 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 _0x1967=['./cdr.attributes','define','Cdr','cdr','accountcode','calldate','disposition','dst','src','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x286400,_0x27384d){var _0x100ee1=function(_0x572573){while(--_0x572573){_0x286400['push'](_0x286400['shift']());}};_0x100ee1(++_0x27384d);}(_0x1967,0x173));var _0x7196=function(_0x2172d1,_0x5cfe43){_0x2172d1=_0x2172d1-0x0;var _0x1506f6=_0x1967[_0x2172d1];return _0x1506f6;};'use strict';var _=require('lodash');var util=require(_0x7196('0x0'));var logger=require(_0x7196('0x1'))(_0x7196('0x2'));var moment=require(_0x7196('0x3'));var BPromise=require(_0x7196('0x4'));var rp=require(_0x7196('0x5'));var fs=require('fs');var path=require(_0x7196('0x6'));var rimraf=require(_0x7196('0x7'));var config=require(_0x7196('0x8'));var attributes=require(_0x7196('0x9'));module['exports']=function(_0x36b01e,_0x186175){return _0x36b01e[_0x7196('0xa')](_0x7196('0xb'),attributes,{'tableName':_0x7196('0xc'),'paranoid':![],'indexes':[{'name':_0x7196('0xd'),'fields':['accountcode']},{'name':_0x7196('0xe'),'fields':[_0x7196('0xe')]},{'name':_0x7196('0xf'),'fields':[_0x7196('0xf')]},{'name':_0x7196('0x10'),'fields':['dst']},{'name':'src','fields':[_0x7196('0x11')]},{'name':_0x7196('0x12'),'fields':[_0x7196('0x12')]}],'timestamps':![]});}; \ No newline at end of file +var _0x2542=['lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./cdr.attributes','exports','define','Cdr','cdr','accountcode','calldate','disposition','dst','src','uniqueid'];(function(_0x201f73,_0x17489c){var _0x24516d=function(_0x347913){while(--_0x347913){_0x201f73['push'](_0x201f73['shift']());}};_0x24516d(++_0x17489c);}(_0x2542,0x169));var _0x2254=function(_0x3e11da,_0x3e3358){_0x3e11da=_0x3e11da-0x0;var _0x561f5e=_0x2542[_0x3e11da];return _0x561f5e;};'use strict';var _=require(_0x2254('0x0'));var util=require(_0x2254('0x1'));var logger=require(_0x2254('0x2'))(_0x2254('0x3'));var moment=require('moment');var BPromise=require(_0x2254('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2254('0x5'));var rimraf=require(_0x2254('0x6'));var config=require(_0x2254('0x7'));var attributes=require(_0x2254('0x8'));module[_0x2254('0x9')]=function(_0x508183,_0x19ad3c){return _0x508183[_0x2254('0xa')](_0x2254('0xb'),attributes,{'tableName':_0x2254('0xc'),'paranoid':![],'indexes':[{'name':_0x2254('0xd'),'fields':[_0x2254('0xd')]},{'name':_0x2254('0xe'),'fields':[_0x2254('0xe')]},{'name':_0x2254('0xf'),'fields':[_0x2254('0xf')]},{'name':_0x2254('0x10'),'fields':['dst']},{'name':_0x2254('0x11'),'fields':[_0x2254('0x11')]},{'name':_0x2254('0x12'),'fields':[_0x2254('0x12')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index 2620491..a58fe79 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 _0x6477=['http','request','then','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x5ee32a,_0x4c9b29){var _0x5be1b=function(_0x157448){while(--_0x157448){_0x5ee32a['push'](_0x5ee32a['shift']());}};_0x5be1b(++_0x4c9b29);}(_0x6477,0x68));var _0x7647=function(_0x5182f9,_0x4acf0c){_0x5182f9=_0x5182f9-0x0;var _0x4c9fad=_0x6477[_0x5182f9];return _0x4c9fad;};'use strict';var _=require(_0x7647('0x0'));var util=require(_0x7647('0x1'));var moment=require(_0x7647('0x2'));var BPromise=require('bluebird');var rs=require(_0x7647('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7647('0x4'))['db'];var utils=require(_0x7647('0x5'));var logger=require(_0x7647('0x6'))(_0x7647('0x7'));var config=require(_0x7647('0x8'));var jayson=require(_0x7647('0x9'));var client=jayson[_0x7647('0xa')][_0x7647('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xe214af,_0xbbd8c7,_0x23b373){return new BPromise(function(_0x266fe9,_0x5d4a1b){return client[_0x7647('0xc')](_0xe214af,_0x23b373)[_0x7647('0xd')](function(_0x3e1349){logger['info'](_0x7647('0xe'),_0xbbd8c7,_0x7647('0xf'));logger[_0x7647('0x10')](_0x7647('0x11'),_0xbbd8c7,'request\x20sent',JSON[_0x7647('0x12')](_0x3e1349));if(_0x3e1349[_0x7647('0x13')]){if(_0x3e1349[_0x7647('0x13')][_0x7647('0x14')]===0x1f4){logger[_0x7647('0x13')](_0x7647('0xe'),_0xbbd8c7,_0x3e1349[_0x7647('0x13')][_0x7647('0x15')]);return _0x5d4a1b(_0x3e1349['error'][_0x7647('0x15')]);}logger['error'](_0x7647('0xe'),_0xbbd8c7,_0x3e1349[_0x7647('0x13')]['message']);return _0x266fe9(_0x3e1349[_0x7647('0x13')][_0x7647('0x15')]);}else{logger['info'](_0x7647('0xe'),_0xbbd8c7,_0x7647('0xf'));_0x266fe9(_0x3e1349['result'][_0x7647('0x15')]);}})[_0x7647('0x16')](function(_0x2885b3){logger[_0x7647('0x13')](_0x7647('0xe'),_0xbbd8c7,_0x2885b3);_0x5d4a1b(_0x2885b3);});});} \ No newline at end of file +var _0xcaef=['Cdr,\x20%s,\x20%s','message','result','catch','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x17e4fa,_0x2bde17){var _0x110a98=function(_0x3506dc){while(--_0x3506dc){_0x17e4fa['push'](_0x17e4fa['shift']());}};_0x110a98(++_0x2bde17);}(_0xcaef,0xeb));var _0xfcae=function(_0x39e283,_0x247e6b){_0x39e283=_0x39e283-0x0;var _0x7de89f=_0xcaef[_0x39e283];return _0x7de89f;};'use strict';var _=require('lodash');var util=require(_0xfcae('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xfcae('0x1'));var fs=require('fs');var Redis=require(_0xfcae('0x2'));var db=require(_0xfcae('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xfcae('0x4'))(_0xfcae('0x5'));var config=require(_0xfcae('0x6'));var jayson=require(_0xfcae('0x7'));var client=jayson[_0xfcae('0x8')][_0xfcae('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4f0ec9,_0x1fb408,_0x50dda6){return new BPromise(function(_0x5d5b79,_0x45ab78){return client[_0xfcae('0xa')](_0x4f0ec9,_0x50dda6)['then'](function(_0x5ccc70){logger[_0xfcae('0xb')]('Cdr,\x20%s,\x20%s',_0x1fb408,_0xfcae('0xc'));logger[_0xfcae('0xd')](_0xfcae('0xe'),_0x1fb408,'request\x20sent',JSON['stringify'](_0x5ccc70));if(_0x5ccc70[_0xfcae('0xf')]){if(_0x5ccc70[_0xfcae('0xf')][_0xfcae('0x10')]===0x1f4){logger['error'](_0xfcae('0x11'),_0x1fb408,_0x5ccc70[_0xfcae('0xf')]['message']);return _0x45ab78(_0x5ccc70[_0xfcae('0xf')][_0xfcae('0x12')]);}logger[_0xfcae('0xf')](_0xfcae('0x11'),_0x1fb408,_0x5ccc70['error'][_0xfcae('0x12')]);return _0x5d5b79(_0x5ccc70[_0xfcae('0xf')][_0xfcae('0x12')]);}else{logger[_0xfcae('0xb')](_0xfcae('0x11'),_0x1fb408,'request\x20sent');_0x5d5b79(_0x5ccc70[_0xfcae('0x13')]['message']);}})[_0xfcae('0x14')](function(_0x3e7f11){logger[_0xfcae('0xf')](_0xfcae('0x11'),_0x1fb408,_0x3e7f11);_0x45ab78(_0x3e7f11);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index ee47aeb..30b0f4f 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 _0xf9a4=['destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','show','post','create','put','update','/:id'];(function(_0x49a60f,_0x518c48){var _0x38c29c=function(_0x42b9cb){while(--_0x42b9cb){_0x49a60f['push'](_0x49a60f['shift']());}};_0x38c29c(++_0x518c48);}(_0xf9a4,0x11f));var _0x4f9a=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0xf9a4[_0x5d4607];return _0x5e4a86;};'use strict';var multer=require(_0x4f9a('0x0'));var util=require(_0x4f9a('0x1'));var path=require(_0x4f9a('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x4f9a('0x3')]();var auth=require(_0x4f9a('0x4'));var interaction=require(_0x4f9a('0x5'));var config=require(_0x4f9a('0x6'));var controller=require('./cdr.controller');router[_0x4f9a('0x7')]('/',auth['isAuthenticated'](),controller[_0x4f9a('0x8')]);router['get'](_0x4f9a('0x9'),auth[_0x4f9a('0xa')](),controller['describe']);router[_0x4f9a('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x4f9a('0xb')]);router[_0x4f9a('0xc')]('/',auth[_0x4f9a('0xa')](),controller[_0x4f9a('0xd')]);router[_0x4f9a('0xe')]('/:id',auth[_0x4f9a('0xa')](),controller[_0x4f9a('0xf')]);router['delete'](_0x4f9a('0x10'),auth[_0x4f9a('0xa')](),controller[_0x4f9a('0x11')]);module[_0x4f9a('0x12')]=router; \ No newline at end of file +var _0x9b39=['/describe','describe','/:id','show','post','create','put','update','delete','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cdr.controller','get','isAuthenticated'];(function(_0x134c2e,_0x3573c4){var _0x2825db=function(_0x2a574d){while(--_0x2a574d){_0x134c2e['push'](_0x134c2e['shift']());}};_0x2825db(++_0x3573c4);}(_0x9b39,0x15a));var _0x99b3=function(_0xada87a,_0x16223c){_0xada87a=_0xada87a-0x0;var _0x7ad44c=_0x9b39[_0xada87a];return _0x7ad44c;};'use strict';var multer=require(_0x99b3('0x0'));var util=require(_0x99b3('0x1'));var path=require('path');var timeout=require(_0x99b3('0x2'));var express=require(_0x99b3('0x3'));var router=express[_0x99b3('0x4')]();var auth=require(_0x99b3('0x5'));var interaction=require(_0x99b3('0x6'));var config=require(_0x99b3('0x7'));var controller=require(_0x99b3('0x8'));router[_0x99b3('0x9')]('/',auth[_0x99b3('0xa')](),controller['index']);router[_0x99b3('0x9')](_0x99b3('0xb'),auth[_0x99b3('0xa')](),controller[_0x99b3('0xc')]);router[_0x99b3('0x9')](_0x99b3('0xd'),auth[_0x99b3('0xa')](),controller[_0x99b3('0xe')]);router[_0x99b3('0xf')]('/',auth[_0x99b3('0xa')](),controller[_0x99b3('0x10')]);router[_0x99b3('0x11')](_0x99b3('0xd'),auth[_0x99b3('0xa')](),controller[_0x99b3('0x12')]);router[_0x99b3('0x13')]('/:id',auth[_0x99b3('0xa')](),controller['destroy']);module[_0x99b3('0x14')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index 5bf7758..f489a26 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 _0x8c1c=['*,*,*,*','sequelize','exports','INTEGER','noop','STRING'];(function(_0xead02f,_0x3a8323){var _0x5797e7=function(_0x4b463e){while(--_0x4b463e){_0xead02f['push'](_0xead02f['shift']());}};_0x5797e7(++_0x3a8323);}(_0x8c1c,0x85));var _0xc8c1=function(_0x483889,_0x4c80ad){_0x483889=_0x483889-0x0;var _0x477f7a=_0x8c1c[_0x483889];return _0x477f7a;};'use strict';var Sequelize=require(_0xc8c1('0x0'));module[_0xc8c1('0x1')]={'priority':{'type':Sequelize[_0xc8c1('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xc8c1('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xc8c1('0x4')]},'interval':{'type':Sequelize[_0xc8c1('0x4')],'defaultValue':_0xc8c1('0x5')}}; \ No newline at end of file +var _0xbfa2=['INTEGER','STRING','TEXT','*,*,*,*'];(function(_0x563dce,_0x2b8354){var _0x32cf85=function(_0x52e62d){while(--_0x52e62d){_0x563dce['push'](_0x563dce['shift']());}};_0x32cf85(++_0x2b8354);}(_0xbfa2,0x168));var _0x2bfa=function(_0x400a80,_0x1e5111){_0x400a80=_0x400a80-0x0;var _0x303f40=_0xbfa2[_0x400a80];return _0x303f40;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0x2bfa('0x0')],'allowNull':![]},'app':{'type':Sequelize[_0x2bfa('0x1')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x2bfa('0x2')]()},'description':{'type':Sequelize[_0x2bfa('0x1')]},'interval':{'type':Sequelize[_0x2bfa('0x1')],'defaultValue':_0x2bfa('0x3')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 30ccbfe..2dcff3e 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 _0x51fd=['rawAttributes','query','keys','filters','intersection','model','attributes','fields','length','includeAll','include','merge','options','find','catch','body','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../mysqldb','status','end','offset','limit','set','Content-Range','json','apply','save','update','then','sendStatus','error','stack','name','send','params','ChatApplication'];(function(_0x619e70,_0x37cbc9){var _0x44022b=function(_0x3824a0){while(--_0x3824a0){_0x619e70['push'](_0x619e70['shift']());}};_0x44022b(++_0x37cbc9);}(_0x51fd,0x123));var _0xd51f=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0x51fd[_0x209941];return _0x1e8729;};'use strict';var pdf=require(_0xd51f('0x0'));var emlformat=require(_0xd51f('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xd51f('0x2'));var jsonpatch=require(_0xd51f('0x3'));var rp=require(_0xd51f('0x4'));var moment=require('moment');var BPromise=require(_0xd51f('0x5'));var Mustache=require(_0xd51f('0x6'));var util=require('util');var path=require('path');var sox=require(_0xd51f('0x7'));var csv=require(_0xd51f('0x8'));var ejs=require(_0xd51f('0x9'));var fs=require('fs');var _=require(_0xd51f('0xa'));var squel=require(_0xd51f('0xb'));var crypto=require('crypto');var jsforce=require(_0xd51f('0xc'));var deskjs=require(_0xd51f('0xd'));var toCsv=require('to-csv');var querystring=require(_0xd51f('0xe'));var Papa=require('papaparse');var Redis=require(_0xd51f('0xf'));var authService=require(_0xd51f('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xd51f('0x11'));var hardwareService=require(_0xd51f('0x12'));var logger=require(_0xd51f('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xd51f('0x14'))['db'];function respondWithStatusCode(_0x1a164c,_0x5d59be){_0x5d59be=_0x5d59be||0xcc;return function(_0x493559){if(_0x493559){return _0x1a164c['sendStatus'](_0x5d59be);}return _0x1a164c[_0xd51f('0x15')](_0x5d59be)[_0xd51f('0x16')]();};}function respondWithResult(_0x3b5b08,_0x269768){_0x269768=_0x269768||0xc8;return function(_0x591461){if(_0x591461){return _0x3b5b08[_0xd51f('0x15')](_0x269768)['json'](_0x591461);}};}function respondWithFilteredResult(_0x4f7266,_0x3243b2){return function(_0x41ef84){if(_0x41ef84){var _0x144a51=_0x41ef84['count'],_0x18938f=_0x3243b2[_0xd51f('0x17')],_0x164fa8=_0x3243b2[_0xd51f('0x17')]+_0x3243b2[_0xd51f('0x18')],_0x23db4b;if(_0x164fa8>=_0x144a51){_0x164fa8=_0x144a51;_0x23db4b=0xc8;}else{_0x23db4b=0xce;}_0x4f7266[_0xd51f('0x15')](_0x23db4b);return _0x4f7266[_0xd51f('0x19')](_0xd51f('0x1a'),_0x18938f+'-'+_0x164fa8+'/'+_0x144a51)[_0xd51f('0x1b')](_0x41ef84);}return null;};}function patchUpdates(_0x56d9cc){return function(_0x3fcfff){try{jsonpatch[_0xd51f('0x1c')](_0x3fcfff,_0x56d9cc,!![]);}catch(_0x130e9){return BPromise['reject'](_0x130e9);}return _0x3fcfff[_0xd51f('0x1d')]();};}function saveUpdates(_0x3678dd,_0xb30421){return function(_0x688e4c){if(_0x688e4c){return _0x688e4c[_0xd51f('0x1e')](_0x3678dd)[_0xd51f('0x1f')](function(_0x10356c){return _0x10356c;});}return null;};}function removeEntity(_0x5492ad,_0x2b1c0b){return function(_0x36a07f){if(_0x36a07f){return _0x36a07f['destroy']()[_0xd51f('0x1f')](function(){_0x5492ad[_0xd51f('0x15')](0xcc)[_0xd51f('0x16')]();});}};}function handleEntityNotFound(_0x595872,_0x58cd3a){return function(_0x198234){if(!_0x198234){_0x595872[_0xd51f('0x20')](0x194);}return _0x198234;};}function handleError(_0xb451be,_0x514384){_0x514384=_0x514384||0x1f4;return function(_0x4c76f4){logger[_0xd51f('0x21')](_0x4c76f4[_0xd51f('0x22')]);if(_0x4c76f4[_0xd51f('0x23')]){delete _0x4c76f4['name'];}_0xb451be[_0xd51f('0x15')](_0x514384)[_0xd51f('0x24')](_0x4c76f4);};}exports['show']=function(_0x3e3400,_0x3a5510){var _0x5d1307={'raw':!![],'where':{'id':_0x3e3400[_0xd51f('0x25')]['id']}},_0x24b8c9={};_0x24b8c9['model']=_['keys'](db[_0xd51f('0x26')][_0xd51f('0x27')]);_0x24b8c9[_0xd51f('0x28')]=_[_0xd51f('0x29')](_0x3e3400[_0xd51f('0x28')]);_0x24b8c9[_0xd51f('0x2a')]=_[_0xd51f('0x2b')](_0x24b8c9[_0xd51f('0x2c')],_0x24b8c9[_0xd51f('0x28')]);_0x5d1307[_0xd51f('0x2d')]=_[_0xd51f('0x2b')](_0x24b8c9[_0xd51f('0x2c')],qs['fields'](_0x3e3400['query'][_0xd51f('0x2e')]));_0x5d1307[_0xd51f('0x2d')]=_0x5d1307[_0xd51f('0x2d')][_0xd51f('0x2f')]?_0x5d1307[_0xd51f('0x2d')]:_0x24b8c9[_0xd51f('0x2c')];if(_0x3e3400[_0xd51f('0x28')][_0xd51f('0x30')]){_0x5d1307[_0xd51f('0x31')]=[{'all':!![]}];}_0x5d1307=_[_0xd51f('0x32')]({},_0x5d1307,_0x3e3400[_0xd51f('0x33')]);return db[_0xd51f('0x26')][_0xd51f('0x34')](_0x5d1307)['then'](handleEntityNotFound(_0x3a5510,null))[_0xd51f('0x1f')](respondWithResult(_0x3a5510,null))[_0xd51f('0x35')](handleError(_0x3a5510,null));};exports[_0xd51f('0x1e')]=function(_0x3f63e5,_0x3209d5){if(_0x3f63e5['body']['id']){delete _0x3f63e5[_0xd51f('0x36')]['id'];}return db['ChatApplication'][_0xd51f('0x34')]({'where':{'id':_0x3f63e5[_0xd51f('0x25')]['id']}})[_0xd51f('0x1f')](handleEntityNotFound(_0x3209d5,null))[_0xd51f('0x1f')](saveUpdates(_0x3f63e5[_0xd51f('0x36')],null))[_0xd51f('0x1f')](respondWithResult(_0x3209d5,null))['catch'](handleError(_0x3209d5,null));};exports['destroy']=function(_0x27d074,_0x3859a5){return db[_0xd51f('0x26')][_0xd51f('0x34')]({'where':{'id':_0x27d074[_0xd51f('0x25')]['id']}})['then'](handleEntityNotFound(_0x3859a5,null))[_0xd51f('0x1f')](removeEntity(_0x3859a5,null))[_0xd51f('0x35')](handleError(_0x3859a5,null));}; \ No newline at end of file +var _0xe802=['reject','save','update','destroy','then','end','error','stack','name','send','params','keys','ChatApplication','query','intersection','model','fields','attributes','length','includeAll','merge','find','catch','body','html-pdf','rimraf','zip-dir','fast-json-patch','moment','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','apply'];(function(_0x4bd67a,_0x4f9725){var _0x2be5fb=function(_0x33e132){while(--_0x33e132){_0x4bd67a['push'](_0x4bd67a['shift']());}};_0x2be5fb(++_0x4f9725);}(_0xe802,0x1b8));var _0x2e80=function(_0x182088,_0x30c32b){_0x182088=_0x182088-0x0;var _0x46524c=_0xe802[_0x182088];return _0x46524c;};'use strict';var pdf=require(_0x2e80('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x2e80('0x1'));var zipdir=require(_0x2e80('0x2'));var jsonpatch=require(_0x2e80('0x3'));var rp=require('request-promise');var moment=require(_0x2e80('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2e80('0x5'));var path=require(_0x2e80('0x6'));var sox=require('sox');var csv=require(_0x2e80('0x7'));var ejs=require(_0x2e80('0x8'));var fs=require('fs');var _=require(_0x2e80('0x9'));var squel=require(_0x2e80('0xa'));var crypto=require(_0x2e80('0xb'));var jsforce=require(_0x2e80('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x2e80('0x7'));var querystring=require('querystring');var Papa=require(_0x2e80('0xd'));var Redis=require(_0x2e80('0xe'));var authService=require(_0x2e80('0xf'));var qs=require(_0x2e80('0x10'));var as=require(_0x2e80('0x11'));var hardwareService=require(_0x2e80('0x12'));var logger=require(_0x2e80('0x13'))(_0x2e80('0x14'));var utils=require(_0x2e80('0x15'));var config=require('../../config/environment');var db=require(_0x2e80('0x16'))['db'];function respondWithStatusCode(_0x22337b,_0x27f7cf){_0x27f7cf=_0x27f7cf||0xcc;return function(_0x25ba84){if(_0x25ba84){return _0x22337b[_0x2e80('0x17')](_0x27f7cf);}return _0x22337b[_0x2e80('0x18')](_0x27f7cf)['end']();};}function respondWithResult(_0x1253ad,_0x5250e9){_0x5250e9=_0x5250e9||0xc8;return function(_0x777355){if(_0x777355){return _0x1253ad[_0x2e80('0x18')](_0x5250e9)[_0x2e80('0x19')](_0x777355);}};}function respondWithFilteredResult(_0x246a1f,_0x4adcd0){return function(_0x152a61){if(_0x152a61){var _0x276bea=_0x152a61['count'],_0x214818=_0x4adcd0[_0x2e80('0x1a')],_0x1782bf=_0x4adcd0[_0x2e80('0x1a')]+_0x4adcd0['limit'],_0x4cffc9;if(_0x1782bf>=_0x276bea){_0x1782bf=_0x276bea;_0x4cffc9=0xc8;}else{_0x4cffc9=0xce;}_0x246a1f[_0x2e80('0x18')](_0x4cffc9);return _0x246a1f['set']('Content-Range',_0x214818+'-'+_0x1782bf+'/'+_0x276bea)[_0x2e80('0x19')](_0x152a61);}return null;};}function patchUpdates(_0x1d3378){return function(_0x20d44e){try{jsonpatch[_0x2e80('0x1b')](_0x20d44e,_0x1d3378,!![]);}catch(_0x131941){return BPromise[_0x2e80('0x1c')](_0x131941);}return _0x20d44e[_0x2e80('0x1d')]();};}function saveUpdates(_0xabe412,_0x445f10){return function(_0x35d85d){if(_0x35d85d){return _0x35d85d[_0x2e80('0x1e')](_0xabe412)['then'](function(_0x39ace8){return _0x39ace8;});}return null;};}function removeEntity(_0x23f26c,_0x1629e1){return function(_0x535eb8){if(_0x535eb8){return _0x535eb8[_0x2e80('0x1f')]()[_0x2e80('0x20')](function(){_0x23f26c[_0x2e80('0x18')](0xcc)[_0x2e80('0x21')]();});}};}function handleEntityNotFound(_0x29d913,_0x1a89e4){return function(_0x3e9d6e){if(!_0x3e9d6e){_0x29d913['sendStatus'](0x194);}return _0x3e9d6e;};}function handleError(_0x5acda5,_0x3350b9){_0x3350b9=_0x3350b9||0x1f4;return function(_0xccdd46){logger[_0x2e80('0x22')](_0xccdd46[_0x2e80('0x23')]);if(_0xccdd46[_0x2e80('0x24')]){delete _0xccdd46[_0x2e80('0x24')];}_0x5acda5['status'](_0x3350b9)[_0x2e80('0x25')](_0xccdd46);};}exports['show']=function(_0x30ceda,_0x1ad4c8){var _0x3546b4={'raw':!![],'where':{'id':_0x30ceda[_0x2e80('0x26')]['id']}},_0x3cc0b4={};_0x3cc0b4['model']=_[_0x2e80('0x27')](db[_0x2e80('0x28')]['rawAttributes']);_0x3cc0b4[_0x2e80('0x29')]=_[_0x2e80('0x27')](_0x30ceda[_0x2e80('0x29')]);_0x3cc0b4['filters']=_[_0x2e80('0x2a')](_0x3cc0b4[_0x2e80('0x2b')],_0x3cc0b4[_0x2e80('0x29')]);_0x3546b4['attributes']=_[_0x2e80('0x2a')](_0x3cc0b4[_0x2e80('0x2b')],qs[_0x2e80('0x2c')](_0x30ceda[_0x2e80('0x29')][_0x2e80('0x2c')]));_0x3546b4[_0x2e80('0x2d')]=_0x3546b4['attributes'][_0x2e80('0x2e')]?_0x3546b4['attributes']:_0x3cc0b4[_0x2e80('0x2b')];if(_0x30ceda['query'][_0x2e80('0x2f')]){_0x3546b4['include']=[{'all':!![]}];}_0x3546b4=_[_0x2e80('0x30')]({},_0x3546b4,_0x30ceda['options']);return db['ChatApplication'][_0x2e80('0x31')](_0x3546b4)[_0x2e80('0x20')](handleEntityNotFound(_0x1ad4c8,null))[_0x2e80('0x20')](respondWithResult(_0x1ad4c8,null))[_0x2e80('0x32')](handleError(_0x1ad4c8,null));};exports['update']=function(_0x1d64bd,_0x430085){if(_0x1d64bd[_0x2e80('0x33')]['id']){delete _0x1d64bd[_0x2e80('0x33')]['id'];}return db[_0x2e80('0x28')][_0x2e80('0x31')]({'where':{'id':_0x1d64bd[_0x2e80('0x26')]['id']}})[_0x2e80('0x20')](handleEntityNotFound(_0x430085,null))[_0x2e80('0x20')](saveUpdates(_0x1d64bd[_0x2e80('0x33')],null))['then'](respondWithResult(_0x430085,null))[_0x2e80('0x32')](handleError(_0x430085,null));};exports[_0x2e80('0x1f')]=function(_0x49185b,_0x2a8aea){return db['ChatApplication'][_0x2e80('0x31')]({'where':{'id':_0x49185b[_0x2e80('0x26')]['id']}})[_0x2e80('0x20')](handleEntityNotFound(_0x2a8aea,null))[_0x2e80('0x20')](removeEntity(_0x2a8aea,null))[_0x2e80('0x32')](handleError(_0x2a8aea,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index c95a1c8..b4bcac7 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(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0xa9e0[_0x298ed3];return _0x5aad28;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xa9e0[_0x139a3c];return _0x2b375b;};'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 eaa577e..a660be3 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 _0x1c57=['client','http','then','info','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','code','ChatApplication,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x3611a7,_0x59563c){var _0x569692=function(_0x5bbdc7){while(--_0x5bbdc7){_0x3611a7['push'](_0x3611a7['shift']());}};_0x569692(++_0x59563c);}(_0x1c57,0x122));var _0x71c5=function(_0x8c0032,_0x5052ed){_0x8c0032=_0x8c0032-0x0;var _0x284555=_0x1c57[_0x8c0032];return _0x284555;};'use strict';var _=require(_0x71c5('0x0'));var util=require(_0x71c5('0x1'));var moment=require(_0x71c5('0x2'));var BPromise=require('bluebird');var rs=require(_0x71c5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x71c5('0x4'))['db'];var utils=require(_0x71c5('0x5'));var logger=require(_0x71c5('0x6'))(_0x71c5('0x7'));var config=require(_0x71c5('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x71c5('0x9')][_0x71c5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x211a1a,_0x3f65ac,_0x5b8630){return new BPromise(function(_0x4c4529,_0x691de3){return client['request'](_0x211a1a,_0x5b8630)[_0x71c5('0xb')](function(_0x2579eb){logger[_0x71c5('0xc')]('ChatApplication,\x20%s,\x20%s',_0x3f65ac,_0x71c5('0xd'));logger[_0x71c5('0xe')](_0x71c5('0xf'),_0x3f65ac,_0x71c5('0xd'),JSON[_0x71c5('0x10')](_0x2579eb));if(_0x2579eb['error']){if(_0x2579eb['error'][_0x71c5('0x11')]===0x1f4){logger['error'](_0x71c5('0x12'),_0x3f65ac,_0x2579eb[_0x71c5('0x13')][_0x71c5('0x14')]);return _0x691de3(_0x2579eb[_0x71c5('0x13')]['message']);}logger[_0x71c5('0x13')](_0x71c5('0x12'),_0x3f65ac,_0x2579eb[_0x71c5('0x13')][_0x71c5('0x14')]);return _0x4c4529(_0x2579eb[_0x71c5('0x13')]['message']);}else{logger[_0x71c5('0xc')](_0x71c5('0x12'),_0x3f65ac,_0x71c5('0xd'));_0x4c4529(_0x2579eb[_0x71c5('0x15')][_0x71c5('0x14')]);}})[_0x71c5('0x16')](function(_0x8383e8){logger[_0x71c5('0x13')]('ChatApplication,\x20%s,\x20%s',_0x3f65ac,_0x8383e8);_0x691de3(_0x8383e8);});});} \ No newline at end of file +var _0x0c0b=['error','code','message','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x0c0b,0x1e4));var _0xb0c0=function(_0x53b8df,_0x2d987c){_0x53b8df=_0x53b8df-0x0;var _0x549eb0=_0x0c0b[_0x53b8df];return _0x549eb0;};'use strict';var _=require(_0xb0c0('0x0'));var util=require(_0xb0c0('0x1'));var moment=require('moment');var BPromise=require(_0xb0c0('0x2'));var rs=require(_0xb0c0('0x3'));var fs=require('fs');var Redis=require(_0xb0c0('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb0c0('0x5'));var logger=require(_0xb0c0('0x6'))(_0xb0c0('0x7'));var config=require(_0xb0c0('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xb0c0('0x9')][_0xb0c0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x332854,_0x41cd4f,_0x346b28){return new BPromise(function(_0x37fd07,_0x5af5f6){return client['request'](_0x332854,_0x346b28)[_0xb0c0('0xb')](function(_0x2c09e8){logger['info'](_0xb0c0('0xc'),_0x41cd4f,_0xb0c0('0xd'));logger[_0xb0c0('0xe')]('ChatApplication,\x20%s,\x20%s,\x20%s',_0x41cd4f,'request\x20sent',JSON[_0xb0c0('0xf')](_0x2c09e8));if(_0x2c09e8[_0xb0c0('0x10')]){if(_0x2c09e8['error'][_0xb0c0('0x11')]===0x1f4){logger[_0xb0c0('0x10')]('ChatApplication,\x20%s,\x20%s',_0x41cd4f,_0x2c09e8[_0xb0c0('0x10')]['message']);return _0x5af5f6(_0x2c09e8[_0xb0c0('0x10')][_0xb0c0('0x12')]);}logger[_0xb0c0('0x10')]('ChatApplication,\x20%s,\x20%s',_0x41cd4f,_0x2c09e8['error']['message']);return _0x37fd07(_0x2c09e8[_0xb0c0('0x10')][_0xb0c0('0x12')]);}else{logger['info'](_0xb0c0('0xc'),_0x41cd4f,_0xb0c0('0xd'));_0x37fd07(_0x2c09e8['result'][_0xb0c0('0x12')]);}})[_0xb0c0('0x13')](function(_0x4fbd0b){logger[_0xb0c0('0x10')](_0xb0c0('0xc'),_0x41cd4f,_0x4fbd0b);_0x5af5f6(_0x4fbd0b);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 36a9098..c67b73e 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 _0x656e=['destroy','exports','multer','util','express','../../components/auth/service','../../components/interaction/service','./chatApplication.controller','get','/:id','isAuthenticated','update','delete'];(function(_0x1e7a55,_0x2bf159){var _0x20742e=function(_0x3cb71d){while(--_0x3cb71d){_0x1e7a55['push'](_0x1e7a55['shift']());}};_0x20742e(++_0x2bf159);}(_0x656e,0xf9));var _0xe656=function(_0x380329,_0x63b51e){_0x380329=_0x380329-0x0;var _0x15b881=_0x656e[_0x380329];return _0x15b881;};'use strict';var multer=require(_0xe656('0x0'));var util=require(_0xe656('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xe656('0x2'));var router=express['Router']();var auth=require(_0xe656('0x3'));var interaction=require(_0xe656('0x4'));var config=require('../../config/environment');var controller=require(_0xe656('0x5'));router[_0xe656('0x6')](_0xe656('0x7'),auth[_0xe656('0x8')](),controller['show']);router['put'](_0xe656('0x7'),auth['isAuthenticated'](),controller[_0xe656('0x9')]);router[_0xe656('0xa')](_0xe656('0x7'),auth['isAuthenticated'](),controller[_0xe656('0xb')]);module[_0xe656('0xc')]=router; \ No newline at end of file +var _0x87c5=['delete','multer','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatApplication.controller','get','/:id','show','isAuthenticated'];(function(_0x53ecd8,_0x49e4ea){var _0x3d4716=function(_0xf0ab5){while(--_0xf0ab5){_0x53ecd8['push'](_0x53ecd8['shift']());}};_0x3d4716(++_0x49e4ea);}(_0x87c5,0x169));var _0x587c=function(_0x19e387,_0x2ee3a6){_0x19e387=_0x19e387-0x0;var _0x5d170b=_0x87c5[_0x19e387];return _0x5d170b;};'use strict';var multer=require(_0x587c('0x0'));var util=require('util');var path=require(_0x587c('0x1'));var timeout=require(_0x587c('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x587c('0x3'));var interaction=require(_0x587c('0x4'));var config=require(_0x587c('0x5'));var controller=require(_0x587c('0x6'));router[_0x587c('0x7')](_0x587c('0x8'),auth['isAuthenticated'](),controller[_0x587c('0x9')]);router['put'](_0x587c('0x8'),auth[_0x587c('0xa')](),controller['update']);router[_0x587c('0xb')]('/:id',auth['isAuthenticated'](),controller['destroy']);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 19fd4fe..9700552 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 _0xf68d=['BOOLEAN','sequelize','exports','STRING'];(function(_0x25ca30,_0xe38294){var _0x1b1c8e=function(_0x6c33a2){while(--_0x6c33a2){_0x25ca30['push'](_0x25ca30['shift']());}};_0x1b1c8e(++_0xe38294);}(_0xf68d,0x135));var _0xdf68=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0xf68d[_0x255d5b];return _0x3e141a;};'use strict';var Sequelize=require(_0xdf68('0x0'));module[_0xdf68('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xdf68('0x2')]},'write':{'type':Sequelize[_0xdf68('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0xadc4=['STRING','BOOLEAN','sequelize','exports'];(function(_0x4f46f1,_0x2a39b9){var _0x5e146b=function(_0x5aed22){while(--_0x5aed22){_0x4f46f1['push'](_0x4f46f1['shift']());}};_0x5e146b(++_0x2a39b9);}(_0xadc4,0x1b2));var _0x4adc=function(_0x43ea46,_0x283420){_0x43ea46=_0x43ea46-0x0;var _0x52ec03=_0xadc4[_0x43ea46];return _0x52ec03;};'use strict';var Sequelize=require(_0x4adc('0x0'));module[_0x4adc('0x1')]={'name':{'type':Sequelize[_0x4adc('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x4adc('0x2')]},'write':{'type':Sequelize[_0x4adc('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index 2529b8d..a018339 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 _0x1f8a=['hasOwnProperty','removeMembers','addMessage','ChatGroupId','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','jayson/promise','client','http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','ChatGroup,\x20%s,\x20%s','request\x20sent','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','status','end','count','offset','limit','set','Content-Range','json','apply','reject','destroy','sendStatus','stack','name','index','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','filter','merge','map','VIRTUAL','where','ChatGroup','includeAll','include','findAll','rows','show','params','options','find','create','update','body','describe','getUnread','ChatInternalMessage','user','toInteger','addMembers','ids','omit','getMembers','findOne','keys','User','pick'];(function(_0x52c2ad,_0x2adc78){var _0x30122a=function(_0x64147f){while(--_0x64147f){_0x52c2ad['push'](_0x52c2ad['shift']());}};_0x30122a(++_0x2adc78);}(_0x1f8a,0x1d9));var _0xa1f8=function(_0x5e18b5,_0x35807e){_0x5e18b5=_0x5e18b5-0x0;var _0x2a0cd2=_0x1f8a[_0x5e18b5];return _0x2a0cd2;};'use strict';var pdf=require(_0xa1f8('0x0'));var emlformat=require(_0xa1f8('0x1'));var rimraf=require(_0xa1f8('0x2'));var zipdir=require(_0xa1f8('0x3'));var jsonpatch=require(_0xa1f8('0x4'));var rp=require(_0xa1f8('0x5'));var moment=require(_0xa1f8('0x6'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xa1f8('0x7'));var path=require(_0xa1f8('0x8'));var sox=require(_0xa1f8('0x9'));var csv=require(_0xa1f8('0xa'));var ejs=require(_0xa1f8('0xb'));var fs=require('fs');var _=require(_0xa1f8('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa1f8('0xd'));var deskjs=require(_0xa1f8('0xe'));var toCsv=require(_0xa1f8('0xa'));var querystring=require(_0xa1f8('0xf'));var Papa=require(_0xa1f8('0x10'));var Redis=require(_0xa1f8('0x11'));var authService=require(_0xa1f8('0x12'));var qs=require(_0xa1f8('0x13'));var as=require(_0xa1f8('0x14'));var hardwareService=require(_0xa1f8('0x15'));var logger=require(_0xa1f8('0x16'))(_0xa1f8('0x17'));var utils=require(_0xa1f8('0x18'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0xa1f8('0x19')]=_[_0xa1f8('0x1a')](config['redis'],{'host':_0xa1f8('0x1b'),'port':0x18eb});var socket=require(_0xa1f8('0x1c'))(new Redis(config['redis']));require(_0xa1f8('0x1d'))[_0xa1f8('0x1e')](socket);var jayson=require(_0xa1f8('0x1f'));var client=jayson[_0xa1f8('0x20')][_0xa1f8('0x21')]({'port':0x232a});function checkPasswordPattern(_0x184218,_0x4c2087,_0x1fe6f9){if(_0x1fe6f9){var _0x508d87=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x508d87[_0xa1f8('0x22')](_0x4c2087)){return _0x184218;}else{throw new db['Sequelize'][(_0xa1f8('0x23'))](_0xa1f8('0x24'));}}else{return _0x184218;}}function respondWithRpcPromise(_0x3441bd,_0x435289,_0x47c7c2,_0x3defa1){return new BPromise(function(_0x4877b7,_0x3a8b7c){var _0x4bdb4a=_0x3defa1||client;return _0x4bdb4a[_0xa1f8('0x25')](_0x3441bd,_0x47c7c2)[_0xa1f8('0x26')](function(_0x358efd){logger['info'](_0xa1f8('0x27'),_0x435289,_0xa1f8('0x28'));logger['debug'](_0xa1f8('0x29'),_0x435289,'request\x20sent',JSON[_0xa1f8('0x2a')](_0x358efd));if(_0x358efd['error']){if(_0x358efd[_0xa1f8('0x2b')]['code']===0x1f4){logger['error']('ChatGroup,\x20%s,\x20%s',_0x435289,_0x358efd[_0xa1f8('0x2b')][_0xa1f8('0x2c')]);return _0x3a8b7c(_0x358efd[_0xa1f8('0x2b')]['message']);}logger[_0xa1f8('0x2b')](_0xa1f8('0x27'),_0x435289,_0x358efd['error'][_0xa1f8('0x2c')]);return _0x4877b7(_0x358efd[_0xa1f8('0x2b')][_0xa1f8('0x2c')]);}else{logger[_0xa1f8('0x2d')]('ChatGroup,\x20%s,\x20%s',_0x435289,_0xa1f8('0x28'));_0x4877b7(_0x358efd[_0xa1f8('0x2e')][_0xa1f8('0x2c')]);}})[_0xa1f8('0x2f')](function(_0x4ff15b){logger[_0xa1f8('0x2b')]('ChatGroup,\x20%s,\x20%s',_0x435289,_0x4ff15b);_0x3a8b7c(_0x4ff15b);});});}function respondWithStatusCode(_0x292a5c,_0xccbe66){_0xccbe66=_0xccbe66||0xcc;return function(_0x1b3a3c){if(_0x1b3a3c){return _0x292a5c['sendStatus'](_0xccbe66);}return _0x292a5c[_0xa1f8('0x30')](_0xccbe66)[_0xa1f8('0x31')]();};}function respondWithResult(_0x26fde1,_0x271951){_0x271951=_0x271951||0xc8;return function(_0x352557){if(_0x352557){return _0x26fde1[_0xa1f8('0x30')](_0x271951)['json'](_0x352557);}};}function respondWithFilteredResult(_0x55342e,_0x27a322){return function(_0x26b862){if(_0x26b862){var _0x304bec=_0x26b862[_0xa1f8('0x32')],_0x23a85c=_0x27a322[_0xa1f8('0x33')],_0x17db38=_0x27a322[_0xa1f8('0x33')]+_0x27a322[_0xa1f8('0x34')],_0x37d11e;if(_0x17db38>=_0x304bec){_0x17db38=_0x304bec;_0x37d11e=0xc8;}else{_0x37d11e=0xce;}_0x55342e['status'](_0x37d11e);return _0x55342e[_0xa1f8('0x35')](_0xa1f8('0x36'),_0x23a85c+'-'+_0x17db38+'/'+_0x304bec)[_0xa1f8('0x37')](_0x26b862);}return null;};}function patchUpdates(_0x2ea556){return function(_0x5e1579){try{jsonpatch[_0xa1f8('0x38')](_0x5e1579,_0x2ea556,!![]);}catch(_0x398b4b){return BPromise[_0xa1f8('0x39')](_0x398b4b);}return _0x5e1579['save']();};}function saveUpdates(_0x1a884d,_0x38e801){return function(_0x41e50a){if(_0x41e50a){return _0x41e50a['update'](_0x1a884d)['then'](function(_0x363981){return _0x363981;});}return null;};}function removeEntity(_0x20a673,_0x23675e){return function(_0x4a642d){if(_0x4a642d){return _0x4a642d[_0xa1f8('0x3a')]()[_0xa1f8('0x26')](function(){_0x20a673[_0xa1f8('0x30')](0xcc)[_0xa1f8('0x31')]();});}};}function handleEntityNotFound(_0x131cc1,_0x42b346){return function(_0x5b426d){if(!_0x5b426d){_0x131cc1[_0xa1f8('0x3b')](0x194);}return _0x5b426d;};}function handleError(_0x30d34a,_0x1ad2a1){_0x1ad2a1=_0x1ad2a1||0x1f4;return function(_0x2ccbfc){logger[_0xa1f8('0x2b')](_0x2ccbfc[_0xa1f8('0x3c')]);if(_0x2ccbfc[_0xa1f8('0x3d')]){delete _0x2ccbfc[_0xa1f8('0x3d')];}_0x30d34a[_0xa1f8('0x30')](_0x1ad2a1)['send'](_0x2ccbfc);};}exports[_0xa1f8('0x3e')]=function(_0x1bb131,_0x14c313){var _0x21ce4b={},_0x3d7262={},_0x1ddb67={'count':0x0,'rows':[]};var _0x1fd43a=_['map'](db['ChatGroup'][_0xa1f8('0x3f')],function(_0x1a66a0){return{'name':_0x1a66a0[_0xa1f8('0x40')],'type':_0x1a66a0[_0xa1f8('0x41')][_0xa1f8('0x42')]};});_0x3d7262['model']=_['map'](_0x1fd43a,_0xa1f8('0x3d'));_0x3d7262[_0xa1f8('0x43')]=_['keys'](_0x1bb131[_0xa1f8('0x43')]);_0x3d7262[_0xa1f8('0x44')]=_[_0xa1f8('0x45')](_0x3d7262[_0xa1f8('0x46')],_0x3d7262[_0xa1f8('0x43')]);_0x21ce4b[_0xa1f8('0x47')]=_['intersection'](_0x3d7262[_0xa1f8('0x46')],qs[_0xa1f8('0x48')](_0x1bb131[_0xa1f8('0x43')][_0xa1f8('0x48')]));_0x21ce4b[_0xa1f8('0x47')]=_0x21ce4b[_0xa1f8('0x47')][_0xa1f8('0x49')]?_0x21ce4b[_0xa1f8('0x47')]:_0x3d7262[_0xa1f8('0x46')];if(!_0x1bb131[_0xa1f8('0x43')]['hasOwnProperty'](_0xa1f8('0x4a'))){_0x21ce4b[_0xa1f8('0x34')]=qs[_0xa1f8('0x34')](_0x1bb131['query'][_0xa1f8('0x34')]);_0x21ce4b['offset']=qs[_0xa1f8('0x33')](_0x1bb131[_0xa1f8('0x43')][_0xa1f8('0x33')]);}_0x21ce4b[_0xa1f8('0x4b')]=qs[_0xa1f8('0x4c')](_0x1bb131[_0xa1f8('0x43')][_0xa1f8('0x4c')]);_0x21ce4b['where']=qs[_0xa1f8('0x44')](_['pick'](_0x1bb131[_0xa1f8('0x43')],_0x3d7262[_0xa1f8('0x44')]),_0x1fd43a);if(_0x1bb131[_0xa1f8('0x43')][_0xa1f8('0x4d')]){_0x21ce4b['where']=_[_0xa1f8('0x4e')](_0x21ce4b['where'],{'$or':_[_0xa1f8('0x4f')](_0x1fd43a,function(_0xde9096){if(_0xde9096['type']!==_0xa1f8('0x50')){var _0x297259={};_0x297259[_0xde9096[_0xa1f8('0x3d')]]={'$like':'%'+_0x1bb131[_0xa1f8('0x43')][_0xa1f8('0x4d')]+'%'};return _0x297259;}})});}_0x21ce4b=_[_0xa1f8('0x4e')]({},_0x21ce4b,_0x1bb131['options']);var _0x2dada5={'where':_0x21ce4b[_0xa1f8('0x51')]};return db[_0xa1f8('0x52')]['count'](_0x2dada5)[_0xa1f8('0x26')](function(_0x33f381){_0x1ddb67[_0xa1f8('0x32')]=_0x33f381;if(_0x1bb131[_0xa1f8('0x43')][_0xa1f8('0x53')]){_0x21ce4b[_0xa1f8('0x54')]=[{'all':!![]}];}return db[_0xa1f8('0x52')][_0xa1f8('0x55')](_0x21ce4b);})[_0xa1f8('0x26')](function(_0x369143){_0x1ddb67[_0xa1f8('0x56')]=_0x369143;return _0x1ddb67;})[_0xa1f8('0x26')](respondWithFilteredResult(_0x14c313,_0x21ce4b))[_0xa1f8('0x2f')](handleError(_0x14c313,null));};exports[_0xa1f8('0x57')]=function(_0x1877de,_0x5c7565){var _0x15d143={'raw':!![],'where':{'id':_0x1877de[_0xa1f8('0x58')]['id']}},_0x5be979={};_0x5be979[_0xa1f8('0x46')]=_['keys'](db[_0xa1f8('0x52')]['rawAttributes']);_0x5be979[_0xa1f8('0x43')]=_['keys'](_0x1877de[_0xa1f8('0x43')]);_0x5be979[_0xa1f8('0x44')]=_['intersection'](_0x5be979[_0xa1f8('0x46')],_0x5be979[_0xa1f8('0x43')]);_0x15d143['attributes']=_[_0xa1f8('0x45')](_0x5be979[_0xa1f8('0x46')],qs[_0xa1f8('0x48')](_0x1877de['query'][_0xa1f8('0x48')]));_0x15d143[_0xa1f8('0x47')]=_0x15d143[_0xa1f8('0x47')][_0xa1f8('0x49')]?_0x15d143[_0xa1f8('0x47')]:_0x5be979[_0xa1f8('0x46')];if(_0x1877de['query']['includeAll']){_0x15d143[_0xa1f8('0x54')]=[{'all':!![]}];}_0x15d143=_['merge']({},_0x15d143,_0x1877de[_0xa1f8('0x59')]);return db['ChatGroup'][_0xa1f8('0x5a')](_0x15d143)['then'](handleEntityNotFound(_0x5c7565,null))[_0xa1f8('0x26')](respondWithResult(_0x5c7565,null))[_0xa1f8('0x2f')](handleError(_0x5c7565,null));};exports['create']=function(_0x51bf9c,_0x2c3f0b){return db[_0xa1f8('0x52')][_0xa1f8('0x5b')](_0x51bf9c['body'],{})[_0xa1f8('0x26')](respondWithResult(_0x2c3f0b,0xc9))[_0xa1f8('0x2f')](handleError(_0x2c3f0b,null));};exports[_0xa1f8('0x5c')]=function(_0x1d94e6,_0x572f1c){if(_0x1d94e6['body']['id']){delete _0x1d94e6[_0xa1f8('0x5d')]['id'];}return db[_0xa1f8('0x52')][_0xa1f8('0x5a')]({'where':{'id':_0x1d94e6[_0xa1f8('0x58')]['id']}})[_0xa1f8('0x26')](handleEntityNotFound(_0x572f1c,null))[_0xa1f8('0x26')](saveUpdates(_0x1d94e6[_0xa1f8('0x5d')],null))[_0xa1f8('0x26')](respondWithResult(_0x572f1c,null))['catch'](handleError(_0x572f1c,null));};exports[_0xa1f8('0x3a')]=function(_0x45acbc,_0x2d2bf8){return db['ChatGroup']['find']({'where':{'id':_0x45acbc['params']['id']}})['then'](handleEntityNotFound(_0x2d2bf8,null))[_0xa1f8('0x26')](removeEntity(_0x2d2bf8,null))[_0xa1f8('0x2f')](handleError(_0x2d2bf8,null));};exports[_0xa1f8('0x5e')]=function(_0x402be8,_0x1f2461){return db['ChatGroup'][_0xa1f8('0x5e')]()[_0xa1f8('0x26')](respondWithResult(_0x1f2461,null))[_0xa1f8('0x2f')](handleError(_0x1f2461,null));};exports[_0xa1f8('0x5f')]=function(_0x2e0295,_0x2273ad,_0x107f0a){return db[_0xa1f8('0x60')]['count']({'where':{'ChatGroupId':_0x2e0295['params']['id'],'ToId':_0x2e0295[_0xa1f8('0x61')]['id'],'read':![]}})[_0xa1f8('0x26')](function(_0x274cd0){return{'id':_[_0xa1f8('0x62')](_0x2e0295[_0xa1f8('0x58')]['id']),'count':_0x274cd0};})[_0xa1f8('0x26')](respondWithResult(_0x2273ad,null))['catch'](handleError(_0x2273ad,null));};exports[_0xa1f8('0x63')]=function(_0x4403b6,_0x1e6e5b,_0x4bf73b){return db[_0xa1f8('0x52')]['find']({'where':{'id':_0x4403b6['params']['id']}})[_0xa1f8('0x26')](handleEntityNotFound(_0x1e6e5b,null))[_0xa1f8('0x26')](function(_0x35551e){if(_0x35551e){return _0x35551e[_0xa1f8('0x63')](_0x4403b6[_0xa1f8('0x5d')][_0xa1f8('0x64')],_[_0xa1f8('0x65')](_0x4403b6[_0xa1f8('0x5d')],[_0xa1f8('0x64'),'id'])||{});}})['then'](respondWithResult(_0x1e6e5b,null))[_0xa1f8('0x2f')](handleError(_0x1e6e5b,null));};exports[_0xa1f8('0x66')]=function(_0x20cbe8,_0x193663,_0x2b1f5a){var _0x1e6783={};var _0x36cbdd={};var _0x534520;var _0x1be815;return db[_0xa1f8('0x52')][_0xa1f8('0x67')]({'where':{'id':_0x20cbe8['params']['id']}})[_0xa1f8('0x26')](handleEntityNotFound(_0x193663,null))[_0xa1f8('0x26')](function(_0x638740){if(_0x638740){_0x534520=_0x638740;_0x36cbdd[_0xa1f8('0x46')]=_[_0xa1f8('0x68')](db[_0xa1f8('0x69')][_0xa1f8('0x3f')]);_0x36cbdd[_0xa1f8('0x43')]=_[_0xa1f8('0x68')](_0x20cbe8[_0xa1f8('0x43')]);_0x36cbdd['filters']=_[_0xa1f8('0x45')](_0x36cbdd[_0xa1f8('0x46')],_0x36cbdd['query']);_0x1e6783[_0xa1f8('0x47')]=_[_0xa1f8('0x45')](_0x36cbdd[_0xa1f8('0x46')],qs[_0xa1f8('0x48')](_0x20cbe8[_0xa1f8('0x43')]['fields']));_0x1e6783[_0xa1f8('0x47')]=_0x1e6783[_0xa1f8('0x47')]['length']?_0x1e6783['attributes']:_0x36cbdd[_0xa1f8('0x46')];_0x1e6783['order']=qs[_0xa1f8('0x4c')](_0x20cbe8['query'][_0xa1f8('0x4c')]);_0x1e6783[_0xa1f8('0x51')]=qs[_0xa1f8('0x44')](_[_0xa1f8('0x6a')](_0x20cbe8['query'],_0x36cbdd['filters']));if(_0x20cbe8[_0xa1f8('0x43')]['filter']){_0x1e6783[_0xa1f8('0x51')]=_[_0xa1f8('0x4e')](_0x1e6783[_0xa1f8('0x51')],{'$or':_[_0xa1f8('0x4f')](_0x1e6783['attributes'],function(_0x13372b){var _0x4eb231={};_0x4eb231[_0x13372b]={'$like':'%'+_0x20cbe8['query'][_0xa1f8('0x4d')]+'%'};return _0x4eb231;})});}_0x1e6783=_[_0xa1f8('0x4e')]({},_0x1e6783,_0x20cbe8['options']);return _0x534520[_0xa1f8('0x66')](_0x1e6783);}})[_0xa1f8('0x26')](function(_0x5cb237){if(_0x5cb237){_0x1be815=_0x5cb237['length'];if(!_0x20cbe8[_0xa1f8('0x43')][_0xa1f8('0x6b')](_0xa1f8('0x4a'))){_0x1e6783['limit']=qs[_0xa1f8('0x34')](_0x20cbe8[_0xa1f8('0x43')][_0xa1f8('0x34')]);_0x1e6783['offset']=qs[_0xa1f8('0x33')](_0x20cbe8[_0xa1f8('0x43')][_0xa1f8('0x33')]);}return _0x534520[_0xa1f8('0x66')](_0x1e6783);}})['then'](function(_0x110d69){if(_0x110d69){return _0x110d69?{'count':_0x1be815,'rows':_0x110d69}:null;}})['then'](respondWithResult(_0x193663,null))['catch'](handleError(_0x193663,null));};exports['removeMembers']=function(_0x1bc0b4,_0x19a420,_0x2e95bd){return db['ChatGroup'][_0xa1f8('0x5a')]({'where':{'id':_0x1bc0b4[_0xa1f8('0x58')]['id']}})[_0xa1f8('0x26')](handleEntityNotFound(_0x19a420,null))[_0xa1f8('0x26')](function(_0x161b26){if(_0x161b26){return _0x161b26[_0xa1f8('0x6c')](_0x1bc0b4[_0xa1f8('0x43')][_0xa1f8('0x64')]);}})['then'](respondWithStatusCode(_0x19a420,null))['catch'](handleError(_0x19a420,null));};exports[_0xa1f8('0x6d')]=function(_0x3bacfa,_0x4737cd,_0x1cdf26){if(_0x3bacfa['body']['id']){delete _0x3bacfa['body']['id'];}return db['ChatGroup'][_0xa1f8('0x5a')]({'where':{'id':_0x3bacfa[_0xa1f8('0x58')]['id']}})['then'](handleEntityNotFound(_0x4737cd,null))[_0xa1f8('0x26')](function(_0x57bbe1){if(_0x57bbe1){_0x3bacfa[_0xa1f8('0x5d')][_0xa1f8('0x6e')]=_0x57bbe1['id'];return db[_0xa1f8('0x60')][_0xa1f8('0x5b')](_0x3bacfa[_0xa1f8('0x5d')]);}})[_0xa1f8('0x26')](respondWithResult(_0x4737cd,null))[_0xa1f8('0x2f')](handleError(_0x4737cd,null));};exports[_0xa1f8('0x6f')]=function(_0x1f5039,_0x29496b,_0x3a7607){var _0x2af271={};var _0x453206={};var _0x50c2b6;var _0x351c7c;return db[_0xa1f8('0x52')][_0xa1f8('0x67')]({'where':{'id':_0x1f5039[_0xa1f8('0x58')]['id']}})[_0xa1f8('0x26')](handleEntityNotFound(_0x29496b,null))[_0xa1f8('0x26')](function(_0x4985d6){if(_0x4985d6){_0x50c2b6=_0x4985d6;_0x453206[_0xa1f8('0x46')]=_[_0xa1f8('0x68')](db[_0xa1f8('0x60')]['rawAttributes']);_0x453206['query']=_[_0xa1f8('0x68')](_0x1f5039[_0xa1f8('0x43')]);_0x453206[_0xa1f8('0x44')]=_[_0xa1f8('0x45')](_0x453206[_0xa1f8('0x46')],_0x453206[_0xa1f8('0x43')]);_0x2af271[_0xa1f8('0x47')]=_['intersection'](_0x453206[_0xa1f8('0x46')],qs['fields'](_0x1f5039[_0xa1f8('0x43')][_0xa1f8('0x48')]));_0x2af271[_0xa1f8('0x47')]=_0x2af271[_0xa1f8('0x47')][_0xa1f8('0x49')]?_0x2af271[_0xa1f8('0x47')]:_0x453206[_0xa1f8('0x46')];_0x2af271[_0xa1f8('0x4b')]=qs[_0xa1f8('0x4c')](_0x1f5039[_0xa1f8('0x43')]['sort']);_0x2af271[_0xa1f8('0x51')]=qs[_0xa1f8('0x44')](_[_0xa1f8('0x6a')](_0x1f5039[_0xa1f8('0x43')],_0x453206[_0xa1f8('0x44')]));if(_0x1f5039[_0xa1f8('0x43')][_0xa1f8('0x4d')]){_0x2af271[_0xa1f8('0x51')]=_[_0xa1f8('0x4e')](_0x2af271[_0xa1f8('0x51')],{'$or':_[_0xa1f8('0x4f')](_0x2af271[_0xa1f8('0x47')],function(_0x14feaf){var _0x2b54f1={};_0x2b54f1[_0x14feaf]={'$like':'%'+_0x1f5039[_0xa1f8('0x43')][_0xa1f8('0x4d')]+'%'};return _0x2b54f1;})});}if(_0x1f5039[_0xa1f8('0x43')][_0xa1f8('0x70')]){var _0x3cb650=_0x1f5039['query'][_0xa1f8('0x70')][_0xa1f8('0x71')](',');var _0x1f7412={};_0x1f7412[_0x3cb650[0x0]]={'$gte':moment(_0x3cb650[0x1])[_0xa1f8('0x72')](_0xa1f8('0x73'))};_0x2af271[_0xa1f8('0x51')]=_[_0xa1f8('0x4e')](_0x2af271[_0xa1f8('0x51')],_0x1f7412);}_0x2af271=_[_0xa1f8('0x4e')]({},_0x2af271,_0x1f5039['options']);return _0x50c2b6[_0xa1f8('0x6f')](_0x2af271);}})['then'](function(_0x166322){if(_0x166322){_0x351c7c=_0x166322[_0xa1f8('0x49')];if(!_0x1f5039[_0xa1f8('0x43')][_0xa1f8('0x6b')]('nolimit')){_0x2af271[_0xa1f8('0x34')]=qs['limit'](_0x1f5039[_0xa1f8('0x43')][_0xa1f8('0x34')]);_0x2af271[_0xa1f8('0x33')]=qs[_0xa1f8('0x33')](_0x1f5039[_0xa1f8('0x43')]['offset']);}return _0x50c2b6['getMessages'](_0x2af271);}})[_0xa1f8('0x26')](function(_0x3bb92f){if(_0x3bb92f){return _0x3bb92f?{'count':_0x351c7c,'rows':_0x3bb92f}:null;}})['then'](respondWithResult(_0x29496b,null))[_0xa1f8('0x2f')](handleError(_0x29496b,null));}; \ No newline at end of file +var _0x051b=['where','pick','filter','VIRTUAL','merge','includeAll','rows','show','params','include','options','find','create','update','body','destroy','describe','ChatInternalMessage','addMembers','ids','omit','getMembers','User','removeMembers','addMessage','ChatGroupId','getMessages','findOne','$gte','split','YYYY-MM-DD\x20HH:mm:ss','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','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','defaults','redis','localhost','./chatGroup.socket','register','jayson/promise','client','http','test','Sequelize','ValidationError','request','then','info','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','error','code','message','ChatGroup,\x20%s,\x20%s','result','catch','sendStatus','status','end','json','count','offset','reject','save','name','index','map','ChatGroup','rawAttributes','fieldName','type','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort'];(function(_0x225641,_0x45f09d){var _0x1465f7=function(_0x5ee68b){while(--_0x5ee68b){_0x225641['push'](_0x225641['shift']());}};_0x1465f7(++_0x45f09d);}(_0x051b,0x1d3));var _0xb051=function(_0x3ae5a7,_0x17c65f){_0x3ae5a7=_0x3ae5a7-0x0;var _0x5afe55=_0x051b[_0x3ae5a7];return _0x5afe55;};'use strict';var pdf=require(_0xb051('0x0'));var emlformat=require(_0xb051('0x1'));var rimraf=require(_0xb051('0x2'));var zipdir=require(_0xb051('0x3'));var jsonpatch=require(_0xb051('0x4'));var rp=require(_0xb051('0x5'));var moment=require(_0xb051('0x6'));var BPromise=require(_0xb051('0x7'));var Mustache=require(_0xb051('0x8'));var util=require('util');var path=require(_0xb051('0x9'));var sox=require(_0xb051('0xa'));var csv=require('to-csv');var ejs=require(_0xb051('0xb'));var fs=require('fs');var _=require(_0xb051('0xc'));var squel=require('squel');var crypto=require(_0xb051('0xd'));var jsforce=require(_0xb051('0xe'));var deskjs=require(_0xb051('0xf'));var toCsv=require('to-csv');var querystring=require(_0xb051('0x10'));var Papa=require(_0xb051('0x11'));var Redis=require(_0xb051('0x12'));var authService=require(_0xb051('0x13'));var qs=require(_0xb051('0x14'));var as=require(_0xb051('0x15'));var hardwareService=require(_0xb051('0x16'));var logger=require('../../config/logger')(_0xb051('0x17'));var utils=require(_0xb051('0x18'));var config=require(_0xb051('0x19'));var db=require(_0xb051('0x1a'))['db'];config['redis']=_[_0xb051('0x1b')](config[_0xb051('0x1c')],{'host':_0xb051('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb051('0x1c')]));require(_0xb051('0x1e'))[_0xb051('0x1f')](socket);var jayson=require(_0xb051('0x20'));var client=jayson[_0xb051('0x21')][_0xb051('0x22')]({'port':0x232a});function checkPasswordPattern(_0x326a06,_0x17f44f,_0x46e319){if(_0x46e319){var _0x5634e9=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5634e9[_0xb051('0x23')](_0x17f44f)){return _0x326a06;}else{throw new db[(_0xb051('0x24'))][(_0xb051('0x25'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x326a06;}}function respondWithRpcPromise(_0x36112c,_0x29357d,_0x3f7ea7,_0x5ba189){return new BPromise(function(_0x292698,_0x5070a6){var _0x593cc6=_0x5ba189||client;return _0x593cc6[_0xb051('0x26')](_0x36112c,_0x3f7ea7)[_0xb051('0x27')](function(_0x250b99){logger[_0xb051('0x28')]('ChatGroup,\x20%s,\x20%s',_0x29357d,_0xb051('0x29'));logger[_0xb051('0x2a')](_0xb051('0x2b'),_0x29357d,_0xb051('0x29'),JSON['stringify'](_0x250b99));if(_0x250b99[_0xb051('0x2c')]){if(_0x250b99['error'][_0xb051('0x2d')]===0x1f4){logger['error']('ChatGroup,\x20%s,\x20%s',_0x29357d,_0x250b99[_0xb051('0x2c')][_0xb051('0x2e')]);return _0x5070a6(_0x250b99['error'][_0xb051('0x2e')]);}logger[_0xb051('0x2c')](_0xb051('0x2f'),_0x29357d,_0x250b99[_0xb051('0x2c')][_0xb051('0x2e')]);return _0x292698(_0x250b99[_0xb051('0x2c')][_0xb051('0x2e')]);}else{logger['info']('ChatGroup,\x20%s,\x20%s',_0x29357d,_0xb051('0x29'));_0x292698(_0x250b99[_0xb051('0x30')][_0xb051('0x2e')]);}})[_0xb051('0x31')](function(_0x586f1d){logger[_0xb051('0x2c')]('ChatGroup,\x20%s,\x20%s',_0x29357d,_0x586f1d);_0x5070a6(_0x586f1d);});});}function respondWithStatusCode(_0x2f4a54,_0x21057a){_0x21057a=_0x21057a||0xcc;return function(_0x28023b){if(_0x28023b){return _0x2f4a54[_0xb051('0x32')](_0x21057a);}return _0x2f4a54[_0xb051('0x33')](_0x21057a)[_0xb051('0x34')]();};}function respondWithResult(_0x35de78,_0xd80967){_0xd80967=_0xd80967||0xc8;return function(_0x386ca2){if(_0x386ca2){return _0x35de78[_0xb051('0x33')](_0xd80967)[_0xb051('0x35')](_0x386ca2);}};}function respondWithFilteredResult(_0x55cc9b,_0x25e37d){return function(_0x5b412d){if(_0x5b412d){var _0xf05d2f=_0x5b412d[_0xb051('0x36')],_0x22ac44=_0x25e37d[_0xb051('0x37')],_0x5c875b=_0x25e37d[_0xb051('0x37')]+_0x25e37d['limit'],_0x419e89;if(_0x5c875b>=_0xf05d2f){_0x5c875b=_0xf05d2f;_0x419e89=0xc8;}else{_0x419e89=0xce;}_0x55cc9b['status'](_0x419e89);return _0x55cc9b['set']('Content-Range',_0x22ac44+'-'+_0x5c875b+'/'+_0xf05d2f)[_0xb051('0x35')](_0x5b412d);}return null;};}function patchUpdates(_0x4abf53){return function(_0x164009){try{jsonpatch['apply'](_0x164009,_0x4abf53,!![]);}catch(_0x316892){return BPromise[_0xb051('0x38')](_0x316892);}return _0x164009[_0xb051('0x39')]();};}function saveUpdates(_0x4bf9d4,_0x5d6c46){return function(_0x277b91){if(_0x277b91){return _0x277b91['update'](_0x4bf9d4)[_0xb051('0x27')](function(_0x42e202){return _0x42e202;});}return null;};}function removeEntity(_0x59c5c5,_0x1e3fc5){return function(_0x5beb61){if(_0x5beb61){return _0x5beb61['destroy']()[_0xb051('0x27')](function(){_0x59c5c5[_0xb051('0x33')](0xcc)[_0xb051('0x34')]();});}};}function handleEntityNotFound(_0x14fd2c,_0x50ff99){return function(_0x4942ae){if(!_0x4942ae){_0x14fd2c['sendStatus'](0x194);}return _0x4942ae;};}function handleError(_0x15eec0,_0x368fca){_0x368fca=_0x368fca||0x1f4;return function(_0x12a315){logger[_0xb051('0x2c')](_0x12a315['stack']);if(_0x12a315[_0xb051('0x3a')]){delete _0x12a315['name'];}_0x15eec0[_0xb051('0x33')](_0x368fca)['send'](_0x12a315);};}exports[_0xb051('0x3b')]=function(_0x7ab81e,_0x30d759){var _0x41844d={},_0x2f3f7e={},_0x4ee7b1={'count':0x0,'rows':[]};var _0x311051=_[_0xb051('0x3c')](db[_0xb051('0x3d')][_0xb051('0x3e')],function(_0x5df952){return{'name':_0x5df952[_0xb051('0x3f')],'type':_0x5df952[_0xb051('0x40')]['key']};});_0x2f3f7e['model']=_[_0xb051('0x3c')](_0x311051,_0xb051('0x3a'));_0x2f3f7e['query']=_[_0xb051('0x41')](_0x7ab81e[_0xb051('0x42')]);_0x2f3f7e[_0xb051('0x43')]=_[_0xb051('0x44')](_0x2f3f7e[_0xb051('0x45')],_0x2f3f7e[_0xb051('0x42')]);_0x41844d['attributes']=_[_0xb051('0x44')](_0x2f3f7e[_0xb051('0x45')],qs[_0xb051('0x46')](_0x7ab81e[_0xb051('0x42')][_0xb051('0x46')]));_0x41844d[_0xb051('0x47')]=_0x41844d[_0xb051('0x47')][_0xb051('0x48')]?_0x41844d['attributes']:_0x2f3f7e[_0xb051('0x45')];if(!_0x7ab81e['query'][_0xb051('0x49')](_0xb051('0x4a'))){_0x41844d[_0xb051('0x4b')]=qs[_0xb051('0x4b')](_0x7ab81e[_0xb051('0x42')]['limit']);_0x41844d['offset']=qs[_0xb051('0x37')](_0x7ab81e[_0xb051('0x42')][_0xb051('0x37')]);}_0x41844d[_0xb051('0x4c')]=qs['sort'](_0x7ab81e[_0xb051('0x42')][_0xb051('0x4d')]);_0x41844d[_0xb051('0x4e')]=qs[_0xb051('0x43')](_[_0xb051('0x4f')](_0x7ab81e[_0xb051('0x42')],_0x2f3f7e['filters']),_0x311051);if(_0x7ab81e[_0xb051('0x42')][_0xb051('0x50')]){_0x41844d[_0xb051('0x4e')]=_['merge'](_0x41844d[_0xb051('0x4e')],{'$or':_['map'](_0x311051,function(_0x24191b){if(_0x24191b[_0xb051('0x40')]!==_0xb051('0x51')){var _0x555eec={};_0x555eec[_0x24191b[_0xb051('0x3a')]]={'$like':'%'+_0x7ab81e['query'][_0xb051('0x50')]+'%'};return _0x555eec;}})});}_0x41844d=_[_0xb051('0x52')]({},_0x41844d,_0x7ab81e['options']);var _0x56659c={'where':_0x41844d['where']};return db[_0xb051('0x3d')][_0xb051('0x36')](_0x56659c)['then'](function(_0x4b71de){_0x4ee7b1[_0xb051('0x36')]=_0x4b71de;if(_0x7ab81e['query'][_0xb051('0x53')]){_0x41844d['include']=[{'all':!![]}];}return db[_0xb051('0x3d')]['findAll'](_0x41844d);})['then'](function(_0x54ce19){_0x4ee7b1[_0xb051('0x54')]=_0x54ce19;return _0x4ee7b1;})['then'](respondWithFilteredResult(_0x30d759,_0x41844d))['catch'](handleError(_0x30d759,null));};exports[_0xb051('0x55')]=function(_0x97bb98,_0x7b9106){var _0xebacd2={'raw':!![],'where':{'id':_0x97bb98[_0xb051('0x56')]['id']}},_0x4a7510={};_0x4a7510[_0xb051('0x45')]=_[_0xb051('0x41')](db[_0xb051('0x3d')][_0xb051('0x3e')]);_0x4a7510[_0xb051('0x42')]=_[_0xb051('0x41')](_0x97bb98[_0xb051('0x42')]);_0x4a7510['filters']=_[_0xb051('0x44')](_0x4a7510['model'],_0x4a7510[_0xb051('0x42')]);_0xebacd2[_0xb051('0x47')]=_['intersection'](_0x4a7510[_0xb051('0x45')],qs[_0xb051('0x46')](_0x97bb98[_0xb051('0x42')]['fields']));_0xebacd2[_0xb051('0x47')]=_0xebacd2['attributes']['length']?_0xebacd2[_0xb051('0x47')]:_0x4a7510['model'];if(_0x97bb98[_0xb051('0x42')]['includeAll']){_0xebacd2[_0xb051('0x57')]=[{'all':!![]}];}_0xebacd2=_['merge']({},_0xebacd2,_0x97bb98[_0xb051('0x58')]);return db[_0xb051('0x3d')][_0xb051('0x59')](_0xebacd2)[_0xb051('0x27')](handleEntityNotFound(_0x7b9106,null))[_0xb051('0x27')](respondWithResult(_0x7b9106,null))['catch'](handleError(_0x7b9106,null));};exports[_0xb051('0x5a')]=function(_0x11c212,_0x41f379){return db[_0xb051('0x3d')][_0xb051('0x5a')](_0x11c212['body'],{})[_0xb051('0x27')](respondWithResult(_0x41f379,0xc9))[_0xb051('0x31')](handleError(_0x41f379,null));};exports[_0xb051('0x5b')]=function(_0x40a5f8,_0x4aa23f){if(_0x40a5f8['body']['id']){delete _0x40a5f8[_0xb051('0x5c')]['id'];}return db[_0xb051('0x3d')]['find']({'where':{'id':_0x40a5f8[_0xb051('0x56')]['id']}})['then'](handleEntityNotFound(_0x4aa23f,null))[_0xb051('0x27')](saveUpdates(_0x40a5f8[_0xb051('0x5c')],null))[_0xb051('0x27')](respondWithResult(_0x4aa23f,null))['catch'](handleError(_0x4aa23f,null));};exports[_0xb051('0x5d')]=function(_0x4e4fea,_0x3ebc11){return db[_0xb051('0x3d')][_0xb051('0x59')]({'where':{'id':_0x4e4fea[_0xb051('0x56')]['id']}})[_0xb051('0x27')](handleEntityNotFound(_0x3ebc11,null))[_0xb051('0x27')](removeEntity(_0x3ebc11,null))[_0xb051('0x31')](handleError(_0x3ebc11,null));};exports[_0xb051('0x5e')]=function(_0x505f0f,_0x14ae8c){return db[_0xb051('0x3d')][_0xb051('0x5e')]()['then'](respondWithResult(_0x14ae8c,null))[_0xb051('0x31')](handleError(_0x14ae8c,null));};exports['getUnread']=function(_0x557e5e,_0x213ff1,_0x23adbe){return db[_0xb051('0x5f')][_0xb051('0x36')]({'where':{'ChatGroupId':_0x557e5e[_0xb051('0x56')]['id'],'ToId':_0x557e5e['user']['id'],'read':![]}})['then'](function(_0x5a77ca){return{'id':_['toInteger'](_0x557e5e['params']['id']),'count':_0x5a77ca};})['then'](respondWithResult(_0x213ff1,null))[_0xb051('0x31')](handleError(_0x213ff1,null));};exports['addMembers']=function(_0x3aa730,_0x435a71,_0x1f2e9e){return db[_0xb051('0x3d')]['find']({'where':{'id':_0x3aa730['params']['id']}})[_0xb051('0x27')](handleEntityNotFound(_0x435a71,null))['then'](function(_0xa802d0){if(_0xa802d0){return _0xa802d0[_0xb051('0x60')](_0x3aa730[_0xb051('0x5c')][_0xb051('0x61')],_[_0xb051('0x62')](_0x3aa730['body'],[_0xb051('0x61'),'id'])||{});}})[_0xb051('0x27')](respondWithResult(_0x435a71,null))[_0xb051('0x31')](handleError(_0x435a71,null));};exports[_0xb051('0x63')]=function(_0x51ead8,_0xe20481,_0x5bb359){var _0x46ef11={};var _0x345e03={};var _0x13cd45;var _0x498451;return db[_0xb051('0x3d')]['findOne']({'where':{'id':_0x51ead8[_0xb051('0x56')]['id']}})['then'](handleEntityNotFound(_0xe20481,null))[_0xb051('0x27')](function(_0x196287){if(_0x196287){_0x13cd45=_0x196287;_0x345e03[_0xb051('0x45')]=_['keys'](db[_0xb051('0x64')][_0xb051('0x3e')]);_0x345e03[_0xb051('0x42')]=_['keys'](_0x51ead8[_0xb051('0x42')]);_0x345e03[_0xb051('0x43')]=_[_0xb051('0x44')](_0x345e03['model'],_0x345e03[_0xb051('0x42')]);_0x46ef11[_0xb051('0x47')]=_['intersection'](_0x345e03[_0xb051('0x45')],qs[_0xb051('0x46')](_0x51ead8[_0xb051('0x42')][_0xb051('0x46')]));_0x46ef11[_0xb051('0x47')]=_0x46ef11[_0xb051('0x47')][_0xb051('0x48')]?_0x46ef11[_0xb051('0x47')]:_0x345e03[_0xb051('0x45')];_0x46ef11[_0xb051('0x4c')]=qs[_0xb051('0x4d')](_0x51ead8['query']['sort']);_0x46ef11[_0xb051('0x4e')]=qs[_0xb051('0x43')](_['pick'](_0x51ead8[_0xb051('0x42')],_0x345e03[_0xb051('0x43')]));if(_0x51ead8[_0xb051('0x42')][_0xb051('0x50')]){_0x46ef11[_0xb051('0x4e')]=_['merge'](_0x46ef11['where'],{'$or':_[_0xb051('0x3c')](_0x46ef11['attributes'],function(_0x4335cf){var _0x2d35a5={};_0x2d35a5[_0x4335cf]={'$like':'%'+_0x51ead8[_0xb051('0x42')]['filter']+'%'};return _0x2d35a5;})});}_0x46ef11=_['merge']({},_0x46ef11,_0x51ead8[_0xb051('0x58')]);return _0x13cd45[_0xb051('0x63')](_0x46ef11);}})['then'](function(_0x3da99b){if(_0x3da99b){_0x498451=_0x3da99b[_0xb051('0x48')];if(!_0x51ead8[_0xb051('0x42')][_0xb051('0x49')]('nolimit')){_0x46ef11[_0xb051('0x4b')]=qs[_0xb051('0x4b')](_0x51ead8[_0xb051('0x42')][_0xb051('0x4b')]);_0x46ef11['offset']=qs[_0xb051('0x37')](_0x51ead8[_0xb051('0x42')]['offset']);}return _0x13cd45[_0xb051('0x63')](_0x46ef11);}})[_0xb051('0x27')](function(_0x13d07d){if(_0x13d07d){return _0x13d07d?{'count':_0x498451,'rows':_0x13d07d}:null;}})[_0xb051('0x27')](respondWithResult(_0xe20481,null))['catch'](handleError(_0xe20481,null));};exports[_0xb051('0x65')]=function(_0x3016d0,_0x383b9d,_0x3278b2){return db['ChatGroup'][_0xb051('0x59')]({'where':{'id':_0x3016d0[_0xb051('0x56')]['id']}})[_0xb051('0x27')](handleEntityNotFound(_0x383b9d,null))[_0xb051('0x27')](function(_0x7feac){if(_0x7feac){return _0x7feac[_0xb051('0x65')](_0x3016d0[_0xb051('0x42')][_0xb051('0x61')]);}})[_0xb051('0x27')](respondWithStatusCode(_0x383b9d,null))[_0xb051('0x31')](handleError(_0x383b9d,null));};exports[_0xb051('0x66')]=function(_0x16ddac,_0x11ce32,_0xed7f89){if(_0x16ddac[_0xb051('0x5c')]['id']){delete _0x16ddac['body']['id'];}return db['ChatGroup']['find']({'where':{'id':_0x16ddac[_0xb051('0x56')]['id']}})[_0xb051('0x27')](handleEntityNotFound(_0x11ce32,null))['then'](function(_0x47d6c3){if(_0x47d6c3){_0x16ddac[_0xb051('0x5c')][_0xb051('0x67')]=_0x47d6c3['id'];return db[_0xb051('0x5f')][_0xb051('0x5a')](_0x16ddac[_0xb051('0x5c')]);}})[_0xb051('0x27')](respondWithResult(_0x11ce32,null))['catch'](handleError(_0x11ce32,null));};exports[_0xb051('0x68')]=function(_0x1973db,_0x179b4d,_0x2e59ea){var _0x353068={};var _0x2ceeb9={};var _0x3dc90d;var _0x13e983;return db['ChatGroup'][_0xb051('0x69')]({'where':{'id':_0x1973db['params']['id']}})[_0xb051('0x27')](handleEntityNotFound(_0x179b4d,null))[_0xb051('0x27')](function(_0x489fa){if(_0x489fa){_0x3dc90d=_0x489fa;_0x2ceeb9[_0xb051('0x45')]=_[_0xb051('0x41')](db['ChatInternalMessage']['rawAttributes']);_0x2ceeb9[_0xb051('0x42')]=_['keys'](_0x1973db[_0xb051('0x42')]);_0x2ceeb9['filters']=_['intersection'](_0x2ceeb9[_0xb051('0x45')],_0x2ceeb9[_0xb051('0x42')]);_0x353068['attributes']=_[_0xb051('0x44')](_0x2ceeb9[_0xb051('0x45')],qs[_0xb051('0x46')](_0x1973db['query']['fields']));_0x353068[_0xb051('0x47')]=_0x353068[_0xb051('0x47')][_0xb051('0x48')]?_0x353068[_0xb051('0x47')]:_0x2ceeb9['model'];_0x353068['order']=qs['sort'](_0x1973db[_0xb051('0x42')][_0xb051('0x4d')]);_0x353068[_0xb051('0x4e')]=qs['filters'](_[_0xb051('0x4f')](_0x1973db[_0xb051('0x42')],_0x2ceeb9['filters']));if(_0x1973db[_0xb051('0x42')][_0xb051('0x50')]){_0x353068['where']=_[_0xb051('0x52')](_0x353068[_0xb051('0x4e')],{'$or':_[_0xb051('0x3c')](_0x353068[_0xb051('0x47')],function(_0x483548){var _0x367fd3={};_0x367fd3[_0x483548]={'$like':'%'+_0x1973db[_0xb051('0x42')][_0xb051('0x50')]+'%'};return _0x367fd3;})});}if(_0x1973db[_0xb051('0x42')][_0xb051('0x6a')]){var _0x30b9c6=_0x1973db[_0xb051('0x42')]['$gte'][_0xb051('0x6b')](',');var _0xa1b76a={};_0xa1b76a[_0x30b9c6[0x0]]={'$gte':moment(_0x30b9c6[0x1])['format'](_0xb051('0x6c'))};_0x353068[_0xb051('0x4e')]=_[_0xb051('0x52')](_0x353068[_0xb051('0x4e')],_0xa1b76a);}_0x353068=_[_0xb051('0x52')]({},_0x353068,_0x1973db[_0xb051('0x58')]);return _0x3dc90d[_0xb051('0x68')](_0x353068);}})[_0xb051('0x27')](function(_0xe931b1){if(_0xe931b1){_0x13e983=_0xe931b1[_0xb051('0x48')];if(!_0x1973db['query'][_0xb051('0x49')]('nolimit')){_0x353068[_0xb051('0x4b')]=qs['limit'](_0x1973db[_0xb051('0x42')]['limit']);_0x353068['offset']=qs[_0xb051('0x37')](_0x1973db['query'][_0xb051('0x37')]);}return _0x3dc90d[_0xb051('0x68')](_0x353068);}})[_0xb051('0x27')](function(_0xb0e906){if(_0xb0e906){return _0xb0e906?{'count':_0x13e983,'rows':_0xb0e906}:null;}})['then'](respondWithResult(_0x179b4d,null))['catch'](handleError(_0x179b4d,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 5b5baa8..5f41dc8 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 _0x5f2f=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatGroup','setMaxListeners','save','update'];(function(_0x269658,_0x50e08d){var _0x268a6b=function(_0x33313e){while(--_0x33313e){_0x269658['push'](_0x269658['shift']());}};_0x268a6b(++_0x50e08d);}(_0x5f2f,0x73));var _0xf5f2=function(_0x1ef040,_0xc6201d){_0x1ef040=_0x1ef040-0x0;var _0x45d6d6=_0x5f2f[_0x1ef040];return _0x45d6d6;};'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 +var _0x2032=['exports','../../mysqldb','ChatGroup','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0xa8883,_0x1f107f){var _0x479426=function(_0x4e56b9){while(--_0x4e56b9){_0xa8883['push'](_0xa8883['shift']());}};_0x479426(++_0x1f107f);}(_0x2032,0xd9));var _0x2203=function(_0xc2061d,_0x3f3619){_0xc2061d=_0xc2061d-0x0;var _0x20ceaf=_0x2032[_0xc2061d];return _0x20ceaf;};'use strict';var EventEmitter=require('events');var ChatGroup=require(_0x2203('0x0'))['db'][_0x2203('0x1')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x2203('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2203('0x3'),'afterDestroy':_0x2203('0x4')};function emitEvent(_0x4b4c7f){return function(_0x46c49a,_0x880dcd,_0x44ccfd){ChatGroupEvents[_0x2203('0x5')](_0x4b4c7f+':'+_0x46c49a['id'],_0x46c49a);ChatGroupEvents[_0x2203('0x5')](_0x4b4c7f,_0x46c49a);_0x44ccfd(null);};}for(var e in events){if(events[_0x2203('0x6')](e)){var event=events[e];ChatGroup[_0x2203('0x7')](e,emitEvent(event));}}module[_0x2203('0x8')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 59dd19e..cfede74 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 _0x1666=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatGroup.attributes','define','ChatGroup','chat_groups'];(function(_0x30240a,_0x53544c){var _0x246313=function(_0x24f3c0){while(--_0x24f3c0){_0x30240a['push'](_0x30240a['shift']());}};_0x246313(++_0x53544c);}(_0x1666,0x75));var _0x6166=function(_0x17acbf,_0x5a5971){_0x17acbf=_0x17acbf-0x0;var _0x45106c=_0x1666[_0x17acbf];return _0x45106c;};'use strict';var _=require(_0x6166('0x0'));var util=require(_0x6166('0x1'));var logger=require('../../config/logger')(_0x6166('0x2'));var moment=require(_0x6166('0x3'));var BPromise=require(_0x6166('0x4'));var rp=require(_0x6166('0x5'));var fs=require('fs');var path=require(_0x6166('0x6'));var rimraf=require(_0x6166('0x7'));var config=require(_0x6166('0x8'));var attributes=require(_0x6166('0x9'));module['exports']=function(_0x2ee359,_0x1d4f2a){return _0x2ee359[_0x6166('0xa')](_0x6166('0xb'),attributes,{'tableName':_0x6166('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6208=['path','rimraf','../../config/environment','./chatGroup.attributes','exports','ChatGroup','chat_groups','lodash','../../config/logger','api','bluebird'];(function(_0x2800da,_0x4ef0da){var _0xc672d6=function(_0x345ca5){while(--_0x345ca5){_0x2800da['push'](_0x2800da['shift']());}};_0xc672d6(++_0x4ef0da);}(_0x6208,0x17d));var _0x8620=function(_0x499210,_0x325b29){_0x499210=_0x499210-0x0;var _0x2e153d=_0x6208[_0x499210];return _0x2e153d;};'use strict';var _=require(_0x8620('0x0'));var util=require('util');var logger=require(_0x8620('0x1'))(_0x8620('0x2'));var moment=require('moment');var BPromise=require(_0x8620('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8620('0x4'));var rimraf=require(_0x8620('0x5'));var config=require(_0x8620('0x6'));var attributes=require(_0x8620('0x7'));module[_0x8620('0x8')]=function(_0x373f95,_0x135c32){return _0x373f95['define'](_0x8620('0x9'),attributes,{'tableName':_0x8620('0xa'),'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 b76da5d..2f8bd27 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 _0xc8fd=['ChatGroup,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./chatGroup.socket','register','then','info','ChatGroup,\x20%s,\x20%s'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xc8fd,0x102));var _0xdc8f=function(_0x2337f2,_0x591d5d){_0x2337f2=_0x2337f2-0x0;var _0x9488a2=_0xc8fd[_0x2337f2];return _0x9488a2;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xdc8f('0x0'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdc8f('0x1'))['db'];var utils=require(_0xdc8f('0x2'));var logger=require('../../config/logger')('rpc');var config=require(_0xdc8f('0x3'));var jayson=require(_0xdc8f('0x4'));var client=jayson[_0xdc8f('0x5')][_0xdc8f('0x6')]({'port':0x232a});config[_0xdc8f('0x7')]=_[_0xdc8f('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xdc8f('0x9'))(new Redis(config[_0xdc8f('0x7')]));require(_0xdc8f('0xa'))[_0xdc8f('0xb')](socket);function respondWithRpcPromise(_0x4c1dce,_0x211cf5,_0x5c2728){return new BPromise(function(_0x43a978,_0xe86349){return client['request'](_0x4c1dce,_0x5c2728)[_0xdc8f('0xc')](function(_0xecf6bd){logger[_0xdc8f('0xd')](_0xdc8f('0xe'),_0x211cf5,'request\x20sent');logger['debug'](_0xdc8f('0xf'),_0x211cf5,'request\x20sent',JSON['stringify'](_0xecf6bd));if(_0xecf6bd['error']){if(_0xecf6bd[_0xdc8f('0x10')][_0xdc8f('0x11')]===0x1f4){logger['error'](_0xdc8f('0xe'),_0x211cf5,_0xecf6bd[_0xdc8f('0x10')][_0xdc8f('0x12')]);return _0xe86349(_0xecf6bd[_0xdc8f('0x10')][_0xdc8f('0x12')]);}logger[_0xdc8f('0x10')](_0xdc8f('0xe'),_0x211cf5,_0xecf6bd[_0xdc8f('0x10')][_0xdc8f('0x12')]);return _0x43a978(_0xecf6bd[_0xdc8f('0x10')][_0xdc8f('0x12')]);}else{logger['info'](_0xdc8f('0xe'),_0x211cf5,'request\x20sent');_0x43a978(_0xecf6bd[_0xdc8f('0x13')][_0xdc8f('0x12')]);}})[_0xdc8f('0x14')](function(_0x3e72a0){logger[_0xdc8f('0x10')](_0xdc8f('0xe'),_0x211cf5,_0x3e72a0);_0xe86349(_0x3e72a0);});});} \ No newline at end of file +var _0xec1c=['randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','defaults','redis','socket.io-emitter','request','info','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ChatGroup,\x20%s,\x20%s','result','catch','lodash','bluebird'];(function(_0x4c802c,_0x45e190){var _0x170db1=function(_0x4c0b3c){while(--_0x4c0b3c){_0x4c802c['push'](_0x4c802c['shift']());}};_0x170db1(++_0x45e190);}(_0xec1c,0x148));var _0xcec1=function(_0x41cf04,_0x41e49b){_0x41cf04=_0x41cf04-0x0;var _0x270ada=_0xec1c[_0x41cf04];return _0x270ada;};'use strict';var _=require(_0xcec1('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xcec1('0x1'));var rs=require(_0xcec1('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xcec1('0x3'));var logger=require(_0xcec1('0x4'))(_0xcec1('0x5'));var config=require(_0xcec1('0x6'));var jayson=require(_0xcec1('0x7'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0xcec1('0x8')](config[_0xcec1('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xcec1('0xa'))(new Redis(config['redis']));require('./chatGroup.socket')['register'](socket);function respondWithRpcPromise(_0x55aed7,_0x35b1e9,_0x4c5629){return new BPromise(function(_0x302d51,_0x2d1085){return client[_0xcec1('0xb')](_0x55aed7,_0x4c5629)['then'](function(_0xb6c76){logger[_0xcec1('0xc')]('ChatGroup,\x20%s,\x20%s',_0x35b1e9,'request\x20sent');logger[_0xcec1('0xd')](_0xcec1('0xe'),_0x35b1e9,'request\x20sent',JSON[_0xcec1('0xf')](_0xb6c76));if(_0xb6c76[_0xcec1('0x10')]){if(_0xb6c76[_0xcec1('0x10')][_0xcec1('0x11')]===0x1f4){logger[_0xcec1('0x10')]('ChatGroup,\x20%s,\x20%s',_0x35b1e9,_0xb6c76['error'][_0xcec1('0x12')]);return _0x2d1085(_0xb6c76[_0xcec1('0x10')][_0xcec1('0x12')]);}logger[_0xcec1('0x10')](_0xcec1('0x13'),_0x35b1e9,_0xb6c76[_0xcec1('0x10')][_0xcec1('0x12')]);return _0x302d51(_0xb6c76[_0xcec1('0x10')]['message']);}else{logger[_0xcec1('0xc')]('ChatGroup,\x20%s,\x20%s',_0x35b1e9,'request\x20sent');_0x302d51(_0xb6c76[_0xcec1('0x14')][_0xcec1('0x12')]);}})[_0xcec1('0x15')](function(_0x44f1ff){logger[_0xcec1('0x10')]('ChatGroup,\x20%s,\x20%s',_0x35b1e9,_0x44f1ff);_0x2d1085(_0x44f1ff);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 3d08fbe..c2e20e3 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 _0x08f3=['removeListener','register','chatGroup:','./chatGroup.events','save','remove','update','emit'];(function(_0x2da230,_0x5a5dfc){var _0x3504a9=function(_0x5bc685){while(--_0x5bc685){_0x2da230['push'](_0x2da230['shift']());}};_0x3504a9(++_0x5a5dfc);}(_0x08f3,0x143));var _0x308f=function(_0x4712b3,_0x435df1){_0x4712b3=_0x4712b3-0x0;var _0x2448eb=_0x08f3[_0x4712b3];return _0x2448eb;};'use strict';var ChatGroupEvents=require(_0x308f('0x0'));var events=[_0x308f('0x1'),_0x308f('0x2'),_0x308f('0x3')];function createListener(_0x407dbd,_0x7cc5f7){return function(_0x16b618){_0x7cc5f7[_0x308f('0x4')](_0x407dbd,_0x16b618);};}function removeListener(_0x57f8c2,_0x2c5913){return function(){ChatGroupEvents[_0x308f('0x5')](_0x57f8c2,_0x2c5913);};}exports[_0x308f('0x6')]=function(_0x2326fa){for(var _0x3ad512=0x0,_0x2819d9=events['length'];_0x3ad512<_0x2819d9;_0x3ad512++){var _0x197ddc=events[_0x3ad512];var _0x393aca=createListener(_0x308f('0x7')+_0x197ddc,_0x2326fa);ChatGroupEvents['on'](_0x197ddc,_0x393aca);}}; \ No newline at end of file +var _0x2716=['removeListener','register','length','chatGroup:','./chatGroup.events','save','update'];(function(_0x4ebc40,_0x569bbb){var _0x1ee9f9=function(_0x540309){while(--_0x540309){_0x4ebc40['push'](_0x4ebc40['shift']());}};_0x1ee9f9(++_0x569bbb);}(_0x2716,0x1af));var _0x6271=function(_0x2f506e,_0x2bef86){_0x2f506e=_0x2f506e-0x0;var _0x1a67b2=_0x2716[_0x2f506e];return _0x1a67b2;};'use strict';var ChatGroupEvents=require(_0x6271('0x0'));var events=[_0x6271('0x1'),'remove',_0x6271('0x2')];function createListener(_0x53ba14,_0x203be9){return function(_0x131edb){_0x203be9['emit'](_0x53ba14,_0x131edb);};}function removeListener(_0x5c0198,_0x51ec06){return function(){ChatGroupEvents[_0x6271('0x3')](_0x5c0198,_0x51ec06);};}exports[_0x6271('0x4')]=function(_0x25d3f3){for(var _0x597852=0x0,_0x166f92=events[_0x6271('0x5')];_0x597852<_0x166f92;_0x597852++){var _0x207fde=events[_0x597852];var _0x49d5c1=createListener(_0x6271('0x6')+_0x207fde,_0x25d3f3);ChatGroupEvents['on'](_0x207fde,_0x49d5c1);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 88db467..4ab7759 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 _0x80a3=['../../components/interaction/service','../../config/environment','./chatGroup.controller','index','get','/describe','isAuthenticated','/:id','show','/:id/unread','getUnread','/:id/members','getMembers','getMessages','post','create','addMembers','addMessage','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x531a78,_0x477d97){var _0x13ed6e=function(_0x11134c){while(--_0x11134c){_0x531a78['push'](_0x531a78['shift']());}};_0x13ed6e(++_0x477d97);}(_0x80a3,0x69));var _0x380a=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0x80a3[_0x134c2e];return _0x2825db;};'use strict';var multer=require(_0x380a('0x0'));var util=require(_0x380a('0x1'));var path=require(_0x380a('0x2'));var timeout=require(_0x380a('0x3'));var express=require(_0x380a('0x4'));var router=express[_0x380a('0x5')]();var auth=require(_0x380a('0x6'));var interaction=require(_0x380a('0x7'));var config=require(_0x380a('0x8'));var controller=require(_0x380a('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x380a('0xa')]);router[_0x380a('0xb')](_0x380a('0xc'),auth[_0x380a('0xd')](),controller['describe']);router[_0x380a('0xb')](_0x380a('0xe'),auth[_0x380a('0xd')](),controller[_0x380a('0xf')]);router['get'](_0x380a('0x10'),auth[_0x380a('0xd')](),controller[_0x380a('0x11')]);router['get'](_0x380a('0x12'),auth[_0x380a('0xd')](),controller[_0x380a('0x13')]);router['get']('/:id/messages',auth[_0x380a('0xd')](),controller[_0x380a('0x14')]);router[_0x380a('0x15')]('/',auth[_0x380a('0xd')](),controller[_0x380a('0x16')]);router[_0x380a('0x15')](_0x380a('0x12'),auth[_0x380a('0xd')](),controller[_0x380a('0x17')]);router['post']('/:id/messages',auth[_0x380a('0xd')](),controller[_0x380a('0x18')]);router['put'](_0x380a('0xe'),auth[_0x380a('0xd')](),controller[_0x380a('0x19')]);router[_0x380a('0x1a')]('/:id',auth[_0x380a('0xd')](),controller[_0x380a('0x1b')]);router[_0x380a('0x1a')]('/:id/members',auth['isAuthenticated'](),controller['removeMembers']);module['exports']=router; \ No newline at end of file +var _0xb8b5=['/describe','isAuthenticated','describe','get','/:id','show','/:id/unread','getUnread','getMembers','/:id/messages','post','create','/:id/members','addMessage','update','delete','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatGroup.controller'];(function(_0x422b2a,_0x2f107a){var _0x8dbded=function(_0x53cf4b){while(--_0x53cf4b){_0x422b2a['push'](_0x422b2a['shift']());}};_0x8dbded(++_0x2f107a);}(_0xb8b5,0xe2));var _0x5b8b=function(_0x307666,_0x2cd5da){_0x307666=_0x307666-0x0;var _0x1f6743=_0xb8b5[_0x307666];return _0x1f6743;};'use strict';var multer=require('multer');var util=require(_0x5b8b('0x0'));var path=require('path');var timeout=require(_0x5b8b('0x1'));var express=require(_0x5b8b('0x2'));var router=express[_0x5b8b('0x3')]();var auth=require(_0x5b8b('0x4'));var interaction=require(_0x5b8b('0x5'));var config=require(_0x5b8b('0x6'));var controller=require(_0x5b8b('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x5b8b('0x8'),auth[_0x5b8b('0x9')](),controller[_0x5b8b('0xa')]);router[_0x5b8b('0xb')](_0x5b8b('0xc'),auth[_0x5b8b('0x9')](),controller[_0x5b8b('0xd')]);router['get'](_0x5b8b('0xe'),auth['isAuthenticated'](),controller[_0x5b8b('0xf')]);router[_0x5b8b('0xb')]('/:id/members',auth['isAuthenticated'](),controller[_0x5b8b('0x10')]);router[_0x5b8b('0xb')](_0x5b8b('0x11'),auth['isAuthenticated'](),controller['getMessages']);router[_0x5b8b('0x12')]('/',auth[_0x5b8b('0x9')](),controller[_0x5b8b('0x13')]);router[_0x5b8b('0x12')](_0x5b8b('0x14'),auth[_0x5b8b('0x9')](),controller['addMembers']);router[_0x5b8b('0x12')](_0x5b8b('0x11'),auth['isAuthenticated'](),controller[_0x5b8b('0x15')]);router['put'](_0x5b8b('0xc'),auth[_0x5b8b('0x9')](),controller[_0x5b8b('0x16')]);router[_0x5b8b('0x17')](_0x5b8b('0xc'),auth[_0x5b8b('0x9')](),controller[_0x5b8b('0x18')]);router['delete'](_0x5b8b('0x14'),auth[_0x5b8b('0x9')](),controller['removeMembers']);module[_0x5b8b('0x19')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index a803a77..0954bb0 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 _0x6d6a=['ENUM','star','TEXT','STRING','DATE','out','INTEGER'];(function(_0x3556b5,_0x5eb8c1){var _0x3640bc=function(_0x731ee4){while(--_0x731ee4){_0x3556b5['push'](_0x3556b5['shift']());}};_0x3640bc(++_0x5eb8c1);}(_0x6d6a,0x68));var _0xa6d6=function(_0x15876a,_0x15383d){_0x15876a=_0x15876a-0x0;var _0xbd900f=_0x6d6a[_0x15876a];return _0xbd900f;};'use strict';var Sequelize=require('sequelize');module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0xa6d6('0x0')]},'ratingType':{'type':Sequelize[_0xa6d6('0x1')](_0xa6d6('0x2'),'thumb'),'defaultValue':_0xa6d6('0x2')},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize[_0xa6d6('0x3')]},'mailTranscript':{'type':Sequelize[_0xa6d6('0x4')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xa6d6('0x5')]},'disposition':{'type':Sequelize[_0xa6d6('0x4')]},'note':{'type':Sequelize[_0xa6d6('0x4')]},'browserName':{'type':Sequelize[_0xa6d6('0x4')]},'browserVersion':{'type':Sequelize[_0xa6d6('0x4')]},'osName':{'type':Sequelize[_0xa6d6('0x4')]},'osVersion':{'type':Sequelize['STRING']},'deviceModel':{'type':Sequelize[_0xa6d6('0x4')]},'deviceVendor':{'type':Sequelize[_0xa6d6('0x4')]},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize['TEXT']},'customerIp':{'type':Sequelize[_0xa6d6('0x4')]},'formData':{'type':Sequelize[_0xa6d6('0x3')]('long')},'read1stAt':{'type':Sequelize[_0xa6d6('0x5')]},'lastMsgAt':{'type':Sequelize[_0xa6d6('0x5')]},'lastMsgDirection':{'type':Sequelize[_0xa6d6('0x1')]('in',_0xa6d6('0x6')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize['STRING']},'customerPort':{'type':Sequelize[_0xa6d6('0x4')]},'vidaooSessionId':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x4fa1=['INTEGER','star','thumb','TEXT','STRING','long','DATE','exports','BOOLEAN'];(function(_0xe973ec,_0x5aa943){var _0x69dacf=function(_0x48a4e2){while(--_0x48a4e2){_0xe973ec['push'](_0xe973ec['shift']());}};_0x69dacf(++_0x5aa943);}(_0x4fa1,0x1d2));var _0x14fa=function(_0x3221e7,_0x246805){_0x3221e7=_0x3221e7-0x0;var _0x408263=_0x4fa1[_0x3221e7];return _0x408263;};'use strict';var Sequelize=require('sequelize');module[_0x14fa('0x0')]={'closed':{'type':Sequelize[_0x14fa('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x14fa('0x2')]},'ratingType':{'type':Sequelize['ENUM'](_0x14fa('0x3'),_0x14fa('0x4')),'defaultValue':_0x14fa('0x3')},'ratingMessage':{'type':Sequelize[_0x14fa('0x5')]},'pathTranscript':{'type':Sequelize[_0x14fa('0x5')]},'mailTranscript':{'type':Sequelize[_0x14fa('0x6')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x14fa('0x6')]},'browserName':{'type':Sequelize[_0x14fa('0x6')]},'browserVersion':{'type':Sequelize[_0x14fa('0x6')]},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize[_0x14fa('0x6')]},'deviceModel':{'type':Sequelize['STRING']},'deviceVendor':{'type':Sequelize[_0x14fa('0x6')]},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize['TEXT']},'customerIp':{'type':Sequelize[_0x14fa('0x6')]},'formData':{'type':Sequelize['TEXT'](_0x14fa('0x7'))},'read1stAt':{'type':Sequelize[_0x14fa('0x8')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize['STRING']},'customerPort':{'type':Sequelize[_0x14fa('0x6')]},'vidaooSessionId':{'type':Sequelize[_0x14fa('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 2cd78bf..9ceeb79 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 _0x1623=['having','`unreadMessages`\x20>\x200','tag','isArray','replace','\x27\x27\x27\x27','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','t.id\x20IN\x20?','resolve','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','getChatWebsites','isEmpty','i.ChatWebsiteId\x20IS\x20NULL','sequelize','toString','keyBy','merge','Account.key','a.mandatoryDisposition','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.phone','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','ui.ChatInteractionId\x20IN\x20?','groupBy','ChatInteractionId','all','rows','show','ChatInteraction','includeAll','include','create','update','params','describe','createVidaooSession','findOne','ChatWebsite','vidaooApiKey','POST','https://api-vidaoo.xcally.com/api/v1/sessions','MotionCWB:','follow','Error\x20in\x20Vidaoo\x20configuration','join_url','out','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','Interaction\x20already\x20assigned','closed','disposition','AbandonInteraction','attachmentUpload','originalname','basename','filename','file','mimetype','Attachment','attachmentDownload','Unauthorized','download','root','server/files/attachments/','close','mailTranscript','format','transcript-%s.txt','now','ChatMessage','Messages','CmContact','%s%d','agentAlias','System','customer','Visitor','website_alias','agent_alias','alias','fullname','agent_fullname','MM/DD/YYYY\x20HH:mm:ss','secret','appendFileSync','MailAccount','Smtp','service','host','port','secure','authentication','pass','SendMail','\x22%s\x22\x20<%s>','email','Mail\x20Transcript','addMessage','omit','ids','getMessages','pick','filter','options','findAll','getMyMessages','includeAgent','addTags','spread','Tag','emit','removeTags','unix','join','files','attachments','transcript-%d-%s.zip','push','lastName','direction','Account','Owner','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','Chat','YYYY-MM-DD','N.A.','YYYY-MM-DD\x20HH:mm:ss','browserName','osName','referer','customerPort','tail','existsSync','createReadStream','pipe','createWriteStream','renderFile','server','downloadInteraction.html','toFile','.pdf','log','err','unlinkSync','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./chatInteraction.socket','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','error','code','ChatInteraction,\x20%s,\x20%s','message','info','result','catch','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','then','end','name','Users','Tags','TagIds','split','forEach','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','field','color','from','tools_tags','select','u.fullname','ui.ChatInteractionId','user_has_chat_interactions','left_join','users','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','chat_websites','chat_messages','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','expr','search','parseSearch','conditions','find','unreadMessages','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','value','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','start','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','body','some','compact','ChatWebsiteId','i.ChatWebsiteId\x20IN\x20?','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','where','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200'];(function(_0x33be9d,_0x41618e){var _0x4a9267=function(_0x4f0e70){while(--_0x4f0e70){_0x33be9d['push'](_0x33be9d['shift']());}};_0x4a9267(++_0x41618e);}(_0x1623,0xab));var _0x3162=function(_0x4804e7,_0x69ba34){_0x4804e7=_0x4804e7-0x0;var _0x318d9c=_0x1623[_0x4804e7];return _0x318d9c;};'use strict';var pdf=require(_0x3162('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3162('0x1'));var jsonpatch=require(_0x3162('0x2'));var rp=require(_0x3162('0x3'));var moment=require(_0x3162('0x4'));var BPromise=require(_0x3162('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x3162('0x6'));var sox=require('sox');var csv=require(_0x3162('0x7'));var ejs=require(_0x3162('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x3162('0x9'));var crypto=require(_0x3162('0xa'));var jsforce=require(_0x3162('0xb'));var deskjs=require(_0x3162('0xc'));var toCsv=require(_0x3162('0x7'));var querystring=require(_0x3162('0xd'));var Papa=require(_0x3162('0xe'));var Redis=require(_0x3162('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3162('0x10'));var hardwareService=require(_0x3162('0x11'));var logger=require(_0x3162('0x12'))(_0x3162('0x13'));var utils=require(_0x3162('0x14'));var config=require(_0x3162('0x15'));var db=require(_0x3162('0x16'))['db'];config[_0x3162('0x17')]=_[_0x3162('0x18')](config['redis'],{'host':_0x3162('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3162('0x17')]));require(_0x3162('0x1a'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x3162('0x1b')][_0x3162('0x1c')]({'port':0x232b});var client9004=jayson[_0x3162('0x1b')]['http']({'port':0x232c});function checkPasswordPattern(_0x15e348,_0x3d0bea,_0x2705d1){if(_0x2705d1){var _0x490371=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x490371[_0x3162('0x1d')](_0x3d0bea)){return _0x15e348;}else{throw new db[(_0x3162('0x1e'))][(_0x3162('0x1f'))](_0x3162('0x20'));}}else{return _0x15e348;}}function respondWithRpcPromise(_0x930415,_0x1eed46,_0x391d97,_0x4b2bf3){return new BPromise(function(_0x42f283,_0x1e3d75){var _0x460b7b=_0x4b2bf3||client;return _0x460b7b[_0x3162('0x21')](_0x930415,_0x391d97)['then'](function(_0x1dfd5c){logger['info']('ChatInteraction,\x20%s,\x20%s',_0x1eed46,_0x3162('0x22'));logger[_0x3162('0x23')](_0x3162('0x24'),_0x1eed46,'request\x20sent',JSON['stringify'](_0x1dfd5c));if(_0x1dfd5c[_0x3162('0x25')]){if(_0x1dfd5c[_0x3162('0x25')][_0x3162('0x26')]===0x1f4){logger[_0x3162('0x25')](_0x3162('0x27'),_0x1eed46,_0x1dfd5c[_0x3162('0x25')][_0x3162('0x28')]);return _0x1e3d75(_0x1dfd5c[_0x3162('0x25')]['message']);}logger[_0x3162('0x25')](_0x3162('0x27'),_0x1eed46,_0x1dfd5c[_0x3162('0x25')][_0x3162('0x28')]);return _0x42f283(_0x1dfd5c[_0x3162('0x25')][_0x3162('0x28')]);}else{logger[_0x3162('0x29')](_0x3162('0x27'),_0x1eed46,_0x3162('0x22'));_0x42f283(_0x1dfd5c[_0x3162('0x2a')][_0x3162('0x28')]);}})[_0x3162('0x2b')](function(_0x1c03a4){logger['error'](_0x3162('0x27'),_0x1eed46,_0x1c03a4);_0x1e3d75(_0x1c03a4);});});}function respondWithStatusCode(_0x552469,_0x37acdd){_0x37acdd=_0x37acdd||0xcc;return function(_0x31f7fd){if(_0x31f7fd){return _0x552469[_0x3162('0x2c')](_0x37acdd);}return _0x552469['status'](_0x37acdd)['end']();};}function respondWithResult(_0xda0389,_0xaa1f35){_0xaa1f35=_0xaa1f35||0xc8;return function(_0x14df16){if(_0x14df16){return _0xda0389[_0x3162('0x2d')](_0xaa1f35)[_0x3162('0x2e')](_0x14df16);}};}function respondWithFilteredResult(_0x5c2d28,_0x8a7bce){return function(_0x4e3cc2){if(_0x4e3cc2){var _0xf11765=_0x4e3cc2[_0x3162('0x2f')],_0x3a188e=_0x8a7bce[_0x3162('0x30')],_0x41e933=_0x8a7bce[_0x3162('0x30')]+_0x8a7bce[_0x3162('0x31')],_0x221b38;if(_0x41e933>=_0xf11765){_0x41e933=_0xf11765;_0x221b38=0xc8;}else{_0x221b38=0xce;}_0x5c2d28['status'](_0x221b38);return _0x5c2d28[_0x3162('0x32')](_0x3162('0x33'),_0x3a188e+'-'+_0x41e933+'/'+_0xf11765)['json'](_0x4e3cc2);}return null;};}function patchUpdates(_0x110bb4){return function(_0x155b78){try{jsonpatch['apply'](_0x155b78,_0x110bb4,!![]);}catch(_0x5b7efb){return BPromise[_0x3162('0x34')](_0x5b7efb);}return _0x155b78['save']();};}function saveUpdates(_0x266aab,_0x47241c){return function(_0x1de909){if(_0x1de909){return _0x1de909['update'](_0x266aab)['then'](function(_0x3bb9d0){return _0x3bb9d0;});}return null;};}function removeEntity(_0x1cf9a6,_0x5d8714){return function(_0x1a79fc){if(_0x1a79fc){return _0x1a79fc['destroy']()[_0x3162('0x35')](function(){_0x1cf9a6[_0x3162('0x2d')](0xcc)[_0x3162('0x36')]();});}};}function handleEntityNotFound(_0x137e9b,_0x435aed){return function(_0x3b6c91){if(!_0x3b6c91){_0x137e9b[_0x3162('0x2c')](0x194);}return _0x3b6c91;};}function handleError(_0x25951b,_0x3ee5f8){_0x3ee5f8=_0x3ee5f8||0x1f4;return function(_0x16c5d6){logger[_0x3162('0x25')](_0x16c5d6['stack']);if(_0x16c5d6[_0x3162('0x37')]){delete _0x16c5d6[_0x3162('0x37')];}_0x25951b[_0x3162('0x2d')](_0x3ee5f8)['send'](_0x16c5d6);};}function getInteractionUsers(_0x59759d,_0x3b0a0b){return new BPromise(function(_0x124c92,_0x2e1ab5){try{if(_0x3b0a0b[_0x59759d['id']]){_0x59759d[_0x3162('0x38')]=_['map'](_0x3b0a0b[_0x59759d['id']],function(_0x4186b6){return{'id':_0x4186b6['id'],'fullname':_0x4186b6['fullname']};});}}catch(_0x59e049){_0x2e1ab5(_0x59e049);}_0x124c92(_0x59759d);});}function getInteractionTags(_0x5dee49,_0x298ed7){return new BPromise(function(_0x3fe4d2,_0x315fdb){try{if(_0x5dee49['TagIds']){_0x5dee49[_0x3162('0x39')]=[];_0x5dee49[_0x3162('0x3a')][_0x3162('0x3b')](',')[_0x3162('0x3c')](function(_0x1e8d5e){_0x5dee49['Tags']['push'](_0x298ed7[_0x1e8d5e]);});}delete _0x5dee49[_0x3162('0x3a')];}catch(_0x3783bd){_0x315fdb(_0x3783bd);}_0x3fe4d2(_0x5dee49);});}function updateChatInteraction(_0x5ae385,_0x5960cd,_0x43f780){return new BPromise(function(_0x32c960,_0x379756){return getInteractionUsers(_0x5ae385,_0x43f780)['then'](function(_0x3502ba){return getInteractionTags(_0x3502ba,_0x5960cd);})[_0x3162('0x35')](function(_0x1831f5){_0x32c960(_0x1831f5);})[_0x3162('0x2b')](function(_0x534708){_0x379756(_0x534708);});});}exports[_0x3162('0x3d')]=function(_0x282e3e,_0x522cce){var _0x1d78de={},_0x337352={},_0x500e6b={'count':0x0,'rows':[]};var _0xbb8846=_[_0x3162('0x3e')](db['ChatInteraction'][_0x3162('0x3f')],function(_0x555d33){return{'name':_0x555d33[_0x3162('0x40')],'type':_0x555d33[_0x3162('0x41')][_0x3162('0x42')]};});_0x337352[_0x3162('0x43')]=_[_0x3162('0x3e')](_0xbb8846,_0x3162('0x37'));_0x337352['query']=_[_0x3162('0x44')](_0x282e3e[_0x3162('0x45')]);_0x337352[_0x3162('0x46')]=_['intersection'](_0x337352[_0x3162('0x43')],_0x337352[_0x3162('0x45')]);_0x1d78de['attributes']=_[_0x3162('0x47')](_0x337352['model'],qs['fields'](_0x282e3e['query'][_0x3162('0x48')]));_0x1d78de[_0x3162('0x49')]=_0x1d78de[_0x3162('0x49')][_0x3162('0x4a')]?_0x1d78de[_0x3162('0x49')]:_0x337352[_0x3162('0x43')];if(!_0x282e3e[_0x3162('0x45')][_0x3162('0x4b')](_0x3162('0x4c'))){_0x1d78de[_0x3162('0x31')]=qs[_0x3162('0x31')](_0x282e3e[_0x3162('0x45')][_0x3162('0x31')]);_0x1d78de['offset']=qs[_0x3162('0x30')](_0x282e3e['query']['offset']);}_0x1d78de[_0x3162('0x4d')]=qs[_0x3162('0x4e')](_0x282e3e[_0x3162('0x45')][_0x3162('0x4e')]);_0x1d78de['where']=qs[_0x3162('0x46')](_['pick'](_0x282e3e[_0x3162('0x45')],_0x337352[_0x3162('0x46')]),_0xbb8846);var _0x4b23e8=[];var _0x146758=squel['select']()['field']('id')[_0x3162('0x4f')](_0x3162('0x37'))[_0x3162('0x4f')](_0x3162('0x50'))[_0x3162('0x51')](_0x3162('0x52'));var _0x871a24=squel[_0x3162('0x53')]()['field']('u.id')['field'](_0x3162('0x54'))[_0x3162('0x4f')](_0x3162('0x55'))[_0x3162('0x51')](_0x3162('0x56'),'ui')[_0x3162('0x57')](_0x3162('0x58'),'u','u.id\x20=\x20ui.UserId');var _0x1f35ae=squel['select']()[_0x3162('0x51')]('chat_interactions','i')[_0x3162('0x57')]('cm_contacts','c',_0x3162('0x59'))[_0x3162('0x57')]('users','o','o.id\x20=\x20i.UserId')[_0x3162('0x57')](_0x3162('0x5a'),'a','a.id\x20=\x20i.ChatWebsiteId')[_0x3162('0x57')](_0x3162('0x5b'),'me',_0x3162('0x5c'))[_0x3162('0x57')](_0x3162('0x5d'),'it','it.ChatInteractionId\x20=\x20i.id')[_0x3162('0x57')](_0x3162('0x52'),'t','t.id\x20=\x20it.TagId');var _0x5e1f2b=squel[_0x3162('0x5e')]();var _0x6ed643=[];var _0x27eaba=squel['expr']();var _0xf7d3e1;if(_0x282e3e[_0x3162('0x45')][_0x3162('0x5f')]){_0xf7d3e1=as[_0x3162('0x60')](_0x282e3e['query'][_0x3162('0x5f')]);var _0x286aad=_0xf7d3e1['sqlOperator'];for(var _0x3179a=0x0;_0x3179a<_0xf7d3e1['conditions'][_0x3162('0x4a')];_0x3179a++){var _0x1b0f2b=_0xf7d3e1[_0x3162('0x61')][_0x3179a];var _0x53ad9b='i';var _0x291aa7=_[_0x3162('0x62')](_0xbb8846,[_0x3162('0x37'),_0x1b0f2b[_0x3162('0x4f')]]);if(!_0x291aa7){switch(_0x1b0f2b[_0x3162('0x4f')]){case _0x3162('0x63'):if(_0x1b0f2b['value']==0x1){_0x1f35ae['having']('`'+_0x1b0f2b['field']+_0x3162('0x64'));}else{_0x1f35ae['having']('`'+_0x1b0f2b[_0x3162('0x4f')]+_0x3162('0x65'));}break;case _0x3162('0x66'):if(_0x1b0f2b[_0x3162('0x67')]===_0x3162('0x68')){if(_0x1b0f2b['value']['split']('\x20')[_0x3162('0x4a')]>0x1){_0x5e1f2b[_0x286aad](_0x3162('0x69'),qs['getFullTextValue'](_0x1b0f2b[_0x3162('0x6a')]),null);}else{var _0x2bd1ba='%'+_0x1b0f2b[_0x3162('0x6a')]+'%';_0x5e1f2b[_0x286aad](_0x3162('0x6b'),_0x2bd1ba,_0x2bd1ba,_0x2bd1ba);}}else{_0x291aa7=_[_0x3162('0x62')](_0xbb8846,['name',_0x3162('0x6c')]);_0x1b0f2b[_0x3162('0x4f')]=_0x3162('0x6c');_0x355cae=as[_0x3162('0x6d')](_0x53ad9b,_0x291aa7[_0x3162('0x41')],_0x1b0f2b);_0x5e1f2b[_0x286aad](_0x355cae['text'],_0x355cae[_0x3162('0x6a')][_0x3162('0x6e')],_0x355cae[_0x3162('0x6a')][_0x3162('0x36')]);}break;case'Tag':var _0x134a99=_0x1b0f2b[_0x3162('0x6a')][_0x3162('0x3b')](',')[_0x3162('0x3e')](function(_0x2f6fa2){return Number(_0x2f6fa2);});_0x134a99[_0x3162('0x3c')](function(_0xbc75f){_0x27eaba['or'](_0x3162('0x6f'),'%,'+_0xbc75f+',%');});_0x6ed643=_[_0x3162('0x70')](_0x6ed643,_0x134a99);break;case _0x3162('0x71'):if(_0x1b0f2b['operator']===_0x3162('0x68')){_0x5e1f2b[_0x286aad](_0x3162('0x72'),'%'+_0x1b0f2b['value']+'%',null);}else{_0x291aa7=_[_0x3162('0x62')](_0xbb8846,['name',_0x3162('0x73')]);_0x1b0f2b[_0x3162('0x4f')]=_0x3162('0x73');_0x355cae=as[_0x3162('0x6d')](_0x53ad9b,_0x291aa7[_0x3162('0x41')],_0x1b0f2b);_0x5e1f2b[_0x286aad](_0x355cae[_0x3162('0x74')],_0x355cae['value'][_0x3162('0x6e')],_0x355cae[_0x3162('0x6a')][_0x3162('0x36')]);}break;case _0x3162('0x75'):_0x355cae=as[_0x3162('0x6d')]('me',null,_0x1b0f2b);_0x5e1f2b[_0x286aad](_0x355cae[_0x3162('0x74')],_0x355cae['value'][_0x3162('0x6e')],_0x355cae[_0x3162('0x6a')][_0x3162('0x36')]);break;}}else{var _0x355cae=as[_0x3162('0x6d')](_0x53ad9b,_0x291aa7[_0x3162('0x41')],_0x1b0f2b);_0x5e1f2b[_0x286aad](_0x355cae[_0x3162('0x74')],_0x355cae['value']['start'],_0x355cae['value'][_0x3162('0x36')]);}}}else{var _0x3b4afd=_(_0x282e3e['query'])[_0x3162('0x44')]()[_0x3162('0x3e')](function(_0x4acd77){return _[_0x3162('0x76')](_0xbb8846,['name',_0x4acd77])?_0x4acd77:undefined;})[_0x3162('0x77')]()[_0x3162('0x6a')]();if(!_['isEmpty'](_0x3b4afd)){_0x3b4afd[_0x3162('0x3c')](function(_0x5e5892){if(_0x5e5892===_0x3162('0x78')){_0x1f35ae['where'](_0x3162('0x79'),[]['concat'](_0x282e3e[_0x3162('0x45')][_0x5e5892]));}else if(_0x5e5892===_0x3162('0x7a')){var _0x22c234=JSON[_0x3162('0x7b')](_0x282e3e[_0x3162('0x45')][_0x5e5892])[_0x3162('0x7c')];var _0x5885dd=JSON[_0x3162('0x7b')](_0x282e3e[_0x3162('0x45')][_0x5e5892])[_0x3162('0x7d')];_0x1f35ae['where'](_0x3162('0x7e'),_0x22c234,_0x5885dd);}else{if(_0x282e3e[_0x3162('0x45')][_0x5e5892]===_0x3162('0x7f')){_0x1f35ae[_0x3162('0x80')]('i.'+_0x5e5892+_0x3162('0x81'));}else{_0x1f35ae['where']('i.'+_0x5e5892+_0x3162('0x82'),_0x282e3e[_0x3162('0x45')][_0x5e5892]);}}});}if(_0x282e3e['query']['read']){if(_0x282e3e[_0x3162('0x45')][_0x3162('0x83')]==0x1){_0x1f35ae['having'](_0x3162('0x84'));}else{_0x1f35ae[_0x3162('0x85')](_0x3162('0x86'));}}if(_0x282e3e[_0x3162('0x45')][_0x3162('0x87')]){_0x6ed643=_[_0x3162('0x88')](_0x282e3e[_0x3162('0x45')][_0x3162('0x87')])?_0x282e3e[_0x3162('0x45')]['tag']:new Array(_0x282e3e['query'][_0x3162('0x87')]);_0x6ed643[_0x3162('0x3c')](function(_0x5d9af1){_0x27eaba['or'](_0x3162('0x6f'),'%,'+_0x5d9af1+',%');});}if(_0x282e3e['query']['filter']){var _0x4bc14c=_0x282e3e[_0x3162('0x45')]['filter'][_0x3162('0x89')]('\x5c','\x5c\x5c')[_0x3162('0x89')]('\x27\x27',_0x3162('0x8a'));if(qs[_0x3162('0x8b')](_0x4bc14c)){_0x5e1f2b['or'](_0x3162('0x8c'),_0x4bc14c+'%');}else{_0x5e1f2b['or'](_0x3162('0x8d'),qs[_0x3162('0x8e')](_0x4bc14c))['or'](_0x3162('0x8f'),_0x4bc14c+'%');}}}_0x1f35ae[_0x3162('0x80')](_0x5e1f2b);_0x1f35ae[_0x3162('0x90')](_0x3162('0x91'));var _0x53d6d9={'type':db[_0x3162('0x1e')][_0x3162('0x92')][_0x3162('0x93')],'raw':!![]};var _0x38ac7a=_0x1f35ae[_0x3162('0x94')]();_0x38ac7a[_0x3162('0x4f')](_0x3162('0x91'));_0x38ac7a[_0x3162('0x4f')](_0x3162('0x95'),_0x3162('0x63'));if(_0x1d78de[_0x3162('0x4d')]){_0x1d78de[_0x3162('0x4d')]['forEach'](function(_0x22bfb6){_0x1f35ae[_0x3162('0x4d')]('i.'+_0x22bfb6[0x0],_0x22bfb6[0x1]===_0x3162('0x96')?![]:!![]);});}if(!_['isEmpty'](_0x6ed643)){_0x1f35ae[_0x3162('0x85')](_0x27eaba);_0x38ac7a['where'](_0x3162('0x97'),_0x6ed643);}BPromise[_0x3162('0x98')]()['then'](function(){if(!_0xf7d3e1){if(_0x282e3e['query'][_0x3162('0x78')]||_0x282e3e[_0x3162('0x45')]['journey'])return;_0x38ac7a[_0x3162('0x80')]('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');_0x1f35ae[_0x3162('0x80')](_0x3162('0x99'));return;}return _0x282e3e[_0x3162('0x9a')][_0x3162('0x9b')]({'attributes':['id'],'raw':!![]})[_0x3162('0x35')](function(_0x32b6cf){if(_[_0x3162('0x9c')](_0x32b6cf)){_0x38ac7a[_0x3162('0x80')](_0x3162('0x9d'));_0x1f35ae['where'](_0x3162('0x9d'));}else{_0x38ac7a['where'](_0x3162('0x79'),_[_0x3162('0x3e')](_0x32b6cf,'id'));_0x1f35ae['where'](_0x3162('0x79'),_[_0x3162('0x3e')](_0x32b6cf,'id'));}});})[_0x3162('0x35')](function(){db[_0x3162('0x9e')][_0x3162('0x45')](_0x38ac7a[_0x3162('0x9f')](),_0x53d6d9)[_0x3162('0x35')](function(_0x59a84b){_0x500e6b[_0x3162('0x2f')]=_0x59a84b[_0x3162('0x4a')];if(_0x500e6b[_0x3162('0x2f')]===0x0)return[];return db['sequelize'][_0x3162('0x45')](_0x146758[_0x3162('0x9f')](),_0x53d6d9)[_0x3162('0x35')](function(_0x2b8e21){_0x4b23e8=_[_0x3162('0xa0')](_0x2b8e21,'id');_0x53d6d9=_[_0x3162('0xa1')](_0x53d6d9,{'model':db['ChatInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x282e3e[_0x3162('0x45')][_0x3162('0x48')]){_0x1d78de[_0x3162('0x49')][_0x3162('0x3c')](function(_0x40ae99){_0x1f35ae['field']('i.'+_0x40ae99);});}else{_0x1f35ae[_0x3162('0x4f')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x3162('0x63'));_0x1f35ae[_0x3162('0x4f')]('a.key',_0x3162('0xa2'));_0x1f35ae[_0x3162('0x4f')](_0x3162('0xa3'),'Account.mandatoryDisposition');_0x1f35ae[_0x3162('0x4f')]('i.*');_0x1f35ae['field'](_0x3162('0xa4'),_0x3162('0xa5'));_0x1f35ae[_0x3162('0x4f')](_0x3162('0xa6'),_0x3162('0xa7'));_0x1f35ae[_0x3162('0x4f')](_0x3162('0xa8'),'Contact.email');_0x1f35ae['field']('c.phone',_0x3162('0xa9'));_0x1f35ae[_0x3162('0x4f')]('c.mobile','Contact.mobile');_0x1f35ae[_0x3162('0x4f')]('c.fax',_0x3162('0xaa'));_0x1f35ae[_0x3162('0x4f')](_0x3162('0xab'),_0x3162('0xac'));_0x1f35ae['field'](_0x3162('0xad'),_0x3162('0xae'));_0x1f35ae[_0x3162('0x4f')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x3162('0x3a'));}if(_0x1d78de['limit'])_0x1f35ae[_0x3162('0x31')](_0x1d78de['limit']);if(_0x1d78de[_0x3162('0x30')])_0x1f35ae[_0x3162('0x30')](_0x1d78de[_0x3162('0x30')]);return db['sequelize'][_0x3162('0x45')](_0x1f35ae[_0x3162('0x9f')](),_0x53d6d9);})[_0x3162('0x35')](function(_0x249b87){_0x871a24['where'](_0x3162('0xaf'),_[_0x3162('0x3e')](_0x249b87,'id'));return db['sequelize'][_0x3162('0x45')](_0x871a24[_0x3162('0x9f')](),_0x53d6d9)[_0x3162('0x35')](function(_0x2243b3){var _0xdccc1a=_[_0x3162('0xb0')](_0x2243b3,_0x3162('0xb1'));var _0x3d977b=[];_0x249b87[_0x3162('0x3c')](function(_0xa2b606){_0x3d977b['push'](updateChatInteraction(_0xa2b606,_0x4b23e8,_0xdccc1a));});return BPromise[_0x3162('0xb2')](_0x3d977b);});});})[_0x3162('0x35')](function(_0x1ccb06){_0x500e6b[_0x3162('0xb3')]=_0x1ccb06;return _0x500e6b;})[_0x3162('0x35')](respondWithFilteredResult(_0x522cce,_0x1d78de));})[_0x3162('0x2b')](handleError(_0x522cce,null));};exports[_0x3162('0xb4')]=function(_0x3a103f,_0x49a2fe){var _0x2d179b={'raw':![],'where':{'id':_0x3a103f['params']['id']}},_0x3f0764={};_0x3f0764[_0x3162('0x43')]=_[_0x3162('0x44')](db[_0x3162('0xb5')][_0x3162('0x3f')]);_0x3f0764[_0x3162('0x45')]=_['keys'](_0x3a103f[_0x3162('0x45')]);_0x3f0764[_0x3162('0x46')]=_['intersection'](_0x3f0764[_0x3162('0x43')],_0x3f0764[_0x3162('0x45')]);_0x2d179b[_0x3162('0x49')]=_['intersection'](_0x3f0764['model'],qs[_0x3162('0x48')](_0x3a103f[_0x3162('0x45')]['fields']));_0x2d179b[_0x3162('0x49')]=_0x2d179b[_0x3162('0x49')][_0x3162('0x4a')]?_0x2d179b[_0x3162('0x49')]:_0x3f0764[_0x3162('0x43')];if(_0x3a103f[_0x3162('0x45')][_0x3162('0xb6')]){_0x2d179b[_0x3162('0xb7')]=[{'all':!![]}];}_0x2d179b=_[_0x3162('0xa1')]({},_0x2d179b,_0x3a103f['options']);return db[_0x3162('0xb5')][_0x3162('0x62')](_0x2d179b)['then'](handleEntityNotFound(_0x49a2fe,null))[_0x3162('0x35')](respondWithResult(_0x49a2fe,null))[_0x3162('0x2b')](handleError(_0x49a2fe,null));};exports[_0x3162('0xb8')]=function(_0x21a870,_0x334634){return db[_0x3162('0xb5')][_0x3162('0xb8')](_0x21a870[_0x3162('0x75')],{})[_0x3162('0x35')](respondWithResult(_0x334634,0xc9))[_0x3162('0x2b')](handleError(_0x334634,null));};exports[_0x3162('0xb9')]=function(_0x29b50e,_0x3fdb63){if(_0x29b50e['body']['id']){delete _0x29b50e[_0x3162('0x75')]['id'];}return db[_0x3162('0xb5')]['find']({'where':{'id':_0x29b50e[_0x3162('0xba')]['id']}})['then'](handleEntityNotFound(_0x3fdb63,null))[_0x3162('0x35')](saveUpdates(_0x29b50e[_0x3162('0x75')],null))[_0x3162('0x35')](respondWithResult(_0x3fdb63,null))[_0x3162('0x2b')](handleError(_0x3fdb63,null));};exports['destroy']=function(_0x301b3e,_0x43b706){return db[_0x3162('0xb5')][_0x3162('0x62')]({'where':{'id':_0x301b3e[_0x3162('0xba')]['id']}})[_0x3162('0x35')](handleEntityNotFound(_0x43b706,null))[_0x3162('0x35')](removeEntity(_0x43b706,null))[_0x3162('0x2b')](handleError(_0x43b706,null));};exports[_0x3162('0xbb')]=function(_0x185974,_0x448ea9){return db['ChatInteraction'][_0x3162('0xbb')]()[_0x3162('0x35')](respondWithResult(_0x448ea9,null))[_0x3162('0x2b')](handleError(_0x448ea9,null));};exports[_0x3162('0xbc')]=function(_0x543964,_0x1b53ac){var _0xd056ef=_0x543964[_0x3162('0xba')]['id'];var _0x5ab418;var _0xa64510;var _0x411582;return db['ChatInteraction'][_0x3162('0xbd')]({'where':{'id':_0xd056ef}})[_0x3162('0x35')](function(_0x562335){_0x5ab418=_0x562335;return db[_0x3162('0xbe')][_0x3162('0xbd')]({'where':{'id':_0x562335[_0x3162('0x78')]},'attributes':['id',_0x3162('0xbf'),'vidaooEscalation'],'raw':!![]});})[_0x3162('0x35')](function(_0x13f37d){if(_0x13f37d&&_0x13f37d[_0x3162('0xbf')]&&_0x13f37d['vidaooEscalation']){_0xa64510=_0x13f37d;var _0x1dbdcc={'rejectUnauthorized':![],'method':_0x3162('0xc0'),'uri':_0x3162('0xc1'),'headers':{'X-APIKEY':_0x13f37d[_0x3162('0xbf')]},'body':{'name':_0x3162('0xc2')+_0xd056ef},'redirect':_0x3162('0xc3'),'json':!![]};return rp(_0x1dbdcc);}else{throw new db[(_0x3162('0x1e'))]['ValidationError'](_0x3162('0xc4'));}})[_0x3162('0x35')](function(_0x348241){_0x411582=_0x348241;if(_0x411582['id']){var _0x56ba1e={'body':_0x411582[_0x3162('0xc5')],'ChatWebsiteId':_0xa64510['id'],'ChatInteractionId':_0x5ab418['id'],'direction':_0x3162('0xc6'),'UserId':_0x543964[_0x3162('0x9a')]['id']};return db['ChatMessage'][_0x3162('0xb8')](_0x56ba1e,{});}else{throw new db[(_0x3162('0x1e'))][(_0x3162('0x1f'))](_0x3162('0xc7'));}})[_0x3162('0x35')](function(){return _0x5ab418[_0x3162('0xc8')]({'vidaooSessionId':_0x411582['id']});})[_0x3162('0x35')](respondWithResult(_0x1b53ac,null))[_0x3162('0x2b')](handleError(_0x1b53ac,null));};exports[_0x3162('0xc9')]=function(_0x2f1bc1,_0x42c65a){if(_0x2f1bc1[_0x3162('0x75')]['id']){delete _0x2f1bc1[_0x3162('0x75')]['id'];}return db[_0x3162('0xb5')][_0x3162('0x62')]({'where':{'id':_0x2f1bc1[_0x3162('0xba')]['id']}})[_0x3162('0x35')](handleEntityNotFound(_0x42c65a,null))[_0x3162('0x35')](saveUpdates(_0x2f1bc1[_0x3162('0x75')],null))[_0x3162('0x35')](respondWithResult(_0x42c65a,null))[_0x3162('0x2b')](handleError(_0x42c65a,null));};exports[_0x3162('0xca')]=function(_0x5f3a9b,_0x13507d,_0x4137cb){if(_0x5f3a9b['body']['id']){delete _0x5f3a9b[_0x3162('0x75')]['id'];}return db[_0x3162('0xb5')][_0x3162('0x62')]({'where':{'id':_0x5f3a9b[_0x3162('0xba')]['id']}})[_0x3162('0x35')](function(_0x3bd8e4){if(!_0x3bd8e4){logger['error'](_0x3162('0xcb'),_0x3162('0xca'),0x194,'entity\x20not\x20found');_0x13507d[_0x3162('0x2c')](0x194);}else{if(_0x3bd8e4['UserId']){throw new db[(_0x3162('0x1e'))][(_0x3162('0x1f'))](_0x3162('0xcc'));}}return _0x3bd8e4;})[_0x3162('0x35')](function(_0x545f3e){if(_0x545f3e){return _0x545f3e[_0x3162('0xb9')]({'closed':_0x5f3a9b[_0x3162('0x75')][_0x3162('0xcd')],'disposition':_0x5f3a9b[_0x3162('0x75')][_0x3162('0xce')]})[_0x3162('0x35')](function(_0x4555ec){return _0x4555ec;});}})[_0x3162('0x35')](function(_0x594f55){return respondWithRpcPromise(_0x3162('0xcf'),_0x3162('0xca'),_0x5f3a9b[_0x3162('0x75')],client9004);})[_0x3162('0x35')](respondWithResult(_0x13507d,null))[_0x3162('0x2b')](handleError(_0x13507d,null));};exports[_0x3162('0xd0')]=function(_0x59c60a,_0x12282c,_0x421bb7){_0x59c60a[_0x3162('0x75')][_0x3162('0x37')]=_0x59c60a['file'][_0x3162('0xd1')];_0x59c60a[_0x3162('0x75')][_0x3162('0xd2')]=_0x59c60a['file'][_0x3162('0xd3')];_0x59c60a['body'][_0x3162('0x41')]=_0x59c60a[_0x3162('0xd4')][_0x3162('0xd5')];return db[_0x3162('0xd6')][_0x3162('0xb8')](_0x59c60a[_0x3162('0x75')])[_0x3162('0x35')](respondWithResult(_0x12282c,0xc9))['catch'](handleError(_0x12282c,null));};exports[_0x3162('0xd7')]=function(_0x71b6b9,_0x26a8ff,_0x30e1b7){return db[_0x3162('0xb5')][_0x3162('0xbd')]({'where':{'id':_0x71b6b9['params']['id']},'raw':!![]})[_0x3162('0x35')](handleEntityNotFound(_0x26a8ff,null))[_0x3162('0x35')](function(_0x1cca9a){if(_0x1cca9a){if(_0x1cca9a[_0x3162('0xcd')]){return _0x26a8ff['status'](0x193)[_0x3162('0x2e')]({'status':0x193,'message':_0x3162('0xd8')});}return db[_0x3162('0xd6')][_0x3162('0xbd')]({'where':{'id':_0x71b6b9[_0x3162('0x45')]['attachId']},'raw':!![]})['then'](handleEntityNotFound(_0x26a8ff,null));}})[_0x3162('0x35')](function(_0xc6d3a1){if(_0xc6d3a1){return _0x26a8ff[_0x3162('0xd9')](path['join'](config[_0x3162('0xda')],_0x3162('0xdb'),_0xc6d3a1[_0x3162('0xd2')]));}})[_0x3162('0x2b')](handleError(_0x26a8ff,null));};exports[_0x3162('0xdc')]=function(_0x391873,_0x548926){var _0x2df99e=null;var _0x4a7364=null;var _0x4749ba=null;var _0x468c8d=null;if(_0x391873['body']['id']){delete _0x391873[_0x3162('0x75')]['id'];}if(_0x391873[_0x3162('0x75')][_0x3162('0xdd')]){_0x468c8d=path['join'](config['root'],'server/files/chat/upload/',util[_0x3162('0xde')](_0x3162('0xdf'),Date[_0x3162('0xe0')]()));_0x391873[_0x3162('0x75')]['pathTranscript']=_0x468c8d;}return db['ChatInteraction'][_0x3162('0x62')]({'where':{'id':_0x391873['params']['id']},'include':[{'model':db[_0x3162('0xe1')],'as':_0x3162('0xe2'),'include':[{'model':db[_0x3162('0x71')],'as':_0x3162('0x71')}]}]})[_0x3162('0x35')](handleEntityNotFound(_0x548926,null))[_0x3162('0x35')](saveUpdates(_0x391873['body'],null))[_0x3162('0x35')](function(_0x459392){if(_0x459392){_0x2df99e=_0x459392;return db['ChatWebsite'][_0x3162('0x62')]({'where':{'id':_0x2df99e['ChatWebsiteId']}});}})[_0x3162('0x35')](function(_0x54e1ac){if(_0x54e1ac){_0x4749ba=_0x54e1ac;return db[_0x3162('0xe3')][_0x3162('0x62')]({'where':{'id':_0x2df99e[_0x3162('0x6c')]}});}})['then'](function(_0x332e31){if(_0x332e31){_0x4a7364=_0x332e31;if(_0x468c8d){var _0x505ef9=null;for(var _0x5381bc=0x1;_0x5381bc<_0x2df99e['Messages'][_0x3162('0x4a')];++_0x5381bc){_0x505ef9=_0x2df99e[_0x3162('0xe2')][_0x5381bc];var _0x341b67=_0x505ef9[_0x3162('0x73')]?util[_0x3162('0xde')](_0x3162('0xe4'),_0x4749ba[_0x3162('0xe5')],_0x505ef9[_0x3162('0x73')]):_0x3162('0xe6');var _0x2d298e=_0x391873[_0x3162('0x75')][_0x3162('0xe7')]||util[_0x3162('0xde')](_0x3162('0xe4'),_0x3162('0xe8'),_0x505ef9[_0x3162('0x6c')]);switch(_0x4749ba['agentIdentifier']){case _0x3162('0xe9'):_0x341b67=_0x505ef9['UserId']?util[_0x3162('0xde')](_0x3162('0xe4'),_0x4749ba[_0x3162('0xe5')],_0x505ef9[_0x3162('0x73')]):_0x3162('0xe6');break;case _0x3162('0xea'):_0x341b67=_0x505ef9[_0x3162('0x73')]?_0x505ef9[_0x3162('0x71')][_0x3162('0xeb')]||_0x505ef9[_0x3162('0x71')][_0x3162('0xec')]:_0x3162('0xe6');break;case _0x3162('0xed'):_0x341b67=_0x505ef9['UserId']?_0x505ef9['User'][_0x3162('0xec')]:_0x3162('0xe6');break;default:_0x341b67=_0x505ef9[_0x3162('0x73')]?util['format']('%s%d',_0x4749ba['agentAlias'],_0x505ef9[_0x3162('0x73')]):_0x3162('0xe6');}var _0x39785a=util[_0x3162('0xde')]('[%s]\x20%s:\x20%s\x0a',moment(_0x505ef9[_0x3162('0x7a')])['format'](_0x3162('0xee')),_0x505ef9['direction']==='in'?_0x2d298e:_0x341b67,_0x505ef9[_0x3162('0x75')]);if(!_0x505ef9[_0x3162('0xef')]){fs[_0x3162('0xf0')](_0x468c8d,_0x39785a);}}return db[_0x3162('0xf1')][_0x3162('0xbd')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':'Smtp','raw':!![]}]});}}})[_0x3162('0x35')](function(_0x2c485b){if(_0x2c485b&&_0x2c485b[_0x3162('0xf2')]&&_0x391873[_0x3162('0x75')]){var _0x1be5ab={'tls':{'rejectUnauthorized':![]}};if(_0x2c485b['Smtp'][_0x3162('0xf3')]){_0x1be5ab[_0x3162('0xf3')]=_0x2c485b[_0x3162('0xf2')][_0x3162('0xf3')];}else{_0x1be5ab[_0x3162('0xf4')]=_0x2c485b[_0x3162('0xf2')]['host'];_0x1be5ab[_0x3162('0xf5')]=_0x2c485b[_0x3162('0xf2')]['port'];_0x1be5ab[_0x3162('0xf6')]=_0x2c485b['Smtp']['secure'];}if(_0x2c485b['Smtp'][_0x3162('0xf7')]){_0x1be5ab['auth']={'user':_0x2c485b[_0x3162('0xf2')]['user'],'pass':_0x2c485b[_0x3162('0xf2')][_0x3162('0xf8')]};}return respondWithRpcPromise(_0x3162('0xf9'),'sendMail',{'account':_0x1be5ab,'message':{'from':util[_0x3162('0xde')](_0x3162('0xfa'),_0x2c485b[_0x3162('0x37')],_0x2c485b[_0x3162('0xfb')]||_0x2c485b[_0x3162('0xf2')][_0x3162('0x9a')]),'to':_0x391873[_0x3162('0x75')][_0x3162('0xdd')],'subject':_0x3162('0xfc'),'text':util['format']('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0x391873['body']['mailTranscript']),'attachments':[{'path':_0x468c8d}]}})[_0x3162('0x35')](function(){return _0x2df99e;})[_0x3162('0x2b')](function(_0x560089){console[_0x3162('0x25')](_0x560089);});}else{return _0x2df99e;}})[_0x3162('0x35')](respondWithStatusCode(_0x548926,0xc8))['catch'](handleError(_0x548926,null));};exports[_0x3162('0xfd')]=function(_0x4e54ed,_0x2b3e5e,_0x58b2c8){return db['ChatMessage']['find']({'where':{'id':_0x4e54ed[_0x3162('0xba')]['id']}})[_0x3162('0x35')](handleEntityNotFound(_0x2b3e5e,null))['then'](function(_0x1d3e81){if(_0x1d3e81){return _0x1d3e81[_0x3162('0xfd')](_0x4e54ed[_0x3162('0x75')]['ids'],_[_0x3162('0xfe')](_0x4e54ed['body'],[_0x3162('0xff'),'id'])||{});}})[_0x3162('0x35')](respondWithResult(_0x2b3e5e,null))[_0x3162('0x2b')](handleError(_0x2b3e5e,null));};exports[_0x3162('0x100')]=function(_0x12e467,_0x26f3ad,_0x5397e2){var _0x8d0df={'raw':![],'where':{}};var _0x167d75={};var _0x2dcc43={'count':0x0,'rows':[]};return db[_0x3162('0xb5')]['findOne']({'where':{'id':_0x12e467[_0x3162('0xba')]['id']}})[_0x3162('0x35')](handleEntityNotFound(_0x26f3ad,null))[_0x3162('0x35')](function(_0x2d7dc2){if(_0x2d7dc2){_0x167d75[_0x3162('0x43')]=_[_0x3162('0x44')](db[_0x3162('0xe1')]['rawAttributes']);_0x167d75[_0x3162('0x45')]=_[_0x3162('0x44')](_0x12e467[_0x3162('0x45')]);_0x167d75[_0x3162('0x46')]=_[_0x3162('0x47')](_0x167d75[_0x3162('0x43')],_0x167d75['query']);_0x8d0df[_0x3162('0x49')]=_['intersection'](_0x167d75[_0x3162('0x43')],qs[_0x3162('0x48')](_0x12e467['query'][_0x3162('0x48')]));_0x8d0df[_0x3162('0x49')]=_0x8d0df[_0x3162('0x49')]['length']?_0x8d0df[_0x3162('0x49')]:_0x167d75['model'];if(!_0x12e467[_0x3162('0x45')][_0x3162('0x4b')](_0x3162('0x4c'))){_0x8d0df[_0x3162('0x31')]=qs[_0x3162('0x31')](_0x12e467[_0x3162('0x45')]['limit']);_0x8d0df[_0x3162('0x30')]=qs['offset'](_0x12e467[_0x3162('0x45')][_0x3162('0x30')]);}_0x8d0df[_0x3162('0x4d')]=qs[_0x3162('0x4e')](_0x12e467['query'][_0x3162('0x4e')]);_0x8d0df[_0x3162('0x80')]=qs[_0x3162('0x46')](_[_0x3162('0x101')](_0x12e467[_0x3162('0x45')],_0x167d75[_0x3162('0x46')]));_0x8d0df[_0x3162('0x80')]['ChatInteractionId']=_0x2d7dc2['id'];if(_0x12e467[_0x3162('0x45')][_0x3162('0x102')]){_0x8d0df[_0x3162('0x80')]=_['merge'](_0x8d0df[_0x3162('0x80')],{'$or':_[_0x3162('0x3e')](_0x8d0df['attributes'],function(_0x109f34){var _0xf633c5={};_0xf633c5[_0x109f34]={'$like':'%'+_0x12e467[_0x3162('0x45')][_0x3162('0x102')]+'%'};return _0xf633c5;})});}if(_0x12e467['query'][_0x3162('0x7c')]){var _0x655e50=_0x12e467[_0x3162('0x45')]['$gte'][_0x3162('0x3b')](',');var _0x1df3ef={};_0x1df3ef[_0x655e50[0x0]]={'$gte':moment(_0x655e50[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x8d0df[_0x3162('0x80')]=_['merge'](_0x8d0df['where'],_0x1df3ef);}_0x8d0df=_[_0x3162('0xa1')]({},_0x8d0df,_0x12e467[_0x3162('0x103')]);return db[_0x3162('0xe1')][_0x3162('0x2f')]({'where':_0x8d0df[_0x3162('0x80')]})[_0x3162('0x35')](function(_0x4db20b){_0x2dcc43[_0x3162('0x2f')]=_0x4db20b;if(_0x12e467[_0x3162('0x45')][_0x3162('0xb6')]){_0x8d0df[_0x3162('0xb7')]=[{'all':!![]}];}return db['ChatMessage'][_0x3162('0x104')](_0x8d0df);})[_0x3162('0x35')](function(_0x25a0b8){_0x2dcc43[_0x3162('0xb3')]=_0x25a0b8;return _0x2dcc43;});}})['then'](respondWithFilteredResult(_0x26f3ad,_0x8d0df))[_0x3162('0x2b')](handleError(_0x26f3ad,null));};exports[_0x3162('0x105')]=function(_0x1f1e55,_0x2aeef7,_0x12655a){var _0x2bd203={'where':{}},_0x579bf2={},_0x1363c8={'count':0x0,'rows':[]};return db[_0x3162('0xb5')][_0x3162('0xbd')]({'where':{'id':_0x1f1e55[_0x3162('0xba')]['id']}})[_0x3162('0x35')](handleEntityNotFound(_0x2aeef7,null))['then'](function(_0x506aad){if(_0x506aad){_0x579bf2[_0x3162('0x43')]=_['keys'](db[_0x3162('0xe1')][_0x3162('0x3f')]);_0x579bf2[_0x3162('0x45')]=_[_0x3162('0x44')](_0x1f1e55['query']);_0x579bf2[_0x3162('0x46')]=_['intersection'](_0x579bf2[_0x3162('0x43')],_0x579bf2[_0x3162('0x45')]);_0x2bd203[_0x3162('0x49')]=_['intersection'](_0x579bf2[_0x3162('0x43')],qs[_0x3162('0x48')](_0x1f1e55[_0x3162('0x45')]['fields']));_0x2bd203[_0x3162('0x49')]=_0x2bd203[_0x3162('0x49')][_0x3162('0x4a')]?_0x2bd203[_0x3162('0x49')]:_0x579bf2[_0x3162('0x43')];if(!_0x1f1e55['query']['hasOwnProperty'](_0x3162('0x4c'))){_0x2bd203['limit']=qs[_0x3162('0x31')](_0x1f1e55['query'][_0x3162('0x31')]);_0x2bd203[_0x3162('0x30')]=qs[_0x3162('0x30')](_0x1f1e55['query'][_0x3162('0x30')]);}_0x2bd203[_0x3162('0x4d')]=qs['sort'](_0x1f1e55[_0x3162('0x45')]['sort']);_0x2bd203[_0x3162('0x80')]=qs[_0x3162('0x46')](_[_0x3162('0x101')](_0x1f1e55[_0x3162('0x45')],_0x579bf2[_0x3162('0x46')]));_0x2bd203[_0x3162('0x80')][_0x3162('0xb1')]=_0x506aad['id'];if(_0x1f1e55[_0x3162('0x45')][_0x3162('0x102')]){_0x2bd203[_0x3162('0x80')]=_['merge'](_0x2bd203[_0x3162('0x80')],{'$or':_[_0x3162('0x3e')](_0x2bd203[_0x3162('0x49')],function(_0x476077){var _0xa09807={};_0xa09807[_0x476077]={'$like':'%'+_0x1f1e55[_0x3162('0x45')]['filter']+'%'};return _0xa09807;})});}_0x2bd203[_0x3162('0x80')][_0x3162('0xef')]=![];if(_0x1f1e55[_0x3162('0x45')]['id']){_0x2bd203['where']['id']={'$gt':_0x1f1e55[_0x3162('0x45')]['id']};}_0x2bd203=_['merge']({},_0x2bd203,_0x1f1e55[_0x3162('0x103')]);return db[_0x3162('0xe1')][_0x3162('0x2f')]({'where':_0x2bd203[_0x3162('0x80')]})['then'](function(_0x548fb5){_0x1363c8[_0x3162('0x2f')]=_0x548fb5;_0x2bd203[_0x3162('0xb7')]=[];if(_0x1f1e55[_0x3162('0x45')][_0x3162('0x106')]){_0x2bd203[_0x3162('0xb7')]['push']({'model':db[_0x3162('0x71')],'as':'User','attributes':['id',_0x3162('0xec'),_0x3162('0xeb')]});}if(_0x1f1e55[_0x3162('0x45')]['includeAll']){_0x2bd203[_0x3162('0xb7')]=[{'all':!![]}];}return db[_0x3162('0xe1')][_0x3162('0x104')](_0x2bd203);})[_0x3162('0x35')](function(_0x201644){_0x1363c8['rows']=_0x201644;return _0x1363c8;});}})[_0x3162('0x35')](respondWithFilteredResult(_0x2aeef7,_0x2bd203))['catch'](handleError(_0x2aeef7,null));};exports[_0x3162('0x107')]=function(_0x491aed,_0x235e9f,_0x3c2e92){return db[_0x3162('0xb5')][_0x3162('0x62')]({'where':{'id':_0x491aed[_0x3162('0xba')]['id']}})[_0x3162('0x35')](handleEntityNotFound(_0x235e9f,null))[_0x3162('0x35')](function(_0x26cf0e){if(_0x26cf0e){return _0x26cf0e['setTags'](_0x491aed['body'][_0x3162('0xff')],_[_0x3162('0xfe')](_0x491aed[_0x3162('0x75')],[_0x3162('0xff'),'id'])||{})[_0x3162('0x108')](function(){return db[_0x3162('0x109')]['findAll']({'attributes':['id',_0x3162('0x37'),_0x3162('0x50')],'where':{'id':_0x491aed[_0x3162('0x75')]['ids']}});})[_0x3162('0x35')](function(_0x442122){socket[_0x3162('0x10a')]('chatInteractionTags:save',{'id':Number(_0x491aed[_0x3162('0xba')]['id']),'tags':_0x442122||[]});return{'id':Number(_0x491aed[_0x3162('0xba')]['id']),'tags':_0x442122||[]};});}})['then'](respondWithResult(_0x235e9f,null))[_0x3162('0x2b')](handleError(_0x235e9f,null));};exports[_0x3162('0x10b')]=function(_0x2af795,_0x4d031b,_0x10c3ab){return db['ChatInteraction'][_0x3162('0x62')]({'where':{'id':_0x2af795[_0x3162('0xba')]['id']}})[_0x3162('0x35')](handleEntityNotFound(_0x4d031b,null))[_0x3162('0x35')](function(_0x41f32a){if(_0x41f32a){return _0x41f32a[_0x3162('0x10b')](_0x2af795[_0x3162('0x45')]['ids']);}})['then'](respondWithStatusCode(_0x4d031b,null))['catch'](handleError(_0x4d031b,null));};exports[_0x3162('0xd9')]=function(_0x3dbcbe,_0x39a4b8){var _0x4f9c36=moment()[_0x3162('0x10c')]()['toString']();var _0x35ae89=path[_0x3162('0x10d')](config[_0x3162('0xda')],'server',_0x3162('0x10e'),'tmp');var _0x41500b=path['join'](config[_0x3162('0xda')],'server','files',_0x3162('0x10f'));var _0xe47f9b=path[_0x3162('0x10d')](_0x35ae89,_0x4f9c36);var _0x4f3266=util[_0x3162('0xde')](_0x3162('0x110'),_0x3dbcbe[_0x3162('0xba')]['id'],_0x4f9c36);var _0x478f9f=path[_0x3162('0x10d')](_0x35ae89,_0x4f3266);var _0xfadf2a=[];_0xfadf2a[_0x3162('0x111')]({'model':db[_0x3162('0x71')],'as':_0x3162('0x71'),'attributes':['id','fullname'],'raw':!![]});_0xfadf2a[_0x3162('0x111')]({'model':db['CmContact'],'as':_0x3162('0x66'),'attributes':['id','firstName',_0x3162('0x112')],'raw':!![]});if(_0x3dbcbe['query']['attachments']){_0xfadf2a[_0x3162('0x111')]({'model':db[_0x3162('0xd6')],'as':_0x3162('0xd6'),'raw':!![]});}var _0x238eef=[{'model':db[_0x3162('0xe1')],'as':'Messages','attributes':['id','body',_0x3162('0x7a'),_0x3162('0x113'),_0x3162('0xef'),'read'],'include':_0xfadf2a}];_0x238eef['push']({'model':db[_0x3162('0xbe')],'as':_0x3162('0x114'),'attributes':['id',_0x3162('0x37')]});_0x238eef[_0x3162('0x111')]({'model':db['User'],'as':_0x3162('0x115'),'attributes':['id',_0x3162('0xec')]});return db[_0x3162('0xb5')][_0x3162('0x62')]({'where':{'id':_0x3dbcbe[_0x3162('0xba')]['id']},'include':_0x238eef})['then'](handleEntityNotFound(_0x39a4b8,null))['then'](function(_0x471d89){if(_0x471d89){var _0x4f536c=_0x471d89['get']({'plain':!![]});fs[_0x3162('0x116')](_0xe47f9b);var _0x3d15ec={'format':'A4','border':_0x3162('0x117'),'header':{'height':_0x3162('0x118'),'contents':{'first':_0x3162('0x119')}},'footer':{'height':_0x3162('0x11a'),'contents':{'default':util[_0x3162('0xde')]('\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',util[_0x3162('0xde')]('%s\x20#%d',_0x3162('0x11b'),_0x4f536c['id']),moment()[_0x3162('0xde')](_0x3162('0x11c'))[_0x3162('0x9f')]())}}};var _0x6023bd={'channel':_0x3162('0x11b'),'account':_0x4f536c['Account'][_0x3162('0x37')],'agent':_0x4f536c[_0x3162('0x115')]?_0x4f536c[_0x3162('0x115')]['fullname']:_0x3162('0x11d'),'createdAt':moment(_0x4f536c[_0x3162('0x7a')])[_0x3162('0xde')](_0x3162('0x11e'))[_0x3162('0x9f')](),'closedAt':_0x4f536c['closed']?moment(_0x4f536c['closedAt'])[_0x3162('0xde')](_0x3162('0x11e'))['toString']():'','disposition':_0x4f536c[_0x3162('0xce')],'chatInfo':{'browser':_0x4f536c[_0x3162('0x11f')],'os':_0x4f536c[_0x3162('0x120')],'referer':_0x4f536c[_0x3162('0x121')],'customerIp':_0x4f536c['customerIp'],'customerPort':_0x4f536c['customerPort']?_0x4f536c[_0x3162('0x122')]:_0x3162('0x11d')},'messages':_(_0x4f536c[_0x3162('0xe2')])[_0x3162('0x123')]()['filter']({'secret':![]})[_0x3162('0x3e')](function(_0x42ce41){if(_0x42ce41[_0x3162('0xd6')]){var _0x5c2208=path[_0x3162('0x10d')](_0x41500b,_0x42ce41[_0x3162('0xd6')][_0x3162('0xd2')]);if(fs[_0x3162('0x124')](_0x5c2208)){fs[_0x3162('0x125')](_0x5c2208)[_0x3162('0x126')](fs[_0x3162('0x127')](path[_0x3162('0x10d')](_0xe47f9b,_0x42ce41[_0x3162('0xd6')][_0x3162('0xd2')])));}}return{'date':moment(_0x42ce41['createdAt'])[_0x3162('0xde')](_0x3162('0x11e'))[_0x3162('0x9f')](),'sender':_0x42ce41[_0x3162('0x113')]===_0x3162('0xc6')?_0x42ce41[_0x3162('0x71')]?_0x42ce41['User'][_0x3162('0xec')]:_0x3162('0xe6'):_0x42ce41[_0x3162('0x66')]['firstName']+(_0x42ce41[_0x3162('0x66')][_0x3162('0x112')]?'\x20'+_0x42ce41[_0x3162('0x66')][_0x3162('0x112')]:''),'body':_0x42ce41[_0x3162('0xd6')]?_0x42ce41[_0x3162('0xd6')][_0x3162('0xd2')]:_0x42ce41[_0x3162('0x75')],'direction':_0x42ce41[_0x3162('0x113')]==='out'?'A':'C','secret':_0x42ce41[_0x3162('0xef')],'read':_0x42ce41['read'],'attachment':_0x42ce41[_0x3162('0xd6')]};})['value']()};return ejs[_0x3162('0x128')](path[_0x3162('0x10d')](config[_0x3162('0xda')],_0x3162('0x129'),'views',_0x3162('0x12a')),{'interaction':_0x6023bd})['then'](function(_0x4d23a9){return new BPromise(function(_0x549a4b,_0x25b697){pdf[_0x3162('0xb8')](_0x4d23a9,_0x3d15ec)[_0x3162('0x12b')](path[_0x3162('0x10d')](_0xe47f9b,'transcript-'+_0x4f536c['id']+'-'+_0x4f9c36+_0x3162('0x12c')),function(_0x8d17c4,_0x52718f){if(_0x8d17c4)return _0x25b697(_0x8d17c4);_0x549a4b(_0x52718f);});});})[_0x3162('0x35')](function(){return new BPromise(function(_0x4ca74a,_0xe54261){zipdir(_0xe47f9b,{'saveTo':_0x478f9f},function(_0x5964b7,_0x19f1d6){if(_0x5964b7)return _0xe54261(_0x5964b7);return _0x4ca74a(_0x19f1d6);});})['then'](function(){return new BPromise(function(_0x4716b2,_0x5b89b7){rimraf(_0xe47f9b,function(_0x1be91b){if(_0x1be91b)_0x5b89b7(_0x1be91b);return _0x4716b2();});});})[_0x3162('0x35')](function(){return _0x39a4b8[_0x3162('0xd9')](_0x478f9f,_0x4f3266,function(_0x8922b5){if(_0x8922b5){console[_0x3162('0x12d')](_0x3162('0x12e'),_0x8922b5);}else{fs[_0x3162('0x12f')](_0x478f9f);}});});});}else{return _0x39a4b8[_0x3162('0x2c')](0xc8);}})[_0x3162('0x2b')](handleError(_0x39a4b8,null));}; \ No newline at end of file +var _0x7278=['getMyMessages','includeAgent','addTags','spread','Tag','emit','removeTags','unix','server','files','tmp','attachments','transcript-%d-%s.zip','CmContact','firstName','lastName','Account','Owner','get','mkdirSync','10px','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','N.A.','closedAt','osName','referer','customerPort','tail','createReadStream','out','Contact','renderFile','views','downloadInteraction.html','toFile','transcript-','log','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','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','socket.io-emitter','./chatInteraction.socket','register','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatInteraction,\x20%s,\x20%s','message','result','catch','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','sendStatus','stack','name','send','Users','map','fullname','TagIds','Tags','split','push','index','ChatInteraction','fieldName','type','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','field','from','tools_tags','u.id','u.fullname','ui.ChatInteractionId','user_has_chat_interactions','users','u.id\x20=\x20ui.UserId','select','chat_interactions','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.ChatWebsiteId','chat_messages','it.ChatInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','search','sqlOperator','length','conditions','find','unreadMessages','value','having','`\x20=\x200','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','forEach','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','some','compact','isEmpty','ChatWebsiteId','i.ChatWebsiteId\x20IN\x20?','concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','\x27\x27\x27\x27','isNumeric','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','QueryTypes','SELECT','clone','t.id\x20IN\x20?','journey','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','sequelize','toString','keyBy','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','c.firstName','Contact.lastName','c.email','Contact.email','Contact.phone','c.mobile','Contact.mobile','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','groupBy','ChatInteractionId','rows','params','rawAttributes','includeAll','include','options','create','update','body','destroy','describe','createVidaooSession','findOne','vidaooEscalation','vidaooApiKey','POST','https://api-vidaoo.xcally.com/api/v1/sessions','MotionCWB:','Error\x20in\x20Vidaoo\x20configuration','join_url','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','abandonInteraction,\x20%s,\x20%s,\x20%s','abandon','entity\x20not\x20found','UserId','Interaction\x20already\x20assigned','closed','AbandonInteraction','file','basename','Attachment','Unauthorized','attachId','download','join','server/files/attachments/','close','mailTranscript','root','server/files/chat/upload/','transcript-%s.txt','now','pathTranscript','Messages','ChatWebsite','format','%s%d','agentAlias','customer','Visitor','website_alias','System','agent_alias','alias','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailAccount','MailServerOut','Smtp','service','host','port','secure','auth','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','email','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','ids','omit','getMessages','YYYY-MM-DD\x20HH:mm:ss','findAll'];(function(_0x5ddaac,_0x2697a8){var _0x2a9c58=function(_0x851032){while(--_0x851032){_0x5ddaac['push'](_0x5ddaac['shift']());}};_0x2a9c58(++_0x2697a8);}(_0x7278,0x161));var _0x8727=function(_0x35e894,_0x552897){_0x35e894=_0x35e894-0x0;var _0x260b89=_0x7278[_0x35e894];return _0x260b89;};'use strict';var pdf=require(_0x8727('0x0'));var emlformat=require(_0x8727('0x1'));var rimraf=require(_0x8727('0x2'));var zipdir=require(_0x8727('0x3'));var jsonpatch=require(_0x8727('0x4'));var rp=require('request-promise');var moment=require(_0x8727('0x5'));var BPromise=require(_0x8727('0x6'));var Mustache=require(_0x8727('0x7'));var util=require(_0x8727('0x8'));var path=require(_0x8727('0x9'));var sox=require(_0x8727('0xa'));var csv=require(_0x8727('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x8727('0xc'));var squel=require(_0x8727('0xd'));var crypto=require(_0x8727('0xe'));var jsforce=require(_0x8727('0xf'));var deskjs=require(_0x8727('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8727('0x11'));var authService=require(_0x8727('0x12'));var qs=require(_0x8727('0x13'));var as=require(_0x8727('0x14'));var hardwareService=require(_0x8727('0x15'));var logger=require(_0x8727('0x16'))(_0x8727('0x17'));var utils=require(_0x8727('0x18'));var config=require('../../config/environment');var db=require(_0x8727('0x19'))['db'];config[_0x8727('0x1a')]=_[_0x8727('0x1b')](config['redis'],{'host':_0x8727('0x1c'),'port':0x18eb});var socket=require(_0x8727('0x1d'))(new Redis(config['redis']));require(_0x8727('0x1e'))[_0x8727('0x1f')](socket);var jayson=require(_0x8727('0x20'));var client=jayson[_0x8727('0x21')][_0x8727('0x22')]({'port':0x232b});var client9004=jayson[_0x8727('0x21')][_0x8727('0x22')]({'port':0x232c});function checkPasswordPattern(_0x1916f7,_0x11c828,_0x88857c){if(_0x88857c){var _0x4842a0=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4842a0[_0x8727('0x23')](_0x11c828)){return _0x1916f7;}else{throw new db[(_0x8727('0x24'))][(_0x8727('0x25'))](_0x8727('0x26'));}}else{return _0x1916f7;}}function respondWithRpcPromise(_0x112f04,_0xba0af5,_0x533e6d,_0x575d29){return new BPromise(function(_0x1a90ed,_0x4a0a7d){var _0x28b10f=_0x575d29||client;return _0x28b10f[_0x8727('0x27')](_0x112f04,_0x533e6d)[_0x8727('0x28')](function(_0x22e6c9){logger[_0x8727('0x29')]('ChatInteraction,\x20%s,\x20%s',_0xba0af5,_0x8727('0x2a'));logger[_0x8727('0x2b')](_0x8727('0x2c'),_0xba0af5,_0x8727('0x2a'),JSON[_0x8727('0x2d')](_0x22e6c9));if(_0x22e6c9[_0x8727('0x2e')]){if(_0x22e6c9[_0x8727('0x2e')][_0x8727('0x2f')]===0x1f4){logger[_0x8727('0x2e')](_0x8727('0x30'),_0xba0af5,_0x22e6c9[_0x8727('0x2e')][_0x8727('0x31')]);return _0x4a0a7d(_0x22e6c9['error'][_0x8727('0x31')]);}logger[_0x8727('0x2e')]('ChatInteraction,\x20%s,\x20%s',_0xba0af5,_0x22e6c9['error'][_0x8727('0x31')]);return _0x1a90ed(_0x22e6c9[_0x8727('0x2e')][_0x8727('0x31')]);}else{logger['info'](_0x8727('0x30'),_0xba0af5,_0x8727('0x2a'));_0x1a90ed(_0x22e6c9[_0x8727('0x32')][_0x8727('0x31')]);}})[_0x8727('0x33')](function(_0xf33348){logger[_0x8727('0x2e')](_0x8727('0x30'),_0xba0af5,_0xf33348);_0x4a0a7d(_0xf33348);});});}function respondWithStatusCode(_0x5d03f2,_0x243f15){_0x243f15=_0x243f15||0xcc;return function(_0x307055){if(_0x307055){return _0x5d03f2['sendStatus'](_0x243f15);}return _0x5d03f2[_0x8727('0x34')](_0x243f15)[_0x8727('0x35')]();};}function respondWithResult(_0x3ecd6a,_0x228ca9){_0x228ca9=_0x228ca9||0xc8;return function(_0x416da8){if(_0x416da8){return _0x3ecd6a[_0x8727('0x34')](_0x228ca9)['json'](_0x416da8);}};}function respondWithFilteredResult(_0x332ebe,_0x563201){return function(_0x34c58e){if(_0x34c58e){var _0x47e9f9=_0x34c58e[_0x8727('0x36')],_0x44ed83=_0x563201[_0x8727('0x37')],_0x391d60=_0x563201[_0x8727('0x37')]+_0x563201[_0x8727('0x38')],_0x152a53;if(_0x391d60>=_0x47e9f9){_0x391d60=_0x47e9f9;_0x152a53=0xc8;}else{_0x152a53=0xce;}_0x332ebe['status'](_0x152a53);return _0x332ebe[_0x8727('0x39')](_0x8727('0x3a'),_0x44ed83+'-'+_0x391d60+'/'+_0x47e9f9)[_0x8727('0x3b')](_0x34c58e);}return null;};}function patchUpdates(_0x1b047a){return function(_0x3374e8){try{jsonpatch[_0x8727('0x3c')](_0x3374e8,_0x1b047a,!![]);}catch(_0x1626ff){return BPromise[_0x8727('0x3d')](_0x1626ff);}return _0x3374e8[_0x8727('0x3e')]();};}function saveUpdates(_0x4435c9,_0x14cfdc){return function(_0x184905){if(_0x184905){return _0x184905['update'](_0x4435c9)['then'](function(_0x456254){return _0x456254;});}return null;};}function removeEntity(_0x3fac76,_0x38a61f){return function(_0x477ae2){if(_0x477ae2){return _0x477ae2['destroy']()[_0x8727('0x28')](function(){_0x3fac76[_0x8727('0x34')](0xcc)[_0x8727('0x35')]();});}};}function handleEntityNotFound(_0x26c545,_0x11d420){return function(_0x5b96cc){if(!_0x5b96cc){_0x26c545[_0x8727('0x3f')](0x194);}return _0x5b96cc;};}function handleError(_0x3c1007,_0x8e9de8){_0x8e9de8=_0x8e9de8||0x1f4;return function(_0x1b0e88){logger[_0x8727('0x2e')](_0x1b0e88[_0x8727('0x40')]);if(_0x1b0e88[_0x8727('0x41')]){delete _0x1b0e88[_0x8727('0x41')];}_0x3c1007[_0x8727('0x34')](_0x8e9de8)[_0x8727('0x42')](_0x1b0e88);};}function getInteractionUsers(_0x396f12,_0x308c1d){return new BPromise(function(_0x5e1ea1,_0x51c66d){try{if(_0x308c1d[_0x396f12['id']]){_0x396f12[_0x8727('0x43')]=_[_0x8727('0x44')](_0x308c1d[_0x396f12['id']],function(_0x403d90){return{'id':_0x403d90['id'],'fullname':_0x403d90[_0x8727('0x45')]};});}}catch(_0x2c60b0){_0x51c66d(_0x2c60b0);}_0x5e1ea1(_0x396f12);});}function getInteractionTags(_0x308035,_0x41b08e){return new BPromise(function(_0x42d767,_0x2a1bd8){try{if(_0x308035[_0x8727('0x46')]){_0x308035[_0x8727('0x47')]=[];_0x308035[_0x8727('0x46')][_0x8727('0x48')](',')['forEach'](function(_0x15fbe6){_0x308035[_0x8727('0x47')][_0x8727('0x49')](_0x41b08e[_0x15fbe6]);});}delete _0x308035['TagIds'];}catch(_0x2a506f){_0x2a1bd8(_0x2a506f);}_0x42d767(_0x308035);});}function updateChatInteraction(_0x1a4563,_0x1ec675,_0x641064){return new BPromise(function(_0x57817f,_0x3a2683){return getInteractionUsers(_0x1a4563,_0x641064)[_0x8727('0x28')](function(_0x1b90e3){return getInteractionTags(_0x1b90e3,_0x1ec675);})[_0x8727('0x28')](function(_0x16b870){_0x57817f(_0x16b870);})[_0x8727('0x33')](function(_0x2fe40d){_0x3a2683(_0x2fe40d);});});}exports[_0x8727('0x4a')]=function(_0x3aac97,_0x2b5ba7){var _0x51e3fa={},_0x307785={},_0x24ae2d={'count':0x0,'rows':[]};var _0x21bfe8=_[_0x8727('0x44')](db[_0x8727('0x4b')]['rawAttributes'],function(_0x161200){return{'name':_0x161200[_0x8727('0x4c')],'type':_0x161200[_0x8727('0x4d')]['key']};});_0x307785[_0x8727('0x4e')]=_[_0x8727('0x44')](_0x21bfe8,_0x8727('0x41'));_0x307785[_0x8727('0x4f')]=_[_0x8727('0x50')](_0x3aac97[_0x8727('0x4f')]);_0x307785['filters']=_[_0x8727('0x51')](_0x307785[_0x8727('0x4e')],_0x307785[_0x8727('0x4f')]);_0x51e3fa['attributes']=_[_0x8727('0x51')](_0x307785[_0x8727('0x4e')],qs[_0x8727('0x52')](_0x3aac97[_0x8727('0x4f')][_0x8727('0x52')]));_0x51e3fa[_0x8727('0x53')]=_0x51e3fa[_0x8727('0x53')]['length']?_0x51e3fa[_0x8727('0x53')]:_0x307785[_0x8727('0x4e')];if(!_0x3aac97[_0x8727('0x4f')][_0x8727('0x54')](_0x8727('0x55'))){_0x51e3fa[_0x8727('0x38')]=qs[_0x8727('0x38')](_0x3aac97['query'][_0x8727('0x38')]);_0x51e3fa[_0x8727('0x37')]=qs[_0x8727('0x37')](_0x3aac97['query'][_0x8727('0x37')]);}_0x51e3fa[_0x8727('0x56')]=qs[_0x8727('0x57')](_0x3aac97[_0x8727('0x4f')][_0x8727('0x57')]);_0x51e3fa[_0x8727('0x58')]=qs[_0x8727('0x59')](_['pick'](_0x3aac97[_0x8727('0x4f')],_0x307785['filters']),_0x21bfe8);var _0x207893=[];var _0x19a0ab=squel['select']()[_0x8727('0x5a')]('id')[_0x8727('0x5a')](_0x8727('0x41'))['field']('color')[_0x8727('0x5b')](_0x8727('0x5c'));var _0x3cbc81=squel['select']()[_0x8727('0x5a')](_0x8727('0x5d'))[_0x8727('0x5a')](_0x8727('0x5e'))[_0x8727('0x5a')](_0x8727('0x5f'))[_0x8727('0x5b')](_0x8727('0x60'),'ui')['left_join'](_0x8727('0x61'),'u',_0x8727('0x62'));var _0x8a8cce=squel[_0x8727('0x63')]()['from'](_0x8727('0x64'),'i')[_0x8727('0x65')](_0x8727('0x66'),'c',_0x8727('0x67'))[_0x8727('0x65')](_0x8727('0x61'),'o',_0x8727('0x68'))[_0x8727('0x65')]('chat_websites','a',_0x8727('0x69'))[_0x8727('0x65')](_0x8727('0x6a'),'me','me.ChatInteractionId\x20=\x20i.id')[_0x8727('0x65')]('chat_interaction_has_tags','it',_0x8727('0x6b'))['left_join'](_0x8727('0x5c'),'t',_0x8727('0x6c'));var _0x5f4908=squel[_0x8727('0x6d')]();var _0x1f8f2a=[];var _0x105a9d=squel['expr']();var _0x5246c1;if(_0x3aac97['query']['search']){_0x5246c1=as[_0x8727('0x6e')](_0x3aac97[_0x8727('0x4f')][_0x8727('0x6f')]);var _0x7e15b0=_0x5246c1[_0x8727('0x70')];for(var _0x57c2fb=0x0;_0x57c2fb<_0x5246c1['conditions'][_0x8727('0x71')];_0x57c2fb++){var _0x10876e=_0x5246c1[_0x8727('0x72')][_0x57c2fb];var _0x11441a='i';var _0x407518=_[_0x8727('0x73')](_0x21bfe8,[_0x8727('0x41'),_0x10876e[_0x8727('0x5a')]]);if(!_0x407518){switch(_0x10876e[_0x8727('0x5a')]){case _0x8727('0x74'):if(_0x10876e[_0x8727('0x75')]==0x1){_0x8a8cce[_0x8727('0x76')]('`'+_0x10876e['field']+_0x8727('0x77'));}else{_0x8a8cce[_0x8727('0x76')]('`'+_0x10876e['field']+'`\x20>\x200');}break;case'Contact':if(_0x10876e['operator']===_0x8727('0x78')){if(_0x10876e[_0x8727('0x75')]['split']('\x20')[_0x8727('0x71')]>0x1){_0x5f4908[_0x7e15b0](_0x8727('0x79'),qs[_0x8727('0x7a')](_0x10876e[_0x8727('0x75')]),null);}else{var _0x16a11b='%'+_0x10876e['value']+'%';_0x5f4908[_0x7e15b0](_0x8727('0x7b'),_0x16a11b,_0x16a11b,_0x16a11b);}}else{_0x407518=_[_0x8727('0x73')](_0x21bfe8,[_0x8727('0x41'),_0x8727('0x7c')]);_0x10876e[_0x8727('0x5a')]=_0x8727('0x7c');_0x398d7f=as[_0x8727('0x7d')](_0x11441a,_0x407518[_0x8727('0x4d')],_0x10876e);_0x5f4908[_0x7e15b0](_0x398d7f[_0x8727('0x7e')],_0x398d7f['value'][_0x8727('0x7f')],_0x398d7f[_0x8727('0x75')][_0x8727('0x35')]);}break;case'Tag':var _0x303092=_0x10876e['value'][_0x8727('0x48')](',')[_0x8727('0x44')](function(_0xb8e231){return Number(_0xb8e231);});_0x303092[_0x8727('0x80')](function(_0x1255a7){_0x105a9d['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x1255a7+',%');});_0x1f8f2a=_['union'](_0x1f8f2a,_0x303092);break;case _0x8727('0x81'):if(_0x10876e[_0x8727('0x82')]===_0x8727('0x78')){_0x5f4908[_0x7e15b0](_0x8727('0x83'),'%'+_0x10876e[_0x8727('0x75')]+'%',null);}else{_0x407518=_['find'](_0x21bfe8,[_0x8727('0x41'),'UserId']);_0x10876e[_0x8727('0x5a')]='UserId';_0x398d7f=as['buildExpression'](_0x11441a,_0x407518[_0x8727('0x4d')],_0x10876e);_0x5f4908[_0x7e15b0](_0x398d7f[_0x8727('0x7e')],_0x398d7f[_0x8727('0x75')][_0x8727('0x7f')],_0x398d7f[_0x8727('0x75')]['end']);}break;case'body':_0x398d7f=as[_0x8727('0x7d')]('me',null,_0x10876e);_0x5f4908[_0x7e15b0](_0x398d7f[_0x8727('0x7e')],_0x398d7f['value'][_0x8727('0x7f')],_0x398d7f[_0x8727('0x75')][_0x8727('0x35')]);break;}}else{var _0x398d7f=as['buildExpression'](_0x11441a,_0x407518[_0x8727('0x4d')],_0x10876e);_0x5f4908[_0x7e15b0](_0x398d7f[_0x8727('0x7e')],_0x398d7f[_0x8727('0x75')][_0x8727('0x7f')],_0x398d7f[_0x8727('0x75')][_0x8727('0x35')]);}}}else{var _0x271588=_(_0x3aac97['query'])['keys']()['map'](function(_0x1441a5){return _[_0x8727('0x84')](_0x21bfe8,[_0x8727('0x41'),_0x1441a5])?_0x1441a5:undefined;})[_0x8727('0x85')]()[_0x8727('0x75')]();if(!_[_0x8727('0x86')](_0x271588)){_0x271588[_0x8727('0x80')](function(_0x18c76e){if(_0x18c76e===_0x8727('0x87')){_0x8a8cce[_0x8727('0x58')](_0x8727('0x88'),[][_0x8727('0x89')](_0x3aac97[_0x8727('0x4f')][_0x18c76e]));}else if(_0x18c76e===_0x8727('0x8a')){var _0x2b1916=JSON['parse'](_0x3aac97['query'][_0x18c76e])['$gte'];var _0x449dc0=JSON[_0x8727('0x8b')](_0x3aac97['query'][_0x18c76e])[_0x8727('0x8c')];_0x8a8cce[_0x8727('0x58')](_0x8727('0x8d'),_0x2b1916,_0x449dc0);}else{if(_0x3aac97['query'][_0x18c76e]===_0x8727('0x8e')){_0x8a8cce['where']('i.'+_0x18c76e+_0x8727('0x8f'));}else{_0x8a8cce[_0x8727('0x58')]('i.'+_0x18c76e+_0x8727('0x90'),_0x3aac97['query'][_0x18c76e]);}}});}if(_0x3aac97['query'][_0x8727('0x91')]){if(_0x3aac97[_0x8727('0x4f')][_0x8727('0x91')]==0x1){_0x8a8cce[_0x8727('0x76')](_0x8727('0x92'));}else{_0x8a8cce[_0x8727('0x76')](_0x8727('0x93'));}}if(_0x3aac97[_0x8727('0x4f')]['tag']){_0x1f8f2a=_['isArray'](_0x3aac97['query'][_0x8727('0x94')])?_0x3aac97[_0x8727('0x4f')][_0x8727('0x94')]:new Array(_0x3aac97['query'][_0x8727('0x94')]);_0x1f8f2a[_0x8727('0x80')](function(_0x5e2af5){_0x105a9d['or'](_0x8727('0x95'),'%,'+_0x5e2af5+',%');});}if(_0x3aac97[_0x8727('0x4f')][_0x8727('0x96')]){var _0x444b9e=_0x3aac97[_0x8727('0x4f')][_0x8727('0x96')][_0x8727('0x97')]('\x5c','\x5c\x5c')[_0x8727('0x97')]('\x27\x27',_0x8727('0x98'));if(qs[_0x8727('0x99')](_0x444b9e)){_0x5f4908['or']('i.id\x20LIKE\x20?',_0x444b9e+'%');}else{_0x5f4908['or'](_0x8727('0x9a'),qs[_0x8727('0x7a')](_0x444b9e))['or'](_0x8727('0x9b'),_0x444b9e+'%');}}}_0x8a8cce[_0x8727('0x58')](_0x5f4908);_0x8a8cce[_0x8727('0x9c')](_0x8727('0x9d'));var _0x136f97={'type':db[_0x8727('0x24')][_0x8727('0x9e')][_0x8727('0x9f')],'raw':!![]};var _0x1402d5=_0x8a8cce[_0x8727('0xa0')]();_0x1402d5['field'](_0x8727('0x9d'));_0x1402d5[_0x8727('0x5a')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');if(_0x51e3fa[_0x8727('0x56')]){_0x51e3fa[_0x8727('0x56')][_0x8727('0x80')](function(_0x1e5252){_0x8a8cce[_0x8727('0x56')]('i.'+_0x1e5252[0x0],_0x1e5252[0x1]==='DESC'?![]:!![]);});}if(!_[_0x8727('0x86')](_0x1f8f2a)){_0x8a8cce[_0x8727('0x76')](_0x105a9d);_0x1402d5['where'](_0x8727('0xa1'),_0x1f8f2a);}BPromise['resolve']()[_0x8727('0x28')](function(){if(!_0x5246c1){if(_0x3aac97[_0x8727('0x4f')]['ChatWebsiteId']||_0x3aac97['query'][_0x8727('0xa2')])return;_0x1402d5[_0x8727('0x58')](_0x8727('0xa3'));_0x8a8cce['where'](_0x8727('0xa3'));return;}return _0x3aac97[_0x8727('0xa4')][_0x8727('0xa5')]({'attributes':['id'],'raw':!![]})['then'](function(_0x353213){if(_[_0x8727('0x86')](_0x353213)){_0x1402d5[_0x8727('0x58')](_0x8727('0xa6'));_0x8a8cce['where']('i.ChatWebsiteId\x20IS\x20NULL');}else{_0x1402d5['where'](_0x8727('0x88'),_[_0x8727('0x44')](_0x353213,'id'));_0x8a8cce[_0x8727('0x58')](_0x8727('0x88'),_[_0x8727('0x44')](_0x353213,'id'));}});})[_0x8727('0x28')](function(){db[_0x8727('0xa7')][_0x8727('0x4f')](_0x1402d5[_0x8727('0xa8')](),_0x136f97)[_0x8727('0x28')](function(_0x13dc56){_0x24ae2d[_0x8727('0x36')]=_0x13dc56[_0x8727('0x71')];if(_0x24ae2d['count']===0x0)return[];return db[_0x8727('0xa7')][_0x8727('0x4f')](_0x19a0ab[_0x8727('0xa8')](),_0x136f97)[_0x8727('0x28')](function(_0x2834b8){_0x207893=_[_0x8727('0xa9')](_0x2834b8,'id');_0x136f97=_[_0x8727('0xaa')](_0x136f97,{'model':db[_0x8727('0x4b')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3aac97[_0x8727('0x4f')]['fields']){_0x51e3fa[_0x8727('0x53')]['forEach'](function(_0x311f51){_0x8a8cce[_0x8727('0x5a')]('i.'+_0x311f51);});}else{_0x8a8cce[_0x8727('0x5a')](_0x8727('0xab'),_0x8727('0x74'));_0x8a8cce[_0x8727('0x5a')](_0x8727('0xac'),_0x8727('0xad'));_0x8a8cce[_0x8727('0x5a')](_0x8727('0xae'),_0x8727('0xaf'));_0x8a8cce['field']('i.*');_0x8a8cce[_0x8727('0x5a')](_0x8727('0xb0'),'Contact.firstName');_0x8a8cce[_0x8727('0x5a')]('c.lastName',_0x8727('0xb1'));_0x8a8cce[_0x8727('0x5a')](_0x8727('0xb2'),_0x8727('0xb3'));_0x8a8cce[_0x8727('0x5a')]('c.phone',_0x8727('0xb4'));_0x8a8cce[_0x8727('0x5a')](_0x8727('0xb5'),_0x8727('0xb6'));_0x8a8cce[_0x8727('0x5a')]('c.fax','Contact.fax');_0x8a8cce[_0x8727('0x5a')](_0x8727('0xb7'),_0x8727('0xb8'));_0x8a8cce[_0x8727('0x5a')](_0x8727('0xb9'),_0x8727('0xba'));_0x8a8cce[_0x8727('0x5a')](_0x8727('0xbb'),'TagIds');}if(_0x51e3fa[_0x8727('0x38')])_0x8a8cce[_0x8727('0x38')](_0x51e3fa[_0x8727('0x38')]);if(_0x51e3fa['offset'])_0x8a8cce[_0x8727('0x37')](_0x51e3fa[_0x8727('0x37')]);return db[_0x8727('0xa7')][_0x8727('0x4f')](_0x8a8cce['toString'](),_0x136f97);})[_0x8727('0x28')](function(_0x2abd90){_0x3cbc81[_0x8727('0x58')](_0x8727('0xbc'),_[_0x8727('0x44')](_0x2abd90,'id'));return db[_0x8727('0xa7')]['query'](_0x3cbc81[_0x8727('0xa8')](),_0x136f97)[_0x8727('0x28')](function(_0x50e746){var _0x3441a6=_[_0x8727('0xbd')](_0x50e746,_0x8727('0xbe'));var _0x1d9908=[];_0x2abd90[_0x8727('0x80')](function(_0x28ca63){_0x1d9908[_0x8727('0x49')](updateChatInteraction(_0x28ca63,_0x207893,_0x3441a6));});return BPromise['all'](_0x1d9908);});});})[_0x8727('0x28')](function(_0x58f25b){_0x24ae2d[_0x8727('0xbf')]=_0x58f25b;return _0x24ae2d;})[_0x8727('0x28')](respondWithFilteredResult(_0x2b5ba7,_0x51e3fa));})[_0x8727('0x33')](handleError(_0x2b5ba7,null));};exports['show']=function(_0x22751e,_0x30b18a){var _0x357298={'raw':![],'where':{'id':_0x22751e[_0x8727('0xc0')]['id']}},_0x4b1f4e={};_0x4b1f4e['model']=_[_0x8727('0x50')](db['ChatInteraction'][_0x8727('0xc1')]);_0x4b1f4e['query']=_['keys'](_0x22751e['query']);_0x4b1f4e[_0x8727('0x59')]=_[_0x8727('0x51')](_0x4b1f4e[_0x8727('0x4e')],_0x4b1f4e['query']);_0x357298[_0x8727('0x53')]=_['intersection'](_0x4b1f4e['model'],qs['fields'](_0x22751e[_0x8727('0x4f')][_0x8727('0x52')]));_0x357298[_0x8727('0x53')]=_0x357298['attributes']['length']?_0x357298[_0x8727('0x53')]:_0x4b1f4e['model'];if(_0x22751e['query'][_0x8727('0xc2')]){_0x357298[_0x8727('0xc3')]=[{'all':!![]}];}_0x357298=_[_0x8727('0xaa')]({},_0x357298,_0x22751e[_0x8727('0xc4')]);return db[_0x8727('0x4b')][_0x8727('0x73')](_0x357298)[_0x8727('0x28')](handleEntityNotFound(_0x30b18a,null))['then'](respondWithResult(_0x30b18a,null))[_0x8727('0x33')](handleError(_0x30b18a,null));};exports[_0x8727('0xc5')]=function(_0x128380,_0x1a3d61){return db[_0x8727('0x4b')]['create'](_0x128380['body'],{})[_0x8727('0x28')](respondWithResult(_0x1a3d61,0xc9))[_0x8727('0x33')](handleError(_0x1a3d61,null));};exports[_0x8727('0xc6')]=function(_0xd4fc71,_0x181c47){if(_0xd4fc71['body']['id']){delete _0xd4fc71[_0x8727('0xc7')]['id'];}return db[_0x8727('0x4b')][_0x8727('0x73')]({'where':{'id':_0xd4fc71[_0x8727('0xc0')]['id']}})[_0x8727('0x28')](handleEntityNotFound(_0x181c47,null))[_0x8727('0x28')](saveUpdates(_0xd4fc71['body'],null))[_0x8727('0x28')](respondWithResult(_0x181c47,null))[_0x8727('0x33')](handleError(_0x181c47,null));};exports[_0x8727('0xc8')]=function(_0x50acda,_0x498272){return db[_0x8727('0x4b')][_0x8727('0x73')]({'where':{'id':_0x50acda[_0x8727('0xc0')]['id']}})[_0x8727('0x28')](handleEntityNotFound(_0x498272,null))[_0x8727('0x28')](removeEntity(_0x498272,null))['catch'](handleError(_0x498272,null));};exports[_0x8727('0xc9')]=function(_0x56c17c,_0x4f0f79){return db[_0x8727('0x4b')][_0x8727('0xc9')]()[_0x8727('0x28')](respondWithResult(_0x4f0f79,null))[_0x8727('0x33')](handleError(_0x4f0f79,null));};exports[_0x8727('0xca')]=function(_0x3ecac6,_0x2ca238){var _0x46338a=_0x3ecac6[_0x8727('0xc0')]['id'];var _0x85d98d;var _0x114514;var _0x56deec;return db[_0x8727('0x4b')][_0x8727('0xcb')]({'where':{'id':_0x46338a}})[_0x8727('0x28')](function(_0xeb4c54){_0x85d98d=_0xeb4c54;return db['ChatWebsite']['findOne']({'where':{'id':_0xeb4c54[_0x8727('0x87')]},'attributes':['id','vidaooApiKey',_0x8727('0xcc')],'raw':!![]});})[_0x8727('0x28')](function(_0x4eecd9){if(_0x4eecd9&&_0x4eecd9[_0x8727('0xcd')]&&_0x4eecd9[_0x8727('0xcc')]){_0x114514=_0x4eecd9;var _0x1b6a69={'rejectUnauthorized':![],'method':_0x8727('0xce'),'uri':_0x8727('0xcf'),'headers':{'X-APIKEY':_0x4eecd9['vidaooApiKey']},'body':{'name':_0x8727('0xd0')+_0x46338a},'redirect':'follow','json':!![]};return rp(_0x1b6a69);}else{throw new db[(_0x8727('0x24'))]['ValidationError'](_0x8727('0xd1'));}})[_0x8727('0x28')](function(_0x15fd8c){_0x56deec=_0x15fd8c;if(_0x56deec['id']){var _0x2a5c45={'body':_0x56deec[_0x8727('0xd2')],'ChatWebsiteId':_0x114514['id'],'ChatInteractionId':_0x85d98d['id'],'direction':'out','UserId':_0x3ecac6['user']['id']};return db[_0x8727('0xd3')]['create'](_0x2a5c45,{});}else{throw new db[(_0x8727('0x24'))]['ValidationError'](_0x8727('0xd4'));}})[_0x8727('0x28')](function(){return _0x85d98d['updateAttributes']({'vidaooSessionId':_0x56deec['id']});})[_0x8727('0x28')](respondWithResult(_0x2ca238,null))[_0x8727('0x33')](handleError(_0x2ca238,null));};exports['customUpdate']=function(_0x57d140,_0x3da8cb){if(_0x57d140[_0x8727('0xc7')]['id']){delete _0x57d140[_0x8727('0xc7')]['id'];}return db['ChatInteraction'][_0x8727('0x73')]({'where':{'id':_0x57d140[_0x8727('0xc0')]['id']}})[_0x8727('0x28')](handleEntityNotFound(_0x3da8cb,null))[_0x8727('0x28')](saveUpdates(_0x57d140[_0x8727('0xc7')],null))['then'](respondWithResult(_0x3da8cb,null))[_0x8727('0x33')](handleError(_0x3da8cb,null));};exports['abandon']=function(_0x85cab0,_0x3e4367,_0xbffdc1){if(_0x85cab0['body']['id']){delete _0x85cab0[_0x8727('0xc7')]['id'];}return db[_0x8727('0x4b')][_0x8727('0x73')]({'where':{'id':_0x85cab0[_0x8727('0xc0')]['id']}})[_0x8727('0x28')](function(_0x2438e1){if(!_0x2438e1){logger[_0x8727('0x2e')](_0x8727('0xd5'),_0x8727('0xd6'),0x194,_0x8727('0xd7'));_0x3e4367[_0x8727('0x3f')](0x194);}else{if(_0x2438e1[_0x8727('0xd8')]){throw new db[(_0x8727('0x24'))]['ValidationError'](_0x8727('0xd9'));}}return _0x2438e1;})[_0x8727('0x28')](function(_0x176cbf){if(_0x176cbf){return _0x176cbf[_0x8727('0xc6')]({'closed':_0x85cab0[_0x8727('0xc7')][_0x8727('0xda')],'disposition':_0x85cab0[_0x8727('0xc7')]['disposition']})[_0x8727('0x28')](function(_0x3784ca){return _0x3784ca;});}})[_0x8727('0x28')](function(_0x44f90c){return respondWithRpcPromise(_0x8727('0xdb'),_0x8727('0xd6'),_0x85cab0[_0x8727('0xc7')],client9004);})[_0x8727('0x28')](respondWithResult(_0x3e4367,null))[_0x8727('0x33')](handleError(_0x3e4367,null));};exports['attachmentUpload']=function(_0x54afd1,_0x1a1261,_0x3c8280){_0x54afd1[_0x8727('0xc7')][_0x8727('0x41')]=_0x54afd1[_0x8727('0xdc')]['originalname'];_0x54afd1[_0x8727('0xc7')][_0x8727('0xdd')]=_0x54afd1[_0x8727('0xdc')]['filename'];_0x54afd1[_0x8727('0xc7')][_0x8727('0x4d')]=_0x54afd1[_0x8727('0xdc')]['mimetype'];return db[_0x8727('0xde')]['create'](_0x54afd1[_0x8727('0xc7')])[_0x8727('0x28')](respondWithResult(_0x1a1261,0xc9))[_0x8727('0x33')](handleError(_0x1a1261,null));};exports['attachmentDownload']=function(_0x2ac756,_0x347744,_0x1bc73d){return db[_0x8727('0x4b')][_0x8727('0xcb')]({'where':{'id':_0x2ac756[_0x8727('0xc0')]['id']},'raw':!![]})[_0x8727('0x28')](handleEntityNotFound(_0x347744,null))[_0x8727('0x28')](function(_0x28bfcc){if(_0x28bfcc){if(_0x28bfcc[_0x8727('0xda')]){return _0x347744[_0x8727('0x34')](0x193)[_0x8727('0x3b')]({'status':0x193,'message':_0x8727('0xdf')});}return db[_0x8727('0xde')][_0x8727('0xcb')]({'where':{'id':_0x2ac756[_0x8727('0x4f')][_0x8727('0xe0')]},'raw':!![]})[_0x8727('0x28')](handleEntityNotFound(_0x347744,null));}})[_0x8727('0x28')](function(_0x5a2ed4){if(_0x5a2ed4){return _0x347744[_0x8727('0xe1')](path[_0x8727('0xe2')](config['root'],_0x8727('0xe3'),_0x5a2ed4['basename']));}})[_0x8727('0x33')](handleError(_0x347744,null));};exports[_0x8727('0xe4')]=function(_0x42d226,_0x5b8a00){var _0x1f16f0=null;var _0x111973=null;var _0x450b8d=null;var _0x1d6116=null;if(_0x42d226[_0x8727('0xc7')]['id']){delete _0x42d226[_0x8727('0xc7')]['id'];}if(_0x42d226[_0x8727('0xc7')][_0x8727('0xe5')]){_0x1d6116=path[_0x8727('0xe2')](config[_0x8727('0xe6')],_0x8727('0xe7'),util['format'](_0x8727('0xe8'),Date[_0x8727('0xe9')]()));_0x42d226[_0x8727('0xc7')][_0x8727('0xea')]=_0x1d6116;}return db[_0x8727('0x4b')][_0x8727('0x73')]({'where':{'id':_0x42d226['params']['id']},'include':[{'model':db['ChatMessage'],'as':_0x8727('0xeb'),'include':[{'model':db[_0x8727('0x81')],'as':_0x8727('0x81')}]}]})[_0x8727('0x28')](handleEntityNotFound(_0x5b8a00,null))['then'](saveUpdates(_0x42d226[_0x8727('0xc7')],null))['then'](function(_0x43648f){if(_0x43648f){_0x1f16f0=_0x43648f;return db[_0x8727('0xec')][_0x8727('0x73')]({'where':{'id':_0x1f16f0[_0x8727('0x87')]}});}})[_0x8727('0x28')](function(_0x4bd379){if(_0x4bd379){_0x450b8d=_0x4bd379;return db['CmContact']['find']({'where':{'id':_0x1f16f0[_0x8727('0x7c')]}});}})[_0x8727('0x28')](function(_0x592209){if(_0x592209){_0x111973=_0x592209;if(_0x1d6116){var _0x316136=null;for(var _0x555f62=0x1;_0x555f62<_0x1f16f0[_0x8727('0xeb')][_0x8727('0x71')];++_0x555f62){_0x316136=_0x1f16f0[_0x8727('0xeb')][_0x555f62];var _0x403593=_0x316136[_0x8727('0xd8')]?util[_0x8727('0xed')](_0x8727('0xee'),_0x450b8d[_0x8727('0xef')],_0x316136['UserId']):'System';var _0x188c9c=_0x42d226['body'][_0x8727('0xf0')]||util[_0x8727('0xed')](_0x8727('0xee'),_0x8727('0xf1'),_0x316136[_0x8727('0x7c')]);switch(_0x450b8d['agentIdentifier']){case _0x8727('0xf2'):_0x403593=_0x316136[_0x8727('0xd8')]?util['format']('%s%d',_0x450b8d['agentAlias'],_0x316136['UserId']):_0x8727('0xf3');break;case _0x8727('0xf4'):_0x403593=_0x316136[_0x8727('0xd8')]?_0x316136[_0x8727('0x81')][_0x8727('0xf5')]||_0x316136['User']['fullname']:_0x8727('0xf3');break;case'agent_fullname':_0x403593=_0x316136[_0x8727('0xd8')]?_0x316136[_0x8727('0x81')][_0x8727('0x45')]:_0x8727('0xf3');break;default:_0x403593=_0x316136[_0x8727('0xd8')]?util[_0x8727('0xed')](_0x8727('0xee'),_0x450b8d[_0x8727('0xef')],_0x316136[_0x8727('0xd8')]):_0x8727('0xf3');}var _0x60fd55=util[_0x8727('0xed')](_0x8727('0xf6'),moment(_0x316136['createdAt'])['format'](_0x8727('0xf7')),_0x316136[_0x8727('0xf8')]==='in'?_0x188c9c:_0x403593,_0x316136['body']);if(!_0x316136[_0x8727('0xf9')]){fs[_0x8727('0xfa')](_0x1d6116,_0x60fd55);}}return db[_0x8727('0xfb')][_0x8727('0xcb')]({'where':{'service':!![]},'include':[{'model':db[_0x8727('0xfc')],'as':_0x8727('0xfd'),'raw':!![]}]});}}})['then'](function(_0x272682){if(_0x272682&&_0x272682[_0x8727('0xfd')]&&_0x42d226[_0x8727('0xc7')]){var _0xda7ef3={'tls':{'rejectUnauthorized':![]}};if(_0x272682[_0x8727('0xfd')][_0x8727('0xfe')]){_0xda7ef3[_0x8727('0xfe')]=_0x272682['Smtp'][_0x8727('0xfe')];}else{_0xda7ef3[_0x8727('0xff')]=_0x272682[_0x8727('0xfd')]['host'];_0xda7ef3[_0x8727('0x100')]=_0x272682['Smtp'][_0x8727('0x100')];_0xda7ef3['secure']=_0x272682['Smtp'][_0x8727('0x101')];}if(_0x272682['Smtp']['authentication']){_0xda7ef3[_0x8727('0x102')]={'user':_0x272682[_0x8727('0xfd')]['user'],'pass':_0x272682[_0x8727('0xfd')][_0x8727('0x103')]};}return respondWithRpcPromise(_0x8727('0x104'),_0x8727('0x105'),{'account':_0xda7ef3,'message':{'from':util[_0x8727('0xed')](_0x8727('0x106'),_0x272682[_0x8727('0x41')],_0x272682[_0x8727('0x107')]||_0x272682[_0x8727('0xfd')][_0x8727('0xa4')]),'to':_0x42d226[_0x8727('0xc7')]['mailTranscript'],'subject':_0x8727('0x108'),'text':util['format'](_0x8727('0x109'),_0x42d226['body']['mailTranscript']),'attachments':[{'path':_0x1d6116}]}})['then'](function(){return _0x1f16f0;})[_0x8727('0x33')](function(_0x46c688){console['error'](_0x46c688);});}else{return _0x1f16f0;}})[_0x8727('0x28')](respondWithStatusCode(_0x5b8a00,0xc8))['catch'](handleError(_0x5b8a00,null));};exports['addMessage']=function(_0x5221bb,_0x754ce8,_0x355ff6){return db[_0x8727('0xd3')][_0x8727('0x73')]({'where':{'id':_0x5221bb['params']['id']}})[_0x8727('0x28')](handleEntityNotFound(_0x754ce8,null))[_0x8727('0x28')](function(_0x10864d){if(_0x10864d){return _0x10864d['addMessage'](_0x5221bb[_0x8727('0xc7')][_0x8727('0x10a')],_[_0x8727('0x10b')](_0x5221bb[_0x8727('0xc7')],[_0x8727('0x10a'),'id'])||{});}})[_0x8727('0x28')](respondWithResult(_0x754ce8,null))[_0x8727('0x33')](handleError(_0x754ce8,null));};exports[_0x8727('0x10c')]=function(_0x1487ee,_0x259a62,_0x524653){var _0x32c2e6={'raw':![],'where':{}};var _0x3ae291={};var _0x40def0={'count':0x0,'rows':[]};return db[_0x8727('0x4b')]['findOne']({'where':{'id':_0x1487ee[_0x8727('0xc0')]['id']}})[_0x8727('0x28')](handleEntityNotFound(_0x259a62,null))[_0x8727('0x28')](function(_0x1a3d90){if(_0x1a3d90){_0x3ae291['model']=_[_0x8727('0x50')](db['ChatMessage'][_0x8727('0xc1')]);_0x3ae291['query']=_[_0x8727('0x50')](_0x1487ee[_0x8727('0x4f')]);_0x3ae291[_0x8727('0x59')]=_[_0x8727('0x51')](_0x3ae291['model'],_0x3ae291[_0x8727('0x4f')]);_0x32c2e6['attributes']=_[_0x8727('0x51')](_0x3ae291[_0x8727('0x4e')],qs['fields'](_0x1487ee[_0x8727('0x4f')][_0x8727('0x52')]));_0x32c2e6[_0x8727('0x53')]=_0x32c2e6['attributes']['length']?_0x32c2e6[_0x8727('0x53')]:_0x3ae291['model'];if(!_0x1487ee[_0x8727('0x4f')]['hasOwnProperty'](_0x8727('0x55'))){_0x32c2e6['limit']=qs[_0x8727('0x38')](_0x1487ee[_0x8727('0x4f')][_0x8727('0x38')]);_0x32c2e6['offset']=qs[_0x8727('0x37')](_0x1487ee[_0x8727('0x4f')][_0x8727('0x37')]);}_0x32c2e6['order']=qs['sort'](_0x1487ee['query']['sort']);_0x32c2e6[_0x8727('0x58')]=qs[_0x8727('0x59')](_['pick'](_0x1487ee['query'],_0x3ae291[_0x8727('0x59')]));_0x32c2e6[_0x8727('0x58')][_0x8727('0xbe')]=_0x1a3d90['id'];if(_0x1487ee[_0x8727('0x4f')][_0x8727('0x96')]){_0x32c2e6[_0x8727('0x58')]=_[_0x8727('0xaa')](_0x32c2e6['where'],{'$or':_[_0x8727('0x44')](_0x32c2e6['attributes'],function(_0x419a84){var _0x374139={};_0x374139[_0x419a84]={'$like':'%'+_0x1487ee[_0x8727('0x4f')]['filter']+'%'};return _0x374139;})});}if(_0x1487ee[_0x8727('0x4f')]['$gte']){var _0x41bc35=_0x1487ee[_0x8727('0x4f')]['$gte']['split'](',');var _0xb9f1fd={};_0xb9f1fd[_0x41bc35[0x0]]={'$gte':moment(_0x41bc35[0x1])[_0x8727('0xed')](_0x8727('0x10d'))};_0x32c2e6[_0x8727('0x58')]=_[_0x8727('0xaa')](_0x32c2e6[_0x8727('0x58')],_0xb9f1fd);}_0x32c2e6=_[_0x8727('0xaa')]({},_0x32c2e6,_0x1487ee['options']);return db[_0x8727('0xd3')][_0x8727('0x36')]({'where':_0x32c2e6[_0x8727('0x58')]})[_0x8727('0x28')](function(_0xc8055b){_0x40def0[_0x8727('0x36')]=_0xc8055b;if(_0x1487ee[_0x8727('0x4f')]['includeAll']){_0x32c2e6[_0x8727('0xc3')]=[{'all':!![]}];}return db['ChatMessage'][_0x8727('0x10e')](_0x32c2e6);})['then'](function(_0x2cdc7e){_0x40def0['rows']=_0x2cdc7e;return _0x40def0;});}})[_0x8727('0x28')](respondWithFilteredResult(_0x259a62,_0x32c2e6))['catch'](handleError(_0x259a62,null));};exports[_0x8727('0x10f')]=function(_0xa19db3,_0x18ebd0,_0x5c781c){var _0x412de3={'where':{}},_0x3c9c91={},_0x4b487c={'count':0x0,'rows':[]};return db['ChatInteraction']['findOne']({'where':{'id':_0xa19db3['params']['id']}})[_0x8727('0x28')](handleEntityNotFound(_0x18ebd0,null))[_0x8727('0x28')](function(_0x5d07eb){if(_0x5d07eb){_0x3c9c91['model']=_[_0x8727('0x50')](db[_0x8727('0xd3')][_0x8727('0xc1')]);_0x3c9c91[_0x8727('0x4f')]=_['keys'](_0xa19db3['query']);_0x3c9c91[_0x8727('0x59')]=_['intersection'](_0x3c9c91['model'],_0x3c9c91[_0x8727('0x4f')]);_0x412de3[_0x8727('0x53')]=_[_0x8727('0x51')](_0x3c9c91[_0x8727('0x4e')],qs[_0x8727('0x52')](_0xa19db3['query'][_0x8727('0x52')]));_0x412de3['attributes']=_0x412de3[_0x8727('0x53')][_0x8727('0x71')]?_0x412de3[_0x8727('0x53')]:_0x3c9c91[_0x8727('0x4e')];if(!_0xa19db3[_0x8727('0x4f')][_0x8727('0x54')](_0x8727('0x55'))){_0x412de3[_0x8727('0x38')]=qs['limit'](_0xa19db3[_0x8727('0x4f')][_0x8727('0x38')]);_0x412de3[_0x8727('0x37')]=qs[_0x8727('0x37')](_0xa19db3['query'][_0x8727('0x37')]);}_0x412de3[_0x8727('0x56')]=qs['sort'](_0xa19db3[_0x8727('0x4f')][_0x8727('0x57')]);_0x412de3[_0x8727('0x58')]=qs['filters'](_['pick'](_0xa19db3[_0x8727('0x4f')],_0x3c9c91['filters']));_0x412de3[_0x8727('0x58')][_0x8727('0xbe')]=_0x5d07eb['id'];if(_0xa19db3[_0x8727('0x4f')][_0x8727('0x96')]){_0x412de3[_0x8727('0x58')]=_[_0x8727('0xaa')](_0x412de3[_0x8727('0x58')],{'$or':_[_0x8727('0x44')](_0x412de3[_0x8727('0x53')],function(_0x5fdbda){var _0x74eef0={};_0x74eef0[_0x5fdbda]={'$like':'%'+_0xa19db3[_0x8727('0x4f')][_0x8727('0x96')]+'%'};return _0x74eef0;})});}_0x412de3[_0x8727('0x58')][_0x8727('0xf9')]=![];if(_0xa19db3[_0x8727('0x4f')]['id']){_0x412de3[_0x8727('0x58')]['id']={'$gt':_0xa19db3[_0x8727('0x4f')]['id']};}_0x412de3=_[_0x8727('0xaa')]({},_0x412de3,_0xa19db3[_0x8727('0xc4')]);return db[_0x8727('0xd3')][_0x8727('0x36')]({'where':_0x412de3['where']})[_0x8727('0x28')](function(_0x1da389){_0x4b487c[_0x8727('0x36')]=_0x1da389;_0x412de3[_0x8727('0xc3')]=[];if(_0xa19db3['query'][_0x8727('0x110')]){_0x412de3[_0x8727('0xc3')]['push']({'model':db[_0x8727('0x81')],'as':_0x8727('0x81'),'attributes':['id',_0x8727('0x45'),_0x8727('0xf5')]});}if(_0xa19db3[_0x8727('0x4f')]['includeAll']){_0x412de3['include']=[{'all':!![]}];}return db[_0x8727('0xd3')]['findAll'](_0x412de3);})[_0x8727('0x28')](function(_0x187581){_0x4b487c[_0x8727('0xbf')]=_0x187581;return _0x4b487c;});}})[_0x8727('0x28')](respondWithFilteredResult(_0x18ebd0,_0x412de3))[_0x8727('0x33')](handleError(_0x18ebd0,null));};exports[_0x8727('0x111')]=function(_0x25103d,_0x3f73b3,_0x1fd0ff){return db[_0x8727('0x4b')][_0x8727('0x73')]({'where':{'id':_0x25103d[_0x8727('0xc0')]['id']}})[_0x8727('0x28')](handleEntityNotFound(_0x3f73b3,null))[_0x8727('0x28')](function(_0x5788fc){if(_0x5788fc){return _0x5788fc['setTags'](_0x25103d['body'][_0x8727('0x10a')],_[_0x8727('0x10b')](_0x25103d[_0x8727('0xc7')],['ids','id'])||{})[_0x8727('0x112')](function(){return db[_0x8727('0x113')]['findAll']({'attributes':['id',_0x8727('0x41'),'color'],'where':{'id':_0x25103d[_0x8727('0xc7')][_0x8727('0x10a')]}});})['then'](function(_0x12f8fe){socket[_0x8727('0x114')]('chatInteractionTags:save',{'id':Number(_0x25103d['params']['id']),'tags':_0x12f8fe||[]});return{'id':Number(_0x25103d[_0x8727('0xc0')]['id']),'tags':_0x12f8fe||[]};});}})[_0x8727('0x28')](respondWithResult(_0x3f73b3,null))[_0x8727('0x33')](handleError(_0x3f73b3,null));};exports[_0x8727('0x115')]=function(_0x16058b,_0x2267b0,_0x164aef){return db[_0x8727('0x4b')][_0x8727('0x73')]({'where':{'id':_0x16058b[_0x8727('0xc0')]['id']}})[_0x8727('0x28')](handleEntityNotFound(_0x2267b0,null))[_0x8727('0x28')](function(_0x2d231e){if(_0x2d231e){return _0x2d231e['removeTags'](_0x16058b['query']['ids']);}})[_0x8727('0x28')](respondWithStatusCode(_0x2267b0,null))[_0x8727('0x33')](handleError(_0x2267b0,null));};exports[_0x8727('0xe1')]=function(_0x48fc4e,_0x249499){var _0x5d215f=moment()[_0x8727('0x116')]()[_0x8727('0xa8')]();var _0x2c2fb8=path['join'](config[_0x8727('0xe6')],_0x8727('0x117'),_0x8727('0x118'),_0x8727('0x119'));var _0x54d38c=path[_0x8727('0xe2')](config['root'],_0x8727('0x117'),_0x8727('0x118'),_0x8727('0x11a'));var _0x5f4ac7=path[_0x8727('0xe2')](_0x2c2fb8,_0x5d215f);var _0x4c48c7=util[_0x8727('0xed')](_0x8727('0x11b'),_0x48fc4e[_0x8727('0xc0')]['id'],_0x5d215f);var _0xaa1378=path[_0x8727('0xe2')](_0x2c2fb8,_0x4c48c7);var _0xba0976=[];_0xba0976[_0x8727('0x49')]({'model':db[_0x8727('0x81')],'as':_0x8727('0x81'),'attributes':['id',_0x8727('0x45')],'raw':!![]});_0xba0976[_0x8727('0x49')]({'model':db[_0x8727('0x11c')],'as':'Contact','attributes':['id',_0x8727('0x11d'),_0x8727('0x11e')],'raw':!![]});if(_0x48fc4e['query'][_0x8727('0x11a')]){_0xba0976['push']({'model':db[_0x8727('0xde')],'as':_0x8727('0xde'),'raw':!![]});}var _0x157325=[{'model':db['ChatMessage'],'as':_0x8727('0xeb'),'attributes':['id',_0x8727('0xc7'),_0x8727('0x8a'),_0x8727('0xf8'),_0x8727('0xf9'),_0x8727('0x91')],'include':_0xba0976}];_0x157325['push']({'model':db[_0x8727('0xec')],'as':_0x8727('0x11f'),'attributes':['id',_0x8727('0x41')]});_0x157325['push']({'model':db[_0x8727('0x81')],'as':_0x8727('0x120'),'attributes':['id',_0x8727('0x45')]});return db[_0x8727('0x4b')][_0x8727('0x73')]({'where':{'id':_0x48fc4e['params']['id']},'include':_0x157325})[_0x8727('0x28')](handleEntityNotFound(_0x249499,null))[_0x8727('0x28')](function(_0x377ef6){if(_0x377ef6){var _0x8a48aa=_0x377ef6[_0x8727('0x121')]({'plain':!![]});fs[_0x8727('0x122')](_0x5f4ac7);var _0x45268f={'format':'A4','border':_0x8727('0x123'),'header':{'height':'40px','contents':{'first':'\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'}},'footer':{'height':_0x8727('0x124'),'contents':{'default':util[_0x8727('0xed')](_0x8727('0x125'),util[_0x8727('0xed')](_0x8727('0x126'),_0x8727('0x127'),_0x8a48aa['id']),moment()[_0x8727('0xed')]('YYYY-MM-DD')[_0x8727('0xa8')]())}}};var _0x52f7b2={'channel':'Chat','account':_0x8a48aa[_0x8727('0x11f')][_0x8727('0x41')],'agent':_0x8a48aa[_0x8727('0x120')]?_0x8a48aa['Owner']['fullname']:_0x8727('0x128'),'createdAt':moment(_0x8a48aa['createdAt'])[_0x8727('0xed')](_0x8727('0x10d'))['toString'](),'closedAt':_0x8a48aa['closed']?moment(_0x8a48aa[_0x8727('0x129')])[_0x8727('0xed')](_0x8727('0x10d'))[_0x8727('0xa8')]():'','disposition':_0x8a48aa['disposition'],'chatInfo':{'browser':_0x8a48aa['browserName'],'os':_0x8a48aa[_0x8727('0x12a')],'referer':_0x8a48aa[_0x8727('0x12b')],'customerIp':_0x8a48aa['customerIp'],'customerPort':_0x8a48aa['customerPort']?_0x8a48aa[_0x8727('0x12c')]:'N.A.'},'messages':_(_0x8a48aa[_0x8727('0xeb')])[_0x8727('0x12d')]()[_0x8727('0x96')]({'secret':![]})[_0x8727('0x44')](function(_0x127b36){if(_0x127b36['Attachment']){var _0x3a0647=path['join'](_0x54d38c,_0x127b36[_0x8727('0xde')][_0x8727('0xdd')]);if(fs['existsSync'](_0x3a0647)){fs[_0x8727('0x12e')](_0x3a0647)['pipe'](fs['createWriteStream'](path['join'](_0x5f4ac7,_0x127b36[_0x8727('0xde')]['basename'])));}}return{'date':moment(_0x127b36[_0x8727('0x8a')])[_0x8727('0xed')](_0x8727('0x10d'))['toString'](),'sender':_0x127b36[_0x8727('0xf8')]===_0x8727('0x12f')?_0x127b36['User']?_0x127b36[_0x8727('0x81')]['fullname']:'System':_0x127b36[_0x8727('0x130')][_0x8727('0x11d')]+(_0x127b36[_0x8727('0x130')][_0x8727('0x11e')]?'\x20'+_0x127b36[_0x8727('0x130')][_0x8727('0x11e')]:''),'body':_0x127b36[_0x8727('0xde')]?_0x127b36['Attachment'][_0x8727('0xdd')]:_0x127b36[_0x8727('0xc7')],'direction':_0x127b36['direction']==='out'?'A':'C','secret':_0x127b36[_0x8727('0xf9')],'read':_0x127b36[_0x8727('0x91')],'attachment':_0x127b36[_0x8727('0xde')]};})[_0x8727('0x75')]()};return ejs[_0x8727('0x131')](path[_0x8727('0xe2')](config[_0x8727('0xe6')],_0x8727('0x117'),_0x8727('0x132'),_0x8727('0x133')),{'interaction':_0x52f7b2})[_0x8727('0x28')](function(_0x10d23d){return new BPromise(function(_0xfb2bc0,_0x89c0aa){pdf['create'](_0x10d23d,_0x45268f)[_0x8727('0x134')](path[_0x8727('0xe2')](_0x5f4ac7,_0x8727('0x135')+_0x8a48aa['id']+'-'+_0x5d215f+'.pdf'),function(_0x574273,_0x51de12){if(_0x574273)return _0x89c0aa(_0x574273);_0xfb2bc0(_0x51de12);});});})['then'](function(){return new BPromise(function(_0x57bae2,_0xb33cd9){zipdir(_0x5f4ac7,{'saveTo':_0xaa1378},function(_0x5aa409,_0x500891){if(_0x5aa409)return _0xb33cd9(_0x5aa409);return _0x57bae2(_0x500891);});})[_0x8727('0x28')](function(){return new BPromise(function(_0x47ad91,_0x2f6516){rimraf(_0x5f4ac7,function(_0x135bec){if(_0x135bec)_0x2f6516(_0x135bec);return _0x47ad91();});});})[_0x8727('0x28')](function(){return _0x249499['download'](_0xaa1378,_0x4c48c7,function(_0x3aeed6){if(_0x3aeed6){console[_0x8727('0x136')]('err',_0x3aeed6);}else{fs[_0x8727('0x137')](_0xaa1378);}});});});}else{return _0x249499['sendStatus'](0xc8);}})['catch'](handleError(_0x249499,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 78be78b..02548d9 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 _0x269b=['setDataValue','Users','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','ChatInteraction','../../mysqldb','ChatMessage','setMaxListeners','update','getUsers','then'];(function(_0x2028a2,_0xeaf4ff){var _0x22ddde=function(_0x55a5f9){while(--_0x55a5f9){_0x2028a2['push'](_0x2028a2['shift']());}};_0x22ddde(++_0xeaf4ff);}(_0x269b,0x9a));var _0xb269=function(_0x1c8ce1,_0x14a3d1){_0x1c8ce1=_0x1c8ce1-0x0;var _0x50280d=_0x269b[_0x1c8ce1];return _0x50280d;};'use strict';var EventEmitter=require(_0xb269('0x0'));var ChatInteraction=require('../../mysqldb')['db'][_0xb269('0x1')];var ChatMessage=require(_0xb269('0x2'))['db'][_0xb269('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xb269('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0xb269('0x5'),'afterDestroy':'remove'};function emitEvent(_0x5c4827){return function(_0x4b6243,_0x349406,_0x2398bb){_0x4b6243[_0xb269('0x6')]({'attributes':['id'],'raw':!![]})[_0xb269('0x7')](function(_0x17dcff){_0x4b6243[_0xb269('0x8')](_0xb269('0x9'),_0x17dcff['map'](function(_0x57a954){return{'id':_0x57a954['id']};}));return ChatMessage[_0xb269('0xa')]({'where':{'ChatInteractionId':_0x4b6243['id'],'direction':'in','read':![]},'raw':!![]});})[_0xb269('0x7')](function(_0x33799c){_0x4b6243[_0xb269('0x8')](_0xb269('0xb'),_0x33799c[_0xb269('0xc')]);ChatInteractionEvents[_0xb269('0xd')](_0x5c4827+':'+_0x4b6243['id'],_0x4b6243);ChatInteractionEvents[_0xb269('0xd')](_0x5c4827,_0x4b6243);_0x2398bb(null);})[_0xb269('0xe')](_0x2398bb(null));};}for(var e in events){if(events[_0xb269('0xf')](e)){var event=events[e];ChatInteraction[_0xb269('0x10')](e,emitEvent(event));}}module[_0xb269('0x11')]=ChatInteractionEvents; \ No newline at end of file +var _0x34f0=['remove','then','setDataValue','Users','map','unreadMessages','length','emit','catch','hook','exports','events','../../mysqldb','setMaxListeners','save','update'];(function(_0x385529,_0x2f5a67){var _0x30031d=function(_0x23f3a0){while(--_0x23f3a0){_0x385529['push'](_0x385529['shift']());}};_0x30031d(++_0x2f5a67);}(_0x34f0,0x13b));var _0x034f=function(_0xd60e6a,_0x319cd6){_0xd60e6a=_0xd60e6a-0x0;var _0x4d7c5b=_0x34f0[_0xd60e6a];return _0x4d7c5b;};'use strict';var EventEmitter=require(_0x034f('0x0'));var ChatInteraction=require(_0x034f('0x1'))['db']['ChatInteraction'];var ChatMessage=require(_0x034f('0x1'))['db']['ChatMessage'];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x034f('0x2')](0x0);var events={'afterCreate':_0x034f('0x3'),'afterUpdate':_0x034f('0x4'),'afterDestroy':_0x034f('0x5')};function emitEvent(_0x2bd6d1){return function(_0x5011cd,_0x6ad48f,_0x1fd628){_0x5011cd['getUsers']({'attributes':['id'],'raw':!![]})[_0x034f('0x6')](function(_0x4d03a0){_0x5011cd[_0x034f('0x7')](_0x034f('0x8'),_0x4d03a0[_0x034f('0x9')](function(_0x47e544){return{'id':_0x47e544['id']};}));return ChatMessage['findAll']({'where':{'ChatInteractionId':_0x5011cd['id'],'direction':'in','read':![]},'raw':!![]});})[_0x034f('0x6')](function(_0x50909e){_0x5011cd['setDataValue'](_0x034f('0xa'),_0x50909e[_0x034f('0xb')]);ChatInteractionEvents[_0x034f('0xc')](_0x2bd6d1+':'+_0x5011cd['id'],_0x5011cd);ChatInteractionEvents[_0x034f('0xc')](_0x2bd6d1,_0x5011cd);_0x1fd628(null);})[_0x034f('0xd')](_0x1fd628(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInteraction[_0x034f('0xe')](e,emitEvent(event));}}module[_0x034f('0xf')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index 724c038..28fced6 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 _0x2634=['YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./chatInteraction.attributes','define','ChatInteraction','chat_interactions','closed','format'];(function(_0x43776a,_0x4eb74c){var _0x18eb8f=function(_0x319afb){while(--_0x319afb){_0x43776a['push'](_0x43776a['shift']());}};_0x18eb8f(++_0x4eb74c);}(_0x2634,0x1f3));var _0x4263=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x2634[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0x4263('0x0'));var logger=require(_0x4263('0x1'))(_0x4263('0x2'));var moment=require('moment');var BPromise=require(_0x4263('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4263('0x4'));var rimraf=require(_0x4263('0x5'));var config=require(_0x4263('0x6'));var attributes=require(_0x4263('0x7'));module['exports']=function(_0x1123ed,_0x4d5018){return _0x1123ed[_0x4263('0x8')](_0x4263('0x9'),attributes,{'tableName':_0x4263('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x57ece9,_0x17b72f,_0x538744){if(_0x57ece9['changed'](_0x4263('0xb'))){_0x57ece9['closedAt']=moment()[_0x4263('0xc')](_0x4263('0xd'));}_0x538744(null,_0x57ece9);}},'charset':_0x4263('0xe'),'collate':_0x4263('0xf')});}; \ No newline at end of file +var _0xc604=['YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','moment','bluebird','request-promise','../../config/environment','./chatInteraction.attributes','exports','define','changed','closed','closedAt'];(function(_0x4a9595,_0x4c651f){var _0x2c6ba2=function(_0x23d071){while(--_0x23d071){_0x4a9595['push'](_0x4a9595['shift']());}};_0x2c6ba2(++_0x4c651f);}(_0xc604,0x16f));var _0x4c60=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc604[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x4c60('0x0'));var BPromise=require(_0x4c60('0x1'));var rp=require(_0x4c60('0x2'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x4c60('0x3'));var attributes=require(_0x4c60('0x4'));module[_0x4c60('0x5')]=function(_0x517109,_0x1db17f){return _0x517109[_0x4c60('0x6')]('ChatInteraction',attributes,{'tableName':'chat_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x391291,_0x6737d9,_0xd4674b){if(_0x391291[_0x4c60('0x7')](_0x4c60('0x8'))){_0x391291[_0x4c60('0x9')]=moment()['format'](_0x4c60('0xa'));}_0xd4674b(null,_0x391291);}},'charset':_0x4c60('0xb'),'collate':_0x4c60('0xc')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 576c969..ec3924a 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 _0x6c91=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','then','info','ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','ChatInteraction,\x20%s,\x20%s','message','result','catch','UpdateChatInteraction','ChatInteraction','body','options','raw','debug','stringify','AddTagsToChatInteraction','find','where','ids','omit','spread','AddTags','lodash','moment','bluebird'];(function(_0x37537c,_0x1a4cd5){var _0x42345b=function(_0x5c5309){while(--_0x5c5309){_0x37537c['push'](_0x37537c['shift']());}};_0x42345b(++_0x1a4cd5);}(_0x6c91,0xed));var _0x16c9=function(_0x1c7668,_0x3f047f){_0x1c7668=_0x1c7668-0x0;var _0x5b2934=_0x6c91[_0x1c7668];return _0x5b2934;};'use strict';var _=require(_0x16c9('0x0'));var util=require('util');var moment=require(_0x16c9('0x1'));var BPromise=require(_0x16c9('0x2'));var rs=require(_0x16c9('0x3'));var fs=require('fs');var Redis=require(_0x16c9('0x4'));var db=require(_0x16c9('0x5'))['db'];var utils=require(_0x16c9('0x6'));var logger=require('../../config/logger')(_0x16c9('0x7'));var config=require('../../config/environment');var jayson=require(_0x16c9('0x8'));var client=jayson[_0x16c9('0x9')][_0x16c9('0xa')]({'port':0x232a});config[_0x16c9('0xb')]=_[_0x16c9('0xc')](config[_0x16c9('0xb')],{'host':_0x16c9('0xd'),'port':0x18eb});var socket=require(_0x16c9('0xe'))(new Redis(config[_0x16c9('0xb')]));require(_0x16c9('0xf'))['register'](socket);function respondWithRpcPromise(_0x5853e4,_0x1df1d5,_0xa72142){return new BPromise(function(_0x6842be,_0xc59501){return client['request'](_0x5853e4,_0xa72142)[_0x16c9('0x10')](function(_0x47ac09){logger[_0x16c9('0x11')]('ChatInteraction,\x20%s,\x20%s',_0x1df1d5,'request\x20sent');logger['debug'](_0x16c9('0x12'),_0x1df1d5,_0x16c9('0x13'),JSON['stringify'](_0x47ac09));if(_0x47ac09[_0x16c9('0x14')]){if(_0x47ac09['error'][_0x16c9('0x15')]===0x1f4){logger[_0x16c9('0x14')](_0x16c9('0x16'),_0x1df1d5,_0x47ac09[_0x16c9('0x14')][_0x16c9('0x17')]);return _0xc59501(_0x47ac09['error'][_0x16c9('0x17')]);}logger[_0x16c9('0x14')](_0x16c9('0x16'),_0x1df1d5,_0x47ac09[_0x16c9('0x14')]['message']);return _0x6842be(_0x47ac09[_0x16c9('0x14')][_0x16c9('0x17')]);}else{logger[_0x16c9('0x11')](_0x16c9('0x16'),_0x1df1d5,_0x16c9('0x13'));_0x6842be(_0x47ac09[_0x16c9('0x18')]['message']);}})[_0x16c9('0x19')](function(_0x5f4ebc){logger[_0x16c9('0x14')](_0x16c9('0x16'),_0x1df1d5,_0x5f4ebc);_0xc59501(_0x5f4ebc);});});}exports[_0x16c9('0x1a')]=function(_0x6defc4){var _0x4beaac=this;return new Promise(function(_0x4ad122,_0xa745a9){return db[_0x16c9('0x1b')]['update'](_0x6defc4[_0x16c9('0x1c')],{'raw':_0x6defc4[_0x16c9('0x1d')]?_0x6defc4['options'][_0x16c9('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x6defc4[_0x16c9('0x1d')]?_0x6defc4[_0x16c9('0x1d')]['where']||null:null,'attributes':_0x6defc4[_0x16c9('0x1d')]?_0x6defc4[_0x16c9('0x1d')]['attributes']||null:null,'limit':_0x6defc4['options']?_0x6defc4[_0x16c9('0x1d')]['limit']||null:null})['then'](function(_0xc7e98a){logger['info'](_0x16c9('0x1a'),_0x6defc4);logger[_0x16c9('0x1f')](_0x16c9('0x1a'),_0x6defc4,JSON[_0x16c9('0x20')](_0xc7e98a));_0x4ad122(_0xc7e98a);})[_0x16c9('0x19')](function(_0x308168){logger[_0x16c9('0x14')](_0x16c9('0x1a'),_0x308168[_0x16c9('0x17')],_0x6defc4);_0xa745a9(_0x4beaac[_0x16c9('0x14')](0x1f4,_0x308168['message']));});});};exports[_0x16c9('0x21')]=function(_0x9d49de){return new Promise(function(_0x109311,_0x359b4c){return db[_0x16c9('0x1b')][_0x16c9('0x22')]({'where':_0x9d49de['options']?_0x9d49de[_0x16c9('0x1d')][_0x16c9('0x23')]||null:null})[_0x16c9('0x10')](function(_0x3316b9){if(_0x3316b9){return _0x3316b9['addTags'](_0x9d49de[_0x16c9('0x1c')][_0x16c9('0x24')],_[_0x16c9('0x25')](_0x9d49de['body'],[_0x16c9('0x24'),'id'])||{});}})[_0x16c9('0x26')](function(_0x5d5e74){logger[_0x16c9('0x11')]('AddTags',_0x9d49de);logger[_0x16c9('0x1f')](_0x16c9('0x27'),_0x9d49de,JSON['stringify'](_0x5d5e74));_0x109311(_0x5d5e74);})[_0x16c9('0x19')](function(_0x481598){logger[_0x16c9('0x14')](_0x16c9('0x27'),_0x481598[_0x16c9('0x17')],_0x9d49de);_0x359b4c(_this[_0x16c9('0x14')](0x1f4,_0x481598['message']));});});}; \ No newline at end of file +var _0x6ac9=['AddTagsToChatInteraction','ChatInteraction','find','addTags','body','ids','spread','AddTags','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','defaults','redis','localhost','./chatInteraction.socket','register','request','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','update','options','raw','where','attributes','limit','then','UpdateChatInteraction','stringify'];(function(_0x52442d,_0x47d3f8){var _0x1cb159=function(_0x47e96b){while(--_0x47e96b){_0x52442d['push'](_0x52442d['shift']());}};_0x1cb159(++_0x47d3f8);}(_0x6ac9,0xa8));var _0x96ac=function(_0xd6875f,_0x1091c3){_0xd6875f=_0xd6875f-0x0;var _0x45336e=_0x6ac9[_0xd6875f];return _0x45336e;};'use strict';var _=require(_0x96ac('0x0'));var util=require('util');var moment=require(_0x96ac('0x1'));var BPromise=require(_0x96ac('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x96ac('0x3'));var db=require(_0x96ac('0x4'))['db'];var utils=require(_0x96ac('0x5'));var logger=require(_0x96ac('0x6'))('rpc');var config=require(_0x96ac('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x96ac('0x8')]({'port':0x232a});config['redis']=_[_0x96ac('0x9')](config[_0x96ac('0xa')],{'host':_0x96ac('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x96ac('0xa')]));require(_0x96ac('0xc'))[_0x96ac('0xd')](socket);function respondWithRpcPromise(_0x361045,_0x313dd2,_0x15b4d6){return new BPromise(function(_0x576885,_0x4e24ce){return client[_0x96ac('0xe')](_0x361045,_0x15b4d6)['then'](function(_0x11180c){logger['info'](_0x96ac('0xf'),_0x313dd2,_0x96ac('0x10'));logger[_0x96ac('0x11')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x313dd2,_0x96ac('0x10'),JSON['stringify'](_0x11180c));if(_0x11180c[_0x96ac('0x12')]){if(_0x11180c[_0x96ac('0x12')][_0x96ac('0x13')]===0x1f4){logger[_0x96ac('0x12')](_0x96ac('0xf'),_0x313dd2,_0x11180c[_0x96ac('0x12')][_0x96ac('0x14')]);return _0x4e24ce(_0x11180c[_0x96ac('0x12')][_0x96ac('0x14')]);}logger['error']('ChatInteraction,\x20%s,\x20%s',_0x313dd2,_0x11180c[_0x96ac('0x12')][_0x96ac('0x14')]);return _0x576885(_0x11180c['error'][_0x96ac('0x14')]);}else{logger[_0x96ac('0x15')](_0x96ac('0xf'),_0x313dd2,_0x96ac('0x10'));_0x576885(_0x11180c['result'][_0x96ac('0x14')]);}})[_0x96ac('0x16')](function(_0x1a81b6){logger[_0x96ac('0x12')](_0x96ac('0xf'),_0x313dd2,_0x1a81b6);_0x4e24ce(_0x1a81b6);});});}exports['UpdateChatInteraction']=function(_0x1cda31){var _0x5e9d09=this;return new Promise(function(_0x31bb34,_0x295c17){return db['ChatInteraction'][_0x96ac('0x17')](_0x1cda31['body'],{'raw':_0x1cda31['options']?_0x1cda31[_0x96ac('0x18')][_0x96ac('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1cda31[_0x96ac('0x18')]?_0x1cda31[_0x96ac('0x18')][_0x96ac('0x1a')]||null:null,'attributes':_0x1cda31[_0x96ac('0x18')]?_0x1cda31[_0x96ac('0x18')][_0x96ac('0x1b')]||null:null,'limit':_0x1cda31[_0x96ac('0x18')]?_0x1cda31[_0x96ac('0x18')][_0x96ac('0x1c')]||null:null})[_0x96ac('0x1d')](function(_0x383b89){logger[_0x96ac('0x15')]('UpdateChatInteraction',_0x1cda31);logger[_0x96ac('0x11')](_0x96ac('0x1e'),_0x1cda31,JSON[_0x96ac('0x1f')](_0x383b89));_0x31bb34(_0x383b89);})[_0x96ac('0x16')](function(_0x342934){logger['error'](_0x96ac('0x1e'),_0x342934[_0x96ac('0x14')],_0x1cda31);_0x295c17(_0x5e9d09[_0x96ac('0x12')](0x1f4,_0x342934[_0x96ac('0x14')]));});});};exports[_0x96ac('0x20')]=function(_0x2d5760){return new Promise(function(_0x27db37,_0x1aa2cc){return db[_0x96ac('0x21')][_0x96ac('0x22')]({'where':_0x2d5760['options']?_0x2d5760[_0x96ac('0x18')][_0x96ac('0x1a')]||null:null})[_0x96ac('0x1d')](function(_0x99d416){if(_0x99d416){return _0x99d416[_0x96ac('0x23')](_0x2d5760[_0x96ac('0x24')][_0x96ac('0x25')],_['omit'](_0x2d5760[_0x96ac('0x24')],[_0x96ac('0x25'),'id'])||{});}})[_0x96ac('0x26')](function(_0x3e3daf){logger[_0x96ac('0x15')](_0x96ac('0x27'),_0x2d5760);logger['debug'](_0x96ac('0x27'),_0x2d5760,JSON[_0x96ac('0x1f')](_0x3e3daf));_0x27db37(_0x3e3daf);})[_0x96ac('0x16')](function(_0x2e5dea){logger[_0x96ac('0x12')]('AddTags',_0x2e5dea[_0x96ac('0x14')],_0x2d5760);_0x1aa2cc(_this[_0x96ac('0x12')](0x1f4,_0x2e5dea[_0x96ac('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 24204d3..20aec74 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 _0x2d9a=['remove','emit','register','chatInteraction:'];(function(_0x3e85bb,_0x2e9931){var _0x4a66b2=function(_0x12f422){while(--_0x12f422){_0x3e85bb['push'](_0x3e85bb['shift']());}};_0x4a66b2(++_0x2e9931);}(_0x2d9a,0x114));var _0xa2d9=function(_0x1f7839,_0x2a26e6){_0x1f7839=_0x1f7839-0x0;var _0x36b42e=_0x2d9a[_0x1f7839];return _0x36b42e;};'use strict';var ChatInteractionEvents=require('./chatInteraction.events');var events=['save',_0xa2d9('0x0'),'update'];function createListener(_0x5066dc,_0xa3bd7){return function(_0x21b17f){_0xa3bd7[_0xa2d9('0x1')](_0x5066dc,_0x21b17f);};}function removeListener(_0xe7eb1a,_0x4c4d38){return function(){ChatInteractionEvents['removeListener'](_0xe7eb1a,_0x4c4d38);};}exports[_0xa2d9('0x2')]=function(_0x5346be){for(var _0x159f47=0x0,_0x361fd8=events['length'];_0x159f47<_0x361fd8;_0x159f47++){var _0x9f7cda=events[_0x159f47];var _0xd67d7e=createListener(_0xa2d9('0x3')+_0x9f7cda,_0x5346be);ChatInteractionEvents['on'](_0x9f7cda,_0xd67d7e);}}; \ No newline at end of file +var _0xab9f=['register','chatInteraction:','./chatInteraction.events','save','remove','removeListener'];(function(_0x648163,_0x241576){var _0x199d4d=function(_0x23055d){while(--_0x23055d){_0x648163['push'](_0x648163['shift']());}};_0x199d4d(++_0x241576);}(_0xab9f,0x170));var _0xfab9=function(_0x14e51e,_0xed289b){_0x14e51e=_0x14e51e-0x0;var _0xf93e94=_0xab9f[_0x14e51e];return _0xf93e94;};'use strict';var ChatInteractionEvents=require(_0xfab9('0x0'));var events=[_0xfab9('0x1'),_0xfab9('0x2'),'update'];function createListener(_0x9b5f4c,_0x1b18d9){return function(_0x53fb1e){_0x1b18d9['emit'](_0x9b5f4c,_0x53fb1e);};}function removeListener(_0x101a6f,_0x1e0bd0){return function(){ChatInteractionEvents[_0xfab9('0x3')](_0x101a6f,_0x1e0bd0);};}exports[_0xfab9('0x4')]=function(_0x39b27f){for(var _0x1bcfad=0x0,_0x1ace41=events['length'];_0x1bcfad<_0x1ace41;_0x1bcfad++){var _0x3cfde3=events[_0x1bcfad];var _0x11b592=createListener(_0xfab9('0x5')+_0x3cfde3,_0x39b27f);ChatInteractionEvents['on'](_0x3cfde3,_0x11b592);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 01aed8c..d17247f 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 _0x6a95=['attachmentDownload','/:id/messages','getMessages','/:id/download','download','post','create','/:id/vidaoo','diskStorage','root','format','%s-%s','now','originalname','replace','/:id/attachment_upload','single','file','attachmentUpload','addMessage','/:id/tags','chat','chatinteraction:addtags','addTags','put','tracked','chatinteraction:update','update','/:id/custom_update','customUpdate','/:id/close','close','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','./chatInteraction.controller','get','isAuthenticated','index','/describe','/:id','isChatInteractionAuthorized','/:id/attachment_download'];(function(_0x3ec551,_0xbf0edc){var _0x4b5e52=function(_0x4707c0){while(--_0x4707c0){_0x3ec551['push'](_0x3ec551['shift']());}};_0x4b5e52(++_0xbf0edc);}(_0x6a95,0x1db));var _0x56a9=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0x6a95[_0x5447fd];return _0x15b28a;};'use strict';var multer=require(_0x56a9('0x0'));var util=require(_0x56a9('0x1'));var path=require(_0x56a9('0x2'));var timeout=require(_0x56a9('0x3'));var express=require(_0x56a9('0x4'));var router=express[_0x56a9('0x5')]();var auth=require(_0x56a9('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x56a9('0x7'));router[_0x56a9('0x8')]('/',auth[_0x56a9('0x9')](),controller[_0x56a9('0xa')]);router[_0x56a9('0x8')](_0x56a9('0xb'),auth[_0x56a9('0x9')](),controller['describe']);router['get'](_0x56a9('0xc'),auth[_0x56a9('0xd')](),controller['show']);router[_0x56a9('0x8')](_0x56a9('0xe'),auth[_0x56a9('0xd')](),controller[_0x56a9('0xf')]);router[_0x56a9('0x8')](_0x56a9('0x10'),auth[_0x56a9('0x9')](),controller[_0x56a9('0x11')]);router[_0x56a9('0x8')]('/:id/my_messages',auth[_0x56a9('0xd')](),controller['getMyMessages']);router[_0x56a9('0x8')](_0x56a9('0x12'),auth[_0x56a9('0x9')](),controller[_0x56a9('0x13')]);router[_0x56a9('0x14')]('/',auth[_0x56a9('0x9')](),controller[_0x56a9('0x15')]);router[_0x56a9('0x14')](_0x56a9('0x16'),auth['isAuthenticated'](),controller['createVidaooSession']);var upload=multer({'storage':multer[_0x56a9('0x17')]({'destination':function(_0x2a0714,_0x42007b,_0x46f854){_0x46f854(null,path['join'](config[_0x56a9('0x18')],'server/files/attachments/'));},'filename':function(_0x5e5218,_0x4e292f,_0x312e58){_0x312e58(null,util[_0x56a9('0x19')](_0x56a9('0x1a'),Date[_0x56a9('0x1b')](),_0x4e292f[_0x56a9('0x1c')][_0x56a9('0x1d')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x56a9('0x14')](_0x56a9('0x1e'),upload[_0x56a9('0x1f')](_0x56a9('0x20')),controller[_0x56a9('0x21')]);router[_0x56a9('0x14')]('/:id/messages',auth['isChatInteractionAuthorized'](),controller[_0x56a9('0x22')]);router[_0x56a9('0x14')](_0x56a9('0x23'),auth[_0x56a9('0x9')](),interaction['tracked'](_0x56a9('0x24'),_0x56a9('0x25')),controller[_0x56a9('0x26')]);router[_0x56a9('0x27')]('/:id',auth[_0x56a9('0x9')](),interaction[_0x56a9('0x28')](_0x56a9('0x24'),_0x56a9('0x29')),controller[_0x56a9('0x2a')]);router['put'](_0x56a9('0x2b'),controller[_0x56a9('0x2c')]);router[_0x56a9('0x27')]('/:id/abandon',auth[_0x56a9('0xd')](),controller['abandon']);router[_0x56a9('0x27')](_0x56a9('0x2d'),controller[_0x56a9('0x2e')]);router[_0x56a9('0x2f')](_0x56a9('0xc'),auth[_0x56a9('0x9')](),interaction[_0x56a9('0x28')](_0x56a9('0x24'),'chatinteraction:destroy'),controller[_0x56a9('0x30')]);router[_0x56a9('0x2f')]('/:id/tags',auth[_0x56a9('0x9')](),controller['removeTags']);module['exports']=router; \ No newline at end of file +var _0x793b=['put','tracked','chat','chatinteraction:update','/:id/custom_update','customUpdate','/:id/abandon','abandon','/:id/close','close','delete','chatinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','isChatInteractionAuthorized','show','/:id/attachment_download','/:id/messages','/:id/my_messages','getMyMessages','download','post','create','/:id/vidaoo','createVidaooSession','join','root','server/files/attachments/','format','%s-%s','now','originalname','replace','/:id/attachment_upload','single','attachmentUpload','addMessage','/:id/tags','chatinteraction:addtags','addTags'];(function(_0x2e2f84,_0x24e46f){var _0x448191=function(_0x336e06){while(--_0x336e06){_0x2e2f84['push'](_0x2e2f84['shift']());}};_0x448191(++_0x24e46f);}(_0x793b,0x189));var _0xb793=function(_0x41ff10,_0x29ee36){_0x41ff10=_0x41ff10-0x0;var _0x384778=_0x793b[_0x41ff10];return _0x384778;};'use strict';var multer=require(_0xb793('0x0'));var util=require(_0xb793('0x1'));var path=require(_0xb793('0x2'));var timeout=require(_0xb793('0x3'));var express=require(_0xb793('0x4'));var router=express['Router']();var auth=require(_0xb793('0x5'));var interaction=require(_0xb793('0x6'));var config=require('../../config/environment');var controller=require('./chatInteraction.controller');router[_0xb793('0x7')]('/',auth[_0xb793('0x8')](),controller[_0xb793('0x9')]);router[_0xb793('0x7')](_0xb793('0xa'),auth[_0xb793('0x8')](),controller[_0xb793('0xb')]);router[_0xb793('0x7')](_0xb793('0xc'),auth[_0xb793('0xd')](),controller[_0xb793('0xe')]);router[_0xb793('0x7')](_0xb793('0xf'),auth[_0xb793('0xd')](),controller['attachmentDownload']);router[_0xb793('0x7')](_0xb793('0x10'),auth['isAuthenticated'](),controller['getMessages']);router[_0xb793('0x7')](_0xb793('0x11'),auth['isChatInteractionAuthorized'](),controller[_0xb793('0x12')]);router[_0xb793('0x7')]('/:id/download',auth[_0xb793('0x8')](),controller[_0xb793('0x13')]);router[_0xb793('0x14')]('/',auth[_0xb793('0x8')](),controller[_0xb793('0x15')]);router[_0xb793('0x14')](_0xb793('0x16'),auth['isAuthenticated'](),controller[_0xb793('0x17')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5a2baa,_0x20ab1e,_0x18fb18){_0x18fb18(null,path[_0xb793('0x18')](config[_0xb793('0x19')],_0xb793('0x1a')));},'filename':function(_0x32e9e7,_0x18c005,_0x408410){_0x408410(null,util[_0xb793('0x1b')](_0xb793('0x1c'),Date[_0xb793('0x1d')](),_0x18c005[_0xb793('0x1e')][_0xb793('0x1f')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xb793('0x14')](_0xb793('0x20'),upload[_0xb793('0x21')]('file'),controller[_0xb793('0x22')]);router[_0xb793('0x14')]('/:id/messages',auth[_0xb793('0xd')](),controller[_0xb793('0x23')]);router[_0xb793('0x14')](_0xb793('0x24'),auth[_0xb793('0x8')](),interaction['tracked']('chat',_0xb793('0x25')),controller[_0xb793('0x26')]);router[_0xb793('0x27')](_0xb793('0xc'),auth[_0xb793('0x8')](),interaction[_0xb793('0x28')](_0xb793('0x29'),_0xb793('0x2a')),controller['update']);router[_0xb793('0x27')](_0xb793('0x2b'),controller[_0xb793('0x2c')]);router[_0xb793('0x27')](_0xb793('0x2d'),auth[_0xb793('0xd')](),controller[_0xb793('0x2e')]);router['put'](_0xb793('0x2f'),controller[_0xb793('0x30')]);router[_0xb793('0x31')](_0xb793('0xc'),auth[_0xb793('0x8')](),interaction[_0xb793('0x28')]('chat',_0xb793('0x32')),controller[_0xb793('0x33')]);router[_0xb793('0x31')]('/:id/tags',auth[_0xb793('0x8')](),controller[_0xb793('0x34')]);module[_0xb793('0x35')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index bc49fd6..2956338 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 _0x57ca=['exports','TEXT','BOOLEAN','INTEGER'];(function(_0x51853a,_0x2dd1eb){var _0x54a035=function(_0x1881f3){while(--_0x1881f3){_0x51853a['push'](_0x51853a['shift']());}};_0x54a035(++_0x2dd1eb);}(_0x57ca,0x108));var _0xa57c=function(_0x56abda,_0x3f0212){_0x56abda=_0x56abda-0x0;var _0x1f8f30=_0x57ca[_0x56abda];return _0x1f8f30;};'use strict';var Sequelize=require('sequelize');module[_0xa57c('0x0')]={'body':{'type':Sequelize[_0xa57c('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xa57c('0x2')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xa57c('0x3')]}}; \ No newline at end of file +var _0x7a54=['BOOLEAN','INTEGER','sequelize','exports','TEXT'];(function(_0x2e655a,_0x6d5799){var _0x26f13b=function(_0x2dd535){while(--_0x2dd535){_0x2e655a['push'](_0x2e655a['shift']());}};_0x26f13b(++_0x6d5799);}(_0x7a54,0x106));var _0x47a5=function(_0x4d8655,_0x457fc7){_0x4d8655=_0x4d8655-0x0;var _0x2cca68=_0x7a54[_0x4d8655];return _0x2cca68;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'body':{'type':Sequelize[_0x47a5('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x47a5('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x47a5('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 078bdbe..010c995 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 _0xb3ce=['send','index','map','ChatInternalMessage','rawAttributes','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','catch','create','body','find','messages','lastMessageAt','YYYY-MM-DD\x20HH:mm:ss','lastMessage','getUsers','agent','user','fullname','role','userpic','online','lastLoginAt','-online','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','autoAssociation','UserProfileResource','isEmpty','resourceId','push','createdAt','FromId','ToId','read','all','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','end','count','offset','limit','Content-Range','json','save','destroy','then','name'];(function(_0x411b36,_0x15e8c9){var _0x3702a0=function(_0x1d93d7){while(--_0x1d93d7){_0x411b36['push'](_0x411b36['shift']());}};_0x3702a0(++_0x15e8c9);}(_0xb3ce,0x16e));var _0xeb3c=function(_0x462832,_0x3c5525){_0x462832=_0x462832-0x0;var _0x33f578=_0xb3ce[_0x462832];return _0x33f578;};'use strict';var pdf=require(_0xeb3c('0x0'));var emlformat=require(_0xeb3c('0x1'));var rimraf=require(_0xeb3c('0x2'));var zipdir=require(_0xeb3c('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xeb3c('0x4'));var moment=require('moment');var BPromise=require(_0xeb3c('0x5'));var Mustache=require(_0xeb3c('0x6'));var util=require(_0xeb3c('0x7'));var path=require('path');var sox=require(_0xeb3c('0x8'));var csv=require(_0xeb3c('0x9'));var ejs=require(_0xeb3c('0xa'));var fs=require('fs');var _=require(_0xeb3c('0xb'));var squel=require(_0xeb3c('0xc'));var crypto=require('crypto');var jsforce=require(_0xeb3c('0xd'));var deskjs=require(_0xeb3c('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xeb3c('0xf'));var Redis=require('ioredis');var authService=require(_0xeb3c('0x10'));var qs=require(_0xeb3c('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xeb3c('0x12'))(_0xeb3c('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xeb3c('0x14'))['db'];config[_0xeb3c('0x15')]=_[_0xeb3c('0x16')](config[_0xeb3c('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0xeb3c('0x17'))(new Redis(config[_0xeb3c('0x15')]));require(_0xeb3c('0x18'))[_0xeb3c('0x19')](socket);function respondWithStatusCode(_0x5ecab9,_0x3a6c28){_0x3a6c28=_0x3a6c28||0xcc;return function(_0x108f81){if(_0x108f81){return _0x5ecab9[_0xeb3c('0x1a')](_0x3a6c28);}return _0x5ecab9[_0xeb3c('0x1b')](_0x3a6c28)[_0xeb3c('0x1c')]();};}function respondWithResult(_0x4c358d,_0x4f9b9f){_0x4f9b9f=_0x4f9b9f||0xc8;return function(_0x22a874){if(_0x22a874){return _0x4c358d[_0xeb3c('0x1b')](_0x4f9b9f)['json'](_0x22a874);}};}function respondWithFilteredResult(_0x2dec39,_0x157fd8){return function(_0x475b3a){if(_0x475b3a){var _0x523e5e=_0x475b3a[_0xeb3c('0x1d')],_0x3d7d60=_0x157fd8[_0xeb3c('0x1e')],_0x41f79f=_0x157fd8[_0xeb3c('0x1e')]+_0x157fd8[_0xeb3c('0x1f')],_0x5da35a;if(_0x41f79f>=_0x523e5e){_0x41f79f=_0x523e5e;_0x5da35a=0xc8;}else{_0x5da35a=0xce;}_0x2dec39['status'](_0x5da35a);return _0x2dec39['set'](_0xeb3c('0x20'),_0x3d7d60+'-'+_0x41f79f+'/'+_0x523e5e)[_0xeb3c('0x21')](_0x475b3a);}return null;};}function patchUpdates(_0xa35c6b){return function(_0x3b54aa){try{jsonpatch['apply'](_0x3b54aa,_0xa35c6b,!![]);}catch(_0x4a0ab4){return BPromise['reject'](_0x4a0ab4);}return _0x3b54aa[_0xeb3c('0x22')]();};}function saveUpdates(_0xd7a5bc,_0x1bd292){return function(_0x1d9494){if(_0x1d9494){return _0x1d9494['update'](_0xd7a5bc)['then'](function(_0x171510){return _0x171510;});}return null;};}function removeEntity(_0x151d15,_0x2f4e78){return function(_0x20449c){if(_0x20449c){return _0x20449c[_0xeb3c('0x23')]()[_0xeb3c('0x24')](function(){_0x151d15[_0xeb3c('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0xa4c703,_0x5b15e3){return function(_0x3e2379){if(!_0x3e2379){_0xa4c703[_0xeb3c('0x1a')](0x194);}return _0x3e2379;};}function handleError(_0x31f491,_0x1f61a6){_0x1f61a6=_0x1f61a6||0x1f4;return function(_0x4bf0dd){logger['error'](_0x4bf0dd['stack']);if(_0x4bf0dd[_0xeb3c('0x25')]){delete _0x4bf0dd['name'];}_0x31f491[_0xeb3c('0x1b')](_0x1f61a6)[_0xeb3c('0x26')](_0x4bf0dd);};}exports[_0xeb3c('0x27')]=function(_0x3d7ee0,_0x346270){var _0x1b0e9d={},_0x483047={},_0x3549d7={'count':0x0,'rows':[]};var _0x1bfddd=_[_0xeb3c('0x28')](db[_0xeb3c('0x29')][_0xeb3c('0x2a')],function(_0x3d7878){return{'name':_0x3d7878['fieldName'],'type':_0x3d7878[_0xeb3c('0x2b')][_0xeb3c('0x2c')]};});_0x483047[_0xeb3c('0x2d')]=_[_0xeb3c('0x28')](_0x1bfddd,_0xeb3c('0x25'));_0x483047['query']=_[_0xeb3c('0x2e')](_0x3d7ee0[_0xeb3c('0x2f')]);_0x483047[_0xeb3c('0x30')]=_['intersection'](_0x483047[_0xeb3c('0x2d')],_0x483047[_0xeb3c('0x2f')]);_0x1b0e9d['attributes']=_[_0xeb3c('0x31')](_0x483047[_0xeb3c('0x2d')],qs[_0xeb3c('0x32')](_0x3d7ee0[_0xeb3c('0x2f')]['fields']));_0x1b0e9d[_0xeb3c('0x33')]=_0x1b0e9d[_0xeb3c('0x33')][_0xeb3c('0x34')]?_0x1b0e9d[_0xeb3c('0x33')]:_0x483047['model'];if(!_0x3d7ee0['query'][_0xeb3c('0x35')](_0xeb3c('0x36'))){_0x1b0e9d['limit']=qs['limit'](_0x3d7ee0['query'][_0xeb3c('0x1f')]);_0x1b0e9d[_0xeb3c('0x1e')]=qs[_0xeb3c('0x1e')](_0x3d7ee0[_0xeb3c('0x2f')][_0xeb3c('0x1e')]);}_0x1b0e9d[_0xeb3c('0x37')]=qs['sort'](_0x3d7ee0['query'][_0xeb3c('0x38')]);_0x1b0e9d[_0xeb3c('0x39')]=qs[_0xeb3c('0x30')](_[_0xeb3c('0x3a')](_0x3d7ee0[_0xeb3c('0x2f')],_0x483047[_0xeb3c('0x30')]),_0x1bfddd);if(_0x3d7ee0[_0xeb3c('0x2f')]['filter']){_0x1b0e9d['where']=_[_0xeb3c('0x3b')](_0x1b0e9d[_0xeb3c('0x39')],{'$or':_['map'](_0x1bfddd,function(_0x56b161){if(_0x56b161[_0xeb3c('0x2b')]!==_0xeb3c('0x3c')){var _0x13b2e4={};_0x13b2e4[_0x56b161['name']]={'$like':'%'+_0x3d7ee0[_0xeb3c('0x2f')][_0xeb3c('0x3d')]+'%'};return _0x13b2e4;}})});}_0x1b0e9d=_['merge']({},_0x1b0e9d,_0x3d7ee0[_0xeb3c('0x3e')]);var _0x23bf8e={'where':_0x1b0e9d[_0xeb3c('0x39')]};return db[_0xeb3c('0x29')][_0xeb3c('0x1d')](_0x23bf8e)[_0xeb3c('0x24')](function(_0x37d156){_0x3549d7[_0xeb3c('0x1d')]=_0x37d156;if(_0x3d7ee0[_0xeb3c('0x2f')][_0xeb3c('0x3f')]){_0x1b0e9d[_0xeb3c('0x40')]=[{'all':!![]}];}return db[_0xeb3c('0x29')][_0xeb3c('0x41')](_0x1b0e9d);})[_0xeb3c('0x24')](function(_0x416eb5){_0x3549d7[_0xeb3c('0x42')]=_0x416eb5;return _0x3549d7;})['then'](respondWithFilteredResult(_0x346270,_0x1b0e9d))['catch'](handleError(_0x346270,null));};exports[_0xeb3c('0x43')]=function(_0x42be71,_0x4f05d0){var _0x5d2058={'raw':!![],'where':{'id':_0x42be71[_0xeb3c('0x44')]['id']}},_0x4b1ca0={};_0x4b1ca0[_0xeb3c('0x2d')]=_[_0xeb3c('0x2e')](db['ChatInternalMessage']['rawAttributes']);_0x4b1ca0[_0xeb3c('0x2f')]=_[_0xeb3c('0x2e')](_0x42be71[_0xeb3c('0x2f')]);_0x4b1ca0[_0xeb3c('0x30')]=_[_0xeb3c('0x31')](_0x4b1ca0[_0xeb3c('0x2d')],_0x4b1ca0[_0xeb3c('0x2f')]);_0x5d2058[_0xeb3c('0x33')]=_[_0xeb3c('0x31')](_0x4b1ca0[_0xeb3c('0x2d')],qs[_0xeb3c('0x32')](_0x42be71['query']['fields']));_0x5d2058[_0xeb3c('0x33')]=_0x5d2058['attributes'][_0xeb3c('0x34')]?_0x5d2058[_0xeb3c('0x33')]:_0x4b1ca0[_0xeb3c('0x2d')];if(_0x42be71['query'][_0xeb3c('0x3f')]){_0x5d2058['include']=[{'all':!![]}];}_0x5d2058=_[_0xeb3c('0x3b')]({},_0x5d2058,_0x42be71[_0xeb3c('0x3e')]);return db[_0xeb3c('0x29')]['find'](_0x5d2058)[_0xeb3c('0x24')](handleEntityNotFound(_0x4f05d0,null))[_0xeb3c('0x24')](respondWithResult(_0x4f05d0,null))[_0xeb3c('0x45')](handleError(_0x4f05d0,null));};exports[_0xeb3c('0x46')]=function(_0x3791c2,_0x4d1c82){return db[_0xeb3c('0x29')]['create'](_0x3791c2[_0xeb3c('0x47')],{})[_0xeb3c('0x24')](respondWithResult(_0x4d1c82,0xc9))[_0xeb3c('0x45')](handleError(_0x4d1c82,null));};exports['update']=function(_0x543371,_0x1540cf){if(_0x543371[_0xeb3c('0x47')]['id']){delete _0x543371[_0xeb3c('0x47')]['id'];}return db[_0xeb3c('0x29')]['find']({'where':{'id':_0x543371['params']['id']}})['then'](handleEntityNotFound(_0x1540cf,null))[_0xeb3c('0x24')](saveUpdates(_0x543371[_0xeb3c('0x47')],null))[_0xeb3c('0x24')](respondWithResult(_0x1540cf,null))['catch'](handleError(_0x1540cf,null));};exports[_0xeb3c('0x23')]=function(_0x256c73,_0x2fa683){return db[_0xeb3c('0x29')][_0xeb3c('0x48')]({'where':{'id':_0x256c73[_0xeb3c('0x44')]['id']}})[_0xeb3c('0x24')](handleEntityNotFound(_0x2fa683,null))[_0xeb3c('0x24')](removeEntity(_0x2fa683,null))[_0xeb3c('0x45')](handleError(_0x2fa683,null));};exports['describe']=function(_0x460e9d,_0x32110a){return db[_0xeb3c('0x29')]['describe']()[_0xeb3c('0x24')](respondWithResult(_0x32110a,null))[_0xeb3c('0x45')](handleError(_0x32110a,null));};function wrapUser(_0x4f8043){return function(_0x2e1a1b){var _0x429d58=_0x4f8043['get']({'plain':!![]});_0x429d58[_0xeb3c('0x49')]=[];if(_0x2e1a1b){_0x429d58[_0xeb3c('0x4a')]=_0x2e1a1b['createdAt'];_0x429d58['lastMessage']=_0x2e1a1b;}else{_0x429d58[_0xeb3c('0x4a')]=moment(0x0)['format'](_0xeb3c('0x4b'));_0x429d58[_0xeb3c('0x4c')]={};}return _0x429d58;};}exports[_0xeb3c('0x4d')]=function(_0x4637a2,_0x5856ac,_0xeca05e){var _0x32327b=[];return db['User'][_0xeb3c('0x41')]({'where':{'role':[_0xeb3c('0x4e'),'admin',_0xeb3c('0x4f')]},'attributes':['id',_0xeb3c('0x50'),_0xeb3c('0x25'),_0xeb3c('0x51'),_0xeb3c('0x52'),'internal',_0xeb3c('0x53'),_0xeb3c('0x54'),'allowmessenger','showWebBar'],'order':qs[_0xeb3c('0x38')](_0xeb3c('0x55')),'include':[{'model':db[_0xeb3c('0x56')],'as':_0xeb3c('0x57'),'attributes':['id',_0xeb3c('0x25'),_0xeb3c('0x2b')],'through':{'attributes':[]}}]})[_0xeb3c('0x24')](function(_0x2b6f33){if(_0x2b6f33){var _0x39eb86=_0x4637a2[_0xeb3c('0x4f')]['get']({'plain':!![]});if(!_0x39eb86)throw new Error(_0xeb3c('0x58'));if(_0x39eb86['role']===_0xeb3c('0x4f')){return db[_0xeb3c('0x59')][_0xeb3c('0x48')]({'where':{'name':_0xeb3c('0x5a'),'userProfileId':_0x39eb86['userProfileId']},'raw':!![]})[_0xeb3c('0x24')](function(_0x1a2702){if(_0x1a2702){if(_0x1a2702[_0xeb3c('0x5b')]===0x0){return db[_0xeb3c('0x5c')][_0xeb3c('0x41')]({'where':{'sectionId':_0x1a2702['id']},'raw':!![]})[_0xeb3c('0x24')](function(_0x57de3c){var _0x4d2710=[];if(_[_0xeb3c('0x5d')](_0x57de3c)){_0x4d2710=_[_0xeb3c('0x3d')](_0x2b6f33,function(_0x3ddaec){if(_0x3ddaec[_0xeb3c('0x51')]!==_0xeb3c('0x4e')){return _0x3ddaec;}});return _0x4d2710;}else{for(var _0x12a7cf=0x0;_0x12a7cf<_0x2b6f33['length'];_0x12a7cf++){var _0x1c17fd=_0x2b6f33[_0x12a7cf];if(_0x1c17fd[_0xeb3c('0x51')]===_0xeb3c('0x4e')){var _0x5d239f=_[_0xeb3c('0x48')](_0x57de3c,function(_0x229779){return _0x229779[_0xeb3c('0x5e')]===_0x1c17fd['id'];});if(_0x5d239f)_0x4d2710['push'](_0x1c17fd);}else{_0x4d2710[_0xeb3c('0x5f')](_0x1c17fd);}}return _0x4d2710;}});}else{return _0x2b6f33;}}else{var _0x1b420b=_[_0xeb3c('0x3d')](_0x2b6f33,function(_0x135203){if(_0x135203[_0xeb3c('0x51')]!==_0xeb3c('0x4e')){return _0x135203;}});return _0x1b420b;}});}else{return _0x2b6f33;}}})[_0xeb3c('0x24')](function(_0x151db3){var _0x2a6915=[];if(_0x151db3){_0x32327b=_0x151db3;for(var _0x549139=0x0;_0x549139<_0x151db3[_0xeb3c('0x34')];_0x549139+=0x1){_0x32327b[_0x549139][_0xeb3c('0x49')]=[];_0x2a6915[_0xeb3c('0x5f')](db[_0xeb3c('0x29')][_0xeb3c('0x48')]({'where':{'FromId':[_0x4637a2[_0xeb3c('0x4f')]['id'],_0x151db3[_0x549139]['id']],'ToId':[_0x4637a2['user']['id'],_0x151db3[_0x549139]['id']],'ChatGroupId':null},'attributes':['id',_0xeb3c('0x60'),_0xeb3c('0x61'),_0xeb3c('0x62'),_0xeb3c('0x63'),_0xeb3c('0x47')],'order':qs[_0xeb3c('0x38')]('-createdAt'),'limit':0x1,'offset':0x0,'raw':!![]})[_0xeb3c('0x24')](wrapUser(_0x151db3[_0x549139])));}return BPromise[_0xeb3c('0x64')](_0x2a6915);}return[];})[_0xeb3c('0x24')](function(_0xca7032){return{'rows':_0xca7032,'count':_0xca7032['length']};})[_0xeb3c('0x24')](respondWithResult(_0x5856ac,null))[_0xeb3c('0x45')](handleError(_0x5856ac,null));}; \ No newline at end of file +var _0x4857=['defaults','localhost','./chatInternalMessage.socket','sendStatus','status','end','json','count','offset','set','apply','reject','save','destroy','then','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','type','VIRTUAL','options','ChatInternalMessage','includeAll','include','findAll','catch','show','params','attributes','merge','create','body','update','find','describe','get','messages','createdAt','lastMessage','lastMessageAt','format','YYYY-MM-DD\x20HH:mm:ss','User','agent','admin','user','role','userpic','internal','lastLoginAt','showWebBar','-online','VoiceQueue','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','autoAssociation','isEmpty','resourceId','push','FromId','ToId','read','-createdAt','all','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','redis'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x4857,0x130));var _0x7485=function(_0x3c8e9a,_0x384306){_0x3c8e9a=_0x3c8e9a-0x0;var _0x2d4c57=_0x4857[_0x3c8e9a];return _0x2d4c57;};'use strict';var pdf=require(_0x7485('0x0'));var emlformat=require(_0x7485('0x1'));var rimraf=require(_0x7485('0x2'));var zipdir=require(_0x7485('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7485('0x4'));var moment=require('moment');var BPromise=require(_0x7485('0x5'));var Mustache=require(_0x7485('0x6'));var util=require(_0x7485('0x7'));var path=require(_0x7485('0x8'));var sox=require(_0x7485('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x7485('0xa'));var squel=require(_0x7485('0xb'));var crypto=require(_0x7485('0xc'));var jsforce=require(_0x7485('0xd'));var deskjs=require(_0x7485('0xe'));var toCsv=require('to-csv');var querystring=require(_0x7485('0xf'));var Papa=require(_0x7485('0x10'));var Redis=require(_0x7485('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x7485('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7485('0x13'))('api');var utils=require(_0x7485('0x14'));var config=require('../../config/environment');var db=require(_0x7485('0x15'))['db'];config[_0x7485('0x16')]=_[_0x7485('0x17')](config[_0x7485('0x16')],{'host':_0x7485('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x7485('0x19'))['register'](socket);function respondWithStatusCode(_0x554b92,_0x1a9db4){_0x1a9db4=_0x1a9db4||0xcc;return function(_0x8f43ee){if(_0x8f43ee){return _0x554b92[_0x7485('0x1a')](_0x1a9db4);}return _0x554b92[_0x7485('0x1b')](_0x1a9db4)[_0x7485('0x1c')]();};}function respondWithResult(_0x418356,_0x3885c0){_0x3885c0=_0x3885c0||0xc8;return function(_0x37ca4d){if(_0x37ca4d){return _0x418356[_0x7485('0x1b')](_0x3885c0)[_0x7485('0x1d')](_0x37ca4d);}};}function respondWithFilteredResult(_0x5c2f32,_0x1fe078){return function(_0x2376cd){if(_0x2376cd){var _0xf7afd1=_0x2376cd[_0x7485('0x1e')],_0xc8257f=_0x1fe078[_0x7485('0x1f')],_0x4fa42d=_0x1fe078[_0x7485('0x1f')]+_0x1fe078['limit'],_0xb85578;if(_0x4fa42d>=_0xf7afd1){_0x4fa42d=_0xf7afd1;_0xb85578=0xc8;}else{_0xb85578=0xce;}_0x5c2f32[_0x7485('0x1b')](_0xb85578);return _0x5c2f32[_0x7485('0x20')]('Content-Range',_0xc8257f+'-'+_0x4fa42d+'/'+_0xf7afd1)['json'](_0x2376cd);}return null;};}function patchUpdates(_0x51d8c3){return function(_0x701b53){try{jsonpatch[_0x7485('0x21')](_0x701b53,_0x51d8c3,!![]);}catch(_0x1bda2a){return BPromise[_0x7485('0x22')](_0x1bda2a);}return _0x701b53[_0x7485('0x23')]();};}function saveUpdates(_0xae7404,_0x459ad7){return function(_0x2a02e4){if(_0x2a02e4){return _0x2a02e4['update'](_0xae7404)['then'](function(_0x422b66){return _0x422b66;});}return null;};}function removeEntity(_0x5c477f,_0x28095e){return function(_0x44d00f){if(_0x44d00f){return _0x44d00f[_0x7485('0x24')]()[_0x7485('0x25')](function(){_0x5c477f[_0x7485('0x1b')](0xcc)[_0x7485('0x1c')]();});}};}function handleEntityNotFound(_0x4b8b88,_0x8accca){return function(_0x739c68){if(!_0x739c68){_0x4b8b88[_0x7485('0x1a')](0x194);}return _0x739c68;};}function handleError(_0x54a15d,_0x1bdd6a){_0x1bdd6a=_0x1bdd6a||0x1f4;return function(_0xd5fc7a){logger[_0x7485('0x26')](_0xd5fc7a[_0x7485('0x27')]);if(_0xd5fc7a['name']){delete _0xd5fc7a[_0x7485('0x28')];}_0x54a15d['status'](_0x1bdd6a)[_0x7485('0x29')](_0xd5fc7a);};}exports[_0x7485('0x2a')]=function(_0x490d25,_0x58d293){var _0x28b072={},_0xef277a={},_0x298b01={'count':0x0,'rows':[]};var _0x6d0686=_[_0x7485('0x2b')](db['ChatInternalMessage'][_0x7485('0x2c')],function(_0x18a111){return{'name':_0x18a111[_0x7485('0x2d')],'type':_0x18a111['type'][_0x7485('0x2e')]};});_0xef277a[_0x7485('0x2f')]=_['map'](_0x6d0686,_0x7485('0x28'));_0xef277a[_0x7485('0x30')]=_[_0x7485('0x31')](_0x490d25['query']);_0xef277a[_0x7485('0x32')]=_[_0x7485('0x33')](_0xef277a[_0x7485('0x2f')],_0xef277a[_0x7485('0x30')]);_0x28b072['attributes']=_[_0x7485('0x33')](_0xef277a[_0x7485('0x2f')],qs[_0x7485('0x34')](_0x490d25[_0x7485('0x30')]['fields']));_0x28b072['attributes']=_0x28b072['attributes'][_0x7485('0x35')]?_0x28b072['attributes']:_0xef277a[_0x7485('0x2f')];if(!_0x490d25['query'][_0x7485('0x36')](_0x7485('0x37'))){_0x28b072['limit']=qs[_0x7485('0x38')](_0x490d25['query'][_0x7485('0x38')]);_0x28b072[_0x7485('0x1f')]=qs[_0x7485('0x1f')](_0x490d25['query'][_0x7485('0x1f')]);}_0x28b072[_0x7485('0x39')]=qs['sort'](_0x490d25[_0x7485('0x30')][_0x7485('0x3a')]);_0x28b072[_0x7485('0x3b')]=qs['filters'](_[_0x7485('0x3c')](_0x490d25[_0x7485('0x30')],_0xef277a['filters']),_0x6d0686);if(_0x490d25[_0x7485('0x30')][_0x7485('0x3d')]){_0x28b072['where']=_['merge'](_0x28b072['where'],{'$or':_[_0x7485('0x2b')](_0x6d0686,function(_0x1eef5c){if(_0x1eef5c[_0x7485('0x3e')]!==_0x7485('0x3f')){var _0x31e5c4={};_0x31e5c4[_0x1eef5c[_0x7485('0x28')]]={'$like':'%'+_0x490d25[_0x7485('0x30')]['filter']+'%'};return _0x31e5c4;}})});}_0x28b072=_['merge']({},_0x28b072,_0x490d25[_0x7485('0x40')]);var _0x4af8a5={'where':_0x28b072[_0x7485('0x3b')]};return db[_0x7485('0x41')][_0x7485('0x1e')](_0x4af8a5)[_0x7485('0x25')](function(_0x1ca472){_0x298b01[_0x7485('0x1e')]=_0x1ca472;if(_0x490d25[_0x7485('0x30')][_0x7485('0x42')]){_0x28b072[_0x7485('0x43')]=[{'all':!![]}];}return db[_0x7485('0x41')][_0x7485('0x44')](_0x28b072);})['then'](function(_0x466d47){_0x298b01['rows']=_0x466d47;return _0x298b01;})[_0x7485('0x25')](respondWithFilteredResult(_0x58d293,_0x28b072))[_0x7485('0x45')](handleError(_0x58d293,null));};exports[_0x7485('0x46')]=function(_0x4eadf2,_0x5ea881){var _0x1cbead={'raw':!![],'where':{'id':_0x4eadf2[_0x7485('0x47')]['id']}},_0x300159={};_0x300159[_0x7485('0x2f')]=_[_0x7485('0x31')](db[_0x7485('0x41')][_0x7485('0x2c')]);_0x300159[_0x7485('0x30')]=_[_0x7485('0x31')](_0x4eadf2[_0x7485('0x30')]);_0x300159[_0x7485('0x32')]=_['intersection'](_0x300159[_0x7485('0x2f')],_0x300159[_0x7485('0x30')]);_0x1cbead[_0x7485('0x48')]=_[_0x7485('0x33')](_0x300159['model'],qs[_0x7485('0x34')](_0x4eadf2[_0x7485('0x30')][_0x7485('0x34')]));_0x1cbead[_0x7485('0x48')]=_0x1cbead[_0x7485('0x48')]['length']?_0x1cbead[_0x7485('0x48')]:_0x300159[_0x7485('0x2f')];if(_0x4eadf2['query']['includeAll']){_0x1cbead[_0x7485('0x43')]=[{'all':!![]}];}_0x1cbead=_[_0x7485('0x49')]({},_0x1cbead,_0x4eadf2[_0x7485('0x40')]);return db['ChatInternalMessage']['find'](_0x1cbead)[_0x7485('0x25')](handleEntityNotFound(_0x5ea881,null))[_0x7485('0x25')](respondWithResult(_0x5ea881,null))['catch'](handleError(_0x5ea881,null));};exports[_0x7485('0x4a')]=function(_0x5b0f5a,_0x3d4589){return db[_0x7485('0x41')][_0x7485('0x4a')](_0x5b0f5a[_0x7485('0x4b')],{})['then'](respondWithResult(_0x3d4589,0xc9))[_0x7485('0x45')](handleError(_0x3d4589,null));};exports[_0x7485('0x4c')]=function(_0x265096,_0x1fc5c2){if(_0x265096[_0x7485('0x4b')]['id']){delete _0x265096[_0x7485('0x4b')]['id'];}return db['ChatInternalMessage']['find']({'where':{'id':_0x265096['params']['id']}})[_0x7485('0x25')](handleEntityNotFound(_0x1fc5c2,null))['then'](saveUpdates(_0x265096[_0x7485('0x4b')],null))[_0x7485('0x25')](respondWithResult(_0x1fc5c2,null))[_0x7485('0x45')](handleError(_0x1fc5c2,null));};exports[_0x7485('0x24')]=function(_0x19ea59,_0x3598cb){return db[_0x7485('0x41')][_0x7485('0x4d')]({'where':{'id':_0x19ea59['params']['id']}})['then'](handleEntityNotFound(_0x3598cb,null))['then'](removeEntity(_0x3598cb,null))['catch'](handleError(_0x3598cb,null));};exports[_0x7485('0x4e')]=function(_0x55421c,_0x4dd614){return db['ChatInternalMessage'][_0x7485('0x4e')]()[_0x7485('0x25')](respondWithResult(_0x4dd614,null))[_0x7485('0x45')](handleError(_0x4dd614,null));};function wrapUser(_0x59ae1f){return function(_0x533dfa){var _0x186d69=_0x59ae1f[_0x7485('0x4f')]({'plain':!![]});_0x186d69[_0x7485('0x50')]=[];if(_0x533dfa){_0x186d69['lastMessageAt']=_0x533dfa[_0x7485('0x51')];_0x186d69[_0x7485('0x52')]=_0x533dfa;}else{_0x186d69[_0x7485('0x53')]=moment(0x0)[_0x7485('0x54')](_0x7485('0x55'));_0x186d69[_0x7485('0x52')]={};}return _0x186d69;};}exports['getUsers']=function(_0x416abe,_0x52043f,_0x594082){var _0x223a19=[];return db[_0x7485('0x56')][_0x7485('0x44')]({'where':{'role':[_0x7485('0x57'),_0x7485('0x58'),_0x7485('0x59')]},'attributes':['id','fullname',_0x7485('0x28'),_0x7485('0x5a'),_0x7485('0x5b'),_0x7485('0x5c'),'online',_0x7485('0x5d'),'allowmessenger',_0x7485('0x5e')],'order':qs[_0x7485('0x3a')](_0x7485('0x5f')),'include':[{'model':db[_0x7485('0x60')],'as':'VoiceQueues','attributes':['id',_0x7485('0x28'),'type'],'through':{'attributes':[]}}]})[_0x7485('0x25')](function(_0x160be6){if(_0x160be6){var _0x379cd8=_0x416abe[_0x7485('0x59')]['get']({'plain':!![]});if(!_0x379cd8)throw new Error(_0x7485('0x61'));if(_0x379cd8[_0x7485('0x5a')]===_0x7485('0x59')){return db[_0x7485('0x62')][_0x7485('0x4d')]({'where':{'name':_0x7485('0x63'),'userProfileId':_0x379cd8['userProfileId']},'raw':!![]})[_0x7485('0x25')](function(_0x293877){if(_0x293877){if(_0x293877[_0x7485('0x64')]===0x0){return db['UserProfileResource'][_0x7485('0x44')]({'where':{'sectionId':_0x293877['id']},'raw':!![]})[_0x7485('0x25')](function(_0x394975){var _0x4228ca=[];if(_[_0x7485('0x65')](_0x394975)){_0x4228ca=_[_0x7485('0x3d')](_0x160be6,function(_0x25001b){if(_0x25001b['role']!=='agent'){return _0x25001b;}});return _0x4228ca;}else{for(var _0xc0c9e0=0x0;_0xc0c9e0<_0x160be6[_0x7485('0x35')];_0xc0c9e0++){var _0x5f164a=_0x160be6[_0xc0c9e0];if(_0x5f164a[_0x7485('0x5a')]==='agent'){var _0x191821=_['find'](_0x394975,function(_0x4edecd){return _0x4edecd[_0x7485('0x66')]===_0x5f164a['id'];});if(_0x191821)_0x4228ca['push'](_0x5f164a);}else{_0x4228ca[_0x7485('0x67')](_0x5f164a);}}return _0x4228ca;}});}else{return _0x160be6;}}else{var _0x30de79=_[_0x7485('0x3d')](_0x160be6,function(_0x97d3a7){if(_0x97d3a7[_0x7485('0x5a')]!==_0x7485('0x57')){return _0x97d3a7;}});return _0x30de79;}});}else{return _0x160be6;}}})[_0x7485('0x25')](function(_0x44364d){var _0x33ccac=[];if(_0x44364d){_0x223a19=_0x44364d;for(var _0x1a61af=0x0;_0x1a61af<_0x44364d[_0x7485('0x35')];_0x1a61af+=0x1){_0x223a19[_0x1a61af][_0x7485('0x50')]=[];_0x33ccac[_0x7485('0x67')](db['ChatInternalMessage'][_0x7485('0x4d')]({'where':{'FromId':[_0x416abe[_0x7485('0x59')]['id'],_0x44364d[_0x1a61af]['id']],'ToId':[_0x416abe[_0x7485('0x59')]['id'],_0x44364d[_0x1a61af]['id']],'ChatGroupId':null},'attributes':['id',_0x7485('0x51'),_0x7485('0x68'),_0x7485('0x69'),_0x7485('0x6a'),'body'],'order':qs['sort'](_0x7485('0x6b')),'limit':0x1,'offset':0x0,'raw':!![]})['then'](wrapUser(_0x44364d[_0x1a61af])));}return BPromise[_0x7485('0x6c')](_0x33ccac);}return[];})[_0x7485('0x25')](function(_0x51feeb){return{'rows':_0x51feeb,'count':_0x51feeb[_0x7485('0x35')]};})['then'](respondWithResult(_0x52043f,null))['catch'](handleError(_0x52043f,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index a83f873..275d5ad 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 _0xee5c=['save','remove','emit','hasOwnProperty','exports','events','../../mysqldb','setMaxListeners'];(function(_0x346111,_0x47e5fb){var _0x2229b3=function(_0x31d248){while(--_0x31d248){_0x346111['push'](_0x346111['shift']());}};_0x2229b3(++_0x47e5fb);}(_0xee5c,0xcd));var _0xcee5=function(_0x2e4cbf,_0x8763d3){_0x2e4cbf=_0x2e4cbf-0x0;var _0x52840f=_0xee5c[_0x2e4cbf];return _0x52840f;};'use strict';var EventEmitter=require(_0xcee5('0x0'));var ChatInternalMessage=require(_0xcee5('0x1'))['db']['ChatInternalMessage'];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xcee5('0x2')](0x0);var events={'afterCreate':_0xcee5('0x3'),'afterUpdate':'update','afterDestroy':_0xcee5('0x4')};function emitEvent(_0x2535a8){return function(_0x25a4a8,_0x214d8e,_0x14d6aa){ChatInternalMessageEvents[_0xcee5('0x5')](_0x2535a8+':'+_0x25a4a8['id'],_0x25a4a8);ChatInternalMessageEvents[_0xcee5('0x5')](_0x2535a8,_0x25a4a8);_0x14d6aa(null);};}for(var e in events){if(events[_0xcee5('0x6')](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module[_0xcee5('0x7')]=ChatInternalMessageEvents; \ No newline at end of file +var _0x075e=['update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','ChatInternalMessage','setMaxListeners','save'];(function(_0x4cd3b7,_0x4f1bac){var _0x4cf662=function(_0x23079d){while(--_0x23079d){_0x4cd3b7['push'](_0x4cd3b7['shift']());}};_0x4cf662(++_0x4f1bac);}(_0x075e,0x92));var _0xe075=function(_0x3631b,_0x56a91f){_0x3631b=_0x3631b-0x0;var _0x4bbfe7=_0x075e[_0x3631b];return _0x4bbfe7;};'use strict';var EventEmitter=require('events');var ChatInternalMessage=require(_0xe075('0x0'))['db'][_0xe075('0x1')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xe075('0x2')](0x0);var events={'afterCreate':_0xe075('0x3'),'afterUpdate':_0xe075('0x4'),'afterDestroy':_0xe075('0x5')};function emitEvent(_0x15bef2){return function(_0x422c3a,_0x5eddf4,_0xc28e9d){ChatInternalMessageEvents[_0xe075('0x6')](_0x15bef2+':'+_0x422c3a['id'],_0x422c3a);ChatInternalMessageEvents['emit'](_0x15bef2,_0x422c3a);_0xc28e9d(null);};}for(var e in events){if(events[_0xe075('0x7')](e)){var event=events[e];ChatInternalMessage[_0xe075('0x8')](e,emitEvent(event));}}module[_0xe075('0x9')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index c93cf9e..b02ad12 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 _0xbdb7=['define','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./chatInternalMessage.attributes'];(function(_0x4a8418,_0x39078a){var _0x390174=function(_0x173ea6){while(--_0x173ea6){_0x4a8418['push'](_0x4a8418['shift']());}};_0x390174(++_0x39078a);}(_0xbdb7,0x12e));var _0x7bdb=function(_0xa60623,_0x2d4e4f){_0xa60623=_0xa60623-0x0;var _0x4a6487=_0xbdb7[_0xa60623];return _0x4a6487;};'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 +var _0xbdb7=['define','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./chatInternalMessage.attributes'];(function(_0x2bb66c,_0x36c6c6){var _0x1e0f98=function(_0x1e3412){while(--_0x1e3412){_0x2bb66c['push'](_0x2bb66c['shift']());}};_0x1e0f98(++_0x36c6c6);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x2de9de,_0xd46ad){_0x2de9de=_0x2de9de-0x0;var _0x34be8c=_0xbdb7[_0x2de9de];return _0x34be8c;};'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 6bd9a67..b2ae8be 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 _0xd13e=['../../config/logger','../../config/environment','jayson/promise','http','redis','socket.io-emitter','./chatInternalMessage.socket','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd13e,0x1c2));var _0xed13=function(_0x4ba5c6,_0x41e42b){_0x4ba5c6=_0x4ba5c6-0x0;var _0x5a2863=_0xd13e[_0x4ba5c6];return _0x5a2863;};'use strict';var _=require('lodash');var util=require(_0xed13('0x0'));var moment=require(_0xed13('0x1'));var BPromise=require(_0xed13('0x2'));var rs=require(_0xed13('0x3'));var fs=require('fs');var Redis=require(_0xed13('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xed13('0x5'));var logger=require(_0xed13('0x6'))('rpc');var config=require(_0xed13('0x7'));var jayson=require(_0xed13('0x8'));var client=jayson['client'][_0xed13('0x9')]({'port':0x232a});config[_0xed13('0xa')]=_['defaults'](config[_0xed13('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xed13('0xb'))(new Redis(config['redis']));require(_0xed13('0xc'))['register'](socket);function respondWithRpcPromise(_0x3da3eb,_0x12e4f9,_0x6c0bd8){return new BPromise(function(_0x469dd9,_0x463c34){return client['request'](_0x3da3eb,_0x6c0bd8)[_0xed13('0xd')](function(_0x24874e){logger[_0xed13('0xe')](_0xed13('0xf'),_0x12e4f9,_0xed13('0x10'));logger[_0xed13('0x11')](_0xed13('0x12'),_0x12e4f9,_0xed13('0x10'),JSON[_0xed13('0x13')](_0x24874e));if(_0x24874e[_0xed13('0x14')]){if(_0x24874e[_0xed13('0x14')][_0xed13('0x15')]===0x1f4){logger[_0xed13('0x14')](_0xed13('0xf'),_0x12e4f9,_0x24874e['error']['message']);return _0x463c34(_0x24874e[_0xed13('0x14')][_0xed13('0x16')]);}logger[_0xed13('0x14')](_0xed13('0xf'),_0x12e4f9,_0x24874e[_0xed13('0x14')][_0xed13('0x16')]);return _0x469dd9(_0x24874e['error'][_0xed13('0x16')]);}else{logger[_0xed13('0xe')](_0xed13('0xf'),_0x12e4f9,_0xed13('0x10'));_0x469dd9(_0x24874e[_0xed13('0x17')][_0xed13('0x16')]);}})['catch'](function(_0x35034f){logger[_0xed13('0x14')]('ChatInternalMessage,\x20%s,\x20%s',_0x12e4f9,_0x35034f);_0x463c34(_0x35034f);});});} \ No newline at end of file +var _0xbf76=['message','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','request','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x127a9f,_0x5f0e6a){var _0x3aaa5f=function(_0x3d5eb6){while(--_0x3d5eb6){_0x127a9f['push'](_0x127a9f['shift']());}};_0x3aaa5f(++_0x5f0e6a);}(_0xbf76,0x69));var _0x6bf7=function(_0x488b49,_0x34d2e2){_0x488b49=_0x488b49-0x0;var _0x241e56=_0xbf76[_0x488b49];return _0x241e56;};'use strict';var _=require(_0x6bf7('0x0'));var util=require(_0x6bf7('0x1'));var moment=require(_0x6bf7('0x2'));var BPromise=require(_0x6bf7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6bf7('0x4'));var db=require(_0x6bf7('0x5'))['db'];var utils=require(_0x6bf7('0x6'));var logger=require(_0x6bf7('0x7'))('rpc');var config=require(_0x6bf7('0x8'));var jayson=require(_0x6bf7('0x9'));var client=jayson[_0x6bf7('0xa')]['http']({'port':0x232a});config[_0x6bf7('0xb')]=_['defaults'](config['redis'],{'host':_0x6bf7('0xc'),'port':0x18eb});var socket=require(_0x6bf7('0xd'))(new Redis(config[_0x6bf7('0xb')]));require(_0x6bf7('0xe'))['register'](socket);function respondWithRpcPromise(_0x407b9e,_0x49fd37,_0x541aa6){return new BPromise(function(_0x542cf6,_0x2643d8){return client[_0x6bf7('0xf')](_0x407b9e,_0x541aa6)[_0x6bf7('0x10')](function(_0x500198){logger[_0x6bf7('0x11')](_0x6bf7('0x12'),_0x49fd37,_0x6bf7('0x13'));logger[_0x6bf7('0x14')](_0x6bf7('0x15'),_0x49fd37,_0x6bf7('0x13'),JSON[_0x6bf7('0x16')](_0x500198));if(_0x500198[_0x6bf7('0x17')]){if(_0x500198['error'][_0x6bf7('0x18')]===0x1f4){logger['error']('ChatInternalMessage,\x20%s,\x20%s',_0x49fd37,_0x500198[_0x6bf7('0x17')]['message']);return _0x2643d8(_0x500198[_0x6bf7('0x17')]['message']);}logger['error'](_0x6bf7('0x12'),_0x49fd37,_0x500198[_0x6bf7('0x17')][_0x6bf7('0x19')]);return _0x542cf6(_0x500198[_0x6bf7('0x17')][_0x6bf7('0x19')]);}else{logger['info'](_0x6bf7('0x12'),_0x49fd37,'request\x20sent');_0x542cf6(_0x500198['result'][_0x6bf7('0x19')]);}})['catch'](function(_0x1f17a9){logger[_0x6bf7('0x17')](_0x6bf7('0x12'),_0x49fd37,_0x1f17a9);_0x2643d8(_0x1f17a9);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index c4dcec2..0b97670 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 _0x593e=['emit','removeListener','register','length','chatInternalMessage:','./chatInternalMessage.events','save','remove','update'];(function(_0x513b32,_0x1e0cde){var _0x415451=function(_0x51ab8e){while(--_0x51ab8e){_0x513b32['push'](_0x513b32['shift']());}};_0x415451(++_0x1e0cde);}(_0x593e,0xcb));var _0xe593=function(_0x416429,_0xaaf0cb){_0x416429=_0x416429-0x0;var _0x48e26e=_0x593e[_0x416429];return _0x48e26e;};'use strict';var ChatInternalMessageEvents=require(_0xe593('0x0'));var events=[_0xe593('0x1'),_0xe593('0x2'),_0xe593('0x3')];function createListener(_0x43dabb,_0x184a6b){return function(_0x2c7c48){_0x184a6b[_0xe593('0x4')](_0x43dabb,_0x2c7c48);};}function removeListener(_0x550574,_0x8a87e8){return function(){ChatInternalMessageEvents[_0xe593('0x5')](_0x550574,_0x8a87e8);};}exports[_0xe593('0x6')]=function(_0x1e50d3){for(var _0x3b7082=0x0,_0x14cff3=events[_0xe593('0x7')];_0x3b7082<_0x14cff3;_0x3b7082++){var _0x307dad=events[_0x3b7082];var _0x169c08=createListener(_0xe593('0x8')+_0x307dad,_0x1e50d3);ChatInternalMessageEvents['on'](_0x307dad,_0x169c08);}}; \ No newline at end of file +var _0x59ce=['removeListener','chatInternalMessage:','./chatInternalMessage.events','save','remove','emit'];(function(_0x372129,_0x539547){var _0x2385b4=function(_0x17969f){while(--_0x17969f){_0x372129['push'](_0x372129['shift']());}};_0x2385b4(++_0x539547);}(_0x59ce,0x92));var _0xe59c=function(_0x3d585b,_0x2a0ee1){_0x3d585b=_0x3d585b-0x0;var _0x2bc350=_0x59ce[_0x3d585b];return _0x2bc350;};'use strict';var ChatInternalMessageEvents=require(_0xe59c('0x0'));var events=[_0xe59c('0x1'),_0xe59c('0x2'),'update'];function createListener(_0x9cdd6a,_0x18c8c3){return function(_0x455361){_0x18c8c3[_0xe59c('0x3')](_0x9cdd6a,_0x455361);};}function removeListener(_0x2ea56e,_0x42a856){return function(){ChatInternalMessageEvents[_0xe59c('0x4')](_0x2ea56e,_0x42a856);};}exports['register']=function(_0x387c49){for(var _0x4ba903=0x0,_0x534601=events['length'];_0x4ba903<_0x534601;_0x4ba903++){var _0x2c1d11=events[_0x4ba903];var _0x101a79=createListener(_0xe59c('0x5')+_0x2c1d11,_0x387c49);ChatInternalMessageEvents['on'](_0x2c1d11,_0x101a79);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 27a109f..028b15b 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 _0x9c44=['express','Router','../../components/auth/service','../../components/interaction/service','get','index','/describe','isAuthenticated','describe','/users','getUsers','show','post','create','put','delete','/:id','destroy','exports','path','connect-timeout'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x9c44,0x178));var _0x49c4=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0x9c44[_0x16b9ed];return _0x66b1f8;};'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('./chatInternalMessage.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('0x6')]('/:id',auth['isAuthenticated'](),controller[_0x49c4('0xd')]);router[_0x49c4('0xe')]('/',auth['isAuthenticated'](),controller[_0x49c4('0xf')]);router[_0x49c4('0x10')]('/:id',controller['update']);router[_0x49c4('0x11')](_0x49c4('0x12'),auth['isAuthenticated'](),controller[_0x49c4('0x13')]);module[_0x49c4('0x14')]=router; \ No newline at end of file +var _0x0713=['exports','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','index','/describe','describe','/users','getUsers','/:id','show','post','put','update','delete'];(function(_0x3486ae,_0x5a52e9){var _0x59c8e4=function(_0x10c174){while(--_0x10c174){_0x3486ae['push'](_0x3486ae['shift']());}};_0x59c8e4(++_0x5a52e9);}(_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('0x10')]('/',auth[_0x3071('0x8')](),controller['create']);router[_0x3071('0x11')](_0x3071('0xe'),controller[_0x3071('0x12')]);router[_0x3071('0x13')](_0x3071('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0x3071('0x14')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 366de7a..f899e76 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 _0xadbb=['sequelize','exports','TEXT','medium','BOOLEAN','ENUM','out','DATE'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xadbb,0x170));var _0xbadb=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xadbb[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require(_0xbadb('0x0'));module[_0xbadb('0x1')]={'body':{'type':Sequelize[_0xbadb('0x2')](_0xbadb('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xbadb('0x4')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xbadb('0x5')]('in',_0xbadb('0x6')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0xbadb('0x7')]}}; \ No newline at end of file +var _0x46fa=['ENUM','out','DATE','sequelize','TEXT','medium','BOOLEAN'];(function(_0x117f65,_0x41780d){var _0x27a8cd=function(_0x4999f3){while(--_0x4999f3){_0x117f65['push'](_0x117f65['shift']());}};_0x27a8cd(++_0x41780d);}(_0x46fa,0x1df));var _0xa46f=function(_0x55d00,_0x1ddb99){_0x55d00=_0x55d00-0x0;var _0x15bf1d=_0x46fa[_0x55d00];return _0x15bf1d;};'use strict';var Sequelize=require(_0xa46f('0x0'));module['exports']={'body':{'type':Sequelize[_0xa46f('0x1')](_0xa46f('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xa46f('0x3')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xa46f('0x4')]('in',_0xa46f('0x5')),'defaultValue':_0xa46f('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0xa46f('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 3751d49..d731b2f 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 _0x7151=['get','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','null','AcceptMessage','acceptMessage','interface','SIP/%s','channel','event','EventManager','acceptmessage','parse','chat-interactions','reject','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','rejectmessage','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','defaults','localhost','socket.io-emitter','jayson/promise','client','http','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~!@#$%^&-_=+[{]}.','request','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','error','message','info','result','catch','sendStatus','status','end','json','count','limit','Content-Range','destroy','then','name','send','index','map','fieldName','type','key','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','merge','VIRTUAL','options','ChatMessage','include','findAll','rows','show','params','rawAttributes','find','create','body','update','describe','accept','chat','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','ChatInteraction','ChatInteractionId','isNil','interaction'];(function(_0x5b8f6d,_0x15ecd0){var _0x729fba=function(_0xfeecfc){while(--_0xfeecfc){_0x5b8f6d['push'](_0x5b8f6d['shift']());}};_0x729fba(++_0x15ecd0);}(_0x7151,0x8c));var _0x1715=function(_0x2e5c2c,_0x1a744a){_0x2e5c2c=_0x2e5c2c-0x0;var _0x5e240b=_0x7151[_0x2e5c2c];return _0x5e240b;};'use strict';var pdf=require(_0x1715('0x0'));var emlformat=require(_0x1715('0x1'));var rimraf=require(_0x1715('0x2'));var zipdir=require(_0x1715('0x3'));var jsonpatch=require(_0x1715('0x4'));var rp=require(_0x1715('0x5'));var moment=require(_0x1715('0x6'));var BPromise=require(_0x1715('0x7'));var Mustache=require(_0x1715('0x8'));var util=require(_0x1715('0x9'));var path=require(_0x1715('0xa'));var sox=require(_0x1715('0xb'));var csv=require(_0x1715('0xc'));var ejs=require(_0x1715('0xd'));var fs=require('fs');var _=require(_0x1715('0xe'));var squel=require(_0x1715('0xf'));var crypto=require(_0x1715('0x10'));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(_0x1715('0x11'));var authService=require(_0x1715('0x12'));var qs=require(_0x1715('0x13'));var as=require(_0x1715('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1715('0x15'))(_0x1715('0x16'));var utils=require(_0x1715('0x17'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config['redis']=_[_0x1715('0x18')](config['redis'],{'host':_0x1715('0x19'),'port':0x18eb});var socket=require(_0x1715('0x1a'))(new Redis(config['redis']));require('./chatMessage.socket')['register'](socket);var jayson=require(_0x1715('0x1b'));var client=jayson[_0x1715('0x1c')][_0x1715('0x1d')]({'port':0x232c});var client9002=jayson[_0x1715('0x1c')]['http']({'port':0x232a});function checkPasswordPattern(_0x1861dd,_0x424f4c,_0x2b85c8){if(_0x2b85c8){var _0x3523a5=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3523a5[_0x1715('0x1e')](_0x424f4c)){return _0x1861dd;}else{throw new db[(_0x1715('0x1f'))]['ValidationError'](_0x1715('0x20'));}}else{return _0x1861dd;}}function respondWithRpcPromise(_0x525a3b,_0x40c09,_0xb0c0fe,_0xa8e6d0){return new BPromise(function(_0x3d1178,_0x3ecf1c){var _0x27d0b8=_0xa8e6d0||client;return _0x27d0b8[_0x1715('0x21')](_0x525a3b,_0xb0c0fe)['then'](function(_0xad9e93){logger['info'](_0x1715('0x22'),_0x40c09,_0x1715('0x23'));logger[_0x1715('0x24')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x40c09,'request\x20sent',JSON['stringify'](_0xad9e93));if(_0xad9e93[_0x1715('0x25')]){if(_0xad9e93[_0x1715('0x25')]['code']===0x1f4){logger['error'](_0x1715('0x22'),_0x40c09,_0xad9e93[_0x1715('0x25')][_0x1715('0x26')]);return _0x3ecf1c(_0xad9e93['error'][_0x1715('0x26')]);}logger['error'](_0x1715('0x22'),_0x40c09,_0xad9e93[_0x1715('0x25')]['message']);return _0x3d1178(_0xad9e93[_0x1715('0x25')]['message']);}else{logger[_0x1715('0x27')](_0x1715('0x22'),_0x40c09,_0x1715('0x23'));_0x3d1178(_0xad9e93[_0x1715('0x28')][_0x1715('0x26')]);}})[_0x1715('0x29')](function(_0x43c0b5){logger['error'](_0x1715('0x22'),_0x40c09,_0x43c0b5);_0x3ecf1c(_0x43c0b5);});});}function respondWithStatusCode(_0x559b40,_0x3e84b8){_0x3e84b8=_0x3e84b8||0xcc;return function(_0x398431){if(_0x398431){return _0x559b40[_0x1715('0x2a')](_0x3e84b8);}return _0x559b40[_0x1715('0x2b')](_0x3e84b8)[_0x1715('0x2c')]();};}function respondWithResult(_0x1cd61b,_0x26cdca){_0x26cdca=_0x26cdca||0xc8;return function(_0x4a29fe){if(_0x4a29fe){return _0x1cd61b[_0x1715('0x2b')](_0x26cdca)[_0x1715('0x2d')](_0x4a29fe);}};}function respondWithFilteredResult(_0x2147de,_0x4e4bfe){return function(_0x19c0e3){if(_0x19c0e3){var _0x203310=_0x19c0e3[_0x1715('0x2e')],_0xc7b469=_0x4e4bfe['offset'],_0x9f3b7f=_0x4e4bfe['offset']+_0x4e4bfe[_0x1715('0x2f')],_0x351859;if(_0x9f3b7f>=_0x203310){_0x9f3b7f=_0x203310;_0x351859=0xc8;}else{_0x351859=0xce;}_0x2147de[_0x1715('0x2b')](_0x351859);return _0x2147de['set'](_0x1715('0x30'),_0xc7b469+'-'+_0x9f3b7f+'/'+_0x203310)[_0x1715('0x2d')](_0x19c0e3);}return null;};}function patchUpdates(_0x485b89){return function(_0x47a38a){try{jsonpatch['apply'](_0x47a38a,_0x485b89,!![]);}catch(_0x4dce87){return BPromise['reject'](_0x4dce87);}return _0x47a38a['save']();};}function saveUpdates(_0x2939fb,_0x1b8c7b){return function(_0xc91865){if(_0xc91865){return _0xc91865['update'](_0x2939fb)['then'](function(_0x3e1708){return _0x3e1708;});}return null;};}function removeEntity(_0x1e1740,_0x39e4fd){return function(_0x4ab542){if(_0x4ab542){return _0x4ab542[_0x1715('0x31')]()[_0x1715('0x32')](function(){_0x1e1740[_0x1715('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x590ee3,_0x3615b4){return function(_0x5705c9){if(!_0x5705c9){_0x590ee3[_0x1715('0x2a')](0x194);}return _0x5705c9;};}function handleError(_0x56d0d5,_0x374a49){_0x374a49=_0x374a49||0x1f4;return function(_0x3a7006){logger['error'](_0x3a7006['stack']);if(_0x3a7006[_0x1715('0x33')]){delete _0x3a7006[_0x1715('0x33')];}_0x56d0d5[_0x1715('0x2b')](_0x374a49)[_0x1715('0x34')](_0x3a7006);};}exports[_0x1715('0x35')]=function(_0x35a435,_0x12d601){var _0x2ad61b={},_0x300055={},_0x23a300={'count':0x0,'rows':[]};var _0x4bc92b=_[_0x1715('0x36')](db['ChatMessage']['rawAttributes'],function(_0xf170b7){return{'name':_0xf170b7[_0x1715('0x37')],'type':_0xf170b7[_0x1715('0x38')][_0x1715('0x39')]};});_0x300055['model']=_[_0x1715('0x36')](_0x4bc92b,_0x1715('0x33'));_0x300055['query']=_[_0x1715('0x3a')](_0x35a435[_0x1715('0x3b')]);_0x300055[_0x1715('0x3c')]=_[_0x1715('0x3d')](_0x300055[_0x1715('0x3e')],_0x300055['query']);_0x2ad61b['attributes']=_[_0x1715('0x3d')](_0x300055[_0x1715('0x3e')],qs[_0x1715('0x3f')](_0x35a435[_0x1715('0x3b')][_0x1715('0x3f')]));_0x2ad61b[_0x1715('0x40')]=_0x2ad61b[_0x1715('0x40')][_0x1715('0x41')]?_0x2ad61b[_0x1715('0x40')]:_0x300055['model'];if(!_0x35a435['query'][_0x1715('0x42')](_0x1715('0x43'))){_0x2ad61b['limit']=qs[_0x1715('0x2f')](_0x35a435[_0x1715('0x3b')]['limit']);_0x2ad61b[_0x1715('0x44')]=qs[_0x1715('0x44')](_0x35a435[_0x1715('0x3b')][_0x1715('0x44')]);}_0x2ad61b[_0x1715('0x45')]=qs[_0x1715('0x46')](_0x35a435['query'][_0x1715('0x46')]);_0x2ad61b[_0x1715('0x47')]=qs[_0x1715('0x3c')](_[_0x1715('0x48')](_0x35a435['query'],_0x300055[_0x1715('0x3c')]),_0x4bc92b);if(_0x35a435[_0x1715('0x3b')][_0x1715('0x49')]){_0x2ad61b[_0x1715('0x47')]=_[_0x1715('0x4a')](_0x2ad61b['where'],{'$or':_[_0x1715('0x36')](_0x4bc92b,function(_0x160c6f){if(_0x160c6f['type']!==_0x1715('0x4b')){var _0x172fe6={};_0x172fe6[_0x160c6f[_0x1715('0x33')]]={'$like':'%'+_0x35a435[_0x1715('0x3b')][_0x1715('0x49')]+'%'};return _0x172fe6;}})});}_0x2ad61b=_[_0x1715('0x4a')]({},_0x2ad61b,_0x35a435[_0x1715('0x4c')]);var _0x47cbcf={'where':_0x2ad61b[_0x1715('0x47')]};return db[_0x1715('0x4d')][_0x1715('0x2e')](_0x47cbcf)[_0x1715('0x32')](function(_0x5e1c35){_0x23a300[_0x1715('0x2e')]=_0x5e1c35;if(_0x35a435[_0x1715('0x3b')]['includeAll']){_0x2ad61b[_0x1715('0x4e')]=[{'all':!![]}];}return db[_0x1715('0x4d')][_0x1715('0x4f')](_0x2ad61b);})[_0x1715('0x32')](function(_0x575d47){_0x23a300[_0x1715('0x50')]=_0x575d47;return _0x23a300;})['then'](respondWithFilteredResult(_0x12d601,_0x2ad61b))['catch'](handleError(_0x12d601,null));};exports[_0x1715('0x51')]=function(_0x3292e6,_0xa2e4ac){var _0x2edce8={'raw':!![],'where':{'id':_0x3292e6[_0x1715('0x52')]['id']}},_0x33cadc={};_0x33cadc['model']=_[_0x1715('0x3a')](db[_0x1715('0x4d')][_0x1715('0x53')]);_0x33cadc['query']=_[_0x1715('0x3a')](_0x3292e6[_0x1715('0x3b')]);_0x33cadc[_0x1715('0x3c')]=_[_0x1715('0x3d')](_0x33cadc[_0x1715('0x3e')],_0x33cadc['query']);_0x2edce8[_0x1715('0x40')]=_[_0x1715('0x3d')](_0x33cadc[_0x1715('0x3e')],qs[_0x1715('0x3f')](_0x3292e6[_0x1715('0x3b')]['fields']));_0x2edce8[_0x1715('0x40')]=_0x2edce8['attributes'][_0x1715('0x41')]?_0x2edce8[_0x1715('0x40')]:_0x33cadc[_0x1715('0x3e')];if(_0x3292e6[_0x1715('0x3b')]['includeAll']){_0x2edce8['include']=[{'all':!![]}];}_0x2edce8=_[_0x1715('0x4a')]({},_0x2edce8,_0x3292e6['options']);return db['ChatMessage'][_0x1715('0x54')](_0x2edce8)['then'](handleEntityNotFound(_0xa2e4ac,null))[_0x1715('0x32')](respondWithResult(_0xa2e4ac,null))[_0x1715('0x29')](handleError(_0xa2e4ac,null));};exports[_0x1715('0x55')]=function(_0x1bd669,_0x50f24d){return db[_0x1715('0x4d')][_0x1715('0x55')](_0x1bd669[_0x1715('0x56')],{})['then'](respondWithResult(_0x50f24d,0xc9))[_0x1715('0x29')](handleError(_0x50f24d,null));};exports[_0x1715('0x57')]=function(_0x4ea20e,_0x2164c2){if(_0x4ea20e['body']['id']){delete _0x4ea20e[_0x1715('0x56')]['id'];}return db[_0x1715('0x4d')]['find']({'where':{'id':_0x4ea20e[_0x1715('0x52')]['id']}})['then'](handleEntityNotFound(_0x2164c2,null))[_0x1715('0x32')](saveUpdates(_0x4ea20e[_0x1715('0x56')],null))[_0x1715('0x32')](respondWithResult(_0x2164c2,null))[_0x1715('0x29')](handleError(_0x2164c2,null));};exports['destroy']=function(_0x57ed64,_0x5586b4){return db[_0x1715('0x4d')][_0x1715('0x54')]({'where':{'id':_0x57ed64[_0x1715('0x52')]['id']}})[_0x1715('0x32')](handleEntityNotFound(_0x5586b4,null))[_0x1715('0x32')](removeEntity(_0x5586b4,null))[_0x1715('0x29')](handleError(_0x5586b4,null));};exports['describe']=function(_0xd68bf1,_0x5583e8){return db[_0x1715('0x4d')][_0x1715('0x58')]()['then'](respondWithResult(_0x5583e8,null))[_0x1715('0x29')](handleError(_0x5583e8,null));};var interaction_log=require(_0x1715('0x15'))('chat-interactions');exports[_0x1715('0x59')]=function(_0x2bc1ef,_0x11fc27,_0x174470){var _0x1daa45={'channel':_0x1715('0x5a')};if(_0x2bc1ef[_0x1715('0x56')]['id']){delete _0x2bc1ef[_0x1715('0x56')]['id'];}_0x2bc1ef[_0x1715('0x56')]['read']=!![];_0x2bc1ef[_0x1715('0x56')][_0x1715('0x5b')]=moment()[_0x1715('0x5c')](_0x1715('0x5d'));_0x2bc1ef[_0x1715('0x56')][_0x1715('0x5e')]=_0x2bc1ef['body'][_0x1715('0x5e')]||_0x2bc1ef[_0x1715('0x5f')]['id'];return db['ChatMessage']['find']({'where':{'id':_0x2bc1ef['params']['id'],'UserId':null},'include':[{'model':db[_0x1715('0x60')],'as':_0x1715('0x61')}]})['then'](handleEntityNotFound(_0x11fc27,null))[_0x1715('0x32')](saveUpdates(_0x2bc1ef[_0x1715('0x56')],null))[_0x1715('0x32')](function(_0x216c3c){if(_0x216c3c){_0x1daa45[_0x1715('0x26')]=_0x216c3c['get']({'plain':!![]});return db[_0x1715('0x62')]['find']({'where':{'id':_0x216c3c[_0x1715('0x63')]}});}return null;})[_0x1715('0x32')](handleEntityNotFound(_0x11fc27,null))[_0x1715('0x32')](function(_0x5ec5ec){if(_0x5ec5ec){return _0x5ec5ec[_0x1715('0x57')]({'UserId':_0x2bc1ef[_0x1715('0x56')]['UserId'],'read1stAt':_[_0x1715('0x64')](_0x5ec5ec['read1stAt'])?moment()['format'](_0x1715('0x5d')):undefined});}return null;})['then'](function(_0x1f7566){if(_0x1f7566){_0x1daa45[_0x1715('0x65')]=_0x1f7566[_0x1715('0x66')]({'plain':!![]});interaction_log[_0x1715('0x27')](_0x1715('0x67'),_0x2bc1ef[_0x1715('0x5f')]['id'],_0x2bc1ef[_0x1715('0x5f')][_0x1715('0x33')],_0x2bc1ef[_0x1715('0x5f')][_0x1715('0x68')],_0x1daa45[_0x1715('0x65')]['id'],_0x2bc1ef[_0x1715('0x56')]?JSON[_0x1715('0x69')](_0x2bc1ef[_0x1715('0x56')]):_0x1715('0x6a'));return respondWithRpcPromise(_0x1715('0x6b'),_0x1715('0x6c'),_0x1daa45);}return null;})[_0x1715('0x32')](function(_0x48518b){if(_0x48518b){if(_0x2bc1ef[_0x1715('0x56')]['manual']){_0x1daa45[_0x1715('0x26')][_0x1715('0x6d')]=util[_0x1715('0x5c')](_0x1715('0x6e'),_0x2bc1ef[_0x1715('0x5f')][_0x1715('0x33')]);_0x1daa45[_0x1715('0x26')][_0x1715('0x6f')]=_0x1daa45['channel'];_0x1daa45[_0x1715('0x26')][_0x1715('0x70')]=_0x1715('0x59');return respondWithRpcPromise(_0x1715('0x71'),_0x1715('0x71'),{'event':_0x1715('0x72'),'message':_[_0x1715('0x4a')](_0x1daa45[_0x1715('0x26')],JSON[_0x1715('0x73')](_0x1daa45[_0x1715('0x65')]['formData']))},client9002)[_0x1715('0x32')](function(){return _0x1daa45;});}return _0x1daa45;}return null;})['then'](respondWithResult(_0x11fc27,null))['catch'](handleError(_0x11fc27,null));};var interaction_log=require(_0x1715('0x15'))(_0x1715('0x74'));exports[_0x1715('0x75')]=function(_0x294398,_0x4258cd,_0x2b648c){var _0x50a627={'agent':{},'channel':_0x1715('0x5a')};if(_0x294398[_0x1715('0x56')]['id']){delete _0x294398['body']['id'];}_0x294398['body'][_0x1715('0x5e')]=_0x294398[_0x1715('0x56')][_0x1715('0x5e')]||_0x294398['user']['id'];_0x50a627['agent']['id']=_0x294398[_0x1715('0x56')]['UserId'];return db[_0x1715('0x4d')][_0x1715('0x54')]({'where':{'id':_0x294398[_0x1715('0x52')]['id'],'UserId':null}})[_0x1715('0x32')](handleEntityNotFound(_0x4258cd,null))[_0x1715('0x32')](function(_0x388263){if(_0x388263){_0x50a627[_0x1715('0x26')]=_0x388263['get']({'plain':!![]});return db[_0x1715('0x62')][_0x1715('0x54')]({'where':{'id':_0x388263[_0x1715('0x63')]}});}return null;})[_0x1715('0x32')](handleEntityNotFound(_0x4258cd,null))[_0x1715('0x32')](function(_0xd30d58){if(_0xd30d58){_0x50a627[_0x1715('0x65')]=_0xd30d58[_0x1715('0x66')]({'plain':!![]});interaction_log['info'](_0x1715('0x76'),_0x294398[_0x1715('0x5f')]['id'],_0x294398[_0x1715('0x5f')]['name'],_0x294398[_0x1715('0x5f')][_0x1715('0x68')],_0x50a627[_0x1715('0x65')]['id'],_0x294398[_0x1715('0x56')]?JSON[_0x1715('0x69')](_0x294398[_0x1715('0x56')]):_0x1715('0x6a'));return respondWithRpcPromise('RejectMessage',_0x1715('0x77'),_0x50a627);}return null;})[_0x1715('0x32')](function(_0x5331ee){if(_0x5331ee){_0x5331ee[_0x1715('0x26')][_0x1715('0x6d')]=util[_0x1715('0x5c')](_0x1715('0x6e'),_0x294398[_0x1715('0x5f')][_0x1715('0x33')]);_0x5331ee[_0x1715('0x26')][_0x1715('0x6f')]=_0x50a627[_0x1715('0x6f')];_0x5331ee[_0x1715('0x26')][_0x1715('0x70')]=_0x1715('0x75');respondWithRpcPromise(_0x1715('0x71'),_0x1715('0x71'),{'event':_0x1715('0x78'),'message':_0x5331ee[_0x1715('0x26')]},client9002);return _0x50a627;}return null;})[_0x1715('0x32')](respondWithResult(_0x4258cd,null))[_0x1715('0x29')](handleError(_0x4258cd,null));}; \ No newline at end of file +var _0xb9fb=['length','hasOwnProperty','nolimit','limit','sort','where','filters','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','params','find','create','catch','body','describe','../../config/logger','chat-interactions','accept','UserId','user','CmContact','Contact','get','ChatInteraction','ChatInteractionId','isNil','read1stAt','format','YYYY-MM-DD\x20HH:mm:ss','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','parse','formData','chat','agent','RejectMessage','rejectMessage','rejectmessage','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','jayson/promise','client','http','Sequelize','ValidationError','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','sendStatus','offset','status','set','apply','reject','save','update','end','name','send','index','map','ChatMessage','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields'];(function(_0x5be3e4,_0x3aae4d){var _0x18bf71=function(_0x49d8cf){while(--_0x49d8cf){_0x5be3e4['push'](_0x5be3e4['shift']());}};_0x18bf71(++_0x3aae4d);}(_0xb9fb,0x1aa));var _0xbb9f=function(_0x341e0f,_0x4a09d0){_0x341e0f=_0x341e0f-0x0;var _0x59555a=_0xb9fb[_0x341e0f];return _0x59555a;};'use strict';var pdf=require(_0xbb9f('0x0'));var emlformat=require(_0xbb9f('0x1'));var rimraf=require(_0xbb9f('0x2'));var zipdir=require(_0xbb9f('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xbb9f('0x4'));var BPromise=require(_0xbb9f('0x5'));var Mustache=require(_0xbb9f('0x6'));var util=require(_0xbb9f('0x7'));var path=require(_0xbb9f('0x8'));var sox=require(_0xbb9f('0x9'));var csv=require(_0xbb9f('0xa'));var ejs=require(_0xbb9f('0xb'));var fs=require('fs');var _=require(_0xbb9f('0xc'));var squel=require('squel');var crypto=require(_0xbb9f('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xbb9f('0xe'));var toCsv=require(_0xbb9f('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xbb9f('0xf'));var qs=require(_0xbb9f('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbb9f('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0xbb9f('0x12'));var config=require('../../config/environment');var db=require(_0xbb9f('0x13'))['db'];config[_0xbb9f('0x14')]=_[_0xbb9f('0x15')](config[_0xbb9f('0x14')],{'host':_0xbb9f('0x16'),'port':0x18eb});var socket=require(_0xbb9f('0x17'))(new Redis(config['redis']));require(_0xbb9f('0x18'))[_0xbb9f('0x19')](socket);var jayson=require(_0xbb9f('0x1a'));var client=jayson[_0xbb9f('0x1b')][_0xbb9f('0x1c')]({'port':0x232c});var client9002=jayson[_0xbb9f('0x1b')][_0xbb9f('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x582255,_0x212bbb,_0x344198){if(_0x344198){var _0x18b7bc=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x18b7bc['test'](_0x212bbb)){return _0x582255;}else{throw new db[(_0xbb9f('0x1d'))][(_0xbb9f('0x1e'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x582255;}}function respondWithRpcPromise(_0x554411,_0x2ffb9b,_0x56ce45,_0xfc31da){return new BPromise(function(_0x4e2037,_0x1cffd3){var _0x4a8a1e=_0xfc31da||client;return _0x4a8a1e[_0xbb9f('0x1f')](_0x554411,_0x56ce45)[_0xbb9f('0x20')](function(_0x11e7c5){logger[_0xbb9f('0x21')](_0xbb9f('0x22'),_0x2ffb9b,_0xbb9f('0x23'));logger[_0xbb9f('0x24')](_0xbb9f('0x25'),_0x2ffb9b,_0xbb9f('0x23'),JSON[_0xbb9f('0x26')](_0x11e7c5));if(_0x11e7c5[_0xbb9f('0x27')]){if(_0x11e7c5['error'][_0xbb9f('0x28')]===0x1f4){logger[_0xbb9f('0x27')](_0xbb9f('0x22'),_0x2ffb9b,_0x11e7c5['error']['message']);return _0x1cffd3(_0x11e7c5[_0xbb9f('0x27')]['message']);}logger[_0xbb9f('0x27')](_0xbb9f('0x22'),_0x2ffb9b,_0x11e7c5[_0xbb9f('0x27')][_0xbb9f('0x29')]);return _0x4e2037(_0x11e7c5[_0xbb9f('0x27')][_0xbb9f('0x29')]);}else{logger[_0xbb9f('0x21')]('ChatMessage,\x20%s,\x20%s',_0x2ffb9b,_0xbb9f('0x23'));_0x4e2037(_0x11e7c5['result'][_0xbb9f('0x29')]);}})['catch'](function(_0x575897){logger[_0xbb9f('0x27')]('ChatMessage,\x20%s,\x20%s',_0x2ffb9b,_0x575897);_0x1cffd3(_0x575897);});});}function respondWithStatusCode(_0x5aacbb,_0x3701a6){_0x3701a6=_0x3701a6||0xcc;return function(_0x13bafa){if(_0x13bafa){return _0x5aacbb[_0xbb9f('0x2a')](_0x3701a6);}return _0x5aacbb['status'](_0x3701a6)['end']();};}function respondWithResult(_0x34e300,_0xd91e23){_0xd91e23=_0xd91e23||0xc8;return function(_0xc3aa5b){if(_0xc3aa5b){return _0x34e300['status'](_0xd91e23)['json'](_0xc3aa5b);}};}function respondWithFilteredResult(_0x91cfe4,_0x2b2c7f){return function(_0x3c7441){if(_0x3c7441){var _0x166c0d=_0x3c7441['count'],_0x51ebf9=_0x2b2c7f['offset'],_0x562c9a=_0x2b2c7f[_0xbb9f('0x2b')]+_0x2b2c7f['limit'],_0xaff706;if(_0x562c9a>=_0x166c0d){_0x562c9a=_0x166c0d;_0xaff706=0xc8;}else{_0xaff706=0xce;}_0x91cfe4[_0xbb9f('0x2c')](_0xaff706);return _0x91cfe4[_0xbb9f('0x2d')]('Content-Range',_0x51ebf9+'-'+_0x562c9a+'/'+_0x166c0d)['json'](_0x3c7441);}return null;};}function patchUpdates(_0x14cbec){return function(_0x2df19e){try{jsonpatch[_0xbb9f('0x2e')](_0x2df19e,_0x14cbec,!![]);}catch(_0x435e98){return BPromise[_0xbb9f('0x2f')](_0x435e98);}return _0x2df19e[_0xbb9f('0x30')]();};}function saveUpdates(_0x40e20a,_0x4ae29f){return function(_0x30b03b){if(_0x30b03b){return _0x30b03b[_0xbb9f('0x31')](_0x40e20a)[_0xbb9f('0x20')](function(_0x5a6e29){return _0x5a6e29;});}return null;};}function removeEntity(_0x268e92,_0x5cf863){return function(_0x53d089){if(_0x53d089){return _0x53d089['destroy']()[_0xbb9f('0x20')](function(){_0x268e92[_0xbb9f('0x2c')](0xcc)[_0xbb9f('0x32')]();});}};}function handleEntityNotFound(_0x560ed8,_0x5d17fd){return function(_0x112d8a){if(!_0x112d8a){_0x560ed8[_0xbb9f('0x2a')](0x194);}return _0x112d8a;};}function handleError(_0x532ab6,_0x38dcea){_0x38dcea=_0x38dcea||0x1f4;return function(_0x10f405){logger[_0xbb9f('0x27')](_0x10f405['stack']);if(_0x10f405[_0xbb9f('0x33')]){delete _0x10f405[_0xbb9f('0x33')];}_0x532ab6[_0xbb9f('0x2c')](_0x38dcea)[_0xbb9f('0x34')](_0x10f405);};}exports[_0xbb9f('0x35')]=function(_0x1e90dc,_0x4502e4){var _0xa4e5d9={},_0x422a59={},_0x94b29a={'count':0x0,'rows':[]};var _0x1e2f1b=_[_0xbb9f('0x36')](db[_0xbb9f('0x37')][_0xbb9f('0x38')],function(_0xfe5458){return{'name':_0xfe5458[_0xbb9f('0x39')],'type':_0xfe5458[_0xbb9f('0x3a')][_0xbb9f('0x3b')]};});_0x422a59[_0xbb9f('0x3c')]=_[_0xbb9f('0x36')](_0x1e2f1b,_0xbb9f('0x33'));_0x422a59['query']=_[_0xbb9f('0x3d')](_0x1e90dc[_0xbb9f('0x3e')]);_0x422a59['filters']=_[_0xbb9f('0x3f')](_0x422a59[_0xbb9f('0x3c')],_0x422a59[_0xbb9f('0x3e')]);_0xa4e5d9[_0xbb9f('0x40')]=_[_0xbb9f('0x3f')](_0x422a59['model'],qs[_0xbb9f('0x41')](_0x1e90dc[_0xbb9f('0x3e')][_0xbb9f('0x41')]));_0xa4e5d9[_0xbb9f('0x40')]=_0xa4e5d9[_0xbb9f('0x40')][_0xbb9f('0x42')]?_0xa4e5d9[_0xbb9f('0x40')]:_0x422a59[_0xbb9f('0x3c')];if(!_0x1e90dc[_0xbb9f('0x3e')][_0xbb9f('0x43')](_0xbb9f('0x44'))){_0xa4e5d9[_0xbb9f('0x45')]=qs['limit'](_0x1e90dc[_0xbb9f('0x3e')][_0xbb9f('0x45')]);_0xa4e5d9[_0xbb9f('0x2b')]=qs[_0xbb9f('0x2b')](_0x1e90dc[_0xbb9f('0x3e')][_0xbb9f('0x2b')]);}_0xa4e5d9['order']=qs['sort'](_0x1e90dc['query'][_0xbb9f('0x46')]);_0xa4e5d9[_0xbb9f('0x47')]=qs[_0xbb9f('0x48')](_[_0xbb9f('0x49')](_0x1e90dc[_0xbb9f('0x3e')],_0x422a59['filters']),_0x1e2f1b);if(_0x1e90dc[_0xbb9f('0x3e')][_0xbb9f('0x4a')]){_0xa4e5d9['where']=_[_0xbb9f('0x4b')](_0xa4e5d9[_0xbb9f('0x47')],{'$or':_['map'](_0x1e2f1b,function(_0x2de62c){if(_0x2de62c['type']!==_0xbb9f('0x4c')){var _0x171600={};_0x171600[_0x2de62c[_0xbb9f('0x33')]]={'$like':'%'+_0x1e90dc['query']['filter']+'%'};return _0x171600;}})});}_0xa4e5d9=_[_0xbb9f('0x4b')]({},_0xa4e5d9,_0x1e90dc[_0xbb9f('0x4d')]);var _0x8ae572={'where':_0xa4e5d9[_0xbb9f('0x47')]};return db['ChatMessage']['count'](_0x8ae572)['then'](function(_0x296007){_0x94b29a[_0xbb9f('0x4e')]=_0x296007;if(_0x1e90dc['query'][_0xbb9f('0x4f')]){_0xa4e5d9[_0xbb9f('0x50')]=[{'all':!![]}];}return db[_0xbb9f('0x37')][_0xbb9f('0x51')](_0xa4e5d9);})[_0xbb9f('0x20')](function(_0x1f7989){_0x94b29a[_0xbb9f('0x52')]=_0x1f7989;return _0x94b29a;})['then'](respondWithFilteredResult(_0x4502e4,_0xa4e5d9))['catch'](handleError(_0x4502e4,null));};exports['show']=function(_0x261cd1,_0xd0f663){var _0x174c06={'raw':!![],'where':{'id':_0x261cd1[_0xbb9f('0x53')]['id']}},_0x31c1db={};_0x31c1db[_0xbb9f('0x3c')]=_[_0xbb9f('0x3d')](db[_0xbb9f('0x37')][_0xbb9f('0x38')]);_0x31c1db[_0xbb9f('0x3e')]=_['keys'](_0x261cd1[_0xbb9f('0x3e')]);_0x31c1db[_0xbb9f('0x48')]=_[_0xbb9f('0x3f')](_0x31c1db['model'],_0x31c1db['query']);_0x174c06[_0xbb9f('0x40')]=_[_0xbb9f('0x3f')](_0x31c1db[_0xbb9f('0x3c')],qs[_0xbb9f('0x41')](_0x261cd1[_0xbb9f('0x3e')][_0xbb9f('0x41')]));_0x174c06['attributes']=_0x174c06[_0xbb9f('0x40')]['length']?_0x174c06[_0xbb9f('0x40')]:_0x31c1db[_0xbb9f('0x3c')];if(_0x261cd1[_0xbb9f('0x3e')]['includeAll']){_0x174c06['include']=[{'all':!![]}];}_0x174c06=_[_0xbb9f('0x4b')]({},_0x174c06,_0x261cd1[_0xbb9f('0x4d')]);return db[_0xbb9f('0x37')][_0xbb9f('0x54')](_0x174c06)['then'](handleEntityNotFound(_0xd0f663,null))[_0xbb9f('0x20')](respondWithResult(_0xd0f663,null))['catch'](handleError(_0xd0f663,null));};exports[_0xbb9f('0x55')]=function(_0x202f35,_0x371ae5){return db['ChatMessage'][_0xbb9f('0x55')](_0x202f35['body'],{})[_0xbb9f('0x20')](respondWithResult(_0x371ae5,0xc9))[_0xbb9f('0x56')](handleError(_0x371ae5,null));};exports[_0xbb9f('0x31')]=function(_0x23b9a7,_0x11a185){if(_0x23b9a7['body']['id']){delete _0x23b9a7[_0xbb9f('0x57')]['id'];}return db['ChatMessage'][_0xbb9f('0x54')]({'where':{'id':_0x23b9a7['params']['id']}})[_0xbb9f('0x20')](handleEntityNotFound(_0x11a185,null))[_0xbb9f('0x20')](saveUpdates(_0x23b9a7[_0xbb9f('0x57')],null))['then'](respondWithResult(_0x11a185,null))[_0xbb9f('0x56')](handleError(_0x11a185,null));};exports['destroy']=function(_0x2c6262,_0x38799e){return db[_0xbb9f('0x37')][_0xbb9f('0x54')]({'where':{'id':_0x2c6262[_0xbb9f('0x53')]['id']}})['then'](handleEntityNotFound(_0x38799e,null))[_0xbb9f('0x20')](removeEntity(_0x38799e,null))[_0xbb9f('0x56')](handleError(_0x38799e,null));};exports['describe']=function(_0x619bc8,_0x3e4a12){return db[_0xbb9f('0x37')][_0xbb9f('0x58')]()['then'](respondWithResult(_0x3e4a12,null))['catch'](handleError(_0x3e4a12,null));};var interaction_log=require(_0xbb9f('0x59'))(_0xbb9f('0x5a'));exports[_0xbb9f('0x5b')]=function(_0x58585e,_0x5b71a3,_0x58fee5){var _0x1b1b72={'channel':'chat'};if(_0x58585e[_0xbb9f('0x57')]['id']){delete _0x58585e[_0xbb9f('0x57')]['id'];}_0x58585e[_0xbb9f('0x57')]['read']=!![];_0x58585e[_0xbb9f('0x57')]['readAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x58585e[_0xbb9f('0x57')][_0xbb9f('0x5c')]=_0x58585e[_0xbb9f('0x57')][_0xbb9f('0x5c')]||_0x58585e[_0xbb9f('0x5d')]['id'];return db[_0xbb9f('0x37')][_0xbb9f('0x54')]({'where':{'id':_0x58585e[_0xbb9f('0x53')]['id'],'UserId':null},'include':[{'model':db[_0xbb9f('0x5e')],'as':_0xbb9f('0x5f')}]})[_0xbb9f('0x20')](handleEntityNotFound(_0x5b71a3,null))[_0xbb9f('0x20')](saveUpdates(_0x58585e[_0xbb9f('0x57')],null))[_0xbb9f('0x20')](function(_0x38dce8){if(_0x38dce8){_0x1b1b72[_0xbb9f('0x29')]=_0x38dce8[_0xbb9f('0x60')]({'plain':!![]});return db[_0xbb9f('0x61')][_0xbb9f('0x54')]({'where':{'id':_0x38dce8[_0xbb9f('0x62')]}});}return null;})[_0xbb9f('0x20')](handleEntityNotFound(_0x5b71a3,null))[_0xbb9f('0x20')](function(_0x479c59){if(_0x479c59){return _0x479c59['update']({'UserId':_0x58585e[_0xbb9f('0x57')][_0xbb9f('0x5c')],'read1stAt':_[_0xbb9f('0x63')](_0x479c59[_0xbb9f('0x64')])?moment()[_0xbb9f('0x65')](_0xbb9f('0x66')):undefined});}return null;})[_0xbb9f('0x20')](function(_0x12cb0e){if(_0x12cb0e){_0x1b1b72[_0xbb9f('0x67')]=_0x12cb0e[_0xbb9f('0x60')]({'plain':!![]});interaction_log[_0xbb9f('0x21')](_0xbb9f('0x68'),_0x58585e['user']['id'],_0x58585e[_0xbb9f('0x5d')][_0xbb9f('0x33')],_0x58585e['user'][_0xbb9f('0x69')],_0x1b1b72[_0xbb9f('0x67')]['id'],_0x58585e['body']?JSON[_0xbb9f('0x26')](_0x58585e[_0xbb9f('0x57')]):_0xbb9f('0x6a'));return respondWithRpcPromise(_0xbb9f('0x6b'),_0xbb9f('0x6c'),_0x1b1b72);}return null;})[_0xbb9f('0x20')](function(_0x5327a4){if(_0x5327a4){if(_0x58585e[_0xbb9f('0x57')][_0xbb9f('0x6d')]){_0x1b1b72[_0xbb9f('0x29')][_0xbb9f('0x6e')]=util[_0xbb9f('0x65')](_0xbb9f('0x6f'),_0x58585e[_0xbb9f('0x5d')]['name']);_0x1b1b72[_0xbb9f('0x29')][_0xbb9f('0x70')]=_0x1b1b72[_0xbb9f('0x70')];_0x1b1b72[_0xbb9f('0x29')][_0xbb9f('0x71')]='accept';return respondWithRpcPromise(_0xbb9f('0x72'),'EventManager',{'event':_0xbb9f('0x73'),'message':_[_0xbb9f('0x4b')](_0x1b1b72[_0xbb9f('0x29')],JSON[_0xbb9f('0x74')](_0x1b1b72['interaction'][_0xbb9f('0x75')]))},client9002)[_0xbb9f('0x20')](function(){return _0x1b1b72;});}return _0x1b1b72;}return null;})[_0xbb9f('0x20')](respondWithResult(_0x5b71a3,null))[_0xbb9f('0x56')](handleError(_0x5b71a3,null));};var interaction_log=require(_0xbb9f('0x59'))('chat-interactions');exports[_0xbb9f('0x2f')]=function(_0x46b566,_0x3e03b0,_0x132cdf){var _0x304851={'agent':{},'channel':_0xbb9f('0x76')};if(_0x46b566[_0xbb9f('0x57')]['id']){delete _0x46b566[_0xbb9f('0x57')]['id'];}_0x46b566[_0xbb9f('0x57')]['UserId']=_0x46b566['body'][_0xbb9f('0x5c')]||_0x46b566[_0xbb9f('0x5d')]['id'];_0x304851[_0xbb9f('0x77')]['id']=_0x46b566[_0xbb9f('0x57')]['UserId'];return db['ChatMessage']['find']({'where':{'id':_0x46b566[_0xbb9f('0x53')]['id'],'UserId':null}})[_0xbb9f('0x20')](handleEntityNotFound(_0x3e03b0,null))[_0xbb9f('0x20')](function(_0x546755){if(_0x546755){_0x304851[_0xbb9f('0x29')]=_0x546755[_0xbb9f('0x60')]({'plain':!![]});return db['ChatInteraction'][_0xbb9f('0x54')]({'where':{'id':_0x546755['ChatInteractionId']}});}return null;})[_0xbb9f('0x20')](handleEntityNotFound(_0x3e03b0,null))['then'](function(_0x494cf1){if(_0x494cf1){_0x304851['interaction']=_0x494cf1[_0xbb9f('0x60')]({'plain':!![]});interaction_log['info']('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x46b566[_0xbb9f('0x5d')]['id'],_0x46b566[_0xbb9f('0x5d')][_0xbb9f('0x33')],_0x46b566[_0xbb9f('0x5d')][_0xbb9f('0x69')],_0x304851['interaction']['id'],_0x46b566[_0xbb9f('0x57')]?JSON[_0xbb9f('0x26')](_0x46b566['body']):_0xbb9f('0x6a'));return respondWithRpcPromise(_0xbb9f('0x78'),_0xbb9f('0x79'),_0x304851);}return null;})['then'](function(_0x1d8de6){if(_0x1d8de6){_0x1d8de6[_0xbb9f('0x29')][_0xbb9f('0x6e')]=util[_0xbb9f('0x65')](_0xbb9f('0x6f'),_0x46b566[_0xbb9f('0x5d')][_0xbb9f('0x33')]);_0x1d8de6['message'][_0xbb9f('0x70')]=_0x304851[_0xbb9f('0x70')];_0x1d8de6[_0xbb9f('0x29')][_0xbb9f('0x71')]=_0xbb9f('0x2f');respondWithRpcPromise(_0xbb9f('0x72'),'EventManager',{'event':_0xbb9f('0x7a'),'message':_0x1d8de6[_0xbb9f('0x29')]},client9002);return _0x304851;}return null;})[_0xbb9f('0x20')](respondWithResult(_0x3e03b0,null))['catch'](handleError(_0x3e03b0,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 5afc8c9..d5bfa45 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 _0xe775=['hook','exports','events','ChatMessage','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x386165,_0x19aae8){var _0x56fe83=function(_0x18983b){while(--_0x18983b){_0x386165['push'](_0x386165['shift']());}};_0x56fe83(++_0x19aae8);}(_0xe775,0x158));var _0x5e77=function(_0x1c5950,_0x49e128){_0x1c5950=_0x1c5950-0x0;var _0x2b720a=_0xe775[_0x1c5950];return _0x2b720a;};'use strict';var EventEmitter=require(_0x5e77('0x0'));var ChatMessage=require('../../mysqldb')['db'][_0x5e77('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x5e77('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x5e77('0x3'),'afterDestroy':_0x5e77('0x4')};function emitEvent(_0x19053d){return function(_0x2a3819,_0x541802,_0xd07968){ChatMessageEvents[_0x5e77('0x5')](_0x19053d+':'+_0x2a3819['id'],_0x2a3819);ChatMessageEvents[_0x5e77('0x5')](_0x19053d,_0x2a3819);_0xd07968(null);};}for(var e in events){if(events[_0x5e77('0x6')](e)){var event=events[e];ChatMessage[_0x5e77('0x7')](e,emitEvent(event));}}module[_0x5e77('0x8')]=ChatMessageEvents; \ No newline at end of file +var _0xd27d=['../../mysqldb','ChatMessage','setMaxListeners','remove','emit','exports','events'];(function(_0x1092f9,_0x55416d){var _0x54aedf=function(_0x3d0f44){while(--_0x3d0f44){_0x1092f9['push'](_0x1092f9['shift']());}};_0x54aedf(++_0x55416d);}(_0xd27d,0xb5));var _0xdd27=function(_0x3cb027,_0x1063a1){_0x3cb027=_0x3cb027-0x0;var _0x5004b7=_0xd27d[_0x3cb027];return _0x5004b7;};'use strict';var EventEmitter=require(_0xdd27('0x0'));var ChatMessage=require(_0xdd27('0x1'))['db'][_0xdd27('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xdd27('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xdd27('0x4')};function emitEvent(_0xd08b22){return function(_0x1d6edd,_0x547ee3,_0x450f0e){ChatMessageEvents[_0xdd27('0x5')](_0xd08b22+':'+_0x1d6edd['id'],_0x1d6edd);ChatMessageEvents[_0xdd27('0x5')](_0xd08b22,_0x1d6edd);_0x450f0e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage['hook'](e,emitEvent(event));}}module[_0xdd27('0x6')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index ba6629f..becca57 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 _0x89bc=['lodash','util','../../config/logger','moment','bluebird','path','rimraf','exports','define','ChatMessage','chat_messages','fti_chat_messages','body','FULLTEXT','get','direction','toLowerCase','out','isNil','UserId','ChatInteraction','findOne','then','update','createdAt','catch','error','utf8mb4_unicode_ci'];(function(_0x2b7764,_0x2606f1){var _0x848dcb=function(_0x1ae85b){while(--_0x1ae85b){_0x2b7764['push'](_0x2b7764['shift']());}};_0x848dcb(++_0x2606f1);}(_0x89bc,0xe0));var _0xc89b=function(_0xa5e821,_0x4dd2f6){_0xa5e821=_0xa5e821-0x0;var _0x62d0cd=_0x89bc[_0xa5e821];return _0x62d0cd;};'use strict';var _=require(_0xc89b('0x0'));var util=require(_0xc89b('0x1'));var logger=require(_0xc89b('0x2'))('api');var moment=require(_0xc89b('0x3'));var BPromise=require(_0xc89b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc89b('0x5'));var rimraf=require(_0xc89b('0x6'));var config=require('../../config/environment');var attributes=require('./chatMessage.attributes');module[_0xc89b('0x7')]=function(_0x1b7cde,_0x36c8a0){return _0x1b7cde[_0xc89b('0x8')](_0xc89b('0x9'),attributes,{'tableName':_0xc89b('0xa'),'paranoid':![],'indexes':[{'name':_0xc89b('0xb'),'fields':[_0xc89b('0xc')],'type':_0xc89b('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x288429,_0x5b28db,_0x27ad0a){var _0x265940=_0x1b7cde['models'];var _0x878313=_0x288429[_0xc89b('0xe')]({'plain':!![]});if(_0x878313[_0xc89b('0xf')][_0xc89b('0x10')]()==='in'||_0x878313['direction'][_0xc89b('0x10')]()===_0xc89b('0x11')&&!_0x878313['secret']&&!_[_0xc89b('0x12')](_0x878313[_0xc89b('0x13')])){_0x265940[_0xc89b('0x14')][_0xc89b('0x15')]({'where':{'id':_0x878313['ChatInteractionId']}})[_0xc89b('0x16')](function(_0x198104){if(_0x198104){_0x198104[_0xc89b('0x17')]({'lastMsgAt':_0x878313[_0xc89b('0x18')],'lastMsgDirection':_0x878313[_0xc89b('0xf')][_0xc89b('0x10')]()});}})[_0xc89b('0x19')](function(_0x4e2236){console[_0xc89b('0x1a')](_0x4e2236);});}_0x27ad0a();}},'charset':'utf8mb4','collate':_0xc89b('0x1b')});}; \ No newline at end of file +var _0x83f3=['fti_chat_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','ChatInteraction','ChatInteractionId','then','update','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','rimraf','./chatMessage.attributes','define','ChatMessage','chat_messages'];(function(_0x3d3896,_0x58f53f){var _0x425e70=function(_0x23a69a){while(--_0x23a69a){_0x3d3896['push'](_0x3d3896['shift']());}};_0x425e70(++_0x58f53f);}(_0x83f3,0x118));var _0x383f=function(_0x3cb8ac,_0x34bf3d){_0x3cb8ac=_0x3cb8ac-0x0;var _0x103d43=_0x83f3[_0x3cb8ac];return _0x103d43;};'use strict';var _=require(_0x383f('0x0'));var util=require(_0x383f('0x1'));var logger=require(_0x383f('0x2'))('api');var moment=require(_0x383f('0x3'));var BPromise=require(_0x383f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x383f('0x5'));var config=require('../../config/environment');var attributes=require(_0x383f('0x6'));module['exports']=function(_0x2ad480,_0x616225){return _0x2ad480[_0x383f('0x7')](_0x383f('0x8'),attributes,{'tableName':_0x383f('0x9'),'paranoid':![],'indexes':[{'name':_0x383f('0xa'),'fields':[_0x383f('0xb')],'type':_0x383f('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3480e8,_0xf0e0d2,_0x3bedd6){var _0x50df06=_0x2ad480[_0x383f('0xd')];var _0x50c8ed=_0x3480e8[_0x383f('0xe')]({'plain':!![]});if(_0x50c8ed[_0x383f('0xf')][_0x383f('0x10')]()==='in'||_0x50c8ed['direction'][_0x383f('0x10')]()===_0x383f('0x11')&&!_0x50c8ed[_0x383f('0x12')]&&!_[_0x383f('0x13')](_0x50c8ed[_0x383f('0x14')])){_0x50df06[_0x383f('0x15')]['findOne']({'where':{'id':_0x50c8ed[_0x383f('0x16')]}})[_0x383f('0x17')](function(_0x3a03c5){if(_0x3a03c5){_0x3a03c5[_0x383f('0x18')]({'lastMsgAt':_0x50c8ed['createdAt'],'lastMsgDirection':_0x50c8ed[_0x383f('0xf')]['toLowerCase']()});}})[_0x383f('0x19')](function(_0x46d020){console[_0x383f('0x1a')](_0x46d020);});}_0x3bedd6();}},'charset':_0x383f('0x1b'),'collate':_0x383f('0x1c')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 0e125fd..8601771 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 _0x900a=['info','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ChatMessage,\x20%s,\x20%s','message','result','catch','CreateChatMessage','create','body','options','raw','debug','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','request','then'];(function(_0x5f12fd,_0x33c70d){var _0x58bd80=function(_0x515f56){while(--_0x515f56){_0x5f12fd['push'](_0x5f12fd['shift']());}};_0x58bd80(++_0x33c70d);}(_0x900a,0x1ec));var _0xa900=function(_0x9f528a,_0x5b1bc8){_0x9f528a=_0x9f528a-0x0;var _0x273be7=_0x900a[_0x9f528a];return _0x273be7;};'use strict';var _=require('lodash');var util=require(_0xa900('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa900('0x1'));var fs=require('fs');var Redis=require(_0xa900('0x2'));var db=require(_0xa900('0x3'))['db'];var utils=require(_0xa900('0x4'));var logger=require(_0xa900('0x5'))(_0xa900('0x6'));var config=require(_0xa900('0x7'));var jayson=require(_0xa900('0x8'));var client=jayson['client'][_0xa900('0x9')]({'port':0x232a});config[_0xa900('0xa')]=_[_0xa900('0xb')](config[_0xa900('0xa')],{'host':_0xa900('0xc'),'port':0x18eb});var socket=require(_0xa900('0xd'))(new Redis(config[_0xa900('0xa')]));require(_0xa900('0xe'))[_0xa900('0xf')](socket);function respondWithRpcPromise(_0x50b813,_0x12b4cb,_0x3ab44a){return new BPromise(function(_0x246d19,_0x399fbe){return client[_0xa900('0x10')](_0x50b813,_0x3ab44a)[_0xa900('0x11')](function(_0x5d9313){logger[_0xa900('0x12')]('ChatMessage,\x20%s,\x20%s',_0x12b4cb,'request\x20sent');logger['debug'](_0xa900('0x13'),_0x12b4cb,_0xa900('0x14'),JSON[_0xa900('0x15')](_0x5d9313));if(_0x5d9313[_0xa900('0x16')]){if(_0x5d9313['error'][_0xa900('0x17')]===0x1f4){logger[_0xa900('0x16')](_0xa900('0x18'),_0x12b4cb,_0x5d9313[_0xa900('0x16')][_0xa900('0x19')]);return _0x399fbe(_0x5d9313[_0xa900('0x16')][_0xa900('0x19')]);}logger[_0xa900('0x16')](_0xa900('0x18'),_0x12b4cb,_0x5d9313[_0xa900('0x16')]['message']);return _0x246d19(_0x5d9313[_0xa900('0x16')]['message']);}else{logger['info'](_0xa900('0x18'),_0x12b4cb,_0xa900('0x14'));_0x246d19(_0x5d9313[_0xa900('0x1a')][_0xa900('0x19')]);}})[_0xa900('0x1b')](function(_0x4b5642){logger[_0xa900('0x16')](_0xa900('0x18'),_0x12b4cb,_0x4b5642);_0x399fbe(_0x4b5642);});});}exports[_0xa900('0x1c')]=function(_0x3961c7){var _0xd0ad41=this;return new Promise(function(_0x36fcca,_0x21db21){return db['ChatMessage'][_0xa900('0x1d')](_0x3961c7[_0xa900('0x1e')],{'raw':_0x3961c7[_0xa900('0x1f')]?_0x3961c7[_0xa900('0x1f')][_0xa900('0x20')]===undefined?!![]:![]:!![]})[_0xa900('0x11')](function(_0x2b56df){logger[_0xa900('0x12')](_0xa900('0x1c'),_0x3961c7);logger[_0xa900('0x21')](_0xa900('0x1c'),_0x3961c7,JSON[_0xa900('0x15')](_0x2b56df));_0x36fcca(_0x2b56df);})[_0xa900('0x1b')](function(_0x1e0ee){logger[_0xa900('0x16')](_0xa900('0x1c'),_0x1e0ee[_0xa900('0x19')],_0x3961c7);_0x21db21(_0xd0ad41[_0xa900('0x16')](0x1f4,_0x1e0ee[_0xa900('0x19')]));});});}; \ No newline at end of file +var _0xe1f1=['ChatMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreateChatMessage','ChatMessage','create','body','options','raw','lodash','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','request','then','info'];(function(_0x583a7a,_0x4c8def){var _0x514434=function(_0x5eaf68){while(--_0x5eaf68){_0x583a7a['push'](_0x583a7a['shift']());}};_0x514434(++_0x4c8def);}(_0xe1f1,0x1bc));var _0x1e1f=function(_0x485543,_0x3e0a59){_0x485543=_0x485543-0x0;var _0xaf68a4=_0xe1f1[_0x485543];return _0xaf68a4;};'use strict';var _=require(_0x1e1f('0x0'));var util=require('util');var moment=require(_0x1e1f('0x1'));var BPromise=require('bluebird');var rs=require(_0x1e1f('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x1e1f('0x3'));var logger=require(_0x1e1f('0x4'))(_0x1e1f('0x5'));var config=require(_0x1e1f('0x6'));var jayson=require(_0x1e1f('0x7'));var client=jayson['client'][_0x1e1f('0x8')]({'port':0x232a});config[_0x1e1f('0x9')]=_[_0x1e1f('0xa')](config[_0x1e1f('0x9')],{'host':_0x1e1f('0xb'),'port':0x18eb});var socket=require(_0x1e1f('0xc'))(new Redis(config[_0x1e1f('0x9')]));require(_0x1e1f('0xd'))[_0x1e1f('0xe')](socket);function respondWithRpcPromise(_0x3c36fa,_0x4f01ab,_0x342373){return new BPromise(function(_0x3a0fef,_0x337bfe){return client[_0x1e1f('0xf')](_0x3c36fa,_0x342373)[_0x1e1f('0x10')](function(_0x465b3){logger[_0x1e1f('0x11')](_0x1e1f('0x12'),_0x4f01ab,_0x1e1f('0x13'));logger[_0x1e1f('0x14')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x4f01ab,'request\x20sent',JSON[_0x1e1f('0x15')](_0x465b3));if(_0x465b3[_0x1e1f('0x16')]){if(_0x465b3[_0x1e1f('0x16')][_0x1e1f('0x17')]===0x1f4){logger[_0x1e1f('0x16')](_0x1e1f('0x12'),_0x4f01ab,_0x465b3[_0x1e1f('0x16')][_0x1e1f('0x18')]);return _0x337bfe(_0x465b3[_0x1e1f('0x16')][_0x1e1f('0x18')]);}logger[_0x1e1f('0x16')](_0x1e1f('0x12'),_0x4f01ab,_0x465b3[_0x1e1f('0x16')][_0x1e1f('0x18')]);return _0x3a0fef(_0x465b3['error'][_0x1e1f('0x18')]);}else{logger[_0x1e1f('0x11')](_0x1e1f('0x12'),_0x4f01ab,_0x1e1f('0x13'));_0x3a0fef(_0x465b3[_0x1e1f('0x19')][_0x1e1f('0x18')]);}})[_0x1e1f('0x1a')](function(_0x4b583c){logger['error']('ChatMessage,\x20%s,\x20%s',_0x4f01ab,_0x4b583c);_0x337bfe(_0x4b583c);});});}exports[_0x1e1f('0x1b')]=function(_0x1e7be6){var _0x50e0d1=this;return new Promise(function(_0x17c81e,_0x16eb55){return db[_0x1e1f('0x1c')][_0x1e1f('0x1d')](_0x1e7be6[_0x1e1f('0x1e')],{'raw':_0x1e7be6[_0x1e1f('0x1f')]?_0x1e7be6[_0x1e1f('0x1f')][_0x1e1f('0x20')]===undefined?!![]:![]:!![]})['then'](function(_0x2a3654){logger[_0x1e1f('0x11')](_0x1e1f('0x1b'),_0x1e7be6);logger['debug'](_0x1e1f('0x1b'),_0x1e7be6,JSON[_0x1e1f('0x15')](_0x2a3654));_0x17c81e(_0x2a3654);})[_0x1e1f('0x1a')](function(_0x523e84){logger[_0x1e1f('0x16')](_0x1e1f('0x1b'),_0x523e84[_0x1e1f('0x18')],_0x1e7be6);_0x16eb55(_0x50e0d1[_0x1e1f('0x16')](0x1f4,_0x523e84['message']));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 0d6390a..d77c210 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 _0x7880=['register','length','save','remove','update','removeListener'];(function(_0x2cd4a7,_0x49a857){var _0x58462d=function(_0x12f62d){while(--_0x12f62d){_0x2cd4a7['push'](_0x2cd4a7['shift']());}};_0x58462d(++_0x49a857);}(_0x7880,0x1f4));var _0x0788=function(_0x2126c7,_0x5cd37f){_0x2126c7=_0x2126c7-0x0;var _0x2d91f4=_0x7880[_0x2126c7];return _0x2d91f4;};'use strict';var ChatMessageEvents=require('./chatMessage.events');var events=[_0x0788('0x0'),_0x0788('0x1'),_0x0788('0x2')];function createListener(_0x1b196a,_0x47dc20){return function(_0x446ded){_0x47dc20['emit'](_0x1b196a,_0x446ded);};}function removeListener(_0x3925a6,_0x1e0814){return function(){ChatMessageEvents[_0x0788('0x3')](_0x3925a6,_0x1e0814);};}exports[_0x0788('0x4')]=function(_0x262f5c){for(var _0x775629=0x0,_0x3f9cb8=events[_0x0788('0x5')];_0x775629<_0x3f9cb8;_0x775629++){var _0x3c29f3=events[_0x775629];var _0x422f8b=createListener('chatMessage:'+_0x3c29f3,_0x262f5c);ChatMessageEvents['on'](_0x3c29f3,_0x422f8b);}}; \ No newline at end of file +var _0x4975=['length','./chatMessage.events','remove','update','emit','removeListener','register'];(function(_0x7add50,_0x184296){var _0x58d21d=function(_0x384e52){while(--_0x384e52){_0x7add50['push'](_0x7add50['shift']());}};_0x58d21d(++_0x184296);}(_0x4975,0x86));var _0x5497=function(_0x26f320,_0x5a07f6){_0x26f320=_0x26f320-0x0;var _0x1a3ceb=_0x4975[_0x26f320];return _0x1a3ceb;};'use strict';var ChatMessageEvents=require(_0x5497('0x0'));var events=['save',_0x5497('0x1'),_0x5497('0x2')];function createListener(_0xfc7927,_0x349f5f){return function(_0x135f6f){_0x349f5f[_0x5497('0x3')](_0xfc7927,_0x135f6f);};}function removeListener(_0x14cecb,_0xeb31af){return function(){ChatMessageEvents[_0x5497('0x4')](_0x14cecb,_0xeb31af);};}exports[_0x5497('0x5')]=function(_0x539a27){for(var _0x37e48d=0x0,_0x4f563d=events[_0x5497('0x6')];_0x37e48d<_0x4f563d;_0x37e48d++){var _0x674a2a=events[_0x37e48d];var _0x368e8b=createListener('chatMessage:'+_0x674a2a,_0x539a27);ChatMessageEvents['on'](_0x674a2a,_0x368e8b);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 84b093e..a7cf823 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 _0x2483=['reject','delete','exports','multer','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/describe','isAuthenticated','describe','/:id','show','post','tracked','chat','chatmessage:create','create','update','put','/:id/accept','accept','/:id/reject'];(function(_0x354634,_0x5beaed){var _0x386114=function(_0x3a12f2){while(--_0x3a12f2){_0x354634['push'](_0x354634['shift']());}};_0x386114(++_0x5beaed);}(_0x2483,0xb2));var _0x3248=function(_0x4b6512,_0x5c076e){_0x4b6512=_0x4b6512-0x0;var _0x36dc78=_0x2483[_0x4b6512];return _0x36dc78;};'use strict';var multer=require(_0x3248('0x0'));var util=require('util');var path=require(_0x3248('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x3248('0x2')]();var auth=require(_0x3248('0x3'));var interaction=require(_0x3248('0x4'));var config=require(_0x3248('0x5'));var controller=require('./chatMessage.controller');router[_0x3248('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x3248('0x6')](_0x3248('0x7'),auth[_0x3248('0x8')](),controller[_0x3248('0x9')]);router[_0x3248('0x6')](_0x3248('0xa'),auth[_0x3248('0x8')](),controller[_0x3248('0xb')]);router[_0x3248('0xc')]('/',auth[_0x3248('0x8')](),interaction[_0x3248('0xd')](_0x3248('0xe'),_0x3248('0xf')),controller[_0x3248('0x10')]);router['put'](_0x3248('0xa'),controller[_0x3248('0x11')]);router[_0x3248('0x12')](_0x3248('0x13'),auth[_0x3248('0x8')](),controller[_0x3248('0x14')]);router['put'](_0x3248('0x15'),auth[_0x3248('0x8')](),controller[_0x3248('0x16')]);router[_0x3248('0x17')]('/:id',auth[_0x3248('0x8')](),controller['destroy']);module[_0x3248('0x18')]=router; \ No newline at end of file +var _0xe29a=['describe','/:id','show','post','tracked','chatmessage:create','create','put','update','/:id/accept','accept','/:id/reject','reject','destroy','multer','util','connect-timeout','Router','../../components/interaction/service','get','isAuthenticated'];(function(_0x4fd378,_0x2ec43a){var _0x34e272=function(_0x1c4d5a){while(--_0x1c4d5a){_0x4fd378['push'](_0x4fd378['shift']());}};_0x34e272(++_0x2ec43a);}(_0xe29a,0x1c7));var _0xae29=function(_0x10b114,_0x3ded79){_0x10b114=_0x10b114-0x0;var _0x3f3bb5=_0xe29a[_0x10b114];return _0x3f3bb5;};'use strict';var multer=require(_0xae29('0x0'));var util=require(_0xae29('0x1'));var path=require('path');var timeout=require(_0xae29('0x2'));var express=require('express');var router=express[_0xae29('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xae29('0x4'));var config=require('../../config/environment');var controller=require('./chatMessage.controller');router[_0xae29('0x5')]('/',auth[_0xae29('0x6')](),controller['index']);router['get']('/describe',auth['isAuthenticated'](),controller[_0xae29('0x7')]);router[_0xae29('0x5')](_0xae29('0x8'),auth[_0xae29('0x6')](),controller[_0xae29('0x9')]);router[_0xae29('0xa')]('/',auth[_0xae29('0x6')](),interaction[_0xae29('0xb')]('chat',_0xae29('0xc')),controller[_0xae29('0xd')]);router[_0xae29('0xe')](_0xae29('0x8'),controller[_0xae29('0xf')]);router['put'](_0xae29('0x10'),auth['isAuthenticated'](),controller[_0xae29('0x11')]);router[_0xae29('0xe')](_0xae29('0x12'),auth['isAuthenticated'](),controller[_0xae29('0x13')]);router['delete'](_0xae29('0x8'),auth[_0xae29('0x6')](),controller[_0xae29('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 4533ccb..e08917a 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 _0x86d9=['TEXT','medium'];(function(_0x1b30cb,_0x3c9692){var _0x1e0cc5=function(_0x52b205){while(--_0x52b205){_0x1b30cb['push'](_0x1b30cb['shift']());}};_0x1e0cc5(++_0x3c9692);}(_0x86d9,0xa8));var _0x986d=function(_0xba6a4a,_0xc8d9be){_0xba6a4a=_0xba6a4a-0x0;var _0x443d50=_0x86d9[_0xba6a4a];return _0x443d50;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0x986d('0x0')](_0x986d('0x1')),'allowNull':![]}}; \ No newline at end of file +var _0x92bd=['TEXT','sequelize','exports'];(function(_0x298223,_0x25be5f){var _0x3655c4=function(_0x523274){while(--_0x523274){_0x298223['push'](_0x298223['shift']());}};_0x3655c4(++_0x25be5f);}(_0x92bd,0x13f));var _0xd92b=function(_0x57cd61,_0x573d4d){_0x57cd61=_0x57cd61-0x0;var _0x318e68=_0x92bd[_0x57cd61];return _0x318e68;};'use strict';var Sequelize=require(_0xd92b('0x0'));module[_0xd92b('0x1')]={'body':{'type':Sequelize[_0xd92b('0x2')]('medium'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index 653d580..4b41689 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 _0xd101=['name','send','index','ChatOfflineMessage','fieldName','key','model','map','query','keys','intersection','attributes','fields','length','nolimit','order','sort','pick','filters','filter','where','type','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','rawAttributes','find','create','body','destroy','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','update','then','error'];(function(_0x1389e8,_0x971f55){var _0x114191=function(_0x54304e){while(--_0x54304e){_0x1389e8['push'](_0x1389e8['shift']());}};_0x114191(++_0x971f55);}(_0xd101,0xc1));var _0x1d10=function(_0xbf4b27,_0x1d08d3){_0xbf4b27=_0xbf4b27-0x0;var _0x46c7df=_0xd101[_0xbf4b27];return _0x46c7df;};'use strict';var pdf=require(_0x1d10('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x1d10('0x1'));var zipdir=require(_0x1d10('0x2'));var jsonpatch=require(_0x1d10('0x3'));var rp=require(_0x1d10('0x4'));var moment=require(_0x1d10('0x5'));var BPromise=require(_0x1d10('0x6'));var Mustache=require(_0x1d10('0x7'));var util=require(_0x1d10('0x8'));var path=require('path');var sox=require(_0x1d10('0x9'));var csv=require(_0x1d10('0xa'));var ejs=require(_0x1d10('0xb'));var fs=require('fs');var _=require(_0x1d10('0xc'));var squel=require(_0x1d10('0xd'));var crypto=require(_0x1d10('0xe'));var jsforce=require(_0x1d10('0xf'));var deskjs=require(_0x1d10('0x10'));var toCsv=require(_0x1d10('0xa'));var querystring=require(_0x1d10('0x11'));var Papa=require(_0x1d10('0x12'));var Redis=require(_0x1d10('0x13'));var authService=require(_0x1d10('0x14'));var qs=require(_0x1d10('0x15'));var as=require(_0x1d10('0x16'));var hardwareService=require(_0x1d10('0x17'));var logger=require(_0x1d10('0x18'))('api');var utils=require(_0x1d10('0x19'));var config=require(_0x1d10('0x1a'));var db=require(_0x1d10('0x1b'))['db'];function respondWithStatusCode(_0x190d4c,_0x268506){_0x268506=_0x268506||0xcc;return function(_0x5b71d8){if(_0x5b71d8){return _0x190d4c[_0x1d10('0x1c')](_0x268506);}return _0x190d4c[_0x1d10('0x1d')](_0x268506)[_0x1d10('0x1e')]();};}function respondWithResult(_0x2b7c35,_0x2224ff){_0x2224ff=_0x2224ff||0xc8;return function(_0x183bc4){if(_0x183bc4){return _0x2b7c35['status'](_0x2224ff)[_0x1d10('0x1f')](_0x183bc4);}};}function respondWithFilteredResult(_0x556f27,_0x306953){return function(_0x2ad3c0){if(_0x2ad3c0){var _0x4f014a=_0x2ad3c0[_0x1d10('0x20')],_0x3aedf7=_0x306953[_0x1d10('0x21')],_0x3fe555=_0x306953[_0x1d10('0x21')]+_0x306953[_0x1d10('0x22')],_0x41152c;if(_0x3fe555>=_0x4f014a){_0x3fe555=_0x4f014a;_0x41152c=0xc8;}else{_0x41152c=0xce;}_0x556f27['status'](_0x41152c);return _0x556f27[_0x1d10('0x23')](_0x1d10('0x24'),_0x3aedf7+'-'+_0x3fe555+'/'+_0x4f014a)[_0x1d10('0x1f')](_0x2ad3c0);}return null;};}function patchUpdates(_0xd4a7ca){return function(_0x42e1a8){try{jsonpatch['apply'](_0x42e1a8,_0xd4a7ca,!![]);}catch(_0x47d4e2){return BPromise[_0x1d10('0x25')](_0x47d4e2);}return _0x42e1a8['save']();};}function saveUpdates(_0x4b94db,_0x5774f9){return function(_0x237b92){if(_0x237b92){return _0x237b92[_0x1d10('0x26')](_0x4b94db)[_0x1d10('0x27')](function(_0x250395){return _0x250395;});}return null;};}function removeEntity(_0x4ce84a,_0x5e5315){return function(_0x140147){if(_0x140147){return _0x140147['destroy']()[_0x1d10('0x27')](function(){_0x4ce84a[_0x1d10('0x1d')](0xcc)[_0x1d10('0x1e')]();});}};}function handleEntityNotFound(_0x37f22d,_0x127b37){return function(_0x3601ba){if(!_0x3601ba){_0x37f22d[_0x1d10('0x1c')](0x194);}return _0x3601ba;};}function handleError(_0x3af06d,_0x4168e){_0x4168e=_0x4168e||0x1f4;return function(_0x84055f){logger[_0x1d10('0x28')](_0x84055f['stack']);if(_0x84055f[_0x1d10('0x29')]){delete _0x84055f[_0x1d10('0x29')];}_0x3af06d[_0x1d10('0x1d')](_0x4168e)[_0x1d10('0x2a')](_0x84055f);};}exports[_0x1d10('0x2b')]=function(_0x3bffbe,_0x38f583){var _0xaa8ab6={},_0x4f7837={},_0x355e10={'count':0x0,'rows':[]};var _0x24eb47=_['map'](db[_0x1d10('0x2c')]['rawAttributes'],function(_0x4db221){return{'name':_0x4db221[_0x1d10('0x2d')],'type':_0x4db221['type'][_0x1d10('0x2e')]};});_0x4f7837[_0x1d10('0x2f')]=_[_0x1d10('0x30')](_0x24eb47,_0x1d10('0x29'));_0x4f7837[_0x1d10('0x31')]=_[_0x1d10('0x32')](_0x3bffbe['query']);_0x4f7837['filters']=_[_0x1d10('0x33')](_0x4f7837[_0x1d10('0x2f')],_0x4f7837[_0x1d10('0x31')]);_0xaa8ab6[_0x1d10('0x34')]=_[_0x1d10('0x33')](_0x4f7837[_0x1d10('0x2f')],qs[_0x1d10('0x35')](_0x3bffbe[_0x1d10('0x31')][_0x1d10('0x35')]));_0xaa8ab6[_0x1d10('0x34')]=_0xaa8ab6['attributes'][_0x1d10('0x36')]?_0xaa8ab6['attributes']:_0x4f7837[_0x1d10('0x2f')];if(!_0x3bffbe[_0x1d10('0x31')]['hasOwnProperty'](_0x1d10('0x37'))){_0xaa8ab6['limit']=qs[_0x1d10('0x22')](_0x3bffbe[_0x1d10('0x31')][_0x1d10('0x22')]);_0xaa8ab6[_0x1d10('0x21')]=qs[_0x1d10('0x21')](_0x3bffbe['query']['offset']);}_0xaa8ab6[_0x1d10('0x38')]=qs[_0x1d10('0x39')](_0x3bffbe[_0x1d10('0x31')]['sort']);_0xaa8ab6['where']=qs['filters'](_[_0x1d10('0x3a')](_0x3bffbe['query'],_0x4f7837[_0x1d10('0x3b')]),_0x24eb47);if(_0x3bffbe[_0x1d10('0x31')][_0x1d10('0x3c')]){_0xaa8ab6[_0x1d10('0x3d')]=_['merge'](_0xaa8ab6['where'],{'$or':_[_0x1d10('0x30')](_0x24eb47,function(_0x13049a){if(_0x13049a[_0x1d10('0x3e')]!==_0x1d10('0x3f')){var _0x549e83={};_0x549e83[_0x13049a[_0x1d10('0x29')]]={'$like':'%'+_0x3bffbe['query'][_0x1d10('0x3c')]+'%'};return _0x549e83;}})});}_0xaa8ab6=_[_0x1d10('0x40')]({},_0xaa8ab6,_0x3bffbe[_0x1d10('0x41')]);var _0x8d8405={'where':_0xaa8ab6[_0x1d10('0x3d')]};return db[_0x1d10('0x2c')][_0x1d10('0x20')](_0x8d8405)[_0x1d10('0x27')](function(_0x1a5126){_0x355e10[_0x1d10('0x20')]=_0x1a5126;if(_0x3bffbe[_0x1d10('0x31')][_0x1d10('0x42')]){_0xaa8ab6[_0x1d10('0x43')]=[{'all':!![]}];}return db['ChatOfflineMessage']['findAll'](_0xaa8ab6);})[_0x1d10('0x27')](function(_0x3267c5){_0x355e10[_0x1d10('0x44')]=_0x3267c5;return _0x355e10;})[_0x1d10('0x27')](respondWithFilteredResult(_0x38f583,_0xaa8ab6))[_0x1d10('0x45')](handleError(_0x38f583,null));};exports[_0x1d10('0x46')]=function(_0x1ab775,_0x4ebd4a){var _0x1a67e9={'raw':!![],'where':{'id':_0x1ab775[_0x1d10('0x47')]['id']}},_0xf1fc47={};_0xf1fc47['model']=_[_0x1d10('0x32')](db[_0x1d10('0x2c')][_0x1d10('0x48')]);_0xf1fc47['query']=_['keys'](_0x1ab775[_0x1d10('0x31')]);_0xf1fc47[_0x1d10('0x3b')]=_[_0x1d10('0x33')](_0xf1fc47[_0x1d10('0x2f')],_0xf1fc47[_0x1d10('0x31')]);_0x1a67e9[_0x1d10('0x34')]=_[_0x1d10('0x33')](_0xf1fc47['model'],qs[_0x1d10('0x35')](_0x1ab775[_0x1d10('0x31')]['fields']));_0x1a67e9[_0x1d10('0x34')]=_0x1a67e9['attributes'][_0x1d10('0x36')]?_0x1a67e9['attributes']:_0xf1fc47['model'];if(_0x1ab775[_0x1d10('0x31')][_0x1d10('0x42')]){_0x1a67e9[_0x1d10('0x43')]=[{'all':!![]}];}_0x1a67e9=_[_0x1d10('0x40')]({},_0x1a67e9,_0x1ab775[_0x1d10('0x41')]);return db[_0x1d10('0x2c')][_0x1d10('0x49')](_0x1a67e9)[_0x1d10('0x27')](handleEntityNotFound(_0x4ebd4a,null))[_0x1d10('0x27')](respondWithResult(_0x4ebd4a,null))['catch'](handleError(_0x4ebd4a,null));};exports['create']=function(_0x1ce4e9,_0x38bcba){return db[_0x1d10('0x2c')][_0x1d10('0x4a')](_0x1ce4e9[_0x1d10('0x4b')],{})[_0x1d10('0x27')](respondWithResult(_0x38bcba,0xc9))['catch'](handleError(_0x38bcba,null));};exports[_0x1d10('0x26')]=function(_0x1b8513,_0x304342){if(_0x1b8513[_0x1d10('0x4b')]['id']){delete _0x1b8513[_0x1d10('0x4b')]['id'];}return db[_0x1d10('0x2c')][_0x1d10('0x49')]({'where':{'id':_0x1b8513[_0x1d10('0x47')]['id']}})[_0x1d10('0x27')](handleEntityNotFound(_0x304342,null))[_0x1d10('0x27')](saveUpdates(_0x1b8513[_0x1d10('0x4b')],null))[_0x1d10('0x27')](respondWithResult(_0x304342,null))[_0x1d10('0x45')](handleError(_0x304342,null));};exports[_0x1d10('0x4c')]=function(_0x5ebe57,_0x560b6f){return db[_0x1d10('0x2c')]['find']({'where':{'id':_0x5ebe57['params']['id']}})[_0x1d10('0x27')](handleEntityNotFound(_0x560b6f,null))[_0x1d10('0x27')](removeEntity(_0x560b6f,null))[_0x1d10('0x45')](handleError(_0x560b6f,null));};exports[_0x1d10('0x4d')]=function(_0x2f9542,_0x5a9250){return db['ChatOfflineMessage']['describe']()['then'](respondWithResult(_0x5a9250,null))[_0x1d10('0x45')](handleError(_0x5a9250,null));}; \ No newline at end of file +var _0xc7a3=['destroy','then','sendStatus','error','name','send','index','map','ChatOfflineMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','rows','catch','show','params','fields','includeAll','include','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update'];(function(_0x2d2885,_0x667d70){var _0x2cea6=function(_0x407056){while(--_0x407056){_0x2d2885['push'](_0x2d2885['shift']());}};_0x2cea6(++_0x667d70);}(_0xc7a3,0xbd));var _0x3c7a=function(_0x484704,_0x35c6c4){_0x484704=_0x484704-0x0;var _0x5efce3=_0xc7a3[_0x484704];return _0x5efce3;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x3c7a('0x0'));var rimraf=require(_0x3c7a('0x1'));var zipdir=require(_0x3c7a('0x2'));var jsonpatch=require(_0x3c7a('0x3'));var rp=require(_0x3c7a('0x4'));var moment=require(_0x3c7a('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x3c7a('0x6'));var util=require(_0x3c7a('0x7'));var path=require('path');var sox=require(_0x3c7a('0x8'));var csv=require(_0x3c7a('0x9'));var ejs=require(_0x3c7a('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x3c7a('0xb'));var crypto=require('crypto');var jsforce=require(_0x3c7a('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x3c7a('0x9'));var querystring=require(_0x3c7a('0xd'));var Papa=require(_0x3c7a('0xe'));var Redis=require('ioredis');var authService=require(_0x3c7a('0xf'));var qs=require(_0x3c7a('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3c7a('0x11'));var logger=require('../../config/logger')(_0x3c7a('0x12'));var utils=require('../../config/utils');var config=require(_0x3c7a('0x13'));var db=require(_0x3c7a('0x14'))['db'];function respondWithStatusCode(_0x2fa3a3,_0x16ea63){_0x16ea63=_0x16ea63||0xcc;return function(_0x3d47c3){if(_0x3d47c3){return _0x2fa3a3['sendStatus'](_0x16ea63);}return _0x2fa3a3[_0x3c7a('0x15')](_0x16ea63)[_0x3c7a('0x16')]();};}function respondWithResult(_0x4103db,_0x36185c){_0x36185c=_0x36185c||0xc8;return function(_0x24d188){if(_0x24d188){return _0x4103db['status'](_0x36185c)[_0x3c7a('0x17')](_0x24d188);}};}function respondWithFilteredResult(_0x2fc645,_0x5af0a6){return function(_0x539270){if(_0x539270){var _0x3044e6=_0x539270[_0x3c7a('0x18')],_0xb9201c=_0x5af0a6['offset'],_0x687077=_0x5af0a6[_0x3c7a('0x19')]+_0x5af0a6[_0x3c7a('0x1a')],_0x4d7a8c;if(_0x687077>=_0x3044e6){_0x687077=_0x3044e6;_0x4d7a8c=0xc8;}else{_0x4d7a8c=0xce;}_0x2fc645[_0x3c7a('0x15')](_0x4d7a8c);return _0x2fc645[_0x3c7a('0x1b')](_0x3c7a('0x1c'),_0xb9201c+'-'+_0x687077+'/'+_0x3044e6)[_0x3c7a('0x17')](_0x539270);}return null;};}function patchUpdates(_0x5975de){return function(_0x1a11ef){try{jsonpatch[_0x3c7a('0x1d')](_0x1a11ef,_0x5975de,!![]);}catch(_0x3f0024){return BPromise[_0x3c7a('0x1e')](_0x3f0024);}return _0x1a11ef[_0x3c7a('0x1f')]();};}function saveUpdates(_0x320730,_0x11a06b){return function(_0x34f4a6){if(_0x34f4a6){return _0x34f4a6[_0x3c7a('0x20')](_0x320730)['then'](function(_0x354800){return _0x354800;});}return null;};}function removeEntity(_0x518097,_0x3c75ff){return function(_0x557518){if(_0x557518){return _0x557518[_0x3c7a('0x21')]()[_0x3c7a('0x22')](function(){_0x518097[_0x3c7a('0x15')](0xcc)[_0x3c7a('0x16')]();});}};}function handleEntityNotFound(_0x283568,_0x245dde){return function(_0x8251d4){if(!_0x8251d4){_0x283568[_0x3c7a('0x23')](0x194);}return _0x8251d4;};}function handleError(_0x193d48,_0x42bcbe){_0x42bcbe=_0x42bcbe||0x1f4;return function(_0x2cc413){logger[_0x3c7a('0x24')](_0x2cc413['stack']);if(_0x2cc413[_0x3c7a('0x25')]){delete _0x2cc413[_0x3c7a('0x25')];}_0x193d48[_0x3c7a('0x15')](_0x42bcbe)[_0x3c7a('0x26')](_0x2cc413);};}exports[_0x3c7a('0x27')]=function(_0x1940bb,_0x2c000f){var _0x8f084b={},_0x5bbcde={},_0x33b72d={'count':0x0,'rows':[]};var _0xb1b1c7=_[_0x3c7a('0x28')](db[_0x3c7a('0x29')][_0x3c7a('0x2a')],function(_0x1a96a0){return{'name':_0x1a96a0[_0x3c7a('0x2b')],'type':_0x1a96a0[_0x3c7a('0x2c')][_0x3c7a('0x2d')]};});_0x5bbcde[_0x3c7a('0x2e')]=_[_0x3c7a('0x28')](_0xb1b1c7,_0x3c7a('0x25'));_0x5bbcde[_0x3c7a('0x2f')]=_[_0x3c7a('0x30')](_0x1940bb[_0x3c7a('0x2f')]);_0x5bbcde[_0x3c7a('0x31')]=_[_0x3c7a('0x32')](_0x5bbcde[_0x3c7a('0x2e')],_0x5bbcde[_0x3c7a('0x2f')]);_0x8f084b[_0x3c7a('0x33')]=_[_0x3c7a('0x32')](_0x5bbcde[_0x3c7a('0x2e')],qs['fields'](_0x1940bb['query']['fields']));_0x8f084b['attributes']=_0x8f084b[_0x3c7a('0x33')][_0x3c7a('0x34')]?_0x8f084b[_0x3c7a('0x33')]:_0x5bbcde[_0x3c7a('0x2e')];if(!_0x1940bb[_0x3c7a('0x2f')][_0x3c7a('0x35')](_0x3c7a('0x36'))){_0x8f084b[_0x3c7a('0x1a')]=qs[_0x3c7a('0x1a')](_0x1940bb[_0x3c7a('0x2f')][_0x3c7a('0x1a')]);_0x8f084b[_0x3c7a('0x19')]=qs[_0x3c7a('0x19')](_0x1940bb[_0x3c7a('0x2f')]['offset']);}_0x8f084b[_0x3c7a('0x37')]=qs[_0x3c7a('0x38')](_0x1940bb['query'][_0x3c7a('0x38')]);_0x8f084b['where']=qs[_0x3c7a('0x31')](_[_0x3c7a('0x39')](_0x1940bb['query'],_0x5bbcde[_0x3c7a('0x31')]),_0xb1b1c7);if(_0x1940bb[_0x3c7a('0x2f')][_0x3c7a('0x3a')]){_0x8f084b[_0x3c7a('0x3b')]=_[_0x3c7a('0x3c')](_0x8f084b[_0x3c7a('0x3b')],{'$or':_[_0x3c7a('0x28')](_0xb1b1c7,function(_0x28ca76){if(_0x28ca76[_0x3c7a('0x2c')]!==_0x3c7a('0x3d')){var _0x5b6537={};_0x5b6537[_0x28ca76[_0x3c7a('0x25')]]={'$like':'%'+_0x1940bb[_0x3c7a('0x2f')][_0x3c7a('0x3a')]+'%'};return _0x5b6537;}})});}_0x8f084b=_[_0x3c7a('0x3c')]({},_0x8f084b,_0x1940bb[_0x3c7a('0x3e')]);var _0x44da91={'where':_0x8f084b[_0x3c7a('0x3b')]};return db[_0x3c7a('0x29')]['count'](_0x44da91)[_0x3c7a('0x22')](function(_0x7d8093){_0x33b72d['count']=_0x7d8093;if(_0x1940bb[_0x3c7a('0x2f')]['includeAll']){_0x8f084b['include']=[{'all':!![]}];}return db['ChatOfflineMessage']['findAll'](_0x8f084b);})[_0x3c7a('0x22')](function(_0x2b845a){_0x33b72d[_0x3c7a('0x3f')]=_0x2b845a;return _0x33b72d;})['then'](respondWithFilteredResult(_0x2c000f,_0x8f084b))[_0x3c7a('0x40')](handleError(_0x2c000f,null));};exports[_0x3c7a('0x41')]=function(_0x5239a1,_0x5e3238){var _0x491335={'raw':!![],'where':{'id':_0x5239a1[_0x3c7a('0x42')]['id']}},_0x2a68d5={};_0x2a68d5[_0x3c7a('0x2e')]=_[_0x3c7a('0x30')](db[_0x3c7a('0x29')][_0x3c7a('0x2a')]);_0x2a68d5[_0x3c7a('0x2f')]=_[_0x3c7a('0x30')](_0x5239a1[_0x3c7a('0x2f')]);_0x2a68d5[_0x3c7a('0x31')]=_[_0x3c7a('0x32')](_0x2a68d5[_0x3c7a('0x2e')],_0x2a68d5[_0x3c7a('0x2f')]);_0x491335[_0x3c7a('0x33')]=_[_0x3c7a('0x32')](_0x2a68d5['model'],qs[_0x3c7a('0x43')](_0x5239a1[_0x3c7a('0x2f')]['fields']));_0x491335['attributes']=_0x491335['attributes'][_0x3c7a('0x34')]?_0x491335[_0x3c7a('0x33')]:_0x2a68d5[_0x3c7a('0x2e')];if(_0x5239a1[_0x3c7a('0x2f')][_0x3c7a('0x44')]){_0x491335[_0x3c7a('0x45')]=[{'all':!![]}];}_0x491335=_[_0x3c7a('0x3c')]({},_0x491335,_0x5239a1[_0x3c7a('0x3e')]);return db[_0x3c7a('0x29')][_0x3c7a('0x46')](_0x491335)[_0x3c7a('0x22')](handleEntityNotFound(_0x5e3238,null))['then'](respondWithResult(_0x5e3238,null))['catch'](handleError(_0x5e3238,null));};exports['create']=function(_0x30942a,_0x323a4d){return db[_0x3c7a('0x29')][_0x3c7a('0x47')](_0x30942a[_0x3c7a('0x48')],{})['then'](respondWithResult(_0x323a4d,0xc9))[_0x3c7a('0x40')](handleError(_0x323a4d,null));};exports[_0x3c7a('0x20')]=function(_0x2eb9e2,_0x15e4cd){if(_0x2eb9e2[_0x3c7a('0x48')]['id']){delete _0x2eb9e2[_0x3c7a('0x48')]['id'];}return db[_0x3c7a('0x29')]['find']({'where':{'id':_0x2eb9e2['params']['id']}})[_0x3c7a('0x22')](handleEntityNotFound(_0x15e4cd,null))[_0x3c7a('0x22')](saveUpdates(_0x2eb9e2[_0x3c7a('0x48')],null))[_0x3c7a('0x22')](respondWithResult(_0x15e4cd,null))[_0x3c7a('0x40')](handleError(_0x15e4cd,null));};exports[_0x3c7a('0x21')]=function(_0x4bc0c8,_0x22fbd0){return db['ChatOfflineMessage']['find']({'where':{'id':_0x4bc0c8[_0x3c7a('0x42')]['id']}})[_0x3c7a('0x22')](handleEntityNotFound(_0x22fbd0,null))[_0x3c7a('0x22')](removeEntity(_0x22fbd0,null))['catch'](handleError(_0x22fbd0,null));};exports['describe']=function(_0x4ba11a,_0x5b940d){return db[_0x3c7a('0x29')][_0x3c7a('0x49')]()[_0x3c7a('0x22')](respondWithResult(_0x5b940d,null))[_0x3c7a('0x40')](handleError(_0x5b940d,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index a17c05a..9fb487c 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 _0x207c=['bluebird','request-promise','path','../../config/environment','define','ChatOfflineMessage','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment'];(function(_0x5382dd,_0x2b4157){var _0x55758e=function(_0x206b7d){while(--_0x206b7d){_0x5382dd['push'](_0x5382dd['shift']());}};_0x55758e(++_0x2b4157);}(_0x207c,0x1e8));var _0xc207=function(_0x5759e0,_0x31984b){_0x5759e0=_0x5759e0-0x0;var _0x1a64cd=_0x207c[_0x5759e0];return _0x1a64cd;};'use strict';var _=require('lodash');var util=require(_0xc207('0x0'));var logger=require(_0xc207('0x1'))(_0xc207('0x2'));var moment=require(_0xc207('0x3'));var BPromise=require(_0xc207('0x4'));var rp=require(_0xc207('0x5'));var fs=require('fs');var path=require(_0xc207('0x6'));var rimraf=require('rimraf');var config=require(_0xc207('0x7'));var attributes=require('./chatOfflineMessage.attributes');module['exports']=function(_0x55023e,_0xc88789){return _0x55023e[_0xc207('0x8')](_0xc207('0x9'),attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc207('0xa'),'collate':_0xc207('0xb')});}; \ No newline at end of file +var _0x5ad3=['utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./chatOfflineMessage.attributes','exports','define','chat_offline_messages'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5ad3,0x1e2));var _0x35ad=function(_0x3b5bca,_0x326805){_0x3b5bca=_0x3b5bca-0x0;var _0x39833=_0x5ad3[_0x3b5bca];return _0x39833;};'use strict';var _=require(_0x35ad('0x0'));var util=require(_0x35ad('0x1'));var logger=require(_0x35ad('0x2'))(_0x35ad('0x3'));var moment=require('moment');var BPromise=require(_0x35ad('0x4'));var rp=require(_0x35ad('0x5'));var fs=require('fs');var path=require(_0x35ad('0x6'));var rimraf=require(_0x35ad('0x7'));var config=require(_0x35ad('0x8'));var attributes=require(_0x35ad('0x9'));module[_0x35ad('0xa')]=function(_0x436dcb,_0x36c606){return _0x436dcb[_0x35ad('0xb')]('ChatOfflineMessage',attributes,{'tableName':_0x35ad('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x35ad('0xd'),'collate':_0x35ad('0xe')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 32daa1e..65b28ce 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 _0x5f54=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch'];(function(_0x22f061,_0x2604c2){var _0x3b3ec9=function(_0x296cd4){while(--_0x296cd4){_0x22f061['push'](_0x22f061['shift']());}};_0x3b3ec9(++_0x2604c2);}(_0x5f54,0xe7));var _0x45f5=function(_0x580bab,_0x319f08){_0x580bab=_0x580bab-0x0;var _0x53e7e7=_0x5f54[_0x580bab];return _0x53e7e7;};'use strict';var _=require(_0x45f5('0x0'));var util=require(_0x45f5('0x1'));var moment=require(_0x45f5('0x2'));var BPromise=require(_0x45f5('0x3'));var rs=require(_0x45f5('0x4'));var fs=require('fs');var Redis=require(_0x45f5('0x5'));var db=require(_0x45f5('0x6'))['db'];var utils=require(_0x45f5('0x7'));var logger=require(_0x45f5('0x8'))(_0x45f5('0x9'));var config=require('../../config/environment');var jayson=require(_0x45f5('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2e69af,_0x503332,_0x6819b9){return new BPromise(function(_0x56daf7,_0x31a223){return client['request'](_0x2e69af,_0x6819b9)[_0x45f5('0xb')](function(_0x3efac5){logger[_0x45f5('0xc')](_0x45f5('0xd'),_0x503332,_0x45f5('0xe'));logger['debug'](_0x45f5('0xf'),_0x503332,'request\x20sent',JSON['stringify'](_0x3efac5));if(_0x3efac5[_0x45f5('0x10')]){if(_0x3efac5[_0x45f5('0x10')][_0x45f5('0x11')]===0x1f4){logger[_0x45f5('0x10')](_0x45f5('0xd'),_0x503332,_0x3efac5['error']['message']);return _0x31a223(_0x3efac5[_0x45f5('0x10')][_0x45f5('0x12')]);}logger['error']('ChatOfflineMessage,\x20%s,\x20%s',_0x503332,_0x3efac5[_0x45f5('0x10')][_0x45f5('0x12')]);return _0x56daf7(_0x3efac5[_0x45f5('0x10')][_0x45f5('0x12')]);}else{logger['info']('ChatOfflineMessage,\x20%s,\x20%s',_0x503332,_0x45f5('0xe'));_0x56daf7(_0x3efac5[_0x45f5('0x13')][_0x45f5('0x12')]);}})[_0x45f5('0x14')](function(_0x4fd50f){logger['error'](_0x45f5('0xd'),_0x503332,_0x4fd50f);_0x31a223(_0x4fd50f);});});} \ No newline at end of file +var _0x3830=['lodash','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ChatOfflineMessage,\x20%s,\x20%s','message','catch'];(function(_0x972a8e,_0x5ef65e){var _0x2f6d99=function(_0x54131){while(--_0x54131){_0x972a8e['push'](_0x972a8e['shift']());}};_0x2f6d99(++_0x5ef65e);}(_0x3830,0x154));var _0x0383=function(_0x24ae93,_0x364bd5){_0x24ae93=_0x24ae93-0x0;var _0x2fc1f3=_0x3830[_0x24ae93];return _0x2fc1f3;};'use strict';var _=require(_0x0383('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x0383('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0383('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x0383('0x3'))(_0x0383('0x4'));var config=require(_0x0383('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x0383('0x6')][_0x0383('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x321200,_0x103d14,_0x10cea8){return new BPromise(function(_0x1cdf71,_0x47d094){return client[_0x0383('0x8')](_0x321200,_0x10cea8)[_0x0383('0x9')](function(_0x303195){logger[_0x0383('0xa')]('ChatOfflineMessage,\x20%s,\x20%s',_0x103d14,'request\x20sent');logger[_0x0383('0xb')](_0x0383('0xc'),_0x103d14,_0x0383('0xd'),JSON[_0x0383('0xe')](_0x303195));if(_0x303195[_0x0383('0xf')]){if(_0x303195['error'][_0x0383('0x10')]===0x1f4){logger[_0x0383('0xf')](_0x0383('0x11'),_0x103d14,_0x303195['error'][_0x0383('0x12')]);return _0x47d094(_0x303195[_0x0383('0xf')][_0x0383('0x12')]);}logger[_0x0383('0xf')](_0x0383('0x11'),_0x103d14,_0x303195[_0x0383('0xf')][_0x0383('0x12')]);return _0x1cdf71(_0x303195['error']['message']);}else{logger['info'](_0x0383('0x11'),_0x103d14,_0x0383('0xd'));_0x1cdf71(_0x303195['result'][_0x0383('0x12')]);}})[_0x0383('0x13')](function(_0x244e8a){logger[_0x0383('0xf')]('ChatOfflineMessage,\x20%s,\x20%s',_0x103d14,_0x244e8a);_0x47d094(_0x244e8a);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 4a9a091..187694a 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 _0x2476=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','put','update','delete','destroy','exports','multer','util'];(function(_0x535e90,_0x52d9d7){var _0x2cb1ac=function(_0x36fc69){while(--_0x36fc69){_0x535e90['push'](_0x535e90['shift']());}};_0x2cb1ac(++_0x52d9d7);}(_0x2476,0x1a2));var _0x6247=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2476[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x6247('0x0'));var util=require(_0x6247('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x6247('0x2'));var router=express[_0x6247('0x3')]();var auth=require(_0x6247('0x4'));var interaction=require(_0x6247('0x5'));var config=require(_0x6247('0x6'));var controller=require(_0x6247('0x7'));router[_0x6247('0x8')]('/',auth[_0x6247('0x9')](),controller[_0x6247('0xa')]);router[_0x6247('0x8')](_0x6247('0xb'),auth['isAuthenticated'](),controller[_0x6247('0xc')]);router[_0x6247('0x8')](_0x6247('0xd'),auth[_0x6247('0x9')](),controller['show']);router[_0x6247('0xe')]('/',auth[_0x6247('0x9')](),controller[_0x6247('0xf')]);router[_0x6247('0x10')](_0x6247('0xd'),auth['isAuthenticated'](),controller[_0x6247('0x11')]);router[_0x6247('0x12')]('/:id',auth[_0x6247('0x9')](),controller[_0x6247('0x13')]);module[_0x6247('0x14')]=router; \ No newline at end of file +var _0x9338=['index','get','/describe','describe','/:id','show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./chatOfflineMessage.controller','isAuthenticated'];(function(_0x23fd8c,_0x29d523){var _0x501d32=function(_0x5cef5e){while(--_0x5cef5e){_0x23fd8c['push'](_0x23fd8c['shift']());}};_0x501d32(++_0x29d523);}(_0x9338,0x147));var _0x8933=function(_0xfcc030,_0x3ec053){_0xfcc030=_0xfcc030-0x0;var _0x5caa66=_0x9338[_0xfcc030];return _0x5caa66;};'use strict';var multer=require(_0x8933('0x0'));var util=require(_0x8933('0x1'));var path=require(_0x8933('0x2'));var timeout=require(_0x8933('0x3'));var express=require('express');var router=express[_0x8933('0x4')]();var auth=require(_0x8933('0x5'));var interaction=require(_0x8933('0x6'));var config=require('../../config/environment');var controller=require(_0x8933('0x7'));router['get']('/',auth[_0x8933('0x8')](),controller[_0x8933('0x9')]);router[_0x8933('0xa')](_0x8933('0xb'),auth[_0x8933('0x8')](),controller[_0x8933('0xc')]);router['get'](_0x8933('0xd'),auth[_0x8933('0x8')](),controller[_0x8933('0xe')]);router[_0x8933('0xf')]('/',auth[_0x8933('0x8')](),controller[_0x8933('0x10')]);router['put'](_0x8933('0xd'),auth[_0x8933('0x8')](),controller[_0x8933('0x11')]);router[_0x8933('0x12')](_0x8933('0xd'),auth[_0x8933('0x8')](),controller[_0x8933('0x13')]);module[_0x8933('0x14')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 1c1525a..6882fb8 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 _0x2050=['exports','STRING','ENUM','mouseOver','timeout','INTEGER','sequelize'];(function(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0x2050,0x180));var _0x0205=function(_0x32560c,_0x1bc9ee){_0x32560c=_0x32560c-0x0;var _0x4f2c2c=_0x2050[_0x32560c];return _0x4f2c2c;};'use strict';var Sequelize=require(_0x0205('0x0'));module[_0x0205('0x1')]={'name':{'type':Sequelize[_0x0205('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x0205('0x3')](_0x0205('0x4'),_0x0205('0x5')),'defaultValue':_0x0205('0x4')},'selector':{'type':Sequelize[_0x0205('0x2')]},'timeout':{'type':Sequelize[_0x0205('0x6')]}}; \ No newline at end of file +var _0x6144=['STRING','sequelize','exports','mouseOver','timeout'];(function(_0x7f2e6b,_0x591729){var _0x143790=function(_0x356889){while(--_0x356889){_0x7f2e6b['push'](_0x7f2e6b['shift']());}};_0x143790(++_0x591729);}(_0x6144,0xf6));var _0x4614=function(_0x92ad46,_0x4b48c7){_0x92ad46=_0x92ad46-0x0;var _0x5df85c=_0x6144[_0x92ad46];return _0x5df85c;};'use strict';var Sequelize=require(_0x4614('0x0'));module[_0x4614('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x4614('0x2'),_0x4614('0x3')),'defaultValue':_0x4614('0x2')},'selector':{'type':Sequelize[_0x4614('0x4')]},'timeout':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 62ded95..ffa58d0 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 _0xcb91=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','apply','reject','save','then','destroy','sendStatus','error','stack','name','send','params','model','keys','ChatProactiveAction','rawAttributes','query','intersection','attributes','length','includeAll','merge','options','find','catch','create','body','update','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','lodash','crypto','jsforce','to-csv','ioredis','../../components/auth/service'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x313c96,_0x3cee6e){_0x313c96=_0x313c96-0x0;var _0x522f53=_0xcb91[_0x313c96];return _0x522f53;};'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 db=require(_0x1cb9('0x15'))['db'];function respondWithStatusCode(_0x46af58,_0x5445e1){_0x5445e1=_0x5445e1||0xcc;return function(_0x5e3c19){if(_0x5e3c19){return _0x46af58['sendStatus'](_0x5445e1);}return _0x46af58[_0x1cb9('0x16')](_0x5445e1)[_0x1cb9('0x17')]();};}function respondWithResult(_0x384496,_0x1c714f){_0x1c714f=_0x1c714f||0xc8;return function(_0x56884d){if(_0x56884d){return _0x384496[_0x1cb9('0x16')](_0x1c714f)[_0x1cb9('0x18')](_0x56884d);}};}function respondWithFilteredResult(_0x1b3cd7,_0x8dfa55){return function(_0x3e2d11){if(_0x3e2d11){var _0x5806d8=_0x3e2d11[_0x1cb9('0x19')],_0x5572cb=_0x8dfa55[_0x1cb9('0x1a')],_0xd446a3=_0x8dfa55[_0x1cb9('0x1a')]+_0x8dfa55[_0x1cb9('0x1b')],_0x3cc765;if(_0xd446a3>=_0x5806d8){_0xd446a3=_0x5806d8;_0x3cc765=0xc8;}else{_0x3cc765=0xce;}_0x1b3cd7[_0x1cb9('0x16')](_0x3cc765);return _0x1b3cd7['set']('Content-Range',_0x5572cb+'-'+_0xd446a3+'/'+_0x5806d8)[_0x1cb9('0x18')](_0x3e2d11);}return null;};}function patchUpdates(_0x41ac41){return function(_0x2b2669){try{jsonpatch[_0x1cb9('0x1c')](_0x2b2669,_0x41ac41,!![]);}catch(_0x280a84){return BPromise[_0x1cb9('0x1d')](_0x280a84);}return _0x2b2669[_0x1cb9('0x1e')]();};}function saveUpdates(_0x4ac422,_0x559bcc){return function(_0x1a5a72){if(_0x1a5a72){return _0x1a5a72['update'](_0x4ac422)[_0x1cb9('0x1f')](function(_0x2265ea){return _0x2265ea;});}return null;};}function removeEntity(_0x523b26,_0x599275){return function(_0x2e3854){if(_0x2e3854){return _0x2e3854[_0x1cb9('0x20')]()[_0x1cb9('0x1f')](function(){_0x523b26[_0x1cb9('0x16')](0xcc)[_0x1cb9('0x17')]();});}};}function handleEntityNotFound(_0x27db16,_0x59ebea){return function(_0x55b232){if(!_0x55b232){_0x27db16[_0x1cb9('0x21')](0x194);}return _0x55b232;};}function handleError(_0x557199,_0x10a419){_0x10a419=_0x10a419||0x1f4;return function(_0x2b1275){logger[_0x1cb9('0x22')](_0x2b1275[_0x1cb9('0x23')]);if(_0x2b1275[_0x1cb9('0x24')]){delete _0x2b1275['name'];}_0x557199[_0x1cb9('0x16')](_0x10a419)[_0x1cb9('0x25')](_0x2b1275);};}exports['show']=function(_0xd6891c,_0x21effa){var _0x41a9a0={'raw':!![],'where':{'id':_0xd6891c[_0x1cb9('0x26')]['id']}},_0x1804fd={};_0x1804fd[_0x1cb9('0x27')]=_[_0x1cb9('0x28')](db[_0x1cb9('0x29')][_0x1cb9('0x2a')]);_0x1804fd[_0x1cb9('0x2b')]=_['keys'](_0xd6891c[_0x1cb9('0x2b')]);_0x1804fd['filters']=_[_0x1cb9('0x2c')](_0x1804fd['model'],_0x1804fd[_0x1cb9('0x2b')]);_0x41a9a0[_0x1cb9('0x2d')]=_[_0x1cb9('0x2c')](_0x1804fd[_0x1cb9('0x27')],qs['fields'](_0xd6891c[_0x1cb9('0x2b')]['fields']));_0x41a9a0[_0x1cb9('0x2d')]=_0x41a9a0[_0x1cb9('0x2d')][_0x1cb9('0x2e')]?_0x41a9a0['attributes']:_0x1804fd[_0x1cb9('0x27')];if(_0xd6891c['query'][_0x1cb9('0x2f')]){_0x41a9a0['include']=[{'all':!![]}];}_0x41a9a0=_[_0x1cb9('0x30')]({},_0x41a9a0,_0xd6891c[_0x1cb9('0x31')]);return db[_0x1cb9('0x29')][_0x1cb9('0x32')](_0x41a9a0)['then'](handleEntityNotFound(_0x21effa,null))[_0x1cb9('0x1f')](respondWithResult(_0x21effa,null))[_0x1cb9('0x33')](handleError(_0x21effa,null));};exports[_0x1cb9('0x34')]=function(_0x91a1db,_0xc6784c){return db[_0x1cb9('0x29')][_0x1cb9('0x34')](_0x91a1db[_0x1cb9('0x35')],{})[_0x1cb9('0x1f')](respondWithResult(_0xc6784c,0xc9))[_0x1cb9('0x33')](handleError(_0xc6784c,null));};exports[_0x1cb9('0x36')]=function(_0x26b950,_0x29f149){if(_0x26b950['body']['id']){delete _0x26b950['body']['id'];}return db[_0x1cb9('0x29')][_0x1cb9('0x32')]({'where':{'id':_0x26b950[_0x1cb9('0x26')]['id']}})[_0x1cb9('0x1f')](handleEntityNotFound(_0x29f149,null))[_0x1cb9('0x1f')](saveUpdates(_0x26b950[_0x1cb9('0x35')],null))[_0x1cb9('0x1f')](respondWithResult(_0x29f149,null))[_0x1cb9('0x33')](handleError(_0x29f149,null));};exports['destroy']=function(_0x2aa59b,_0x1482c4){return db[_0x1cb9('0x29')]['find']({'where':{'id':_0x2aa59b[_0x1cb9('0x26')]['id']}})['then'](handleEntityNotFound(_0x1482c4,null))[_0x1cb9('0x1f')](removeEntity(_0x1482c4,null))['catch'](handleError(_0x1482c4,null));}; \ No newline at end of file +var _0xd8b0=['eml-format','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','show','params','keys','rawAttributes','filters','model','attributes','intersection','length','query','includeAll','include','merge','options','ChatProactiveAction','find','catch','create','body','html-pdf'];(function(_0x457711,_0x1b38fd){var _0x23befb=function(_0x24130e){while(--_0x24130e){_0x457711['push'](_0x457711['shift']());}};_0x23befb(++_0x1b38fd);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var pdf=require(_0x0d8b('0x0'));var emlformat=require(_0x0d8b('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0d8b('0x2'));var moment=require(_0x0d8b('0x3'));var BPromise=require(_0x0d8b('0x4'));var Mustache=require(_0x0d8b('0x5'));var util=require(_0x0d8b('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x0d8b('0x7'));var ejs=require(_0x0d8b('0x8'));var fs=require('fs');var _=require(_0x0d8b('0x9'));var squel=require('squel');var crypto=require(_0x0d8b('0xa'));var jsforce=require(_0x0d8b('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x0d8b('0x7'));var querystring=require(_0x0d8b('0xc'));var Papa=require(_0x0d8b('0xd'));var Redis=require(_0x0d8b('0xe'));var authService=require(_0x0d8b('0xf'));var qs=require(_0x0d8b('0x10'));var as=require(_0x0d8b('0x11'));var hardwareService=require(_0x0d8b('0x12'));var logger=require('../../config/logger')(_0x0d8b('0x13'));var utils=require('../../config/utils');var config=require(_0x0d8b('0x14'));var db=require(_0x0d8b('0x15'))['db'];function respondWithStatusCode(_0x340cc4,_0x92cdd8){_0x92cdd8=_0x92cdd8||0xcc;return function(_0x35a07b){if(_0x35a07b){return _0x340cc4[_0x0d8b('0x16')](_0x92cdd8);}return _0x340cc4[_0x0d8b('0x17')](_0x92cdd8)[_0x0d8b('0x18')]();};}function respondWithResult(_0x1d4bbc,_0x2ce75e){_0x2ce75e=_0x2ce75e||0xc8;return function(_0x5ad086){if(_0x5ad086){return _0x1d4bbc[_0x0d8b('0x17')](_0x2ce75e)[_0x0d8b('0x19')](_0x5ad086);}};}function respondWithFilteredResult(_0x2d4e1c,_0x4f6f21){return function(_0x23eb7b){if(_0x23eb7b){var _0xa86349=_0x23eb7b['count'],_0x17f7df=_0x4f6f21[_0x0d8b('0x1a')],_0xe2e167=_0x4f6f21[_0x0d8b('0x1a')]+_0x4f6f21[_0x0d8b('0x1b')],_0x2cb03c;if(_0xe2e167>=_0xa86349){_0xe2e167=_0xa86349;_0x2cb03c=0xc8;}else{_0x2cb03c=0xce;}_0x2d4e1c[_0x0d8b('0x17')](_0x2cb03c);return _0x2d4e1c[_0x0d8b('0x1c')](_0x0d8b('0x1d'),_0x17f7df+'-'+_0xe2e167+'/'+_0xa86349)[_0x0d8b('0x19')](_0x23eb7b);}return null;};}function patchUpdates(_0xa3612a){return function(_0x4a15bf){try{jsonpatch[_0x0d8b('0x1e')](_0x4a15bf,_0xa3612a,!![]);}catch(_0x23d58f){return BPromise[_0x0d8b('0x1f')](_0x23d58f);}return _0x4a15bf[_0x0d8b('0x20')]();};}function saveUpdates(_0x24e8ed,_0x5b709c){return function(_0x393beb){if(_0x393beb){return _0x393beb[_0x0d8b('0x21')](_0x24e8ed)['then'](function(_0x4f0a1a){return _0x4f0a1a;});}return null;};}function removeEntity(_0x33fb87,_0x54a9a7){return function(_0x56c729){if(_0x56c729){return _0x56c729['destroy']()[_0x0d8b('0x22')](function(){_0x33fb87[_0x0d8b('0x17')](0xcc)[_0x0d8b('0x18')]();});}};}function handleEntityNotFound(_0x38efc8,_0x221071){return function(_0x2c64e2){if(!_0x2c64e2){_0x38efc8[_0x0d8b('0x16')](0x194);}return _0x2c64e2;};}function handleError(_0x4562cb,_0x27b695){_0x27b695=_0x27b695||0x1f4;return function(_0x5e5bc3){logger[_0x0d8b('0x23')](_0x5e5bc3[_0x0d8b('0x24')]);if(_0x5e5bc3['name']){delete _0x5e5bc3[_0x0d8b('0x25')];}_0x4562cb['status'](_0x27b695)[_0x0d8b('0x26')](_0x5e5bc3);};}exports[_0x0d8b('0x27')]=function(_0xa2af02,_0x4fe6f9){var _0x59a905={'raw':!![],'where':{'id':_0xa2af02[_0x0d8b('0x28')]['id']}},_0x28f639={};_0x28f639['model']=_[_0x0d8b('0x29')](db['ChatProactiveAction'][_0x0d8b('0x2a')]);_0x28f639['query']=_[_0x0d8b('0x29')](_0xa2af02['query']);_0x28f639[_0x0d8b('0x2b')]=_['intersection'](_0x28f639[_0x0d8b('0x2c')],_0x28f639['query']);_0x59a905[_0x0d8b('0x2d')]=_[_0x0d8b('0x2e')](_0x28f639[_0x0d8b('0x2c')],qs['fields'](_0xa2af02['query']['fields']));_0x59a905[_0x0d8b('0x2d')]=_0x59a905['attributes'][_0x0d8b('0x2f')]?_0x59a905['attributes']:_0x28f639['model'];if(_0xa2af02[_0x0d8b('0x30')][_0x0d8b('0x31')]){_0x59a905[_0x0d8b('0x32')]=[{'all':!![]}];}_0x59a905=_[_0x0d8b('0x33')]({},_0x59a905,_0xa2af02[_0x0d8b('0x34')]);return db[_0x0d8b('0x35')][_0x0d8b('0x36')](_0x59a905)[_0x0d8b('0x22')](handleEntityNotFound(_0x4fe6f9,null))['then'](respondWithResult(_0x4fe6f9,null))[_0x0d8b('0x37')](handleError(_0x4fe6f9,null));};exports[_0x0d8b('0x38')]=function(_0x4b3ea0,_0xb18586){return db[_0x0d8b('0x35')][_0x0d8b('0x38')](_0x4b3ea0['body'],{})[_0x0d8b('0x22')](respondWithResult(_0xb18586,0xc9))[_0x0d8b('0x37')](handleError(_0xb18586,null));};exports[_0x0d8b('0x21')]=function(_0x31ceba,_0x933e01){if(_0x31ceba['body']['id']){delete _0x31ceba[_0x0d8b('0x39')]['id'];}return db[_0x0d8b('0x35')]['find']({'where':{'id':_0x31ceba[_0x0d8b('0x28')]['id']}})[_0x0d8b('0x22')](handleEntityNotFound(_0x933e01,null))[_0x0d8b('0x22')](saveUpdates(_0x31ceba[_0x0d8b('0x39')],null))[_0x0d8b('0x22')](respondWithResult(_0x933e01,null))['catch'](handleError(_0x933e01,null));};exports['destroy']=function(_0x41b4f9,_0x5c2c04){return db['ChatProactiveAction'][_0x0d8b('0x36')]({'where':{'id':_0x41b4f9[_0x0d8b('0x28')]['id']}})[_0x0d8b('0x22')](handleEntityNotFound(_0x5c2c04,null))[_0x0d8b('0x22')](removeEntity(_0x5c2c04,null))[_0x0d8b('0x37')](handleError(_0x5c2c04,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 5617129..16a5f72 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 _0x293b=['exports','define','ChatProactiveAction','chat_proactive_actions','lodash','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./chatProactiveAction.attributes'];(function(_0x143368,_0x5d0b64){var _0x44c10a=function(_0x30c90c){while(--_0x30c90c){_0x143368['push'](_0x143368['shift']());}};_0x44c10a(++_0x5d0b64);}(_0x293b,0x1b4));var _0xb293=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x293b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xb293('0x0'));var util=require('util');var logger=require(_0xb293('0x1'))(_0xb293('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb293('0x3'));var fs=require('fs');var path=require(_0xb293('0x4'));var rimraf=require(_0xb293('0x5'));var config=require(_0xb293('0x6'));var attributes=require(_0xb293('0x7'));module[_0xb293('0x8')]=function(_0x428202,_0x2ab585){return _0x428202[_0xb293('0x9')](_0xb293('0xa'),attributes,{'tableName':_0xb293('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7cc9=['lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatProactiveAction.attributes','exports','define','ChatProactiveAction','chat_proactive_actions'];(function(_0x272c63,_0x27f7bd){var _0x4bf81d=function(_0x3b1986){while(--_0x3b1986){_0x272c63['push'](_0x272c63['shift']());}};_0x4bf81d(++_0x27f7bd);}(_0x7cc9,0xea));var _0x97cc=function(_0x23c3f4,_0x24f0b3){_0x23c3f4=_0x23c3f4-0x0;var _0x82f0f1=_0x7cc9[_0x23c3f4];return _0x82f0f1;};'use strict';var _=require(_0x97cc('0x0'));var util=require('util');var logger=require(_0x97cc('0x1'))(_0x97cc('0x2'));var moment=require(_0x97cc('0x3'));var BPromise=require(_0x97cc('0x4'));var rp=require(_0x97cc('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x97cc('0x6'));var config=require(_0x97cc('0x7'));var attributes=require(_0x97cc('0x8'));module[_0x97cc('0x9')]=function(_0x51da70,_0x30c03a){return _0x51da70[_0x97cc('0xa')](_0x97cc('0xb'),attributes,{'tableName':_0x97cc('0xc'),'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 a994b2e..6186717 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 _0x20f0=['ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info'];(function(_0x2f6136,_0x27b599){var _0x1d9243=function(_0x1b9004){while(--_0x1b9004){_0x2f6136['push'](_0x2f6136['shift']());}};_0x1d9243(++_0x27b599);}(_0x20f0,0x72));var _0x020f=function(_0x42bc91,_0x41f40a){_0x42bc91=_0x42bc91-0x0;var _0x3f5507=_0x20f0[_0x42bc91];return _0x3f5507;};'use strict';var _=require(_0x020f('0x0'));var util=require(_0x020f('0x1'));var moment=require(_0x020f('0x2'));var BPromise=require(_0x020f('0x3'));var rs=require(_0x020f('0x4'));var fs=require('fs');var Redis=require(_0x020f('0x5'));var db=require(_0x020f('0x6'))['db'];var utils=require(_0x020f('0x7'));var logger=require(_0x020f('0x8'))(_0x020f('0x9'));var config=require(_0x020f('0xa'));var jayson=require(_0x020f('0xb'));var client=jayson[_0x020f('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2cce07,_0x23fcc2,_0x36c237){return new BPromise(function(_0x218c8b,_0x45ca31){return client[_0x020f('0xd')](_0x2cce07,_0x36c237)[_0x020f('0xe')](function(_0x478dd1){logger[_0x020f('0xf')](_0x020f('0x10'),_0x23fcc2,_0x020f('0x11'));logger[_0x020f('0x12')](_0x020f('0x13'),_0x23fcc2,_0x020f('0x11'),JSON[_0x020f('0x14')](_0x478dd1));if(_0x478dd1[_0x020f('0x15')]){if(_0x478dd1[_0x020f('0x15')][_0x020f('0x16')]===0x1f4){logger[_0x020f('0x15')](_0x020f('0x10'),_0x23fcc2,_0x478dd1[_0x020f('0x15')][_0x020f('0x17')]);return _0x45ca31(_0x478dd1[_0x020f('0x15')][_0x020f('0x17')]);}logger['error'](_0x020f('0x10'),_0x23fcc2,_0x478dd1[_0x020f('0x15')][_0x020f('0x17')]);return _0x218c8b(_0x478dd1['error'][_0x020f('0x17')]);}else{logger[_0x020f('0xf')]('ChatProactiveAction,\x20%s,\x20%s',_0x23fcc2,_0x020f('0x11'));_0x218c8b(_0x478dd1[_0x020f('0x18')][_0x020f('0x17')]);}})[_0x020f('0x19')](function(_0x132361){logger[_0x020f('0x15')](_0x020f('0x10'),_0x23fcc2,_0x132361);_0x45ca31(_0x132361);});});} \ No newline at end of file +var _0x88c8=['code','ChatProactiveAction,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','error'];(function(_0x288d33,_0x58ee36){var _0x1033bd=function(_0x2e22f1){while(--_0x2e22f1){_0x288d33['push'](_0x288d33['shift']());}};_0x1033bd(++_0x58ee36);}(_0x88c8,0x130));var _0x888c=function(_0x510e2a,_0x59303c){_0x510e2a=_0x510e2a-0x0;var _0x5800ce=_0x88c8[_0x510e2a];return _0x5800ce;};'use strict';var _=require(_0x888c('0x0'));var util=require(_0x888c('0x1'));var moment=require(_0x888c('0x2'));var BPromise=require(_0x888c('0x3'));var rs=require(_0x888c('0x4'));var fs=require('fs');var Redis=require(_0x888c('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x888c('0x6'))(_0x888c('0x7'));var config=require(_0x888c('0x8'));var jayson=require(_0x888c('0x9'));var client=jayson[_0x888c('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x22e75c,_0x5b53fe,_0x5572e9){return new BPromise(function(_0x132091,_0x1b214b){return client[_0x888c('0xb')](_0x22e75c,_0x5572e9)[_0x888c('0xc')](function(_0x4b4c8a){logger[_0x888c('0xd')]('ChatProactiveAction,\x20%s,\x20%s',_0x5b53fe,_0x888c('0xe'));logger[_0x888c('0xf')](_0x888c('0x10'),_0x5b53fe,_0x888c('0xe'),JSON['stringify'](_0x4b4c8a));if(_0x4b4c8a[_0x888c('0x11')]){if(_0x4b4c8a[_0x888c('0x11')][_0x888c('0x12')]===0x1f4){logger[_0x888c('0x11')](_0x888c('0x13'),_0x5b53fe,_0x4b4c8a[_0x888c('0x11')][_0x888c('0x14')]);return _0x1b214b(_0x4b4c8a[_0x888c('0x11')][_0x888c('0x14')]);}logger[_0x888c('0x11')](_0x888c('0x13'),_0x5b53fe,_0x4b4c8a['error'][_0x888c('0x14')]);return _0x132091(_0x4b4c8a[_0x888c('0x11')][_0x888c('0x14')]);}else{logger[_0x888c('0xd')](_0x888c('0x13'),_0x5b53fe,_0x888c('0xe'));_0x132091(_0x4b4c8a[_0x888c('0x15')][_0x888c('0x14')]);}})[_0x888c('0x16')](function(_0x5e93cd){logger['error']('ChatProactiveAction,\x20%s,\x20%s',_0x5b53fe,_0x5e93cd);_0x1b214b(_0x5e93cd);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 9f77f71..d3ca10e 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 _0x0c94=['create','put','update','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','show','post','isAuthenticated'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0x0c94,0x7a));var _0x40c9=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x0c94[_0x21a9d9];return _0x46adce;};'use strict';var multer=require(_0x40c9('0x0'));var util=require(_0x40c9('0x1'));var path=require(_0x40c9('0x2'));var timeout=require(_0x40c9('0x3'));var express=require(_0x40c9('0x4'));var router=express[_0x40c9('0x5')]();var auth=require(_0x40c9('0x6'));var interaction=require(_0x40c9('0x7'));var config=require(_0x40c9('0x8'));var controller=require('./chatProactiveAction.controller');router[_0x40c9('0x9')](_0x40c9('0xa'),auth['isAuthenticated'](),controller[_0x40c9('0xb')]);router[_0x40c9('0xc')]('/',auth[_0x40c9('0xd')](),controller[_0x40c9('0xe')]);router[_0x40c9('0xf')](_0x40c9('0xa'),auth['isAuthenticated'](),controller[_0x40c9('0x10')]);router['delete']('/:id',auth[_0x40c9('0xd')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x1976=['post','create','put','update','delete','destroy','exports','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','/:id','isAuthenticated','show'];(function(_0x522ae8,_0x3b637e){var _0x3189b9=function(_0x3115d4){while(--_0x3115d4){_0x522ae8['push'](_0x522ae8['shift']());}};_0x3189b9(++_0x3b637e);}(_0x1976,0x1e3));var _0x6197=function(_0x4b752f,_0x12f445){_0x4b752f=_0x4b752f-0x0;var _0x17442e=_0x1976[_0x4b752f];return _0x17442e;};'use strict';var multer=require('multer');var util=require(_0x6197('0x0'));var path=require('path');var timeout=require(_0x6197('0x1'));var express=require('express');var router=express[_0x6197('0x2')]();var auth=require(_0x6197('0x3'));var interaction=require(_0x6197('0x4'));var config=require(_0x6197('0x5'));var controller=require(_0x6197('0x6'));router['get'](_0x6197('0x7'),auth[_0x6197('0x8')](),controller[_0x6197('0x9')]);router[_0x6197('0xa')]('/',auth[_0x6197('0x8')](),controller[_0x6197('0xb')]);router[_0x6197('0xc')](_0x6197('0x7'),auth[_0x6197('0x8')](),controller[_0x6197('0xd')]);router[_0x6197('0xe')](_0x6197('0x7'),auth[_0x6197('0x8')](),controller[_0x6197('0xf')]);module[_0x6197('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 553b056..fbd00e0 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 _0xa750=['STRING','name','ENUM','rrmemory','beepall','roundrobin','sequelize','exports'];(function(_0x3ccb1a,_0x4d78cc){var _0x4661fb=function(_0x5dd024){while(--_0x5dd024){_0x3ccb1a['push'](_0x3ccb1a['shift']());}};_0x4661fb(++_0x4d78cc);}(_0xa750,0x15e));var _0x0a75=function(_0x4158c7,_0x23c429){_0x4158c7=_0x4158c7-0x0;var _0x985677=_0xa750[_0x4158c7];return _0x985677;};'use strict';var Sequelize=require(_0x0a75('0x0'));module[_0x0a75('0x1')]={'name':{'type':Sequelize[_0x0a75('0x2')],'unique':_0x0a75('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x0a75('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x0a75('0x4')](_0x0a75('0x5'),_0x0a75('0x6'),_0x0a75('0x7'))}}; \ No newline at end of file +var _0xc544=['ENUM','rrmemory','roundrobin','sequelize','exports','name','INTEGER'];(function(_0x409353,_0xe9f04d){var _0x4f4b59=function(_0x64b587){while(--_0x64b587){_0x409353['push'](_0x409353['shift']());}};_0x4f4b59(++_0xe9f04d);}(_0xc544,0xd5));var _0x4c54=function(_0x42cc76,_0x50073e){_0x42cc76=_0x42cc76-0x0;var _0x279b78=_0xc544[_0x42cc76];return _0x279b78;};'use strict';var Sequelize=require(_0x4c54('0x0'));module[_0x4c54('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x4c54('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x4c54('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x4c54('0x4')](_0x4c54('0x5'),'beepall',_0x4c54('0x6'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 597c5a0..aaebf12 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 _0x5ca2=['ids','online','interface','flatMap','Agents','transaction','each','findOrCreate','forEach','userChatQueue:save','removeTeams','select','from','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','toString','SELECT','includes','all','compact','value','isEmpty','removeAgents','emit','userChatQueue:remove','addAgents','omit','spread','getAgents','html-pdf','rimraf','fast-json-patch','request-promise','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','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./chatQueue.socket','client','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','info','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','ChatQueue,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','stack','name','send','index','map','ChatQueue','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ChatQueues','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','findOne','UserChatQueue','hasOwnProperty','pick','User','findAndCountAll','agent','createdAt','format','%s/%s','SIP','chatPause','Team','getTeams','addTeams'];(function(_0xcdb9ef,_0x2e0083){var _0x2f7741=function(_0x429e37){while(--_0x429e37){_0xcdb9ef['push'](_0xcdb9ef['shift']());}};_0x2f7741(++_0x2e0083);}(_0x5ca2,0x158));var _0x25ca=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x5ca2[_0x2641f9];return _0x585741;};'use strict';var pdf=require(_0x25ca('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x25ca('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x25ca('0x2'));var rp=require(_0x25ca('0x3'));var moment=require('moment');var BPromise=require(_0x25ca('0x4'));var Mustache=require('mustache');var util=require(_0x25ca('0x5'));var path=require(_0x25ca('0x6'));var sox=require(_0x25ca('0x7'));var csv=require(_0x25ca('0x8'));var ejs=require(_0x25ca('0x9'));var fs=require('fs');var _=require(_0x25ca('0xa'));var squel=require(_0x25ca('0xb'));var crypto=require(_0x25ca('0xc'));var jsforce=require(_0x25ca('0xd'));var deskjs=require(_0x25ca('0xe'));var toCsv=require('to-csv');var querystring=require(_0x25ca('0xf'));var Papa=require(_0x25ca('0x10'));var Redis=require(_0x25ca('0x11'));var authService=require(_0x25ca('0x12'));var qs=require(_0x25ca('0x13'));var as=require(_0x25ca('0x14'));var hardwareService=require(_0x25ca('0x15'));var logger=require('../../config/logger')(_0x25ca('0x16'));var utils=require(_0x25ca('0x17'));var config=require(_0x25ca('0x18'));var db=require(_0x25ca('0x19'))['db'];config[_0x25ca('0x1a')]=_['defaults'](config[_0x25ca('0x1a')],{'host':_0x25ca('0x1b'),'port':0x18eb});var socket=require(_0x25ca('0x1c'))(new Redis(config[_0x25ca('0x1a')]));require(_0x25ca('0x1d'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x25ca('0x1e')]['http']({'port':0x232a});function checkPasswordPattern(_0x446365,_0x425cf1,_0x4b4d19){if(_0x4b4d19){var _0x11250f=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x11250f['test'](_0x425cf1)){return _0x446365;}else{throw new db[(_0x25ca('0x1f'))][(_0x25ca('0x20'))](_0x25ca('0x21'));}}else{return _0x446365;}}function respondWithRpcPromise(_0x42dcff,_0x5e7acb,_0x1874b8,_0x1465db){return new BPromise(function(_0x200850,_0x542cc6){var _0x1576a7=_0x1465db||client;return _0x1576a7['request'](_0x42dcff,_0x1874b8)['then'](function(_0x4523e3){logger[_0x25ca('0x22')]('ChatQueue,\x20%s,\x20%s',_0x5e7acb,_0x25ca('0x23'));logger[_0x25ca('0x24')](_0x25ca('0x25'),_0x5e7acb,'request\x20sent',JSON[_0x25ca('0x26')](_0x4523e3));if(_0x4523e3[_0x25ca('0x27')]){if(_0x4523e3[_0x25ca('0x27')]['code']===0x1f4){logger[_0x25ca('0x27')](_0x25ca('0x28'),_0x5e7acb,_0x4523e3[_0x25ca('0x27')][_0x25ca('0x29')]);return _0x542cc6(_0x4523e3[_0x25ca('0x27')]['message']);}logger[_0x25ca('0x27')](_0x25ca('0x28'),_0x5e7acb,_0x4523e3[_0x25ca('0x27')][_0x25ca('0x29')]);return _0x200850(_0x4523e3[_0x25ca('0x27')]['message']);}else{logger[_0x25ca('0x22')](_0x25ca('0x28'),_0x5e7acb,'request\x20sent');_0x200850(_0x4523e3[_0x25ca('0x2a')][_0x25ca('0x29')]);}})[_0x25ca('0x2b')](function(_0x459300){logger['error'](_0x25ca('0x28'),_0x5e7acb,_0x459300);_0x542cc6(_0x459300);});});}function respondWithStatusCode(_0x2726c1,_0x5afdf8){_0x5afdf8=_0x5afdf8||0xcc;return function(_0x3ab933){if(_0x3ab933){return _0x2726c1[_0x25ca('0x2c')](_0x5afdf8);}return _0x2726c1[_0x25ca('0x2d')](_0x5afdf8)[_0x25ca('0x2e')]();};}function respondWithResult(_0x3bffc7,_0x3d3254){_0x3d3254=_0x3d3254||0xc8;return function(_0x20cbb1){if(_0x20cbb1){return _0x3bffc7[_0x25ca('0x2d')](_0x3d3254)[_0x25ca('0x2f')](_0x20cbb1);}};}function respondWithFilteredResult(_0x4cb15c,_0x39ee84){return function(_0x53013a){if(_0x53013a){var _0x333bf5=_0x53013a['count'],_0x2c7f24=_0x39ee84[_0x25ca('0x30')],_0x5dd45d=_0x39ee84[_0x25ca('0x30')]+_0x39ee84[_0x25ca('0x31')],_0x55271b;if(_0x5dd45d>=_0x333bf5){_0x5dd45d=_0x333bf5;_0x55271b=0xc8;}else{_0x55271b=0xce;}_0x4cb15c[_0x25ca('0x2d')](_0x55271b);return _0x4cb15c[_0x25ca('0x32')](_0x25ca('0x33'),_0x2c7f24+'-'+_0x5dd45d+'/'+_0x333bf5)[_0x25ca('0x2f')](_0x53013a);}return null;};}function patchUpdates(_0xd7c8c3){return function(_0x18c52f){try{jsonpatch[_0x25ca('0x34')](_0x18c52f,_0xd7c8c3,!![]);}catch(_0xc4fe77){return BPromise[_0x25ca('0x35')](_0xc4fe77);}return _0x18c52f[_0x25ca('0x36')]();};}function saveUpdates(_0x5d146c,_0x4ac32e){return function(_0xb17187){if(_0xb17187){return _0xb17187[_0x25ca('0x37')](_0x5d146c)[_0x25ca('0x38')](function(_0xaa79fc){return _0xaa79fc;});}return null;};}function removeEntity(_0x50eabd,_0x59e953){return function(_0x28a89b){if(_0x28a89b){return _0x28a89b[_0x25ca('0x39')]()[_0x25ca('0x38')](function(){var _0x3b541c=_0x28a89b[_0x25ca('0x3a')]({'plain':!![]});var _0x2af66e='ChatQueues';return db['UserProfileResource'][_0x25ca('0x39')]({'where':{'type':_0x2af66e,'resourceId':_0x3b541c['id']}})['then'](function(){return _0x28a89b;});})[_0x25ca('0x38')](function(){_0x50eabd[_0x25ca('0x2d')](0xcc)[_0x25ca('0x2e')]();});}};}function handleEntityNotFound(_0x4df6a4,_0x84785c){return function(_0x13fe3b){if(!_0x13fe3b){_0x4df6a4[_0x25ca('0x2c')](0x194);}return _0x13fe3b;};}function handleError(_0x1ac6ce,_0x1452e2){_0x1452e2=_0x1452e2||0x1f4;return function(_0x3d5cee){logger[_0x25ca('0x27')](_0x3d5cee[_0x25ca('0x3b')]);if(_0x3d5cee['name']){delete _0x3d5cee[_0x25ca('0x3c')];}_0x1ac6ce[_0x25ca('0x2d')](_0x1452e2)[_0x25ca('0x3d')](_0x3d5cee);};}exports[_0x25ca('0x3e')]=function(_0x1da1a2,_0x519db8){var _0x5508c7={},_0x8f0f68={},_0x9a716a={'count':0x0,'rows':[]};var _0x81381b=_[_0x25ca('0x3f')](db[_0x25ca('0x40')][_0x25ca('0x41')],function(_0x4367bc){return{'name':_0x4367bc[_0x25ca('0x42')],'type':_0x4367bc[_0x25ca('0x43')][_0x25ca('0x44')]};});_0x8f0f68[_0x25ca('0x45')]=_['map'](_0x81381b,_0x25ca('0x3c'));_0x8f0f68[_0x25ca('0x46')]=_[_0x25ca('0x47')](_0x1da1a2['query']);_0x8f0f68[_0x25ca('0x48')]=_[_0x25ca('0x49')](_0x8f0f68['model'],_0x8f0f68[_0x25ca('0x46')]);_0x5508c7[_0x25ca('0x4a')]=_['intersection'](_0x8f0f68['model'],qs[_0x25ca('0x4b')](_0x1da1a2[_0x25ca('0x46')][_0x25ca('0x4b')]));_0x5508c7[_0x25ca('0x4a')]=_0x5508c7[_0x25ca('0x4a')]['length']?_0x5508c7[_0x25ca('0x4a')]:_0x8f0f68['model'];if(!_0x1da1a2['query']['hasOwnProperty'](_0x25ca('0x4c'))){_0x5508c7[_0x25ca('0x31')]=qs[_0x25ca('0x31')](_0x1da1a2['query'][_0x25ca('0x31')]);_0x5508c7['offset']=qs[_0x25ca('0x30')](_0x1da1a2[_0x25ca('0x46')]['offset']);}_0x5508c7[_0x25ca('0x4d')]=qs[_0x25ca('0x4e')](_0x1da1a2[_0x25ca('0x46')][_0x25ca('0x4e')]);_0x5508c7[_0x25ca('0x4f')]=qs[_0x25ca('0x48')](_['pick'](_0x1da1a2[_0x25ca('0x46')],_0x8f0f68[_0x25ca('0x48')]),_0x81381b);if(_0x1da1a2['query'][_0x25ca('0x50')]){_0x5508c7[_0x25ca('0x4f')]=_[_0x25ca('0x51')](_0x5508c7['where'],{'$or':_[_0x25ca('0x3f')](_0x81381b,function(_0x45d418){if(_0x45d418[_0x25ca('0x43')]!==_0x25ca('0x52')){var _0x2d91bb={};_0x2d91bb[_0x45d418['name']]={'$like':'%'+_0x1da1a2[_0x25ca('0x46')][_0x25ca('0x50')]+'%'};return _0x2d91bb;}})});}_0x5508c7=_['merge']({},_0x5508c7,_0x1da1a2[_0x25ca('0x53')]);var _0x12df37={'where':_0x5508c7[_0x25ca('0x4f')]};return db[_0x25ca('0x40')][_0x25ca('0x54')](_0x12df37)[_0x25ca('0x38')](function(_0x5714c1){_0x9a716a[_0x25ca('0x54')]=_0x5714c1;if(_0x1da1a2['query'][_0x25ca('0x55')]){_0x5508c7[_0x25ca('0x56')]=[{'all':!![]}];}return db[_0x25ca('0x40')][_0x25ca('0x57')](_0x5508c7);})[_0x25ca('0x38')](function(_0xf027be){_0x9a716a['rows']=_0xf027be;return _0x9a716a;})[_0x25ca('0x38')](respondWithFilteredResult(_0x519db8,_0x5508c7))[_0x25ca('0x2b')](handleError(_0x519db8,null));};exports['show']=function(_0x5ad580,_0x431882){var _0x14e5b0={'raw':!![],'where':{'id':_0x5ad580['params']['id']}},_0x17e552={};_0x17e552[_0x25ca('0x45')]=_[_0x25ca('0x47')](db[_0x25ca('0x40')][_0x25ca('0x41')]);_0x17e552['query']=_[_0x25ca('0x47')](_0x5ad580['query']);_0x17e552[_0x25ca('0x48')]=_[_0x25ca('0x49')](_0x17e552[_0x25ca('0x45')],_0x17e552['query']);_0x14e5b0[_0x25ca('0x4a')]=_[_0x25ca('0x49')](_0x17e552[_0x25ca('0x45')],qs['fields'](_0x5ad580[_0x25ca('0x46')]['fields']));_0x14e5b0['attributes']=_0x14e5b0[_0x25ca('0x4a')][_0x25ca('0x58')]?_0x14e5b0['attributes']:_0x17e552[_0x25ca('0x45')];if(_0x5ad580[_0x25ca('0x46')][_0x25ca('0x55')]){_0x14e5b0['include']=[{'all':!![]}];}_0x14e5b0=_[_0x25ca('0x51')]({},_0x14e5b0,_0x5ad580[_0x25ca('0x53')]);return db[_0x25ca('0x40')][_0x25ca('0x59')](_0x14e5b0)[_0x25ca('0x38')](handleEntityNotFound(_0x431882,null))[_0x25ca('0x38')](respondWithResult(_0x431882,null))[_0x25ca('0x2b')](handleError(_0x431882,null));};exports[_0x25ca('0x5a')]=function(_0x15662b,_0x38698f){return db[_0x25ca('0x40')]['create'](_0x15662b[_0x25ca('0x5b')],{})[_0x25ca('0x38')](function(_0x22bcc9){var _0x31738d=_0x15662b[_0x25ca('0x5c')][_0x25ca('0x3a')]({'plain':!![]});if(!_0x31738d)throw new Error(_0x25ca('0x5d'));if(_0x31738d[_0x25ca('0x5e')]===_0x25ca('0x5c')){var _0x1733d0=_0x22bcc9[_0x25ca('0x3a')]({'plain':!![]});var _0x5a047d=_0x25ca('0x5f');return db[_0x25ca('0x60')]['find']({'where':{'name':_0x5a047d,'userProfileId':_0x31738d[_0x25ca('0x61')]},'raw':!![]})[_0x25ca('0x38')](function(_0x568a64){if(_0x568a64&&_0x568a64[_0x25ca('0x62')]===0x0){return db[_0x25ca('0x63')]['create']({'name':_0x1733d0[_0x25ca('0x3c')],'resourceId':_0x1733d0['id'],'type':_0x568a64[_0x25ca('0x3c')],'sectionId':_0x568a64['id']},{})[_0x25ca('0x38')](function(){return _0x22bcc9;});}else{return _0x22bcc9;}})[_0x25ca('0x2b')](function(_0x111588){logger[_0x25ca('0x27')](_0x25ca('0x64'),_0x111588);throw _0x111588;});}return _0x22bcc9;})[_0x25ca('0x38')](respondWithResult(_0x38698f,0xc9))[_0x25ca('0x2b')](handleError(_0x38698f,null));};exports[_0x25ca('0x37')]=function(_0x5557bf,_0x55b44b){if(_0x5557bf['body']['id']){delete _0x5557bf['body']['id'];}return db[_0x25ca('0x40')][_0x25ca('0x59')]({'where':{'id':_0x5557bf[_0x25ca('0x65')]['id']}})[_0x25ca('0x38')](handleEntityNotFound(_0x55b44b,null))[_0x25ca('0x38')](saveUpdates(_0x5557bf['body'],null))['then'](respondWithResult(_0x55b44b,null))['catch'](handleError(_0x55b44b,null));};exports[_0x25ca('0x39')]=function(_0x4900bc,_0x4401ac){return db['ChatQueue']['find']({'where':{'id':_0x4900bc[_0x25ca('0x65')]['id']}})[_0x25ca('0x38')](handleEntityNotFound(_0x4401ac,null))['then'](removeEntity(_0x4401ac,null))[_0x25ca('0x2b')](handleError(_0x4401ac,null));};exports[_0x25ca('0x66')]=function(_0x4b576f,_0x16d1b8){return db[_0x25ca('0x40')][_0x25ca('0x66')]()[_0x25ca('0x38')](respondWithResult(_0x16d1b8,null))[_0x25ca('0x2b')](handleError(_0x16d1b8,null));};exports['getMembers']=function(_0x3e9c70,_0x1456b8,_0x49788b){var _0x428949={'raw':!![],'where':{}},_0x1f986d={},_0x290a49;return db[_0x25ca('0x40')][_0x25ca('0x67')]({'where':{'id':_0x3e9c70[_0x25ca('0x65')]['id']}})['then'](handleEntityNotFound(_0x1456b8,null))[_0x25ca('0x38')](function(_0x168987){if(_0x168987){_0x290a49=_0x168987[_0x25ca('0x3a')]({'plain':!![]});_0x1f986d['model']=_[_0x25ca('0x47')](db[_0x25ca('0x68')]['rawAttributes']);_0x1f986d[_0x25ca('0x46')]=_[_0x25ca('0x47')](_0x3e9c70[_0x25ca('0x46')]);_0x1f986d['filters']=_['intersection'](_0x1f986d[_0x25ca('0x45')],_0x1f986d[_0x25ca('0x46')]);_0x428949[_0x25ca('0x4a')]=_[_0x25ca('0x49')](_0x1f986d[_0x25ca('0x45')],qs[_0x25ca('0x4b')](_0x3e9c70[_0x25ca('0x46')]['fields']));_0x428949[_0x25ca('0x4a')]=_0x428949['attributes'][_0x25ca('0x58')]?_0x428949[_0x25ca('0x4a')]:_0x1f986d['model'];if(!_0x3e9c70[_0x25ca('0x46')][_0x25ca('0x69')](_0x25ca('0x4c'))){_0x428949['limit']=qs[_0x25ca('0x31')](_0x3e9c70['query'][_0x25ca('0x31')]);_0x428949['offset']=qs[_0x25ca('0x30')](_0x3e9c70[_0x25ca('0x46')][_0x25ca('0x30')]);}_0x428949[_0x25ca('0x4d')]=qs[_0x25ca('0x4e')](_0x3e9c70[_0x25ca('0x46')][_0x25ca('0x4e')]);_0x428949[_0x25ca('0x4f')]=qs[_0x25ca('0x48')](_[_0x25ca('0x6a')](_0x3e9c70['query'],_0x1f986d[_0x25ca('0x48')]));_0x428949[_0x25ca('0x4f')]['ChatQueueId']=_0x168987['id'];if(_0x3e9c70['query']['filter']){_0x428949[_0x25ca('0x4f')]=_[_0x25ca('0x51')](_0x428949[_0x25ca('0x4f')],{'$or':_[_0x25ca('0x3f')](_0x428949['attributes'],function(_0x1f7811){var _0x2f7cdc={};_0x2f7cdc[_0x1f7811]={'$like':'%'+_0x3e9c70[_0x25ca('0x46')][_0x25ca('0x50')]+'%'};return _0x2f7cdc;})});}_0x428949=_[_0x25ca('0x51')]({},_0x428949,_0x3e9c70[_0x25ca('0x53')]);return db[_0x25ca('0x68')]['findAll'](_0x428949);}})[_0x25ca('0x38')](function(_0x517e5b){if(_0x517e5b){return db[_0x25ca('0x6b')][_0x25ca('0x6c')]({'where':{'id':_[_0x25ca('0x3f')](_0x517e5b,'UserId'),'role':_0x25ca('0x6d')},'attributes':['id',_0x25ca('0x3c'),'chatPause','updatedAt',_0x25ca('0x6e')]});}})[_0x25ca('0x38')](function(_0x245a3c){if(_0x245a3c){return{'count':_0x245a3c['count'],'rows':_[_0x25ca('0x3f')](_0x245a3c['rows'],function(_0x304e3a){return{'membername':_0x304e3a['name'],'UserId':_0x304e3a['id'],'queue_name':_0x290a49[_0x25ca('0x3c')],'ChatQueueId':_0x290a49['id'],'interface':util[_0x25ca('0x6f')](_0x25ca('0x70'),_0x25ca('0x71'),_0x304e3a['name']),'penalty':0x0,'paused':_0x304e3a[_0x25ca('0x72')],'createdAt':_0x304e3a[_0x25ca('0x6e')],'updatedAt':_0x304e3a['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x25ca('0x38')](respondWithFilteredResult(_0x1456b8,_0x428949))[_0x25ca('0x2b')](handleError(_0x1456b8,null));};exports['getTeams']=function(_0xb90c2e,_0x436d27,_0x3f31e3){var _0x1a095c={};var _0x5cab1d={};var _0x5cb9e1;var _0x5dba9f;return db['ChatQueue'][_0x25ca('0x67')]({'where':{'id':_0xb90c2e['params']['id']}})[_0x25ca('0x38')](handleEntityNotFound(_0x436d27,null))[_0x25ca('0x38')](function(_0x22b448){if(_0x22b448){_0x5cb9e1=_0x22b448;_0x5cab1d['model']=_[_0x25ca('0x47')](db[_0x25ca('0x73')][_0x25ca('0x41')]);_0x5cab1d[_0x25ca('0x46')]=_['keys'](_0xb90c2e[_0x25ca('0x46')]);_0x5cab1d[_0x25ca('0x48')]=_[_0x25ca('0x49')](_0x5cab1d[_0x25ca('0x45')],_0x5cab1d['query']);_0x1a095c[_0x25ca('0x4a')]=_['intersection'](_0x5cab1d[_0x25ca('0x45')],qs['fields'](_0xb90c2e[_0x25ca('0x46')][_0x25ca('0x4b')]));_0x1a095c[_0x25ca('0x4a')]=_0x1a095c[_0x25ca('0x4a')][_0x25ca('0x58')]?_0x1a095c[_0x25ca('0x4a')]:_0x5cab1d['model'];_0x1a095c[_0x25ca('0x4d')]=qs[_0x25ca('0x4e')](_0xb90c2e[_0x25ca('0x46')][_0x25ca('0x4e')]);_0x1a095c[_0x25ca('0x4f')]=qs[_0x25ca('0x48')](_['pick'](_0xb90c2e[_0x25ca('0x46')],_0x5cab1d[_0x25ca('0x48')]));if(_0xb90c2e[_0x25ca('0x46')][_0x25ca('0x50')]){_0x1a095c[_0x25ca('0x4f')]=_['merge'](_0x1a095c[_0x25ca('0x4f')],{'$or':_[_0x25ca('0x3f')](_0x1a095c[_0x25ca('0x4a')],function(_0xc3768b){var _0x445d92={};_0x445d92[_0xc3768b]={'$like':'%'+_0xb90c2e['query'][_0x25ca('0x50')]+'%'};return _0x445d92;})});}_0x1a095c=_[_0x25ca('0x51')]({},_0x1a095c,_0xb90c2e[_0x25ca('0x53')]);return _0x5cb9e1[_0x25ca('0x74')](_0x1a095c);}})['then'](function(_0x30c7c0){if(_0x30c7c0){_0x5dba9f=_0x30c7c0[_0x25ca('0x58')];if(!_0xb90c2e['query'][_0x25ca('0x69')]('nolimit')){_0x1a095c['limit']=qs[_0x25ca('0x31')](_0xb90c2e[_0x25ca('0x46')][_0x25ca('0x31')]);_0x1a095c['offset']=qs[_0x25ca('0x30')](_0xb90c2e[_0x25ca('0x46')][_0x25ca('0x30')]);}return _0x5cb9e1[_0x25ca('0x74')](_0x1a095c);}})[_0x25ca('0x38')](function(_0x58664f){if(_0x58664f){return _0x58664f?{'count':_0x5dba9f,'rows':_0x58664f}:null;}})[_0x25ca('0x38')](respondWithResult(_0x436d27,null))['catch'](handleError(_0x436d27,null));};exports[_0x25ca('0x75')]=function(_0x5a1f6e,_0xd47d53,_0x343a22){var _0x282a24=_0x5a1f6e[_0x25ca('0x5b')][_0x25ca('0x76')];return db['Team']['findAll']({'where':{'id':_0x282a24},'attributes':['id'],'include':[{'model':db[_0x25ca('0x6b')],'as':'Agents','attributes':['id',_0x25ca('0x3c'),_0x25ca('0x77'),'voicePause',_0x25ca('0x78')],'raw':!![]}]})['then'](function(_0x37b563){if(_0x37b563){var _0xab329a=_[_0x25ca('0x79')](_0x37b563,function(_0x4bd762){var _0x4c55bf=_0x4bd762[_0x25ca('0x3a')]({'plain':!![]});return _0x4c55bf[_0x25ca('0x7a')];});return db[_0x25ca('0x40')]['find']({'where':{'id':_0x5a1f6e['params']['id']}})['then'](function(_0x494247){return db['sequelize'][_0x25ca('0x7b')](function(_0x25fcdb){return _0x494247[_0x25ca('0x75')](_0x282a24,{'transaction':_0x25fcdb})[_0x25ca('0x38')](function(){return BPromise[_0x25ca('0x7c')](_0xab329a,function(_0x3db827){return db[_0x25ca('0x68')][_0x25ca('0x7d')]({'where':{'UserId':_0x3db827['id'],'ChatQueueId':_0x5a1f6e[_0x25ca('0x65')]['id']},'transaction':_0x25fcdb});});})[_0x25ca('0x38')](function(){_0xab329a[_0x25ca('0x7e')](function(_0x272f2c){socket['emit'](_0x25ca('0x7f'),{'UserId':_0x272f2c['id'],'ChatQueueId':_0x494247['id']});});});});});}})[_0x25ca('0x38')](respondWithStatusCode(_0xd47d53,null))[_0x25ca('0x2b')](handleError(_0xd47d53,null));};exports[_0x25ca('0x80')]=function(_0x3b869a,_0x1d9e64,_0x57ce06){return db[_0x25ca('0x73')][_0x25ca('0x57')]({'where':{'id':_0x3b869a['query'][_0x25ca('0x76')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x25ca('0x7a'),'attributes':['id'],'raw':!![]}]})[_0x25ca('0x38')](handleEntityNotFound(_0x1d9e64,null))[_0x25ca('0x38')](function(_0x5dd858){var _0x5befb8=_[_0x25ca('0x3f')](_0x5dd858,'id');var _0x25f193=[];var _0x52edf7=[];var _0xae61e2=squel[_0x25ca('0x81')]();_0xae61e2['field']('tq.TeamId')[_0x25ca('0x82')](_0x25ca('0x83'),'tq')[_0x25ca('0x84')](_0x25ca('0x85'),'ut',_0x25ca('0x86'))['where'](_0x25ca('0x87'),_0x3b869a[_0x25ca('0x65')]['id']);for(var _0x345fb7=0x0;_0x345fb7<_0x5dd858['length'];_0x345fb7+=0x1){let _0xd0ed6d=_0x5dd858[_0x345fb7];for(var _0x2a78a8=0x0;_0x2a78a8<_0xd0ed6d[_0x25ca('0x7a')][_0x25ca('0x58')];_0x2a78a8+=0x1){let _0x2ee1eb=_0xd0ed6d[_0x25ca('0x7a')][_0x2a78a8];var _0x506dee=_0xae61e2[_0x25ca('0x88')]();_0x506dee[_0x25ca('0x4f')](_0x25ca('0x89'),_0x2ee1eb['id']);_0x52edf7[_0x25ca('0x8a')](db[_0x25ca('0x8b')][_0x25ca('0x46')](_0x506dee[_0x25ca('0x8c')](),{'type':db[_0x25ca('0x8b')]['QueryTypes'][_0x25ca('0x8d')]})['then'](function(_0x18c3c8){if(_0x18c3c8[_0x25ca('0x58')]===0x1){return _0x2ee1eb['id'];}else{var _0xa93db1=_['every'](_['map'](_0x18c3c8,'TeamId'),function(_0x510b1a){return _[_0x25ca('0x8e')](_0x5befb8,_0x510b1a);});if(_0xa93db1){return _0x2ee1eb['id'];}}}));}}return BPromise[_0x25ca('0x8f')](_0x52edf7)[_0x25ca('0x38')](function(_0x4405d6){_0x25f193=_(_0x25f193)['union'](_0x4405d6)[_0x25ca('0x90')]()[_0x25ca('0x91')]();return db[_0x25ca('0x40')][_0x25ca('0x59')]({'where':{'id':_0x3b869a[_0x25ca('0x65')]['id']}})[_0x25ca('0x38')](function(_0x1f61d6){return db[_0x25ca('0x8b')]['transaction'](function(_0x221fd8){return _0x1f61d6[_0x25ca('0x80')](_0x3b869a[_0x25ca('0x46')][_0x25ca('0x76')],{'transaction':_0x221fd8})['then'](function(){if(!_[_0x25ca('0x92')](_0x25f193)){return _0x1f61d6[_0x25ca('0x93')](_0x25f193,{'transaction':_0x221fd8});}})[_0x25ca('0x38')](function(){_0x25f193[_0x25ca('0x7e')](function(_0x252d01){socket[_0x25ca('0x94')](_0x25ca('0x95'),{'UserId':_0x252d01,'ChatQueueId':_0x1f61d6['id']});});});});});});})[_0x25ca('0x38')](respondWithStatusCode(_0x1d9e64,null))[_0x25ca('0x2b')](handleError(_0x1d9e64,null));};exports[_0x25ca('0x96')]=function(_0x11bda7,_0xda251e,_0x1b678f){return db[_0x25ca('0x40')][_0x25ca('0x59')]({'where':{'id':_0x11bda7[_0x25ca('0x65')]['id']}})['then'](handleEntityNotFound(_0xda251e,null))[_0x25ca('0x38')](function(_0x122333){if(_0x122333){return _0x122333[_0x25ca('0x96')](_0x11bda7['body']['ids'],_[_0x25ca('0x97')](_0x11bda7['body'],['ids','id'])||{})[_0x25ca('0x98')](function(_0x417306){for(var _0x3cba40=0x0;_0x3cba40<_0x11bda7[_0x25ca('0x5b')]['ids'][_0x25ca('0x58')];_0x3cba40+=0x1){socket[_0x25ca('0x94')](_0x25ca('0x7f'),{'UserId':_0x11bda7[_0x25ca('0x5b')]['ids'][_0x3cba40],'ChatQueueId':_0x11bda7['params']['id']});}return _0x417306;});}})[_0x25ca('0x38')](respondWithResult(_0xda251e,null))[_0x25ca('0x2b')](handleError(_0xda251e,null));};exports[_0x25ca('0x93')]=function(_0x56fc88,_0x18f011,_0x16362a){return db[_0x25ca('0x40')][_0x25ca('0x59')]({'where':{'id':_0x56fc88['params']['id']}})[_0x25ca('0x38')](handleEntityNotFound(_0x18f011,null))['then'](function(_0x5dd8cf){if(_0x5dd8cf){return _0x5dd8cf[_0x25ca('0x93')](_0x56fc88['query']['ids'])['then'](function(){if(_['isArray'](_0x56fc88[_0x25ca('0x46')][_0x25ca('0x76')])){for(var _0x24bb6d=0x0;_0x24bb6d<_0x56fc88[_0x25ca('0x46')][_0x25ca('0x76')]['length'];_0x24bb6d+=0x1){socket['emit'](_0x25ca('0x95'),{'UserId':Number(_0x56fc88[_0x25ca('0x46')][_0x25ca('0x76')][_0x24bb6d]),'ChatQueueId':Number(_0x56fc88[_0x25ca('0x65')]['id'])});}}else{socket[_0x25ca('0x94')]('userChatQueue:remove',{'UserId':Number(_0x56fc88[_0x25ca('0x46')][_0x25ca('0x76')]),'ChatQueueId':Number(_0x56fc88['params']['id'])});}});}})[_0x25ca('0x38')](respondWithStatusCode(_0x18f011,null))[_0x25ca('0x2b')](handleError(_0x18f011,null));};exports[_0x25ca('0x99')]=function(_0x3252bc,_0x5e55be,_0x2c4b26){var _0x5e8173={};var _0x282f89={};var _0xc69387;var _0x1bfb12;return db[_0x25ca('0x40')][_0x25ca('0x67')]({'where':{'id':_0x3252bc[_0x25ca('0x65')]['id']}})[_0x25ca('0x38')](handleEntityNotFound(_0x5e55be,null))[_0x25ca('0x38')](function(_0x100de7){if(_0x100de7){_0xc69387=_0x100de7;_0x282f89[_0x25ca('0x45')]=_[_0x25ca('0x47')](db[_0x25ca('0x6b')][_0x25ca('0x41')]);_0x282f89[_0x25ca('0x46')]=_['keys'](_0x3252bc[_0x25ca('0x46')]);_0x282f89[_0x25ca('0x48')]=_['intersection'](_0x282f89[_0x25ca('0x45')],_0x282f89[_0x25ca('0x46')]);_0x5e8173[_0x25ca('0x4a')]=_['intersection'](_0x282f89[_0x25ca('0x45')],qs['fields'](_0x3252bc[_0x25ca('0x46')][_0x25ca('0x4b')]));_0x5e8173[_0x25ca('0x4a')]=_0x5e8173[_0x25ca('0x4a')]['length']?_0x5e8173['attributes']:_0x282f89[_0x25ca('0x45')];_0x5e8173['order']=qs[_0x25ca('0x4e')](_0x3252bc[_0x25ca('0x46')][_0x25ca('0x4e')]);_0x5e8173[_0x25ca('0x4f')]=qs['filters'](_['pick'](_0x3252bc['query'],_0x282f89[_0x25ca('0x48')]));if(_0x3252bc[_0x25ca('0x46')][_0x25ca('0x50')]){_0x5e8173[_0x25ca('0x4f')]=_['merge'](_0x5e8173[_0x25ca('0x4f')],{'$or':_[_0x25ca('0x3f')](_0x5e8173[_0x25ca('0x4a')],function(_0x18f4b1){var _0x11ee53={};_0x11ee53[_0x18f4b1]={'$like':'%'+_0x3252bc[_0x25ca('0x46')][_0x25ca('0x50')]+'%'};return _0x11ee53;})});}_0x5e8173=_[_0x25ca('0x51')]({},_0x5e8173,_0x3252bc[_0x25ca('0x53')]);return _0xc69387[_0x25ca('0x99')](_0x5e8173);}})[_0x25ca('0x38')](function(_0x8fae9e){if(_0x8fae9e){_0x1bfb12=_0x8fae9e[_0x25ca('0x58')];if(!_0x3252bc[_0x25ca('0x46')][_0x25ca('0x69')](_0x25ca('0x4c'))){_0x5e8173[_0x25ca('0x31')]=qs[_0x25ca('0x31')](_0x3252bc[_0x25ca('0x46')][_0x25ca('0x31')]);_0x5e8173[_0x25ca('0x30')]=qs[_0x25ca('0x30')](_0x3252bc[_0x25ca('0x46')]['offset']);}return _0xc69387[_0x25ca('0x99')](_0x5e8173);}})['then'](function(_0xb64570){if(_0xb64570){return _0xb64570?{'count':_0x1bfb12,'rows':_0xb64570}:null;}})[_0x25ca('0x38')](respondWithResult(_0x5e55be,null))[_0x25ca('0x2b')](handleError(_0x5e55be,null));}; \ No newline at end of file +var _0x271c=['user','get','role','UserProfileSection','userProfileId','describe','getMembers','UserChatQueue','pick','ChatQueueId','User','findAndCountAll','UserId','agent','chatPause','updatedAt','format','createdAt','getTeams','findOne','Team','addTeams','ids','online','voicePause','flatMap','Agents','sequelize','findOrCreate','forEach','emit','userChatQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','push','QueryTypes','SELECT','every','all','compact','value','transaction','removeAgents','userChatQueue:remove','addAgents','isArray','getAgents','html-pdf','eml-format','moment','bluebird','mustache','util','path','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./chatQueue.socket','register','jayson/promise','client','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatQueue,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','limit','apply','reject','update','ChatQueues','UserProfileResource','destroy','name','index','map','ChatQueue','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','merge','VIRTUAL','filter','options','count','includeAll','include','findAll','rows','show','params','rawAttributes','find','create','body'];(function(_0x5e3caf,_0x17358b){var _0xdf587c=function(_0x125b92){while(--_0x125b92){_0x5e3caf['push'](_0x5e3caf['shift']());}};_0xdf587c(++_0x17358b);}(_0x271c,0x15a));var _0xc271=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x271c[_0x4565bf];return _0x5610ba;};'use strict';var pdf=require(_0xc271('0x0'));var emlformat=require(_0xc271('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xc271('0x2'));var BPromise=require(_0xc271('0x3'));var Mustache=require(_0xc271('0x4'));var util=require(_0xc271('0x5'));var path=require(_0xc271('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xc271('0x7'));var deskjs=require(_0xc271('0x8'));var toCsv=require(_0xc271('0x9'));var querystring=require('querystring');var Papa=require(_0xc271('0xa'));var Redis=require(_0xc271('0xb'));var authService=require(_0xc271('0xc'));var qs=require(_0xc271('0xd'));var as=require(_0xc271('0xe'));var hardwareService=require(_0xc271('0xf'));var logger=require(_0xc271('0x10'))(_0xc271('0x11'));var utils=require(_0xc271('0x12'));var config=require(_0xc271('0x13'));var db=require(_0xc271('0x14'))['db'];config[_0xc271('0x15')]=_[_0xc271('0x16')](config[_0xc271('0x15')],{'host':_0xc271('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc271('0x15')]));require(_0xc271('0x18'))[_0xc271('0x19')](socket);var jayson=require(_0xc271('0x1a'));var client=jayson[_0xc271('0x1b')]['http']({'port':0x232a});function checkPasswordPattern(_0x43757f,_0xe6b035,_0x301106){if(_0x301106){var _0x4fc5ee=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4fc5ee[_0xc271('0x1c')](_0xe6b035)){return _0x43757f;}else{throw new db[(_0xc271('0x1d'))][(_0xc271('0x1e'))](_0xc271('0x1f'));}}else{return _0x43757f;}}function respondWithRpcPromise(_0x382179,_0x30229e,_0x25a241,_0x570b0d){return new BPromise(function(_0x3553d7,_0x4f6b29){var _0x5190db=_0x570b0d||client;return _0x5190db['request'](_0x382179,_0x25a241)[_0xc271('0x20')](function(_0x2dec8f){logger[_0xc271('0x21')]('ChatQueue,\x20%s,\x20%s',_0x30229e,_0xc271('0x22'));logger[_0xc271('0x23')](_0xc271('0x24'),_0x30229e,_0xc271('0x22'),JSON[_0xc271('0x25')](_0x2dec8f));if(_0x2dec8f[_0xc271('0x26')]){if(_0x2dec8f[_0xc271('0x26')][_0xc271('0x27')]===0x1f4){logger[_0xc271('0x26')](_0xc271('0x28'),_0x30229e,_0x2dec8f[_0xc271('0x26')][_0xc271('0x29')]);return _0x4f6b29(_0x2dec8f[_0xc271('0x26')][_0xc271('0x29')]);}logger[_0xc271('0x26')]('ChatQueue,\x20%s,\x20%s',_0x30229e,_0x2dec8f[_0xc271('0x26')][_0xc271('0x29')]);return _0x3553d7(_0x2dec8f['error'][_0xc271('0x29')]);}else{logger[_0xc271('0x21')]('ChatQueue,\x20%s,\x20%s',_0x30229e,_0xc271('0x22'));_0x3553d7(_0x2dec8f[_0xc271('0x2a')][_0xc271('0x29')]);}})[_0xc271('0x2b')](function(_0xd4738a){logger['error'](_0xc271('0x28'),_0x30229e,_0xd4738a);_0x4f6b29(_0xd4738a);});});}function respondWithStatusCode(_0x4d462e,_0xe9c0b4){_0xe9c0b4=_0xe9c0b4||0xcc;return function(_0x4fe3b2){if(_0x4fe3b2){return _0x4d462e[_0xc271('0x2c')](_0xe9c0b4);}return _0x4d462e[_0xc271('0x2d')](_0xe9c0b4)[_0xc271('0x2e')]();};}function respondWithResult(_0x417e06,_0x32b9ae){_0x32b9ae=_0x32b9ae||0xc8;return function(_0x182e61){if(_0x182e61){return _0x417e06[_0xc271('0x2d')](_0x32b9ae)[_0xc271('0x2f')](_0x182e61);}};}function respondWithFilteredResult(_0x4f99e9,_0x32659a){return function(_0x40443d){if(_0x40443d){var _0x2d52e2=_0x40443d['count'],_0x48fbd8=_0x32659a[_0xc271('0x30')],_0x2bebe7=_0x32659a[_0xc271('0x30')]+_0x32659a[_0xc271('0x31')],_0x5f3ed4;if(_0x2bebe7>=_0x2d52e2){_0x2bebe7=_0x2d52e2;_0x5f3ed4=0xc8;}else{_0x5f3ed4=0xce;}_0x4f99e9[_0xc271('0x2d')](_0x5f3ed4);return _0x4f99e9['set']('Content-Range',_0x48fbd8+'-'+_0x2bebe7+'/'+_0x2d52e2)[_0xc271('0x2f')](_0x40443d);}return null;};}function patchUpdates(_0x184f8d){return function(_0x258b86){try{jsonpatch[_0xc271('0x32')](_0x258b86,_0x184f8d,!![]);}catch(_0x2a8bca){return BPromise[_0xc271('0x33')](_0x2a8bca);}return _0x258b86['save']();};}function saveUpdates(_0x256795,_0x24518d){return function(_0x32aa6a){if(_0x32aa6a){return _0x32aa6a[_0xc271('0x34')](_0x256795)[_0xc271('0x20')](function(_0x19c667){return _0x19c667;});}return null;};}function removeEntity(_0x1b0888,_0x259a26){return function(_0x5e8a14){if(_0x5e8a14){return _0x5e8a14['destroy']()[_0xc271('0x20')](function(){var _0x245513=_0x5e8a14['get']({'plain':!![]});var _0x13c25d=_0xc271('0x35');return db[_0xc271('0x36')][_0xc271('0x37')]({'where':{'type':_0x13c25d,'resourceId':_0x245513['id']}})[_0xc271('0x20')](function(){return _0x5e8a14;});})['then'](function(){_0x1b0888[_0xc271('0x2d')](0xcc)[_0xc271('0x2e')]();});}};}function handleEntityNotFound(_0x2fb7dc,_0x14cd8d){return function(_0x48cf87){if(!_0x48cf87){_0x2fb7dc['sendStatus'](0x194);}return _0x48cf87;};}function handleError(_0x491202,_0x24f81c){_0x24f81c=_0x24f81c||0x1f4;return function(_0x47a1ef){logger[_0xc271('0x26')](_0x47a1ef['stack']);if(_0x47a1ef[_0xc271('0x38')]){delete _0x47a1ef['name'];}_0x491202[_0xc271('0x2d')](_0x24f81c)['send'](_0x47a1ef);};}exports[_0xc271('0x39')]=function(_0x5c8bd3,_0xdf3698){var _0x4327b5={},_0x2990cf={},_0x1d5dfa={'count':0x0,'rows':[]};var _0x29e507=_[_0xc271('0x3a')](db[_0xc271('0x3b')]['rawAttributes'],function(_0x55720c){return{'name':_0x55720c['fieldName'],'type':_0x55720c[_0xc271('0x3c')]['key']};});_0x2990cf[_0xc271('0x3d')]=_[_0xc271('0x3a')](_0x29e507,'name');_0x2990cf[_0xc271('0x3e')]=_[_0xc271('0x3f')](_0x5c8bd3[_0xc271('0x3e')]);_0x2990cf['filters']=_[_0xc271('0x40')](_0x2990cf[_0xc271('0x3d')],_0x2990cf[_0xc271('0x3e')]);_0x4327b5[_0xc271('0x41')]=_[_0xc271('0x40')](_0x2990cf['model'],qs[_0xc271('0x42')](_0x5c8bd3[_0xc271('0x3e')][_0xc271('0x42')]));_0x4327b5[_0xc271('0x41')]=_0x4327b5['attributes'][_0xc271('0x43')]?_0x4327b5[_0xc271('0x41')]:_0x2990cf[_0xc271('0x3d')];if(!_0x5c8bd3[_0xc271('0x3e')][_0xc271('0x44')](_0xc271('0x45'))){_0x4327b5[_0xc271('0x31')]=qs[_0xc271('0x31')](_0x5c8bd3[_0xc271('0x3e')][_0xc271('0x31')]);_0x4327b5[_0xc271('0x30')]=qs['offset'](_0x5c8bd3[_0xc271('0x3e')][_0xc271('0x30')]);}_0x4327b5[_0xc271('0x46')]=qs[_0xc271('0x47')](_0x5c8bd3[_0xc271('0x3e')]['sort']);_0x4327b5[_0xc271('0x48')]=qs[_0xc271('0x49')](_['pick'](_0x5c8bd3['query'],_0x2990cf[_0xc271('0x49')]),_0x29e507);if(_0x5c8bd3[_0xc271('0x3e')]['filter']){_0x4327b5[_0xc271('0x48')]=_[_0xc271('0x4a')](_0x4327b5[_0xc271('0x48')],{'$or':_[_0xc271('0x3a')](_0x29e507,function(_0x2ab3d1){if(_0x2ab3d1[_0xc271('0x3c')]!==_0xc271('0x4b')){var _0x3cdd30={};_0x3cdd30[_0x2ab3d1[_0xc271('0x38')]]={'$like':'%'+_0x5c8bd3['query'][_0xc271('0x4c')]+'%'};return _0x3cdd30;}})});}_0x4327b5=_[_0xc271('0x4a')]({},_0x4327b5,_0x5c8bd3[_0xc271('0x4d')]);var _0x5b694f={'where':_0x4327b5[_0xc271('0x48')]};return db[_0xc271('0x3b')][_0xc271('0x4e')](_0x5b694f)[_0xc271('0x20')](function(_0x4d7c18){_0x1d5dfa[_0xc271('0x4e')]=_0x4d7c18;if(_0x5c8bd3[_0xc271('0x3e')][_0xc271('0x4f')]){_0x4327b5[_0xc271('0x50')]=[{'all':!![]}];}return db[_0xc271('0x3b')][_0xc271('0x51')](_0x4327b5);})[_0xc271('0x20')](function(_0x476a9){_0x1d5dfa[_0xc271('0x52')]=_0x476a9;return _0x1d5dfa;})['then'](respondWithFilteredResult(_0xdf3698,_0x4327b5))['catch'](handleError(_0xdf3698,null));};exports[_0xc271('0x53')]=function(_0x36fb85,_0x29c60c){var _0x52a074={'raw':!![],'where':{'id':_0x36fb85[_0xc271('0x54')]['id']}},_0x1970a3={};_0x1970a3[_0xc271('0x3d')]=_[_0xc271('0x3f')](db[_0xc271('0x3b')][_0xc271('0x55')]);_0x1970a3['query']=_[_0xc271('0x3f')](_0x36fb85[_0xc271('0x3e')]);_0x1970a3['filters']=_[_0xc271('0x40')](_0x1970a3[_0xc271('0x3d')],_0x1970a3[_0xc271('0x3e')]);_0x52a074[_0xc271('0x41')]=_[_0xc271('0x40')](_0x1970a3[_0xc271('0x3d')],qs[_0xc271('0x42')](_0x36fb85[_0xc271('0x3e')][_0xc271('0x42')]));_0x52a074[_0xc271('0x41')]=_0x52a074[_0xc271('0x41')]['length']?_0x52a074[_0xc271('0x41')]:_0x1970a3[_0xc271('0x3d')];if(_0x36fb85['query'][_0xc271('0x4f')]){_0x52a074[_0xc271('0x50')]=[{'all':!![]}];}_0x52a074=_['merge']({},_0x52a074,_0x36fb85['options']);return db[_0xc271('0x3b')][_0xc271('0x56')](_0x52a074)[_0xc271('0x20')](handleEntityNotFound(_0x29c60c,null))[_0xc271('0x20')](respondWithResult(_0x29c60c,null))['catch'](handleError(_0x29c60c,null));};exports['create']=function(_0xcc2f8,_0x4b8e4c){return db[_0xc271('0x3b')][_0xc271('0x57')](_0xcc2f8[_0xc271('0x58')],{})[_0xc271('0x20')](function(_0x2c98f6){var _0x3fd734=_0xcc2f8[_0xc271('0x59')][_0xc271('0x5a')]({'plain':!![]});if(!_0x3fd734)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3fd734[_0xc271('0x5b')]==='user'){var _0x5b88e8=_0x2c98f6[_0xc271('0x5a')]({'plain':!![]});var _0x1f7576=_0xc271('0x35');return db[_0xc271('0x5c')][_0xc271('0x56')]({'where':{'name':_0x1f7576,'userProfileId':_0x3fd734[_0xc271('0x5d')]},'raw':!![]})['then'](function(_0x1f1632){if(_0x1f1632&&_0x1f1632['autoAssociation']===0x0){return db[_0xc271('0x36')]['create']({'name':_0x5b88e8[_0xc271('0x38')],'resourceId':_0x5b88e8['id'],'type':_0x1f1632['name'],'sectionId':_0x1f1632['id']},{})[_0xc271('0x20')](function(){return _0x2c98f6;});}else{return _0x2c98f6;}})[_0xc271('0x2b')](function(_0x4a6254){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4a6254);throw _0x4a6254;});}return _0x2c98f6;})[_0xc271('0x20')](respondWithResult(_0x4b8e4c,0xc9))[_0xc271('0x2b')](handleError(_0x4b8e4c,null));};exports['update']=function(_0x24629d,_0x2307a2){if(_0x24629d[_0xc271('0x58')]['id']){delete _0x24629d['body']['id'];}return db[_0xc271('0x3b')][_0xc271('0x56')]({'where':{'id':_0x24629d[_0xc271('0x54')]['id']}})[_0xc271('0x20')](handleEntityNotFound(_0x2307a2,null))['then'](saveUpdates(_0x24629d[_0xc271('0x58')],null))['then'](respondWithResult(_0x2307a2,null))[_0xc271('0x2b')](handleError(_0x2307a2,null));};exports['destroy']=function(_0x1dd861,_0x13bc01){return db[_0xc271('0x3b')][_0xc271('0x56')]({'where':{'id':_0x1dd861[_0xc271('0x54')]['id']}})[_0xc271('0x20')](handleEntityNotFound(_0x13bc01,null))['then'](removeEntity(_0x13bc01,null))[_0xc271('0x2b')](handleError(_0x13bc01,null));};exports[_0xc271('0x5e')]=function(_0x21aa6c,_0x3ad13a){return db['ChatQueue'][_0xc271('0x5e')]()[_0xc271('0x20')](respondWithResult(_0x3ad13a,null))[_0xc271('0x2b')](handleError(_0x3ad13a,null));};exports[_0xc271('0x5f')]=function(_0x41e9eb,_0x3aa4ce,_0x8d9bad){var _0x365279={'raw':!![],'where':{}},_0x3d8c66={},_0x541c70;return db[_0xc271('0x3b')]['findOne']({'where':{'id':_0x41e9eb['params']['id']}})['then'](handleEntityNotFound(_0x3aa4ce,null))[_0xc271('0x20')](function(_0x41c6b6){if(_0x41c6b6){_0x541c70=_0x41c6b6[_0xc271('0x5a')]({'plain':!![]});_0x3d8c66[_0xc271('0x3d')]=_[_0xc271('0x3f')](db[_0xc271('0x60')][_0xc271('0x55')]);_0x3d8c66[_0xc271('0x3e')]=_[_0xc271('0x3f')](_0x41e9eb[_0xc271('0x3e')]);_0x3d8c66['filters']=_['intersection'](_0x3d8c66['model'],_0x3d8c66[_0xc271('0x3e')]);_0x365279[_0xc271('0x41')]=_[_0xc271('0x40')](_0x3d8c66['model'],qs[_0xc271('0x42')](_0x41e9eb[_0xc271('0x3e')][_0xc271('0x42')]));_0x365279[_0xc271('0x41')]=_0x365279['attributes'][_0xc271('0x43')]?_0x365279[_0xc271('0x41')]:_0x3d8c66['model'];if(!_0x41e9eb['query'][_0xc271('0x44')](_0xc271('0x45'))){_0x365279[_0xc271('0x31')]=qs[_0xc271('0x31')](_0x41e9eb['query'][_0xc271('0x31')]);_0x365279[_0xc271('0x30')]=qs[_0xc271('0x30')](_0x41e9eb[_0xc271('0x3e')][_0xc271('0x30')]);}_0x365279[_0xc271('0x46')]=qs[_0xc271('0x47')](_0x41e9eb['query'][_0xc271('0x47')]);_0x365279['where']=qs[_0xc271('0x49')](_[_0xc271('0x61')](_0x41e9eb['query'],_0x3d8c66[_0xc271('0x49')]));_0x365279[_0xc271('0x48')][_0xc271('0x62')]=_0x41c6b6['id'];if(_0x41e9eb['query'][_0xc271('0x4c')]){_0x365279['where']=_['merge'](_0x365279[_0xc271('0x48')],{'$or':_['map'](_0x365279[_0xc271('0x41')],function(_0x443298){var _0x2293c7={};_0x2293c7[_0x443298]={'$like':'%'+_0x41e9eb[_0xc271('0x3e')][_0xc271('0x4c')]+'%'};return _0x2293c7;})});}_0x365279=_[_0xc271('0x4a')]({},_0x365279,_0x41e9eb[_0xc271('0x4d')]);return db[_0xc271('0x60')][_0xc271('0x51')](_0x365279);}})[_0xc271('0x20')](function(_0x2e2309){if(_0x2e2309){return db[_0xc271('0x63')][_0xc271('0x64')]({'where':{'id':_[_0xc271('0x3a')](_0x2e2309,_0xc271('0x65')),'role':_0xc271('0x66')},'attributes':['id',_0xc271('0x38'),_0xc271('0x67'),_0xc271('0x68'),'createdAt']});}})[_0xc271('0x20')](function(_0x4320b4){if(_0x4320b4){return{'count':_0x4320b4[_0xc271('0x4e')],'rows':_[_0xc271('0x3a')](_0x4320b4['rows'],function(_0x72b2cd){return{'membername':_0x72b2cd[_0xc271('0x38')],'UserId':_0x72b2cd['id'],'queue_name':_0x541c70[_0xc271('0x38')],'ChatQueueId':_0x541c70['id'],'interface':util[_0xc271('0x69')]('%s/%s','SIP',_0x72b2cd[_0xc271('0x38')]),'penalty':0x0,'paused':_0x72b2cd['chatPause'],'createdAt':_0x72b2cd[_0xc271('0x6a')],'updatedAt':_0x72b2cd[_0xc271('0x68')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x3aa4ce,_0x365279))[_0xc271('0x2b')](handleError(_0x3aa4ce,null));};exports[_0xc271('0x6b')]=function(_0x563781,_0x2a207b,_0x20600e){var _0x1c0f1c={};var _0x21b397={};var _0x148d7c;var _0x3c0f47;return db[_0xc271('0x3b')][_0xc271('0x6c')]({'where':{'id':_0x563781[_0xc271('0x54')]['id']}})[_0xc271('0x20')](handleEntityNotFound(_0x2a207b,null))['then'](function(_0x204a0b){if(_0x204a0b){_0x148d7c=_0x204a0b;_0x21b397[_0xc271('0x3d')]=_[_0xc271('0x3f')](db[_0xc271('0x6d')][_0xc271('0x55')]);_0x21b397[_0xc271('0x3e')]=_[_0xc271('0x3f')](_0x563781[_0xc271('0x3e')]);_0x21b397['filters']=_[_0xc271('0x40')](_0x21b397['model'],_0x21b397['query']);_0x1c0f1c[_0xc271('0x41')]=_[_0xc271('0x40')](_0x21b397[_0xc271('0x3d')],qs[_0xc271('0x42')](_0x563781['query'][_0xc271('0x42')]));_0x1c0f1c[_0xc271('0x41')]=_0x1c0f1c[_0xc271('0x41')][_0xc271('0x43')]?_0x1c0f1c['attributes']:_0x21b397[_0xc271('0x3d')];_0x1c0f1c['order']=qs[_0xc271('0x47')](_0x563781[_0xc271('0x3e')][_0xc271('0x47')]);_0x1c0f1c[_0xc271('0x48')]=qs[_0xc271('0x49')](_[_0xc271('0x61')](_0x563781[_0xc271('0x3e')],_0x21b397['filters']));if(_0x563781[_0xc271('0x3e')][_0xc271('0x4c')]){_0x1c0f1c[_0xc271('0x48')]=_[_0xc271('0x4a')](_0x1c0f1c[_0xc271('0x48')],{'$or':_[_0xc271('0x3a')](_0x1c0f1c[_0xc271('0x41')],function(_0x58d51f){var _0xe975cf={};_0xe975cf[_0x58d51f]={'$like':'%'+_0x563781[_0xc271('0x3e')][_0xc271('0x4c')]+'%'};return _0xe975cf;})});}_0x1c0f1c=_[_0xc271('0x4a')]({},_0x1c0f1c,_0x563781[_0xc271('0x4d')]);return _0x148d7c['getTeams'](_0x1c0f1c);}})[_0xc271('0x20')](function(_0x184cf3){if(_0x184cf3){_0x3c0f47=_0x184cf3[_0xc271('0x43')];if(!_0x563781[_0xc271('0x3e')][_0xc271('0x44')]('nolimit')){_0x1c0f1c[_0xc271('0x31')]=qs[_0xc271('0x31')](_0x563781[_0xc271('0x3e')][_0xc271('0x31')]);_0x1c0f1c[_0xc271('0x30')]=qs[_0xc271('0x30')](_0x563781['query']['offset']);}return _0x148d7c[_0xc271('0x6b')](_0x1c0f1c);}})[_0xc271('0x20')](function(_0x235dac){if(_0x235dac){return _0x235dac?{'count':_0x3c0f47,'rows':_0x235dac}:null;}})[_0xc271('0x20')](respondWithResult(_0x2a207b,null))['catch'](handleError(_0x2a207b,null));};exports[_0xc271('0x6e')]=function(_0x24562d,_0xd5cc13,_0xd91153){var _0x1039d1=_0x24562d[_0xc271('0x58')][_0xc271('0x6f')];return db[_0xc271('0x6d')][_0xc271('0x51')]({'where':{'id':_0x1039d1},'attributes':['id'],'include':[{'model':db[_0xc271('0x63')],'as':'Agents','attributes':['id',_0xc271('0x38'),_0xc271('0x70'),_0xc271('0x71'),'interface'],'raw':!![]}]})[_0xc271('0x20')](function(_0x35e861){if(_0x35e861){var _0x2db60d=_[_0xc271('0x72')](_0x35e861,function(_0x59b87d){var _0x2758f1=_0x59b87d[_0xc271('0x5a')]({'plain':!![]});return _0x2758f1[_0xc271('0x73')];});return db['ChatQueue'][_0xc271('0x56')]({'where':{'id':_0x24562d[_0xc271('0x54')]['id']}})['then'](function(_0x511c61){return db[_0xc271('0x74')]['transaction'](function(_0xf89ff){return _0x511c61[_0xc271('0x6e')](_0x1039d1,{'transaction':_0xf89ff})[_0xc271('0x20')](function(){return BPromise['each'](_0x2db60d,function(_0x2450ba){return db[_0xc271('0x60')][_0xc271('0x75')]({'where':{'UserId':_0x2450ba['id'],'ChatQueueId':_0x24562d['params']['id']},'transaction':_0xf89ff});});})[_0xc271('0x20')](function(){_0x2db60d[_0xc271('0x76')](function(_0x5816de){socket[_0xc271('0x77')](_0xc271('0x78'),{'UserId':_0x5816de['id'],'ChatQueueId':_0x511c61['id']});});});});});}})[_0xc271('0x20')](respondWithStatusCode(_0xd5cc13,null))['catch'](handleError(_0xd5cc13,null));};exports[_0xc271('0x79')]=function(_0x419542,_0x41898a,_0x2d8832){return db[_0xc271('0x6d')][_0xc271('0x51')]({'where':{'id':_0x419542[_0xc271('0x3e')][_0xc271('0x6f')]},'attributes':['id'],'include':[{'model':db[_0xc271('0x63')],'as':_0xc271('0x73'),'attributes':['id'],'raw':!![]}]})[_0xc271('0x20')](handleEntityNotFound(_0x41898a,null))[_0xc271('0x20')](function(_0x2be4fc){var _0x337646=_['map'](_0x2be4fc,'id');var _0x44e554=[];var _0x5603cb=[];var _0x5a7f32=squel[_0xc271('0x7a')]();_0x5a7f32[_0xc271('0x7b')](_0xc271('0x7c'))[_0xc271('0x7d')](_0xc271('0x7e'),'tq')[_0xc271('0x7f')](_0xc271('0x80'),'ut',_0xc271('0x81'))[_0xc271('0x48')](_0xc271('0x82'),_0x419542[_0xc271('0x54')]['id']);for(var _0x34d1c6=0x0;_0x34d1c6<_0x2be4fc[_0xc271('0x43')];_0x34d1c6+=0x1){let _0x56a3d2=_0x2be4fc[_0x34d1c6];for(var _0xd69d30=0x0;_0xd69d30<_0x56a3d2[_0xc271('0x73')]['length'];_0xd69d30+=0x1){let _0x3b5cc1=_0x56a3d2[_0xc271('0x73')][_0xd69d30];var _0x2957f8=_0x5a7f32[_0xc271('0x83')]();_0x2957f8[_0xc271('0x48')]('ut.UserId\x20=\x20?',_0x3b5cc1['id']);_0x5603cb[_0xc271('0x84')](db[_0xc271('0x74')]['query'](_0x2957f8['toString'](),{'type':db[_0xc271('0x74')][_0xc271('0x85')][_0xc271('0x86')]})[_0xc271('0x20')](function(_0xe647e3){if(_0xe647e3[_0xc271('0x43')]===0x1){return _0x3b5cc1['id'];}else{var _0x56e40b=_[_0xc271('0x87')](_['map'](_0xe647e3,'TeamId'),function(_0x186287){return _['includes'](_0x337646,_0x186287);});if(_0x56e40b){return _0x3b5cc1['id'];}}}));}}return BPromise[_0xc271('0x88')](_0x5603cb)[_0xc271('0x20')](function(_0x57f5cf){_0x44e554=_(_0x44e554)['union'](_0x57f5cf)[_0xc271('0x89')]()[_0xc271('0x8a')]();return db[_0xc271('0x3b')]['find']({'where':{'id':_0x419542['params']['id']}})[_0xc271('0x20')](function(_0x40540a){return db[_0xc271('0x74')][_0xc271('0x8b')](function(_0x497be3){return _0x40540a['removeTeams'](_0x419542[_0xc271('0x3e')][_0xc271('0x6f')],{'transaction':_0x497be3})['then'](function(){if(!_['isEmpty'](_0x44e554)){return _0x40540a[_0xc271('0x8c')](_0x44e554,{'transaction':_0x497be3});}})[_0xc271('0x20')](function(){_0x44e554[_0xc271('0x76')](function(_0x2ff7dc){socket[_0xc271('0x77')](_0xc271('0x8d'),{'UserId':_0x2ff7dc,'ChatQueueId':_0x40540a['id']});});});});});});})[_0xc271('0x20')](respondWithStatusCode(_0x41898a,null))[_0xc271('0x2b')](handleError(_0x41898a,null));};exports[_0xc271('0x8e')]=function(_0x244c1b,_0x1fc3a4,_0x53d34f){return db[_0xc271('0x3b')][_0xc271('0x56')]({'where':{'id':_0x244c1b[_0xc271('0x54')]['id']}})[_0xc271('0x20')](handleEntityNotFound(_0x1fc3a4,null))[_0xc271('0x20')](function(_0xcda51a){if(_0xcda51a){return _0xcda51a['addAgents'](_0x244c1b[_0xc271('0x58')][_0xc271('0x6f')],_['omit'](_0x244c1b['body'],[_0xc271('0x6f'),'id'])||{})['spread'](function(_0x57e62b){for(var _0x4d0061=0x0;_0x4d0061<_0x244c1b['body']['ids'][_0xc271('0x43')];_0x4d0061+=0x1){socket[_0xc271('0x77')]('userChatQueue:save',{'UserId':_0x244c1b[_0xc271('0x58')][_0xc271('0x6f')][_0x4d0061],'ChatQueueId':_0x244c1b['params']['id']});}return _0x57e62b;});}})[_0xc271('0x20')](respondWithResult(_0x1fc3a4,null))[_0xc271('0x2b')](handleError(_0x1fc3a4,null));};exports['removeAgents']=function(_0x24e482,_0x4a1bcf,_0x518194){return db['ChatQueue'][_0xc271('0x56')]({'where':{'id':_0x24e482[_0xc271('0x54')]['id']}})['then'](handleEntityNotFound(_0x4a1bcf,null))[_0xc271('0x20')](function(_0x4f5e71){if(_0x4f5e71){return _0x4f5e71[_0xc271('0x8c')](_0x24e482[_0xc271('0x3e')]['ids'])[_0xc271('0x20')](function(){if(_[_0xc271('0x8f')](_0x24e482[_0xc271('0x3e')][_0xc271('0x6f')])){for(var _0x2bcbcb=0x0;_0x2bcbcb<_0x24e482[_0xc271('0x3e')]['ids'][_0xc271('0x43')];_0x2bcbcb+=0x1){socket[_0xc271('0x77')](_0xc271('0x8d'),{'UserId':Number(_0x24e482['query'][_0xc271('0x6f')][_0x2bcbcb]),'ChatQueueId':Number(_0x24e482[_0xc271('0x54')]['id'])});}}else{socket['emit'](_0xc271('0x8d'),{'UserId':Number(_0x24e482[_0xc271('0x3e')]['ids']),'ChatQueueId':Number(_0x24e482[_0xc271('0x54')]['id'])});}});}})[_0xc271('0x20')](respondWithStatusCode(_0x4a1bcf,null))[_0xc271('0x2b')](handleError(_0x4a1bcf,null));};exports[_0xc271('0x90')]=function(_0x5cb9e3,_0x5ee553,_0x152a9e){var _0x6da6a={};var _0x3bdfd0={};var _0x5b2519;var _0x310f2b;return db[_0xc271('0x3b')][_0xc271('0x6c')]({'where':{'id':_0x5cb9e3['params']['id']}})[_0xc271('0x20')](handleEntityNotFound(_0x5ee553,null))[_0xc271('0x20')](function(_0x3528e5){if(_0x3528e5){_0x5b2519=_0x3528e5;_0x3bdfd0[_0xc271('0x3d')]=_[_0xc271('0x3f')](db[_0xc271('0x63')]['rawAttributes']);_0x3bdfd0[_0xc271('0x3e')]=_[_0xc271('0x3f')](_0x5cb9e3[_0xc271('0x3e')]);_0x3bdfd0[_0xc271('0x49')]=_['intersection'](_0x3bdfd0[_0xc271('0x3d')],_0x3bdfd0[_0xc271('0x3e')]);_0x6da6a['attributes']=_[_0xc271('0x40')](_0x3bdfd0[_0xc271('0x3d')],qs['fields'](_0x5cb9e3[_0xc271('0x3e')]['fields']));_0x6da6a[_0xc271('0x41')]=_0x6da6a['attributes'][_0xc271('0x43')]?_0x6da6a[_0xc271('0x41')]:_0x3bdfd0[_0xc271('0x3d')];_0x6da6a['order']=qs[_0xc271('0x47')](_0x5cb9e3['query'][_0xc271('0x47')]);_0x6da6a['where']=qs[_0xc271('0x49')](_[_0xc271('0x61')](_0x5cb9e3[_0xc271('0x3e')],_0x3bdfd0[_0xc271('0x49')]));if(_0x5cb9e3['query'][_0xc271('0x4c')]){_0x6da6a[_0xc271('0x48')]=_['merge'](_0x6da6a[_0xc271('0x48')],{'$or':_[_0xc271('0x3a')](_0x6da6a[_0xc271('0x41')],function(_0x432b7d){var _0x23e9e3={};_0x23e9e3[_0x432b7d]={'$like':'%'+_0x5cb9e3[_0xc271('0x3e')][_0xc271('0x4c')]+'%'};return _0x23e9e3;})});}_0x6da6a=_[_0xc271('0x4a')]({},_0x6da6a,_0x5cb9e3[_0xc271('0x4d')]);return _0x5b2519[_0xc271('0x90')](_0x6da6a);}})[_0xc271('0x20')](function(_0x3345b3){if(_0x3345b3){_0x310f2b=_0x3345b3[_0xc271('0x43')];if(!_0x5cb9e3[_0xc271('0x3e')][_0xc271('0x44')](_0xc271('0x45'))){_0x6da6a['limit']=qs['limit'](_0x5cb9e3[_0xc271('0x3e')][_0xc271('0x31')]);_0x6da6a['offset']=qs[_0xc271('0x30')](_0x5cb9e3[_0xc271('0x3e')][_0xc271('0x30')]);}return _0x5b2519[_0xc271('0x90')](_0x6da6a);}})[_0xc271('0x20')](function(_0x3d3a98){if(_0x3d3a98){return _0x3d3a98?{'count':_0x310f2b,'rows':_0x3d3a98}:null;}})[_0xc271('0x20')](respondWithResult(_0x5ee553,null))['catch'](handleError(_0x5ee553,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 077069a..25b8152 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 _0x5f2f=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatQueue','setMaxListeners','save','update'];(function(_0x1aec99,_0x54b962){var _0x400114=function(_0xab69c1){while(--_0xab69c1){_0x1aec99['push'](_0x1aec99['shift']());}};_0x400114(++_0x54b962);}(_0x5f2f,0x73));var _0xf5f2=function(_0x5a7be5,_0x4aa6a6){_0x5a7be5=_0x5a7be5-0x0;var _0xb0cb13=_0x5f2f[_0x5a7be5];return _0xb0cb13;};'use strict';var EventEmitter=require(_0xf5f2('0x0'));var ChatQueue=require(_0xf5f2('0x1'))['db'][_0xf5f2('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xf5f2('0x3')](0x0);var events={'afterCreate':_0xf5f2('0x4'),'afterUpdate':_0xf5f2('0x5'),'afterDestroy':_0xf5f2('0x6')};function emitEvent(_0x107cf){return function(_0x501fbd,_0x4854b6,_0x1665c7){ChatQueueEvents[_0xf5f2('0x7')](_0x107cf+':'+_0x501fbd['id'],_0x501fbd);ChatQueueEvents[_0xf5f2('0x7')](_0x107cf,_0x501fbd);_0x1665c7(null);};}for(var e in events){if(events[_0xf5f2('0x8')](e)){var event=events[e];ChatQueue[_0xf5f2('0x9')](e,emitEvent(event));}}module[_0xf5f2('0xa')]=ChatQueueEvents; \ No newline at end of file +var _0x5f2f=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatQueue','setMaxListeners','save','update'];(function(_0x583533,_0x421a42){var _0x239244=function(_0x625dc8){while(--_0x625dc8){_0x583533['push'](_0x583533['shift']());}};_0x239244(++_0x421a42);}(_0x5f2f,0x73));var _0xf5f2=function(_0x1046ef,_0xcecd0e){_0x1046ef=_0x1046ef-0x0;var _0x3d7d8b=_0x5f2f[_0x1046ef];return _0x3d7d8b;};'use strict';var EventEmitter=require(_0xf5f2('0x0'));var ChatQueue=require(_0xf5f2('0x1'))['db'][_0xf5f2('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xf5f2('0x3')](0x0);var events={'afterCreate':_0xf5f2('0x4'),'afterUpdate':_0xf5f2('0x5'),'afterDestroy':_0xf5f2('0x6')};function emitEvent(_0x107cf){return function(_0x501fbd,_0x4854b6,_0x1665c7){ChatQueueEvents[_0xf5f2('0x7')](_0x107cf+':'+_0x501fbd['id'],_0x501fbd);ChatQueueEvents[_0xf5f2('0x7')](_0x107cf,_0x501fbd);_0x1665c7(null);};}for(var e in events){if(events[_0xf5f2('0x8')](e)){var event=events[e];ChatQueue[_0xf5f2('0x9')](e,emitEvent(event));}}module[_0xf5f2('0xa')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 3ba0cc9..d064197 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 _0x7c7b=['moment','bluebird','path','../../config/environment','./chatQueue.attributes','exports','ChatQueue','chat_queues','util','../../config/logger','api'];(function(_0x489b87,_0xd51c93){var _0x1823b6=function(_0x451c70){while(--_0x451c70){_0x489b87['push'](_0x489b87['shift']());}};_0x1823b6(++_0xd51c93);}(_0x7c7b,0x81));var _0xb7c7=function(_0x53814e,_0x5eaf21){_0x53814e=_0x53814e-0x0;var _0x206d91=_0x7c7b[_0x53814e];return _0x206d91;};'use strict';var _=require('lodash');var util=require(_0xb7c7('0x0'));var logger=require(_0xb7c7('0x1'))(_0xb7c7('0x2'));var moment=require(_0xb7c7('0x3'));var BPromise=require(_0xb7c7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb7c7('0x5'));var rimraf=require('rimraf');var config=require(_0xb7c7('0x6'));var attributes=require(_0xb7c7('0x7'));module[_0xb7c7('0x8')]=function(_0x4d806f,_0x230fd2){return _0x4d806f['define'](_0xb7c7('0x9'),attributes,{'tableName':_0xb7c7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc5fc=['path','rimraf','./chatQueue.attributes','exports','define','ChatQueue','chat_queues','../../config/logger','moment','request-promise'];(function(_0x5638be,_0x252354){var _0x3fff51=function(_0x3178f1){while(--_0x3178f1){_0x5638be['push'](_0x5638be['shift']());}};_0x3fff51(++_0x252354);}(_0xc5fc,0x16f));var _0xcc5f=function(_0x228a46,_0x268f20){_0x228a46=_0x228a46-0x0;var _0x565a4d=_0xc5fc[_0x228a46];return _0x565a4d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xcc5f('0x0'))('api');var moment=require(_0xcc5f('0x1'));var BPromise=require('bluebird');var rp=require(_0xcc5f('0x2'));var fs=require('fs');var path=require(_0xcc5f('0x3'));var rimraf=require(_0xcc5f('0x4'));var config=require('../../config/environment');var attributes=require(_0xcc5f('0x5'));module[_0xcc5f('0x6')]=function(_0x3a87d8,_0x5f2376){return _0x3a87d8[_0xcc5f('0x7')](_0xcc5f('0x8'),attributes,{'tableName':_0xcc5f('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 8d915fa..49e75a4 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 _0xbcff=['limit','include','map','model','then','find','ShowChatQueue','stringify','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','defaults','redis','socket.io-emitter','./chatQueue.socket','register','request','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetChatQueue','ChatQueue','findAll','options','raw','where','attributes'];(function(_0x488c16,_0x2dcab7){var _0x57ae25=function(_0x2d7f1f){while(--_0x2d7f1f){_0x488c16['push'](_0x488c16['shift']());}};_0x57ae25(++_0x2dcab7);}(_0xbcff,0x12e));var _0xfbcf=function(_0x1a5d05,_0x432575){_0x1a5d05=_0x1a5d05-0x0;var _0x11c7d6=_0xbcff[_0x1a5d05];return _0x11c7d6;};'use strict';var _=require(_0xfbcf('0x0'));var util=require(_0xfbcf('0x1'));var moment=require(_0xfbcf('0x2'));var BPromise=require('bluebird');var rs=require(_0xfbcf('0x3'));var fs=require('fs');var Redis=require(_0xfbcf('0x4'));var db=require(_0xfbcf('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xfbcf('0x6'))(_0xfbcf('0x7'));var config=require(_0xfbcf('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xfbcf('0x9')][_0xfbcf('0xa')]({'port':0x232a});config['redis']=_[_0xfbcf('0xb')](config[_0xfbcf('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xfbcf('0xd'))(new Redis(config['redis']));require(_0xfbcf('0xe'))[_0xfbcf('0xf')](socket);function respondWithRpcPromise(_0x5eb1b8,_0x59fdda,_0x307226){return new BPromise(function(_0x3a960d,_0x1fbe45){return client[_0xfbcf('0x10')](_0x5eb1b8,_0x307226)['then'](function(_0x117f2c){logger[_0xfbcf('0x11')](_0xfbcf('0x12'),_0x59fdda,_0xfbcf('0x13'));logger[_0xfbcf('0x14')](_0xfbcf('0x15'),_0x59fdda,_0xfbcf('0x13'),JSON['stringify'](_0x117f2c));if(_0x117f2c[_0xfbcf('0x16')]){if(_0x117f2c['error'][_0xfbcf('0x17')]===0x1f4){logger[_0xfbcf('0x16')](_0xfbcf('0x12'),_0x59fdda,_0x117f2c[_0xfbcf('0x16')][_0xfbcf('0x18')]);return _0x1fbe45(_0x117f2c[_0xfbcf('0x16')][_0xfbcf('0x18')]);}logger[_0xfbcf('0x16')](_0xfbcf('0x12'),_0x59fdda,_0x117f2c['error'][_0xfbcf('0x18')]);return _0x3a960d(_0x117f2c[_0xfbcf('0x16')][_0xfbcf('0x18')]);}else{logger[_0xfbcf('0x11')](_0xfbcf('0x12'),_0x59fdda,_0xfbcf('0x13'));_0x3a960d(_0x117f2c[_0xfbcf('0x19')][_0xfbcf('0x18')]);}})[_0xfbcf('0x1a')](function(_0xef5fcf){logger[_0xfbcf('0x16')]('ChatQueue,\x20%s,\x20%s',_0x59fdda,_0xef5fcf);_0x1fbe45(_0xef5fcf);});});}exports[_0xfbcf('0x1b')]=function(_0x3a5785){var _0x54f09b=this;return new Promise(function(_0x42b15f,_0x1fbbef){return db[_0xfbcf('0x1c')][_0xfbcf('0x1d')]({'raw':_0x3a5785[_0xfbcf('0x1e')]?_0x3a5785[_0xfbcf('0x1e')][_0xfbcf('0x1f')]===undefined?!![]:![]:!![],'where':_0x3a5785['options']?_0x3a5785[_0xfbcf('0x1e')][_0xfbcf('0x20')]||null:null,'attributes':_0x3a5785['options']?_0x3a5785[_0xfbcf('0x1e')][_0xfbcf('0x21')]||null:null,'limit':_0x3a5785['options']?_0x3a5785[_0xfbcf('0x1e')][_0xfbcf('0x22')]||null:null,'include':_0x3a5785[_0xfbcf('0x1e')]?_0x3a5785[_0xfbcf('0x1e')][_0xfbcf('0x23')]?_['map'](_0x3a5785[_0xfbcf('0x1e')][_0xfbcf('0x23')],function(_0x1f94de){return{'model':db[_0x1f94de['model']],'as':_0x1f94de['as'],'attributes':_0x1f94de['attributes'],'include':_0x1f94de[_0xfbcf('0x23')]?_[_0xfbcf('0x24')](_0x1f94de['include'],function(_0x43a263){return{'model':db[_0x43a263[_0xfbcf('0x25')]],'as':_0x43a263['as'],'attributes':_0x43a263['attributes'],'include':_0x43a263[_0xfbcf('0x23')]?_[_0xfbcf('0x24')](_0x43a263[_0xfbcf('0x23')],function(_0x4db905){return{'model':db[_0x4db905['model']],'as':_0x4db905['as'],'attributes':_0x4db905[_0xfbcf('0x21')]};}):[]};}):[]};}):[]:[]})[_0xfbcf('0x26')](function(_0x35fab2){logger[_0xfbcf('0x11')](_0xfbcf('0x1b'),_0x3a5785);logger[_0xfbcf('0x14')](_0xfbcf('0x1b'),_0x3a5785,JSON['stringify'](_0x35fab2));_0x42b15f(_0x35fab2);})[_0xfbcf('0x1a')](function(_0x24fefa){logger['error'](_0xfbcf('0x1b'),_0x24fefa[_0xfbcf('0x18')],_0x3a5785);_0x1fbbef(_0x54f09b[_0xfbcf('0x16')](0x1f4,_0x24fefa[_0xfbcf('0x18')]));});});};exports['ShowChatQueue']=function(_0x30beaa){var _0x4240cf=this;return new Promise(function(_0x58fa0d,_0xad39a5){return db[_0xfbcf('0x1c')][_0xfbcf('0x27')]({'raw':_0x30beaa[_0xfbcf('0x1e')]?_0x30beaa[_0xfbcf('0x1e')][_0xfbcf('0x1f')]===undefined?!![]:![]:!![],'where':_0x30beaa[_0xfbcf('0x1e')]?_0x30beaa[_0xfbcf('0x1e')][_0xfbcf('0x20')]||null:null,'attributes':_0x30beaa['options']?_0x30beaa[_0xfbcf('0x1e')]['attributes']||null:null,'include':_0x30beaa[_0xfbcf('0x1e')]?_0x30beaa[_0xfbcf('0x1e')][_0xfbcf('0x23')]?_[_0xfbcf('0x24')](_0x30beaa['options'][_0xfbcf('0x23')],function(_0x4f8ba3){return{'model':db[_0x4f8ba3[_0xfbcf('0x25')]],'as':_0x4f8ba3['as'],'attributes':_0x4f8ba3[_0xfbcf('0x21')],'include':_0x4f8ba3[_0xfbcf('0x23')]?_[_0xfbcf('0x24')](_0x4f8ba3[_0xfbcf('0x23')],function(_0x1e5339){return{'model':db[_0x1e5339[_0xfbcf('0x25')]],'as':_0x1e5339['as'],'attributes':_0x1e5339[_0xfbcf('0x21')],'include':_0x1e5339[_0xfbcf('0x23')]?_[_0xfbcf('0x24')](_0x1e5339[_0xfbcf('0x23')],function(_0x4ec1b0){return{'model':db[_0x4ec1b0[_0xfbcf('0x25')]],'as':_0x4ec1b0['as'],'attributes':_0x4ec1b0[_0xfbcf('0x21')]};}):[]};}):[]};}):[]:[]})[_0xfbcf('0x26')](function(_0x46c8a6){logger['info'](_0xfbcf('0x28'),_0x30beaa);logger[_0xfbcf('0x14')]('ShowChatQueue',_0x30beaa,JSON[_0xfbcf('0x29')](_0x46c8a6));_0x58fa0d(_0x46c8a6);})['catch'](function(_0x5ed4be){logger[_0xfbcf('0x16')](_0xfbcf('0x28'),_0x5ed4be['message'],_0x30beaa);_0xad39a5(_0x4240cf[_0xfbcf('0x16')](0x1f4,_0x5ed4be['message']));});});}; \ No newline at end of file +var _0x4fc2=['rpc','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','./chatQueue.socket','request','then','ChatQueue,\x20%s,\x20%s','request\x20sent','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetChatQueue','ChatQueue','options','raw','where','attributes','limit','include','map','model','ShowChatQueue','debug','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x1e82bc,_0x592e92){var _0x2c04ba=function(_0x18d17e){while(--_0x18d17e){_0x1e82bc['push'](_0x1e82bc['shift']());}};_0x2c04ba(++_0x592e92);}(_0x4fc2,0x111));var _0x24fc=function(_0xd4e5fb,_0x4b32f5){_0xd4e5fb=_0xd4e5fb-0x0;var _0x287ec5=_0x4fc2[_0xd4e5fb];return _0x287ec5;};'use strict';var _=require(_0x24fc('0x0'));var util=require(_0x24fc('0x1'));var moment=require(_0x24fc('0x2'));var BPromise=require(_0x24fc('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x24fc('0x4'));var db=require(_0x24fc('0x5'))['db'];var utils=require(_0x24fc('0x6'));var logger=require('../../config/logger')(_0x24fc('0x7'));var config=require(_0x24fc('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x24fc('0x9')][_0x24fc('0xa')]({'port':0x232a});config['redis']=_[_0x24fc('0xb')](config[_0x24fc('0xc')],{'host':_0x24fc('0xd'),'port':0x18eb});var socket=require(_0x24fc('0xe'))(new Redis(config[_0x24fc('0xc')]));require(_0x24fc('0xf'))['register'](socket);function respondWithRpcPromise(_0x44caca,_0x1819a5,_0x1a4462){return new BPromise(function(_0x133438,_0x24998d){return client[_0x24fc('0x10')](_0x44caca,_0x1a4462)[_0x24fc('0x11')](function(_0x9a1673){logger['info'](_0x24fc('0x12'),_0x1819a5,_0x24fc('0x13'));logger['debug'](_0x24fc('0x14'),_0x1819a5,_0x24fc('0x13'),JSON[_0x24fc('0x15')](_0x9a1673));if(_0x9a1673[_0x24fc('0x16')]){if(_0x9a1673[_0x24fc('0x16')][_0x24fc('0x17')]===0x1f4){logger['error'](_0x24fc('0x12'),_0x1819a5,_0x9a1673[_0x24fc('0x16')][_0x24fc('0x18')]);return _0x24998d(_0x9a1673[_0x24fc('0x16')]['message']);}logger[_0x24fc('0x16')]('ChatQueue,\x20%s,\x20%s',_0x1819a5,_0x9a1673[_0x24fc('0x16')][_0x24fc('0x18')]);return _0x133438(_0x9a1673[_0x24fc('0x16')][_0x24fc('0x18')]);}else{logger[_0x24fc('0x19')]('ChatQueue,\x20%s,\x20%s',_0x1819a5,_0x24fc('0x13'));_0x133438(_0x9a1673[_0x24fc('0x1a')][_0x24fc('0x18')]);}})[_0x24fc('0x1b')](function(_0x4c5a43){logger[_0x24fc('0x16')](_0x24fc('0x12'),_0x1819a5,_0x4c5a43);_0x24998d(_0x4c5a43);});});}exports[_0x24fc('0x1c')]=function(_0x5b0516){var _0x32a57d=this;return new Promise(function(_0x36a771,_0xbf1d6b){return db[_0x24fc('0x1d')]['findAll']({'raw':_0x5b0516[_0x24fc('0x1e')]?_0x5b0516['options'][_0x24fc('0x1f')]===undefined?!![]:![]:!![],'where':_0x5b0516['options']?_0x5b0516[_0x24fc('0x1e')][_0x24fc('0x20')]||null:null,'attributes':_0x5b0516[_0x24fc('0x1e')]?_0x5b0516['options'][_0x24fc('0x21')]||null:null,'limit':_0x5b0516['options']?_0x5b0516[_0x24fc('0x1e')][_0x24fc('0x22')]||null:null,'include':_0x5b0516[_0x24fc('0x1e')]?_0x5b0516[_0x24fc('0x1e')][_0x24fc('0x23')]?_[_0x24fc('0x24')](_0x5b0516[_0x24fc('0x1e')][_0x24fc('0x23')],function(_0x168d98){return{'model':db[_0x168d98[_0x24fc('0x25')]],'as':_0x168d98['as'],'attributes':_0x168d98['attributes'],'include':_0x168d98[_0x24fc('0x23')]?_[_0x24fc('0x24')](_0x168d98[_0x24fc('0x23')],function(_0x5bb4c8){return{'model':db[_0x5bb4c8[_0x24fc('0x25')]],'as':_0x5bb4c8['as'],'attributes':_0x5bb4c8[_0x24fc('0x21')],'include':_0x5bb4c8[_0x24fc('0x23')]?_[_0x24fc('0x24')](_0x5bb4c8[_0x24fc('0x23')],function(_0x443796){return{'model':db[_0x443796['model']],'as':_0x443796['as'],'attributes':_0x443796[_0x24fc('0x21')]};}):[]};}):[]};}):[]:[]})[_0x24fc('0x11')](function(_0x3c99ed){logger[_0x24fc('0x19')](_0x24fc('0x1c'),_0x5b0516);logger['debug']('GetChatQueue',_0x5b0516,JSON['stringify'](_0x3c99ed));_0x36a771(_0x3c99ed);})[_0x24fc('0x1b')](function(_0x574ba3){logger[_0x24fc('0x16')](_0x24fc('0x1c'),_0x574ba3[_0x24fc('0x18')],_0x5b0516);_0xbf1d6b(_0x32a57d[_0x24fc('0x16')](0x1f4,_0x574ba3['message']));});});};exports[_0x24fc('0x26')]=function(_0x33f368){var _0x523c1f=this;return new Promise(function(_0xf46cd5,_0x1b174d){return db['ChatQueue']['find']({'raw':_0x33f368[_0x24fc('0x1e')]?_0x33f368['options'][_0x24fc('0x1f')]===undefined?!![]:![]:!![],'where':_0x33f368[_0x24fc('0x1e')]?_0x33f368['options'][_0x24fc('0x20')]||null:null,'attributes':_0x33f368[_0x24fc('0x1e')]?_0x33f368[_0x24fc('0x1e')][_0x24fc('0x21')]||null:null,'include':_0x33f368[_0x24fc('0x1e')]?_0x33f368[_0x24fc('0x1e')][_0x24fc('0x23')]?_[_0x24fc('0x24')](_0x33f368[_0x24fc('0x1e')]['include'],function(_0x320d2e){return{'model':db[_0x320d2e[_0x24fc('0x25')]],'as':_0x320d2e['as'],'attributes':_0x320d2e[_0x24fc('0x21')],'include':_0x320d2e[_0x24fc('0x23')]?_[_0x24fc('0x24')](_0x320d2e['include'],function(_0x56a9bd){return{'model':db[_0x56a9bd[_0x24fc('0x25')]],'as':_0x56a9bd['as'],'attributes':_0x56a9bd['attributes'],'include':_0x56a9bd[_0x24fc('0x23')]?_[_0x24fc('0x24')](_0x56a9bd[_0x24fc('0x23')],function(_0x41b408){return{'model':db[_0x41b408['model']],'as':_0x41b408['as'],'attributes':_0x41b408[_0x24fc('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x65771d){logger[_0x24fc('0x19')](_0x24fc('0x26'),_0x33f368);logger[_0x24fc('0x27')](_0x24fc('0x26'),_0x33f368,JSON['stringify'](_0x65771d));_0xf46cd5(_0x65771d);})[_0x24fc('0x1b')](function(_0x3f40cd){logger[_0x24fc('0x16')](_0x24fc('0x26'),_0x3f40cd['message'],_0x33f368);_0x1b174d(_0x523c1f[_0x24fc('0x16')](0x1f4,_0x3f40cd[_0x24fc('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index a2cb866..0df37b0 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(_0x4b4255,_0xf71f54){var _0x3ab4a6=function(_0x1eb42e){while(--_0x1eb42e){_0x4b4255['push'](_0x4b4255['shift']());}};_0x3ab4a6(++_0xf71f54);}(_0x0b0e,0x187));var _0xe0b0=function(_0x475191,_0x5bce86){_0x475191=_0x475191-0x0;var _0x189e96=_0x0b0e[_0x475191];return _0x189e96;};'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 _0x0b0e=['chatQueue:','./chatQueue.events','remove','emit','removeListener','register'];(function(_0x14ebbc,_0x5055b5){var _0x8dff=function(_0x5dd0c9){while(--_0x5dd0c9){_0x14ebbc['push'](_0x14ebbc['shift']());}};_0x8dff(++_0x5055b5);}(_0x0b0e,0x187));var _0xe0b0=function(_0x21bb2f,_0x4199b9){_0x21bb2f=_0x21bb2f-0x0;var _0x279b0e=_0x0b0e[_0x21bb2f];return _0x279b0e;};'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 diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index e910d63..1fe054e 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 _0x64c7=['Router','../../components/auth/service','../../components/interaction/service','./chatQueue.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','addTeams','post','update','delete','destroy','removeTeams','exports','multer','util','connect-timeout'];(function(_0x401920,_0x4e4877){var _0x68075e=function(_0x2bb848){while(--_0x2bb848){_0x401920['push'](_0x401920['shift']());}};_0x68075e(++_0x4e4877);}(_0x64c7,0x1b7));var _0x764c=function(_0x492535,_0x46524a){_0x492535=_0x492535-0x0;var _0x256620=_0x64c7[_0x492535];return _0x256620;};'use strict';var multer=require(_0x764c('0x0'));var util=require(_0x764c('0x1'));var path=require('path');var timeout=require(_0x764c('0x2'));var express=require('express');var router=express[_0x764c('0x3')]();var auth=require(_0x764c('0x4'));var interaction=require(_0x764c('0x5'));var config=require('../../config/environment');var controller=require(_0x764c('0x6'));router[_0x764c('0x7')]('/',auth[_0x764c('0x8')](),controller[_0x764c('0x9')]);router[_0x764c('0x7')](_0x764c('0xa'),auth[_0x764c('0x8')](),controller['describe']);router[_0x764c('0x7')](_0x764c('0xb'),auth['isAuthenticated'](),controller[_0x764c('0xc')]);router[_0x764c('0x7')](_0x764c('0xd'),auth[_0x764c('0x8')](),controller[_0x764c('0xe')]);router['get'](_0x764c('0xf'),auth['isAuthenticated'](),controller[_0x764c('0x10')]);router[_0x764c('0x7')](_0x764c('0x11'),auth[_0x764c('0x8')](),controller[_0x764c('0x12')]);router['post']('/',auth[_0x764c('0x8')](),controller['create']);router['post'](_0x764c('0xf'),auth['isAuthenticated'](),controller[_0x764c('0x13')]);router[_0x764c('0x14')](_0x764c('0x11'),auth['isAuthenticated'](),controller['addAgents']);router['put'](_0x764c('0xb'),auth['isAuthenticated'](),controller[_0x764c('0x15')]);router[_0x764c('0x16')](_0x764c('0xb'),auth[_0x764c('0x8')](),controller[_0x764c('0x17')]);router['delete'](_0x764c('0xf'),auth['isAuthenticated'](),controller[_0x764c('0x18')]);router[_0x764c('0x16')](_0x764c('0x11'),auth[_0x764c('0x8')](),controller['removeAgents']);module[_0x764c('0x19')]=router; \ No newline at end of file +var _0xe5a7=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','/:id/members','getMembers','getTeams','/:id/users','post','/:id/teams','addTeams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports','util','connect-timeout'];(function(_0x3a07f9,_0x410eba){var _0x55603b=function(_0x1ff325){while(--_0x1ff325){_0x3a07f9['push'](_0x3a07f9['shift']());}};_0x55603b(++_0x410eba);}(_0xe5a7,0x6a));var _0x7e5a=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xe5a7[_0x433a86];return _0x23000c;};'use strict';var multer=require('multer');var util=require(_0x7e5a('0x0'));var path=require('path');var timeout=require(_0x7e5a('0x1'));var express=require(_0x7e5a('0x2'));var router=express['Router']();var auth=require(_0x7e5a('0x3'));var interaction=require(_0x7e5a('0x4'));var config=require(_0x7e5a('0x5'));var controller=require('./chatQueue.controller');router[_0x7e5a('0x6')]('/',auth[_0x7e5a('0x7')](),controller['index']);router[_0x7e5a('0x6')](_0x7e5a('0x8'),auth['isAuthenticated'](),controller[_0x7e5a('0x9')]);router['get'](_0x7e5a('0xa'),auth[_0x7e5a('0x7')](),controller[_0x7e5a('0xb')]);router['get'](_0x7e5a('0xc'),auth[_0x7e5a('0x7')](),controller[_0x7e5a('0xd')]);router[_0x7e5a('0x6')]('/:id/teams',auth[_0x7e5a('0x7')](),controller[_0x7e5a('0xe')]);router['get'](_0x7e5a('0xf'),auth[_0x7e5a('0x7')](),controller['getAgents']);router[_0x7e5a('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0x7e5a('0x10')](_0x7e5a('0x11'),auth[_0x7e5a('0x7')](),controller[_0x7e5a('0x12')]);router[_0x7e5a('0x10')](_0x7e5a('0xf'),auth[_0x7e5a('0x7')](),controller[_0x7e5a('0x13')]);router[_0x7e5a('0x14')]('/:id',auth[_0x7e5a('0x7')](),controller[_0x7e5a('0x15')]);router[_0x7e5a('0x16')](_0x7e5a('0xa'),auth[_0x7e5a('0x7')](),controller[_0x7e5a('0x17')]);router['delete'](_0x7e5a('0x11'),auth[_0x7e5a('0x7')](),controller[_0x7e5a('0x18')]);router[_0x7e5a('0x16')](_0x7e5a('0xf'),auth[_0x7e5a('0x7')](),controller[_0x7e5a('0x19')]);module[_0x7e5a('0x1a')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 675d62f..cd8befe 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 _0xec5d=['exports','STRING','DATE','sequelize'];(function(_0x5d0a1e,_0x3c20c9){var _0x4c9d7d=function(_0x37c8f3){while(--_0x37c8f3){_0x5d0a1e['push'](_0x5d0a1e['shift']());}};_0x4c9d7d(++_0x3c20c9);}(_0xec5d,0xcf));var _0xdec5=function(_0x5a40d7,_0x41310a){_0x5a40d7=_0x5a40d7-0x0;var _0xd4a319=_0xec5d[_0x5a40d7];return _0xd4a319;};'use strict';var moment=require('moment');var Sequelize=require(_0xdec5('0x0'));module[_0xdec5('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xdec5('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xdec5('0x3')]},'acceptAt':{'type':Sequelize[_0xdec5('0x3')]},'exitAt':{'type':Sequelize[_0xdec5('0x3')]},'reason':{'type':Sequelize[_0xdec5('0x2')]}}; \ No newline at end of file +var _0x8d92=['DATE','moment','sequelize','exports','STRING'];(function(_0x23ca2f,_0x271c2b){var _0x4f4b51=function(_0x1cb6c0){while(--_0x1cb6c0){_0x23ca2f['push'](_0x23ca2f['shift']());}};_0x4f4b51(++_0x271c2b);}(_0x8d92,0xbf));var _0x28d9=function(_0x11a220,_0x4e470a){_0x11a220=_0x11a220-0x0;var _0x20d8fe=_0x8d92[_0x11a220];return _0x20d8fe;};'use strict';var moment=require(_0x28d9('0x0'));var Sequelize=require(_0x28d9('0x1'));module[_0x28d9('0x2')]={'uniqueid':{'type':Sequelize[_0x28d9('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x28d9('0x3')]},'joinAt':{'type':Sequelize[_0x28d9('0x4')]},'leaveAt':{'type':Sequelize[_0x28d9('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x28d9('0x4')]},'reason':{'type':Sequelize[_0x28d9('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 4b3ac39..af814f8 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 _0xb7e7=['desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','name','send','index','ChatQueueReport','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','rows','catch','show','params','length','find','create','body','describe','html-pdf','rimraf','fast-json-patch','moment','mustache','util','path','ejs','lodash','squel','jsforce'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb7e7,0x121));var _0x7b7e=function(_0x5d80de,_0x2cf15d){_0x5d80de=_0x5d80de-0x0;var _0x1c7556=_0xb7e7[_0x5d80de];return _0x1c7556;};'use strict';var pdf=require(_0x7b7e('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7b7e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7b7e('0x2'));var rp=require('request-promise');var moment=require(_0x7b7e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x7b7e('0x4'));var util=require(_0x7b7e('0x5'));var path=require(_0x7b7e('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x7b7e('0x7'));var fs=require('fs');var _=require(_0x7b7e('0x8'));var squel=require(_0x7b7e('0x9'));var crypto=require('crypto');var jsforce=require(_0x7b7e('0xa'));var deskjs=require(_0x7b7e('0xb'));var toCsv=require(_0x7b7e('0xc'));var querystring=require(_0x7b7e('0xd'));var Papa=require(_0x7b7e('0xe'));var Redis=require(_0x7b7e('0xf'));var authService=require(_0x7b7e('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x7b7e('0x11'));var hardwareService=require(_0x7b7e('0x12'));var logger=require(_0x7b7e('0x13'))(_0x7b7e('0x14'));var utils=require(_0x7b7e('0x15'));var config=require(_0x7b7e('0x16'));var db=require(_0x7b7e('0x17'))['db'];function respondWithStatusCode(_0x55620b,_0xaadda){_0xaadda=_0xaadda||0xcc;return function(_0x54d8ce){if(_0x54d8ce){return _0x55620b[_0x7b7e('0x18')](_0xaadda);}return _0x55620b[_0x7b7e('0x19')](_0xaadda)['end']();};}function respondWithResult(_0x422d3a,_0x5976ac){_0x5976ac=_0x5976ac||0xc8;return function(_0x4c6011){if(_0x4c6011){return _0x422d3a[_0x7b7e('0x19')](_0x5976ac)[_0x7b7e('0x1a')](_0x4c6011);}};}function respondWithFilteredResult(_0xf067da,_0x457ec5){return function(_0x3d2fb2){if(_0x3d2fb2){var _0x5703fd=_0x3d2fb2[_0x7b7e('0x1b')],_0x51baf6=_0x457ec5[_0x7b7e('0x1c')],_0xc7f087=_0x457ec5[_0x7b7e('0x1c')]+_0x457ec5[_0x7b7e('0x1d')],_0x36444d;if(_0xc7f087>=_0x5703fd){_0xc7f087=_0x5703fd;_0x36444d=0xc8;}else{_0x36444d=0xce;}_0xf067da[_0x7b7e('0x19')](_0x36444d);return _0xf067da[_0x7b7e('0x1e')](_0x7b7e('0x1f'),_0x51baf6+'-'+_0xc7f087+'/'+_0x5703fd)[_0x7b7e('0x1a')](_0x3d2fb2);}return null;};}function patchUpdates(_0x12e8e9){return function(_0x14f4fe){try{jsonpatch[_0x7b7e('0x20')](_0x14f4fe,_0x12e8e9,!![]);}catch(_0x3bec7d){return BPromise[_0x7b7e('0x21')](_0x3bec7d);}return _0x14f4fe[_0x7b7e('0x22')]();};}function saveUpdates(_0x3a7b8b,_0x49eddb){return function(_0x69262b){if(_0x69262b){return _0x69262b[_0x7b7e('0x23')](_0x3a7b8b)[_0x7b7e('0x24')](function(_0x4c0647){return _0x4c0647;});}return null;};}function removeEntity(_0x313122,_0xbf0cb3){return function(_0x14243b){if(_0x14243b){return _0x14243b[_0x7b7e('0x25')]()[_0x7b7e('0x24')](function(){_0x313122[_0x7b7e('0x19')](0xcc)[_0x7b7e('0x26')]();});}};}function handleEntityNotFound(_0x10a66a,_0x53bbb3){return function(_0x5d6215){if(!_0x5d6215){_0x10a66a['sendStatus'](0x194);}return _0x5d6215;};}function handleError(_0x26ee14,_0x22598e){_0x22598e=_0x22598e||0x1f4;return function(_0x23bfa3){logger['error'](_0x23bfa3['stack']);if(_0x23bfa3['name']){delete _0x23bfa3[_0x7b7e('0x27')];}_0x26ee14[_0x7b7e('0x19')](_0x22598e)[_0x7b7e('0x28')](_0x23bfa3);};}exports[_0x7b7e('0x29')]=function(_0x3ceaf5,_0x48fad1){var _0x6a1e71={},_0x21a15={},_0x4c46b8={'count':0x0,'rows':[]};var _0x57b9da=_['map'](db[_0x7b7e('0x2a')][_0x7b7e('0x2b')],function(_0x503625){return{'name':_0x503625[_0x7b7e('0x2c')],'type':_0x503625['type'][_0x7b7e('0x2d')]};});_0x21a15[_0x7b7e('0x2e')]=_[_0x7b7e('0x2f')](_0x57b9da,'name');_0x21a15[_0x7b7e('0x30')]=_[_0x7b7e('0x31')](_0x3ceaf5[_0x7b7e('0x30')]);_0x21a15[_0x7b7e('0x32')]=_[_0x7b7e('0x33')](_0x21a15['model'],_0x21a15[_0x7b7e('0x30')]);_0x6a1e71['attributes']=_[_0x7b7e('0x33')](_0x21a15[_0x7b7e('0x2e')],qs[_0x7b7e('0x34')](_0x3ceaf5[_0x7b7e('0x30')][_0x7b7e('0x34')]));_0x6a1e71[_0x7b7e('0x35')]=_0x6a1e71[_0x7b7e('0x35')]['length']?_0x6a1e71['attributes']:_0x21a15[_0x7b7e('0x2e')];if(!_0x3ceaf5[_0x7b7e('0x30')]['hasOwnProperty'](_0x7b7e('0x36'))){_0x6a1e71[_0x7b7e('0x1d')]=qs[_0x7b7e('0x1d')](_0x3ceaf5['query'][_0x7b7e('0x1d')]);_0x6a1e71[_0x7b7e('0x1c')]=qs[_0x7b7e('0x1c')](_0x3ceaf5[_0x7b7e('0x30')][_0x7b7e('0x1c')]);}_0x6a1e71[_0x7b7e('0x37')]=qs[_0x7b7e('0x38')](_0x3ceaf5[_0x7b7e('0x30')][_0x7b7e('0x38')]);_0x6a1e71[_0x7b7e('0x39')]=qs[_0x7b7e('0x32')](_[_0x7b7e('0x3a')](_0x3ceaf5[_0x7b7e('0x30')],_0x21a15[_0x7b7e('0x32')]),_0x57b9da);if(_0x3ceaf5[_0x7b7e('0x30')][_0x7b7e('0x3b')]){_0x6a1e71['where']=_[_0x7b7e('0x3c')](_0x6a1e71[_0x7b7e('0x39')],{'$or':_[_0x7b7e('0x2f')](_0x57b9da,function(_0x242609){if(_0x242609[_0x7b7e('0x3d')]!==_0x7b7e('0x3e')){var _0x7f15={};_0x7f15[_0x242609[_0x7b7e('0x27')]]={'$like':'%'+_0x3ceaf5[_0x7b7e('0x30')][_0x7b7e('0x3b')]+'%'};return _0x7f15;}})});}_0x6a1e71=_['merge']({},_0x6a1e71,_0x3ceaf5[_0x7b7e('0x3f')]);var _0x1fa75b={'where':_0x6a1e71[_0x7b7e('0x39')]};return db[_0x7b7e('0x2a')]['count'](_0x1fa75b)[_0x7b7e('0x24')](function(_0x35b31a){_0x4c46b8[_0x7b7e('0x1b')]=_0x35b31a;if(_0x3ceaf5['query']['includeAll']){_0x6a1e71[_0x7b7e('0x40')]=[{'all':!![]}];}return db['ChatQueueReport'][_0x7b7e('0x41')](_0x6a1e71);})[_0x7b7e('0x24')](function(_0x4de331){_0x4c46b8[_0x7b7e('0x42')]=_0x4de331;return _0x4c46b8;})[_0x7b7e('0x24')](respondWithFilteredResult(_0x48fad1,_0x6a1e71))[_0x7b7e('0x43')](handleError(_0x48fad1,null));};exports[_0x7b7e('0x44')]=function(_0x38d32f,_0x435de5){var _0xc888e4={'raw':!![],'where':{'id':_0x38d32f[_0x7b7e('0x45')]['id']}},_0x1d9bb9={};_0x1d9bb9['model']=_['keys'](db[_0x7b7e('0x2a')]['rawAttributes']);_0x1d9bb9[_0x7b7e('0x30')]=_['keys'](_0x38d32f['query']);_0x1d9bb9[_0x7b7e('0x32')]=_['intersection'](_0x1d9bb9[_0x7b7e('0x2e')],_0x1d9bb9['query']);_0xc888e4[_0x7b7e('0x35')]=_[_0x7b7e('0x33')](_0x1d9bb9[_0x7b7e('0x2e')],qs[_0x7b7e('0x34')](_0x38d32f['query'][_0x7b7e('0x34')]));_0xc888e4[_0x7b7e('0x35')]=_0xc888e4[_0x7b7e('0x35')][_0x7b7e('0x46')]?_0xc888e4[_0x7b7e('0x35')]:_0x1d9bb9[_0x7b7e('0x2e')];if(_0x38d32f['query']['includeAll']){_0xc888e4['include']=[{'all':!![]}];}_0xc888e4=_[_0x7b7e('0x3c')]({},_0xc888e4,_0x38d32f[_0x7b7e('0x3f')]);return db[_0x7b7e('0x2a')][_0x7b7e('0x47')](_0xc888e4)[_0x7b7e('0x24')](handleEntityNotFound(_0x435de5,null))[_0x7b7e('0x24')](respondWithResult(_0x435de5,null))['catch'](handleError(_0x435de5,null));};exports[_0x7b7e('0x48')]=function(_0x42e560,_0x5a0832){return db['ChatQueueReport'][_0x7b7e('0x48')](_0x42e560[_0x7b7e('0x49')],{})[_0x7b7e('0x24')](respondWithResult(_0x5a0832,0xc9))[_0x7b7e('0x43')](handleError(_0x5a0832,null));};exports[_0x7b7e('0x23')]=function(_0xb46776,_0x590154){if(_0xb46776[_0x7b7e('0x49')]['id']){delete _0xb46776['body']['id'];}return db[_0x7b7e('0x2a')][_0x7b7e('0x47')]({'where':{'id':_0xb46776[_0x7b7e('0x45')]['id']}})[_0x7b7e('0x24')](handleEntityNotFound(_0x590154,null))['then'](saveUpdates(_0xb46776[_0x7b7e('0x49')],null))[_0x7b7e('0x24')](respondWithResult(_0x590154,null))[_0x7b7e('0x43')](handleError(_0x590154,null));};exports[_0x7b7e('0x25')]=function(_0x1f9d0f,_0x5cce7c){return db[_0x7b7e('0x2a')][_0x7b7e('0x47')]({'where':{'id':_0x1f9d0f[_0x7b7e('0x45')]['id']}})[_0x7b7e('0x24')](handleEntityNotFound(_0x5cce7c,null))[_0x7b7e('0x24')](removeEntity(_0x5cce7c,null))['catch'](handleError(_0x5cce7c,null));};exports[_0x7b7e('0x4a')]=function(_0x29024e,_0x46d4ee){return db[_0x7b7e('0x2a')][_0x7b7e('0x4a')]()[_0x7b7e('0x24')](respondWithResult(_0x46d4ee,null))[_0x7b7e('0x43')](handleError(_0x46d4ee,null));}; \ No newline at end of file +var _0xb7e7=['desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','name','send','index','ChatQueueReport','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','rows','catch','show','params','length','find','create','body','describe','html-pdf','rimraf','fast-json-patch','moment','mustache','util','path','ejs','lodash','squel','jsforce'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xb7e7,0x121));var _0x7b7e=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xb7e7[_0x4243a3];return _0x1b2a33;};'use strict';var pdf=require(_0x7b7e('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7b7e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7b7e('0x2'));var rp=require('request-promise');var moment=require(_0x7b7e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x7b7e('0x4'));var util=require(_0x7b7e('0x5'));var path=require(_0x7b7e('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x7b7e('0x7'));var fs=require('fs');var _=require(_0x7b7e('0x8'));var squel=require(_0x7b7e('0x9'));var crypto=require('crypto');var jsforce=require(_0x7b7e('0xa'));var deskjs=require(_0x7b7e('0xb'));var toCsv=require(_0x7b7e('0xc'));var querystring=require(_0x7b7e('0xd'));var Papa=require(_0x7b7e('0xe'));var Redis=require(_0x7b7e('0xf'));var authService=require(_0x7b7e('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x7b7e('0x11'));var hardwareService=require(_0x7b7e('0x12'));var logger=require(_0x7b7e('0x13'))(_0x7b7e('0x14'));var utils=require(_0x7b7e('0x15'));var config=require(_0x7b7e('0x16'));var db=require(_0x7b7e('0x17'))['db'];function respondWithStatusCode(_0x55620b,_0xaadda){_0xaadda=_0xaadda||0xcc;return function(_0x54d8ce){if(_0x54d8ce){return _0x55620b[_0x7b7e('0x18')](_0xaadda);}return _0x55620b[_0x7b7e('0x19')](_0xaadda)['end']();};}function respondWithResult(_0x422d3a,_0x5976ac){_0x5976ac=_0x5976ac||0xc8;return function(_0x4c6011){if(_0x4c6011){return _0x422d3a[_0x7b7e('0x19')](_0x5976ac)[_0x7b7e('0x1a')](_0x4c6011);}};}function respondWithFilteredResult(_0xf067da,_0x457ec5){return function(_0x3d2fb2){if(_0x3d2fb2){var _0x5703fd=_0x3d2fb2[_0x7b7e('0x1b')],_0x51baf6=_0x457ec5[_0x7b7e('0x1c')],_0xc7f087=_0x457ec5[_0x7b7e('0x1c')]+_0x457ec5[_0x7b7e('0x1d')],_0x36444d;if(_0xc7f087>=_0x5703fd){_0xc7f087=_0x5703fd;_0x36444d=0xc8;}else{_0x36444d=0xce;}_0xf067da[_0x7b7e('0x19')](_0x36444d);return _0xf067da[_0x7b7e('0x1e')](_0x7b7e('0x1f'),_0x51baf6+'-'+_0xc7f087+'/'+_0x5703fd)[_0x7b7e('0x1a')](_0x3d2fb2);}return null;};}function patchUpdates(_0x12e8e9){return function(_0x14f4fe){try{jsonpatch[_0x7b7e('0x20')](_0x14f4fe,_0x12e8e9,!![]);}catch(_0x3bec7d){return BPromise[_0x7b7e('0x21')](_0x3bec7d);}return _0x14f4fe[_0x7b7e('0x22')]();};}function saveUpdates(_0x3a7b8b,_0x49eddb){return function(_0x69262b){if(_0x69262b){return _0x69262b[_0x7b7e('0x23')](_0x3a7b8b)[_0x7b7e('0x24')](function(_0x4c0647){return _0x4c0647;});}return null;};}function removeEntity(_0x313122,_0xbf0cb3){return function(_0x14243b){if(_0x14243b){return _0x14243b[_0x7b7e('0x25')]()[_0x7b7e('0x24')](function(){_0x313122[_0x7b7e('0x19')](0xcc)[_0x7b7e('0x26')]();});}};}function handleEntityNotFound(_0x10a66a,_0x53bbb3){return function(_0x5d6215){if(!_0x5d6215){_0x10a66a['sendStatus'](0x194);}return _0x5d6215;};}function handleError(_0x26ee14,_0x22598e){_0x22598e=_0x22598e||0x1f4;return function(_0x23bfa3){logger['error'](_0x23bfa3['stack']);if(_0x23bfa3['name']){delete _0x23bfa3[_0x7b7e('0x27')];}_0x26ee14[_0x7b7e('0x19')](_0x22598e)[_0x7b7e('0x28')](_0x23bfa3);};}exports[_0x7b7e('0x29')]=function(_0x3ceaf5,_0x48fad1){var _0x6a1e71={},_0x21a15={},_0x4c46b8={'count':0x0,'rows':[]};var _0x57b9da=_['map'](db[_0x7b7e('0x2a')][_0x7b7e('0x2b')],function(_0x503625){return{'name':_0x503625[_0x7b7e('0x2c')],'type':_0x503625['type'][_0x7b7e('0x2d')]};});_0x21a15[_0x7b7e('0x2e')]=_[_0x7b7e('0x2f')](_0x57b9da,'name');_0x21a15[_0x7b7e('0x30')]=_[_0x7b7e('0x31')](_0x3ceaf5[_0x7b7e('0x30')]);_0x21a15[_0x7b7e('0x32')]=_[_0x7b7e('0x33')](_0x21a15['model'],_0x21a15[_0x7b7e('0x30')]);_0x6a1e71['attributes']=_[_0x7b7e('0x33')](_0x21a15[_0x7b7e('0x2e')],qs[_0x7b7e('0x34')](_0x3ceaf5[_0x7b7e('0x30')][_0x7b7e('0x34')]));_0x6a1e71[_0x7b7e('0x35')]=_0x6a1e71[_0x7b7e('0x35')]['length']?_0x6a1e71['attributes']:_0x21a15[_0x7b7e('0x2e')];if(!_0x3ceaf5[_0x7b7e('0x30')]['hasOwnProperty'](_0x7b7e('0x36'))){_0x6a1e71[_0x7b7e('0x1d')]=qs[_0x7b7e('0x1d')](_0x3ceaf5['query'][_0x7b7e('0x1d')]);_0x6a1e71[_0x7b7e('0x1c')]=qs[_0x7b7e('0x1c')](_0x3ceaf5[_0x7b7e('0x30')][_0x7b7e('0x1c')]);}_0x6a1e71[_0x7b7e('0x37')]=qs[_0x7b7e('0x38')](_0x3ceaf5[_0x7b7e('0x30')][_0x7b7e('0x38')]);_0x6a1e71[_0x7b7e('0x39')]=qs[_0x7b7e('0x32')](_[_0x7b7e('0x3a')](_0x3ceaf5[_0x7b7e('0x30')],_0x21a15[_0x7b7e('0x32')]),_0x57b9da);if(_0x3ceaf5[_0x7b7e('0x30')][_0x7b7e('0x3b')]){_0x6a1e71['where']=_[_0x7b7e('0x3c')](_0x6a1e71[_0x7b7e('0x39')],{'$or':_[_0x7b7e('0x2f')](_0x57b9da,function(_0x242609){if(_0x242609[_0x7b7e('0x3d')]!==_0x7b7e('0x3e')){var _0x7f15={};_0x7f15[_0x242609[_0x7b7e('0x27')]]={'$like':'%'+_0x3ceaf5[_0x7b7e('0x30')][_0x7b7e('0x3b')]+'%'};return _0x7f15;}})});}_0x6a1e71=_['merge']({},_0x6a1e71,_0x3ceaf5[_0x7b7e('0x3f')]);var _0x1fa75b={'where':_0x6a1e71[_0x7b7e('0x39')]};return db[_0x7b7e('0x2a')]['count'](_0x1fa75b)[_0x7b7e('0x24')](function(_0x35b31a){_0x4c46b8[_0x7b7e('0x1b')]=_0x35b31a;if(_0x3ceaf5['query']['includeAll']){_0x6a1e71[_0x7b7e('0x40')]=[{'all':!![]}];}return db['ChatQueueReport'][_0x7b7e('0x41')](_0x6a1e71);})[_0x7b7e('0x24')](function(_0x4de331){_0x4c46b8[_0x7b7e('0x42')]=_0x4de331;return _0x4c46b8;})[_0x7b7e('0x24')](respondWithFilteredResult(_0x48fad1,_0x6a1e71))[_0x7b7e('0x43')](handleError(_0x48fad1,null));};exports[_0x7b7e('0x44')]=function(_0x38d32f,_0x435de5){var _0xc888e4={'raw':!![],'where':{'id':_0x38d32f[_0x7b7e('0x45')]['id']}},_0x1d9bb9={};_0x1d9bb9['model']=_['keys'](db[_0x7b7e('0x2a')]['rawAttributes']);_0x1d9bb9[_0x7b7e('0x30')]=_['keys'](_0x38d32f['query']);_0x1d9bb9[_0x7b7e('0x32')]=_['intersection'](_0x1d9bb9[_0x7b7e('0x2e')],_0x1d9bb9['query']);_0xc888e4[_0x7b7e('0x35')]=_[_0x7b7e('0x33')](_0x1d9bb9[_0x7b7e('0x2e')],qs[_0x7b7e('0x34')](_0x38d32f['query'][_0x7b7e('0x34')]));_0xc888e4[_0x7b7e('0x35')]=_0xc888e4[_0x7b7e('0x35')][_0x7b7e('0x46')]?_0xc888e4[_0x7b7e('0x35')]:_0x1d9bb9[_0x7b7e('0x2e')];if(_0x38d32f['query']['includeAll']){_0xc888e4['include']=[{'all':!![]}];}_0xc888e4=_[_0x7b7e('0x3c')]({},_0xc888e4,_0x38d32f[_0x7b7e('0x3f')]);return db[_0x7b7e('0x2a')][_0x7b7e('0x47')](_0xc888e4)[_0x7b7e('0x24')](handleEntityNotFound(_0x435de5,null))[_0x7b7e('0x24')](respondWithResult(_0x435de5,null))['catch'](handleError(_0x435de5,null));};exports[_0x7b7e('0x48')]=function(_0x42e560,_0x5a0832){return db['ChatQueueReport'][_0x7b7e('0x48')](_0x42e560[_0x7b7e('0x49')],{})[_0x7b7e('0x24')](respondWithResult(_0x5a0832,0xc9))[_0x7b7e('0x43')](handleError(_0x5a0832,null));};exports[_0x7b7e('0x23')]=function(_0xb46776,_0x590154){if(_0xb46776[_0x7b7e('0x49')]['id']){delete _0xb46776['body']['id'];}return db[_0x7b7e('0x2a')][_0x7b7e('0x47')]({'where':{'id':_0xb46776[_0x7b7e('0x45')]['id']}})[_0x7b7e('0x24')](handleEntityNotFound(_0x590154,null))['then'](saveUpdates(_0xb46776[_0x7b7e('0x49')],null))[_0x7b7e('0x24')](respondWithResult(_0x590154,null))[_0x7b7e('0x43')](handleError(_0x590154,null));};exports[_0x7b7e('0x25')]=function(_0x1f9d0f,_0x5cce7c){return db[_0x7b7e('0x2a')][_0x7b7e('0x47')]({'where':{'id':_0x1f9d0f[_0x7b7e('0x45')]['id']}})[_0x7b7e('0x24')](handleEntityNotFound(_0x5cce7c,null))[_0x7b7e('0x24')](removeEntity(_0x5cce7c,null))['catch'](handleError(_0x5cce7c,null));};exports[_0x7b7e('0x4a')]=function(_0x29024e,_0x46d4ee){return db[_0x7b7e('0x2a')][_0x7b7e('0x4a')]()[_0x7b7e('0x24')](respondWithResult(_0x46d4ee,null))[_0x7b7e('0x43')](handleError(_0x46d4ee,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index f7d97fb..a01c317 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 _0x6f46=['report_chat_queue','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','ChatQueueReport'];(function(_0x491deb,_0x1bf192){var _0xc21671=function(_0x320df4){while(--_0x320df4){_0x491deb['push'](_0x491deb['shift']());}};_0xc21671(++_0x1bf192);}(_0x6f46,0x10b));var _0x66f4=function(_0x235fae,_0xea3869){_0x235fae=_0x235fae-0x0;var _0x221dc8=_0x6f46[_0x235fae];return _0x221dc8;};'use strict';var _=require(_0x66f4('0x0'));var util=require(_0x66f4('0x1'));var logger=require(_0x66f4('0x2'))(_0x66f4('0x3'));var moment=require('moment');var BPromise=require(_0x66f4('0x4'));var rp=require(_0x66f4('0x5'));var fs=require('fs');var path=require(_0x66f4('0x6'));var rimraf=require(_0x66f4('0x7'));var config=require(_0x66f4('0x8'));var attributes=require(_0x66f4('0x9'));module[_0x66f4('0xa')]=function(_0x1c2b4e,_0x5bf968){return _0x1c2b4e[_0x66f4('0xb')](_0x66f4('0xc'),attributes,{'tableName':_0x66f4('0xd'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xe0a8=['bluebird','request-promise','../../config/environment','./chatQueueReport.attributes','exports','define','ChatQueueReport','report_chat_queue','uniqueid','util','../../config/logger','api','moment'];(function(_0x9ae49d,_0x4a0874){var _0x1dddf4=function(_0xf681e){while(--_0xf681e){_0x9ae49d['push'](_0x9ae49d['shift']());}};_0x1dddf4(++_0x4a0874);}(_0xe0a8,0xcc));var _0x8e0a=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xe0a8[_0x59ee6f];return _0x4c0979;};'use strict';var _=require('lodash');var util=require(_0x8e0a('0x0'));var logger=require(_0x8e0a('0x1'))(_0x8e0a('0x2'));var moment=require(_0x8e0a('0x3'));var BPromise=require(_0x8e0a('0x4'));var rp=require(_0x8e0a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8e0a('0x6'));var attributes=require(_0x8e0a('0x7'));module[_0x8e0a('0x8')]=function(_0x144fdc,_0x55daa0){return _0x144fdc[_0x8e0a('0x9')](_0x8e0a('0xa'),attributes,{'tableName':_0x8e0a('0xb'),'paranoid':![],'indexes':[{'name':_0x8e0a('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 90b6278..49f24d8 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 _0xfdb6=['error','code','message','info','catch','ChatQueueReport,\x20%s,\x20%s','CreateChatQueueReport','create','body','options','raw','then','ChatQueueReport','update','where','UpdateChatQueueReport','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x11c193,_0xb90e1c){var _0x46297b=function(_0x27b193){while(--_0x27b193){_0x11c193['push'](_0x11c193['shift']());}};_0x46297b(++_0xb90e1c);}(_0xfdb6,0x1de));var _0x6fdb=function(_0x10fe10,_0x4fd05e){_0x10fe10=_0x10fe10-0x0;var _0x5cb04f=_0xfdb6[_0x10fe10];return _0x5cb04f;};'use strict';var _=require(_0x6fdb('0x0'));var util=require(_0x6fdb('0x1'));var moment=require(_0x6fdb('0x2'));var BPromise=require('bluebird');var rs=require(_0x6fdb('0x3'));var fs=require('fs');var Redis=require(_0x6fdb('0x4'));var db=require(_0x6fdb('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6fdb('0x6'))(_0x6fdb('0x7'));var config=require(_0x6fdb('0x8'));var jayson=require(_0x6fdb('0x9'));var client=jayson[_0x6fdb('0xa')][_0x6fdb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x259e4b,_0x49cb28,_0xe2387f){return new BPromise(function(_0x348d3e,_0x4b49af){return client[_0x6fdb('0xc')](_0x259e4b,_0xe2387f)['then'](function(_0x33be97){logger['info']('ChatQueueReport,\x20%s,\x20%s',_0x49cb28,_0x6fdb('0xd'));logger[_0x6fdb('0xe')](_0x6fdb('0xf'),_0x49cb28,_0x6fdb('0xd'),JSON[_0x6fdb('0x10')](_0x33be97));if(_0x33be97[_0x6fdb('0x11')]){if(_0x33be97[_0x6fdb('0x11')][_0x6fdb('0x12')]===0x1f4){logger['error']('ChatQueueReport,\x20%s,\x20%s',_0x49cb28,_0x33be97[_0x6fdb('0x11')]['message']);return _0x4b49af(_0x33be97[_0x6fdb('0x11')][_0x6fdb('0x13')]);}logger[_0x6fdb('0x11')]('ChatQueueReport,\x20%s,\x20%s',_0x49cb28,_0x33be97['error'][_0x6fdb('0x13')]);return _0x348d3e(_0x33be97['error']['message']);}else{logger[_0x6fdb('0x14')]('ChatQueueReport,\x20%s,\x20%s',_0x49cb28,_0x6fdb('0xd'));_0x348d3e(_0x33be97['result'][_0x6fdb('0x13')]);}})[_0x6fdb('0x15')](function(_0x4ae579){logger['error'](_0x6fdb('0x16'),_0x49cb28,_0x4ae579);_0x4b49af(_0x4ae579);});});}exports[_0x6fdb('0x17')]=function(_0x19f6b3){var _0x338a33=this;return new Promise(function(_0x2e0ff9,_0xb5da8b){return db['ChatQueueReport'][_0x6fdb('0x18')](_0x19f6b3[_0x6fdb('0x19')],{'raw':_0x19f6b3[_0x6fdb('0x1a')]?_0x19f6b3[_0x6fdb('0x1a')][_0x6fdb('0x1b')]===undefined?!![]:![]:!![]})[_0x6fdb('0x1c')](function(_0x1bf16a){logger[_0x6fdb('0x14')](_0x6fdb('0x17'),_0x19f6b3);logger[_0x6fdb('0xe')](_0x6fdb('0x17'),_0x19f6b3,JSON[_0x6fdb('0x10')](_0x1bf16a));_0x2e0ff9(_0x1bf16a);})[_0x6fdb('0x15')](function(_0x52260e){logger[_0x6fdb('0x11')](_0x6fdb('0x17'),_0x52260e[_0x6fdb('0x13')],_0x19f6b3);_0xb5da8b(_0x338a33['error'](0x1f4,_0x52260e[_0x6fdb('0x13')]));});});};exports['UpdateChatQueueReport']=function(_0x18f735){var _0x12def3=this;return new Promise(function(_0x5b1f23,_0x702698){return db[_0x6fdb('0x1d')][_0x6fdb('0x1e')](_0x18f735[_0x6fdb('0x19')],{'raw':_0x18f735[_0x6fdb('0x1a')]?_0x18f735['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x18f735[_0x6fdb('0x1a')]?_0x18f735[_0x6fdb('0x1a')][_0x6fdb('0x1f')]||null:null,'attributes':_0x18f735[_0x6fdb('0x1a')]?_0x18f735[_0x6fdb('0x1a')]['attributes']||null:null,'limit':_0x18f735['options']?_0x18f735['options']['limit']||null:null})[_0x6fdb('0x1c')](function(_0x1074a4){logger[_0x6fdb('0x14')](_0x6fdb('0x20'),_0x18f735);logger[_0x6fdb('0xe')](_0x6fdb('0x20'),_0x18f735,JSON['stringify'](_0x1074a4));_0x5b1f23(_0x1074a4);})['catch'](function(_0x1c9b83){logger['error'](_0x6fdb('0x20'),_0x1c9b83[_0x6fdb('0x13')],_0x18f735);_0x702698(_0x12def3[_0x6fdb('0x11')](0x1f4,_0x1c9b83[_0x6fdb('0x13')]));});});}; \ No newline at end of file +var _0xaca4=['body','raw','where','attributes','limit','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ChatQueueReport,\x20%s,\x20%s','CreateChatQueueReport','ChatQueueReport','create','options','catch','UpdateChatQueueReport','update'];(function(_0x49b03a,_0x4daa82){var _0x221987=function(_0x414808){while(--_0x414808){_0x49b03a['push'](_0x49b03a['shift']());}};_0x221987(++_0x4daa82);}(_0xaca4,0x68));var _0x4aca=function(_0x22ea97,_0x272b2f){_0x22ea97=_0x22ea97-0x0;var _0x3698dc=_0xaca4[_0x22ea97];return _0x3698dc;};'use strict';var _=require(_0x4aca('0x0'));var util=require(_0x4aca('0x1'));var moment=require(_0x4aca('0x2'));var BPromise=require(_0x4aca('0x3'));var rs=require(_0x4aca('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4aca('0x5'));var logger=require(_0x4aca('0x6'))('rpc');var config=require(_0x4aca('0x7'));var jayson=require(_0x4aca('0x8'));var client=jayson[_0x4aca('0x9')][_0x4aca('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x463c19,_0x4002fb,_0x2e9570){return new BPromise(function(_0x4a7e35,_0x4b18f7){return client['request'](_0x463c19,_0x2e9570)[_0x4aca('0xb')](function(_0x34969c){logger[_0x4aca('0xc')]('ChatQueueReport,\x20%s,\x20%s',_0x4002fb,_0x4aca('0xd'));logger[_0x4aca('0xe')](_0x4aca('0xf'),_0x4002fb,_0x4aca('0xd'),JSON[_0x4aca('0x10')](_0x34969c));if(_0x34969c[_0x4aca('0x11')]){if(_0x34969c[_0x4aca('0x11')][_0x4aca('0x12')]===0x1f4){logger[_0x4aca('0x11')]('ChatQueueReport,\x20%s,\x20%s',_0x4002fb,_0x34969c[_0x4aca('0x11')]['message']);return _0x4b18f7(_0x34969c[_0x4aca('0x11')][_0x4aca('0x13')]);}logger[_0x4aca('0x11')]('ChatQueueReport,\x20%s,\x20%s',_0x4002fb,_0x34969c['error'][_0x4aca('0x13')]);return _0x4a7e35(_0x34969c['error'][_0x4aca('0x13')]);}else{logger['info'](_0x4aca('0x14'),_0x4002fb,_0x4aca('0xd'));_0x4a7e35(_0x34969c['result']['message']);}})['catch'](function(_0x123da9){logger[_0x4aca('0x11')]('ChatQueueReport,\x20%s,\x20%s',_0x4002fb,_0x123da9);_0x4b18f7(_0x123da9);});});}exports[_0x4aca('0x15')]=function(_0x129dbd){var _0x11bb56=this;return new Promise(function(_0x39f41c,_0x5224df){return db[_0x4aca('0x16')][_0x4aca('0x17')](_0x129dbd['body'],{'raw':_0x129dbd[_0x4aca('0x18')]?_0x129dbd['options']['raw']===undefined?!![]:![]:!![]})[_0x4aca('0xb')](function(_0x346e0a){logger[_0x4aca('0xc')]('CreateChatQueueReport',_0x129dbd);logger['debug'](_0x4aca('0x15'),_0x129dbd,JSON['stringify'](_0x346e0a));_0x39f41c(_0x346e0a);})[_0x4aca('0x19')](function(_0x274756){logger['error'](_0x4aca('0x15'),_0x274756[_0x4aca('0x13')],_0x129dbd);_0x5224df(_0x11bb56[_0x4aca('0x11')](0x1f4,_0x274756[_0x4aca('0x13')]));});});};exports[_0x4aca('0x1a')]=function(_0x292888){var _0xc21d50=this;return new Promise(function(_0x3fb5d4,_0x71e8b){return db['ChatQueueReport'][_0x4aca('0x1b')](_0x292888[_0x4aca('0x1c')],{'raw':_0x292888['options']?_0x292888['options'][_0x4aca('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x292888[_0x4aca('0x18')]?_0x292888[_0x4aca('0x18')][_0x4aca('0x1e')]||null:null,'attributes':_0x292888['options']?_0x292888[_0x4aca('0x18')][_0x4aca('0x1f')]||null:null,'limit':_0x292888[_0x4aca('0x18')]?_0x292888[_0x4aca('0x18')][_0x4aca('0x20')]||null:null})[_0x4aca('0xb')](function(_0x13492d){logger[_0x4aca('0xc')]('UpdateChatQueueReport',_0x292888);logger[_0x4aca('0xe')]('UpdateChatQueueReport',_0x292888,JSON[_0x4aca('0x10')](_0x13492d));_0x3fb5d4(_0x13492d);})[_0x4aca('0x19')](function(_0x37b39b){logger[_0x4aca('0x11')](_0x4aca('0x1a'),_0x37b39b[_0x4aca('0x13')],_0x292888);_0x71e8b(_0xc21d50[_0x4aca('0x11')](0x1f4,_0x37b39b[_0x4aca('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 9815ff6..e8fb187 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 _0x7949=['connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','isAuthenticated','index','/describe','describe','get','show','post','put','/:id','update','delete','destroy','multer','util','path'];(function(_0x28958d,_0xfa5f9f){var _0x439c72=function(_0x280df5){while(--_0x280df5){_0x28958d['push'](_0x28958d['shift']());}};_0x439c72(++_0xfa5f9f);}(_0x7949,0xf9));var _0x9794=function(_0x578a7a,_0xe0adcd){_0x578a7a=_0x578a7a-0x0;var _0x5d55c3=_0x7949[_0x578a7a];return _0x5d55c3;};'use strict';var multer=require(_0x9794('0x0'));var util=require(_0x9794('0x1'));var path=require(_0x9794('0x2'));var timeout=require(_0x9794('0x3'));var express=require(_0x9794('0x4'));var router=express[_0x9794('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x9794('0x6'));var config=require(_0x9794('0x7'));var controller=require(_0x9794('0x8'));router['get']('/',auth[_0x9794('0x9')](),controller[_0x9794('0xa')]);router['get'](_0x9794('0xb'),auth[_0x9794('0x9')](),controller[_0x9794('0xc')]);router[_0x9794('0xd')]('/:id',auth[_0x9794('0x9')](),controller[_0x9794('0xe')]);router[_0x9794('0xf')]('/',auth[_0x9794('0x9')](),controller['create']);router[_0x9794('0x10')](_0x9794('0x11'),auth[_0x9794('0x9')](),controller[_0x9794('0x12')]);router[_0x9794('0x13')](_0x9794('0x11'),auth[_0x9794('0x9')](),controller[_0x9794('0x14')]);module['exports']=router; \ No newline at end of file +var _0x133b=['get','isAuthenticated','index','describe','/:id','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./chatQueueReport.controller'];(function(_0x2b81be,_0x544bdf){var _0x8ed4a7=function(_0x4a7bf4){while(--_0x4a7bf4){_0x2b81be['push'](_0x2b81be['shift']());}};_0x8ed4a7(++_0x544bdf);}(_0x133b,0xab));var _0xb133=function(_0x14741c,_0x4892f5){_0x14741c=_0x14741c-0x0;var _0x1d5907=_0x133b[_0x14741c];return _0x1d5907;};'use strict';var multer=require(_0xb133('0x0'));var util=require(_0xb133('0x1'));var path=require(_0xb133('0x2'));var timeout=require(_0xb133('0x3'));var express=require(_0xb133('0x4'));var router=express[_0xb133('0x5')]();var auth=require(_0xb133('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xb133('0x7'));var controller=require(_0xb133('0x8'));router[_0xb133('0x9')]('/',auth[_0xb133('0xa')](),controller[_0xb133('0xb')]);router[_0xb133('0x9')]('/describe',auth[_0xb133('0xa')](),controller[_0xb133('0xc')]);router[_0xb133('0x9')](_0xb133('0xd'),auth[_0xb133('0xa')](),controller['show']);router[_0xb133('0xe')]('/',auth[_0xb133('0xa')](),controller[_0xb133('0xf')]);router[_0xb133('0x10')](_0xb133('0xd'),auth[_0xb133('0xa')](),controller['update']);router[_0xb133('0x11')](_0xb133('0xd'),auth[_0xb133('0xa')](),controller[_0xb133('0x12')]);module[_0xb133('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index abac526..93db36a 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 _0x1ac0=['agent','queue','DATE','NOW','moment','sequelize','exports','STRING','ENUM','account'];(function(_0x34016a,_0x19c998){var _0x272a18=function(_0xb0a910){while(--_0xb0a910){_0x34016a['push'](_0x34016a['shift']());}};_0x272a18(++_0x19c998);}(_0x1ac0,0x1bc));var _0x01ac=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x1ac0[_0x17d9e3];return _0x14192d;};'use strict';var moment=require(_0x01ac('0x0'));var Sequelize=require(_0x01ac('0x1'));module[_0x01ac('0x2')]={'uniqueid':{'type':Sequelize[_0x01ac('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x01ac('0x4')](_0x01ac('0x5'),_0x01ac('0x6'),_0x01ac('0x7')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0x01ac('0x8')],'allowNull':![],'defaultValue':Sequelize[_0x01ac('0x9')]}}; \ No newline at end of file +var _0x7431=['ENUM','agent','queue','NOW','moment','sequelize','exports','STRING'];(function(_0x1a9660,_0x3b8421){var _0x36ac12=function(_0x4cab5b){while(--_0x4cab5b){_0x1a9660['push'](_0x1a9660['shift']());}};_0x36ac12(++_0x3b8421);}(_0x7431,0x74));var _0x1743=function(_0x5a80db,_0x260ce5){_0x5a80db=_0x5a80db-0x0;var _0x39c515=_0x7431[_0x5a80db];return _0x39c515;};'use strict';var moment=require(_0x1743('0x0'));var Sequelize=require(_0x1743('0x1'));module[_0x1743('0x2')]={'uniqueid':{'type':Sequelize[_0x1743('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x1743('0x4')]('account',_0x1743('0x5'),_0x1743('0x6')),'allowNull':![],'defaultValue':_0x1743('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x1743('0x7')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 2ce1311..c2ab19d 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 _0xa5ee=['filters','intersection','model','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','create','body','params','find','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','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','../../mysqldb','status','end','json','count','offset','limit','reject','save','update','then','destroy','sendStatus','error','send','index','map','ChatTransferReport','rawAttributes','fieldName','type','query','keys'];(function(_0x3b9ba7,_0x2500be){var _0x4c3dfe=function(_0x5c5db5){while(--_0x5c5db5){_0x3b9ba7['push'](_0x3b9ba7['shift']());}};_0x4c3dfe(++_0x2500be);}(_0xa5ee,0x1dc));var _0xea5e=function(_0x1d0374,_0x5b6bb0){_0x1d0374=_0x1d0374-0x0;var _0x55b65a=_0xa5ee[_0x1d0374];return _0x55b65a;};'use strict';var pdf=require(_0xea5e('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xea5e('0x1'));var zipdir=require(_0xea5e('0x2'));var jsonpatch=require(_0xea5e('0x3'));var rp=require(_0xea5e('0x4'));var moment=require(_0xea5e('0x5'));var BPromise=require(_0xea5e('0x6'));var Mustache=require(_0xea5e('0x7'));var util=require(_0xea5e('0x8'));var path=require(_0xea5e('0x9'));var sox=require(_0xea5e('0xa'));var csv=require(_0xea5e('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xea5e('0xc'));var squel=require(_0xea5e('0xd'));var crypto=require(_0xea5e('0xe'));var jsforce=require(_0xea5e('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xea5e('0x10'));var Papa=require('papaparse');var Redis=require(_0xea5e('0x11'));var authService=require(_0xea5e('0x12'));var qs=require(_0xea5e('0x13'));var as=require(_0xea5e('0x14'));var hardwareService=require(_0xea5e('0x15'));var logger=require(_0xea5e('0x16'))(_0xea5e('0x17'));var utils=require(_0xea5e('0x18'));var config=require(_0xea5e('0x19'));var db=require(_0xea5e('0x1a'))['db'];function respondWithStatusCode(_0x539450,_0x11518e){_0x11518e=_0x11518e||0xcc;return function(_0x4832b4){if(_0x4832b4){return _0x539450['sendStatus'](_0x11518e);}return _0x539450[_0xea5e('0x1b')](_0x11518e)[_0xea5e('0x1c')]();};}function respondWithResult(_0x2530dd,_0x36dbdb){_0x36dbdb=_0x36dbdb||0xc8;return function(_0x36978c){if(_0x36978c){return _0x2530dd[_0xea5e('0x1b')](_0x36dbdb)[_0xea5e('0x1d')](_0x36978c);}};}function respondWithFilteredResult(_0x19f754,_0x1968f5){return function(_0xc43c29){if(_0xc43c29){var _0x35867e=_0xc43c29[_0xea5e('0x1e')],_0x1ea75a=_0x1968f5[_0xea5e('0x1f')],_0x43c93a=_0x1968f5[_0xea5e('0x1f')]+_0x1968f5[_0xea5e('0x20')],_0x37d395;if(_0x43c93a>=_0x35867e){_0x43c93a=_0x35867e;_0x37d395=0xc8;}else{_0x37d395=0xce;}_0x19f754[_0xea5e('0x1b')](_0x37d395);return _0x19f754['set']('Content-Range',_0x1ea75a+'-'+_0x43c93a+'/'+_0x35867e)['json'](_0xc43c29);}return null;};}function patchUpdates(_0xb9ae20){return function(_0x1045d0){try{jsonpatch['apply'](_0x1045d0,_0xb9ae20,!![]);}catch(_0x53d711){return BPromise[_0xea5e('0x21')](_0x53d711);}return _0x1045d0[_0xea5e('0x22')]();};}function saveUpdates(_0x511e6b,_0x4fdcab){return function(_0x23a25c){if(_0x23a25c){return _0x23a25c[_0xea5e('0x23')](_0x511e6b)[_0xea5e('0x24')](function(_0x3f2025){return _0x3f2025;});}return null;};}function removeEntity(_0xb1483e,_0xdea9d5){return function(_0x43b43a){if(_0x43b43a){return _0x43b43a[_0xea5e('0x25')]()[_0xea5e('0x24')](function(){_0xb1483e['status'](0xcc)[_0xea5e('0x1c')]();});}};}function handleEntityNotFound(_0x4b33f5,_0x1116e3){return function(_0x33898e){if(!_0x33898e){_0x4b33f5[_0xea5e('0x26')](0x194);}return _0x33898e;};}function handleError(_0x35dce9,_0x4063ff){_0x4063ff=_0x4063ff||0x1f4;return function(_0x3e2b17){logger[_0xea5e('0x27')](_0x3e2b17['stack']);if(_0x3e2b17['name']){delete _0x3e2b17['name'];}_0x35dce9['status'](_0x4063ff)[_0xea5e('0x28')](_0x3e2b17);};}exports[_0xea5e('0x29')]=function(_0x59021d,_0x155f0b){var _0x5971e5={},_0x5aa2f3={},_0xd18fc6={'count':0x0,'rows':[]};var _0x129376=_[_0xea5e('0x2a')](db[_0xea5e('0x2b')][_0xea5e('0x2c')],function(_0x3cd18c){return{'name':_0x3cd18c[_0xea5e('0x2d')],'type':_0x3cd18c[_0xea5e('0x2e')]['key']};});_0x5aa2f3['model']=_[_0xea5e('0x2a')](_0x129376,'name');_0x5aa2f3[_0xea5e('0x2f')]=_[_0xea5e('0x30')](_0x59021d[_0xea5e('0x2f')]);_0x5aa2f3[_0xea5e('0x31')]=_[_0xea5e('0x32')](_0x5aa2f3[_0xea5e('0x33')],_0x5aa2f3[_0xea5e('0x2f')]);_0x5971e5[_0xea5e('0x34')]=_['intersection'](_0x5aa2f3[_0xea5e('0x33')],qs['fields'](_0x59021d[_0xea5e('0x2f')][_0xea5e('0x35')]));_0x5971e5[_0xea5e('0x34')]=_0x5971e5[_0xea5e('0x34')][_0xea5e('0x36')]?_0x5971e5['attributes']:_0x5aa2f3[_0xea5e('0x33')];if(!_0x59021d['query']['hasOwnProperty'](_0xea5e('0x37'))){_0x5971e5['limit']=qs['limit'](_0x59021d[_0xea5e('0x2f')][_0xea5e('0x20')]);_0x5971e5[_0xea5e('0x1f')]=qs[_0xea5e('0x1f')](_0x59021d[_0xea5e('0x2f')][_0xea5e('0x1f')]);}_0x5971e5[_0xea5e('0x38')]=qs[_0xea5e('0x39')](_0x59021d[_0xea5e('0x2f')][_0xea5e('0x39')]);_0x5971e5['where']=qs[_0xea5e('0x31')](_[_0xea5e('0x3a')](_0x59021d['query'],_0x5aa2f3[_0xea5e('0x31')]),_0x129376);if(_0x59021d[_0xea5e('0x2f')][_0xea5e('0x3b')]){_0x5971e5[_0xea5e('0x3c')]=_[_0xea5e('0x3d')](_0x5971e5[_0xea5e('0x3c')],{'$or':_[_0xea5e('0x2a')](_0x129376,function(_0x48c514){if(_0x48c514[_0xea5e('0x2e')]!==_0xea5e('0x3e')){var _0xae642a={};_0xae642a[_0x48c514['name']]={'$like':'%'+_0x59021d[_0xea5e('0x2f')][_0xea5e('0x3b')]+'%'};return _0xae642a;}})});}_0x5971e5=_['merge']({},_0x5971e5,_0x59021d[_0xea5e('0x3f')]);var _0x446eb7={'where':_0x5971e5[_0xea5e('0x3c')]};return db['ChatTransferReport'][_0xea5e('0x1e')](_0x446eb7)[_0xea5e('0x24')](function(_0x7616cd){_0xd18fc6[_0xea5e('0x1e')]=_0x7616cd;if(_0x59021d[_0xea5e('0x2f')][_0xea5e('0x40')]){_0x5971e5[_0xea5e('0x41')]=[{'all':!![]}];}return db['ChatTransferReport'][_0xea5e('0x42')](_0x5971e5);})[_0xea5e('0x24')](function(_0x244c4b){_0xd18fc6[_0xea5e('0x43')]=_0x244c4b;return _0xd18fc6;})[_0xea5e('0x24')](respondWithFilteredResult(_0x155f0b,_0x5971e5))[_0xea5e('0x44')](handleError(_0x155f0b,null));};exports[_0xea5e('0x45')]=function(_0x37b2fb,_0x301be5){var _0x5a05a1={'raw':!![],'where':{'id':_0x37b2fb['params']['id']}},_0x5cb535={};_0x5cb535[_0xea5e('0x33')]=_[_0xea5e('0x30')](db[_0xea5e('0x2b')]['rawAttributes']);_0x5cb535[_0xea5e('0x2f')]=_['keys'](_0x37b2fb['query']);_0x5cb535['filters']=_[_0xea5e('0x32')](_0x5cb535[_0xea5e('0x33')],_0x5cb535['query']);_0x5a05a1[_0xea5e('0x34')]=_['intersection'](_0x5cb535[_0xea5e('0x33')],qs[_0xea5e('0x35')](_0x37b2fb['query'][_0xea5e('0x35')]));_0x5a05a1[_0xea5e('0x34')]=_0x5a05a1[_0xea5e('0x34')][_0xea5e('0x36')]?_0x5a05a1[_0xea5e('0x34')]:_0x5cb535[_0xea5e('0x33')];if(_0x37b2fb['query']['includeAll']){_0x5a05a1['include']=[{'all':!![]}];}_0x5a05a1=_[_0xea5e('0x3d')]({},_0x5a05a1,_0x37b2fb[_0xea5e('0x3f')]);return db[_0xea5e('0x2b')]['find'](_0x5a05a1)['then'](handleEntityNotFound(_0x301be5,null))[_0xea5e('0x24')](respondWithResult(_0x301be5,null))[_0xea5e('0x44')](handleError(_0x301be5,null));};exports[_0xea5e('0x46')]=function(_0x512a0b,_0x2bd00a){return db[_0xea5e('0x2b')][_0xea5e('0x46')](_0x512a0b[_0xea5e('0x47')],{})[_0xea5e('0x24')](respondWithResult(_0x2bd00a,0xc9))[_0xea5e('0x44')](handleError(_0x2bd00a,null));};exports['update']=function(_0x47a988,_0x19ffd1){if(_0x47a988[_0xea5e('0x47')]['id']){delete _0x47a988[_0xea5e('0x47')]['id'];}return db['ChatTransferReport']['find']({'where':{'id':_0x47a988[_0xea5e('0x48')]['id']}})[_0xea5e('0x24')](handleEntityNotFound(_0x19ffd1,null))['then'](saveUpdates(_0x47a988['body'],null))['then'](respondWithResult(_0x19ffd1,null))[_0xea5e('0x44')](handleError(_0x19ffd1,null));};exports[_0xea5e('0x25')]=function(_0x59060b,_0x320c7d){return db[_0xea5e('0x2b')][_0xea5e('0x49')]({'where':{'id':_0x59060b[_0xea5e('0x48')]['id']}})[_0xea5e('0x24')](handleEntityNotFound(_0x320c7d,null))[_0xea5e('0x24')](removeEntity(_0x320c7d,null))[_0xea5e('0x44')](handleError(_0x320c7d,null));};exports[_0xea5e('0x4a')]=function(_0x3d3984,_0x88391){return db['ChatTransferReport']['describe']()['then'](respondWithResult(_0x88391,null))[_0xea5e('0x44')](handleError(_0x88391,null));}; \ No newline at end of file +var _0x412b=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','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','../../mysqldb','sendStatus','end','count','offset','limit','status','set','Content-Range','json','reject','save','then','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','ChatTransferReport','findAll','rows','catch','params','merge','find','create','body','update','destroy','describe','html-pdf'];(function(_0x14015b,_0x32cf7e){var _0x2531da=function(_0x162c50){while(--_0x162c50){_0x14015b['push'](_0x14015b['shift']());}};_0x2531da(++_0x32cf7e);}(_0x412b,0xef));var _0xb412=function(_0xc00988,_0x3964a6){_0xc00988=_0xc00988-0x0;var _0x100506=_0x412b[_0xc00988];return _0x100506;};'use strict';var pdf=require(_0xb412('0x0'));var emlformat=require(_0xb412('0x1'));var rimraf=require(_0xb412('0x2'));var zipdir=require(_0xb412('0x3'));var jsonpatch=require(_0xb412('0x4'));var rp=require(_0xb412('0x5'));var moment=require(_0xb412('0x6'));var BPromise=require(_0xb412('0x7'));var Mustache=require(_0xb412('0x8'));var util=require(_0xb412('0x9'));var path=require(_0xb412('0xa'));var sox=require('sox');var csv=require(_0xb412('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xb412('0xc'));var squel=require(_0xb412('0xd'));var crypto=require(_0xb412('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xb412('0xf'));var toCsv=require('to-csv');var querystring=require(_0xb412('0x10'));var Papa=require(_0xb412('0x11'));var Redis=require(_0xb412('0x12'));var authService=require(_0xb412('0x13'));var qs=require(_0xb412('0x14'));var as=require(_0xb412('0x15'));var hardwareService=require(_0xb412('0x16'));var logger=require(_0xb412('0x17'))(_0xb412('0x18'));var utils=require(_0xb412('0x19'));var config=require(_0xb412('0x1a'));var db=require(_0xb412('0x1b'))['db'];function respondWithStatusCode(_0x239874,_0x4c6cc2){_0x4c6cc2=_0x4c6cc2||0xcc;return function(_0x4cbb4e){if(_0x4cbb4e){return _0x239874[_0xb412('0x1c')](_0x4c6cc2);}return _0x239874['status'](_0x4c6cc2)[_0xb412('0x1d')]();};}function respondWithResult(_0x34498c,_0x55ba9e){_0x55ba9e=_0x55ba9e||0xc8;return function(_0x21a444){if(_0x21a444){return _0x34498c['status'](_0x55ba9e)['json'](_0x21a444);}};}function respondWithFilteredResult(_0x1e3cf9,_0x526d97){return function(_0x419bb7){if(_0x419bb7){var _0x8109d6=_0x419bb7[_0xb412('0x1e')],_0x522660=_0x526d97[_0xb412('0x1f')],_0x218aa9=_0x526d97['offset']+_0x526d97[_0xb412('0x20')],_0x261219;if(_0x218aa9>=_0x8109d6){_0x218aa9=_0x8109d6;_0x261219=0xc8;}else{_0x261219=0xce;}_0x1e3cf9[_0xb412('0x21')](_0x261219);return _0x1e3cf9[_0xb412('0x22')](_0xb412('0x23'),_0x522660+'-'+_0x218aa9+'/'+_0x8109d6)[_0xb412('0x24')](_0x419bb7);}return null;};}function patchUpdates(_0xf785ea){return function(_0x4c3870){try{jsonpatch['apply'](_0x4c3870,_0xf785ea,!![]);}catch(_0x3d6237){return BPromise[_0xb412('0x25')](_0x3d6237);}return _0x4c3870[_0xb412('0x26')]();};}function saveUpdates(_0x2966eb,_0x3846c2){return function(_0x34ade7){if(_0x34ade7){return _0x34ade7['update'](_0x2966eb)[_0xb412('0x27')](function(_0x3576cf){return _0x3576cf;});}return null;};}function removeEntity(_0xb98e08,_0x379249){return function(_0x54b57e){if(_0x54b57e){return _0x54b57e['destroy']()[_0xb412('0x27')](function(){_0xb98e08[_0xb412('0x21')](0xcc)[_0xb412('0x1d')]();});}};}function handleEntityNotFound(_0x47e87f,_0x9d9daa){return function(_0x1892d5){if(!_0x1892d5){_0x47e87f[_0xb412('0x1c')](0x194);}return _0x1892d5;};}function handleError(_0x4c85a7,_0x57658b){_0x57658b=_0x57658b||0x1f4;return function(_0x325502){logger['error'](_0x325502[_0xb412('0x28')]);if(_0x325502[_0xb412('0x29')]){delete _0x325502[_0xb412('0x29')];}_0x4c85a7[_0xb412('0x21')](_0x57658b)[_0xb412('0x2a')](_0x325502);};}exports[_0xb412('0x2b')]=function(_0x307bff,_0x57d871){var _0x2f19ba={},_0x44c4c0={},_0xb130e8={'count':0x0,'rows':[]};var _0x4b3b42=_['map'](db['ChatTransferReport'][_0xb412('0x2c')],function(_0x231137){return{'name':_0x231137[_0xb412('0x2d')],'type':_0x231137[_0xb412('0x2e')][_0xb412('0x2f')]};});_0x44c4c0[_0xb412('0x30')]=_[_0xb412('0x31')](_0x4b3b42,'name');_0x44c4c0[_0xb412('0x32')]=_[_0xb412('0x33')](_0x307bff[_0xb412('0x32')]);_0x44c4c0[_0xb412('0x34')]=_[_0xb412('0x35')](_0x44c4c0[_0xb412('0x30')],_0x44c4c0[_0xb412('0x32')]);_0x2f19ba['attributes']=_[_0xb412('0x35')](_0x44c4c0[_0xb412('0x30')],qs[_0xb412('0x36')](_0x307bff[_0xb412('0x32')][_0xb412('0x36')]));_0x2f19ba[_0xb412('0x37')]=_0x2f19ba[_0xb412('0x37')][_0xb412('0x38')]?_0x2f19ba[_0xb412('0x37')]:_0x44c4c0[_0xb412('0x30')];if(!_0x307bff[_0xb412('0x32')][_0xb412('0x39')](_0xb412('0x3a'))){_0x2f19ba[_0xb412('0x20')]=qs['limit'](_0x307bff[_0xb412('0x32')]['limit']);_0x2f19ba['offset']=qs[_0xb412('0x1f')](_0x307bff[_0xb412('0x32')][_0xb412('0x1f')]);}_0x2f19ba[_0xb412('0x3b')]=qs[_0xb412('0x3c')](_0x307bff[_0xb412('0x32')][_0xb412('0x3c')]);_0x2f19ba[_0xb412('0x3d')]=qs['filters'](_[_0xb412('0x3e')](_0x307bff['query'],_0x44c4c0[_0xb412('0x34')]),_0x4b3b42);if(_0x307bff[_0xb412('0x32')][_0xb412('0x3f')]){_0x2f19ba['where']=_['merge'](_0x2f19ba[_0xb412('0x3d')],{'$or':_['map'](_0x4b3b42,function(_0x37056a){if(_0x37056a[_0xb412('0x2e')]!==_0xb412('0x40')){var _0x486d54={};_0x486d54[_0x37056a['name']]={'$like':'%'+_0x307bff['query'][_0xb412('0x3f')]+'%'};return _0x486d54;}})});}_0x2f19ba=_['merge']({},_0x2f19ba,_0x307bff[_0xb412('0x41')]);var _0xecefc0={'where':_0x2f19ba[_0xb412('0x3d')]};return db['ChatTransferReport']['count'](_0xecefc0)[_0xb412('0x27')](function(_0xded6b0){_0xb130e8[_0xb412('0x1e')]=_0xded6b0;if(_0x307bff[_0xb412('0x32')][_0xb412('0x42')]){_0x2f19ba[_0xb412('0x43')]=[{'all':!![]}];}return db[_0xb412('0x44')][_0xb412('0x45')](_0x2f19ba);})['then'](function(_0x4fcab9){_0xb130e8[_0xb412('0x46')]=_0x4fcab9;return _0xb130e8;})[_0xb412('0x27')](respondWithFilteredResult(_0x57d871,_0x2f19ba))[_0xb412('0x47')](handleError(_0x57d871,null));};exports['show']=function(_0x1b0787,_0x4918ba){var _0x12d04d={'raw':!![],'where':{'id':_0x1b0787[_0xb412('0x48')]['id']}},_0x2dec6b={};_0x2dec6b[_0xb412('0x30')]=_['keys'](db['ChatTransferReport'][_0xb412('0x2c')]);_0x2dec6b[_0xb412('0x32')]=_[_0xb412('0x33')](_0x1b0787['query']);_0x2dec6b['filters']=_[_0xb412('0x35')](_0x2dec6b[_0xb412('0x30')],_0x2dec6b[_0xb412('0x32')]);_0x12d04d[_0xb412('0x37')]=_[_0xb412('0x35')](_0x2dec6b['model'],qs['fields'](_0x1b0787['query'][_0xb412('0x36')]));_0x12d04d[_0xb412('0x37')]=_0x12d04d['attributes'][_0xb412('0x38')]?_0x12d04d['attributes']:_0x2dec6b[_0xb412('0x30')];if(_0x1b0787['query'][_0xb412('0x42')]){_0x12d04d[_0xb412('0x43')]=[{'all':!![]}];}_0x12d04d=_[_0xb412('0x49')]({},_0x12d04d,_0x1b0787[_0xb412('0x41')]);return db[_0xb412('0x44')][_0xb412('0x4a')](_0x12d04d)['then'](handleEntityNotFound(_0x4918ba,null))[_0xb412('0x27')](respondWithResult(_0x4918ba,null))[_0xb412('0x47')](handleError(_0x4918ba,null));};exports[_0xb412('0x4b')]=function(_0x179575,_0x4b4983){return db[_0xb412('0x44')]['create'](_0x179575[_0xb412('0x4c')],{})[_0xb412('0x27')](respondWithResult(_0x4b4983,0xc9))[_0xb412('0x47')](handleError(_0x4b4983,null));};exports[_0xb412('0x4d')]=function(_0x285bb2,_0x221168){if(_0x285bb2[_0xb412('0x4c')]['id']){delete _0x285bb2[_0xb412('0x4c')]['id'];}return db[_0xb412('0x44')][_0xb412('0x4a')]({'where':{'id':_0x285bb2['params']['id']}})[_0xb412('0x27')](handleEntityNotFound(_0x221168,null))['then'](saveUpdates(_0x285bb2[_0xb412('0x4c')],null))[_0xb412('0x27')](respondWithResult(_0x221168,null))[_0xb412('0x47')](handleError(_0x221168,null));};exports[_0xb412('0x4e')]=function(_0x56bb96,_0xcee53){return db[_0xb412('0x44')][_0xb412('0x4a')]({'where':{'id':_0x56bb96[_0xb412('0x48')]['id']}})[_0xb412('0x27')](handleEntityNotFound(_0xcee53,null))[_0xb412('0x27')](removeEntity(_0xcee53,null))[_0xb412('0x47')](handleError(_0xcee53,null));};exports[_0xb412('0x4f')]=function(_0x3f477,_0xeab0b){return db['ChatTransferReport'][_0xb412('0x4f')]()['then'](respondWithResult(_0xeab0b,null))[_0xb412('0x47')](handleError(_0xeab0b,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 99456ed..93515b6 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 _0x5034=['../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./chatTransferReport.attributes','exports','ChatTransferReport','report_chat_transfer','uniqueid','lodash','util'];(function(_0x1ac571,_0xebb9fb){var _0x42b9af=function(_0x490b4b){while(--_0x490b4b){_0x1ac571['push'](_0x1ac571['shift']());}};_0x42b9af(++_0xebb9fb);}(_0x5034,0x8d));var _0x4503=function(_0x43f55b,_0x3f14e0){_0x43f55b=_0x43f55b-0x0;var _0x16683d=_0x5034[_0x43f55b];return _0x16683d;};'use strict';var _=require(_0x4503('0x0'));var util=require(_0x4503('0x1'));var logger=require(_0x4503('0x2'))('api');var moment=require(_0x4503('0x3'));var BPromise=require(_0x4503('0x4'));var rp=require(_0x4503('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4503('0x6'));var config=require(_0x4503('0x7'));var attributes=require(_0x4503('0x8'));module[_0x4503('0x9')]=function(_0x217cd4,_0x516a40){return _0x217cd4['define'](_0x4503('0xa'),attributes,{'tableName':_0x4503('0xb'),'paranoid':![],'indexes':[{'name':_0x4503('0xc'),'fields':[_0x4503('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe74e=['define','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatTransferReport.attributes'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0xe74e,0x10a));var _0xee74=function(_0x29f095,_0x5c23ac){_0x29f095=_0x29f095-0x0;var _0x180061=_0xe74e[_0x29f095];return _0x180061;};'use strict';var _=require('lodash');var util=require(_0xee74('0x0'));var logger=require(_0xee74('0x1'))(_0xee74('0x2'));var moment=require(_0xee74('0x3'));var BPromise=require(_0xee74('0x4'));var rp=require(_0xee74('0x5'));var fs=require('fs');var path=require(_0xee74('0x6'));var rimraf=require(_0xee74('0x7'));var config=require(_0xee74('0x8'));var attributes=require(_0xee74('0x9'));module['exports']=function(_0x483d0a,_0xbb9d43){return _0x483d0a[_0xee74('0xa')]('ChatTransferReport',attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':_0xee74('0xb'),'fields':[_0xee74('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 39975ef..0f4bfc5 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 _0xf1d0=['client','http','request','then','info','request\x20sent','debug','stringify','error','code','message','ChatTransferReport,\x20%s,\x20%s','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise'];(function(_0x33375c,_0x327942){var _0x24084e=function(_0x21039b){while(--_0x21039b){_0x33375c['push'](_0x33375c['shift']());}};_0x24084e(++_0x327942);}(_0xf1d0,0xdd));var _0x0f1d=function(_0x5372e2,_0x531fcf){_0x5372e2=_0x5372e2-0x0;var _0x55ff3d=_0xf1d0[_0x5372e2];return _0x55ff3d;};'use strict';var _=require(_0x0f1d('0x0'));var util=require(_0x0f1d('0x1'));var moment=require(_0x0f1d('0x2'));var BPromise=require('bluebird');var rs=require(_0x0f1d('0x3'));var fs=require('fs');var Redis=require(_0x0f1d('0x4'));var db=require(_0x0f1d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0f1d('0x6'))('rpc');var config=require(_0x0f1d('0x7'));var jayson=require(_0x0f1d('0x8'));var client=jayson[_0x0f1d('0x9')][_0x0f1d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x11a15b,_0x4335df,_0x44e82e){return new BPromise(function(_0x47cc7d,_0x5f0631){return client[_0x0f1d('0xb')](_0x11a15b,_0x44e82e)[_0x0f1d('0xc')](function(_0xf9ed79){logger[_0x0f1d('0xd')]('ChatTransferReport,\x20%s,\x20%s',_0x4335df,_0x0f1d('0xe'));logger[_0x0f1d('0xf')]('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0x4335df,_0x0f1d('0xe'),JSON[_0x0f1d('0x10')](_0xf9ed79));if(_0xf9ed79[_0x0f1d('0x11')]){if(_0xf9ed79[_0x0f1d('0x11')][_0x0f1d('0x12')]===0x1f4){logger[_0x0f1d('0x11')]('ChatTransferReport,\x20%s,\x20%s',_0x4335df,_0xf9ed79[_0x0f1d('0x11')][_0x0f1d('0x13')]);return _0x5f0631(_0xf9ed79['error']['message']);}logger[_0x0f1d('0x11')](_0x0f1d('0x14'),_0x4335df,_0xf9ed79['error'][_0x0f1d('0x13')]);return _0x47cc7d(_0xf9ed79[_0x0f1d('0x11')][_0x0f1d('0x13')]);}else{logger[_0x0f1d('0xd')](_0x0f1d('0x14'),_0x4335df,_0x0f1d('0xe'));_0x47cc7d(_0xf9ed79[_0x0f1d('0x15')][_0x0f1d('0x13')]);}})[_0x0f1d('0x16')](function(_0x1b4fe5){logger[_0x0f1d('0x11')](_0x0f1d('0x14'),_0x4335df,_0x1b4fe5);_0x5f0631(_0x1b4fe5);});});} \ No newline at end of file +var _0x1f70=['info','ChatTransferReport,\x20%s,\x20%s','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','then'];(function(_0x54ba35,_0x55d8bd){var _0x5ddaea=function(_0x2b33da){while(--_0x2b33da){_0x54ba35['push'](_0x54ba35['shift']());}};_0x5ddaea(++_0x55d8bd);}(_0x1f70,0x199));var _0x01f7=function(_0x232556,_0x3f110c){_0x232556=_0x232556-0x0;var _0x4339fa=_0x1f70[_0x232556];return _0x4339fa;};'use strict';var _=require(_0x01f7('0x0'));var util=require('util');var moment=require(_0x01f7('0x1'));var BPromise=require(_0x01f7('0x2'));var rs=require(_0x01f7('0x3'));var fs=require('fs');var Redis=require(_0x01f7('0x4'));var db=require(_0x01f7('0x5'))['db'];var utils=require(_0x01f7('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x01f7('0x7'));var jayson=require(_0x01f7('0x8'));var client=jayson['client'][_0x01f7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4169d8,_0x917da6,_0x424695){return new BPromise(function(_0x54d1ac,_0x373ded){return client['request'](_0x4169d8,_0x424695)[_0x01f7('0xa')](function(_0x12c297){logger[_0x01f7('0xb')](_0x01f7('0xc'),_0x917da6,'request\x20sent');logger[_0x01f7('0xd')](_0x01f7('0xe'),_0x917da6,_0x01f7('0xf'),JSON['stringify'](_0x12c297));if(_0x12c297[_0x01f7('0x10')]){if(_0x12c297[_0x01f7('0x10')]['code']===0x1f4){logger[_0x01f7('0x10')](_0x01f7('0xc'),_0x917da6,_0x12c297[_0x01f7('0x10')][_0x01f7('0x11')]);return _0x373ded(_0x12c297['error'][_0x01f7('0x11')]);}logger[_0x01f7('0x10')](_0x01f7('0xc'),_0x917da6,_0x12c297[_0x01f7('0x10')][_0x01f7('0x11')]);return _0x54d1ac(_0x12c297[_0x01f7('0x10')][_0x01f7('0x11')]);}else{logger[_0x01f7('0xb')](_0x01f7('0xc'),_0x917da6,_0x01f7('0xf'));_0x54d1ac(_0x12c297[_0x01f7('0x12')]['message']);}})[_0x01f7('0x13')](function(_0x27b2b9){logger[_0x01f7('0x10')]('ChatTransferReport,\x20%s,\x20%s',_0x917da6,_0x27b2b9);_0x373ded(_0x27b2b9);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index e44340a..9b5cefb 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 _0xb10b=['../../config/environment','./chatTransferReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','update','delete','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service'];(function(_0x16df8f,_0x3dbe15){var _0x56ffee=function(_0x23aa44){while(--_0x23aa44){_0x16df8f['push'](_0x16df8f['shift']());}};_0x56ffee(++_0x3dbe15);}(_0xb10b,0x12a));var _0xbb10=function(_0x5b58ba,_0x16159f){_0x5b58ba=_0x5b58ba-0x0;var _0xc67099=_0xb10b[_0x5b58ba];return _0xc67099;};'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('0xe')]('/',auth[_0xbb10('0x9')](),controller[_0xbb10('0xf')]);router['put']('/:id',auth[_0xbb10('0x9')](),controller[_0xbb10('0x10')]);router[_0xbb10('0x11')]('/:id',auth[_0xbb10('0x9')](),controller['destroy']);module[_0xbb10('0x12')]=router; \ No newline at end of file +var _0x5f2f=['/describe','/:id','post','create','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index'];(function(_0x32bd74,_0x231209){var _0x1988de=function(_0x3f1ff4){while(--_0x3f1ff4){_0x32bd74['push'](_0x32bd74['shift']());}};_0x1988de(++_0x231209);}(_0x5f2f,0x73));var _0xf5f2=function(_0x5a4438,_0x2152b0){_0x5a4438=_0x5a4438-0x0;var _0x39a4df=_0x5f2f[_0x5a4438];return _0x39a4df;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var auth=require(_0xf5f2('0x6'));var interaction=require(_0xf5f2('0x7'));var config=require('../../config/environment');var controller=require('./chatTransferReport.controller');router[_0xf5f2('0x8')]('/',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0xa')]);router[_0xf5f2('0x8')](_0xf5f2('0xb'),auth[_0xf5f2('0x9')](),controller['describe']);router[_0xf5f2('0x8')](_0xf5f2('0xc'),auth[_0xf5f2('0x9')](),controller['show']);router[_0xf5f2('0xd')]('/',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0xe')]);router['put'](_0xf5f2('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xf5f2('0xf')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0x10')]);module[_0xf5f2('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index b8e0e94..7192a2f 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 _0x34ab=['thumb','star','stringify','input','name','text','getDataValue','onlineForm','parse','setDataValue','textarea','Comments','Leave\x20your\x20comments','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','Your\x20request\x20has\x20not\x20been\x20processed.','Skip','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','email','Agent','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','rounded','We\x20are\x20here!','Chat','Send','Contact\x20us','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Feedback'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x34ab,0xf1));var _0xb34a=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x34ab[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0xb34a('0x0'));var rs=require(_0xb34a('0x1'));module[_0xb34a('0x2')]={'name':{'type':Sequelize[_0xb34a('0x3')],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':'address'},'description':{'type':Sequelize[_0xb34a('0x3')]},'mapKey':{'type':Sequelize['STRING'],'defaultValue':_0xb34a('0x4')},'mapKeyOffline':{'type':Sequelize[_0xb34a('0x3')],'defaultValue':_0xb34a('0x4')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize[_0xb34a('0x3')],'defaultValue':_0xb34a('0x5')},'customerAlias':{'type':Sequelize[_0xb34a('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize[_0xb34a('0x3')],'allowNull':![],'defaultValue':_0xb34a('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xb34a('0x3')],'allowNull':![],'defaultValue':_0xb34a('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xb34a('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xb34a('0x8')],'defaultValue':0xf},'remote':{'type':Sequelize['STRING']},'animation':{'type':Sequelize[_0xb34a('0x9')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xb34a('0xa')](_0xb34a('0xb'),'squared'),'defaultValue':_0xb34a('0xb')},'header_online':{'type':Sequelize[_0xb34a('0x3')],'defaultValue':_0xb34a('0xc')},'start_chat_button':{'type':Sequelize[_0xb34a('0x3')],'defaultValue':_0xb34a('0xd')},'offline_chat_button':{'type':Sequelize[_0xb34a('0x3')],'defaultValue':_0xb34a('0xe')},'header_offline':{'type':Sequelize[_0xb34a('0x3')],'defaultValue':_0xb34a('0xf')},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xb34a('0x8')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':_0xb34a('0x10')},'defaultWhiteLabel':{'type':Sequelize[_0xb34a('0x9')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xb34a('0x11')]},'closingQuestion':{'type':Sequelize[_0xb34a('0x3')],'defaultValue':_0xb34a('0x12')},'formSubmitSuccessMessage':{'type':Sequelize['STRING'],'defaultValue':_0xb34a('0x13')},'formSubmitFailureMessage':{'type':Sequelize[_0xb34a('0x3')],'defaultValue':'Form\x20submission\x20error'},'noteTitle':{'type':Sequelize['STRING'],'defaultValue':_0xb34a('0x14')},'placeholderMessage':{'type':Sequelize[_0xb34a('0x3')],'defaultValue':_0xb34a('0x15')},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':_0xb34a('0x16')},'closingMessageButton':{'type':Sequelize[_0xb34a('0x3')],'defaultValue':_0xb34a('0xe')},'skipMessageButton':{'type':Sequelize[_0xb34a('0x3')],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xb34a('0x9')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xb34a('0x9')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xb34a('0x9')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xb34a('0x3')],'defaultValue':_0xb34a('0x17')},'ratingType':{'type':Sequelize[_0xb34a('0xa')]('star',_0xb34a('0x18')),'defaultValue':_0xb34a('0x19')},'ratingStarsNumber':{'type':Sequelize[_0xb34a('0x8')],'defaultValue':0x5},'onlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0xb34a('0x1a')]({'items':[{'type':_0xb34a('0x1b'),'variable':null,'config':{'placeholder':_0xb34a('0x1c'),'type':_0xb34a('0x1d'),'required':!![]},'props':{'title':_0xb34a('0x1c'),'helpText':''}},{'type':'input','props':{'title':_0xb34a('0x4'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xb34a('0x1e')](_0xb34a('0x1f'))?JSON[_0xb34a('0x20')](this['getDataValue']('onlineForm')):{};},'set':function(_0x3324a2){return this[_0xb34a('0x21')]('onlineForm',JSON[_0xb34a('0x1a')](_0x3324a2));}},'offlineForm':{'type':Sequelize[_0xb34a('0x11')],'defaultValue':function(){return JSON[_0xb34a('0x1a')]({'items':[{'type':_0xb34a('0x1b'),'props':{'title':_0xb34a('0x4'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':_0xb34a('0x4')},'variable':null},{'type':_0xb34a('0x22'),'config':{'placeholder':'Comments'},'props':{'title':_0xb34a('0x23'),'helpText':_0xb34a('0x24')}}],'fromKey':0x0});},'get':function(){return this[_0xb34a('0x1e')](_0xb34a('0x25'))?JSON['parse'](this['getDataValue'](_0xb34a('0x25'))):{};},'set':function(_0x8cc74d){return this['setDataValue'](_0xb34a('0x25'),JSON[_0xb34a('0x1a')](_0x8cc74d));}},'token':{'type':Sequelize[_0xb34a('0x3')],'defaultValue':function(){return rs[_0xb34a('0x26')]();}},'autoclose':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xb34a('0x9')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xb34a('0x9')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize['STRING']},'forwardOffline':{'type':Sequelize[_0xb34a('0x9')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xb34a('0x3')]},'waitingTitle':{'type':Sequelize[_0xb34a('0x3')],'defaultValue':_0xb34a('0x27')},'waitingMessage':{'type':Sequelize[_0xb34a('0x3')],'defaultValue':_0xb34a('0x28')},'offlineMessageSubject':{'type':Sequelize[_0xb34a('0x3')],'defaultValue':_0xb34a('0x29')},'offlineMessageBody':{'type':Sequelize[_0xb34a('0x3')],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize[_0xb34a('0x9')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xb34a('0x3')],'defaultValue':_0xb34a('0x2a')},'skipUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0xb34a('0x2b')},'sendUnmanaged':{'type':Sequelize[_0xb34a('0x3')],'defaultValue':_0xb34a('0xe')},'enableCustomerAttachment':{'type':Sequelize[_0xb34a('0x9')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xb34a('0x9')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xb34a('0x11')]},'showAgentAvatar':{'type':Sequelize[_0xb34a('0x9')],'defaultValue':![]},'timezone':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xb34a('0x2c');}},'notificationSound':{'type':Sequelize[_0xb34a('0x9')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xb34a('0x9')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xb34a('0x3')],'defaultValue':_0xb34a('0x2d')},'waitForTheAssignedAgent':{'type':Sequelize[_0xb34a('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xb34a('0x3')],'defaultValue':'bottom_right'},'verticalAlignment':{'type':Sequelize[_0xb34a('0x8')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0xb34a('0x3')],'defaultValue':_0xb34a('0x2e')},'defaultTitle':{'type':Sequelize[_0xb34a('0x3')]},'customerAvatar':{'type':Sequelize[_0xb34a('0x11')]},'showCustomerAvatar':{'type':Sequelize[_0xb34a('0x9')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xb34a('0x8')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xb34a('0x2f'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xb34a('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xb34a('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xb34a('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xb34a('0x3')],'defaultValue':_0xb34a('0x30')},'systemAvatar':{'type':Sequelize[_0xb34a('0x11')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0xb34a('0x31')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xb34a('0x32'),'set':function(_0x510f7d){if(!_0x510f7d)this[_0xb34a('0x21')](_0xb34a('0x33'),null);this[_0xb34a('0x21')](_0xb34a('0x34'),_0x510f7d);}},'vidaooEscalation':{'type':Sequelize[_0xb34a('0x9')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xb34a('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xcc6f=['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:','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','alternate','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','sequelize','randomstring','exports','STRING','address','email','#011F6A','#ffffff','INTEGER','ENUM','rounded','squared','We\x20are\x20here!','Chat','Send','Powered\x20by\x20xCALLY','BOOLEAN','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','star','thumb','TEXT','stringify','input','name','text','parse','onlineForm','setDataValue','textarea','Comments','Leave\x20your\x20comments','getDataValue','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0xcc6f,0x10f));var _0xfcc6=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xcc6f[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0xfcc6('0x0'));var rs=require(_0xfcc6('0x1'));module[_0xfcc6('0x2')]={'name':{'type':Sequelize[_0xfcc6('0x3')],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xfcc6('0x4')},'description':{'type':Sequelize[_0xfcc6('0x3')]},'mapKey':{'type':Sequelize[_0xfcc6('0x3')],'defaultValue':_0xfcc6('0x5')},'mapKeyOffline':{'type':Sequelize[_0xfcc6('0x3')],'defaultValue':'email'},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':'Agent'},'customerAlias':{'type':Sequelize[_0xfcc6('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xfcc6('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xfcc6('0x3')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xfcc6('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xfcc6('0x8')],'defaultValue':0xf},'remote':{'type':Sequelize['STRING']},'animation':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xfcc6('0x9')](_0xfcc6('0xa'),_0xfcc6('0xb')),'defaultValue':'rounded'},'header_online':{'type':Sequelize[_0xfcc6('0x3')],'defaultValue':_0xfcc6('0xc')},'start_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0xfcc6('0xd')},'offline_chat_button':{'type':Sequelize[_0xfcc6('0x3')],'defaultValue':_0xfcc6('0xe')},'header_offline':{'type':Sequelize['STRING'],'defaultValue':'Contact\x20us'},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xfcc6('0x8')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xfcc6('0x3')],'defaultValue':_0xfcc6('0xf')},'defaultWhiteLabel':{'type':Sequelize[_0xfcc6('0x10')],'defaultValue':!![]},'sitepic':{'type':Sequelize['TEXT']},'closingQuestion':{'type':Sequelize[_0xfcc6('0x3')],'defaultValue':_0xfcc6('0x11')},'formSubmitSuccessMessage':{'type':Sequelize[_0xfcc6('0x3')],'defaultValue':_0xfcc6('0x12')},'formSubmitFailureMessage':{'type':Sequelize['STRING'],'defaultValue':_0xfcc6('0x13')},'noteTitle':{'type':Sequelize[_0xfcc6('0x3')],'defaultValue':_0xfcc6('0x14')},'placeholderMessage':{'type':Sequelize[_0xfcc6('0x3')],'defaultValue':_0xfcc6('0x15')},'closingMessage':{'type':Sequelize[_0xfcc6('0x3')],'defaultValue':_0xfcc6('0x16')},'closingMessageButton':{'type':Sequelize[_0xfcc6('0x3')],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0xfcc6('0x17')},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xfcc6('0x10')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xfcc6('0x10')],'defaultValue':![]},'enableSendButton':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xfcc6('0x3')],'defaultValue':'Feedback'},'ratingType':{'type':Sequelize[_0xfcc6('0x9')](_0xfcc6('0x18'),_0xfcc6('0x19')),'defaultValue':'star'},'ratingStarsNumber':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xfcc6('0x1a')],'defaultValue':function(){return JSON[_0xfcc6('0x1b')]({'items':[{'type':_0xfcc6('0x1c'),'variable':null,'config':{'placeholder':_0xfcc6('0x1d'),'type':_0xfcc6('0x1e'),'required':!![]},'props':{'title':_0xfcc6('0x1d'),'helpText':''}},{'type':_0xfcc6('0x1c'),'props':{'title':_0xfcc6('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0xfcc6('0x5'),'type':_0xfcc6('0x5')},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue']('onlineForm')?JSON[_0xfcc6('0x1f')](this['getDataValue'](_0xfcc6('0x20'))):{};},'set':function(_0x4b4d11){return this[_0xfcc6('0x21')](_0xfcc6('0x20'),JSON[_0xfcc6('0x1b')](_0x4b4d11));}},'offlineForm':{'type':Sequelize[_0xfcc6('0x1a')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0xfcc6('0x1c'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0xfcc6('0x5'),'type':_0xfcc6('0x5')},'variable':null},{'type':_0xfcc6('0x22'),'config':{'placeholder':'Comments'},'props':{'title':_0xfcc6('0x23'),'helpText':_0xfcc6('0x24')}}],'fromKey':0x0});},'get':function(){return this[_0xfcc6('0x25')](_0xfcc6('0x26'))?JSON['parse'](this[_0xfcc6('0x25')](_0xfcc6('0x26'))):{};},'set':function(_0xffcd84){return this[_0xfcc6('0x21')](_0xfcc6('0x26'),JSON['stringify'](_0xffcd84));}},'token':{'type':Sequelize[_0xfcc6('0x3')],'defaultValue':function(){return rs[_0xfcc6('0x27')]();}},'autoclose':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xfcc6('0x10')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xfcc6('0x3')]},'forwardOffline':{'type':Sequelize[_0xfcc6('0x10')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xfcc6('0x3')]},'waitingTitle':{'type':Sequelize[_0xfcc6('0x3')],'defaultValue':_0xfcc6('0x28')},'waitingMessage':{'type':Sequelize['STRING'],'defaultValue':_0xfcc6('0x29')},'offlineMessageSubject':{'type':Sequelize[_0xfcc6('0x3')],'defaultValue':_0xfcc6('0x2a')},'offlineMessageBody':{'type':Sequelize[_0xfcc6('0x3')],'defaultValue':_0xfcc6('0x2b')},'enableUnmanagedNote':{'type':Sequelize[_0xfcc6('0x10')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xfcc6('0x3')],'defaultValue':'Your\x20request\x20has\x20not\x20been\x20processed.'},'skipUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0xfcc6('0x17')},'sendUnmanaged':{'type':Sequelize['STRING'],'defaultValue':'Send'},'enableCustomerAttachment':{'type':Sequelize[_0xfcc6('0x10')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xfcc6('0x10')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xfcc6('0x1a')]},'showAgentAvatar':{'type':Sequelize[_0xfcc6('0x10')],'defaultValue':![]},'timezone':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xfcc6('0x2c');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xfcc6('0x10')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xfcc6('0x10')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xfcc6('0x3')],'defaultValue':_0xfcc6('0x2d')},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize['STRING'],'defaultValue':_0xfcc6('0x2e')},'verticalAlignment':{'type':Sequelize[_0xfcc6('0x8')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0xfcc6('0x3')],'defaultValue':_0xfcc6('0x2f')},'defaultTitle':{'type':Sequelize[_0xfcc6('0x3')]},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize[_0xfcc6('0x10')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xfcc6('0x8')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xfcc6('0x10')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xfcc6('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xfcc6('0x10')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xfcc6('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xfcc6('0x3')],'defaultValue':_0xfcc6('0x30')},'systemAvatar':{'type':Sequelize[_0xfcc6('0x1a')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xfcc6('0x8')],'comment':_0xfcc6('0x31')},'mandatoryDisposition':{'type':Sequelize[_0xfcc6('0x10')],'defaultValue':![],'comment':_0xfcc6('0x32'),'set':function(_0x54d6ff){if(!_0x54d6ff)this[_0xfcc6('0x21')]('mandatoryDispositionPauseId',null);this['setDataValue'](_0xfcc6('0x33'),_0x54d6ff);}},'vidaooEscalation':{'type':Sequelize[_0xfcc6('0x10')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize['STRING'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index e77fb57..2c0e394 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 _0x598d=['chat','CmContact','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','from','from\x20is\x20mandatory','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','DESC','List','account','Applications','list','applications','orderBy','priority','asc','Contacts','ListId','contact','customerIp','headers','cf-connecting-ip','x-forwarded-for','first','split','firstName','x-real-port','referer','browser','version','format','unknown','%s\x20%s','device','vendor','%s\x20%s\x20%s','threadId','externalUrl','ChatInteraction','ContactId','interaction','spread','lastName','messageId','created','autoclose','push','close','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','*,*,*,*','startRouting','EventManager','offline','send','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','utf8','render','toPairs','ChatOfflineMessage','MailAccount','MailServerOut','Smtp','forwardOfflineAddress','service','host','port','secure','authentication','auth','pass','email','addInteraction','getInteractions','Contact','Owner','fullname','Tags','color','tag','Command','iftime\x20%s,%s','interval','timezone','iftime\x20%s','indexOf','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','No\x20timezone','inspect','getSnippet','Interval','Intervals','getProactiveActions','virtual','License','chatLicenseExceeded','some','remote','x-real-ip','connection','alignment','verticalAlignment','addApplications','sequelize','transaction','ChatApplication','bulkCreate','findAndCountAll','getApplications','addProactiveActions','chatProactiveAction','omit','ChatProactiveAction','getFields','online','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','redis','defaults','socket.io-emitter','./chatWebsite.socket','register','client','http','test','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','get','UserProfileResource','stack','name','index','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','options','ChatWebsite','include','findAll','rows','show','includeAll','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','ChatWebsites','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','ChatWebsiteId','Disposition','getDispositions','findOne','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','file','filename','addAvatar','agentAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','join','root','sitepic','../../config/license/util','getLicense','custom','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','isNil','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','existsSync','getSystemAvatar','notify','user-agent-parser','setUA','getResult'];(function(_0x4c3afd,_0x3e7a45){var _0x4e2ef3=function(_0x426053){while(--_0x426053){_0x4c3afd['push'](_0x4c3afd['shift']());}};_0x4e2ef3(++_0x3e7a45);}(_0x598d,0x1b9));var _0xd598=function(_0x323437,_0x3bc345){_0x323437=_0x323437-0x0;var _0x2da452=_0x598d[_0x323437];return _0x2da452;};'use strict';var pdf=require(_0xd598('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xd598('0x1'));var jsonpatch=require(_0xd598('0x2'));var rp=require(_0xd598('0x3'));var moment=require(_0xd598('0x4'));var BPromise=require(_0xd598('0x5'));var Mustache=require(_0xd598('0x6'));var util=require(_0xd598('0x7'));var path=require(_0xd598('0x8'));var sox=require(_0xd598('0x9'));var csv=require(_0xd598('0xa'));var ejs=require(_0xd598('0xb'));var fs=require('fs');var _=require(_0xd598('0xc'));var squel=require(_0xd598('0xd'));var crypto=require(_0xd598('0xe'));var jsforce=require(_0xd598('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xd598('0xa'));var querystring=require('querystring');var Papa=require(_0xd598('0x10'));var Redis=require(_0xd598('0x11'));var authService=require(_0xd598('0x12'));var qs=require(_0xd598('0x13'));var as=require(_0xd598('0x14'));var hardwareService=require(_0xd598('0x15'));var logger=require('../../config/logger')(_0xd598('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0xd598('0x17')]=_[_0xd598('0x18')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xd598('0x19'))(new Redis(config[_0xd598('0x17')]));require(_0xd598('0x1a'))[_0xd598('0x1b')](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0xd598('0x1c')][_0xd598('0x1d')]({'port':0x232a});var client9003=jayson[_0xd598('0x1c')][_0xd598('0x1d')]({'port':0x232b});function checkPasswordPattern(_0x4cb714,_0x5815aa,_0x104a6e){if(_0x104a6e){var _0x1d7205=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1d7205[_0xd598('0x1e')](_0x5815aa)){return _0x4cb714;}else{throw new db['Sequelize']['ValidationError'](_0xd598('0x1f'));}}else{return _0x4cb714;}}function respondWithRpcPromise(_0x6b90cd,_0x382f0b,_0x46f2e5,_0x38fec4){return new BPromise(function(_0x528c01,_0x3823b6){var _0x58df17=_0x38fec4||client;return _0x58df17[_0xd598('0x20')](_0x6b90cd,_0x46f2e5)['then'](function(_0x3980cf){logger[_0xd598('0x21')](_0xd598('0x22'),_0x382f0b,_0xd598('0x23'));logger[_0xd598('0x24')](_0xd598('0x25'),_0x382f0b,_0xd598('0x23'),JSON[_0xd598('0x26')](_0x3980cf));if(_0x3980cf[_0xd598('0x27')]){if(_0x3980cf[_0xd598('0x27')][_0xd598('0x28')]===0x1f4){logger[_0xd598('0x27')](_0xd598('0x22'),_0x382f0b,_0x3980cf[_0xd598('0x27')][_0xd598('0x29')]);return _0x3823b6(_0x3980cf[_0xd598('0x27')][_0xd598('0x29')]);}logger[_0xd598('0x27')](_0xd598('0x22'),_0x382f0b,_0x3980cf['error']['message']);return _0x528c01(_0x3980cf[_0xd598('0x27')][_0xd598('0x29')]);}else{logger[_0xd598('0x21')]('ChatWebsite,\x20%s,\x20%s',_0x382f0b,_0xd598('0x23'));_0x528c01(_0x3980cf[_0xd598('0x2a')]['message']);}})[_0xd598('0x2b')](function(_0x2faaf1){logger['error']('ChatWebsite,\x20%s,\x20%s',_0x382f0b,_0x2faaf1);_0x3823b6(_0x2faaf1);});});}function respondWithStatusCode(_0x26b84e,_0x2490b4){_0x2490b4=_0x2490b4||0xcc;return function(_0x2b6b3c){if(_0x2b6b3c){return _0x26b84e[_0xd598('0x2c')](_0x2490b4);}return _0x26b84e[_0xd598('0x2d')](_0x2490b4)[_0xd598('0x2e')]();};}function respondWithResult(_0x5d2c5a,_0xea4ff0){_0xea4ff0=_0xea4ff0||0xc8;return function(_0x98ea0d){if(_0x98ea0d){return _0x5d2c5a[_0xd598('0x2d')](_0xea4ff0)[_0xd598('0x2f')](_0x98ea0d);}};}function respondWithFilteredResult(_0x3cb75a,_0x49a3c9){return function(_0x1dc172){if(_0x1dc172){var _0xb2e19e=_0x1dc172[_0xd598('0x30')],_0x38a184=_0x49a3c9[_0xd598('0x31')],_0x50804e=_0x49a3c9['offset']+_0x49a3c9[_0xd598('0x32')],_0x3425fd;if(_0x50804e>=_0xb2e19e){_0x50804e=_0xb2e19e;_0x3425fd=0xc8;}else{_0x3425fd=0xce;}_0x3cb75a[_0xd598('0x2d')](_0x3425fd);return _0x3cb75a[_0xd598('0x33')](_0xd598('0x34'),_0x38a184+'-'+_0x50804e+'/'+_0xb2e19e)[_0xd598('0x2f')](_0x1dc172);}return null;};}function patchUpdates(_0xf88574){return function(_0x32e0ec){try{jsonpatch[_0xd598('0x35')](_0x32e0ec,_0xf88574,!![]);}catch(_0x239fa4){return BPromise[_0xd598('0x36')](_0x239fa4);}return _0x32e0ec['save']();};}function saveUpdates(_0x3ec8c8,_0x5bbcee){return function(_0x288560){if(_0x288560){return _0x288560[_0xd598('0x37')](_0x3ec8c8)[_0xd598('0x38')](function(_0x949eb1){return _0x949eb1;});}return null;};}function removeEntity(_0xc7ad1b,_0x1d84e9){return function(_0x198c3d){if(_0x198c3d){return _0x198c3d[_0xd598('0x39')]()[_0xd598('0x38')](function(){var _0x25a464=_0x198c3d[_0xd598('0x3a')]({'plain':!![]});var _0x51e2e3='ChatWebsites';return db[_0xd598('0x3b')][_0xd598('0x39')]({'where':{'type':_0x51e2e3,'resourceId':_0x25a464['id']}})[_0xd598('0x38')](function(){return _0x198c3d;});})[_0xd598('0x38')](function(){_0xc7ad1b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x50c715,_0x55cf78){return function(_0x20380e){if(!_0x20380e){_0x50c715[_0xd598('0x2c')](0x194);}return _0x20380e;};}function handleError(_0x3d4224,_0x1da0ba){_0x1da0ba=_0x1da0ba||0x1f4;return function(_0xbb548){logger[_0xd598('0x27')](_0xbb548[_0xd598('0x3c')]);if(_0xbb548[_0xd598('0x3d')]){delete _0xbb548['name'];}_0x3d4224[_0xd598('0x2d')](_0x1da0ba)['send'](_0xbb548);};}exports[_0xd598('0x3e')]=function(_0x1c1f66,_0x3bb6ab){var _0x57f142={'include':[{'model':db[_0xd598('0x3f')],'as':_0xd598('0x40')}]},_0x4cdb4f={},_0x4fba00={'count':0x0,'rows':[]};var _0x29fab1=_[_0xd598('0x41')](db['ChatWebsite'][_0xd598('0x42')],function(_0x1761be){return{'name':_0x1761be[_0xd598('0x43')],'type':_0x1761be['type'][_0xd598('0x44')]};});_0x4cdb4f[_0xd598('0x45')]=_[_0xd598('0x41')](_0x29fab1,_0xd598('0x3d'));_0x4cdb4f[_0xd598('0x46')]=_[_0xd598('0x47')](_0x1c1f66[_0xd598('0x46')]);_0x4cdb4f[_0xd598('0x48')]=_[_0xd598('0x49')](_0x4cdb4f['model'],_0x4cdb4f[_0xd598('0x46')]);_0x57f142[_0xd598('0x4a')]=_[_0xd598('0x49')](_0x4cdb4f['model'],qs['fields'](_0x1c1f66[_0xd598('0x46')][_0xd598('0x4b')]));_0x57f142[_0xd598('0x4a')]=_0x57f142[_0xd598('0x4a')][_0xd598('0x4c')]?_0x57f142[_0xd598('0x4a')]:_0x4cdb4f[_0xd598('0x45')];if(!_0x1c1f66[_0xd598('0x46')][_0xd598('0x4d')](_0xd598('0x4e'))){_0x57f142['limit']=qs[_0xd598('0x32')](_0x1c1f66[_0xd598('0x46')][_0xd598('0x32')]);_0x57f142[_0xd598('0x31')]=qs[_0xd598('0x31')](_0x1c1f66['query'][_0xd598('0x31')]);}_0x57f142[_0xd598('0x4f')]=qs[_0xd598('0x50')](_0x1c1f66[_0xd598('0x46')][_0xd598('0x50')]);_0x57f142['where']=qs[_0xd598('0x48')](_[_0xd598('0x51')](_0x1c1f66[_0xd598('0x46')],_0x4cdb4f[_0xd598('0x48')]),_0x29fab1);if(_0x1c1f66[_0xd598('0x46')][_0xd598('0x52')]){_0x57f142[_0xd598('0x53')]=_[_0xd598('0x54')](_0x57f142[_0xd598('0x53')],{'$or':_['map'](_0x29fab1,function(_0x6de56e){if(_0x6de56e[_0xd598('0x55')]!=='VIRTUAL'){var _0x58abe9={};_0x58abe9[_0x6de56e[_0xd598('0x3d')]]={'$like':'%'+_0x1c1f66[_0xd598('0x46')][_0xd598('0x52')]+'%'};return _0x58abe9;}})});}_0x57f142=_[_0xd598('0x54')]({},_0x57f142,_0x1c1f66[_0xd598('0x56')]);var _0x2ec19c={'where':_0x57f142[_0xd598('0x53')]};return db[_0xd598('0x57')][_0xd598('0x30')](_0x2ec19c)['then'](function(_0x3c3a91){_0x4fba00[_0xd598('0x30')]=_0x3c3a91;if(_0x1c1f66['query']['includeAll']){_0x57f142[_0xd598('0x58')]=[{'all':!![]}];}return db[_0xd598('0x57')][_0xd598('0x59')](_0x57f142);})[_0xd598('0x38')](function(_0x236ab0){_0x4fba00[_0xd598('0x5a')]=_0x236ab0;return _0x4fba00;})['then'](respondWithFilteredResult(_0x3bb6ab,_0x57f142))[_0xd598('0x2b')](handleError(_0x3bb6ab,null));};exports[_0xd598('0x5b')]=function(_0x53bab5,_0xb089b7){var _0x2c7ef2={'raw':![],'where':{'id':_0x53bab5['params']['id']},'include':[{'model':db[_0xd598('0x3f')],'as':'mandatoryDispositionPause'}]},_0x2d665c={};_0x2d665c['model']=_[_0xd598('0x47')](db['ChatWebsite'][_0xd598('0x42')]);_0x2d665c[_0xd598('0x46')]=_[_0xd598('0x47')](_0x53bab5['query']);_0x2d665c['filters']=_['intersection'](_0x2d665c['model'],_0x2d665c[_0xd598('0x46')]);_0x2c7ef2[_0xd598('0x4a')]=_[_0xd598('0x49')](_0x2d665c['model'],qs[_0xd598('0x4b')](_0x53bab5[_0xd598('0x46')][_0xd598('0x4b')]));_0x2c7ef2[_0xd598('0x4a')]=_0x2c7ef2['attributes']['length']?_0x2c7ef2[_0xd598('0x4a')]:_0x2d665c[_0xd598('0x45')];if(_0x53bab5[_0xd598('0x46')][_0xd598('0x5c')]){_0x2c7ef2[_0xd598('0x58')]=[{'all':!![]}];}_0x2c7ef2=_[_0xd598('0x54')]({},_0x2c7ef2,_0x53bab5[_0xd598('0x56')]);return db[_0xd598('0x57')][_0xd598('0x5d')](_0x2c7ef2)['then'](handleEntityNotFound(_0xb089b7,null))['then'](respondWithResult(_0xb089b7,null))[_0xd598('0x2b')](handleError(_0xb089b7,null));};exports[_0xd598('0x5e')]=function(_0x1e1a31,_0x207e98){return db['ChatWebsite'][_0xd598('0x5e')](_0x1e1a31[_0xd598('0x5f')],{})[_0xd598('0x38')](function(_0x2c1341){var _0x24696b=_0x1e1a31['user'][_0xd598('0x3a')]({'plain':!![]});if(!_0x24696b)throw new Error(_0xd598('0x60'));if(_0x24696b['role']===_0xd598('0x61')){var _0x5af418=_0x2c1341[_0xd598('0x3a')]({'plain':!![]});var _0x706775=_0xd598('0x62');return db[_0xd598('0x63')][_0xd598('0x5d')]({'where':{'name':_0x706775,'userProfileId':_0x24696b['userProfileId']},'raw':!![]})[_0xd598('0x38')](function(_0x4ecc02){if(_0x4ecc02&&_0x4ecc02['autoAssociation']===0x0){return db[_0xd598('0x3b')][_0xd598('0x5e')]({'name':_0x5af418[_0xd598('0x3d')],'resourceId':_0x5af418['id'],'type':_0x4ecc02[_0xd598('0x3d')],'sectionId':_0x4ecc02['id']},{})[_0xd598('0x38')](function(){return _0x2c1341;});}else{return _0x2c1341;}})[_0xd598('0x2b')](function(_0x3763b3){logger[_0xd598('0x27')](_0xd598('0x64'),_0x3763b3);throw _0x3763b3;});}return _0x2c1341;})[_0xd598('0x38')](respondWithResult(_0x207e98,0xc9))[_0xd598('0x2b')](handleError(_0x207e98,null));};exports[_0xd598('0x37')]=function(_0x113ad8,_0x587803){if(_0x113ad8[_0xd598('0x5f')]['id']){delete _0x113ad8[_0xd598('0x5f')]['id'];}return db[_0xd598('0x57')]['find']({'where':{'id':_0x113ad8[_0xd598('0x65')]['id']},'include':[{'model':db['Pause'],'as':_0xd598('0x40')}]})[_0xd598('0x38')](handleEntityNotFound(_0x587803,null))[_0xd598('0x38')](saveUpdates(_0x113ad8[_0xd598('0x5f')],null))['then'](respondWithResult(_0x587803,null))['catch'](handleError(_0x587803,null));};exports['destroy']=function(_0x23140e,_0x520489){return db[_0xd598('0x57')]['find']({'where':{'id':_0x23140e[_0xd598('0x65')]['id']}})[_0xd598('0x38')](handleEntityNotFound(_0x520489,null))[_0xd598('0x38')](removeEntity(_0x520489,null))[_0xd598('0x2b')](handleError(_0x520489,null));};exports[_0xd598('0x66')]=function(_0x57ee13,_0xf38465){return db[_0xd598('0x57')][_0xd598('0x66')]()[_0xd598('0x38')](respondWithResult(_0xf38465,null))[_0xd598('0x2b')](handleError(_0xf38465,null));};exports['addDisposition']=function(_0x50fa3e,_0x36595b,_0x13d273){if(_0x50fa3e[_0xd598('0x5f')]['id']){delete _0x50fa3e[_0xd598('0x5f')]['id'];}return db['ChatWebsite'][_0xd598('0x5d')]({'where':{'id':_0x50fa3e[_0xd598('0x65')]['id']}})[_0xd598('0x38')](handleEntityNotFound(_0x36595b,null))[_0xd598('0x38')](function(_0x141425){if(_0x141425){_0x50fa3e[_0xd598('0x5f')][_0xd598('0x67')]=_0x141425['id'];return db[_0xd598('0x68')][_0xd598('0x5e')](_0x50fa3e[_0xd598('0x5f')]);}})['then'](respondWithResult(_0x36595b,null))[_0xd598('0x2b')](handleError(_0x36595b,null));};exports[_0xd598('0x69')]=function(_0x58f04c,_0x3001a3,_0x4b094f){var _0x352f4e={'raw':![],'where':{}};var _0x392456={};var _0x54cd53={'count':0x0,'rows':[]};return db[_0xd598('0x57')][_0xd598('0x6a')]({'where':{'id':_0x58f04c[_0xd598('0x65')]['id']}})[_0xd598('0x38')](handleEntityNotFound(_0x3001a3,null))[_0xd598('0x38')](function(_0x4dd820){if(_0x4dd820){_0x392456[_0xd598('0x45')]=_[_0xd598('0x47')](db[_0xd598('0x68')][_0xd598('0x42')]);_0x392456['query']=_[_0xd598('0x47')](_0x58f04c[_0xd598('0x46')]);_0x392456[_0xd598('0x48')]=_[_0xd598('0x49')](_0x392456[_0xd598('0x45')],_0x392456[_0xd598('0x46')]);_0x352f4e['attributes']=_[_0xd598('0x49')](_0x392456[_0xd598('0x45')],qs['fields'](_0x58f04c[_0xd598('0x46')][_0xd598('0x4b')]));_0x352f4e[_0xd598('0x4a')]=_0x352f4e[_0xd598('0x4a')]['length']?_0x352f4e[_0xd598('0x4a')]:_0x392456[_0xd598('0x45')];if(!_0x58f04c[_0xd598('0x46')][_0xd598('0x4d')](_0xd598('0x4e'))){_0x352f4e[_0xd598('0x32')]=qs[_0xd598('0x32')](_0x58f04c[_0xd598('0x46')][_0xd598('0x32')]);_0x352f4e['offset']=qs[_0xd598('0x31')](_0x58f04c[_0xd598('0x46')][_0xd598('0x31')]);}_0x352f4e[_0xd598('0x4f')]=qs[_0xd598('0x50')](_0x58f04c[_0xd598('0x46')][_0xd598('0x50')]);_0x352f4e[_0xd598('0x53')]=qs[_0xd598('0x48')](_[_0xd598('0x51')](_0x58f04c[_0xd598('0x46')],_0x392456[_0xd598('0x48')]));_0x352f4e[_0xd598('0x53')][_0xd598('0x67')]=_0x4dd820['id'];if(_0x58f04c[_0xd598('0x46')][_0xd598('0x52')]){_0x352f4e['where']=_[_0xd598('0x54')](_0x352f4e[_0xd598('0x53')],{'$or':_['map'](_0x352f4e['attributes'],function(_0x43c200){var _0x38070f={};_0x38070f[_0x43c200]={'$like':'%'+_0x58f04c[_0xd598('0x46')][_0xd598('0x52')]+'%'};return _0x38070f;})});}_0x352f4e=_['merge']({},_0x352f4e,_0x58f04c[_0xd598('0x56')]);return db[_0xd598('0x68')][_0xd598('0x30')]({'where':_0x352f4e[_0xd598('0x53')]})[_0xd598('0x38')](function(_0x5c4b2e){_0x54cd53[_0xd598('0x30')]=_0x5c4b2e;if(_0x58f04c[_0xd598('0x46')][_0xd598('0x5c')]){_0x352f4e[_0xd598('0x58')]=[{'all':!![]}];}return db[_0xd598('0x68')][_0xd598('0x59')](_0x352f4e);})[_0xd598('0x38')](function(_0x5b4921){_0x54cd53['rows']=_0x5b4921;return _0x54cd53;});}})[_0xd598('0x38')](respondWithFilteredResult(_0x3001a3,_0x352f4e))[_0xd598('0x2b')](handleError(_0x3001a3,null));};exports[_0xd598('0x6b')]=function(_0x1a2cf0,_0xbbfc47,_0x4a3ee1){return db[_0xd598('0x57')][_0xd598('0x5d')]({'where':{'id':_0x1a2cf0[_0xd598('0x65')]['id']}})[_0xd598('0x38')](handleEntityNotFound(_0xbbfc47,null))[_0xd598('0x38')](function(_0x41ee36){if(_0x41ee36){return _0x41ee36[_0xd598('0x6b')](_0x1a2cf0[_0xd598('0x46')][_0xd598('0x6c')]);}})[_0xd598('0x38')](respondWithStatusCode(_0xbbfc47,null))['catch'](handleError(_0xbbfc47,null));};exports[_0xd598('0x6d')]=function(_0x106616,_0x3271f3,_0x3c7a7b){if(_0x106616[_0xd598('0x5f')]['id']){delete _0x106616['body']['id'];}return db['ChatWebsite'][_0xd598('0x5d')]({'where':{'id':_0x106616[_0xd598('0x65')]['id']}})[_0xd598('0x38')](handleEntityNotFound(_0x3271f3,null))['then'](function(_0x58a48d){if(_0x58a48d){_0x106616['body'][_0xd598('0x67')]=_0x58a48d['id'];return db[_0xd598('0x6e')]['create'](_0x106616[_0xd598('0x5f')]);}})[_0xd598('0x38')](respondWithResult(_0x3271f3,null))[_0xd598('0x2b')](handleError(_0x3271f3,null));};exports[_0xd598('0x6f')]=function(_0x4fb267,_0xd5d594,_0x2bca1f){var _0x17b75f={'raw':![],'where':{}};var _0x5bb7e5={};var _0xdf6873={'count':0x0,'rows':[]};return db[_0xd598('0x57')][_0xd598('0x6a')]({'where':{'id':_0x4fb267[_0xd598('0x65')]['id']}})['then'](handleEntityNotFound(_0xd5d594,null))[_0xd598('0x38')](function(_0x27e840){if(_0x27e840){_0x5bb7e5[_0xd598('0x45')]=_[_0xd598('0x47')](db[_0xd598('0x6e')][_0xd598('0x42')]);_0x5bb7e5[_0xd598('0x46')]=_[_0xd598('0x47')](_0x4fb267[_0xd598('0x46')]);_0x5bb7e5[_0xd598('0x48')]=_[_0xd598('0x49')](_0x5bb7e5[_0xd598('0x45')],_0x5bb7e5['query']);_0x17b75f[_0xd598('0x4a')]=_[_0xd598('0x49')](_0x5bb7e5[_0xd598('0x45')],qs[_0xd598('0x4b')](_0x4fb267[_0xd598('0x46')]['fields']));_0x17b75f[_0xd598('0x4a')]=_0x17b75f[_0xd598('0x4a')][_0xd598('0x4c')]?_0x17b75f['attributes']:_0x5bb7e5[_0xd598('0x45')];if(!_0x4fb267[_0xd598('0x46')][_0xd598('0x4d')](_0xd598('0x4e'))){_0x17b75f[_0xd598('0x32')]=qs[_0xd598('0x32')](_0x4fb267[_0xd598('0x46')][_0xd598('0x32')]);_0x17b75f[_0xd598('0x31')]=qs['offset'](_0x4fb267[_0xd598('0x46')]['offset']);}_0x17b75f['order']=qs[_0xd598('0x50')](_0x4fb267[_0xd598('0x46')]['sort']);_0x17b75f['where']=qs[_0xd598('0x48')](_['pick'](_0x4fb267[_0xd598('0x46')],_0x5bb7e5[_0xd598('0x48')]));_0x17b75f[_0xd598('0x53')][_0xd598('0x67')]=_0x27e840['id'];if(_0x4fb267['query']['filter']){_0x17b75f['where']=_['merge'](_0x17b75f[_0xd598('0x53')],{'$or':_['map'](_0x17b75f[_0xd598('0x4a')],function(_0x5801c1){var _0x1bc2fd={};_0x1bc2fd[_0x5801c1]={'$like':'%'+_0x4fb267['query'][_0xd598('0x52')]+'%'};return _0x1bc2fd;})});}_0x17b75f=_['merge']({},_0x17b75f,_0x4fb267[_0xd598('0x56')]);return db[_0xd598('0x6e')][_0xd598('0x30')]({'where':_0x17b75f[_0xd598('0x53')]})['then'](function(_0x154403){_0xdf6873['count']=_0x154403;if(_0x4fb267[_0xd598('0x46')][_0xd598('0x5c')]){_0x17b75f['include']=[{'all':!![]}];}return db[_0xd598('0x6e')][_0xd598('0x59')](_0x17b75f);})[_0xd598('0x38')](function(_0x1d026f){_0xdf6873[_0xd598('0x5a')]=_0x1d026f;return _0xdf6873;});}})[_0xd598('0x38')](respondWithFilteredResult(_0xd5d594,_0x17b75f))[_0xd598('0x2b')](handleError(_0xd5d594,null));};exports[_0xd598('0x70')]=function(_0x4c0470,_0x2247aa,_0xd67e0){return db[_0xd598('0x57')][_0xd598('0x5d')]({'where':{'id':_0x4c0470[_0xd598('0x65')]['id']}})[_0xd598('0x38')](handleEntityNotFound(_0x2247aa,null))[_0xd598('0x38')](function(_0x4c0051){if(_0x4c0051){return _0x4c0051['removeAnswers'](_0x4c0470[_0xd598('0x46')][_0xd598('0x6c')]);}})['then'](respondWithStatusCode(_0x2247aa,null))[_0xd598('0x2b')](handleError(_0x2247aa,null));};exports['addLogo']=function(_0x46cef7,_0x65b833,_0x18458c){_0x46cef7[_0xd598('0x5f')]['sitepic']=_0x46cef7[_0xd598('0x71')][_0xd598('0x72')];return db[_0xd598('0x57')][_0xd598('0x5d')]({'where':{'id':_0x46cef7['params']['id']}})[_0xd598('0x38')](handleEntityNotFound(_0x65b833,null))['then'](saveUpdates(_0x46cef7[_0xd598('0x5f')],null))[_0xd598('0x38')](respondWithResult(_0x65b833,null))[_0xd598('0x2b')](handleError(_0x65b833,null));};exports[_0xd598('0x73')]=function(_0x124391,_0x40dd50,_0x2bd47c){_0x124391['body'][_0xd598('0x74')]=_0x124391[_0xd598('0x71')][_0xd598('0x72')];return db['ChatWebsite'][_0xd598('0x5d')]({'where':{'id':_0x124391[_0xd598('0x65')]['id']}})[_0xd598('0x38')](handleEntityNotFound(_0x40dd50,null))[_0xd598('0x38')](saveUpdates(_0x124391[_0xd598('0x5f')],null))[_0xd598('0x38')](respondWithResult(_0x40dd50,null))['catch'](handleError(_0x40dd50,null));};exports[_0xd598('0x75')]=function(_0x5f1313,_0x1475f9,_0x3061bf){_0x5f1313[_0xd598('0x5f')][_0xd598('0x76')]=_0x5f1313['file'][_0xd598('0x72')];return db[_0xd598('0x57')][_0xd598('0x5d')]({'where':{'id':_0x5f1313[_0xd598('0x65')]['id']}})['then'](handleEntityNotFound(_0x1475f9,null))['then'](saveUpdates(_0x5f1313['body'],null))['then'](respondWithResult(_0x1475f9,null))[_0xd598('0x2b')](handleError(_0x1475f9,null));};exports[_0xd598('0x77')]=function(_0x1adba5,_0x290c00,_0x397ed6){_0x1adba5[_0xd598('0x5f')][_0xd598('0x78')]=_0x1adba5[_0xd598('0x71')][_0xd598('0x72')];return db[_0xd598('0x57')][_0xd598('0x5d')]({'where':{'id':_0x1adba5[_0xd598('0x65')]['id']}})[_0xd598('0x38')](handleEntityNotFound(_0x290c00,null))[_0xd598('0x38')](saveUpdates(_0x1adba5[_0xd598('0x5f')],null))[_0xd598('0x38')](respondWithResult(_0x290c00,null))['catch'](handleError(_0x290c00,null));};exports[_0xd598('0x79')]=function(_0x484ebf,_0x205dd2,_0x2538c0){var _0x5f0df6=path[_0xd598('0x7a')](config[_0xd598('0x7b')],'server/files/images/logos/default_logo.svg');var _0x3a3e51={'where':{'id':_0x484ebf[_0xd598('0x65')]['id']},'attributes':['id',_0xd598('0x7c')],'raw':!![]};var _0x57ea2a=![];return require(_0xd598('0x7d'))[_0xd598('0x7e')]()['then'](function(_0x22eb45){if(_0x22eb45){_0x57ea2a=_0x22eb45[_0xd598('0x7f')];}})[_0xd598('0x38')](function(){return db[_0xd598('0x57')][_0xd598('0x5d')](_0x3a3e51);})[_0xd598('0x38')](handleEntityNotFound(_0x205dd2,null))[_0xd598('0x38')](function(_0x1752e2){if(_0x1752e2){if(!_['isNil'](_0x1752e2[_0xd598('0x7c')])){if(fs['existsSync'](path[_0xd598('0x7a')](config[_0xd598('0x7b')],_0xd598('0x80'),_0x1752e2[_0xd598('0x7c')]))&&_0x57ea2a){_0x5f0df6=path[_0xd598('0x7a')](config[_0xd598('0x7b')],_0xd598('0x80'),_0x1752e2[_0xd598('0x7c')]);}}return _0x205dd2[_0xd598('0x81')](_0x5f0df6);}})['catch'](handleError(_0x205dd2,null));};exports[_0xd598('0x82')]=function(_0x3e8208,_0x5e1588,_0x9d61da){var _0x3cad9f=path[_0xd598('0x7a')](config[_0xd598('0x7b')],_0xd598('0x83'));var _0x4d1a0b={'where':{'id':_0x3e8208[_0xd598('0x65')]['id']},'attributes':['id','agentAvatar'],'raw':!![]};return db[_0xd598('0x57')][_0xd598('0x5d')](_0x4d1a0b)[_0xd598('0x38')](handleEntityNotFound(_0x5e1588,null))['then'](function(_0x5893ba){if(_0x5893ba){if(!_[_0xd598('0x84')](_0x5893ba[_0xd598('0x74')])){if(fs['existsSync'](path[_0xd598('0x7a')](config[_0xd598('0x7b')],_0xd598('0x85'),_0x5893ba['agentAvatar']))){_0x3cad9f=path[_0xd598('0x7a')](config[_0xd598('0x7b')],_0xd598('0x85'),_0x5893ba['agentAvatar']);}}return _0x5e1588[_0xd598('0x81')](_0x3cad9f);}})[_0xd598('0x2b')](handleError(_0x5e1588,null));};exports[_0xd598('0x86')]=function(_0x47b8b0,_0x525727,_0x199aab){var _0x2a29a9=path['join'](config[_0xd598('0x7b')],_0xd598('0x87'));var _0x2df418={'where':{'id':_0x47b8b0[_0xd598('0x65')]['id']},'attributes':['id',_0xd598('0x76'),_0xd598('0x88')],'raw':!![]};return db[_0xd598('0x57')][_0xd598('0x5d')](_0x2df418)[_0xd598('0x38')](handleEntityNotFound(_0x525727,null))[_0xd598('0x38')](function(_0x5d67cb){if(_0x5d67cb){if(!_[_0xd598('0x84')](_0x5d67cb[_0xd598('0x76')])){if(fs[_0xd598('0x89')](path[_0xd598('0x7a')](config[_0xd598('0x7b')],_0xd598('0x85'),_0x5d67cb[_0xd598('0x76')]))&&_0x5d67cb[_0xd598('0x88')]){_0x2a29a9=path[_0xd598('0x7a')](config[_0xd598('0x7b')],_0xd598('0x85'),_0x5d67cb[_0xd598('0x76')]);}}return _0x525727[_0xd598('0x81')](_0x2a29a9);}})['catch'](handleError(_0x525727,null));};exports[_0xd598('0x8a')]=function(_0x5df211,_0x37391e,_0x27b31d){var _0x306f32=path[_0xd598('0x7a')](config[_0xd598('0x7b')],'server/files/images/avatars/system_avatar.png');var _0xed1b05={'where':{'id':_0x5df211['params']['id']},'attributes':['id',_0xd598('0x78')],'raw':!![]};return db[_0xd598('0x57')]['find'](_0xed1b05)[_0xd598('0x38')](handleEntityNotFound(_0x37391e,null))[_0xd598('0x38')](function(_0x46920e){if(_0x46920e){if(!_['isNil'](_0x46920e[_0xd598('0x78')])){if(fs[_0xd598('0x89')](path[_0xd598('0x7a')](config['root'],_0xd598('0x85'),_0x46920e[_0xd598('0x78')]))){_0x306f32=path[_0xd598('0x7a')](config[_0xd598('0x7b')],'server/files/images/avatars/',_0x46920e[_0xd598('0x78')]);}}return _0x37391e[_0xd598('0x81')](_0x306f32);}})[_0xd598('0x2b')](handleError(_0x37391e,null));};exports[_0xd598('0x8b')]=function(_0x4b2d94,_0x758ef1,_0x26eb8d){var _0x3a8fd5=require(_0xd598('0x8c'));var _0x2825cd=new _0x3a8fd5();var _0x5aa7b2=_0x2825cd[_0xd598('0x8d')](_0x4b2d94['headers']['user-agent'])[_0xd598('0x8e')]();var _0x3f8c7f={'body':_0x4b2d94['body'],'channel':_0xd598('0x8f')};var _0x40631f=[];var _0x48629d=[];var _0x5bfaee={};var _0xd57400=![];return db[_0xd598('0x90')]['describe']()['then'](function(_0x1dbcb4){if(!_0x1dbcb4){throw new db['Sequelize'][(_0xd598('0x91'))](_0xd598('0x92'));}_0x40631f=_[_0xd598('0x93')](_[_0xd598('0x47')](_0x1dbcb4),[_0xd598('0x94'),_0xd598('0x95')]);_0x48629d=_[_0xd598('0x93')](_[_0xd598('0x47')](_0x1dbcb4),[_0xd598('0x94'),_0xd598('0x95'),_0xd598('0x96'),'ListId']);if(_0x4b2d94[_0xd598('0x5f')]['id']){delete _0x4b2d94[_0xd598('0x5f')]['id'];}if(_[_0xd598('0x84')](_0x4b2d94[_0xd598('0x5f')][_0xd598('0x97')])){throw new db['Sequelize'][(_0xd598('0x91'))](_0xd598('0x98'));}if(_['isNil'](_0x4b2d94['body'][_0xd598('0x5f')])||_0x4b2d94[_0xd598('0x5f')][_0xd598('0x5f')]===''){throw new db[(_0xd598('0x99'))][(_0xd598('0x91'))](_0xd598('0x9a'));}if(_[_0xd598('0x84')](_0x4b2d94[_0xd598('0x5f')]['mapKey'])){throw new db[(_0xd598('0x99'))]['ValidationError'](_0xd598('0x9b')+_0x48629d);}if(!_[_0xd598('0x9c')](_0x48629d,_0x4b2d94['body']['mapKey'])){throw new db['Sequelize']['ValidationError'](_0xd598('0x9d')+_0x48629d);}_0x5bfaee[_0x4b2d94['body'][_0xd598('0x9e')]]=_0x4b2d94[_0xd598('0x5f')]['from'];})[_0xd598('0x38')](function(){return db[_0xd598('0x57')][_0xd598('0x5d')]({'where':{'id':_0x4b2d94[_0xd598('0x65')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db['CmContact'],'as':'Contacts','where':_0x5bfaee,'limit':0x1,'order':[['updatedAt',_0xd598('0x9f')]]}]},{'model':db['ChatApplication'],'as':'Applications'}]});})[_0xd598('0x38')](handleEntityNotFound(_0x758ef1,null))[_0xd598('0x38')](function(_0x3e45fd){if(_0x3e45fd&&_0x3e45fd[_0xd598('0xa0')]){_0x3f8c7f[_0xd598('0xa1')]=_0x3e45fd;_0x3f8c7f['applications']=_0x3e45fd[_0xd598('0xa2')];_0x3f8c7f[_0xd598('0xa3')]=_0x3e45fd[_0xd598('0xa0')];_0x3f8c7f[_0xd598('0xa4')]=_[_0xd598('0xa5')](_0x3f8c7f[_0xd598('0xa4')],[_0xd598('0xa6')],[_0xd598('0xa7')]);if(_0x3f8c7f[_0xd598('0xa1')]['Applications']){delete _0x3f8c7f[_0xd598('0xa1')][_0xd598('0xa2')];}if(_0x3f8c7f['account']['List']&&_0x3f8c7f[_0xd598('0xa1')]['List'][_0xd598('0xa8')][_0xd598('0x4c')]){return _0x3f8c7f[_0xd598('0xa1')][_0xd598('0xa0')][_0xd598('0xa8')][0x0];}var _0x3e13b1=_[_0xd598('0x18')](_0x4b2d94[_0xd598('0x5f')],{'firstName':_0x4b2d94['body']['from'],'ListId':_0x3e45fd[_0xd598('0xa9')]});_0x3e13b1[_0x4b2d94[_0xd598('0x5f')][_0xd598('0x9e')]]=_0x4b2d94[_0xd598('0x5f')][_0xd598('0x97')];return db['CmContact'][_0xd598('0x5e')](_0x3e13b1,{'fields':_0x40631f,'raw':!![]});}})['then'](handleEntityNotFound(_0x758ef1,null))[_0xd598('0x38')](function(_0x4a4cf3){_0x3f8c7f[_0xd598('0xaa')]=_0x4a4cf3;var _0x25ff8e=_0x4b2d94[_0xd598('0x5f')][_0xd598('0xab')];if(_0x4b2d94[_0xd598('0xac')][_0xd598('0xad')]){_0x25ff8e=_0x4b2d94[_0xd598('0xac')][_0xd598('0xad')];}else if(_0x4b2d94['headers'][_0xd598('0xae')]){_0x25ff8e=_[_0xd598('0xaf')](_0x4b2d94[_0xd598('0xac')][_0xd598('0xae')][_0xd598('0xb0')](','));}if(_0x4a4cf3){var _0x3825fb={'ContactId':_0x4a4cf3['id'],'ChatWebsiteId':_0x4b2d94['params']['id'],'from':(_0x4a4cf3[_0xd598('0xb1')]||'')+'\x20'+(_0x4a4cf3['lastName']||''),'customerIp':_0x25ff8e,'customerPort':_0x4b2d94[_0xd598('0xac')][_0xd598('0xb2')]?_0x4b2d94[_0xd598('0xac')]['x-real-port']:null,'referer':_0x4b2d94['body'][_0xd598('0xb3')],'browserName':_0x5aa7b2[_0xd598('0xb4')]['name']&&_0x5aa7b2[_0xd598('0xb4')][_0xd598('0xb5')]?util[_0xd598('0xb6')]('%s\x20%s',_0x5aa7b2['browser']['name'],_0x5aa7b2[_0xd598('0xb4')][_0xd598('0xb5')]):_0xd598('0xb7'),'browserVersion':_0x5aa7b2[_0xd598('0xb4')][_0xd598('0xb5')]||'unknown','osName':util[_0xd598('0xb6')](_0xd598('0xb8'),_0x5aa7b2['os']['name'],_0x5aa7b2['os'][_0xd598('0xb5')]),'osVersion':_0x5aa7b2['os'][_0xd598('0xb5')],'deviceModel':_0x5aa7b2[_0xd598('0xb9')][_0xd598('0x45')]&&_0x5aa7b2['device'][_0xd598('0xba')]?util[_0xd598('0xb6')](_0xd598('0xbb'),_0x5aa7b2['device'][_0xd598('0x45')],_0x5aa7b2[_0xd598('0xb9')][_0xd598('0xba')],_0x5aa7b2['device'][_0xd598('0x55')]):null,'deviceVendor':_0x5aa7b2[_0xd598('0xb9')][_0xd598('0xba')],'deviceType':_0x5aa7b2[_0xd598('0xb9')][_0xd598('0x55')],'formData':JSON[_0xd598('0x26')](_0x4b2d94['body'])};var _0x22ead0={'ChatWebsiteId':_0x4b2d94[_0xd598('0x65')]['id'],'closed':![]};if(_0x4b2d94['body'][_0xd598('0xbc')]){_0x22ead0[_0xd598('0xbc')]=_0x4b2d94[_0xd598('0x5f')][_0xd598('0xbc')];return db['ChatInteraction'][_0xd598('0x5d')]({'where':_0x22ead0})['then'](function(_0x5a3f2f){if(_0x5a3f2f){return[_0x5a3f2f,![]];}_0x3825fb[_0xd598('0xbc')]=_0x4b2d94[_0xd598('0x5f')]['threadId'];_0x3825fb[_0xd598('0xbd')]=_0x4b2d94[_0xd598('0x5f')]['externalUrl'];return db[_0xd598('0xbe')][_0xd598('0x5e')](_0x3825fb)[_0xd598('0x38')](function(_0x52e435){return[_0x52e435,!![]];});});}_0x22ead0[_0xd598('0xbf')]=_0x4a4cf3['id'];if(_0x4b2d94['body'][_0xd598('0xc0')]&&_0x4b2d94[_0xd598('0x5f')][_0xd598('0xc0')]['id']){_0x22ead0['id']=_0x4b2d94[_0xd598('0x5f')]['interaction']['id'];return db[_0xd598('0xbe')][_0xd598('0x5d')]({'where':_0x22ead0})[_0xd598('0x38')](function(_0x56f287){if(_0x56f287){return[_0x56f287,![]];}return db['ChatInteraction'][_0xd598('0x5e')](_0x3825fb)['then'](function(_0x48203b){return[_0x48203b,!![]];});});}return db['ChatInteraction'][_0xd598('0x5e')](_0x3825fb)[_0xd598('0x38')](function(_0x16dcae){return[_0x16dcae,!![]];});}})[_0xd598('0xc1')](function(_0x413085,_0x32bd2d){if(_0x413085){_0xd57400=_0x32bd2d;if(!_0x32bd2d){var _0x1bcc5c={'from':(_0x3f8c7f[_0xd598('0xaa')]['firstName']||'')+'\x20'+(_0x3f8c7f[_0xd598('0xaa')][_0xd598('0xc2')]||'')};if(_0x4b2d94['body']['threadId']&&_0x4b2d94[_0xd598('0x5f')][_0xd598('0xc3')]&&_0x4b2d94['body'][_0xd598('0xbc')]!=_0x4b2d94[_0xd598('0x5f')][_0xd598('0xc3')]){_0x1bcc5c['threadId']=_0x4b2d94[_0xd598('0x5f')][_0xd598('0xc3')];}return _0x413085['update'](_0x1bcc5c);}else{return _0x413085;}}})[_0xd598('0x38')](function(_0x30923e){_0x3f8c7f['interaction']=_0x30923e[_0xd598('0x3a')]({'plain':!![]});_0x3f8c7f[_0xd598('0xc0')][_0xd598('0xc4')]=_0xd57400;if(_0x3f8c7f['interaction']['created']){if(_0x3f8c7f['account'][_0xd598('0xc5')]){_0x3f8c7f['applications'][_0xd598('0xc6')]({'id':0x0,'priority':_0x3f8c7f[_0xd598('0xa4')][_0xd598('0x4c')]+0x1,'app':_0xd598('0xc7'),'appdata':'unmanaged','interval':'*,*,*,*'});}}return db['ChatMessage'][_0xd598('0x5e')]({'body':_0x4b2d94[_0xd598('0x5f')]['body'],'ChatWebsiteId':_0x4b2d94[_0xd598('0x65')]['id'],'ChatInteractionId':_0x30923e['id'],'direction':'in','ContactId':_0x3f8c7f[_0xd598('0xaa')]['id'],'AttachmentId':_0x4b2d94[_0xd598('0x5f')][_0xd598('0xc8')]});})[_0xd598('0x38')](function(_0x7f44b7){_0x3f8c7f['message']=_0x7f44b7;if(_0x3f8c7f[_0xd598('0xc0')][_0xd598('0xc9')]){return db[_0xd598('0xca')][_0xd598('0x5d')]({'attributes':['id',_0xd598('0x3d')],'where':{'id':_0x3f8c7f['interaction'][_0xd598('0xc9')]}})[_0xd598('0x38')](function(_0x4380f2){if(_0x4380f2){_0x3f8c7f['applications'][_0xd598('0xcb')]({'id':0x0,'priority':0x0,'app':_0xd598('0xcc'),'appdata':_0x4380f2[_0xd598('0x3d')]+','+(_0x3f8c7f[_0xd598('0xa1')][_0xd598('0xcd')]||0xa),'interval':_0xd598('0xce')});_0x3f8c7f['forcedOwnership']=!![];}return respondWithRpcPromise('Start',_0xd598('0xcf'),_0x3f8c7f);});}return respondWithRpcPromise('Start','startRouting',_0x3f8c7f);})[_0xd598('0x38')](function(_0x4d6a32){respondWithRpcPromise(_0xd598('0xd0'),_0xd598('0xd0'),{'event':'notify','message':_0x4d6a32},client9002);return _0x4d6a32;})[_0xd598('0x38')](respondWithResult(_0x758ef1,null))['catch'](handleError(_0x758ef1,null));};exports[_0xd598('0xd1')]=function(_0x33f30c,_0x237c89,_0x559802){var _0x58de95,_0x50964a,_0x17279c;var _0x5c2f62=[];var _0x3e8609=[];var _0xd2e0a5={};return db[_0xd598('0x90')][_0xd598('0x66')]()[_0xd598('0x38')](function(_0x3dd496){if(!_0x3dd496){throw new db['Sequelize']['ValidationError'](_0xd598('0x92'));}_0x3e8609=_[_0xd598('0x93')](_[_0xd598('0x47')](_0x3dd496),[_0xd598('0x94'),'updatedAt']);_0x5c2f62=_[_0xd598('0x93')](_[_0xd598('0x47')](_0x3dd496),[_0xd598('0x94'),_0xd598('0x95'),'CompanyId',_0xd598('0xa9')]);if(_0x33f30c[_0xd598('0x5f')]['id']){delete _0x33f30c['body']['id'];}if(_[_0xd598('0x84')](_0x33f30c['body']['from'])){throw _0x237c89[_0xd598('0x2d')](0x1f4)[_0xd598('0xd2')](new db[(_0xd598('0x99'))]['ValidationError'](_0xd598('0x98')));}if(_['isNil'](_0x33f30c[_0xd598('0x5f')]['body'])||_0x33f30c[_0xd598('0x5f')][_0xd598('0x5f')]===''){throw _0x237c89[_0xd598('0x2d')](0x1f4)[_0xd598('0xd2')](new db['Sequelize'][(_0xd598('0x91'))](_0xd598('0x9a')));}if(_['isNil'](_0x33f30c['body'][_0xd598('0xd3')])){throw _0x237c89[_0xd598('0x2d')](0x1f4)[_0xd598('0xd2')](new db[(_0xd598('0x99'))][(_0xd598('0x91'))](_0xd598('0xd4')+_0x5c2f62));}if(!_['includes'](_0x5c2f62,_0x33f30c['body'][_0xd598('0xd3')])){throw _0x237c89[_0xd598('0x2d')](0x1f4)[_0xd598('0xd2')](new db[(_0xd598('0x99'))][(_0xd598('0x91'))](_0xd598('0xd5')+_0x5c2f62));}_0xd2e0a5[_0x33f30c[_0xd598('0x5f')]['mapKeyOffline']]=_0x33f30c[_0xd598('0x5f')][_0xd598('0x97')];})[_0xd598('0x38')](function(){return db[_0xd598('0x57')][_0xd598('0x5d')]({'where':{'id':_0x33f30c[_0xd598('0x65')]['id']},'include':[{'model':db[_0xd598('0xd6')],'as':_0xd598('0xa0')}]});})[_0xd598('0x38')](handleEntityNotFound(_0x237c89,null))[_0xd598('0x38')](function(_0x1e36bd){if(_0x1e36bd&&_0x1e36bd[_0xd598('0xa0')]){_0x50964a=_0x1e36bd;var _0xfa8d08=_[_0xd598('0x18')](_0x33f30c[_0xd598('0x5f')],{'firstName':_0x33f30c[_0xd598('0x5f')][_0xd598('0x97')],'phone':_0x33f30c[_0xd598('0x5f')][_0xd598('0x97')],'ListId':_0x1e36bd['ListId']});_0xfa8d08[_0x33f30c[_0xd598('0x5f')][_0xd598('0xd3')]]=_0x33f30c[_0xd598('0x5f')][_0xd598('0x97')];return db[_0xd598('0x90')][_0xd598('0xd7')]({'where':_0xd2e0a5,'defaults':_0xfa8d08});}})['spread'](function(_0x319526){if(_0x319526){_0x17279c=_0x319526;var _0x142d28=fs[_0xd598('0xd8')](path[_0xd598('0x7a')](config[_0xd598('0x7b')],_0xd598('0xd9')),_0xd598('0xda'));var _0x145ab1=ejs[_0xd598('0xdb')](_0x142d28,{'body':_[_0xd598('0xdc')](_0x33f30c[_0xd598('0x5f')][_0xd598('0x5f')]),'bodyTitle':_0x50964a['offlineMessageBody']});return db[_0xd598('0xdd')]['create']({'body':_0x145ab1,'ContactId':_0x319526['id'],'ChatWebsiteId':_0x50964a['id']});}})[_0xd598('0x38')](function(_0x2915a8){if(_0x2915a8){_0x58de95=_0x2915a8;return db[_0xd598('0xde')][_0xd598('0x6a')]({'where':{'service':!![]},'include':[{'model':db[_0xd598('0xdf')],'as':_0xd598('0xe0'),'raw':!![]}]});}})[_0xd598('0x38')](function(_0x3f395b){if(_0x3f395b&&_0x3f395b[_0xd598('0xe0')]&&_0x50964a[_0xd598('0xe1')]){var _0x13b322={'tls':{'rejectUnauthorized':![]}};if(_0x3f395b['Smtp'][_0xd598('0xe2')]){_0x13b322[_0xd598('0xe2')]=_0x3f395b[_0xd598('0xe0')][_0xd598('0xe2')];}else{_0x13b322[_0xd598('0xe3')]=_0x3f395b[_0xd598('0xe0')][_0xd598('0xe3')];_0x13b322[_0xd598('0xe4')]=_0x3f395b[_0xd598('0xe0')][_0xd598('0xe4')];_0x13b322[_0xd598('0xe5')]=_0x3f395b[_0xd598('0xe0')][_0xd598('0xe5')];}if(_0x3f395b[_0xd598('0xe0')][_0xd598('0xe6')]){_0x13b322[_0xd598('0xe7')]={'user':_0x3f395b[_0xd598('0xe0')][_0xd598('0x61')],'pass':_0x3f395b['Smtp'][_0xd598('0xe8')]};}return respondWithRpcPromise('SendMail','sendMail',{'account':_0x13b322,'message':{'from':util['format']('\x22%s\x22\x20<%s>',_0x3f395b[_0xd598('0x3d')],_0x3f395b[_0xd598('0xe9')]||_0x3f395b[_0xd598('0xe0')][_0xd598('0x61')]),'to':_0x50964a[_0xd598('0xe1')],'subject':_0x50964a['offlineMessageSubject'],'text':_0x58de95['body']}},client9003)['then'](function(){return _0x58de95;})['catch'](function(_0x4ff785){console[_0xd598('0x27')](_0x4ff785);});}})[_0xd598('0x38')](function(){if(_0x58de95){return _0x58de95;}})['then'](respondWithResult(_0x237c89,null))[_0xd598('0x2b')](handleError(_0x237c89,null));};exports[_0xd598('0xea')]=function(_0x48ae33,_0x3b9d60,_0x4a7aa1){return db[_0xd598('0xbe')][_0xd598('0x5d')]({'where':{'id':_0x48ae33['params']['id']}})[_0xd598('0x38')](handleEntityNotFound(_0x3b9d60,null))[_0xd598('0x38')](function(_0xd4c61c){if(_0xd4c61c){return _0xd4c61c['addInteraction'](_0x48ae33['body'][_0xd598('0x6c')],_['omit'](_0x48ae33[_0xd598('0x5f')],[_0xd598('0x6c'),'id'])||{});}})[_0xd598('0x38')](respondWithResult(_0x3b9d60,null))[_0xd598('0x2b')](handleError(_0x3b9d60,null));};exports[_0xd598('0xeb')]=function(_0x315a74,_0x443df8,_0x4c1e0d){var _0x7794f0={'raw':![],'where':{}};var _0x7c99ec={};var _0x2727d6={'count':0x0,'rows':[]};return db[_0xd598('0x57')][_0xd598('0x6a')]({'where':{'id':_0x315a74[_0xd598('0x65')]['id']}})['then'](handleEntityNotFound(_0x443df8,null))['then'](function(_0x3fee87){if(_0x3fee87){_0x7c99ec[_0xd598('0x45')]=_['keys'](db[_0xd598('0xbe')][_0xd598('0x42')]);_0x7c99ec[_0xd598('0x46')]=_[_0xd598('0x47')](_0x315a74[_0xd598('0x46')]);_0x7c99ec[_0xd598('0x48')]=_['intersection'](_0x7c99ec[_0xd598('0x45')],_0x7c99ec['query']);_0x7794f0[_0xd598('0x4a')]=_[_0xd598('0x49')](_0x7c99ec[_0xd598('0x45')],qs[_0xd598('0x4b')](_0x315a74['query'][_0xd598('0x4b')]));_0x7794f0[_0xd598('0x4a')]=_0x7794f0['attributes']['length']?_0x7794f0[_0xd598('0x4a')]:_0x7c99ec[_0xd598('0x45')];if(!_0x315a74[_0xd598('0x46')][_0xd598('0x4d')]('nolimit')){_0x7794f0['limit']=qs[_0xd598('0x32')](_0x315a74[_0xd598('0x46')][_0xd598('0x32')]);_0x7794f0['offset']=qs[_0xd598('0x31')](_0x315a74[_0xd598('0x46')]['offset']);}_0x7794f0[_0xd598('0x4f')]=qs['sort'](_0x315a74[_0xd598('0x46')][_0xd598('0x50')]);_0x7794f0[_0xd598('0x53')]=qs[_0xd598('0x48')](_[_0xd598('0x51')](_0x315a74[_0xd598('0x46')],_0x7c99ec[_0xd598('0x48')]));_0x7794f0['where'][_0xd598('0x67')]=_0x3fee87['id'];if(_0x315a74[_0xd598('0x46')]['filter']){_0x7794f0['where']=_[_0xd598('0x54')](_0x7794f0[_0xd598('0x53')],{'$or':_[_0xd598('0x41')](_0x7794f0[_0xd598('0x4a')],function(_0x138cf1){var _0x18fec5={};_0x18fec5[_0x138cf1]={'$like':'%'+_0x315a74[_0xd598('0x46')][_0xd598('0x52')]+'%'};return _0x18fec5;})});}_0x7794f0=_[_0xd598('0x54')]({},_0x7794f0,_0x315a74[_0xd598('0x56')]);return db['ChatInteraction']['count']({'where':_0x7794f0[_0xd598('0x53')]})['then'](function(_0x20f629){_0x2727d6[_0xd598('0x30')]=_0x20f629;if(_0x315a74[_0xd598('0x46')][_0xd598('0x5c')]){_0x7794f0[_0xd598('0x58')]=[{'model':db[_0xd598('0x90')],'as':_0xd598('0xec'),'required':![]},{'model':db[_0xd598('0xca')],'as':_0xd598('0xed'),'attributes':[_0xd598('0x3d'),_0xd598('0xee'),'internal'],'required':![]},{'model':db['Tag'],'as':_0xd598('0xef'),'attributes':['id',_0xd598('0x3d'),_0xd598('0xf0')],'where':_0x315a74['query'][_0xd598('0xf1')]?{'id':_0x315a74[_0xd598('0x46')]['tag']}:undefined,'required':_0x315a74['query'][_0xd598('0xf1')]?!![]:![]}];}return db['ChatInteraction'][_0xd598('0x59')](_0x7794f0);})[_0xd598('0x38')](function(_0x510e6a){_0x2727d6['rows']=_0x510e6a;return _0x2727d6;});}})[_0xd598('0x38')](respondWithFilteredResult(_0x443df8,_0x7794f0))[_0xd598('0x2b')](handleError(_0x443df8,null));};function iftimePromise(_0x416d02,_0x474976){return respondWithRpcPromise(_0xd598('0xf2'),'getSnippet',{'command':_0x474976['timezone']?util[_0xd598('0xb6')](_0xd598('0xf3'),_0x416d02[_0xd598('0xf4')],_0x474976[_0xd598('0xf5')]):util[_0xd598('0xb6')](_0xd598('0xf6'),_0x416d02['interval'])},client9002)[_0xd598('0x38')](function(_0x446e02){var _0x14a8fc=_0x446e02&&_0x446e02[_0xd598('0xf7')]('true')>=0x0?!![]:![];logger[_0xd598('0x21')](_0xd598('0xf8'),_0x474976['id'],_0x416d02['id'],_0x416d02[_0xd598('0xf4')],_0x14a8fc?_0xd598('0xf9'):_0xd598('0xfa'),_0x474976['timezone']?_0x474976[_0xd598('0xf5')]:_0xd598('0xfb'));return _0x14a8fc;})[_0xd598('0x2b')](function(_0x4c7606){logger['error'](_0xd598('0xf8'),_0x474976['id'],_0x416d02['id'],_0x416d02[_0xd598('0xf4')],util[_0xd598('0xfc')](_0x4c7606,{'showHidden':![],'depth':null}),_0x474976['timezone']?_0x474976[_0xd598('0xf5')]:_0xd598('0xfb'));return![];});}exports[_0xd598('0xfd')]=function(_0x18d19c,_0x3d0335,_0x2002b9){var _0xf4b591=0x0;var _0x4c36e4=0x0;var _0x149bbc=![];var _0x171e0d;var _0x519db7;return db['ChatWebsite'][_0xd598('0x5d')]({'where':{'id':_0x18d19c[_0xd598('0x65')]['id']},'include':[{'model':db[_0xd598('0xfe')],'as':_0xd598('0xfe'),'include':[{'model':db['Interval'],'as':_0xd598('0xff'),'attributes':['id','interval'],'raw':!![]}]}]})[_0xd598('0x38')](handleEntityNotFound(_0x3d0335,null))[_0xd598('0x38')](function(_0x253ec9){if(_0x253ec9){_0x171e0d=_0x253ec9;return _0x253ec9[_0xd598('0x100')]({'raw':!![]});}})['then'](function(_0x1c44e9){if(_0x171e0d){if(_0x1c44e9){_0x519db7=_0x1c44e9;}}return require(_0xd598('0x7d'))[_0xd598('0x7e')]();})['then'](function(_0x457b67){if(_0x457b67){_0x4c36e4=_0x457b67[_0xd598('0x101')];_0x149bbc=_0x457b67[_0xd598('0x7f')];}})[_0xd598('0x38')](function(){return db[_0xd598('0xbe')][_0xd598('0x30')]({'where':{'closed':![]}});})[_0xd598('0x38')](function(_0x3c2f22){_0xf4b591=_0x3c2f22;if(_0x4c36e4&&_0x3c2f22>_0x4c36e4){return db[_0xd598('0x102')]['findOne']({'where':{'id':0x1}})[_0xd598('0x38')](function(_0x12f2a3){if(_0x12f2a3){_0x12f2a3['increment'](_0xd598('0x103'));}});}})[_0xd598('0x38')](function(){if(_0x171e0d[_0xd598('0xfe')]&&_0x171e0d[_0xd598('0xfe')][_0xd598('0xff')]){var _0x28fdbb=[];for(var _0x182249=0x0;_0x182249<_0x171e0d[_0xd598('0xfe')][_0xd598('0xff')][_0xd598('0x4c')];_0x182249++){var _0x4e57bd=_0x171e0d[_0xd598('0xfe')][_0xd598('0xff')][_0x182249][_0xd598('0x3a')]({'plain':!![]});_0x28fdbb[_0xd598('0xc6')](iftimePromise(_0x4e57bd,_0x171e0d));}return BPromise['all'](_0x28fdbb)[_0xd598('0x38')](function(_0x1868f2){return _[_0xd598('0x104')](_0x1868f2);});}else{return!![];}})[_0xd598('0x38')](function(_0x395667){var _0xfb9914=fs[_0xd598('0xd8')](path[_0xd598('0x7a')](config['root'],'server/files/chat/iframe.js'),_0xd598('0xda'));var _0x124cb5={'remote':_0x171e0d[_0xd598('0x105')],'query':querystring[_0xd598('0x26')](_[_0xd598('0x54')](_0x171e0d[_0xd598('0x3a')]({'plain':!![]}),{'customerIp':_0x18d19c[_0xd598('0xac')][_0xd598('0xae')]||_0x18d19c[_0xd598('0xac')][_0xd598('0x106')]||_0x18d19c[_0xd598('0x107')]['remoteAddress']||_0x18d19c['ip'],'referer':_0x18d19c['headers'][_0xd598('0xb3')],'openedInteractions':_0xf4b591,'maxInteractions':_0x4c36e4,'virtual':_0x149bbc[_0xd598('0x101')],'online':_0x395667,'custom':_0x149bbc}))['replace'](/'/g,'\x5c\x27')};_0x3d0335[_0xd598('0xd2')](ejs[_0xd598('0xdb')](Mustache[_0xd598('0xdb')](_0xfb9914,_0x124cb5),{'proactiveActions':_0x519db7,'alignment':_0x171e0d[_0xd598('0x108')],'verticalAlignment':_0x171e0d[_0xd598('0x109')],'div_color':_0x171e0d[_0xd598('0xf0')],'text_color':_0x171e0d['textColor']}));})[_0xd598('0x2b')](handleError(_0x3d0335,null));};exports[_0xd598('0x10a')]=function(_0x24f059,_0x5eb30d,_0x30cb48){return db[_0xd598('0x57')][_0xd598('0x6a')]({'where':{'id':_0x24f059[_0xd598('0x65')]['id']}})['then'](handleEntityNotFound(_0x5eb30d,null))['then'](function(_0x553e0a){if(_0x553e0a){return db[_0xd598('0x10b')][_0xd598('0x10c')](function(_0x5b9b39){return db[_0xd598('0x10d')]['destroy']({'where':{'ChatWebsiteId':_0x24f059[_0xd598('0x65')]['id']},'transaction':_0x5b9b39})['then'](function(_0x284dbb){var _0x2bcd83=_[_0xd598('0x41')](_0x24f059[_0xd598('0x5f')],function(_0x9b7a8){_0x9b7a8[_0xd598('0x67')]=_0x24f059['params']['id'];return _0x9b7a8;});return db[_0xd598('0x10d')][_0xd598('0x10e')](_0x2bcd83,{'transaction':_0x5b9b39});});})[_0xd598('0x38')](function(){return db['ChatApplication'][_0xd598('0x10f')]({'where':{'ChatWebsiteId':_0x24f059[_0xd598('0x65')]['id']},'order':_0xd598('0xa6')});});}})[_0xd598('0x38')](respondWithResult(_0x5eb30d,null))[_0xd598('0x2b')](handleError(_0x5eb30d,null));};exports[_0xd598('0x110')]=function(_0x593b1b,_0x69eec6,_0x587f0e){var _0x519279={};var _0x1ce3b7={};var _0x22a6c0;var _0x3f3620;return db['ChatWebsite'][_0xd598('0x6a')]({'where':{'id':_0x593b1b[_0xd598('0x65')]['id']}})[_0xd598('0x38')](handleEntityNotFound(_0x69eec6,null))['then'](function(_0x8b6f0){if(_0x8b6f0){_0x22a6c0=_0x8b6f0;_0x1ce3b7[_0xd598('0x45')]=_[_0xd598('0x47')](db[_0xd598('0x10d')][_0xd598('0x42')]);_0x1ce3b7['query']=_[_0xd598('0x47')](_0x593b1b['query']);_0x1ce3b7[_0xd598('0x48')]=_[_0xd598('0x49')](_0x1ce3b7['model'],_0x1ce3b7[_0xd598('0x46')]);_0x519279[_0xd598('0x4a')]=_[_0xd598('0x49')](_0x1ce3b7['model'],qs[_0xd598('0x4b')](_0x593b1b[_0xd598('0x46')]['fields']));_0x519279['attributes']=_0x519279[_0xd598('0x4a')]['length']?_0x519279[_0xd598('0x4a')]:_0x1ce3b7['model'];_0x519279[_0xd598('0x4f')]=qs[_0xd598('0x50')](_0x593b1b[_0xd598('0x46')][_0xd598('0x50')]);_0x519279[_0xd598('0x53')]=qs[_0xd598('0x48')](_[_0xd598('0x51')](_0x593b1b[_0xd598('0x46')],_0x1ce3b7['filters']));if(_0x593b1b[_0xd598('0x46')][_0xd598('0x52')]){_0x519279[_0xd598('0x53')]=_[_0xd598('0x54')](_0x519279['where'],{'$or':_['map'](_0x519279[_0xd598('0x4a')],function(_0x4f4500){var _0x59d4fc={};_0x59d4fc[_0x4f4500]={'$like':'%'+_0x593b1b['query'][_0xd598('0x52')]+'%'};return _0x59d4fc;})});}_0x519279=_[_0xd598('0x54')]({},_0x519279,_0x593b1b[_0xd598('0x56')]);return _0x22a6c0[_0xd598('0x110')](_0x519279);}})[_0xd598('0x38')](function(_0x53388e){if(_0x53388e){_0x3f3620=_0x53388e[_0xd598('0x4c')];if(!_0x593b1b['query'][_0xd598('0x4d')](_0xd598('0x4e'))){_0x519279[_0xd598('0x32')]=qs[_0xd598('0x32')](_0x593b1b['query'][_0xd598('0x32')]);_0x519279[_0xd598('0x31')]=qs['offset'](_0x593b1b[_0xd598('0x46')]['offset']);}return _0x22a6c0['getApplications'](_0x519279);}})[_0xd598('0x38')](function(_0x3fc3b5){if(_0x3fc3b5){return _0x3fc3b5?{'count':_0x3f3620,'rows':_0x3fc3b5}:null;}})[_0xd598('0x38')](respondWithResult(_0x69eec6,null))[_0xd598('0x2b')](handleError(_0x69eec6,null));};exports[_0xd598('0x111')]=function(_0x500061,_0xca1a86,_0x529745){return db[_0xd598('0x112')][_0xd598('0x5d')]({'where':{'id':_0x500061[_0xd598('0x65')]['id']}})['then'](handleEntityNotFound(_0xca1a86,null))[_0xd598('0x38')](function(_0xdea1e7){if(_0xdea1e7){return _0xdea1e7[_0xd598('0x111')](_0x500061[_0xd598('0x5f')][_0xd598('0x6c')],_[_0xd598('0x113')](_0x500061[_0xd598('0x5f')],[_0xd598('0x6c'),'id'])||{});}})[_0xd598('0x38')](respondWithResult(_0xca1a86,null))[_0xd598('0x2b')](handleError(_0xca1a86,null));};exports[_0xd598('0x100')]=function(_0x5ade72,_0xe3082b,_0x2e49da){var _0x16698f={};var _0x244488={};var _0xab6f60;var _0x4104e7;return db['ChatWebsite']['findOne']({'where':{'id':_0x5ade72['params']['id']}})[_0xd598('0x38')](handleEntityNotFound(_0xe3082b,null))[_0xd598('0x38')](function(_0x41c806){if(_0x41c806){_0xab6f60=_0x41c806;_0x244488[_0xd598('0x45')]=_[_0xd598('0x47')](db[_0xd598('0x114')][_0xd598('0x42')]);_0x244488[_0xd598('0x46')]=_[_0xd598('0x47')](_0x5ade72['query']);_0x244488[_0xd598('0x48')]=_[_0xd598('0x49')](_0x244488[_0xd598('0x45')],_0x244488[_0xd598('0x46')]);_0x16698f[_0xd598('0x4a')]=_['intersection'](_0x244488['model'],qs[_0xd598('0x4b')](_0x5ade72[_0xd598('0x46')]['fields']));_0x16698f[_0xd598('0x4a')]=_0x16698f[_0xd598('0x4a')][_0xd598('0x4c')]?_0x16698f[_0xd598('0x4a')]:_0x244488[_0xd598('0x45')];_0x16698f[_0xd598('0x4f')]=qs[_0xd598('0x50')](_0x5ade72[_0xd598('0x46')][_0xd598('0x50')]);_0x16698f[_0xd598('0x53')]=qs[_0xd598('0x48')](_['pick'](_0x5ade72[_0xd598('0x46')],_0x244488['filters']));if(_0x5ade72[_0xd598('0x46')][_0xd598('0x52')]){_0x16698f['where']=_[_0xd598('0x54')](_0x16698f[_0xd598('0x53')],{'$or':_['map'](_0x16698f[_0xd598('0x4a')],function(_0x4a9974){var _0xbcf5bb={};_0xbcf5bb[_0x4a9974]={'$like':'%'+_0x5ade72[_0xd598('0x46')][_0xd598('0x52')]+'%'};return _0xbcf5bb;})});}_0x16698f=_[_0xd598('0x54')]({},_0x16698f,_0x5ade72[_0xd598('0x56')]);return _0xab6f60[_0xd598('0x100')](_0x16698f);}})[_0xd598('0x38')](function(_0x5a4761){if(_0x5a4761){_0x4104e7=_0x5a4761[_0xd598('0x4c')];if(!_0x5ade72[_0xd598('0x46')]['hasOwnProperty'](_0xd598('0x4e'))){_0x16698f['limit']=qs[_0xd598('0x32')](_0x5ade72[_0xd598('0x46')]['limit']);_0x16698f[_0xd598('0x31')]=qs[_0xd598('0x31')](_0x5ade72[_0xd598('0x46')][_0xd598('0x31')]);}return _0xab6f60[_0xd598('0x100')](_0x16698f);}})['then'](function(_0x4c2d89){if(_0x4c2d89){return _0x4c2d89?{'count':_0x4104e7,'rows':_0x4c2d89}:null;}})[_0xd598('0x38')](respondWithResult(_0xe3082b,null))[_0xd598('0x2b')](handleError(_0xe3082b,null));};exports[_0xd598('0x115')]=function(_0x652cb0,_0x4e499d,_0xa35a9a){var _0x23608d=_0x652cb0['query'][_0xd598('0x116')]===_0xd598('0x117')?_0xd598('0x118'):_0xd598('0x119');return db[_0xd598('0x57')][_0xd598('0x5d')]({'attributes':['id',_0x23608d],'where':{'id':_0x652cb0[_0xd598('0x65')]['id']}})[_0xd598('0x38')](handleEntityNotFound(_0x4e499d,null))[_0xd598('0x38')](function(_0x19f853){if(_0x19f853){var _0x408943=_0x19f853[_0x23608d];var _0x3d5496=_0x408943&&_0x408943[_0xd598('0x11a')]?_0x408943['items']:[];_0x4e499d[_0xd598('0xd2')]({'fromKey':_['isNil'](_0x408943['fromKey'])?undefined:_0x408943[_0xd598('0x11b')],'count':_0x3d5496[_0xd598('0x4c')],'rows':_0x3d5496});}})[_0xd598('0x2b')](handleError(_0x4e499d,null));};exports[_0xd598('0x11c')]=function(_0x53f7b0,_0x216bcd,_0x1e8ebc){var _0x493beb={'raw':![],'where':{}};var _0x308823={};var _0x3137ad={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xd598('0x6a')]({'where':{'id':_0x53f7b0[_0xd598('0x65')]['id']}})[_0xd598('0x38')](handleEntityNotFound(_0x216bcd,null))[_0xd598('0x38')](function(_0x484f4a){if(_0x484f4a){_0x308823[_0xd598('0x45')]=_[_0xd598('0x47')](db[_0xd598('0xdd')][_0xd598('0x42')]);_0x308823[_0xd598('0x46')]=_['keys'](_0x53f7b0['query']);_0x308823[_0xd598('0x48')]=_[_0xd598('0x49')](_0x308823[_0xd598('0x45')],_0x308823[_0xd598('0x46')]);_0x493beb[_0xd598('0x4a')]=_[_0xd598('0x49')](_0x308823[_0xd598('0x45')],qs['fields'](_0x53f7b0['query'][_0xd598('0x4b')]));_0x493beb['attributes']=_0x493beb['attributes'][_0xd598('0x4c')]?_0x493beb['attributes']:_0x308823[_0xd598('0x45')];if(!_0x53f7b0[_0xd598('0x46')]['hasOwnProperty']('nolimit')){_0x493beb[_0xd598('0x32')]=qs['limit'](_0x53f7b0['query'][_0xd598('0x32')]);_0x493beb[_0xd598('0x31')]=qs[_0xd598('0x31')](_0x53f7b0[_0xd598('0x46')][_0xd598('0x31')]);}_0x493beb[_0xd598('0x4f')]=qs[_0xd598('0x50')](_0x53f7b0[_0xd598('0x46')][_0xd598('0x50')]);_0x493beb[_0xd598('0x53')]=qs[_0xd598('0x48')](_[_0xd598('0x51')](_0x53f7b0[_0xd598('0x46')],_0x308823[_0xd598('0x48')]));_0x493beb[_0xd598('0x53')][_0xd598('0x67')]=_0x484f4a['id'];if(_0x53f7b0['query']['filter']){_0x493beb[_0xd598('0x53')]=_['merge'](_0x493beb[_0xd598('0x53')],{'$or':_['map'](_0x493beb[_0xd598('0x4a')],function(_0x2a3a1f){var _0x2b75ec={};_0x2b75ec[_0x2a3a1f]={'$like':'%'+_0x53f7b0[_0xd598('0x46')][_0xd598('0x52')]+'%'};return _0x2b75ec;})});}_0x493beb=_[_0xd598('0x54')]({},_0x493beb,_0x53f7b0[_0xd598('0x56')]);return db[_0xd598('0xdd')][_0xd598('0x30')]({'where':_0x493beb[_0xd598('0x53')]})[_0xd598('0x38')](function(_0x5370fe){_0x3137ad['count']=_0x5370fe;if(_0x53f7b0[_0xd598('0x46')]['includeAll']){_0x493beb[_0xd598('0x58')]=[{'all':!![]}];}else{_0x493beb[_0xd598('0x58')]=[{'model':db['CmContact'],'as':_0xd598('0xec'),'required':![]}];}return db[_0xd598('0xdd')][_0xd598('0x59')](_0x493beb);})['then'](function(_0x205e64){_0x3137ad[_0xd598('0x5a')]=_0x205e64;return _0x3137ad;});}})['then'](respondWithFilteredResult(_0x216bcd,_0x493beb))['catch'](handleError(_0x216bcd,null));};exports[_0xd598('0x11d')]=function(_0x511f59,_0xf77a,_0x6d9a99){return db['ChatWebsite'][_0xd598('0x5d')]({'where':{'id':_0x511f59['params']['id']}})[_0xd598('0x38')](handleEntityNotFound(_0xf77a,null))['then'](function(_0xbfcfad){if(_0xbfcfad){return _0xbfcfad['addAgents'](_0x511f59[_0xd598('0x5f')][_0xd598('0x6c')],_['omit'](_0x511f59[_0xd598('0x5f')],[_0xd598('0x6c'),'id'])||{})[_0xd598('0xc1')](function(_0xe3d235){for(var _0x401219=0x0;_0x401219<_0x511f59[_0xd598('0x5f')][_0xd598('0x6c')][_0xd598('0x4c')];_0x401219+=0x1){socket[_0xd598('0x11e')](_0xd598('0x11f'),{'UserId':_0x511f59['body'][_0xd598('0x6c')][_0x401219],'ChatWebsiteId':_0x511f59[_0xd598('0x65')]['id']});}return _0xe3d235;});}})[_0xd598('0x38')](respondWithResult(_0xf77a,null))['catch'](handleError(_0xf77a,null));};exports[_0xd598('0x120')]=function(_0x1c7260,_0xf79358,_0x101600){return db[_0xd598('0x57')]['find']({'where':{'id':_0x1c7260['params']['id']}})[_0xd598('0x38')](handleEntityNotFound(_0xf79358,null))[_0xd598('0x38')](function(_0x5bd2b9){if(_0x5bd2b9){return _0x5bd2b9[_0xd598('0x120')](_0x1c7260[_0xd598('0x46')]['ids'])['then'](function(){if(_[_0xd598('0x121')](_0x1c7260[_0xd598('0x46')][_0xd598('0x6c')])){for(var _0x2a8d08=0x0;_0x2a8d08<_0x1c7260[_0xd598('0x46')][_0xd598('0x6c')][_0xd598('0x4c')];_0x2a8d08+=0x1){socket['emit']('userChatWebsite:remove',{'UserId':Number(_0x1c7260[_0xd598('0x46')][_0xd598('0x6c')][_0x2a8d08]),'ChatWebsiteId':Number(_0x1c7260[_0xd598('0x65')]['id'])});}}else{socket[_0xd598('0x11e')](_0xd598('0x122'),{'UserId':Number(_0x1c7260[_0xd598('0x46')]['ids']),'ChatWebsiteId':Number(_0x1c7260['params']['id'])});}});}})[_0xd598('0x38')](respondWithStatusCode(_0xf79358,null))[_0xd598('0x2b')](handleError(_0xf79358,null));};exports['getAgents']=function(_0x5114a6,_0x1be1e6,_0x644fc9){var _0x4a0d86={};var _0x50b102={};var _0xf9e649;var _0x277af6;return db['ChatWebsite'][_0xd598('0x6a')]({'where':{'id':_0x5114a6[_0xd598('0x65')]['id']}})['then'](handleEntityNotFound(_0x1be1e6,null))['then'](function(_0x377a80){if(_0x377a80){_0xf9e649=_0x377a80;_0x50b102['model']=_[_0xd598('0x47')](db[_0xd598('0xca')][_0xd598('0x42')]);_0x50b102[_0xd598('0x46')]=_[_0xd598('0x47')](_0x5114a6[_0xd598('0x46')]);_0x50b102[_0xd598('0x48')]=_[_0xd598('0x49')](_0x50b102[_0xd598('0x45')],_0x50b102['query']);_0x4a0d86[_0xd598('0x4a')]=_[_0xd598('0x49')](_0x50b102[_0xd598('0x45')],qs[_0xd598('0x4b')](_0x5114a6['query']['fields']));_0x4a0d86['attributes']=_0x4a0d86[_0xd598('0x4a')]['length']?_0x4a0d86['attributes']:_0x50b102[_0xd598('0x45')];_0x4a0d86[_0xd598('0x4f')]=qs[_0xd598('0x50')](_0x5114a6[_0xd598('0x46')][_0xd598('0x50')]);_0x4a0d86[_0xd598('0x53')]=qs[_0xd598('0x48')](_[_0xd598('0x51')](_0x5114a6[_0xd598('0x46')],_0x50b102[_0xd598('0x48')]));if(_0x5114a6[_0xd598('0x46')][_0xd598('0x52')]){_0x4a0d86[_0xd598('0x53')]=_[_0xd598('0x54')](_0x4a0d86[_0xd598('0x53')],{'$or':_[_0xd598('0x41')](_0x4a0d86['attributes'],function(_0x4515ca){var _0x3f446b={};_0x3f446b[_0x4515ca]={'$like':'%'+_0x5114a6[_0xd598('0x46')][_0xd598('0x52')]+'%'};return _0x3f446b;})});}_0x4a0d86=_[_0xd598('0x54')]({},_0x4a0d86,_0x5114a6[_0xd598('0x56')]);return _0xf9e649[_0xd598('0x123')](_0x4a0d86);}})[_0xd598('0x38')](function(_0x362a29){if(_0x362a29){_0x277af6=_0x362a29[_0xd598('0x4c')];if(!_0x5114a6['query'][_0xd598('0x4d')](_0xd598('0x4e'))){_0x4a0d86[_0xd598('0x32')]=qs[_0xd598('0x32')](_0x5114a6[_0xd598('0x46')][_0xd598('0x32')]);_0x4a0d86['offset']=qs[_0xd598('0x31')](_0x5114a6[_0xd598('0x46')][_0xd598('0x31')]);}return _0xf9e649['getAgents'](_0x4a0d86);}})[_0xd598('0x38')](function(_0x22ec9b){if(_0x22ec9b){return _0x22ec9b?{'count':_0x277af6,'rows':_0x22ec9b}:null;}})[_0xd598('0x38')](respondWithResult(_0x1be1e6,null))['catch'](handleError(_0x1be1e6,null));}; \ No newline at end of file +var _0x2e15=['from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','DESC','ChatApplication','Applications','List','account','applications','list','orderBy','Contacts','customerIp','cf-connecting-ip','x-forwarded-for','firstName','lastName','x-real-port','referer','browser','%s\x20%s','version','unknown','device','vendor','format','%s\x20%s\x20%s','stringify','ChatInteraction','threadId','externalUrl','spread','contact','messageId','interaction','created','autoclose','close','unmanaged','*,*,*,*','AttachmentId','User','UserId','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','offline','difference','mapKeyOffline','includes','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','offlineMessageBody','MailServerOut','Smtp','host','port','auth','SendMail','sendMail','forwardOfflineAddress','addInteraction','Contact','fullname','Tag','Tags','color','tag','Command','getSnippet','timezone','interval','iftime\x20%s','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','OFFLINE','inspect','No\x20timezone','Interval','Intervals','getProactiveActions','virtual','License','increment','chatLicenseExceeded','push','all','server/files/chat/iframe.js','remote','x-real-ip','connection','remoteAddress','alignment','verticalAlignment','textColor','addApplications','sequelize','findAndCountAll','priority','addProactiveActions','chatProactiveAction','omit','ChatProactiveAction','getFields','online','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','ChatOfflineMessage','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','html-pdf','eml-format','rimraf','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/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','jayson/promise','http','client','test','Sequelize','ValidationError','request','then','ChatWebsite,\x20%s,\x20%s','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','info','result','catch','sendStatus','status','end','json','offset','apply','save','destroy','get','ChatWebsites','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','show','params','fields','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','find','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','findOne','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','addLogo','sitepic','filename','addAvatar','agentAvatar','file','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','custom','isNil','existsSync','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','server/files/images/avatars/system_avatar.png','notify','user-agent-parser','setUA','headers','user-agent','chat','CmContact','no\x20available\x20attributes','updatedAt','createdAt','CompanyId','ListId','from'];(function(_0x2d3915,_0x4dba05){var _0x3e24b8=function(_0x33b595){while(--_0x33b595){_0x2d3915['push'](_0x2d3915['shift']());}};_0x3e24b8(++_0x4dba05);}(_0x2e15,0x19f));var _0x52e1=function(_0x2ce9d,_0x4ff962){_0x2ce9d=_0x2ce9d-0x0;var _0x578428=_0x2e15[_0x2ce9d];return _0x578428;};'use strict';var pdf=require(_0x52e1('0x0'));var emlformat=require(_0x52e1('0x1'));var rimraf=require(_0x52e1('0x2'));var zipdir=require(_0x52e1('0x3'));var jsonpatch=require(_0x52e1('0x4'));var rp=require(_0x52e1('0x5'));var moment=require(_0x52e1('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x52e1('0x7'));var util=require(_0x52e1('0x8'));var path=require(_0x52e1('0x9'));var sox=require('sox');var csv=require(_0x52e1('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x52e1('0xb'));var squel=require('squel');var crypto=require(_0x52e1('0xc'));var jsforce=require(_0x52e1('0xd'));var deskjs=require(_0x52e1('0xe'));var toCsv=require(_0x52e1('0xa'));var querystring=require(_0x52e1('0xf'));var Papa=require(_0x52e1('0x10'));var Redis=require(_0x52e1('0x11'));var authService=require(_0x52e1('0x12'));var qs=require(_0x52e1('0x13'));var as=require(_0x52e1('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x52e1('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x52e1('0x16'));var db=require('../../mysqldb')['db'];config[_0x52e1('0x17')]=_[_0x52e1('0x18')](config[_0x52e1('0x17')],{'host':_0x52e1('0x19'),'port':0x18eb});var socket=require(_0x52e1('0x1a'))(new Redis(config['redis']));require(_0x52e1('0x1b'))[_0x52e1('0x1c')](socket);var jayson=require(_0x52e1('0x1d'));var client=jayson['client'][_0x52e1('0x1e')]({'port':0x232c});var client9002=jayson[_0x52e1('0x1f')][_0x52e1('0x1e')]({'port':0x232a});var client9003=jayson['client']['http']({'port':0x232b});function checkPasswordPattern(_0x346342,_0x4cd929,_0x1830f0){if(_0x1830f0){var _0x2f9216=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2f9216[_0x52e1('0x20')](_0x4cd929)){return _0x346342;}else{throw new db[(_0x52e1('0x21'))][(_0x52e1('0x22'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x346342;}}function respondWithRpcPromise(_0x64d3a4,_0x395107,_0x18ffd0,_0x441ffa){return new BPromise(function(_0x1769e5,_0x509ff2){var _0x569cc9=_0x441ffa||client;return _0x569cc9[_0x52e1('0x23')](_0x64d3a4,_0x18ffd0)[_0x52e1('0x24')](function(_0x2b963e){logger['info'](_0x52e1('0x25'),_0x395107,'request\x20sent');logger[_0x52e1('0x26')](_0x52e1('0x27'),_0x395107,_0x52e1('0x28'),JSON['stringify'](_0x2b963e));if(_0x2b963e['error']){if(_0x2b963e['error']['code']===0x1f4){logger[_0x52e1('0x29')]('ChatWebsite,\x20%s,\x20%s',_0x395107,_0x2b963e[_0x52e1('0x29')][_0x52e1('0x2a')]);return _0x509ff2(_0x2b963e[_0x52e1('0x29')]['message']);}logger['error']('ChatWebsite,\x20%s,\x20%s',_0x395107,_0x2b963e['error']['message']);return _0x1769e5(_0x2b963e[_0x52e1('0x29')][_0x52e1('0x2a')]);}else{logger[_0x52e1('0x2b')](_0x52e1('0x25'),_0x395107,_0x52e1('0x28'));_0x1769e5(_0x2b963e[_0x52e1('0x2c')]['message']);}})[_0x52e1('0x2d')](function(_0x6f6701){logger[_0x52e1('0x29')]('ChatWebsite,\x20%s,\x20%s',_0x395107,_0x6f6701);_0x509ff2(_0x6f6701);});});}function respondWithStatusCode(_0x3b5661,_0x413e95){_0x413e95=_0x413e95||0xcc;return function(_0x45052b){if(_0x45052b){return _0x3b5661[_0x52e1('0x2e')](_0x413e95);}return _0x3b5661[_0x52e1('0x2f')](_0x413e95)[_0x52e1('0x30')]();};}function respondWithResult(_0x5d2991,_0x11059d){_0x11059d=_0x11059d||0xc8;return function(_0x2c1365){if(_0x2c1365){return _0x5d2991[_0x52e1('0x2f')](_0x11059d)[_0x52e1('0x31')](_0x2c1365);}};}function respondWithFilteredResult(_0x17272f,_0x41f44a){return function(_0x1da46e){if(_0x1da46e){var _0x350536=_0x1da46e['count'],_0x5bcf47=_0x41f44a[_0x52e1('0x32')],_0x199427=_0x41f44a[_0x52e1('0x32')]+_0x41f44a['limit'],_0x132930;if(_0x199427>=_0x350536){_0x199427=_0x350536;_0x132930=0xc8;}else{_0x132930=0xce;}_0x17272f['status'](_0x132930);return _0x17272f['set']('Content-Range',_0x5bcf47+'-'+_0x199427+'/'+_0x350536)['json'](_0x1da46e);}return null;};}function patchUpdates(_0x34ef3){return function(_0x95d51b){try{jsonpatch[_0x52e1('0x33')](_0x95d51b,_0x34ef3,!![]);}catch(_0x253d4c){return BPromise['reject'](_0x253d4c);}return _0x95d51b[_0x52e1('0x34')]();};}function saveUpdates(_0x1949a8,_0x13f51f){return function(_0x124146){if(_0x124146){return _0x124146['update'](_0x1949a8)[_0x52e1('0x24')](function(_0x2293ad){return _0x2293ad;});}return null;};}function removeEntity(_0x52cd43,_0x46a4ff){return function(_0x1e1eb2){if(_0x1e1eb2){return _0x1e1eb2[_0x52e1('0x35')]()[_0x52e1('0x24')](function(){var _0x491a8f=_0x1e1eb2[_0x52e1('0x36')]({'plain':!![]});var _0x249616=_0x52e1('0x37');return db[_0x52e1('0x38')]['destroy']({'where':{'type':_0x249616,'resourceId':_0x491a8f['id']}})[_0x52e1('0x24')](function(){return _0x1e1eb2;});})[_0x52e1('0x24')](function(){_0x52cd43['status'](0xcc)[_0x52e1('0x30')]();});}};}function handleEntityNotFound(_0x34efe9,_0x572576){return function(_0x346167){if(!_0x346167){_0x34efe9[_0x52e1('0x2e')](0x194);}return _0x346167;};}function handleError(_0x511904,_0x44fc4b){_0x44fc4b=_0x44fc4b||0x1f4;return function(_0x2bfb83){logger['error'](_0x2bfb83[_0x52e1('0x39')]);if(_0x2bfb83[_0x52e1('0x3a')]){delete _0x2bfb83[_0x52e1('0x3a')];}_0x511904[_0x52e1('0x2f')](_0x44fc4b)[_0x52e1('0x3b')](_0x2bfb83);};}exports[_0x52e1('0x3c')]=function(_0x49a4b1,_0x841655){var _0x31da52={'include':[{'model':db[_0x52e1('0x3d')],'as':_0x52e1('0x3e')}]},_0x44beac={},_0x48df82={'count':0x0,'rows':[]};var _0x3bbb13=_[_0x52e1('0x3f')](db[_0x52e1('0x40')][_0x52e1('0x41')],function(_0xf72a08){return{'name':_0xf72a08[_0x52e1('0x42')],'type':_0xf72a08[_0x52e1('0x43')]['key']};});_0x44beac[_0x52e1('0x44')]=_[_0x52e1('0x3f')](_0x3bbb13,_0x52e1('0x3a'));_0x44beac['query']=_[_0x52e1('0x45')](_0x49a4b1[_0x52e1('0x46')]);_0x44beac[_0x52e1('0x47')]=_[_0x52e1('0x48')](_0x44beac['model'],_0x44beac[_0x52e1('0x46')]);_0x31da52[_0x52e1('0x49')]=_[_0x52e1('0x48')](_0x44beac[_0x52e1('0x44')],qs['fields'](_0x49a4b1[_0x52e1('0x46')]['fields']));_0x31da52['attributes']=_0x31da52[_0x52e1('0x49')][_0x52e1('0x4a')]?_0x31da52['attributes']:_0x44beac['model'];if(!_0x49a4b1['query'][_0x52e1('0x4b')](_0x52e1('0x4c'))){_0x31da52[_0x52e1('0x4d')]=qs[_0x52e1('0x4d')](_0x49a4b1[_0x52e1('0x46')]['limit']);_0x31da52[_0x52e1('0x32')]=qs[_0x52e1('0x32')](_0x49a4b1[_0x52e1('0x46')]['offset']);}_0x31da52[_0x52e1('0x4e')]=qs['sort'](_0x49a4b1[_0x52e1('0x46')][_0x52e1('0x4f')]);_0x31da52[_0x52e1('0x50')]=qs[_0x52e1('0x47')](_[_0x52e1('0x51')](_0x49a4b1['query'],_0x44beac[_0x52e1('0x47')]),_0x3bbb13);if(_0x49a4b1[_0x52e1('0x46')][_0x52e1('0x52')]){_0x31da52[_0x52e1('0x50')]=_[_0x52e1('0x53')](_0x31da52[_0x52e1('0x50')],{'$or':_[_0x52e1('0x3f')](_0x3bbb13,function(_0x3ff804){if(_0x3ff804[_0x52e1('0x43')]!==_0x52e1('0x54')){var _0x276831={};_0x276831[_0x3ff804[_0x52e1('0x3a')]]={'$like':'%'+_0x49a4b1[_0x52e1('0x46')][_0x52e1('0x52')]+'%'};return _0x276831;}})});}_0x31da52=_['merge']({},_0x31da52,_0x49a4b1[_0x52e1('0x55')]);var _0x4b6199={'where':_0x31da52[_0x52e1('0x50')]};return db[_0x52e1('0x40')]['count'](_0x4b6199)['then'](function(_0x48beaf){_0x48df82[_0x52e1('0x56')]=_0x48beaf;if(_0x49a4b1[_0x52e1('0x46')][_0x52e1('0x57')]){_0x31da52[_0x52e1('0x58')]=[{'all':!![]}];}return db['ChatWebsite'][_0x52e1('0x59')](_0x31da52);})['then'](function(_0x5bf61b){_0x48df82[_0x52e1('0x5a')]=_0x5bf61b;return _0x48df82;})['then'](respondWithFilteredResult(_0x841655,_0x31da52))[_0x52e1('0x2d')](handleError(_0x841655,null));};exports[_0x52e1('0x5b')]=function(_0x5e5e59,_0x293af2){var _0x30e85a={'raw':![],'where':{'id':_0x5e5e59[_0x52e1('0x5c')]['id']},'include':[{'model':db[_0x52e1('0x3d')],'as':_0x52e1('0x3e')}]},_0x36d753={};_0x36d753[_0x52e1('0x44')]=_[_0x52e1('0x45')](db[_0x52e1('0x40')][_0x52e1('0x41')]);_0x36d753['query']=_[_0x52e1('0x45')](_0x5e5e59['query']);_0x36d753[_0x52e1('0x47')]=_[_0x52e1('0x48')](_0x36d753[_0x52e1('0x44')],_0x36d753[_0x52e1('0x46')]);_0x30e85a[_0x52e1('0x49')]=_[_0x52e1('0x48')](_0x36d753[_0x52e1('0x44')],qs[_0x52e1('0x5d')](_0x5e5e59[_0x52e1('0x46')]['fields']));_0x30e85a[_0x52e1('0x49')]=_0x30e85a[_0x52e1('0x49')]['length']?_0x30e85a[_0x52e1('0x49')]:_0x36d753[_0x52e1('0x44')];if(_0x5e5e59['query'][_0x52e1('0x57')]){_0x30e85a[_0x52e1('0x58')]=[{'all':!![]}];}_0x30e85a=_[_0x52e1('0x53')]({},_0x30e85a,_0x5e5e59[_0x52e1('0x55')]);return db[_0x52e1('0x40')]['find'](_0x30e85a)[_0x52e1('0x24')](handleEntityNotFound(_0x293af2,null))['then'](respondWithResult(_0x293af2,null))[_0x52e1('0x2d')](handleError(_0x293af2,null));};exports['create']=function(_0x18d75c,_0x55e58a){return db[_0x52e1('0x40')][_0x52e1('0x5e')](_0x18d75c[_0x52e1('0x5f')],{})[_0x52e1('0x24')](function(_0x272e20){var _0x43ed4f=_0x18d75c['user'][_0x52e1('0x36')]({'plain':!![]});if(!_0x43ed4f)throw new Error(_0x52e1('0x60'));if(_0x43ed4f[_0x52e1('0x61')]===_0x52e1('0x62')){var _0xa667e6=_0x272e20[_0x52e1('0x36')]({'plain':!![]});var _0x3ad38d=_0x52e1('0x37');return db['UserProfileSection'][_0x52e1('0x63')]({'where':{'name':_0x3ad38d,'userProfileId':_0x43ed4f['userProfileId']},'raw':!![]})['then'](function(_0x310f05){if(_0x310f05&&_0x310f05['autoAssociation']===0x0){return db[_0x52e1('0x38')][_0x52e1('0x5e')]({'name':_0xa667e6['name'],'resourceId':_0xa667e6['id'],'type':_0x310f05[_0x52e1('0x3a')],'sectionId':_0x310f05['id']},{})[_0x52e1('0x24')](function(){return _0x272e20;});}else{return _0x272e20;}})[_0x52e1('0x2d')](function(_0x48ba43){logger['error'](_0x52e1('0x64'),_0x48ba43);throw _0x48ba43;});}return _0x272e20;})[_0x52e1('0x24')](respondWithResult(_0x55e58a,0xc9))[_0x52e1('0x2d')](handleError(_0x55e58a,null));};exports['update']=function(_0x136400,_0x3e8663){if(_0x136400[_0x52e1('0x5f')]['id']){delete _0x136400[_0x52e1('0x5f')]['id'];}return db[_0x52e1('0x40')]['find']({'where':{'id':_0x136400[_0x52e1('0x5c')]['id']},'include':[{'model':db['Pause'],'as':_0x52e1('0x3e')}]})[_0x52e1('0x24')](handleEntityNotFound(_0x3e8663,null))[_0x52e1('0x24')](saveUpdates(_0x136400[_0x52e1('0x5f')],null))[_0x52e1('0x24')](respondWithResult(_0x3e8663,null))['catch'](handleError(_0x3e8663,null));};exports['destroy']=function(_0x107b27,_0x2abdf0){return db['ChatWebsite']['find']({'where':{'id':_0x107b27[_0x52e1('0x5c')]['id']}})[_0x52e1('0x24')](handleEntityNotFound(_0x2abdf0,null))['then'](removeEntity(_0x2abdf0,null))['catch'](handleError(_0x2abdf0,null));};exports[_0x52e1('0x65')]=function(_0x4fcf24,_0x1dd515){return db['ChatWebsite'][_0x52e1('0x65')]()[_0x52e1('0x24')](respondWithResult(_0x1dd515,null))[_0x52e1('0x2d')](handleError(_0x1dd515,null));};exports[_0x52e1('0x66')]=function(_0x457e76,_0x4c991a,_0x26db98){if(_0x457e76[_0x52e1('0x5f')]['id']){delete _0x457e76[_0x52e1('0x5f')]['id'];}return db[_0x52e1('0x40')][_0x52e1('0x63')]({'where':{'id':_0x457e76[_0x52e1('0x5c')]['id']}})[_0x52e1('0x24')](handleEntityNotFound(_0x4c991a,null))[_0x52e1('0x24')](function(_0x17433b){if(_0x17433b){_0x457e76[_0x52e1('0x5f')][_0x52e1('0x67')]=_0x17433b['id'];return db[_0x52e1('0x68')][_0x52e1('0x5e')](_0x457e76[_0x52e1('0x5f')]);}})[_0x52e1('0x24')](respondWithResult(_0x4c991a,null))['catch'](handleError(_0x4c991a,null));};exports[_0x52e1('0x69')]=function(_0x44ee37,_0x4912e5,_0xa51bec){var _0x2640d1={'raw':![],'where':{}};var _0x48336f={};var _0x3d4b33={'count':0x0,'rows':[]};return db[_0x52e1('0x40')][_0x52e1('0x6a')]({'where':{'id':_0x44ee37['params']['id']}})[_0x52e1('0x24')](handleEntityNotFound(_0x4912e5,null))[_0x52e1('0x24')](function(_0x1bdbcb){if(_0x1bdbcb){_0x48336f['model']=_['keys'](db[_0x52e1('0x68')]['rawAttributes']);_0x48336f[_0x52e1('0x46')]=_[_0x52e1('0x45')](_0x44ee37[_0x52e1('0x46')]);_0x48336f[_0x52e1('0x47')]=_[_0x52e1('0x48')](_0x48336f[_0x52e1('0x44')],_0x48336f['query']);_0x2640d1[_0x52e1('0x49')]=_[_0x52e1('0x48')](_0x48336f['model'],qs['fields'](_0x44ee37[_0x52e1('0x46')][_0x52e1('0x5d')]));_0x2640d1[_0x52e1('0x49')]=_0x2640d1[_0x52e1('0x49')]['length']?_0x2640d1[_0x52e1('0x49')]:_0x48336f[_0x52e1('0x44')];if(!_0x44ee37[_0x52e1('0x46')][_0x52e1('0x4b')]('nolimit')){_0x2640d1[_0x52e1('0x4d')]=qs[_0x52e1('0x4d')](_0x44ee37[_0x52e1('0x46')][_0x52e1('0x4d')]);_0x2640d1[_0x52e1('0x32')]=qs[_0x52e1('0x32')](_0x44ee37[_0x52e1('0x46')][_0x52e1('0x32')]);}_0x2640d1[_0x52e1('0x4e')]=qs['sort'](_0x44ee37['query'][_0x52e1('0x4f')]);_0x2640d1[_0x52e1('0x50')]=qs[_0x52e1('0x47')](_[_0x52e1('0x51')](_0x44ee37[_0x52e1('0x46')],_0x48336f[_0x52e1('0x47')]));_0x2640d1[_0x52e1('0x50')][_0x52e1('0x67')]=_0x1bdbcb['id'];if(_0x44ee37['query']['filter']){_0x2640d1['where']=_['merge'](_0x2640d1[_0x52e1('0x50')],{'$or':_[_0x52e1('0x3f')](_0x2640d1[_0x52e1('0x49')],function(_0x241810){var _0x333b12={};_0x333b12[_0x241810]={'$like':'%'+_0x44ee37['query'][_0x52e1('0x52')]+'%'};return _0x333b12;})});}_0x2640d1=_[_0x52e1('0x53')]({},_0x2640d1,_0x44ee37[_0x52e1('0x55')]);return db[_0x52e1('0x68')]['count']({'where':_0x2640d1[_0x52e1('0x50')]})[_0x52e1('0x24')](function(_0x9e71d){_0x3d4b33['count']=_0x9e71d;if(_0x44ee37[_0x52e1('0x46')][_0x52e1('0x57')]){_0x2640d1['include']=[{'all':!![]}];}return db[_0x52e1('0x68')]['findAll'](_0x2640d1);})[_0x52e1('0x24')](function(_0x344132){_0x3d4b33[_0x52e1('0x5a')]=_0x344132;return _0x3d4b33;});}})[_0x52e1('0x24')](respondWithFilteredResult(_0x4912e5,_0x2640d1))[_0x52e1('0x2d')](handleError(_0x4912e5,null));};exports[_0x52e1('0x6b')]=function(_0x5b3027,_0x1cf9c6,_0x19dbe5){return db[_0x52e1('0x40')]['find']({'where':{'id':_0x5b3027[_0x52e1('0x5c')]['id']}})[_0x52e1('0x24')](handleEntityNotFound(_0x1cf9c6,null))['then'](function(_0x46e050){if(_0x46e050){return _0x46e050[_0x52e1('0x6b')](_0x5b3027[_0x52e1('0x46')][_0x52e1('0x6c')]);}})[_0x52e1('0x24')](respondWithStatusCode(_0x1cf9c6,null))[_0x52e1('0x2d')](handleError(_0x1cf9c6,null));};exports['addAnswer']=function(_0xeb27ee,_0x39ed94,_0x33df3e){if(_0xeb27ee['body']['id']){delete _0xeb27ee['body']['id'];}return db['ChatWebsite']['find']({'where':{'id':_0xeb27ee['params']['id']}})[_0x52e1('0x24')](handleEntityNotFound(_0x39ed94,null))[_0x52e1('0x24')](function(_0x4f1232){if(_0x4f1232){_0xeb27ee[_0x52e1('0x5f')]['ChatWebsiteId']=_0x4f1232['id'];return db[_0x52e1('0x6d')]['create'](_0xeb27ee[_0x52e1('0x5f')]);}})[_0x52e1('0x24')](respondWithResult(_0x39ed94,null))[_0x52e1('0x2d')](handleError(_0x39ed94,null));};exports[_0x52e1('0x6e')]=function(_0x1b1ade,_0x449108,_0x2f0203){var _0x19e2fc={'raw':![],'where':{}};var _0x92dd25={};var _0x2e91ab={'count':0x0,'rows':[]};return db[_0x52e1('0x40')][_0x52e1('0x6a')]({'where':{'id':_0x1b1ade[_0x52e1('0x5c')]['id']}})[_0x52e1('0x24')](handleEntityNotFound(_0x449108,null))[_0x52e1('0x24')](function(_0xb1e6e6){if(_0xb1e6e6){_0x92dd25['model']=_[_0x52e1('0x45')](db[_0x52e1('0x6d')]['rawAttributes']);_0x92dd25['query']=_[_0x52e1('0x45')](_0x1b1ade['query']);_0x92dd25[_0x52e1('0x47')]=_[_0x52e1('0x48')](_0x92dd25['model'],_0x92dd25[_0x52e1('0x46')]);_0x19e2fc[_0x52e1('0x49')]=_[_0x52e1('0x48')](_0x92dd25[_0x52e1('0x44')],qs[_0x52e1('0x5d')](_0x1b1ade[_0x52e1('0x46')][_0x52e1('0x5d')]));_0x19e2fc['attributes']=_0x19e2fc['attributes'][_0x52e1('0x4a')]?_0x19e2fc[_0x52e1('0x49')]:_0x92dd25[_0x52e1('0x44')];if(!_0x1b1ade[_0x52e1('0x46')][_0x52e1('0x4b')](_0x52e1('0x4c'))){_0x19e2fc[_0x52e1('0x4d')]=qs[_0x52e1('0x4d')](_0x1b1ade[_0x52e1('0x46')][_0x52e1('0x4d')]);_0x19e2fc[_0x52e1('0x32')]=qs['offset'](_0x1b1ade['query'][_0x52e1('0x32')]);}_0x19e2fc['order']=qs['sort'](_0x1b1ade[_0x52e1('0x46')][_0x52e1('0x4f')]);_0x19e2fc['where']=qs[_0x52e1('0x47')](_[_0x52e1('0x51')](_0x1b1ade[_0x52e1('0x46')],_0x92dd25[_0x52e1('0x47')]));_0x19e2fc[_0x52e1('0x50')][_0x52e1('0x67')]=_0xb1e6e6['id'];if(_0x1b1ade[_0x52e1('0x46')][_0x52e1('0x52')]){_0x19e2fc[_0x52e1('0x50')]=_[_0x52e1('0x53')](_0x19e2fc[_0x52e1('0x50')],{'$or':_[_0x52e1('0x3f')](_0x19e2fc[_0x52e1('0x49')],function(_0x31d934){var _0x4ee3b8={};_0x4ee3b8[_0x31d934]={'$like':'%'+_0x1b1ade['query'][_0x52e1('0x52')]+'%'};return _0x4ee3b8;})});}_0x19e2fc=_[_0x52e1('0x53')]({},_0x19e2fc,_0x1b1ade['options']);return db[_0x52e1('0x6d')][_0x52e1('0x56')]({'where':_0x19e2fc[_0x52e1('0x50')]})[_0x52e1('0x24')](function(_0x159a81){_0x2e91ab[_0x52e1('0x56')]=_0x159a81;if(_0x1b1ade['query'][_0x52e1('0x57')]){_0x19e2fc['include']=[{'all':!![]}];}return db[_0x52e1('0x6d')]['findAll'](_0x19e2fc);})[_0x52e1('0x24')](function(_0x34903c){_0x2e91ab['rows']=_0x34903c;return _0x2e91ab;});}})[_0x52e1('0x24')](respondWithFilteredResult(_0x449108,_0x19e2fc))[_0x52e1('0x2d')](handleError(_0x449108,null));};exports['removeAnswers']=function(_0x583a18,_0x32f569,_0x8dad70){return db['ChatWebsite'][_0x52e1('0x63')]({'where':{'id':_0x583a18[_0x52e1('0x5c')]['id']}})[_0x52e1('0x24')](handleEntityNotFound(_0x32f569,null))[_0x52e1('0x24')](function(_0x37d51b){if(_0x37d51b){return _0x37d51b[_0x52e1('0x6f')](_0x583a18[_0x52e1('0x46')][_0x52e1('0x6c')]);}})[_0x52e1('0x24')](respondWithStatusCode(_0x32f569,null))[_0x52e1('0x2d')](handleError(_0x32f569,null));};exports[_0x52e1('0x70')]=function(_0x2ac68f,_0xc83c26,_0x27e402){_0x2ac68f[_0x52e1('0x5f')][_0x52e1('0x71')]=_0x2ac68f['file'][_0x52e1('0x72')];return db[_0x52e1('0x40')][_0x52e1('0x63')]({'where':{'id':_0x2ac68f[_0x52e1('0x5c')]['id']}})['then'](handleEntityNotFound(_0xc83c26,null))[_0x52e1('0x24')](saveUpdates(_0x2ac68f[_0x52e1('0x5f')],null))['then'](respondWithResult(_0xc83c26,null))[_0x52e1('0x2d')](handleError(_0xc83c26,null));};exports[_0x52e1('0x73')]=function(_0x134b55,_0x532143,_0x1405b8){_0x134b55[_0x52e1('0x5f')][_0x52e1('0x74')]=_0x134b55[_0x52e1('0x75')][_0x52e1('0x72')];return db[_0x52e1('0x40')][_0x52e1('0x63')]({'where':{'id':_0x134b55[_0x52e1('0x5c')]['id']}})[_0x52e1('0x24')](handleEntityNotFound(_0x532143,null))[_0x52e1('0x24')](saveUpdates(_0x134b55[_0x52e1('0x5f')],null))['then'](respondWithResult(_0x532143,null))[_0x52e1('0x2d')](handleError(_0x532143,null));};exports[_0x52e1('0x76')]=function(_0x1fea8a,_0x2d09f9,_0x24848c){_0x1fea8a[_0x52e1('0x5f')][_0x52e1('0x77')]=_0x1fea8a[_0x52e1('0x75')][_0x52e1('0x72')];return db['ChatWebsite'][_0x52e1('0x63')]({'where':{'id':_0x1fea8a[_0x52e1('0x5c')]['id']}})[_0x52e1('0x24')](handleEntityNotFound(_0x2d09f9,null))['then'](saveUpdates(_0x1fea8a[_0x52e1('0x5f')],null))[_0x52e1('0x24')](respondWithResult(_0x2d09f9,null))[_0x52e1('0x2d')](handleError(_0x2d09f9,null));};exports[_0x52e1('0x78')]=function(_0x3956d8,_0x12970c,_0x2933e2){_0x3956d8[_0x52e1('0x5f')][_0x52e1('0x79')]=_0x3956d8[_0x52e1('0x75')][_0x52e1('0x72')];return db['ChatWebsite'][_0x52e1('0x63')]({'where':{'id':_0x3956d8['params']['id']}})[_0x52e1('0x24')](handleEntityNotFound(_0x12970c,null))['then'](saveUpdates(_0x3956d8[_0x52e1('0x5f')],null))[_0x52e1('0x24')](respondWithResult(_0x12970c,null))[_0x52e1('0x2d')](handleError(_0x12970c,null));};exports[_0x52e1('0x7a')]=function(_0x7a7e,_0x4bf507,_0xb59678){var _0x5e2381=path[_0x52e1('0x7b')](config[_0x52e1('0x7c')],_0x52e1('0x7d'));var _0x1ea710={'where':{'id':_0x7a7e[_0x52e1('0x5c')]['id']},'attributes':['id',_0x52e1('0x71')],'raw':!![]};var _0x56aca4=![];return require(_0x52e1('0x7e'))[_0x52e1('0x7f')]()[_0x52e1('0x24')](function(_0x414cf5){if(_0x414cf5){_0x56aca4=_0x414cf5[_0x52e1('0x80')];}})[_0x52e1('0x24')](function(){return db[_0x52e1('0x40')]['find'](_0x1ea710);})['then'](handleEntityNotFound(_0x4bf507,null))[_0x52e1('0x24')](function(_0x3b7f8c){if(_0x3b7f8c){if(!_[_0x52e1('0x81')](_0x3b7f8c[_0x52e1('0x71')])){if(fs[_0x52e1('0x82')](path[_0x52e1('0x7b')](config[_0x52e1('0x7c')],_0x52e1('0x83'),_0x3b7f8c[_0x52e1('0x71')]))&&_0x56aca4){_0x5e2381=path[_0x52e1('0x7b')](config[_0x52e1('0x7c')],_0x52e1('0x83'),_0x3b7f8c['sitepic']);}}return _0x4bf507[_0x52e1('0x84')](_0x5e2381);}})[_0x52e1('0x2d')](handleError(_0x4bf507,null));};exports[_0x52e1('0x85')]=function(_0x40d78e,_0x335c15,_0xa20f44){var _0x3fde0b=path[_0x52e1('0x7b')](config[_0x52e1('0x7c')],_0x52e1('0x86'));var _0x50524b={'where':{'id':_0x40d78e[_0x52e1('0x5c')]['id']},'attributes':['id','agentAvatar'],'raw':!![]};return db[_0x52e1('0x40')]['find'](_0x50524b)[_0x52e1('0x24')](handleEntityNotFound(_0x335c15,null))[_0x52e1('0x24')](function(_0x1180c2){if(_0x1180c2){if(!_['isNil'](_0x1180c2[_0x52e1('0x74')])){if(fs[_0x52e1('0x82')](path[_0x52e1('0x7b')](config[_0x52e1('0x7c')],_0x52e1('0x87'),_0x1180c2[_0x52e1('0x74')]))){_0x3fde0b=path[_0x52e1('0x7b')](config[_0x52e1('0x7c')],_0x52e1('0x87'),_0x1180c2[_0x52e1('0x74')]);}}return _0x335c15[_0x52e1('0x84')](_0x3fde0b);}})[_0x52e1('0x2d')](handleError(_0x335c15,null));};exports[_0x52e1('0x88')]=function(_0x3f10be,_0x2ce780,_0xbab949){var _0x5a1179=path['join'](config[_0x52e1('0x7c')],_0x52e1('0x89'));var _0x269752={'where':{'id':_0x3f10be['params']['id']},'attributes':['id',_0x52e1('0x77'),_0x52e1('0x8a')],'raw':!![]};return db['ChatWebsite'][_0x52e1('0x63')](_0x269752)['then'](handleEntityNotFound(_0x2ce780,null))[_0x52e1('0x24')](function(_0x4586ca){if(_0x4586ca){if(!_[_0x52e1('0x81')](_0x4586ca[_0x52e1('0x77')])){if(fs[_0x52e1('0x82')](path[_0x52e1('0x7b')](config[_0x52e1('0x7c')],_0x52e1('0x87'),_0x4586ca[_0x52e1('0x77')]))&&_0x4586ca[_0x52e1('0x8a')]){_0x5a1179=path[_0x52e1('0x7b')](config[_0x52e1('0x7c')],_0x52e1('0x87'),_0x4586ca[_0x52e1('0x77')]);}}return _0x2ce780[_0x52e1('0x84')](_0x5a1179);}})[_0x52e1('0x2d')](handleError(_0x2ce780,null));};exports['getSystemAvatar']=function(_0x4c3153,_0x486bf3,_0x468551){var _0xae2dc0=path[_0x52e1('0x7b')](config[_0x52e1('0x7c')],_0x52e1('0x8b'));var _0x110bba={'where':{'id':_0x4c3153[_0x52e1('0x5c')]['id']},'attributes':['id',_0x52e1('0x79')],'raw':!![]};return db[_0x52e1('0x40')]['find'](_0x110bba)[_0x52e1('0x24')](handleEntityNotFound(_0x486bf3,null))[_0x52e1('0x24')](function(_0x300c51){if(_0x300c51){if(!_[_0x52e1('0x81')](_0x300c51['systemAvatar'])){if(fs[_0x52e1('0x82')](path[_0x52e1('0x7b')](config[_0x52e1('0x7c')],_0x52e1('0x87'),_0x300c51[_0x52e1('0x79')]))){_0xae2dc0=path[_0x52e1('0x7b')](config[_0x52e1('0x7c')],_0x52e1('0x87'),_0x300c51[_0x52e1('0x79')]);}}return _0x486bf3['download'](_0xae2dc0);}})[_0x52e1('0x2d')](handleError(_0x486bf3,null));};exports[_0x52e1('0x8c')]=function(_0x326680,_0x33bd43,_0x42ee79){var _0x5a5370=require(_0x52e1('0x8d'));var _0x44d182=new _0x5a5370();var _0x2724e5=_0x44d182[_0x52e1('0x8e')](_0x326680[_0x52e1('0x8f')][_0x52e1('0x90')])['getResult']();var _0x562068={'body':_0x326680[_0x52e1('0x5f')],'channel':_0x52e1('0x91')};var _0x4f4475=[];var _0x953fa=[];var _0xb2282={};var _0x407f33=![];return db[_0x52e1('0x92')]['describe']()[_0x52e1('0x24')](function(_0x507a05){if(!_0x507a05){throw new db[(_0x52e1('0x21'))][(_0x52e1('0x22'))](_0x52e1('0x93'));}_0x4f4475=_['difference'](_['keys'](_0x507a05),['createdAt',_0x52e1('0x94')]);_0x953fa=_['difference'](_['keys'](_0x507a05),[_0x52e1('0x95'),'updatedAt',_0x52e1('0x96'),_0x52e1('0x97')]);if(_0x326680[_0x52e1('0x5f')]['id']){delete _0x326680['body']['id'];}if(_[_0x52e1('0x81')](_0x326680['body'][_0x52e1('0x98')])){throw new db[(_0x52e1('0x21'))]['ValidationError'](_0x52e1('0x99'));}if(_[_0x52e1('0x81')](_0x326680[_0x52e1('0x5f')]['body'])||_0x326680['body'][_0x52e1('0x5f')]===''){throw new db['Sequelize'][(_0x52e1('0x22'))](_0x52e1('0x9a'));}if(_[_0x52e1('0x81')](_0x326680['body'][_0x52e1('0x9b')])){throw new db['Sequelize'][(_0x52e1('0x22'))](_0x52e1('0x9c')+_0x953fa);}if(!_['includes'](_0x953fa,_0x326680[_0x52e1('0x5f')]['mapKey'])){throw new db[(_0x52e1('0x21'))][(_0x52e1('0x22'))](_0x52e1('0x9d')+_0x953fa);}_0xb2282[_0x326680[_0x52e1('0x5f')][_0x52e1('0x9b')]]=_0x326680[_0x52e1('0x5f')][_0x52e1('0x98')];})[_0x52e1('0x24')](function(){return db[_0x52e1('0x40')][_0x52e1('0x63')]({'where':{'id':_0x326680['params']['id']},'include':[{'model':db[_0x52e1('0x9e')],'as':'List','include':[{'model':db['CmContact'],'as':'Contacts','where':_0xb2282,'limit':0x1,'order':[[_0x52e1('0x94'),_0x52e1('0x9f')]]}]},{'model':db[_0x52e1('0xa0')],'as':_0x52e1('0xa1')}]});})[_0x52e1('0x24')](handleEntityNotFound(_0x33bd43,null))['then'](function(_0x3968a7){if(_0x3968a7&&_0x3968a7[_0x52e1('0xa2')]){_0x562068[_0x52e1('0xa3')]=_0x3968a7;_0x562068[_0x52e1('0xa4')]=_0x3968a7['Applications'];_0x562068[_0x52e1('0xa5')]=_0x3968a7[_0x52e1('0xa2')];_0x562068[_0x52e1('0xa4')]=_[_0x52e1('0xa6')](_0x562068[_0x52e1('0xa4')],['priority'],['asc']);if(_0x562068[_0x52e1('0xa3')][_0x52e1('0xa1')]){delete _0x562068[_0x52e1('0xa3')][_0x52e1('0xa1')];}if(_0x562068[_0x52e1('0xa3')][_0x52e1('0xa2')]&&_0x562068['account'][_0x52e1('0xa2')][_0x52e1('0xa7')]['length']){return _0x562068[_0x52e1('0xa3')]['List'][_0x52e1('0xa7')][0x0];}var _0x5ababd=_[_0x52e1('0x18')](_0x326680[_0x52e1('0x5f')],{'firstName':_0x326680[_0x52e1('0x5f')]['from'],'ListId':_0x3968a7[_0x52e1('0x97')]});_0x5ababd[_0x326680[_0x52e1('0x5f')][_0x52e1('0x9b')]]=_0x326680[_0x52e1('0x5f')][_0x52e1('0x98')];return db['CmContact'][_0x52e1('0x5e')](_0x5ababd,{'fields':_0x4f4475,'raw':!![]});}})['then'](handleEntityNotFound(_0x33bd43,null))[_0x52e1('0x24')](function(_0x158a3e){_0x562068['contact']=_0x158a3e;var _0x5d00b5=_0x326680[_0x52e1('0x5f')][_0x52e1('0xa8')];if(_0x326680['headers'][_0x52e1('0xa9')]){_0x5d00b5=_0x326680[_0x52e1('0x8f')][_0x52e1('0xa9')];}else if(_0x326680[_0x52e1('0x8f')][_0x52e1('0xaa')]){_0x5d00b5=_['first'](_0x326680[_0x52e1('0x8f')][_0x52e1('0xaa')]['split'](','));}if(_0x158a3e){var _0x298071={'ContactId':_0x158a3e['id'],'ChatWebsiteId':_0x326680[_0x52e1('0x5c')]['id'],'from':(_0x158a3e[_0x52e1('0xab')]||'')+'\x20'+(_0x158a3e[_0x52e1('0xac')]||''),'customerIp':_0x5d00b5,'customerPort':_0x326680[_0x52e1('0x8f')][_0x52e1('0xad')]?_0x326680['headers']['x-real-port']:null,'referer':_0x326680['body'][_0x52e1('0xae')],'browserName':_0x2724e5[_0x52e1('0xaf')][_0x52e1('0x3a')]&&_0x2724e5[_0x52e1('0xaf')]['version']?util['format'](_0x52e1('0xb0'),_0x2724e5[_0x52e1('0xaf')][_0x52e1('0x3a')],_0x2724e5[_0x52e1('0xaf')][_0x52e1('0xb1')]):_0x52e1('0xb2'),'browserVersion':_0x2724e5[_0x52e1('0xaf')]['version']||_0x52e1('0xb2'),'osName':util['format']('%s\x20%s',_0x2724e5['os'][_0x52e1('0x3a')],_0x2724e5['os'][_0x52e1('0xb1')]),'osVersion':_0x2724e5['os'][_0x52e1('0xb1')],'deviceModel':_0x2724e5[_0x52e1('0xb3')][_0x52e1('0x44')]&&_0x2724e5[_0x52e1('0xb3')][_0x52e1('0xb4')]?util[_0x52e1('0xb5')](_0x52e1('0xb6'),_0x2724e5[_0x52e1('0xb3')][_0x52e1('0x44')],_0x2724e5[_0x52e1('0xb3')][_0x52e1('0xb4')],_0x2724e5['device'][_0x52e1('0x43')]):null,'deviceVendor':_0x2724e5['device'][_0x52e1('0xb4')],'deviceType':_0x2724e5[_0x52e1('0xb3')][_0x52e1('0x43')],'formData':JSON[_0x52e1('0xb7')](_0x326680[_0x52e1('0x5f')])};var _0x2f11bf={'ChatWebsiteId':_0x326680[_0x52e1('0x5c')]['id'],'closed':![]};if(_0x326680['body']['threadId']){_0x2f11bf['threadId']=_0x326680[_0x52e1('0x5f')]['threadId'];return db[_0x52e1('0xb8')][_0x52e1('0x63')]({'where':_0x2f11bf})['then'](function(_0x28c7ae){if(_0x28c7ae){return[_0x28c7ae,![]];}_0x298071[_0x52e1('0xb9')]=_0x326680[_0x52e1('0x5f')][_0x52e1('0xb9')];_0x298071['externalUrl']=_0x326680[_0x52e1('0x5f')][_0x52e1('0xba')];return db[_0x52e1('0xb8')]['create'](_0x298071)[_0x52e1('0x24')](function(_0x184c83){return[_0x184c83,!![]];});});}_0x2f11bf['ContactId']=_0x158a3e['id'];if(_0x326680['body']['interaction']&&_0x326680[_0x52e1('0x5f')]['interaction']['id']){_0x2f11bf['id']=_0x326680[_0x52e1('0x5f')]['interaction']['id'];return db[_0x52e1('0xb8')]['find']({'where':_0x2f11bf})['then'](function(_0x44fa54){if(_0x44fa54){return[_0x44fa54,![]];}return db[_0x52e1('0xb8')]['create'](_0x298071)['then'](function(_0x2c1098){return[_0x2c1098,!![]];});});}return db[_0x52e1('0xb8')][_0x52e1('0x5e')](_0x298071)[_0x52e1('0x24')](function(_0x566ec7){return[_0x566ec7,!![]];});}})[_0x52e1('0xbb')](function(_0x5c3fb6,_0x17830c){if(_0x5c3fb6){_0x407f33=_0x17830c;if(!_0x17830c){var _0x1dbe19={'from':(_0x562068[_0x52e1('0xbc')][_0x52e1('0xab')]||'')+'\x20'+(_0x562068[_0x52e1('0xbc')][_0x52e1('0xac')]||'')};if(_0x326680[_0x52e1('0x5f')][_0x52e1('0xb9')]&&_0x326680[_0x52e1('0x5f')][_0x52e1('0xbd')]&&_0x326680[_0x52e1('0x5f')]['threadId']!=_0x326680[_0x52e1('0x5f')][_0x52e1('0xbd')]){_0x1dbe19[_0x52e1('0xb9')]=_0x326680[_0x52e1('0x5f')]['messageId'];}return _0x5c3fb6['update'](_0x1dbe19);}else{return _0x5c3fb6;}}})['then'](function(_0x271c76){_0x562068[_0x52e1('0xbe')]=_0x271c76[_0x52e1('0x36')]({'plain':!![]});_0x562068[_0x52e1('0xbe')][_0x52e1('0xbf')]=_0x407f33;if(_0x562068[_0x52e1('0xbe')][_0x52e1('0xbf')]){if(_0x562068[_0x52e1('0xa3')][_0x52e1('0xc0')]){_0x562068[_0x52e1('0xa4')]['push']({'id':0x0,'priority':_0x562068[_0x52e1('0xa4')][_0x52e1('0x4a')]+0x1,'app':_0x52e1('0xc1'),'appdata':_0x52e1('0xc2'),'interval':_0x52e1('0xc3')});}}return db['ChatMessage'][_0x52e1('0x5e')]({'body':_0x326680['body'][_0x52e1('0x5f')],'ChatWebsiteId':_0x326680[_0x52e1('0x5c')]['id'],'ChatInteractionId':_0x271c76['id'],'direction':'in','ContactId':_0x562068[_0x52e1('0xbc')]['id'],'AttachmentId':_0x326680[_0x52e1('0x5f')][_0x52e1('0xc4')]});})['then'](function(_0x215e94){_0x562068['message']=_0x215e94;if(_0x562068[_0x52e1('0xbe')]['UserId']){return db[_0x52e1('0xc5')][_0x52e1('0x63')]({'attributes':['id',_0x52e1('0x3a')],'where':{'id':_0x562068['interaction'][_0x52e1('0xc6')]}})['then'](function(_0x2e1b99){if(_0x2e1b99){_0x562068['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0x52e1('0xc7'),'appdata':_0x2e1b99['name']+','+(_0x562068['account'][_0x52e1('0xc8')]||0xa),'interval':_0x52e1('0xc3')});_0x562068[_0x52e1('0xc9')]=!![];}return respondWithRpcPromise(_0x52e1('0xca'),_0x52e1('0xcb'),_0x562068);});}return respondWithRpcPromise(_0x52e1('0xca'),_0x52e1('0xcb'),_0x562068);})[_0x52e1('0x24')](function(_0x2d1adc){respondWithRpcPromise(_0x52e1('0xcc'),_0x52e1('0xcc'),{'event':'notify','message':_0x2d1adc},client9002);return _0x2d1adc;})[_0x52e1('0x24')](respondWithResult(_0x33bd43,null))[_0x52e1('0x2d')](handleError(_0x33bd43,null));};exports[_0x52e1('0xcd')]=function(_0x4736c8,_0x1c386a,_0x54fc09){var _0x1cf7f0,_0x22be9f,_0x4a485f;var _0x2ba400=[];var _0x561d81=[];var _0x785bda={};return db[_0x52e1('0x92')][_0x52e1('0x65')]()[_0x52e1('0x24')](function(_0x4a4559){if(!_0x4a4559){throw new db['Sequelize']['ValidationError']('no\x20available\x20attributes');}_0x561d81=_[_0x52e1('0xce')](_[_0x52e1('0x45')](_0x4a4559),[_0x52e1('0x95'),'updatedAt']);_0x2ba400=_[_0x52e1('0xce')](_['keys'](_0x4a4559),[_0x52e1('0x95'),_0x52e1('0x94'),_0x52e1('0x96'),_0x52e1('0x97')]);if(_0x4736c8['body']['id']){delete _0x4736c8['body']['id'];}if(_[_0x52e1('0x81')](_0x4736c8[_0x52e1('0x5f')][_0x52e1('0x98')])){throw _0x1c386a['status'](0x1f4)[_0x52e1('0x3b')](new db['Sequelize'][(_0x52e1('0x22'))](_0x52e1('0x99')));}if(_[_0x52e1('0x81')](_0x4736c8[_0x52e1('0x5f')][_0x52e1('0x5f')])||_0x4736c8[_0x52e1('0x5f')]['body']===''){throw _0x1c386a[_0x52e1('0x2f')](0x1f4)['send'](new db[(_0x52e1('0x21'))][(_0x52e1('0x22'))]('body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0x52e1('0x81')](_0x4736c8['body'][_0x52e1('0xcf')])){throw _0x1c386a[_0x52e1('0x2f')](0x1f4)['send'](new db['Sequelize'][(_0x52e1('0x22'))]('mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2ba400));}if(!_[_0x52e1('0xd0')](_0x2ba400,_0x4736c8['body'][_0x52e1('0xcf')])){throw _0x1c386a[_0x52e1('0x2f')](0x1f4)[_0x52e1('0x3b')](new db[(_0x52e1('0x21'))]['ValidationError'](_0x52e1('0xd1')+_0x2ba400));}_0x785bda[_0x4736c8['body'][_0x52e1('0xcf')]]=_0x4736c8[_0x52e1('0x5f')][_0x52e1('0x98')];})[_0x52e1('0x24')](function(){return db['ChatWebsite'][_0x52e1('0x63')]({'where':{'id':_0x4736c8[_0x52e1('0x5c')]['id']},'include':[{'model':db['CmList'],'as':_0x52e1('0xa2')}]});})[_0x52e1('0x24')](handleEntityNotFound(_0x1c386a,null))[_0x52e1('0x24')](function(_0x1e6e3b){if(_0x1e6e3b&&_0x1e6e3b[_0x52e1('0xa2')]){_0x22be9f=_0x1e6e3b;var _0xe73144=_[_0x52e1('0x18')](_0x4736c8[_0x52e1('0x5f')],{'firstName':_0x4736c8[_0x52e1('0x5f')][_0x52e1('0x98')],'phone':_0x4736c8[_0x52e1('0x5f')]['from'],'ListId':_0x1e6e3b[_0x52e1('0x97')]});_0xe73144[_0x4736c8[_0x52e1('0x5f')][_0x52e1('0xcf')]]=_0x4736c8['body']['from'];return db[_0x52e1('0x92')][_0x52e1('0xd2')]({'where':_0x785bda,'defaults':_0xe73144});}})['spread'](function(_0x1aff12){if(_0x1aff12){_0x4a485f=_0x1aff12;var _0x8b98f4=fs[_0x52e1('0xd3')](path['join'](config[_0x52e1('0x7c')],_0x52e1('0xd4')),_0x52e1('0xd5'));var _0x5ed8cf=ejs[_0x52e1('0xd6')](_0x8b98f4,{'body':_[_0x52e1('0xd7')](_0x4736c8['body'][_0x52e1('0x5f')]),'bodyTitle':_0x22be9f[_0x52e1('0xd8')]});return db['ChatOfflineMessage'][_0x52e1('0x5e')]({'body':_0x5ed8cf,'ContactId':_0x1aff12['id'],'ChatWebsiteId':_0x22be9f['id']});}})[_0x52e1('0x24')](function(_0x447c49){if(_0x447c49){_0x1cf7f0=_0x447c49;return db['MailAccount']['findOne']({'where':{'service':!![]},'include':[{'model':db[_0x52e1('0xd9')],'as':_0x52e1('0xda'),'raw':!![]}]});}})[_0x52e1('0x24')](function(_0xbfc323){if(_0xbfc323&&_0xbfc323[_0x52e1('0xda')]&&_0x22be9f['forwardOfflineAddress']){var _0x3f4c14={'tls':{'rejectUnauthorized':![]}};if(_0xbfc323[_0x52e1('0xda')]['service']){_0x3f4c14['service']=_0xbfc323[_0x52e1('0xda')]['service'];}else{_0x3f4c14[_0x52e1('0xdb')]=_0xbfc323[_0x52e1('0xda')][_0x52e1('0xdb')];_0x3f4c14[_0x52e1('0xdc')]=_0xbfc323['Smtp'][_0x52e1('0xdc')];_0x3f4c14['secure']=_0xbfc323[_0x52e1('0xda')]['secure'];}if(_0xbfc323[_0x52e1('0xda')]['authentication']){_0x3f4c14[_0x52e1('0xdd')]={'user':_0xbfc323[_0x52e1('0xda')]['user'],'pass':_0xbfc323['Smtp']['pass']};}return respondWithRpcPromise(_0x52e1('0xde'),_0x52e1('0xdf'),{'account':_0x3f4c14,'message':{'from':util[_0x52e1('0xb5')]('\x22%s\x22\x20<%s>',_0xbfc323[_0x52e1('0x3a')],_0xbfc323['email']||_0xbfc323['Smtp'][_0x52e1('0x62')]),'to':_0x22be9f[_0x52e1('0xe0')],'subject':_0x22be9f['offlineMessageSubject'],'text':_0x1cf7f0['body']}},client9003)[_0x52e1('0x24')](function(){return _0x1cf7f0;})['catch'](function(_0x221912){console[_0x52e1('0x29')](_0x221912);});}})[_0x52e1('0x24')](function(){if(_0x1cf7f0){return _0x1cf7f0;}})[_0x52e1('0x24')](respondWithResult(_0x1c386a,null))[_0x52e1('0x2d')](handleError(_0x1c386a,null));};exports['addInteraction']=function(_0x31bf7c,_0x1de041,_0x2e4dba){return db[_0x52e1('0xb8')]['find']({'where':{'id':_0x31bf7c[_0x52e1('0x5c')]['id']}})[_0x52e1('0x24')](handleEntityNotFound(_0x1de041,null))[_0x52e1('0x24')](function(_0x599b23){if(_0x599b23){return _0x599b23[_0x52e1('0xe1')](_0x31bf7c[_0x52e1('0x5f')][_0x52e1('0x6c')],_['omit'](_0x31bf7c[_0x52e1('0x5f')],[_0x52e1('0x6c'),'id'])||{});}})[_0x52e1('0x24')](respondWithResult(_0x1de041,null))['catch'](handleError(_0x1de041,null));};exports['getInteractions']=function(_0x422a8f,_0x455c5e,_0x2b842d){var _0x918823={'raw':![],'where':{}};var _0x81ff6a={};var _0x5b6e44={'count':0x0,'rows':[]};return db[_0x52e1('0x40')][_0x52e1('0x6a')]({'where':{'id':_0x422a8f[_0x52e1('0x5c')]['id']}})[_0x52e1('0x24')](handleEntityNotFound(_0x455c5e,null))[_0x52e1('0x24')](function(_0x22f0dd){if(_0x22f0dd){_0x81ff6a[_0x52e1('0x44')]=_['keys'](db[_0x52e1('0xb8')][_0x52e1('0x41')]);_0x81ff6a[_0x52e1('0x46')]=_[_0x52e1('0x45')](_0x422a8f['query']);_0x81ff6a[_0x52e1('0x47')]=_['intersection'](_0x81ff6a[_0x52e1('0x44')],_0x81ff6a[_0x52e1('0x46')]);_0x918823[_0x52e1('0x49')]=_[_0x52e1('0x48')](_0x81ff6a[_0x52e1('0x44')],qs[_0x52e1('0x5d')](_0x422a8f[_0x52e1('0x46')][_0x52e1('0x5d')]));_0x918823[_0x52e1('0x49')]=_0x918823[_0x52e1('0x49')]['length']?_0x918823[_0x52e1('0x49')]:_0x81ff6a[_0x52e1('0x44')];if(!_0x422a8f['query'][_0x52e1('0x4b')](_0x52e1('0x4c'))){_0x918823[_0x52e1('0x4d')]=qs[_0x52e1('0x4d')](_0x422a8f[_0x52e1('0x46')][_0x52e1('0x4d')]);_0x918823[_0x52e1('0x32')]=qs[_0x52e1('0x32')](_0x422a8f[_0x52e1('0x46')]['offset']);}_0x918823['order']=qs['sort'](_0x422a8f['query']['sort']);_0x918823[_0x52e1('0x50')]=qs[_0x52e1('0x47')](_[_0x52e1('0x51')](_0x422a8f['query'],_0x81ff6a['filters']));_0x918823[_0x52e1('0x50')][_0x52e1('0x67')]=_0x22f0dd['id'];if(_0x422a8f[_0x52e1('0x46')][_0x52e1('0x52')]){_0x918823['where']=_[_0x52e1('0x53')](_0x918823['where'],{'$or':_['map'](_0x918823['attributes'],function(_0x575f42){var _0x37d724={};_0x37d724[_0x575f42]={'$like':'%'+_0x422a8f[_0x52e1('0x46')][_0x52e1('0x52')]+'%'};return _0x37d724;})});}_0x918823=_[_0x52e1('0x53')]({},_0x918823,_0x422a8f['options']);return db[_0x52e1('0xb8')][_0x52e1('0x56')]({'where':_0x918823[_0x52e1('0x50')]})['then'](function(_0x1bb309){_0x5b6e44[_0x52e1('0x56')]=_0x1bb309;if(_0x422a8f[_0x52e1('0x46')]['includeAll']){_0x918823[_0x52e1('0x58')]=[{'model':db[_0x52e1('0x92')],'as':_0x52e1('0xe2'),'required':![]},{'model':db[_0x52e1('0xc5')],'as':'Owner','attributes':[_0x52e1('0x3a'),_0x52e1('0xe3'),'internal'],'required':![]},{'model':db[_0x52e1('0xe4')],'as':_0x52e1('0xe5'),'attributes':['id','name',_0x52e1('0xe6')],'where':_0x422a8f[_0x52e1('0x46')]['tag']?{'id':_0x422a8f[_0x52e1('0x46')][_0x52e1('0xe7')]}:undefined,'required':_0x422a8f['query'][_0x52e1('0xe7')]?!![]:![]}];}return db[_0x52e1('0xb8')][_0x52e1('0x59')](_0x918823);})[_0x52e1('0x24')](function(_0x222208){_0x5b6e44[_0x52e1('0x5a')]=_0x222208;return _0x5b6e44;});}})[_0x52e1('0x24')](respondWithFilteredResult(_0x455c5e,_0x918823))['catch'](handleError(_0x455c5e,null));};function iftimePromise(_0x52fc92,_0x201da2){return respondWithRpcPromise(_0x52e1('0xe8'),_0x52e1('0xe9'),{'command':_0x201da2[_0x52e1('0xea')]?util['format']('iftime\x20%s,%s',_0x52fc92[_0x52e1('0xeb')],_0x201da2[_0x52e1('0xea')]):util['format'](_0x52e1('0xec'),_0x52fc92[_0x52e1('0xeb')])},client9002)[_0x52e1('0x24')](function(_0x2d57b9){var _0x53758b=_0x2d57b9&&_0x2d57b9[_0x52e1('0xed')](_0x52e1('0xee'))>=0x0?!![]:![];logger['info'](_0x52e1('0xef'),_0x201da2['id'],_0x52fc92['id'],_0x52fc92['interval'],_0x53758b?'ONLINE':_0x52e1('0xf0'),_0x201da2['timezone']?_0x201da2[_0x52e1('0xea')]:'No\x20timezone');return _0x53758b;})[_0x52e1('0x2d')](function(_0x33e515){logger['error'](_0x52e1('0xef'),_0x201da2['id'],_0x52fc92['id'],_0x52fc92[_0x52e1('0xeb')],util[_0x52e1('0xf1')](_0x33e515,{'showHidden':![],'depth':null}),_0x201da2[_0x52e1('0xea')]?_0x201da2[_0x52e1('0xea')]:_0x52e1('0xf2'));return![];});}exports['getSnippet']=function(_0x31eee8,_0x1a606a,_0x357198){var _0x1ed065=0x0;var _0x3e8ba4=0x0;var _0x402345=![];var _0x248e6f;var _0x19787c;return db[_0x52e1('0x40')][_0x52e1('0x63')]({'where':{'id':_0x31eee8['params']['id']},'include':[{'model':db[_0x52e1('0xf3')],'as':_0x52e1('0xf3'),'include':[{'model':db[_0x52e1('0xf3')],'as':_0x52e1('0xf4'),'attributes':['id',_0x52e1('0xeb')],'raw':!![]}]}]})[_0x52e1('0x24')](handleEntityNotFound(_0x1a606a,null))['then'](function(_0x1e505e){if(_0x1e505e){_0x248e6f=_0x1e505e;return _0x1e505e[_0x52e1('0xf5')]({'raw':!![]});}})['then'](function(_0x487854){if(_0x248e6f){if(_0x487854){_0x19787c=_0x487854;}}return require('../../config/license/util')[_0x52e1('0x7f')]();})['then'](function(_0x2e3714){if(_0x2e3714){_0x3e8ba4=_0x2e3714[_0x52e1('0xf6')];_0x402345=_0x2e3714['custom'];}})[_0x52e1('0x24')](function(){return db[_0x52e1('0xb8')]['count']({'where':{'closed':![]}});})[_0x52e1('0x24')](function(_0x4c8b63){_0x1ed065=_0x4c8b63;if(_0x3e8ba4&&_0x4c8b63>_0x3e8ba4){return db[_0x52e1('0xf7')][_0x52e1('0x6a')]({'where':{'id':0x1}})[_0x52e1('0x24')](function(_0x40796d){if(_0x40796d){_0x40796d[_0x52e1('0xf8')](_0x52e1('0xf9'));}});}})['then'](function(){if(_0x248e6f[_0x52e1('0xf3')]&&_0x248e6f[_0x52e1('0xf3')][_0x52e1('0xf4')]){var _0xbe47bd=[];for(var _0x13097f=0x0;_0x13097f<_0x248e6f[_0x52e1('0xf3')][_0x52e1('0xf4')][_0x52e1('0x4a')];_0x13097f++){var _0x49aea4=_0x248e6f['Interval']['Intervals'][_0x13097f][_0x52e1('0x36')]({'plain':!![]});_0xbe47bd[_0x52e1('0xfa')](iftimePromise(_0x49aea4,_0x248e6f));}return BPromise[_0x52e1('0xfb')](_0xbe47bd)[_0x52e1('0x24')](function(_0x52d634){return _['some'](_0x52d634);});}else{return!![];}})[_0x52e1('0x24')](function(_0x165a81){var _0xee2524=fs[_0x52e1('0xd3')](path['join'](config[_0x52e1('0x7c')],_0x52e1('0xfc')),'utf8');var _0x15aa05={'remote':_0x248e6f[_0x52e1('0xfd')],'query':querystring[_0x52e1('0xb7')](_[_0x52e1('0x53')](_0x248e6f[_0x52e1('0x36')]({'plain':!![]}),{'customerIp':_0x31eee8[_0x52e1('0x8f')][_0x52e1('0xaa')]||_0x31eee8[_0x52e1('0x8f')][_0x52e1('0xfe')]||_0x31eee8[_0x52e1('0xff')][_0x52e1('0x100')]||_0x31eee8['ip'],'referer':_0x31eee8['headers'][_0x52e1('0xae')],'openedInteractions':_0x1ed065,'maxInteractions':_0x3e8ba4,'virtual':_0x402345['virtual'],'online':_0x165a81,'custom':_0x402345}))['replace'](/'/g,'\x5c\x27')};_0x1a606a['send'](ejs[_0x52e1('0xd6')](Mustache['render'](_0xee2524,_0x15aa05),{'proactiveActions':_0x19787c,'alignment':_0x248e6f[_0x52e1('0x101')],'verticalAlignment':_0x248e6f[_0x52e1('0x102')],'div_color':_0x248e6f[_0x52e1('0xe6')],'text_color':_0x248e6f[_0x52e1('0x103')]}));})[_0x52e1('0x2d')](handleError(_0x1a606a,null));};exports[_0x52e1('0x104')]=function(_0x33f174,_0x21d046,_0x31bdb1){return db[_0x52e1('0x40')][_0x52e1('0x6a')]({'where':{'id':_0x33f174['params']['id']}})[_0x52e1('0x24')](handleEntityNotFound(_0x21d046,null))['then'](function(_0x36b228){if(_0x36b228){return db[_0x52e1('0x105')]['transaction'](function(_0x4b3b13){return db['ChatApplication'][_0x52e1('0x35')]({'where':{'ChatWebsiteId':_0x33f174['params']['id']},'transaction':_0x4b3b13})['then'](function(_0x54bdf9){var _0x4b5565=_[_0x52e1('0x3f')](_0x33f174[_0x52e1('0x5f')],function(_0x461b39){_0x461b39[_0x52e1('0x67')]=_0x33f174[_0x52e1('0x5c')]['id'];return _0x461b39;});return db[_0x52e1('0xa0')]['bulkCreate'](_0x4b5565,{'transaction':_0x4b3b13});});})['then'](function(){return db['ChatApplication'][_0x52e1('0x106')]({'where':{'ChatWebsiteId':_0x33f174[_0x52e1('0x5c')]['id']},'order':_0x52e1('0x107')});});}})['then'](respondWithResult(_0x21d046,null))[_0x52e1('0x2d')](handleError(_0x21d046,null));};exports['getApplications']=function(_0x483ec9,_0x21159a,_0x40b056){var _0x3c79fd={};var _0x2ef308={};var _0x1ccd63;var _0x3230be;return db['ChatWebsite']['findOne']({'where':{'id':_0x483ec9['params']['id']}})[_0x52e1('0x24')](handleEntityNotFound(_0x21159a,null))[_0x52e1('0x24')](function(_0x5f2ac5){if(_0x5f2ac5){_0x1ccd63=_0x5f2ac5;_0x2ef308[_0x52e1('0x44')]=_[_0x52e1('0x45')](db[_0x52e1('0xa0')][_0x52e1('0x41')]);_0x2ef308[_0x52e1('0x46')]=_['keys'](_0x483ec9[_0x52e1('0x46')]);_0x2ef308[_0x52e1('0x47')]=_[_0x52e1('0x48')](_0x2ef308['model'],_0x2ef308[_0x52e1('0x46')]);_0x3c79fd['attributes']=_[_0x52e1('0x48')](_0x2ef308[_0x52e1('0x44')],qs[_0x52e1('0x5d')](_0x483ec9[_0x52e1('0x46')][_0x52e1('0x5d')]));_0x3c79fd[_0x52e1('0x49')]=_0x3c79fd[_0x52e1('0x49')][_0x52e1('0x4a')]?_0x3c79fd['attributes']:_0x2ef308['model'];_0x3c79fd[_0x52e1('0x4e')]=qs[_0x52e1('0x4f')](_0x483ec9[_0x52e1('0x46')][_0x52e1('0x4f')]);_0x3c79fd['where']=qs[_0x52e1('0x47')](_[_0x52e1('0x51')](_0x483ec9['query'],_0x2ef308[_0x52e1('0x47')]));if(_0x483ec9['query']['filter']){_0x3c79fd[_0x52e1('0x50')]=_[_0x52e1('0x53')](_0x3c79fd[_0x52e1('0x50')],{'$or':_[_0x52e1('0x3f')](_0x3c79fd['attributes'],function(_0x178fe9){var _0x394154={};_0x394154[_0x178fe9]={'$like':'%'+_0x483ec9['query'][_0x52e1('0x52')]+'%'};return _0x394154;})});}_0x3c79fd=_['merge']({},_0x3c79fd,_0x483ec9[_0x52e1('0x55')]);return _0x1ccd63['getApplications'](_0x3c79fd);}})['then'](function(_0x1f1d8b){if(_0x1f1d8b){_0x3230be=_0x1f1d8b[_0x52e1('0x4a')];if(!_0x483ec9[_0x52e1('0x46')]['hasOwnProperty'](_0x52e1('0x4c'))){_0x3c79fd[_0x52e1('0x4d')]=qs[_0x52e1('0x4d')](_0x483ec9[_0x52e1('0x46')][_0x52e1('0x4d')]);_0x3c79fd['offset']=qs[_0x52e1('0x32')](_0x483ec9[_0x52e1('0x46')][_0x52e1('0x32')]);}return _0x1ccd63['getApplications'](_0x3c79fd);}})['then'](function(_0x58580c){if(_0x58580c){return _0x58580c?{'count':_0x3230be,'rows':_0x58580c}:null;}})[_0x52e1('0x24')](respondWithResult(_0x21159a,null))['catch'](handleError(_0x21159a,null));};exports[_0x52e1('0x108')]=function(_0x53d838,_0x5d82e6,_0xd5b44e){return db[_0x52e1('0x109')][_0x52e1('0x63')]({'where':{'id':_0x53d838[_0x52e1('0x5c')]['id']}})[_0x52e1('0x24')](handleEntityNotFound(_0x5d82e6,null))['then'](function(_0x417e16){if(_0x417e16){return _0x417e16[_0x52e1('0x108')](_0x53d838[_0x52e1('0x5f')][_0x52e1('0x6c')],_[_0x52e1('0x10a')](_0x53d838[_0x52e1('0x5f')],[_0x52e1('0x6c'),'id'])||{});}})[_0x52e1('0x24')](respondWithResult(_0x5d82e6,null))[_0x52e1('0x2d')](handleError(_0x5d82e6,null));};exports[_0x52e1('0xf5')]=function(_0x3ba8cf,_0x26592d,_0xc00099){var _0x4a68f1={};var _0x2e53c2={};var _0x43182c;var _0x10f6aa;return db['ChatWebsite'][_0x52e1('0x6a')]({'where':{'id':_0x3ba8cf['params']['id']}})[_0x52e1('0x24')](handleEntityNotFound(_0x26592d,null))['then'](function(_0x5dd378){if(_0x5dd378){_0x43182c=_0x5dd378;_0x2e53c2['model']=_[_0x52e1('0x45')](db[_0x52e1('0x10b')][_0x52e1('0x41')]);_0x2e53c2[_0x52e1('0x46')]=_[_0x52e1('0x45')](_0x3ba8cf[_0x52e1('0x46')]);_0x2e53c2['filters']=_['intersection'](_0x2e53c2[_0x52e1('0x44')],_0x2e53c2[_0x52e1('0x46')]);_0x4a68f1[_0x52e1('0x49')]=_[_0x52e1('0x48')](_0x2e53c2[_0x52e1('0x44')],qs[_0x52e1('0x5d')](_0x3ba8cf['query'][_0x52e1('0x5d')]));_0x4a68f1[_0x52e1('0x49')]=_0x4a68f1[_0x52e1('0x49')]['length']?_0x4a68f1['attributes']:_0x2e53c2[_0x52e1('0x44')];_0x4a68f1[_0x52e1('0x4e')]=qs['sort'](_0x3ba8cf[_0x52e1('0x46')]['sort']);_0x4a68f1[_0x52e1('0x50')]=qs[_0x52e1('0x47')](_[_0x52e1('0x51')](_0x3ba8cf[_0x52e1('0x46')],_0x2e53c2[_0x52e1('0x47')]));if(_0x3ba8cf[_0x52e1('0x46')][_0x52e1('0x52')]){_0x4a68f1[_0x52e1('0x50')]=_[_0x52e1('0x53')](_0x4a68f1[_0x52e1('0x50')],{'$or':_[_0x52e1('0x3f')](_0x4a68f1['attributes'],function(_0x37fd2d){var _0x3975b2={};_0x3975b2[_0x37fd2d]={'$like':'%'+_0x3ba8cf[_0x52e1('0x46')]['filter']+'%'};return _0x3975b2;})});}_0x4a68f1=_[_0x52e1('0x53')]({},_0x4a68f1,_0x3ba8cf[_0x52e1('0x55')]);return _0x43182c[_0x52e1('0xf5')](_0x4a68f1);}})[_0x52e1('0x24')](function(_0x2e884e){if(_0x2e884e){_0x10f6aa=_0x2e884e[_0x52e1('0x4a')];if(!_0x3ba8cf[_0x52e1('0x46')][_0x52e1('0x4b')]('nolimit')){_0x4a68f1[_0x52e1('0x4d')]=qs[_0x52e1('0x4d')](_0x3ba8cf['query'][_0x52e1('0x4d')]);_0x4a68f1[_0x52e1('0x32')]=qs[_0x52e1('0x32')](_0x3ba8cf[_0x52e1('0x46')][_0x52e1('0x32')]);}return _0x43182c[_0x52e1('0xf5')](_0x4a68f1);}})[_0x52e1('0x24')](function(_0x3306a6){if(_0x3306a6){return _0x3306a6?{'count':_0x10f6aa,'rows':_0x3306a6}:null;}})[_0x52e1('0x24')](respondWithResult(_0x26592d,null))[_0x52e1('0x2d')](handleError(_0x26592d,null));};exports[_0x52e1('0x10c')]=function(_0x2a1271,_0x3f5667,_0x24a6be){var _0x3ad6d1=_0x2a1271['query'][_0x52e1('0x10d')]===_0x52e1('0x10e')?_0x52e1('0x10f'):_0x52e1('0x110');return db[_0x52e1('0x40')][_0x52e1('0x63')]({'attributes':['id',_0x3ad6d1],'where':{'id':_0x2a1271[_0x52e1('0x5c')]['id']}})[_0x52e1('0x24')](handleEntityNotFound(_0x3f5667,null))[_0x52e1('0x24')](function(_0xb63947){if(_0xb63947){var _0x27efec=_0xb63947[_0x3ad6d1];var _0x16fe22=_0x27efec&&_0x27efec[_0x52e1('0x111')]?_0x27efec[_0x52e1('0x111')]:[];_0x3f5667[_0x52e1('0x3b')]({'fromKey':_[_0x52e1('0x81')](_0x27efec[_0x52e1('0x112')])?undefined:_0x27efec[_0x52e1('0x112')],'count':_0x16fe22['length'],'rows':_0x16fe22});}})[_0x52e1('0x2d')](handleError(_0x3f5667,null));};exports[_0x52e1('0x113')]=function(_0x348f97,_0x8c7d31,_0x1fdeab){var _0x1041b8={'raw':![],'where':{}};var _0xdc3f5c={};var _0x3decda={'count':0x0,'rows':[]};return db[_0x52e1('0x40')][_0x52e1('0x6a')]({'where':{'id':_0x348f97[_0x52e1('0x5c')]['id']}})[_0x52e1('0x24')](handleEntityNotFound(_0x8c7d31,null))['then'](function(_0x1703c0){if(_0x1703c0){_0xdc3f5c[_0x52e1('0x44')]=_['keys'](db[_0x52e1('0x114')][_0x52e1('0x41')]);_0xdc3f5c[_0x52e1('0x46')]=_['keys'](_0x348f97[_0x52e1('0x46')]);_0xdc3f5c[_0x52e1('0x47')]=_[_0x52e1('0x48')](_0xdc3f5c[_0x52e1('0x44')],_0xdc3f5c['query']);_0x1041b8[_0x52e1('0x49')]=_[_0x52e1('0x48')](_0xdc3f5c[_0x52e1('0x44')],qs[_0x52e1('0x5d')](_0x348f97['query']['fields']));_0x1041b8[_0x52e1('0x49')]=_0x1041b8[_0x52e1('0x49')][_0x52e1('0x4a')]?_0x1041b8[_0x52e1('0x49')]:_0xdc3f5c[_0x52e1('0x44')];if(!_0x348f97[_0x52e1('0x46')][_0x52e1('0x4b')]('nolimit')){_0x1041b8[_0x52e1('0x4d')]=qs[_0x52e1('0x4d')](_0x348f97['query'][_0x52e1('0x4d')]);_0x1041b8[_0x52e1('0x32')]=qs['offset'](_0x348f97['query'][_0x52e1('0x32')]);}_0x1041b8[_0x52e1('0x4e')]=qs[_0x52e1('0x4f')](_0x348f97[_0x52e1('0x46')][_0x52e1('0x4f')]);_0x1041b8[_0x52e1('0x50')]=qs[_0x52e1('0x47')](_['pick'](_0x348f97['query'],_0xdc3f5c[_0x52e1('0x47')]));_0x1041b8[_0x52e1('0x50')][_0x52e1('0x67')]=_0x1703c0['id'];if(_0x348f97[_0x52e1('0x46')][_0x52e1('0x52')]){_0x1041b8[_0x52e1('0x50')]=_[_0x52e1('0x53')](_0x1041b8['where'],{'$or':_[_0x52e1('0x3f')](_0x1041b8[_0x52e1('0x49')],function(_0x6c57a4){var _0x266cd1={};_0x266cd1[_0x6c57a4]={'$like':'%'+_0x348f97[_0x52e1('0x46')]['filter']+'%'};return _0x266cd1;})});}_0x1041b8=_[_0x52e1('0x53')]({},_0x1041b8,_0x348f97[_0x52e1('0x55')]);return db[_0x52e1('0x114')][_0x52e1('0x56')]({'where':_0x1041b8[_0x52e1('0x50')]})[_0x52e1('0x24')](function(_0x109ec7){_0x3decda['count']=_0x109ec7;if(_0x348f97[_0x52e1('0x46')]['includeAll']){_0x1041b8[_0x52e1('0x58')]=[{'all':!![]}];}else{_0x1041b8[_0x52e1('0x58')]=[{'model':db[_0x52e1('0x92')],'as':_0x52e1('0xe2'),'required':![]}];}return db[_0x52e1('0x114')]['findAll'](_0x1041b8);})[_0x52e1('0x24')](function(_0x5ea673){_0x3decda[_0x52e1('0x5a')]=_0x5ea673;return _0x3decda;});}})[_0x52e1('0x24')](respondWithFilteredResult(_0x8c7d31,_0x1041b8))[_0x52e1('0x2d')](handleError(_0x8c7d31,null));};exports[_0x52e1('0x115')]=function(_0xfb867e,_0x1b0bda,_0x5f595e){return db['ChatWebsite']['find']({'where':{'id':_0xfb867e[_0x52e1('0x5c')]['id']}})['then'](handleEntityNotFound(_0x1b0bda,null))['then'](function(_0x280306){if(_0x280306){return _0x280306['addAgents'](_0xfb867e['body'][_0x52e1('0x6c')],_[_0x52e1('0x10a')](_0xfb867e['body'],[_0x52e1('0x6c'),'id'])||{})[_0x52e1('0xbb')](function(_0x43b61b){for(var _0x24f296=0x0;_0x24f296<_0xfb867e[_0x52e1('0x5f')][_0x52e1('0x6c')][_0x52e1('0x4a')];_0x24f296+=0x1){socket[_0x52e1('0x116')](_0x52e1('0x117'),{'UserId':_0xfb867e['body'][_0x52e1('0x6c')][_0x24f296],'ChatWebsiteId':_0xfb867e['params']['id']});}return _0x43b61b;});}})[_0x52e1('0x24')](respondWithResult(_0x1b0bda,null))['catch'](handleError(_0x1b0bda,null));};exports[_0x52e1('0x118')]=function(_0x4cf56d,_0x24cc9d,_0x3d79e8){return db[_0x52e1('0x40')][_0x52e1('0x63')]({'where':{'id':_0x4cf56d[_0x52e1('0x5c')]['id']}})['then'](handleEntityNotFound(_0x24cc9d,null))[_0x52e1('0x24')](function(_0x3f0020){if(_0x3f0020){return _0x3f0020[_0x52e1('0x118')](_0x4cf56d[_0x52e1('0x46')][_0x52e1('0x6c')])[_0x52e1('0x24')](function(){if(_[_0x52e1('0x119')](_0x4cf56d[_0x52e1('0x46')][_0x52e1('0x6c')])){for(var _0x241c0f=0x0;_0x241c0f<_0x4cf56d[_0x52e1('0x46')][_0x52e1('0x6c')][_0x52e1('0x4a')];_0x241c0f+=0x1){socket[_0x52e1('0x116')]('userChatWebsite:remove',{'UserId':Number(_0x4cf56d[_0x52e1('0x46')][_0x52e1('0x6c')][_0x241c0f]),'ChatWebsiteId':Number(_0x4cf56d[_0x52e1('0x5c')]['id'])});}}else{socket[_0x52e1('0x116')](_0x52e1('0x11a'),{'UserId':Number(_0x4cf56d[_0x52e1('0x46')]['ids']),'ChatWebsiteId':Number(_0x4cf56d[_0x52e1('0x5c')]['id'])});}});}})['then'](respondWithStatusCode(_0x24cc9d,null))[_0x52e1('0x2d')](handleError(_0x24cc9d,null));};exports[_0x52e1('0x11b')]=function(_0x15569c,_0x43e99c,_0x46e444){var _0x164fa7={};var _0x81241e={};var _0x4ad632;var _0xd00c09;return db['ChatWebsite'][_0x52e1('0x6a')]({'where':{'id':_0x15569c[_0x52e1('0x5c')]['id']}})['then'](handleEntityNotFound(_0x43e99c,null))[_0x52e1('0x24')](function(_0x2c3c9f){if(_0x2c3c9f){_0x4ad632=_0x2c3c9f;_0x81241e['model']=_[_0x52e1('0x45')](db[_0x52e1('0xc5')]['rawAttributes']);_0x81241e[_0x52e1('0x46')]=_[_0x52e1('0x45')](_0x15569c[_0x52e1('0x46')]);_0x81241e[_0x52e1('0x47')]=_[_0x52e1('0x48')](_0x81241e[_0x52e1('0x44')],_0x81241e['query']);_0x164fa7[_0x52e1('0x49')]=_[_0x52e1('0x48')](_0x81241e[_0x52e1('0x44')],qs[_0x52e1('0x5d')](_0x15569c[_0x52e1('0x46')][_0x52e1('0x5d')]));_0x164fa7[_0x52e1('0x49')]=_0x164fa7['attributes']['length']?_0x164fa7[_0x52e1('0x49')]:_0x81241e[_0x52e1('0x44')];_0x164fa7[_0x52e1('0x4e')]=qs[_0x52e1('0x4f')](_0x15569c[_0x52e1('0x46')][_0x52e1('0x4f')]);_0x164fa7['where']=qs[_0x52e1('0x47')](_['pick'](_0x15569c[_0x52e1('0x46')],_0x81241e['filters']));if(_0x15569c['query'][_0x52e1('0x52')]){_0x164fa7['where']=_[_0x52e1('0x53')](_0x164fa7['where'],{'$or':_['map'](_0x164fa7[_0x52e1('0x49')],function(_0x48d590){var _0x87726f={};_0x87726f[_0x48d590]={'$like':'%'+_0x15569c[_0x52e1('0x46')][_0x52e1('0x52')]+'%'};return _0x87726f;})});}_0x164fa7=_[_0x52e1('0x53')]({},_0x164fa7,_0x15569c[_0x52e1('0x55')]);return _0x4ad632[_0x52e1('0x11b')](_0x164fa7);}})[_0x52e1('0x24')](function(_0x3443fc){if(_0x3443fc){_0xd00c09=_0x3443fc[_0x52e1('0x4a')];if(!_0x15569c[_0x52e1('0x46')][_0x52e1('0x4b')](_0x52e1('0x4c'))){_0x164fa7[_0x52e1('0x4d')]=qs[_0x52e1('0x4d')](_0x15569c[_0x52e1('0x46')]['limit']);_0x164fa7['offset']=qs[_0x52e1('0x32')](_0x15569c[_0x52e1('0x46')][_0x52e1('0x32')]);}return _0x4ad632['getAgents'](_0x164fa7);}})['then'](function(_0x3f8ff6){if(_0x3f8ff6){return _0x3f8ff6?{'count':_0xd00c09,'rows':_0x3f8ff6}:null;}})[_0x52e1('0x24')](respondWithResult(_0x43e99c,null))[_0x52e1('0x2d')](handleError(_0x43e99c,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index ca5050b..72a29e5 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 _0x7024=['exports','events','ChatWebsite','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0xf55e73,_0x3fecc5){var _0x116b99=function(_0x314e0c){while(--_0x314e0c){_0xf55e73['push'](_0xf55e73['shift']());}};_0x116b99(++_0x3fecc5);}(_0x7024,0xa1));var _0x4702=function(_0x51d953,_0x11a23b){_0x51d953=_0x51d953-0x0;var _0x5080c5=_0x7024[_0x51d953];return _0x5080c5;};'use strict';var EventEmitter=require(_0x4702('0x0'));var ChatWebsite=require('../../mysqldb')['db'][_0x4702('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x4702('0x2')](0x0);var events={'afterCreate':_0x4702('0x3'),'afterUpdate':_0x4702('0x4'),'afterDestroy':_0x4702('0x5')};function emitEvent(_0x514e34){return function(_0x144426,_0x5902f0,_0x446766){ChatWebsiteEvents[_0x4702('0x6')](_0x514e34+':'+_0x144426['id'],_0x144426);ChatWebsiteEvents['emit'](_0x514e34,_0x144426);_0x446766(null);};}for(var e in events){if(events[_0x4702('0x7')](e)){var event=events[e];ChatWebsite[_0x4702('0x8')](e,emitEvent(event));}}module[_0x4702('0x9')]=ChatWebsiteEvents; \ No newline at end of file +var _0x34e8=['emit','hasOwnProperty','exports','events','../../mysqldb','ChatWebsite','setMaxListeners','update','remove'];(function(_0x2cf2e9,_0xd58ea1){var _0xd3670d=function(_0x272868){while(--_0x272868){_0x2cf2e9['push'](_0x2cf2e9['shift']());}};_0xd3670d(++_0xd58ea1);}(_0x34e8,0x12c));var _0x834e=function(_0x4f40f4,_0x4b6c1b){_0x4f40f4=_0x4f40f4-0x0;var _0x1bdd3b=_0x34e8[_0x4f40f4];return _0x1bdd3b;};'use strict';var EventEmitter=require(_0x834e('0x0'));var ChatWebsite=require(_0x834e('0x1'))['db'][_0x834e('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x834e('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x834e('0x4'),'afterDestroy':_0x834e('0x5')};function emitEvent(_0x472111){return function(_0x31bf20,_0x289ef2,_0x19a3e0){ChatWebsiteEvents[_0x834e('0x6')](_0x472111+':'+_0x31bf20['id'],_0x31bf20);ChatWebsiteEvents['emit'](_0x472111,_0x31bf20);_0x19a3e0(null);};}for(var e in events){if(events[_0x834e('0x7')](e)){var event=events[e];ChatWebsite['hook'](e,emitEvent(event));}}module[_0x834e('0x8')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index 2cba48d..33f61f0 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 _0xc2da=['exports','define','ChatWebsite','chat_websites','lodash','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./chatWebsite.attributes'];(function(_0x29ab70,_0x10a26f){var _0x3cab86=function(_0x34ecf6){while(--_0x34ecf6){_0x29ab70['push'](_0x29ab70['shift']());}};_0x3cab86(++_0x10a26f);}(_0xc2da,0x124));var _0xac2d=function(_0x4884a7,_0x18e38a){_0x4884a7=_0x4884a7-0x0;var _0x56b60e=_0xc2da[_0x4884a7];return _0x56b60e;};'use strict';var _=require(_0xac2d('0x0'));var util=require('util');var logger=require(_0xac2d('0x1'))('api');var moment=require(_0xac2d('0x2'));var BPromise=require('bluebird');var rp=require(_0xac2d('0x3'));var fs=require('fs');var path=require(_0xac2d('0x4'));var rimraf=require(_0xac2d('0x5'));var config=require(_0xac2d('0x6'));var attributes=require(_0xac2d('0x7'));module[_0xac2d('0x8')]=function(_0x3db400,_0x133e22){return _0x3db400[_0xac2d('0x9')](_0xac2d('0xa'),attributes,{'tableName':_0xac2d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe130=['api','moment','bluebird','request-promise','path','../../config/environment','./chatWebsite.attributes','exports','define','lodash','util'];(function(_0x5a744a,_0x5926b6){var _0x6c1c29=function(_0x418810){while(--_0x418810){_0x5a744a['push'](_0x5a744a['shift']());}};_0x6c1c29(++_0x5926b6);}(_0xe130,0x127));var _0x0e13=function(_0xbe2b97,_0x303060){_0xbe2b97=_0xbe2b97-0x0;var _0x228f32=_0xe130[_0xbe2b97];return _0x228f32;};'use strict';var _=require(_0x0e13('0x0'));var util=require(_0x0e13('0x1'));var logger=require('../../config/logger')(_0x0e13('0x2'));var moment=require(_0x0e13('0x3'));var BPromise=require(_0x0e13('0x4'));var rp=require(_0x0e13('0x5'));var fs=require('fs');var path=require(_0x0e13('0x6'));var rimraf=require('rimraf');var config=require(_0x0e13('0x7'));var attributes=require(_0x0e13('0x8'));module[_0x0e13('0x9')]=function(_0xcd92e,_0x50a80e){return _0xcd92e[_0x0e13('0xa')]('ChatWebsite',attributes,{'tableName':'chat_websites','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.rpc.js b/server/api/chatWebsite/chatWebsite.rpc.js index a8d99b8..26c2a28 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 _0xf61e=['info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','register','request','then'];(function(_0x28a26e,_0xf2632d){var _0x581f16=function(_0x331f45){while(--_0x331f45){_0x28a26e['push'](_0x28a26e['shift']());}};_0x581f16(++_0xf2632d);}(_0xf61e,0x191));var _0xef61=function(_0x1e1c0f,_0x3acd26){_0x1e1c0f=_0x1e1c0f-0x0;var _0x335e64=_0xf61e[_0x1e1c0f];return _0x335e64;};'use strict';var _=require(_0xef61('0x0'));var util=require(_0xef61('0x1'));var moment=require(_0xef61('0x2'));var BPromise=require(_0xef61('0x3'));var rs=require(_0xef61('0x4'));var fs=require('fs');var Redis=require(_0xef61('0x5'));var db=require(_0xef61('0x6'))['db'];var utils=require(_0xef61('0x7'));var logger=require(_0xef61('0x8'))(_0xef61('0x9'));var config=require(_0xef61('0xa'));var jayson=require(_0xef61('0xb'));var client=jayson['client'][_0xef61('0xc')]({'port':0x232a});config[_0xef61('0xd')]=_['defaults'](config[_0xef61('0xd')],{'host':_0xef61('0xe'),'port':0x18eb});var socket=require(_0xef61('0xf'))(new Redis(config['redis']));require('./chatWebsite.socket')[_0xef61('0x10')](socket);function respondWithRpcPromise(_0x2e28c7,_0x1ab79d,_0x11181b){return new BPromise(function(_0x2af74c,_0xdcd707){return client[_0xef61('0x11')](_0x2e28c7,_0x11181b)[_0xef61('0x12')](function(_0x237f43){logger[_0xef61('0x13')](_0xef61('0x14'),_0x1ab79d,_0xef61('0x15'));logger[_0xef61('0x16')](_0xef61('0x17'),_0x1ab79d,'request\x20sent',JSON[_0xef61('0x18')](_0x237f43));if(_0x237f43['error']){if(_0x237f43[_0xef61('0x19')][_0xef61('0x1a')]===0x1f4){logger[_0xef61('0x19')](_0xef61('0x14'),_0x1ab79d,_0x237f43['error'][_0xef61('0x1b')]);return _0xdcd707(_0x237f43[_0xef61('0x19')][_0xef61('0x1b')]);}logger[_0xef61('0x19')]('ChatWebsite,\x20%s,\x20%s',_0x1ab79d,_0x237f43[_0xef61('0x19')][_0xef61('0x1b')]);return _0x2af74c(_0x237f43['error'][_0xef61('0x1b')]);}else{logger[_0xef61('0x13')](_0xef61('0x14'),_0x1ab79d,_0xef61('0x15'));_0x2af74c(_0x237f43[_0xef61('0x1c')][_0xef61('0x1b')]);}})[_0xef61('0x1d')](function(_0x55f887){logger[_0xef61('0x19')](_0xef61('0x14'),_0x1ab79d,_0x55f887);_0xdcd707(_0x55f887);});});} \ No newline at end of file +var _0xadb5=['code','message','info','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','request','then','ChatWebsite,\x20%s,\x20%s','debug','request\x20sent','stringify','error'];(function(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0xadb5,0xad));var _0x5adb=function(_0xfaf960,_0x54666d){_0xfaf960=_0xfaf960-0x0;var _0x2d2ef1=_0xadb5[_0xfaf960];return _0x2d2ef1;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});config[_0x5adb('0xa')]=_[_0x5adb('0xb')](config[_0x5adb('0xa')],{'host':_0x5adb('0xc'),'port':0x18eb});var socket=require(_0x5adb('0xd'))(new Redis(config[_0x5adb('0xa')]));require(_0x5adb('0xe'))[_0x5adb('0xf')](socket);function respondWithRpcPromise(_0x336bad,_0x129f5a,_0x275428){return new BPromise(function(_0x563d86,_0x4c268d){return client[_0x5adb('0x10')](_0x336bad,_0x275428)[_0x5adb('0x11')](function(_0x82e67e){logger['info'](_0x5adb('0x12'),_0x129f5a,'request\x20sent');logger[_0x5adb('0x13')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x129f5a,_0x5adb('0x14'),JSON[_0x5adb('0x15')](_0x82e67e));if(_0x82e67e[_0x5adb('0x16')]){if(_0x82e67e['error'][_0x5adb('0x17')]===0x1f4){logger[_0x5adb('0x16')](_0x5adb('0x12'),_0x129f5a,_0x82e67e['error'][_0x5adb('0x18')]);return _0x4c268d(_0x82e67e['error'][_0x5adb('0x18')]);}logger[_0x5adb('0x16')](_0x5adb('0x12'),_0x129f5a,_0x82e67e[_0x5adb('0x16')][_0x5adb('0x18')]);return _0x563d86(_0x82e67e[_0x5adb('0x16')][_0x5adb('0x18')]);}else{logger[_0x5adb('0x19')](_0x5adb('0x12'),_0x129f5a,'request\x20sent');_0x563d86(_0x82e67e[_0x5adb('0x1a')]['message']);}})[_0x5adb('0x1b')](function(_0x558f76){logger[_0x5adb('0x16')]('ChatWebsite,\x20%s,\x20%s',_0x129f5a,_0x558f76);_0x4c268d(_0x558f76);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 4943727..7823d04 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(_0x216e72,_0x5cd161){var _0x2ff28d=function(_0x29a533){while(--_0x29a533){_0x216e72['push'](_0x216e72['shift']());}};_0x2ff28d(++_0x5cd161);}(_0x5f2f,0x73));var _0xf5f2=function(_0x1030c1,_0x325080){_0x1030c1=_0x1030c1-0x0;var _0xf6ae57=_0x5f2f[_0x1030c1];return _0xf6ae57;};'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(_0x1e0f42,_0x2567e5){var _0x4e9c54=function(_0x519f2d){while(--_0x519f2d){_0x1e0f42['push'](_0x1e0f42['shift']());}};_0x4e9c54(++_0x2567e5);}(_0xb10b,0x12a));var _0xbb10=function(_0x1b046f,_0x8e5fa6){_0x1b046f=_0x1b046f-0x0;var _0x1f6c8f=_0xb10b[_0x1b046f];return _0x1f6c8f;};'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 3a20db3..b36a953 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 _0xb36e=['/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','/:id/applications','getApplications','getProactiveActions','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','diskStorage','server/files/images/logos/','addLogo','join','server/files/images/avatars/','format','%s-%s','now','originalname','single','file','addAvatar','root','addCustomerAvatar','addSystemAvatar','/:id/notify','notify','/:id/offline','offline','addInteraction','addApplications','/:id/proactive_actions','addProactiveActions','addAgents','put','/:id','update','destroy','delete','removeDispositions','removeAgents','multer','util','path','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getAnswers','/:id/logo','getLogo'];(function(_0x5e030c,_0x231dda){var _0x1767a1=function(_0x12c75b){while(--_0x12c75b){_0x5e030c['push'](_0x5e030c['shift']());}};_0x1767a1(++_0x231dda);}(_0xb36e,0x140));var _0xeb36=function(_0x855f7f,_0x3cb7d5){_0x855f7f=_0x855f7f-0x0;var _0x23acc=_0xb36e[_0x855f7f];return _0x23acc;};'use strict';var multer=require(_0xeb36('0x0'));var util=require(_0xeb36('0x1'));var path=require(_0xeb36('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xeb36('0x3'));var config=require(_0xeb36('0x4'));var controller=require('./chatWebsite.controller');router[_0xeb36('0x5')]('/',auth[_0xeb36('0x6')](),controller[_0xeb36('0x7')]);router[_0xeb36('0x5')](_0xeb36('0x8'),auth['isAuthenticated'](),controller[_0xeb36('0x9')]);router[_0xeb36('0x5')]('/:id',auth[_0xeb36('0x6')](),controller[_0xeb36('0xa')]);router[_0xeb36('0x5')](_0xeb36('0xb'),auth[_0xeb36('0x6')](),controller['getDispositions']);router[_0xeb36('0x5')]('/:id/canned_answers',auth[_0xeb36('0x6')](),controller[_0xeb36('0xc')]);router[_0xeb36('0x5')](_0xeb36('0xd'),controller[_0xeb36('0xe')]);router[_0xeb36('0x5')](_0xeb36('0xf'),controller[_0xeb36('0x10')]);router[_0xeb36('0x5')](_0xeb36('0x11'),controller[_0xeb36('0x12')]);router[_0xeb36('0x5')](_0xeb36('0x13'),controller['getSystemAvatar']);router[_0xeb36('0x5')](_0xeb36('0x14'),auth[_0xeb36('0x6')](),controller[_0xeb36('0x15')]);router[_0xeb36('0x5')](_0xeb36('0x16'),controller[_0xeb36('0x17')]);router[_0xeb36('0x5')](_0xeb36('0x18'),auth[_0xeb36('0x6')](),controller[_0xeb36('0x19')]);router['get']('/:id/proactive_actions',auth['isAuthenticated'](),controller[_0xeb36('0x1a')]);router[_0xeb36('0x5')]('/:id/fields',controller[_0xeb36('0x1b')]);router[_0xeb36('0x5')](_0xeb36('0x1c'),auth[_0xeb36('0x6')](),controller[_0xeb36('0x1d')]);router[_0xeb36('0x5')](_0xeb36('0x1e'),auth[_0xeb36('0x6')](),controller[_0xeb36('0x1f')]);router[_0xeb36('0x20')]('/',auth[_0xeb36('0x6')](),controller['create']);router[_0xeb36('0x20')](_0xeb36('0xb'),auth['isAuthenticated'](),controller[_0xeb36('0x21')]);router[_0xeb36('0x20')](_0xeb36('0x22'),auth[_0xeb36('0x6')](),controller[_0xeb36('0x23')]);var upload=multer({'storage':multer[_0xeb36('0x24')]({'destination':function(_0xa73595,_0x2f7687,_0x529023){_0x529023(null,path['join'](config['root'],_0xeb36('0x25')));},'filename':function(_0x3d70d7,_0x26b708,_0x4c2503){_0x4c2503(null,util['format']('%s-%s',Date['now'](),_0x26b708['originalname']));}})});router[_0xeb36('0x20')](_0xeb36('0xd'),upload['single']('file'),controller[_0xeb36('0x26')]);var upload=multer({'storage':multer[_0xeb36('0x24')]({'destination':function(_0x11072b,_0x4bb24a,_0x49362d){_0x49362d(null,path[_0xeb36('0x27')](config['root'],_0xeb36('0x28')));},'filename':function(_0x5d3715,_0x41e2ee,_0x1e45f6){_0x1e45f6(null,util[_0xeb36('0x29')](_0xeb36('0x2a'),Date[_0xeb36('0x2b')](),_0x41e2ee[_0xeb36('0x2c')]));}})});router[_0xeb36('0x20')](_0xeb36('0xf'),upload[_0xeb36('0x2d')](_0xeb36('0x2e')),controller[_0xeb36('0x2f')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x14e7ea,_0x5a4320,_0x426c53){_0x426c53(null,path[_0xeb36('0x27')](config[_0xeb36('0x30')],'server/files/images/avatars/'));},'filename':function(_0x38a516,_0x917a72,_0x1da280){_0x1da280(null,util[_0xeb36('0x29')](_0xeb36('0x2a'),Date[_0xeb36('0x2b')](),_0x917a72['originalname']));}})});router[_0xeb36('0x20')](_0xeb36('0x11'),upload[_0xeb36('0x2d')](_0xeb36('0x2e')),controller[_0xeb36('0x31')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3b279f,_0x4ecb19,_0x52152d){_0x52152d(null,path['join'](config['root'],_0xeb36('0x28')));},'filename':function(_0x3fb3ec,_0x2dbe3c,_0x70c420){_0x70c420(null,util['format']('%s-%s',Date[_0xeb36('0x2b')](),_0x2dbe3c[_0xeb36('0x2c')]));}})});router[_0xeb36('0x20')](_0xeb36('0x13'),upload[_0xeb36('0x2d')](_0xeb36('0x2e')),controller[_0xeb36('0x32')]);router[_0xeb36('0x20')](_0xeb36('0x33'),controller[_0xeb36('0x34')]);router[_0xeb36('0x20')](_0xeb36('0x35'),controller[_0xeb36('0x36')]);router[_0xeb36('0x20')](_0xeb36('0x14'),auth[_0xeb36('0x6')](),controller[_0xeb36('0x37')]);router[_0xeb36('0x20')](_0xeb36('0x18'),auth[_0xeb36('0x6')](),controller[_0xeb36('0x38')]);router[_0xeb36('0x20')](_0xeb36('0x39'),auth[_0xeb36('0x6')](),controller[_0xeb36('0x3a')]);router['post'](_0xeb36('0x1e'),auth[_0xeb36('0x6')](),controller[_0xeb36('0x3b')]);router[_0xeb36('0x3c')](_0xeb36('0x3d'),auth[_0xeb36('0x6')](),controller[_0xeb36('0x3e')]);router['delete'](_0xeb36('0x3d'),auth[_0xeb36('0x6')](),controller[_0xeb36('0x3f')]);router[_0xeb36('0x40')](_0xeb36('0xb'),auth[_0xeb36('0x6')](),controller[_0xeb36('0x41')]);router[_0xeb36('0x40')](_0xeb36('0x22'),auth[_0xeb36('0x6')](),controller['removeAnswers']);router['delete'](_0xeb36('0x1e'),auth[_0xeb36('0x6')](),controller[_0xeb36('0x42')]);module['exports']=router; \ No newline at end of file +var _0x3a21=['getSnippet','/:id/applications','getApplications','/:id/fields','getOfflineMessages','getAgents','post','addDisposition','/:id/canned_answers','diskStorage','join','root','server/files/images/logos/','format','%s-%s','now','originalname','single','file','addLogo','addAvatar','server/files/images/avatars/','addSystemAvatar','/:id/notify','notify','/:id/offline','offline','addInteraction','addApplications','addProactiveActions','/:id/users','addAgents','put','delete','destroy','/:id/dispositions','removeAgents','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','index','isAuthenticated','describe','/:id','getDispositions','getAnswers','/:id/logo','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','/:id/system_avatar','/:id/interactions'];(function(_0x44e535,_0x2e4be6){var _0x3b46eb=function(_0x41a089){while(--_0x41a089){_0x44e535['push'](_0x44e535['shift']());}};_0x3b46eb(++_0x2e4be6);}(_0x3a21,0x18d));var _0x13a2=function(_0xc026a1,_0x1d8173){_0xc026a1=_0xc026a1-0x0;var _0x235ad0=_0x3a21[_0xc026a1];return _0x235ad0;};'use strict';var multer=require(_0x13a2('0x0'));var util=require(_0x13a2('0x1'));var path=require(_0x13a2('0x2'));var timeout=require(_0x13a2('0x3'));var express=require('express');var router=express[_0x13a2('0x4')]();var auth=require(_0x13a2('0x5'));var interaction=require(_0x13a2('0x6'));var config=require(_0x13a2('0x7'));var controller=require(_0x13a2('0x8'));router[_0x13a2('0x9')]('/',auth['isAuthenticated'](),controller[_0x13a2('0xa')]);router[_0x13a2('0x9')]('/describe',auth[_0x13a2('0xb')](),controller[_0x13a2('0xc')]);router[_0x13a2('0x9')](_0x13a2('0xd'),auth['isAuthenticated'](),controller['show']);router['get']('/:id/dispositions',auth[_0x13a2('0xb')](),controller[_0x13a2('0xe')]);router['get']('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x13a2('0xf')]);router['get'](_0x13a2('0x10'),controller[_0x13a2('0x11')]);router['get'](_0x13a2('0x12'),controller[_0x13a2('0x13')]);router[_0x13a2('0x9')](_0x13a2('0x14'),controller['getCustomerAvatar']);router[_0x13a2('0x9')](_0x13a2('0x15'),controller['getSystemAvatar']);router[_0x13a2('0x9')](_0x13a2('0x16'),auth['isAuthenticated'](),controller['getInteractions']);router[_0x13a2('0x9')]('/:id/snippet',controller[_0x13a2('0x17')]);router['get'](_0x13a2('0x18'),auth[_0x13a2('0xb')](),controller[_0x13a2('0x19')]);router['get']('/:id/proactive_actions',auth[_0x13a2('0xb')](),controller['getProactiveActions']);router[_0x13a2('0x9')](_0x13a2('0x1a'),controller['getFields']);router[_0x13a2('0x9')]('/:id/offline_messages',auth[_0x13a2('0xb')](),controller[_0x13a2('0x1b')]);router[_0x13a2('0x9')]('/:id/users',auth[_0x13a2('0xb')](),controller[_0x13a2('0x1c')]);router[_0x13a2('0x1d')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/dispositions',auth[_0x13a2('0xb')](),controller[_0x13a2('0x1e')]);router[_0x13a2('0x1d')](_0x13a2('0x1f'),auth[_0x13a2('0xb')](),controller['addAnswer']);var upload=multer({'storage':multer[_0x13a2('0x20')]({'destination':function(_0x4572a6,_0xba9d37,_0x277b31){_0x277b31(null,path[_0x13a2('0x21')](config[_0x13a2('0x22')],_0x13a2('0x23')));},'filename':function(_0x58e59b,_0x17e81f,_0x5c0883){_0x5c0883(null,util[_0x13a2('0x24')](_0x13a2('0x25'),Date[_0x13a2('0x26')](),_0x17e81f[_0x13a2('0x27')]));}})});router['post'](_0x13a2('0x10'),upload[_0x13a2('0x28')](_0x13a2('0x29')),controller[_0x13a2('0x2a')]);var upload=multer({'storage':multer[_0x13a2('0x20')]({'destination':function(_0x25b256,_0x74f026,_0xdfb697){_0xdfb697(null,path[_0x13a2('0x21')](config[_0x13a2('0x22')],'server/files/images/avatars/'));},'filename':function(_0x6bef75,_0x5a9022,_0x1995ec){_0x1995ec(null,util[_0x13a2('0x24')]('%s-%s',Date[_0x13a2('0x26')](),_0x5a9022[_0x13a2('0x27')]));}})});router[_0x13a2('0x1d')](_0x13a2('0x12'),upload[_0x13a2('0x28')]('file'),controller[_0x13a2('0x2b')]);var upload=multer({'storage':multer[_0x13a2('0x20')]({'destination':function(_0x402bcc,_0x3b234a,_0x14fd8c){_0x14fd8c(null,path[_0x13a2('0x21')](config[_0x13a2('0x22')],_0x13a2('0x2c')));},'filename':function(_0x64fd12,_0x5469c3,_0x3d92cc){_0x3d92cc(null,util[_0x13a2('0x24')](_0x13a2('0x25'),Date['now'](),_0x5469c3[_0x13a2('0x27')]));}})});router[_0x13a2('0x1d')](_0x13a2('0x14'),upload[_0x13a2('0x28')](_0x13a2('0x29')),controller['addCustomerAvatar']);var upload=multer({'storage':multer[_0x13a2('0x20')]({'destination':function(_0x58f4a5,_0x7dff3b,_0x409ee5){_0x409ee5(null,path[_0x13a2('0x21')](config[_0x13a2('0x22')],_0x13a2('0x2c')));},'filename':function(_0x1dc9bf,_0x4a6e40,_0x2bafad){_0x2bafad(null,util[_0x13a2('0x24')](_0x13a2('0x25'),Date[_0x13a2('0x26')](),_0x4a6e40[_0x13a2('0x27')]));}})});router[_0x13a2('0x1d')](_0x13a2('0x15'),upload[_0x13a2('0x28')]('file'),controller[_0x13a2('0x2d')]);router[_0x13a2('0x1d')](_0x13a2('0x2e'),controller[_0x13a2('0x2f')]);router['post'](_0x13a2('0x30'),controller[_0x13a2('0x31')]);router[_0x13a2('0x1d')]('/:id/interactions',auth['isAuthenticated'](),controller[_0x13a2('0x32')]);router['post'](_0x13a2('0x18'),auth[_0x13a2('0xb')](),controller[_0x13a2('0x33')]);router[_0x13a2('0x1d')]('/:id/proactive_actions',auth[_0x13a2('0xb')](),controller[_0x13a2('0x34')]);router[_0x13a2('0x1d')](_0x13a2('0x35'),auth[_0x13a2('0xb')](),controller[_0x13a2('0x36')]);router[_0x13a2('0x37')]('/:id',auth[_0x13a2('0xb')](),controller['update']);router[_0x13a2('0x38')](_0x13a2('0xd'),auth[_0x13a2('0xb')](),controller[_0x13a2('0x39')]);router[_0x13a2('0x38')](_0x13a2('0x3a'),auth['isAuthenticated'](),controller['removeDispositions']);router[_0x13a2('0x38')]('/:id/canned_answers',auth[_0x13a2('0xb')](),controller['removeAnswers']);router[_0x13a2('0x38')](_0x13a2('0x35'),auth[_0x13a2('0xb')](),controller[_0x13a2('0x3b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index cfbf6e8..ecde811 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 _0xcb41=['exports','STRING','ENUM','Google','sequelize'];(function(_0x212a37,_0xf35b2e){var _0x5d0bf9=function(_0x51850f){while(--_0x51850f){_0x212a37['push'](_0x212a37['shift']());}};_0x5d0bf9(++_0xf35b2e);}(_0xcb41,0x1df));var _0x1cb4=function(_0x3ef3c2,_0x2206c1){_0x3ef3c2=_0x3ef3c2-0x0;var _0x47c700=_0xcb41[_0x3ef3c2];return _0x47c700;};'use strict';var Sequelize=require(_0x1cb4('0x0'));module[_0x1cb4('0x1')]={'name':{'type':Sequelize[_0x1cb4('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x1cb4('0x3')]('AmazonAWS',_0x1cb4('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0x1cb4('0x2')]}}; \ No newline at end of file +var _0xea1c=['ENUM','AmazonAWS','Google','STRING'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xea1c,0x117));var _0xcea1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xea1c[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xcea1('0x0')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xcea1('0x1')](_0xcea1('0x2'),_0xcea1('0x3')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0xcea1('0x0')]}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index a507dd4..00829b5 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 _0x41a4=['ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','count','offset','limit','set','Content-Range','json','apply','save','update','then','stack','name','send','index','CloudProvider','rawAttributes','fieldName','model','map','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','keys','length','find','create','body','catch','params','destroy','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox'];(function(_0x5a516a,_0x541200){var _0x38c0d9=function(_0x4d2d8f){while(--_0x4d2d8f){_0x5a516a['push'](_0x5a516a['shift']());}};_0x38c0d9(++_0x541200);}(_0x41a4,0x163));var _0x441a=function(_0x152374,_0x15c2a1){_0x152374=_0x152374-0x0;var _0x5c7f33=_0x41a4[_0x152374];return _0x5c7f33;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x441a('0x0'));var zipdir=require(_0x441a('0x1'));var jsonpatch=require(_0x441a('0x2'));var rp=require(_0x441a('0x3'));var moment=require(_0x441a('0x4'));var BPromise=require(_0x441a('0x5'));var Mustache=require(_0x441a('0x6'));var util=require(_0x441a('0x7'));var path=require(_0x441a('0x8'));var sox=require(_0x441a('0x9'));var csv=require('to-csv');var ejs=require(_0x441a('0xa'));var fs=require('fs');var _=require(_0x441a('0xb'));var squel=require(_0x441a('0xc'));var crypto=require('crypto');var jsforce=require(_0x441a('0xd'));var deskjs=require(_0x441a('0xe'));var toCsv=require(_0x441a('0xf'));var querystring=require(_0x441a('0x10'));var Papa=require(_0x441a('0x11'));var Redis=require(_0x441a('0x12'));var authService=require(_0x441a('0x13'));var qs=require(_0x441a('0x14'));var as=require(_0x441a('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x441a('0x16'))(_0x441a('0x17'));var utils=require(_0x441a('0x18'));var config=require(_0x441a('0x19'));var db=require(_0x441a('0x1a'))['db'];function respondWithStatusCode(_0x186520,_0x47aaa4){_0x47aaa4=_0x47aaa4||0xcc;return function(_0x228883){if(_0x228883){return _0x186520[_0x441a('0x1b')](_0x47aaa4);}return _0x186520['status'](_0x47aaa4)[_0x441a('0x1c')]();};}function respondWithResult(_0x461dfc,_0x27d2ab){_0x27d2ab=_0x27d2ab||0xc8;return function(_0x407b27){if(_0x407b27){return _0x461dfc[_0x441a('0x1d')](_0x27d2ab)['json'](_0x407b27);}};}function respondWithFilteredResult(_0x2a0907,_0x37b9e9){return function(_0x545bba){if(_0x545bba){var _0x589f69=_0x545bba[_0x441a('0x1e')],_0x4e33a7=_0x37b9e9[_0x441a('0x1f')],_0x413079=_0x37b9e9[_0x441a('0x1f')]+_0x37b9e9[_0x441a('0x20')],_0x1f90f0;if(_0x413079>=_0x589f69){_0x413079=_0x589f69;_0x1f90f0=0xc8;}else{_0x1f90f0=0xce;}_0x2a0907[_0x441a('0x1d')](_0x1f90f0);return _0x2a0907[_0x441a('0x21')](_0x441a('0x22'),_0x4e33a7+'-'+_0x413079+'/'+_0x589f69)[_0x441a('0x23')](_0x545bba);}return null;};}function patchUpdates(_0x48af97){return function(_0x5986ad){try{jsonpatch[_0x441a('0x24')](_0x5986ad,_0x48af97,!![]);}catch(_0x4c2844){return BPromise['reject'](_0x4c2844);}return _0x5986ad[_0x441a('0x25')]();};}function saveUpdates(_0x58d6c0,_0x4d4277){return function(_0x28c1f4){if(_0x28c1f4){return _0x28c1f4[_0x441a('0x26')](_0x58d6c0)[_0x441a('0x27')](function(_0xe6e63f){return _0xe6e63f;});}return null;};}function removeEntity(_0xecef66,_0x570155){return function(_0x30e3e9){if(_0x30e3e9){return _0x30e3e9['destroy']()[_0x441a('0x27')](function(){_0xecef66[_0x441a('0x1d')](0xcc)[_0x441a('0x1c')]();});}};}function handleEntityNotFound(_0x3a7ae3,_0x49ffd3){return function(_0x58604c){if(!_0x58604c){_0x3a7ae3[_0x441a('0x1b')](0x194);}return _0x58604c;};}function handleError(_0x4e8466,_0x467390){_0x467390=_0x467390||0x1f4;return function(_0x2a3c35){logger['error'](_0x2a3c35[_0x441a('0x28')]);if(_0x2a3c35[_0x441a('0x29')]){delete _0x2a3c35[_0x441a('0x29')];}_0x4e8466[_0x441a('0x1d')](_0x467390)[_0x441a('0x2a')](_0x2a3c35);};}exports[_0x441a('0x2b')]=function(_0x5c0f38,_0x32506d){var _0x364851={},_0x51bf89={},_0x3bf355={'count':0x0,'rows':[]};var _0x4cd46d=_['map'](db[_0x441a('0x2c')][_0x441a('0x2d')],function(_0x502134){return{'name':_0x502134[_0x441a('0x2e')],'type':_0x502134['type']['key']};});_0x51bf89[_0x441a('0x2f')]=_[_0x441a('0x30')](_0x4cd46d,_0x441a('0x29'));_0x51bf89[_0x441a('0x31')]=_['keys'](_0x5c0f38[_0x441a('0x31')]);_0x51bf89[_0x441a('0x32')]=_['intersection'](_0x51bf89[_0x441a('0x2f')],_0x51bf89[_0x441a('0x31')]);_0x364851[_0x441a('0x33')]=_[_0x441a('0x34')](_0x51bf89[_0x441a('0x2f')],qs['fields'](_0x5c0f38[_0x441a('0x31')][_0x441a('0x35')]));_0x364851[_0x441a('0x33')]=_0x364851[_0x441a('0x33')]['length']?_0x364851[_0x441a('0x33')]:_0x51bf89[_0x441a('0x2f')];if(!_0x5c0f38[_0x441a('0x31')][_0x441a('0x36')](_0x441a('0x37'))){_0x364851[_0x441a('0x20')]=qs['limit'](_0x5c0f38[_0x441a('0x31')][_0x441a('0x20')]);_0x364851[_0x441a('0x1f')]=qs['offset'](_0x5c0f38['query'][_0x441a('0x1f')]);}_0x364851['order']=qs['sort'](_0x5c0f38['query'][_0x441a('0x38')]);_0x364851[_0x441a('0x39')]=qs['filters'](_[_0x441a('0x3a')](_0x5c0f38[_0x441a('0x31')],_0x51bf89[_0x441a('0x32')]),_0x4cd46d);if(_0x5c0f38['query'][_0x441a('0x3b')]){_0x364851[_0x441a('0x39')]=_[_0x441a('0x3c')](_0x364851[_0x441a('0x39')],{'$or':_[_0x441a('0x30')](_0x4cd46d,function(_0x3f1068){if(_0x3f1068[_0x441a('0x3d')]!==_0x441a('0x3e')){var _0x5353ce={};_0x5353ce[_0x3f1068[_0x441a('0x29')]]={'$like':'%'+_0x5c0f38[_0x441a('0x31')][_0x441a('0x3b')]+'%'};return _0x5353ce;}})});}_0x364851=_['merge']({},_0x364851,_0x5c0f38['options']);var _0x5d4182={'where':_0x364851[_0x441a('0x39')]};return db[_0x441a('0x2c')][_0x441a('0x1e')](_0x5d4182)[_0x441a('0x27')](function(_0x25de97){_0x3bf355[_0x441a('0x1e')]=_0x25de97;if(_0x5c0f38[_0x441a('0x31')][_0x441a('0x3f')]){_0x364851[_0x441a('0x40')]=[{'all':!![]}];}return db[_0x441a('0x2c')]['findAll'](_0x364851);})[_0x441a('0x27')](function(_0x564f02){_0x3bf355['rows']=_0x564f02;return _0x3bf355;})[_0x441a('0x27')](respondWithFilteredResult(_0x32506d,_0x364851))['catch'](handleError(_0x32506d,null));};exports['show']=function(_0x31ed9d,_0x17b249){var _0xa70639={'raw':!![],'where':{'id':_0x31ed9d['params']['id']}},_0x4491d9={};_0x4491d9[_0x441a('0x2f')]=_[_0x441a('0x41')](db[_0x441a('0x2c')]['rawAttributes']);_0x4491d9[_0x441a('0x31')]=_[_0x441a('0x41')](_0x31ed9d[_0x441a('0x31')]);_0x4491d9[_0x441a('0x32')]=_[_0x441a('0x34')](_0x4491d9[_0x441a('0x2f')],_0x4491d9['query']);_0xa70639['attributes']=_[_0x441a('0x34')](_0x4491d9[_0x441a('0x2f')],qs['fields'](_0x31ed9d['query']['fields']));_0xa70639[_0x441a('0x33')]=_0xa70639[_0x441a('0x33')][_0x441a('0x42')]?_0xa70639[_0x441a('0x33')]:_0x4491d9['model'];if(_0x31ed9d[_0x441a('0x31')][_0x441a('0x3f')]){_0xa70639['include']=[{'all':!![]}];}_0xa70639=_[_0x441a('0x3c')]({},_0xa70639,_0x31ed9d['options']);return db[_0x441a('0x2c')][_0x441a('0x43')](_0xa70639)[_0x441a('0x27')](handleEntityNotFound(_0x17b249,null))[_0x441a('0x27')](respondWithResult(_0x17b249,null))['catch'](handleError(_0x17b249,null));};exports['create']=function(_0x516ec2,_0x31b73c){return db[_0x441a('0x2c')][_0x441a('0x44')](_0x516ec2[_0x441a('0x45')],{})[_0x441a('0x27')](respondWithResult(_0x31b73c,0xc9))[_0x441a('0x46')](handleError(_0x31b73c,null));};exports['update']=function(_0x3ab386,_0x41dea6){if(_0x3ab386[_0x441a('0x45')]['id']){delete _0x3ab386['body']['id'];}return db[_0x441a('0x2c')][_0x441a('0x43')]({'where':{'id':_0x3ab386[_0x441a('0x47')]['id']}})[_0x441a('0x27')](handleEntityNotFound(_0x41dea6,null))[_0x441a('0x27')](saveUpdates(_0x3ab386[_0x441a('0x45')],null))[_0x441a('0x27')](respondWithResult(_0x41dea6,null))[_0x441a('0x46')](handleError(_0x41dea6,null));};exports[_0x441a('0x48')]=function(_0x149dab,_0x26e4d1){return db[_0x441a('0x2c')][_0x441a('0x43')]({'where':{'id':_0x149dab[_0x441a('0x47')]['id']}})['then'](handleEntityNotFound(_0x26e4d1,null))['then'](removeEntity(_0x26e4d1,null))[_0x441a('0x46')](handleError(_0x26e4d1,null));}; \ No newline at end of file +var _0xc8e7=['options','findAll','catch','show','params','keys','includeAll','include','find','create','body','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','lodash','squel','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','count','offset','set','json','reject','save','update','then','destroy','sendStatus','error','name','send','index','CloudProvider','fieldName','type','model','map','query','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','VIRTUAL','merge'];(function(_0x3f7caf,_0x7e099){var _0x3bba7e=function(_0x5485b7){while(--_0x5485b7){_0x3f7caf['push'](_0x3f7caf['shift']());}};_0x3bba7e(++_0x7e099);}(_0xc8e7,0x1a3));var _0x7c8e=function(_0x28678d,_0x54324f){_0x28678d=_0x28678d-0x0;var _0x1643e9=_0xc8e7[_0x28678d];return _0x1643e9;};'use strict';var pdf=require(_0x7c8e('0x0'));var emlformat=require(_0x7c8e('0x1'));var rimraf=require(_0x7c8e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7c8e('0x3'));var rp=require('request-promise');var moment=require(_0x7c8e('0x4'));var BPromise=require(_0x7c8e('0x5'));var Mustache=require('mustache');var util=require(_0x7c8e('0x6'));var path=require(_0x7c8e('0x7'));var sox=require(_0x7c8e('0x8'));var csv=require(_0x7c8e('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x7c8e('0xa'));var squel=require(_0x7c8e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x7c8e('0xc'));var toCsv=require(_0x7c8e('0x9'));var querystring=require(_0x7c8e('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7c8e('0xe'));var qs=require(_0x7c8e('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7c8e('0x10'));var logger=require('../../config/logger')(_0x7c8e('0x11'));var utils=require(_0x7c8e('0x12'));var config=require(_0x7c8e('0x13'));var db=require(_0x7c8e('0x14'))['db'];function respondWithStatusCode(_0x22dda1,_0x3b2281){_0x3b2281=_0x3b2281||0xcc;return function(_0x82ee5e){if(_0x82ee5e){return _0x22dda1['sendStatus'](_0x3b2281);}return _0x22dda1['status'](_0x3b2281)['end']();};}function respondWithResult(_0x56489b,_0x18ce33){_0x18ce33=_0x18ce33||0xc8;return function(_0x227167){if(_0x227167){return _0x56489b[_0x7c8e('0x15')](_0x18ce33)['json'](_0x227167);}};}function respondWithFilteredResult(_0x2cde43,_0x4b0e62){return function(_0x5da70c){if(_0x5da70c){var _0x11b8e5=_0x5da70c[_0x7c8e('0x16')],_0x104313=_0x4b0e62[_0x7c8e('0x17')],_0x4f8df1=_0x4b0e62[_0x7c8e('0x17')]+_0x4b0e62['limit'],_0x680790;if(_0x4f8df1>=_0x11b8e5){_0x4f8df1=_0x11b8e5;_0x680790=0xc8;}else{_0x680790=0xce;}_0x2cde43['status'](_0x680790);return _0x2cde43[_0x7c8e('0x18')]('Content-Range',_0x104313+'-'+_0x4f8df1+'/'+_0x11b8e5)[_0x7c8e('0x19')](_0x5da70c);}return null;};}function patchUpdates(_0x261e4c){return function(_0x16b907){try{jsonpatch['apply'](_0x16b907,_0x261e4c,!![]);}catch(_0x4c4bf9){return BPromise[_0x7c8e('0x1a')](_0x4c4bf9);}return _0x16b907[_0x7c8e('0x1b')]();};}function saveUpdates(_0x45a37c,_0x362245){return function(_0x5dba1b){if(_0x5dba1b){return _0x5dba1b[_0x7c8e('0x1c')](_0x45a37c)[_0x7c8e('0x1d')](function(_0x5f4728){return _0x5f4728;});}return null;};}function removeEntity(_0x390df6,_0x53f1b7){return function(_0x5ab15d){if(_0x5ab15d){return _0x5ab15d[_0x7c8e('0x1e')]()[_0x7c8e('0x1d')](function(){_0x390df6['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x254a89,_0x454fdb){return function(_0x60cf89){if(!_0x60cf89){_0x254a89[_0x7c8e('0x1f')](0x194);}return _0x60cf89;};}function handleError(_0x4afdde,_0x2b0879){_0x2b0879=_0x2b0879||0x1f4;return function(_0x462c32){logger[_0x7c8e('0x20')](_0x462c32['stack']);if(_0x462c32['name']){delete _0x462c32[_0x7c8e('0x21')];}_0x4afdde['status'](_0x2b0879)[_0x7c8e('0x22')](_0x462c32);};}exports[_0x7c8e('0x23')]=function(_0x108b78,_0x98dbe2){var _0x2c97cb={},_0x198811={},_0x4b2ff4={'count':0x0,'rows':[]};var _0xe196a7=_['map'](db[_0x7c8e('0x24')]['rawAttributes'],function(_0x57ffe9){return{'name':_0x57ffe9[_0x7c8e('0x25')],'type':_0x57ffe9[_0x7c8e('0x26')]['key']};});_0x198811[_0x7c8e('0x27')]=_[_0x7c8e('0x28')](_0xe196a7,_0x7c8e('0x21'));_0x198811[_0x7c8e('0x29')]=_['keys'](_0x108b78['query']);_0x198811[_0x7c8e('0x2a')]=_[_0x7c8e('0x2b')](_0x198811['model'],_0x198811[_0x7c8e('0x29')]);_0x2c97cb['attributes']=_[_0x7c8e('0x2b')](_0x198811[_0x7c8e('0x27')],qs[_0x7c8e('0x2c')](_0x108b78[_0x7c8e('0x29')][_0x7c8e('0x2c')]));_0x2c97cb['attributes']=_0x2c97cb['attributes'][_0x7c8e('0x2d')]?_0x2c97cb[_0x7c8e('0x2e')]:_0x198811['model'];if(!_0x108b78[_0x7c8e('0x29')][_0x7c8e('0x2f')](_0x7c8e('0x30'))){_0x2c97cb['limit']=qs[_0x7c8e('0x31')](_0x108b78[_0x7c8e('0x29')][_0x7c8e('0x31')]);_0x2c97cb['offset']=qs['offset'](_0x108b78[_0x7c8e('0x29')][_0x7c8e('0x17')]);}_0x2c97cb[_0x7c8e('0x32')]=qs[_0x7c8e('0x33')](_0x108b78[_0x7c8e('0x29')][_0x7c8e('0x33')]);_0x2c97cb[_0x7c8e('0x34')]=qs[_0x7c8e('0x2a')](_[_0x7c8e('0x35')](_0x108b78[_0x7c8e('0x29')],_0x198811[_0x7c8e('0x2a')]),_0xe196a7);if(_0x108b78[_0x7c8e('0x29')][_0x7c8e('0x36')]){_0x2c97cb[_0x7c8e('0x34')]=_['merge'](_0x2c97cb[_0x7c8e('0x34')],{'$or':_[_0x7c8e('0x28')](_0xe196a7,function(_0x26d182){if(_0x26d182['type']!==_0x7c8e('0x37')){var _0x4c4f9b={};_0x4c4f9b[_0x26d182[_0x7c8e('0x21')]]={'$like':'%'+_0x108b78[_0x7c8e('0x29')][_0x7c8e('0x36')]+'%'};return _0x4c4f9b;}})});}_0x2c97cb=_[_0x7c8e('0x38')]({},_0x2c97cb,_0x108b78[_0x7c8e('0x39')]);var _0x792ef1={'where':_0x2c97cb[_0x7c8e('0x34')]};return db[_0x7c8e('0x24')][_0x7c8e('0x16')](_0x792ef1)['then'](function(_0x1fdb16){_0x4b2ff4['count']=_0x1fdb16;if(_0x108b78[_0x7c8e('0x29')]['includeAll']){_0x2c97cb['include']=[{'all':!![]}];}return db[_0x7c8e('0x24')][_0x7c8e('0x3a')](_0x2c97cb);})[_0x7c8e('0x1d')](function(_0x1c94f3){_0x4b2ff4['rows']=_0x1c94f3;return _0x4b2ff4;})['then'](respondWithFilteredResult(_0x98dbe2,_0x2c97cb))[_0x7c8e('0x3b')](handleError(_0x98dbe2,null));};exports[_0x7c8e('0x3c')]=function(_0xd608a3,_0xedc0c3){var _0x50717={'raw':!![],'where':{'id':_0xd608a3[_0x7c8e('0x3d')]['id']}},_0x1d50ee={};_0x1d50ee['model']=_[_0x7c8e('0x3e')](db[_0x7c8e('0x24')]['rawAttributes']);_0x1d50ee[_0x7c8e('0x29')]=_[_0x7c8e('0x3e')](_0xd608a3[_0x7c8e('0x29')]);_0x1d50ee[_0x7c8e('0x2a')]=_[_0x7c8e('0x2b')](_0x1d50ee[_0x7c8e('0x27')],_0x1d50ee[_0x7c8e('0x29')]);_0x50717[_0x7c8e('0x2e')]=_[_0x7c8e('0x2b')](_0x1d50ee[_0x7c8e('0x27')],qs[_0x7c8e('0x2c')](_0xd608a3[_0x7c8e('0x29')][_0x7c8e('0x2c')]));_0x50717[_0x7c8e('0x2e')]=_0x50717['attributes'][_0x7c8e('0x2d')]?_0x50717['attributes']:_0x1d50ee[_0x7c8e('0x27')];if(_0xd608a3[_0x7c8e('0x29')][_0x7c8e('0x3f')]){_0x50717[_0x7c8e('0x40')]=[{'all':!![]}];}_0x50717=_['merge']({},_0x50717,_0xd608a3[_0x7c8e('0x39')]);return db[_0x7c8e('0x24')][_0x7c8e('0x41')](_0x50717)[_0x7c8e('0x1d')](handleEntityNotFound(_0xedc0c3,null))[_0x7c8e('0x1d')](respondWithResult(_0xedc0c3,null))[_0x7c8e('0x3b')](handleError(_0xedc0c3,null));};exports[_0x7c8e('0x42')]=function(_0x29046c,_0x53611d){return db[_0x7c8e('0x24')][_0x7c8e('0x42')](_0x29046c[_0x7c8e('0x43')],{})[_0x7c8e('0x1d')](respondWithResult(_0x53611d,0xc9))['catch'](handleError(_0x53611d,null));};exports['update']=function(_0x3eaf49,_0x6c91a8){if(_0x3eaf49[_0x7c8e('0x43')]['id']){delete _0x3eaf49['body']['id'];}return db[_0x7c8e('0x24')][_0x7c8e('0x41')]({'where':{'id':_0x3eaf49['params']['id']}})[_0x7c8e('0x1d')](handleEntityNotFound(_0x6c91a8,null))['then'](saveUpdates(_0x3eaf49[_0x7c8e('0x43')],null))[_0x7c8e('0x1d')](respondWithResult(_0x6c91a8,null))['catch'](handleError(_0x6c91a8,null));};exports[_0x7c8e('0x1e')]=function(_0x37758a,_0x5dba50){return db[_0x7c8e('0x24')][_0x7c8e('0x41')]({'where':{'id':_0x37758a[_0x7c8e('0x3d')]['id']}})[_0x7c8e('0x1d')](handleEntityNotFound(_0x5dba50,null))['then'](removeEntity(_0x5dba50,null))['catch'](handleError(_0x5dba50,null));}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index af0bc2d..327eb1c 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 _0xb358=['request-promise','path','rimraf','./cloudProvider.attributes','exports','define','CloudProvider','cloud_providers','lodash','../../config/logger','moment','bluebird'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0xb358,0x194));var _0x8b35=function(_0xbfd058,_0x1ee59){_0xbfd058=_0xbfd058-0x0;var _0x568cb1=_0xb358[_0xbfd058];return _0x568cb1;};'use strict';var _=require(_0x8b35('0x0'));var util=require('util');var logger=require(_0x8b35('0x1'))('api');var moment=require(_0x8b35('0x2'));var BPromise=require(_0x8b35('0x3'));var rp=require(_0x8b35('0x4'));var fs=require('fs');var path=require(_0x8b35('0x5'));var rimraf=require(_0x8b35('0x6'));var config=require('../../config/environment');var attributes=require(_0x8b35('0x7'));module[_0x8b35('0x8')]=function(_0x21641b,_0x2dbd2a){return _0x21641b[_0x8b35('0x9')](_0x8b35('0xa'),attributes,{'tableName':_0x8b35('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x277f=['bluebird','request-promise','rimraf','../../config/environment','cloud_providers','lodash','util','api','moment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x277f,0x1b5));var _0xf277=function(_0x928fef,_0x21283a){_0x928fef=_0x928fef-0x0;var _0xe31e8c=_0x277f[_0x928fef];return _0xe31e8c;};'use strict';var _=require(_0xf277('0x0'));var util=require(_0xf277('0x1'));var logger=require('../../config/logger')(_0xf277('0x2'));var moment=require(_0xf277('0x3'));var BPromise=require(_0xf277('0x4'));var rp=require(_0xf277('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf277('0x6'));var config=require(_0xf277('0x7'));var attributes=require('./cloudProvider.attributes');module['exports']=function(_0x577912,_0x538c19){return _0x577912['define']('CloudProvider',attributes,{'tableName':_0xf277('0x8'),'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 cdd0804..30fc76a 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 _0x7e8a=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','lodash','util','randomstring','ioredis','../../mysqldb'];(function(_0xfa8bcc,_0x1f1fd4){var _0x55cbe7=function(_0x1b57b3){while(--_0x1b57b3){_0xfa8bcc['push'](_0xfa8bcc['shift']());}};_0x55cbe7(++_0x1f1fd4);}(_0x7e8a,0xeb));var _0xa7e8=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0x7e8a[_0x173441];return _0x2423a8;};'use strict';var _=require(_0xa7e8('0x0'));var util=require(_0xa7e8('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa7e8('0x2'));var fs=require('fs');var Redis=require(_0xa7e8('0x3'));var db=require(_0xa7e8('0x4'))['db'];var utils=require(_0xa7e8('0x5'));var logger=require(_0xa7e8('0x6'))('rpc');var config=require(_0xa7e8('0x7'));var jayson=require(_0xa7e8('0x8'));var client=jayson[_0xa7e8('0x9')][_0xa7e8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x29c0a3,_0x46afe3,_0x14916e){return new BPromise(function(_0x1283e1,_0x11d4c4){return client[_0xa7e8('0xb')](_0x29c0a3,_0x14916e)['then'](function(_0x27d029){logger[_0xa7e8('0xc')](_0xa7e8('0xd'),_0x46afe3,_0xa7e8('0xe'));logger[_0xa7e8('0xf')]('CloudProvider,\x20%s,\x20%s,\x20%s',_0x46afe3,'request\x20sent',JSON['stringify'](_0x27d029));if(_0x27d029[_0xa7e8('0x10')]){if(_0x27d029[_0xa7e8('0x10')][_0xa7e8('0x11')]===0x1f4){logger[_0xa7e8('0x10')](_0xa7e8('0xd'),_0x46afe3,_0x27d029[_0xa7e8('0x10')][_0xa7e8('0x12')]);return _0x11d4c4(_0x27d029[_0xa7e8('0x10')]['message']);}logger[_0xa7e8('0x10')]('CloudProvider,\x20%s,\x20%s',_0x46afe3,_0x27d029['error'][_0xa7e8('0x12')]);return _0x1283e1(_0x27d029[_0xa7e8('0x10')][_0xa7e8('0x12')]);}else{logger[_0xa7e8('0xc')](_0xa7e8('0xd'),_0x46afe3,'request\x20sent');_0x1283e1(_0x27d029['result'][_0xa7e8('0x12')]);}})[_0xa7e8('0x13')](function(_0xd0a2d4){logger[_0xa7e8('0x10')](_0xa7e8('0xd'),_0x46afe3,_0xd0a2d4);_0x11d4c4(_0xd0a2d4);});});} \ No newline at end of file +var _0x2291=['catch','lodash','util','bluebird','../../mysqldb','../../config/utils','jayson/promise','client','http','request','CloudProvider,\x20%s,\x20%s','debug','CloudProvider,\x20%s,\x20%s,\x20%s','error','message','info','request\x20sent','result'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0x2291,0xa3));var _0x1229=function(_0x50c6de,_0x5ca2c5){_0x50c6de=_0x50c6de-0x0;var _0x9f38e9=_0x2291[_0x50c6de];return _0x9f38e9;};'use strict';var _=require(_0x1229('0x0'));var util=require(_0x1229('0x1'));var moment=require('moment');var BPromise=require(_0x1229('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1229('0x3'))['db'];var utils=require(_0x1229('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x1229('0x5'));var client=jayson[_0x1229('0x6')][_0x1229('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2249ef,_0x17b8cc,_0x1aba85){return new BPromise(function(_0x3ea5c3,_0x35518a){return client[_0x1229('0x8')](_0x2249ef,_0x1aba85)['then'](function(_0x47b85b){logger['info'](_0x1229('0x9'),_0x17b8cc,'request\x20sent');logger[_0x1229('0xa')](_0x1229('0xb'),_0x17b8cc,'request\x20sent',JSON['stringify'](_0x47b85b));if(_0x47b85b[_0x1229('0xc')]){if(_0x47b85b[_0x1229('0xc')]['code']===0x1f4){logger[_0x1229('0xc')](_0x1229('0x9'),_0x17b8cc,_0x47b85b[_0x1229('0xc')][_0x1229('0xd')]);return _0x35518a(_0x47b85b[_0x1229('0xc')]['message']);}logger[_0x1229('0xc')](_0x1229('0x9'),_0x17b8cc,_0x47b85b[_0x1229('0xc')]['message']);return _0x3ea5c3(_0x47b85b['error'][_0x1229('0xd')]);}else{logger[_0x1229('0xe')](_0x1229('0x9'),_0x17b8cc,_0x1229('0xf'));_0x3ea5c3(_0x47b85b[_0x1229('0x10')][_0x1229('0xd')]);}})[_0x1229('0x11')](function(_0x230956){logger[_0x1229('0xc')](_0x1229('0x9'),_0x17b8cc,_0x230956);_0x35518a(_0x230956);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index f8c6850..07762a1 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 _0xcc42=['exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','show','post','create','put','/:id','update','delete'];(function(_0x151334,_0x1e11ac){var _0x3d03da=function(_0x2099cf){while(--_0x2099cf){_0x151334['push'](_0x151334['shift']());}};_0x3d03da(++_0x1e11ac);}(_0xcc42,0x16a));var _0x2cc4=function(_0x527824,_0xc824a9){_0x527824=_0x527824-0x0;var _0xc8b8ed=_0xcc42[_0x527824];return _0xc8b8ed;};'use strict';var multer=require(_0x2cc4('0x0'));var util=require(_0x2cc4('0x1'));var path=require(_0x2cc4('0x2'));var timeout=require(_0x2cc4('0x3'));var express=require(_0x2cc4('0x4'));var router=express[_0x2cc4('0x5')]();var auth=require(_0x2cc4('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x2cc4('0x7'));var controller=require('./cloudProvider.controller');router[_0x2cc4('0x8')]('/',auth[_0x2cc4('0x9')](),controller[_0x2cc4('0xa')]);router[_0x2cc4('0x8')]('/:id',auth[_0x2cc4('0x9')](),controller[_0x2cc4('0xb')]);router[_0x2cc4('0xc')]('/',auth[_0x2cc4('0x9')](),controller[_0x2cc4('0xd')]);router[_0x2cc4('0xe')](_0x2cc4('0xf'),auth[_0x2cc4('0x9')](),controller[_0x2cc4('0x10')]);router[_0x2cc4('0x11')](_0x2cc4('0xf'),auth[_0x2cc4('0x9')](),controller['destroy']);module[_0x2cc4('0x12')]=router; \ No newline at end of file +var _0xa5b3=['path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./cloudProvider.controller','get','isAuthenticated','show','put','/:id','update','delete','destroy','exports'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xa5b3,0x96));var _0x3a5b=function(_0x50aa5c,_0x516848){_0x50aa5c=_0x50aa5c-0x0;var _0x4830c8=_0xa5b3[_0x50aa5c];return _0x4830c8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3a5b('0x0'));var timeout=require('connect-timeout');var express=require(_0x3a5b('0x1'));var router=express['Router']();var auth=require(_0x3a5b('0x2'));var interaction=require(_0x3a5b('0x3'));var config=require(_0x3a5b('0x4'));var controller=require(_0x3a5b('0x5'));router[_0x3a5b('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x3a5b('0x6')]('/:id',auth[_0x3a5b('0x7')](),controller[_0x3a5b('0x8')]);router['post']('/',auth[_0x3a5b('0x7')](),controller['create']);router[_0x3a5b('0x9')](_0x3a5b('0xa'),auth['isAuthenticated'](),controller[_0x3a5b('0xb')]);router[_0x3a5b('0xc')](_0x3a5b('0xa'),auth[_0x3a5b('0x7')](),controller[_0x3a5b('0xd')]);module[_0x3a5b('0xe')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 4bd83e5..abccd30 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 _0xca8b=['sequelize','exports','STRING','name'];(function(_0xa94ac1,_0x48a13c){var _0xd9cfde=function(_0x529a98){while(--_0x529a98){_0xa94ac1['push'](_0xa94ac1['shift']());}};_0xd9cfde(++_0x48a13c);}(_0xca8b,0x150));var _0xbca8=function(_0x5289c5,_0x58e2a3){_0x5289c5=_0x5289c5-0x0;var _0x53d7bc=_0xca8b[_0x5289c5];return _0x53d7bc;};'use strict';var Sequelize=require(_0xbca8('0x0'));module[_0xbca8('0x1')]={'name':{'type':Sequelize[_0xbca8('0x2')],'unique':_0xbca8('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xbca8('0x2')]},'companyId':{'type':Sequelize[_0xbca8('0x2')]},'website':{'type':Sequelize['STRING']},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0xbca8('0x2')]},'type':{'type':Sequelize[_0xbca8('0x2')]},'street':{'type':Sequelize[_0xbca8('0x2')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0xbca8('0x2')]},'country':{'type':Sequelize[_0xbca8('0x2')]},'email':{'type':Sequelize[_0xbca8('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xbca8('0x2')]},'sStreet':{'type':Sequelize['STRING']},'sPostalCode':{'type':Sequelize['STRING']},'sCity':{'type':Sequelize[_0xbca8('0x2')]},'sCountry':{'type':Sequelize[_0xbca8('0x2')]},'description':{'type':Sequelize[_0xbca8('0x2')]}}; \ No newline at end of file +var _0xb77a=['STRING','sequelize','exports'];(function(_0x36f6a3,_0x2b6ab8){var _0xc28488=function(_0x300d56){while(--_0x300d56){_0x36f6a3['push'](_0x36f6a3['shift']());}};_0xc28488(++_0x2b6ab8);}(_0xb77a,0x79));var _0xab77=function(_0x41d039,_0x44c776){_0x41d039=_0x41d039-0x0;var _0x20febc=_0xb77a[_0x41d039];return _0x20febc;};'use strict';var Sequelize=require(_0xab77('0x0'));module[_0xab77('0x1')]={'name':{'type':Sequelize[_0xab77('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xab77('0x2')]},'companyId':{'type':Sequelize[_0xab77('0x2')]},'website':{'type':Sequelize[_0xab77('0x2')]},'phone':{'type':Sequelize[_0xab77('0x2')]},'fax':{'type':Sequelize[_0xab77('0x2')]},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0xab77('0x2')]},'postalCode':{'type':Sequelize[_0xab77('0x2')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0xab77('0x2')]},'email':{'type':Sequelize[_0xab77('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize['STRING']},'sPostalCode':{'type':Sequelize['STRING']},'sCity':{'type':Sequelize[_0xab77('0x2')]},'sCountry':{'type':Sequelize[_0xab77('0x2')]},'description':{'type':Sequelize[_0xab77('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 0b99f50..0dcbe07 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 _0x6110=['where','pick','filter','merge','map','options','include','findAll','rows','catch','params','rawAttributes','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','body','addContacts','CmContact','ids','findOne','getContacts','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','set','Content-Range','json','apply','save','update','then','destroy','get','Companies','error','stack','name','send','index','CmCompany','describe','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort'];(function(_0x3e25c1,_0x1d15f9){var _0x52e7f2=function(_0x597a5a){while(--_0x597a5a){_0x3e25c1['push'](_0x3e25c1['shift']());}};_0x52e7f2(++_0x1d15f9);}(_0x6110,0x75));var _0x0611=function(_0x5c6c8a,_0x16e6a0){_0x5c6c8a=_0x5c6c8a-0x0;var _0x9926e0=_0x6110[_0x5c6c8a];return _0x9926e0;};'use strict';var pdf=require(_0x0611('0x0'));var emlformat=require(_0x0611('0x1'));var rimraf=require(_0x0611('0x2'));var zipdir=require(_0x0611('0x3'));var jsonpatch=require(_0x0611('0x4'));var rp=require(_0x0611('0x5'));var moment=require(_0x0611('0x6'));var BPromise=require(_0x0611('0x7'));var Mustache=require(_0x0611('0x8'));var util=require(_0x0611('0x9'));var path=require('path');var sox=require('sox');var csv=require(_0x0611('0xa'));var ejs=require(_0x0611('0xb'));var fs=require('fs');var _=require(_0x0611('0xc'));var squel=require(_0x0611('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x0611('0xa'));var querystring=require(_0x0611('0xe'));var Papa=require(_0x0611('0xf'));var Redis=require(_0x0611('0x10'));var authService=require(_0x0611('0x11'));var qs=require(_0x0611('0x12'));var as=require(_0x0611('0x13'));var hardwareService=require(_0x0611('0x14'));var logger=require(_0x0611('0x15'))(_0x0611('0x16'));var utils=require(_0x0611('0x17'));var config=require(_0x0611('0x18'));var db=require(_0x0611('0x19'))['db'];function respondWithStatusCode(_0x57e88a,_0x378e37){_0x378e37=_0x378e37||0xcc;return function(_0x40299b){if(_0x40299b){return _0x57e88a[_0x0611('0x1a')](_0x378e37);}return _0x57e88a[_0x0611('0x1b')](_0x378e37)[_0x0611('0x1c')]();};}function respondWithResult(_0x5a7d17,_0x34a0e5){_0x34a0e5=_0x34a0e5||0xc8;return function(_0xc669de){if(_0xc669de){return _0x5a7d17[_0x0611('0x1b')](_0x34a0e5)['json'](_0xc669de);}};}function respondWithFilteredResult(_0x269b35,_0x56a54f){return function(_0x2f9518){if(_0x2f9518){var _0x5372ff=_0x2f9518[_0x0611('0x1d')],_0x5e40f7=_0x56a54f['offset'],_0x33412f=_0x56a54f[_0x0611('0x1e')]+_0x56a54f['limit'],_0x7c27b4;if(_0x33412f>=_0x5372ff){_0x33412f=_0x5372ff;_0x7c27b4=0xc8;}else{_0x7c27b4=0xce;}_0x269b35[_0x0611('0x1b')](_0x7c27b4);return _0x269b35[_0x0611('0x1f')](_0x0611('0x20'),_0x5e40f7+'-'+_0x33412f+'/'+_0x5372ff)[_0x0611('0x21')](_0x2f9518);}return null;};}function patchUpdates(_0x4f605c){return function(_0x33c051){try{jsonpatch[_0x0611('0x22')](_0x33c051,_0x4f605c,!![]);}catch(_0x266027){return BPromise['reject'](_0x266027);}return _0x33c051[_0x0611('0x23')]();};}function saveUpdates(_0x24f20c,_0x125373){return function(_0xa97384){if(_0xa97384){return _0xa97384[_0x0611('0x24')](_0x24f20c)[_0x0611('0x25')](function(_0x3854c1){return _0x3854c1;});}return null;};}function removeEntity(_0x302edc,_0x426ce3){return function(_0x218036){if(_0x218036){return _0x218036[_0x0611('0x26')]()[_0x0611('0x25')](function(){var _0x5d9949=_0x218036[_0x0611('0x27')]({'plain':!![]});var _0x1200eb=_0x0611('0x28');return db['UserProfileResource'][_0x0611('0x26')]({'where':{'type':_0x1200eb,'resourceId':_0x5d9949['id']}})[_0x0611('0x25')](function(){return _0x218036;});})[_0x0611('0x25')](function(){_0x302edc[_0x0611('0x1b')](0xcc)[_0x0611('0x1c')]();});}};}function handleEntityNotFound(_0x3f0508,_0x2c0720){return function(_0x1beb95){if(!_0x1beb95){_0x3f0508[_0x0611('0x1a')](0x194);}return _0x1beb95;};}function handleError(_0xb7c650,_0x2811b7){_0x2811b7=_0x2811b7||0x1f4;return function(_0x38a095){logger[_0x0611('0x29')](_0x38a095[_0x0611('0x2a')]);if(_0x38a095['name']){delete _0x38a095[_0x0611('0x2b')];}_0xb7c650['status'](_0x2811b7)[_0x0611('0x2c')](_0x38a095);};}exports[_0x0611('0x2d')]=function(_0x7e9792,_0x9071fd){var _0x5be7db={},_0x205bc5={},_0x28a2a4={'count':0x0,'rows':[]};return db[_0x0611('0x2e')][_0x0611('0x2f')]()['then'](function(_0x385c85){_0x205bc5[_0x0611('0x30')]=_['keys'](_0x385c85);_0x205bc5['query']=_[_0x0611('0x31')](_0x7e9792[_0x0611('0x32')]);_0x205bc5[_0x0611('0x33')]=_['intersection'](_0x205bc5[_0x0611('0x30')],_0x205bc5[_0x0611('0x32')]);_0x5be7db['attributes']=_[_0x0611('0x34')](_0x205bc5['model'],qs[_0x0611('0x35')](_0x7e9792['query'][_0x0611('0x35')]));_0x5be7db[_0x0611('0x36')]=_0x5be7db['attributes'][_0x0611('0x37')]?_0x5be7db[_0x0611('0x36')]:_0x205bc5[_0x0611('0x30')];if(!_0x7e9792[_0x0611('0x32')][_0x0611('0x38')](_0x0611('0x39'))){_0x5be7db[_0x0611('0x3a')]=qs['limit'](_0x7e9792[_0x0611('0x32')]['limit']);_0x5be7db['offset']=qs[_0x0611('0x1e')](_0x7e9792[_0x0611('0x32')][_0x0611('0x1e')]);}_0x5be7db[_0x0611('0x3b')]=qs[_0x0611('0x3c')](_0x7e9792[_0x0611('0x32')][_0x0611('0x3c')]);_0x5be7db[_0x0611('0x3d')]=qs[_0x0611('0x33')](_[_0x0611('0x3e')](_0x7e9792[_0x0611('0x32')],_0x205bc5[_0x0611('0x33')]),_0x385c85);if(_0x7e9792[_0x0611('0x32')][_0x0611('0x3f')]){_0x5be7db[_0x0611('0x3d')]=_[_0x0611('0x40')](_0x5be7db['where'],{'$or':_[_0x0611('0x41')](_0x5be7db[_0x0611('0x36')],function(_0x57a827){var _0x163511={};_0x163511[_0x57a827]={'$like':'%'+_0x7e9792[_0x0611('0x32')]['filter']+'%'};return _0x163511;})});}_0x5be7db=_[_0x0611('0x40')]({},_0x5be7db,_0x7e9792[_0x0611('0x42')]);var _0x388632={'where':_0x5be7db[_0x0611('0x3d')]};return db[_0x0611('0x2e')][_0x0611('0x1d')](_0x388632)[_0x0611('0x25')](function(_0x260b92){_0x28a2a4[_0x0611('0x1d')]=_0x260b92;if(_0x7e9792['query']['includeAll']){_0x5be7db[_0x0611('0x43')]=[{'all':!![]}];}return db[_0x0611('0x2e')][_0x0611('0x44')](_0x5be7db);})[_0x0611('0x25')](function(_0x3364dc){_0x28a2a4[_0x0611('0x45')]=_0x3364dc;return _0x28a2a4;})[_0x0611('0x25')](respondWithFilteredResult(_0x9071fd,_0x5be7db))['catch'](handleError(_0x9071fd,null));})[_0x0611('0x46')](handleError(_0x9071fd,null));};exports['show']=function(_0x1ffe09,_0x111498){var _0x689800={'raw':![],'where':{'id':_0x1ffe09[_0x0611('0x47')]['id']}},_0xbb284d={};_0xbb284d[_0x0611('0x30')]=_[_0x0611('0x31')](db[_0x0611('0x2e')][_0x0611('0x48')]);_0xbb284d[_0x0611('0x32')]=_[_0x0611('0x31')](_0x1ffe09[_0x0611('0x32')]);_0xbb284d[_0x0611('0x33')]=_[_0x0611('0x34')](_0xbb284d[_0x0611('0x30')],_0xbb284d[_0x0611('0x32')]);_0x689800[_0x0611('0x36')]=_[_0x0611('0x34')](_0xbb284d[_0x0611('0x30')],qs[_0x0611('0x35')](_0x1ffe09['query']['fields']));_0x689800['attributes']=_0x689800[_0x0611('0x36')][_0x0611('0x37')]?_0x689800[_0x0611('0x36')]:_0xbb284d[_0x0611('0x30')];if(_0x1ffe09[_0x0611('0x32')][_0x0611('0x49')]){_0x689800[_0x0611('0x43')]=[{'all':!![]}];}_0x689800=_[_0x0611('0x40')]({},_0x689800,_0x1ffe09['options']);return db[_0x0611('0x2e')][_0x0611('0x4a')](_0x689800)[_0x0611('0x25')](handleEntityNotFound(_0x111498,null))['then'](respondWithResult(_0x111498,null))[_0x0611('0x46')](handleError(_0x111498,null));};exports['create']=function(_0xea6798,_0x24ed54){return db[_0x0611('0x2e')][_0x0611('0x4b')](_0xea6798['body'],{})['then'](function(_0x5a669d){var _0x4d9bec=_0xea6798[_0x0611('0x4c')][_0x0611('0x27')]({'plain':!![]});if(!_0x4d9bec)throw new Error(_0x0611('0x4d'));if(_0x4d9bec[_0x0611('0x4e')]===_0x0611('0x4c')){var _0x4ea91a=_0x5a669d[_0x0611('0x27')]({'plain':!![]});var _0x14a117=_0x0611('0x28');return db[_0x0611('0x4f')][_0x0611('0x4a')]({'where':{'name':_0x14a117,'userProfileId':_0x4d9bec[_0x0611('0x50')]},'raw':!![]})['then'](function(_0x20ff13){if(_0x20ff13&&_0x20ff13[_0x0611('0x51')]===0x0){return db[_0x0611('0x52')][_0x0611('0x4b')]({'name':_0x4ea91a['name'],'resourceId':_0x4ea91a['id'],'type':_0x20ff13[_0x0611('0x2b')],'sectionId':_0x20ff13['id']},{})[_0x0611('0x25')](function(){return _0x5a669d;});}else{return _0x5a669d;}})[_0x0611('0x46')](function(_0x8582b6){logger[_0x0611('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x8582b6);throw _0x8582b6;});}return _0x5a669d;})[_0x0611('0x25')](respondWithResult(_0x24ed54,0xc9))[_0x0611('0x46')](handleError(_0x24ed54,null));};exports['update']=function(_0x460dfb,_0x423072){if(_0x460dfb[_0x0611('0x53')]['id']){delete _0x460dfb[_0x0611('0x53')]['id'];}return db[_0x0611('0x2e')][_0x0611('0x4a')]({'where':{'id':_0x460dfb[_0x0611('0x47')]['id']}})[_0x0611('0x25')](handleEntityNotFound(_0x423072,null))['then'](saveUpdates(_0x460dfb[_0x0611('0x53')],null))[_0x0611('0x25')](respondWithResult(_0x423072,null))[_0x0611('0x46')](handleError(_0x423072,null));};exports['destroy']=function(_0x5e90c0,_0x2c400a){return db[_0x0611('0x2e')]['find']({'where':{'id':_0x5e90c0[_0x0611('0x47')]['id']}})['then'](handleEntityNotFound(_0x2c400a,null))[_0x0611('0x25')](removeEntity(_0x2c400a,null))['catch'](handleError(_0x2c400a,null));};exports[_0x0611('0x2f')]=function(_0x4e648a,_0x1b4a54){return db['CmCompany'][_0x0611('0x2f')]()['then'](respondWithResult(_0x1b4a54,null))[_0x0611('0x46')](handleError(_0x1b4a54,null));};exports[_0x0611('0x54')]=function(_0x3e6353,_0x298a29,_0x41dada){return db[_0x0611('0x55')][_0x0611('0x4a')]({'where':{'id':_0x3e6353[_0x0611('0x47')]['id']}})[_0x0611('0x25')](handleEntityNotFound(_0x298a29,null))[_0x0611('0x25')](function(_0x297072){if(_0x297072){return _0x297072['addContacts'](_0x3e6353['body'][_0x0611('0x56')],_['omit'](_0x3e6353['body'],[_0x0611('0x56'),'id'])||{});}})['then'](respondWithResult(_0x298a29,null))['catch'](handleError(_0x298a29,null));};exports['getContacts']=function(_0x32dc65,_0x6703bb,_0x111efd){var _0x2969c9={};var _0x276496={};var _0x150fdd;var _0x164665;return db['CmCompany'][_0x0611('0x57')]({'where':{'id':_0x32dc65[_0x0611('0x47')]['id']}})[_0x0611('0x25')](handleEntityNotFound(_0x6703bb,null))['then'](function(_0x4412cc){if(_0x4412cc){_0x150fdd=_0x4412cc;_0x276496[_0x0611('0x30')]=_[_0x0611('0x31')](db[_0x0611('0x55')][_0x0611('0x48')]);_0x276496[_0x0611('0x32')]=_['keys'](_0x32dc65[_0x0611('0x32')]);_0x276496[_0x0611('0x33')]=_[_0x0611('0x34')](_0x276496[_0x0611('0x30')],_0x276496['query']);_0x2969c9[_0x0611('0x36')]=_[_0x0611('0x34')](_0x276496[_0x0611('0x30')],qs[_0x0611('0x35')](_0x32dc65[_0x0611('0x32')][_0x0611('0x35')]));_0x2969c9['attributes']=_0x2969c9[_0x0611('0x36')]['length']?_0x2969c9['attributes']:_0x276496['model'];_0x2969c9[_0x0611('0x3b')]=qs[_0x0611('0x3c')](_0x32dc65['query'][_0x0611('0x3c')]);_0x2969c9[_0x0611('0x3d')]=qs[_0x0611('0x33')](_[_0x0611('0x3e')](_0x32dc65[_0x0611('0x32')],_0x276496[_0x0611('0x33')]));if(_0x32dc65[_0x0611('0x32')][_0x0611('0x3f')]){_0x2969c9['where']=_[_0x0611('0x40')](_0x2969c9[_0x0611('0x3d')],{'$or':_[_0x0611('0x41')](_0x2969c9['attributes'],function(_0x3027db){var _0x5422bc={};_0x5422bc[_0x3027db]={'$like':'%'+_0x32dc65[_0x0611('0x32')][_0x0611('0x3f')]+'%'};return _0x5422bc;})});}_0x2969c9=_[_0x0611('0x40')]({},_0x2969c9,_0x32dc65[_0x0611('0x42')]);return _0x150fdd[_0x0611('0x58')](_0x2969c9);}})[_0x0611('0x25')](function(_0x4667de){if(_0x4667de){_0x164665=_0x4667de[_0x0611('0x37')];if(!_0x32dc65['query'][_0x0611('0x38')]('nolimit')){_0x2969c9[_0x0611('0x3a')]=qs[_0x0611('0x3a')](_0x32dc65['query']['limit']);_0x2969c9['offset']=qs[_0x0611('0x1e')](_0x32dc65[_0x0611('0x32')]['offset']);}return _0x150fdd['getContacts'](_0x2969c9);}})[_0x0611('0x25')](function(_0x37ffd2){if(_0x37ffd2){return _0x37ffd2?{'count':_0x164665,'rows':_0x37ffd2}:null;}})[_0x0611('0x25')](respondWithResult(_0x6703bb,null))[_0x0611('0x46')](handleError(_0x6703bb,null));}; \ No newline at end of file +var _0x30e4=['api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','reject','save','destroy','then','get','Companies','UserProfileResource','error','stack','name','send','index','CmCompany','describe','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','merge','where','filter','options','count','includeAll','include','findAll','catch','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','addContacts','CmContact','ids','omit','getContacts','findOne','rawAttributes','map','nolimit','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x273bd4,_0x202780){var _0x24cbcc=function(_0x241dcc){while(--_0x241dcc){_0x273bd4['push'](_0x273bd4['shift']());}};_0x24cbcc(++_0x202780);}(_0x30e4,0x141));var _0x430e=function(_0x388594,_0x21e329){_0x388594=_0x388594-0x0;var _0x1f0b02=_0x30e4[_0x388594];return _0x1f0b02;};'use strict';var pdf=require(_0x430e('0x0'));var emlformat=require(_0x430e('0x1'));var rimraf=require(_0x430e('0x2'));var zipdir=require(_0x430e('0x3'));var jsonpatch=require(_0x430e('0x4'));var rp=require('request-promise');var moment=require(_0x430e('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x430e('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x430e('0x7'));var fs=require('fs');var _=require(_0x430e('0x8'));var squel=require(_0x430e('0x9'));var crypto=require(_0x430e('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x430e('0xb'));var Papa=require(_0x430e('0xc'));var Redis=require(_0x430e('0xd'));var authService=require(_0x430e('0xe'));var qs=require(_0x430e('0xf'));var as=require(_0x430e('0x10'));var hardwareService=require(_0x430e('0x11'));var logger=require(_0x430e('0x12'))(_0x430e('0x13'));var utils=require(_0x430e('0x14'));var config=require(_0x430e('0x15'));var db=require(_0x430e('0x16'))['db'];function respondWithStatusCode(_0x47d191,_0x167f04){_0x167f04=_0x167f04||0xcc;return function(_0x3e1d3b){if(_0x3e1d3b){return _0x47d191[_0x430e('0x17')](_0x167f04);}return _0x47d191[_0x430e('0x18')](_0x167f04)[_0x430e('0x19')]();};}function respondWithResult(_0x5acc05,_0xcfcfba){_0xcfcfba=_0xcfcfba||0xc8;return function(_0x366804){if(_0x366804){return _0x5acc05[_0x430e('0x18')](_0xcfcfba)[_0x430e('0x1a')](_0x366804);}};}function respondWithFilteredResult(_0x557be7,_0x17784e){return function(_0x3e053c){if(_0x3e053c){var _0x5cb08e=_0x3e053c['count'],_0x49810f=_0x17784e[_0x430e('0x1b')],_0x3e9205=_0x17784e['offset']+_0x17784e[_0x430e('0x1c')],_0xd1499b;if(_0x3e9205>=_0x5cb08e){_0x3e9205=_0x5cb08e;_0xd1499b=0xc8;}else{_0xd1499b=0xce;}_0x557be7[_0x430e('0x18')](_0xd1499b);return _0x557be7[_0x430e('0x1d')]('Content-Range',_0x49810f+'-'+_0x3e9205+'/'+_0x5cb08e)[_0x430e('0x1a')](_0x3e053c);}return null;};}function patchUpdates(_0x5010aa){return function(_0x41105f){try{jsonpatch['apply'](_0x41105f,_0x5010aa,!![]);}catch(_0x1a480b){return BPromise[_0x430e('0x1e')](_0x1a480b);}return _0x41105f[_0x430e('0x1f')]();};}function saveUpdates(_0x5ce521,_0x2e9cd4){return function(_0x1ac0bf){if(_0x1ac0bf){return _0x1ac0bf['update'](_0x5ce521)['then'](function(_0x282f47){return _0x282f47;});}return null;};}function removeEntity(_0x31c810,_0x3690fb){return function(_0x25fc9b){if(_0x25fc9b){return _0x25fc9b[_0x430e('0x20')]()[_0x430e('0x21')](function(){var _0x48ff9e=_0x25fc9b[_0x430e('0x22')]({'plain':!![]});var _0x2e5b5c=_0x430e('0x23');return db[_0x430e('0x24')][_0x430e('0x20')]({'where':{'type':_0x2e5b5c,'resourceId':_0x48ff9e['id']}})[_0x430e('0x21')](function(){return _0x25fc9b;});})['then'](function(){_0x31c810[_0x430e('0x18')](0xcc)[_0x430e('0x19')]();});}};}function handleEntityNotFound(_0x448fed,_0x3987a9){return function(_0x136073){if(!_0x136073){_0x448fed['sendStatus'](0x194);}return _0x136073;};}function handleError(_0x56c361,_0x479510){_0x479510=_0x479510||0x1f4;return function(_0x363a1e){logger[_0x430e('0x25')](_0x363a1e[_0x430e('0x26')]);if(_0x363a1e[_0x430e('0x27')]){delete _0x363a1e['name'];}_0x56c361[_0x430e('0x18')](_0x479510)[_0x430e('0x28')](_0x363a1e);};}exports[_0x430e('0x29')]=function(_0x2e191c,_0x5a120a){var _0x20f47a={},_0x9b707d={},_0x535d9a={'count':0x0,'rows':[]};return db[_0x430e('0x2a')][_0x430e('0x2b')]()[_0x430e('0x21')](function(_0xa05f61){_0x9b707d[_0x430e('0x2c')]=_[_0x430e('0x2d')](_0xa05f61);_0x9b707d[_0x430e('0x2e')]=_['keys'](_0x2e191c['query']);_0x9b707d[_0x430e('0x2f')]=_[_0x430e('0x30')](_0x9b707d[_0x430e('0x2c')],_0x9b707d[_0x430e('0x2e')]);_0x20f47a[_0x430e('0x31')]=_['intersection'](_0x9b707d[_0x430e('0x2c')],qs[_0x430e('0x32')](_0x2e191c[_0x430e('0x2e')][_0x430e('0x32')]));_0x20f47a['attributes']=_0x20f47a[_0x430e('0x31')][_0x430e('0x33')]?_0x20f47a[_0x430e('0x31')]:_0x9b707d[_0x430e('0x2c')];if(!_0x2e191c[_0x430e('0x2e')][_0x430e('0x34')]('nolimit')){_0x20f47a[_0x430e('0x1c')]=qs[_0x430e('0x1c')](_0x2e191c[_0x430e('0x2e')]['limit']);_0x20f47a[_0x430e('0x1b')]=qs[_0x430e('0x1b')](_0x2e191c['query'][_0x430e('0x1b')]);}_0x20f47a[_0x430e('0x35')]=qs[_0x430e('0x36')](_0x2e191c['query'][_0x430e('0x36')]);_0x20f47a['where']=qs[_0x430e('0x2f')](_[_0x430e('0x37')](_0x2e191c[_0x430e('0x2e')],_0x9b707d[_0x430e('0x2f')]),_0xa05f61);if(_0x2e191c[_0x430e('0x2e')]['filter']){_0x20f47a['where']=_[_0x430e('0x38')](_0x20f47a[_0x430e('0x39')],{'$or':_['map'](_0x20f47a['attributes'],function(_0x152c93){var _0x150091={};_0x150091[_0x152c93]={'$like':'%'+_0x2e191c[_0x430e('0x2e')][_0x430e('0x3a')]+'%'};return _0x150091;})});}_0x20f47a=_['merge']({},_0x20f47a,_0x2e191c[_0x430e('0x3b')]);var _0x24c66c={'where':_0x20f47a[_0x430e('0x39')]};return db['CmCompany']['count'](_0x24c66c)['then'](function(_0x128d9e){_0x535d9a[_0x430e('0x3c')]=_0x128d9e;if(_0x2e191c['query'][_0x430e('0x3d')]){_0x20f47a[_0x430e('0x3e')]=[{'all':!![]}];}return db[_0x430e('0x2a')][_0x430e('0x3f')](_0x20f47a);})[_0x430e('0x21')](function(_0x4653cb){_0x535d9a['rows']=_0x4653cb;return _0x535d9a;})[_0x430e('0x21')](respondWithFilteredResult(_0x5a120a,_0x20f47a))[_0x430e('0x40')](handleError(_0x5a120a,null));})[_0x430e('0x40')](handleError(_0x5a120a,null));};exports['show']=function(_0x2e3e18,_0x29735e){var _0x59bd33={'raw':![],'where':{'id':_0x2e3e18[_0x430e('0x41')]['id']}},_0x15eaee={};_0x15eaee[_0x430e('0x2c')]=_['keys'](db[_0x430e('0x2a')]['rawAttributes']);_0x15eaee[_0x430e('0x2e')]=_[_0x430e('0x2d')](_0x2e3e18[_0x430e('0x2e')]);_0x15eaee[_0x430e('0x2f')]=_[_0x430e('0x30')](_0x15eaee[_0x430e('0x2c')],_0x15eaee['query']);_0x59bd33['attributes']=_[_0x430e('0x30')](_0x15eaee[_0x430e('0x2c')],qs[_0x430e('0x32')](_0x2e3e18[_0x430e('0x2e')]['fields']));_0x59bd33[_0x430e('0x31')]=_0x59bd33[_0x430e('0x31')][_0x430e('0x33')]?_0x59bd33['attributes']:_0x15eaee[_0x430e('0x2c')];if(_0x2e3e18['query'][_0x430e('0x3d')]){_0x59bd33[_0x430e('0x3e')]=[{'all':!![]}];}_0x59bd33=_[_0x430e('0x38')]({},_0x59bd33,_0x2e3e18[_0x430e('0x3b')]);return db['CmCompany'][_0x430e('0x42')](_0x59bd33)['then'](handleEntityNotFound(_0x29735e,null))['then'](respondWithResult(_0x29735e,null))['catch'](handleError(_0x29735e,null));};exports[_0x430e('0x43')]=function(_0x52bb49,_0x3f3f0b){return db[_0x430e('0x2a')]['create'](_0x52bb49['body'],{})[_0x430e('0x21')](function(_0x559ab0){var _0x4ff039=_0x52bb49[_0x430e('0x44')][_0x430e('0x22')]({'plain':!![]});if(!_0x4ff039)throw new Error(_0x430e('0x45'));if(_0x4ff039[_0x430e('0x46')]==='user'){var _0x32c201=_0x559ab0[_0x430e('0x22')]({'plain':!![]});var _0x5dd0b6=_0x430e('0x23');return db[_0x430e('0x47')][_0x430e('0x42')]({'where':{'name':_0x5dd0b6,'userProfileId':_0x4ff039[_0x430e('0x48')]},'raw':!![]})[_0x430e('0x21')](function(_0x3c537a){if(_0x3c537a&&_0x3c537a['autoAssociation']===0x0){return db[_0x430e('0x24')]['create']({'name':_0x32c201[_0x430e('0x27')],'resourceId':_0x32c201['id'],'type':_0x3c537a[_0x430e('0x27')],'sectionId':_0x3c537a['id']},{})[_0x430e('0x21')](function(){return _0x559ab0;});}else{return _0x559ab0;}})['catch'](function(_0x2ffb36){logger[_0x430e('0x25')](_0x430e('0x49'),_0x2ffb36);throw _0x2ffb36;});}return _0x559ab0;})[_0x430e('0x21')](respondWithResult(_0x3f3f0b,0xc9))[_0x430e('0x40')](handleError(_0x3f3f0b,null));};exports[_0x430e('0x4a')]=function(_0x23f22f,_0x2c51b7){if(_0x23f22f['body']['id']){delete _0x23f22f[_0x430e('0x4b')]['id'];}return db[_0x430e('0x2a')]['find']({'where':{'id':_0x23f22f['params']['id']}})[_0x430e('0x21')](handleEntityNotFound(_0x2c51b7,null))[_0x430e('0x21')](saveUpdates(_0x23f22f[_0x430e('0x4b')],null))['then'](respondWithResult(_0x2c51b7,null))[_0x430e('0x40')](handleError(_0x2c51b7,null));};exports[_0x430e('0x20')]=function(_0x4b3a6b,_0x568f3c){return db['CmCompany'][_0x430e('0x42')]({'where':{'id':_0x4b3a6b[_0x430e('0x41')]['id']}})[_0x430e('0x21')](handleEntityNotFound(_0x568f3c,null))[_0x430e('0x21')](removeEntity(_0x568f3c,null))[_0x430e('0x40')](handleError(_0x568f3c,null));};exports[_0x430e('0x2b')]=function(_0x34a157,_0x33517d){return db[_0x430e('0x2a')][_0x430e('0x2b')]()[_0x430e('0x21')](respondWithResult(_0x33517d,null))[_0x430e('0x40')](handleError(_0x33517d,null));};exports[_0x430e('0x4c')]=function(_0x5e9c65,_0x2e4f40,_0x550c5b){return db[_0x430e('0x4d')]['find']({'where':{'id':_0x5e9c65[_0x430e('0x41')]['id']}})['then'](handleEntityNotFound(_0x2e4f40,null))[_0x430e('0x21')](function(_0x5c0c6d){if(_0x5c0c6d){return _0x5c0c6d[_0x430e('0x4c')](_0x5e9c65['body'][_0x430e('0x4e')],_[_0x430e('0x4f')](_0x5e9c65[_0x430e('0x4b')],[_0x430e('0x4e'),'id'])||{});}})['then'](respondWithResult(_0x2e4f40,null))[_0x430e('0x40')](handleError(_0x2e4f40,null));};exports[_0x430e('0x50')]=function(_0x324b8b,_0x451e7f,_0x293946){var _0x578559={};var _0x488526={};var _0x5db935;var _0x597814;return db['CmCompany'][_0x430e('0x51')]({'where':{'id':_0x324b8b[_0x430e('0x41')]['id']}})[_0x430e('0x21')](handleEntityNotFound(_0x451e7f,null))[_0x430e('0x21')](function(_0x4e7bdc){if(_0x4e7bdc){_0x5db935=_0x4e7bdc;_0x488526[_0x430e('0x2c')]=_[_0x430e('0x2d')](db[_0x430e('0x4d')][_0x430e('0x52')]);_0x488526[_0x430e('0x2e')]=_[_0x430e('0x2d')](_0x324b8b[_0x430e('0x2e')]);_0x488526[_0x430e('0x2f')]=_[_0x430e('0x30')](_0x488526['model'],_0x488526['query']);_0x578559[_0x430e('0x31')]=_['intersection'](_0x488526[_0x430e('0x2c')],qs[_0x430e('0x32')](_0x324b8b[_0x430e('0x2e')][_0x430e('0x32')]));_0x578559['attributes']=_0x578559[_0x430e('0x31')][_0x430e('0x33')]?_0x578559[_0x430e('0x31')]:_0x488526[_0x430e('0x2c')];_0x578559[_0x430e('0x35')]=qs['sort'](_0x324b8b['query'][_0x430e('0x36')]);_0x578559[_0x430e('0x39')]=qs[_0x430e('0x2f')](_['pick'](_0x324b8b[_0x430e('0x2e')],_0x488526[_0x430e('0x2f')]));if(_0x324b8b['query'][_0x430e('0x3a')]){_0x578559['where']=_[_0x430e('0x38')](_0x578559[_0x430e('0x39')],{'$or':_[_0x430e('0x53')](_0x578559['attributes'],function(_0x1802cd){var _0x4dc1ff={};_0x4dc1ff[_0x1802cd]={'$like':'%'+_0x324b8b['query'][_0x430e('0x3a')]+'%'};return _0x4dc1ff;})});}_0x578559=_[_0x430e('0x38')]({},_0x578559,_0x324b8b[_0x430e('0x3b')]);return _0x5db935['getContacts'](_0x578559);}})[_0x430e('0x21')](function(_0x4e167f){if(_0x4e167f){_0x597814=_0x4e167f[_0x430e('0x33')];if(!_0x324b8b['query'][_0x430e('0x34')](_0x430e('0x54'))){_0x578559[_0x430e('0x1c')]=qs[_0x430e('0x1c')](_0x324b8b['query']['limit']);_0x578559[_0x430e('0x1b')]=qs[_0x430e('0x1b')](_0x324b8b[_0x430e('0x2e')][_0x430e('0x1b')]);}return _0x5db935[_0x430e('0x50')](_0x578559);}})[_0x430e('0x21')](function(_0x2e7dda){if(_0x2e7dda){return _0x2e7dda?{'count':_0x597814,'rows':_0x2e7dda}:null;}})[_0x430e('0x21')](respondWithResult(_0x451e7f,null))[_0x430e('0x40')](handleError(_0x451e7f,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 237651d..dc9766a 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 _0xa786=['moment','bluebird','request-promise','path','rimraf','./cmCompany.attributes','exports','define','CmCompany','cm_companies','../../config/logger','api'];(function(_0x15b303,_0x68ba03){var _0x404ec6=function(_0x38064a){while(--_0x38064a){_0x15b303['push'](_0x15b303['shift']());}};_0x404ec6(++_0x68ba03);}(_0xa786,0x1d2));var _0x6a78=function(_0x519a12,_0x1990a9){_0x519a12=_0x519a12-0x0;var _0xd96043=_0xa786[_0x519a12];return _0xd96043;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6a78('0x0'))(_0x6a78('0x1'));var moment=require(_0x6a78('0x2'));var BPromise=require(_0x6a78('0x3'));var rp=require(_0x6a78('0x4'));var fs=require('fs');var path=require(_0x6a78('0x5'));var rimraf=require(_0x6a78('0x6'));var config=require('../../config/environment');var attributes=require(_0x6a78('0x7'));module[_0x6a78('0x8')]=function(_0xc0be8b,_0x45470e){return _0xc0be8b[_0x6a78('0x9')](_0x6a78('0xa'),attributes,{'tableName':_0x6a78('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x979e=['CmCompany','cm_companies','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x3524c8,_0x290d56){var _0x5d6b9e=function(_0x410475){while(--_0x410475){_0x3524c8['push'](_0x3524c8['shift']());}};_0x5d6b9e(++_0x290d56);}(_0x979e,0x195));var _0xe979=function(_0x31d2fa,_0x1a43dd){_0x31d2fa=_0x31d2fa-0x0;var _0xbeb964=_0x979e[_0x31d2fa];return _0xbeb964;};'use strict';var _=require(_0xe979('0x0'));var util=require(_0xe979('0x1'));var logger=require(_0xe979('0x2'))(_0xe979('0x3'));var moment=require('moment');var BPromise=require(_0xe979('0x4'));var rp=require(_0xe979('0x5'));var fs=require('fs');var path=require(_0xe979('0x6'));var rimraf=require(_0xe979('0x7'));var config=require(_0xe979('0x8'));var attributes=require('./cmCompany.attributes');module[_0xe979('0x9')]=function(_0x580e20,_0x1a0d35){return _0x580e20[_0xe979('0xa')](_0xe979('0xb'),attributes,{'tableName':_0xe979('0xc'),'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 cb144a2..7a80a84 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 _0xd519=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','CmCompany,\x20%s,\x20%s','request\x20sent','CmCompany,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xd519,0x101));var _0x9d51=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xd519[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0x9d51('0x0'));var moment=require(_0x9d51('0x1'));var BPromise=require(_0x9d51('0x2'));var rs=require(_0x9d51('0x3'));var fs=require('fs');var Redis=require(_0x9d51('0x4'));var db=require(_0x9d51('0x5'))['db'];var utils=require(_0x9d51('0x6'));var logger=require(_0x9d51('0x7'))(_0x9d51('0x8'));var config=require(_0x9d51('0x9'));var jayson=require(_0x9d51('0xa'));var client=jayson[_0x9d51('0xb')][_0x9d51('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x46b90c,_0x442f41,_0x2c79a7){return new BPromise(function(_0x268a9b,_0x17146c){return client[_0x9d51('0xd')](_0x46b90c,_0x2c79a7)['then'](function(_0x3fa485){logger['info'](_0x9d51('0xe'),_0x442f41,_0x9d51('0xf'));logger['debug'](_0x9d51('0x10'),_0x442f41,'request\x20sent',JSON[_0x9d51('0x11')](_0x3fa485));if(_0x3fa485['error']){if(_0x3fa485['error'][_0x9d51('0x12')]===0x1f4){logger[_0x9d51('0x13')](_0x9d51('0xe'),_0x442f41,_0x3fa485['error'][_0x9d51('0x14')]);return _0x17146c(_0x3fa485[_0x9d51('0x13')]['message']);}logger[_0x9d51('0x13')]('CmCompany,\x20%s,\x20%s',_0x442f41,_0x3fa485[_0x9d51('0x13')][_0x9d51('0x14')]);return _0x268a9b(_0x3fa485[_0x9d51('0x13')][_0x9d51('0x14')]);}else{logger[_0x9d51('0x15')](_0x9d51('0xe'),_0x442f41,_0x9d51('0xf'));_0x268a9b(_0x3fa485[_0x9d51('0x16')][_0x9d51('0x14')]);}})[_0x9d51('0x17')](function(_0x2ffff7){logger['error']('CmCompany,\x20%s,\x20%s',_0x442f41,_0x2ffff7);_0x17146c(_0x2ffff7);});});} \ No newline at end of file +var _0x41ab=['lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','CmCompany,\x20%s,\x20%s','debug','CmCompany,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch'];(function(_0x2e6dbf,_0x57dd06){var _0x2680e5=function(_0x4018f4){while(--_0x4018f4){_0x2e6dbf['push'](_0x2e6dbf['shift']());}};_0x2680e5(++_0x57dd06);}(_0x41ab,0x1ce));var _0xb41a=function(_0x3b32a9,_0x3c30d9){_0x3b32a9=_0x3b32a9-0x0;var _0x128c34=_0x41ab[_0x3b32a9];return _0x128c34;};'use strict';var _=require(_0xb41a('0x0'));var util=require(_0xb41a('0x1'));var moment=require(_0xb41a('0x2'));var BPromise=require('bluebird');var rs=require(_0xb41a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb41a('0x4'));var logger=require(_0xb41a('0x5'))(_0xb41a('0x6'));var config=require(_0xb41a('0x7'));var jayson=require(_0xb41a('0x8'));var client=jayson[_0xb41a('0x9')][_0xb41a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x8914c2,_0x4f3211,_0x78e6d1){return new BPromise(function(_0x1f78d6,_0x4e3828){return client[_0xb41a('0xb')](_0x8914c2,_0x78e6d1)['then'](function(_0x256f3d){logger[_0xb41a('0xc')](_0xb41a('0xd'),_0x4f3211,'request\x20sent');logger[_0xb41a('0xe')](_0xb41a('0xf'),_0x4f3211,_0xb41a('0x10'),JSON[_0xb41a('0x11')](_0x256f3d));if(_0x256f3d[_0xb41a('0x12')]){if(_0x256f3d[_0xb41a('0x12')]['code']===0x1f4){logger[_0xb41a('0x12')](_0xb41a('0xd'),_0x4f3211,_0x256f3d[_0xb41a('0x12')][_0xb41a('0x13')]);return _0x4e3828(_0x256f3d['error'][_0xb41a('0x13')]);}logger[_0xb41a('0x12')]('CmCompany,\x20%s,\x20%s',_0x4f3211,_0x256f3d[_0xb41a('0x12')]['message']);return _0x1f78d6(_0x256f3d[_0xb41a('0x12')]['message']);}else{logger[_0xb41a('0xc')](_0xb41a('0xd'),_0x4f3211,_0xb41a('0x10'));_0x1f78d6(_0x256f3d['result']['message']);}})[_0xb41a('0x14')](function(_0xbe9bb5){logger[_0xb41a('0x12')](_0xb41a('0xd'),_0x4f3211,_0xbe9bb5);_0x4e3828(_0xbe9bb5);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 9c16f92..249299c 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 _0x25e7=['get','/:id','show','/:id/contacts','getContacts','post','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCompany.controller','index','isAuthenticated','describe'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x25e7,0x1d6));var _0x725e=function(_0x200703,_0x4cccfd){_0x200703=_0x200703-0x0;var _0x5a32dc=_0x25e7[_0x200703];return _0x5a32dc;};'use strict';var multer=require(_0x725e('0x0'));var util=require(_0x725e('0x1'));var path=require(_0x725e('0x2'));var timeout=require(_0x725e('0x3'));var express=require(_0x725e('0x4'));var router=express[_0x725e('0x5')]();var auth=require(_0x725e('0x6'));var interaction=require(_0x725e('0x7'));var config=require(_0x725e('0x8'));var controller=require(_0x725e('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x725e('0xa')]);router['get']('/describe',auth[_0x725e('0xb')](),controller[_0x725e('0xc')]);router[_0x725e('0xd')](_0x725e('0xe'),auth[_0x725e('0xb')](),controller[_0x725e('0xf')]);router[_0x725e('0xd')](_0x725e('0x10'),auth[_0x725e('0xb')](),controller[_0x725e('0x11')]);router[_0x725e('0x12')]('/',auth[_0x725e('0xb')](),controller['create']);router['post'](_0x725e('0x10'),auth[_0x725e('0xb')](),controller['addContacts']);router['put'](_0x725e('0xe'),auth[_0x725e('0xb')](),controller['update']);router[_0x725e('0x13')](_0x725e('0xe'),auth[_0x725e('0xb')](),controller['destroy']);module[_0x725e('0x14')]=router; \ No newline at end of file +var _0x430c=['Router','get','isAuthenticated','describe','/:id','show','/:id/contacts','post','put','update','delete','multer','connect-timeout','express'];(function(_0x2b3c75,_0x8995c6){var _0x289c7a=function(_0x45cee3){while(--_0x45cee3){_0x2b3c75['push'](_0x2b3c75['shift']());}};_0x289c7a(++_0x8995c6);}(_0x430c,0x1a1));var _0xc430=function(_0x59342a,_0x16827b){_0x59342a=_0x59342a-0x0;var _0x17abc9=_0x430c[_0x59342a];return _0x17abc9;};'use strict';var multer=require(_0xc430('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xc430('0x1'));var express=require(_0xc430('0x2'));var router=express[_0xc430('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./cmCompany.controller');router[_0xc430('0x4')]('/',auth[_0xc430('0x5')](),controller['index']);router[_0xc430('0x4')]('/describe',auth[_0xc430('0x5')](),controller[_0xc430('0x6')]);router[_0xc430('0x4')](_0xc430('0x7'),auth[_0xc430('0x5')](),controller[_0xc430('0x8')]);router[_0xc430('0x4')](_0xc430('0x9'),auth[_0xc430('0x5')](),controller['getContacts']);router[_0xc430('0xa')]('/',auth[_0xc430('0x5')](),controller['create']);router[_0xc430('0xa')]('/:id/contacts',auth[_0xc430('0x5')](),controller['addContacts']);router[_0xc430('0xb')](_0xc430('0x7'),auth[_0xc430('0x5')](),controller[_0xc430('0xc')]);router[_0xc430('0xd')](_0xc430('0x7'),auth[_0xc430('0x5')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 01e2a6a..37c821f 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 _0xc37e=['sequelize','exports','STRING','INTEGER','UNSIGNED','DATE','NOW','lodash'];(function(_0x5d8027,_0x372235){var _0x135a7a=function(_0xe5e5db){while(--_0xe5e5db){_0x5d8027['push'](_0x5d8027['shift']());}};_0x135a7a(++_0x372235);}(_0xc37e,0x9f));var _0xec37=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0xc37e[_0x46e363];return _0x3fb059;};'use strict';var _=require(_0xec37('0x0'));var Sequelize=require(_0xec37('0x1'));module[_0xec37('0x2')]={'firstName':{'type':Sequelize[_0xec37('0x3')],'allowNull':![]},'lastName':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0xec37('0x3')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0xec37('0x3')]},'country':{'type':Sequelize[_0xec37('0x3')]},'dateOfBirth':{'type':Sequelize['STRING']},'description':{'type':Sequelize['TEXT']},'phone':{'type':Sequelize[_0xec37('0x3')]},'mobile':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0xec37('0x3')]},'email':{'type':Sequelize[_0xec37('0x3')]},'url':{'type':Sequelize[_0xec37('0x3')]},'facebook':{'type':Sequelize[_0xec37('0x3')]},'fb_data':{'type':Sequelize[_0xec37('0x3')]},'twitter':{'type':Sequelize[_0xec37('0x3')]},'skype':{'type':Sequelize[_0xec37('0x3')]},'teams':{'type':Sequelize[_0xec37('0x3')]},'viber':{'type':Sequelize[_0xec37('0x3')]},'line':{'type':Sequelize[_0xec37('0x3')]},'wechat':{'type':Sequelize[_0xec37('0x3')]},'telegram':{'type':Sequelize[_0xec37('0x3')]},'UserId':{'type':Sequelize[_0xec37('0x4')]},'priority':{'type':Sequelize[_0xec37('0x4')](0x2)[_0xec37('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xec37('0x6')],'defaultValue':Sequelize[_0xec37('0x7')]}}; \ No newline at end of file +var _0x0e69=['UNSIGNED','DATE','lodash','exports','STRING','INTEGER'];(function(_0x387616,_0x2efd13){var _0x220c72=function(_0x597ee6){while(--_0x597ee6){_0x387616['push'](_0x387616['shift']());}};_0x220c72(++_0x2efd13);}(_0x0e69,0x1ca));var _0x90e6=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x0e69[_0x4243a3];return _0x1b2a33;};'use strict';var _=require(_0x90e6('0x0'));var Sequelize=require('sequelize');module[_0x90e6('0x1')]={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize[_0x90e6('0x2')]},'street':{'type':Sequelize[_0x90e6('0x2')]},'postalCode':{'type':Sequelize[_0x90e6('0x2')]},'city':{'type':Sequelize[_0x90e6('0x2')]},'country':{'type':Sequelize[_0x90e6('0x2')]},'dateOfBirth':{'type':Sequelize['STRING']},'description':{'type':Sequelize['TEXT']},'phone':{'type':Sequelize[_0x90e6('0x2')]},'mobile':{'type':Sequelize['STRING']},'fax':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x90e6('0x2')]},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize[_0x90e6('0x2')]},'fb_data':{'type':Sequelize[_0x90e6('0x2')]},'twitter':{'type':Sequelize[_0x90e6('0x2')]},'skype':{'type':Sequelize[_0x90e6('0x2')]},'teams':{'type':Sequelize[_0x90e6('0x2')]},'viber':{'type':Sequelize[_0x90e6('0x2')]},'line':{'type':Sequelize[_0x90e6('0x2')]},'wechat':{'type':Sequelize[_0x90e6('0x2')]},'telegram':{'type':Sequelize[_0x90e6('0x2')]},'UserId':{'type':Sequelize[_0x90e6('0x3')]},'priority':{'type':Sequelize[_0x90e6('0x3')](0x2)[_0x90e6('0x4')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x90e6('0x5')],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index d710420..d6647b7 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 _0x361b=['push','CmCustomField','findOne','trimStart','cf_','all','length','fieldType','type','model','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','select','field','from','tools_tags','left_join','uc.CmContactId\x20=\x20c.id','t.id\x20=\x20ct.TagId','c.deletedAt\x20IS\x20NULL','expr','search','parseSearch','sqlOperator','conditions','find','Tag','split','map','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','and','uc.UserId\x20=\x20?','value','dateOfBirth','datetime','castTo','DATE','buildExpression','start','hasOwnProperty','filter','isNil','Contact','isEmpty','forEach','ListId','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','tag','replace','\x27\x27\x27\x27','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.lastName\x20LIKE\x20?','group','Sequelize','SELECT','clone','DESC','having','t.id\x20IN\x20?','resolve','some','user','getLists','c.ListId\x20IS\x20NULL','c.ListId\x20IN\x20?','toString','sequelize','keyBy','merge','CmContact','c.id','c.lastName','c.deletedAt','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','Tags','rows','params','catch','columnName','displayName','alias','custom','values','body','findAll','get','isArray','tags','join','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','OpenchannelMessage','CmHopperHistory','ReportAgentPreview','ChatQueueReport','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','bulkCreate','duplicates','$or','findOrCreate','show','color','$and','omit','cf_%d','pickBy','startsWith','cm_contacts','setFields','id\x20=\x20?','toParam','phone','CmHopper','rawAttributes','getTags','setTags','getHoppers','options','ContactId','getHopperFinals','CmHopperFinal','includeAll','include','getJscriptySessions','uploadCsv','No\x20ListId\x20specified','binding_keys','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','No\x20firstName\x20column\x20specified','root','server/files/tmp','file','filename','chmodSync','0777','fork','../../components/import/cm/csv','CompanyId','File\x20uploaded\x20correctly!','createReadStream','meta','agent','binding','firstName','child_process','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','pid','exit','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','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','../../config/environment','../../mysqldb','defaults','redis','socket.io-emitter','status','count','offset','limit','set','json','apply','reject','save','update','then','destroy','end','sendStatus','error','stack','name','send','describe','keys'];(function(_0x4cb57a,_0x38366a){var _0x5670ba=function(_0x56b288){while(--_0x56b288){_0x4cb57a['push'](_0x4cb57a['shift']());}};_0x5670ba(++_0x38366a);}(_0x361b,0x1ad));var _0xb361=function(_0x32d675,_0x25b027){_0x32d675=_0x32d675-0x0;var _0x1c1343=_0x361b[_0x32d675];return _0x1c1343;};'use strict';var pdf=require(_0xb361('0x0'));var emlformat=require(_0xb361('0x1'));var rimraf=require(_0xb361('0x2'));var zipdir=require(_0xb361('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb361('0x4'));var moment=require(_0xb361('0x5'));var BPromise=require(_0xb361('0x6'));var Mustache=require('mustache');var util=require(_0xb361('0x7'));var path=require('path');var sox=require(_0xb361('0x8'));var csv=require(_0xb361('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xb361('0xa'));var squel=require(_0xb361('0xb'));var crypto=require(_0xb361('0xc'));var jsforce=require(_0xb361('0xd'));var deskjs=require(_0xb361('0xe'));var toCsv=require('to-csv');var querystring=require(_0xb361('0xf'));var Papa=require(_0xb361('0x10'));var Redis=require(_0xb361('0x11'));var authService=require(_0xb361('0x12'));var qs=require(_0xb361('0x13'));var as=require(_0xb361('0x14'));var hardwareService=require(_0xb361('0x15'));var logger=require(_0xb361('0x16'))(_0xb361('0x17'));var utils=require('../../config/utils');var config=require(_0xb361('0x18'));var db=require(_0xb361('0x19'))['db'];config['redis']=_[_0xb361('0x1a')](config[_0xb361('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0xb361('0x1c'))(new Redis(config[_0xb361('0x1b')]));require('./cmContact.socket')['register'](socket);function respondWithStatusCode(_0x383443,_0x145bdb){_0x145bdb=_0x145bdb||0xcc;return function(_0x372dd7){if(_0x372dd7){return _0x383443['sendStatus'](_0x145bdb);}return _0x383443[_0xb361('0x1d')](_0x145bdb)['end']();};}function respondWithResult(_0x153e6f,_0xe87557){_0xe87557=_0xe87557||0xc8;return function(_0x364988){if(_0x364988){return _0x153e6f[_0xb361('0x1d')](_0xe87557)['json'](_0x364988);}};}function respondWithFilteredResult(_0x5e98ff,_0x3099d2){return function(_0xbc5a87){if(_0xbc5a87){var _0x1d91ba=_0xbc5a87[_0xb361('0x1e')],_0x299391=_0x3099d2[_0xb361('0x1f')],_0x38d410=_0x3099d2[_0xb361('0x1f')]+_0x3099d2[_0xb361('0x20')],_0x209385;if(_0x38d410>=_0x1d91ba){_0x38d410=_0x1d91ba;_0x209385=0xc8;}else{_0x209385=0xce;}_0x5e98ff['status'](_0x209385);return _0x5e98ff[_0xb361('0x21')]('Content-Range',_0x299391+'-'+_0x38d410+'/'+_0x1d91ba)[_0xb361('0x22')](_0xbc5a87);}return null;};}function patchUpdates(_0x2a0772){return function(_0x4464d2){try{jsonpatch[_0xb361('0x23')](_0x4464d2,_0x2a0772,!![]);}catch(_0x370360){return BPromise[_0xb361('0x24')](_0x370360);}return _0x4464d2[_0xb361('0x25')]();};}function saveUpdates(_0x36dec8,_0xe9627b){return function(_0x78339c){if(_0x78339c){return _0x78339c[_0xb361('0x26')](_0x36dec8)[_0xb361('0x27')](function(_0x51777d){return _0x51777d;});}return null;};}function removeEntity(_0x35c8a8,_0xb4efff){return function(_0x343136){if(_0x343136){return _0x343136[_0xb361('0x28')]()['then'](function(){_0x35c8a8['status'](0xcc)[_0xb361('0x29')]();});}};}function handleEntityNotFound(_0x595d87,_0x531f4a){return function(_0x662463){if(!_0x662463){_0x595d87[_0xb361('0x2a')](0x194);}return _0x662463;};}function handleError(_0x475e91,_0x595fd3){_0x595fd3=_0x595fd3||0x1f4;return function(_0x1f4e39){logger[_0xb361('0x2b')](_0x1f4e39[_0xb361('0x2c')]);if(_0x1f4e39[_0xb361('0x2d')]){delete _0x1f4e39[_0xb361('0x2d')];}_0x475e91[_0xb361('0x1d')](_0x595fd3)[_0xb361('0x2e')](_0x1f4e39);};}exports['index']=function(_0x366b08,_0x4d4ced){var _0x220a77={},_0x216abb={},_0x34b8ce={'count':0x0,'rows':[]};return db['CmContact'][_0xb361('0x2f')]()[_0xb361('0x27')](function(_0x1c78bd){var _0x2da86e=[];for(var _0x5ef0ba=0x0;_0x5ef0ba0x1){_0x477c31['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xb361('0x6e')](_0xbff04f),null);}else{if(qs[_0xb361('0x6f')](_0xbff04f)){_0x477c31['or'](_0xb361('0x70'),_0xbff04f+'%');_0x477c31['or'](_0xb361('0x71'),_0xbff04f+'%');_0x477c31['or']('c.mobile\x20LIKE\x20?',_0xbff04f+'%');_0x477c31['or'](_0xb361('0x72'),_0xbff04f+'%');}else if(qs[_0xb361('0x73')](_0xbff04f)){_0x477c31['or'](_0xb361('0x74'),_0xbff04f+'%');}else{_0x477c31['or']('c.firstName\x20LIKE\x20?','%'+_0xbff04f+'%');_0x477c31['or'](_0xb361('0x75'),'%'+_0xbff04f+'%');_0x477c31['or']('c.email\x20LIKE\x20?','%'+_0xbff04f+'%');}}}}_0x540ef9['where'](_0x477c31);_0x540ef9[_0xb361('0x76')]('c.id');var _0x536d34={'type':db[_0xb361('0x77')]['QueryTypes'][_0xb361('0x78')],'raw':!![]};var _0x23280d=_0x540ef9[_0xb361('0x79')]()[_0xb361('0x46')]('c.id');if(_0x220a77[_0xb361('0x41')]){_0x220a77[_0xb361('0x41')][_0xb361('0x67')](function(_0x4b76df){_0x540ef9[_0xb361('0x41')]('c.'+_0x4b76df[0x0],_0x4b76df[0x1]===_0xb361('0x7a')?![]:!![]);});}if(!_[_0xb361('0x66')](_0x38b73a)){_0x540ef9[_0xb361('0x7b')](_0x36c5f1);_0x23280d['where'](_0xb361('0x7c'),_0x38b73a);}BPromise[_0xb361('0x7d')]()[_0xb361('0x27')](function(){if(_0x444b7e&&!_[_0xb361('0x7e')](_0x444b7e[_0xb361('0x51')],[_0xb361('0x46'),_0xb361('0x58')])){return _0x366b08[_0xb361('0x7f')][_0xb361('0x80')]({'attributes':['id'],'raw':!![]})[_0xb361('0x27')](function(_0x295a75){if(_['isEmpty'](_0x295a75)){_0x23280d['where'](_0xb361('0x81'));_0x540ef9['where'](_0xb361('0x81'));}else{_0x23280d[_0xb361('0x43')](_0xb361('0x82'),_['map'](_0x295a75,'id'));_0x540ef9[_0xb361('0x43')](_0xb361('0x82'),_[_0xb361('0x55')](_0x295a75,'id'));}});}else{return;}})[_0xb361('0x27')](function(){db['sequelize'][_0xb361('0x3b')](_0x23280d[_0xb361('0x83')](),_0x536d34)['then'](function(_0x55275b){_0x34b8ce[_0xb361('0x1e')]=_0x55275b['length'];if(_0x34b8ce[_0xb361('0x1e')]===0x0)return[];return db[_0xb361('0x84')][_0xb361('0x3b')](_0x169165[_0xb361('0x83')](),_0x536d34);})[_0xb361('0x27')](function(_0x4ca782){_0x4bdd3f=_[_0xb361('0x85')](_0x4ca782,'id');_0x536d34=_[_0xb361('0x86')](_0x536d34,{'model':db[_0xb361('0x87')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x366b08[_0xb361('0x3b')][_0xb361('0x3f')]){_0x220a77[_0xb361('0x3e')]['forEach'](function(_0x120ff4){_0x540ef9[_0xb361('0x46')]('c.'+_0x120ff4);});}else{_0x540ef9[_0xb361('0x46')](_0xb361('0x88'));_0x540ef9[_0xb361('0x46')]('c.firstName');_0x540ef9[_0xb361('0x46')](_0xb361('0x89'));_0x540ef9[_0xb361('0x46')]('c.phone');_0x540ef9[_0xb361('0x46')]('c.mobile');_0x540ef9[_0xb361('0x46')]('c.fax');_0x540ef9[_0xb361('0x46')]('c.email');_0x540ef9[_0xb361('0x46')]('c.ListId');_0x540ef9[_0xb361('0x46')](_0xb361('0x8a'));_0x540ef9[_0xb361('0x46')](_0xb361('0x8b'),_0xb361('0x8c'));}if(_0x220a77[_0xb361('0x20')])_0x540ef9[_0xb361('0x20')](_0x220a77['limit']);if(_0x220a77['offset'])_0x540ef9[_0xb361('0x1f')](_0x220a77['offset']);return db['sequelize'][_0xb361('0x3b')](_0x540ef9[_0xb361('0x83')](),_0x536d34);})[_0xb361('0x27')](function(_0x3b6567){_0x3b6567[_0xb361('0x67')](function(_0xd14343){if(_0xd14343[_0xb361('0x8c')]){_0xd14343[_0xb361('0x8d')]=[];_0xd14343[_0xb361('0x8c')][_0xb361('0x54')](',')[_0xb361('0x67')](function(_0x4834b9){_0xd14343[_0xb361('0x8d')][_0xb361('0x31')](_0x4bdd3f[_0x4834b9]);});}delete _0xd14343['TagIds'];});_0x34b8ce[_0xb361('0x8e')]=_0x3b6567;return _0x34b8ce;})[_0xb361('0x27')](respondWithFilteredResult(_0x4d4ced,_0x220a77));});})['catch'](handleError(_0x4d4ced,null));};exports[_0xb361('0x28')]=function(_0x22b7a8,_0x5af60a){return db['CmContact'][_0xb361('0x52')]({'where':{'id':_0x22b7a8[_0xb361('0x8f')]['id']}})[_0xb361('0x27')](handleEntityNotFound(_0x5af60a,null))[_0xb361('0x27')](removeEntity(_0x5af60a,null))[_0xb361('0x90')](handleError(_0x5af60a,null));};exports[_0xb361('0x2f')]=function(_0x531a74,_0x15789a){return db[_0xb361('0x87')]['describe']()[_0xb361('0x27')](function(_0x5c5241){delete _0x5c5241['tags'];for(var _0x4071f3=0x0;_0x4071f3=_0x85c2a6){_0x3e42cd=_0x85c2a6;_0xba00f9=0xc8;}else{_0xba00f9=0xce;}_0x12871d[_0x8d24('0x1c')](_0xba00f9);return _0x12871d[_0x8d24('0x22')](_0x8d24('0x23'),_0x3bb7ba+'-'+_0x3e42cd+'/'+_0x85c2a6)[_0x8d24('0x1e')](_0x4fe627);}return null;};}function patchUpdates(_0x5e28d9){return function(_0x21bb1f){try{jsonpatch['apply'](_0x21bb1f,_0x5e28d9,!![]);}catch(_0x14cf15){return BPromise[_0x8d24('0x24')](_0x14cf15);}return _0x21bb1f[_0x8d24('0x25')]();};}function saveUpdates(_0x4c5da1,_0x20fc80){return function(_0x5d93d8){if(_0x5d93d8){return _0x5d93d8[_0x8d24('0x26')](_0x4c5da1)['then'](function(_0x5cf2ad){return _0x5cf2ad;});}return null;};}function removeEntity(_0x3eafa3,_0x303cd1){return function(_0x54461a){if(_0x54461a){return _0x54461a[_0x8d24('0x27')]()[_0x8d24('0x28')](function(){_0x3eafa3[_0x8d24('0x1c')](0xcc)[_0x8d24('0x1d')]();});}};}function handleEntityNotFound(_0x2f35a9,_0x2342ed){return function(_0x3dfbba){if(!_0x3dfbba){_0x2f35a9['sendStatus'](0x194);}return _0x3dfbba;};}function handleError(_0x3530cd,_0x33e062){_0x33e062=_0x33e062||0x1f4;return function(_0x31fcc1){logger[_0x8d24('0x29')](_0x31fcc1[_0x8d24('0x2a')]);if(_0x31fcc1[_0x8d24('0x2b')]){delete _0x31fcc1['name'];}_0x3530cd[_0x8d24('0x1c')](_0x33e062)[_0x8d24('0x2c')](_0x31fcc1);};}exports[_0x8d24('0x2d')]=function(_0x417f24,_0x33455b){var _0x3fe42a={},_0x33faf4={},_0x774a9={'count':0x0,'rows':[]};return db['CmContact'][_0x8d24('0x2e')]()[_0x8d24('0x28')](function(_0x42456f){var _0x2f6b02=[];for(var _0x2416cf=0x0;_0x2416cf0x1){_0x1dd2d7['or'](_0x8d24('0x70'),qs[_0x8d24('0x71')](_0x52faf6),null);}else{if(qs['isNumeric'](_0x52faf6)){_0x1dd2d7['or'](_0x8d24('0x72'),_0x52faf6+'%');_0x1dd2d7['or'](_0x8d24('0x73'),_0x52faf6+'%');_0x1dd2d7['or']('c.mobile\x20LIKE\x20?',_0x52faf6+'%');_0x1dd2d7['or'](_0x8d24('0x74'),_0x52faf6+'%');}else if(qs[_0x8d24('0x75')](_0x52faf6)){_0x1dd2d7['or'](_0x8d24('0x76'),_0x52faf6+'%');}else{_0x1dd2d7['or']('c.firstName\x20LIKE\x20?','%'+_0x52faf6+'%');_0x1dd2d7['or'](_0x8d24('0x77'),'%'+_0x52faf6+'%');_0x1dd2d7['or'](_0x8d24('0x76'),'%'+_0x52faf6+'%');}}}}_0x2414fc[_0x8d24('0x41')](_0x1dd2d7);_0x2414fc['group'](_0x8d24('0x78'));var _0x5282b1={'type':db['Sequelize'][_0x8d24('0x79')][_0x8d24('0x7a')],'raw':!![]};var _0x15b68b=_0x2414fc[_0x8d24('0x7b')]()[_0x8d24('0x44')](_0x8d24('0x78'));if(_0x3fe42a[_0x8d24('0x7c')]){_0x3fe42a['order'][_0x8d24('0x56')](function(_0x4e371e){_0x2414fc['order']('c.'+_0x4e371e[0x0],_0x4e371e[0x1]===_0x8d24('0x7d')?![]:!![]);});}if(!_[_0x8d24('0x66')](_0x5cccc9)){_0x2414fc[_0x8d24('0x7e')](_0x4f0135);_0x15b68b['where'](_0x8d24('0x7f'),_0x5cccc9);}BPromise[_0x8d24('0x80')]()[_0x8d24('0x28')](function(){if(_0x5d4d30&&!_[_0x8d24('0x81')](_0x5d4d30[_0x8d24('0x52')],[_0x8d24('0x44'),'User'])){return _0x417f24[_0x8d24('0x82')][_0x8d24('0x83')]({'attributes':['id'],'raw':!![]})[_0x8d24('0x28')](function(_0x37a568){if(_[_0x8d24('0x66')](_0x37a568)){_0x15b68b['where']('c.ListId\x20IS\x20NULL');_0x2414fc[_0x8d24('0x41')](_0x8d24('0x84'));}else{_0x15b68b[_0x8d24('0x41')](_0x8d24('0x68'),_[_0x8d24('0x62')](_0x37a568,'id'));_0x2414fc[_0x8d24('0x41')]('c.ListId\x20IN\x20?',_[_0x8d24('0x62')](_0x37a568,'id'));}});}else{return;}})['then'](function(){db[_0x8d24('0x85')][_0x8d24('0x38')](_0x15b68b[_0x8d24('0x86')](),_0x5282b1)['then'](function(_0xf34805){_0x774a9[_0x8d24('0x1f')]=_0xf34805[_0x8d24('0x2f')];if(_0x774a9[_0x8d24('0x1f')]===0x0)return[];return db[_0x8d24('0x85')][_0x8d24('0x38')](_0x27e1b9['toString'](),_0x5282b1);})[_0x8d24('0x28')](function(_0x5aa1f5){_0x1a6eb4=_['keyBy'](_0x5aa1f5,'id');_0x5282b1=_[_0x8d24('0x87')](_0x5282b1,{'model':db[_0x8d24('0x88')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x417f24['query'][_0x8d24('0x3d')]){_0x3fe42a[_0x8d24('0x3c')][_0x8d24('0x56')](function(_0x3ce081){_0x2414fc[_0x8d24('0x44')]('c.'+_0x3ce081);});}else{_0x2414fc['field'](_0x8d24('0x78'));_0x2414fc[_0x8d24('0x44')](_0x8d24('0x89'));_0x2414fc[_0x8d24('0x44')]('c.lastName');_0x2414fc[_0x8d24('0x44')]('c.phone');_0x2414fc[_0x8d24('0x44')](_0x8d24('0x8a'));_0x2414fc[_0x8d24('0x44')](_0x8d24('0x8b'));_0x2414fc[_0x8d24('0x44')](_0x8d24('0x8c'));_0x2414fc[_0x8d24('0x44')](_0x8d24('0x8d'));_0x2414fc[_0x8d24('0x44')](_0x8d24('0x8e'));_0x2414fc[_0x8d24('0x44')](_0x8d24('0x8f'),_0x8d24('0x90'));}if(_0x3fe42a['limit'])_0x2414fc[_0x8d24('0x21')](_0x3fe42a[_0x8d24('0x21')]);if(_0x3fe42a[_0x8d24('0x20')])_0x2414fc['offset'](_0x3fe42a[_0x8d24('0x20')]);return db['sequelize'][_0x8d24('0x38')](_0x2414fc[_0x8d24('0x86')](),_0x5282b1);})['then'](function(_0x30ddd4){_0x30ddd4['forEach'](function(_0x19604f){if(_0x19604f[_0x8d24('0x90')]){_0x19604f[_0x8d24('0x91')]=[];_0x19604f['TagIds'][_0x8d24('0x55')](',')[_0x8d24('0x56')](function(_0x3a845c){_0x19604f[_0x8d24('0x91')]['push'](_0x1a6eb4[_0x3a845c]);});}delete _0x19604f[_0x8d24('0x90')];});_0x774a9[_0x8d24('0x92')]=_0x30ddd4;return _0x774a9;})[_0x8d24('0x28')](respondWithFilteredResult(_0x33455b,_0x3fe42a));});})[_0x8d24('0x93')](handleError(_0x33455b,null));};exports[_0x8d24('0x27')]=function(_0x5537f3,_0x3584a6){return db['CmContact'][_0x8d24('0x94')]({'where':{'id':_0x5537f3[_0x8d24('0x95')]['id']}})[_0x8d24('0x28')](handleEntityNotFound(_0x3584a6,null))['then'](removeEntity(_0x3584a6,null))['catch'](handleError(_0x3584a6,null));};exports[_0x8d24('0x2e')]=function(_0x464737,_0x4cbb92){return db[_0x8d24('0x88')][_0x8d24('0x2e')]()['then'](function(_0x4db217){delete _0x4db217['tags'];for(var _0x235711=0x0;_0x235711{}\s\\|]/g,'-');_0x55e3df(null,util[_0x7b4c('0x24')](_0x7b4c('0x25'),path[_0x7b4c('0x26')](_0x3556d8[_0x7b4c('0x22')],path[_0x7b4c('0x27')](_0x3556d8[_0x7b4c('0x22')])),Date[_0x7b4c('0x28')](),path['extname'](_0x3556d8[_0x7b4c('0x22')])));}})});router[_0x7b4c('0x1a')](_0x7b4c('0x29'),upload[_0x7b4c('0x2a')](_0x7b4c('0x2b')),controller[_0x7b4c('0x2c')]);var upload=multer({'storage':multer[_0x7b4c('0x1e')]({'destination':function(_0x459eb4,_0x1f311e,_0x1a69db){_0x1a69db(null,path[_0x7b4c('0x1f')](config[_0x7b4c('0x20')],_0x7b4c('0x21')));},'filename':function(_0x501f75,_0x27f361,_0x3ab614){_0x27f361[_0x7b4c('0x22')]=_0x27f361[_0x7b4c('0x22')][_0x7b4c('0x23')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x3ab614(null,util[_0x7b4c('0x24')](_0x7b4c('0x25'),path[_0x7b4c('0x26')](_0x27f361[_0x7b4c('0x22')],path[_0x7b4c('0x27')](_0x27f361[_0x7b4c('0x22')])),Date[_0x7b4c('0x28')](),path[_0x7b4c('0x27')](_0x27f361[_0x7b4c('0x22')])));}})});router[_0x7b4c('0x1a')](_0x7b4c('0x2d'),upload[_0x7b4c('0x2a')](_0x7b4c('0x2b')),controller[_0x7b4c('0x2e')]);router['post']('/upload/:id',auth['isAuthenticated'](),controller[_0x7b4c('0x2f')]);router[_0x7b4c('0x30')](_0x7b4c('0x31'),auth[_0x7b4c('0xd')](),controller['update']);router[_0x7b4c('0x32')](_0x7b4c('0x31'),auth['isAuthenticated'](),controller[_0x7b4c('0x33')]);module['exports']=router; \ No newline at end of file +var _0xf494=['getTags','/:id/hoppers','getHopperHistories','getHopperFinals','/:id/jscripty_sessions','getJscriptySessions','post','merge','/create_many','join','root','server/files/tmp','originalname','replace','%s-%s%s','basename','now','extname','/csv','uploadCsv','diskStorage','/upload','single','file','/upload/:id','import','put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContact.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/tags'];(function(_0x4d4466,_0x2ce11f){var _0xe69337=function(_0x3fb379){while(--_0x3fb379){_0x4d4466['push'](_0x4d4466['shift']());}};_0xe69337(++_0x2ce11f);}(_0xf494,0x1c6));var _0x4f49=function(_0x33fa76,_0x17007a){_0x33fa76=_0x33fa76-0x0;var _0x26c2a9=_0xf494[_0x33fa76];return _0x26c2a9;};'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['describe']);router[_0x4f49('0x9')](_0x4f49('0xd'),auth[_0x4f49('0xa')](),controller[_0x4f49('0xe')]);router[_0x4f49('0x9')](_0x4f49('0xf'),auth[_0x4f49('0xa')](),controller[_0x4f49('0x10')]);router['get'](_0x4f49('0x11'),auth[_0x4f49('0xa')](),controller['getHoppers']);router[_0x4f49('0x9')]('/:id/hopper_histories',auth['isAuthenticated'](),controller[_0x4f49('0x12')]);router[_0x4f49('0x9')]('/:id/hopper_finals',auth[_0x4f49('0xa')](),controller[_0x4f49('0x13')]);router[_0x4f49('0x9')](_0x4f49('0x14'),auth[_0x4f49('0xa')](),controller[_0x4f49('0x15')]);router[_0x4f49('0x16')]('/merge',auth[_0x4f49('0xa')](),controller[_0x4f49('0x17')]);router[_0x4f49('0x16')]('/',auth['isAuthenticated'](),controller['create']);router[_0x4f49('0x16')](_0x4f49('0x18'),auth[_0x4f49('0xa')](),controller['bulkCreate']);router[_0x4f49('0x16')](_0x4f49('0xf'),auth[_0x4f49('0xa')](),controller['setTags']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x560592,_0x47f1e8,_0xb2081a){_0xb2081a(null,path[_0x4f49('0x19')](config[_0x4f49('0x1a')],_0x4f49('0x1b')));},'filename':function(_0x5793ac,_0x416893,_0x2aed27){_0x416893[_0x4f49('0x1c')]=_0x416893[_0x4f49('0x1c')][_0x4f49('0x1d')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x2aed27(null,util['format'](_0x4f49('0x1e'),path[_0x4f49('0x1f')](_0x416893[_0x4f49('0x1c')],path['extname'](_0x416893[_0x4f49('0x1c')])),Date[_0x4f49('0x20')](),path[_0x4f49('0x21')](_0x416893[_0x4f49('0x1c')])));}})});router[_0x4f49('0x16')](_0x4f49('0x22'),upload['single']('file'),controller[_0x4f49('0x23')]);var upload=multer({'storage':multer[_0x4f49('0x24')]({'destination':function(_0x4fedbb,_0x408552,_0x2c1519){_0x2c1519(null,path[_0x4f49('0x19')](config['root'],_0x4f49('0x1b')));},'filename':function(_0x2eed1c,_0x298785,_0x148153){_0x298785[_0x4f49('0x1c')]=_0x298785[_0x4f49('0x1c')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x148153(null,util['format'](_0x4f49('0x1e'),path[_0x4f49('0x1f')](_0x298785[_0x4f49('0x1c')],path['extname'](_0x298785[_0x4f49('0x1c')])),Date[_0x4f49('0x20')](),path[_0x4f49('0x21')](_0x298785['originalname'])));}})});router['post'](_0x4f49('0x25'),upload[_0x4f49('0x26')](_0x4f49('0x27')),controller['upload']);router[_0x4f49('0x16')](_0x4f49('0x28'),auth[_0x4f49('0xa')](),controller[_0x4f49('0x29')]);router[_0x4f49('0x2a')](_0x4f49('0xd'),auth[_0x4f49('0xa')](),controller[_0x4f49('0x2b')]);router[_0x4f49('0x2c')](_0x4f49('0xd'),auth[_0x4f49('0xa')](),controller[_0x4f49('0x2d')]);module[_0x4f49('0x2e')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index c999aa0..c95bb20 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 _0xfb04=['getDataValue','alias','STRING','setDataValue','TEXT','long','type','select','values','isArray','stringify','BOOLEAN','sequelize','lodash','exports','VIRTUAL'];(function(_0x461a6e,_0x11dfeb){var _0x336db4=function(_0x53f85b){while(--_0x53f85b){_0x461a6e['push'](_0x461a6e['shift']());}};_0x336db4(++_0x11dfeb);}(_0xfb04,0x6c));var _0x4fb0=function(_0x327c52,_0x467df6){_0x327c52=_0x327c52-0x0;var _0x59e28c=_0xfb04[_0x327c52];return _0x59e28c;};'use strict';var Sequelize=require(_0x4fb0('0x0'));var _=require(_0x4fb0('0x1'));module[_0x4fb0('0x2')]={'name':{'type':Sequelize[_0x4fb0('0x3')],'get':function(_0x323de6){return this[_0x4fb0('0x4')](_0x4fb0('0x5'));}},'alias':{'type':Sequelize[_0x4fb0('0x6')],'allowNull':![],'set':function(_0x5bb841){this[_0x4fb0('0x7')](_0x4fb0('0x5'),_0x5bb841?_0x5bb841:this[_0x4fb0('0x4')]('name'));}},'type':{'type':Sequelize[_0x4fb0('0x6')],'allowNull':![]},'values':{'type':Sequelize[_0x4fb0('0x8')](_0x4fb0('0x9')),'get':function(){if(this['getDataValue'](_0x4fb0('0xa'))===_0x4fb0('0xb')){return JSON['parse'](this[_0x4fb0('0x4')](_0x4fb0('0xc')));}else{return this['getDataValue'](_0x4fb0('0xc'));}},'set':function(_0xe43813){if(Array[_0x4fb0('0xd')](_0xe43813)){this[_0x4fb0('0x7')](_0x4fb0('0xc'),JSON[_0x4fb0('0xe')](_0xe43813));}else{this[_0x4fb0('0x7')]('values',_0xe43813);}}},'required':{'type':Sequelize[_0x4fb0('0xf')],'defaultValue':![]}}; \ No newline at end of file +var _0x0fad=['getDataValue','values','isArray','setDataValue','BOOLEAN','sequelize','lodash','VIRTUAL','alias','STRING','name','TEXT','long','type','select','parse'];(function(_0x15519b,_0x502ef4){var _0x4e4cd2=function(_0x5d5d22){while(--_0x5d5d22){_0x15519b['push'](_0x15519b['shift']());}};_0x4e4cd2(++_0x502ef4);}(_0x0fad,0xf5));var _0xd0fa=function(_0x57f100,_0xa53aca){_0x57f100=_0x57f100-0x0;var _0x4cac01=_0x0fad[_0x57f100];return _0x4cac01;};'use strict';var Sequelize=require(_0xd0fa('0x0'));var _=require(_0xd0fa('0x1'));module['exports']={'name':{'type':Sequelize[_0xd0fa('0x2')],'get':function(_0x40d1dd){return this['getDataValue'](_0xd0fa('0x3'));}},'alias':{'type':Sequelize[_0xd0fa('0x4')],'allowNull':![],'set':function(_0x46d456){this['setDataValue'](_0xd0fa('0x3'),_0x46d456?_0x46d456:this['getDataValue'](_0xd0fa('0x5')));}},'type':{'type':Sequelize[_0xd0fa('0x4')],'allowNull':![]},'values':{'type':Sequelize[_0xd0fa('0x6')](_0xd0fa('0x7')),'get':function(){if(this['getDataValue'](_0xd0fa('0x8'))===_0xd0fa('0x9')){return JSON[_0xd0fa('0xa')](this[_0xd0fa('0xb')](_0xd0fa('0xc')));}else{return this['getDataValue'](_0xd0fa('0xc'));}},'set':function(_0x5d3b62){if(Array[_0xd0fa('0xd')](_0x5d3b62)){this[_0xd0fa('0xe')]('values',JSON['stringify'](_0x5d3b62));}else{this[_0xd0fa('0xe')](_0xd0fa('0xc'),_0x5d3b62);}}},'required':{'type':Sequelize[_0xd0fa('0xf')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 43b1dda..0ba1ffb 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 _0x1a95=['key','model','differenceBy','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','CmCustomField','includeAll','rows','catch','show','rawAttributes','include','options','find','body','params','create','sequelize','transaction','Sequelize','TEXT','number','INTEGER','switch','BOOLEAN','queryInterface','addColumn','cm_contacts','format','cf_%d','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','sendStatus','status','end','json','count','offset','set','Content-Range','reject','save','update','then','destroy','error','stack','send','index','map','fieldName','type'];(function(_0x79c52f,_0x5bd9d3){var _0x37f2a8=function(_0x53d6f2){while(--_0x53d6f2){_0x79c52f['push'](_0x79c52f['shift']());}};_0x37f2a8(++_0x5bd9d3);}(_0x1a95,0x12f));var _0x51a9=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x1a95[_0x321bb2];return _0x9c12ed;};'use strict';var pdf=require(_0x51a9('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x51a9('0x1'));var zipdir=require(_0x51a9('0x2'));var jsonpatch=require(_0x51a9('0x3'));var rp=require(_0x51a9('0x4'));var moment=require(_0x51a9('0x5'));var BPromise=require(_0x51a9('0x6'));var Mustache=require('mustache');var util=require(_0x51a9('0x7'));var path=require(_0x51a9('0x8'));var sox=require(_0x51a9('0x9'));var csv=require(_0x51a9('0xa'));var ejs=require(_0x51a9('0xb'));var fs=require('fs');var _=require(_0x51a9('0xc'));var squel=require(_0x51a9('0xd'));var crypto=require(_0x51a9('0xe'));var jsforce=require(_0x51a9('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x51a9('0xa'));var querystring=require(_0x51a9('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x51a9('0x11'));var as=require(_0x51a9('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x51a9('0x13'));var utils=require(_0x51a9('0x14'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x686093,_0x3b4921){_0x3b4921=_0x3b4921||0xcc;return function(_0x5501b9){if(_0x5501b9){return _0x686093[_0x51a9('0x15')](_0x3b4921);}return _0x686093[_0x51a9('0x16')](_0x3b4921)[_0x51a9('0x17')]();};}function respondWithResult(_0x3e8c4a,_0x51f4ba){_0x51f4ba=_0x51f4ba||0xc8;return function(_0x354111){if(_0x354111){return _0x3e8c4a[_0x51a9('0x16')](_0x51f4ba)[_0x51a9('0x18')](_0x354111);}};}function respondWithFilteredResult(_0x141768,_0x28397f){return function(_0x16c157){if(_0x16c157){var _0x344198=_0x16c157[_0x51a9('0x19')],_0x194f35=_0x28397f[_0x51a9('0x1a')],_0x412eb6=_0x28397f[_0x51a9('0x1a')]+_0x28397f['limit'],_0x1e7510;if(_0x412eb6>=_0x344198){_0x412eb6=_0x344198;_0x1e7510=0xc8;}else{_0x1e7510=0xce;}_0x141768[_0x51a9('0x16')](_0x1e7510);return _0x141768[_0x51a9('0x1b')](_0x51a9('0x1c'),_0x194f35+'-'+_0x412eb6+'/'+_0x344198)['json'](_0x16c157);}return null;};}function patchUpdates(_0x55ad68){return function(_0x5f28b0){try{jsonpatch['apply'](_0x5f28b0,_0x55ad68,!![]);}catch(_0x18a8ab){return BPromise[_0x51a9('0x1d')](_0x18a8ab);}return _0x5f28b0[_0x51a9('0x1e')]();};}function saveUpdates(_0x244d8,_0x1b8947){return function(_0x45a81){if(_0x45a81){return _0x45a81[_0x51a9('0x1f')](_0x244d8)[_0x51a9('0x20')](function(_0x1ef91c){return _0x1ef91c;});}return null;};}function removeEntity(_0x27f892,_0x404b65){return function(_0x4f2ab3){if(_0x4f2ab3){return _0x4f2ab3[_0x51a9('0x21')]()[_0x51a9('0x20')](function(){_0x27f892[_0x51a9('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x53762c,_0x4eb51b){return function(_0x5248fc){if(!_0x5248fc){_0x53762c[_0x51a9('0x15')](0x194);}return _0x5248fc;};}function handleError(_0x10d50b,_0x3d2c79){_0x3d2c79=_0x3d2c79||0x1f4;return function(_0x51e46e){logger[_0x51a9('0x22')](_0x51e46e[_0x51a9('0x23')]);if(_0x51e46e['name']){delete _0x51e46e['name'];}_0x10d50b[_0x51a9('0x16')](_0x3d2c79)[_0x51a9('0x24')](_0x51e46e);};}exports[_0x51a9('0x25')]=function(_0x352d9e,_0x31dd4f){var _0x572a08={},_0x401633={},_0x3e8b92={'count':0x0,'rows':[]};var _0x43cf8c=_[_0x51a9('0x26')](db['CmCustomField']['rawAttributes'],function(_0x27c070){return{'name':_0x27c070[_0x51a9('0x27')],'type':_0x27c070[_0x51a9('0x28')][_0x51a9('0x29')]};});_0x401633[_0x51a9('0x2a')]=_[_0x51a9('0x2b')](_[_0x51a9('0x26')](_0x43cf8c,_0x51a9('0x2c')),[_0x51a9('0x2c')]);_0x401633[_0x51a9('0x2d')]=_[_0x51a9('0x2e')](_0x352d9e[_0x51a9('0x2d')]);_0x401633[_0x51a9('0x2f')]=_[_0x51a9('0x30')](_0x401633[_0x51a9('0x2a')],_0x401633[_0x51a9('0x2d')]);_0x572a08[_0x51a9('0x31')]=_[_0x51a9('0x30')](_0x401633[_0x51a9('0x2a')],qs[_0x51a9('0x32')](_0x352d9e[_0x51a9('0x2d')][_0x51a9('0x32')]));_0x572a08['attributes']=_0x572a08['attributes'][_0x51a9('0x33')]?_0x572a08['attributes']:_0x401633[_0x51a9('0x2a')];if(!_0x352d9e[_0x51a9('0x2d')][_0x51a9('0x34')](_0x51a9('0x35'))){_0x572a08[_0x51a9('0x36')]=qs[_0x51a9('0x36')](_0x352d9e['query']['limit']);_0x572a08[_0x51a9('0x1a')]=qs['offset'](_0x352d9e['query']['offset']);}_0x572a08[_0x51a9('0x37')]=qs[_0x51a9('0x38')](_0x352d9e[_0x51a9('0x2d')][_0x51a9('0x38')]);_0x572a08[_0x51a9('0x39')]=qs['filters'](_[_0x51a9('0x3a')](_0x352d9e[_0x51a9('0x2d')],_0x401633['filters']),_0x43cf8c);if(_0x352d9e['query'][_0x51a9('0x3b')]){_0x572a08[_0x51a9('0x39')]=_[_0x51a9('0x3c')](_0x572a08[_0x51a9('0x39')],{'$or':_[_0x51a9('0x26')](_0x43cf8c,function(_0x518d56){if(_0x518d56[_0x51a9('0x28')]!=='VIRTUAL'){var _0x1f85f5={};_0x1f85f5[_0x518d56[_0x51a9('0x2c')]]={'$like':'%'+_0x352d9e[_0x51a9('0x2d')][_0x51a9('0x3b')]+'%'};return _0x1f85f5;}})});}_0x572a08=_[_0x51a9('0x3c')]({},_0x572a08,_0x352d9e['options']);var _0x4d038c={'where':_0x572a08[_0x51a9('0x39')]};return db[_0x51a9('0x3d')][_0x51a9('0x19')](_0x4d038c)['then'](function(_0x24febd){_0x3e8b92[_0x51a9('0x19')]=_0x24febd;if(_0x352d9e[_0x51a9('0x2d')][_0x51a9('0x3e')]){_0x572a08['include']=[{'all':!![]}];}return db['CmCustomField']['findAll'](_0x572a08);})[_0x51a9('0x20')](function(_0x1b18a3){_0x3e8b92[_0x51a9('0x3f')]=_0x1b18a3;return _0x3e8b92;})[_0x51a9('0x20')](respondWithFilteredResult(_0x31dd4f,_0x572a08))[_0x51a9('0x40')](handleError(_0x31dd4f,null));};exports[_0x51a9('0x41')]=function(_0x910d0b,_0xfc6507){var _0x2b47e4={'raw':!![],'where':{'id':_0x910d0b['params']['id']}},_0x11e262={};_0x11e262['model']=_[_0x51a9('0x2e')](db[_0x51a9('0x3d')][_0x51a9('0x42')]);_0x11e262[_0x51a9('0x2d')]=_[_0x51a9('0x2e')](_0x910d0b['query']);_0x11e262[_0x51a9('0x2f')]=_[_0x51a9('0x30')](_0x11e262[_0x51a9('0x2a')],_0x11e262[_0x51a9('0x2d')]);_0x2b47e4[_0x51a9('0x31')]=_[_0x51a9('0x30')](_0x11e262['model'],qs[_0x51a9('0x32')](_0x910d0b[_0x51a9('0x2d')][_0x51a9('0x32')]));_0x2b47e4[_0x51a9('0x31')]=_0x2b47e4[_0x51a9('0x31')][_0x51a9('0x33')]?_0x2b47e4[_0x51a9('0x31')]:_0x11e262[_0x51a9('0x2a')];if(_0x910d0b['query'][_0x51a9('0x3e')]){_0x2b47e4[_0x51a9('0x43')]=[{'all':!![]}];}_0x2b47e4=_[_0x51a9('0x3c')]({},_0x2b47e4,_0x910d0b[_0x51a9('0x44')]);return db['CmCustomField'][_0x51a9('0x45')](_0x2b47e4)[_0x51a9('0x20')](handleEntityNotFound(_0xfc6507,null))[_0x51a9('0x20')](respondWithResult(_0xfc6507,null))[_0x51a9('0x40')](handleError(_0xfc6507,null));};exports[_0x51a9('0x1f')]=function(_0x17817d,_0x2bca6c){if(_0x17817d[_0x51a9('0x46')]['id']){delete _0x17817d[_0x51a9('0x46')]['id'];}return db[_0x51a9('0x3d')][_0x51a9('0x45')]({'where':{'id':_0x17817d[_0x51a9('0x47')]['id']}})['then'](handleEntityNotFound(_0x2bca6c,null))[_0x51a9('0x20')](saveUpdates(_0x17817d[_0x51a9('0x46')],null))[_0x51a9('0x20')](respondWithResult(_0x2bca6c,null))['catch'](handleError(_0x2bca6c,null));};exports[_0x51a9('0x21')]=function(_0x6b0752,_0x558c9b){return db[_0x51a9('0x3d')][_0x51a9('0x45')]({'where':{'id':_0x6b0752[_0x51a9('0x47')]['id']}})[_0x51a9('0x20')](handleEntityNotFound(_0x558c9b,null))[_0x51a9('0x20')](removeEntity(_0x558c9b,null))[_0x51a9('0x40')](handleError(_0x558c9b,null));};exports[_0x51a9('0x48')]=function(_0x4bc69c,_0x2a0244){var _0x26c047;return db[_0x51a9('0x49')][_0x51a9('0x4a')](function(_0x20fc0b){return db[_0x51a9('0x3d')][_0x51a9('0x48')](_0x4bc69c['body'],{'transaction':_0x20fc0b})[_0x51a9('0x20')](function(_0x5eb357){_0x26c047=_0x5eb357;var _0x1caf6f={'type':db[_0x51a9('0x4b')][_0x51a9('0x4c')],'transaction':_0x20fc0b};switch(_0x4bc69c[_0x51a9('0x46')][_0x51a9('0x28')]){case'text':_0x1caf6f[_0x51a9('0x28')]=db['Sequelize'][_0x51a9('0x4c')];break;case _0x51a9('0x4d'):_0x1caf6f[_0x51a9('0x28')]=db['Sequelize'][_0x51a9('0x4e')];break;case _0x51a9('0x4f'):_0x1caf6f['type']=db[_0x51a9('0x4b')][_0x51a9('0x50')];_0x1caf6f['defaultValue']=![];break;default:}return db[_0x51a9('0x49')][_0x51a9('0x51')][_0x51a9('0x52')](_0x51a9('0x53'),util[_0x51a9('0x54')](_0x51a9('0x55'),_0x26c047['id']),_0x1caf6f);})[_0x51a9('0x20')](function(){return _0x26c047;});})[_0x51a9('0x20')](respondWithResult(_0x2a0244,0xc9))['catch'](handleError(_0x2a0244,null));}; \ No newline at end of file +var _0xbebb=['INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','format','cf_%d','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','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/environment','../../mysqldb','status','end','json','count','offset','limit','apply','reject','save','update','then','destroy','error','stack','name','send','CmCustomField','rawAttributes','fieldName','key','model','differenceBy','map','keys','intersection','query','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','type','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','params','find','body','create','sequelize','Sequelize','TEXT','number'];(function(_0x364e3a,_0x4349a6){var _0x27ec1=function(_0x3005f5){while(--_0x3005f5){_0x364e3a['push'](_0x364e3a['shift']());}};_0x27ec1(++_0x4349a6);}(_0xbebb,0xb6));var _0xbbeb=function(_0x1a2dd8,_0x175be5){_0x1a2dd8=_0x1a2dd8-0x0;var _0x141942=_0xbebb[_0x1a2dd8];return _0x141942;};'use strict';var pdf=require(_0xbbeb('0x0'));var emlformat=require(_0xbbeb('0x1'));var rimraf=require(_0xbbeb('0x2'));var zipdir=require(_0xbbeb('0x3'));var jsonpatch=require(_0xbbeb('0x4'));var rp=require(_0xbbeb('0x5'));var moment=require('moment');var BPromise=require(_0xbbeb('0x6'));var Mustache=require(_0xbbeb('0x7'));var util=require(_0xbbeb('0x8'));var path=require(_0xbbeb('0x9'));var sox=require('sox');var csv=require(_0xbbeb('0xa'));var ejs=require(_0xbbeb('0xb'));var fs=require('fs');var _=require(_0xbbeb('0xc'));var squel=require(_0xbbeb('0xd'));var crypto=require(_0xbbeb('0xe'));var jsforce=require(_0xbbeb('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xbbeb('0xa'));var querystring=require(_0xbbeb('0x10'));var Papa=require(_0xbbeb('0x11'));var Redis=require(_0xbbeb('0x12'));var authService=require(_0xbbeb('0x13'));var qs=require(_0xbbeb('0x14'));var as=require(_0xbbeb('0x15'));var hardwareService=require(_0xbbeb('0x16'));var logger=require(_0xbbeb('0x17'))('api');var utils=require('../../config/utils');var config=require(_0xbbeb('0x18'));var db=require(_0xbbeb('0x19'))['db'];function respondWithStatusCode(_0x39e410,_0x165842){_0x165842=_0x165842||0xcc;return function(_0x536371){if(_0x536371){return _0x39e410['sendStatus'](_0x165842);}return _0x39e410[_0xbbeb('0x1a')](_0x165842)[_0xbbeb('0x1b')]();};}function respondWithResult(_0xb5cbf4,_0x58c72b){_0x58c72b=_0x58c72b||0xc8;return function(_0x535eeb){if(_0x535eeb){return _0xb5cbf4['status'](_0x58c72b)[_0xbbeb('0x1c')](_0x535eeb);}};}function respondWithFilteredResult(_0xaaa362,_0x50bd92){return function(_0x262c87){if(_0x262c87){var _0x390820=_0x262c87[_0xbbeb('0x1d')],_0x183283=_0x50bd92[_0xbbeb('0x1e')],_0x12064a=_0x50bd92[_0xbbeb('0x1e')]+_0x50bd92[_0xbbeb('0x1f')],_0x1f5860;if(_0x12064a>=_0x390820){_0x12064a=_0x390820;_0x1f5860=0xc8;}else{_0x1f5860=0xce;}_0xaaa362[_0xbbeb('0x1a')](_0x1f5860);return _0xaaa362['set']('Content-Range',_0x183283+'-'+_0x12064a+'/'+_0x390820)[_0xbbeb('0x1c')](_0x262c87);}return null;};}function patchUpdates(_0x1087f2){return function(_0x43e76d){try{jsonpatch[_0xbbeb('0x20')](_0x43e76d,_0x1087f2,!![]);}catch(_0x482275){return BPromise[_0xbbeb('0x21')](_0x482275);}return _0x43e76d[_0xbbeb('0x22')]();};}function saveUpdates(_0x4f98bb,_0x5c2b9f){return function(_0x297ddc){if(_0x297ddc){return _0x297ddc[_0xbbeb('0x23')](_0x4f98bb)[_0xbbeb('0x24')](function(_0x5969dd){return _0x5969dd;});}return null;};}function removeEntity(_0x284eb5,_0x537797){return function(_0x163715){if(_0x163715){return _0x163715[_0xbbeb('0x25')]()[_0xbbeb('0x24')](function(){_0x284eb5['status'](0xcc)[_0xbbeb('0x1b')]();});}};}function handleEntityNotFound(_0xbd5ac3,_0x400b4c){return function(_0x185eb6){if(!_0x185eb6){_0xbd5ac3['sendStatus'](0x194);}return _0x185eb6;};}function handleError(_0x964e5c,_0x186348){_0x186348=_0x186348||0x1f4;return function(_0x2aa509){logger[_0xbbeb('0x26')](_0x2aa509[_0xbbeb('0x27')]);if(_0x2aa509[_0xbbeb('0x28')]){delete _0x2aa509['name'];}_0x964e5c['status'](_0x186348)[_0xbbeb('0x29')](_0x2aa509);};}exports['index']=function(_0x3882f0,_0x3540c2){var _0x4ea93b={},_0x2fa104={},_0x549700={'count':0x0,'rows':[]};var _0x4f7768=_['map'](db[_0xbbeb('0x2a')][_0xbbeb('0x2b')],function(_0x7a0ee0){return{'name':_0x7a0ee0[_0xbbeb('0x2c')],'type':_0x7a0ee0['type'][_0xbbeb('0x2d')]};});_0x2fa104[_0xbbeb('0x2e')]=_[_0xbbeb('0x2f')](_[_0xbbeb('0x30')](_0x4f7768,_0xbbeb('0x28')),[_0xbbeb('0x28')]);_0x2fa104['query']=_[_0xbbeb('0x31')](_0x3882f0['query']);_0x2fa104['filters']=_[_0xbbeb('0x32')](_0x2fa104[_0xbbeb('0x2e')],_0x2fa104[_0xbbeb('0x33')]);_0x4ea93b[_0xbbeb('0x34')]=_['intersection'](_0x2fa104[_0xbbeb('0x2e')],qs[_0xbbeb('0x35')](_0x3882f0[_0xbbeb('0x33')]['fields']));_0x4ea93b[_0xbbeb('0x34')]=_0x4ea93b[_0xbbeb('0x34')][_0xbbeb('0x36')]?_0x4ea93b['attributes']:_0x2fa104[_0xbbeb('0x2e')];if(!_0x3882f0['query'][_0xbbeb('0x37')]('nolimit')){_0x4ea93b[_0xbbeb('0x1f')]=qs[_0xbbeb('0x1f')](_0x3882f0['query']['limit']);_0x4ea93b[_0xbbeb('0x1e')]=qs[_0xbbeb('0x1e')](_0x3882f0['query'][_0xbbeb('0x1e')]);}_0x4ea93b[_0xbbeb('0x38')]=qs[_0xbbeb('0x39')](_0x3882f0[_0xbbeb('0x33')][_0xbbeb('0x39')]);_0x4ea93b[_0xbbeb('0x3a')]=qs[_0xbbeb('0x3b')](_[_0xbbeb('0x3c')](_0x3882f0[_0xbbeb('0x33')],_0x2fa104[_0xbbeb('0x3b')]),_0x4f7768);if(_0x3882f0[_0xbbeb('0x33')]['filter']){_0x4ea93b[_0xbbeb('0x3a')]=_['merge'](_0x4ea93b[_0xbbeb('0x3a')],{'$or':_[_0xbbeb('0x30')](_0x4f7768,function(_0x20c794){if(_0x20c794[_0xbbeb('0x3d')]!==_0xbbeb('0x3e')){var _0x30c602={};_0x30c602[_0x20c794[_0xbbeb('0x28')]]={'$like':'%'+_0x3882f0['query'][_0xbbeb('0x3f')]+'%'};return _0x30c602;}})});}_0x4ea93b=_[_0xbbeb('0x40')]({},_0x4ea93b,_0x3882f0[_0xbbeb('0x41')]);var _0x1e8c18={'where':_0x4ea93b[_0xbbeb('0x3a')]};return db['CmCustomField'][_0xbbeb('0x1d')](_0x1e8c18)[_0xbbeb('0x24')](function(_0x45d0d9){_0x549700['count']=_0x45d0d9;if(_0x3882f0[_0xbbeb('0x33')][_0xbbeb('0x42')]){_0x4ea93b[_0xbbeb('0x43')]=[{'all':!![]}];}return db[_0xbbeb('0x2a')][_0xbbeb('0x44')](_0x4ea93b);})[_0xbbeb('0x24')](function(_0x3b33af){_0x549700[_0xbbeb('0x45')]=_0x3b33af;return _0x549700;})[_0xbbeb('0x24')](respondWithFilteredResult(_0x3540c2,_0x4ea93b))[_0xbbeb('0x46')](handleError(_0x3540c2,null));};exports['show']=function(_0x3ab0e6,_0x219041){var _0x3ed0f4={'raw':!![],'where':{'id':_0x3ab0e6[_0xbbeb('0x47')]['id']}},_0x3811d4={};_0x3811d4[_0xbbeb('0x2e')]=_['keys'](db[_0xbbeb('0x2a')][_0xbbeb('0x2b')]);_0x3811d4[_0xbbeb('0x33')]=_[_0xbbeb('0x31')](_0x3ab0e6[_0xbbeb('0x33')]);_0x3811d4['filters']=_['intersection'](_0x3811d4[_0xbbeb('0x2e')],_0x3811d4['query']);_0x3ed0f4[_0xbbeb('0x34')]=_['intersection'](_0x3811d4[_0xbbeb('0x2e')],qs[_0xbbeb('0x35')](_0x3ab0e6['query'][_0xbbeb('0x35')]));_0x3ed0f4[_0xbbeb('0x34')]=_0x3ed0f4['attributes'][_0xbbeb('0x36')]?_0x3ed0f4[_0xbbeb('0x34')]:_0x3811d4[_0xbbeb('0x2e')];if(_0x3ab0e6[_0xbbeb('0x33')][_0xbbeb('0x42')]){_0x3ed0f4[_0xbbeb('0x43')]=[{'all':!![]}];}_0x3ed0f4=_[_0xbbeb('0x40')]({},_0x3ed0f4,_0x3ab0e6[_0xbbeb('0x41')]);return db[_0xbbeb('0x2a')][_0xbbeb('0x48')](_0x3ed0f4)[_0xbbeb('0x24')](handleEntityNotFound(_0x219041,null))['then'](respondWithResult(_0x219041,null))[_0xbbeb('0x46')](handleError(_0x219041,null));};exports[_0xbbeb('0x23')]=function(_0x54e9cc,_0x4ef85f){if(_0x54e9cc[_0xbbeb('0x49')]['id']){delete _0x54e9cc['body']['id'];}return db['CmCustomField'][_0xbbeb('0x48')]({'where':{'id':_0x54e9cc[_0xbbeb('0x47')]['id']}})[_0xbbeb('0x24')](handleEntityNotFound(_0x4ef85f,null))[_0xbbeb('0x24')](saveUpdates(_0x54e9cc[_0xbbeb('0x49')],null))[_0xbbeb('0x24')](respondWithResult(_0x4ef85f,null))[_0xbbeb('0x46')](handleError(_0x4ef85f,null));};exports[_0xbbeb('0x25')]=function(_0x2360d0,_0x2b544e){return db['CmCustomField']['find']({'where':{'id':_0x2360d0[_0xbbeb('0x47')]['id']}})[_0xbbeb('0x24')](handleEntityNotFound(_0x2b544e,null))[_0xbbeb('0x24')](removeEntity(_0x2b544e,null))[_0xbbeb('0x46')](handleError(_0x2b544e,null));};exports[_0xbbeb('0x4a')]=function(_0x33900e,_0x22ca43){var _0x6cd5bf;return db[_0xbbeb('0x4b')]['transaction'](function(_0x5bb968){return db[_0xbbeb('0x2a')][_0xbbeb('0x4a')](_0x33900e[_0xbbeb('0x49')],{'transaction':_0x5bb968})[_0xbbeb('0x24')](function(_0x327d05){_0x6cd5bf=_0x327d05;var _0x277251={'type':db[_0xbbeb('0x4c')][_0xbbeb('0x4d')],'transaction':_0x5bb968};switch(_0x33900e[_0xbbeb('0x49')]['type']){case'text':_0x277251[_0xbbeb('0x3d')]=db[_0xbbeb('0x4c')][_0xbbeb('0x4d')];break;case _0xbbeb('0x4e'):_0x277251['type']=db[_0xbbeb('0x4c')][_0xbbeb('0x4f')];break;case _0xbbeb('0x50'):_0x277251[_0xbbeb('0x3d')]=db[_0xbbeb('0x4c')][_0xbbeb('0x51')];_0x277251[_0xbbeb('0x52')]=![];break;default:}return db[_0xbbeb('0x4b')][_0xbbeb('0x53')][_0xbbeb('0x54')]('cm_contacts',util[_0xbbeb('0x55')](_0xbbeb('0x56'),_0x6cd5bf['id']),_0x277251);})[_0xbbeb('0x24')](function(){return _0x6cd5bf;});})[_0xbbeb('0x24')](respondWithResult(_0x22ca43,0xc9))[_0xbbeb('0x46')](handleError(_0x22ca43,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 815b2f7..5d72b96 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 _0x4844=['lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./cmCustomField.attributes','define','CmCustomField','cm_custom_fields'];(function(_0x3f5f84,_0x4302dc){var _0x410d8d=function(_0x26da28){while(--_0x26da28){_0x3f5f84['push'](_0x3f5f84['shift']());}};_0x410d8d(++_0x4302dc);}(_0x4844,0x6c));var _0x4484=function(_0x2e5fc7,_0x430dc2){_0x2e5fc7=_0x2e5fc7-0x0;var _0x3123e3=_0x4844[_0x2e5fc7];return _0x3123e3;};'use strict';var _=require(_0x4484('0x0'));var util=require(_0x4484('0x1'));var logger=require('../../config/logger')(_0x4484('0x2'));var moment=require('moment');var BPromise=require(_0x4484('0x3'));var rp=require(_0x4484('0x4'));var fs=require('fs');var path=require(_0x4484('0x5'));var rimraf=require(_0x4484('0x6'));var config=require(_0x4484('0x7'));var attributes=require(_0x4484('0x8'));module['exports']=function(_0x1761cc,_0x47fbfa){return _0x1761cc[_0x4484('0x9')](_0x4484('0xa'),attributes,{'tableName':_0x4484('0xb'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4c50=['bluebird','request-promise','../../config/environment','./cmCustomField.attributes','define','CmCustomField','cm_custom_fields','lodash','util','../../config/logger','api','moment'];(function(_0x1d2518,_0x49b912){var _0x28d31d=function(_0x3bc54d){while(--_0x3bc54d){_0x1d2518['push'](_0x1d2518['shift']());}};_0x28d31d(++_0x49b912);}(_0x4c50,0x10f));var _0x04c5=function(_0x5c424d,_0x1a4493){_0x5c424d=_0x5c424d-0x0;var _0x3bf050=_0x4c50[_0x5c424d];return _0x3bf050;};'use strict';var _=require(_0x04c5('0x0'));var util=require(_0x04c5('0x1'));var logger=require(_0x04c5('0x2'))(_0x04c5('0x3'));var moment=require(_0x04c5('0x4'));var BPromise=require(_0x04c5('0x5'));var rp=require(_0x04c5('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x04c5('0x7'));var attributes=require(_0x04c5('0x8'));module['exports']=function(_0x314a0e,_0x347dd3){return _0x314a0e[_0x04c5('0x9')](_0x04c5('0xa'),attributes,{'tableName':_0x04c5('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 0c7c832..1e8c55b 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 _0x22fb=['CmCustomField,\x20%s,\x20%s,\x20%s','code','message','error','result','catch','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','CmCustomField,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x5d1a13,_0x31af61){var _0x5b0304=function(_0x5e9991){while(--_0x5e9991){_0x5d1a13['push'](_0x5d1a13['shift']());}};_0x5b0304(++_0x31af61);}(_0x22fb,0x192));var _0xb22f=function(_0x452738,_0x336092){_0x452738=_0x452738-0x0;var _0x565eb4=_0x22fb[_0x452738];return _0x565eb4;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb22f('0x0'));var BPromise=require('bluebird');var rs=require(_0xb22f('0x1'));var fs=require('fs');var Redis=require(_0xb22f('0x2'));var db=require(_0xb22f('0x3'))['db'];var utils=require(_0xb22f('0x4'));var logger=require(_0xb22f('0x5'))('rpc');var config=require(_0xb22f('0x6'));var jayson=require(_0xb22f('0x7'));var client=jayson[_0xb22f('0x8')][_0xb22f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x412a95,_0x367d4b,_0x47f61a){return new BPromise(function(_0x34433b,_0x22c509){return client[_0xb22f('0xa')](_0x412a95,_0x47f61a)[_0xb22f('0xb')](function(_0x1a3aae){logger[_0xb22f('0xc')](_0xb22f('0xd'),_0x367d4b,_0xb22f('0xe'));logger[_0xb22f('0xf')](_0xb22f('0x10'),_0x367d4b,_0xb22f('0xe'),JSON['stringify'](_0x1a3aae));if(_0x1a3aae['error']){if(_0x1a3aae['error'][_0xb22f('0x11')]===0x1f4){logger['error']('CmCustomField,\x20%s,\x20%s',_0x367d4b,_0x1a3aae['error'][_0xb22f('0x12')]);return _0x22c509(_0x1a3aae[_0xb22f('0x13')][_0xb22f('0x12')]);}logger[_0xb22f('0x13')](_0xb22f('0xd'),_0x367d4b,_0x1a3aae[_0xb22f('0x13')]['message']);return _0x34433b(_0x1a3aae[_0xb22f('0x13')]['message']);}else{logger[_0xb22f('0xc')]('CmCustomField,\x20%s,\x20%s',_0x367d4b,_0xb22f('0xe'));_0x34433b(_0x1a3aae[_0xb22f('0x14')][_0xb22f('0x12')]);}})[_0xb22f('0x15')](function(_0x447eaf){logger['error'](_0xb22f('0xd'),_0x367d4b,_0x447eaf);_0x22c509(_0x447eaf);});});} \ No newline at end of file +var _0xc874=['bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','moment'];(function(_0x23d9fc,_0x454351){var _0x1575be=function(_0x2ac95a){while(--_0x2ac95a){_0x23d9fc['push'](_0x23d9fc['shift']());}};_0x1575be(++_0x454351);}(_0xc874,0x154));var _0x4c87=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xc874[_0x411add];return _0x238242;};'use strict';var _=require(_0x4c87('0x0'));var util=require('util');var moment=require(_0x4c87('0x1'));var BPromise=require(_0x4c87('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4c87('0x3'))['db'];var utils=require(_0x4c87('0x4'));var logger=require(_0x4c87('0x5'))('rpc');var config=require(_0x4c87('0x6'));var jayson=require(_0x4c87('0x7'));var client=jayson['client'][_0x4c87('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3dafe0,_0x30c939,_0xdc4a29){return new BPromise(function(_0x116649,_0x5b7720){return client[_0x4c87('0x9')](_0x3dafe0,_0xdc4a29)['then'](function(_0x384268){logger[_0x4c87('0xa')](_0x4c87('0xb'),_0x30c939,_0x4c87('0xc'));logger[_0x4c87('0xd')]('CmCustomField,\x20%s,\x20%s,\x20%s',_0x30c939,_0x4c87('0xc'),JSON[_0x4c87('0xe')](_0x384268));if(_0x384268['error']){if(_0x384268[_0x4c87('0xf')][_0x4c87('0x10')]===0x1f4){logger[_0x4c87('0xf')](_0x4c87('0xb'),_0x30c939,_0x384268[_0x4c87('0xf')]['message']);return _0x5b7720(_0x384268['error']['message']);}logger[_0x4c87('0xf')](_0x4c87('0xb'),_0x30c939,_0x384268[_0x4c87('0xf')][_0x4c87('0x11')]);return _0x116649(_0x384268[_0x4c87('0xf')][_0x4c87('0x11')]);}else{logger[_0x4c87('0xa')](_0x4c87('0xb'),_0x30c939,'request\x20sent');_0x116649(_0x384268[_0x4c87('0x12')][_0x4c87('0x11')]);}})['catch'](function(_0x575de5){logger[_0x4c87('0xf')](_0x4c87('0xb'),_0x30c939,_0x575de5);_0x5b7720(_0x575de5);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 90f5705..17af381 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 _0xf271=['update','delete','destroy','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','post','create','put'];(function(_0x36ee93,_0x502135){var _0x2a936c=function(_0xb6659c){while(--_0xb6659c){_0x36ee93['push'](_0x36ee93['shift']());}};_0x2a936c(++_0x502135);}(_0xf271,0xff));var _0x1f27=function(_0x173375,_0x11809f){_0x173375=_0x173375-0x0;var _0x3ac760=_0xf271[_0x173375];return _0x3ac760;};'use strict';var multer=require(_0x1f27('0x0'));var util=require(_0x1f27('0x1'));var path=require('path');var timeout=require(_0x1f27('0x2'));var express=require(_0x1f27('0x3'));var router=express['Router']();var auth=require(_0x1f27('0x4'));var interaction=require(_0x1f27('0x5'));var config=require(_0x1f27('0x6'));var controller=require('./cmCustomField.controller');router['get']('/',auth[_0x1f27('0x7')](),controller[_0x1f27('0x8')]);router[_0x1f27('0x9')](_0x1f27('0xa'),auth[_0x1f27('0x7')](),controller[_0x1f27('0xb')]);router[_0x1f27('0xc')]('/',auth['isAuthenticated'](),controller[_0x1f27('0xd')]);router[_0x1f27('0xe')](_0x1f27('0xa'),auth['isAuthenticated'](),controller[_0x1f27('0xf')]);router[_0x1f27('0x10')](_0x1f27('0xa'),auth[_0x1f27('0x7')](),controller[_0x1f27('0x11')]);module['exports']=router; \ No newline at end of file +var _0x2450=['./cmCustomField.controller','get','isAuthenticated','/:id','show','post','create','put','update','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment'];(function(_0x16a6cc,_0x48192a){var _0xca4149=function(_0x200f07){while(--_0x200f07){_0x16a6cc['push'](_0x16a6cc['shift']());}};_0xca4149(++_0x48192a);}(_0x2450,0x1cc));var _0x0245=function(_0x12c2fe,_0x340166){_0x12c2fe=_0x12c2fe-0x0;var _0x5572d4=_0x2450[_0x12c2fe];return _0x5572d4;};'use strict';var multer=require(_0x0245('0x0'));var util=require(_0x0245('0x1'));var path=require(_0x0245('0x2'));var timeout=require(_0x0245('0x3'));var express=require(_0x0245('0x4'));var router=express[_0x0245('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x0245('0x6'));var config=require(_0x0245('0x7'));var controller=require(_0x0245('0x8'));router[_0x0245('0x9')]('/',auth[_0x0245('0xa')](),controller['index']);router[_0x0245('0x9')](_0x0245('0xb'),auth[_0x0245('0xa')](),controller[_0x0245('0xc')]);router[_0x0245('0xd')]('/',auth[_0x0245('0xa')](),controller[_0x0245('0xe')]);router[_0x0245('0xf')]('/:id',auth[_0x0245('0xa')](),controller[_0x0245('0x10')]);router['delete'](_0x0245('0xb'),auth[_0x0245('0xa')](),controller['destroy']);module[_0x0245('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 eeba0bc..1fb0516 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 _0xb66c=['DATE','format','INTEGER','UNSIGNED','contactListQueue','moment','exports','BOOLEAN'];(function(_0x3705f7,_0x2553c4){var _0x2a1cf2=function(_0x51f080){while(--_0x51f080){_0x3705f7['push'](_0x3705f7['shift']());}};_0x2a1cf2(++_0x2553c4);}(_0xb66c,0x175));var _0xcb66=function(_0xb235b9,_0x55271b){_0xb235b9=_0xb235b9-0x0;var _0x7fcb99=_0xb66c[_0xb235b9];return _0x7fcb99;};'use strict';var moment=require(_0xcb66('0x0'));var Sequelize=require('sequelize');module[_0xcb66('0x1')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'active':{'type':Sequelize[_0xcb66('0x2')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xcb66('0x3')],'defaultValue':moment()[_0xcb66('0x4')]('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0xcb66('0x5')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xcb66('0x5')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xcb66('0x5')],'defaultValue':0x0},'callback':{'type':Sequelize[_0xcb66('0x2')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize[_0xcb66('0x5')](0x2)[_0xcb66('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0xcb66('0x2')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xcb66('0x5')],'unique':_0xcb66('0x7')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0xcb66('0x7')},'UserId':{'type':Sequelize[_0xcb66('0x5')]},'VoiceQueueId':{'type':Sequelize[_0xcb66('0x5')],'unique':_0xcb66('0x7')},'CampaignId':{'type':Sequelize[_0xcb66('0x5')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xcb66('0x5')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xcb66('0x5')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xcb66('0x5')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xcb66('0x5')],'defaultValue':0x0}}; \ No newline at end of file +var _0x7da7=['sequelize','exports','DATE','format','INTEGER','BOOLEAN','STRING','contactListQueue','moment'];(function(_0x311fcf,_0x9e0e57){var _0xc44552=function(_0x403033){while(--_0x403033){_0x311fcf['push'](_0x311fcf['shift']());}};_0xc44552(++_0x9e0e57);}(_0x7da7,0x10d));var _0x77da=function(_0xbeb808,_0x881ddf){_0xbeb808=_0xbeb808-0x0;var _0x5d6909=_0x7da7[_0xbeb808];return _0x5d6909;};'use strict';var moment=require(_0x77da('0x0'));var Sequelize=require(_0x77da('0x1'));module[_0x77da('0x2')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x77da('0x3')],'defaultValue':moment()[_0x77da('0x4')]('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0x77da('0x5')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x77da('0x5')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'callback':{'type':Sequelize[_0x77da('0x6')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x77da('0x7')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize[_0x77da('0x5')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x77da('0x6')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x77da('0x5')],'unique':_0x77da('0x8')},'ListId':{'type':Sequelize[_0x77da('0x5')],'unique':_0x77da('0x8')},'UserId':{'type':Sequelize['INTEGER']},'VoiceQueueId':{'type':Sequelize[_0x77da('0x5')],'unique':_0x77da('0x8')},'CampaignId':{'type':Sequelize[_0x77da('0x5')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x77da('0x5')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x77da('0x5')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x77da('0x5')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x77da('0x5')],'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 2d2bed6..9326ac7 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 _0x71ae=['sequelize','transaction','format','direction','prev','isEmpty','hopperIds','ASC','scheduledAt','DESC','COALESCE(CmHopper.UserId,\x200)\x20ASC','COALESCE(CmHopper.UserId,\x200)\x20DESC','scheduledat','LOCK','UPDATE','Contact','CmCompany','Company','List','Queue','dialActive','getOpenContacts','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','count','offset','limit','status','set','apply','save','update','then','destroy','error','stack','name','index','map','fieldName','type','model','query','keys','filters','intersection','concat','$and','$or','$gt','$gte','$lt','$lte','$ne','$between','$notBetween','$in','$notIn','$like','$notLike','$iLike','$notILike','$overlap','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','CmHopper','includeAll','include','catch','show','params','rawAttributes','find','create','body','describe','VoiceQueueId','CampaignId','VoiceQueue','Campaign','omit','createdAt','updatedAt','state','deleted','membername','user','UserId','deletedat','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','queue','ivr','CmContact','lastName','isNil','firstName','calleridname','finally','getPreview','outbound','preview','dialOrderByScheduledAt'];(function(_0x44317d,_0x58e860){var _0x4f2c6c=function(_0x25bea8){while(--_0x25bea8){_0x44317d['push'](_0x44317d['shift']());}};_0x4f2c6c(++_0x58e860);}(_0x71ae,0xa9));var _0xe71a=function(_0x3b1b23,_0x21bccd){_0x3b1b23=_0x3b1b23-0x0;var _0x1efc85=_0x71ae[_0x3b1b23];return _0x1efc85;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe71a('0x0'));var rimraf=require(_0xe71a('0x1'));var zipdir=require(_0xe71a('0x2'));var jsonpatch=require(_0xe71a('0x3'));var rp=require(_0xe71a('0x4'));var moment=require(_0xe71a('0x5'));var BPromise=require(_0xe71a('0x6'));var Mustache=require(_0xe71a('0x7'));var util=require(_0xe71a('0x8'));var path=require(_0xe71a('0x9'));var sox=require(_0xe71a('0xa'));var csv=require(_0xe71a('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xe71a('0xc'));var squel=require(_0xe71a('0xd'));var crypto=require(_0xe71a('0xe'));var jsforce=require(_0xe71a('0xf'));var deskjs=require(_0xe71a('0x10'));var toCsv=require(_0xe71a('0xb'));var querystring=require(_0xe71a('0x11'));var Papa=require('papaparse');var Redis=require(_0xe71a('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe71a('0x13'));var hardwareService=require(_0xe71a('0x14'));var logger=require(_0xe71a('0x15'))('api');var utils=require(_0xe71a('0x16'));var config=require(_0xe71a('0x17'));var db=require(_0xe71a('0x18'))['db'];function respondWithStatusCode(_0x556ff5,_0x4830c2){_0x4830c2=_0x4830c2||0xcc;return function(_0x4ec873){if(_0x4ec873){return _0x556ff5[_0xe71a('0x19')](_0x4830c2);}return _0x556ff5['status'](_0x4830c2)[_0xe71a('0x1a')]();};}function respondWithResult(_0x456fe4,_0x145025){_0x145025=_0x145025||0xc8;return function(_0x11a8c8){if(_0x11a8c8){return _0x456fe4['status'](_0x145025)[_0xe71a('0x1b')](_0x11a8c8);}};}function respondWithFilteredResult(_0x53a070,_0x5a4c41){return function(_0x17fe7e){if(_0x17fe7e){var _0x4c17e7=_0x17fe7e[_0xe71a('0x1c')],_0x878b70=_0x5a4c41[_0xe71a('0x1d')],_0x2b2a95=_0x5a4c41[_0xe71a('0x1d')]+_0x5a4c41[_0xe71a('0x1e')],_0xa7ec58;if(_0x2b2a95>=_0x4c17e7){_0x2b2a95=_0x4c17e7;_0xa7ec58=0xc8;}else{_0xa7ec58=0xce;}_0x53a070[_0xe71a('0x1f')](_0xa7ec58);return _0x53a070[_0xe71a('0x20')]('Content-Range',_0x878b70+'-'+_0x2b2a95+'/'+_0x4c17e7)[_0xe71a('0x1b')](_0x17fe7e);}return null;};}function patchUpdates(_0x27081d){return function(_0xf26343){try{jsonpatch[_0xe71a('0x21')](_0xf26343,_0x27081d,!![]);}catch(_0x4fe784){return BPromise['reject'](_0x4fe784);}return _0xf26343[_0xe71a('0x22')]();};}function saveUpdates(_0x767aab,_0x586a73){return function(_0x281bec){if(_0x281bec){return _0x281bec[_0xe71a('0x23')](_0x767aab)[_0xe71a('0x24')](function(_0x516a02){return _0x516a02;});}return null;};}function removeEntity(_0x1f7b7d,_0xfcbe13){return function(_0x3b715c){if(_0x3b715c){return _0x3b715c[_0xe71a('0x25')]()[_0xe71a('0x24')](function(){_0x1f7b7d[_0xe71a('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x19dc48,_0x5a3e80){return function(_0x404df9){if(!_0x404df9){_0x19dc48[_0xe71a('0x19')](0x194);}return _0x404df9;};}function handleError(_0x4714ce,_0xc386bd){_0xc386bd=_0xc386bd||0x1f4;return function(_0x12cfb5){logger[_0xe71a('0x26')](_0x12cfb5[_0xe71a('0x27')]);if(_0x12cfb5[_0xe71a('0x28')]){delete _0x12cfb5[_0xe71a('0x28')];}_0x4714ce[_0xe71a('0x1f')](_0xc386bd)['send'](_0x12cfb5);};}exports[_0xe71a('0x29')]=function(_0x4a6951,_0x3e67b9){var _0x2377c8={},_0x12b0cf={},_0x31b8dd={'count':0x0,'rows':[]};var _0x1ddc9e=_[_0xe71a('0x2a')](db['CmHopper']['rawAttributes'],function(_0x2e9cbc){return{'name':_0x2e9cbc[_0xe71a('0x2b')],'type':_0x2e9cbc[_0xe71a('0x2c')]['key']};});_0x12b0cf[_0xe71a('0x2d')]=_[_0xe71a('0x2a')](_0x1ddc9e,_0xe71a('0x28'));_0x12b0cf[_0xe71a('0x2e')]=_[_0xe71a('0x2f')](_0x4a6951['query']);_0x12b0cf[_0xe71a('0x30')]=_[_0xe71a('0x31')](_0x12b0cf[_0xe71a('0x2d')],_0x12b0cf[_0xe71a('0x2e')]);_0x12b0cf[_0xe71a('0x30')]=_[_0xe71a('0x32')](_0x12b0cf[_0xe71a('0x30')],[_0xe71a('0x33'),_0xe71a('0x34'),_0xe71a('0x35'),_0xe71a('0x36'),_0xe71a('0x37'),_0xe71a('0x38'),_0xe71a('0x39'),'$eq','$not',_0xe71a('0x3a'),_0xe71a('0x3b'),_0xe71a('0x3c'),_0xe71a('0x3d'),_0xe71a('0x3e'),_0xe71a('0x3f'),_0xe71a('0x40'),_0xe71a('0x41'),_0xe71a('0x3e'),_0xe71a('0x42'),'$contains','$contained','$any']);_0x2377c8['attributes']=_[_0xe71a('0x31')](_0x12b0cf[_0xe71a('0x2d')],qs[_0xe71a('0x43')](_0x4a6951[_0xe71a('0x2e')][_0xe71a('0x43')]));_0x2377c8[_0xe71a('0x44')]=_0x2377c8[_0xe71a('0x44')][_0xe71a('0x45')]?_0x2377c8[_0xe71a('0x44')]:_0x12b0cf[_0xe71a('0x2d')];if(!_0x4a6951['query'][_0xe71a('0x46')](_0xe71a('0x47'))){_0x2377c8[_0xe71a('0x1e')]=qs[_0xe71a('0x1e')](_0x4a6951[_0xe71a('0x2e')][_0xe71a('0x1e')]);_0x2377c8[_0xe71a('0x1d')]=qs[_0xe71a('0x1d')](_0x4a6951[_0xe71a('0x2e')]['offset']);}_0x2377c8[_0xe71a('0x48')]=qs[_0xe71a('0x49')](_0x4a6951[_0xe71a('0x2e')][_0xe71a('0x49')]);_0x2377c8[_0xe71a('0x4a')]=qs[_0xe71a('0x30')](_[_0xe71a('0x4b')](_0x4a6951[_0xe71a('0x2e')],_0x12b0cf[_0xe71a('0x30')]),_0x1ddc9e);if(_0x4a6951[_0xe71a('0x2e')][_0xe71a('0x4c')]){_0x2377c8['where']=_['merge'](_0x2377c8['where'],{'$or':_['map'](_0x1ddc9e,function(_0x283e34){if(_0x283e34[_0xe71a('0x2c')]!=='VIRTUAL'){var _0x210261={};_0x210261[_0x283e34[_0xe71a('0x28')]]={'$like':'%'+_0x4a6951['query'][_0xe71a('0x4c')]+'%'};return _0x210261;}})});}_0x2377c8=_[_0xe71a('0x4d')]({},_0x2377c8,_0x4a6951[_0xe71a('0x4e')]);var _0x4a2289={'where':_0x2377c8[_0xe71a('0x4a')]};return db[_0xe71a('0x4f')]['count'](_0x4a2289)[_0xe71a('0x24')](function(_0xb5ce9){_0x31b8dd['count']=_0xb5ce9;if(_0x4a6951[_0xe71a('0x2e')][_0xe71a('0x50')]){_0x2377c8[_0xe71a('0x51')]=[{'all':!![]}];}return db[_0xe71a('0x4f')]['findAll'](_0x2377c8);})[_0xe71a('0x24')](function(_0x5497a6){_0x31b8dd['rows']=_0x5497a6;return _0x31b8dd;})[_0xe71a('0x24')](respondWithFilteredResult(_0x3e67b9,_0x2377c8))[_0xe71a('0x52')](handleError(_0x3e67b9,null));};exports[_0xe71a('0x53')]=function(_0x59596b,_0x411e40){var _0x481713={'raw':!![],'where':{'id':_0x59596b[_0xe71a('0x54')]['id']}},_0x167849={};_0x167849[_0xe71a('0x2d')]=_[_0xe71a('0x2f')](db[_0xe71a('0x4f')][_0xe71a('0x55')]);_0x167849[_0xe71a('0x2e')]=_[_0xe71a('0x2f')](_0x59596b[_0xe71a('0x2e')]);_0x167849[_0xe71a('0x30')]=_['intersection'](_0x167849[_0xe71a('0x2d')],_0x167849[_0xe71a('0x2e')]);_0x481713[_0xe71a('0x44')]=_[_0xe71a('0x31')](_0x167849['model'],qs['fields'](_0x59596b[_0xe71a('0x2e')]['fields']));_0x481713[_0xe71a('0x44')]=_0x481713[_0xe71a('0x44')]['length']?_0x481713[_0xe71a('0x44')]:_0x167849[_0xe71a('0x2d')];if(_0x59596b['query'][_0xe71a('0x50')]){_0x481713[_0xe71a('0x51')]=[{'all':!![]}];}_0x481713=_[_0xe71a('0x4d')]({},_0x481713,_0x59596b[_0xe71a('0x4e')]);return db[_0xe71a('0x4f')][_0xe71a('0x56')](_0x481713)[_0xe71a('0x24')](handleEntityNotFound(_0x411e40,null))[_0xe71a('0x24')](respondWithResult(_0x411e40,null))[_0xe71a('0x52')](handleError(_0x411e40,null));};exports[_0xe71a('0x57')]=function(_0x345cf0,_0x59cbaf){return db['CmHopper'][_0xe71a('0x57')](_0x345cf0[_0xe71a('0x58')],{})[_0xe71a('0x24')](respondWithResult(_0x59cbaf,0xc9))[_0xe71a('0x52')](handleError(_0x59cbaf,null));};exports[_0xe71a('0x23')]=function(_0x535912,_0x7e23a0){if(_0x535912[_0xe71a('0x58')]['id']){delete _0x535912[_0xe71a('0x58')]['id'];}return db[_0xe71a('0x4f')]['find']({'where':{'id':_0x535912[_0xe71a('0x54')]['id']}})[_0xe71a('0x24')](handleEntityNotFound(_0x7e23a0,null))[_0xe71a('0x24')](saveUpdates(_0x535912[_0xe71a('0x58')],null))['then'](respondWithResult(_0x7e23a0,null))[_0xe71a('0x52')](handleError(_0x7e23a0,null));};exports[_0xe71a('0x59')]=function(_0x4836f6,_0x441dd5){return db[_0xe71a('0x4f')]['describe']()[_0xe71a('0x24')](respondWithResult(_0x441dd5,null))[_0xe71a('0x52')](handleError(_0x441dd5,null));};exports[_0xe71a('0x25')]=function(_0x4a4708,_0x3a6df3){var _0x5f2f7d;return db[_0xe71a('0x4f')][_0xe71a('0x56')]({'where':{'id':_0x4a4708[_0xe71a('0x54')]['id']}})[_0xe71a('0x24')](handleEntityNotFound(_0x3a6df3,null))[_0xe71a('0x24')](function(_0x13ed64){if(_0x13ed64){return _0x13ed64['destroy']()[_0xe71a('0x24')](function(_0x5f097e){return _0x5f097e;});}})[_0xe71a('0x24')](function(_0x3e0026){_0x5f2f7d=_0x3e0026;if(_0x3e0026){if(_0x3e0026[_0xe71a('0x5a')]||_0x3e0026[_0xe71a('0x5b')]){return db[_0x3e0026[_0xe71a('0x5a')]?_0xe71a('0x5c'):_0xe71a('0x5d')][_0xe71a('0x56')]({'where':{'id':_0x3e0026['VoiceQueueId']?_0x3e0026[_0xe71a('0x5a')]:_0x3e0026[_0xe71a('0x5b')]},'attributes':['id',_0xe71a('0x28')],'raw':!![]});}}})[_0xe71a('0x24')](function(_0x53cfeb){var _0x3b8705={};if(_0x53cfeb){_[_0xe71a('0x4d')](_0x3b8705,_[_0xe71a('0x5e')](_0x5f2f7d['dataValues'],[_0xe71a('0x5f'),_0xe71a('0x60'),'id']));_0x3b8705[_0xe71a('0x61')]=0x15;_0x3b8705['statedesc']=_0xe71a('0x62');_0x3b8705['campaign']=_0x53cfeb[_0xe71a('0x28')];_0x3b8705[_0xe71a('0x63')]=_0x4a4708[_0xe71a('0x64')][_0xe71a('0x28')];_0x3b8705[_0xe71a('0x65')]=_0x4a4708[_0xe71a('0x64')]['id'];_0x3b8705[_0xe71a('0x62')]=!![];_0x3b8705[_0xe71a('0x66')]=moment()['format'](_0xe71a('0x67'));_0x3b8705[_0xe71a('0x68')]=_0x5f2f7d[_0xe71a('0x69')];_0x3b8705[_0xe71a('0x6a')]=_0x5f2f7d[_0xe71a('0x5a')]?_0xe71a('0x6b'):_0xe71a('0x6c');return db[_0xe71a('0x6d')]['find']({'where':{'id':_0x3b8705['ContactId']},'attributes':['firstName',_0xe71a('0x6e')]})[_0xe71a('0x24')](function(_0x2dc4cd){if(!_[_0xe71a('0x6f')](_0x3a6df3)&&!_[_0xe71a('0x6f')](_0x2dc4cd[_0xe71a('0x70')])){_0x3b8705[_0xe71a('0x71')]=_0x2dc4cd[_0xe71a('0x70')];if(!_[_0xe71a('0x6f')](_0x2dc4cd[_0xe71a('0x6e')])){_0x3b8705[_0xe71a('0x71')]+='\x20'+_0x2dc4cd[_0xe71a('0x6e')];}}})[_0xe71a('0x72')](function(){return db['CmHopperFinal']['create'](_0x3b8705);});}})[_0xe71a('0x24')](function(){return _0x3a6df3[_0xe71a('0x1f')](0xcc)[_0xe71a('0x1a')]();})[_0xe71a('0x52')](handleError(_0x3a6df3,null));};exports[_0xe71a('0x73')]=function(_0x59f389,_0x42f3ee,_0x9f29b8){var _0x56e1b4=[];return db[_0xe71a('0x6d')][_0xe71a('0x59')]()[_0xe71a('0x24')](function(_0x590c01){_0x56e1b4=_[_0xe71a('0x2f')](_0x590c01);return _0x59f389[_0xe71a('0x64')]['getVoiceQueues']({'where':{'type':_0xe71a('0x74'),'dialActive':!![],'dialMethod':_0xe71a('0x75')},'attributes':['id',_0xe71a('0x76')],'raw':!![]});})[_0xe71a('0x24')](function(_0x32efb8){if(_0x32efb8&&_0x32efb8[_0xe71a('0x45')]){return db[_0xe71a('0x77')][_0xe71a('0x78')](function(_0x5f3fb4){var _0x38efa8={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xe71a('0x79')](_0xe71a('0x67'))},'VoiceQueueId':{'$in':_['map'](_0x32efb8,'id')},'$or':[{'UserId':null},{'UserId':_0x59f389[_0xe71a('0x64')]['id']}]};var _0xc56708=[];if(_0x59f389[_0xe71a('0x58')][_0xe71a('0x7a')]&&_0x59f389[_0xe71a('0x58')][_0xe71a('0x7a')]===_0xe71a('0x7b')){if(!_[_0xe71a('0x7c')](_0x59f389[_0xe71a('0x58')][_0xe71a('0x7d')])){_0x38efa8['id']={'$in':_0x59f389[_0xe71a('0x58')][_0xe71a('0x7d')]};}_0xc56708=[['priority',_0xe71a('0x7e')],[_0xe71a('0x7f'),_0x32efb8[0x0][_0xe71a('0x76')]===_0xe71a('0x7e')?_0xe71a('0x80'):_0xe71a('0x7e')],db[_0xe71a('0x77')]['literal'](_0xe71a('0x81')),['id',_0xe71a('0x80')]];}else{if(!_[_0xe71a('0x7c')](_0x59f389['body']['hopperIds'])){_0x38efa8['id']={'$notIn':_0x59f389['body'][_0xe71a('0x7d')]};}_0xc56708=[['priority',_0xe71a('0x80')],['scheduledAt',_0x32efb8[0x0][_0xe71a('0x76')]],db[_0xe71a('0x77')]['literal'](_0xe71a('0x82')),['id','ASC']];}return db[_0xe71a('0x4f')]['findOne']({'attributes':['id',_0xe71a('0x83')],'where':_0x38efa8,'order':_0xc56708,'transaction':_0x5f3fb4,'lock':_0x5f3fb4[_0xe71a('0x84')][_0xe71a('0x85')],'include':[{'model':db[_0xe71a('0x6d')],'as':_0xe71a('0x86'),'attributes':_0x56e1b4,'include':[{'model':db[_0xe71a('0x87')],'as':_0xe71a('0x88'),'attributes':['id','name']}]},{'model':db['CmList'],'as':_0xe71a('0x89'),'attributes':['id',_0xe71a('0x28')]},{'model':db[_0xe71a('0x5c')],'as':_0xe71a('0x8a'),'attributes':['id',_0xe71a('0x28'),_0xe71a('0x8b')]}]})[_0xe71a('0x24')](function(_0x10f082){if(_0x10f082){return _0x10f082[_0xe71a('0x23')]({'UserId':_0x59f389[_0xe71a('0x64')]['id']},{'transaction':_0x5f3fb4});}});});}})['then'](handleEntityNotFound(_0x42f3ee,null))[_0xe71a('0x24')](respondWithResult(_0x42f3ee,null))[_0xe71a('0x52')](handleError(_0x42f3ee,null));};exports[_0xe71a('0x8c')]=function(_0x455211,_0x30c641,_0x55261c){return _0x455211['user']['getVoiceQueues']({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0xe71a('0x75')},'attributes':['id'],'raw':!![]})['then'](function(_0x46f820){if(_0x46f820&&_0x46f820[_0xe71a('0x45')]){return db[_0xe71a('0x4f')][_0xe71a('0x1c')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xe71a('0x79')](_0xe71a('0x67'))},'VoiceQueueId':{'$in':_[_0xe71a('0x2a')](_0x46f820,'id')},'$or':[{'UserId':null},{'UserId':_0x455211[_0xe71a('0x64')]['id']}]}});}return 0x0;})['then'](function(_0x24d22f){if(!_[_0xe71a('0x6f')](_0x24d22f)&&_[_0xe71a('0x8d')](_0x24d22f)){return _0x30c641[_0xe71a('0x1f')](0xc8)[_0xe71a('0x1b')]({'contacts':_0x24d22f});}else{logger[_0xe71a('0x26')](_0xe71a('0x8e'),'getOpenContacts',0x194,_0xe71a('0x8f'));_0x30c641[_0xe71a('0x19')](0x194);}})[_0xe71a('0x52')](handleError(_0x30c641,null));}; \ No newline at end of file +var _0x978d=['query','keys','filters','intersection','$and','$gt','$gte','$lt','$lte','$ne','$eq','$not','$notBetween','$in','$notIn','$like','$notLike','$iLike','$notILike','$overlap','$contains','$any','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','pick','where','merge','map','VIRTUAL','filter','options','count','includeAll','include','findAll','rows','catch','show','model','rawAttributes','create','body','find','params','describe','VoiceQueueId','VoiceQueue','Campaign','CampaignId','dataValues','createdAt','updatedAt','statedesc','campaign','membername','user','UserId','deleted','deletedat','format','calleridnum','phone','campaigntype','queue','ivr','CmContact','firstName','isNil','lastName','calleridname','CmHopperFinal','getVoiceQueues','preview','dialOrderByScheduledAt','sequelize','transaction','YYYY-MM-DD\x20HH:mm:ss','direction','prev','isEmpty','hopperIds','priority','ASC','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','scheduledAt','findOne','scheduledat','LOCK','Contact','CmCompany','Company','Queue','outbound','isNumber','getOpenContacts','entity\x20not\x20found','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','limit','set','apply','reject','update','then','destroy','stack','name','index','CmHopper','fieldName','type','key'];(function(_0x38eca6,_0x5f4874){var _0xee8ac1=function(_0x1d2643){while(--_0x1d2643){_0x38eca6['push'](_0x38eca6['shift']());}};_0xee8ac1(++_0x5f4874);}(_0x978d,0x190));var _0xd978=function(_0x1d4bb3,_0x3d1187){_0x1d4bb3=_0x1d4bb3-0x0;var _0xb3319b=_0x978d[_0x1d4bb3];return _0xb3319b;};'use strict';var pdf=require(_0xd978('0x0'));var emlformat=require(_0xd978('0x1'));var rimraf=require(_0xd978('0x2'));var zipdir=require(_0xd978('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd978('0x4'));var moment=require(_0xd978('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xd978('0x6'));var util=require(_0xd978('0x7'));var path=require(_0xd978('0x8'));var sox=require(_0xd978('0x9'));var csv=require('to-csv');var ejs=require(_0xd978('0xa'));var fs=require('fs');var _=require(_0xd978('0xb'));var squel=require(_0xd978('0xc'));var crypto=require(_0xd978('0xd'));var jsforce=require(_0xd978('0xe'));var deskjs=require(_0xd978('0xf'));var toCsv=require(_0xd978('0x10'));var querystring=require(_0xd978('0x11'));var Papa=require(_0xd978('0x12'));var Redis=require(_0xd978('0x13'));var authService=require(_0xd978('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xd978('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd978('0x16'))('api');var utils=require(_0xd978('0x17'));var config=require(_0xd978('0x18'));var db=require(_0xd978('0x19'))['db'];function respondWithStatusCode(_0xddbb0a,_0xf01063){_0xf01063=_0xf01063||0xcc;return function(_0x2217a4){if(_0x2217a4){return _0xddbb0a[_0xd978('0x1a')](_0xf01063);}return _0xddbb0a['status'](_0xf01063)[_0xd978('0x1b')]();};}function respondWithResult(_0x2450b1,_0x5bec8a){_0x5bec8a=_0x5bec8a||0xc8;return function(_0x18b134){if(_0x18b134){return _0x2450b1[_0xd978('0x1c')](_0x5bec8a)[_0xd978('0x1d')](_0x18b134);}};}function respondWithFilteredResult(_0x2d833d,_0x283faa){return function(_0x963b6c){if(_0x963b6c){var _0x24c19f=_0x963b6c['count'],_0x2c1d7f=_0x283faa['offset'],_0x158b4d=_0x283faa['offset']+_0x283faa[_0xd978('0x1e')],_0x463d7b;if(_0x158b4d>=_0x24c19f){_0x158b4d=_0x24c19f;_0x463d7b=0xc8;}else{_0x463d7b=0xce;}_0x2d833d[_0xd978('0x1c')](_0x463d7b);return _0x2d833d[_0xd978('0x1f')]('Content-Range',_0x2c1d7f+'-'+_0x158b4d+'/'+_0x24c19f)['json'](_0x963b6c);}return null;};}function patchUpdates(_0x362ab1){return function(_0x154edd){try{jsonpatch[_0xd978('0x20')](_0x154edd,_0x362ab1,!![]);}catch(_0x124a31){return BPromise[_0xd978('0x21')](_0x124a31);}return _0x154edd['save']();};}function saveUpdates(_0x14f5c4,_0x29d8be){return function(_0x30ee88){if(_0x30ee88){return _0x30ee88[_0xd978('0x22')](_0x14f5c4)[_0xd978('0x23')](function(_0xa49447){return _0xa49447;});}return null;};}function removeEntity(_0x5e1e5a,_0x1ae86b){return function(_0x4242b7){if(_0x4242b7){return _0x4242b7[_0xd978('0x24')]()[_0xd978('0x23')](function(){_0x5e1e5a[_0xd978('0x1c')](0xcc)[_0xd978('0x1b')]();});}};}function handleEntityNotFound(_0x5036e5,_0x2adb12){return function(_0x35f5f1){if(!_0x35f5f1){_0x5036e5['sendStatus'](0x194);}return _0x35f5f1;};}function handleError(_0x497c73,_0x4b7ea9){_0x4b7ea9=_0x4b7ea9||0x1f4;return function(_0x4cf749){logger['error'](_0x4cf749[_0xd978('0x25')]);if(_0x4cf749[_0xd978('0x26')]){delete _0x4cf749[_0xd978('0x26')];}_0x497c73['status'](_0x4b7ea9)['send'](_0x4cf749);};}exports[_0xd978('0x27')]=function(_0x32d1ce,_0x444e9d){var _0x1c4608={},_0x4edf26={},_0x4068a4={'count':0x0,'rows':[]};var _0x1aa952=_['map'](db[_0xd978('0x28')]['rawAttributes'],function(_0x293aa8){return{'name':_0x293aa8[_0xd978('0x29')],'type':_0x293aa8[_0xd978('0x2a')][_0xd978('0x2b')]};});_0x4edf26['model']=_['map'](_0x1aa952,_0xd978('0x26'));_0x4edf26[_0xd978('0x2c')]=_[_0xd978('0x2d')](_0x32d1ce[_0xd978('0x2c')]);_0x4edf26[_0xd978('0x2e')]=_[_0xd978('0x2f')](_0x4edf26['model'],_0x4edf26[_0xd978('0x2c')]);_0x4edf26[_0xd978('0x2e')]=_['concat'](_0x4edf26[_0xd978('0x2e')],[_0xd978('0x30'),'$or',_0xd978('0x31'),_0xd978('0x32'),_0xd978('0x33'),_0xd978('0x34'),_0xd978('0x35'),_0xd978('0x36'),_0xd978('0x37'),'$between',_0xd978('0x38'),_0xd978('0x39'),_0xd978('0x3a'),_0xd978('0x3b'),_0xd978('0x3c'),_0xd978('0x3d'),_0xd978('0x3e'),_0xd978('0x3b'),_0xd978('0x3f'),_0xd978('0x40'),'$contained',_0xd978('0x41')]);_0x1c4608[_0xd978('0x42')]=_[_0xd978('0x2f')](_0x4edf26['model'],qs[_0xd978('0x43')](_0x32d1ce[_0xd978('0x2c')][_0xd978('0x43')]));_0x1c4608['attributes']=_0x1c4608[_0xd978('0x42')][_0xd978('0x44')]?_0x1c4608[_0xd978('0x42')]:_0x4edf26['model'];if(!_0x32d1ce[_0xd978('0x2c')][_0xd978('0x45')](_0xd978('0x46'))){_0x1c4608['limit']=qs[_0xd978('0x1e')](_0x32d1ce[_0xd978('0x2c')][_0xd978('0x1e')]);_0x1c4608[_0xd978('0x47')]=qs['offset'](_0x32d1ce[_0xd978('0x2c')][_0xd978('0x47')]);}_0x1c4608[_0xd978('0x48')]=qs[_0xd978('0x49')](_0x32d1ce[_0xd978('0x2c')][_0xd978('0x49')]);_0x1c4608['where']=qs[_0xd978('0x2e')](_[_0xd978('0x4a')](_0x32d1ce[_0xd978('0x2c')],_0x4edf26[_0xd978('0x2e')]),_0x1aa952);if(_0x32d1ce['query']['filter']){_0x1c4608[_0xd978('0x4b')]=_[_0xd978('0x4c')](_0x1c4608[_0xd978('0x4b')],{'$or':_[_0xd978('0x4d')](_0x1aa952,function(_0x12ab61){if(_0x12ab61[_0xd978('0x2a')]!==_0xd978('0x4e')){var _0x4a751d={};_0x4a751d[_0x12ab61[_0xd978('0x26')]]={'$like':'%'+_0x32d1ce[_0xd978('0x2c')][_0xd978('0x4f')]+'%'};return _0x4a751d;}})});}_0x1c4608=_[_0xd978('0x4c')]({},_0x1c4608,_0x32d1ce[_0xd978('0x50')]);var _0x494f7f={'where':_0x1c4608[_0xd978('0x4b')]};return db['CmHopper'][_0xd978('0x51')](_0x494f7f)[_0xd978('0x23')](function(_0x349e1a){_0x4068a4['count']=_0x349e1a;if(_0x32d1ce[_0xd978('0x2c')][_0xd978('0x52')]){_0x1c4608[_0xd978('0x53')]=[{'all':!![]}];}return db['CmHopper'][_0xd978('0x54')](_0x1c4608);})[_0xd978('0x23')](function(_0x3e4a83){_0x4068a4[_0xd978('0x55')]=_0x3e4a83;return _0x4068a4;})[_0xd978('0x23')](respondWithFilteredResult(_0x444e9d,_0x1c4608))[_0xd978('0x56')](handleError(_0x444e9d,null));};exports[_0xd978('0x57')]=function(_0x210f2e,_0x4e1812){var _0x4d43e3={'raw':!![],'where':{'id':_0x210f2e['params']['id']}},_0x401f87={};_0x401f87[_0xd978('0x58')]=_[_0xd978('0x2d')](db[_0xd978('0x28')][_0xd978('0x59')]);_0x401f87[_0xd978('0x2c')]=_[_0xd978('0x2d')](_0x210f2e['query']);_0x401f87[_0xd978('0x2e')]=_['intersection'](_0x401f87[_0xd978('0x58')],_0x401f87[_0xd978('0x2c')]);_0x4d43e3[_0xd978('0x42')]=_[_0xd978('0x2f')](_0x401f87[_0xd978('0x58')],qs['fields'](_0x210f2e[_0xd978('0x2c')][_0xd978('0x43')]));_0x4d43e3[_0xd978('0x42')]=_0x4d43e3[_0xd978('0x42')]['length']?_0x4d43e3[_0xd978('0x42')]:_0x401f87['model'];if(_0x210f2e['query'][_0xd978('0x52')]){_0x4d43e3[_0xd978('0x53')]=[{'all':!![]}];}_0x4d43e3=_[_0xd978('0x4c')]({},_0x4d43e3,_0x210f2e['options']);return db[_0xd978('0x28')]['find'](_0x4d43e3)[_0xd978('0x23')](handleEntityNotFound(_0x4e1812,null))['then'](respondWithResult(_0x4e1812,null))[_0xd978('0x56')](handleError(_0x4e1812,null));};exports['create']=function(_0x1c173f,_0x2a745e){return db['CmHopper'][_0xd978('0x5a')](_0x1c173f['body'],{})[_0xd978('0x23')](respondWithResult(_0x2a745e,0xc9))[_0xd978('0x56')](handleError(_0x2a745e,null));};exports[_0xd978('0x22')]=function(_0x451000,_0x123d59){if(_0x451000[_0xd978('0x5b')]['id']){delete _0x451000[_0xd978('0x5b')]['id'];}return db[_0xd978('0x28')][_0xd978('0x5c')]({'where':{'id':_0x451000[_0xd978('0x5d')]['id']}})[_0xd978('0x23')](handleEntityNotFound(_0x123d59,null))['then'](saveUpdates(_0x451000[_0xd978('0x5b')],null))[_0xd978('0x23')](respondWithResult(_0x123d59,null))[_0xd978('0x56')](handleError(_0x123d59,null));};exports[_0xd978('0x5e')]=function(_0x3d8d84,_0x143961){return db[_0xd978('0x28')][_0xd978('0x5e')]()[_0xd978('0x23')](respondWithResult(_0x143961,null))['catch'](handleError(_0x143961,null));};exports[_0xd978('0x24')]=function(_0x457ca9,_0x5f2969){var _0x44f9b8;return db[_0xd978('0x28')][_0xd978('0x5c')]({'where':{'id':_0x457ca9['params']['id']}})['then'](handleEntityNotFound(_0x5f2969,null))['then'](function(_0x22a5f4){if(_0x22a5f4){return _0x22a5f4['destroy']()[_0xd978('0x23')](function(_0x53ec30){return _0x53ec30;});}})['then'](function(_0x335b4f){_0x44f9b8=_0x335b4f;if(_0x335b4f){if(_0x335b4f[_0xd978('0x5f')]||_0x335b4f['CampaignId']){return db[_0x335b4f[_0xd978('0x5f')]?_0xd978('0x60'):_0xd978('0x61')][_0xd978('0x5c')]({'where':{'id':_0x335b4f[_0xd978('0x5f')]?_0x335b4f[_0xd978('0x5f')]:_0x335b4f[_0xd978('0x62')]},'attributes':['id','name'],'raw':!![]});}}})[_0xd978('0x23')](function(_0xd21c50){var _0x4e91d0={};if(_0xd21c50){_['merge'](_0x4e91d0,_['omit'](_0x44f9b8[_0xd978('0x63')],[_0xd978('0x64'),_0xd978('0x65'),'id']));_0x4e91d0['state']=0x15;_0x4e91d0[_0xd978('0x66')]='deleted';_0x4e91d0[_0xd978('0x67')]=_0xd21c50['name'];_0x4e91d0[_0xd978('0x68')]=_0x457ca9[_0xd978('0x69')]['name'];_0x4e91d0[_0xd978('0x6a')]=_0x457ca9[_0xd978('0x69')]['id'];_0x4e91d0[_0xd978('0x6b')]=!![];_0x4e91d0[_0xd978('0x6c')]=moment()[_0xd978('0x6d')]('YYYY-MM-DD\x20HH:mm:ss');_0x4e91d0[_0xd978('0x6e')]=_0x44f9b8[_0xd978('0x6f')];_0x4e91d0[_0xd978('0x70')]=_0x44f9b8['VoiceQueueId']?_0xd978('0x71'):_0xd978('0x72');return db[_0xd978('0x73')][_0xd978('0x5c')]({'where':{'id':_0x4e91d0['ContactId']},'attributes':[_0xd978('0x74'),'lastName']})[_0xd978('0x23')](function(_0x2bbcd9){if(!_[_0xd978('0x75')](_0x5f2969)&&!_['isNil'](_0x2bbcd9[_0xd978('0x74')])){_0x4e91d0['calleridname']=_0x2bbcd9[_0xd978('0x74')];if(!_[_0xd978('0x75')](_0x2bbcd9[_0xd978('0x76')])){_0x4e91d0[_0xd978('0x77')]+='\x20'+_0x2bbcd9['lastName'];}}})['finally'](function(){return db[_0xd978('0x78')][_0xd978('0x5a')](_0x4e91d0);});}})[_0xd978('0x23')](function(){return _0x5f2969[_0xd978('0x1c')](0xcc)[_0xd978('0x1b')]();})[_0xd978('0x56')](handleError(_0x5f2969,null));};exports['getPreview']=function(_0x87c98d,_0x582af8,_0x4114ad){var _0x51c1e1=[];return db[_0xd978('0x73')][_0xd978('0x5e')]()['then'](function(_0x13baa3){_0x51c1e1=_[_0xd978('0x2d')](_0x13baa3);return _0x87c98d[_0xd978('0x69')][_0xd978('0x79')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0xd978('0x7a')},'attributes':['id',_0xd978('0x7b')],'raw':!![]});})[_0xd978('0x23')](function(_0x5ece85){if(_0x5ece85&&_0x5ece85[_0xd978('0x44')]){return db[_0xd978('0x7c')][_0xd978('0x7d')](function(_0x2d47a3){var _0x264731={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xd978('0x6d')](_0xd978('0x7e'))},'VoiceQueueId':{'$in':_[_0xd978('0x4d')](_0x5ece85,'id')},'$or':[{'UserId':null},{'UserId':_0x87c98d['user']['id']}]};var _0x1edeb5=[];if(_0x87c98d[_0xd978('0x5b')]['direction']&&_0x87c98d[_0xd978('0x5b')][_0xd978('0x7f')]===_0xd978('0x80')){if(!_[_0xd978('0x81')](_0x87c98d[_0xd978('0x5b')][_0xd978('0x82')])){_0x264731['id']={'$in':_0x87c98d[_0xd978('0x5b')][_0xd978('0x82')]};}_0x1edeb5=[[_0xd978('0x83'),_0xd978('0x84')],['scheduledAt',_0x5ece85[0x0][_0xd978('0x7b')]===_0xd978('0x84')?_0xd978('0x85'):'ASC'],db[_0xd978('0x7c')][_0xd978('0x86')](_0xd978('0x87')),['id',_0xd978('0x85')]];}else{if(!_[_0xd978('0x81')](_0x87c98d[_0xd978('0x5b')][_0xd978('0x82')])){_0x264731['id']={'$notIn':_0x87c98d[_0xd978('0x5b')][_0xd978('0x82')]};}_0x1edeb5=[['priority',_0xd978('0x85')],[_0xd978('0x88'),_0x5ece85[0x0][_0xd978('0x7b')]],db[_0xd978('0x7c')]['literal']('COALESCE(CmHopper.UserId,\x200)\x20DESC'),['id',_0xd978('0x84')]];}return db[_0xd978('0x28')][_0xd978('0x89')]({'attributes':['id',_0xd978('0x8a')],'where':_0x264731,'order':_0x1edeb5,'transaction':_0x2d47a3,'lock':_0x2d47a3[_0xd978('0x8b')]['UPDATE'],'include':[{'model':db[_0xd978('0x73')],'as':_0xd978('0x8c'),'attributes':_0x51c1e1,'include':[{'model':db[_0xd978('0x8d')],'as':_0xd978('0x8e'),'attributes':['id',_0xd978('0x26')]}]},{'model':db['CmList'],'as':'List','attributes':['id',_0xd978('0x26')]},{'model':db[_0xd978('0x60')],'as':_0xd978('0x8f'),'attributes':['id',_0xd978('0x26'),'dialActive']}]})[_0xd978('0x23')](function(_0x52bcb4){if(_0x52bcb4){return _0x52bcb4['update']({'UserId':_0x87c98d[_0xd978('0x69')]['id']},{'transaction':_0x2d47a3});}});});}})[_0xd978('0x23')](handleEntityNotFound(_0x582af8,null))[_0xd978('0x23')](respondWithResult(_0x582af8,null))[_0xd978('0x56')](handleError(_0x582af8,null));};exports['getOpenContacts']=function(_0x48be54,_0x1aa427,_0x3105e0){return _0x48be54[_0xd978('0x69')][_0xd978('0x79')]({'where':{'type':_0xd978('0x90'),'dialActive':!![],'dialMethod':_0xd978('0x7a')},'attributes':['id'],'raw':!![]})[_0xd978('0x23')](function(_0x3e5599){if(_0x3e5599&&_0x3e5599[_0xd978('0x44')]){return db[_0xd978('0x28')][_0xd978('0x51')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0xd978('0x7e'))},'VoiceQueueId':{'$in':_[_0xd978('0x4d')](_0x3e5599,'id')},'$or':[{'UserId':null},{'UserId':_0x48be54[_0xd978('0x69')]['id']}]}});}return 0x0;})[_0xd978('0x23')](function(_0x23480b){if(!_[_0xd978('0x75')](_0x23480b)&&_[_0xd978('0x91')](_0x23480b)){return _0x1aa427[_0xd978('0x1c')](0xc8)[_0xd978('0x1d')]({'contacts':_0x23480b});}else{logger['error']('CmHopper,\x20%s,\x20%s,\x20%s',_0xd978('0x92'),0x194,_0xd978('0x93'));_0x1aa427[_0xd978('0x1a')](0x194);}})[_0xd978('0x56')](handleError(_0x1aa427,null));}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 7aee8e2..5219a2b 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 _0xd5b5=['moment','bluebird','rimraf','../../config/environment','./cmHopper.attributes','exports','define','CmHopper','cm_hopper','scheduledat','phone','priority','lodash','../../config/logger','api'];(function(_0x54fadf,_0x25947b){var _0x1bca87=function(_0x3860f1){while(--_0x3860f1){_0x54fadf['push'](_0x54fadf['shift']());}};_0x1bca87(++_0x25947b);}(_0xd5b5,0xed));var _0x5d5b=function(_0x416bc9,_0x28a051){_0x416bc9=_0x416bc9-0x0;var _0x5884f4=_0xd5b5[_0x416bc9];return _0x5884f4;};'use strict';var _=require(_0x5d5b('0x0'));var util=require('util');var logger=require(_0x5d5b('0x1'))(_0x5d5b('0x2'));var moment=require(_0x5d5b('0x3'));var BPromise=require(_0x5d5b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5d5b('0x5'));var config=require(_0x5d5b('0x6'));var attributes=require(_0x5d5b('0x7'));module[_0x5d5b('0x8')]=function(_0x2b9da0,_0x3db278){return _0x2b9da0[_0x5d5b('0x9')](_0x5d5b('0xa'),attributes,{'tableName':_0x5d5b('0xb'),'paranoid':![],'indexes':[{'name':_0x5d5b('0xc'),'fields':['scheduledat']},{'name':_0x5d5b('0xd'),'fields':['phone']},{'name':_0x5d5b('0xe'),'fields':['priority']}],'timestamps':!![]});}; \ No newline at end of file +var _0x8274=['../../config/environment','exports','define','cm_hopper','scheduledat','phone','priority','util','../../config/logger','api','moment','request-promise','rimraf'];(function(_0x573808,_0x44d1ca){var _0x295fd1=function(_0x47b9b4){while(--_0x47b9b4){_0x573808['push'](_0x573808['shift']());}};_0x295fd1(++_0x44d1ca);}(_0x8274,0x1a7));var _0x4827=function(_0x3a4272,_0x2a46df){_0x3a4272=_0x3a4272-0x0;var _0x25734f=_0x8274[_0x3a4272];return _0x25734f;};'use strict';var _=require('lodash');var util=require(_0x4827('0x0'));var logger=require(_0x4827('0x1'))(_0x4827('0x2'));var moment=require(_0x4827('0x3'));var BPromise=require('bluebird');var rp=require(_0x4827('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4827('0x5'));var config=require(_0x4827('0x6'));var attributes=require('./cmHopper.attributes');module[_0x4827('0x7')]=function(_0x557a25,_0x577e24){return _0x557a25[_0x4827('0x8')]('CmHopper',attributes,{'tableName':_0x4827('0x9'),'paranoid':![],'indexes':[{'name':_0x4827('0xa'),'fields':[_0x4827('0xa')]},{'name':'phone','fields':[_0x4827('0xb')]},{'name':'priority','fields':[_0x4827('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index c8b41e7..d9e455e 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 _0x2fd9=['info','result','GetCmHopper','options','raw','where','attributes','limit','include','model','map','stringify','CmHopper','find','ShowCmHopper','catch','CreateCmHopper','body','UpdateCmHopper','update','DestroyCmHopper','destroy','GetContactDialer','describe','sequelize','findAll','LOCK','keys','User','Agent','name','voicePause','includes','UserId','push','all','MoveContactManagedDialer','transaction','CmHopperFinal','create','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','\x22%s\x22','format','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','order','UPDATE','length','GetContactRecallMe','GetCmHopperPreview','CmContact','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','request\x20sent','debug','error','code','CmHopper,\x20%s,\x20%s','message'];(function(_0x554bbe,_0x449e76){var _0x5cc316=function(_0x5e24a3){while(--_0x5e24a3){_0x554bbe['push'](_0x554bbe['shift']());}};_0x5cc316(++_0x449e76);}(_0x2fd9,0x1ae));var _0x92fd=function(_0x59625f,_0x3b2c76){_0x59625f=_0x59625f-0x0;var _0x498e1e=_0x2fd9[_0x59625f];return _0x498e1e;};'use strict';var _=require(_0x92fd('0x0'));var util=require(_0x92fd('0x1'));var moment=require(_0x92fd('0x2'));var BPromise=require('bluebird');var rs=require(_0x92fd('0x3'));var fs=require('fs');var Redis=require(_0x92fd('0x4'));var db=require(_0x92fd('0x5'))['db'];var utils=require(_0x92fd('0x6'));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(_0x49df80,_0x2583e2,_0x5e55f6){return new BPromise(function(_0xc71958,_0x34e298){return client['request'](_0x49df80,_0x5e55f6)[_0x92fd('0xd')](function(_0x1a9226){logger['info']('CmHopper,\x20%s,\x20%s',_0x2583e2,_0x92fd('0xe'));logger[_0x92fd('0xf')]('CmHopper,\x20%s,\x20%s,\x20%s',_0x2583e2,'request\x20sent',JSON['stringify'](_0x1a9226));if(_0x1a9226[_0x92fd('0x10')]){if(_0x1a9226[_0x92fd('0x10')][_0x92fd('0x11')]===0x1f4){logger[_0x92fd('0x10')](_0x92fd('0x12'),_0x2583e2,_0x1a9226[_0x92fd('0x10')]['message']);return _0x34e298(_0x1a9226['error'][_0x92fd('0x13')]);}logger[_0x92fd('0x10')](_0x92fd('0x12'),_0x2583e2,_0x1a9226[_0x92fd('0x10')][_0x92fd('0x13')]);return _0xc71958(_0x1a9226[_0x92fd('0x10')][_0x92fd('0x13')]);}else{logger[_0x92fd('0x14')](_0x92fd('0x12'),_0x2583e2,_0x92fd('0xe'));_0xc71958(_0x1a9226[_0x92fd('0x15')][_0x92fd('0x13')]);}})['catch'](function(_0x14ce23){logger[_0x92fd('0x10')]('CmHopper,\x20%s,\x20%s',_0x2583e2,_0x14ce23);_0x34e298(_0x14ce23);});});}exports[_0x92fd('0x16')]=function(_0x135cf2){var _0x1ca691=this;return new Promise(function(_0x2e5a55,_0x484037){return db['CmHopper']['findAll']({'raw':_0x135cf2[_0x92fd('0x17')]?_0x135cf2[_0x92fd('0x17')][_0x92fd('0x18')]===undefined?!![]:![]:!![],'where':_0x135cf2['options']?_0x135cf2[_0x92fd('0x17')][_0x92fd('0x19')]||null:null,'attributes':_0x135cf2[_0x92fd('0x17')]?_0x135cf2[_0x92fd('0x17')][_0x92fd('0x1a')]||null:null,'limit':_0x135cf2[_0x92fd('0x17')]?_0x135cf2[_0x92fd('0x17')][_0x92fd('0x1b')]||null:null,'include':_0x135cf2[_0x92fd('0x17')]?_0x135cf2[_0x92fd('0x17')][_0x92fd('0x1c')]?_['map'](_0x135cf2['options'][_0x92fd('0x1c')],function(_0x19a8f1){return{'model':db[_0x19a8f1[_0x92fd('0x1d')]],'as':_0x19a8f1['as'],'attributes':_0x19a8f1[_0x92fd('0x1a')],'include':_0x19a8f1['include']?_[_0x92fd('0x1e')](_0x19a8f1[_0x92fd('0x1c')],function(_0x50503c){return{'model':db[_0x50503c['model']],'as':_0x50503c['as'],'attributes':_0x50503c[_0x92fd('0x1a')],'include':_0x50503c[_0x92fd('0x1c')]?_[_0x92fd('0x1e')](_0x50503c['include'],function(_0x1360cf){return{'model':db[_0x1360cf[_0x92fd('0x1d')]],'as':_0x1360cf['as'],'attributes':_0x1360cf[_0x92fd('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x92fd('0xd')](function(_0x14aa82){logger['info'](_0x92fd('0x16'),_0x135cf2);logger[_0x92fd('0xf')](_0x92fd('0x16'),_0x135cf2,JSON[_0x92fd('0x1f')](_0x14aa82));_0x2e5a55(_0x14aa82);})['catch'](function(_0x11b8ff){logger[_0x92fd('0x10')](_0x92fd('0x16'),_0x11b8ff[_0x92fd('0x13')],_0x135cf2);_0x484037(_0x1ca691['error'](0x1f4,_0x11b8ff['message']));});});};exports['ShowCmHopper']=function(_0x4edbf3){var _0x4c86e3=this;return new Promise(function(_0x14ccc5,_0xbb418f){return db[_0x92fd('0x20')][_0x92fd('0x21')]({'raw':_0x4edbf3[_0x92fd('0x17')]?_0x4edbf3[_0x92fd('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x4edbf3[_0x92fd('0x17')]?_0x4edbf3[_0x92fd('0x17')][_0x92fd('0x19')]||null:null,'attributes':_0x4edbf3['options']?_0x4edbf3[_0x92fd('0x17')][_0x92fd('0x1a')]||null:null,'include':_0x4edbf3[_0x92fd('0x17')]?_0x4edbf3['options'][_0x92fd('0x1c')]?_[_0x92fd('0x1e')](_0x4edbf3[_0x92fd('0x17')][_0x92fd('0x1c')],function(_0x1d6e38){return{'model':db[_0x1d6e38[_0x92fd('0x1d')]],'as':_0x1d6e38['as'],'attributes':_0x1d6e38[_0x92fd('0x1a')],'include':_0x1d6e38[_0x92fd('0x1c')]?_[_0x92fd('0x1e')](_0x1d6e38[_0x92fd('0x1c')],function(_0x3014d2){return{'model':db[_0x3014d2[_0x92fd('0x1d')]],'as':_0x3014d2['as'],'attributes':_0x3014d2[_0x92fd('0x1a')],'include':_0x3014d2['include']?_[_0x92fd('0x1e')](_0x3014d2[_0x92fd('0x1c')],function(_0x34e42c){return{'model':db[_0x34e42c[_0x92fd('0x1d')]],'as':_0x34e42c['as'],'attributes':_0x34e42c[_0x92fd('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x92fd('0xd')](function(_0x50703a){logger[_0x92fd('0x14')](_0x92fd('0x22'),_0x4edbf3);logger['debug'](_0x92fd('0x22'),_0x4edbf3,JSON[_0x92fd('0x1f')](_0x50703a));_0x14ccc5(_0x50703a);})[_0x92fd('0x23')](function(_0x4b47c1){logger['error']('ShowCmHopper',_0x4b47c1[_0x92fd('0x13')],_0x4edbf3);_0xbb418f(_0x4c86e3[_0x92fd('0x10')](0x1f4,_0x4b47c1[_0x92fd('0x13')]));});});};exports[_0x92fd('0x24')]=function(_0x57a7fc){var _0x26942b=this;return new Promise(function(_0x32f3aa,_0x14721d){return db['CmHopper']['create'](_0x57a7fc[_0x92fd('0x25')],{'raw':_0x57a7fc['options']?_0x57a7fc[_0x92fd('0x17')][_0x92fd('0x18')]===undefined?!![]:![]:!![]})[_0x92fd('0xd')](function(_0x19726b){logger['info'](_0x92fd('0x24'),_0x57a7fc);logger[_0x92fd('0xf')]('CreateCmHopper',_0x57a7fc,JSON[_0x92fd('0x1f')](_0x19726b));_0x32f3aa(_0x19726b);})[_0x92fd('0x23')](function(_0x38622b){logger[_0x92fd('0x10')](_0x92fd('0x24'),_0x38622b[_0x92fd('0x13')],_0x57a7fc);_0x14721d(_0x26942b[_0x92fd('0x10')](0x1f4,_0x38622b['message']));});});};exports[_0x92fd('0x26')]=function(_0x4417b7){var _0x40bac1=this;return new Promise(function(_0x4a8e96,_0x11b116){return db[_0x92fd('0x20')][_0x92fd('0x27')](_0x4417b7[_0x92fd('0x25')],{'raw':_0x4417b7['options']?_0x4417b7['options'][_0x92fd('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4417b7['options']?_0x4417b7[_0x92fd('0x17')][_0x92fd('0x19')]||null:null,'attributes':_0x4417b7[_0x92fd('0x17')]?_0x4417b7[_0x92fd('0x17')][_0x92fd('0x1a')]||null:null,'limit':_0x4417b7[_0x92fd('0x17')]?_0x4417b7[_0x92fd('0x17')][_0x92fd('0x1b')]||null:null})[_0x92fd('0xd')](function(_0xe88611){logger[_0x92fd('0x14')](_0x92fd('0x26'),_0x4417b7);logger[_0x92fd('0xf')]('UpdateCmHopper',_0x4417b7,JSON['stringify'](_0xe88611));_0x4a8e96(_0xe88611);})['catch'](function(_0x4559c3){logger[_0x92fd('0x10')](_0x92fd('0x26'),_0x4559c3[_0x92fd('0x13')],_0x4417b7);_0x11b116(_0x40bac1[_0x92fd('0x10')](0x1f4,_0x4559c3[_0x92fd('0x13')]));});});};exports[_0x92fd('0x28')]=function(_0x2b5973){var _0x466a4d=this;return new Promise(function(_0x174109,_0x41949e){return db[_0x92fd('0x20')][_0x92fd('0x29')]({'where':_0x2b5973[_0x92fd('0x17')]?_0x2b5973[_0x92fd('0x17')]['where']||null:null})['then'](function(_0x109739){logger[_0x92fd('0x14')](_0x92fd('0x28'),_0x2b5973);logger[_0x92fd('0xf')](_0x92fd('0x28'),_0x2b5973,JSON[_0x92fd('0x1f')](_0x109739));_0x174109(_0x109739);})[_0x92fd('0x23')](function(_0x303b5d){logger[_0x92fd('0x10')]('DestroyCmHopper',_0x303b5d[_0x92fd('0x13')],_0x2b5973);_0x41949e(_0x466a4d[_0x92fd('0x10')](0x1f4,_0x303b5d[_0x92fd('0x13')]));});});};exports[_0x92fd('0x2a')]=function(_0x1d0fae){var _0x3be535=this;return new Promise(function(_0x27451b,_0x2d00f2){return db['CmContact'][_0x92fd('0x2b')]()[_0x92fd('0xd')](function(_0x5277a5){return db[_0x92fd('0x2c')]['transaction'](function(_0x187642){return db[_0x92fd('0x20')][_0x92fd('0x2d')]({'where':_0x1d0fae[_0x92fd('0x17')]?_0x1d0fae[_0x92fd('0x17')][_0x92fd('0x19')]||null:null,'attributes':_0x1d0fae[_0x92fd('0x17')]?_0x1d0fae[_0x92fd('0x17')][_0x92fd('0x1a')]||null:null,'limit':_0x1d0fae['options']?_0x1d0fae['options']['limit']||null:null,'order':_0x1d0fae[_0x92fd('0x17')]?_0x1d0fae[_0x92fd('0x17')]['order']||null:null,'transaction':_0x187642,'lock':_0x187642[_0x92fd('0x2e')]['UPDATE'],'include':[{'model':db['CmContact'],'as':'Contact','attributes':_[_0x92fd('0x2f')](_0x5277a5)},{'model':db[_0x92fd('0x30')],'as':_0x92fd('0x31'),'attributes':['id',_0x92fd('0x32'),_0x92fd('0x33')]}]})['then'](function(_0x4404a8){var _0x2eba52=[];var _0x34dfcb=[];for(var _0xb34ab2=0x0;_0xb34ab2<_0x4404a8['length'];_0xb34ab2+=0x1){if(!_0x34dfcb[_0x92fd('0x34')](_0x4404a8[_0xb34ab2]['UserId'])){_0x34dfcb['push'](_0x4404a8[_0xb34ab2][_0x92fd('0x35')]);_0x2eba52[_0x92fd('0x36')](_0x4404a8[_0xb34ab2][_0x92fd('0x27')](_0x1d0fae['body'],{'transaction':_0x187642}));}}return BPromise[_0x92fd('0x37')](_0x2eba52);});})[_0x92fd('0xd')](function(_0x57b4e0){logger[_0x92fd('0x14')](_0x92fd('0x2a'),_0x1d0fae);logger[_0x92fd('0xf')](_0x92fd('0x2a'),_0x1d0fae,JSON['stringify'](_0x57b4e0));_0x27451b(_0x57b4e0);})[_0x92fd('0x23')](function(_0x303148){logger['error']('GetContactDialer',_0x303148['message'],_0x1d0fae);_0x2d00f2(_0x3be535[_0x92fd('0x10')](0x1f4,_0x303148[_0x92fd('0x13')]));});});});};exports[_0x92fd('0x38')]=function(_0x696bd6){var _0x1602f9=this;return new Promise(function(_0x487f6e,_0x25ea1c){return db[_0x92fd('0x2c')][_0x92fd('0x39')](function(_0x76aafd){return db[_0x92fd('0x3a')][_0x92fd('0x3b')](_0x696bd6[_0x92fd('0x25')],{'raw':_0x696bd6['options']?_0x696bd6[_0x92fd('0x17')]['raw']===undefined?!![]:![]:!![],'transaction':_0x76aafd})[_0x92fd('0xd')](function(){return db[_0x92fd('0x20')]['destroy']({'where':_0x696bd6[_0x92fd('0x17')]?_0x696bd6[_0x92fd('0x17')][_0x92fd('0x19')]||null:null,'transaction':_0x76aafd});});})[_0x92fd('0xd')](function(_0x1a67d1){logger[_0x92fd('0x14')](_0x92fd('0x38'),_0x696bd6);logger['debug'](_0x92fd('0x38'),_0x696bd6,JSON[_0x92fd('0x1f')](_0x1a67d1));_0x487f6e(_0x1a67d1);})['catch'](function(_0x98b2b6){logger[_0x92fd('0x10')](_0x92fd('0x38'),_0x98b2b6[_0x92fd('0x13')],_0x696bd6);_0x25ea1c(_0x1602f9['error'](0x1f4,_0x98b2b6[_0x92fd('0x13')]));});});};exports[_0x92fd('0x3c')]=function(_0x21405c){var _0x56a628=this;return new Promise(function(_0xd52e6b,_0x2d0021){return db['CmHopper'][_0x92fd('0x2d')]({'raw':_0x21405c[_0x92fd('0x17')]?_0x21405c['options']['raw']===undefined?!![]:![]:!![],'where':_0x21405c[_0x92fd('0x17')]?_0x21405c[_0x92fd('0x17')][_0x92fd('0x19')]||null:null,'attributes':[[db['sequelize']['fn'](_0x92fd('0x3d'),db[_0x92fd('0x2c')]['fn']('IF',db[_0x92fd('0x2c')][_0x92fd('0x3e')](_0x92fd('0x3f')+util['format'](_0x92fd('0x40'),moment()[_0x92fd('0x41')](_0x92fd('0x42')))+_0x92fd('0x43')))),_0x92fd('0x44')]]})[_0x92fd('0xd')](function(_0x454023){logger['info'](_0x92fd('0x3c'),_0x21405c);logger['debug']('CountReScheduled',_0x21405c,JSON[_0x92fd('0x1f')](_0x454023));_0xd52e6b(_0x454023);})[_0x92fd('0x23')](function(_0x3861ca){logger[_0x92fd('0x10')](_0x92fd('0x3c'),_0x3861ca[_0x92fd('0x13')],_0x21405c);_0x2d0021(_0x56a628[_0x92fd('0x10')](0x1f4,_0x3861ca[_0x92fd('0x13')]));});});};exports['GetContactRecallMe']=function(_0x433fb1){var _0x2b94e3=this;return new Promise(function(_0xc650da,_0x27d30c){return db['CmContact'][_0x92fd('0x2b')]()[_0x92fd('0xd')](function(_0x4aeac9){return db[_0x92fd('0x2c')][_0x92fd('0x39')](function(_0x4d0f22){return db[_0x92fd('0x20')][_0x92fd('0x2d')]({'where':_0x433fb1['options']?_0x433fb1[_0x92fd('0x17')]['where']||null:null,'attributes':_0x433fb1['options']?_0x433fb1[_0x92fd('0x17')][_0x92fd('0x1a')]||null:null,'limit':0x1,'order':_0x433fb1[_0x92fd('0x17')]?_0x433fb1['options'][_0x92fd('0x45')]||null:null,'group':db[_0x92fd('0x20')][_0x92fd('0x35')],'transaction':_0x4d0f22,'lock':_0x4d0f22[_0x92fd('0x2e')][_0x92fd('0x46')],'include':_0x433fb1['options']?_0x433fb1[_0x92fd('0x17')][_0x92fd('0x1c')]?_[_0x92fd('0x1e')](_0x433fb1['options'][_0x92fd('0x1c')],function(_0x1613a2){return{'model':db[_0x1613a2[_0x92fd('0x1d')]],'as':_0x1613a2['as'],'attributes':_0x1613a2[_0x92fd('0x1a')],'include':_0x1613a2[_0x92fd('0x1c')]?_[_0x92fd('0x1e')](_0x1613a2[_0x92fd('0x1c')],function(_0x2b3e31){return{'model':db[_0x2b3e31[_0x92fd('0x1d')]],'as':_0x2b3e31['as'],'attributes':_0x2b3e31[_0x92fd('0x1a')],'include':_0x2b3e31[_0x92fd('0x1c')]?_[_0x92fd('0x1e')](_0x2b3e31[_0x92fd('0x1c')],function(_0x3fea50){return{'model':db[_0x3fea50[_0x92fd('0x1d')]],'as':_0x3fea50['as'],'attributes':_0x3fea50[_0x92fd('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x92fd('0xd')](function(_0x37f51f){var _0x4a6371=[];for(var _0xc6f0e2=0x0;_0xc6f0e2<_0x37f51f[_0x92fd('0x47')];_0xc6f0e2+=0x1){_0x4a6371[_0x92fd('0x36')](_0x37f51f[_0xc6f0e2]['update'](_0x433fb1[_0x92fd('0x25')],{'transaction':_0x4d0f22}));}return BPromise[_0x92fd('0x37')](_0x4a6371);});})[_0x92fd('0xd')](function(_0x138eaf){logger[_0x92fd('0x14')](_0x92fd('0x48'),_0x433fb1);logger[_0x92fd('0xf')](_0x92fd('0x48'),_0x433fb1,JSON[_0x92fd('0x1f')](_0x138eaf));_0xc650da(_0x138eaf);})[_0x92fd('0x23')](function(_0xdbb530){logger[_0x92fd('0x10')](_0x92fd('0x48'),_0xdbb530[_0x92fd('0x13')],_0x433fb1);_0x27d30c(_0x2b94e3[_0x92fd('0x10')](0x1f4,_0xdbb530[_0x92fd('0x13')]));});});});};exports[_0x92fd('0x49')]=function(_0x282b26){var _0x4e679f=this;return new Promise(function(_0x27e9a5,_0x103a60){db[_0x92fd('0x4a')][_0x92fd('0x2b')]()[_0x92fd('0xd')](function(_0x28fa14){return db['CmHopper'][_0x92fd('0x2d')]({'raw':_0x282b26[_0x92fd('0x17')]?_0x282b26[_0x92fd('0x17')][_0x92fd('0x18')]===undefined?!![]:![]:!![],'where':_0x282b26[_0x92fd('0x17')]?_0x282b26['options'][_0x92fd('0x19')]||null:null,'attributes':_0x282b26[_0x92fd('0x17')]?_0x282b26[_0x92fd('0x17')][_0x92fd('0x1a')]||null:null,'limit':_0x282b26['options']?_0x282b26[_0x92fd('0x17')]['limit']||null:null,'include':_0x282b26[_0x92fd('0x17')]?_0x282b26[_0x92fd('0x17')][_0x92fd('0x1c')]?_[_0x92fd('0x1e')](_0x282b26[_0x92fd('0x17')][_0x92fd('0x1c')],function(_0x5abaa8){return{'model':db[_0x5abaa8[_0x92fd('0x1d')]],'as':_0x5abaa8['as'],'attributes':_0x5abaa8['as']==='Contact'?_[_0x92fd('0x2f')](_0x28fa14):_0x5abaa8[_0x92fd('0x1a')],'include':_0x5abaa8[_0x92fd('0x1c')]?_[_0x92fd('0x1e')](_0x5abaa8['include'],function(_0x1d10c6){return{'model':db[_0x1d10c6[_0x92fd('0x1d')]],'as':_0x1d10c6['as'],'attributes':_0x1d10c6[_0x92fd('0x1a')],'include':_0x1d10c6[_0x92fd('0x1c')]?_[_0x92fd('0x1e')](_0x1d10c6[_0x92fd('0x1c')],function(_0x185430){return{'model':db[_0x185430[_0x92fd('0x1d')]],'as':_0x185430['as'],'attributes':_0x185430['attributes']};}):[]};}):[]};}):[]:[]})[_0x92fd('0xd')](function(_0x59675a){logger[_0x92fd('0x14')](_0x92fd('0x16'),_0x282b26);logger[_0x92fd('0xf')](_0x92fd('0x16'),_0x282b26,JSON[_0x92fd('0x1f')](_0x59675a));_0x27e9a5(_0x59675a);})[_0x92fd('0x23')](function(_0x4d15ce){logger[_0x92fd('0x10')]('GetCmHopper',_0x4d15ce[_0x92fd('0x13')],_0x282b26);_0x103a60(_0x4e679f[_0x92fd('0x10')](0x1f4,_0x4d15ce['message']));});});});}; \ No newline at end of file +var _0x45a1=['message','result','catch','CmHopper','options','raw','where','attributes','include','model','map','GetCmHopper','ShowCmHopper','find','debug','CreateCmHopper','create','body','limit','UpdateCmHopper','DestroyCmHopper','GetContactDialer','CmContact','describe','sequelize','findAll','order','UPDATE','User','Agent','name','length','UserId','push','update','all','MoveContactManagedDialer','transaction','destroy','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','CountReScheduled','LOCK','GetContactRecallMe','GetCmHopperPreview','Contact','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','CmHopper,\x20%s,\x20%s','request\x20sent','CmHopper,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x1474ec,_0x23f44e){var _0x3900fe=function(_0x29aa3e){while(--_0x29aa3e){_0x1474ec['push'](_0x1474ec['shift']());}};_0x3900fe(++_0x23f44e);}(_0x45a1,0x10f));var _0x145a=function(_0x209df1,_0x179321){_0x209df1=_0x209df1-0x0;var _0x810fcf=_0x45a1[_0x209df1];return _0x810fcf;};'use strict';var _=require(_0x145a('0x0'));var util=require(_0x145a('0x1'));var moment=require(_0x145a('0x2'));var BPromise=require(_0x145a('0x3'));var rs=require(_0x145a('0x4'));var fs=require('fs');var Redis=require(_0x145a('0x5'));var db=require(_0x145a('0x6'))['db'];var utils=require(_0x145a('0x7'));var logger=require(_0x145a('0x8'))(_0x145a('0x9'));var config=require(_0x145a('0xa'));var jayson=require(_0x145a('0xb'));var client=jayson[_0x145a('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x527422,_0x5d1fe9,_0x1cd56d){return new BPromise(function(_0x7a6f65,_0x2a9661){return client['request'](_0x527422,_0x1cd56d)[_0x145a('0xd')](function(_0x42ea5a){logger[_0x145a('0xe')](_0x145a('0xf'),_0x5d1fe9,_0x145a('0x10'));logger['debug'](_0x145a('0x11'),_0x5d1fe9,_0x145a('0x10'),JSON[_0x145a('0x12')](_0x42ea5a));if(_0x42ea5a[_0x145a('0x13')]){if(_0x42ea5a['error'][_0x145a('0x14')]===0x1f4){logger[_0x145a('0x13')](_0x145a('0xf'),_0x5d1fe9,_0x42ea5a[_0x145a('0x13')]['message']);return _0x2a9661(_0x42ea5a['error'][_0x145a('0x15')]);}logger['error'](_0x145a('0xf'),_0x5d1fe9,_0x42ea5a['error'][_0x145a('0x15')]);return _0x7a6f65(_0x42ea5a['error'][_0x145a('0x15')]);}else{logger[_0x145a('0xe')](_0x145a('0xf'),_0x5d1fe9,_0x145a('0x10'));_0x7a6f65(_0x42ea5a[_0x145a('0x16')][_0x145a('0x15')]);}})[_0x145a('0x17')](function(_0x153060){logger['error'](_0x145a('0xf'),_0x5d1fe9,_0x153060);_0x2a9661(_0x153060);});});}exports['GetCmHopper']=function(_0x250dbd){var _0x341d9b=this;return new Promise(function(_0x51ec49,_0x32f46e){return db[_0x145a('0x18')]['findAll']({'raw':_0x250dbd[_0x145a('0x19')]?_0x250dbd[_0x145a('0x19')][_0x145a('0x1a')]===undefined?!![]:![]:!![],'where':_0x250dbd[_0x145a('0x19')]?_0x250dbd[_0x145a('0x19')][_0x145a('0x1b')]||null:null,'attributes':_0x250dbd[_0x145a('0x19')]?_0x250dbd[_0x145a('0x19')][_0x145a('0x1c')]||null:null,'limit':_0x250dbd[_0x145a('0x19')]?_0x250dbd[_0x145a('0x19')]['limit']||null:null,'include':_0x250dbd[_0x145a('0x19')]?_0x250dbd[_0x145a('0x19')][_0x145a('0x1d')]?_['map'](_0x250dbd[_0x145a('0x19')][_0x145a('0x1d')],function(_0x89deac){return{'model':db[_0x89deac[_0x145a('0x1e')]],'as':_0x89deac['as'],'attributes':_0x89deac[_0x145a('0x1c')],'include':_0x89deac['include']?_[_0x145a('0x1f')](_0x89deac[_0x145a('0x1d')],function(_0x780719){return{'model':db[_0x780719['model']],'as':_0x780719['as'],'attributes':_0x780719[_0x145a('0x1c')],'include':_0x780719[_0x145a('0x1d')]?_['map'](_0x780719[_0x145a('0x1d')],function(_0x5d01e0){return{'model':db[_0x5d01e0[_0x145a('0x1e')]],'as':_0x5d01e0['as'],'attributes':_0x5d01e0[_0x145a('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1d4c6d){logger[_0x145a('0xe')](_0x145a('0x20'),_0x250dbd);logger['debug'](_0x145a('0x20'),_0x250dbd,JSON[_0x145a('0x12')](_0x1d4c6d));_0x51ec49(_0x1d4c6d);})['catch'](function(_0x8c161b){logger[_0x145a('0x13')](_0x145a('0x20'),_0x8c161b[_0x145a('0x15')],_0x250dbd);_0x32f46e(_0x341d9b[_0x145a('0x13')](0x1f4,_0x8c161b['message']));});});};exports[_0x145a('0x21')]=function(_0x4572ff){var _0x180fb7=this;return new Promise(function(_0x290c35,_0x3c635e){return db[_0x145a('0x18')][_0x145a('0x22')]({'raw':_0x4572ff[_0x145a('0x19')]?_0x4572ff[_0x145a('0x19')][_0x145a('0x1a')]===undefined?!![]:![]:!![],'where':_0x4572ff['options']?_0x4572ff[_0x145a('0x19')][_0x145a('0x1b')]||null:null,'attributes':_0x4572ff[_0x145a('0x19')]?_0x4572ff['options'][_0x145a('0x1c')]||null:null,'include':_0x4572ff[_0x145a('0x19')]?_0x4572ff[_0x145a('0x19')][_0x145a('0x1d')]?_['map'](_0x4572ff[_0x145a('0x19')][_0x145a('0x1d')],function(_0x7c2f23){return{'model':db[_0x7c2f23[_0x145a('0x1e')]],'as':_0x7c2f23['as'],'attributes':_0x7c2f23[_0x145a('0x1c')],'include':_0x7c2f23[_0x145a('0x1d')]?_[_0x145a('0x1f')](_0x7c2f23[_0x145a('0x1d')],function(_0xe8ae0b){return{'model':db[_0xe8ae0b[_0x145a('0x1e')]],'as':_0xe8ae0b['as'],'attributes':_0xe8ae0b[_0x145a('0x1c')],'include':_0xe8ae0b['include']?_['map'](_0xe8ae0b[_0x145a('0x1d')],function(_0x19a239){return{'model':db[_0x19a239['model']],'as':_0x19a239['as'],'attributes':_0x19a239[_0x145a('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x121bc9){logger['info']('ShowCmHopper',_0x4572ff);logger[_0x145a('0x23')](_0x145a('0x21'),_0x4572ff,JSON['stringify'](_0x121bc9));_0x290c35(_0x121bc9);})[_0x145a('0x17')](function(_0x2fdefe){logger[_0x145a('0x13')](_0x145a('0x21'),_0x2fdefe[_0x145a('0x15')],_0x4572ff);_0x3c635e(_0x180fb7[_0x145a('0x13')](0x1f4,_0x2fdefe[_0x145a('0x15')]));});});};exports[_0x145a('0x24')]=function(_0x243348){var _0x139375=this;return new Promise(function(_0x5dba3d,_0x566745){return db['CmHopper'][_0x145a('0x25')](_0x243348[_0x145a('0x26')],{'raw':_0x243348[_0x145a('0x19')]?_0x243348['options']['raw']===undefined?!![]:![]:!![]})[_0x145a('0xd')](function(_0x3fcb0e){logger[_0x145a('0xe')](_0x145a('0x24'),_0x243348);logger[_0x145a('0x23')]('CreateCmHopper',_0x243348,JSON['stringify'](_0x3fcb0e));_0x5dba3d(_0x3fcb0e);})['catch'](function(_0x5c5a6d){logger[_0x145a('0x13')](_0x145a('0x24'),_0x5c5a6d[_0x145a('0x15')],_0x243348);_0x566745(_0x139375[_0x145a('0x13')](0x1f4,_0x5c5a6d[_0x145a('0x15')]));});});};exports['UpdateCmHopper']=function(_0x247471){var _0x8abde7=this;return new Promise(function(_0x22be00,_0x171a51){return db[_0x145a('0x18')]['update'](_0x247471[_0x145a('0x26')],{'raw':_0x247471['options']?_0x247471['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x247471['options']?_0x247471[_0x145a('0x19')][_0x145a('0x1b')]||null:null,'attributes':_0x247471[_0x145a('0x19')]?_0x247471['options'][_0x145a('0x1c')]||null:null,'limit':_0x247471[_0x145a('0x19')]?_0x247471[_0x145a('0x19')][_0x145a('0x27')]||null:null})['then'](function(_0x5bae69){logger['info'](_0x145a('0x28'),_0x247471);logger[_0x145a('0x23')]('UpdateCmHopper',_0x247471,JSON[_0x145a('0x12')](_0x5bae69));_0x22be00(_0x5bae69);})[_0x145a('0x17')](function(_0x383933){logger[_0x145a('0x13')](_0x145a('0x28'),_0x383933['message'],_0x247471);_0x171a51(_0x8abde7['error'](0x1f4,_0x383933[_0x145a('0x15')]));});});};exports[_0x145a('0x29')]=function(_0x12524d){var _0x4b275f=this;return new Promise(function(_0x5dbee7,_0x5c8fbc){return db['CmHopper']['destroy']({'where':_0x12524d[_0x145a('0x19')]?_0x12524d['options']['where']||null:null})[_0x145a('0xd')](function(_0x2b0214){logger[_0x145a('0xe')]('DestroyCmHopper',_0x12524d);logger['debug'](_0x145a('0x29'),_0x12524d,JSON[_0x145a('0x12')](_0x2b0214));_0x5dbee7(_0x2b0214);})[_0x145a('0x17')](function(_0x55f138){logger['error']('DestroyCmHopper',_0x55f138[_0x145a('0x15')],_0x12524d);_0x5c8fbc(_0x4b275f[_0x145a('0x13')](0x1f4,_0x55f138[_0x145a('0x15')]));});});};exports[_0x145a('0x2a')]=function(_0x251539){var _0x260415=this;return new Promise(function(_0x22b087,_0x3ac8b8){return db[_0x145a('0x2b')][_0x145a('0x2c')]()[_0x145a('0xd')](function(_0x4f4d61){return db[_0x145a('0x2d')]['transaction'](function(_0x2e47a5){return db[_0x145a('0x18')][_0x145a('0x2e')]({'where':_0x251539[_0x145a('0x19')]?_0x251539[_0x145a('0x19')][_0x145a('0x1b')]||null:null,'attributes':_0x251539[_0x145a('0x19')]?_0x251539[_0x145a('0x19')]['attributes']||null:null,'limit':_0x251539[_0x145a('0x19')]?_0x251539[_0x145a('0x19')][_0x145a('0x27')]||null:null,'order':_0x251539['options']?_0x251539[_0x145a('0x19')][_0x145a('0x2f')]||null:null,'transaction':_0x2e47a5,'lock':_0x2e47a5['LOCK'][_0x145a('0x30')],'include':[{'model':db[_0x145a('0x2b')],'as':'Contact','attributes':_['keys'](_0x4f4d61)},{'model':db[_0x145a('0x31')],'as':_0x145a('0x32'),'attributes':['id',_0x145a('0x33'),'voicePause']}]})[_0x145a('0xd')](function(_0x3cccc5){var _0x19a278=[];var _0x526357=[];for(var _0x3b1f59=0x0;_0x3b1f59<_0x3cccc5[_0x145a('0x34')];_0x3b1f59+=0x1){if(!_0x526357['includes'](_0x3cccc5[_0x3b1f59][_0x145a('0x35')])){_0x526357[_0x145a('0x36')](_0x3cccc5[_0x3b1f59][_0x145a('0x35')]);_0x19a278[_0x145a('0x36')](_0x3cccc5[_0x3b1f59][_0x145a('0x37')](_0x251539[_0x145a('0x26')],{'transaction':_0x2e47a5}));}}return BPromise[_0x145a('0x38')](_0x19a278);});})[_0x145a('0xd')](function(_0xc7f84e){logger[_0x145a('0xe')](_0x145a('0x2a'),_0x251539);logger[_0x145a('0x23')](_0x145a('0x2a'),_0x251539,JSON[_0x145a('0x12')](_0xc7f84e));_0x22b087(_0xc7f84e);})[_0x145a('0x17')](function(_0xee5f35){logger[_0x145a('0x13')](_0x145a('0x2a'),_0xee5f35['message'],_0x251539);_0x3ac8b8(_0x260415['error'](0x1f4,_0xee5f35[_0x145a('0x15')]));});});});};exports[_0x145a('0x39')]=function(_0x3e1c82){var _0x16c5f6=this;return new Promise(function(_0x51eae3,_0x2e2776){return db[_0x145a('0x2d')][_0x145a('0x3a')](function(_0x66ed13){return db['CmHopperFinal']['create'](_0x3e1c82['body'],{'raw':_0x3e1c82['options']?_0x3e1c82['options'][_0x145a('0x1a')]===undefined?!![]:![]:!![],'transaction':_0x66ed13})[_0x145a('0xd')](function(){return db[_0x145a('0x18')][_0x145a('0x3b')]({'where':_0x3e1c82[_0x145a('0x19')]?_0x3e1c82[_0x145a('0x19')]['where']||null:null,'transaction':_0x66ed13});});})[_0x145a('0xd')](function(_0x383757){logger[_0x145a('0xe')](_0x145a('0x39'),_0x3e1c82);logger[_0x145a('0x23')](_0x145a('0x39'),_0x3e1c82,JSON[_0x145a('0x12')](_0x383757));_0x51eae3(_0x383757);})[_0x145a('0x17')](function(_0x54f9c9){logger['error'](_0x145a('0x39'),_0x54f9c9[_0x145a('0x15')],_0x3e1c82);_0x2e2776(_0x16c5f6[_0x145a('0x13')](0x1f4,_0x54f9c9[_0x145a('0x15')]));});});};exports['CountReScheduled']=function(_0x38d040){var _0xab8a6d=this;return new Promise(function(_0x52e254,_0x165be0){return db['CmHopper'][_0x145a('0x2e')]({'raw':_0x38d040[_0x145a('0x19')]?_0x38d040[_0x145a('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x38d040[_0x145a('0x19')]?_0x38d040[_0x145a('0x19')][_0x145a('0x1b')]||null:null,'attributes':[[db['sequelize']['fn'](_0x145a('0x3c'),db[_0x145a('0x2d')]['fn']('IF',db[_0x145a('0x2d')][_0x145a('0x3d')](_0x145a('0x3e')+util[_0x145a('0x3f')](_0x145a('0x40'),moment()[_0x145a('0x3f')](_0x145a('0x41')))+_0x145a('0x42')))),_0x145a('0x43')]]})[_0x145a('0xd')](function(_0x14c659){logger['info'](_0x145a('0x44'),_0x38d040);logger[_0x145a('0x23')](_0x145a('0x44'),_0x38d040,JSON['stringify'](_0x14c659));_0x52e254(_0x14c659);})[_0x145a('0x17')](function(_0xccde73){logger[_0x145a('0x13')](_0x145a('0x44'),_0xccde73['message'],_0x38d040);_0x165be0(_0xab8a6d[_0x145a('0x13')](0x1f4,_0xccde73[_0x145a('0x15')]));});});};exports['GetContactRecallMe']=function(_0x524c3a){var _0x5b6c5c=this;return new Promise(function(_0x199c3b,_0x44bb47){return db[_0x145a('0x2b')][_0x145a('0x2c')]()[_0x145a('0xd')](function(_0x4710cb){return db[_0x145a('0x2d')]['transaction'](function(_0x49440d){return db['CmHopper'][_0x145a('0x2e')]({'where':_0x524c3a[_0x145a('0x19')]?_0x524c3a[_0x145a('0x19')][_0x145a('0x1b')]||null:null,'attributes':_0x524c3a['options']?_0x524c3a[_0x145a('0x19')][_0x145a('0x1c')]||null:null,'limit':0x1,'order':_0x524c3a[_0x145a('0x19')]?_0x524c3a[_0x145a('0x19')]['order']||null:null,'group':db[_0x145a('0x18')][_0x145a('0x35')],'transaction':_0x49440d,'lock':_0x49440d[_0x145a('0x45')]['UPDATE'],'include':_0x524c3a[_0x145a('0x19')]?_0x524c3a['options']['include']?_[_0x145a('0x1f')](_0x524c3a[_0x145a('0x19')][_0x145a('0x1d')],function(_0x2ae860){return{'model':db[_0x2ae860['model']],'as':_0x2ae860['as'],'attributes':_0x2ae860[_0x145a('0x1c')],'include':_0x2ae860[_0x145a('0x1d')]?_['map'](_0x2ae860[_0x145a('0x1d')],function(_0x52253a){return{'model':db[_0x52253a[_0x145a('0x1e')]],'as':_0x52253a['as'],'attributes':_0x52253a['attributes'],'include':_0x52253a[_0x145a('0x1d')]?_[_0x145a('0x1f')](_0x52253a[_0x145a('0x1d')],function(_0x3e1078){return{'model':db[_0x3e1078[_0x145a('0x1e')]],'as':_0x3e1078['as'],'attributes':_0x3e1078[_0x145a('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x145a('0xd')](function(_0x2570e8){var _0xdc4d24=[];for(var _0x5dbca3=0x0;_0x5dbca3<_0x2570e8[_0x145a('0x34')];_0x5dbca3+=0x1){_0xdc4d24['push'](_0x2570e8[_0x5dbca3][_0x145a('0x37')](_0x524c3a[_0x145a('0x26')],{'transaction':_0x49440d}));}return BPromise[_0x145a('0x38')](_0xdc4d24);});})[_0x145a('0xd')](function(_0x86ec7b){logger['info'](_0x145a('0x46'),_0x524c3a);logger[_0x145a('0x23')](_0x145a('0x46'),_0x524c3a,JSON[_0x145a('0x12')](_0x86ec7b));_0x199c3b(_0x86ec7b);})[_0x145a('0x17')](function(_0x3f76dc){logger['error']('GetContactRecallMe',_0x3f76dc[_0x145a('0x15')],_0x524c3a);_0x44bb47(_0x5b6c5c['error'](0x1f4,_0x3f76dc[_0x145a('0x15')]));});});});};exports[_0x145a('0x47')]=function(_0x2b9f4e){var _0x279f3d=this;return new Promise(function(_0x5ed300,_0x323f23){db[_0x145a('0x2b')][_0x145a('0x2c')]()[_0x145a('0xd')](function(_0xeddd14){return db[_0x145a('0x18')][_0x145a('0x2e')]({'raw':_0x2b9f4e[_0x145a('0x19')]?_0x2b9f4e[_0x145a('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x2b9f4e[_0x145a('0x19')]?_0x2b9f4e[_0x145a('0x19')][_0x145a('0x1b')]||null:null,'attributes':_0x2b9f4e['options']?_0x2b9f4e[_0x145a('0x19')]['attributes']||null:null,'limit':_0x2b9f4e[_0x145a('0x19')]?_0x2b9f4e[_0x145a('0x19')][_0x145a('0x27')]||null:null,'include':_0x2b9f4e[_0x145a('0x19')]?_0x2b9f4e[_0x145a('0x19')][_0x145a('0x1d')]?_[_0x145a('0x1f')](_0x2b9f4e[_0x145a('0x19')]['include'],function(_0x38d803){return{'model':db[_0x38d803[_0x145a('0x1e')]],'as':_0x38d803['as'],'attributes':_0x38d803['as']===_0x145a('0x48')?_['keys'](_0xeddd14):_0x38d803[_0x145a('0x1c')],'include':_0x38d803[_0x145a('0x1d')]?_[_0x145a('0x1f')](_0x38d803[_0x145a('0x1d')],function(_0x52a78e){return{'model':db[_0x52a78e['model']],'as':_0x52a78e['as'],'attributes':_0x52a78e['attributes'],'include':_0x52a78e[_0x145a('0x1d')]?_['map'](_0x52a78e[_0x145a('0x1d')],function(_0x425f88){return{'model':db[_0x425f88[_0x145a('0x1e')]],'as':_0x425f88['as'],'attributes':_0x425f88[_0x145a('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x145a('0xd')](function(_0x30050a){logger[_0x145a('0xe')]('GetCmHopper',_0x2b9f4e);logger[_0x145a('0x23')](_0x145a('0x20'),_0x2b9f4e,JSON['stringify'](_0x30050a));_0x5ed300(_0x30050a);})[_0x145a('0x17')](function(_0x382232){logger[_0x145a('0x13')]('GetCmHopper',_0x382232[_0x145a('0x15')],_0x2b9f4e);_0x323f23(_0x279f3d['error'](0x1f4,_0x382232[_0x145a('0x15')]));});});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 263c29f..3cf414d 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 _0x2884=['express','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/opencontacts','getOpenContacts','/:id','post','create','/preview','getPreview','update','delete','destroy','multer','path','connect-timeout'];(function(_0x1ee299,_0xaef0b0){var _0x492982=function(_0xa797b5){while(--_0xa797b5){_0x1ee299['push'](_0x1ee299['shift']());}};_0x492982(++_0xaef0b0);}(_0x2884,0x1eb));var _0x4288=function(_0x185c5e,_0x1b05f5){_0x185c5e=_0x185c5e-0x0;var _0x14053a=_0x2884[_0x185c5e];return _0x14053a;};'use strict';var multer=require(_0x4288('0x0'));var util=require('util');var path=require(_0x4288('0x1'));var timeout=require(_0x4288('0x2'));var express=require(_0x4288('0x3'));var router=express['Router']();var auth=require(_0x4288('0x4'));var interaction=require(_0x4288('0x5'));var config=require('../../config/environment');var controller=require('./cmHopper.controller');router[_0x4288('0x6')]('/',auth[_0x4288('0x7')](),controller[_0x4288('0x8')]);router['get']('/describe',auth[_0x4288('0x7')](),controller['describe']);router[_0x4288('0x6')](_0x4288('0x9'),auth['isAuthenticated'](),controller[_0x4288('0xa')]);router[_0x4288('0x6')](_0x4288('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x4288('0xc')]('/',auth[_0x4288('0x7')](),controller[_0x4288('0xd')]);router[_0x4288('0xc')](_0x4288('0xe'),auth[_0x4288('0x7')](),controller[_0x4288('0xf')]);router['put'](_0x4288('0xb'),auth[_0x4288('0x7')](),controller[_0x4288('0x10')]);router[_0x4288('0x11')]('/:id',auth[_0x4288('0x7')](),controller[_0x4288('0x12')]);module['exports']=router; \ No newline at end of file +var _0xd142=['getPreview','put','update','delete','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopper.controller','get','isAuthenticated','index','/describe','describe','getOpenContacts','/:id','show','create'];(function(_0x30b814,_0x47b3da){var _0x4b6fe2=function(_0x96058f){while(--_0x96058f){_0x30b814['push'](_0x30b814['shift']());}};_0x4b6fe2(++_0x47b3da);}(_0xd142,0x11a));var _0x2d14=function(_0x4a705c,_0x5196c3){_0x4a705c=_0x4a705c-0x0;var _0x3e1195=_0xd142[_0x4a705c];return _0x3e1195;};'use strict';var multer=require(_0x2d14('0x0'));var util=require(_0x2d14('0x1'));var path=require(_0x2d14('0x2'));var timeout=require(_0x2d14('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x2d14('0x4'));var interaction=require(_0x2d14('0x5'));var config=require(_0x2d14('0x6'));var controller=require(_0x2d14('0x7'));router[_0x2d14('0x8')]('/',auth[_0x2d14('0x9')](),controller[_0x2d14('0xa')]);router[_0x2d14('0x8')](_0x2d14('0xb'),auth[_0x2d14('0x9')](),controller[_0x2d14('0xc')]);router[_0x2d14('0x8')]('/opencontacts',auth[_0x2d14('0x9')](),controller[_0x2d14('0xd')]);router['get'](_0x2d14('0xe'),auth[_0x2d14('0x9')](),controller[_0x2d14('0xf')]);router['post']('/',auth[_0x2d14('0x9')](),controller[_0x2d14('0x10')]);router['post']('/preview',auth[_0x2d14('0x9')](),controller[_0x2d14('0x11')]);router[_0x2d14('0x12')]('/:id',auth[_0x2d14('0x9')](),controller[_0x2d14('0x13')]);router[_0x2d14('0x14')](_0x2d14('0xe'),auth['isAuthenticated'](),controller[_0x2d14('0x15')]);module[_0x2d14('0x16')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 5592ee6..4a1f736 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 _0x25e9=['exports','STRING','INTEGER','contactListQueue','moment','sequelize'];(function(_0x505245,_0x39fd3e){var _0x23612e=function(_0x4579e1){while(--_0x4579e1){_0x505245['push'](_0x505245['shift']());}};_0x23612e(++_0x39fd3e);}(_0x25e9,0x1a8));var _0x925e=function(_0x22b2be,_0x4b164c){_0x22b2be=_0x22b2be-0x0;var _0x213c31=_0x25e9[_0x22b2be];return _0x213c31;};'use strict';var moment=require(_0x925e('0x0'));var Sequelize=require(_0x925e('0x1'));module[_0x925e('0x2')]={'phone':{'type':Sequelize[_0x925e('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x925e('0x4')],'unique':_0x925e('0x5')},'ListId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0x925e('0x5')}}; \ No newline at end of file +var _0x277c=['sequelize','exports','STRING','INTEGER','contactListQueue','moment'];(function(_0x474bc0,_0x26989c){var _0x4b24cf=function(_0x4be866){while(--_0x4be866){_0x474bc0['push'](_0x474bc0['shift']());}};_0x4b24cf(++_0x26989c);}(_0x277c,0x65));var _0xc277=function(_0x491243,_0x267751){_0x491243=_0x491243-0x0;var _0x4f206f=_0x277c[_0x491243];return _0x4f206f;};'use strict';var moment=require(_0xc277('0x0'));var Sequelize=require(_0xc277('0x1'));module[_0xc277('0x2')]={'phone':{'type':Sequelize[_0xc277('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0xc277('0x4')],'unique':_0xc277('0x5')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0xc277('0x5')},'VoiceQueueId':{'type':Sequelize[_0xc277('0x4')],'unique':_0xc277('0x5')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 7e279df..f93fe4e 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 _0xa9e0=['sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','catch','params','includeAll','body','find','describe','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','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','index','map','CmHopperBlack','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit'];(function(_0xc58a59,_0x5c5875){var _0x456aa6=function(_0x4cdbf1){while(--_0x4cdbf1){_0xc58a59['push'](_0xc58a59['shift']());}};_0x456aa6(++_0x5c5875);}(_0xa9e0,0x123));var _0x0a9e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xa9e0[_0x43d11d];return _0x38cd08;};'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 db=require(_0x0a9e('0x13'))['db'];function respondWithStatusCode(_0x36471c,_0xd5b662){_0xd5b662=_0xd5b662||0xcc;return function(_0x26d672){if(_0x26d672){return _0x36471c[_0x0a9e('0x14')](_0xd5b662);}return _0x36471c[_0x0a9e('0x15')](_0xd5b662)['end']();};}function respondWithResult(_0x4283ce,_0x239b12){_0x239b12=_0x239b12||0xc8;return function(_0x2b4227){if(_0x2b4227){return _0x4283ce[_0x0a9e('0x15')](_0x239b12)[_0x0a9e('0x16')](_0x2b4227);}};}function respondWithFilteredResult(_0x4d5611,_0x52a03d){return function(_0x22dccb){if(_0x22dccb){var _0x5d0880=_0x22dccb[_0x0a9e('0x17')],_0x1985b6=_0x52a03d['offset'],_0x519dfd=_0x52a03d[_0x0a9e('0x18')]+_0x52a03d['limit'],_0x16033c;if(_0x519dfd>=_0x5d0880){_0x519dfd=_0x5d0880;_0x16033c=0xc8;}else{_0x16033c=0xce;}_0x4d5611[_0x0a9e('0x15')](_0x16033c);return _0x4d5611[_0x0a9e('0x19')](_0x0a9e('0x1a'),_0x1985b6+'-'+_0x519dfd+'/'+_0x5d0880)[_0x0a9e('0x16')](_0x22dccb);}return null;};}function patchUpdates(_0x31b1ca){return function(_0x2eb11f){try{jsonpatch[_0x0a9e('0x1b')](_0x2eb11f,_0x31b1ca,!![]);}catch(_0x20559e){return BPromise[_0x0a9e('0x1c')](_0x20559e);}return _0x2eb11f[_0x0a9e('0x1d')]();};}function saveUpdates(_0x1c696a,_0x105080){return function(_0x4bb1e3){if(_0x4bb1e3){return _0x4bb1e3[_0x0a9e('0x1e')](_0x1c696a)[_0x0a9e('0x1f')](function(_0x53682f){return _0x53682f;});}return null;};}function removeEntity(_0x20f109,_0x5a09ef){return function(_0x588269){if(_0x588269){return _0x588269[_0x0a9e('0x20')]()[_0x0a9e('0x1f')](function(){_0x20f109[_0x0a9e('0x15')](0xcc)[_0x0a9e('0x21')]();});}};}function handleEntityNotFound(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(!_0x2fb0e4){_0x4abc77[_0x0a9e('0x14')](0x194);}return _0x2fb0e4;};}function handleError(_0x4d00e6,_0x370d86){_0x370d86=_0x370d86||0x1f4;return function(_0x42ac8f){logger[_0x0a9e('0x22')](_0x42ac8f['stack']);if(_0x42ac8f['name']){delete _0x42ac8f[_0x0a9e('0x23')];}_0x4d00e6[_0x0a9e('0x15')](_0x370d86)[_0x0a9e('0x24')](_0x42ac8f);};}exports[_0x0a9e('0x25')]=function(_0x526cf3,_0x384319){var _0x479bc4={},_0x45a1e7={},_0x5bfb33={'count':0x0,'rows':[]};var _0x1dc186=_[_0x0a9e('0x26')](db[_0x0a9e('0x27')][_0x0a9e('0x28')],function(_0x140511){return{'name':_0x140511[_0x0a9e('0x29')],'type':_0x140511[_0x0a9e('0x2a')][_0x0a9e('0x2b')]};});_0x45a1e7['model']=_[_0x0a9e('0x26')](_0x1dc186,_0x0a9e('0x23'));_0x45a1e7[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x526cf3['query']);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],_0x45a1e7[_0x0a9e('0x2c')]);_0x479bc4[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],qs[_0x0a9e('0x32')](_0x526cf3[_0x0a9e('0x2c')]['fields']));_0x479bc4[_0x0a9e('0x31')]=_0x479bc4['attributes'][_0x0a9e('0x33')]?_0x479bc4[_0x0a9e('0x31')]:_0x45a1e7[_0x0a9e('0x30')];if(!_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x34')]('nolimit')){_0x479bc4[_0x0a9e('0x35')]=qs[_0x0a9e('0x35')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x35')]);_0x479bc4[_0x0a9e('0x18')]=qs[_0x0a9e('0x18')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x18')]);}_0x479bc4['order']=qs[_0x0a9e('0x36')](_0x526cf3['query'][_0x0a9e('0x36')]);_0x479bc4[_0x0a9e('0x37')]=qs[_0x0a9e('0x2e')](_[_0x0a9e('0x38')](_0x526cf3['query'],_0x45a1e7[_0x0a9e('0x2e')]),_0x1dc186);if(_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x39')]){_0x479bc4[_0x0a9e('0x37')]=_['merge'](_0x479bc4['where'],{'$or':_[_0x0a9e('0x26')](_0x1dc186,function(_0x5640eb){if(_0x5640eb[_0x0a9e('0x2a')]!==_0x0a9e('0x3a')){var _0x381c37={};_0x381c37[_0x5640eb[_0x0a9e('0x23')]]={'$like':'%'+_0x526cf3['query'][_0x0a9e('0x39')]+'%'};return _0x381c37;}})});}_0x479bc4=_[_0x0a9e('0x3b')]({},_0x479bc4,_0x526cf3[_0x0a9e('0x3c')]);var _0x533942={'where':_0x479bc4[_0x0a9e('0x37')]};return db[_0x0a9e('0x27')][_0x0a9e('0x17')](_0x533942)['then'](function(_0x546ef8){_0x5bfb33[_0x0a9e('0x17')]=_0x546ef8;if(_0x526cf3[_0x0a9e('0x2c')]['includeAll']){_0x479bc4[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x27')][_0x0a9e('0x3e')](_0x479bc4);})[_0x0a9e('0x1f')](function(_0x4b38d9){_0x5bfb33['rows']=_0x4b38d9;return _0x5bfb33;})[_0x0a9e('0x1f')](respondWithFilteredResult(_0x384319,_0x479bc4))[_0x0a9e('0x3f')](handleError(_0x384319,null));};exports['show']=function(_0x183991,_0x1dec2e){var _0x1459bb={'raw':!![],'where':{'id':_0x183991[_0x0a9e('0x40')]['id']}},_0x5b4f5e={};_0x5b4f5e[_0x0a9e('0x30')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x27')][_0x0a9e('0x28')]);_0x5b4f5e[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x183991[_0x0a9e('0x2c')]);_0x5b4f5e[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],_0x5b4f5e[_0x0a9e('0x2c')]);_0x1459bb[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],qs['fields'](_0x183991['query'][_0x0a9e('0x32')]));_0x1459bb[_0x0a9e('0x31')]=_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x33')]?_0x1459bb[_0x0a9e('0x31')]:_0x5b4f5e[_0x0a9e('0x30')];if(_0x183991[_0x0a9e('0x2c')][_0x0a9e('0x41')]){_0x1459bb[_0x0a9e('0x3d')]=[{'all':!![]}];}_0x1459bb=_[_0x0a9e('0x3b')]({},_0x1459bb,_0x183991[_0x0a9e('0x3c')]);return db[_0x0a9e('0x27')]['find'](_0x1459bb)[_0x0a9e('0x1f')](handleEntityNotFound(_0x1dec2e,null))[_0x0a9e('0x1f')](respondWithResult(_0x1dec2e,null))[_0x0a9e('0x3f')](handleError(_0x1dec2e,null));};exports[_0x0a9e('0x1e')]=function(_0x2e8caf,_0xbe9d19){if(_0x2e8caf[_0x0a9e('0x42')]['id']){delete _0x2e8caf[_0x0a9e('0x42')]['id'];}return db['CmHopperBlack'][_0x0a9e('0x43')]({'where':{'id':_0x2e8caf['params']['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0xbe9d19,null))[_0x0a9e('0x1f')](saveUpdates(_0x2e8caf[_0x0a9e('0x42')],null))['then'](respondWithResult(_0xbe9d19,null))[_0x0a9e('0x3f')](handleError(_0xbe9d19,null));};exports[_0x0a9e('0x20')]=function(_0x4774f4,_0x34aa5a){return db[_0x0a9e('0x27')][_0x0a9e('0x43')]({'where':{'id':_0x4774f4[_0x0a9e('0x40')]['id']}})['then'](handleEntityNotFound(_0x34aa5a,null))[_0x0a9e('0x1f')](removeEntity(_0x34aa5a,null))[_0x0a9e('0x3f')](handleError(_0x34aa5a,null));};exports[_0x0a9e('0x44')]=function(_0x16f976,_0x409789){return db[_0x0a9e('0x27')][_0x0a9e('0x44')]()[_0x0a9e('0x1f')](respondWithResult(_0x409789,null))[_0x0a9e('0x3f')](handleError(_0x409789,null));}; \ No newline at end of file +var _0xa9e0=['sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','catch','params','includeAll','body','find','describe','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','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','index','map','CmHopperBlack','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit'];(function(_0x480691,_0xe1a834){var _0x322f4c=function(_0x62ef2f){while(--_0x62ef2f){_0x480691['push'](_0x480691['shift']());}};_0x322f4c(++_0xe1a834);}(_0xa9e0,0x123));var _0x0a9e=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xa9e0[_0x484e36];return _0xafc85d;};'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 db=require(_0x0a9e('0x13'))['db'];function respondWithStatusCode(_0x36471c,_0xd5b662){_0xd5b662=_0xd5b662||0xcc;return function(_0x26d672){if(_0x26d672){return _0x36471c[_0x0a9e('0x14')](_0xd5b662);}return _0x36471c[_0x0a9e('0x15')](_0xd5b662)['end']();};}function respondWithResult(_0x4283ce,_0x239b12){_0x239b12=_0x239b12||0xc8;return function(_0x2b4227){if(_0x2b4227){return _0x4283ce[_0x0a9e('0x15')](_0x239b12)[_0x0a9e('0x16')](_0x2b4227);}};}function respondWithFilteredResult(_0x4d5611,_0x52a03d){return function(_0x22dccb){if(_0x22dccb){var _0x5d0880=_0x22dccb[_0x0a9e('0x17')],_0x1985b6=_0x52a03d['offset'],_0x519dfd=_0x52a03d[_0x0a9e('0x18')]+_0x52a03d['limit'],_0x16033c;if(_0x519dfd>=_0x5d0880){_0x519dfd=_0x5d0880;_0x16033c=0xc8;}else{_0x16033c=0xce;}_0x4d5611[_0x0a9e('0x15')](_0x16033c);return _0x4d5611[_0x0a9e('0x19')](_0x0a9e('0x1a'),_0x1985b6+'-'+_0x519dfd+'/'+_0x5d0880)[_0x0a9e('0x16')](_0x22dccb);}return null;};}function patchUpdates(_0x31b1ca){return function(_0x2eb11f){try{jsonpatch[_0x0a9e('0x1b')](_0x2eb11f,_0x31b1ca,!![]);}catch(_0x20559e){return BPromise[_0x0a9e('0x1c')](_0x20559e);}return _0x2eb11f[_0x0a9e('0x1d')]();};}function saveUpdates(_0x1c696a,_0x105080){return function(_0x4bb1e3){if(_0x4bb1e3){return _0x4bb1e3[_0x0a9e('0x1e')](_0x1c696a)[_0x0a9e('0x1f')](function(_0x53682f){return _0x53682f;});}return null;};}function removeEntity(_0x20f109,_0x5a09ef){return function(_0x588269){if(_0x588269){return _0x588269[_0x0a9e('0x20')]()[_0x0a9e('0x1f')](function(){_0x20f109[_0x0a9e('0x15')](0xcc)[_0x0a9e('0x21')]();});}};}function handleEntityNotFound(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(!_0x2fb0e4){_0x4abc77[_0x0a9e('0x14')](0x194);}return _0x2fb0e4;};}function handleError(_0x4d00e6,_0x370d86){_0x370d86=_0x370d86||0x1f4;return function(_0x42ac8f){logger[_0x0a9e('0x22')](_0x42ac8f['stack']);if(_0x42ac8f['name']){delete _0x42ac8f[_0x0a9e('0x23')];}_0x4d00e6[_0x0a9e('0x15')](_0x370d86)[_0x0a9e('0x24')](_0x42ac8f);};}exports[_0x0a9e('0x25')]=function(_0x526cf3,_0x384319){var _0x479bc4={},_0x45a1e7={},_0x5bfb33={'count':0x0,'rows':[]};var _0x1dc186=_[_0x0a9e('0x26')](db[_0x0a9e('0x27')][_0x0a9e('0x28')],function(_0x140511){return{'name':_0x140511[_0x0a9e('0x29')],'type':_0x140511[_0x0a9e('0x2a')][_0x0a9e('0x2b')]};});_0x45a1e7['model']=_[_0x0a9e('0x26')](_0x1dc186,_0x0a9e('0x23'));_0x45a1e7[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x526cf3['query']);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],_0x45a1e7[_0x0a9e('0x2c')]);_0x479bc4[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],qs[_0x0a9e('0x32')](_0x526cf3[_0x0a9e('0x2c')]['fields']));_0x479bc4[_0x0a9e('0x31')]=_0x479bc4['attributes'][_0x0a9e('0x33')]?_0x479bc4[_0x0a9e('0x31')]:_0x45a1e7[_0x0a9e('0x30')];if(!_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x34')]('nolimit')){_0x479bc4[_0x0a9e('0x35')]=qs[_0x0a9e('0x35')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x35')]);_0x479bc4[_0x0a9e('0x18')]=qs[_0x0a9e('0x18')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x18')]);}_0x479bc4['order']=qs[_0x0a9e('0x36')](_0x526cf3['query'][_0x0a9e('0x36')]);_0x479bc4[_0x0a9e('0x37')]=qs[_0x0a9e('0x2e')](_[_0x0a9e('0x38')](_0x526cf3['query'],_0x45a1e7[_0x0a9e('0x2e')]),_0x1dc186);if(_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x39')]){_0x479bc4[_0x0a9e('0x37')]=_['merge'](_0x479bc4['where'],{'$or':_[_0x0a9e('0x26')](_0x1dc186,function(_0x5640eb){if(_0x5640eb[_0x0a9e('0x2a')]!==_0x0a9e('0x3a')){var _0x381c37={};_0x381c37[_0x5640eb[_0x0a9e('0x23')]]={'$like':'%'+_0x526cf3['query'][_0x0a9e('0x39')]+'%'};return _0x381c37;}})});}_0x479bc4=_[_0x0a9e('0x3b')]({},_0x479bc4,_0x526cf3[_0x0a9e('0x3c')]);var _0x533942={'where':_0x479bc4[_0x0a9e('0x37')]};return db[_0x0a9e('0x27')][_0x0a9e('0x17')](_0x533942)['then'](function(_0x546ef8){_0x5bfb33[_0x0a9e('0x17')]=_0x546ef8;if(_0x526cf3[_0x0a9e('0x2c')]['includeAll']){_0x479bc4[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x27')][_0x0a9e('0x3e')](_0x479bc4);})[_0x0a9e('0x1f')](function(_0x4b38d9){_0x5bfb33['rows']=_0x4b38d9;return _0x5bfb33;})[_0x0a9e('0x1f')](respondWithFilteredResult(_0x384319,_0x479bc4))[_0x0a9e('0x3f')](handleError(_0x384319,null));};exports['show']=function(_0x183991,_0x1dec2e){var _0x1459bb={'raw':!![],'where':{'id':_0x183991[_0x0a9e('0x40')]['id']}},_0x5b4f5e={};_0x5b4f5e[_0x0a9e('0x30')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x27')][_0x0a9e('0x28')]);_0x5b4f5e[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x183991[_0x0a9e('0x2c')]);_0x5b4f5e[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],_0x5b4f5e[_0x0a9e('0x2c')]);_0x1459bb[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],qs['fields'](_0x183991['query'][_0x0a9e('0x32')]));_0x1459bb[_0x0a9e('0x31')]=_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x33')]?_0x1459bb[_0x0a9e('0x31')]:_0x5b4f5e[_0x0a9e('0x30')];if(_0x183991[_0x0a9e('0x2c')][_0x0a9e('0x41')]){_0x1459bb[_0x0a9e('0x3d')]=[{'all':!![]}];}_0x1459bb=_[_0x0a9e('0x3b')]({},_0x1459bb,_0x183991[_0x0a9e('0x3c')]);return db[_0x0a9e('0x27')]['find'](_0x1459bb)[_0x0a9e('0x1f')](handleEntityNotFound(_0x1dec2e,null))[_0x0a9e('0x1f')](respondWithResult(_0x1dec2e,null))[_0x0a9e('0x3f')](handleError(_0x1dec2e,null));};exports[_0x0a9e('0x1e')]=function(_0x2e8caf,_0xbe9d19){if(_0x2e8caf[_0x0a9e('0x42')]['id']){delete _0x2e8caf[_0x0a9e('0x42')]['id'];}return db['CmHopperBlack'][_0x0a9e('0x43')]({'where':{'id':_0x2e8caf['params']['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0xbe9d19,null))[_0x0a9e('0x1f')](saveUpdates(_0x2e8caf[_0x0a9e('0x42')],null))['then'](respondWithResult(_0xbe9d19,null))[_0x0a9e('0x3f')](handleError(_0xbe9d19,null));};exports[_0x0a9e('0x20')]=function(_0x4774f4,_0x34aa5a){return db[_0x0a9e('0x27')][_0x0a9e('0x43')]({'where':{'id':_0x4774f4[_0x0a9e('0x40')]['id']}})['then'](handleEntityNotFound(_0x34aa5a,null))[_0x0a9e('0x1f')](removeEntity(_0x34aa5a,null))[_0x0a9e('0x3f')](handleError(_0x34aa5a,null));};exports[_0x0a9e('0x44')]=function(_0x16f976,_0x409789){return db[_0x0a9e('0x27')][_0x0a9e('0x44')]()[_0x0a9e('0x1f')](respondWithResult(_0x409789,null))[_0x0a9e('0x3f')](handleError(_0x409789,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 13631d1..c72f4e9 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 _0xb8d3=['cm_hopper_black','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./cmHopperBlack.attributes','exports','define','CmHopperBlack'];(function(_0x1f8f86,_0x3e1fe6){var _0x21359d=function(_0x599184){while(--_0x599184){_0x1f8f86['push'](_0x1f8f86['shift']());}};_0x21359d(++_0x3e1fe6);}(_0xb8d3,0x151));var _0x3b8d=function(_0x57fda8,_0x5e80a0){_0x57fda8=_0x57fda8-0x0;var _0x11c895=_0xb8d3[_0x57fda8];return _0x11c895;};'use strict';var _=require(_0x3b8d('0x0'));var util=require(_0x3b8d('0x1'));var logger=require(_0x3b8d('0x2'))(_0x3b8d('0x3'));var moment=require(_0x3b8d('0x4'));var BPromise=require('bluebird');var rp=require(_0x3b8d('0x5'));var fs=require('fs');var path=require(_0x3b8d('0x6'));var rimraf=require(_0x3b8d('0x7'));var config=require(_0x3b8d('0x8'));var attributes=require(_0x3b8d('0x9'));module[_0x3b8d('0xa')]=function(_0x154386,_0x31a268){return _0x154386[_0x3b8d('0xb')](_0x3b8d('0xc'),attributes,{'tableName':_0x3b8d('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x774b=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperBlack.attributes','define','CmHopperBlack','cm_hopper_black','util','../../config/logger'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x774b,0x1df));var _0xb774=function(_0x47283e,_0x258a00){_0x47283e=_0x47283e-0x0;var _0x306e46=_0x774b[_0x47283e];return _0x306e46;};'use strict';var _=require('lodash');var util=require(_0xb774('0x0'));var logger=require(_0xb774('0x1'))(_0xb774('0x2'));var moment=require(_0xb774('0x3'));var BPromise=require(_0xb774('0x4'));var rp=require(_0xb774('0x5'));var fs=require('fs');var path=require(_0xb774('0x6'));var rimraf=require(_0xb774('0x7'));var config=require(_0xb774('0x8'));var attributes=require(_0xb774('0x9'));module['exports']=function(_0x4fc340,_0x367e37){return _0x4fc340[_0xb774('0xa')](_0xb774('0xb'),attributes,{'tableName':_0xb774('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 78cfbf6..38f0530 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 _0x4c59=['where','attributes','include','model','map','GetCmHopperBlack','UpdateCmHopperBlack','update','body','DestroyCmHopperBlack','destroy','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','stringify','error','code','CmHopperBlack,\x20%s,\x20%s','message','info','catch','CmHopperBlack','options','raw'];(function(_0x17b9d0,_0x3ac188){var _0x40b459=function(_0x160671){while(--_0x160671){_0x17b9d0['push'](_0x17b9d0['shift']());}};_0x40b459(++_0x3ac188);}(_0x4c59,0x1af));var _0x94c5=function(_0x7ecd61,_0x28c775){_0x7ecd61=_0x7ecd61-0x0;var _0x67d35d=_0x4c59[_0x7ecd61];return _0x67d35d;};'use strict';var _=require(_0x94c5('0x0'));var util=require(_0x94c5('0x1'));var moment=require('moment');var BPromise=require(_0x94c5('0x2'));var rs=require(_0x94c5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x94c5('0x4'));var logger=require(_0x94c5('0x5'))(_0x94c5('0x6'));var config=require(_0x94c5('0x7'));var jayson=require(_0x94c5('0x8'));var client=jayson[_0x94c5('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x39889e,_0x285de6,_0x24ab42){return new BPromise(function(_0x51e557,_0x2a8943){return client[_0x94c5('0xa')](_0x39889e,_0x24ab42)[_0x94c5('0xb')](function(_0x562b70){logger['info']('CmHopperBlack,\x20%s,\x20%s',_0x285de6,_0x94c5('0xc'));logger[_0x94c5('0xd')]('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0x285de6,_0x94c5('0xc'),JSON[_0x94c5('0xe')](_0x562b70));if(_0x562b70[_0x94c5('0xf')]){if(_0x562b70[_0x94c5('0xf')][_0x94c5('0x10')]===0x1f4){logger[_0x94c5('0xf')](_0x94c5('0x11'),_0x285de6,_0x562b70['error'][_0x94c5('0x12')]);return _0x2a8943(_0x562b70[_0x94c5('0xf')]['message']);}logger['error']('CmHopperBlack,\x20%s,\x20%s',_0x285de6,_0x562b70['error'][_0x94c5('0x12')]);return _0x51e557(_0x562b70['error']['message']);}else{logger[_0x94c5('0x13')](_0x94c5('0x11'),_0x285de6,_0x94c5('0xc'));_0x51e557(_0x562b70['result'][_0x94c5('0x12')]);}})[_0x94c5('0x14')](function(_0x27e2bf){logger['error']('CmHopperBlack,\x20%s,\x20%s',_0x285de6,_0x27e2bf);_0x2a8943(_0x27e2bf);});});}exports['GetCmHopperBlack']=function(_0x58a9f9){var _0x59d788=this;return new Promise(function(_0x310a11,_0x20c49f){return db[_0x94c5('0x15')]['findAll']({'raw':_0x58a9f9[_0x94c5('0x16')]?_0x58a9f9[_0x94c5('0x16')][_0x94c5('0x17')]===undefined?!![]:![]:!![],'where':_0x58a9f9[_0x94c5('0x16')]?_0x58a9f9['options'][_0x94c5('0x18')]||null:null,'attributes':_0x58a9f9[_0x94c5('0x16')]?_0x58a9f9[_0x94c5('0x16')][_0x94c5('0x19')]||null:null,'limit':_0x58a9f9[_0x94c5('0x16')]?_0x58a9f9['options']['limit']||null:null,'include':_0x58a9f9[_0x94c5('0x16')]?_0x58a9f9[_0x94c5('0x16')][_0x94c5('0x1a')]?_['map'](_0x58a9f9[_0x94c5('0x16')]['include'],function(_0x24b324){return{'model':db[_0x24b324[_0x94c5('0x1b')]],'as':_0x24b324['as'],'attributes':_0x24b324[_0x94c5('0x19')],'include':_0x24b324[_0x94c5('0x1a')]?_[_0x94c5('0x1c')](_0x24b324[_0x94c5('0x1a')],function(_0x561092){return{'model':db[_0x561092[_0x94c5('0x1b')]],'as':_0x561092['as'],'attributes':_0x561092[_0x94c5('0x19')],'include':_0x561092[_0x94c5('0x1a')]?_[_0x94c5('0x1c')](_0x561092['include'],function(_0x18210c){return{'model':db[_0x18210c[_0x94c5('0x1b')]],'as':_0x18210c['as'],'attributes':_0x18210c[_0x94c5('0x19')]};}):[]};}):[]};}):[]:[]})[_0x94c5('0xb')](function(_0x41f1da){logger[_0x94c5('0x13')](_0x94c5('0x1d'),_0x58a9f9);logger[_0x94c5('0xd')](_0x94c5('0x1d'),_0x58a9f9,JSON[_0x94c5('0xe')](_0x41f1da));_0x310a11(_0x41f1da);})[_0x94c5('0x14')](function(_0x58edae){logger['error'](_0x94c5('0x1d'),_0x58edae[_0x94c5('0x12')],_0x58a9f9);_0x20c49f(_0x59d788['error'](0x1f4,_0x58edae[_0x94c5('0x12')]));});});};exports[_0x94c5('0x1e')]=function(_0x163765){var _0xc9fe51=this;return new Promise(function(_0x9af015,_0x12518c){return db['CmHopperBlack'][_0x94c5('0x1f')](_0x163765[_0x94c5('0x20')],{'raw':_0x163765['options']?_0x163765[_0x94c5('0x16')][_0x94c5('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x163765[_0x94c5('0x16')]?_0x163765[_0x94c5('0x16')]['where']||null:null,'attributes':_0x163765[_0x94c5('0x16')]?_0x163765[_0x94c5('0x16')][_0x94c5('0x19')]||null:null,'limit':_0x163765[_0x94c5('0x16')]?_0x163765[_0x94c5('0x16')]['limit']||null:null})['then'](function(_0x578e2f){logger['info']('UpdateCmHopperBlack',_0x163765);logger[_0x94c5('0xd')](_0x94c5('0x1e'),_0x163765,JSON[_0x94c5('0xe')](_0x578e2f));_0x9af015(_0x578e2f);})[_0x94c5('0x14')](function(_0x363078){logger[_0x94c5('0xf')](_0x94c5('0x1e'),_0x363078['message'],_0x163765);_0x12518c(_0xc9fe51['error'](0x1f4,_0x363078[_0x94c5('0x12')]));});});};exports[_0x94c5('0x21')]=function(_0x44609a){var _0x17f83f=this;return new Promise(function(_0xd0fda4,_0x32b06f){return db['CmHopperBlack'][_0x94c5('0x22')]({'where':_0x44609a[_0x94c5('0x16')]?_0x44609a['options'][_0x94c5('0x18')]||null:null})['then'](function(_0x59077e){logger[_0x94c5('0x13')]('DestroyCmHopperBlack',_0x44609a);logger['debug'](_0x94c5('0x21'),_0x44609a,JSON['stringify'](_0x59077e));_0xd0fda4(_0x59077e);})['catch'](function(_0x2fc910){logger[_0x94c5('0xf')]('DestroyCmHopperBlack',_0x2fc910['message'],_0x44609a);_0x32b06f(_0x17f83f[_0x94c5('0xf')](0x1f4,_0x2fc910[_0x94c5('0x12')]));});});}; \ No newline at end of file +var _0xffc5=['model','UpdateCmHopperBlack','update','body','DestroyCmHopperBlack','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CmHopperBlack,\x20%s,\x20%s','catch','GetCmHopperBlack','CmHopperBlack','options','raw','where','attributes','limit','include','map'];(function(_0x596c43,_0x28647a){var _0x4e1315=function(_0x58e910){while(--_0x58e910){_0x596c43['push'](_0x596c43['shift']());}};_0x4e1315(++_0x28647a);}(_0xffc5,0x74));var _0x5ffc=function(_0x12bcf7,_0xc11103){_0x12bcf7=_0x12bcf7-0x0;var _0x2825a=_0xffc5[_0x12bcf7];return _0x2825a;};'use strict';var _=require(_0x5ffc('0x0'));var util=require(_0x5ffc('0x1'));var moment=require('moment');var BPromise=require(_0x5ffc('0x2'));var rs=require(_0x5ffc('0x3'));var fs=require('fs');var Redis=require(_0x5ffc('0x4'));var db=require(_0x5ffc('0x5'))['db'];var utils=require(_0x5ffc('0x6'));var logger=require(_0x5ffc('0x7'))(_0x5ffc('0x8'));var config=require(_0x5ffc('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x5ffc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2de3c6,_0x42d69b,_0x587e18){return new BPromise(function(_0x165947,_0x3ac9a7){return client[_0x5ffc('0xb')](_0x2de3c6,_0x587e18)[_0x5ffc('0xc')](function(_0x1bc05c){logger[_0x5ffc('0xd')]('CmHopperBlack,\x20%s,\x20%s',_0x42d69b,_0x5ffc('0xe'));logger[_0x5ffc('0xf')](_0x5ffc('0x10'),_0x42d69b,'request\x20sent',JSON[_0x5ffc('0x11')](_0x1bc05c));if(_0x1bc05c[_0x5ffc('0x12')]){if(_0x1bc05c[_0x5ffc('0x12')][_0x5ffc('0x13')]===0x1f4){logger[_0x5ffc('0x12')]('CmHopperBlack,\x20%s,\x20%s',_0x42d69b,_0x1bc05c[_0x5ffc('0x12')][_0x5ffc('0x14')]);return _0x3ac9a7(_0x1bc05c[_0x5ffc('0x12')]['message']);}logger[_0x5ffc('0x12')](_0x5ffc('0x15'),_0x42d69b,_0x1bc05c['error'][_0x5ffc('0x14')]);return _0x165947(_0x1bc05c[_0x5ffc('0x12')][_0x5ffc('0x14')]);}else{logger[_0x5ffc('0xd')](_0x5ffc('0x15'),_0x42d69b,'request\x20sent');_0x165947(_0x1bc05c['result'][_0x5ffc('0x14')]);}})[_0x5ffc('0x16')](function(_0x53a775){logger['error']('CmHopperBlack,\x20%s,\x20%s',_0x42d69b,_0x53a775);_0x3ac9a7(_0x53a775);});});}exports[_0x5ffc('0x17')]=function(_0x392ea7){var _0x4738f1=this;return new Promise(function(_0xd0ec07,_0x497d77){return db[_0x5ffc('0x18')]['findAll']({'raw':_0x392ea7[_0x5ffc('0x19')]?_0x392ea7[_0x5ffc('0x19')][_0x5ffc('0x1a')]===undefined?!![]:![]:!![],'where':_0x392ea7[_0x5ffc('0x19')]?_0x392ea7[_0x5ffc('0x19')][_0x5ffc('0x1b')]||null:null,'attributes':_0x392ea7[_0x5ffc('0x19')]?_0x392ea7[_0x5ffc('0x19')][_0x5ffc('0x1c')]||null:null,'limit':_0x392ea7['options']?_0x392ea7[_0x5ffc('0x19')][_0x5ffc('0x1d')]||null:null,'include':_0x392ea7[_0x5ffc('0x19')]?_0x392ea7['options'][_0x5ffc('0x1e')]?_[_0x5ffc('0x1f')](_0x392ea7[_0x5ffc('0x19')][_0x5ffc('0x1e')],function(_0x263b51){return{'model':db[_0x263b51['model']],'as':_0x263b51['as'],'attributes':_0x263b51[_0x5ffc('0x1c')],'include':_0x263b51[_0x5ffc('0x1e')]?_['map'](_0x263b51['include'],function(_0xe40a11){return{'model':db[_0xe40a11['model']],'as':_0xe40a11['as'],'attributes':_0xe40a11[_0x5ffc('0x1c')],'include':_0xe40a11['include']?_[_0x5ffc('0x1f')](_0xe40a11['include'],function(_0x2cb06a){return{'model':db[_0x2cb06a[_0x5ffc('0x20')]],'as':_0x2cb06a['as'],'attributes':_0x2cb06a[_0x5ffc('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x5ffc('0xc')](function(_0x137a96){logger['info']('GetCmHopperBlack',_0x392ea7);logger[_0x5ffc('0xf')](_0x5ffc('0x17'),_0x392ea7,JSON[_0x5ffc('0x11')](_0x137a96));_0xd0ec07(_0x137a96);})['catch'](function(_0x4c357b){logger[_0x5ffc('0x12')]('GetCmHopperBlack',_0x4c357b['message'],_0x392ea7);_0x497d77(_0x4738f1[_0x5ffc('0x12')](0x1f4,_0x4c357b[_0x5ffc('0x14')]));});});};exports[_0x5ffc('0x21')]=function(_0x59f6f9){var _0x597ef6=this;return new Promise(function(_0x291ac,_0x3bded9){return db[_0x5ffc('0x18')][_0x5ffc('0x22')](_0x59f6f9[_0x5ffc('0x23')],{'raw':_0x59f6f9[_0x5ffc('0x19')]?_0x59f6f9[_0x5ffc('0x19')][_0x5ffc('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x59f6f9[_0x5ffc('0x19')]?_0x59f6f9[_0x5ffc('0x19')][_0x5ffc('0x1b')]||null:null,'attributes':_0x59f6f9[_0x5ffc('0x19')]?_0x59f6f9['options'][_0x5ffc('0x1c')]||null:null,'limit':_0x59f6f9['options']?_0x59f6f9['options'][_0x5ffc('0x1d')]||null:null})[_0x5ffc('0xc')](function(_0x21cb0e){logger[_0x5ffc('0xd')](_0x5ffc('0x21'),_0x59f6f9);logger[_0x5ffc('0xf')](_0x5ffc('0x21'),_0x59f6f9,JSON[_0x5ffc('0x11')](_0x21cb0e));_0x291ac(_0x21cb0e);})[_0x5ffc('0x16')](function(_0x1edf5b){logger[_0x5ffc('0x12')](_0x5ffc('0x21'),_0x1edf5b[_0x5ffc('0x14')],_0x59f6f9);_0x3bded9(_0x597ef6[_0x5ffc('0x12')](0x1f4,_0x1edf5b[_0x5ffc('0x14')]));});});};exports[_0x5ffc('0x24')]=function(_0x3e049b){var _0x484c01=this;return new Promise(function(_0x4d1e32,_0x3352ec){return db['CmHopperBlack']['destroy']({'where':_0x3e049b[_0x5ffc('0x19')]?_0x3e049b[_0x5ffc('0x19')][_0x5ffc('0x1b')]||null:null})[_0x5ffc('0xc')](function(_0x1589b6){logger[_0x5ffc('0xd')](_0x5ffc('0x24'),_0x3e049b);logger[_0x5ffc('0xf')](_0x5ffc('0x24'),_0x3e049b,JSON[_0x5ffc('0x11')](_0x1589b6));_0x4d1e32(_0x1589b6);})['catch'](function(_0x5be6e8){logger[_0x5ffc('0x12')](_0x5ffc('0x24'),_0x5be6e8[_0x5ffc('0x14')],_0x3e049b);_0x3352ec(_0x484c01[_0x5ffc('0x12')](0x1f4,_0x5be6e8[_0x5ffc('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index c77765d..596c46e 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 _0x9a19=['/describe','/:id','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','isAuthenticated','index'];(function(_0x299020,_0x206dac){var _0x32152f=function(_0x191f8d){while(--_0x191f8d){_0x299020['push'](_0x299020['shift']());}};_0x32152f(++_0x206dac);}(_0x9a19,0x114));var _0x99a1=function(_0x152fe3,_0x12b0c8){_0x152fe3=_0x152fe3-0x0;var _0xc5bb39=_0x9a19[_0x152fe3];return _0xc5bb39;};'use strict';var multer=require(_0x99a1('0x0'));var util=require(_0x99a1('0x1'));var path=require(_0x99a1('0x2'));var timeout=require('connect-timeout');var express=require(_0x99a1('0x3'));var router=express[_0x99a1('0x4')]();var auth=require(_0x99a1('0x5'));var interaction=require(_0x99a1('0x6'));var config=require(_0x99a1('0x7'));var controller=require(_0x99a1('0x8'));router[_0x99a1('0x9')]('/',auth[_0x99a1('0xa')](),controller[_0x99a1('0xb')]);router[_0x99a1('0x9')](_0x99a1('0xc'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x99a1('0xd'),auth[_0x99a1('0xa')](),controller['show']);router['put'](_0x99a1('0xd'),auth[_0x99a1('0xa')](),controller[_0x99a1('0xe')]);router[_0x99a1('0xf')](_0x99a1('0xd'),auth['isAuthenticated'](),controller[_0x99a1('0x10')]);module[_0x99a1('0x11')]=router; \ No newline at end of file +var _0xb458=['show','put','/:id','delete','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/describe','isAuthenticated','describe'];(function(_0x908ef4,_0x475e99){var _0x1cadc5=function(_0x578776){while(--_0x578776){_0x908ef4['push'](_0x908ef4['shift']());}};_0x1cadc5(++_0x475e99);}(_0xb458,0x103));var _0x8b45=function(_0x12db7d,_0x5b8bfc){_0x12db7d=_0x12db7d-0x0;var _0x5336ce=_0xb458[_0x12db7d];return _0x5336ce;};'use strict';var multer=require(_0x8b45('0x0'));var util=require(_0x8b45('0x1'));var path=require(_0x8b45('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8b45('0x3')]();var auth=require(_0x8b45('0x4'));var interaction=require(_0x8b45('0x5'));var config=require(_0x8b45('0x6'));var controller=require('./cmHopperBlack.controller');router[_0x8b45('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x8b45('0x7')](_0x8b45('0x8'),auth[_0x8b45('0x9')](),controller[_0x8b45('0xa')]);router[_0x8b45('0x7')]('/:id',auth[_0x8b45('0x9')](),controller[_0x8b45('0xb')]);router[_0x8b45('0xc')](_0x8b45('0xd'),auth[_0x8b45('0x9')](),controller['update']);router[_0x8b45('0xe')](_0x8b45('0xd'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index fa5fc86..2399b35 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 _0x3a04=['endtime','setDataValue','diff','seconds','dispositionat','BOOLEAN','exports','INTEGER','STRING','DATE','getDataValue'];(function(_0x5e8bfa,_0x1e83d1){var _0x10b312=function(_0x2613e6){while(--_0x2613e6){_0x5e8bfa['push'](_0x5e8bfa['shift']());}};_0x10b312(++_0x1e83d1);}(_0x3a04,0x171));var _0x43a0=function(_0xb4b80e,_0x1f02e8){_0xb4b80e=_0xb4b80e-0x0;var _0x5e4846=_0x3a04[_0xb4b80e];return _0x5e4846;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x43a0('0x0')]={'state':{'type':Sequelize[_0x43a0('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x43a0('0x2')]},'scheduledat':{'type':Sequelize[_0x43a0('0x3')]},'countbusyretry':{'type':Sequelize[_0x43a0('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x43a0('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x43a0('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x43a0('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x43a0('0x2')]},'originatecalleridnum':{'type':Sequelize[_0x43a0('0x2')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x43a0('0x2')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x43a0('0x3')]},'answertime':{'type':Sequelize[_0x43a0('0x3')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x43a0('0x3')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x43a0('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x43a0('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0x43a0('0x2')]},'campaigntype':{'type':Sequelize[_0x43a0('0x2')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize['STRING']},'dispositionat':{'type':Sequelize[_0x43a0('0x3')],'set':function(_0x5842df){var _0x2523b4=this[_0x43a0('0x4')](_0x43a0('0x5'));if(_0x2523b4&&_0x5842df){this[_0x43a0('0x6')]('followuptime',moment(_0x5842df)[_0x43a0('0x7')](moment(_0x2523b4),_0x43a0('0x8')));}return this[_0x43a0('0x6')](_0x43a0('0x9'),_0x5842df);}},'amd':{'type':Sequelize[_0x43a0('0xa')],'defaultValue':![]},'fax':{'type':Sequelize[_0x43a0('0xa')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x43a0('0xa')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x43a0('0xa')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x43a0('0x3')]},'callback':{'type':Sequelize[_0x43a0('0xa')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x43a0('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x43a0('0x3')]},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize[_0x43a0('0x3')]},'recallme':{'type':Sequelize[_0x43a0('0xa')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x43a0('0x3')]},'countnosuchnumberretry':{'type':Sequelize[_0x43a0('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x43a0('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x43a0('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x754a=['exports','INTEGER','STRING','DATE','getDataValue','endtime','followuptime','diff','seconds','setDataValue','dispositionat','BOOLEAN','sequelize','moment'];(function(_0x1c4dcd,_0x5c25e1){var _0x4ee6fa=function(_0xc7cfa8){while(--_0xc7cfa8){_0x1c4dcd['push'](_0x1c4dcd['shift']());}};_0x4ee6fa(++_0x5c25e1);}(_0x754a,0xa6));var _0xa754=function(_0x49d41c,_0x2bdc35){_0x49d41c=_0x49d41c-0x0;var _0xb64c5f=_0x754a[_0x49d41c];return _0xb64c5f;};'use strict';var Sequelize=require(_0xa754('0x0'));var moment=require(_0xa754('0x1'));module[_0xa754('0x2')]={'state':{'type':Sequelize[_0xa754('0x3')](0x2)},'statedesc':{'type':Sequelize[_0xa754('0x4')]},'scheduledat':{'type':Sequelize[_0xa754('0x5')]},'countbusyretry':{'type':Sequelize[_0xa754('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xa754('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xa754('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xa754('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xa754('0x4')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0xa754('0x4')]},'calleridnum':{'type':Sequelize[_0xa754('0x4')]},'calleridname':{'type':Sequelize[_0xa754('0x4')]},'starttime':{'type':Sequelize[_0xa754('0x5')]},'responsetime':{'type':Sequelize[_0xa754('0x5')]},'answertime':{'type':Sequelize[_0xa754('0x5')]},'droptime':{'type':Sequelize[_0xa754('0x5')]},'endtime':{'type':Sequelize[_0xa754('0x5')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xa754('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xa754('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xa754('0x4')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0xa754('0x4')]},'membername':{'type':Sequelize[_0xa754('0x4')]},'reason':{'type':Sequelize[_0xa754('0x4')]},'disposition':{'type':Sequelize[_0xa754('0x4')]},'dispositionat':{'type':Sequelize[_0xa754('0x5')],'set':function(_0x1e9681){var _0x591759=this[_0xa754('0x6')](_0xa754('0x7'));if(_0x591759&&_0x1e9681){this['setDataValue'](_0xa754('0x8'),moment(_0x1e9681)[_0xa754('0x9')](moment(_0x591759),_0xa754('0xa')));}return this[_0xa754('0xb')](_0xa754('0xc'),_0x1e9681);}},'amd':{'type':Sequelize[_0xa754('0xd')],'defaultValue':![]},'fax':{'type':Sequelize[_0xa754('0xd')],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xa754('0x5')]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xa754('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xa754('0x5')]},'deleted':{'type':Sequelize[_0xa754('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize[_0xa754('0x5')]},'recallme':{'type':Sequelize[_0xa754('0xd')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xa754('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0xa754('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xa754('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xa754('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xa754('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'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 17f3140..16291b5 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 _0x7bd0=['CampaignId','ANY_VALUE(ListId)','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','checkContactHopper','CmHopper','findOne','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','set','apply','reject','save','update','then','end','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','where','filter','merge','VIRTUAL','options','CmHopperFinal','includeAll','findAll','rows','catch','show','params','include','describe','body','uniqueid','find','countContactsQueueCampaignHopperFinal','COUNT','sequelize','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','answeringMachine','reCallContacts','`state`\x20=\x2019,\x201,\x20null','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','cm_hopper','phone','scheduledAt','ContactId','ListId','createdAt','updatedAt','select','field','ANY_VALUE(calleridnum)','ANY_VALUE(ContactId)','ANY_VALUE(VoiceQueueId)','NOW()','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','from','state\x20=\x204','moveContactsIvrCampaignHopperFinal','Campaign','into','fromQuery'];(function(_0x4934e3,_0x1d2e40){var _0x44b196=function(_0x7e5c0b){while(--_0x7e5c0b){_0x4934e3['push'](_0x4934e3['shift']());}};_0x44b196(++_0x1d2e40);}(_0x7bd0,0x111));var _0x07bd=function(_0x52c4e9,_0x5412d0){_0x52c4e9=_0x52c4e9-0x0;var _0x252a03=_0x7bd0[_0x52c4e9];return _0x252a03;};'use strict';var pdf=require(_0x07bd('0x0'));var emlformat=require(_0x07bd('0x1'));var rimraf=require(_0x07bd('0x2'));var zipdir=require(_0x07bd('0x3'));var jsonpatch=require(_0x07bd('0x4'));var rp=require(_0x07bd('0x5'));var moment=require(_0x07bd('0x6'));var BPromise=require(_0x07bd('0x7'));var Mustache=require('mustache');var util=require(_0x07bd('0x8'));var path=require(_0x07bd('0x9'));var sox=require(_0x07bd('0xa'));var csv=require(_0x07bd('0xb'));var ejs=require(_0x07bd('0xc'));var fs=require('fs');var _=require(_0x07bd('0xd'));var squel=require(_0x07bd('0xe'));var crypto=require('crypto');var jsforce=require(_0x07bd('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x07bd('0xb'));var querystring=require(_0x07bd('0x10'));var Papa=require(_0x07bd('0x11'));var Redis=require('ioredis');var authService=require(_0x07bd('0x12'));var qs=require(_0x07bd('0x13'));var as=require(_0x07bd('0x14'));var hardwareService=require(_0x07bd('0x15'));var logger=require('../../config/logger')(_0x07bd('0x16'));var utils=require(_0x07bd('0x17'));var config=require(_0x07bd('0x18'));var db=require(_0x07bd('0x19'))['db'];function respondWithStatusCode(_0x456ecd,_0x1eff6c){_0x1eff6c=_0x1eff6c||0xcc;return function(_0x10aa2e){if(_0x10aa2e){return _0x456ecd[_0x07bd('0x1a')](_0x1eff6c);}return _0x456ecd['status'](_0x1eff6c)['end']();};}function respondWithResult(_0x2ca1bc,_0x3fe523){_0x3fe523=_0x3fe523||0xc8;return function(_0x1c59c2){if(_0x1c59c2){return _0x2ca1bc[_0x07bd('0x1b')](_0x3fe523)[_0x07bd('0x1c')](_0x1c59c2);}};}function respondWithFilteredResult(_0x2406b0,_0x2c9166){return function(_0x49d962){if(_0x49d962){var _0x418444=_0x49d962[_0x07bd('0x1d')],_0x505839=_0x2c9166[_0x07bd('0x1e')],_0x229bf1=_0x2c9166[_0x07bd('0x1e')]+_0x2c9166['limit'],_0x2dd97b;if(_0x229bf1>=_0x418444){_0x229bf1=_0x418444;_0x2dd97b=0xc8;}else{_0x2dd97b=0xce;}_0x2406b0[_0x07bd('0x1b')](_0x2dd97b);return _0x2406b0[_0x07bd('0x1f')]('Content-Range',_0x505839+'-'+_0x229bf1+'/'+_0x418444)[_0x07bd('0x1c')](_0x49d962);}return null;};}function patchUpdates(_0x72f775){return function(_0x758fd5){try{jsonpatch[_0x07bd('0x20')](_0x758fd5,_0x72f775,!![]);}catch(_0x36ccec){return BPromise[_0x07bd('0x21')](_0x36ccec);}return _0x758fd5[_0x07bd('0x22')]();};}function saveUpdates(_0x1a65ff,_0x29a52e){return function(_0x50109f){if(_0x50109f){return _0x50109f[_0x07bd('0x23')](_0x1a65ff)[_0x07bd('0x24')](function(_0xcb8b23){return _0xcb8b23;});}return null;};}function removeEntity(_0x11684d,_0x16d0e6){return function(_0x47bd50){if(_0x47bd50){return _0x47bd50['destroy']()[_0x07bd('0x24')](function(){_0x11684d['status'](0xcc)[_0x07bd('0x25')]();});}};}function handleEntityNotFound(_0x480c9c,_0x50bd12){return function(_0x4165bc){if(!_0x4165bc){_0x480c9c[_0x07bd('0x1a')](0x194);}return _0x4165bc;};}function handleError(_0xf3b23c,_0xdb47ba){_0xdb47ba=_0xdb47ba||0x1f4;return function(_0x28bd91){logger[_0x07bd('0x26')](_0x28bd91['stack']);if(_0x28bd91[_0x07bd('0x27')]){delete _0x28bd91[_0x07bd('0x27')];}_0xf3b23c[_0x07bd('0x1b')](_0xdb47ba)[_0x07bd('0x28')](_0x28bd91);};}exports[_0x07bd('0x29')]=function(_0x1c1fda,_0x571dab){var _0x56687f={},_0x5184dc={},_0x335d61={'count':0x0,'rows':[]};var _0xfa7566=_[_0x07bd('0x2a')](db['CmHopperFinal'][_0x07bd('0x2b')],function(_0x400cc0){return{'name':_0x400cc0[_0x07bd('0x2c')],'type':_0x400cc0[_0x07bd('0x2d')][_0x07bd('0x2e')]};});_0x5184dc[_0x07bd('0x2f')]=_['map'](_0xfa7566,_0x07bd('0x27'));_0x5184dc[_0x07bd('0x30')]=_[_0x07bd('0x31')](_0x1c1fda[_0x07bd('0x30')]);_0x5184dc[_0x07bd('0x32')]=_[_0x07bd('0x33')](_0x5184dc[_0x07bd('0x2f')],_0x5184dc[_0x07bd('0x30')]);_0x56687f['attributes']=_['intersection'](_0x5184dc[_0x07bd('0x2f')],qs[_0x07bd('0x34')](_0x1c1fda[_0x07bd('0x30')]['fields']));_0x56687f[_0x07bd('0x35')]=_0x56687f[_0x07bd('0x35')][_0x07bd('0x36')]?_0x56687f['attributes']:_0x5184dc['model'];if(!_0x1c1fda[_0x07bd('0x30')][_0x07bd('0x37')](_0x07bd('0x38'))){_0x56687f[_0x07bd('0x39')]=qs['limit'](_0x1c1fda[_0x07bd('0x30')][_0x07bd('0x39')]);_0x56687f[_0x07bd('0x1e')]=qs['offset'](_0x1c1fda[_0x07bd('0x30')][_0x07bd('0x1e')]);}_0x56687f['order']=qs[_0x07bd('0x3a')](_0x1c1fda[_0x07bd('0x30')][_0x07bd('0x3a')]);_0x56687f[_0x07bd('0x3b')]=qs['filters'](_['pick'](_0x1c1fda[_0x07bd('0x30')],_0x5184dc['filters']),_0xfa7566);if(_0x1c1fda[_0x07bd('0x30')][_0x07bd('0x3c')]){_0x56687f[_0x07bd('0x3b')]=_[_0x07bd('0x3d')](_0x56687f[_0x07bd('0x3b')],{'$or':_[_0x07bd('0x2a')](_0xfa7566,function(_0x3e63b3){if(_0x3e63b3[_0x07bd('0x2d')]!==_0x07bd('0x3e')){var _0x27b563={};_0x27b563[_0x3e63b3[_0x07bd('0x27')]]={'$like':'%'+_0x1c1fda[_0x07bd('0x30')][_0x07bd('0x3c')]+'%'};return _0x27b563;}})});}_0x56687f=_['merge']({},_0x56687f,_0x1c1fda[_0x07bd('0x3f')]);var _0x2799c6={'where':_0x56687f[_0x07bd('0x3b')]};return db[_0x07bd('0x40')]['count'](_0x2799c6)[_0x07bd('0x24')](function(_0xa36d6b){_0x335d61[_0x07bd('0x1d')]=_0xa36d6b;if(_0x1c1fda[_0x07bd('0x30')][_0x07bd('0x41')]){_0x56687f['include']=[{'all':!![]}];}return db['CmHopperFinal'][_0x07bd('0x42')](_0x56687f);})[_0x07bd('0x24')](function(_0x17c3df){_0x335d61[_0x07bd('0x43')]=_0x17c3df;return _0x335d61;})['then'](respondWithFilteredResult(_0x571dab,_0x56687f))[_0x07bd('0x44')](handleError(_0x571dab,null));};exports[_0x07bd('0x45')]=function(_0x3de7d3,_0x6cdf23){var _0x318b7c={'raw':!![],'where':{'id':_0x3de7d3[_0x07bd('0x46')]['id']}},_0x2a08e3={};_0x2a08e3['model']=_[_0x07bd('0x31')](db[_0x07bd('0x40')][_0x07bd('0x2b')]);_0x2a08e3[_0x07bd('0x30')]=_[_0x07bd('0x31')](_0x3de7d3['query']);_0x2a08e3[_0x07bd('0x32')]=_[_0x07bd('0x33')](_0x2a08e3[_0x07bd('0x2f')],_0x2a08e3[_0x07bd('0x30')]);_0x318b7c[_0x07bd('0x35')]=_['intersection'](_0x2a08e3[_0x07bd('0x2f')],qs[_0x07bd('0x34')](_0x3de7d3[_0x07bd('0x30')][_0x07bd('0x34')]));_0x318b7c['attributes']=_0x318b7c['attributes'][_0x07bd('0x36')]?_0x318b7c[_0x07bd('0x35')]:_0x2a08e3[_0x07bd('0x2f')];if(_0x3de7d3[_0x07bd('0x30')][_0x07bd('0x41')]){_0x318b7c[_0x07bd('0x47')]=[{'all':!![]}];}_0x318b7c=_[_0x07bd('0x3d')]({},_0x318b7c,_0x3de7d3[_0x07bd('0x3f')]);return db[_0x07bd('0x40')]['find'](_0x318b7c)['then'](handleEntityNotFound(_0x6cdf23,null))[_0x07bd('0x24')](respondWithResult(_0x6cdf23,null))[_0x07bd('0x44')](handleError(_0x6cdf23,null));};exports[_0x07bd('0x48')]=function(_0xaa85c5,_0x44274b){return db[_0x07bd('0x40')]['describe']()[_0x07bd('0x24')](respondWithResult(_0x44274b,null))[_0x07bd('0x44')](handleError(_0x44274b,null));};exports[_0x07bd('0x23')]=function(_0x39823e,_0x7755e2){if(_0x39823e[_0x07bd('0x49')]['uniqueid']){delete _0x39823e[_0x07bd('0x49')][_0x07bd('0x4a')];}return db[_0x07bd('0x40')][_0x07bd('0x4b')]({'where':{'uniqueid':_0x39823e[_0x07bd('0x46')]['id']}})[_0x07bd('0x24')](handleEntityNotFound(_0x7755e2,null))[_0x07bd('0x24')](saveUpdates(_0x39823e[_0x07bd('0x49')],null))[_0x07bd('0x24')](respondWithResult(_0x7755e2,null))[_0x07bd('0x44')](handleError(_0x7755e2,null));};exports[_0x07bd('0x4c')]=function(_0x2fa62e,_0x4896e4,_0x1a2606){return db[_0x07bd('0x40')][_0x07bd('0x42')]({'raw':![],'where':{'VoiceQueueId':_0x2fa62e['params']['id']},'attributes':[[db['sequelize']['fn'](_0x07bd('0x4d'),db['sequelize']['fn']('IF',db[_0x07bd('0x4e')][_0x07bd('0x4f')](_0x07bd('0x50')))),_0x07bd('0x51')],[db[_0x07bd('0x4e')]['fn'](_0x07bd('0x4d'),db[_0x07bd('0x4e')]['fn']('IF',db[_0x07bd('0x4e')]['literal'](_0x07bd('0x52')))),_0x07bd('0x53')],[db[_0x07bd('0x4e')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0x07bd('0x4f')](_0x07bd('0x54')))),_0x07bd('0x55')],[db['sequelize']['fn'](_0x07bd('0x4d'),db[_0x07bd('0x4e')]['fn']('IF',db[_0x07bd('0x4e')][_0x07bd('0x4f')](_0x07bd('0x56')))),_0x07bd('0x57')],[db['sequelize']['fn']('COUNT',db[_0x07bd('0x4e')]['fn']('IF',db['sequelize']['literal'](_0x07bd('0x58')))),_0x07bd('0x59')],[db[_0x07bd('0x4e')]['fn']('COUNT',db[_0x07bd('0x4e')]['fn']('IF',db[_0x07bd('0x4e')][_0x07bd('0x4f')](_0x07bd('0x5a')))),_0x07bd('0x5b')],[db[_0x07bd('0x4e')]['fn'](_0x07bd('0x4d'),db[_0x07bd('0x4e')]['fn']('IF',db[_0x07bd('0x4e')]['literal'](_0x07bd('0x5c')))),'reCallContacts'],[db[_0x07bd('0x4e')]['fn'](_0x07bd('0x4d'),db[_0x07bd('0x4e')]['fn']('IF',db['sequelize'][_0x07bd('0x4f')]('`state`\x20=\x2019,\x201,\x20null'))),_0x07bd('0x5d')]]})[_0x07bd('0x24')](handleEntityNotFound(_0x4896e4,null))[_0x07bd('0x24')](respondWithResult(_0x4896e4,null))[_0x07bd('0x44')](handleError(_0x4896e4,null));};exports['countContactsIvrCampaignHopperFinal']=function(_0x5dc6f6,_0x135e4e,_0x5e4670){return db[_0x07bd('0x40')][_0x07bd('0x42')]({'raw':![],'where':{'CampaignId':_0x5dc6f6[_0x07bd('0x46')]['id']},'attributes':[[db[_0x07bd('0x4e')]['fn'](_0x07bd('0x4d'),db[_0x07bd('0x4e')]['fn']('IF',db['sequelize'][_0x07bd('0x4f')](_0x07bd('0x50')))),_0x07bd('0x51')],[db[_0x07bd('0x4e')]['fn'](_0x07bd('0x4d'),db['sequelize']['fn']('IF',db[_0x07bd('0x4e')][_0x07bd('0x4f')](_0x07bd('0x52')))),'noAnswerContacts'],[db[_0x07bd('0x4e')]['fn']('COUNT',db[_0x07bd('0x4e')]['fn']('IF',db[_0x07bd('0x4e')]['literal']('`state`\x20=\x205,\x201,\x20null'))),_0x07bd('0x55')],[db[_0x07bd('0x4e')]['fn'](_0x07bd('0x4d'),db[_0x07bd('0x4e')]['fn']('IF',db[_0x07bd('0x4e')]['literal'](_0x07bd('0x56')))),'congestionContacts'],[db[_0x07bd('0x4e')]['fn']('COUNT',db[_0x07bd('0x4e')]['fn']('IF',db['sequelize']['literal'](_0x07bd('0x58')))),_0x07bd('0x59')],[db[_0x07bd('0x4e')]['fn'](_0x07bd('0x4d'),db[_0x07bd('0x4e')]['fn']('IF',db[_0x07bd('0x4e')][_0x07bd('0x4f')](_0x07bd('0x5a')))),_0x07bd('0x5b')],[db[_0x07bd('0x4e')]['fn']('COUNT',db[_0x07bd('0x4e')]['fn']('IF',db['sequelize'][_0x07bd('0x4f')](_0x07bd('0x5c')))),_0x07bd('0x5e')],[db['sequelize']['fn'](_0x07bd('0x4d'),db[_0x07bd('0x4e')]['fn']('IF',db[_0x07bd('0x4e')][_0x07bd('0x4f')](_0x07bd('0x5f')))),_0x07bd('0x5d')]]})[_0x07bd('0x24')](handleEntityNotFound(_0x135e4e,null))['then'](respondWithResult(_0x135e4e,null))[_0x07bd('0x44')](handleError(_0x135e4e,null));};exports[_0x07bd('0x60')]=function(_0x6bf34b,_0x5acb4a,_0x29a452){return db[_0x07bd('0x61')][_0x07bd('0x4b')]({'where':{'id':_0x6bf34b[_0x07bd('0x46')]['id']}})['then'](handleEntityNotFound(_0x5acb4a,null))[_0x07bd('0x24')](function(_0x15bcd3){var _0x2d1ee7;if(_0x15bcd3){_0x2d1ee7=squel[_0x07bd('0x62')]()['into'](_0x07bd('0x63'))['fromQuery']([_0x07bd('0x64'),_0x07bd('0x65'),_0x07bd('0x66'),_0x07bd('0x67'),'VoiceQueueId',_0x07bd('0x68'),_0x07bd('0x69')],squel[_0x07bd('0x6a')]()[_0x07bd('0x6b')](_0x07bd('0x6c'),_0x07bd('0x64'))[_0x07bd('0x6b')]('NOW()',_0x07bd('0x65'))[_0x07bd('0x6b')](_0x07bd('0x6d'),_0x07bd('0x66'))[_0x07bd('0x6b')]('ANY_VALUE(ListId)',_0x07bd('0x67'))[_0x07bd('0x6b')](_0x07bd('0x6e'),'VoiceQueueId')[_0x07bd('0x6b')](_0x07bd('0x6f'),_0x07bd('0x68'))[_0x07bd('0x6b')](_0x07bd('0x6f'),'updatedAt')['from'](_0x07bd('0x70'))[_0x07bd('0x3b')](_0x07bd('0x71'),_0x6bf34b[_0x07bd('0x46')]['id'][_0x07bd('0x72')]())[_0x07bd('0x3b')](_0x07bd('0x73'),_0x6bf34b[_0x07bd('0x49')][_0x07bd('0x74')]['toString']())[_0x07bd('0x3b')](_0x07bd('0x75'))[_0x07bd('0x3b')](_0x07bd('0x76'),squel[_0x07bd('0x6a')]()['field'](_0x07bd('0x64'))['from'](_0x07bd('0x63'))[_0x07bd('0x3b')]('VoiceQueueId\x20=\x20?',_0x6bf34b[_0x07bd('0x46')]['id']['toString']()))['where'](_0x07bd('0x76'),squel[_0x07bd('0x6a')]()[_0x07bd('0x6b')](_0x07bd('0x77'))[_0x07bd('0x78')]('cm_hopper_final')[_0x07bd('0x3b')](_0x07bd('0x71'),_0x6bf34b[_0x07bd('0x46')]['id']['toString']())[_0x07bd('0x3b')](_0x07bd('0x79')))['group'](_0x07bd('0x66')))[_0x07bd('0x72')]();return db['sequelize'][_0x07bd('0x30')](_0x2d1ee7);}return[];})[_0x07bd('0x24')](respondWithResult(_0x5acb4a,null))[_0x07bd('0x44')](handleError(_0x5acb4a,null));};exports[_0x07bd('0x7a')]=function(_0x37d153,_0x3d1275,_0x3124c2){return db[_0x07bd('0x7b')]['find']({'where':{'id':_0x37d153[_0x07bd('0x46')]['id']}})[_0x07bd('0x24')](handleEntityNotFound(_0x3d1275,null))['then'](function(_0x31a9ac){var _0x138515;if(_0x31a9ac){_0x138515=squel[_0x07bd('0x62')]()[_0x07bd('0x7c')]('cm_hopper')[_0x07bd('0x7d')]([_0x07bd('0x64'),_0x07bd('0x65'),_0x07bd('0x66'),'ListId',_0x07bd('0x7e'),_0x07bd('0x68'),_0x07bd('0x69')],squel[_0x07bd('0x6a')]()[_0x07bd('0x6b')](_0x07bd('0x6c'),_0x07bd('0x64'))[_0x07bd('0x6b')](_0x07bd('0x6f'),_0x07bd('0x65'))[_0x07bd('0x6b')](_0x07bd('0x6d'),_0x07bd('0x66'))[_0x07bd('0x6b')](_0x07bd('0x7f'),_0x07bd('0x67'))[_0x07bd('0x6b')](_0x07bd('0x80'),'CampaignId')[_0x07bd('0x6b')](_0x07bd('0x6f'),_0x07bd('0x68'))[_0x07bd('0x6b')](_0x07bd('0x6f'),_0x07bd('0x69'))[_0x07bd('0x78')](_0x07bd('0x70'))[_0x07bd('0x3b')](_0x07bd('0x81'),_0x37d153['params']['id'][_0x07bd('0x72')]())[_0x07bd('0x3b')](_0x07bd('0x73'),_0x37d153[_0x07bd('0x49')][_0x07bd('0x74')][_0x07bd('0x72')]())[_0x07bd('0x3b')](_0x07bd('0x75'))[_0x07bd('0x3b')](_0x07bd('0x76'),squel[_0x07bd('0x6a')]()[_0x07bd('0x6b')](_0x07bd('0x64'))[_0x07bd('0x78')](_0x07bd('0x63'))[_0x07bd('0x3b')](_0x07bd('0x81'),_0x37d153[_0x07bd('0x46')]['id'][_0x07bd('0x72')]()))[_0x07bd('0x3b')](_0x07bd('0x76'),squel[_0x07bd('0x6a')]()['field'](_0x07bd('0x77'))[_0x07bd('0x78')]('cm_hopper_final')[_0x07bd('0x3b')]('CampaignId\x20=\x20?',_0x37d153[_0x07bd('0x46')]['id']['toString']())[_0x07bd('0x3b')](_0x07bd('0x79')))['group'](_0x07bd('0x66')))[_0x07bd('0x72')]();return db['sequelize'][_0x07bd('0x30')](_0x138515);}return[];})['then'](respondWithResult(_0x3d1275,null))[_0x07bd('0x44')](handleError(_0x3d1275,null));};exports[_0x07bd('0x82')]=function(_0x207fde,_0x349e55,_0xaac9a4){return db[_0x07bd('0x83')][_0x07bd('0x84')]({'where':{'VoiceQueueId':_0x207fde['body']['VoiceQueueId'],'CampaignId':_0x207fde[_0x07bd('0x49')][_0x07bd('0x7e')],'ContactId':_0x207fde[_0x07bd('0x49')][_0x07bd('0x66')]}})[_0x07bd('0x24')](handleEntityNotFound(_0x349e55,null))[_0x07bd('0x24')](function(_0x5872b8){if(_0x5872b8){return _0x5872b8;}return null;})[_0x07bd('0x24')](respondWithResult(_0x349e55,null))['catch'](handleError(_0x349e55,null));}; \ No newline at end of file +var _0x5b6e=['intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','count','findAll','rows','catch','show','params','includeAll','include','find','describe','body','uniqueid','countContactsQueueCampaignHopperFinal','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','reCallContacts','`state`\x20=\x2019,\x201,\x20null','countContactsIvrCampaignHopperFinal','`state`\x20=\x203,\x201,\x20null','busyContacts','`state`\x20=\x2022,\x201,\x20null','answeringMachine','moveContactsQueueCampaignHopperFinal','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','VoiceQueueId','createdAt','updatedAt','select','ANY_VALUE(calleridnum)','field','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ListId','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','CampaignId','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','findOne','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','path','sox','to-csv','ejs','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','apply','reject','save','update','then','error','name','send','index','map','CmHopperFinal','rawAttributes','fieldName','type','model','query','keys','filters'];(function(_0x29483c,_0x515183){var _0x231849=function(_0x249114){while(--_0x249114){_0x29483c['push'](_0x29483c['shift']());}};_0x231849(++_0x515183);}(_0x5b6e,0x14c));var _0xe5b6=function(_0xf0ec78,_0x399b6b){_0xf0ec78=_0xf0ec78-0x0;var _0x47af9a=_0x5b6e[_0xf0ec78];return _0x47af9a;};'use strict';var pdf=require(_0xe5b6('0x0'));var emlformat=require(_0xe5b6('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xe5b6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe5b6('0x3'));var moment=require(_0xe5b6('0x4'));var BPromise=require(_0xe5b6('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xe5b6('0x6'));var sox=require(_0xe5b6('0x7'));var csv=require(_0xe5b6('0x8'));var ejs=require(_0xe5b6('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xe5b6('0xa'));var crypto=require(_0xe5b6('0xb'));var jsforce=require(_0xe5b6('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xe5b6('0x8'));var querystring=require('querystring');var Papa=require(_0xe5b6('0xd'));var Redis=require(_0xe5b6('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xe5b6('0xf'));var as=require(_0xe5b6('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe5b6('0x11'))(_0xe5b6('0x12'));var utils=require('../../config/utils');var config=require(_0xe5b6('0x13'));var db=require(_0xe5b6('0x14'))['db'];function respondWithStatusCode(_0x4eae27,_0x2e1800){_0x2e1800=_0x2e1800||0xcc;return function(_0x3c6b85){if(_0x3c6b85){return _0x4eae27[_0xe5b6('0x15')](_0x2e1800);}return _0x4eae27[_0xe5b6('0x16')](_0x2e1800)[_0xe5b6('0x17')]();};}function respondWithResult(_0x531390,_0x2b72e5){_0x2b72e5=_0x2b72e5||0xc8;return function(_0x344e52){if(_0x344e52){return _0x531390[_0xe5b6('0x16')](_0x2b72e5)[_0xe5b6('0x18')](_0x344e52);}};}function respondWithFilteredResult(_0x533025,_0x3f5025){return function(_0x8db237){if(_0x8db237){var _0xb33f41=_0x8db237['count'],_0x117ccd=_0x3f5025[_0xe5b6('0x19')],_0x1d3bd8=_0x3f5025['offset']+_0x3f5025[_0xe5b6('0x1a')],_0x2c9aec;if(_0x1d3bd8>=_0xb33f41){_0x1d3bd8=_0xb33f41;_0x2c9aec=0xc8;}else{_0x2c9aec=0xce;}_0x533025[_0xe5b6('0x16')](_0x2c9aec);return _0x533025[_0xe5b6('0x1b')]('Content-Range',_0x117ccd+'-'+_0x1d3bd8+'/'+_0xb33f41)[_0xe5b6('0x18')](_0x8db237);}return null;};}function patchUpdates(_0x64de88){return function(_0xdb37da){try{jsonpatch[_0xe5b6('0x1c')](_0xdb37da,_0x64de88,!![]);}catch(_0x6b42bd){return BPromise[_0xe5b6('0x1d')](_0x6b42bd);}return _0xdb37da[_0xe5b6('0x1e')]();};}function saveUpdates(_0x33d7d3,_0x5a88bb){return function(_0x190e5a){if(_0x190e5a){return _0x190e5a[_0xe5b6('0x1f')](_0x33d7d3)[_0xe5b6('0x20')](function(_0xa6b614){return _0xa6b614;});}return null;};}function removeEntity(_0x1b7586,_0x5b83f4){return function(_0x8fd4e1){if(_0x8fd4e1){return _0x8fd4e1['destroy']()[_0xe5b6('0x20')](function(){_0x1b7586['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x52468d,_0x4abeb8){return function(_0x2f0c1f){if(!_0x2f0c1f){_0x52468d[_0xe5b6('0x15')](0x194);}return _0x2f0c1f;};}function handleError(_0x5bb96b,_0x44a248){_0x44a248=_0x44a248||0x1f4;return function(_0x23bff6){logger[_0xe5b6('0x21')](_0x23bff6['stack']);if(_0x23bff6[_0xe5b6('0x22')]){delete _0x23bff6['name'];}_0x5bb96b[_0xe5b6('0x16')](_0x44a248)[_0xe5b6('0x23')](_0x23bff6);};}exports[_0xe5b6('0x24')]=function(_0x238147,_0x1532f7){var _0x4530cf={},_0x67e54d={},_0x4348c8={'count':0x0,'rows':[]};var _0xb33738=_[_0xe5b6('0x25')](db[_0xe5b6('0x26')][_0xe5b6('0x27')],function(_0x2c53e2){return{'name':_0x2c53e2[_0xe5b6('0x28')],'type':_0x2c53e2[_0xe5b6('0x29')]['key']};});_0x67e54d[_0xe5b6('0x2a')]=_[_0xe5b6('0x25')](_0xb33738,_0xe5b6('0x22'));_0x67e54d[_0xe5b6('0x2b')]=_[_0xe5b6('0x2c')](_0x238147[_0xe5b6('0x2b')]);_0x67e54d[_0xe5b6('0x2d')]=_[_0xe5b6('0x2e')](_0x67e54d[_0xe5b6('0x2a')],_0x67e54d[_0xe5b6('0x2b')]);_0x4530cf[_0xe5b6('0x2f')]=_['intersection'](_0x67e54d[_0xe5b6('0x2a')],qs[_0xe5b6('0x30')](_0x238147[_0xe5b6('0x2b')][_0xe5b6('0x30')]));_0x4530cf[_0xe5b6('0x2f')]=_0x4530cf[_0xe5b6('0x2f')][_0xe5b6('0x31')]?_0x4530cf['attributes']:_0x67e54d[_0xe5b6('0x2a')];if(!_0x238147[_0xe5b6('0x2b')][_0xe5b6('0x32')](_0xe5b6('0x33'))){_0x4530cf[_0xe5b6('0x1a')]=qs[_0xe5b6('0x1a')](_0x238147['query'][_0xe5b6('0x1a')]);_0x4530cf[_0xe5b6('0x19')]=qs['offset'](_0x238147['query'][_0xe5b6('0x19')]);}_0x4530cf['order']=qs[_0xe5b6('0x34')](_0x238147[_0xe5b6('0x2b')][_0xe5b6('0x34')]);_0x4530cf[_0xe5b6('0x35')]=qs[_0xe5b6('0x2d')](_[_0xe5b6('0x36')](_0x238147[_0xe5b6('0x2b')],_0x67e54d[_0xe5b6('0x2d')]),_0xb33738);if(_0x238147[_0xe5b6('0x2b')][_0xe5b6('0x37')]){_0x4530cf['where']=_[_0xe5b6('0x38')](_0x4530cf['where'],{'$or':_[_0xe5b6('0x25')](_0xb33738,function(_0x5cb904){if(_0x5cb904['type']!==_0xe5b6('0x39')){var _0x41a253={};_0x41a253[_0x5cb904[_0xe5b6('0x22')]]={'$like':'%'+_0x238147[_0xe5b6('0x2b')][_0xe5b6('0x37')]+'%'};return _0x41a253;}})});}_0x4530cf=_[_0xe5b6('0x38')]({},_0x4530cf,_0x238147[_0xe5b6('0x3a')]);var _0x4b1231={'where':_0x4530cf[_0xe5b6('0x35')]};return db['CmHopperFinal']['count'](_0x4b1231)['then'](function(_0x2fea3a){_0x4348c8[_0xe5b6('0x3b')]=_0x2fea3a;if(_0x238147['query']['includeAll']){_0x4530cf['include']=[{'all':!![]}];}return db[_0xe5b6('0x26')][_0xe5b6('0x3c')](_0x4530cf);})[_0xe5b6('0x20')](function(_0x3a1e3b){_0x4348c8[_0xe5b6('0x3d')]=_0x3a1e3b;return _0x4348c8;})[_0xe5b6('0x20')](respondWithFilteredResult(_0x1532f7,_0x4530cf))[_0xe5b6('0x3e')](handleError(_0x1532f7,null));};exports[_0xe5b6('0x3f')]=function(_0x1e84eb,_0x7f216f){var _0x4b67b7={'raw':!![],'where':{'id':_0x1e84eb[_0xe5b6('0x40')]['id']}},_0x3afdb0={};_0x3afdb0[_0xe5b6('0x2a')]=_[_0xe5b6('0x2c')](db[_0xe5b6('0x26')][_0xe5b6('0x27')]);_0x3afdb0[_0xe5b6('0x2b')]=_['keys'](_0x1e84eb[_0xe5b6('0x2b')]);_0x3afdb0[_0xe5b6('0x2d')]=_[_0xe5b6('0x2e')](_0x3afdb0[_0xe5b6('0x2a')],_0x3afdb0[_0xe5b6('0x2b')]);_0x4b67b7[_0xe5b6('0x2f')]=_['intersection'](_0x3afdb0[_0xe5b6('0x2a')],qs[_0xe5b6('0x30')](_0x1e84eb[_0xe5b6('0x2b')]['fields']));_0x4b67b7[_0xe5b6('0x2f')]=_0x4b67b7[_0xe5b6('0x2f')][_0xe5b6('0x31')]?_0x4b67b7[_0xe5b6('0x2f')]:_0x3afdb0['model'];if(_0x1e84eb['query'][_0xe5b6('0x41')]){_0x4b67b7[_0xe5b6('0x42')]=[{'all':!![]}];}_0x4b67b7=_[_0xe5b6('0x38')]({},_0x4b67b7,_0x1e84eb['options']);return db[_0xe5b6('0x26')][_0xe5b6('0x43')](_0x4b67b7)[_0xe5b6('0x20')](handleEntityNotFound(_0x7f216f,null))['then'](respondWithResult(_0x7f216f,null))[_0xe5b6('0x3e')](handleError(_0x7f216f,null));};exports[_0xe5b6('0x44')]=function(_0x516372,_0x423414){return db['CmHopperFinal'][_0xe5b6('0x44')]()[_0xe5b6('0x20')](respondWithResult(_0x423414,null))[_0xe5b6('0x3e')](handleError(_0x423414,null));};exports[_0xe5b6('0x1f')]=function(_0x104373,_0x147ab7){if(_0x104373[_0xe5b6('0x45')][_0xe5b6('0x46')]){delete _0x104373[_0xe5b6('0x45')]['uniqueid'];}return db['CmHopperFinal']['find']({'where':{'uniqueid':_0x104373['params']['id']}})[_0xe5b6('0x20')](handleEntityNotFound(_0x147ab7,null))[_0xe5b6('0x20')](saveUpdates(_0x104373['body'],null))['then'](respondWithResult(_0x147ab7,null))[_0xe5b6('0x3e')](handleError(_0x147ab7,null));};exports[_0xe5b6('0x47')]=function(_0x2915d8,_0x3bfb39,_0xa912d5){return db[_0xe5b6('0x26')][_0xe5b6('0x3c')]({'raw':![],'where':{'VoiceQueueId':_0x2915d8[_0xe5b6('0x40')]['id']},'attributes':[[db[_0xe5b6('0x48')]['fn'](_0xe5b6('0x49'),db['sequelize']['fn']('IF',db[_0xe5b6('0x48')][_0xe5b6('0x4a')](_0xe5b6('0x4b')))),_0xe5b6('0x4c')],[db[_0xe5b6('0x48')]['fn'](_0xe5b6('0x49'),db[_0xe5b6('0x48')]['fn']('IF',db['sequelize'][_0xe5b6('0x4a')]('`state`\x20=\x203,\x201,\x20null'))),_0xe5b6('0x4d')],[db[_0xe5b6('0x48')]['fn']('COUNT',db[_0xe5b6('0x48')]['fn']('IF',db[_0xe5b6('0x48')]['literal'](_0xe5b6('0x4e')))),'busyContacts'],[db[_0xe5b6('0x48')]['fn'](_0xe5b6('0x49'),db['sequelize']['fn']('IF',db['sequelize'][_0xe5b6('0x4a')](_0xe5b6('0x4f')))),_0xe5b6('0x50')],[db[_0xe5b6('0x48')]['fn'](_0xe5b6('0x49'),db[_0xe5b6('0x48')]['fn']('IF',db[_0xe5b6('0x48')][_0xe5b6('0x4a')](_0xe5b6('0x51')))),_0xe5b6('0x52')],[db[_0xe5b6('0x48')]['fn'](_0xe5b6('0x49'),db[_0xe5b6('0x48')]['fn']('IF',db[_0xe5b6('0x48')][_0xe5b6('0x4a')](_0xe5b6('0x53')))),_0xe5b6('0x54')],[db[_0xe5b6('0x48')]['fn'](_0xe5b6('0x49'),db[_0xe5b6('0x48')]['fn']('IF',db[_0xe5b6('0x48')][_0xe5b6('0x4a')]('`state`\x20=\x2022,\x201,\x20null'))),_0xe5b6('0x55')],[db[_0xe5b6('0x48')]['fn'](_0xe5b6('0x49'),db[_0xe5b6('0x48')]['fn']('IF',db[_0xe5b6('0x48')]['literal'](_0xe5b6('0x56')))),'answeringMachine']]})[_0xe5b6('0x20')](handleEntityNotFound(_0x3bfb39,null))['then'](respondWithResult(_0x3bfb39,null))[_0xe5b6('0x3e')](handleError(_0x3bfb39,null));};exports[_0xe5b6('0x57')]=function(_0x50603a,_0x47d99c,_0x460006){return db[_0xe5b6('0x26')][_0xe5b6('0x3c')]({'raw':![],'where':{'CampaignId':_0x50603a['params']['id']},'attributes':[[db[_0xe5b6('0x48')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xe5b6('0x48')][_0xe5b6('0x4a')](_0xe5b6('0x4b')))),_0xe5b6('0x4c')],[db[_0xe5b6('0x48')]['fn'](_0xe5b6('0x49'),db[_0xe5b6('0x48')]['fn']('IF',db[_0xe5b6('0x48')][_0xe5b6('0x4a')](_0xe5b6('0x58')))),_0xe5b6('0x4d')],[db[_0xe5b6('0x48')]['fn'](_0xe5b6('0x49'),db[_0xe5b6('0x48')]['fn']('IF',db[_0xe5b6('0x48')][_0xe5b6('0x4a')]('`state`\x20=\x205,\x201,\x20null'))),_0xe5b6('0x59')],[db[_0xe5b6('0x48')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0xe5b6('0x4a')](_0xe5b6('0x4f')))),'congestionContacts'],[db['sequelize']['fn']('COUNT',db[_0xe5b6('0x48')]['fn']('IF',db[_0xe5b6('0x48')][_0xe5b6('0x4a')](_0xe5b6('0x51')))),_0xe5b6('0x52')],[db[_0xe5b6('0x48')]['fn'](_0xe5b6('0x49'),db[_0xe5b6('0x48')]['fn']('IF',db[_0xe5b6('0x48')]['literal'](_0xe5b6('0x53')))),_0xe5b6('0x54')],[db[_0xe5b6('0x48')]['fn'](_0xe5b6('0x49'),db['sequelize']['fn']('IF',db['sequelize'][_0xe5b6('0x4a')](_0xe5b6('0x5a')))),_0xe5b6('0x55')],[db[_0xe5b6('0x48')]['fn'](_0xe5b6('0x49'),db[_0xe5b6('0x48')]['fn']('IF',db['sequelize'][_0xe5b6('0x4a')](_0xe5b6('0x56')))),_0xe5b6('0x5b')]]})[_0xe5b6('0x20')](handleEntityNotFound(_0x47d99c,null))[_0xe5b6('0x20')](respondWithResult(_0x47d99c,null))[_0xe5b6('0x3e')](handleError(_0x47d99c,null));};exports[_0xe5b6('0x5c')]=function(_0x2b451f,_0x2ee152,_0x21259c){return db['VoiceQueue']['find']({'where':{'id':_0x2b451f['params']['id']}})['then'](handleEntityNotFound(_0x2ee152,null))[_0xe5b6('0x20')](function(_0x558976){var _0x326110;if(_0x558976){_0x326110=squel[_0xe5b6('0x5d')]()[_0xe5b6('0x5e')](_0xe5b6('0x5f'))[_0xe5b6('0x60')]([_0xe5b6('0x61'),_0xe5b6('0x62'),_0xe5b6('0x63'),'ListId',_0xe5b6('0x64'),_0xe5b6('0x65'),_0xe5b6('0x66')],squel[_0xe5b6('0x67')]()['field'](_0xe5b6('0x68'),_0xe5b6('0x61'))[_0xe5b6('0x69')](_0xe5b6('0x6a'),_0xe5b6('0x62'))[_0xe5b6('0x69')](_0xe5b6('0x6b'),'ContactId')['field'](_0xe5b6('0x6c'),_0xe5b6('0x6d'))['field']('ANY_VALUE(VoiceQueueId)',_0xe5b6('0x64'))[_0xe5b6('0x69')](_0xe5b6('0x6a'),_0xe5b6('0x65'))[_0xe5b6('0x69')](_0xe5b6('0x6a'),_0xe5b6('0x66'))[_0xe5b6('0x6e')](_0xe5b6('0x6f'))[_0xe5b6('0x35')](_0xe5b6('0x70'),_0x2b451f[_0xe5b6('0x40')]['id'][_0xe5b6('0x71')]())['where']('state\x20=\x20?',_0x2b451f[_0xe5b6('0x45')][_0xe5b6('0x72')]['toString']())[_0xe5b6('0x35')](_0xe5b6('0x73'))[_0xe5b6('0x35')](_0xe5b6('0x74'),squel[_0xe5b6('0x67')]()[_0xe5b6('0x69')](_0xe5b6('0x61'))['from'](_0xe5b6('0x5f'))['where'](_0xe5b6('0x70'),_0x2b451f['params']['id'][_0xe5b6('0x71')]()))[_0xe5b6('0x35')]('calleridnum\x20NOT\x20IN\x20(?)',squel['select']()[_0xe5b6('0x69')](_0xe5b6('0x75'))[_0xe5b6('0x6e')](_0xe5b6('0x6f'))[_0xe5b6('0x35')](_0xe5b6('0x70'),_0x2b451f[_0xe5b6('0x40')]['id']['toString']())[_0xe5b6('0x35')](_0xe5b6('0x76')))[_0xe5b6('0x77')]('ContactId'))[_0xe5b6('0x71')]();return db[_0xe5b6('0x48')]['query'](_0x326110);}return[];})['then'](respondWithResult(_0x2ee152,null))[_0xe5b6('0x3e')](handleError(_0x2ee152,null));};exports[_0xe5b6('0x78')]=function(_0x1c1e1d,_0x574403,_0x2b07ae){return db[_0xe5b6('0x79')]['find']({'where':{'id':_0x1c1e1d[_0xe5b6('0x40')]['id']}})[_0xe5b6('0x20')](handleEntityNotFound(_0x574403,null))[_0xe5b6('0x20')](function(_0x391adb){var _0x5b8a0e;if(_0x391adb){_0x5b8a0e=squel['insert']()[_0xe5b6('0x5e')](_0xe5b6('0x5f'))[_0xe5b6('0x60')]([_0xe5b6('0x61'),_0xe5b6('0x62'),_0xe5b6('0x63'),_0xe5b6('0x6d'),_0xe5b6('0x7a'),_0xe5b6('0x65'),_0xe5b6('0x66')],squel[_0xe5b6('0x67')]()[_0xe5b6('0x69')](_0xe5b6('0x68'),_0xe5b6('0x61'))[_0xe5b6('0x69')](_0xe5b6('0x6a'),'scheduledAt')[_0xe5b6('0x69')](_0xe5b6('0x6b'),_0xe5b6('0x63'))[_0xe5b6('0x69')](_0xe5b6('0x6c'),_0xe5b6('0x6d'))[_0xe5b6('0x69')](_0xe5b6('0x7b'),_0xe5b6('0x7a'))[_0xe5b6('0x69')](_0xe5b6('0x6a'),_0xe5b6('0x65'))[_0xe5b6('0x69')](_0xe5b6('0x6a'),_0xe5b6('0x66'))['from']('cm_hopper_final')[_0xe5b6('0x35')]('CampaignId\x20=\x20?',_0x1c1e1d['params']['id']['toString']())[_0xe5b6('0x35')]('state\x20=\x20?',_0x1c1e1d['body']['state'][_0xe5b6('0x71')]())[_0xe5b6('0x35')]('calleridnum\x20IS\x20NOT\x20NULL')[_0xe5b6('0x35')](_0xe5b6('0x74'),squel[_0xe5b6('0x67')]()[_0xe5b6('0x69')]('phone')[_0xe5b6('0x6e')](_0xe5b6('0x5f'))[_0xe5b6('0x35')]('CampaignId\x20=\x20?',_0x1c1e1d[_0xe5b6('0x40')]['id'][_0xe5b6('0x71')]()))[_0xe5b6('0x35')](_0xe5b6('0x74'),squel[_0xe5b6('0x67')]()['field'](_0xe5b6('0x75'))[_0xe5b6('0x6e')](_0xe5b6('0x6f'))[_0xe5b6('0x35')](_0xe5b6('0x7c'),_0x1c1e1d[_0xe5b6('0x40')]['id'][_0xe5b6('0x71')]())[_0xe5b6('0x35')](_0xe5b6('0x76')))['group'](_0xe5b6('0x63')))[_0xe5b6('0x71')]();return db[_0xe5b6('0x48')][_0xe5b6('0x2b')](_0x5b8a0e);}return[];})[_0xe5b6('0x20')](respondWithResult(_0x574403,null))[_0xe5b6('0x3e')](handleError(_0x574403,null));};exports['checkContactHopper']=function(_0x43dea7,_0x42c41a,_0x2728ce){return db['CmHopper'][_0xe5b6('0x7d')]({'where':{'VoiceQueueId':_0x43dea7['body'][_0xe5b6('0x64')],'CampaignId':_0x43dea7['body'][_0xe5b6('0x7a')],'ContactId':_0x43dea7['body'][_0xe5b6('0x63')]}})[_0xe5b6('0x20')](handleEntityNotFound(_0x42c41a,null))[_0xe5b6('0x20')](function(_0x359e3e){if(_0x359e3e){return _0x359e3e;}return null;})[_0xe5b6('0x20')](respondWithResult(_0x42c41a,null))[_0xe5b6('0x3e')](handleError(_0x42c41a,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 896526f..e7f275b 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 _0xfdbb=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./cmHopperFinal.attributes','exports','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash'];(function(_0x547459,_0x1d2690){var _0x4d261b=function(_0x323865){while(--_0x323865){_0x547459['push'](_0x547459['shift']());}};_0x4d261b(++_0x1d2690);}(_0xfdbb,0xb3));var _0xbfdb=function(_0x378b4,_0x5ca7fa){_0x378b4=_0x378b4-0x0;var _0x11d07b=_0xfdbb[_0x378b4];return _0x11d07b;};'use strict';var _=require(_0xbfdb('0x0'));var util=require(_0xbfdb('0x1'));var logger=require(_0xbfdb('0x2'))(_0xbfdb('0x3'));var moment=require(_0xbfdb('0x4'));var BPromise=require(_0xbfdb('0x5'));var rp=require(_0xbfdb('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbfdb('0x7'));var config=require(_0xbfdb('0x8'));var attributes=require(_0xbfdb('0x9'));module[_0xbfdb('0xa')]=function(_0x3e6b6e,_0x478430){return _0x3e6b6e['define'](_0xbfdb('0xb'),attributes,{'tableName':_0xbfdb('0xc'),'paranoid':![],'indexes':[{'name':_0xbfdb('0xd'),'fields':[_0xbfdb('0xd')]},{'name':_0xbfdb('0xe'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x860f=['uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','CmHopperFinal','cm_hopper_final','calleridnum'];(function(_0x51edca,_0x18ad70){var _0x2b77ec=function(_0x55a549){while(--_0x55a549){_0x51edca['push'](_0x51edca['shift']());}};_0x2b77ec(++_0x18ad70);}(_0x860f,0x189));var _0xf860=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0x860f[_0x47e7cb];return _0x2a8874;};'use strict';var _=require(_0xf860('0x0'));var util=require(_0xf860('0x1'));var logger=require(_0xf860('0x2'))(_0xf860('0x3'));var moment=require(_0xf860('0x4'));var BPromise=require(_0xf860('0x5'));var rp=require(_0xf860('0x6'));var fs=require('fs');var path=require(_0xf860('0x7'));var rimraf=require(_0xf860('0x8'));var config=require(_0xf860('0x9'));var attributes=require('./cmHopperFinal.attributes');module['exports']=function(_0x5e1199,_0x419294){return _0x5e1199['define'](_0xf860('0xa'),attributes,{'tableName':_0xf860('0xb'),'paranoid':![],'indexes':[{'name':_0xf860('0xc'),'fields':['calleridnum']},{'name':_0xf860('0xd'),'fields':[_0xf860('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 4546909..294bc87 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 _0x12b7=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','CmHopperFinal,\x20%s,\x20%s,\x20%s','error','code','CmHopperFinal,\x20%s,\x20%s','message','result','catch','create','body','options','raw','then','CreateCmHopperFinal','stringify','moment','bluebird','randomstring','ioredis'];(function(_0x2b08ea,_0x28ad45){var _0x46474d=function(_0x5f0ead){while(--_0x5f0ead){_0x2b08ea['push'](_0x2b08ea['shift']());}};_0x46474d(++_0x28ad45);}(_0x12b7,0x182));var _0x712b=function(_0x45fbd2,_0x507381){_0x45fbd2=_0x45fbd2-0x0;var _0x926e6a=_0x12b7[_0x45fbd2];return _0x926e6a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x712b('0x0'));var BPromise=require(_0x712b('0x1'));var rs=require(_0x712b('0x2'));var fs=require('fs');var Redis=require(_0x712b('0x3'));var db=require(_0x712b('0x4'))['db'];var utils=require(_0x712b('0x5'));var logger=require(_0x712b('0x6'))(_0x712b('0x7'));var config=require(_0x712b('0x8'));var jayson=require(_0x712b('0x9'));var client=jayson[_0x712b('0xa')][_0x712b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5f46a8,_0x231fb3,_0x454359){return new BPromise(function(_0x5d2ef4,_0x5159e7){return client[_0x712b('0xc')](_0x5f46a8,_0x454359)['then'](function(_0x1c54bd){logger[_0x712b('0xd')]('CmHopperFinal,\x20%s,\x20%s',_0x231fb3,_0x712b('0xe'));logger[_0x712b('0xf')](_0x712b('0x10'),_0x231fb3,'request\x20sent',JSON['stringify'](_0x1c54bd));if(_0x1c54bd[_0x712b('0x11')]){if(_0x1c54bd[_0x712b('0x11')][_0x712b('0x12')]===0x1f4){logger[_0x712b('0x11')](_0x712b('0x13'),_0x231fb3,_0x1c54bd[_0x712b('0x11')][_0x712b('0x14')]);return _0x5159e7(_0x1c54bd[_0x712b('0x11')]['message']);}logger[_0x712b('0x11')](_0x712b('0x13'),_0x231fb3,_0x1c54bd[_0x712b('0x11')][_0x712b('0x14')]);return _0x5d2ef4(_0x1c54bd[_0x712b('0x11')][_0x712b('0x14')]);}else{logger['info'](_0x712b('0x13'),_0x231fb3,_0x712b('0xe'));_0x5d2ef4(_0x1c54bd[_0x712b('0x15')][_0x712b('0x14')]);}})[_0x712b('0x16')](function(_0x2b0a82){logger[_0x712b('0x11')]('CmHopperFinal,\x20%s,\x20%s',_0x231fb3,_0x2b0a82);_0x5159e7(_0x2b0a82);});});}exports['CreateCmHopperFinal']=function(_0x3fe990){var _0x32ae23=this;return new Promise(function(_0x222863,_0x251bc6){return db['CmHopperFinal'][_0x712b('0x17')](_0x3fe990[_0x712b('0x18')],{'raw':_0x3fe990[_0x712b('0x19')]?_0x3fe990[_0x712b('0x19')][_0x712b('0x1a')]===undefined?!![]:![]:!![]})[_0x712b('0x1b')](function(_0x40b381){logger['info'](_0x712b('0x1c'),_0x3fe990);logger[_0x712b('0xf')](_0x712b('0x1c'),_0x3fe990,JSON[_0x712b('0x1d')](_0x40b381));_0x222863(_0x40b381);})[_0x712b('0x16')](function(_0x34ce3c){logger[_0x712b('0x11')](_0x712b('0x1c'),_0x34ce3c['message'],_0x3fe990);_0x251bc6(_0x32ae23[_0x712b('0x11')](0x1f4,_0x34ce3c[_0x712b('0x14')]));});});}; \ No newline at end of file +var _0xa04c=['CmHopperFinal,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateCmHopperFinal','CmHopperFinal','create','body','options','then','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','CmHopperFinal,\x20%s,\x20%s','request\x20sent','debug'];(function(_0xf21353,_0x4e76cf){var _0xd2371f=function(_0xca6953){while(--_0xca6953){_0xf21353['push'](_0xf21353['shift']());}};_0xd2371f(++_0x4e76cf);}(_0xa04c,0x151));var _0xca04=function(_0x42e97d,_0x4c3e25){_0x42e97d=_0x42e97d-0x0;var _0x307cf2=_0xa04c[_0x42e97d];return _0x307cf2;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xca04('0x0'));var rs=require(_0xca04('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xca04('0x2'))['db'];var utils=require(_0xca04('0x3'));var logger=require(_0xca04('0x4'))(_0xca04('0x5'));var config=require(_0xca04('0x6'));var jayson=require(_0xca04('0x7'));var client=jayson[_0xca04('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4b2305,_0x2bb740,_0x3159ba){return new BPromise(function(_0x298cd7,_0x38a767){return client[_0xca04('0x9')](_0x4b2305,_0x3159ba)['then'](function(_0x579f5d){logger[_0xca04('0xa')](_0xca04('0xb'),_0x2bb740,_0xca04('0xc'));logger[_0xca04('0xd')](_0xca04('0xe'),_0x2bb740,_0xca04('0xc'),JSON[_0xca04('0xf')](_0x579f5d));if(_0x579f5d[_0xca04('0x10')]){if(_0x579f5d[_0xca04('0x10')][_0xca04('0x11')]===0x1f4){logger[_0xca04('0x10')](_0xca04('0xb'),_0x2bb740,_0x579f5d[_0xca04('0x10')]['message']);return _0x38a767(_0x579f5d[_0xca04('0x10')][_0xca04('0x12')]);}logger['error'](_0xca04('0xb'),_0x2bb740,_0x579f5d[_0xca04('0x10')][_0xca04('0x12')]);return _0x298cd7(_0x579f5d['error'][_0xca04('0x12')]);}else{logger[_0xca04('0xa')](_0xca04('0xb'),_0x2bb740,_0xca04('0xc'));_0x298cd7(_0x579f5d[_0xca04('0x13')][_0xca04('0x12')]);}})[_0xca04('0x14')](function(_0xec827c){logger['error'](_0xca04('0xb'),_0x2bb740,_0xec827c);_0x38a767(_0xec827c);});});}exports[_0xca04('0x15')]=function(_0x216ed6){var _0x256f44=this;return new Promise(function(_0x2faced,_0x340da6){return db[_0xca04('0x16')][_0xca04('0x17')](_0x216ed6[_0xca04('0x18')],{'raw':_0x216ed6[_0xca04('0x19')]?_0x216ed6[_0xca04('0x19')]['raw']===undefined?!![]:![]:!![]})[_0xca04('0x1a')](function(_0x49cf28){logger[_0xca04('0xa')](_0xca04('0x15'),_0x216ed6);logger[_0xca04('0xd')](_0xca04('0x15'),_0x216ed6,JSON[_0xca04('0xf')](_0x49cf28));_0x2faced(_0x49cf28);})[_0xca04('0x14')](function(_0x45db35){logger['error'](_0xca04('0x15'),_0x45db35[_0xca04('0x12')],_0x216ed6);_0x340da6(_0x256f44['error'](0x1f4,_0x45db35[_0xca04('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index 0d9cb41..999f7f3 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 _0x8d50=['checkContactHopper','put','update','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','isAuthenticated','index','get','/describe','describe','/:id','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','post','/voice/campaign/moveContacts/:id'];(function(_0x589189,_0x2ff145){var _0x3cd621=function(_0x1a63b4){while(--_0x1a63b4){_0x589189['push'](_0x589189['shift']());}};_0x3cd621(++_0x2ff145);}(_0x8d50,0xdc));var _0x08d5=function(_0x50946f,_0xb2abb7){_0x50946f=_0x50946f-0x0;var _0xdea2e1=_0x8d50[_0x50946f];return _0xdea2e1;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x08d5('0x0'));var timeout=require(_0x08d5('0x1'));var express=require(_0x08d5('0x2'));var router=express[_0x08d5('0x3')]();var auth=require(_0x08d5('0x4'));var interaction=require(_0x08d5('0x5'));var config=require(_0x08d5('0x6'));var controller=require(_0x08d5('0x7'));router['get']('/',auth[_0x08d5('0x8')](),controller[_0x08d5('0x9')]);router[_0x08d5('0xa')](_0x08d5('0xb'),auth[_0x08d5('0x8')](),controller[_0x08d5('0xc')]);router[_0x08d5('0xa')](_0x08d5('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x08d5('0xa')](_0x08d5('0xe'),auth[_0x08d5('0x8')](),controller[_0x08d5('0xf')]);router[_0x08d5('0xa')]('/campaign/countAttributes/:id',auth[_0x08d5('0x8')](),controller['countContactsIvrCampaignHopperFinal']);router['post'](_0x08d5('0x10'),auth[_0x08d5('0x8')](),controller[_0x08d5('0x11')]);router[_0x08d5('0x12')](_0x08d5('0x13'),auth[_0x08d5('0x8')](),controller['moveContactsIvrCampaignHopperFinal']);router['post']('/checkContactHopper',auth['isAuthenticated'](),controller[_0x08d5('0x14')]);router[_0x08d5('0x15')](_0x08d5('0xd'),auth['isAuthenticated'](),controller[_0x08d5('0x16')]);module[_0x08d5('0x17')]=router; \ No newline at end of file +var _0x1f77=['/describe','describe','/:id','show','countContactsQueueCampaignHopperFinal','countContactsIvrCampaignHopperFinal','post','/checkContactHopper','checkContactHopper','put','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','./cmHopperFinal.controller','get','isAuthenticated','index'];(function(_0x48fe9d,_0x17e621){var _0x36cf5e=function(_0x516f83){while(--_0x516f83){_0x48fe9d['push'](_0x48fe9d['shift']());}};_0x36cf5e(++_0x17e621);}(_0x1f77,0x74));var _0x71f7=function(_0x170663,_0x248416){_0x170663=_0x170663-0x0;var _0x3bd975=_0x1f77[_0x170663];return _0x3bd975;};'use strict';var multer=require(_0x71f7('0x0'));var util=require('util');var path=require(_0x71f7('0x1'));var timeout=require('connect-timeout');var express=require(_0x71f7('0x2'));var router=express[_0x71f7('0x3')]();var auth=require(_0x71f7('0x4'));var interaction=require(_0x71f7('0x5'));var config=require('../../config/environment');var controller=require(_0x71f7('0x6'));router[_0x71f7('0x7')]('/',auth[_0x71f7('0x8')](),controller[_0x71f7('0x9')]);router[_0x71f7('0x7')](_0x71f7('0xa'),auth['isAuthenticated'](),controller[_0x71f7('0xb')]);router[_0x71f7('0x7')](_0x71f7('0xc'),auth[_0x71f7('0x8')](),controller[_0x71f7('0xd')]);router[_0x71f7('0x7')]('/voice/queue/countAttributes/:id',auth['isAuthenticated'](),controller[_0x71f7('0xe')]);router['get']('/campaign/countAttributes/:id',auth[_0x71f7('0x8')](),controller[_0x71f7('0xf')]);router[_0x71f7('0x10')]('/voice/queue/moveContacts/:id',auth['isAuthenticated'](),controller['moveContactsQueueCampaignHopperFinal']);router['post']('/voice/campaign/moveContacts/:id',auth[_0x71f7('0x8')](),controller['moveContactsIvrCampaignHopperFinal']);router['post'](_0x71f7('0x11'),auth['isAuthenticated'](),controller[_0x71f7('0x12')]);router[_0x71f7('0x13')](_0x71f7('0xc'),auth['isAuthenticated'](),controller['update']);module[_0x71f7('0x14')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index f9c0304..6857803 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 _0x219d=['BOOLEAN','sequelize','exports','STRING','INTEGER','DATE'];(function(_0x37bc3b,_0x5ca5c3){var _0x508415=function(_0x2e55ed){while(--_0x2e55ed){_0x37bc3b['push'](_0x37bc3b['shift']());}};_0x508415(++_0x5ca5c3);}(_0x219d,0x199));var _0xd219=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x219d[_0x432682];return _0x463d05;};'use strict';var Sequelize=require(_0xd219('0x0'));module[_0xd219('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0xd219('0x2')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0xd219('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xd219('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0xd219('0x2')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xd219('0x2')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0xd219('0x4')]},'answertime':{'type':Sequelize[_0xd219('0x4')]},'droptime':{'type':Sequelize[_0xd219('0x4')]},'endtime':{'type':Sequelize[_0xd219('0x4')]},'ringtime':{'type':Sequelize[_0xd219('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xd219('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xd219('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xd219('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xd219('0x2')]},'campaign':{'type':Sequelize[_0xd219('0x2')]},'campaigntype':{'type':Sequelize[_0xd219('0x2')]},'membername':{'type':Sequelize[_0xd219('0x2')]},'reason':{'type':Sequelize[_0xd219('0x2')]},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0xd219('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0xd219('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xd219('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0xd219('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0xd219('0x4')]},'edited':{'type':Sequelize[_0xd219('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xd219('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xd219('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xd219('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xd219('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xd219('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x6d30=['STRING','DATE','BOOLEAN','sequelize','exports','INTEGER'];(function(_0x5c1b26,_0x356a45){var _0x5253de=function(_0x1ae31f){while(--_0x1ae31f){_0x5c1b26['push'](_0x5c1b26['shift']());}};_0x5253de(++_0x356a45);}(_0x6d30,0xab));var _0x06d3=function(_0x48f038,_0x2bde84){_0x48f038=_0x48f038-0x0;var _0x2edc62=_0x6d30[_0x48f038];return _0x2edc62;};'use strict';var Sequelize=require(_0x06d3('0x0'));module[_0x06d3('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0x06d3('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x06d3('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x06d3('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x06d3('0x3')]},'originatecalleridname':{'type':Sequelize[_0x06d3('0x3')]},'calleridnum':{'type':Sequelize[_0x06d3('0x3')]},'calleridname':{'type':Sequelize[_0x06d3('0x3')]},'starttime':{'type':Sequelize[_0x06d3('0x4')]},'responsetime':{'type':Sequelize[_0x06d3('0x4')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0x06d3('0x4')]},'endtime':{'type':Sequelize[_0x06d3('0x4')]},'ringtime':{'type':Sequelize[_0x06d3('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x06d3('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x06d3('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x06d3('0x3')]},'campaign':{'type':Sequelize[_0x06d3('0x3')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0x06d3('0x3')]},'amd':{'type':Sequelize[_0x06d3('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0x06d3('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0x06d3('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x06d3('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x06d3('0x4')]},'recallme':{'type':Sequelize[_0x06d3('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x06d3('0x4')]},'edited':{'type':Sequelize[_0x06d3('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x06d3('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x06d3('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x06d3('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index c1dbea3..3e989f9 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 _0x094f=['name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','CmHopperHistory','includeAll','catch','show','params','find','create','describe','uniqueid','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','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','../../mysqldb','sendStatus','end','status','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack'];(function(_0x4d4440,_0x101e49){var _0x38959b=function(_0x143aea){while(--_0x143aea){_0x4d4440['push'](_0x4d4440['shift']());}};_0x38959b(++_0x101e49);}(_0x094f,0x1a4));var _0xf094=function(_0x1b70e3,_0x3a15b1){_0x1b70e3=_0x1b70e3-0x0;var _0x1452ab=_0x094f[_0x1b70e3];return _0x1452ab;};'use strict';var pdf=require(_0xf094('0x0'));var emlformat=require(_0xf094('0x1'));var rimraf=require(_0xf094('0x2'));var zipdir=require(_0xf094('0x3'));var jsonpatch=require(_0xf094('0x4'));var rp=require(_0xf094('0x5'));var moment=require(_0xf094('0x6'));var BPromise=require(_0xf094('0x7'));var Mustache=require('mustache');var util=require('util');var path=require(_0xf094('0x8'));var sox=require(_0xf094('0x9'));var csv=require(_0xf094('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xf094('0xb'));var squel=require(_0xf094('0xc'));var crypto=require(_0xf094('0xd'));var jsforce=require(_0xf094('0xe'));var deskjs=require(_0xf094('0xf'));var toCsv=require(_0xf094('0xa'));var querystring=require(_0xf094('0x10'));var Papa=require(_0xf094('0x11'));var Redis=require(_0xf094('0x12'));var authService=require(_0xf094('0x13'));var qs=require(_0xf094('0x14'));var as=require(_0xf094('0x15'));var hardwareService=require(_0xf094('0x16'));var logger=require(_0xf094('0x17'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xf094('0x18'))['db'];function respondWithStatusCode(_0x42605f,_0x25d982){_0x25d982=_0x25d982||0xcc;return function(_0x37c187){if(_0x37c187){return _0x42605f[_0xf094('0x19')](_0x25d982);}return _0x42605f['status'](_0x25d982)[_0xf094('0x1a')]();};}function respondWithResult(_0x3f057b,_0x11ec6a){_0x11ec6a=_0x11ec6a||0xc8;return function(_0x3327d7){if(_0x3327d7){return _0x3f057b[_0xf094('0x1b')](_0x11ec6a)['json'](_0x3327d7);}};}function respondWithFilteredResult(_0x52622e,_0x1ac556){return function(_0x271f92){if(_0x271f92){var _0x444370=_0x271f92[_0xf094('0x1c')],_0x432f18=_0x1ac556['offset'],_0x5be3a9=_0x1ac556[_0xf094('0x1d')]+_0x1ac556[_0xf094('0x1e')],_0x1ee049;if(_0x5be3a9>=_0x444370){_0x5be3a9=_0x444370;_0x1ee049=0xc8;}else{_0x1ee049=0xce;}_0x52622e[_0xf094('0x1b')](_0x1ee049);return _0x52622e[_0xf094('0x1f')](_0xf094('0x20'),_0x432f18+'-'+_0x5be3a9+'/'+_0x444370)[_0xf094('0x21')](_0x271f92);}return null;};}function patchUpdates(_0x29c4ab){return function(_0x537fda){try{jsonpatch[_0xf094('0x22')](_0x537fda,_0x29c4ab,!![]);}catch(_0x5c602b){return BPromise[_0xf094('0x23')](_0x5c602b);}return _0x537fda[_0xf094('0x24')]();};}function saveUpdates(_0x19b0c4,_0x45b223){return function(_0x32db59){if(_0x32db59){return _0x32db59[_0xf094('0x25')](_0x19b0c4)[_0xf094('0x26')](function(_0x14fb61){return _0x14fb61;});}return null;};}function removeEntity(_0x40a2a0,_0x43d765){return function(_0x4d7be0){if(_0x4d7be0){return _0x4d7be0[_0xf094('0x27')]()[_0xf094('0x26')](function(){_0x40a2a0[_0xf094('0x1b')](0xcc)[_0xf094('0x1a')]();});}};}function handleEntityNotFound(_0x239880,_0x55891f){return function(_0x4fe7db){if(!_0x4fe7db){_0x239880[_0xf094('0x19')](0x194);}return _0x4fe7db;};}function handleError(_0x2f95d5,_0xe80fdf){_0xe80fdf=_0xe80fdf||0x1f4;return function(_0x2bdd1c){logger[_0xf094('0x28')](_0x2bdd1c[_0xf094('0x29')]);if(_0x2bdd1c['name']){delete _0x2bdd1c[_0xf094('0x2a')];}_0x2f95d5['status'](_0xe80fdf)[_0xf094('0x2b')](_0x2bdd1c);};}exports[_0xf094('0x2c')]=function(_0x41887b,_0x237d89){var _0x45de8c={},_0x2b8be8={},_0x38290a={'count':0x0,'rows':[]};var _0xc03097=_[_0xf094('0x2d')](db['CmHopperHistory'][_0xf094('0x2e')],function(_0x72636c){return{'name':_0x72636c[_0xf094('0x2f')],'type':_0x72636c[_0xf094('0x30')][_0xf094('0x31')]};});_0x2b8be8['model']=_[_0xf094('0x2d')](_0xc03097,'name');_0x2b8be8[_0xf094('0x32')]=_[_0xf094('0x33')](_0x41887b['query']);_0x2b8be8[_0xf094('0x34')]=_[_0xf094('0x35')](_0x2b8be8[_0xf094('0x36')],_0x2b8be8[_0xf094('0x32')]);_0x45de8c[_0xf094('0x37')]=_[_0xf094('0x35')](_0x2b8be8[_0xf094('0x36')],qs[_0xf094('0x38')](_0x41887b[_0xf094('0x32')][_0xf094('0x38')]));_0x45de8c[_0xf094('0x37')]=_0x45de8c[_0xf094('0x37')][_0xf094('0x39')]?_0x45de8c['attributes']:_0x2b8be8[_0xf094('0x36')];if(!_0x41887b[_0xf094('0x32')][_0xf094('0x3a')](_0xf094('0x3b'))){_0x45de8c[_0xf094('0x1e')]=qs[_0xf094('0x1e')](_0x41887b['query']['limit']);_0x45de8c['offset']=qs[_0xf094('0x1d')](_0x41887b['query'][_0xf094('0x1d')]);}_0x45de8c[_0xf094('0x3c')]=qs[_0xf094('0x3d')](_0x41887b[_0xf094('0x32')][_0xf094('0x3d')]);_0x45de8c[_0xf094('0x3e')]=qs[_0xf094('0x34')](_[_0xf094('0x3f')](_0x41887b[_0xf094('0x32')],_0x2b8be8['filters']),_0xc03097);if(_0x41887b[_0xf094('0x32')][_0xf094('0x40')]){_0x45de8c[_0xf094('0x3e')]=_[_0xf094('0x41')](_0x45de8c[_0xf094('0x3e')],{'$or':_['map'](_0xc03097,function(_0x450fb8){if(_0x450fb8['type']!=='VIRTUAL'){var _0x478be5={};_0x478be5[_0x450fb8[_0xf094('0x2a')]]={'$like':'%'+_0x41887b['query'][_0xf094('0x40')]+'%'};return _0x478be5;}})});}_0x45de8c=_[_0xf094('0x41')]({},_0x45de8c,_0x41887b[_0xf094('0x42')]);var _0x434ec4={'where':_0x45de8c[_0xf094('0x3e')]};return db[_0xf094('0x43')][_0xf094('0x1c')](_0x434ec4)[_0xf094('0x26')](function(_0x1e9ec3){_0x38290a['count']=_0x1e9ec3;if(_0x41887b[_0xf094('0x32')][_0xf094('0x44')]){_0x45de8c['include']=[{'all':!![]}];}return db[_0xf094('0x43')]['findAll'](_0x45de8c);})[_0xf094('0x26')](function(_0xeb1335){_0x38290a['rows']=_0xeb1335;return _0x38290a;})[_0xf094('0x26')](respondWithFilteredResult(_0x237d89,_0x45de8c))[_0xf094('0x45')](handleError(_0x237d89,null));};exports[_0xf094('0x46')]=function(_0x5ac7ab,_0x6652ef){var _0x2a9ab5={'raw':!![],'where':{'id':_0x5ac7ab[_0xf094('0x47')]['id']}},_0x27dfae={};_0x27dfae[_0xf094('0x36')]=_[_0xf094('0x33')](db['CmHopperHistory'][_0xf094('0x2e')]);_0x27dfae['query']=_[_0xf094('0x33')](_0x5ac7ab[_0xf094('0x32')]);_0x27dfae['filters']=_[_0xf094('0x35')](_0x27dfae[_0xf094('0x36')],_0x27dfae[_0xf094('0x32')]);_0x2a9ab5['attributes']=_[_0xf094('0x35')](_0x27dfae[_0xf094('0x36')],qs['fields'](_0x5ac7ab[_0xf094('0x32')][_0xf094('0x38')]));_0x2a9ab5['attributes']=_0x2a9ab5[_0xf094('0x37')][_0xf094('0x39')]?_0x2a9ab5[_0xf094('0x37')]:_0x27dfae[_0xf094('0x36')];if(_0x5ac7ab['query'][_0xf094('0x44')]){_0x2a9ab5['include']=[{'all':!![]}];}_0x2a9ab5=_[_0xf094('0x41')]({},_0x2a9ab5,_0x5ac7ab['options']);return db[_0xf094('0x43')][_0xf094('0x48')](_0x2a9ab5)[_0xf094('0x26')](handleEntityNotFound(_0x6652ef,null))['then'](respondWithResult(_0x6652ef,null))[_0xf094('0x45')](handleError(_0x6652ef,null));};exports['create']=function(_0x5adb46,_0x2cbf6c){return db[_0xf094('0x43')][_0xf094('0x49')](_0x5adb46['body'],{})[_0xf094('0x26')](respondWithResult(_0x2cbf6c,0xc9))[_0xf094('0x45')](handleError(_0x2cbf6c,null));};exports[_0xf094('0x4a')]=function(_0x4e5045,_0x20bd45){return db['CmHopperHistory']['describe']()[_0xf094('0x26')](respondWithResult(_0x20bd45,null))[_0xf094('0x45')](handleError(_0x20bd45,null));};exports[_0xf094('0x25')]=function(_0x35b4ac,_0x34e8c7){if(_0x35b4ac['body']['uniqueid']){delete _0x35b4ac['body'][_0xf094('0x4b')];}return db['CmHopperHistory']['find']({'where':{'uniqueid':_0x35b4ac[_0xf094('0x47')]['id']}})[_0xf094('0x26')](handleEntityNotFound(_0x34e8c7,null))[_0xf094('0x26')](saveUpdates(_0x35b4ac[_0xf094('0x4c')],null))['then'](respondWithResult(_0x34e8c7,null))[_0xf094('0x45')](handleError(_0x34e8c7,null));}; \ No newline at end of file +var _0x9bad=['sendStatus','status','end','json','count','offset','limit','Content-Range','reject','save','update','then','stack','name','send','map','CmHopperHistory','fieldName','type','key','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','create','body','describe','uniqueid','find','params','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb'];(function(_0x154f26,_0x228c67){var _0x2a1b3f=function(_0x1a93a3){while(--_0x1a93a3){_0x154f26['push'](_0x154f26['shift']());}};_0x2a1b3f(++_0x228c67);}(_0x9bad,0x1ee));var _0xd9ba=function(_0x36b16a,_0x573bb9){_0x36b16a=_0x36b16a-0x0;var _0x134793=_0x9bad[_0x36b16a];return _0x134793;};'use strict';var pdf=require(_0xd9ba('0x0'));var emlformat=require(_0xd9ba('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xd9ba('0x2'));var jsonpatch=require(_0xd9ba('0x3'));var rp=require(_0xd9ba('0x4'));var moment=require(_0xd9ba('0x5'));var BPromise=require(_0xd9ba('0x6'));var Mustache=require(_0xd9ba('0x7'));var util=require(_0xd9ba('0x8'));var path=require('path');var sox=require(_0xd9ba('0x9'));var csv=require(_0xd9ba('0xa'));var ejs=require(_0xd9ba('0xb'));var fs=require('fs');var _=require(_0xd9ba('0xc'));var squel=require('squel');var crypto=require(_0xd9ba('0xd'));var jsforce=require(_0xd9ba('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xd9ba('0xa'));var querystring=require(_0xd9ba('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xd9ba('0x10'));var qs=require(_0xd9ba('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd9ba('0x12'));var logger=require(_0xd9ba('0x13'))(_0xd9ba('0x14'));var utils=require(_0xd9ba('0x15'));var config=require(_0xd9ba('0x16'));var db=require(_0xd9ba('0x17'))['db'];function respondWithStatusCode(_0x50443b,_0x71515c){_0x71515c=_0x71515c||0xcc;return function(_0x28ae14){if(_0x28ae14){return _0x50443b[_0xd9ba('0x18')](_0x71515c);}return _0x50443b[_0xd9ba('0x19')](_0x71515c)[_0xd9ba('0x1a')]();};}function respondWithResult(_0x212d8c,_0x264fc6){_0x264fc6=_0x264fc6||0xc8;return function(_0x3c65d4){if(_0x3c65d4){return _0x212d8c[_0xd9ba('0x19')](_0x264fc6)[_0xd9ba('0x1b')](_0x3c65d4);}};}function respondWithFilteredResult(_0x2815ce,_0xbbb95c){return function(_0x36adec){if(_0x36adec){var _0x3b5755=_0x36adec[_0xd9ba('0x1c')],_0xc19886=_0xbbb95c['offset'],_0x21f44b=_0xbbb95c[_0xd9ba('0x1d')]+_0xbbb95c[_0xd9ba('0x1e')],_0x15693d;if(_0x21f44b>=_0x3b5755){_0x21f44b=_0x3b5755;_0x15693d=0xc8;}else{_0x15693d=0xce;}_0x2815ce[_0xd9ba('0x19')](_0x15693d);return _0x2815ce['set'](_0xd9ba('0x1f'),_0xc19886+'-'+_0x21f44b+'/'+_0x3b5755)['json'](_0x36adec);}return null;};}function patchUpdates(_0x35f103){return function(_0x43e76b){try{jsonpatch['apply'](_0x43e76b,_0x35f103,!![]);}catch(_0x2ce8e9){return BPromise[_0xd9ba('0x20')](_0x2ce8e9);}return _0x43e76b[_0xd9ba('0x21')]();};}function saveUpdates(_0x3f8a33,_0x3fa01b){return function(_0x1c5381){if(_0x1c5381){return _0x1c5381[_0xd9ba('0x22')](_0x3f8a33)[_0xd9ba('0x23')](function(_0xc000f7){return _0xc000f7;});}return null;};}function removeEntity(_0x9f58e0,_0x3475c8){return function(_0x1c9fa8){if(_0x1c9fa8){return _0x1c9fa8['destroy']()[_0xd9ba('0x23')](function(){_0x9f58e0[_0xd9ba('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x44696a,_0x3af2d7){return function(_0x53455a){if(!_0x53455a){_0x44696a[_0xd9ba('0x18')](0x194);}return _0x53455a;};}function handleError(_0x867304,_0x5313dd){_0x5313dd=_0x5313dd||0x1f4;return function(_0x5b2673){logger['error'](_0x5b2673[_0xd9ba('0x24')]);if(_0x5b2673[_0xd9ba('0x25')]){delete _0x5b2673[_0xd9ba('0x25')];}_0x867304['status'](_0x5313dd)[_0xd9ba('0x26')](_0x5b2673);};}exports['index']=function(_0x2b9cd3,_0x4f1a04){var _0x511f7e={},_0x19f6a8={},_0x39f6cf={'count':0x0,'rows':[]};var _0x4560=_[_0xd9ba('0x27')](db[_0xd9ba('0x28')]['rawAttributes'],function(_0x21d366){return{'name':_0x21d366[_0xd9ba('0x29')],'type':_0x21d366[_0xd9ba('0x2a')][_0xd9ba('0x2b')]};});_0x19f6a8['model']=_['map'](_0x4560,'name');_0x19f6a8[_0xd9ba('0x2c')]=_[_0xd9ba('0x2d')](_0x2b9cd3[_0xd9ba('0x2c')]);_0x19f6a8['filters']=_[_0xd9ba('0x2e')](_0x19f6a8['model'],_0x19f6a8[_0xd9ba('0x2c')]);_0x511f7e['attributes']=_[_0xd9ba('0x2e')](_0x19f6a8[_0xd9ba('0x2f')],qs[_0xd9ba('0x30')](_0x2b9cd3[_0xd9ba('0x2c')][_0xd9ba('0x30')]));_0x511f7e[_0xd9ba('0x31')]=_0x511f7e[_0xd9ba('0x31')][_0xd9ba('0x32')]?_0x511f7e['attributes']:_0x19f6a8[_0xd9ba('0x2f')];if(!_0x2b9cd3[_0xd9ba('0x2c')][_0xd9ba('0x33')](_0xd9ba('0x34'))){_0x511f7e[_0xd9ba('0x1e')]=qs[_0xd9ba('0x1e')](_0x2b9cd3[_0xd9ba('0x2c')][_0xd9ba('0x1e')]);_0x511f7e['offset']=qs[_0xd9ba('0x1d')](_0x2b9cd3[_0xd9ba('0x2c')][_0xd9ba('0x1d')]);}_0x511f7e[_0xd9ba('0x35')]=qs[_0xd9ba('0x36')](_0x2b9cd3[_0xd9ba('0x2c')][_0xd9ba('0x36')]);_0x511f7e[_0xd9ba('0x37')]=qs[_0xd9ba('0x38')](_[_0xd9ba('0x39')](_0x2b9cd3[_0xd9ba('0x2c')],_0x19f6a8[_0xd9ba('0x38')]),_0x4560);if(_0x2b9cd3['query'][_0xd9ba('0x3a')]){_0x511f7e['where']=_[_0xd9ba('0x3b')](_0x511f7e[_0xd9ba('0x37')],{'$or':_[_0xd9ba('0x27')](_0x4560,function(_0x15a1ca){if(_0x15a1ca[_0xd9ba('0x2a')]!==_0xd9ba('0x3c')){var _0x4fdd43={};_0x4fdd43[_0x15a1ca['name']]={'$like':'%'+_0x2b9cd3[_0xd9ba('0x2c')]['filter']+'%'};return _0x4fdd43;}})});}_0x511f7e=_[_0xd9ba('0x3b')]({},_0x511f7e,_0x2b9cd3[_0xd9ba('0x3d')]);var _0x4a67d4={'where':_0x511f7e[_0xd9ba('0x37')]};return db[_0xd9ba('0x28')][_0xd9ba('0x1c')](_0x4a67d4)[_0xd9ba('0x23')](function(_0x1a9b37){_0x39f6cf['count']=_0x1a9b37;if(_0x2b9cd3['query'][_0xd9ba('0x3e')]){_0x511f7e[_0xd9ba('0x3f')]=[{'all':!![]}];}return db[_0xd9ba('0x28')][_0xd9ba('0x40')](_0x511f7e);})[_0xd9ba('0x23')](function(_0x1143d5){_0x39f6cf[_0xd9ba('0x41')]=_0x1143d5;return _0x39f6cf;})[_0xd9ba('0x23')](respondWithFilteredResult(_0x4f1a04,_0x511f7e))[_0xd9ba('0x42')](handleError(_0x4f1a04,null));};exports[_0xd9ba('0x43')]=function(_0xd76ec1,_0x1d6b78){var _0x5bc009={'raw':!![],'where':{'id':_0xd76ec1['params']['id']}},_0x583808={};_0x583808[_0xd9ba('0x2f')]=_['keys'](db['CmHopperHistory']['rawAttributes']);_0x583808[_0xd9ba('0x2c')]=_[_0xd9ba('0x2d')](_0xd76ec1[_0xd9ba('0x2c')]);_0x583808[_0xd9ba('0x38')]=_[_0xd9ba('0x2e')](_0x583808[_0xd9ba('0x2f')],_0x583808[_0xd9ba('0x2c')]);_0x5bc009[_0xd9ba('0x31')]=_[_0xd9ba('0x2e')](_0x583808[_0xd9ba('0x2f')],qs[_0xd9ba('0x30')](_0xd76ec1[_0xd9ba('0x2c')]['fields']));_0x5bc009[_0xd9ba('0x31')]=_0x5bc009[_0xd9ba('0x31')][_0xd9ba('0x32')]?_0x5bc009[_0xd9ba('0x31')]:_0x583808['model'];if(_0xd76ec1[_0xd9ba('0x2c')][_0xd9ba('0x3e')]){_0x5bc009['include']=[{'all':!![]}];}_0x5bc009=_['merge']({},_0x5bc009,_0xd76ec1[_0xd9ba('0x3d')]);return db['CmHopperHistory']['find'](_0x5bc009)[_0xd9ba('0x23')](handleEntityNotFound(_0x1d6b78,null))['then'](respondWithResult(_0x1d6b78,null))[_0xd9ba('0x42')](handleError(_0x1d6b78,null));};exports[_0xd9ba('0x44')]=function(_0x4076dd,_0x1d8be6){return db[_0xd9ba('0x28')][_0xd9ba('0x44')](_0x4076dd[_0xd9ba('0x45')],{})[_0xd9ba('0x23')](respondWithResult(_0x1d8be6,0xc9))[_0xd9ba('0x42')](handleError(_0x1d8be6,null));};exports[_0xd9ba('0x46')]=function(_0x6ef95b,_0x479598){return db[_0xd9ba('0x28')][_0xd9ba('0x46')]()[_0xd9ba('0x23')](respondWithResult(_0x479598,null))[_0xd9ba('0x42')](handleError(_0x479598,null));};exports[_0xd9ba('0x22')]=function(_0x2c1be9,_0x3ef2e0){if(_0x2c1be9[_0xd9ba('0x45')][_0xd9ba('0x47')]){delete _0x2c1be9[_0xd9ba('0x45')][_0xd9ba('0x47')];}return db[_0xd9ba('0x28')][_0xd9ba('0x48')]({'where':{'uniqueid':_0x2c1be9[_0xd9ba('0x49')]['id']}})['then'](handleEntityNotFound(_0x3ef2e0,null))[_0xd9ba('0x23')](saveUpdates(_0x2c1be9[_0xd9ba('0x45')],null))[_0xd9ba('0x23')](respondWithResult(_0x3ef2e0,null))[_0xd9ba('0x42')](handleError(_0x3ef2e0,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 87b901b..c5b41dc 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 _0xdf66=['moment','bluebird','request-promise','path','rimraf','./cmHopperHistory.attributes','define','endtime','uniqueid','lodash','util','../../config/logger','api'];(function(_0x2aed41,_0x479e81){var _0x4ff431=function(_0x53f695){while(--_0x53f695){_0x2aed41['push'](_0x2aed41['shift']());}};_0x4ff431(++_0x479e81);}(_0xdf66,0x1a9));var _0x6df6=function(_0x163d42,_0x3cabea){_0x163d42=_0x163d42-0x0;var _0x59186c=_0xdf66[_0x163d42];return _0x59186c;};'use strict';var _=require(_0x6df6('0x0'));var util=require(_0x6df6('0x1'));var logger=require(_0x6df6('0x2'))(_0x6df6('0x3'));var moment=require(_0x6df6('0x4'));var BPromise=require(_0x6df6('0x5'));var rp=require(_0x6df6('0x6'));var fs=require('fs');var path=require(_0x6df6('0x7'));var rimraf=require(_0x6df6('0x8'));var config=require('../../config/environment');var attributes=require(_0x6df6('0x9'));module['exports']=function(_0x5df40f,_0x333a12){return _0x5df40f[_0x6df6('0xa')]('CmHopperHistory',attributes,{'tableName':'cm_hopper_history','paranoid':![],'indexes':[{'name':_0x6df6('0xb'),'fields':[_0x6df6('0xb')]},{'name':_0x6df6('0xc'),'fields':[_0x6df6('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xdc29=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperHistory.attributes','exports','CmHopperHistory','endtime','uniqueid','lodash','util'];(function(_0x297b5a,_0x5b36bb){var _0x3c7ebd=function(_0x541fab){while(--_0x541fab){_0x297b5a['push'](_0x297b5a['shift']());}};_0x3c7ebd(++_0x5b36bb);}(_0xdc29,0x6e));var _0x9dc2=function(_0x33706c,_0x541608){_0x33706c=_0x33706c-0x0;var _0x11eacd=_0xdc29[_0x33706c];return _0x11eacd;};'use strict';var _=require(_0x9dc2('0x0'));var util=require(_0x9dc2('0x1'));var logger=require('../../config/logger')(_0x9dc2('0x2'));var moment=require(_0x9dc2('0x3'));var BPromise=require(_0x9dc2('0x4'));var rp=require(_0x9dc2('0x5'));var fs=require('fs');var path=require(_0x9dc2('0x6'));var rimraf=require(_0x9dc2('0x7'));var config=require(_0x9dc2('0x8'));var attributes=require(_0x9dc2('0x9'));module[_0x9dc2('0xa')]=function(_0x41345f,_0x16a41a){return _0x41345f['define'](_0x9dc2('0xb'),attributes,{'tableName':'cm_hopper_history','paranoid':![],'indexes':[{'name':_0x9dc2('0xc'),'fields':[_0x9dc2('0xc')]},{'name':_0x9dc2('0xd'),'fields':[_0x9dc2('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 bdec2e8..0a4bc91 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 _0xf4eb=['col','predictiveIntervalTotalCalls','literal','predictiveIntervalAnsweredCalls','COUNT','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','where','campaign','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x208,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','name','`state`\x20=\x204,\x201,\x20null','ivrAnswerCallsDay','GetCampaignHopperHistory','lodash','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','CreateCmHopperHistory','CmHopperHistory','create','body','raw','AvgHandleTime','findAll','options','sequelize'];(function(_0x369633,_0x263fb9){var _0x1eda8c=function(_0x3b1b46){while(--_0x3b1b46){_0x369633['push'](_0x369633['shift']());}};_0x1eda8c(++_0x263fb9);}(_0xf4eb,0xec));var _0xbf4e=function(_0x4e55cc,_0x6e5a19){_0x4e55cc=_0x4e55cc-0x0;var _0xa243fb=_0xf4eb[_0x4e55cc];return _0xa243fb;};'use strict';var _=require(_0xbf4e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbf4e('0x1'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbf4e('0x2'))(_0xbf4e('0x3'));var config=require(_0xbf4e('0x4'));var jayson=require(_0xbf4e('0x5'));var client=jayson[_0xbf4e('0x6')][_0xbf4e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x15b99f,_0x540736,_0x449d55){return new BPromise(function(_0x5013c2,_0x5e23d4){return client[_0xbf4e('0x8')](_0x15b99f,_0x449d55)[_0xbf4e('0x9')](function(_0xcc4097){logger[_0xbf4e('0xa')](_0xbf4e('0xb'),_0x540736,_0xbf4e('0xc'));logger[_0xbf4e('0xd')]('CmHopperHistory,\x20%s,\x20%s,\x20%s',_0x540736,'request\x20sent',JSON[_0xbf4e('0xe')](_0xcc4097));if(_0xcc4097['error']){if(_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x10')]===0x1f4){logger['error'](_0xbf4e('0xb'),_0x540736,_0xcc4097['error']['message']);return _0x5e23d4(_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x11')]);}logger[_0xbf4e('0xf')](_0xbf4e('0xb'),_0x540736,_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x11')]);return _0x5013c2(_0xcc4097['error']['message']);}else{logger[_0xbf4e('0xa')](_0xbf4e('0xb'),_0x540736,_0xbf4e('0xc'));_0x5013c2(_0xcc4097['result'][_0xbf4e('0x11')]);}})[_0xbf4e('0x12')](function(_0x912fc0){logger[_0xbf4e('0xf')]('CmHopperHistory,\x20%s,\x20%s',_0x540736,_0x912fc0);_0x5e23d4(_0x912fc0);});});}exports[_0xbf4e('0x13')]=function(_0x577c27){var _0x5db03f=this;return new Promise(function(_0x566ec3,_0x4f8762){return db[_0xbf4e('0x14')][_0xbf4e('0x15')](_0x577c27[_0xbf4e('0x16')],{'raw':_0x577c27['options']?_0x577c27['options'][_0xbf4e('0x17')]===undefined?!![]:![]:!![]})[_0xbf4e('0x9')](function(_0x3be138){logger[_0xbf4e('0xa')](_0xbf4e('0x13'),_0x577c27);logger[_0xbf4e('0xd')](_0xbf4e('0x13'),_0x577c27,JSON[_0xbf4e('0xe')](_0x3be138));_0x566ec3(_0x3be138);})[_0xbf4e('0x12')](function(_0x376832){logger[_0xbf4e('0xf')]('CreateCmHopperHistory',_0x376832[_0xbf4e('0x11')],_0x577c27);_0x4f8762(_0x5db03f[_0xbf4e('0xf')](0x1f4,_0x376832['message']));});});};exports[_0xbf4e('0x18')]=function(_0x30994d){var _0x114412=this;return new Promise(function(_0x1bda8b,_0x3a5d72){return db['CmHopperHistory'][_0xbf4e('0x19')]({'raw':_0x30994d[_0xbf4e('0x1a')]?_0x30994d[_0xbf4e('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x30994d[_0xbf4e('0x1a')]?_0x30994d['options']['where']||null:null,'attributes':[[db[_0xbf4e('0x1b')]['fn']('COUNT',db[_0xbf4e('0x1b')][_0xbf4e('0x1c')]('id')),_0xbf4e('0x1d')],[db[_0xbf4e('0x1b')]['fn']('COUNT',db[_0xbf4e('0x1b')]['fn']('IF',db[_0xbf4e('0x1b')][_0xbf4e('0x1e')]('`state`\x20=\x204,\x201,\x20null'))),_0xbf4e('0x1f')],[db['sequelize']['fn'](_0xbf4e('0x20'),db[_0xbf4e('0x1b')]['fn']('IF',db[_0xbf4e('0x1b')]['literal'](_0xbf4e('0x21')))),_0xbf4e('0x22')],[db[_0xbf4e('0x1b')]['fn'](_0xbf4e('0x20'),db[_0xbf4e('0x1b')]['fn']('IF',db[_0xbf4e('0x1b')]['literal'](_0xbf4e('0x23')))),_0xbf4e('0x24')],[db['sequelize']['fn'](_0xbf4e('0x25'),db[_0xbf4e('0x1b')]['fn']('IF',db['sequelize'][_0xbf4e('0x1e')]('`state`\x20=\x204,\x20`holdtime`,\x20null'))),_0xbf4e('0x26')],[db['sequelize']['fn'](_0xbf4e('0x25'),db[_0xbf4e('0x1b')]['fn']('IF',db[_0xbf4e('0x1b')]['literal'](_0xbf4e('0x27')))),_0xbf4e('0x28')]]})[_0xbf4e('0x9')](function(_0x29d6aa){logger[_0xbf4e('0xa')](_0xbf4e('0x18'),_0x30994d);logger['debug'](_0xbf4e('0x18'),_0x30994d,JSON[_0xbf4e('0xe')](_0x29d6aa));_0x1bda8b(_0x29d6aa);})[_0xbf4e('0x12')](function(_0x3bba55){logger[_0xbf4e('0xf')]('AvgHandleTime',_0x3bba55['message'],_0x30994d);_0x3a5d72(_0x114412['error'](0x1f4,_0x3bba55['message']));});});};exports[_0xbf4e('0x29')]=function(_0x17a1a1){var _0x91b52f=this;return new Promise(function(_0x2693ba,_0x22ddde){return db[_0xbf4e('0x14')][_0xbf4e('0x19')]({'raw':_0x17a1a1[_0xbf4e('0x1a')]?_0x17a1a1[_0xbf4e('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x17a1a1['options']?_0x17a1a1[_0xbf4e('0x1a')][_0xbf4e('0x2a')]||null:null,'attributes':[[_0xbf4e('0x2b'),'name'],[db[_0xbf4e('0x1b')]['fn']('COUNT',db[_0xbf4e('0x1b')]['fn']('IF',db[_0xbf4e('0x1b')][_0xbf4e('0x1e')](_0xbf4e('0x2c')))),'outboundNoSuchCallsDay'],[db[_0xbf4e('0x1b')]['fn'](_0xbf4e('0x20'),db[_0xbf4e('0x1b')]['fn']('IF',db[_0xbf4e('0x1b')]['literal'](_0xbf4e('0x2d')))),_0xbf4e('0x2e')],[db[_0xbf4e('0x1b')]['fn'](_0xbf4e('0x20'),db[_0xbf4e('0x1b')]['fn']('IF',db[_0xbf4e('0x1b')][_0xbf4e('0x1e')]('`state`\x20=\x204,\x201,\x20null'))),_0xbf4e('0x2f')],[db[_0xbf4e('0x1b')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xbf4e('0x1b')][_0xbf4e('0x1e')]('`state`\x20=\x205,\x201,\x20null'))),'outboundBusyCallsDay'],[db[_0xbf4e('0x1b')]['fn'](_0xbf4e('0x20'),db[_0xbf4e('0x1b')]['fn']('IF',db[_0xbf4e('0x1b')][_0xbf4e('0x1e')](_0xbf4e('0x30')))),'outboundCongestionCallsDay'],[db[_0xbf4e('0x1b')]['fn'](_0xbf4e('0x20'),db['sequelize']['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2010\x20,\x201,\x20null'))),_0xbf4e('0x31')],[db['sequelize']['fn'](_0xbf4e('0x20'),db[_0xbf4e('0x1b')]['fn']('IF',db['sequelize']['literal'](_0xbf4e('0x32')))),_0xbf4e('0x33')],[db[_0xbf4e('0x1b')]['fn'](_0xbf4e('0x20'),db[_0xbf4e('0x1b')]['fn']('IF',db['sequelize'][_0xbf4e('0x1e')](_0xbf4e('0x34')))),_0xbf4e('0x35')],[db[_0xbf4e('0x1b')]['fn'](_0xbf4e('0x20'),db[_0xbf4e('0x1b')]['fn']('IF',db[_0xbf4e('0x1b')][_0xbf4e('0x1e')]('`state`\x20=\x2013,\x201,\x20null'))),_0xbf4e('0x36')],[db[_0xbf4e('0x1b')]['fn'](_0xbf4e('0x20'),db[_0xbf4e('0x1b')]['fn']('IF',db[_0xbf4e('0x1b')][_0xbf4e('0x1e')](_0xbf4e('0x37')))),_0xbf4e('0x38')],[db[_0xbf4e('0x1b')]['fn'](_0xbf4e('0x20'),db[_0xbf4e('0x1b')]['fn']('IF',db[_0xbf4e('0x1b')][_0xbf4e('0x1e')](_0xbf4e('0x39')))),_0xbf4e('0x3a')],[db[_0xbf4e('0x1b')]['fn'](_0xbf4e('0x20'),db['sequelize']['fn']('IF',db[_0xbf4e('0x1b')][_0xbf4e('0x1e')](_0xbf4e('0x3b')))),'outboundAnswerAgiCallsDay'],[db[_0xbf4e('0x1b')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xbf4e('0x1b')][_0xbf4e('0x1e')]('`state`\x20=\x2020,\x201,\x20null'))),_0xbf4e('0x3a')],[db[_0xbf4e('0x1b')]['fn'](_0xbf4e('0x20'),db[_0xbf4e('0x1b')]['fn']('IF',db[_0xbf4e('0x1b')][_0xbf4e('0x1e')](_0xbf4e('0x3c')))),_0xbf4e('0x3d')]],'group':[_0xbf4e('0x2b')]})[_0xbf4e('0x9')](function(_0x271ad2){logger['info']('GetVoiceQueueHopperHistory',_0x17a1a1);logger[_0xbf4e('0xd')](_0xbf4e('0x29'),_0x17a1a1,JSON[_0xbf4e('0xe')](_0x271ad2));_0x2693ba(_0x271ad2);})['catch'](function(_0x339ce6){logger[_0xbf4e('0xf')]('GetVoiceQueueHopperHistory',_0x339ce6['message'],_0x17a1a1);_0x22ddde(_0x91b52f[_0xbf4e('0xf')](0x1f4,_0x339ce6['message']));});});};exports['GetCampaignHopperHistory']=function(_0x424f41){var _0x3dd51a=this;return new Promise(function(_0x73ca86,_0x43cfd7){return db[_0xbf4e('0x14')]['findAll']({'raw':_0x424f41[_0xbf4e('0x1a')]?_0x424f41['options'][_0xbf4e('0x17')]===undefined?!![]:![]:!![],'where':_0x424f41['options']?_0x424f41[_0xbf4e('0x1a')]['where']||null:null,'attributes':[[_0xbf4e('0x2b'),_0xbf4e('0x3e')],[db[_0xbf4e('0x1b')]['fn'](_0xbf4e('0x20'),db[_0xbf4e('0x1b')]['col']('id')),'ivrTotalCallsDays'],[db['sequelize']['fn']('COUNT',db[_0xbf4e('0x1b')]['fn']('IF',db[_0xbf4e('0x1b')]['literal'](_0xbf4e('0x3f')))),_0xbf4e('0x40')]],'group':[_0xbf4e('0x2b')]})[_0xbf4e('0x9')](function(_0x17c2e1){logger[_0xbf4e('0xa')](_0xbf4e('0x41'),_0x424f41);logger['debug'](_0xbf4e('0x41'),_0x424f41,JSON[_0xbf4e('0xe')](_0x17c2e1));_0x73ca86(_0x17c2e1);})[_0xbf4e('0x12')](function(_0x5e548a){logger['error'](_0xbf4e('0x41'),_0x5e548a[_0xbf4e('0x11')],_0x424f41);_0x43cfd7(_0x3dd51a[_0xbf4e('0xf')](0x1f4,_0x5e548a['message']));});});}; \ No newline at end of file +var _0xea28=['GetVoiceQueueHopperHistory','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundAnswerCallsDay','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetCampaignHopperHistory','ivrAnswerCallsDay','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateCmHopperHistory','CmHopperHistory','create','body','options','debug','AvgHandleTime','findAll','where','COUNT','sequelize','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null'];(function(_0x2f58a1,_0x507478){var _0x60eda3=function(_0x3bcbf4){while(--_0x3bcbf4){_0x2f58a1['push'](_0x2f58a1['shift']());}};_0x60eda3(++_0x507478);}(_0xea28,0x13a));var _0x8ea2=function(_0x582cb8,_0x4a097e){_0x582cb8=_0x582cb8-0x0;var _0x1ffd18=_0xea28[_0x582cb8];return _0x1ffd18;};'use strict';var _=require(_0x8ea2('0x0'));var util=require(_0x8ea2('0x1'));var moment=require(_0x8ea2('0x2'));var BPromise=require(_0x8ea2('0x3'));var rs=require(_0x8ea2('0x4'));var fs=require('fs');var Redis=require(_0x8ea2('0x5'));var db=require(_0x8ea2('0x6'))['db'];var utils=require(_0x8ea2('0x7'));var logger=require('../../config/logger')(_0x8ea2('0x8'));var config=require(_0x8ea2('0x9'));var jayson=require(_0x8ea2('0xa'));var client=jayson['client'][_0x8ea2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x435d78,_0xb7f278,_0x39b1fa){return new BPromise(function(_0x28b5b8,_0x929304){return client[_0x8ea2('0xc')](_0x435d78,_0x39b1fa)[_0x8ea2('0xd')](function(_0x3de4a1){logger[_0x8ea2('0xe')](_0x8ea2('0xf'),_0xb7f278,_0x8ea2('0x10'));logger['debug']('CmHopperHistory,\x20%s,\x20%s,\x20%s',_0xb7f278,_0x8ea2('0x10'),JSON[_0x8ea2('0x11')](_0x3de4a1));if(_0x3de4a1[_0x8ea2('0x12')]){if(_0x3de4a1['error'][_0x8ea2('0x13')]===0x1f4){logger[_0x8ea2('0x12')](_0x8ea2('0xf'),_0xb7f278,_0x3de4a1[_0x8ea2('0x12')][_0x8ea2('0x14')]);return _0x929304(_0x3de4a1['error'][_0x8ea2('0x14')]);}logger['error']('CmHopperHistory,\x20%s,\x20%s',_0xb7f278,_0x3de4a1[_0x8ea2('0x12')][_0x8ea2('0x14')]);return _0x28b5b8(_0x3de4a1[_0x8ea2('0x12')][_0x8ea2('0x14')]);}else{logger[_0x8ea2('0xe')](_0x8ea2('0xf'),_0xb7f278,_0x8ea2('0x10'));_0x28b5b8(_0x3de4a1[_0x8ea2('0x15')][_0x8ea2('0x14')]);}})[_0x8ea2('0x16')](function(_0x2dfa7c){logger[_0x8ea2('0x12')](_0x8ea2('0xf'),_0xb7f278,_0x2dfa7c);_0x929304(_0x2dfa7c);});});}exports[_0x8ea2('0x17')]=function(_0x1b64cf){var _0x174ef2=this;return new Promise(function(_0x467045,_0x2a0329){return db[_0x8ea2('0x18')][_0x8ea2('0x19')](_0x1b64cf[_0x8ea2('0x1a')],{'raw':_0x1b64cf[_0x8ea2('0x1b')]?_0x1b64cf['options']['raw']===undefined?!![]:![]:!![]})[_0x8ea2('0xd')](function(_0x248c18){logger[_0x8ea2('0xe')]('CreateCmHopperHistory',_0x1b64cf);logger[_0x8ea2('0x1c')](_0x8ea2('0x17'),_0x1b64cf,JSON['stringify'](_0x248c18));_0x467045(_0x248c18);})[_0x8ea2('0x16')](function(_0x283f00){logger[_0x8ea2('0x12')](_0x8ea2('0x17'),_0x283f00[_0x8ea2('0x14')],_0x1b64cf);_0x2a0329(_0x174ef2[_0x8ea2('0x12')](0x1f4,_0x283f00[_0x8ea2('0x14')]));});});};exports[_0x8ea2('0x1d')]=function(_0x18ec34){var _0x4d5030=this;return new Promise(function(_0x433bc5,_0x4f48bd){return db[_0x8ea2('0x18')][_0x8ea2('0x1e')]({'raw':_0x18ec34[_0x8ea2('0x1b')]?_0x18ec34['options']['raw']===undefined?!![]:![]:!![],'where':_0x18ec34[_0x8ea2('0x1b')]?_0x18ec34['options'][_0x8ea2('0x1f')]||null:null,'attributes':[[db['sequelize']['fn'](_0x8ea2('0x20'),db[_0x8ea2('0x21')][_0x8ea2('0x22')]('id')),_0x8ea2('0x23')],[db['sequelize']['fn']('COUNT',db[_0x8ea2('0x21')]['fn']('IF',db['sequelize'][_0x8ea2('0x24')](_0x8ea2('0x25')))),_0x8ea2('0x26')],[db[_0x8ea2('0x21')]['fn'](_0x8ea2('0x20'),db[_0x8ea2('0x21')]['fn']('IF',db[_0x8ea2('0x21')][_0x8ea2('0x24')](_0x8ea2('0x27')))),_0x8ea2('0x28')],[db['sequelize']['fn']('COUNT',db[_0x8ea2('0x21')]['fn']('IF',db[_0x8ea2('0x21')]['literal']('`state`\x20=\x2011,\x201,\x20null'))),_0x8ea2('0x29')],[db['sequelize']['fn'](_0x8ea2('0x2a'),db[_0x8ea2('0x21')]['fn']('IF',db['sequelize'][_0x8ea2('0x24')](_0x8ea2('0x2b')))),_0x8ea2('0x2c')],[db['sequelize']['fn']('AVG',db['sequelize']['fn']('IF',db[_0x8ea2('0x21')][_0x8ea2('0x24')](_0x8ea2('0x2d')))),'predictiveIntervalAvgTalktime']]})[_0x8ea2('0xd')](function(_0x391b08){logger[_0x8ea2('0xe')](_0x8ea2('0x1d'),_0x18ec34);logger[_0x8ea2('0x1c')](_0x8ea2('0x1d'),_0x18ec34,JSON[_0x8ea2('0x11')](_0x391b08));_0x433bc5(_0x391b08);})[_0x8ea2('0x16')](function(_0x5e9b1f){logger[_0x8ea2('0x12')](_0x8ea2('0x1d'),_0x5e9b1f[_0x8ea2('0x14')],_0x18ec34);_0x4f48bd(_0x4d5030[_0x8ea2('0x12')](0x1f4,_0x5e9b1f['message']));});});};exports[_0x8ea2('0x2e')]=function(_0x5355aa){var _0x1e03f2=this;return new Promise(function(_0x103d5a,_0x1bec4e){return db[_0x8ea2('0x18')]['findAll']({'raw':_0x5355aa[_0x8ea2('0x1b')]?_0x5355aa['options']['raw']===undefined?!![]:![]:!![],'where':_0x5355aa[_0x8ea2('0x1b')]?_0x5355aa['options'][_0x8ea2('0x1f')]||null:null,'attributes':[[_0x8ea2('0x2f'),_0x8ea2('0x30')],[db[_0x8ea2('0x21')]['fn'](_0x8ea2('0x20'),db['sequelize']['fn']('IF',db[_0x8ea2('0x21')]['literal'](_0x8ea2('0x31')))),_0x8ea2('0x32')],[db[_0x8ea2('0x21')]['fn'](_0x8ea2('0x20'),db['sequelize']['fn']('IF',db[_0x8ea2('0x21')]['literal'](_0x8ea2('0x33')))),'outboundNoAnswerCallsDay'],[db[_0x8ea2('0x21')]['fn'](_0x8ea2('0x20'),db[_0x8ea2('0x21')]['fn']('IF',db[_0x8ea2('0x21')][_0x8ea2('0x24')](_0x8ea2('0x25')))),_0x8ea2('0x34')],[db['sequelize']['fn']('COUNT',db[_0x8ea2('0x21')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x205,\x201,\x20null'))),_0x8ea2('0x35')],[db['sequelize']['fn'](_0x8ea2('0x20'),db[_0x8ea2('0x21')]['fn']('IF',db[_0x8ea2('0x21')][_0x8ea2('0x24')](_0x8ea2('0x36')))),_0x8ea2('0x37')],[db[_0x8ea2('0x21')]['fn'](_0x8ea2('0x20'),db['sequelize']['fn']('IF',db[_0x8ea2('0x21')][_0x8ea2('0x24')](_0x8ea2('0x38')))),'outboundDropCallsDayTimeout'],[db[_0x8ea2('0x21')]['fn'](_0x8ea2('0x20'),db[_0x8ea2('0x21')]['fn']('IF',db[_0x8ea2('0x21')][_0x8ea2('0x24')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x8ea2('0x39')],[db[_0x8ea2('0x21')]['fn'](_0x8ea2('0x20'),db['sequelize']['fn']('IF',db[_0x8ea2('0x21')][_0x8ea2('0x24')](_0x8ea2('0x3a')))),_0x8ea2('0x3b')],[db[_0x8ea2('0x21')]['fn'](_0x8ea2('0x20'),db[_0x8ea2('0x21')]['fn']('IF',db[_0x8ea2('0x21')][_0x8ea2('0x24')](_0x8ea2('0x3c')))),_0x8ea2('0x3d')],[db[_0x8ea2('0x21')]['fn'](_0x8ea2('0x20'),db[_0x8ea2('0x21')]['fn']('IF',db['sequelize'][_0x8ea2('0x24')](_0x8ea2('0x3e')))),_0x8ea2('0x3f')],[db[_0x8ea2('0x21')]['fn'](_0x8ea2('0x20'),db[_0x8ea2('0x21')]['fn']('IF',db[_0x8ea2('0x21')][_0x8ea2('0x24')]('`state`\x20=\x2018,\x201,\x20null'))),_0x8ea2('0x40')],[db[_0x8ea2('0x21')]['fn'](_0x8ea2('0x20'),db['sequelize']['fn']('IF',db['sequelize'][_0x8ea2('0x24')](_0x8ea2('0x41')))),_0x8ea2('0x42')],[db['sequelize']['fn'](_0x8ea2('0x20'),db[_0x8ea2('0x21')]['fn']('IF',db[_0x8ea2('0x21')][_0x8ea2('0x24')](_0x8ea2('0x43')))),'outboundRejectCallsDay'],[db['sequelize']['fn'](_0x8ea2('0x20'),db[_0x8ea2('0x21')]['fn']('IF',db[_0x8ea2('0x21')]['literal'](_0x8ea2('0x44')))),_0x8ea2('0x45')]],'group':[_0x8ea2('0x2f')]})['then'](function(_0x5c6524){logger['info']('GetVoiceQueueHopperHistory',_0x5355aa);logger['debug'](_0x8ea2('0x2e'),_0x5355aa,JSON[_0x8ea2('0x11')](_0x5c6524));_0x103d5a(_0x5c6524);})['catch'](function(_0x49cf11){logger[_0x8ea2('0x12')](_0x8ea2('0x2e'),_0x49cf11[_0x8ea2('0x14')],_0x5355aa);_0x1bec4e(_0x1e03f2['error'](0x1f4,_0x49cf11[_0x8ea2('0x14')]));});});};exports[_0x8ea2('0x46')]=function(_0x59e3df){var _0x8f0598=this;return new Promise(function(_0x28e56a,_0x293dd8){return db[_0x8ea2('0x18')][_0x8ea2('0x1e')]({'raw':_0x59e3df['options']?_0x59e3df['options']['raw']===undefined?!![]:![]:!![],'where':_0x59e3df[_0x8ea2('0x1b')]?_0x59e3df[_0x8ea2('0x1b')][_0x8ea2('0x1f')]||null:null,'attributes':[[_0x8ea2('0x2f'),_0x8ea2('0x30')],[db[_0x8ea2('0x21')]['fn'](_0x8ea2('0x20'),db['sequelize']['col']('id')),'ivrTotalCallsDays'],[db[_0x8ea2('0x21')]['fn'](_0x8ea2('0x20'),db[_0x8ea2('0x21')]['fn']('IF',db[_0x8ea2('0x21')]['literal'](_0x8ea2('0x25')))),_0x8ea2('0x47')]],'group':['campaign']})[_0x8ea2('0xd')](function(_0x193c32){logger[_0x8ea2('0xe')](_0x8ea2('0x46'),_0x59e3df);logger[_0x8ea2('0x1c')]('GetCampaignHopperHistory',_0x59e3df,JSON['stringify'](_0x193c32));_0x28e56a(_0x193c32);})['catch'](function(_0x53a62c){logger[_0x8ea2('0x12')](_0x8ea2('0x46'),_0x53a62c[_0x8ea2('0x14')],_0x59e3df);_0x293dd8(_0x8f0598[_0x8ea2('0x12')](0x1f4,_0x53a62c['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 41be326..b80d23b 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 _0x5fab=['../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','index','describe','show','post','put','/:id','update','exports','multer','util','connect-timeout','express','Router'];(function(_0x3987e5,_0x3fc01d){var _0x45d23c=function(_0x278fb3){while(--_0x278fb3){_0x3987e5['push'](_0x3987e5['shift']());}};_0x45d23c(++_0x3fc01d);}(_0x5fab,0x177));var _0xb5fa=function(_0x581d53,_0x4ad997){_0x581d53=_0x581d53-0x0;var _0x56c2d8=_0x5fab[_0x581d53];return _0x56c2d8;};'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']('/describe',auth[_0xb5fa('0xa')](),controller[_0xb5fa('0xc')]);router[_0xb5fa('0x9')]('/:id',auth[_0xb5fa('0xa')](),controller[_0xb5fa('0xd')]);router[_0xb5fa('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0xb5fa('0xf')](_0xb5fa('0x10'),auth[_0xb5fa('0xa')](),controller[_0xb5fa('0x11')]);module[_0xb5fa('0x12')]=router; \ No newline at end of file +var _0x5ec4=['../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','index','/describe','describe','post','create','put','update','multer','path','connect-timeout','express'];(function(_0x442f02,_0x47d845){var _0xab6ef1=function(_0x4cad5c){while(--_0x4cad5c){_0x442f02['push'](_0x442f02['shift']());}};_0xab6ef1(++_0x47d845);}(_0x5ec4,0x172));var _0x45ec=function(_0x400c89,_0x593b72){_0x400c89=_0x400c89-0x0;var _0x1d1979=_0x5ec4[_0x400c89];return _0x1d1979;};'use strict';var multer=require(_0x45ec('0x0'));var util=require('util');var path=require(_0x45ec('0x1'));var timeout=require(_0x45ec('0x2'));var express=require(_0x45ec('0x3'));var router=express['Router']();var auth=require(_0x45ec('0x4'));var interaction=require(_0x45ec('0x5'));var config=require(_0x45ec('0x6'));var controller=require(_0x45ec('0x7'));router[_0x45ec('0x8')]('/',auth[_0x45ec('0x9')](),controller[_0x45ec('0xa')]);router[_0x45ec('0x8')](_0x45ec('0xb'),auth[_0x45ec('0x9')](),controller[_0x45ec('0xc')]);router[_0x45ec('0x8')]('/:id',auth[_0x45ec('0x9')](),controller['show']);router[_0x45ec('0xd')]('/',auth[_0x45ec('0x9')](),controller[_0x45ec('0xe')]);router[_0x45ec('0xf')]('/:id',auth[_0x45ec('0x9')](),controller[_0x45ec('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index f8cdc77..518d49c 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 _0xba7a=['STRING','name','exports'];(function(_0x2acd24,_0xf315ac){var _0x546099=function(_0x479e66){while(--_0x479e66){_0x2acd24['push'](_0x2acd24['shift']());}};_0x546099(++_0xf315ac);}(_0xba7a,0x89));var _0xaba7=function(_0x3e9e3e,_0x331b44){_0x3e9e3e=_0x3e9e3e-0x0;var _0x32ae57=_0xba7a[_0x3e9e3e];return _0x32ae57;};'use strict';var Sequelize=require('sequelize');module[_0xaba7('0x0')]={'name':{'type':Sequelize[_0xaba7('0x1')],'unique':_0xaba7('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xaba7('0x1')]},'dialPrefix':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x977b=['sequelize','STRING','name'];(function(_0x15038b,_0x871998){var _0x14949c=function(_0x4d5920){while(--_0x4d5920){_0x15038b['push'](_0x15038b['shift']());}};_0x14949c(++_0x871998);}(_0x977b,0x195));var _0xb977=function(_0x22fa8,_0x1068eb){_0x22fa8=_0x22fa8-0x0;var _0x5c74be=_0x977b[_0x22fa8];return _0x5c74be;};'use strict';var Sequelize=require(_0xb977('0x0'));module['exports']={'name':{'type':Sequelize[_0xb977('0x1')],'unique':_0xb977('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xb977('0x1')]},'dialPrefix':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 9a79d09..f62780e 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 _0x3c56=['redis','defaults','socket.io-emitter','./cmList.socket','register','sendStatus','status','end','count','offset','limit','Content-Range','json','apply','reject','save','update','then','destroy','get','Lists','error','stack','name','send','map','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','CmList','findAll','rows','show','keys','rawAttributes','length','catch','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','addDisposition','findOne','ListId','Disposition','removeDispositions','ids','CmContact','tags','isArray','join','push','each','omit','success','dataValues','errors','message','Malformed\x20request\x20syntax','getContacts','CustomFields','concat','cf_%d','raw','CmCustomField','format','isEmpty','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','text/csv','sequelize','addCustomFields','Sequelize','TEXT','text','number','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','findAndCountAll','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','User','getAgents','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','squel','crypto','jsforce','papaparse','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment'];(function(_0x47343f,_0x5452bc){var _0x4b2162=function(_0xa05d1c){while(--_0xa05d1c){_0x47343f['push'](_0x47343f['shift']());}};_0x4b2162(++_0x5452bc);}(_0x3c56,0x102));var _0x63c5=function(_0x4ac350,_0x35498b){_0x4ac350=_0x4ac350-0x0;var _0x384923=_0x3c56[_0x4ac350];return _0x384923;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x63c5('0x0'));var jsonpatch=require(_0x63c5('0x1'));var rp=require(_0x63c5('0x2'));var moment=require(_0x63c5('0x3'));var BPromise=require(_0x63c5('0x4'));var Mustache=require(_0x63c5('0x5'));var util=require(_0x63c5('0x6'));var path=require('path');var sox=require(_0x63c5('0x7'));var csv=require(_0x63c5('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x63c5('0x9'));var crypto=require(_0x63c5('0xa'));var jsforce=require(_0x63c5('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x63c5('0x8'));var querystring=require('querystring');var Papa=require(_0x63c5('0xc'));var Redis=require('ioredis');var authService=require(_0x63c5('0xd'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x63c5('0xe'));var logger=require('../../config/logger')(_0x63c5('0xf'));var utils=require(_0x63c5('0x10'));var config=require(_0x63c5('0x11'));var db=require('../../mysqldb')['db'];config[_0x63c5('0x12')]=_[_0x63c5('0x13')](config[_0x63c5('0x12')],{'host':'localhost','port':0x18eb});var socket=require(_0x63c5('0x14'))(new Redis(config[_0x63c5('0x12')]));require(_0x63c5('0x15'))[_0x63c5('0x16')](socket);function respondWithStatusCode(_0x5b5770,_0x35e390){_0x35e390=_0x35e390||0xcc;return function(_0x4a9518){if(_0x4a9518){return _0x5b5770[_0x63c5('0x17')](_0x35e390);}return _0x5b5770[_0x63c5('0x18')](_0x35e390)[_0x63c5('0x19')]();};}function respondWithResult(_0x4d2258,_0x364208){_0x364208=_0x364208||0xc8;return function(_0x5aba7e){if(_0x5aba7e){return _0x4d2258[_0x63c5('0x18')](_0x364208)['json'](_0x5aba7e);}};}function respondWithFilteredResult(_0x461017,_0x54fedd){return function(_0x3cfdb8){if(_0x3cfdb8){var _0x22f2f1=_0x3cfdb8[_0x63c5('0x1a')],_0x4b9252=_0x54fedd[_0x63c5('0x1b')],_0x52ab26=_0x54fedd['offset']+_0x54fedd[_0x63c5('0x1c')],_0x1b4917;if(_0x52ab26>=_0x22f2f1){_0x52ab26=_0x22f2f1;_0x1b4917=0xc8;}else{_0x1b4917=0xce;}_0x461017['status'](_0x1b4917);return _0x461017['set'](_0x63c5('0x1d'),_0x4b9252+'-'+_0x52ab26+'/'+_0x22f2f1)[_0x63c5('0x1e')](_0x3cfdb8);}return null;};}function patchUpdates(_0x3a549f){return function(_0x29d59f){try{jsonpatch[_0x63c5('0x1f')](_0x29d59f,_0x3a549f,!![]);}catch(_0x285cef){return BPromise[_0x63c5('0x20')](_0x285cef);}return _0x29d59f[_0x63c5('0x21')]();};}function saveUpdates(_0x5307b8,_0x5955c3){return function(_0x4ad34f){if(_0x4ad34f){return _0x4ad34f[_0x63c5('0x22')](_0x5307b8)[_0x63c5('0x23')](function(_0x4761eb){return _0x4761eb;});}return null;};}function removeEntity(_0x1c0eee,_0x57bd26){return function(_0x15cb7e){if(_0x15cb7e){return _0x15cb7e[_0x63c5('0x24')]()[_0x63c5('0x23')](function(){var _0x94975d=_0x15cb7e[_0x63c5('0x25')]({'plain':!![]});var _0x2cd94b=_0x63c5('0x26');return db['UserProfileResource']['destroy']({'where':{'type':_0x2cd94b,'resourceId':_0x94975d['id']}})['then'](function(){return _0x15cb7e;});})[_0x63c5('0x23')](function(){_0x1c0eee['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x32f350,_0x403a9d){return function(_0x325e4f){if(!_0x325e4f){_0x32f350[_0x63c5('0x17')](0x194);}return _0x325e4f;};}function handleError(_0x189b79,_0x4f7a8b){_0x4f7a8b=_0x4f7a8b||0x1f4;return function(_0x4b848d){logger[_0x63c5('0x27')](_0x4b848d[_0x63c5('0x28')]);if(_0x4b848d[_0x63c5('0x29')]){delete _0x4b848d['name'];}_0x189b79[_0x63c5('0x18')](_0x4f7a8b)[_0x63c5('0x2a')](_0x4b848d);};}exports['index']=function(_0x5a19dc,_0x1012d1){var _0x11633b={},_0xe64dab={},_0x2fbc94={'count':0x0,'rows':[]};var _0x4a4e74=_[_0x63c5('0x2b')](db['CmList']['rawAttributes'],function(_0x5c03fc){return{'name':_0x5c03fc['fieldName'],'type':_0x5c03fc[_0x63c5('0x2c')][_0x63c5('0x2d')]};});_0xe64dab[_0x63c5('0x2e')]=_['map'](_0x4a4e74,'name');_0xe64dab[_0x63c5('0x2f')]=_['keys'](_0x5a19dc[_0x63c5('0x2f')]);_0xe64dab[_0x63c5('0x30')]=_[_0x63c5('0x31')](_0xe64dab[_0x63c5('0x2e')],_0xe64dab['query']);_0x11633b[_0x63c5('0x32')]=_[_0x63c5('0x31')](_0xe64dab[_0x63c5('0x2e')],qs[_0x63c5('0x33')](_0x5a19dc[_0x63c5('0x2f')][_0x63c5('0x33')]));_0x11633b[_0x63c5('0x32')]=_0x11633b[_0x63c5('0x32')]['length']?_0x11633b[_0x63c5('0x32')]:_0xe64dab[_0x63c5('0x2e')];if(!_0x5a19dc[_0x63c5('0x2f')][_0x63c5('0x34')](_0x63c5('0x35'))){_0x11633b['limit']=qs[_0x63c5('0x1c')](_0x5a19dc[_0x63c5('0x2f')][_0x63c5('0x1c')]);_0x11633b[_0x63c5('0x1b')]=qs[_0x63c5('0x1b')](_0x5a19dc[_0x63c5('0x2f')]['offset']);}_0x11633b[_0x63c5('0x36')]=qs[_0x63c5('0x37')](_0x5a19dc[_0x63c5('0x2f')]['sort']);_0x11633b[_0x63c5('0x38')]=qs[_0x63c5('0x30')](_[_0x63c5('0x39')](_0x5a19dc[_0x63c5('0x2f')],_0xe64dab[_0x63c5('0x30')]),_0x4a4e74);if(_0x5a19dc[_0x63c5('0x2f')][_0x63c5('0x3a')]){_0x11633b[_0x63c5('0x38')]=_[_0x63c5('0x3b')](_0x11633b[_0x63c5('0x38')],{'$or':_[_0x63c5('0x2b')](_0x4a4e74,function(_0xe3fa26){if(_0xe3fa26[_0x63c5('0x2c')]!==_0x63c5('0x3c')){var _0x5b77cd={};_0x5b77cd[_0xe3fa26['name']]={'$like':'%'+_0x5a19dc[_0x63c5('0x2f')][_0x63c5('0x3a')]+'%'};return _0x5b77cd;}})});}_0x11633b=_[_0x63c5('0x3b')]({},_0x11633b,_0x5a19dc[_0x63c5('0x3d')]);var _0x3e90d4={'where':_0x11633b[_0x63c5('0x38')]};return db['CmList'][_0x63c5('0x1a')](_0x3e90d4)[_0x63c5('0x23')](function(_0x27d651){_0x2fbc94[_0x63c5('0x1a')]=_0x27d651;if(_0x5a19dc[_0x63c5('0x2f')][_0x63c5('0x3e')]){_0x11633b[_0x63c5('0x3f')]=[{'all':!![]}];}return db[_0x63c5('0x40')][_0x63c5('0x41')](_0x11633b);})[_0x63c5('0x23')](function(_0x4e2999){_0x2fbc94[_0x63c5('0x42')]=_0x4e2999;return _0x2fbc94;})[_0x63c5('0x23')](respondWithFilteredResult(_0x1012d1,_0x11633b))['catch'](handleError(_0x1012d1,null));};exports[_0x63c5('0x43')]=function(_0x50aeaa,_0xf9cf7d){var _0x556c9a={'raw':![],'where':{'id':_0x50aeaa['params']['id']}},_0x2beb98={};_0x2beb98[_0x63c5('0x2e')]=_[_0x63c5('0x44')](db['CmList'][_0x63c5('0x45')]);_0x2beb98[_0x63c5('0x2f')]=_[_0x63c5('0x44')](_0x50aeaa['query']);_0x2beb98['filters']=_['intersection'](_0x2beb98[_0x63c5('0x2e')],_0x2beb98[_0x63c5('0x2f')]);_0x556c9a[_0x63c5('0x32')]=_[_0x63c5('0x31')](_0x2beb98[_0x63c5('0x2e')],qs['fields'](_0x50aeaa[_0x63c5('0x2f')]['fields']));_0x556c9a['attributes']=_0x556c9a['attributes'][_0x63c5('0x46')]?_0x556c9a['attributes']:_0x2beb98[_0x63c5('0x2e')];if(_0x50aeaa[_0x63c5('0x2f')]['includeAll']){_0x556c9a[_0x63c5('0x3f')]=[{'all':!![]}];}_0x556c9a=_[_0x63c5('0x3b')]({},_0x556c9a,_0x50aeaa[_0x63c5('0x3d')]);return db['CmList']['find'](_0x556c9a)[_0x63c5('0x23')](handleEntityNotFound(_0xf9cf7d,null))[_0x63c5('0x23')](respondWithResult(_0xf9cf7d,null))[_0x63c5('0x47')](handleError(_0xf9cf7d,null));};exports[_0x63c5('0x48')]=function(_0x4c09dc,_0x5d3bbe){return db[_0x63c5('0x40')]['create'](_0x4c09dc[_0x63c5('0x49')],{})[_0x63c5('0x23')](function(_0x37a044){var _0x45f48a=_0x4c09dc[_0x63c5('0x4a')][_0x63c5('0x25')]({'plain':!![]});if(!_0x45f48a)throw new Error(_0x63c5('0x4b'));if(_0x45f48a[_0x63c5('0x4c')]===_0x63c5('0x4a')){var _0x191516=_0x37a044[_0x63c5('0x25')]({'plain':!![]});var _0x5a5331='Lists';return db[_0x63c5('0x4d')][_0x63c5('0x4e')]({'where':{'name':_0x5a5331,'userProfileId':_0x45f48a[_0x63c5('0x4f')]},'raw':!![]})[_0x63c5('0x23')](function(_0x1b6f2d){if(_0x1b6f2d&&_0x1b6f2d[_0x63c5('0x50')]===0x0){return db[_0x63c5('0x51')][_0x63c5('0x48')]({'name':_0x191516[_0x63c5('0x29')],'resourceId':_0x191516['id'],'type':_0x1b6f2d['name'],'sectionId':_0x1b6f2d['id']},{})[_0x63c5('0x23')](function(){return _0x37a044;});}else{return _0x37a044;}})[_0x63c5('0x47')](function(_0x8caefd){logger[_0x63c5('0x27')](_0x63c5('0x52'),_0x8caefd);throw _0x8caefd;});}return _0x37a044;})['then'](respondWithResult(_0x5d3bbe,0xc9))['catch'](handleError(_0x5d3bbe,null));};exports[_0x63c5('0x22')]=function(_0x7712f0,_0x28ca34){if(_0x7712f0[_0x63c5('0x49')]['id']){delete _0x7712f0[_0x63c5('0x49')]['id'];}return db[_0x63c5('0x40')][_0x63c5('0x4e')]({'where':{'id':_0x7712f0[_0x63c5('0x53')]['id']}})[_0x63c5('0x23')](handleEntityNotFound(_0x28ca34,null))['then'](saveUpdates(_0x7712f0[_0x63c5('0x49')],null))['then'](respondWithResult(_0x28ca34,null))[_0x63c5('0x47')](handleError(_0x28ca34,null));};exports[_0x63c5('0x24')]=function(_0x22cf49,_0x594717){return db[_0x63c5('0x40')]['find']({'where':{'id':_0x22cf49[_0x63c5('0x53')]['id']}})[_0x63c5('0x23')](handleEntityNotFound(_0x594717,null))[_0x63c5('0x23')](removeEntity(_0x594717,null))['catch'](handleError(_0x594717,null));};exports[_0x63c5('0x54')]=function(_0x6f56c1,_0x2a624d){return db['CmList'][_0x63c5('0x54')]()['then'](respondWithResult(_0x2a624d,null))[_0x63c5('0x47')](handleError(_0x2a624d,null));};exports[_0x63c5('0x55')]=function(_0xdaf193,_0xf9c10a,_0x40ae34){if(_0xdaf193[_0x63c5('0x49')]['id']){delete _0xdaf193[_0x63c5('0x49')]['id'];}return db[_0x63c5('0x40')]['find']({'where':{'id':_0xdaf193[_0x63c5('0x53')]['id']}})[_0x63c5('0x23')](handleEntityNotFound(_0xf9c10a,null))[_0x63c5('0x23')](function(_0x544d50){if(_0x544d50){_0xdaf193[_0x63c5('0x49')]['ListId']=_0x544d50['id'];return db['Disposition'][_0x63c5('0x48')](_0xdaf193['body']);}})[_0x63c5('0x23')](respondWithResult(_0xf9c10a,null))[_0x63c5('0x47')](handleError(_0xf9c10a,null));};exports['getDispositions']=function(_0x464c5f,_0x17d605,_0x44ef29){var _0x4e0276={'raw':![],'where':{}};var _0x1acba7={};var _0x365008={'count':0x0,'rows':[]};return db['CmList'][_0x63c5('0x56')]({'where':{'id':_0x464c5f['params']['id']}})[_0x63c5('0x23')](handleEntityNotFound(_0x17d605,null))[_0x63c5('0x23')](function(_0x1186f2){if(_0x1186f2){_0x1acba7[_0x63c5('0x2e')]=_[_0x63c5('0x44')](db['Disposition'][_0x63c5('0x45')]);_0x1acba7[_0x63c5('0x2f')]=_[_0x63c5('0x44')](_0x464c5f[_0x63c5('0x2f')]);_0x1acba7[_0x63c5('0x30')]=_['intersection'](_0x1acba7[_0x63c5('0x2e')],_0x1acba7[_0x63c5('0x2f')]);_0x4e0276[_0x63c5('0x32')]=_[_0x63c5('0x31')](_0x1acba7[_0x63c5('0x2e')],qs[_0x63c5('0x33')](_0x464c5f[_0x63c5('0x2f')][_0x63c5('0x33')]));_0x4e0276['attributes']=_0x4e0276[_0x63c5('0x32')][_0x63c5('0x46')]?_0x4e0276[_0x63c5('0x32')]:_0x1acba7['model'];if(!_0x464c5f['query'][_0x63c5('0x34')](_0x63c5('0x35'))){_0x4e0276[_0x63c5('0x1c')]=qs['limit'](_0x464c5f[_0x63c5('0x2f')][_0x63c5('0x1c')]);_0x4e0276['offset']=qs[_0x63c5('0x1b')](_0x464c5f['query']['offset']);}_0x4e0276[_0x63c5('0x36')]=qs[_0x63c5('0x37')](_0x464c5f['query']['sort']);_0x4e0276[_0x63c5('0x38')]=qs[_0x63c5('0x30')](_['pick'](_0x464c5f['query'],_0x1acba7[_0x63c5('0x30')]));_0x4e0276[_0x63c5('0x38')][_0x63c5('0x57')]=_0x1186f2['id'];if(_0x464c5f[_0x63c5('0x2f')][_0x63c5('0x3a')]){_0x4e0276['where']=_[_0x63c5('0x3b')](_0x4e0276[_0x63c5('0x38')],{'$or':_['map'](_0x4e0276['attributes'],function(_0x5904f2){var _0x59b5e9={};_0x59b5e9[_0x5904f2]={'$like':'%'+_0x464c5f[_0x63c5('0x2f')][_0x63c5('0x3a')]+'%'};return _0x59b5e9;})});}_0x4e0276=_['merge']({},_0x4e0276,_0x464c5f[_0x63c5('0x3d')]);return db[_0x63c5('0x58')][_0x63c5('0x1a')]({'where':_0x4e0276[_0x63c5('0x38')]})[_0x63c5('0x23')](function(_0x1eb00){_0x365008[_0x63c5('0x1a')]=_0x1eb00;if(_0x464c5f[_0x63c5('0x2f')][_0x63c5('0x3e')]){_0x4e0276['include']=[{'all':!![]}];}return db[_0x63c5('0x58')][_0x63c5('0x41')](_0x4e0276);})[_0x63c5('0x23')](function(_0x2033f9){_0x365008[_0x63c5('0x42')]=_0x2033f9;return _0x365008;});}})[_0x63c5('0x23')](respondWithFilteredResult(_0x17d605,_0x4e0276))[_0x63c5('0x47')](handleError(_0x17d605,null));};exports[_0x63c5('0x59')]=function(_0x3d2bef,_0x344800,_0x17bc13){return db[_0x63c5('0x40')][_0x63c5('0x4e')]({'where':{'id':_0x3d2bef[_0x63c5('0x53')]['id']}})[_0x63c5('0x23')](handleEntityNotFound(_0x344800,null))[_0x63c5('0x23')](function(_0x41c445){if(_0x41c445){return _0x41c445[_0x63c5('0x59')](_0x3d2bef['query'][_0x63c5('0x5a')]);}})[_0x63c5('0x23')](respondWithStatusCode(_0x344800,null))[_0x63c5('0x47')](handleError(_0x344800,null));};exports['addContacts']=function(_0x383eef,_0x363af8,_0x5c1f0c){return db['CmList'][_0x63c5('0x4e')]({'where':{'id':_0x383eef[_0x63c5('0x53')]['id']}})['then'](handleEntityNotFound(_0x363af8,null))[_0x63c5('0x23')](function(_0x588861){if(_0x588861){var _0x1eac99=[];var _0x29d32e={'success':[],'errors':[]};return db[_0x63c5('0x5b')][_0x63c5('0x54')]()[_0x63c5('0x23')](function(_0x75db5d){if(_0x383eef['body'][_0x63c5('0x5c')]&&_[_0x63c5('0x5d')](_0x383eef[_0x63c5('0x49')][_0x63c5('0x5c')])){if(_0x383eef['body'][_0x63c5('0x5c')][_0x63c5('0x46')]){_0x383eef['body'][_0x63c5('0x5c')]=_0x383eef['body'][_0x63c5('0x5c')][_0x63c5('0x5e')](';')+';';}else{_0x383eef[_0x63c5('0x49')][_0x63c5('0x5c')]=null;}}else{_0x383eef[_0x63c5('0x49')]['tags']=null;}if(_0x383eef[_0x63c5('0x49')]&&_[_0x63c5('0x5d')](_0x383eef[_0x63c5('0x49')])){for(var _0x59eb00=0x0;_0x59eb00<_0x383eef[_0x63c5('0x49')]['length'];_0x59eb00+=0x1){_0x383eef[_0x63c5('0x49')][_0x59eb00]['ListId']=_0x383eef[_0x63c5('0x53')]['id'];_0x1eac99[_0x63c5('0x5f')](_0x383eef[_0x63c5('0x49')][_0x59eb00]);}return BPromise[_0x63c5('0x60')](_0x1eac99,function(_0x2c8eda){return db[_0x63c5('0x5b')][_0x63c5('0x48')](_[_0x63c5('0x61')](_0x2c8eda,[_0x63c5('0x5a'),'id'])||{},{'fields':_['keys'](_0x75db5d),'raw':!![]})[_0x63c5('0x23')](function(_0x219bee){_0x29d32e[_0x63c5('0x62')]['push'](_0x219bee[_0x63c5('0x63')]);})[_0x63c5('0x47')](function(_0x45cc12){_0x29d32e[_0x63c5('0x64')]['push']({'data':_0x2c8eda,'error':_0x45cc12[_0x63c5('0x65')]});});})[_0x63c5('0x23')](function(_0x3becec){return _0x29d32e;})['catch'](function(_0x29792f){return _0x29792f;});}else{_0x363af8[_0x63c5('0x18')](0x190)[_0x63c5('0x1e')]({'message':_0x63c5('0x66')});}});}})[_0x63c5('0x23')](respondWithResult(_0x363af8,null))[_0x63c5('0x47')](handleError(_0x363af8,null));};exports[_0x63c5('0x67')]=function(_0x19f5e6,_0xa5ca1c,_0xc615bf){var _0x21b8c9;return db['CmList'][_0x63c5('0x4e')]({'where':{'id':_0x19f5e6[_0x63c5('0x53')]['id']},'include':[{'model':db['CmCustomField'],'as':_0x63c5('0x68')}]})[_0x63c5('0x23')](handleEntityNotFound(_0xa5ca1c,null))['then'](function(_0x3967ce){if(_0x3967ce){_0x21b8c9=_0x3967ce;return db[_0x63c5('0x5b')][_0x63c5('0x45')];}})[_0x63c5('0x23')](function(_0xd1b5a0){if(_0xd1b5a0){var _0x513fee={};var _0x2300ad={};_0x2300ad[_0x63c5('0x2e')]=_[_0x63c5('0x69')](_['keys'](_0xd1b5a0),_[_0x63c5('0x2b')](_0x21b8c9[_0x63c5('0x68')],function(_0x5a0baa){return util['format'](_0x63c5('0x6a'),_0x5a0baa['id']);}));_0x2300ad[_0x63c5('0x2f')]=_[_0x63c5('0x44')](_0x19f5e6['query']);_0x2300ad[_0x63c5('0x30')]=_[_0x63c5('0x31')](_0x2300ad[_0x63c5('0x2e')],_0x2300ad[_0x63c5('0x2f')]);_0x513fee[_0x63c5('0x32')]=_[_0x63c5('0x31')](_0x2300ad[_0x63c5('0x2e')],qs[_0x63c5('0x33')](_0x19f5e6['query'][_0x63c5('0x33')]));_0x513fee['attributes']=_0x513fee['attributes'][_0x63c5('0x46')]?_0x513fee[_0x63c5('0x32')]:_0x2300ad['model'];if(!_0x19f5e6[_0x63c5('0x2f')][_0x63c5('0x34')](_0x63c5('0x35'))){_0x513fee[_0x63c5('0x1c')]=qs[_0x63c5('0x1c')](_0x19f5e6[_0x63c5('0x2f')][_0x63c5('0x1c')]);_0x513fee[_0x63c5('0x1b')]=qs[_0x63c5('0x1b')](_0x19f5e6[_0x63c5('0x2f')][_0x63c5('0x1b')]);}_0x513fee[_0x63c5('0x36')]=qs[_0x63c5('0x37')](_0x19f5e6[_0x63c5('0x2f')][_0x63c5('0x37')]);_0x513fee['where']=qs[_0x63c5('0x30')](_['pick'](_0x19f5e6[_0x63c5('0x2f')],_0x2300ad[_0x63c5('0x30')]));_0x513fee[_0x63c5('0x6b')]=!![];if(_0x19f5e6[_0x63c5('0x2f')][_0x63c5('0x3a')]){_0x513fee[_0x63c5('0x38')]=_[_0x63c5('0x3b')](_0x513fee[_0x63c5('0x38')],{'$or':_[_0x63c5('0x2b')](_0x513fee[_0x63c5('0x32')],function(_0x157d46){var _0x189037={};_0x189037[_0x157d46]={'$like':'%'+_0x19f5e6[_0x63c5('0x2f')]['filter']+'%'};return _0x189037;})});}_0x513fee=_[_0x63c5('0x3b')]({},_0x513fee,_0x19f5e6[_0x63c5('0x3d')]);return _0x21b8c9[_0x63c5('0x67')](_0x513fee);}})[_0x63c5('0x23')](respondWithResult(_0xa5ca1c,null))[_0x63c5('0x47')](handleError(_0xa5ca1c,null));};exports['getContactsCsv']=function(_0x6908b5,_0x311c69,_0x2fa7ef){var _0x3eec12;return db[_0x63c5('0x40')][_0x63c5('0x4e')]({'where':{'id':_0x6908b5['params']['id']},'include':[{'model':db[_0x63c5('0x6c')],'as':'CustomFields'}]})[_0x63c5('0x23')](handleEntityNotFound(_0x311c69,null))[_0x63c5('0x23')](function(_0x48ebfd){if(_0x48ebfd){_0x3eec12=_0x48ebfd;return db[_0x63c5('0x5b')]['rawAttributes'];}})[_0x63c5('0x23')](function(_0x2f372d){if(_0x2f372d){var _0x10be43={};var _0x412a4d={};_0x412a4d['model']=_[_0x63c5('0x69')](_[_0x63c5('0x44')](_0x2f372d),_[_0x63c5('0x2b')](_0x3eec12[_0x63c5('0x68')],function(_0x293979){return util[_0x63c5('0x6d')]('cf_%d',_0x293979['id']);}));_0x412a4d[_0x63c5('0x2f')]=_[_0x63c5('0x44')](_0x6908b5[_0x63c5('0x2f')]);_0x412a4d[_0x63c5('0x30')]=_['intersection'](_0x412a4d[_0x63c5('0x2e')],_0x412a4d[_0x63c5('0x2f')]);_0x10be43[_0x63c5('0x32')]=_[_0x63c5('0x31')](_0x412a4d['model'],qs['fields'](_0x6908b5['query'][_0x63c5('0x33')]));_0x10be43['attributes']=_0x10be43[_0x63c5('0x32')][_0x63c5('0x46')]?_0x10be43[_0x63c5('0x32')]:_0x412a4d[_0x63c5('0x2e')];if(!_0x6908b5[_0x63c5('0x2f')]['hasOwnProperty'](_0x63c5('0x35'))){_0x10be43[_0x63c5('0x1c')]=qs[_0x63c5('0x1c')](_0x6908b5[_0x63c5('0x2f')][_0x63c5('0x1c')]);_0x10be43[_0x63c5('0x1b')]=qs[_0x63c5('0x1b')](_0x6908b5[_0x63c5('0x2f')]['offset']);}_0x10be43['order']=qs[_0x63c5('0x37')](_0x6908b5[_0x63c5('0x2f')][_0x63c5('0x37')]);_0x10be43[_0x63c5('0x38')]=qs['filters'](_[_0x63c5('0x39')](_0x6908b5[_0x63c5('0x2f')],_0x412a4d[_0x63c5('0x30')]));_0x10be43[_0x63c5('0x6b')]=!![];if(_0x6908b5[_0x63c5('0x2f')]['filter']){_0x10be43['where']=_[_0x63c5('0x3b')](_0x10be43[_0x63c5('0x38')],{'$or':_['map'](_0x10be43['attributes'],function(_0x1598b4){var _0x3485aa={};_0x3485aa[_0x1598b4]={'$like':'%'+_0x6908b5[_0x63c5('0x2f')][_0x63c5('0x3a')]+'%'};return _0x3485aa;})});}_0x10be43=_['merge']({},_0x10be43,_0x6908b5['options']);return _0x3eec12[_0x63c5('0x67')](_0x10be43);}})['then'](function(_0x19bd5f){if(!_[_0x63c5('0x6e')](_0x19bd5f)){var _0x59dacd=toCsv(_0x19bd5f);var _0x243911=Date['now']();fs['writeFileSync'](util[_0x63c5('0x6d')](_0x63c5('0x6f'),_0x3eec12['id'],_0x243911),_0x59dacd);_0x311c69[_0x63c5('0x70')](_0x63c5('0x71'),_0x63c5('0x72')+util[_0x63c5('0x6d')]('list_%d_%s.csv',_0x3eec12['id'],_0x243911));_0x311c69['setHeader']('Content-type',_0x63c5('0x73'));return _0x311c69['download'](util[_0x63c5('0x6d')](_0x63c5('0x6f'),_0x3eec12['id'],_0x243911));}else{return _0x311c69['sendStatus'](0xcc);}})['catch'](handleError(_0x311c69,null));};exports['addCustomField']=function(_0x29db3d,_0x3b5e74,_0x3f197f){var _0x187b8a;delete _0x29db3d['body']['id'];return db[_0x63c5('0x40')][_0x63c5('0x56')]({'where':{'id':_0x29db3d[_0x63c5('0x53')]['id']}})[_0x63c5('0x23')](handleEntityNotFound(_0x3b5e74,null))[_0x63c5('0x23')](function(_0x1fe5c6){if(_0x1fe5c6){return db[_0x63c5('0x74')]['transaction'](function(_0xca3572){return db[_0x63c5('0x6c')][_0x63c5('0x48')](_0x29db3d[_0x63c5('0x49')],{'transaction':_0xca3572})[_0x63c5('0x23')](function(_0x148465){_0x187b8a=_0x148465;return _0x1fe5c6[_0x63c5('0x75')](_0x148465,{'transaction':_0xca3572});})[_0x63c5('0x23')](function(){var _0x47b3c5={'type':db[_0x63c5('0x76')][_0x63c5('0x77')],'transaction':_0xca3572};switch(_0x29db3d[_0x63c5('0x49')][_0x63c5('0x2c')]){case _0x63c5('0x78'):_0x47b3c5[_0x63c5('0x2c')]=db[_0x63c5('0x76')][_0x63c5('0x77')];break;case _0x63c5('0x79'):_0x47b3c5[_0x63c5('0x2c')]=db[_0x63c5('0x76')][_0x63c5('0x7a')];break;case _0x63c5('0x7b'):_0x47b3c5[_0x63c5('0x2c')]=db['Sequelize'][_0x63c5('0x7c')];_0x47b3c5[_0x63c5('0x7d')]=![];break;default:}return db[_0x63c5('0x74')][_0x63c5('0x7e')][_0x63c5('0x7f')](_0x63c5('0x80'),util['format']('cf_%s',_0x187b8a['id']),_0x47b3c5);})[_0x63c5('0x23')](function(){return _0x187b8a;});});}})[_0x63c5('0x23')](respondWithResult(_0x3b5e74,null))[_0x63c5('0x47')](handleError(_0x3b5e74,null));};exports['getCustomFields']=function(_0x119e0e,_0x7f5e5b,_0x30b9b7){var _0x17e744={};var _0x5a3193={};var _0xb8c521;var _0x25e228;return db[_0x63c5('0x40')][_0x63c5('0x56')]({'where':{'id':_0x119e0e[_0x63c5('0x53')]['id']}})[_0x63c5('0x23')](handleEntityNotFound(_0x7f5e5b,null))[_0x63c5('0x23')](function(_0x2b05b8){if(_0x2b05b8){_0xb8c521=_0x2b05b8;_0x5a3193[_0x63c5('0x2e')]=_[_0x63c5('0x44')](db[_0x63c5('0x6c')][_0x63c5('0x45')]);_0x5a3193[_0x63c5('0x2f')]=_[_0x63c5('0x44')](_0x119e0e['query']);_0x5a3193[_0x63c5('0x30')]=_[_0x63c5('0x31')](_0x5a3193[_0x63c5('0x2e')],_0x5a3193[_0x63c5('0x2f')]);_0x17e744[_0x63c5('0x32')]=_[_0x63c5('0x31')](_0x5a3193[_0x63c5('0x2e')],qs[_0x63c5('0x33')](_0x119e0e[_0x63c5('0x2f')]['fields']));_0x17e744[_0x63c5('0x32')]=_0x17e744[_0x63c5('0x32')]['length']?_0x17e744[_0x63c5('0x32')]:_0x5a3193[_0x63c5('0x2e')];_0x17e744['order']=qs[_0x63c5('0x37')](_0x119e0e[_0x63c5('0x2f')][_0x63c5('0x37')]);_0x17e744[_0x63c5('0x38')]=qs[_0x63c5('0x30')](_[_0x63c5('0x39')](_0x119e0e['query'],_0x5a3193[_0x63c5('0x30')]));_0x17e744[_0x63c5('0x38')]=_[_0x63c5('0x3b')](_0x17e744['where'],{'$or':[{'ListId':_0x2b05b8['id']},{'ListId':null}]});if(_0x119e0e['query'][_0x63c5('0x3a')]){_0x17e744[_0x63c5('0x38')]=_[_0x63c5('0x3b')](_0x17e744[_0x63c5('0x38')],{'$or':_[_0x63c5('0x2b')](_0x17e744[_0x63c5('0x32')],function(_0xc5566){var _0x14704f={};_0x14704f[_0xc5566]={'$like':'%'+_0x119e0e[_0x63c5('0x2f')]['filter']+'%'};return _0x14704f;})});}_0x17e744=_[_0x63c5('0x3b')]({},_0x17e744,_0x119e0e['options']);return db[_0x63c5('0x6c')][_0x63c5('0x81')](_0x17e744);}})['then'](respondWithResult(_0x7f5e5b,null))['catch'](handleError(_0x7f5e5b,null));};exports[_0x63c5('0x82')]=function(_0x59ca75,_0x8235cc,_0x540aac){return db[_0x63c5('0x40')]['find']({'where':{'id':_0x59ca75['params']['id']}})[_0x63c5('0x23')](handleEntityNotFound(_0x8235cc,null))[_0x63c5('0x23')](function(_0x1e1f2f){if(_0x1e1f2f){return _0x1e1f2f[_0x63c5('0x82')](_0x59ca75[_0x63c5('0x49')][_0x63c5('0x5a')],_[_0x63c5('0x61')](_0x59ca75['body'],[_0x63c5('0x5a'),'id'])||{})[_0x63c5('0x83')](function(_0x5c9627){for(var _0x5b5569=0x0;_0x5b5569<_0x59ca75[_0x63c5('0x49')][_0x63c5('0x5a')][_0x63c5('0x46')];_0x5b5569+=0x1){socket[_0x63c5('0x84')](_0x63c5('0x85'),{'UserId':_0x59ca75[_0x63c5('0x49')][_0x63c5('0x5a')][_0x5b5569],'CmListId':_0x59ca75[_0x63c5('0x53')]['id']});}return _0x5c9627;});}})[_0x63c5('0x23')](respondWithResult(_0x8235cc,null))[_0x63c5('0x47')](handleError(_0x8235cc,null));};exports[_0x63c5('0x86')]=function(_0x53b0f1,_0x33bdc6,_0x823a75){return db[_0x63c5('0x40')][_0x63c5('0x4e')]({'where':{'id':_0x53b0f1[_0x63c5('0x53')]['id']}})['then'](handleEntityNotFound(_0x33bdc6,null))[_0x63c5('0x23')](function(_0x394bef){if(_0x394bef){return _0x394bef[_0x63c5('0x86')](_0x53b0f1[_0x63c5('0x2f')][_0x63c5('0x5a')])[_0x63c5('0x23')](function(){if(_[_0x63c5('0x5d')](_0x53b0f1['query']['ids'])){for(var _0x165277=0x0;_0x165277<_0x53b0f1[_0x63c5('0x2f')][_0x63c5('0x5a')]['length'];_0x165277+=0x1){socket[_0x63c5('0x84')](_0x63c5('0x87'),{'UserId':Number(_0x53b0f1[_0x63c5('0x2f')][_0x63c5('0x5a')][_0x165277]),'CmListId':Number(_0x53b0f1[_0x63c5('0x53')]['id'])});}}else{socket['emit'](_0x63c5('0x87'),{'UserId':Number(_0x53b0f1['query'][_0x63c5('0x5a')]),'CmListId':Number(_0x53b0f1[_0x63c5('0x53')]['id'])});}});}})[_0x63c5('0x23')](respondWithStatusCode(_0x33bdc6,null))['catch'](handleError(_0x33bdc6,null));};exports['getAgents']=function(_0x52cdc4,_0x17177b,_0x440faa){var _0x16fcee={};var _0x26b06a={};var _0x392e1e;var _0x384473;return db[_0x63c5('0x40')][_0x63c5('0x56')]({'where':{'id':_0x52cdc4[_0x63c5('0x53')]['id']}})[_0x63c5('0x23')](handleEntityNotFound(_0x17177b,null))[_0x63c5('0x23')](function(_0x2c23ff){if(_0x2c23ff){_0x392e1e=_0x2c23ff;_0x26b06a[_0x63c5('0x2e')]=_[_0x63c5('0x44')](db[_0x63c5('0x88')][_0x63c5('0x45')]);_0x26b06a[_0x63c5('0x2f')]=_[_0x63c5('0x44')](_0x52cdc4[_0x63c5('0x2f')]);_0x26b06a[_0x63c5('0x30')]=_[_0x63c5('0x31')](_0x26b06a[_0x63c5('0x2e')],_0x26b06a[_0x63c5('0x2f')]);_0x16fcee[_0x63c5('0x32')]=_[_0x63c5('0x31')](_0x26b06a[_0x63c5('0x2e')],qs[_0x63c5('0x33')](_0x52cdc4['query']['fields']));_0x16fcee['attributes']=_0x16fcee[_0x63c5('0x32')]['length']?_0x16fcee[_0x63c5('0x32')]:_0x26b06a['model'];_0x16fcee[_0x63c5('0x36')]=qs[_0x63c5('0x37')](_0x52cdc4[_0x63c5('0x2f')][_0x63c5('0x37')]);_0x16fcee[_0x63c5('0x38')]=qs[_0x63c5('0x30')](_[_0x63c5('0x39')](_0x52cdc4[_0x63c5('0x2f')],_0x26b06a[_0x63c5('0x30')]));if(_0x52cdc4[_0x63c5('0x2f')][_0x63c5('0x3a')]){_0x16fcee[_0x63c5('0x38')]=_[_0x63c5('0x3b')](_0x16fcee[_0x63c5('0x38')],{'$or':_[_0x63c5('0x2b')](_0x16fcee[_0x63c5('0x32')],function(_0x4c8496){var _0x382000={};_0x382000[_0x4c8496]={'$like':'%'+_0x52cdc4[_0x63c5('0x2f')][_0x63c5('0x3a')]+'%'};return _0x382000;})});}_0x16fcee=_[_0x63c5('0x3b')]({},_0x16fcee,_0x52cdc4[_0x63c5('0x3d')]);return _0x392e1e['getAgents'](_0x16fcee);}})[_0x63c5('0x23')](function(_0x266cb4){if(_0x266cb4){_0x384473=_0x266cb4[_0x63c5('0x46')];if(!_0x52cdc4[_0x63c5('0x2f')][_0x63c5('0x34')](_0x63c5('0x35'))){_0x16fcee['limit']=qs[_0x63c5('0x1c')](_0x52cdc4[_0x63c5('0x2f')]['limit']);_0x16fcee[_0x63c5('0x1b')]=qs[_0x63c5('0x1b')](_0x52cdc4[_0x63c5('0x2f')]['offset']);}return _0x392e1e[_0x63c5('0x89')](_0x16fcee);}})[_0x63c5('0x23')](function(_0x33cf77){if(_0x33cf77){return _0x33cf77?{'count':_0x384473,'rows':_0x33cf77}:null;}})[_0x63c5('0x23')](respondWithResult(_0x17177b,null))[_0x63c5('0x47')](handleError(_0x17177b,null));}; \ No newline at end of file +var _0x7e78=['request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','sendStatus','status','json','count','offset','Content-Range','apply','reject','save','then','destroy','end','stack','name','send','index','CmList','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','fields','length','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Lists','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','ListId','getDispositions','findOne','Disposition','removeDispositions','ids','addContacts','CmContact','tags','join','isArray','each','omit','success','push','dataValues','errors','message','getContacts','CmCustomField','CustomFields','concat','format','cf_%d','order','raw','isEmpty','now','setHeader','Content-disposition','list_%d_%s.csv','Content-type','text/csv','download','addCustomField','sequelize','transaction','addCustomFields','Sequelize','number','INTEGER','BOOLEAN','queryInterface','cm_contacts','getCustomFields','findAndCountAll','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','eml-format','zip-dir','fast-json-patch'];(function(_0xd47da8,_0x8148e5){var _0x4ebb63=function(_0x5dbced){while(--_0x5dbced){_0xd47da8['push'](_0xd47da8['shift']());}};_0x4ebb63(++_0x8148e5);}(_0x7e78,0x8f));var _0x87e7=function(_0x1374a6,_0x4f174d){_0x1374a6=_0x1374a6-0x0;var _0x198a9f=_0x7e78[_0x1374a6];return _0x198a9f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x87e7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x87e7('0x1'));var jsonpatch=require(_0x87e7('0x2'));var rp=require(_0x87e7('0x3'));var moment=require(_0x87e7('0x4'));var BPromise=require(_0x87e7('0x5'));var Mustache=require(_0x87e7('0x6'));var util=require(_0x87e7('0x7'));var path=require(_0x87e7('0x8'));var sox=require(_0x87e7('0x9'));var csv=require(_0x87e7('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x87e7('0xb'));var squel=require(_0x87e7('0xc'));var crypto=require(_0x87e7('0xd'));var jsforce=require(_0x87e7('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x87e7('0xa'));var querystring=require(_0x87e7('0xf'));var Papa=require('papaparse');var Redis=require(_0x87e7('0x10'));var authService=require(_0x87e7('0x11'));var qs=require(_0x87e7('0x12'));var as=require(_0x87e7('0x13'));var hardwareService=require(_0x87e7('0x14'));var logger=require('../../config/logger')(_0x87e7('0x15'));var utils=require(_0x87e7('0x16'));var config=require('../../config/environment');var db=require(_0x87e7('0x17'))['db'];config[_0x87e7('0x18')]=_[_0x87e7('0x19')](config[_0x87e7('0x18')],{'host':_0x87e7('0x1a'),'port':0x18eb});var socket=require(_0x87e7('0x1b'))(new Redis(config[_0x87e7('0x18')]));require(_0x87e7('0x1c'))[_0x87e7('0x1d')](socket);function respondWithStatusCode(_0x3b0bb1,_0x19cb2d){_0x19cb2d=_0x19cb2d||0xcc;return function(_0x34e568){if(_0x34e568){return _0x3b0bb1[_0x87e7('0x1e')](_0x19cb2d);}return _0x3b0bb1[_0x87e7('0x1f')](_0x19cb2d)['end']();};}function respondWithResult(_0xe793c2,_0x4a967d){_0x4a967d=_0x4a967d||0xc8;return function(_0x2ee791){if(_0x2ee791){return _0xe793c2[_0x87e7('0x1f')](_0x4a967d)[_0x87e7('0x20')](_0x2ee791);}};}function respondWithFilteredResult(_0x4058f0,_0x4e1799){return function(_0x47122e){if(_0x47122e){var _0x22739d=_0x47122e[_0x87e7('0x21')],_0x4280b2=_0x4e1799[_0x87e7('0x22')],_0x3c522d=_0x4e1799[_0x87e7('0x22')]+_0x4e1799['limit'],_0x2c23c8;if(_0x3c522d>=_0x22739d){_0x3c522d=_0x22739d;_0x2c23c8=0xc8;}else{_0x2c23c8=0xce;}_0x4058f0['status'](_0x2c23c8);return _0x4058f0['set'](_0x87e7('0x23'),_0x4280b2+'-'+_0x3c522d+'/'+_0x22739d)['json'](_0x47122e);}return null;};}function patchUpdates(_0x24dbc2){return function(_0x3ee3c9){try{jsonpatch[_0x87e7('0x24')](_0x3ee3c9,_0x24dbc2,!![]);}catch(_0x43b2b5){return BPromise[_0x87e7('0x25')](_0x43b2b5);}return _0x3ee3c9[_0x87e7('0x26')]();};}function saveUpdates(_0x562edc,_0x281bf1){return function(_0x190be2){if(_0x190be2){return _0x190be2['update'](_0x562edc)[_0x87e7('0x27')](function(_0x12bcfb){return _0x12bcfb;});}return null;};}function removeEntity(_0x3432cb,_0x3e89c2){return function(_0x4fe592){if(_0x4fe592){return _0x4fe592[_0x87e7('0x28')]()[_0x87e7('0x27')](function(){var _0xa9ab6c=_0x4fe592['get']({'plain':!![]});var _0xa079e0='Lists';return db['UserProfileResource'][_0x87e7('0x28')]({'where':{'type':_0xa079e0,'resourceId':_0xa9ab6c['id']}})[_0x87e7('0x27')](function(){return _0x4fe592;});})['then'](function(){_0x3432cb[_0x87e7('0x1f')](0xcc)[_0x87e7('0x29')]();});}};}function handleEntityNotFound(_0x300a6e,_0x37eb62){return function(_0x1634c4){if(!_0x1634c4){_0x300a6e[_0x87e7('0x1e')](0x194);}return _0x1634c4;};}function handleError(_0x4bb28d,_0x3f3082){_0x3f3082=_0x3f3082||0x1f4;return function(_0x35a1ca){logger['error'](_0x35a1ca[_0x87e7('0x2a')]);if(_0x35a1ca[_0x87e7('0x2b')]){delete _0x35a1ca[_0x87e7('0x2b')];}_0x4bb28d[_0x87e7('0x1f')](_0x3f3082)[_0x87e7('0x2c')](_0x35a1ca);};}exports[_0x87e7('0x2d')]=function(_0x3bf712,_0x315413){var _0x4271a0={},_0x1e5c01={},_0x198173={'count':0x0,'rows':[]};var _0x577037=_['map'](db[_0x87e7('0x2e')][_0x87e7('0x2f')],function(_0x25053c){return{'name':_0x25053c[_0x87e7('0x30')],'type':_0x25053c['type'][_0x87e7('0x31')]};});_0x1e5c01[_0x87e7('0x32')]=_[_0x87e7('0x33')](_0x577037,_0x87e7('0x2b'));_0x1e5c01[_0x87e7('0x34')]=_[_0x87e7('0x35')](_0x3bf712[_0x87e7('0x34')]);_0x1e5c01[_0x87e7('0x36')]=_[_0x87e7('0x37')](_0x1e5c01[_0x87e7('0x32')],_0x1e5c01[_0x87e7('0x34')]);_0x4271a0[_0x87e7('0x38')]=_[_0x87e7('0x37')](_0x1e5c01['model'],qs['fields'](_0x3bf712['query']['fields']));_0x4271a0['attributes']=_0x4271a0[_0x87e7('0x38')]['length']?_0x4271a0[_0x87e7('0x38')]:_0x1e5c01[_0x87e7('0x32')];if(!_0x3bf712[_0x87e7('0x34')][_0x87e7('0x39')](_0x87e7('0x3a'))){_0x4271a0['limit']=qs[_0x87e7('0x3b')](_0x3bf712[_0x87e7('0x34')][_0x87e7('0x3b')]);_0x4271a0['offset']=qs[_0x87e7('0x22')](_0x3bf712[_0x87e7('0x34')][_0x87e7('0x22')]);}_0x4271a0['order']=qs[_0x87e7('0x3c')](_0x3bf712[_0x87e7('0x34')]['sort']);_0x4271a0[_0x87e7('0x3d')]=qs[_0x87e7('0x36')](_[_0x87e7('0x3e')](_0x3bf712['query'],_0x1e5c01['filters']),_0x577037);if(_0x3bf712[_0x87e7('0x34')][_0x87e7('0x3f')]){_0x4271a0[_0x87e7('0x3d')]=_[_0x87e7('0x40')](_0x4271a0[_0x87e7('0x3d')],{'$or':_[_0x87e7('0x33')](_0x577037,function(_0x1cf31b){if(_0x1cf31b[_0x87e7('0x41')]!==_0x87e7('0x42')){var _0x5bd064={};_0x5bd064[_0x1cf31b[_0x87e7('0x2b')]]={'$like':'%'+_0x3bf712['query'][_0x87e7('0x3f')]+'%'};return _0x5bd064;}})});}_0x4271a0=_[_0x87e7('0x40')]({},_0x4271a0,_0x3bf712[_0x87e7('0x43')]);var _0x1533e9={'where':_0x4271a0[_0x87e7('0x3d')]};return db[_0x87e7('0x2e')][_0x87e7('0x21')](_0x1533e9)[_0x87e7('0x27')](function(_0x587257){_0x198173['count']=_0x587257;if(_0x3bf712[_0x87e7('0x34')][_0x87e7('0x44')]){_0x4271a0[_0x87e7('0x45')]=[{'all':!![]}];}return db['CmList'][_0x87e7('0x46')](_0x4271a0);})['then'](function(_0x51cf62){_0x198173[_0x87e7('0x47')]=_0x51cf62;return _0x198173;})[_0x87e7('0x27')](respondWithFilteredResult(_0x315413,_0x4271a0))[_0x87e7('0x48')](handleError(_0x315413,null));};exports[_0x87e7('0x49')]=function(_0x590303,_0x4ab2f6){var _0x3bc381={'raw':![],'where':{'id':_0x590303[_0x87e7('0x4a')]['id']}},_0x5db6b0={};_0x5db6b0[_0x87e7('0x32')]=_[_0x87e7('0x35')](db['CmList']['rawAttributes']);_0x5db6b0[_0x87e7('0x34')]=_[_0x87e7('0x35')](_0x590303[_0x87e7('0x34')]);_0x5db6b0[_0x87e7('0x36')]=_[_0x87e7('0x37')](_0x5db6b0[_0x87e7('0x32')],_0x5db6b0['query']);_0x3bc381['attributes']=_[_0x87e7('0x37')](_0x5db6b0[_0x87e7('0x32')],qs[_0x87e7('0x4b')](_0x590303[_0x87e7('0x34')][_0x87e7('0x4b')]));_0x3bc381['attributes']=_0x3bc381[_0x87e7('0x38')][_0x87e7('0x4c')]?_0x3bc381[_0x87e7('0x38')]:_0x5db6b0[_0x87e7('0x32')];if(_0x590303[_0x87e7('0x34')][_0x87e7('0x44')]){_0x3bc381['include']=[{'all':!![]}];}_0x3bc381=_[_0x87e7('0x40')]({},_0x3bc381,_0x590303[_0x87e7('0x43')]);return db['CmList'][_0x87e7('0x4d')](_0x3bc381)[_0x87e7('0x27')](handleEntityNotFound(_0x4ab2f6,null))[_0x87e7('0x27')](respondWithResult(_0x4ab2f6,null))[_0x87e7('0x48')](handleError(_0x4ab2f6,null));};exports[_0x87e7('0x4e')]=function(_0x5d5681,_0x5ede4a){return db['CmList'][_0x87e7('0x4e')](_0x5d5681[_0x87e7('0x4f')],{})[_0x87e7('0x27')](function(_0x42cc1c){var _0x2d0a95=_0x5d5681[_0x87e7('0x50')][_0x87e7('0x51')]({'plain':!![]});if(!_0x2d0a95)throw new Error(_0x87e7('0x52'));if(_0x2d0a95[_0x87e7('0x53')]===_0x87e7('0x50')){var _0x255f54=_0x42cc1c[_0x87e7('0x51')]({'plain':!![]});var _0x47f22b=_0x87e7('0x54');return db['UserProfileSection'][_0x87e7('0x4d')]({'where':{'name':_0x47f22b,'userProfileId':_0x2d0a95[_0x87e7('0x55')]},'raw':!![]})['then'](function(_0x2ce026){if(_0x2ce026&&_0x2ce026[_0x87e7('0x56')]===0x0){return db[_0x87e7('0x57')]['create']({'name':_0x255f54['name'],'resourceId':_0x255f54['id'],'type':_0x2ce026[_0x87e7('0x2b')],'sectionId':_0x2ce026['id']},{})[_0x87e7('0x27')](function(){return _0x42cc1c;});}else{return _0x42cc1c;}})['catch'](function(_0x224bc7){logger['error'](_0x87e7('0x58'),_0x224bc7);throw _0x224bc7;});}return _0x42cc1c;})[_0x87e7('0x27')](respondWithResult(_0x5ede4a,0xc9))['catch'](handleError(_0x5ede4a,null));};exports[_0x87e7('0x59')]=function(_0x2d75c6,_0x4945ad){if(_0x2d75c6['body']['id']){delete _0x2d75c6[_0x87e7('0x4f')]['id'];}return db['CmList'][_0x87e7('0x4d')]({'where':{'id':_0x2d75c6[_0x87e7('0x4a')]['id']}})[_0x87e7('0x27')](handleEntityNotFound(_0x4945ad,null))[_0x87e7('0x27')](saveUpdates(_0x2d75c6[_0x87e7('0x4f')],null))['then'](respondWithResult(_0x4945ad,null))['catch'](handleError(_0x4945ad,null));};exports[_0x87e7('0x28')]=function(_0x341339,_0x3abe4e){return db[_0x87e7('0x2e')]['find']({'where':{'id':_0x341339[_0x87e7('0x4a')]['id']}})[_0x87e7('0x27')](handleEntityNotFound(_0x3abe4e,null))['then'](removeEntity(_0x3abe4e,null))[_0x87e7('0x48')](handleError(_0x3abe4e,null));};exports[_0x87e7('0x5a')]=function(_0x4bcc8c,_0x11111f){return db[_0x87e7('0x2e')][_0x87e7('0x5a')]()[_0x87e7('0x27')](respondWithResult(_0x11111f,null))[_0x87e7('0x48')](handleError(_0x11111f,null));};exports[_0x87e7('0x5b')]=function(_0x11af5e,_0x1c1c08,_0x3a9428){if(_0x11af5e[_0x87e7('0x4f')]['id']){delete _0x11af5e[_0x87e7('0x4f')]['id'];}return db[_0x87e7('0x2e')][_0x87e7('0x4d')]({'where':{'id':_0x11af5e['params']['id']}})[_0x87e7('0x27')](handleEntityNotFound(_0x1c1c08,null))[_0x87e7('0x27')](function(_0x2ab882){if(_0x2ab882){_0x11af5e['body'][_0x87e7('0x5c')]=_0x2ab882['id'];return db['Disposition']['create'](_0x11af5e[_0x87e7('0x4f')]);}})[_0x87e7('0x27')](respondWithResult(_0x1c1c08,null))[_0x87e7('0x48')](handleError(_0x1c1c08,null));};exports[_0x87e7('0x5d')]=function(_0x64040,_0x7c6498,_0x217e6e){var _0x55e8b2={'raw':![],'where':{}};var _0x37c9fc={};var _0x4eb617={'count':0x0,'rows':[]};return db[_0x87e7('0x2e')][_0x87e7('0x5e')]({'where':{'id':_0x64040[_0x87e7('0x4a')]['id']}})[_0x87e7('0x27')](handleEntityNotFound(_0x7c6498,null))[_0x87e7('0x27')](function(_0x429c44){if(_0x429c44){_0x37c9fc['model']=_[_0x87e7('0x35')](db[_0x87e7('0x5f')][_0x87e7('0x2f')]);_0x37c9fc[_0x87e7('0x34')]=_[_0x87e7('0x35')](_0x64040[_0x87e7('0x34')]);_0x37c9fc[_0x87e7('0x36')]=_[_0x87e7('0x37')](_0x37c9fc[_0x87e7('0x32')],_0x37c9fc[_0x87e7('0x34')]);_0x55e8b2[_0x87e7('0x38')]=_[_0x87e7('0x37')](_0x37c9fc['model'],qs[_0x87e7('0x4b')](_0x64040[_0x87e7('0x34')][_0x87e7('0x4b')]));_0x55e8b2[_0x87e7('0x38')]=_0x55e8b2[_0x87e7('0x38')]['length']?_0x55e8b2['attributes']:_0x37c9fc[_0x87e7('0x32')];if(!_0x64040[_0x87e7('0x34')][_0x87e7('0x39')]('nolimit')){_0x55e8b2[_0x87e7('0x3b')]=qs[_0x87e7('0x3b')](_0x64040['query'][_0x87e7('0x3b')]);_0x55e8b2[_0x87e7('0x22')]=qs[_0x87e7('0x22')](_0x64040[_0x87e7('0x34')]['offset']);}_0x55e8b2['order']=qs[_0x87e7('0x3c')](_0x64040['query'][_0x87e7('0x3c')]);_0x55e8b2[_0x87e7('0x3d')]=qs['filters'](_['pick'](_0x64040[_0x87e7('0x34')],_0x37c9fc[_0x87e7('0x36')]));_0x55e8b2[_0x87e7('0x3d')][_0x87e7('0x5c')]=_0x429c44['id'];if(_0x64040[_0x87e7('0x34')][_0x87e7('0x3f')]){_0x55e8b2[_0x87e7('0x3d')]=_[_0x87e7('0x40')](_0x55e8b2[_0x87e7('0x3d')],{'$or':_[_0x87e7('0x33')](_0x55e8b2[_0x87e7('0x38')],function(_0x212909){var _0x57722f={};_0x57722f[_0x212909]={'$like':'%'+_0x64040['query'][_0x87e7('0x3f')]+'%'};return _0x57722f;})});}_0x55e8b2=_[_0x87e7('0x40')]({},_0x55e8b2,_0x64040[_0x87e7('0x43')]);return db[_0x87e7('0x5f')][_0x87e7('0x21')]({'where':_0x55e8b2['where']})[_0x87e7('0x27')](function(_0x14ca64){_0x4eb617[_0x87e7('0x21')]=_0x14ca64;if(_0x64040[_0x87e7('0x34')]['includeAll']){_0x55e8b2[_0x87e7('0x45')]=[{'all':!![]}];}return db[_0x87e7('0x5f')][_0x87e7('0x46')](_0x55e8b2);})['then'](function(_0x5a7495){_0x4eb617['rows']=_0x5a7495;return _0x4eb617;});}})[_0x87e7('0x27')](respondWithFilteredResult(_0x7c6498,_0x55e8b2))['catch'](handleError(_0x7c6498,null));};exports[_0x87e7('0x60')]=function(_0x4d6ae1,_0x3f7fa2,_0xa8f5dc){return db[_0x87e7('0x2e')][_0x87e7('0x4d')]({'where':{'id':_0x4d6ae1[_0x87e7('0x4a')]['id']}})[_0x87e7('0x27')](handleEntityNotFound(_0x3f7fa2,null))[_0x87e7('0x27')](function(_0xe2fd08){if(_0xe2fd08){return _0xe2fd08[_0x87e7('0x60')](_0x4d6ae1[_0x87e7('0x34')][_0x87e7('0x61')]);}})[_0x87e7('0x27')](respondWithStatusCode(_0x3f7fa2,null))[_0x87e7('0x48')](handleError(_0x3f7fa2,null));};exports[_0x87e7('0x62')]=function(_0x11141a,_0x15943c,_0x3aa66a){return db['CmList'][_0x87e7('0x4d')]({'where':{'id':_0x11141a['params']['id']}})['then'](handleEntityNotFound(_0x15943c,null))['then'](function(_0x10e4f3){if(_0x10e4f3){var _0x145090=[];var _0x25cad5={'success':[],'errors':[]};return db[_0x87e7('0x63')]['describe']()[_0x87e7('0x27')](function(_0xdb3cc9){if(_0x11141a[_0x87e7('0x4f')][_0x87e7('0x64')]&&_['isArray'](_0x11141a[_0x87e7('0x4f')][_0x87e7('0x64')])){if(_0x11141a[_0x87e7('0x4f')][_0x87e7('0x64')][_0x87e7('0x4c')]){_0x11141a[_0x87e7('0x4f')]['tags']=_0x11141a[_0x87e7('0x4f')][_0x87e7('0x64')][_0x87e7('0x65')](';')+';';}else{_0x11141a[_0x87e7('0x4f')][_0x87e7('0x64')]=null;}}else{_0x11141a[_0x87e7('0x4f')][_0x87e7('0x64')]=null;}if(_0x11141a['body']&&_[_0x87e7('0x66')](_0x11141a[_0x87e7('0x4f')])){for(var _0x29c5fb=0x0;_0x29c5fb<_0x11141a[_0x87e7('0x4f')][_0x87e7('0x4c')];_0x29c5fb+=0x1){_0x11141a[_0x87e7('0x4f')][_0x29c5fb][_0x87e7('0x5c')]=_0x11141a[_0x87e7('0x4a')]['id'];_0x145090['push'](_0x11141a[_0x87e7('0x4f')][_0x29c5fb]);}return BPromise[_0x87e7('0x67')](_0x145090,function(_0xcbe4e0){return db[_0x87e7('0x63')][_0x87e7('0x4e')](_[_0x87e7('0x68')](_0xcbe4e0,[_0x87e7('0x61'),'id'])||{},{'fields':_[_0x87e7('0x35')](_0xdb3cc9),'raw':!![]})['then'](function(_0x13f05c){_0x25cad5[_0x87e7('0x69')][_0x87e7('0x6a')](_0x13f05c[_0x87e7('0x6b')]);})[_0x87e7('0x48')](function(_0x4c9c30){_0x25cad5[_0x87e7('0x6c')][_0x87e7('0x6a')]({'data':_0xcbe4e0,'error':_0x4c9c30[_0x87e7('0x6d')]});});})[_0x87e7('0x27')](function(_0x2cad4d){return _0x25cad5;})[_0x87e7('0x48')](function(_0x2c5a3c){return _0x2c5a3c;});}else{_0x15943c[_0x87e7('0x1f')](0x190)[_0x87e7('0x20')]({'message':'Malformed\x20request\x20syntax'});}});}})[_0x87e7('0x27')](respondWithResult(_0x15943c,null))[_0x87e7('0x48')](handleError(_0x15943c,null));};exports[_0x87e7('0x6e')]=function(_0x157b71,_0x456d9f,_0x94bae8){var _0x29ae96;return db[_0x87e7('0x2e')][_0x87e7('0x4d')]({'where':{'id':_0x157b71['params']['id']},'include':[{'model':db[_0x87e7('0x6f')],'as':_0x87e7('0x70')}]})[_0x87e7('0x27')](handleEntityNotFound(_0x456d9f,null))[_0x87e7('0x27')](function(_0x80aa9){if(_0x80aa9){_0x29ae96=_0x80aa9;return db[_0x87e7('0x63')]['rawAttributes'];}})[_0x87e7('0x27')](function(_0x16b7be){if(_0x16b7be){var _0x1bda44={};var _0x2edae5={};_0x2edae5['model']=_[_0x87e7('0x71')](_[_0x87e7('0x35')](_0x16b7be),_['map'](_0x29ae96[_0x87e7('0x70')],function(_0xd65957){return util[_0x87e7('0x72')](_0x87e7('0x73'),_0xd65957['id']);}));_0x2edae5[_0x87e7('0x34')]=_[_0x87e7('0x35')](_0x157b71[_0x87e7('0x34')]);_0x2edae5[_0x87e7('0x36')]=_[_0x87e7('0x37')](_0x2edae5['model'],_0x2edae5[_0x87e7('0x34')]);_0x1bda44[_0x87e7('0x38')]=_[_0x87e7('0x37')](_0x2edae5[_0x87e7('0x32')],qs[_0x87e7('0x4b')](_0x157b71[_0x87e7('0x34')]['fields']));_0x1bda44[_0x87e7('0x38')]=_0x1bda44[_0x87e7('0x38')][_0x87e7('0x4c')]?_0x1bda44[_0x87e7('0x38')]:_0x2edae5[_0x87e7('0x32')];if(!_0x157b71[_0x87e7('0x34')][_0x87e7('0x39')](_0x87e7('0x3a'))){_0x1bda44[_0x87e7('0x3b')]=qs['limit'](_0x157b71[_0x87e7('0x34')][_0x87e7('0x3b')]);_0x1bda44[_0x87e7('0x22')]=qs[_0x87e7('0x22')](_0x157b71['query'][_0x87e7('0x22')]);}_0x1bda44[_0x87e7('0x74')]=qs[_0x87e7('0x3c')](_0x157b71[_0x87e7('0x34')][_0x87e7('0x3c')]);_0x1bda44['where']=qs[_0x87e7('0x36')](_[_0x87e7('0x3e')](_0x157b71['query'],_0x2edae5[_0x87e7('0x36')]));_0x1bda44[_0x87e7('0x75')]=!![];if(_0x157b71[_0x87e7('0x34')][_0x87e7('0x3f')]){_0x1bda44[_0x87e7('0x3d')]=_[_0x87e7('0x40')](_0x1bda44[_0x87e7('0x3d')],{'$or':_[_0x87e7('0x33')](_0x1bda44[_0x87e7('0x38')],function(_0x38f926){var _0x515f6d={};_0x515f6d[_0x38f926]={'$like':'%'+_0x157b71['query']['filter']+'%'};return _0x515f6d;})});}_0x1bda44=_[_0x87e7('0x40')]({},_0x1bda44,_0x157b71[_0x87e7('0x43')]);return _0x29ae96[_0x87e7('0x6e')](_0x1bda44);}})[_0x87e7('0x27')](respondWithResult(_0x456d9f,null))[_0x87e7('0x48')](handleError(_0x456d9f,null));};exports['getContactsCsv']=function(_0x3ab612,_0x322d93,_0x179264){var _0x12263d;return db['CmList']['find']({'where':{'id':_0x3ab612['params']['id']},'include':[{'model':db[_0x87e7('0x6f')],'as':_0x87e7('0x70')}]})['then'](handleEntityNotFound(_0x322d93,null))[_0x87e7('0x27')](function(_0x58148d){if(_0x58148d){_0x12263d=_0x58148d;return db[_0x87e7('0x63')][_0x87e7('0x2f')];}})['then'](function(_0x41b9f5){if(_0x41b9f5){var _0x56346c={};var _0x25243f={};_0x25243f[_0x87e7('0x32')]=_[_0x87e7('0x71')](_[_0x87e7('0x35')](_0x41b9f5),_['map'](_0x12263d[_0x87e7('0x70')],function(_0x13836f){return util['format']('cf_%d',_0x13836f['id']);}));_0x25243f['query']=_[_0x87e7('0x35')](_0x3ab612['query']);_0x25243f['filters']=_[_0x87e7('0x37')](_0x25243f[_0x87e7('0x32')],_0x25243f['query']);_0x56346c[_0x87e7('0x38')]=_[_0x87e7('0x37')](_0x25243f[_0x87e7('0x32')],qs['fields'](_0x3ab612[_0x87e7('0x34')][_0x87e7('0x4b')]));_0x56346c[_0x87e7('0x38')]=_0x56346c[_0x87e7('0x38')][_0x87e7('0x4c')]?_0x56346c['attributes']:_0x25243f['model'];if(!_0x3ab612[_0x87e7('0x34')][_0x87e7('0x39')](_0x87e7('0x3a'))){_0x56346c[_0x87e7('0x3b')]=qs[_0x87e7('0x3b')](_0x3ab612[_0x87e7('0x34')]['limit']);_0x56346c[_0x87e7('0x22')]=qs['offset'](_0x3ab612[_0x87e7('0x34')][_0x87e7('0x22')]);}_0x56346c[_0x87e7('0x74')]=qs[_0x87e7('0x3c')](_0x3ab612[_0x87e7('0x34')][_0x87e7('0x3c')]);_0x56346c[_0x87e7('0x3d')]=qs[_0x87e7('0x36')](_[_0x87e7('0x3e')](_0x3ab612['query'],_0x25243f[_0x87e7('0x36')]));_0x56346c[_0x87e7('0x75')]=!![];if(_0x3ab612[_0x87e7('0x34')][_0x87e7('0x3f')]){_0x56346c[_0x87e7('0x3d')]=_[_0x87e7('0x40')](_0x56346c['where'],{'$or':_[_0x87e7('0x33')](_0x56346c[_0x87e7('0x38')],function(_0x4be332){var _0x64ae55={};_0x64ae55[_0x4be332]={'$like':'%'+_0x3ab612['query'][_0x87e7('0x3f')]+'%'};return _0x64ae55;})});}_0x56346c=_[_0x87e7('0x40')]({},_0x56346c,_0x3ab612[_0x87e7('0x43')]);return _0x12263d[_0x87e7('0x6e')](_0x56346c);}})[_0x87e7('0x27')](function(_0x4b69a1){if(!_[_0x87e7('0x76')](_0x4b69a1)){var _0x5ea94d=toCsv(_0x4b69a1);var _0x7f6d35=Date[_0x87e7('0x77')]();fs['writeFileSync'](util['format']('/tmp/list_%d_%s.csv',_0x12263d['id'],_0x7f6d35),_0x5ea94d);_0x322d93[_0x87e7('0x78')](_0x87e7('0x79'),'attachment;\x20filename='+util[_0x87e7('0x72')](_0x87e7('0x7a'),_0x12263d['id'],_0x7f6d35));_0x322d93['setHeader'](_0x87e7('0x7b'),_0x87e7('0x7c'));return _0x322d93[_0x87e7('0x7d')](util['format']('/tmp/list_%d_%s.csv',_0x12263d['id'],_0x7f6d35));}else{return _0x322d93[_0x87e7('0x1e')](0xcc);}})['catch'](handleError(_0x322d93,null));};exports[_0x87e7('0x7e')]=function(_0x1e66f4,_0x3bee6d,_0x16f20c){var _0x553c7b;delete _0x1e66f4['body']['id'];return db[_0x87e7('0x2e')][_0x87e7('0x5e')]({'where':{'id':_0x1e66f4['params']['id']}})['then'](handleEntityNotFound(_0x3bee6d,null))[_0x87e7('0x27')](function(_0x2d0a9e){if(_0x2d0a9e){return db[_0x87e7('0x7f')][_0x87e7('0x80')](function(_0xab7570){return db['CmCustomField']['create'](_0x1e66f4[_0x87e7('0x4f')],{'transaction':_0xab7570})[_0x87e7('0x27')](function(_0x2e2baa){_0x553c7b=_0x2e2baa;return _0x2d0a9e[_0x87e7('0x81')](_0x2e2baa,{'transaction':_0xab7570});})[_0x87e7('0x27')](function(){var _0x552808={'type':db[_0x87e7('0x82')]['TEXT'],'transaction':_0xab7570};switch(_0x1e66f4[_0x87e7('0x4f')][_0x87e7('0x41')]){case'text':_0x552808['type']=db['Sequelize']['TEXT'];break;case _0x87e7('0x83'):_0x552808[_0x87e7('0x41')]=db[_0x87e7('0x82')][_0x87e7('0x84')];break;case'switch':_0x552808['type']=db[_0x87e7('0x82')][_0x87e7('0x85')];_0x552808['defaultValue']=![];break;default:}return db[_0x87e7('0x7f')][_0x87e7('0x86')]['addColumn'](_0x87e7('0x87'),util[_0x87e7('0x72')]('cf_%s',_0x553c7b['id']),_0x552808);})[_0x87e7('0x27')](function(){return _0x553c7b;});});}})[_0x87e7('0x27')](respondWithResult(_0x3bee6d,null))[_0x87e7('0x48')](handleError(_0x3bee6d,null));};exports[_0x87e7('0x88')]=function(_0x3def5f,_0xc89ba9,_0x3046a3){var _0x218cfe={};var _0xbeafc5={};var _0x5258e5;var _0x70b61;return db['CmList'][_0x87e7('0x5e')]({'where':{'id':_0x3def5f[_0x87e7('0x4a')]['id']}})[_0x87e7('0x27')](handleEntityNotFound(_0xc89ba9,null))[_0x87e7('0x27')](function(_0x421c11){if(_0x421c11){_0x5258e5=_0x421c11;_0xbeafc5[_0x87e7('0x32')]=_[_0x87e7('0x35')](db[_0x87e7('0x6f')]['rawAttributes']);_0xbeafc5[_0x87e7('0x34')]=_[_0x87e7('0x35')](_0x3def5f[_0x87e7('0x34')]);_0xbeafc5[_0x87e7('0x36')]=_[_0x87e7('0x37')](_0xbeafc5['model'],_0xbeafc5[_0x87e7('0x34')]);_0x218cfe[_0x87e7('0x38')]=_[_0x87e7('0x37')](_0xbeafc5[_0x87e7('0x32')],qs[_0x87e7('0x4b')](_0x3def5f[_0x87e7('0x34')][_0x87e7('0x4b')]));_0x218cfe[_0x87e7('0x38')]=_0x218cfe[_0x87e7('0x38')]['length']?_0x218cfe['attributes']:_0xbeafc5[_0x87e7('0x32')];_0x218cfe[_0x87e7('0x74')]=qs[_0x87e7('0x3c')](_0x3def5f[_0x87e7('0x34')][_0x87e7('0x3c')]);_0x218cfe['where']=qs['filters'](_[_0x87e7('0x3e')](_0x3def5f[_0x87e7('0x34')],_0xbeafc5[_0x87e7('0x36')]));_0x218cfe[_0x87e7('0x3d')]=_['merge'](_0x218cfe[_0x87e7('0x3d')],{'$or':[{'ListId':_0x421c11['id']},{'ListId':null}]});if(_0x3def5f[_0x87e7('0x34')][_0x87e7('0x3f')]){_0x218cfe['where']=_[_0x87e7('0x40')](_0x218cfe[_0x87e7('0x3d')],{'$or':_[_0x87e7('0x33')](_0x218cfe[_0x87e7('0x38')],function(_0x15f33f){var _0xa413cf={};_0xa413cf[_0x15f33f]={'$like':'%'+_0x3def5f['query']['filter']+'%'};return _0xa413cf;})});}_0x218cfe=_[_0x87e7('0x40')]({},_0x218cfe,_0x3def5f[_0x87e7('0x43')]);return db[_0x87e7('0x6f')][_0x87e7('0x89')](_0x218cfe);}})[_0x87e7('0x27')](respondWithResult(_0xc89ba9,null))[_0x87e7('0x48')](handleError(_0xc89ba9,null));};exports[_0x87e7('0x8a')]=function(_0x45fdea,_0x10cea9,_0x253fc0){return db[_0x87e7('0x2e')]['find']({'where':{'id':_0x45fdea[_0x87e7('0x4a')]['id']}})[_0x87e7('0x27')](handleEntityNotFound(_0x10cea9,null))['then'](function(_0xe713e7){if(_0xe713e7){return _0xe713e7[_0x87e7('0x8a')](_0x45fdea[_0x87e7('0x4f')][_0x87e7('0x61')],_['omit'](_0x45fdea[_0x87e7('0x4f')],[_0x87e7('0x61'),'id'])||{})[_0x87e7('0x8b')](function(_0x2cdacf){for(var _0x52d447=0x0;_0x52d447<_0x45fdea[_0x87e7('0x4f')]['ids'][_0x87e7('0x4c')];_0x52d447+=0x1){socket[_0x87e7('0x8c')](_0x87e7('0x8d'),{'UserId':_0x45fdea[_0x87e7('0x4f')][_0x87e7('0x61')][_0x52d447],'CmListId':_0x45fdea[_0x87e7('0x4a')]['id']});}return _0x2cdacf;});}})['then'](respondWithResult(_0x10cea9,null))['catch'](handleError(_0x10cea9,null));};exports[_0x87e7('0x8e')]=function(_0x26f396,_0x3cc7f6,_0x128f95){return db[_0x87e7('0x2e')][_0x87e7('0x4d')]({'where':{'id':_0x26f396['params']['id']}})[_0x87e7('0x27')](handleEntityNotFound(_0x3cc7f6,null))[_0x87e7('0x27')](function(_0x48c909){if(_0x48c909){return _0x48c909[_0x87e7('0x8e')](_0x26f396[_0x87e7('0x34')]['ids'])[_0x87e7('0x27')](function(){if(_[_0x87e7('0x66')](_0x26f396[_0x87e7('0x34')][_0x87e7('0x61')])){for(var _0x590db1=0x0;_0x590db1<_0x26f396['query'][_0x87e7('0x61')][_0x87e7('0x4c')];_0x590db1+=0x1){socket['emit'](_0x87e7('0x8f'),{'UserId':Number(_0x26f396[_0x87e7('0x34')][_0x87e7('0x61')][_0x590db1]),'CmListId':Number(_0x26f396[_0x87e7('0x4a')]['id'])});}}else{socket['emit'](_0x87e7('0x8f'),{'UserId':Number(_0x26f396[_0x87e7('0x34')]['ids']),'CmListId':Number(_0x26f396[_0x87e7('0x4a')]['id'])});}});}})[_0x87e7('0x27')](respondWithStatusCode(_0x3cc7f6,null))['catch'](handleError(_0x3cc7f6,null));};exports[_0x87e7('0x90')]=function(_0x1d6a13,_0x2f1e4a,_0x2fc9c1){var _0x228f32={};var _0x2db4a4={};var _0x1aaf9d;var _0x1d5eac;return db[_0x87e7('0x2e')][_0x87e7('0x5e')]({'where':{'id':_0x1d6a13[_0x87e7('0x4a')]['id']}})[_0x87e7('0x27')](handleEntityNotFound(_0x2f1e4a,null))[_0x87e7('0x27')](function(_0x3f401e){if(_0x3f401e){_0x1aaf9d=_0x3f401e;_0x2db4a4['model']=_['keys'](db[_0x87e7('0x91')]['rawAttributes']);_0x2db4a4[_0x87e7('0x34')]=_[_0x87e7('0x35')](_0x1d6a13[_0x87e7('0x34')]);_0x2db4a4['filters']=_[_0x87e7('0x37')](_0x2db4a4[_0x87e7('0x32')],_0x2db4a4[_0x87e7('0x34')]);_0x228f32['attributes']=_[_0x87e7('0x37')](_0x2db4a4[_0x87e7('0x32')],qs['fields'](_0x1d6a13[_0x87e7('0x34')][_0x87e7('0x4b')]));_0x228f32[_0x87e7('0x38')]=_0x228f32[_0x87e7('0x38')][_0x87e7('0x4c')]?_0x228f32[_0x87e7('0x38')]:_0x2db4a4[_0x87e7('0x32')];_0x228f32['order']=qs['sort'](_0x1d6a13[_0x87e7('0x34')]['sort']);_0x228f32[_0x87e7('0x3d')]=qs[_0x87e7('0x36')](_[_0x87e7('0x3e')](_0x1d6a13[_0x87e7('0x34')],_0x2db4a4[_0x87e7('0x36')]));if(_0x1d6a13[_0x87e7('0x34')][_0x87e7('0x3f')]){_0x228f32[_0x87e7('0x3d')]=_[_0x87e7('0x40')](_0x228f32[_0x87e7('0x3d')],{'$or':_[_0x87e7('0x33')](_0x228f32[_0x87e7('0x38')],function(_0x5badfb){var _0x2e76af={};_0x2e76af[_0x5badfb]={'$like':'%'+_0x1d6a13[_0x87e7('0x34')][_0x87e7('0x3f')]+'%'};return _0x2e76af;})});}_0x228f32=_['merge']({},_0x228f32,_0x1d6a13[_0x87e7('0x43')]);return _0x1aaf9d[_0x87e7('0x90')](_0x228f32);}})[_0x87e7('0x27')](function(_0x3651c6){if(_0x3651c6){_0x1d5eac=_0x3651c6[_0x87e7('0x4c')];if(!_0x1d6a13[_0x87e7('0x34')]['hasOwnProperty'](_0x87e7('0x3a'))){_0x228f32[_0x87e7('0x3b')]=qs[_0x87e7('0x3b')](_0x1d6a13['query'][_0x87e7('0x3b')]);_0x228f32[_0x87e7('0x22')]=qs[_0x87e7('0x22')](_0x1d6a13[_0x87e7('0x34')][_0x87e7('0x22')]);}return _0x1aaf9d[_0x87e7('0x90')](_0x228f32);}})[_0x87e7('0x27')](function(_0x404a8e){if(_0x404a8e){return _0x404a8e?{'count':_0x1d5eac,'rows':_0x404a8e}:null;}})['then'](respondWithResult(_0x2f1e4a,null))[_0x87e7('0x48')](handleError(_0x2f1e4a,null));}; \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index b10f0fa..05bb5b1 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 _0xed4e=['hook','exports','../../mysqldb','CmList','save','remove','emit','hasOwnProperty'];(function(_0x1d94b7,_0x5988e5){var _0x40a258=function(_0x3da766){while(--_0x3da766){_0x1d94b7['push'](_0x1d94b7['shift']());}};_0x40a258(++_0x5988e5);}(_0xed4e,0xe2));var _0xeed4=function(_0x15e097,_0xf4848){_0x15e097=_0x15e097-0x0;var _0x3866be=_0xed4e[_0x15e097];return _0x3866be;};'use strict';var EventEmitter=require('events');var CmList=require(_0xeed4('0x0'))['db'][_0xeed4('0x1')];var CmListEvents=new EventEmitter();CmListEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xeed4('0x2'),'afterUpdate':'update','afterDestroy':_0xeed4('0x3')};function emitEvent(_0x3d81fd){return function(_0x447a04,_0x18a02,_0x47efd0){CmListEvents['emit'](_0x3d81fd+':'+_0x447a04['id'],_0x447a04);CmListEvents[_0xeed4('0x4')](_0x3d81fd,_0x447a04);_0x47efd0(null);};}for(var e in events){if(events[_0xeed4('0x5')](e)){var event=events[e];CmList[_0xeed4('0x6')](e,emitEvent(event));}}module[_0xeed4('0x7')]=CmListEvents; \ No newline at end of file +var _0xddff=['setMaxListeners','save','update','emit','events','../../mysqldb'];(function(_0x4153e6,_0x4d67b6){var _0x270fca=function(_0x390984){while(--_0x390984){_0x4153e6['push'](_0x4153e6['shift']());}};_0x270fca(++_0x4d67b6);}(_0xddff,0x100));var _0xfddf=function(_0x1b2422,_0x1e98d4){_0x1b2422=_0x1b2422-0x0;var _0x376573=_0xddff[_0x1b2422];return _0x376573;};'use strict';var EventEmitter=require(_0xfddf('0x0'));var CmList=require(_0xfddf('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents[_0xfddf('0x2')](0x0);var events={'afterCreate':_0xfddf('0x3'),'afterUpdate':_0xfddf('0x4'),'afterDestroy':'remove'};function emitEvent(_0x43019e){return function(_0x2b5928,_0x751127,_0x2fcdb3){CmListEvents['emit'](_0x43019e+':'+_0x2b5928['id'],_0x2b5928);CmListEvents[_0xfddf('0x5')](_0x43019e,_0x2b5928);_0x2fcdb3(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList['hook'](e,emitEvent(event));}}module['exports']=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index c22fa5a..bc7a9b7 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 _0xcd56=['../../config/logger','api','moment','./cmList.attributes','cm_lists','lodash','util'];(function(_0x554f21,_0x23044d){var _0x4dc64b=function(_0x37891d){while(--_0x37891d){_0x554f21['push'](_0x554f21['shift']());}};_0x4dc64b(++_0x23044d);}(_0xcd56,0x1c5));var _0x6cd5=function(_0x44cf54,_0x168f8b){_0x44cf54=_0x44cf54-0x0;var _0x3f5d08=_0xcd56[_0x44cf54];return _0x3f5d08;};'use strict';var _=require(_0x6cd5('0x0'));var util=require(_0x6cd5('0x1'));var logger=require(_0x6cd5('0x2'))(_0x6cd5('0x3'));var moment=require(_0x6cd5('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6cd5('0x5'));module['exports']=function(_0x50666d,_0x190d9e){return _0x50666d['define']('CmList',attributes,{'tableName':_0x6cd5('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf7fa=['moment','request-promise','path','rimraf','../../config/environment','./cmList.attributes','exports','define','lodash','util','../../config/logger','api'];(function(_0x46a50c,_0x3a7f4a){var _0x4274db=function(_0x213af1){while(--_0x213af1){_0x46a50c['push'](_0x46a50c['shift']());}};_0x4274db(++_0x3a7f4a);}(_0xf7fa,0x1d0));var _0xaf7f=function(_0x2aec0d,_0x4bde07){_0x2aec0d=_0x2aec0d-0x0;var _0x20e0c8=_0xf7fa[_0x2aec0d];return _0x20e0c8;};'use strict';var _=require(_0xaf7f('0x0'));var util=require(_0xaf7f('0x1'));var logger=require(_0xaf7f('0x2'))(_0xaf7f('0x3'));var moment=require(_0xaf7f('0x4'));var BPromise=require('bluebird');var rp=require(_0xaf7f('0x5'));var fs=require('fs');var path=require(_0xaf7f('0x6'));var rimraf=require(_0xaf7f('0x7'));var config=require(_0xaf7f('0x8'));var attributes=require(_0xaf7f('0x9'));module[_0xaf7f('0xa')]=function(_0x2085ed,_0x10c7da){return _0x2085ed[_0xaf7f('0xb')]('CmList',attributes,{'tableName':'cm_lists','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 770e7c6..0abf0ea 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 _0xc27d=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','redis','localhost','socket.io-emitter','./cmList.socket','register','then','CmList,\x20%s,\x20%s','request\x20sent','debug','code','error','message','info'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xc27d,0x199));var _0xdc27=function(_0x6d989d,_0x416427){_0x6d989d=_0x6d989d-0x0;var _0x5c5535=_0xc27d[_0x6d989d];return _0x5c5535;};'use strict';var _=require(_0xdc27('0x0'));var util=require(_0xdc27('0x1'));var moment=require(_0xdc27('0x2'));var BPromise=require(_0xdc27('0x3'));var rs=require(_0xdc27('0x4'));var fs=require('fs');var Redis=require(_0xdc27('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xdc27('0x6'));var logger=require(_0xdc27('0x7'))('rpc');var config=require(_0xdc27('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xdc27('0x9')]['http']({'port':0x232a});config[_0xdc27('0xa')]=_['defaults'](config[_0xdc27('0xa')],{'host':_0xdc27('0xb'),'port':0x18eb});var socket=require(_0xdc27('0xc'))(new Redis(config['redis']));require(_0xdc27('0xd'))[_0xdc27('0xe')](socket);function respondWithRpcPromise(_0x4f4414,_0xb4c9ef,_0x197bc4){return new BPromise(function(_0x2f3881,_0xa9dee){return client['request'](_0x4f4414,_0x197bc4)[_0xdc27('0xf')](function(_0x118b1c){logger['info'](_0xdc27('0x10'),_0xb4c9ef,_0xdc27('0x11'));logger[_0xdc27('0x12')]('CmList,\x20%s,\x20%s,\x20%s',_0xb4c9ef,_0xdc27('0x11'),JSON['stringify'](_0x118b1c));if(_0x118b1c['error']){if(_0x118b1c['error'][_0xdc27('0x13')]===0x1f4){logger['error']('CmList,\x20%s,\x20%s',_0xb4c9ef,_0x118b1c[_0xdc27('0x14')][_0xdc27('0x15')]);return _0xa9dee(_0x118b1c[_0xdc27('0x14')][_0xdc27('0x15')]);}logger[_0xdc27('0x14')](_0xdc27('0x10'),_0xb4c9ef,_0x118b1c[_0xdc27('0x14')][_0xdc27('0x15')]);return _0x2f3881(_0x118b1c[_0xdc27('0x14')]['message']);}else{logger[_0xdc27('0x16')](_0xdc27('0x10'),_0xb4c9ef,_0xdc27('0x11'));_0x2f3881(_0x118b1c['result'][_0xdc27('0x15')]);}})[_0xdc27('0x17')](function(_0x415459){logger[_0xdc27('0x14')]('CmList,\x20%s,\x20%s',_0xb4c9ef,_0x415459);_0xa9dee(_0x415459);});});} \ No newline at end of file +var _0x8e29=['CmList,\x20%s,\x20%s','CmList,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info'];(function(_0xe7798a,_0x482e12){var _0x5e4869=function(_0x20f5d3){while(--_0x20f5d3){_0xe7798a['push'](_0xe7798a['shift']());}};_0x5e4869(++_0x482e12);}(_0x8e29,0xbe));var _0x98e2=function(_0x16f75a,_0x3ba006){_0x16f75a=_0x16f75a-0x0;var _0x1c2db6=_0x8e29[_0x16f75a];return _0x1c2db6;};'use strict';var _=require('lodash');var util=require(_0x98e2('0x0'));var moment=require(_0x98e2('0x1'));var BPromise=require(_0x98e2('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x98e2('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x98e2('0x4'));var logger=require(_0x98e2('0x5'))(_0x98e2('0x6'));var config=require('../../config/environment');var jayson=require(_0x98e2('0x7'));var client=jayson[_0x98e2('0x8')][_0x98e2('0x9')]({'port':0x232a});config[_0x98e2('0xa')]=_[_0x98e2('0xb')](config['redis'],{'host':_0x98e2('0xc'),'port':0x18eb});var socket=require(_0x98e2('0xd'))(new Redis(config[_0x98e2('0xa')]));require('./cmList.socket')[_0x98e2('0xe')](socket);function respondWithRpcPromise(_0x18c111,_0x3ad567,_0x1da5ca){return new BPromise(function(_0x322b22,_0x2bf3b6){return client[_0x98e2('0xf')](_0x18c111,_0x1da5ca)[_0x98e2('0x10')](function(_0x412874){logger[_0x98e2('0x11')](_0x98e2('0x12'),_0x3ad567,'request\x20sent');logger['debug'](_0x98e2('0x13'),_0x3ad567,'request\x20sent',JSON[_0x98e2('0x14')](_0x412874));if(_0x412874[_0x98e2('0x15')]){if(_0x412874['error']['code']===0x1f4){logger[_0x98e2('0x15')](_0x98e2('0x12'),_0x3ad567,_0x412874['error'][_0x98e2('0x16')]);return _0x2bf3b6(_0x412874['error'][_0x98e2('0x16')]);}logger[_0x98e2('0x15')]('CmList,\x20%s,\x20%s',_0x3ad567,_0x412874[_0x98e2('0x15')][_0x98e2('0x16')]);return _0x322b22(_0x412874[_0x98e2('0x15')][_0x98e2('0x16')]);}else{logger[_0x98e2('0x11')]('CmList,\x20%s,\x20%s',_0x3ad567,_0x98e2('0x17'));_0x322b22(_0x412874[_0x98e2('0x18')][_0x98e2('0x16')]);}})[_0x98e2('0x19')](function(_0x24a717){logger[_0x98e2('0x15')](_0x98e2('0x12'),_0x3ad567,_0x24a717);_0x2bf3b6(_0x24a717);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index a9081a9..efcd846 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 _0xe292=['remove','update','emit','removeListener','length','cmList:'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xe292,0x19e));var _0x2e29=function(_0x598fb2,_0x6808e7){_0x598fb2=_0x598fb2-0x0;var _0x1a10a8=_0xe292[_0x598fb2];return _0x1a10a8;};'use strict';var CmListEvents=require('./cmList.events');var events=['save',_0x2e29('0x0'),_0x2e29('0x1')];function createListener(_0x56d796,_0x575f18){return function(_0x1d2c2a){_0x575f18[_0x2e29('0x2')](_0x56d796,_0x1d2c2a);};}function removeListener(_0x4fec69,_0x59d723){return function(){CmListEvents[_0x2e29('0x3')](_0x4fec69,_0x59d723);};}exports['register']=function(_0x5bd6cc){for(var _0xcdccd7=0x0,_0x422679=events[_0x2e29('0x4')];_0xcdccd7<_0x422679;_0xcdccd7++){var _0x39f1ee=events[_0xcdccd7];var _0x1e7c81=createListener(_0x2e29('0x5')+_0x39f1ee,_0x5bd6cc);CmListEvents['on'](_0x39f1ee,_0x1e7c81);}}; \ No newline at end of file +var _0x06f4=['register','cmList:','./cmList.events','save','update','emit','removeListener'];(function(_0x47b7dc,_0x1d8546){var _0x469765=function(_0x3a6525){while(--_0x3a6525){_0x47b7dc['push'](_0x47b7dc['shift']());}};_0x469765(++_0x1d8546);}(_0x06f4,0x136));var _0x406f=function(_0x1f837f,_0x466baf){_0x1f837f=_0x1f837f-0x0;var _0x29396e=_0x06f4[_0x1f837f];return _0x29396e;};'use strict';var CmListEvents=require(_0x406f('0x0'));var events=[_0x406f('0x1'),'remove',_0x406f('0x2')];function createListener(_0x276a15,_0x58cd7d){return function(_0x5cab5e){_0x58cd7d[_0x406f('0x3')](_0x276a15,_0x5cab5e);};}function removeListener(_0x5ed32f,_0x32abfd){return function(){CmListEvents[_0x406f('0x4')](_0x5ed32f,_0x32abfd);};}exports[_0x406f('0x5')]=function(_0x32b2bd){for(var _0x59821c=0x0,_0x1d2886=events['length'];_0x59821c<_0x1d2886;_0x59821c++){var _0x1afec4=events[_0x59821c];var _0x1c39ce=createListener(_0x406f('0x6')+_0x1afec4,_0x32b2bd);CmListEvents['on'](_0x1afec4,_0x1c39ce);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index a28fd36..d16f39b 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 _0x8b7e=['show','/:id/dispositions','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','/:id/fields','getCustomFields','getAgents','post','addDisposition','addContacts','addCustomField','/:id/users','put','/:id','update','delete','destroy','removeDispositions','exports','multer','util','path','Router','../../components/auth/service','./cmList.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x48647c,_0x1ac6c4){var _0xc917fc=function(_0x34761d){while(--_0x34761d){_0x48647c['push'](_0x48647c['shift']());}};_0xc917fc(++_0x1ac6c4);}(_0x8b7e,0x75));var _0xe8b7=function(_0x33829b,_0x3f5c8d){_0x33829b=_0x33829b-0x0;var _0x233357=_0x8b7e[_0x33829b];return _0x233357;};'use strict';var multer=require(_0xe8b7('0x0'));var util=require(_0xe8b7('0x1'));var path=require(_0xe8b7('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xe8b7('0x3')]();var auth=require(_0xe8b7('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xe8b7('0x5'));router[_0xe8b7('0x6')]('/',auth[_0xe8b7('0x7')](),controller[_0xe8b7('0x8')]);router['get'](_0xe8b7('0x9'),auth[_0xe8b7('0x7')](),controller[_0xe8b7('0xa')]);router[_0xe8b7('0x6')]('/:id',auth[_0xe8b7('0x7')](),controller[_0xe8b7('0xb')]);router[_0xe8b7('0x6')](_0xe8b7('0xc'),auth[_0xe8b7('0x7')](),controller[_0xe8b7('0xd')]);router['get'](_0xe8b7('0xe'),auth[_0xe8b7('0x7')](),controller[_0xe8b7('0xf')]);router[_0xe8b7('0x6')](_0xe8b7('0x10'),auth[_0xe8b7('0x7')](),controller['getContactsCsv']);router['get'](_0xe8b7('0x11'),auth[_0xe8b7('0x7')](),controller[_0xe8b7('0x12')]);router[_0xe8b7('0x6')]('/:id/users',auth[_0xe8b7('0x7')](),controller[_0xe8b7('0x13')]);router[_0xe8b7('0x14')]('/',auth[_0xe8b7('0x7')](),controller['create']);router['post'](_0xe8b7('0xc'),auth['isAuthenticated'](),controller[_0xe8b7('0x15')]);router[_0xe8b7('0x14')](_0xe8b7('0xe'),auth['isAuthenticated'](),controller[_0xe8b7('0x16')]);router[_0xe8b7('0x14')](_0xe8b7('0x11'),auth[_0xe8b7('0x7')](),controller[_0xe8b7('0x17')]);router[_0xe8b7('0x14')](_0xe8b7('0x18'),auth[_0xe8b7('0x7')](),controller['addAgents']);router[_0xe8b7('0x19')](_0xe8b7('0x1a'),auth[_0xe8b7('0x7')](),controller[_0xe8b7('0x1b')]);router[_0xe8b7('0x1c')](_0xe8b7('0x1a'),auth['isAuthenticated'](),controller[_0xe8b7('0x1d')]);router[_0xe8b7('0x1c')](_0xe8b7('0xc'),auth['isAuthenticated'](),controller[_0xe8b7('0x1e')]);router[_0xe8b7('0x1c')](_0xe8b7('0x18'),auth[_0xe8b7('0x7')](),controller['removeAgents']);module[_0xe8b7('0x1f')]=router; \ No newline at end of file +var _0x3a9e=['post','/:id/dispositions','addDisposition','addCustomField','addAgents','put','delete','destroy','removeAgents','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','/:id','show','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','/:id/users','create'];(function(_0xae1a83,_0x1980d4){var _0xdb9da8=function(_0x36fc99){while(--_0x36fc99){_0xae1a83['push'](_0xae1a83['shift']());}};_0xdb9da8(++_0x1980d4);}(_0x3a9e,0x12b));var _0xe3a9=function(_0x12c32c,_0x13af3b){_0x12c32c=_0x12c32c-0x0;var _0x39b809=_0x3a9e[_0x12c32c];return _0x39b809;};'use strict';var multer=require('multer');var util=require(_0xe3a9('0x0'));var path=require('path');var timeout=require(_0xe3a9('0x1'));var express=require(_0xe3a9('0x2'));var router=express['Router']();var auth=require(_0xe3a9('0x3'));var interaction=require(_0xe3a9('0x4'));var config=require(_0xe3a9('0x5'));var controller=require('./cmList.controller');router['get']('/',auth[_0xe3a9('0x6')](),controller[_0xe3a9('0x7')]);router[_0xe3a9('0x8')](_0xe3a9('0x9'),auth[_0xe3a9('0x6')](),controller['describe']);router[_0xe3a9('0x8')](_0xe3a9('0xa'),auth['isAuthenticated'](),controller[_0xe3a9('0xb')]);router[_0xe3a9('0x8')]('/:id/dispositions',auth[_0xe3a9('0x6')](),controller['getDispositions']);router[_0xe3a9('0x8')](_0xe3a9('0xc'),auth[_0xe3a9('0x6')](),controller[_0xe3a9('0xd')]);router[_0xe3a9('0x8')](_0xe3a9('0xe'),auth[_0xe3a9('0x6')](),controller[_0xe3a9('0xf')]);router[_0xe3a9('0x8')](_0xe3a9('0x10'),auth[_0xe3a9('0x6')](),controller[_0xe3a9('0x11')]);router['get'](_0xe3a9('0x12'),auth['isAuthenticated'](),controller['getAgents']);router['post']('/',auth['isAuthenticated'](),controller[_0xe3a9('0x13')]);router[_0xe3a9('0x14')](_0xe3a9('0x15'),auth[_0xe3a9('0x6')](),controller[_0xe3a9('0x16')]);router[_0xe3a9('0x14')](_0xe3a9('0xc'),auth[_0xe3a9('0x6')](),controller['addContacts']);router['post'](_0xe3a9('0x10'),auth[_0xe3a9('0x6')](),controller[_0xe3a9('0x17')]);router['post'](_0xe3a9('0x12'),auth[_0xe3a9('0x6')](),controller[_0xe3a9('0x18')]);router[_0xe3a9('0x19')](_0xe3a9('0xa'),auth['isAuthenticated'](),controller['update']);router[_0xe3a9('0x1a')](_0xe3a9('0xa'),auth['isAuthenticated'](),controller[_0xe3a9('0x1b')]);router['delete'](_0xe3a9('0x15'),auth['isAuthenticated'](),controller['removeDispositions']);router['delete']('/:id/users',auth[_0xe3a9('0x6')](),controller[_0xe3a9('0x1c')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 37ea4e9..9b23198 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(_0x32f1a2,_0xa27ac3){var _0x2023f0=function(_0x27208b){while(--_0x27208b){_0x32f1a2['push'](_0x32f1a2['shift']());}};_0x2023f0(++_0xa27ac3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xa9e0[_0x4243a3];return _0x1b2a33;};'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 _0x9957=['field','STRING','sequelize','exports','VIRTUAL'];(function(_0x35a872,_0x48ed88){var _0x3a467f=function(_0x47a5ac){while(--_0x47a5ac){_0x35a872['push'](_0x35a872['shift']());}};_0x3a467f(++_0x48ed88);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'name':{'type':Sequelize[_0x7995('0x2')],'get':function(_0x10a05d){return this['getDataValue'](_0x7995('0x3'));}},'field':{'type':Sequelize[_0x7995('0x4')],'allowNull':![]},'operator':{'type':Sequelize[_0x7995('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x7995('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 f8afd6e..29a8570 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 _0x9e38=['to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','status','count','offset','Content-Range','reject','save','update','then','error','name','send','body','find','Condition','params','html-pdf','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox'];(function(_0xb7fc0b,_0x4181d9){var _0x586afc=function(_0x1dfa07){while(--_0x1dfa07){_0xb7fc0b['push'](_0xb7fc0b['shift']());}};_0x586afc(++_0x4181d9);}(_0x9e38,0x171));var _0x89e3=function(_0x1d2bc8,_0x2860bc){_0x1d2bc8=_0x1d2bc8-0x0;var _0x1857e1=_0x9e38[_0x1d2bc8];return _0x1857e1;};'use strict';var pdf=require(_0x89e3('0x0'));var emlformat=require(_0x89e3('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x89e3('0x2'));var jsonpatch=require(_0x89e3('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x89e3('0x4'));var Mustache=require(_0x89e3('0x5'));var util=require(_0x89e3('0x6'));var path=require(_0x89e3('0x7'));var sox=require(_0x89e3('0x8'));var csv=require(_0x89e3('0x9'));var ejs=require(_0x89e3('0xa'));var fs=require('fs');var _=require(_0x89e3('0xb'));var squel=require(_0x89e3('0xc'));var crypto=require(_0x89e3('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x89e3('0xe'));var toCsv=require(_0x89e3('0x9'));var querystring=require(_0x89e3('0xf'));var Papa=require(_0x89e3('0x10'));var Redis=require(_0x89e3('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x89e3('0x12'));var as=require(_0x89e3('0x13'));var hardwareService=require(_0x89e3('0x14'));var logger=require(_0x89e3('0x15'))(_0x89e3('0x16'));var utils=require('../../config/utils');var config=require(_0x89e3('0x17'));var db=require(_0x89e3('0x18'))['db'];function respondWithStatusCode(_0x3aa8f1,_0x264c0a){_0x264c0a=_0x264c0a||0xcc;return function(_0x2205c8){if(_0x2205c8){return _0x3aa8f1[_0x89e3('0x19')](_0x264c0a);}return _0x3aa8f1['status'](_0x264c0a)[_0x89e3('0x1a')]();};}function respondWithResult(_0x768d1c,_0x2a6e98){_0x2a6e98=_0x2a6e98||0xc8;return function(_0x43bc47){if(_0x43bc47){return _0x768d1c[_0x89e3('0x1b')](_0x2a6e98)['json'](_0x43bc47);}};}function respondWithFilteredResult(_0x5d1308,_0x8b768a){return function(_0x4ab641){if(_0x4ab641){var _0x47a728=_0x4ab641[_0x89e3('0x1c')],_0xeedc96=_0x8b768a['offset'],_0xd925a0=_0x8b768a[_0x89e3('0x1d')]+_0x8b768a['limit'],_0x342250;if(_0xd925a0>=_0x47a728){_0xd925a0=_0x47a728;_0x342250=0xc8;}else{_0x342250=0xce;}_0x5d1308['status'](_0x342250);return _0x5d1308['set'](_0x89e3('0x1e'),_0xeedc96+'-'+_0xd925a0+'/'+_0x47a728)['json'](_0x4ab641);}return null;};}function patchUpdates(_0x3adc8f){return function(_0x425b3f){try{jsonpatch['apply'](_0x425b3f,_0x3adc8f,!![]);}catch(_0x2eb202){return BPromise[_0x89e3('0x1f')](_0x2eb202);}return _0x425b3f[_0x89e3('0x20')]();};}function saveUpdates(_0x5cf380,_0x34628e){return function(_0x1c8ab3){if(_0x1c8ab3){return _0x1c8ab3[_0x89e3('0x21')](_0x5cf380)[_0x89e3('0x22')](function(_0x28fa34){return _0x28fa34;});}return null;};}function removeEntity(_0x293c1e,_0x189d69){return function(_0x50afe2){if(_0x50afe2){return _0x50afe2['destroy']()['then'](function(){_0x293c1e[_0x89e3('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0xc740ec,_0x13b440){return function(_0x1adca7){if(!_0x1adca7){_0xc740ec['sendStatus'](0x194);}return _0x1adca7;};}function handleError(_0x82459,_0x2b2f9d){_0x2b2f9d=_0x2b2f9d||0x1f4;return function(_0x1be1ce){logger[_0x89e3('0x23')](_0x1be1ce['stack']);if(_0x1be1ce[_0x89e3('0x24')]){delete _0x1be1ce[_0x89e3('0x24')];}_0x82459['status'](_0x2b2f9d)[_0x89e3('0x25')](_0x1be1ce);};}exports[_0x89e3('0x21')]=function(_0x503869,_0x24179c){if(_0x503869[_0x89e3('0x26')]['id']){delete _0x503869[_0x89e3('0x26')]['id'];}return db['Condition'][_0x89e3('0x27')]({'where':{'id':_0x503869['params']['id']}})[_0x89e3('0x22')](handleEntityNotFound(_0x24179c,null))[_0x89e3('0x22')](saveUpdates(_0x503869[_0x89e3('0x26')],null))[_0x89e3('0x22')](respondWithResult(_0x24179c,null))['catch'](handleError(_0x24179c,null));};exports['destroy']=function(_0xc4092d,_0x2ebbcc){return db[_0x89e3('0x28')]['find']({'where':{'id':_0xc4092d[_0x89e3('0x29')]['id']}})[_0x89e3('0x22')](handleEntityNotFound(_0x2ebbcc,null))[_0x89e3('0x22')](removeEntity(_0x2ebbcc,null))['catch'](handleError(_0x2ebbcc,null));}; \ No newline at end of file +var _0x160f=['offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','sendStatus','name','body','Condition','catch','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','json','count'];(function(_0x255bdf,_0x3b77c9){var _0x55115b=function(_0x85549a){while(--_0x85549a){_0x255bdf['push'](_0x255bdf['shift']());}};_0x55115b(++_0x3b77c9);}(_0x160f,0x1ef));var _0xf160=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x160f[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xf160('0x0'));var emlformat=require(_0xf160('0x1'));var rimraf=require(_0xf160('0x2'));var zipdir=require(_0xf160('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf160('0x4'));var moment=require(_0xf160('0x5'));var BPromise=require(_0xf160('0x6'));var Mustache=require(_0xf160('0x7'));var util=require(_0xf160('0x8'));var path=require(_0xf160('0x9'));var sox=require('sox');var csv=require(_0xf160('0xa'));var ejs=require(_0xf160('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xf160('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf160('0xd'));var Papa=require(_0xf160('0xe'));var Redis=require(_0xf160('0xf'));var authService=require(_0xf160('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf160('0x11'));var logger=require(_0xf160('0x12'))(_0xf160('0x13'));var utils=require('../../config/utils');var config=require(_0xf160('0x14'));var db=require(_0xf160('0x15'))['db'];function respondWithStatusCode(_0x25866c,_0x3b09ea){_0x3b09ea=_0x3b09ea||0xcc;return function(_0x2d8854){if(_0x2d8854){return _0x25866c['sendStatus'](_0x3b09ea);}return _0x25866c[_0xf160('0x16')](_0x3b09ea)['end']();};}function respondWithResult(_0x1496b6,_0x26951a){_0x26951a=_0x26951a||0xc8;return function(_0x12549a){if(_0x12549a){return _0x1496b6[_0xf160('0x16')](_0x26951a)[_0xf160('0x17')](_0x12549a);}};}function respondWithFilteredResult(_0x31f7ae,_0x2643ba){return function(_0x172337){if(_0x172337){var _0x1396ba=_0x172337[_0xf160('0x18')],_0x59ac02=_0x2643ba[_0xf160('0x19')],_0x477e4d=_0x2643ba['offset']+_0x2643ba[_0xf160('0x1a')],_0x400bda;if(_0x477e4d>=_0x1396ba){_0x477e4d=_0x1396ba;_0x400bda=0xc8;}else{_0x400bda=0xce;}_0x31f7ae['status'](_0x400bda);return _0x31f7ae[_0xf160('0x1b')](_0xf160('0x1c'),_0x59ac02+'-'+_0x477e4d+'/'+_0x1396ba)[_0xf160('0x17')](_0x172337);}return null;};}function patchUpdates(_0x1e09f3){return function(_0x19299b){try{jsonpatch[_0xf160('0x1d')](_0x19299b,_0x1e09f3,!![]);}catch(_0x156dca){return BPromise[_0xf160('0x1e')](_0x156dca);}return _0x19299b[_0xf160('0x1f')]();};}function saveUpdates(_0x4a58d9,_0x40ccf0){return function(_0xa20d5a){if(_0xa20d5a){return _0xa20d5a[_0xf160('0x20')](_0x4a58d9)['then'](function(_0x435572){return _0x435572;});}return null;};}function removeEntity(_0xff0491,_0x454e63){return function(_0x36d0cb){if(_0x36d0cb){return _0x36d0cb[_0xf160('0x21')]()[_0xf160('0x22')](function(){_0xff0491[_0xf160('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3d1f6c,_0x28bf27){return function(_0x305f6a){if(!_0x305f6a){_0x3d1f6c[_0xf160('0x23')](0x194);}return _0x305f6a;};}function handleError(_0x578f7d,_0x42458c){_0x42458c=_0x42458c||0x1f4;return function(_0x46d45a){logger['error'](_0x46d45a['stack']);if(_0x46d45a[_0xf160('0x24')]){delete _0x46d45a[_0xf160('0x24')];}_0x578f7d[_0xf160('0x16')](_0x42458c)['send'](_0x46d45a);};}exports[_0xf160('0x20')]=function(_0x73851f,_0x2851e8){if(_0x73851f[_0xf160('0x25')]['id']){delete _0x73851f[_0xf160('0x25')]['id'];}return db[_0xf160('0x26')]['find']({'where':{'id':_0x73851f['params']['id']}})['then'](handleEntityNotFound(_0x2851e8,null))[_0xf160('0x22')](saveUpdates(_0x73851f[_0xf160('0x25')],null))[_0xf160('0x22')](respondWithResult(_0x2851e8,null))[_0xf160('0x27')](handleError(_0x2851e8,null));};exports[_0xf160('0x21')]=function(_0x563103,_0x55f9c3){return db[_0xf160('0x26')]['find']({'where':{'id':_0x563103['params']['id']}})[_0xf160('0x22')](handleEntityNotFound(_0x55f9c3,null))[_0xf160('0x22')](removeEntity(_0x55f9c3,null))['catch'](handleError(_0x55f9c3,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index 2e05366..b3e6cc8 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 _0xd36c=['bluebird','request-promise','exports','define','Condition','lodash','util','../../config/logger','moment'];(function(_0x2418e0,_0x7215b0){var _0x55ffbf=function(_0x4fc0ec){while(--_0x4fc0ec){_0x2418e0['push'](_0x2418e0['shift']());}};_0x55ffbf(++_0x7215b0);}(_0xd36c,0x1b5));var _0xcd36=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0xd36c[_0x1d9aa0];return _0x226868;};'use strict';var _=require(_0xcd36('0x0'));var util=require(_0xcd36('0x1'));var logger=require(_0xcd36('0x2'))('api');var moment=require(_0xcd36('0x3'));var BPromise=require(_0xcd36('0x4'));var rp=require(_0xcd36('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./condition.attributes');module[_0xcd36('0x6')]=function(_0x4cdbec,_0xcd649b){return _0x4cdbec[_0xcd36('0x7')](_0xcd36('0x8'),attributes,{'tableName':'tools_conditions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8e4a=['Condition','tools_conditions','lodash','../../config/logger','moment','request-promise','rimraf','../../config/environment','define'];(function(_0x362256,_0x4f8638){var _0xfa7997=function(_0xfb12d0){while(--_0xfb12d0){_0x362256['push'](_0x362256['shift']());}};_0xfa7997(++_0x4f8638);}(_0x8e4a,0x1d6));var _0xa8e4=function(_0x5ea7c5,_0x18eac7){_0x5ea7c5=_0x5ea7c5-0x0;var _0x17f6e5=_0x8e4a[_0x5ea7c5];return _0x17f6e5;};'use strict';var _=require(_0xa8e4('0x0'));var util=require('util');var logger=require(_0xa8e4('0x1'))('api');var moment=require(_0xa8e4('0x2'));var BPromise=require('bluebird');var rp=require(_0xa8e4('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa8e4('0x4'));var config=require(_0xa8e4('0x5'));var attributes=require('./condition.attributes');module['exports']=function(_0x1aa7fd,_0x13060b){return _0x1aa7fd[_0xa8e4('0x6')](_0xa8e4('0x7'),attributes,{'tableName':_0xa8e4('0x8'),'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 11f074d..4da5cbd 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 _0x4db7=['Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','Condition,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','request\x20sent','debug'];(function(_0x1ca29f,_0x318ac5){var _0x576c3b=function(_0x40caab){while(--_0x40caab){_0x1ca29f['push'](_0x1ca29f['shift']());}};_0x576c3b(++_0x318ac5);}(_0x4db7,0x1eb));var _0x74db=function(_0x4b2863,_0x494899){_0x4b2863=_0x4b2863-0x0;var _0x567d67=_0x4db7[_0x4b2863];return _0x567d67;};'use strict';var _=require(_0x74db('0x0'));var util=require(_0x74db('0x1'));var moment=require(_0x74db('0x2'));var BPromise=require('bluebird');var rs=require(_0x74db('0x3'));var fs=require('fs');var Redis=require(_0x74db('0x4'));var db=require(_0x74db('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x74db('0x6'))(_0x74db('0x7'));var config=require(_0x74db('0x8'));var jayson=require(_0x74db('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x232882,_0x4b14bb,_0x45c150){return new BPromise(function(_0x16961f,_0x3c65a1){return client[_0x74db('0xa')](_0x232882,_0x45c150)[_0x74db('0xb')](function(_0x2aae75){logger[_0x74db('0xc')]('Condition,\x20%s,\x20%s',_0x4b14bb,_0x74db('0xd'));logger[_0x74db('0xe')](_0x74db('0xf'),_0x4b14bb,_0x74db('0xd'),JSON[_0x74db('0x10')](_0x2aae75));if(_0x2aae75['error']){if(_0x2aae75[_0x74db('0x11')][_0x74db('0x12')]===0x1f4){logger[_0x74db('0x11')](_0x74db('0x13'),_0x4b14bb,_0x2aae75[_0x74db('0x11')][_0x74db('0x14')]);return _0x3c65a1(_0x2aae75['error'][_0x74db('0x14')]);}logger[_0x74db('0x11')](_0x74db('0x13'),_0x4b14bb,_0x2aae75[_0x74db('0x11')]['message']);return _0x16961f(_0x2aae75[_0x74db('0x11')]['message']);}else{logger['info'](_0x74db('0x13'),_0x4b14bb,_0x74db('0xd'));_0x16961f(_0x2aae75[_0x74db('0x15')][_0x74db('0x14')]);}})[_0x74db('0x16')](function(_0x323da8){logger[_0x74db('0x11')](_0x74db('0x13'),_0x4b14bb,_0x323da8);_0x3c65a1(_0x323da8);});});} \ No newline at end of file +var _0x76b3=['Condition,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','moment','bluebird','randomstring','../../config/utils','../../config/environment','jayson/promise','http','request','info','Condition,\x20%s,\x20%s','request\x20sent'];(function(_0x2bf5d6,_0x129082){var _0x9c9f50=function(_0x15fe80){while(--_0x15fe80){_0x2bf5d6['push'](_0x2bf5d6['shift']());}};_0x9c9f50(++_0x129082);}(_0x76b3,0x1bf));var _0x376b=function(_0xa93c63,_0x248dfe){_0xa93c63=_0xa93c63-0x0;var _0x1fb6c3=_0x76b3[_0xa93c63];return _0x1fb6c3;};'use strict';var _=require(_0x376b('0x0'));var util=require('util');var moment=require(_0x376b('0x1'));var BPromise=require(_0x376b('0x2'));var rs=require(_0x376b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x376b('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x376b('0x5'));var jayson=require(_0x376b('0x6'));var client=jayson['client'][_0x376b('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x28a3a0,_0x426062,_0x2a387d){return new BPromise(function(_0x332ea3,_0x11ff88){return client[_0x376b('0x8')](_0x28a3a0,_0x2a387d)['then'](function(_0x4290da){logger[_0x376b('0x9')](_0x376b('0xa'),_0x426062,_0x376b('0xb'));logger['debug'](_0x376b('0xc'),_0x426062,_0x376b('0xb'),JSON[_0x376b('0xd')](_0x4290da));if(_0x4290da[_0x376b('0xe')]){if(_0x4290da['error']['code']===0x1f4){logger[_0x376b('0xe')](_0x376b('0xa'),_0x426062,_0x4290da[_0x376b('0xe')][_0x376b('0xf')]);return _0x11ff88(_0x4290da[_0x376b('0xe')][_0x376b('0xf')]);}logger[_0x376b('0xe')]('Condition,\x20%s,\x20%s',_0x426062,_0x4290da[_0x376b('0xe')][_0x376b('0xf')]);return _0x332ea3(_0x4290da[_0x376b('0xe')][_0x376b('0xf')]);}else{logger[_0x376b('0x9')](_0x376b('0xa'),_0x426062,'request\x20sent');_0x332ea3(_0x4290da['result'][_0x376b('0xf')]);}})[_0x376b('0x10')](function(_0x44495b){logger[_0x376b('0xe')](_0x376b('0xa'),_0x426062,_0x44495b);_0x11ff88(_0x44495b);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index fdea442..3d9338d 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 _0x9428=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./condition.controller','put','isAuthenticated','update','delete','/:id','destroy','exports','multer'];(function(_0x1eaad7,_0x44dd84){var _0x20929e=function(_0x265504){while(--_0x265504){_0x1eaad7['push'](_0x1eaad7['shift']());}};_0x20929e(++_0x44dd84);}(_0x9428,0x1db));var _0x8942=function(_0x5a2285,_0x3212d1){_0x5a2285=_0x5a2285-0x0;var _0x48f6ed=_0x9428[_0x5a2285];return _0x48f6ed;};'use strict';var multer=require(_0x8942('0x0'));var util=require(_0x8942('0x1'));var path=require(_0x8942('0x2'));var timeout=require(_0x8942('0x3'));var express=require(_0x8942('0x4'));var router=express[_0x8942('0x5')]();var auth=require(_0x8942('0x6'));var interaction=require(_0x8942('0x7'));var config=require(_0x8942('0x8'));var controller=require(_0x8942('0x9'));router[_0x8942('0xa')]('/:id',auth[_0x8942('0xb')](),controller[_0x8942('0xc')]);router[_0x8942('0xd')](_0x8942('0xe'),auth[_0x8942('0xb')](),controller[_0x8942('0xf')]);module[_0x8942('0x10')]=router; \ No newline at end of file +var _0x8879=['util','connect-timeout','express','../../components/interaction/service','../../config/environment','put','/:id','isAuthenticated','update','delete','destroy','exports','multer'];(function(_0x17250e,_0x3da3e9){var _0xf277d4=function(_0x18ad06){while(--_0x18ad06){_0x17250e['push'](_0x17250e['shift']());}};_0xf277d4(++_0x3da3e9);}(_0x8879,0xe9));var _0x9887=function(_0x12c1f8,_0x14fdae){_0x12c1f8=_0x12c1f8-0x0;var _0x19e25a=_0x8879[_0x12c1f8];return _0x19e25a;};'use strict';var multer=require(_0x9887('0x0'));var util=require(_0x9887('0x1'));var path=require('path');var timeout=require(_0x9887('0x2'));var express=require(_0x9887('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x9887('0x4'));var config=require(_0x9887('0x5'));var controller=require('./condition.controller');router[_0x9887('0x6')](_0x9887('0x7'),auth[_0x9887('0x8')](),controller[_0x9887('0x9')]);router[_0x9887('0xa')](_0x9887('0x7'),auth[_0x9887('0x8')](),controller[_0x9887('0xb')]);module[_0x9887('0xc')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 21d2fc1..3f936b3 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 _0x5a63=['exports','STRING','sequelize'];(function(_0x1f1c46,_0x572114){var _0x5f4a51=function(_0x45ee9e){while(--_0x45ee9e){_0x1f1c46['push'](_0x1f1c46['shift']());}};_0x5f4a51(++_0x572114);}(_0x5a63,0xe3));var _0x35a6=function(_0x600477,_0x217c57){_0x600477=_0x600477-0x0;var _0x7d2596=_0x5a63[_0x600477];return _0x7d2596;};'use strict';var Sequelize=require(_0x35a6('0x0'));module[_0x35a6('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x35a6('0x2')]}}; \ No newline at end of file +var _0xab72=['name','sequelize','exports','STRING'];(function(_0x413f69,_0x551673){var _0x55eebf=function(_0x1517d9){while(--_0x1517d9){_0x413f69['push'](_0x413f69['shift']());}};_0x55eebf(++_0x551673);}(_0xab72,0x71));var _0x2ab7=function(_0x5197a0,_0x1d079e){_0x5197a0=_0x5197a0-0x0;var _0x557ffd=_0xab72[_0x5197a0];return _0x557ffd;};'use strict';var Sequelize=require(_0x2ab7('0x0'));module[_0x2ab7('0x1')]={'name':{'type':Sequelize[_0x2ab7('0x2')],'allowNull':![],'unique':_0x2ab7('0x3')},'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 8019f45..2c038e6 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 _0x1193=['update','then','destroy','get','CustomDashboards','error','stack','name','send','index','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','map','type','VIRTUAL','Dashboard','includeAll','findAll','rows','show','params','include','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','catch','clone','omit','createdAt','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','reportType','attrReport','attrRefresh','stringify','DashboardId','getItems','findOne','DashboardItem','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','lodash','squel','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','sendStatus','status','end','count','offset','limit','Content-Range','json','apply','reject'];(function(_0x4a3ac8,_0x2699f8){var _0xd84d0=function(_0x574bd7){while(--_0x574bd7){_0x4a3ac8['push'](_0x4a3ac8['shift']());}};_0xd84d0(++_0x2699f8);}(_0x1193,0xcd));var _0x3119=function(_0x3ad64e,_0x3641ef){_0x3ad64e=_0x3ad64e-0x0;var _0x461f83=_0x1193[_0x3ad64e];return _0x461f83;};'use strict';var pdf=require(_0x3119('0x0'));var emlformat=require(_0x3119('0x1'));var rimraf=require(_0x3119('0x2'));var zipdir=require(_0x3119('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3119('0x4'));var moment=require(_0x3119('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x3119('0x6'));var util=require(_0x3119('0x7'));var path=require(_0x3119('0x8'));var sox=require(_0x3119('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x3119('0xa'));var squel=require(_0x3119('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3119('0xc'));var Papa=require(_0x3119('0xd'));var Redis=require(_0x3119('0xe'));var authService=require(_0x3119('0xf'));var qs=require(_0x3119('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3119('0x11'));var logger=require(_0x3119('0x12'))(_0x3119('0x13'));var utils=require(_0x3119('0x14'));var config=require(_0x3119('0x15'));var db=require(_0x3119('0x16'))['db'];config['redis']=_[_0x3119('0x17')](config[_0x3119('0x18')],{'host':_0x3119('0x19'),'port':0x18eb});var socket=require(_0x3119('0x1a'))(new Redis(config['redis']));require('./dashboard.socket')['register'](socket);function respondWithStatusCode(_0x10f404,_0x3787cb){_0x3787cb=_0x3787cb||0xcc;return function(_0x4b63c1){if(_0x4b63c1){return _0x10f404[_0x3119('0x1b')](_0x3787cb);}return _0x10f404[_0x3119('0x1c')](_0x3787cb)[_0x3119('0x1d')]();};}function respondWithResult(_0x31c9e8,_0x10c1be){_0x10c1be=_0x10c1be||0xc8;return function(_0x5c64c1){if(_0x5c64c1){return _0x31c9e8[_0x3119('0x1c')](_0x10c1be)['json'](_0x5c64c1);}};}function respondWithFilteredResult(_0x113c07,_0x5e7a83){return function(_0x4b4f6b){if(_0x4b4f6b){var _0x3382e5=_0x4b4f6b[_0x3119('0x1e')],_0x17eff6=_0x5e7a83[_0x3119('0x1f')],_0x44de71=_0x5e7a83[_0x3119('0x1f')]+_0x5e7a83[_0x3119('0x20')],_0x49093b;if(_0x44de71>=_0x3382e5){_0x44de71=_0x3382e5;_0x49093b=0xc8;}else{_0x49093b=0xce;}_0x113c07[_0x3119('0x1c')](_0x49093b);return _0x113c07['set'](_0x3119('0x21'),_0x17eff6+'-'+_0x44de71+'/'+_0x3382e5)[_0x3119('0x22')](_0x4b4f6b);}return null;};}function patchUpdates(_0x1c62cd){return function(_0x522d3d){try{jsonpatch[_0x3119('0x23')](_0x522d3d,_0x1c62cd,!![]);}catch(_0x15294d){return BPromise[_0x3119('0x24')](_0x15294d);}return _0x522d3d['save']();};}function saveUpdates(_0x1ddd68,_0x5d50a4){return function(_0x819bf6){if(_0x819bf6){return _0x819bf6[_0x3119('0x25')](_0x1ddd68)[_0x3119('0x26')](function(_0x5f5c09){return _0x5f5c09;});}return null;};}function removeEntity(_0x3934dd,_0x3cfd27){return function(_0x237298){if(_0x237298){return _0x237298[_0x3119('0x27')]()['then'](function(){var _0xd2eaa8=_0x237298[_0x3119('0x28')]({'plain':!![]});var _0x2fabff=_0x3119('0x29');return db['UserProfileResource'][_0x3119('0x27')]({'where':{'type':_0x2fabff,'resourceId':_0xd2eaa8['id']}})[_0x3119('0x26')](function(){return _0x237298;});})[_0x3119('0x26')](function(){_0x3934dd[_0x3119('0x1c')](0xcc)[_0x3119('0x1d')]();});}};}function handleEntityNotFound(_0x14e23a,_0x50cf71){return function(_0x238cc3){if(!_0x238cc3){_0x14e23a[_0x3119('0x1b')](0x194);}return _0x238cc3;};}function handleError(_0x47e926,_0x44f9f5){_0x44f9f5=_0x44f9f5||0x1f4;return function(_0x4e4725){logger[_0x3119('0x2a')](_0x4e4725[_0x3119('0x2b')]);if(_0x4e4725['name']){delete _0x4e4725[_0x3119('0x2c')];}_0x47e926[_0x3119('0x1c')](_0x44f9f5)[_0x3119('0x2d')](_0x4e4725);};}exports[_0x3119('0x2e')]=function(_0x48197e,_0x57a734){var _0x370eb6={},_0x47c483={},_0xcb04f7={'count':0x0,'rows':[]};var _0xb496f3=_['map'](db['Dashboard'][_0x3119('0x2f')],function(_0x26121e){return{'name':_0x26121e['fieldName'],'type':_0x26121e['type'][_0x3119('0x30')]};});_0x47c483[_0x3119('0x31')]=_['map'](_0xb496f3,_0x3119('0x2c'));_0x47c483[_0x3119('0x32')]=_[_0x3119('0x33')](_0x48197e[_0x3119('0x32')]);_0x47c483[_0x3119('0x34')]=_['intersection'](_0x47c483['model'],_0x47c483[_0x3119('0x32')]);_0x370eb6['attributes']=_[_0x3119('0x35')](_0x47c483[_0x3119('0x31')],qs['fields'](_0x48197e[_0x3119('0x32')][_0x3119('0x36')]));_0x370eb6[_0x3119('0x37')]=_0x370eb6[_0x3119('0x37')][_0x3119('0x38')]?_0x370eb6[_0x3119('0x37')]:_0x47c483[_0x3119('0x31')];if(!_0x48197e[_0x3119('0x32')][_0x3119('0x39')](_0x3119('0x3a'))){_0x370eb6['limit']=qs['limit'](_0x48197e['query'][_0x3119('0x20')]);_0x370eb6[_0x3119('0x1f')]=qs['offset'](_0x48197e[_0x3119('0x32')][_0x3119('0x1f')]);}_0x370eb6[_0x3119('0x3b')]=qs[_0x3119('0x3c')](_0x48197e['query'][_0x3119('0x3c')]);_0x370eb6['where']=qs['filters'](_[_0x3119('0x3d')](_0x48197e[_0x3119('0x32')],_0x47c483['filters']),_0xb496f3);if(_0x48197e['query'][_0x3119('0x3e')]){_0x370eb6[_0x3119('0x3f')]=_[_0x3119('0x40')](_0x370eb6[_0x3119('0x3f')],{'$or':_[_0x3119('0x41')](_0xb496f3,function(_0x21ffd1){if(_0x21ffd1[_0x3119('0x42')]!==_0x3119('0x43')){var _0x906364={};_0x906364[_0x21ffd1[_0x3119('0x2c')]]={'$like':'%'+_0x48197e[_0x3119('0x32')][_0x3119('0x3e')]+'%'};return _0x906364;}})});}_0x370eb6=_[_0x3119('0x40')]({},_0x370eb6,_0x48197e['options']);var _0x27129d={'where':_0x370eb6['where']};return db[_0x3119('0x44')]['count'](_0x27129d)[_0x3119('0x26')](function(_0x28e74a){_0xcb04f7[_0x3119('0x1e')]=_0x28e74a;if(_0x48197e[_0x3119('0x32')][_0x3119('0x45')]){_0x370eb6['include']=[{'all':!![]}];}return db[_0x3119('0x44')][_0x3119('0x46')](_0x370eb6);})[_0x3119('0x26')](function(_0x3e3159){_0xcb04f7[_0x3119('0x47')]=_0x3e3159;return _0xcb04f7;})[_0x3119('0x26')](respondWithFilteredResult(_0x57a734,_0x370eb6))['catch'](handleError(_0x57a734,null));};exports[_0x3119('0x48')]=function(_0xefbb0d,_0x3915c8){var _0xf65160={'raw':![],'where':{'id':_0xefbb0d[_0x3119('0x49')]['id']}},_0xce943c={};_0xce943c[_0x3119('0x31')]=_[_0x3119('0x33')](db[_0x3119('0x44')][_0x3119('0x2f')]);_0xce943c[_0x3119('0x32')]=_['keys'](_0xefbb0d[_0x3119('0x32')]);_0xce943c['filters']=_[_0x3119('0x35')](_0xce943c[_0x3119('0x31')],_0xce943c[_0x3119('0x32')]);_0xf65160['attributes']=_['intersection'](_0xce943c['model'],qs[_0x3119('0x36')](_0xefbb0d[_0x3119('0x32')][_0x3119('0x36')]));_0xf65160[_0x3119('0x37')]=_0xf65160[_0x3119('0x37')]['length']?_0xf65160[_0x3119('0x37')]:_0xce943c['model'];if(_0xefbb0d['query'][_0x3119('0x45')]){_0xf65160[_0x3119('0x4a')]=[{'all':!![]}];}_0xf65160=_[_0x3119('0x40')]({},_0xf65160,_0xefbb0d[_0x3119('0x4b')]);return db[_0x3119('0x44')][_0x3119('0x4c')](_0xf65160)['then'](handleEntityNotFound(_0x3915c8,null))[_0x3119('0x26')](respondWithResult(_0x3915c8,null))['catch'](handleError(_0x3915c8,null));};exports[_0x3119('0x4d')]=function(_0x18dc94,_0x7ed69a){return db[_0x3119('0x44')]['create'](_0x18dc94[_0x3119('0x4e')],{})[_0x3119('0x26')](function(_0x543780){var _0xf1da94=_0x18dc94[_0x3119('0x4f')][_0x3119('0x28')]({'plain':!![]});if(!_0xf1da94)throw new Error(_0x3119('0x50'));if(_0xf1da94[_0x3119('0x51')]===_0x3119('0x4f')){var _0x25db96=_0x543780[_0x3119('0x28')]({'plain':!![]});var _0x50d8d8=_0x3119('0x29');return db[_0x3119('0x52')]['find']({'where':{'name':_0x50d8d8,'userProfileId':_0xf1da94[_0x3119('0x53')]},'raw':!![]})[_0x3119('0x26')](function(_0x2b9f0b){if(_0x2b9f0b&&_0x2b9f0b['autoAssociation']===0x0){return db['UserProfileResource'][_0x3119('0x4d')]({'name':_0x25db96[_0x3119('0x2c')],'resourceId':_0x25db96['id'],'type':_0x2b9f0b['name'],'sectionId':_0x2b9f0b['id']},{})[_0x3119('0x26')](function(){return _0x543780;});}else{return _0x543780;}})[_0x3119('0x54')](function(_0x236a3a){logger[_0x3119('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x236a3a);throw _0x236a3a;});}return _0x543780;})[_0x3119('0x26')](respondWithResult(_0x7ed69a,0xc9))[_0x3119('0x54')](handleError(_0x7ed69a,null));};exports[_0x3119('0x55')]=function(_0x83751e,_0x43c2df){var _0x304f5e={'where':{'id':_0x83751e['params']['id']}},_0x1eef85={};_0x1eef85[_0x3119('0x31')]=_[_0x3119('0x33')](db[_0x3119('0x44')][_0x3119('0x2f')]);_0x304f5e[_0x3119('0x37')]=_[_0x3119('0x35')](_0x1eef85[_0x3119('0x31')],qs[_0x3119('0x36')](_0x83751e[_0x3119('0x32')][_0x3119('0x36')]));_0x304f5e[_0x3119('0x37')]=_0x304f5e[_0x3119('0x37')]['length']?_0x304f5e['attributes']:_0x1eef85['model'];if(_0x83751e[_0x3119('0x32')][_0x3119('0x45')]){_0x304f5e[_0x3119('0x4a')]=[{'all':!![]}];}_0x304f5e=_[_0x3119('0x40')]({},_0x304f5e,_0x83751e[_0x3119('0x4b')]);return db[_0x3119('0x44')][_0x3119('0x4c')](_0x304f5e)[_0x3119('0x26')](handleEntityNotFound(_0x43c2df,null))['then'](function(_0x1c76b3){if(_0x1c76b3){var _0x5bac3e=_0x1c76b3[_0x3119('0x28')]({'plain':!![]});_0x5bac3e=qs[_0x3119('0x56')](_0x5bac3e,['id',_0x3119('0x57'),'updatedAt']);_0x83751e[_0x3119('0x4e')]=_[_0x3119('0x56')](_0x83751e['body'],['id','createdAt','updatedAt']);return db['Dashboard'][_0x3119('0x4d')](_['merge'](_0x5bac3e,_0x83751e[_0x3119('0x4e')]),{'include':_0x83751e['query'][_0x3119('0x45')]?[{'all':!![]}]:undefined})[_0x3119('0x26')](function(_0x1d5ff5){var _0x7b43d9=_0x83751e[_0x3119('0x4f')]['get']({'plain':!![]});if(!_0x7b43d9)throw new Error(_0x3119('0x50'));if(_0x7b43d9['role']===_0x3119('0x4f')){var _0x530cc7=_0x1d5ff5[_0x3119('0x28')]({'plain':!![]});var _0x56ce08=_0x3119('0x29');return db[_0x3119('0x52')][_0x3119('0x4c')]({'where':{'name':_0x56ce08,'userProfileId':_0x7b43d9[_0x3119('0x53')]},'raw':!![]})[_0x3119('0x26')](function(_0x4d1344){if(_0x4d1344&&_0x4d1344[_0x3119('0x58')]===0x0){return db[_0x3119('0x59')][_0x3119('0x4d')]({'name':_0x530cc7['name'],'resourceId':_0x530cc7['id'],'type':_0x4d1344[_0x3119('0x2c')],'sectionId':_0x4d1344['id']},{})[_0x3119('0x26')](function(){return _0x1d5ff5;});}else{return _0x1d5ff5;}})[_0x3119('0x54')](function(_0x45fb1c){logger['error'](_0x3119('0x5a'),_0x45fb1c);throw _0x45fb1c;});}return _0x1d5ff5;});}})['then'](respondWithResult(_0x43c2df,0xc9))['catch'](handleError(_0x43c2df,null));};exports[_0x3119('0x25')]=function(_0x30f851,_0x3f00c9){if(_0x30f851[_0x3119('0x4e')]['id']){delete _0x30f851['body']['id'];}return db[_0x3119('0x44')][_0x3119('0x4c')]({'where':{'id':_0x30f851[_0x3119('0x49')]['id']}})['then'](handleEntityNotFound(_0x3f00c9,null))[_0x3119('0x26')](saveUpdates(_0x30f851[_0x3119('0x4e')],null))['then'](respondWithResult(_0x3f00c9,null))[_0x3119('0x54')](handleError(_0x3f00c9,null));};exports['destroy']=function(_0x495f9a,_0x15326d){return db[_0x3119('0x44')][_0x3119('0x4c')]({'where':{'id':_0x495f9a[_0x3119('0x49')]['id']}})[_0x3119('0x26')](handleEntityNotFound(_0x15326d,null))[_0x3119('0x26')](removeEntity(_0x15326d,null))['catch'](handleError(_0x15326d,null));};function widgetAttributes(_0x207e20){try{switch(_0x207e20[_0x3119('0x42')]){case'iframe':return[{'name':_0x3119('0x5b'),'value':_0x207e20['attrUrl']||(_0x207e20[_0x3119('0x5c')]&&_0x207e20[_0x3119('0x5c')][0x0]?_0x207e20['attrs'][0x0][_0x3119('0x5d')]:undefined)||_0x3119('0x5e')}];case _0x3119('0x5f'):return[{'name':_0x3119('0x60'),'value':_0x207e20[_0x3119('0x60')]||(_0x207e20['attrs']&&_0x207e20[_0x3119('0x5c')][0x0]?_0x207e20[_0x3119('0x5c')][0x0][_0x3119('0x5d')]:undefined)||''}];case _0x3119('0x61'):return[{'name':_0x3119('0x62'),'value':_0x207e20[_0x3119('0x62')]||(_0x207e20[_0x3119('0x5c')]&&_0x207e20[_0x3119('0x5c')][0x0]?_0x207e20[_0x3119('0x5c')][0x0][_0x3119('0x5d')]:undefined)||_0x3119('0x63')},{'name':_0x3119('0x64'),'value':_0x207e20[_0x3119('0x64')]||(_0x207e20[_0x3119('0x5c')]&&_0x207e20[_0x3119('0x5c')][0x1]?_0x207e20[_0x3119('0x5c')][0x1][_0x3119('0x5d')]:undefined)||_0x3119('0x65')},{'name':_0x3119('0x66'),'value':_0x207e20[_0x3119('0x66')]||(_0x207e20['attrs']&&_0x207e20['attrs'][0x2]?_0x207e20[_0x3119('0x5c')][0x2][_0x3119('0x5d')]:undefined)||0xc}];case _0x3119('0x67'):return[{'name':_0x3119('0x68'),'value':_0x207e20[_0x3119('0x68')]||(_0x207e20['attrs']&&_0x207e20['attrs'][0x0]?_0x207e20['attrs'][0x0][_0x3119('0x5d')]:undefined)||_0x3119('0x69')},{'name':'attrVoiceQueues','value':_0x207e20[_0x3119('0x6a')]||(_0x207e20['attrs']&&_0x207e20[_0x3119('0x5c')][0x1]?_0x207e20[_0x3119('0x5c')][0x1][_0x3119('0x5d')]:undefined)||[]},{'name':_0x3119('0x66'),'value':_0x207e20['attrFontSize']||(_0x207e20[_0x3119('0x5c')]&&_0x207e20['attrs'][0x2]?_0x207e20[_0x3119('0x5c')][0x2][_0x3119('0x5d')]:undefined)||0x14}];case _0x3119('0x6b'):case _0x3119('0x6c'):return[{'name':_0x3119('0x6d'),'value':_0x207e20[_0x3119('0x6d')]||(_0x207e20[_0x3119('0x5c')]&&_0x207e20[_0x3119('0x5c')][0x0]?_0x207e20[_0x3119('0x5c')][0x0][_0x3119('0x5d')]:undefined)||_0x3119('0x69')},{'name':_0x3119('0x6e'),'value':_0x207e20[_0x3119('0x6e')]||(_0x207e20[_0x3119('0x5c')]&&_0x207e20[_0x3119('0x5c')][0x1]?_0x207e20[_0x3119('0x5c')][0x1][_0x3119('0x5d')]:undefined)||null},{'name':'attrSerie3','value':_0x207e20[_0x3119('0x6f')]||(_0x207e20['attrs']&&_0x207e20['attrs'][0x2]?_0x207e20[_0x3119('0x5c')][0x2][_0x3119('0x5d')]:undefined)||null},{'name':_0x3119('0x6a'),'value':_0x207e20[_0x3119('0x6a')]||(_0x207e20['attrs']&&_0x207e20[_0x3119('0x5c')][0x3]?_0x207e20[_0x3119('0x5c')][0x3][_0x3119('0x5d')]:undefined)||[]}];case _0x3119('0x70'):return[{'name':'attrReport','type':_0x207e20[_0x3119('0x71')]||(_0x207e20[_0x3119('0x5c')]&&_0x207e20['attrs'][0x0]?_0x207e20[_0x3119('0x5c')][0x0][_0x3119('0x42')]:undefined)||null,'value':_0x207e20[_0x3119('0x72')]||(_0x207e20['attrs']&&_0x207e20[_0x3119('0x5c')][0x0]?_0x207e20[_0x3119('0x5c')][0x0]['value']:undefined)||null},{'name':'attrRefresh','value':_0x207e20[_0x3119('0x73')]||(_0x207e20['attrs']&&_0x207e20[_0x3119('0x5c')][0x1]?_0x207e20[_0x3119('0x5c')][0x1][_0x3119('0x5d')]:undefined)||0x0}];default:return[];}}catch(_0x37be01){logger[_0x3119('0x2a')]('widgetAttributes:\x20%s',JSON[_0x3119('0x74')](_0x37be01));return[];}}exports['addItem']=function(_0xd58eb4,_0x39d050,_0x2b9d32){if(_0xd58eb4[_0x3119('0x4e')]['id']){delete _0xd58eb4['body']['id'];}return db['Dashboard'][_0x3119('0x4c')]({'where':{'id':_0xd58eb4[_0x3119('0x49')]['id']}})[_0x3119('0x26')](handleEntityNotFound(_0x39d050,null))[_0x3119('0x26')](function(_0xccaa47){if(_0xccaa47){_0xd58eb4[_0x3119('0x4e')][_0x3119('0x75')]=_0xccaa47['id'];_0xd58eb4['body'][_0x3119('0x5c')]=widgetAttributes(_0xd58eb4[_0x3119('0x4e')]);return db['DashboardItem']['create'](_0xd58eb4[_0x3119('0x4e')]);}})[_0x3119('0x26')](respondWithResult(_0x39d050,null))['catch'](handleError(_0x39d050,null));};exports[_0x3119('0x76')]=function(_0x2d2f76,_0x52822f,_0x1dd78b){var _0x240933={};var _0x15832b={};var _0x15569e;var _0x5bc149;return db[_0x3119('0x44')][_0x3119('0x77')]({'where':{'id':_0x2d2f76[_0x3119('0x49')]['id']}})['then'](handleEntityNotFound(_0x52822f,null))['then'](function(_0x56c269){if(_0x56c269){_0x15569e=_0x56c269;_0x15832b[_0x3119('0x31')]=_['keys'](db[_0x3119('0x78')][_0x3119('0x2f')]);_0x15832b[_0x3119('0x32')]=_[_0x3119('0x33')](_0x2d2f76[_0x3119('0x32')]);_0x15832b[_0x3119('0x34')]=_[_0x3119('0x35')](_0x15832b[_0x3119('0x31')],_0x15832b['query']);_0x240933['attributes']=_[_0x3119('0x35')](_0x15832b[_0x3119('0x31')],qs['fields'](_0x2d2f76[_0x3119('0x32')][_0x3119('0x36')]));_0x240933[_0x3119('0x37')]=_0x240933[_0x3119('0x37')][_0x3119('0x38')]?_0x240933[_0x3119('0x37')]:_0x15832b[_0x3119('0x31')];_0x240933['order']=qs[_0x3119('0x3c')](_0x2d2f76[_0x3119('0x32')][_0x3119('0x3c')]);_0x240933['where']=qs[_0x3119('0x34')](_[_0x3119('0x3d')](_0x2d2f76[_0x3119('0x32')],_0x15832b[_0x3119('0x34')]));if(_0x2d2f76[_0x3119('0x32')][_0x3119('0x3e')]){_0x240933[_0x3119('0x3f')]=_[_0x3119('0x40')](_0x240933['where'],{'$or':_[_0x3119('0x41')](_0x240933[_0x3119('0x37')],function(_0x1958d4){var _0x3d59a4={};_0x3d59a4[_0x1958d4]={'$like':'%'+_0x2d2f76['query']['filter']+'%'};return _0x3d59a4;})});}_0x240933=_[_0x3119('0x40')]({},_0x240933,_0x2d2f76['options']);return _0x15569e[_0x3119('0x76')](_0x240933);}})[_0x3119('0x26')](function(_0x425443){if(_0x425443){_0x5bc149=_0x425443[_0x3119('0x38')];if(!_0x2d2f76[_0x3119('0x32')][_0x3119('0x39')]('nolimit')){_0x240933[_0x3119('0x20')]=qs['limit'](_0x2d2f76[_0x3119('0x32')][_0x3119('0x20')]);_0x240933['offset']=qs[_0x3119('0x1f')](_0x2d2f76[_0x3119('0x32')][_0x3119('0x1f')]);}return _0x15569e['getItems'](_0x240933);}})[_0x3119('0x26')](function(_0x2229eb){if(_0x2229eb){return _0x2229eb?{'count':_0x5bc149,'rows':_0x2229eb}:null;}})['then'](respondWithResult(_0x52822f,null))[_0x3119('0x54')](handleError(_0x52822f,null));}; \ No newline at end of file +var _0x9d96=['counter','attrMetric','total','attrVoiceQueues','multibar-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','DashboardId','findOne','getItems','hasOwnProperty','html-pdf','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','status','json','count','limit','apply','reject','save','then','get','CustomDashboards','UserProfileResource','destroy','error','stack','name','index','Dashboard','rawAttributes','type','key','model','map','query','filters','intersection','attributes','fields','length','offset','order','sort','pick','where','filter','merge','includeAll','include','findAll','rows','show','params','keys','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','catch','omit','updatedAt','createdAt','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','iframe','attrUrl','attrs','value','custom','attrPath','attrHourFormat','attrTimezone','0.00','attrFontSize'];(function(_0x330d1f,_0x47c710){var _0x1df784=function(_0x3ec796){while(--_0x3ec796){_0x330d1f['push'](_0x330d1f['shift']());}};_0x1df784(++_0x47c710);}(_0x9d96,0x162));var _0x69d9=function(_0x15340e,_0x5245b4){_0x15340e=_0x15340e-0x0;var _0x5597c4=_0x9d96[_0x15340e];return _0x5597c4;};'use strict';var pdf=require(_0x69d9('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x69d9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x69d9('0x2'));var rp=require(_0x69d9('0x3'));var moment=require('moment');var BPromise=require(_0x69d9('0x4'));var Mustache=require(_0x69d9('0x5'));var util=require(_0x69d9('0x6'));var path=require(_0x69d9('0x7'));var sox=require('sox');var csv=require(_0x69d9('0x8'));var ejs=require(_0x69d9('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x69d9('0xa'));var crypto=require(_0x69d9('0xb'));var jsforce=require(_0x69d9('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x69d9('0xd'));var Redis=require(_0x69d9('0xe'));var authService=require(_0x69d9('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x69d9('0x10'));var hardwareService=require(_0x69d9('0x11'));var logger=require(_0x69d9('0x12'))('api');var utils=require(_0x69d9('0x13'));var config=require('../../config/environment');var db=require(_0x69d9('0x14'))['db'];config[_0x69d9('0x15')]=_[_0x69d9('0x16')](config[_0x69d9('0x15')],{'host':_0x69d9('0x17'),'port':0x18eb});var socket=require(_0x69d9('0x18'))(new Redis(config['redis']));require(_0x69d9('0x19'))[_0x69d9('0x1a')](socket);function respondWithStatusCode(_0x5cb4f0,_0x2180ac){_0x2180ac=_0x2180ac||0xcc;return function(_0x1654ee){if(_0x1654ee){return _0x5cb4f0['sendStatus'](_0x2180ac);}return _0x5cb4f0[_0x69d9('0x1b')](_0x2180ac)['end']();};}function respondWithResult(_0x583a50,_0x299967){_0x299967=_0x299967||0xc8;return function(_0x42b68b){if(_0x42b68b){return _0x583a50[_0x69d9('0x1b')](_0x299967)[_0x69d9('0x1c')](_0x42b68b);}};}function respondWithFilteredResult(_0x5a824b,_0x3ba863){return function(_0x61934e){if(_0x61934e){var _0x4180d5=_0x61934e[_0x69d9('0x1d')],_0x43caf0=_0x3ba863['offset'],_0x27b63b=_0x3ba863['offset']+_0x3ba863[_0x69d9('0x1e')],_0x5b0dde;if(_0x27b63b>=_0x4180d5){_0x27b63b=_0x4180d5;_0x5b0dde=0xc8;}else{_0x5b0dde=0xce;}_0x5a824b[_0x69d9('0x1b')](_0x5b0dde);return _0x5a824b['set']('Content-Range',_0x43caf0+'-'+_0x27b63b+'/'+_0x4180d5)[_0x69d9('0x1c')](_0x61934e);}return null;};}function patchUpdates(_0x182bea){return function(_0x1e81fe){try{jsonpatch[_0x69d9('0x1f')](_0x1e81fe,_0x182bea,!![]);}catch(_0x32f248){return BPromise[_0x69d9('0x20')](_0x32f248);}return _0x1e81fe[_0x69d9('0x21')]();};}function saveUpdates(_0x10d3a0,_0x500542){return function(_0xdb7d13){if(_0xdb7d13){return _0xdb7d13['update'](_0x10d3a0)[_0x69d9('0x22')](function(_0x2f927c){return _0x2f927c;});}return null;};}function removeEntity(_0x5e0cc9,_0x4ee228){return function(_0x2fb606){if(_0x2fb606){return _0x2fb606['destroy']()['then'](function(){var _0x8fb5a1=_0x2fb606[_0x69d9('0x23')]({'plain':!![]});var _0x532a14=_0x69d9('0x24');return db[_0x69d9('0x25')][_0x69d9('0x26')]({'where':{'type':_0x532a14,'resourceId':_0x8fb5a1['id']}})[_0x69d9('0x22')](function(){return _0x2fb606;});})[_0x69d9('0x22')](function(){_0x5e0cc9[_0x69d9('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe8aec7,_0x519d05){return function(_0x34f43b){if(!_0x34f43b){_0xe8aec7['sendStatus'](0x194);}return _0x34f43b;};}function handleError(_0xad05f6,_0x304f8a){_0x304f8a=_0x304f8a||0x1f4;return function(_0x8f82e4){logger[_0x69d9('0x27')](_0x8f82e4[_0x69d9('0x28')]);if(_0x8f82e4[_0x69d9('0x29')]){delete _0x8f82e4[_0x69d9('0x29')];}_0xad05f6[_0x69d9('0x1b')](_0x304f8a)['send'](_0x8f82e4);};}exports[_0x69d9('0x2a')]=function(_0x2c4a20,_0x34e70f){var _0x108b65={},_0x3b026d={},_0x7bebe3={'count':0x0,'rows':[]};var _0x37d50d=_['map'](db[_0x69d9('0x2b')][_0x69d9('0x2c')],function(_0x360ed4){return{'name':_0x360ed4['fieldName'],'type':_0x360ed4[_0x69d9('0x2d')][_0x69d9('0x2e')]};});_0x3b026d[_0x69d9('0x2f')]=_[_0x69d9('0x30')](_0x37d50d,'name');_0x3b026d[_0x69d9('0x31')]=_['keys'](_0x2c4a20[_0x69d9('0x31')]);_0x3b026d[_0x69d9('0x32')]=_[_0x69d9('0x33')](_0x3b026d[_0x69d9('0x2f')],_0x3b026d[_0x69d9('0x31')]);_0x108b65[_0x69d9('0x34')]=_[_0x69d9('0x33')](_0x3b026d[_0x69d9('0x2f')],qs[_0x69d9('0x35')](_0x2c4a20[_0x69d9('0x31')][_0x69d9('0x35')]));_0x108b65[_0x69d9('0x34')]=_0x108b65[_0x69d9('0x34')][_0x69d9('0x36')]?_0x108b65[_0x69d9('0x34')]:_0x3b026d['model'];if(!_0x2c4a20[_0x69d9('0x31')]['hasOwnProperty']('nolimit')){_0x108b65['limit']=qs[_0x69d9('0x1e')](_0x2c4a20[_0x69d9('0x31')][_0x69d9('0x1e')]);_0x108b65[_0x69d9('0x37')]=qs['offset'](_0x2c4a20['query'][_0x69d9('0x37')]);}_0x108b65[_0x69d9('0x38')]=qs[_0x69d9('0x39')](_0x2c4a20[_0x69d9('0x31')]['sort']);_0x108b65['where']=qs['filters'](_[_0x69d9('0x3a')](_0x2c4a20['query'],_0x3b026d[_0x69d9('0x32')]),_0x37d50d);if(_0x2c4a20['query']['filter']){_0x108b65['where']=_['merge'](_0x108b65[_0x69d9('0x3b')],{'$or':_[_0x69d9('0x30')](_0x37d50d,function(_0x4c7a2d){if(_0x4c7a2d['type']!=='VIRTUAL'){var _0x2e6cb6={};_0x2e6cb6[_0x4c7a2d[_0x69d9('0x29')]]={'$like':'%'+_0x2c4a20[_0x69d9('0x31')][_0x69d9('0x3c')]+'%'};return _0x2e6cb6;}})});}_0x108b65=_[_0x69d9('0x3d')]({},_0x108b65,_0x2c4a20['options']);var _0x3ce2c9={'where':_0x108b65[_0x69d9('0x3b')]};return db['Dashboard'][_0x69d9('0x1d')](_0x3ce2c9)[_0x69d9('0x22')](function(_0x579bdb){_0x7bebe3[_0x69d9('0x1d')]=_0x579bdb;if(_0x2c4a20[_0x69d9('0x31')][_0x69d9('0x3e')]){_0x108b65[_0x69d9('0x3f')]=[{'all':!![]}];}return db[_0x69d9('0x2b')][_0x69d9('0x40')](_0x108b65);})[_0x69d9('0x22')](function(_0xada8d1){_0x7bebe3[_0x69d9('0x41')]=_0xada8d1;return _0x7bebe3;})[_0x69d9('0x22')](respondWithFilteredResult(_0x34e70f,_0x108b65))['catch'](handleError(_0x34e70f,null));};exports[_0x69d9('0x42')]=function(_0x53f9fe,_0x31350e){var _0x5d8ebe={'raw':![],'where':{'id':_0x53f9fe[_0x69d9('0x43')]['id']}},_0x1c191c={};_0x1c191c[_0x69d9('0x2f')]=_[_0x69d9('0x44')](db[_0x69d9('0x2b')][_0x69d9('0x2c')]);_0x1c191c[_0x69d9('0x31')]=_[_0x69d9('0x44')](_0x53f9fe[_0x69d9('0x31')]);_0x1c191c[_0x69d9('0x32')]=_[_0x69d9('0x33')](_0x1c191c[_0x69d9('0x2f')],_0x1c191c[_0x69d9('0x31')]);_0x5d8ebe[_0x69d9('0x34')]=_[_0x69d9('0x33')](_0x1c191c[_0x69d9('0x2f')],qs['fields'](_0x53f9fe[_0x69d9('0x31')]['fields']));_0x5d8ebe[_0x69d9('0x34')]=_0x5d8ebe[_0x69d9('0x34')][_0x69d9('0x36')]?_0x5d8ebe[_0x69d9('0x34')]:_0x1c191c[_0x69d9('0x2f')];if(_0x53f9fe['query'][_0x69d9('0x3e')]){_0x5d8ebe[_0x69d9('0x3f')]=[{'all':!![]}];}_0x5d8ebe=_[_0x69d9('0x3d')]({},_0x5d8ebe,_0x53f9fe[_0x69d9('0x45')]);return db[_0x69d9('0x2b')][_0x69d9('0x46')](_0x5d8ebe)['then'](handleEntityNotFound(_0x31350e,null))['then'](respondWithResult(_0x31350e,null))['catch'](handleError(_0x31350e,null));};exports[_0x69d9('0x47')]=function(_0x30f67b,_0x2d4b87){return db[_0x69d9('0x2b')][_0x69d9('0x47')](_0x30f67b[_0x69d9('0x48')],{})[_0x69d9('0x22')](function(_0x51ee44){var _0x1564d8=_0x30f67b[_0x69d9('0x49')][_0x69d9('0x23')]({'plain':!![]});if(!_0x1564d8)throw new Error(_0x69d9('0x4a'));if(_0x1564d8[_0x69d9('0x4b')]==='user'){var _0x2d47cd=_0x51ee44[_0x69d9('0x23')]({'plain':!![]});var _0x2ad632=_0x69d9('0x24');return db[_0x69d9('0x4c')]['find']({'where':{'name':_0x2ad632,'userProfileId':_0x1564d8[_0x69d9('0x4d')]},'raw':!![]})['then'](function(_0x5818cd){if(_0x5818cd&&_0x5818cd[_0x69d9('0x4e')]===0x0){return db[_0x69d9('0x25')][_0x69d9('0x47')]({'name':_0x2d47cd[_0x69d9('0x29')],'resourceId':_0x2d47cd['id'],'type':_0x5818cd[_0x69d9('0x29')],'sectionId':_0x5818cd['id']},{})[_0x69d9('0x22')](function(){return _0x51ee44;});}else{return _0x51ee44;}})['catch'](function(_0x2c9532){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2c9532);throw _0x2c9532;});}return _0x51ee44;})[_0x69d9('0x22')](respondWithResult(_0x2d4b87,0xc9))[_0x69d9('0x4f')](handleError(_0x2d4b87,null));};exports['clone']=function(_0x3cfe27,_0x120c91){var _0x4c2c2a={'where':{'id':_0x3cfe27['params']['id']}},_0x5908c1={};_0x5908c1['model']=_[_0x69d9('0x44')](db[_0x69d9('0x2b')][_0x69d9('0x2c')]);_0x4c2c2a['attributes']=_[_0x69d9('0x33')](_0x5908c1[_0x69d9('0x2f')],qs[_0x69d9('0x35')](_0x3cfe27[_0x69d9('0x31')][_0x69d9('0x35')]));_0x4c2c2a[_0x69d9('0x34')]=_0x4c2c2a[_0x69d9('0x34')]['length']?_0x4c2c2a[_0x69d9('0x34')]:_0x5908c1['model'];if(_0x3cfe27[_0x69d9('0x31')]['includeAll']){_0x4c2c2a[_0x69d9('0x3f')]=[{'all':!![]}];}_0x4c2c2a=_[_0x69d9('0x3d')]({},_0x4c2c2a,_0x3cfe27[_0x69d9('0x45')]);return db[_0x69d9('0x2b')][_0x69d9('0x46')](_0x4c2c2a)['then'](handleEntityNotFound(_0x120c91,null))[_0x69d9('0x22')](function(_0x1d0b38){if(_0x1d0b38){var _0x192b9f=_0x1d0b38[_0x69d9('0x23')]({'plain':!![]});_0x192b9f=qs[_0x69d9('0x50')](_0x192b9f,['id','createdAt',_0x69d9('0x51')]);_0x3cfe27['body']=_[_0x69d9('0x50')](_0x3cfe27[_0x69d9('0x48')],['id',_0x69d9('0x52'),_0x69d9('0x51')]);return db[_0x69d9('0x2b')][_0x69d9('0x47')](_[_0x69d9('0x3d')](_0x192b9f,_0x3cfe27[_0x69d9('0x48')]),{'include':_0x3cfe27[_0x69d9('0x31')][_0x69d9('0x3e')]?[{'all':!![]}]:undefined})[_0x69d9('0x22')](function(_0x50590c){var _0x30fd23=_0x3cfe27[_0x69d9('0x49')][_0x69d9('0x23')]({'plain':!![]});if(!_0x30fd23)throw new Error(_0x69d9('0x4a'));if(_0x30fd23['role']===_0x69d9('0x49')){var _0x31b3a5=_0x50590c[_0x69d9('0x23')]({'plain':!![]});var _0x5709cf=_0x69d9('0x24');return db['UserProfileSection'][_0x69d9('0x46')]({'where':{'name':_0x5709cf,'userProfileId':_0x30fd23[_0x69d9('0x4d')]},'raw':!![]})[_0x69d9('0x22')](function(_0x41e17e){if(_0x41e17e&&_0x41e17e['autoAssociation']===0x0){return db[_0x69d9('0x25')]['create']({'name':_0x31b3a5[_0x69d9('0x29')],'resourceId':_0x31b3a5['id'],'type':_0x41e17e[_0x69d9('0x29')],'sectionId':_0x41e17e['id']},{})[_0x69d9('0x22')](function(){return _0x50590c;});}else{return _0x50590c;}})[_0x69d9('0x4f')](function(_0x131fe2){logger[_0x69d9('0x27')](_0x69d9('0x53'),_0x131fe2);throw _0x131fe2;});}return _0x50590c;});}})['then'](respondWithResult(_0x120c91,0xc9))[_0x69d9('0x4f')](handleError(_0x120c91,null));};exports['update']=function(_0x589c61,_0x2bd4b7){if(_0x589c61[_0x69d9('0x48')]['id']){delete _0x589c61[_0x69d9('0x48')]['id'];}return db['Dashboard'][_0x69d9('0x46')]({'where':{'id':_0x589c61['params']['id']}})['then'](handleEntityNotFound(_0x2bd4b7,null))[_0x69d9('0x22')](saveUpdates(_0x589c61[_0x69d9('0x48')],null))['then'](respondWithResult(_0x2bd4b7,null))['catch'](handleError(_0x2bd4b7,null));};exports[_0x69d9('0x26')]=function(_0x3dfe4e,_0x58622b){return db[_0x69d9('0x2b')]['find']({'where':{'id':_0x3dfe4e['params']['id']}})['then'](handleEntityNotFound(_0x58622b,null))[_0x69d9('0x22')](removeEntity(_0x58622b,null))['catch'](handleError(_0x58622b,null));};function widgetAttributes(_0x5c3376){try{switch(_0x5c3376[_0x69d9('0x2d')]){case _0x69d9('0x54'):return[{'name':_0x69d9('0x55'),'value':_0x5c3376[_0x69d9('0x55')]||(_0x5c3376[_0x69d9('0x56')]&&_0x5c3376[_0x69d9('0x56')][0x0]?_0x5c3376[_0x69d9('0x56')][0x0][_0x69d9('0x57')]:undefined)||'https://'}];case _0x69d9('0x58'):return[{'name':_0x69d9('0x59'),'value':_0x5c3376[_0x69d9('0x59')]||(_0x5c3376[_0x69d9('0x56')]&&_0x5c3376['attrs'][0x0]?_0x5c3376[_0x69d9('0x56')][0x0][_0x69d9('0x57')]:undefined)||''}];case'clock':return[{'name':_0x69d9('0x5a'),'value':_0x5c3376[_0x69d9('0x5a')]||(_0x5c3376[_0x69d9('0x56')]&&_0x5c3376[_0x69d9('0x56')][0x0]?_0x5c3376['attrs'][0x0][_0x69d9('0x57')]:undefined)||'HH:mm:ss'},{'name':'attrTimezone','value':_0x5c3376[_0x69d9('0x5b')]||(_0x5c3376[_0x69d9('0x56')]&&_0x5c3376[_0x69d9('0x56')][0x1]?_0x5c3376['attrs'][0x1][_0x69d9('0x57')]:undefined)||_0x69d9('0x5c')},{'name':_0x69d9('0x5d'),'value':_0x5c3376[_0x69d9('0x5d')]||(_0x5c3376[_0x69d9('0x56')]&&_0x5c3376[_0x69d9('0x56')][0x2]?_0x5c3376[_0x69d9('0x56')][0x2]['value']:undefined)||0xc}];case _0x69d9('0x5e'):return[{'name':_0x69d9('0x5f'),'value':_0x5c3376[_0x69d9('0x5f')]||(_0x5c3376[_0x69d9('0x56')]&&_0x5c3376[_0x69d9('0x56')][0x0]?_0x5c3376['attrs'][0x0][_0x69d9('0x57')]:undefined)||_0x69d9('0x60')},{'name':_0x69d9('0x61'),'value':_0x5c3376['attrVoiceQueues']||(_0x5c3376[_0x69d9('0x56')]&&_0x5c3376[_0x69d9('0x56')][0x1]?_0x5c3376[_0x69d9('0x56')][0x1][_0x69d9('0x57')]:undefined)||[]},{'name':_0x69d9('0x5d'),'value':_0x5c3376[_0x69d9('0x5d')]||(_0x5c3376['attrs']&&_0x5c3376[_0x69d9('0x56')][0x2]?_0x5c3376[_0x69d9('0x56')][0x2][_0x69d9('0x57')]:undefined)||0x14}];case _0x69d9('0x62'):case'pie-chart':return[{'name':_0x69d9('0x63'),'value':_0x5c3376[_0x69d9('0x63')]||(_0x5c3376['attrs']&&_0x5c3376[_0x69d9('0x56')][0x0]?_0x5c3376[_0x69d9('0x56')][0x0][_0x69d9('0x57')]:undefined)||_0x69d9('0x60')},{'name':_0x69d9('0x64'),'value':_0x5c3376[_0x69d9('0x64')]||(_0x5c3376[_0x69d9('0x56')]&&_0x5c3376['attrs'][0x1]?_0x5c3376['attrs'][0x1][_0x69d9('0x57')]:undefined)||null},{'name':_0x69d9('0x65'),'value':_0x5c3376[_0x69d9('0x65')]||(_0x5c3376[_0x69d9('0x56')]&&_0x5c3376[_0x69d9('0x56')][0x2]?_0x5c3376[_0x69d9('0x56')][0x2]['value']:undefined)||null},{'name':_0x69d9('0x61'),'value':_0x5c3376[_0x69d9('0x61')]||(_0x5c3376[_0x69d9('0x56')]&&_0x5c3376[_0x69d9('0x56')][0x3]?_0x5c3376[_0x69d9('0x56')][0x3]['value']:undefined)||[]}];case _0x69d9('0x66'):return[{'name':_0x69d9('0x67'),'type':_0x5c3376[_0x69d9('0x68')]||(_0x5c3376[_0x69d9('0x56')]&&_0x5c3376[_0x69d9('0x56')][0x0]?_0x5c3376[_0x69d9('0x56')][0x0][_0x69d9('0x2d')]:undefined)||null,'value':_0x5c3376[_0x69d9('0x67')]||(_0x5c3376[_0x69d9('0x56')]&&_0x5c3376['attrs'][0x0]?_0x5c3376['attrs'][0x0][_0x69d9('0x57')]:undefined)||null},{'name':_0x69d9('0x69'),'value':_0x5c3376['attrRefresh']||(_0x5c3376[_0x69d9('0x56')]&&_0x5c3376['attrs'][0x1]?_0x5c3376['attrs'][0x1][_0x69d9('0x57')]:undefined)||0x0}];default:return[];}}catch(_0x25cac8){logger['error'](_0x69d9('0x6a'),JSON[_0x69d9('0x6b')](_0x25cac8));return[];}}exports['addItem']=function(_0x2cdb46,_0x3589b1,_0x5681ba){if(_0x2cdb46[_0x69d9('0x48')]['id']){delete _0x2cdb46[_0x69d9('0x48')]['id'];}return db[_0x69d9('0x2b')][_0x69d9('0x46')]({'where':{'id':_0x2cdb46[_0x69d9('0x43')]['id']}})[_0x69d9('0x22')](handleEntityNotFound(_0x3589b1,null))[_0x69d9('0x22')](function(_0x5418b5){if(_0x5418b5){_0x2cdb46[_0x69d9('0x48')][_0x69d9('0x6c')]=_0x5418b5['id'];_0x2cdb46[_0x69d9('0x48')]['attrs']=widgetAttributes(_0x2cdb46[_0x69d9('0x48')]);return db['DashboardItem'][_0x69d9('0x47')](_0x2cdb46['body']);}})[_0x69d9('0x22')](respondWithResult(_0x3589b1,null))[_0x69d9('0x4f')](handleError(_0x3589b1,null));};exports['getItems']=function(_0x366fda,_0x22b4b0,_0x37d321){var _0x3fa7fb={};var _0xfc65b9={};var _0x5c0cd1;var _0x50602d;return db[_0x69d9('0x2b')][_0x69d9('0x6d')]({'where':{'id':_0x366fda[_0x69d9('0x43')]['id']}})[_0x69d9('0x22')](handleEntityNotFound(_0x22b4b0,null))[_0x69d9('0x22')](function(_0x1532cd){if(_0x1532cd){_0x5c0cd1=_0x1532cd;_0xfc65b9[_0x69d9('0x2f')]=_[_0x69d9('0x44')](db['DashboardItem'][_0x69d9('0x2c')]);_0xfc65b9[_0x69d9('0x31')]=_['keys'](_0x366fda[_0x69d9('0x31')]);_0xfc65b9['filters']=_[_0x69d9('0x33')](_0xfc65b9[_0x69d9('0x2f')],_0xfc65b9[_0x69d9('0x31')]);_0x3fa7fb[_0x69d9('0x34')]=_[_0x69d9('0x33')](_0xfc65b9[_0x69d9('0x2f')],qs['fields'](_0x366fda[_0x69d9('0x31')][_0x69d9('0x35')]));_0x3fa7fb['attributes']=_0x3fa7fb[_0x69d9('0x34')][_0x69d9('0x36')]?_0x3fa7fb[_0x69d9('0x34')]:_0xfc65b9[_0x69d9('0x2f')];_0x3fa7fb[_0x69d9('0x38')]=qs['sort'](_0x366fda[_0x69d9('0x31')]['sort']);_0x3fa7fb['where']=qs[_0x69d9('0x32')](_[_0x69d9('0x3a')](_0x366fda['query'],_0xfc65b9[_0x69d9('0x32')]));if(_0x366fda['query'][_0x69d9('0x3c')]){_0x3fa7fb[_0x69d9('0x3b')]=_[_0x69d9('0x3d')](_0x3fa7fb['where'],{'$or':_[_0x69d9('0x30')](_0x3fa7fb[_0x69d9('0x34')],function(_0x34cfae){var _0x3d9108={};_0x3d9108[_0x34cfae]={'$like':'%'+_0x366fda[_0x69d9('0x31')][_0x69d9('0x3c')]+'%'};return _0x3d9108;})});}_0x3fa7fb=_[_0x69d9('0x3d')]({},_0x3fa7fb,_0x366fda[_0x69d9('0x45')]);return _0x5c0cd1[_0x69d9('0x6e')](_0x3fa7fb);}})[_0x69d9('0x22')](function(_0x38d37d){if(_0x38d37d){_0x50602d=_0x38d37d[_0x69d9('0x36')];if(!_0x366fda['query'][_0x69d9('0x6f')]('nolimit')){_0x3fa7fb['limit']=qs[_0x69d9('0x1e')](_0x366fda[_0x69d9('0x31')][_0x69d9('0x1e')]);_0x3fa7fb[_0x69d9('0x37')]=qs['offset'](_0x366fda[_0x69d9('0x31')][_0x69d9('0x37')]);}return _0x5c0cd1['getItems'](_0x3fa7fb);}})[_0x69d9('0x22')](function(_0x5131fe){if(_0x5131fe){return _0x5131fe?{'count':_0x50602d,'rows':_0x5131fe}:null;}})[_0x69d9('0x22')](respondWithResult(_0x22b4b0,null))['catch'](handleError(_0x22b4b0,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index ed0d5ff..f6a7627 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 _0xffc5=['Dashboard','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xffc5,0x1bf));var _0x5ffc=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0xffc5[_0x580576];return _0x3f55a0;};'use strict';var EventEmitter=require('events');var Dashboard=require(_0x5ffc('0x0'))['db'][_0x5ffc('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x5ffc('0x2'),'afterDestroy':_0x5ffc('0x3')};function emitEvent(_0x1a1e8f){return function(_0x1785c8,_0x58d4c2,_0x552532){DashboardEvents[_0x5ffc('0x4')](_0x1a1e8f+':'+_0x1785c8['id'],_0x1785c8);DashboardEvents[_0x5ffc('0x4')](_0x1a1e8f,_0x1785c8);_0x552532(null);};}for(var e in events){if(events[_0x5ffc('0x5')](e)){var event=events[e];Dashboard[_0x5ffc('0x6')](e,emitEvent(event));}}module[_0x5ffc('0x7')]=DashboardEvents; \ No newline at end of file +var _0xf260=['hasOwnProperty','hook','events','../../mysqldb','update','emit'];(function(_0x1dbcfb,_0x4ba8be){var _0x5f579b=function(_0x3c7eb0){while(--_0x3c7eb0){_0x1dbcfb['push'](_0x1dbcfb['shift']());}};_0x5f579b(++_0x4ba8be);}(_0xf260,0xda));var _0x0f26=function(_0x1ae491,_0x5b83b9){_0x1ae491=_0x1ae491-0x0;var _0x4958a5=_0xf260[_0x1ae491];return _0x4958a5;};'use strict';var EventEmitter=require(_0x0f26('0x0'));var Dashboard=require(_0x0f26('0x1'))['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x0f26('0x2'),'afterDestroy':'remove'};function emitEvent(_0x4d6acf){return function(_0x136d91,_0x4c4852,_0x4428f8){DashboardEvents[_0x0f26('0x3')](_0x4d6acf+':'+_0x136d91['id'],_0x136d91);DashboardEvents[_0x0f26('0x3')](_0x4d6acf,_0x136d91);_0x4428f8(null);};}for(var e in events){if(events[_0x0f26('0x4')](e)){var event=events[e];Dashboard[_0x0f26('0x5')](e,emitEvent(event));}}module['exports']=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index 14c63f0..b77dbf6 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 _0x7cf5=['lodash','util','../../config/logger','api','path','../../config/environment','./dashboard.attributes','exports','define','Dashboard'];(function(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0x7cf5,0x82));var _0x57cf=function(_0x199de6,_0x54e5e3){_0x199de6=_0x199de6-0x0;var _0xbae868=_0x7cf5[_0x199de6];return _0xbae868;};'use strict';var _=require(_0x57cf('0x0'));var util=require(_0x57cf('0x1'));var logger=require(_0x57cf('0x2'))(_0x57cf('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x57cf('0x4'));var rimraf=require('rimraf');var config=require(_0x57cf('0x5'));var attributes=require(_0x57cf('0x6'));module[_0x57cf('0x7')]=function(_0x47a03b,_0x8cd73e){return _0x47a03b[_0x57cf('0x8')](_0x57cf('0x9'),attributes,{'tableName':'dashboards','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x747b=['api','moment','bluebird','path','rimraf','./dashboard.attributes','define','Dashboard','dashboards','lodash','util','../../config/logger'];(function(_0x3bfe11,_0x573678){var _0x19f6b2=function(_0x561817){while(--_0x561817){_0x3bfe11['push'](_0x3bfe11['shift']());}};_0x19f6b2(++_0x573678);}(_0x747b,0xd5));var _0xb747=function(_0xbe253c,_0xc05172){_0xbe253c=_0xbe253c-0x0;var _0x77b20e=_0x747b[_0xbe253c];return _0x77b20e;};'use strict';var _=require(_0xb747('0x0'));var util=require(_0xb747('0x1'));var logger=require(_0xb747('0x2'))(_0xb747('0x3'));var moment=require(_0xb747('0x4'));var BPromise=require(_0xb747('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb747('0x6'));var rimraf=require(_0xb747('0x7'));var config=require('../../config/environment');var attributes=require(_0xb747('0x8'));module['exports']=function(_0x2130f3,_0x7068bd){return _0x2130f3[_0xb747('0x9')](_0xb747('0xa'),attributes,{'tableName':_0xb747('0xb'),'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 4ffbb52..24bfe32 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 _0xea44=['catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x25c019,_0xd5a5b8){var _0x41950d=function(_0x53381f){while(--_0x53381f){_0x25c019['push'](_0x25c019['shift']());}};_0x41950d(++_0xd5a5b8);}(_0xea44,0x1a5));var _0x4ea4=function(_0x5e8ec8,_0x2dd32b){_0x5e8ec8=_0x5e8ec8-0x0;var _0x287b71=_0xea44[_0x5e8ec8];return _0x287b71;};'use strict';var _=require(_0x4ea4('0x0'));var util=require(_0x4ea4('0x1'));var moment=require(_0x4ea4('0x2'));var BPromise=require(_0x4ea4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4ea4('0x4'));var db=require(_0x4ea4('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x4ea4('0x6'))(_0x4ea4('0x7'));var config=require(_0x4ea4('0x8'));var jayson=require(_0x4ea4('0x9'));var client=jayson['client'][_0x4ea4('0xa')]({'port':0x232a});config[_0x4ea4('0xb')]=_[_0x4ea4('0xc')](config[_0x4ea4('0xb')],{'host':_0x4ea4('0xd'),'port':0x18eb});var socket=require(_0x4ea4('0xe'))(new Redis(config[_0x4ea4('0xb')]));require(_0x4ea4('0xf'))[_0x4ea4('0x10')](socket);function respondWithRpcPromise(_0x4904a4,_0x333358,_0x56654d){return new BPromise(function(_0x4b6df1,_0x42732c){return client['request'](_0x4904a4,_0x56654d)[_0x4ea4('0x11')](function(_0x379914){logger[_0x4ea4('0x12')](_0x4ea4('0x13'),_0x333358,_0x4ea4('0x14'));logger[_0x4ea4('0x15')](_0x4ea4('0x16'),_0x333358,_0x4ea4('0x14'),JSON[_0x4ea4('0x17')](_0x379914));if(_0x379914[_0x4ea4('0x18')]){if(_0x379914[_0x4ea4('0x18')][_0x4ea4('0x19')]===0x1f4){logger[_0x4ea4('0x18')](_0x4ea4('0x13'),_0x333358,_0x379914['error'][_0x4ea4('0x1a')]);return _0x42732c(_0x379914[_0x4ea4('0x18')][_0x4ea4('0x1a')]);}logger[_0x4ea4('0x18')](_0x4ea4('0x13'),_0x333358,_0x379914[_0x4ea4('0x18')]['message']);return _0x4b6df1(_0x379914[_0x4ea4('0x18')]['message']);}else{logger['info'](_0x4ea4('0x13'),_0x333358,_0x4ea4('0x14'));_0x4b6df1(_0x379914['result'][_0x4ea4('0x1a')]);}})[_0x4ea4('0x1b')](function(_0x47e44c){logger[_0x4ea4('0x18')](_0x4ea4('0x13'),_0x333358,_0x47e44c);_0x42732c(_0x47e44c);});});} \ No newline at end of file +var _0x719c=['defaults','localhost','redis','./dashboard.socket','register','request','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/environment','http'];(function(_0x40b472,_0x34b372){var _0x4b2bf8=function(_0x4a325b){while(--_0x4a325b){_0x40b472['push'](_0x40b472['shift']());}};_0x4b2bf8(++_0x34b372);}(_0x719c,0xae));var _0xc719=function(_0x2784a9,_0x1280df){_0x2784a9=_0x2784a9-0x0;var _0x4b5ca8=_0x719c[_0x2784a9];return _0x4b5ca8;};'use strict';var _=require(_0xc719('0x0'));var util=require(_0xc719('0x1'));var moment=require(_0xc719('0x2'));var BPromise=require(_0xc719('0x3'));var rs=require(_0xc719('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xc719('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xc719('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0xc719('0x7')]({'port':0x232a});config['redis']=_[_0xc719('0x8')](config['redis'],{'host':_0xc719('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc719('0xa')]));require(_0xc719('0xb'))[_0xc719('0xc')](socket);function respondWithRpcPromise(_0x158027,_0xee2434,_0x15b61e){return new BPromise(function(_0xffb19f,_0x238a10){return client[_0xc719('0xd')](_0x158027,_0x15b61e)[_0xc719('0xe')](function(_0x2a1294){logger[_0xc719('0xf')](_0xc719('0x10'),_0xee2434,_0xc719('0x11'));logger[_0xc719('0x12')](_0xc719('0x13'),_0xee2434,_0xc719('0x11'),JSON[_0xc719('0x14')](_0x2a1294));if(_0x2a1294[_0xc719('0x15')]){if(_0x2a1294[_0xc719('0x15')][_0xc719('0x16')]===0x1f4){logger[_0xc719('0x15')](_0xc719('0x10'),_0xee2434,_0x2a1294[_0xc719('0x15')]['message']);return _0x238a10(_0x2a1294[_0xc719('0x15')][_0xc719('0x17')]);}logger[_0xc719('0x15')](_0xc719('0x10'),_0xee2434,_0x2a1294[_0xc719('0x15')][_0xc719('0x17')]);return _0xffb19f(_0x2a1294[_0xc719('0x15')][_0xc719('0x17')]);}else{logger[_0xc719('0xf')](_0xc719('0x10'),_0xee2434,'request\x20sent');_0xffb19f(_0x2a1294[_0xc719('0x18')]['message']);}})[_0xc719('0x19')](function(_0x11c01b){logger[_0xc719('0x15')](_0xc719('0x10'),_0xee2434,_0x11c01b);_0x238a10(_0x11c01b);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 6098a71..59ff5d7 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 _0x3eeb=['update','removeListener','register','length','dashboard:','./dashboard.events','save'];(function(_0x7b173,_0x539d7f){var _0x1c598c=function(_0xe1e1e0){while(--_0xe1e1e0){_0x7b173['push'](_0x7b173['shift']());}};_0x1c598c(++_0x539d7f);}(_0x3eeb,0x98));var _0xb3ee=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x3eeb[_0x6131cd];return _0x47e916;};'use strict';var DashboardEvents=require(_0xb3ee('0x0'));var events=[_0xb3ee('0x1'),'remove',_0xb3ee('0x2')];function createListener(_0x131d70,_0x3058cf){return function(_0x5f41c1){_0x3058cf['emit'](_0x131d70,_0x5f41c1);};}function removeListener(_0x170b59,_0x45cb73){return function(){DashboardEvents[_0xb3ee('0x3')](_0x170b59,_0x45cb73);};}exports[_0xb3ee('0x4')]=function(_0x222193){for(var _0x533855=0x0,_0x1eccfc=events[_0xb3ee('0x5')];_0x533855<_0x1eccfc;_0x533855++){var _0x462b4d=events[_0x533855];var _0x3f7dea=createListener(_0xb3ee('0x6')+_0x462b4d,_0x222193);DashboardEvents['on'](_0x462b4d,_0x3f7dea);}}; \ No newline at end of file +var _0x5d81=['remove','update','removeListener','register','length','dashboard:','./dashboard.events'];(function(_0x161fdc,_0x573ade){var _0x2f1b64=function(_0x2c4f44){while(--_0x2c4f44){_0x161fdc['push'](_0x161fdc['shift']());}};_0x2f1b64(++_0x573ade);}(_0x5d81,0x1b1));var _0x15d8=function(_0xaa6a4,_0x64b067){_0xaa6a4=_0xaa6a4-0x0;var _0xdc31a4=_0x5d81[_0xaa6a4];return _0xdc31a4;};'use strict';var DashboardEvents=require(_0x15d8('0x0'));var events=['save',_0x15d8('0x1'),_0x15d8('0x2')];function createListener(_0x304d09,_0x57ef79){return function(_0x3f4954){_0x57ef79['emit'](_0x304d09,_0x3f4954);};}function removeListener(_0x18c624,_0x2ac0a3){return function(){DashboardEvents[_0x15d8('0x3')](_0x18c624,_0x2ac0a3);};}exports[_0x15d8('0x4')]=function(_0x2dff38){for(var _0x41f80d=0x0,_0x4e71b5=events[_0x15d8('0x5')];_0x41f80d<_0x4e71b5;_0x41f80d++){var _0x2d35bd=events[_0x41f80d];var _0x217895=createListener(_0x15d8('0x6')+_0x2d35bd,_0x2dff38);DashboardEvents['on'](_0x2d35bd,_0x217895);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index cff152a..ea8fee8 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 _0xa9e0=['/:id','/:id/items','post','create','/:id/clone','addItem','put','update','delete','destroy','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./dashboard.controller','get','isAuthenticated'];(function(_0x1b642d,_0x4e8eb0){var _0x7c508a=function(_0xab3358){while(--_0xab3358){_0x1b642d['push'](_0x1b642d['shift']());}};_0x7c508a(++_0x4e8eb0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0xa9e0[_0x92c450];return _0x2a9599;};'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['show']);router['get'](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['getItems']);router[_0x0a9e('0xb')]('/',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0xb')](_0x0a9e('0xd'),auth[_0x0a9e('0x8')](),controller['clone']);router['post']('/:id/items',auth['isAuthenticated'](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')]('/:id',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x12')]);module[_0x0a9e('0x13')]=router; \ No newline at end of file +var _0xd8b0=['../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller','index','get','/:id','show','isAuthenticated','getItems','post','create','/:id/clone','addItem','put','update','delete','destroy','exports','multer','util','Router'];(function(_0x22d655,_0x3941dd){var _0x257739=function(_0x98136e){while(--_0x98136e){_0x22d655['push'](_0x22d655['shift']());}};_0x257739(++_0x3941dd);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var auth=require(_0x0d8b('0x3'));var interaction=require(_0x0d8b('0x4'));var config=require(_0x0d8b('0x5'));var controller=require(_0x0d8b('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x0d8b('0x7')]);router[_0x0d8b('0x8')](_0x0d8b('0x9'),auth['isAuthenticated'](),controller[_0x0d8b('0xa')]);router[_0x0d8b('0x8')]('/:id/items',auth[_0x0d8b('0xb')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0xb')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xd')](_0x0d8b('0xf'),auth[_0x0d8b('0xb')](),controller['clone']);router[_0x0d8b('0xd')]('/:id/items',auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x10')]);router[_0x0d8b('0x11')](_0x0d8b('0x9'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x12')]);router[_0x0d8b('0x13')](_0x0d8b('0x9'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x14')]);module[_0x0d8b('0x15')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index fbd578a..46c4e41 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 _0xc585=['getDataValue','attrs','setDataValue','stringify','INTEGER','#ffffff','#2196f3','lodash','STRING','TEXT','long','parse'];(function(_0x4d9f7a,_0x5785fc){var _0x2d6c25=function(_0x1a8ccd){while(--_0x1a8ccd){_0x4d9f7a['push'](_0x4d9f7a['shift']());}};_0x2d6c25(++_0x5785fc);}(_0xc585,0xf7));var _0x5c58=function(_0x150df4,_0x2a9950){_0x150df4=_0x150df4-0x0;var _0x141103=_0xc585[_0x150df4];return _0x141103;};'use strict';var Sequelize=require('sequelize');var squel=require('squel');var _=require(_0x5c58('0x0'));module['exports']={'title':{'type':Sequelize[_0x5c58('0x1')],'allowNull':![]},'type':{'type':Sequelize['STRING'](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x5c58('0x2')](_0x5c58('0x3')),'get':function(){try{return JSON[_0x5c58('0x4')](this[_0x5c58('0x5')](_0x5c58('0x6')));}catch(_0x4b988b){return[];}},'set':function(_0x3172fe){try{this[_0x5c58('0x7')](_0x5c58('0x6'),JSON[_0x5c58('0x8')](_0x3172fe));}catch(_0x394343){this[_0x5c58('0x7')](_0x5c58('0x6'),JSON[_0x5c58('0x8')]([]));}}},'sizeX':{'type':Sequelize[_0x5c58('0x9')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x5c58('0x9')]},'col':{'type':Sequelize[_0x5c58('0x9')]},'background':{'type':Sequelize[_0x5c58('0x1')],'allowNull':![],'defaultValue':_0x5c58('0xa'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x5c58('0x1')],'allowNull':![],'defaultValue':_0x5c58('0xb'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x5c58('0x1')]}}; \ No newline at end of file +var _0xa5c6=['exports','STRING','parse','getDataValue','setDataValue','attrs','stringify','INTEGER','#ffffff','#2196f3','sequelize','squel','lodash'];(function(_0x42bdad,_0x12836c){var _0x122626=function(_0x2eb29c){while(--_0x2eb29c){_0x42bdad['push'](_0x42bdad['shift']());}};_0x122626(++_0x12836c);}(_0xa5c6,0x176));var _0x6a5c=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xa5c6[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x6a5c('0x0'));var squel=require(_0x6a5c('0x1'));var _=require(_0x6a5c('0x2'));module[_0x6a5c('0x3')]={'title':{'type':Sequelize[_0x6a5c('0x4')],'allowNull':![]},'type':{'type':Sequelize[_0x6a5c('0x4')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize['TEXT']('long'),'get':function(){try{return JSON[_0x6a5c('0x5')](this[_0x6a5c('0x6')]('attrs'));}catch(_0x538437){return[];}},'set':function(_0x34c475){try{this[_0x6a5c('0x7')]('attrs',JSON['stringify'](_0x34c475));}catch(_0x71e19f){this[_0x6a5c('0x7')](_0x6a5c('0x8'),JSON[_0x6a5c('0x9')]([]));}}},'sizeX':{'type':Sequelize[_0x6a5c('0xa')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x6a5c('0xa')]},'col':{'type':Sequelize[_0x6a5c('0xa')]},'background':{'type':Sequelize[_0x6a5c('0x4')],'allowNull':![],'defaultValue':_0x6a5c('0xb'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x6a5c('0xc'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x6a5c('0x4')]}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index 922cc32..68d54a5 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 _0x0e6d=['squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','then','error','stack','name','send','show','params','keys','query','filters','intersection','attributes','model','fields','length','includeAll','include','catch','destroy','find','type','attrUrl','attrs','value','https://','custom','attrPath','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','total','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','update','DashboardItem','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs'];(function(_0x458edc,_0x9baf98){var _0x44af29=function(_0x41929c){while(--_0x41929c){_0x458edc['push'](_0x458edc['shift']());}};_0x44af29(++_0x9baf98);}(_0x0e6d,0xae));var _0xd0e6=function(_0x3186ae,_0x5d615c){_0x3186ae=_0x3186ae-0x0;var _0x247818=_0x0e6d[_0x3186ae];return _0x247818;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xd0e6('0x0'));var rimraf=require(_0xd0e6('0x1'));var zipdir=require(_0xd0e6('0x2'));var jsonpatch=require(_0xd0e6('0x3'));var rp=require(_0xd0e6('0x4'));var moment=require(_0xd0e6('0x5'));var BPromise=require(_0xd0e6('0x6'));var Mustache=require(_0xd0e6('0x7'));var util=require(_0xd0e6('0x8'));var path=require(_0xd0e6('0x9'));var sox=require('sox');var csv=require(_0xd0e6('0xa'));var ejs=require(_0xd0e6('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xd0e6('0xc'));var crypto=require(_0xd0e6('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xd0e6('0xa'));var querystring=require(_0xd0e6('0xe'));var Papa=require(_0xd0e6('0xf'));var Redis=require(_0xd0e6('0x10'));var authService=require(_0xd0e6('0x11'));var qs=require(_0xd0e6('0x12'));var as=require(_0xd0e6('0x13'));var hardwareService=require(_0xd0e6('0x14'));var logger=require(_0xd0e6('0x15'))(_0xd0e6('0x16'));var utils=require(_0xd0e6('0x17'));var config=require(_0xd0e6('0x18'));var db=require('../../mysqldb')['db'];config[_0xd0e6('0x19')]=_[_0xd0e6('0x1a')](config[_0xd0e6('0x19')],{'host':_0xd0e6('0x1b'),'port':0x18eb});var socket=require(_0xd0e6('0x1c'))(new Redis(config[_0xd0e6('0x19')]));require('./dashboardItem.socket')[_0xd0e6('0x1d')](socket);function respondWithStatusCode(_0x54fdd9,_0x364545){_0x364545=_0x364545||0xcc;return function(_0x2731c9){if(_0x2731c9){return _0x54fdd9[_0xd0e6('0x1e')](_0x364545);}return _0x54fdd9[_0xd0e6('0x1f')](_0x364545)[_0xd0e6('0x20')]();};}function respondWithResult(_0x324e5c,_0x1eb342){_0x1eb342=_0x1eb342||0xc8;return function(_0x717f2b){if(_0x717f2b){return _0x324e5c[_0xd0e6('0x1f')](_0x1eb342)[_0xd0e6('0x21')](_0x717f2b);}};}function respondWithFilteredResult(_0x44e298,_0x25bb45){return function(_0x525539){if(_0x525539){var _0x55b261=_0x525539[_0xd0e6('0x22')],_0x5b8720=_0x25bb45[_0xd0e6('0x23')],_0x1f9a30=_0x25bb45[_0xd0e6('0x23')]+_0x25bb45[_0xd0e6('0x24')],_0x409a2a;if(_0x1f9a30>=_0x55b261){_0x1f9a30=_0x55b261;_0x409a2a=0xc8;}else{_0x409a2a=0xce;}_0x44e298[_0xd0e6('0x1f')](_0x409a2a);return _0x44e298[_0xd0e6('0x25')](_0xd0e6('0x26'),_0x5b8720+'-'+_0x1f9a30+'/'+_0x55b261)[_0xd0e6('0x21')](_0x525539);}return null;};}function patchUpdates(_0x4d5e52){return function(_0x3eb7d4){try{jsonpatch[_0xd0e6('0x27')](_0x3eb7d4,_0x4d5e52,!![]);}catch(_0x58b1c3){return BPromise[_0xd0e6('0x28')](_0x58b1c3);}return _0x3eb7d4[_0xd0e6('0x29')]();};}function saveUpdates(_0xf737d0,_0x3b2818){return function(_0xd5e5c6){if(_0xd5e5c6){return _0xd5e5c6['update'](_0xf737d0)['then'](function(_0x590b6d){return _0x590b6d;});}return null;};}function removeEntity(_0x286d76,_0x253be3){return function(_0x207366){if(_0x207366){return _0x207366['destroy']()[_0xd0e6('0x2a')](function(){_0x286d76['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e1e59,_0x3e52db){return function(_0xbaa58d){if(!_0xbaa58d){_0x5e1e59[_0xd0e6('0x1e')](0x194);}return _0xbaa58d;};}function handleError(_0x591be1,_0x525178){_0x525178=_0x525178||0x1f4;return function(_0x513612){logger[_0xd0e6('0x2b')](_0x513612[_0xd0e6('0x2c')]);if(_0x513612['name']){delete _0x513612[_0xd0e6('0x2d')];}_0x591be1[_0xd0e6('0x1f')](_0x525178)[_0xd0e6('0x2e')](_0x513612);};}exports[_0xd0e6('0x2f')]=function(_0x4cc73a,_0x43b1da){var _0x23fa8d={'raw':![],'where':{'id':_0x4cc73a[_0xd0e6('0x30')]['id']}},_0x19606a={};_0x19606a['model']=_[_0xd0e6('0x31')](db['DashboardItem']['rawAttributes']);_0x19606a[_0xd0e6('0x32')]=_[_0xd0e6('0x31')](_0x4cc73a[_0xd0e6('0x32')]);_0x19606a[_0xd0e6('0x33')]=_[_0xd0e6('0x34')](_0x19606a['model'],_0x19606a[_0xd0e6('0x32')]);_0x23fa8d[_0xd0e6('0x35')]=_[_0xd0e6('0x34')](_0x19606a[_0xd0e6('0x36')],qs[_0xd0e6('0x37')](_0x4cc73a[_0xd0e6('0x32')][_0xd0e6('0x37')]));_0x23fa8d[_0xd0e6('0x35')]=_0x23fa8d[_0xd0e6('0x35')][_0xd0e6('0x38')]?_0x23fa8d[_0xd0e6('0x35')]:_0x19606a[_0xd0e6('0x36')];if(_0x4cc73a[_0xd0e6('0x32')][_0xd0e6('0x39')]){_0x23fa8d[_0xd0e6('0x3a')]=[{'all':!![]}];}_0x23fa8d=_['merge']({},_0x23fa8d,_0x4cc73a['options']);return db['DashboardItem']['find'](_0x23fa8d)['then'](handleEntityNotFound(_0x43b1da,null))[_0xd0e6('0x2a')](respondWithResult(_0x43b1da,null))[_0xd0e6('0x3b')](handleError(_0x43b1da,null));};exports[_0xd0e6('0x3c')]=function(_0x61ffd,_0x524b0d){return db['DashboardItem'][_0xd0e6('0x3d')]({'where':{'id':_0x61ffd[_0xd0e6('0x30')]['id']}})[_0xd0e6('0x2a')](handleEntityNotFound(_0x524b0d,null))[_0xd0e6('0x2a')](removeEntity(_0x524b0d,null))[_0xd0e6('0x3b')](handleError(_0x524b0d,null));};function widgetAttributes(_0xd35631){try{switch(_0xd35631[_0xd0e6('0x3e')]){case'iframe':return[{'name':_0xd0e6('0x3f'),'value':_0xd35631[_0xd0e6('0x3f')]||(_0xd35631['attrs']&&_0xd35631[_0xd0e6('0x40')][0x0]?_0xd35631[_0xd0e6('0x40')][0x0][_0xd0e6('0x41')]:undefined)||_0xd0e6('0x42')}];case _0xd0e6('0x43'):return[{'name':_0xd0e6('0x44'),'value':_0xd35631[_0xd0e6('0x44')]||(_0xd35631[_0xd0e6('0x40')]&&_0xd35631[_0xd0e6('0x40')][0x0]?_0xd35631[_0xd0e6('0x40')][0x0][_0xd0e6('0x41')]:undefined)||''}];case'clock':return[{'name':_0xd0e6('0x45'),'value':_0xd35631[_0xd0e6('0x45')]||(_0xd35631[_0xd0e6('0x40')]&&_0xd35631[_0xd0e6('0x40')][0x0]?_0xd35631[_0xd0e6('0x40')][0x0][_0xd0e6('0x41')]:undefined)||_0xd0e6('0x46')},{'name':_0xd0e6('0x47'),'value':_0xd35631[_0xd0e6('0x47')]||(_0xd35631[_0xd0e6('0x40')]&&_0xd35631[_0xd0e6('0x40')][0x1]?_0xd35631[_0xd0e6('0x40')][0x1][_0xd0e6('0x41')]:undefined)||_0xd0e6('0x48')},{'name':'attrFontSize','value':_0xd35631[_0xd0e6('0x49')]||(_0xd35631[_0xd0e6('0x40')]&&_0xd35631[_0xd0e6('0x40')][0x2]?_0xd35631[_0xd0e6('0x40')][0x2][_0xd0e6('0x41')]:undefined)||0xc}];case _0xd0e6('0x4a'):return[{'name':'attrMetric','value':_0xd35631[_0xd0e6('0x4b')]||(_0xd35631[_0xd0e6('0x40')]&&_0xd35631[_0xd0e6('0x40')][0x0]?_0xd35631['attrs'][0x0]['value']:undefined)||'total'},{'name':_0xd0e6('0x4c'),'value':_0xd35631['attrVoiceQueues']||(_0xd35631[_0xd0e6('0x40')]&&_0xd35631['attrs'][0x1]?_0xd35631[_0xd0e6('0x40')][0x1][_0xd0e6('0x41')]:undefined)||[]},{'name':'attrFontSize','value':_0xd35631[_0xd0e6('0x49')]||(_0xd35631['attrs']&&_0xd35631[_0xd0e6('0x40')][0x2]?_0xd35631[_0xd0e6('0x40')][0x2][_0xd0e6('0x41')]:undefined)||0x14}];case _0xd0e6('0x4d'):case _0xd0e6('0x4e'):return[{'name':'attrSerie1','value':_0xd35631[_0xd0e6('0x4f')]||(_0xd35631[_0xd0e6('0x40')]&&_0xd35631[_0xd0e6('0x40')][0x0]?_0xd35631[_0xd0e6('0x40')][0x0]['value']:undefined)||_0xd0e6('0x50')},{'name':'attrSerie2','value':_0xd35631[_0xd0e6('0x51')]||(_0xd35631[_0xd0e6('0x40')]&&_0xd35631['attrs'][0x1]?_0xd35631['attrs'][0x1][_0xd0e6('0x41')]:undefined)||null},{'name':_0xd0e6('0x52'),'value':_0xd35631['attrSerie3']||(_0xd35631[_0xd0e6('0x40')]&&_0xd35631[_0xd0e6('0x40')][0x2]?_0xd35631[_0xd0e6('0x40')][0x2][_0xd0e6('0x41')]:undefined)||null},{'name':_0xd0e6('0x4c'),'value':_0xd35631[_0xd0e6('0x4c')]||(_0xd35631[_0xd0e6('0x40')]&&_0xd35631[_0xd0e6('0x40')][0x3]?_0xd35631[_0xd0e6('0x40')][0x3]['value']:undefined)||[]}];case _0xd0e6('0x53'):return[{'name':_0xd0e6('0x54'),'type':_0xd35631[_0xd0e6('0x55')]||(_0xd35631[_0xd0e6('0x40')]&&_0xd35631[_0xd0e6('0x40')][0x0]?_0xd35631[_0xd0e6('0x40')][0x0][_0xd0e6('0x3e')]:undefined)||null,'value':_0xd35631[_0xd0e6('0x54')]||(_0xd35631[_0xd0e6('0x40')]&&_0xd35631[_0xd0e6('0x40')][0x0]?_0xd35631[_0xd0e6('0x40')][0x0]['value']:undefined)||null},{'name':_0xd0e6('0x56'),'value':_0xd35631['attrRefresh']||(_0xd35631[_0xd0e6('0x40')]&&_0xd35631[_0xd0e6('0x40')][0x1]?_0xd35631[_0xd0e6('0x40')][0x1][_0xd0e6('0x41')]:undefined)||0x0}];default:return[];}}catch(_0x1d9b71){logger[_0xd0e6('0x2b')](_0xd0e6('0x57'),JSON[_0xd0e6('0x58')](_0x1d9b71));return[];}}exports[_0xd0e6('0x59')]=function(_0x4080ae,_0x2c3452){if(_0x4080ae['body']){_0x4080ae[_0xd0e6('0x5a')]['attrs']=widgetAttributes(_0x4080ae[_0xd0e6('0x5a')]);}return db['DashboardItem'][_0xd0e6('0x59')](_0x4080ae[_0xd0e6('0x5a')],{})[_0xd0e6('0x2a')](respondWithResult(_0x2c3452,0xc9))[_0xd0e6('0x3b')](handleError(_0x2c3452,null));};exports[_0xd0e6('0x5b')]=function(_0x15460f,_0x4e2935){if(_0x15460f[_0xd0e6('0x5a')]['id']){delete _0x15460f['body']['id'];}_0x15460f[_0xd0e6('0x5a')]['attrs']=widgetAttributes(_0x15460f[_0xd0e6('0x5a')]);return db[_0xd0e6('0x5c')][_0xd0e6('0x3d')]({'where':{'id':_0x15460f[_0xd0e6('0x30')]['id']}})[_0xd0e6('0x2a')](handleEntityNotFound(_0x4e2935,null))[_0xd0e6('0x2a')](saveUpdates(_0x15460f['body'],null))[_0xd0e6('0x2a')](respondWithResult(_0x4e2935,null))[_0xd0e6('0x3b')](handleError(_0x4e2935,null));}; \ No newline at end of file +var _0x3f06=['attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','reportType','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','body','create','catch','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','sendStatus','end','status','json','count','offset','limit','set','apply','reject','update','destroy','then','error','stack','name','send','show','params','keys','DashboardItem','rawAttributes','query','filters','intersection','model','attributes','fields','length','include','merge','options','find','type','iframe','attrUrl','attrs','value','https://','custom','attrPath','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter'];(function(_0x2169ab,_0x5b8036){var _0x1a62ed=function(_0x287b7a){while(--_0x287b7a){_0x2169ab['push'](_0x2169ab['shift']());}};_0x1a62ed(++_0x5b8036);}(_0x3f06,0xd0));var _0x63f0=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x3f06[_0x4565bf];return _0x5610ba;};'use strict';var pdf=require(_0x63f0('0x0'));var emlformat=require(_0x63f0('0x1'));var rimraf=require(_0x63f0('0x2'));var zipdir=require(_0x63f0('0x3'));var jsonpatch=require(_0x63f0('0x4'));var rp=require(_0x63f0('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x63f0('0x6'));var util=require(_0x63f0('0x7'));var path=require(_0x63f0('0x8'));var sox=require(_0x63f0('0x9'));var csv=require(_0x63f0('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x63f0('0xb'));var squel=require(_0x63f0('0xc'));var crypto=require(_0x63f0('0xd'));var jsforce=require(_0x63f0('0xe'));var deskjs=require(_0x63f0('0xf'));var toCsv=require(_0x63f0('0xa'));var querystring=require(_0x63f0('0x10'));var Papa=require(_0x63f0('0x11'));var Redis=require(_0x63f0('0x12'));var authService=require(_0x63f0('0x13'));var qs=require(_0x63f0('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x63f0('0x15'));var logger=require(_0x63f0('0x16'))(_0x63f0('0x17'));var utils=require(_0x63f0('0x18'));var config=require(_0x63f0('0x19'));var db=require(_0x63f0('0x1a'))['db'];config[_0x63f0('0x1b')]=_[_0x63f0('0x1c')](config[_0x63f0('0x1b')],{'host':_0x63f0('0x1d'),'port':0x18eb});var socket=require(_0x63f0('0x1e'))(new Redis(config[_0x63f0('0x1b')]));require(_0x63f0('0x1f'))[_0x63f0('0x20')](socket);function respondWithStatusCode(_0x59ab9f,_0x4bdfb4){_0x4bdfb4=_0x4bdfb4||0xcc;return function(_0x5b4b4f){if(_0x5b4b4f){return _0x59ab9f[_0x63f0('0x21')](_0x4bdfb4);}return _0x59ab9f['status'](_0x4bdfb4)[_0x63f0('0x22')]();};}function respondWithResult(_0x4238c3,_0x5e1cde){_0x5e1cde=_0x5e1cde||0xc8;return function(_0x311c59){if(_0x311c59){return _0x4238c3[_0x63f0('0x23')](_0x5e1cde)[_0x63f0('0x24')](_0x311c59);}};}function respondWithFilteredResult(_0x3850c5,_0x4002d5){return function(_0x1e66ec){if(_0x1e66ec){var _0x2f99d4=_0x1e66ec[_0x63f0('0x25')],_0xedbd05=_0x4002d5[_0x63f0('0x26')],_0x5c9d98=_0x4002d5[_0x63f0('0x26')]+_0x4002d5[_0x63f0('0x27')],_0x46360b;if(_0x5c9d98>=_0x2f99d4){_0x5c9d98=_0x2f99d4;_0x46360b=0xc8;}else{_0x46360b=0xce;}_0x3850c5['status'](_0x46360b);return _0x3850c5[_0x63f0('0x28')]('Content-Range',_0xedbd05+'-'+_0x5c9d98+'/'+_0x2f99d4)['json'](_0x1e66ec);}return null;};}function patchUpdates(_0x52f23a){return function(_0x48d99f){try{jsonpatch[_0x63f0('0x29')](_0x48d99f,_0x52f23a,!![]);}catch(_0x6fd024){return BPromise[_0x63f0('0x2a')](_0x6fd024);}return _0x48d99f['save']();};}function saveUpdates(_0xd2a455,_0x33e487){return function(_0xff3391){if(_0xff3391){return _0xff3391[_0x63f0('0x2b')](_0xd2a455)['then'](function(_0x135a00){return _0x135a00;});}return null;};}function removeEntity(_0x5d70f4,_0x45559c){return function(_0x10873f){if(_0x10873f){return _0x10873f[_0x63f0('0x2c')]()[_0x63f0('0x2d')](function(){_0x5d70f4[_0x63f0('0x23')](0xcc)[_0x63f0('0x22')]();});}};}function handleEntityNotFound(_0x5b57ca,_0x5a3578){return function(_0x1922f8){if(!_0x1922f8){_0x5b57ca[_0x63f0('0x21')](0x194);}return _0x1922f8;};}function handleError(_0x132171,_0x1afde6){_0x1afde6=_0x1afde6||0x1f4;return function(_0x1087df){logger[_0x63f0('0x2e')](_0x1087df[_0x63f0('0x2f')]);if(_0x1087df['name']){delete _0x1087df[_0x63f0('0x30')];}_0x132171[_0x63f0('0x23')](_0x1afde6)[_0x63f0('0x31')](_0x1087df);};}exports[_0x63f0('0x32')]=function(_0xd1f1ad,_0x15f306){var _0x1273be={'raw':![],'where':{'id':_0xd1f1ad[_0x63f0('0x33')]['id']}},_0x4a8ac5={};_0x4a8ac5['model']=_[_0x63f0('0x34')](db[_0x63f0('0x35')][_0x63f0('0x36')]);_0x4a8ac5[_0x63f0('0x37')]=_['keys'](_0xd1f1ad[_0x63f0('0x37')]);_0x4a8ac5[_0x63f0('0x38')]=_[_0x63f0('0x39')](_0x4a8ac5[_0x63f0('0x3a')],_0x4a8ac5[_0x63f0('0x37')]);_0x1273be[_0x63f0('0x3b')]=_['intersection'](_0x4a8ac5['model'],qs[_0x63f0('0x3c')](_0xd1f1ad['query'][_0x63f0('0x3c')]));_0x1273be[_0x63f0('0x3b')]=_0x1273be['attributes'][_0x63f0('0x3d')]?_0x1273be[_0x63f0('0x3b')]:_0x4a8ac5[_0x63f0('0x3a')];if(_0xd1f1ad[_0x63f0('0x37')]['includeAll']){_0x1273be[_0x63f0('0x3e')]=[{'all':!![]}];}_0x1273be=_[_0x63f0('0x3f')]({},_0x1273be,_0xd1f1ad[_0x63f0('0x40')]);return db['DashboardItem'][_0x63f0('0x41')](_0x1273be)[_0x63f0('0x2d')](handleEntityNotFound(_0x15f306,null))[_0x63f0('0x2d')](respondWithResult(_0x15f306,null))['catch'](handleError(_0x15f306,null));};exports[_0x63f0('0x2c')]=function(_0x128e7c,_0x1b96b7){return db['DashboardItem'][_0x63f0('0x41')]({'where':{'id':_0x128e7c[_0x63f0('0x33')]['id']}})[_0x63f0('0x2d')](handleEntityNotFound(_0x1b96b7,null))[_0x63f0('0x2d')](removeEntity(_0x1b96b7,null))['catch'](handleError(_0x1b96b7,null));};function widgetAttributes(_0x5b45c0){try{switch(_0x5b45c0[_0x63f0('0x42')]){case _0x63f0('0x43'):return[{'name':_0x63f0('0x44'),'value':_0x5b45c0[_0x63f0('0x44')]||(_0x5b45c0[_0x63f0('0x45')]&&_0x5b45c0[_0x63f0('0x45')][0x0]?_0x5b45c0[_0x63f0('0x45')][0x0][_0x63f0('0x46')]:undefined)||_0x63f0('0x47')}];case _0x63f0('0x48'):return[{'name':_0x63f0('0x49'),'value':_0x5b45c0[_0x63f0('0x49')]||(_0x5b45c0[_0x63f0('0x45')]&&_0x5b45c0['attrs'][0x0]?_0x5b45c0[_0x63f0('0x45')][0x0][_0x63f0('0x46')]:undefined)||''}];case'clock':return[{'name':_0x63f0('0x4a'),'value':_0x5b45c0['attrHourFormat']||(_0x5b45c0[_0x63f0('0x45')]&&_0x5b45c0['attrs'][0x0]?_0x5b45c0[_0x63f0('0x45')][0x0][_0x63f0('0x46')]:undefined)||_0x63f0('0x4b')},{'name':'attrTimezone','value':_0x5b45c0[_0x63f0('0x4c')]||(_0x5b45c0[_0x63f0('0x45')]&&_0x5b45c0[_0x63f0('0x45')][0x1]?_0x5b45c0[_0x63f0('0x45')][0x1][_0x63f0('0x46')]:undefined)||_0x63f0('0x4d')},{'name':_0x63f0('0x4e'),'value':_0x5b45c0[_0x63f0('0x4e')]||(_0x5b45c0[_0x63f0('0x45')]&&_0x5b45c0[_0x63f0('0x45')][0x2]?_0x5b45c0['attrs'][0x2][_0x63f0('0x46')]:undefined)||0xc}];case _0x63f0('0x4f'):return[{'name':_0x63f0('0x50'),'value':_0x5b45c0[_0x63f0('0x50')]||(_0x5b45c0[_0x63f0('0x45')]&&_0x5b45c0[_0x63f0('0x45')][0x0]?_0x5b45c0[_0x63f0('0x45')][0x0][_0x63f0('0x46')]:undefined)||_0x63f0('0x51')},{'name':_0x63f0('0x52'),'value':_0x5b45c0['attrVoiceQueues']||(_0x5b45c0['attrs']&&_0x5b45c0['attrs'][0x1]?_0x5b45c0[_0x63f0('0x45')][0x1][_0x63f0('0x46')]:undefined)||[]},{'name':_0x63f0('0x4e'),'value':_0x5b45c0['attrFontSize']||(_0x5b45c0[_0x63f0('0x45')]&&_0x5b45c0[_0x63f0('0x45')][0x2]?_0x5b45c0[_0x63f0('0x45')][0x2][_0x63f0('0x46')]:undefined)||0x14}];case _0x63f0('0x53'):case _0x63f0('0x54'):return[{'name':_0x63f0('0x55'),'value':_0x5b45c0[_0x63f0('0x55')]||(_0x5b45c0[_0x63f0('0x45')]&&_0x5b45c0[_0x63f0('0x45')][0x0]?_0x5b45c0['attrs'][0x0][_0x63f0('0x46')]:undefined)||_0x63f0('0x51')},{'name':_0x63f0('0x56'),'value':_0x5b45c0['attrSerie2']||(_0x5b45c0['attrs']&&_0x5b45c0[_0x63f0('0x45')][0x1]?_0x5b45c0[_0x63f0('0x45')][0x1][_0x63f0('0x46')]:undefined)||null},{'name':_0x63f0('0x57'),'value':_0x5b45c0[_0x63f0('0x57')]||(_0x5b45c0['attrs']&&_0x5b45c0[_0x63f0('0x45')][0x2]?_0x5b45c0[_0x63f0('0x45')][0x2]['value']:undefined)||null},{'name':_0x63f0('0x52'),'value':_0x5b45c0[_0x63f0('0x52')]||(_0x5b45c0[_0x63f0('0x45')]&&_0x5b45c0[_0x63f0('0x45')][0x3]?_0x5b45c0[_0x63f0('0x45')][0x3][_0x63f0('0x46')]:undefined)||[]}];case'web-report':return[{'name':'attrReport','type':_0x5b45c0[_0x63f0('0x58')]||(_0x5b45c0['attrs']&&_0x5b45c0[_0x63f0('0x45')][0x0]?_0x5b45c0[_0x63f0('0x45')][0x0][_0x63f0('0x42')]:undefined)||null,'value':_0x5b45c0[_0x63f0('0x59')]||(_0x5b45c0['attrs']&&_0x5b45c0[_0x63f0('0x45')][0x0]?_0x5b45c0[_0x63f0('0x45')][0x0][_0x63f0('0x46')]:undefined)||null},{'name':_0x63f0('0x5a'),'value':_0x5b45c0['attrRefresh']||(_0x5b45c0['attrs']&&_0x5b45c0[_0x63f0('0x45')][0x1]?_0x5b45c0[_0x63f0('0x45')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x4c57eb){logger[_0x63f0('0x2e')](_0x63f0('0x5b'),JSON[_0x63f0('0x5c')](_0x4c57eb));return[];}}exports['create']=function(_0x4cb5bc,_0x56258e){if(_0x4cb5bc[_0x63f0('0x5d')]){_0x4cb5bc[_0x63f0('0x5d')][_0x63f0('0x45')]=widgetAttributes(_0x4cb5bc[_0x63f0('0x5d')]);}return db[_0x63f0('0x35')][_0x63f0('0x5e')](_0x4cb5bc[_0x63f0('0x5d')],{})[_0x63f0('0x2d')](respondWithResult(_0x56258e,0xc9))['catch'](handleError(_0x56258e,null));};exports[_0x63f0('0x2b')]=function(_0xbcd7cc,_0x52ea93){if(_0xbcd7cc[_0x63f0('0x5d')]['id']){delete _0xbcd7cc[_0x63f0('0x5d')]['id'];}_0xbcd7cc[_0x63f0('0x5d')]['attrs']=widgetAttributes(_0xbcd7cc['body']);return db['DashboardItem'][_0x63f0('0x41')]({'where':{'id':_0xbcd7cc[_0x63f0('0x33')]['id']}})['then'](handleEntityNotFound(_0x52ea93,null))['then'](saveUpdates(_0xbcd7cc[_0x63f0('0x5d')],null))['then'](respondWithResult(_0x52ea93,null))[_0x63f0('0x5f')](handleError(_0x52ea93,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 8105e3e..2f61516 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 _0x808a=['../../mysqldb','DashboardItem','setMaxListeners','emit','hasOwnProperty','hook','exports','events'];(function(_0x51f964,_0x4a9d5a){var _0x37fe61=function(_0xb0fb97){while(--_0xb0fb97){_0x51f964['push'](_0x51f964['shift']());}};_0x37fe61(++_0x4a9d5a);}(_0x808a,0x1b7));var _0xa808=function(_0x423e4b,_0x1bb75b){_0x423e4b=_0x423e4b-0x0;var _0x626fd4=_0x808a[_0x423e4b];return _0x626fd4;};'use strict';var EventEmitter=require(_0xa808('0x0'));var DashboardItem=require(_0xa808('0x1'))['db'][_0xa808('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xa808('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x591089){return function(_0x169e1d,_0x38ed20,_0x3baf9b){DashboardItemEvents[_0xa808('0x4')](_0x591089+':'+_0x169e1d['id'],_0x169e1d);DashboardItemEvents['emit'](_0x591089,_0x169e1d);_0x3baf9b(null);};}for(var e in events){if(events[_0xa808('0x5')](e)){var event=events[e];DashboardItem[_0xa808('0x6')](e,emitEvent(event));}}module[_0xa808('0x7')]=DashboardItemEvents; \ No newline at end of file +var _0x1135=['hasOwnProperty','hook','events','DashboardItem','setMaxListeners','save','update','remove','emit'];(function(_0xde2f77,_0x353872){var _0x568e04=function(_0xad3dad){while(--_0xad3dad){_0xde2f77['push'](_0xde2f77['shift']());}};_0x568e04(++_0x353872);}(_0x1135,0x119));var _0x5113=function(_0x20ab2d,_0xf0a990){_0x20ab2d=_0x20ab2d-0x0;var _0x571570=_0x1135[_0x20ab2d];return _0x571570;};'use strict';var EventEmitter=require(_0x5113('0x0'));var DashboardItem=require('../../mysqldb')['db'][_0x5113('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x5113('0x2')](0x0);var events={'afterCreate':_0x5113('0x3'),'afterUpdate':_0x5113('0x4'),'afterDestroy':_0x5113('0x5')};function emitEvent(_0x2f2b20){return function(_0xd01f27,_0x1f7133,_0x26720d){DashboardItemEvents[_0x5113('0x6')](_0x2f2b20+':'+_0xd01f27['id'],_0xd01f27);DashboardItemEvents[_0x5113('0x6')](_0x2f2b20,_0xd01f27);_0x26720d(null);};}for(var e in events){if(events[_0x5113('0x7')](e)){var event=events[e];DashboardItem[_0x5113('0x8')](e,emitEvent(event));}}module['exports']=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index 63afc0b..e6b0359 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 _0x0704=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./dashboardItem.attributes','exports','DashboardItem','dashboard_items','../../config/logger'];(function(_0x3453e5,_0x5c0f68){var _0x4c63b4=function(_0x380ee7){while(--_0x380ee7){_0x3453e5['push'](_0x3453e5['shift']());}};_0x4c63b4(++_0x5c0f68);}(_0x0704,0x8e));var _0x4070=function(_0x349942,_0xaf2dc4){_0x349942=_0x349942-0x0;var _0x40a55b=_0x0704[_0x349942];return _0x40a55b;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4070('0x0'))(_0x4070('0x1'));var moment=require(_0x4070('0x2'));var BPromise=require(_0x4070('0x3'));var rp=require(_0x4070('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4070('0x5'));var config=require(_0x4070('0x6'));var attributes=require(_0x4070('0x7'));module[_0x4070('0x8')]=function(_0x5eaad8,_0x16c4d1){return _0x5eaad8['define'](_0x4070('0x9'),attributes,{'tableName':_0x4070('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1cc7=['DashboardItem','dashboard_items','lodash','util','moment','bluebird','request-promise','path','../../config/environment','./dashboardItem.attributes','exports','define'];(function(_0x3629de,_0x155f66){var _0x462e4d=function(_0x11a97d){while(--_0x11a97d){_0x3629de['push'](_0x3629de['shift']());}};_0x462e4d(++_0x155f66);}(_0x1cc7,0x116));var _0x71cc=function(_0x29d46b,_0x197247){_0x29d46b=_0x29d46b-0x0;var _0x18c5ab=_0x1cc7[_0x29d46b];return _0x18c5ab;};'use strict';var _=require(_0x71cc('0x0'));var util=require(_0x71cc('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x71cc('0x2'));var BPromise=require(_0x71cc('0x3'));var rp=require(_0x71cc('0x4'));var fs=require('fs');var path=require(_0x71cc('0x5'));var rimraf=require('rimraf');var config=require(_0x71cc('0x6'));var attributes=require(_0x71cc('0x7'));module[_0x71cc('0x8')]=function(_0x539dec,_0x1b03fb){return _0x539dec[_0x71cc('0x9')](_0x71cc('0xa'),attributes,{'tableName':_0x71cc('0xb'),'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 135660b..74fa9fa 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 _0x96dc=['ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','then','info','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','DashboardItem,\x20%s,\x20%s','message','result','catch','moment','randomstring'];(function(_0x11b0c8,_0xf4b742){var _0x348398=function(_0x2047d2){while(--_0x2047d2){_0x11b0c8['push'](_0x11b0c8['shift']());}};_0x348398(++_0xf4b742);}(_0x96dc,0x11c));var _0xc96d=function(_0x56ae7b,_0x4d95db){_0x56ae7b=_0x56ae7b-0x0;var _0x4a3d58=_0x96dc[_0x56ae7b];return _0x4a3d58;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc96d('0x0'));var BPromise=require('bluebird');var rs=require(_0xc96d('0x1'));var fs=require('fs');var Redis=require(_0xc96d('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xc96d('0x3'));var logger=require(_0xc96d('0x4'))(_0xc96d('0x5'));var config=require('../../config/environment');var jayson=require(_0xc96d('0x6'));var client=jayson['client'][_0xc96d('0x7')]({'port':0x232a});config[_0xc96d('0x8')]=_[_0xc96d('0x9')](config['redis'],{'host':_0xc96d('0xa'),'port':0x18eb});var socket=require(_0xc96d('0xb'))(new Redis(config[_0xc96d('0x8')]));require(_0xc96d('0xc'))[_0xc96d('0xd')](socket);function respondWithRpcPromise(_0x15c27f,_0xcbc49a,_0x153b2f){return new BPromise(function(_0x441016,_0x57a069){return client['request'](_0x15c27f,_0x153b2f)[_0xc96d('0xe')](function(_0x4a2ae6){logger[_0xc96d('0xf')]('DashboardItem,\x20%s,\x20%s',_0xcbc49a,_0xc96d('0x10'));logger[_0xc96d('0x11')](_0xc96d('0x12'),_0xcbc49a,_0xc96d('0x10'),JSON[_0xc96d('0x13')](_0x4a2ae6));if(_0x4a2ae6['error']){if(_0x4a2ae6[_0xc96d('0x14')][_0xc96d('0x15')]===0x1f4){logger[_0xc96d('0x14')](_0xc96d('0x16'),_0xcbc49a,_0x4a2ae6[_0xc96d('0x14')][_0xc96d('0x17')]);return _0x57a069(_0x4a2ae6[_0xc96d('0x14')][_0xc96d('0x17')]);}logger['error']('DashboardItem,\x20%s,\x20%s',_0xcbc49a,_0x4a2ae6['error'][_0xc96d('0x17')]);return _0x441016(_0x4a2ae6[_0xc96d('0x14')][_0xc96d('0x17')]);}else{logger[_0xc96d('0xf')](_0xc96d('0x16'),_0xcbc49a,_0xc96d('0x10'));_0x441016(_0x4a2ae6[_0xc96d('0x18')][_0xc96d('0x17')]);}})[_0xc96d('0x19')](function(_0x3cdd5c){logger[_0xc96d('0x14')](_0xc96d('0x16'),_0xcbc49a,_0x3cdd5c);_0x57a069(_0x3cdd5c);});});} \ No newline at end of file +var _0xb64a=['debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','then','DashboardItem,\x20%s,\x20%s','request\x20sent'];(function(_0x3b36ec,_0x578e5b){var _0x50e9d5=function(_0xbfbf06){while(--_0xbfbf06){_0x3b36ec['push'](_0x3b36ec['shift']());}};_0x50e9d5(++_0x578e5b);}(_0xb64a,0x126));var _0xab64=function(_0xff37bf,_0x31d95c){_0xff37bf=_0xff37bf-0x0;var _0x40f85d=_0xb64a[_0xff37bf];return _0x40f85d;};'use strict';var _=require(_0xab64('0x0'));var util=require(_0xab64('0x1'));var moment=require(_0xab64('0x2'));var BPromise=require(_0xab64('0x3'));var rs=require(_0xab64('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xab64('0x5'));var logger=require(_0xab64('0x6'))('rpc');var config=require(_0xab64('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xab64('0x8')][_0xab64('0x9')]({'port':0x232a});config[_0xab64('0xa')]=_[_0xab64('0xb')](config[_0xab64('0xa')],{'host':_0xab64('0xc'),'port':0x18eb});var socket=require(_0xab64('0xd'))(new Redis(config[_0xab64('0xa')]));require(_0xab64('0xe'))['register'](socket);function respondWithRpcPromise(_0x145af8,_0x55c62e,_0x50cff9){return new BPromise(function(_0x50acda,_0x12100c){return client['request'](_0x145af8,_0x50cff9)[_0xab64('0xf')](function(_0xa9b415){logger['info'](_0xab64('0x10'),_0x55c62e,_0xab64('0x11'));logger[_0xab64('0x12')](_0xab64('0x13'),_0x55c62e,_0xab64('0x11'),JSON[_0xab64('0x14')](_0xa9b415));if(_0xa9b415['error']){if(_0xa9b415['error'][_0xab64('0x15')]===0x1f4){logger[_0xab64('0x16')](_0xab64('0x10'),_0x55c62e,_0xa9b415['error']['message']);return _0x12100c(_0xa9b415[_0xab64('0x16')][_0xab64('0x17')]);}logger['error'](_0xab64('0x10'),_0x55c62e,_0xa9b415[_0xab64('0x16')][_0xab64('0x17')]);return _0x50acda(_0xa9b415[_0xab64('0x16')][_0xab64('0x17')]);}else{logger[_0xab64('0x18')]('DashboardItem,\x20%s,\x20%s',_0x55c62e,'request\x20sent');_0x50acda(_0xa9b415[_0xab64('0x19')][_0xab64('0x17')]);}})['catch'](function(_0x154b4b){logger[_0xab64('0x16')](_0xab64('0x10'),_0x55c62e,_0x154b4b);_0x12100c(_0x154b4b);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 7d04300..7c2eb09 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 _0x6cb6=['register','./dashboardItem.events','save','remove','emit','removeListener'];(function(_0x17cb63,_0x4c0e90){var _0x4340bc=function(_0x364807){while(--_0x364807){_0x17cb63['push'](_0x17cb63['shift']());}};_0x4340bc(++_0x4c0e90);}(_0x6cb6,0x1db));var _0x66cb=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x6cb6[_0x3b380d];return _0x54502b;};'use strict';var DashboardItemEvents=require(_0x66cb('0x0'));var events=[_0x66cb('0x1'),_0x66cb('0x2'),'update'];function createListener(_0x4215b2,_0x43d0ed){return function(_0x2010d5){_0x43d0ed[_0x66cb('0x3')](_0x4215b2,_0x2010d5);};}function removeListener(_0x1dd926,_0x327fbf){return function(){DashboardItemEvents[_0x66cb('0x4')](_0x1dd926,_0x327fbf);};}exports[_0x66cb('0x5')]=function(_0x1a31b2){for(var _0x30f536=0x0,_0x430c5c=events['length'];_0x30f536<_0x430c5c;_0x30f536++){var _0x205927=events[_0x30f536];var _0x26d5c7=createListener('dashboardItem:'+_0x205927,_0x1a31b2);DashboardItemEvents['on'](_0x205927,_0x26d5c7);}}; \ No newline at end of file +var _0x38f9=['register','dashboardItem:','save','remove','update'];(function(_0xe44b1,_0x242100){var _0x368147=function(_0x3cd64c){while(--_0x3cd64c){_0xe44b1['push'](_0xe44b1['shift']());}};_0x368147(++_0x242100);}(_0x38f9,0xbb));var _0x938f=function(_0x45fc6a,_0x166adb){_0x45fc6a=_0x45fc6a-0x0;var _0x14bcfd=_0x38f9[_0x45fc6a];return _0x14bcfd;};'use strict';var DashboardItemEvents=require('./dashboardItem.events');var events=[_0x938f('0x0'),_0x938f('0x1'),_0x938f('0x2')];function createListener(_0x57d3ca,_0xd997cb){return function(_0x40c323){_0xd997cb['emit'](_0x57d3ca,_0x40c323);};}function removeListener(_0x2d8b59,_0x41b816){return function(){DashboardItemEvents['removeListener'](_0x2d8b59,_0x41b816);};}exports[_0x938f('0x3')]=function(_0x543da3){for(var _0x485407=0x0,_0x334bff=events['length'];_0x485407<_0x334bff;_0x485407++){var _0x4f12c8=events[_0x485407];var _0x3b6199=createListener(_0x938f('0x4')+_0x4f12c8,_0x543da3);DashboardItemEvents['on'](_0x4f12c8,_0x3b6199);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 86e43f7..38e5120 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 _0x4819=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','get','isAuthenticated','create','put','/:id','delete','exports','util','path','connect-timeout'];(function(_0x4c0622,_0x5dacaf){var _0x1799d8=function(_0x2ba801){while(--_0x2ba801){_0x4c0622['push'](_0x4c0622['shift']());}};_0x1799d8(++_0x5dacaf);}(_0x4819,0xcd));var _0x9481=function(_0x5293c8,_0xab0c3c){_0x5293c8=_0x5293c8-0x0;var _0x3623fb=_0x4819[_0x5293c8];return _0x3623fb;};'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')]('/:id',auth[_0x9481('0xa')](),controller['show']);router['post']('/',auth[_0x9481('0xa')](),controller[_0x9481('0xb')]);router[_0x9481('0xc')](_0x9481('0xd'),auth[_0x9481('0xa')](),controller['update']);router[_0x9481('0xe')]('/:id',auth[_0x9481('0xa')](),controller['destroy']);module[_0x9481('0xf')]=router; \ No newline at end of file +var _0x7217=['post','create','put','update','delete','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','./dashboardItem.controller','get','/:id','isAuthenticated','show'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x7217,0x19e));var _0x7721=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0x7217[_0x25bea7];return _0x175952;};'use strict';var multer=require(_0x7721('0x0'));var util=require('util');var path=require(_0x7721('0x1'));var timeout=require(_0x7721('0x2'));var express=require(_0x7721('0x3'));var router=express[_0x7721('0x4')]();var auth=require(_0x7721('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x7721('0x6'));router[_0x7721('0x7')](_0x7721('0x8'),auth[_0x7721('0x9')](),controller[_0x7721('0xa')]);router[_0x7721('0xb')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xc')]);router[_0x7721('0xd')](_0x7721('0x8'),auth[_0x7721('0x9')](),controller[_0x7721('0xe')]);router[_0x7721('0xf')](_0x7721('0x8'),auth[_0x7721('0x9')](),controller['destroy']);module[_0x7721('0x10')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index 4022487..022aa54 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 _0xa474=['STRING','exports'];(function(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0xa474,0x195));var _0x4a47=function(_0x28332e,_0x17a69c){_0x28332e=_0x28332e-0x0;var _0x2f1b5b=_0xa474[_0x28332e];return _0x2f1b5b;};'use strict';var Sequelize=require('sequelize');module[_0x4a47('0x0')]={'name':{'type':Sequelize[_0x4a47('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x96a0=['exports'];(function(_0x349a2d,_0x2a748b){var _0xa6b2ca=function(_0x525251){while(--_0x525251){_0x349a2d['push'](_0x349a2d['shift']());}};_0xa6b2ca(++_0x2a748b);}(_0x96a0,0xb2));var _0x096a=function(_0x4832fe,_0x3558aa){_0x4832fe=_0x4832fe-0x0;var _0x237c72=_0x96a0[_0x4832fe];return _0x237c72;};'use strict';var Sequelize=require('sequelize');module[_0x096a('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index a7156c5..e70f15a 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 _0xb027=['send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','Disposition','includeAll','include','findAll','rows','catch','length','find','create','body','user','role','UserProfileSection','params','rimraf','zip-dir','request-promise','moment','mustache','util','sox','to-csv','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','save','update','get','Dispositions','UserProfileResource','destroy','then','stack','name'];(function(_0x122395,_0x7851b0){var _0x264333=function(_0x516da5){while(--_0x516da5){_0x122395['push'](_0x122395['shift']());}};_0x264333(++_0x7851b0);}(_0xb027,0x191));var _0x7b02=function(_0x5dc2a7,_0x5cdc58){_0x5dc2a7=_0x5dc2a7-0x0;var _0x149c6c=_0xb027[_0x5dc2a7];return _0x149c6c;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x7b02('0x0'));var zipdir=require(_0x7b02('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7b02('0x2'));var moment=require(_0x7b02('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x7b02('0x4'));var util=require(_0x7b02('0x5'));var path=require('path');var sox=require(_0x7b02('0x6'));var csv=require(_0x7b02('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x7b02('0x8'));var squel=require('squel');var crypto=require(_0x7b02('0x9'));var jsforce=require(_0x7b02('0xa'));var deskjs=require(_0x7b02('0xb'));var toCsv=require(_0x7b02('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x7b02('0xc'));var authService=require(_0x7b02('0xd'));var qs=require(_0x7b02('0xe'));var as=require(_0x7b02('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7b02('0x10'));var utils=require('../../config/utils');var config=require(_0x7b02('0x11'));var db=require(_0x7b02('0x12'))['db'];function respondWithStatusCode(_0x20cd88,_0x15ef06){_0x15ef06=_0x15ef06||0xcc;return function(_0xbb69ec){if(_0xbb69ec){return _0x20cd88[_0x7b02('0x13')](_0x15ef06);}return _0x20cd88[_0x7b02('0x14')](_0x15ef06)[_0x7b02('0x15')]();};}function respondWithResult(_0x1f846f,_0x5708bc){_0x5708bc=_0x5708bc||0xc8;return function(_0x253bfe){if(_0x253bfe){return _0x1f846f[_0x7b02('0x14')](_0x5708bc)[_0x7b02('0x16')](_0x253bfe);}};}function respondWithFilteredResult(_0x2502c1,_0x2d81fe){return function(_0x574777){if(_0x574777){var _0x5d6d63=_0x574777[_0x7b02('0x17')],_0x4c0acb=_0x2d81fe[_0x7b02('0x18')],_0x53488b=_0x2d81fe[_0x7b02('0x18')]+_0x2d81fe[_0x7b02('0x19')],_0x584fcd;if(_0x53488b>=_0x5d6d63){_0x53488b=_0x5d6d63;_0x584fcd=0xc8;}else{_0x584fcd=0xce;}_0x2502c1[_0x7b02('0x14')](_0x584fcd);return _0x2502c1[_0x7b02('0x1a')](_0x7b02('0x1b'),_0x4c0acb+'-'+_0x53488b+'/'+_0x5d6d63)['json'](_0x574777);}return null;};}function patchUpdates(_0x16e9ee){return function(_0x24793b){try{jsonpatch['apply'](_0x24793b,_0x16e9ee,!![]);}catch(_0x4a43f4){return BPromise['reject'](_0x4a43f4);}return _0x24793b[_0x7b02('0x1c')]();};}function saveUpdates(_0x2feaa9,_0x4921a7){return function(_0x10b771){if(_0x10b771){return _0x10b771[_0x7b02('0x1d')](_0x2feaa9)['then'](function(_0x1766c8){return _0x1766c8;});}return null;};}function removeEntity(_0xd2296a,_0x41a3ad){return function(_0x2cd08a){if(_0x2cd08a){return _0x2cd08a['destroy']()['then'](function(){var _0x2f73c7=_0x2cd08a[_0x7b02('0x1e')]({'plain':!![]});var _0x24cfbf=_0x7b02('0x1f');return db[_0x7b02('0x20')][_0x7b02('0x21')]({'where':{'type':_0x24cfbf,'resourceId':_0x2f73c7['id']}})[_0x7b02('0x22')](function(){return _0x2cd08a;});})[_0x7b02('0x22')](function(){_0xd2296a[_0x7b02('0x14')](0xcc)[_0x7b02('0x15')]();});}};}function handleEntityNotFound(_0x6c951d,_0xc2a77b){return function(_0x55933c){if(!_0x55933c){_0x6c951d['sendStatus'](0x194);}return _0x55933c;};}function handleError(_0x3b4bab,_0x3f2375){_0x3f2375=_0x3f2375||0x1f4;return function(_0x2de9b2){logger['error'](_0x2de9b2[_0x7b02('0x23')]);if(_0x2de9b2['name']){delete _0x2de9b2[_0x7b02('0x24')];}_0x3b4bab[_0x7b02('0x14')](_0x3f2375)[_0x7b02('0x25')](_0x2de9b2);};}exports[_0x7b02('0x26')]=function(_0x565a25,_0x12f005){var _0x3b5aaa={},_0x4262e7={},_0x1c9632={'count':0x0,'rows':[]};var _0x2db658=_[_0x7b02('0x27')](db['Disposition'][_0x7b02('0x28')],function(_0x3f2287){return{'name':_0x3f2287[_0x7b02('0x29')],'type':_0x3f2287[_0x7b02('0x2a')][_0x7b02('0x2b')]};});_0x4262e7[_0x7b02('0x2c')]=_[_0x7b02('0x27')](_0x2db658,_0x7b02('0x24'));_0x4262e7[_0x7b02('0x2d')]=_[_0x7b02('0x2e')](_0x565a25['query']);_0x4262e7[_0x7b02('0x2f')]=_[_0x7b02('0x30')](_0x4262e7[_0x7b02('0x2c')],_0x4262e7[_0x7b02('0x2d')]);_0x3b5aaa['attributes']=_['intersection'](_0x4262e7['model'],qs[_0x7b02('0x31')](_0x565a25[_0x7b02('0x2d')]['fields']));_0x3b5aaa['attributes']=_0x3b5aaa[_0x7b02('0x32')]['length']?_0x3b5aaa['attributes']:_0x4262e7[_0x7b02('0x2c')];if(!_0x565a25[_0x7b02('0x2d')][_0x7b02('0x33')]('nolimit')){_0x3b5aaa[_0x7b02('0x19')]=qs['limit'](_0x565a25[_0x7b02('0x2d')][_0x7b02('0x19')]);_0x3b5aaa[_0x7b02('0x18')]=qs[_0x7b02('0x18')](_0x565a25['query'][_0x7b02('0x18')]);}_0x3b5aaa[_0x7b02('0x34')]=qs[_0x7b02('0x35')](_0x565a25[_0x7b02('0x2d')][_0x7b02('0x35')]);_0x3b5aaa['where']=qs[_0x7b02('0x2f')](_[_0x7b02('0x36')](_0x565a25['query'],_0x4262e7[_0x7b02('0x2f')]),_0x2db658);if(_0x565a25['query'][_0x7b02('0x37')]){_0x3b5aaa[_0x7b02('0x38')]=_[_0x7b02('0x39')](_0x3b5aaa['where'],{'$or':_[_0x7b02('0x27')](_0x2db658,function(_0x2f8649){if(_0x2f8649[_0x7b02('0x2a')]!==_0x7b02('0x3a')){var _0x83412b={};_0x83412b[_0x2f8649[_0x7b02('0x24')]]={'$like':'%'+_0x565a25[_0x7b02('0x2d')][_0x7b02('0x37')]+'%'};return _0x83412b;}})});}_0x3b5aaa=_[_0x7b02('0x39')]({},_0x3b5aaa,_0x565a25['options']);var _0x4653de={'where':_0x3b5aaa[_0x7b02('0x38')]};return db[_0x7b02('0x3b')][_0x7b02('0x17')](_0x4653de)[_0x7b02('0x22')](function(_0x12647f){_0x1c9632[_0x7b02('0x17')]=_0x12647f;if(_0x565a25['query'][_0x7b02('0x3c')]){_0x3b5aaa[_0x7b02('0x3d')]=[{'all':!![]}];}return db['Disposition'][_0x7b02('0x3e')](_0x3b5aaa);})['then'](function(_0x2ccb2c){_0x1c9632[_0x7b02('0x3f')]=_0x2ccb2c;return _0x1c9632;})[_0x7b02('0x22')](respondWithFilteredResult(_0x12f005,_0x3b5aaa))[_0x7b02('0x40')](handleError(_0x12f005,null));};exports['show']=function(_0x4c92d1,_0x1c53c8){var _0x31f685={'raw':!![],'where':{'id':_0x4c92d1['params']['id']}},_0x5a059f={};_0x5a059f[_0x7b02('0x2c')]=_[_0x7b02('0x2e')](db[_0x7b02('0x3b')][_0x7b02('0x28')]);_0x5a059f[_0x7b02('0x2d')]=_[_0x7b02('0x2e')](_0x4c92d1['query']);_0x5a059f[_0x7b02('0x2f')]=_[_0x7b02('0x30')](_0x5a059f[_0x7b02('0x2c')],_0x5a059f[_0x7b02('0x2d')]);_0x31f685[_0x7b02('0x32')]=_[_0x7b02('0x30')](_0x5a059f[_0x7b02('0x2c')],qs[_0x7b02('0x31')](_0x4c92d1['query'][_0x7b02('0x31')]));_0x31f685['attributes']=_0x31f685['attributes'][_0x7b02('0x41')]?_0x31f685[_0x7b02('0x32')]:_0x5a059f[_0x7b02('0x2c')];if(_0x4c92d1[_0x7b02('0x2d')]['includeAll']){_0x31f685['include']=[{'all':!![]}];}_0x31f685=_[_0x7b02('0x39')]({},_0x31f685,_0x4c92d1['options']);return db[_0x7b02('0x3b')][_0x7b02('0x42')](_0x31f685)[_0x7b02('0x22')](handleEntityNotFound(_0x1c53c8,null))[_0x7b02('0x22')](respondWithResult(_0x1c53c8,null))[_0x7b02('0x40')](handleError(_0x1c53c8,null));};exports[_0x7b02('0x43')]=function(_0x6000a0,_0x2777de){return db[_0x7b02('0x3b')][_0x7b02('0x43')](_0x6000a0[_0x7b02('0x44')],{})[_0x7b02('0x22')](function(_0xab5ba5){var _0x4c5a6e=_0x6000a0[_0x7b02('0x45')][_0x7b02('0x1e')]({'plain':!![]});if(!_0x4c5a6e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4c5a6e[_0x7b02('0x46')]==='user'){var _0x2de710=_0xab5ba5[_0x7b02('0x1e')]({'plain':!![]});var _0x439d9=_0x7b02('0x1f');return db[_0x7b02('0x47')][_0x7b02('0x42')]({'where':{'name':_0x439d9,'userProfileId':_0x4c5a6e['userProfileId']},'raw':!![]})[_0x7b02('0x22')](function(_0x4931d0){if(_0x4931d0&&_0x4931d0['autoAssociation']===0x0){return db[_0x7b02('0x20')][_0x7b02('0x43')]({'name':_0x2de710[_0x7b02('0x24')],'resourceId':_0x2de710['id'],'type':_0x4931d0[_0x7b02('0x24')],'sectionId':_0x4931d0['id']},{})[_0x7b02('0x22')](function(){return _0xab5ba5;});}else{return _0xab5ba5;}})[_0x7b02('0x40')](function(_0x539b9f){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x539b9f);throw _0x539b9f;});}return _0xab5ba5;})[_0x7b02('0x22')](respondWithResult(_0x2777de,0xc9))[_0x7b02('0x40')](handleError(_0x2777de,null));};exports[_0x7b02('0x1d')]=function(_0x3c9172,_0x35e26d){if(_0x3c9172[_0x7b02('0x44')]['id']){delete _0x3c9172[_0x7b02('0x44')]['id'];}return db[_0x7b02('0x3b')][_0x7b02('0x42')]({'where':{'id':_0x3c9172['params']['id']}})[_0x7b02('0x22')](handleEntityNotFound(_0x35e26d,null))[_0x7b02('0x22')](saveUpdates(_0x3c9172[_0x7b02('0x44')],null))[_0x7b02('0x22')](respondWithResult(_0x35e26d,null))[_0x7b02('0x40')](handleError(_0x35e26d,null));};exports['destroy']=function(_0x59652e,_0xa84494){return db[_0x7b02('0x3b')][_0x7b02('0x42')]({'where':{'id':_0x59652e[_0x7b02('0x48')]['id']}})['then'](handleEntityNotFound(_0xa84494,null))[_0x7b02('0x22')](removeEntity(_0xa84494,null))[_0x7b02('0x40')](handleError(_0xa84494,null));}; \ No newline at end of file +var _0x6837=['fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','status','end','json','offset','set','Content-Range','apply','update','then','get','Dispositions','UserProfileResource','destroy','sendStatus','error','stack','send','index','type','key','model','map','name','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','limit','where','pick','filter','VIRTUAL','merge','options','Disposition','count','includeAll','findAll','catch','show','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir'];(function(_0x292602,_0x2a58e2){var _0x1a3b4d=function(_0x4f2f9b){while(--_0x4f2f9b){_0x292602['push'](_0x292602['shift']());}};_0x1a3b4d(++_0x2a58e2);}(_0x6837,0x184));var _0x7683=function(_0x1c5ed8,_0xdf27ce){_0x1c5ed8=_0x1c5ed8-0x0;var _0x5fa9e4=_0x6837[_0x1c5ed8];return _0x5fa9e4;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x7683('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7683('0x1'));var jsonpatch=require(_0x7683('0x2'));var rp=require(_0x7683('0x3'));var moment=require(_0x7683('0x4'));var BPromise=require(_0x7683('0x5'));var Mustache=require(_0x7683('0x6'));var util=require(_0x7683('0x7'));var path=require(_0x7683('0x8'));var sox=require('sox');var csv=require(_0x7683('0x9'));var ejs=require(_0x7683('0xa'));var fs=require('fs');var _=require(_0x7683('0xb'));var squel=require('squel');var crypto=require(_0x7683('0xc'));var jsforce=require(_0x7683('0xd'));var deskjs=require(_0x7683('0xe'));var toCsv=require(_0x7683('0x9'));var querystring=require(_0x7683('0xf'));var Papa=require(_0x7683('0x10'));var Redis=require(_0x7683('0x11'));var authService=require(_0x7683('0x12'));var qs=require(_0x7683('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x7683('0x14'))(_0x7683('0x15'));var utils=require(_0x7683('0x16'));var config=require(_0x7683('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3a3447,_0x4037e0){_0x4037e0=_0x4037e0||0xcc;return function(_0x1f3609){if(_0x1f3609){return _0x3a3447['sendStatus'](_0x4037e0);}return _0x3a3447[_0x7683('0x18')](_0x4037e0)[_0x7683('0x19')]();};}function respondWithResult(_0x301433,_0x14fc21){_0x14fc21=_0x14fc21||0xc8;return function(_0x28cd76){if(_0x28cd76){return _0x301433[_0x7683('0x18')](_0x14fc21)[_0x7683('0x1a')](_0x28cd76);}};}function respondWithFilteredResult(_0x185a59,_0x1b0734){return function(_0x2a822e){if(_0x2a822e){var _0x48c3a5=_0x2a822e['count'],_0x37d7d6=_0x1b0734[_0x7683('0x1b')],_0x5cadce=_0x1b0734[_0x7683('0x1b')]+_0x1b0734['limit'],_0x2587cf;if(_0x5cadce>=_0x48c3a5){_0x5cadce=_0x48c3a5;_0x2587cf=0xc8;}else{_0x2587cf=0xce;}_0x185a59[_0x7683('0x18')](_0x2587cf);return _0x185a59[_0x7683('0x1c')](_0x7683('0x1d'),_0x37d7d6+'-'+_0x5cadce+'/'+_0x48c3a5)['json'](_0x2a822e);}return null;};}function patchUpdates(_0x23d01f){return function(_0x3b46e5){try{jsonpatch[_0x7683('0x1e')](_0x3b46e5,_0x23d01f,!![]);}catch(_0x341dda){return BPromise['reject'](_0x341dda);}return _0x3b46e5['save']();};}function saveUpdates(_0x230790,_0x285662){return function(_0x497604){if(_0x497604){return _0x497604[_0x7683('0x1f')](_0x230790)['then'](function(_0x58b740){return _0x58b740;});}return null;};}function removeEntity(_0x7fbf9d,_0x152497){return function(_0x589d34){if(_0x589d34){return _0x589d34['destroy']()[_0x7683('0x20')](function(){var _0x1932ca=_0x589d34[_0x7683('0x21')]({'plain':!![]});var _0x2326f7=_0x7683('0x22');return db[_0x7683('0x23')][_0x7683('0x24')]({'where':{'type':_0x2326f7,'resourceId':_0x1932ca['id']}})[_0x7683('0x20')](function(){return _0x589d34;});})['then'](function(){_0x7fbf9d[_0x7683('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x19bb2c,_0x453239){return function(_0x3e5a50){if(!_0x3e5a50){_0x19bb2c[_0x7683('0x25')](0x194);}return _0x3e5a50;};}function handleError(_0x48b2c9,_0x4911c2){_0x4911c2=_0x4911c2||0x1f4;return function(_0x227c34){logger[_0x7683('0x26')](_0x227c34[_0x7683('0x27')]);if(_0x227c34['name']){delete _0x227c34['name'];}_0x48b2c9[_0x7683('0x18')](_0x4911c2)[_0x7683('0x28')](_0x227c34);};}exports[_0x7683('0x29')]=function(_0x12dba5,_0x5795ca){var _0x450257={},_0x16624a={},_0x30dc31={'count':0x0,'rows':[]};var _0x44ead9=_['map'](db['Disposition']['rawAttributes'],function(_0x2bb7f9){return{'name':_0x2bb7f9['fieldName'],'type':_0x2bb7f9[_0x7683('0x2a')][_0x7683('0x2b')]};});_0x16624a[_0x7683('0x2c')]=_[_0x7683('0x2d')](_0x44ead9,_0x7683('0x2e'));_0x16624a[_0x7683('0x2f')]=_[_0x7683('0x30')](_0x12dba5['query']);_0x16624a[_0x7683('0x31')]=_[_0x7683('0x32')](_0x16624a[_0x7683('0x2c')],_0x16624a['query']);_0x450257['attributes']=_[_0x7683('0x32')](_0x16624a[_0x7683('0x2c')],qs[_0x7683('0x33')](_0x12dba5['query'][_0x7683('0x33')]));_0x450257[_0x7683('0x34')]=_0x450257[_0x7683('0x34')][_0x7683('0x35')]?_0x450257['attributes']:_0x16624a[_0x7683('0x2c')];if(!_0x12dba5[_0x7683('0x2f')][_0x7683('0x36')]('nolimit')){_0x450257['limit']=qs[_0x7683('0x37')](_0x12dba5[_0x7683('0x2f')][_0x7683('0x37')]);_0x450257[_0x7683('0x1b')]=qs[_0x7683('0x1b')](_0x12dba5[_0x7683('0x2f')][_0x7683('0x1b')]);}_0x450257['order']=qs['sort'](_0x12dba5[_0x7683('0x2f')]['sort']);_0x450257[_0x7683('0x38')]=qs['filters'](_[_0x7683('0x39')](_0x12dba5['query'],_0x16624a[_0x7683('0x31')]),_0x44ead9);if(_0x12dba5[_0x7683('0x2f')][_0x7683('0x3a')]){_0x450257[_0x7683('0x38')]=_['merge'](_0x450257[_0x7683('0x38')],{'$or':_[_0x7683('0x2d')](_0x44ead9,function(_0x530acf){if(_0x530acf['type']!==_0x7683('0x3b')){var _0x6f77c9={};_0x6f77c9[_0x530acf[_0x7683('0x2e')]]={'$like':'%'+_0x12dba5[_0x7683('0x2f')][_0x7683('0x3a')]+'%'};return _0x6f77c9;}})});}_0x450257=_[_0x7683('0x3c')]({},_0x450257,_0x12dba5[_0x7683('0x3d')]);var _0x28540d={'where':_0x450257[_0x7683('0x38')]};return db[_0x7683('0x3e')][_0x7683('0x3f')](_0x28540d)[_0x7683('0x20')](function(_0x2da65f){_0x30dc31[_0x7683('0x3f')]=_0x2da65f;if(_0x12dba5[_0x7683('0x2f')][_0x7683('0x40')]){_0x450257['include']=[{'all':!![]}];}return db[_0x7683('0x3e')][_0x7683('0x41')](_0x450257);})[_0x7683('0x20')](function(_0x2e1ac5){_0x30dc31['rows']=_0x2e1ac5;return _0x30dc31;})['then'](respondWithFilteredResult(_0x5795ca,_0x450257))[_0x7683('0x42')](handleError(_0x5795ca,null));};exports[_0x7683('0x43')]=function(_0x5b4ed7,_0x3fb174){var _0x52f3de={'raw':!![],'where':{'id':_0x5b4ed7['params']['id']}},_0x4f9b17={};_0x4f9b17[_0x7683('0x2c')]=_[_0x7683('0x30')](db[_0x7683('0x3e')][_0x7683('0x44')]);_0x4f9b17[_0x7683('0x2f')]=_[_0x7683('0x30')](_0x5b4ed7[_0x7683('0x2f')]);_0x4f9b17[_0x7683('0x31')]=_['intersection'](_0x4f9b17[_0x7683('0x2c')],_0x4f9b17[_0x7683('0x2f')]);_0x52f3de[_0x7683('0x34')]=_[_0x7683('0x32')](_0x4f9b17['model'],qs['fields'](_0x5b4ed7[_0x7683('0x2f')]['fields']));_0x52f3de['attributes']=_0x52f3de[_0x7683('0x34')][_0x7683('0x35')]?_0x52f3de['attributes']:_0x4f9b17[_0x7683('0x2c')];if(_0x5b4ed7['query']['includeAll']){_0x52f3de['include']=[{'all':!![]}];}_0x52f3de=_[_0x7683('0x3c')]({},_0x52f3de,_0x5b4ed7['options']);return db[_0x7683('0x3e')][_0x7683('0x45')](_0x52f3de)[_0x7683('0x20')](handleEntityNotFound(_0x3fb174,null))['then'](respondWithResult(_0x3fb174,null))[_0x7683('0x42')](handleError(_0x3fb174,null));};exports[_0x7683('0x46')]=function(_0x31a102,_0xa7af25){return db[_0x7683('0x3e')][_0x7683('0x46')](_0x31a102[_0x7683('0x47')],{})[_0x7683('0x20')](function(_0xd91e5){var _0x12dc36=_0x31a102[_0x7683('0x48')]['get']({'plain':!![]});if(!_0x12dc36)throw new Error(_0x7683('0x49'));if(_0x12dc36['role']===_0x7683('0x48')){var _0x8b9182=_0xd91e5['get']({'plain':!![]});var _0x4a1595='Dispositions';return db[_0x7683('0x4a')]['find']({'where':{'name':_0x4a1595,'userProfileId':_0x12dc36[_0x7683('0x4b')]},'raw':!![]})[_0x7683('0x20')](function(_0x3b9090){if(_0x3b9090&&_0x3b9090[_0x7683('0x4c')]===0x0){return db[_0x7683('0x23')][_0x7683('0x46')]({'name':_0x8b9182[_0x7683('0x2e')],'resourceId':_0x8b9182['id'],'type':_0x3b9090[_0x7683('0x2e')],'sectionId':_0x3b9090['id']},{})[_0x7683('0x20')](function(){return _0xd91e5;});}else{return _0xd91e5;}})[_0x7683('0x42')](function(_0x5d8fcd){logger[_0x7683('0x26')](_0x7683('0x4d'),_0x5d8fcd);throw _0x5d8fcd;});}return _0xd91e5;})[_0x7683('0x20')](respondWithResult(_0xa7af25,0xc9))[_0x7683('0x42')](handleError(_0xa7af25,null));};exports[_0x7683('0x1f')]=function(_0x256935,_0x2f9f77){if(_0x256935[_0x7683('0x47')]['id']){delete _0x256935[_0x7683('0x47')]['id'];}return db[_0x7683('0x3e')]['find']({'where':{'id':_0x256935['params']['id']}})['then'](handleEntityNotFound(_0x2f9f77,null))[_0x7683('0x20')](saveUpdates(_0x256935[_0x7683('0x47')],null))[_0x7683('0x20')](respondWithResult(_0x2f9f77,null))[_0x7683('0x42')](handleError(_0x2f9f77,null));};exports[_0x7683('0x24')]=function(_0x40acb8,_0x53e423){return db[_0x7683('0x3e')]['find']({'where':{'id':_0x40acb8['params']['id']}})[_0x7683('0x20')](handleEntityNotFound(_0x53e423,null))[_0x7683('0x20')](removeEntity(_0x53e423,null))[_0x7683('0x42')](handleError(_0x53e423,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 1e969af..452d92c 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 _0x5c1f=['api','bluebird','request-promise','path','exports','define','Disposition','tools_dispositions','name_voice','ChatWebsiteId','name_mail','name','MailAccountId','name_sms','SmsAccountId','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash','../../config/logger'];(function(_0x5f01a7,_0x5cb047){var _0x2f8b0b=function(_0x596602){while(--_0x596602){_0x5f01a7['push'](_0x5f01a7['shift']());}};_0x2f8b0b(++_0x5cb047);}(_0x5c1f,0x1b3));var _0xf5c1=function(_0x5678b5,_0x1c4aa8){_0x5678b5=_0x5678b5-0x0;var _0x4c09a5=_0x5c1f[_0x5678b5];return _0x4c09a5;};'use strict';var _=require(_0xf5c1('0x0'));var util=require('util');var logger=require(_0xf5c1('0x1'))(_0xf5c1('0x2'));var moment=require('moment');var BPromise=require(_0xf5c1('0x3'));var rp=require(_0xf5c1('0x4'));var fs=require('fs');var path=require(_0xf5c1('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./disposition.attributes');module[_0xf5c1('0x6')]=function(_0x3a7475,_0x52e4cb){return _0x3a7475[_0xf5c1('0x7')](_0xf5c1('0x8'),attributes,{'tableName':_0xf5c1('0x9'),'paranoid':![],'indexes':[{'unique':!![],'name':_0xf5c1('0xa'),'fields':['name','ListId']},{'unique':!![],'name':'name_chat','fields':['name',_0xf5c1('0xb')]},{'unique':!![],'name':_0xf5c1('0xc'),'fields':[_0xf5c1('0xd'),_0xf5c1('0xe')]},{'unique':!![],'name':_0xf5c1('0xf'),'fields':[_0xf5c1('0xd'),_0xf5c1('0x10')]},{'unique':!![],'name':_0xf5c1('0x11'),'fields':['name',_0xf5c1('0x12')]},{'unique':!![],'name':_0xf5c1('0x13'),'fields':[_0xf5c1('0xd'),_0xf5c1('0x14')]},{'unique':!![],'name':_0xf5c1('0x15'),'fields':['name',_0xf5c1('0x16')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe93b=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./disposition.attributes','exports','define','Disposition','tools_dispositions','name_voice','name','ListId','name_chat','ChatWebsiteId','MailAccountId','name_sms','SmsAccountId','name_fax','FaxAccountId','name_openchannel','WhatsappAccountId'];(function(_0x7844b9,_0x579e6a){var _0x4e9db6=function(_0x319afb){while(--_0x319afb){_0x7844b9['push'](_0x7844b9['shift']());}};_0x4e9db6(++_0x579e6a);}(_0xe93b,0x1c2));var _0xbe93=function(_0x1f967a,_0x43333c){_0x1f967a=_0x1f967a-0x0;var _0x2de6e2=_0xe93b[_0x1f967a];return _0x2de6e2;};'use strict';var _=require('lodash');var util=require(_0xbe93('0x0'));var logger=require(_0xbe93('0x1'))(_0xbe93('0x2'));var moment=require('moment');var BPromise=require(_0xbe93('0x3'));var rp=require(_0xbe93('0x4'));var fs=require('fs');var path=require(_0xbe93('0x5'));var rimraf=require(_0xbe93('0x6'));var config=require(_0xbe93('0x7'));var attributes=require(_0xbe93('0x8'));module[_0xbe93('0x9')]=function(_0x704555,_0x5ad742){return _0x704555[_0xbe93('0xa')](_0xbe93('0xb'),attributes,{'tableName':_0xbe93('0xc'),'paranoid':![],'indexes':[{'unique':!![],'name':_0xbe93('0xd'),'fields':[_0xbe93('0xe'),_0xbe93('0xf')]},{'unique':!![],'name':_0xbe93('0x10'),'fields':[_0xbe93('0xe'),_0xbe93('0x11')]},{'unique':!![],'name':'name_mail','fields':[_0xbe93('0xe'),_0xbe93('0x12')]},{'unique':!![],'name':_0xbe93('0x13'),'fields':[_0xbe93('0xe'),_0xbe93('0x14')]},{'unique':!![],'name':_0xbe93('0x15'),'fields':['name',_0xbe93('0x16')]},{'unique':!![],'name':_0xbe93('0x17'),'fields':[_0xbe93('0xe'),'OpenchannelAccountId']},{'unique':!![],'name':'name_whatsapp','fields':[_0xbe93('0xe'),_0xbe93('0x18')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 926db94..f92cc7b 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 _0x51a4=['code','message','info','Disposition,\x20%s,\x20%s','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','request','request\x20sent','Disposition,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0xecc801,_0x37a8d1){var _0x36d0e8=function(_0x17a0bf){while(--_0x17a0bf){_0xecc801['push'](_0xecc801['shift']());}};_0x36d0e8(++_0x37a8d1);}(_0x51a4,0x16e));var _0x451a=function(_0x344dd7,_0x39eb8c){_0x344dd7=_0x344dd7-0x0;var _0x3fcba8=_0x51a4[_0x344dd7];return _0x3fcba8;};'use strict';var _=require('lodash');var util=require(_0x451a('0x0'));var moment=require(_0x451a('0x1'));var BPromise=require(_0x451a('0x2'));var rs=require(_0x451a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x451a('0x4'))['db'];var utils=require(_0x451a('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x451a('0x6'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5b11ac,_0x2389c5,_0x4cc715){return new BPromise(function(_0xd19767,_0x2cdf3e){return client[_0x451a('0x7')](_0x5b11ac,_0x4cc715)['then'](function(_0x2976a1){logger['info']('Disposition,\x20%s,\x20%s',_0x2389c5,_0x451a('0x8'));logger['debug'](_0x451a('0x9'),_0x2389c5,_0x451a('0x8'),JSON[_0x451a('0xa')](_0x2976a1));if(_0x2976a1[_0x451a('0xb')]){if(_0x2976a1['error'][_0x451a('0xc')]===0x1f4){logger[_0x451a('0xb')]('Disposition,\x20%s,\x20%s',_0x2389c5,_0x2976a1[_0x451a('0xb')][_0x451a('0xd')]);return _0x2cdf3e(_0x2976a1[_0x451a('0xb')]['message']);}logger[_0x451a('0xb')]('Disposition,\x20%s,\x20%s',_0x2389c5,_0x2976a1[_0x451a('0xb')][_0x451a('0xd')]);return _0xd19767(_0x2976a1[_0x451a('0xb')][_0x451a('0xd')]);}else{logger[_0x451a('0xe')](_0x451a('0xf'),_0x2389c5,_0x451a('0x8'));_0xd19767(_0x2976a1[_0x451a('0x10')][_0x451a('0xd')]);}})[_0x451a('0x11')](function(_0x523e2d){logger[_0x451a('0xb')](_0x451a('0xf'),_0x2389c5,_0x523e2d);_0x2cdf3e(_0x523e2d);});});} \ No newline at end of file +var _0x8764=['debug','Disposition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Disposition,\x20%s,\x20%s','request\x20sent'];(function(_0xa3dc31,_0x4d19b2){var _0x3329a5=function(_0x547602){while(--_0x547602){_0xa3dc31['push'](_0xa3dc31['shift']());}};_0x3329a5(++_0x4d19b2);}(_0x8764,0x197));var _0x4876=function(_0x4ad18d,_0x467ceb){_0x4ad18d=_0x4ad18d-0x0;var _0x467d92=_0x8764[_0x4ad18d];return _0x467d92;};'use strict';var _=require(_0x4876('0x0'));var util=require(_0x4876('0x1'));var moment=require(_0x4876('0x2'));var BPromise=require(_0x4876('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4876('0x4'));var db=require(_0x4876('0x5'))['db'];var utils=require(_0x4876('0x6'));var logger=require(_0x4876('0x7'))(_0x4876('0x8'));var config=require(_0x4876('0x9'));var jayson=require(_0x4876('0xa'));var client=jayson[_0x4876('0xb')][_0x4876('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x51a6cf,_0x477646,_0x4c5291){return new BPromise(function(_0x3d2be0,_0x4f4f69){return client[_0x4876('0xd')](_0x51a6cf,_0x4c5291)[_0x4876('0xe')](function(_0x1079ff){logger[_0x4876('0xf')](_0x4876('0x10'),_0x477646,_0x4876('0x11'));logger[_0x4876('0x12')](_0x4876('0x13'),_0x477646,_0x4876('0x11'),JSON[_0x4876('0x14')](_0x1079ff));if(_0x1079ff[_0x4876('0x15')]){if(_0x1079ff[_0x4876('0x15')][_0x4876('0x16')]===0x1f4){logger[_0x4876('0x15')](_0x4876('0x10'),_0x477646,_0x1079ff[_0x4876('0x15')]['message']);return _0x4f4f69(_0x1079ff[_0x4876('0x15')][_0x4876('0x17')]);}logger['error'](_0x4876('0x10'),_0x477646,_0x1079ff[_0x4876('0x15')]['message']);return _0x3d2be0(_0x1079ff[_0x4876('0x15')]['message']);}else{logger['info'](_0x4876('0x10'),_0x477646,_0x4876('0x11'));_0x3d2be0(_0x1079ff[_0x4876('0x18')][_0x4876('0x17')]);}})['catch'](function(_0x3340bc){logger['error'](_0x4876('0x10'),_0x477646,_0x3340bc);_0x4f4f69(_0x3340bc);});});} \ No newline at end of file diff --git a/server/api/disposition/index.js b/server/api/disposition/index.js index b5e7fba..20ef840 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 _0xb016=['delete','destroy','exports','multer','util','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./disposition.controller','isAuthenticated','index','get','show','post','put','/:id','update'];(function(_0x276846,_0x7c88b0){var _0x25a493=function(_0x31d735){while(--_0x31d735){_0x276846['push'](_0x276846['shift']());}};_0x25a493(++_0x7c88b0);}(_0xb016,0x159));var _0x6b01=function(_0x1ded18,_0x1c6634){_0x1ded18=_0x1ded18-0x0;var _0x5ef7cd=_0xb016[_0x1ded18];return _0x5ef7cd;};'use strict';var multer=require(_0x6b01('0x0'));var util=require(_0x6b01('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x6b01('0x2'));var router=express['Router']();var auth=require(_0x6b01('0x3'));var interaction=require(_0x6b01('0x4'));var config=require(_0x6b01('0x5'));var controller=require(_0x6b01('0x6'));router['get']('/',auth[_0x6b01('0x7')](),controller[_0x6b01('0x8')]);router[_0x6b01('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x6b01('0xa')]);router[_0x6b01('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x6b01('0xc')](_0x6b01('0xd'),auth[_0x6b01('0x7')](),controller[_0x6b01('0xe')]);router[_0x6b01('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x6b01('0x10')]);module[_0x6b01('0x11')]=router; \ No newline at end of file +var _0x42f4=['isAuthenticated','/:id','show','post','put','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','get'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x42f4,0x19d));var _0x442f=function(_0xb5fc3e,_0x234703){_0xb5fc3e=_0xb5fc3e-0x0;var _0x2efc3c=_0x42f4[_0xb5fc3e];return _0x2efc3c;};'use strict';var multer=require(_0x442f('0x0'));var util=require('util');var path=require(_0x442f('0x1'));var timeout=require(_0x442f('0x2'));var express=require(_0x442f('0x3'));var router=express[_0x442f('0x4')]();var auth=require(_0x442f('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./disposition.controller');router[_0x442f('0x6')]('/',auth[_0x442f('0x7')](),controller['index']);router[_0x442f('0x6')](_0x442f('0x8'),auth[_0x442f('0x7')](),controller[_0x442f('0x9')]);router[_0x442f('0xa')]('/',auth[_0x442f('0x7')](),controller['create']);router[_0x442f('0xb')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x442f('0xc')](_0x442f('0x8'),auth[_0x442f('0x7')](),controller[_0x442f('0xd')]);module[_0x442f('0xe')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 1b73b19..55886aa 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 _0xe88f=['localstationid','4800','7200','14400','9600','12000','SIP','DADHI','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax'];(function(_0x549d00,_0x3ad946){var _0x46b21d=function(_0x1a2f32){while(--_0x1a2f32){_0x549d00['push'](_0x549d00['shift']());}};_0x46b21d(++_0x3ad946);}(_0xe88f,0x186));var _0xfe88=function(_0x5bd4f6,_0xf4e45c){_0x5bd4f6=_0x5bd4f6-0x0;var _0x33a165=_0xe88f[_0x5bd4f6];return _0x33a165;};'use strict';var Sequelize=require(_0xfe88('0x0'));module[_0xfe88('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xfe88('0x2')]},'ecm':{'type':Sequelize[_0xfe88('0x3')](_0xfe88('0x4'),'no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize[_0xfe88('0x2')],'defaultValue':_0xfe88('0x5')},'localstationid':{'type':Sequelize[_0xfe88('0x2')],'unique':_0xfe88('0x6')},'minrate':{'type':Sequelize['ENUM']('2400',_0xfe88('0x7'),_0xfe88('0x8'),'9600','12000',_0xfe88('0x9')),'defaultValue':_0xfe88('0x7')},'maxrate':{'type':Sequelize[_0xfe88('0x3')]('2400',_0xfe88('0x7'),'7200',_0xfe88('0xa'),_0xfe88('0xb'),'14400'),'defaultValue':_0xfe88('0x9')},'modem':{'type':Sequelize[_0xfe88('0x2')],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize[_0xfe88('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0xfe88('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xfe88('0x3')](_0xfe88('0xc'),'IAX',_0xfe88('0xd'),'KHOMP'),'defaultValue':'SIP'},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xfe88('0xe')],'defaultValue':function(){return _0xfe88('0xf');}},'notificationSound':{'type':Sequelize[_0xfe88('0x10')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xfe88('0x10')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xfe88('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xfe88('0x10')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xfe88('0x10')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xfe88('0x11')],'allowNull':!![],'defaultValue':null,'comment':_0xfe88('0x12')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x264a86){if(!_0x264a86)this[_0xfe88('0x13')](_0xfe88('0x14'),null);this['setDataValue'](_0xfe88('0x15'),_0x264a86);}}}; \ No newline at end of file +var _0xfe5e=['mandatoryDispositionPauseId','exports','STRING','yes','xCALLY\x20Motion\x20Fax','localstationid','ENUM','2400','4800','7200','9600','12000','14400','v17,v27,v29','INTEGER','IAX','DADHI','KHOMP','SIP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue'];(function(_0x4849f6,_0x104836){var _0x1a3dcd=function(_0x494d3c){while(--_0x494d3c){_0x4849f6['push'](_0x4849f6['shift']());}};_0x1a3dcd(++_0x104836);}(_0xfe5e,0xc1));var _0xefe5=function(_0x2f2cb8,_0x417d38){_0x2f2cb8=_0x2f2cb8-0x0;var _0x5a7add=_0xfe5e[_0x2f2cb8];return _0x5a7add;};'use strict';var Sequelize=require('sequelize');module[_0xefe5('0x0')]={'name':{'type':Sequelize[_0xefe5('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xefe5('0x1')]},'ecm':{'type':Sequelize['ENUM'](_0xefe5('0x2'),'no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize[_0xefe5('0x1')],'defaultValue':_0xefe5('0x3')},'localstationid':{'type':Sequelize[_0xefe5('0x1')],'unique':_0xefe5('0x4')},'minrate':{'type':Sequelize[_0xefe5('0x5')](_0xefe5('0x6'),_0xefe5('0x7'),_0xefe5('0x8'),_0xefe5('0x9'),_0xefe5('0xa'),_0xefe5('0xb')),'defaultValue':_0xefe5('0x7')},'maxrate':{'type':Sequelize[_0xefe5('0x5')](_0xefe5('0x6'),_0xefe5('0x7'),_0xefe5('0x8'),_0xefe5('0x9'),_0xefe5('0xa'),_0xefe5('0xb')),'defaultValue':_0xefe5('0xb')},'modem':{'type':Sequelize[_0xefe5('0x1')],'defaultValue':_0xefe5('0xc')},'gateway':{'type':Sequelize[_0xefe5('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0xefe5('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0xefe5('0xd')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize['ENUM']('SIP',_0xefe5('0xe'),_0xefe5('0xf'),_0xefe5('0x10')),'defaultValue':_0xefe5('0x11')},'key':{'type':Sequelize[_0xefe5('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xefe5('0x12')],'defaultValue':function(){return _0xefe5('0x13');}},'notificationSound':{'type':Sequelize[_0xefe5('0x14')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xefe5('0x14')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xefe5('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xefe5('0x14')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xefe5('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xefe5('0xd')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xefe5('0x14')],'defaultValue':![],'comment':_0xefe5('0x15'),'set':function(_0x2fc35d){if(!_0x2fc35d)this[_0xefe5('0x16')](_0xefe5('0x17'),null);this[_0xefe5('0x16')]('mandatoryDisposition',_0x2fc35d);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 5df127c..e97718e 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 _0x93ba=['register','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','json','count','offset','Content-Range','apply','reject','save','update','get','UserProfileResource','destroy','name','index','mandatoryDispositionPause','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','map','options','FaxAccount','includeAll','include','findAll','rows','show','params','Pause','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','FaxAccounts','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','Disposition','getDispositions','findOne','FaxAccountId','removeDispositions','CannedAnswer','length','removeAnswers','ids','addInteraction','FaxInteraction','omit','getInteractions','CmContact','Contact','User','internal','Tags','color','tag','addApplications','transaction','FaxApplication','bulkCreate','findAndCountAll','priority','getApplications','from-voip-provider','exten','localstationid','system','description','Fax\x20Extension','appdata','push','Set','ecm','gateway','faxdetect','headerinfo','maxrate','minrate','modem','t38timeout','FAXOPT(','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','VoiceExtension','updateAccountApplications','sequelize','tech','TrunkId','ListId','findById','getMessages','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','send','List','Contacts','updatedAt','attachments','join','server/files/attachments','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','List\x20not\x20found','Send\x20Fax\x20failed','out','Messages','Contact\x20not\x20found','spread','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','isArray','userFaxAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket'];(function(_0x1f4a8f,_0x3786b0){var _0x293e34=function(_0x4f313a){while(--_0x4f313a){_0x1f4a8f['push'](_0x1f4a8f['shift']());}};_0x293e34(++_0x3786b0);}(_0x93ba,0x16a));var _0xa93b=function(_0x4ad3df,_0x504543){_0x4ad3df=_0x4ad3df-0x0;var _0xbd9e63=_0x93ba[_0x4ad3df];return _0xbd9e63;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xa93b('0x0'));var rimraf=require(_0xa93b('0x1'));var zipdir=require(_0xa93b('0x2'));var jsonpatch=require(_0xa93b('0x3'));var rp=require(_0xa93b('0x4'));var moment=require(_0xa93b('0x5'));var BPromise=require(_0xa93b('0x6'));var Mustache=require(_0xa93b('0x7'));var util=require('util');var path=require(_0xa93b('0x8'));var sox=require('sox');var csv=require(_0xa93b('0x9'));var ejs=require(_0xa93b('0xa'));var fs=require('fs');var _=require(_0xa93b('0xb'));var squel=require(_0xa93b('0xc'));var crypto=require(_0xa93b('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xa93b('0xe'));var toCsv=require('to-csv');var querystring=require(_0xa93b('0xf'));var Papa=require(_0xa93b('0x10'));var Redis=require(_0xa93b('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xa93b('0x12'));var as=require(_0xa93b('0x13'));var hardwareService=require(_0xa93b('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xa93b('0x15'));var config=require('../../config/environment');var db=require(_0xa93b('0x16'))['db'];config[_0xa93b('0x17')]=_[_0xa93b('0x18')](config[_0xa93b('0x17')],{'host':_0xa93b('0x19'),'port':0x18eb});var socket=require(_0xa93b('0x1a'))(new Redis(config['redis']));require(_0xa93b('0x1b'))[_0xa93b('0x1c')](socket);var jayson=require(_0xa93b('0x1d'));var client=jayson[_0xa93b('0x1e')][_0xa93b('0x1f')]({'port':0x232c});var client9002=jayson[_0xa93b('0x1e')][_0xa93b('0x1f')]({'port':0x232a});function checkPasswordPattern(_0x349566,_0x7cd67b,_0x2bc5eb){if(_0x2bc5eb){var _0x42fff4=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x42fff4[_0xa93b('0x20')](_0x7cd67b)){return _0x349566;}else{throw new db[(_0xa93b('0x21'))][(_0xa93b('0x22'))](_0xa93b('0x23'));}}else{return _0x349566;}}function respondWithRpcPromise(_0x59913b,_0x64c15,_0x1d162d,_0x4a1887){return new BPromise(function(_0x3eab85,_0x4b16fa){var _0x43234b=_0x4a1887||client;return _0x43234b['request'](_0x59913b,_0x1d162d)[_0xa93b('0x24')](function(_0x3ad7fc){logger[_0xa93b('0x25')](_0xa93b('0x26'),_0x64c15,_0xa93b('0x27'));logger[_0xa93b('0x28')](_0xa93b('0x29'),_0x64c15,_0xa93b('0x27'),JSON[_0xa93b('0x2a')](_0x3ad7fc));if(_0x3ad7fc[_0xa93b('0x2b')]){if(_0x3ad7fc[_0xa93b('0x2b')]['code']===0x1f4){logger[_0xa93b('0x2b')](_0xa93b('0x26'),_0x64c15,_0x3ad7fc['error'][_0xa93b('0x2c')]);return _0x4b16fa(_0x3ad7fc[_0xa93b('0x2b')][_0xa93b('0x2c')]);}logger[_0xa93b('0x2b')](_0xa93b('0x26'),_0x64c15,_0x3ad7fc[_0xa93b('0x2b')][_0xa93b('0x2c')]);return _0x3eab85(_0x3ad7fc[_0xa93b('0x2b')][_0xa93b('0x2c')]);}else{logger[_0xa93b('0x25')](_0xa93b('0x26'),_0x64c15,_0xa93b('0x27'));_0x3eab85(_0x3ad7fc[_0xa93b('0x2d')][_0xa93b('0x2c')]);}})[_0xa93b('0x2e')](function(_0x5ea19e){logger[_0xa93b('0x2b')]('FaxAccount,\x20%s,\x20%s',_0x64c15,_0x5ea19e);_0x4b16fa(_0x5ea19e);});});}function respondWithStatusCode(_0x1ff09f,_0x5e8438){_0x5e8438=_0x5e8438||0xcc;return function(_0x31f3eb){if(_0x31f3eb){return _0x1ff09f[_0xa93b('0x2f')](_0x5e8438);}return _0x1ff09f[_0xa93b('0x30')](_0x5e8438)[_0xa93b('0x31')]();};}function respondWithResult(_0x352b87,_0x8197f2){_0x8197f2=_0x8197f2||0xc8;return function(_0x5d141d){if(_0x5d141d){return _0x352b87['status'](_0x8197f2)[_0xa93b('0x32')](_0x5d141d);}};}function respondWithFilteredResult(_0xb2d6a8,_0x5c7a9){return function(_0x226b78){if(_0x226b78){var _0x48fda3=_0x226b78[_0xa93b('0x33')],_0x519c56=_0x5c7a9[_0xa93b('0x34')],_0x5e3afd=_0x5c7a9[_0xa93b('0x34')]+_0x5c7a9['limit'],_0x3934b3;if(_0x5e3afd>=_0x48fda3){_0x5e3afd=_0x48fda3;_0x3934b3=0xc8;}else{_0x3934b3=0xce;}_0xb2d6a8['status'](_0x3934b3);return _0xb2d6a8['set'](_0xa93b('0x35'),_0x519c56+'-'+_0x5e3afd+'/'+_0x48fda3)['json'](_0x226b78);}return null;};}function patchUpdates(_0x428b1e){return function(_0x49a094){try{jsonpatch[_0xa93b('0x36')](_0x49a094,_0x428b1e,!![]);}catch(_0x39083d){return BPromise[_0xa93b('0x37')](_0x39083d);}return _0x49a094[_0xa93b('0x38')]();};}function saveUpdates(_0x12b03f,_0x8151ed){return function(_0x48cd36){if(_0x48cd36){return _0x48cd36[_0xa93b('0x39')](_0x12b03f)['then'](function(_0x10255f){return _0x10255f;});}return null;};}function removeEntity(_0x2c894d,_0x44c9b6){return function(_0x57c6ff){if(_0x57c6ff){return _0x57c6ff['destroy']()['then'](function(){var _0x164ea1=_0x57c6ff[_0xa93b('0x3a')]({'plain':!![]});var _0x1e4a05='FaxAccounts';return db[_0xa93b('0x3b')][_0xa93b('0x3c')]({'where':{'type':_0x1e4a05,'resourceId':_0x164ea1['id']}})[_0xa93b('0x24')](function(){return _0x57c6ff;});})[_0xa93b('0x24')](function(){_0x2c894d[_0xa93b('0x30')](0xcc)[_0xa93b('0x31')]();});}};}function handleEntityNotFound(_0x1b790d,_0x262131){return function(_0x19f32f){if(!_0x19f32f){_0x1b790d[_0xa93b('0x2f')](0x194);}return _0x19f32f;};}function handleError(_0x1d524d,_0x5bb89f){_0x5bb89f=_0x5bb89f||0x1f4;return function(_0x4fce18){logger[_0xa93b('0x2b')](_0x4fce18['stack']);if(_0x4fce18[_0xa93b('0x3d')]){delete _0x4fce18[_0xa93b('0x3d')];}_0x1d524d[_0xa93b('0x30')](_0x5bb89f)['send'](_0x4fce18);};}exports[_0xa93b('0x3e')]=function(_0x224c66,_0x6d0f99){var _0x5c591f={'include':[{'model':db['Pause'],'as':_0xa93b('0x3f')}]},_0x2885ab={},_0x3eaf92={'count':0x0,'rows':[]};var _0x1da0ca=_['map'](db['FaxAccount'][_0xa93b('0x40')],function(_0x61335c){return{'name':_0x61335c[_0xa93b('0x41')],'type':_0x61335c[_0xa93b('0x42')][_0xa93b('0x43')]};});_0x2885ab[_0xa93b('0x44')]=_['map'](_0x1da0ca,'name');_0x2885ab[_0xa93b('0x45')]=_[_0xa93b('0x46')](_0x224c66[_0xa93b('0x45')]);_0x2885ab[_0xa93b('0x47')]=_['intersection'](_0x2885ab[_0xa93b('0x44')],_0x2885ab[_0xa93b('0x45')]);_0x5c591f['attributes']=_[_0xa93b('0x48')](_0x2885ab[_0xa93b('0x44')],qs['fields'](_0x224c66[_0xa93b('0x45')][_0xa93b('0x49')]));_0x5c591f[_0xa93b('0x4a')]=_0x5c591f[_0xa93b('0x4a')]['length']?_0x5c591f['attributes']:_0x2885ab['model'];if(!_0x224c66['query'][_0xa93b('0x4b')](_0xa93b('0x4c'))){_0x5c591f[_0xa93b('0x4d')]=qs['limit'](_0x224c66[_0xa93b('0x45')]['limit']);_0x5c591f[_0xa93b('0x34')]=qs[_0xa93b('0x34')](_0x224c66['query'][_0xa93b('0x34')]);}_0x5c591f[_0xa93b('0x4e')]=qs[_0xa93b('0x4f')](_0x224c66['query'][_0xa93b('0x4f')]);_0x5c591f[_0xa93b('0x50')]=qs[_0xa93b('0x47')](_[_0xa93b('0x51')](_0x224c66[_0xa93b('0x45')],_0x2885ab[_0xa93b('0x47')]),_0x1da0ca);if(_0x224c66['query'][_0xa93b('0x52')]){_0x5c591f['where']=_[_0xa93b('0x53')](_0x5c591f[_0xa93b('0x50')],{'$or':_[_0xa93b('0x54')](_0x1da0ca,function(_0x37ea25){if(_0x37ea25['type']!=='VIRTUAL'){var _0x397c1f={};_0x397c1f[_0x37ea25[_0xa93b('0x3d')]]={'$like':'%'+_0x224c66[_0xa93b('0x45')][_0xa93b('0x52')]+'%'};return _0x397c1f;}})});}_0x5c591f=_[_0xa93b('0x53')]({},_0x5c591f,_0x224c66[_0xa93b('0x55')]);var _0x464389={'where':_0x5c591f[_0xa93b('0x50')]};return db[_0xa93b('0x56')][_0xa93b('0x33')](_0x464389)[_0xa93b('0x24')](function(_0x5375a9){_0x3eaf92[_0xa93b('0x33')]=_0x5375a9;if(_0x224c66[_0xa93b('0x45')][_0xa93b('0x57')]){_0x5c591f[_0xa93b('0x58')]=[{'all':!![]}];}return db['FaxAccount'][_0xa93b('0x59')](_0x5c591f);})[_0xa93b('0x24')](function(_0x1ca34c){_0x3eaf92[_0xa93b('0x5a')]=_0x1ca34c;return _0x3eaf92;})['then'](respondWithFilteredResult(_0x6d0f99,_0x5c591f))['catch'](handleError(_0x6d0f99,null));};exports[_0xa93b('0x5b')]=function(_0x3ae47f,_0x43140b){var _0x46df7a={'raw':![],'where':{'id':_0x3ae47f[_0xa93b('0x5c')]['id']},'include':[{'model':db[_0xa93b('0x5d')],'as':_0xa93b('0x3f')}]},_0x20d647={};_0x20d647[_0xa93b('0x44')]=_[_0xa93b('0x46')](db[_0xa93b('0x56')]['rawAttributes']);_0x20d647[_0xa93b('0x45')]=_[_0xa93b('0x46')](_0x3ae47f[_0xa93b('0x45')]);_0x20d647['filters']=_[_0xa93b('0x48')](_0x20d647[_0xa93b('0x44')],_0x20d647['query']);_0x46df7a[_0xa93b('0x4a')]=_['intersection'](_0x20d647[_0xa93b('0x44')],qs[_0xa93b('0x49')](_0x3ae47f[_0xa93b('0x45')][_0xa93b('0x49')]));_0x46df7a[_0xa93b('0x4a')]=_0x46df7a[_0xa93b('0x4a')]['length']?_0x46df7a[_0xa93b('0x4a')]:_0x20d647[_0xa93b('0x44')];if(_0x3ae47f['query'][_0xa93b('0x57')]){_0x46df7a[_0xa93b('0x58')]=[{'all':!![]}];}_0x46df7a=_[_0xa93b('0x53')]({},_0x46df7a,_0x3ae47f[_0xa93b('0x55')]);return db[_0xa93b('0x56')]['find'](_0x46df7a)[_0xa93b('0x24')](handleEntityNotFound(_0x43140b,null))[_0xa93b('0x24')](respondWithResult(_0x43140b,null))[_0xa93b('0x2e')](handleError(_0x43140b,null));};exports[_0xa93b('0x5e')]=function(_0x4da32d,_0x4a5f22){return db['FaxAccount']['create'](_0x4da32d[_0xa93b('0x5f')],{})[_0xa93b('0x24')](function(_0x1d15c6){var _0x55fad3=_0x4da32d[_0xa93b('0x60')]['get']({'plain':!![]});if(!_0x55fad3)throw new Error(_0xa93b('0x61'));if(_0x55fad3[_0xa93b('0x62')]===_0xa93b('0x60')){var _0xe75781=_0x1d15c6[_0xa93b('0x3a')]({'plain':!![]});var _0xaeddd8=_0xa93b('0x63');return db[_0xa93b('0x64')][_0xa93b('0x65')]({'where':{'name':_0xaeddd8,'userProfileId':_0x55fad3[_0xa93b('0x66')]},'raw':!![]})[_0xa93b('0x24')](function(_0x3dfbd7){if(_0x3dfbd7&&_0x3dfbd7[_0xa93b('0x67')]===0x0){return db[_0xa93b('0x3b')][_0xa93b('0x5e')]({'name':_0xe75781[_0xa93b('0x3d')],'resourceId':_0xe75781['id'],'type':_0x3dfbd7[_0xa93b('0x3d')],'sectionId':_0x3dfbd7['id']},{})[_0xa93b('0x24')](function(){return _0x1d15c6;});}else{return _0x1d15c6;}})[_0xa93b('0x2e')](function(_0x3ed655){logger[_0xa93b('0x2b')](_0xa93b('0x68'),_0x3ed655);throw _0x3ed655;});}return _0x1d15c6;})[_0xa93b('0x24')](respondWithResult(_0x4a5f22,0xc9))[_0xa93b('0x2e')](handleError(_0x4a5f22,null));};exports[_0xa93b('0x39')]=function(_0x58a236,_0x5e2acd){if(_0x58a236[_0xa93b('0x5f')]['id']){delete _0x58a236[_0xa93b('0x5f')]['id'];}return db['FaxAccount'][_0xa93b('0x65')]({'where':{'id':_0x58a236[_0xa93b('0x5c')]['id']},'include':[{'model':db[_0xa93b('0x5d')],'as':_0xa93b('0x3f')}]})[_0xa93b('0x24')](handleEntityNotFound(_0x5e2acd,null))['then'](saveUpdates(_0x58a236[_0xa93b('0x5f')],null))[_0xa93b('0x24')](respondWithResult(_0x5e2acd,null))[_0xa93b('0x2e')](handleError(_0x5e2acd,null));};exports[_0xa93b('0x3c')]=function(_0x53edde,_0x416619){return db[_0xa93b('0x56')][_0xa93b('0x65')]({'where':{'id':_0x53edde[_0xa93b('0x5c')]['id']}})[_0xa93b('0x24')](handleEntityNotFound(_0x416619,null))[_0xa93b('0x24')](removeEntity(_0x416619,null))[_0xa93b('0x2e')](handleError(_0x416619,null));};exports[_0xa93b('0x69')]=function(_0x151127,_0x4c6dcd){return db['FaxAccount'][_0xa93b('0x69')]()['then'](respondWithResult(_0x4c6dcd,null))['catch'](handleError(_0x4c6dcd,null));};exports[_0xa93b('0x6a')]=function(_0xd01f46,_0x13cf76,_0x2f30be){if(_0xd01f46[_0xa93b('0x5f')]['id']){delete _0xd01f46['body']['id'];}return db[_0xa93b('0x56')][_0xa93b('0x65')]({'where':{'id':_0xd01f46[_0xa93b('0x5c')]['id']}})[_0xa93b('0x24')](handleEntityNotFound(_0x13cf76,null))[_0xa93b('0x24')](function(_0xd5863b){if(_0xd5863b){_0xd01f46[_0xa93b('0x5f')]['FaxAccountId']=_0xd5863b['id'];return db[_0xa93b('0x6b')]['create'](_0xd01f46[_0xa93b('0x5f')]);}})['then'](respondWithResult(_0x13cf76,null))[_0xa93b('0x2e')](handleError(_0x13cf76,null));};exports[_0xa93b('0x6c')]=function(_0x437d3e,_0x2b3201,_0x27b7e4){var _0x2304b2={'raw':![],'where':{}};var _0xcf7658={};var _0x4e0d53={'count':0x0,'rows':[]};return db[_0xa93b('0x56')][_0xa93b('0x6d')]({'where':{'id':_0x437d3e[_0xa93b('0x5c')]['id']}})[_0xa93b('0x24')](handleEntityNotFound(_0x2b3201,null))['then'](function(_0x1c822e){if(_0x1c822e){_0xcf7658[_0xa93b('0x44')]=_['keys'](db[_0xa93b('0x6b')][_0xa93b('0x40')]);_0xcf7658['query']=_[_0xa93b('0x46')](_0x437d3e[_0xa93b('0x45')]);_0xcf7658[_0xa93b('0x47')]=_[_0xa93b('0x48')](_0xcf7658[_0xa93b('0x44')],_0xcf7658[_0xa93b('0x45')]);_0x2304b2[_0xa93b('0x4a')]=_[_0xa93b('0x48')](_0xcf7658['model'],qs[_0xa93b('0x49')](_0x437d3e[_0xa93b('0x45')][_0xa93b('0x49')]));_0x2304b2[_0xa93b('0x4a')]=_0x2304b2['attributes']['length']?_0x2304b2[_0xa93b('0x4a')]:_0xcf7658['model'];if(!_0x437d3e[_0xa93b('0x45')]['hasOwnProperty'](_0xa93b('0x4c'))){_0x2304b2[_0xa93b('0x4d')]=qs[_0xa93b('0x4d')](_0x437d3e[_0xa93b('0x45')][_0xa93b('0x4d')]);_0x2304b2['offset']=qs[_0xa93b('0x34')](_0x437d3e[_0xa93b('0x45')][_0xa93b('0x34')]);}_0x2304b2[_0xa93b('0x4e')]=qs[_0xa93b('0x4f')](_0x437d3e[_0xa93b('0x45')][_0xa93b('0x4f')]);_0x2304b2[_0xa93b('0x50')]=qs[_0xa93b('0x47')](_[_0xa93b('0x51')](_0x437d3e[_0xa93b('0x45')],_0xcf7658['filters']));_0x2304b2['where'][_0xa93b('0x6e')]=_0x1c822e['id'];if(_0x437d3e[_0xa93b('0x45')][_0xa93b('0x52')]){_0x2304b2[_0xa93b('0x50')]=_[_0xa93b('0x53')](_0x2304b2[_0xa93b('0x50')],{'$or':_['map'](_0x2304b2['attributes'],function(_0x1c9a17){var _0x500dc2={};_0x500dc2[_0x1c9a17]={'$like':'%'+_0x437d3e[_0xa93b('0x45')][_0xa93b('0x52')]+'%'};return _0x500dc2;})});}_0x2304b2=_[_0xa93b('0x53')]({},_0x2304b2,_0x437d3e['options']);return db[_0xa93b('0x6b')][_0xa93b('0x33')]({'where':_0x2304b2[_0xa93b('0x50')]})['then'](function(_0x2dbca7){_0x4e0d53[_0xa93b('0x33')]=_0x2dbca7;if(_0x437d3e[_0xa93b('0x45')][_0xa93b('0x57')]){_0x2304b2[_0xa93b('0x58')]=[{'all':!![]}];}return db[_0xa93b('0x6b')][_0xa93b('0x59')](_0x2304b2);})['then'](function(_0xa320d5){_0x4e0d53[_0xa93b('0x5a')]=_0xa320d5;return _0x4e0d53;});}})['then'](respondWithFilteredResult(_0x2b3201,_0x2304b2))[_0xa93b('0x2e')](handleError(_0x2b3201,null));};exports[_0xa93b('0x6f')]=function(_0x4527f1,_0xadbfa5,_0x4ce786){return db['FaxAccount'][_0xa93b('0x65')]({'where':{'id':_0x4527f1[_0xa93b('0x5c')]['id']}})[_0xa93b('0x24')](handleEntityNotFound(_0xadbfa5,null))[_0xa93b('0x24')](function(_0x46adea){if(_0x46adea){return _0x46adea[_0xa93b('0x6f')](_0x4527f1[_0xa93b('0x45')]['ids']);}})[_0xa93b('0x24')](respondWithStatusCode(_0xadbfa5,null))[_0xa93b('0x2e')](handleError(_0xadbfa5,null));};exports['addAnswer']=function(_0x17d2ad,_0x45f7ae,_0x11509f){if(_0x17d2ad['body']['id']){delete _0x17d2ad['body']['id'];}return db[_0xa93b('0x56')][_0xa93b('0x65')]({'where':{'id':_0x17d2ad[_0xa93b('0x5c')]['id']}})[_0xa93b('0x24')](handleEntityNotFound(_0x45f7ae,null))[_0xa93b('0x24')](function(_0x5b3538){if(_0x5b3538){_0x17d2ad[_0xa93b('0x5f')]['FaxAccountId']=_0x5b3538['id'];return db['CannedAnswer']['create'](_0x17d2ad['body']);}})[_0xa93b('0x24')](respondWithResult(_0x45f7ae,null))[_0xa93b('0x2e')](handleError(_0x45f7ae,null));};exports['getAnswers']=function(_0x2002b2,_0x145b7f,_0x34971c){var _0x2aca81={'raw':![],'where':{}};var _0x26a129={};var _0x7974c8={'count':0x0,'rows':[]};return db[_0xa93b('0x56')]['findOne']({'where':{'id':_0x2002b2['params']['id']}})['then'](handleEntityNotFound(_0x145b7f,null))[_0xa93b('0x24')](function(_0x5005fa){if(_0x5005fa){_0x26a129['model']=_[_0xa93b('0x46')](db[_0xa93b('0x70')][_0xa93b('0x40')]);_0x26a129['query']=_[_0xa93b('0x46')](_0x2002b2[_0xa93b('0x45')]);_0x26a129[_0xa93b('0x47')]=_[_0xa93b('0x48')](_0x26a129[_0xa93b('0x44')],_0x26a129['query']);_0x2aca81[_0xa93b('0x4a')]=_[_0xa93b('0x48')](_0x26a129[_0xa93b('0x44')],qs[_0xa93b('0x49')](_0x2002b2[_0xa93b('0x45')][_0xa93b('0x49')]));_0x2aca81[_0xa93b('0x4a')]=_0x2aca81[_0xa93b('0x4a')][_0xa93b('0x71')]?_0x2aca81['attributes']:_0x26a129[_0xa93b('0x44')];if(!_0x2002b2[_0xa93b('0x45')][_0xa93b('0x4b')](_0xa93b('0x4c'))){_0x2aca81[_0xa93b('0x4d')]=qs[_0xa93b('0x4d')](_0x2002b2[_0xa93b('0x45')][_0xa93b('0x4d')]);_0x2aca81['offset']=qs[_0xa93b('0x34')](_0x2002b2[_0xa93b('0x45')][_0xa93b('0x34')]);}_0x2aca81[_0xa93b('0x4e')]=qs[_0xa93b('0x4f')](_0x2002b2['query'][_0xa93b('0x4f')]);_0x2aca81[_0xa93b('0x50')]=qs[_0xa93b('0x47')](_['pick'](_0x2002b2[_0xa93b('0x45')],_0x26a129['filters']));_0x2aca81[_0xa93b('0x50')][_0xa93b('0x6e')]=_0x5005fa['id'];if(_0x2002b2['query'][_0xa93b('0x52')]){_0x2aca81[_0xa93b('0x50')]=_[_0xa93b('0x53')](_0x2aca81['where'],{'$or':_[_0xa93b('0x54')](_0x2aca81['attributes'],function(_0x3e1db6){var _0x10a134={};_0x10a134[_0x3e1db6]={'$like':'%'+_0x2002b2[_0xa93b('0x45')]['filter']+'%'};return _0x10a134;})});}_0x2aca81=_[_0xa93b('0x53')]({},_0x2aca81,_0x2002b2[_0xa93b('0x55')]);return db[_0xa93b('0x70')]['count']({'where':_0x2aca81[_0xa93b('0x50')]})['then'](function(_0x49e8fa){_0x7974c8['count']=_0x49e8fa;if(_0x2002b2[_0xa93b('0x45')]['includeAll']){_0x2aca81['include']=[{'all':!![]}];}return db[_0xa93b('0x70')][_0xa93b('0x59')](_0x2aca81);})[_0xa93b('0x24')](function(_0x57549b){_0x7974c8[_0xa93b('0x5a')]=_0x57549b;return _0x7974c8;});}})['then'](respondWithFilteredResult(_0x145b7f,_0x2aca81))['catch'](handleError(_0x145b7f,null));};exports[_0xa93b('0x72')]=function(_0x53dd8e,_0x3993d7,_0x211c4f){return db['FaxAccount'][_0xa93b('0x65')]({'where':{'id':_0x53dd8e[_0xa93b('0x5c')]['id']}})[_0xa93b('0x24')](handleEntityNotFound(_0x3993d7,null))[_0xa93b('0x24')](function(_0x122e4e){if(_0x122e4e){return _0x122e4e[_0xa93b('0x72')](_0x53dd8e[_0xa93b('0x45')][_0xa93b('0x73')]);}})['then'](respondWithStatusCode(_0x3993d7,null))['catch'](handleError(_0x3993d7,null));};exports[_0xa93b('0x74')]=function(_0x37f5f8,_0x1676f1,_0x19c559){return db[_0xa93b('0x75')][_0xa93b('0x65')]({'where':{'id':_0x37f5f8[_0xa93b('0x5c')]['id']}})['then'](handleEntityNotFound(_0x1676f1,null))[_0xa93b('0x24')](function(_0x16d8c0){if(_0x16d8c0){return _0x16d8c0[_0xa93b('0x74')](_0x37f5f8[_0xa93b('0x5f')]['ids'],_[_0xa93b('0x76')](_0x37f5f8['body'],[_0xa93b('0x73'),'id'])||{});}})[_0xa93b('0x24')](respondWithResult(_0x1676f1,null))[_0xa93b('0x2e')](handleError(_0x1676f1,null));};exports[_0xa93b('0x77')]=function(_0x1db861,_0x8a2afa,_0x2f16e6){var _0x4ee8ee={'raw':![],'where':{}};var _0x37998b={};var _0x364ac2={'count':0x0,'rows':[]};return db['FaxAccount'][_0xa93b('0x6d')]({'where':{'id':_0x1db861[_0xa93b('0x5c')]['id']}})[_0xa93b('0x24')](handleEntityNotFound(_0x8a2afa,null))['then'](function(_0x35c511){if(_0x35c511){_0x37998b['model']=_['keys'](db[_0xa93b('0x75')][_0xa93b('0x40')]);_0x37998b[_0xa93b('0x45')]=_[_0xa93b('0x46')](_0x1db861[_0xa93b('0x45')]);_0x37998b[_0xa93b('0x47')]=_[_0xa93b('0x48')](_0x37998b[_0xa93b('0x44')],_0x37998b[_0xa93b('0x45')]);_0x4ee8ee[_0xa93b('0x4a')]=_['intersection'](_0x37998b[_0xa93b('0x44')],qs[_0xa93b('0x49')](_0x1db861[_0xa93b('0x45')]['fields']));_0x4ee8ee[_0xa93b('0x4a')]=_0x4ee8ee[_0xa93b('0x4a')][_0xa93b('0x71')]?_0x4ee8ee[_0xa93b('0x4a')]:_0x37998b[_0xa93b('0x44')];if(!_0x1db861[_0xa93b('0x45')][_0xa93b('0x4b')](_0xa93b('0x4c'))){_0x4ee8ee['limit']=qs[_0xa93b('0x4d')](_0x1db861[_0xa93b('0x45')][_0xa93b('0x4d')]);_0x4ee8ee[_0xa93b('0x34')]=qs[_0xa93b('0x34')](_0x1db861[_0xa93b('0x45')]['offset']);}_0x4ee8ee[_0xa93b('0x4e')]=qs[_0xa93b('0x4f')](_0x1db861['query']['sort']);_0x4ee8ee[_0xa93b('0x50')]=qs[_0xa93b('0x47')](_[_0xa93b('0x51')](_0x1db861[_0xa93b('0x45')],_0x37998b['filters']));_0x4ee8ee[_0xa93b('0x50')][_0xa93b('0x6e')]=_0x35c511['id'];if(_0x1db861[_0xa93b('0x45')]['filter']){_0x4ee8ee[_0xa93b('0x50')]=_[_0xa93b('0x53')](_0x4ee8ee[_0xa93b('0x50')],{'$or':_[_0xa93b('0x54')](_0x4ee8ee[_0xa93b('0x4a')],function(_0x3433b6){var _0x214710={};_0x214710[_0x3433b6]={'$like':'%'+_0x1db861[_0xa93b('0x45')][_0xa93b('0x52')]+'%'};return _0x214710;})});}_0x4ee8ee=_[_0xa93b('0x53')]({},_0x4ee8ee,_0x1db861['options']);return db['FaxInteraction'][_0xa93b('0x33')]({'where':_0x4ee8ee[_0xa93b('0x50')]})['then'](function(_0x5ccb40){_0x364ac2[_0xa93b('0x33')]=_0x5ccb40;if(_0x1db861[_0xa93b('0x45')][_0xa93b('0x57')]){_0x4ee8ee[_0xa93b('0x58')]=[{'model':db[_0xa93b('0x78')],'as':_0xa93b('0x79'),'required':![]},{'model':db[_0xa93b('0x7a')],'as':'Owner','attributes':['name','fullname',_0xa93b('0x7b')],'required':![]},{'model':db['Tag'],'as':_0xa93b('0x7c'),'attributes':['id',_0xa93b('0x3d'),_0xa93b('0x7d')],'where':_0x1db861[_0xa93b('0x45')][_0xa93b('0x7e')]?{'id':_0x1db861[_0xa93b('0x45')][_0xa93b('0x7e')]}:undefined,'required':_0x1db861[_0xa93b('0x45')][_0xa93b('0x7e')]?!![]:![]}];}return db[_0xa93b('0x75')][_0xa93b('0x59')](_0x4ee8ee);})[_0xa93b('0x24')](function(_0x36b6aa){_0x364ac2[_0xa93b('0x5a')]=_0x36b6aa;return _0x364ac2;});}})[_0xa93b('0x24')](respondWithFilteredResult(_0x8a2afa,_0x4ee8ee))[_0xa93b('0x2e')](handleError(_0x8a2afa,null));};exports[_0xa93b('0x7f')]=function(_0x30a38e,_0x1d599d,_0x1fa5c5){return db[_0xa93b('0x56')][_0xa93b('0x6d')]({'where':{'id':_0x30a38e[_0xa93b('0x5c')]['id']}})['then'](handleEntityNotFound(_0x1d599d,null))[_0xa93b('0x24')](function(_0xd31190){if(_0xd31190){return db['sequelize'][_0xa93b('0x80')](function(_0x1c5c25){return db['FaxApplication'][_0xa93b('0x3c')]({'where':{'FaxAccountId':_0x30a38e[_0xa93b('0x5c')]['id']},'transaction':_0x1c5c25})[_0xa93b('0x24')](function(_0x63ddcf){var _0xf65122=_[_0xa93b('0x54')](_0x30a38e[_0xa93b('0x5f')],function(_0x3959ef){_0x3959ef['FaxAccountId']=_0x30a38e[_0xa93b('0x5c')]['id'];return _0x3959ef;});return db[_0xa93b('0x81')][_0xa93b('0x82')](_0xf65122,{'transaction':_0x1c5c25});});})[_0xa93b('0x24')](function(){return db[_0xa93b('0x81')][_0xa93b('0x83')]({'where':{'FaxAccountId':_0x30a38e[_0xa93b('0x5c')]['id']},'order':_0xa93b('0x84')});});}})[_0xa93b('0x24')](respondWithResult(_0x1d599d,null))['catch'](handleError(_0x1d599d,null));};exports[_0xa93b('0x85')]=function(_0x49d154,_0x582afe,_0x43a990){var _0xbc5d17={};var _0xc8eaf7={};var _0x4fc3cb;var _0x1690d7;return db['FaxAccount']['findOne']({'where':{'id':_0x49d154[_0xa93b('0x5c')]['id']}})[_0xa93b('0x24')](handleEntityNotFound(_0x582afe,null))['then'](function(_0x366fe1){if(_0x366fe1){_0x4fc3cb=_0x366fe1;_0xc8eaf7[_0xa93b('0x44')]=_['keys'](db[_0xa93b('0x81')][_0xa93b('0x40')]);_0xc8eaf7[_0xa93b('0x45')]=_[_0xa93b('0x46')](_0x49d154[_0xa93b('0x45')]);_0xc8eaf7['filters']=_[_0xa93b('0x48')](_0xc8eaf7[_0xa93b('0x44')],_0xc8eaf7[_0xa93b('0x45')]);_0xbc5d17[_0xa93b('0x4a')]=_[_0xa93b('0x48')](_0xc8eaf7['model'],qs['fields'](_0x49d154[_0xa93b('0x45')]['fields']));_0xbc5d17[_0xa93b('0x4a')]=_0xbc5d17[_0xa93b('0x4a')][_0xa93b('0x71')]?_0xbc5d17[_0xa93b('0x4a')]:_0xc8eaf7[_0xa93b('0x44')];_0xbc5d17[_0xa93b('0x4e')]=qs[_0xa93b('0x4f')](_0x49d154['query'][_0xa93b('0x4f')]);_0xbc5d17[_0xa93b('0x50')]=qs[_0xa93b('0x47')](_[_0xa93b('0x51')](_0x49d154[_0xa93b('0x45')],_0xc8eaf7[_0xa93b('0x47')]));if(_0x49d154[_0xa93b('0x45')][_0xa93b('0x52')]){_0xbc5d17[_0xa93b('0x50')]=_[_0xa93b('0x53')](_0xbc5d17[_0xa93b('0x50')],{'$or':_[_0xa93b('0x54')](_0xbc5d17['attributes'],function(_0x2637ce){var _0x5d392f={};_0x5d392f[_0x2637ce]={'$like':'%'+_0x49d154[_0xa93b('0x45')]['filter']+'%'};return _0x5d392f;})});}_0xbc5d17=_[_0xa93b('0x53')]({},_0xbc5d17,_0x49d154[_0xa93b('0x55')]);return _0x4fc3cb[_0xa93b('0x85')](_0xbc5d17);}})[_0xa93b('0x24')](function(_0x4bfa65){if(_0x4bfa65){_0x1690d7=_0x4bfa65[_0xa93b('0x71')];if(!_0x49d154['query'][_0xa93b('0x4b')](_0xa93b('0x4c'))){_0xbc5d17['limit']=qs[_0xa93b('0x4d')](_0x49d154[_0xa93b('0x45')]['limit']);_0xbc5d17[_0xa93b('0x34')]=qs['offset'](_0x49d154['query'][_0xa93b('0x34')]);}return _0x4fc3cb[_0xa93b('0x85')](_0xbc5d17);}})['then'](function(_0x3f3948){if(_0x3f3948){return _0x3f3948?{'count':_0x1690d7,'rows':_0x3f3948}:null;}})[_0xa93b('0x24')](respondWithResult(_0x582afe,null))[_0xa93b('0x2e')](handleError(_0x582afe,null));};function Extension(_0x3adfad,_0x7bee8f,_0x4a4d43,_0x32bca4){this['context']=_0xa93b('0x86');this[_0xa93b('0x87')]=_0x3adfad[_0xa93b('0x88')];this['app']=_0x32bca4;this[_0xa93b('0x42')]=_0xa93b('0x89');this[_0xa93b('0x8a')]=_0xa93b('0x8b');this['FaxAccountId']=_0x3adfad['id'];this[_0xa93b('0x84')]=_0x7bee8f;this[_0xa93b('0x8c')]=_0x4a4d43;}function createExtensionsReciveFax(_0xa2e696){var _0x5d092d=0x1;var _0x296a75=[];_0x296a75['push'](new Extension(_0xa2e696,_0x5d092d,'','Answer'));_0x5d092d+=0x1;_0x296a75[_0xa93b('0x8d')](new Extension(_0xa2e696,_0x5d092d,'CDR(type)=inbound-fax',_0xa93b('0x8e')));_0x5d092d+=0x1;for(var _0xb6f1e2 in _0xa2e696){if(_0xa2e696[_0xa93b('0x4b')](_0xb6f1e2)&&(_0xb6f1e2===_0xa93b('0x8f')||_0xb6f1e2===_0xa93b('0x88')||_0xb6f1e2===_0xa93b('0x90')||_0xb6f1e2===_0xa93b('0x91')||_0xb6f1e2===_0xa93b('0x92')||_0xb6f1e2===_0xa93b('0x93')||_0xb6f1e2===_0xa93b('0x94')||_0xb6f1e2===_0xa93b('0x95')||_0xb6f1e2===_0xa93b('0x96'))){_0x296a75[_0xa93b('0x8d')](new Extension(_0xa2e696,_0x5d092d,_0xa93b('0x97')+_0xb6f1e2+')='+_0xa2e696[_0xb6f1e2],_0xa93b('0x8e')));_0x5d092d+=0x1;}}_0x296a75[_0xa93b('0x8d')](new Extension(_0xa2e696,_0x5d092d,'6','Wait'));_0x5d092d+=0x1;_0x296a75[_0xa93b('0x8d')](new Extension(_0xa2e696,_0x5d092d,_0xa93b('0x98'),_0xa93b('0x99')));_0x5d092d=0x0;return _0x296a75;}exports['addAccountApplications']=function(_0x2a8447,_0x3134eb,_0x186545){var _0x2cc0bc;return db['sequelize'][_0xa93b('0x80')](function(_0x18ea13){return db[_0xa93b('0x56')][_0xa93b('0x5e')](_0x2a8447['body'],{'transaction':_0x18ea13})[_0xa93b('0x24')](function(_0x6c12fe){_0x2cc0bc=_0x6c12fe[_0xa93b('0x3a')]({'plain':!![]});return db[_0xa93b('0x9a')]['bulkCreate'](createExtensionsReciveFax(_0x2cc0bc),{'transaction':_0x18ea13});});})[_0xa93b('0x24')](function(){return _0x2cc0bc;})[_0xa93b('0x24')](respondWithResult(_0x3134eb,null))[_0xa93b('0x2e')](handleError(_0x3134eb,null));};exports[_0xa93b('0x9b')]=function(_0x23ad23,_0x404180,_0x2c9336){var _0x2a300b;return db[_0xa93b('0x9c')][_0xa93b('0x80')](function(_0x2a87a3){return db[_0xa93b('0x56')][_0xa93b('0x39')](_0x23ad23[_0xa93b('0x5f')],{'where':{'id':_0x23ad23['body']['id']},'transaction':_0x2a87a3})['then'](function(_0x1dfce7){return db['VoiceExtension']['destroy']({'where':{'FaxAccountId':_0x23ad23['body']['id']},'transaction':_0x2a87a3})[_0xa93b('0x24')](function(_0x6ced0b){return db['VoiceExtension'][_0xa93b('0x82')](createExtensionsReciveFax(_['omit'](_0x23ad23['body'],[_0xa93b('0x9d'),_0xa93b('0x43'),'createdAt','updatedAt',_0xa93b('0x9e'),_0xa93b('0x9f')])),{'transaction':_0x2a87a3});});});})['then'](function(){return db[_0xa93b('0x56')][_0xa93b('0xa0')](_0x23ad23[_0xa93b('0x5f')]['id']);})[_0xa93b('0x24')](respondWithResult(_0x404180,null))[_0xa93b('0x2e')](handleError(_0x404180,null));};exports[_0xa93b('0xa1')]=function(_0x3f0773,_0xe92276,_0x5d58f9){var _0x3fa44e={'raw':!![],'where':{}};var _0x45768c={};var _0x436ef8={'count':0x0,'rows':[]};return db[_0xa93b('0x56')][_0xa93b('0x6d')]({'where':{'id':_0x3f0773[_0xa93b('0x5c')]['id']}})[_0xa93b('0x24')](handleEntityNotFound(_0xe92276,null))[_0xa93b('0x24')](function(_0x52fb1c){if(_0x52fb1c){_0x45768c['model']=_['keys'](db[_0xa93b('0xa2')][_0xa93b('0x40')]);_0x45768c['query']=_[_0xa93b('0x46')](_0x3f0773[_0xa93b('0x45')]);_0x45768c['filters']=_[_0xa93b('0x48')](_0x45768c[_0xa93b('0x44')],_0x45768c[_0xa93b('0x45')]);_0x3fa44e['attributes']=_[_0xa93b('0x48')](_0x45768c[_0xa93b('0x44')],qs[_0xa93b('0x49')](_0x3f0773[_0xa93b('0x45')][_0xa93b('0x49')]));_0x3fa44e[_0xa93b('0x4a')]=_0x3fa44e[_0xa93b('0x4a')][_0xa93b('0x71')]?_0x3fa44e[_0xa93b('0x4a')]:_0x45768c[_0xa93b('0x44')];if(!_0x3f0773[_0xa93b('0x45')][_0xa93b('0x4b')]('nolimit')){_0x3fa44e[_0xa93b('0x4d')]=qs['limit'](_0x3f0773[_0xa93b('0x45')][_0xa93b('0x4d')]);_0x3fa44e['offset']=qs[_0xa93b('0x34')](_0x3f0773[_0xa93b('0x45')]['offset']);}_0x3fa44e[_0xa93b('0x4e')]=qs[_0xa93b('0x4f')](_0x3f0773[_0xa93b('0x45')][_0xa93b('0x4f')]);_0x3fa44e[_0xa93b('0x50')]=qs[_0xa93b('0x47')](_[_0xa93b('0x51')](_0x3f0773['query'],_0x45768c[_0xa93b('0x47')]));_0x3fa44e[_0xa93b('0x50')][_0xa93b('0x6e')]=_0x52fb1c['id'];if(_0x3f0773[_0xa93b('0x45')][_0xa93b('0x52')]){_0x3fa44e[_0xa93b('0x50')]=_[_0xa93b('0x53')](_0x3fa44e[_0xa93b('0x50')],{'$or':_[_0xa93b('0x54')](_0x3fa44e[_0xa93b('0x4a')],function(_0xb4b83c){var _0x197b5b={};_0x197b5b[_0xb4b83c]={'$like':'%'+_0x3f0773[_0xa93b('0x45')][_0xa93b('0x52')]+'%'};return _0x197b5b;})});}if(_0x3f0773[_0xa93b('0x45')][_0xa93b('0xa3')]){var _0x1a1ccf=_0x3f0773[_0xa93b('0x45')][_0xa93b('0xa3')][_0xa93b('0xa4')](',');var _0x4114b3={};_0x4114b3[_0x1a1ccf[0x0]]={'$gte':moment(_0x1a1ccf[0x1])[_0xa93b('0xa5')](_0xa93b('0xa6'))};_0x3fa44e[_0xa93b('0x50')]=_['merge'](_0x3fa44e[_0xa93b('0x50')],_0x4114b3);}_0x3fa44e=_[_0xa93b('0x53')]({},_0x3fa44e,_0x3f0773[_0xa93b('0x55')]);return db[_0xa93b('0xa2')][_0xa93b('0x33')]({'where':_0x3fa44e[_0xa93b('0x50')]})['then'](function(_0x7ccc8e){_0x436ef8['count']=_0x7ccc8e;if(_0x3f0773[_0xa93b('0x45')][_0xa93b('0x57')]){_0x3fa44e[_0xa93b('0x58')]=[{'all':!![]}];}return db[_0xa93b('0xa2')][_0xa93b('0x59')](_0x3fa44e);})[_0xa93b('0x24')](function(_0x3bde2e){_0x436ef8[_0xa93b('0x5a')]=_0x3bde2e;return _0x436ef8;});}})[_0xa93b('0x24')](respondWithFilteredResult(_0xe92276,_0x3fa44e))['catch'](handleError(_0xe92276,null));};exports[_0xa93b('0xa7')]=function(_0x5c941a,_0x48813c,_0x400d85){var _0x1b6d36,_0x10057f={},_0x1bc63f;if(_0x5c941a[_0xa93b('0x5f')]['to']){_0x1bc63f=_0x5c941a[_0xa93b('0x5f')]['to'][0x0];}return db['FaxAccount'][_0xa93b('0x65')]({'where':{'id':_0x5c941a[_0xa93b('0x5c')]['id']},'include':[{'model':db['CmList'],'as':_0xa93b('0xa8'),'include':[{'model':db[_0xa93b('0x78')],'as':_0xa93b('0xa9'),'where':{'fax':_0x1bc63f},'limit':0x1,'order':[[_0xa93b('0xaa'),'DESC']]}]}]})[_0xa93b('0x24')](handleEntityNotFound(_0x48813c,null))[_0xa93b('0x24')](function(_0x3bc508){_0x1b6d36=_0x3bc508;if(_0x5c941a[_0xa93b('0x5f')][_0xa93b('0xab')]&&_0x5c941a[_0xa93b('0x5f')][_0xa93b('0xab')]['length']){for(var _0x15ae22=0x0;_0x15ae22<_0x5c941a[_0xa93b('0x5f')]['attachments'][_0xa93b('0x71')];_0x15ae22+=0x1){_0x5c941a[_0xa93b('0x5f')][_0xa93b('0xab')][_0x15ae22]={'filename':_0x5c941a[_0xa93b('0x5f')][_0xa93b('0xab')][_0x15ae22][_0xa93b('0x3d')],'id':_0x5c941a[_0xa93b('0x5f')]['attachments'][_0x15ae22]['id'],'path':path[_0xa93b('0xac')](config['root'],_0xa93b('0xad'),_0x5c941a['body'][_0xa93b('0xab')][_0x15ae22][_0xa93b('0xae')])};}}return respondWithRpcPromise(_0xa93b('0xaf'),_0xa93b('0xaf'),{'FaxAccountId':_[_0xa93b('0xb0')](_0x5c941a['params']['id'])?undefined:_0x5c941a[_0xa93b('0x5c')]['id'],'path':_[_0xa93b('0xb0')](_0x5c941a[_0xa93b('0x5f')][_0xa93b('0xab')][0x0]['path'])?undefined:_0x5c941a[_0xa93b('0x5f')][_0xa93b('0xab')][0x0][_0xa93b('0x8')],'fax':_[_0xa93b('0xb0')](_0x5c941a[_0xa93b('0x5f')]['to'][0x0])?undefined:_0x5c941a[_0xa93b('0x5f')]['to'][0x0]},client9002);})['then'](function(){if(_0x1b6d36){if(_['isNil'](_0x5c941a['body'][_0xa93b('0xb1')])){_0x5c941a['body'][_0xa93b('0xb1')]=util[_0xa93b('0xa5')](_0xa93b('0xb2'),_0x1b6d36[_0xa93b('0x3d')],_0x1b6d36[_0xa93b('0xb3')]);}if(_0x1b6d36[_0xa93b('0xa8')]){if(_0x1b6d36[_0xa93b('0xa8')][_0xa93b('0xa9')]['length']){return _0x1b6d36[_0xa93b('0xa8')][_0xa93b('0xa9')][0x0];}else{return db[_0xa93b('0x78')][_0xa93b('0x5e')](_[_0xa93b('0x18')](_0x5c941a[_0xa93b('0x5f')],{'firstName':_0x5c941a[_0xa93b('0x5f')]['to'][0x0],'phone':_0x5c941a['body']['to'][0x0],'fax':_0x5c941a['body']['to'][0x0],'ListId':_0x1b6d36[_0xa93b('0x9f')]}));}}else{throw new Error(_0xa93b('0xb4'));}}else{throw new Error(_0xa93b('0xb5'));}})[_0xa93b('0x24')](function(_0x587bf1){if(_0x587bf1){return db[_0xa93b('0x75')][_0xa93b('0x65')]({'where':{'ContactId':_0x587bf1['id'],'closed':![],'FaxAccountId':_0x1b6d36['id']}})['then'](function(_0x13b399){if(_0x13b399){return[_0x13b399,![]];}return db['FaxInteraction']['create']({'UserId':_0x5c941a[_0xa93b('0x60')]['id'],'ContactId':_0x587bf1['id'],'FaxAccountId':_0x1b6d36['id'],'fax':_0x5c941a['body']['to'][0x0],'firstMsgDirection':_0xa93b('0xb6'),'Messages':[_['merge'](_0x5c941a[_0xa93b('0x5f')],{'read':![],'body':_0x5c941a['body'][_0xa93b('0xab')][0x0]['filename'],'FaxAccountId':_0x1b6d36['id'],'UserId':_0x5c941a[_0xa93b('0x60')]['id'],'ContactId':_0x587bf1['id'],'AttachmentId':_0x5c941a['body'][_0xa93b('0xab')][0x0]['id']})]},{'include':[{'model':db[_0xa93b('0xa2')],'as':_0xa93b('0xb7')}]})['then'](function(_0x2afa17){return[_0x2afa17,!![]];});});}else{throw new Error(_0xa93b('0xb8'));}})[_0xa93b('0xb9')](function(_0x29e317,_0x4c622d){if(_0x4c622d){return _0x29e317;}return db['FaxMessage'][_0xa93b('0x5e')]({'direction':_0xa93b('0xb6'),'read':![],'body':_0x5c941a[_0xa93b('0x5f')][_0xa93b('0xab')][0x0]['filename'],'FaxAccountId':_0x1b6d36['id'],'FaxInteractionId':_0x29e317['id'],'UserId':_0x5c941a[_0xa93b('0x60')]['id'],'ContactId':_0x29e317[_0xa93b('0xba')],'AttachmentId':_0x5c941a[_0xa93b('0x5f')]['attachments'][0x0]['id']})[_0xa93b('0x24')](function(_0x27e24c){_0x29e317[_0xa93b('0xbb')][_0xa93b('0xb7')]=[];_0x29e317[_0xa93b('0xbb')]['Messages'][_0xa93b('0x8d')](_0x27e24c[_0xa93b('0xbb')]);return _0x29e317;});})[_0xa93b('0x24')](function(_0x8bc9be){respondWithRpcPromise(_0xa93b('0xbc'),_0xa93b('0xbc'),{'FaxAccountId':_[_0xa93b('0xb0')](_0x5c941a[_0xa93b('0x5c')]['id'])?undefined:_0x5c941a[_0xa93b('0x5c')]['id'],'path':_[_0xa93b('0xb0')](_0x5c941a[_0xa93b('0x5f')][_0xa93b('0xab')][0x0][_0xa93b('0x8')])?undefined:_0x5c941a[_0xa93b('0x5f')][_0xa93b('0xab')][0x0]['path'],'fax':_[_0xa93b('0xb0')](_0x5c941a[_0xa93b('0x5f')]['to'][0x0])?undefined:_0x5c941a[_0xa93b('0x5f')]['to'][0x0],'AttachmentId':_0x5c941a['body']['attachments'][0x0]['id']},client9002)[_0xa93b('0x24')](function(_0x5f1c8d){logger['info'](_0xa93b('0xbd'),_0x5f1c8d);})['catch'](function(_0x6382a0){logger[_0xa93b('0x25')](_0xa93b('0xbd'),_0x6382a0);});return _0x8bc9be;})[_0xa93b('0x24')](respondWithResult(_0x48813c,null))['catch'](handleError(_0x48813c,null));};exports[_0xa93b('0xbe')]=function(_0x54b854,_0x3eccde,_0x7a0052){return db[_0xa93b('0x56')][_0xa93b('0x65')]({'where':{'id':_0x54b854[_0xa93b('0x5c')]['id']}})['then'](handleEntityNotFound(_0x3eccde,null))[_0xa93b('0x24')](function(_0x503171){if(_0x503171){return _0x503171[_0xa93b('0xbe')](_0x54b854[_0xa93b('0x5f')][_0xa93b('0x73')],_[_0xa93b('0x76')](_0x54b854[_0xa93b('0x5f')],[_0xa93b('0x73'),'id'])||{})[_0xa93b('0xb9')](function(_0x4b2c4d){for(var _0x5447ea=0x0;_0x5447ea<_0x54b854['body'][_0xa93b('0x73')][_0xa93b('0x71')];_0x5447ea+=0x1){socket[_0xa93b('0xbf')]('userFaxAccount:save',{'UserId':_0x54b854['body']['ids'][_0x5447ea],'FaxAccountId':_0x54b854[_0xa93b('0x5c')]['id']});}return _0x4b2c4d;});}})[_0xa93b('0x24')](respondWithResult(_0x3eccde,null))[_0xa93b('0x2e')](handleError(_0x3eccde,null));};exports['removeAgents']=function(_0x55fa45,_0x508496,_0x2c687c){return db[_0xa93b('0x56')][_0xa93b('0x65')]({'where':{'id':_0x55fa45[_0xa93b('0x5c')]['id']}})[_0xa93b('0x24')](handleEntityNotFound(_0x508496,null))['then'](function(_0x5c4ed){if(_0x5c4ed){return _0x5c4ed['removeAgents'](_0x55fa45['query'][_0xa93b('0x73')])[_0xa93b('0x24')](function(){if(_[_0xa93b('0xc0')](_0x55fa45[_0xa93b('0x45')][_0xa93b('0x73')])){for(var _0x428e9d=0x0;_0x428e9d<_0x55fa45[_0xa93b('0x45')][_0xa93b('0x73')][_0xa93b('0x71')];_0x428e9d+=0x1){socket[_0xa93b('0xbf')]('userFaxAccount:remove',{'UserId':Number(_0x55fa45[_0xa93b('0x45')][_0xa93b('0x73')][_0x428e9d]),'FaxAccountId':Number(_0x55fa45[_0xa93b('0x5c')]['id'])});}}else{socket[_0xa93b('0xbf')](_0xa93b('0xc1'),{'UserId':Number(_0x55fa45[_0xa93b('0x45')][_0xa93b('0x73')]),'FaxAccountId':Number(_0x55fa45['params']['id'])});}});}})['then'](respondWithStatusCode(_0x508496,null))[_0xa93b('0x2e')](handleError(_0x508496,null));};exports[_0xa93b('0xc2')]=function(_0xa99175,_0x31e203,_0x5827e5){var _0x14d2f6={};var _0xe7b36={};var _0x42715c;var _0x26057a;return db[_0xa93b('0x56')][_0xa93b('0x6d')]({'where':{'id':_0xa99175[_0xa93b('0x5c')]['id']}})[_0xa93b('0x24')](handleEntityNotFound(_0x31e203,null))[_0xa93b('0x24')](function(_0x1d9661){if(_0x1d9661){_0x42715c=_0x1d9661;_0xe7b36[_0xa93b('0x44')]=_[_0xa93b('0x46')](db['User'][_0xa93b('0x40')]);_0xe7b36[_0xa93b('0x45')]=_[_0xa93b('0x46')](_0xa99175[_0xa93b('0x45')]);_0xe7b36['filters']=_['intersection'](_0xe7b36[_0xa93b('0x44')],_0xe7b36['query']);_0x14d2f6[_0xa93b('0x4a')]=_[_0xa93b('0x48')](_0xe7b36[_0xa93b('0x44')],qs['fields'](_0xa99175[_0xa93b('0x45')]['fields']));_0x14d2f6[_0xa93b('0x4a')]=_0x14d2f6[_0xa93b('0x4a')][_0xa93b('0x71')]?_0x14d2f6['attributes']:_0xe7b36[_0xa93b('0x44')];_0x14d2f6['order']=qs[_0xa93b('0x4f')](_0xa99175['query'][_0xa93b('0x4f')]);_0x14d2f6['where']=qs[_0xa93b('0x47')](_[_0xa93b('0x51')](_0xa99175['query'],_0xe7b36[_0xa93b('0x47')]));if(_0xa99175[_0xa93b('0x45')][_0xa93b('0x52')]){_0x14d2f6['where']=_[_0xa93b('0x53')](_0x14d2f6[_0xa93b('0x50')],{'$or':_[_0xa93b('0x54')](_0x14d2f6['attributes'],function(_0xcc41fb){var _0x200b3a={};_0x200b3a[_0xcc41fb]={'$like':'%'+_0xa99175[_0xa93b('0x45')][_0xa93b('0x52')]+'%'};return _0x200b3a;})});}_0x14d2f6=_[_0xa93b('0x53')]({},_0x14d2f6,_0xa99175[_0xa93b('0x55')]);return _0x42715c['getAgents'](_0x14d2f6);}})['then'](function(_0x10ac72){if(_0x10ac72){_0x26057a=_0x10ac72[_0xa93b('0x71')];if(!_0xa99175['query'][_0xa93b('0x4b')]('nolimit')){_0x14d2f6['limit']=qs[_0xa93b('0x4d')](_0xa99175[_0xa93b('0x45')]['limit']);_0x14d2f6[_0xa93b('0x34')]=qs[_0xa93b('0x34')](_0xa99175[_0xa93b('0x45')]['offset']);}return _0x42715c[_0xa93b('0xc2')](_0x14d2f6);}})[_0xa93b('0x24')](function(_0x4acc80){if(_0x4acc80){return _0x4acc80?{'count':_0x26057a,'rows':_0x4acc80}:null;}})['then'](respondWithResult(_0x31e203,null))[_0xa93b('0x2e')](handleError(_0x31e203,null));}; \ No newline at end of file +var _0x38a8=['rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','request\x20sent','debug','error','code','FaxAccount,\x20%s,\x20%s','message','catch','sendStatus','status','count','offset','limit','Content-Range','reject','save','update','destroy','get','FaxAccounts','end','stack','name','send','index','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','nolimit','sort','where','filter','merge','options','includeAll','include','FaxAccount','findAll','rows','params','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','body','describe','addDisposition','find','FaxAccountId','Disposition','findOne','order','pick','removeDispositions','ids','CannedAnswer','hasOwnProperty','removeAnswers','addInteraction','FaxInteraction','getInteractions','CmContact','Contact','User','Owner','Tag','Tags','color','tag','sequelize','transaction','FaxApplication','findAndCountAll','priority','getApplications','context','from-voip-provider','localstationid','description','Fax\x20Extension','push','Answer','CDR(type)=inbound-fax','Set','ecm','gateway','faxdetect','headerinfo','maxrate','minrate','t38timeout','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','VoiceExtension','bulkCreate','updateAccountApplications','tech','key','createdAt','updatedAt','ListId','getMessages','FaxMessage','$gte','split','YYYY-MM-DD\x20HH:mm:ss','CmList','List','Contacts','DESC','attachments','join','root','basename','CheckAfterSend','isNil','from','format','\x22%s\x22\x20<%s>','fax','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Messages','Contact\x20not\x20found','dataValues','SendFax','info','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','eml-format'];(function(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0x38a8,0x17d));var _0x838a=function(_0x31bab3,_0x44554f){_0x31bab3=_0x31bab3-0x0;var _0x4fd382=_0x38a8[_0x31bab3];return _0x4fd382;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x838a('0x0'));var rimraf=require(_0x838a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x838a('0x2'));var rp=require(_0x838a('0x3'));var moment=require('moment');var BPromise=require(_0x838a('0x4'));var Mustache=require(_0x838a('0x5'));var util=require(_0x838a('0x6'));var path=require(_0x838a('0x7'));var sox=require(_0x838a('0x8'));var csv=require('to-csv');var ejs=require(_0x838a('0x9'));var fs=require('fs');var _=require(_0x838a('0xa'));var squel=require(_0x838a('0xb'));var crypto=require(_0x838a('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x838a('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x838a('0xe'));var Redis=require(_0x838a('0xf'));var authService=require(_0x838a('0x10'));var qs=require(_0x838a('0x11'));var as=require(_0x838a('0x12'));var hardwareService=require(_0x838a('0x13'));var logger=require(_0x838a('0x14'))('api');var utils=require(_0x838a('0x15'));var config=require(_0x838a('0x16'));var db=require(_0x838a('0x17'))['db'];config[_0x838a('0x18')]=_[_0x838a('0x19')](config[_0x838a('0x18')],{'host':_0x838a('0x1a'),'port':0x18eb});var socket=require(_0x838a('0x1b'))(new Redis(config['redis']));require(_0x838a('0x1c'))[_0x838a('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson[_0x838a('0x1e')][_0x838a('0x1f')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function checkPasswordPattern(_0x24eeb2,_0x593b81,_0x83b6a1){if(_0x83b6a1){var _0x4ede24=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4ede24[_0x838a('0x20')](_0x593b81)){return _0x24eeb2;}else{throw new db[(_0x838a('0x21'))][(_0x838a('0x22'))](_0x838a('0x23'));}}else{return _0x24eeb2;}}function respondWithRpcPromise(_0x866fca,_0xe735b8,_0x26b3ec,_0x3be775){return new BPromise(function(_0x39832a,_0x312fc3){var _0xbd7d71=_0x3be775||client;return _0xbd7d71[_0x838a('0x24')](_0x866fca,_0x26b3ec)[_0x838a('0x25')](function(_0x2b2af7){logger['info']('FaxAccount,\x20%s,\x20%s',_0xe735b8,_0x838a('0x26'));logger[_0x838a('0x27')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0xe735b8,'request\x20sent',JSON['stringify'](_0x2b2af7));if(_0x2b2af7[_0x838a('0x28')]){if(_0x2b2af7[_0x838a('0x28')][_0x838a('0x29')]===0x1f4){logger[_0x838a('0x28')](_0x838a('0x2a'),_0xe735b8,_0x2b2af7[_0x838a('0x28')][_0x838a('0x2b')]);return _0x312fc3(_0x2b2af7['error'][_0x838a('0x2b')]);}logger[_0x838a('0x28')](_0x838a('0x2a'),_0xe735b8,_0x2b2af7[_0x838a('0x28')][_0x838a('0x2b')]);return _0x39832a(_0x2b2af7[_0x838a('0x28')][_0x838a('0x2b')]);}else{logger['info'](_0x838a('0x2a'),_0xe735b8,_0x838a('0x26'));_0x39832a(_0x2b2af7['result'][_0x838a('0x2b')]);}})[_0x838a('0x2c')](function(_0x7464ae){logger['error'](_0x838a('0x2a'),_0xe735b8,_0x7464ae);_0x312fc3(_0x7464ae);});});}function respondWithStatusCode(_0x489b19,_0x56499e){_0x56499e=_0x56499e||0xcc;return function(_0x5b4b06){if(_0x5b4b06){return _0x489b19[_0x838a('0x2d')](_0x56499e);}return _0x489b19[_0x838a('0x2e')](_0x56499e)['end']();};}function respondWithResult(_0x958063,_0x3adffa){_0x3adffa=_0x3adffa||0xc8;return function(_0x5abac7){if(_0x5abac7){return _0x958063[_0x838a('0x2e')](_0x3adffa)['json'](_0x5abac7);}};}function respondWithFilteredResult(_0x43e72c,_0x1ece58){return function(_0x551bfa){if(_0x551bfa){var _0x4a3f3b=_0x551bfa[_0x838a('0x2f')],_0x172210=_0x1ece58[_0x838a('0x30')],_0x29f06e=_0x1ece58[_0x838a('0x30')]+_0x1ece58[_0x838a('0x31')],_0x2c4460;if(_0x29f06e>=_0x4a3f3b){_0x29f06e=_0x4a3f3b;_0x2c4460=0xc8;}else{_0x2c4460=0xce;}_0x43e72c[_0x838a('0x2e')](_0x2c4460);return _0x43e72c['set'](_0x838a('0x32'),_0x172210+'-'+_0x29f06e+'/'+_0x4a3f3b)['json'](_0x551bfa);}return null;};}function patchUpdates(_0x590d62){return function(_0x5e92f0){try{jsonpatch['apply'](_0x5e92f0,_0x590d62,!![]);}catch(_0x143a34){return BPromise[_0x838a('0x33')](_0x143a34);}return _0x5e92f0[_0x838a('0x34')]();};}function saveUpdates(_0x3ddd5a,_0x42f99a){return function(_0x30b5d5){if(_0x30b5d5){return _0x30b5d5[_0x838a('0x35')](_0x3ddd5a)['then'](function(_0x3bb577){return _0x3bb577;});}return null;};}function removeEntity(_0x59d5cc,_0x19e68f){return function(_0x2c6d6e){if(_0x2c6d6e){return _0x2c6d6e[_0x838a('0x36')]()[_0x838a('0x25')](function(){var _0x14bf8b=_0x2c6d6e[_0x838a('0x37')]({'plain':!![]});var _0x11418a=_0x838a('0x38');return db['UserProfileResource'][_0x838a('0x36')]({'where':{'type':_0x11418a,'resourceId':_0x14bf8b['id']}})[_0x838a('0x25')](function(){return _0x2c6d6e;});})['then'](function(){_0x59d5cc['status'](0xcc)[_0x838a('0x39')]();});}};}function handleEntityNotFound(_0x111bd9,_0x15e7e3){return function(_0x27f88e){if(!_0x27f88e){_0x111bd9[_0x838a('0x2d')](0x194);}return _0x27f88e;};}function handleError(_0xea7742,_0x43ff59){_0x43ff59=_0x43ff59||0x1f4;return function(_0x28d7b7){logger[_0x838a('0x28')](_0x28d7b7[_0x838a('0x3a')]);if(_0x28d7b7[_0x838a('0x3b')]){delete _0x28d7b7[_0x838a('0x3b')];}_0xea7742[_0x838a('0x2e')](_0x43ff59)[_0x838a('0x3c')](_0x28d7b7);};}exports[_0x838a('0x3d')]=function(_0x2f5831,_0x4505d6){var _0x15d8da={'include':[{'model':db[_0x838a('0x3e')],'as':_0x838a('0x3f')}]},_0x10e1c8={},_0x3f4033={'count':0x0,'rows':[]};var _0x490004=_[_0x838a('0x40')](db['FaxAccount'][_0x838a('0x41')],function(_0x3f7fd1){return{'name':_0x3f7fd1[_0x838a('0x42')],'type':_0x3f7fd1[_0x838a('0x43')]['key']};});_0x10e1c8[_0x838a('0x44')]=_[_0x838a('0x40')](_0x490004,'name');_0x10e1c8[_0x838a('0x45')]=_[_0x838a('0x46')](_0x2f5831['query']);_0x10e1c8[_0x838a('0x47')]=_[_0x838a('0x48')](_0x10e1c8[_0x838a('0x44')],_0x10e1c8[_0x838a('0x45')]);_0x15d8da['attributes']=_['intersection'](_0x10e1c8[_0x838a('0x44')],qs[_0x838a('0x49')](_0x2f5831[_0x838a('0x45')][_0x838a('0x49')]));_0x15d8da[_0x838a('0x4a')]=_0x15d8da[_0x838a('0x4a')][_0x838a('0x4b')]?_0x15d8da[_0x838a('0x4a')]:_0x10e1c8[_0x838a('0x44')];if(!_0x2f5831['query']['hasOwnProperty'](_0x838a('0x4c'))){_0x15d8da[_0x838a('0x31')]=qs[_0x838a('0x31')](_0x2f5831[_0x838a('0x45')][_0x838a('0x31')]);_0x15d8da[_0x838a('0x30')]=qs['offset'](_0x2f5831['query']['offset']);}_0x15d8da['order']=qs[_0x838a('0x4d')](_0x2f5831[_0x838a('0x45')][_0x838a('0x4d')]);_0x15d8da[_0x838a('0x4e')]=qs[_0x838a('0x47')](_['pick'](_0x2f5831[_0x838a('0x45')],_0x10e1c8[_0x838a('0x47')]),_0x490004);if(_0x2f5831[_0x838a('0x45')][_0x838a('0x4f')]){_0x15d8da[_0x838a('0x4e')]=_[_0x838a('0x50')](_0x15d8da[_0x838a('0x4e')],{'$or':_[_0x838a('0x40')](_0x490004,function(_0x24295d){if(_0x24295d[_0x838a('0x43')]!=='VIRTUAL'){var _0x31c326={};_0x31c326[_0x24295d[_0x838a('0x3b')]]={'$like':'%'+_0x2f5831[_0x838a('0x45')]['filter']+'%'};return _0x31c326;}})});}_0x15d8da=_[_0x838a('0x50')]({},_0x15d8da,_0x2f5831[_0x838a('0x51')]);var _0x466e58={'where':_0x15d8da[_0x838a('0x4e')]};return db['FaxAccount'][_0x838a('0x2f')](_0x466e58)['then'](function(_0x1ab13a){_0x3f4033[_0x838a('0x2f')]=_0x1ab13a;if(_0x2f5831[_0x838a('0x45')][_0x838a('0x52')]){_0x15d8da[_0x838a('0x53')]=[{'all':!![]}];}return db[_0x838a('0x54')][_0x838a('0x55')](_0x15d8da);})[_0x838a('0x25')](function(_0xa5e9f3){_0x3f4033[_0x838a('0x56')]=_0xa5e9f3;return _0x3f4033;})['then'](respondWithFilteredResult(_0x4505d6,_0x15d8da))[_0x838a('0x2c')](handleError(_0x4505d6,null));};exports['show']=function(_0x4b4d3c,_0x2e21f3){var _0x5d484a={'raw':![],'where':{'id':_0x4b4d3c[_0x838a('0x57')]['id']},'include':[{'model':db[_0x838a('0x3e')],'as':_0x838a('0x3f')}]},_0xe35042={};_0xe35042[_0x838a('0x44')]=_[_0x838a('0x46')](db[_0x838a('0x54')][_0x838a('0x41')]);_0xe35042[_0x838a('0x45')]=_[_0x838a('0x46')](_0x4b4d3c[_0x838a('0x45')]);_0xe35042[_0x838a('0x47')]=_[_0x838a('0x48')](_0xe35042[_0x838a('0x44')],_0xe35042[_0x838a('0x45')]);_0x5d484a[_0x838a('0x4a')]=_[_0x838a('0x48')](_0xe35042[_0x838a('0x44')],qs['fields'](_0x4b4d3c[_0x838a('0x45')][_0x838a('0x49')]));_0x5d484a[_0x838a('0x4a')]=_0x5d484a['attributes'][_0x838a('0x4b')]?_0x5d484a[_0x838a('0x4a')]:_0xe35042['model'];if(_0x4b4d3c[_0x838a('0x45')]['includeAll']){_0x5d484a[_0x838a('0x53')]=[{'all':!![]}];}_0x5d484a=_['merge']({},_0x5d484a,_0x4b4d3c[_0x838a('0x51')]);return db[_0x838a('0x54')]['find'](_0x5d484a)['then'](handleEntityNotFound(_0x2e21f3,null))['then'](respondWithResult(_0x2e21f3,null))[_0x838a('0x2c')](handleError(_0x2e21f3,null));};exports[_0x838a('0x58')]=function(_0x2e23bd,_0x553b7a){return db[_0x838a('0x54')]['create'](_0x2e23bd['body'],{})[_0x838a('0x25')](function(_0x588655){var _0x8abcfe=_0x2e23bd['user'][_0x838a('0x37')]({'plain':!![]});if(!_0x8abcfe)throw new Error(_0x838a('0x59'));if(_0x8abcfe[_0x838a('0x5a')]===_0x838a('0x5b')){var _0x32798d=_0x588655[_0x838a('0x37')]({'plain':!![]});var _0x2e79a4='FaxAccounts';return db[_0x838a('0x5c')]['find']({'where':{'name':_0x2e79a4,'userProfileId':_0x8abcfe[_0x838a('0x5d')]},'raw':!![]})[_0x838a('0x25')](function(_0x5c72c6){if(_0x5c72c6&&_0x5c72c6[_0x838a('0x5e')]===0x0){return db[_0x838a('0x5f')][_0x838a('0x58')]({'name':_0x32798d['name'],'resourceId':_0x32798d['id'],'type':_0x5c72c6[_0x838a('0x3b')],'sectionId':_0x5c72c6['id']},{})['then'](function(){return _0x588655;});}else{return _0x588655;}})[_0x838a('0x2c')](function(_0x3f69b1){logger[_0x838a('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3f69b1);throw _0x3f69b1;});}return _0x588655;})[_0x838a('0x25')](respondWithResult(_0x553b7a,0xc9))['catch'](handleError(_0x553b7a,null));};exports[_0x838a('0x35')]=function(_0x16acce,_0x1cbf77){if(_0x16acce['body']['id']){delete _0x16acce[_0x838a('0x60')]['id'];}return db[_0x838a('0x54')]['find']({'where':{'id':_0x16acce[_0x838a('0x57')]['id']},'include':[{'model':db[_0x838a('0x3e')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x1cbf77,null))['then'](saveUpdates(_0x16acce[_0x838a('0x60')],null))[_0x838a('0x25')](respondWithResult(_0x1cbf77,null))[_0x838a('0x2c')](handleError(_0x1cbf77,null));};exports['destroy']=function(_0x78a476,_0x2cde2f){return db['FaxAccount']['find']({'where':{'id':_0x78a476[_0x838a('0x57')]['id']}})[_0x838a('0x25')](handleEntityNotFound(_0x2cde2f,null))[_0x838a('0x25')](removeEntity(_0x2cde2f,null))[_0x838a('0x2c')](handleError(_0x2cde2f,null));};exports[_0x838a('0x61')]=function(_0x35a084,_0xa2cc65){return db[_0x838a('0x54')][_0x838a('0x61')]()['then'](respondWithResult(_0xa2cc65,null))[_0x838a('0x2c')](handleError(_0xa2cc65,null));};exports[_0x838a('0x62')]=function(_0x3cfa3a,_0x572126,_0x173b42){if(_0x3cfa3a[_0x838a('0x60')]['id']){delete _0x3cfa3a['body']['id'];}return db[_0x838a('0x54')][_0x838a('0x63')]({'where':{'id':_0x3cfa3a[_0x838a('0x57')]['id']}})[_0x838a('0x25')](handleEntityNotFound(_0x572126,null))['then'](function(_0x3e886e){if(_0x3e886e){_0x3cfa3a[_0x838a('0x60')][_0x838a('0x64')]=_0x3e886e['id'];return db[_0x838a('0x65')][_0x838a('0x58')](_0x3cfa3a[_0x838a('0x60')]);}})[_0x838a('0x25')](respondWithResult(_0x572126,null))[_0x838a('0x2c')](handleError(_0x572126,null));};exports['getDispositions']=function(_0x37aa08,_0x107263,_0x46fa79){var _0x1a777e={'raw':![],'where':{}};var _0x3a254f={};var _0x26fb70={'count':0x0,'rows':[]};return db[_0x838a('0x54')][_0x838a('0x66')]({'where':{'id':_0x37aa08['params']['id']}})[_0x838a('0x25')](handleEntityNotFound(_0x107263,null))['then'](function(_0x2300c3){if(_0x2300c3){_0x3a254f[_0x838a('0x44')]=_['keys'](db['Disposition'][_0x838a('0x41')]);_0x3a254f[_0x838a('0x45')]=_[_0x838a('0x46')](_0x37aa08[_0x838a('0x45')]);_0x3a254f[_0x838a('0x47')]=_[_0x838a('0x48')](_0x3a254f[_0x838a('0x44')],_0x3a254f['query']);_0x1a777e[_0x838a('0x4a')]=_[_0x838a('0x48')](_0x3a254f[_0x838a('0x44')],qs['fields'](_0x37aa08[_0x838a('0x45')][_0x838a('0x49')]));_0x1a777e[_0x838a('0x4a')]=_0x1a777e[_0x838a('0x4a')][_0x838a('0x4b')]?_0x1a777e[_0x838a('0x4a')]:_0x3a254f['model'];if(!_0x37aa08[_0x838a('0x45')]['hasOwnProperty'](_0x838a('0x4c'))){_0x1a777e['limit']=qs[_0x838a('0x31')](_0x37aa08['query']['limit']);_0x1a777e['offset']=qs[_0x838a('0x30')](_0x37aa08['query'][_0x838a('0x30')]);}_0x1a777e[_0x838a('0x67')]=qs[_0x838a('0x4d')](_0x37aa08['query'][_0x838a('0x4d')]);_0x1a777e[_0x838a('0x4e')]=qs[_0x838a('0x47')](_[_0x838a('0x68')](_0x37aa08['query'],_0x3a254f[_0x838a('0x47')]));_0x1a777e['where'][_0x838a('0x64')]=_0x2300c3['id'];if(_0x37aa08[_0x838a('0x45')]['filter']){_0x1a777e['where']=_[_0x838a('0x50')](_0x1a777e[_0x838a('0x4e')],{'$or':_[_0x838a('0x40')](_0x1a777e[_0x838a('0x4a')],function(_0x116061){var _0xf02389={};_0xf02389[_0x116061]={'$like':'%'+_0x37aa08[_0x838a('0x45')][_0x838a('0x4f')]+'%'};return _0xf02389;})});}_0x1a777e=_['merge']({},_0x1a777e,_0x37aa08[_0x838a('0x51')]);return db['Disposition']['count']({'where':_0x1a777e['where']})[_0x838a('0x25')](function(_0x23fbec){_0x26fb70['count']=_0x23fbec;if(_0x37aa08[_0x838a('0x45')][_0x838a('0x52')]){_0x1a777e[_0x838a('0x53')]=[{'all':!![]}];}return db[_0x838a('0x65')][_0x838a('0x55')](_0x1a777e);})['then'](function(_0x5d5f7b){_0x26fb70[_0x838a('0x56')]=_0x5d5f7b;return _0x26fb70;});}})[_0x838a('0x25')](respondWithFilteredResult(_0x107263,_0x1a777e))['catch'](handleError(_0x107263,null));};exports[_0x838a('0x69')]=function(_0x45128f,_0x39ad26,_0x45949a){return db[_0x838a('0x54')][_0x838a('0x63')]({'where':{'id':_0x45128f['params']['id']}})[_0x838a('0x25')](handleEntityNotFound(_0x39ad26,null))[_0x838a('0x25')](function(_0x476e01){if(_0x476e01){return _0x476e01[_0x838a('0x69')](_0x45128f[_0x838a('0x45')][_0x838a('0x6a')]);}})[_0x838a('0x25')](respondWithStatusCode(_0x39ad26,null))[_0x838a('0x2c')](handleError(_0x39ad26,null));};exports['addAnswer']=function(_0x338e7b,_0x21ca38,_0x20b135){if(_0x338e7b[_0x838a('0x60')]['id']){delete _0x338e7b[_0x838a('0x60')]['id'];}return db['FaxAccount'][_0x838a('0x63')]({'where':{'id':_0x338e7b[_0x838a('0x57')]['id']}})['then'](handleEntityNotFound(_0x21ca38,null))[_0x838a('0x25')](function(_0x56cb20){if(_0x56cb20){_0x338e7b[_0x838a('0x60')][_0x838a('0x64')]=_0x56cb20['id'];return db[_0x838a('0x6b')][_0x838a('0x58')](_0x338e7b[_0x838a('0x60')]);}})[_0x838a('0x25')](respondWithResult(_0x21ca38,null))['catch'](handleError(_0x21ca38,null));};exports['getAnswers']=function(_0x8f503,_0x370462,_0xdafd7c){var _0x1bd3f1={'raw':![],'where':{}};var _0x3866df={};var _0x2261ad={'count':0x0,'rows':[]};return db[_0x838a('0x54')][_0x838a('0x66')]({'where':{'id':_0x8f503[_0x838a('0x57')]['id']}})[_0x838a('0x25')](handleEntityNotFound(_0x370462,null))[_0x838a('0x25')](function(_0x24b027){if(_0x24b027){_0x3866df['model']=_['keys'](db[_0x838a('0x6b')]['rawAttributes']);_0x3866df[_0x838a('0x45')]=_[_0x838a('0x46')](_0x8f503[_0x838a('0x45')]);_0x3866df[_0x838a('0x47')]=_[_0x838a('0x48')](_0x3866df[_0x838a('0x44')],_0x3866df[_0x838a('0x45')]);_0x1bd3f1[_0x838a('0x4a')]=_[_0x838a('0x48')](_0x3866df[_0x838a('0x44')],qs[_0x838a('0x49')](_0x8f503[_0x838a('0x45')][_0x838a('0x49')]));_0x1bd3f1[_0x838a('0x4a')]=_0x1bd3f1[_0x838a('0x4a')][_0x838a('0x4b')]?_0x1bd3f1['attributes']:_0x3866df['model'];if(!_0x8f503[_0x838a('0x45')][_0x838a('0x6c')](_0x838a('0x4c'))){_0x1bd3f1['limit']=qs[_0x838a('0x31')](_0x8f503[_0x838a('0x45')][_0x838a('0x31')]);_0x1bd3f1[_0x838a('0x30')]=qs[_0x838a('0x30')](_0x8f503[_0x838a('0x45')][_0x838a('0x30')]);}_0x1bd3f1['order']=qs[_0x838a('0x4d')](_0x8f503[_0x838a('0x45')]['sort']);_0x1bd3f1[_0x838a('0x4e')]=qs[_0x838a('0x47')](_[_0x838a('0x68')](_0x8f503[_0x838a('0x45')],_0x3866df['filters']));_0x1bd3f1['where']['FaxAccountId']=_0x24b027['id'];if(_0x8f503[_0x838a('0x45')][_0x838a('0x4f')]){_0x1bd3f1[_0x838a('0x4e')]=_['merge'](_0x1bd3f1['where'],{'$or':_[_0x838a('0x40')](_0x1bd3f1['attributes'],function(_0x5f303e){var _0x42605b={};_0x42605b[_0x5f303e]={'$like':'%'+_0x8f503[_0x838a('0x45')][_0x838a('0x4f')]+'%'};return _0x42605b;})});}_0x1bd3f1=_[_0x838a('0x50')]({},_0x1bd3f1,_0x8f503[_0x838a('0x51')]);return db['CannedAnswer']['count']({'where':_0x1bd3f1[_0x838a('0x4e')]})['then'](function(_0x2795a9){_0x2261ad[_0x838a('0x2f')]=_0x2795a9;if(_0x8f503[_0x838a('0x45')]['includeAll']){_0x1bd3f1[_0x838a('0x53')]=[{'all':!![]}];}return db[_0x838a('0x6b')][_0x838a('0x55')](_0x1bd3f1);})['then'](function(_0x3a8166){_0x2261ad[_0x838a('0x56')]=_0x3a8166;return _0x2261ad;});}})[_0x838a('0x25')](respondWithFilteredResult(_0x370462,_0x1bd3f1))['catch'](handleError(_0x370462,null));};exports['removeAnswers']=function(_0x55df1f,_0x5f292d,_0x14ff69){return db['FaxAccount'][_0x838a('0x63')]({'where':{'id':_0x55df1f['params']['id']}})[_0x838a('0x25')](handleEntityNotFound(_0x5f292d,null))['then'](function(_0x5b2f47){if(_0x5b2f47){return _0x5b2f47[_0x838a('0x6d')](_0x55df1f[_0x838a('0x45')][_0x838a('0x6a')]);}})[_0x838a('0x25')](respondWithStatusCode(_0x5f292d,null))['catch'](handleError(_0x5f292d,null));};exports[_0x838a('0x6e')]=function(_0x4fdd12,_0x68d2fa,_0x49e1ca){return db[_0x838a('0x6f')][_0x838a('0x63')]({'where':{'id':_0x4fdd12['params']['id']}})[_0x838a('0x25')](handleEntityNotFound(_0x68d2fa,null))['then'](function(_0x470aae){if(_0x470aae){return _0x470aae['addInteraction'](_0x4fdd12['body']['ids'],_['omit'](_0x4fdd12[_0x838a('0x60')],[_0x838a('0x6a'),'id'])||{});}})[_0x838a('0x25')](respondWithResult(_0x68d2fa,null))[_0x838a('0x2c')](handleError(_0x68d2fa,null));};exports[_0x838a('0x70')]=function(_0x39ff53,_0x28dcbf,_0x211240){var _0x247325={'raw':![],'where':{}};var _0x5d1620={};var _0x35ff07={'count':0x0,'rows':[]};return db[_0x838a('0x54')][_0x838a('0x66')]({'where':{'id':_0x39ff53[_0x838a('0x57')]['id']}})[_0x838a('0x25')](handleEntityNotFound(_0x28dcbf,null))[_0x838a('0x25')](function(_0xa4698f){if(_0xa4698f){_0x5d1620[_0x838a('0x44')]=_[_0x838a('0x46')](db['FaxInteraction'][_0x838a('0x41')]);_0x5d1620['query']=_[_0x838a('0x46')](_0x39ff53[_0x838a('0x45')]);_0x5d1620[_0x838a('0x47')]=_[_0x838a('0x48')](_0x5d1620['model'],_0x5d1620['query']);_0x247325[_0x838a('0x4a')]=_[_0x838a('0x48')](_0x5d1620[_0x838a('0x44')],qs['fields'](_0x39ff53['query']['fields']));_0x247325[_0x838a('0x4a')]=_0x247325['attributes'][_0x838a('0x4b')]?_0x247325[_0x838a('0x4a')]:_0x5d1620[_0x838a('0x44')];if(!_0x39ff53['query']['hasOwnProperty'](_0x838a('0x4c'))){_0x247325['limit']=qs[_0x838a('0x31')](_0x39ff53[_0x838a('0x45')][_0x838a('0x31')]);_0x247325[_0x838a('0x30')]=qs[_0x838a('0x30')](_0x39ff53[_0x838a('0x45')][_0x838a('0x30')]);}_0x247325[_0x838a('0x67')]=qs[_0x838a('0x4d')](_0x39ff53[_0x838a('0x45')][_0x838a('0x4d')]);_0x247325['where']=qs[_0x838a('0x47')](_[_0x838a('0x68')](_0x39ff53[_0x838a('0x45')],_0x5d1620['filters']));_0x247325['where']['FaxAccountId']=_0xa4698f['id'];if(_0x39ff53[_0x838a('0x45')][_0x838a('0x4f')]){_0x247325['where']=_[_0x838a('0x50')](_0x247325[_0x838a('0x4e')],{'$or':_[_0x838a('0x40')](_0x247325[_0x838a('0x4a')],function(_0x5e9110){var _0x45f56c={};_0x45f56c[_0x5e9110]={'$like':'%'+_0x39ff53[_0x838a('0x45')][_0x838a('0x4f')]+'%'};return _0x45f56c;})});}_0x247325=_[_0x838a('0x50')]({},_0x247325,_0x39ff53[_0x838a('0x51')]);return db['FaxInteraction'][_0x838a('0x2f')]({'where':_0x247325[_0x838a('0x4e')]})['then'](function(_0x3ad01d){_0x35ff07[_0x838a('0x2f')]=_0x3ad01d;if(_0x39ff53['query'][_0x838a('0x52')]){_0x247325[_0x838a('0x53')]=[{'model':db[_0x838a('0x71')],'as':_0x838a('0x72'),'required':![]},{'model':db[_0x838a('0x73')],'as':_0x838a('0x74'),'attributes':[_0x838a('0x3b'),'fullname','internal'],'required':![]},{'model':db[_0x838a('0x75')],'as':_0x838a('0x76'),'attributes':['id',_0x838a('0x3b'),_0x838a('0x77')],'where':_0x39ff53[_0x838a('0x45')][_0x838a('0x78')]?{'id':_0x39ff53[_0x838a('0x45')][_0x838a('0x78')]}:undefined,'required':_0x39ff53[_0x838a('0x45')][_0x838a('0x78')]?!![]:![]}];}return db[_0x838a('0x6f')]['findAll'](_0x247325);})[_0x838a('0x25')](function(_0x212287){_0x35ff07[_0x838a('0x56')]=_0x212287;return _0x35ff07;});}})[_0x838a('0x25')](respondWithFilteredResult(_0x28dcbf,_0x247325))[_0x838a('0x2c')](handleError(_0x28dcbf,null));};exports['addApplications']=function(_0x2fe636,_0x339c13,_0x2e67bb){return db[_0x838a('0x54')][_0x838a('0x66')]({'where':{'id':_0x2fe636[_0x838a('0x57')]['id']}})[_0x838a('0x25')](handleEntityNotFound(_0x339c13,null))[_0x838a('0x25')](function(_0x82dafc){if(_0x82dafc){return db[_0x838a('0x79')][_0x838a('0x7a')](function(_0x81a1e3){return db['FaxApplication'][_0x838a('0x36')]({'where':{'FaxAccountId':_0x2fe636[_0x838a('0x57')]['id']},'transaction':_0x81a1e3})[_0x838a('0x25')](function(_0xbe499f){var _0x12aa8b=_[_0x838a('0x40')](_0x2fe636['body'],function(_0x1620fb){_0x1620fb[_0x838a('0x64')]=_0x2fe636[_0x838a('0x57')]['id'];return _0x1620fb;});return db[_0x838a('0x7b')]['bulkCreate'](_0x12aa8b,{'transaction':_0x81a1e3});});})[_0x838a('0x25')](function(){return db[_0x838a('0x7b')][_0x838a('0x7c')]({'where':{'FaxAccountId':_0x2fe636[_0x838a('0x57')]['id']},'order':_0x838a('0x7d')});});}})[_0x838a('0x25')](respondWithResult(_0x339c13,null))[_0x838a('0x2c')](handleError(_0x339c13,null));};exports[_0x838a('0x7e')]=function(_0x294aa1,_0x17508e,_0x24ea0c){var _0x543821={};var _0x561828={};var _0x1c165a;var _0x490d8d;return db[_0x838a('0x54')][_0x838a('0x66')]({'where':{'id':_0x294aa1[_0x838a('0x57')]['id']}})[_0x838a('0x25')](handleEntityNotFound(_0x17508e,null))[_0x838a('0x25')](function(_0xf2fde8){if(_0xf2fde8){_0x1c165a=_0xf2fde8;_0x561828['model']=_[_0x838a('0x46')](db['FaxApplication'][_0x838a('0x41')]);_0x561828[_0x838a('0x45')]=_[_0x838a('0x46')](_0x294aa1['query']);_0x561828[_0x838a('0x47')]=_[_0x838a('0x48')](_0x561828[_0x838a('0x44')],_0x561828['query']);_0x543821[_0x838a('0x4a')]=_[_0x838a('0x48')](_0x561828[_0x838a('0x44')],qs[_0x838a('0x49')](_0x294aa1[_0x838a('0x45')][_0x838a('0x49')]));_0x543821['attributes']=_0x543821['attributes'][_0x838a('0x4b')]?_0x543821[_0x838a('0x4a')]:_0x561828['model'];_0x543821['order']=qs[_0x838a('0x4d')](_0x294aa1[_0x838a('0x45')]['sort']);_0x543821[_0x838a('0x4e')]=qs[_0x838a('0x47')](_[_0x838a('0x68')](_0x294aa1['query'],_0x561828['filters']));if(_0x294aa1['query']['filter']){_0x543821['where']=_[_0x838a('0x50')](_0x543821[_0x838a('0x4e')],{'$or':_[_0x838a('0x40')](_0x543821[_0x838a('0x4a')],function(_0x57b970){var _0x485136={};_0x485136[_0x57b970]={'$like':'%'+_0x294aa1[_0x838a('0x45')][_0x838a('0x4f')]+'%'};return _0x485136;})});}_0x543821=_[_0x838a('0x50')]({},_0x543821,_0x294aa1[_0x838a('0x51')]);return _0x1c165a[_0x838a('0x7e')](_0x543821);}})['then'](function(_0x3b2b53){if(_0x3b2b53){_0x490d8d=_0x3b2b53['length'];if(!_0x294aa1[_0x838a('0x45')]['hasOwnProperty'](_0x838a('0x4c'))){_0x543821[_0x838a('0x31')]=qs[_0x838a('0x31')](_0x294aa1[_0x838a('0x45')][_0x838a('0x31')]);_0x543821['offset']=qs[_0x838a('0x30')](_0x294aa1[_0x838a('0x45')][_0x838a('0x30')]);}return _0x1c165a[_0x838a('0x7e')](_0x543821);}})['then'](function(_0x57a240){if(_0x57a240){return _0x57a240?{'count':_0x490d8d,'rows':_0x57a240}:null;}})[_0x838a('0x25')](respondWithResult(_0x17508e,null))[_0x838a('0x2c')](handleError(_0x17508e,null));};function Extension(_0x17ac87,_0x2cee3c,_0x3d4c1e,_0x5d3097){this[_0x838a('0x7f')]=_0x838a('0x80');this['exten']=_0x17ac87[_0x838a('0x81')];this['app']=_0x5d3097;this[_0x838a('0x43')]='system';this[_0x838a('0x82')]=_0x838a('0x83');this[_0x838a('0x64')]=_0x17ac87['id'];this['priority']=_0x2cee3c;this['appdata']=_0x3d4c1e;}function createExtensionsReciveFax(_0x3cd37a){var _0x2a38ce=0x1;var _0x17a5d6=[];_0x17a5d6[_0x838a('0x84')](new Extension(_0x3cd37a,_0x2a38ce,'',_0x838a('0x85')));_0x2a38ce+=0x1;_0x17a5d6[_0x838a('0x84')](new Extension(_0x3cd37a,_0x2a38ce,_0x838a('0x86'),_0x838a('0x87')));_0x2a38ce+=0x1;for(var _0x372faf in _0x3cd37a){if(_0x3cd37a[_0x838a('0x6c')](_0x372faf)&&(_0x372faf===_0x838a('0x88')||_0x372faf==='localstationid'||_0x372faf===_0x838a('0x89')||_0x372faf===_0x838a('0x8a')||_0x372faf===_0x838a('0x8b')||_0x372faf===_0x838a('0x8c')||_0x372faf===_0x838a('0x8d')||_0x372faf==='modem'||_0x372faf===_0x838a('0x8e'))){_0x17a5d6[_0x838a('0x84')](new Extension(_0x3cd37a,_0x2a38ce,'FAXOPT('+_0x372faf+')='+_0x3cd37a[_0x372faf],_0x838a('0x87')));_0x2a38ce+=0x1;}}_0x17a5d6['push'](new Extension(_0x3cd37a,_0x2a38ce,'6',_0x838a('0x8f')));_0x2a38ce+=0x1;_0x17a5d6['push'](new Extension(_0x3cd37a,_0x2a38ce,_0x838a('0x90'),_0x838a('0x91')));_0x2a38ce=0x0;return _0x17a5d6;}exports[_0x838a('0x92')]=function(_0x3ef10a,_0x17d7b5,_0x159a43){var _0x21161d;return db[_0x838a('0x79')][_0x838a('0x7a')](function(_0x1aa899){return db['FaxAccount']['create'](_0x3ef10a[_0x838a('0x60')],{'transaction':_0x1aa899})[_0x838a('0x25')](function(_0x14a01a){_0x21161d=_0x14a01a[_0x838a('0x37')]({'plain':!![]});return db[_0x838a('0x93')][_0x838a('0x94')](createExtensionsReciveFax(_0x21161d),{'transaction':_0x1aa899});});})[_0x838a('0x25')](function(){return _0x21161d;})['then'](respondWithResult(_0x17d7b5,null))['catch'](handleError(_0x17d7b5,null));};exports[_0x838a('0x95')]=function(_0x1d72d8,_0x28b6ca,_0x23c332){var _0xd18cad;return db['sequelize'][_0x838a('0x7a')](function(_0x1e044d){return db[_0x838a('0x54')][_0x838a('0x35')](_0x1d72d8[_0x838a('0x60')],{'where':{'id':_0x1d72d8[_0x838a('0x60')]['id']},'transaction':_0x1e044d})[_0x838a('0x25')](function(_0x56c784){return db[_0x838a('0x93')][_0x838a('0x36')]({'where':{'FaxAccountId':_0x1d72d8[_0x838a('0x60')]['id']},'transaction':_0x1e044d})[_0x838a('0x25')](function(_0x2b5e28){return db['VoiceExtension'][_0x838a('0x94')](createExtensionsReciveFax(_['omit'](_0x1d72d8[_0x838a('0x60')],[_0x838a('0x96'),_0x838a('0x97'),_0x838a('0x98'),_0x838a('0x99'),'TrunkId',_0x838a('0x9a')])),{'transaction':_0x1e044d});});});})[_0x838a('0x25')](function(){return db[_0x838a('0x54')]['findById'](_0x1d72d8[_0x838a('0x60')]['id']);})[_0x838a('0x25')](respondWithResult(_0x28b6ca,null))[_0x838a('0x2c')](handleError(_0x28b6ca,null));};exports[_0x838a('0x9b')]=function(_0x515ec5,_0x2c7ecb,_0x16e6e8){var _0x195fa8={'raw':!![],'where':{}};var _0x2567a0={};var _0x59525c={'count':0x0,'rows':[]};return db[_0x838a('0x54')]['findOne']({'where':{'id':_0x515ec5[_0x838a('0x57')]['id']}})[_0x838a('0x25')](handleEntityNotFound(_0x2c7ecb,null))['then'](function(_0x2fd590){if(_0x2fd590){_0x2567a0[_0x838a('0x44')]=_[_0x838a('0x46')](db[_0x838a('0x9c')][_0x838a('0x41')]);_0x2567a0[_0x838a('0x45')]=_['keys'](_0x515ec5['query']);_0x2567a0[_0x838a('0x47')]=_[_0x838a('0x48')](_0x2567a0[_0x838a('0x44')],_0x2567a0[_0x838a('0x45')]);_0x195fa8['attributes']=_['intersection'](_0x2567a0[_0x838a('0x44')],qs[_0x838a('0x49')](_0x515ec5[_0x838a('0x45')][_0x838a('0x49')]));_0x195fa8[_0x838a('0x4a')]=_0x195fa8['attributes']['length']?_0x195fa8['attributes']:_0x2567a0[_0x838a('0x44')];if(!_0x515ec5[_0x838a('0x45')][_0x838a('0x6c')](_0x838a('0x4c'))){_0x195fa8[_0x838a('0x31')]=qs[_0x838a('0x31')](_0x515ec5[_0x838a('0x45')][_0x838a('0x31')]);_0x195fa8[_0x838a('0x30')]=qs[_0x838a('0x30')](_0x515ec5[_0x838a('0x45')]['offset']);}_0x195fa8[_0x838a('0x67')]=qs[_0x838a('0x4d')](_0x515ec5[_0x838a('0x45')][_0x838a('0x4d')]);_0x195fa8[_0x838a('0x4e')]=qs['filters'](_['pick'](_0x515ec5[_0x838a('0x45')],_0x2567a0[_0x838a('0x47')]));_0x195fa8[_0x838a('0x4e')][_0x838a('0x64')]=_0x2fd590['id'];if(_0x515ec5[_0x838a('0x45')][_0x838a('0x4f')]){_0x195fa8[_0x838a('0x4e')]=_[_0x838a('0x50')](_0x195fa8[_0x838a('0x4e')],{'$or':_[_0x838a('0x40')](_0x195fa8[_0x838a('0x4a')],function(_0x58b4b0){var _0xe957bd={};_0xe957bd[_0x58b4b0]={'$like':'%'+_0x515ec5[_0x838a('0x45')][_0x838a('0x4f')]+'%'};return _0xe957bd;})});}if(_0x515ec5[_0x838a('0x45')]['$gte']){var _0x384344=_0x515ec5[_0x838a('0x45')][_0x838a('0x9d')][_0x838a('0x9e')](',');var _0x42b5b3={};_0x42b5b3[_0x384344[0x0]]={'$gte':moment(_0x384344[0x1])['format'](_0x838a('0x9f'))};_0x195fa8[_0x838a('0x4e')]=_[_0x838a('0x50')](_0x195fa8['where'],_0x42b5b3);}_0x195fa8=_['merge']({},_0x195fa8,_0x515ec5[_0x838a('0x51')]);return db['FaxMessage']['count']({'where':_0x195fa8[_0x838a('0x4e')]})[_0x838a('0x25')](function(_0x3f2720){_0x59525c[_0x838a('0x2f')]=_0x3f2720;if(_0x515ec5['query']['includeAll']){_0x195fa8['include']=[{'all':!![]}];}return db['FaxMessage'][_0x838a('0x55')](_0x195fa8);})[_0x838a('0x25')](function(_0x5ac6c9){_0x59525c[_0x838a('0x56')]=_0x5ac6c9;return _0x59525c;});}})[_0x838a('0x25')](respondWithFilteredResult(_0x2c7ecb,_0x195fa8))[_0x838a('0x2c')](handleError(_0x2c7ecb,null));};exports[_0x838a('0x3c')]=function(_0x249b35,_0x11e716,_0x45f784){var _0x5893ca,_0x31ba9b={},_0x2fe22c;if(_0x249b35[_0x838a('0x60')]['to']){_0x2fe22c=_0x249b35[_0x838a('0x60')]['to'][0x0];}return db['FaxAccount'][_0x838a('0x63')]({'where':{'id':_0x249b35[_0x838a('0x57')]['id']},'include':[{'model':db[_0x838a('0xa0')],'as':_0x838a('0xa1'),'include':[{'model':db[_0x838a('0x71')],'as':_0x838a('0xa2'),'where':{'fax':_0x2fe22c},'limit':0x1,'order':[[_0x838a('0x99'),_0x838a('0xa3')]]}]}]})[_0x838a('0x25')](handleEntityNotFound(_0x11e716,null))[_0x838a('0x25')](function(_0x4449e3){_0x5893ca=_0x4449e3;if(_0x249b35['body'][_0x838a('0xa4')]&&_0x249b35[_0x838a('0x60')][_0x838a('0xa4')][_0x838a('0x4b')]){for(var _0x4f1701=0x0;_0x4f1701<_0x249b35['body']['attachments'][_0x838a('0x4b')];_0x4f1701+=0x1){_0x249b35[_0x838a('0x60')][_0x838a('0xa4')][_0x4f1701]={'filename':_0x249b35[_0x838a('0x60')]['attachments'][_0x4f1701]['name'],'id':_0x249b35[_0x838a('0x60')][_0x838a('0xa4')][_0x4f1701]['id'],'path':path[_0x838a('0xa5')](config[_0x838a('0xa6')],'server/files/attachments',_0x249b35[_0x838a('0x60')][_0x838a('0xa4')][_0x4f1701][_0x838a('0xa7')])};}}return respondWithRpcPromise(_0x838a('0xa8'),'CheckAfterSend',{'FaxAccountId':_[_0x838a('0xa9')](_0x249b35[_0x838a('0x57')]['id'])?undefined:_0x249b35[_0x838a('0x57')]['id'],'path':_[_0x838a('0xa9')](_0x249b35[_0x838a('0x60')][_0x838a('0xa4')][0x0][_0x838a('0x7')])?undefined:_0x249b35[_0x838a('0x60')]['attachments'][0x0]['path'],'fax':_[_0x838a('0xa9')](_0x249b35[_0x838a('0x60')]['to'][0x0])?undefined:_0x249b35[_0x838a('0x60')]['to'][0x0]},client9002);})[_0x838a('0x25')](function(){if(_0x5893ca){if(_[_0x838a('0xa9')](_0x249b35[_0x838a('0x60')][_0x838a('0xaa')])){_0x249b35[_0x838a('0x60')][_0x838a('0xaa')]=util[_0x838a('0xab')](_0x838a('0xac'),_0x5893ca[_0x838a('0x3b')],_0x5893ca[_0x838a('0xad')]);}if(_0x5893ca['List']){if(_0x5893ca[_0x838a('0xa1')][_0x838a('0xa2')][_0x838a('0x4b')]){return _0x5893ca[_0x838a('0xa1')][_0x838a('0xa2')][0x0];}else{return db[_0x838a('0x71')]['create'](_['defaults'](_0x249b35[_0x838a('0x60')],{'firstName':_0x249b35[_0x838a('0x60')]['to'][0x0],'phone':_0x249b35[_0x838a('0x60')]['to'][0x0],'fax':_0x249b35[_0x838a('0x60')]['to'][0x0],'ListId':_0x5893ca[_0x838a('0x9a')]}));}}else{throw new Error(_0x838a('0xae'));}}else{throw new Error(_0x838a('0xaf'));}})['then'](function(_0x131aff){if(_0x131aff){return db[_0x838a('0x6f')]['find']({'where':{'ContactId':_0x131aff['id'],'closed':![],'FaxAccountId':_0x5893ca['id']}})[_0x838a('0x25')](function(_0x25528c){if(_0x25528c){return[_0x25528c,![]];}return db[_0x838a('0x6f')][_0x838a('0x58')]({'UserId':_0x249b35[_0x838a('0x5b')]['id'],'ContactId':_0x131aff['id'],'FaxAccountId':_0x5893ca['id'],'fax':_0x249b35[_0x838a('0x60')]['to'][0x0],'firstMsgDirection':_0x838a('0xb0'),'Messages':[_[_0x838a('0x50')](_0x249b35[_0x838a('0x60')],{'read':![],'body':_0x249b35[_0x838a('0x60')][_0x838a('0xa4')][0x0][_0x838a('0xb1')],'FaxAccountId':_0x5893ca['id'],'UserId':_0x249b35[_0x838a('0x5b')]['id'],'ContactId':_0x131aff['id'],'AttachmentId':_0x249b35[_0x838a('0x60')][_0x838a('0xa4')][0x0]['id']})]},{'include':[{'model':db[_0x838a('0x9c')],'as':_0x838a('0xb2')}]})[_0x838a('0x25')](function(_0x264b76){return[_0x264b76,!![]];});});}else{throw new Error(_0x838a('0xb3'));}})['spread'](function(_0x4a7b61,_0xd70555){if(_0xd70555){return _0x4a7b61;}return db[_0x838a('0x9c')][_0x838a('0x58')]({'direction':_0x838a('0xb0'),'read':![],'body':_0x249b35[_0x838a('0x60')][_0x838a('0xa4')][0x0]['filename'],'FaxAccountId':_0x5893ca['id'],'FaxInteractionId':_0x4a7b61['id'],'UserId':_0x249b35[_0x838a('0x5b')]['id'],'ContactId':_0x4a7b61['ContactId'],'AttachmentId':_0x249b35[_0x838a('0x60')][_0x838a('0xa4')][0x0]['id']})['then'](function(_0x332700){_0x4a7b61['dataValues'][_0x838a('0xb2')]=[];_0x4a7b61[_0x838a('0xb4')]['Messages'][_0x838a('0x84')](_0x332700['dataValues']);return _0x4a7b61;});})[_0x838a('0x25')](function(_0x31fd88){respondWithRpcPromise(_0x838a('0xb5'),'SendFax',{'FaxAccountId':_[_0x838a('0xa9')](_0x249b35[_0x838a('0x57')]['id'])?undefined:_0x249b35[_0x838a('0x57')]['id'],'path':_[_0x838a('0xa9')](_0x249b35[_0x838a('0x60')][_0x838a('0xa4')][0x0]['path'])?undefined:_0x249b35[_0x838a('0x60')][_0x838a('0xa4')][0x0][_0x838a('0x7')],'fax':_[_0x838a('0xa9')](_0x249b35['body']['to'][0x0])?undefined:_0x249b35[_0x838a('0x60')]['to'][0x0],'AttachmentId':_0x249b35[_0x838a('0x60')][_0x838a('0xa4')][0x0]['id']},client9002)[_0x838a('0x25')](function(_0x108e1d){logger['info']('SendFaxRpc,\x20%s',_0x108e1d);})['catch'](function(_0x3cc2ed){logger[_0x838a('0xb6')](_0x838a('0xb7'),_0x3cc2ed);});return _0x31fd88;})[_0x838a('0x25')](respondWithResult(_0x11e716,null))[_0x838a('0x2c')](handleError(_0x11e716,null));};exports[_0x838a('0xb8')]=function(_0x3fc361,_0x3aca37,_0x2125d8){return db['FaxAccount'][_0x838a('0x63')]({'where':{'id':_0x3fc361['params']['id']}})[_0x838a('0x25')](handleEntityNotFound(_0x3aca37,null))['then'](function(_0x725723){if(_0x725723){return _0x725723[_0x838a('0xb8')](_0x3fc361[_0x838a('0x60')]['ids'],_['omit'](_0x3fc361[_0x838a('0x60')],[_0x838a('0x6a'),'id'])||{})['spread'](function(_0x118603){for(var _0x52c2c4=0x0;_0x52c2c4<_0x3fc361[_0x838a('0x60')][_0x838a('0x6a')]['length'];_0x52c2c4+=0x1){socket[_0x838a('0xb9')](_0x838a('0xba'),{'UserId':_0x3fc361['body'][_0x838a('0x6a')][_0x52c2c4],'FaxAccountId':_0x3fc361[_0x838a('0x57')]['id']});}return _0x118603;});}})['then'](respondWithResult(_0x3aca37,null))['catch'](handleError(_0x3aca37,null));};exports['removeAgents']=function(_0x54e421,_0x2990ef,_0x2cc53e){return db[_0x838a('0x54')][_0x838a('0x63')]({'where':{'id':_0x54e421[_0x838a('0x57')]['id']}})[_0x838a('0x25')](handleEntityNotFound(_0x2990ef,null))['then'](function(_0x29ae21){if(_0x29ae21){return _0x29ae21[_0x838a('0xbb')](_0x54e421[_0x838a('0x45')][_0x838a('0x6a')])['then'](function(){if(_[_0x838a('0xbc')](_0x54e421['query'][_0x838a('0x6a')])){for(var _0x41ee99=0x0;_0x41ee99<_0x54e421['query'][_0x838a('0x6a')]['length'];_0x41ee99+=0x1){socket[_0x838a('0xb9')]('userFaxAccount:remove',{'UserId':Number(_0x54e421[_0x838a('0x45')][_0x838a('0x6a')][_0x41ee99]),'FaxAccountId':Number(_0x54e421[_0x838a('0x57')]['id'])});}}else{socket[_0x838a('0xb9')](_0x838a('0xbd'),{'UserId':Number(_0x54e421['query']['ids']),'FaxAccountId':Number(_0x54e421[_0x838a('0x57')]['id'])});}});}})[_0x838a('0x25')](respondWithStatusCode(_0x2990ef,null))[_0x838a('0x2c')](handleError(_0x2990ef,null));};exports[_0x838a('0xbe')]=function(_0x290b19,_0x1256a3,_0x25f518){var _0x4b2e60={};var _0x58d89f={};var _0xdc0909;var _0x2dd67a;return db[_0x838a('0x54')][_0x838a('0x66')]({'where':{'id':_0x290b19[_0x838a('0x57')]['id']}})[_0x838a('0x25')](handleEntityNotFound(_0x1256a3,null))[_0x838a('0x25')](function(_0x43cc14){if(_0x43cc14){_0xdc0909=_0x43cc14;_0x58d89f[_0x838a('0x44')]=_['keys'](db['User']['rawAttributes']);_0x58d89f[_0x838a('0x45')]=_[_0x838a('0x46')](_0x290b19[_0x838a('0x45')]);_0x58d89f['filters']=_['intersection'](_0x58d89f[_0x838a('0x44')],_0x58d89f[_0x838a('0x45')]);_0x4b2e60['attributes']=_['intersection'](_0x58d89f[_0x838a('0x44')],qs['fields'](_0x290b19[_0x838a('0x45')][_0x838a('0x49')]));_0x4b2e60[_0x838a('0x4a')]=_0x4b2e60['attributes'][_0x838a('0x4b')]?_0x4b2e60[_0x838a('0x4a')]:_0x58d89f[_0x838a('0x44')];_0x4b2e60['order']=qs[_0x838a('0x4d')](_0x290b19[_0x838a('0x45')][_0x838a('0x4d')]);_0x4b2e60[_0x838a('0x4e')]=qs[_0x838a('0x47')](_['pick'](_0x290b19[_0x838a('0x45')],_0x58d89f[_0x838a('0x47')]));if(_0x290b19[_0x838a('0x45')]['filter']){_0x4b2e60[_0x838a('0x4e')]=_['merge'](_0x4b2e60[_0x838a('0x4e')],{'$or':_['map'](_0x4b2e60[_0x838a('0x4a')],function(_0x782953){var _0x3c2d77={};_0x3c2d77[_0x782953]={'$like':'%'+_0x290b19[_0x838a('0x45')][_0x838a('0x4f')]+'%'};return _0x3c2d77;})});}_0x4b2e60=_[_0x838a('0x50')]({},_0x4b2e60,_0x290b19[_0x838a('0x51')]);return _0xdc0909[_0x838a('0xbe')](_0x4b2e60);}})[_0x838a('0x25')](function(_0x42f9f0){if(_0x42f9f0){_0x2dd67a=_0x42f9f0[_0x838a('0x4b')];if(!_0x290b19[_0x838a('0x45')][_0x838a('0x6c')]('nolimit')){_0x4b2e60[_0x838a('0x31')]=qs[_0x838a('0x31')](_0x290b19[_0x838a('0x45')][_0x838a('0x31')]);_0x4b2e60[_0x838a('0x30')]=qs[_0x838a('0x30')](_0x290b19[_0x838a('0x45')]['offset']);}return _0xdc0909[_0x838a('0xbe')](_0x4b2e60);}})[_0x838a('0x25')](function(_0xbcdbf1){if(_0xbcdbf1){return _0xbcdbf1?{'count':_0x2dd67a,'rows':_0xbcdbf1}:null;}})[_0x838a('0x25')](respondWithResult(_0x1256a3,null))[_0x838a('0x2c')](handleError(_0x1256a3,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 9c690be..46a7ac6 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 _0x3620=['save','update','emit','hasOwnProperty','hook','exports','events','setMaxListeners'];(function(_0xfe575e,_0x577879){var _0x16eba1=function(_0x76c5a0){while(--_0x76c5a0){_0xfe575e['push'](_0xfe575e['shift']());}};_0x16eba1(++_0x577879);}(_0x3620,0x13e));var _0x0362=function(_0x2e14b2,_0x275f09){_0x2e14b2=_0x2e14b2-0x0;var _0x484a05=_0x3620[_0x2e14b2];return _0x484a05;};'use strict';var EventEmitter=require(_0x0362('0x0'));var FaxAccount=require('../../mysqldb')['db']['FaxAccount'];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x0362('0x1')](0x0);var events={'afterCreate':_0x0362('0x2'),'afterUpdate':_0x0362('0x3'),'afterDestroy':'remove'};function emitEvent(_0x224ad7){return function(_0x40c925,_0x24d6ba,_0x442f48){FaxAccountEvents[_0x0362('0x4')](_0x224ad7+':'+_0x40c925['id'],_0x40c925);FaxAccountEvents['emit'](_0x224ad7,_0x40c925);_0x442f48(null);};}for(var e in events){if(events[_0x0362('0x5')](e)){var event=events[e];FaxAccount[_0x0362('0x6')](e,emitEvent(event));}}module[_0x0362('0x7')]=FaxAccountEvents; \ No newline at end of file +var _0x5c38=['exports','../../mysqldb','FaxAccount','setMaxListeners','save','remove','emit','hook'];(function(_0x1aaa09,_0xb45040){var _0x7b302c=function(_0x1bd433){while(--_0x1bd433){_0x1aaa09['push'](_0x1aaa09['shift']());}};_0x7b302c(++_0xb45040);}(_0x5c38,0x189));var _0x85c3=function(_0x1d5733,_0xc2266c){_0x1d5733=_0x1d5733-0x0;var _0x441e76=_0x5c38[_0x1d5733];return _0x441e76;};'use strict';var EventEmitter=require('events');var FaxAccount=require(_0x85c3('0x0'))['db'][_0x85c3('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x85c3('0x2')](0x0);var events={'afterCreate':_0x85c3('0x3'),'afterUpdate':'update','afterDestroy':_0x85c3('0x4')};function emitEvent(_0x14a809){return function(_0xe24d83,_0x2379d4,_0x4617b6){FaxAccountEvents[_0x85c3('0x5')](_0x14a809+':'+_0xe24d83['id'],_0xe24d83);FaxAccountEvents[_0x85c3('0x5')](_0x14a809,_0xe24d83);_0x4617b6(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxAccount[_0x85c3('0x6')](e,emitEvent(event));}}module[_0x85c3('0x7')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index 7375796..5fa63ab 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 _0xb4c1=['moment','bluebird','path','../../config/environment','./faxAccount.attributes','exports','define','fax_accounts','lodash','util','../../config/logger'];(function(_0x3ac219,_0x426e1c){var _0x118273=function(_0x16c018){while(--_0x16c018){_0x3ac219['push'](_0x3ac219['shift']());}};_0x118273(++_0x426e1c);}(_0xb4c1,0x126));var _0x1b4c=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0xb4c1[_0x5d6456];return _0x4d66c1;};'use strict';var _=require(_0x1b4c('0x0'));var util=require(_0x1b4c('0x1'));var logger=require(_0x1b4c('0x2'))('api');var moment=require(_0x1b4c('0x3'));var BPromise=require(_0x1b4c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1b4c('0x5'));var rimraf=require('rimraf');var config=require(_0x1b4c('0x6'));var attributes=require(_0x1b4c('0x7'));module[_0x1b4c('0x8')]=function(_0x80d720,_0x3bded4){return _0x80d720[_0x1b4c('0x9')]('FaxAccount',attributes,{'tableName':_0x1b4c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa319=['define','FaxAccount','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./faxAccount.attributes'];(function(_0x27d400,_0x2f47ad){var _0x3e0728=function(_0x426a27){while(--_0x426a27){_0x27d400['push'](_0x27d400['shift']());}};_0x3e0728(++_0x2f47ad);}(_0xa319,0x1ca));var _0x9a31=function(_0xfae54f,_0x4aad21){_0xfae54f=_0xfae54f-0x0;var _0x57c03a=_0xa319[_0xfae54f];return _0x57c03a;};'use strict';var _=require(_0x9a31('0x0'));var util=require(_0x9a31('0x1'));var logger=require(_0x9a31('0x2'))(_0x9a31('0x3'));var moment=require(_0x9a31('0x4'));var BPromise=require(_0x9a31('0x5'));var rp=require(_0x9a31('0x6'));var fs=require('fs');var path=require(_0x9a31('0x7'));var rimraf=require(_0x9a31('0x8'));var config=require('../../config/environment');var attributes=require(_0x9a31('0x9'));module['exports']=function(_0x23befc,_0x4592c8){return _0x23befc[_0x9a31('0xa')](_0x9a31('0xb'),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 5d94aa6..95a05a7 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 _0xb1fc=['isNil','from\x20is\x20mandatory','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','find','account','CmList','List','DESC','FaxApplication','Applications','get','applications','list','priority','asc','Contacts','length','create','contact','FaxInteraction','Contact\x20not\x20found','spread','push','close','created','interaction','FaxMessage','AttachmentId','name','UserId','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','catch','lodash','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','redis','socket.io-emitter','register','then','info','request\x20sent','FaxAccount,\x20%s,\x20%s,\x20%s','error','code','FaxAccount,\x20%s,\x20%s','message','result','GetFaxAccount','FaxAccount','findAll','options','attributes','include','map','model','debug','stringify','NotifyFaxAccount','fax','CmContact','describe','Sequelize','ValidationError','difference','keys','createdAt','updatedAt','CompanyId','body'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xb1fc,0x78));var _0xcb1f=function(_0x40c2c9,_0x22d19a){_0x40c2c9=_0x40c2c9-0x0;var _0x5c13c5=_0xb1fc[_0x40c2c9];return _0x5c13c5;};'use strict';var _=require(_0xcb1f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xcb1f('0x1'));var fs=require('fs');var Redis=require(_0xcb1f('0x2'));var db=require(_0xcb1f('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xcb1f('0x4'))(_0xcb1f('0x5'));var config=require(_0xcb1f('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0xcb1f('0x7')]({'port':0x232c});config[_0xcb1f('0x8')]=_['defaults'](config[_0xcb1f('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0xcb1f('0x9'))(new Redis(config[_0xcb1f('0x8')]));require('./faxAccount.socket')[_0xcb1f('0xa')](socket);function respondWithRpcPromise(_0xd5ad2a,_0x1cd0e7,_0x4f3254){return new BPromise(function(_0x52457a,_0x426e7e){return client['request'](_0xd5ad2a,_0x4f3254)[_0xcb1f('0xb')](function(_0x1d5660){logger[_0xcb1f('0xc')]('FaxAccount,\x20%s,\x20%s',_0x1cd0e7,_0xcb1f('0xd'));logger['debug'](_0xcb1f('0xe'),_0x1cd0e7,_0xcb1f('0xd'),JSON['stringify'](_0x1d5660));if(_0x1d5660[_0xcb1f('0xf')]){if(_0x1d5660[_0xcb1f('0xf')][_0xcb1f('0x10')]===0x1f4){logger[_0xcb1f('0xf')](_0xcb1f('0x11'),_0x1cd0e7,_0x1d5660[_0xcb1f('0xf')][_0xcb1f('0x12')]);return _0x426e7e(_0x1d5660[_0xcb1f('0xf')][_0xcb1f('0x12')]);}logger[_0xcb1f('0xf')](_0xcb1f('0x11'),_0x1cd0e7,_0x1d5660['error'][_0xcb1f('0x12')]);return _0x52457a(_0x1d5660[_0xcb1f('0xf')][_0xcb1f('0x12')]);}else{logger['info'](_0xcb1f('0x11'),_0x1cd0e7,_0xcb1f('0xd'));_0x52457a(_0x1d5660[_0xcb1f('0x13')][_0xcb1f('0x12')]);}})['catch'](function(_0x44cf6f){logger['error'](_0xcb1f('0x11'),_0x1cd0e7,_0x44cf6f);_0x426e7e(_0x44cf6f);});});}exports[_0xcb1f('0x14')]=function(_0xf78f4f){var _0x241c62=this;return new Promise(function(_0x53bfd9,_0x3d8744){return db[_0xcb1f('0x15')][_0xcb1f('0x16')]({'raw':_0xf78f4f['options']?_0xf78f4f['options']['raw']===undefined?!![]:![]:!![],'where':_0xf78f4f[_0xcb1f('0x17')]?_0xf78f4f[_0xcb1f('0x17')]['where']||null:null,'attributes':_0xf78f4f[_0xcb1f('0x17')]?_0xf78f4f[_0xcb1f('0x17')][_0xcb1f('0x18')]||null:null,'limit':_0xf78f4f[_0xcb1f('0x17')]?_0xf78f4f[_0xcb1f('0x17')]['limit']||null:null,'include':_0xf78f4f['options']?_0xf78f4f[_0xcb1f('0x17')][_0xcb1f('0x19')]?_[_0xcb1f('0x1a')](_0xf78f4f[_0xcb1f('0x17')][_0xcb1f('0x19')],function(_0x15b4a6){return{'model':db[_0x15b4a6['model']],'as':_0x15b4a6['as'],'attributes':_0x15b4a6['attributes'],'include':_0x15b4a6[_0xcb1f('0x19')]?_[_0xcb1f('0x1a')](_0x15b4a6[_0xcb1f('0x19')],function(_0x1fb089){return{'model':db[_0x1fb089['model']],'as':_0x1fb089['as'],'attributes':_0x1fb089[_0xcb1f('0x18')],'include':_0x1fb089['include']?_[_0xcb1f('0x1a')](_0x1fb089['include'],function(_0x5a36fd){return{'model':db[_0x5a36fd[_0xcb1f('0x1b')]],'as':_0x5a36fd['as'],'attributes':_0x5a36fd['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4726c4){logger['info'](_0xcb1f('0x14'),_0xf78f4f);logger[_0xcb1f('0x1c')](_0xcb1f('0x14'),_0xf78f4f,JSON[_0xcb1f('0x1d')](_0x4726c4));_0x53bfd9(_0x4726c4);})['catch'](function(_0x2ec557){logger[_0xcb1f('0xf')](_0xcb1f('0x14'),_0x2ec557['message'],_0xf78f4f);_0x3d8744(_0x241c62[_0xcb1f('0xf')](0x1f4,_0x2ec557[_0xcb1f('0x12')]));});});};exports[_0xcb1f('0x1e')]=function(_0x2027c8,_0x59531e,_0x8973a){var _0x3d144f=this;return new Promise(function(_0x4e0afe,_0x53d8b0){var _0x42db83={'body':_0x2027c8['body'],'channel':_0xcb1f('0x1f')};var _0x55c029=[];var _0x25a99e=[];var _0x316999={};return db[_0xcb1f('0x20')][_0xcb1f('0x21')]()['then'](function(_0x26d487){if(!_0x26d487){throw new db[(_0xcb1f('0x22'))][(_0xcb1f('0x23'))]('no\x20available\x20attributes');}_0x55c029=_[_0xcb1f('0x24')](_[_0xcb1f('0x25')](_0x26d487),[_0xcb1f('0x26'),_0xcb1f('0x27')]);_0x25a99e=_[_0xcb1f('0x24')](_[_0xcb1f('0x25')](_0x26d487),[_0xcb1f('0x26'),_0xcb1f('0x27'),_0xcb1f('0x28'),'ListId']);if(_0x2027c8[_0xcb1f('0x29')]['id']){delete _0x2027c8[_0xcb1f('0x29')]['id'];}if(_[_0xcb1f('0x2a')](_0x2027c8[_0xcb1f('0x29')]['from'])){throw new db['Sequelize'][(_0xcb1f('0x23'))](_0xcb1f('0x2b'));}if(_[_0xcb1f('0x2a')](_0x2027c8[_0xcb1f('0x29')][_0xcb1f('0x29')])||_0x2027c8[_0xcb1f('0x29')]['body']===''){throw new db['Sequelize'][(_0xcb1f('0x23'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xcb1f('0x2a')](_0x2027c8[_0xcb1f('0x29')]['mapKey'])){throw new db[(_0xcb1f('0x22'))][(_0xcb1f('0x23'))](_0xcb1f('0x2c')+_0x25a99e);}if(!_[_0xcb1f('0x2d')](_0x25a99e,_0x2027c8[_0xcb1f('0x29')][_0xcb1f('0x2e')])){throw new db[(_0xcb1f('0x22'))][(_0xcb1f('0x23'))](_0xcb1f('0x2f')+_0x25a99e);}_0x316999[_0x2027c8[_0xcb1f('0x29')][_0xcb1f('0x2e')]]=_0x2027c8[_0xcb1f('0x29')][_0xcb1f('0x30')];})[_0xcb1f('0xb')](function(){return db[_0xcb1f('0x15')][_0xcb1f('0x31')]({'where':{'id':_0x2027c8[_0xcb1f('0x32')]['id']},'include':[{'model':db[_0xcb1f('0x33')],'as':_0xcb1f('0x34'),'include':[{'model':db[_0xcb1f('0x20')],'as':'Contacts','where':_0x316999,'limit':0x1,'order':[['updatedAt',_0xcb1f('0x35')]]}]},{'model':db[_0xcb1f('0x36')],'as':_0xcb1f('0x37')}]});})[_0xcb1f('0xb')](function(_0x52da4b){if(_0x52da4b&&_0x52da4b[_0xcb1f('0x34')]){var _0x55fc25=_0x52da4b[_0xcb1f('0x38')]({'plain':!![]});_0x42db83[_0xcb1f('0x32')]=_0x55fc25;_0x42db83[_0xcb1f('0x39')]=_0x55fc25['Applications'];_0x42db83[_0xcb1f('0x3a')]=_0x55fc25['List'];_0x42db83[_0xcb1f('0x39')]=_['orderBy'](_0x42db83[_0xcb1f('0x39')],[_0xcb1f('0x3b')],[_0xcb1f('0x3c')]);if(_0x42db83[_0xcb1f('0x32')][_0xcb1f('0x37')]){delete _0x42db83['account'][_0xcb1f('0x37')];}if(_0x42db83[_0xcb1f('0x32')][_0xcb1f('0x34')]&&_0x42db83[_0xcb1f('0x32')][_0xcb1f('0x34')][_0xcb1f('0x3d')][_0xcb1f('0x3e')]){return _0x42db83[_0xcb1f('0x32')][_0xcb1f('0x34')]['Contacts'][0x0];}var _0x3b7484=_['defaults'](_0x2027c8[_0xcb1f('0x29')],{'firstName':_0x2027c8[_0xcb1f('0x29')][_0xcb1f('0x30')],'ListId':_0x55fc25['ListId']});_0x3b7484[_0x2027c8[_0xcb1f('0x29')][_0xcb1f('0x2e')]]=_0x2027c8[_0xcb1f('0x29')][_0xcb1f('0x30')];return db['CmContact'][_0xcb1f('0x3f')](_0x3b7484,{'fields':_0x55c029,'raw':!![]});}})[_0xcb1f('0xb')](function(_0xaacb32){_0x42db83[_0xcb1f('0x40')]=_0xaacb32;if(_0xaacb32){var _0x42b734={'ContactId':_0xaacb32['id'],'FaxAccountId':_0x2027c8[_0xcb1f('0x32')]['id'],'fax':_0xaacb32['fax']};return db[_0xcb1f('0x41')]['find']({'where':{'ContactId':_0xaacb32['id'],'closed':![],'FaxAccountId':_0x2027c8[_0xcb1f('0x32')]['id']}})['then'](function(_0x318a10){if(_0x318a10){return[_0x318a10,![]];}return db[_0xcb1f('0x41')]['create'](_0x42b734)[_0xcb1f('0xb')](function(_0x189783){return[_0x189783,!![]];});});}else{throw new Error(_0xcb1f('0x42'));}})[_0xcb1f('0x43')](function(_0x5a3a79,_0x3c908e){var _0x17751c=_0x5a3a79[_0xcb1f('0x38')]({'plain':!![]});if(_0x3c908e){if(_0x42db83[_0xcb1f('0x32')]['autoclose']){_0x42db83[_0xcb1f('0x39')][_0xcb1f('0x44')]({'id':0x0,'priority':_0x42db83[_0xcb1f('0x39')][_0xcb1f('0x3e')]+0x1,'app':_0xcb1f('0x45'),'appdata':'unmanaged','interval':'*,*,*,*'});}_0x17751c['created']=!![];}else{_0x17751c[_0xcb1f('0x46')]=![];}_0x42db83[_0xcb1f('0x47')]=_0x17751c;return db[_0xcb1f('0x48')]['create']({'body':_0x2027c8['body'][_0xcb1f('0x29')],'FaxAccountId':_0x2027c8[_0xcb1f('0x32')]['id'],'FaxInteractionId':_0x5a3a79['id'],'direction':'in','ContactId':_0x5a3a79['ContactId'],'AttachmentId':_0x2027c8[_0xcb1f('0x29')][_0xcb1f('0x49')]});})['then'](function(_0xd2383c){_0x42db83[_0xcb1f('0x12')]=_0xd2383c;if(_0x42db83['interaction']['UserId']){return db['User'][_0xcb1f('0x31')]({'attributes':['id',_0xcb1f('0x4a')],'where':{'id':_0x42db83[_0xcb1f('0x47')][_0xcb1f('0x4b')]}})[_0xcb1f('0xb')](function(_0xeb512d){if(_0xeb512d){_0x42db83[_0xcb1f('0x39')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0xeb512d[_0xcb1f('0x4a')]+','+(_0x42db83['account'][_0xcb1f('0x4c')]||0xa),'interval':_0xcb1f('0x4d')});}return respondWithRpcPromise(_0xcb1f('0x4e'),_0xcb1f('0x4f'),_0x42db83);});}return respondWithRpcPromise(_0xcb1f('0x4e'),_0xcb1f('0x4f'),_0x42db83);})['then'](function(_0x1692d8){_0x4e0afe(_0x1692d8);})[_0xcb1f('0x50')](function(_0x1f40ba){_0x53d8b0(_0x3d144f[_0xcb1f('0xf')](0x1f4,_0x1f40ba[_0xcb1f('0x12')]));});});}; \ No newline at end of file +var _0x1ab8=['defaults','ListId','CmContact','contact','FaxInteraction','create','spread','close','unmanaged','*,*,*,*','created','interaction','FaxMessage','ContactId','AttachmentId','UserId','name','unshift','agent','waitForTheAssignedAgent','Start','startRouting','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./faxAccount.socket','register','request','info','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','error','code','FaxAccount,\x20%s,\x20%s','message','result','GetFaxAccount','FaxAccount','findAll','options','where','limit','map','attributes','include','model','then','catch','fax','describe','Sequelize','ValidationError','keys','createdAt','updatedAt','CompanyId','body','from','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','CmList','List','FaxApplication','Applications','get','list','applications','orderBy','priority','length'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x1ab8,0x11e));var _0x81ab=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x1ab8[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x81ab('0x0'));var util=require(_0x81ab('0x1'));var moment=require('moment');var BPromise=require(_0x81ab('0x2'));var rs=require(_0x81ab('0x3'));var fs=require('fs');var Redis=require(_0x81ab('0x4'));var db=require(_0x81ab('0x5'))['db'];var utils=require(_0x81ab('0x6'));var logger=require(_0x81ab('0x7'))(_0x81ab('0x8'));var config=require(_0x81ab('0x9'));var jayson=require(_0x81ab('0xa'));var client=jayson[_0x81ab('0xb')][_0x81ab('0xc')]({'port':0x232c});config[_0x81ab('0xd')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x81ab('0xe'))(new Redis(config[_0x81ab('0xd')]));require(_0x81ab('0xf'))[_0x81ab('0x10')](socket);function respondWithRpcPromise(_0xac9762,_0x3b8650,_0x43eddd){return new BPromise(function(_0x5d77f0,_0x212f09){return client[_0x81ab('0x11')](_0xac9762,_0x43eddd)['then'](function(_0x474780){logger[_0x81ab('0x12')]('FaxAccount,\x20%s,\x20%s',_0x3b8650,_0x81ab('0x13'));logger[_0x81ab('0x14')](_0x81ab('0x15'),_0x3b8650,'request\x20sent',JSON['stringify'](_0x474780));if(_0x474780[_0x81ab('0x16')]){if(_0x474780[_0x81ab('0x16')][_0x81ab('0x17')]===0x1f4){logger[_0x81ab('0x16')](_0x81ab('0x18'),_0x3b8650,_0x474780[_0x81ab('0x16')][_0x81ab('0x19')]);return _0x212f09(_0x474780[_0x81ab('0x16')][_0x81ab('0x19')]);}logger[_0x81ab('0x16')](_0x81ab('0x18'),_0x3b8650,_0x474780[_0x81ab('0x16')][_0x81ab('0x19')]);return _0x5d77f0(_0x474780[_0x81ab('0x16')][_0x81ab('0x19')]);}else{logger['info']('FaxAccount,\x20%s,\x20%s',_0x3b8650,_0x81ab('0x13'));_0x5d77f0(_0x474780[_0x81ab('0x1a')][_0x81ab('0x19')]);}})['catch'](function(_0x3749de){logger[_0x81ab('0x16')](_0x81ab('0x18'),_0x3b8650,_0x3749de);_0x212f09(_0x3749de);});});}exports[_0x81ab('0x1b')]=function(_0x23deb9){var _0x344347=this;return new Promise(function(_0x3c5a05,_0x2faf23){return db[_0x81ab('0x1c')][_0x81ab('0x1d')]({'raw':_0x23deb9[_0x81ab('0x1e')]?_0x23deb9[_0x81ab('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x23deb9['options']?_0x23deb9[_0x81ab('0x1e')][_0x81ab('0x1f')]||null:null,'attributes':_0x23deb9[_0x81ab('0x1e')]?_0x23deb9[_0x81ab('0x1e')]['attributes']||null:null,'limit':_0x23deb9[_0x81ab('0x1e')]?_0x23deb9[_0x81ab('0x1e')][_0x81ab('0x20')]||null:null,'include':_0x23deb9[_0x81ab('0x1e')]?_0x23deb9[_0x81ab('0x1e')]['include']?_[_0x81ab('0x21')](_0x23deb9[_0x81ab('0x1e')]['include'],function(_0x3ed3b9){return{'model':db[_0x3ed3b9['model']],'as':_0x3ed3b9['as'],'attributes':_0x3ed3b9[_0x81ab('0x22')],'include':_0x3ed3b9[_0x81ab('0x23')]?_['map'](_0x3ed3b9[_0x81ab('0x23')],function(_0x360a3f){return{'model':db[_0x360a3f[_0x81ab('0x24')]],'as':_0x360a3f['as'],'attributes':_0x360a3f[_0x81ab('0x22')],'include':_0x360a3f[_0x81ab('0x23')]?_[_0x81ab('0x21')](_0x360a3f['include'],function(_0x4534b0){return{'model':db[_0x4534b0[_0x81ab('0x24')]],'as':_0x4534b0['as'],'attributes':_0x4534b0[_0x81ab('0x22')]};}):[]};}):[]};}):[]:[]})[_0x81ab('0x25')](function(_0x3f3888){logger[_0x81ab('0x12')](_0x81ab('0x1b'),_0x23deb9);logger[_0x81ab('0x14')](_0x81ab('0x1b'),_0x23deb9,JSON['stringify'](_0x3f3888));_0x3c5a05(_0x3f3888);})[_0x81ab('0x26')](function(_0x28f399){logger[_0x81ab('0x16')](_0x81ab('0x1b'),_0x28f399[_0x81ab('0x19')],_0x23deb9);_0x2faf23(_0x344347['error'](0x1f4,_0x28f399[_0x81ab('0x19')]));});});};exports['NotifyFaxAccount']=function(_0xa1fc20,_0x1c4313,_0x457465){var _0x5bf4bc=this;return new Promise(function(_0x47b271,_0x43c6c0){var _0x420b14={'body':_0xa1fc20['body'],'channel':_0x81ab('0x27')};var _0x1c1144=[];var _0x48d0b4=[];var _0x5b2b97={};return db['CmContact'][_0x81ab('0x28')]()['then'](function(_0x4e3ae9){if(!_0x4e3ae9){throw new db[(_0x81ab('0x29'))][(_0x81ab('0x2a'))]('no\x20available\x20attributes');}_0x1c1144=_['difference'](_[_0x81ab('0x2b')](_0x4e3ae9),[_0x81ab('0x2c'),_0x81ab('0x2d')]);_0x48d0b4=_['difference'](_['keys'](_0x4e3ae9),[_0x81ab('0x2c'),'updatedAt',_0x81ab('0x2e'),'ListId']);if(_0xa1fc20[_0x81ab('0x2f')]['id']){delete _0xa1fc20[_0x81ab('0x2f')]['id'];}if(_['isNil'](_0xa1fc20['body'][_0x81ab('0x30')])){throw new db['Sequelize'][(_0x81ab('0x2a'))]('from\x20is\x20mandatory');}if(_[_0x81ab('0x31')](_0xa1fc20['body'][_0x81ab('0x2f')])||_0xa1fc20[_0x81ab('0x2f')][_0x81ab('0x2f')]===''){throw new db[(_0x81ab('0x29'))][(_0x81ab('0x2a'))](_0x81ab('0x32'));}if(_[_0x81ab('0x31')](_0xa1fc20[_0x81ab('0x2f')][_0x81ab('0x33')])){throw new db[(_0x81ab('0x29'))]['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x48d0b4);}if(!_[_0x81ab('0x34')](_0x48d0b4,_0xa1fc20[_0x81ab('0x2f')][_0x81ab('0x33')])){throw new db['Sequelize'][(_0x81ab('0x2a'))](_0x81ab('0x35')+_0x48d0b4);}_0x5b2b97[_0xa1fc20[_0x81ab('0x2f')][_0x81ab('0x33')]]=_0xa1fc20[_0x81ab('0x2f')][_0x81ab('0x30')];})[_0x81ab('0x25')](function(){return db['FaxAccount'][_0x81ab('0x36')]({'where':{'id':_0xa1fc20[_0x81ab('0x37')]['id']},'include':[{'model':db[_0x81ab('0x38')],'as':_0x81ab('0x39'),'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x5b2b97,'limit':0x1,'order':[[_0x81ab('0x2d'),'DESC']]}]},{'model':db[_0x81ab('0x3a')],'as':_0x81ab('0x3b')}]});})['then'](function(_0x39700b){if(_0x39700b&&_0x39700b['List']){var _0x3b84fe=_0x39700b[_0x81ab('0x3c')]({'plain':!![]});_0x420b14[_0x81ab('0x37')]=_0x3b84fe;_0x420b14['applications']=_0x3b84fe['Applications'];_0x420b14[_0x81ab('0x3d')]=_0x3b84fe['List'];_0x420b14[_0x81ab('0x3e')]=_[_0x81ab('0x3f')](_0x420b14[_0x81ab('0x3e')],[_0x81ab('0x40')],['asc']);if(_0x420b14[_0x81ab('0x37')]['Applications']){delete _0x420b14['account']['Applications'];}if(_0x420b14[_0x81ab('0x37')][_0x81ab('0x39')]&&_0x420b14[_0x81ab('0x37')]['List']['Contacts'][_0x81ab('0x41')]){return _0x420b14[_0x81ab('0x37')][_0x81ab('0x39')]['Contacts'][0x0];}var _0x122705=_[_0x81ab('0x42')](_0xa1fc20[_0x81ab('0x2f')],{'firstName':_0xa1fc20[_0x81ab('0x2f')][_0x81ab('0x30')],'ListId':_0x3b84fe[_0x81ab('0x43')]});_0x122705[_0xa1fc20[_0x81ab('0x2f')][_0x81ab('0x33')]]=_0xa1fc20[_0x81ab('0x2f')]['from'];return db[_0x81ab('0x44')]['create'](_0x122705,{'fields':_0x1c1144,'raw':!![]});}})[_0x81ab('0x25')](function(_0xab6c0b){_0x420b14[_0x81ab('0x45')]=_0xab6c0b;if(_0xab6c0b){var _0x285a36={'ContactId':_0xab6c0b['id'],'FaxAccountId':_0xa1fc20[_0x81ab('0x37')]['id'],'fax':_0xab6c0b[_0x81ab('0x27')]};return db['FaxInteraction'][_0x81ab('0x36')]({'where':{'ContactId':_0xab6c0b['id'],'closed':![],'FaxAccountId':_0xa1fc20[_0x81ab('0x37')]['id']}})[_0x81ab('0x25')](function(_0x26df77){if(_0x26df77){return[_0x26df77,![]];}return db[_0x81ab('0x46')][_0x81ab('0x47')](_0x285a36)[_0x81ab('0x25')](function(_0x1f866a){return[_0x1f866a,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x81ab('0x48')](function(_0x40fbc0,_0x100721){var _0x698190=_0x40fbc0[_0x81ab('0x3c')]({'plain':!![]});if(_0x100721){if(_0x420b14[_0x81ab('0x37')]['autoclose']){_0x420b14[_0x81ab('0x3e')]['push']({'id':0x0,'priority':_0x420b14[_0x81ab('0x3e')][_0x81ab('0x41')]+0x1,'app':_0x81ab('0x49'),'appdata':_0x81ab('0x4a'),'interval':_0x81ab('0x4b')});}_0x698190[_0x81ab('0x4c')]=!![];}else{_0x698190[_0x81ab('0x4c')]=![];}_0x420b14[_0x81ab('0x4d')]=_0x698190;return db[_0x81ab('0x4e')]['create']({'body':_0xa1fc20['body'][_0x81ab('0x2f')],'FaxAccountId':_0xa1fc20[_0x81ab('0x37')]['id'],'FaxInteractionId':_0x40fbc0['id'],'direction':'in','ContactId':_0x40fbc0[_0x81ab('0x4f')],'AttachmentId':_0xa1fc20[_0x81ab('0x2f')][_0x81ab('0x50')]});})[_0x81ab('0x25')](function(_0x512e21){_0x420b14[_0x81ab('0x19')]=_0x512e21;if(_0x420b14[_0x81ab('0x4d')][_0x81ab('0x51')]){return db['User']['find']({'attributes':['id',_0x81ab('0x52')],'where':{'id':_0x420b14['interaction'][_0x81ab('0x51')]}})['then'](function(_0x3f0ff9){if(_0x3f0ff9){_0x420b14[_0x81ab('0x3e')][_0x81ab('0x53')]({'id':0x0,'priority':0x0,'app':_0x81ab('0x54'),'appdata':_0x3f0ff9[_0x81ab('0x52')]+','+(_0x420b14[_0x81ab('0x37')][_0x81ab('0x55')]||0xa),'interval':_0x81ab('0x4b')});}return respondWithRpcPromise(_0x81ab('0x56'),_0x81ab('0x57'),_0x420b14);});}return respondWithRpcPromise(_0x81ab('0x56'),'startRouting',_0x420b14);})[_0x81ab('0x25')](function(_0x206b41){_0x47b271(_0x206b41);})[_0x81ab('0x26')](function(_0x45f49d){_0x43c6c0(_0x5bf4bc['error'](0x1f4,_0x45f49d[_0x81ab('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 6d40fb8..45070ff 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 _0x7708=['length','faxAccount:','./faxAccount.events','save','update','register'];(function(_0x59f024,_0x3c233a){var _0x528e37=function(_0x163585){while(--_0x163585){_0x59f024['push'](_0x59f024['shift']());}};_0x528e37(++_0x3c233a);}(_0x7708,0x188));var _0x8770=function(_0x5af59e,_0x3771c1){_0x5af59e=_0x5af59e-0x0;var _0x4240df=_0x7708[_0x5af59e];return _0x4240df;};'use strict';var FaxAccountEvents=require(_0x8770('0x0'));var events=[_0x8770('0x1'),'remove',_0x8770('0x2')];function createListener(_0x5a8b5b,_0x5ca46f){return function(_0x555477){_0x5ca46f['emit'](_0x5a8b5b,_0x555477);};}function removeListener(_0x182d52,_0x1a796d){return function(){FaxAccountEvents['removeListener'](_0x182d52,_0x1a796d);};}exports[_0x8770('0x3')]=function(_0x50bab7){for(var _0x31390d=0x0,_0x42d305=events[_0x8770('0x4')];_0x31390d<_0x42d305;_0x31390d++){var _0x20e293=events[_0x31390d];var _0x212b12=createListener(_0x8770('0x5')+_0x20e293,_0x50bab7);FaxAccountEvents['on'](_0x20e293,_0x212b12);}}; \ No newline at end of file +var _0x32b6=['faxAccount:','./faxAccount.events','save','update','emit','removeListener','register','length'];(function(_0x318a67,_0x5284c4){var _0x2c0811=function(_0x2f9804){while(--_0x2f9804){_0x318a67['push'](_0x318a67['shift']());}};_0x2c0811(++_0x5284c4);}(_0x32b6,0x1d1));var _0x632b=function(_0x9b833d,_0x4950cd){_0x9b833d=_0x9b833d-0x0;var _0x4de663=_0x32b6[_0x9b833d];return _0x4de663;};'use strict';var FaxAccountEvents=require(_0x632b('0x0'));var events=[_0x632b('0x1'),'remove',_0x632b('0x2')];function createListener(_0x1d100a,_0x51c210){return function(_0x5ad871){_0x51c210[_0x632b('0x3')](_0x1d100a,_0x5ad871);};}function removeListener(_0x3435e8,_0x3ba3a7){return function(){FaxAccountEvents[_0x632b('0x4')](_0x3435e8,_0x3ba3a7);};}exports[_0x632b('0x5')]=function(_0x122768){for(var _0x24ceab=0x0,_0x10458a=events[_0x632b('0x6')];_0x24ceab<_0x10458a;_0x24ceab++){var _0x43d6c7=events[_0x24ceab];var _0x5128f5=createListener(_0x632b('0x7')+_0x43d6c7,_0x122768);FaxAccountEvents['on'](_0x43d6c7,_0x5128f5);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 0380a52..dd5d986 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 _0xf987=['get','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','/:id/messages','/:id/users','getAgents','post','/:id/interactions','addInteraction','addApplications','/addaccountapplications','/updateaccountapplications','updateAccountApplications','/:id/send','send','update','delete','destroy','removeDispositions','exports','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','isAuthenticated','index'];(function(_0x50e033,_0x391e5d){var _0x40b17e=function(_0x203afd){while(--_0x203afd){_0x50e033['push'](_0x50e033['shift']());}};_0x40b17e(++_0x391e5d);}(_0xf987,0xb4));var _0x7f98=function(_0xc4094d,_0x15121a){_0xc4094d=_0xc4094d-0x0;var _0x5cc355=_0xf987[_0xc4094d];return _0x5cc355;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0x7f98('0x0'));var interaction=require(_0x7f98('0x1'));var config=require(_0x7f98('0x2'));var controller=require(_0x7f98('0x3'));router['get']('/',auth[_0x7f98('0x4')](),controller[_0x7f98('0x5')]);router[_0x7f98('0x6')]('/describe',auth[_0x7f98('0x4')](),controller['describe']);router[_0x7f98('0x6')](_0x7f98('0x7'),auth[_0x7f98('0x4')](),controller[_0x7f98('0x8')]);router[_0x7f98('0x6')](_0x7f98('0x9'),auth[_0x7f98('0x4')](),controller[_0x7f98('0xa')]);router[_0x7f98('0x6')](_0x7f98('0xb'),auth[_0x7f98('0x4')](),controller[_0x7f98('0xc')]);router[_0x7f98('0x6')]('/:id/interactions',auth[_0x7f98('0x4')](),controller['getInteractions']);router['get'](_0x7f98('0xd'),auth[_0x7f98('0x4')](),controller['getApplications']);router[_0x7f98('0x6')](_0x7f98('0xe'),auth[_0x7f98('0x4')](),controller['getMessages']);router[_0x7f98('0x6')](_0x7f98('0xf'),auth[_0x7f98('0x4')](),controller[_0x7f98('0x10')]);router[_0x7f98('0x11')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x7f98('0x9'),auth['isAuthenticated'](),controller['addDisposition']);router['post'](_0x7f98('0xb'),auth[_0x7f98('0x4')](),controller['addAnswer']);router['post'](_0x7f98('0x12'),auth['isAuthenticated'](),controller[_0x7f98('0x13')]);router[_0x7f98('0x11')](_0x7f98('0xd'),auth[_0x7f98('0x4')](),controller[_0x7f98('0x14')]);router[_0x7f98('0x11')](_0x7f98('0x15'),auth['isAuthenticated'](),controller['addAccountApplications']);router[_0x7f98('0x11')](_0x7f98('0x16'),auth[_0x7f98('0x4')](),controller[_0x7f98('0x17')]);router['post'](_0x7f98('0x18'),auth[_0x7f98('0x4')](),controller[_0x7f98('0x19')]);router[_0x7f98('0x11')]('/:id/users',auth[_0x7f98('0x4')](),controller['addAgents']);router['put'](_0x7f98('0x7'),auth[_0x7f98('0x4')](),controller[_0x7f98('0x1a')]);router[_0x7f98('0x1b')]('/:id',auth['isAuthenticated'](),controller[_0x7f98('0x1c')]);router[_0x7f98('0x1b')](_0x7f98('0x9'),auth[_0x7f98('0x4')](),controller[_0x7f98('0x1d')]);router['delete'](_0x7f98('0xb'),auth[_0x7f98('0x4')](),controller['removeAnswers']);router['delete']('/:id/users',auth[_0x7f98('0x4')](),controller['removeAgents']);module[_0x7f98('0x1e')]=router; \ No newline at end of file +var _0xa92a=['Router','../../components/auth/service','../../config/environment','./faxAccount.controller','get','isAuthenticated','index','describe','/:id','show','/:id/dispositions','getDispositions','/:id/interactions','getInteractions','getApplications','/:id/messages','/:id/users','getAgents','post','/:id/canned_answers','addAnswer','addInteraction','/:id/applications','addApplications','/addaccountapplications','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','multer','util','path','connect-timeout','express'];(function(_0x40246c,_0x181924){var _0x1042f5=function(_0x473f03){while(--_0x473f03){_0x40246c['push'](_0x40246c['shift']());}};_0x1042f5(++_0x181924);}(_0xa92a,0xd3));var _0xaa92=function(_0x43d701,_0x4bb2e9){_0x43d701=_0x43d701-0x0;var _0x2ec4c6=_0xa92a[_0x43d701];return _0x2ec4c6;};'use strict';var multer=require(_0xaa92('0x0'));var util=require(_0xaa92('0x1'));var path=require(_0xaa92('0x2'));var timeout=require(_0xaa92('0x3'));var express=require(_0xaa92('0x4'));var router=express[_0xaa92('0x5')]();var auth=require(_0xaa92('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xaa92('0x7'));var controller=require(_0xaa92('0x8'));router[_0xaa92('0x9')]('/',auth[_0xaa92('0xa')](),controller[_0xaa92('0xb')]);router['get']('/describe',auth[_0xaa92('0xa')](),controller[_0xaa92('0xc')]);router[_0xaa92('0x9')](_0xaa92('0xd'),auth['isAuthenticated'](),controller[_0xaa92('0xe')]);router['get'](_0xaa92('0xf'),auth[_0xaa92('0xa')](),controller[_0xaa92('0x10')]);router[_0xaa92('0x9')]('/:id/canned_answers',auth['isAuthenticated'](),controller['getAnswers']);router[_0xaa92('0x9')](_0xaa92('0x11'),auth[_0xaa92('0xa')](),controller[_0xaa92('0x12')]);router[_0xaa92('0x9')]('/:id/applications',auth[_0xaa92('0xa')](),controller[_0xaa92('0x13')]);router[_0xaa92('0x9')](_0xaa92('0x14'),auth[_0xaa92('0xa')](),controller['getMessages']);router[_0xaa92('0x9')](_0xaa92('0x15'),auth[_0xaa92('0xa')](),controller[_0xaa92('0x16')]);router[_0xaa92('0x17')]('/',auth[_0xaa92('0xa')](),controller['create']);router[_0xaa92('0x17')](_0xaa92('0xf'),auth['isAuthenticated'](),controller['addDisposition']);router[_0xaa92('0x17')](_0xaa92('0x18'),auth['isAuthenticated'](),controller[_0xaa92('0x19')]);router[_0xaa92('0x17')](_0xaa92('0x11'),auth[_0xaa92('0xa')](),controller[_0xaa92('0x1a')]);router['post'](_0xaa92('0x1b'),auth['isAuthenticated'](),controller[_0xaa92('0x1c')]);router[_0xaa92('0x17')](_0xaa92('0x1d'),auth[_0xaa92('0xa')](),controller['addAccountApplications']);router['post']('/updateaccountapplications',auth[_0xaa92('0xa')](),controller['updateAccountApplications']);router[_0xaa92('0x17')]('/:id/send',auth[_0xaa92('0xa')](),controller['send']);router[_0xaa92('0x17')](_0xaa92('0x15'),auth['isAuthenticated'](),controller['addAgents']);router['put'](_0xaa92('0xd'),auth[_0xaa92('0xa')](),controller[_0xaa92('0x1e')]);router[_0xaa92('0x1f')](_0xaa92('0xd'),auth['isAuthenticated'](),controller[_0xaa92('0x20')]);router['delete'](_0xaa92('0xf'),auth[_0xaa92('0xa')](),controller[_0xaa92('0x21')]);router[_0xaa92('0x1f')](_0xaa92('0x18'),auth['isAuthenticated'](),controller[_0xaa92('0x22')]);router[_0xaa92('0x1f')](_0xaa92('0x15'),auth[_0xaa92('0xa')](),controller[_0xaa92('0x23')]);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 cdb2ed5..68b003c 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 _0x2432=['TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING'];(function(_0xc489d8,_0x562c9b){var _0x17dc03=function(_0x774be0){while(--_0x774be0){_0xc489d8['push'](_0xc489d8['shift']());}};_0x17dc03(++_0x562c9b);}(_0x2432,0x7a));var _0x2243=function(_0x187e30,_0x27f261){_0x187e30=_0x187e30-0x0;var _0x3f7ae2=_0x2432[_0x187e30];return _0x3f7ae2;};'use strict';var Sequelize=require(_0x2243('0x0'));module[_0x2243('0x1')]={'priority':{'type':Sequelize[_0x2243('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x2243('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x2243('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x2243('0x3')],'defaultValue':_0x2243('0x5')}}; \ No newline at end of file +var _0xf29d=['TEXT','sequelize','exports','STRING','noop'];(function(_0x54044f,_0x287473){var _0x1ad1ef=function(_0x3bf5cb){while(--_0x3bf5cb){_0x54044f['push'](_0x54044f['shift']());}};_0x1ad1ef(++_0x287473);}(_0xf29d,0xc4));var _0xdf29=function(_0x272936,_0x102203){_0x272936=_0x272936-0x0;var _0x4b988d=_0xf29d[_0x272936];return _0x4b988d;};'use strict';var Sequelize=require(_0xdf29('0x0'));module[_0xdf29('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xdf29('0x2')],'allowNull':![],'defaultValue':_0xdf29('0x3')},'appdata':{'type':Sequelize[_0xdf29('0x4')]()},'description':{'type':Sequelize[_0xdf29('0x2')]},'interval':{'type':Sequelize[_0xdf29('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 75a648c..4f14a43 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 _0xe14b=['options','includeAll','include','findAll','rows','catch','find','create','body','params','destroy','html-pdf','eml-format','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','json','apply','reject','update','then','error','stack','name','index','FaxApplication','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','order','sort','filter','where','merge','VIRTUAL'];(function(_0x4b2a49,_0x27836f){var _0x158874=function(_0x1ac619){while(--_0x1ac619){_0x4b2a49['push'](_0x4b2a49['shift']());}};_0x158874(++_0x27836f);}(_0xe14b,0x93));var _0xbe14=function(_0x4bc605,_0x493389){_0x4bc605=_0x4bc605-0x0;var _0x3121f8=_0xe14b[_0x4bc605];return _0x3121f8;};'use strict';var pdf=require(_0xbe14('0x0'));var emlformat=require(_0xbe14('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xbe14('0x2'));var rp=require(_0xbe14('0x3'));var moment=require('moment');var BPromise=require(_0xbe14('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xbe14('0x5'));var sox=require(_0xbe14('0x6'));var csv=require(_0xbe14('0x7'));var ejs=require(_0xbe14('0x8'));var fs=require('fs');var _=require(_0xbe14('0x9'));var squel=require(_0xbe14('0xa'));var crypto=require(_0xbe14('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xbe14('0xc'));var Papa=require(_0xbe14('0xd'));var Redis=require(_0xbe14('0xe'));var authService=require(_0xbe14('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbe14('0x10'));var logger=require(_0xbe14('0x11'))('api');var utils=require(_0xbe14('0x12'));var config=require(_0xbe14('0x13'));var db=require(_0xbe14('0x14'))['db'];function respondWithStatusCode(_0x3d38c2,_0x27792f){_0x27792f=_0x27792f||0xcc;return function(_0x3b898d){if(_0x3b898d){return _0x3d38c2[_0xbe14('0x15')](_0x27792f);}return _0x3d38c2[_0xbe14('0x16')](_0x27792f)[_0xbe14('0x17')]();};}function respondWithResult(_0xa2cf72,_0x1e4826){_0x1e4826=_0x1e4826||0xc8;return function(_0x33fd54){if(_0x33fd54){return _0xa2cf72[_0xbe14('0x16')](_0x1e4826)['json'](_0x33fd54);}};}function respondWithFilteredResult(_0x55b3a7,_0x3f58f5){return function(_0x3dc4a9){if(_0x3dc4a9){var _0xf4ac9=_0x3dc4a9[_0xbe14('0x18')],_0x37ce4e=_0x3f58f5[_0xbe14('0x19')],_0x4e8f34=_0x3f58f5[_0xbe14('0x19')]+_0x3f58f5[_0xbe14('0x1a')],_0x21c789;if(_0x4e8f34>=_0xf4ac9){_0x4e8f34=_0xf4ac9;_0x21c789=0xc8;}else{_0x21c789=0xce;}_0x55b3a7[_0xbe14('0x16')](_0x21c789);return _0x55b3a7[_0xbe14('0x1b')]('Content-Range',_0x37ce4e+'-'+_0x4e8f34+'/'+_0xf4ac9)[_0xbe14('0x1c')](_0x3dc4a9);}return null;};}function patchUpdates(_0x456ca8){return function(_0x329588){try{jsonpatch[_0xbe14('0x1d')](_0x329588,_0x456ca8,!![]);}catch(_0x3249da){return BPromise[_0xbe14('0x1e')](_0x3249da);}return _0x329588['save']();};}function saveUpdates(_0x24f820,_0x4a1bbd){return function(_0x417c8d){if(_0x417c8d){return _0x417c8d[_0xbe14('0x1f')](_0x24f820)[_0xbe14('0x20')](function(_0x51dc0b){return _0x51dc0b;});}return null;};}function removeEntity(_0xe60f42,_0x56d845){return function(_0x3c1c85){if(_0x3c1c85){return _0x3c1c85['destroy']()[_0xbe14('0x20')](function(){_0xe60f42['status'](0xcc)[_0xbe14('0x17')]();});}};}function handleEntityNotFound(_0x3d3608,_0x505dbd){return function(_0x2da350){if(!_0x2da350){_0x3d3608['sendStatus'](0x194);}return _0x2da350;};}function handleError(_0x4587a8,_0x4851f8){_0x4851f8=_0x4851f8||0x1f4;return function(_0x36a21e){logger[_0xbe14('0x21')](_0x36a21e[_0xbe14('0x22')]);if(_0x36a21e[_0xbe14('0x23')]){delete _0x36a21e[_0xbe14('0x23')];}_0x4587a8[_0xbe14('0x16')](_0x4851f8)['send'](_0x36a21e);};}exports[_0xbe14('0x24')]=function(_0x1ba46a,_0x391556){var _0x169369={},_0x5dd475={},_0x16f884={'count':0x0,'rows':[]};var _0x29fc64=_['map'](db[_0xbe14('0x25')][_0xbe14('0x26')],function(_0x1c7cc7){return{'name':_0x1c7cc7[_0xbe14('0x27')],'type':_0x1c7cc7[_0xbe14('0x28')][_0xbe14('0x29')]};});_0x5dd475[_0xbe14('0x2a')]=_[_0xbe14('0x2b')](_0x29fc64,_0xbe14('0x23'));_0x5dd475[_0xbe14('0x2c')]=_[_0xbe14('0x2d')](_0x1ba46a[_0xbe14('0x2c')]);_0x5dd475[_0xbe14('0x2e')]=_[_0xbe14('0x2f')](_0x5dd475[_0xbe14('0x2a')],_0x5dd475[_0xbe14('0x2c')]);_0x169369[_0xbe14('0x30')]=_[_0xbe14('0x2f')](_0x5dd475[_0xbe14('0x2a')],qs[_0xbe14('0x31')](_0x1ba46a['query'][_0xbe14('0x31')]));_0x169369['attributes']=_0x169369['attributes'][_0xbe14('0x32')]?_0x169369['attributes']:_0x5dd475[_0xbe14('0x2a')];if(!_0x1ba46a[_0xbe14('0x2c')]['hasOwnProperty']('nolimit')){_0x169369['limit']=qs[_0xbe14('0x1a')](_0x1ba46a[_0xbe14('0x2c')]['limit']);_0x169369[_0xbe14('0x19')]=qs[_0xbe14('0x19')](_0x1ba46a[_0xbe14('0x2c')][_0xbe14('0x19')]);}_0x169369[_0xbe14('0x33')]=qs['sort'](_0x1ba46a['query'][_0xbe14('0x34')]);_0x169369['where']=qs['filters'](_['pick'](_0x1ba46a[_0xbe14('0x2c')],_0x5dd475[_0xbe14('0x2e')]),_0x29fc64);if(_0x1ba46a[_0xbe14('0x2c')][_0xbe14('0x35')]){_0x169369[_0xbe14('0x36')]=_[_0xbe14('0x37')](_0x169369[_0xbe14('0x36')],{'$or':_[_0xbe14('0x2b')](_0x29fc64,function(_0x2d9c12){if(_0x2d9c12[_0xbe14('0x28')]!==_0xbe14('0x38')){var _0x32c59d={};_0x32c59d[_0x2d9c12['name']]={'$like':'%'+_0x1ba46a['query'][_0xbe14('0x35')]+'%'};return _0x32c59d;}})});}_0x169369=_[_0xbe14('0x37')]({},_0x169369,_0x1ba46a[_0xbe14('0x39')]);var _0x520e09={'where':_0x169369[_0xbe14('0x36')]};return db[_0xbe14('0x25')][_0xbe14('0x18')](_0x520e09)[_0xbe14('0x20')](function(_0x3bd454){_0x16f884[_0xbe14('0x18')]=_0x3bd454;if(_0x1ba46a[_0xbe14('0x2c')][_0xbe14('0x3a')]){_0x169369[_0xbe14('0x3b')]=[{'all':!![]}];}return db['FaxApplication'][_0xbe14('0x3c')](_0x169369);})[_0xbe14('0x20')](function(_0x3463c4){_0x16f884[_0xbe14('0x3d')]=_0x3463c4;return _0x16f884;})[_0xbe14('0x20')](respondWithFilteredResult(_0x391556,_0x169369))[_0xbe14('0x3e')](handleError(_0x391556,null));};exports['show']=function(_0xb0f143,_0x1974a4){var _0x1220c9={'raw':!![],'where':{'id':_0xb0f143['params']['id']}},_0x36263c={};_0x36263c['model']=_[_0xbe14('0x2d')](db[_0xbe14('0x25')][_0xbe14('0x26')]);_0x36263c['query']=_['keys'](_0xb0f143[_0xbe14('0x2c')]);_0x36263c['filters']=_['intersection'](_0x36263c[_0xbe14('0x2a')],_0x36263c[_0xbe14('0x2c')]);_0x1220c9[_0xbe14('0x30')]=_['intersection'](_0x36263c['model'],qs['fields'](_0xb0f143[_0xbe14('0x2c')][_0xbe14('0x31')]));_0x1220c9[_0xbe14('0x30')]=_0x1220c9['attributes'][_0xbe14('0x32')]?_0x1220c9[_0xbe14('0x30')]:_0x36263c[_0xbe14('0x2a')];if(_0xb0f143[_0xbe14('0x2c')]['includeAll']){_0x1220c9['include']=[{'all':!![]}];}_0x1220c9=_[_0xbe14('0x37')]({},_0x1220c9,_0xb0f143[_0xbe14('0x39')]);return db[_0xbe14('0x25')][_0xbe14('0x3f')](_0x1220c9)[_0xbe14('0x20')](handleEntityNotFound(_0x1974a4,null))['then'](respondWithResult(_0x1974a4,null))['catch'](handleError(_0x1974a4,null));};exports[_0xbe14('0x40')]=function(_0x2a3623,_0x238c60){return db[_0xbe14('0x25')]['create'](_0x2a3623[_0xbe14('0x41')],{})[_0xbe14('0x20')](respondWithResult(_0x238c60,0xc9))['catch'](handleError(_0x238c60,null));};exports[_0xbe14('0x1f')]=function(_0x2a35e5,_0x2d6ee8){if(_0x2a35e5[_0xbe14('0x41')]['id']){delete _0x2a35e5['body']['id'];}return db['FaxApplication'][_0xbe14('0x3f')]({'where':{'id':_0x2a35e5[_0xbe14('0x42')]['id']}})['then'](handleEntityNotFound(_0x2d6ee8,null))['then'](saveUpdates(_0x2a35e5[_0xbe14('0x41')],null))[_0xbe14('0x20')](respondWithResult(_0x2d6ee8,null))[_0xbe14('0x3e')](handleError(_0x2d6ee8,null));};exports[_0xbe14('0x43')]=function(_0xdbc6e1,_0xd04fd5){return db[_0xbe14('0x25')]['find']({'where':{'id':_0xdbc6e1[_0xbe14('0x42')]['id']}})[_0xbe14('0x20')](handleEntityNotFound(_0xd04fd5,null))[_0xbe14('0x20')](removeEntity(_0xd04fd5,null))[_0xbe14('0x3e')](handleError(_0xd04fd5,null));}; \ No newline at end of file +var _0x1cb9=['api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','apply','save','then','destroy','error','stack','index','map','FaxApplication','rawAttributes','type','model','name','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','include','rows','catch','show','params','includeAll','options','find','create','body','update','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x5e200a,_0x3a1409){var _0xfc9917=function(_0x5ab291){while(--_0x5ab291){_0x5e200a['push'](_0x5e200a['shift']());}};_0xfc9917(++_0x3a1409);}(_0x1cb9,0x14e));var _0x91cb=function(_0x3d2693,_0x53be50){_0x3d2693=_0x3d2693-0x0;var _0x9b72cc=_0x1cb9[_0x3d2693];return _0x9b72cc;};'use strict';var pdf=require(_0x91cb('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x91cb('0x1'));var zipdir=require(_0x91cb('0x2'));var jsonpatch=require(_0x91cb('0x3'));var rp=require(_0x91cb('0x4'));var moment=require('moment');var BPromise=require(_0x91cb('0x5'));var Mustache=require(_0x91cb('0x6'));var util=require('util');var path=require(_0x91cb('0x7'));var sox=require(_0x91cb('0x8'));var csv=require(_0x91cb('0x9'));var ejs=require(_0x91cb('0xa'));var fs=require('fs');var _=require(_0x91cb('0xb'));var squel=require(_0x91cb('0xc'));var crypto=require('crypto');var jsforce=require(_0x91cb('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x91cb('0x9'));var querystring=require('querystring');var Papa=require(_0x91cb('0xe'));var Redis=require(_0x91cb('0xf'));var authService=require(_0x91cb('0x10'));var qs=require(_0x91cb('0x11'));var as=require(_0x91cb('0x12'));var hardwareService=require(_0x91cb('0x13'));var logger=require(_0x91cb('0x14'))(_0x91cb('0x15'));var utils=require(_0x91cb('0x16'));var config=require(_0x91cb('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3c1f56,_0x366f09){_0x366f09=_0x366f09||0xcc;return function(_0x4ba2f2){if(_0x4ba2f2){return _0x3c1f56[_0x91cb('0x18')](_0x366f09);}return _0x3c1f56[_0x91cb('0x19')](_0x366f09)[_0x91cb('0x1a')]();};}function respondWithResult(_0x2c7d40,_0x4a7d45){_0x4a7d45=_0x4a7d45||0xc8;return function(_0x4cc6ef){if(_0x4cc6ef){return _0x2c7d40[_0x91cb('0x19')](_0x4a7d45)[_0x91cb('0x1b')](_0x4cc6ef);}};}function respondWithFilteredResult(_0x585470,_0x528f73){return function(_0x576369){if(_0x576369){var _0xc3629e=_0x576369[_0x91cb('0x1c')],_0x347980=_0x528f73['offset'],_0x5ea796=_0x528f73[_0x91cb('0x1d')]+_0x528f73[_0x91cb('0x1e')],_0x238f11;if(_0x5ea796>=_0xc3629e){_0x5ea796=_0xc3629e;_0x238f11=0xc8;}else{_0x238f11=0xce;}_0x585470[_0x91cb('0x19')](_0x238f11);return _0x585470[_0x91cb('0x1f')]('Content-Range',_0x347980+'-'+_0x5ea796+'/'+_0xc3629e)[_0x91cb('0x1b')](_0x576369);}return null;};}function patchUpdates(_0x7dcf60){return function(_0x4ca8e8){try{jsonpatch[_0x91cb('0x20')](_0x4ca8e8,_0x7dcf60,!![]);}catch(_0x4c9fb2){return BPromise['reject'](_0x4c9fb2);}return _0x4ca8e8[_0x91cb('0x21')]();};}function saveUpdates(_0x160ded,_0x56e409){return function(_0x51a1d5){if(_0x51a1d5){return _0x51a1d5['update'](_0x160ded)[_0x91cb('0x22')](function(_0x18827b){return _0x18827b;});}return null;};}function removeEntity(_0x20aff5,_0x1dbee2){return function(_0x5c6a15){if(_0x5c6a15){return _0x5c6a15[_0x91cb('0x23')]()[_0x91cb('0x22')](function(){_0x20aff5[_0x91cb('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x26f18f,_0x1a7a54){return function(_0x2447e7){if(!_0x2447e7){_0x26f18f[_0x91cb('0x18')](0x194);}return _0x2447e7;};}function handleError(_0x3ca500,_0x7ad361){_0x7ad361=_0x7ad361||0x1f4;return function(_0x414e60){logger[_0x91cb('0x24')](_0x414e60[_0x91cb('0x25')]);if(_0x414e60['name']){delete _0x414e60['name'];}_0x3ca500[_0x91cb('0x19')](_0x7ad361)['send'](_0x414e60);};}exports[_0x91cb('0x26')]=function(_0x34d372,_0x318031){var _0x5595c5={},_0x9b26a6={},_0x4f5a7b={'count':0x0,'rows':[]};var _0x4572f6=_[_0x91cb('0x27')](db[_0x91cb('0x28')][_0x91cb('0x29')],function(_0x468908){return{'name':_0x468908['fieldName'],'type':_0x468908[_0x91cb('0x2a')]['key']};});_0x9b26a6[_0x91cb('0x2b')]=_[_0x91cb('0x27')](_0x4572f6,_0x91cb('0x2c'));_0x9b26a6['query']=_[_0x91cb('0x2d')](_0x34d372[_0x91cb('0x2e')]);_0x9b26a6[_0x91cb('0x2f')]=_[_0x91cb('0x30')](_0x9b26a6[_0x91cb('0x2b')],_0x9b26a6[_0x91cb('0x2e')]);_0x5595c5[_0x91cb('0x31')]=_[_0x91cb('0x30')](_0x9b26a6[_0x91cb('0x2b')],qs['fields'](_0x34d372[_0x91cb('0x2e')][_0x91cb('0x32')]));_0x5595c5[_0x91cb('0x31')]=_0x5595c5[_0x91cb('0x31')][_0x91cb('0x33')]?_0x5595c5['attributes']:_0x9b26a6[_0x91cb('0x2b')];if(!_0x34d372[_0x91cb('0x2e')][_0x91cb('0x34')](_0x91cb('0x35'))){_0x5595c5[_0x91cb('0x1e')]=qs['limit'](_0x34d372[_0x91cb('0x2e')]['limit']);_0x5595c5['offset']=qs['offset'](_0x34d372[_0x91cb('0x2e')]['offset']);}_0x5595c5[_0x91cb('0x36')]=qs['sort'](_0x34d372['query'][_0x91cb('0x37')]);_0x5595c5[_0x91cb('0x38')]=qs[_0x91cb('0x2f')](_[_0x91cb('0x39')](_0x34d372[_0x91cb('0x2e')],_0x9b26a6['filters']),_0x4572f6);if(_0x34d372[_0x91cb('0x2e')][_0x91cb('0x3a')]){_0x5595c5[_0x91cb('0x38')]=_[_0x91cb('0x3b')](_0x5595c5['where'],{'$or':_['map'](_0x4572f6,function(_0x1eed21){if(_0x1eed21[_0x91cb('0x2a')]!=='VIRTUAL'){var _0x39bd64={};_0x39bd64[_0x1eed21[_0x91cb('0x2c')]]={'$like':'%'+_0x34d372['query'][_0x91cb('0x3a')]+'%'};return _0x39bd64;}})});}_0x5595c5=_[_0x91cb('0x3b')]({},_0x5595c5,_0x34d372['options']);var _0x43d4fe={'where':_0x5595c5['where']};return db[_0x91cb('0x28')][_0x91cb('0x1c')](_0x43d4fe)[_0x91cb('0x22')](function(_0x279ad5){_0x4f5a7b[_0x91cb('0x1c')]=_0x279ad5;if(_0x34d372[_0x91cb('0x2e')]['includeAll']){_0x5595c5[_0x91cb('0x3c')]=[{'all':!![]}];}return db[_0x91cb('0x28')]['findAll'](_0x5595c5);})[_0x91cb('0x22')](function(_0x4ecbd7){_0x4f5a7b[_0x91cb('0x3d')]=_0x4ecbd7;return _0x4f5a7b;})[_0x91cb('0x22')](respondWithFilteredResult(_0x318031,_0x5595c5))[_0x91cb('0x3e')](handleError(_0x318031,null));};exports[_0x91cb('0x3f')]=function(_0x5e98c4,_0x435fff){var _0x5af0e6={'raw':!![],'where':{'id':_0x5e98c4[_0x91cb('0x40')]['id']}},_0x2cf27e={};_0x2cf27e[_0x91cb('0x2b')]=_[_0x91cb('0x2d')](db[_0x91cb('0x28')][_0x91cb('0x29')]);_0x2cf27e[_0x91cb('0x2e')]=_[_0x91cb('0x2d')](_0x5e98c4['query']);_0x2cf27e[_0x91cb('0x2f')]=_['intersection'](_0x2cf27e[_0x91cb('0x2b')],_0x2cf27e['query']);_0x5af0e6[_0x91cb('0x31')]=_['intersection'](_0x2cf27e[_0x91cb('0x2b')],qs[_0x91cb('0x32')](_0x5e98c4[_0x91cb('0x2e')][_0x91cb('0x32')]));_0x5af0e6['attributes']=_0x5af0e6[_0x91cb('0x31')][_0x91cb('0x33')]?_0x5af0e6['attributes']:_0x2cf27e[_0x91cb('0x2b')];if(_0x5e98c4[_0x91cb('0x2e')][_0x91cb('0x41')]){_0x5af0e6[_0x91cb('0x3c')]=[{'all':!![]}];}_0x5af0e6=_[_0x91cb('0x3b')]({},_0x5af0e6,_0x5e98c4[_0x91cb('0x42')]);return db[_0x91cb('0x28')][_0x91cb('0x43')](_0x5af0e6)[_0x91cb('0x22')](handleEntityNotFound(_0x435fff,null))['then'](respondWithResult(_0x435fff,null))[_0x91cb('0x3e')](handleError(_0x435fff,null));};exports[_0x91cb('0x44')]=function(_0x2b7323,_0x470996){return db[_0x91cb('0x28')][_0x91cb('0x44')](_0x2b7323[_0x91cb('0x45')],{})[_0x91cb('0x22')](respondWithResult(_0x470996,0xc9))['catch'](handleError(_0x470996,null));};exports[_0x91cb('0x46')]=function(_0x46caf1,_0x2b8b7f){if(_0x46caf1[_0x91cb('0x45')]['id']){delete _0x46caf1['body']['id'];}return db[_0x91cb('0x28')][_0x91cb('0x43')]({'where':{'id':_0x46caf1['params']['id']}})[_0x91cb('0x22')](handleEntityNotFound(_0x2b8b7f,null))['then'](saveUpdates(_0x46caf1[_0x91cb('0x45')],null))['then'](respondWithResult(_0x2b8b7f,null))['catch'](handleError(_0x2b8b7f,null));};exports['destroy']=function(_0x98245b,_0xff3d11){return db[_0x91cb('0x28')][_0x91cb('0x43')]({'where':{'id':_0x98245b[_0x91cb('0x40')]['id']}})['then'](handleEntityNotFound(_0xff3d11,null))['then'](removeEntity(_0xff3d11,null))[_0x91cb('0x3e')](handleError(_0xff3d11,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 617ed3e..08fd68a 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 _0x3241=['path','rimraf','../../config/environment','./faxApplication.attributes','exports','define','fax_applications','utf8mb4','lodash','util','api','moment','bluebird','request-promise'];(function(_0x56e657,_0x439be6){var _0x61a99c=function(_0x431fab){while(--_0x431fab){_0x56e657['push'](_0x56e657['shift']());}};_0x61a99c(++_0x439be6);}(_0x3241,0x86));var _0x1324=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3241[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x1324('0x0'));var util=require(_0x1324('0x1'));var logger=require('../../config/logger')(_0x1324('0x2'));var moment=require(_0x1324('0x3'));var BPromise=require(_0x1324('0x4'));var rp=require(_0x1324('0x5'));var fs=require('fs');var path=require(_0x1324('0x6'));var rimraf=require(_0x1324('0x7'));var config=require(_0x1324('0x8'));var attributes=require(_0x1324('0x9'));module[_0x1324('0xa')]=function(_0x52ebd2,_0x583748){return _0x52ebd2[_0x1324('0xb')]('FaxApplication',attributes,{'tableName':_0x1324('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x1324('0xd'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xf2de=['fax_applications','utf8mb4_unicode_ci','util','../../config/logger','bluebird','request-promise','rimraf','./faxApplication.attributes','exports','define'];(function(_0x546274,_0xa191fc){var _0x191030=function(_0x464122){while(--_0x464122){_0x546274['push'](_0x546274['shift']());}};_0x191030(++_0xa191fc);}(_0xf2de,0x160));var _0xef2d=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0xf2de[_0x279d37];return _0x530173;};'use strict';var _=require('lodash');var util=require(_0xef2d('0x0'));var logger=require(_0xef2d('0x1'))('api');var moment=require('moment');var BPromise=require(_0xef2d('0x2'));var rp=require(_0xef2d('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xef2d('0x4'));var config=require('../../config/environment');var attributes=require(_0xef2d('0x5'));module[_0xef2d('0x6')]=function(_0x167d07,_0x5f4629){return _0x167d07[_0xef2d('0x7')]('FaxApplication',attributes,{'tableName':_0xef2d('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xef2d('0x9')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index c03aa0e..6e3bae7 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 _0xffb6=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','info','FaxApplication,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','UpdateFaxApplication','FaxApplication','update','options','raw','where','limit','then','lodash','util'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xffb6,0x120));var _0x6ffb=function(_0x284897,_0x3a3f0f){_0x284897=_0x284897-0x0;var _0x108a2e=_0xffb6[_0x284897];return _0x108a2e;};'use strict';var _=require(_0x6ffb('0x0'));var util=require(_0x6ffb('0x1'));var moment=require(_0x6ffb('0x2'));var BPromise=require(_0x6ffb('0x3'));var rs=require(_0x6ffb('0x4'));var fs=require('fs');var Redis=require(_0x6ffb('0x5'));var db=require(_0x6ffb('0x6'))['db'];var utils=require(_0x6ffb('0x7'));var logger=require(_0x6ffb('0x8'))(_0x6ffb('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x6ffb('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xfc3b5e,_0x3fbba0,_0x186eaf){return new BPromise(function(_0x1db05b,_0x2c06ae){return client['request'](_0xfc3b5e,_0x186eaf)['then'](function(_0x2ec0a1){logger[_0x6ffb('0xb')](_0x6ffb('0xc'),_0x3fbba0,'request\x20sent');logger[_0x6ffb('0xd')]('FaxApplication,\x20%s,\x20%s,\x20%s',_0x3fbba0,_0x6ffb('0xe'),JSON[_0x6ffb('0xf')](_0x2ec0a1));if(_0x2ec0a1['error']){if(_0x2ec0a1[_0x6ffb('0x10')][_0x6ffb('0x11')]===0x1f4){logger[_0x6ffb('0x10')](_0x6ffb('0xc'),_0x3fbba0,_0x2ec0a1[_0x6ffb('0x10')]['message']);return _0x2c06ae(_0x2ec0a1[_0x6ffb('0x10')][_0x6ffb('0x12')]);}logger[_0x6ffb('0x10')]('FaxApplication,\x20%s,\x20%s',_0x3fbba0,_0x2ec0a1[_0x6ffb('0x10')]['message']);return _0x1db05b(_0x2ec0a1['error']['message']);}else{logger[_0x6ffb('0xb')](_0x6ffb('0xc'),_0x3fbba0,_0x6ffb('0xe'));_0x1db05b(_0x2ec0a1[_0x6ffb('0x13')][_0x6ffb('0x12')]);}})[_0x6ffb('0x14')](function(_0x34222e){logger[_0x6ffb('0x10')](_0x6ffb('0xc'),_0x3fbba0,_0x34222e);_0x2c06ae(_0x34222e);});});}exports[_0x6ffb('0x15')]=function(_0x400824){var _0x26598c=this;return new Promise(function(_0x2cc01c,_0x373c76){return db[_0x6ffb('0x16')][_0x6ffb('0x17')](_0x400824['body'],{'raw':_0x400824[_0x6ffb('0x18')]?_0x400824[_0x6ffb('0x18')][_0x6ffb('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x400824['options']?_0x400824[_0x6ffb('0x18')][_0x6ffb('0x1a')]||null:null,'attributes':_0x400824['options']?_0x400824[_0x6ffb('0x18')]['attributes']||null:null,'limit':_0x400824[_0x6ffb('0x18')]?_0x400824['options'][_0x6ffb('0x1b')]||null:null})[_0x6ffb('0x1c')](function(_0x37c753){logger['info'](_0x6ffb('0x15'),_0x400824);logger[_0x6ffb('0xd')]('UpdateFaxApplication',_0x400824,JSON[_0x6ffb('0xf')](_0x37c753));_0x2cc01c(_0x37c753);})[_0x6ffb('0x14')](function(_0x2df37a){logger[_0x6ffb('0x10')](_0x6ffb('0x15'),_0x2df37a['message'],_0x400824);_0x373c76(_0x26598c[_0x6ffb('0x10')](0x1f4,_0x2df37a['message']));});});}; \ No newline at end of file +var _0x728b=['debug','stringify','error','code','message','UpdateFaxApplication','FaxApplication','update','body','options','raw','where','attributes','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','http','request','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent'];(function(_0x2d08a7,_0x228001){var _0x124aff=function(_0x553b0e){while(--_0x553b0e){_0x2d08a7['push'](_0x2d08a7['shift']());}};_0x124aff(++_0x228001);}(_0x728b,0x1ce));var _0xb728=function(_0x620cc3,_0x22e29d){_0x620cc3=_0x620cc3-0x0;var _0x4d8f8f=_0x728b[_0x620cc3];return _0x4d8f8f;};'use strict';var _=require(_0xb728('0x0'));var util=require(_0xb728('0x1'));var moment=require(_0xb728('0x2'));var BPromise=require(_0xb728('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb728('0x4'));var db=require(_0xb728('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb728('0x6'))(_0xb728('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xb728('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4c051f,_0x5b0930,_0xb1caf3){return new BPromise(function(_0x282394,_0x489c0f){return client[_0xb728('0x9')](_0x4c051f,_0xb1caf3)[_0xb728('0xa')](function(_0x3e5ac5){logger[_0xb728('0xb')](_0xb728('0xc'),_0x5b0930,_0xb728('0xd'));logger[_0xb728('0xe')]('FaxApplication,\x20%s,\x20%s,\x20%s',_0x5b0930,_0xb728('0xd'),JSON[_0xb728('0xf')](_0x3e5ac5));if(_0x3e5ac5['error']){if(_0x3e5ac5[_0xb728('0x10')][_0xb728('0x11')]===0x1f4){logger['error'](_0xb728('0xc'),_0x5b0930,_0x3e5ac5[_0xb728('0x10')]['message']);return _0x489c0f(_0x3e5ac5[_0xb728('0x10')][_0xb728('0x12')]);}logger[_0xb728('0x10')](_0xb728('0xc'),_0x5b0930,_0x3e5ac5[_0xb728('0x10')][_0xb728('0x12')]);return _0x282394(_0x3e5ac5['error']['message']);}else{logger['info'](_0xb728('0xc'),_0x5b0930,_0xb728('0xd'));_0x282394(_0x3e5ac5['result'][_0xb728('0x12')]);}})['catch'](function(_0x594db9){logger[_0xb728('0x10')](_0xb728('0xc'),_0x5b0930,_0x594db9);_0x489c0f(_0x594db9);});});}exports[_0xb728('0x13')]=function(_0xaf6f2a){var _0x4e53bd=this;return new Promise(function(_0xe1539e,_0x4bfd4c){return db[_0xb728('0x14')][_0xb728('0x15')](_0xaf6f2a[_0xb728('0x16')],{'raw':_0xaf6f2a[_0xb728('0x17')]?_0xaf6f2a[_0xb728('0x17')][_0xb728('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xaf6f2a[_0xb728('0x17')]?_0xaf6f2a[_0xb728('0x17')][_0xb728('0x19')]||null:null,'attributes':_0xaf6f2a[_0xb728('0x17')]?_0xaf6f2a[_0xb728('0x17')][_0xb728('0x1a')]||null:null,'limit':_0xaf6f2a[_0xb728('0x17')]?_0xaf6f2a[_0xb728('0x17')]['limit']||null:null})[_0xb728('0xa')](function(_0x22cc5a){logger[_0xb728('0xb')](_0xb728('0x13'),_0xaf6f2a);logger['debug']('UpdateFaxApplication',_0xaf6f2a,JSON[_0xb728('0xf')](_0x22cc5a));_0xe1539e(_0x22cc5a);})[_0xb728('0x1b')](function(_0x25f992){logger['error'](_0xb728('0x13'),_0x25f992['message'],_0xaf6f2a);_0x4bfd4c(_0x4e53bd[_0xb728('0x10')](0x1f4,_0x25f992[_0xb728('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 756407a..93bf989 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(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x326f,0xd1));var _0xf326=function(_0x377f64,_0x24b0aa){_0x377f64=_0x377f64-0x0;var _0x2a0114=_0x326f[_0x377f64];return _0x2a0114;};'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 _0xafc4=['multer','path','express','Router','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/:id','show','create','put','update','exports'];(function(_0x3d752d,_0xc52697){var _0x24b394=function(_0x1f3515){while(--_0x1f3515){_0x3d752d['push'](_0x3d752d['shift']());}};_0x24b394(++_0xc52697);}(_0xafc4,0x69));var _0x4afc=function(_0x480c5f,_0x26b444){_0x480c5f=_0x480c5f-0x0;var _0xe36993=_0xafc4[_0x480c5f];return _0xe36993;};'use strict';var multer=require(_0x4afc('0x0'));var util=require('util');var path=require(_0x4afc('0x1'));var timeout=require('connect-timeout');var express=require(_0x4afc('0x2'));var router=express[_0x4afc('0x3')]();var auth=require(_0x4afc('0x4'));var interaction=require(_0x4afc('0x5'));var config=require('../../config/environment');var controller=require('./faxApplication.controller');router['get']('/',auth[_0x4afc('0x6')](),controller[_0x4afc('0x7')]);router[_0x4afc('0x8')](_0x4afc('0x9'),auth[_0x4afc('0x6')](),controller[_0x4afc('0xa')]);router['post']('/',auth[_0x4afc('0x6')](),controller[_0x4afc('0xb')]);router[_0x4afc('0xc')](_0x4afc('0x9'),auth[_0x4afc('0x6')](),controller[_0x4afc('0xd')]);router['delete']('/:id',auth[_0x4afc('0x6')](),controller['destroy']);module[_0x4afc('0xe')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 15f28ce..89909cb 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 _0x7586=['STRING','out','ENUM','BOOLEAN','DATE'];(function(_0x19a931,_0x6a12b6){var _0x519a86=function(_0x4784d5){while(--_0x4784d5){_0x19a931['push'](_0x19a931['shift']());}};_0x519a86(++_0x6a12b6);}(_0x7586,0x8a));var _0x6758=function(_0x3bd961,_0x26f947){_0x3bd961=_0x3bd961-0x0;var _0xbeeb8e=_0x7586[_0x3bd961];return _0xbeeb8e;};'use strict';var Sequelize=require('sequelize');module['exports']={'closed':{'type':Sequelize[_0x6758('0x0')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x6758('0x1')]},'disposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x6758('0x2')]},'read1stAt':{'type':Sequelize[_0x6758('0x1')]},'fax':{'type':Sequelize[_0x6758('0x2')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x6758('0x3')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x6758('0x1')]},'lastMsgDirection':{'type':Sequelize[_0x6758('0x4')]('in',_0x6758('0x3')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x6285=['DATE','STRING','ENUM','out','exports'];(function(_0xbd31d3,_0x356834){var _0x73fddf=function(_0x203050){while(--_0x203050){_0xbd31d3['push'](_0xbd31d3['shift']());}};_0x73fddf(++_0x356834);}(_0x6285,0x18a));var _0x5628=function(_0x116e98,_0x5ef530){_0x116e98=_0x116e98-0x0;var _0x422e1d=_0x6285[_0x116e98];return _0x422e1d;};'use strict';var Sequelize=require('sequelize');module[_0x5628('0x0')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x5628('0x1')]},'disposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x5628('0x2')]},'read1stAt':{'type':Sequelize[_0x5628('0x1')]},'fax':{'type':Sequelize['STRING']},'firstMsgDirection':{'type':Sequelize[_0x5628('0x3')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x5628('0x1')]},'lastMsgDirection':{'type':Sequelize[_0x5628('0x3')]('in',_0x5628('0x4')),'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 6ce998f..c31a03f 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 _0x8eba=['path','sox','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','redis','defaults','localhost','./faxInteraction.socket','register','status','end','json','count','offset','limit','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','map','fullname','TagIds','split','push','catch','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','field','color','from','tools_tags','u.id','u.fullname','ui.FaxInteractionId','user_has_fax_interactions','left_join','users','u.id\x20=\x20ui.UserId','select','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','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','parseSearch','search','sqlOperator','conditions','find','unreadMessages','having','`\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?','ContactId','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','body','keys','some','compact','forEach','FaxAccountId','i.FaxAccountId\x20IN\x20?','createdAt','parse','$gte','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','\x27\x27\x27\x27','i.id\x20LIKE\x20?','group','SELECT','clone','isEmpty','t.id\x20IN\x20?','resolve','journey','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','i.FaxAccountId\x20IS\x20NULL','sequelize','toString','merge','FaxInteraction','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','c.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','Contact.mobile','c.fax','o.fullname','Owner.fullname','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','groupBy','all','rows','includeAll','options','create','params','describe','FaxMessage','addMessage','omit','ids','getMessages','FaxInteractionId','format','include','findAll','addTags','spread','emit','faxInteractionTags:save','removeTags','download','unix','join','root','files','attachments','transcript-%d-%s.zip','Attachment','Messages','get','basename','existsSync','createReadStream','pipe','createWriteStream','log','err','unlinkSync','html-pdf','eml-format','request-promise','moment','bluebird','mustache'];(function(_0x2a332d,_0x3d5865){var _0x5d24c4=function(_0x255e6c){while(--_0x255e6c){_0x2a332d['push'](_0x2a332d['shift']());}};_0x5d24c4(++_0x3d5865);}(_0x8eba,0xc3));var _0xa8eb=function(_0x20a558,_0x160e0e){_0x20a558=_0x20a558-0x0;var _0x53d3f7=_0x8eba[_0x20a558];return _0x53d3f7;};'use strict';var pdf=require(_0xa8eb('0x0'));var emlformat=require(_0xa8eb('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xa8eb('0x2'));var moment=require(_0xa8eb('0x3'));var BPromise=require(_0xa8eb('0x4'));var Mustache=require(_0xa8eb('0x5'));var util=require('util');var path=require(_0xa8eb('0x6'));var sox=require(_0xa8eb('0x7'));var csv=require('to-csv');var ejs=require(_0xa8eb('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0xa8eb('0x9'));var crypto=require(_0xa8eb('0xa'));var jsforce=require(_0xa8eb('0xb'));var deskjs=require(_0xa8eb('0xc'));var toCsv=require('to-csv');var querystring=require(_0xa8eb('0xd'));var Papa=require(_0xa8eb('0xe'));var Redis=require('ioredis');var authService=require(_0xa8eb('0xf'));var qs=require(_0xa8eb('0x10'));var as=require(_0xa8eb('0x11'));var hardwareService=require(_0xa8eb('0x12'));var logger=require('../../config/logger')(_0xa8eb('0x13'));var utils=require('../../config/utils');var config=require(_0xa8eb('0x14'));var db=require('../../mysqldb')['db'];config[_0xa8eb('0x15')]=_[_0xa8eb('0x16')](config['redis'],{'host':_0xa8eb('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa8eb('0x15')]));require(_0xa8eb('0x18'))[_0xa8eb('0x19')](socket);function respondWithStatusCode(_0x1a014a,_0x557bb0){_0x557bb0=_0x557bb0||0xcc;return function(_0x2d35c7){if(_0x2d35c7){return _0x1a014a['sendStatus'](_0x557bb0);}return _0x1a014a[_0xa8eb('0x1a')](_0x557bb0)[_0xa8eb('0x1b')]();};}function respondWithResult(_0x40ec36,_0x102a81){_0x102a81=_0x102a81||0xc8;return function(_0x538313){if(_0x538313){return _0x40ec36[_0xa8eb('0x1a')](_0x102a81)[_0xa8eb('0x1c')](_0x538313);}};}function respondWithFilteredResult(_0x1a6500,_0x249527){return function(_0x215b2d){if(_0x215b2d){var _0x57a6c6=_0x215b2d[_0xa8eb('0x1d')],_0x307bef=_0x249527[_0xa8eb('0x1e')],_0x1cb4f1=_0x249527[_0xa8eb('0x1e')]+_0x249527[_0xa8eb('0x1f')],_0x2c16a0;if(_0x1cb4f1>=_0x57a6c6){_0x1cb4f1=_0x57a6c6;_0x2c16a0=0xc8;}else{_0x2c16a0=0xce;}_0x1a6500[_0xa8eb('0x1a')](_0x2c16a0);return _0x1a6500['set']('Content-Range',_0x307bef+'-'+_0x1cb4f1+'/'+_0x57a6c6)['json'](_0x215b2d);}return null;};}function patchUpdates(_0x1f6d6d){return function(_0x3f3e49){try{jsonpatch[_0xa8eb('0x20')](_0x3f3e49,_0x1f6d6d,!![]);}catch(_0x597df0){return BPromise[_0xa8eb('0x21')](_0x597df0);}return _0x3f3e49[_0xa8eb('0x22')]();};}function saveUpdates(_0x449f76,_0x453b69){return function(_0xd0ecf){if(_0xd0ecf){return _0xd0ecf[_0xa8eb('0x23')](_0x449f76)[_0xa8eb('0x24')](function(_0x32e9ce){return _0x32e9ce;});}return null;};}function removeEntity(_0x4557fc,_0x387d49){return function(_0xf55fd4){if(_0xf55fd4){return _0xf55fd4[_0xa8eb('0x25')]()[_0xa8eb('0x24')](function(){_0x4557fc['status'](0xcc)[_0xa8eb('0x1b')]();});}};}function handleEntityNotFound(_0x1760ec,_0x130a51){return function(_0x18f65f){if(!_0x18f65f){_0x1760ec[_0xa8eb('0x26')](0x194);}return _0x18f65f;};}function handleError(_0x4aa445,_0x261248){_0x261248=_0x261248||0x1f4;return function(_0x1d4a0b){logger[_0xa8eb('0x27')](_0x1d4a0b[_0xa8eb('0x28')]);if(_0x1d4a0b[_0xa8eb('0x29')]){delete _0x1d4a0b['name'];}_0x4aa445['status'](_0x261248)[_0xa8eb('0x2a')](_0x1d4a0b);};}function getInteractionUsers(_0x3cfcf0,_0x167f29){return new BPromise(function(_0x186eb5,_0x418200){try{if(_0x167f29[_0x3cfcf0['id']]){_0x3cfcf0['Users']=_[_0xa8eb('0x2b')](_0x167f29[_0x3cfcf0['id']],function(_0x453fb5){return{'id':_0x453fb5['id'],'fullname':_0x453fb5[_0xa8eb('0x2c')]};});}}catch(_0x109433){_0x418200(_0x109433);}_0x186eb5(_0x3cfcf0);});}function getInteractionTags(_0x262304,_0x17ddcf){return new BPromise(function(_0xc1d74d,_0x5a3cec){try{if(_0x262304[_0xa8eb('0x2d')]){_0x262304['Tags']=[];_0x262304[_0xa8eb('0x2d')][_0xa8eb('0x2e')](',')['forEach'](function(_0x9fa6ce){_0x262304['Tags'][_0xa8eb('0x2f')](_0x17ddcf[_0x9fa6ce]);});}delete _0x262304[_0xa8eb('0x2d')];}catch(_0x11ff1c){_0x5a3cec(_0x11ff1c);}_0xc1d74d(_0x262304);});}function updateFaxInteraction(_0x215677,_0x532f1e,_0x3844f0){return new BPromise(function(_0x2df68f,_0xc71f34){return getInteractionUsers(_0x215677,_0x3844f0)[_0xa8eb('0x24')](function(_0x3ad0df){return getInteractionTags(_0x3ad0df,_0x532f1e);})[_0xa8eb('0x24')](function(_0x5e7106){_0x2df68f(_0x5e7106);})[_0xa8eb('0x30')](function(_0x5af9ec){_0xc71f34(_0x5af9ec);});});}exports['index']=function(_0x594923,_0xed9001){var _0x246931={},_0x3ec1ec={},_0x20b760={'count':0x0,'rows':[]};var _0x201a1e=_['map'](db['FaxInteraction'][_0xa8eb('0x31')],function(_0x181346){return{'name':_0x181346[_0xa8eb('0x32')],'type':_0x181346[_0xa8eb('0x33')][_0xa8eb('0x34')]};});_0x3ec1ec['model']=_[_0xa8eb('0x2b')](_0x201a1e,'name');_0x3ec1ec[_0xa8eb('0x35')]=_['keys'](_0x594923[_0xa8eb('0x35')]);_0x3ec1ec[_0xa8eb('0x36')]=_[_0xa8eb('0x37')](_0x3ec1ec[_0xa8eb('0x38')],_0x3ec1ec['query']);_0x246931[_0xa8eb('0x39')]=_['intersection'](_0x3ec1ec[_0xa8eb('0x38')],qs[_0xa8eb('0x3a')](_0x594923[_0xa8eb('0x35')][_0xa8eb('0x3a')]));_0x246931['attributes']=_0x246931[_0xa8eb('0x39')][_0xa8eb('0x3b')]?_0x246931['attributes']:_0x3ec1ec[_0xa8eb('0x38')];if(!_0x594923['query'][_0xa8eb('0x3c')](_0xa8eb('0x3d'))){_0x246931[_0xa8eb('0x1f')]=qs['limit'](_0x594923[_0xa8eb('0x35')]['limit']);_0x246931['offset']=qs[_0xa8eb('0x1e')](_0x594923[_0xa8eb('0x35')]['offset']);}_0x246931[_0xa8eb('0x3e')]=qs[_0xa8eb('0x3f')](_0x594923[_0xa8eb('0x35')][_0xa8eb('0x3f')]);_0x246931[_0xa8eb('0x40')]=qs[_0xa8eb('0x36')](_[_0xa8eb('0x41')](_0x594923[_0xa8eb('0x35')],_0x3ec1ec[_0xa8eb('0x36')]),_0x201a1e);var _0x4613d3=[];var _0x5bcf53=squel['select']()[_0xa8eb('0x42')]('id')[_0xa8eb('0x42')](_0xa8eb('0x29'))[_0xa8eb('0x42')](_0xa8eb('0x43'))[_0xa8eb('0x44')](_0xa8eb('0x45'));var _0x470e68=squel['select']()['field'](_0xa8eb('0x46'))[_0xa8eb('0x42')](_0xa8eb('0x47'))['field'](_0xa8eb('0x48'))[_0xa8eb('0x44')](_0xa8eb('0x49'),'ui')[_0xa8eb('0x4a')](_0xa8eb('0x4b'),'u',_0xa8eb('0x4c'));var _0xe7c7c0=squel[_0xa8eb('0x4d')]()[_0xa8eb('0x44')]('fax_interactions','i')[_0xa8eb('0x4a')]('cm_contacts','c',_0xa8eb('0x4e'))[_0xa8eb('0x4a')](_0xa8eb('0x4b'),'o','o.id\x20=\x20i.UserId')[_0xa8eb('0x4a')](_0xa8eb('0x4f'),'a',_0xa8eb('0x50'))[_0xa8eb('0x4a')](_0xa8eb('0x51'),'me',_0xa8eb('0x52'))[_0xa8eb('0x4a')](_0xa8eb('0x53'),'it',_0xa8eb('0x54'))['left_join']('tools_tags','t',_0xa8eb('0x55'));var _0x3c2aff=squel[_0xa8eb('0x56')]();var _0x1b2bb8=[];var _0x50f65c=squel['expr']();var _0x527ee0;if(_0x594923[_0xa8eb('0x35')]['search']){_0x527ee0=as[_0xa8eb('0x57')](_0x594923[_0xa8eb('0x35')][_0xa8eb('0x58')]);var _0x279a0f=_0x527ee0[_0xa8eb('0x59')];for(var _0x7e0af2=0x0;_0x7e0af2<_0x527ee0[_0xa8eb('0x5a')][_0xa8eb('0x3b')];_0x7e0af2++){var _0xd8790a=_0x527ee0[_0xa8eb('0x5a')][_0x7e0af2];var _0x80d0fc='i';var _0x2268cc=_[_0xa8eb('0x5b')](_0x201a1e,[_0xa8eb('0x29'),_0xd8790a[_0xa8eb('0x42')]]);if(!_0x2268cc){switch(_0xd8790a[_0xa8eb('0x42')]){case _0xa8eb('0x5c'):if(_0xd8790a['value']==0x1){_0xe7c7c0['having']('`'+_0xd8790a[_0xa8eb('0x42')]+'`\x20=\x200');}else{_0xe7c7c0[_0xa8eb('0x5d')]('`'+_0xd8790a['field']+_0xa8eb('0x5e'));}break;case _0xa8eb('0x5f'):if(_0xd8790a['operator']==='$substring'){if(_0xd8790a[_0xa8eb('0x60')][_0xa8eb('0x2e')]('\x20')[_0xa8eb('0x3b')]>0x1){_0x3c2aff[_0x279a0f](_0xa8eb('0x61'),qs[_0xa8eb('0x62')](_0xd8790a[_0xa8eb('0x60')]),null);}else{var _0xcda846='%'+_0xd8790a[_0xa8eb('0x60')]+'%';_0x3c2aff[_0x279a0f](_0xa8eb('0x63'),_0xcda846,_0xcda846,_0xcda846);}}else{_0x2268cc=_[_0xa8eb('0x5b')](_0x201a1e,[_0xa8eb('0x29'),_0xa8eb('0x64')]);_0xd8790a[_0xa8eb('0x42')]=_0xa8eb('0x64');_0x3786c4=as['buildExpression'](_0x80d0fc,_0x2268cc['type'],_0xd8790a);_0x3c2aff[_0x279a0f](_0x3786c4[_0xa8eb('0x65')],_0x3786c4[_0xa8eb('0x60')][_0xa8eb('0x66')],_0x3786c4[_0xa8eb('0x60')][_0xa8eb('0x1b')]);}break;case _0xa8eb('0x67'):var _0x5a2df8=_0xd8790a[_0xa8eb('0x60')][_0xa8eb('0x2e')](',')[_0xa8eb('0x2b')](function(_0x292a15){return Number(_0x292a15);});_0x5a2df8['forEach'](function(_0xcdef6a){_0x50f65c['or'](_0xa8eb('0x68'),'%,'+_0xcdef6a+',%');});_0x1b2bb8=_['union'](_0x1b2bb8,_0x5a2df8);break;case'User':if(_0xd8790a[_0xa8eb('0x69')]==='$substring'){_0x3c2aff[_0x279a0f](_0xa8eb('0x6a'),'%'+_0xd8790a['value']+'%',null);}else{_0x2268cc=_[_0xa8eb('0x5b')](_0x201a1e,['name','UserId']);_0xd8790a[_0xa8eb('0x42')]=_0xa8eb('0x6b');_0x3786c4=as[_0xa8eb('0x6c')](_0x80d0fc,_0x2268cc[_0xa8eb('0x33')],_0xd8790a);_0x3c2aff[_0x279a0f](_0x3786c4[_0xa8eb('0x65')],_0x3786c4[_0xa8eb('0x60')][_0xa8eb('0x66')],_0x3786c4[_0xa8eb('0x60')]['end']);}break;case _0xa8eb('0x6d'):_0x3786c4=as[_0xa8eb('0x6c')]('me',null,_0xd8790a);_0x3c2aff[_0x279a0f](_0x3786c4['text'],_0x3786c4[_0xa8eb('0x60')][_0xa8eb('0x66')],_0x3786c4[_0xa8eb('0x60')][_0xa8eb('0x1b')]);break;}}else{var _0x3786c4=as[_0xa8eb('0x6c')](_0x80d0fc,_0x2268cc[_0xa8eb('0x33')],_0xd8790a);_0x3c2aff[_0x279a0f](_0x3786c4[_0xa8eb('0x65')],_0x3786c4[_0xa8eb('0x60')][_0xa8eb('0x66')],_0x3786c4[_0xa8eb('0x60')][_0xa8eb('0x1b')]);}}}else{var _0x212ddc=_(_0x594923['query'])[_0xa8eb('0x6e')]()[_0xa8eb('0x2b')](function(_0x32254e){return _[_0xa8eb('0x6f')](_0x201a1e,['name',_0x32254e])?_0x32254e:undefined;})[_0xa8eb('0x70')]()[_0xa8eb('0x60')]();if(!_['isEmpty'](_0x212ddc)){_0x212ddc[_0xa8eb('0x71')](function(_0x2b016f){if(_0x2b016f===_0xa8eb('0x72')){_0xe7c7c0[_0xa8eb('0x40')](_0xa8eb('0x73'),[]['concat'](_0x594923[_0xa8eb('0x35')][_0x2b016f]));}else if(_0x2b016f===_0xa8eb('0x74')){var _0x4b9585=JSON[_0xa8eb('0x75')](_0x594923['query'][_0x2b016f])[_0xa8eb('0x76')];var _0x4582be=JSON[_0xa8eb('0x75')](_0x594923['query'][_0x2b016f])['$lte'];_0xe7c7c0[_0xa8eb('0x40')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x4b9585,_0x4582be);}else{if(_0x594923[_0xa8eb('0x35')][_0x2b016f]===_0xa8eb('0x77')){_0xe7c7c0[_0xa8eb('0x40')]('i.'+_0x2b016f+_0xa8eb('0x78'));}else{_0xe7c7c0[_0xa8eb('0x40')]('i.'+_0x2b016f+_0xa8eb('0x79'),_0x594923[_0xa8eb('0x35')][_0x2b016f]);}}});}if(_0x594923[_0xa8eb('0x35')]['read']){if(_0x594923[_0xa8eb('0x35')][_0xa8eb('0x7a')]==0x1){_0xe7c7c0['having'](_0xa8eb('0x7b'));}else{_0xe7c7c0[_0xa8eb('0x5d')](_0xa8eb('0x7c'));}}if(_0x594923[_0xa8eb('0x35')]['tag']){_0x1b2bb8=_[_0xa8eb('0x7d')](_0x594923['query']['tag'])?_0x594923[_0xa8eb('0x35')][_0xa8eb('0x7e')]:new Array(_0x594923[_0xa8eb('0x35')]['tag']);_0x1b2bb8[_0xa8eb('0x71')](function(_0x1ef45b){_0x50f65c['or'](_0xa8eb('0x68'),'%,'+_0x1ef45b+',%');});}if(_0x594923['query'][_0xa8eb('0x7f')]){var _0x193a3d=_0x594923[_0xa8eb('0x35')][_0xa8eb('0x7f')]['replace']('\x5c','\x5c\x5c')[_0xa8eb('0x80')]('\x27\x27',_0xa8eb('0x81'));if(qs['isNumeric'](_0x193a3d)){_0x3c2aff['or'](_0xa8eb('0x82'),_0x193a3d+'%')['or']('i.fax\x20LIKE\x20?',_0x193a3d+'%');}_0x3c2aff['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x193a3d+'%');}}_0xe7c7c0[_0xa8eb('0x40')](_0x3c2aff);_0xe7c7c0[_0xa8eb('0x83')]('i.id');var _0x79a545={'type':db['Sequelize']['QueryTypes'][_0xa8eb('0x84')],'raw':!![]};var _0x382da9=_0xe7c7c0[_0xa8eb('0x85')]();_0x382da9[_0xa8eb('0x42')]('i.id');_0x382da9[_0xa8eb('0x42')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xa8eb('0x5c'));if(_0x246931[_0xa8eb('0x3e')]){_0x246931[_0xa8eb('0x3e')]['forEach'](function(_0x3eb373){_0xe7c7c0[_0xa8eb('0x3e')]('i.'+_0x3eb373[0x0],_0x3eb373[0x1]==='DESC'?![]:!![]);});}if(!_[_0xa8eb('0x86')](_0x1b2bb8)){_0xe7c7c0[_0xa8eb('0x5d')](_0x50f65c);_0x382da9[_0xa8eb('0x40')](_0xa8eb('0x87'),_0x1b2bb8);}BPromise[_0xa8eb('0x88')]()[_0xa8eb('0x24')](function(){if(!_0x527ee0){if(_0x594923[_0xa8eb('0x35')][_0xa8eb('0x72')]||_0x594923[_0xa8eb('0x35')][_0xa8eb('0x89')])return;_0x382da9[_0xa8eb('0x40')](_0xa8eb('0x8a'));_0xe7c7c0[_0xa8eb('0x40')](_0xa8eb('0x8a'));return;}return _0x594923[_0xa8eb('0x8b')]['getFaxAccounts']({'attributes':['id'],'raw':!![]})['then'](function(_0x5cb335){if(_[_0xa8eb('0x86')](_0x5cb335)){_0x382da9[_0xa8eb('0x40')](_0xa8eb('0x8c'));_0xe7c7c0[_0xa8eb('0x40')](_0xa8eb('0x8c'));}else{_0x382da9[_0xa8eb('0x40')](_0xa8eb('0x73'),_['map'](_0x5cb335,'id'));_0xe7c7c0[_0xa8eb('0x40')](_0xa8eb('0x73'),_[_0xa8eb('0x2b')](_0x5cb335,'id'));}});})[_0xa8eb('0x24')](function(){db[_0xa8eb('0x8d')][_0xa8eb('0x35')](_0x382da9[_0xa8eb('0x8e')](),_0x79a545)[_0xa8eb('0x24')](function(_0x4a504c){_0x20b760['count']=_0x4a504c['length'];if(_0x20b760['count']===0x0)return[];return db[_0xa8eb('0x8d')]['query'](_0x5bcf53[_0xa8eb('0x8e')](),_0x79a545)[_0xa8eb('0x24')](function(_0x5c7d4a){_0x4613d3=_['keyBy'](_0x5c7d4a,'id');_0x79a545=_[_0xa8eb('0x8f')](_0x79a545,{'model':db[_0xa8eb('0x90')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x594923[_0xa8eb('0x35')][_0xa8eb('0x3a')]){_0x246931[_0xa8eb('0x39')][_0xa8eb('0x71')](function(_0x2f5568){_0xe7c7c0['field']('i.'+_0x2f5568);});}else{_0xe7c7c0[_0xa8eb('0x42')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xa8eb('0x5c'));_0xe7c7c0[_0xa8eb('0x42')](_0xa8eb('0x91'),'Account.key');_0xe7c7c0[_0xa8eb('0x42')](_0xa8eb('0x92'),_0xa8eb('0x93'));_0xe7c7c0[_0xa8eb('0x42')]('i.*');_0xe7c7c0[_0xa8eb('0x42')](_0xa8eb('0x94'),'Contact.firstName');_0xe7c7c0[_0xa8eb('0x42')](_0xa8eb('0x95'),_0xa8eb('0x96'));_0xe7c7c0[_0xa8eb('0x42')](_0xa8eb('0x97'),_0xa8eb('0x98'));_0xe7c7c0[_0xa8eb('0x42')](_0xa8eb('0x99'),_0xa8eb('0x9a'));_0xe7c7c0['field']('c.mobile',_0xa8eb('0x9b'));_0xe7c7c0[_0xa8eb('0x42')](_0xa8eb('0x9c'),'Contact.fax');_0xe7c7c0['field'](_0xa8eb('0x9d'),_0xa8eb('0x9e'));_0xe7c7c0[_0xa8eb('0x42')]('o.internal','Owner.internal');_0xe7c7c0[_0xa8eb('0x42')](_0xa8eb('0x9f'),_0xa8eb('0x2d'));}if(_0x246931['limit'])_0xe7c7c0[_0xa8eb('0x1f')](_0x246931[_0xa8eb('0x1f')]);if(_0x246931[_0xa8eb('0x1e')])_0xe7c7c0[_0xa8eb('0x1e')](_0x246931[_0xa8eb('0x1e')]);return db[_0xa8eb('0x8d')][_0xa8eb('0x35')](_0xe7c7c0[_0xa8eb('0x8e')](),_0x79a545);})[_0xa8eb('0x24')](function(_0x117b3d){_0x470e68[_0xa8eb('0x40')](_0xa8eb('0xa0'),_[_0xa8eb('0x2b')](_0x117b3d,'id'));return db[_0xa8eb('0x8d')][_0xa8eb('0x35')](_0x470e68['toString'](),_0x79a545)[_0xa8eb('0x24')](function(_0x3ab5d6){var _0x53fde3=_[_0xa8eb('0xa1')](_0x3ab5d6,'FaxInteractionId');var _0x353f82=[];_0x117b3d[_0xa8eb('0x71')](function(_0x6952c6){_0x353f82[_0xa8eb('0x2f')](updateFaxInteraction(_0x6952c6,_0x4613d3,_0x53fde3));});return BPromise[_0xa8eb('0xa2')](_0x353f82);});});})[_0xa8eb('0x24')](function(_0x2a5077){_0x20b760[_0xa8eb('0xa3')]=_0x2a5077;return _0x20b760;})[_0xa8eb('0x24')](respondWithFilteredResult(_0xed9001,_0x246931));})[_0xa8eb('0x30')](handleError(_0xed9001,null));};exports['show']=function(_0x1f2f37,_0x5af9d3){var _0x15119c={'raw':![],'where':{'id':_0x1f2f37['params']['id']}},_0x10ad83={};_0x10ad83[_0xa8eb('0x38')]=_['keys'](db[_0xa8eb('0x90')][_0xa8eb('0x31')]);_0x10ad83['query']=_[_0xa8eb('0x6e')](_0x1f2f37['query']);_0x10ad83[_0xa8eb('0x36')]=_['intersection'](_0x10ad83[_0xa8eb('0x38')],_0x10ad83[_0xa8eb('0x35')]);_0x15119c[_0xa8eb('0x39')]=_['intersection'](_0x10ad83[_0xa8eb('0x38')],qs['fields'](_0x1f2f37[_0xa8eb('0x35')][_0xa8eb('0x3a')]));_0x15119c[_0xa8eb('0x39')]=_0x15119c['attributes'][_0xa8eb('0x3b')]?_0x15119c[_0xa8eb('0x39')]:_0x10ad83[_0xa8eb('0x38')];if(_0x1f2f37[_0xa8eb('0x35')][_0xa8eb('0xa4')]){_0x15119c['include']=[{'all':!![]}];}_0x15119c=_[_0xa8eb('0x8f')]({},_0x15119c,_0x1f2f37[_0xa8eb('0xa5')]);return db[_0xa8eb('0x90')]['find'](_0x15119c)['then'](handleEntityNotFound(_0x5af9d3,null))[_0xa8eb('0x24')](respondWithResult(_0x5af9d3,null))[_0xa8eb('0x30')](handleError(_0x5af9d3,null));};exports[_0xa8eb('0xa6')]=function(_0x174a34,_0x19215f){return db[_0xa8eb('0x90')][_0xa8eb('0xa6')](_0x174a34['body'],{})[_0xa8eb('0x24')](respondWithResult(_0x19215f,0xc9))[_0xa8eb('0x30')](handleError(_0x19215f,null));};exports[_0xa8eb('0x23')]=function(_0x157732,_0xf25aea){if(_0x157732['body']['id']){delete _0x157732[_0xa8eb('0x6d')]['id'];}return db[_0xa8eb('0x90')][_0xa8eb('0x5b')]({'where':{'id':_0x157732[_0xa8eb('0xa7')]['id']}})[_0xa8eb('0x24')](handleEntityNotFound(_0xf25aea,null))[_0xa8eb('0x24')](saveUpdates(_0x157732['body'],null))['then'](respondWithResult(_0xf25aea,null))[_0xa8eb('0x30')](handleError(_0xf25aea,null));};exports[_0xa8eb('0x25')]=function(_0x1e738a,_0x25ea3c){return db['FaxInteraction'][_0xa8eb('0x5b')]({'where':{'id':_0x1e738a[_0xa8eb('0xa7')]['id']}})[_0xa8eb('0x24')](handleEntityNotFound(_0x25ea3c,null))[_0xa8eb('0x24')](removeEntity(_0x25ea3c,null))['catch'](handleError(_0x25ea3c,null));};exports['describe']=function(_0x3b1a2b,_0x3f3c29){return db['FaxInteraction'][_0xa8eb('0xa8')]()[_0xa8eb('0x24')](respondWithResult(_0x3f3c29,null))[_0xa8eb('0x30')](handleError(_0x3f3c29,null));};exports['addMessage']=function(_0x102b54,_0x59a424,_0x50d8e0){return db[_0xa8eb('0xa9')][_0xa8eb('0x5b')]({'where':{'id':_0x102b54[_0xa8eb('0xa7')]['id']}})[_0xa8eb('0x24')](handleEntityNotFound(_0x59a424,null))['then'](function(_0x37f37c){if(_0x37f37c){return _0x37f37c[_0xa8eb('0xaa')](_0x102b54['body']['ids'],_[_0xa8eb('0xab')](_0x102b54['body'],[_0xa8eb('0xac'),'id'])||{});}})['then'](respondWithResult(_0x59a424,null))[_0xa8eb('0x30')](handleError(_0x59a424,null));};exports[_0xa8eb('0xad')]=function(_0x85bc9,_0x7457b2,_0x294687){var _0x37fab8={'raw':![],'where':{}};var _0x3b9f87={};var _0xc3500b={'count':0x0,'rows':[]};return db[_0xa8eb('0x90')]['findOne']({'where':{'id':_0x85bc9[_0xa8eb('0xa7')]['id']}})['then'](handleEntityNotFound(_0x7457b2,null))['then'](function(_0x5a1b30){if(_0x5a1b30){_0x3b9f87[_0xa8eb('0x38')]=_[_0xa8eb('0x6e')](db[_0xa8eb('0xa9')][_0xa8eb('0x31')]);_0x3b9f87[_0xa8eb('0x35')]=_[_0xa8eb('0x6e')](_0x85bc9[_0xa8eb('0x35')]);_0x3b9f87[_0xa8eb('0x36')]=_['intersection'](_0x3b9f87[_0xa8eb('0x38')],_0x3b9f87[_0xa8eb('0x35')]);_0x37fab8[_0xa8eb('0x39')]=_[_0xa8eb('0x37')](_0x3b9f87[_0xa8eb('0x38')],qs[_0xa8eb('0x3a')](_0x85bc9[_0xa8eb('0x35')][_0xa8eb('0x3a')]));_0x37fab8[_0xa8eb('0x39')]=_0x37fab8[_0xa8eb('0x39')][_0xa8eb('0x3b')]?_0x37fab8['attributes']:_0x3b9f87[_0xa8eb('0x38')];if(!_0x85bc9['query'][_0xa8eb('0x3c')](_0xa8eb('0x3d'))){_0x37fab8['limit']=qs['limit'](_0x85bc9[_0xa8eb('0x35')][_0xa8eb('0x1f')]);_0x37fab8[_0xa8eb('0x1e')]=qs[_0xa8eb('0x1e')](_0x85bc9[_0xa8eb('0x35')]['offset']);}_0x37fab8['order']=qs['sort'](_0x85bc9[_0xa8eb('0x35')][_0xa8eb('0x3f')]);_0x37fab8[_0xa8eb('0x40')]=qs['filters'](_['pick'](_0x85bc9[_0xa8eb('0x35')],_0x3b9f87[_0xa8eb('0x36')]));_0x37fab8[_0xa8eb('0x40')][_0xa8eb('0xae')]=_0x5a1b30['id'];if(_0x85bc9[_0xa8eb('0x35')][_0xa8eb('0x7f')]){_0x37fab8[_0xa8eb('0x40')]=_[_0xa8eb('0x8f')](_0x37fab8[_0xa8eb('0x40')],{'$or':_['map'](_0x37fab8[_0xa8eb('0x39')],function(_0x37f975){var _0x1edd3d={};_0x1edd3d[_0x37f975]={'$like':'%'+_0x85bc9[_0xa8eb('0x35')][_0xa8eb('0x7f')]+'%'};return _0x1edd3d;})});}if(_0x85bc9[_0xa8eb('0x35')][_0xa8eb('0x76')]){var _0x10aad9=_0x85bc9[_0xa8eb('0x35')][_0xa8eb('0x76')][_0xa8eb('0x2e')](',');var _0x5bce2b={};_0x5bce2b[_0x10aad9[0x0]]={'$gte':moment(_0x10aad9[0x1])[_0xa8eb('0xaf')]('YYYY-MM-DD\x20HH:mm:ss')};_0x37fab8[_0xa8eb('0x40')]=_[_0xa8eb('0x8f')](_0x37fab8[_0xa8eb('0x40')],_0x5bce2b);}_0x37fab8=_[_0xa8eb('0x8f')]({},_0x37fab8,_0x85bc9[_0xa8eb('0xa5')]);return db[_0xa8eb('0xa9')][_0xa8eb('0x1d')]({'where':_0x37fab8[_0xa8eb('0x40')]})[_0xa8eb('0x24')](function(_0x5665f1){_0xc3500b['count']=_0x5665f1;if(_0x85bc9['query']['includeAll']){_0x37fab8[_0xa8eb('0xb0')]=[{'all':!![]}];}return db[_0xa8eb('0xa9')][_0xa8eb('0xb1')](_0x37fab8);})['then'](function(_0x4a3b83){_0xc3500b[_0xa8eb('0xa3')]=_0x4a3b83;return _0xc3500b;});}})[_0xa8eb('0x24')](respondWithFilteredResult(_0x7457b2,_0x37fab8))['catch'](handleError(_0x7457b2,null));};exports[_0xa8eb('0xb2')]=function(_0xf25768,_0x1b021f,_0x4595cb){return db[_0xa8eb('0x90')][_0xa8eb('0x5b')]({'where':{'id':_0xf25768[_0xa8eb('0xa7')]['id']}})[_0xa8eb('0x24')](handleEntityNotFound(_0x1b021f,null))[_0xa8eb('0x24')](function(_0x1cd5f8){if(_0x1cd5f8){return _0x1cd5f8['setTags'](_0xf25768['body'][_0xa8eb('0xac')],_[_0xa8eb('0xab')](_0xf25768['body'],['ids','id'])||{})[_0xa8eb('0xb3')](function(){return db[_0xa8eb('0x67')][_0xa8eb('0xb1')]({'attributes':['id',_0xa8eb('0x29'),_0xa8eb('0x43')],'where':{'id':_0xf25768['body'][_0xa8eb('0xac')]}});})[_0xa8eb('0x24')](function(_0x332f6a){socket[_0xa8eb('0xb4')](_0xa8eb('0xb5'),{'id':Number(_0xf25768['params']['id']),'tags':_0x332f6a||[]});return{'id':Number(_0xf25768[_0xa8eb('0xa7')]['id']),'tags':_0x332f6a||[]};});}})[_0xa8eb('0x24')](respondWithResult(_0x1b021f,null))['catch'](handleError(_0x1b021f,null));};exports[_0xa8eb('0xb6')]=function(_0x2c9cba,_0x1683c5,_0x4442dd){return db[_0xa8eb('0x90')][_0xa8eb('0x5b')]({'where':{'id':_0x2c9cba['params']['id']}})[_0xa8eb('0x24')](handleEntityNotFound(_0x1683c5,null))[_0xa8eb('0x24')](function(_0x49c3b5){if(_0x49c3b5){return _0x49c3b5[_0xa8eb('0xb6')](_0x2c9cba[_0xa8eb('0x35')][_0xa8eb('0xac')]);}})[_0xa8eb('0x24')](respondWithStatusCode(_0x1683c5,null))[_0xa8eb('0x30')](handleError(_0x1683c5,null));};exports[_0xa8eb('0xb7')]=function(_0x444e01,_0x120dd8){var _0x32f8ab=moment()[_0xa8eb('0xb8')]()[_0xa8eb('0x8e')]();var _0xbd2cec=path[_0xa8eb('0xb9')](config[_0xa8eb('0xba')],'server',_0xa8eb('0xbb'),'tmp');var _0x1a30bb=path['join'](config[_0xa8eb('0xba')],'server',_0xa8eb('0xbb'),_0xa8eb('0xbc'));var _0x102546=path[_0xa8eb('0xb9')](_0xbd2cec,_0x32f8ab);var _0x444ba6=util['format'](_0xa8eb('0xbd'),_0x444e01['params']['id'],_0x32f8ab);var _0x45cab1=path[_0xa8eb('0xb9')](_0xbd2cec,_0x444ba6);var _0x2dd90c=[];_0x2dd90c[_0xa8eb('0x2f')]({'model':db[_0xa8eb('0xbe')],'as':_0xa8eb('0xbe'),'raw':!![]});var _0x19f7f5=[{'model':db[_0xa8eb('0xa9')],'as':'Messages','attributes':['id','body',_0xa8eb('0x74')],'include':_0x2dd90c}];return db[_0xa8eb('0x90')][_0xa8eb('0x5b')]({'where':{'id':_0x444e01['params']['id']},'include':_0x19f7f5})['then'](handleEntityNotFound(_0x120dd8,null))[_0xa8eb('0x24')](function(_0x281d80){if(_0x281d80&&_0x281d80[_0xa8eb('0xbf')]){var _0x1c6988=_0x281d80[_0xa8eb('0xc0')]({'plain':!![]});fs['mkdirSync'](_0x102546);for(var _0x483f9c=0x0;_0x483f9c<_0x1c6988[_0xa8eb('0xbf')][_0xa8eb('0x3b')];_0x483f9c++){var _0x4aef65=_0x1c6988[_0xa8eb('0xbf')][_0x483f9c][_0xa8eb('0xbe')];if(_0x4aef65){var _0xd7b42e=path[_0xa8eb('0xb9')](_0x1a30bb,_0x4aef65[_0xa8eb('0xc1')]);if(fs[_0xa8eb('0xc2')](_0xd7b42e)){fs[_0xa8eb('0xc3')](_0xd7b42e)[_0xa8eb('0xc4')](fs[_0xa8eb('0xc5')](path['join'](_0x102546,_0x4aef65[_0xa8eb('0xc1')])));}}}return BPromise[_0xa8eb('0x88')]()['then'](function(){return new BPromise(function(_0x10b7a3,_0x15cb43){zipdir(_0x102546,{'saveTo':_0x45cab1},function(_0xd75663,_0x41ac8c){if(_0xd75663)return _0x15cb43(_0xd75663);return _0x10b7a3(_0x41ac8c);});})[_0xa8eb('0x24')](function(){return new BPromise(function(_0x2823d4,_0x4244ef){rimraf(_0x102546,function(_0x46dfe4){if(_0x46dfe4)_0x4244ef(_0x46dfe4);return _0x2823d4();});});})['then'](function(){return _0x120dd8['download'](_0x45cab1,_0x444ba6,function(_0x46c0ad){if(_0x46c0ad){console[_0xa8eb('0xc6')](_0xa8eb('0xc7'),_0x46c0ad);}else{fs[_0xa8eb('0xc8')](_0x45cab1);}});});});}else{return _0x120dd8['sendStatus'](0xc8);}})['catch'](handleError(_0x120dd8,null));}; \ No newline at end of file +var _0x3da6=['api','../../config/utils','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','end','json','offset','limit','set','apply','reject','save','update','then','destroy','error','stack','name','send','Users','map','fullname','Tags','TagIds','split','forEach','push','catch','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','nolimit','sort','select','field','color','from','tools_tags','u.id','ui.FaxInteractionId','user_has_fax_interactions','left_join','users','u.id\x20=\x20ui.UserId','fax_interactions','o.id\x20=\x20i.UserId','fax_accounts','a.id\x20=\x20i.FaxAccountId','fax_messages','me.FaxInteractionId\x20=\x20i.id','it.FaxInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','length','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','UserId','body','some','compact','isEmpty','FaxAccountId','i.FaxAccountId\x20IN\x20?','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','where','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','\x27\x27\x27\x27','isNumeric','i.id\x20LIKE\x20?','i.fax\x20LIKE\x20?','i.id','Sequelize','QueryTypes','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','t.id\x20IN\x20?','resolve','journey','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','sequelize','toString','count','keyBy','merge','FaxInteraction','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','c.mobile','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','ui.FaxInteractionId\x20IN\x20?','groupBy','all','show','rawAttributes','includeAll','options','create','params','describe','FaxMessage','addMessage','ids','omit','getMessages','findOne','hasOwnProperty','format','YYYY-MM-DD\x20HH:mm:ss','include','findAll','spread','emit','removeTags','download','unix','join','server','files','tmp','root','transcript-%d-%s.zip','Attachment','createdAt','mkdirSync','Messages','basename','existsSync','createReadStream','pipe','createWriteStream','err','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x3da6,0xc1));var _0x63da=function(_0x3ee9e5,_0x2f7539){_0x3ee9e5=_0x3ee9e5-0x0;var _0x2a7160=_0x3da6[_0x3ee9e5];return _0x2a7160;};'use strict';var pdf=require(_0x63da('0x0'));var emlformat=require(_0x63da('0x1'));var rimraf=require(_0x63da('0x2'));var zipdir=require(_0x63da('0x3'));var jsonpatch=require(_0x63da('0x4'));var rp=require(_0x63da('0x5'));var moment=require(_0x63da('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x63da('0x7'));var util=require(_0x63da('0x8'));var path=require('path');var sox=require(_0x63da('0x9'));var csv=require('to-csv');var ejs=require(_0x63da('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x63da('0xb'));var crypto=require(_0x63da('0xc'));var jsforce=require(_0x63da('0xd'));var deskjs=require(_0x63da('0xe'));var toCsv=require('to-csv');var querystring=require(_0x63da('0xf'));var Papa=require(_0x63da('0x10'));var Redis=require('ioredis');var authService=require(_0x63da('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x63da('0x12'));var hardwareService=require(_0x63da('0x13'));var logger=require(_0x63da('0x14'))(_0x63da('0x15'));var utils=require(_0x63da('0x16'));var config=require('../../config/environment');var db=require(_0x63da('0x17'))['db'];config['redis']=_[_0x63da('0x18')](config[_0x63da('0x19')],{'host':_0x63da('0x1a'),'port':0x18eb});var socket=require(_0x63da('0x1b'))(new Redis(config[_0x63da('0x19')]));require(_0x63da('0x1c'))[_0x63da('0x1d')](socket);function respondWithStatusCode(_0x2ad591,_0x37ce36){_0x37ce36=_0x37ce36||0xcc;return function(_0x26870d){if(_0x26870d){return _0x2ad591[_0x63da('0x1e')](_0x37ce36);}return _0x2ad591[_0x63da('0x1f')](_0x37ce36)[_0x63da('0x20')]();};}function respondWithResult(_0x4e6084,_0x48ac11){_0x48ac11=_0x48ac11||0xc8;return function(_0x12ffb3){if(_0x12ffb3){return _0x4e6084['status'](_0x48ac11)[_0x63da('0x21')](_0x12ffb3);}};}function respondWithFilteredResult(_0xe8c774,_0x329ef4){return function(_0x3128cd){if(_0x3128cd){var _0xaf41cb=_0x3128cd['count'],_0x5a26a2=_0x329ef4[_0x63da('0x22')],_0x8ce2aa=_0x329ef4['offset']+_0x329ef4[_0x63da('0x23')],_0x562ca8;if(_0x8ce2aa>=_0xaf41cb){_0x8ce2aa=_0xaf41cb;_0x562ca8=0xc8;}else{_0x562ca8=0xce;}_0xe8c774[_0x63da('0x1f')](_0x562ca8);return _0xe8c774[_0x63da('0x24')]('Content-Range',_0x5a26a2+'-'+_0x8ce2aa+'/'+_0xaf41cb)[_0x63da('0x21')](_0x3128cd);}return null;};}function patchUpdates(_0x112193){return function(_0x54b6c6){try{jsonpatch[_0x63da('0x25')](_0x54b6c6,_0x112193,!![]);}catch(_0x2a9f74){return BPromise[_0x63da('0x26')](_0x2a9f74);}return _0x54b6c6[_0x63da('0x27')]();};}function saveUpdates(_0x1e777b,_0x33e5c6){return function(_0x131dc9){if(_0x131dc9){return _0x131dc9[_0x63da('0x28')](_0x1e777b)[_0x63da('0x29')](function(_0x524c08){return _0x524c08;});}return null;};}function removeEntity(_0x55df4a,_0xef0017){return function(_0x32d43e){if(_0x32d43e){return _0x32d43e[_0x63da('0x2a')]()[_0x63da('0x29')](function(){_0x55df4a[_0x63da('0x1f')](0xcc)[_0x63da('0x20')]();});}};}function handleEntityNotFound(_0x5ebcbb,_0xc44172){return function(_0x15d548){if(!_0x15d548){_0x5ebcbb[_0x63da('0x1e')](0x194);}return _0x15d548;};}function handleError(_0x2d8810,_0x54acd0){_0x54acd0=_0x54acd0||0x1f4;return function(_0x172955){logger[_0x63da('0x2b')](_0x172955[_0x63da('0x2c')]);if(_0x172955[_0x63da('0x2d')]){delete _0x172955[_0x63da('0x2d')];}_0x2d8810[_0x63da('0x1f')](_0x54acd0)[_0x63da('0x2e')](_0x172955);};}function getInteractionUsers(_0x4b5e64,_0x5a4628){return new BPromise(function(_0x3c646a,_0x392617){try{if(_0x5a4628[_0x4b5e64['id']]){_0x4b5e64[_0x63da('0x2f')]=_[_0x63da('0x30')](_0x5a4628[_0x4b5e64['id']],function(_0x90788a){return{'id':_0x90788a['id'],'fullname':_0x90788a[_0x63da('0x31')]};});}}catch(_0x21530d){_0x392617(_0x21530d);}_0x3c646a(_0x4b5e64);});}function getInteractionTags(_0x152655,_0x56fcda){return new BPromise(function(_0x59c9ef,_0x3fb195){try{if(_0x152655['TagIds']){_0x152655[_0x63da('0x32')]=[];_0x152655[_0x63da('0x33')][_0x63da('0x34')](',')[_0x63da('0x35')](function(_0x347f24){_0x152655[_0x63da('0x32')][_0x63da('0x36')](_0x56fcda[_0x347f24]);});}delete _0x152655[_0x63da('0x33')];}catch(_0x52a432){_0x3fb195(_0x52a432);}_0x59c9ef(_0x152655);});}function updateFaxInteraction(_0x562146,_0x59bf28,_0x373135){return new BPromise(function(_0x501a84,_0x4f5c27){return getInteractionUsers(_0x562146,_0x373135)[_0x63da('0x29')](function(_0x1cb9e4){return getInteractionTags(_0x1cb9e4,_0x59bf28);})[_0x63da('0x29')](function(_0x413675){_0x501a84(_0x413675);})[_0x63da('0x37')](function(_0x4ed257){_0x4f5c27(_0x4ed257);});});}exports['index']=function(_0x1dd5ce,_0x4d1a57){var _0x22b138={},_0x17589c={},_0x110555={'count':0x0,'rows':[]};var _0x3a8bf6=_[_0x63da('0x30')](db['FaxInteraction']['rawAttributes'],function(_0x5c9df0){return{'name':_0x5c9df0[_0x63da('0x38')],'type':_0x5c9df0[_0x63da('0x39')][_0x63da('0x3a')]};});_0x17589c[_0x63da('0x3b')]=_['map'](_0x3a8bf6,'name');_0x17589c[_0x63da('0x3c')]=_[_0x63da('0x3d')](_0x1dd5ce[_0x63da('0x3c')]);_0x17589c[_0x63da('0x3e')]=_[_0x63da('0x3f')](_0x17589c[_0x63da('0x3b')],_0x17589c[_0x63da('0x3c')]);_0x22b138['attributes']=_['intersection'](_0x17589c[_0x63da('0x3b')],qs[_0x63da('0x40')](_0x1dd5ce[_0x63da('0x3c')][_0x63da('0x40')]));_0x22b138[_0x63da('0x41')]=_0x22b138[_0x63da('0x41')]['length']?_0x22b138['attributes']:_0x17589c['model'];if(!_0x1dd5ce[_0x63da('0x3c')]['hasOwnProperty'](_0x63da('0x42'))){_0x22b138['limit']=qs[_0x63da('0x23')](_0x1dd5ce[_0x63da('0x3c')]['limit']);_0x22b138[_0x63da('0x22')]=qs['offset'](_0x1dd5ce[_0x63da('0x3c')]['offset']);}_0x22b138['order']=qs[_0x63da('0x43')](_0x1dd5ce['query'][_0x63da('0x43')]);_0x22b138['where']=qs['filters'](_['pick'](_0x1dd5ce[_0x63da('0x3c')],_0x17589c[_0x63da('0x3e')]),_0x3a8bf6);var _0x4b6d00=[];var _0x5b999c=squel[_0x63da('0x44')]()[_0x63da('0x45')]('id')[_0x63da('0x45')](_0x63da('0x2d'))[_0x63da('0x45')](_0x63da('0x46'))[_0x63da('0x47')](_0x63da('0x48'));var _0x15d4ee=squel[_0x63da('0x44')]()[_0x63da('0x45')](_0x63da('0x49'))['field']('u.fullname')['field'](_0x63da('0x4a'))['from'](_0x63da('0x4b'),'ui')[_0x63da('0x4c')](_0x63da('0x4d'),'u',_0x63da('0x4e'));var _0x46d1e9=squel[_0x63da('0x44')]()[_0x63da('0x47')](_0x63da('0x4f'),'i')['left_join']('cm_contacts','c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x63da('0x4c')](_0x63da('0x4d'),'o',_0x63da('0x50'))['left_join'](_0x63da('0x51'),'a',_0x63da('0x52'))[_0x63da('0x4c')](_0x63da('0x53'),'me',_0x63da('0x54'))[_0x63da('0x4c')]('fax_interaction_has_tags','it',_0x63da('0x55'))[_0x63da('0x4c')]('tools_tags','t',_0x63da('0x56'));var _0x239657=squel[_0x63da('0x57')]();var _0xd20751=[];var _0x850a8=squel[_0x63da('0x57')]();var _0x4fadcc;if(_0x1dd5ce[_0x63da('0x3c')]['search']){_0x4fadcc=as[_0x63da('0x58')](_0x1dd5ce['query']['search']);var _0x338bbc=_0x4fadcc[_0x63da('0x59')];for(var _0x5d1dfa=0x0;_0x5d1dfa<_0x4fadcc[_0x63da('0x5a')]['length'];_0x5d1dfa++){var _0x4c7f48=_0x4fadcc[_0x63da('0x5a')][_0x5d1dfa];var _0x529886='i';var _0x50f95d=_[_0x63da('0x5b')](_0x3a8bf6,[_0x63da('0x2d'),_0x4c7f48[_0x63da('0x45')]]);if(!_0x50f95d){switch(_0x4c7f48[_0x63da('0x45')]){case _0x63da('0x5c'):if(_0x4c7f48[_0x63da('0x5d')]==0x1){_0x46d1e9[_0x63da('0x5e')]('`'+_0x4c7f48[_0x63da('0x45')]+_0x63da('0x5f'));}else{_0x46d1e9[_0x63da('0x5e')]('`'+_0x4c7f48['field']+_0x63da('0x60'));}break;case _0x63da('0x61'):if(_0x4c7f48[_0x63da('0x62')]===_0x63da('0x63')){if(_0x4c7f48[_0x63da('0x5d')][_0x63da('0x34')]('\x20')[_0x63da('0x64')]>0x1){_0x239657[_0x338bbc](_0x63da('0x65'),qs[_0x63da('0x66')](_0x4c7f48[_0x63da('0x5d')]),null);}else{var _0x511406='%'+_0x4c7f48[_0x63da('0x5d')]+'%';_0x239657[_0x338bbc](_0x63da('0x67'),_0x511406,_0x511406,_0x511406);}}else{_0x50f95d=_['find'](_0x3a8bf6,[_0x63da('0x2d'),_0x63da('0x68')]);_0x4c7f48[_0x63da('0x45')]=_0x63da('0x68');_0x2f89d3=as[_0x63da('0x69')](_0x529886,_0x50f95d[_0x63da('0x39')],_0x4c7f48);_0x239657[_0x338bbc](_0x2f89d3[_0x63da('0x6a')],_0x2f89d3[_0x63da('0x5d')][_0x63da('0x6b')],_0x2f89d3['value'][_0x63da('0x20')]);}break;case _0x63da('0x6c'):var _0x26f451=_0x4c7f48[_0x63da('0x5d')][_0x63da('0x34')](',')[_0x63da('0x30')](function(_0x11bf43){return Number(_0x11bf43);});_0x26f451[_0x63da('0x35')](function(_0x4d0471){_0x850a8['or'](_0x63da('0x6d'),'%,'+_0x4d0471+',%');});_0xd20751=_[_0x63da('0x6e')](_0xd20751,_0x26f451);break;case _0x63da('0x6f'):if(_0x4c7f48[_0x63da('0x62')]===_0x63da('0x63')){_0x239657[_0x338bbc]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x4c7f48[_0x63da('0x5d')]+'%',null);}else{_0x50f95d=_['find'](_0x3a8bf6,[_0x63da('0x2d'),_0x63da('0x70')]);_0x4c7f48[_0x63da('0x45')]=_0x63da('0x70');_0x2f89d3=as[_0x63da('0x69')](_0x529886,_0x50f95d['type'],_0x4c7f48);_0x239657[_0x338bbc](_0x2f89d3[_0x63da('0x6a')],_0x2f89d3[_0x63da('0x5d')][_0x63da('0x6b')],_0x2f89d3[_0x63da('0x5d')]['end']);}break;case _0x63da('0x71'):_0x2f89d3=as[_0x63da('0x69')]('me',null,_0x4c7f48);_0x239657[_0x338bbc](_0x2f89d3[_0x63da('0x6a')],_0x2f89d3['value'][_0x63da('0x6b')],_0x2f89d3[_0x63da('0x5d')]['end']);break;}}else{var _0x2f89d3=as[_0x63da('0x69')](_0x529886,_0x50f95d['type'],_0x4c7f48);_0x239657[_0x338bbc](_0x2f89d3[_0x63da('0x6a')],_0x2f89d3[_0x63da('0x5d')][_0x63da('0x6b')],_0x2f89d3[_0x63da('0x5d')][_0x63da('0x20')]);}}}else{var _0x503208=_(_0x1dd5ce[_0x63da('0x3c')])[_0x63da('0x3d')]()[_0x63da('0x30')](function(_0x4253ab){return _[_0x63da('0x72')](_0x3a8bf6,[_0x63da('0x2d'),_0x4253ab])?_0x4253ab:undefined;})[_0x63da('0x73')]()[_0x63da('0x5d')]();if(!_[_0x63da('0x74')](_0x503208)){_0x503208[_0x63da('0x35')](function(_0x2fba64){if(_0x2fba64===_0x63da('0x75')){_0x46d1e9['where'](_0x63da('0x76'),[]['concat'](_0x1dd5ce['query'][_0x2fba64]));}else if(_0x2fba64==='createdAt'){var _0x40b56f=JSON[_0x63da('0x77')](_0x1dd5ce[_0x63da('0x3c')][_0x2fba64])[_0x63da('0x78')];var _0x35ef7d=JSON[_0x63da('0x77')](_0x1dd5ce['query'][_0x2fba64])[_0x63da('0x79')];_0x46d1e9['where'](_0x63da('0x7a'),_0x40b56f,_0x35ef7d);}else{if(_0x1dd5ce['query'][_0x2fba64]==='null'){_0x46d1e9[_0x63da('0x7b')]('i.'+_0x2fba64+_0x63da('0x7c'));}else{_0x46d1e9[_0x63da('0x7b')]('i.'+_0x2fba64+'\x20=\x20?',_0x1dd5ce[_0x63da('0x3c')][_0x2fba64]);}}});}if(_0x1dd5ce[_0x63da('0x3c')][_0x63da('0x7d')]){if(_0x1dd5ce[_0x63da('0x3c')][_0x63da('0x7d')]==0x1){_0x46d1e9[_0x63da('0x5e')](_0x63da('0x7e'));}else{_0x46d1e9[_0x63da('0x5e')](_0x63da('0x7f'));}}if(_0x1dd5ce[_0x63da('0x3c')][_0x63da('0x80')]){_0xd20751=_[_0x63da('0x81')](_0x1dd5ce['query'][_0x63da('0x80')])?_0x1dd5ce[_0x63da('0x3c')][_0x63da('0x80')]:new Array(_0x1dd5ce[_0x63da('0x3c')][_0x63da('0x80')]);_0xd20751[_0x63da('0x35')](function(_0x33ddbc){_0x850a8['or'](_0x63da('0x6d'),'%,'+_0x33ddbc+',%');});}if(_0x1dd5ce[_0x63da('0x3c')][_0x63da('0x82')]){var _0x5d669f=_0x1dd5ce['query'][_0x63da('0x82')][_0x63da('0x83')]('\x5c','\x5c\x5c')[_0x63da('0x83')]('\x27\x27',_0x63da('0x84'));if(qs[_0x63da('0x85')](_0x5d669f)){_0x239657['or'](_0x63da('0x86'),_0x5d669f+'%')['or'](_0x63da('0x87'),_0x5d669f+'%');}_0x239657['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x5d669f+'%');}}_0x46d1e9[_0x63da('0x7b')](_0x239657);_0x46d1e9['group'](_0x63da('0x88'));var _0x1964e2={'type':db[_0x63da('0x89')][_0x63da('0x8a')][_0x63da('0x8b')],'raw':!![]};var _0x4f0b5c=_0x46d1e9['clone']();_0x4f0b5c[_0x63da('0x45')](_0x63da('0x88'));_0x4f0b5c['field'](_0x63da('0x8c'),'unreadMessages');if(_0x22b138[_0x63da('0x8d')]){_0x22b138[_0x63da('0x8d')][_0x63da('0x35')](function(_0x28dfa0){_0x46d1e9['order']('i.'+_0x28dfa0[0x0],_0x28dfa0[0x1]==='DESC'?![]:!![]);});}if(!_['isEmpty'](_0xd20751)){_0x46d1e9[_0x63da('0x5e')](_0x850a8);_0x4f0b5c[_0x63da('0x7b')](_0x63da('0x8e'),_0xd20751);}BPromise[_0x63da('0x8f')]()[_0x63da('0x29')](function(){if(!_0x4fadcc){if(_0x1dd5ce['query'][_0x63da('0x75')]||_0x1dd5ce[_0x63da('0x3c')][_0x63da('0x90')])return;_0x4f0b5c[_0x63da('0x7b')](_0x63da('0x91'));_0x46d1e9[_0x63da('0x7b')]('i.FaxAccountId\x20IS\x20NOT\x20NULL');return;}return _0x1dd5ce[_0x63da('0x92')][_0x63da('0x93')]({'attributes':['id'],'raw':!![]})[_0x63da('0x29')](function(_0x9c8ef7){if(_['isEmpty'](_0x9c8ef7)){_0x4f0b5c['where'](_0x63da('0x94'));_0x46d1e9[_0x63da('0x7b')]('i.FaxAccountId\x20IS\x20NULL');}else{_0x4f0b5c[_0x63da('0x7b')](_0x63da('0x76'),_[_0x63da('0x30')](_0x9c8ef7,'id'));_0x46d1e9[_0x63da('0x7b')](_0x63da('0x76'),_['map'](_0x9c8ef7,'id'));}});})[_0x63da('0x29')](function(){db[_0x63da('0x95')][_0x63da('0x3c')](_0x4f0b5c[_0x63da('0x96')](),_0x1964e2)[_0x63da('0x29')](function(_0x2bbaaa){_0x110555[_0x63da('0x97')]=_0x2bbaaa[_0x63da('0x64')];if(_0x110555[_0x63da('0x97')]===0x0)return[];return db[_0x63da('0x95')][_0x63da('0x3c')](_0x5b999c[_0x63da('0x96')](),_0x1964e2)[_0x63da('0x29')](function(_0x13b685){_0x4b6d00=_[_0x63da('0x98')](_0x13b685,'id');_0x1964e2=_[_0x63da('0x99')](_0x1964e2,{'model':db[_0x63da('0x9a')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1dd5ce[_0x63da('0x3c')][_0x63da('0x40')]){_0x22b138[_0x63da('0x41')][_0x63da('0x35')](function(_0x5a1af4){_0x46d1e9[_0x63da('0x45')]('i.'+_0x5a1af4);});}else{_0x46d1e9[_0x63da('0x45')](_0x63da('0x8c'),_0x63da('0x5c'));_0x46d1e9['field']('a.key',_0x63da('0x9b'));_0x46d1e9[_0x63da('0x45')](_0x63da('0x9c'),_0x63da('0x9d'));_0x46d1e9['field'](_0x63da('0x9e'));_0x46d1e9[_0x63da('0x45')]('c.firstName','Contact.firstName');_0x46d1e9['field'](_0x63da('0x9f'),_0x63da('0xa0'));_0x46d1e9[_0x63da('0x45')](_0x63da('0xa1'),_0x63da('0xa2'));_0x46d1e9[_0x63da('0x45')](_0x63da('0xa3'),'Contact.phone');_0x46d1e9[_0x63da('0x45')](_0x63da('0xa4'),_0x63da('0xa5'));_0x46d1e9[_0x63da('0x45')]('c.fax',_0x63da('0xa6'));_0x46d1e9[_0x63da('0x45')](_0x63da('0xa7'),_0x63da('0xa8'));_0x46d1e9[_0x63da('0x45')](_0x63da('0xa9'),_0x63da('0xaa'));_0x46d1e9[_0x63da('0x45')]('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');}if(_0x22b138[_0x63da('0x23')])_0x46d1e9[_0x63da('0x23')](_0x22b138[_0x63da('0x23')]);if(_0x22b138[_0x63da('0x22')])_0x46d1e9[_0x63da('0x22')](_0x22b138[_0x63da('0x22')]);return db[_0x63da('0x95')][_0x63da('0x3c')](_0x46d1e9[_0x63da('0x96')](),_0x1964e2);})[_0x63da('0x29')](function(_0x5aa3e8){_0x15d4ee[_0x63da('0x7b')](_0x63da('0xab'),_[_0x63da('0x30')](_0x5aa3e8,'id'));return db['sequelize'][_0x63da('0x3c')](_0x15d4ee[_0x63da('0x96')](),_0x1964e2)[_0x63da('0x29')](function(_0x94316a){var _0xc1ba33=_[_0x63da('0xac')](_0x94316a,'FaxInteractionId');var _0x59b2ab=[];_0x5aa3e8['forEach'](function(_0x5bbc4e){_0x59b2ab['push'](updateFaxInteraction(_0x5bbc4e,_0x4b6d00,_0xc1ba33));});return BPromise[_0x63da('0xad')](_0x59b2ab);});});})[_0x63da('0x29')](function(_0x319f68){_0x110555['rows']=_0x319f68;return _0x110555;})[_0x63da('0x29')](respondWithFilteredResult(_0x4d1a57,_0x22b138));})[_0x63da('0x37')](handleError(_0x4d1a57,null));};exports[_0x63da('0xae')]=function(_0x40bb07,_0x649658){var _0x690e46={'raw':![],'where':{'id':_0x40bb07['params']['id']}},_0x13b02f={};_0x13b02f[_0x63da('0x3b')]=_['keys'](db[_0x63da('0x9a')][_0x63da('0xaf')]);_0x13b02f[_0x63da('0x3c')]=_[_0x63da('0x3d')](_0x40bb07[_0x63da('0x3c')]);_0x13b02f[_0x63da('0x3e')]=_[_0x63da('0x3f')](_0x13b02f['model'],_0x13b02f[_0x63da('0x3c')]);_0x690e46[_0x63da('0x41')]=_[_0x63da('0x3f')](_0x13b02f[_0x63da('0x3b')],qs['fields'](_0x40bb07[_0x63da('0x3c')][_0x63da('0x40')]));_0x690e46[_0x63da('0x41')]=_0x690e46[_0x63da('0x41')][_0x63da('0x64')]?_0x690e46[_0x63da('0x41')]:_0x13b02f['model'];if(_0x40bb07[_0x63da('0x3c')][_0x63da('0xb0')]){_0x690e46['include']=[{'all':!![]}];}_0x690e46=_[_0x63da('0x99')]({},_0x690e46,_0x40bb07[_0x63da('0xb1')]);return db[_0x63da('0x9a')][_0x63da('0x5b')](_0x690e46)[_0x63da('0x29')](handleEntityNotFound(_0x649658,null))[_0x63da('0x29')](respondWithResult(_0x649658,null))['catch'](handleError(_0x649658,null));};exports['create']=function(_0x23c538,_0x4e7638){return db[_0x63da('0x9a')][_0x63da('0xb2')](_0x23c538[_0x63da('0x71')],{})['then'](respondWithResult(_0x4e7638,0xc9))[_0x63da('0x37')](handleError(_0x4e7638,null));};exports[_0x63da('0x28')]=function(_0x11031c,_0x432d98){if(_0x11031c[_0x63da('0x71')]['id']){delete _0x11031c[_0x63da('0x71')]['id'];}return db[_0x63da('0x9a')][_0x63da('0x5b')]({'where':{'id':_0x11031c[_0x63da('0xb3')]['id']}})[_0x63da('0x29')](handleEntityNotFound(_0x432d98,null))[_0x63da('0x29')](saveUpdates(_0x11031c[_0x63da('0x71')],null))[_0x63da('0x29')](respondWithResult(_0x432d98,null))['catch'](handleError(_0x432d98,null));};exports[_0x63da('0x2a')]=function(_0x2ec9cd,_0x4871f6){return db[_0x63da('0x9a')][_0x63da('0x5b')]({'where':{'id':_0x2ec9cd[_0x63da('0xb3')]['id']}})[_0x63da('0x29')](handleEntityNotFound(_0x4871f6,null))[_0x63da('0x29')](removeEntity(_0x4871f6,null))[_0x63da('0x37')](handleError(_0x4871f6,null));};exports[_0x63da('0xb4')]=function(_0x13077b,_0x245658){return db[_0x63da('0x9a')][_0x63da('0xb4')]()['then'](respondWithResult(_0x245658,null))['catch'](handleError(_0x245658,null));};exports['addMessage']=function(_0x54adc4,_0x3286e5,_0x5b2817){return db[_0x63da('0xb5')][_0x63da('0x5b')]({'where':{'id':_0x54adc4[_0x63da('0xb3')]['id']}})[_0x63da('0x29')](handleEntityNotFound(_0x3286e5,null))['then'](function(_0x4ab41c){if(_0x4ab41c){return _0x4ab41c[_0x63da('0xb6')](_0x54adc4[_0x63da('0x71')][_0x63da('0xb7')],_[_0x63da('0xb8')](_0x54adc4[_0x63da('0x71')],[_0x63da('0xb7'),'id'])||{});}})[_0x63da('0x29')](respondWithResult(_0x3286e5,null))[_0x63da('0x37')](handleError(_0x3286e5,null));};exports[_0x63da('0xb9')]=function(_0x2c04ac,_0x4d50d2,_0x2f4007){var _0x2cfe83={'raw':![],'where':{}};var _0x2a30fc={};var _0x16a129={'count':0x0,'rows':[]};return db[_0x63da('0x9a')][_0x63da('0xba')]({'where':{'id':_0x2c04ac[_0x63da('0xb3')]['id']}})[_0x63da('0x29')](handleEntityNotFound(_0x4d50d2,null))['then'](function(_0x28ddc0){if(_0x28ddc0){_0x2a30fc['model']=_[_0x63da('0x3d')](db[_0x63da('0xb5')][_0x63da('0xaf')]);_0x2a30fc['query']=_[_0x63da('0x3d')](_0x2c04ac['query']);_0x2a30fc[_0x63da('0x3e')]=_['intersection'](_0x2a30fc[_0x63da('0x3b')],_0x2a30fc['query']);_0x2cfe83[_0x63da('0x41')]=_[_0x63da('0x3f')](_0x2a30fc[_0x63da('0x3b')],qs['fields'](_0x2c04ac[_0x63da('0x3c')][_0x63da('0x40')]));_0x2cfe83[_0x63da('0x41')]=_0x2cfe83['attributes']['length']?_0x2cfe83[_0x63da('0x41')]:_0x2a30fc[_0x63da('0x3b')];if(!_0x2c04ac['query'][_0x63da('0xbb')](_0x63da('0x42'))){_0x2cfe83[_0x63da('0x23')]=qs[_0x63da('0x23')](_0x2c04ac[_0x63da('0x3c')][_0x63da('0x23')]);_0x2cfe83[_0x63da('0x22')]=qs[_0x63da('0x22')](_0x2c04ac[_0x63da('0x3c')][_0x63da('0x22')]);}_0x2cfe83['order']=qs[_0x63da('0x43')](_0x2c04ac[_0x63da('0x3c')][_0x63da('0x43')]);_0x2cfe83[_0x63da('0x7b')]=qs[_0x63da('0x3e')](_['pick'](_0x2c04ac[_0x63da('0x3c')],_0x2a30fc[_0x63da('0x3e')]));_0x2cfe83[_0x63da('0x7b')]['FaxInteractionId']=_0x28ddc0['id'];if(_0x2c04ac['query'][_0x63da('0x82')]){_0x2cfe83[_0x63da('0x7b')]=_[_0x63da('0x99')](_0x2cfe83[_0x63da('0x7b')],{'$or':_['map'](_0x2cfe83[_0x63da('0x41')],function(_0x4e69c0){var _0x40992e={};_0x40992e[_0x4e69c0]={'$like':'%'+_0x2c04ac['query'][_0x63da('0x82')]+'%'};return _0x40992e;})});}if(_0x2c04ac[_0x63da('0x3c')][_0x63da('0x78')]){var _0x1a385a=_0x2c04ac[_0x63da('0x3c')][_0x63da('0x78')][_0x63da('0x34')](',');var _0x17f4a9={};_0x17f4a9[_0x1a385a[0x0]]={'$gte':moment(_0x1a385a[0x1])[_0x63da('0xbc')](_0x63da('0xbd'))};_0x2cfe83[_0x63da('0x7b')]=_['merge'](_0x2cfe83[_0x63da('0x7b')],_0x17f4a9);}_0x2cfe83=_['merge']({},_0x2cfe83,_0x2c04ac[_0x63da('0xb1')]);return db[_0x63da('0xb5')][_0x63da('0x97')]({'where':_0x2cfe83['where']})['then'](function(_0x10a67b){_0x16a129[_0x63da('0x97')]=_0x10a67b;if(_0x2c04ac[_0x63da('0x3c')]['includeAll']){_0x2cfe83[_0x63da('0xbe')]=[{'all':!![]}];}return db[_0x63da('0xb5')][_0x63da('0xbf')](_0x2cfe83);})[_0x63da('0x29')](function(_0x521e3f){_0x16a129['rows']=_0x521e3f;return _0x16a129;});}})['then'](respondWithFilteredResult(_0x4d50d2,_0x2cfe83))['catch'](handleError(_0x4d50d2,null));};exports['addTags']=function(_0x3eb52f,_0xb6f6fc,_0x169e34){return db[_0x63da('0x9a')][_0x63da('0x5b')]({'where':{'id':_0x3eb52f[_0x63da('0xb3')]['id']}})[_0x63da('0x29')](handleEntityNotFound(_0xb6f6fc,null))[_0x63da('0x29')](function(_0x1c3591){if(_0x1c3591){return _0x1c3591['setTags'](_0x3eb52f[_0x63da('0x71')][_0x63da('0xb7')],_[_0x63da('0xb8')](_0x3eb52f[_0x63da('0x71')],[_0x63da('0xb7'),'id'])||{})[_0x63da('0xc0')](function(){return db['Tag'][_0x63da('0xbf')]({'attributes':['id',_0x63da('0x2d'),_0x63da('0x46')],'where':{'id':_0x3eb52f[_0x63da('0x71')][_0x63da('0xb7')]}});})[_0x63da('0x29')](function(_0x435853){socket[_0x63da('0xc1')]('faxInteractionTags:save',{'id':Number(_0x3eb52f['params']['id']),'tags':_0x435853||[]});return{'id':Number(_0x3eb52f[_0x63da('0xb3')]['id']),'tags':_0x435853||[]};});}})[_0x63da('0x29')](respondWithResult(_0xb6f6fc,null))[_0x63da('0x37')](handleError(_0xb6f6fc,null));};exports[_0x63da('0xc2')]=function(_0x3a3254,_0xfd8c3b,_0x4463cc){return db[_0x63da('0x9a')]['find']({'where':{'id':_0x3a3254[_0x63da('0xb3')]['id']}})[_0x63da('0x29')](handleEntityNotFound(_0xfd8c3b,null))['then'](function(_0x19fc86){if(_0x19fc86){return _0x19fc86['removeTags'](_0x3a3254[_0x63da('0x3c')]['ids']);}})['then'](respondWithStatusCode(_0xfd8c3b,null))[_0x63da('0x37')](handleError(_0xfd8c3b,null));};exports[_0x63da('0xc3')]=function(_0x37d170,_0x1c6dbd){var _0x406b0c=moment()[_0x63da('0xc4')]()[_0x63da('0x96')]();var _0x232c13=path[_0x63da('0xc5')](config['root'],_0x63da('0xc6'),_0x63da('0xc7'),_0x63da('0xc8'));var _0x174088=path['join'](config[_0x63da('0xc9')],_0x63da('0xc6'),_0x63da('0xc7'),'attachments');var _0x27e4f3=path[_0x63da('0xc5')](_0x232c13,_0x406b0c);var _0x32f708=util['format'](_0x63da('0xca'),_0x37d170[_0x63da('0xb3')]['id'],_0x406b0c);var _0x1b2449=path['join'](_0x232c13,_0x32f708);var _0x11dcbb=[];_0x11dcbb[_0x63da('0x36')]({'model':db[_0x63da('0xcb')],'as':_0x63da('0xcb'),'raw':!![]});var _0x5a3ee2=[{'model':db['FaxMessage'],'as':'Messages','attributes':['id',_0x63da('0x71'),_0x63da('0xcc')],'include':_0x11dcbb}];return db[_0x63da('0x9a')][_0x63da('0x5b')]({'where':{'id':_0x37d170[_0x63da('0xb3')]['id']},'include':_0x5a3ee2})['then'](handleEntityNotFound(_0x1c6dbd,null))['then'](function(_0x268a38){if(_0x268a38&&_0x268a38['Messages']){var _0x151975=_0x268a38['get']({'plain':!![]});fs[_0x63da('0xcd')](_0x27e4f3);for(var _0x343c8d=0x0;_0x343c8d<_0x151975['Messages'][_0x63da('0x64')];_0x343c8d++){var _0x3499c5=_0x151975[_0x63da('0xce')][_0x343c8d][_0x63da('0xcb')];if(_0x3499c5){var _0x15693a=path[_0x63da('0xc5')](_0x174088,_0x3499c5[_0x63da('0xcf')]);if(fs[_0x63da('0xd0')](_0x15693a)){fs[_0x63da('0xd1')](_0x15693a)[_0x63da('0xd2')](fs[_0x63da('0xd3')](path[_0x63da('0xc5')](_0x27e4f3,_0x3499c5[_0x63da('0xcf')])));}}}return BPromise[_0x63da('0x8f')]()[_0x63da('0x29')](function(){return new BPromise(function(_0x39433d,_0x3a8b28){zipdir(_0x27e4f3,{'saveTo':_0x1b2449},function(_0x153e1f,_0x38cc0f){if(_0x153e1f)return _0x3a8b28(_0x153e1f);return _0x39433d(_0x38cc0f);});})[_0x63da('0x29')](function(){return new BPromise(function(_0x210c10,_0x3fbfae){rimraf(_0x27e4f3,function(_0x56adbf){if(_0x56adbf)_0x3fbfae(_0x56adbf);return _0x210c10();});});})[_0x63da('0x29')](function(){return _0x1c6dbd[_0x63da('0xc3')](_0x1b2449,_0x32f708,function(_0x287bfd){if(_0x287bfd){console['log'](_0x63da('0xd4'),_0x287bfd);}else{fs[_0x63da('0xd5')](_0x1b2449);}});});});}else{return _0x1c6dbd[_0x63da('0x1e')](0xc8);}})[_0x63da('0x37')](handleError(_0x1c6dbd,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index bd1cabe..1ff75a9 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(_0x5dc5cb,_0x11f12d){var _0x74b231=function(_0x5ca349){while(--_0x5ca349){_0x5dc5cb['push'](_0x5dc5cb['shift']());}};_0x74b231(++_0x11f12d);}(_0x326f,0xd1));var _0xf326=function(_0x2c4e2c,_0x3a6cb8){_0x2c4e2c=_0x2c4e2c-0x0;var _0x2ea7d4=_0x326f[_0x2c4e2c];return _0x2ea7d4;};'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 _0x1261=['exports','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','emit','hasOwnProperty'];(function(_0x3babfc,_0x686d9c){var _0x47e5b4=function(_0x2f77be){while(--_0x2f77be){_0x3babfc['push'](_0x3babfc['shift']());}};_0x47e5b4(++_0x686d9c);}(_0x1261,0x144));var _0x1126=function(_0x242e41,_0x2beb78){_0x242e41=_0x242e41-0x0;var _0x171510=_0x1261[_0x242e41];return _0x171510;};'use strict';var EventEmitter=require('events');var FaxInteraction=require(_0x1126('0x0'))['db'][_0x1126('0x1')];var FaxMessage=require(_0x1126('0x0'))['db'][_0x1126('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x1126('0x3')](0x0);var events={'afterCreate':_0x1126('0x4'),'afterUpdate':_0x1126('0x5'),'afterDestroy':_0x1126('0x6')};function emitEvent(_0x21a480){return function(_0x75a851,_0x5a2189,_0x5c68c8){_0x75a851[_0x1126('0x7')]({'attributes':['id'],'raw':!![]})[_0x1126('0x8')](function(_0x4f239c){_0x75a851[_0x1126('0x9')](_0x1126('0xa'),_0x4f239c[_0x1126('0xb')](function(_0x3abb0b){return{'id':_0x3abb0b['id']};}));return FaxMessage[_0x1126('0xc')]({'where':{'FaxInteractionId':_0x75a851['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x3f09ac){_0x75a851[_0x1126('0x9')](_0x1126('0xd'),_0x3f09ac['length']);FaxInteractionEvents[_0x1126('0xe')](_0x21a480+':'+_0x75a851['id'],_0x75a851);FaxInteractionEvents['emit'](_0x21a480,_0x75a851);_0x5c68c8(null);})['catch'](_0x5c68c8(null));};}for(var e in events){if(events[_0x1126('0xf')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0x1126('0x10')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index ea83a1d..9c97a78 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 _0x79eb=['exports','define','FaxInteraction','fax_interactions','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','moment','path','rimraf','./faxInteraction.attributes'];(function(_0x2f3b44,_0x54d1a0){var _0x2f406e=function(_0x176344){while(--_0x176344){_0x2f3b44['push'](_0x2f3b44['shift']());}};_0x2f406e(++_0x54d1a0);}(_0x79eb,0x1e8));var _0xb79e=function(_0x5c053b,_0x3159c6){_0x5c053b=_0x5c053b-0x0;var _0x1db17a=_0x79eb[_0x5c053b];return _0x1db17a;};'use strict';var _=require(_0xb79e('0x0'));var util=require('util');var logger=require(_0xb79e('0x1'))(_0xb79e('0x2'));var moment=require(_0xb79e('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xb79e('0x4'));var rimraf=require(_0xb79e('0x5'));var config=require('../../config/environment');var attributes=require(_0xb79e('0x6'));module[_0xb79e('0x7')]=function(_0x870f3a,_0x2822df){return _0x870f3a[_0xb79e('0x8')](_0xb79e('0x9'),attributes,{'tableName':_0xb79e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x342aa5,_0x2bdc2b,_0x32aeee){if(_0x342aa5[_0xb79e('0xb')]('closed')){_0x342aa5[_0xb79e('0xc')]=moment()[_0xb79e('0xd')](_0xb79e('0xe'));}_0x32aeee(null,_0x342aa5);}}});}; \ No newline at end of file +var _0x84c1=['api','moment','bluebird','request-promise','../../config/environment','./faxInteraction.attributes','define','FaxInteraction','changed','closedAt','format','../../config/logger'];(function(_0x439110,_0x5c8275){var _0x4c3743=function(_0xd5e3ec){while(--_0xd5e3ec){_0x439110['push'](_0x439110['shift']());}};_0x4c3743(++_0x5c8275);}(_0x84c1,0x137));var _0x184c=function(_0xf6969c,_0x59e54c){_0xf6969c=_0xf6969c-0x0;var _0x3633ff=_0x84c1[_0xf6969c];return _0x3633ff;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x184c('0x0'))(_0x184c('0x1'));var moment=require(_0x184c('0x2'));var BPromise=require(_0x184c('0x3'));var rp=require(_0x184c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x184c('0x5'));var attributes=require(_0x184c('0x6'));module['exports']=function(_0x422ee4,_0x138961){return _0x422ee4[_0x184c('0x7')](_0x184c('0x8'),attributes,{'tableName':'fax_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3e2f7a,_0x2d8271,_0x54690c){if(_0x3e2f7a[_0x184c('0x9')]('closed')){_0x3e2f7a[_0x184c('0xa')]=moment()[_0x184c('0xb')]('YYYY-MM-DD\x20HH:mm:ss');}_0x54690c(null,_0x3e2f7a);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 539dc3e..07788d1 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 _0x41c9=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','request','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateFaxInteraction','FaxInteraction','update','options','raw','where','attributes','limit','then','find','addTags','body','ids','omit','spread','AddTags','lodash','util','moment','ioredis','../../mysqldb'];(function(_0x231510,_0x207dac){var _0x364e1a=function(_0x5c900b){while(--_0x5c900b){_0x231510['push'](_0x231510['shift']());}};_0x364e1a(++_0x207dac);}(_0x41c9,0x15b));var _0x941c=function(_0x24d0a0,_0x38b28f){_0x24d0a0=_0x24d0a0-0x0;var _0x30c1c6=_0x41c9[_0x24d0a0];return _0x30c1c6;};'use strict';var _=require(_0x941c('0x0'));var util=require(_0x941c('0x1'));var moment=require(_0x941c('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x941c('0x3'));var db=require(_0x941c('0x4'))['db'];var utils=require(_0x941c('0x5'));var logger=require(_0x941c('0x6'))('rpc');var config=require(_0x941c('0x7'));var jayson=require(_0x941c('0x8'));var client=jayson['client'][_0x941c('0x9')]({'port':0x232a});config[_0x941c('0xa')]=_[_0x941c('0xb')](config[_0x941c('0xa')],{'host':_0x941c('0xc'),'port':0x18eb});var socket=require(_0x941c('0xd'))(new Redis(config[_0x941c('0xa')]));require(_0x941c('0xe'))[_0x941c('0xf')](socket);function respondWithRpcPromise(_0x3adf67,_0x35de2c,_0x195c30){return new BPromise(function(_0x49a123,_0x1b855b){return client[_0x941c('0x10')](_0x3adf67,_0x195c30)['then'](function(_0x5db19a){logger[_0x941c('0x11')](_0x941c('0x12'),_0x35de2c,_0x941c('0x13'));logger[_0x941c('0x14')](_0x941c('0x15'),_0x35de2c,_0x941c('0x13'),JSON[_0x941c('0x16')](_0x5db19a));if(_0x5db19a[_0x941c('0x17')]){if(_0x5db19a[_0x941c('0x17')][_0x941c('0x18')]===0x1f4){logger[_0x941c('0x17')](_0x941c('0x12'),_0x35de2c,_0x5db19a[_0x941c('0x17')][_0x941c('0x19')]);return _0x1b855b(_0x5db19a[_0x941c('0x17')][_0x941c('0x19')]);}logger[_0x941c('0x17')](_0x941c('0x12'),_0x35de2c,_0x5db19a['error']['message']);return _0x49a123(_0x5db19a[_0x941c('0x17')][_0x941c('0x19')]);}else{logger[_0x941c('0x11')]('FaxInteraction,\x20%s,\x20%s',_0x35de2c,_0x941c('0x13'));_0x49a123(_0x5db19a[_0x941c('0x1a')][_0x941c('0x19')]);}})[_0x941c('0x1b')](function(_0x58c141){logger[_0x941c('0x17')](_0x941c('0x12'),_0x35de2c,_0x58c141);_0x1b855b(_0x58c141);});});}exports[_0x941c('0x1c')]=function(_0x18ee90){var _0x3d0579=this;return new Promise(function(_0x2d4c97,_0x25236e){return db[_0x941c('0x1d')][_0x941c('0x1e')](_0x18ee90['body'],{'raw':_0x18ee90[_0x941c('0x1f')]?_0x18ee90[_0x941c('0x1f')][_0x941c('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x18ee90['options']?_0x18ee90['options'][_0x941c('0x21')]||null:null,'attributes':_0x18ee90[_0x941c('0x1f')]?_0x18ee90[_0x941c('0x1f')][_0x941c('0x22')]||null:null,'limit':_0x18ee90[_0x941c('0x1f')]?_0x18ee90[_0x941c('0x1f')][_0x941c('0x23')]||null:null})[_0x941c('0x24')](function(_0x2c8189){logger['info'](_0x941c('0x1c'),_0x18ee90);logger[_0x941c('0x14')](_0x941c('0x1c'),_0x18ee90,JSON[_0x941c('0x16')](_0x2c8189));_0x2d4c97(_0x2c8189);})[_0x941c('0x1b')](function(_0x3c6bc2){logger[_0x941c('0x17')](_0x941c('0x1c'),_0x3c6bc2[_0x941c('0x19')],_0x18ee90);_0x25236e(_0x3d0579[_0x941c('0x17')](0x1f4,_0x3c6bc2[_0x941c('0x19')]));});});};exports['AddTagsToFaxInteraction']=function(_0x2e7ea4){return new Promise(function(_0x9b1bdf,_0x42095c){return db[_0x941c('0x1d')][_0x941c('0x25')]({'where':_0x2e7ea4[_0x941c('0x1f')]?_0x2e7ea4[_0x941c('0x1f')][_0x941c('0x21')]||null:null})[_0x941c('0x24')](function(_0x2fc84f){if(_0x2fc84f){return _0x2fc84f[_0x941c('0x26')](_0x2e7ea4[_0x941c('0x27')][_0x941c('0x28')],_[_0x941c('0x29')](_0x2e7ea4[_0x941c('0x27')],[_0x941c('0x28'),'id'])||{});}})[_0x941c('0x2a')](function(_0x2ec7e6){logger['info'](_0x941c('0x2b'),_0x2e7ea4);logger[_0x941c('0x14')](_0x941c('0x2b'),_0x2e7ea4,JSON['stringify'](_0x2ec7e6));_0x9b1bdf(_0x2ec7e6);})[_0x941c('0x1b')](function(_0x501fee){logger[_0x941c('0x17')](_0x941c('0x2b'),_0x501fee[_0x941c('0x19')],_0x2e7ea4);_0x42095c(_this['error'](0x1f4,_0x501fee[_0x941c('0x19')]));});});}; \ No newline at end of file +var _0x3514=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','request','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','error','result','message','catch','UpdateFaxInteraction','options','raw','where','attributes','then','FaxInteraction','find','addTags','body','ids','omit','AddTags','stringify','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x4ef56b,_0x1f8891){var _0x58b4de=function(_0x38c402){while(--_0x38c402){_0x4ef56b['push'](_0x4ef56b['shift']());}};_0x58b4de(++_0x1f8891);}(_0x3514,0x6d));var _0x4351=function(_0x598b42,_0x48dc5d){_0x598b42=_0x598b42-0x0;var _0x9391d1=_0x3514[_0x598b42];return _0x9391d1;};'use strict';var _=require('lodash');var util=require(_0x4351('0x0'));var moment=require('moment');var BPromise=require(_0x4351('0x1'));var rs=require(_0x4351('0x2'));var fs=require('fs');var Redis=require(_0x4351('0x3'));var db=require(_0x4351('0x4'))['db'];var utils=require(_0x4351('0x5'));var logger=require('../../config/logger')(_0x4351('0x6'));var config=require(_0x4351('0x7'));var jayson=require(_0x4351('0x8'));var client=jayson[_0x4351('0x9')][_0x4351('0xa')]({'port':0x232a});config[_0x4351('0xb')]=_[_0x4351('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x4351('0xd'))(new Redis(config[_0x4351('0xb')]));require('./faxInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x3d86b5,_0x233a95,_0x13f8d9){return new BPromise(function(_0xdab358,_0x479df0){return client[_0x4351('0xe')](_0x3d86b5,_0x13f8d9)['then'](function(_0x17ddc1){logger[_0x4351('0xf')](_0x4351('0x10'),_0x233a95,_0x4351('0x11'));logger[_0x4351('0x12')](_0x4351('0x13'),_0x233a95,_0x4351('0x11'),JSON['stringify'](_0x17ddc1));if(_0x17ddc1[_0x4351('0x14')]){if(_0x17ddc1[_0x4351('0x14')]['code']===0x1f4){logger[_0x4351('0x14')]('FaxInteraction,\x20%s,\x20%s',_0x233a95,_0x17ddc1[_0x4351('0x14')]['message']);return _0x479df0(_0x17ddc1[_0x4351('0x14')]['message']);}logger[_0x4351('0x14')](_0x4351('0x10'),_0x233a95,_0x17ddc1[_0x4351('0x14')]['message']);return _0xdab358(_0x17ddc1[_0x4351('0x14')]['message']);}else{logger[_0x4351('0xf')](_0x4351('0x10'),_0x233a95,'request\x20sent');_0xdab358(_0x17ddc1[_0x4351('0x15')][_0x4351('0x16')]);}})[_0x4351('0x17')](function(_0x5ee8d8){logger[_0x4351('0x14')](_0x4351('0x10'),_0x233a95,_0x5ee8d8);_0x479df0(_0x5ee8d8);});});}exports[_0x4351('0x18')]=function(_0x3c6d1b){var _0x375b72=this;return new Promise(function(_0x27dbac,_0x961798){return db['FaxInteraction']['update'](_0x3c6d1b['body'],{'raw':_0x3c6d1b[_0x4351('0x19')]?_0x3c6d1b[_0x4351('0x19')][_0x4351('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3c6d1b['options']?_0x3c6d1b[_0x4351('0x19')][_0x4351('0x1b')]||null:null,'attributes':_0x3c6d1b[_0x4351('0x19')]?_0x3c6d1b[_0x4351('0x19')][_0x4351('0x1c')]||null:null,'limit':_0x3c6d1b['options']?_0x3c6d1b[_0x4351('0x19')]['limit']||null:null})[_0x4351('0x1d')](function(_0x2aa51c){logger[_0x4351('0xf')]('UpdateFaxInteraction',_0x3c6d1b);logger[_0x4351('0x12')](_0x4351('0x18'),_0x3c6d1b,JSON['stringify'](_0x2aa51c));_0x27dbac(_0x2aa51c);})['catch'](function(_0x5c086c){logger['error']('UpdateFaxInteraction',_0x5c086c[_0x4351('0x16')],_0x3c6d1b);_0x961798(_0x375b72['error'](0x1f4,_0x5c086c['message']));});});};exports['AddTagsToFaxInteraction']=function(_0x5e4496){return new Promise(function(_0x32db35,_0x13f66a){return db[_0x4351('0x1e')][_0x4351('0x1f')]({'where':_0x5e4496[_0x4351('0x19')]?_0x5e4496[_0x4351('0x19')][_0x4351('0x1b')]||null:null})[_0x4351('0x1d')](function(_0x2ab938){if(_0x2ab938){return _0x2ab938[_0x4351('0x20')](_0x5e4496[_0x4351('0x21')][_0x4351('0x22')],_[_0x4351('0x23')](_0x5e4496['body'],['ids','id'])||{});}})['spread'](function(_0x1c1ac9){logger[_0x4351('0xf')](_0x4351('0x24'),_0x5e4496);logger['debug'](_0x4351('0x24'),_0x5e4496,JSON[_0x4351('0x25')](_0x1c1ac9));_0x32db35(_0x1c1ac9);})[_0x4351('0x17')](function(_0x1ceb90){logger[_0x4351('0x14')](_0x4351('0x24'),_0x1ceb90[_0x4351('0x16')],_0x5e4496);_0x13f66a(_this[_0x4351('0x14')](0x1f4,_0x1ceb90[_0x4351('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index a7f11ee..c1c0608 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 _0x8d73=['remove','update','register','length','faxInteraction:','./faxInteraction.events'];(function(_0x1035a9,_0x301969){var _0x310e4a=function(_0x2cdee7){while(--_0x2cdee7){_0x1035a9['push'](_0x1035a9['shift']());}};_0x310e4a(++_0x301969);}(_0x8d73,0x1af));var _0x38d7=function(_0x45dafe,_0x9ff797){_0x45dafe=_0x45dafe-0x0;var _0x5e7f7e=_0x8d73[_0x45dafe];return _0x5e7f7e;};'use strict';var FaxInteractionEvents=require(_0x38d7('0x0'));var events=['save',_0x38d7('0x1'),_0x38d7('0x2')];function createListener(_0x4068db,_0x200dc0){return function(_0xf92c98){_0x200dc0['emit'](_0x4068db,_0xf92c98);};}function removeListener(_0x3c79bb,_0xf1732b){return function(){FaxInteractionEvents['removeListener'](_0x3c79bb,_0xf1732b);};}exports[_0x38d7('0x3')]=function(_0x4d34d6){for(var _0x4cd943=0x0,_0x42d6f7=events[_0x38d7('0x4')];_0x4cd943<_0x42d6f7;_0x4cd943++){var _0x24c11f=events[_0x4cd943];var _0x2cd283=createListener(_0x38d7('0x5')+_0x24c11f,_0x4d34d6);FaxInteractionEvents['on'](_0x24c11f,_0x2cd283);}}; \ No newline at end of file +var _0xfda3=['remove','update','emit','register','length','faxInteraction:','save'];(function(_0x228255,_0x5d8de7){var _0x55770a=function(_0x452cae){while(--_0x452cae){_0x228255['push'](_0x228255['shift']());}};_0x55770a(++_0x5d8de7);}(_0xfda3,0x125));var _0x3fda=function(_0x43cd9f,_0x57d758){_0x43cd9f=_0x43cd9f-0x0;var _0x5cf244=_0xfda3[_0x43cd9f];return _0x5cf244;};'use strict';var FaxInteractionEvents=require('./faxInteraction.events');var events=[_0x3fda('0x0'),_0x3fda('0x1'),_0x3fda('0x2')];function createListener(_0x574cf3,_0x2e9da3){return function(_0x1036cb){_0x2e9da3[_0x3fda('0x3')](_0x574cf3,_0x1036cb);};}function removeListener(_0x28d305,_0x343432){return function(){FaxInteractionEvents['removeListener'](_0x28d305,_0x343432);};}exports[_0x3fda('0x4')]=function(_0x71156f){for(var _0x7dc1c9=0x0,_0x3d9888=events[_0x3fda('0x5')];_0x7dc1c9<_0x3d9888;_0x7dc1c9++){var _0x1e6161=events[_0x7dc1c9];var _0x2631b2=createListener(_0x3fda('0x6')+_0x1e6161,_0x71156f);FaxInteractionEvents['on'](_0x1e6161,_0x2631b2);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 2237a60..2ef67d8 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 _0xecee=['faxinteraction:destroy','destroy','removeTags','multer','util','path','connect-timeout','../../components/interaction/service','./faxInteraction.controller','isAuthenticated','index','/describe','get','/:id','show','/:id/messages','/:id/download','download','create','post','/:id/tags','fax','faxinteraction:addtags','addTags','put','tracked','update','delete'];(function(_0x56a061,_0x53fb1b){var _0x105fa0=function(_0x164d08){while(--_0x164d08){_0x56a061['push'](_0x56a061['shift']());}};_0x105fa0(++_0x53fb1b);}(_0xecee,0x1a7));var _0xeece=function(_0x44b668,_0xebc29c){_0x44b668=_0x44b668-0x0;var _0x28e78a=_0xecee[_0x44b668];return _0x28e78a;};'use strict';var multer=require(_0xeece('0x0'));var util=require(_0xeece('0x1'));var path=require(_0xeece('0x2'));var timeout=require(_0xeece('0x3'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xeece('0x4'));var config=require('../../config/environment');var controller=require(_0xeece('0x5'));router['get']('/',auth[_0xeece('0x6')](),controller[_0xeece('0x7')]);router['get'](_0xeece('0x8'),auth[_0xeece('0x6')](),controller['describe']);router[_0xeece('0x9')](_0xeece('0xa'),auth[_0xeece('0x6')](),controller[_0xeece('0xb')]);router[_0xeece('0x9')](_0xeece('0xc'),auth[_0xeece('0x6')](),controller['getMessages']);router['get'](_0xeece('0xd'),auth[_0xeece('0x6')](),controller[_0xeece('0xe')]);router['post']('/',auth[_0xeece('0x6')](),controller[_0xeece('0xf')]);router[_0xeece('0x10')]('/:id/messages',auth[_0xeece('0x6')](),controller['addMessage']);router[_0xeece('0x10')](_0xeece('0x11'),auth[_0xeece('0x6')](),interaction['tracked'](_0xeece('0x12'),_0xeece('0x13')),controller[_0xeece('0x14')]);router[_0xeece('0x15')](_0xeece('0xa'),auth['isAuthenticated'](),interaction[_0xeece('0x16')]('fax','faxinteraction:update'),controller[_0xeece('0x17')]);router[_0xeece('0x18')](_0xeece('0xa'),auth[_0xeece('0x6')](),interaction[_0xeece('0x16')](_0xeece('0x12'),_0xeece('0x19')),controller[_0xeece('0x1a')]);router[_0xeece('0x18')](_0xeece('0x11'),auth[_0xeece('0x6')](),controller[_0xeece('0x1b')]);module['exports']=router; \ No newline at end of file +var _0x7a34=['post','addMessage','/:id/tags','tracked','faxinteraction:addtags','addTags','put','/:id','fax','faxinteraction:update','update','faxinteraction:destroy','destroy','delete','removeTags','exports','path','connect-timeout','Router','../../components/auth/service','./faxInteraction.controller','index','get','/describe','isAuthenticated','show','/:id/messages','getMessages','download','create'];(function(_0x774a25,_0x46f547){var _0x3dc2fd=function(_0x27de02){while(--_0x27de02){_0x774a25['push'](_0x774a25['shift']());}};_0x3dc2fd(++_0x46f547);}(_0x7a34,0xa6));var _0x47a3=function(_0x297dd0,_0x42520d){_0x297dd0=_0x297dd0-0x0;var _0x3ad126=_0x7a34[_0x297dd0];return _0x3ad126;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x47a3('0x0'));var timeout=require(_0x47a3('0x1'));var express=require('express');var router=express[_0x47a3('0x2')]();var auth=require(_0x47a3('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x47a3('0x4'));router['get']('/',auth['isAuthenticated'](),controller[_0x47a3('0x5')]);router[_0x47a3('0x6')](_0x47a3('0x7'),auth[_0x47a3('0x8')](),controller['describe']);router[_0x47a3('0x6')]('/:id',auth[_0x47a3('0x8')](),controller[_0x47a3('0x9')]);router[_0x47a3('0x6')](_0x47a3('0xa'),auth['isAuthenticated'](),controller[_0x47a3('0xb')]);router[_0x47a3('0x6')]('/:id/download',auth[_0x47a3('0x8')](),controller[_0x47a3('0xc')]);router['post']('/',auth[_0x47a3('0x8')](),controller[_0x47a3('0xd')]);router[_0x47a3('0xe')](_0x47a3('0xa'),auth[_0x47a3('0x8')](),controller[_0x47a3('0xf')]);router[_0x47a3('0xe')](_0x47a3('0x10'),auth[_0x47a3('0x8')](),interaction[_0x47a3('0x11')]('fax',_0x47a3('0x12')),controller[_0x47a3('0x13')]);router[_0x47a3('0x14')](_0x47a3('0x15'),auth[_0x47a3('0x8')](),interaction['tracked'](_0x47a3('0x16'),_0x47a3('0x17')),controller[_0x47a3('0x18')]);router['delete'](_0x47a3('0x15'),auth[_0x47a3('0x8')](),interaction['tracked'](_0x47a3('0x16'),_0x47a3('0x19')),controller[_0x47a3('0x1a')]);router[_0x47a3('0x1b')]('/:id/tags',auth['isAuthenticated'](),controller[_0x47a3('0x1c')]);module[_0x47a3('0x1d')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index a778695..9f91237 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 _0x761e=['ENUM','out','exports','TEXT','medium','BOOLEAN'];(function(_0x26caae,_0x62a08f){var _0x1caa52=function(_0x35742e){while(--_0x35742e){_0x26caae['push'](_0x26caae['shift']());}};_0x1caa52(++_0x62a08f);}(_0x761e,0x104));var _0xe761=function(_0x31e5cb,_0x2f5adf){_0x31e5cb=_0x31e5cb-0x0;var _0x4170df=_0x761e[_0x31e5cb];return _0x4170df;};'use strict';var Sequelize=require('sequelize');module[_0xe761('0x0')]={'body':{'type':Sequelize[_0xe761('0x1')](_0xe761('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xe761('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xe761('0x4')]('in','out'),'defaultValue':_0xe761('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize[_0xe761('0x1')],'defaultValue':null},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0x7ef3=['DATE','sequelize','exports','TEXT','medium','BOOLEAN','ENUM','out'];(function(_0x1deb03,_0xd05ad8){var _0x189fe7=function(_0x321225){while(--_0x321225){_0x1deb03['push'](_0x1deb03['shift']());}};_0x189fe7(++_0xd05ad8);}(_0x7ef3,0x1d9));var _0x37ef=function(_0x5cc8b9,_0x20e3c3){_0x5cc8b9=_0x5cc8b9-0x0;var _0x58892e=_0x7ef3[_0x5cc8b9];return _0x58892e;};'use strict';var Sequelize=require(_0x37ef('0x0'));module[_0x37ef('0x1')]={'body':{'type':Sequelize[_0x37ef('0x2')](_0x37ef('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x37ef('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x37ef('0x5')]('in',_0x37ef('0x6')),'defaultValue':_0x37ef('0x6'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x37ef('0x2')],'defaultValue':null},'readAt':{'type':Sequelize[_0x37ef('0x7')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index b29f116..f405282 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 _0x1614=['nolimit','limit','where','filter','merge','include','FaxMessage','findAll','rows','catch','show','params','includeAll','options','find','body','destroy','describe','fax-interactions','accept','fax','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','Contact','get','FaxInteraction','FaxInteractionId','isNil','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','AcceptMessage','acceptMessage','manual','SIP/%s','channel','EventManager','acceptmessage','agent','null','rejectMessage','interface','event','rejectmessage','create','CmContact','findOne','Attachment','SendFax','/var/opt/motion2/server/files/attachments/%s','basename','AttachmentId','join','server','files','attachments','download','html-pdf','eml-format','rimraf','zip-dir','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','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','socket.io-emitter','register','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','request\x20sent','debug','stringify','error','message','FaxMessage,\x20%s,\x20%s','result','sendStatus','status','end','json','count','offset','Content-Range','apply','reject','save','update','then','stack','name','send','index','map','rawAttributes','type','keys','filters','intersection','model','query','attributes','fields','length'];(function(_0x1a7431,_0x3ee90){var _0xf745d0=function(_0x328260){while(--_0x328260){_0x1a7431['push'](_0x1a7431['shift']());}};_0xf745d0(++_0x3ee90);}(_0x1614,0xc4));var _0x4161=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0x1614[_0x4bfac3];return _0x15f0f2;};'use strict';var pdf=require(_0x4161('0x0'));var emlformat=require(_0x4161('0x1'));var rimraf=require(_0x4161('0x2'));var zipdir=require(_0x4161('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4161('0x4'));var moment=require(_0x4161('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x4161('0x6'));var util=require(_0x4161('0x7'));var path=require(_0x4161('0x8'));var sox=require(_0x4161('0x9'));var csv=require(_0x4161('0xa'));var ejs=require(_0x4161('0xb'));var fs=require('fs');var _=require(_0x4161('0xc'));var squel=require(_0x4161('0xd'));var crypto=require(_0x4161('0xe'));var jsforce=require(_0x4161('0xf'));var deskjs=require(_0x4161('0x10'));var toCsv=require(_0x4161('0xa'));var querystring=require(_0x4161('0x11'));var Papa=require('papaparse');var Redis=require(_0x4161('0x12'));var authService=require(_0x4161('0x13'));var qs=require(_0x4161('0x14'));var as=require(_0x4161('0x15'));var hardwareService=require(_0x4161('0x16'));var logger=require(_0x4161('0x17'))(_0x4161('0x18'));var utils=require(_0x4161('0x19'));var config=require(_0x4161('0x1a'));var db=require(_0x4161('0x1b'))['db'];config[_0x4161('0x1c')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x4161('0x1d'))(new Redis(config[_0x4161('0x1c')]));require('./faxMessage.socket')[_0x4161('0x1e')](socket);var jayson=require(_0x4161('0x1f'));var client=jayson[_0x4161('0x20')][_0x4161('0x21')]({'port':0x232c});var client9002=jayson[_0x4161('0x20')][_0x4161('0x21')]({'port':0x232a});function checkPasswordPattern(_0x4cf54e,_0x22443c,_0x25c24e){if(_0x25c24e){var _0x1d6ebf=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1d6ebf[_0x4161('0x22')](_0x22443c)){return _0x4cf54e;}else{throw new db[(_0x4161('0x23'))][(_0x4161('0x24'))](_0x4161('0x25'));}}else{return _0x4cf54e;}}function respondWithRpcPromise(_0x597b0b,_0x17d334,_0x6c79f4,_0x34ac10){return new BPromise(function(_0x38f44f,_0xc47d64){var _0x122ab=_0x34ac10||client;return _0x122ab[_0x4161('0x26')](_0x597b0b,_0x6c79f4)['then'](function(_0x4ca186){logger[_0x4161('0x27')]('FaxMessage,\x20%s,\x20%s',_0x17d334,_0x4161('0x28'));logger[_0x4161('0x29')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x17d334,_0x4161('0x28'),JSON[_0x4161('0x2a')](_0x4ca186));if(_0x4ca186[_0x4161('0x2b')]){if(_0x4ca186['error']['code']===0x1f4){logger['error']('FaxMessage,\x20%s,\x20%s',_0x17d334,_0x4ca186['error'][_0x4161('0x2c')]);return _0xc47d64(_0x4ca186[_0x4161('0x2b')][_0x4161('0x2c')]);}logger['error'](_0x4161('0x2d'),_0x17d334,_0x4ca186['error']['message']);return _0x38f44f(_0x4ca186['error'][_0x4161('0x2c')]);}else{logger[_0x4161('0x27')](_0x4161('0x2d'),_0x17d334,'request\x20sent');_0x38f44f(_0x4ca186[_0x4161('0x2e')][_0x4161('0x2c')]);}})['catch'](function(_0x1109cd){logger['error'](_0x4161('0x2d'),_0x17d334,_0x1109cd);_0xc47d64(_0x1109cd);});});}function respondWithStatusCode(_0xf29ac5,_0x318d2a){_0x318d2a=_0x318d2a||0xcc;return function(_0x252e29){if(_0x252e29){return _0xf29ac5[_0x4161('0x2f')](_0x318d2a);}return _0xf29ac5[_0x4161('0x30')](_0x318d2a)[_0x4161('0x31')]();};}function respondWithResult(_0x3ecdc6,_0x948c64){_0x948c64=_0x948c64||0xc8;return function(_0x4ad4f1){if(_0x4ad4f1){return _0x3ecdc6['status'](_0x948c64)[_0x4161('0x32')](_0x4ad4f1);}};}function respondWithFilteredResult(_0x341eb4,_0x5c0919){return function(_0x449c00){if(_0x449c00){var _0x48ff47=_0x449c00[_0x4161('0x33')],_0x70252e=_0x5c0919[_0x4161('0x34')],_0x9fd5d=_0x5c0919[_0x4161('0x34')]+_0x5c0919['limit'],_0x596c88;if(_0x9fd5d>=_0x48ff47){_0x9fd5d=_0x48ff47;_0x596c88=0xc8;}else{_0x596c88=0xce;}_0x341eb4['status'](_0x596c88);return _0x341eb4['set'](_0x4161('0x35'),_0x70252e+'-'+_0x9fd5d+'/'+_0x48ff47)[_0x4161('0x32')](_0x449c00);}return null;};}function patchUpdates(_0x2677e3){return function(_0x21d868){try{jsonpatch[_0x4161('0x36')](_0x21d868,_0x2677e3,!![]);}catch(_0x544e5f){return BPromise[_0x4161('0x37')](_0x544e5f);}return _0x21d868[_0x4161('0x38')]();};}function saveUpdates(_0x4621d5,_0x3e9a1c){return function(_0x4a2758){if(_0x4a2758){return _0x4a2758[_0x4161('0x39')](_0x4621d5)[_0x4161('0x3a')](function(_0x4fad6e){return _0x4fad6e;});}return null;};}function removeEntity(_0x3de73a,_0x289c49){return function(_0x2711b8){if(_0x2711b8){return _0x2711b8['destroy']()[_0x4161('0x3a')](function(){_0x3de73a[_0x4161('0x30')](0xcc)[_0x4161('0x31')]();});}};}function handleEntityNotFound(_0x5e22e4,_0xd3922c){return function(_0x56f670){if(!_0x56f670){_0x5e22e4[_0x4161('0x2f')](0x194);}return _0x56f670;};}function handleError(_0x2a3d54,_0x37c0d2){_0x37c0d2=_0x37c0d2||0x1f4;return function(_0x34076a){logger[_0x4161('0x2b')](_0x34076a[_0x4161('0x3b')]);if(_0x34076a[_0x4161('0x3c')]){delete _0x34076a['name'];}_0x2a3d54[_0x4161('0x30')](_0x37c0d2)[_0x4161('0x3d')](_0x34076a);};}exports[_0x4161('0x3e')]=function(_0x48fa62,_0x4083ff){var _0x12bf7c={},_0x1b9d52={},_0x21fbdf={'count':0x0,'rows':[]};var _0x2e34f9=_[_0x4161('0x3f')](db['FaxMessage'][_0x4161('0x40')],function(_0x4c3711){return{'name':_0x4c3711['fieldName'],'type':_0x4c3711[_0x4161('0x41')]['key']};});_0x1b9d52['model']=_['map'](_0x2e34f9,'name');_0x1b9d52['query']=_[_0x4161('0x42')](_0x48fa62['query']);_0x1b9d52[_0x4161('0x43')]=_[_0x4161('0x44')](_0x1b9d52[_0x4161('0x45')],_0x1b9d52[_0x4161('0x46')]);_0x12bf7c[_0x4161('0x47')]=_[_0x4161('0x44')](_0x1b9d52['model'],qs[_0x4161('0x48')](_0x48fa62['query'][_0x4161('0x48')]));_0x12bf7c[_0x4161('0x47')]=_0x12bf7c[_0x4161('0x47')][_0x4161('0x49')]?_0x12bf7c[_0x4161('0x47')]:_0x1b9d52[_0x4161('0x45')];if(!_0x48fa62[_0x4161('0x46')]['hasOwnProperty'](_0x4161('0x4a'))){_0x12bf7c[_0x4161('0x4b')]=qs['limit'](_0x48fa62[_0x4161('0x46')][_0x4161('0x4b')]);_0x12bf7c['offset']=qs[_0x4161('0x34')](_0x48fa62[_0x4161('0x46')][_0x4161('0x34')]);}_0x12bf7c['order']=qs['sort'](_0x48fa62[_0x4161('0x46')]['sort']);_0x12bf7c[_0x4161('0x4c')]=qs[_0x4161('0x43')](_['pick'](_0x48fa62[_0x4161('0x46')],_0x1b9d52['filters']),_0x2e34f9);if(_0x48fa62['query'][_0x4161('0x4d')]){_0x12bf7c[_0x4161('0x4c')]=_[_0x4161('0x4e')](_0x12bf7c['where'],{'$or':_[_0x4161('0x3f')](_0x2e34f9,function(_0x77b239){if(_0x77b239[_0x4161('0x41')]!=='VIRTUAL'){var _0x4dc964={};_0x4dc964[_0x77b239['name']]={'$like':'%'+_0x48fa62[_0x4161('0x46')][_0x4161('0x4d')]+'%'};return _0x4dc964;}})});}_0x12bf7c=_['merge']({},_0x12bf7c,_0x48fa62['options']);var _0x3844a0={'where':_0x12bf7c[_0x4161('0x4c')]};return db['FaxMessage'][_0x4161('0x33')](_0x3844a0)['then'](function(_0x2bef65){_0x21fbdf[_0x4161('0x33')]=_0x2bef65;if(_0x48fa62[_0x4161('0x46')]['includeAll']){_0x12bf7c[_0x4161('0x4f')]=[{'all':!![]}];}return db[_0x4161('0x50')][_0x4161('0x51')](_0x12bf7c);})['then'](function(_0x27708c){_0x21fbdf[_0x4161('0x52')]=_0x27708c;return _0x21fbdf;})['then'](respondWithFilteredResult(_0x4083ff,_0x12bf7c))[_0x4161('0x53')](handleError(_0x4083ff,null));};exports[_0x4161('0x54')]=function(_0x5805c5,_0x27da2d){var _0x3b7b68={'raw':!![],'where':{'id':_0x5805c5[_0x4161('0x55')]['id']}},_0x44f269={};_0x44f269[_0x4161('0x45')]=_['keys'](db[_0x4161('0x50')]['rawAttributes']);_0x44f269[_0x4161('0x46')]=_[_0x4161('0x42')](_0x5805c5[_0x4161('0x46')]);_0x44f269[_0x4161('0x43')]=_[_0x4161('0x44')](_0x44f269[_0x4161('0x45')],_0x44f269[_0x4161('0x46')]);_0x3b7b68[_0x4161('0x47')]=_[_0x4161('0x44')](_0x44f269[_0x4161('0x45')],qs[_0x4161('0x48')](_0x5805c5[_0x4161('0x46')]['fields']));_0x3b7b68['attributes']=_0x3b7b68['attributes'][_0x4161('0x49')]?_0x3b7b68[_0x4161('0x47')]:_0x44f269[_0x4161('0x45')];if(_0x5805c5[_0x4161('0x46')][_0x4161('0x56')]){_0x3b7b68['include']=[{'all':!![]}];}_0x3b7b68=_[_0x4161('0x4e')]({},_0x3b7b68,_0x5805c5[_0x4161('0x57')]);return db[_0x4161('0x50')][_0x4161('0x58')](_0x3b7b68)[_0x4161('0x3a')](handleEntityNotFound(_0x27da2d,null))['then'](respondWithResult(_0x27da2d,null))['catch'](handleError(_0x27da2d,null));};exports[_0x4161('0x39')]=function(_0x40b6c1,_0xeab925){if(_0x40b6c1['body']['id']){delete _0x40b6c1[_0x4161('0x59')]['id'];}return db['FaxMessage'][_0x4161('0x58')]({'where':{'id':_0x40b6c1[_0x4161('0x55')]['id']}})[_0x4161('0x3a')](handleEntityNotFound(_0xeab925,null))[_0x4161('0x3a')](saveUpdates(_0x40b6c1['body'],null))['then'](respondWithResult(_0xeab925,null))[_0x4161('0x53')](handleError(_0xeab925,null));};exports[_0x4161('0x5a')]=function(_0x31a162,_0x56ce88){return db['FaxMessage'][_0x4161('0x58')]({'where':{'id':_0x31a162[_0x4161('0x55')]['id']}})[_0x4161('0x3a')](handleEntityNotFound(_0x56ce88,null))['then'](removeEntity(_0x56ce88,null))[_0x4161('0x53')](handleError(_0x56ce88,null));};exports[_0x4161('0x5b')]=function(_0x25e4fc,_0x5b1387){return db[_0x4161('0x50')][_0x4161('0x5b')]()[_0x4161('0x3a')](respondWithResult(_0x5b1387,null))[_0x4161('0x53')](handleError(_0x5b1387,null));};var interaction_log=require(_0x4161('0x17'))(_0x4161('0x5c'));exports[_0x4161('0x5d')]=function(_0x279c04,_0x109412,_0x48e2bd){var _0x285612={'channel':_0x4161('0x5e')};if(_0x279c04[_0x4161('0x59')]['id']){delete _0x279c04[_0x4161('0x59')]['id'];}_0x279c04[_0x4161('0x59')][_0x4161('0x5f')]=!![];_0x279c04[_0x4161('0x59')][_0x4161('0x60')]=moment()[_0x4161('0x61')](_0x4161('0x62'));_0x279c04[_0x4161('0x59')][_0x4161('0x63')]=_0x279c04[_0x4161('0x59')]['UserId']||_0x279c04['user']['id'];return db[_0x4161('0x50')][_0x4161('0x58')]({'where':{'id':_0x279c04[_0x4161('0x55')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0x4161('0x64')}]})[_0x4161('0x3a')](handleEntityNotFound(_0x109412,null))[_0x4161('0x3a')](saveUpdates(_0x279c04[_0x4161('0x59')],null))['then'](function(_0x17aa25){if(_0x17aa25){_0x285612[_0x4161('0x2c')]=_0x17aa25[_0x4161('0x65')]({'plain':!![]});return db[_0x4161('0x66')][_0x4161('0x58')]({'where':{'id':_0x17aa25[_0x4161('0x67')]}});}return null;})[_0x4161('0x3a')](handleEntityNotFound(_0x109412,null))['then'](function(_0x28787a){if(_0x28787a){return _0x28787a[_0x4161('0x39')]({'UserId':_0x279c04[_0x4161('0x59')][_0x4161('0x63')],'read1stAt':_[_0x4161('0x68')](_0x28787a['read1stAt'])?moment()[_0x4161('0x61')](_0x4161('0x62')):undefined});}return null;})[_0x4161('0x3a')](function(_0x3685ee){if(_0x3685ee){_0x285612[_0x4161('0x69')]=_0x3685ee[_0x4161('0x65')]({'plain':!![]});interaction_log[_0x4161('0x27')](_0x4161('0x6a'),_0x279c04[_0x4161('0x6b')]['id'],_0x279c04['user'][_0x4161('0x3c')],_0x279c04['user'][_0x4161('0x6c')],_0x285612[_0x4161('0x69')]['id'],_0x279c04[_0x4161('0x59')]?JSON[_0x4161('0x2a')](_0x279c04[_0x4161('0x59')]):'null');return respondWithRpcPromise(_0x4161('0x6d'),_0x4161('0x6e'),_0x285612);}return null;})[_0x4161('0x3a')](function(_0xdf3017){if(_0xdf3017){if(_0x279c04[_0x4161('0x59')][_0x4161('0x6f')]){_0x285612[_0x4161('0x2c')]['interface']=util[_0x4161('0x61')](_0x4161('0x70'),_0x279c04[_0x4161('0x6b')]['name']);_0x285612[_0x4161('0x2c')][_0x4161('0x71')]=_0x285612[_0x4161('0x71')];_0x285612[_0x4161('0x2c')]['event']=_0x4161('0x5d');return respondWithRpcPromise(_0x4161('0x72'),_0x4161('0x72'),{'event':_0x4161('0x73'),'message':_0x285612[_0x4161('0x2c')]},client9002)[_0x4161('0x3a')](function(){return _0x285612;});}return _0x285612;}return null;})[_0x4161('0x3a')](respondWithResult(_0x109412,null))[_0x4161('0x53')](handleError(_0x109412,null));};var interaction_log=require(_0x4161('0x17'))(_0x4161('0x5c'));exports['reject']=function(_0x25990a,_0x291407,_0x4648fe){var _0xa95740={'agent':{},'channel':_0x4161('0x5e')};if(_0x25990a['body']['id']){delete _0x25990a['body']['id'];}_0x25990a['body']['UserId']=_0x25990a[_0x4161('0x59')][_0x4161('0x63')]||_0x25990a[_0x4161('0x6b')]['id'];_0xa95740[_0x4161('0x74')]['id']=_0x25990a[_0x4161('0x59')]['UserId'];return db[_0x4161('0x50')][_0x4161('0x58')]({'where':{'id':_0x25990a['params']['id'],'UserId':null}})[_0x4161('0x3a')](handleEntityNotFound(_0x291407,null))[_0x4161('0x3a')](function(_0x29458e){if(_0x29458e){_0xa95740[_0x4161('0x2c')]=_0x29458e[_0x4161('0x65')]({'plain':!![]});return db[_0x4161('0x66')]['find']({'where':{'id':_0x29458e[_0x4161('0x67')]}});}return null;})['then'](handleEntityNotFound(_0x291407,null))['then'](function(_0x3c6baa){if(_0x3c6baa){_0xa95740[_0x4161('0x69')]=_0x3c6baa[_0x4161('0x65')]({'plain':!![]});interaction_log[_0x4161('0x27')]('[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x25990a['user']['id'],_0x25990a[_0x4161('0x6b')][_0x4161('0x3c')],_0x25990a[_0x4161('0x6b')]['role'],_0xa95740['interaction']['id'],_0x25990a[_0x4161('0x59')]?JSON['stringify'](_0x25990a['body']):_0x4161('0x75'));return respondWithRpcPromise('RejectMessage',_0x4161('0x76'),_0xa95740);}return null;})['then'](function(_0x2488ac){if(_0x2488ac){_0x2488ac[_0x4161('0x2c')][_0x4161('0x77')]=util['format'](_0x4161('0x70'),_0x25990a[_0x4161('0x6b')][_0x4161('0x3c')]);_0x2488ac[_0x4161('0x2c')][_0x4161('0x71')]=_0xa95740[_0x4161('0x71')];_0x2488ac[_0x4161('0x2c')][_0x4161('0x78')]='reject';respondWithRpcPromise(_0x4161('0x72'),'EventManager',{'event':_0x4161('0x79'),'message':_0x2488ac[_0x4161('0x2c')]},client9002);return _0xa95740;}return null;})[_0x4161('0x3a')](respondWithResult(_0x291407,null))[_0x4161('0x53')](handleError(_0x291407,null));};exports[_0x4161('0x7a')]=function(_0x50b2a5,_0x1e389c){var _0xc5d418;return db[_0x4161('0x50')][_0x4161('0x7a')](_0x50b2a5['body'],{})[_0x4161('0x3a')](function(_0x4cb624){_0xc5d418=_0x4cb624;return db[_0x4161('0x7b')][_0x4161('0x7c')]({'where':{'id':_0xc5d418['ContactId']}});})['then'](function(_0x15c3a3){if(_[_0x4161('0x68')](_0x15c3a3)){return;}else{_0xc5d418['fax']=_0x15c3a3[_0x4161('0x5e')];return db[_0x4161('0x7d')][_0x4161('0x7c')]({'where':{'id':_0xc5d418['AttachmentId']}});}})[_0x4161('0x3a')](function(_0x4c26cb){return respondWithRpcPromise(_0x4161('0x7e'),'SendFax',{'FaxAccountId':_[_0x4161('0x68')](_0x50b2a5[_0x4161('0x59')])?undefined:_0x50b2a5['body']['FaxAccountId'],'path':_[_0x4161('0x68')](_0x4c26cb)?undefined:util['format'](_0x4161('0x7f'),_0x4c26cb[_0x4161('0x80')]),'fax':_['isNil'](_0xc5d418[_0x4161('0x5e')])?undefined:_0xc5d418['fax'],'AttachmentId':_0xc5d418[_0x4161('0x81')]},client9002);})[_0x4161('0x3a')](respondWithResult(_0x1e389c,0xc9))[_0x4161('0x53')](handleError(_0x1e389c,null));};exports['download']=function(_0x2dfa11,_0x3e69f0){var _0x32cfbc=path[_0x4161('0x82')](config['root'],_0x4161('0x83'),_0x4161('0x84'),_0x4161('0x85'));return db['FaxMessage'][_0x4161('0x58')]({'where':{'id':_0x2dfa11[_0x4161('0x55')]['id']},'include':[{'model':db[_0x4161('0x7d')],'as':'Attachment'}]})[_0x4161('0x3a')](handleEntityNotFound(_0x3e69f0,null))[_0x4161('0x3a')](function(_0x21c0a0){if(_0x21c0a0){return _0x3e69f0[_0x4161('0x86')](path[_0x4161('0x82')](_0x32cfbc,_0x21c0a0['Attachment'][_0x4161('0x80')]));}})[_0x4161('0x53')](handleError(_0x3e69f0,null));}; \ No newline at end of file +var _0x9141=['crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','redis','localhost','socket.io-emitter','./faxMessage.socket','jayson/promise','client','http','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~!@#$%^&-_=+[{]}.','request','then','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','error','FaxMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','count','offset','limit','Content-Range','apply','save','update','destroy','stack','name','map','FaxMessage','rawAttributes','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','options','includeAll','include','rows','show','params','keys','find','body','describe','fax-interactions','fax','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','get','FaxInteractionId','isNil','read1stAt','format','interaction','role','null','AcceptMessage','acceptMessage','manual','interface','SIP/%s','event','EventManager','acceptmessage','reject','agent','FaxInteraction','info','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','stringify','RejectMessage','channel','rejectmessage','create','findOne','ContactId','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','join','root','server','attachments','Attachment','basename','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','ejs','lodash','squel'];(function(_0xc5a93d,_0x5ac4f2){var _0x34d71b=function(_0x1ae992){while(--_0x1ae992){_0xc5a93d['push'](_0xc5a93d['shift']());}};_0x34d71b(++_0x5ac4f2);}(_0x9141,0xf9));var _0x1914=function(_0x340c91,_0x3f0efd){_0x340c91=_0x340c91-0x0;var _0x449bd3=_0x9141[_0x340c91];return _0x449bd3;};'use strict';var pdf=require(_0x1914('0x0'));var emlformat=require(_0x1914('0x1'));var rimraf=require(_0x1914('0x2'));var zipdir=require(_0x1914('0x3'));var jsonpatch=require(_0x1914('0x4'));var rp=require(_0x1914('0x5'));var moment=require('moment');var BPromise=require(_0x1914('0x6'));var Mustache=require(_0x1914('0x7'));var util=require('util');var path=require(_0x1914('0x8'));var sox=require('sox');var csv=require(_0x1914('0x9'));var ejs=require(_0x1914('0xa'));var fs=require('fs');var _=require(_0x1914('0xb'));var squel=require(_0x1914('0xc'));var crypto=require(_0x1914('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x1914('0xe'));var toCsv=require(_0x1914('0x9'));var querystring=require(_0x1914('0xf'));var Papa=require(_0x1914('0x10'));var Redis=require('ioredis');var authService=require(_0x1914('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x1914('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1914('0x13'))(_0x1914('0x14'));var utils=require(_0x1914('0x15'));var config=require(_0x1914('0x16'));var db=require('../../mysqldb')['db'];config[_0x1914('0x17')]=_['defaults'](config[_0x1914('0x17')],{'host':_0x1914('0x18'),'port':0x18eb});var socket=require(_0x1914('0x19'))(new Redis(config[_0x1914('0x17')]));require(_0x1914('0x1a'))['register'](socket);var jayson=require(_0x1914('0x1b'));var client=jayson[_0x1914('0x1c')][_0x1914('0x1d')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function checkPasswordPattern(_0x2d8d5a,_0x5a66fd,_0x508b73){if(_0x508b73){var _0x14d20a=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x14d20a[_0x1914('0x1e')](_0x5a66fd)){return _0x2d8d5a;}else{throw new db[(_0x1914('0x1f'))]['ValidationError'](_0x1914('0x20'));}}else{return _0x2d8d5a;}}function respondWithRpcPromise(_0x522a25,_0x4c4e4f,_0x3a5ff6,_0x349476){return new BPromise(function(_0x32a19d,_0x2f0917){var _0x5bb377=_0x349476||client;return _0x5bb377[_0x1914('0x21')](_0x522a25,_0x3a5ff6)[_0x1914('0x22')](function(_0x34fcc7){logger['info']('FaxMessage,\x20%s,\x20%s',_0x4c4e4f,_0x1914('0x23'));logger[_0x1914('0x24')](_0x1914('0x25'),_0x4c4e4f,'request\x20sent',JSON['stringify'](_0x34fcc7));if(_0x34fcc7[_0x1914('0x26')]){if(_0x34fcc7['error']['code']===0x1f4){logger['error'](_0x1914('0x27'),_0x4c4e4f,_0x34fcc7[_0x1914('0x26')]['message']);return _0x2f0917(_0x34fcc7[_0x1914('0x26')]['message']);}logger['error'](_0x1914('0x27'),_0x4c4e4f,_0x34fcc7[_0x1914('0x26')][_0x1914('0x28')]);return _0x32a19d(_0x34fcc7[_0x1914('0x26')][_0x1914('0x28')]);}else{logger['info'](_0x1914('0x27'),_0x4c4e4f,_0x1914('0x23'));_0x32a19d(_0x34fcc7[_0x1914('0x29')][_0x1914('0x28')]);}})[_0x1914('0x2a')](function(_0x1e8145){logger[_0x1914('0x26')]('FaxMessage,\x20%s,\x20%s',_0x4c4e4f,_0x1e8145);_0x2f0917(_0x1e8145);});});}function respondWithStatusCode(_0xe2b922,_0x5dbabd){_0x5dbabd=_0x5dbabd||0xcc;return function(_0x36ba2f){if(_0x36ba2f){return _0xe2b922[_0x1914('0x2b')](_0x5dbabd);}return _0xe2b922['status'](_0x5dbabd)['end']();};}function respondWithResult(_0x9201c2,_0x5e4a57){_0x5e4a57=_0x5e4a57||0xc8;return function(_0x4b844d){if(_0x4b844d){return _0x9201c2[_0x1914('0x2c')](_0x5e4a57)[_0x1914('0x2d')](_0x4b844d);}};}function respondWithFilteredResult(_0x1e0cc3,_0x5ae4d9){return function(_0xbf25c3){if(_0xbf25c3){var _0x46e23b=_0xbf25c3[_0x1914('0x2e')],_0x164601=_0x5ae4d9[_0x1914('0x2f')],_0x2308da=_0x5ae4d9[_0x1914('0x2f')]+_0x5ae4d9[_0x1914('0x30')],_0x30f5ee;if(_0x2308da>=_0x46e23b){_0x2308da=_0x46e23b;_0x30f5ee=0xc8;}else{_0x30f5ee=0xce;}_0x1e0cc3['status'](_0x30f5ee);return _0x1e0cc3['set'](_0x1914('0x31'),_0x164601+'-'+_0x2308da+'/'+_0x46e23b)[_0x1914('0x2d')](_0xbf25c3);}return null;};}function patchUpdates(_0x3659d5){return function(_0xf74400){try{jsonpatch[_0x1914('0x32')](_0xf74400,_0x3659d5,!![]);}catch(_0x2fbf27){return BPromise['reject'](_0x2fbf27);}return _0xf74400[_0x1914('0x33')]();};}function saveUpdates(_0x490269,_0x37c2ba){return function(_0x5ed80f){if(_0x5ed80f){return _0x5ed80f[_0x1914('0x34')](_0x490269)[_0x1914('0x22')](function(_0x34a7c0){return _0x34a7c0;});}return null;};}function removeEntity(_0x40d5ee,_0x2d32fe){return function(_0x2f47db){if(_0x2f47db){return _0x2f47db[_0x1914('0x35')]()[_0x1914('0x22')](function(){_0x40d5ee['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x51ca5a,_0x3b9352){return function(_0x2e233f){if(!_0x2e233f){_0x51ca5a['sendStatus'](0x194);}return _0x2e233f;};}function handleError(_0x38261a,_0x18016f){_0x18016f=_0x18016f||0x1f4;return function(_0x14753b){logger[_0x1914('0x26')](_0x14753b[_0x1914('0x36')]);if(_0x14753b[_0x1914('0x37')]){delete _0x14753b[_0x1914('0x37')];}_0x38261a['status'](_0x18016f)['send'](_0x14753b);};}exports['index']=function(_0x3ee657,_0x5e63b0){var _0x1f6ffc={},_0x2718d1={},_0x1b6a48={'count':0x0,'rows':[]};var _0x2a5789=_[_0x1914('0x38')](db[_0x1914('0x39')][_0x1914('0x3a')],function(_0xa7f133){return{'name':_0xa7f133['fieldName'],'type':_0xa7f133[_0x1914('0x3b')][_0x1914('0x3c')]};});_0x2718d1[_0x1914('0x3d')]=_[_0x1914('0x38')](_0x2a5789,_0x1914('0x37'));_0x2718d1[_0x1914('0x3e')]=_['keys'](_0x3ee657[_0x1914('0x3e')]);_0x2718d1[_0x1914('0x3f')]=_['intersection'](_0x2718d1[_0x1914('0x3d')],_0x2718d1[_0x1914('0x3e')]);_0x1f6ffc[_0x1914('0x40')]=_[_0x1914('0x41')](_0x2718d1[_0x1914('0x3d')],qs[_0x1914('0x42')](_0x3ee657[_0x1914('0x3e')][_0x1914('0x42')]));_0x1f6ffc[_0x1914('0x40')]=_0x1f6ffc['attributes'][_0x1914('0x43')]?_0x1f6ffc[_0x1914('0x40')]:_0x2718d1[_0x1914('0x3d')];if(!_0x3ee657['query'][_0x1914('0x44')](_0x1914('0x45'))){_0x1f6ffc[_0x1914('0x30')]=qs[_0x1914('0x30')](_0x3ee657['query'][_0x1914('0x30')]);_0x1f6ffc[_0x1914('0x2f')]=qs[_0x1914('0x2f')](_0x3ee657[_0x1914('0x3e')][_0x1914('0x2f')]);}_0x1f6ffc[_0x1914('0x46')]=qs[_0x1914('0x47')](_0x3ee657[_0x1914('0x3e')]['sort']);_0x1f6ffc[_0x1914('0x48')]=qs[_0x1914('0x3f')](_['pick'](_0x3ee657[_0x1914('0x3e')],_0x2718d1['filters']),_0x2a5789);if(_0x3ee657[_0x1914('0x3e')][_0x1914('0x49')]){_0x1f6ffc[_0x1914('0x48')]=_['merge'](_0x1f6ffc[_0x1914('0x48')],{'$or':_[_0x1914('0x38')](_0x2a5789,function(_0x9a5bf6){if(_0x9a5bf6[_0x1914('0x3b')]!=='VIRTUAL'){var _0x46403c={};_0x46403c[_0x9a5bf6[_0x1914('0x37')]]={'$like':'%'+_0x3ee657[_0x1914('0x3e')][_0x1914('0x49')]+'%'};return _0x46403c;}})});}_0x1f6ffc=_['merge']({},_0x1f6ffc,_0x3ee657[_0x1914('0x4a')]);var _0x3c3556={'where':_0x1f6ffc[_0x1914('0x48')]};return db[_0x1914('0x39')]['count'](_0x3c3556)[_0x1914('0x22')](function(_0x10d600){_0x1b6a48[_0x1914('0x2e')]=_0x10d600;if(_0x3ee657[_0x1914('0x3e')][_0x1914('0x4b')]){_0x1f6ffc[_0x1914('0x4c')]=[{'all':!![]}];}return db[_0x1914('0x39')]['findAll'](_0x1f6ffc);})[_0x1914('0x22')](function(_0x564aa3){_0x1b6a48[_0x1914('0x4d')]=_0x564aa3;return _0x1b6a48;})[_0x1914('0x22')](respondWithFilteredResult(_0x5e63b0,_0x1f6ffc))['catch'](handleError(_0x5e63b0,null));};exports[_0x1914('0x4e')]=function(_0x2e5298,_0x985c8a){var _0x8d19e3={'raw':!![],'where':{'id':_0x2e5298[_0x1914('0x4f')]['id']}},_0x19fc00={};_0x19fc00[_0x1914('0x3d')]=_[_0x1914('0x50')](db['FaxMessage'][_0x1914('0x3a')]);_0x19fc00[_0x1914('0x3e')]=_[_0x1914('0x50')](_0x2e5298[_0x1914('0x3e')]);_0x19fc00['filters']=_['intersection'](_0x19fc00['model'],_0x19fc00[_0x1914('0x3e')]);_0x8d19e3['attributes']=_[_0x1914('0x41')](_0x19fc00[_0x1914('0x3d')],qs['fields'](_0x2e5298[_0x1914('0x3e')]['fields']));_0x8d19e3[_0x1914('0x40')]=_0x8d19e3[_0x1914('0x40')][_0x1914('0x43')]?_0x8d19e3[_0x1914('0x40')]:_0x19fc00[_0x1914('0x3d')];if(_0x2e5298[_0x1914('0x3e')][_0x1914('0x4b')]){_0x8d19e3['include']=[{'all':!![]}];}_0x8d19e3=_['merge']({},_0x8d19e3,_0x2e5298[_0x1914('0x4a')]);return db['FaxMessage'][_0x1914('0x51')](_0x8d19e3)['then'](handleEntityNotFound(_0x985c8a,null))[_0x1914('0x22')](respondWithResult(_0x985c8a,null))['catch'](handleError(_0x985c8a,null));};exports[_0x1914('0x34')]=function(_0x5e0e36,_0x20e0ad){if(_0x5e0e36[_0x1914('0x52')]['id']){delete _0x5e0e36[_0x1914('0x52')]['id'];}return db['FaxMessage'][_0x1914('0x51')]({'where':{'id':_0x5e0e36[_0x1914('0x4f')]['id']}})[_0x1914('0x22')](handleEntityNotFound(_0x20e0ad,null))[_0x1914('0x22')](saveUpdates(_0x5e0e36[_0x1914('0x52')],null))[_0x1914('0x22')](respondWithResult(_0x20e0ad,null))['catch'](handleError(_0x20e0ad,null));};exports[_0x1914('0x35')]=function(_0x2433a0,_0x2467a5){return db[_0x1914('0x39')][_0x1914('0x51')]({'where':{'id':_0x2433a0[_0x1914('0x4f')]['id']}})['then'](handleEntityNotFound(_0x2467a5,null))[_0x1914('0x22')](removeEntity(_0x2467a5,null))[_0x1914('0x2a')](handleError(_0x2467a5,null));};exports[_0x1914('0x53')]=function(_0x4c125c,_0x3fcf64){return db['FaxMessage']['describe']()['then'](respondWithResult(_0x3fcf64,null))[_0x1914('0x2a')](handleError(_0x3fcf64,null));};var interaction_log=require(_0x1914('0x13'))(_0x1914('0x54'));exports['accept']=function(_0x6ae593,_0x5324c2,_0x4936c8){var _0x4c94f4={'channel':_0x1914('0x55')};if(_0x6ae593[_0x1914('0x52')]['id']){delete _0x6ae593[_0x1914('0x52')]['id'];}_0x6ae593[_0x1914('0x52')][_0x1914('0x56')]=!![];_0x6ae593[_0x1914('0x52')][_0x1914('0x57')]=moment()['format'](_0x1914('0x58'));_0x6ae593[_0x1914('0x52')][_0x1914('0x59')]=_0x6ae593[_0x1914('0x52')]['UserId']||_0x6ae593[_0x1914('0x5a')]['id'];return db[_0x1914('0x39')][_0x1914('0x51')]({'where':{'id':_0x6ae593[_0x1914('0x4f')]['id'],'UserId':null},'include':[{'model':db[_0x1914('0x5b')],'as':_0x1914('0x5c')}]})['then'](handleEntityNotFound(_0x5324c2,null))[_0x1914('0x22')](saveUpdates(_0x6ae593[_0x1914('0x52')],null))['then'](function(_0x28d120){if(_0x28d120){_0x4c94f4['message']=_0x28d120[_0x1914('0x5d')]({'plain':!![]});return db['FaxInteraction'][_0x1914('0x51')]({'where':{'id':_0x28d120[_0x1914('0x5e')]}});}return null;})['then'](handleEntityNotFound(_0x5324c2,null))['then'](function(_0x1d4b1d){if(_0x1d4b1d){return _0x1d4b1d[_0x1914('0x34')]({'UserId':_0x6ae593['body'][_0x1914('0x59')],'read1stAt':_[_0x1914('0x5f')](_0x1d4b1d[_0x1914('0x60')])?moment()[_0x1914('0x61')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x1914('0x22')](function(_0x1bef49){if(_0x1bef49){_0x4c94f4[_0x1914('0x62')]=_0x1bef49['get']({'plain':!![]});interaction_log['info']('[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x6ae593['user']['id'],_0x6ae593[_0x1914('0x5a')][_0x1914('0x37')],_0x6ae593['user'][_0x1914('0x63')],_0x4c94f4[_0x1914('0x62')]['id'],_0x6ae593[_0x1914('0x52')]?JSON['stringify'](_0x6ae593[_0x1914('0x52')]):_0x1914('0x64'));return respondWithRpcPromise(_0x1914('0x65'),_0x1914('0x66'),_0x4c94f4);}return null;})[_0x1914('0x22')](function(_0x1b2ee0){if(_0x1b2ee0){if(_0x6ae593['body'][_0x1914('0x67')]){_0x4c94f4[_0x1914('0x28')][_0x1914('0x68')]=util[_0x1914('0x61')](_0x1914('0x69'),_0x6ae593['user'][_0x1914('0x37')]);_0x4c94f4[_0x1914('0x28')]['channel']=_0x4c94f4['channel'];_0x4c94f4[_0x1914('0x28')][_0x1914('0x6a')]='accept';return respondWithRpcPromise(_0x1914('0x6b'),_0x1914('0x6b'),{'event':_0x1914('0x6c'),'message':_0x4c94f4[_0x1914('0x28')]},client9002)['then'](function(){return _0x4c94f4;});}return _0x4c94f4;}return null;})['then'](respondWithResult(_0x5324c2,null))[_0x1914('0x2a')](handleError(_0x5324c2,null));};var interaction_log=require(_0x1914('0x13'))(_0x1914('0x54'));exports[_0x1914('0x6d')]=function(_0x10e0c1,_0x2b71fa,_0x575035){var _0x3eb03c={'agent':{},'channel':'fax'};if(_0x10e0c1['body']['id']){delete _0x10e0c1['body']['id'];}_0x10e0c1[_0x1914('0x52')][_0x1914('0x59')]=_0x10e0c1[_0x1914('0x52')]['UserId']||_0x10e0c1['user']['id'];_0x3eb03c[_0x1914('0x6e')]['id']=_0x10e0c1[_0x1914('0x52')]['UserId'];return db[_0x1914('0x39')][_0x1914('0x51')]({'where':{'id':_0x10e0c1[_0x1914('0x4f')]['id'],'UserId':null}})[_0x1914('0x22')](handleEntityNotFound(_0x2b71fa,null))[_0x1914('0x22')](function(_0x480145){if(_0x480145){_0x3eb03c[_0x1914('0x28')]=_0x480145['get']({'plain':!![]});return db[_0x1914('0x6f')][_0x1914('0x51')]({'where':{'id':_0x480145[_0x1914('0x5e')]}});}return null;})[_0x1914('0x22')](handleEntityNotFound(_0x2b71fa,null))[_0x1914('0x22')](function(_0x1d2728){if(_0x1d2728){_0x3eb03c['interaction']=_0x1d2728['get']({'plain':!![]});interaction_log[_0x1914('0x70')](_0x1914('0x71'),_0x10e0c1[_0x1914('0x5a')]['id'],_0x10e0c1['user'][_0x1914('0x37')],_0x10e0c1[_0x1914('0x5a')][_0x1914('0x63')],_0x3eb03c['interaction']['id'],_0x10e0c1[_0x1914('0x52')]?JSON[_0x1914('0x72')](_0x10e0c1[_0x1914('0x52')]):'null');return respondWithRpcPromise(_0x1914('0x73'),'rejectMessage',_0x3eb03c);}return null;})['then'](function(_0x49b9c7){if(_0x49b9c7){_0x49b9c7['message'][_0x1914('0x68')]=util[_0x1914('0x61')]('SIP/%s',_0x10e0c1[_0x1914('0x5a')][_0x1914('0x37')]);_0x49b9c7[_0x1914('0x28')][_0x1914('0x74')]=_0x3eb03c[_0x1914('0x74')];_0x49b9c7[_0x1914('0x28')][_0x1914('0x6a')]=_0x1914('0x6d');respondWithRpcPromise(_0x1914('0x6b'),_0x1914('0x6b'),{'event':_0x1914('0x75'),'message':_0x49b9c7[_0x1914('0x28')]},client9002);return _0x3eb03c;}return null;})[_0x1914('0x22')](respondWithResult(_0x2b71fa,null))[_0x1914('0x2a')](handleError(_0x2b71fa,null));};exports[_0x1914('0x76')]=function(_0x3f4573,_0x2ce718){var _0x44f91f;return db['FaxMessage']['create'](_0x3f4573[_0x1914('0x52')],{})[_0x1914('0x22')](function(_0x15f279){_0x44f91f=_0x15f279;return db[_0x1914('0x5b')][_0x1914('0x77')]({'where':{'id':_0x44f91f[_0x1914('0x78')]}});})[_0x1914('0x22')](function(_0x32f4d1){if(_[_0x1914('0x5f')](_0x32f4d1)){return;}else{_0x44f91f['fax']=_0x32f4d1[_0x1914('0x55')];return db['Attachment']['findOne']({'where':{'id':_0x44f91f[_0x1914('0x79')]}});}})[_0x1914('0x22')](function(_0x5a1212){return respondWithRpcPromise(_0x1914('0x7a'),_0x1914('0x7a'),{'FaxAccountId':_[_0x1914('0x5f')](_0x3f4573[_0x1914('0x52')])?undefined:_0x3f4573['body'][_0x1914('0x7b')],'path':_[_0x1914('0x5f')](_0x5a1212)?undefined:util['format'](_0x1914('0x7c'),_0x5a1212['basename']),'fax':_['isNil'](_0x44f91f[_0x1914('0x55')])?undefined:_0x44f91f['fax'],'AttachmentId':_0x44f91f['AttachmentId']},client9002);})['then'](respondWithResult(_0x2ce718,0xc9))[_0x1914('0x2a')](handleError(_0x2ce718,null));};exports['download']=function(_0x282f61,_0x112f24){var _0x164104=path[_0x1914('0x7d')](config[_0x1914('0x7e')],_0x1914('0x7f'),'files',_0x1914('0x80'));return db['FaxMessage'][_0x1914('0x51')]({'where':{'id':_0x282f61[_0x1914('0x4f')]['id']},'include':[{'model':db[_0x1914('0x81')],'as':_0x1914('0x81')}]})[_0x1914('0x22')](handleEntityNotFound(_0x112f24,null))[_0x1914('0x22')](function(_0x4bc792){if(_0x4bc792){return _0x112f24['download'](path['join'](_0x164104,_0x4bc792[_0x1914('0x81')][_0x1914('0x82')]));}})['catch'](handleError(_0x112f24,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index b952330..a1bf6f9 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 _0x008c=['save','remove','emit','hasOwnProperty','hook','events','../../mysqldb','FaxMessage','setMaxListeners'];(function(_0x22d1a6,_0x127148){var _0x50e885=function(_0x25dcb4){while(--_0x25dcb4){_0x22d1a6['push'](_0x22d1a6['shift']());}};_0x50e885(++_0x127148);}(_0x008c,0x188));var _0xc008=function(_0x42e013,_0x4e1584){_0x42e013=_0x42e013-0x0;var _0x3e951b=_0x008c[_0x42e013];return _0x3e951b;};'use strict';var EventEmitter=require(_0xc008('0x0'));var FaxMessage=require(_0xc008('0x1'))['db'][_0xc008('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0xc008('0x3')](0x0);var events={'afterCreate':_0xc008('0x4'),'afterUpdate':'update','afterDestroy':_0xc008('0x5')};function emitEvent(_0x47063f){return function(_0x10b33c,_0x163bd9,_0x1cbe76){FaxMessageEvents[_0xc008('0x6')](_0x47063f+':'+_0x10b33c['id'],_0x10b33c);FaxMessageEvents[_0xc008('0x6')](_0x47063f,_0x10b33c);_0x1cbe76(null);};}for(var e in events){if(events[_0xc008('0x7')](e)){var event=events[e];FaxMessage[_0xc008('0x8')](e,emitEvent(event));}}module['exports']=FaxMessageEvents; \ No newline at end of file +var _0x008c=['save','remove','emit','hasOwnProperty','hook','events','../../mysqldb','FaxMessage','setMaxListeners'];(function(_0x587637,_0x239676){var _0x170759=function(_0x326ccd){while(--_0x326ccd){_0x587637['push'](_0x587637['shift']());}};_0x170759(++_0x239676);}(_0x008c,0x188));var _0xc008=function(_0x4d7c86,_0x9b62a6){_0x4d7c86=_0x4d7c86-0x0;var _0x59443d=_0x008c[_0x4d7c86];return _0x59443d;};'use strict';var EventEmitter=require(_0xc008('0x0'));var FaxMessage=require(_0xc008('0x1'))['db'][_0xc008('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0xc008('0x3')](0x0);var events={'afterCreate':_0xc008('0x4'),'afterUpdate':'update','afterDestroy':_0xc008('0x5')};function emitEvent(_0x47063f){return function(_0x10b33c,_0x163bd9,_0x1cbe76){FaxMessageEvents[_0xc008('0x6')](_0x47063f+':'+_0x10b33c['id'],_0x10b33c);FaxMessageEvents[_0xc008('0x6')](_0x47063f,_0x10b33c);_0x1cbe76(null);};}for(var e in events){if(events[_0xc008('0x7')](e)){var event=events[e];FaxMessage[_0xc008('0x8')](e,emitEvent(event));}}module['exports']=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index 18590b6..841c4a3 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 _0x138b=['./faxMessage.attributes','exports','define','FaxMessage','fax_messages','fti_fax_messages','body','get','direction','toLowerCase','out','secret','UserId','FaxInteraction','findOne','FaxInteractionId','then','update','catch','error','utf8mb4','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x1bea7a,_0x3ce27){var _0x93964e=function(_0x2f34cf){while(--_0x2f34cf){_0x1bea7a['push'](_0x1bea7a['shift']());}};_0x93964e(++_0x3ce27);}(_0x138b,0x12d));var _0xb138=function(_0x43c6a1,_0x3134c1){_0x43c6a1=_0x43c6a1-0x0;var _0x5ad58a=_0x138b[_0x43c6a1];return _0x5ad58a;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xb138('0x0'));var moment=require(_0xb138('0x1'));var BPromise=require(_0xb138('0x2'));var rp=require(_0xb138('0x3'));var fs=require('fs');var path=require(_0xb138('0x4'));var rimraf=require(_0xb138('0x5'));var config=require(_0xb138('0x6'));var attributes=require(_0xb138('0x7'));module[_0xb138('0x8')]=function(_0x517968,_0x2bfeb6){return _0x517968[_0xb138('0x9')](_0xb138('0xa'),attributes,{'tableName':_0xb138('0xb'),'paranoid':![],'indexes':[{'name':_0xb138('0xc'),'fields':[_0xb138('0xd')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x48cd16,_0x48bd29,_0x3af0a8){var _0x7a15e9=_0x517968['models'];var _0xaf9a2=_0x48cd16[_0xb138('0xe')]({'plain':!![]});if(_0xaf9a2[_0xb138('0xf')][_0xb138('0x10')]()==='in'||_0xaf9a2[_0xb138('0xf')][_0xb138('0x10')]()===_0xb138('0x11')&&!_0xaf9a2[_0xb138('0x12')]&&!_['isNil'](_0xaf9a2[_0xb138('0x13')])){_0x7a15e9[_0xb138('0x14')][_0xb138('0x15')]({'where':{'id':_0xaf9a2[_0xb138('0x16')]}})[_0xb138('0x17')](function(_0x2376da){if(_0x2376da){_0x2376da[_0xb138('0x18')]({'lastMsgAt':_0xaf9a2['createdAt'],'lastMsgDirection':_0xaf9a2['direction'][_0xb138('0x10')]()});}})[_0xb138('0x19')](function(_0x160d77){console[_0xb138('0x1a')](_0x160d77);});}_0x3af0a8();}},'charset':_0xb138('0x1b'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x2be2=['out','secret','FaxInteraction','FaxInteractionId','update','createdAt','toLowerCase','catch','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxMessage.attributes','exports','FaxMessage','fax_messages','fti_fax_messages','FULLTEXT','models','get','direction'];(function(_0x14cb8c,_0x554b3a){var _0x1ba966=function(_0x41a63e){while(--_0x41a63e){_0x14cb8c['push'](_0x14cb8c['shift']());}};_0x1ba966(++_0x554b3a);}(_0x2be2,0x1ae));var _0x22be=function(_0x43da0b,_0x4c5e47){_0x43da0b=_0x43da0b-0x0;var _0x333e54=_0x2be2[_0x43da0b];return _0x333e54;};'use strict';var _=require(_0x22be('0x0'));var util=require('util');var logger=require(_0x22be('0x1'))(_0x22be('0x2'));var moment=require(_0x22be('0x3'));var BPromise=require(_0x22be('0x4'));var rp=require(_0x22be('0x5'));var fs=require('fs');var path=require(_0x22be('0x6'));var rimraf=require(_0x22be('0x7'));var config=require(_0x22be('0x8'));var attributes=require(_0x22be('0x9'));module[_0x22be('0xa')]=function(_0x31c012,_0x4fe560){return _0x31c012['define'](_0x22be('0xb'),attributes,{'tableName':_0x22be('0xc'),'paranoid':![],'indexes':[{'name':_0x22be('0xd'),'fields':['body'],'type':_0x22be('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5e7a19,_0x24e05c,_0x95bf4d){var _0x14c04c=_0x31c012[_0x22be('0xf')];var _0x4bb125=_0x5e7a19[_0x22be('0x10')]({'plain':!![]});if(_0x4bb125[_0x22be('0x11')]['toLowerCase']()==='in'||_0x4bb125['direction']['toLowerCase']()===_0x22be('0x12')&&!_0x4bb125[_0x22be('0x13')]&&!_['isNil'](_0x4bb125['UserId'])){_0x14c04c[_0x22be('0x14')]['findOne']({'where':{'id':_0x4bb125[_0x22be('0x15')]}})['then'](function(_0x884342){if(_0x884342){_0x884342[_0x22be('0x16')]({'lastMsgAt':_0x4bb125[_0x22be('0x17')],'lastMsgDirection':_0x4bb125[_0x22be('0x11')][_0x22be('0x18')]()});}})[_0x22be('0x19')](function(_0x57e977){console['error'](_0x57e977);});}_0x95bf4d();}},'charset':_0x22be('0x1a'),'collate':_0x22be('0x1b')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 3293bb4..c5b25bf 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 _0x7428=['error','message','result','catch','CreateFaxMessage','FaxMessage','create','body','options','UpdateFaxMessage','update','raw','attributes','limit','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','then','info','FaxMessage,\x20%s,\x20%s','debug','FaxMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x7428,0xfc));var _0x8742=function(_0x17495b,_0x2ca8c0){_0x17495b=_0x17495b-0x0;var _0x4edfda=_0x7428[_0x17495b];return _0x4edfda;};'use strict';var _=require(_0x8742('0x0'));var util=require(_0x8742('0x1'));var moment=require('moment');var BPromise=require(_0x8742('0x2'));var rs=require(_0x8742('0x3'));var fs=require('fs');var Redis=require(_0x8742('0x4'));var db=require(_0x8742('0x5'))['db'];var utils=require(_0x8742('0x6'));var logger=require(_0x8742('0x7'))(_0x8742('0x8'));var config=require(_0x8742('0x9'));var jayson=require(_0x8742('0xa'));var client=jayson['client']['http']({'port':0x232a});config[_0x8742('0xb')]=_[_0x8742('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8742('0xb')]));require('./faxMessage.socket')['register'](socket);function respondWithRpcPromise(_0x2a4efe,_0x358832,_0x4f0ebe){return new BPromise(function(_0x2665d3,_0x518997){return client['request'](_0x2a4efe,_0x4f0ebe)[_0x8742('0xd')](function(_0x1f75c2){logger[_0x8742('0xe')](_0x8742('0xf'),_0x358832,'request\x20sent');logger[_0x8742('0x10')](_0x8742('0x11'),_0x358832,_0x8742('0x12'),JSON[_0x8742('0x13')](_0x1f75c2));if(_0x1f75c2[_0x8742('0x14')]){if(_0x1f75c2[_0x8742('0x14')]['code']===0x1f4){logger['error'](_0x8742('0xf'),_0x358832,_0x1f75c2[_0x8742('0x14')][_0x8742('0x15')]);return _0x518997(_0x1f75c2[_0x8742('0x14')][_0x8742('0x15')]);}logger[_0x8742('0x14')](_0x8742('0xf'),_0x358832,_0x1f75c2['error']['message']);return _0x2665d3(_0x1f75c2[_0x8742('0x14')][_0x8742('0x15')]);}else{logger[_0x8742('0xe')](_0x8742('0xf'),_0x358832,_0x8742('0x12'));_0x2665d3(_0x1f75c2[_0x8742('0x16')]['message']);}})[_0x8742('0x17')](function(_0x127940){logger[_0x8742('0x14')](_0x8742('0xf'),_0x358832,_0x127940);_0x518997(_0x127940);});});}exports[_0x8742('0x18')]=function(_0x787a4){var _0x186385=this;return new Promise(function(_0x4d774f,_0x590774){return db[_0x8742('0x19')][_0x8742('0x1a')](_0x787a4[_0x8742('0x1b')],{'raw':_0x787a4[_0x8742('0x1c')]?_0x787a4['options']['raw']===undefined?!![]:![]:!![]})[_0x8742('0xd')](function(_0x26613b){logger[_0x8742('0xe')]('CreateFaxMessage',_0x787a4);logger[_0x8742('0x10')](_0x8742('0x18'),_0x787a4,JSON['stringify'](_0x26613b));_0x4d774f(_0x26613b);})[_0x8742('0x17')](function(_0x1a7029){logger['error'](_0x8742('0x18'),_0x1a7029[_0x8742('0x15')],_0x787a4);_0x590774(_0x186385[_0x8742('0x14')](0x1f4,_0x1a7029['message']));});});};exports[_0x8742('0x1d')]=function(_0x10de26){var _0x328183=this;return new Promise(function(_0x34f644,_0x16d8a0){return db[_0x8742('0x19')][_0x8742('0x1e')](_0x10de26[_0x8742('0x1b')],{'raw':_0x10de26[_0x8742('0x1c')]?_0x10de26[_0x8742('0x1c')][_0x8742('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x10de26[_0x8742('0x1c')]?_0x10de26[_0x8742('0x1c')]['where']||null:null,'attributes':_0x10de26['options']?_0x10de26['options'][_0x8742('0x20')]||null:null,'limit':_0x10de26[_0x8742('0x1c')]?_0x10de26[_0x8742('0x1c')][_0x8742('0x21')]||null:null})[_0x8742('0xd')](function(_0x276591){logger[_0x8742('0xe')](_0x8742('0x1d'),_0x10de26);logger[_0x8742('0x10')]('UpdateFaxMessage',_0x10de26,JSON[_0x8742('0x13')](_0x276591));_0x34f644(_0x276591);})[_0x8742('0x17')](function(_0x100321){logger[_0x8742('0x14')]('UpdateFaxMessage',_0x100321[_0x8742('0x15')],_0x10de26);_0x16d8a0(_0x328183[_0x8742('0x14')](0x1f4,_0x100321[_0x8742('0x15')]));});});}; \ No newline at end of file +var _0xaa53=['register','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','FaxMessage','create','body','options','raw','CreateFaxMessage','update','where','attributes','limit','UpdateFaxMessage','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./faxMessage.socket'];(function(_0x518b6b,_0x1cfbb5){var _0x480ba8=function(_0x386670){while(--_0x386670){_0x518b6b['push'](_0x518b6b['shift']());}};_0x480ba8(++_0x1cfbb5);}(_0xaa53,0xb0));var _0x3aa5=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xaa53[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x3aa5('0x0'));var util=require(_0x3aa5('0x1'));var moment=require(_0x3aa5('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3aa5('0x3'));var db=require(_0x3aa5('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3aa5('0x5'))('rpc');var config=require(_0x3aa5('0x6'));var jayson=require(_0x3aa5('0x7'));var client=jayson[_0x3aa5('0x8')][_0x3aa5('0x9')]({'port':0x232a});config[_0x3aa5('0xa')]=_[_0x3aa5('0xb')](config[_0x3aa5('0xa')],{'host':_0x3aa5('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x3aa5('0xd'))[_0x3aa5('0xe')](socket);function respondWithRpcPromise(_0x48de4d,_0x4c240f,_0x2b1609){return new BPromise(function(_0x176187,_0x12b684){return client['request'](_0x48de4d,_0x2b1609)[_0x3aa5('0xf')](function(_0x5854b4){logger[_0x3aa5('0x10')](_0x3aa5('0x11'),_0x4c240f,_0x3aa5('0x12'));logger[_0x3aa5('0x13')](_0x3aa5('0x14'),_0x4c240f,_0x3aa5('0x12'),JSON[_0x3aa5('0x15')](_0x5854b4));if(_0x5854b4['error']){if(_0x5854b4[_0x3aa5('0x16')][_0x3aa5('0x17')]===0x1f4){logger[_0x3aa5('0x16')](_0x3aa5('0x11'),_0x4c240f,_0x5854b4[_0x3aa5('0x16')]['message']);return _0x12b684(_0x5854b4['error'][_0x3aa5('0x18')]);}logger[_0x3aa5('0x16')](_0x3aa5('0x11'),_0x4c240f,_0x5854b4['error']['message']);return _0x176187(_0x5854b4[_0x3aa5('0x16')][_0x3aa5('0x18')]);}else{logger[_0x3aa5('0x10')](_0x3aa5('0x11'),_0x4c240f,'request\x20sent');_0x176187(_0x5854b4[_0x3aa5('0x19')][_0x3aa5('0x18')]);}})[_0x3aa5('0x1a')](function(_0x59d375){logger[_0x3aa5('0x16')](_0x3aa5('0x11'),_0x4c240f,_0x59d375);_0x12b684(_0x59d375);});});}exports['CreateFaxMessage']=function(_0x3df6ba){var _0x4650d7=this;return new Promise(function(_0x5984c6,_0x5decdd){return db[_0x3aa5('0x1b')][_0x3aa5('0x1c')](_0x3df6ba[_0x3aa5('0x1d')],{'raw':_0x3df6ba[_0x3aa5('0x1e')]?_0x3df6ba[_0x3aa5('0x1e')][_0x3aa5('0x1f')]===undefined?!![]:![]:!![]})[_0x3aa5('0xf')](function(_0x474935){logger[_0x3aa5('0x10')](_0x3aa5('0x20'),_0x3df6ba);logger[_0x3aa5('0x13')]('CreateFaxMessage',_0x3df6ba,JSON[_0x3aa5('0x15')](_0x474935));_0x5984c6(_0x474935);})['catch'](function(_0xf63b2e){logger[_0x3aa5('0x16')](_0x3aa5('0x20'),_0xf63b2e[_0x3aa5('0x18')],_0x3df6ba);_0x5decdd(_0x4650d7[_0x3aa5('0x16')](0x1f4,_0xf63b2e[_0x3aa5('0x18')]));});});};exports['UpdateFaxMessage']=function(_0x4bc407){var _0x4e7b01=this;return new Promise(function(_0x1f0cb0,_0x2f67ac){return db['FaxMessage'][_0x3aa5('0x21')](_0x4bc407[_0x3aa5('0x1d')],{'raw':_0x4bc407['options']?_0x4bc407[_0x3aa5('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4bc407[_0x3aa5('0x1e')]?_0x4bc407[_0x3aa5('0x1e')][_0x3aa5('0x22')]||null:null,'attributes':_0x4bc407[_0x3aa5('0x1e')]?_0x4bc407['options'][_0x3aa5('0x23')]||null:null,'limit':_0x4bc407[_0x3aa5('0x1e')]?_0x4bc407[_0x3aa5('0x1e')][_0x3aa5('0x24')]||null:null})[_0x3aa5('0xf')](function(_0x1da22b){logger['info'](_0x3aa5('0x25'),_0x4bc407);logger[_0x3aa5('0x13')](_0x3aa5('0x25'),_0x4bc407,JSON[_0x3aa5('0x15')](_0x1da22b));_0x1f0cb0(_0x1da22b);})[_0x3aa5('0x1a')](function(_0x41d24b){logger[_0x3aa5('0x16')](_0x3aa5('0x25'),_0x41d24b['message'],_0x4bc407);_0x2f67ac(_0x4e7b01[_0x3aa5('0x16')](0x1f4,_0x41d24b[_0x3aa5('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 732b864..c6b3784 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 _0x9957=['register','length','faxMessage:','./faxMessage.events','save','remove','update','emit','removeListener'];(function(_0x47e549,_0x2e53d6){var _0x251374=function(_0x400458){while(--_0x400458){_0x47e549['push'](_0x47e549['shift']());}};_0x251374(++_0x2e53d6);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'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 +var _0x9957=['register','length','faxMessage:','./faxMessage.events','save','remove','update','emit','removeListener'];(function(_0x2cde0a,_0x1f9695){var _0x260610=function(_0x179089){while(--_0x179089){_0x2cde0a['push'](_0x2cde0a['shift']());}};_0x260610(++_0x1f9695);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'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 2889a4e..21a8769 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 _0x5b45=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked','fax','faxmessage:create','create','update','put','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x5b45,0x1d0));var _0x55b4=function(_0x316c42,_0x3391f0){_0x316c42=_0x316c42-0x0;var _0x2b38f7=_0x5b45[_0x316c42];return _0x2b38f7;};'use strict';var multer=require(_0x55b4('0x0'));var util=require(_0x55b4('0x1'));var path=require(_0x55b4('0x2'));var timeout=require(_0x55b4('0x3'));var express=require(_0x55b4('0x4'));var router=express[_0x55b4('0x5')]();var auth=require(_0x55b4('0x6'));var interaction=require(_0x55b4('0x7'));var config=require(_0x55b4('0x8'));var controller=require(_0x55b4('0x9'));router[_0x55b4('0xa')]('/',auth[_0x55b4('0xb')](),controller[_0x55b4('0xc')]);router[_0x55b4('0xa')](_0x55b4('0xd'),auth[_0x55b4('0xb')](),controller[_0x55b4('0xe')]);router[_0x55b4('0xa')](_0x55b4('0xf'),auth[_0x55b4('0xb')](),controller[_0x55b4('0x10')]);router[_0x55b4('0xa')]('/:id/download',auth[_0x55b4('0xb')](),controller['download']);router[_0x55b4('0x11')]('/',auth['isAuthenticated'](),interaction[_0x55b4('0x12')](_0x55b4('0x13'),_0x55b4('0x14')),controller[_0x55b4('0x15')]);router['put'](_0x55b4('0xf'),auth[_0x55b4('0xb')](),controller[_0x55b4('0x16')]);router[_0x55b4('0x17')](_0x55b4('0x18'),auth[_0x55b4('0xb')](),controller[_0x55b4('0x19')]);router[_0x55b4('0x17')](_0x55b4('0x1a'),auth[_0x55b4('0xb')](),controller[_0x55b4('0x1b')]);router[_0x55b4('0x1c')](_0x55b4('0xf'),auth[_0x55b4('0xb')](),controller[_0x55b4('0x1d')]);module[_0x55b4('0x1e')]=router; \ No newline at end of file +var _0xec81=['accept','reject','delete','destroy','exports','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/download','download','tracked','fax','faxmessage:create','create','put','update','/:id/accept'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xec81,0x71));var _0x1ec8=function(_0x478aa8,_0x1d38dd){_0x478aa8=_0x478aa8-0x0;var _0x117609=_0xec81[_0x478aa8];return _0x117609;};'use strict';var multer=require('multer');var util=require(_0x1ec8('0x0'));var path=require('path');var timeout=require(_0x1ec8('0x1'));var express=require('express');var router=express[_0x1ec8('0x2')]();var auth=require(_0x1ec8('0x3'));var interaction=require(_0x1ec8('0x4'));var config=require(_0x1ec8('0x5'));var controller=require(_0x1ec8('0x6'));router[_0x1ec8('0x7')]('/',auth[_0x1ec8('0x8')](),controller[_0x1ec8('0x9')]);router['get'](_0x1ec8('0xa'),auth[_0x1ec8('0x8')](),controller['describe']);router[_0x1ec8('0x7')](_0x1ec8('0xb'),auth['isAuthenticated'](),controller[_0x1ec8('0xc')]);router[_0x1ec8('0x7')](_0x1ec8('0xd'),auth[_0x1ec8('0x8')](),controller[_0x1ec8('0xe')]);router['post']('/',auth[_0x1ec8('0x8')](),interaction[_0x1ec8('0xf')](_0x1ec8('0x10'),_0x1ec8('0x11')),controller[_0x1ec8('0x12')]);router[_0x1ec8('0x13')](_0x1ec8('0xb'),auth['isAuthenticated'](),controller[_0x1ec8('0x14')]);router[_0x1ec8('0x13')](_0x1ec8('0x15'),auth[_0x1ec8('0x8')](),controller[_0x1ec8('0x16')]);router[_0x1ec8('0x13')]('/:id/reject',auth[_0x1ec8('0x8')](),controller[_0x1ec8('0x17')]);router[_0x1ec8('0x18')]('/:id',auth[_0x1ec8('0x8')](),controller[_0x1ec8('0x19')]);module[_0x1ec8('0x1a')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index d836ece..35b8f42 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 _0x9b7c=['beepall','sequelize','exports','STRING','name','INTEGER','rrmemory'];(function(_0x349a91,_0x17f611){var _0x5a07b1=function(_0x430a90){while(--_0x430a90){_0x349a91['push'](_0x349a91['shift']());}};_0x5a07b1(++_0x17f611);}(_0x9b7c,0x19e));var _0xc9b7=function(_0x58252d,_0x2070b3){_0x58252d=_0x58252d-0x0;var _0x55a98c=_0x9b7c[_0x58252d];return _0x55a98c;};'use strict';var Sequelize=require(_0xc9b7('0x0'));module[_0xc9b7('0x1')]={'name':{'type':Sequelize[_0xc9b7('0x2')],'unique':_0xc9b7('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xc9b7('0x2')]},'timeout':{'type':Sequelize[_0xc9b7('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xc9b7('0x5'),_0xc9b7('0x6'),'roundrobin'),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xc9b7('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x1a41=['exports','name','STRING','ENUM','rrmemory','beepall','INTEGER'];(function(_0x146484,_0x27a7f0){var _0x4c7aa3=function(_0x481b98){while(--_0x481b98){_0x146484['push'](_0x146484['shift']());}};_0x4c7aa3(++_0x27a7f0);}(_0x1a41,0x126));var _0x11a4=function(_0x48bb13,_0x5bbf43){_0x48bb13=_0x48bb13-0x0;var _0x2a0ef4=_0x1a41[_0x48bb13];return _0x2a0ef4;};'use strict';var Sequelize=require('sequelize');module[_0x11a4('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x11a4('0x1'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x11a4('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x11a4('0x3')](_0x11a4('0x4'),_0x11a4('0x5'),'roundrobin'),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x11a4('0x6')],'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 e661e17..f536272 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 _0x1775=['Team','addTeams','ids','voicePause','interface','flatMap','Agents','sequelize','findOrCreate','emit','removeTeams','field','tq.TeamId','from','team_has_fax_queues','join','user_has_teams','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','TeamId','includes','all','union','compact','transaction','isEmpty','removeAgents','forEach','userFaxQueue:remove','addAgents','omit','spread','userFaxQueue:save','isArray','getAgents','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/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','sendStatus','status','end','count','offset','set','Content-Range','json','apply','reject','save','update','then','FaxQueues','destroy','stack','name','send','index','map','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','type','options','FaxQueue','includeAll','findAll','rows','show','params','length','catch','body','get','role','user','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserFaxQueue','merge','User','findAndCountAll','UserId','agent','faxPause','createdAt','format','SIP','getTeams'];(function(_0x4a7a9d,_0x1661b0){var _0x238cff=function(_0x5bcdeb){while(--_0x5bcdeb){_0x4a7a9d['push'](_0x4a7a9d['shift']());}};_0x238cff(++_0x1661b0);}(_0x1775,0x1db));var _0x5177=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x1775[_0x19e35c];return _0x3e1fe8;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5177('0x0'));var rimraf=require(_0x5177('0x1'));var zipdir=require(_0x5177('0x2'));var jsonpatch=require(_0x5177('0x3'));var rp=require(_0x5177('0x4'));var moment=require(_0x5177('0x5'));var BPromise=require(_0x5177('0x6'));var Mustache=require(_0x5177('0x7'));var util=require(_0x5177('0x8'));var path=require(_0x5177('0x9'));var sox=require(_0x5177('0xa'));var csv=require(_0x5177('0xb'));var ejs=require(_0x5177('0xc'));var fs=require('fs');var _=require(_0x5177('0xd'));var squel=require(_0x5177('0xe'));var crypto=require(_0x5177('0xf'));var jsforce=require(_0x5177('0x10'));var deskjs=require(_0x5177('0x11'));var toCsv=require(_0x5177('0xb'));var querystring=require(_0x5177('0x12'));var Papa=require(_0x5177('0x13'));var Redis=require(_0x5177('0x14'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x5177('0x15'));var hardwareService=require(_0x5177('0x16'));var logger=require(_0x5177('0x17'))(_0x5177('0x18'));var utils=require(_0x5177('0x19'));var config=require('../../config/environment');var db=require(_0x5177('0x1a'))['db'];config[_0x5177('0x1b')]=_[_0x5177('0x1c')](config[_0x5177('0x1b')],{'host':_0x5177('0x1d'),'port':0x18eb});var socket=require(_0x5177('0x1e'))(new Redis(config[_0x5177('0x1b')]));require(_0x5177('0x1f'))[_0x5177('0x20')](socket);function respondWithStatusCode(_0x1eb9dd,_0x41bef4){_0x41bef4=_0x41bef4||0xcc;return function(_0x2bf5bb){if(_0x2bf5bb){return _0x1eb9dd[_0x5177('0x21')](_0x41bef4);}return _0x1eb9dd[_0x5177('0x22')](_0x41bef4)[_0x5177('0x23')]();};}function respondWithResult(_0x175ca6,_0x2ab5e5){_0x2ab5e5=_0x2ab5e5||0xc8;return function(_0x7dba6f){if(_0x7dba6f){return _0x175ca6[_0x5177('0x22')](_0x2ab5e5)['json'](_0x7dba6f);}};}function respondWithFilteredResult(_0x288e3f,_0x41e687){return function(_0x3f5ab5){if(_0x3f5ab5){var _0x1b4102=_0x3f5ab5[_0x5177('0x24')],_0x5f5bd4=_0x41e687['offset'],_0x3e6944=_0x41e687[_0x5177('0x25')]+_0x41e687['limit'],_0x2ebf91;if(_0x3e6944>=_0x1b4102){_0x3e6944=_0x1b4102;_0x2ebf91=0xc8;}else{_0x2ebf91=0xce;}_0x288e3f[_0x5177('0x22')](_0x2ebf91);return _0x288e3f[_0x5177('0x26')](_0x5177('0x27'),_0x5f5bd4+'-'+_0x3e6944+'/'+_0x1b4102)[_0x5177('0x28')](_0x3f5ab5);}return null;};}function patchUpdates(_0x451e5c){return function(_0x3314f2){try{jsonpatch[_0x5177('0x29')](_0x3314f2,_0x451e5c,!![]);}catch(_0xfc1bd4){return BPromise[_0x5177('0x2a')](_0xfc1bd4);}return _0x3314f2[_0x5177('0x2b')]();};}function saveUpdates(_0x23dad2,_0x3b0c37){return function(_0x5d9a9c){if(_0x5d9a9c){return _0x5d9a9c[_0x5177('0x2c')](_0x23dad2)['then'](function(_0x30b60f){return _0x30b60f;});}return null;};}function removeEntity(_0x2c68d8,_0x3b39b5){return function(_0x2d51d0){if(_0x2d51d0){return _0x2d51d0['destroy']()[_0x5177('0x2d')](function(){var _0x533409=_0x2d51d0['get']({'plain':!![]});var _0x19a0c2=_0x5177('0x2e');return db['UserProfileResource'][_0x5177('0x2f')]({'where':{'type':_0x19a0c2,'resourceId':_0x533409['id']}})['then'](function(){return _0x2d51d0;});})[_0x5177('0x2d')](function(){_0x2c68d8[_0x5177('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e021a,_0x2554ec){return function(_0x3c4248){if(!_0x3c4248){_0x3e021a[_0x5177('0x21')](0x194);}return _0x3c4248;};}function handleError(_0xe98ff1,_0x1cef5d){_0x1cef5d=_0x1cef5d||0x1f4;return function(_0x5577bb){logger['error'](_0x5577bb[_0x5177('0x30')]);if(_0x5577bb[_0x5177('0x31')]){delete _0x5577bb[_0x5177('0x31')];}_0xe98ff1[_0x5177('0x22')](_0x1cef5d)[_0x5177('0x32')](_0x5577bb);};}exports[_0x5177('0x33')]=function(_0x31eb9f,_0x72dced){var _0x49f6f1={},_0x42e1db={},_0x2233a2={'count':0x0,'rows':[]};var _0x4f3416=_[_0x5177('0x34')](db['FaxQueue'][_0x5177('0x35')],function(_0x1a2c46){return{'name':_0x1a2c46[_0x5177('0x36')],'type':_0x1a2c46['type']['key']};});_0x42e1db[_0x5177('0x37')]=_[_0x5177('0x34')](_0x4f3416,_0x5177('0x31'));_0x42e1db[_0x5177('0x38')]=_[_0x5177('0x39')](_0x31eb9f[_0x5177('0x38')]);_0x42e1db[_0x5177('0x3a')]=_[_0x5177('0x3b')](_0x42e1db['model'],_0x42e1db[_0x5177('0x38')]);_0x49f6f1[_0x5177('0x3c')]=_['intersection'](_0x42e1db[_0x5177('0x37')],qs[_0x5177('0x3d')](_0x31eb9f[_0x5177('0x38')][_0x5177('0x3d')]));_0x49f6f1[_0x5177('0x3c')]=_0x49f6f1[_0x5177('0x3c')]['length']?_0x49f6f1[_0x5177('0x3c')]:_0x42e1db[_0x5177('0x37')];if(!_0x31eb9f[_0x5177('0x38')][_0x5177('0x3e')](_0x5177('0x3f'))){_0x49f6f1[_0x5177('0x40')]=qs[_0x5177('0x40')](_0x31eb9f['query'][_0x5177('0x40')]);_0x49f6f1[_0x5177('0x25')]=qs['offset'](_0x31eb9f['query'][_0x5177('0x25')]);}_0x49f6f1[_0x5177('0x41')]=qs[_0x5177('0x42')](_0x31eb9f[_0x5177('0x38')][_0x5177('0x42')]);_0x49f6f1[_0x5177('0x43')]=qs[_0x5177('0x3a')](_[_0x5177('0x44')](_0x31eb9f[_0x5177('0x38')],_0x42e1db[_0x5177('0x3a')]),_0x4f3416);if(_0x31eb9f[_0x5177('0x38')][_0x5177('0x45')]){_0x49f6f1[_0x5177('0x43')]=_['merge'](_0x49f6f1[_0x5177('0x43')],{'$or':_[_0x5177('0x34')](_0x4f3416,function(_0x4e3677){if(_0x4e3677[_0x5177('0x46')]!=='VIRTUAL'){var _0x2d4d35={};_0x2d4d35[_0x4e3677[_0x5177('0x31')]]={'$like':'%'+_0x31eb9f[_0x5177('0x38')]['filter']+'%'};return _0x2d4d35;}})});}_0x49f6f1=_['merge']({},_0x49f6f1,_0x31eb9f[_0x5177('0x47')]);var _0x227654={'where':_0x49f6f1[_0x5177('0x43')]};return db[_0x5177('0x48')][_0x5177('0x24')](_0x227654)[_0x5177('0x2d')](function(_0x41d874){_0x2233a2[_0x5177('0x24')]=_0x41d874;if(_0x31eb9f['query'][_0x5177('0x49')]){_0x49f6f1['include']=[{'all':!![]}];}return db['FaxQueue'][_0x5177('0x4a')](_0x49f6f1);})[_0x5177('0x2d')](function(_0x5172f8){_0x2233a2[_0x5177('0x4b')]=_0x5172f8;return _0x2233a2;})['then'](respondWithFilteredResult(_0x72dced,_0x49f6f1))['catch'](handleError(_0x72dced,null));};exports[_0x5177('0x4c')]=function(_0x1769cd,_0x262c71){var _0x3776b8={'raw':!![],'where':{'id':_0x1769cd[_0x5177('0x4d')]['id']}},_0x191973={};_0x191973[_0x5177('0x37')]=_['keys'](db['FaxQueue'][_0x5177('0x35')]);_0x191973['query']=_[_0x5177('0x39')](_0x1769cd[_0x5177('0x38')]);_0x191973[_0x5177('0x3a')]=_[_0x5177('0x3b')](_0x191973['model'],_0x191973[_0x5177('0x38')]);_0x3776b8[_0x5177('0x3c')]=_[_0x5177('0x3b')](_0x191973[_0x5177('0x37')],qs[_0x5177('0x3d')](_0x1769cd[_0x5177('0x38')][_0x5177('0x3d')]));_0x3776b8[_0x5177('0x3c')]=_0x3776b8[_0x5177('0x3c')][_0x5177('0x4e')]?_0x3776b8[_0x5177('0x3c')]:_0x191973['model'];if(_0x1769cd[_0x5177('0x38')]['includeAll']){_0x3776b8['include']=[{'all':!![]}];}_0x3776b8=_['merge']({},_0x3776b8,_0x1769cd[_0x5177('0x47')]);return db[_0x5177('0x48')]['find'](_0x3776b8)[_0x5177('0x2d')](handleEntityNotFound(_0x262c71,null))[_0x5177('0x2d')](respondWithResult(_0x262c71,null))[_0x5177('0x4f')](handleError(_0x262c71,null));};exports['create']=function(_0x1d4ae4,_0x5981dc){return db['FaxQueue']['create'](_0x1d4ae4[_0x5177('0x50')],{})[_0x5177('0x2d')](function(_0x1300d7){var _0x5a1f8b=_0x1d4ae4['user'][_0x5177('0x51')]({'plain':!![]});if(!_0x5a1f8b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5a1f8b[_0x5177('0x52')]===_0x5177('0x53')){var _0x430e8e=_0x1300d7[_0x5177('0x51')]({'plain':!![]});var _0x84233c=_0x5177('0x2e');return db[_0x5177('0x54')][_0x5177('0x55')]({'where':{'name':_0x84233c,'userProfileId':_0x5a1f8b[_0x5177('0x56')]},'raw':!![]})[_0x5177('0x2d')](function(_0x89fe3a){if(_0x89fe3a&&_0x89fe3a[_0x5177('0x57')]===0x0){return db[_0x5177('0x58')]['create']({'name':_0x430e8e['name'],'resourceId':_0x430e8e['id'],'type':_0x89fe3a[_0x5177('0x31')],'sectionId':_0x89fe3a['id']},{})['then'](function(){return _0x1300d7;});}else{return _0x1300d7;}})[_0x5177('0x4f')](function(_0x49aba9){logger[_0x5177('0x59')](_0x5177('0x5a'),_0x49aba9);throw _0x49aba9;});}return _0x1300d7;})[_0x5177('0x2d')](respondWithResult(_0x5981dc,0xc9))['catch'](handleError(_0x5981dc,null));};exports['update']=function(_0x19884e,_0x43b5b9){if(_0x19884e[_0x5177('0x50')]['id']){delete _0x19884e[_0x5177('0x50')]['id'];}return db['FaxQueue']['find']({'where':{'id':_0x19884e[_0x5177('0x4d')]['id']}})[_0x5177('0x2d')](handleEntityNotFound(_0x43b5b9,null))[_0x5177('0x2d')](saveUpdates(_0x19884e[_0x5177('0x50')],null))['then'](respondWithResult(_0x43b5b9,null))[_0x5177('0x4f')](handleError(_0x43b5b9,null));};exports[_0x5177('0x2f')]=function(_0x3a18ad,_0x589da8){return db[_0x5177('0x48')][_0x5177('0x55')]({'where':{'id':_0x3a18ad[_0x5177('0x4d')]['id']}})['then'](handleEntityNotFound(_0x589da8,null))[_0x5177('0x2d')](removeEntity(_0x589da8,null))['catch'](handleError(_0x589da8,null));};exports[_0x5177('0x5b')]=function(_0x39fb92,_0x3268bd){return db['FaxQueue'][_0x5177('0x5b')]()[_0x5177('0x2d')](respondWithResult(_0x3268bd,null))[_0x5177('0x4f')](handleError(_0x3268bd,null));};exports[_0x5177('0x5c')]=function(_0xc7a59e,_0x74589e,_0x37380c){var _0x267599={'raw':!![],'where':{}},_0x5ceed2={},_0x5d96ce;return db['FaxQueue'][_0x5177('0x5d')]({'where':{'id':_0xc7a59e[_0x5177('0x4d')]['id']}})[_0x5177('0x2d')](handleEntityNotFound(_0x74589e,null))[_0x5177('0x2d')](function(_0x2472e9){if(_0x2472e9){_0x5d96ce=_0x2472e9[_0x5177('0x51')]({'plain':!![]});_0x5ceed2['model']=_['keys'](db[_0x5177('0x5e')][_0x5177('0x35')]);_0x5ceed2[_0x5177('0x38')]=_[_0x5177('0x39')](_0xc7a59e[_0x5177('0x38')]);_0x5ceed2[_0x5177('0x3a')]=_[_0x5177('0x3b')](_0x5ceed2[_0x5177('0x37')],_0x5ceed2[_0x5177('0x38')]);_0x267599['attributes']=_[_0x5177('0x3b')](_0x5ceed2[_0x5177('0x37')],qs['fields'](_0xc7a59e[_0x5177('0x38')][_0x5177('0x3d')]));_0x267599['attributes']=_0x267599[_0x5177('0x3c')][_0x5177('0x4e')]?_0x267599[_0x5177('0x3c')]:_0x5ceed2['model'];if(!_0xc7a59e[_0x5177('0x38')][_0x5177('0x3e')]('nolimit')){_0x267599['limit']=qs[_0x5177('0x40')](_0xc7a59e['query'][_0x5177('0x40')]);_0x267599['offset']=qs[_0x5177('0x25')](_0xc7a59e[_0x5177('0x38')]['offset']);}_0x267599[_0x5177('0x41')]=qs[_0x5177('0x42')](_0xc7a59e[_0x5177('0x38')][_0x5177('0x42')]);_0x267599[_0x5177('0x43')]=qs[_0x5177('0x3a')](_[_0x5177('0x44')](_0xc7a59e['query'],_0x5ceed2[_0x5177('0x3a')]));_0x267599['where']['FaxQueueId']=_0x2472e9['id'];if(_0xc7a59e[_0x5177('0x38')][_0x5177('0x45')]){_0x267599['where']=_[_0x5177('0x5f')](_0x267599[_0x5177('0x43')],{'$or':_[_0x5177('0x34')](_0x267599[_0x5177('0x3c')],function(_0x19b587){var _0x128cab={};_0x128cab[_0x19b587]={'$like':'%'+_0xc7a59e[_0x5177('0x38')][_0x5177('0x45')]+'%'};return _0x128cab;})});}_0x267599=_['merge']({},_0x267599,_0xc7a59e['options']);return db[_0x5177('0x5e')][_0x5177('0x4a')](_0x267599);}})[_0x5177('0x2d')](function(_0x2d24b3){if(_0x2d24b3){return db[_0x5177('0x60')][_0x5177('0x61')]({'where':{'id':_['map'](_0x2d24b3,_0x5177('0x62')),'role':_0x5177('0x63')},'attributes':['id',_0x5177('0x31'),_0x5177('0x64'),'updatedAt',_0x5177('0x65')]});}})[_0x5177('0x2d')](function(_0x124935){if(_0x124935){return{'count':_0x124935[_0x5177('0x24')],'rows':_[_0x5177('0x34')](_0x124935['rows'],function(_0x2734fc){return{'membername':_0x2734fc['name'],'UserId':_0x2734fc['id'],'queue_name':_0x5d96ce[_0x5177('0x31')],'FaxQueueId':_0x5d96ce['id'],'interface':util[_0x5177('0x66')]('%s/%s',_0x5177('0x67'),_0x2734fc[_0x5177('0x31')]),'penalty':0x0,'paused':_0x2734fc[_0x5177('0x64')],'createdAt':_0x2734fc[_0x5177('0x65')],'updatedAt':_0x2734fc['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x5177('0x2d')](respondWithFilteredResult(_0x74589e,_0x267599))[_0x5177('0x4f')](handleError(_0x74589e,null));};exports[_0x5177('0x68')]=function(_0x20fc85,_0x50485e,_0x16b85b){var _0x17456b={};var _0x3502dd={};var _0x4c8a15;var _0x54b87d;return db[_0x5177('0x48')][_0x5177('0x5d')]({'where':{'id':_0x20fc85[_0x5177('0x4d')]['id']}})[_0x5177('0x2d')](handleEntityNotFound(_0x50485e,null))[_0x5177('0x2d')](function(_0x37ed49){if(_0x37ed49){_0x4c8a15=_0x37ed49;_0x3502dd[_0x5177('0x37')]=_[_0x5177('0x39')](db[_0x5177('0x69')]['rawAttributes']);_0x3502dd['query']=_['keys'](_0x20fc85[_0x5177('0x38')]);_0x3502dd['filters']=_[_0x5177('0x3b')](_0x3502dd[_0x5177('0x37')],_0x3502dd[_0x5177('0x38')]);_0x17456b[_0x5177('0x3c')]=_[_0x5177('0x3b')](_0x3502dd['model'],qs[_0x5177('0x3d')](_0x20fc85[_0x5177('0x38')][_0x5177('0x3d')]));_0x17456b['attributes']=_0x17456b[_0x5177('0x3c')]['length']?_0x17456b[_0x5177('0x3c')]:_0x3502dd[_0x5177('0x37')];_0x17456b['order']=qs[_0x5177('0x42')](_0x20fc85[_0x5177('0x38')]['sort']);_0x17456b['where']=qs[_0x5177('0x3a')](_['pick'](_0x20fc85[_0x5177('0x38')],_0x3502dd[_0x5177('0x3a')]));if(_0x20fc85['query'][_0x5177('0x45')]){_0x17456b[_0x5177('0x43')]=_[_0x5177('0x5f')](_0x17456b[_0x5177('0x43')],{'$or':_[_0x5177('0x34')](_0x17456b[_0x5177('0x3c')],function(_0xbc8f9f){var _0x10b062={};_0x10b062[_0xbc8f9f]={'$like':'%'+_0x20fc85['query'][_0x5177('0x45')]+'%'};return _0x10b062;})});}_0x17456b=_['merge']({},_0x17456b,_0x20fc85[_0x5177('0x47')]);return _0x4c8a15[_0x5177('0x68')](_0x17456b);}})[_0x5177('0x2d')](function(_0x2f9728){if(_0x2f9728){_0x54b87d=_0x2f9728['length'];if(!_0x20fc85[_0x5177('0x38')][_0x5177('0x3e')]('nolimit')){_0x17456b[_0x5177('0x40')]=qs[_0x5177('0x40')](_0x20fc85['query'][_0x5177('0x40')]);_0x17456b['offset']=qs[_0x5177('0x25')](_0x20fc85['query']['offset']);}return _0x4c8a15['getTeams'](_0x17456b);}})[_0x5177('0x2d')](function(_0x348da7){if(_0x348da7){return _0x348da7?{'count':_0x54b87d,'rows':_0x348da7}:null;}})[_0x5177('0x2d')](respondWithResult(_0x50485e,null))['catch'](handleError(_0x50485e,null));};exports[_0x5177('0x6a')]=function(_0x3473ef,_0x3adb47,_0x3b68b2){var _0x42446a=_0x3473ef['body'][_0x5177('0x6b')];return db[_0x5177('0x69')]['findAll']({'where':{'id':_0x42446a},'attributes':['id'],'include':[{'model':db[_0x5177('0x60')],'as':'Agents','attributes':['id',_0x5177('0x31'),'online',_0x5177('0x6c'),_0x5177('0x6d')],'raw':!![]}]})[_0x5177('0x2d')](function(_0x11cce2){if(_0x11cce2){var _0x3447b9=_[_0x5177('0x6e')](_0x11cce2,function(_0x4ba911){var _0x5ba4ef=_0x4ba911[_0x5177('0x51')]({'plain':!![]});return _0x5ba4ef[_0x5177('0x6f')];});return db[_0x5177('0x48')]['find']({'where':{'id':_0x3473ef[_0x5177('0x4d')]['id']}})[_0x5177('0x2d')](function(_0x4ee41d){return db[_0x5177('0x70')]['transaction'](function(_0x125b08){return _0x4ee41d[_0x5177('0x6a')](_0x42446a,{'transaction':_0x125b08})[_0x5177('0x2d')](function(){return BPromise['each'](_0x3447b9,function(_0x33b82b){return db['UserFaxQueue'][_0x5177('0x71')]({'where':{'UserId':_0x33b82b['id'],'FaxQueueId':_0x3473ef[_0x5177('0x4d')]['id']},'transaction':_0x125b08});});})['then'](function(){_0x3447b9['forEach'](function(_0x4a61da){socket[_0x5177('0x72')]('userFaxQueue:save',{'UserId':_0x4a61da['id'],'FaxQueueId':_0x4ee41d['id']});});});});});}})[_0x5177('0x2d')](respondWithStatusCode(_0x3adb47,null))[_0x5177('0x4f')](handleError(_0x3adb47,null));};exports[_0x5177('0x73')]=function(_0x57adf4,_0x5e4963,_0x5e870f){return db[_0x5177('0x69')][_0x5177('0x4a')]({'where':{'id':_0x57adf4[_0x5177('0x38')]['ids']},'attributes':['id'],'include':[{'model':db[_0x5177('0x60')],'as':_0x5177('0x6f'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x5e4963,null))[_0x5177('0x2d')](function(_0x526459){var _0x26fd12=_['map'](_0x526459,'id');var _0x4a0f8b=[];var _0x5910a8=[];var _0x3940dd=squel['select']();_0x3940dd[_0x5177('0x74')](_0x5177('0x75'))[_0x5177('0x76')](_0x5177('0x77'),'tq')[_0x5177('0x78')](_0x5177('0x79'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x5177('0x43')](_0x5177('0x7a'),_0x57adf4['params']['id']);for(var _0x346a22=0x0;_0x346a22<_0x526459[_0x5177('0x4e')];_0x346a22+=0x1){let _0x1e64fa=_0x526459[_0x346a22];for(var _0x51f7ce=0x0;_0x51f7ce<_0x1e64fa['Agents']['length'];_0x51f7ce+=0x1){let _0x1a83d2=_0x1e64fa[_0x5177('0x6f')][_0x51f7ce];var _0x12591e=_0x3940dd[_0x5177('0x7b')]();_0x12591e[_0x5177('0x43')](_0x5177('0x7c'),_0x1a83d2['id']);_0x5910a8[_0x5177('0x7d')](db[_0x5177('0x70')][_0x5177('0x38')](_0x12591e[_0x5177('0x7e')](),{'type':db[_0x5177('0x70')][_0x5177('0x7f')]['SELECT']})[_0x5177('0x2d')](function(_0x5d05e8){if(_0x5d05e8[_0x5177('0x4e')]===0x1){return _0x1a83d2['id'];}else{var _0x42c345=_[_0x5177('0x80')](_['map'](_0x5d05e8,_0x5177('0x81')),function(_0x15f6bd){return _[_0x5177('0x82')](_0x26fd12,_0x15f6bd);});if(_0x42c345){return _0x1a83d2['id'];}}}));}}return BPromise[_0x5177('0x83')](_0x5910a8)[_0x5177('0x2d')](function(_0x17abe1){_0x4a0f8b=_(_0x4a0f8b)[_0x5177('0x84')](_0x17abe1)[_0x5177('0x85')]()['value']();return db['FaxQueue'][_0x5177('0x55')]({'where':{'id':_0x57adf4['params']['id']}})[_0x5177('0x2d')](function(_0xd443b2){return db['sequelize'][_0x5177('0x86')](function(_0x1fb680){return _0xd443b2['removeTeams'](_0x57adf4[_0x5177('0x38')][_0x5177('0x6b')],{'transaction':_0x1fb680})[_0x5177('0x2d')](function(){if(!_[_0x5177('0x87')](_0x4a0f8b)){return _0xd443b2[_0x5177('0x88')](_0x4a0f8b,{'transaction':_0x1fb680});}})[_0x5177('0x2d')](function(){_0x4a0f8b[_0x5177('0x89')](function(_0x7a67fb){socket[_0x5177('0x72')](_0x5177('0x8a'),{'UserId':_0x7a67fb,'FaxQueueId':_0xd443b2['id']});});});});});});})[_0x5177('0x2d')](respondWithStatusCode(_0x5e4963,null))[_0x5177('0x4f')](handleError(_0x5e4963,null));};exports[_0x5177('0x8b')]=function(_0x4f27ec,_0x174655,_0x20302d){return db[_0x5177('0x48')]['find']({'where':{'id':_0x4f27ec[_0x5177('0x4d')]['id']}})[_0x5177('0x2d')](handleEntityNotFound(_0x174655,null))['then'](function(_0x15aa8a){if(_0x15aa8a){return _0x15aa8a['addAgents'](_0x4f27ec['body'][_0x5177('0x6b')],_[_0x5177('0x8c')](_0x4f27ec[_0x5177('0x50')],[_0x5177('0x6b'),'id'])||{})[_0x5177('0x8d')](function(_0x219a7c){for(var _0x56bd2b=0x0;_0x56bd2b<_0x4f27ec[_0x5177('0x50')][_0x5177('0x6b')]['length'];_0x56bd2b+=0x1){socket[_0x5177('0x72')](_0x5177('0x8e'),{'UserId':_0x4f27ec[_0x5177('0x50')][_0x5177('0x6b')][_0x56bd2b],'FaxQueueId':_0x4f27ec[_0x5177('0x4d')]['id']});}return _0x219a7c;});}})[_0x5177('0x2d')](respondWithResult(_0x174655,null))[_0x5177('0x4f')](handleError(_0x174655,null));};exports[_0x5177('0x88')]=function(_0x4e60b2,_0x193dbf,_0x566d71){return db[_0x5177('0x48')]['find']({'where':{'id':_0x4e60b2[_0x5177('0x4d')]['id']}})[_0x5177('0x2d')](handleEntityNotFound(_0x193dbf,null))[_0x5177('0x2d')](function(_0x396e5c){if(_0x396e5c){return _0x396e5c['removeAgents'](_0x4e60b2[_0x5177('0x38')][_0x5177('0x6b')])[_0x5177('0x2d')](function(){if(_[_0x5177('0x8f')](_0x4e60b2['query']['ids'])){for(var _0x561e41=0x0;_0x561e41<_0x4e60b2['query'][_0x5177('0x6b')]['length'];_0x561e41+=0x1){socket[_0x5177('0x72')]('userFaxQueue:remove',{'UserId':Number(_0x4e60b2[_0x5177('0x38')]['ids'][_0x561e41]),'FaxQueueId':Number(_0x4e60b2[_0x5177('0x4d')]['id'])});}}else{socket[_0x5177('0x72')](_0x5177('0x8a'),{'UserId':Number(_0x4e60b2[_0x5177('0x38')][_0x5177('0x6b')]),'FaxQueueId':Number(_0x4e60b2[_0x5177('0x4d')]['id'])});}});}})[_0x5177('0x2d')](respondWithStatusCode(_0x193dbf,null))[_0x5177('0x4f')](handleError(_0x193dbf,null));};exports[_0x5177('0x90')]=function(_0x1845a6,_0x4d7ada,_0x1c8890){var _0x13fa90={};var _0x3475c3={};var _0x5ed46a;var _0x467638;return db[_0x5177('0x48')][_0x5177('0x5d')]({'where':{'id':_0x1845a6[_0x5177('0x4d')]['id']}})[_0x5177('0x2d')](handleEntityNotFound(_0x4d7ada,null))[_0x5177('0x2d')](function(_0x2e871b){if(_0x2e871b){_0x5ed46a=_0x2e871b;_0x3475c3[_0x5177('0x37')]=_[_0x5177('0x39')](db[_0x5177('0x60')][_0x5177('0x35')]);_0x3475c3['query']=_[_0x5177('0x39')](_0x1845a6[_0x5177('0x38')]);_0x3475c3[_0x5177('0x3a')]=_['intersection'](_0x3475c3[_0x5177('0x37')],_0x3475c3[_0x5177('0x38')]);_0x13fa90['attributes']=_[_0x5177('0x3b')](_0x3475c3[_0x5177('0x37')],qs[_0x5177('0x3d')](_0x1845a6['query'][_0x5177('0x3d')]));_0x13fa90[_0x5177('0x3c')]=_0x13fa90[_0x5177('0x3c')][_0x5177('0x4e')]?_0x13fa90[_0x5177('0x3c')]:_0x3475c3['model'];_0x13fa90['order']=qs[_0x5177('0x42')](_0x1845a6[_0x5177('0x38')]['sort']);_0x13fa90[_0x5177('0x43')]=qs[_0x5177('0x3a')](_['pick'](_0x1845a6[_0x5177('0x38')],_0x3475c3[_0x5177('0x3a')]));if(_0x1845a6['query']['filter']){_0x13fa90[_0x5177('0x43')]=_['merge'](_0x13fa90['where'],{'$or':_[_0x5177('0x34')](_0x13fa90[_0x5177('0x3c')],function(_0x58170f){var _0x303bf4={};_0x303bf4[_0x58170f]={'$like':'%'+_0x1845a6[_0x5177('0x38')][_0x5177('0x45')]+'%'};return _0x303bf4;})});}_0x13fa90=_[_0x5177('0x5f')]({},_0x13fa90,_0x1845a6[_0x5177('0x47')]);return _0x5ed46a[_0x5177('0x90')](_0x13fa90);}})['then'](function(_0x37f9ed){if(_0x37f9ed){_0x467638=_0x37f9ed['length'];if(!_0x1845a6['query'][_0x5177('0x3e')](_0x5177('0x3f'))){_0x13fa90[_0x5177('0x40')]=qs['limit'](_0x1845a6[_0x5177('0x38')][_0x5177('0x40')]);_0x13fa90[_0x5177('0x25')]=qs[_0x5177('0x25')](_0x1845a6[_0x5177('0x38')][_0x5177('0x25')]);}return _0x5ed46a[_0x5177('0x90')](_0x13fa90);}})[_0x5177('0x2d')](function(_0x153bb1){if(_0x153bb1){return _0x153bb1?{'count':_0x467638,'rows':_0x153bb1}:null;}})[_0x5177('0x2d')](respondWithResult(_0x4d7ada,null))[_0x5177('0x4f')](handleError(_0x4d7ada,null));}; \ No newline at end of file +var _0x0472=['addAgents','omit','spread','isArray','getAgents','rimraf','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','sendStatus','status','end','json','count','offset','limit','apply','reject','then','get','FaxQueues','UserProfileResource','destroy','stack','name','send','index','map','FaxQueue','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserFaxQueue','order','findAll','User','UserId','agent','faxPause','updatedAt','format','SIP','createdAt','getTeams','Team','addTeams','ids','interface','flatMap','Agents','sequelize','transaction','each','findOrCreate','emit','userFaxQueue:save','removeTeams','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','every','includes','compact','value','isEmpty','removeAgents','userFaxQueue:remove'];(function(_0x1b1863,_0x4dd954){var _0xcafc0e=function(_0x58a40b){while(--_0x58a40b){_0x1b1863['push'](_0x1b1863['shift']());}};_0xcafc0e(++_0x4dd954);}(_0x0472,0x197));var _0x2047=function(_0x9902e2,_0x4e89ff){_0x9902e2=_0x9902e2-0x0;var _0xd95ac0=_0x0472[_0x9902e2];return _0xd95ac0;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x2047('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2047('0x1'));var rp=require(_0x2047('0x2'));var moment=require(_0x2047('0x3'));var BPromise=require(_0x2047('0x4'));var Mustache=require('mustache');var util=require(_0x2047('0x5'));var path=require('path');var sox=require(_0x2047('0x6'));var csv=require(_0x2047('0x7'));var ejs=require(_0x2047('0x8'));var fs=require('fs');var _=require(_0x2047('0x9'));var squel=require('squel');var crypto=require(_0x2047('0xa'));var jsforce=require(_0x2047('0xb'));var deskjs=require(_0x2047('0xc'));var toCsv=require(_0x2047('0x7'));var querystring=require(_0x2047('0xd'));var Papa=require(_0x2047('0xe'));var Redis=require(_0x2047('0xf'));var authService=require(_0x2047('0x10'));var qs=require(_0x2047('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2047('0x12'));var logger=require(_0x2047('0x13'))('api');var utils=require(_0x2047('0x14'));var config=require(_0x2047('0x15'));var db=require(_0x2047('0x16'))['db'];config[_0x2047('0x17')]=_[_0x2047('0x18')](config[_0x2047('0x17')],{'host':_0x2047('0x19'),'port':0x18eb});var socket=require(_0x2047('0x1a'))(new Redis(config[_0x2047('0x17')]));require(_0x2047('0x1b'))[_0x2047('0x1c')](socket);function respondWithStatusCode(_0x1aabec,_0x5a8dca){_0x5a8dca=_0x5a8dca||0xcc;return function(_0x36e8b0){if(_0x36e8b0){return _0x1aabec[_0x2047('0x1d')](_0x5a8dca);}return _0x1aabec[_0x2047('0x1e')](_0x5a8dca)[_0x2047('0x1f')]();};}function respondWithResult(_0x3e3188,_0x5bfe06){_0x5bfe06=_0x5bfe06||0xc8;return function(_0x1b8dcd){if(_0x1b8dcd){return _0x3e3188[_0x2047('0x1e')](_0x5bfe06)[_0x2047('0x20')](_0x1b8dcd);}};}function respondWithFilteredResult(_0x20a331,_0x3e1948){return function(_0xf30b4d){if(_0xf30b4d){var _0x30c8e8=_0xf30b4d[_0x2047('0x21')],_0x5f3be9=_0x3e1948[_0x2047('0x22')],_0x4b0090=_0x3e1948['offset']+_0x3e1948[_0x2047('0x23')],_0x11a3b2;if(_0x4b0090>=_0x30c8e8){_0x4b0090=_0x30c8e8;_0x11a3b2=0xc8;}else{_0x11a3b2=0xce;}_0x20a331[_0x2047('0x1e')](_0x11a3b2);return _0x20a331['set']('Content-Range',_0x5f3be9+'-'+_0x4b0090+'/'+_0x30c8e8)[_0x2047('0x20')](_0xf30b4d);}return null;};}function patchUpdates(_0xacec26){return function(_0x5e452a){try{jsonpatch[_0x2047('0x24')](_0x5e452a,_0xacec26,!![]);}catch(_0x1b070d){return BPromise[_0x2047('0x25')](_0x1b070d);}return _0x5e452a['save']();};}function saveUpdates(_0x522491,_0x271dde){return function(_0x49d1fa){if(_0x49d1fa){return _0x49d1fa['update'](_0x522491)[_0x2047('0x26')](function(_0x215c19){return _0x215c19;});}return null;};}function removeEntity(_0x338ffc,_0x170a73){return function(_0x580057){if(_0x580057){return _0x580057['destroy']()[_0x2047('0x26')](function(){var _0x20f7ea=_0x580057[_0x2047('0x27')]({'plain':!![]});var _0x2d9ca6=_0x2047('0x28');return db[_0x2047('0x29')][_0x2047('0x2a')]({'where':{'type':_0x2d9ca6,'resourceId':_0x20f7ea['id']}})['then'](function(){return _0x580057;});})[_0x2047('0x26')](function(){_0x338ffc[_0x2047('0x1e')](0xcc)[_0x2047('0x1f')]();});}};}function handleEntityNotFound(_0x518488,_0x535528){return function(_0x4db0c2){if(!_0x4db0c2){_0x518488[_0x2047('0x1d')](0x194);}return _0x4db0c2;};}function handleError(_0xe51bd8,_0x1a90af){_0x1a90af=_0x1a90af||0x1f4;return function(_0x2d369c){logger['error'](_0x2d369c[_0x2047('0x2b')]);if(_0x2d369c[_0x2047('0x2c')]){delete _0x2d369c[_0x2047('0x2c')];}_0xe51bd8[_0x2047('0x1e')](_0x1a90af)[_0x2047('0x2d')](_0x2d369c);};}exports[_0x2047('0x2e')]=function(_0x369f46,_0x33437a){var _0x31eb73={},_0x529834={},_0x24250c={'count':0x0,'rows':[]};var _0x1af4ed=_[_0x2047('0x2f')](db[_0x2047('0x30')][_0x2047('0x31')],function(_0x35a786){return{'name':_0x35a786[_0x2047('0x32')],'type':_0x35a786[_0x2047('0x33')][_0x2047('0x34')]};});_0x529834[_0x2047('0x35')]=_[_0x2047('0x2f')](_0x1af4ed,_0x2047('0x2c'));_0x529834[_0x2047('0x36')]=_[_0x2047('0x37')](_0x369f46['query']);_0x529834[_0x2047('0x38')]=_[_0x2047('0x39')](_0x529834[_0x2047('0x35')],_0x529834[_0x2047('0x36')]);_0x31eb73[_0x2047('0x3a')]=_[_0x2047('0x39')](_0x529834[_0x2047('0x35')],qs[_0x2047('0x3b')](_0x369f46[_0x2047('0x36')][_0x2047('0x3b')]));_0x31eb73[_0x2047('0x3a')]=_0x31eb73[_0x2047('0x3a')][_0x2047('0x3c')]?_0x31eb73[_0x2047('0x3a')]:_0x529834['model'];if(!_0x369f46['query'][_0x2047('0x3d')](_0x2047('0x3e'))){_0x31eb73[_0x2047('0x23')]=qs[_0x2047('0x23')](_0x369f46[_0x2047('0x36')]['limit']);_0x31eb73['offset']=qs[_0x2047('0x22')](_0x369f46[_0x2047('0x36')]['offset']);}_0x31eb73['order']=qs[_0x2047('0x3f')](_0x369f46[_0x2047('0x36')]['sort']);_0x31eb73[_0x2047('0x40')]=qs[_0x2047('0x38')](_[_0x2047('0x41')](_0x369f46[_0x2047('0x36')],_0x529834[_0x2047('0x38')]),_0x1af4ed);if(_0x369f46[_0x2047('0x36')][_0x2047('0x42')]){_0x31eb73[_0x2047('0x40')]=_['merge'](_0x31eb73[_0x2047('0x40')],{'$or':_[_0x2047('0x2f')](_0x1af4ed,function(_0x19442c){if(_0x19442c['type']!=='VIRTUAL'){var _0x26b143={};_0x26b143[_0x19442c['name']]={'$like':'%'+_0x369f46[_0x2047('0x36')]['filter']+'%'};return _0x26b143;}})});}_0x31eb73=_[_0x2047('0x43')]({},_0x31eb73,_0x369f46[_0x2047('0x44')]);var _0x3fe0ac={'where':_0x31eb73[_0x2047('0x40')]};return db[_0x2047('0x30')][_0x2047('0x21')](_0x3fe0ac)[_0x2047('0x26')](function(_0x45c679){_0x24250c[_0x2047('0x21')]=_0x45c679;if(_0x369f46['query'][_0x2047('0x45')]){_0x31eb73[_0x2047('0x46')]=[{'all':!![]}];}return db[_0x2047('0x30')]['findAll'](_0x31eb73);})[_0x2047('0x26')](function(_0x37719c){_0x24250c[_0x2047('0x47')]=_0x37719c;return _0x24250c;})[_0x2047('0x26')](respondWithFilteredResult(_0x33437a,_0x31eb73))[_0x2047('0x48')](handleError(_0x33437a,null));};exports[_0x2047('0x49')]=function(_0x101dbe,_0x51337d){var _0x268c0d={'raw':!![],'where':{'id':_0x101dbe[_0x2047('0x4a')]['id']}},_0x8321c={};_0x8321c[_0x2047('0x35')]=_[_0x2047('0x37')](db[_0x2047('0x30')][_0x2047('0x31')]);_0x8321c['query']=_['keys'](_0x101dbe['query']);_0x8321c[_0x2047('0x38')]=_[_0x2047('0x39')](_0x8321c[_0x2047('0x35')],_0x8321c[_0x2047('0x36')]);_0x268c0d[_0x2047('0x3a')]=_[_0x2047('0x39')](_0x8321c[_0x2047('0x35')],qs[_0x2047('0x3b')](_0x101dbe[_0x2047('0x36')][_0x2047('0x3b')]));_0x268c0d['attributes']=_0x268c0d[_0x2047('0x3a')][_0x2047('0x3c')]?_0x268c0d['attributes']:_0x8321c[_0x2047('0x35')];if(_0x101dbe[_0x2047('0x36')][_0x2047('0x45')]){_0x268c0d['include']=[{'all':!![]}];}_0x268c0d=_[_0x2047('0x43')]({},_0x268c0d,_0x101dbe[_0x2047('0x44')]);return db[_0x2047('0x30')][_0x2047('0x4b')](_0x268c0d)[_0x2047('0x26')](handleEntityNotFound(_0x51337d,null))[_0x2047('0x26')](respondWithResult(_0x51337d,null))[_0x2047('0x48')](handleError(_0x51337d,null));};exports[_0x2047('0x4c')]=function(_0x5ebffe,_0x1427c6){return db[_0x2047('0x30')][_0x2047('0x4c')](_0x5ebffe[_0x2047('0x4d')],{})[_0x2047('0x26')](function(_0x2ca457){var _0x58c490=_0x5ebffe[_0x2047('0x4e')]['get']({'plain':!![]});if(!_0x58c490)throw new Error(_0x2047('0x4f'));if(_0x58c490[_0x2047('0x50')]===_0x2047('0x4e')){var _0x38a233=_0x2ca457[_0x2047('0x27')]({'plain':!![]});var _0x56cee8=_0x2047('0x28');return db[_0x2047('0x51')][_0x2047('0x4b')]({'where':{'name':_0x56cee8,'userProfileId':_0x58c490['userProfileId']},'raw':!![]})[_0x2047('0x26')](function(_0x45d913){if(_0x45d913&&_0x45d913['autoAssociation']===0x0){return db['UserProfileResource'][_0x2047('0x4c')]({'name':_0x38a233['name'],'resourceId':_0x38a233['id'],'type':_0x45d913['name'],'sectionId':_0x45d913['id']},{})[_0x2047('0x26')](function(){return _0x2ca457;});}else{return _0x2ca457;}})[_0x2047('0x48')](function(_0x5a77b4){logger[_0x2047('0x52')](_0x2047('0x53'),_0x5a77b4);throw _0x5a77b4;});}return _0x2ca457;})['then'](respondWithResult(_0x1427c6,0xc9))['catch'](handleError(_0x1427c6,null));};exports['update']=function(_0x54be20,_0x15a620){if(_0x54be20[_0x2047('0x4d')]['id']){delete _0x54be20[_0x2047('0x4d')]['id'];}return db['FaxQueue'][_0x2047('0x4b')]({'where':{'id':_0x54be20[_0x2047('0x4a')]['id']}})['then'](handleEntityNotFound(_0x15a620,null))['then'](saveUpdates(_0x54be20['body'],null))['then'](respondWithResult(_0x15a620,null))[_0x2047('0x48')](handleError(_0x15a620,null));};exports['destroy']=function(_0x4fc1f3,_0x299da5){return db[_0x2047('0x30')][_0x2047('0x4b')]({'where':{'id':_0x4fc1f3[_0x2047('0x4a')]['id']}})[_0x2047('0x26')](handleEntityNotFound(_0x299da5,null))[_0x2047('0x26')](removeEntity(_0x299da5,null))['catch'](handleError(_0x299da5,null));};exports[_0x2047('0x54')]=function(_0x4121e2,_0x4152ef){return db[_0x2047('0x30')][_0x2047('0x54')]()[_0x2047('0x26')](respondWithResult(_0x4152ef,null))[_0x2047('0x48')](handleError(_0x4152ef,null));};exports[_0x2047('0x55')]=function(_0x45fe36,_0x101177,_0x18217e){var _0x210fb5={'raw':!![],'where':{}},_0x1eaf3b={},_0x343ee6;return db['FaxQueue'][_0x2047('0x56')]({'where':{'id':_0x45fe36[_0x2047('0x4a')]['id']}})[_0x2047('0x26')](handleEntityNotFound(_0x101177,null))[_0x2047('0x26')](function(_0x429791){if(_0x429791){_0x343ee6=_0x429791['get']({'plain':!![]});_0x1eaf3b[_0x2047('0x35')]=_['keys'](db[_0x2047('0x57')][_0x2047('0x31')]);_0x1eaf3b[_0x2047('0x36')]=_[_0x2047('0x37')](_0x45fe36[_0x2047('0x36')]);_0x1eaf3b['filters']=_[_0x2047('0x39')](_0x1eaf3b[_0x2047('0x35')],_0x1eaf3b['query']);_0x210fb5[_0x2047('0x3a')]=_['intersection'](_0x1eaf3b[_0x2047('0x35')],qs[_0x2047('0x3b')](_0x45fe36[_0x2047('0x36')][_0x2047('0x3b')]));_0x210fb5[_0x2047('0x3a')]=_0x210fb5[_0x2047('0x3a')][_0x2047('0x3c')]?_0x210fb5[_0x2047('0x3a')]:_0x1eaf3b[_0x2047('0x35')];if(!_0x45fe36[_0x2047('0x36')][_0x2047('0x3d')]('nolimit')){_0x210fb5[_0x2047('0x23')]=qs['limit'](_0x45fe36[_0x2047('0x36')]['limit']);_0x210fb5[_0x2047('0x22')]=qs[_0x2047('0x22')](_0x45fe36[_0x2047('0x36')][_0x2047('0x22')]);}_0x210fb5[_0x2047('0x58')]=qs['sort'](_0x45fe36[_0x2047('0x36')][_0x2047('0x3f')]);_0x210fb5[_0x2047('0x40')]=qs['filters'](_[_0x2047('0x41')](_0x45fe36[_0x2047('0x36')],_0x1eaf3b[_0x2047('0x38')]));_0x210fb5['where']['FaxQueueId']=_0x429791['id'];if(_0x45fe36['query'][_0x2047('0x42')]){_0x210fb5['where']=_[_0x2047('0x43')](_0x210fb5[_0x2047('0x40')],{'$or':_[_0x2047('0x2f')](_0x210fb5['attributes'],function(_0x29fb49){var _0x40210b={};_0x40210b[_0x29fb49]={'$like':'%'+_0x45fe36['query'][_0x2047('0x42')]+'%'};return _0x40210b;})});}_0x210fb5=_[_0x2047('0x43')]({},_0x210fb5,_0x45fe36[_0x2047('0x44')]);return db[_0x2047('0x57')][_0x2047('0x59')](_0x210fb5);}})[_0x2047('0x26')](function(_0x4cbf6f){if(_0x4cbf6f){return db[_0x2047('0x5a')]['findAndCountAll']({'where':{'id':_[_0x2047('0x2f')](_0x4cbf6f,_0x2047('0x5b')),'role':_0x2047('0x5c')},'attributes':['id','name',_0x2047('0x5d'),_0x2047('0x5e'),'createdAt']});}})['then'](function(_0x3f5443){if(_0x3f5443){return{'count':_0x3f5443[_0x2047('0x21')],'rows':_[_0x2047('0x2f')](_0x3f5443['rows'],function(_0x597449){return{'membername':_0x597449[_0x2047('0x2c')],'UserId':_0x597449['id'],'queue_name':_0x343ee6[_0x2047('0x2c')],'FaxQueueId':_0x343ee6['id'],'interface':util[_0x2047('0x5f')]('%s/%s',_0x2047('0x60'),_0x597449[_0x2047('0x2c')]),'penalty':0x0,'paused':_0x597449['faxPause'],'createdAt':_0x597449[_0x2047('0x61')],'updatedAt':_0x597449['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x2047('0x26')](respondWithFilteredResult(_0x101177,_0x210fb5))[_0x2047('0x48')](handleError(_0x101177,null));};exports[_0x2047('0x62')]=function(_0x3b7e53,_0x36a27d,_0x41251d){var _0x3ae92a={};var _0x123a59={};var _0x25d750;var _0x4ef640;return db[_0x2047('0x30')][_0x2047('0x56')]({'where':{'id':_0x3b7e53[_0x2047('0x4a')]['id']}})[_0x2047('0x26')](handleEntityNotFound(_0x36a27d,null))[_0x2047('0x26')](function(_0x514632){if(_0x514632){_0x25d750=_0x514632;_0x123a59[_0x2047('0x35')]=_[_0x2047('0x37')](db[_0x2047('0x63')][_0x2047('0x31')]);_0x123a59[_0x2047('0x36')]=_[_0x2047('0x37')](_0x3b7e53[_0x2047('0x36')]);_0x123a59[_0x2047('0x38')]=_[_0x2047('0x39')](_0x123a59[_0x2047('0x35')],_0x123a59[_0x2047('0x36')]);_0x3ae92a[_0x2047('0x3a')]=_[_0x2047('0x39')](_0x123a59[_0x2047('0x35')],qs['fields'](_0x3b7e53[_0x2047('0x36')][_0x2047('0x3b')]));_0x3ae92a[_0x2047('0x3a')]=_0x3ae92a['attributes'][_0x2047('0x3c')]?_0x3ae92a[_0x2047('0x3a')]:_0x123a59[_0x2047('0x35')];_0x3ae92a[_0x2047('0x58')]=qs[_0x2047('0x3f')](_0x3b7e53[_0x2047('0x36')][_0x2047('0x3f')]);_0x3ae92a[_0x2047('0x40')]=qs[_0x2047('0x38')](_[_0x2047('0x41')](_0x3b7e53[_0x2047('0x36')],_0x123a59[_0x2047('0x38')]));if(_0x3b7e53['query'][_0x2047('0x42')]){_0x3ae92a['where']=_['merge'](_0x3ae92a[_0x2047('0x40')],{'$or':_['map'](_0x3ae92a['attributes'],function(_0x3a9cac){var _0x145198={};_0x145198[_0x3a9cac]={'$like':'%'+_0x3b7e53[_0x2047('0x36')][_0x2047('0x42')]+'%'};return _0x145198;})});}_0x3ae92a=_[_0x2047('0x43')]({},_0x3ae92a,_0x3b7e53[_0x2047('0x44')]);return _0x25d750['getTeams'](_0x3ae92a);}})[_0x2047('0x26')](function(_0x118796){if(_0x118796){_0x4ef640=_0x118796[_0x2047('0x3c')];if(!_0x3b7e53[_0x2047('0x36')][_0x2047('0x3d')](_0x2047('0x3e'))){_0x3ae92a[_0x2047('0x23')]=qs[_0x2047('0x23')](_0x3b7e53['query'][_0x2047('0x23')]);_0x3ae92a['offset']=qs[_0x2047('0x22')](_0x3b7e53[_0x2047('0x36')][_0x2047('0x22')]);}return _0x25d750[_0x2047('0x62')](_0x3ae92a);}})['then'](function(_0xb3bdbc){if(_0xb3bdbc){return _0xb3bdbc?{'count':_0x4ef640,'rows':_0xb3bdbc}:null;}})['then'](respondWithResult(_0x36a27d,null))[_0x2047('0x48')](handleError(_0x36a27d,null));};exports[_0x2047('0x64')]=function(_0x19598a,_0x2af928,_0x1b392e){var _0x1b2dd8=_0x19598a[_0x2047('0x4d')][_0x2047('0x65')];return db['Team'][_0x2047('0x59')]({'where':{'id':_0x1b2dd8},'attributes':['id'],'include':[{'model':db[_0x2047('0x5a')],'as':'Agents','attributes':['id',_0x2047('0x2c'),'online','voicePause',_0x2047('0x66')],'raw':!![]}]})[_0x2047('0x26')](function(_0x5344ed){if(_0x5344ed){var _0x11cf37=_[_0x2047('0x67')](_0x5344ed,function(_0x1d2253){var _0x4d1d8b=_0x1d2253[_0x2047('0x27')]({'plain':!![]});return _0x4d1d8b[_0x2047('0x68')];});return db['FaxQueue']['find']({'where':{'id':_0x19598a[_0x2047('0x4a')]['id']}})[_0x2047('0x26')](function(_0x260d07){return db[_0x2047('0x69')][_0x2047('0x6a')](function(_0x24fa20){return _0x260d07['addTeams'](_0x1b2dd8,{'transaction':_0x24fa20})[_0x2047('0x26')](function(){return BPromise[_0x2047('0x6b')](_0x11cf37,function(_0x5514fe){return db[_0x2047('0x57')][_0x2047('0x6c')]({'where':{'UserId':_0x5514fe['id'],'FaxQueueId':_0x19598a['params']['id']},'transaction':_0x24fa20});});})[_0x2047('0x26')](function(){_0x11cf37['forEach'](function(_0x243deb){socket[_0x2047('0x6d')](_0x2047('0x6e'),{'UserId':_0x243deb['id'],'FaxQueueId':_0x260d07['id']});});});});});}})[_0x2047('0x26')](respondWithStatusCode(_0x2af928,null))[_0x2047('0x48')](handleError(_0x2af928,null));};exports[_0x2047('0x6f')]=function(_0xfeef11,_0x86fc2e,_0x4f9e94){return db[_0x2047('0x63')][_0x2047('0x59')]({'where':{'id':_0xfeef11[_0x2047('0x36')]['ids']},'attributes':['id'],'include':[{'model':db[_0x2047('0x5a')],'as':_0x2047('0x68'),'attributes':['id'],'raw':!![]}]})[_0x2047('0x26')](handleEntityNotFound(_0x86fc2e,null))[_0x2047('0x26')](function(_0x14877e){var _0xec629f=_[_0x2047('0x2f')](_0x14877e,'id');var _0x8a3079=[];var _0x322b76=[];var _0x565b2a=squel['select']();_0x565b2a[_0x2047('0x70')](_0x2047('0x71'))[_0x2047('0x72')]('team_has_fax_queues','tq')[_0x2047('0x73')](_0x2047('0x74'),'ut',_0x2047('0x75'))['where'](_0x2047('0x76'),_0xfeef11[_0x2047('0x4a')]['id']);for(var _0x35ab27=0x0;_0x35ab27<_0x14877e[_0x2047('0x3c')];_0x35ab27+=0x1){let _0x21902a=_0x14877e[_0x35ab27];for(var _0x5d313d=0x0;_0x5d313d<_0x21902a[_0x2047('0x68')]['length'];_0x5d313d+=0x1){let _0x27756f=_0x21902a[_0x2047('0x68')][_0x5d313d];var _0x6d7583=_0x565b2a['clone']();_0x6d7583[_0x2047('0x40')](_0x2047('0x77'),_0x27756f['id']);_0x322b76[_0x2047('0x78')](db[_0x2047('0x69')][_0x2047('0x36')](_0x6d7583[_0x2047('0x79')](),{'type':db['sequelize']['QueryTypes']['SELECT']})[_0x2047('0x26')](function(_0x3cfdbe){if(_0x3cfdbe[_0x2047('0x3c')]===0x1){return _0x27756f['id'];}else{var _0x382080=_[_0x2047('0x7a')](_[_0x2047('0x2f')](_0x3cfdbe,'TeamId'),function(_0x5daf71){return _[_0x2047('0x7b')](_0xec629f,_0x5daf71);});if(_0x382080){return _0x27756f['id'];}}}));}}return BPromise['all'](_0x322b76)[_0x2047('0x26')](function(_0x1e5ab8){_0x8a3079=_(_0x8a3079)['union'](_0x1e5ab8)[_0x2047('0x7c')]()[_0x2047('0x7d')]();return db['FaxQueue'][_0x2047('0x4b')]({'where':{'id':_0xfeef11['params']['id']}})[_0x2047('0x26')](function(_0x2a6c87){return db[_0x2047('0x69')][_0x2047('0x6a')](function(_0x35f2d8){return _0x2a6c87[_0x2047('0x6f')](_0xfeef11[_0x2047('0x36')][_0x2047('0x65')],{'transaction':_0x35f2d8})['then'](function(){if(!_[_0x2047('0x7e')](_0x8a3079)){return _0x2a6c87[_0x2047('0x7f')](_0x8a3079,{'transaction':_0x35f2d8});}})[_0x2047('0x26')](function(){_0x8a3079['forEach'](function(_0xbe4fb2){socket[_0x2047('0x6d')](_0x2047('0x80'),{'UserId':_0xbe4fb2,'FaxQueueId':_0x2a6c87['id']});});});});});});})[_0x2047('0x26')](respondWithStatusCode(_0x86fc2e,null))[_0x2047('0x48')](handleError(_0x86fc2e,null));};exports[_0x2047('0x81')]=function(_0x370576,_0x433b03,_0x5312b5){return db[_0x2047('0x30')][_0x2047('0x4b')]({'where':{'id':_0x370576[_0x2047('0x4a')]['id']}})[_0x2047('0x26')](handleEntityNotFound(_0x433b03,null))[_0x2047('0x26')](function(_0xd86b8e){if(_0xd86b8e){return _0xd86b8e[_0x2047('0x81')](_0x370576[_0x2047('0x4d')][_0x2047('0x65')],_[_0x2047('0x82')](_0x370576[_0x2047('0x4d')],['ids','id'])||{})[_0x2047('0x83')](function(_0x264820){for(var _0x5ba7fa=0x0;_0x5ba7fa<_0x370576[_0x2047('0x4d')][_0x2047('0x65')][_0x2047('0x3c')];_0x5ba7fa+=0x1){socket[_0x2047('0x6d')]('userFaxQueue:save',{'UserId':_0x370576['body'][_0x2047('0x65')][_0x5ba7fa],'FaxQueueId':_0x370576[_0x2047('0x4a')]['id']});}return _0x264820;});}})[_0x2047('0x26')](respondWithResult(_0x433b03,null))[_0x2047('0x48')](handleError(_0x433b03,null));};exports['removeAgents']=function(_0x12404e,_0x492b49,_0x3a9788){return db[_0x2047('0x30')][_0x2047('0x4b')]({'where':{'id':_0x12404e['params']['id']}})[_0x2047('0x26')](handleEntityNotFound(_0x492b49,null))[_0x2047('0x26')](function(_0x4fb898){if(_0x4fb898){return _0x4fb898[_0x2047('0x7f')](_0x12404e[_0x2047('0x36')][_0x2047('0x65')])[_0x2047('0x26')](function(){if(_[_0x2047('0x84')](_0x12404e['query'][_0x2047('0x65')])){for(var _0x32ae5a=0x0;_0x32ae5a<_0x12404e[_0x2047('0x36')]['ids'][_0x2047('0x3c')];_0x32ae5a+=0x1){socket[_0x2047('0x6d')](_0x2047('0x80'),{'UserId':Number(_0x12404e[_0x2047('0x36')][_0x2047('0x65')][_0x32ae5a]),'FaxQueueId':Number(_0x12404e[_0x2047('0x4a')]['id'])});}}else{socket['emit'](_0x2047('0x80'),{'UserId':Number(_0x12404e[_0x2047('0x36')][_0x2047('0x65')]),'FaxQueueId':Number(_0x12404e['params']['id'])});}});}})['then'](respondWithStatusCode(_0x492b49,null))['catch'](handleError(_0x492b49,null));};exports[_0x2047('0x85')]=function(_0x86415,_0x16bf1b,_0x120702){var _0x125de0={};var _0x5b6b01={};var _0x17bbfa;var _0x59274d;return db[_0x2047('0x30')]['findOne']({'where':{'id':_0x86415[_0x2047('0x4a')]['id']}})['then'](handleEntityNotFound(_0x16bf1b,null))[_0x2047('0x26')](function(_0x3602d8){if(_0x3602d8){_0x17bbfa=_0x3602d8;_0x5b6b01[_0x2047('0x35')]=_[_0x2047('0x37')](db[_0x2047('0x5a')][_0x2047('0x31')]);_0x5b6b01[_0x2047('0x36')]=_[_0x2047('0x37')](_0x86415[_0x2047('0x36')]);_0x5b6b01[_0x2047('0x38')]=_[_0x2047('0x39')](_0x5b6b01['model'],_0x5b6b01[_0x2047('0x36')]);_0x125de0[_0x2047('0x3a')]=_['intersection'](_0x5b6b01['model'],qs[_0x2047('0x3b')](_0x86415[_0x2047('0x36')][_0x2047('0x3b')]));_0x125de0['attributes']=_0x125de0[_0x2047('0x3a')][_0x2047('0x3c')]?_0x125de0[_0x2047('0x3a')]:_0x5b6b01['model'];_0x125de0[_0x2047('0x58')]=qs['sort'](_0x86415['query']['sort']);_0x125de0[_0x2047('0x40')]=qs['filters'](_[_0x2047('0x41')](_0x86415[_0x2047('0x36')],_0x5b6b01[_0x2047('0x38')]));if(_0x86415[_0x2047('0x36')]['filter']){_0x125de0[_0x2047('0x40')]=_[_0x2047('0x43')](_0x125de0[_0x2047('0x40')],{'$or':_[_0x2047('0x2f')](_0x125de0[_0x2047('0x3a')],function(_0x59e7c1){var _0x2fbed={};_0x2fbed[_0x59e7c1]={'$like':'%'+_0x86415['query'][_0x2047('0x42')]+'%'};return _0x2fbed;})});}_0x125de0=_[_0x2047('0x43')]({},_0x125de0,_0x86415['options']);return _0x17bbfa[_0x2047('0x85')](_0x125de0);}})[_0x2047('0x26')](function(_0x2e62ad){if(_0x2e62ad){_0x59274d=_0x2e62ad[_0x2047('0x3c')];if(!_0x86415[_0x2047('0x36')][_0x2047('0x3d')](_0x2047('0x3e'))){_0x125de0[_0x2047('0x23')]=qs['limit'](_0x86415[_0x2047('0x36')][_0x2047('0x23')]);_0x125de0[_0x2047('0x22')]=qs[_0x2047('0x22')](_0x86415['query'][_0x2047('0x22')]);}return _0x17bbfa[_0x2047('0x85')](_0x125de0);}})['then'](function(_0x3b4993){if(_0x3b4993){return _0x3b4993?{'count':_0x59274d,'rows':_0x3b4993}:null;}})[_0x2047('0x26')](respondWithResult(_0x16bf1b,null))['catch'](handleError(_0x16bf1b,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index b7468ac..db24250 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 _0x86d3=['FaxQueue','setMaxListeners','save','update','emit','hasOwnProperty','events'];(function(_0x5b1dcc,_0x43b3b0){var _0x3c8fa9=function(_0xe70816){while(--_0xe70816){_0x5b1dcc['push'](_0x5b1dcc['shift']());}};_0x3c8fa9(++_0x43b3b0);}(_0x86d3,0xd1));var _0x386d=function(_0x15fab0,_0x416c7d){_0x15fab0=_0x15fab0-0x0;var _0x1b41a8=_0x86d3[_0x15fab0];return _0x1b41a8;};'use strict';var EventEmitter=require(_0x386d('0x0'));var FaxQueue=require('../../mysqldb')['db'][_0x386d('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x386d('0x2')](0x0);var events={'afterCreate':_0x386d('0x3'),'afterUpdate':_0x386d('0x4'),'afterDestroy':'remove'};function emitEvent(_0x5d8949){return function(_0x25d223,_0x22b8ac,_0x40f71e){FaxQueueEvents[_0x386d('0x5')](_0x5d8949+':'+_0x25d223['id'],_0x25d223);FaxQueueEvents[_0x386d('0x5')](_0x5d8949,_0x25d223);_0x40f71e(null);};}for(var e in events){if(events[_0x386d('0x6')](e)){var event=events[e];FaxQueue['hook'](e,emitEvent(event));}}module['exports']=FaxQueueEvents; \ No newline at end of file +var _0x7596=['../../mysqldb','FaxQueue','setMaxListeners','remove','emit','hasOwnProperty','hook','exports'];(function(_0x4a73ea,_0x59eff8){var _0x5e2737=function(_0x3832c5){while(--_0x3832c5){_0x4a73ea['push'](_0x4a73ea['shift']());}};_0x5e2737(++_0x59eff8);}(_0x7596,0xe0));var _0x6759=function(_0xa30766,_0x6f613e){_0xa30766=_0xa30766-0x0;var _0x24e780=_0x7596[_0xa30766];return _0x24e780;};'use strict';var EventEmitter=require('events');var FaxQueue=require(_0x6759('0x0'))['db'][_0x6759('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x6759('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x6759('0x3')};function emitEvent(_0x210258){return function(_0x59f544,_0x17ff41,_0xf939ad){FaxQueueEvents['emit'](_0x210258+':'+_0x59f544['id'],_0x59f544);FaxQueueEvents[_0x6759('0x4')](_0x210258,_0x59f544);_0xf939ad(null);};}for(var e in events){if(events[_0x6759('0x5')](e)){var event=events[e];FaxQueue[_0x6759('0x6')](e,emitEvent(event));}}module[_0x6759('0x7')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 2d7e2b0..014ecaf 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 _0x2652=['FaxQueue','fax_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','./faxQueue.attributes','exports','define'];(function(_0x36b9da,_0x580057){var _0x4c84ff=function(_0xae9a9f){while(--_0xae9a9f){_0x36b9da['push'](_0x36b9da['shift']());}};_0x4c84ff(++_0x580057);}(_0x2652,0x116));var _0x2265=function(_0x3bfb5b,_0x32c9b5){_0x3bfb5b=_0x3bfb5b-0x0;var _0x1d193f=_0x2652[_0x3bfb5b];return _0x1d193f;};'use strict';var _=require(_0x2265('0x0'));var util=require(_0x2265('0x1'));var logger=require(_0x2265('0x2'))(_0x2265('0x3'));var moment=require(_0x2265('0x4'));var BPromise=require(_0x2265('0x5'));var rp=require(_0x2265('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x2265('0x7'));module[_0x2265('0x8')]=function(_0x215929,_0x446ab9){return _0x215929[_0x2265('0x9')](_0x2265('0xa'),attributes,{'tableName':_0x2265('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7056=['../../config/logger','api','moment','bluebird','path','rimraf','./faxQueue.attributes','exports','fax_queues','lodash','util'];(function(_0x44ffd9,_0x41db68){var _0x45e04d=function(_0x4a19ad){while(--_0x4a19ad){_0x44ffd9['push'](_0x44ffd9['shift']());}};_0x45e04d(++_0x41db68);}(_0x7056,0x1a0));var _0x6705=function(_0x3ed712,_0x5a824a){_0x3ed712=_0x3ed712-0x0;var _0x2eea38=_0x7056[_0x3ed712];return _0x2eea38;};'use strict';var _=require(_0x6705('0x0'));var util=require(_0x6705('0x1'));var logger=require(_0x6705('0x2'))(_0x6705('0x3'));var moment=require(_0x6705('0x4'));var BPromise=require(_0x6705('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6705('0x6'));var rimraf=require(_0x6705('0x7'));var config=require('../../config/environment');var attributes=require(_0x6705('0x8'));module[_0x6705('0x9')]=function(_0x56bff3,_0x303956){return _0x56bff3['define']('FaxQueue',attributes,{'tableName':_0x6705('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 3860ebb..4e9566e 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 _0xee53=['client','localhost','socket.io-emitter','redis','./faxQueue.socket','register','request','then','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','GetFaxQueue','FaxQueue','findAll','options','where','limit','include','map','attributes','ShowFaxQueue','find','raw','model','stringify','lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x4a5578,_0x4efc52){var _0x19eebc=function(_0x57b5cd){while(--_0x57b5cd){_0x4a5578['push'](_0x4a5578['shift']());}};_0x19eebc(++_0x4efc52);}(_0xee53,0x1d7));var _0x3ee5=function(_0x587693,_0x27fe90){_0x587693=_0x587693-0x0;var _0x510a1a=_0xee53[_0x587693];return _0x510a1a;};'use strict';var _=require(_0x3ee5('0x0'));var util=require(_0x3ee5('0x1'));var moment=require(_0x3ee5('0x2'));var BPromise=require('bluebird');var rs=require(_0x3ee5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x3ee5('0x4'));var logger=require(_0x3ee5('0x5'))(_0x3ee5('0x6'));var config=require(_0x3ee5('0x7'));var jayson=require(_0x3ee5('0x8'));var client=jayson[_0x3ee5('0x9')]['http']({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0x3ee5('0xa'),'port':0x18eb});var socket=require(_0x3ee5('0xb'))(new Redis(config[_0x3ee5('0xc')]));require(_0x3ee5('0xd'))[_0x3ee5('0xe')](socket);function respondWithRpcPromise(_0xd4c754,_0x41ee16,_0x930de7){return new BPromise(function(_0xf1d77,_0x439b3e){return client[_0x3ee5('0xf')](_0xd4c754,_0x930de7)[_0x3ee5('0x10')](function(_0x5daaae){logger['info'](_0x3ee5('0x11'),_0x41ee16,_0x3ee5('0x12'));logger[_0x3ee5('0x13')](_0x3ee5('0x14'),_0x41ee16,'request\x20sent',JSON['stringify'](_0x5daaae));if(_0x5daaae[_0x3ee5('0x15')]){if(_0x5daaae[_0x3ee5('0x15')]['code']===0x1f4){logger['error'](_0x3ee5('0x11'),_0x41ee16,_0x5daaae[_0x3ee5('0x15')][_0x3ee5('0x16')]);return _0x439b3e(_0x5daaae[_0x3ee5('0x15')]['message']);}logger['error'](_0x3ee5('0x11'),_0x41ee16,_0x5daaae['error'][_0x3ee5('0x16')]);return _0xf1d77(_0x5daaae[_0x3ee5('0x15')]['message']);}else{logger[_0x3ee5('0x17')](_0x3ee5('0x11'),_0x41ee16,'request\x20sent');_0xf1d77(_0x5daaae[_0x3ee5('0x18')][_0x3ee5('0x16')]);}})[_0x3ee5('0x19')](function(_0x430b76){logger['error'](_0x3ee5('0x11'),_0x41ee16,_0x430b76);_0x439b3e(_0x430b76);});});}exports[_0x3ee5('0x1a')]=function(_0x56b43b){var _0x16fb49=this;return new Promise(function(_0x357aa8,_0x4b2627){return db[_0x3ee5('0x1b')][_0x3ee5('0x1c')]({'raw':_0x56b43b[_0x3ee5('0x1d')]?_0x56b43b[_0x3ee5('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x56b43b['options']?_0x56b43b[_0x3ee5('0x1d')][_0x3ee5('0x1e')]||null:null,'attributes':_0x56b43b['options']?_0x56b43b[_0x3ee5('0x1d')]['attributes']||null:null,'limit':_0x56b43b[_0x3ee5('0x1d')]?_0x56b43b['options'][_0x3ee5('0x1f')]||null:null,'include':_0x56b43b['options']?_0x56b43b['options'][_0x3ee5('0x20')]?_[_0x3ee5('0x21')](_0x56b43b[_0x3ee5('0x1d')][_0x3ee5('0x20')],function(_0x43165a){return{'model':db[_0x43165a['model']],'as':_0x43165a['as'],'attributes':_0x43165a['attributes'],'include':_0x43165a[_0x3ee5('0x20')]?_[_0x3ee5('0x21')](_0x43165a[_0x3ee5('0x20')],function(_0x2daafb){return{'model':db[_0x2daafb['model']],'as':_0x2daafb['as'],'attributes':_0x2daafb['attributes'],'include':_0x2daafb[_0x3ee5('0x20')]?_[_0x3ee5('0x21')](_0x2daafb[_0x3ee5('0x20')],function(_0x3041b1){return{'model':db[_0x3041b1['model']],'as':_0x3041b1['as'],'attributes':_0x3041b1[_0x3ee5('0x22')]};}):[]};}):[]};}):[]:[]})[_0x3ee5('0x10')](function(_0xa9f139){logger['info'](_0x3ee5('0x1a'),_0x56b43b);logger['debug'](_0x3ee5('0x1a'),_0x56b43b,JSON['stringify'](_0xa9f139));_0x357aa8(_0xa9f139);})[_0x3ee5('0x19')](function(_0x19ebf9){logger[_0x3ee5('0x15')](_0x3ee5('0x1a'),_0x19ebf9['message'],_0x56b43b);_0x4b2627(_0x16fb49['error'](0x1f4,_0x19ebf9['message']));});});};exports[_0x3ee5('0x23')]=function(_0x42bdee){var _0x2a84b9=this;return new Promise(function(_0x293bfa,_0x4f035b){return db[_0x3ee5('0x1b')][_0x3ee5('0x24')]({'raw':_0x42bdee[_0x3ee5('0x1d')]?_0x42bdee['options'][_0x3ee5('0x25')]===undefined?!![]:![]:!![],'where':_0x42bdee[_0x3ee5('0x1d')]?_0x42bdee[_0x3ee5('0x1d')][_0x3ee5('0x1e')]||null:null,'attributes':_0x42bdee[_0x3ee5('0x1d')]?_0x42bdee[_0x3ee5('0x1d')][_0x3ee5('0x22')]||null:null,'include':_0x42bdee[_0x3ee5('0x1d')]?_0x42bdee[_0x3ee5('0x1d')][_0x3ee5('0x20')]?_[_0x3ee5('0x21')](_0x42bdee['options'][_0x3ee5('0x20')],function(_0x41779e){return{'model':db[_0x41779e[_0x3ee5('0x26')]],'as':_0x41779e['as'],'attributes':_0x41779e[_0x3ee5('0x22')],'include':_0x41779e[_0x3ee5('0x20')]?_[_0x3ee5('0x21')](_0x41779e[_0x3ee5('0x20')],function(_0x4810c2){return{'model':db[_0x4810c2[_0x3ee5('0x26')]],'as':_0x4810c2['as'],'attributes':_0x4810c2[_0x3ee5('0x22')],'include':_0x4810c2[_0x3ee5('0x20')]?_[_0x3ee5('0x21')](_0x4810c2['include'],function(_0x465495){return{'model':db[_0x465495[_0x3ee5('0x26')]],'as':_0x465495['as'],'attributes':_0x465495[_0x3ee5('0x22')]};}):[]};}):[]};}):[]:[]})[_0x3ee5('0x10')](function(_0x53f78a){logger['info'](_0x3ee5('0x23'),_0x42bdee);logger[_0x3ee5('0x13')](_0x3ee5('0x23'),_0x42bdee,JSON[_0x3ee5('0x27')](_0x53f78a));_0x293bfa(_0x53f78a);})[_0x3ee5('0x19')](function(_0x5d7f98){logger[_0x3ee5('0x15')](_0x3ee5('0x23'),_0x5d7f98[_0x3ee5('0x16')],_0x42bdee);_0x4f035b(_0x2a84b9[_0x3ee5('0x15')](0x1f4,_0x5d7f98['message']));});});}; \ No newline at end of file +var _0xe3a0=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./faxQueue.socket','register','info','FaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','FaxQueue,\x20%s,\x20%s','message','result','catch','GetFaxQueue','FaxQueue','findAll','options','where','attributes','limit','include','map','model','then','debug','ShowFaxQueue','find','raw','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x238b4b,_0x2fe72d){var _0x4fe904=function(_0x434e9c){while(--_0x434e9c){_0x238b4b['push'](_0x238b4b['shift']());}};_0x4fe904(++_0x2fe72d);}(_0xe3a0,0x119));var _0x0e3a=function(_0x175899,_0x2af79b){_0x175899=_0x175899-0x0;var _0x43aa10=_0xe3a0[_0x175899];return _0x43aa10;};'use strict';var _=require('lodash');var util=require(_0x0e3a('0x0'));var moment=require('moment');var BPromise=require(_0x0e3a('0x1'));var rs=require(_0x0e3a('0x2'));var fs=require('fs');var Redis=require(_0x0e3a('0x3'));var db=require(_0x0e3a('0x4'))['db'];var utils=require(_0x0e3a('0x5'));var logger=require(_0x0e3a('0x6'))(_0x0e3a('0x7'));var config=require(_0x0e3a('0x8'));var jayson=require(_0x0e3a('0x9'));var client=jayson[_0x0e3a('0xa')][_0x0e3a('0xb')]({'port':0x232a});config[_0x0e3a('0xc')]=_['defaults'](config[_0x0e3a('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x0e3a('0xd'))(new Redis(config[_0x0e3a('0xc')]));require(_0x0e3a('0xe'))[_0x0e3a('0xf')](socket);function respondWithRpcPromise(_0x50b154,_0x4c2fb8,_0x4d61f6){return new BPromise(function(_0x396f24,_0x8b36f1){return client['request'](_0x50b154,_0x4d61f6)['then'](function(_0x4d780b){logger[_0x0e3a('0x10')]('FaxQueue,\x20%s,\x20%s',_0x4c2fb8,'request\x20sent');logger['debug'](_0x0e3a('0x11'),_0x4c2fb8,_0x0e3a('0x12'),JSON[_0x0e3a('0x13')](_0x4d780b));if(_0x4d780b['error']){if(_0x4d780b[_0x0e3a('0x14')][_0x0e3a('0x15')]===0x1f4){logger[_0x0e3a('0x14')](_0x0e3a('0x16'),_0x4c2fb8,_0x4d780b[_0x0e3a('0x14')][_0x0e3a('0x17')]);return _0x8b36f1(_0x4d780b[_0x0e3a('0x14')][_0x0e3a('0x17')]);}logger[_0x0e3a('0x14')](_0x0e3a('0x16'),_0x4c2fb8,_0x4d780b[_0x0e3a('0x14')]['message']);return _0x396f24(_0x4d780b[_0x0e3a('0x14')]['message']);}else{logger[_0x0e3a('0x10')](_0x0e3a('0x16'),_0x4c2fb8,_0x0e3a('0x12'));_0x396f24(_0x4d780b[_0x0e3a('0x18')]['message']);}})[_0x0e3a('0x19')](function(_0x531e58){logger[_0x0e3a('0x14')](_0x0e3a('0x16'),_0x4c2fb8,_0x531e58);_0x8b36f1(_0x531e58);});});}exports[_0x0e3a('0x1a')]=function(_0x227e21){var _0x51cd45=this;return new Promise(function(_0x5bbc98,_0x187d66){return db[_0x0e3a('0x1b')][_0x0e3a('0x1c')]({'raw':_0x227e21[_0x0e3a('0x1d')]?_0x227e21[_0x0e3a('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x227e21['options']?_0x227e21['options'][_0x0e3a('0x1e')]||null:null,'attributes':_0x227e21[_0x0e3a('0x1d')]?_0x227e21[_0x0e3a('0x1d')][_0x0e3a('0x1f')]||null:null,'limit':_0x227e21[_0x0e3a('0x1d')]?_0x227e21[_0x0e3a('0x1d')][_0x0e3a('0x20')]||null:null,'include':_0x227e21[_0x0e3a('0x1d')]?_0x227e21[_0x0e3a('0x1d')][_0x0e3a('0x21')]?_['map'](_0x227e21[_0x0e3a('0x1d')][_0x0e3a('0x21')],function(_0x28976b){return{'model':db[_0x28976b['model']],'as':_0x28976b['as'],'attributes':_0x28976b['attributes'],'include':_0x28976b[_0x0e3a('0x21')]?_[_0x0e3a('0x22')](_0x28976b[_0x0e3a('0x21')],function(_0x55ac13){return{'model':db[_0x55ac13[_0x0e3a('0x23')]],'as':_0x55ac13['as'],'attributes':_0x55ac13[_0x0e3a('0x1f')],'include':_0x55ac13[_0x0e3a('0x21')]?_[_0x0e3a('0x22')](_0x55ac13['include'],function(_0x25b8ed){return{'model':db[_0x25b8ed[_0x0e3a('0x23')]],'as':_0x25b8ed['as'],'attributes':_0x25b8ed['attributes']};}):[]};}):[]};}):[]:[]})[_0x0e3a('0x24')](function(_0x2c8d66){logger[_0x0e3a('0x10')](_0x0e3a('0x1a'),_0x227e21);logger[_0x0e3a('0x25')](_0x0e3a('0x1a'),_0x227e21,JSON['stringify'](_0x2c8d66));_0x5bbc98(_0x2c8d66);})[_0x0e3a('0x19')](function(_0x5597c4){logger[_0x0e3a('0x14')](_0x0e3a('0x1a'),_0x5597c4[_0x0e3a('0x17')],_0x227e21);_0x187d66(_0x51cd45['error'](0x1f4,_0x5597c4[_0x0e3a('0x17')]));});});};exports[_0x0e3a('0x26')]=function(_0x45361b){var _0x40a35c=this;return new Promise(function(_0x10105a,_0x3d701b){return db[_0x0e3a('0x1b')][_0x0e3a('0x27')]({'raw':_0x45361b['options']?_0x45361b[_0x0e3a('0x1d')][_0x0e3a('0x28')]===undefined?!![]:![]:!![],'where':_0x45361b[_0x0e3a('0x1d')]?_0x45361b[_0x0e3a('0x1d')][_0x0e3a('0x1e')]||null:null,'attributes':_0x45361b[_0x0e3a('0x1d')]?_0x45361b[_0x0e3a('0x1d')]['attributes']||null:null,'include':_0x45361b[_0x0e3a('0x1d')]?_0x45361b[_0x0e3a('0x1d')][_0x0e3a('0x21')]?_['map'](_0x45361b[_0x0e3a('0x1d')][_0x0e3a('0x21')],function(_0x25df58){return{'model':db[_0x25df58['model']],'as':_0x25df58['as'],'attributes':_0x25df58[_0x0e3a('0x1f')],'include':_0x25df58[_0x0e3a('0x21')]?_[_0x0e3a('0x22')](_0x25df58[_0x0e3a('0x21')],function(_0x4f87ee){return{'model':db[_0x4f87ee[_0x0e3a('0x23')]],'as':_0x4f87ee['as'],'attributes':_0x4f87ee[_0x0e3a('0x1f')],'include':_0x4f87ee[_0x0e3a('0x21')]?_[_0x0e3a('0x22')](_0x4f87ee[_0x0e3a('0x21')],function(_0x5e325f){return{'model':db[_0x5e325f[_0x0e3a('0x23')]],'as':_0x5e325f['as'],'attributes':_0x5e325f[_0x0e3a('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x0e3a('0x24')](function(_0x5090fb){logger[_0x0e3a('0x10')](_0x0e3a('0x26'),_0x45361b);logger[_0x0e3a('0x25')](_0x0e3a('0x26'),_0x45361b,JSON[_0x0e3a('0x13')](_0x5090fb));_0x10105a(_0x5090fb);})['catch'](function(_0x5494db){logger[_0x0e3a('0x14')](_0x0e3a('0x26'),_0x5494db['message'],_0x45361b);_0x3d701b(_0x40a35c[_0x0e3a('0x14')](0x1f4,_0x5494db[_0x0e3a('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 5a2782f..e7ca737 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 _0x47cb=['update','emit','removeListener','register','length','faxQueue:','./faxQueue.events','save'];(function(_0x1622a0,_0x2b55a9){var _0x2a2308=function(_0x38d05b){while(--_0x38d05b){_0x1622a0['push'](_0x1622a0['shift']());}};_0x2a2308(++_0x2b55a9);}(_0x47cb,0xd6));var _0xb47c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x47cb[_0x3dd15e];return _0x231fd0;};'use strict';var FaxQueueEvents=require(_0xb47c('0x0'));var events=[_0xb47c('0x1'),'remove',_0xb47c('0x2')];function createListener(_0x513b65,_0x5b42b1){return function(_0x37f4f5){_0x5b42b1[_0xb47c('0x3')](_0x513b65,_0x37f4f5);};}function removeListener(_0x1c8c18,_0x549858){return function(){FaxQueueEvents[_0xb47c('0x4')](_0x1c8c18,_0x549858);};}exports[_0xb47c('0x5')]=function(_0x1337f2){for(var _0x739d13=0x0,_0x46f5d6=events[_0xb47c('0x6')];_0x739d13<_0x46f5d6;_0x739d13++){var _0x34246a=events[_0x739d13];var _0x497442=createListener(_0xb47c('0x7')+_0x34246a,_0x1337f2);FaxQueueEvents['on'](_0x34246a,_0x497442);}}; \ No newline at end of file +var _0x42ce=['register','length','faxQueue:','./faxQueue.events','remove','update','removeListener'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x42ce,0x1e6));var _0xe42c=function(_0x36625f,_0x727bd6){_0x36625f=_0x36625f-0x0;var _0x135981=_0x42ce[_0x36625f];return _0x135981;};'use strict';var FaxQueueEvents=require(_0xe42c('0x0'));var events=['save',_0xe42c('0x1'),_0xe42c('0x2')];function createListener(_0x2707b6,_0x5a83a7){return function(_0x30c159){_0x5a83a7['emit'](_0x2707b6,_0x30c159);};}function removeListener(_0x4c041d,_0x3794f4){return function(){FaxQueueEvents[_0xe42c('0x3')](_0x4c041d,_0x3794f4);};}exports[_0xe42c('0x4')]=function(_0x348c70){for(var _0x251a2e=0x0,_0x45cbda=events[_0xe42c('0x5')];_0x251a2e<_0x45cbda;_0x251a2e++){var _0x2bf495=events[_0x251a2e];var _0x1e70c4=createListener(_0xe42c('0x6')+_0x2bf495,_0x348c70);FaxQueueEvents['on'](_0x2bf495,_0x1e70c4);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index e11095e..89c070b 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(_0x4fc9e6,_0xc51915){var _0x551d28=function(_0x1a603b){while(--_0x1a603b){_0x4fc9e6['push'](_0x4fc9e6['shift']());}};_0x551d28(++_0xc51915);}(_0xb10b,0x12a));var _0xbb10=function(_0x4e1d3c,_0x4f9988){_0x4e1d3c=_0x4e1d3c-0x0;var _0x5177b2=_0xb10b[_0x4e1d3c];return _0x5177b2;};'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 _0xbaf0=['create','addAgents','put','delete','destroy','removeTeams','removeAgents','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post'];(function(_0x5d0c1e,_0x132dd6){var _0x3ad7b0=function(_0x18703e){while(--_0x18703e){_0x5d0c1e['push'](_0x5d0c1e['shift']());}};_0x3ad7b0(++_0x132dd6);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xbaf0[_0x2f5ac5];return _0x37c9a8;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var 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['getAgents']);router[_0x0baf('0x14')]('/',auth[_0x0baf('0x9')](),controller[_0x0baf('0x15')]);router[_0x0baf('0x14')]('/:id/teams',auth[_0x0baf('0x9')](),controller['addTeams']);router[_0x0baf('0x14')](_0x0baf('0x13'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x16')]);router[_0x0baf('0x17')](_0x0baf('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x0baf('0x18')](_0x0baf('0xd'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x19')]);router[_0x0baf('0x18')](_0x0baf('0x11'),auth['isAuthenticated'](),controller[_0x0baf('0x1a')]);router[_0x0baf('0x18')](_0x0baf('0x13'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x1b')]);module[_0x0baf('0x1c')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 7b150bd..aee5882 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 _0x2f0f=['STRING','DATE'];(function(_0x5d5aa1,_0x3e4aaf){var _0x39f9d5=function(_0xc3bfb4){while(--_0xc3bfb4){_0x5d5aa1['push'](_0x5d5aa1['shift']());}};_0x39f9d5(++_0x3e4aaf);}(_0x2f0f,0x182));var _0xf2f0=function(_0x290c78,_0x406c3d){_0x290c78=_0x290c78-0x0;var _0x5d5bf5=_0x2f0f[_0x290c78];return _0x5d5bf5;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0xf2f0('0x0')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xf2f0('0x1')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xf2f0('0x1')]},'reason':{'type':Sequelize[_0xf2f0('0x0')]}}; \ No newline at end of file +var _0xb4aa=['STRING','DATE','exports'];(function(_0x56b1ea,_0xa0e4e5){var _0x2f6808=function(_0x2bb60d){while(--_0x2bb60d){_0x56b1ea['push'](_0x56b1ea['shift']());}};_0x2f6808(++_0xa0e4e5);}(_0xb4aa,0x13d));var _0xab4a=function(_0xf7ee8d,_0x3ceb30){_0xf7ee8d=_0xf7ee8d-0x0;var _0x231bc7=_0xb4aa[_0xf7ee8d];return _0x231bc7;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0xab4a('0x0')]={'uniqueid':{'type':Sequelize[_0xab4a('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0xab4a('0x1')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xab4a('0x2')]},'acceptAt':{'type':Sequelize[_0xab4a('0x2')]},'exitAt':{'type':Sequelize[_0xab4a('0x2')]},'reason':{'type':Sequelize[_0xab4a('0x1')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 3839207..1c4355f 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 _0x56b2=['stack','name','send','index','FaxQueueReport','rawAttributes','fieldName','type','key','model','query','keys','fields','attributes','length','nolimit','order','sort','where','filters','pick','VIRTUAL','filter','merge','options','includeAll','include','rows','catch','show','params','intersection','find','create','body','update','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','Content-Range','apply','save','then','sendStatus','error'];(function(_0x5fc355,_0x5c1953){var _0x129e43=function(_0x357969){while(--_0x357969){_0x5fc355['push'](_0x5fc355['shift']());}};_0x129e43(++_0x5c1953);}(_0x56b2,0x142));var _0x256b=function(_0x5d5727,_0x4297e0){_0x5d5727=_0x5d5727-0x0;var _0x593cd3=_0x56b2[_0x5d5727];return _0x593cd3;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x256b('0x0'));var rimraf=require(_0x256b('0x1'));var zipdir=require(_0x256b('0x2'));var jsonpatch=require(_0x256b('0x3'));var rp=require(_0x256b('0x4'));var moment=require('moment');var BPromise=require(_0x256b('0x5'));var Mustache=require('mustache');var util=require(_0x256b('0x6'));var path=require(_0x256b('0x7'));var sox=require(_0x256b('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x256b('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x256b('0xa'));var querystring=require(_0x256b('0xb'));var Papa=require(_0x256b('0xc'));var Redis=require(_0x256b('0xd'));var authService=require(_0x256b('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x256b('0xf'));var hardwareService=require(_0x256b('0x10'));var logger=require(_0x256b('0x11'))(_0x256b('0x12'));var utils=require('../../config/utils');var config=require(_0x256b('0x13'));var db=require(_0x256b('0x14'))['db'];function respondWithStatusCode(_0x5934b9,_0x3cd5ff){_0x3cd5ff=_0x3cd5ff||0xcc;return function(_0x2cbcdc){if(_0x2cbcdc){return _0x5934b9['sendStatus'](_0x3cd5ff);}return _0x5934b9[_0x256b('0x15')](_0x3cd5ff)[_0x256b('0x16')]();};}function respondWithResult(_0x46cc5a,_0x48f179){_0x48f179=_0x48f179||0xc8;return function(_0x4e9bdd){if(_0x4e9bdd){return _0x46cc5a[_0x256b('0x15')](_0x48f179)[_0x256b('0x17')](_0x4e9bdd);}};}function respondWithFilteredResult(_0x3f2668,_0x25ce87){return function(_0x338e4e){if(_0x338e4e){var _0x35e33e=_0x338e4e[_0x256b('0x18')],_0x484b1c=_0x25ce87[_0x256b('0x19')],_0x81fb6e=_0x25ce87[_0x256b('0x19')]+_0x25ce87[_0x256b('0x1a')],_0x569216;if(_0x81fb6e>=_0x35e33e){_0x81fb6e=_0x35e33e;_0x569216=0xc8;}else{_0x569216=0xce;}_0x3f2668[_0x256b('0x15')](_0x569216);return _0x3f2668['set'](_0x256b('0x1b'),_0x484b1c+'-'+_0x81fb6e+'/'+_0x35e33e)[_0x256b('0x17')](_0x338e4e);}return null;};}function patchUpdates(_0x4a9531){return function(_0x4b3a7f){try{jsonpatch[_0x256b('0x1c')](_0x4b3a7f,_0x4a9531,!![]);}catch(_0x4e72b3){return BPromise['reject'](_0x4e72b3);}return _0x4b3a7f[_0x256b('0x1d')]();};}function saveUpdates(_0x308b78,_0x1c295d){return function(_0x547e36){if(_0x547e36){return _0x547e36['update'](_0x308b78)[_0x256b('0x1e')](function(_0x513cc4){return _0x513cc4;});}return null;};}function removeEntity(_0x4b5b4b,_0x244178){return function(_0x139888){if(_0x139888){return _0x139888['destroy']()[_0x256b('0x1e')](function(){_0x4b5b4b[_0x256b('0x15')](0xcc)[_0x256b('0x16')]();});}};}function handleEntityNotFound(_0x528a95,_0x531f4c){return function(_0x442ccf){if(!_0x442ccf){_0x528a95[_0x256b('0x1f')](0x194);}return _0x442ccf;};}function handleError(_0x185be0,_0x5d44e9){_0x5d44e9=_0x5d44e9||0x1f4;return function(_0x4c0608){logger[_0x256b('0x20')](_0x4c0608[_0x256b('0x21')]);if(_0x4c0608[_0x256b('0x22')]){delete _0x4c0608[_0x256b('0x22')];}_0x185be0[_0x256b('0x15')](_0x5d44e9)[_0x256b('0x23')](_0x4c0608);};}exports[_0x256b('0x24')]=function(_0x390ff3,_0x415342){var _0x19503e={},_0x419083={},_0xeb6ff0={'count':0x0,'rows':[]};var _0x2bb0e0=_['map'](db[_0x256b('0x25')][_0x256b('0x26')],function(_0x317d0c){return{'name':_0x317d0c[_0x256b('0x27')],'type':_0x317d0c[_0x256b('0x28')][_0x256b('0x29')]};});_0x419083[_0x256b('0x2a')]=_['map'](_0x2bb0e0,_0x256b('0x22'));_0x419083[_0x256b('0x2b')]=_[_0x256b('0x2c')](_0x390ff3[_0x256b('0x2b')]);_0x419083['filters']=_['intersection'](_0x419083[_0x256b('0x2a')],_0x419083[_0x256b('0x2b')]);_0x19503e['attributes']=_['intersection'](_0x419083[_0x256b('0x2a')],qs[_0x256b('0x2d')](_0x390ff3[_0x256b('0x2b')][_0x256b('0x2d')]));_0x19503e[_0x256b('0x2e')]=_0x19503e[_0x256b('0x2e')][_0x256b('0x2f')]?_0x19503e['attributes']:_0x419083[_0x256b('0x2a')];if(!_0x390ff3[_0x256b('0x2b')]['hasOwnProperty'](_0x256b('0x30'))){_0x19503e[_0x256b('0x1a')]=qs[_0x256b('0x1a')](_0x390ff3[_0x256b('0x2b')]['limit']);_0x19503e['offset']=qs[_0x256b('0x19')](_0x390ff3[_0x256b('0x2b')][_0x256b('0x19')]);}_0x19503e[_0x256b('0x31')]=qs[_0x256b('0x32')](_0x390ff3[_0x256b('0x2b')][_0x256b('0x32')]);_0x19503e[_0x256b('0x33')]=qs[_0x256b('0x34')](_[_0x256b('0x35')](_0x390ff3[_0x256b('0x2b')],_0x419083[_0x256b('0x34')]),_0x2bb0e0);if(_0x390ff3[_0x256b('0x2b')]['filter']){_0x19503e['where']=_['merge'](_0x19503e[_0x256b('0x33')],{'$or':_['map'](_0x2bb0e0,function(_0x22470b){if(_0x22470b[_0x256b('0x28')]!==_0x256b('0x36')){var _0x3ac22b={};_0x3ac22b[_0x22470b[_0x256b('0x22')]]={'$like':'%'+_0x390ff3[_0x256b('0x2b')][_0x256b('0x37')]+'%'};return _0x3ac22b;}})});}_0x19503e=_[_0x256b('0x38')]({},_0x19503e,_0x390ff3[_0x256b('0x39')]);var _0xf5a666={'where':_0x19503e[_0x256b('0x33')]};return db[_0x256b('0x25')][_0x256b('0x18')](_0xf5a666)[_0x256b('0x1e')](function(_0x44b50b){_0xeb6ff0['count']=_0x44b50b;if(_0x390ff3[_0x256b('0x2b')][_0x256b('0x3a')]){_0x19503e[_0x256b('0x3b')]=[{'all':!![]}];}return db[_0x256b('0x25')]['findAll'](_0x19503e);})[_0x256b('0x1e')](function(_0x10cc9b){_0xeb6ff0[_0x256b('0x3c')]=_0x10cc9b;return _0xeb6ff0;})[_0x256b('0x1e')](respondWithFilteredResult(_0x415342,_0x19503e))[_0x256b('0x3d')](handleError(_0x415342,null));};exports[_0x256b('0x3e')]=function(_0x46a52a,_0x4b7ae1){var _0x2f29cb={'raw':!![],'where':{'id':_0x46a52a[_0x256b('0x3f')]['id']}},_0x5b4bbf={};_0x5b4bbf[_0x256b('0x2a')]=_[_0x256b('0x2c')](db[_0x256b('0x25')][_0x256b('0x26')]);_0x5b4bbf[_0x256b('0x2b')]=_['keys'](_0x46a52a['query']);_0x5b4bbf['filters']=_['intersection'](_0x5b4bbf[_0x256b('0x2a')],_0x5b4bbf[_0x256b('0x2b')]);_0x2f29cb[_0x256b('0x2e')]=_[_0x256b('0x40')](_0x5b4bbf[_0x256b('0x2a')],qs[_0x256b('0x2d')](_0x46a52a[_0x256b('0x2b')][_0x256b('0x2d')]));_0x2f29cb[_0x256b('0x2e')]=_0x2f29cb[_0x256b('0x2e')]['length']?_0x2f29cb[_0x256b('0x2e')]:_0x5b4bbf[_0x256b('0x2a')];if(_0x46a52a[_0x256b('0x2b')][_0x256b('0x3a')]){_0x2f29cb['include']=[{'all':!![]}];}_0x2f29cb=_[_0x256b('0x38')]({},_0x2f29cb,_0x46a52a[_0x256b('0x39')]);return db[_0x256b('0x25')][_0x256b('0x41')](_0x2f29cb)[_0x256b('0x1e')](handleEntityNotFound(_0x4b7ae1,null))[_0x256b('0x1e')](respondWithResult(_0x4b7ae1,null))['catch'](handleError(_0x4b7ae1,null));};exports['create']=function(_0x331b82,_0x49b6da){return db[_0x256b('0x25')][_0x256b('0x42')](_0x331b82[_0x256b('0x43')],{})['then'](respondWithResult(_0x49b6da,0xc9))['catch'](handleError(_0x49b6da,null));};exports[_0x256b('0x44')]=function(_0x5465bc,_0x1c5c2b){if(_0x5465bc[_0x256b('0x43')]['id']){delete _0x5465bc[_0x256b('0x43')]['id'];}return db[_0x256b('0x25')]['find']({'where':{'id':_0x5465bc[_0x256b('0x3f')]['id']}})[_0x256b('0x1e')](handleEntityNotFound(_0x1c5c2b,null))[_0x256b('0x1e')](saveUpdates(_0x5465bc['body'],null))[_0x256b('0x1e')](respondWithResult(_0x1c5c2b,null))[_0x256b('0x3d')](handleError(_0x1c5c2b,null));};exports[_0x256b('0x45')]=function(_0x185a95,_0x57e9c7){return db[_0x256b('0x25')][_0x256b('0x41')]({'where':{'id':_0x185a95[_0x256b('0x3f')]['id']}})[_0x256b('0x1e')](handleEntityNotFound(_0x57e9c7,null))[_0x256b('0x1e')](removeEntity(_0x57e9c7,null))['catch'](handleError(_0x57e9c7,null));};exports[_0x256b('0x46')]=function(_0x27a4f2,_0x4816e5){return db[_0x256b('0x25')]['describe']()[_0x256b('0x1e')](respondWithResult(_0x4816e5,null))[_0x256b('0x3d')](handleError(_0x4816e5,null));}; \ No newline at end of file +var _0x7d1b=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','Content-Range','apply','reject','update','then','destroy','error','stack','name','index','map','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','limit','offset','order','sort','where','filters','filter','VIRTUAL','merge','FaxQueueReport','includeAll','include','findAll','rows','catch','show','rawAttributes','options','find','create','body','html-pdf','rimraf','zip-dir','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','ioredis'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7d1b,0x185));var _0xb7d1=function(_0x81c11d,_0x407378){_0x81c11d=_0x81c11d-0x0;var _0x501fa5=_0x7d1b[_0x81c11d];return _0x501fa5;};'use strict';var pdf=require(_0xb7d1('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xb7d1('0x1'));var zipdir=require(_0xb7d1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xb7d1('0x3'));var BPromise=require(_0xb7d1('0x4'));var Mustache=require(_0xb7d1('0x5'));var util=require('util');var path=require(_0xb7d1('0x6'));var sox=require(_0xb7d1('0x7'));var csv=require(_0xb7d1('0x8'));var ejs=require(_0xb7d1('0x9'));var fs=require('fs');var _=require(_0xb7d1('0xa'));var squel=require('squel');var crypto=require(_0xb7d1('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb7d1('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb7d1('0xc'));var authService=require(_0xb7d1('0xd'));var qs=require(_0xb7d1('0xe'));var as=require(_0xb7d1('0xf'));var hardwareService=require(_0xb7d1('0x10'));var logger=require('../../config/logger')(_0xb7d1('0x11'));var utils=require(_0xb7d1('0x12'));var config=require(_0xb7d1('0x13'));var db=require(_0xb7d1('0x14'))['db'];function respondWithStatusCode(_0x3a6465,_0x3e6d74){_0x3e6d74=_0x3e6d74||0xcc;return function(_0x3c3eee){if(_0x3c3eee){return _0x3a6465[_0xb7d1('0x15')](_0x3e6d74);}return _0x3a6465[_0xb7d1('0x16')](_0x3e6d74)['end']();};}function respondWithResult(_0x5a8662,_0x25c82b){_0x25c82b=_0x25c82b||0xc8;return function(_0x3c9b77){if(_0x3c9b77){return _0x5a8662[_0xb7d1('0x16')](_0x25c82b)[_0xb7d1('0x17')](_0x3c9b77);}};}function respondWithFilteredResult(_0x390715,_0x22a2b3){return function(_0x4dc54c){if(_0x4dc54c){var _0x20b337=_0x4dc54c[_0xb7d1('0x18')],_0x25b770=_0x22a2b3['offset'],_0x30858a=_0x22a2b3['offset']+_0x22a2b3['limit'],_0x3d4e30;if(_0x30858a>=_0x20b337){_0x30858a=_0x20b337;_0x3d4e30=0xc8;}else{_0x3d4e30=0xce;}_0x390715[_0xb7d1('0x16')](_0x3d4e30);return _0x390715['set'](_0xb7d1('0x19'),_0x25b770+'-'+_0x30858a+'/'+_0x20b337)[_0xb7d1('0x17')](_0x4dc54c);}return null;};}function patchUpdates(_0x26298c){return function(_0x4261ec){try{jsonpatch[_0xb7d1('0x1a')](_0x4261ec,_0x26298c,!![]);}catch(_0x144a04){return BPromise[_0xb7d1('0x1b')](_0x144a04);}return _0x4261ec['save']();};}function saveUpdates(_0x39cce7,_0xe7df73){return function(_0x13ac53){if(_0x13ac53){return _0x13ac53[_0xb7d1('0x1c')](_0x39cce7)[_0xb7d1('0x1d')](function(_0x20241f){return _0x20241f;});}return null;};}function removeEntity(_0x5d8cf2,_0x51b01b){return function(_0x15114f){if(_0x15114f){return _0x15114f[_0xb7d1('0x1e')]()['then'](function(){_0x5d8cf2[_0xb7d1('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e025a,_0x17dee9){return function(_0x400915){if(!_0x400915){_0x5e025a[_0xb7d1('0x15')](0x194);}return _0x400915;};}function handleError(_0x45f42b,_0x3946f6){_0x3946f6=_0x3946f6||0x1f4;return function(_0x102492){logger[_0xb7d1('0x1f')](_0x102492[_0xb7d1('0x20')]);if(_0x102492['name']){delete _0x102492[_0xb7d1('0x21')];}_0x45f42b[_0xb7d1('0x16')](_0x3946f6)['send'](_0x102492);};}exports[_0xb7d1('0x22')]=function(_0x488d6d,_0x3dc6e3){var _0x321cce={},_0x43710f={},_0x1103a4={'count':0x0,'rows':[]};var _0x53be9e=_[_0xb7d1('0x23')](db['FaxQueueReport']['rawAttributes'],function(_0x15d9c4){return{'name':_0x15d9c4['fieldName'],'type':_0x15d9c4[_0xb7d1('0x24')][_0xb7d1('0x25')]};});_0x43710f[_0xb7d1('0x26')]=_[_0xb7d1('0x23')](_0x53be9e,'name');_0x43710f[_0xb7d1('0x27')]=_[_0xb7d1('0x28')](_0x488d6d[_0xb7d1('0x27')]);_0x43710f['filters']=_[_0xb7d1('0x29')](_0x43710f['model'],_0x43710f[_0xb7d1('0x27')]);_0x321cce[_0xb7d1('0x2a')]=_[_0xb7d1('0x29')](_0x43710f[_0xb7d1('0x26')],qs[_0xb7d1('0x2b')](_0x488d6d['query'][_0xb7d1('0x2b')]));_0x321cce[_0xb7d1('0x2a')]=_0x321cce[_0xb7d1('0x2a')][_0xb7d1('0x2c')]?_0x321cce['attributes']:_0x43710f[_0xb7d1('0x26')];if(!_0x488d6d[_0xb7d1('0x27')][_0xb7d1('0x2d')]('nolimit')){_0x321cce[_0xb7d1('0x2e')]=qs['limit'](_0x488d6d[_0xb7d1('0x27')][_0xb7d1('0x2e')]);_0x321cce[_0xb7d1('0x2f')]=qs[_0xb7d1('0x2f')](_0x488d6d[_0xb7d1('0x27')][_0xb7d1('0x2f')]);}_0x321cce[_0xb7d1('0x30')]=qs[_0xb7d1('0x31')](_0x488d6d[_0xb7d1('0x27')][_0xb7d1('0x31')]);_0x321cce[_0xb7d1('0x32')]=qs[_0xb7d1('0x33')](_['pick'](_0x488d6d['query'],_0x43710f['filters']),_0x53be9e);if(_0x488d6d[_0xb7d1('0x27')][_0xb7d1('0x34')]){_0x321cce['where']=_['merge'](_0x321cce[_0xb7d1('0x32')],{'$or':_['map'](_0x53be9e,function(_0x4a9a7d){if(_0x4a9a7d['type']!==_0xb7d1('0x35')){var _0x4192bb={};_0x4192bb[_0x4a9a7d[_0xb7d1('0x21')]]={'$like':'%'+_0x488d6d[_0xb7d1('0x27')][_0xb7d1('0x34')]+'%'};return _0x4192bb;}})});}_0x321cce=_[_0xb7d1('0x36')]({},_0x321cce,_0x488d6d['options']);var _0x5c06e4={'where':_0x321cce['where']};return db[_0xb7d1('0x37')]['count'](_0x5c06e4)[_0xb7d1('0x1d')](function(_0x14dec1){_0x1103a4[_0xb7d1('0x18')]=_0x14dec1;if(_0x488d6d[_0xb7d1('0x27')][_0xb7d1('0x38')]){_0x321cce[_0xb7d1('0x39')]=[{'all':!![]}];}return db[_0xb7d1('0x37')][_0xb7d1('0x3a')](_0x321cce);})[_0xb7d1('0x1d')](function(_0x588d8d){_0x1103a4[_0xb7d1('0x3b')]=_0x588d8d;return _0x1103a4;})[_0xb7d1('0x1d')](respondWithFilteredResult(_0x3dc6e3,_0x321cce))[_0xb7d1('0x3c')](handleError(_0x3dc6e3,null));};exports[_0xb7d1('0x3d')]=function(_0x5b63dd,_0x33f544){var _0x2df087={'raw':!![],'where':{'id':_0x5b63dd['params']['id']}},_0x3057fb={};_0x3057fb['model']=_[_0xb7d1('0x28')](db[_0xb7d1('0x37')][_0xb7d1('0x3e')]);_0x3057fb[_0xb7d1('0x27')]=_[_0xb7d1('0x28')](_0x5b63dd['query']);_0x3057fb[_0xb7d1('0x33')]=_[_0xb7d1('0x29')](_0x3057fb[_0xb7d1('0x26')],_0x3057fb[_0xb7d1('0x27')]);_0x2df087[_0xb7d1('0x2a')]=_['intersection'](_0x3057fb[_0xb7d1('0x26')],qs['fields'](_0x5b63dd[_0xb7d1('0x27')]['fields']));_0x2df087['attributes']=_0x2df087[_0xb7d1('0x2a')][_0xb7d1('0x2c')]?_0x2df087[_0xb7d1('0x2a')]:_0x3057fb['model'];if(_0x5b63dd[_0xb7d1('0x27')][_0xb7d1('0x38')]){_0x2df087[_0xb7d1('0x39')]=[{'all':!![]}];}_0x2df087=_['merge']({},_0x2df087,_0x5b63dd[_0xb7d1('0x3f')]);return db['FaxQueueReport'][_0xb7d1('0x40')](_0x2df087)['then'](handleEntityNotFound(_0x33f544,null))[_0xb7d1('0x1d')](respondWithResult(_0x33f544,null))[_0xb7d1('0x3c')](handleError(_0x33f544,null));};exports[_0xb7d1('0x41')]=function(_0x2dd1bc,_0x3979e0){return db[_0xb7d1('0x37')]['create'](_0x2dd1bc[_0xb7d1('0x42')],{})[_0xb7d1('0x1d')](respondWithResult(_0x3979e0,0xc9))[_0xb7d1('0x3c')](handleError(_0x3979e0,null));};exports[_0xb7d1('0x1c')]=function(_0x4fad88,_0x13c7f2){if(_0x4fad88['body']['id']){delete _0x4fad88['body']['id'];}return db['FaxQueueReport'][_0xb7d1('0x40')]({'where':{'id':_0x4fad88['params']['id']}})['then'](handleEntityNotFound(_0x13c7f2,null))[_0xb7d1('0x1d')](saveUpdates(_0x4fad88[_0xb7d1('0x42')],null))[_0xb7d1('0x1d')](respondWithResult(_0x13c7f2,null))[_0xb7d1('0x3c')](handleError(_0x13c7f2,null));};exports['destroy']=function(_0xa4ef1a,_0x1e3094){return db[_0xb7d1('0x37')][_0xb7d1('0x40')]({'where':{'id':_0xa4ef1a['params']['id']}})[_0xb7d1('0x1d')](handleEntityNotFound(_0x1e3094,null))[_0xb7d1('0x1d')](removeEntity(_0x1e3094,null))[_0xb7d1('0x3c')](handleError(_0x1e3094,null));};exports['describe']=function(_0x3577e5,_0x53ffc3){return db['FaxQueueReport']['describe']()[_0xb7d1('0x1d')](respondWithResult(_0x53ffc3,null))[_0xb7d1('0x3c')](handleError(_0x53ffc3,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 2381e3d..a4e845a 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 _0x52ee=['uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./faxQueueReport.attributes','exports','FaxQueueReport','report_fax_queue'];(function(_0x21f7b2,_0xe13c0){var _0x12ca03=function(_0x4c5c58){while(--_0x4c5c58){_0x21f7b2['push'](_0x21f7b2['shift']());}};_0x12ca03(++_0xe13c0);}(_0x52ee,0x1cf));var _0xe52e=function(_0x42e9c2,_0xf71604){_0x42e9c2=_0x42e9c2-0x0;var _0x1e7c80=_0x52ee[_0x42e9c2];return _0x1e7c80;};'use strict';var _=require(_0xe52e('0x0'));var util=require(_0xe52e('0x1'));var logger=require(_0xe52e('0x2'))(_0xe52e('0x3'));var moment=require(_0xe52e('0x4'));var BPromise=require(_0xe52e('0x5'));var rp=require(_0xe52e('0x6'));var fs=require('fs');var path=require(_0xe52e('0x7'));var rimraf=require('rimraf');var config=require(_0xe52e('0x8'));var attributes=require(_0xe52e('0x9'));module[_0xe52e('0xa')]=function(_0x43e8f4,_0x18e2a8){return _0x43e8f4['define'](_0xe52e('0xb'),attributes,{'tableName':_0xe52e('0xc'),'paranoid':![],'indexes':[{'name':_0xe52e('0xd'),'fields':[_0xe52e('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x480b=['util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','report_fax_queue','uniqueid','lodash'];(function(_0x2f7d77,_0x43797b){var _0x578606=function(_0x3bf930){while(--_0x3bf930){_0x2f7d77['push'](_0x2f7d77['shift']());}};_0x578606(++_0x43797b);}(_0x480b,0xa7));var _0xb480=function(_0x37168c,_0x155070){_0x37168c=_0x37168c-0x0;var _0x216aa4=_0x480b[_0x37168c];return _0x216aa4;};'use strict';var _=require(_0xb480('0x0'));var util=require(_0xb480('0x1'));var logger=require(_0xb480('0x2'))(_0xb480('0x3'));var moment=require('moment');var BPromise=require(_0xb480('0x4'));var rp=require(_0xb480('0x5'));var fs=require('fs');var path=require(_0xb480('0x6'));var rimraf=require('rimraf');var config=require(_0xb480('0x7'));var attributes=require(_0xb480('0x8'));module[_0xb480('0x9')]=function(_0x392091,_0x59d959){return _0x392091[_0xb480('0xa')](_0xb480('0xb'),attributes,{'tableName':_0xb480('0xc'),'paranoid':![],'indexes':[{'name':_0xb480('0xd'),'fields':[_0xb480('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index e48289a..fd83d31 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 _0x3c04=['CreateFaxQueueReport','FaxQueueReport','body','options','then','debug','UpdateFaxQueueReport','update','raw','limit','stringify','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','FaxQueueReport,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x219cc1,_0x3d03b5){var _0x177034=function(_0x45e0fe){while(--_0x45e0fe){_0x219cc1['push'](_0x219cc1['shift']());}};_0x177034(++_0x3d03b5);}(_0x3c04,0xc0));var _0x43c0=function(_0x22e567,_0x4435cb){_0x22e567=_0x22e567-0x0;var _0x12e30e=_0x3c04[_0x22e567];return _0x12e30e;};'use strict';var _=require(_0x43c0('0x0'));var util=require(_0x43c0('0x1'));var moment=require('moment');var BPromise=require(_0x43c0('0x2'));var rs=require(_0x43c0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x43c0('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x43c0('0x5'))(_0x43c0('0x6'));var config=require(_0x43c0('0x7'));var jayson=require(_0x43c0('0x8'));var client=jayson[_0x43c0('0x9')][_0x43c0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x114deb,_0x2a811c,_0x20bc86){return new BPromise(function(_0x1d4565,_0x2c2750){return client['request'](_0x114deb,_0x20bc86)['then'](function(_0x3c1ad0){logger[_0x43c0('0xb')](_0x43c0('0xc'),_0x2a811c,_0x43c0('0xd'));logger['debug'](_0x43c0('0xe'),_0x2a811c,'request\x20sent',JSON['stringify'](_0x3c1ad0));if(_0x3c1ad0[_0x43c0('0xf')]){if(_0x3c1ad0[_0x43c0('0xf')][_0x43c0('0x10')]===0x1f4){logger['error']('FaxQueueReport,\x20%s,\x20%s',_0x2a811c,_0x3c1ad0[_0x43c0('0xf')][_0x43c0('0x11')]);return _0x2c2750(_0x3c1ad0['error']['message']);}logger[_0x43c0('0xf')]('FaxQueueReport,\x20%s,\x20%s',_0x2a811c,_0x3c1ad0[_0x43c0('0xf')][_0x43c0('0x11')]);return _0x1d4565(_0x3c1ad0[_0x43c0('0xf')][_0x43c0('0x11')]);}else{logger[_0x43c0('0xb')]('FaxQueueReport,\x20%s,\x20%s',_0x2a811c,_0x43c0('0xd'));_0x1d4565(_0x3c1ad0['result'][_0x43c0('0x11')]);}})['catch'](function(_0x27c3cc){logger[_0x43c0('0xf')](_0x43c0('0xc'),_0x2a811c,_0x27c3cc);_0x2c2750(_0x27c3cc);});});}exports[_0x43c0('0x12')]=function(_0x1dabe5){var _0x3c5b05=this;return new Promise(function(_0x2a2422,_0x1e876e){return db[_0x43c0('0x13')]['create'](_0x1dabe5[_0x43c0('0x14')],{'raw':_0x1dabe5[_0x43c0('0x15')]?_0x1dabe5[_0x43c0('0x15')]['raw']===undefined?!![]:![]:!![]})[_0x43c0('0x16')](function(_0x1054d1){logger['info'](_0x43c0('0x12'),_0x1dabe5);logger[_0x43c0('0x17')](_0x43c0('0x12'),_0x1dabe5,JSON['stringify'](_0x1054d1));_0x2a2422(_0x1054d1);})['catch'](function(_0x4aa903){logger[_0x43c0('0xf')](_0x43c0('0x12'),_0x4aa903[_0x43c0('0x11')],_0x1dabe5);_0x1e876e(_0x3c5b05['error'](0x1f4,_0x4aa903[_0x43c0('0x11')]));});});};exports[_0x43c0('0x18')]=function(_0x4f8aa7){var _0x2f4781=this;return new Promise(function(_0x6f1e88,_0x2379ce){return db[_0x43c0('0x13')][_0x43c0('0x19')](_0x4f8aa7[_0x43c0('0x14')],{'raw':_0x4f8aa7[_0x43c0('0x15')]?_0x4f8aa7[_0x43c0('0x15')][_0x43c0('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4f8aa7[_0x43c0('0x15')]?_0x4f8aa7['options']['where']||null:null,'attributes':_0x4f8aa7['options']?_0x4f8aa7[_0x43c0('0x15')]['attributes']||null:null,'limit':_0x4f8aa7[_0x43c0('0x15')]?_0x4f8aa7[_0x43c0('0x15')][_0x43c0('0x1b')]||null:null})[_0x43c0('0x16')](function(_0x5cd81b){logger[_0x43c0('0xb')](_0x43c0('0x18'),_0x4f8aa7);logger[_0x43c0('0x17')](_0x43c0('0x18'),_0x4f8aa7,JSON[_0x43c0('0x1c')](_0x5cd81b));_0x6f1e88(_0x5cd81b);})[_0x43c0('0x1d')](function(_0x220532){logger['error'](_0x43c0('0x18'),_0x220532[_0x43c0('0x11')],_0x4f8aa7);_0x2379ce(_0x2f4781[_0x43c0('0xf')](0x1f4,_0x220532[_0x43c0('0x11')]));});});}; \ No newline at end of file +var _0x1b22=['UpdateFaxQueueReport','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateFaxQueueReport','FaxQueueReport','body','options','raw','update','where','attributes'];(function(_0xcb19e1,_0x465489){var _0x121872=function(_0x5c9cd1){while(--_0x5c9cd1){_0xcb19e1['push'](_0xcb19e1['shift']());}};_0x121872(++_0x465489);}(_0x1b22,0xc7));var _0x21b2=function(_0x367c8e,_0x3a6502){_0x367c8e=_0x367c8e-0x0;var _0x1c2789=_0x1b22[_0x367c8e];return _0x1c2789;};'use strict';var _=require(_0x21b2('0x0'));var util=require(_0x21b2('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x21b2('0x2'));var fs=require('fs');var Redis=require(_0x21b2('0x3'));var db=require(_0x21b2('0x4'))['db'];var utils=require(_0x21b2('0x5'));var logger=require(_0x21b2('0x6'))(_0x21b2('0x7'));var config=require(_0x21b2('0x8'));var jayson=require(_0x21b2('0x9'));var client=jayson[_0x21b2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4b380f,_0xb1eefd,_0x1667ca){return new BPromise(function(_0x2ff8f8,_0x37c3a1){return client[_0x21b2('0xb')](_0x4b380f,_0x1667ca)[_0x21b2('0xc')](function(_0x11af27){logger['info'](_0x21b2('0xd'),_0xb1eefd,_0x21b2('0xe'));logger[_0x21b2('0xf')](_0x21b2('0x10'),_0xb1eefd,_0x21b2('0xe'),JSON[_0x21b2('0x11')](_0x11af27));if(_0x11af27[_0x21b2('0x12')]){if(_0x11af27[_0x21b2('0x12')][_0x21b2('0x13')]===0x1f4){logger['error'](_0x21b2('0xd'),_0xb1eefd,_0x11af27[_0x21b2('0x12')][_0x21b2('0x14')]);return _0x37c3a1(_0x11af27['error'][_0x21b2('0x14')]);}logger[_0x21b2('0x12')](_0x21b2('0xd'),_0xb1eefd,_0x11af27[_0x21b2('0x12')][_0x21b2('0x14')]);return _0x2ff8f8(_0x11af27[_0x21b2('0x12')][_0x21b2('0x14')]);}else{logger[_0x21b2('0x15')](_0x21b2('0xd'),_0xb1eefd,_0x21b2('0xe'));_0x2ff8f8(_0x11af27[_0x21b2('0x16')][_0x21b2('0x14')]);}})[_0x21b2('0x17')](function(_0x2a72ba){logger['error'](_0x21b2('0xd'),_0xb1eefd,_0x2a72ba);_0x37c3a1(_0x2a72ba);});});}exports[_0x21b2('0x18')]=function(_0x538d75){var _0x2018ed=this;return new Promise(function(_0x4b7ece,_0x1984da){return db[_0x21b2('0x19')]['create'](_0x538d75[_0x21b2('0x1a')],{'raw':_0x538d75['options']?_0x538d75[_0x21b2('0x1b')][_0x21b2('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x5caae4){logger[_0x21b2('0x15')](_0x21b2('0x18'),_0x538d75);logger[_0x21b2('0xf')](_0x21b2('0x18'),_0x538d75,JSON['stringify'](_0x5caae4));_0x4b7ece(_0x5caae4);})['catch'](function(_0x5deff1){logger['error']('CreateFaxQueueReport',_0x5deff1['message'],_0x538d75);_0x1984da(_0x2018ed[_0x21b2('0x12')](0x1f4,_0x5deff1[_0x21b2('0x14')]));});});};exports['UpdateFaxQueueReport']=function(_0x80b68){var _0x4185c4=this;return new Promise(function(_0x292133,_0x2a5bee){return db['FaxQueueReport'][_0x21b2('0x1d')](_0x80b68['body'],{'raw':_0x80b68[_0x21b2('0x1b')]?_0x80b68[_0x21b2('0x1b')][_0x21b2('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x80b68['options']?_0x80b68[_0x21b2('0x1b')][_0x21b2('0x1e')]||null:null,'attributes':_0x80b68['options']?_0x80b68['options'][_0x21b2('0x1f')]||null:null,'limit':_0x80b68[_0x21b2('0x1b')]?_0x80b68[_0x21b2('0x1b')]['limit']||null:null})[_0x21b2('0xc')](function(_0x1e01ff){logger[_0x21b2('0x15')](_0x21b2('0x20'),_0x80b68);logger['debug'](_0x21b2('0x20'),_0x80b68,JSON[_0x21b2('0x11')](_0x1e01ff));_0x292133(_0x1e01ff);})[_0x21b2('0x17')](function(_0x58a807){logger[_0x21b2('0x12')]('UpdateFaxQueueReport',_0x58a807[_0x21b2('0x14')],_0x80b68);_0x2a5bee(_0x4185c4[_0x21b2('0x12')](0x1f4,_0x58a807[_0x21b2('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 6d90884..eddeafa 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 _0xcf90=['express','Router','../../components/auth/service','../../config/environment','./faxQueueReport.controller','get','index','isAuthenticated','/:id','post','create','put','delete','destroy','exports','multer','path'];(function(_0x521b61,_0x47e2b4){var _0x476cdf=function(_0xbca2ca){while(--_0xbca2ca){_0x521b61['push'](_0x521b61['shift']());}};_0x476cdf(++_0x47e2b4);}(_0xcf90,0x10e));var _0x0cf9=function(_0xdf20cb,_0x35f605){_0xdf20cb=_0xdf20cb-0x0;var _0x4522bc=_0xcf90[_0xdf20cb];return _0x4522bc;};'use strict';var multer=require(_0x0cf9('0x0'));var util=require('util');var path=require(_0x0cf9('0x1'));var timeout=require('connect-timeout');var express=require(_0x0cf9('0x2'));var router=express[_0x0cf9('0x3')]();var auth=require(_0x0cf9('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x0cf9('0x5'));var controller=require(_0x0cf9('0x6'));router[_0x0cf9('0x7')]('/',auth['isAuthenticated'](),controller[_0x0cf9('0x8')]);router['get']('/describe',auth[_0x0cf9('0x9')](),controller['describe']);router[_0x0cf9('0x7')](_0x0cf9('0xa'),auth[_0x0cf9('0x9')](),controller['show']);router[_0x0cf9('0xb')]('/',auth[_0x0cf9('0x9')](),controller[_0x0cf9('0xc')]);router[_0x0cf9('0xd')]('/:id',auth[_0x0cf9('0x9')](),controller['update']);router[_0x0cf9('0xe')](_0x0cf9('0xa'),auth['isAuthenticated'](),controller[_0x0cf9('0xf')]);module[_0x0cf9('0x10')]=router; \ No newline at end of file +var _0x3b6a=['multer','connect-timeout','express','../../components/auth/service','get','describe','/:id','isAuthenticated','show','post','update','delete','destroy','exports'];(function(_0x1e3310,_0x6de577){var _0x33e002=function(_0x93f22a){while(--_0x93f22a){_0x1e3310['push'](_0x1e3310['shift']());}};_0x33e002(++_0x6de577);}(_0x3b6a,0x8c));var _0xa3b6=function(_0x36a974,_0x381b74){_0x36a974=_0x36a974-0x0;var _0x2d0781=_0x3b6a[_0x36a974];return _0x2d0781;};'use strict';var multer=require(_0xa3b6('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xa3b6('0x1'));var express=require(_0xa3b6('0x2'));var router=express['Router']();var auth=require(_0xa3b6('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./faxQueueReport.controller');router[_0xa3b6('0x4')]('/',auth['isAuthenticated'](),controller['index']);router[_0xa3b6('0x4')]('/describe',auth['isAuthenticated'](),controller[_0xa3b6('0x5')]);router['get'](_0xa3b6('0x6'),auth[_0xa3b6('0x7')](),controller[_0xa3b6('0x8')]);router[_0xa3b6('0x9')]('/',auth[_0xa3b6('0x7')](),controller['create']);router['put'](_0xa3b6('0x6'),auth[_0xa3b6('0x7')](),controller[_0xa3b6('0xa')]);router[_0xa3b6('0xb')](_0xa3b6('0x6'),auth[_0xa3b6('0x7')](),controller[_0xa3b6('0xc')]);module[_0xa3b6('0xd')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 570acd3..ce23236 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 _0x0373=['DATE','NOW','sequelize','exports','STRING','account','agent','queue'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x0373,0x1a2));var _0x3037=function(_0x333734,_0x412291){_0x333734=_0x333734-0x0;var _0x4e91e7=_0x0373[_0x333734];return _0x4e91e7;};'use strict';var moment=require('moment');var Sequelize=require(_0x3037('0x0'));module[_0x3037('0x1')]={'uniqueid':{'type':Sequelize[_0x3037('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x3037('0x3'),_0x3037('0x4'),_0x3037('0x5')),'allowNull':![],'defaultValue':_0x3037('0x5')},'transferredAt':{'type':Sequelize[_0x3037('0x6')],'allowNull':![],'defaultValue':Sequelize[_0x3037('0x7')]}}; \ No newline at end of file +var _0xfb8a=['NOW','moment','sequelize','STRING','account','agent','DATE'];(function(_0x474bc0,_0x26989c){var _0x4b24cf=function(_0x4be866){while(--_0x4be866){_0x474bc0['push'](_0x474bc0['shift']());}};_0x4b24cf(++_0x26989c);}(_0xfb8a,0xe1));var _0xafb8=function(_0x4a8cbb,_0x40177c){_0x4a8cbb=_0x4a8cbb-0x0;var _0x36b5b1=_0xfb8a[_0x4a8cbb];return _0x36b5b1;};'use strict';var moment=require(_0xafb8('0x0'));var Sequelize=require(_0xafb8('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xafb8('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xafb8('0x3'),_0xafb8('0x4'),'queue'),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xafb8('0x5')],'allowNull':![],'defaultValue':Sequelize[_0xafb8('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 07ef389..b4819c4 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 _0xadb5=['map','fieldName','type','key','model','query','keys','filters','intersection','attributes','nolimit','order','sort','where','VIRTUAL','merge','options','FaxTransferReport','findAll','rows','catch','show','rawAttributes','fields','includeAll','include','find','create','body','update','describe','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','../../mysqldb','sendStatus','status','end','count','offset','limit','set','json','reject','save','then','destroy','stack','name','send','index'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xadb5,0xad));var _0x5adb=function(_0x12cac5,_0xb8b836){_0x12cac5=_0x12cac5-0x0;var _0x3273b9=_0xadb5[_0x12cac5];return _0x3273b9;};'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 db=require(_0x5adb('0x17'))['db'];function respondWithStatusCode(_0x56012f,_0x2a0b70){_0x2a0b70=_0x2a0b70||0xcc;return function(_0x5433bf){if(_0x5433bf){return _0x56012f[_0x5adb('0x18')](_0x2a0b70);}return _0x56012f[_0x5adb('0x19')](_0x2a0b70)[_0x5adb('0x1a')]();};}function respondWithResult(_0x5c929a,_0x2a545b){_0x2a545b=_0x2a545b||0xc8;return function(_0x34af2c){if(_0x34af2c){return _0x5c929a[_0x5adb('0x19')](_0x2a545b)['json'](_0x34af2c);}};}function respondWithFilteredResult(_0x2312de,_0x518823){return function(_0x367d82){if(_0x367d82){var _0x42a482=_0x367d82[_0x5adb('0x1b')],_0x30614e=_0x518823[_0x5adb('0x1c')],_0x304784=_0x518823[_0x5adb('0x1c')]+_0x518823[_0x5adb('0x1d')],_0x1c0f97;if(_0x304784>=_0x42a482){_0x304784=_0x42a482;_0x1c0f97=0xc8;}else{_0x1c0f97=0xce;}_0x2312de['status'](_0x1c0f97);return _0x2312de[_0x5adb('0x1e')]('Content-Range',_0x30614e+'-'+_0x304784+'/'+_0x42a482)[_0x5adb('0x1f')](_0x367d82);}return null;};}function patchUpdates(_0x558f76){return function(_0x3ef465){try{jsonpatch['apply'](_0x3ef465,_0x558f76,!![]);}catch(_0x5e218c){return BPromise[_0x5adb('0x20')](_0x5e218c);}return _0x3ef465[_0x5adb('0x21')]();};}function saveUpdates(_0x438671,_0x1fd4a7){return function(_0x99bc6c){if(_0x99bc6c){return _0x99bc6c['update'](_0x438671)[_0x5adb('0x22')](function(_0x5c296e){return _0x5c296e;});}return null;};}function removeEntity(_0x4e9f16,_0x3754cc){return function(_0x379b33){if(_0x379b33){return _0x379b33[_0x5adb('0x23')]()[_0x5adb('0x22')](function(){_0x4e9f16[_0x5adb('0x19')](0xcc)[_0x5adb('0x1a')]();});}};}function handleEntityNotFound(_0xfd9bb9,_0x4ca150){return function(_0x4b1957){if(!_0x4b1957){_0xfd9bb9[_0x5adb('0x18')](0x194);}return _0x4b1957;};}function handleError(_0x3220cd,_0x3839fb){_0x3839fb=_0x3839fb||0x1f4;return function(_0xeb556c){logger['error'](_0xeb556c[_0x5adb('0x24')]);if(_0xeb556c[_0x5adb('0x25')]){delete _0xeb556c['name'];}_0x3220cd[_0x5adb('0x19')](_0x3839fb)[_0x5adb('0x26')](_0xeb556c);};}exports[_0x5adb('0x27')]=function(_0x55b40a,_0x13ad1d){var _0xbe21b1={},_0x3a4fca={},_0x2c64a3={'count':0x0,'rows':[]};var _0x36459b=_[_0x5adb('0x28')](db['FaxTransferReport']['rawAttributes'],function(_0x5d457e){return{'name':_0x5d457e[_0x5adb('0x29')],'type':_0x5d457e[_0x5adb('0x2a')][_0x5adb('0x2b')]};});_0x3a4fca[_0x5adb('0x2c')]=_[_0x5adb('0x28')](_0x36459b,'name');_0x3a4fca[_0x5adb('0x2d')]=_[_0x5adb('0x2e')](_0x55b40a[_0x5adb('0x2d')]);_0x3a4fca[_0x5adb('0x2f')]=_[_0x5adb('0x30')](_0x3a4fca[_0x5adb('0x2c')],_0x3a4fca[_0x5adb('0x2d')]);_0xbe21b1[_0x5adb('0x31')]=_[_0x5adb('0x30')](_0x3a4fca[_0x5adb('0x2c')],qs['fields'](_0x55b40a[_0x5adb('0x2d')]['fields']));_0xbe21b1[_0x5adb('0x31')]=_0xbe21b1[_0x5adb('0x31')]['length']?_0xbe21b1[_0x5adb('0x31')]:_0x3a4fca[_0x5adb('0x2c')];if(!_0x55b40a[_0x5adb('0x2d')]['hasOwnProperty'](_0x5adb('0x32'))){_0xbe21b1[_0x5adb('0x1d')]=qs['limit'](_0x55b40a['query'][_0x5adb('0x1d')]);_0xbe21b1['offset']=qs[_0x5adb('0x1c')](_0x55b40a[_0x5adb('0x2d')][_0x5adb('0x1c')]);}_0xbe21b1[_0x5adb('0x33')]=qs[_0x5adb('0x34')](_0x55b40a['query'][_0x5adb('0x34')]);_0xbe21b1[_0x5adb('0x35')]=qs[_0x5adb('0x2f')](_['pick'](_0x55b40a['query'],_0x3a4fca[_0x5adb('0x2f')]),_0x36459b);if(_0x55b40a[_0x5adb('0x2d')]['filter']){_0xbe21b1[_0x5adb('0x35')]=_['merge'](_0xbe21b1[_0x5adb('0x35')],{'$or':_['map'](_0x36459b,function(_0x11cb37){if(_0x11cb37['type']!==_0x5adb('0x36')){var _0x23a1db={};_0x23a1db[_0x11cb37['name']]={'$like':'%'+_0x55b40a[_0x5adb('0x2d')]['filter']+'%'};return _0x23a1db;}})});}_0xbe21b1=_[_0x5adb('0x37')]({},_0xbe21b1,_0x55b40a[_0x5adb('0x38')]);var _0xd5660c={'where':_0xbe21b1['where']};return db[_0x5adb('0x39')][_0x5adb('0x1b')](_0xd5660c)[_0x5adb('0x22')](function(_0x132803){_0x2c64a3[_0x5adb('0x1b')]=_0x132803;if(_0x55b40a['query']['includeAll']){_0xbe21b1['include']=[{'all':!![]}];}return db['FaxTransferReport'][_0x5adb('0x3a')](_0xbe21b1);})[_0x5adb('0x22')](function(_0x3a104a){_0x2c64a3[_0x5adb('0x3b')]=_0x3a104a;return _0x2c64a3;})[_0x5adb('0x22')](respondWithFilteredResult(_0x13ad1d,_0xbe21b1))[_0x5adb('0x3c')](handleError(_0x13ad1d,null));};exports[_0x5adb('0x3d')]=function(_0x3bf282,_0x478a70){var _0x53f2c6={'raw':!![],'where':{'id':_0x3bf282['params']['id']}},_0x27dbb7={};_0x27dbb7[_0x5adb('0x2c')]=_[_0x5adb('0x2e')](db[_0x5adb('0x39')][_0x5adb('0x3e')]);_0x27dbb7[_0x5adb('0x2d')]=_['keys'](_0x3bf282[_0x5adb('0x2d')]);_0x27dbb7[_0x5adb('0x2f')]=_['intersection'](_0x27dbb7[_0x5adb('0x2c')],_0x27dbb7[_0x5adb('0x2d')]);_0x53f2c6['attributes']=_[_0x5adb('0x30')](_0x27dbb7[_0x5adb('0x2c')],qs[_0x5adb('0x3f')](_0x3bf282[_0x5adb('0x2d')][_0x5adb('0x3f')]));_0x53f2c6[_0x5adb('0x31')]=_0x53f2c6[_0x5adb('0x31')]['length']?_0x53f2c6['attributes']:_0x27dbb7[_0x5adb('0x2c')];if(_0x3bf282[_0x5adb('0x2d')][_0x5adb('0x40')]){_0x53f2c6[_0x5adb('0x41')]=[{'all':!![]}];}_0x53f2c6=_['merge']({},_0x53f2c6,_0x3bf282['options']);return db[_0x5adb('0x39')][_0x5adb('0x42')](_0x53f2c6)[_0x5adb('0x22')](handleEntityNotFound(_0x478a70,null))[_0x5adb('0x22')](respondWithResult(_0x478a70,null))[_0x5adb('0x3c')](handleError(_0x478a70,null));};exports['create']=function(_0x182cbc,_0x437f52){return db['FaxTransferReport'][_0x5adb('0x43')](_0x182cbc[_0x5adb('0x44')],{})[_0x5adb('0x22')](respondWithResult(_0x437f52,0xc9))[_0x5adb('0x3c')](handleError(_0x437f52,null));};exports[_0x5adb('0x45')]=function(_0x3a5409,_0x39840e){if(_0x3a5409[_0x5adb('0x44')]['id']){delete _0x3a5409['body']['id'];}return db[_0x5adb('0x39')]['find']({'where':{'id':_0x3a5409['params']['id']}})['then'](handleEntityNotFound(_0x39840e,null))[_0x5adb('0x22')](saveUpdates(_0x3a5409[_0x5adb('0x44')],null))[_0x5adb('0x22')](respondWithResult(_0x39840e,null))['catch'](handleError(_0x39840e,null));};exports[_0x5adb('0x23')]=function(_0x5cbab5,_0x177a81){return db[_0x5adb('0x39')][_0x5adb('0x42')]({'where':{'id':_0x5cbab5['params']['id']}})[_0x5adb('0x22')](handleEntityNotFound(_0x177a81,null))['then'](removeEntity(_0x177a81,null))[_0x5adb('0x3c')](handleError(_0x177a81,null));};exports[_0x5adb('0x46')]=function(_0x55c535,_0x2402a3){return db[_0x5adb('0x39')][_0x5adb('0x46')]()[_0x5adb('0x22')](respondWithResult(_0x2402a3,null))[_0x5adb('0x3c')](handleError(_0x2402a3,null));}; \ No newline at end of file +var _0x0b0e=['index','map','FaxTransferReport','fieldName','type','key','model','keys','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','VIRTUAL','merge','count','includeAll','rows','show','params','rawAttributes','include','find','catch','create','body','describe','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','json','offset','set','reject','update','then','destroy','end','error','name'];(function(_0x374f98,_0x1399d2){var _0x7cdb71=function(_0x385da7){while(--_0x385da7){_0x374f98['push'](_0x374f98['shift']());}};_0x7cdb71(++_0x1399d2);}(_0x0b0e,0x187));var _0xe0b0=function(_0x4cb231,_0x3d3c5b){_0x4cb231=_0x4cb231-0x0;var _0x4d5063=_0x0b0e[_0x4cb231];return _0x4d5063;};'use strict';var pdf=require(_0xe0b0('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xe0b0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe0b0('0x2'));var rp=require(_0xe0b0('0x3'));var moment=require(_0xe0b0('0x4'));var BPromise=require(_0xe0b0('0x5'));var Mustache=require(_0xe0b0('0x6'));var util=require(_0xe0b0('0x7'));var path=require(_0xe0b0('0x8'));var sox=require(_0xe0b0('0x9'));var csv=require(_0xe0b0('0xa'));var ejs=require(_0xe0b0('0xb'));var fs=require('fs');var _=require(_0xe0b0('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe0b0('0xd'));var deskjs=require(_0xe0b0('0xe'));var toCsv=require(_0xe0b0('0xa'));var querystring=require(_0xe0b0('0xf'));var Papa=require('papaparse');var Redis=require(_0xe0b0('0x10'));var authService=require(_0xe0b0('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xe0b0('0x12'));var hardwareService=require(_0xe0b0('0x13'));var logger=require('../../config/logger')(_0xe0b0('0x14'));var utils=require(_0xe0b0('0x15'));var config=require(_0xe0b0('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3068c0,_0x1c358a){_0x1c358a=_0x1c358a||0xcc;return function(_0x3cc19a){if(_0x3cc19a){return _0x3068c0[_0xe0b0('0x17')](_0x1c358a);}return _0x3068c0[_0xe0b0('0x18')](_0x1c358a)['end']();};}function respondWithResult(_0x3782be,_0x154de6){_0x154de6=_0x154de6||0xc8;return function(_0x743318){if(_0x743318){return _0x3782be[_0xe0b0('0x18')](_0x154de6)[_0xe0b0('0x19')](_0x743318);}};}function respondWithFilteredResult(_0x55d884,_0x41a7e2){return function(_0x5adb01){if(_0x5adb01){var _0x35cb40=_0x5adb01['count'],_0xadee6e=_0x41a7e2[_0xe0b0('0x1a')],_0x519ae8=_0x41a7e2[_0xe0b0('0x1a')]+_0x41a7e2['limit'],_0x11fdca;if(_0x519ae8>=_0x35cb40){_0x519ae8=_0x35cb40;_0x11fdca=0xc8;}else{_0x11fdca=0xce;}_0x55d884['status'](_0x11fdca);return _0x55d884[_0xe0b0('0x1b')]('Content-Range',_0xadee6e+'-'+_0x519ae8+'/'+_0x35cb40)['json'](_0x5adb01);}return null;};}function patchUpdates(_0x4bce65){return function(_0x1920ee){try{jsonpatch['apply'](_0x1920ee,_0x4bce65,!![]);}catch(_0x52598b){return BPromise[_0xe0b0('0x1c')](_0x52598b);}return _0x1920ee['save']();};}function saveUpdates(_0x472286,_0x5dba2f){return function(_0x2c84cc){if(_0x2c84cc){return _0x2c84cc[_0xe0b0('0x1d')](_0x472286)[_0xe0b0('0x1e')](function(_0x310a6d){return _0x310a6d;});}return null;};}function removeEntity(_0x2cf6a1,_0x58b804){return function(_0x4cae54){if(_0x4cae54){return _0x4cae54[_0xe0b0('0x1f')]()['then'](function(){_0x2cf6a1[_0xe0b0('0x18')](0xcc)[_0xe0b0('0x20')]();});}};}function handleEntityNotFound(_0x513e63,_0x170ad8){return function(_0x503883){if(!_0x503883){_0x513e63[_0xe0b0('0x17')](0x194);}return _0x503883;};}function handleError(_0x49a727,_0x28586d){_0x28586d=_0x28586d||0x1f4;return function(_0x576352){logger[_0xe0b0('0x21')](_0x576352['stack']);if(_0x576352[_0xe0b0('0x22')]){delete _0x576352['name'];}_0x49a727[_0xe0b0('0x18')](_0x28586d)['send'](_0x576352);};}exports[_0xe0b0('0x23')]=function(_0x3c3bc2,_0x1f1ebd){var _0x1d91ad={},_0x3ec2={},_0x10745d={'count':0x0,'rows':[]};var _0x5200a6=_[_0xe0b0('0x24')](db[_0xe0b0('0x25')]['rawAttributes'],function(_0x15e13b){return{'name':_0x15e13b[_0xe0b0('0x26')],'type':_0x15e13b[_0xe0b0('0x27')][_0xe0b0('0x28')]};});_0x3ec2[_0xe0b0('0x29')]=_[_0xe0b0('0x24')](_0x5200a6,_0xe0b0('0x22'));_0x3ec2['query']=_[_0xe0b0('0x2a')](_0x3c3bc2[_0xe0b0('0x2b')]);_0x3ec2['filters']=_['intersection'](_0x3ec2[_0xe0b0('0x29')],_0x3ec2[_0xe0b0('0x2b')]);_0x1d91ad[_0xe0b0('0x2c')]=_[_0xe0b0('0x2d')](_0x3ec2[_0xe0b0('0x29')],qs['fields'](_0x3c3bc2[_0xe0b0('0x2b')][_0xe0b0('0x2e')]));_0x1d91ad[_0xe0b0('0x2c')]=_0x1d91ad[_0xe0b0('0x2c')][_0xe0b0('0x2f')]?_0x1d91ad['attributes']:_0x3ec2[_0xe0b0('0x29')];if(!_0x3c3bc2[_0xe0b0('0x2b')][_0xe0b0('0x30')](_0xe0b0('0x31'))){_0x1d91ad[_0xe0b0('0x32')]=qs[_0xe0b0('0x32')](_0x3c3bc2[_0xe0b0('0x2b')][_0xe0b0('0x32')]);_0x1d91ad[_0xe0b0('0x1a')]=qs[_0xe0b0('0x1a')](_0x3c3bc2[_0xe0b0('0x2b')][_0xe0b0('0x1a')]);}_0x1d91ad[_0xe0b0('0x33')]=qs[_0xe0b0('0x34')](_0x3c3bc2[_0xe0b0('0x2b')]['sort']);_0x1d91ad[_0xe0b0('0x35')]=qs[_0xe0b0('0x36')](_[_0xe0b0('0x37')](_0x3c3bc2[_0xe0b0('0x2b')],_0x3ec2[_0xe0b0('0x36')]),_0x5200a6);if(_0x3c3bc2[_0xe0b0('0x2b')][_0xe0b0('0x38')]){_0x1d91ad['where']=_['merge'](_0x1d91ad['where'],{'$or':_['map'](_0x5200a6,function(_0x26137c){if(_0x26137c[_0xe0b0('0x27')]!==_0xe0b0('0x39')){var _0x4e4b20={};_0x4e4b20[_0x26137c[_0xe0b0('0x22')]]={'$like':'%'+_0x3c3bc2[_0xe0b0('0x2b')][_0xe0b0('0x38')]+'%'};return _0x4e4b20;}})});}_0x1d91ad=_[_0xe0b0('0x3a')]({},_0x1d91ad,_0x3c3bc2['options']);var _0xed3226={'where':_0x1d91ad[_0xe0b0('0x35')]};return db[_0xe0b0('0x25')][_0xe0b0('0x3b')](_0xed3226)[_0xe0b0('0x1e')](function(_0x1205db){_0x10745d[_0xe0b0('0x3b')]=_0x1205db;if(_0x3c3bc2[_0xe0b0('0x2b')][_0xe0b0('0x3c')]){_0x1d91ad['include']=[{'all':!![]}];}return db[_0xe0b0('0x25')]['findAll'](_0x1d91ad);})[_0xe0b0('0x1e')](function(_0x2d5f47){_0x10745d[_0xe0b0('0x3d')]=_0x2d5f47;return _0x10745d;})[_0xe0b0('0x1e')](respondWithFilteredResult(_0x1f1ebd,_0x1d91ad))['catch'](handleError(_0x1f1ebd,null));};exports[_0xe0b0('0x3e')]=function(_0x41adcb,_0x33706d){var _0x402a0e={'raw':!![],'where':{'id':_0x41adcb[_0xe0b0('0x3f')]['id']}},_0x19c80e={};_0x19c80e[_0xe0b0('0x29')]=_[_0xe0b0('0x2a')](db['FaxTransferReport'][_0xe0b0('0x40')]);_0x19c80e[_0xe0b0('0x2b')]=_['keys'](_0x41adcb['query']);_0x19c80e[_0xe0b0('0x36')]=_[_0xe0b0('0x2d')](_0x19c80e['model'],_0x19c80e[_0xe0b0('0x2b')]);_0x402a0e[_0xe0b0('0x2c')]=_[_0xe0b0('0x2d')](_0x19c80e[_0xe0b0('0x29')],qs[_0xe0b0('0x2e')](_0x41adcb['query']['fields']));_0x402a0e['attributes']=_0x402a0e[_0xe0b0('0x2c')][_0xe0b0('0x2f')]?_0x402a0e['attributes']:_0x19c80e[_0xe0b0('0x29')];if(_0x41adcb[_0xe0b0('0x2b')][_0xe0b0('0x3c')]){_0x402a0e[_0xe0b0('0x41')]=[{'all':!![]}];}_0x402a0e=_[_0xe0b0('0x3a')]({},_0x402a0e,_0x41adcb['options']);return db['FaxTransferReport'][_0xe0b0('0x42')](_0x402a0e)[_0xe0b0('0x1e')](handleEntityNotFound(_0x33706d,null))[_0xe0b0('0x1e')](respondWithResult(_0x33706d,null))[_0xe0b0('0x43')](handleError(_0x33706d,null));};exports[_0xe0b0('0x44')]=function(_0x575c7d,_0x3b1474){return db[_0xe0b0('0x25')]['create'](_0x575c7d['body'],{})['then'](respondWithResult(_0x3b1474,0xc9))[_0xe0b0('0x43')](handleError(_0x3b1474,null));};exports[_0xe0b0('0x1d')]=function(_0x2419ce,_0x364877){if(_0x2419ce['body']['id']){delete _0x2419ce[_0xe0b0('0x45')]['id'];}return db[_0xe0b0('0x25')]['find']({'where':{'id':_0x2419ce['params']['id']}})[_0xe0b0('0x1e')](handleEntityNotFound(_0x364877,null))[_0xe0b0('0x1e')](saveUpdates(_0x2419ce['body'],null))[_0xe0b0('0x1e')](respondWithResult(_0x364877,null))[_0xe0b0('0x43')](handleError(_0x364877,null));};exports['destroy']=function(_0x5cb2b6,_0x123ad2){return db['FaxTransferReport'][_0xe0b0('0x42')]({'where':{'id':_0x5cb2b6[_0xe0b0('0x3f')]['id']}})[_0xe0b0('0x1e')](handleEntityNotFound(_0x123ad2,null))[_0xe0b0('0x1e')](removeEntity(_0x123ad2,null))[_0xe0b0('0x43')](handleError(_0x123ad2,null));};exports[_0xe0b0('0x46')]=function(_0x5f5486,_0x5d018d){return db[_0xe0b0('0x25')]['describe']()['then'](respondWithResult(_0x5d018d,null))[_0xe0b0('0x43')](handleError(_0x5d018d,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index ac3dcee..faac2eb 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 _0x991b=['path','rimraf','./faxTransferReport.attributes','exports','define','FaxTransferReport','uniqueid','api','moment','request-promise'];(function(_0x38d207,_0x29970f){var _0x3f38ab=function(_0x268cc5){while(--_0x268cc5){_0x38d207['push'](_0x38d207['shift']());}};_0x3f38ab(++_0x29970f);}(_0x991b,0x6b));var _0xb991=function(_0x11b62d,_0x4af8eb){_0x11b62d=_0x11b62d-0x0;var _0x3ed6ee=_0x991b[_0x11b62d];return _0x3ed6ee;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xb991('0x0'));var moment=require(_0xb991('0x1'));var BPromise=require('bluebird');var rp=require(_0xb991('0x2'));var fs=require('fs');var path=require(_0xb991('0x3'));var rimraf=require(_0xb991('0x4'));var config=require('../../config/environment');var attributes=require(_0xb991('0x5'));module[_0xb991('0x6')]=function(_0x16214e,_0x199a63){return _0x16214e[_0xb991('0x7')](_0xb991('0x8'),attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':_0xb991('0x9'),'fields':[_0xb991('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x294d=['./faxTransferReport.attributes','exports','define','report_fax_transfer','uniqueid','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment'];(function(_0x3eb713,_0x437874){var _0x1d7128=function(_0x2b9cea){while(--_0x2b9cea){_0x3eb713['push'](_0x3eb713['shift']());}};_0x1d7128(++_0x437874);}(_0x294d,0x198));var _0xd294=function(_0x377a6e,_0x59b99d){_0x377a6e=_0x377a6e-0x0;var _0x37f751=_0x294d[_0x377a6e];return _0x37f751;};'use strict';var _=require(_0xd294('0x0'));var util=require(_0xd294('0x1'));var logger=require(_0xd294('0x2'))(_0xd294('0x3'));var moment=require(_0xd294('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xd294('0x5'));var rimraf=require(_0xd294('0x6'));var config=require(_0xd294('0x7'));var attributes=require(_0xd294('0x8'));module[_0xd294('0x9')]=function(_0x530422,_0xadd344){return _0x530422[_0xd294('0xa')]('FaxTransferReport',attributes,{'tableName':_0xd294('0xb'),'paranoid':![],'indexes':[{'name':_0xd294('0xc'),'fields':[_0xd294('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 6503f3c..b0bef1d 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 _0x35a6=['info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x1bd498,_0x14b925){var _0xb4473e=function(_0x367808){while(--_0x367808){_0x1bd498['push'](_0x1bd498['shift']());}};_0xb4473e(++_0x14b925);}(_0x35a6,0x136));var _0x635a=function(_0x13ea36,_0x2805ad){_0x13ea36=_0x13ea36-0x0;var _0x312066=_0x35a6[_0x13ea36];return _0x312066;};'use strict';var _=require(_0x635a('0x0'));var util=require(_0x635a('0x1'));var moment=require('moment');var BPromise=require(_0x635a('0x2'));var rs=require(_0x635a('0x3'));var fs=require('fs');var Redis=require(_0x635a('0x4'));var db=require(_0x635a('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x635a('0x6'));var jayson=require(_0x635a('0x7'));var client=jayson[_0x635a('0x8')][_0x635a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x39f3ca,_0x309919,_0x435ae0){return new BPromise(function(_0x5c3925,_0x90d99b){return client[_0x635a('0xa')](_0x39f3ca,_0x435ae0)[_0x635a('0xb')](function(_0x221a50){logger[_0x635a('0xc')](_0x635a('0xd'),_0x309919,_0x635a('0xe'));logger[_0x635a('0xf')](_0x635a('0x10'),_0x309919,'request\x20sent',JSON[_0x635a('0x11')](_0x221a50));if(_0x221a50[_0x635a('0x12')]){if(_0x221a50[_0x635a('0x12')][_0x635a('0x13')]===0x1f4){logger[_0x635a('0x12')](_0x635a('0xd'),_0x309919,_0x221a50[_0x635a('0x12')][_0x635a('0x14')]);return _0x90d99b(_0x221a50[_0x635a('0x12')][_0x635a('0x14')]);}logger[_0x635a('0x12')](_0x635a('0xd'),_0x309919,_0x221a50[_0x635a('0x12')][_0x635a('0x14')]);return _0x5c3925(_0x221a50['error']['message']);}else{logger['info'](_0x635a('0xd'),_0x309919,_0x635a('0xe'));_0x5c3925(_0x221a50[_0x635a('0x15')][_0x635a('0x14')]);}})[_0x635a('0x16')](function(_0x4b05d1){logger[_0x635a('0x12')](_0x635a('0xd'),_0x309919,_0x4b05d1);_0x90d99b(_0x4b05d1);});});} \ No newline at end of file +var _0x9526=['catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x9526,0x188));var _0x6952=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0x9526[_0x29b609];return _0x54c952;};'use strict';var _=require(_0x6952('0x0'));var util=require('util');var moment=require(_0x6952('0x1'));var BPromise=require(_0x6952('0x2'));var rs=require(_0x6952('0x3'));var fs=require('fs');var Redis=require(_0x6952('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6952('0x5'));var logger=require('../../config/logger')(_0x6952('0x6'));var config=require(_0x6952('0x7'));var jayson=require(_0x6952('0x8'));var client=jayson[_0x6952('0x9')][_0x6952('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x594a4a,_0x4f4df0,_0xc674e7){return new BPromise(function(_0x1348cc,_0x44c81d){return client[_0x6952('0xb')](_0x594a4a,_0xc674e7)[_0x6952('0xc')](function(_0x5d81bb){logger[_0x6952('0xd')](_0x6952('0xe'),_0x4f4df0,_0x6952('0xf'));logger['debug'](_0x6952('0x10'),_0x4f4df0,_0x6952('0xf'),JSON[_0x6952('0x11')](_0x5d81bb));if(_0x5d81bb[_0x6952('0x12')]){if(_0x5d81bb['error'][_0x6952('0x13')]===0x1f4){logger['error'](_0x6952('0xe'),_0x4f4df0,_0x5d81bb[_0x6952('0x12')][_0x6952('0x14')]);return _0x44c81d(_0x5d81bb['error'][_0x6952('0x14')]);}logger['error'](_0x6952('0xe'),_0x4f4df0,_0x5d81bb[_0x6952('0x12')]['message']);return _0x1348cc(_0x5d81bb[_0x6952('0x12')][_0x6952('0x14')]);}else{logger['info']('FaxTransferReport,\x20%s,\x20%s',_0x4f4df0,_0x6952('0xf'));_0x1348cc(_0x5d81bb[_0x6952('0x15')][_0x6952('0x14')]);}})[_0x6952('0x16')](function(_0x395d4b){logger[_0x6952('0x12')]('FaxTransferReport,\x20%s,\x20%s',_0x4f4df0,_0x395d4b);_0x44c81d(_0x395d4b);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index f923907..c704fad 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 _0x1186=['delete','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','/describe','isAuthenticated','describe','show','post','create','put','/:id','update'];(function(_0x540fad,_0x5874e5){var _0x8508a2=function(_0x541a07){while(--_0x541a07){_0x540fad['push'](_0x540fad['shift']());}};_0x8508a2(++_0x5874e5);}(_0x1186,0x167));var _0x6118=function(_0x57826f,_0x271bf1){_0x57826f=_0x57826f-0x0;var _0x18f80f=_0x1186[_0x57826f];return _0x18f80f;};'use strict';var multer=require(_0x6118('0x0'));var util=require(_0x6118('0x1'));var path=require(_0x6118('0x2'));var timeout=require(_0x6118('0x3'));var express=require('express');var router=express[_0x6118('0x4')]();var auth=require(_0x6118('0x5'));var interaction=require(_0x6118('0x6'));var config=require(_0x6118('0x7'));var controller=require(_0x6118('0x8'));router[_0x6118('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x6118('0x9')](_0x6118('0xa'),auth[_0x6118('0xb')](),controller[_0x6118('0xc')]);router[_0x6118('0x9')]('/:id',auth[_0x6118('0xb')](),controller[_0x6118('0xd')]);router[_0x6118('0xe')]('/',auth['isAuthenticated'](),controller[_0x6118('0xf')]);router[_0x6118('0x10')](_0x6118('0x11'),auth[_0x6118('0xb')](),controller[_0x6118('0x12')]);router[_0x6118('0x13')](_0x6118('0x11'),auth[_0x6118('0xb')](),controller[_0x6118('0x14')]);module['exports']=router; \ No newline at end of file +var _0xcce0=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','put','update','delete','exports','multer','util','path'];(function(_0x2bc326,_0x473cf8){var _0x43722e=function(_0x4dd559){while(--_0x4dd559){_0x2bc326['push'](_0x2bc326['shift']());}};_0x43722e(++_0x473cf8);}(_0xcce0,0x128));var _0x0cce=function(_0x48f99,_0x38afd0){_0x48f99=_0x48f99-0x0;var _0x194c2c=_0xcce0[_0x48f99];return _0x194c2c;};'use strict';var multer=require(_0x0cce('0x0'));var util=require(_0x0cce('0x1'));var path=require(_0x0cce('0x2'));var timeout=require(_0x0cce('0x3'));var express=require(_0x0cce('0x4'));var router=express[_0x0cce('0x5')]();var auth=require(_0x0cce('0x6'));var interaction=require(_0x0cce('0x7'));var config=require(_0x0cce('0x8'));var controller=require(_0x0cce('0x9'));router[_0x0cce('0xa')]('/',auth['isAuthenticated'](),controller[_0x0cce('0xb')]);router['get'](_0x0cce('0xc'),auth[_0x0cce('0xd')](),controller[_0x0cce('0xe')]);router['get'](_0x0cce('0xf'),auth[_0x0cce('0xd')](),controller[_0x0cce('0x10')]);router[_0x0cce('0x11')]('/',auth[_0x0cce('0xd')](),controller[_0x0cce('0x12')]);router[_0x0cce('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x0cce('0x14')]);router[_0x0cce('0x15')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x0cce('0x16')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 336306d..c5dab78 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 _0x6334=['getConfigurations','/:id/fields','getFields','post','create','put','/:id','destroy','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','get','isAuthenticated','index','/:id/configurations'];(function(_0x4e1d03,_0x786f3a){var _0x362d4b=function(_0x1924d2){while(--_0x1924d2){_0x4e1d03['push'](_0x4e1d03['shift']());}};_0x362d4b(++_0x786f3a);}(_0x6334,0x119));var _0x4633=function(_0x1bd2a6,_0x45f0fc){_0x1bd2a6=_0x1bd2a6-0x0;var _0x525206=_0x6334[_0x1bd2a6];return _0x525206;};'use strict';var multer=require(_0x4633('0x0'));var util=require(_0x4633('0x1'));var path=require(_0x4633('0x2'));var timeout=require(_0x4633('0x3'));var express=require(_0x4633('0x4'));var router=express[_0x4633('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x4633('0x6'));var config=require(_0x4633('0x7'));var controller=require(_0x4633('0x8'));router[_0x4633('0x9')]('/',auth[_0x4633('0xa')](),controller[_0x4633('0xb')]);router[_0x4633('0x9')]('/:id',auth[_0x4633('0xa')](),controller['show']);router[_0x4633('0x9')](_0x4633('0xc'),auth['isAuthenticated'](),controller[_0x4633('0xd')]);router[_0x4633('0x9')](_0x4633('0xe'),auth['isAuthenticated'](),controller[_0x4633('0xf')]);router[_0x4633('0x10')]('/',auth['isAuthenticated'](),controller[_0x4633('0x11')]);router[_0x4633('0x10')](_0x4633('0xc'),auth[_0x4633('0xa')](),controller['addConfiguration']);router[_0x4633('0x12')](_0x4633('0x13'),auth[_0x4633('0xa')](),controller['update']);router['delete']('/:id',auth[_0x4633('0xa')](),controller[_0x4633('0x14')]);module['exports']=router; \ No newline at end of file +var _0xb647=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intDeskAccount.controller','isAuthenticated','index','get','/:id','show','/:id/configurations','create','addConfiguration','put','update','exports','multer'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0xb647,0xdb));var _0x7b64=function(_0x44632c,_0xb85d47){_0x44632c=_0x44632c-0x0;var _0x5a3833=_0xb647[_0x44632c];return _0x5a3833;};'use strict';var multer=require(_0x7b64('0x0'));var util=require(_0x7b64('0x1'));var path=require(_0x7b64('0x2'));var timeout=require(_0x7b64('0x3'));var express=require(_0x7b64('0x4'));var router=express[_0x7b64('0x5')]();var auth=require(_0x7b64('0x6'));var interaction=require(_0x7b64('0x7'));var config=require('../../config/environment');var controller=require(_0x7b64('0x8'));router['get']('/',auth[_0x7b64('0x9')](),controller[_0x7b64('0xa')]);router[_0x7b64('0xb')](_0x7b64('0xc'),auth[_0x7b64('0x9')](),controller[_0x7b64('0xd')]);router[_0x7b64('0xb')](_0x7b64('0xe'),auth[_0x7b64('0x9')](),controller['getConfigurations']);router[_0x7b64('0xb')]('/:id/fields',auth[_0x7b64('0x9')](),controller['getFields']);router['post']('/',auth[_0x7b64('0x9')](),controller[_0x7b64('0xf')]);router['post'](_0x7b64('0xe'),auth[_0x7b64('0x9')](),controller[_0x7b64('0x10')]);router[_0x7b64('0x11')](_0x7b64('0xc'),auth[_0x7b64('0x9')](),controller[_0x7b64('0x12')]);router['delete'](_0x7b64('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x7b64('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 7e26839..ad58d86 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 _0x69a7=['integrationTab','sequelize','exports','STRING','ENUM','basic','newTab'];(function(_0x1b6186,_0x1ec7f2){var _0x186121=function(_0x1748a8){while(--_0x1748a8){_0x1b6186['push'](_0x1b6186['shift']());}};_0x186121(++_0x1ec7f2);}(_0x69a7,0x119));var _0x769a=function(_0x241424,_0x25eb5d){_0x241424=_0x241424-0x0;var _0x3da798=_0x69a7[_0x241424];return _0x3da798;};'use strict';var Sequelize=require(_0x769a('0x0'));module[_0x769a('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x769a('0x2')]},'username':{'type':Sequelize[_0x769a('0x2')]},'remoteUri':{'type':Sequelize[_0x769a('0x2')]},'authType':{'type':Sequelize[_0x769a('0x3')]('basic'),'defaultValue':_0x769a('0x4')},'password':{'type':Sequelize[_0x769a('0x2')]},'consumerKey':{'type':Sequelize[_0x769a('0x2')]},'consumerSecret':{'type':Sequelize[_0x769a('0x2')]},'token':{'type':Sequelize[_0x769a('0x2')]},'tokenSecret':{'type':Sequelize[_0x769a('0x2')]},'serverUrl':{'type':Sequelize[_0x769a('0x2')]},'type':{'type':Sequelize[_0x769a('0x3')]('integrationTab',_0x769a('0x5')),'defaultValue':_0x769a('0x6')}}; \ No newline at end of file +var _0x0e51=['sequelize','exports','STRING','basic','integrationTab','newTab'];(function(_0x46060a,_0x4ed109){var _0x119e5e=function(_0x3d880d){while(--_0x3d880d){_0x46060a['push'](_0x46060a['shift']());}};_0x119e5e(++_0x4ed109);}(_0x0e51,0xba));var _0x10e5=function(_0x358271,_0x3b5cf0){_0x358271=_0x358271-0x0;var _0x37ad09=_0x0e51[_0x358271];return _0x37ad09;};'use strict';var Sequelize=require(_0x10e5('0x0'));module[_0x10e5('0x1')]={'name':{'type':Sequelize[_0x10e5('0x2')]},'description':{'type':Sequelize[_0x10e5('0x2')]},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x10e5('0x2')]},'authType':{'type':Sequelize['ENUM'](_0x10e5('0x3')),'defaultValue':_0x10e5('0x3')},'password':{'type':Sequelize[_0x10e5('0x2')]},'consumerKey':{'type':Sequelize[_0x10e5('0x2')]},'consumerSecret':{'type':Sequelize[_0x10e5('0x2')]},'token':{'type':Sequelize[_0x10e5('0x2')]},'tokenSecret':{'type':Sequelize[_0x10e5('0x2')]},'serverUrl':{'type':Sequelize[_0x10e5('0x2')]},'type':{'type':Sequelize['ENUM'](_0x10e5('0x4'),_0x10e5('0x5')),'defaultValue':_0x10e5('0x4')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 74d9e33..7eea0c9 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 _0xf8a6=['getSubjects','getDescriptions','channel','DeskField','Descriptions','getFields','priority','authType','username','password','consumerKey','consumerSecret','token','remoteUri','slice','lastIndexOf','GET','format','%s/custom_fields','application/json','basic','headers','%s:%s','base64','concat','_embedded','entries','active','label','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','statusCode','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','end','status','count','offset','limit','json','apply','save','update','sendStatus','stack','name','send','index','map','DeskAccount','rawAttributes','fieldName','key','keys','query','filters','intersection','attributes','model','fields','length','nolimit','order','sort','where','pick','filter','merge','type','include','rows','show','params','includeAll','options','find','create','body','destroy','DeskConfiguration','getConfigurations','addConfiguration','findOne','Subjects'];(function(_0x6c008,_0x226dbb){var _0x2746b8=function(_0x3278fb){while(--_0x3278fb){_0x6c008['push'](_0x6c008['shift']());}};_0x2746b8(++_0x226dbb);}(_0xf8a6,0x9b));var _0x6f8a=function(_0x43a7c4,_0x24ec22){_0x43a7c4=_0x43a7c4-0x0;var _0x54241e=_0xf8a6[_0x43a7c4];return _0x54241e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x6f8a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6f8a('0x1'));var jsonpatch=require(_0x6f8a('0x2'));var rp=require(_0x6f8a('0x3'));var moment=require(_0x6f8a('0x4'));var BPromise=require(_0x6f8a('0x5'));var Mustache=require('mustache');var util=require(_0x6f8a('0x6'));var path=require(_0x6f8a('0x7'));var sox=require('sox');var csv=require(_0x6f8a('0x8'));var ejs=require(_0x6f8a('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x6f8a('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x6f8a('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x6f8a('0xc'));var Redis=require('ioredis');var authService=require(_0x6f8a('0xd'));var qs=require(_0x6f8a('0xe'));var as=require(_0x6f8a('0xf'));var hardwareService=require(_0x6f8a('0x10'));var logger=require(_0x6f8a('0x11'))('api');var utils=require(_0x6f8a('0x12'));var config=require(_0x6f8a('0x13'));var db=require(_0x6f8a('0x14'))['db'];var integrations=require(_0x6f8a('0x15'));var jayson=require(_0x6f8a('0x16'));var client=jayson[_0x6f8a('0x17')][_0x6f8a('0x18')]({'port':0x232a});function checkPasswordPattern(_0xbab398,_0x9a6d73,_0x16f9c0){if(_0x16f9c0){var _0x82d0ba=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x82d0ba[_0x6f8a('0x19')](_0x9a6d73)){return _0xbab398;}else{throw new db[(_0x6f8a('0x1a'))][(_0x6f8a('0x1b'))](_0x6f8a('0x1c'));}}else{return _0xbab398;}}function respondWithRpcPromise(_0x542ec9,_0x43a694,_0x2ff8ca,_0x2ff31b){return new BPromise(function(_0x4e36fd,_0x33544f){var _0x4eb0ab=_0x2ff31b||client;return _0x4eb0ab[_0x6f8a('0x1d')](_0x542ec9,_0x2ff8ca)[_0x6f8a('0x1e')](function(_0x3d0604){logger[_0x6f8a('0x1f')](_0x6f8a('0x20'),_0x43a694,_0x6f8a('0x21'));logger[_0x6f8a('0x22')](_0x6f8a('0x23'),_0x43a694,_0x6f8a('0x21'),JSON[_0x6f8a('0x24')](_0x3d0604));if(_0x3d0604[_0x6f8a('0x25')]){if(_0x3d0604[_0x6f8a('0x25')][_0x6f8a('0x26')]===0x1f4){logger['error'](_0x6f8a('0x20'),_0x43a694,_0x3d0604[_0x6f8a('0x25')]['message']);return _0x33544f(_0x3d0604['error'][_0x6f8a('0x27')]);}logger['error']('DeskAccount,\x20%s,\x20%s',_0x43a694,_0x3d0604[_0x6f8a('0x25')]['message']);return _0x4e36fd(_0x3d0604[_0x6f8a('0x25')][_0x6f8a('0x27')]);}else{logger[_0x6f8a('0x1f')](_0x6f8a('0x20'),_0x43a694,'request\x20sent');_0x4e36fd(_0x3d0604['result']['message']);}})[_0x6f8a('0x28')](function(_0x320a37){logger[_0x6f8a('0x25')](_0x6f8a('0x20'),_0x43a694,_0x320a37);_0x33544f(_0x320a37);});});}function respondWithStatusCode(_0x4b48ab,_0x140ce3){_0x140ce3=_0x140ce3||0xcc;return function(_0x144e96){if(_0x144e96){return _0x4b48ab['sendStatus'](_0x140ce3);}return _0x4b48ab['status'](_0x140ce3)[_0x6f8a('0x29')]();};}function respondWithResult(_0x6eefad,_0xd9b4df){_0xd9b4df=_0xd9b4df||0xc8;return function(_0xe0b34){if(_0xe0b34){return _0x6eefad[_0x6f8a('0x2a')](_0xd9b4df)['json'](_0xe0b34);}};}function respondWithFilteredResult(_0x4e042a,_0x53e640){return function(_0x3243b4){if(_0x3243b4){var _0x245cb3=_0x3243b4[_0x6f8a('0x2b')],_0x238e09=_0x53e640[_0x6f8a('0x2c')],_0x456eac=_0x53e640[_0x6f8a('0x2c')]+_0x53e640[_0x6f8a('0x2d')],_0x1fb34f;if(_0x456eac>=_0x245cb3){_0x456eac=_0x245cb3;_0x1fb34f=0xc8;}else{_0x1fb34f=0xce;}_0x4e042a[_0x6f8a('0x2a')](_0x1fb34f);return _0x4e042a['set']('Content-Range',_0x238e09+'-'+_0x456eac+'/'+_0x245cb3)[_0x6f8a('0x2e')](_0x3243b4);}return null;};}function patchUpdates(_0x19973b){return function(_0x2c3add){try{jsonpatch[_0x6f8a('0x2f')](_0x2c3add,_0x19973b,!![]);}catch(_0x24b54d){return BPromise['reject'](_0x24b54d);}return _0x2c3add[_0x6f8a('0x30')]();};}function saveUpdates(_0xb17594,_0x257b3e){return function(_0x2598c3){if(_0x2598c3){return _0x2598c3[_0x6f8a('0x31')](_0xb17594)[_0x6f8a('0x1e')](function(_0x559140){return _0x559140;});}return null;};}function removeEntity(_0x363b97,_0x370523){return function(_0xfc4d1){if(_0xfc4d1){return _0xfc4d1['destroy']()[_0x6f8a('0x1e')](function(){_0x363b97[_0x6f8a('0x2a')](0xcc)[_0x6f8a('0x29')]();});}};}function handleEntityNotFound(_0xd8d995,_0x4f0ff5){return function(_0x4d105f){if(!_0x4d105f){_0xd8d995[_0x6f8a('0x32')](0x194);}return _0x4d105f;};}function handleError(_0x3d1df7,_0x2bfacd){_0x2bfacd=_0x2bfacd||0x1f4;return function(_0x554d3f){logger['error'](_0x554d3f[_0x6f8a('0x33')]);if(_0x554d3f[_0x6f8a('0x34')]){delete _0x554d3f[_0x6f8a('0x34')];}_0x3d1df7[_0x6f8a('0x2a')](_0x2bfacd)[_0x6f8a('0x35')](_0x554d3f);};}exports[_0x6f8a('0x36')]=function(_0x288c05,_0x2109a2){var _0x56ebc4={},_0x2371be={},_0x35d6e9={'count':0x0,'rows':[]};var _0x11c05d=_[_0x6f8a('0x37')](db[_0x6f8a('0x38')][_0x6f8a('0x39')],function(_0x390e5a){return{'name':_0x390e5a[_0x6f8a('0x3a')],'type':_0x390e5a['type'][_0x6f8a('0x3b')]};});_0x2371be['model']=_[_0x6f8a('0x37')](_0x11c05d,'name');_0x2371be['query']=_[_0x6f8a('0x3c')](_0x288c05[_0x6f8a('0x3d')]);_0x2371be[_0x6f8a('0x3e')]=_[_0x6f8a('0x3f')](_0x2371be['model'],_0x2371be[_0x6f8a('0x3d')]);_0x56ebc4[_0x6f8a('0x40')]=_['intersection'](_0x2371be[_0x6f8a('0x41')],qs[_0x6f8a('0x42')](_0x288c05['query'][_0x6f8a('0x42')]));_0x56ebc4['attributes']=_0x56ebc4[_0x6f8a('0x40')][_0x6f8a('0x43')]?_0x56ebc4[_0x6f8a('0x40')]:_0x2371be['model'];if(!_0x288c05[_0x6f8a('0x3d')]['hasOwnProperty'](_0x6f8a('0x44'))){_0x56ebc4[_0x6f8a('0x2d')]=qs['limit'](_0x288c05[_0x6f8a('0x3d')][_0x6f8a('0x2d')]);_0x56ebc4[_0x6f8a('0x2c')]=qs[_0x6f8a('0x2c')](_0x288c05['query'][_0x6f8a('0x2c')]);}_0x56ebc4[_0x6f8a('0x45')]=qs['sort'](_0x288c05[_0x6f8a('0x3d')][_0x6f8a('0x46')]);_0x56ebc4[_0x6f8a('0x47')]=qs[_0x6f8a('0x3e')](_[_0x6f8a('0x48')](_0x288c05[_0x6f8a('0x3d')],_0x2371be[_0x6f8a('0x3e')]),_0x11c05d);if(_0x288c05[_0x6f8a('0x3d')][_0x6f8a('0x49')]){_0x56ebc4[_0x6f8a('0x47')]=_[_0x6f8a('0x4a')](_0x56ebc4[_0x6f8a('0x47')],{'$or':_[_0x6f8a('0x37')](_0x11c05d,function(_0x163013){if(_0x163013[_0x6f8a('0x4b')]!=='VIRTUAL'){var _0x4faec3={};_0x4faec3[_0x163013[_0x6f8a('0x34')]]={'$like':'%'+_0x288c05[_0x6f8a('0x3d')]['filter']+'%'};return _0x4faec3;}})});}_0x56ebc4=_[_0x6f8a('0x4a')]({},_0x56ebc4,_0x288c05['options']);var _0x555470={'where':_0x56ebc4['where']};return db['DeskAccount'][_0x6f8a('0x2b')](_0x555470)[_0x6f8a('0x1e')](function(_0x29ee08){_0x35d6e9['count']=_0x29ee08;if(_0x288c05[_0x6f8a('0x3d')]['includeAll']){_0x56ebc4[_0x6f8a('0x4c')]=[{'all':!![]}];}return db['DeskAccount']['findAll'](_0x56ebc4);})[_0x6f8a('0x1e')](function(_0x4f0b65){_0x35d6e9[_0x6f8a('0x4d')]=_0x4f0b65;return _0x35d6e9;})[_0x6f8a('0x1e')](respondWithFilteredResult(_0x2109a2,_0x56ebc4))[_0x6f8a('0x28')](handleError(_0x2109a2,null));};exports[_0x6f8a('0x4e')]=function(_0x4998da,_0x1ee63b){var _0x142f65={'raw':![],'where':{'id':_0x4998da[_0x6f8a('0x4f')]['id']}},_0x19c2a3={};_0x19c2a3[_0x6f8a('0x41')]=_[_0x6f8a('0x3c')](db[_0x6f8a('0x38')][_0x6f8a('0x39')]);_0x19c2a3['query']=_[_0x6f8a('0x3c')](_0x4998da['query']);_0x19c2a3[_0x6f8a('0x3e')]=_[_0x6f8a('0x3f')](_0x19c2a3[_0x6f8a('0x41')],_0x19c2a3[_0x6f8a('0x3d')]);_0x142f65[_0x6f8a('0x40')]=_[_0x6f8a('0x3f')](_0x19c2a3[_0x6f8a('0x41')],qs['fields'](_0x4998da[_0x6f8a('0x3d')]['fields']));_0x142f65[_0x6f8a('0x40')]=_0x142f65['attributes'][_0x6f8a('0x43')]?_0x142f65[_0x6f8a('0x40')]:_0x19c2a3[_0x6f8a('0x41')];if(_0x4998da[_0x6f8a('0x3d')][_0x6f8a('0x50')]){_0x142f65[_0x6f8a('0x4c')]=[{'all':!![]}];}_0x142f65=_[_0x6f8a('0x4a')]({},_0x142f65,_0x4998da[_0x6f8a('0x51')]);return db[_0x6f8a('0x38')][_0x6f8a('0x52')](_0x142f65)[_0x6f8a('0x1e')](handleEntityNotFound(_0x1ee63b,null))[_0x6f8a('0x1e')](respondWithResult(_0x1ee63b,null))[_0x6f8a('0x28')](handleError(_0x1ee63b,null));};exports[_0x6f8a('0x53')]=function(_0x50dc55,_0x393d6a){return db['DeskAccount']['create'](_0x50dc55[_0x6f8a('0x54')],{})[_0x6f8a('0x1e')](respondWithResult(_0x393d6a,0xc9))[_0x6f8a('0x28')](handleError(_0x393d6a,null));};exports[_0x6f8a('0x31')]=function(_0x332629,_0x1e1163){if(_0x332629['body']['id']){delete _0x332629['body']['id'];}return db['DeskAccount'][_0x6f8a('0x52')]({'where':{'id':_0x332629[_0x6f8a('0x4f')]['id']}})[_0x6f8a('0x1e')](handleEntityNotFound(_0x1e1163,null))['then'](saveUpdates(_0x332629[_0x6f8a('0x54')],null))[_0x6f8a('0x1e')](respondWithResult(_0x1e1163,null))[_0x6f8a('0x28')](handleError(_0x1e1163,null));};exports[_0x6f8a('0x55')]=function(_0x237659,_0x44348a){return db[_0x6f8a('0x38')][_0x6f8a('0x52')]({'where':{'id':_0x237659[_0x6f8a('0x4f')]['id']}})['then'](handleEntityNotFound(_0x44348a,null))[_0x6f8a('0x1e')](removeEntity(_0x44348a,null))[_0x6f8a('0x28')](handleError(_0x44348a,null));};exports['getConfigurations']=function(_0x521661,_0x1a0353,_0x25887d){var _0x1e8fc7={};var _0x4ae1d7={};var _0x1636eb;var _0x6bf3e6;return db[_0x6f8a('0x38')]['findOne']({'where':{'id':_0x521661[_0x6f8a('0x4f')]['id']}})[_0x6f8a('0x1e')](handleEntityNotFound(_0x1a0353,null))[_0x6f8a('0x1e')](function(_0x82dc3a){if(_0x82dc3a){_0x1636eb=_0x82dc3a;_0x4ae1d7[_0x6f8a('0x41')]=_[_0x6f8a('0x3c')](db[_0x6f8a('0x56')][_0x6f8a('0x39')]);_0x4ae1d7['query']=_['keys'](_0x521661['query']);_0x4ae1d7['filters']=_[_0x6f8a('0x3f')](_0x4ae1d7[_0x6f8a('0x41')],_0x4ae1d7['query']);_0x1e8fc7[_0x6f8a('0x40')]=_[_0x6f8a('0x3f')](_0x4ae1d7[_0x6f8a('0x41')],qs[_0x6f8a('0x42')](_0x521661['query']['fields']));_0x1e8fc7[_0x6f8a('0x40')]=_0x1e8fc7[_0x6f8a('0x40')][_0x6f8a('0x43')]?_0x1e8fc7[_0x6f8a('0x40')]:_0x4ae1d7[_0x6f8a('0x41')];_0x1e8fc7[_0x6f8a('0x45')]=qs[_0x6f8a('0x46')](_0x521661['query'][_0x6f8a('0x46')]);_0x1e8fc7[_0x6f8a('0x47')]=qs['filters'](_['pick'](_0x521661['query'],_0x4ae1d7[_0x6f8a('0x3e')]));if(_0x521661[_0x6f8a('0x3d')][_0x6f8a('0x49')]){_0x1e8fc7[_0x6f8a('0x47')]=_[_0x6f8a('0x4a')](_0x1e8fc7['where'],{'$or':_[_0x6f8a('0x37')](_0x1e8fc7[_0x6f8a('0x40')],function(_0x2f3418){var _0x384ae6={};_0x384ae6[_0x2f3418]={'$like':'%'+_0x521661[_0x6f8a('0x3d')][_0x6f8a('0x49')]+'%'};return _0x384ae6;})});}_0x1e8fc7=_['merge']({},_0x1e8fc7,_0x521661[_0x6f8a('0x51')]);return _0x1636eb[_0x6f8a('0x57')](_0x1e8fc7);}})[_0x6f8a('0x1e')](function(_0x3c500e){if(_0x3c500e){_0x6bf3e6=_0x3c500e[_0x6f8a('0x43')];if(!_0x521661[_0x6f8a('0x3d')]['hasOwnProperty'](_0x6f8a('0x44'))){_0x1e8fc7['limit']=qs['limit'](_0x521661[_0x6f8a('0x3d')][_0x6f8a('0x2d')]);_0x1e8fc7[_0x6f8a('0x2c')]=qs['offset'](_0x521661['query'][_0x6f8a('0x2c')]);}return _0x1636eb[_0x6f8a('0x57')](_0x1e8fc7);}})[_0x6f8a('0x1e')](function(_0x1f11a7){if(_0x1f11a7){return _0x1f11a7?{'count':_0x6bf3e6,'rows':_0x1f11a7}:null;}})[_0x6f8a('0x1e')](respondWithResult(_0x1a0353,null))[_0x6f8a('0x28')](handleError(_0x1a0353,null));};exports[_0x6f8a('0x58')]=function(_0x29bdcc,_0xc62a9,_0x738d6a){if(_0x29bdcc[_0x6f8a('0x54')]['id']){delete _0x29bdcc['body']['id'];}return db[_0x6f8a('0x38')][_0x6f8a('0x59')]({'where':{'id':_0x29bdcc[_0x6f8a('0x4f')]['id']}})[_0x6f8a('0x1e')](handleEntityNotFound(_0xc62a9,null))[_0x6f8a('0x1e')](function(_0x1a25d8){if(_0x1a25d8){_0x29bdcc[_0x6f8a('0x54')]['AccountId']=_0x1a25d8['id'];_0x29bdcc['body'][_0x6f8a('0x5a')]=integrations[_0x6f8a('0x5b')](_0x29bdcc[_0x6f8a('0x54')]['channel'],_0x29bdcc[_0x6f8a('0x54')][_0x6f8a('0x4b')]);_0x29bdcc[_0x6f8a('0x54')]['Descriptions']=integrations[_0x6f8a('0x5c')](_0x29bdcc[_0x6f8a('0x54')][_0x6f8a('0x5d')],_0x29bdcc['body'][_0x6f8a('0x4b')]);return db[_0x6f8a('0x56')]['create'](_0x29bdcc['body'],{'include':[{'model':db[_0x6f8a('0x5e')],'as':_0x6f8a('0x5a')},{'model':db[_0x6f8a('0x5e')],'as':_0x6f8a('0x5f')}]});}return null;})[_0x6f8a('0x1e')](respondWithResult(_0xc62a9,null))[_0x6f8a('0x28')](handleError(_0xc62a9,null));};exports[_0x6f8a('0x60')]=function(_0x121b2a,_0x428952,_0x1e20e0){var _0x1e423a=[{'name':'priority','label':_0x6f8a('0x61'),'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 _0x1e5985='';return db[_0x6f8a('0x38')][_0x6f8a('0x59')]({'where':{'id':_0x121b2a[_0x6f8a('0x4f')]['id']},'attributes':['id','remoteUri',_0x6f8a('0x62'),_0x6f8a('0x63'),_0x6f8a('0x64'),_0x6f8a('0x65'),_0x6f8a('0x66'),_0x6f8a('0x67'),'tokenSecret']})[_0x6f8a('0x1e')](handleEntityNotFound(_0x428952,null))[_0x6f8a('0x1e')](function(_0x5af820){if(_0x5af820){_0x1e5985=_0x5af820[_0x6f8a('0x68')];var _0x432d4b=_0x1e5985[_0x6f8a('0x69')](-0x1);if(_0x432d4b==='/'){_0x1e5985=_0x1e5985['substring'](0x0,_0x1e5985[_0x6f8a('0x6a')](_0x432d4b));}var _0x111de6={'method':_0x6f8a('0x6b'),'uri':util[_0x6f8a('0x6c')](_0x6f8a('0x6d'),_0x1e5985),'headers':{'Content-Type':_0x6f8a('0x6e'),'Accept':_0x6f8a('0x6e')},'json':!![]};if(_0x5af820[_0x6f8a('0x62')]===_0x6f8a('0x6f')){_0x111de6[_0x6f8a('0x70')]['Authorization']=util['format']('Basic\x20%s',new Buffer(util[_0x6f8a('0x6c')](_0x6f8a('0x71'),_0x5af820[_0x6f8a('0x63')],_0x5af820['password']))['toString'](_0x6f8a('0x72')));}return rp(_0x111de6)[_0x6f8a('0x1e')](function(_0x58aaa7){return _0x1e423a[_0x6f8a('0x73')](_[_0x6f8a('0x37')](_0x58aaa7[_0x6f8a('0x74')][_0x6f8a('0x75')],function(_0x52a7e5){return{'id':_0x52a7e5['name'],'name':_0x52a7e5['name'],'type':_0x52a7e5[_0x6f8a('0x4b')],'active':_0x52a7e5[_0x6f8a('0x76')],'label':_0x52a7e5[_0x6f8a('0x77')],'custom':!![]};}));});}})[_0x6f8a('0x1e')](function(_0x586327){return{'count':_0x586327[_0x6f8a('0x43')],'rows':_0x586327};})[_0x6f8a('0x1e')](respondWithResult(_0x428952,null))[_0x6f8a('0x28')](function(_0x525249){var _0x3efce3=_0x121b2a['query'][_0x6f8a('0x19')]?0x1f4:_0x525249['statusCode']||0x1f4;logger['error'](_0x6f8a('0x78'),_0x6f8a('0x60'),_0x3efce3,JSON[_0x6f8a('0x24')](_0x525249));delete _0x525249[_0x6f8a('0x34')];if(_0x3efce3===0x191){_0x3efce3=0x190;}_0x428952['status'](_0x3efce3)['send'](_0x121b2a[_0x6f8a('0x3d')][_0x6f8a('0x19')]?{'message':_0x6f8a('0x79'),'statusCode':_0x525249[_0x6f8a('0x7a')]}:_0x525249);});}; \ No newline at end of file +var _0xd019=['getConfigurations','DeskConfiguration','addConfiguration','findOne','getSubjects','channel','Descriptions','create','Subjects','DeskField','getFields','priority','remoteUri','authType','consumerSecret','token','slice','substring','lastIndexOf','format','%s/custom_fields','application/json','basic','headers','Authorization','%s:%s','username','password','toString','base64','concat','_embedded','entries','label','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','json','count','offset','limit','apply','reject','save','destroy','end','name','send','index','map','DeskAccount','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','findAll','rows','params','include','body','update','find'];(function(_0x2666b7,_0x5e6e98){var _0x53ea7d=function(_0x3eeb56){while(--_0x3eeb56){_0x2666b7['push'](_0x2666b7['shift']());}};_0x53ea7d(++_0x5e6e98);}(_0xd019,0x11b));var _0x9d01=function(_0xa1e3ca,_0x559022){_0xa1e3ca=_0xa1e3ca-0x0;var _0x5005ab=_0xd019[_0xa1e3ca];return _0x5005ab;};'use strict';var pdf=require(_0x9d01('0x0'));var emlformat=require(_0x9d01('0x1'));var rimraf=require(_0x9d01('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9d01('0x3'));var rp=require(_0x9d01('0x4'));var moment=require('moment');var BPromise=require(_0x9d01('0x5'));var Mustache=require(_0x9d01('0x6'));var util=require('util');var path=require(_0x9d01('0x7'));var sox=require(_0x9d01('0x8'));var csv=require(_0x9d01('0x9'));var ejs=require(_0x9d01('0xa'));var fs=require('fs');var _=require(_0x9d01('0xb'));var squel=require('squel');var crypto=require(_0x9d01('0xc'));var jsforce=require(_0x9d01('0xd'));var deskjs=require(_0x9d01('0xe'));var toCsv=require(_0x9d01('0x9'));var querystring=require(_0x9d01('0xf'));var Papa=require(_0x9d01('0x10'));var Redis=require(_0x9d01('0x11'));var authService=require(_0x9d01('0x12'));var qs=require(_0x9d01('0x13'));var as=require(_0x9d01('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9d01('0x15'))(_0x9d01('0x16'));var utils=require(_0x9d01('0x17'));var config=require('../../config/environment');var db=require(_0x9d01('0x18'))['db'];var integrations=require(_0x9d01('0x19'));var jayson=require(_0x9d01('0x1a'));var client=jayson[_0x9d01('0x1b')][_0x9d01('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x1e6e61,_0x16291f,_0x510801){if(_0x510801){var _0x2ad30b=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2ad30b[_0x9d01('0x1d')](_0x16291f)){return _0x1e6e61;}else{throw new db['Sequelize'][(_0x9d01('0x1e'))](_0x9d01('0x1f'));}}else{return _0x1e6e61;}}function respondWithRpcPromise(_0x2d2028,_0x2cd845,_0x350e90,_0x307d2b){return new BPromise(function(_0x562da5,_0x2c7c23){var _0x59e745=_0x307d2b||client;return _0x59e745[_0x9d01('0x20')](_0x2d2028,_0x350e90)[_0x9d01('0x21')](function(_0x3368eb){logger[_0x9d01('0x22')](_0x9d01('0x23'),_0x2cd845,_0x9d01('0x24'));logger['debug'](_0x9d01('0x25'),_0x2cd845,_0x9d01('0x24'),JSON[_0x9d01('0x26')](_0x3368eb));if(_0x3368eb[_0x9d01('0x27')]){if(_0x3368eb[_0x9d01('0x27')][_0x9d01('0x28')]===0x1f4){logger[_0x9d01('0x27')]('DeskAccount,\x20%s,\x20%s',_0x2cd845,_0x3368eb['error']['message']);return _0x2c7c23(_0x3368eb[_0x9d01('0x27')]['message']);}logger['error'](_0x9d01('0x23'),_0x2cd845,_0x3368eb[_0x9d01('0x27')][_0x9d01('0x29')]);return _0x562da5(_0x3368eb[_0x9d01('0x27')][_0x9d01('0x29')]);}else{logger[_0x9d01('0x22')](_0x9d01('0x23'),_0x2cd845,_0x9d01('0x24'));_0x562da5(_0x3368eb[_0x9d01('0x2a')]['message']);}})[_0x9d01('0x2b')](function(_0x446aaa){logger[_0x9d01('0x27')]('DeskAccount,\x20%s,\x20%s',_0x2cd845,_0x446aaa);_0x2c7c23(_0x446aaa);});});}function respondWithStatusCode(_0x3e8add,_0x37cc62){_0x37cc62=_0x37cc62||0xcc;return function(_0x298f1f){if(_0x298f1f){return _0x3e8add['sendStatus'](_0x37cc62);}return _0x3e8add[_0x9d01('0x2c')](_0x37cc62)['end']();};}function respondWithResult(_0x4b8001,_0xba2737){_0xba2737=_0xba2737||0xc8;return function(_0x4966d7){if(_0x4966d7){return _0x4b8001[_0x9d01('0x2c')](_0xba2737)[_0x9d01('0x2d')](_0x4966d7);}};}function respondWithFilteredResult(_0x517df6,_0xe0c45){return function(_0x5c75a2){if(_0x5c75a2){var _0x43b293=_0x5c75a2[_0x9d01('0x2e')],_0x41f1a7=_0xe0c45[_0x9d01('0x2f')],_0x5dd467=_0xe0c45[_0x9d01('0x2f')]+_0xe0c45[_0x9d01('0x30')],_0x3b0ccd;if(_0x5dd467>=_0x43b293){_0x5dd467=_0x43b293;_0x3b0ccd=0xc8;}else{_0x3b0ccd=0xce;}_0x517df6[_0x9d01('0x2c')](_0x3b0ccd);return _0x517df6['set']('Content-Range',_0x41f1a7+'-'+_0x5dd467+'/'+_0x43b293)['json'](_0x5c75a2);}return null;};}function patchUpdates(_0x565129){return function(_0x14559e){try{jsonpatch[_0x9d01('0x31')](_0x14559e,_0x565129,!![]);}catch(_0x374225){return BPromise[_0x9d01('0x32')](_0x374225);}return _0x14559e[_0x9d01('0x33')]();};}function saveUpdates(_0x7b70ae,_0x30290a){return function(_0x585252){if(_0x585252){return _0x585252['update'](_0x7b70ae)[_0x9d01('0x21')](function(_0x2a49e5){return _0x2a49e5;});}return null;};}function removeEntity(_0x7290b6,_0x2f657b){return function(_0x4470c9){if(_0x4470c9){return _0x4470c9[_0x9d01('0x34')]()[_0x9d01('0x21')](function(){_0x7290b6[_0x9d01('0x2c')](0xcc)[_0x9d01('0x35')]();});}};}function handleEntityNotFound(_0x246193,_0x22d73b){return function(_0x462b3f){if(!_0x462b3f){_0x246193['sendStatus'](0x194);}return _0x462b3f;};}function handleError(_0x5ce9d5,_0x3d19f6){_0x3d19f6=_0x3d19f6||0x1f4;return function(_0x574539){logger[_0x9d01('0x27')](_0x574539['stack']);if(_0x574539[_0x9d01('0x36')]){delete _0x574539['name'];}_0x5ce9d5[_0x9d01('0x2c')](_0x3d19f6)[_0x9d01('0x37')](_0x574539);};}exports[_0x9d01('0x38')]=function(_0x24c456,_0x2920e4){var _0x28d27b={},_0x3a462e={},_0x45717b={'count':0x0,'rows':[]};var _0x262d03=_[_0x9d01('0x39')](db[_0x9d01('0x3a')][_0x9d01('0x3b')],function(_0x318771){return{'name':_0x318771[_0x9d01('0x3c')],'type':_0x318771[_0x9d01('0x3d')]['key']};});_0x3a462e[_0x9d01('0x3e')]=_[_0x9d01('0x39')](_0x262d03,_0x9d01('0x36'));_0x3a462e[_0x9d01('0x3f')]=_[_0x9d01('0x40')](_0x24c456[_0x9d01('0x3f')]);_0x3a462e[_0x9d01('0x41')]=_[_0x9d01('0x42')](_0x3a462e[_0x9d01('0x3e')],_0x3a462e[_0x9d01('0x3f')]);_0x28d27b[_0x9d01('0x43')]=_[_0x9d01('0x42')](_0x3a462e['model'],qs[_0x9d01('0x44')](_0x24c456['query'][_0x9d01('0x44')]));_0x28d27b[_0x9d01('0x43')]=_0x28d27b[_0x9d01('0x43')][_0x9d01('0x45')]?_0x28d27b[_0x9d01('0x43')]:_0x3a462e[_0x9d01('0x3e')];if(!_0x24c456['query'][_0x9d01('0x46')](_0x9d01('0x47'))){_0x28d27b[_0x9d01('0x30')]=qs[_0x9d01('0x30')](_0x24c456[_0x9d01('0x3f')]['limit']);_0x28d27b['offset']=qs[_0x9d01('0x2f')](_0x24c456[_0x9d01('0x3f')][_0x9d01('0x2f')]);}_0x28d27b[_0x9d01('0x48')]=qs[_0x9d01('0x49')](_0x24c456[_0x9d01('0x3f')][_0x9d01('0x49')]);_0x28d27b[_0x9d01('0x4a')]=qs[_0x9d01('0x41')](_[_0x9d01('0x4b')](_0x24c456[_0x9d01('0x3f')],_0x3a462e[_0x9d01('0x41')]),_0x262d03);if(_0x24c456[_0x9d01('0x3f')][_0x9d01('0x4c')]){_0x28d27b[_0x9d01('0x4a')]=_[_0x9d01('0x4d')](_0x28d27b[_0x9d01('0x4a')],{'$or':_[_0x9d01('0x39')](_0x262d03,function(_0x593854){if(_0x593854[_0x9d01('0x3d')]!=='VIRTUAL'){var _0x32a3ae={};_0x32a3ae[_0x593854[_0x9d01('0x36')]]={'$like':'%'+_0x24c456[_0x9d01('0x3f')][_0x9d01('0x4c')]+'%'};return _0x32a3ae;}})});}_0x28d27b=_[_0x9d01('0x4d')]({},_0x28d27b,_0x24c456[_0x9d01('0x4e')]);var _0x4e7355={'where':_0x28d27b['where']};return db[_0x9d01('0x3a')][_0x9d01('0x2e')](_0x4e7355)['then'](function(_0x5d22a6){_0x45717b[_0x9d01('0x2e')]=_0x5d22a6;if(_0x24c456[_0x9d01('0x3f')]['includeAll']){_0x28d27b['include']=[{'all':!![]}];}return db[_0x9d01('0x3a')][_0x9d01('0x4f')](_0x28d27b);})['then'](function(_0x4b8dcf){_0x45717b[_0x9d01('0x50')]=_0x4b8dcf;return _0x45717b;})['then'](respondWithFilteredResult(_0x2920e4,_0x28d27b))[_0x9d01('0x2b')](handleError(_0x2920e4,null));};exports['show']=function(_0x33d4d8,_0x2abc04){var _0x254565={'raw':![],'where':{'id':_0x33d4d8[_0x9d01('0x51')]['id']}},_0x3f8054={};_0x3f8054[_0x9d01('0x3e')]=_[_0x9d01('0x40')](db[_0x9d01('0x3a')][_0x9d01('0x3b')]);_0x3f8054['query']=_[_0x9d01('0x40')](_0x33d4d8['query']);_0x3f8054[_0x9d01('0x41')]=_[_0x9d01('0x42')](_0x3f8054[_0x9d01('0x3e')],_0x3f8054[_0x9d01('0x3f')]);_0x254565[_0x9d01('0x43')]=_[_0x9d01('0x42')](_0x3f8054[_0x9d01('0x3e')],qs[_0x9d01('0x44')](_0x33d4d8[_0x9d01('0x3f')]['fields']));_0x254565[_0x9d01('0x43')]=_0x254565[_0x9d01('0x43')]['length']?_0x254565[_0x9d01('0x43')]:_0x3f8054[_0x9d01('0x3e')];if(_0x33d4d8[_0x9d01('0x3f')]['includeAll']){_0x254565[_0x9d01('0x52')]=[{'all':!![]}];}_0x254565=_[_0x9d01('0x4d')]({},_0x254565,_0x33d4d8[_0x9d01('0x4e')]);return db[_0x9d01('0x3a')]['find'](_0x254565)[_0x9d01('0x21')](handleEntityNotFound(_0x2abc04,null))[_0x9d01('0x21')](respondWithResult(_0x2abc04,null))[_0x9d01('0x2b')](handleError(_0x2abc04,null));};exports['create']=function(_0x25dec4,_0x41c0cf){return db['DeskAccount']['create'](_0x25dec4[_0x9d01('0x53')],{})['then'](respondWithResult(_0x41c0cf,0xc9))[_0x9d01('0x2b')](handleError(_0x41c0cf,null));};exports[_0x9d01('0x54')]=function(_0x41db31,_0x23091f){if(_0x41db31[_0x9d01('0x53')]['id']){delete _0x41db31[_0x9d01('0x53')]['id'];}return db['DeskAccount'][_0x9d01('0x55')]({'where':{'id':_0x41db31['params']['id']}})[_0x9d01('0x21')](handleEntityNotFound(_0x23091f,null))[_0x9d01('0x21')](saveUpdates(_0x41db31[_0x9d01('0x53')],null))[_0x9d01('0x21')](respondWithResult(_0x23091f,null))[_0x9d01('0x2b')](handleError(_0x23091f,null));};exports[_0x9d01('0x34')]=function(_0x51e001,_0x572d88){return db[_0x9d01('0x3a')][_0x9d01('0x55')]({'where':{'id':_0x51e001['params']['id']}})[_0x9d01('0x21')](handleEntityNotFound(_0x572d88,null))[_0x9d01('0x21')](removeEntity(_0x572d88,null))[_0x9d01('0x2b')](handleError(_0x572d88,null));};exports[_0x9d01('0x56')]=function(_0x2d5bf0,_0x4342f9,_0x50949a){var _0x4e2be2={};var _0x1ade2b={};var _0x3cce8e;var _0x510581;return db[_0x9d01('0x3a')]['findOne']({'where':{'id':_0x2d5bf0[_0x9d01('0x51')]['id']}})[_0x9d01('0x21')](handleEntityNotFound(_0x4342f9,null))[_0x9d01('0x21')](function(_0x190403){if(_0x190403){_0x3cce8e=_0x190403;_0x1ade2b['model']=_[_0x9d01('0x40')](db[_0x9d01('0x57')][_0x9d01('0x3b')]);_0x1ade2b['query']=_['keys'](_0x2d5bf0[_0x9d01('0x3f')]);_0x1ade2b[_0x9d01('0x41')]=_[_0x9d01('0x42')](_0x1ade2b['model'],_0x1ade2b[_0x9d01('0x3f')]);_0x4e2be2[_0x9d01('0x43')]=_['intersection'](_0x1ade2b[_0x9d01('0x3e')],qs[_0x9d01('0x44')](_0x2d5bf0[_0x9d01('0x3f')][_0x9d01('0x44')]));_0x4e2be2['attributes']=_0x4e2be2[_0x9d01('0x43')][_0x9d01('0x45')]?_0x4e2be2['attributes']:_0x1ade2b[_0x9d01('0x3e')];_0x4e2be2[_0x9d01('0x48')]=qs[_0x9d01('0x49')](_0x2d5bf0['query'][_0x9d01('0x49')]);_0x4e2be2[_0x9d01('0x4a')]=qs['filters'](_[_0x9d01('0x4b')](_0x2d5bf0[_0x9d01('0x3f')],_0x1ade2b['filters']));if(_0x2d5bf0[_0x9d01('0x3f')][_0x9d01('0x4c')]){_0x4e2be2[_0x9d01('0x4a')]=_[_0x9d01('0x4d')](_0x4e2be2['where'],{'$or':_[_0x9d01('0x39')](_0x4e2be2[_0x9d01('0x43')],function(_0x3c3563){var _0x157257={};_0x157257[_0x3c3563]={'$like':'%'+_0x2d5bf0['query'][_0x9d01('0x4c')]+'%'};return _0x157257;})});}_0x4e2be2=_['merge']({},_0x4e2be2,_0x2d5bf0['options']);return _0x3cce8e['getConfigurations'](_0x4e2be2);}})[_0x9d01('0x21')](function(_0x1dc93a){if(_0x1dc93a){_0x510581=_0x1dc93a[_0x9d01('0x45')];if(!_0x2d5bf0[_0x9d01('0x3f')][_0x9d01('0x46')](_0x9d01('0x47'))){_0x4e2be2[_0x9d01('0x30')]=qs[_0x9d01('0x30')](_0x2d5bf0[_0x9d01('0x3f')]['limit']);_0x4e2be2[_0x9d01('0x2f')]=qs[_0x9d01('0x2f')](_0x2d5bf0[_0x9d01('0x3f')][_0x9d01('0x2f')]);}return _0x3cce8e[_0x9d01('0x56')](_0x4e2be2);}})['then'](function(_0x2dd2ce){if(_0x2dd2ce){return _0x2dd2ce?{'count':_0x510581,'rows':_0x2dd2ce}:null;}})[_0x9d01('0x21')](respondWithResult(_0x4342f9,null))[_0x9d01('0x2b')](handleError(_0x4342f9,null));};exports[_0x9d01('0x58')]=function(_0x2f2e91,_0x28421d,_0x2a7c99){if(_0x2f2e91[_0x9d01('0x53')]['id']){delete _0x2f2e91[_0x9d01('0x53')]['id'];}return db[_0x9d01('0x3a')][_0x9d01('0x59')]({'where':{'id':_0x2f2e91[_0x9d01('0x51')]['id']}})[_0x9d01('0x21')](handleEntityNotFound(_0x28421d,null))[_0x9d01('0x21')](function(_0x1a69cd){if(_0x1a69cd){_0x2f2e91[_0x9d01('0x53')]['AccountId']=_0x1a69cd['id'];_0x2f2e91['body']['Subjects']=integrations[_0x9d01('0x5a')](_0x2f2e91[_0x9d01('0x53')][_0x9d01('0x5b')],_0x2f2e91[_0x9d01('0x53')][_0x9d01('0x3d')]);_0x2f2e91[_0x9d01('0x53')][_0x9d01('0x5c')]=integrations['getDescriptions'](_0x2f2e91[_0x9d01('0x53')][_0x9d01('0x5b')],_0x2f2e91[_0x9d01('0x53')][_0x9d01('0x3d')]);return db[_0x9d01('0x57')][_0x9d01('0x5d')](_0x2f2e91[_0x9d01('0x53')],{'include':[{'model':db['DeskField'],'as':_0x9d01('0x5e')},{'model':db[_0x9d01('0x5f')],'as':_0x9d01('0x5c')}]});}return null;})[_0x9d01('0x21')](respondWithResult(_0x28421d,null))[_0x9d01('0x2b')](handleError(_0x28421d,null));};exports[_0x9d01('0x60')]=function(_0x3b1656,_0xa67817,_0x2da557){var _0x5147ec=[{'name':_0x9d01('0x61'),'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 _0x49c48d='';return db['DeskAccount'][_0x9d01('0x59')]({'where':{'id':_0x3b1656[_0x9d01('0x51')]['id']},'attributes':['id',_0x9d01('0x62'),_0x9d01('0x63'),'username','password','consumerKey',_0x9d01('0x64'),_0x9d01('0x65'),'tokenSecret']})[_0x9d01('0x21')](handleEntityNotFound(_0xa67817,null))[_0x9d01('0x21')](function(_0x2d637e){if(_0x2d637e){_0x49c48d=_0x2d637e['remoteUri'];var _0x1f4e8b=_0x49c48d[_0x9d01('0x66')](-0x1);if(_0x1f4e8b==='/'){_0x49c48d=_0x49c48d[_0x9d01('0x67')](0x0,_0x49c48d[_0x9d01('0x68')](_0x1f4e8b));}var _0x50d127={'method':'GET','uri':util[_0x9d01('0x69')](_0x9d01('0x6a'),_0x49c48d),'headers':{'Content-Type':_0x9d01('0x6b'),'Accept':_0x9d01('0x6b')},'json':!![]};if(_0x2d637e['authType']===_0x9d01('0x6c')){_0x50d127[_0x9d01('0x6d')][_0x9d01('0x6e')]=util[_0x9d01('0x69')]('Basic\x20%s',new Buffer(util[_0x9d01('0x69')](_0x9d01('0x6f'),_0x2d637e[_0x9d01('0x70')],_0x2d637e[_0x9d01('0x71')]))[_0x9d01('0x72')](_0x9d01('0x73')));}return rp(_0x50d127)[_0x9d01('0x21')](function(_0x36d275){return _0x5147ec[_0x9d01('0x74')](_[_0x9d01('0x39')](_0x36d275[_0x9d01('0x75')][_0x9d01('0x76')],function(_0x3d0caf){return{'id':_0x3d0caf[_0x9d01('0x36')],'name':_0x3d0caf[_0x9d01('0x36')],'type':_0x3d0caf['type'],'active':_0x3d0caf['active'],'label':_0x3d0caf[_0x9d01('0x77')],'custom':!![]};}));});}})[_0x9d01('0x21')](function(_0x42644d){return{'count':_0x42644d[_0x9d01('0x45')],'rows':_0x42644d};})[_0x9d01('0x21')](respondWithResult(_0xa67817,null))[_0x9d01('0x2b')](function(_0x477b85){var _0x4d9287=_0x3b1656[_0x9d01('0x3f')][_0x9d01('0x1d')]?0x1f4:_0x477b85[_0x9d01('0x78')]||0x1f4;logger[_0x9d01('0x27')](_0x9d01('0x79'),'getFields',_0x4d9287,JSON[_0x9d01('0x26')](_0x477b85));delete _0x477b85['name'];if(_0x4d9287===0x191){_0x4d9287=0x190;}_0xa67817['status'](_0x4d9287)[_0x9d01('0x37')](_0x3b1656[_0x9d01('0x3f')]['test']?{'message':_0x9d01('0x7a'),'statusCode':_0x477b85[_0x9d01('0x78')]}:_0x477b85);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 4d39947..6048071 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 _0xb682=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','exports','define','DeskAccount','int_desk_accounts'];(function(_0x4d7116,_0xdb8175){var _0x4593dc=function(_0x51d44e){while(--_0x51d44e){_0x4d7116['push'](_0x4d7116['shift']());}};_0x4593dc(++_0xdb8175);}(_0xb682,0x11d));var _0x2b68=function(_0x5532e1,_0x388cd1){_0x5532e1=_0x5532e1-0x0;var _0x276bb5=_0xb682[_0x5532e1];return _0x276bb5;};'use strict';var _=require(_0x2b68('0x0'));var util=require(_0x2b68('0x1'));var logger=require(_0x2b68('0x2'))('api');var moment=require(_0x2b68('0x3'));var BPromise=require(_0x2b68('0x4'));var rp=require(_0x2b68('0x5'));var fs=require('fs');var path=require(_0x2b68('0x6'));var rimraf=require(_0x2b68('0x7'));var config=require(_0x2b68('0x8'));var attributes=require(_0x2b68('0x9'));var integrations=require(_0x2b68('0xa'));module[_0x2b68('0xb')]=function(_0x5e7d2e,_0x501079){return _0x5e7d2e[_0x2b68('0xc')](_0x2b68('0xd'),attributes,{'tableName':_0x2b68('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x52e1=['exports','DeskAccount','int_desk_accounts','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x52e1,0x13b));var _0x152e=function(_0x3e2e99,_0xad339){_0x3e2e99=_0x3e2e99-0x0;var _0x52ceef=_0x52e1[_0x3e2e99];return _0x52ceef;};'use strict';var _=require('lodash');var util=require(_0x152e('0x0'));var logger=require(_0x152e('0x1'))(_0x152e('0x2'));var moment=require('moment');var BPromise=require(_0x152e('0x3'));var rp=require(_0x152e('0x4'));var fs=require('fs');var path=require(_0x152e('0x5'));var rimraf=require(_0x152e('0x6'));var config=require(_0x152e('0x7'));var attributes=require(_0x152e('0x8'));var integrations=require(_0x152e('0x9'));module[_0x152e('0xa')]=function(_0x22ba43,_0x5c8df8){return _0x22ba43['define'](_0x152e('0xb'),attributes,{'tableName':_0x152e('0xc'),'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 fff7cdc..13333bf 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 _0x5db1=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','DeskAccount,\x20%s,\x20%s','DeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','DeskAccount','findAll','options','raw','where','attributes','limit','include','map','model','GetDeskAccount','ShowDeskAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x27c24e,_0x5db1c7){var _0x39004a=function(_0x44286d){while(--_0x44286d){_0x27c24e['push'](_0x27c24e['shift']());}};_0x39004a(++_0x5db1c7);}(_0x5db1,0x90));var _0x15db=function(_0x408e6b,_0x165500){_0x408e6b=_0x408e6b-0x0;var _0x2f1a14=_0x5db1[_0x408e6b];return _0x2f1a14;};'use strict';var _=require(_0x15db('0x0'));var util=require(_0x15db('0x1'));var moment=require(_0x15db('0x2'));var BPromise=require(_0x15db('0x3'));var rs=require(_0x15db('0x4'));var fs=require('fs');var Redis=require(_0x15db('0x5'));var db=require(_0x15db('0x6'))['db'];var utils=require(_0x15db('0x7'));var logger=require(_0x15db('0x8'))(_0x15db('0x9'));var config=require(_0x15db('0xa'));var jayson=require(_0x15db('0xb'));var client=jayson[_0x15db('0xc')][_0x15db('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x14e485,_0x1ecb90,_0x20f4cd){return new BPromise(function(_0x3bdafc,_0x3ebab6){return client[_0x15db('0xe')](_0x14e485,_0x20f4cd)[_0x15db('0xf')](function(_0x473dff){logger[_0x15db('0x10')](_0x15db('0x11'),_0x1ecb90,'request\x20sent');logger['debug'](_0x15db('0x12'),_0x1ecb90,_0x15db('0x13'),JSON[_0x15db('0x14')](_0x473dff));if(_0x473dff['error']){if(_0x473dff[_0x15db('0x15')][_0x15db('0x16')]===0x1f4){logger[_0x15db('0x15')](_0x15db('0x11'),_0x1ecb90,_0x473dff[_0x15db('0x15')][_0x15db('0x17')]);return _0x3ebab6(_0x473dff['error']['message']);}logger[_0x15db('0x15')](_0x15db('0x11'),_0x1ecb90,_0x473dff['error'][_0x15db('0x17')]);return _0x3bdafc(_0x473dff[_0x15db('0x15')][_0x15db('0x17')]);}else{logger[_0x15db('0x10')](_0x15db('0x11'),_0x1ecb90,_0x15db('0x13'));_0x3bdafc(_0x473dff[_0x15db('0x18')][_0x15db('0x17')]);}})[_0x15db('0x19')](function(_0x43400c){logger[_0x15db('0x15')](_0x15db('0x11'),_0x1ecb90,_0x43400c);_0x3ebab6(_0x43400c);});});}exports['GetDeskAccount']=function(_0x2b2c19){var _0x691783=this;return new Promise(function(_0x1cf8e7,_0x36628f){return db[_0x15db('0x1a')][_0x15db('0x1b')]({'raw':_0x2b2c19[_0x15db('0x1c')]?_0x2b2c19['options'][_0x15db('0x1d')]===undefined?!![]:![]:!![],'where':_0x2b2c19[_0x15db('0x1c')]?_0x2b2c19[_0x15db('0x1c')][_0x15db('0x1e')]||null:null,'attributes':_0x2b2c19[_0x15db('0x1c')]?_0x2b2c19[_0x15db('0x1c')][_0x15db('0x1f')]||null:null,'limit':_0x2b2c19[_0x15db('0x1c')]?_0x2b2c19[_0x15db('0x1c')][_0x15db('0x20')]||null:null,'include':_0x2b2c19[_0x15db('0x1c')]?_0x2b2c19['options'][_0x15db('0x21')]?_[_0x15db('0x22')](_0x2b2c19[_0x15db('0x1c')]['include'],function(_0x45f8b3){return{'model':db[_0x45f8b3['model']],'as':_0x45f8b3['as'],'attributes':_0x45f8b3[_0x15db('0x1f')],'include':_0x45f8b3[_0x15db('0x21')]?_['map'](_0x45f8b3['include'],function(_0xf175fa){return{'model':db[_0xf175fa['model']],'as':_0xf175fa['as'],'attributes':_0xf175fa[_0x15db('0x1f')],'include':_0xf175fa['include']?_[_0x15db('0x22')](_0xf175fa[_0x15db('0x21')],function(_0x5395bf){return{'model':db[_0x5395bf[_0x15db('0x23')]],'as':_0x5395bf['as'],'attributes':_0x5395bf[_0x15db('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x15db('0xf')](function(_0x7c9a46){logger[_0x15db('0x10')](_0x15db('0x24'),_0x2b2c19);logger['debug'](_0x15db('0x24'),_0x2b2c19,JSON[_0x15db('0x14')](_0x7c9a46));_0x1cf8e7(_0x7c9a46);})['catch'](function(_0x435e05){logger[_0x15db('0x15')](_0x15db('0x24'),_0x435e05[_0x15db('0x17')],_0x2b2c19);_0x36628f(_0x691783[_0x15db('0x15')](0x1f4,_0x435e05[_0x15db('0x17')]));});});};exports[_0x15db('0x25')]=function(_0x5b6a08){var _0x2b080c=this;return new Promise(function(_0x435829,_0x983eef){return db[_0x15db('0x1a')]['find']({'raw':_0x5b6a08[_0x15db('0x1c')]?_0x5b6a08['options'][_0x15db('0x1d')]===undefined?!![]:![]:!![],'where':_0x5b6a08[_0x15db('0x1c')]?_0x5b6a08[_0x15db('0x1c')][_0x15db('0x1e')]||null:null,'attributes':_0x5b6a08['options']?_0x5b6a08[_0x15db('0x1c')][_0x15db('0x1f')]||null:null,'include':_0x5b6a08[_0x15db('0x1c')]?_0x5b6a08[_0x15db('0x1c')][_0x15db('0x21')]?_[_0x15db('0x22')](_0x5b6a08[_0x15db('0x1c')][_0x15db('0x21')],function(_0x2b9629){return{'model':db[_0x2b9629['model']],'as':_0x2b9629['as'],'attributes':_0x2b9629[_0x15db('0x1f')],'include':_0x2b9629[_0x15db('0x21')]?_[_0x15db('0x22')](_0x2b9629['include'],function(_0x5502b5){return{'model':db[_0x5502b5[_0x15db('0x23')]],'as':_0x5502b5['as'],'attributes':_0x5502b5['attributes'],'include':_0x5502b5[_0x15db('0x21')]?_[_0x15db('0x22')](_0x5502b5[_0x15db('0x21')],function(_0x1ad9d2){return{'model':db[_0x1ad9d2[_0x15db('0x23')]],'as':_0x1ad9d2['as'],'attributes':_0x1ad9d2['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2517ae){logger[_0x15db('0x10')](_0x15db('0x25'),_0x5b6a08);logger['debug'](_0x15db('0x25'),_0x5b6a08,JSON[_0x15db('0x14')](_0x2517ae));_0x435829(_0x2517ae);})['catch'](function(_0x2309e1){logger[_0x15db('0x15')]('ShowDeskAccount',_0x2309e1[_0x15db('0x17')],_0x5b6a08);_0x983eef(_0x2b080c['error'](0x1f4,_0x2309e1['message']));});});}; \ No newline at end of file +var _0x6d84=['DeskAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','DeskAccount','options','raw','where','attributes','limit','include','map','model','GetDeskAccount','debug','ShowDeskAccount','find','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x5853b0,_0x124b7d){var _0x2843ab=function(_0x49a335){while(--_0x49a335){_0x5853b0['push'](_0x5853b0['shift']());}};_0x2843ab(++_0x124b7d);}(_0x6d84,0x1dc));var _0x46d8=function(_0x55787d,_0x210991){_0x55787d=_0x55787d-0x0;var _0xfd2b98=_0x6d84[_0x55787d];return _0xfd2b98;};'use strict';var _=require(_0x46d8('0x0'));var util=require(_0x46d8('0x1'));var moment=require(_0x46d8('0x2'));var BPromise=require(_0x46d8('0x3'));var rs=require(_0x46d8('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x46d8('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x46d8('0x6'))('rpc');var config=require(_0x46d8('0x7'));var jayson=require(_0x46d8('0x8'));var client=jayson[_0x46d8('0x9')][_0x46d8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x6b2e2f,_0x15f5e5,_0x57b254){return new BPromise(function(_0x5945cd,_0x44d7ca){return client[_0x46d8('0xb')](_0x6b2e2f,_0x57b254)[_0x46d8('0xc')](function(_0x32712f){logger[_0x46d8('0xd')](_0x46d8('0xe'),_0x15f5e5,_0x46d8('0xf'));logger['debug']('DeskAccount,\x20%s,\x20%s,\x20%s',_0x15f5e5,_0x46d8('0xf'),JSON[_0x46d8('0x10')](_0x32712f));if(_0x32712f['error']){if(_0x32712f[_0x46d8('0x11')][_0x46d8('0x12')]===0x1f4){logger[_0x46d8('0x11')](_0x46d8('0xe'),_0x15f5e5,_0x32712f[_0x46d8('0x11')]['message']);return _0x44d7ca(_0x32712f['error'][_0x46d8('0x13')]);}logger[_0x46d8('0x11')]('DeskAccount,\x20%s,\x20%s',_0x15f5e5,_0x32712f['error'][_0x46d8('0x13')]);return _0x5945cd(_0x32712f[_0x46d8('0x11')][_0x46d8('0x13')]);}else{logger[_0x46d8('0xd')](_0x46d8('0xe'),_0x15f5e5,_0x46d8('0xf'));_0x5945cd(_0x32712f[_0x46d8('0x14')][_0x46d8('0x13')]);}})[_0x46d8('0x15')](function(_0x1ffbef){logger[_0x46d8('0x11')]('DeskAccount,\x20%s,\x20%s',_0x15f5e5,_0x1ffbef);_0x44d7ca(_0x1ffbef);});});}exports['GetDeskAccount']=function(_0x5f641){var _0x5626b6=this;return new Promise(function(_0x2a9c60,_0x362b62){return db[_0x46d8('0x16')]['findAll']({'raw':_0x5f641['options']?_0x5f641[_0x46d8('0x17')][_0x46d8('0x18')]===undefined?!![]:![]:!![],'where':_0x5f641['options']?_0x5f641[_0x46d8('0x17')][_0x46d8('0x19')]||null:null,'attributes':_0x5f641[_0x46d8('0x17')]?_0x5f641[_0x46d8('0x17')][_0x46d8('0x1a')]||null:null,'limit':_0x5f641[_0x46d8('0x17')]?_0x5f641[_0x46d8('0x17')][_0x46d8('0x1b')]||null:null,'include':_0x5f641['options']?_0x5f641['options'][_0x46d8('0x1c')]?_[_0x46d8('0x1d')](_0x5f641[_0x46d8('0x17')][_0x46d8('0x1c')],function(_0x2e02bf){return{'model':db[_0x2e02bf[_0x46d8('0x1e')]],'as':_0x2e02bf['as'],'attributes':_0x2e02bf[_0x46d8('0x1a')],'include':_0x2e02bf[_0x46d8('0x1c')]?_['map'](_0x2e02bf[_0x46d8('0x1c')],function(_0x5af6a1){return{'model':db[_0x5af6a1['model']],'as':_0x5af6a1['as'],'attributes':_0x5af6a1['attributes'],'include':_0x5af6a1[_0x46d8('0x1c')]?_[_0x46d8('0x1d')](_0x5af6a1['include'],function(_0x291db5){return{'model':db[_0x291db5[_0x46d8('0x1e')]],'as':_0x291db5['as'],'attributes':_0x291db5[_0x46d8('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x496194){logger['info'](_0x46d8('0x1f'),_0x5f641);logger[_0x46d8('0x20')](_0x46d8('0x1f'),_0x5f641,JSON['stringify'](_0x496194));_0x2a9c60(_0x496194);})['catch'](function(_0x29e6b9){logger[_0x46d8('0x11')](_0x46d8('0x1f'),_0x29e6b9[_0x46d8('0x13')],_0x5f641);_0x362b62(_0x5626b6[_0x46d8('0x11')](0x1f4,_0x29e6b9['message']));});});};exports[_0x46d8('0x21')]=function(_0xfef810){var _0x88e91a=this;return new Promise(function(_0x58f39c,_0x122ffc){return db['DeskAccount'][_0x46d8('0x22')]({'raw':_0xfef810[_0x46d8('0x17')]?_0xfef810[_0x46d8('0x17')][_0x46d8('0x18')]===undefined?!![]:![]:!![],'where':_0xfef810[_0x46d8('0x17')]?_0xfef810[_0x46d8('0x17')][_0x46d8('0x19')]||null:null,'attributes':_0xfef810[_0x46d8('0x17')]?_0xfef810[_0x46d8('0x17')][_0x46d8('0x1a')]||null:null,'include':_0xfef810[_0x46d8('0x17')]?_0xfef810[_0x46d8('0x17')]['include']?_['map'](_0xfef810['options']['include'],function(_0x45e3f0){return{'model':db[_0x45e3f0[_0x46d8('0x1e')]],'as':_0x45e3f0['as'],'attributes':_0x45e3f0[_0x46d8('0x1a')],'include':_0x45e3f0[_0x46d8('0x1c')]?_[_0x46d8('0x1d')](_0x45e3f0[_0x46d8('0x1c')],function(_0x3a1e8a){return{'model':db[_0x3a1e8a[_0x46d8('0x1e')]],'as':_0x3a1e8a['as'],'attributes':_0x3a1e8a[_0x46d8('0x1a')],'include':_0x3a1e8a['include']?_[_0x46d8('0x1d')](_0x3a1e8a[_0x46d8('0x1c')],function(_0x5b78f5){return{'model':db[_0x5b78f5[_0x46d8('0x1e')]],'as':_0x5b78f5['as'],'attributes':_0x5b78f5[_0x46d8('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x232a1d){logger['info'](_0x46d8('0x21'),_0xfef810);logger[_0x46d8('0x20')](_0x46d8('0x21'),_0xfef810,JSON[_0x46d8('0x10')](_0x232a1d));_0x58f39c(_0x232a1d);})['catch'](function(_0x19cfd1){logger['error'](_0x46d8('0x21'),_0x19cfd1[_0x46d8('0x13')],_0xfef810);_0x122ffc(_0x88e91a[_0x46d8('0x11')](0x1f4,_0x19cfd1['message']));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 5493ea6..d25b9b0 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 _0x4253=['../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','show','getFields','/:id/subjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','create','post','setTags','put','delete','/:id','destroy','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x386746,_0x372192){var _0x122328=function(_0x5fcdc3){while(--_0x5fcdc3){_0x386746['push'](_0x386746['shift']());}};_0x122328(++_0x372192);}(_0x4253,0x14c));var _0x3425=function(_0x4610a3,_0x47d045){_0x4610a3=_0x4610a3-0x0;var _0x7c38ee=_0x4253[_0x4610a3];return _0x7c38ee;};'use strict';var multer=require(_0x3425('0x0'));var util=require(_0x3425('0x1'));var path=require('path');var timeout=require(_0x3425('0x2'));var express=require('express');var router=express[_0x3425('0x3')]();var auth=require(_0x3425('0x4'));var interaction=require(_0x3425('0x5'));var config=require(_0x3425('0x6'));var controller=require(_0x3425('0x7'));router[_0x3425('0x8')]('/',auth[_0x3425('0x9')](),controller[_0x3425('0xa')]);router[_0x3425('0x8')]('/:id',auth[_0x3425('0x9')](),controller[_0x3425('0xb')]);router[_0x3425('0x8')]('/:id/fields',auth[_0x3425('0x9')](),controller[_0x3425('0xc')]);router['get'](_0x3425('0xd'),auth['isAuthenticated'](),controller['getSubjects']);router['get'](_0x3425('0xe'),auth[_0x3425('0x9')](),controller[_0x3425('0xf')]);router['get'](_0x3425('0x10'),auth[_0x3425('0x9')](),controller[_0x3425('0x11')]);router['post']('/',auth[_0x3425('0x9')](),controller[_0x3425('0x12')]);router[_0x3425('0x13')](_0x3425('0x10'),auth[_0x3425('0x9')](),controller[_0x3425('0x14')]);router[_0x3425('0x15')]('/:id',auth[_0x3425('0x9')](),controller['update']);router[_0x3425('0x16')](_0x3425('0x17'),auth['isAuthenticated'](),controller[_0x3425('0x18')]);module[_0x3425('0x19')]=router; \ No newline at end of file +var _0xcaef=['exports','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./intDeskConfiguration.controller','isAuthenticated','index','/:id','get','/:id/fields','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','create','post','setTags','put','update','destroy'];(function(_0x4bedce,_0x265ebf){var _0x4fd2fb=function(_0x14122b){while(--_0x14122b){_0x4bedce['push'](_0x4bedce['shift']());}};_0x4fd2fb(++_0x265ebf);}(_0xcaef,0x1c9));var _0xfcae=function(_0xc8a931,_0x260690){_0xc8a931=_0xc8a931-0x0;var _0x28bd27=_0xcaef[_0xc8a931];return _0x28bd27;};'use strict';var multer=require('multer');var util=require(_0xfcae('0x0'));var path=require(_0xfcae('0x1'));var timeout=require(_0xfcae('0x2'));var express=require(_0xfcae('0x3'));var router=express['Router']();var auth=require(_0xfcae('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xfcae('0x5'));var controller=require(_0xfcae('0x6'));router['get']('/',auth[_0xfcae('0x7')](),controller[_0xfcae('0x8')]);router['get'](_0xfcae('0x9'),auth['isAuthenticated'](),controller['show']);router[_0xfcae('0xa')](_0xfcae('0xb'),auth[_0xfcae('0x7')](),controller['getFields']);router[_0xfcae('0xa')]('/:id/subjects',auth['isAuthenticated'](),controller[_0xfcae('0xc')]);router[_0xfcae('0xa')](_0xfcae('0xd'),auth[_0xfcae('0x7')](),controller[_0xfcae('0xe')]);router[_0xfcae('0xa')](_0xfcae('0xf'),auth[_0xfcae('0x7')](),controller[_0xfcae('0x10')]);router['post']('/',auth[_0xfcae('0x7')](),controller[_0xfcae('0x11')]);router[_0xfcae('0x12')](_0xfcae('0xf'),auth[_0xfcae('0x7')](),controller[_0xfcae('0x13')]);router[_0xfcae('0x14')](_0xfcae('0x9'),auth['isAuthenticated'](),controller[_0xfcae('0x15')]);router['delete'](_0xfcae('0x9'),auth[_0xfcae('0x7')](),controller[_0xfcae('0x16')]);module[_0xfcae('0x17')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index 1b30344..62fcf42 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 _0x6fee=['sequelize','exports','STRING'];(function(_0x2485f1,_0x126dc4){var _0x3fc3e3=function(_0x26ac45){while(--_0x26ac45){_0x2485f1['push'](_0x2485f1['shift']());}};_0x3fc3e3(++_0x126dc4);}(_0x6fee,0x147));var _0xe6fe=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6fee[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xe6fe('0x0'));module[_0xe6fe('0x1')]={'name':{'type':Sequelize[_0xe6fe('0x2')]},'description':{'type':Sequelize[_0xe6fe('0x2')]}}; \ No newline at end of file +var _0x3ffd=['exports','STRING','sequelize'];(function(_0x58feed,_0xa1f308){var _0x31292e=function(_0x37fbb2){while(--_0x37fbb2){_0x58feed['push'](_0x58feed['shift']());}};_0x31292e(++_0xa1f308);}(_0x3ffd,0x6b));var _0xd3ff=function(_0x3239f5,_0x50e77c){_0x3239f5=_0x3239f5-0x0;var _0x3559c8=_0x3ffd[_0x3239f5];return _0x3559c8;};'use strict';var Sequelize=require(_0xd3ff('0x0'));module[_0xd3ff('0x1')]={'name':{'type':Sequelize[_0xd3ff('0x2')]},'description':{'type':Sequelize[_0xd3ff('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 1e33c34..ed3aa89 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 _0x04d0=['getDescriptions','findOne','getTags','Tag','setTags','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','sox','to-csv','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../mysqldb','client','http','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~!@#$%^&-_=+[{]}.','then','info','request\x20sent','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','DeskConfiguration,\x20%s,\x20%s','result','catch','sendStatus','status','end','offset','limit','set','Content-Range','apply','update','destroy','stack','name','send','map','DeskConfiguration','type','key','model','query','keys','filters','attributes','intersection','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','rows','params','fields','length','find','create','body','getFields','rawAttributes','hasOwnProperty','getSubjects','DeskField','nolimit'];(function(_0x41d2d4,_0x12bcf4){var _0x225e0f=function(_0x8464f5){while(--_0x8464f5){_0x41d2d4['push'](_0x41d2d4['shift']());}};_0x225e0f(++_0x12bcf4);}(_0x04d0,0x10a));var _0x004d=function(_0x1c2ffa,_0x4ab74c){_0x1c2ffa=_0x1c2ffa-0x0;var _0x2e568c=_0x04d0[_0x1c2ffa];return _0x2e568c;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x004d('0x0'));var zipdir=require(_0x004d('0x1'));var jsonpatch=require(_0x004d('0x2'));var rp=require(_0x004d('0x3'));var moment=require(_0x004d('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x004d('0x5'));var path=require('path');var sox=require(_0x004d('0x6'));var csv=require(_0x004d('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x004d('0x8'));var squel=require(_0x004d('0x9'));var crypto=require('crypto');var jsforce=require(_0x004d('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x004d('0x7'));var querystring=require(_0x004d('0xb'));var Papa=require(_0x004d('0xc'));var Redis=require('ioredis');var authService=require(_0x004d('0xd'));var qs=require(_0x004d('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x004d('0xf'));var logger=require('../../config/logger')(_0x004d('0x10'));var utils=require(_0x004d('0x11'));var config=require('../../config/environment');var db=require(_0x004d('0x12'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x004d('0x13')][_0x004d('0x14')]({'port':0x232a});function checkPasswordPattern(_0x3ec7fb,_0xe201bb,_0x20308e){if(_0x20308e){var _0x25417a=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x25417a[_0x004d('0x15')](_0xe201bb)){return _0x3ec7fb;}else{throw new db[(_0x004d('0x16'))]['ValidationError'](_0x004d('0x17'));}}else{return _0x3ec7fb;}}function respondWithRpcPromise(_0x3bd18c,_0x22d22d,_0x1822f5,_0x43f5fb){return new BPromise(function(_0x402969,_0x1904a6){var _0x365c20=_0x43f5fb||client;return _0x365c20['request'](_0x3bd18c,_0x1822f5)[_0x004d('0x18')](function(_0x1f3482){logger[_0x004d('0x19')]('DeskConfiguration,\x20%s,\x20%s',_0x22d22d,_0x004d('0x1a'));logger['debug'](_0x004d('0x1b'),_0x22d22d,_0x004d('0x1a'),JSON[_0x004d('0x1c')](_0x1f3482));if(_0x1f3482[_0x004d('0x1d')]){if(_0x1f3482['error'][_0x004d('0x1e')]===0x1f4){logger[_0x004d('0x1d')]('DeskConfiguration,\x20%s,\x20%s',_0x22d22d,_0x1f3482[_0x004d('0x1d')][_0x004d('0x1f')]);return _0x1904a6(_0x1f3482[_0x004d('0x1d')][_0x004d('0x1f')]);}logger['error'](_0x004d('0x20'),_0x22d22d,_0x1f3482[_0x004d('0x1d')][_0x004d('0x1f')]);return _0x402969(_0x1f3482[_0x004d('0x1d')][_0x004d('0x1f')]);}else{logger[_0x004d('0x19')](_0x004d('0x20'),_0x22d22d,_0x004d('0x1a'));_0x402969(_0x1f3482[_0x004d('0x21')][_0x004d('0x1f')]);}})[_0x004d('0x22')](function(_0x83a2f0){logger['error']('DeskConfiguration,\x20%s,\x20%s',_0x22d22d,_0x83a2f0);_0x1904a6(_0x83a2f0);});});}function respondWithStatusCode(_0x1263d8,_0xb07ff9){_0xb07ff9=_0xb07ff9||0xcc;return function(_0x4a4fe1){if(_0x4a4fe1){return _0x1263d8[_0x004d('0x23')](_0xb07ff9);}return _0x1263d8[_0x004d('0x24')](_0xb07ff9)[_0x004d('0x25')]();};}function respondWithResult(_0xd13fff,_0x225527){_0x225527=_0x225527||0xc8;return function(_0x1ccb0e){if(_0x1ccb0e){return _0xd13fff[_0x004d('0x24')](_0x225527)['json'](_0x1ccb0e);}};}function respondWithFilteredResult(_0x2e6ab1,_0x5c55a3){return function(_0x5b3c9a){if(_0x5b3c9a){var _0x2e7763=_0x5b3c9a['count'],_0x38518d=_0x5c55a3[_0x004d('0x26')],_0xe17b2d=_0x5c55a3[_0x004d('0x26')]+_0x5c55a3[_0x004d('0x27')],_0x1e13b1;if(_0xe17b2d>=_0x2e7763){_0xe17b2d=_0x2e7763;_0x1e13b1=0xc8;}else{_0x1e13b1=0xce;}_0x2e6ab1[_0x004d('0x24')](_0x1e13b1);return _0x2e6ab1[_0x004d('0x28')](_0x004d('0x29'),_0x38518d+'-'+_0xe17b2d+'/'+_0x2e7763)['json'](_0x5b3c9a);}return null;};}function patchUpdates(_0x88920b){return function(_0x268606){try{jsonpatch[_0x004d('0x2a')](_0x268606,_0x88920b,!![]);}catch(_0x188248){return BPromise['reject'](_0x188248);}return _0x268606['save']();};}function saveUpdates(_0x457385,_0x4d06d8){return function(_0x3aa5f3){if(_0x3aa5f3){return _0x3aa5f3[_0x004d('0x2b')](_0x457385)[_0x004d('0x18')](function(_0x15b0c1){return _0x15b0c1;});}return null;};}function removeEntity(_0x9d5260,_0x1ce8b4){return function(_0x357b34){if(_0x357b34){return _0x357b34[_0x004d('0x2c')]()[_0x004d('0x18')](function(){_0x9d5260[_0x004d('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x31c9c9,_0x1dbdf7){return function(_0x59d2ea){if(!_0x59d2ea){_0x31c9c9[_0x004d('0x23')](0x194);}return _0x59d2ea;};}function handleError(_0x54b85a,_0x251baa){_0x251baa=_0x251baa||0x1f4;return function(_0x269750){logger['error'](_0x269750[_0x004d('0x2d')]);if(_0x269750[_0x004d('0x2e')]){delete _0x269750[_0x004d('0x2e')];}_0x54b85a[_0x004d('0x24')](_0x251baa)[_0x004d('0x2f')](_0x269750);};}exports['index']=function(_0x2ef5cf,_0x6467a2){var _0x164f24={},_0x1b91ab={},_0xb9e65e={'count':0x0,'rows':[]};var _0x36ff48=_[_0x004d('0x30')](db[_0x004d('0x31')]['rawAttributes'],function(_0xd97acc){return{'name':_0xd97acc['fieldName'],'type':_0xd97acc[_0x004d('0x32')][_0x004d('0x33')]};});_0x1b91ab[_0x004d('0x34')]=_['map'](_0x36ff48,_0x004d('0x2e'));_0x1b91ab[_0x004d('0x35')]=_[_0x004d('0x36')](_0x2ef5cf['query']);_0x1b91ab[_0x004d('0x37')]=_['intersection'](_0x1b91ab[_0x004d('0x34')],_0x1b91ab[_0x004d('0x35')]);_0x164f24[_0x004d('0x38')]=_[_0x004d('0x39')](_0x1b91ab[_0x004d('0x34')],qs['fields'](_0x2ef5cf['query']['fields']));_0x164f24[_0x004d('0x38')]=_0x164f24['attributes']['length']?_0x164f24[_0x004d('0x38')]:_0x1b91ab['model'];if(!_0x2ef5cf[_0x004d('0x35')]['hasOwnProperty']('nolimit')){_0x164f24[_0x004d('0x27')]=qs[_0x004d('0x27')](_0x2ef5cf[_0x004d('0x35')]['limit']);_0x164f24['offset']=qs[_0x004d('0x26')](_0x2ef5cf[_0x004d('0x35')][_0x004d('0x26')]);}_0x164f24[_0x004d('0x3a')]=qs[_0x004d('0x3b')](_0x2ef5cf[_0x004d('0x35')][_0x004d('0x3b')]);_0x164f24[_0x004d('0x3c')]=qs[_0x004d('0x37')](_[_0x004d('0x3d')](_0x2ef5cf['query'],_0x1b91ab[_0x004d('0x37')]),_0x36ff48);if(_0x2ef5cf[_0x004d('0x35')][_0x004d('0x3e')]){_0x164f24[_0x004d('0x3c')]=_[_0x004d('0x3f')](_0x164f24[_0x004d('0x3c')],{'$or':_['map'](_0x36ff48,function(_0xe3c206){if(_0xe3c206[_0x004d('0x32')]!==_0x004d('0x40')){var _0xf0aed={};_0xf0aed[_0xe3c206[_0x004d('0x2e')]]={'$like':'%'+_0x2ef5cf['query'][_0x004d('0x3e')]+'%'};return _0xf0aed;}})});}_0x164f24=_[_0x004d('0x3f')]({},_0x164f24,_0x2ef5cf[_0x004d('0x41')]);var _0x4d1a4a={'where':_0x164f24[_0x004d('0x3c')]};return db[_0x004d('0x31')][_0x004d('0x42')](_0x4d1a4a)[_0x004d('0x18')](function(_0x5b61af){_0xb9e65e['count']=_0x5b61af;if(_0x2ef5cf[_0x004d('0x35')][_0x004d('0x43')]){_0x164f24[_0x004d('0x44')]=[{'all':!![]}];}return db[_0x004d('0x31')]['findAll'](_0x164f24);})[_0x004d('0x18')](function(_0x432af3){_0xb9e65e[_0x004d('0x45')]=_0x432af3;return _0xb9e65e;})[_0x004d('0x18')](respondWithFilteredResult(_0x6467a2,_0x164f24))['catch'](handleError(_0x6467a2,null));};exports['show']=function(_0x25ecb0,_0x21fc27){var _0x4cb5fa={'raw':![],'where':{'id':_0x25ecb0[_0x004d('0x46')]['id']}},_0x48eb46={};_0x48eb46[_0x004d('0x34')]=_['keys'](db['DeskConfiguration']['rawAttributes']);_0x48eb46[_0x004d('0x35')]=_['keys'](_0x25ecb0[_0x004d('0x35')]);_0x48eb46[_0x004d('0x37')]=_['intersection'](_0x48eb46[_0x004d('0x34')],_0x48eb46['query']);_0x4cb5fa[_0x004d('0x38')]=_['intersection'](_0x48eb46[_0x004d('0x34')],qs[_0x004d('0x47')](_0x25ecb0[_0x004d('0x35')]['fields']));_0x4cb5fa['attributes']=_0x4cb5fa[_0x004d('0x38')][_0x004d('0x48')]?_0x4cb5fa['attributes']:_0x48eb46[_0x004d('0x34')];if(_0x25ecb0['query'][_0x004d('0x43')]){_0x4cb5fa[_0x004d('0x44')]=[{'all':!![]}];}_0x4cb5fa=_['merge']({},_0x4cb5fa,_0x25ecb0[_0x004d('0x41')]);return db[_0x004d('0x31')][_0x004d('0x49')](_0x4cb5fa)[_0x004d('0x18')](handleEntityNotFound(_0x21fc27,null))['then'](respondWithResult(_0x21fc27,null))[_0x004d('0x22')](handleError(_0x21fc27,null));};exports[_0x004d('0x4a')]=function(_0x2d5b2d,_0x4d3969){return db[_0x004d('0x31')][_0x004d('0x4a')](_0x2d5b2d[_0x004d('0x4b')],{})[_0x004d('0x18')](respondWithResult(_0x4d3969,0xc9))[_0x004d('0x22')](handleError(_0x4d3969,null));};exports[_0x004d('0x2b')]=function(_0x3bd8c1,_0x2b7a72){if(_0x3bd8c1['body']['id']){delete _0x3bd8c1[_0x004d('0x4b')]['id'];}return db[_0x004d('0x31')][_0x004d('0x49')]({'where':{'id':_0x3bd8c1[_0x004d('0x46')]['id']}})[_0x004d('0x18')](handleEntityNotFound(_0x2b7a72,null))['then'](saveUpdates(_0x3bd8c1[_0x004d('0x4b')],null))['then'](respondWithResult(_0x2b7a72,null))['catch'](handleError(_0x2b7a72,null));};exports[_0x004d('0x2c')]=function(_0x1355d7,_0x3e200b){return db[_0x004d('0x31')][_0x004d('0x49')]({'where':{'id':_0x1355d7[_0x004d('0x46')]['id']}})['then'](handleEntityNotFound(_0x3e200b,null))['then'](removeEntity(_0x3e200b,null))[_0x004d('0x22')](handleError(_0x3e200b,null));};exports[_0x004d('0x4c')]=function(_0x4d5869,_0x296100,_0x3f6591){var _0x264977={};var _0xfe703f={};var _0x22c0d8;var _0x3d95c4;return db[_0x004d('0x31')]['findOne']({'where':{'id':_0x4d5869[_0x004d('0x46')]['id']}})['then'](handleEntityNotFound(_0x296100,null))[_0x004d('0x18')](function(_0x568710){if(_0x568710){_0x22c0d8=_0x568710;_0xfe703f['model']=_[_0x004d('0x36')](db['DeskField'][_0x004d('0x4d')]);_0xfe703f[_0x004d('0x35')]=_[_0x004d('0x36')](_0x4d5869[_0x004d('0x35')]);_0xfe703f[_0x004d('0x37')]=_[_0x004d('0x39')](_0xfe703f[_0x004d('0x34')],_0xfe703f[_0x004d('0x35')]);_0x264977['attributes']=_[_0x004d('0x39')](_0xfe703f[_0x004d('0x34')],qs[_0x004d('0x47')](_0x4d5869['query'][_0x004d('0x47')]));_0x264977[_0x004d('0x38')]=_0x264977['attributes']['length']?_0x264977[_0x004d('0x38')]:_0xfe703f[_0x004d('0x34')];_0x264977[_0x004d('0x3a')]=qs[_0x004d('0x3b')](_0x4d5869[_0x004d('0x35')][_0x004d('0x3b')]);_0x264977[_0x004d('0x3c')]=qs[_0x004d('0x37')](_[_0x004d('0x3d')](_0x4d5869[_0x004d('0x35')],_0xfe703f[_0x004d('0x37')]));if(_0x4d5869[_0x004d('0x35')]['filter']){_0x264977[_0x004d('0x3c')]=_[_0x004d('0x3f')](_0x264977['where'],{'$or':_[_0x004d('0x30')](_0x264977[_0x004d('0x38')],function(_0x3fda2c){var _0x36d9f7={};_0x36d9f7[_0x3fda2c]={'$like':'%'+_0x4d5869[_0x004d('0x35')][_0x004d('0x3e')]+'%'};return _0x36d9f7;})});}_0x264977=_[_0x004d('0x3f')]({},_0x264977,_0x4d5869[_0x004d('0x41')]);return _0x22c0d8[_0x004d('0x4c')](_0x264977);}})['then'](function(_0x4b4470){if(_0x4b4470){_0x3d95c4=_0x4b4470[_0x004d('0x48')];if(!_0x4d5869['query'][_0x004d('0x4e')]('nolimit')){_0x264977[_0x004d('0x27')]=qs[_0x004d('0x27')](_0x4d5869['query']['limit']);_0x264977[_0x004d('0x26')]=qs[_0x004d('0x26')](_0x4d5869[_0x004d('0x35')][_0x004d('0x26')]);}return _0x22c0d8[_0x004d('0x4c')](_0x264977);}})['then'](function(_0x301a88){if(_0x301a88){return _0x301a88?{'count':_0x3d95c4,'rows':_0x301a88}:null;}})['then'](respondWithResult(_0x296100,null))[_0x004d('0x22')](handleError(_0x296100,null));};exports[_0x004d('0x4f')]=function(_0x44158a,_0x30ea57,_0x56adf6){var _0x4e6f2d={};var _0x3b12d3={};var _0x58ba51;var _0xf2fc89;return db[_0x004d('0x31')]['findOne']({'where':{'id':_0x44158a['params']['id']}})['then'](handleEntityNotFound(_0x30ea57,null))['then'](function(_0x292a0d){if(_0x292a0d){_0x58ba51=_0x292a0d;_0x3b12d3[_0x004d('0x34')]=_['keys'](db[_0x004d('0x50')]['rawAttributes']);_0x3b12d3['query']=_[_0x004d('0x36')](_0x44158a[_0x004d('0x35')]);_0x3b12d3[_0x004d('0x37')]=_['intersection'](_0x3b12d3[_0x004d('0x34')],_0x3b12d3[_0x004d('0x35')]);_0x4e6f2d['attributes']=_[_0x004d('0x39')](_0x3b12d3[_0x004d('0x34')],qs[_0x004d('0x47')](_0x44158a[_0x004d('0x35')][_0x004d('0x47')]));_0x4e6f2d[_0x004d('0x38')]=_0x4e6f2d[_0x004d('0x38')]['length']?_0x4e6f2d[_0x004d('0x38')]:_0x3b12d3[_0x004d('0x34')];_0x4e6f2d[_0x004d('0x3a')]=qs[_0x004d('0x3b')](_0x44158a[_0x004d('0x35')][_0x004d('0x3b')]);_0x4e6f2d[_0x004d('0x3c')]=qs[_0x004d('0x37')](_[_0x004d('0x3d')](_0x44158a[_0x004d('0x35')],_0x3b12d3[_0x004d('0x37')]));if(_0x44158a[_0x004d('0x35')]['filter']){_0x4e6f2d[_0x004d('0x3c')]=_[_0x004d('0x3f')](_0x4e6f2d[_0x004d('0x3c')],{'$or':_[_0x004d('0x30')](_0x4e6f2d[_0x004d('0x38')],function(_0x2b8b87){var _0x530071={};_0x530071[_0x2b8b87]={'$like':'%'+_0x44158a['query'][_0x004d('0x3e')]+'%'};return _0x530071;})});}_0x4e6f2d=_[_0x004d('0x3f')]({},_0x4e6f2d,_0x44158a[_0x004d('0x41')]);return _0x58ba51[_0x004d('0x4f')](_0x4e6f2d);}})[_0x004d('0x18')](function(_0xebaa04){if(_0xebaa04){_0xf2fc89=_0xebaa04[_0x004d('0x48')];if(!_0x44158a[_0x004d('0x35')]['hasOwnProperty'](_0x004d('0x51'))){_0x4e6f2d['limit']=qs[_0x004d('0x27')](_0x44158a['query'][_0x004d('0x27')]);_0x4e6f2d[_0x004d('0x26')]=qs['offset'](_0x44158a[_0x004d('0x35')]['offset']);}return _0x58ba51[_0x004d('0x4f')](_0x4e6f2d);}})['then'](function(_0x238b04){if(_0x238b04){return _0x238b04?{'count':_0xf2fc89,'rows':_0x238b04}:null;}})[_0x004d('0x18')](respondWithResult(_0x30ea57,null))[_0x004d('0x22')](handleError(_0x30ea57,null));};exports[_0x004d('0x52')]=function(_0x294ef7,_0x5707c7,_0x608746){var _0x3b5d56={};var _0x55c8cf={};var _0x4f5cca;var _0x4a9dda;return db[_0x004d('0x31')][_0x004d('0x53')]({'where':{'id':_0x294ef7[_0x004d('0x46')]['id']}})[_0x004d('0x18')](handleEntityNotFound(_0x5707c7,null))[_0x004d('0x18')](function(_0x51ab41){if(_0x51ab41){_0x4f5cca=_0x51ab41;_0x55c8cf[_0x004d('0x34')]=_[_0x004d('0x36')](db[_0x004d('0x50')][_0x004d('0x4d')]);_0x55c8cf[_0x004d('0x35')]=_[_0x004d('0x36')](_0x294ef7[_0x004d('0x35')]);_0x55c8cf[_0x004d('0x37')]=_[_0x004d('0x39')](_0x55c8cf['model'],_0x55c8cf[_0x004d('0x35')]);_0x3b5d56[_0x004d('0x38')]=_[_0x004d('0x39')](_0x55c8cf[_0x004d('0x34')],qs[_0x004d('0x47')](_0x294ef7['query'][_0x004d('0x47')]));_0x3b5d56['attributes']=_0x3b5d56[_0x004d('0x38')][_0x004d('0x48')]?_0x3b5d56[_0x004d('0x38')]:_0x55c8cf[_0x004d('0x34')];_0x3b5d56[_0x004d('0x3a')]=qs[_0x004d('0x3b')](_0x294ef7[_0x004d('0x35')][_0x004d('0x3b')]);_0x3b5d56[_0x004d('0x3c')]=qs[_0x004d('0x37')](_[_0x004d('0x3d')](_0x294ef7[_0x004d('0x35')],_0x55c8cf[_0x004d('0x37')]));if(_0x294ef7[_0x004d('0x35')][_0x004d('0x3e')]){_0x3b5d56[_0x004d('0x3c')]=_['merge'](_0x3b5d56[_0x004d('0x3c')],{'$or':_[_0x004d('0x30')](_0x3b5d56[_0x004d('0x38')],function(_0x27c986){var _0x4ba9ab={};_0x4ba9ab[_0x27c986]={'$like':'%'+_0x294ef7[_0x004d('0x35')][_0x004d('0x3e')]+'%'};return _0x4ba9ab;})});}_0x3b5d56=_[_0x004d('0x3f')]({},_0x3b5d56,_0x294ef7['options']);return _0x4f5cca['getDescriptions'](_0x3b5d56);}})[_0x004d('0x18')](function(_0xa23337){if(_0xa23337){_0x4a9dda=_0xa23337[_0x004d('0x48')];if(!_0x294ef7[_0x004d('0x35')][_0x004d('0x4e')](_0x004d('0x51'))){_0x3b5d56[_0x004d('0x27')]=qs['limit'](_0x294ef7[_0x004d('0x35')]['limit']);_0x3b5d56[_0x004d('0x26')]=qs[_0x004d('0x26')](_0x294ef7[_0x004d('0x35')][_0x004d('0x26')]);}return _0x4f5cca[_0x004d('0x52')](_0x3b5d56);}})[_0x004d('0x18')](function(_0x3020dd){if(_0x3020dd){return _0x3020dd?{'count':_0x4a9dda,'rows':_0x3020dd}:null;}})[_0x004d('0x18')](respondWithResult(_0x5707c7,null))[_0x004d('0x22')](handleError(_0x5707c7,null));};exports[_0x004d('0x54')]=function(_0x176f84,_0x533d45,_0x1d9d2f){var _0x37a849={};var _0x1071cc={};var _0x4066e1;var _0x46b2e7;return db['DeskConfiguration']['findOne']({'where':{'id':_0x176f84[_0x004d('0x46')]['id']}})[_0x004d('0x18')](handleEntityNotFound(_0x533d45,null))['then'](function(_0x14dbb9){if(_0x14dbb9){_0x4066e1=_0x14dbb9;_0x1071cc[_0x004d('0x34')]=_[_0x004d('0x36')](db[_0x004d('0x55')][_0x004d('0x4d')]);_0x1071cc[_0x004d('0x35')]=_[_0x004d('0x36')](_0x176f84[_0x004d('0x35')]);_0x1071cc[_0x004d('0x37')]=_[_0x004d('0x39')](_0x1071cc[_0x004d('0x34')],_0x1071cc['query']);_0x37a849[_0x004d('0x38')]=_[_0x004d('0x39')](_0x1071cc[_0x004d('0x34')],qs[_0x004d('0x47')](_0x176f84['query'][_0x004d('0x47')]));_0x37a849[_0x004d('0x38')]=_0x37a849[_0x004d('0x38')][_0x004d('0x48')]?_0x37a849['attributes']:_0x1071cc[_0x004d('0x34')];_0x37a849[_0x004d('0x3a')]=qs[_0x004d('0x3b')](_0x176f84[_0x004d('0x35')][_0x004d('0x3b')]);_0x37a849[_0x004d('0x3c')]=qs[_0x004d('0x37')](_['pick'](_0x176f84[_0x004d('0x35')],_0x1071cc['filters']));if(_0x176f84[_0x004d('0x35')][_0x004d('0x3e')]){_0x37a849['where']=_[_0x004d('0x3f')](_0x37a849[_0x004d('0x3c')],{'$or':_[_0x004d('0x30')](_0x37a849[_0x004d('0x38')],function(_0xb10fa1){var _0x543253={};_0x543253[_0xb10fa1]={'$like':'%'+_0x176f84['query']['filter']+'%'};return _0x543253;})});}_0x37a849=_[_0x004d('0x3f')]({},_0x37a849,_0x176f84[_0x004d('0x41')]);return _0x4066e1[_0x004d('0x54')](_0x37a849);}})[_0x004d('0x18')](function(_0x34c6df){if(_0x34c6df){_0x46b2e7=_0x34c6df['length'];if(!_0x176f84['query'][_0x004d('0x4e')]('nolimit')){_0x37a849[_0x004d('0x27')]=qs[_0x004d('0x27')](_0x176f84[_0x004d('0x35')]['limit']);_0x37a849[_0x004d('0x26')]=qs['offset'](_0x176f84[_0x004d('0x35')][_0x004d('0x26')]);}return _0x4066e1[_0x004d('0x54')](_0x37a849);}})[_0x004d('0x18')](function(_0x35477a){if(_0x35477a){return _0x35477a?{'count':_0x46b2e7,'rows':_0x35477a}:null;}})[_0x004d('0x18')](respondWithResult(_0x533d45,null))['catch'](handleError(_0x533d45,null));};exports[_0x004d('0x56')]=function(_0x4a236d,_0x5b19af,_0x412179){if(_0x4a236d[_0x004d('0x4b')]['id']){delete _0x4a236d[_0x004d('0x4b')]['id'];}return db['DeskConfiguration'][_0x004d('0x53')]({'where':{'id':_0x4a236d['params']['id']}})[_0x004d('0x18')](handleEntityNotFound(_0x5b19af,null))[_0x004d('0x18')](function(_0x229976){if(_0x229976){return _0x229976[_0x004d('0x56')](_0x4a236d[_0x004d('0x4b')]['ids']||[]);}return null;})[_0x004d('0x18')](respondWithResult(_0x5b19af,null))[_0x004d('0x22')](handleError(_0x5b19af,null));}; \ No newline at end of file +var _0x0fc8=['update','stack','name','index','map','DeskConfiguration','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','sort','where','filters','filter','type','VIRTUAL','includeAll','findAll','params','length','include','merge','find','body','getFields','DeskField','order','options','nolimit','getSubjects','findOne','pick','getDescriptions','getTags','Tag','setTags','ids','html-pdf','eml-format','request-promise','moment','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save'];(function(_0x18b5e8,_0x51e875){var _0x25baed=function(_0x3fcdf9){while(--_0x3fcdf9){_0x18b5e8['push'](_0x18b5e8['shift']());}};_0x25baed(++_0x51e875);}(_0x0fc8,0x145));var _0x80fc=function(_0x5f3d6b,_0x358951){_0x5f3d6b=_0x5f3d6b-0x0;var _0xfeca1=_0x0fc8[_0x5f3d6b];return _0xfeca1;};'use strict';var pdf=require(_0x80fc('0x0'));var emlformat=require(_0x80fc('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x80fc('0x2'));var moment=require(_0x80fc('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x80fc('0x4'));var path=require('path');var sox=require(_0x80fc('0x5'));var csv=require(_0x80fc('0x6'));var ejs=require(_0x80fc('0x7'));var fs=require('fs');var _=require(_0x80fc('0x8'));var squel=require(_0x80fc('0x9'));var crypto=require('crypto');var jsforce=require(_0x80fc('0xa'));var deskjs=require(_0x80fc('0xb'));var toCsv=require('to-csv');var querystring=require(_0x80fc('0xc'));var Papa=require(_0x80fc('0xd'));var Redis=require(_0x80fc('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x80fc('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x80fc('0x10'))(_0x80fc('0x11'));var utils=require(_0x80fc('0x12'));var config=require(_0x80fc('0x13'));var db=require(_0x80fc('0x14'))['db'];var jayson=require(_0x80fc('0x15'));var client=jayson[_0x80fc('0x16')][_0x80fc('0x17')]({'port':0x232a});function checkPasswordPattern(_0x376368,_0x2bad8c,_0xa17a93){if(_0xa17a93){var _0x1836ad=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1836ad[_0x80fc('0x18')](_0x2bad8c)){return _0x376368;}else{throw new db[(_0x80fc('0x19'))][(_0x80fc('0x1a'))](_0x80fc('0x1b'));}}else{return _0x376368;}}function respondWithRpcPromise(_0xc5ae35,_0x49620d,_0x307b02,_0x534f29){return new BPromise(function(_0x455017,_0x431821){var _0xb84685=_0x534f29||client;return _0xb84685['request'](_0xc5ae35,_0x307b02)[_0x80fc('0x1c')](function(_0x5ac244){logger[_0x80fc('0x1d')](_0x80fc('0x1e'),_0x49620d,_0x80fc('0x1f'));logger['debug'](_0x80fc('0x20'),_0x49620d,'request\x20sent',JSON[_0x80fc('0x21')](_0x5ac244));if(_0x5ac244[_0x80fc('0x22')]){if(_0x5ac244[_0x80fc('0x22')][_0x80fc('0x23')]===0x1f4){logger[_0x80fc('0x22')](_0x80fc('0x1e'),_0x49620d,_0x5ac244[_0x80fc('0x22')]['message']);return _0x431821(_0x5ac244[_0x80fc('0x22')][_0x80fc('0x24')]);}logger[_0x80fc('0x22')](_0x80fc('0x1e'),_0x49620d,_0x5ac244['error'][_0x80fc('0x24')]);return _0x455017(_0x5ac244[_0x80fc('0x22')][_0x80fc('0x24')]);}else{logger[_0x80fc('0x1d')]('DeskConfiguration,\x20%s,\x20%s',_0x49620d,_0x80fc('0x1f'));_0x455017(_0x5ac244[_0x80fc('0x25')][_0x80fc('0x24')]);}})[_0x80fc('0x26')](function(_0xc50f3){logger[_0x80fc('0x22')]('DeskConfiguration,\x20%s,\x20%s',_0x49620d,_0xc50f3);_0x431821(_0xc50f3);});});}function respondWithStatusCode(_0x5d2719,_0x32cded){_0x32cded=_0x32cded||0xcc;return function(_0x429f25){if(_0x429f25){return _0x5d2719[_0x80fc('0x27')](_0x32cded);}return _0x5d2719[_0x80fc('0x28')](_0x32cded)[_0x80fc('0x29')]();};}function respondWithResult(_0x32d839,_0x587274){_0x587274=_0x587274||0xc8;return function(_0xec3855){if(_0xec3855){return _0x32d839[_0x80fc('0x28')](_0x587274)['json'](_0xec3855);}};}function respondWithFilteredResult(_0x1bc4a5,_0x4d4181){return function(_0x317ec0){if(_0x317ec0){var _0x4b52fe=_0x317ec0[_0x80fc('0x2a')],_0x19a89e=_0x4d4181[_0x80fc('0x2b')],_0x146068=_0x4d4181[_0x80fc('0x2b')]+_0x4d4181[_0x80fc('0x2c')],_0x1f32c9;if(_0x146068>=_0x4b52fe){_0x146068=_0x4b52fe;_0x1f32c9=0xc8;}else{_0x1f32c9=0xce;}_0x1bc4a5[_0x80fc('0x28')](_0x1f32c9);return _0x1bc4a5[_0x80fc('0x2d')](_0x80fc('0x2e'),_0x19a89e+'-'+_0x146068+'/'+_0x4b52fe)[_0x80fc('0x2f')](_0x317ec0);}return null;};}function patchUpdates(_0x3a4218){return function(_0x2f4f7a){try{jsonpatch[_0x80fc('0x30')](_0x2f4f7a,_0x3a4218,!![]);}catch(_0x1c424f){return BPromise[_0x80fc('0x31')](_0x1c424f);}return _0x2f4f7a[_0x80fc('0x32')]();};}function saveUpdates(_0x537f63,_0x1e1549){return function(_0x5054e1){if(_0x5054e1){return _0x5054e1[_0x80fc('0x33')](_0x537f63)['then'](function(_0x2f237e){return _0x2f237e;});}return null;};}function removeEntity(_0x3b5024,_0x48a857){return function(_0x1c06fe){if(_0x1c06fe){return _0x1c06fe['destroy']()['then'](function(){_0x3b5024['status'](0xcc)[_0x80fc('0x29')]();});}};}function handleEntityNotFound(_0x524a73,_0x6ac16){return function(_0x4a1517){if(!_0x4a1517){_0x524a73[_0x80fc('0x27')](0x194);}return _0x4a1517;};}function handleError(_0x13bb8b,_0x1e81cf){_0x1e81cf=_0x1e81cf||0x1f4;return function(_0x2e89e5){logger[_0x80fc('0x22')](_0x2e89e5[_0x80fc('0x34')]);if(_0x2e89e5[_0x80fc('0x35')]){delete _0x2e89e5[_0x80fc('0x35')];}_0x13bb8b[_0x80fc('0x28')](_0x1e81cf)['send'](_0x2e89e5);};}exports[_0x80fc('0x36')]=function(_0x326d8d,_0x240166){var _0xf0a502={},_0x3fac2e={},_0x4584aa={'count':0x0,'rows':[]};var _0x5859bb=_[_0x80fc('0x37')](db[_0x80fc('0x38')][_0x80fc('0x39')],function(_0x2ee9bb){return{'name':_0x2ee9bb[_0x80fc('0x3a')],'type':_0x2ee9bb['type'][_0x80fc('0x3b')]};});_0x3fac2e[_0x80fc('0x3c')]=_[_0x80fc('0x37')](_0x5859bb,_0x80fc('0x35'));_0x3fac2e[_0x80fc('0x3d')]=_[_0x80fc('0x3e')](_0x326d8d[_0x80fc('0x3d')]);_0x3fac2e['filters']=_[_0x80fc('0x3f')](_0x3fac2e['model'],_0x3fac2e[_0x80fc('0x3d')]);_0xf0a502['attributes']=_['intersection'](_0x3fac2e[_0x80fc('0x3c')],qs[_0x80fc('0x40')](_0x326d8d[_0x80fc('0x3d')][_0x80fc('0x40')]));_0xf0a502[_0x80fc('0x41')]=_0xf0a502[_0x80fc('0x41')]['length']?_0xf0a502['attributes']:_0x3fac2e[_0x80fc('0x3c')];if(!_0x326d8d[_0x80fc('0x3d')][_0x80fc('0x42')]('nolimit')){_0xf0a502[_0x80fc('0x2c')]=qs[_0x80fc('0x2c')](_0x326d8d[_0x80fc('0x3d')][_0x80fc('0x2c')]);_0xf0a502[_0x80fc('0x2b')]=qs[_0x80fc('0x2b')](_0x326d8d[_0x80fc('0x3d')][_0x80fc('0x2b')]);}_0xf0a502['order']=qs['sort'](_0x326d8d[_0x80fc('0x3d')][_0x80fc('0x43')]);_0xf0a502[_0x80fc('0x44')]=qs[_0x80fc('0x45')](_['pick'](_0x326d8d['query'],_0x3fac2e[_0x80fc('0x45')]),_0x5859bb);if(_0x326d8d[_0x80fc('0x3d')][_0x80fc('0x46')]){_0xf0a502[_0x80fc('0x44')]=_['merge'](_0xf0a502[_0x80fc('0x44')],{'$or':_[_0x80fc('0x37')](_0x5859bb,function(_0x5ac286){if(_0x5ac286[_0x80fc('0x47')]!==_0x80fc('0x48')){var _0x144aa8={};_0x144aa8[_0x5ac286[_0x80fc('0x35')]]={'$like':'%'+_0x326d8d['query'][_0x80fc('0x46')]+'%'};return _0x144aa8;}})});}_0xf0a502=_['merge']({},_0xf0a502,_0x326d8d['options']);var _0x58dcc2={'where':_0xf0a502['where']};return db[_0x80fc('0x38')][_0x80fc('0x2a')](_0x58dcc2)[_0x80fc('0x1c')](function(_0x45da50){_0x4584aa['count']=_0x45da50;if(_0x326d8d[_0x80fc('0x3d')][_0x80fc('0x49')]){_0xf0a502['include']=[{'all':!![]}];}return db['DeskConfiguration'][_0x80fc('0x4a')](_0xf0a502);})[_0x80fc('0x1c')](function(_0x4a6577){_0x4584aa['rows']=_0x4a6577;return _0x4584aa;})[_0x80fc('0x1c')](respondWithFilteredResult(_0x240166,_0xf0a502))[_0x80fc('0x26')](handleError(_0x240166,null));};exports['show']=function(_0x2f66ec,_0x571d40){var _0x52d97b={'raw':![],'where':{'id':_0x2f66ec[_0x80fc('0x4b')]['id']}},_0x58f344={};_0x58f344['model']=_[_0x80fc('0x3e')](db[_0x80fc('0x38')][_0x80fc('0x39')]);_0x58f344[_0x80fc('0x3d')]=_[_0x80fc('0x3e')](_0x2f66ec[_0x80fc('0x3d')]);_0x58f344[_0x80fc('0x45')]=_['intersection'](_0x58f344['model'],_0x58f344[_0x80fc('0x3d')]);_0x52d97b[_0x80fc('0x41')]=_[_0x80fc('0x3f')](_0x58f344[_0x80fc('0x3c')],qs[_0x80fc('0x40')](_0x2f66ec[_0x80fc('0x3d')][_0x80fc('0x40')]));_0x52d97b[_0x80fc('0x41')]=_0x52d97b[_0x80fc('0x41')][_0x80fc('0x4c')]?_0x52d97b[_0x80fc('0x41')]:_0x58f344['model'];if(_0x2f66ec[_0x80fc('0x3d')]['includeAll']){_0x52d97b[_0x80fc('0x4d')]=[{'all':!![]}];}_0x52d97b=_[_0x80fc('0x4e')]({},_0x52d97b,_0x2f66ec['options']);return db[_0x80fc('0x38')][_0x80fc('0x4f')](_0x52d97b)['then'](handleEntityNotFound(_0x571d40,null))['then'](respondWithResult(_0x571d40,null))[_0x80fc('0x26')](handleError(_0x571d40,null));};exports['create']=function(_0x2242e6,_0x4cc0de){return db['DeskConfiguration']['create'](_0x2242e6[_0x80fc('0x50')],{})[_0x80fc('0x1c')](respondWithResult(_0x4cc0de,0xc9))[_0x80fc('0x26')](handleError(_0x4cc0de,null));};exports[_0x80fc('0x33')]=function(_0x3772fd,_0x1a7af9){if(_0x3772fd[_0x80fc('0x50')]['id']){delete _0x3772fd[_0x80fc('0x50')]['id'];}return db[_0x80fc('0x38')][_0x80fc('0x4f')]({'where':{'id':_0x3772fd[_0x80fc('0x4b')]['id']}})[_0x80fc('0x1c')](handleEntityNotFound(_0x1a7af9,null))[_0x80fc('0x1c')](saveUpdates(_0x3772fd['body'],null))[_0x80fc('0x1c')](respondWithResult(_0x1a7af9,null))[_0x80fc('0x26')](handleError(_0x1a7af9,null));};exports['destroy']=function(_0x2cf07f,_0x121312){return db[_0x80fc('0x38')][_0x80fc('0x4f')]({'where':{'id':_0x2cf07f[_0x80fc('0x4b')]['id']}})[_0x80fc('0x1c')](handleEntityNotFound(_0x121312,null))[_0x80fc('0x1c')](removeEntity(_0x121312,null))['catch'](handleError(_0x121312,null));};exports[_0x80fc('0x51')]=function(_0x4aa1a0,_0x5386a5,_0x557738){var _0x2510ad={};var _0x27a45f={};var _0x247947;var _0x5c5aee;return db['DeskConfiguration']['findOne']({'where':{'id':_0x4aa1a0[_0x80fc('0x4b')]['id']}})[_0x80fc('0x1c')](handleEntityNotFound(_0x5386a5,null))[_0x80fc('0x1c')](function(_0x3fbe55){if(_0x3fbe55){_0x247947=_0x3fbe55;_0x27a45f['model']=_[_0x80fc('0x3e')](db[_0x80fc('0x52')]['rawAttributes']);_0x27a45f[_0x80fc('0x3d')]=_[_0x80fc('0x3e')](_0x4aa1a0['query']);_0x27a45f[_0x80fc('0x45')]=_['intersection'](_0x27a45f[_0x80fc('0x3c')],_0x27a45f['query']);_0x2510ad[_0x80fc('0x41')]=_[_0x80fc('0x3f')](_0x27a45f['model'],qs[_0x80fc('0x40')](_0x4aa1a0['query'][_0x80fc('0x40')]));_0x2510ad[_0x80fc('0x41')]=_0x2510ad['attributes'][_0x80fc('0x4c')]?_0x2510ad['attributes']:_0x27a45f[_0x80fc('0x3c')];_0x2510ad[_0x80fc('0x53')]=qs[_0x80fc('0x43')](_0x4aa1a0['query']['sort']);_0x2510ad[_0x80fc('0x44')]=qs[_0x80fc('0x45')](_['pick'](_0x4aa1a0['query'],_0x27a45f[_0x80fc('0x45')]));if(_0x4aa1a0[_0x80fc('0x3d')][_0x80fc('0x46')]){_0x2510ad[_0x80fc('0x44')]=_[_0x80fc('0x4e')](_0x2510ad[_0x80fc('0x44')],{'$or':_[_0x80fc('0x37')](_0x2510ad[_0x80fc('0x41')],function(_0x5716d1){var _0x37a672={};_0x37a672[_0x5716d1]={'$like':'%'+_0x4aa1a0['query'][_0x80fc('0x46')]+'%'};return _0x37a672;})});}_0x2510ad=_[_0x80fc('0x4e')]({},_0x2510ad,_0x4aa1a0[_0x80fc('0x54')]);return _0x247947[_0x80fc('0x51')](_0x2510ad);}})['then'](function(_0x2c5d35){if(_0x2c5d35){_0x5c5aee=_0x2c5d35['length'];if(!_0x4aa1a0[_0x80fc('0x3d')][_0x80fc('0x42')](_0x80fc('0x55'))){_0x2510ad[_0x80fc('0x2c')]=qs[_0x80fc('0x2c')](_0x4aa1a0[_0x80fc('0x3d')][_0x80fc('0x2c')]);_0x2510ad['offset']=qs[_0x80fc('0x2b')](_0x4aa1a0[_0x80fc('0x3d')][_0x80fc('0x2b')]);}return _0x247947[_0x80fc('0x51')](_0x2510ad);}})['then'](function(_0x50e862){if(_0x50e862){return _0x50e862?{'count':_0x5c5aee,'rows':_0x50e862}:null;}})['then'](respondWithResult(_0x5386a5,null))[_0x80fc('0x26')](handleError(_0x5386a5,null));};exports[_0x80fc('0x56')]=function(_0x313319,_0x19f7a0,_0x567042){var _0x590953={};var _0x5d25ec={};var _0x3ac1b4;var _0x32f136;return db[_0x80fc('0x38')][_0x80fc('0x57')]({'where':{'id':_0x313319['params']['id']}})['then'](handleEntityNotFound(_0x19f7a0,null))[_0x80fc('0x1c')](function(_0x2e2901){if(_0x2e2901){_0x3ac1b4=_0x2e2901;_0x5d25ec[_0x80fc('0x3c')]=_[_0x80fc('0x3e')](db['DeskField'][_0x80fc('0x39')]);_0x5d25ec[_0x80fc('0x3d')]=_[_0x80fc('0x3e')](_0x313319[_0x80fc('0x3d')]);_0x5d25ec[_0x80fc('0x45')]=_[_0x80fc('0x3f')](_0x5d25ec[_0x80fc('0x3c')],_0x5d25ec[_0x80fc('0x3d')]);_0x590953[_0x80fc('0x41')]=_['intersection'](_0x5d25ec['model'],qs['fields'](_0x313319[_0x80fc('0x3d')]['fields']));_0x590953['attributes']=_0x590953['attributes']['length']?_0x590953[_0x80fc('0x41')]:_0x5d25ec[_0x80fc('0x3c')];_0x590953[_0x80fc('0x53')]=qs[_0x80fc('0x43')](_0x313319[_0x80fc('0x3d')][_0x80fc('0x43')]);_0x590953['where']=qs['filters'](_[_0x80fc('0x58')](_0x313319[_0x80fc('0x3d')],_0x5d25ec[_0x80fc('0x45')]));if(_0x313319[_0x80fc('0x3d')][_0x80fc('0x46')]){_0x590953[_0x80fc('0x44')]=_[_0x80fc('0x4e')](_0x590953[_0x80fc('0x44')],{'$or':_['map'](_0x590953[_0x80fc('0x41')],function(_0x4c4fcd){var _0x41b9f1={};_0x41b9f1[_0x4c4fcd]={'$like':'%'+_0x313319[_0x80fc('0x3d')][_0x80fc('0x46')]+'%'};return _0x41b9f1;})});}_0x590953=_[_0x80fc('0x4e')]({},_0x590953,_0x313319[_0x80fc('0x54')]);return _0x3ac1b4[_0x80fc('0x56')](_0x590953);}})[_0x80fc('0x1c')](function(_0x353e18){if(_0x353e18){_0x32f136=_0x353e18['length'];if(!_0x313319[_0x80fc('0x3d')][_0x80fc('0x42')](_0x80fc('0x55'))){_0x590953['limit']=qs[_0x80fc('0x2c')](_0x313319[_0x80fc('0x3d')][_0x80fc('0x2c')]);_0x590953[_0x80fc('0x2b')]=qs[_0x80fc('0x2b')](_0x313319[_0x80fc('0x3d')][_0x80fc('0x2b')]);}return _0x3ac1b4[_0x80fc('0x56')](_0x590953);}})[_0x80fc('0x1c')](function(_0xcbc322){if(_0xcbc322){return _0xcbc322?{'count':_0x32f136,'rows':_0xcbc322}:null;}})[_0x80fc('0x1c')](respondWithResult(_0x19f7a0,null))['catch'](handleError(_0x19f7a0,null));};exports[_0x80fc('0x59')]=function(_0x44a092,_0x40a1fa,_0x30dc06){var _0xaea212={};var _0x2831a1={};var _0x53c755;var _0x112d12;return db[_0x80fc('0x38')]['findOne']({'where':{'id':_0x44a092[_0x80fc('0x4b')]['id']}})['then'](handleEntityNotFound(_0x40a1fa,null))[_0x80fc('0x1c')](function(_0x22b94d){if(_0x22b94d){_0x53c755=_0x22b94d;_0x2831a1['model']=_['keys'](db[_0x80fc('0x52')][_0x80fc('0x39')]);_0x2831a1[_0x80fc('0x3d')]=_['keys'](_0x44a092['query']);_0x2831a1['filters']=_['intersection'](_0x2831a1['model'],_0x2831a1[_0x80fc('0x3d')]);_0xaea212[_0x80fc('0x41')]=_[_0x80fc('0x3f')](_0x2831a1[_0x80fc('0x3c')],qs['fields'](_0x44a092['query'][_0x80fc('0x40')]));_0xaea212['attributes']=_0xaea212[_0x80fc('0x41')]['length']?_0xaea212['attributes']:_0x2831a1[_0x80fc('0x3c')];_0xaea212[_0x80fc('0x53')]=qs['sort'](_0x44a092[_0x80fc('0x3d')]['sort']);_0xaea212[_0x80fc('0x44')]=qs['filters'](_['pick'](_0x44a092['query'],_0x2831a1['filters']));if(_0x44a092['query']['filter']){_0xaea212[_0x80fc('0x44')]=_['merge'](_0xaea212[_0x80fc('0x44')],{'$or':_[_0x80fc('0x37')](_0xaea212['attributes'],function(_0x1c960d){var _0x57a6c0={};_0x57a6c0[_0x1c960d]={'$like':'%'+_0x44a092[_0x80fc('0x3d')][_0x80fc('0x46')]+'%'};return _0x57a6c0;})});}_0xaea212=_[_0x80fc('0x4e')]({},_0xaea212,_0x44a092[_0x80fc('0x54')]);return _0x53c755[_0x80fc('0x59')](_0xaea212);}})[_0x80fc('0x1c')](function(_0x1821cf){if(_0x1821cf){_0x112d12=_0x1821cf[_0x80fc('0x4c')];if(!_0x44a092['query'][_0x80fc('0x42')](_0x80fc('0x55'))){_0xaea212[_0x80fc('0x2c')]=qs[_0x80fc('0x2c')](_0x44a092[_0x80fc('0x3d')][_0x80fc('0x2c')]);_0xaea212[_0x80fc('0x2b')]=qs[_0x80fc('0x2b')](_0x44a092[_0x80fc('0x3d')][_0x80fc('0x2b')]);}return _0x53c755['getDescriptions'](_0xaea212);}})[_0x80fc('0x1c')](function(_0x3b31f2){if(_0x3b31f2){return _0x3b31f2?{'count':_0x112d12,'rows':_0x3b31f2}:null;}})[_0x80fc('0x1c')](respondWithResult(_0x40a1fa,null))['catch'](handleError(_0x40a1fa,null));};exports[_0x80fc('0x5a')]=function(_0x4dc71e,_0x5aef22,_0x358ead){var _0x2ee724={};var _0x442fa7={};var _0xa7ad6c;var _0x18c253;return db[_0x80fc('0x38')][_0x80fc('0x57')]({'where':{'id':_0x4dc71e[_0x80fc('0x4b')]['id']}})['then'](handleEntityNotFound(_0x5aef22,null))[_0x80fc('0x1c')](function(_0x107326){if(_0x107326){_0xa7ad6c=_0x107326;_0x442fa7[_0x80fc('0x3c')]=_[_0x80fc('0x3e')](db[_0x80fc('0x5b')][_0x80fc('0x39')]);_0x442fa7[_0x80fc('0x3d')]=_['keys'](_0x4dc71e['query']);_0x442fa7[_0x80fc('0x45')]=_[_0x80fc('0x3f')](_0x442fa7[_0x80fc('0x3c')],_0x442fa7[_0x80fc('0x3d')]);_0x2ee724['attributes']=_[_0x80fc('0x3f')](_0x442fa7[_0x80fc('0x3c')],qs[_0x80fc('0x40')](_0x4dc71e['query'][_0x80fc('0x40')]));_0x2ee724[_0x80fc('0x41')]=_0x2ee724['attributes'][_0x80fc('0x4c')]?_0x2ee724[_0x80fc('0x41')]:_0x442fa7['model'];_0x2ee724[_0x80fc('0x53')]=qs[_0x80fc('0x43')](_0x4dc71e[_0x80fc('0x3d')][_0x80fc('0x43')]);_0x2ee724[_0x80fc('0x44')]=qs[_0x80fc('0x45')](_[_0x80fc('0x58')](_0x4dc71e['query'],_0x442fa7[_0x80fc('0x45')]));if(_0x4dc71e[_0x80fc('0x3d')][_0x80fc('0x46')]){_0x2ee724[_0x80fc('0x44')]=_[_0x80fc('0x4e')](_0x2ee724[_0x80fc('0x44')],{'$or':_['map'](_0x2ee724[_0x80fc('0x41')],function(_0x3b9853){var _0x3e13b0={};_0x3e13b0[_0x3b9853]={'$like':'%'+_0x4dc71e[_0x80fc('0x3d')][_0x80fc('0x46')]+'%'};return _0x3e13b0;})});}_0x2ee724=_[_0x80fc('0x4e')]({},_0x2ee724,_0x4dc71e[_0x80fc('0x54')]);return _0xa7ad6c[_0x80fc('0x5a')](_0x2ee724);}})[_0x80fc('0x1c')](function(_0x2c78df){if(_0x2c78df){_0x18c253=_0x2c78df['length'];if(!_0x4dc71e['query'][_0x80fc('0x42')]('nolimit')){_0x2ee724['limit']=qs[_0x80fc('0x2c')](_0x4dc71e[_0x80fc('0x3d')][_0x80fc('0x2c')]);_0x2ee724[_0x80fc('0x2b')]=qs[_0x80fc('0x2b')](_0x4dc71e[_0x80fc('0x3d')][_0x80fc('0x2b')]);}return _0xa7ad6c[_0x80fc('0x5a')](_0x2ee724);}})[_0x80fc('0x1c')](function(_0x13bf44){if(_0x13bf44){return _0x13bf44?{'count':_0x18c253,'rows':_0x13bf44}:null;}})[_0x80fc('0x1c')](respondWithResult(_0x5aef22,null))[_0x80fc('0x26')](handleError(_0x5aef22,null));};exports['setTags']=function(_0x5d7212,_0x40dc26,_0x4b123c){if(_0x5d7212[_0x80fc('0x50')]['id']){delete _0x5d7212[_0x80fc('0x50')]['id'];}return db[_0x80fc('0x38')][_0x80fc('0x57')]({'where':{'id':_0x5d7212[_0x80fc('0x4b')]['id']}})[_0x80fc('0x1c')](handleEntityNotFound(_0x40dc26,null))[_0x80fc('0x1c')](function(_0x5516ba){if(_0x5516ba){return _0x5516ba[_0x80fc('0x5c')](_0x5d7212[_0x80fc('0x50')][_0x80fc('0x5d')]||[]);}return null;})[_0x80fc('0x1c')](respondWithResult(_0x40dc26,null))[_0x80fc('0x26')](handleError(_0x40dc26,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index c3c11b4..7ae4e01 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 _0x6105=['./intDeskConfiguration.attributes','define','int_desk_configurations','lodash','util','request-promise','path','rimraf'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0x6105,0x18b));var _0x5610=function(_0xb41913,_0x46ea28){_0xb41913=_0xb41913-0x0;var _0xe3ecf8=_0x6105[_0xb41913];return _0xe3ecf8;};'use strict';var _=require(_0x5610('0x0'));var util=require(_0x5610('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5610('0x2'));var fs=require('fs');var path=require(_0x5610('0x3'));var rimraf=require(_0x5610('0x4'));var config=require('../../config/environment');var attributes=require(_0x5610('0x5'));module['exports']=function(_0x25b1f8,_0x2064e8){return _0x25b1f8[_0x5610('0x6')]('DeskConfiguration',attributes,{'tableName':_0x5610('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6c5e=['./intDeskConfiguration.attributes','exports','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0x6c5e,0x1ee));var _0xe6c5=function(_0x3c9c05,_0x31f740){_0x3c9c05=_0x3c9c05-0x0;var _0x2f1d51=_0x6c5e[_0x3c9c05];return _0x2f1d51;};'use strict';var _=require(_0xe6c5('0x0'));var util=require(_0xe6c5('0x1'));var logger=require(_0xe6c5('0x2'))(_0xe6c5('0x3'));var moment=require(_0xe6c5('0x4'));var BPromise=require(_0xe6c5('0x5'));var rp=require(_0xe6c5('0x6'));var fs=require('fs');var path=require(_0xe6c5('0x7'));var rimraf=require(_0xe6c5('0x8'));var config=require(_0xe6c5('0x9'));var attributes=require(_0xe6c5('0xa'));module[_0xe6c5('0xb')]=function(_0x1c710f,_0x13dd6f){return _0x1c710f['define']('DeskConfiguration',attributes,{'tableName':'int_desk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js b/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js index 05635df..c417860 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 _0xfa12=['../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','DeskConfiguration,\x20%s,\x20%s','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x233bbb,_0x4294f9){var _0x1bc0db=function(_0x25048f){while(--_0x25048f){_0x233bbb['push'](_0x233bbb['shift']());}};_0x1bc0db(++_0x4294f9);}(_0xfa12,0x1b2));var _0x2fa1=function(_0x2244cf,_0x1333e2){_0x2244cf=_0x2244cf-0x0;var _0x48d2fa=_0xfa12[_0x2244cf];return _0x48d2fa;};'use strict';var _=require(_0x2fa1('0x0'));var util=require(_0x2fa1('0x1'));var moment=require('moment');var BPromise=require(_0x2fa1('0x2'));var rs=require(_0x2fa1('0x3'));var fs=require('fs');var Redis=require(_0x2fa1('0x4'));var db=require(_0x2fa1('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2fa1('0x6'))(_0x2fa1('0x7'));var config=require(_0x2fa1('0x8'));var jayson=require(_0x2fa1('0x9'));var client=jayson['client'][_0x2fa1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x25b233,_0x58a81e,_0x3449c3){return new BPromise(function(_0x30a897,_0x2a9dc4){return client[_0x2fa1('0xb')](_0x25b233,_0x3449c3)['then'](function(_0x3ac971){logger[_0x2fa1('0xc')]('DeskConfiguration,\x20%s,\x20%s',_0x58a81e,_0x2fa1('0xd'));logger[_0x2fa1('0xe')](_0x2fa1('0xf'),_0x58a81e,_0x2fa1('0xd'),JSON[_0x2fa1('0x10')](_0x3ac971));if(_0x3ac971[_0x2fa1('0x11')]){if(_0x3ac971[_0x2fa1('0x11')][_0x2fa1('0x12')]===0x1f4){logger['error'](_0x2fa1('0x13'),_0x58a81e,_0x3ac971[_0x2fa1('0x11')][_0x2fa1('0x14')]);return _0x2a9dc4(_0x3ac971[_0x2fa1('0x11')][_0x2fa1('0x14')]);}logger[_0x2fa1('0x11')]('DeskConfiguration,\x20%s,\x20%s',_0x58a81e,_0x3ac971[_0x2fa1('0x11')][_0x2fa1('0x14')]);return _0x30a897(_0x3ac971[_0x2fa1('0x11')][_0x2fa1('0x14')]);}else{logger['info'](_0x2fa1('0x13'),_0x58a81e,_0x2fa1('0xd'));_0x30a897(_0x3ac971['result'][_0x2fa1('0x14')]);}})[_0x2fa1('0x15')](function(_0x453d24){logger[_0x2fa1('0x11')](_0x2fa1('0x13'),_0x58a81e,_0x453d24);_0x2a9dc4(_0x453d24);});});} \ No newline at end of file +var _0xb49a=['info','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','DeskConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x5e3f0f,_0x16c6c7){var _0xbd8d66=function(_0x3f4da4){while(--_0x3f4da4){_0x5e3f0f['push'](_0x5e3f0f['shift']());}};_0xbd8d66(++_0x16c6c7);}(_0xb49a,0xfb));var _0xab49=function(_0x3c7f1d,_0x44b37b){_0x3c7f1d=_0x3c7f1d-0x0;var _0xd7ab0c=_0xb49a[_0x3c7f1d];return _0xd7ab0c;};'use strict';var _=require(_0xab49('0x0'));var util=require(_0xab49('0x1'));var moment=require(_0xab49('0x2'));var BPromise=require(_0xab49('0x3'));var rs=require(_0xab49('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xab49('0x5'))['db'];var utils=require(_0xab49('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xab49('0x7'));var jayson=require(_0xab49('0x8'));var client=jayson[_0xab49('0x9')][_0xab49('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x57ea72,_0x26a98a,_0xd86a5){return new BPromise(function(_0x4d4d00,_0x15f259){return client[_0xab49('0xb')](_0x57ea72,_0xd86a5)[_0xab49('0xc')](function(_0x79f764){logger[_0xab49('0xd')]('DeskConfiguration,\x20%s,\x20%s',_0x26a98a,'request\x20sent');logger[_0xab49('0xe')](_0xab49('0xf'),_0x26a98a,_0xab49('0x10'),JSON[_0xab49('0x11')](_0x79f764));if(_0x79f764[_0xab49('0x12')]){if(_0x79f764['error'][_0xab49('0x13')]===0x1f4){logger[_0xab49('0x12')](_0xab49('0x14'),_0x26a98a,_0x79f764[_0xab49('0x12')][_0xab49('0x15')]);return _0x15f259(_0x79f764[_0xab49('0x12')][_0xab49('0x15')]);}logger[_0xab49('0x12')](_0xab49('0x14'),_0x26a98a,_0x79f764[_0xab49('0x12')][_0xab49('0x15')]);return _0x4d4d00(_0x79f764['error'][_0xab49('0x15')]);}else{logger[_0xab49('0xd')](_0xab49('0x14'),_0x26a98a,_0xab49('0x10'));_0x4d4d00(_0x79f764[_0xab49('0x16')]['message']);}})[_0xab49('0x17')](function(_0x2cbcff){logger[_0xab49('0x12')](_0xab49('0x14'),_0x26a98a,_0x2cbcff);_0x15f259(_0x2cbcff);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index b919008..3511ae1 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 _0x6f77=['update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','get','isAuthenticated','index','post','create','/:id'];(function(_0x10ab62,_0x21d1da){var _0x3b325b=function(_0x4aae9d){while(--_0x4aae9d){_0x10ab62['push'](_0x10ab62['shift']());}};_0x3b325b(++_0x21d1da);}(_0x6f77,0x1cc));var _0x76f7=function(_0x548627,_0x4ec392){_0x548627=_0x548627-0x0;var _0x844a84=_0x6f77[_0x548627];return _0x844a84;};'use strict';var multer=require(_0x76f7('0x0'));var util=require(_0x76f7('0x1'));var path=require(_0x76f7('0x2'));var timeout=require(_0x76f7('0x3'));var express=require('express');var router=express[_0x76f7('0x4')]();var auth=require(_0x76f7('0x5'));var interaction=require(_0x76f7('0x6'));var config=require(_0x76f7('0x7'));var controller=require(_0x76f7('0x8'));router[_0x76f7('0x9')]('/',auth[_0x76f7('0xa')](),controller[_0x76f7('0xb')]);router[_0x76f7('0x9')]('/:id',auth[_0x76f7('0xa')](),controller['show']);router[_0x76f7('0xc')]('/',auth[_0x76f7('0xa')](),controller[_0x76f7('0xd')]);router['put'](_0x76f7('0xe'),auth[_0x76f7('0xa')](),controller[_0x76f7('0xf')]);router[_0x76f7('0x10')](_0x76f7('0xe'),auth[_0x76f7('0xa')](),controller[_0x76f7('0x11')]);module[_0x76f7('0x12')]=router; \ No newline at end of file +var _0xd189=['put','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','post','create'];(function(_0x3f042c,_0x3d2cfe){var _0x280d2e=function(_0x235cad){while(--_0x235cad){_0x3f042c['push'](_0x3f042c['shift']());}};_0x280d2e(++_0x3d2cfe);}(_0xd189,0x1f0));var _0x9d18=function(_0x436e8e,_0x29f9b8){_0x436e8e=_0x436e8e-0x0;var _0x269226=_0xd189[_0x436e8e];return _0x269226;};'use strict';var multer=require(_0x9d18('0x0'));var util=require(_0x9d18('0x1'));var path=require(_0x9d18('0x2'));var timeout=require(_0x9d18('0x3'));var express=require(_0x9d18('0x4'));var router=express[_0x9d18('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x9d18('0x6'));var config=require(_0x9d18('0x7'));var controller=require('./intDeskField.controller');router[_0x9d18('0x8')]('/',auth[_0x9d18('0x9')](),controller['index']);router['get'](_0x9d18('0xa'),auth[_0x9d18('0x9')](),controller[_0x9d18('0xb')]);router[_0x9d18('0xc')]('/',auth[_0x9d18('0x9')](),controller[_0x9d18('0xd')]);router[_0x9d18('0xe')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x9d18('0xf')](_0x9d18('0xa'),auth[_0x9d18('0x9')](),controller[_0x9d18('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 642b227..182e5fc 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 _0x43dd=['variable','BOOLEAN','sequelize','exports','ENUM','customVariable','keyValue','STRING','string'];(function(_0x55768b,_0x3dbd37){var _0x32c5bf=function(_0x11b381){while(--_0x11b381){_0x55768b['push'](_0x55768b['shift']());}};_0x32c5bf(++_0x3dbd37);}(_0x43dd,0x110));var _0xd43d=function(_0x39c589,_0x389217){_0x39c589=_0x39c589-0x0;var _0x6b90d5=_0x43dd[_0x39c589];return _0x6b90d5;};'use strict';var Sequelize=require(_0xd43d('0x0'));module[_0xd43d('0x1')]={'type':{'type':Sequelize[_0xd43d('0x2')]('string','variable',_0xd43d('0x3'),_0xd43d('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0xd43d('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xd43d('0x2')](_0xd43d('0x6'),_0xd43d('0x7'),'customVariable')},'keyContent':{'type':Sequelize[_0xd43d('0x5')]},'idField':{'type':Sequelize[_0xd43d('0x5')]},'nameField':{'type':Sequelize[_0xd43d('0x5')]},'customField':{'type':Sequelize[_0xd43d('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xd43d('0x5')]}}; \ No newline at end of file +var _0x1dc3=['customVariable','keyValue','STRING','variable','BOOLEAN','sequelize','exports','ENUM','string'];(function(_0x4ce5af,_0x2dbeaa){var _0xb85361=function(_0xdd36e7){while(--_0xdd36e7){_0x4ce5af['push'](_0x4ce5af['shift']());}};_0xb85361(++_0x2dbeaa);}(_0x1dc3,0x9e));var _0x31dc=function(_0x54ed58,_0x50ba4c){_0x54ed58=_0x54ed58-0x0;var _0x458e41=_0x1dc3[_0x54ed58];return _0x458e41;};'use strict';var Sequelize=require(_0x31dc('0x0'));module[_0x31dc('0x1')]={'type':{'type':Sequelize[_0x31dc('0x2')](_0x31dc('0x3'),'variable',_0x31dc('0x4'),_0x31dc('0x5')),'defaultValue':_0x31dc('0x3')},'content':{'type':Sequelize[_0x31dc('0x6')]},'key':{'type':Sequelize[_0x31dc('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0x31dc('0x3'),_0x31dc('0x7'),_0x31dc('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x31dc('0x6')]},'customField':{'type':Sequelize[_0x31dc('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 81a81ce..02dd6d2 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 _0x0481=['eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','DeskField','includeAll','include','rows','catch','params','keys','options','create','body','find'];(function(_0xc8dbcf,_0xa57a31){var _0x1e1f4d=function(_0x7da737){while(--_0x7da737){_0xc8dbcf['push'](_0xc8dbcf['shift']());}};_0x1e1f4d(++_0xa57a31);}(_0x0481,0x1ea));var _0x1048=function(_0x5f1d74,_0x33e095){_0x5f1d74=_0x5f1d74-0x0;var _0xab75f5=_0x0481[_0x5f1d74];return _0xab75f5;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1048('0x0'));var rimraf=require(_0x1048('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1048('0x2'));var rp=require('request-promise');var moment=require(_0x1048('0x3'));var BPromise=require(_0x1048('0x4'));var Mustache=require(_0x1048('0x5'));var util=require(_0x1048('0x6'));var path=require(_0x1048('0x7'));var sox=require(_0x1048('0x8'));var csv=require('to-csv');var ejs=require(_0x1048('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x1048('0xa'));var crypto=require('crypto');var jsforce=require(_0x1048('0xb'));var deskjs=require(_0x1048('0xc'));var toCsv=require('to-csv');var querystring=require(_0x1048('0xd'));var Papa=require('papaparse');var Redis=require(_0x1048('0xe'));var authService=require(_0x1048('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x1048('0x10'));var hardwareService=require(_0x1048('0x11'));var logger=require(_0x1048('0x12'))(_0x1048('0x13'));var utils=require('../../config/utils');var config=require(_0x1048('0x14'));var db=require(_0x1048('0x15'))['db'];function respondWithStatusCode(_0x11dbe0,_0x3ac779){_0x3ac779=_0x3ac779||0xcc;return function(_0x36dc1c){if(_0x36dc1c){return _0x11dbe0[_0x1048('0x16')](_0x3ac779);}return _0x11dbe0['status'](_0x3ac779)[_0x1048('0x17')]();};}function respondWithResult(_0x1ff21e,_0x25620c){_0x25620c=_0x25620c||0xc8;return function(_0x2c82af){if(_0x2c82af){return _0x1ff21e[_0x1048('0x18')](_0x25620c)[_0x1048('0x19')](_0x2c82af);}};}function respondWithFilteredResult(_0x286577,_0x2a0dc3){return function(_0x501727){if(_0x501727){var _0x309795=_0x501727[_0x1048('0x1a')],_0x51adfd=_0x2a0dc3[_0x1048('0x1b')],_0x5e3337=_0x2a0dc3[_0x1048('0x1b')]+_0x2a0dc3[_0x1048('0x1c')],_0x5c3d9c;if(_0x5e3337>=_0x309795){_0x5e3337=_0x309795;_0x5c3d9c=0xc8;}else{_0x5c3d9c=0xce;}_0x286577[_0x1048('0x18')](_0x5c3d9c);return _0x286577['set'](_0x1048('0x1d'),_0x51adfd+'-'+_0x5e3337+'/'+_0x309795)[_0x1048('0x19')](_0x501727);}return null;};}function patchUpdates(_0x5ef798){return function(_0x217f17){try{jsonpatch[_0x1048('0x1e')](_0x217f17,_0x5ef798,!![]);}catch(_0x2b6c7d){return BPromise[_0x1048('0x1f')](_0x2b6c7d);}return _0x217f17[_0x1048('0x20')]();};}function saveUpdates(_0x220d40,_0x391f07){return function(_0x2dbcb7){if(_0x2dbcb7){return _0x2dbcb7[_0x1048('0x21')](_0x220d40)['then'](function(_0x424bfa){return _0x424bfa;});}return null;};}function removeEntity(_0x2365c6,_0x3714bb){return function(_0x4b9e04){if(_0x4b9e04){return _0x4b9e04[_0x1048('0x22')]()[_0x1048('0x23')](function(){_0x2365c6[_0x1048('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59e113,_0x7d1db3){return function(_0x4f068a){if(!_0x4f068a){_0x59e113['sendStatus'](0x194);}return _0x4f068a;};}function handleError(_0xc54014,_0x53329d){_0x53329d=_0x53329d||0x1f4;return function(_0x5dcdea){logger[_0x1048('0x24')](_0x5dcdea[_0x1048('0x25')]);if(_0x5dcdea[_0x1048('0x26')]){delete _0x5dcdea['name'];}_0xc54014[_0x1048('0x18')](_0x53329d)[_0x1048('0x27')](_0x5dcdea);};}exports[_0x1048('0x28')]=function(_0x38e489,_0x112fda){var _0x2b6ac7={},_0x21190d={},_0x58cd70={'count':0x0,'rows':[]};var _0x4c24b7=_[_0x1048('0x29')](db['DeskField'][_0x1048('0x2a')],function(_0x3c4b48){return{'name':_0x3c4b48[_0x1048('0x2b')],'type':_0x3c4b48[_0x1048('0x2c')]['key']};});_0x21190d[_0x1048('0x2d')]=_[_0x1048('0x29')](_0x4c24b7,_0x1048('0x26'));_0x21190d[_0x1048('0x2e')]=_['keys'](_0x38e489[_0x1048('0x2e')]);_0x21190d[_0x1048('0x2f')]=_[_0x1048('0x30')](_0x21190d[_0x1048('0x2d')],_0x21190d[_0x1048('0x2e')]);_0x2b6ac7[_0x1048('0x31')]=_[_0x1048('0x30')](_0x21190d[_0x1048('0x2d')],qs['fields'](_0x38e489[_0x1048('0x2e')][_0x1048('0x32')]));_0x2b6ac7[_0x1048('0x31')]=_0x2b6ac7[_0x1048('0x31')][_0x1048('0x33')]?_0x2b6ac7[_0x1048('0x31')]:_0x21190d[_0x1048('0x2d')];if(!_0x38e489['query'][_0x1048('0x34')]('nolimit')){_0x2b6ac7[_0x1048('0x1c')]=qs[_0x1048('0x1c')](_0x38e489[_0x1048('0x2e')][_0x1048('0x1c')]);_0x2b6ac7['offset']=qs[_0x1048('0x1b')](_0x38e489[_0x1048('0x2e')][_0x1048('0x1b')]);}_0x2b6ac7[_0x1048('0x35')]=qs[_0x1048('0x36')](_0x38e489[_0x1048('0x2e')][_0x1048('0x36')]);_0x2b6ac7[_0x1048('0x37')]=qs[_0x1048('0x2f')](_['pick'](_0x38e489[_0x1048('0x2e')],_0x21190d[_0x1048('0x2f')]),_0x4c24b7);if(_0x38e489[_0x1048('0x2e')][_0x1048('0x38')]){_0x2b6ac7[_0x1048('0x37')]=_[_0x1048('0x39')](_0x2b6ac7[_0x1048('0x37')],{'$or':_['map'](_0x4c24b7,function(_0x47b503){if(_0x47b503[_0x1048('0x2c')]!==_0x1048('0x3a')){var _0x3af631={};_0x3af631[_0x47b503[_0x1048('0x26')]]={'$like':'%'+_0x38e489[_0x1048('0x2e')][_0x1048('0x38')]+'%'};return _0x3af631;}})});}_0x2b6ac7=_[_0x1048('0x39')]({},_0x2b6ac7,_0x38e489['options']);var _0x131bda={'where':_0x2b6ac7[_0x1048('0x37')]};return db[_0x1048('0x3b')][_0x1048('0x1a')](_0x131bda)['then'](function(_0x2bf85f){_0x58cd70[_0x1048('0x1a')]=_0x2bf85f;if(_0x38e489[_0x1048('0x2e')][_0x1048('0x3c')]){_0x2b6ac7[_0x1048('0x3d')]=[{'all':!![]}];}return db[_0x1048('0x3b')]['findAll'](_0x2b6ac7);})['then'](function(_0x4636cf){_0x58cd70[_0x1048('0x3e')]=_0x4636cf;return _0x58cd70;})[_0x1048('0x23')](respondWithFilteredResult(_0x112fda,_0x2b6ac7))[_0x1048('0x3f')](handleError(_0x112fda,null));};exports['show']=function(_0x2cc00e,_0x5cd3cd){var _0x45fa13={'raw':!![],'where':{'id':_0x2cc00e[_0x1048('0x40')]['id']}},_0x1723db={};_0x1723db[_0x1048('0x2d')]=_[_0x1048('0x41')](db['DeskField'][_0x1048('0x2a')]);_0x1723db[_0x1048('0x2e')]=_[_0x1048('0x41')](_0x2cc00e['query']);_0x1723db['filters']=_[_0x1048('0x30')](_0x1723db[_0x1048('0x2d')],_0x1723db[_0x1048('0x2e')]);_0x45fa13[_0x1048('0x31')]=_[_0x1048('0x30')](_0x1723db[_0x1048('0x2d')],qs['fields'](_0x2cc00e[_0x1048('0x2e')][_0x1048('0x32')]));_0x45fa13[_0x1048('0x31')]=_0x45fa13[_0x1048('0x31')][_0x1048('0x33')]?_0x45fa13[_0x1048('0x31')]:_0x1723db[_0x1048('0x2d')];if(_0x2cc00e[_0x1048('0x2e')]['includeAll']){_0x45fa13[_0x1048('0x3d')]=[{'all':!![]}];}_0x45fa13=_[_0x1048('0x39')]({},_0x45fa13,_0x2cc00e[_0x1048('0x42')]);return db[_0x1048('0x3b')]['find'](_0x45fa13)[_0x1048('0x23')](handleEntityNotFound(_0x5cd3cd,null))[_0x1048('0x23')](respondWithResult(_0x5cd3cd,null))[_0x1048('0x3f')](handleError(_0x5cd3cd,null));};exports[_0x1048('0x43')]=function(_0x49e455,_0x29413c){return db[_0x1048('0x3b')]['create'](_0x49e455[_0x1048('0x44')],{})['then'](respondWithResult(_0x29413c,0xc9))['catch'](handleError(_0x29413c,null));};exports[_0x1048('0x21')]=function(_0xabea57,_0x398021){if(_0xabea57[_0x1048('0x44')]['id']){delete _0xabea57[_0x1048('0x44')]['id'];}return db['DeskField'][_0x1048('0x45')]({'where':{'id':_0xabea57[_0x1048('0x40')]['id']}})[_0x1048('0x23')](handleEntityNotFound(_0x398021,null))[_0x1048('0x23')](saveUpdates(_0xabea57[_0x1048('0x44')],null))[_0x1048('0x23')](respondWithResult(_0x398021,null))[_0x1048('0x3f')](handleError(_0x398021,null));};exports[_0x1048('0x22')]=function(_0x2f0c4c,_0x1fc82b){return db[_0x1048('0x3b')][_0x1048('0x45')]({'where':{'id':_0x2f0c4c['params']['id']}})[_0x1048('0x23')](handleEntityNotFound(_0x1fc82b,null))[_0x1048('0x23')](removeEntity(_0x1fc82b,null))['catch'](handleError(_0x1fc82b,null));}; \ No newline at end of file +var _0x4b66=['eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','then','destroy','error','stack','name','index','DeskField','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','filter','merge','where','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','body','find','html-pdf'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4b66,0x11f));var _0x64b6=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x4b66[_0x122ef9];return _0x42fba0;};'use strict';var pdf=require(_0x64b6('0x0'));var emlformat=require(_0x64b6('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x64b6('0x2'));var jsonpatch=require(_0x64b6('0x3'));var rp=require(_0x64b6('0x4'));var moment=require(_0x64b6('0x5'));var BPromise=require(_0x64b6('0x6'));var Mustache=require('mustache');var util=require(_0x64b6('0x7'));var path=require(_0x64b6('0x8'));var sox=require(_0x64b6('0x9'));var csv=require(_0x64b6('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x64b6('0xb'));var squel=require(_0x64b6('0xc'));var crypto=require(_0x64b6('0xd'));var jsforce=require(_0x64b6('0xe'));var deskjs=require(_0x64b6('0xf'));var toCsv=require(_0x64b6('0xa'));var querystring=require(_0x64b6('0x10'));var Papa=require(_0x64b6('0x11'));var Redis=require(_0x64b6('0x12'));var authService=require(_0x64b6('0x13'));var qs=require(_0x64b6('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x64b6('0x15'));var logger=require(_0x64b6('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x64b6('0x17'));var db=require(_0x64b6('0x18'))['db'];function respondWithStatusCode(_0x2f0163,_0x3833ab){_0x3833ab=_0x3833ab||0xcc;return function(_0x51fffa){if(_0x51fffa){return _0x2f0163[_0x64b6('0x19')](_0x3833ab);}return _0x2f0163[_0x64b6('0x1a')](_0x3833ab)[_0x64b6('0x1b')]();};}function respondWithResult(_0x431c16,_0x25d200){_0x25d200=_0x25d200||0xc8;return function(_0x159568){if(_0x159568){return _0x431c16['status'](_0x25d200)[_0x64b6('0x1c')](_0x159568);}};}function respondWithFilteredResult(_0x225cd5,_0x5a5fbd){return function(_0x29aebd){if(_0x29aebd){var _0x13b5c8=_0x29aebd[_0x64b6('0x1d')],_0x75b75d=_0x5a5fbd[_0x64b6('0x1e')],_0x44271a=_0x5a5fbd[_0x64b6('0x1e')]+_0x5a5fbd[_0x64b6('0x1f')],_0x423c34;if(_0x44271a>=_0x13b5c8){_0x44271a=_0x13b5c8;_0x423c34=0xc8;}else{_0x423c34=0xce;}_0x225cd5[_0x64b6('0x1a')](_0x423c34);return _0x225cd5['set'](_0x64b6('0x20'),_0x75b75d+'-'+_0x44271a+'/'+_0x13b5c8)[_0x64b6('0x1c')](_0x29aebd);}return null;};}function patchUpdates(_0x23d20a){return function(_0x21b468){try{jsonpatch[_0x64b6('0x21')](_0x21b468,_0x23d20a,!![]);}catch(_0x47ee10){return BPromise[_0x64b6('0x22')](_0x47ee10);}return _0x21b468['save']();};}function saveUpdates(_0x4cf0d8,_0x1166b2){return function(_0x2824e7){if(_0x2824e7){return _0x2824e7['update'](_0x4cf0d8)[_0x64b6('0x23')](function(_0x40cbed){return _0x40cbed;});}return null;};}function removeEntity(_0x1bc017,_0x507f92){return function(_0x3ab15e){if(_0x3ab15e){return _0x3ab15e[_0x64b6('0x24')]()[_0x64b6('0x23')](function(){_0x1bc017[_0x64b6('0x1a')](0xcc)[_0x64b6('0x1b')]();});}};}function handleEntityNotFound(_0x165abb,_0x56c683){return function(_0x2f9234){if(!_0x2f9234){_0x165abb[_0x64b6('0x19')](0x194);}return _0x2f9234;};}function handleError(_0x29d348,_0x4d95ba){_0x4d95ba=_0x4d95ba||0x1f4;return function(_0x5a9ee2){logger[_0x64b6('0x25')](_0x5a9ee2[_0x64b6('0x26')]);if(_0x5a9ee2[_0x64b6('0x27')]){delete _0x5a9ee2[_0x64b6('0x27')];}_0x29d348[_0x64b6('0x1a')](_0x4d95ba)['send'](_0x5a9ee2);};}exports[_0x64b6('0x28')]=function(_0x1beb68,_0x3f9c7a){var _0x480cfa={},_0x4c342a={},_0x20ebcd={'count':0x0,'rows':[]};var _0x4b1ff0=_['map'](db[_0x64b6('0x29')]['rawAttributes'],function(_0x32b283){return{'name':_0x32b283[_0x64b6('0x2a')],'type':_0x32b283[_0x64b6('0x2b')][_0x64b6('0x2c')]};});_0x4c342a[_0x64b6('0x2d')]=_[_0x64b6('0x2e')](_0x4b1ff0,_0x64b6('0x27'));_0x4c342a[_0x64b6('0x2f')]=_[_0x64b6('0x30')](_0x1beb68[_0x64b6('0x2f')]);_0x4c342a['filters']=_[_0x64b6('0x31')](_0x4c342a[_0x64b6('0x2d')],_0x4c342a[_0x64b6('0x2f')]);_0x480cfa[_0x64b6('0x32')]=_[_0x64b6('0x31')](_0x4c342a[_0x64b6('0x2d')],qs[_0x64b6('0x33')](_0x1beb68[_0x64b6('0x2f')]['fields']));_0x480cfa[_0x64b6('0x32')]=_0x480cfa[_0x64b6('0x32')][_0x64b6('0x34')]?_0x480cfa[_0x64b6('0x32')]:_0x4c342a[_0x64b6('0x2d')];if(!_0x1beb68['query'][_0x64b6('0x35')]('nolimit')){_0x480cfa[_0x64b6('0x1f')]=qs[_0x64b6('0x1f')](_0x1beb68[_0x64b6('0x2f')][_0x64b6('0x1f')]);_0x480cfa[_0x64b6('0x1e')]=qs[_0x64b6('0x1e')](_0x1beb68[_0x64b6('0x2f')][_0x64b6('0x1e')]);}_0x480cfa[_0x64b6('0x36')]=qs[_0x64b6('0x37')](_0x1beb68[_0x64b6('0x2f')][_0x64b6('0x37')]);_0x480cfa['where']=qs[_0x64b6('0x38')](_['pick'](_0x1beb68[_0x64b6('0x2f')],_0x4c342a[_0x64b6('0x38')]),_0x4b1ff0);if(_0x1beb68[_0x64b6('0x2f')][_0x64b6('0x39')]){_0x480cfa['where']=_[_0x64b6('0x3a')](_0x480cfa[_0x64b6('0x3b')],{'$or':_['map'](_0x4b1ff0,function(_0x1acaf1){if(_0x1acaf1[_0x64b6('0x2b')]!=='VIRTUAL'){var _0x241bb9={};_0x241bb9[_0x1acaf1[_0x64b6('0x27')]]={'$like':'%'+_0x1beb68[_0x64b6('0x2f')]['filter']+'%'};return _0x241bb9;}})});}_0x480cfa=_['merge']({},_0x480cfa,_0x1beb68[_0x64b6('0x3c')]);var _0x160c90={'where':_0x480cfa[_0x64b6('0x3b')]};return db['DeskField'][_0x64b6('0x1d')](_0x160c90)[_0x64b6('0x23')](function(_0x3c3d7e){_0x20ebcd[_0x64b6('0x1d')]=_0x3c3d7e;if(_0x1beb68[_0x64b6('0x2f')][_0x64b6('0x3d')]){_0x480cfa[_0x64b6('0x3e')]=[{'all':!![]}];}return db['DeskField'][_0x64b6('0x3f')](_0x480cfa);})[_0x64b6('0x23')](function(_0x3eb37f){_0x20ebcd[_0x64b6('0x40')]=_0x3eb37f;return _0x20ebcd;})[_0x64b6('0x23')](respondWithFilteredResult(_0x3f9c7a,_0x480cfa))[_0x64b6('0x41')](handleError(_0x3f9c7a,null));};exports[_0x64b6('0x42')]=function(_0x4712cd,_0x5606fb){var _0xdfb909={'raw':!![],'where':{'id':_0x4712cd[_0x64b6('0x43')]['id']}},_0x26292c={};_0x26292c[_0x64b6('0x2d')]=_['keys'](db[_0x64b6('0x29')][_0x64b6('0x44')]);_0x26292c[_0x64b6('0x2f')]=_[_0x64b6('0x30')](_0x4712cd[_0x64b6('0x2f')]);_0x26292c[_0x64b6('0x38')]=_[_0x64b6('0x31')](_0x26292c['model'],_0x26292c[_0x64b6('0x2f')]);_0xdfb909[_0x64b6('0x32')]=_[_0x64b6('0x31')](_0x26292c['model'],qs['fields'](_0x4712cd[_0x64b6('0x2f')]['fields']));_0xdfb909[_0x64b6('0x32')]=_0xdfb909[_0x64b6('0x32')][_0x64b6('0x34')]?_0xdfb909[_0x64b6('0x32')]:_0x26292c['model'];if(_0x4712cd[_0x64b6('0x2f')][_0x64b6('0x3d')]){_0xdfb909['include']=[{'all':!![]}];}_0xdfb909=_['merge']({},_0xdfb909,_0x4712cd[_0x64b6('0x3c')]);return db['DeskField']['find'](_0xdfb909)['then'](handleEntityNotFound(_0x5606fb,null))[_0x64b6('0x23')](respondWithResult(_0x5606fb,null))[_0x64b6('0x41')](handleError(_0x5606fb,null));};exports[_0x64b6('0x45')]=function(_0xa67876,_0xf7533a){return db[_0x64b6('0x29')]['create'](_0xa67876[_0x64b6('0x46')],{})[_0x64b6('0x23')](respondWithResult(_0xf7533a,0xc9))[_0x64b6('0x41')](handleError(_0xf7533a,null));};exports['update']=function(_0x103085,_0x1cd206){if(_0x103085['body']['id']){delete _0x103085[_0x64b6('0x46')]['id'];}return db['DeskField']['find']({'where':{'id':_0x103085[_0x64b6('0x43')]['id']}})[_0x64b6('0x23')](handleEntityNotFound(_0x1cd206,null))['then'](saveUpdates(_0x103085[_0x64b6('0x46')],null))[_0x64b6('0x23')](respondWithResult(_0x1cd206,null))[_0x64b6('0x41')](handleError(_0x1cd206,null));};exports[_0x64b6('0x24')]=function(_0x32000e,_0x3444b6){return db['DeskField'][_0x64b6('0x47')]({'where':{'id':_0x32000e['params']['id']}})[_0x64b6('0x23')](handleEntityNotFound(_0x3444b6,null))[_0x64b6('0x23')](removeEntity(_0x3444b6,null))[_0x64b6('0x41')](handleError(_0x3444b6,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index e41f88c..2f21239 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 _0xf770=['lodash','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','exports','define','int_desk_fields','desk_unique_index','idField','FieldId'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf770,0x16c));var _0x0f77=function(_0x3412d6,_0x1f67f1){_0x3412d6=_0x3412d6-0x0;var _0x12cdd8=_0xf770[_0x3412d6];return _0x12cdd8;};'use strict';var _=require(_0x0f77('0x0'));var util=require('util');var logger=require(_0x0f77('0x1'))(_0x0f77('0x2'));var moment=require(_0x0f77('0x3'));var BPromise=require('bluebird');var rp=require(_0x0f77('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0f77('0x5'));var config=require(_0x0f77('0x6'));var attributes=require('./intDeskField.attributes');module[_0x0f77('0x7')]=function(_0x341626,_0x38052c){return _0x341626[_0x0f77('0x8')]('DeskField',attributes,{'tableName':_0x0f77('0x9'),'paranoid':![],'indexes':[{'name':_0x0f77('0xa'),'fields':[_0x0f77('0xb'),_0x0f77('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xdd13=['int_desk_fields','desk_unique_index','idField','FieldId','../../config/logger','bluebird','request-promise','path','../../config/environment','./intDeskField.attributes','define','DeskField'];(function(_0x2b4ec6,_0x529490){var _0x1f8507=function(_0x161e44){while(--_0x161e44){_0x2b4ec6['push'](_0x2b4ec6['shift']());}};_0x1f8507(++_0x529490);}(_0xdd13,0x19c));var _0x3dd1=function(_0x19a242,_0x5716b4){_0x19a242=_0x19a242-0x0;var _0x4eea87=_0xdd13[_0x19a242];return _0x4eea87;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3dd1('0x0'))('api');var moment=require('moment');var BPromise=require(_0x3dd1('0x1'));var rp=require(_0x3dd1('0x2'));var fs=require('fs');var path=require(_0x3dd1('0x3'));var rimraf=require('rimraf');var config=require(_0x3dd1('0x4'));var attributes=require(_0x3dd1('0x5'));module['exports']=function(_0x561c1d,_0x84efd3){return _0x561c1d[_0x3dd1('0x6')](_0x3dd1('0x7'),attributes,{'tableName':_0x3dd1('0x8'),'paranoid':![],'indexes':[{'name':_0x3dd1('0x9'),'fields':[_0x3dd1('0xa'),_0x3dd1('0xb')],'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 f4b83de..812545e 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 _0xaecd=['request','then','info','DeskField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0xa45c53,_0xe21591){var _0x4a5b39=function(_0x526b2e){while(--_0x526b2e){_0xa45c53['push'](_0xa45c53['shift']());}};_0x4a5b39(++_0xe21591);}(_0xaecd,0x11f));var _0xdaec=function(_0x3293dc,_0x2089fe){_0x3293dc=_0x3293dc-0x0;var _0x46960f=_0xaecd[_0x3293dc];return _0x46960f;};'use strict';var _=require(_0xdaec('0x0'));var util=require(_0xdaec('0x1'));var moment=require(_0xdaec('0x2'));var BPromise=require(_0xdaec('0x3'));var rs=require(_0xdaec('0x4'));var fs=require('fs');var Redis=require(_0xdaec('0x5'));var db=require(_0xdaec('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xdaec('0x7'))(_0xdaec('0x8'));var config=require(_0xdaec('0x9'));var jayson=require(_0xdaec('0xa'));var client=jayson['client'][_0xdaec('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x478285,_0x33d0c8,_0xbae55d){return new BPromise(function(_0x3ab54d,_0x558b22){return client[_0xdaec('0xc')](_0x478285,_0xbae55d)[_0xdaec('0xd')](function(_0x1a1104){logger[_0xdaec('0xe')](_0xdaec('0xf'),_0x33d0c8,_0xdaec('0x10'));logger[_0xdaec('0x11')]('DeskField,\x20%s,\x20%s,\x20%s',_0x33d0c8,_0xdaec('0x10'),JSON[_0xdaec('0x12')](_0x1a1104));if(_0x1a1104[_0xdaec('0x13')]){if(_0x1a1104['error']['code']===0x1f4){logger[_0xdaec('0x13')](_0xdaec('0xf'),_0x33d0c8,_0x1a1104[_0xdaec('0x13')][_0xdaec('0x14')]);return _0x558b22(_0x1a1104[_0xdaec('0x13')][_0xdaec('0x14')]);}logger['error'](_0xdaec('0xf'),_0x33d0c8,_0x1a1104[_0xdaec('0x13')][_0xdaec('0x14')]);return _0x3ab54d(_0x1a1104[_0xdaec('0x13')][_0xdaec('0x14')]);}else{logger[_0xdaec('0xe')](_0xdaec('0xf'),_0x33d0c8,'request\x20sent');_0x3ab54d(_0x1a1104[_0xdaec('0x15')][_0xdaec('0x14')]);}})[_0xdaec('0x16')](function(_0x48fa3c){logger['error']('DeskField,\x20%s,\x20%s',_0x33d0c8,_0x48fa3c);_0x558b22(_0x48fa3c);});});} \ No newline at end of file +var _0x9bce=['info','request\x20sent','debug','stringify','error','code','DeskField,\x20%s,\x20%s','message','result','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then'];(function(_0x1cfb62,_0x121148){var _0x16c67c=function(_0x15eed8){while(--_0x15eed8){_0x1cfb62['push'](_0x1cfb62['shift']());}};_0x16c67c(++_0x121148);}(_0x9bce,0x8d));var _0xe9bc=function(_0x3b765b,_0x3a1afc){_0x3b765b=_0x3b765b-0x0;var _0x195366=_0x9bce[_0x3b765b];return _0x195366;};'use strict';var _=require(_0xe9bc('0x0'));var util=require('util');var moment=require(_0xe9bc('0x1'));var BPromise=require('bluebird');var rs=require(_0xe9bc('0x2'));var fs=require('fs');var Redis=require(_0xe9bc('0x3'));var db=require(_0xe9bc('0x4'))['db'];var utils=require(_0xe9bc('0x5'));var logger=require(_0xe9bc('0x6'))(_0xe9bc('0x7'));var config=require(_0xe9bc('0x8'));var jayson=require(_0xe9bc('0x9'));var client=jayson[_0xe9bc('0xa')][_0xe9bc('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x14501b,_0x1cddcc,_0x226ece){return new BPromise(function(_0x48c1f9,_0x1692ee){return client['request'](_0x14501b,_0x226ece)[_0xe9bc('0xc')](function(_0x9509fb){logger[_0xe9bc('0xd')]('DeskField,\x20%s,\x20%s',_0x1cddcc,_0xe9bc('0xe'));logger[_0xe9bc('0xf')]('DeskField,\x20%s,\x20%s,\x20%s',_0x1cddcc,_0xe9bc('0xe'),JSON[_0xe9bc('0x10')](_0x9509fb));if(_0x9509fb[_0xe9bc('0x11')]){if(_0x9509fb[_0xe9bc('0x11')][_0xe9bc('0x12')]===0x1f4){logger[_0xe9bc('0x11')](_0xe9bc('0x13'),_0x1cddcc,_0x9509fb[_0xe9bc('0x11')]['message']);return _0x1692ee(_0x9509fb['error']['message']);}logger[_0xe9bc('0x11')](_0xe9bc('0x13'),_0x1cddcc,_0x9509fb[_0xe9bc('0x11')]['message']);return _0x48c1f9(_0x9509fb[_0xe9bc('0x11')][_0xe9bc('0x14')]);}else{logger[_0xe9bc('0xd')](_0xe9bc('0x13'),_0x1cddcc,'request\x20sent');_0x48c1f9(_0x9509fb[_0xe9bc('0x15')][_0xe9bc('0x14')]);}})['catch'](function(_0x16ccee){logger[_0xe9bc('0x11')](_0xe9bc('0x13'),_0x1cddcc,_0x16ccee);_0x1692ee(_0x16ccee);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 54fcceb..5136eb6 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 _0x6acd=['isAuthenticated','/:id','show','/:id/configurations','getConfigurations','getFields','post','put','destroy','exports','connect-timeout','express','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get'];(function(_0xb28ee9,_0x184eae){var _0x3d830f=function(_0x37be18){while(--_0x37be18){_0xb28ee9['push'](_0xb28ee9['shift']());}};_0x3d830f(++_0x184eae);}(_0x6acd,0x19a));var _0xd6ac=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x6acd[_0x40a045];return _0x1a687c;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xd6ac('0x0'));var express=require(_0xd6ac('0x1'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xd6ac('0x2'));var config=require(_0xd6ac('0x3'));var controller=require(_0xd6ac('0x4'));router[_0xd6ac('0x5')]('/',auth[_0xd6ac('0x6')](),controller['index']);router['get'](_0xd6ac('0x7'),auth[_0xd6ac('0x6')](),controller[_0xd6ac('0x8')]);router[_0xd6ac('0x5')](_0xd6ac('0x9'),auth[_0xd6ac('0x6')](),controller[_0xd6ac('0xa')]);router[_0xd6ac('0x5')]('/:id/fields',auth['isAuthenticated'](),controller[_0xd6ac('0xb')]);router['post']('/',auth[_0xd6ac('0x6')](),controller['create']);router[_0xd6ac('0xc')](_0xd6ac('0x9'),auth[_0xd6ac('0x6')](),controller['addConfiguration']);router[_0xd6ac('0xd')](_0xd6ac('0x7'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xd6ac('0x7'),auth[_0xd6ac('0x6')](),controller[_0xd6ac('0xe')]);module[_0xd6ac('0xf')]=router; \ No newline at end of file +var _0xaf50=['addConfiguration','put','update','delete','exports','multer','connect-timeout','Router','../../components/auth/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','post','create'];(function(_0x2b2b34,_0x354337){var _0x10ef10=function(_0x2db75e){while(--_0x2db75e){_0x2b2b34['push'](_0x2b2b34['shift']());}};_0x10ef10(++_0x354337);}(_0xaf50,0x1a9));var _0x0af5=function(_0x23d753,_0x57e8cc){_0x23d753=_0x23d753-0x0;var _0x220e53=_0xaf50[_0x23d753];return _0x220e53;};'use strict';var multer=require(_0x0af5('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x0af5('0x1'));var express=require('express');var router=express[_0x0af5('0x2')]();var auth=require(_0x0af5('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x0af5('0x4'));var controller=require(_0x0af5('0x5'));router[_0x0af5('0x6')]('/',auth[_0x0af5('0x7')](),controller[_0x0af5('0x8')]);router['get'](_0x0af5('0x9'),auth[_0x0af5('0x7')](),controller[_0x0af5('0xa')]);router[_0x0af5('0x6')]('/:id/configurations',auth[_0x0af5('0x7')](),controller['getConfigurations']);router[_0x0af5('0x6')](_0x0af5('0xb'),auth[_0x0af5('0x7')](),controller[_0x0af5('0xc')]);router[_0x0af5('0xd')]('/',auth[_0x0af5('0x7')](),controller[_0x0af5('0xe')]);router[_0x0af5('0xd')]('/:id/configurations',auth[_0x0af5('0x7')](),controller[_0x0af5('0xf')]);router[_0x0af5('0x10')](_0x0af5('0x9'),auth[_0x0af5('0x7')](),controller[_0x0af5('0x11')]);router[_0x0af5('0x12')](_0x0af5('0x9'),auth[_0x0af5('0x7')](),controller['destroy']);module[_0x0af5('0x13')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index c7ae2e3..83e52e2 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 _0x7af2=['exports','STRING','sequelize'];(function(_0x20e702,_0x37eafd){var _0x4cd3a0=function(_0x90105a){while(--_0x90105a){_0x20e702['push'](_0x20e702['shift']());}};_0x4cd3a0(++_0x37eafd);}(_0x7af2,0x1dc));var _0x27af=function(_0x2ef345,_0x7edda2){_0x2ef345=_0x2ef345-0x0;var _0x3dbad6=_0x7af2[_0x2ef345];return _0x3dbad6;};'use strict';var Sequelize=require(_0x27af('0x0'));module[_0x27af('0x1')]={'name':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x27af('0x2')]},'password':{'type':Sequelize[_0x27af('0x2')]},'remoteUri':{'type':Sequelize[_0x27af('0x2')]},'tenantId':{'type':Sequelize[_0x27af('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x27af('0x2')]},'serverUrl':{'type':Sequelize[_0x27af('0x2')]},'description':{'type':Sequelize[_0x27af('0x2')]}}; \ No newline at end of file +var _0xba05=['STRING','exports'];(function(_0x3b5053,_0x34af47){var _0x29124a=function(_0x3a2895){while(--_0x3a2895){_0x3b5053['push'](_0x3b5053['shift']());}};_0x29124a(++_0x34af47);}(_0xba05,0xb7));var _0x5ba0=function(_0x1d24eb,_0x12295b){_0x1d24eb=_0x1d24eb-0x0;var _0x1dc576=_0xba05[_0x1d24eb];return _0x1dc576;};'use strict';var Sequelize=require('sequelize');module[_0x5ba0('0x0')]={'name':{'type':Sequelize[_0x5ba0('0x1')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x5ba0('0x1')]},'remoteUri':{'type':Sequelize['STRING']},'tenantId':{'type':Sequelize[_0x5ba0('0x1')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x5ba0('0x1')]},'serverUrl':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x5ba0('0x1')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 6f901db..473c438 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 _0xc8a0=['PicklistAttributeMetadata','all','isNil','push','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','DecimalAttributeMetadata','statusCode','Wrong\x20credentials',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','OptionSet','Options','UserLocalizedLabel','Label','Value','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','FalseOption','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','client','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','message','result','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','send','index','map','Dynamics365Account','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','keys','find','create','body','params','getConfigurations','rawAttributes','hasOwnProperty','addConfiguration','findOne','AccountId','getSubjects','channel','Descriptions','getDescriptions','Dynamics365Configuration','Dynamics365Field','Subjects','ticketType','incident','Incident','PhoneCall','title','description','customerid','ownerid','caseorigincode','subject','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','accountidyominame','billedserviceunits','contactidname','contactidyominame','contractdetailidname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridyominame','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','followupby','influencescore','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','msdyn_incidenttypename','onholdtime','overriddencreatedon','owneridname','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','resolveby','resolvebykpiidname','responseby','sentimentvalue','slainvokedidname','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','traversedpath','utcconversiontimezonecode','versionnumber','concat','username','password','remoteUri','tenantId','clientId','clientSecret','slice','lastIndexOf','format','%s/api/data/v9.0/','POST','https://login.microsoftonline.com/','/oauth2/token','access_token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','remove','includes','LogicalName','forEach','@odata.type','substring'];(function(_0x485abd,_0x32c7c1){var _0x3379f1=function(_0x36b528){while(--_0x36b528){_0x485abd['push'](_0x485abd['shift']());}};_0x3379f1(++_0x32c7c1);}(_0xc8a0,0xf8));var _0x0c8a=function(_0x1f3dcc,_0x39e9f9){_0x1f3dcc=_0x1f3dcc-0x0;var _0xf990ba=_0xc8a0[_0x1f3dcc];return _0xf990ba;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x0c8a('0x0'));var rimraf=require(_0x0c8a('0x1'));var zipdir=require(_0x0c8a('0x2'));var jsonpatch=require(_0x0c8a('0x3'));var rp=require(_0x0c8a('0x4'));var moment=require(_0x0c8a('0x5'));var BPromise=require(_0x0c8a('0x6'));var Mustache=require(_0x0c8a('0x7'));var util=require('util');var path=require(_0x0c8a('0x8'));var sox=require(_0x0c8a('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x0c8a('0xa'));var squel=require(_0x0c8a('0xb'));var crypto=require(_0x0c8a('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x0c8a('0xd'));var toCsv=require(_0x0c8a('0xe'));var querystring=require(_0x0c8a('0xf'));var Papa=require(_0x0c8a('0x10'));var Redis=require(_0x0c8a('0x11'));var authService=require(_0x0c8a('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x0c8a('0x13'));var hardwareService=require(_0x0c8a('0x14'));var logger=require(_0x0c8a('0x15'))('api');var utils=require(_0x0c8a('0x16'));var config=require(_0x0c8a('0x17'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');var jayson=require('jayson/promise');var client=jayson[_0x0c8a('0x18')]['http']({'port':0x232a});function checkPasswordPattern(_0x10b22,_0x434a71,_0x16afc0){if(_0x16afc0){var _0x3e7c5d=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3e7c5d[_0x0c8a('0x19')](_0x434a71)){return _0x10b22;}else{throw new db[(_0x0c8a('0x1a'))][(_0x0c8a('0x1b'))](_0x0c8a('0x1c'));}}else{return _0x10b22;}}function respondWithRpcPromise(_0x3bcb58,_0x5d150c,_0x577a47,_0x3efc5c){return new BPromise(function(_0x4c6b56,_0x49fe46){var _0x4b1409=_0x3efc5c||client;return _0x4b1409[_0x0c8a('0x1d')](_0x3bcb58,_0x577a47)[_0x0c8a('0x1e')](function(_0x51b9c8){logger[_0x0c8a('0x1f')](_0x0c8a('0x20'),_0x5d150c,_0x0c8a('0x21'));logger[_0x0c8a('0x22')](_0x0c8a('0x23'),_0x5d150c,_0x0c8a('0x21'),JSON[_0x0c8a('0x24')](_0x51b9c8));if(_0x51b9c8['error']){if(_0x51b9c8[_0x0c8a('0x25')]['code']===0x1f4){logger[_0x0c8a('0x25')](_0x0c8a('0x20'),_0x5d150c,_0x51b9c8[_0x0c8a('0x25')][_0x0c8a('0x26')]);return _0x49fe46(_0x51b9c8[_0x0c8a('0x25')][_0x0c8a('0x26')]);}logger[_0x0c8a('0x25')](_0x0c8a('0x20'),_0x5d150c,_0x51b9c8[_0x0c8a('0x25')]['message']);return _0x4c6b56(_0x51b9c8[_0x0c8a('0x25')][_0x0c8a('0x26')]);}else{logger['info'](_0x0c8a('0x20'),_0x5d150c,_0x0c8a('0x21'));_0x4c6b56(_0x51b9c8[_0x0c8a('0x27')][_0x0c8a('0x26')]);}})['catch'](function(_0x1611da){logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x5d150c,_0x1611da);_0x49fe46(_0x1611da);});});}function respondWithStatusCode(_0x2887d9,_0x1fd560){_0x1fd560=_0x1fd560||0xcc;return function(_0x236187){if(_0x236187){return _0x2887d9['sendStatus'](_0x1fd560);}return _0x2887d9[_0x0c8a('0x28')](_0x1fd560)[_0x0c8a('0x29')]();};}function respondWithResult(_0x3afdbe,_0x5cab97){_0x5cab97=_0x5cab97||0xc8;return function(_0xc9e4d1){if(_0xc9e4d1){return _0x3afdbe[_0x0c8a('0x28')](_0x5cab97)[_0x0c8a('0x2a')](_0xc9e4d1);}};}function respondWithFilteredResult(_0xeec116,_0x3faded){return function(_0x76f459){if(_0x76f459){var _0x28a638=_0x76f459[_0x0c8a('0x2b')],_0x167caa=_0x3faded[_0x0c8a('0x2c')],_0x22b21f=_0x3faded[_0x0c8a('0x2c')]+_0x3faded[_0x0c8a('0x2d')],_0x3062ad;if(_0x22b21f>=_0x28a638){_0x22b21f=_0x28a638;_0x3062ad=0xc8;}else{_0x3062ad=0xce;}_0xeec116[_0x0c8a('0x28')](_0x3062ad);return _0xeec116['set'](_0x0c8a('0x2e'),_0x167caa+'-'+_0x22b21f+'/'+_0x28a638)[_0x0c8a('0x2a')](_0x76f459);}return null;};}function patchUpdates(_0x2091b8){return function(_0x20c2bb){try{jsonpatch[_0x0c8a('0x2f')](_0x20c2bb,_0x2091b8,!![]);}catch(_0x3e35c2){return BPromise[_0x0c8a('0x30')](_0x3e35c2);}return _0x20c2bb[_0x0c8a('0x31')]();};}function saveUpdates(_0x9f7d2f,_0x46e8a3){return function(_0x399a43){if(_0x399a43){return _0x399a43[_0x0c8a('0x32')](_0x9f7d2f)[_0x0c8a('0x1e')](function(_0x2d5153){return _0x2d5153;});}return null;};}function removeEntity(_0x2824ae,_0x5ecf76){return function(_0x5c7963){if(_0x5c7963){return _0x5c7963[_0x0c8a('0x33')]()[_0x0c8a('0x1e')](function(){_0x2824ae[_0x0c8a('0x28')](0xcc)[_0x0c8a('0x29')]();});}};}function handleEntityNotFound(_0x39e879,_0x5359b6){return function(_0x1e3daf){if(!_0x1e3daf){_0x39e879[_0x0c8a('0x34')](0x194);}return _0x1e3daf;};}function handleError(_0x2f8797,_0x3e20b0){_0x3e20b0=_0x3e20b0||0x1f4;return function(_0x4220f9){logger[_0x0c8a('0x25')](_0x4220f9[_0x0c8a('0x35')]);if(_0x4220f9[_0x0c8a('0x36')]){delete _0x4220f9[_0x0c8a('0x36')];}_0x2f8797[_0x0c8a('0x28')](_0x3e20b0)[_0x0c8a('0x37')](_0x4220f9);};}exports[_0x0c8a('0x38')]=function(_0x2147bd,_0x22da85){var _0xfd5c14={},_0x116b16={},_0xce7753={'count':0x0,'rows':[]};var _0x4f858a=_[_0x0c8a('0x39')](db[_0x0c8a('0x3a')]['rawAttributes'],function(_0x20ec44){return{'name':_0x20ec44[_0x0c8a('0x3b')],'type':_0x20ec44[_0x0c8a('0x3c')][_0x0c8a('0x3d')]};});_0x116b16[_0x0c8a('0x3e')]=_[_0x0c8a('0x39')](_0x4f858a,_0x0c8a('0x36'));_0x116b16[_0x0c8a('0x3f')]=_['keys'](_0x2147bd[_0x0c8a('0x3f')]);_0x116b16[_0x0c8a('0x40')]=_[_0x0c8a('0x41')](_0x116b16[_0x0c8a('0x3e')],_0x116b16['query']);_0xfd5c14[_0x0c8a('0x42')]=_['intersection'](_0x116b16[_0x0c8a('0x3e')],qs[_0x0c8a('0x43')](_0x2147bd[_0x0c8a('0x3f')][_0x0c8a('0x43')]));_0xfd5c14[_0x0c8a('0x42')]=_0xfd5c14[_0x0c8a('0x42')][_0x0c8a('0x44')]?_0xfd5c14[_0x0c8a('0x42')]:_0x116b16[_0x0c8a('0x3e')];if(!_0x2147bd['query']['hasOwnProperty'](_0x0c8a('0x45'))){_0xfd5c14[_0x0c8a('0x2d')]=qs[_0x0c8a('0x2d')](_0x2147bd['query'][_0x0c8a('0x2d')]);_0xfd5c14[_0x0c8a('0x2c')]=qs[_0x0c8a('0x2c')](_0x2147bd[_0x0c8a('0x3f')]['offset']);}_0xfd5c14[_0x0c8a('0x46')]=qs['sort'](_0x2147bd[_0x0c8a('0x3f')][_0x0c8a('0x47')]);_0xfd5c14[_0x0c8a('0x48')]=qs[_0x0c8a('0x40')](_[_0x0c8a('0x49')](_0x2147bd[_0x0c8a('0x3f')],_0x116b16[_0x0c8a('0x40')]),_0x4f858a);if(_0x2147bd[_0x0c8a('0x3f')][_0x0c8a('0x4a')]){_0xfd5c14[_0x0c8a('0x48')]=_[_0x0c8a('0x4b')](_0xfd5c14[_0x0c8a('0x48')],{'$or':_[_0x0c8a('0x39')](_0x4f858a,function(_0x57e915){if(_0x57e915['type']!=='VIRTUAL'){var _0x67ab14={};_0x67ab14[_0x57e915[_0x0c8a('0x36')]]={'$like':'%'+_0x2147bd[_0x0c8a('0x3f')][_0x0c8a('0x4a')]+'%'};return _0x67ab14;}})});}_0xfd5c14=_[_0x0c8a('0x4b')]({},_0xfd5c14,_0x2147bd[_0x0c8a('0x4c')]);var _0x1852c9={'where':_0xfd5c14[_0x0c8a('0x48')]};return db[_0x0c8a('0x3a')][_0x0c8a('0x2b')](_0x1852c9)[_0x0c8a('0x1e')](function(_0xa83083){_0xce7753[_0x0c8a('0x2b')]=_0xa83083;if(_0x2147bd[_0x0c8a('0x3f')][_0x0c8a('0x4d')]){_0xfd5c14[_0x0c8a('0x4e')]=[{'all':!![]}];}return db[_0x0c8a('0x3a')][_0x0c8a('0x4f')](_0xfd5c14);})[_0x0c8a('0x1e')](function(_0x511122){_0xce7753[_0x0c8a('0x50')]=_0x511122;return _0xce7753;})[_0x0c8a('0x1e')](respondWithFilteredResult(_0x22da85,_0xfd5c14))[_0x0c8a('0x51')](handleError(_0x22da85,null));};exports['show']=function(_0x122d55,_0x27d9bd){var _0x4fedc8={'raw':![],'where':{'id':_0x122d55['params']['id']}},_0x50919c={};_0x50919c[_0x0c8a('0x3e')]=_['keys'](db['Dynamics365Account']['rawAttributes']);_0x50919c[_0x0c8a('0x3f')]=_[_0x0c8a('0x52')](_0x122d55[_0x0c8a('0x3f')]);_0x50919c[_0x0c8a('0x40')]=_[_0x0c8a('0x41')](_0x50919c[_0x0c8a('0x3e')],_0x50919c[_0x0c8a('0x3f')]);_0x4fedc8[_0x0c8a('0x42')]=_[_0x0c8a('0x41')](_0x50919c['model'],qs[_0x0c8a('0x43')](_0x122d55[_0x0c8a('0x3f')][_0x0c8a('0x43')]));_0x4fedc8['attributes']=_0x4fedc8[_0x0c8a('0x42')][_0x0c8a('0x44')]?_0x4fedc8['attributes']:_0x50919c['model'];if(_0x122d55['query'][_0x0c8a('0x4d')]){_0x4fedc8[_0x0c8a('0x4e')]=[{'all':!![]}];}_0x4fedc8=_[_0x0c8a('0x4b')]({},_0x4fedc8,_0x122d55['options']);return db[_0x0c8a('0x3a')][_0x0c8a('0x53')](_0x4fedc8)['then'](handleEntityNotFound(_0x27d9bd,null))[_0x0c8a('0x1e')](respondWithResult(_0x27d9bd,null))[_0x0c8a('0x51')](handleError(_0x27d9bd,null));};exports[_0x0c8a('0x54')]=function(_0x30722f,_0x5b74f1){return db['Dynamics365Account'][_0x0c8a('0x54')](_0x30722f['body'],{})[_0x0c8a('0x1e')](respondWithResult(_0x5b74f1,0xc9))[_0x0c8a('0x51')](handleError(_0x5b74f1,null));};exports[_0x0c8a('0x32')]=function(_0x37f352,_0x4cb486){if(_0x37f352[_0x0c8a('0x55')]['id']){delete _0x37f352[_0x0c8a('0x55')]['id'];}return db[_0x0c8a('0x3a')][_0x0c8a('0x53')]({'where':{'id':_0x37f352[_0x0c8a('0x56')]['id']}})[_0x0c8a('0x1e')](handleEntityNotFound(_0x4cb486,null))[_0x0c8a('0x1e')](saveUpdates(_0x37f352[_0x0c8a('0x55')],null))[_0x0c8a('0x1e')](respondWithResult(_0x4cb486,null))['catch'](handleError(_0x4cb486,null));};exports[_0x0c8a('0x33')]=function(_0x500c69,_0x5290b2){return db['Dynamics365Account'][_0x0c8a('0x53')]({'where':{'id':_0x500c69[_0x0c8a('0x56')]['id']}})[_0x0c8a('0x1e')](handleEntityNotFound(_0x5290b2,null))[_0x0c8a('0x1e')](removeEntity(_0x5290b2,null))[_0x0c8a('0x51')](handleError(_0x5290b2,null));};exports[_0x0c8a('0x57')]=function(_0x249372,_0x348766,_0x12617e){var _0x31b0af={};var _0x2cc53e={};var _0x435b12;var _0x5b0e50;return db[_0x0c8a('0x3a')]['findOne']({'where':{'id':_0x249372[_0x0c8a('0x56')]['id']}})[_0x0c8a('0x1e')](handleEntityNotFound(_0x348766,null))[_0x0c8a('0x1e')](function(_0x21d5d8){if(_0x21d5d8){_0x435b12=_0x21d5d8;_0x2cc53e['model']=_[_0x0c8a('0x52')](db['Dynamics365Configuration'][_0x0c8a('0x58')]);_0x2cc53e[_0x0c8a('0x3f')]=_[_0x0c8a('0x52')](_0x249372[_0x0c8a('0x3f')]);_0x2cc53e[_0x0c8a('0x40')]=_[_0x0c8a('0x41')](_0x2cc53e['model'],_0x2cc53e[_0x0c8a('0x3f')]);_0x31b0af[_0x0c8a('0x42')]=_[_0x0c8a('0x41')](_0x2cc53e[_0x0c8a('0x3e')],qs[_0x0c8a('0x43')](_0x249372[_0x0c8a('0x3f')][_0x0c8a('0x43')]));_0x31b0af[_0x0c8a('0x42')]=_0x31b0af[_0x0c8a('0x42')][_0x0c8a('0x44')]?_0x31b0af[_0x0c8a('0x42')]:_0x2cc53e['model'];_0x31b0af[_0x0c8a('0x46')]=qs['sort'](_0x249372['query'][_0x0c8a('0x47')]);_0x31b0af['where']=qs[_0x0c8a('0x40')](_[_0x0c8a('0x49')](_0x249372[_0x0c8a('0x3f')],_0x2cc53e['filters']));if(_0x249372[_0x0c8a('0x3f')][_0x0c8a('0x4a')]){_0x31b0af[_0x0c8a('0x48')]=_['merge'](_0x31b0af[_0x0c8a('0x48')],{'$or':_['map'](_0x31b0af[_0x0c8a('0x42')],function(_0x3a3d22){var _0xa6be3c={};_0xa6be3c[_0x3a3d22]={'$like':'%'+_0x249372[_0x0c8a('0x3f')][_0x0c8a('0x4a')]+'%'};return _0xa6be3c;})});}_0x31b0af=_[_0x0c8a('0x4b')]({},_0x31b0af,_0x249372[_0x0c8a('0x4c')]);return _0x435b12[_0x0c8a('0x57')](_0x31b0af);}})[_0x0c8a('0x1e')](function(_0x3ebfa9){if(_0x3ebfa9){_0x5b0e50=_0x3ebfa9['length'];if(!_0x249372[_0x0c8a('0x3f')][_0x0c8a('0x59')](_0x0c8a('0x45'))){_0x31b0af[_0x0c8a('0x2d')]=qs[_0x0c8a('0x2d')](_0x249372[_0x0c8a('0x3f')][_0x0c8a('0x2d')]);_0x31b0af['offset']=qs[_0x0c8a('0x2c')](_0x249372[_0x0c8a('0x3f')]['offset']);}return _0x435b12[_0x0c8a('0x57')](_0x31b0af);}})[_0x0c8a('0x1e')](function(_0x43567c){if(_0x43567c){return _0x43567c?{'count':_0x5b0e50,'rows':_0x43567c}:null;}})[_0x0c8a('0x1e')](respondWithResult(_0x348766,null))[_0x0c8a('0x51')](handleError(_0x348766,null));};exports[_0x0c8a('0x5a')]=function(_0x2eda27,_0x240983,_0x2d9a52){if(_0x2eda27[_0x0c8a('0x55')]['id']){delete _0x2eda27['body']['id'];}return db[_0x0c8a('0x3a')][_0x0c8a('0x5b')]({'where':{'id':_0x2eda27[_0x0c8a('0x56')]['id']}})['then'](handleEntityNotFound(_0x240983,null))[_0x0c8a('0x1e')](function(_0x293365){if(_0x293365){_0x2eda27['body'][_0x0c8a('0x5c')]=_0x293365['id'];_0x2eda27[_0x0c8a('0x55')]['Subjects']=integrations[_0x0c8a('0x5d')](_0x2eda27['body'][_0x0c8a('0x5e')],_0x2eda27[_0x0c8a('0x55')][_0x0c8a('0x3c')]);_0x2eda27[_0x0c8a('0x55')][_0x0c8a('0x5f')]=integrations[_0x0c8a('0x60')](_0x2eda27['body'][_0x0c8a('0x5e')],_0x2eda27[_0x0c8a('0x55')][_0x0c8a('0x3c')]);return db[_0x0c8a('0x61')][_0x0c8a('0x54')](_0x2eda27[_0x0c8a('0x55')],{'include':[{'model':db[_0x0c8a('0x62')],'as':_0x0c8a('0x63')},{'model':db[_0x0c8a('0x62')],'as':_0x0c8a('0x5f')}]});}return null;})[_0x0c8a('0x1e')](respondWithResult(_0x240983,null))[_0x0c8a('0x51')](handleError(_0x240983,null));};exports['getFields']=function(_0x185d80,_0x39e152,_0x2199f8){var _0x33c582=_0x185d80[_0x0c8a('0x3f')][_0x0c8a('0x64')];var _0x56fbc0=_0x33c582===_0x0c8a('0x65')?_0x0c8a('0x66'):_0x0c8a('0x67');var _0x4b1da3='';var _0x55dd83='';var _0x1e7eae='';var _0x2aa9cc='';var _0x3934d2='';var _0x677e24='';var _0x429f48='';var _0x2a06aa='';var _0x23decd=[_0x0c8a('0x68'),_0x0c8a('0x69'),_0x0c8a('0x6a'),_0x0c8a('0x6b'),_0x0c8a('0x6c'),_0x0c8a('0x6d'),_0x0c8a('0x6e'),_0x0c8a('0x6f'),_0x0c8a('0x70'),_0x0c8a('0x71')];var _0x3e64b6=[_0x0c8a('0x72'),_0x0c8a('0x73'),'actualserviceunits',_0x0c8a('0x74'),_0x0c8a('0x75'),_0x0c8a('0x76'),_0x0c8a('0x77'),'contractidname','createdbyexternalpartyname',_0x0c8a('0x78'),_0x0c8a('0x79'),_0x0c8a('0x7a'),'createdon',_0x0c8a('0x7b'),_0x0c8a('0x7c'),_0x0c8a('0x7d'),'customeridtype',_0x0c8a('0x7e'),'emailaddress',_0x0c8a('0x7f'),_0x0c8a('0x80'),_0x0c8a('0x81'),_0x0c8a('0x82'),_0x0c8a('0x83'),'firstresponsebykpiidname',_0x0c8a('0x84'),'importsequencenumber',_0x0c8a('0x85'),'kbarticleidname',_0x0c8a('0x86'),_0x0c8a('0x87'),_0x0c8a('0x88'),_0x0c8a('0x89'),_0x0c8a('0x8a'),_0x0c8a('0x8b'),_0x0c8a('0x8c'),_0x0c8a('0x8d'),'modifiedonbehalfbyyominame',_0x0c8a('0x8e'),'msdyn_iotalertname','numberofchildincidents',_0x0c8a('0x8f'),_0x0c8a('0x90'),_0x0c8a('0x91'),'owneridtype',_0x0c8a('0x92'),_0x0c8a('0x93'),_0x0c8a('0x94'),_0x0c8a('0x95'),_0x0c8a('0x96'),_0x0c8a('0x97'),'productserialnumber',_0x0c8a('0x98'),_0x0c8a('0x99'),_0x0c8a('0x9a'),'responsiblecontactidname','responsiblecontactidyominame',_0x0c8a('0x9b'),_0x0c8a('0x9c'),'slaname','socialprofileidname','statecode',_0x0c8a('0x9d'),_0x0c8a('0x9e'),_0x0c8a('0x9f'),_0x0c8a('0xa0'),'transactioncurrencyidname',_0x0c8a('0xa1'),_0x0c8a('0xa2'),_0x0c8a('0xa3')];var _0x37b038=_0x23decd[_0x0c8a('0xa4')](_0x3e64b6);return db[_0x0c8a('0x3a')][_0x0c8a('0x5b')]({'where':{'id':_0x185d80[_0x0c8a('0x56')]['id']},'attributes':['id',_0x0c8a('0xa5'),_0x0c8a('0xa6'),_0x0c8a('0xa7'),_0x0c8a('0xa8'),_0x0c8a('0xa9'),_0x0c8a('0xaa')]})[_0x0c8a('0x1e')](handleEntityNotFound(_0x39e152,null))['then'](function(_0x3e5447){if(_0x3e5447){_0x2a06aa=_0x3e5447['remoteUri'];var _0x10412c=_0x2a06aa[_0x0c8a('0xab')](-0x1);if(_0x10412c==='/'){_0x2a06aa=_0x2a06aa['substring'](0x0,_0x2a06aa[_0x0c8a('0xac')](_0x10412c));}_0x429f48=util[_0x0c8a('0xad')](_0x0c8a('0xae'),_0x2a06aa);var _0x2f8117={'method':_0x0c8a('0xaf'),'uri':_0x0c8a('0xb0')+_0x3e5447[_0x0c8a('0xa8')]+_0x0c8a('0xb1'),'form':{'client_id':_0x3e5447[_0x0c8a('0xa9')],'resource':_0x2a06aa,'username':_0x3e5447[_0x0c8a('0xa5')],'password':_0x3e5447[_0x0c8a('0xa6')],'grant_type':_0x0c8a('0xa6'),'client_secret':_0x3e5447[_0x0c8a('0xaa')]},'json':!![]};return rp(_0x2f8117);}})[_0x0c8a('0x1e')](function(_0x2cd367){_0x677e24=_0x2cd367[_0x0c8a('0xb2')];var _0x187fcf={'method':_0x0c8a('0xb3'),'uri':encodeURI(_0x429f48+_0x0c8a('0xb4')+_0x56fbc0+'\x27'),'headers':{'Authorization':_0x0c8a('0xb5')+_0x677e24,'If-None-Match':null,'OData-Version':_0x0c8a('0xb6')},'json':!![]};return rp(_0x187fcf);})['then'](function(_0x427ad2){var _0x43b7a5=_0x427ad2[_0x0c8a('0xb7')][0x0];var _0x46d2b2=_0x43b7a5[_0x0c8a('0xb8')];var _0xc2a567={'method':'GET','uri':_0x429f48+_0x0c8a('0xb9')+_0x46d2b2+_0x0c8a('0xba'),'headers':{'Authorization':_0x0c8a('0xb5')+_0x677e24,'If-None-Match':null,'OData-Version':_0x0c8a('0xb6')},'json':!![]};return rp(_0xc2a567);})['then'](function(_0x447864){_0x4b1da3=_0x447864;_0x55dd83=_0x4b1da3[_0x0c8a('0xbb')];_0x55dd83=_[_0x0c8a('0xbc')](_0x55dd83,function(_0x149d98){return!_0x37b038[_0x0c8a('0xbd')](_0x149d98[_0x0c8a('0xbe')]);});var _0x383f97=[];var _0x5faa57=[];_0x55dd83[_0x0c8a('0xbf')](function(_0x2b9fc8){if(_0x2b9fc8['@odata.type']){var _0xfb6007=_0x2b9fc8[_0x0c8a('0xc0')][_0x0c8a('0xc1')](_0x2b9fc8[_0x0c8a('0xc0')]['lastIndexOf']('.')+0x1);if(_0xfb6007===_0x0c8a('0xc2')){_0x383f97['push'](getSelectList(_0x429f48,_0x33c582,_0x5faa57,_0x4b1da3[_0x0c8a('0xb8')],_0x2b9fc8[_0x0c8a('0xb8')],_0x677e24));}}});return Promise[_0x0c8a('0xc3')](_0x383f97);})[_0x0c8a('0x1e')](function(_0x87dbc8){_0x1e7eae=_0x87dbc8[0x0];var _0x40bc88=[];var _0xc365f1=[];_0x55dd83[_0x0c8a('0xbf')](function(_0x49382f){if(!_[_0x0c8a('0xc4')](_0x49382f[_0x0c8a('0xc0')])){var _0x96cde4=_0x49382f[_0x0c8a('0xc0')]['substring'](_0x49382f[_0x0c8a('0xc0')][_0x0c8a('0xac')]('.')+0x1);if(_0x96cde4==='BooleanAttributeMetadata'){_0x40bc88[_0x0c8a('0xc5')](getBooleanList(_0x429f48,_0x33c582,_0xc365f1,_0x4b1da3['MetadataId'],_0x49382f['MetadataId'],_0x677e24));}}});return Promise[_0x0c8a('0xc3')](_0x40bc88);})['then'](function(_0x2d0dce){_0x2aa9cc=_0x2d0dce[0x0];var _0x1a6c2b=[];var _0x2fbae7=[];_0x55dd83[_0x0c8a('0xbf')](function(_0x53aeda){if(_0x53aeda[_0x0c8a('0xc0')]){var _0x41ef17=_0x53aeda[_0x0c8a('0xc0')][_0x0c8a('0xc1')](_0x53aeda[_0x0c8a('0xc0')][_0x0c8a('0xac')]('.')+0x1);if(_0x41ef17===_0x0c8a('0xc6')||_0x41ef17===_0x0c8a('0xc7')||_0x41ef17===_0x0c8a('0xc8')||_0x41ef17==='IntegerAttributeMetadata'||_0x41ef17===_0x0c8a('0xc9')||_0x41ef17===_0x0c8a('0xca')||_0x41ef17===_0x0c8a('0xcb')||_0x41ef17===_0x0c8a('0xcc')||_0x41ef17==='StateAttributeMetadata'||_0x41ef17===_0x0c8a('0xcd')){_0x1a6c2b[_0x0c8a('0xc5')](getInputList(_0x429f48,_0x33c582,_0x41ef17,_0x2fbae7,_0x4b1da3[_0x0c8a('0xb8')],_0x53aeda[_0x0c8a('0xb8')],_0x677e24));}}});return Promise['all'](_0x1a6c2b);})[_0x0c8a('0x1e')](function(_0x47faf5){_0x3934d2=_0x47faf5[0x0];var _0xcf44ab=_0x1e7eae[_0x0c8a('0xa4')](_0x2aa9cc)[_0x0c8a('0xa4')](_0x3934d2);var _0x52f85d={'count':_0xcf44ab['length'],'rows':_0xcf44ab};return _0x52f85d;})[_0x0c8a('0x1e')](respondWithResult(_0x39e152,null))[_0x0c8a('0x51')](function(_0x1e1965){var _0x20b334=_0x185d80[_0x0c8a('0x3f')][_0x0c8a('0x19')]?0x1f4:_0x1e1965[_0x0c8a('0xce')]||0x1f4;logger[_0x0c8a('0x25')](_0x1e1965[_0x0c8a('0x35')]);delete _0x1e1965[_0x0c8a('0x36')];if(_0x20b334===0x191){_0x20b334=0x190;}_0x39e152[_0x0c8a('0x28')](_0x20b334)[_0x0c8a('0x37')](_0x185d80[_0x0c8a('0x3f')][_0x0c8a('0x19')]?{'message':_0x0c8a('0xcf'),'statusCode':_0x1e1965['statusCode']}:_0x1e1965);});};function getSelectList(_0x32de9a,_0x235c84,_0x67667a,_0x3e755f,_0x4e62cc,_0x226e26){var _0x55c9a6={'method':'GET','uri':_0x32de9a+'EntityDefinitions('+_0x3e755f+_0x0c8a('0xd0')+_0x4e62cc+_0x0c8a('0xd1')+'$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','headers':{'Authorization':'Bearer\x20'+_0x226e26,'If-None-Match':null,'OData-Version':_0x0c8a('0xb6')},'json':!![]};return rp(_0x55c9a6)[_0x0c8a('0x1e')](function(_0x2bfff6){var _0xc6d58f=[];var _0x53e38f=_0x2bfff6[_0x0c8a('0xd2')][_0x0c8a('0xd3')];_0x53e38f['forEach'](function(_0x4125a3){_0xc6d58f[_0x0c8a('0xc5')]({'name':_0x4125a3['Label'][_0x0c8a('0xd4')][_0x0c8a('0xd5')],'value':String(_0x4125a3[_0x0c8a('0xd6')])});});var _0x2b05a4={'id':_0x235c84+'_'+_0x2bfff6[_0x0c8a('0xbe')],'name':_0x2bfff6[_0x0c8a('0xd7')][_0x0c8a('0xd4')]['Label'],'custom':![],'options':_0xc6d58f};_0x67667a['push'](_0x2b05a4);return _0x67667a;});}function getBooleanList(_0x4583ed,_0x519643,_0x5c00b9,_0x658680,_0x54cf4e,_0x1ab1a3){var _0x44d60c={'method':_0x0c8a('0xb3'),'uri':_0x4583ed+_0x0c8a('0xb9')+_0x658680+')/Attributes('+_0x54cf4e+_0x0c8a('0xd8'),'headers':{'Authorization':'Bearer\x20'+_0x1ab1a3,'If-None-Match':null,'OData-Version':_0x0c8a('0xb6')},'json':!![]};return rp(_0x44d60c)[_0x0c8a('0x1e')](function(_0x1a14e8){var _0x33ff6d=[];_0x33ff6d[_0x0c8a('0xc5')]({'name':_0x1a14e8[_0x0c8a('0xd2')]['TrueOption']['Label']['UserLocalizedLabel'][_0x0c8a('0xd5')],'value':'true'},{'name':_0x1a14e8[_0x0c8a('0xd2')][_0x0c8a('0xd9')][_0x0c8a('0xd5')]['UserLocalizedLabel'][_0x0c8a('0xd5')],'value':_0x0c8a('0xda')});var _0x558b02={'id':_0x519643+'_'+_0x1a14e8[_0x0c8a('0xbe')],'name':_0x1a14e8[_0x0c8a('0xd7')][_0x0c8a('0xd4')]['Label'],'custom':![],'options':_0x33ff6d};_0x5c00b9[_0x0c8a('0xc5')](_0x558b02);return _0x5c00b9;});}function getInputList(_0x47b9bb,_0x9562de,_0x50f9c1,_0x4859ed,_0x35e07e,_0x3ea89e,_0xbf3083){var _0x525626={'method':_0x0c8a('0xb3'),'uri':_0x47b9bb+'EntityDefinitions('+_0x35e07e+_0x0c8a('0xd0')+_0x3ea89e+_0x0c8a('0xdb')+_0x50f9c1+_0x0c8a('0xdc'),'headers':{'Authorization':'Bearer\x20'+_0xbf3083,'If-None-Match':null,'OData-Version':_0x0c8a('0xb6')},'json':!![]};return rp(_0x525626)[_0x0c8a('0x1e')](function(_0x37875f){var _0x536b25={'id':_0x9562de+'_'+_0x37875f[_0x0c8a('0xbe')],'name':_0x37875f['DisplayName'][_0x0c8a('0xd4')]?_0x37875f[_0x0c8a('0xd7')][_0x0c8a('0xd4')][_0x0c8a('0xd5')]:_0x37875f[_0x0c8a('0xbe')],'custom':![],'options':[]};_0x4859ed[_0x0c8a('0xc5')](_0x536b25);return _0x4859ed;});} \ No newline at end of file +var _0x1e48=['destroy','getConfigurations','Dynamics365Configuration','options','addConfiguration','findOne','AccountId','channel','getDescriptions','Dynamics365Field','Subjects','Descriptions','getFields','Incident','PhoneCall','title','description','customerid','ownerid','caseorigincode','subject','regardingobjectid','directioncode','phonecall_activity_parties','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyyominame','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','escalatedon','followupby','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','numberofchildincidents','owneridname','owneridtype','owneridyominame','primarycontactidname','primarycontactidyominame','productserialnumber','resolveby','resolvebykpiidname','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statecode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','remoteUri','tenantId','clientId','clientSecret','substring','lastIndexOf','format','%s/api/data/v9.0/','POST','https://login.microsoftonline.com/','/oauth2/token','username','password','access_token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','4.0','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','remove','LogicalName','@odata.type','PicklistAttributeMetadata','push','all','isNil','BooleanAttributeMetadata','DoubleAttributeMetadata','MemoAttributeMetadata','StatusAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','concat','Wrong\x20credentials','statusCode',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','Bearer\x20','OptionSet','forEach','UserLocalizedLabel','Value','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','Label','true','FalseOption','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','to-csv','ejs','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','client','http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','stack','send','index','map','Dynamics365Account','rawAttributes','fieldName','type','key','model','name','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','include','catch','includeAll','create','body','find','params'];(function(_0x41195c,_0x55c7aa){var _0xdd5dfb=function(_0x23859f){while(--_0x23859f){_0x41195c['push'](_0x41195c['shift']());}};_0xdd5dfb(++_0x55c7aa);}(_0x1e48,0x81));var _0x81e4=function(_0x27bd9b,_0x206238){_0x27bd9b=_0x27bd9b-0x0;var _0xbd6219=_0x1e48[_0x27bd9b];return _0xbd6219;};'use strict';var pdf=require(_0x81e4('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x81e4('0x1'));var zipdir=require(_0x81e4('0x2'));var jsonpatch=require(_0x81e4('0x3'));var rp=require(_0x81e4('0x4'));var moment=require(_0x81e4('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x81e4('0x6'));var util=require('util');var path=require('path');var sox=require(_0x81e4('0x7'));var csv=require(_0x81e4('0x8'));var ejs=require(_0x81e4('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x81e4('0xa'));var toCsv=require('to-csv');var querystring=require(_0x81e4('0xb'));var Papa=require(_0x81e4('0xc'));var Redis=require(_0x81e4('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x81e4('0xe'));var as=require(_0x81e4('0xf'));var hardwareService=require(_0x81e4('0x10'));var logger=require(_0x81e4('0x11'))(_0x81e4('0x12'));var utils=require(_0x81e4('0x13'));var config=require(_0x81e4('0x14'));var db=require(_0x81e4('0x15'))['db'];var integrations=require(_0x81e4('0x16'));var jayson=require('jayson/promise');var client=jayson[_0x81e4('0x17')][_0x81e4('0x18')]({'port':0x232a});function checkPasswordPattern(_0x34f250,_0x21da91,_0x21e47b){if(_0x21e47b){var _0x4d5da6=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4d5da6[_0x81e4('0x19')](_0x21da91)){return _0x34f250;}else{throw new db['Sequelize'][(_0x81e4('0x1a'))](_0x81e4('0x1b'));}}else{return _0x34f250;}}function respondWithRpcPromise(_0x53e02b,_0xe3558e,_0x5e78d9,_0x347362){return new BPromise(function(_0x4316fc,_0x527802){var _0x10a6ce=_0x347362||client;return _0x10a6ce[_0x81e4('0x1c')](_0x53e02b,_0x5e78d9)[_0x81e4('0x1d')](function(_0xa373d8){logger[_0x81e4('0x1e')](_0x81e4('0x1f'),_0xe3558e,_0x81e4('0x20'));logger[_0x81e4('0x21')](_0x81e4('0x22'),_0xe3558e,_0x81e4('0x20'),JSON[_0x81e4('0x23')](_0xa373d8));if(_0xa373d8['error']){if(_0xa373d8['error'][_0x81e4('0x24')]===0x1f4){logger[_0x81e4('0x25')](_0x81e4('0x1f'),_0xe3558e,_0xa373d8['error']['message']);return _0x527802(_0xa373d8['error'][_0x81e4('0x26')]);}logger[_0x81e4('0x25')](_0x81e4('0x1f'),_0xe3558e,_0xa373d8[_0x81e4('0x25')][_0x81e4('0x26')]);return _0x4316fc(_0xa373d8[_0x81e4('0x25')][_0x81e4('0x26')]);}else{logger['info'](_0x81e4('0x1f'),_0xe3558e,_0x81e4('0x20'));_0x4316fc(_0xa373d8[_0x81e4('0x27')][_0x81e4('0x26')]);}})['catch'](function(_0x57388e){logger[_0x81e4('0x25')](_0x81e4('0x1f'),_0xe3558e,_0x57388e);_0x527802(_0x57388e);});});}function respondWithStatusCode(_0x8a9496,_0x3c8615){_0x3c8615=_0x3c8615||0xcc;return function(_0x9aa388){if(_0x9aa388){return _0x8a9496[_0x81e4('0x28')](_0x3c8615);}return _0x8a9496[_0x81e4('0x29')](_0x3c8615)[_0x81e4('0x2a')]();};}function respondWithResult(_0x555851,_0x3598e2){_0x3598e2=_0x3598e2||0xc8;return function(_0x25ee8d){if(_0x25ee8d){return _0x555851['status'](_0x3598e2)[_0x81e4('0x2b')](_0x25ee8d);}};}function respondWithFilteredResult(_0x514eac,_0xdb8fa8){return function(_0x44c07c){if(_0x44c07c){var _0x5e4e68=_0x44c07c[_0x81e4('0x2c')],_0x5518db=_0xdb8fa8[_0x81e4('0x2d')],_0x52ff64=_0xdb8fa8[_0x81e4('0x2d')]+_0xdb8fa8[_0x81e4('0x2e')],_0x2f1757;if(_0x52ff64>=_0x5e4e68){_0x52ff64=_0x5e4e68;_0x2f1757=0xc8;}else{_0x2f1757=0xce;}_0x514eac[_0x81e4('0x29')](_0x2f1757);return _0x514eac['set'](_0x81e4('0x2f'),_0x5518db+'-'+_0x52ff64+'/'+_0x5e4e68)[_0x81e4('0x2b')](_0x44c07c);}return null;};}function patchUpdates(_0x532dc2){return function(_0x46ae72){try{jsonpatch[_0x81e4('0x30')](_0x46ae72,_0x532dc2,!![]);}catch(_0x130941){return BPromise[_0x81e4('0x31')](_0x130941);}return _0x46ae72[_0x81e4('0x32')]();};}function saveUpdates(_0x48d6ce,_0x376c60){return function(_0x56f988){if(_0x56f988){return _0x56f988[_0x81e4('0x33')](_0x48d6ce)['then'](function(_0xc25f1){return _0xc25f1;});}return null;};}function removeEntity(_0x5d54e7,_0x33e849){return function(_0x3f99c1){if(_0x3f99c1){return _0x3f99c1['destroy']()[_0x81e4('0x1d')](function(){_0x5d54e7[_0x81e4('0x29')](0xcc)[_0x81e4('0x2a')]();});}};}function handleEntityNotFound(_0xbf366e,_0x5cc0d8){return function(_0x4d3ff8){if(!_0x4d3ff8){_0xbf366e['sendStatus'](0x194);}return _0x4d3ff8;};}function handleError(_0x3fd1e1,_0x54b59f){_0x54b59f=_0x54b59f||0x1f4;return function(_0xd28fac){logger[_0x81e4('0x25')](_0xd28fac[_0x81e4('0x34')]);if(_0xd28fac['name']){delete _0xd28fac['name'];}_0x3fd1e1[_0x81e4('0x29')](_0x54b59f)[_0x81e4('0x35')](_0xd28fac);};}exports[_0x81e4('0x36')]=function(_0x306033,_0x447213){var _0x473f7a={},_0x4cf35f={},_0x1a121c={'count':0x0,'rows':[]};var _0x596223=_[_0x81e4('0x37')](db[_0x81e4('0x38')][_0x81e4('0x39')],function(_0x56eddd){return{'name':_0x56eddd[_0x81e4('0x3a')],'type':_0x56eddd[_0x81e4('0x3b')][_0x81e4('0x3c')]};});_0x4cf35f[_0x81e4('0x3d')]=_[_0x81e4('0x37')](_0x596223,_0x81e4('0x3e'));_0x4cf35f['query']=_[_0x81e4('0x3f')](_0x306033[_0x81e4('0x40')]);_0x4cf35f['filters']=_[_0x81e4('0x41')](_0x4cf35f[_0x81e4('0x3d')],_0x4cf35f['query']);_0x473f7a[_0x81e4('0x42')]=_['intersection'](_0x4cf35f[_0x81e4('0x3d')],qs[_0x81e4('0x43')](_0x306033[_0x81e4('0x40')]['fields']));_0x473f7a['attributes']=_0x473f7a[_0x81e4('0x42')][_0x81e4('0x44')]?_0x473f7a[_0x81e4('0x42')]:_0x4cf35f[_0x81e4('0x3d')];if(!_0x306033[_0x81e4('0x40')][_0x81e4('0x45')](_0x81e4('0x46'))){_0x473f7a['limit']=qs['limit'](_0x306033[_0x81e4('0x40')][_0x81e4('0x2e')]);_0x473f7a['offset']=qs['offset'](_0x306033['query'][_0x81e4('0x2d')]);}_0x473f7a[_0x81e4('0x47')]=qs[_0x81e4('0x48')](_0x306033[_0x81e4('0x40')]['sort']);_0x473f7a['where']=qs[_0x81e4('0x49')](_[_0x81e4('0x4a')](_0x306033[_0x81e4('0x40')],_0x4cf35f['filters']),_0x596223);if(_0x306033[_0x81e4('0x40')][_0x81e4('0x4b')]){_0x473f7a[_0x81e4('0x4c')]=_[_0x81e4('0x4d')](_0x473f7a['where'],{'$or':_[_0x81e4('0x37')](_0x596223,function(_0x570fd7){if(_0x570fd7['type']!==_0x81e4('0x4e')){var _0x5c04bf={};_0x5c04bf[_0x570fd7[_0x81e4('0x3e')]]={'$like':'%'+_0x306033[_0x81e4('0x40')][_0x81e4('0x4b')]+'%'};return _0x5c04bf;}})});}_0x473f7a=_[_0x81e4('0x4d')]({},_0x473f7a,_0x306033['options']);var _0xdcfe8f={'where':_0x473f7a[_0x81e4('0x4c')]};return db[_0x81e4('0x38')][_0x81e4('0x2c')](_0xdcfe8f)[_0x81e4('0x1d')](function(_0x5da993){_0x1a121c[_0x81e4('0x2c')]=_0x5da993;if(_0x306033[_0x81e4('0x40')]['includeAll']){_0x473f7a[_0x81e4('0x4f')]=[{'all':!![]}];}return db['Dynamics365Account']['findAll'](_0x473f7a);})['then'](function(_0x108809){_0x1a121c['rows']=_0x108809;return _0x1a121c;})[_0x81e4('0x1d')](respondWithFilteredResult(_0x447213,_0x473f7a))[_0x81e4('0x50')](handleError(_0x447213,null));};exports['show']=function(_0x2ea4e2,_0x46a69e){var _0x19ca3e={'raw':![],'where':{'id':_0x2ea4e2['params']['id']}},_0x257031={};_0x257031[_0x81e4('0x3d')]=_[_0x81e4('0x3f')](db['Dynamics365Account'][_0x81e4('0x39')]);_0x257031[_0x81e4('0x40')]=_[_0x81e4('0x3f')](_0x2ea4e2['query']);_0x257031[_0x81e4('0x49')]=_[_0x81e4('0x41')](_0x257031[_0x81e4('0x3d')],_0x257031['query']);_0x19ca3e[_0x81e4('0x42')]=_[_0x81e4('0x41')](_0x257031[_0x81e4('0x3d')],qs['fields'](_0x2ea4e2[_0x81e4('0x40')]['fields']));_0x19ca3e[_0x81e4('0x42')]=_0x19ca3e[_0x81e4('0x42')][_0x81e4('0x44')]?_0x19ca3e[_0x81e4('0x42')]:_0x257031[_0x81e4('0x3d')];if(_0x2ea4e2['query'][_0x81e4('0x51')]){_0x19ca3e[_0x81e4('0x4f')]=[{'all':!![]}];}_0x19ca3e=_[_0x81e4('0x4d')]({},_0x19ca3e,_0x2ea4e2['options']);return db['Dynamics365Account']['find'](_0x19ca3e)[_0x81e4('0x1d')](handleEntityNotFound(_0x46a69e,null))[_0x81e4('0x1d')](respondWithResult(_0x46a69e,null))['catch'](handleError(_0x46a69e,null));};exports[_0x81e4('0x52')]=function(_0x37444d,_0x56f5ba){return db[_0x81e4('0x38')]['create'](_0x37444d['body'],{})['then'](respondWithResult(_0x56f5ba,0xc9))['catch'](handleError(_0x56f5ba,null));};exports[_0x81e4('0x33')]=function(_0x347a4c,_0x349021){if(_0x347a4c[_0x81e4('0x53')]['id']){delete _0x347a4c[_0x81e4('0x53')]['id'];}return db['Dynamics365Account'][_0x81e4('0x54')]({'where':{'id':_0x347a4c[_0x81e4('0x55')]['id']}})[_0x81e4('0x1d')](handleEntityNotFound(_0x349021,null))['then'](saveUpdates(_0x347a4c[_0x81e4('0x53')],null))[_0x81e4('0x1d')](respondWithResult(_0x349021,null))[_0x81e4('0x50')](handleError(_0x349021,null));};exports[_0x81e4('0x56')]=function(_0x271a0f,_0x2318df){return db[_0x81e4('0x38')][_0x81e4('0x54')]({'where':{'id':_0x271a0f[_0x81e4('0x55')]['id']}})['then'](handleEntityNotFound(_0x2318df,null))[_0x81e4('0x1d')](removeEntity(_0x2318df,null))['catch'](handleError(_0x2318df,null));};exports[_0x81e4('0x57')]=function(_0x328eed,_0x120732,_0x53adfb){var _0x3700bd={};var _0x35d31c={};var _0x164e8b;var _0x2bb962;return db[_0x81e4('0x38')]['findOne']({'where':{'id':_0x328eed[_0x81e4('0x55')]['id']}})['then'](handleEntityNotFound(_0x120732,null))[_0x81e4('0x1d')](function(_0x5e4122){if(_0x5e4122){_0x164e8b=_0x5e4122;_0x35d31c[_0x81e4('0x3d')]=_[_0x81e4('0x3f')](db[_0x81e4('0x58')][_0x81e4('0x39')]);_0x35d31c[_0x81e4('0x40')]=_[_0x81e4('0x3f')](_0x328eed[_0x81e4('0x40')]);_0x35d31c[_0x81e4('0x49')]=_['intersection'](_0x35d31c[_0x81e4('0x3d')],_0x35d31c[_0x81e4('0x40')]);_0x3700bd[_0x81e4('0x42')]=_[_0x81e4('0x41')](_0x35d31c[_0x81e4('0x3d')],qs[_0x81e4('0x43')](_0x328eed['query'][_0x81e4('0x43')]));_0x3700bd[_0x81e4('0x42')]=_0x3700bd[_0x81e4('0x42')][_0x81e4('0x44')]?_0x3700bd[_0x81e4('0x42')]:_0x35d31c[_0x81e4('0x3d')];_0x3700bd[_0x81e4('0x47')]=qs['sort'](_0x328eed[_0x81e4('0x40')][_0x81e4('0x48')]);_0x3700bd[_0x81e4('0x4c')]=qs[_0x81e4('0x49')](_['pick'](_0x328eed[_0x81e4('0x40')],_0x35d31c[_0x81e4('0x49')]));if(_0x328eed[_0x81e4('0x40')]['filter']){_0x3700bd[_0x81e4('0x4c')]=_[_0x81e4('0x4d')](_0x3700bd['where'],{'$or':_[_0x81e4('0x37')](_0x3700bd[_0x81e4('0x42')],function(_0x4f8fce){var _0x1a2ec4={};_0x1a2ec4[_0x4f8fce]={'$like':'%'+_0x328eed[_0x81e4('0x40')][_0x81e4('0x4b')]+'%'};return _0x1a2ec4;})});}_0x3700bd=_[_0x81e4('0x4d')]({},_0x3700bd,_0x328eed[_0x81e4('0x59')]);return _0x164e8b[_0x81e4('0x57')](_0x3700bd);}})[_0x81e4('0x1d')](function(_0x577e3c){if(_0x577e3c){_0x2bb962=_0x577e3c[_0x81e4('0x44')];if(!_0x328eed[_0x81e4('0x40')]['hasOwnProperty'](_0x81e4('0x46'))){_0x3700bd[_0x81e4('0x2e')]=qs[_0x81e4('0x2e')](_0x328eed[_0x81e4('0x40')][_0x81e4('0x2e')]);_0x3700bd[_0x81e4('0x2d')]=qs[_0x81e4('0x2d')](_0x328eed[_0x81e4('0x40')][_0x81e4('0x2d')]);}return _0x164e8b[_0x81e4('0x57')](_0x3700bd);}})[_0x81e4('0x1d')](function(_0xed2320){if(_0xed2320){return _0xed2320?{'count':_0x2bb962,'rows':_0xed2320}:null;}})['then'](respondWithResult(_0x120732,null))[_0x81e4('0x50')](handleError(_0x120732,null));};exports[_0x81e4('0x5a')]=function(_0x53eeb4,_0x3b9b58,_0x20b138){if(_0x53eeb4[_0x81e4('0x53')]['id']){delete _0x53eeb4[_0x81e4('0x53')]['id'];}return db[_0x81e4('0x38')][_0x81e4('0x5b')]({'where':{'id':_0x53eeb4[_0x81e4('0x55')]['id']}})[_0x81e4('0x1d')](handleEntityNotFound(_0x3b9b58,null))['then'](function(_0x2afa37){if(_0x2afa37){_0x53eeb4[_0x81e4('0x53')][_0x81e4('0x5c')]=_0x2afa37['id'];_0x53eeb4['body']['Subjects']=integrations['getSubjects'](_0x53eeb4[_0x81e4('0x53')][_0x81e4('0x5d')],_0x53eeb4[_0x81e4('0x53')][_0x81e4('0x3b')]);_0x53eeb4['body']['Descriptions']=integrations[_0x81e4('0x5e')](_0x53eeb4['body'][_0x81e4('0x5d')],_0x53eeb4['body']['type']);return db['Dynamics365Configuration'][_0x81e4('0x52')](_0x53eeb4[_0x81e4('0x53')],{'include':[{'model':db[_0x81e4('0x5f')],'as':_0x81e4('0x60')},{'model':db['Dynamics365Field'],'as':_0x81e4('0x61')}]});}return null;})[_0x81e4('0x1d')](respondWithResult(_0x3b9b58,null))[_0x81e4('0x50')](handleError(_0x3b9b58,null));};exports[_0x81e4('0x62')]=function(_0x21c3b7,_0x21f892,_0x1fc5f8){var _0x19fd12=_0x21c3b7['query']['ticketType'];var _0x5d6453=_0x19fd12==='incident'?_0x81e4('0x63'):_0x81e4('0x64');var _0x4181a0='';var _0x4b6180='';var _0xe28274='';var _0x694a7b='';var _0x522701='';var _0x59dc8c='';var _0x5c8b39='';var _0x2136f6='';var _0x1a7a63=[_0x81e4('0x65'),_0x81e4('0x66'),_0x81e4('0x67'),_0x81e4('0x68'),_0x81e4('0x69'),_0x81e4('0x6a'),'phonenumber',_0x81e4('0x6b'),_0x81e4('0x6c'),_0x81e4('0x6d')];var _0x3793f2=['accountidname',_0x81e4('0x6e'),_0x81e4('0x6f'),_0x81e4('0x70'),_0x81e4('0x71'),_0x81e4('0x72'),_0x81e4('0x73'),_0x81e4('0x74'),_0x81e4('0x75'),_0x81e4('0x76'),'createdbyname',_0x81e4('0x77'),'createdon',_0x81e4('0x78'),_0x81e4('0x79'),_0x81e4('0x7a'),'customeridtype',_0x81e4('0x7b'),_0x81e4('0x7c'),_0x81e4('0x7d'),_0x81e4('0x7e'),'entityimage_url',_0x81e4('0x7f'),'exchangerate','firstresponsebykpiidname',_0x81e4('0x80'),_0x81e4('0x81'),_0x81e4('0x82'),_0x81e4('0x83'),_0x81e4('0x84'),_0x81e4('0x85'),_0x81e4('0x86'),_0x81e4('0x87'),_0x81e4('0x88'),_0x81e4('0x89'),_0x81e4('0x8a'),_0x81e4('0x8b'),'modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname',_0x81e4('0x8c'),'onholdtime','overriddencreatedon',_0x81e4('0x8d'),_0x81e4('0x8e'),_0x81e4('0x8f'),'parentcaseidname',_0x81e4('0x90'),_0x81e4('0x91'),'prioritycodename','productidname',_0x81e4('0x92'),_0x81e4('0x93'),_0x81e4('0x94'),'responseby',_0x81e4('0x95'),_0x81e4('0x96'),_0x81e4('0x97'),_0x81e4('0x98'),_0x81e4('0x99'),_0x81e4('0x9a'),_0x81e4('0x9b'),'statuscode',_0x81e4('0x9c'),_0x81e4('0x9d'),_0x81e4('0x9e'),_0x81e4('0x9f'),_0x81e4('0xa0'),_0x81e4('0xa1'),'versionnumber'];var _0x7bf647=_0x1a7a63['concat'](_0x3793f2);return db['Dynamics365Account'][_0x81e4('0x5b')]({'where':{'id':_0x21c3b7['params']['id']},'attributes':['id','username','password',_0x81e4('0xa2'),_0x81e4('0xa3'),_0x81e4('0xa4'),_0x81e4('0xa5')]})[_0x81e4('0x1d')](handleEntityNotFound(_0x21f892,null))[_0x81e4('0x1d')](function(_0x5bd441){if(_0x5bd441){_0x2136f6=_0x5bd441[_0x81e4('0xa2')];var _0x5667d8=_0x2136f6['slice'](-0x1);if(_0x5667d8==='/'){_0x2136f6=_0x2136f6[_0x81e4('0xa6')](0x0,_0x2136f6[_0x81e4('0xa7')](_0x5667d8));}_0x5c8b39=util[_0x81e4('0xa8')](_0x81e4('0xa9'),_0x2136f6);var _0x11cc5b={'method':_0x81e4('0xaa'),'uri':_0x81e4('0xab')+_0x5bd441[_0x81e4('0xa3')]+_0x81e4('0xac'),'form':{'client_id':_0x5bd441[_0x81e4('0xa4')],'resource':_0x2136f6,'username':_0x5bd441[_0x81e4('0xad')],'password':_0x5bd441['password'],'grant_type':_0x81e4('0xae'),'client_secret':_0x5bd441[_0x81e4('0xa5')]},'json':!![]};return rp(_0x11cc5b);}})[_0x81e4('0x1d')](function(_0x15977a){_0x59dc8c=_0x15977a[_0x81e4('0xaf')];var _0x5273cb={'method':_0x81e4('0xb0'),'uri':encodeURI(_0x5c8b39+_0x81e4('0xb1')+_0x5d6453+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0x59dc8c,'If-None-Match':null,'OData-Version':_0x81e4('0xb2')},'json':!![]};return rp(_0x5273cb);})[_0x81e4('0x1d')](function(_0xffefb4){var _0x2961b9=_0xffefb4['value'][0x0];var _0x47becc=_0x2961b9[_0x81e4('0xb3')];var _0x4e304f={'method':_0x81e4('0xb0'),'uri':_0x5c8b39+_0x81e4('0xb4')+_0x47becc+_0x81e4('0xb5'),'headers':{'Authorization':'Bearer\x20'+_0x59dc8c,'If-None-Match':null,'OData-Version':_0x81e4('0xb2')},'json':!![]};return rp(_0x4e304f);})[_0x81e4('0x1d')](function(_0x5a4c08){_0x4181a0=_0x5a4c08;_0x4b6180=_0x4181a0['Attributes'];_0x4b6180=_[_0x81e4('0xb6')](_0x4b6180,function(_0x25900f){return!_0x7bf647['includes'](_0x25900f[_0x81e4('0xb7')]);});var _0xb6d78a=[];var _0x2591f9=[];_0x4b6180['forEach'](function(_0x7a4f2e){if(_0x7a4f2e['@odata.type']){var _0x2e4f18=_0x7a4f2e[_0x81e4('0xb8')][_0x81e4('0xa6')](_0x7a4f2e[_0x81e4('0xb8')][_0x81e4('0xa7')]('.')+0x1);if(_0x2e4f18===_0x81e4('0xb9')){_0xb6d78a[_0x81e4('0xba')](getSelectList(_0x5c8b39,_0x19fd12,_0x2591f9,_0x4181a0[_0x81e4('0xb3')],_0x7a4f2e['MetadataId'],_0x59dc8c));}}});return Promise[_0x81e4('0xbb')](_0xb6d78a);})[_0x81e4('0x1d')](function(_0x443e8a){_0xe28274=_0x443e8a[0x0];var _0x4ab400=[];var _0x57fafd=[];_0x4b6180['forEach'](function(_0x2053f2){if(!_[_0x81e4('0xbc')](_0x2053f2[_0x81e4('0xb8')])){var _0x2d7671=_0x2053f2[_0x81e4('0xb8')][_0x81e4('0xa6')](_0x2053f2[_0x81e4('0xb8')][_0x81e4('0xa7')]('.')+0x1);if(_0x2d7671===_0x81e4('0xbd')){_0x4ab400[_0x81e4('0xba')](getBooleanList(_0x5c8b39,_0x19fd12,_0x57fafd,_0x4181a0[_0x81e4('0xb3')],_0x2053f2['MetadataId'],_0x59dc8c));}}});return Promise['all'](_0x4ab400);})[_0x81e4('0x1d')](function(_0x1ff5b5){_0x694a7b=_0x1ff5b5[0x0];var _0x5c8ffe=[];var _0x535aaa=[];_0x4b6180['forEach'](function(_0x190109){if(_0x190109[_0x81e4('0xb8')]){var _0x32f14a=_0x190109[_0x81e4('0xb8')]['substring'](_0x190109['@odata.type'][_0x81e4('0xa7')]('.')+0x1);if(_0x32f14a==='StringAttributeMetadata'||_0x32f14a===_0x81e4('0xbe')||_0x32f14a==='BigIntAttributeMetadata'||_0x32f14a==='IntegerAttributeMetadata'||_0x32f14a===_0x81e4('0xbf')||_0x32f14a==='DateTimeAttributeMetadata'||_0x32f14a===_0x81e4('0xc0')||_0x32f14a==='EntityNameAttributeMetadata'||_0x32f14a===_0x81e4('0xc1')||_0x32f14a===_0x81e4('0xc2')){_0x5c8ffe[_0x81e4('0xba')](getInputList(_0x5c8b39,_0x19fd12,_0x32f14a,_0x535aaa,_0x4181a0['MetadataId'],_0x190109['MetadataId'],_0x59dc8c));}}});return Promise[_0x81e4('0xbb')](_0x5c8ffe);})['then'](function(_0x3777eb){_0x522701=_0x3777eb[0x0];var _0xce7367=_0xe28274[_0x81e4('0xc3')](_0x694a7b)[_0x81e4('0xc3')](_0x522701);var _0x3c3bbd={'count':_0xce7367[_0x81e4('0x44')],'rows':_0xce7367};return _0x3c3bbd;})[_0x81e4('0x1d')](respondWithResult(_0x21f892,null))[_0x81e4('0x50')](function(_0x40120a){var _0x366f5a=_0x21c3b7[_0x81e4('0x40')][_0x81e4('0x19')]?0x1f4:_0x40120a['statusCode']||0x1f4;logger[_0x81e4('0x25')](_0x40120a['stack']);delete _0x40120a[_0x81e4('0x3e')];if(_0x366f5a===0x191){_0x366f5a=0x190;}_0x21f892[_0x81e4('0x29')](_0x366f5a)['send'](_0x21c3b7[_0x81e4('0x40')]['test']?{'message':_0x81e4('0xc4'),'statusCode':_0x40120a[_0x81e4('0xc5')]}:_0x40120a);});};function getSelectList(_0x30af87,_0x4e2831,_0x5b4c51,_0x27d524,_0x5a96a7,_0x45c909){var _0x264908={'method':_0x81e4('0xb0'),'uri':_0x30af87+_0x81e4('0xb4')+_0x27d524+_0x81e4('0xc6')+_0x5a96a7+_0x81e4('0xc7')+_0x81e4('0xc8'),'headers':{'Authorization':_0x81e4('0xc9')+_0x45c909,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x264908)[_0x81e4('0x1d')](function(_0x3ace0c){var _0x231b6f=[];var _0x3f9532=_0x3ace0c[_0x81e4('0xca')]['Options'];_0x3f9532[_0x81e4('0xcb')](function(_0x21cbff){_0x231b6f[_0x81e4('0xba')]({'name':_0x21cbff['Label'][_0x81e4('0xcc')]['Label'],'value':String(_0x21cbff[_0x81e4('0xcd')])});});var _0x2465d={'id':_0x4e2831+'_'+_0x3ace0c[_0x81e4('0xb7')],'name':_0x3ace0c[_0x81e4('0xce')][_0x81e4('0xcc')]['Label'],'custom':![],'options':_0x231b6f};_0x5b4c51[_0x81e4('0xba')](_0x2465d);return _0x5b4c51;});}function getBooleanList(_0x41c481,_0xa7f797,_0x331b73,_0x4e52bb,_0x1fe08e,_0x3bd609){var _0x10a635={'method':_0x81e4('0xb0'),'uri':_0x41c481+_0x81e4('0xb4')+_0x4e52bb+_0x81e4('0xc6')+_0x1fe08e+_0x81e4('0xcf'),'headers':{'Authorization':'Bearer\x20'+_0x3bd609,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x10a635)[_0x81e4('0x1d')](function(_0x21d4e5){var _0x2434c9=[];_0x2434c9[_0x81e4('0xba')]({'name':_0x21d4e5[_0x81e4('0xca')][_0x81e4('0xd0')][_0x81e4('0xd1')][_0x81e4('0xcc')][_0x81e4('0xd1')],'value':_0x81e4('0xd2')},{'name':_0x21d4e5[_0x81e4('0xca')][_0x81e4('0xd3')][_0x81e4('0xd1')][_0x81e4('0xcc')][_0x81e4('0xd1')],'value':_0x81e4('0xd4')});var _0x27433d={'id':_0xa7f797+'_'+_0x21d4e5['LogicalName'],'name':_0x21d4e5[_0x81e4('0xce')]['UserLocalizedLabel'][_0x81e4('0xd1')],'custom':![],'options':_0x2434c9};_0x331b73[_0x81e4('0xba')](_0x27433d);return _0x331b73;});}function getInputList(_0x3c2cff,_0x10dfa4,_0x5eeeb4,_0x1eec99,_0x52fda0,_0x43a3c4,_0x4a563d){var _0x5cb738={'method':'GET','uri':_0x3c2cff+_0x81e4('0xb4')+_0x52fda0+_0x81e4('0xc6')+_0x43a3c4+_0x81e4('0xd5')+_0x5eeeb4+_0x81e4('0xd6'),'headers':{'Authorization':'Bearer\x20'+_0x4a563d,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x5cb738)[_0x81e4('0x1d')](function(_0x495f52){var _0x2c0bff={'id':_0x10dfa4+'_'+_0x495f52['LogicalName'],'name':_0x495f52[_0x81e4('0xce')][_0x81e4('0xcc')]?_0x495f52[_0x81e4('0xce')][_0x81e4('0xcc')][_0x81e4('0xd1')]:_0x495f52[_0x81e4('0xb7')],'custom':![],'options':[]};_0x1eec99[_0x81e4('0xba')](_0x2c0bff);return _0x1eec99;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 1661647..41f987a 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 _0x01ce=['../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','../../components/integrations/configuration','exports','define','int_dynamics365_accounts','lodash','util'];(function(_0x791c7b,_0x49bbb6){var _0x110508=function(_0x3d156e){while(--_0x3d156e){_0x791c7b['push'](_0x791c7b['shift']());}};_0x110508(++_0x49bbb6);}(_0x01ce,0xe2));var _0xe01c=function(_0x25f5ba,_0x3b6ba8){_0x25f5ba=_0x25f5ba-0x0;var _0x151382=_0x01ce[_0x25f5ba];return _0x151382;};'use strict';var _=require(_0xe01c('0x0'));var util=require(_0xe01c('0x1'));var logger=require(_0xe01c('0x2'))(_0xe01c('0x3'));var moment=require('moment');var BPromise=require(_0xe01c('0x4'));var rp=require(_0xe01c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe01c('0x6'));var config=require(_0xe01c('0x7'));var attributes=require('./intDynamics365Account.attributes');var integrations=require(_0xe01c('0x8'));module[_0xe01c('0x9')]=function(_0x5e8fc2,_0x4ca988){return _0x5e8fc2[_0xe01c('0xa')]('Dynamics365Account',attributes,{'tableName':_0xe01c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x74f5=['Dynamics365Account','int_dynamics365_accounts','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Account.attributes','define'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x74f5,0x188));var _0x574f=function(_0x22d300,_0x23c213){_0x22d300=_0x22d300-0x0;var _0x4d2a92=_0x74f5[_0x22d300];return _0x4d2a92;};'use strict';var _=require(_0x574f('0x0'));var util=require(_0x574f('0x1'));var logger=require('../../config/logger')(_0x574f('0x2'));var moment=require(_0x574f('0x3'));var BPromise=require(_0x574f('0x4'));var rp=require(_0x574f('0x5'));var fs=require('fs');var path=require(_0x574f('0x6'));var rimraf=require(_0x574f('0x7'));var config=require(_0x574f('0x8'));var attributes=require(_0x574f('0x9'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x23569b,_0x275747){return _0x23569b[_0x574f('0xa')](_0x574f('0xb'),attributes,{'tableName':_0x574f('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 05085d3..aa9bb42 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 _0x8375=['client','http','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','Dynamics365Account,\x20%s,\x20%s,\x20%s','error','message','result','GetDynamics365Account','Dynamics365Account','options','raw','attributes','limit','include','map','model','debug','stringify','catch','ShowDynamics365Account','find','where','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x8375,0x132));var _0x5837=function(_0x380bd4,_0x522b8f){_0x380bd4=_0x380bd4-0x0;var _0x33f96f=_0x8375[_0x380bd4];return _0x33f96f;};'use strict';var _=require('lodash');var util=require(_0x5837('0x0'));var moment=require(_0x5837('0x1'));var BPromise=require(_0x5837('0x2'));var rs=require(_0x5837('0x3'));var fs=require('fs');var Redis=require(_0x5837('0x4'));var db=require(_0x5837('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x5837('0x6'))(_0x5837('0x7'));var config=require('../../config/environment');var jayson=require(_0x5837('0x8'));var client=jayson[_0x5837('0x9')][_0x5837('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1e0d00,_0x5e980d,_0x23454c){return new BPromise(function(_0x1f4f78,_0x89657e){return client[_0x5837('0xb')](_0x1e0d00,_0x23454c)[_0x5837('0xc')](function(_0x32e545){logger[_0x5837('0xd')](_0x5837('0xe'),_0x5e980d,_0x5837('0xf'));logger['debug'](_0x5837('0x10'),_0x5e980d,_0x5837('0xf'),JSON['stringify'](_0x32e545));if(_0x32e545[_0x5837('0x11')]){if(_0x32e545[_0x5837('0x11')]['code']===0x1f4){logger[_0x5837('0x11')]('Dynamics365Account,\x20%s,\x20%s',_0x5e980d,_0x32e545[_0x5837('0x11')][_0x5837('0x12')]);return _0x89657e(_0x32e545[_0x5837('0x11')][_0x5837('0x12')]);}logger['error'](_0x5837('0xe'),_0x5e980d,_0x32e545[_0x5837('0x11')][_0x5837('0x12')]);return _0x1f4f78(_0x32e545['error'][_0x5837('0x12')]);}else{logger[_0x5837('0xd')](_0x5837('0xe'),_0x5e980d,_0x5837('0xf'));_0x1f4f78(_0x32e545[_0x5837('0x13')][_0x5837('0x12')]);}})['catch'](function(_0x555ebb){logger['error'](_0x5837('0xe'),_0x5e980d,_0x555ebb);_0x89657e(_0x555ebb);});});}exports[_0x5837('0x14')]=function(_0x1a5725){var _0x423a9f=this;return new Promise(function(_0x128b4a,_0x602f19){return db[_0x5837('0x15')]['findAll']({'raw':_0x1a5725[_0x5837('0x16')]?_0x1a5725[_0x5837('0x16')][_0x5837('0x17')]===undefined?!![]:![]:!![],'where':_0x1a5725[_0x5837('0x16')]?_0x1a5725[_0x5837('0x16')]['where']||null:null,'attributes':_0x1a5725['options']?_0x1a5725[_0x5837('0x16')][_0x5837('0x18')]||null:null,'limit':_0x1a5725[_0x5837('0x16')]?_0x1a5725['options'][_0x5837('0x19')]||null:null,'include':_0x1a5725[_0x5837('0x16')]?_0x1a5725['options'][_0x5837('0x1a')]?_[_0x5837('0x1b')](_0x1a5725['options'][_0x5837('0x1a')],function(_0x2709cf){return{'model':db[_0x2709cf[_0x5837('0x1c')]],'as':_0x2709cf['as'],'attributes':_0x2709cf['attributes'],'include':_0x2709cf[_0x5837('0x1a')]?_['map'](_0x2709cf[_0x5837('0x1a')],function(_0x8e5a48){return{'model':db[_0x8e5a48[_0x5837('0x1c')]],'as':_0x8e5a48['as'],'attributes':_0x8e5a48[_0x5837('0x18')],'include':_0x8e5a48[_0x5837('0x1a')]?_[_0x5837('0x1b')](_0x8e5a48[_0x5837('0x1a')],function(_0x1d7285){return{'model':db[_0x1d7285[_0x5837('0x1c')]],'as':_0x1d7285['as'],'attributes':_0x1d7285[_0x5837('0x18')]};}):[]};}):[]};}):[]:[]})[_0x5837('0xc')](function(_0x27848d){logger[_0x5837('0xd')](_0x5837('0x14'),_0x1a5725);logger[_0x5837('0x1d')]('GetDynamics365Account',_0x1a5725,JSON[_0x5837('0x1e')](_0x27848d));_0x128b4a(_0x27848d);})[_0x5837('0x1f')](function(_0x170cb2){logger[_0x5837('0x11')](_0x5837('0x14'),_0x170cb2[_0x5837('0x12')],_0x1a5725);_0x602f19(_0x423a9f[_0x5837('0x11')](0x1f4,_0x170cb2['message']));});});};exports[_0x5837('0x20')]=function(_0x290e14){var _0x3a3a34=this;return new Promise(function(_0x285186,_0x55b71b){return db['Dynamics365Account'][_0x5837('0x21')]({'raw':_0x290e14[_0x5837('0x16')]?_0x290e14[_0x5837('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x290e14[_0x5837('0x16')]?_0x290e14[_0x5837('0x16')][_0x5837('0x22')]||null:null,'attributes':_0x290e14[_0x5837('0x16')]?_0x290e14[_0x5837('0x16')][_0x5837('0x18')]||null:null,'include':_0x290e14['options']?_0x290e14[_0x5837('0x16')][_0x5837('0x1a')]?_['map'](_0x290e14[_0x5837('0x16')][_0x5837('0x1a')],function(_0x216f11){return{'model':db[_0x216f11['model']],'as':_0x216f11['as'],'attributes':_0x216f11['attributes'],'include':_0x216f11['include']?_['map'](_0x216f11[_0x5837('0x1a')],function(_0x57322c){return{'model':db[_0x57322c['model']],'as':_0x57322c['as'],'attributes':_0x57322c[_0x5837('0x18')],'include':_0x57322c[_0x5837('0x1a')]?_['map'](_0x57322c[_0x5837('0x1a')],function(_0x549fc4){return{'model':db[_0x549fc4[_0x5837('0x1c')]],'as':_0x549fc4['as'],'attributes':_0x549fc4[_0x5837('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4109fa){logger[_0x5837('0xd')]('ShowDynamics365Account',_0x290e14);logger[_0x5837('0x1d')]('ShowDynamics365Account',_0x290e14,JSON[_0x5837('0x1e')](_0x4109fa));_0x285186(_0x4109fa);})['catch'](function(_0x495901){logger[_0x5837('0x11')](_0x5837('0x20'),_0x495901[_0x5837('0x12')],_0x290e14);_0x55b71b(_0x3a3a34[_0x5837('0x11')](0x1f4,_0x495901[_0x5837('0x12')]));});});}; \ No newline at end of file +var _0x49df=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','Dynamics365Account,\x20%s,\x20%s','result','GetDynamics365Account','findAll','options','raw','where','attributes','include','map','model','then','stringify','catch','ShowDynamics365Account','Dynamics365Account','find','moment','bluebird'];(function(_0xbc6e4d,_0x16a1bb){var _0xc413bd=function(_0x128276){while(--_0x128276){_0xbc6e4d['push'](_0xbc6e4d['shift']());}};_0xc413bd(++_0x16a1bb);}(_0x49df,0xad));var _0xf49d=function(_0x509b99,_0x3ff1f0){_0x509b99=_0x509b99-0x0;var _0x383d46=_0x49df[_0x509b99];return _0x383d46;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf49d('0x0'));var BPromise=require(_0xf49d('0x1'));var rs=require(_0xf49d('0x2'));var fs=require('fs');var Redis=require(_0xf49d('0x3'));var db=require(_0xf49d('0x4'))['db'];var utils=require(_0xf49d('0x5'));var logger=require(_0xf49d('0x6'))('rpc');var config=require(_0xf49d('0x7'));var jayson=require(_0xf49d('0x8'));var client=jayson[_0xf49d('0x9')][_0xf49d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1aaf37,_0x29b82e,_0x4e8b5e){return new BPromise(function(_0xadfde5,_0x36ed1d){return client[_0xf49d('0xb')](_0x1aaf37,_0x4e8b5e)['then'](function(_0x5aca77){logger[_0xf49d('0xc')]('Dynamics365Account,\x20%s,\x20%s',_0x29b82e,'request\x20sent');logger[_0xf49d('0xd')](_0xf49d('0xe'),_0x29b82e,_0xf49d('0xf'),JSON['stringify'](_0x5aca77));if(_0x5aca77[_0xf49d('0x10')]){if(_0x5aca77[_0xf49d('0x10')]['code']===0x1f4){logger[_0xf49d('0x10')]('Dynamics365Account,\x20%s,\x20%s',_0x29b82e,_0x5aca77['error'][_0xf49d('0x11')]);return _0x36ed1d(_0x5aca77['error'][_0xf49d('0x11')]);}logger[_0xf49d('0x10')](_0xf49d('0x12'),_0x29b82e,_0x5aca77['error'][_0xf49d('0x11')]);return _0xadfde5(_0x5aca77[_0xf49d('0x10')][_0xf49d('0x11')]);}else{logger['info'](_0xf49d('0x12'),_0x29b82e,_0xf49d('0xf'));_0xadfde5(_0x5aca77[_0xf49d('0x13')][_0xf49d('0x11')]);}})['catch'](function(_0x2927b9){logger[_0xf49d('0x10')](_0xf49d('0x12'),_0x29b82e,_0x2927b9);_0x36ed1d(_0x2927b9);});});}exports[_0xf49d('0x14')]=function(_0x2a7a78){var _0x1de1ac=this;return new Promise(function(_0xbc6fdd,_0x2eb1e4){return db['Dynamics365Account'][_0xf49d('0x15')]({'raw':_0x2a7a78[_0xf49d('0x16')]?_0x2a7a78[_0xf49d('0x16')][_0xf49d('0x17')]===undefined?!![]:![]:!![],'where':_0x2a7a78[_0xf49d('0x16')]?_0x2a7a78[_0xf49d('0x16')][_0xf49d('0x18')]||null:null,'attributes':_0x2a7a78[_0xf49d('0x16')]?_0x2a7a78[_0xf49d('0x16')][_0xf49d('0x19')]||null:null,'limit':_0x2a7a78[_0xf49d('0x16')]?_0x2a7a78['options']['limit']||null:null,'include':_0x2a7a78[_0xf49d('0x16')]?_0x2a7a78[_0xf49d('0x16')]['include']?_['map'](_0x2a7a78[_0xf49d('0x16')][_0xf49d('0x1a')],function(_0x5cce78){return{'model':db[_0x5cce78['model']],'as':_0x5cce78['as'],'attributes':_0x5cce78[_0xf49d('0x19')],'include':_0x5cce78['include']?_[_0xf49d('0x1b')](_0x5cce78[_0xf49d('0x1a')],function(_0xb8dcf8){return{'model':db[_0xb8dcf8[_0xf49d('0x1c')]],'as':_0xb8dcf8['as'],'attributes':_0xb8dcf8['attributes'],'include':_0xb8dcf8[_0xf49d('0x1a')]?_[_0xf49d('0x1b')](_0xb8dcf8[_0xf49d('0x1a')],function(_0x33168c){return{'model':db[_0x33168c[_0xf49d('0x1c')]],'as':_0x33168c['as'],'attributes':_0x33168c[_0xf49d('0x19')]};}):[]};}):[]};}):[]:[]})[_0xf49d('0x1d')](function(_0x3f8892){logger[_0xf49d('0xc')](_0xf49d('0x14'),_0x2a7a78);logger['debug']('GetDynamics365Account',_0x2a7a78,JSON[_0xf49d('0x1e')](_0x3f8892));_0xbc6fdd(_0x3f8892);})[_0xf49d('0x1f')](function(_0x1832cd){logger[_0xf49d('0x10')](_0xf49d('0x14'),_0x1832cd[_0xf49d('0x11')],_0x2a7a78);_0x2eb1e4(_0x1de1ac[_0xf49d('0x10')](0x1f4,_0x1832cd['message']));});});};exports[_0xf49d('0x20')]=function(_0x17e3cf){var _0x17eb47=this;return new Promise(function(_0x280fd4,_0x3f64d0){return db[_0xf49d('0x21')][_0xf49d('0x22')]({'raw':_0x17e3cf[_0xf49d('0x16')]?_0x17e3cf[_0xf49d('0x16')][_0xf49d('0x17')]===undefined?!![]:![]:!![],'where':_0x17e3cf['options']?_0x17e3cf['options'][_0xf49d('0x18')]||null:null,'attributes':_0x17e3cf[_0xf49d('0x16')]?_0x17e3cf['options'][_0xf49d('0x19')]||null:null,'include':_0x17e3cf[_0xf49d('0x16')]?_0x17e3cf[_0xf49d('0x16')]['include']?_[_0xf49d('0x1b')](_0x17e3cf[_0xf49d('0x16')][_0xf49d('0x1a')],function(_0x3ecff6){return{'model':db[_0x3ecff6[_0xf49d('0x1c')]],'as':_0x3ecff6['as'],'attributes':_0x3ecff6[_0xf49d('0x19')],'include':_0x3ecff6[_0xf49d('0x1a')]?_[_0xf49d('0x1b')](_0x3ecff6['include'],function(_0x2b2f2a){return{'model':db[_0x2b2f2a[_0xf49d('0x1c')]],'as':_0x2b2f2a['as'],'attributes':_0x2b2f2a['attributes'],'include':_0x2b2f2a[_0xf49d('0x1a')]?_[_0xf49d('0x1b')](_0x2b2f2a['include'],function(_0x2ced1b){return{'model':db[_0x2ced1b[_0xf49d('0x1c')]],'as':_0x2ced1b['as'],'attributes':_0x2ced1b['attributes']};}):[]};}):[]};}):[]:[]})[_0xf49d('0x1d')](function(_0x11b59a){logger[_0xf49d('0xc')](_0xf49d('0x20'),_0x17e3cf);logger[_0xf49d('0xd')](_0xf49d('0x20'),_0x17e3cf,JSON['stringify'](_0x11b59a));_0x280fd4(_0x11b59a);})[_0xf49d('0x1f')](function(_0x3db67f){logger[_0xf49d('0x10')](_0xf49d('0x20'),_0x3db67f['message'],_0x17e3cf);_0x3f64d0(_0x17eb47[_0xf49d('0x10')](0x1f4,_0x3db67f[_0xf49d('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 9797005..bcbd886 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 _0xa3f9=['get','isAuthenticated','index','/:id','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','put','update','delete','destroy','multer','express','../../components/auth/service','../../components/interaction/service','./intDynamics365Configuration.controller'];(function(_0x2fa9df,_0x3f9a11){var _0x39f749=function(_0xa77a3e){while(--_0xa77a3e){_0x2fa9df['push'](_0x2fa9df['shift']());}};_0x39f749(++_0x3f9a11);}(_0xa3f9,0xd7));var _0x9a3f=function(_0x1c4cd1,_0x447f9d){_0x1c4cd1=_0x1c4cd1-0x0;var _0x53e576=_0xa3f9[_0x1c4cd1];return _0x53e576;};'use strict';var multer=require(_0x9a3f('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x9a3f('0x1'));var router=express['Router']();var auth=require(_0x9a3f('0x2'));var interaction=require(_0x9a3f('0x3'));var config=require('../../config/environment');var controller=require(_0x9a3f('0x4'));router[_0x9a3f('0x5')]('/',auth[_0x9a3f('0x6')](),controller[_0x9a3f('0x7')]);router['get'](_0x9a3f('0x8'),auth['isAuthenticated'](),controller['show']);router[_0x9a3f('0x5')](_0x9a3f('0x9'),auth[_0x9a3f('0x6')](),controller[_0x9a3f('0xa')]);router[_0x9a3f('0x5')](_0x9a3f('0xb'),auth['isAuthenticated'](),controller[_0x9a3f('0xc')]);router[_0x9a3f('0x5')](_0x9a3f('0xd'),auth[_0x9a3f('0x6')](),controller[_0x9a3f('0xe')]);router[_0x9a3f('0xf')]('/',auth[_0x9a3f('0x6')](),controller['create']);router[_0x9a3f('0x10')](_0x9a3f('0x8'),auth[_0x9a3f('0x6')](),controller[_0x9a3f('0x11')]);router[_0x9a3f('0x12')](_0x9a3f('0x8'),auth[_0x9a3f('0x6')](),controller[_0x9a3f('0x13')]);module['exports']=router; \ No newline at end of file +var _0x99a9=['get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','put','delete','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller'];(function(_0xf3ccb3,_0x57f2ac){var _0x54c9d5=function(_0x47e0bb){while(--_0x47e0bb){_0xf3ccb3['push'](_0xf3ccb3['shift']());}};_0x54c9d5(++_0x57f2ac);}(_0x99a9,0x15d));var _0x999a=function(_0x19589e,_0x22aa53){_0x19589e=_0x19589e-0x0;var _0xd26414=_0x99a9[_0x19589e];return _0xd26414;};'use strict';var multer=require(_0x999a('0x0'));var util=require('util');var path=require(_0x999a('0x1'));var timeout=require(_0x999a('0x2'));var express=require(_0x999a('0x3'));var router=express['Router']();var auth=require(_0x999a('0x4'));var interaction=require(_0x999a('0x5'));var config=require(_0x999a('0x6'));var controller=require(_0x999a('0x7'));router[_0x999a('0x8')]('/',auth[_0x999a('0x9')](),controller[_0x999a('0xa')]);router[_0x999a('0x8')](_0x999a('0xb'),auth[_0x999a('0x9')](),controller[_0x999a('0xc')]);router[_0x999a('0x8')](_0x999a('0xd'),auth[_0x999a('0x9')](),controller[_0x999a('0xe')]);router[_0x999a('0x8')](_0x999a('0xf'),auth['isAuthenticated'](),controller['getSubjects']);router['get'](_0x999a('0x10'),auth['isAuthenticated'](),controller['getDescriptions']);router['post']('/',auth[_0x999a('0x9')](),controller['create']);router[_0x999a('0x11')](_0x999a('0xb'),auth[_0x999a('0x9')](),controller['update']);router[_0x999a('0x12')]('/:id',auth[_0x999a('0x9')](),controller[_0x999a('0x13')]);module[_0x999a('0x14')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index e9b3051..66de827 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 _0xdde4=['sequelize','STRING','incident'];(function(_0x1782ae,_0x16ce5b){var _0x19b2af=function(_0x2c03a5){while(--_0x2c03a5){_0x1782ae['push'](_0x1782ae['shift']());}};_0x19b2af(++_0x16ce5b);}(_0xdde4,0x12c));var _0x4dde=function(_0x350a97,_0x33648e){_0x350a97=_0x350a97-0x0;var _0x39cb80=_0xdde4[_0x350a97];return _0x39cb80;};'use strict';var Sequelize=require(_0x4dde('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x4dde('0x1')]},'ticketType':{'type':Sequelize['ENUM']('incident','phonecall'),'defaultValue':_0x4dde('0x2')}}; \ No newline at end of file +var _0x9309=['incident','sequelize','exports','STRING','ENUM','phonecall'];(function(_0x413c70,_0x3b33ab){var _0x52a26e=function(_0x58f85d){while(--_0x58f85d){_0x413c70['push'](_0x413c70['shift']());}};_0x52a26e(++_0x3b33ab);}(_0x9309,0x181));var _0x9930=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9309[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x9930('0x0'));module[_0x9930('0x1')]={'name':{'type':Sequelize[_0x9930('0x2')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0x9930('0x3')]('incident',_0x9930('0x4')),'defaultValue':_0x9930('0x5')}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index fab239b..49f4e4b 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 _0x9696=['save','then','destroy','end','stack','name','send','index','Dynamics365Configuration','rawAttributes','fieldName','type','key','map','query','keys','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','limit','offset','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','rows','show','params','length','include','find','create','body','update','getFields','findOne','Dynamics365Field','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','ejs','lodash','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','../../mysqldb','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','Dynamics365Configuration,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','count','apply','reject'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0x9696,0x92));var _0x6969=function(_0x4c2406,_0x1de04d){_0x4c2406=_0x4c2406-0x0;var _0x344f78=_0x9696[_0x4c2406];return _0x344f78;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x6969('0x0'));var rimraf=require(_0x6969('0x1'));var zipdir=require(_0x6969('0x2'));var jsonpatch=require(_0x6969('0x3'));var rp=require(_0x6969('0x4'));var moment=require(_0x6969('0x5'));var BPromise=require(_0x6969('0x6'));var Mustache=require('mustache');var util=require(_0x6969('0x7'));var path=require('path');var sox=require(_0x6969('0x8'));var csv=require('to-csv');var ejs=require(_0x6969('0x9'));var fs=require('fs');var _=require(_0x6969('0xa'));var squel=require('squel');var crypto=require(_0x6969('0xb'));var jsforce=require(_0x6969('0xc'));var deskjs=require(_0x6969('0xd'));var toCsv=require('to-csv');var querystring=require(_0x6969('0xe'));var Papa=require(_0x6969('0xf'));var Redis=require('ioredis');var authService=require(_0x6969('0x10'));var qs=require(_0x6969('0x11'));var as=require(_0x6969('0x12'));var hardwareService=require(_0x6969('0x13'));var logger=require(_0x6969('0x14'))(_0x6969('0x15'));var utils=require(_0x6969('0x16'));var config=require(_0x6969('0x17'));var db=require(_0x6969('0x18'))['db'];var jayson=require(_0x6969('0x19'));var client=jayson[_0x6969('0x1a')][_0x6969('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x425200,_0x539c09,_0x71c4bf){if(_0x71c4bf){var _0x38c91a=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x38c91a[_0x6969('0x1c')](_0x539c09)){return _0x425200;}else{throw new db[(_0x6969('0x1d'))][(_0x6969('0x1e'))](_0x6969('0x1f'));}}else{return _0x425200;}}function respondWithRpcPromise(_0x9961a0,_0x344d83,_0x3b85e6,_0x346b6d){return new BPromise(function(_0x291ee1,_0x3f9ce7){var _0x61f6f2=_0x346b6d||client;return _0x61f6f2[_0x6969('0x20')](_0x9961a0,_0x3b85e6)['then'](function(_0x2fba94){logger[_0x6969('0x21')]('Dynamics365Configuration,\x20%s,\x20%s',_0x344d83,_0x6969('0x22'));logger[_0x6969('0x23')](_0x6969('0x24'),_0x344d83,_0x6969('0x22'),JSON[_0x6969('0x25')](_0x2fba94));if(_0x2fba94[_0x6969('0x26')]){if(_0x2fba94[_0x6969('0x26')][_0x6969('0x27')]===0x1f4){logger[_0x6969('0x26')](_0x6969('0x28'),_0x344d83,_0x2fba94[_0x6969('0x26')]['message']);return _0x3f9ce7(_0x2fba94['error'][_0x6969('0x29')]);}logger['error'](_0x6969('0x28'),_0x344d83,_0x2fba94[_0x6969('0x26')][_0x6969('0x29')]);return _0x291ee1(_0x2fba94['error'][_0x6969('0x29')]);}else{logger['info'](_0x6969('0x28'),_0x344d83,_0x6969('0x22'));_0x291ee1(_0x2fba94[_0x6969('0x2a')][_0x6969('0x29')]);}})[_0x6969('0x2b')](function(_0x4ca072){logger['error'](_0x6969('0x28'),_0x344d83,_0x4ca072);_0x3f9ce7(_0x4ca072);});});}function respondWithStatusCode(_0x3c41ea,_0x103192){_0x103192=_0x103192||0xcc;return function(_0x1f65d5){if(_0x1f65d5){return _0x3c41ea[_0x6969('0x2c')](_0x103192);}return _0x3c41ea[_0x6969('0x2d')](_0x103192)['end']();};}function respondWithResult(_0x59aee3,_0x52c022){_0x52c022=_0x52c022||0xc8;return function(_0x14047f){if(_0x14047f){return _0x59aee3[_0x6969('0x2d')](_0x52c022)[_0x6969('0x2e')](_0x14047f);}};}function respondWithFilteredResult(_0x395209,_0x41e395){return function(_0x2b2fdb){if(_0x2b2fdb){var _0x4ba9fd=_0x2b2fdb[_0x6969('0x2f')],_0x1ea78d=_0x41e395['offset'],_0x127afd=_0x41e395['offset']+_0x41e395['limit'],_0x3c0c9a;if(_0x127afd>=_0x4ba9fd){_0x127afd=_0x4ba9fd;_0x3c0c9a=0xc8;}else{_0x3c0c9a=0xce;}_0x395209[_0x6969('0x2d')](_0x3c0c9a);return _0x395209['set']('Content-Range',_0x1ea78d+'-'+_0x127afd+'/'+_0x4ba9fd)[_0x6969('0x2e')](_0x2b2fdb);}return null;};}function patchUpdates(_0x2d682d){return function(_0x2e2b99){try{jsonpatch[_0x6969('0x30')](_0x2e2b99,_0x2d682d,!![]);}catch(_0x10e3b1){return BPromise[_0x6969('0x31')](_0x10e3b1);}return _0x2e2b99[_0x6969('0x32')]();};}function saveUpdates(_0x4c0745,_0x72b4bc){return function(_0x24326b){if(_0x24326b){return _0x24326b['update'](_0x4c0745)[_0x6969('0x33')](function(_0x402ddf){return _0x402ddf;});}return null;};}function removeEntity(_0xd64eac,_0x48a25f){return function(_0x24c115){if(_0x24c115){return _0x24c115[_0x6969('0x34')]()[_0x6969('0x33')](function(){_0xd64eac[_0x6969('0x2d')](0xcc)[_0x6969('0x35')]();});}};}function handleEntityNotFound(_0x11cac0,_0xcb6f33){return function(_0x43aff1){if(!_0x43aff1){_0x11cac0[_0x6969('0x2c')](0x194);}return _0x43aff1;};}function handleError(_0x4519af,_0x232945){_0x232945=_0x232945||0x1f4;return function(_0x312246){logger[_0x6969('0x26')](_0x312246[_0x6969('0x36')]);if(_0x312246[_0x6969('0x37')]){delete _0x312246[_0x6969('0x37')];}_0x4519af[_0x6969('0x2d')](_0x232945)[_0x6969('0x38')](_0x312246);};}exports[_0x6969('0x39')]=function(_0x1b74a1,_0x148859){var _0x3c695d={},_0x5c224c={},_0x533fc9={'count':0x0,'rows':[]};var _0x2f06f6=_['map'](db[_0x6969('0x3a')][_0x6969('0x3b')],function(_0x141588){return{'name':_0x141588[_0x6969('0x3c')],'type':_0x141588[_0x6969('0x3d')][_0x6969('0x3e')]};});_0x5c224c['model']=_[_0x6969('0x3f')](_0x2f06f6,_0x6969('0x37'));_0x5c224c[_0x6969('0x40')]=_[_0x6969('0x41')](_0x1b74a1['query']);_0x5c224c[_0x6969('0x42')]=_['intersection'](_0x5c224c[_0x6969('0x43')],_0x5c224c[_0x6969('0x40')]);_0x3c695d[_0x6969('0x44')]=_[_0x6969('0x45')](_0x5c224c[_0x6969('0x43')],qs[_0x6969('0x46')](_0x1b74a1[_0x6969('0x40')]['fields']));_0x3c695d['attributes']=_0x3c695d[_0x6969('0x44')]['length']?_0x3c695d[_0x6969('0x44')]:_0x5c224c[_0x6969('0x43')];if(!_0x1b74a1[_0x6969('0x40')][_0x6969('0x47')](_0x6969('0x48'))){_0x3c695d[_0x6969('0x49')]=qs[_0x6969('0x49')](_0x1b74a1[_0x6969('0x40')][_0x6969('0x49')]);_0x3c695d[_0x6969('0x4a')]=qs[_0x6969('0x4a')](_0x1b74a1[_0x6969('0x40')][_0x6969('0x4a')]);}_0x3c695d[_0x6969('0x4b')]=qs[_0x6969('0x4c')](_0x1b74a1[_0x6969('0x40')]['sort']);_0x3c695d['where']=qs[_0x6969('0x42')](_[_0x6969('0x4d')](_0x1b74a1[_0x6969('0x40')],_0x5c224c[_0x6969('0x42')]),_0x2f06f6);if(_0x1b74a1[_0x6969('0x40')][_0x6969('0x4e')]){_0x3c695d[_0x6969('0x4f')]=_[_0x6969('0x50')](_0x3c695d[_0x6969('0x4f')],{'$or':_[_0x6969('0x3f')](_0x2f06f6,function(_0x3810ba){if(_0x3810ba[_0x6969('0x3d')]!==_0x6969('0x51')){var _0x5a2b7d={};_0x5a2b7d[_0x3810ba[_0x6969('0x37')]]={'$like':'%'+_0x1b74a1[_0x6969('0x40')][_0x6969('0x4e')]+'%'};return _0x5a2b7d;}})});}_0x3c695d=_['merge']({},_0x3c695d,_0x1b74a1[_0x6969('0x52')]);var _0x26bebc={'where':_0x3c695d['where']};return db['Dynamics365Configuration']['count'](_0x26bebc)['then'](function(_0x3db005){_0x533fc9[_0x6969('0x2f')]=_0x3db005;if(_0x1b74a1[_0x6969('0x40')][_0x6969('0x53')]){_0x3c695d['include']=[{'all':!![]}];}return db[_0x6969('0x3a')]['findAll'](_0x3c695d);})[_0x6969('0x33')](function(_0x50c03e){_0x533fc9[_0x6969('0x54')]=_0x50c03e;return _0x533fc9;})[_0x6969('0x33')](respondWithFilteredResult(_0x148859,_0x3c695d))[_0x6969('0x2b')](handleError(_0x148859,null));};exports[_0x6969('0x55')]=function(_0x378de8,_0x536f51){var _0x58a8fc={'raw':![],'where':{'id':_0x378de8[_0x6969('0x56')]['id']}},_0x556ede={};_0x556ede[_0x6969('0x43')]=_[_0x6969('0x41')](db[_0x6969('0x3a')][_0x6969('0x3b')]);_0x556ede['query']=_[_0x6969('0x41')](_0x378de8[_0x6969('0x40')]);_0x556ede[_0x6969('0x42')]=_[_0x6969('0x45')](_0x556ede[_0x6969('0x43')],_0x556ede[_0x6969('0x40')]);_0x58a8fc[_0x6969('0x44')]=_['intersection'](_0x556ede['model'],qs[_0x6969('0x46')](_0x378de8[_0x6969('0x40')]['fields']));_0x58a8fc[_0x6969('0x44')]=_0x58a8fc[_0x6969('0x44')][_0x6969('0x57')]?_0x58a8fc['attributes']:_0x556ede[_0x6969('0x43')];if(_0x378de8[_0x6969('0x40')][_0x6969('0x53')]){_0x58a8fc[_0x6969('0x58')]=[{'all':!![]}];}_0x58a8fc=_[_0x6969('0x50')]({},_0x58a8fc,_0x378de8[_0x6969('0x52')]);return db[_0x6969('0x3a')][_0x6969('0x59')](_0x58a8fc)[_0x6969('0x33')](handleEntityNotFound(_0x536f51,null))['then'](respondWithResult(_0x536f51,null))[_0x6969('0x2b')](handleError(_0x536f51,null));};exports[_0x6969('0x5a')]=function(_0x524dfe,_0x90a8a2){return db[_0x6969('0x3a')][_0x6969('0x5a')](_0x524dfe[_0x6969('0x5b')],{})['then'](respondWithResult(_0x90a8a2,0xc9))['catch'](handleError(_0x90a8a2,null));};exports[_0x6969('0x5c')]=function(_0x50101e,_0x391654){if(_0x50101e[_0x6969('0x5b')]['id']){delete _0x50101e[_0x6969('0x5b')]['id'];}return db[_0x6969('0x3a')][_0x6969('0x59')]({'where':{'id':_0x50101e[_0x6969('0x56')]['id']}})['then'](handleEntityNotFound(_0x391654,null))[_0x6969('0x33')](saveUpdates(_0x50101e[_0x6969('0x5b')],null))[_0x6969('0x33')](respondWithResult(_0x391654,null))['catch'](handleError(_0x391654,null));};exports[_0x6969('0x34')]=function(_0x14c36b,_0x534f6f){return db[_0x6969('0x3a')]['find']({'where':{'id':_0x14c36b[_0x6969('0x56')]['id']}})[_0x6969('0x33')](handleEntityNotFound(_0x534f6f,null))[_0x6969('0x33')](removeEntity(_0x534f6f,null))[_0x6969('0x2b')](handleError(_0x534f6f,null));};exports[_0x6969('0x5d')]=function(_0x225b25,_0x38bb4b,_0x1ba9de){var _0x3e1f80={};var _0x3360fc={};var _0x2236b4;var _0x3331c6;return db[_0x6969('0x3a')][_0x6969('0x5e')]({'where':{'id':_0x225b25['params']['id']}})[_0x6969('0x33')](handleEntityNotFound(_0x38bb4b,null))[_0x6969('0x33')](function(_0x3f801d){if(_0x3f801d){_0x2236b4=_0x3f801d;_0x3360fc['model']=_[_0x6969('0x41')](db[_0x6969('0x5f')][_0x6969('0x3b')]);_0x3360fc[_0x6969('0x40')]=_['keys'](_0x225b25[_0x6969('0x40')]);_0x3360fc[_0x6969('0x42')]=_[_0x6969('0x45')](_0x3360fc[_0x6969('0x43')],_0x3360fc[_0x6969('0x40')]);_0x3e1f80[_0x6969('0x44')]=_[_0x6969('0x45')](_0x3360fc[_0x6969('0x43')],qs['fields'](_0x225b25[_0x6969('0x40')][_0x6969('0x46')]));_0x3e1f80[_0x6969('0x44')]=_0x3e1f80[_0x6969('0x44')][_0x6969('0x57')]?_0x3e1f80[_0x6969('0x44')]:_0x3360fc[_0x6969('0x43')];_0x3e1f80[_0x6969('0x4b')]=qs[_0x6969('0x4c')](_0x225b25[_0x6969('0x40')][_0x6969('0x4c')]);_0x3e1f80[_0x6969('0x4f')]=qs['filters'](_[_0x6969('0x4d')](_0x225b25['query'],_0x3360fc[_0x6969('0x42')]));if(_0x225b25['query'][_0x6969('0x4e')]){_0x3e1f80[_0x6969('0x4f')]=_[_0x6969('0x50')](_0x3e1f80[_0x6969('0x4f')],{'$or':_[_0x6969('0x3f')](_0x3e1f80['attributes'],function(_0xbb3fc3){var _0x34df03={};_0x34df03[_0xbb3fc3]={'$like':'%'+_0x225b25[_0x6969('0x40')]['filter']+'%'};return _0x34df03;})});}_0x3e1f80=_[_0x6969('0x50')]({},_0x3e1f80,_0x225b25[_0x6969('0x52')]);return _0x2236b4['getFields'](_0x3e1f80);}})[_0x6969('0x33')](function(_0x2bacdd){if(_0x2bacdd){_0x3331c6=_0x2bacdd[_0x6969('0x57')];if(!_0x225b25[_0x6969('0x40')]['hasOwnProperty'](_0x6969('0x48'))){_0x3e1f80['limit']=qs['limit'](_0x225b25[_0x6969('0x40')][_0x6969('0x49')]);_0x3e1f80[_0x6969('0x4a')]=qs[_0x6969('0x4a')](_0x225b25[_0x6969('0x40')][_0x6969('0x4a')]);}return _0x2236b4[_0x6969('0x5d')](_0x3e1f80);}})['then'](function(_0x2e6453){if(_0x2e6453){return _0x2e6453?{'count':_0x3331c6,'rows':_0x2e6453}:null;}})[_0x6969('0x33')](respondWithResult(_0x38bb4b,null))[_0x6969('0x2b')](handleError(_0x38bb4b,null));};exports[_0x6969('0x60')]=function(_0x16886e,_0x493333,_0x334a97){var _0x2ec958={};var _0x47d8fe={};var _0x12a39c;var _0x56e6c8;return db['Dynamics365Configuration'][_0x6969('0x5e')]({'where':{'id':_0x16886e[_0x6969('0x56')]['id']}})[_0x6969('0x33')](handleEntityNotFound(_0x493333,null))['then'](function(_0x15e336){if(_0x15e336){_0x12a39c=_0x15e336;_0x47d8fe['model']=_[_0x6969('0x41')](db[_0x6969('0x5f')][_0x6969('0x3b')]);_0x47d8fe[_0x6969('0x40')]=_[_0x6969('0x41')](_0x16886e[_0x6969('0x40')]);_0x47d8fe[_0x6969('0x42')]=_['intersection'](_0x47d8fe['model'],_0x47d8fe[_0x6969('0x40')]);_0x2ec958[_0x6969('0x44')]=_[_0x6969('0x45')](_0x47d8fe[_0x6969('0x43')],qs['fields'](_0x16886e['query'][_0x6969('0x46')]));_0x2ec958['attributes']=_0x2ec958[_0x6969('0x44')][_0x6969('0x57')]?_0x2ec958[_0x6969('0x44')]:_0x47d8fe[_0x6969('0x43')];_0x2ec958[_0x6969('0x4b')]=qs['sort'](_0x16886e[_0x6969('0x40')][_0x6969('0x4c')]);_0x2ec958['where']=qs['filters'](_[_0x6969('0x4d')](_0x16886e[_0x6969('0x40')],_0x47d8fe['filters']));if(_0x16886e[_0x6969('0x40')]['filter']){_0x2ec958[_0x6969('0x4f')]=_[_0x6969('0x50')](_0x2ec958[_0x6969('0x4f')],{'$or':_[_0x6969('0x3f')](_0x2ec958[_0x6969('0x44')],function(_0x636e90){var _0x3cacee={};_0x3cacee[_0x636e90]={'$like':'%'+_0x16886e['query']['filter']+'%'};return _0x3cacee;})});}_0x2ec958=_[_0x6969('0x50')]({},_0x2ec958,_0x16886e[_0x6969('0x52')]);return _0x12a39c['getSubjects'](_0x2ec958);}})[_0x6969('0x33')](function(_0x13f46d){if(_0x13f46d){_0x56e6c8=_0x13f46d['length'];if(!_0x16886e[_0x6969('0x40')][_0x6969('0x47')](_0x6969('0x48'))){_0x2ec958['limit']=qs[_0x6969('0x49')](_0x16886e['query']['limit']);_0x2ec958[_0x6969('0x4a')]=qs['offset'](_0x16886e['query'][_0x6969('0x4a')]);}return _0x12a39c[_0x6969('0x60')](_0x2ec958);}})[_0x6969('0x33')](function(_0x3595ce){if(_0x3595ce){return _0x3595ce?{'count':_0x56e6c8,'rows':_0x3595ce}:null;}})[_0x6969('0x33')](respondWithResult(_0x493333,null))[_0x6969('0x2b')](handleError(_0x493333,null));};exports['getDescriptions']=function(_0x497bbe,_0x4d1683,_0x1b6480){var _0x4327fc={};var _0x23cd3d={};var _0xda9d12;var _0x58b55f;return db[_0x6969('0x3a')][_0x6969('0x5e')]({'where':{'id':_0x497bbe[_0x6969('0x56')]['id']}})[_0x6969('0x33')](handleEntityNotFound(_0x4d1683,null))[_0x6969('0x33')](function(_0x25cde6){if(_0x25cde6){_0xda9d12=_0x25cde6;_0x23cd3d[_0x6969('0x43')]=_[_0x6969('0x41')](db[_0x6969('0x5f')][_0x6969('0x3b')]);_0x23cd3d[_0x6969('0x40')]=_['keys'](_0x497bbe[_0x6969('0x40')]);_0x23cd3d[_0x6969('0x42')]=_['intersection'](_0x23cd3d[_0x6969('0x43')],_0x23cd3d[_0x6969('0x40')]);_0x4327fc[_0x6969('0x44')]=_['intersection'](_0x23cd3d['model'],qs['fields'](_0x497bbe[_0x6969('0x40')]['fields']));_0x4327fc[_0x6969('0x44')]=_0x4327fc['attributes'][_0x6969('0x57')]?_0x4327fc[_0x6969('0x44')]:_0x23cd3d[_0x6969('0x43')];_0x4327fc['order']=qs[_0x6969('0x4c')](_0x497bbe[_0x6969('0x40')][_0x6969('0x4c')]);_0x4327fc[_0x6969('0x4f')]=qs[_0x6969('0x42')](_[_0x6969('0x4d')](_0x497bbe[_0x6969('0x40')],_0x23cd3d[_0x6969('0x42')]));if(_0x497bbe[_0x6969('0x40')][_0x6969('0x4e')]){_0x4327fc['where']=_[_0x6969('0x50')](_0x4327fc[_0x6969('0x4f')],{'$or':_['map'](_0x4327fc[_0x6969('0x44')],function(_0x11f0f3){var _0x2ef36f={};_0x2ef36f[_0x11f0f3]={'$like':'%'+_0x497bbe[_0x6969('0x40')][_0x6969('0x4e')]+'%'};return _0x2ef36f;})});}_0x4327fc=_[_0x6969('0x50')]({},_0x4327fc,_0x497bbe[_0x6969('0x52')]);return _0xda9d12[_0x6969('0x61')](_0x4327fc);}})[_0x6969('0x33')](function(_0x3ab7df){if(_0x3ab7df){_0x58b55f=_0x3ab7df[_0x6969('0x57')];if(!_0x497bbe[_0x6969('0x40')]['hasOwnProperty']('nolimit')){_0x4327fc[_0x6969('0x49')]=qs['limit'](_0x497bbe[_0x6969('0x40')][_0x6969('0x49')]);_0x4327fc[_0x6969('0x4a')]=qs[_0x6969('0x4a')](_0x497bbe['query'][_0x6969('0x4a')]);}return _0xda9d12[_0x6969('0x61')](_0x4327fc);}})[_0x6969('0x33')](function(_0x1a133f){if(_0x1a133f){return _0x1a133f?{'count':_0x58b55f,'rows':_0x1a133f}:null;}})['then'](respondWithResult(_0x4d1683,null))['catch'](handleError(_0x4d1683,null));}; \ No newline at end of file +var _0x5e55=['then','info','Dynamics365Configuration,\x20%s,\x20%s','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','sendStatus','status','end','offset','limit','set','Content-Range','json','apply','reject','update','destroy','stack','name','send','index','map','Dynamics365Configuration','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','length','attributes','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','count','includeAll','include','rows','catch','show','keys','create','body','find','params','getFields','findOne','hasOwnProperty','Dynamics365Field','getSubjects','getDescriptions','options','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../mysqldb','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x5e55,0x165));var _0x55e5=function(_0x554416,_0x2d2519){_0x554416=_0x554416-0x0;var _0x2f0003=_0x5e55[_0x554416];return _0x2f0003;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x55e5('0x0'));var rimraf=require(_0x55e5('0x1'));var zipdir=require(_0x55e5('0x2'));var jsonpatch=require(_0x55e5('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x55e5('0x4'));var Mustache=require(_0x55e5('0x5'));var util=require(_0x55e5('0x6'));var path=require(_0x55e5('0x7'));var sox=require(_0x55e5('0x8'));var csv=require('to-csv');var ejs=require(_0x55e5('0x9'));var fs=require('fs');var _=require(_0x55e5('0xa'));var squel=require(_0x55e5('0xb'));var crypto=require(_0x55e5('0xc'));var jsforce=require(_0x55e5('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x55e5('0xe'));var querystring=require('querystring');var Papa=require(_0x55e5('0xf'));var Redis=require(_0x55e5('0x10'));var authService=require(_0x55e5('0x11'));var qs=require(_0x55e5('0x12'));var as=require(_0x55e5('0x13'));var hardwareService=require(_0x55e5('0x14'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x55e5('0x15'));var db=require(_0x55e5('0x16'))['db'];var jayson=require(_0x55e5('0x17'));var client=jayson[_0x55e5('0x18')][_0x55e5('0x19')]({'port':0x232a});function checkPasswordPattern(_0xcf6282,_0x2b2579,_0x9cae75){if(_0x9cae75){var _0x97c728=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x97c728[_0x55e5('0x1a')](_0x2b2579)){return _0xcf6282;}else{throw new db[(_0x55e5('0x1b'))][(_0x55e5('0x1c'))](_0x55e5('0x1d'));}}else{return _0xcf6282;}}function respondWithRpcPromise(_0x32daf7,_0x15e624,_0x165ee8,_0x5263b4){return new BPromise(function(_0x5cc3fb,_0x1b8daa){var _0x5e9086=_0x5263b4||client;return _0x5e9086[_0x55e5('0x1e')](_0x32daf7,_0x165ee8)[_0x55e5('0x1f')](function(_0x1880f7){logger[_0x55e5('0x20')](_0x55e5('0x21'),_0x15e624,'request\x20sent');logger[_0x55e5('0x22')](_0x55e5('0x23'),_0x15e624,'request\x20sent',JSON[_0x55e5('0x24')](_0x1880f7));if(_0x1880f7[_0x55e5('0x25')]){if(_0x1880f7[_0x55e5('0x25')][_0x55e5('0x26')]===0x1f4){logger['error']('Dynamics365Configuration,\x20%s,\x20%s',_0x15e624,_0x1880f7[_0x55e5('0x25')]['message']);return _0x1b8daa(_0x1880f7[_0x55e5('0x25')][_0x55e5('0x27')]);}logger[_0x55e5('0x25')](_0x55e5('0x21'),_0x15e624,_0x1880f7[_0x55e5('0x25')][_0x55e5('0x27')]);return _0x5cc3fb(_0x1880f7[_0x55e5('0x25')][_0x55e5('0x27')]);}else{logger[_0x55e5('0x20')](_0x55e5('0x21'),_0x15e624,_0x55e5('0x28'));_0x5cc3fb(_0x1880f7[_0x55e5('0x29')][_0x55e5('0x27')]);}})['catch'](function(_0x1af3f5){logger['error'](_0x55e5('0x21'),_0x15e624,_0x1af3f5);_0x1b8daa(_0x1af3f5);});});}function respondWithStatusCode(_0x700611,_0x31f47f){_0x31f47f=_0x31f47f||0xcc;return function(_0x204071){if(_0x204071){return _0x700611[_0x55e5('0x2a')](_0x31f47f);}return _0x700611[_0x55e5('0x2b')](_0x31f47f)[_0x55e5('0x2c')]();};}function respondWithResult(_0x2866de,_0x4421f4){_0x4421f4=_0x4421f4||0xc8;return function(_0x41c344){if(_0x41c344){return _0x2866de[_0x55e5('0x2b')](_0x4421f4)['json'](_0x41c344);}};}function respondWithFilteredResult(_0x5226dd,_0x145098){return function(_0x17e544){if(_0x17e544){var _0x2257ac=_0x17e544['count'],_0x579e7f=_0x145098['offset'],_0x49a24d=_0x145098[_0x55e5('0x2d')]+_0x145098[_0x55e5('0x2e')],_0x47c263;if(_0x49a24d>=_0x2257ac){_0x49a24d=_0x2257ac;_0x47c263=0xc8;}else{_0x47c263=0xce;}_0x5226dd[_0x55e5('0x2b')](_0x47c263);return _0x5226dd[_0x55e5('0x2f')](_0x55e5('0x30'),_0x579e7f+'-'+_0x49a24d+'/'+_0x2257ac)[_0x55e5('0x31')](_0x17e544);}return null;};}function patchUpdates(_0xe4d90b){return function(_0x53fef2){try{jsonpatch[_0x55e5('0x32')](_0x53fef2,_0xe4d90b,!![]);}catch(_0x1b2a66){return BPromise[_0x55e5('0x33')](_0x1b2a66);}return _0x53fef2['save']();};}function saveUpdates(_0xf7deaa,_0xbe1e64){return function(_0x220b9b){if(_0x220b9b){return _0x220b9b[_0x55e5('0x34')](_0xf7deaa)[_0x55e5('0x1f')](function(_0x209f1e){return _0x209f1e;});}return null;};}function removeEntity(_0x470d0a,_0x197301){return function(_0x58b705){if(_0x58b705){return _0x58b705[_0x55e5('0x35')]()[_0x55e5('0x1f')](function(){_0x470d0a[_0x55e5('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x132c21,_0x1a0a41){return function(_0x311396){if(!_0x311396){_0x132c21['sendStatus'](0x194);}return _0x311396;};}function handleError(_0x53163f,_0x3c128a){_0x3c128a=_0x3c128a||0x1f4;return function(_0x5000f2){logger[_0x55e5('0x25')](_0x5000f2[_0x55e5('0x36')]);if(_0x5000f2['name']){delete _0x5000f2[_0x55e5('0x37')];}_0x53163f[_0x55e5('0x2b')](_0x3c128a)[_0x55e5('0x38')](_0x5000f2);};}exports[_0x55e5('0x39')]=function(_0x39c77f,_0x30504d){var _0x56c7bf={},_0x508530={},_0x531f3e={'count':0x0,'rows':[]};var _0xf9e0e2=_[_0x55e5('0x3a')](db[_0x55e5('0x3b')][_0x55e5('0x3c')],function(_0x1d11fc){return{'name':_0x1d11fc[_0x55e5('0x3d')],'type':_0x1d11fc[_0x55e5('0x3e')][_0x55e5('0x3f')]};});_0x508530[_0x55e5('0x40')]=_[_0x55e5('0x3a')](_0xf9e0e2,_0x55e5('0x37'));_0x508530[_0x55e5('0x41')]=_['keys'](_0x39c77f[_0x55e5('0x41')]);_0x508530[_0x55e5('0x42')]=_['intersection'](_0x508530[_0x55e5('0x40')],_0x508530[_0x55e5('0x41')]);_0x56c7bf['attributes']=_[_0x55e5('0x43')](_0x508530[_0x55e5('0x40')],qs[_0x55e5('0x44')](_0x39c77f[_0x55e5('0x41')]['fields']));_0x56c7bf['attributes']=_0x56c7bf['attributes'][_0x55e5('0x45')]?_0x56c7bf[_0x55e5('0x46')]:_0x508530[_0x55e5('0x40')];if(!_0x39c77f['query']['hasOwnProperty'](_0x55e5('0x47'))){_0x56c7bf['limit']=qs[_0x55e5('0x2e')](_0x39c77f[_0x55e5('0x41')]['limit']);_0x56c7bf[_0x55e5('0x2d')]=qs[_0x55e5('0x2d')](_0x39c77f[_0x55e5('0x41')][_0x55e5('0x2d')]);}_0x56c7bf[_0x55e5('0x48')]=qs[_0x55e5('0x49')](_0x39c77f['query'][_0x55e5('0x49')]);_0x56c7bf[_0x55e5('0x4a')]=qs['filters'](_[_0x55e5('0x4b')](_0x39c77f[_0x55e5('0x41')],_0x508530[_0x55e5('0x42')]),_0xf9e0e2);if(_0x39c77f['query'][_0x55e5('0x4c')]){_0x56c7bf[_0x55e5('0x4a')]=_['merge'](_0x56c7bf[_0x55e5('0x4a')],{'$or':_['map'](_0xf9e0e2,function(_0x3b5db4){if(_0x3b5db4['type']!==_0x55e5('0x4d')){var _0x13dd57={};_0x13dd57[_0x3b5db4['name']]={'$like':'%'+_0x39c77f[_0x55e5('0x41')][_0x55e5('0x4c')]+'%'};return _0x13dd57;}})});}_0x56c7bf=_[_0x55e5('0x4e')]({},_0x56c7bf,_0x39c77f['options']);var _0x359686={'where':_0x56c7bf[_0x55e5('0x4a')]};return db['Dynamics365Configuration'][_0x55e5('0x4f')](_0x359686)[_0x55e5('0x1f')](function(_0x3eb314){_0x531f3e[_0x55e5('0x4f')]=_0x3eb314;if(_0x39c77f['query'][_0x55e5('0x50')]){_0x56c7bf[_0x55e5('0x51')]=[{'all':!![]}];}return db[_0x55e5('0x3b')]['findAll'](_0x56c7bf);})[_0x55e5('0x1f')](function(_0x22a926){_0x531f3e[_0x55e5('0x52')]=_0x22a926;return _0x531f3e;})[_0x55e5('0x1f')](respondWithFilteredResult(_0x30504d,_0x56c7bf))[_0x55e5('0x53')](handleError(_0x30504d,null));};exports[_0x55e5('0x54')]=function(_0x47848c,_0x51433d){var _0x3cd798={'raw':![],'where':{'id':_0x47848c['params']['id']}},_0xc86d86={};_0xc86d86[_0x55e5('0x40')]=_[_0x55e5('0x55')](db['Dynamics365Configuration'][_0x55e5('0x3c')]);_0xc86d86[_0x55e5('0x41')]=_[_0x55e5('0x55')](_0x47848c['query']);_0xc86d86['filters']=_[_0x55e5('0x43')](_0xc86d86[_0x55e5('0x40')],_0xc86d86['query']);_0x3cd798[_0x55e5('0x46')]=_[_0x55e5('0x43')](_0xc86d86[_0x55e5('0x40')],qs[_0x55e5('0x44')](_0x47848c['query'][_0x55e5('0x44')]));_0x3cd798[_0x55e5('0x46')]=_0x3cd798[_0x55e5('0x46')][_0x55e5('0x45')]?_0x3cd798['attributes']:_0xc86d86[_0x55e5('0x40')];if(_0x47848c[_0x55e5('0x41')][_0x55e5('0x50')]){_0x3cd798[_0x55e5('0x51')]=[{'all':!![]}];}_0x3cd798=_[_0x55e5('0x4e')]({},_0x3cd798,_0x47848c['options']);return db[_0x55e5('0x3b')]['find'](_0x3cd798)[_0x55e5('0x1f')](handleEntityNotFound(_0x51433d,null))[_0x55e5('0x1f')](respondWithResult(_0x51433d,null))[_0x55e5('0x53')](handleError(_0x51433d,null));};exports['create']=function(_0x3580c2,_0x2bc389){return db[_0x55e5('0x3b')][_0x55e5('0x56')](_0x3580c2[_0x55e5('0x57')],{})[_0x55e5('0x1f')](respondWithResult(_0x2bc389,0xc9))['catch'](handleError(_0x2bc389,null));};exports[_0x55e5('0x34')]=function(_0x1502b0,_0x6e474){if(_0x1502b0[_0x55e5('0x57')]['id']){delete _0x1502b0[_0x55e5('0x57')]['id'];}return db[_0x55e5('0x3b')][_0x55e5('0x58')]({'where':{'id':_0x1502b0[_0x55e5('0x59')]['id']}})[_0x55e5('0x1f')](handleEntityNotFound(_0x6e474,null))['then'](saveUpdates(_0x1502b0[_0x55e5('0x57')],null))[_0x55e5('0x1f')](respondWithResult(_0x6e474,null))[_0x55e5('0x53')](handleError(_0x6e474,null));};exports[_0x55e5('0x35')]=function(_0x58495b,_0x4b453a){return db[_0x55e5('0x3b')][_0x55e5('0x58')]({'where':{'id':_0x58495b['params']['id']}})['then'](handleEntityNotFound(_0x4b453a,null))[_0x55e5('0x1f')](removeEntity(_0x4b453a,null))[_0x55e5('0x53')](handleError(_0x4b453a,null));};exports[_0x55e5('0x5a')]=function(_0x20a9f0,_0x56cd81,_0x4a65de){var _0x10677c={};var _0x584d67={};var _0xf5c038;var _0x22a4f2;return db[_0x55e5('0x3b')][_0x55e5('0x5b')]({'where':{'id':_0x20a9f0[_0x55e5('0x59')]['id']}})['then'](handleEntityNotFound(_0x56cd81,null))['then'](function(_0x31a34d){if(_0x31a34d){_0xf5c038=_0x31a34d;_0x584d67[_0x55e5('0x40')]=_[_0x55e5('0x55')](db['Dynamics365Field'][_0x55e5('0x3c')]);_0x584d67[_0x55e5('0x41')]=_[_0x55e5('0x55')](_0x20a9f0[_0x55e5('0x41')]);_0x584d67[_0x55e5('0x42')]=_['intersection'](_0x584d67[_0x55e5('0x40')],_0x584d67[_0x55e5('0x41')]);_0x10677c['attributes']=_[_0x55e5('0x43')](_0x584d67[_0x55e5('0x40')],qs[_0x55e5('0x44')](_0x20a9f0[_0x55e5('0x41')][_0x55e5('0x44')]));_0x10677c['attributes']=_0x10677c[_0x55e5('0x46')][_0x55e5('0x45')]?_0x10677c[_0x55e5('0x46')]:_0x584d67['model'];_0x10677c['order']=qs[_0x55e5('0x49')](_0x20a9f0[_0x55e5('0x41')][_0x55e5('0x49')]);_0x10677c[_0x55e5('0x4a')]=qs[_0x55e5('0x42')](_['pick'](_0x20a9f0[_0x55e5('0x41')],_0x584d67[_0x55e5('0x42')]));if(_0x20a9f0['query']['filter']){_0x10677c['where']=_['merge'](_0x10677c['where'],{'$or':_[_0x55e5('0x3a')](_0x10677c[_0x55e5('0x46')],function(_0x185a05){var _0x215838={};_0x215838[_0x185a05]={'$like':'%'+_0x20a9f0['query']['filter']+'%'};return _0x215838;})});}_0x10677c=_['merge']({},_0x10677c,_0x20a9f0['options']);return _0xf5c038[_0x55e5('0x5a')](_0x10677c);}})[_0x55e5('0x1f')](function(_0x22c296){if(_0x22c296){_0x22a4f2=_0x22c296[_0x55e5('0x45')];if(!_0x20a9f0['query'][_0x55e5('0x5c')](_0x55e5('0x47'))){_0x10677c[_0x55e5('0x2e')]=qs[_0x55e5('0x2e')](_0x20a9f0['query'][_0x55e5('0x2e')]);_0x10677c[_0x55e5('0x2d')]=qs[_0x55e5('0x2d')](_0x20a9f0['query'][_0x55e5('0x2d')]);}return _0xf5c038['getFields'](_0x10677c);}})[_0x55e5('0x1f')](function(_0x4031a0){if(_0x4031a0){return _0x4031a0?{'count':_0x22a4f2,'rows':_0x4031a0}:null;}})[_0x55e5('0x1f')](respondWithResult(_0x56cd81,null))[_0x55e5('0x53')](handleError(_0x56cd81,null));};exports['getSubjects']=function(_0x51837e,_0x2104d9,_0x2439db){var _0x2a8ca8={};var _0x34aa78={};var _0x18292d;var _0x2cae07;return db[_0x55e5('0x3b')][_0x55e5('0x5b')]({'where':{'id':_0x51837e[_0x55e5('0x59')]['id']}})[_0x55e5('0x1f')](handleEntityNotFound(_0x2104d9,null))[_0x55e5('0x1f')](function(_0x5e5bc2){if(_0x5e5bc2){_0x18292d=_0x5e5bc2;_0x34aa78[_0x55e5('0x40')]=_[_0x55e5('0x55')](db[_0x55e5('0x5d')][_0x55e5('0x3c')]);_0x34aa78[_0x55e5('0x41')]=_[_0x55e5('0x55')](_0x51837e['query']);_0x34aa78[_0x55e5('0x42')]=_[_0x55e5('0x43')](_0x34aa78['model'],_0x34aa78[_0x55e5('0x41')]);_0x2a8ca8[_0x55e5('0x46')]=_[_0x55e5('0x43')](_0x34aa78[_0x55e5('0x40')],qs[_0x55e5('0x44')](_0x51837e[_0x55e5('0x41')]['fields']));_0x2a8ca8[_0x55e5('0x46')]=_0x2a8ca8['attributes'][_0x55e5('0x45')]?_0x2a8ca8[_0x55e5('0x46')]:_0x34aa78[_0x55e5('0x40')];_0x2a8ca8[_0x55e5('0x48')]=qs[_0x55e5('0x49')](_0x51837e[_0x55e5('0x41')][_0x55e5('0x49')]);_0x2a8ca8[_0x55e5('0x4a')]=qs[_0x55e5('0x42')](_[_0x55e5('0x4b')](_0x51837e['query'],_0x34aa78[_0x55e5('0x42')]));if(_0x51837e[_0x55e5('0x41')][_0x55e5('0x4c')]){_0x2a8ca8[_0x55e5('0x4a')]=_['merge'](_0x2a8ca8[_0x55e5('0x4a')],{'$or':_[_0x55e5('0x3a')](_0x2a8ca8[_0x55e5('0x46')],function(_0xbb6ea2){var _0x5ad592={};_0x5ad592[_0xbb6ea2]={'$like':'%'+_0x51837e[_0x55e5('0x41')][_0x55e5('0x4c')]+'%'};return _0x5ad592;})});}_0x2a8ca8=_[_0x55e5('0x4e')]({},_0x2a8ca8,_0x51837e['options']);return _0x18292d[_0x55e5('0x5e')](_0x2a8ca8);}})[_0x55e5('0x1f')](function(_0x1369c6){if(_0x1369c6){_0x2cae07=_0x1369c6[_0x55e5('0x45')];if(!_0x51837e[_0x55e5('0x41')][_0x55e5('0x5c')]('nolimit')){_0x2a8ca8[_0x55e5('0x2e')]=qs[_0x55e5('0x2e')](_0x51837e[_0x55e5('0x41')][_0x55e5('0x2e')]);_0x2a8ca8[_0x55e5('0x2d')]=qs[_0x55e5('0x2d')](_0x51837e[_0x55e5('0x41')][_0x55e5('0x2d')]);}return _0x18292d['getSubjects'](_0x2a8ca8);}})['then'](function(_0x14935e){if(_0x14935e){return _0x14935e?{'count':_0x2cae07,'rows':_0x14935e}:null;}})[_0x55e5('0x1f')](respondWithResult(_0x2104d9,null))[_0x55e5('0x53')](handleError(_0x2104d9,null));};exports[_0x55e5('0x5f')]=function(_0x458493,_0x52aada,_0x1978d0){var _0x547f84={};var _0x13f029={};var _0x38118a;var _0x5aea21;return db[_0x55e5('0x3b')][_0x55e5('0x5b')]({'where':{'id':_0x458493[_0x55e5('0x59')]['id']}})[_0x55e5('0x1f')](handleEntityNotFound(_0x52aada,null))['then'](function(_0x825f04){if(_0x825f04){_0x38118a=_0x825f04;_0x13f029['model']=_[_0x55e5('0x55')](db[_0x55e5('0x5d')][_0x55e5('0x3c')]);_0x13f029[_0x55e5('0x41')]=_['keys'](_0x458493['query']);_0x13f029['filters']=_[_0x55e5('0x43')](_0x13f029['model'],_0x13f029[_0x55e5('0x41')]);_0x547f84[_0x55e5('0x46')]=_[_0x55e5('0x43')](_0x13f029['model'],qs[_0x55e5('0x44')](_0x458493[_0x55e5('0x41')][_0x55e5('0x44')]));_0x547f84[_0x55e5('0x46')]=_0x547f84[_0x55e5('0x46')][_0x55e5('0x45')]?_0x547f84[_0x55e5('0x46')]:_0x13f029[_0x55e5('0x40')];_0x547f84[_0x55e5('0x48')]=qs['sort'](_0x458493[_0x55e5('0x41')]['sort']);_0x547f84[_0x55e5('0x4a')]=qs[_0x55e5('0x42')](_[_0x55e5('0x4b')](_0x458493[_0x55e5('0x41')],_0x13f029[_0x55e5('0x42')]));if(_0x458493[_0x55e5('0x41')][_0x55e5('0x4c')]){_0x547f84[_0x55e5('0x4a')]=_[_0x55e5('0x4e')](_0x547f84['where'],{'$or':_[_0x55e5('0x3a')](_0x547f84[_0x55e5('0x46')],function(_0x34bb9e){var _0x7f09c4={};_0x7f09c4[_0x34bb9e]={'$like':'%'+_0x458493[_0x55e5('0x41')][_0x55e5('0x4c')]+'%'};return _0x7f09c4;})});}_0x547f84=_[_0x55e5('0x4e')]({},_0x547f84,_0x458493[_0x55e5('0x60')]);return _0x38118a[_0x55e5('0x5f')](_0x547f84);}})[_0x55e5('0x1f')](function(_0x63d93c){if(_0x63d93c){_0x5aea21=_0x63d93c[_0x55e5('0x45')];if(!_0x458493[_0x55e5('0x41')][_0x55e5('0x5c')]('nolimit')){_0x547f84[_0x55e5('0x2e')]=qs['limit'](_0x458493[_0x55e5('0x41')][_0x55e5('0x2e')]);_0x547f84[_0x55e5('0x2d')]=qs[_0x55e5('0x2d')](_0x458493[_0x55e5('0x41')]['offset']);}return _0x38118a[_0x55e5('0x5f')](_0x547f84);}})[_0x55e5('0x1f')](function(_0x425f37){if(_0x425f37){return _0x425f37?{'count':_0x5aea21,'rows':_0x425f37}:null;}})['then'](respondWithResult(_0x52aada,null))[_0x55e5('0x53')](handleError(_0x52aada,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 4749897..c009364 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 _0xc2bd=['api','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','lodash'];(function(_0x3bea64,_0x3f73b5){var _0x3ab4c2=function(_0x48052d){while(--_0x48052d){_0x3bea64['push'](_0x3bea64['shift']());}};_0x3ab4c2(++_0x3f73b5);}(_0xc2bd,0x179));var _0xdc2b=function(_0x118769,_0x681f23){_0x118769=_0x118769-0x0;var _0x28ef87=_0xc2bd[_0x118769];return _0x28ef87;};'use strict';var _=require(_0xdc2b('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xdc2b('0x1'));var moment=require('moment');var BPromise=require(_0xdc2b('0x2'));var rp=require(_0xdc2b('0x3'));var fs=require('fs');var path=require(_0xdc2b('0x4'));var rimraf=require(_0xdc2b('0x5'));var config=require(_0xdc2b('0x6'));var attributes=require(_0xdc2b('0x7'));module[_0xdc2b('0x8')]=function(_0x18de01,_0x1aaa3f){return _0x18de01['define']('Dynamics365Configuration',attributes,{'tableName':'int_dynamics365_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd5cd=['path','../../config/environment','./intDynamics365Configuration.attributes','define','Dynamics365Configuration','int_dynamics365_configurations','lodash','util','../../config/logger','api','request-promise'];(function(_0x143cc4,_0x30e7f6){var _0x5d25f6=function(_0x141b20){while(--_0x141b20){_0x143cc4['push'](_0x143cc4['shift']());}};_0x5d25f6(++_0x30e7f6);}(_0xd5cd,0x171));var _0xdd5c=function(_0x499d6f,_0x5aa11a){_0x499d6f=_0x499d6f-0x0;var _0x4d31ed=_0xd5cd[_0x499d6f];return _0x4d31ed;};'use strict';var _=require(_0xdd5c('0x0'));var util=require(_0xdd5c('0x1'));var logger=require(_0xdd5c('0x2'))(_0xdd5c('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xdd5c('0x4'));var fs=require('fs');var path=require(_0xdd5c('0x5'));var rimraf=require('rimraf');var config=require(_0xdd5c('0x6'));var attributes=require(_0xdd5c('0x7'));module['exports']=function(_0x217ec7,_0x562e5c){return _0x217ec7[_0xdd5c('0x8')](_0xdd5c('0x9'),attributes,{'tableName':_0xdd5c('0xa'),'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 9ae132e..c4c77da 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 _0xbb5b=['error','code','message','info','request\x20sent','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','Dynamics365Configuration,\x20%s,\x20%s','Dynamics365Configuration,\x20%s,\x20%s,\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbb5b,0x1d4));var _0xbbb5=function(_0x3f7598,_0x212e37){_0x3f7598=_0x3f7598-0x0;var _0x51fb16=_0xbb5b[_0x3f7598];return _0x51fb16;};'use strict';var _=require(_0xbbb5('0x0'));var util=require(_0xbbb5('0x1'));var moment=require(_0xbbb5('0x2'));var BPromise=require('bluebird');var rs=require(_0xbbb5('0x3'));var fs=require('fs');var Redis=require(_0xbbb5('0x4'));var db=require(_0xbbb5('0x5'))['db'];var utils=require(_0xbbb5('0x6'));var logger=require(_0xbbb5('0x7'))(_0xbbb5('0x8'));var config=require(_0xbbb5('0x9'));var jayson=require(_0xbbb5('0xa'));var client=jayson[_0xbbb5('0xb')][_0xbbb5('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x58ee62,_0x3a84e4,_0x2b1a7b){return new BPromise(function(_0x7fb3ea,_0x6140d2){return client[_0xbbb5('0xd')](_0x58ee62,_0x2b1a7b)['then'](function(_0x3e295f){logger['info'](_0xbbb5('0xe'),_0x3a84e4,'request\x20sent');logger['debug'](_0xbbb5('0xf'),_0x3a84e4,'request\x20sent',JSON['stringify'](_0x3e295f));if(_0x3e295f[_0xbbb5('0x10')]){if(_0x3e295f[_0xbbb5('0x10')][_0xbbb5('0x11')]===0x1f4){logger[_0xbbb5('0x10')](_0xbbb5('0xe'),_0x3a84e4,_0x3e295f[_0xbbb5('0x10')]['message']);return _0x6140d2(_0x3e295f[_0xbbb5('0x10')]['message']);}logger[_0xbbb5('0x10')](_0xbbb5('0xe'),_0x3a84e4,_0x3e295f[_0xbbb5('0x10')][_0xbbb5('0x12')]);return _0x7fb3ea(_0x3e295f['error'][_0xbbb5('0x12')]);}else{logger[_0xbbb5('0x13')](_0xbbb5('0xe'),_0x3a84e4,_0xbbb5('0x14'));_0x7fb3ea(_0x3e295f['result'][_0xbbb5('0x12')]);}})[_0xbbb5('0x15')](function(_0x1410a4){logger[_0xbbb5('0x10')](_0xbbb5('0xe'),_0x3a84e4,_0x1410a4);_0x6140d2(_0x1410a4);});});} \ No newline at end of file +var _0xf963=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result','catch','util','moment','randomstring','../../mysqldb','../../config/utils'];(function(_0x55d58f,_0x2bea83){var _0x1ad6e6=function(_0x31447e){while(--_0x31447e){_0x55d58f['push'](_0x55d58f['shift']());}};_0x1ad6e6(++_0x2bea83);}(_0xf963,0x133));var _0x3f96=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0xf963[_0x160c73];return _0xd9302;};'use strict';var _=require('lodash');var util=require(_0x3f96('0x0'));var moment=require(_0x3f96('0x1'));var BPromise=require('bluebird');var rs=require(_0x3f96('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3f96('0x3'))['db'];var utils=require(_0x3f96('0x4'));var logger=require(_0x3f96('0x5'))(_0x3f96('0x6'));var config=require(_0x3f96('0x7'));var jayson=require(_0x3f96('0x8'));var client=jayson[_0x3f96('0x9')][_0x3f96('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x117995,_0x16909a,_0x5a1b1f){return new BPromise(function(_0x5eeeb4,_0xa6c4cf){return client[_0x3f96('0xb')](_0x117995,_0x5a1b1f)[_0x3f96('0xc')](function(_0x3983ef){logger['info'](_0x3f96('0xd'),_0x16909a,_0x3f96('0xe'));logger[_0x3f96('0xf')](_0x3f96('0x10'),_0x16909a,'request\x20sent',JSON[_0x3f96('0x11')](_0x3983ef));if(_0x3983ef['error']){if(_0x3983ef['error'][_0x3f96('0x12')]===0x1f4){logger[_0x3f96('0x13')]('Dynamics365Configuration,\x20%s,\x20%s',_0x16909a,_0x3983ef[_0x3f96('0x13')]['message']);return _0xa6c4cf(_0x3983ef[_0x3f96('0x13')]['message']);}logger[_0x3f96('0x13')](_0x3f96('0xd'),_0x16909a,_0x3983ef['error'][_0x3f96('0x14')]);return _0x5eeeb4(_0x3983ef['error'][_0x3f96('0x14')]);}else{logger[_0x3f96('0x15')](_0x3f96('0xd'),_0x16909a,_0x3f96('0xe'));_0x5eeeb4(_0x3983ef[_0x3f96('0x16')][_0x3f96('0x14')]);}})[_0x3f96('0x17')](function(_0x39c78c){logger[_0x3f96('0x13')](_0x3f96('0xd'),_0x16909a,_0x39c78c);_0xa6c4cf(_0x39c78c);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index eb0f444..34519fc 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 _0xa699=['/:id','show','post','create','put','update','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','index'];(function(_0x3f0897,_0x44d968){var _0x55831f=function(_0x39825a){while(--_0x39825a){_0x3f0897['push'](_0x3f0897['shift']());}};_0x55831f(++_0x44d968);}(_0xa699,0x6b));var _0x9a69=function(_0x5a7d41,_0x4447e2){_0x5a7d41=_0x5a7d41-0x0;var _0x98d8fa=_0xa699[_0x5a7d41];return _0x98d8fa;};'use strict';var multer=require(_0x9a69('0x0'));var util=require(_0x9a69('0x1'));var path=require(_0x9a69('0x2'));var timeout=require(_0x9a69('0x3'));var express=require(_0x9a69('0x4'));var router=express[_0x9a69('0x5')]();var auth=require(_0x9a69('0x6'));var interaction=require(_0x9a69('0x7'));var config=require(_0x9a69('0x8'));var controller=require(_0x9a69('0x9'));router[_0x9a69('0xa')]('/',auth[_0x9a69('0xb')](),controller[_0x9a69('0xc')]);router['get'](_0x9a69('0xd'),auth[_0x9a69('0xb')](),controller[_0x9a69('0xe')]);router[_0x9a69('0xf')]('/',auth['isAuthenticated'](),controller[_0x9a69('0x10')]);router[_0x9a69('0x11')](_0x9a69('0xd'),auth[_0x9a69('0xb')](),controller[_0x9a69('0x12')]);router['delete']('/:id',auth[_0x9a69('0xb')](),controller['destroy']);module[_0x9a69('0x13')]=router; \ No newline at end of file +var _0xee5b=['/:id','put','update','destroy','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get'];(function(_0x43086f,_0x13e4fa){var _0x51d881=function(_0x3a4f2f){while(--_0x3a4f2f){_0x43086f['push'](_0x43086f['shift']());}};_0x51d881(++_0x13e4fa);}(_0xee5b,0x1f4));var _0xbee5=function(_0x4e8386,_0x380b02){_0x4e8386=_0x4e8386-0x0;var _0x2168d6=_0xee5b[_0x4e8386];return _0x2168d6;};'use strict';var multer=require(_0xbee5('0x0'));var util=require('util');var path=require(_0xbee5('0x1'));var timeout=require(_0xbee5('0x2'));var express=require('express');var router=express[_0xbee5('0x3')]();var auth=require(_0xbee5('0x4'));var interaction=require(_0xbee5('0x5'));var config=require(_0xbee5('0x6'));var controller=require('./intDynamics365Field.controller');router['get']('/',auth[_0xbee5('0x7')](),controller[_0xbee5('0x8')]);router[_0xbee5('0x9')](_0xbee5('0xa'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xbee5('0xb')](_0xbee5('0xa'),auth[_0xbee5('0x7')](),controller[_0xbee5('0xc')]);router['delete'](_0xbee5('0xa'),auth[_0xbee5('0x7')](),controller[_0xbee5('0xd')]);module[_0xbee5('0xe')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 4af6bee..3a1ba2e 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 _0x36cf=['STRING','BOOLEAN','sequelize','exports','variable','keyValue'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0x36cf,0xbc));var _0xf36c=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0x36cf[_0x49ca18];return _0x145d54;};'use strict';var Sequelize=require(_0xf36c('0x0'));module[_0xf36c('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0xf36c('0x2'),'customVariable',_0xf36c('0x3')),'defaultValue':'string'},'content':{'type':Sequelize[_0xf36c('0x4')]},'key':{'type':Sequelize[_0xf36c('0x4')]},'keyType':{'type':Sequelize['ENUM']('string',_0xf36c('0x2'),'customVariable')},'keyContent':{'type':Sequelize[_0xf36c('0x4')]},'idField':{'type':Sequelize[_0xf36c('0x4')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xf36c('0x5')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf36c('0x4')]}}; \ No newline at end of file +var _0xf998=['STRING','variable','customVariable','BOOLEAN','sequelize','ENUM','string','keyValue'];(function(_0x486dfe,_0xc0cb4c){var _0x34e4d8=function(_0x279d63){while(--_0x279d63){_0x486dfe['push'](_0x486dfe['shift']());}};_0x34e4d8(++_0xc0cb4c);}(_0xf998,0x6c));var _0x8f99=function(_0x445101,_0x2414bf){_0x445101=_0x445101-0x0;var _0x3c3d04=_0xf998[_0x445101];return _0x3c3d04;};'use strict';var Sequelize=require(_0x8f99('0x0'));module['exports']={'type':{'type':Sequelize[_0x8f99('0x1')](_0x8f99('0x2'),'variable','customVariable',_0x8f99('0x3')),'defaultValue':_0x8f99('0x2')},'content':{'type':Sequelize[_0x8f99('0x4')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x8f99('0x1')](_0x8f99('0x2'),_0x8f99('0x5'),_0x8f99('0x6'))},'keyContent':{'type':Sequelize[_0x8f99('0x4')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x8f99('0x4')]},'customField':{'type':Sequelize[_0x8f99('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8f99('0x4')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 8c58ab3..0f40804 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 _0xe41f=['../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','map','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','Dynamics365Field','includeAll','include','catch','show','params','find','create','body','html-pdf','eml-format','rimraf','zip-dir','bluebird','mustache','util','path','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe41f,0x13e));var _0xfe41=function(_0x464829,_0x83eb3f){_0x464829=_0x464829-0x0;var _0x5af5cb=_0xe41f[_0x464829];return _0x5af5cb;};'use strict';var pdf=require(_0xfe41('0x0'));var emlformat=require(_0xfe41('0x1'));var rimraf=require(_0xfe41('0x2'));var zipdir=require(_0xfe41('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xfe41('0x4'));var Mustache=require(_0xfe41('0x5'));var util=require(_0xfe41('0x6'));var path=require(_0xfe41('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xfe41('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0xfe41('0x9'));var crypto=require(_0xfe41('0xa'));var jsforce=require(_0xfe41('0xb'));var deskjs=require(_0xfe41('0xc'));var toCsv=require(_0xfe41('0xd'));var querystring=require(_0xfe41('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xfe41('0xf'));var hardwareService=require(_0xfe41('0x10'));var logger=require(_0xfe41('0x11'))('api');var utils=require(_0xfe41('0x12'));var config=require(_0xfe41('0x13'));var db=require(_0xfe41('0x14'))['db'];function respondWithStatusCode(_0x57c097,_0x19ed0e){_0x19ed0e=_0x19ed0e||0xcc;return function(_0x3c41da){if(_0x3c41da){return _0x57c097['sendStatus'](_0x19ed0e);}return _0x57c097[_0xfe41('0x15')](_0x19ed0e)[_0xfe41('0x16')]();};}function respondWithResult(_0x421eb7,_0x2fd465){_0x2fd465=_0x2fd465||0xc8;return function(_0x3cffc1){if(_0x3cffc1){return _0x421eb7['status'](_0x2fd465)[_0xfe41('0x17')](_0x3cffc1);}};}function respondWithFilteredResult(_0x384749,_0x1de7f0){return function(_0x539962){if(_0x539962){var _0x597522=_0x539962[_0xfe41('0x18')],_0x364979=_0x1de7f0['offset'],_0xca164f=_0x1de7f0[_0xfe41('0x19')]+_0x1de7f0[_0xfe41('0x1a')],_0x31dedd;if(_0xca164f>=_0x597522){_0xca164f=_0x597522;_0x31dedd=0xc8;}else{_0x31dedd=0xce;}_0x384749[_0xfe41('0x15')](_0x31dedd);return _0x384749[_0xfe41('0x1b')](_0xfe41('0x1c'),_0x364979+'-'+_0xca164f+'/'+_0x597522)[_0xfe41('0x17')](_0x539962);}return null;};}function patchUpdates(_0x3d3dc3){return function(_0x22a631){try{jsonpatch[_0xfe41('0x1d')](_0x22a631,_0x3d3dc3,!![]);}catch(_0x3ad01a){return BPromise[_0xfe41('0x1e')](_0x3ad01a);}return _0x22a631[_0xfe41('0x1f')]();};}function saveUpdates(_0x3cf01e,_0x4d5538){return function(_0x2e85ca){if(_0x2e85ca){return _0x2e85ca[_0xfe41('0x20')](_0x3cf01e)[_0xfe41('0x21')](function(_0x2ca1d4){return _0x2ca1d4;});}return null;};}function removeEntity(_0x916a2,_0x4186d9){return function(_0x3cfccc){if(_0x3cfccc){return _0x3cfccc[_0xfe41('0x22')]()[_0xfe41('0x21')](function(){_0x916a2[_0xfe41('0x15')](0xcc)[_0xfe41('0x16')]();});}};}function handleEntityNotFound(_0x21f42a,_0x5afe19){return function(_0x33d1b7){if(!_0x33d1b7){_0x21f42a[_0xfe41('0x23')](0x194);}return _0x33d1b7;};}function handleError(_0x344bea,_0x450e0a){_0x450e0a=_0x450e0a||0x1f4;return function(_0x16709b){logger['error'](_0x16709b[_0xfe41('0x24')]);if(_0x16709b[_0xfe41('0x25')]){delete _0x16709b[_0xfe41('0x25')];}_0x344bea[_0xfe41('0x15')](_0x450e0a)[_0xfe41('0x26')](_0x16709b);};}exports['index']=function(_0x10e5ed,_0x2a3dcc){var _0x167151={},_0x422d80={},_0x44d7a3={'count':0x0,'rows':[]};var _0x2804b7=_[_0xfe41('0x27')](db['Dynamics365Field'][_0xfe41('0x28')],function(_0x9a5108){return{'name':_0x9a5108['fieldName'],'type':_0x9a5108[_0xfe41('0x29')]['key']};});_0x422d80[_0xfe41('0x2a')]=_['map'](_0x2804b7,_0xfe41('0x25'));_0x422d80[_0xfe41('0x2b')]=_[_0xfe41('0x2c')](_0x10e5ed[_0xfe41('0x2b')]);_0x422d80[_0xfe41('0x2d')]=_[_0xfe41('0x2e')](_0x422d80['model'],_0x422d80[_0xfe41('0x2b')]);_0x167151[_0xfe41('0x2f')]=_[_0xfe41('0x2e')](_0x422d80['model'],qs[_0xfe41('0x30')](_0x10e5ed['query'][_0xfe41('0x30')]));_0x167151[_0xfe41('0x2f')]=_0x167151[_0xfe41('0x2f')][_0xfe41('0x31')]?_0x167151[_0xfe41('0x2f')]:_0x422d80[_0xfe41('0x2a')];if(!_0x10e5ed[_0xfe41('0x2b')][_0xfe41('0x32')]('nolimit')){_0x167151[_0xfe41('0x1a')]=qs[_0xfe41('0x1a')](_0x10e5ed[_0xfe41('0x2b')]['limit']);_0x167151[_0xfe41('0x19')]=qs[_0xfe41('0x19')](_0x10e5ed[_0xfe41('0x2b')][_0xfe41('0x19')]);}_0x167151[_0xfe41('0x33')]=qs[_0xfe41('0x34')](_0x10e5ed[_0xfe41('0x2b')][_0xfe41('0x34')]);_0x167151[_0xfe41('0x35')]=qs[_0xfe41('0x2d')](_[_0xfe41('0x36')](_0x10e5ed['query'],_0x422d80[_0xfe41('0x2d')]),_0x2804b7);if(_0x10e5ed[_0xfe41('0x2b')][_0xfe41('0x37')]){_0x167151[_0xfe41('0x35')]=_[_0xfe41('0x38')](_0x167151['where'],{'$or':_[_0xfe41('0x27')](_0x2804b7,function(_0x547ae5){if(_0x547ae5[_0xfe41('0x29')]!=='VIRTUAL'){var _0x1b6566={};_0x1b6566[_0x547ae5[_0xfe41('0x25')]]={'$like':'%'+_0x10e5ed[_0xfe41('0x2b')][_0xfe41('0x37')]+'%'};return _0x1b6566;}})});}_0x167151=_[_0xfe41('0x38')]({},_0x167151,_0x10e5ed[_0xfe41('0x39')]);var _0x4bffcf={'where':_0x167151[_0xfe41('0x35')]};return db[_0xfe41('0x3a')][_0xfe41('0x18')](_0x4bffcf)['then'](function(_0x5ebe52){_0x44d7a3[_0xfe41('0x18')]=_0x5ebe52;if(_0x10e5ed[_0xfe41('0x2b')][_0xfe41('0x3b')]){_0x167151[_0xfe41('0x3c')]=[{'all':!![]}];}return db[_0xfe41('0x3a')]['findAll'](_0x167151);})[_0xfe41('0x21')](function(_0x4fc5e6){_0x44d7a3['rows']=_0x4fc5e6;return _0x44d7a3;})[_0xfe41('0x21')](respondWithFilteredResult(_0x2a3dcc,_0x167151))[_0xfe41('0x3d')](handleError(_0x2a3dcc,null));};exports[_0xfe41('0x3e')]=function(_0x15dee2,_0x2cd38f){var _0x5a12d2={'raw':!![],'where':{'id':_0x15dee2[_0xfe41('0x3f')]['id']}},_0x2448cb={};_0x2448cb[_0xfe41('0x2a')]=_[_0xfe41('0x2c')](db[_0xfe41('0x3a')][_0xfe41('0x28')]);_0x2448cb[_0xfe41('0x2b')]=_[_0xfe41('0x2c')](_0x15dee2[_0xfe41('0x2b')]);_0x2448cb['filters']=_[_0xfe41('0x2e')](_0x2448cb[_0xfe41('0x2a')],_0x2448cb[_0xfe41('0x2b')]);_0x5a12d2[_0xfe41('0x2f')]=_[_0xfe41('0x2e')](_0x2448cb[_0xfe41('0x2a')],qs[_0xfe41('0x30')](_0x15dee2[_0xfe41('0x2b')]['fields']));_0x5a12d2['attributes']=_0x5a12d2[_0xfe41('0x2f')]['length']?_0x5a12d2[_0xfe41('0x2f')]:_0x2448cb['model'];if(_0x15dee2[_0xfe41('0x2b')]['includeAll']){_0x5a12d2['include']=[{'all':!![]}];}_0x5a12d2=_[_0xfe41('0x38')]({},_0x5a12d2,_0x15dee2['options']);return db[_0xfe41('0x3a')][_0xfe41('0x40')](_0x5a12d2)['then'](handleEntityNotFound(_0x2cd38f,null))[_0xfe41('0x21')](respondWithResult(_0x2cd38f,null))[_0xfe41('0x3d')](handleError(_0x2cd38f,null));};exports[_0xfe41('0x41')]=function(_0x307485,_0x20c73d){return db[_0xfe41('0x3a')][_0xfe41('0x41')](_0x307485[_0xfe41('0x42')],{})[_0xfe41('0x21')](respondWithResult(_0x20c73d,0xc9))['catch'](handleError(_0x20c73d,null));};exports[_0xfe41('0x20')]=function(_0x3c293e,_0x1c25f2){if(_0x3c293e[_0xfe41('0x42')]['id']){delete _0x3c293e[_0xfe41('0x42')]['id'];}return db[_0xfe41('0x3a')][_0xfe41('0x40')]({'where':{'id':_0x3c293e[_0xfe41('0x3f')]['id']}})[_0xfe41('0x21')](handleEntityNotFound(_0x1c25f2,null))[_0xfe41('0x21')](saveUpdates(_0x3c293e[_0xfe41('0x42')],null))[_0xfe41('0x21')](respondWithResult(_0x1c25f2,null))[_0xfe41('0x3d')](handleError(_0x1c25f2,null));};exports[_0xfe41('0x22')]=function(_0x364ebe,_0x12c2bd){return db[_0xfe41('0x3a')][_0xfe41('0x40')]({'where':{'id':_0x364ebe[_0xfe41('0x3f')]['id']}})['then'](handleEntityNotFound(_0x12c2bd,null))['then'](removeEntity(_0x12c2bd,null))[_0xfe41('0x3d')](handleError(_0x12c2bd,null));}; \ No newline at end of file +var _0xf031=['send','index','map','Dynamics365Field','rawAttributes','fieldName','model','query','keys','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','type','options','then','findAll','rows','catch','params','intersection','includeAll','merge','find','create','body','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','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/environment','../../mysqldb','sendStatus','end','status','count','offset','limit','Content-Range','json','apply','reject','save','update','destroy','error','stack','name'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xf031,0xfc));var _0x1f03=function(_0x3c291d,_0x47ca90){_0x3c291d=_0x3c291d-0x0;var _0x5a3fdc=_0xf031[_0x3c291d];return _0x5a3fdc;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x1f03('0x0'));var zipdir=require(_0x1f03('0x1'));var jsonpatch=require(_0x1f03('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x1f03('0x3'));var Mustache=require(_0x1f03('0x4'));var util=require(_0x1f03('0x5'));var path=require('path');var sox=require(_0x1f03('0x6'));var csv=require(_0x1f03('0x7'));var ejs=require(_0x1f03('0x8'));var fs=require('fs');var _=require(_0x1f03('0x9'));var squel=require(_0x1f03('0xa'));var crypto=require('crypto');var jsforce=require(_0x1f03('0xb'));var deskjs=require(_0x1f03('0xc'));var toCsv=require(_0x1f03('0x7'));var querystring=require(_0x1f03('0xd'));var Papa=require(_0x1f03('0xe'));var Redis=require(_0x1f03('0xf'));var authService=require(_0x1f03('0x10'));var qs=require(_0x1f03('0x11'));var as=require(_0x1f03('0x12'));var hardwareService=require(_0x1f03('0x13'));var logger=require(_0x1f03('0x14'))(_0x1f03('0x15'));var utils=require('../../config/utils');var config=require(_0x1f03('0x16'));var db=require(_0x1f03('0x17'))['db'];function respondWithStatusCode(_0xc2c7f5,_0x84c916){_0x84c916=_0x84c916||0xcc;return function(_0x3dd878){if(_0x3dd878){return _0xc2c7f5[_0x1f03('0x18')](_0x84c916);}return _0xc2c7f5['status'](_0x84c916)[_0x1f03('0x19')]();};}function respondWithResult(_0x2cb73a,_0x27838d){_0x27838d=_0x27838d||0xc8;return function(_0x2270bd){if(_0x2270bd){return _0x2cb73a[_0x1f03('0x1a')](_0x27838d)['json'](_0x2270bd);}};}function respondWithFilteredResult(_0xf4f290,_0x1089f8){return function(_0x3fbb54){if(_0x3fbb54){var _0x5b5fb3=_0x3fbb54[_0x1f03('0x1b')],_0x396180=_0x1089f8[_0x1f03('0x1c')],_0x1201b1=_0x1089f8[_0x1f03('0x1c')]+_0x1089f8[_0x1f03('0x1d')],_0x5b3e55;if(_0x1201b1>=_0x5b5fb3){_0x1201b1=_0x5b5fb3;_0x5b3e55=0xc8;}else{_0x5b3e55=0xce;}_0xf4f290['status'](_0x5b3e55);return _0xf4f290['set'](_0x1f03('0x1e'),_0x396180+'-'+_0x1201b1+'/'+_0x5b5fb3)[_0x1f03('0x1f')](_0x3fbb54);}return null;};}function patchUpdates(_0x30a71d){return function(_0x28c076){try{jsonpatch[_0x1f03('0x20')](_0x28c076,_0x30a71d,!![]);}catch(_0x14adcd){return BPromise[_0x1f03('0x21')](_0x14adcd);}return _0x28c076[_0x1f03('0x22')]();};}function saveUpdates(_0x100fec,_0x43b633){return function(_0x5567b7){if(_0x5567b7){return _0x5567b7[_0x1f03('0x23')](_0x100fec)['then'](function(_0x5e30a0){return _0x5e30a0;});}return null;};}function removeEntity(_0x4bbf11,_0x4268b8){return function(_0x92ea8f){if(_0x92ea8f){return _0x92ea8f[_0x1f03('0x24')]()['then'](function(){_0x4bbf11[_0x1f03('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4ab52c,_0x34b851){return function(_0x1e3b19){if(!_0x1e3b19){_0x4ab52c['sendStatus'](0x194);}return _0x1e3b19;};}function handleError(_0x1af374,_0x1cb47c){_0x1cb47c=_0x1cb47c||0x1f4;return function(_0x146565){logger[_0x1f03('0x25')](_0x146565[_0x1f03('0x26')]);if(_0x146565[_0x1f03('0x27')]){delete _0x146565[_0x1f03('0x27')];}_0x1af374[_0x1f03('0x1a')](_0x1cb47c)[_0x1f03('0x28')](_0x146565);};}exports[_0x1f03('0x29')]=function(_0x53b615,_0x5e3472){var _0x2b20e3={},_0x2adaf2={},_0x3b56f7={'count':0x0,'rows':[]};var _0x3e0f60=_[_0x1f03('0x2a')](db[_0x1f03('0x2b')][_0x1f03('0x2c')],function(_0x3dbd4f){return{'name':_0x3dbd4f[_0x1f03('0x2d')],'type':_0x3dbd4f['type']['key']};});_0x2adaf2[_0x1f03('0x2e')]=_[_0x1f03('0x2a')](_0x3e0f60,'name');_0x2adaf2[_0x1f03('0x2f')]=_[_0x1f03('0x30')](_0x53b615[_0x1f03('0x2f')]);_0x2adaf2['filters']=_['intersection'](_0x2adaf2[_0x1f03('0x2e')],_0x2adaf2[_0x1f03('0x2f')]);_0x2b20e3[_0x1f03('0x31')]=_['intersection'](_0x2adaf2[_0x1f03('0x2e')],qs[_0x1f03('0x32')](_0x53b615[_0x1f03('0x2f')][_0x1f03('0x32')]));_0x2b20e3[_0x1f03('0x31')]=_0x2b20e3['attributes'][_0x1f03('0x33')]?_0x2b20e3[_0x1f03('0x31')]:_0x2adaf2[_0x1f03('0x2e')];if(!_0x53b615[_0x1f03('0x2f')][_0x1f03('0x34')](_0x1f03('0x35'))){_0x2b20e3[_0x1f03('0x1d')]=qs['limit'](_0x53b615[_0x1f03('0x2f')][_0x1f03('0x1d')]);_0x2b20e3[_0x1f03('0x1c')]=qs[_0x1f03('0x1c')](_0x53b615[_0x1f03('0x2f')][_0x1f03('0x1c')]);}_0x2b20e3[_0x1f03('0x36')]=qs[_0x1f03('0x37')](_0x53b615['query'][_0x1f03('0x37')]);_0x2b20e3['where']=qs[_0x1f03('0x38')](_[_0x1f03('0x39')](_0x53b615[_0x1f03('0x2f')],_0x2adaf2['filters']),_0x3e0f60);if(_0x53b615[_0x1f03('0x2f')][_0x1f03('0x3a')]){_0x2b20e3[_0x1f03('0x3b')]=_['merge'](_0x2b20e3[_0x1f03('0x3b')],{'$or':_['map'](_0x3e0f60,function(_0xf6c043){if(_0xf6c043[_0x1f03('0x3c')]!=='VIRTUAL'){var _0x2fe365={};_0x2fe365[_0xf6c043[_0x1f03('0x27')]]={'$like':'%'+_0x53b615[_0x1f03('0x2f')][_0x1f03('0x3a')]+'%'};return _0x2fe365;}})});}_0x2b20e3=_['merge']({},_0x2b20e3,_0x53b615[_0x1f03('0x3d')]);var _0x2c1d84={'where':_0x2b20e3[_0x1f03('0x3b')]};return db[_0x1f03('0x2b')][_0x1f03('0x1b')](_0x2c1d84)[_0x1f03('0x3e')](function(_0x4de4d2){_0x3b56f7['count']=_0x4de4d2;if(_0x53b615[_0x1f03('0x2f')]['includeAll']){_0x2b20e3['include']=[{'all':!![]}];}return db[_0x1f03('0x2b')][_0x1f03('0x3f')](_0x2b20e3);})[_0x1f03('0x3e')](function(_0x4b5100){_0x3b56f7[_0x1f03('0x40')]=_0x4b5100;return _0x3b56f7;})[_0x1f03('0x3e')](respondWithFilteredResult(_0x5e3472,_0x2b20e3))[_0x1f03('0x41')](handleError(_0x5e3472,null));};exports['show']=function(_0x2f8fd0,_0x3bcf90){var _0x57966a={'raw':!![],'where':{'id':_0x2f8fd0[_0x1f03('0x42')]['id']}},_0x4957c0={};_0x4957c0[_0x1f03('0x2e')]=_[_0x1f03('0x30')](db[_0x1f03('0x2b')][_0x1f03('0x2c')]);_0x4957c0['query']=_[_0x1f03('0x30')](_0x2f8fd0['query']);_0x4957c0[_0x1f03('0x38')]=_[_0x1f03('0x43')](_0x4957c0['model'],_0x4957c0[_0x1f03('0x2f')]);_0x57966a[_0x1f03('0x31')]=_[_0x1f03('0x43')](_0x4957c0[_0x1f03('0x2e')],qs[_0x1f03('0x32')](_0x2f8fd0[_0x1f03('0x2f')][_0x1f03('0x32')]));_0x57966a[_0x1f03('0x31')]=_0x57966a[_0x1f03('0x31')][_0x1f03('0x33')]?_0x57966a[_0x1f03('0x31')]:_0x4957c0[_0x1f03('0x2e')];if(_0x2f8fd0[_0x1f03('0x2f')][_0x1f03('0x44')]){_0x57966a['include']=[{'all':!![]}];}_0x57966a=_[_0x1f03('0x45')]({},_0x57966a,_0x2f8fd0[_0x1f03('0x3d')]);return db[_0x1f03('0x2b')][_0x1f03('0x46')](_0x57966a)['then'](handleEntityNotFound(_0x3bcf90,null))[_0x1f03('0x3e')](respondWithResult(_0x3bcf90,null))[_0x1f03('0x41')](handleError(_0x3bcf90,null));};exports[_0x1f03('0x47')]=function(_0x4bcd21,_0x1dc0e7){return db[_0x1f03('0x2b')][_0x1f03('0x47')](_0x4bcd21['body'],{})[_0x1f03('0x3e')](respondWithResult(_0x1dc0e7,0xc9))[_0x1f03('0x41')](handleError(_0x1dc0e7,null));};exports[_0x1f03('0x23')]=function(_0xa4e4f5,_0x4a752f){if(_0xa4e4f5[_0x1f03('0x48')]['id']){delete _0xa4e4f5[_0x1f03('0x48')]['id'];}return db[_0x1f03('0x2b')][_0x1f03('0x46')]({'where':{'id':_0xa4e4f5[_0x1f03('0x42')]['id']}})[_0x1f03('0x3e')](handleEntityNotFound(_0x4a752f,null))[_0x1f03('0x3e')](saveUpdates(_0xa4e4f5[_0x1f03('0x48')],null))[_0x1f03('0x3e')](respondWithResult(_0x4a752f,null))[_0x1f03('0x41')](handleError(_0x4a752f,null));};exports[_0x1f03('0x24')]=function(_0x3666fc,_0x4229c6){return db[_0x1f03('0x2b')][_0x1f03('0x46')]({'where':{'id':_0x3666fc[_0x1f03('0x42')]['id']}})['then'](handleEntityNotFound(_0x4229c6,null))['then'](removeEntity(_0x4229c6,null))['catch'](handleError(_0x4229c6,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 4d35a49..9014c67 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 _0x16e2=['../../config/environment','exports','define','int_dynamics365_fields','dynamics365_unique_index','idField','FieldId','lodash','../../config/logger','bluebird','request-promise','rimraf'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x16e2,0x8b));var _0x216e=function(_0xaab43b,_0x171483){_0xaab43b=_0xaab43b-0x0;var _0x83838=_0x16e2[_0xaab43b];return _0x83838;};'use strict';var _=require(_0x216e('0x0'));var util=require('util');var logger=require(_0x216e('0x1'))('api');var moment=require('moment');var BPromise=require(_0x216e('0x2'));var rp=require(_0x216e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x216e('0x4'));var config=require(_0x216e('0x5'));var attributes=require('./intDynamics365Field.attributes');module[_0x216e('0x6')]=function(_0x186aa6,_0x40d537){return _0x186aa6[_0x216e('0x7')]('Dynamics365Field',attributes,{'tableName':_0x216e('0x8'),'paranoid':![],'indexes':[{'name':_0x216e('0x9'),'fields':[_0x216e('0xa'),_0x216e('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x128d=['moment','request-promise','path','rimraf','./intDynamics365Field.attributes','exports','define','Dynamics365Field','int_dynamics365_fields','idField','FieldId','lodash','../../config/logger','api'];(function(_0xdd26a0,_0x356af6){var _0x2b92d0=function(_0x10c684){while(--_0x10c684){_0xdd26a0['push'](_0xdd26a0['shift']());}};_0x2b92d0(++_0x356af6);}(_0x128d,0x15b));var _0xd128=function(_0x9576e,_0x16e3fb){_0x9576e=_0x9576e-0x0;var _0x398c31=_0x128d[_0x9576e];return _0x398c31;};'use strict';var _=require(_0xd128('0x0'));var util=require('util');var logger=require(_0xd128('0x1'))(_0xd128('0x2'));var moment=require(_0xd128('0x3'));var BPromise=require('bluebird');var rp=require(_0xd128('0x4'));var fs=require('fs');var path=require(_0xd128('0x5'));var rimraf=require(_0xd128('0x6'));var config=require('../../config/environment');var attributes=require(_0xd128('0x7'));module[_0xd128('0x8')]=function(_0x3419ed,_0x6b19d5){return _0x3419ed[_0xd128('0x9')](_0xd128('0xa'),attributes,{'tableName':_0xd128('0xb'),'paranoid':![],'indexes':[{'name':'dynamics365_unique_index','fields':[_0xd128('0xc'),_0xd128('0xd')],'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 504e6ec..19ed4d9 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 _0x4ccb=['moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','Dynamics365Field,\x20%s,\x20%s','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','lodash','util'];(function(_0x3db750,_0x5d66c2){var _0x5427a=function(_0x41fdb8){while(--_0x41fdb8){_0x3db750['push'](_0x3db750['shift']());}};_0x5427a(++_0x5d66c2);}(_0x4ccb,0x196));var _0xb4cc=function(_0x1316ee,_0x28a687){_0x1316ee=_0x1316ee-0x0;var _0x2118bf=_0x4ccb[_0x1316ee];return _0x2118bf;};'use strict';var _=require(_0xb4cc('0x0'));var util=require(_0xb4cc('0x1'));var moment=require(_0xb4cc('0x2'));var BPromise=require('bluebird');var rs=require(_0xb4cc('0x3'));var fs=require('fs');var Redis=require(_0xb4cc('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb4cc('0x5'));var logger=require(_0xb4cc('0x6'))(_0xb4cc('0x7'));var config=require('../../config/environment');var jayson=require(_0xb4cc('0x8'));var client=jayson[_0xb4cc('0x9')][_0xb4cc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5c0bdd,_0x370b12,_0x6ba3bf){return new BPromise(function(_0x2129ef,_0x5327a4){return client[_0xb4cc('0xb')](_0x5c0bdd,_0x6ba3bf)[_0xb4cc('0xc')](function(_0xbf893){logger[_0xb4cc('0xd')](_0xb4cc('0xe'),_0x370b12,'request\x20sent');logger[_0xb4cc('0xf')](_0xb4cc('0x10'),_0x370b12,'request\x20sent',JSON[_0xb4cc('0x11')](_0xbf893));if(_0xbf893['error']){if(_0xbf893[_0xb4cc('0x12')][_0xb4cc('0x13')]===0x1f4){logger[_0xb4cc('0x12')]('Dynamics365Field,\x20%s,\x20%s',_0x370b12,_0xbf893['error'][_0xb4cc('0x14')]);return _0x5327a4(_0xbf893['error']['message']);}logger[_0xb4cc('0x12')]('Dynamics365Field,\x20%s,\x20%s',_0x370b12,_0xbf893['error'][_0xb4cc('0x14')]);return _0x2129ef(_0xbf893[_0xb4cc('0x12')][_0xb4cc('0x14')]);}else{logger['info'](_0xb4cc('0xe'),_0x370b12,_0xb4cc('0x15'));_0x2129ef(_0xbf893[_0xb4cc('0x16')][_0xb4cc('0x14')]);}})[_0xb4cc('0x17')](function(_0x506ef9){logger[_0xb4cc('0x12')](_0xb4cc('0xe'),_0x370b12,_0x506ef9);_0x5327a4(_0x506ef9);});});} \ No newline at end of file +var _0xa6ce=['error','code','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x386123,_0x52e268){var _0x5365d2=function(_0x5ccdda){while(--_0x5ccdda){_0x386123['push'](_0x386123['shift']());}};_0x5365d2(++_0x52e268);}(_0xa6ce,0x15e));var _0xea6c=function(_0x4bb581,_0x6f7037){_0x4bb581=_0x4bb581-0x0;var _0x316bf5=_0xa6ce[_0x4bb581];return _0x316bf5;};'use strict';var _=require(_0xea6c('0x0'));var util=require('util');var moment=require(_0xea6c('0x1'));var BPromise=require(_0xea6c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xea6c('0x3'));var db=require(_0xea6c('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xea6c('0x5'));var config=require(_0xea6c('0x6'));var jayson=require(_0xea6c('0x7'));var client=jayson[_0xea6c('0x8')][_0xea6c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x8a751f,_0x5c3ba1,_0x2af078){return new BPromise(function(_0x3f1ce4,_0x1be5e8){return client[_0xea6c('0xa')](_0x8a751f,_0x2af078)[_0xea6c('0xb')](function(_0x227f1c){logger[_0xea6c('0xc')](_0xea6c('0xd'),_0x5c3ba1,_0xea6c('0xe'));logger[_0xea6c('0xf')](_0xea6c('0x10'),_0x5c3ba1,_0xea6c('0xe'),JSON[_0xea6c('0x11')](_0x227f1c));if(_0x227f1c[_0xea6c('0x12')]){if(_0x227f1c['error'][_0xea6c('0x13')]===0x1f4){logger[_0xea6c('0x12')](_0xea6c('0xd'),_0x5c3ba1,_0x227f1c['error'][_0xea6c('0x14')]);return _0x1be5e8(_0x227f1c[_0xea6c('0x12')]['message']);}logger[_0xea6c('0x12')](_0xea6c('0xd'),_0x5c3ba1,_0x227f1c[_0xea6c('0x12')][_0xea6c('0x14')]);return _0x3f1ce4(_0x227f1c[_0xea6c('0x12')][_0xea6c('0x14')]);}else{logger['info'](_0xea6c('0xd'),_0x5c3ba1,'request\x20sent');_0x3f1ce4(_0x227f1c[_0xea6c('0x15')][_0xea6c('0x14')]);}})[_0xea6c('0x16')](function(_0x105b0b){logger[_0xea6c('0x12')]('Dynamics365Field,\x20%s,\x20%s',_0x5c3ba1,_0x105b0b);_0x1be5e8(_0x105b0b);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 147f62f..c5042d4 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 _0x3b45=['get','isAuthenticated','/:id/configurations','getConfigurations','/:id/fields','create','addConfiguration','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','express','../../components/interaction/service','./intFreshdeskAccount.controller'];(function(_0x52a312,_0x52fa77){var _0x2fbf53=function(_0x469863){while(--_0x469863){_0x52a312['push'](_0x52a312['shift']());}};_0x2fbf53(++_0x52fa77);}(_0x3b45,0xde));var _0x53b4=function(_0xfadae6,_0x13ec35){_0xfadae6=_0xfadae6-0x0;var _0x2a156e=_0x3b45[_0xfadae6];return _0x2a156e;};'use strict';var multer=require(_0x53b4('0x0'));var util=require('util');var path=require(_0x53b4('0x1'));var timeout=require(_0x53b4('0x2'));var express=require(_0x53b4('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x53b4('0x4'));var config=require('../../config/environment');var controller=require(_0x53b4('0x5'));router[_0x53b4('0x6')]('/',auth[_0x53b4('0x7')](),controller['index']);router[_0x53b4('0x6')]('/:id',auth[_0x53b4('0x7')](),controller['show']);router[_0x53b4('0x6')](_0x53b4('0x8'),auth[_0x53b4('0x7')](),controller[_0x53b4('0x9')]);router['get'](_0x53b4('0xa'),auth['isAuthenticated'](),controller['getFields']);router['post']('/',auth[_0x53b4('0x7')](),controller[_0x53b4('0xb')]);router['post'](_0x53b4('0x8'),auth[_0x53b4('0x7')](),controller[_0x53b4('0xc')]);router[_0x53b4('0xd')](_0x53b4('0xe'),auth['isAuthenticated'](),controller[_0x53b4('0xf')]);router[_0x53b4('0x10')](_0x53b4('0xe'),auth['isAuthenticated'](),controller[_0x53b4('0x11')]);module[_0x53b4('0x12')]=router; \ No newline at end of file +var _0x7acf=['isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','addConfiguration','put','/:id','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get'];(function(_0x2abfa3,_0x569e6c){var _0xa4cb5a=function(_0x4eb076){while(--_0x4eb076){_0x2abfa3['push'](_0x2abfa3['shift']());}};_0xa4cb5a(++_0x569e6c);}(_0x7acf,0x1ab));var _0xf7ac=function(_0x14104d,_0x4ee4f9){_0x14104d=_0x14104d-0x0;var _0x4a45af=_0x7acf[_0x14104d];return _0x4a45af;};'use strict';var multer=require(_0xf7ac('0x0'));var util=require(_0xf7ac('0x1'));var path=require(_0xf7ac('0x2'));var timeout=require('connect-timeout');var express=require(_0xf7ac('0x3'));var router=express[_0xf7ac('0x4')]();var auth=require(_0xf7ac('0x5'));var interaction=require(_0xf7ac('0x6'));var config=require(_0xf7ac('0x7'));var controller=require(_0xf7ac('0x8'));router[_0xf7ac('0x9')]('/',auth[_0xf7ac('0xa')](),controller['index']);router[_0xf7ac('0x9')]('/:id',auth[_0xf7ac('0xa')](),controller[_0xf7ac('0xb')]);router[_0xf7ac('0x9')](_0xf7ac('0xc'),auth[_0xf7ac('0xa')](),controller[_0xf7ac('0xd')]);router[_0xf7ac('0x9')](_0xf7ac('0xe'),auth['isAuthenticated'](),controller[_0xf7ac('0xf')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['post'](_0xf7ac('0xc'),auth[_0xf7ac('0xa')](),controller[_0xf7ac('0x10')]);router[_0xf7ac('0x11')](_0xf7ac('0x12'),auth[_0xf7ac('0xa')](),controller[_0xf7ac('0x13')]);router[_0xf7ac('0x14')](_0xf7ac('0x12'),auth[_0xf7ac('0xa')](),controller[_0xf7ac('0x15')]);module[_0xf7ac('0x16')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index c43589b..76d519c 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 _0x014c=['STRING','username','remoteUri','exports'];(function(_0x11bd81,_0x11fa4c){var _0x158de0=function(_0xa93fbb){while(--_0xa93fbb){_0x11bd81['push'](_0x11bd81['shift']());}};_0x158de0(++_0x11fa4c);}(_0x014c,0x17b));var _0xc014=function(_0x5d9ceb,_0x1a49f5){_0x5d9ceb=_0x5d9ceb-0x0;var _0x33ce82=_0x014c[_0x5d9ceb];return _0x33ce82;};'use strict';var Sequelize=require('sequelize');module[_0xc014('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xc014('0x1')]},'username':{'type':Sequelize[_0xc014('0x1')],'unique':_0xc014('0x2')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xc014('0x3')},'serverUrl':{'type':Sequelize[_0xc014('0x1')]}}; \ No newline at end of file +var _0x8579=['sequelize','exports','STRING','username'];(function(_0x38fb0d,_0x52b5db){var _0x30a5d6=function(_0x31eba6){while(--_0x31eba6){_0x38fb0d['push'](_0x38fb0d['shift']());}};_0x30a5d6(++_0x52b5db);}(_0x8579,0x16c));var _0x9857=function(_0xee2a7e,_0x56c1e3){_0xee2a7e=_0xee2a7e-0x0;var _0x58f799=_0x8579[_0xee2a7e];return _0x58f799;};'use strict';var Sequelize=require(_0x9857('0x0'));module[_0x9857('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x9857('0x2')]},'username':{'type':Sequelize[_0x9857('0x2')],'unique':_0x9857('0x3')},'apiKey':{'type':Sequelize[_0x9857('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'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 63aecf1..d077880 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 _0xe14b=['apiKey','slice','substring','lastIndexOf','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X','base64','requester','subject','agent','priority','group','ticket_type','company','includes','default','custom_text','choices','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','Wrong\x20credentials','html-pdf','eml-format','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','test','Sequelize','request','then','info','FreshdeskAccount,\x20%s,\x20%s','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','sendStatus','end','json','count','offset','limit','status','set','Content-Range','apply','reject','save','name','index','map','FreshdeskAccount','rawAttributes','fieldName','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','type','merge','options','includeAll','findAll','show','params','include','find','create','body','update','destroy','getConfigurations','findOne','FreshdeskConfiguration','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','FreshdeskField','getFields','remoteUri'];(function(_0x2fdebe,_0x3d65fe){var _0x45f85f=function(_0x161e1b){while(--_0x161e1b){_0x2fdebe['push'](_0x2fdebe['shift']());}};_0x45f85f(++_0x3d65fe);}(_0xe14b,0x93));var _0xbe14=function(_0x171f9e,_0x2bdf80){_0x171f9e=_0x171f9e-0x0;var _0x12f8e3=_0xe14b[_0x171f9e];return _0x12f8e3;};'use strict';var pdf=require(_0xbe14('0x0'));var emlformat=require(_0xbe14('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xbe14('0x2'));var rp=require(_0xbe14('0x3'));var moment=require('moment');var BPromise=require(_0xbe14('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xbe14('0x5'));var sox=require(_0xbe14('0x6'));var csv=require(_0xbe14('0x7'));var ejs=require(_0xbe14('0x8'));var fs=require('fs');var _=require(_0xbe14('0x9'));var squel=require(_0xbe14('0xa'));var crypto=require(_0xbe14('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xbe14('0xc'));var Papa=require(_0xbe14('0xd'));var Redis=require(_0xbe14('0xe'));var authService=require(_0xbe14('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbe14('0x10'));var logger=require(_0xbe14('0x11'))('api');var utils=require(_0xbe14('0x12'));var config=require(_0xbe14('0x13'));var db=require(_0xbe14('0x14'))['db'];var integrations=require(_0xbe14('0x15'));var jayson=require(_0xbe14('0x16'));var client=jayson[_0xbe14('0x17')][_0xbe14('0x18')]({'port':0x232a});function checkPasswordPattern(_0x2850cb,_0x16893f,_0xa2cf72){if(_0xa2cf72){var _0x1e4826=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1e4826[_0xbe14('0x19')](_0x16893f)){return _0x2850cb;}else{throw new db[(_0xbe14('0x1a'))]['ValidationError']('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x2850cb;}}function respondWithRpcPromise(_0x3f58f5,_0x3dc4a9,_0xf4ac9,_0x37ce4e){return new BPromise(function(_0x4e8f34,_0x21c789){var _0xe9c3ec=_0x37ce4e||client;return _0xe9c3ec[_0xbe14('0x1b')](_0x3f58f5,_0xf4ac9)[_0xbe14('0x1c')](function(_0x38f1ea){logger[_0xbe14('0x1d')](_0xbe14('0x1e'),_0x3dc4a9,'request\x20sent');logger[_0xbe14('0x1f')](_0xbe14('0x20'),_0x3dc4a9,_0xbe14('0x21'),JSON[_0xbe14('0x22')](_0x38f1ea));if(_0x38f1ea[_0xbe14('0x23')]){if(_0x38f1ea[_0xbe14('0x23')]['code']===0x1f4){logger[_0xbe14('0x23')](_0xbe14('0x1e'),_0x3dc4a9,_0x38f1ea[_0xbe14('0x23')][_0xbe14('0x24')]);return _0x21c789(_0x38f1ea[_0xbe14('0x23')]['message']);}logger[_0xbe14('0x23')]('FreshdeskAccount,\x20%s,\x20%s',_0x3dc4a9,_0x38f1ea[_0xbe14('0x23')]['message']);return _0x4e8f34(_0x38f1ea[_0xbe14('0x23')]['message']);}else{logger[_0xbe14('0x1d')](_0xbe14('0x1e'),_0x3dc4a9,'request\x20sent');_0x4e8f34(_0x38f1ea[_0xbe14('0x25')]['message']);}})[_0xbe14('0x26')](function(_0x4851f8){logger[_0xbe14('0x23')](_0xbe14('0x1e'),_0x3dc4a9,_0x4851f8);_0x21c789(_0x4851f8);});});}function respondWithStatusCode(_0x1ee9c1,_0x39cc81){_0x39cc81=_0x39cc81||0xcc;return function(_0x15ef02){if(_0x15ef02){return _0x1ee9c1[_0xbe14('0x27')](_0x39cc81);}return _0x1ee9c1['status'](_0x39cc81)[_0xbe14('0x28')]();};}function respondWithResult(_0x1ba46a,_0x391556){_0x391556=_0x391556||0xc8;return function(_0x169369){if(_0x169369){return _0x1ba46a['status'](_0x391556)[_0xbe14('0x29')](_0x169369);}};}function respondWithFilteredResult(_0x29fc64,_0x59bf34){return function(_0x3c3613){if(_0x3c3613){var _0x3b3e84=_0x3c3613[_0xbe14('0x2a')],_0x1c7cc7=_0x59bf34[_0xbe14('0x2b')],_0x19252f=_0x59bf34[_0xbe14('0x2b')]+_0x59bf34[_0xbe14('0x2c')],_0x34d648;if(_0x19252f>=_0x3b3e84){_0x19252f=_0x3b3e84;_0x34d648=0xc8;}else{_0x34d648=0xce;}_0x29fc64[_0xbe14('0x2d')](_0x34d648);return _0x29fc64[_0xbe14('0x2e')](_0xbe14('0x2f'),_0x1c7cc7+'-'+_0x19252f+'/'+_0x3b3e84)[_0xbe14('0x29')](_0x3c3613);}return null;};}function patchUpdates(_0x10ae36){return function(_0x223f7a){try{jsonpatch[_0xbe14('0x30')](_0x223f7a,_0x10ae36,!![]);}catch(_0x6ba36c){return BPromise[_0xbe14('0x31')](_0x6ba36c);}return _0x223f7a[_0xbe14('0x32')]();};}function saveUpdates(_0x14e7c4,_0x581e86){return function(_0x2e33e1){if(_0x2e33e1){return _0x2e33e1['update'](_0x14e7c4)['then'](function(_0x46c2d1){return _0x46c2d1;});}return null;};}function removeEntity(_0x4c1e7e,_0x243524){return function(_0x345b0){if(_0x345b0){return _0x345b0['destroy']()['then'](function(){_0x4c1e7e['status'](0xcc)[_0xbe14('0x28')]();});}};}function handleEntityNotFound(_0xa3d24,_0x5f27b6){return function(_0x46c570){if(!_0x46c570){_0xa3d24[_0xbe14('0x27')](0x194);}return _0x46c570;};}function handleError(_0x452635,_0x1aa849){_0x1aa849=_0x1aa849||0x1f4;return function(_0x29c23e){logger['error'](_0x29c23e['stack']);if(_0x29c23e[_0xbe14('0x33')]){delete _0x29c23e['name'];}_0x452635['status'](_0x1aa849)['send'](_0x29c23e);};}exports[_0xbe14('0x34')]=function(_0x393f6b,_0x2bb45){var _0x3dbacb={},_0x172e79={},_0x29356f={'count':0x0,'rows':[]};var _0xcdc50=_[_0xbe14('0x35')](db[_0xbe14('0x36')][_0xbe14('0x37')],function(_0x41652d){return{'name':_0x41652d[_0xbe14('0x38')],'type':_0x41652d['type']['key']};});_0x172e79[_0xbe14('0x39')]=_[_0xbe14('0x35')](_0xcdc50,_0xbe14('0x33'));_0x172e79['query']=_[_0xbe14('0x3a')](_0x393f6b[_0xbe14('0x3b')]);_0x172e79[_0xbe14('0x3c')]=_[_0xbe14('0x3d')](_0x172e79[_0xbe14('0x39')],_0x172e79[_0xbe14('0x3b')]);_0x3dbacb[_0xbe14('0x3e')]=_[_0xbe14('0x3d')](_0x172e79[_0xbe14('0x39')],qs['fields'](_0x393f6b[_0xbe14('0x3b')][_0xbe14('0x3f')]));_0x3dbacb[_0xbe14('0x3e')]=_0x3dbacb[_0xbe14('0x3e')][_0xbe14('0x40')]?_0x3dbacb[_0xbe14('0x3e')]:_0x172e79['model'];if(!_0x393f6b[_0xbe14('0x3b')][_0xbe14('0x41')](_0xbe14('0x42'))){_0x3dbacb[_0xbe14('0x2c')]=qs['limit'](_0x393f6b['query'][_0xbe14('0x2c')]);_0x3dbacb[_0xbe14('0x2b')]=qs[_0xbe14('0x2b')](_0x393f6b['query']['offset']);}_0x3dbacb[_0xbe14('0x43')]=qs['sort'](_0x393f6b['query'][_0xbe14('0x44')]);_0x3dbacb[_0xbe14('0x45')]=qs[_0xbe14('0x3c')](_['pick'](_0x393f6b['query'],_0x172e79['filters']),_0xcdc50);if(_0x393f6b[_0xbe14('0x3b')][_0xbe14('0x46')]){_0x3dbacb[_0xbe14('0x45')]=_['merge'](_0x3dbacb[_0xbe14('0x45')],{'$or':_[_0xbe14('0x35')](_0xcdc50,function(_0x32f22e){if(_0x32f22e[_0xbe14('0x47')]!=='VIRTUAL'){var _0x4a1a4b={};_0x4a1a4b[_0x32f22e[_0xbe14('0x33')]]={'$like':'%'+_0x393f6b[_0xbe14('0x3b')][_0xbe14('0x46')]+'%'};return _0x4a1a4b;}})});}_0x3dbacb=_[_0xbe14('0x48')]({},_0x3dbacb,_0x393f6b[_0xbe14('0x49')]);var _0x4f2d95={'where':_0x3dbacb['where']};return db[_0xbe14('0x36')][_0xbe14('0x2a')](_0x4f2d95)[_0xbe14('0x1c')](function(_0x2a3b35){_0x29356f['count']=_0x2a3b35;if(_0x393f6b[_0xbe14('0x3b')][_0xbe14('0x4a')]){_0x3dbacb['include']=[{'all':!![]}];}return db[_0xbe14('0x36')][_0xbe14('0x4b')](_0x3dbacb);})[_0xbe14('0x1c')](function(_0x36c20c){_0x29356f['rows']=_0x36c20c;return _0x29356f;})['then'](respondWithFilteredResult(_0x2bb45,_0x3dbacb))[_0xbe14('0x26')](handleError(_0x2bb45,null));};exports[_0xbe14('0x4c')]=function(_0x4a1a37,_0x5acf90){var _0xca8cdb={'raw':![],'where':{'id':_0x4a1a37[_0xbe14('0x4d')]['id']}},_0x5d3726={};_0x5d3726[_0xbe14('0x39')]=_[_0xbe14('0x3a')](db[_0xbe14('0x36')][_0xbe14('0x37')]);_0x5d3726['query']=_[_0xbe14('0x3a')](_0x4a1a37[_0xbe14('0x3b')]);_0x5d3726[_0xbe14('0x3c')]=_[_0xbe14('0x3d')](_0x5d3726[_0xbe14('0x39')],_0x5d3726['query']);_0xca8cdb[_0xbe14('0x3e')]=_[_0xbe14('0x3d')](_0x5d3726[_0xbe14('0x39')],qs[_0xbe14('0x3f')](_0x4a1a37[_0xbe14('0x3b')][_0xbe14('0x3f')]));_0xca8cdb['attributes']=_0xca8cdb['attributes'][_0xbe14('0x40')]?_0xca8cdb[_0xbe14('0x3e')]:_0x5d3726[_0xbe14('0x39')];if(_0x4a1a37['query']['includeAll']){_0xca8cdb[_0xbe14('0x4e')]=[{'all':!![]}];}_0xca8cdb=_[_0xbe14('0x48')]({},_0xca8cdb,_0x4a1a37['options']);return db[_0xbe14('0x36')][_0xbe14('0x4f')](_0xca8cdb)['then'](handleEntityNotFound(_0x5acf90,null))[_0xbe14('0x1c')](respondWithResult(_0x5acf90,null))['catch'](handleError(_0x5acf90,null));};exports[_0xbe14('0x50')]=function(_0x410c59,_0x12a9de){return db['FreshdeskAccount'][_0xbe14('0x50')](_0x410c59[_0xbe14('0x51')],{})['then'](respondWithResult(_0x12a9de,0xc9))[_0xbe14('0x26')](handleError(_0x12a9de,null));};exports[_0xbe14('0x52')]=function(_0x2210cc,_0x20c48d){if(_0x2210cc[_0xbe14('0x51')]['id']){delete _0x2210cc['body']['id'];}return db[_0xbe14('0x36')][_0xbe14('0x4f')]({'where':{'id':_0x2210cc[_0xbe14('0x4d')]['id']}})[_0xbe14('0x1c')](handleEntityNotFound(_0x20c48d,null))[_0xbe14('0x1c')](saveUpdates(_0x2210cc[_0xbe14('0x51')],null))[_0xbe14('0x1c')](respondWithResult(_0x20c48d,null))['catch'](handleError(_0x20c48d,null));};exports[_0xbe14('0x53')]=function(_0x1b47a4,_0x941ee2){return db[_0xbe14('0x36')][_0xbe14('0x4f')]({'where':{'id':_0x1b47a4[_0xbe14('0x4d')]['id']}})[_0xbe14('0x1c')](handleEntityNotFound(_0x941ee2,null))[_0xbe14('0x1c')](removeEntity(_0x941ee2,null))[_0xbe14('0x26')](handleError(_0x941ee2,null));};exports[_0xbe14('0x54')]=function(_0x358950,_0x4bccfc,_0x56bcd3){var _0x58dd79={};var _0x10c0bc={};var _0x1bfcbf;var _0x2f4e52;return db[_0xbe14('0x36')][_0xbe14('0x55')]({'where':{'id':_0x358950[_0xbe14('0x4d')]['id']}})[_0xbe14('0x1c')](handleEntityNotFound(_0x4bccfc,null))[_0xbe14('0x1c')](function(_0x31d015){if(_0x31d015){_0x1bfcbf=_0x31d015;_0x10c0bc[_0xbe14('0x39')]=_[_0xbe14('0x3a')](db[_0xbe14('0x56')][_0xbe14('0x37')]);_0x10c0bc[_0xbe14('0x3b')]=_[_0xbe14('0x3a')](_0x358950[_0xbe14('0x3b')]);_0x10c0bc[_0xbe14('0x3c')]=_[_0xbe14('0x3d')](_0x10c0bc[_0xbe14('0x39')],_0x10c0bc[_0xbe14('0x3b')]);_0x58dd79['attributes']=_[_0xbe14('0x3d')](_0x10c0bc[_0xbe14('0x39')],qs[_0xbe14('0x3f')](_0x358950[_0xbe14('0x3b')][_0xbe14('0x3f')]));_0x58dd79[_0xbe14('0x3e')]=_0x58dd79[_0xbe14('0x3e')][_0xbe14('0x40')]?_0x58dd79[_0xbe14('0x3e')]:_0x10c0bc[_0xbe14('0x39')];_0x58dd79['order']=qs[_0xbe14('0x44')](_0x358950[_0xbe14('0x3b')][_0xbe14('0x44')]);_0x58dd79[_0xbe14('0x45')]=qs[_0xbe14('0x3c')](_['pick'](_0x358950[_0xbe14('0x3b')],_0x10c0bc[_0xbe14('0x3c')]));if(_0x358950[_0xbe14('0x3b')][_0xbe14('0x46')]){_0x58dd79[_0xbe14('0x45')]=_['merge'](_0x58dd79[_0xbe14('0x45')],{'$or':_[_0xbe14('0x35')](_0x58dd79[_0xbe14('0x3e')],function(_0x29bb26){var _0xaebce8={};_0xaebce8[_0x29bb26]={'$like':'%'+_0x358950[_0xbe14('0x3b')][_0xbe14('0x46')]+'%'};return _0xaebce8;})});}_0x58dd79=_[_0xbe14('0x48')]({},_0x58dd79,_0x358950['options']);return _0x1bfcbf[_0xbe14('0x54')](_0x58dd79);}})[_0xbe14('0x1c')](function(_0x2fdf5d){if(_0x2fdf5d){_0x2f4e52=_0x2fdf5d[_0xbe14('0x40')];if(!_0x358950[_0xbe14('0x3b')][_0xbe14('0x41')](_0xbe14('0x42'))){_0x58dd79['limit']=qs['limit'](_0x358950[_0xbe14('0x3b')][_0xbe14('0x2c')]);_0x58dd79[_0xbe14('0x2b')]=qs[_0xbe14('0x2b')](_0x358950[_0xbe14('0x3b')][_0xbe14('0x2b')]);}return _0x1bfcbf[_0xbe14('0x54')](_0x58dd79);}})[_0xbe14('0x1c')](function(_0x50e644){if(_0x50e644){return _0x50e644?{'count':_0x2f4e52,'rows':_0x50e644}:null;}})['then'](respondWithResult(_0x4bccfc,null))[_0xbe14('0x26')](handleError(_0x4bccfc,null));};exports[_0xbe14('0x57')]=function(_0x29aa52,_0x57729f,_0x76e91e){if(_0x29aa52[_0xbe14('0x51')]['id']){delete _0x29aa52[_0xbe14('0x51')]['id'];}return db[_0xbe14('0x36')][_0xbe14('0x55')]({'where':{'id':_0x29aa52[_0xbe14('0x4d')]['id']}})[_0xbe14('0x1c')](handleEntityNotFound(_0x57729f,null))['then'](function(_0x43b817){if(_0x43b817){_0x29aa52[_0xbe14('0x51')][_0xbe14('0x58')]=_0x43b817['id'];_0x29aa52[_0xbe14('0x51')][_0xbe14('0x59')]=integrations[_0xbe14('0x5a')](_0x29aa52[_0xbe14('0x51')]['channel'],_0x29aa52[_0xbe14('0x51')][_0xbe14('0x47')]);_0x29aa52[_0xbe14('0x51')][_0xbe14('0x5b')]=integrations[_0xbe14('0x5c')](_0x29aa52[_0xbe14('0x51')][_0xbe14('0x5d')],_0x29aa52[_0xbe14('0x51')]['type']);return db[_0xbe14('0x56')][_0xbe14('0x50')](_0x29aa52[_0xbe14('0x51')],{'include':[{'model':db[_0xbe14('0x5e')],'as':_0xbe14('0x59')},{'model':db[_0xbe14('0x5e')],'as':'Descriptions'}]});}return null;})[_0xbe14('0x1c')](respondWithResult(_0x57729f,null))[_0xbe14('0x26')](handleError(_0x57729f,null));};exports[_0xbe14('0x5f')]=function(_0x1b23a1,_0x508455,_0x7e9e5c){var _0x1578b6='';return db[_0xbe14('0x36')][_0xbe14('0x55')]({'where':{'id':_0x1b23a1[_0xbe14('0x4d')]['id']},'attributes':['id',_0xbe14('0x60'),_0xbe14('0x61')]})['then'](handleEntityNotFound(_0x508455,null))[_0xbe14('0x1c')](function(_0x589197){if(_0x589197){_0x1578b6=_0x589197[_0xbe14('0x60')];var _0x5d85d3=_0x1578b6[_0xbe14('0x62')](-0x1);if(_0x5d85d3==='/'){_0x1578b6=_0x1578b6[_0xbe14('0x63')](0x0,_0x1578b6[_0xbe14('0x64')](_0x5d85d3));}return rp({'method':'GET','uri':util[_0xbe14('0x65')](_0xbe14('0x66'),_0x1578b6,_0xbe14('0x67')),'headers':{'Authorization':util['format'](_0xbe14('0x68'),new Buffer(util[_0xbe14('0x65')](_0xbe14('0x69'),_0x589197[_0xbe14('0x61')]))['toString'](_0xbe14('0x6a')))},'json':!![]});}})[_0xbe14('0x1c')](function(_0x34f90b){if(_0x34f90b){var _0x2b2e0e=[_0xbe14('0x6b'),_0xbe14('0x6c'),_0xbe14('0x6d'),'description',_0xbe14('0x2d'),_0xbe14('0x6e'),_0xbe14('0x6f'),'source',_0xbe14('0x70'),_0xbe14('0x6f'),_0xbe14('0x71')];_['remove'](_0x34f90b,function(_0xa53262){return _0x2b2e0e[_0xbe14('0x72')](_0xa53262['name'])||!_0xa53262[_0xbe14('0x73')]&&_0xa53262['type']!==_0xbe14('0x74')&&_0xa53262[_0xbe14('0x47')]!=='custom_dropdown';});return{'count':_0x34f90b['length'],'rows':_[_0xbe14('0x35')](_0x34f90b,function(_0x3db955){return{'id':_0x3db955[_0xbe14('0x33')],'name':_0x3db955['label'],'custom':!_0x3db955[_0xbe14('0x73')],'options':_0x3db955[_0xbe14('0x75')]?_[_0xbe14('0x35')](_0x3db955[_0xbe14('0x75')],function(_0x5ee624){return{'name':_['capitalize'](_0x5ee624),'value':_0x5ee624};}):[]};})};}})[_0xbe14('0x1c')](respondWithResult(_0x508455,null))[_0xbe14('0x26')](function(_0xc8d0f6){var _0x215d5b=_0x1b23a1[_0xbe14('0x3b')][_0xbe14('0x19')]?0x1f4:_0xc8d0f6[_0xbe14('0x76')]||0x1f4;logger['error'](_0xbe14('0x77'),'getFields',_0x215d5b,JSON[_0xbe14('0x22')](_0xc8d0f6));delete _0xc8d0f6[_0xbe14('0x33')];if(_0x215d5b===0x191){_0x215d5b=0x190;}_0x508455[_0xbe14('0x2d')](_0x215d5b)[_0xbe14('0x78')](_0x1b23a1['query'][_0xbe14('0x19')]?{'message':_0xbe14('0x79'),'statusCode':_0xc8d0f6[_0xbe14('0x76')]}:_0xc8d0f6);});}; \ No newline at end of file +var _0x7fbe=['../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','error','code','FreshdeskAccount,\x20%s,\x20%s','message','result','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','FreshdeskAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','filter','where','VIRTUAL','options','findAll','rows','params','includeAll','create','body','catch','find','findOne','merge','getConfigurations','addConfiguration','Subjects','getSubjects','channel','Descriptions','FreshdeskConfiguration','FreshdeskField','getFields','remoteUri','slice','lastIndexOf','GET','format','%s/%s','%s:X','apiKey','toString','base64','requester','agent','description','priority','group','source','ticket_type','company','remove','custom_dropdown','label','default','choices','capitalize','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x297153,_0x511733){var _0x43d525=function(_0x335573){while(--_0x335573){_0x297153['push'](_0x297153['shift']());}};_0x43d525(++_0x511733);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x2a74a6,_0x10592f){_0x2a74a6=_0x2a74a6-0x0;var _0xc2e34a=_0x7fbe[_0x2a74a6];return _0xc2e34a;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xe7fb('0x0'));var zipdir=require(_0xe7fb('0x1'));var jsonpatch=require(_0xe7fb('0x2'));var rp=require(_0xe7fb('0x3'));var moment=require(_0xe7fb('0x4'));var BPromise=require(_0xe7fb('0x5'));var Mustache=require(_0xe7fb('0x6'));var util=require(_0xe7fb('0x7'));var path=require(_0xe7fb('0x8'));var sox=require(_0xe7fb('0x9'));var csv=require(_0xe7fb('0xa'));var ejs=require(_0xe7fb('0xb'));var fs=require('fs');var _=require(_0xe7fb('0xc'));var squel=require(_0xe7fb('0xd'));var crypto=require('crypto');var jsforce=require(_0xe7fb('0xe'));var deskjs=require(_0xe7fb('0xf'));var toCsv=require(_0xe7fb('0xa'));var querystring=require(_0xe7fb('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe7fb('0x11'));var qs=require(_0xe7fb('0x12'));var as=require(_0xe7fb('0x13'));var hardwareService=require(_0xe7fb('0x14'));var logger=require(_0xe7fb('0x15'))(_0xe7fb('0x16'));var utils=require(_0xe7fb('0x17'));var config=require(_0xe7fb('0x18'));var db=require(_0xe7fb('0x19'))['db'];var integrations=require(_0xe7fb('0x1a'));var jayson=require(_0xe7fb('0x1b'));var client=jayson[_0xe7fb('0x1c')][_0xe7fb('0x1d')]({'port':0x232a});function checkPasswordPattern(_0x45fe75,_0x7fe4d3,_0x598729){if(_0x598729){var _0x278b75=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x278b75[_0xe7fb('0x1e')](_0x7fe4d3)){return _0x45fe75;}else{throw new db['Sequelize'][(_0xe7fb('0x1f'))](_0xe7fb('0x20'));}}else{return _0x45fe75;}}function respondWithRpcPromise(_0x482f7d,_0xa76acf,_0x559129,_0x12fff6){return new BPromise(function(_0x18d23c,_0x12603d){var _0x17e8a8=_0x12fff6||client;return _0x17e8a8['request'](_0x482f7d,_0x559129)[_0xe7fb('0x21')](function(_0x5ebc87){logger[_0xe7fb('0x22')]('FreshdeskAccount,\x20%s,\x20%s',_0xa76acf,_0xe7fb('0x23'));logger[_0xe7fb('0x24')](_0xe7fb('0x25'),_0xa76acf,_0xe7fb('0x23'),JSON['stringify'](_0x5ebc87));if(_0x5ebc87[_0xe7fb('0x26')]){if(_0x5ebc87['error'][_0xe7fb('0x27')]===0x1f4){logger['error'](_0xe7fb('0x28'),_0xa76acf,_0x5ebc87['error'][_0xe7fb('0x29')]);return _0x12603d(_0x5ebc87[_0xe7fb('0x26')]['message']);}logger[_0xe7fb('0x26')](_0xe7fb('0x28'),_0xa76acf,_0x5ebc87[_0xe7fb('0x26')]['message']);return _0x18d23c(_0x5ebc87[_0xe7fb('0x26')][_0xe7fb('0x29')]);}else{logger['info']('FreshdeskAccount,\x20%s,\x20%s',_0xa76acf,'request\x20sent');_0x18d23c(_0x5ebc87[_0xe7fb('0x2a')]['message']);}})['catch'](function(_0x4026b1){logger[_0xe7fb('0x26')](_0xe7fb('0x28'),_0xa76acf,_0x4026b1);_0x12603d(_0x4026b1);});});}function respondWithStatusCode(_0x4f6c73,_0x6c930){_0x6c930=_0x6c930||0xcc;return function(_0x2b69c4){if(_0x2b69c4){return _0x4f6c73[_0xe7fb('0x2b')](_0x6c930);}return _0x4f6c73[_0xe7fb('0x2c')](_0x6c930)[_0xe7fb('0x2d')]();};}function respondWithResult(_0x16237a,_0x380130){_0x380130=_0x380130||0xc8;return function(_0x59e015){if(_0x59e015){return _0x16237a['status'](_0x380130)[_0xe7fb('0x2e')](_0x59e015);}};}function respondWithFilteredResult(_0x3bdee9,_0xead63){return function(_0x4fd290){if(_0x4fd290){var _0xb1f2f4=_0x4fd290[_0xe7fb('0x2f')],_0x251807=_0xead63[_0xe7fb('0x30')],_0xd3fffe=_0xead63[_0xe7fb('0x30')]+_0xead63[_0xe7fb('0x31')],_0x5f265f;if(_0xd3fffe>=_0xb1f2f4){_0xd3fffe=_0xb1f2f4;_0x5f265f=0xc8;}else{_0x5f265f=0xce;}_0x3bdee9['status'](_0x5f265f);return _0x3bdee9[_0xe7fb('0x32')](_0xe7fb('0x33'),_0x251807+'-'+_0xd3fffe+'/'+_0xb1f2f4)[_0xe7fb('0x2e')](_0x4fd290);}return null;};}function patchUpdates(_0x547a04){return function(_0x517d70){try{jsonpatch[_0xe7fb('0x34')](_0x517d70,_0x547a04,!![]);}catch(_0x4a9fea){return BPromise[_0xe7fb('0x35')](_0x4a9fea);}return _0x517d70[_0xe7fb('0x36')]();};}function saveUpdates(_0xe49053,_0x2a4745){return function(_0x556368){if(_0x556368){return _0x556368[_0xe7fb('0x37')](_0xe49053)[_0xe7fb('0x21')](function(_0x18ed83){return _0x18ed83;});}return null;};}function removeEntity(_0x2f8818,_0x2d650d){return function(_0x480819){if(_0x480819){return _0x480819[_0xe7fb('0x38')]()[_0xe7fb('0x21')](function(){_0x2f8818[_0xe7fb('0x2c')](0xcc)[_0xe7fb('0x2d')]();});}};}function handleEntityNotFound(_0x46f430,_0x25e925){return function(_0x1bc72d){if(!_0x1bc72d){_0x46f430[_0xe7fb('0x2b')](0x194);}return _0x1bc72d;};}function handleError(_0x389903,_0x59f9df){_0x59f9df=_0x59f9df||0x1f4;return function(_0x44d8cf){logger[_0xe7fb('0x26')](_0x44d8cf[_0xe7fb('0x39')]);if(_0x44d8cf['name']){delete _0x44d8cf[_0xe7fb('0x3a')];}_0x389903[_0xe7fb('0x2c')](_0x59f9df)[_0xe7fb('0x3b')](_0x44d8cf);};}exports[_0xe7fb('0x3c')]=function(_0x402ca3,_0x35b828){var _0xfeefb1={},_0xc4e271={},_0x195c35={'count':0x0,'rows':[]};var _0xebfe1d=_[_0xe7fb('0x3d')](db[_0xe7fb('0x3e')][_0xe7fb('0x3f')],function(_0x1c81fe){return{'name':_0x1c81fe[_0xe7fb('0x40')],'type':_0x1c81fe[_0xe7fb('0x41')][_0xe7fb('0x42')]};});_0xc4e271[_0xe7fb('0x43')]=_[_0xe7fb('0x3d')](_0xebfe1d,'name');_0xc4e271[_0xe7fb('0x44')]=_[_0xe7fb('0x45')](_0x402ca3[_0xe7fb('0x44')]);_0xc4e271[_0xe7fb('0x46')]=_['intersection'](_0xc4e271[_0xe7fb('0x43')],_0xc4e271[_0xe7fb('0x44')]);_0xfeefb1[_0xe7fb('0x47')]=_[_0xe7fb('0x48')](_0xc4e271['model'],qs[_0xe7fb('0x49')](_0x402ca3[_0xe7fb('0x44')][_0xe7fb('0x49')]));_0xfeefb1[_0xe7fb('0x47')]=_0xfeefb1[_0xe7fb('0x47')][_0xe7fb('0x4a')]?_0xfeefb1['attributes']:_0xc4e271[_0xe7fb('0x43')];if(!_0x402ca3[_0xe7fb('0x44')][_0xe7fb('0x4b')]('nolimit')){_0xfeefb1[_0xe7fb('0x31')]=qs[_0xe7fb('0x31')](_0x402ca3['query']['limit']);_0xfeefb1['offset']=qs['offset'](_0x402ca3['query'][_0xe7fb('0x30')]);}_0xfeefb1[_0xe7fb('0x4c')]=qs[_0xe7fb('0x4d')](_0x402ca3['query'][_0xe7fb('0x4d')]);_0xfeefb1['where']=qs[_0xe7fb('0x46')](_[_0xe7fb('0x4e')](_0x402ca3['query'],_0xc4e271[_0xe7fb('0x46')]),_0xebfe1d);if(_0x402ca3[_0xe7fb('0x44')][_0xe7fb('0x4f')]){_0xfeefb1[_0xe7fb('0x50')]=_['merge'](_0xfeefb1[_0xe7fb('0x50')],{'$or':_[_0xe7fb('0x3d')](_0xebfe1d,function(_0x1b8a34){if(_0x1b8a34['type']!==_0xe7fb('0x51')){var _0x6eb1ab={};_0x6eb1ab[_0x1b8a34[_0xe7fb('0x3a')]]={'$like':'%'+_0x402ca3[_0xe7fb('0x44')][_0xe7fb('0x4f')]+'%'};return _0x6eb1ab;}})});}_0xfeefb1=_['merge']({},_0xfeefb1,_0x402ca3[_0xe7fb('0x52')]);var _0x4df4aa={'where':_0xfeefb1[_0xe7fb('0x50')]};return db[_0xe7fb('0x3e')][_0xe7fb('0x2f')](_0x4df4aa)[_0xe7fb('0x21')](function(_0x15cec3){_0x195c35['count']=_0x15cec3;if(_0x402ca3[_0xe7fb('0x44')]['includeAll']){_0xfeefb1['include']=[{'all':!![]}];}return db[_0xe7fb('0x3e')][_0xe7fb('0x53')](_0xfeefb1);})[_0xe7fb('0x21')](function(_0x589555){_0x195c35[_0xe7fb('0x54')]=_0x589555;return _0x195c35;})[_0xe7fb('0x21')](respondWithFilteredResult(_0x35b828,_0xfeefb1))['catch'](handleError(_0x35b828,null));};exports['show']=function(_0x284bcb,_0x42270b){var _0x1cbf34={'raw':![],'where':{'id':_0x284bcb[_0xe7fb('0x55')]['id']}},_0x3dd6bf={};_0x3dd6bf[_0xe7fb('0x43')]=_[_0xe7fb('0x45')](db[_0xe7fb('0x3e')]['rawAttributes']);_0x3dd6bf[_0xe7fb('0x44')]=_['keys'](_0x284bcb[_0xe7fb('0x44')]);_0x3dd6bf[_0xe7fb('0x46')]=_['intersection'](_0x3dd6bf[_0xe7fb('0x43')],_0x3dd6bf['query']);_0x1cbf34[_0xe7fb('0x47')]=_['intersection'](_0x3dd6bf[_0xe7fb('0x43')],qs['fields'](_0x284bcb[_0xe7fb('0x44')]['fields']));_0x1cbf34[_0xe7fb('0x47')]=_0x1cbf34[_0xe7fb('0x47')][_0xe7fb('0x4a')]?_0x1cbf34[_0xe7fb('0x47')]:_0x3dd6bf[_0xe7fb('0x43')];if(_0x284bcb[_0xe7fb('0x44')][_0xe7fb('0x56')]){_0x1cbf34['include']=[{'all':!![]}];}_0x1cbf34=_['merge']({},_0x1cbf34,_0x284bcb[_0xe7fb('0x52')]);return db['FreshdeskAccount']['find'](_0x1cbf34)['then'](handleEntityNotFound(_0x42270b,null))['then'](respondWithResult(_0x42270b,null))['catch'](handleError(_0x42270b,null));};exports[_0xe7fb('0x57')]=function(_0x34dd69,_0xd2fd76){return db[_0xe7fb('0x3e')]['create'](_0x34dd69[_0xe7fb('0x58')],{})[_0xe7fb('0x21')](respondWithResult(_0xd2fd76,0xc9))[_0xe7fb('0x59')](handleError(_0xd2fd76,null));};exports['update']=function(_0x56c512,_0x2f3b72){if(_0x56c512[_0xe7fb('0x58')]['id']){delete _0x56c512[_0xe7fb('0x58')]['id'];}return db['FreshdeskAccount'][_0xe7fb('0x5a')]({'where':{'id':_0x56c512[_0xe7fb('0x55')]['id']}})[_0xe7fb('0x21')](handleEntityNotFound(_0x2f3b72,null))[_0xe7fb('0x21')](saveUpdates(_0x56c512['body'],null))['then'](respondWithResult(_0x2f3b72,null))[_0xe7fb('0x59')](handleError(_0x2f3b72,null));};exports[_0xe7fb('0x38')]=function(_0x1f16b2,_0x2f61b1){return db[_0xe7fb('0x3e')]['find']({'where':{'id':_0x1f16b2[_0xe7fb('0x55')]['id']}})[_0xe7fb('0x21')](handleEntityNotFound(_0x2f61b1,null))[_0xe7fb('0x21')](removeEntity(_0x2f61b1,null))['catch'](handleError(_0x2f61b1,null));};exports['getConfigurations']=function(_0x425bee,_0x3b69f7,_0x14fe1b){var _0x1c4035={};var _0x40f546={};var _0x3385e2;var _0x585b7c;return db[_0xe7fb('0x3e')][_0xe7fb('0x5b')]({'where':{'id':_0x425bee[_0xe7fb('0x55')]['id']}})[_0xe7fb('0x21')](handleEntityNotFound(_0x3b69f7,null))[_0xe7fb('0x21')](function(_0x1e0d69){if(_0x1e0d69){_0x3385e2=_0x1e0d69;_0x40f546['model']=_[_0xe7fb('0x45')](db['FreshdeskConfiguration'][_0xe7fb('0x3f')]);_0x40f546[_0xe7fb('0x44')]=_[_0xe7fb('0x45')](_0x425bee[_0xe7fb('0x44')]);_0x40f546['filters']=_['intersection'](_0x40f546[_0xe7fb('0x43')],_0x40f546[_0xe7fb('0x44')]);_0x1c4035[_0xe7fb('0x47')]=_[_0xe7fb('0x48')](_0x40f546[_0xe7fb('0x43')],qs['fields'](_0x425bee[_0xe7fb('0x44')]['fields']));_0x1c4035[_0xe7fb('0x47')]=_0x1c4035['attributes']['length']?_0x1c4035[_0xe7fb('0x47')]:_0x40f546[_0xe7fb('0x43')];_0x1c4035[_0xe7fb('0x4c')]=qs['sort'](_0x425bee[_0xe7fb('0x44')][_0xe7fb('0x4d')]);_0x1c4035[_0xe7fb('0x50')]=qs[_0xe7fb('0x46')](_[_0xe7fb('0x4e')](_0x425bee['query'],_0x40f546[_0xe7fb('0x46')]));if(_0x425bee[_0xe7fb('0x44')]['filter']){_0x1c4035[_0xe7fb('0x50')]=_[_0xe7fb('0x5c')](_0x1c4035['where'],{'$or':_[_0xe7fb('0x3d')](_0x1c4035['attributes'],function(_0x2705ef){var _0x1dc9c1={};_0x1dc9c1[_0x2705ef]={'$like':'%'+_0x425bee[_0xe7fb('0x44')]['filter']+'%'};return _0x1dc9c1;})});}_0x1c4035=_[_0xe7fb('0x5c')]({},_0x1c4035,_0x425bee[_0xe7fb('0x52')]);return _0x3385e2[_0xe7fb('0x5d')](_0x1c4035);}})[_0xe7fb('0x21')](function(_0x35487f){if(_0x35487f){_0x585b7c=_0x35487f[_0xe7fb('0x4a')];if(!_0x425bee[_0xe7fb('0x44')][_0xe7fb('0x4b')]('nolimit')){_0x1c4035['limit']=qs[_0xe7fb('0x31')](_0x425bee[_0xe7fb('0x44')][_0xe7fb('0x31')]);_0x1c4035['offset']=qs['offset'](_0x425bee[_0xe7fb('0x44')][_0xe7fb('0x30')]);}return _0x3385e2[_0xe7fb('0x5d')](_0x1c4035);}})[_0xe7fb('0x21')](function(_0x2d558c){if(_0x2d558c){return _0x2d558c?{'count':_0x585b7c,'rows':_0x2d558c}:null;}})[_0xe7fb('0x21')](respondWithResult(_0x3b69f7,null))[_0xe7fb('0x59')](handleError(_0x3b69f7,null));};exports[_0xe7fb('0x5e')]=function(_0xb06693,_0x3691a6,_0x1ff5e7){if(_0xb06693[_0xe7fb('0x58')]['id']){delete _0xb06693[_0xe7fb('0x58')]['id'];}return db['FreshdeskAccount']['findOne']({'where':{'id':_0xb06693[_0xe7fb('0x55')]['id']}})[_0xe7fb('0x21')](handleEntityNotFound(_0x3691a6,null))[_0xe7fb('0x21')](function(_0x16cd8f){if(_0x16cd8f){_0xb06693[_0xe7fb('0x58')]['AccountId']=_0x16cd8f['id'];_0xb06693[_0xe7fb('0x58')][_0xe7fb('0x5f')]=integrations[_0xe7fb('0x60')](_0xb06693[_0xe7fb('0x58')][_0xe7fb('0x61')],_0xb06693[_0xe7fb('0x58')][_0xe7fb('0x41')]);_0xb06693[_0xe7fb('0x58')][_0xe7fb('0x62')]=integrations['getDescriptions'](_0xb06693[_0xe7fb('0x58')]['channel'],_0xb06693[_0xe7fb('0x58')][_0xe7fb('0x41')]);return db[_0xe7fb('0x63')][_0xe7fb('0x57')](_0xb06693[_0xe7fb('0x58')],{'include':[{'model':db['FreshdeskField'],'as':_0xe7fb('0x5f')},{'model':db[_0xe7fb('0x64')],'as':_0xe7fb('0x62')}]});}return null;})[_0xe7fb('0x21')](respondWithResult(_0x3691a6,null))[_0xe7fb('0x59')](handleError(_0x3691a6,null));};exports[_0xe7fb('0x65')]=function(_0x10a6e8,_0x17e640,_0x3d139f){var _0x59731e='';return db[_0xe7fb('0x3e')][_0xe7fb('0x5b')]({'where':{'id':_0x10a6e8[_0xe7fb('0x55')]['id']},'attributes':['id',_0xe7fb('0x66'),'apiKey']})['then'](handleEntityNotFound(_0x17e640,null))['then'](function(_0x13265b){if(_0x13265b){_0x59731e=_0x13265b[_0xe7fb('0x66')];var _0x25e4d9=_0x59731e[_0xe7fb('0x67')](-0x1);if(_0x25e4d9==='/'){_0x59731e=_0x59731e['substring'](0x0,_0x59731e[_0xe7fb('0x68')](_0x25e4d9));}return rp({'method':_0xe7fb('0x69'),'uri':util[_0xe7fb('0x6a')](_0xe7fb('0x6b'),_0x59731e,'api/v2/ticket_fields'),'headers':{'Authorization':util[_0xe7fb('0x6a')]('Basic\x20%s',new Buffer(util[_0xe7fb('0x6a')](_0xe7fb('0x6c'),_0x13265b[_0xe7fb('0x6d')]))[_0xe7fb('0x6e')](_0xe7fb('0x6f')))},'json':!![]});}})['then'](function(_0x3ffd6c){if(_0x3ffd6c){var _0x5b8f3e=[_0xe7fb('0x70'),'subject',_0xe7fb('0x71'),_0xe7fb('0x72'),'status',_0xe7fb('0x73'),_0xe7fb('0x74'),_0xe7fb('0x75'),_0xe7fb('0x76'),'group',_0xe7fb('0x77')];_[_0xe7fb('0x78')](_0x3ffd6c,function(_0x1412e2){return _0x5b8f3e['includes'](_0x1412e2[_0xe7fb('0x3a')])||!_0x1412e2['default']&&_0x1412e2['type']!=='custom_text'&&_0x1412e2[_0xe7fb('0x41')]!==_0xe7fb('0x79');});return{'count':_0x3ffd6c['length'],'rows':_[_0xe7fb('0x3d')](_0x3ffd6c,function(_0x266bba){return{'id':_0x266bba[_0xe7fb('0x3a')],'name':_0x266bba[_0xe7fb('0x7a')],'custom':!_0x266bba[_0xe7fb('0x7b')],'options':_0x266bba[_0xe7fb('0x7c')]?_[_0xe7fb('0x3d')](_0x266bba[_0xe7fb('0x7c')],function(_0x42190e){return{'name':_[_0xe7fb('0x7d')](_0x42190e),'value':_0x42190e};}):[]};})};}})[_0xe7fb('0x21')](respondWithResult(_0x17e640,null))[_0xe7fb('0x59')](function(_0x3d1f34){var _0x27c97a=_0x10a6e8[_0xe7fb('0x44')][_0xe7fb('0x1e')]?0x1f4:_0x3d1f34[_0xe7fb('0x7e')]||0x1f4;logger[_0xe7fb('0x26')](_0xe7fb('0x7f'),_0xe7fb('0x65'),_0x27c97a,JSON['stringify'](_0x3d1f34));delete _0x3d1f34[_0xe7fb('0x3a')];if(_0x27c97a===0x191){_0x27c97a=0x190;}_0x17e640[_0xe7fb('0x2c')](_0x27c97a)[_0xe7fb('0x3b')](_0x10a6e8[_0xe7fb('0x44')][_0xe7fb('0x1e')]?{'message':_0xe7fb('0x80'),'statusCode':_0x3d1f34[_0xe7fb('0x7e')]}:_0x3d1f34);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 2731077..2c77de4 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 _0x498f=['./intFreshdeskAccount.attributes','../../components/integrations/configuration','FreshdeskAccount','int_freshdesk_accounts','lodash','api','moment','rimraf','../../config/environment'];(function(_0x191c42,_0x13fa6d){var _0x1b055f=function(_0x38f6bd){while(--_0x38f6bd){_0x191c42['push'](_0x191c42['shift']());}};_0x1b055f(++_0x13fa6d);}(_0x498f,0x100));var _0xf498=function(_0x58c766,_0x207d43){_0x58c766=_0x58c766-0x0;var _0x8d22b7=_0x498f[_0x58c766];return _0x8d22b7;};'use strict';var _=require(_0xf498('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf498('0x1'));var moment=require(_0xf498('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xf498('0x3'));var config=require(_0xf498('0x4'));var attributes=require(_0xf498('0x5'));var integrations=require(_0xf498('0x6'));module['exports']=function(_0x740d41,_0x2523f0){return _0x740d41['define'](_0xf498('0x7'),attributes,{'tableName':_0xf498('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa14e=['util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','define','lodash'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa14e,0x6b));var _0xea14=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0xa14e[_0x46e363];return _0x3fb059;};'use strict';var _=require(_0xea14('0x0'));var util=require(_0xea14('0x1'));var logger=require(_0xea14('0x2'))(_0xea14('0x3'));var moment=require(_0xea14('0x4'));var BPromise=require(_0xea14('0x5'));var rp=require(_0xea14('0x6'));var fs=require('fs');var path=require(_0xea14('0x7'));var rimraf=require('rimraf');var config=require(_0xea14('0x8'));var attributes=require(_0xea14('0x9'));var integrations=require(_0xea14('0xa'));module['exports']=function(_0x1f0441,_0x215ebd){return _0x1f0441[_0xea14('0xb')]('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 9aa8f90..cd71ccc 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 _0x8e1f=['message','info','result','catch','GetFreshdeskAccount','FreshdeskAccount','options','raw','where','attributes','limit','include','map','model','then','debug','stringify','find','ShowFreshdeskAccount','lodash','util','moment','bluebird','../../config/utils','../../config/logger','jayson/promise','client','http','request','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','FreshdeskAccount,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x330740,_0x58c0c0){var _0x1cb5f2=function(_0xa5c99a){while(--_0xa5c99a){_0x330740['push'](_0x330740['shift']());}};_0x1cb5f2(++_0x58c0c0);}(_0x8e1f,0x101));var _0xf8e1=function(_0x1421c3,_0x3cb122){_0x1421c3=_0x1421c3-0x0;var _0x4b791d=_0x8e1f[_0x1421c3];return _0x4b791d;};'use strict';var _=require(_0xf8e1('0x0'));var util=require(_0xf8e1('0x1'));var moment=require(_0xf8e1('0x2'));var BPromise=require(_0xf8e1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xf8e1('0x4'));var logger=require(_0xf8e1('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xf8e1('0x6'));var client=jayson[_0xf8e1('0x7')][_0xf8e1('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5ca9bd,_0x388237,_0x48331c){return new BPromise(function(_0x50fda3,_0x445c8b){return client[_0xf8e1('0x9')](_0x5ca9bd,_0x48331c)['then'](function(_0xe403e2){logger['info'](_0xf8e1('0xa'),_0x388237,_0xf8e1('0xb'));logger['debug'](_0xf8e1('0xc'),_0x388237,_0xf8e1('0xb'),JSON['stringify'](_0xe403e2));if(_0xe403e2[_0xf8e1('0xd')]){if(_0xe403e2['error'][_0xf8e1('0xe')]===0x1f4){logger[_0xf8e1('0xd')]('FreshdeskAccount,\x20%s,\x20%s',_0x388237,_0xe403e2[_0xf8e1('0xd')][_0xf8e1('0xf')]);return _0x445c8b(_0xe403e2[_0xf8e1('0xd')][_0xf8e1('0xf')]);}logger[_0xf8e1('0xd')](_0xf8e1('0xa'),_0x388237,_0xe403e2['error']['message']);return _0x50fda3(_0xe403e2['error']['message']);}else{logger[_0xf8e1('0x10')](_0xf8e1('0xa'),_0x388237,_0xf8e1('0xb'));_0x50fda3(_0xe403e2[_0xf8e1('0x11')]['message']);}})[_0xf8e1('0x12')](function(_0x57604b){logger['error'](_0xf8e1('0xa'),_0x388237,_0x57604b);_0x445c8b(_0x57604b);});});}exports[_0xf8e1('0x13')]=function(_0x3f056a){var _0x468cdd=this;return new Promise(function(_0x4e2431,_0x582a32){return db[_0xf8e1('0x14')]['findAll']({'raw':_0x3f056a[_0xf8e1('0x15')]?_0x3f056a['options'][_0xf8e1('0x16')]===undefined?!![]:![]:!![],'where':_0x3f056a[_0xf8e1('0x15')]?_0x3f056a['options'][_0xf8e1('0x17')]||null:null,'attributes':_0x3f056a[_0xf8e1('0x15')]?_0x3f056a[_0xf8e1('0x15')][_0xf8e1('0x18')]||null:null,'limit':_0x3f056a['options']?_0x3f056a[_0xf8e1('0x15')][_0xf8e1('0x19')]||null:null,'include':_0x3f056a[_0xf8e1('0x15')]?_0x3f056a['options'][_0xf8e1('0x1a')]?_['map'](_0x3f056a[_0xf8e1('0x15')][_0xf8e1('0x1a')],function(_0x3ea9a1){return{'model':db[_0x3ea9a1['model']],'as':_0x3ea9a1['as'],'attributes':_0x3ea9a1[_0xf8e1('0x18')],'include':_0x3ea9a1['include']?_[_0xf8e1('0x1b')](_0x3ea9a1['include'],function(_0x27b4bf){return{'model':db[_0x27b4bf[_0xf8e1('0x1c')]],'as':_0x27b4bf['as'],'attributes':_0x27b4bf['attributes'],'include':_0x27b4bf['include']?_[_0xf8e1('0x1b')](_0x27b4bf[_0xf8e1('0x1a')],function(_0x1a2393){return{'model':db[_0x1a2393[_0xf8e1('0x1c')]],'as':_0x1a2393['as'],'attributes':_0x1a2393[_0xf8e1('0x18')]};}):[]};}):[]};}):[]:[]})[_0xf8e1('0x1d')](function(_0x112d53){logger[_0xf8e1('0x10')]('GetFreshdeskAccount',_0x3f056a);logger[_0xf8e1('0x1e')]('GetFreshdeskAccount',_0x3f056a,JSON[_0xf8e1('0x1f')](_0x112d53));_0x4e2431(_0x112d53);})[_0xf8e1('0x12')](function(_0x2dcf65){logger[_0xf8e1('0xd')](_0xf8e1('0x13'),_0x2dcf65[_0xf8e1('0xf')],_0x3f056a);_0x582a32(_0x468cdd[_0xf8e1('0xd')](0x1f4,_0x2dcf65[_0xf8e1('0xf')]));});});};exports['ShowFreshdeskAccount']=function(_0x4b3152){var _0x2fa002=this;return new Promise(function(_0x308964,_0x1f1928){return db[_0xf8e1('0x14')][_0xf8e1('0x20')]({'raw':_0x4b3152[_0xf8e1('0x15')]?_0x4b3152[_0xf8e1('0x15')][_0xf8e1('0x16')]===undefined?!![]:![]:!![],'where':_0x4b3152['options']?_0x4b3152[_0xf8e1('0x15')]['where']||null:null,'attributes':_0x4b3152[_0xf8e1('0x15')]?_0x4b3152[_0xf8e1('0x15')][_0xf8e1('0x18')]||null:null,'include':_0x4b3152[_0xf8e1('0x15')]?_0x4b3152[_0xf8e1('0x15')][_0xf8e1('0x1a')]?_[_0xf8e1('0x1b')](_0x4b3152[_0xf8e1('0x15')][_0xf8e1('0x1a')],function(_0x1fc3e6){return{'model':db[_0x1fc3e6[_0xf8e1('0x1c')]],'as':_0x1fc3e6['as'],'attributes':_0x1fc3e6['attributes'],'include':_0x1fc3e6[_0xf8e1('0x1a')]?_[_0xf8e1('0x1b')](_0x1fc3e6['include'],function(_0x5cee23){return{'model':db[_0x5cee23[_0xf8e1('0x1c')]],'as':_0x5cee23['as'],'attributes':_0x5cee23[_0xf8e1('0x18')],'include':_0x5cee23['include']?_[_0xf8e1('0x1b')](_0x5cee23[_0xf8e1('0x1a')],function(_0xcfff3f){return{'model':db[_0xcfff3f[_0xf8e1('0x1c')]],'as':_0xcfff3f['as'],'attributes':_0xcfff3f[_0xf8e1('0x18')]};}):[]};}):[]};}):[]:[]})[_0xf8e1('0x1d')](function(_0x29d860){logger[_0xf8e1('0x10')]('ShowFreshdeskAccount',_0x4b3152);logger[_0xf8e1('0x1e')](_0xf8e1('0x21'),_0x4b3152,JSON[_0xf8e1('0x1f')](_0x29d860));_0x308964(_0x29d860);})['catch'](function(_0x10eef6){logger[_0xf8e1('0xd')](_0xf8e1('0x21'),_0x10eef6[_0xf8e1('0xf')],_0x4b3152);_0x1f1928(_0x2fa002[_0xf8e1('0xd')](0x1f4,_0x10eef6[_0xf8e1('0xf')]));});});}; \ No newline at end of file +var _0x1063=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','FreshdeskAccount,\x20%s,\x20%s','result','catch','FreshdeskAccount','findAll','options','where','limit','include','map','model','attributes','GetFreshdeskAccount','stringify','ShowFreshdeskAccount','find','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0xf1c04e,_0x209cc0){var _0x54c6a1=function(_0x1edc35){while(--_0x1edc35){_0xf1c04e['push'](_0xf1c04e['shift']());}};_0x54c6a1(++_0x209cc0);}(_0x1063,0x102));var _0x3106=function(_0x5dbdbc,_0x110227){_0x5dbdbc=_0x5dbdbc-0x0;var _0x2b33fe=_0x1063[_0x5dbdbc];return _0x2b33fe;};'use strict';var _=require(_0x3106('0x0'));var util=require(_0x3106('0x1'));var moment=require(_0x3106('0x2'));var BPromise=require(_0x3106('0x3'));var rs=require(_0x3106('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3106('0x5'))['db'];var utils=require(_0x3106('0x6'));var logger=require(_0x3106('0x7'))(_0x3106('0x8'));var config=require(_0x3106('0x9'));var jayson=require(_0x3106('0xa'));var client=jayson[_0x3106('0xb')][_0x3106('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x492ebf,_0x3e87b1,_0x11d2ba){return new BPromise(function(_0x18273d,_0x1d6d49){return client[_0x3106('0xd')](_0x492ebf,_0x11d2ba)[_0x3106('0xe')](function(_0x2e3e20){logger[_0x3106('0xf')]('FreshdeskAccount,\x20%s,\x20%s',_0x3e87b1,_0x3106('0x10'));logger[_0x3106('0x11')](_0x3106('0x12'),_0x3e87b1,_0x3106('0x10'),JSON['stringify'](_0x2e3e20));if(_0x2e3e20[_0x3106('0x13')]){if(_0x2e3e20[_0x3106('0x13')][_0x3106('0x14')]===0x1f4){logger[_0x3106('0x13')]('FreshdeskAccount,\x20%s,\x20%s',_0x3e87b1,_0x2e3e20[_0x3106('0x13')][_0x3106('0x15')]);return _0x1d6d49(_0x2e3e20['error'][_0x3106('0x15')]);}logger[_0x3106('0x13')](_0x3106('0x16'),_0x3e87b1,_0x2e3e20['error'][_0x3106('0x15')]);return _0x18273d(_0x2e3e20[_0x3106('0x13')][_0x3106('0x15')]);}else{logger[_0x3106('0xf')]('FreshdeskAccount,\x20%s,\x20%s',_0x3e87b1,'request\x20sent');_0x18273d(_0x2e3e20[_0x3106('0x17')][_0x3106('0x15')]);}})[_0x3106('0x18')](function(_0x74c660){logger['error']('FreshdeskAccount,\x20%s,\x20%s',_0x3e87b1,_0x74c660);_0x1d6d49(_0x74c660);});});}exports['GetFreshdeskAccount']=function(_0x2d768a){var _0x15e397=this;return new Promise(function(_0x473dab,_0x70b22b){return db[_0x3106('0x19')][_0x3106('0x1a')]({'raw':_0x2d768a[_0x3106('0x1b')]?_0x2d768a[_0x3106('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x2d768a[_0x3106('0x1b')]?_0x2d768a['options'][_0x3106('0x1c')]||null:null,'attributes':_0x2d768a[_0x3106('0x1b')]?_0x2d768a['options']['attributes']||null:null,'limit':_0x2d768a['options']?_0x2d768a[_0x3106('0x1b')][_0x3106('0x1d')]||null:null,'include':_0x2d768a['options']?_0x2d768a[_0x3106('0x1b')][_0x3106('0x1e')]?_[_0x3106('0x1f')](_0x2d768a[_0x3106('0x1b')][_0x3106('0x1e')],function(_0x5d25e6){return{'model':db[_0x5d25e6[_0x3106('0x20')]],'as':_0x5d25e6['as'],'attributes':_0x5d25e6[_0x3106('0x21')],'include':_0x5d25e6[_0x3106('0x1e')]?_[_0x3106('0x1f')](_0x5d25e6[_0x3106('0x1e')],function(_0x3133ff){return{'model':db[_0x3133ff[_0x3106('0x20')]],'as':_0x3133ff['as'],'attributes':_0x3133ff['attributes'],'include':_0x3133ff[_0x3106('0x1e')]?_[_0x3106('0x1f')](_0x3133ff['include'],function(_0x367a90){return{'model':db[_0x367a90['model']],'as':_0x367a90['as'],'attributes':_0x367a90[_0x3106('0x21')]};}):[]};}):[]};}):[]:[]})[_0x3106('0xe')](function(_0x8f2b36){logger[_0x3106('0xf')](_0x3106('0x22'),_0x2d768a);logger[_0x3106('0x11')](_0x3106('0x22'),_0x2d768a,JSON[_0x3106('0x23')](_0x8f2b36));_0x473dab(_0x8f2b36);})['catch'](function(_0x41c38b){logger['error'](_0x3106('0x22'),_0x41c38b[_0x3106('0x15')],_0x2d768a);_0x70b22b(_0x15e397['error'](0x1f4,_0x41c38b[_0x3106('0x15')]));});});};exports[_0x3106('0x24')]=function(_0x4be83){var _0x14fdc3=this;return new Promise(function(_0x1fbcf8,_0x3e7d94){return db[_0x3106('0x19')][_0x3106('0x25')]({'raw':_0x4be83[_0x3106('0x1b')]?_0x4be83[_0x3106('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x4be83[_0x3106('0x1b')]?_0x4be83['options'][_0x3106('0x1c')]||null:null,'attributes':_0x4be83[_0x3106('0x1b')]?_0x4be83['options'][_0x3106('0x21')]||null:null,'include':_0x4be83[_0x3106('0x1b')]?_0x4be83[_0x3106('0x1b')][_0x3106('0x1e')]?_['map'](_0x4be83[_0x3106('0x1b')]['include'],function(_0x5f1ae5){return{'model':db[_0x5f1ae5[_0x3106('0x20')]],'as':_0x5f1ae5['as'],'attributes':_0x5f1ae5['attributes'],'include':_0x5f1ae5[_0x3106('0x1e')]?_['map'](_0x5f1ae5[_0x3106('0x1e')],function(_0x5909ba){return{'model':db[_0x5909ba['model']],'as':_0x5909ba['as'],'attributes':_0x5909ba['attributes'],'include':_0x5909ba['include']?_[_0x3106('0x1f')](_0x5909ba[_0x3106('0x1e')],function(_0x32fde3){return{'model':db[_0x32fde3[_0x3106('0x20')]],'as':_0x32fde3['as'],'attributes':_0x32fde3[_0x3106('0x21')]};}):[]};}):[]};}):[]:[]})[_0x3106('0xe')](function(_0x8c476b){logger['info'](_0x3106('0x24'),_0x4be83);logger[_0x3106('0x11')](_0x3106('0x24'),_0x4be83,JSON[_0x3106('0x23')](_0x8c476b));_0x1fbcf8(_0x8c476b);})[_0x3106('0x18')](function(_0x50966b){logger[_0x3106('0x13')](_0x3106('0x24'),_0x50966b[_0x3106('0x15')],_0x4be83);_0x3e7d94(_0x14fdc3['error'](0x1f4,_0x50966b[_0x3106('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 77878b1..0397243 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 _0x4c82=['post','setTags','put','update','destroy','multer','connect-timeout','Router','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','isAuthenticated','index','get','/:id','show','/:id/fields','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags'];(function(_0x3fc59a,_0x5c0c1d){var _0x2af724=function(_0xa23f3e){while(--_0xa23f3e){_0x3fc59a['push'](_0x3fc59a['shift']());}};_0x2af724(++_0x5c0c1d);}(_0x4c82,0xb5));var _0x24c8=function(_0x4db341,_0xb12794){_0x4db341=_0x4db341-0x0;var _0x193cb0=_0x4c82[_0x4db341];return _0x193cb0;};'use strict';var multer=require(_0x24c8('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x24c8('0x1'));var express=require('express');var router=express[_0x24c8('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x24c8('0x3'));var config=require(_0x24c8('0x4'));var controller=require(_0x24c8('0x5'));router['get']('/',auth[_0x24c8('0x6')](),controller[_0x24c8('0x7')]);router[_0x24c8('0x8')](_0x24c8('0x9'),auth['isAuthenticated'](),controller[_0x24c8('0xa')]);router['get'](_0x24c8('0xb'),auth[_0x24c8('0x6')](),controller['getFields']);router[_0x24c8('0x8')]('/:id/subjects',auth['isAuthenticated'](),controller[_0x24c8('0xc')]);router['get'](_0x24c8('0xd'),auth[_0x24c8('0x6')](),controller[_0x24c8('0xe')]);router[_0x24c8('0x8')](_0x24c8('0xf'),auth[_0x24c8('0x6')](),controller[_0x24c8('0x10')]);router[_0x24c8('0x11')]('/',auth[_0x24c8('0x6')](),controller['create']);router[_0x24c8('0x11')]('/:id/tags',auth[_0x24c8('0x6')](),controller[_0x24c8('0x12')]);router[_0x24c8('0x13')](_0x24c8('0x9'),auth['isAuthenticated'](),controller[_0x24c8('0x14')]);router['delete'](_0x24c8('0x9'),auth[_0x24c8('0x6')](),controller[_0x24c8('0x15')]);module['exports']=router; \ No newline at end of file +var _0xca89=['delete','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','/:id/subjects','getSubjects','getDescriptions','/:id/tags','post','create','setTags','update'];(function(_0x3abff9,_0x543ec5){var _0x38dbd2=function(_0x259a1d){while(--_0x259a1d){_0x3abff9['push'](_0x3abff9['shift']());}};_0x38dbd2(++_0x543ec5);}(_0xca89,0x12f));var _0x9ca8=function(_0x16e887,_0x46a08f){_0x16e887=_0x16e887-0x0;var _0x2bdffd=_0xca89[_0x16e887];return _0x2bdffd;};'use strict';var multer=require(_0x9ca8('0x0'));var util=require(_0x9ca8('0x1'));var path=require(_0x9ca8('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9ca8('0x3')]();var auth=require(_0x9ca8('0x4'));var interaction=require(_0x9ca8('0x5'));var config=require(_0x9ca8('0x6'));var controller=require(_0x9ca8('0x7'));router[_0x9ca8('0x8')]('/',auth[_0x9ca8('0x9')](),controller[_0x9ca8('0xa')]);router[_0x9ca8('0x8')](_0x9ca8('0xb'),auth['isAuthenticated'](),controller[_0x9ca8('0xc')]);router[_0x9ca8('0x8')](_0x9ca8('0xd'),auth[_0x9ca8('0x9')](),controller['getFields']);router[_0x9ca8('0x8')](_0x9ca8('0xe'),auth[_0x9ca8('0x9')](),controller[_0x9ca8('0xf')]);router[_0x9ca8('0x8')]('/:id/descriptions',auth[_0x9ca8('0x9')](),controller[_0x9ca8('0x10')]);router[_0x9ca8('0x8')](_0x9ca8('0x11'),auth[_0x9ca8('0x9')](),controller['getTags']);router[_0x9ca8('0x12')]('/',auth[_0x9ca8('0x9')](),controller[_0x9ca8('0x13')]);router['post'](_0x9ca8('0x11'),auth[_0x9ca8('0x9')](),controller[_0x9ca8('0x14')]);router['put'](_0x9ca8('0xb'),auth['isAuthenticated'](),controller[_0x9ca8('0x15')]);router[_0x9ca8('0x16')]('/:id',auth[_0x9ca8('0x9')](),controller[_0x9ca8('0x17')]);module[_0x9ca8('0x18')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 5dac657..9841662 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 _0xbf5b=['STRING','exports'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xbf5b,0x1b9));var _0xbbf5=function(_0x360dc2,_0x843dd0){_0x360dc2=_0x360dc2-0x0;var _0x32817d=_0xbf5b[_0x360dc2];return _0x32817d;};'use strict';var Sequelize=require('sequelize');module[_0xbbf5('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xbbf5('0x1')]}}; \ No newline at end of file +var _0xaa07=['sequelize','exports','STRING'];(function(_0x38877e,_0x2e8104){var _0x2faaad=function(_0x2e1f19){while(--_0x2e1f19){_0x38877e['push'](_0x38877e['shift']());}};_0x2faaad(++_0x2e8104);}(_0xaa07,0x192));var _0x7aa0=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xaa07[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x7aa0('0x0'));module[_0x7aa0('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x7aa0('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 2deb5ab..f4dbbc2 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 _0xe0ae=['then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','json','count','offset','limit','status','set','Content-Range','apply','reject','save','update','destroy','end','stack','name','send','map','FreshdeskConfiguration','rawAttributes','type','key','keys','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','rows','show','params','length','create','body','find','getFields','findOne','FreshdeskField','filter','getSubjects','getDescriptions','getTags','Tag','setTags','ids','rimraf','zip-dir','request-promise','bluebird','mustache','path','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','client','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request'];(function(_0x26baa8,_0x1a199d){var _0x3a8ada=function(_0x548b8f){while(--_0x548b8f){_0x26baa8['push'](_0x26baa8['shift']());}};_0x3a8ada(++_0x1a199d);}(_0xe0ae,0xa1));var _0xee0a=function(_0x4de877,_0x340170){_0x4de877=_0x4de877-0x0;var _0xb2cfeb=_0xe0ae[_0x4de877];return _0xb2cfeb;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xee0a('0x0'));var zipdir=require(_0xee0a('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xee0a('0x2'));var moment=require('moment');var BPromise=require(_0xee0a('0x3'));var Mustache=require(_0xee0a('0x4'));var util=require('util');var path=require(_0xee0a('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xee0a('0x6'));var fs=require('fs');var _=require(_0xee0a('0x7'));var squel=require(_0xee0a('0x8'));var crypto=require(_0xee0a('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xee0a('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xee0a('0xb'));var Redis=require(_0xee0a('0xc'));var authService=require(_0xee0a('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0xee0a('0xe'));var hardwareService=require(_0xee0a('0xf'));var logger=require('../../config/logger')(_0xee0a('0x10'));var utils=require('../../config/utils');var config=require(_0xee0a('0x11'));var db=require(_0xee0a('0x12'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xee0a('0x13')]['http']({'port':0x232a});function checkPasswordPattern(_0x32fad9,_0x1f2e57,_0x58adf4){if(_0x58adf4){var _0x4e1cd0=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4e1cd0[_0xee0a('0x14')](_0x1f2e57)){return _0x32fad9;}else{throw new db[(_0xee0a('0x15'))][(_0xee0a('0x16'))](_0xee0a('0x17'));}}else{return _0x32fad9;}}function respondWithRpcPromise(_0x41d4e4,_0x57afe6,_0xb891a9,_0xd39431){return new BPromise(function(_0x50063f,_0x2c804a){var _0x35d1e4=_0xd39431||client;return _0x35d1e4[_0xee0a('0x18')](_0x41d4e4,_0xb891a9)[_0xee0a('0x19')](function(_0x4f711b){logger[_0xee0a('0x1a')](_0xee0a('0x1b'),_0x57afe6,_0xee0a('0x1c'));logger['debug'](_0xee0a('0x1d'),_0x57afe6,_0xee0a('0x1c'),JSON[_0xee0a('0x1e')](_0x4f711b));if(_0x4f711b[_0xee0a('0x1f')]){if(_0x4f711b['error'][_0xee0a('0x20')]===0x1f4){logger[_0xee0a('0x1f')](_0xee0a('0x1b'),_0x57afe6,_0x4f711b[_0xee0a('0x1f')]['message']);return _0x2c804a(_0x4f711b[_0xee0a('0x1f')][_0xee0a('0x21')]);}logger[_0xee0a('0x1f')](_0xee0a('0x1b'),_0x57afe6,_0x4f711b[_0xee0a('0x1f')][_0xee0a('0x21')]);return _0x50063f(_0x4f711b[_0xee0a('0x1f')]['message']);}else{logger[_0xee0a('0x1a')](_0xee0a('0x1b'),_0x57afe6,_0xee0a('0x1c'));_0x50063f(_0x4f711b[_0xee0a('0x22')]['message']);}})[_0xee0a('0x23')](function(_0x197616){logger[_0xee0a('0x1f')](_0xee0a('0x1b'),_0x57afe6,_0x197616);_0x2c804a(_0x197616);});});}function respondWithStatusCode(_0x4c61e2,_0x50e9d1){_0x50e9d1=_0x50e9d1||0xcc;return function(_0x578ecf){if(_0x578ecf){return _0x4c61e2[_0xee0a('0x24')](_0x50e9d1);}return _0x4c61e2['status'](_0x50e9d1)['end']();};}function respondWithResult(_0x1c9ad8,_0x2c8965){_0x2c8965=_0x2c8965||0xc8;return function(_0xe5365f){if(_0xe5365f){return _0x1c9ad8['status'](_0x2c8965)[_0xee0a('0x25')](_0xe5365f);}};}function respondWithFilteredResult(_0xe14449,_0x15b1c0){return function(_0x30d1f1){if(_0x30d1f1){var _0x2e7f18=_0x30d1f1[_0xee0a('0x26')],_0x45538d=_0x15b1c0[_0xee0a('0x27')],_0x145332=_0x15b1c0['offset']+_0x15b1c0[_0xee0a('0x28')],_0x408909;if(_0x145332>=_0x2e7f18){_0x145332=_0x2e7f18;_0x408909=0xc8;}else{_0x408909=0xce;}_0xe14449[_0xee0a('0x29')](_0x408909);return _0xe14449[_0xee0a('0x2a')](_0xee0a('0x2b'),_0x45538d+'-'+_0x145332+'/'+_0x2e7f18)[_0xee0a('0x25')](_0x30d1f1);}return null;};}function patchUpdates(_0x3faad3){return function(_0x4cf1df){try{jsonpatch[_0xee0a('0x2c')](_0x4cf1df,_0x3faad3,!![]);}catch(_0x31ae71){return BPromise[_0xee0a('0x2d')](_0x31ae71);}return _0x4cf1df[_0xee0a('0x2e')]();};}function saveUpdates(_0x4b9cd7,_0x354dff){return function(_0x55e328){if(_0x55e328){return _0x55e328[_0xee0a('0x2f')](_0x4b9cd7)[_0xee0a('0x19')](function(_0x3d6de4){return _0x3d6de4;});}return null;};}function removeEntity(_0x229f8d,_0x318c82){return function(_0x443678){if(_0x443678){return _0x443678[_0xee0a('0x30')]()[_0xee0a('0x19')](function(){_0x229f8d['status'](0xcc)[_0xee0a('0x31')]();});}};}function handleEntityNotFound(_0x1d4578,_0x508c87){return function(_0x2ce5c6){if(!_0x2ce5c6){_0x1d4578[_0xee0a('0x24')](0x194);}return _0x2ce5c6;};}function handleError(_0x27db4c,_0x4aede0){_0x4aede0=_0x4aede0||0x1f4;return function(_0x131b60){logger[_0xee0a('0x1f')](_0x131b60[_0xee0a('0x32')]);if(_0x131b60['name']){delete _0x131b60[_0xee0a('0x33')];}_0x27db4c[_0xee0a('0x29')](_0x4aede0)[_0xee0a('0x34')](_0x131b60);};}exports['index']=function(_0x47a59c,_0x7db483){var _0x10e8a5={},_0x2912ce={},_0x25041c={'count':0x0,'rows':[]};var _0xd19cd3=_[_0xee0a('0x35')](db[_0xee0a('0x36')][_0xee0a('0x37')],function(_0x22d505){return{'name':_0x22d505['fieldName'],'type':_0x22d505[_0xee0a('0x38')][_0xee0a('0x39')]};});_0x2912ce['model']=_[_0xee0a('0x35')](_0xd19cd3,_0xee0a('0x33'));_0x2912ce['query']=_[_0xee0a('0x3a')](_0x47a59c[_0xee0a('0x3b')]);_0x2912ce[_0xee0a('0x3c')]=_[_0xee0a('0x3d')](_0x2912ce[_0xee0a('0x3e')],_0x2912ce[_0xee0a('0x3b')]);_0x10e8a5[_0xee0a('0x3f')]=_[_0xee0a('0x3d')](_0x2912ce[_0xee0a('0x3e')],qs['fields'](_0x47a59c[_0xee0a('0x3b')][_0xee0a('0x40')]));_0x10e8a5[_0xee0a('0x3f')]=_0x10e8a5[_0xee0a('0x3f')]['length']?_0x10e8a5['attributes']:_0x2912ce[_0xee0a('0x3e')];if(!_0x47a59c[_0xee0a('0x3b')][_0xee0a('0x41')](_0xee0a('0x42'))){_0x10e8a5[_0xee0a('0x28')]=qs[_0xee0a('0x28')](_0x47a59c[_0xee0a('0x3b')]['limit']);_0x10e8a5['offset']=qs[_0xee0a('0x27')](_0x47a59c[_0xee0a('0x3b')]['offset']);}_0x10e8a5[_0xee0a('0x43')]=qs[_0xee0a('0x44')](_0x47a59c['query'][_0xee0a('0x44')]);_0x10e8a5[_0xee0a('0x45')]=qs[_0xee0a('0x3c')](_[_0xee0a('0x46')](_0x47a59c[_0xee0a('0x3b')],_0x2912ce[_0xee0a('0x3c')]),_0xd19cd3);if(_0x47a59c[_0xee0a('0x3b')]['filter']){_0x10e8a5['where']=_[_0xee0a('0x47')](_0x10e8a5['where'],{'$or':_['map'](_0xd19cd3,function(_0x5cb774){if(_0x5cb774[_0xee0a('0x38')]!==_0xee0a('0x48')){var _0x4cbda6={};_0x4cbda6[_0x5cb774['name']]={'$like':'%'+_0x47a59c['query']['filter']+'%'};return _0x4cbda6;}})});}_0x10e8a5=_[_0xee0a('0x47')]({},_0x10e8a5,_0x47a59c[_0xee0a('0x49')]);var _0x32fd2d={'where':_0x10e8a5[_0xee0a('0x45')]};return db[_0xee0a('0x36')][_0xee0a('0x26')](_0x32fd2d)['then'](function(_0x1a72a2){_0x25041c['count']=_0x1a72a2;if(_0x47a59c[_0xee0a('0x3b')][_0xee0a('0x4a')]){_0x10e8a5[_0xee0a('0x4b')]=[{'all':!![]}];}return db[_0xee0a('0x36')]['findAll'](_0x10e8a5);})[_0xee0a('0x19')](function(_0x219dd3){_0x25041c[_0xee0a('0x4c')]=_0x219dd3;return _0x25041c;})[_0xee0a('0x19')](respondWithFilteredResult(_0x7db483,_0x10e8a5))[_0xee0a('0x23')](handleError(_0x7db483,null));};exports[_0xee0a('0x4d')]=function(_0x340cc9,_0x4cd7d3){var _0x51300e={'raw':![],'where':{'id':_0x340cc9[_0xee0a('0x4e')]['id']}},_0x1b571c={};_0x1b571c[_0xee0a('0x3e')]=_[_0xee0a('0x3a')](db[_0xee0a('0x36')][_0xee0a('0x37')]);_0x1b571c[_0xee0a('0x3b')]=_[_0xee0a('0x3a')](_0x340cc9[_0xee0a('0x3b')]);_0x1b571c[_0xee0a('0x3c')]=_[_0xee0a('0x3d')](_0x1b571c[_0xee0a('0x3e')],_0x1b571c['query']);_0x51300e[_0xee0a('0x3f')]=_[_0xee0a('0x3d')](_0x1b571c[_0xee0a('0x3e')],qs[_0xee0a('0x40')](_0x340cc9[_0xee0a('0x3b')]['fields']));_0x51300e[_0xee0a('0x3f')]=_0x51300e[_0xee0a('0x3f')][_0xee0a('0x4f')]?_0x51300e[_0xee0a('0x3f')]:_0x1b571c[_0xee0a('0x3e')];if(_0x340cc9['query'][_0xee0a('0x4a')]){_0x51300e[_0xee0a('0x4b')]=[{'all':!![]}];}_0x51300e=_[_0xee0a('0x47')]({},_0x51300e,_0x340cc9[_0xee0a('0x49')]);return db[_0xee0a('0x36')]['find'](_0x51300e)[_0xee0a('0x19')](handleEntityNotFound(_0x4cd7d3,null))[_0xee0a('0x19')](respondWithResult(_0x4cd7d3,null))[_0xee0a('0x23')](handleError(_0x4cd7d3,null));};exports[_0xee0a('0x50')]=function(_0x2ff182,_0x458e0c){return db[_0xee0a('0x36')][_0xee0a('0x50')](_0x2ff182[_0xee0a('0x51')],{})[_0xee0a('0x19')](respondWithResult(_0x458e0c,0xc9))[_0xee0a('0x23')](handleError(_0x458e0c,null));};exports[_0xee0a('0x2f')]=function(_0x309a4e,_0x341f43){if(_0x309a4e[_0xee0a('0x51')]['id']){delete _0x309a4e[_0xee0a('0x51')]['id'];}return db[_0xee0a('0x36')][_0xee0a('0x52')]({'where':{'id':_0x309a4e[_0xee0a('0x4e')]['id']}})[_0xee0a('0x19')](handleEntityNotFound(_0x341f43,null))[_0xee0a('0x19')](saveUpdates(_0x309a4e[_0xee0a('0x51')],null))['then'](respondWithResult(_0x341f43,null))['catch'](handleError(_0x341f43,null));};exports['destroy']=function(_0x35eb93,_0x557690){return db[_0xee0a('0x36')][_0xee0a('0x52')]({'where':{'id':_0x35eb93[_0xee0a('0x4e')]['id']}})[_0xee0a('0x19')](handleEntityNotFound(_0x557690,null))['then'](removeEntity(_0x557690,null))[_0xee0a('0x23')](handleError(_0x557690,null));};exports[_0xee0a('0x53')]=function(_0x1e6601,_0x1d6398,_0x301f69){var _0x99e2b0={};var _0xf576ea={};var _0x3c9456;var _0x101c8e;return db[_0xee0a('0x36')][_0xee0a('0x54')]({'where':{'id':_0x1e6601[_0xee0a('0x4e')]['id']}})[_0xee0a('0x19')](handleEntityNotFound(_0x1d6398,null))[_0xee0a('0x19')](function(_0x4eb728){if(_0x4eb728){_0x3c9456=_0x4eb728;_0xf576ea[_0xee0a('0x3e')]=_['keys'](db[_0xee0a('0x55')][_0xee0a('0x37')]);_0xf576ea['query']=_[_0xee0a('0x3a')](_0x1e6601['query']);_0xf576ea[_0xee0a('0x3c')]=_['intersection'](_0xf576ea['model'],_0xf576ea['query']);_0x99e2b0[_0xee0a('0x3f')]=_[_0xee0a('0x3d')](_0xf576ea[_0xee0a('0x3e')],qs[_0xee0a('0x40')](_0x1e6601[_0xee0a('0x3b')][_0xee0a('0x40')]));_0x99e2b0[_0xee0a('0x3f')]=_0x99e2b0[_0xee0a('0x3f')]['length']?_0x99e2b0[_0xee0a('0x3f')]:_0xf576ea['model'];_0x99e2b0['order']=qs[_0xee0a('0x44')](_0x1e6601[_0xee0a('0x3b')][_0xee0a('0x44')]);_0x99e2b0[_0xee0a('0x45')]=qs[_0xee0a('0x3c')](_[_0xee0a('0x46')](_0x1e6601[_0xee0a('0x3b')],_0xf576ea[_0xee0a('0x3c')]));if(_0x1e6601['query'][_0xee0a('0x56')]){_0x99e2b0['where']=_[_0xee0a('0x47')](_0x99e2b0[_0xee0a('0x45')],{'$or':_[_0xee0a('0x35')](_0x99e2b0[_0xee0a('0x3f')],function(_0x4115bd){var _0x2c7bba={};_0x2c7bba[_0x4115bd]={'$like':'%'+_0x1e6601['query'][_0xee0a('0x56')]+'%'};return _0x2c7bba;})});}_0x99e2b0=_[_0xee0a('0x47')]({},_0x99e2b0,_0x1e6601[_0xee0a('0x49')]);return _0x3c9456['getFields'](_0x99e2b0);}})[_0xee0a('0x19')](function(_0x2fb3b5){if(_0x2fb3b5){_0x101c8e=_0x2fb3b5['length'];if(!_0x1e6601[_0xee0a('0x3b')]['hasOwnProperty']('nolimit')){_0x99e2b0['limit']=qs['limit'](_0x1e6601[_0xee0a('0x3b')]['limit']);_0x99e2b0[_0xee0a('0x27')]=qs['offset'](_0x1e6601[_0xee0a('0x3b')][_0xee0a('0x27')]);}return _0x3c9456[_0xee0a('0x53')](_0x99e2b0);}})[_0xee0a('0x19')](function(_0x5f082e){if(_0x5f082e){return _0x5f082e?{'count':_0x101c8e,'rows':_0x5f082e}:null;}})[_0xee0a('0x19')](respondWithResult(_0x1d6398,null))[_0xee0a('0x23')](handleError(_0x1d6398,null));};exports[_0xee0a('0x57')]=function(_0x37936a,_0x336d65,_0x48941f){var _0x10aeda={};var _0xbd642={};var _0x3011da;var _0x5c3897;return db[_0xee0a('0x36')][_0xee0a('0x54')]({'where':{'id':_0x37936a['params']['id']}})[_0xee0a('0x19')](handleEntityNotFound(_0x336d65,null))[_0xee0a('0x19')](function(_0x3f701d){if(_0x3f701d){_0x3011da=_0x3f701d;_0xbd642[_0xee0a('0x3e')]=_[_0xee0a('0x3a')](db[_0xee0a('0x55')][_0xee0a('0x37')]);_0xbd642[_0xee0a('0x3b')]=_['keys'](_0x37936a[_0xee0a('0x3b')]);_0xbd642[_0xee0a('0x3c')]=_[_0xee0a('0x3d')](_0xbd642[_0xee0a('0x3e')],_0xbd642[_0xee0a('0x3b')]);_0x10aeda[_0xee0a('0x3f')]=_[_0xee0a('0x3d')](_0xbd642['model'],qs[_0xee0a('0x40')](_0x37936a[_0xee0a('0x3b')][_0xee0a('0x40')]));_0x10aeda[_0xee0a('0x3f')]=_0x10aeda['attributes'][_0xee0a('0x4f')]?_0x10aeda[_0xee0a('0x3f')]:_0xbd642[_0xee0a('0x3e')];_0x10aeda[_0xee0a('0x43')]=qs[_0xee0a('0x44')](_0x37936a['query']['sort']);_0x10aeda[_0xee0a('0x45')]=qs[_0xee0a('0x3c')](_[_0xee0a('0x46')](_0x37936a['query'],_0xbd642[_0xee0a('0x3c')]));if(_0x37936a[_0xee0a('0x3b')][_0xee0a('0x56')]){_0x10aeda[_0xee0a('0x45')]=_[_0xee0a('0x47')](_0x10aeda[_0xee0a('0x45')],{'$or':_[_0xee0a('0x35')](_0x10aeda[_0xee0a('0x3f')],function(_0x56d4b0){var _0x5cfb45={};_0x5cfb45[_0x56d4b0]={'$like':'%'+_0x37936a[_0xee0a('0x3b')][_0xee0a('0x56')]+'%'};return _0x5cfb45;})});}_0x10aeda=_[_0xee0a('0x47')]({},_0x10aeda,_0x37936a[_0xee0a('0x49')]);return _0x3011da['getSubjects'](_0x10aeda);}})[_0xee0a('0x19')](function(_0x18fa7f){if(_0x18fa7f){_0x5c3897=_0x18fa7f[_0xee0a('0x4f')];if(!_0x37936a[_0xee0a('0x3b')][_0xee0a('0x41')]('nolimit')){_0x10aeda['limit']=qs['limit'](_0x37936a['query'][_0xee0a('0x28')]);_0x10aeda['offset']=qs[_0xee0a('0x27')](_0x37936a[_0xee0a('0x3b')]['offset']);}return _0x3011da[_0xee0a('0x57')](_0x10aeda);}})['then'](function(_0xaf2aac){if(_0xaf2aac){return _0xaf2aac?{'count':_0x5c3897,'rows':_0xaf2aac}:null;}})[_0xee0a('0x19')](respondWithResult(_0x336d65,null))[_0xee0a('0x23')](handleError(_0x336d65,null));};exports[_0xee0a('0x58')]=function(_0x527470,_0x2c8bf3,_0x401491){var _0x22dea8={};var _0x461729={};var _0x584a04;var _0x1baba3;return db[_0xee0a('0x36')][_0xee0a('0x54')]({'where':{'id':_0x527470[_0xee0a('0x4e')]['id']}})[_0xee0a('0x19')](handleEntityNotFound(_0x2c8bf3,null))[_0xee0a('0x19')](function(_0x571e54){if(_0x571e54){_0x584a04=_0x571e54;_0x461729[_0xee0a('0x3e')]=_[_0xee0a('0x3a')](db[_0xee0a('0x55')][_0xee0a('0x37')]);_0x461729[_0xee0a('0x3b')]=_[_0xee0a('0x3a')](_0x527470['query']);_0x461729[_0xee0a('0x3c')]=_[_0xee0a('0x3d')](_0x461729[_0xee0a('0x3e')],_0x461729[_0xee0a('0x3b')]);_0x22dea8[_0xee0a('0x3f')]=_[_0xee0a('0x3d')](_0x461729['model'],qs[_0xee0a('0x40')](_0x527470[_0xee0a('0x3b')][_0xee0a('0x40')]));_0x22dea8[_0xee0a('0x3f')]=_0x22dea8[_0xee0a('0x3f')][_0xee0a('0x4f')]?_0x22dea8[_0xee0a('0x3f')]:_0x461729[_0xee0a('0x3e')];_0x22dea8[_0xee0a('0x43')]=qs[_0xee0a('0x44')](_0x527470[_0xee0a('0x3b')][_0xee0a('0x44')]);_0x22dea8[_0xee0a('0x45')]=qs[_0xee0a('0x3c')](_[_0xee0a('0x46')](_0x527470['query'],_0x461729[_0xee0a('0x3c')]));if(_0x527470[_0xee0a('0x3b')]['filter']){_0x22dea8[_0xee0a('0x45')]=_[_0xee0a('0x47')](_0x22dea8['where'],{'$or':_['map'](_0x22dea8[_0xee0a('0x3f')],function(_0x56a25b){var _0x44e49e={};_0x44e49e[_0x56a25b]={'$like':'%'+_0x527470[_0xee0a('0x3b')]['filter']+'%'};return _0x44e49e;})});}_0x22dea8=_[_0xee0a('0x47')]({},_0x22dea8,_0x527470[_0xee0a('0x49')]);return _0x584a04[_0xee0a('0x58')](_0x22dea8);}})[_0xee0a('0x19')](function(_0x341bc7){if(_0x341bc7){_0x1baba3=_0x341bc7['length'];if(!_0x527470[_0xee0a('0x3b')][_0xee0a('0x41')](_0xee0a('0x42'))){_0x22dea8[_0xee0a('0x28')]=qs[_0xee0a('0x28')](_0x527470[_0xee0a('0x3b')][_0xee0a('0x28')]);_0x22dea8[_0xee0a('0x27')]=qs[_0xee0a('0x27')](_0x527470[_0xee0a('0x3b')][_0xee0a('0x27')]);}return _0x584a04[_0xee0a('0x58')](_0x22dea8);}})[_0xee0a('0x19')](function(_0x5e4d48){if(_0x5e4d48){return _0x5e4d48?{'count':_0x1baba3,'rows':_0x5e4d48}:null;}})[_0xee0a('0x19')](respondWithResult(_0x2c8bf3,null))['catch'](handleError(_0x2c8bf3,null));};exports[_0xee0a('0x59')]=function(_0x2ee940,_0x1c7ce7,_0x2f9e9d){var _0x5aa076={};var _0xc748b6={};var _0x5eca63;var _0x7f1f6a;return db[_0xee0a('0x36')]['findOne']({'where':{'id':_0x2ee940[_0xee0a('0x4e')]['id']}})[_0xee0a('0x19')](handleEntityNotFound(_0x1c7ce7,null))[_0xee0a('0x19')](function(_0x21b7ea){if(_0x21b7ea){_0x5eca63=_0x21b7ea;_0xc748b6[_0xee0a('0x3e')]=_[_0xee0a('0x3a')](db[_0xee0a('0x5a')][_0xee0a('0x37')]);_0xc748b6['query']=_['keys'](_0x2ee940[_0xee0a('0x3b')]);_0xc748b6[_0xee0a('0x3c')]=_[_0xee0a('0x3d')](_0xc748b6[_0xee0a('0x3e')],_0xc748b6['query']);_0x5aa076[_0xee0a('0x3f')]=_[_0xee0a('0x3d')](_0xc748b6[_0xee0a('0x3e')],qs[_0xee0a('0x40')](_0x2ee940[_0xee0a('0x3b')][_0xee0a('0x40')]));_0x5aa076['attributes']=_0x5aa076['attributes'][_0xee0a('0x4f')]?_0x5aa076[_0xee0a('0x3f')]:_0xc748b6[_0xee0a('0x3e')];_0x5aa076[_0xee0a('0x43')]=qs[_0xee0a('0x44')](_0x2ee940[_0xee0a('0x3b')][_0xee0a('0x44')]);_0x5aa076[_0xee0a('0x45')]=qs['filters'](_[_0xee0a('0x46')](_0x2ee940[_0xee0a('0x3b')],_0xc748b6['filters']));if(_0x2ee940['query'][_0xee0a('0x56')]){_0x5aa076[_0xee0a('0x45')]=_[_0xee0a('0x47')](_0x5aa076[_0xee0a('0x45')],{'$or':_[_0xee0a('0x35')](_0x5aa076['attributes'],function(_0x3de8e7){var _0x2c4248={};_0x2c4248[_0x3de8e7]={'$like':'%'+_0x2ee940['query'][_0xee0a('0x56')]+'%'};return _0x2c4248;})});}_0x5aa076=_['merge']({},_0x5aa076,_0x2ee940[_0xee0a('0x49')]);return _0x5eca63[_0xee0a('0x59')](_0x5aa076);}})[_0xee0a('0x19')](function(_0x561e0d){if(_0x561e0d){_0x7f1f6a=_0x561e0d[_0xee0a('0x4f')];if(!_0x2ee940[_0xee0a('0x3b')][_0xee0a('0x41')](_0xee0a('0x42'))){_0x5aa076['limit']=qs['limit'](_0x2ee940['query'][_0xee0a('0x28')]);_0x5aa076[_0xee0a('0x27')]=qs[_0xee0a('0x27')](_0x2ee940['query']['offset']);}return _0x5eca63[_0xee0a('0x59')](_0x5aa076);}})[_0xee0a('0x19')](function(_0x3a405a){if(_0x3a405a){return _0x3a405a?{'count':_0x7f1f6a,'rows':_0x3a405a}:null;}})['then'](respondWithResult(_0x1c7ce7,null))['catch'](handleError(_0x1c7ce7,null));};exports[_0xee0a('0x5b')]=function(_0x5adfd1,_0x5f93d3,_0x2fffa7){if(_0x5adfd1[_0xee0a('0x51')]['id']){delete _0x5adfd1[_0xee0a('0x51')]['id'];}return db['FreshdeskConfiguration'][_0xee0a('0x54')]({'where':{'id':_0x5adfd1[_0xee0a('0x4e')]['id']}})[_0xee0a('0x19')](handleEntityNotFound(_0x5f93d3,null))[_0xee0a('0x19')](function(_0x13f5e8){if(_0x13f5e8){return _0x13f5e8[_0xee0a('0x5b')](_0x5adfd1[_0xee0a('0x51')][_0xee0a('0x5c')]||[]);}return null;})[_0xee0a('0x19')](respondWithResult(_0x5f93d3,null))[_0xee0a('0x23')](handleError(_0x5f93d3,null));}; \ No newline at end of file +var _0xfcbd=['querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','http','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','sendStatus','status','end','offset','limit','Content-Range','apply','reject','update','destroy','name','map','FreshdeskConfiguration','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','VIRTUAL','filter','merge','options','count','findAll','rows','show','include','find','create','body','params','getFields','findOne','FreshdeskField','getDescriptions','getTags','Tag','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv'];(function(_0x4a72de,_0x4dbb4d){var _0x183980=function(_0x6f8030){while(--_0x6f8030){_0x4a72de['push'](_0x4a72de['shift']());}};_0x183980(++_0x4dbb4d);}(_0xfcbd,0x160));var _0xdfcb=function(_0x57270c,_0x2ebdab){_0x57270c=_0x57270c-0x0;var _0x3704a2=_0xfcbd[_0x57270c];return _0x3704a2;};'use strict';var pdf=require(_0xdfcb('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xdfcb('0x1'));var jsonpatch=require(_0xdfcb('0x2'));var rp=require(_0xdfcb('0x3'));var moment=require(_0xdfcb('0x4'));var BPromise=require(_0xdfcb('0x5'));var Mustache=require(_0xdfcb('0x6'));var util=require(_0xdfcb('0x7'));var path=require(_0xdfcb('0x8'));var sox=require(_0xdfcb('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xdfcb('0xa'));var squel=require(_0xdfcb('0xb'));var crypto=require(_0xdfcb('0xc'));var jsforce=require(_0xdfcb('0xd'));var deskjs=require(_0xdfcb('0xe'));var toCsv=require(_0xdfcb('0xf'));var querystring=require(_0xdfcb('0x10'));var Papa=require('papaparse');var Redis=require(_0xdfcb('0x11'));var authService=require(_0xdfcb('0x12'));var qs=require(_0xdfcb('0x13'));var as=require(_0xdfcb('0x14'));var hardwareService=require(_0xdfcb('0x15'));var logger=require(_0xdfcb('0x16'))(_0xdfcb('0x17'));var utils=require(_0xdfcb('0x18'));var config=require(_0xdfcb('0x19'));var db=require(_0xdfcb('0x1a'))['db'];var jayson=require(_0xdfcb('0x1b'));var client=jayson['client'][_0xdfcb('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x2e33ab,_0x2771d5,_0x41275a){if(_0x41275a){var _0x4164b4=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4164b4['test'](_0x2771d5)){return _0x2e33ab;}else{throw new db[(_0xdfcb('0x1d'))][(_0xdfcb('0x1e'))](_0xdfcb('0x1f'));}}else{return _0x2e33ab;}}function respondWithRpcPromise(_0x6c79a4,_0x336866,_0x519cef,_0x3afbd2){return new BPromise(function(_0x421054,_0x1b48fa){var _0x65ec83=_0x3afbd2||client;return _0x65ec83[_0xdfcb('0x20')](_0x6c79a4,_0x519cef)[_0xdfcb('0x21')](function(_0x1e4cae){logger[_0xdfcb('0x22')](_0xdfcb('0x23'),_0x336866,_0xdfcb('0x24'));logger['debug']('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x336866,_0xdfcb('0x24'),JSON[_0xdfcb('0x25')](_0x1e4cae));if(_0x1e4cae['error']){if(_0x1e4cae[_0xdfcb('0x26')][_0xdfcb('0x27')]===0x1f4){logger['error']('FreshdeskConfiguration,\x20%s,\x20%s',_0x336866,_0x1e4cae[_0xdfcb('0x26')]['message']);return _0x1b48fa(_0x1e4cae['error']['message']);}logger[_0xdfcb('0x26')](_0xdfcb('0x23'),_0x336866,_0x1e4cae[_0xdfcb('0x26')]['message']);return _0x421054(_0x1e4cae[_0xdfcb('0x26')][_0xdfcb('0x28')]);}else{logger[_0xdfcb('0x22')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x336866,'request\x20sent');_0x421054(_0x1e4cae['result'][_0xdfcb('0x28')]);}})[_0xdfcb('0x29')](function(_0x5c9150){logger[_0xdfcb('0x26')](_0xdfcb('0x23'),_0x336866,_0x5c9150);_0x1b48fa(_0x5c9150);});});}function respondWithStatusCode(_0x29a5f3,_0xb1f508){_0xb1f508=_0xb1f508||0xcc;return function(_0xd59237){if(_0xd59237){return _0x29a5f3[_0xdfcb('0x2a')](_0xb1f508);}return _0x29a5f3[_0xdfcb('0x2b')](_0xb1f508)[_0xdfcb('0x2c')]();};}function respondWithResult(_0x17de12,_0xb2ef1f){_0xb2ef1f=_0xb2ef1f||0xc8;return function(_0x20cbcd){if(_0x20cbcd){return _0x17de12[_0xdfcb('0x2b')](_0xb2ef1f)['json'](_0x20cbcd);}};}function respondWithFilteredResult(_0x13e885,_0x424994){return function(_0x42c88e){if(_0x42c88e){var _0x1cec28=_0x42c88e['count'],_0x59bf24=_0x424994[_0xdfcb('0x2d')],_0x241f11=_0x424994[_0xdfcb('0x2d')]+_0x424994[_0xdfcb('0x2e')],_0x531918;if(_0x241f11>=_0x1cec28){_0x241f11=_0x1cec28;_0x531918=0xc8;}else{_0x531918=0xce;}_0x13e885[_0xdfcb('0x2b')](_0x531918);return _0x13e885['set'](_0xdfcb('0x2f'),_0x59bf24+'-'+_0x241f11+'/'+_0x1cec28)['json'](_0x42c88e);}return null;};}function patchUpdates(_0x36a72d){return function(_0x503ea5){try{jsonpatch[_0xdfcb('0x30')](_0x503ea5,_0x36a72d,!![]);}catch(_0x18c24d){return BPromise[_0xdfcb('0x31')](_0x18c24d);}return _0x503ea5['save']();};}function saveUpdates(_0x4bcf8b,_0x32b6da){return function(_0x637b49){if(_0x637b49){return _0x637b49[_0xdfcb('0x32')](_0x4bcf8b)[_0xdfcb('0x21')](function(_0x3bb2b5){return _0x3bb2b5;});}return null;};}function removeEntity(_0x1cc953,_0x3519dc){return function(_0x4eb686){if(_0x4eb686){return _0x4eb686[_0xdfcb('0x33')]()[_0xdfcb('0x21')](function(){_0x1cc953['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x117974,_0x2e6d98){return function(_0x328d03){if(!_0x328d03){_0x117974[_0xdfcb('0x2a')](0x194);}return _0x328d03;};}function handleError(_0x4efedf,_0x4c10e6){_0x4c10e6=_0x4c10e6||0x1f4;return function(_0x441c89){logger['error'](_0x441c89['stack']);if(_0x441c89['name']){delete _0x441c89[_0xdfcb('0x34')];}_0x4efedf[_0xdfcb('0x2b')](_0x4c10e6)['send'](_0x441c89);};}exports['index']=function(_0x4ea081,_0x846433){var _0x4723c3={},_0x5c6aec={},_0x555bbc={'count':0x0,'rows':[]};var _0x4912f2=_[_0xdfcb('0x35')](db[_0xdfcb('0x36')][_0xdfcb('0x37')],function(_0x252594){return{'name':_0x252594[_0xdfcb('0x38')],'type':_0x252594[_0xdfcb('0x39')][_0xdfcb('0x3a')]};});_0x5c6aec['model']=_['map'](_0x4912f2,_0xdfcb('0x34'));_0x5c6aec[_0xdfcb('0x3b')]=_[_0xdfcb('0x3c')](_0x4ea081[_0xdfcb('0x3b')]);_0x5c6aec['filters']=_[_0xdfcb('0x3d')](_0x5c6aec[_0xdfcb('0x3e')],_0x5c6aec['query']);_0x4723c3[_0xdfcb('0x3f')]=_[_0xdfcb('0x3d')](_0x5c6aec[_0xdfcb('0x3e')],qs[_0xdfcb('0x40')](_0x4ea081['query'][_0xdfcb('0x40')]));_0x4723c3[_0xdfcb('0x3f')]=_0x4723c3[_0xdfcb('0x3f')][_0xdfcb('0x41')]?_0x4723c3['attributes']:_0x5c6aec[_0xdfcb('0x3e')];if(!_0x4ea081['query'][_0xdfcb('0x42')](_0xdfcb('0x43'))){_0x4723c3[_0xdfcb('0x2e')]=qs[_0xdfcb('0x2e')](_0x4ea081[_0xdfcb('0x3b')][_0xdfcb('0x2e')]);_0x4723c3['offset']=qs['offset'](_0x4ea081['query'][_0xdfcb('0x2d')]);}_0x4723c3[_0xdfcb('0x44')]=qs[_0xdfcb('0x45')](_0x4ea081[_0xdfcb('0x3b')][_0xdfcb('0x45')]);_0x4723c3[_0xdfcb('0x46')]=qs[_0xdfcb('0x47')](_[_0xdfcb('0x48')](_0x4ea081[_0xdfcb('0x3b')],_0x5c6aec['filters']),_0x4912f2);if(_0x4ea081[_0xdfcb('0x3b')]['filter']){_0x4723c3[_0xdfcb('0x46')]=_['merge'](_0x4723c3[_0xdfcb('0x46')],{'$or':_['map'](_0x4912f2,function(_0x9aa0d4){if(_0x9aa0d4[_0xdfcb('0x39')]!==_0xdfcb('0x49')){var _0x5ac22a={};_0x5ac22a[_0x9aa0d4[_0xdfcb('0x34')]]={'$like':'%'+_0x4ea081[_0xdfcb('0x3b')][_0xdfcb('0x4a')]+'%'};return _0x5ac22a;}})});}_0x4723c3=_[_0xdfcb('0x4b')]({},_0x4723c3,_0x4ea081[_0xdfcb('0x4c')]);var _0x4da16e={'where':_0x4723c3[_0xdfcb('0x46')]};return db['FreshdeskConfiguration'][_0xdfcb('0x4d')](_0x4da16e)['then'](function(_0x1de21c){_0x555bbc['count']=_0x1de21c;if(_0x4ea081[_0xdfcb('0x3b')]['includeAll']){_0x4723c3['include']=[{'all':!![]}];}return db['FreshdeskConfiguration'][_0xdfcb('0x4e')](_0x4723c3);})[_0xdfcb('0x21')](function(_0x5831da){_0x555bbc[_0xdfcb('0x4f')]=_0x5831da;return _0x555bbc;})[_0xdfcb('0x21')](respondWithFilteredResult(_0x846433,_0x4723c3))[_0xdfcb('0x29')](handleError(_0x846433,null));};exports[_0xdfcb('0x50')]=function(_0x27cddc,_0x14716d){var _0x5ae111={'raw':![],'where':{'id':_0x27cddc['params']['id']}},_0x32341b={};_0x32341b[_0xdfcb('0x3e')]=_['keys'](db[_0xdfcb('0x36')][_0xdfcb('0x37')]);_0x32341b[_0xdfcb('0x3b')]=_['keys'](_0x27cddc[_0xdfcb('0x3b')]);_0x32341b[_0xdfcb('0x47')]=_[_0xdfcb('0x3d')](_0x32341b[_0xdfcb('0x3e')],_0x32341b[_0xdfcb('0x3b')]);_0x5ae111['attributes']=_[_0xdfcb('0x3d')](_0x32341b[_0xdfcb('0x3e')],qs[_0xdfcb('0x40')](_0x27cddc['query'][_0xdfcb('0x40')]));_0x5ae111[_0xdfcb('0x3f')]=_0x5ae111[_0xdfcb('0x3f')][_0xdfcb('0x41')]?_0x5ae111[_0xdfcb('0x3f')]:_0x32341b[_0xdfcb('0x3e')];if(_0x27cddc[_0xdfcb('0x3b')]['includeAll']){_0x5ae111[_0xdfcb('0x51')]=[{'all':!![]}];}_0x5ae111=_[_0xdfcb('0x4b')]({},_0x5ae111,_0x27cddc['options']);return db[_0xdfcb('0x36')][_0xdfcb('0x52')](_0x5ae111)['then'](handleEntityNotFound(_0x14716d,null))[_0xdfcb('0x21')](respondWithResult(_0x14716d,null))['catch'](handleError(_0x14716d,null));};exports[_0xdfcb('0x53')]=function(_0x44fba,_0xbd7947){return db[_0xdfcb('0x36')][_0xdfcb('0x53')](_0x44fba[_0xdfcb('0x54')],{})[_0xdfcb('0x21')](respondWithResult(_0xbd7947,0xc9))[_0xdfcb('0x29')](handleError(_0xbd7947,null));};exports[_0xdfcb('0x32')]=function(_0x3f3ca9,_0x58ae79){if(_0x3f3ca9[_0xdfcb('0x54')]['id']){delete _0x3f3ca9[_0xdfcb('0x54')]['id'];}return db['FreshdeskConfiguration'][_0xdfcb('0x52')]({'where':{'id':_0x3f3ca9[_0xdfcb('0x55')]['id']}})['then'](handleEntityNotFound(_0x58ae79,null))[_0xdfcb('0x21')](saveUpdates(_0x3f3ca9[_0xdfcb('0x54')],null))[_0xdfcb('0x21')](respondWithResult(_0x58ae79,null))[_0xdfcb('0x29')](handleError(_0x58ae79,null));};exports['destroy']=function(_0x117402,_0x4d0aa3){return db[_0xdfcb('0x36')][_0xdfcb('0x52')]({'where':{'id':_0x117402[_0xdfcb('0x55')]['id']}})['then'](handleEntityNotFound(_0x4d0aa3,null))[_0xdfcb('0x21')](removeEntity(_0x4d0aa3,null))[_0xdfcb('0x29')](handleError(_0x4d0aa3,null));};exports[_0xdfcb('0x56')]=function(_0xb061e6,_0x298d8b,_0x1980d0){var _0x59b218={};var _0x2f41c2={};var _0x26e5ab;var _0x367a38;return db[_0xdfcb('0x36')][_0xdfcb('0x57')]({'where':{'id':_0xb061e6[_0xdfcb('0x55')]['id']}})[_0xdfcb('0x21')](handleEntityNotFound(_0x298d8b,null))['then'](function(_0x34a2c1){if(_0x34a2c1){_0x26e5ab=_0x34a2c1;_0x2f41c2['model']=_[_0xdfcb('0x3c')](db['FreshdeskField']['rawAttributes']);_0x2f41c2[_0xdfcb('0x3b')]=_['keys'](_0xb061e6['query']);_0x2f41c2[_0xdfcb('0x47')]=_[_0xdfcb('0x3d')](_0x2f41c2[_0xdfcb('0x3e')],_0x2f41c2[_0xdfcb('0x3b')]);_0x59b218[_0xdfcb('0x3f')]=_['intersection'](_0x2f41c2[_0xdfcb('0x3e')],qs[_0xdfcb('0x40')](_0xb061e6[_0xdfcb('0x3b')][_0xdfcb('0x40')]));_0x59b218[_0xdfcb('0x3f')]=_0x59b218['attributes'][_0xdfcb('0x41')]?_0x59b218['attributes']:_0x2f41c2[_0xdfcb('0x3e')];_0x59b218[_0xdfcb('0x44')]=qs[_0xdfcb('0x45')](_0xb061e6[_0xdfcb('0x3b')]['sort']);_0x59b218[_0xdfcb('0x46')]=qs['filters'](_[_0xdfcb('0x48')](_0xb061e6['query'],_0x2f41c2[_0xdfcb('0x47')]));if(_0xb061e6[_0xdfcb('0x3b')][_0xdfcb('0x4a')]){_0x59b218['where']=_['merge'](_0x59b218['where'],{'$or':_[_0xdfcb('0x35')](_0x59b218['attributes'],function(_0xe0c5ed){var _0x8996fb={};_0x8996fb[_0xe0c5ed]={'$like':'%'+_0xb061e6[_0xdfcb('0x3b')][_0xdfcb('0x4a')]+'%'};return _0x8996fb;})});}_0x59b218=_[_0xdfcb('0x4b')]({},_0x59b218,_0xb061e6[_0xdfcb('0x4c')]);return _0x26e5ab['getFields'](_0x59b218);}})['then'](function(_0x549979){if(_0x549979){_0x367a38=_0x549979[_0xdfcb('0x41')];if(!_0xb061e6[_0xdfcb('0x3b')][_0xdfcb('0x42')](_0xdfcb('0x43'))){_0x59b218['limit']=qs[_0xdfcb('0x2e')](_0xb061e6[_0xdfcb('0x3b')][_0xdfcb('0x2e')]);_0x59b218[_0xdfcb('0x2d')]=qs[_0xdfcb('0x2d')](_0xb061e6[_0xdfcb('0x3b')][_0xdfcb('0x2d')]);}return _0x26e5ab[_0xdfcb('0x56')](_0x59b218);}})[_0xdfcb('0x21')](function(_0x2a2d15){if(_0x2a2d15){return _0x2a2d15?{'count':_0x367a38,'rows':_0x2a2d15}:null;}})[_0xdfcb('0x21')](respondWithResult(_0x298d8b,null))[_0xdfcb('0x29')](handleError(_0x298d8b,null));};exports['getSubjects']=function(_0x2d6beb,_0x10e308,_0x11ab49){var _0xf539fd={};var _0x313947={};var _0x422fc1;var _0x29929d;return db[_0xdfcb('0x36')][_0xdfcb('0x57')]({'where':{'id':_0x2d6beb[_0xdfcb('0x55')]['id']}})[_0xdfcb('0x21')](handleEntityNotFound(_0x10e308,null))[_0xdfcb('0x21')](function(_0x27e9a6){if(_0x27e9a6){_0x422fc1=_0x27e9a6;_0x313947[_0xdfcb('0x3e')]=_[_0xdfcb('0x3c')](db[_0xdfcb('0x58')][_0xdfcb('0x37')]);_0x313947[_0xdfcb('0x3b')]=_['keys'](_0x2d6beb[_0xdfcb('0x3b')]);_0x313947[_0xdfcb('0x47')]=_[_0xdfcb('0x3d')](_0x313947[_0xdfcb('0x3e')],_0x313947[_0xdfcb('0x3b')]);_0xf539fd[_0xdfcb('0x3f')]=_[_0xdfcb('0x3d')](_0x313947['model'],qs[_0xdfcb('0x40')](_0x2d6beb[_0xdfcb('0x3b')][_0xdfcb('0x40')]));_0xf539fd['attributes']=_0xf539fd[_0xdfcb('0x3f')][_0xdfcb('0x41')]?_0xf539fd[_0xdfcb('0x3f')]:_0x313947['model'];_0xf539fd[_0xdfcb('0x44')]=qs['sort'](_0x2d6beb['query'][_0xdfcb('0x45')]);_0xf539fd[_0xdfcb('0x46')]=qs[_0xdfcb('0x47')](_[_0xdfcb('0x48')](_0x2d6beb[_0xdfcb('0x3b')],_0x313947[_0xdfcb('0x47')]));if(_0x2d6beb['query'][_0xdfcb('0x4a')]){_0xf539fd['where']=_['merge'](_0xf539fd['where'],{'$or':_[_0xdfcb('0x35')](_0xf539fd[_0xdfcb('0x3f')],function(_0x5d0a9e){var _0x1eabfe={};_0x1eabfe[_0x5d0a9e]={'$like':'%'+_0x2d6beb['query']['filter']+'%'};return _0x1eabfe;})});}_0xf539fd=_['merge']({},_0xf539fd,_0x2d6beb[_0xdfcb('0x4c')]);return _0x422fc1['getSubjects'](_0xf539fd);}})['then'](function(_0x4a10fa){if(_0x4a10fa){_0x29929d=_0x4a10fa['length'];if(!_0x2d6beb[_0xdfcb('0x3b')][_0xdfcb('0x42')](_0xdfcb('0x43'))){_0xf539fd[_0xdfcb('0x2e')]=qs['limit'](_0x2d6beb[_0xdfcb('0x3b')][_0xdfcb('0x2e')]);_0xf539fd[_0xdfcb('0x2d')]=qs[_0xdfcb('0x2d')](_0x2d6beb[_0xdfcb('0x3b')][_0xdfcb('0x2d')]);}return _0x422fc1['getSubjects'](_0xf539fd);}})['then'](function(_0x523a59){if(_0x523a59){return _0x523a59?{'count':_0x29929d,'rows':_0x523a59}:null;}})[_0xdfcb('0x21')](respondWithResult(_0x10e308,null))[_0xdfcb('0x29')](handleError(_0x10e308,null));};exports[_0xdfcb('0x59')]=function(_0x58007d,_0x3940a9,_0x3bfeda){var _0xf359cc={};var _0x34b5ca={};var _0x42b5dc;var _0x1b4ce9;return db['FreshdeskConfiguration'][_0xdfcb('0x57')]({'where':{'id':_0x58007d['params']['id']}})['then'](handleEntityNotFound(_0x3940a9,null))[_0xdfcb('0x21')](function(_0x3d98c6){if(_0x3d98c6){_0x42b5dc=_0x3d98c6;_0x34b5ca[_0xdfcb('0x3e')]=_[_0xdfcb('0x3c')](db[_0xdfcb('0x58')][_0xdfcb('0x37')]);_0x34b5ca[_0xdfcb('0x3b')]=_[_0xdfcb('0x3c')](_0x58007d['query']);_0x34b5ca['filters']=_['intersection'](_0x34b5ca[_0xdfcb('0x3e')],_0x34b5ca[_0xdfcb('0x3b')]);_0xf359cc['attributes']=_[_0xdfcb('0x3d')](_0x34b5ca[_0xdfcb('0x3e')],qs['fields'](_0x58007d['query'][_0xdfcb('0x40')]));_0xf359cc[_0xdfcb('0x3f')]=_0xf359cc[_0xdfcb('0x3f')][_0xdfcb('0x41')]?_0xf359cc[_0xdfcb('0x3f')]:_0x34b5ca[_0xdfcb('0x3e')];_0xf359cc['order']=qs[_0xdfcb('0x45')](_0x58007d[_0xdfcb('0x3b')][_0xdfcb('0x45')]);_0xf359cc[_0xdfcb('0x46')]=qs[_0xdfcb('0x47')](_[_0xdfcb('0x48')](_0x58007d[_0xdfcb('0x3b')],_0x34b5ca[_0xdfcb('0x47')]));if(_0x58007d['query'][_0xdfcb('0x4a')]){_0xf359cc[_0xdfcb('0x46')]=_[_0xdfcb('0x4b')](_0xf359cc['where'],{'$or':_['map'](_0xf359cc[_0xdfcb('0x3f')],function(_0x482818){var _0x1a2a44={};_0x1a2a44[_0x482818]={'$like':'%'+_0x58007d[_0xdfcb('0x3b')]['filter']+'%'};return _0x1a2a44;})});}_0xf359cc=_[_0xdfcb('0x4b')]({},_0xf359cc,_0x58007d[_0xdfcb('0x4c')]);return _0x42b5dc['getDescriptions'](_0xf359cc);}})['then'](function(_0x4b6b41){if(_0x4b6b41){_0x1b4ce9=_0x4b6b41['length'];if(!_0x58007d['query']['hasOwnProperty']('nolimit')){_0xf359cc[_0xdfcb('0x2e')]=qs[_0xdfcb('0x2e')](_0x58007d[_0xdfcb('0x3b')]['limit']);_0xf359cc[_0xdfcb('0x2d')]=qs[_0xdfcb('0x2d')](_0x58007d[_0xdfcb('0x3b')]['offset']);}return _0x42b5dc[_0xdfcb('0x59')](_0xf359cc);}})[_0xdfcb('0x21')](function(_0x270c08){if(_0x270c08){return _0x270c08?{'count':_0x1b4ce9,'rows':_0x270c08}:null;}})[_0xdfcb('0x21')](respondWithResult(_0x3940a9,null))[_0xdfcb('0x29')](handleError(_0x3940a9,null));};exports[_0xdfcb('0x5a')]=function(_0xf7398e,_0x3370d4,_0x491e95){var _0x3c421f={};var _0x345a41={};var _0xe64894;var _0x40acba;return db[_0xdfcb('0x36')][_0xdfcb('0x57')]({'where':{'id':_0xf7398e[_0xdfcb('0x55')]['id']}})['then'](handleEntityNotFound(_0x3370d4,null))['then'](function(_0x154043){if(_0x154043){_0xe64894=_0x154043;_0x345a41[_0xdfcb('0x3e')]=_[_0xdfcb('0x3c')](db[_0xdfcb('0x5b')]['rawAttributes']);_0x345a41[_0xdfcb('0x3b')]=_[_0xdfcb('0x3c')](_0xf7398e[_0xdfcb('0x3b')]);_0x345a41['filters']=_[_0xdfcb('0x3d')](_0x345a41['model'],_0x345a41[_0xdfcb('0x3b')]);_0x3c421f['attributes']=_[_0xdfcb('0x3d')](_0x345a41[_0xdfcb('0x3e')],qs[_0xdfcb('0x40')](_0xf7398e['query'][_0xdfcb('0x40')]));_0x3c421f[_0xdfcb('0x3f')]=_0x3c421f['attributes']['length']?_0x3c421f['attributes']:_0x345a41[_0xdfcb('0x3e')];_0x3c421f[_0xdfcb('0x44')]=qs['sort'](_0xf7398e[_0xdfcb('0x3b')][_0xdfcb('0x45')]);_0x3c421f['where']=qs['filters'](_[_0xdfcb('0x48')](_0xf7398e[_0xdfcb('0x3b')],_0x345a41[_0xdfcb('0x47')]));if(_0xf7398e[_0xdfcb('0x3b')][_0xdfcb('0x4a')]){_0x3c421f[_0xdfcb('0x46')]=_[_0xdfcb('0x4b')](_0x3c421f[_0xdfcb('0x46')],{'$or':_[_0xdfcb('0x35')](_0x3c421f[_0xdfcb('0x3f')],function(_0x5de4b4){var _0xa0c41c={};_0xa0c41c[_0x5de4b4]={'$like':'%'+_0xf7398e[_0xdfcb('0x3b')][_0xdfcb('0x4a')]+'%'};return _0xa0c41c;})});}_0x3c421f=_['merge']({},_0x3c421f,_0xf7398e[_0xdfcb('0x4c')]);return _0xe64894[_0xdfcb('0x5a')](_0x3c421f);}})['then'](function(_0x2e9ef7){if(_0x2e9ef7){_0x40acba=_0x2e9ef7[_0xdfcb('0x41')];if(!_0xf7398e[_0xdfcb('0x3b')][_0xdfcb('0x42')](_0xdfcb('0x43'))){_0x3c421f[_0xdfcb('0x2e')]=qs[_0xdfcb('0x2e')](_0xf7398e[_0xdfcb('0x3b')][_0xdfcb('0x2e')]);_0x3c421f['offset']=qs['offset'](_0xf7398e[_0xdfcb('0x3b')][_0xdfcb('0x2d')]);}return _0xe64894['getTags'](_0x3c421f);}})['then'](function(_0x454602){if(_0x454602){return _0x454602?{'count':_0x40acba,'rows':_0x454602}:null;}})['then'](respondWithResult(_0x3370d4,null))[_0xdfcb('0x29')](handleError(_0x3370d4,null));};exports['setTags']=function(_0x16cf4f,_0x6983e6,_0x3e52a7){if(_0x16cf4f[_0xdfcb('0x54')]['id']){delete _0x16cf4f[_0xdfcb('0x54')]['id'];}return db[_0xdfcb('0x36')][_0xdfcb('0x57')]({'where':{'id':_0x16cf4f[_0xdfcb('0x55')]['id']}})[_0xdfcb('0x21')](handleEntityNotFound(_0x6983e6,null))['then'](function(_0x27ccca){if(_0x27ccca){return _0x27ccca['setTags'](_0x16cf4f['body']['ids']||[]);}return null;})[_0xdfcb('0x21')](respondWithResult(_0x6983e6,null))[_0xdfcb('0x29')](handleError(_0x6983e6,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 86c1a88..bb6749a 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 _0x13b1=['path','./intFreshdeskConfiguration.attributes','exports','define','FreshdeskConfiguration','int_freshdesk_configurations','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x2488b4,_0x3c3ea1){var _0x5c3f2f=function(_0x3386ab){while(--_0x3386ab){_0x2488b4['push'](_0x2488b4['shift']());}};_0x5c3f2f(++_0x3c3ea1);}(_0x13b1,0x11a));var _0x113b=function(_0x2118ad,_0xe8e3fd){_0x2118ad=_0x2118ad-0x0;var _0x4b5715=_0x13b1[_0x2118ad];return _0x4b5715;};'use strict';var _=require(_0x113b('0x0'));var util=require(_0x113b('0x1'));var logger=require(_0x113b('0x2'))(_0x113b('0x3'));var moment=require('moment');var BPromise=require(_0x113b('0x4'));var rp=require(_0x113b('0x5'));var fs=require('fs');var path=require(_0x113b('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x113b('0x7'));module[_0x113b('0x8')]=function(_0x16a1ad,_0x129268){return _0x16a1ad[_0x113b('0x9')](_0x113b('0xa'),attributes,{'tableName':_0x113b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0ea3=['path','rimraf','./intFreshdeskConfiguration.attributes','exports','define','FreshdeskConfiguration','int_freshdesk_configurations','lodash','util','api','moment','bluebird','request-promise'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0x0ea3,0x14c));var _0x30ea=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x0ea3[_0x422905];return _0x33dc6c;};'use strict';var _=require(_0x30ea('0x0'));var util=require(_0x30ea('0x1'));var logger=require('../../config/logger')(_0x30ea('0x2'));var moment=require(_0x30ea('0x3'));var BPromise=require(_0x30ea('0x4'));var rp=require(_0x30ea('0x5'));var fs=require('fs');var path=require(_0x30ea('0x6'));var rimraf=require(_0x30ea('0x7'));var config=require('../../config/environment');var attributes=require(_0x30ea('0x8'));module[_0x30ea('0x9')]=function(_0x5628aa,_0x286dc4){return _0x5628aa[_0x30ea('0xa')](_0x30ea('0xb'),attributes,{'tableName':_0x30ea('0xc'),'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 c190e0b..ab516dc 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 _0x226c=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','code','error','message','FreshdeskConfiguration,\x20%s,\x20%s','result','catch','lodash'];(function(_0xb3c668,_0x4d0408){var _0x2f6f68=function(_0x2c7289){while(--_0x2c7289){_0xb3c668['push'](_0xb3c668['shift']());}};_0x2f6f68(++_0x4d0408);}(_0x226c,0xc7));var _0xc226=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x226c[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0xc226('0x0'));var util=require(_0xc226('0x1'));var moment=require('moment');var BPromise=require(_0xc226('0x2'));var rs=require(_0xc226('0x3'));var fs=require('fs');var Redis=require(_0xc226('0x4'));var db=require(_0xc226('0x5'))['db'];var utils=require(_0xc226('0x6'));var logger=require(_0xc226('0x7'))(_0xc226('0x8'));var config=require(_0xc226('0x9'));var jayson=require(_0xc226('0xa'));var client=jayson[_0xc226('0xb')][_0xc226('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x16d789,_0x284f97,_0x3dc548){return new BPromise(function(_0x5adaaa,_0x3118a1){return client[_0xc226('0xd')](_0x16d789,_0x3dc548)[_0xc226('0xe')](function(_0x38ede3){logger[_0xc226('0xf')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x284f97,_0xc226('0x10'));logger[_0xc226('0x11')](_0xc226('0x12'),_0x284f97,_0xc226('0x10'),JSON['stringify'](_0x38ede3));if(_0x38ede3['error']){if(_0x38ede3['error'][_0xc226('0x13')]===0x1f4){logger[_0xc226('0x14')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x284f97,_0x38ede3[_0xc226('0x14')][_0xc226('0x15')]);return _0x3118a1(_0x38ede3['error'][_0xc226('0x15')]);}logger[_0xc226('0x14')](_0xc226('0x16'),_0x284f97,_0x38ede3[_0xc226('0x14')]['message']);return _0x5adaaa(_0x38ede3[_0xc226('0x14')][_0xc226('0x15')]);}else{logger['info'](_0xc226('0x16'),_0x284f97,_0xc226('0x10'));_0x5adaaa(_0x38ede3[_0xc226('0x17')][_0xc226('0x15')]);}})[_0xc226('0x18')](function(_0xfa9c01){logger['error'](_0xc226('0x16'),_0x284f97,_0xfa9c01);_0x3118a1(_0xfa9c01);});});} \ No newline at end of file +var _0x2de8=['debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','client','request','then','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x11765b,_0x59fab7){var _0x5e651e=function(_0x48f17d){while(--_0x48f17d){_0x11765b['push'](_0x11765b['shift']());}};_0x5e651e(++_0x59fab7);}(_0x2de8,0x8e));var _0x82de=function(_0x5b7ec6,_0x5de2ed){_0x5b7ec6=_0x5b7ec6-0x0;var _0x26f8a4=_0x2de8[_0x5b7ec6];return _0x26f8a4;};'use strict';var _=require(_0x82de('0x0'));var util=require(_0x82de('0x1'));var moment=require('moment');var BPromise=require(_0x82de('0x2'));var rs=require(_0x82de('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x82de('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x82de('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x82de('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4d1d32,_0x240e31,_0x41b098){return new BPromise(function(_0x3ae5b9,_0x3402f7){return client[_0x82de('0x7')](_0x4d1d32,_0x41b098)[_0x82de('0x8')](function(_0x23bb94){logger['info'](_0x82de('0x9'),_0x240e31,_0x82de('0xa'));logger[_0x82de('0xb')](_0x82de('0xc'),_0x240e31,_0x82de('0xa'),JSON['stringify'](_0x23bb94));if(_0x23bb94[_0x82de('0xd')]){if(_0x23bb94[_0x82de('0xd')][_0x82de('0xe')]===0x1f4){logger['error'](_0x82de('0x9'),_0x240e31,_0x23bb94['error']['message']);return _0x3402f7(_0x23bb94['error'][_0x82de('0xf')]);}logger[_0x82de('0xd')](_0x82de('0x9'),_0x240e31,_0x23bb94[_0x82de('0xd')][_0x82de('0xf')]);return _0x3ae5b9(_0x23bb94[_0x82de('0xd')][_0x82de('0xf')]);}else{logger['info']('FreshdeskConfiguration,\x20%s,\x20%s',_0x240e31,'request\x20sent');_0x3ae5b9(_0x23bb94[_0x82de('0x10')][_0x82de('0xf')]);}})['catch'](function(_0x1b2caf){logger['error']('FreshdeskConfiguration,\x20%s,\x20%s',_0x240e31,_0x1b2caf);_0x3402f7(_0x1b2caf);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 2b076dc..8fa6c9b 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 _0x008c=['show','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','isAuthenticated','index','/:id'];(function(_0x9640c0,_0x3d6b05){var _0x3a53f1=function(_0x497f4d){while(--_0x497f4d){_0x9640c0['push'](_0x9640c0['shift']());}};_0x3a53f1(++_0x3d6b05);}(_0x008c,0x188));var _0xc008=function(_0x14f681,_0xa0808e){_0x14f681=_0x14f681-0x0;var _0x1d4cb2=_0x008c[_0x14f681];return _0x1d4cb2;};'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 +var _0xa9e0=['/:id','update','delete','multer','util','path','Router','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','isAuthenticated'];(function(_0x2add02,_0x23fd3f){var _0x24062f=function(_0xec85d0){while(--_0xec85d0){_0x2add02['push'](_0x2add02['shift']());}};_0x24062f(++_0x23fd3f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0xa9e0[_0x934425];return _0x31d596;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var 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['show']);router['post']('/',auth[_0x0a9e('0x8')](),controller['create']);router['put'](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xa')]);router[_0x0a9e('0xb')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 7dbe391..c5480a4 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 _0x9efb=['ENUM','variable','customVariable','string','STRING','exports'];(function(_0x1bbeb9,_0x4f9726){var _0x1b710b=function(_0x5316cb){while(--_0x5316cb){_0x1bbeb9['push'](_0x1bbeb9['shift']());}};_0x1b710b(++_0x4f9726);}(_0x9efb,0x143));var _0xb9ef=function(_0x18ba06,_0x42f589){_0x18ba06=_0x18ba06-0x0;var _0x4f4ed9=_0x9efb[_0x18ba06];return _0x4f4ed9;};'use strict';var Sequelize=require('sequelize');module[_0xb9ef('0x0')]={'type':{'type':Sequelize[_0xb9ef('0x1')]('string',_0xb9ef('0x2'),_0xb9ef('0x3'),'keyValue'),'defaultValue':_0xb9ef('0x4')},'content':{'type':Sequelize[_0xb9ef('0x5')]},'key':{'type':Sequelize[_0xb9ef('0x5')]},'keyType':{'type':Sequelize[_0xb9ef('0x1')](_0xb9ef('0x4'),_0xb9ef('0x2'),_0xb9ef('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xb9ef('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x50a6=['string','STRING','ENUM','customVariable','sequelize','exports','variable','keyValue'];(function(_0x49a0b9,_0x8201dd){var _0x457f3e=function(_0x4abffd){while(--_0x4abffd){_0x49a0b9['push'](_0x49a0b9['shift']());}};_0x457f3e(++_0x8201dd);}(_0x50a6,0xa4));var _0x650a=function(_0x31ddea,_0x40de6d){_0x31ddea=_0x31ddea-0x0;var _0x12539b=_0x50a6[_0x31ddea];return _0x12539b;};'use strict';var Sequelize=require(_0x650a('0x0'));module[_0x650a('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0x650a('0x2'),'customVariable',_0x650a('0x3')),'defaultValue':_0x650a('0x4')},'content':{'type':Sequelize[_0x650a('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x650a('0x6')]('string','variable',_0x650a('0x7'))},'keyContent':{'type':Sequelize[_0x650a('0x5')]},'idField':{'type':Sequelize[_0x650a('0x5')]},'nameField':{'type':Sequelize[_0x650a('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x650a('0x5')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 8c0d6bf..cccf251 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 _0x75bd=['bluebird','mustache','util','path','to-csv','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','save','then','destroy','error','stack','name','FreshdeskField','rawAttributes','fieldName','type','key','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','params','keys','find','create','body','html-pdf','eml-format','zip-dir','request-promise','moment'];(function(_0x5d1566,_0x3fed4b){var _0x3441a2=function(_0x57c3fe){while(--_0x57c3fe){_0x5d1566['push'](_0x5d1566['shift']());}};_0x3441a2(++_0x3fed4b);}(_0x75bd,0x113));var _0xd75b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x75bd[_0x14add3];return _0x4a174f;};'use strict';var pdf=require(_0xd75b('0x0'));var emlformat=require(_0xd75b('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xd75b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd75b('0x3'));var moment=require(_0xd75b('0x4'));var BPromise=require(_0xd75b('0x5'));var Mustache=require(_0xd75b('0x6'));var util=require(_0xd75b('0x7'));var path=require(_0xd75b('0x8'));var sox=require('sox');var csv=require(_0xd75b('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xd75b('0xa'));var squel=require('squel');var crypto=require(_0xd75b('0xb'));var jsforce=require(_0xd75b('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xd75b('0x9'));var querystring=require(_0xd75b('0xd'));var Papa=require(_0xd75b('0xe'));var Redis=require(_0xd75b('0xf'));var authService=require(_0xd75b('0x10'));var qs=require(_0xd75b('0x11'));var as=require(_0xd75b('0x12'));var hardwareService=require(_0xd75b('0x13'));var logger=require('../../config/logger')(_0xd75b('0x14'));var utils=require(_0xd75b('0x15'));var config=require('../../config/environment');var db=require(_0xd75b('0x16'))['db'];function respondWithStatusCode(_0x39040d,_0xe8e193){_0xe8e193=_0xe8e193||0xcc;return function(_0x4775d4){if(_0x4775d4){return _0x39040d[_0xd75b('0x17')](_0xe8e193);}return _0x39040d[_0xd75b('0x18')](_0xe8e193)[_0xd75b('0x19')]();};}function respondWithResult(_0x547423,_0x3fb939){_0x3fb939=_0x3fb939||0xc8;return function(_0x49954d){if(_0x49954d){return _0x547423[_0xd75b('0x18')](_0x3fb939)[_0xd75b('0x1a')](_0x49954d);}};}function respondWithFilteredResult(_0x1776d7,_0x5362d2){return function(_0x1c35e0){if(_0x1c35e0){var _0x37a1f4=_0x1c35e0[_0xd75b('0x1b')],_0x3db384=_0x5362d2[_0xd75b('0x1c')],_0x1d71fc=_0x5362d2[_0xd75b('0x1c')]+_0x5362d2['limit'],_0x578c7c;if(_0x1d71fc>=_0x37a1f4){_0x1d71fc=_0x37a1f4;_0x578c7c=0xc8;}else{_0x578c7c=0xce;}_0x1776d7[_0xd75b('0x18')](_0x578c7c);return _0x1776d7[_0xd75b('0x1d')](_0xd75b('0x1e'),_0x3db384+'-'+_0x1d71fc+'/'+_0x37a1f4)['json'](_0x1c35e0);}return null;};}function patchUpdates(_0x4ad9ab){return function(_0x45978a){try{jsonpatch['apply'](_0x45978a,_0x4ad9ab,!![]);}catch(_0x5d3afe){return BPromise['reject'](_0x5d3afe);}return _0x45978a[_0xd75b('0x1f')]();};}function saveUpdates(_0x3cb617,_0x2fb0f8){return function(_0x28d0b7){if(_0x28d0b7){return _0x28d0b7['update'](_0x3cb617)[_0xd75b('0x20')](function(_0x4184fc){return _0x4184fc;});}return null;};}function removeEntity(_0x36a461,_0x5c7b75){return function(_0x5be884){if(_0x5be884){return _0x5be884[_0xd75b('0x21')]()[_0xd75b('0x20')](function(){_0x36a461[_0xd75b('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1aea75,_0xf932b4){return function(_0x8a0ab5){if(!_0x8a0ab5){_0x1aea75['sendStatus'](0x194);}return _0x8a0ab5;};}function handleError(_0x3c2a4a,_0x353052){_0x353052=_0x353052||0x1f4;return function(_0x4bba7c){logger[_0xd75b('0x22')](_0x4bba7c[_0xd75b('0x23')]);if(_0x4bba7c[_0xd75b('0x24')]){delete _0x4bba7c[_0xd75b('0x24')];}_0x3c2a4a[_0xd75b('0x18')](_0x353052)['send'](_0x4bba7c);};}exports['index']=function(_0x2af650,_0x3c0cc3){var _0x588782={},_0x3e50b2={},_0x2d4205={'count':0x0,'rows':[]};var _0x14b441=_['map'](db[_0xd75b('0x25')][_0xd75b('0x26')],function(_0x140cc3){return{'name':_0x140cc3[_0xd75b('0x27')],'type':_0x140cc3[_0xd75b('0x28')][_0xd75b('0x29')]};});_0x3e50b2['model']=_[_0xd75b('0x2a')](_0x14b441,'name');_0x3e50b2[_0xd75b('0x2b')]=_['keys'](_0x2af650[_0xd75b('0x2b')]);_0x3e50b2[_0xd75b('0x2c')]=_[_0xd75b('0x2d')](_0x3e50b2[_0xd75b('0x2e')],_0x3e50b2[_0xd75b('0x2b')]);_0x588782[_0xd75b('0x2f')]=_['intersection'](_0x3e50b2[_0xd75b('0x2e')],qs[_0xd75b('0x30')](_0x2af650[_0xd75b('0x2b')]['fields']));_0x588782[_0xd75b('0x2f')]=_0x588782[_0xd75b('0x2f')][_0xd75b('0x31')]?_0x588782[_0xd75b('0x2f')]:_0x3e50b2[_0xd75b('0x2e')];if(!_0x2af650['query'][_0xd75b('0x32')](_0xd75b('0x33'))){_0x588782[_0xd75b('0x34')]=qs[_0xd75b('0x34')](_0x2af650[_0xd75b('0x2b')][_0xd75b('0x34')]);_0x588782[_0xd75b('0x1c')]=qs['offset'](_0x2af650[_0xd75b('0x2b')]['offset']);}_0x588782[_0xd75b('0x35')]=qs[_0xd75b('0x36')](_0x2af650[_0xd75b('0x2b')][_0xd75b('0x36')]);_0x588782[_0xd75b('0x37')]=qs['filters'](_[_0xd75b('0x38')](_0x2af650[_0xd75b('0x2b')],_0x3e50b2['filters']),_0x14b441);if(_0x2af650[_0xd75b('0x2b')][_0xd75b('0x39')]){_0x588782[_0xd75b('0x37')]=_[_0xd75b('0x3a')](_0x588782[_0xd75b('0x37')],{'$or':_[_0xd75b('0x2a')](_0x14b441,function(_0x29a860){if(_0x29a860[_0xd75b('0x28')]!==_0xd75b('0x3b')){var _0x54607b={};_0x54607b[_0x29a860[_0xd75b('0x24')]]={'$like':'%'+_0x2af650[_0xd75b('0x2b')][_0xd75b('0x39')]+'%'};return _0x54607b;}})});}_0x588782=_[_0xd75b('0x3a')]({},_0x588782,_0x2af650['options']);var _0x40697e={'where':_0x588782[_0xd75b('0x37')]};return db[_0xd75b('0x25')][_0xd75b('0x1b')](_0x40697e)[_0xd75b('0x20')](function(_0x4c97a5){_0x2d4205[_0xd75b('0x1b')]=_0x4c97a5;if(_0x2af650[_0xd75b('0x2b')][_0xd75b('0x3c')]){_0x588782[_0xd75b('0x3d')]=[{'all':!![]}];}return db[_0xd75b('0x25')][_0xd75b('0x3e')](_0x588782);})['then'](function(_0x2f0530){_0x2d4205[_0xd75b('0x3f')]=_0x2f0530;return _0x2d4205;})['then'](respondWithFilteredResult(_0x3c0cc3,_0x588782))[_0xd75b('0x40')](handleError(_0x3c0cc3,null));};exports['show']=function(_0xe48eba,_0xbf6c41){var _0x24b141={'raw':!![],'where':{'id':_0xe48eba[_0xd75b('0x41')]['id']}},_0x2d9303={};_0x2d9303[_0xd75b('0x2e')]=_[_0xd75b('0x42')](db[_0xd75b('0x25')][_0xd75b('0x26')]);_0x2d9303[_0xd75b('0x2b')]=_[_0xd75b('0x42')](_0xe48eba['query']);_0x2d9303[_0xd75b('0x2c')]=_[_0xd75b('0x2d')](_0x2d9303[_0xd75b('0x2e')],_0x2d9303['query']);_0x24b141[_0xd75b('0x2f')]=_[_0xd75b('0x2d')](_0x2d9303['model'],qs[_0xd75b('0x30')](_0xe48eba['query'][_0xd75b('0x30')]));_0x24b141[_0xd75b('0x2f')]=_0x24b141[_0xd75b('0x2f')]['length']?_0x24b141[_0xd75b('0x2f')]:_0x2d9303[_0xd75b('0x2e')];if(_0xe48eba[_0xd75b('0x2b')][_0xd75b('0x3c')]){_0x24b141['include']=[{'all':!![]}];}_0x24b141=_[_0xd75b('0x3a')]({},_0x24b141,_0xe48eba['options']);return db['FreshdeskField'][_0xd75b('0x43')](_0x24b141)['then'](handleEntityNotFound(_0xbf6c41,null))['then'](respondWithResult(_0xbf6c41,null))[_0xd75b('0x40')](handleError(_0xbf6c41,null));};exports[_0xd75b('0x44')]=function(_0x78088d,_0x19380f){return db['FreshdeskField'][_0xd75b('0x44')](_0x78088d[_0xd75b('0x45')],{})[_0xd75b('0x20')](respondWithResult(_0x19380f,0xc9))['catch'](handleError(_0x19380f,null));};exports['update']=function(_0x441b7b,_0x33a782){if(_0x441b7b[_0xd75b('0x45')]['id']){delete _0x441b7b[_0xd75b('0x45')]['id'];}return db[_0xd75b('0x25')][_0xd75b('0x43')]({'where':{'id':_0x441b7b[_0xd75b('0x41')]['id']}})['then'](handleEntityNotFound(_0x33a782,null))[_0xd75b('0x20')](saveUpdates(_0x441b7b[_0xd75b('0x45')],null))[_0xd75b('0x20')](respondWithResult(_0x33a782,null))[_0xd75b('0x40')](handleError(_0x33a782,null));};exports[_0xd75b('0x21')]=function(_0x2dd30a,_0x30b4c9){return db['FreshdeskField']['find']({'where':{'id':_0x2dd30a['params']['id']}})[_0xd75b('0x20')](handleEntityNotFound(_0x30b4c9,null))[_0xd75b('0x20')](removeEntity(_0x30b4c9,null))[_0xd75b('0x40')](handleError(_0x30b4c9,null));}; \ No newline at end of file +var _0x7b76=['update','destroy','sendStatus','error','stack','name','send','map','FreshdeskField','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','then','includeAll','findAll','catch','params','rawAttributes','include','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','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','../../config/utils','../../config/environment','../../mysqldb','end','status','count','offset','limit','set','Content-Range','apply','reject','save'];(function(_0x417626,_0x2c3580){var _0x10589d=function(_0x3a2634){while(--_0x3a2634){_0x417626['push'](_0x417626['shift']());}};_0x10589d(++_0x2c3580);}(_0x7b76,0x104));var _0x67b7=function(_0x6f6c37,_0x1725ef){_0x6f6c37=_0x6f6c37-0x0;var _0x54cb92=_0x7b76[_0x6f6c37];return _0x54cb92;};'use strict';var pdf=require(_0x67b7('0x0'));var emlformat=require(_0x67b7('0x1'));var rimraf=require(_0x67b7('0x2'));var zipdir=require(_0x67b7('0x3'));var jsonpatch=require(_0x67b7('0x4'));var rp=require(_0x67b7('0x5'));var moment=require('moment');var BPromise=require(_0x67b7('0x6'));var Mustache=require(_0x67b7('0x7'));var util=require('util');var path=require(_0x67b7('0x8'));var sox=require(_0x67b7('0x9'));var csv=require(_0x67b7('0xa'));var ejs=require(_0x67b7('0xb'));var fs=require('fs');var _=require(_0x67b7('0xc'));var squel=require(_0x67b7('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x67b7('0xe'));var toCsv=require(_0x67b7('0xa'));var querystring=require(_0x67b7('0xf'));var Papa=require(_0x67b7('0x10'));var Redis=require(_0x67b7('0x11'));var authService=require(_0x67b7('0x12'));var qs=require(_0x67b7('0x13'));var as=require(_0x67b7('0x14'));var hardwareService=require(_0x67b7('0x15'));var logger=require(_0x67b7('0x16'))('api');var utils=require(_0x67b7('0x17'));var config=require(_0x67b7('0x18'));var db=require(_0x67b7('0x19'))['db'];function respondWithStatusCode(_0x9771db,_0x445a83){_0x445a83=_0x445a83||0xcc;return function(_0x154fbb){if(_0x154fbb){return _0x9771db['sendStatus'](_0x445a83);}return _0x9771db['status'](_0x445a83)[_0x67b7('0x1a')]();};}function respondWithResult(_0x4116d8,_0x3f260b){_0x3f260b=_0x3f260b||0xc8;return function(_0x2b145b){if(_0x2b145b){return _0x4116d8[_0x67b7('0x1b')](_0x3f260b)['json'](_0x2b145b);}};}function respondWithFilteredResult(_0x48598a,_0x5a83c8){return function(_0x13de68){if(_0x13de68){var _0x53ff34=_0x13de68[_0x67b7('0x1c')],_0x2a6139=_0x5a83c8[_0x67b7('0x1d')],_0x28781c=_0x5a83c8[_0x67b7('0x1d')]+_0x5a83c8[_0x67b7('0x1e')],_0x422add;if(_0x28781c>=_0x53ff34){_0x28781c=_0x53ff34;_0x422add=0xc8;}else{_0x422add=0xce;}_0x48598a[_0x67b7('0x1b')](_0x422add);return _0x48598a[_0x67b7('0x1f')](_0x67b7('0x20'),_0x2a6139+'-'+_0x28781c+'/'+_0x53ff34)['json'](_0x13de68);}return null;};}function patchUpdates(_0x15b28d){return function(_0x106236){try{jsonpatch[_0x67b7('0x21')](_0x106236,_0x15b28d,!![]);}catch(_0x4ff8b8){return BPromise[_0x67b7('0x22')](_0x4ff8b8);}return _0x106236[_0x67b7('0x23')]();};}function saveUpdates(_0x4c1e65,_0x54dbf4){return function(_0x162046){if(_0x162046){return _0x162046[_0x67b7('0x24')](_0x4c1e65)['then'](function(_0x2bbaa4){return _0x2bbaa4;});}return null;};}function removeEntity(_0x4a4074,_0x1c73b9){return function(_0x4346d4){if(_0x4346d4){return _0x4346d4[_0x67b7('0x25')]()['then'](function(){_0x4a4074[_0x67b7('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1dd743,_0x514eba){return function(_0x13de5c){if(!_0x13de5c){_0x1dd743[_0x67b7('0x26')](0x194);}return _0x13de5c;};}function handleError(_0x76323e,_0x386be2){_0x386be2=_0x386be2||0x1f4;return function(_0x3845c9){logger[_0x67b7('0x27')](_0x3845c9[_0x67b7('0x28')]);if(_0x3845c9[_0x67b7('0x29')]){delete _0x3845c9[_0x67b7('0x29')];}_0x76323e[_0x67b7('0x1b')](_0x386be2)[_0x67b7('0x2a')](_0x3845c9);};}exports['index']=function(_0x483259,_0x431ac5){var _0x5ae53c={},_0x26bf24={},_0x2149f2={'count':0x0,'rows':[]};var _0x50d2a5=_[_0x67b7('0x2b')](db[_0x67b7('0x2c')]['rawAttributes'],function(_0x4657ed){return{'name':_0x4657ed[_0x67b7('0x2d')],'type':_0x4657ed[_0x67b7('0x2e')][_0x67b7('0x2f')]};});_0x26bf24[_0x67b7('0x30')]=_[_0x67b7('0x2b')](_0x50d2a5,_0x67b7('0x29'));_0x26bf24[_0x67b7('0x31')]=_[_0x67b7('0x32')](_0x483259['query']);_0x26bf24[_0x67b7('0x33')]=_[_0x67b7('0x34')](_0x26bf24[_0x67b7('0x30')],_0x26bf24[_0x67b7('0x31')]);_0x5ae53c[_0x67b7('0x35')]=_[_0x67b7('0x34')](_0x26bf24[_0x67b7('0x30')],qs[_0x67b7('0x36')](_0x483259[_0x67b7('0x31')][_0x67b7('0x36')]));_0x5ae53c['attributes']=_0x5ae53c[_0x67b7('0x35')]['length']?_0x5ae53c[_0x67b7('0x35')]:_0x26bf24[_0x67b7('0x30')];if(!_0x483259[_0x67b7('0x31')][_0x67b7('0x37')](_0x67b7('0x38'))){_0x5ae53c['limit']=qs[_0x67b7('0x1e')](_0x483259[_0x67b7('0x31')][_0x67b7('0x1e')]);_0x5ae53c['offset']=qs['offset'](_0x483259[_0x67b7('0x31')][_0x67b7('0x1d')]);}_0x5ae53c[_0x67b7('0x39')]=qs[_0x67b7('0x3a')](_0x483259['query'][_0x67b7('0x3a')]);_0x5ae53c['where']=qs[_0x67b7('0x33')](_['pick'](_0x483259['query'],_0x26bf24[_0x67b7('0x33')]),_0x50d2a5);if(_0x483259['query'][_0x67b7('0x3b')]){_0x5ae53c[_0x67b7('0x3c')]=_[_0x67b7('0x3d')](_0x5ae53c[_0x67b7('0x3c')],{'$or':_[_0x67b7('0x2b')](_0x50d2a5,function(_0x5193df){if(_0x5193df[_0x67b7('0x2e')]!==_0x67b7('0x3e')){var _0x58d97f={};_0x58d97f[_0x5193df[_0x67b7('0x29')]]={'$like':'%'+_0x483259[_0x67b7('0x31')]['filter']+'%'};return _0x58d97f;}})});}_0x5ae53c=_['merge']({},_0x5ae53c,_0x483259[_0x67b7('0x3f')]);var _0x50bfba={'where':_0x5ae53c[_0x67b7('0x3c')]};return db[_0x67b7('0x2c')][_0x67b7('0x1c')](_0x50bfba)[_0x67b7('0x40')](function(_0x1dacea){_0x2149f2[_0x67b7('0x1c')]=_0x1dacea;if(_0x483259['query'][_0x67b7('0x41')]){_0x5ae53c['include']=[{'all':!![]}];}return db[_0x67b7('0x2c')][_0x67b7('0x42')](_0x5ae53c);})['then'](function(_0x36d939){_0x2149f2['rows']=_0x36d939;return _0x2149f2;})[_0x67b7('0x40')](respondWithFilteredResult(_0x431ac5,_0x5ae53c))[_0x67b7('0x43')](handleError(_0x431ac5,null));};exports['show']=function(_0x216c39,_0x3a33bc){var _0xe20f31={'raw':!![],'where':{'id':_0x216c39[_0x67b7('0x44')]['id']}},_0x248c2c={};_0x248c2c[_0x67b7('0x30')]=_['keys'](db['FreshdeskField'][_0x67b7('0x45')]);_0x248c2c[_0x67b7('0x31')]=_[_0x67b7('0x32')](_0x216c39[_0x67b7('0x31')]);_0x248c2c[_0x67b7('0x33')]=_['intersection'](_0x248c2c['model'],_0x248c2c['query']);_0xe20f31[_0x67b7('0x35')]=_[_0x67b7('0x34')](_0x248c2c[_0x67b7('0x30')],qs[_0x67b7('0x36')](_0x216c39[_0x67b7('0x31')][_0x67b7('0x36')]));_0xe20f31[_0x67b7('0x35')]=_0xe20f31['attributes']['length']?_0xe20f31[_0x67b7('0x35')]:_0x248c2c[_0x67b7('0x30')];if(_0x216c39['query']['includeAll']){_0xe20f31[_0x67b7('0x46')]=[{'all':!![]}];}_0xe20f31=_[_0x67b7('0x3d')]({},_0xe20f31,_0x216c39['options']);return db[_0x67b7('0x2c')][_0x67b7('0x47')](_0xe20f31)[_0x67b7('0x40')](handleEntityNotFound(_0x3a33bc,null))['then'](respondWithResult(_0x3a33bc,null))[_0x67b7('0x43')](handleError(_0x3a33bc,null));};exports[_0x67b7('0x48')]=function(_0x2c4326,_0x3bed0a){return db[_0x67b7('0x2c')][_0x67b7('0x48')](_0x2c4326[_0x67b7('0x49')],{})[_0x67b7('0x40')](respondWithResult(_0x3bed0a,0xc9))[_0x67b7('0x43')](handleError(_0x3bed0a,null));};exports['update']=function(_0x5a2280,_0x202108){if(_0x5a2280[_0x67b7('0x49')]['id']){delete _0x5a2280[_0x67b7('0x49')]['id'];}return db[_0x67b7('0x2c')][_0x67b7('0x47')]({'where':{'id':_0x5a2280[_0x67b7('0x44')]['id']}})[_0x67b7('0x40')](handleEntityNotFound(_0x202108,null))['then'](saveUpdates(_0x5a2280['body'],null))[_0x67b7('0x40')](respondWithResult(_0x202108,null))[_0x67b7('0x43')](handleError(_0x202108,null));};exports[_0x67b7('0x25')]=function(_0x17beac,_0x2c15af){return db[_0x67b7('0x2c')][_0x67b7('0x47')]({'where':{'id':_0x17beac[_0x67b7('0x44')]['id']}})['then'](handleEntityNotFound(_0x2c15af,null))[_0x67b7('0x40')](removeEntity(_0x2c15af,null))[_0x67b7('0x43')](handleError(_0x2c15af,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index dc92b73..c31dfa5 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 _0x0080=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intFreshdeskField.attributes','exports','define','FreshdeskField','freshdesk_unique_index','idField','FieldId'];(function(_0x33f119,_0x5621e5){var _0x27c6b3=function(_0x24a76e){while(--_0x24a76e){_0x33f119['push'](_0x33f119['shift']());}};_0x27c6b3(++_0x5621e5);}(_0x0080,0x80));var _0x0008=function(_0xdade7d,_0x29203d){_0xdade7d=_0xdade7d-0x0;var _0x44817d=_0x0080[_0xdade7d];return _0x44817d;};'use strict';var _=require(_0x0008('0x0'));var util=require(_0x0008('0x1'));var logger=require(_0x0008('0x2'))(_0x0008('0x3'));var moment=require(_0x0008('0x4'));var BPromise=require(_0x0008('0x5'));var rp=require(_0x0008('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0008('0x7'));var config=require(_0x0008('0x8'));var attributes=require(_0x0008('0x9'));module[_0x0008('0xa')]=function(_0x1460fc,_0x233b5f){return _0x1460fc[_0x0008('0xb')](_0x0008('0xc'),attributes,{'tableName':'int_freshdesk_fields','paranoid':![],'indexes':[{'name':_0x0008('0xd'),'fields':[_0x0008('0xe'),_0x0008('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xaeba=['bluebird','request-promise','path','rimraf','./intFreshdeskField.attributes','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField','lodash','api'];(function(_0x4eb863,_0x4dfda9){var _0x456061=function(_0x41b406){while(--_0x41b406){_0x4eb863['push'](_0x4eb863['shift']());}};_0x456061(++_0x4dfda9);}(_0xaeba,0x1cc));var _0xaaeb=function(_0x594adf,_0x46d7a1){_0x594adf=_0x594adf-0x0;var _0x4ac73e=_0xaeba[_0x594adf];return _0x4ac73e;};'use strict';var _=require(_0xaaeb('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xaaeb('0x1'));var moment=require('moment');var BPromise=require(_0xaaeb('0x2'));var rp=require(_0xaaeb('0x3'));var fs=require('fs');var path=require(_0xaaeb('0x4'));var rimraf=require(_0xaaeb('0x5'));var config=require('../../config/environment');var attributes=require(_0xaaeb('0x6'));module['exports']=function(_0xab682e,_0x45aa9c){return _0xab682e['define'](_0xaaeb('0x7'),attributes,{'tableName':_0xaaeb('0x8'),'paranoid':![],'indexes':[{'name':_0xaaeb('0x9'),'fields':[_0xaaeb('0xa'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.rpc.js b/server/api/intFreshdeskField/intFreshdeskField.rpc.js index e6c0925..52e2eb9 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 _0xb10b=['stringify','error','message','result','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','FreshdeskField,\x20%s,\x20%s','FreshdeskField,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x5ef5c6,_0x5363dd){var _0x3bb60d=function(_0x50cba6){while(--_0x50cba6){_0x5ef5c6['push'](_0x5ef5c6['shift']());}};_0x3bb60d(++_0x5363dd);}(_0xb10b,0x12a));var _0xbb10=function(_0x24875d,_0x4fb24d){_0x24875d=_0x24875d-0x0;var _0x181471=_0xb10b[_0x24875d];return _0x181471;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});} \ No newline at end of file +var _0xb10b=['stringify','error','message','result','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','FreshdeskField,\x20%s,\x20%s','FreshdeskField,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x29f782,_0x1aeb12){var _0x25fb54=function(_0x2163ee){while(--_0x2163ee){_0x29f782['push'](_0x29f782['shift']());}};_0x25fb54(++_0x1aeb12);}(_0xb10b,0x12a));var _0xbb10=function(_0xf7f60a,_0x15f736){_0xf7f60a=_0xf7f60a-0x0;var _0x2567ad=_0xb10b[_0xf7f60a];return _0x2567ad;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 1b3f1d9..fe5b1b7 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 _0xd3e8=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','put','delete','/:id','destroy','exports','multer','path','connect-timeout','express','Router'];(function(_0x2d2ca2,_0x51873f){var _0x48489d=function(_0x1a2cf7){while(--_0x1a2cf7){_0x2d2ca2['push'](_0x2d2ca2['shift']());}};_0x48489d(++_0x51873f);}(_0xd3e8,0x16b));var _0x8d3e=function(_0x16b042,_0x1ce781){_0x16b042=_0x16b042-0x0;var _0x49c89c=_0xd3e8[_0x16b042];return _0x49c89c;};'use strict';var multer=require(_0x8d3e('0x0'));var util=require('util');var path=require(_0x8d3e('0x1'));var timeout=require(_0x8d3e('0x2'));var express=require(_0x8d3e('0x3'));var router=express[_0x8d3e('0x4')]();var auth=require(_0x8d3e('0x5'));var interaction=require(_0x8d3e('0x6'));var config=require(_0x8d3e('0x7'));var controller=require(_0x8d3e('0x8'));router[_0x8d3e('0x9')]('/',auth[_0x8d3e('0xa')](),controller['index']);router[_0x8d3e('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x8d3e('0xb')]);router[_0x8d3e('0x9')](_0x8d3e('0xc'),auth[_0x8d3e('0xa')](),controller[_0x8d3e('0xd')]);router['get'](_0x8d3e('0xe'),auth[_0x8d3e('0xa')](),controller[_0x8d3e('0xf')]);router[_0x8d3e('0x10')]('/',auth[_0x8d3e('0xa')](),controller[_0x8d3e('0x11')]);router['post']('/:id/configurations',auth['isAuthenticated'](),controller['addConfiguration']);router[_0x8d3e('0x12')]('/:id',auth[_0x8d3e('0xa')](),controller['update']);router[_0x8d3e('0x13')](_0x8d3e('0x14'),auth['isAuthenticated'](),controller[_0x8d3e('0x15')]);module[_0x8d3e('0x16')]=router; \ No newline at end of file +var _0x040e=['/:id/fields','getFields','create','post','addConfiguration','/:id','update','path','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','/:id/configurations','getConfigurations'];(function(_0x3635ce,_0x33a6f9){var _0x97ecd0=function(_0x123d98){while(--_0x123d98){_0x3635ce['push'](_0x3635ce['shift']());}};_0x97ecd0(++_0x33a6f9);}(_0x040e,0x127));var _0xe040=function(_0x43de94,_0x11221a){_0x43de94=_0x43de94-0x0;var _0x1e747e=_0x040e[_0x43de94];return _0x1e747e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe040('0x0'));var timeout=require('connect-timeout');var express=require(_0xe040('0x1'));var router=express[_0xe040('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0xe040('0x3'));var config=require(_0xe040('0x4'));var controller=require('./intFreshsalesAccount.controller');router[_0xe040('0x5')]('/',auth[_0xe040('0x6')](),controller[_0xe040('0x7')]);router[_0xe040('0x5')]('/:id',auth[_0xe040('0x6')](),controller[_0xe040('0x8')]);router[_0xe040('0x5')](_0xe040('0x9'),auth[_0xe040('0x6')](),controller[_0xe040('0xa')]);router[_0xe040('0x5')](_0xe040('0xb'),auth['isAuthenticated'](),controller[_0xe040('0xc')]);router['post']('/',auth[_0xe040('0x6')](),controller[_0xe040('0xd')]);router[_0xe040('0xe')]('/:id/configurations',auth['isAuthenticated'](),controller[_0xe040('0xf')]);router['put'](_0xe040('0x10'),auth[_0xe040('0x6')](),controller[_0xe040('0x11')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index fedac4b..6a0d280 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 _0x341c=['sequelize','STRING','username','remoteUri'];(function(_0x132edb,_0x54e052){var _0x294aab=function(_0x3630cf){while(--_0x3630cf){_0x132edb['push'](_0x132edb['shift']());}};_0x294aab(++_0x54e052);}(_0x341c,0xcc));var _0xc341=function(_0x212579,_0xdb4d5a){_0x212579=_0x212579-0x0;var _0x55d50e=_0x341c[_0x212579];return _0x55d50e;};'use strict';var Sequelize=require(_0xc341('0x0'));module['exports']={'name':{'type':Sequelize[_0xc341('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xc341('0x1')],'unique':_0xc341('0x2')},'apiKey':{'type':Sequelize[_0xc341('0x1')]},'remoteUri':{'type':Sequelize[_0xc341('0x1')],'unique':_0xc341('0x3')},'serverUrl':{'type':Sequelize[_0xc341('0x1')]}}; \ No newline at end of file +var _0x7292=['exports','STRING','username','remoteUri','sequelize'];(function(_0x199cde,_0x1b8a78){var _0x12a7e2=function(_0x502b94){while(--_0x502b94){_0x199cde['push'](_0x199cde['shift']());}};_0x12a7e2(++_0x1b8a78);}(_0x7292,0x6d));var _0x2729=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0x7292[_0x173441];return _0x2423a8;};'use strict';var Sequelize=require(_0x2729('0x0'));module[_0x2729('0x1')]={'name':{'type':Sequelize[_0x2729('0x2')]},'description':{'type':Sequelize[_0x2729('0x2')]},'username':{'type':Sequelize[_0x2729('0x2')],'unique':_0x2729('0x3')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x2729('0x2')],'unique':_0x2729('0x4')},'serverUrl':{'type':Sequelize[_0x2729('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index 33c2f7a..a73a49c 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 _0xecce=['lastIndexOf','format','/api/selector/owners','Token\x20token=','users','email','Requested\x20Resource\x20not\x20Found','statusCode','stringify','send','Wrong\x20credentials','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../components/integrations/configuration','jayson/promise','client','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','FreshsalesAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','sendStatus','status','json','count','offset','set','Content-Range','reject','save','update','destroy','index','map','FreshsalesAccount','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','create','body','find','getConfigurations','findOne','FreshsalesConfiguration','pick','addConfiguration','AccountId','getSubjects','channel','getDescriptions','FreshsalesField','Subjects','getFields','apiKey','username','remoteUri','slice','substring'];(function(_0x4cc03b,_0x299f1c){var _0xf0358c=function(_0x3d0da8){while(--_0x3d0da8){_0x4cc03b['push'](_0x4cc03b['shift']());}};_0xf0358c(++_0x299f1c);}(_0xecce,0x7c));var _0xeecc=function(_0x227bfa,_0x51bedc){_0x227bfa=_0x227bfa-0x0;var _0x331aba=_0xecce[_0x227bfa];return _0x331aba;};'use strict';var pdf=require(_0xeecc('0x0'));var emlformat=require(_0xeecc('0x1'));var rimraf=require(_0xeecc('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xeecc('0x3'));var rp=require(_0xeecc('0x4'));var moment=require(_0xeecc('0x5'));var BPromise=require(_0xeecc('0x6'));var Mustache=require(_0xeecc('0x7'));var util=require(_0xeecc('0x8'));var path=require(_0xeecc('0x9'));var sox=require(_0xeecc('0xa'));var csv=require(_0xeecc('0xb'));var ejs=require(_0xeecc('0xc'));var fs=require('fs');var _=require(_0xeecc('0xd'));var squel=require(_0xeecc('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xeecc('0xf'));var toCsv=require(_0xeecc('0xb'));var querystring=require(_0xeecc('0x10'));var Papa=require(_0xeecc('0x11'));var Redis=require('ioredis');var authService=require(_0xeecc('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xeecc('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xeecc('0x14'))('api');var utils=require(_0xeecc('0x15'));var config=require(_0xeecc('0x16'));var db=require('../../mysqldb')['db'];var integrations=require(_0xeecc('0x17'));var jayson=require(_0xeecc('0x18'));var client=jayson[_0xeecc('0x19')]['http']({'port':0x232a});function checkPasswordPattern(_0x15f404,_0x1c04e8,_0x6b1164){if(_0x6b1164){var _0x24b5e4=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x24b5e4[_0xeecc('0x1a')](_0x1c04e8)){return _0x15f404;}else{throw new db['Sequelize'][(_0xeecc('0x1b'))](_0xeecc('0x1c'));}}else{return _0x15f404;}}function respondWithRpcPromise(_0x4c5704,_0x487b1a,_0x1e84e2,_0x1aa970){return new BPromise(function(_0xe6b060,_0x49d89a){var _0x112aad=_0x1aa970||client;return _0x112aad[_0xeecc('0x1d')](_0x4c5704,_0x1e84e2)[_0xeecc('0x1e')](function(_0x3a7921){logger[_0xeecc('0x1f')](_0xeecc('0x20'),_0x487b1a,_0xeecc('0x21'));logger['debug'](_0xeecc('0x22'),_0x487b1a,'request\x20sent',JSON['stringify'](_0x3a7921));if(_0x3a7921[_0xeecc('0x23')]){if(_0x3a7921['error'][_0xeecc('0x24')]===0x1f4){logger[_0xeecc('0x23')](_0xeecc('0x20'),_0x487b1a,_0x3a7921[_0xeecc('0x23')]['message']);return _0x49d89a(_0x3a7921['error'][_0xeecc('0x25')]);}logger[_0xeecc('0x23')](_0xeecc('0x20'),_0x487b1a,_0x3a7921[_0xeecc('0x23')]['message']);return _0xe6b060(_0x3a7921['error'][_0xeecc('0x25')]);}else{logger[_0xeecc('0x1f')](_0xeecc('0x20'),_0x487b1a,_0xeecc('0x21'));_0xe6b060(_0x3a7921[_0xeecc('0x26')][_0xeecc('0x25')]);}})['catch'](function(_0xb7fdd2){logger[_0xeecc('0x23')](_0xeecc('0x20'),_0x487b1a,_0xb7fdd2);_0x49d89a(_0xb7fdd2);});});}function respondWithStatusCode(_0xfc27ad,_0x20d631){_0x20d631=_0x20d631||0xcc;return function(_0x81236c){if(_0x81236c){return _0xfc27ad[_0xeecc('0x27')](_0x20d631);}return _0xfc27ad['status'](_0x20d631)['end']();};}function respondWithResult(_0x7b618,_0x546e73){_0x546e73=_0x546e73||0xc8;return function(_0x59dffe){if(_0x59dffe){return _0x7b618[_0xeecc('0x28')](_0x546e73)[_0xeecc('0x29')](_0x59dffe);}};}function respondWithFilteredResult(_0x5022c5,_0x2d7cbf){return function(_0x4fc840){if(_0x4fc840){var _0x30ab56=_0x4fc840[_0xeecc('0x2a')],_0x1a39bf=_0x2d7cbf[_0xeecc('0x2b')],_0x2b1a98=_0x2d7cbf[_0xeecc('0x2b')]+_0x2d7cbf['limit'],_0x4ab6b2;if(_0x2b1a98>=_0x30ab56){_0x2b1a98=_0x30ab56;_0x4ab6b2=0xc8;}else{_0x4ab6b2=0xce;}_0x5022c5[_0xeecc('0x28')](_0x4ab6b2);return _0x5022c5[_0xeecc('0x2c')](_0xeecc('0x2d'),_0x1a39bf+'-'+_0x2b1a98+'/'+_0x30ab56)['json'](_0x4fc840);}return null;};}function patchUpdates(_0x4d298d){return function(_0x109e1b){try{jsonpatch['apply'](_0x109e1b,_0x4d298d,!![]);}catch(_0x4e59a9){return BPromise[_0xeecc('0x2e')](_0x4e59a9);}return _0x109e1b[_0xeecc('0x2f')]();};}function saveUpdates(_0x438410,_0x423612){return function(_0x4419f8){if(_0x4419f8){return _0x4419f8[_0xeecc('0x30')](_0x438410)[_0xeecc('0x1e')](function(_0x52c9ba){return _0x52c9ba;});}return null;};}function removeEntity(_0x156674,_0xb6be6d){return function(_0x4ddb7a){if(_0x4ddb7a){return _0x4ddb7a[_0xeecc('0x31')]()['then'](function(){_0x156674['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3f9411,_0x1c532b){return function(_0x3a4242){if(!_0x3a4242){_0x3f9411[_0xeecc('0x27')](0x194);}return _0x3a4242;};}function handleError(_0x1cb84c,_0x10141a){_0x10141a=_0x10141a||0x1f4;return function(_0x18f7ca){logger['error'](_0x18f7ca['stack']);if(_0x18f7ca['name']){delete _0x18f7ca['name'];}_0x1cb84c[_0xeecc('0x28')](_0x10141a)['send'](_0x18f7ca);};}exports[_0xeecc('0x32')]=function(_0xf7d75b,_0x32975c){var _0x51763d={},_0x41442e={},_0x20c864={'count':0x0,'rows':[]};var _0xb5256c=_[_0xeecc('0x33')](db[_0xeecc('0x34')][_0xeecc('0x35')],function(_0xef95e7){return{'name':_0xef95e7[_0xeecc('0x36')],'type':_0xef95e7[_0xeecc('0x37')][_0xeecc('0x38')]};});_0x41442e[_0xeecc('0x39')]=_[_0xeecc('0x33')](_0xb5256c,_0xeecc('0x3a'));_0x41442e[_0xeecc('0x3b')]=_[_0xeecc('0x3c')](_0xf7d75b['query']);_0x41442e[_0xeecc('0x3d')]=_[_0xeecc('0x3e')](_0x41442e[_0xeecc('0x39')],_0x41442e[_0xeecc('0x3b')]);_0x51763d[_0xeecc('0x3f')]=_[_0xeecc('0x3e')](_0x41442e[_0xeecc('0x39')],qs[_0xeecc('0x40')](_0xf7d75b[_0xeecc('0x3b')]['fields']));_0x51763d[_0xeecc('0x3f')]=_0x51763d[_0xeecc('0x3f')][_0xeecc('0x41')]?_0x51763d['attributes']:_0x41442e['model'];if(!_0xf7d75b['query'][_0xeecc('0x42')](_0xeecc('0x43'))){_0x51763d['limit']=qs[_0xeecc('0x44')](_0xf7d75b['query'][_0xeecc('0x44')]);_0x51763d[_0xeecc('0x2b')]=qs[_0xeecc('0x2b')](_0xf7d75b['query'][_0xeecc('0x2b')]);}_0x51763d[_0xeecc('0x45')]=qs[_0xeecc('0x46')](_0xf7d75b['query'][_0xeecc('0x46')]);_0x51763d[_0xeecc('0x47')]=qs[_0xeecc('0x3d')](_['pick'](_0xf7d75b['query'],_0x41442e['filters']),_0xb5256c);if(_0xf7d75b[_0xeecc('0x3b')][_0xeecc('0x48')]){_0x51763d[_0xeecc('0x47')]=_[_0xeecc('0x49')](_0x51763d[_0xeecc('0x47')],{'$or':_[_0xeecc('0x33')](_0xb5256c,function(_0x35f2aa){if(_0x35f2aa[_0xeecc('0x37')]!==_0xeecc('0x4a')){var _0x50aaed={};_0x50aaed[_0x35f2aa['name']]={'$like':'%'+_0xf7d75b['query'][_0xeecc('0x48')]+'%'};return _0x50aaed;}})});}_0x51763d=_['merge']({},_0x51763d,_0xf7d75b[_0xeecc('0x4b')]);var _0x5d4745={'where':_0x51763d[_0xeecc('0x47')]};return db[_0xeecc('0x34')][_0xeecc('0x2a')](_0x5d4745)[_0xeecc('0x1e')](function(_0x5799e2){_0x20c864['count']=_0x5799e2;if(_0xf7d75b[_0xeecc('0x3b')][_0xeecc('0x4c')]){_0x51763d[_0xeecc('0x4d')]=[{'all':!![]}];}return db[_0xeecc('0x34')]['findAll'](_0x51763d);})[_0xeecc('0x1e')](function(_0x2dcdd5){_0x20c864[_0xeecc('0x4e')]=_0x2dcdd5;return _0x20c864;})['then'](respondWithFilteredResult(_0x32975c,_0x51763d))[_0xeecc('0x4f')](handleError(_0x32975c,null));};exports[_0xeecc('0x50')]=function(_0xf56207,_0x35d511){var _0x1732ec={'raw':![],'where':{'id':_0xf56207[_0xeecc('0x51')]['id']}},_0x220fb6={};_0x220fb6['model']=_['keys'](db['FreshsalesAccount'][_0xeecc('0x35')]);_0x220fb6[_0xeecc('0x3b')]=_[_0xeecc('0x3c')](_0xf56207[_0xeecc('0x3b')]);_0x220fb6['filters']=_[_0xeecc('0x3e')](_0x220fb6['model'],_0x220fb6[_0xeecc('0x3b')]);_0x1732ec['attributes']=_['intersection'](_0x220fb6[_0xeecc('0x39')],qs['fields'](_0xf56207['query'][_0xeecc('0x40')]));_0x1732ec['attributes']=_0x1732ec[_0xeecc('0x3f')][_0xeecc('0x41')]?_0x1732ec['attributes']:_0x220fb6[_0xeecc('0x39')];if(_0xf56207[_0xeecc('0x3b')][_0xeecc('0x4c')]){_0x1732ec[_0xeecc('0x4d')]=[{'all':!![]}];}_0x1732ec=_[_0xeecc('0x49')]({},_0x1732ec,_0xf56207[_0xeecc('0x4b')]);return db[_0xeecc('0x34')]['find'](_0x1732ec)['then'](handleEntityNotFound(_0x35d511,null))[_0xeecc('0x1e')](respondWithResult(_0x35d511,null))['catch'](handleError(_0x35d511,null));};exports[_0xeecc('0x52')]=function(_0x441d20,_0x3f408b){return db[_0xeecc('0x34')][_0xeecc('0x52')](_0x441d20[_0xeecc('0x53')],{})[_0xeecc('0x1e')](respondWithResult(_0x3f408b,0xc9))[_0xeecc('0x4f')](handleError(_0x3f408b,null));};exports[_0xeecc('0x30')]=function(_0x15578d,_0x38694f){if(_0x15578d['body']['id']){delete _0x15578d[_0xeecc('0x53')]['id'];}return db['FreshsalesAccount'][_0xeecc('0x54')]({'where':{'id':_0x15578d[_0xeecc('0x51')]['id']}})[_0xeecc('0x1e')](handleEntityNotFound(_0x38694f,null))[_0xeecc('0x1e')](saveUpdates(_0x15578d[_0xeecc('0x53')],null))['then'](respondWithResult(_0x38694f,null))[_0xeecc('0x4f')](handleError(_0x38694f,null));};exports[_0xeecc('0x31')]=function(_0x292c0e,_0x372805){return db['FreshsalesAccount'][_0xeecc('0x54')]({'where':{'id':_0x292c0e['params']['id']}})['then'](handleEntityNotFound(_0x372805,null))['then'](removeEntity(_0x372805,null))[_0xeecc('0x4f')](handleError(_0x372805,null));};exports[_0xeecc('0x55')]=function(_0x1bfde0,_0x3c1229,_0x4a0f55){var _0x43fd1c={};var _0x4448e8={};var _0x3d2323;var _0xb644ad;return db[_0xeecc('0x34')][_0xeecc('0x56')]({'where':{'id':_0x1bfde0[_0xeecc('0x51')]['id']}})[_0xeecc('0x1e')](handleEntityNotFound(_0x3c1229,null))['then'](function(_0x3ad2f1){if(_0x3ad2f1){_0x3d2323=_0x3ad2f1;_0x4448e8[_0xeecc('0x39')]=_['keys'](db[_0xeecc('0x57')]['rawAttributes']);_0x4448e8[_0xeecc('0x3b')]=_['keys'](_0x1bfde0[_0xeecc('0x3b')]);_0x4448e8[_0xeecc('0x3d')]=_[_0xeecc('0x3e')](_0x4448e8[_0xeecc('0x39')],_0x4448e8[_0xeecc('0x3b')]);_0x43fd1c[_0xeecc('0x3f')]=_[_0xeecc('0x3e')](_0x4448e8['model'],qs['fields'](_0x1bfde0['query'][_0xeecc('0x40')]));_0x43fd1c[_0xeecc('0x3f')]=_0x43fd1c['attributes'][_0xeecc('0x41')]?_0x43fd1c['attributes']:_0x4448e8[_0xeecc('0x39')];_0x43fd1c['order']=qs['sort'](_0x1bfde0[_0xeecc('0x3b')][_0xeecc('0x46')]);_0x43fd1c[_0xeecc('0x47')]=qs[_0xeecc('0x3d')](_[_0xeecc('0x58')](_0x1bfde0[_0xeecc('0x3b')],_0x4448e8[_0xeecc('0x3d')]));if(_0x1bfde0[_0xeecc('0x3b')][_0xeecc('0x48')]){_0x43fd1c[_0xeecc('0x47')]=_[_0xeecc('0x49')](_0x43fd1c[_0xeecc('0x47')],{'$or':_['map'](_0x43fd1c[_0xeecc('0x3f')],function(_0x5fb6d8){var _0x2ba752={};_0x2ba752[_0x5fb6d8]={'$like':'%'+_0x1bfde0[_0xeecc('0x3b')][_0xeecc('0x48')]+'%'};return _0x2ba752;})});}_0x43fd1c=_[_0xeecc('0x49')]({},_0x43fd1c,_0x1bfde0[_0xeecc('0x4b')]);return _0x3d2323[_0xeecc('0x55')](_0x43fd1c);}})['then'](function(_0xef047){if(_0xef047){_0xb644ad=_0xef047[_0xeecc('0x41')];if(!_0x1bfde0[_0xeecc('0x3b')]['hasOwnProperty'](_0xeecc('0x43'))){_0x43fd1c['limit']=qs['limit'](_0x1bfde0[_0xeecc('0x3b')][_0xeecc('0x44')]);_0x43fd1c[_0xeecc('0x2b')]=qs[_0xeecc('0x2b')](_0x1bfde0[_0xeecc('0x3b')][_0xeecc('0x2b')]);}return _0x3d2323[_0xeecc('0x55')](_0x43fd1c);}})['then'](function(_0xda6f25){if(_0xda6f25){return _0xda6f25?{'count':_0xb644ad,'rows':_0xda6f25}:null;}})[_0xeecc('0x1e')](respondWithResult(_0x3c1229,null))[_0xeecc('0x4f')](handleError(_0x3c1229,null));};exports[_0xeecc('0x59')]=function(_0x3cb5ba,_0x4d8545,_0x21eb2e){if(_0x3cb5ba[_0xeecc('0x53')]['id']){delete _0x3cb5ba['body']['id'];}return db[_0xeecc('0x34')]['findOne']({'where':{'id':_0x3cb5ba[_0xeecc('0x51')]['id']}})['then'](handleEntityNotFound(_0x4d8545,null))[_0xeecc('0x1e')](function(_0x2f93c9){if(_0x2f93c9){_0x3cb5ba[_0xeecc('0x53')][_0xeecc('0x5a')]=_0x2f93c9['id'];_0x3cb5ba['body']['Subjects']=integrations[_0xeecc('0x5b')](_0x3cb5ba[_0xeecc('0x53')][_0xeecc('0x5c')],_0x3cb5ba['body']['type']);_0x3cb5ba[_0xeecc('0x53')]['Descriptions']=integrations[_0xeecc('0x5d')](_0x3cb5ba[_0xeecc('0x53')][_0xeecc('0x5c')],_0x3cb5ba[_0xeecc('0x53')]['type']);return db[_0xeecc('0x57')][_0xeecc('0x52')](_0x3cb5ba[_0xeecc('0x53')],{'include':[{'model':db[_0xeecc('0x5e')],'as':_0xeecc('0x5f')},{'model':db['FreshsalesField'],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x4d8545,null))[_0xeecc('0x4f')](handleError(_0x4d8545,null));};exports[_0xeecc('0x60')]=function(_0x5716c9,_0x271eea,_0x5a2e81){var _0x33e7eb='';var _0x3bb5da='';return db['FreshsalesAccount'][_0xeecc('0x56')]({'where':{'id':_0x5716c9[_0xeecc('0x51')]['id']},'attributes':['id','username','remoteUri',_0xeecc('0x61')]})[_0xeecc('0x1e')](handleEntityNotFound(_0x271eea,null))['then'](function(_0x3c8ace){if(_0x3c8ace){_0x3bb5da=_0x3c8ace[_0xeecc('0x62')];_0x33e7eb=_0x3c8ace['remoteUri'];var _0x3c7d7a=_0x3c8ace[_0xeecc('0x63')][_0xeecc('0x64')](-0x1);if(_0x3c7d7a==='/'){_0x33e7eb=_0x33e7eb[_0xeecc('0x65')](0x0,_0x33e7eb[_0xeecc('0x66')](_0x3c7d7a));}return rp({'method':'GET','uri':util[_0xeecc('0x67')]('%s%s',_0x33e7eb,_0xeecc('0x68')),'headers':{'Authorization':_0xeecc('0x69')+_0x3c8ace[_0xeecc('0x61')]},'json':!![]});}})[_0xeecc('0x1e')](function(_0xaab06){if(_0xaab06){var _0x750718=_0xaab06[_0xeecc('0x6a')];var _0x513ed2=![];var _0x52f171=null;for(_0x52f171=0x0;_0x52f171<_0x750718[_0xeecc('0x41')];_0x52f171++){if(_0x750718[_0x52f171][_0xeecc('0x6b')]===_0x3bb5da){_0x513ed2=!![];}}if(_0x513ed2){return!![];}else{throw new Error({'statusCode':0x194,'message':_0xeecc('0x6c')});}}})[_0xeecc('0x1e')](respondWithResult(_0x271eea,null))[_0xeecc('0x4f')](function(_0x1d3dbf){var _0x1ea5a3=_0x5716c9[_0xeecc('0x3b')][_0xeecc('0x1a')]?0x1f4:_0x1d3dbf[_0xeecc('0x6d')]||0x1f4;logger[_0xeecc('0x23')]('getFields,\x20%s,\x20%s,\x20%s',_0xeecc('0x60'),_0x1ea5a3,JSON[_0xeecc('0x6e')](_0x1d3dbf));delete _0x1d3dbf[_0xeecc('0x3a')];if(_0x1ea5a3===0x191){_0x1ea5a3=0x190;}_0x271eea[_0xeecc('0x28')](_0x1ea5a3)[_0xeecc('0x6f')](_0x5716c9[_0xeecc('0x3b')][_0xeecc('0x1a')]?{'message':_0xeecc('0x70'),'statusCode':_0x1d3dbf[_0xeecc('0x6d')]}:_0x1d3dbf);});}; \ No newline at end of file +var _0xcaa4=['result','catch','status','end','count','offset','limit','Content-Range','json','apply','reject','save','update','destroy','sendStatus','stack','name','send','map','FreshsalesAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','where','pick','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','options','find','create','body','getConfigurations','findOne','FreshsalesConfiguration','sort','filter','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshsalesField','username','remoteUri','lastIndexOf','GET','/api/selector/owners','Token\x20token=','apiKey','users','email','Requested\x20Resource\x20not\x20Found','statusCode','getFields','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','client','http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','FreshsalesAccount,\x20%s,\x20%s','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x179477,_0x88be93){var _0x5d765c=function(_0x45de6f){while(--_0x45de6f){_0x179477['push'](_0x179477['shift']());}};_0x5d765c(++_0x88be93);}(_0xcaa4,0x133));var _0x4caa=function(_0x125b62,_0x34e995){_0x125b62=_0x125b62-0x0;var _0x5ab790=_0xcaa4[_0x125b62];return _0x5ab790;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x4caa('0x0'));var rimraf=require(_0x4caa('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4caa('0x2'));var rp=require(_0x4caa('0x3'));var moment=require(_0x4caa('0x4'));var BPromise=require(_0x4caa('0x5'));var Mustache=require(_0x4caa('0x6'));var util=require(_0x4caa('0x7'));var path=require(_0x4caa('0x8'));var sox=require(_0x4caa('0x9'));var csv=require(_0x4caa('0xa'));var ejs=require(_0x4caa('0xb'));var fs=require('fs');var _=require(_0x4caa('0xc'));var squel=require(_0x4caa('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4caa('0xe'));var toCsv=require(_0x4caa('0xa'));var querystring=require(_0x4caa('0xf'));var Papa=require(_0x4caa('0x10'));var Redis=require(_0x4caa('0x11'));var authService=require(_0x4caa('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x4caa('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4caa('0x14'))(_0x4caa('0x15'));var utils=require(_0x4caa('0x16'));var config=require(_0x4caa('0x17'));var db=require(_0x4caa('0x18'))['db'];var integrations=require(_0x4caa('0x19'));var jayson=require('jayson/promise');var client=jayson[_0x4caa('0x1a')][_0x4caa('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x205023,_0x40bed0,_0x3c3cef){if(_0x3c3cef){var _0x1a00d1=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1a00d1[_0x4caa('0x1c')](_0x40bed0)){return _0x205023;}else{throw new db['Sequelize'][(_0x4caa('0x1d'))](_0x4caa('0x1e'));}}else{return _0x205023;}}function respondWithRpcPromise(_0xd6b4b9,_0x4b554f,_0x414541,_0x4a1977){return new BPromise(function(_0x5256dc,_0x2dfddd){var _0x2588d0=_0x4a1977||client;return _0x2588d0['request'](_0xd6b4b9,_0x414541)[_0x4caa('0x1f')](function(_0x34e70a){logger[_0x4caa('0x20')](_0x4caa('0x21'),_0x4b554f,'request\x20sent');logger[_0x4caa('0x22')](_0x4caa('0x23'),_0x4b554f,_0x4caa('0x24'),JSON[_0x4caa('0x25')](_0x34e70a));if(_0x34e70a[_0x4caa('0x26')]){if(_0x34e70a[_0x4caa('0x26')][_0x4caa('0x27')]===0x1f4){logger[_0x4caa('0x26')](_0x4caa('0x21'),_0x4b554f,_0x34e70a[_0x4caa('0x26')][_0x4caa('0x28')]);return _0x2dfddd(_0x34e70a['error'][_0x4caa('0x28')]);}logger['error'](_0x4caa('0x21'),_0x4b554f,_0x34e70a[_0x4caa('0x26')][_0x4caa('0x28')]);return _0x5256dc(_0x34e70a[_0x4caa('0x26')][_0x4caa('0x28')]);}else{logger[_0x4caa('0x20')](_0x4caa('0x21'),_0x4b554f,'request\x20sent');_0x5256dc(_0x34e70a[_0x4caa('0x29')][_0x4caa('0x28')]);}})[_0x4caa('0x2a')](function(_0x46f395){logger[_0x4caa('0x26')](_0x4caa('0x21'),_0x4b554f,_0x46f395);_0x2dfddd(_0x46f395);});});}function respondWithStatusCode(_0x53eeb5,_0x30a7d9){_0x30a7d9=_0x30a7d9||0xcc;return function(_0x2827e7){if(_0x2827e7){return _0x53eeb5['sendStatus'](_0x30a7d9);}return _0x53eeb5[_0x4caa('0x2b')](_0x30a7d9)[_0x4caa('0x2c')]();};}function respondWithResult(_0x21fd8c,_0x5c7b5e){_0x5c7b5e=_0x5c7b5e||0xc8;return function(_0x56c4e9){if(_0x56c4e9){return _0x21fd8c[_0x4caa('0x2b')](_0x5c7b5e)['json'](_0x56c4e9);}};}function respondWithFilteredResult(_0xe6c68c,_0x1b7ab4){return function(_0x507017){if(_0x507017){var _0x20ae70=_0x507017[_0x4caa('0x2d')],_0x32824=_0x1b7ab4[_0x4caa('0x2e')],_0x500b56=_0x1b7ab4[_0x4caa('0x2e')]+_0x1b7ab4[_0x4caa('0x2f')],_0x42356f;if(_0x500b56>=_0x20ae70){_0x500b56=_0x20ae70;_0x42356f=0xc8;}else{_0x42356f=0xce;}_0xe6c68c[_0x4caa('0x2b')](_0x42356f);return _0xe6c68c['set'](_0x4caa('0x30'),_0x32824+'-'+_0x500b56+'/'+_0x20ae70)[_0x4caa('0x31')](_0x507017);}return null;};}function patchUpdates(_0x2d630d){return function(_0x2fed3e){try{jsonpatch[_0x4caa('0x32')](_0x2fed3e,_0x2d630d,!![]);}catch(_0x273335){return BPromise[_0x4caa('0x33')](_0x273335);}return _0x2fed3e[_0x4caa('0x34')]();};}function saveUpdates(_0x56a68b,_0x4d3b05){return function(_0x1a898f){if(_0x1a898f){return _0x1a898f[_0x4caa('0x35')](_0x56a68b)['then'](function(_0x5db94e){return _0x5db94e;});}return null;};}function removeEntity(_0x219012,_0x4d3c88){return function(_0x2ea1ef){if(_0x2ea1ef){return _0x2ea1ef[_0x4caa('0x36')]()[_0x4caa('0x1f')](function(){_0x219012['status'](0xcc)[_0x4caa('0x2c')]();});}};}function handleEntityNotFound(_0x4d8f90,_0x14f814){return function(_0x53ac66){if(!_0x53ac66){_0x4d8f90[_0x4caa('0x37')](0x194);}return _0x53ac66;};}function handleError(_0x214694,_0x4736f5){_0x4736f5=_0x4736f5||0x1f4;return function(_0x183c4f){logger[_0x4caa('0x26')](_0x183c4f[_0x4caa('0x38')]);if(_0x183c4f[_0x4caa('0x39')]){delete _0x183c4f[_0x4caa('0x39')];}_0x214694['status'](_0x4736f5)[_0x4caa('0x3a')](_0x183c4f);};}exports['index']=function(_0x5964ce,_0x3f07f7){var _0x4c2300={},_0x3c1369={},_0x495cf5={'count':0x0,'rows':[]};var _0x47e14f=_[_0x4caa('0x3b')](db[_0x4caa('0x3c')][_0x4caa('0x3d')],function(_0x338f7e){return{'name':_0x338f7e[_0x4caa('0x3e')],'type':_0x338f7e[_0x4caa('0x3f')][_0x4caa('0x40')]};});_0x3c1369[_0x4caa('0x41')]=_[_0x4caa('0x3b')](_0x47e14f,'name');_0x3c1369[_0x4caa('0x42')]=_[_0x4caa('0x43')](_0x5964ce[_0x4caa('0x42')]);_0x3c1369[_0x4caa('0x44')]=_[_0x4caa('0x45')](_0x3c1369[_0x4caa('0x41')],_0x3c1369[_0x4caa('0x42')]);_0x4c2300[_0x4caa('0x46')]=_[_0x4caa('0x45')](_0x3c1369['model'],qs[_0x4caa('0x47')](_0x5964ce['query'][_0x4caa('0x47')]));_0x4c2300[_0x4caa('0x46')]=_0x4c2300[_0x4caa('0x46')][_0x4caa('0x48')]?_0x4c2300[_0x4caa('0x46')]:_0x3c1369[_0x4caa('0x41')];if(!_0x5964ce[_0x4caa('0x42')][_0x4caa('0x49')]('nolimit')){_0x4c2300[_0x4caa('0x2f')]=qs['limit'](_0x5964ce[_0x4caa('0x42')][_0x4caa('0x2f')]);_0x4c2300[_0x4caa('0x2e')]=qs[_0x4caa('0x2e')](_0x5964ce[_0x4caa('0x42')][_0x4caa('0x2e')]);}_0x4c2300[_0x4caa('0x4a')]=qs['sort'](_0x5964ce[_0x4caa('0x42')]['sort']);_0x4c2300[_0x4caa('0x4b')]=qs[_0x4caa('0x44')](_[_0x4caa('0x4c')](_0x5964ce[_0x4caa('0x42')],_0x3c1369[_0x4caa('0x44')]),_0x47e14f);if(_0x5964ce['query']['filter']){_0x4c2300[_0x4caa('0x4b')]=_[_0x4caa('0x4d')](_0x4c2300[_0x4caa('0x4b')],{'$or':_[_0x4caa('0x3b')](_0x47e14f,function(_0x2c7df8){if(_0x2c7df8['type']!==_0x4caa('0x4e')){var _0x4b60f9={};_0x4b60f9[_0x2c7df8[_0x4caa('0x39')]]={'$like':'%'+_0x5964ce['query']['filter']+'%'};return _0x4b60f9;}})});}_0x4c2300=_[_0x4caa('0x4d')]({},_0x4c2300,_0x5964ce['options']);var _0x4bca2b={'where':_0x4c2300[_0x4caa('0x4b')]};return db[_0x4caa('0x3c')][_0x4caa('0x2d')](_0x4bca2b)[_0x4caa('0x1f')](function(_0x1e4779){_0x495cf5[_0x4caa('0x2d')]=_0x1e4779;if(_0x5964ce[_0x4caa('0x42')][_0x4caa('0x4f')]){_0x4c2300[_0x4caa('0x50')]=[{'all':!![]}];}return db[_0x4caa('0x3c')][_0x4caa('0x51')](_0x4c2300);})[_0x4caa('0x1f')](function(_0xe94670){_0x495cf5[_0x4caa('0x52')]=_0xe94670;return _0x495cf5;})[_0x4caa('0x1f')](respondWithFilteredResult(_0x3f07f7,_0x4c2300))[_0x4caa('0x2a')](handleError(_0x3f07f7,null));};exports[_0x4caa('0x53')]=function(_0x5c3bd2,_0x1f902f){var _0x3fa9a1={'raw':![],'where':{'id':_0x5c3bd2[_0x4caa('0x54')]['id']}},_0x3dafc9={};_0x3dafc9['model']=_[_0x4caa('0x43')](db[_0x4caa('0x3c')][_0x4caa('0x3d')]);_0x3dafc9['query']=_[_0x4caa('0x43')](_0x5c3bd2[_0x4caa('0x42')]);_0x3dafc9[_0x4caa('0x44')]=_[_0x4caa('0x45')](_0x3dafc9['model'],_0x3dafc9['query']);_0x3fa9a1['attributes']=_[_0x4caa('0x45')](_0x3dafc9[_0x4caa('0x41')],qs[_0x4caa('0x47')](_0x5c3bd2[_0x4caa('0x42')]['fields']));_0x3fa9a1[_0x4caa('0x46')]=_0x3fa9a1[_0x4caa('0x46')][_0x4caa('0x48')]?_0x3fa9a1['attributes']:_0x3dafc9[_0x4caa('0x41')];if(_0x5c3bd2[_0x4caa('0x42')][_0x4caa('0x4f')]){_0x3fa9a1[_0x4caa('0x50')]=[{'all':!![]}];}_0x3fa9a1=_[_0x4caa('0x4d')]({},_0x3fa9a1,_0x5c3bd2[_0x4caa('0x55')]);return db[_0x4caa('0x3c')][_0x4caa('0x56')](_0x3fa9a1)[_0x4caa('0x1f')](handleEntityNotFound(_0x1f902f,null))[_0x4caa('0x1f')](respondWithResult(_0x1f902f,null))[_0x4caa('0x2a')](handleError(_0x1f902f,null));};exports['create']=function(_0x529f1e,_0x5d9511){return db[_0x4caa('0x3c')][_0x4caa('0x57')](_0x529f1e[_0x4caa('0x58')],{})[_0x4caa('0x1f')](respondWithResult(_0x5d9511,0xc9))['catch'](handleError(_0x5d9511,null));};exports[_0x4caa('0x35')]=function(_0x204a4b,_0x27ce56){if(_0x204a4b[_0x4caa('0x58')]['id']){delete _0x204a4b[_0x4caa('0x58')]['id'];}return db['FreshsalesAccount'][_0x4caa('0x56')]({'where':{'id':_0x204a4b[_0x4caa('0x54')]['id']}})[_0x4caa('0x1f')](handleEntityNotFound(_0x27ce56,null))['then'](saveUpdates(_0x204a4b[_0x4caa('0x58')],null))['then'](respondWithResult(_0x27ce56,null))['catch'](handleError(_0x27ce56,null));};exports['destroy']=function(_0x246728,_0x1cfab8){return db[_0x4caa('0x3c')]['find']({'where':{'id':_0x246728['params']['id']}})[_0x4caa('0x1f')](handleEntityNotFound(_0x1cfab8,null))[_0x4caa('0x1f')](removeEntity(_0x1cfab8,null))[_0x4caa('0x2a')](handleError(_0x1cfab8,null));};exports[_0x4caa('0x59')]=function(_0x29dbf2,_0x11f4c9,_0x53fe50){var _0x4f9f30={};var _0x2492ca={};var _0x26dc59;var _0x53c13d;return db[_0x4caa('0x3c')][_0x4caa('0x5a')]({'where':{'id':_0x29dbf2[_0x4caa('0x54')]['id']}})[_0x4caa('0x1f')](handleEntityNotFound(_0x11f4c9,null))['then'](function(_0x21250b){if(_0x21250b){_0x26dc59=_0x21250b;_0x2492ca[_0x4caa('0x41')]=_[_0x4caa('0x43')](db[_0x4caa('0x5b')][_0x4caa('0x3d')]);_0x2492ca[_0x4caa('0x42')]=_[_0x4caa('0x43')](_0x29dbf2[_0x4caa('0x42')]);_0x2492ca['filters']=_[_0x4caa('0x45')](_0x2492ca['model'],_0x2492ca['query']);_0x4f9f30[_0x4caa('0x46')]=_[_0x4caa('0x45')](_0x2492ca[_0x4caa('0x41')],qs['fields'](_0x29dbf2['query']['fields']));_0x4f9f30['attributes']=_0x4f9f30[_0x4caa('0x46')][_0x4caa('0x48')]?_0x4f9f30[_0x4caa('0x46')]:_0x2492ca['model'];_0x4f9f30['order']=qs[_0x4caa('0x5c')](_0x29dbf2['query'][_0x4caa('0x5c')]);_0x4f9f30[_0x4caa('0x4b')]=qs[_0x4caa('0x44')](_[_0x4caa('0x4c')](_0x29dbf2[_0x4caa('0x42')],_0x2492ca['filters']));if(_0x29dbf2[_0x4caa('0x42')][_0x4caa('0x5d')]){_0x4f9f30['where']=_[_0x4caa('0x4d')](_0x4f9f30[_0x4caa('0x4b')],{'$or':_[_0x4caa('0x3b')](_0x4f9f30[_0x4caa('0x46')],function(_0x1414c5){var _0x1d50dc={};_0x1d50dc[_0x1414c5]={'$like':'%'+_0x29dbf2[_0x4caa('0x42')][_0x4caa('0x5d')]+'%'};return _0x1d50dc;})});}_0x4f9f30=_[_0x4caa('0x4d')]({},_0x4f9f30,_0x29dbf2[_0x4caa('0x55')]);return _0x26dc59[_0x4caa('0x59')](_0x4f9f30);}})[_0x4caa('0x1f')](function(_0x758ed5){if(_0x758ed5){_0x53c13d=_0x758ed5[_0x4caa('0x48')];if(!_0x29dbf2[_0x4caa('0x42')]['hasOwnProperty'](_0x4caa('0x5e'))){_0x4f9f30[_0x4caa('0x2f')]=qs[_0x4caa('0x2f')](_0x29dbf2['query'][_0x4caa('0x2f')]);_0x4f9f30[_0x4caa('0x2e')]=qs[_0x4caa('0x2e')](_0x29dbf2['query'][_0x4caa('0x2e')]);}return _0x26dc59['getConfigurations'](_0x4f9f30);}})[_0x4caa('0x1f')](function(_0x2bc9f7){if(_0x2bc9f7){return _0x2bc9f7?{'count':_0x53c13d,'rows':_0x2bc9f7}:null;}})[_0x4caa('0x1f')](respondWithResult(_0x11f4c9,null))[_0x4caa('0x2a')](handleError(_0x11f4c9,null));};exports[_0x4caa('0x5f')]=function(_0x1aa8c4,_0x960d3d,_0x1a2683){if(_0x1aa8c4[_0x4caa('0x58')]['id']){delete _0x1aa8c4['body']['id'];}return db[_0x4caa('0x3c')][_0x4caa('0x5a')]({'where':{'id':_0x1aa8c4['params']['id']}})[_0x4caa('0x1f')](handleEntityNotFound(_0x960d3d,null))['then'](function(_0x545383){if(_0x545383){_0x1aa8c4[_0x4caa('0x58')][_0x4caa('0x60')]=_0x545383['id'];_0x1aa8c4[_0x4caa('0x58')][_0x4caa('0x61')]=integrations[_0x4caa('0x62')](_0x1aa8c4[_0x4caa('0x58')][_0x4caa('0x63')],_0x1aa8c4[_0x4caa('0x58')]['type']);_0x1aa8c4[_0x4caa('0x58')][_0x4caa('0x64')]=integrations[_0x4caa('0x65')](_0x1aa8c4['body']['channel'],_0x1aa8c4[_0x4caa('0x58')]['type']);return db[_0x4caa('0x5b')][_0x4caa('0x57')](_0x1aa8c4[_0x4caa('0x58')],{'include':[{'model':db[_0x4caa('0x66')],'as':_0x4caa('0x61')},{'model':db[_0x4caa('0x66')],'as':_0x4caa('0x64')}]});}return null;})[_0x4caa('0x1f')](respondWithResult(_0x960d3d,null))['catch'](handleError(_0x960d3d,null));};exports['getFields']=function(_0x53f68f,_0x38c44b,_0xfe158d){var _0x3049a9='';var _0xd251af='';return db[_0x4caa('0x3c')][_0x4caa('0x5a')]({'where':{'id':_0x53f68f[_0x4caa('0x54')]['id']},'attributes':['id',_0x4caa('0x67'),_0x4caa('0x68'),'apiKey']})[_0x4caa('0x1f')](handleEntityNotFound(_0x38c44b,null))['then'](function(_0x42c436){if(_0x42c436){_0xd251af=_0x42c436['username'];_0x3049a9=_0x42c436[_0x4caa('0x68')];var _0xe05ebf=_0x42c436[_0x4caa('0x68')]['slice'](-0x1);if(_0xe05ebf==='/'){_0x3049a9=_0x3049a9['substring'](0x0,_0x3049a9[_0x4caa('0x69')](_0xe05ebf));}return rp({'method':_0x4caa('0x6a'),'uri':util['format']('%s%s',_0x3049a9,_0x4caa('0x6b')),'headers':{'Authorization':_0x4caa('0x6c')+_0x42c436[_0x4caa('0x6d')]},'json':!![]});}})[_0x4caa('0x1f')](function(_0x310876){if(_0x310876){var _0x29205f=_0x310876[_0x4caa('0x6e')];var _0xa590e7=![];var _0x36a392=null;for(_0x36a392=0x0;_0x36a392<_0x29205f['length'];_0x36a392++){if(_0x29205f[_0x36a392][_0x4caa('0x6f')]===_0xd251af){_0xa590e7=!![];}}if(_0xa590e7){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x4caa('0x70')});}}})[_0x4caa('0x1f')](respondWithResult(_0x38c44b,null))[_0x4caa('0x2a')](function(_0xba5c98){var _0xca676=_0x53f68f[_0x4caa('0x42')][_0x4caa('0x1c')]?0x1f4:_0xba5c98[_0x4caa('0x71')]||0x1f4;logger[_0x4caa('0x26')]('getFields,\x20%s,\x20%s,\x20%s',_0x4caa('0x72'),_0xca676,JSON['stringify'](_0xba5c98));delete _0xba5c98[_0x4caa('0x39')];if(_0xca676===0x191){_0xca676=0x190;}_0x38c44b['status'](_0xca676)[_0x4caa('0x3a')](_0x53f68f['query']['test']?{'message':_0x4caa('0x73'),'statusCode':_0xba5c98[_0x4caa('0x71')]}:_0xba5c98);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 4b58a23..3818a39 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 _0x2895=['../../config/logger','moment','bluebird','request-promise','path','../../config/environment','../../components/integrations/configuration','exports','define','FreshsalesAccount','lodash','util'];(function(_0x18468f,_0x28573a){var _0x3c19a0=function(_0x2d7687){while(--_0x2d7687){_0x18468f['push'](_0x18468f['shift']());}};_0x3c19a0(++_0x28573a);}(_0x2895,0x82));var _0x5289=function(_0xd83f67,_0xbb3470){_0xd83f67=_0xd83f67-0x0;var _0x2242f1=_0x2895[_0xd83f67];return _0x2242f1;};'use strict';var _=require(_0x5289('0x0'));var util=require(_0x5289('0x1'));var logger=require(_0x5289('0x2'))('api');var moment=require(_0x5289('0x3'));var BPromise=require(_0x5289('0x4'));var rp=require(_0x5289('0x5'));var fs=require('fs');var path=require(_0x5289('0x6'));var rimraf=require('rimraf');var config=require(_0x5289('0x7'));var attributes=require('./intFreshsalesAccount.attributes');var integrations=require(_0x5289('0x8'));module[_0x5289('0x9')]=function(_0x172b41,_0x38bcf2){return _0x172b41[_0x5289('0xa')](_0x5289('0xb'),attributes,{'tableName':'int_freshsales_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf5c0=['int_freshsales_accounts','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./intFreshsalesAccount.attributes','exports','define','FreshsalesAccount'];(function(_0x35b18a,_0x6b2fbe){var _0x4db1bd=function(_0x389e62){while(--_0x389e62){_0x35b18a['push'](_0x35b18a['shift']());}};_0x4db1bd(++_0x6b2fbe);}(_0xf5c0,0x9d));var _0x0f5c=function(_0x184e92,_0x25c2c5){_0x184e92=_0x184e92-0x0;var _0x26151a=_0xf5c0[_0x184e92];return _0x26151a;};'use strict';var _=require(_0x0f5c('0x0'));var util=require(_0x0f5c('0x1'));var logger=require(_0x0f5c('0x2'))(_0x0f5c('0x3'));var moment=require(_0x0f5c('0x4'));var BPromise=require(_0x0f5c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0f5c('0x6'));var rimraf=require('rimraf');var config=require(_0x0f5c('0x7'));var attributes=require(_0x0f5c('0x8'));var integrations=require('../../components/integrations/configuration');module[_0x0f5c('0x9')]=function(_0x3c6d89,_0x497d6b){return _0x3c6d89[_0x0f5c('0xa')](_0x0f5c('0xb'),attributes,{'tableName':_0x0f5c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js index bfca852..3e979af 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 _0x0c19=['message','request\x20sent','catch','GetFreshsalesAccount','FreshsalesAccount','options','raw','where','map','attributes','include','model','ShowFreshsalesAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','FreshsalesAccount,\x20%s,\x20%s','debug','stringify','error','code'];(function(_0x23d4bb,_0x5e5301){var _0x5758b1=function(_0x403bef){while(--_0x403bef){_0x23d4bb['push'](_0x23d4bb['shift']());}};_0x5758b1(++_0x5e5301);}(_0x0c19,0xf5));var _0x90c1=function(_0x43cb30,_0x20b884){_0x43cb30=_0x43cb30-0x0;var _0x4dbf55=_0x0c19[_0x43cb30];return _0x4dbf55;};'use strict';var _=require(_0x90c1('0x0'));var util=require(_0x90c1('0x1'));var moment=require(_0x90c1('0x2'));var BPromise=require(_0x90c1('0x3'));var rs=require(_0x90c1('0x4'));var fs=require('fs');var Redis=require(_0x90c1('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x90c1('0x6'));var logger=require(_0x90c1('0x7'))(_0x90c1('0x8'));var config=require('../../config/environment');var jayson=require(_0x90c1('0x9'));var client=jayson[_0x90c1('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x440f7a,_0x954ac4,_0x37d247){return new BPromise(function(_0x2ed328,_0x351d07){return client[_0x90c1('0xb')](_0x440f7a,_0x37d247)[_0x90c1('0xc')](function(_0x4895b5){logger[_0x90c1('0xd')](_0x90c1('0xe'),_0x954ac4,'request\x20sent');logger[_0x90c1('0xf')]('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x954ac4,'request\x20sent',JSON[_0x90c1('0x10')](_0x4895b5));if(_0x4895b5['error']){if(_0x4895b5[_0x90c1('0x11')][_0x90c1('0x12')]===0x1f4){logger[_0x90c1('0x11')](_0x90c1('0xe'),_0x954ac4,_0x4895b5['error']['message']);return _0x351d07(_0x4895b5[_0x90c1('0x11')][_0x90c1('0x13')]);}logger[_0x90c1('0x11')](_0x90c1('0xe'),_0x954ac4,_0x4895b5['error'][_0x90c1('0x13')]);return _0x2ed328(_0x4895b5[_0x90c1('0x11')][_0x90c1('0x13')]);}else{logger[_0x90c1('0xd')](_0x90c1('0xe'),_0x954ac4,_0x90c1('0x14'));_0x2ed328(_0x4895b5['result'][_0x90c1('0x13')]);}})[_0x90c1('0x15')](function(_0x45a64c){logger[_0x90c1('0x11')](_0x90c1('0xe'),_0x954ac4,_0x45a64c);_0x351d07(_0x45a64c);});});}exports[_0x90c1('0x16')]=function(_0x3b6671){var _0x2960f2=this;return new Promise(function(_0x372949,_0x112aa4){return db[_0x90c1('0x17')]['findAll']({'raw':_0x3b6671[_0x90c1('0x18')]?_0x3b6671[_0x90c1('0x18')][_0x90c1('0x19')]===undefined?!![]:![]:!![],'where':_0x3b6671[_0x90c1('0x18')]?_0x3b6671[_0x90c1('0x18')][_0x90c1('0x1a')]||null:null,'attributes':_0x3b6671['options']?_0x3b6671[_0x90c1('0x18')]['attributes']||null:null,'limit':_0x3b6671[_0x90c1('0x18')]?_0x3b6671['options']['limit']||null:null,'include':_0x3b6671[_0x90c1('0x18')]?_0x3b6671['options']['include']?_[_0x90c1('0x1b')](_0x3b6671['options']['include'],function(_0x36fe37){return{'model':db[_0x36fe37['model']],'as':_0x36fe37['as'],'attributes':_0x36fe37[_0x90c1('0x1c')],'include':_0x36fe37['include']?_[_0x90c1('0x1b')](_0x36fe37[_0x90c1('0x1d')],function(_0x309f83){return{'model':db[_0x309f83[_0x90c1('0x1e')]],'as':_0x309f83['as'],'attributes':_0x309f83[_0x90c1('0x1c')],'include':_0x309f83[_0x90c1('0x1d')]?_[_0x90c1('0x1b')](_0x309f83['include'],function(_0x26ee39){return{'model':db[_0x26ee39[_0x90c1('0x1e')]],'as':_0x26ee39['as'],'attributes':_0x26ee39[_0x90c1('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x90c1('0xc')](function(_0x3c3a20){logger[_0x90c1('0xd')](_0x90c1('0x16'),_0x3b6671);logger[_0x90c1('0xf')](_0x90c1('0x16'),_0x3b6671,JSON[_0x90c1('0x10')](_0x3c3a20));_0x372949(_0x3c3a20);})[_0x90c1('0x15')](function(_0x2f85dc){logger[_0x90c1('0x11')](_0x90c1('0x16'),_0x2f85dc[_0x90c1('0x13')],_0x3b6671);_0x112aa4(_0x2960f2['error'](0x1f4,_0x2f85dc[_0x90c1('0x13')]));});});};exports[_0x90c1('0x1f')]=function(_0x40c2f1){var _0x5be73c=this;return new Promise(function(_0x305e68,_0x578316){return db[_0x90c1('0x17')][_0x90c1('0x20')]({'raw':_0x40c2f1[_0x90c1('0x18')]?_0x40c2f1[_0x90c1('0x18')][_0x90c1('0x19')]===undefined?!![]:![]:!![],'where':_0x40c2f1['options']?_0x40c2f1[_0x90c1('0x18')][_0x90c1('0x1a')]||null:null,'attributes':_0x40c2f1[_0x90c1('0x18')]?_0x40c2f1['options'][_0x90c1('0x1c')]||null:null,'include':_0x40c2f1[_0x90c1('0x18')]?_0x40c2f1[_0x90c1('0x18')][_0x90c1('0x1d')]?_[_0x90c1('0x1b')](_0x40c2f1[_0x90c1('0x18')][_0x90c1('0x1d')],function(_0x36e431){return{'model':db[_0x36e431[_0x90c1('0x1e')]],'as':_0x36e431['as'],'attributes':_0x36e431[_0x90c1('0x1c')],'include':_0x36e431[_0x90c1('0x1d')]?_[_0x90c1('0x1b')](_0x36e431[_0x90c1('0x1d')],function(_0x3a130f){return{'model':db[_0x3a130f['model']],'as':_0x3a130f['as'],'attributes':_0x3a130f[_0x90c1('0x1c')],'include':_0x3a130f[_0x90c1('0x1d')]?_[_0x90c1('0x1b')](_0x3a130f[_0x90c1('0x1d')],function(_0x5c62a4){return{'model':db[_0x5c62a4['model']],'as':_0x5c62a4['as'],'attributes':_0x5c62a4[_0x90c1('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x90c1('0xc')](function(_0x1aa105){logger[_0x90c1('0xd')]('ShowFreshsalesAccount',_0x40c2f1);logger['debug'](_0x90c1('0x1f'),_0x40c2f1,JSON[_0x90c1('0x10')](_0x1aa105));_0x305e68(_0x1aa105);})[_0x90c1('0x15')](function(_0x23bb5a){logger[_0x90c1('0x11')]('ShowFreshsalesAccount',_0x23bb5a['message'],_0x40c2f1);_0x578316(_0x5be73c['error'](0x1f4,_0x23bb5a[_0x90c1('0x13')]));});});}; \ No newline at end of file +var _0xfaf2=['attributes','limit','include','map','model','then','catch','ShowFreshsalesAccount','find','raw','stringify','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','info','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','FreshsalesAccount,\x20%s,\x20%s','message','result','GetFreshsalesAccount','FreshsalesAccount','findAll','options','where'];(function(_0x11160d,_0x413adc){var _0x21520a=function(_0x272f3c){while(--_0x272f3c){_0x11160d['push'](_0x11160d['shift']());}};_0x21520a(++_0x413adc);}(_0xfaf2,0x169));var _0x2faf=function(_0x2a8a3f,_0x546bd4){_0x2a8a3f=_0x2a8a3f-0x0;var _0x16996c=_0xfaf2[_0x2a8a3f];return _0x16996c;};'use strict';var _=require(_0x2faf('0x0'));var util=require(_0x2faf('0x1'));var moment=require(_0x2faf('0x2'));var BPromise=require(_0x2faf('0x3'));var rs=require(_0x2faf('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2faf('0x5'))['db'];var utils=require(_0x2faf('0x6'));var logger=require(_0x2faf('0x7'))(_0x2faf('0x8'));var config=require(_0x2faf('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x32cdb3,_0x43128c,_0x1d3420){return new BPromise(function(_0x1522cb,_0x3f5c12){return client['request'](_0x32cdb3,_0x1d3420)['then'](function(_0x9c958c){logger[_0x2faf('0xa')]('FreshsalesAccount,\x20%s,\x20%s',_0x43128c,'request\x20sent');logger[_0x2faf('0xb')](_0x2faf('0xc'),_0x43128c,_0x2faf('0xd'),JSON['stringify'](_0x9c958c));if(_0x9c958c['error']){if(_0x9c958c[_0x2faf('0xe')][_0x2faf('0xf')]===0x1f4){logger['error'](_0x2faf('0x10'),_0x43128c,_0x9c958c['error'][_0x2faf('0x11')]);return _0x3f5c12(_0x9c958c[_0x2faf('0xe')][_0x2faf('0x11')]);}logger[_0x2faf('0xe')](_0x2faf('0x10'),_0x43128c,_0x9c958c[_0x2faf('0xe')]['message']);return _0x1522cb(_0x9c958c[_0x2faf('0xe')][_0x2faf('0x11')]);}else{logger['info'](_0x2faf('0x10'),_0x43128c,_0x2faf('0xd'));_0x1522cb(_0x9c958c[_0x2faf('0x12')][_0x2faf('0x11')]);}})['catch'](function(_0x3a2f18){logger[_0x2faf('0xe')](_0x2faf('0x10'),_0x43128c,_0x3a2f18);_0x3f5c12(_0x3a2f18);});});}exports[_0x2faf('0x13')]=function(_0x5a0728){var _0x20ff39=this;return new Promise(function(_0xfc6439,_0x934280){return db[_0x2faf('0x14')][_0x2faf('0x15')]({'raw':_0x5a0728[_0x2faf('0x16')]?_0x5a0728[_0x2faf('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x5a0728['options']?_0x5a0728['options'][_0x2faf('0x17')]||null:null,'attributes':_0x5a0728[_0x2faf('0x16')]?_0x5a0728['options'][_0x2faf('0x18')]||null:null,'limit':_0x5a0728['options']?_0x5a0728['options'][_0x2faf('0x19')]||null:null,'include':_0x5a0728[_0x2faf('0x16')]?_0x5a0728['options'][_0x2faf('0x1a')]?_[_0x2faf('0x1b')](_0x5a0728[_0x2faf('0x16')][_0x2faf('0x1a')],function(_0xfe4559){return{'model':db[_0xfe4559[_0x2faf('0x1c')]],'as':_0xfe4559['as'],'attributes':_0xfe4559[_0x2faf('0x18')],'include':_0xfe4559[_0x2faf('0x1a')]?_[_0x2faf('0x1b')](_0xfe4559[_0x2faf('0x1a')],function(_0x770d45){return{'model':db[_0x770d45[_0x2faf('0x1c')]],'as':_0x770d45['as'],'attributes':_0x770d45['attributes'],'include':_0x770d45[_0x2faf('0x1a')]?_[_0x2faf('0x1b')](_0x770d45[_0x2faf('0x1a')],function(_0x53f72c){return{'model':db[_0x53f72c[_0x2faf('0x1c')]],'as':_0x53f72c['as'],'attributes':_0x53f72c[_0x2faf('0x18')]};}):[]};}):[]};}):[]:[]})[_0x2faf('0x1d')](function(_0x3159b8){logger[_0x2faf('0xa')](_0x2faf('0x13'),_0x5a0728);logger['debug'](_0x2faf('0x13'),_0x5a0728,JSON['stringify'](_0x3159b8));_0xfc6439(_0x3159b8);})[_0x2faf('0x1e')](function(_0x1133a0){logger[_0x2faf('0xe')](_0x2faf('0x13'),_0x1133a0[_0x2faf('0x11')],_0x5a0728);_0x934280(_0x20ff39[_0x2faf('0xe')](0x1f4,_0x1133a0[_0x2faf('0x11')]));});});};exports[_0x2faf('0x1f')]=function(_0x3b504c){var _0x48f6a5=this;return new Promise(function(_0x2f7522,_0x10216e){return db[_0x2faf('0x14')][_0x2faf('0x20')]({'raw':_0x3b504c[_0x2faf('0x16')]?_0x3b504c['options'][_0x2faf('0x21')]===undefined?!![]:![]:!![],'where':_0x3b504c[_0x2faf('0x16')]?_0x3b504c['options'][_0x2faf('0x17')]||null:null,'attributes':_0x3b504c[_0x2faf('0x16')]?_0x3b504c[_0x2faf('0x16')][_0x2faf('0x18')]||null:null,'include':_0x3b504c['options']?_0x3b504c[_0x2faf('0x16')]['include']?_['map'](_0x3b504c[_0x2faf('0x16')][_0x2faf('0x1a')],function(_0x3c466b){return{'model':db[_0x3c466b[_0x2faf('0x1c')]],'as':_0x3c466b['as'],'attributes':_0x3c466b['attributes'],'include':_0x3c466b['include']?_[_0x2faf('0x1b')](_0x3c466b[_0x2faf('0x1a')],function(_0xa8bb28){return{'model':db[_0xa8bb28[_0x2faf('0x1c')]],'as':_0xa8bb28['as'],'attributes':_0xa8bb28[_0x2faf('0x18')],'include':_0xa8bb28[_0x2faf('0x1a')]?_['map'](_0xa8bb28[_0x2faf('0x1a')],function(_0x324edc){return{'model':db[_0x324edc[_0x2faf('0x1c')]],'as':_0x324edc['as'],'attributes':_0x324edc[_0x2faf('0x18')]};}):[]};}):[]};}):[]:[]})[_0x2faf('0x1d')](function(_0x28ed30){logger[_0x2faf('0xa')](_0x2faf('0x1f'),_0x3b504c);logger[_0x2faf('0xb')](_0x2faf('0x1f'),_0x3b504c,JSON[_0x2faf('0x22')](_0x28ed30));_0x2f7522(_0x28ed30);})[_0x2faf('0x1e')](function(_0x3a4630){logger['error']('ShowFreshsalesAccount',_0x3a4630[_0x2faf('0x11')],_0x3b504c);_0x10216e(_0x48f6a5[_0x2faf('0xe')](0x1f4,_0x3a4630['message']));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 14a3d91..16fbb11 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 _0x4a34=['/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/fields','getFields','post','put','update','delete','destroy','exports','multer','connect-timeout','express','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show'];(function(_0x41fde7,_0xdc22e0){var _0x5eb960=function(_0xf5306c){while(--_0xf5306c){_0x41fde7['push'](_0x41fde7['shift']());}};_0x5eb960(++_0xdc22e0);}(_0x4a34,0x1ae));var _0x44a3=function(_0x52b663,_0x20a937){_0x52b663=_0x52b663-0x0;var _0x22d7d8=_0x4a34[_0x52b663];return _0x22d7d8;};'use strict';var multer=require(_0x44a3('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x44a3('0x1'));var express=require(_0x44a3('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x44a3('0x3'));var config=require(_0x44a3('0x4'));var controller=require('./intFreshsalesConfiguration.controller');router[_0x44a3('0x5')]('/',auth[_0x44a3('0x6')](),controller[_0x44a3('0x7')]);router[_0x44a3('0x5')](_0x44a3('0x8'),auth[_0x44a3('0x6')](),controller[_0x44a3('0x9')]);router[_0x44a3('0x5')](_0x44a3('0xa'),auth[_0x44a3('0x6')](),controller[_0x44a3('0xb')]);router[_0x44a3('0x5')](_0x44a3('0xc'),auth['isAuthenticated'](),controller[_0x44a3('0xd')]);router[_0x44a3('0x5')](_0x44a3('0xe'),auth['isAuthenticated'](),controller[_0x44a3('0xf')]);router[_0x44a3('0x10')]('/',auth[_0x44a3('0x6')](),controller['create']);router[_0x44a3('0x11')](_0x44a3('0x8'),auth[_0x44a3('0x6')](),controller[_0x44a3('0x12')]);router[_0x44a3('0x13')]('/:id',auth[_0x44a3('0x6')](),controller[_0x44a3('0x14')]);module[_0x44a3('0x15')]=router; \ No newline at end of file +var _0xff16=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','/:id','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/fields','getFields','post','create','put','update','exports','multer'];(function(_0x509042,_0x541f21){var _0x1ac556=function(_0xc19bd4){while(--_0xc19bd4){_0x509042['push'](_0x509042['shift']());}};_0x1ac556(++_0x541f21);}(_0xff16,0xef));var _0x6ff1=function(_0x1a3f27,_0x50d70d){_0x1a3f27=_0x1a3f27-0x0;var _0x3b7d5b=_0xff16[_0x1a3f27];return _0x3b7d5b;};'use strict';var multer=require(_0x6ff1('0x0'));var util=require(_0x6ff1('0x1'));var path=require(_0x6ff1('0x2'));var timeout=require(_0x6ff1('0x3'));var express=require(_0x6ff1('0x4'));var router=express[_0x6ff1('0x5')]();var auth=require(_0x6ff1('0x6'));var interaction=require(_0x6ff1('0x7'));var config=require(_0x6ff1('0x8'));var controller=require(_0x6ff1('0x9'));router[_0x6ff1('0xa')]('/',auth[_0x6ff1('0xb')](),controller['index']);router[_0x6ff1('0xa')](_0x6ff1('0xc'),auth[_0x6ff1('0xb')](),controller['show']);router['get'](_0x6ff1('0xd'),auth[_0x6ff1('0xb')](),controller[_0x6ff1('0xe')]);router['get'](_0x6ff1('0xf'),auth[_0x6ff1('0xb')](),controller[_0x6ff1('0x10')]);router[_0x6ff1('0xa')](_0x6ff1('0x11'),auth[_0x6ff1('0xb')](),controller[_0x6ff1('0x12')]);router[_0x6ff1('0x13')]('/',auth['isAuthenticated'](),controller[_0x6ff1('0x14')]);router[_0x6ff1('0x15')]('/:id',auth[_0x6ff1('0xb')](),controller[_0x6ff1('0x16')]);router['delete'](_0x6ff1('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x6ff1('0x17')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 4b10a5f..e2800ec 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 _0xd8be=['sequelize','exports','STRING'];(function(_0xe00f4c,_0x59ba20){var _0x5dfa97=function(_0xe557dc){while(--_0xe557dc){_0xe00f4c['push'](_0xe00f4c['shift']());}};_0x5dfa97(++_0x59ba20);}(_0xd8be,0xe1));var _0xed8b=function(_0x50aa2e,_0xfbd6f0){_0x50aa2e=_0x50aa2e-0x0;var _0x5e07f0=_0xd8be[_0x50aa2e];return _0x5e07f0;};'use strict';var Sequelize=require(_0xed8b('0x0'));module[_0xed8b('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xed8b('0x2')]}}; \ No newline at end of file +var _0x1bf1=['STRING'];(function(_0x290fa6,_0x16d017){var _0x47f1f3=function(_0x2b5eb8){while(--_0x2b5eb8){_0x290fa6['push'](_0x290fa6['shift']());}};_0x47f1f3(++_0x16d017);}(_0x1bf1,0x1ec));var _0x11bf=function(_0x5316d4,_0x3e273a){_0x5316d4=_0x5316d4-0x0;var _0x590f57=_0x1bf1[_0x5316d4];return _0x590f57;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x11bf('0x0')]},'description':{'type':Sequelize[_0x11bf('0x0')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 65fe90c..a774dfe 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 _0x3871=['include','show','params','length','find','create','body','getSubjects','FreshsalesField','sort','hasOwnProperty','nolimit','findOne','rawAttributes','getDescriptions','getFields','html-pdf','rimraf','fast-json-patch','moment','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','jayson/promise','client','test','Sequelize','ValidationError','request','then','info','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','FreshsalesConfiguration,\x20%s,\x20%s','result','catch','status','end','json','count','offset','set','Content-Range','reject','save','update','destroy','stack','name','send','index','map','fieldName','key','model','query','keys','intersection','fields','attributes','limit','order','where','filters','pick','filter','type','VIRTUAL','merge','options','FreshsalesConfiguration','includeAll'];(function(_0x47b374,_0x1d93db){var _0x572fa0=function(_0x22ee19){while(--_0x22ee19){_0x47b374['push'](_0x47b374['shift']());}};_0x572fa0(++_0x1d93db);}(_0x3871,0x1d2));var _0x1387=function(_0x1b0d31,_0x3dc6b4){_0x1b0d31=_0x1b0d31-0x0;var _0x3604c4=_0x3871[_0x1b0d31];return _0x3604c4;};'use strict';var pdf=require(_0x1387('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x1387('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1387('0x2'));var rp=require('request-promise');var moment=require(_0x1387('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x1387('0x4'));var csv=require('to-csv');var ejs=require(_0x1387('0x5'));var fs=require('fs');var _=require(_0x1387('0x6'));var squel=require(_0x1387('0x7'));var crypto=require(_0x1387('0x8'));var jsforce=require('jsforce');var deskjs=require(_0x1387('0x9'));var toCsv=require(_0x1387('0xa'));var querystring=require(_0x1387('0xb'));var Papa=require(_0x1387('0xc'));var Redis=require('ioredis');var authService=require(_0x1387('0xd'));var qs=require(_0x1387('0xe'));var as=require(_0x1387('0xf'));var hardwareService=require(_0x1387('0x10'));var logger=require(_0x1387('0x11'))(_0x1387('0x12'));var utils=require(_0x1387('0x13'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var jayson=require(_0x1387('0x14'));var client=jayson[_0x1387('0x15')]['http']({'port':0x232a});function checkPasswordPattern(_0x11e40c,_0x2a8b39,_0x24d47b){if(_0x24d47b){var _0xe48aaa=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xe48aaa[_0x1387('0x16')](_0x2a8b39)){return _0x11e40c;}else{throw new db[(_0x1387('0x17'))][(_0x1387('0x18'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x11e40c;}}function respondWithRpcPromise(_0x190cb6,_0x47292b,_0x1cdb89,_0x3bdf63){return new BPromise(function(_0x3fe7f7,_0x11bbd3){var _0xc1822d=_0x3bdf63||client;return _0xc1822d[_0x1387('0x19')](_0x190cb6,_0x1cdb89)[_0x1387('0x1a')](function(_0x96a389){logger[_0x1387('0x1b')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x47292b,'request\x20sent');logger[_0x1387('0x1c')](_0x1387('0x1d'),_0x47292b,_0x1387('0x1e'),JSON[_0x1387('0x1f')](_0x96a389));if(_0x96a389[_0x1387('0x20')]){if(_0x96a389[_0x1387('0x20')][_0x1387('0x21')]===0x1f4){logger[_0x1387('0x20')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x47292b,_0x96a389['error'][_0x1387('0x22')]);return _0x11bbd3(_0x96a389[_0x1387('0x20')][_0x1387('0x22')]);}logger['error']('FreshsalesConfiguration,\x20%s,\x20%s',_0x47292b,_0x96a389[_0x1387('0x20')][_0x1387('0x22')]);return _0x3fe7f7(_0x96a389[_0x1387('0x20')][_0x1387('0x22')]);}else{logger[_0x1387('0x1b')](_0x1387('0x23'),_0x47292b,'request\x20sent');_0x3fe7f7(_0x96a389[_0x1387('0x24')][_0x1387('0x22')]);}})[_0x1387('0x25')](function(_0x348422){logger['error']('FreshsalesConfiguration,\x20%s,\x20%s',_0x47292b,_0x348422);_0x11bbd3(_0x348422);});});}function respondWithStatusCode(_0x1a267d,_0x2a61b7){_0x2a61b7=_0x2a61b7||0xcc;return function(_0x4d9ea2){if(_0x4d9ea2){return _0x1a267d['sendStatus'](_0x2a61b7);}return _0x1a267d[_0x1387('0x26')](_0x2a61b7)[_0x1387('0x27')]();};}function respondWithResult(_0x552190,_0x2b09c8){_0x2b09c8=_0x2b09c8||0xc8;return function(_0x3b594c){if(_0x3b594c){return _0x552190['status'](_0x2b09c8)[_0x1387('0x28')](_0x3b594c);}};}function respondWithFilteredResult(_0x22cef6,_0x182b2d){return function(_0x35fa81){if(_0x35fa81){var _0xe4b355=_0x35fa81[_0x1387('0x29')],_0x3ecead=_0x182b2d['offset'],_0x27ba29=_0x182b2d[_0x1387('0x2a')]+_0x182b2d['limit'],_0x3517d8;if(_0x27ba29>=_0xe4b355){_0x27ba29=_0xe4b355;_0x3517d8=0xc8;}else{_0x3517d8=0xce;}_0x22cef6[_0x1387('0x26')](_0x3517d8);return _0x22cef6[_0x1387('0x2b')](_0x1387('0x2c'),_0x3ecead+'-'+_0x27ba29+'/'+_0xe4b355)[_0x1387('0x28')](_0x35fa81);}return null;};}function patchUpdates(_0x386e3a){return function(_0x52b334){try{jsonpatch['apply'](_0x52b334,_0x386e3a,!![]);}catch(_0x51c5d7){return BPromise[_0x1387('0x2d')](_0x51c5d7);}return _0x52b334[_0x1387('0x2e')]();};}function saveUpdates(_0x5914d7,_0x4dd88a){return function(_0x4469b8){if(_0x4469b8){return _0x4469b8[_0x1387('0x2f')](_0x5914d7)[_0x1387('0x1a')](function(_0x3a3af9){return _0x3a3af9;});}return null;};}function removeEntity(_0x202ccb,_0x11b8b3){return function(_0x877f2){if(_0x877f2){return _0x877f2[_0x1387('0x30')]()[_0x1387('0x1a')](function(){_0x202ccb[_0x1387('0x26')](0xcc)[_0x1387('0x27')]();});}};}function handleEntityNotFound(_0x33d768,_0x5d722b){return function(_0x5ba3ca){if(!_0x5ba3ca){_0x33d768['sendStatus'](0x194);}return _0x5ba3ca;};}function handleError(_0x42795f,_0x3092a1){_0x3092a1=_0x3092a1||0x1f4;return function(_0x4a07a7){logger['error'](_0x4a07a7[_0x1387('0x31')]);if(_0x4a07a7[_0x1387('0x32')]){delete _0x4a07a7[_0x1387('0x32')];}_0x42795f[_0x1387('0x26')](_0x3092a1)[_0x1387('0x33')](_0x4a07a7);};}exports[_0x1387('0x34')]=function(_0x16e03e,_0x430487){var _0x2c4b95={},_0x4ed805={},_0x10b7a1={'count':0x0,'rows':[]};var _0x2ba95b=_[_0x1387('0x35')](db['FreshsalesConfiguration']['rawAttributes'],function(_0x17ba63){return{'name':_0x17ba63[_0x1387('0x36')],'type':_0x17ba63['type'][_0x1387('0x37')]};});_0x4ed805[_0x1387('0x38')]=_[_0x1387('0x35')](_0x2ba95b,_0x1387('0x32'));_0x4ed805[_0x1387('0x39')]=_[_0x1387('0x3a')](_0x16e03e[_0x1387('0x39')]);_0x4ed805['filters']=_[_0x1387('0x3b')](_0x4ed805[_0x1387('0x38')],_0x4ed805[_0x1387('0x39')]);_0x2c4b95['attributes']=_['intersection'](_0x4ed805[_0x1387('0x38')],qs[_0x1387('0x3c')](_0x16e03e[_0x1387('0x39')][_0x1387('0x3c')]));_0x2c4b95[_0x1387('0x3d')]=_0x2c4b95[_0x1387('0x3d')]['length']?_0x2c4b95['attributes']:_0x4ed805[_0x1387('0x38')];if(!_0x16e03e[_0x1387('0x39')]['hasOwnProperty']('nolimit')){_0x2c4b95[_0x1387('0x3e')]=qs['limit'](_0x16e03e[_0x1387('0x39')][_0x1387('0x3e')]);_0x2c4b95[_0x1387('0x2a')]=qs['offset'](_0x16e03e['query']['offset']);}_0x2c4b95[_0x1387('0x3f')]=qs['sort'](_0x16e03e[_0x1387('0x39')]['sort']);_0x2c4b95[_0x1387('0x40')]=qs[_0x1387('0x41')](_[_0x1387('0x42')](_0x16e03e[_0x1387('0x39')],_0x4ed805[_0x1387('0x41')]),_0x2ba95b);if(_0x16e03e[_0x1387('0x39')][_0x1387('0x43')]){_0x2c4b95[_0x1387('0x40')]=_['merge'](_0x2c4b95['where'],{'$or':_['map'](_0x2ba95b,function(_0x291686){if(_0x291686[_0x1387('0x44')]!==_0x1387('0x45')){var _0x5c36b0={};_0x5c36b0[_0x291686[_0x1387('0x32')]]={'$like':'%'+_0x16e03e['query'][_0x1387('0x43')]+'%'};return _0x5c36b0;}})});}_0x2c4b95=_[_0x1387('0x46')]({},_0x2c4b95,_0x16e03e[_0x1387('0x47')]);var _0x5333df={'where':_0x2c4b95[_0x1387('0x40')]};return db[_0x1387('0x48')]['count'](_0x5333df)['then'](function(_0x513918){_0x10b7a1[_0x1387('0x29')]=_0x513918;if(_0x16e03e[_0x1387('0x39')][_0x1387('0x49')]){_0x2c4b95[_0x1387('0x4a')]=[{'all':!![]}];}return db[_0x1387('0x48')]['findAll'](_0x2c4b95);})['then'](function(_0x5c8859){_0x10b7a1['rows']=_0x5c8859;return _0x10b7a1;})[_0x1387('0x1a')](respondWithFilteredResult(_0x430487,_0x2c4b95))[_0x1387('0x25')](handleError(_0x430487,null));};exports[_0x1387('0x4b')]=function(_0x14541c,_0x538c2e){var _0x556f11={'raw':![],'where':{'id':_0x14541c[_0x1387('0x4c')]['id']}},_0x20abb7={};_0x20abb7[_0x1387('0x38')]=_[_0x1387('0x3a')](db[_0x1387('0x48')]['rawAttributes']);_0x20abb7[_0x1387('0x39')]=_[_0x1387('0x3a')](_0x14541c[_0x1387('0x39')]);_0x20abb7[_0x1387('0x41')]=_['intersection'](_0x20abb7['model'],_0x20abb7[_0x1387('0x39')]);_0x556f11[_0x1387('0x3d')]=_[_0x1387('0x3b')](_0x20abb7[_0x1387('0x38')],qs[_0x1387('0x3c')](_0x14541c['query'][_0x1387('0x3c')]));_0x556f11[_0x1387('0x3d')]=_0x556f11[_0x1387('0x3d')][_0x1387('0x4d')]?_0x556f11[_0x1387('0x3d')]:_0x20abb7[_0x1387('0x38')];if(_0x14541c[_0x1387('0x39')][_0x1387('0x49')]){_0x556f11[_0x1387('0x4a')]=[{'all':!![]}];}_0x556f11=_[_0x1387('0x46')]({},_0x556f11,_0x14541c[_0x1387('0x47')]);return db['FreshsalesConfiguration'][_0x1387('0x4e')](_0x556f11)[_0x1387('0x1a')](handleEntityNotFound(_0x538c2e,null))[_0x1387('0x1a')](respondWithResult(_0x538c2e,null))[_0x1387('0x25')](handleError(_0x538c2e,null));};exports['create']=function(_0x3245b4,_0x388fac){return db['FreshsalesConfiguration'][_0x1387('0x4f')](_0x3245b4[_0x1387('0x50')],{})[_0x1387('0x1a')](respondWithResult(_0x388fac,0xc9))[_0x1387('0x25')](handleError(_0x388fac,null));};exports[_0x1387('0x2f')]=function(_0x240d20,_0x425005){if(_0x240d20[_0x1387('0x50')]['id']){delete _0x240d20[_0x1387('0x50')]['id'];}return db[_0x1387('0x48')][_0x1387('0x4e')]({'where':{'id':_0x240d20[_0x1387('0x4c')]['id']}})[_0x1387('0x1a')](handleEntityNotFound(_0x425005,null))[_0x1387('0x1a')](saveUpdates(_0x240d20[_0x1387('0x50')],null))[_0x1387('0x1a')](respondWithResult(_0x425005,null))[_0x1387('0x25')](handleError(_0x425005,null));};exports[_0x1387('0x30')]=function(_0x42b295,_0xb461af){return db['FreshsalesConfiguration'][_0x1387('0x4e')]({'where':{'id':_0x42b295['params']['id']}})[_0x1387('0x1a')](handleEntityNotFound(_0xb461af,null))[_0x1387('0x1a')](removeEntity(_0xb461af,null))[_0x1387('0x25')](handleError(_0xb461af,null));};exports[_0x1387('0x51')]=function(_0x1e5c16,_0x2791c9,_0x17acdf){var _0x156277={};var _0x1d4d4e={};var _0x3f716f;var _0x4ded86;return db[_0x1387('0x48')]['findOne']({'where':{'id':_0x1e5c16[_0x1387('0x4c')]['id']}})[_0x1387('0x1a')](handleEntityNotFound(_0x2791c9,null))[_0x1387('0x1a')](function(_0xc26f5c){if(_0xc26f5c){_0x3f716f=_0xc26f5c;_0x1d4d4e[_0x1387('0x38')]=_[_0x1387('0x3a')](db[_0x1387('0x52')]['rawAttributes']);_0x1d4d4e[_0x1387('0x39')]=_[_0x1387('0x3a')](_0x1e5c16[_0x1387('0x39')]);_0x1d4d4e[_0x1387('0x41')]=_[_0x1387('0x3b')](_0x1d4d4e[_0x1387('0x38')],_0x1d4d4e[_0x1387('0x39')]);_0x156277['attributes']=_[_0x1387('0x3b')](_0x1d4d4e[_0x1387('0x38')],qs['fields'](_0x1e5c16[_0x1387('0x39')][_0x1387('0x3c')]));_0x156277[_0x1387('0x3d')]=_0x156277[_0x1387('0x3d')][_0x1387('0x4d')]?_0x156277[_0x1387('0x3d')]:_0x1d4d4e[_0x1387('0x38')];_0x156277['order']=qs[_0x1387('0x53')](_0x1e5c16[_0x1387('0x39')][_0x1387('0x53')]);_0x156277[_0x1387('0x40')]=qs[_0x1387('0x41')](_[_0x1387('0x42')](_0x1e5c16[_0x1387('0x39')],_0x1d4d4e[_0x1387('0x41')]));if(_0x1e5c16[_0x1387('0x39')]['filter']){_0x156277[_0x1387('0x40')]=_[_0x1387('0x46')](_0x156277['where'],{'$or':_[_0x1387('0x35')](_0x156277['attributes'],function(_0x15de11){var _0x2ab620={};_0x2ab620[_0x15de11]={'$like':'%'+_0x1e5c16['query'][_0x1387('0x43')]+'%'};return _0x2ab620;})});}_0x156277=_['merge']({},_0x156277,_0x1e5c16[_0x1387('0x47')]);return _0x3f716f[_0x1387('0x51')](_0x156277);}})[_0x1387('0x1a')](function(_0x5f59ac){if(_0x5f59ac){_0x4ded86=_0x5f59ac[_0x1387('0x4d')];if(!_0x1e5c16[_0x1387('0x39')][_0x1387('0x54')](_0x1387('0x55'))){_0x156277[_0x1387('0x3e')]=qs[_0x1387('0x3e')](_0x1e5c16[_0x1387('0x39')][_0x1387('0x3e')]);_0x156277[_0x1387('0x2a')]=qs[_0x1387('0x2a')](_0x1e5c16['query']['offset']);}return _0x3f716f[_0x1387('0x51')](_0x156277);}})[_0x1387('0x1a')](function(_0x386913){if(_0x386913){return _0x386913?{'count':_0x4ded86,'rows':_0x386913}:null;}})['then'](respondWithResult(_0x2791c9,null))['catch'](handleError(_0x2791c9,null));};exports['getDescriptions']=function(_0x223729,_0x310468,_0x5821da){var _0x59c830={};var _0x3b8b8d={};var _0x54bf48;var _0x4c7d59;return db['FreshsalesConfiguration'][_0x1387('0x56')]({'where':{'id':_0x223729[_0x1387('0x4c')]['id']}})['then'](handleEntityNotFound(_0x310468,null))[_0x1387('0x1a')](function(_0x5304f8){if(_0x5304f8){_0x54bf48=_0x5304f8;_0x3b8b8d[_0x1387('0x38')]=_[_0x1387('0x3a')](db[_0x1387('0x52')][_0x1387('0x57')]);_0x3b8b8d[_0x1387('0x39')]=_[_0x1387('0x3a')](_0x223729[_0x1387('0x39')]);_0x3b8b8d[_0x1387('0x41')]=_[_0x1387('0x3b')](_0x3b8b8d[_0x1387('0x38')],_0x3b8b8d[_0x1387('0x39')]);_0x59c830[_0x1387('0x3d')]=_['intersection'](_0x3b8b8d[_0x1387('0x38')],qs[_0x1387('0x3c')](_0x223729[_0x1387('0x39')][_0x1387('0x3c')]));_0x59c830[_0x1387('0x3d')]=_0x59c830['attributes'][_0x1387('0x4d')]?_0x59c830['attributes']:_0x3b8b8d['model'];_0x59c830[_0x1387('0x3f')]=qs['sort'](_0x223729['query']['sort']);_0x59c830[_0x1387('0x40')]=qs[_0x1387('0x41')](_[_0x1387('0x42')](_0x223729['query'],_0x3b8b8d[_0x1387('0x41')]));if(_0x223729['query']['filter']){_0x59c830[_0x1387('0x40')]=_['merge'](_0x59c830[_0x1387('0x40')],{'$or':_[_0x1387('0x35')](_0x59c830[_0x1387('0x3d')],function(_0x584308){var _0x2ebb4d={};_0x2ebb4d[_0x584308]={'$like':'%'+_0x223729[_0x1387('0x39')]['filter']+'%'};return _0x2ebb4d;})});}_0x59c830=_[_0x1387('0x46')]({},_0x59c830,_0x223729[_0x1387('0x47')]);return _0x54bf48[_0x1387('0x58')](_0x59c830);}})[_0x1387('0x1a')](function(_0x2f35fa){if(_0x2f35fa){_0x4c7d59=_0x2f35fa[_0x1387('0x4d')];if(!_0x223729[_0x1387('0x39')][_0x1387('0x54')](_0x1387('0x55'))){_0x59c830[_0x1387('0x3e')]=qs[_0x1387('0x3e')](_0x223729[_0x1387('0x39')]['limit']);_0x59c830[_0x1387('0x2a')]=qs[_0x1387('0x2a')](_0x223729[_0x1387('0x39')][_0x1387('0x2a')]);}return _0x54bf48[_0x1387('0x58')](_0x59c830);}})[_0x1387('0x1a')](function(_0x169e26){if(_0x169e26){return _0x169e26?{'count':_0x4c7d59,'rows':_0x169e26}:null;}})[_0x1387('0x1a')](respondWithResult(_0x310468,null))[_0x1387('0x25')](handleError(_0x310468,null));};exports['getFields']=function(_0x2e1533,_0x211d47,_0x4dcfa8){var _0x31a827={};var _0x5793dc={};var _0x5f3b3b;var _0x5bf905;return db[_0x1387('0x48')]['findOne']({'where':{'id':_0x2e1533[_0x1387('0x4c')]['id']}})['then'](handleEntityNotFound(_0x211d47,null))['then'](function(_0x20b770){if(_0x20b770){_0x5f3b3b=_0x20b770;_0x5793dc[_0x1387('0x38')]=_['keys'](db[_0x1387('0x52')][_0x1387('0x57')]);_0x5793dc[_0x1387('0x39')]=_['keys'](_0x2e1533[_0x1387('0x39')]);_0x5793dc[_0x1387('0x41')]=_[_0x1387('0x3b')](_0x5793dc[_0x1387('0x38')],_0x5793dc[_0x1387('0x39')]);_0x31a827[_0x1387('0x3d')]=_[_0x1387('0x3b')](_0x5793dc[_0x1387('0x38')],qs[_0x1387('0x3c')](_0x2e1533[_0x1387('0x39')][_0x1387('0x3c')]));_0x31a827[_0x1387('0x3d')]=_0x31a827['attributes']['length']?_0x31a827[_0x1387('0x3d')]:_0x5793dc[_0x1387('0x38')];_0x31a827['order']=qs[_0x1387('0x53')](_0x2e1533[_0x1387('0x39')][_0x1387('0x53')]);_0x31a827[_0x1387('0x40')]=qs[_0x1387('0x41')](_[_0x1387('0x42')](_0x2e1533[_0x1387('0x39')],_0x5793dc[_0x1387('0x41')]));if(_0x2e1533[_0x1387('0x39')][_0x1387('0x43')]){_0x31a827[_0x1387('0x40')]=_[_0x1387('0x46')](_0x31a827[_0x1387('0x40')],{'$or':_[_0x1387('0x35')](_0x31a827['attributes'],function(_0x364528){var _0x540438={};_0x540438[_0x364528]={'$like':'%'+_0x2e1533['query'][_0x1387('0x43')]+'%'};return _0x540438;})});}_0x31a827=_['merge']({},_0x31a827,_0x2e1533['options']);return _0x5f3b3b[_0x1387('0x59')](_0x31a827);}})[_0x1387('0x1a')](function(_0x5f0e26){if(_0x5f0e26){_0x5bf905=_0x5f0e26[_0x1387('0x4d')];if(!_0x2e1533[_0x1387('0x39')][_0x1387('0x54')]('nolimit')){_0x31a827['limit']=qs[_0x1387('0x3e')](_0x2e1533['query']['limit']);_0x31a827[_0x1387('0x2a')]=qs[_0x1387('0x2a')](_0x2e1533[_0x1387('0x39')][_0x1387('0x2a')]);}return _0x5f3b3b['getFields'](_0x31a827);}})['then'](function(_0x2f4b5f){if(_0x2f4b5f){return _0x2f4b5f?{'count':_0x5bf905,'rows':_0x2f4b5f}:null;}})[_0x1387('0x1a')](respondWithResult(_0x211d47,null))[_0x1387('0x25')](handleError(_0x211d47,null));}; \ No newline at end of file +var _0xb70f=['../../mysqldb','jayson/promise','http','test','Sequelize','ValidationError','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','name','index','map','FreshsalesConfiguration','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','filter','where','merge','includeAll','include','catch','options','create','body','find','params','destroy','getSubjects','findOne','FreshsalesField','pick','nolimit','getDescriptions','getFields','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x50b526,_0x18e863){var _0x429324=function(_0x99534e){while(--_0x99534e){_0x50b526['push'](_0x50b526['shift']());}};_0x429324(++_0x18e863);}(_0xb70f,0x19e));var _0xfb70=function(_0x2ab736,_0x37af67){_0x2ab736=_0x2ab736-0x0;var _0xdfedda=_0xb70f[_0x2ab736];return _0xdfedda;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xfb70('0x0'));var rimraf=require(_0xfb70('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xfb70('0x2'));var moment=require(_0xfb70('0x3'));var BPromise=require(_0xfb70('0x4'));var Mustache=require(_0xfb70('0x5'));var util=require(_0xfb70('0x6'));var path=require('path');var sox=require(_0xfb70('0x7'));var csv=require(_0xfb70('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xfb70('0x9'));var squel=require('squel');var crypto=require(_0xfb70('0xa'));var jsforce=require(_0xfb70('0xb'));var deskjs=require(_0xfb70('0xc'));var toCsv=require(_0xfb70('0x8'));var querystring=require('querystring');var Papa=require(_0xfb70('0xd'));var Redis=require(_0xfb70('0xe'));var authService=require(_0xfb70('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfb70('0x10'));var logger=require(_0xfb70('0x11'))(_0xfb70('0x12'));var utils=require(_0xfb70('0x13'));var config=require(_0xfb70('0x14'));var db=require(_0xfb70('0x15'))['db'];var jayson=require(_0xfb70('0x16'));var client=jayson['client'][_0xfb70('0x17')]({'port':0x232a});function checkPasswordPattern(_0x494043,_0x1894e1,_0x143ff2){if(_0x143ff2){var _0x324441=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x324441[_0xfb70('0x18')](_0x1894e1)){return _0x494043;}else{throw new db[(_0xfb70('0x19'))][(_0xfb70('0x1a'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x494043;}}function respondWithRpcPromise(_0x9f906b,_0x5862f5,_0x14c623,_0x2fbb16){return new BPromise(function(_0x5755f2,_0x17fe8b){var _0x467565=_0x2fbb16||client;return _0x467565[_0xfb70('0x1b')](_0x9f906b,_0x14c623)[_0xfb70('0x1c')](function(_0xf58d4b){logger[_0xfb70('0x1d')](_0xfb70('0x1e'),_0x5862f5,_0xfb70('0x1f'));logger[_0xfb70('0x20')](_0xfb70('0x21'),_0x5862f5,_0xfb70('0x1f'),JSON[_0xfb70('0x22')](_0xf58d4b));if(_0xf58d4b[_0xfb70('0x23')]){if(_0xf58d4b[_0xfb70('0x23')]['code']===0x1f4){logger[_0xfb70('0x23')](_0xfb70('0x1e'),_0x5862f5,_0xf58d4b[_0xfb70('0x23')][_0xfb70('0x24')]);return _0x17fe8b(_0xf58d4b[_0xfb70('0x23')][_0xfb70('0x24')]);}logger[_0xfb70('0x23')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x5862f5,_0xf58d4b[_0xfb70('0x23')]['message']);return _0x5755f2(_0xf58d4b[_0xfb70('0x23')][_0xfb70('0x24')]);}else{logger[_0xfb70('0x1d')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x5862f5,_0xfb70('0x1f'));_0x5755f2(_0xf58d4b['result'][_0xfb70('0x24')]);}})['catch'](function(_0x2c58fb){logger[_0xfb70('0x23')](_0xfb70('0x1e'),_0x5862f5,_0x2c58fb);_0x17fe8b(_0x2c58fb);});});}function respondWithStatusCode(_0x5e3053,_0x2d05e4){_0x2d05e4=_0x2d05e4||0xcc;return function(_0x3043d5){if(_0x3043d5){return _0x5e3053[_0xfb70('0x25')](_0x2d05e4);}return _0x5e3053[_0xfb70('0x26')](_0x2d05e4)[_0xfb70('0x27')]();};}function respondWithResult(_0x4b88a3,_0x575d50){_0x575d50=_0x575d50||0xc8;return function(_0x38ee85){if(_0x38ee85){return _0x4b88a3['status'](_0x575d50)[_0xfb70('0x28')](_0x38ee85);}};}function respondWithFilteredResult(_0x386f71,_0x3145d6){return function(_0x1efb43){if(_0x1efb43){var _0x4171de=_0x1efb43[_0xfb70('0x29')],_0x45d5d2=_0x3145d6[_0xfb70('0x2a')],_0x3b2569=_0x3145d6['offset']+_0x3145d6[_0xfb70('0x2b')],_0x50feee;if(_0x3b2569>=_0x4171de){_0x3b2569=_0x4171de;_0x50feee=0xc8;}else{_0x50feee=0xce;}_0x386f71[_0xfb70('0x26')](_0x50feee);return _0x386f71[_0xfb70('0x2c')](_0xfb70('0x2d'),_0x45d5d2+'-'+_0x3b2569+'/'+_0x4171de)[_0xfb70('0x28')](_0x1efb43);}return null;};}function patchUpdates(_0x5d902e){return function(_0x5161ea){try{jsonpatch[_0xfb70('0x2e')](_0x5161ea,_0x5d902e,!![]);}catch(_0x59e5ec){return BPromise[_0xfb70('0x2f')](_0x59e5ec);}return _0x5161ea[_0xfb70('0x30')]();};}function saveUpdates(_0xb7af46,_0x2457be){return function(_0x285350){if(_0x285350){return _0x285350[_0xfb70('0x31')](_0xb7af46)[_0xfb70('0x1c')](function(_0x19fd88){return _0x19fd88;});}return null;};}function removeEntity(_0x4279ed,_0x4a09cc){return function(_0x5b1e93){if(_0x5b1e93){return _0x5b1e93['destroy']()[_0xfb70('0x1c')](function(){_0x4279ed['status'](0xcc)[_0xfb70('0x27')]();});}};}function handleEntityNotFound(_0x25ca5c,_0x494486){return function(_0x58534d){if(!_0x58534d){_0x25ca5c[_0xfb70('0x25')](0x194);}return _0x58534d;};}function handleError(_0x5b0e73,_0x4bc878){_0x4bc878=_0x4bc878||0x1f4;return function(_0x4b052c){logger['error'](_0x4b052c['stack']);if(_0x4b052c[_0xfb70('0x32')]){delete _0x4b052c[_0xfb70('0x32')];}_0x5b0e73[_0xfb70('0x26')](_0x4bc878)['send'](_0x4b052c);};}exports[_0xfb70('0x33')]=function(_0x488382,_0x508798){var _0x1f5769={},_0x4da184={},_0xb7d30e={'count':0x0,'rows':[]};var _0xca1580=_[_0xfb70('0x34')](db[_0xfb70('0x35')][_0xfb70('0x36')],function(_0x3a5314){return{'name':_0x3a5314['fieldName'],'type':_0x3a5314[_0xfb70('0x37')][_0xfb70('0x38')]};});_0x4da184[_0xfb70('0x39')]=_['map'](_0xca1580,_0xfb70('0x32'));_0x4da184[_0xfb70('0x3a')]=_[_0xfb70('0x3b')](_0x488382[_0xfb70('0x3a')]);_0x4da184['filters']=_[_0xfb70('0x3c')](_0x4da184[_0xfb70('0x39')],_0x4da184[_0xfb70('0x3a')]);_0x1f5769[_0xfb70('0x3d')]=_[_0xfb70('0x3c')](_0x4da184[_0xfb70('0x39')],qs[_0xfb70('0x3e')](_0x488382['query'][_0xfb70('0x3e')]));_0x1f5769['attributes']=_0x1f5769[_0xfb70('0x3d')][_0xfb70('0x3f')]?_0x1f5769[_0xfb70('0x3d')]:_0x4da184[_0xfb70('0x39')];if(!_0x488382['query'][_0xfb70('0x40')]('nolimit')){_0x1f5769['limit']=qs[_0xfb70('0x2b')](_0x488382[_0xfb70('0x3a')]['limit']);_0x1f5769['offset']=qs['offset'](_0x488382[_0xfb70('0x3a')][_0xfb70('0x2a')]);}_0x1f5769[_0xfb70('0x41')]=qs[_0xfb70('0x42')](_0x488382[_0xfb70('0x3a')]['sort']);_0x1f5769['where']=qs['filters'](_['pick'](_0x488382[_0xfb70('0x3a')],_0x4da184[_0xfb70('0x43')]),_0xca1580);if(_0x488382[_0xfb70('0x3a')][_0xfb70('0x44')]){_0x1f5769[_0xfb70('0x45')]=_[_0xfb70('0x46')](_0x1f5769[_0xfb70('0x45')],{'$or':_['map'](_0xca1580,function(_0xd7245a){if(_0xd7245a[_0xfb70('0x37')]!=='VIRTUAL'){var _0x3f6ed6={};_0x3f6ed6[_0xd7245a[_0xfb70('0x32')]]={'$like':'%'+_0x488382[_0xfb70('0x3a')][_0xfb70('0x44')]+'%'};return _0x3f6ed6;}})});}_0x1f5769=_['merge']({},_0x1f5769,_0x488382['options']);var _0x501af1={'where':_0x1f5769[_0xfb70('0x45')]};return db['FreshsalesConfiguration']['count'](_0x501af1)[_0xfb70('0x1c')](function(_0xf4a9c5){_0xb7d30e[_0xfb70('0x29')]=_0xf4a9c5;if(_0x488382['query'][_0xfb70('0x47')]){_0x1f5769[_0xfb70('0x48')]=[{'all':!![]}];}return db[_0xfb70('0x35')]['findAll'](_0x1f5769);})[_0xfb70('0x1c')](function(_0x541891){_0xb7d30e['rows']=_0x541891;return _0xb7d30e;})[_0xfb70('0x1c')](respondWithFilteredResult(_0x508798,_0x1f5769))[_0xfb70('0x49')](handleError(_0x508798,null));};exports['show']=function(_0x16a751,_0x3463a1){var _0xd8ff72={'raw':![],'where':{'id':_0x16a751['params']['id']}},_0xb50d66={};_0xb50d66[_0xfb70('0x39')]=_[_0xfb70('0x3b')](db[_0xfb70('0x35')]['rawAttributes']);_0xb50d66[_0xfb70('0x3a')]=_['keys'](_0x16a751[_0xfb70('0x3a')]);_0xb50d66[_0xfb70('0x43')]=_['intersection'](_0xb50d66[_0xfb70('0x39')],_0xb50d66['query']);_0xd8ff72[_0xfb70('0x3d')]=_[_0xfb70('0x3c')](_0xb50d66['model'],qs[_0xfb70('0x3e')](_0x16a751['query'][_0xfb70('0x3e')]));_0xd8ff72[_0xfb70('0x3d')]=_0xd8ff72[_0xfb70('0x3d')][_0xfb70('0x3f')]?_0xd8ff72[_0xfb70('0x3d')]:_0xb50d66[_0xfb70('0x39')];if(_0x16a751[_0xfb70('0x3a')][_0xfb70('0x47')]){_0xd8ff72[_0xfb70('0x48')]=[{'all':!![]}];}_0xd8ff72=_['merge']({},_0xd8ff72,_0x16a751[_0xfb70('0x4a')]);return db[_0xfb70('0x35')]['find'](_0xd8ff72)[_0xfb70('0x1c')](handleEntityNotFound(_0x3463a1,null))[_0xfb70('0x1c')](respondWithResult(_0x3463a1,null))[_0xfb70('0x49')](handleError(_0x3463a1,null));};exports[_0xfb70('0x4b')]=function(_0x4ffe2c,_0x352e25){return db[_0xfb70('0x35')][_0xfb70('0x4b')](_0x4ffe2c[_0xfb70('0x4c')],{})['then'](respondWithResult(_0x352e25,0xc9))['catch'](handleError(_0x352e25,null));};exports[_0xfb70('0x31')]=function(_0x2be7c7,_0x1eb287){if(_0x2be7c7[_0xfb70('0x4c')]['id']){delete _0x2be7c7[_0xfb70('0x4c')]['id'];}return db[_0xfb70('0x35')][_0xfb70('0x4d')]({'where':{'id':_0x2be7c7[_0xfb70('0x4e')]['id']}})[_0xfb70('0x1c')](handleEntityNotFound(_0x1eb287,null))[_0xfb70('0x1c')](saveUpdates(_0x2be7c7[_0xfb70('0x4c')],null))[_0xfb70('0x1c')](respondWithResult(_0x1eb287,null))['catch'](handleError(_0x1eb287,null));};exports[_0xfb70('0x4f')]=function(_0x4bb011,_0x1192c2){return db[_0xfb70('0x35')][_0xfb70('0x4d')]({'where':{'id':_0x4bb011[_0xfb70('0x4e')]['id']}})[_0xfb70('0x1c')](handleEntityNotFound(_0x1192c2,null))[_0xfb70('0x1c')](removeEntity(_0x1192c2,null))[_0xfb70('0x49')](handleError(_0x1192c2,null));};exports[_0xfb70('0x50')]=function(_0x276965,_0x56509a,_0x262b6e){var _0x380d97={};var _0x31c0a0={};var _0x47849d;var _0x47b8b7;return db['FreshsalesConfiguration'][_0xfb70('0x51')]({'where':{'id':_0x276965[_0xfb70('0x4e')]['id']}})[_0xfb70('0x1c')](handleEntityNotFound(_0x56509a,null))['then'](function(_0x3f039b){if(_0x3f039b){_0x47849d=_0x3f039b;_0x31c0a0[_0xfb70('0x39')]=_[_0xfb70('0x3b')](db[_0xfb70('0x52')][_0xfb70('0x36')]);_0x31c0a0['query']=_[_0xfb70('0x3b')](_0x276965[_0xfb70('0x3a')]);_0x31c0a0[_0xfb70('0x43')]=_[_0xfb70('0x3c')](_0x31c0a0[_0xfb70('0x39')],_0x31c0a0['query']);_0x380d97[_0xfb70('0x3d')]=_[_0xfb70('0x3c')](_0x31c0a0[_0xfb70('0x39')],qs['fields'](_0x276965[_0xfb70('0x3a')][_0xfb70('0x3e')]));_0x380d97['attributes']=_0x380d97[_0xfb70('0x3d')][_0xfb70('0x3f')]?_0x380d97[_0xfb70('0x3d')]:_0x31c0a0[_0xfb70('0x39')];_0x380d97[_0xfb70('0x41')]=qs[_0xfb70('0x42')](_0x276965[_0xfb70('0x3a')]['sort']);_0x380d97[_0xfb70('0x45')]=qs[_0xfb70('0x43')](_[_0xfb70('0x53')](_0x276965[_0xfb70('0x3a')],_0x31c0a0[_0xfb70('0x43')]));if(_0x276965[_0xfb70('0x3a')][_0xfb70('0x44')]){_0x380d97[_0xfb70('0x45')]=_['merge'](_0x380d97[_0xfb70('0x45')],{'$or':_[_0xfb70('0x34')](_0x380d97[_0xfb70('0x3d')],function(_0x550272){var _0x492fff={};_0x492fff[_0x550272]={'$like':'%'+_0x276965[_0xfb70('0x3a')][_0xfb70('0x44')]+'%'};return _0x492fff;})});}_0x380d97=_[_0xfb70('0x46')]({},_0x380d97,_0x276965[_0xfb70('0x4a')]);return _0x47849d[_0xfb70('0x50')](_0x380d97);}})[_0xfb70('0x1c')](function(_0x343268){if(_0x343268){_0x47b8b7=_0x343268[_0xfb70('0x3f')];if(!_0x276965[_0xfb70('0x3a')]['hasOwnProperty'](_0xfb70('0x54'))){_0x380d97[_0xfb70('0x2b')]=qs['limit'](_0x276965[_0xfb70('0x3a')]['limit']);_0x380d97[_0xfb70('0x2a')]=qs[_0xfb70('0x2a')](_0x276965['query']['offset']);}return _0x47849d[_0xfb70('0x50')](_0x380d97);}})['then'](function(_0x2e334c){if(_0x2e334c){return _0x2e334c?{'count':_0x47b8b7,'rows':_0x2e334c}:null;}})[_0xfb70('0x1c')](respondWithResult(_0x56509a,null))[_0xfb70('0x49')](handleError(_0x56509a,null));};exports[_0xfb70('0x55')]=function(_0xe90e9c,_0x52c388,_0x3bd4c9){var _0x14f75d={};var _0x109d8a={};var _0x177b57;var _0x5e35df;return db[_0xfb70('0x35')][_0xfb70('0x51')]({'where':{'id':_0xe90e9c['params']['id']}})[_0xfb70('0x1c')](handleEntityNotFound(_0x52c388,null))[_0xfb70('0x1c')](function(_0x21dcdf){if(_0x21dcdf){_0x177b57=_0x21dcdf;_0x109d8a[_0xfb70('0x39')]=_[_0xfb70('0x3b')](db[_0xfb70('0x52')]['rawAttributes']);_0x109d8a[_0xfb70('0x3a')]=_[_0xfb70('0x3b')](_0xe90e9c['query']);_0x109d8a[_0xfb70('0x43')]=_[_0xfb70('0x3c')](_0x109d8a[_0xfb70('0x39')],_0x109d8a[_0xfb70('0x3a')]);_0x14f75d[_0xfb70('0x3d')]=_['intersection'](_0x109d8a['model'],qs[_0xfb70('0x3e')](_0xe90e9c[_0xfb70('0x3a')][_0xfb70('0x3e')]));_0x14f75d[_0xfb70('0x3d')]=_0x14f75d['attributes'][_0xfb70('0x3f')]?_0x14f75d['attributes']:_0x109d8a[_0xfb70('0x39')];_0x14f75d['order']=qs[_0xfb70('0x42')](_0xe90e9c['query'][_0xfb70('0x42')]);_0x14f75d[_0xfb70('0x45')]=qs[_0xfb70('0x43')](_[_0xfb70('0x53')](_0xe90e9c[_0xfb70('0x3a')],_0x109d8a[_0xfb70('0x43')]));if(_0xe90e9c[_0xfb70('0x3a')][_0xfb70('0x44')]){_0x14f75d['where']=_[_0xfb70('0x46')](_0x14f75d[_0xfb70('0x45')],{'$or':_[_0xfb70('0x34')](_0x14f75d[_0xfb70('0x3d')],function(_0x38ca44){var _0x48ddbc={};_0x48ddbc[_0x38ca44]={'$like':'%'+_0xe90e9c['query'][_0xfb70('0x44')]+'%'};return _0x48ddbc;})});}_0x14f75d=_[_0xfb70('0x46')]({},_0x14f75d,_0xe90e9c[_0xfb70('0x4a')]);return _0x177b57[_0xfb70('0x55')](_0x14f75d);}})[_0xfb70('0x1c')](function(_0x145155){if(_0x145155){_0x5e35df=_0x145155[_0xfb70('0x3f')];if(!_0xe90e9c['query'][_0xfb70('0x40')]('nolimit')){_0x14f75d[_0xfb70('0x2b')]=qs[_0xfb70('0x2b')](_0xe90e9c['query'][_0xfb70('0x2b')]);_0x14f75d[_0xfb70('0x2a')]=qs['offset'](_0xe90e9c[_0xfb70('0x3a')][_0xfb70('0x2a')]);}return _0x177b57[_0xfb70('0x55')](_0x14f75d);}})[_0xfb70('0x1c')](function(_0x1ed179){if(_0x1ed179){return _0x1ed179?{'count':_0x5e35df,'rows':_0x1ed179}:null;}})[_0xfb70('0x1c')](respondWithResult(_0x52c388,null))['catch'](handleError(_0x52c388,null));};exports[_0xfb70('0x56')]=function(_0x10dd32,_0x445727,_0x5441f6){var _0x1a27aa={};var _0x6a49a0={};var _0x544eac;var _0x44c45e;return db[_0xfb70('0x35')][_0xfb70('0x51')]({'where':{'id':_0x10dd32['params']['id']}})[_0xfb70('0x1c')](handleEntityNotFound(_0x445727,null))[_0xfb70('0x1c')](function(_0x539dcb){if(_0x539dcb){_0x544eac=_0x539dcb;_0x6a49a0[_0xfb70('0x39')]=_[_0xfb70('0x3b')](db[_0xfb70('0x52')]['rawAttributes']);_0x6a49a0['query']=_[_0xfb70('0x3b')](_0x10dd32[_0xfb70('0x3a')]);_0x6a49a0[_0xfb70('0x43')]=_['intersection'](_0x6a49a0[_0xfb70('0x39')],_0x6a49a0[_0xfb70('0x3a')]);_0x1a27aa[_0xfb70('0x3d')]=_['intersection'](_0x6a49a0[_0xfb70('0x39')],qs[_0xfb70('0x3e')](_0x10dd32[_0xfb70('0x3a')][_0xfb70('0x3e')]));_0x1a27aa[_0xfb70('0x3d')]=_0x1a27aa['attributes'][_0xfb70('0x3f')]?_0x1a27aa[_0xfb70('0x3d')]:_0x6a49a0[_0xfb70('0x39')];_0x1a27aa[_0xfb70('0x41')]=qs['sort'](_0x10dd32[_0xfb70('0x3a')][_0xfb70('0x42')]);_0x1a27aa[_0xfb70('0x45')]=qs['filters'](_[_0xfb70('0x53')](_0x10dd32['query'],_0x6a49a0[_0xfb70('0x43')]));if(_0x10dd32[_0xfb70('0x3a')][_0xfb70('0x44')]){_0x1a27aa[_0xfb70('0x45')]=_[_0xfb70('0x46')](_0x1a27aa[_0xfb70('0x45')],{'$or':_[_0xfb70('0x34')](_0x1a27aa['attributes'],function(_0x479a87){var _0x11c0ec={};_0x11c0ec[_0x479a87]={'$like':'%'+_0x10dd32[_0xfb70('0x3a')][_0xfb70('0x44')]+'%'};return _0x11c0ec;})});}_0x1a27aa=_[_0xfb70('0x46')]({},_0x1a27aa,_0x10dd32[_0xfb70('0x4a')]);return _0x544eac[_0xfb70('0x56')](_0x1a27aa);}})[_0xfb70('0x1c')](function(_0x1ce988){if(_0x1ce988){_0x44c45e=_0x1ce988['length'];if(!_0x10dd32['query'][_0xfb70('0x40')](_0xfb70('0x54'))){_0x1a27aa['limit']=qs[_0xfb70('0x2b')](_0x10dd32[_0xfb70('0x3a')][_0xfb70('0x2b')]);_0x1a27aa[_0xfb70('0x2a')]=qs[_0xfb70('0x2a')](_0x10dd32[_0xfb70('0x3a')]['offset']);}return _0x544eac[_0xfb70('0x56')](_0x1a27aa);}})['then'](function(_0xf1d1a6){if(_0xf1d1a6){return _0xf1d1a6?{'count':_0x44c45e,'rows':_0xf1d1a6}:null;}})['then'](respondWithResult(_0x445727,null))['catch'](handleError(_0x445727,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index a994176..8c14abe 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 _0xc112=['FreshsalesConfiguration','int_freshsales_configurations','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','exports'];(function(_0x47e7cb,_0x4c1b8d){var _0x2a8874=function(_0x36498f){while(--_0x36498f){_0x47e7cb['push'](_0x47e7cb['shift']());}};_0x2a8874(++_0x4c1b8d);}(_0xc112,0xec));var _0x2c11=function(_0x5330e2,_0x50f2e1){_0x5330e2=_0x5330e2-0x0;var _0x3aa07a=_0xc112[_0x5330e2];return _0x3aa07a;};'use strict';var _=require(_0x2c11('0x0'));var util=require(_0x2c11('0x1'));var logger=require(_0x2c11('0x2'))('api');var moment=require(_0x2c11('0x3'));var BPromise=require(_0x2c11('0x4'));var rp=require(_0x2c11('0x5'));var fs=require('fs');var path=require(_0x2c11('0x6'));var rimraf=require(_0x2c11('0x7'));var config=require(_0x2c11('0x8'));var attributes=require(_0x2c11('0x9'));module[_0x2c11('0xa')]=function(_0x2337d0,_0x5c4748){return _0x2337d0['define'](_0x2c11('0xb'),attributes,{'tableName':_0x2c11('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x61be=['int_freshsales_configurations','lodash','util','../../config/logger','bluebird','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','exports','define'];(function(_0x5575d9,_0x1fcd37){var _0x24c468=function(_0x3f8c77){while(--_0x3f8c77){_0x5575d9['push'](_0x5575d9['shift']());}};_0x24c468(++_0x1fcd37);}(_0x61be,0x1d7));var _0xe61b=function(_0x28638e,_0x30c330){_0x28638e=_0x28638e-0x0;var _0x20a408=_0x61be[_0x28638e];return _0x20a408;};'use strict';var _=require(_0xe61b('0x0'));var util=require(_0xe61b('0x1'));var logger=require(_0xe61b('0x2'))('api');var moment=require('moment');var BPromise=require(_0xe61b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xe61b('0x4'));var config=require(_0xe61b('0x5'));var attributes=require(_0xe61b('0x6'));module[_0xe61b('0x7')]=function(_0x5850c7,_0x4d218f){return _0x5850c7[_0xe61b('0x8')]('FreshsalesConfiguration',attributes,{'tableName':_0xe61b('0x9'),'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 dbf5851..98e6403 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 _0x74f4=['rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','FreshsalesConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger'];(function(_0x3a1e6b,_0x11b50a){var _0x2611ee=function(_0x4f8a49){while(--_0x4f8a49){_0x3a1e6b['push'](_0x3a1e6b['shift']());}};_0x2611ee(++_0x11b50a);}(_0x74f4,0xaa));var _0x474f=function(_0x39c745,_0xa4b72a){_0x39c745=_0x39c745-0x0;var _0x3b4c9c=_0x74f4[_0x39c745];return _0x3b4c9c;};'use strict';var _=require(_0x474f('0x0'));var util=require(_0x474f('0x1'));var moment=require('moment');var BPromise=require(_0x474f('0x2'));var rs=require(_0x474f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x474f('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x474f('0x5'))(_0x474f('0x6'));var config=require(_0x474f('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x474f('0x8')][_0x474f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3344a5,_0x23c5ce,_0x25e3f2){return new BPromise(function(_0x461707,_0x18fdc1){return client[_0x474f('0xa')](_0x3344a5,_0x25e3f2)[_0x474f('0xb')](function(_0x322d95){logger[_0x474f('0xc')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x23c5ce,_0x474f('0xd'));logger[_0x474f('0xe')](_0x474f('0xf'),_0x23c5ce,'request\x20sent',JSON[_0x474f('0x10')](_0x322d95));if(_0x322d95[_0x474f('0x11')]){if(_0x322d95[_0x474f('0x11')]['code']===0x1f4){logger[_0x474f('0x11')](_0x474f('0x12'),_0x23c5ce,_0x322d95['error'][_0x474f('0x13')]);return _0x18fdc1(_0x322d95[_0x474f('0x11')][_0x474f('0x13')]);}logger['error'](_0x474f('0x12'),_0x23c5ce,_0x322d95[_0x474f('0x11')][_0x474f('0x13')]);return _0x461707(_0x322d95[_0x474f('0x11')][_0x474f('0x13')]);}else{logger[_0x474f('0xc')](_0x474f('0x12'),_0x23c5ce,'request\x20sent');_0x461707(_0x322d95[_0x474f('0x14')]['message']);}})[_0x474f('0x15')](function(_0xb8d368){logger['error'](_0x474f('0x12'),_0x23c5ce,_0xb8d368);_0x18fdc1(_0xb8d368);});});} \ No newline at end of file +var _0xcb10=['info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x310d10,_0x3fe887){var _0x1fb8af=function(_0x42965b){while(--_0x42965b){_0x310d10['push'](_0x310d10['shift']());}};_0x1fb8af(++_0x3fe887);}(_0xcb10,0x104));var _0x0cb1=function(_0x344a3f,_0x579a22){_0x344a3f=_0x344a3f-0x0;var _0x264712=_0xcb10[_0x344a3f];return _0x264712;};'use strict';var _=require(_0x0cb1('0x0'));var util=require(_0x0cb1('0x1'));var moment=require('moment');var BPromise=require(_0x0cb1('0x2'));var rs=require(_0x0cb1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0cb1('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x0cb1('0x5'))(_0x0cb1('0x6'));var config=require(_0x0cb1('0x7'));var jayson=require(_0x0cb1('0x8'));var client=jayson[_0x0cb1('0x9')][_0x0cb1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x390335,_0xdda18c,_0x575138){return new BPromise(function(_0x43620c,_0x1f815e){return client[_0x0cb1('0xb')](_0x390335,_0x575138)[_0x0cb1('0xc')](function(_0x41e0d2){logger[_0x0cb1('0xd')](_0x0cb1('0xe'),_0xdda18c,'request\x20sent');logger['debug']('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0xdda18c,_0x0cb1('0xf'),JSON[_0x0cb1('0x10')](_0x41e0d2));if(_0x41e0d2['error']){if(_0x41e0d2['error']['code']===0x1f4){logger[_0x0cb1('0x11')]('FreshsalesConfiguration,\x20%s,\x20%s',_0xdda18c,_0x41e0d2[_0x0cb1('0x11')][_0x0cb1('0x12')]);return _0x1f815e(_0x41e0d2[_0x0cb1('0x11')][_0x0cb1('0x12')]);}logger[_0x0cb1('0x11')](_0x0cb1('0xe'),_0xdda18c,_0x41e0d2['error'][_0x0cb1('0x12')]);return _0x43620c(_0x41e0d2[_0x0cb1('0x11')]['message']);}else{logger[_0x0cb1('0xd')]('FreshsalesConfiguration,\x20%s,\x20%s',_0xdda18c,_0x0cb1('0xf'));_0x43620c(_0x41e0d2[_0x0cb1('0x13')]['message']);}})[_0x0cb1('0x14')](function(_0x24315d){logger[_0x0cb1('0x11')](_0x0cb1('0xe'),_0xdda18c,_0x24315d);_0x1f815e(_0x24315d);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 49284ed..2c992c8 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 _0x6609=['get','isAuthenticated','index','/:id','show','create','update','delete','exports','multer','util','path','express','Router','../../components/auth/service','../../config/environment','./intFreshsalesField.controller'];(function(_0xe3839f,_0x555463){var _0x43c987=function(_0x4a592f){while(--_0x4a592f){_0xe3839f['push'](_0xe3839f['shift']());}};_0x43c987(++_0x555463);}(_0x6609,0x6f));var _0x9660=function(_0x62502c,_0x449075){_0x62502c=_0x62502c-0x0;var _0x27b804=_0x6609[_0x62502c];return _0x27b804;};'use strict';var multer=require(_0x9660('0x0'));var util=require(_0x9660('0x1'));var path=require(_0x9660('0x2'));var timeout=require('connect-timeout');var express=require(_0x9660('0x3'));var router=express[_0x9660('0x4')]();var auth=require(_0x9660('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x9660('0x6'));var controller=require(_0x9660('0x7'));router[_0x9660('0x8')]('/',auth[_0x9660('0x9')](),controller[_0x9660('0xa')]);router[_0x9660('0x8')](_0x9660('0xb'),auth['isAuthenticated'](),controller[_0x9660('0xc')]);router['post']('/',auth[_0x9660('0x9')](),controller[_0x9660('0xd')]);router['put'](_0x9660('0xb'),auth['isAuthenticated'](),controller[_0x9660('0xe')]);router[_0x9660('0xf')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x9660('0x10')]=router; \ No newline at end of file +var _0x933c=['exports','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','/:id','show','post','put','update','delete','destroy'];(function(_0x5b24e7,_0x459f2a){var _0x215179=function(_0x5dc444){while(--_0x5dc444){_0x5b24e7['push'](_0x5b24e7['shift']());}};_0x215179(++_0x459f2a);}(_0x933c,0x166));var _0xc933=function(_0x369fc5,_0x5b07e0){_0x369fc5=_0x369fc5-0x0;var _0x28c0e9=_0x933c[_0x369fc5];return _0x28c0e9;};'use strict';var multer=require('multer');var util=require(_0xc933('0x0'));var path=require(_0xc933('0x1'));var timeout=require(_0xc933('0x2'));var express=require(_0xc933('0x3'));var router=express['Router']();var auth=require(_0xc933('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xc933('0x5'));var controller=require(_0xc933('0x6'));router[_0xc933('0x7')]('/',auth[_0xc933('0x8')](),controller['index']);router[_0xc933('0x7')](_0xc933('0x9'),auth[_0xc933('0x8')](),controller[_0xc933('0xa')]);router[_0xc933('0xb')]('/',auth[_0xc933('0x8')](),controller['create']);router[_0xc933('0xc')](_0xc933('0x9'),auth[_0xc933('0x8')](),controller[_0xc933('0xd')]);router[_0xc933('0xe')](_0xc933('0x9'),auth[_0xc933('0x8')](),controller[_0xc933('0xf')]);module[_0xc933('0x10')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 2a4791a..b7beed0 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 _0x69a1=['string','customVariable','keyValue','STRING','BOOLEAN','sequelize','exports','ENUM'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0x69a1,0x95));var _0x169a=function(_0x428565,_0x5790b6){_0x428565=_0x428565-0x0;var _0x4e6fcc=_0x69a1[_0x428565];return _0x4e6fcc;};'use strict';var Sequelize=require(_0x169a('0x0'));module[_0x169a('0x1')]={'type':{'type':Sequelize[_0x169a('0x2')](_0x169a('0x3'),'variable',_0x169a('0x4'),_0x169a('0x5')),'defaultValue':_0x169a('0x3')},'content':{'type':Sequelize[_0x169a('0x6')]},'key':{'type':Sequelize[_0x169a('0x6')]},'keyType':{'type':Sequelize[_0x169a('0x2')]('string','variable','customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x169a('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x169a('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x169a('0x6')]}}; \ No newline at end of file +var _0x0cc3=['keyValue','STRING','ENUM','sequelize','string','customVariable'];(function(_0x4c6930,_0x26bf20){var _0x1ca6ba=function(_0x2e11fe){while(--_0x2e11fe){_0x4c6930['push'](_0x4c6930['shift']());}};_0x1ca6ba(++_0x26bf20);}(_0x0cc3,0x195));var _0x30cc=function(_0x48fd8c,_0x14995f){_0x48fd8c=_0x48fd8c-0x0;var _0x3c1748=_0x0cc3[_0x48fd8c];return _0x3c1748;};'use strict';var Sequelize=require(_0x30cc('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0x30cc('0x1'),'variable',_0x30cc('0x2'),_0x30cc('0x3')),'defaultValue':_0x30cc('0x1')},'content':{'type':Sequelize[_0x30cc('0x4')]},'key':{'type':Sequelize[_0x30cc('0x4')]},'keyType':{'type':Sequelize[_0x30cc('0x5')](_0x30cc('0x1'),'variable',_0x30cc('0x2'))},'keyContent':{'type':Sequelize[_0x30cc('0x4')]},'idField':{'type':Sequelize[_0x30cc('0x4')]},'nameField':{'type':Sequelize[_0x30cc('0x4')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x30cc('0x4')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 09a3503..ae88ea3 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 _0x78a9=['../../config/license/hardware','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','map','FreshsalesField','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','VIRTUAL','filter','merge','options','includeAll','include','rows','catch','show','keys','find','create','update','body','params','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch'];(function(_0xb21c94,_0xe3ef87){var _0x4bfab5=function(_0x5b6f7){while(--_0x5b6f7){_0xb21c94['push'](_0xb21c94['shift']());}};_0x4bfab5(++_0xe3ef87);}(_0x78a9,0x112));var _0x978a=function(_0x4f1101,_0x5eea42){_0x4f1101=_0x4f1101-0x0;var _0x55f79a=_0x78a9[_0x4f1101];return _0x55f79a;};'use strict';var pdf=require(_0x978a('0x0'));var emlformat=require(_0x978a('0x1'));var rimraf=require(_0x978a('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x978a('0x3'));var rp=require(_0x978a('0x4'));var moment=require(_0x978a('0x5'));var BPromise=require(_0x978a('0x6'));var Mustache=require(_0x978a('0x7'));var util=require(_0x978a('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x978a('0x9'));var ejs=require(_0x978a('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x978a('0xb'));var crypto=require('crypto');var jsforce=require(_0x978a('0xc'));var deskjs=require(_0x978a('0xd'));var toCsv=require('to-csv');var querystring=require(_0x978a('0xe'));var Papa=require(_0x978a('0xf'));var Redis=require(_0x978a('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x978a('0x11'));var hardwareService=require(_0x978a('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x978a('0x13'));var config=require(_0x978a('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x28ef9d,_0x18e826){_0x18e826=_0x18e826||0xcc;return function(_0x16604e){if(_0x16604e){return _0x28ef9d[_0x978a('0x15')](_0x18e826);}return _0x28ef9d[_0x978a('0x16')](_0x18e826)[_0x978a('0x17')]();};}function respondWithResult(_0x268335,_0x50ffe1){_0x50ffe1=_0x50ffe1||0xc8;return function(_0x4dac47){if(_0x4dac47){return _0x268335['status'](_0x50ffe1)[_0x978a('0x18')](_0x4dac47);}};}function respondWithFilteredResult(_0x2c219b,_0x300159){return function(_0x56602e){if(_0x56602e){var _0x198584=_0x56602e[_0x978a('0x19')],_0x5c1f43=_0x300159[_0x978a('0x1a')],_0x5c852f=_0x300159['offset']+_0x300159[_0x978a('0x1b')],_0x41536d;if(_0x5c852f>=_0x198584){_0x5c852f=_0x198584;_0x41536d=0xc8;}else{_0x41536d=0xce;}_0x2c219b[_0x978a('0x16')](_0x41536d);return _0x2c219b[_0x978a('0x1c')](_0x978a('0x1d'),_0x5c1f43+'-'+_0x5c852f+'/'+_0x198584)[_0x978a('0x18')](_0x56602e);}return null;};}function patchUpdates(_0x41a5ee){return function(_0x3ebce8){try{jsonpatch[_0x978a('0x1e')](_0x3ebce8,_0x41a5ee,!![]);}catch(_0x185c94){return BPromise[_0x978a('0x1f')](_0x185c94);}return _0x3ebce8[_0x978a('0x20')]();};}function saveUpdates(_0x2b6f09,_0x5cc99e){return function(_0x1b99f5){if(_0x1b99f5){return _0x1b99f5['update'](_0x2b6f09)[_0x978a('0x21')](function(_0x280cb7){return _0x280cb7;});}return null;};}function removeEntity(_0x2aacef,_0x49993b){return function(_0xa45de8){if(_0xa45de8){return _0xa45de8[_0x978a('0x22')]()[_0x978a('0x21')](function(){_0x2aacef[_0x978a('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x32baab,_0x57bd98){return function(_0x3e070e){if(!_0x3e070e){_0x32baab[_0x978a('0x15')](0x194);}return _0x3e070e;};}function handleError(_0x27c86b,_0x46934d){_0x46934d=_0x46934d||0x1f4;return function(_0x3601fe){logger[_0x978a('0x23')](_0x3601fe[_0x978a('0x24')]);if(_0x3601fe[_0x978a('0x25')]){delete _0x3601fe[_0x978a('0x25')];}_0x27c86b[_0x978a('0x16')](_0x46934d)[_0x978a('0x26')](_0x3601fe);};}exports['index']=function(_0x445ae0,_0x38235b){var _0x1594f2={},_0x43e646={},_0x19f410={'count':0x0,'rows':[]};var _0xc040e9=_[_0x978a('0x27')](db[_0x978a('0x28')][_0x978a('0x29')],function(_0x51ecf0){return{'name':_0x51ecf0[_0x978a('0x2a')],'type':_0x51ecf0[_0x978a('0x2b')][_0x978a('0x2c')]};});_0x43e646[_0x978a('0x2d')]=_[_0x978a('0x27')](_0xc040e9,_0x978a('0x25'));_0x43e646[_0x978a('0x2e')]=_['keys'](_0x445ae0['query']);_0x43e646[_0x978a('0x2f')]=_[_0x978a('0x30')](_0x43e646['model'],_0x43e646['query']);_0x1594f2[_0x978a('0x31')]=_[_0x978a('0x30')](_0x43e646[_0x978a('0x2d')],qs[_0x978a('0x32')](_0x445ae0['query'][_0x978a('0x32')]));_0x1594f2[_0x978a('0x31')]=_0x1594f2[_0x978a('0x31')][_0x978a('0x33')]?_0x1594f2[_0x978a('0x31')]:_0x43e646[_0x978a('0x2d')];if(!_0x445ae0[_0x978a('0x2e')][_0x978a('0x34')](_0x978a('0x35'))){_0x1594f2['limit']=qs['limit'](_0x445ae0[_0x978a('0x2e')][_0x978a('0x1b')]);_0x1594f2[_0x978a('0x1a')]=qs[_0x978a('0x1a')](_0x445ae0[_0x978a('0x2e')][_0x978a('0x1a')]);}_0x1594f2[_0x978a('0x36')]=qs[_0x978a('0x37')](_0x445ae0[_0x978a('0x2e')][_0x978a('0x37')]);_0x1594f2['where']=qs[_0x978a('0x2f')](_[_0x978a('0x38')](_0x445ae0[_0x978a('0x2e')],_0x43e646[_0x978a('0x2f')]),_0xc040e9);if(_0x445ae0['query']['filter']){_0x1594f2[_0x978a('0x39')]=_['merge'](_0x1594f2[_0x978a('0x39')],{'$or':_[_0x978a('0x27')](_0xc040e9,function(_0x11cb00){if(_0x11cb00[_0x978a('0x2b')]!==_0x978a('0x3a')){var _0x1c16f0={};_0x1c16f0[_0x11cb00[_0x978a('0x25')]]={'$like':'%'+_0x445ae0[_0x978a('0x2e')][_0x978a('0x3b')]+'%'};return _0x1c16f0;}})});}_0x1594f2=_[_0x978a('0x3c')]({},_0x1594f2,_0x445ae0[_0x978a('0x3d')]);var _0x152584={'where':_0x1594f2[_0x978a('0x39')]};return db[_0x978a('0x28')]['count'](_0x152584)[_0x978a('0x21')](function(_0x477953){_0x19f410[_0x978a('0x19')]=_0x477953;if(_0x445ae0[_0x978a('0x2e')][_0x978a('0x3e')]){_0x1594f2[_0x978a('0x3f')]=[{'all':!![]}];}return db[_0x978a('0x28')]['findAll'](_0x1594f2);})[_0x978a('0x21')](function(_0x1e3ea9){_0x19f410[_0x978a('0x40')]=_0x1e3ea9;return _0x19f410;})['then'](respondWithFilteredResult(_0x38235b,_0x1594f2))[_0x978a('0x41')](handleError(_0x38235b,null));};exports[_0x978a('0x42')]=function(_0x1e5d46,_0x22bad0){var _0x5a90e5={'raw':!![],'where':{'id':_0x1e5d46['params']['id']}},_0x379e93={};_0x379e93[_0x978a('0x2d')]=_[_0x978a('0x43')](db[_0x978a('0x28')]['rawAttributes']);_0x379e93[_0x978a('0x2e')]=_[_0x978a('0x43')](_0x1e5d46[_0x978a('0x2e')]);_0x379e93[_0x978a('0x2f')]=_[_0x978a('0x30')](_0x379e93['model'],_0x379e93['query']);_0x5a90e5[_0x978a('0x31')]=_[_0x978a('0x30')](_0x379e93[_0x978a('0x2d')],qs[_0x978a('0x32')](_0x1e5d46[_0x978a('0x2e')]['fields']));_0x5a90e5[_0x978a('0x31')]=_0x5a90e5[_0x978a('0x31')][_0x978a('0x33')]?_0x5a90e5[_0x978a('0x31')]:_0x379e93[_0x978a('0x2d')];if(_0x1e5d46[_0x978a('0x2e')]['includeAll']){_0x5a90e5[_0x978a('0x3f')]=[{'all':!![]}];}_0x5a90e5=_[_0x978a('0x3c')]({},_0x5a90e5,_0x1e5d46['options']);return db[_0x978a('0x28')][_0x978a('0x44')](_0x5a90e5)[_0x978a('0x21')](handleEntityNotFound(_0x22bad0,null))[_0x978a('0x21')](respondWithResult(_0x22bad0,null))[_0x978a('0x41')](handleError(_0x22bad0,null));};exports[_0x978a('0x45')]=function(_0x24e861,_0xf4987a){return db[_0x978a('0x28')]['create'](_0x24e861['body'],{})[_0x978a('0x21')](respondWithResult(_0xf4987a,0xc9))['catch'](handleError(_0xf4987a,null));};exports[_0x978a('0x46')]=function(_0x22c180,_0x23e8ed){if(_0x22c180['body']['id']){delete _0x22c180[_0x978a('0x47')]['id'];}return db[_0x978a('0x28')][_0x978a('0x44')]({'where':{'id':_0x22c180[_0x978a('0x48')]['id']}})['then'](handleEntityNotFound(_0x23e8ed,null))[_0x978a('0x21')](saveUpdates(_0x22c180[_0x978a('0x47')],null))['then'](respondWithResult(_0x23e8ed,null))[_0x978a('0x41')](handleError(_0x23e8ed,null));};exports[_0x978a('0x22')]=function(_0x1292f0,_0x4a28fb){return db[_0x978a('0x28')]['find']({'where':{'id':_0x1292f0[_0x978a('0x48')]['id']}})[_0x978a('0x21')](handleEntityNotFound(_0x4a28fb,null))[_0x978a('0x21')](removeEntity(_0x4a28fb,null))['catch'](handleError(_0x4a28fb,null));}; \ No newline at end of file +var _0x5419=['body','find','html-pdf','eml-format','zip-dir','path','sox','to-csv','ejs','squel','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','filter','where','VIRTUAL','merge','options','FreshsalesField','include','findAll','rows','catch','show','params','includeAll','create'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x5419,0x194));var _0x9541=function(_0x2f06b3,_0x12feb6){_0x2f06b3=_0x2f06b3-0x0;var _0x270d4d=_0x5419[_0x2f06b3];return _0x270d4d;};'use strict';var pdf=require(_0x9541('0x0'));var emlformat=require(_0x9541('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x9541('0x2'));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(_0x9541('0x3'));var sox=require(_0x9541('0x4'));var csv=require(_0x9541('0x5'));var ejs=require(_0x9541('0x6'));var fs=require('fs');var _=require('lodash');var squel=require(_0x9541('0x7'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x9541('0x8'));var toCsv=require(_0x9541('0x5'));var querystring=require(_0x9541('0x9'));var Papa=require('papaparse');var Redis=require(_0x9541('0xa'));var authService=require('../../components/auth/service');var qs=require(_0x9541('0xb'));var as=require(_0x9541('0xc'));var hardwareService=require(_0x9541('0xd'));var logger=require(_0x9541('0xe'))(_0x9541('0xf'));var utils=require(_0x9541('0x10'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1ad307,_0x4c0fa7){_0x4c0fa7=_0x4c0fa7||0xcc;return function(_0x8958b0){if(_0x8958b0){return _0x1ad307['sendStatus'](_0x4c0fa7);}return _0x1ad307[_0x9541('0x11')](_0x4c0fa7)[_0x9541('0x12')]();};}function respondWithResult(_0x4c08bf,_0x5f2fd3){_0x5f2fd3=_0x5f2fd3||0xc8;return function(_0x4dd8a8){if(_0x4dd8a8){return _0x4c08bf['status'](_0x5f2fd3)[_0x9541('0x13')](_0x4dd8a8);}};}function respondWithFilteredResult(_0x7eb3fa,_0x38ac92){return function(_0x3b5fb8){if(_0x3b5fb8){var _0x2c2685=_0x3b5fb8[_0x9541('0x14')],_0x15eac7=_0x38ac92[_0x9541('0x15')],_0x388ef5=_0x38ac92[_0x9541('0x15')]+_0x38ac92[_0x9541('0x16')],_0x57a108;if(_0x388ef5>=_0x2c2685){_0x388ef5=_0x2c2685;_0x57a108=0xc8;}else{_0x57a108=0xce;}_0x7eb3fa[_0x9541('0x11')](_0x57a108);return _0x7eb3fa[_0x9541('0x17')](_0x9541('0x18'),_0x15eac7+'-'+_0x388ef5+'/'+_0x2c2685)[_0x9541('0x13')](_0x3b5fb8);}return null;};}function patchUpdates(_0x568300){return function(_0x2c544d){try{jsonpatch[_0x9541('0x19')](_0x2c544d,_0x568300,!![]);}catch(_0x5dda16){return BPromise[_0x9541('0x1a')](_0x5dda16);}return _0x2c544d[_0x9541('0x1b')]();};}function saveUpdates(_0x248304,_0x56ec79){return function(_0x3f360a){if(_0x3f360a){return _0x3f360a[_0x9541('0x1c')](_0x248304)[_0x9541('0x1d')](function(_0x5695c6){return _0x5695c6;});}return null;};}function removeEntity(_0x236f96,_0xaaa82f){return function(_0x395bef){if(_0x395bef){return _0x395bef[_0x9541('0x1e')]()[_0x9541('0x1d')](function(){_0x236f96[_0x9541('0x11')](0xcc)[_0x9541('0x12')]();});}};}function handleEntityNotFound(_0x2db447,_0x1762c7){return function(_0x2e4449){if(!_0x2e4449){_0x2db447['sendStatus'](0x194);}return _0x2e4449;};}function handleError(_0x39c30d,_0x949a18){_0x949a18=_0x949a18||0x1f4;return function(_0x286281){logger['error'](_0x286281[_0x9541('0x1f')]);if(_0x286281[_0x9541('0x20')]){delete _0x286281['name'];}_0x39c30d['status'](_0x949a18)[_0x9541('0x21')](_0x286281);};}exports[_0x9541('0x22')]=function(_0x16e782,_0x269a48){var _0x25c6ea={},_0x318553={},_0x441c6e={'count':0x0,'rows':[]};var _0x5a7974=_[_0x9541('0x23')](db['FreshsalesField'][_0x9541('0x24')],function(_0x2f1c7d){return{'name':_0x2f1c7d[_0x9541('0x25')],'type':_0x2f1c7d[_0x9541('0x26')][_0x9541('0x27')]};});_0x318553[_0x9541('0x28')]=_['map'](_0x5a7974,'name');_0x318553[_0x9541('0x29')]=_[_0x9541('0x2a')](_0x16e782['query']);_0x318553[_0x9541('0x2b')]=_[_0x9541('0x2c')](_0x318553[_0x9541('0x28')],_0x318553[_0x9541('0x29')]);_0x25c6ea[_0x9541('0x2d')]=_[_0x9541('0x2c')](_0x318553[_0x9541('0x28')],qs[_0x9541('0x2e')](_0x16e782['query']['fields']));_0x25c6ea[_0x9541('0x2d')]=_0x25c6ea[_0x9541('0x2d')][_0x9541('0x2f')]?_0x25c6ea[_0x9541('0x2d')]:_0x318553['model'];if(!_0x16e782[_0x9541('0x29')]['hasOwnProperty'](_0x9541('0x30'))){_0x25c6ea['limit']=qs[_0x9541('0x16')](_0x16e782[_0x9541('0x29')][_0x9541('0x16')]);_0x25c6ea['offset']=qs[_0x9541('0x15')](_0x16e782[_0x9541('0x29')][_0x9541('0x15')]);}_0x25c6ea[_0x9541('0x31')]=qs[_0x9541('0x32')](_0x16e782[_0x9541('0x29')][_0x9541('0x32')]);_0x25c6ea['where']=qs[_0x9541('0x2b')](_['pick'](_0x16e782[_0x9541('0x29')],_0x318553['filters']),_0x5a7974);if(_0x16e782['query'][_0x9541('0x33')]){_0x25c6ea[_0x9541('0x34')]=_['merge'](_0x25c6ea[_0x9541('0x34')],{'$or':_[_0x9541('0x23')](_0x5a7974,function(_0x251847){if(_0x251847['type']!==_0x9541('0x35')){var _0x38957e={};_0x38957e[_0x251847['name']]={'$like':'%'+_0x16e782[_0x9541('0x29')][_0x9541('0x33')]+'%'};return _0x38957e;}})});}_0x25c6ea=_[_0x9541('0x36')]({},_0x25c6ea,_0x16e782[_0x9541('0x37')]);var _0x2ae83c={'where':_0x25c6ea[_0x9541('0x34')]};return db[_0x9541('0x38')][_0x9541('0x14')](_0x2ae83c)['then'](function(_0x3b72a4){_0x441c6e[_0x9541('0x14')]=_0x3b72a4;if(_0x16e782[_0x9541('0x29')]['includeAll']){_0x25c6ea[_0x9541('0x39')]=[{'all':!![]}];}return db[_0x9541('0x38')][_0x9541('0x3a')](_0x25c6ea);})[_0x9541('0x1d')](function(_0x375770){_0x441c6e[_0x9541('0x3b')]=_0x375770;return _0x441c6e;})['then'](respondWithFilteredResult(_0x269a48,_0x25c6ea))[_0x9541('0x3c')](handleError(_0x269a48,null));};exports[_0x9541('0x3d')]=function(_0x384399,_0x8d89fd){var _0x3120eb={'raw':!![],'where':{'id':_0x384399[_0x9541('0x3e')]['id']}},_0x3a9f68={};_0x3a9f68[_0x9541('0x28')]=_[_0x9541('0x2a')](db[_0x9541('0x38')][_0x9541('0x24')]);_0x3a9f68['query']=_[_0x9541('0x2a')](_0x384399[_0x9541('0x29')]);_0x3a9f68['filters']=_[_0x9541('0x2c')](_0x3a9f68[_0x9541('0x28')],_0x3a9f68[_0x9541('0x29')]);_0x3120eb[_0x9541('0x2d')]=_[_0x9541('0x2c')](_0x3a9f68[_0x9541('0x28')],qs[_0x9541('0x2e')](_0x384399[_0x9541('0x29')][_0x9541('0x2e')]));_0x3120eb['attributes']=_0x3120eb[_0x9541('0x2d')][_0x9541('0x2f')]?_0x3120eb[_0x9541('0x2d')]:_0x3a9f68[_0x9541('0x28')];if(_0x384399[_0x9541('0x29')][_0x9541('0x3f')]){_0x3120eb['include']=[{'all':!![]}];}_0x3120eb=_[_0x9541('0x36')]({},_0x3120eb,_0x384399['options']);return db['FreshsalesField']['find'](_0x3120eb)[_0x9541('0x1d')](handleEntityNotFound(_0x8d89fd,null))['then'](respondWithResult(_0x8d89fd,null))['catch'](handleError(_0x8d89fd,null));};exports[_0x9541('0x40')]=function(_0xcb0245,_0x3665f1){return db['FreshsalesField']['create'](_0xcb0245['body'],{})[_0x9541('0x1d')](respondWithResult(_0x3665f1,0xc9))[_0x9541('0x3c')](handleError(_0x3665f1,null));};exports[_0x9541('0x1c')]=function(_0x3ac07f,_0x31b31e){if(_0x3ac07f[_0x9541('0x41')]['id']){delete _0x3ac07f[_0x9541('0x41')]['id'];}return db[_0x9541('0x38')][_0x9541('0x42')]({'where':{'id':_0x3ac07f[_0x9541('0x3e')]['id']}})['then'](handleEntityNotFound(_0x31b31e,null))[_0x9541('0x1d')](saveUpdates(_0x3ac07f[_0x9541('0x41')],null))[_0x9541('0x1d')](respondWithResult(_0x31b31e,null))[_0x9541('0x3c')](handleError(_0x31b31e,null));};exports[_0x9541('0x1e')]=function(_0x3c232f,_0x401b89){return db[_0x9541('0x38')][_0x9541('0x42')]({'where':{'id':_0x3c232f[_0x9541('0x3e')]['id']}})['then'](handleEntityNotFound(_0x401b89,null))['then'](removeEntity(_0x401b89,null))['catch'](handleError(_0x401b89,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index d31eb32..93d8262 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 _0x79ad=['idField','FieldId','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','FreshsalesField','int_freshsales_fields','freshsales_unique_index'];(function(_0x2f45ea,_0x15c656){var _0x485a84=function(_0x4a1fe3){while(--_0x4a1fe3){_0x2f45ea['push'](_0x2f45ea['shift']());}};_0x485a84(++_0x15c656);}(_0x79ad,0x16e));var _0xd79a=function(_0x34dd0e,_0x1f965b){_0x34dd0e=_0x34dd0e-0x0;var _0x7ac476=_0x79ad[_0x34dd0e];return _0x7ac476;};'use strict';var _=require(_0xd79a('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xd79a('0x1'));var moment=require(_0xd79a('0x2'));var BPromise=require(_0xd79a('0x3'));var rp=require(_0xd79a('0x4'));var fs=require('fs');var path=require(_0xd79a('0x5'));var rimraf=require(_0xd79a('0x6'));var config=require(_0xd79a('0x7'));var attributes=require('./intFreshsalesField.attributes');module['exports']=function(_0x261e3e,_0x370f0c){return _0x261e3e[_0xd79a('0x8')](_0xd79a('0x9'),attributes,{'tableName':_0xd79a('0xa'),'paranoid':![],'indexes':[{'name':_0xd79a('0xb'),'fields':[_0xd79a('0xc'),_0xd79a('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1917=['idField','FieldId','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesField.attributes','exports','define','FreshsalesField','int_freshsales_fields','freshsales_unique_index'];(function(_0x21aec3,_0x5c97e9){var _0x288bbc=function(_0x2283fe){while(--_0x2283fe){_0x21aec3['push'](_0x21aec3['shift']());}};_0x288bbc(++_0x5c97e9);}(_0x1917,0x9b));var _0x7191=function(_0x370e75,_0xd46009){_0x370e75=_0x370e75-0x0;var _0x5c0ce3=_0x1917[_0x370e75];return _0x5c0ce3;};'use strict';var _=require(_0x7191('0x0'));var util=require('util');var logger=require(_0x7191('0x1'))(_0x7191('0x2'));var moment=require(_0x7191('0x3'));var BPromise=require(_0x7191('0x4'));var rp=require(_0x7191('0x5'));var fs=require('fs');var path=require(_0x7191('0x6'));var rimraf=require(_0x7191('0x7'));var config=require(_0x7191('0x8'));var attributes=require(_0x7191('0x9'));module[_0x7191('0xa')]=function(_0x45ba3e,_0xb5f22f){return _0x45ba3e[_0x7191('0xb')](_0x7191('0xc'),attributes,{'tableName':_0x7191('0xd'),'paranoid':![],'indexes':[{'name':_0x7191('0xe'),'fields':[_0x7191('0xf'),_0x7191('0x10')],'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 47f194c..7f42d1b 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 _0x0a0e=['rpc','../../config/environment','client','http','then','info','FreshsalesField,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x18b7f2,_0xbd3294){var _0x4c685b=function(_0x44d7e5){while(--_0x44d7e5){_0x18b7f2['push'](_0x18b7f2['shift']());}};_0x4c685b(++_0xbd3294);}(_0x0a0e,0xae));var _0xe0a0=function(_0x2872c5,_0x362506){_0x2872c5=_0x2872c5-0x0;var _0x5a3d07=_0x0a0e[_0x2872c5];return _0x5a3d07;};'use strict';var _=require(_0xe0a0('0x0'));var util=require(_0xe0a0('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xe0a0('0x2'));var fs=require('fs');var Redis=require(_0xe0a0('0x3'));var db=require(_0xe0a0('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xe0a0('0x5'))(_0xe0a0('0x6'));var config=require(_0xe0a0('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xe0a0('0x8')][_0xe0a0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x445dc8,_0x19112b,_0x366c54){return new BPromise(function(_0x424fad,_0xd26baf){return client['request'](_0x445dc8,_0x366c54)[_0xe0a0('0xa')](function(_0x1d0d3c){logger[_0xe0a0('0xb')](_0xe0a0('0xc'),_0x19112b,'request\x20sent');logger[_0xe0a0('0xd')]('FreshsalesField,\x20%s,\x20%s,\x20%s',_0x19112b,_0xe0a0('0xe'),JSON[_0xe0a0('0xf')](_0x1d0d3c));if(_0x1d0d3c[_0xe0a0('0x10')]){if(_0x1d0d3c['error']['code']===0x1f4){logger[_0xe0a0('0x10')]('FreshsalesField,\x20%s,\x20%s',_0x19112b,_0x1d0d3c[_0xe0a0('0x10')][_0xe0a0('0x11')]);return _0xd26baf(_0x1d0d3c[_0xe0a0('0x10')][_0xe0a0('0x11')]);}logger[_0xe0a0('0x10')](_0xe0a0('0xc'),_0x19112b,_0x1d0d3c[_0xe0a0('0x10')][_0xe0a0('0x11')]);return _0x424fad(_0x1d0d3c['error'][_0xe0a0('0x11')]);}else{logger[_0xe0a0('0xb')](_0xe0a0('0xc'),_0x19112b,'request\x20sent');_0x424fad(_0x1d0d3c[_0xe0a0('0x12')]['message']);}})[_0xe0a0('0x13')](function(_0x3db66a){logger[_0xe0a0('0x10')](_0xe0a0('0xc'),_0x19112b,_0x3db66a);_0xd26baf(_0x3db66a);});});} \ No newline at end of file +var _0x1fee=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis'];(function(_0x3d4c6f,_0x443db6){var _0x451178=function(_0x35216d){while(--_0x35216d){_0x3d4c6f['push'](_0x3d4c6f['shift']());}};_0x451178(++_0x443db6);}(_0x1fee,0x1de));var _0xe1fe=function(_0x588bb0,_0x4b9785){_0x588bb0=_0x588bb0-0x0;var _0x49621c=_0x1fee[_0x588bb0];return _0x49621c;};'use strict';var _=require(_0xe1fe('0x0'));var util=require(_0xe1fe('0x1'));var moment=require('moment');var BPromise=require(_0xe1fe('0x2'));var rs=require(_0xe1fe('0x3'));var fs=require('fs');var Redis=require(_0xe1fe('0x4'));var db=require(_0xe1fe('0x5'))['db'];var utils=require(_0xe1fe('0x6'));var logger=require(_0xe1fe('0x7'))('rpc');var config=require(_0xe1fe('0x8'));var jayson=require(_0xe1fe('0x9'));var client=jayson[_0xe1fe('0xa')][_0xe1fe('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3e1cf1,_0x2ef815,_0x2cdb6d){return new BPromise(function(_0x256e24,_0x2715d3){return client[_0xe1fe('0xc')](_0x3e1cf1,_0x2cdb6d)[_0xe1fe('0xd')](function(_0x5a6917){logger[_0xe1fe('0xe')](_0xe1fe('0xf'),_0x2ef815,_0xe1fe('0x10'));logger[_0xe1fe('0x11')]('FreshsalesField,\x20%s,\x20%s,\x20%s',_0x2ef815,_0xe1fe('0x10'),JSON['stringify'](_0x5a6917));if(_0x5a6917[_0xe1fe('0x12')]){if(_0x5a6917[_0xe1fe('0x12')][_0xe1fe('0x13')]===0x1f4){logger[_0xe1fe('0x12')](_0xe1fe('0xf'),_0x2ef815,_0x5a6917[_0xe1fe('0x12')]['message']);return _0x2715d3(_0x5a6917[_0xe1fe('0x12')]['message']);}logger[_0xe1fe('0x12')]('FreshsalesField,\x20%s,\x20%s',_0x2ef815,_0x5a6917[_0xe1fe('0x12')][_0xe1fe('0x14')]);return _0x256e24(_0x5a6917['error'][_0xe1fe('0x14')]);}else{logger['info'](_0xe1fe('0xf'),_0x2ef815,'request\x20sent');_0x256e24(_0x5a6917[_0xe1fe('0x15')][_0xe1fe('0x14')]);}})[_0xe1fe('0x16')](function(_0x3d684c){logger['error']('FreshsalesField,\x20%s,\x20%s',_0x2ef815,_0x3d684c);_0x2715d3(_0x3d684c);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index e3b6adb..a240732 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 _0x9772=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','isAuthenticated','index','/:id','get','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','put','update','delete','destroy','exports','multer','connect-timeout','Router'];(function(_0x169e53,_0x46be55){var _0x252bb3=function(_0x521e7a){while(--_0x521e7a){_0x169e53['push'](_0x169e53['shift']());}};_0x252bb3(++_0x46be55);}(_0x9772,0x189));var _0x2977=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x9772[_0x46e363];return _0x3fb059;};'use strict';var multer=require(_0x2977('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x2977('0x1'));var express=require('express');var router=express[_0x2977('0x2')]();var auth=require(_0x2977('0x3'));var interaction=require(_0x2977('0x4'));var config=require(_0x2977('0x5'));var controller=require(_0x2977('0x6'));router['get']('/',auth[_0x2977('0x7')](),controller[_0x2977('0x8')]);router['get'](_0x2977('0x9'),auth[_0x2977('0x7')](),controller['show']);router[_0x2977('0xa')](_0x2977('0xb'),auth[_0x2977('0x7')](),controller[_0x2977('0xc')]);router[_0x2977('0xa')](_0x2977('0xd'),auth[_0x2977('0x7')](),controller[_0x2977('0xe')]);router[_0x2977('0xf')]('/',auth[_0x2977('0x7')](),controller[_0x2977('0x10')]);router[_0x2977('0xf')]('/:id/configurations',auth['isAuthenticated'](),controller['addConfiguration']);router[_0x2977('0x11')]('/:id',auth[_0x2977('0x7')](),controller[_0x2977('0x12')]);router[_0x2977('0x13')]('/:id',auth[_0x2977('0x7')](),controller[_0x2977('0x14')]);module[_0x2977('0x15')]=router; \ No newline at end of file +var _0x4814=['destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/:id','show','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','put'];(function(_0x5ceeba,_0x2acc98){var _0x512d0f=function(_0x3d7d31){while(--_0x3d7d31){_0x5ceeba['push'](_0x5ceeba['shift']());}};_0x512d0f(++_0x2acc98);}(_0x4814,0xde));var _0x4481=function(_0x2bb4c2,_0x179055){_0x2bb4c2=_0x2bb4c2-0x0;var _0x400ad0=_0x4814[_0x2bb4c2];return _0x400ad0;};'use strict';var multer=require(_0x4481('0x0'));var util=require(_0x4481('0x1'));var path=require(_0x4481('0x2'));var timeout=require('connect-timeout');var express=require(_0x4481('0x3'));var router=express[_0x4481('0x4')]();var auth=require(_0x4481('0x5'));var interaction=require(_0x4481('0x6'));var config=require('../../config/environment');var controller=require('./intSalesforceAccount.controller');router[_0x4481('0x7')]('/',auth[_0x4481('0x8')](),controller['index']);router[_0x4481('0x7')](_0x4481('0x9'),auth[_0x4481('0x8')](),controller[_0x4481('0xa')]);router[_0x4481('0x7')](_0x4481('0xb'),auth[_0x4481('0x8')](),controller['getConfigurations']);router[_0x4481('0x7')](_0x4481('0xc'),auth['isAuthenticated'](),controller[_0x4481('0xd')]);router[_0x4481('0xe')]('/',auth['isAuthenticated'](),controller[_0x4481('0xf')]);router[_0x4481('0xe')](_0x4481('0xb'),auth[_0x4481('0x8')](),controller[_0x4481('0x10')]);router[_0x4481('0x11')](_0x4481('0x9'),auth[_0x4481('0x8')](),controller['update']);router['delete'](_0x4481('0x9'),auth[_0x4481('0x8')](),controller[_0x4481('0x12')]);module[_0x4481('0x13')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index 224f9d7..5c6dcfd 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 _0x7217=['sequelize','STRING','username','ENUM','integrationTab','newTab'];(function(_0x187454,_0x69cd05){var _0x4a203a=function(_0x157324){while(--_0x157324){_0x187454['push'](_0x187454['shift']());}};_0x4a203a(++_0x69cd05);}(_0x7217,0x19e));var _0x7721=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0x7217[_0x3054be];return _0x3df150;};'use strict';var Sequelize=require(_0x7721('0x0'));module['exports']={'name':{'type':Sequelize[_0x7721('0x1')]},'description':{'type':Sequelize[_0x7721('0x1')]},'username':{'type':Sequelize[_0x7721('0x1')],'unique':_0x7721('0x2')},'remoteUri':{'type':Sequelize[_0x7721('0x1')]},'password':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x7721('0x1')]},'securityToken':{'type':Sequelize[_0x7721('0x1')]},'serverUrl':{'type':Sequelize[_0x7721('0x1')]},'type':{'type':Sequelize[_0x7721('0x3')](_0x7721('0x4'),_0x7721('0x5')),'defaultValue':_0x7721('0x4')}}; \ No newline at end of file +var _0xf494=['exports','STRING','username','ENUM','integrationTab','newTab','sequelize'];(function(_0x397652,_0x49914f){var _0x3effcd=function(_0x4243ba){while(--_0x4243ba){_0x397652['push'](_0x397652['shift']());}};_0x3effcd(++_0x49914f);}(_0xf494,0x1c6));var _0x4f49=function(_0x1effd0,_0x1f44f5){_0x1effd0=_0x1effd0-0x0;var _0x404e21=_0xf494[_0x1effd0];return _0x404e21;};'use strict';var Sequelize=require(_0x4f49('0x0'));module[_0x4f49('0x1')]={'name':{'type':Sequelize[_0x4f49('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x4f49('0x2')],'unique':_0x4f49('0x3')},'remoteUri':{'type':Sequelize[_0x4f49('0x2')]},'password':{'type':Sequelize[_0x4f49('0x2')]},'clientId':{'type':Sequelize[_0x4f49('0x2')]},'clientSecret':{'type':Sequelize[_0x4f49('0x2')]},'securityToken':{'type':Sequelize[_0x4f49('0x2')]},'serverUrl':{'type':Sequelize[_0x4f49('0x2')]},'type':{'type':Sequelize[_0x4f49('0x4')](_0x4f49('0x5'),_0x4f49('0x6')),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 1af5f25..af3c0ad 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 _0xd57a=['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','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','SalesforceAccount','rawAttributes','fieldName','type','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','show','keys','merge','create','body','find','params','getConfigurations','findOne','SalesforceConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','SalesforceField','Task','remoteUri','username','password','securityToken','slice','substring','lastIndexOf','Connection','clientId','clientSecret','login','concat','ticketType','describe','CallDisposition','CallDurationInSeconds','CallObject','IsArchived','Priority','Status','isNil','Origin','Reason','IsEscalated','SuppliedName','SuppliedCompany','remove','custom','includes','label','value','boolean','true','False','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','html-pdf','zip-dir','fast-json-patch','request-promise','mustache','util','path'];(function(_0x30ad27,_0x750e0f){var _0x42242a=function(_0x352f81){while(--_0x352f81){_0x30ad27['push'](_0x30ad27['shift']());}};_0x42242a(++_0x750e0f);}(_0xd57a,0x117));var _0xad57=function(_0x131c2a,_0x159914){_0x131c2a=_0x131c2a-0x0;var _0x4f9f3c=_0xd57a[_0x131c2a];return _0x4f9f3c;};'use strict';var pdf=require(_0xad57('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xad57('0x1'));var jsonpatch=require(_0xad57('0x2'));var rp=require(_0xad57('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xad57('0x4'));var util=require(_0xad57('0x5'));var path=require(_0xad57('0x6'));var sox=require(_0xad57('0x7'));var csv=require(_0xad57('0x8'));var ejs=require(_0xad57('0x9'));var fs=require('fs');var _=require(_0xad57('0xa'));var squel=require(_0xad57('0xb'));var crypto=require('crypto');var jsforce=require(_0xad57('0xc'));var deskjs=require(_0xad57('0xd'));var toCsv=require(_0xad57('0x8'));var querystring=require(_0xad57('0xe'));var Papa=require(_0xad57('0xf'));var Redis=require(_0xad57('0x10'));var authService=require(_0xad57('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xad57('0x12'));var hardwareService=require(_0xad57('0x13'));var logger=require(_0xad57('0x14'))('api');var utils=require(_0xad57('0x15'));var config=require(_0xad57('0x16'));var db=require(_0xad57('0x17'))['db'];var integrations=require(_0xad57('0x18'));var jayson=require(_0xad57('0x19'));var client=jayson[_0xad57('0x1a')][_0xad57('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x15599f,_0x572b50,_0x37c142){if(_0x37c142){var _0x38e46=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x38e46[_0xad57('0x1c')](_0x572b50)){return _0x15599f;}else{throw new db['Sequelize'][(_0xad57('0x1d'))](_0xad57('0x1e'));}}else{return _0x15599f;}}function respondWithRpcPromise(_0x823170,_0x512bac,_0x200593,_0x5ec430){return new BPromise(function(_0xcecdfb,_0x3a3add){var _0x391f2a=_0x5ec430||client;return _0x391f2a[_0xad57('0x1f')](_0x823170,_0x200593)[_0xad57('0x20')](function(_0x402153){logger[_0xad57('0x21')](_0xad57('0x22'),_0x512bac,_0xad57('0x23'));logger[_0xad57('0x24')](_0xad57('0x25'),_0x512bac,'request\x20sent',JSON['stringify'](_0x402153));if(_0x402153['error']){if(_0x402153[_0xad57('0x26')][_0xad57('0x27')]===0x1f4){logger[_0xad57('0x26')](_0xad57('0x22'),_0x512bac,_0x402153[_0xad57('0x26')][_0xad57('0x28')]);return _0x3a3add(_0x402153[_0xad57('0x26')][_0xad57('0x28')]);}logger[_0xad57('0x26')](_0xad57('0x22'),_0x512bac,_0x402153[_0xad57('0x26')]['message']);return _0xcecdfb(_0x402153[_0xad57('0x26')][_0xad57('0x28')]);}else{logger[_0xad57('0x21')]('SalesforceAccount,\x20%s,\x20%s',_0x512bac,_0xad57('0x23'));_0xcecdfb(_0x402153[_0xad57('0x29')]['message']);}})[_0xad57('0x2a')](function(_0x53ccf9){logger[_0xad57('0x26')]('SalesforceAccount,\x20%s,\x20%s',_0x512bac,_0x53ccf9);_0x3a3add(_0x53ccf9);});});}function respondWithStatusCode(_0x159a1f,_0x22f39f){_0x22f39f=_0x22f39f||0xcc;return function(_0x586486){if(_0x586486){return _0x159a1f[_0xad57('0x2b')](_0x22f39f);}return _0x159a1f[_0xad57('0x2c')](_0x22f39f)[_0xad57('0x2d')]();};}function respondWithResult(_0x515cd4,_0x4eb026){_0x4eb026=_0x4eb026||0xc8;return function(_0x24ffd9){if(_0x24ffd9){return _0x515cd4[_0xad57('0x2c')](_0x4eb026)[_0xad57('0x2e')](_0x24ffd9);}};}function respondWithFilteredResult(_0x2bb616,_0x3033a3){return function(_0xd7b95d){if(_0xd7b95d){var _0x373e40=_0xd7b95d[_0xad57('0x2f')],_0x3df190=_0x3033a3[_0xad57('0x30')],_0x138d02=_0x3033a3[_0xad57('0x30')]+_0x3033a3[_0xad57('0x31')],_0x46fe8a;if(_0x138d02>=_0x373e40){_0x138d02=_0x373e40;_0x46fe8a=0xc8;}else{_0x46fe8a=0xce;}_0x2bb616['status'](_0x46fe8a);return _0x2bb616[_0xad57('0x32')](_0xad57('0x33'),_0x3df190+'-'+_0x138d02+'/'+_0x373e40)[_0xad57('0x2e')](_0xd7b95d);}return null;};}function patchUpdates(_0x44139){return function(_0x5658f7){try{jsonpatch[_0xad57('0x34')](_0x5658f7,_0x44139,!![]);}catch(_0x3bde89){return BPromise[_0xad57('0x35')](_0x3bde89);}return _0x5658f7[_0xad57('0x36')]();};}function saveUpdates(_0x5b3e78,_0x30e8d4){return function(_0x1375c4){if(_0x1375c4){return _0x1375c4[_0xad57('0x37')](_0x5b3e78)[_0xad57('0x20')](function(_0x3eede6){return _0x3eede6;});}return null;};}function removeEntity(_0x197bdb,_0x1ef5da){return function(_0x685755){if(_0x685755){return _0x685755[_0xad57('0x38')]()[_0xad57('0x20')](function(){_0x197bdb[_0xad57('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4fb169,_0x461a3a){return function(_0x393bd4){if(!_0x393bd4){_0x4fb169['sendStatus'](0x194);}return _0x393bd4;};}function handleError(_0x5015e9,_0x231cb4){_0x231cb4=_0x231cb4||0x1f4;return function(_0x5c8a91){logger[_0xad57('0x26')](_0x5c8a91[_0xad57('0x39')]);if(_0x5c8a91[_0xad57('0x3a')]){delete _0x5c8a91[_0xad57('0x3a')];}_0x5015e9[_0xad57('0x2c')](_0x231cb4)[_0xad57('0x3b')](_0x5c8a91);};}exports[_0xad57('0x3c')]=function(_0x386398,_0x16aed8){var _0x40eaa3={},_0x347443={},_0x12bbbc={'count':0x0,'rows':[]};var _0x1d7c6e=_[_0xad57('0x3d')](db[_0xad57('0x3e')][_0xad57('0x3f')],function(_0xe79840){return{'name':_0xe79840[_0xad57('0x40')],'type':_0xe79840[_0xad57('0x41')]['key']};});_0x347443['model']=_['map'](_0x1d7c6e,_0xad57('0x3a'));_0x347443[_0xad57('0x42')]=_['keys'](_0x386398[_0xad57('0x42')]);_0x347443[_0xad57('0x43')]=_['intersection'](_0x347443[_0xad57('0x44')],_0x347443[_0xad57('0x42')]);_0x40eaa3[_0xad57('0x45')]=_[_0xad57('0x46')](_0x347443[_0xad57('0x44')],qs[_0xad57('0x47')](_0x386398[_0xad57('0x42')]['fields']));_0x40eaa3[_0xad57('0x45')]=_0x40eaa3['attributes'][_0xad57('0x48')]?_0x40eaa3[_0xad57('0x45')]:_0x347443[_0xad57('0x44')];if(!_0x386398[_0xad57('0x42')][_0xad57('0x49')](_0xad57('0x4a'))){_0x40eaa3['limit']=qs[_0xad57('0x31')](_0x386398[_0xad57('0x42')][_0xad57('0x31')]);_0x40eaa3[_0xad57('0x30')]=qs['offset'](_0x386398[_0xad57('0x42')][_0xad57('0x30')]);}_0x40eaa3[_0xad57('0x4b')]=qs[_0xad57('0x4c')](_0x386398[_0xad57('0x42')][_0xad57('0x4c')]);_0x40eaa3[_0xad57('0x4d')]=qs[_0xad57('0x43')](_[_0xad57('0x4e')](_0x386398[_0xad57('0x42')],_0x347443[_0xad57('0x43')]),_0x1d7c6e);if(_0x386398['query'][_0xad57('0x4f')]){_0x40eaa3['where']=_['merge'](_0x40eaa3[_0xad57('0x4d')],{'$or':_[_0xad57('0x3d')](_0x1d7c6e,function(_0x23da4){if(_0x23da4[_0xad57('0x41')]!==_0xad57('0x50')){var _0x36222c={};_0x36222c[_0x23da4[_0xad57('0x3a')]]={'$like':'%'+_0x386398[_0xad57('0x42')]['filter']+'%'};return _0x36222c;}})});}_0x40eaa3=_['merge']({},_0x40eaa3,_0x386398[_0xad57('0x51')]);var _0xb888d5={'where':_0x40eaa3['where']};return db['SalesforceAccount'][_0xad57('0x2f')](_0xb888d5)[_0xad57('0x20')](function(_0x3a0648){_0x12bbbc['count']=_0x3a0648;if(_0x386398[_0xad57('0x42')][_0xad57('0x52')]){_0x40eaa3[_0xad57('0x53')]=[{'all':!![]}];}return db[_0xad57('0x3e')][_0xad57('0x54')](_0x40eaa3);})[_0xad57('0x20')](function(_0x5d9b32){_0x12bbbc[_0xad57('0x55')]=_0x5d9b32;return _0x12bbbc;})[_0xad57('0x20')](respondWithFilteredResult(_0x16aed8,_0x40eaa3))['catch'](handleError(_0x16aed8,null));};exports[_0xad57('0x56')]=function(_0x2c5a6a,_0x58f6dc){var _0x3ec065={'raw':![],'where':{'id':_0x2c5a6a['params']['id']}},_0x1bdd7c={};_0x1bdd7c[_0xad57('0x44')]=_[_0xad57('0x57')](db[_0xad57('0x3e')]['rawAttributes']);_0x1bdd7c[_0xad57('0x42')]=_[_0xad57('0x57')](_0x2c5a6a[_0xad57('0x42')]);_0x1bdd7c['filters']=_[_0xad57('0x46')](_0x1bdd7c[_0xad57('0x44')],_0x1bdd7c[_0xad57('0x42')]);_0x3ec065[_0xad57('0x45')]=_[_0xad57('0x46')](_0x1bdd7c[_0xad57('0x44')],qs['fields'](_0x2c5a6a['query']['fields']));_0x3ec065['attributes']=_0x3ec065[_0xad57('0x45')][_0xad57('0x48')]?_0x3ec065['attributes']:_0x1bdd7c[_0xad57('0x44')];if(_0x2c5a6a[_0xad57('0x42')][_0xad57('0x52')]){_0x3ec065[_0xad57('0x53')]=[{'all':!![]}];}_0x3ec065=_[_0xad57('0x58')]({},_0x3ec065,_0x2c5a6a[_0xad57('0x51')]);return db['SalesforceAccount']['find'](_0x3ec065)['then'](handleEntityNotFound(_0x58f6dc,null))['then'](respondWithResult(_0x58f6dc,null))[_0xad57('0x2a')](handleError(_0x58f6dc,null));};exports[_0xad57('0x59')]=function(_0x141f59,_0x49076e){return db[_0xad57('0x3e')]['create'](_0x141f59[_0xad57('0x5a')],{})[_0xad57('0x20')](respondWithResult(_0x49076e,0xc9))['catch'](handleError(_0x49076e,null));};exports[_0xad57('0x37')]=function(_0x115d00,_0x212ac9){if(_0x115d00['body']['id']){delete _0x115d00[_0xad57('0x5a')]['id'];}return db[_0xad57('0x3e')][_0xad57('0x5b')]({'where':{'id':_0x115d00[_0xad57('0x5c')]['id']}})[_0xad57('0x20')](handleEntityNotFound(_0x212ac9,null))[_0xad57('0x20')](saveUpdates(_0x115d00[_0xad57('0x5a')],null))['then'](respondWithResult(_0x212ac9,null))[_0xad57('0x2a')](handleError(_0x212ac9,null));};exports[_0xad57('0x38')]=function(_0x3cc8e8,_0x51927d){return db[_0xad57('0x3e')][_0xad57('0x5b')]({'where':{'id':_0x3cc8e8[_0xad57('0x5c')]['id']}})[_0xad57('0x20')](handleEntityNotFound(_0x51927d,null))[_0xad57('0x20')](removeEntity(_0x51927d,null))[_0xad57('0x2a')](handleError(_0x51927d,null));};exports[_0xad57('0x5d')]=function(_0x54b332,_0x1d0bfc,_0x112ec4){var _0x5d9726={};var _0x5c8f16={};var _0x44feb9;var _0x56bed1;return db[_0xad57('0x3e')][_0xad57('0x5e')]({'where':{'id':_0x54b332[_0xad57('0x5c')]['id']}})[_0xad57('0x20')](handleEntityNotFound(_0x1d0bfc,null))['then'](function(_0x2dfe6f){if(_0x2dfe6f){_0x44feb9=_0x2dfe6f;_0x5c8f16[_0xad57('0x44')]=_[_0xad57('0x57')](db[_0xad57('0x5f')][_0xad57('0x3f')]);_0x5c8f16[_0xad57('0x42')]=_['keys'](_0x54b332['query']);_0x5c8f16[_0xad57('0x43')]=_[_0xad57('0x46')](_0x5c8f16[_0xad57('0x44')],_0x5c8f16[_0xad57('0x42')]);_0x5d9726['attributes']=_[_0xad57('0x46')](_0x5c8f16[_0xad57('0x44')],qs['fields'](_0x54b332[_0xad57('0x42')][_0xad57('0x47')]));_0x5d9726[_0xad57('0x45')]=_0x5d9726['attributes'][_0xad57('0x48')]?_0x5d9726[_0xad57('0x45')]:_0x5c8f16[_0xad57('0x44')];_0x5d9726[_0xad57('0x4b')]=qs['sort'](_0x54b332[_0xad57('0x42')][_0xad57('0x4c')]);_0x5d9726['where']=qs[_0xad57('0x43')](_['pick'](_0x54b332[_0xad57('0x42')],_0x5c8f16[_0xad57('0x43')]));if(_0x54b332['query']['filter']){_0x5d9726[_0xad57('0x4d')]=_[_0xad57('0x58')](_0x5d9726[_0xad57('0x4d')],{'$or':_[_0xad57('0x3d')](_0x5d9726[_0xad57('0x45')],function(_0x146f3e){var _0x475449={};_0x475449[_0x146f3e]={'$like':'%'+_0x54b332[_0xad57('0x42')][_0xad57('0x4f')]+'%'};return _0x475449;})});}_0x5d9726=_['merge']({},_0x5d9726,_0x54b332[_0xad57('0x51')]);return _0x44feb9['getConfigurations'](_0x5d9726);}})[_0xad57('0x20')](function(_0x268e4a){if(_0x268e4a){_0x56bed1=_0x268e4a['length'];if(!_0x54b332[_0xad57('0x42')][_0xad57('0x49')](_0xad57('0x4a'))){_0x5d9726[_0xad57('0x31')]=qs[_0xad57('0x31')](_0x54b332[_0xad57('0x42')][_0xad57('0x31')]);_0x5d9726[_0xad57('0x30')]=qs[_0xad57('0x30')](_0x54b332[_0xad57('0x42')][_0xad57('0x30')]);}return _0x44feb9[_0xad57('0x5d')](_0x5d9726);}})[_0xad57('0x20')](function(_0x4274a2){if(_0x4274a2){return _0x4274a2?{'count':_0x56bed1,'rows':_0x4274a2}:null;}})[_0xad57('0x20')](respondWithResult(_0x1d0bfc,null))['catch'](handleError(_0x1d0bfc,null));};exports[_0xad57('0x60')]=function(_0x5b81bb,_0x3a0a7a,_0x54c3b5){if(_0x5b81bb[_0xad57('0x5a')]['id']){delete _0x5b81bb['body']['id'];}return db[_0xad57('0x3e')][_0xad57('0x5e')]({'where':{'id':_0x5b81bb[_0xad57('0x5c')]['id']}})[_0xad57('0x20')](handleEntityNotFound(_0x3a0a7a,null))['then'](function(_0x3f92ab){if(_0x3f92ab){_0x5b81bb['body'][_0xad57('0x61')]=_0x3f92ab['id'];_0x5b81bb['body'][_0xad57('0x62')]=integrations[_0xad57('0x63')](_0x5b81bb[_0xad57('0x5a')][_0xad57('0x64')],_0x5b81bb[_0xad57('0x5a')][_0xad57('0x41')]);_0x5b81bb['body'][_0xad57('0x65')]=integrations[_0xad57('0x66')](_0x5b81bb[_0xad57('0x5a')][_0xad57('0x64')],_0x5b81bb[_0xad57('0x5a')][_0xad57('0x41')]);return db[_0xad57('0x5f')]['create'](_0x5b81bb[_0xad57('0x5a')],{'include':[{'model':db[_0xad57('0x67')],'as':_0xad57('0x62')},{'model':db[_0xad57('0x67')],'as':_0xad57('0x65')}]});}return null;})['then'](respondWithResult(_0x3a0a7a,null))[_0xad57('0x2a')](handleError(_0x3a0a7a,null));};exports['getFields']=function(_0x5b14a3,_0x172599,_0x4c3745){var _0x31f636;var _0x164ed4='';var _0x36571a=_0xad57('0x68');return db['SalesforceAccount'][_0xad57('0x5e')]({'where':{'id':_0x5b14a3[_0xad57('0x5c')]['id']},'attributes':['id',_0xad57('0x69'),'clientId','clientSecret',_0xad57('0x6a'),_0xad57('0x6b'),_0xad57('0x6c')]})[_0xad57('0x20')](handleEntityNotFound(_0x172599,null))[_0xad57('0x20')](function(_0x46e424){if(_0x46e424){_0x164ed4=_0x46e424[_0xad57('0x69')];var _0x26bea2=_0x164ed4[_0xad57('0x6d')](-0x1);if(_0x26bea2==='/'){_0x164ed4=_0x164ed4[_0xad57('0x6e')](0x0,_0x164ed4[_0xad57('0x6f')](_0x26bea2));}_0x31f636=new jsforce[(_0xad57('0x70'))]({'oauth2':{'loginUrl':_0x164ed4,'clientId':_0x46e424[_0xad57('0x71')],'clientSecret':_0x46e424[_0xad57('0x72')]}});return _0x31f636[_0xad57('0x73')](_0x46e424[_0xad57('0x6a')],_0x46e424[_0xad57('0x6b')][_0xad57('0x74')](_0x46e424[_0xad57('0x6c')]));}})['then'](function(_0x155f54){if(_0x155f54){if(!_['isNil'](_0x5b14a3['query'][_0xad57('0x75')])){_0x36571a=_0x5b14a3[_0xad57('0x42')]['ticketType'];}return _0x31f636['sobject'](_0x36571a)[_0xad57('0x76')]();}})[_0xad57('0x20')](function(_0x55e0ff){var _0x19cbd5=[_0xad57('0x77'),_0xad57('0x78'),_0xad57('0x79'),'CallType',_0xad57('0x7a'),_0xad57('0x7b'),_0xad57('0x7c'),'Type'];if(!_[_0xad57('0x7d')](_0x5b14a3[_0xad57('0x42')][_0xad57('0x75')])&&_0x5b14a3[_0xad57('0x42')][_0xad57('0x75')]==='Case'){_0x19cbd5=['Type',_0xad57('0x7e'),_0xad57('0x7f'),_0xad57('0x7c'),_0xad57('0x7b'),_0xad57('0x80'),_0xad57('0x81'),_0xad57('0x82')];}if(_0x55e0ff){_[_0xad57('0x83')](_0x55e0ff[_0xad57('0x47')],function(_0x4a79db){return _0x4a79db[_0xad57('0x84')]===![]&&!_0x19cbd5[_0xad57('0x85')](_0x4a79db[_0xad57('0x3a')]);});return{'count':_0x55e0ff[_0xad57('0x47')][_0xad57('0x48')],'rows':_[_0xad57('0x3d')](_0x55e0ff[_0xad57('0x47')],function(_0x20e463){return{'id':_0x20e463[_0xad57('0x3a')],'name':_0x20e463[_0xad57('0x86')],'custom':_0x20e463[_0xad57('0x84')],'options':_0x20e463['picklistValues']['length']>0x0?_[_0xad57('0x3d')](_0x20e463['picklistValues'],function(_0x556097){return{'name':_0x556097[_0xad57('0x86')],'value':_0x556097[_0xad57('0x87')]};}):_0x20e463[_0xad57('0x41')]==_0xad57('0x88')?[{'name':'True','value':_0xad57('0x89')},{'name':_0xad57('0x8a'),'value':'false'}]:[]};})};}})['then'](respondWithResult(_0x172599,null))[_0xad57('0x2a')](function(_0x30ee6a){var _0x2c3b7d=_0x5b14a3[_0xad57('0x42')][_0xad57('0x1c')]?0x1f4:_0x30ee6a[_0xad57('0x8b')]||0x1f4;logger[_0xad57('0x26')](_0xad57('0x8c'),_0xad57('0x8d'),_0x2c3b7d,JSON[_0xad57('0x8e')](_0x30ee6a));delete _0x30ee6a[_0xad57('0x3a')];if(_0x2c3b7d===0x191){_0x2c3b7d=0x190;}_0x172599[_0xad57('0x2c')](_0x2c3b7d)['send'](_0x5b14a3[_0xad57('0x42')][_0xad57('0x1c')]?{'message':'Wrong\x20credentials','statusCode':_0x30ee6a[_0xad57('0x8b')]}:_0x30ee6a);});}; \ No newline at end of file +var _0x0ea6=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../components/integrations/configuration','client','http','test','ValidationError','request','then','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','sendStatus','status','count','offset','limit','set','Content-Range','reject','save','update','destroy','end','stack','name','send','index','map','SalesforceAccount','rawAttributes','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','findOne','SalesforceConfiguration','length','getConfigurations','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','SalesforceField','Task','remoteUri','clientId','clientSecret','username','password','securityToken','substring','lastIndexOf','login','concat','ticketType','sobject','CallDisposition','CallDurationInSeconds','CallObject','CallType','IsArchived','Type','isNil','Case','Origin','Reason','Status','IsEscalated','SuppliedCompany','remove','includes','picklistValues','label','boolean','true','False','false','getFields','Wrong\x20credentials','html-pdf','rimraf'];(function(_0x4ce258,_0x82ae9c){var _0x540200=function(_0x10304c){while(--_0x10304c){_0x4ce258['push'](_0x4ce258['shift']());}};_0x540200(++_0x82ae9c);}(_0x0ea6,0x190));var _0x60ea=function(_0x42f009,_0x5e27b1){_0x42f009=_0x42f009-0x0;var _0x22a1e0=_0x0ea6[_0x42f009];return _0x22a1e0;};'use strict';var pdf=require(_0x60ea('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x60ea('0x1'));var zipdir=require(_0x60ea('0x2'));var jsonpatch=require(_0x60ea('0x3'));var rp=require(_0x60ea('0x4'));var moment=require(_0x60ea('0x5'));var BPromise=require(_0x60ea('0x6'));var Mustache=require(_0x60ea('0x7'));var util=require('util');var path=require(_0x60ea('0x8'));var sox=require('sox');var csv=require(_0x60ea('0x9'));var ejs=require(_0x60ea('0xa'));var fs=require('fs');var _=require(_0x60ea('0xb'));var squel=require(_0x60ea('0xc'));var crypto=require('crypto');var jsforce=require(_0x60ea('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x60ea('0x9'));var querystring=require('querystring');var Papa=require(_0x60ea('0xe'));var Redis=require(_0x60ea('0xf'));var authService=require(_0x60ea('0x10'));var qs=require(_0x60ea('0x11'));var as=require(_0x60ea('0x12'));var hardwareService=require(_0x60ea('0x13'));var logger=require('../../config/logger')(_0x60ea('0x14'));var utils=require(_0x60ea('0x15'));var config=require(_0x60ea('0x16'));var db=require('../../mysqldb')['db'];var integrations=require(_0x60ea('0x17'));var jayson=require('jayson/promise');var client=jayson[_0x60ea('0x18')][_0x60ea('0x19')]({'port':0x232a});function checkPasswordPattern(_0x2a0436,_0x57c8fa,_0x457e1c){if(_0x457e1c){var _0x3c3c7d=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3c3c7d[_0x60ea('0x1a')](_0x57c8fa)){return _0x2a0436;}else{throw new db['Sequelize'][(_0x60ea('0x1b'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x2a0436;}}function respondWithRpcPromise(_0x3332c0,_0x4fab2f,_0x15722f,_0x29f0b0){return new BPromise(function(_0x50e266,_0x56f2e9){var _0x35d858=_0x29f0b0||client;return _0x35d858[_0x60ea('0x1c')](_0x3332c0,_0x15722f)[_0x60ea('0x1d')](function(_0x343b31){logger['info']('SalesforceAccount,\x20%s,\x20%s',_0x4fab2f,'request\x20sent');logger[_0x60ea('0x1e')](_0x60ea('0x1f'),_0x4fab2f,'request\x20sent',JSON[_0x60ea('0x20')](_0x343b31));if(_0x343b31[_0x60ea('0x21')]){if(_0x343b31[_0x60ea('0x21')][_0x60ea('0x22')]===0x1f4){logger['error']('SalesforceAccount,\x20%s,\x20%s',_0x4fab2f,_0x343b31[_0x60ea('0x21')][_0x60ea('0x23')]);return _0x56f2e9(_0x343b31[_0x60ea('0x21')][_0x60ea('0x23')]);}logger[_0x60ea('0x21')]('SalesforceAccount,\x20%s,\x20%s',_0x4fab2f,_0x343b31[_0x60ea('0x21')][_0x60ea('0x23')]);return _0x50e266(_0x343b31[_0x60ea('0x21')]['message']);}else{logger[_0x60ea('0x24')](_0x60ea('0x25'),_0x4fab2f,_0x60ea('0x26'));_0x50e266(_0x343b31['result'][_0x60ea('0x23')]);}})['catch'](function(_0x45f663){logger[_0x60ea('0x21')](_0x60ea('0x25'),_0x4fab2f,_0x45f663);_0x56f2e9(_0x45f663);});});}function respondWithStatusCode(_0x27d8b1,_0x68f584){_0x68f584=_0x68f584||0xcc;return function(_0x4e8c96){if(_0x4e8c96){return _0x27d8b1[_0x60ea('0x27')](_0x68f584);}return _0x27d8b1['status'](_0x68f584)['end']();};}function respondWithResult(_0x5a3df3,_0x1163ec){_0x1163ec=_0x1163ec||0xc8;return function(_0x3d3e74){if(_0x3d3e74){return _0x5a3df3[_0x60ea('0x28')](_0x1163ec)['json'](_0x3d3e74);}};}function respondWithFilteredResult(_0x58e599,_0xebc5d){return function(_0x5295a2){if(_0x5295a2){var _0x566837=_0x5295a2[_0x60ea('0x29')],_0x280f2a=_0xebc5d[_0x60ea('0x2a')],_0x846a77=_0xebc5d['offset']+_0xebc5d[_0x60ea('0x2b')],_0x4d746f;if(_0x846a77>=_0x566837){_0x846a77=_0x566837;_0x4d746f=0xc8;}else{_0x4d746f=0xce;}_0x58e599[_0x60ea('0x28')](_0x4d746f);return _0x58e599[_0x60ea('0x2c')](_0x60ea('0x2d'),_0x280f2a+'-'+_0x846a77+'/'+_0x566837)['json'](_0x5295a2);}return null;};}function patchUpdates(_0x4b98da){return function(_0x3486a3){try{jsonpatch['apply'](_0x3486a3,_0x4b98da,!![]);}catch(_0x1d9f1f){return BPromise[_0x60ea('0x2e')](_0x1d9f1f);}return _0x3486a3[_0x60ea('0x2f')]();};}function saveUpdates(_0x30837e,_0x3667a3){return function(_0x31748f){if(_0x31748f){return _0x31748f[_0x60ea('0x30')](_0x30837e)[_0x60ea('0x1d')](function(_0xc7b0c7){return _0xc7b0c7;});}return null;};}function removeEntity(_0x212bb4,_0x14684d){return function(_0x2d32b4){if(_0x2d32b4){return _0x2d32b4[_0x60ea('0x31')]()[_0x60ea('0x1d')](function(){_0x212bb4['status'](0xcc)[_0x60ea('0x32')]();});}};}function handleEntityNotFound(_0x341681,_0x2c5c79){return function(_0x2f1056){if(!_0x2f1056){_0x341681['sendStatus'](0x194);}return _0x2f1056;};}function handleError(_0x46360d,_0x3284ed){_0x3284ed=_0x3284ed||0x1f4;return function(_0x1aab22){logger[_0x60ea('0x21')](_0x1aab22[_0x60ea('0x33')]);if(_0x1aab22[_0x60ea('0x34')]){delete _0x1aab22[_0x60ea('0x34')];}_0x46360d[_0x60ea('0x28')](_0x3284ed)[_0x60ea('0x35')](_0x1aab22);};}exports[_0x60ea('0x36')]=function(_0x38f5b3,_0x3e38ed){var _0x56016f={},_0x1e5f89={},_0x39aae1={'count':0x0,'rows':[]};var _0x36a205=_[_0x60ea('0x37')](db[_0x60ea('0x38')][_0x60ea('0x39')],function(_0x1f2d00){return{'name':_0x1f2d00['fieldName'],'type':_0x1f2d00['type'][_0x60ea('0x3a')]};});_0x1e5f89[_0x60ea('0x3b')]=_[_0x60ea('0x37')](_0x36a205,_0x60ea('0x34'));_0x1e5f89[_0x60ea('0x3c')]=_[_0x60ea('0x3d')](_0x38f5b3[_0x60ea('0x3c')]);_0x1e5f89[_0x60ea('0x3e')]=_['intersection'](_0x1e5f89['model'],_0x1e5f89[_0x60ea('0x3c')]);_0x56016f[_0x60ea('0x3f')]=_[_0x60ea('0x40')](_0x1e5f89[_0x60ea('0x3b')],qs[_0x60ea('0x41')](_0x38f5b3[_0x60ea('0x3c')][_0x60ea('0x41')]));_0x56016f[_0x60ea('0x3f')]=_0x56016f[_0x60ea('0x3f')]['length']?_0x56016f[_0x60ea('0x3f')]:_0x1e5f89[_0x60ea('0x3b')];if(!_0x38f5b3['query'][_0x60ea('0x42')](_0x60ea('0x43'))){_0x56016f['limit']=qs[_0x60ea('0x2b')](_0x38f5b3[_0x60ea('0x3c')]['limit']);_0x56016f[_0x60ea('0x2a')]=qs['offset'](_0x38f5b3[_0x60ea('0x3c')][_0x60ea('0x2a')]);}_0x56016f[_0x60ea('0x44')]=qs['sort'](_0x38f5b3['query'][_0x60ea('0x45')]);_0x56016f[_0x60ea('0x46')]=qs[_0x60ea('0x3e')](_[_0x60ea('0x47')](_0x38f5b3[_0x60ea('0x3c')],_0x1e5f89[_0x60ea('0x3e')]),_0x36a205);if(_0x38f5b3[_0x60ea('0x3c')][_0x60ea('0x48')]){_0x56016f[_0x60ea('0x46')]=_[_0x60ea('0x49')](_0x56016f['where'],{'$or':_[_0x60ea('0x37')](_0x36a205,function(_0x4af0d3){if(_0x4af0d3[_0x60ea('0x4a')]!==_0x60ea('0x4b')){var _0x54a6c3={};_0x54a6c3[_0x4af0d3[_0x60ea('0x34')]]={'$like':'%'+_0x38f5b3['query']['filter']+'%'};return _0x54a6c3;}})});}_0x56016f=_[_0x60ea('0x49')]({},_0x56016f,_0x38f5b3['options']);var _0x32b1e2={'where':_0x56016f[_0x60ea('0x46')]};return db[_0x60ea('0x38')][_0x60ea('0x29')](_0x32b1e2)[_0x60ea('0x1d')](function(_0x32d91a){_0x39aae1[_0x60ea('0x29')]=_0x32d91a;if(_0x38f5b3[_0x60ea('0x3c')][_0x60ea('0x4c')]){_0x56016f[_0x60ea('0x4d')]=[{'all':!![]}];}return db['SalesforceAccount'][_0x60ea('0x4e')](_0x56016f);})[_0x60ea('0x1d')](function(_0x4940e0){_0x39aae1[_0x60ea('0x4f')]=_0x4940e0;return _0x39aae1;})[_0x60ea('0x1d')](respondWithFilteredResult(_0x3e38ed,_0x56016f))[_0x60ea('0x50')](handleError(_0x3e38ed,null));};exports[_0x60ea('0x51')]=function(_0x3d29ef,_0x18fa8a){var _0x3363b2={'raw':![],'where':{'id':_0x3d29ef[_0x60ea('0x52')]['id']}},_0x44d716={};_0x44d716[_0x60ea('0x3b')]=_[_0x60ea('0x3d')](db[_0x60ea('0x38')][_0x60ea('0x39')]);_0x44d716[_0x60ea('0x3c')]=_[_0x60ea('0x3d')](_0x3d29ef[_0x60ea('0x3c')]);_0x44d716['filters']=_[_0x60ea('0x40')](_0x44d716['model'],_0x44d716[_0x60ea('0x3c')]);_0x3363b2[_0x60ea('0x3f')]=_[_0x60ea('0x40')](_0x44d716[_0x60ea('0x3b')],qs[_0x60ea('0x41')](_0x3d29ef['query'][_0x60ea('0x41')]));_0x3363b2[_0x60ea('0x3f')]=_0x3363b2[_0x60ea('0x3f')]['length']?_0x3363b2[_0x60ea('0x3f')]:_0x44d716['model'];if(_0x3d29ef[_0x60ea('0x3c')][_0x60ea('0x4c')]){_0x3363b2[_0x60ea('0x4d')]=[{'all':!![]}];}_0x3363b2=_[_0x60ea('0x49')]({},_0x3363b2,_0x3d29ef[_0x60ea('0x53')]);return db[_0x60ea('0x38')][_0x60ea('0x54')](_0x3363b2)[_0x60ea('0x1d')](handleEntityNotFound(_0x18fa8a,null))[_0x60ea('0x1d')](respondWithResult(_0x18fa8a,null))[_0x60ea('0x50')](handleError(_0x18fa8a,null));};exports[_0x60ea('0x55')]=function(_0x2ed8e9,_0x23de9f){return db[_0x60ea('0x38')][_0x60ea('0x55')](_0x2ed8e9[_0x60ea('0x56')],{})[_0x60ea('0x1d')](respondWithResult(_0x23de9f,0xc9))[_0x60ea('0x50')](handleError(_0x23de9f,null));};exports[_0x60ea('0x30')]=function(_0x38acb5,_0x220ea4){if(_0x38acb5[_0x60ea('0x56')]['id']){delete _0x38acb5[_0x60ea('0x56')]['id'];}return db['SalesforceAccount'][_0x60ea('0x54')]({'where':{'id':_0x38acb5['params']['id']}})[_0x60ea('0x1d')](handleEntityNotFound(_0x220ea4,null))['then'](saveUpdates(_0x38acb5[_0x60ea('0x56')],null))['then'](respondWithResult(_0x220ea4,null))['catch'](handleError(_0x220ea4,null));};exports[_0x60ea('0x31')]=function(_0x1dc049,_0x2c3949){return db[_0x60ea('0x38')]['find']({'where':{'id':_0x1dc049[_0x60ea('0x52')]['id']}})[_0x60ea('0x1d')](handleEntityNotFound(_0x2c3949,null))[_0x60ea('0x1d')](removeEntity(_0x2c3949,null))[_0x60ea('0x50')](handleError(_0x2c3949,null));};exports['getConfigurations']=function(_0x14eb7f,_0x2c34b8,_0x1a805c){var _0x56d4d7={};var _0x359acd={};var _0x20ef39;var _0x5bbd3d;return db[_0x60ea('0x38')][_0x60ea('0x57')]({'where':{'id':_0x14eb7f[_0x60ea('0x52')]['id']}})[_0x60ea('0x1d')](handleEntityNotFound(_0x2c34b8,null))[_0x60ea('0x1d')](function(_0x3ea5e2){if(_0x3ea5e2){_0x20ef39=_0x3ea5e2;_0x359acd[_0x60ea('0x3b')]=_['keys'](db[_0x60ea('0x58')][_0x60ea('0x39')]);_0x359acd[_0x60ea('0x3c')]=_['keys'](_0x14eb7f['query']);_0x359acd['filters']=_[_0x60ea('0x40')](_0x359acd[_0x60ea('0x3b')],_0x359acd[_0x60ea('0x3c')]);_0x56d4d7['attributes']=_[_0x60ea('0x40')](_0x359acd['model'],qs[_0x60ea('0x41')](_0x14eb7f[_0x60ea('0x3c')][_0x60ea('0x41')]));_0x56d4d7[_0x60ea('0x3f')]=_0x56d4d7[_0x60ea('0x3f')][_0x60ea('0x59')]?_0x56d4d7[_0x60ea('0x3f')]:_0x359acd[_0x60ea('0x3b')];_0x56d4d7[_0x60ea('0x44')]=qs[_0x60ea('0x45')](_0x14eb7f['query']['sort']);_0x56d4d7[_0x60ea('0x46')]=qs[_0x60ea('0x3e')](_[_0x60ea('0x47')](_0x14eb7f[_0x60ea('0x3c')],_0x359acd[_0x60ea('0x3e')]));if(_0x14eb7f['query'][_0x60ea('0x48')]){_0x56d4d7[_0x60ea('0x46')]=_[_0x60ea('0x49')](_0x56d4d7[_0x60ea('0x46')],{'$or':_[_0x60ea('0x37')](_0x56d4d7['attributes'],function(_0x5576cc){var _0xa69f1d={};_0xa69f1d[_0x5576cc]={'$like':'%'+_0x14eb7f[_0x60ea('0x3c')][_0x60ea('0x48')]+'%'};return _0xa69f1d;})});}_0x56d4d7=_[_0x60ea('0x49')]({},_0x56d4d7,_0x14eb7f[_0x60ea('0x53')]);return _0x20ef39[_0x60ea('0x5a')](_0x56d4d7);}})[_0x60ea('0x1d')](function(_0xf8ff62){if(_0xf8ff62){_0x5bbd3d=_0xf8ff62[_0x60ea('0x59')];if(!_0x14eb7f[_0x60ea('0x3c')]['hasOwnProperty']('nolimit')){_0x56d4d7[_0x60ea('0x2b')]=qs[_0x60ea('0x2b')](_0x14eb7f[_0x60ea('0x3c')][_0x60ea('0x2b')]);_0x56d4d7[_0x60ea('0x2a')]=qs[_0x60ea('0x2a')](_0x14eb7f[_0x60ea('0x3c')]['offset']);}return _0x20ef39[_0x60ea('0x5a')](_0x56d4d7);}})[_0x60ea('0x1d')](function(_0x1988c6){if(_0x1988c6){return _0x1988c6?{'count':_0x5bbd3d,'rows':_0x1988c6}:null;}})[_0x60ea('0x1d')](respondWithResult(_0x2c34b8,null))[_0x60ea('0x50')](handleError(_0x2c34b8,null));};exports[_0x60ea('0x5b')]=function(_0x5135db,_0x5b09fe,_0x12d62e){if(_0x5135db[_0x60ea('0x56')]['id']){delete _0x5135db[_0x60ea('0x56')]['id'];}return db[_0x60ea('0x38')][_0x60ea('0x57')]({'where':{'id':_0x5135db[_0x60ea('0x52')]['id']}})[_0x60ea('0x1d')](handleEntityNotFound(_0x5b09fe,null))[_0x60ea('0x1d')](function(_0x295a57){if(_0x295a57){_0x5135db[_0x60ea('0x56')]['AccountId']=_0x295a57['id'];_0x5135db[_0x60ea('0x56')][_0x60ea('0x5c')]=integrations[_0x60ea('0x5d')](_0x5135db[_0x60ea('0x56')][_0x60ea('0x5e')],_0x5135db['body'][_0x60ea('0x4a')]);_0x5135db[_0x60ea('0x56')][_0x60ea('0x5f')]=integrations[_0x60ea('0x60')](_0x5135db[_0x60ea('0x56')]['channel'],_0x5135db[_0x60ea('0x56')][_0x60ea('0x4a')]);return db[_0x60ea('0x58')][_0x60ea('0x55')](_0x5135db['body'],{'include':[{'model':db[_0x60ea('0x61')],'as':_0x60ea('0x5c')},{'model':db[_0x60ea('0x61')],'as':_0x60ea('0x5f')}]});}return null;})[_0x60ea('0x1d')](respondWithResult(_0x5b09fe,null))[_0x60ea('0x50')](handleError(_0x5b09fe,null));};exports['getFields']=function(_0x345123,_0x315c4f,_0x56c47d){var _0x3777e9;var _0x12b485='';var _0x32f677=_0x60ea('0x62');return db['SalesforceAccount'][_0x60ea('0x57')]({'where':{'id':_0x345123[_0x60ea('0x52')]['id']},'attributes':['id',_0x60ea('0x63'),_0x60ea('0x64'),_0x60ea('0x65'),_0x60ea('0x66'),_0x60ea('0x67'),_0x60ea('0x68')]})[_0x60ea('0x1d')](handleEntityNotFound(_0x315c4f,null))[_0x60ea('0x1d')](function(_0x51a357){if(_0x51a357){_0x12b485=_0x51a357[_0x60ea('0x63')];var _0x194360=_0x12b485['slice'](-0x1);if(_0x194360==='/'){_0x12b485=_0x12b485[_0x60ea('0x69')](0x0,_0x12b485[_0x60ea('0x6a')](_0x194360));}_0x3777e9=new jsforce['Connection']({'oauth2':{'loginUrl':_0x12b485,'clientId':_0x51a357[_0x60ea('0x64')],'clientSecret':_0x51a357[_0x60ea('0x65')]}});return _0x3777e9[_0x60ea('0x6b')](_0x51a357['username'],_0x51a357[_0x60ea('0x67')][_0x60ea('0x6c')](_0x51a357[_0x60ea('0x68')]));}})[_0x60ea('0x1d')](function(_0x1dc69b){if(_0x1dc69b){if(!_['isNil'](_0x345123[_0x60ea('0x3c')][_0x60ea('0x6d')])){_0x32f677=_0x345123[_0x60ea('0x3c')][_0x60ea('0x6d')];}return _0x3777e9[_0x60ea('0x6e')](_0x32f677)['describe']();}})['then'](function(_0x45a040){var _0x453fe6=[_0x60ea('0x6f'),_0x60ea('0x70'),_0x60ea('0x71'),_0x60ea('0x72'),_0x60ea('0x73'),'Priority','Status',_0x60ea('0x74')];if(!_[_0x60ea('0x75')](_0x345123[_0x60ea('0x3c')][_0x60ea('0x6d')])&&_0x345123[_0x60ea('0x3c')][_0x60ea('0x6d')]===_0x60ea('0x76')){_0x453fe6=[_0x60ea('0x74'),_0x60ea('0x77'),_0x60ea('0x78'),_0x60ea('0x79'),'Priority',_0x60ea('0x7a'),'SuppliedName',_0x60ea('0x7b')];}if(_0x45a040){_[_0x60ea('0x7c')](_0x45a040[_0x60ea('0x41')],function(_0x48823b){return _0x48823b['custom']===![]&&!_0x453fe6[_0x60ea('0x7d')](_0x48823b['name']);});return{'count':_0x45a040[_0x60ea('0x41')][_0x60ea('0x59')],'rows':_[_0x60ea('0x37')](_0x45a040[_0x60ea('0x41')],function(_0x1d687d){return{'id':_0x1d687d[_0x60ea('0x34')],'name':_0x1d687d['label'],'custom':_0x1d687d['custom'],'options':_0x1d687d[_0x60ea('0x7e')][_0x60ea('0x59')]>0x0?_['map'](_0x1d687d[_0x60ea('0x7e')],function(_0x57f38a){return{'name':_0x57f38a[_0x60ea('0x7f')],'value':_0x57f38a['value']};}):_0x1d687d[_0x60ea('0x4a')]==_0x60ea('0x80')?[{'name':'True','value':_0x60ea('0x81')},{'name':_0x60ea('0x82'),'value':_0x60ea('0x83')}]:[]};})};}})['then'](respondWithResult(_0x315c4f,null))[_0x60ea('0x50')](function(_0x1802f0){var _0x31bc03=_0x345123[_0x60ea('0x3c')][_0x60ea('0x1a')]?0x1f4:_0x1802f0['statusCode']||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0x60ea('0x84'),_0x31bc03,JSON[_0x60ea('0x20')](_0x1802f0));delete _0x1802f0[_0x60ea('0x34')];if(_0x31bc03===0x191){_0x31bc03=0x190;}_0x315c4f[_0x60ea('0x28')](_0x31bc03)['send'](_0x345123[_0x60ea('0x3c')][_0x60ea('0x1a')]?{'message':_0x60ea('0x85'),'statusCode':_0x1802f0['statusCode']}:_0x1802f0);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index e06be27..6fca6a6 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 _0x80fc=['../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','define','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x3712e2,_0x32d752){var _0x1faff4=function(_0x550dc0){while(--_0x550dc0){_0x3712e2['push'](_0x3712e2['shift']());}};_0x1faff4(++_0x32d752);}(_0x80fc,0x1bf));var _0xc80f=function(_0x43f638,_0x45397c){_0x43f638=_0x43f638-0x0;var _0x30d91f=_0x80fc[_0x43f638];return _0x30d91f;};'use strict';var _=require(_0xc80f('0x0'));var util=require(_0xc80f('0x1'));var logger=require(_0xc80f('0x2'))(_0xc80f('0x3'));var moment=require('moment');var BPromise=require(_0xc80f('0x4'));var rp=require(_0xc80f('0x5'));var fs=require('fs');var path=require(_0xc80f('0x6'));var rimraf=require(_0xc80f('0x7'));var config=require(_0xc80f('0x8'));var attributes=require(_0xc80f('0x9'));var integrations=require(_0xc80f('0xa'));module[_0xc80f('0xb')]=function(_0x59e6cf,_0x593cc6){return _0x59e6cf[_0xc80f('0xc')]('SalesforceAccount',attributes,{'tableName':'int_salesforce_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x229e=['./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','define','int_salesforce_accounts','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x376b45,_0x5964fb){var _0x2341b3=function(_0x5a7f01){while(--_0x5a7f01){_0x376b45['push'](_0x376b45['shift']());}};_0x2341b3(++_0x5964fb);}(_0x229e,0x198));var _0xe229=function(_0x1b41ab,_0x45652a){_0x1b41ab=_0x1b41ab-0x0;var _0x121ba7=_0x229e[_0x1b41ab];return _0x121ba7;};'use strict';var _=require(_0xe229('0x0'));var util=require(_0xe229('0x1'));var logger=require('../../config/logger')(_0xe229('0x2'));var moment=require(_0xe229('0x3'));var BPromise=require('bluebird');var rp=require(_0xe229('0x4'));var fs=require('fs');var path=require(_0xe229('0x5'));var rimraf=require(_0xe229('0x6'));var config=require(_0xe229('0x7'));var attributes=require(_0xe229('0x8'));var integrations=require(_0xe229('0x9'));module[_0xe229('0xa')]=function(_0x2a737c,_0x387ee8){return _0x2a737c[_0xe229('0xb')]('SalesforceAccount',attributes,{'tableName':_0xe229('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 ff80331..9a36393 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 _0x00bb=['map','then','GetSalesforceAccount','ShowSalesforceAccount','find','raw','where','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','request','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','SalesforceAccount','options','attributes','limit','include','model'];(function(_0x2c2911,_0x507026){var _0x32f829=function(_0x246540){while(--_0x246540){_0x2c2911['push'](_0x2c2911['shift']());}};_0x32f829(++_0x507026);}(_0x00bb,0x1d8));var _0xb00b=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0x00bb[_0x3054be];return _0x3df150;};'use strict';var _=require(_0xb00b('0x0'));var util=require(_0xb00b('0x1'));var moment=require(_0xb00b('0x2'));var BPromise=require('bluebird');var rs=require(_0xb00b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb00b('0x4'))['db'];var utils=require(_0xb00b('0x5'));var logger=require('../../config/logger')(_0xb00b('0x6'));var config=require(_0xb00b('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x36e363,_0xf737d0,_0x41dfc9){return new BPromise(function(_0x37f07d,_0xfa4181){return client[_0xb00b('0x8')](_0x36e363,_0x41dfc9)['then'](function(_0x51d12b){logger[_0xb00b('0x9')](_0xb00b('0xa'),_0xf737d0,_0xb00b('0xb'));logger[_0xb00b('0xc')](_0xb00b('0xd'),_0xf737d0,'request\x20sent',JSON[_0xb00b('0xe')](_0x51d12b));if(_0x51d12b['error']){if(_0x51d12b['error']['code']===0x1f4){logger[_0xb00b('0xf')](_0xb00b('0xa'),_0xf737d0,_0x51d12b[_0xb00b('0xf')][_0xb00b('0x10')]);return _0xfa4181(_0x51d12b[_0xb00b('0xf')][_0xb00b('0x10')]);}logger['error'](_0xb00b('0xa'),_0xf737d0,_0x51d12b[_0xb00b('0xf')]['message']);return _0x37f07d(_0x51d12b[_0xb00b('0xf')][_0xb00b('0x10')]);}else{logger['info']('SalesforceAccount,\x20%s,\x20%s',_0xf737d0,_0xb00b('0xb'));_0x37f07d(_0x51d12b['result']['message']);}})[_0xb00b('0x11')](function(_0x638443){logger[_0xb00b('0xf')](_0xb00b('0xa'),_0xf737d0,_0x638443);_0xfa4181(_0x638443);});});}exports['GetSalesforceAccount']=function(_0x2a7231){var _0x599347=this;return new Promise(function(_0x415f91,_0x5aa9a0){return db[_0xb00b('0x12')]['findAll']({'raw':_0x2a7231[_0xb00b('0x13')]?_0x2a7231[_0xb00b('0x13')]['raw']===undefined?!![]:![]:!![],'where':_0x2a7231['options']?_0x2a7231[_0xb00b('0x13')]['where']||null:null,'attributes':_0x2a7231[_0xb00b('0x13')]?_0x2a7231[_0xb00b('0x13')][_0xb00b('0x14')]||null:null,'limit':_0x2a7231[_0xb00b('0x13')]?_0x2a7231['options'][_0xb00b('0x15')]||null:null,'include':_0x2a7231['options']?_0x2a7231[_0xb00b('0x13')][_0xb00b('0x16')]?_['map'](_0x2a7231[_0xb00b('0x13')][_0xb00b('0x16')],function(_0x520444){return{'model':db[_0x520444[_0xb00b('0x17')]],'as':_0x520444['as'],'attributes':_0x520444[_0xb00b('0x14')],'include':_0x520444['include']?_[_0xb00b('0x18')](_0x520444[_0xb00b('0x16')],function(_0x3c9500){return{'model':db[_0x3c9500[_0xb00b('0x17')]],'as':_0x3c9500['as'],'attributes':_0x3c9500['attributes'],'include':_0x3c9500['include']?_[_0xb00b('0x18')](_0x3c9500['include'],function(_0x550587){return{'model':db[_0x550587['model']],'as':_0x550587['as'],'attributes':_0x550587[_0xb00b('0x14')]};}):[]};}):[]};}):[]:[]})[_0xb00b('0x19')](function(_0x2592cf){logger[_0xb00b('0x9')](_0xb00b('0x1a'),_0x2a7231);logger[_0xb00b('0xc')](_0xb00b('0x1a'),_0x2a7231,JSON['stringify'](_0x2592cf));_0x415f91(_0x2592cf);})[_0xb00b('0x11')](function(_0x503c9c){logger[_0xb00b('0xf')](_0xb00b('0x1a'),_0x503c9c[_0xb00b('0x10')],_0x2a7231);_0x5aa9a0(_0x599347['error'](0x1f4,_0x503c9c[_0xb00b('0x10')]));});});};exports[_0xb00b('0x1b')]=function(_0x16fbd5){var _0x183233=this;return new Promise(function(_0x303625,_0x2b9824){return db[_0xb00b('0x12')][_0xb00b('0x1c')]({'raw':_0x16fbd5[_0xb00b('0x13')]?_0x16fbd5['options'][_0xb00b('0x1d')]===undefined?!![]:![]:!![],'where':_0x16fbd5[_0xb00b('0x13')]?_0x16fbd5['options'][_0xb00b('0x1e')]||null:null,'attributes':_0x16fbd5[_0xb00b('0x13')]?_0x16fbd5['options'][_0xb00b('0x14')]||null:null,'include':_0x16fbd5['options']?_0x16fbd5[_0xb00b('0x13')][_0xb00b('0x16')]?_[_0xb00b('0x18')](_0x16fbd5[_0xb00b('0x13')][_0xb00b('0x16')],function(_0x1436ad){return{'model':db[_0x1436ad[_0xb00b('0x17')]],'as':_0x1436ad['as'],'attributes':_0x1436ad['attributes'],'include':_0x1436ad['include']?_['map'](_0x1436ad[_0xb00b('0x16')],function(_0xc21102){return{'model':db[_0xc21102[_0xb00b('0x17')]],'as':_0xc21102['as'],'attributes':_0xc21102[_0xb00b('0x14')],'include':_0xc21102['include']?_[_0xb00b('0x18')](_0xc21102[_0xb00b('0x16')],function(_0x341f46){return{'model':db[_0x341f46[_0xb00b('0x17')]],'as':_0x341f46['as'],'attributes':_0x341f46[_0xb00b('0x14')]};}):[]};}):[]};}):[]:[]})[_0xb00b('0x19')](function(_0x8785ec){logger[_0xb00b('0x9')]('ShowSalesforceAccount',_0x16fbd5);logger['debug'](_0xb00b('0x1b'),_0x16fbd5,JSON['stringify'](_0x8785ec));_0x303625(_0x8785ec);})[_0xb00b('0x11')](function(_0x1c5400){logger[_0xb00b('0xf')](_0xb00b('0x1b'),_0x1c5400[_0xb00b('0x10')],_0x16fbd5);_0x2b9824(_0x183233[_0xb00b('0xf')](0x1f4,_0x1c5400[_0xb00b('0x10')]));});});}; \ No newline at end of file +var _0xb49a=['info','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','SalesforceAccount,\x20%s,\x20%s','message','result','catch','GetSalesforceAccount','options','attributes','include','map','model','ShowSalesforceAccount','SalesforceAccount','find','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x4e6ae6,_0x49dba6){var _0x23c108=function(_0x1bc103){while(--_0x1bc103){_0x4e6ae6['push'](_0x4e6ae6['shift']());}};_0x23c108(++_0x49dba6);}(_0xb49a,0xfb));var _0xab49=function(_0x168f21,_0x70b14){_0x168f21=_0x168f21-0x0;var _0x66dba=_0xb49a[_0x168f21];return _0x66dba;};'use strict';var _=require(_0xab49('0x0'));var util=require(_0xab49('0x1'));var moment=require(_0xab49('0x2'));var BPromise=require(_0xab49('0x3'));var rs=require(_0xab49('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xab49('0x5'))['db'];var utils=require(_0xab49('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xab49('0x7'));var jayson=require(_0xab49('0x8'));var client=jayson[_0xab49('0x9')][_0xab49('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x57ea72,_0x26a98a,_0xd86a5){return new BPromise(function(_0x4d4d00,_0x15f259){return client[_0xab49('0xb')](_0x57ea72,_0xd86a5)[_0xab49('0xc')](function(_0x79f764){logger[_0xab49('0xd')]('SalesforceAccount,\x20%s,\x20%s',_0x26a98a,'request\x20sent');logger[_0xab49('0xe')](_0xab49('0xf'),_0x26a98a,_0xab49('0x10'),JSON[_0xab49('0x11')](_0x79f764));if(_0x79f764[_0xab49('0x12')]){if(_0x79f764['error'][_0xab49('0x13')]===0x1f4){logger[_0xab49('0x12')](_0xab49('0x14'),_0x26a98a,_0x79f764[_0xab49('0x12')][_0xab49('0x15')]);return _0x15f259(_0x79f764[_0xab49('0x12')][_0xab49('0x15')]);}logger[_0xab49('0x12')](_0xab49('0x14'),_0x26a98a,_0x79f764[_0xab49('0x12')][_0xab49('0x15')]);return _0x4d4d00(_0x79f764['error'][_0xab49('0x15')]);}else{logger[_0xab49('0xd')](_0xab49('0x14'),_0x26a98a,_0xab49('0x10'));_0x4d4d00(_0x79f764[_0xab49('0x16')]['message']);}})[_0xab49('0x17')](function(_0x2cbcff){logger[_0xab49('0x12')](_0xab49('0x14'),_0x26a98a,_0x2cbcff);_0x15f259(_0x2cbcff);});});}exports[_0xab49('0x18')]=function(_0x47f977){var _0x167a2a=this;return new Promise(function(_0x24cb8f,_0x28449b){return db['SalesforceAccount']['findAll']({'raw':_0x47f977[_0xab49('0x19')]?_0x47f977[_0xab49('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x47f977[_0xab49('0x19')]?_0x47f977[_0xab49('0x19')]['where']||null:null,'attributes':_0x47f977[_0xab49('0x19')]?_0x47f977['options'][_0xab49('0x1a')]||null:null,'limit':_0x47f977[_0xab49('0x19')]?_0x47f977['options']['limit']||null:null,'include':_0x47f977[_0xab49('0x19')]?_0x47f977['options'][_0xab49('0x1b')]?_['map'](_0x47f977[_0xab49('0x19')][_0xab49('0x1b')],function(_0x2ba18a){return{'model':db[_0x2ba18a['model']],'as':_0x2ba18a['as'],'attributes':_0x2ba18a[_0xab49('0x1a')],'include':_0x2ba18a['include']?_[_0xab49('0x1c')](_0x2ba18a[_0xab49('0x1b')],function(_0x5c3d71){return{'model':db[_0x5c3d71[_0xab49('0x1d')]],'as':_0x5c3d71['as'],'attributes':_0x5c3d71[_0xab49('0x1a')],'include':_0x5c3d71['include']?_['map'](_0x5c3d71[_0xab49('0x1b')],function(_0x2e0e37){return{'model':db[_0x2e0e37[_0xab49('0x1d')]],'as':_0x2e0e37['as'],'attributes':_0x2e0e37['attributes']};}):[]};}):[]};}):[]:[]})[_0xab49('0xc')](function(_0x237273){logger['info'](_0xab49('0x18'),_0x47f977);logger[_0xab49('0xe')](_0xab49('0x18'),_0x47f977,JSON['stringify'](_0x237273));_0x24cb8f(_0x237273);})[_0xab49('0x17')](function(_0x550f06){logger[_0xab49('0x12')]('GetSalesforceAccount',_0x550f06[_0xab49('0x15')],_0x47f977);_0x28449b(_0x167a2a['error'](0x1f4,_0x550f06[_0xab49('0x15')]));});});};exports[_0xab49('0x1e')]=function(_0x1c48ef){var _0x211be2=this;return new Promise(function(_0x49f122,_0x6e83f6){return db[_0xab49('0x1f')][_0xab49('0x20')]({'raw':_0x1c48ef['options']?_0x1c48ef[_0xab49('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x1c48ef[_0xab49('0x19')]?_0x1c48ef['options']['where']||null:null,'attributes':_0x1c48ef['options']?_0x1c48ef[_0xab49('0x19')]['attributes']||null:null,'include':_0x1c48ef[_0xab49('0x19')]?_0x1c48ef[_0xab49('0x19')][_0xab49('0x1b')]?_['map'](_0x1c48ef[_0xab49('0x19')][_0xab49('0x1b')],function(_0x3cc88b){return{'model':db[_0x3cc88b[_0xab49('0x1d')]],'as':_0x3cc88b['as'],'attributes':_0x3cc88b[_0xab49('0x1a')],'include':_0x3cc88b['include']?_[_0xab49('0x1c')](_0x3cc88b[_0xab49('0x1b')],function(_0x496000){return{'model':db[_0x496000['model']],'as':_0x496000['as'],'attributes':_0x496000[_0xab49('0x1a')],'include':_0x496000[_0xab49('0x1b')]?_[_0xab49('0x1c')](_0x496000[_0xab49('0x1b')],function(_0x325ad9){return{'model':db[_0x325ad9[_0xab49('0x1d')]],'as':_0x325ad9['as'],'attributes':_0x325ad9[_0xab49('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xab49('0xc')](function(_0x459b9d){logger[_0xab49('0xd')](_0xab49('0x1e'),_0x1c48ef);logger[_0xab49('0xe')](_0xab49('0x1e'),_0x1c48ef,JSON['stringify'](_0x459b9d));_0x49f122(_0x459b9d);})[_0xab49('0x17')](function(_0x1803d3){logger[_0xab49('0x12')](_0xab49('0x1e'),_0x1803d3[_0xab49('0x15')],_0x1c48ef);_0x6e83f6(_0x211be2['error'](0x1f4,_0x1803d3[_0xab49('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 02c8c19..1886ef2 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 _0x15f1=['../../components/auth/service','../../components/interaction/service','./intSalesforceConfiguration.controller','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getDescriptions','post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x9540b6,_0x23d466){var _0x289eba=function(_0x1f6d83){while(--_0x1f6d83){_0x9540b6['push'](_0x9540b6['shift']());}};_0x289eba(++_0x23d466);}(_0x15f1,0x1c6));var _0x115f=function(_0x39507c,_0x260989){_0x39507c=_0x39507c-0x0;var _0x312f97=_0x15f1[_0x39507c];return _0x312f97;};'use strict';var multer=require(_0x115f('0x0'));var util=require(_0x115f('0x1'));var path=require(_0x115f('0x2'));var timeout=require(_0x115f('0x3'));var express=require(_0x115f('0x4'));var router=express[_0x115f('0x5')]();var auth=require(_0x115f('0x6'));var interaction=require(_0x115f('0x7'));var config=require('../../config/environment');var controller=require(_0x115f('0x8'));router[_0x115f('0x9')]('/',auth[_0x115f('0xa')](),controller['index']);router['get'](_0x115f('0xb'),auth[_0x115f('0xa')](),controller[_0x115f('0xc')]);router[_0x115f('0x9')](_0x115f('0xd'),auth[_0x115f('0xa')](),controller[_0x115f('0xe')]);router[_0x115f('0x9')](_0x115f('0xf'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x115f('0x9')]('/:id/descriptions',auth[_0x115f('0xa')](),controller[_0x115f('0x10')]);router[_0x115f('0x11')]('/',auth[_0x115f('0xa')](),controller[_0x115f('0x12')]);router[_0x115f('0x13')](_0x115f('0xb'),auth['isAuthenticated'](),controller[_0x115f('0x14')]);router[_0x115f('0x15')]('/:id',auth[_0x115f('0xa')](),controller['destroy']);module[_0x115f('0x16')]=router; \ No newline at end of file +var _0xa879=['destroy','multer','express','Router','../../components/auth/service','../../components/interaction/service','./intSalesforceConfiguration.controller','isAuthenticated','index','get','/:id','getFields','/:id/subjects','/:id/descriptions','post','create','put','update','delete'];(function(_0x41450,_0x3196bb){var _0x1d9985=function(_0x189df0){while(--_0x189df0){_0x41450['push'](_0x41450['shift']());}};_0x1d9985(++_0x3196bb);}(_0xa879,0x10b));var _0x9a87=function(_0x5de0c8,_0x136bad){_0x5de0c8=_0x5de0c8-0x0;var _0x556379=_0xa879[_0x5de0c8];return _0x556379;};'use strict';var multer=require(_0x9a87('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x9a87('0x1'));var router=express[_0x9a87('0x2')]();var auth=require(_0x9a87('0x3'));var interaction=require(_0x9a87('0x4'));var config=require('../../config/environment');var controller=require(_0x9a87('0x5'));router['get']('/',auth[_0x9a87('0x6')](),controller[_0x9a87('0x7')]);router[_0x9a87('0x8')](_0x9a87('0x9'),auth[_0x9a87('0x6')](),controller['show']);router[_0x9a87('0x8')]('/:id/fields',auth[_0x9a87('0x6')](),controller[_0x9a87('0xa')]);router[_0x9a87('0x8')](_0x9a87('0xb'),auth[_0x9a87('0x6')](),controller['getSubjects']);router[_0x9a87('0x8')](_0x9a87('0xc'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0x9a87('0xd')]('/',auth['isAuthenticated'](),controller[_0x9a87('0xe')]);router[_0x9a87('0xf')](_0x9a87('0x9'),auth[_0x9a87('0x6')](),controller[_0x9a87('0x10')]);router[_0x9a87('0x11')](_0x9a87('0x9'),auth[_0x9a87('0x6')](),controller[_0x9a87('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 889d677..cdd8c4a 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 _0xd9d4=['contact_lead','lead','contact','sequelize','exports','STRING','ENUM','Task','Case'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd9d4,0x16b));var _0x4d9d=function(_0x28fbe3,_0x4ac6f8){_0x28fbe3=_0x28fbe3-0x0;var _0x45db6a=_0xd9d4[_0x28fbe3];return _0x45db6a;};'use strict';var Sequelize=require(_0x4d9d('0x0'));module[_0x4d9d('0x1')]={'name':{'type':Sequelize[_0x4d9d('0x2')]},'description':{'type':Sequelize[_0x4d9d('0x2')]},'ticketType':{'type':Sequelize[_0x4d9d('0x3')](_0x4d9d('0x4'),_0x4d9d('0x5')),'defaultValue':_0x4d9d('0x4')},'moduleSearch':{'type':Sequelize['ENUM'](_0x4d9d('0x6'),'contact',_0x4d9d('0x7')),'defaultValue':'contact_lead'},'moduleCreate':{'type':Sequelize['ENUM']('nothing',_0x4d9d('0x8'),_0x4d9d('0x7')),'defaultValue':_0x4d9d('0x7')}}; \ No newline at end of file +var _0x2fed=['nothing','contact','sequelize','exports','STRING','Task','Case','ENUM','lead'];(function(_0x51bd51,_0x49d78d){var _0x29143d=function(_0xeb9f30){while(--_0xeb9f30){_0x51bd51['push'](_0x51bd51['shift']());}};_0x29143d(++_0x49d78d);}(_0x2fed,0x89));var _0xd2fe=function(_0xa5d0c3,_0x133962){_0xa5d0c3=_0xa5d0c3-0x0;var _0x4a588a=_0x2fed[_0xa5d0c3];return _0x4a588a;};'use strict';var Sequelize=require(_0xd2fe('0x0'));module[_0xd2fe('0x1')]={'name':{'type':Sequelize[_0xd2fe('0x2')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize['ENUM'](_0xd2fe('0x3'),_0xd2fe('0x4')),'defaultValue':_0xd2fe('0x3')},'moduleSearch':{'type':Sequelize[_0xd2fe('0x5')]('contact_lead','contact',_0xd2fe('0x6')),'defaultValue':'contact_lead'},'moduleCreate':{'type':Sequelize[_0xd2fe('0x5')](_0xd2fe('0x7'),_0xd2fe('0x8'),_0xd2fe('0x6')),'defaultValue':_0xd2fe('0x6')}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index ce892d0..ffd0699 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 _0xa482=['crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','SalesforceConfiguration','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','merge','type','VIRTUAL','includeAll','include','rows','show','params','options','find','create','body','getFields','findOne','SalesforceField','where','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xa482,0x181));var _0x2a48=function(_0x14cd83,_0x64b65f){_0x14cd83=_0x14cd83-0x0;var _0x171f39=_0xa482[_0x14cd83];return _0x171f39;};'use strict';var pdf=require(_0x2a48('0x0'));var emlformat=require(_0x2a48('0x1'));var rimraf=require(_0x2a48('0x2'));var zipdir=require(_0x2a48('0x3'));var jsonpatch=require(_0x2a48('0x4'));var rp=require(_0x2a48('0x5'));var moment=require('moment');var BPromise=require(_0x2a48('0x6'));var Mustache=require(_0x2a48('0x7'));var util=require(_0x2a48('0x8'));var path=require(_0x2a48('0x9'));var sox=require(_0x2a48('0xa'));var csv=require(_0x2a48('0xb'));var ejs=require(_0x2a48('0xc'));var fs=require('fs');var _=require(_0x2a48('0xd'));var squel=require(_0x2a48('0xe'));var crypto=require(_0x2a48('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x2a48('0x10'));var toCsv=require(_0x2a48('0xb'));var querystring=require('querystring');var Papa=require(_0x2a48('0x11'));var Redis=require(_0x2a48('0x12'));var authService=require(_0x2a48('0x13'));var qs=require(_0x2a48('0x14'));var as=require(_0x2a48('0x15'));var hardwareService=require(_0x2a48('0x16'));var logger=require(_0x2a48('0x17'))('api');var utils=require(_0x2a48('0x18'));var config=require(_0x2a48('0x19'));var db=require(_0x2a48('0x1a'))['db'];var jayson=require(_0x2a48('0x1b'));var client=jayson['client'][_0x2a48('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x5a2972,_0x56ee1c,_0x413cf9){if(_0x413cf9){var _0x1739bb=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1739bb[_0x2a48('0x1d')](_0x56ee1c)){return _0x5a2972;}else{throw new db[(_0x2a48('0x1e'))][(_0x2a48('0x1f'))](_0x2a48('0x20'));}}else{return _0x5a2972;}}function respondWithRpcPromise(_0x32b77a,_0x45e125,_0x20301d,_0x4ac4d7){return new BPromise(function(_0x5416dc,_0x22dfcc){var _0x3aa358=_0x4ac4d7||client;return _0x3aa358[_0x2a48('0x21')](_0x32b77a,_0x20301d)[_0x2a48('0x22')](function(_0x57b662){logger[_0x2a48('0x23')](_0x2a48('0x24'),_0x45e125,_0x2a48('0x25'));logger[_0x2a48('0x26')](_0x2a48('0x27'),_0x45e125,'request\x20sent',JSON[_0x2a48('0x28')](_0x57b662));if(_0x57b662[_0x2a48('0x29')]){if(_0x57b662[_0x2a48('0x29')][_0x2a48('0x2a')]===0x1f4){logger[_0x2a48('0x29')](_0x2a48('0x24'),_0x45e125,_0x57b662['error'][_0x2a48('0x2b')]);return _0x22dfcc(_0x57b662[_0x2a48('0x29')][_0x2a48('0x2b')]);}logger[_0x2a48('0x29')](_0x2a48('0x24'),_0x45e125,_0x57b662['error']['message']);return _0x5416dc(_0x57b662[_0x2a48('0x29')]['message']);}else{logger[_0x2a48('0x23')](_0x2a48('0x24'),_0x45e125,_0x2a48('0x25'));_0x5416dc(_0x57b662[_0x2a48('0x2c')]['message']);}})[_0x2a48('0x2d')](function(_0xa3c05){logger[_0x2a48('0x29')]('SalesforceConfiguration,\x20%s,\x20%s',_0x45e125,_0xa3c05);_0x22dfcc(_0xa3c05);});});}function respondWithStatusCode(_0x4207d4,_0x33a77c){_0x33a77c=_0x33a77c||0xcc;return function(_0x55a735){if(_0x55a735){return _0x4207d4[_0x2a48('0x2e')](_0x33a77c);}return _0x4207d4['status'](_0x33a77c)['end']();};}function respondWithResult(_0x15549e,_0x5cb5ee){_0x5cb5ee=_0x5cb5ee||0xc8;return function(_0xe59d24){if(_0xe59d24){return _0x15549e[_0x2a48('0x2f')](_0x5cb5ee)[_0x2a48('0x30')](_0xe59d24);}};}function respondWithFilteredResult(_0x546c33,_0x5a1250){return function(_0x11f03d){if(_0x11f03d){var _0x4d8889=_0x11f03d[_0x2a48('0x31')],_0x415499=_0x5a1250[_0x2a48('0x32')],_0x5f12fe=_0x5a1250[_0x2a48('0x32')]+_0x5a1250['limit'],_0x152b2d;if(_0x5f12fe>=_0x4d8889){_0x5f12fe=_0x4d8889;_0x152b2d=0xc8;}else{_0x152b2d=0xce;}_0x546c33[_0x2a48('0x2f')](_0x152b2d);return _0x546c33[_0x2a48('0x33')](_0x2a48('0x34'),_0x415499+'-'+_0x5f12fe+'/'+_0x4d8889)[_0x2a48('0x30')](_0x11f03d);}return null;};}function patchUpdates(_0x1eaad2){return function(_0x592e04){try{jsonpatch[_0x2a48('0x35')](_0x592e04,_0x1eaad2,!![]);}catch(_0x339eed){return BPromise[_0x2a48('0x36')](_0x339eed);}return _0x592e04[_0x2a48('0x37')]();};}function saveUpdates(_0x278640,_0x163801){return function(_0x41c592){if(_0x41c592){return _0x41c592[_0x2a48('0x38')](_0x278640)['then'](function(_0x4745fd){return _0x4745fd;});}return null;};}function removeEntity(_0x22a090,_0x57910e){return function(_0x4680ab){if(_0x4680ab){return _0x4680ab[_0x2a48('0x39')]()[_0x2a48('0x22')](function(){_0x22a090[_0x2a48('0x2f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x261a80,_0x26fa5c){return function(_0x353b0b){if(!_0x353b0b){_0x261a80[_0x2a48('0x2e')](0x194);}return _0x353b0b;};}function handleError(_0x22d42c,_0x28733c){_0x28733c=_0x28733c||0x1f4;return function(_0x2c5749){logger['error'](_0x2c5749[_0x2a48('0x3a')]);if(_0x2c5749[_0x2a48('0x3b')]){delete _0x2c5749['name'];}_0x22d42c['status'](_0x28733c)[_0x2a48('0x3c')](_0x2c5749);};}exports[_0x2a48('0x3d')]=function(_0x4767d0,_0x3ce308){var _0x33069f={},_0x46c08a={},_0x4da3d5={'count':0x0,'rows':[]};var _0x41bad1=_[_0x2a48('0x3e')](db[_0x2a48('0x3f')][_0x2a48('0x40')],function(_0x59b23e){return{'name':_0x59b23e[_0x2a48('0x41')],'type':_0x59b23e['type'][_0x2a48('0x42')]};});_0x46c08a[_0x2a48('0x43')]=_[_0x2a48('0x3e')](_0x41bad1,_0x2a48('0x3b'));_0x46c08a[_0x2a48('0x44')]=_[_0x2a48('0x45')](_0x4767d0['query']);_0x46c08a[_0x2a48('0x46')]=_[_0x2a48('0x47')](_0x46c08a['model'],_0x46c08a[_0x2a48('0x44')]);_0x33069f['attributes']=_[_0x2a48('0x47')](_0x46c08a[_0x2a48('0x43')],qs['fields'](_0x4767d0['query'][_0x2a48('0x48')]));_0x33069f[_0x2a48('0x49')]=_0x33069f[_0x2a48('0x49')][_0x2a48('0x4a')]?_0x33069f['attributes']:_0x46c08a[_0x2a48('0x43')];if(!_0x4767d0['query'][_0x2a48('0x4b')](_0x2a48('0x4c'))){_0x33069f['limit']=qs[_0x2a48('0x4d')](_0x4767d0[_0x2a48('0x44')][_0x2a48('0x4d')]);_0x33069f['offset']=qs[_0x2a48('0x32')](_0x4767d0['query'][_0x2a48('0x32')]);}_0x33069f[_0x2a48('0x4e')]=qs['sort'](_0x4767d0[_0x2a48('0x44')][_0x2a48('0x4f')]);_0x33069f['where']=qs[_0x2a48('0x46')](_[_0x2a48('0x50')](_0x4767d0[_0x2a48('0x44')],_0x46c08a[_0x2a48('0x46')]),_0x41bad1);if(_0x4767d0[_0x2a48('0x44')][_0x2a48('0x51')]){_0x33069f['where']=_[_0x2a48('0x52')](_0x33069f['where'],{'$or':_['map'](_0x41bad1,function(_0x1e5fd9){if(_0x1e5fd9[_0x2a48('0x53')]!==_0x2a48('0x54')){var _0x55a965={};_0x55a965[_0x1e5fd9[_0x2a48('0x3b')]]={'$like':'%'+_0x4767d0[_0x2a48('0x44')][_0x2a48('0x51')]+'%'};return _0x55a965;}})});}_0x33069f=_[_0x2a48('0x52')]({},_0x33069f,_0x4767d0['options']);var _0x1d8210={'where':_0x33069f['where']};return db['SalesforceConfiguration']['count'](_0x1d8210)['then'](function(_0x129847){_0x4da3d5[_0x2a48('0x31')]=_0x129847;if(_0x4767d0['query'][_0x2a48('0x55')]){_0x33069f[_0x2a48('0x56')]=[{'all':!![]}];}return db[_0x2a48('0x3f')]['findAll'](_0x33069f);})[_0x2a48('0x22')](function(_0x5a5d30){_0x4da3d5[_0x2a48('0x57')]=_0x5a5d30;return _0x4da3d5;})[_0x2a48('0x22')](respondWithFilteredResult(_0x3ce308,_0x33069f))[_0x2a48('0x2d')](handleError(_0x3ce308,null));};exports[_0x2a48('0x58')]=function(_0x5de5fb,_0x1e8987){var _0x1c74ab={'raw':![],'where':{'id':_0x5de5fb[_0x2a48('0x59')]['id']}},_0xeedd08={};_0xeedd08[_0x2a48('0x43')]=_[_0x2a48('0x45')](db[_0x2a48('0x3f')]['rawAttributes']);_0xeedd08['query']=_[_0x2a48('0x45')](_0x5de5fb[_0x2a48('0x44')]);_0xeedd08[_0x2a48('0x46')]=_[_0x2a48('0x47')](_0xeedd08[_0x2a48('0x43')],_0xeedd08[_0x2a48('0x44')]);_0x1c74ab[_0x2a48('0x49')]=_[_0x2a48('0x47')](_0xeedd08['model'],qs[_0x2a48('0x48')](_0x5de5fb['query'][_0x2a48('0x48')]));_0x1c74ab[_0x2a48('0x49')]=_0x1c74ab[_0x2a48('0x49')][_0x2a48('0x4a')]?_0x1c74ab[_0x2a48('0x49')]:_0xeedd08[_0x2a48('0x43')];if(_0x5de5fb[_0x2a48('0x44')][_0x2a48('0x55')]){_0x1c74ab[_0x2a48('0x56')]=[{'all':!![]}];}_0x1c74ab=_[_0x2a48('0x52')]({},_0x1c74ab,_0x5de5fb[_0x2a48('0x5a')]);return db[_0x2a48('0x3f')][_0x2a48('0x5b')](_0x1c74ab)[_0x2a48('0x22')](handleEntityNotFound(_0x1e8987,null))[_0x2a48('0x22')](respondWithResult(_0x1e8987,null))[_0x2a48('0x2d')](handleError(_0x1e8987,null));};exports[_0x2a48('0x5c')]=function(_0x285380,_0xdaf4c5){return db['SalesforceConfiguration'][_0x2a48('0x5c')](_0x285380['body'],{})[_0x2a48('0x22')](respondWithResult(_0xdaf4c5,0xc9))[_0x2a48('0x2d')](handleError(_0xdaf4c5,null));};exports[_0x2a48('0x38')]=function(_0x227718,_0x4b9893){if(_0x227718[_0x2a48('0x5d')]['id']){delete _0x227718[_0x2a48('0x5d')]['id'];}return db[_0x2a48('0x3f')][_0x2a48('0x5b')]({'where':{'id':_0x227718['params']['id']}})['then'](handleEntityNotFound(_0x4b9893,null))['then'](saveUpdates(_0x227718[_0x2a48('0x5d')],null))[_0x2a48('0x22')](respondWithResult(_0x4b9893,null))[_0x2a48('0x2d')](handleError(_0x4b9893,null));};exports['destroy']=function(_0x2e9591,_0x3af753){return db['SalesforceConfiguration']['find']({'where':{'id':_0x2e9591['params']['id']}})['then'](handleEntityNotFound(_0x3af753,null))[_0x2a48('0x22')](removeEntity(_0x3af753,null))[_0x2a48('0x2d')](handleError(_0x3af753,null));};exports[_0x2a48('0x5e')]=function(_0x2a32be,_0x4ad1fa,_0x656ea6){var _0x5b634d={};var _0x4e89c1={};var _0xb82f28;var _0x3c191a;return db[_0x2a48('0x3f')][_0x2a48('0x5f')]({'where':{'id':_0x2a32be[_0x2a48('0x59')]['id']}})['then'](handleEntityNotFound(_0x4ad1fa,null))['then'](function(_0x2d5307){if(_0x2d5307){_0xb82f28=_0x2d5307;_0x4e89c1['model']=_[_0x2a48('0x45')](db[_0x2a48('0x60')][_0x2a48('0x40')]);_0x4e89c1[_0x2a48('0x44')]=_[_0x2a48('0x45')](_0x2a32be[_0x2a48('0x44')]);_0x4e89c1[_0x2a48('0x46')]=_[_0x2a48('0x47')](_0x4e89c1[_0x2a48('0x43')],_0x4e89c1[_0x2a48('0x44')]);_0x5b634d[_0x2a48('0x49')]=_[_0x2a48('0x47')](_0x4e89c1[_0x2a48('0x43')],qs[_0x2a48('0x48')](_0x2a32be['query'][_0x2a48('0x48')]));_0x5b634d['attributes']=_0x5b634d[_0x2a48('0x49')]['length']?_0x5b634d[_0x2a48('0x49')]:_0x4e89c1[_0x2a48('0x43')];_0x5b634d[_0x2a48('0x4e')]=qs[_0x2a48('0x4f')](_0x2a32be[_0x2a48('0x44')]['sort']);_0x5b634d[_0x2a48('0x61')]=qs['filters'](_[_0x2a48('0x50')](_0x2a32be[_0x2a48('0x44')],_0x4e89c1[_0x2a48('0x46')]));if(_0x2a32be[_0x2a48('0x44')][_0x2a48('0x51')]){_0x5b634d[_0x2a48('0x61')]=_[_0x2a48('0x52')](_0x5b634d[_0x2a48('0x61')],{'$or':_['map'](_0x5b634d[_0x2a48('0x49')],function(_0x5f3022){var _0x150a01={};_0x150a01[_0x5f3022]={'$like':'%'+_0x2a32be[_0x2a48('0x44')][_0x2a48('0x51')]+'%'};return _0x150a01;})});}_0x5b634d=_['merge']({},_0x5b634d,_0x2a32be[_0x2a48('0x5a')]);return _0xb82f28['getFields'](_0x5b634d);}})[_0x2a48('0x22')](function(_0x3fbbf5){if(_0x3fbbf5){_0x3c191a=_0x3fbbf5[_0x2a48('0x4a')];if(!_0x2a32be[_0x2a48('0x44')]['hasOwnProperty'](_0x2a48('0x4c'))){_0x5b634d[_0x2a48('0x4d')]=qs[_0x2a48('0x4d')](_0x2a32be[_0x2a48('0x44')][_0x2a48('0x4d')]);_0x5b634d[_0x2a48('0x32')]=qs[_0x2a48('0x32')](_0x2a32be[_0x2a48('0x44')]['offset']);}return _0xb82f28[_0x2a48('0x5e')](_0x5b634d);}})[_0x2a48('0x22')](function(_0x4bba8c){if(_0x4bba8c){return _0x4bba8c?{'count':_0x3c191a,'rows':_0x4bba8c}:null;}})[_0x2a48('0x22')](respondWithResult(_0x4ad1fa,null))[_0x2a48('0x2d')](handleError(_0x4ad1fa,null));};exports[_0x2a48('0x62')]=function(_0x1d9ec8,_0x20eaa4,_0x10bf2c){var _0x2bcf14={};var _0x3d6839={};var _0x58f8fb;var _0x356c31;return db[_0x2a48('0x3f')][_0x2a48('0x5f')]({'where':{'id':_0x1d9ec8[_0x2a48('0x59')]['id']}})[_0x2a48('0x22')](handleEntityNotFound(_0x20eaa4,null))[_0x2a48('0x22')](function(_0x197818){if(_0x197818){_0x58f8fb=_0x197818;_0x3d6839[_0x2a48('0x43')]=_[_0x2a48('0x45')](db[_0x2a48('0x60')][_0x2a48('0x40')]);_0x3d6839[_0x2a48('0x44')]=_['keys'](_0x1d9ec8[_0x2a48('0x44')]);_0x3d6839[_0x2a48('0x46')]=_['intersection'](_0x3d6839[_0x2a48('0x43')],_0x3d6839['query']);_0x2bcf14[_0x2a48('0x49')]=_['intersection'](_0x3d6839['model'],qs[_0x2a48('0x48')](_0x1d9ec8['query'][_0x2a48('0x48')]));_0x2bcf14[_0x2a48('0x49')]=_0x2bcf14['attributes'][_0x2a48('0x4a')]?_0x2bcf14['attributes']:_0x3d6839['model'];_0x2bcf14[_0x2a48('0x4e')]=qs[_0x2a48('0x4f')](_0x1d9ec8[_0x2a48('0x44')][_0x2a48('0x4f')]);_0x2bcf14[_0x2a48('0x61')]=qs[_0x2a48('0x46')](_[_0x2a48('0x50')](_0x1d9ec8[_0x2a48('0x44')],_0x3d6839[_0x2a48('0x46')]));if(_0x1d9ec8['query'][_0x2a48('0x51')]){_0x2bcf14[_0x2a48('0x61')]=_['merge'](_0x2bcf14[_0x2a48('0x61')],{'$or':_['map'](_0x2bcf14['attributes'],function(_0x3ea9d0){var _0x4d4403={};_0x4d4403[_0x3ea9d0]={'$like':'%'+_0x1d9ec8[_0x2a48('0x44')]['filter']+'%'};return _0x4d4403;})});}_0x2bcf14=_[_0x2a48('0x52')]({},_0x2bcf14,_0x1d9ec8[_0x2a48('0x5a')]);return _0x58f8fb[_0x2a48('0x62')](_0x2bcf14);}})[_0x2a48('0x22')](function(_0x37aa4f){if(_0x37aa4f){_0x356c31=_0x37aa4f[_0x2a48('0x4a')];if(!_0x1d9ec8[_0x2a48('0x44')][_0x2a48('0x4b')](_0x2a48('0x4c'))){_0x2bcf14[_0x2a48('0x4d')]=qs['limit'](_0x1d9ec8['query'][_0x2a48('0x4d')]);_0x2bcf14['offset']=qs[_0x2a48('0x32')](_0x1d9ec8[_0x2a48('0x44')][_0x2a48('0x32')]);}return _0x58f8fb[_0x2a48('0x62')](_0x2bcf14);}})[_0x2a48('0x22')](function(_0xf05160){if(_0xf05160){return _0xf05160?{'count':_0x356c31,'rows':_0xf05160}:null;}})[_0x2a48('0x22')](respondWithResult(_0x20eaa4,null))[_0x2a48('0x2d')](handleError(_0x20eaa4,null));};exports['getDescriptions']=function(_0x183bfe,_0x320234,_0xda80ea){var _0x59a027={};var _0x5d1cc1={};var _0x59c7fe;var _0x443a6a;return db[_0x2a48('0x3f')][_0x2a48('0x5f')]({'where':{'id':_0x183bfe[_0x2a48('0x59')]['id']}})[_0x2a48('0x22')](handleEntityNotFound(_0x320234,null))[_0x2a48('0x22')](function(_0x5afda0){if(_0x5afda0){_0x59c7fe=_0x5afda0;_0x5d1cc1['model']=_[_0x2a48('0x45')](db[_0x2a48('0x60')][_0x2a48('0x40')]);_0x5d1cc1[_0x2a48('0x44')]=_[_0x2a48('0x45')](_0x183bfe[_0x2a48('0x44')]);_0x5d1cc1[_0x2a48('0x46')]=_[_0x2a48('0x47')](_0x5d1cc1[_0x2a48('0x43')],_0x5d1cc1[_0x2a48('0x44')]);_0x59a027[_0x2a48('0x49')]=_['intersection'](_0x5d1cc1[_0x2a48('0x43')],qs[_0x2a48('0x48')](_0x183bfe[_0x2a48('0x44')][_0x2a48('0x48')]));_0x59a027[_0x2a48('0x49')]=_0x59a027['attributes']['length']?_0x59a027[_0x2a48('0x49')]:_0x5d1cc1[_0x2a48('0x43')];_0x59a027['order']=qs[_0x2a48('0x4f')](_0x183bfe['query']['sort']);_0x59a027[_0x2a48('0x61')]=qs['filters'](_[_0x2a48('0x50')](_0x183bfe[_0x2a48('0x44')],_0x5d1cc1['filters']));if(_0x183bfe[_0x2a48('0x44')][_0x2a48('0x51')]){_0x59a027[_0x2a48('0x61')]=_[_0x2a48('0x52')](_0x59a027[_0x2a48('0x61')],{'$or':_[_0x2a48('0x3e')](_0x59a027[_0x2a48('0x49')],function(_0x5d37d1){var _0x147ad7={};_0x147ad7[_0x5d37d1]={'$like':'%'+_0x183bfe[_0x2a48('0x44')][_0x2a48('0x51')]+'%'};return _0x147ad7;})});}_0x59a027=_[_0x2a48('0x52')]({},_0x59a027,_0x183bfe[_0x2a48('0x5a')]);return _0x59c7fe['getDescriptions'](_0x59a027);}})[_0x2a48('0x22')](function(_0x18cbb0){if(_0x18cbb0){_0x443a6a=_0x18cbb0['length'];if(!_0x183bfe[_0x2a48('0x44')][_0x2a48('0x4b')]('nolimit')){_0x59a027['limit']=qs[_0x2a48('0x4d')](_0x183bfe[_0x2a48('0x44')][_0x2a48('0x4d')]);_0x59a027['offset']=qs['offset'](_0x183bfe[_0x2a48('0x44')][_0x2a48('0x32')]);}return _0x59c7fe[_0x2a48('0x63')](_0x59a027);}})[_0x2a48('0x22')](function(_0xf8c867){if(_0xf8c867){return _0xf8c867?{'count':_0x443a6a,'rows':_0xf8c867}:null;}})[_0x2a48('0x22')](respondWithResult(_0x320234,null))[_0x2a48('0x2d')](handleError(_0x320234,null));}; \ No newline at end of file +var _0xd8b1=['squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','count','limit','set','Content-Range','json','apply','reject','save','update','then','stack','name','send','map','SalesforceConfiguration','rawAttributes','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','params','keys','find','create','body','destroy','getFields','SalesforceField','pick','getSubjects','getDescriptions','findOne','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','ejs'];(function(_0x34b1b8,_0x54c9bf){var _0x542dd8=function(_0xff3f89){while(--_0xff3f89){_0x34b1b8['push'](_0x34b1b8['shift']());}};_0x542dd8(++_0x54c9bf);}(_0xd8b1,0x105));var _0x1d8b=function(_0x3a03c4,_0x2dae77){_0x3a03c4=_0x3a03c4-0x0;var _0x482bfe=_0xd8b1[_0x3a03c4];return _0x482bfe;};'use strict';var pdf=require(_0x1d8b('0x0'));var emlformat=require(_0x1d8b('0x1'));var rimraf=require(_0x1d8b('0x2'));var zipdir=require(_0x1d8b('0x3'));var jsonpatch=require(_0x1d8b('0x4'));var rp=require('request-promise');var moment=require(_0x1d8b('0x5'));var BPromise=require(_0x1d8b('0x6'));var Mustache=require('mustache');var util=require(_0x1d8b('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x1d8b('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x1d8b('0x9'));var crypto=require(_0x1d8b('0xa'));var jsforce=require(_0x1d8b('0xb'));var deskjs=require(_0x1d8b('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x1d8b('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x1d8b('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1d8b('0xf'));var logger=require('../../config/logger')(_0x1d8b('0x10'));var utils=require(_0x1d8b('0x11'));var config=require(_0x1d8b('0x12'));var db=require(_0x1d8b('0x13'))['db'];var jayson=require(_0x1d8b('0x14'));var client=jayson[_0x1d8b('0x15')]['http']({'port':0x232a});function checkPasswordPattern(_0xec0671,_0x170d98,_0x2761df){if(_0x2761df){var _0x1bf879=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1bf879[_0x1d8b('0x16')](_0x170d98)){return _0xec0671;}else{throw new db[(_0x1d8b('0x17'))][(_0x1d8b('0x18'))](_0x1d8b('0x19'));}}else{return _0xec0671;}}function respondWithRpcPromise(_0x4fa6d8,_0x50c75f,_0x3d54d3,_0x3f31a4){return new BPromise(function(_0x44ebbe,_0x3bebce){var _0x334824=_0x3f31a4||client;return _0x334824[_0x1d8b('0x1a')](_0x4fa6d8,_0x3d54d3)['then'](function(_0x5aeef3){logger[_0x1d8b('0x1b')](_0x1d8b('0x1c'),_0x50c75f,_0x1d8b('0x1d'));logger[_0x1d8b('0x1e')](_0x1d8b('0x1f'),_0x50c75f,'request\x20sent',JSON[_0x1d8b('0x20')](_0x5aeef3));if(_0x5aeef3[_0x1d8b('0x21')]){if(_0x5aeef3['error'][_0x1d8b('0x22')]===0x1f4){logger[_0x1d8b('0x21')](_0x1d8b('0x1c'),_0x50c75f,_0x5aeef3['error'][_0x1d8b('0x23')]);return _0x3bebce(_0x5aeef3[_0x1d8b('0x21')][_0x1d8b('0x23')]);}logger[_0x1d8b('0x21')](_0x1d8b('0x1c'),_0x50c75f,_0x5aeef3[_0x1d8b('0x21')][_0x1d8b('0x23')]);return _0x44ebbe(_0x5aeef3['error'][_0x1d8b('0x23')]);}else{logger[_0x1d8b('0x1b')](_0x1d8b('0x1c'),_0x50c75f,_0x1d8b('0x1d'));_0x44ebbe(_0x5aeef3['result']['message']);}})[_0x1d8b('0x24')](function(_0x338146){logger['error'](_0x1d8b('0x1c'),_0x50c75f,_0x338146);_0x3bebce(_0x338146);});});}function respondWithStatusCode(_0x461405,_0x497d02){_0x497d02=_0x497d02||0xcc;return function(_0x4df3ab){if(_0x4df3ab){return _0x461405[_0x1d8b('0x25')](_0x497d02);}return _0x461405[_0x1d8b('0x26')](_0x497d02)[_0x1d8b('0x27')]();};}function respondWithResult(_0xe76d45,_0x45d9a4){_0x45d9a4=_0x45d9a4||0xc8;return function(_0x2e6249){if(_0x2e6249){return _0xe76d45[_0x1d8b('0x26')](_0x45d9a4)['json'](_0x2e6249);}};}function respondWithFilteredResult(_0x27371d,_0x4e03da){return function(_0x4b3a64){if(_0x4b3a64){var _0x4ccfa9=_0x4b3a64[_0x1d8b('0x28')],_0x37c284=_0x4e03da['offset'],_0x3f16de=_0x4e03da['offset']+_0x4e03da[_0x1d8b('0x29')],_0x14928e;if(_0x3f16de>=_0x4ccfa9){_0x3f16de=_0x4ccfa9;_0x14928e=0xc8;}else{_0x14928e=0xce;}_0x27371d[_0x1d8b('0x26')](_0x14928e);return _0x27371d[_0x1d8b('0x2a')](_0x1d8b('0x2b'),_0x37c284+'-'+_0x3f16de+'/'+_0x4ccfa9)[_0x1d8b('0x2c')](_0x4b3a64);}return null;};}function patchUpdates(_0x38a747){return function(_0x505435){try{jsonpatch[_0x1d8b('0x2d')](_0x505435,_0x38a747,!![]);}catch(_0x3be1e0){return BPromise[_0x1d8b('0x2e')](_0x3be1e0);}return _0x505435[_0x1d8b('0x2f')]();};}function saveUpdates(_0x408744,_0x1ef016){return function(_0x32a194){if(_0x32a194){return _0x32a194[_0x1d8b('0x30')](_0x408744)[_0x1d8b('0x31')](function(_0x551210){return _0x551210;});}return null;};}function removeEntity(_0x1a6960,_0x57268f){return function(_0x563614){if(_0x563614){return _0x563614['destroy']()[_0x1d8b('0x31')](function(){_0x1a6960[_0x1d8b('0x26')](0xcc)[_0x1d8b('0x27')]();});}};}function handleEntityNotFound(_0x21cccb,_0x1bb354){return function(_0x5ca10d){if(!_0x5ca10d){_0x21cccb[_0x1d8b('0x25')](0x194);}return _0x5ca10d;};}function handleError(_0x12822b,_0x1bb100){_0x1bb100=_0x1bb100||0x1f4;return function(_0xd18d69){logger[_0x1d8b('0x21')](_0xd18d69[_0x1d8b('0x32')]);if(_0xd18d69[_0x1d8b('0x33')]){delete _0xd18d69[_0x1d8b('0x33')];}_0x12822b['status'](_0x1bb100)[_0x1d8b('0x34')](_0xd18d69);};}exports['index']=function(_0x3522de,_0x493ebe){var _0x1db009={},_0x87ce24={},_0x10c520={'count':0x0,'rows':[]};var _0x487e65=_[_0x1d8b('0x35')](db[_0x1d8b('0x36')][_0x1d8b('0x37')],function(_0x197a15){return{'name':_0x197a15['fieldName'],'type':_0x197a15[_0x1d8b('0x38')][_0x1d8b('0x39')]};});_0x87ce24['model']=_[_0x1d8b('0x35')](_0x487e65,'name');_0x87ce24['query']=_['keys'](_0x3522de[_0x1d8b('0x3a')]);_0x87ce24[_0x1d8b('0x3b')]=_[_0x1d8b('0x3c')](_0x87ce24[_0x1d8b('0x3d')],_0x87ce24[_0x1d8b('0x3a')]);_0x1db009[_0x1d8b('0x3e')]=_[_0x1d8b('0x3c')](_0x87ce24['model'],qs[_0x1d8b('0x3f')](_0x3522de['query'][_0x1d8b('0x3f')]));_0x1db009['attributes']=_0x1db009[_0x1d8b('0x3e')][_0x1d8b('0x40')]?_0x1db009[_0x1d8b('0x3e')]:_0x87ce24[_0x1d8b('0x3d')];if(!_0x3522de[_0x1d8b('0x3a')][_0x1d8b('0x41')](_0x1d8b('0x42'))){_0x1db009['limit']=qs['limit'](_0x3522de[_0x1d8b('0x3a')][_0x1d8b('0x29')]);_0x1db009[_0x1d8b('0x43')]=qs[_0x1d8b('0x43')](_0x3522de[_0x1d8b('0x3a')]['offset']);}_0x1db009[_0x1d8b('0x44')]=qs[_0x1d8b('0x45')](_0x3522de['query']['sort']);_0x1db009['where']=qs[_0x1d8b('0x3b')](_['pick'](_0x3522de[_0x1d8b('0x3a')],_0x87ce24[_0x1d8b('0x3b')]),_0x487e65);if(_0x3522de['query'][_0x1d8b('0x46')]){_0x1db009[_0x1d8b('0x47')]=_[_0x1d8b('0x48')](_0x1db009[_0x1d8b('0x47')],{'$or':_[_0x1d8b('0x35')](_0x487e65,function(_0x571ea6){if(_0x571ea6['type']!==_0x1d8b('0x49')){var _0x29df6f={};_0x29df6f[_0x571ea6[_0x1d8b('0x33')]]={'$like':'%'+_0x3522de['query'][_0x1d8b('0x46')]+'%'};return _0x29df6f;}})});}_0x1db009=_[_0x1d8b('0x48')]({},_0x1db009,_0x3522de[_0x1d8b('0x4a')]);var _0x30971f={'where':_0x1db009[_0x1d8b('0x47')]};return db[_0x1d8b('0x36')][_0x1d8b('0x28')](_0x30971f)[_0x1d8b('0x31')](function(_0x57fe82){_0x10c520[_0x1d8b('0x28')]=_0x57fe82;if(_0x3522de[_0x1d8b('0x3a')][_0x1d8b('0x4b')]){_0x1db009[_0x1d8b('0x4c')]=[{'all':!![]}];}return db[_0x1d8b('0x36')][_0x1d8b('0x4d')](_0x1db009);})[_0x1d8b('0x31')](function(_0x15c069){_0x10c520['rows']=_0x15c069;return _0x10c520;})[_0x1d8b('0x31')](respondWithFilteredResult(_0x493ebe,_0x1db009))[_0x1d8b('0x24')](handleError(_0x493ebe,null));};exports['show']=function(_0x50ab12,_0x33d7cd){var _0x51584d={'raw':![],'where':{'id':_0x50ab12[_0x1d8b('0x4e')]['id']}},_0x36635f={};_0x36635f[_0x1d8b('0x3d')]=_[_0x1d8b('0x4f')](db[_0x1d8b('0x36')][_0x1d8b('0x37')]);_0x36635f[_0x1d8b('0x3a')]=_[_0x1d8b('0x4f')](_0x50ab12[_0x1d8b('0x3a')]);_0x36635f[_0x1d8b('0x3b')]=_[_0x1d8b('0x3c')](_0x36635f[_0x1d8b('0x3d')],_0x36635f[_0x1d8b('0x3a')]);_0x51584d[_0x1d8b('0x3e')]=_[_0x1d8b('0x3c')](_0x36635f[_0x1d8b('0x3d')],qs['fields'](_0x50ab12['query'][_0x1d8b('0x3f')]));_0x51584d[_0x1d8b('0x3e')]=_0x51584d['attributes'][_0x1d8b('0x40')]?_0x51584d['attributes']:_0x36635f['model'];if(_0x50ab12['query'][_0x1d8b('0x4b')]){_0x51584d[_0x1d8b('0x4c')]=[{'all':!![]}];}_0x51584d=_[_0x1d8b('0x48')]({},_0x51584d,_0x50ab12[_0x1d8b('0x4a')]);return db['SalesforceConfiguration'][_0x1d8b('0x50')](_0x51584d)[_0x1d8b('0x31')](handleEntityNotFound(_0x33d7cd,null))[_0x1d8b('0x31')](respondWithResult(_0x33d7cd,null))[_0x1d8b('0x24')](handleError(_0x33d7cd,null));};exports[_0x1d8b('0x51')]=function(_0x4e154f,_0x3a324f){return db[_0x1d8b('0x36')][_0x1d8b('0x51')](_0x4e154f['body'],{})[_0x1d8b('0x31')](respondWithResult(_0x3a324f,0xc9))[_0x1d8b('0x24')](handleError(_0x3a324f,null));};exports[_0x1d8b('0x30')]=function(_0x4fb8b1,_0x20d658){if(_0x4fb8b1[_0x1d8b('0x52')]['id']){delete _0x4fb8b1['body']['id'];}return db['SalesforceConfiguration'][_0x1d8b('0x50')]({'where':{'id':_0x4fb8b1[_0x1d8b('0x4e')]['id']}})[_0x1d8b('0x31')](handleEntityNotFound(_0x20d658,null))[_0x1d8b('0x31')](saveUpdates(_0x4fb8b1[_0x1d8b('0x52')],null))[_0x1d8b('0x31')](respondWithResult(_0x20d658,null))[_0x1d8b('0x24')](handleError(_0x20d658,null));};exports[_0x1d8b('0x53')]=function(_0x22bf9c,_0x1bb91c){return db[_0x1d8b('0x36')]['find']({'where':{'id':_0x22bf9c[_0x1d8b('0x4e')]['id']}})[_0x1d8b('0x31')](handleEntityNotFound(_0x1bb91c,null))[_0x1d8b('0x31')](removeEntity(_0x1bb91c,null))[_0x1d8b('0x24')](handleError(_0x1bb91c,null));};exports[_0x1d8b('0x54')]=function(_0x1ddc68,_0x5e1372,_0x4c044b){var _0x3919bd={};var _0x1dfec4={};var _0x5d3e05;var _0x105485;return db[_0x1d8b('0x36')]['findOne']({'where':{'id':_0x1ddc68[_0x1d8b('0x4e')]['id']}})[_0x1d8b('0x31')](handleEntityNotFound(_0x5e1372,null))['then'](function(_0x336b44){if(_0x336b44){_0x5d3e05=_0x336b44;_0x1dfec4[_0x1d8b('0x3d')]=_[_0x1d8b('0x4f')](db[_0x1d8b('0x55')][_0x1d8b('0x37')]);_0x1dfec4[_0x1d8b('0x3a')]=_['keys'](_0x1ddc68[_0x1d8b('0x3a')]);_0x1dfec4[_0x1d8b('0x3b')]=_['intersection'](_0x1dfec4[_0x1d8b('0x3d')],_0x1dfec4[_0x1d8b('0x3a')]);_0x3919bd[_0x1d8b('0x3e')]=_[_0x1d8b('0x3c')](_0x1dfec4[_0x1d8b('0x3d')],qs['fields'](_0x1ddc68[_0x1d8b('0x3a')][_0x1d8b('0x3f')]));_0x3919bd[_0x1d8b('0x3e')]=_0x3919bd[_0x1d8b('0x3e')]['length']?_0x3919bd['attributes']:_0x1dfec4[_0x1d8b('0x3d')];_0x3919bd[_0x1d8b('0x44')]=qs[_0x1d8b('0x45')](_0x1ddc68['query']['sort']);_0x3919bd['where']=qs[_0x1d8b('0x3b')](_[_0x1d8b('0x56')](_0x1ddc68['query'],_0x1dfec4[_0x1d8b('0x3b')]));if(_0x1ddc68['query'][_0x1d8b('0x46')]){_0x3919bd[_0x1d8b('0x47')]=_[_0x1d8b('0x48')](_0x3919bd[_0x1d8b('0x47')],{'$or':_[_0x1d8b('0x35')](_0x3919bd[_0x1d8b('0x3e')],function(_0x362b8c){var _0x288cd0={};_0x288cd0[_0x362b8c]={'$like':'%'+_0x1ddc68[_0x1d8b('0x3a')][_0x1d8b('0x46')]+'%'};return _0x288cd0;})});}_0x3919bd=_[_0x1d8b('0x48')]({},_0x3919bd,_0x1ddc68['options']);return _0x5d3e05[_0x1d8b('0x54')](_0x3919bd);}})[_0x1d8b('0x31')](function(_0x42ee98){if(_0x42ee98){_0x105485=_0x42ee98[_0x1d8b('0x40')];if(!_0x1ddc68[_0x1d8b('0x3a')][_0x1d8b('0x41')](_0x1d8b('0x42'))){_0x3919bd[_0x1d8b('0x29')]=qs[_0x1d8b('0x29')](_0x1ddc68[_0x1d8b('0x3a')][_0x1d8b('0x29')]);_0x3919bd[_0x1d8b('0x43')]=qs[_0x1d8b('0x43')](_0x1ddc68[_0x1d8b('0x3a')][_0x1d8b('0x43')]);}return _0x5d3e05[_0x1d8b('0x54')](_0x3919bd);}})[_0x1d8b('0x31')](function(_0x2c8cf4){if(_0x2c8cf4){return _0x2c8cf4?{'count':_0x105485,'rows':_0x2c8cf4}:null;}})[_0x1d8b('0x31')](respondWithResult(_0x5e1372,null))[_0x1d8b('0x24')](handleError(_0x5e1372,null));};exports[_0x1d8b('0x57')]=function(_0xf1cdcd,_0x40e499,_0x4fd733){var _0x1b1dcf={};var _0x41e44c={};var _0x4dd109;var _0x86a9e3;return db[_0x1d8b('0x36')]['findOne']({'where':{'id':_0xf1cdcd[_0x1d8b('0x4e')]['id']}})[_0x1d8b('0x31')](handleEntityNotFound(_0x40e499,null))[_0x1d8b('0x31')](function(_0x16a924){if(_0x16a924){_0x4dd109=_0x16a924;_0x41e44c['model']=_[_0x1d8b('0x4f')](db['SalesforceField'][_0x1d8b('0x37')]);_0x41e44c[_0x1d8b('0x3a')]=_[_0x1d8b('0x4f')](_0xf1cdcd[_0x1d8b('0x3a')]);_0x41e44c[_0x1d8b('0x3b')]=_['intersection'](_0x41e44c['model'],_0x41e44c['query']);_0x1b1dcf[_0x1d8b('0x3e')]=_[_0x1d8b('0x3c')](_0x41e44c[_0x1d8b('0x3d')],qs[_0x1d8b('0x3f')](_0xf1cdcd[_0x1d8b('0x3a')][_0x1d8b('0x3f')]));_0x1b1dcf[_0x1d8b('0x3e')]=_0x1b1dcf['attributes'][_0x1d8b('0x40')]?_0x1b1dcf[_0x1d8b('0x3e')]:_0x41e44c['model'];_0x1b1dcf[_0x1d8b('0x44')]=qs[_0x1d8b('0x45')](_0xf1cdcd[_0x1d8b('0x3a')]['sort']);_0x1b1dcf[_0x1d8b('0x47')]=qs[_0x1d8b('0x3b')](_['pick'](_0xf1cdcd[_0x1d8b('0x3a')],_0x41e44c[_0x1d8b('0x3b')]));if(_0xf1cdcd[_0x1d8b('0x3a')]['filter']){_0x1b1dcf[_0x1d8b('0x47')]=_[_0x1d8b('0x48')](_0x1b1dcf[_0x1d8b('0x47')],{'$or':_[_0x1d8b('0x35')](_0x1b1dcf[_0x1d8b('0x3e')],function(_0x10b644){var _0x29a5f6={};_0x29a5f6[_0x10b644]={'$like':'%'+_0xf1cdcd[_0x1d8b('0x3a')][_0x1d8b('0x46')]+'%'};return _0x29a5f6;})});}_0x1b1dcf=_['merge']({},_0x1b1dcf,_0xf1cdcd[_0x1d8b('0x4a')]);return _0x4dd109['getSubjects'](_0x1b1dcf);}})[_0x1d8b('0x31')](function(_0x26fb74){if(_0x26fb74){_0x86a9e3=_0x26fb74[_0x1d8b('0x40')];if(!_0xf1cdcd['query']['hasOwnProperty'](_0x1d8b('0x42'))){_0x1b1dcf['limit']=qs[_0x1d8b('0x29')](_0xf1cdcd[_0x1d8b('0x3a')][_0x1d8b('0x29')]);_0x1b1dcf[_0x1d8b('0x43')]=qs[_0x1d8b('0x43')](_0xf1cdcd[_0x1d8b('0x3a')][_0x1d8b('0x43')]);}return _0x4dd109['getSubjects'](_0x1b1dcf);}})['then'](function(_0x383fe3){if(_0x383fe3){return _0x383fe3?{'count':_0x86a9e3,'rows':_0x383fe3}:null;}})[_0x1d8b('0x31')](respondWithResult(_0x40e499,null))['catch'](handleError(_0x40e499,null));};exports[_0x1d8b('0x58')]=function(_0x468019,_0x4f76d4,_0x977610){var _0x3f7dd3={};var _0xefe6eb={};var _0x122b20;var _0x1af8bf;return db[_0x1d8b('0x36')][_0x1d8b('0x59')]({'where':{'id':_0x468019[_0x1d8b('0x4e')]['id']}})[_0x1d8b('0x31')](handleEntityNotFound(_0x4f76d4,null))[_0x1d8b('0x31')](function(_0x1aadfc){if(_0x1aadfc){_0x122b20=_0x1aadfc;_0xefe6eb[_0x1d8b('0x3d')]=_[_0x1d8b('0x4f')](db['SalesforceField'][_0x1d8b('0x37')]);_0xefe6eb['query']=_['keys'](_0x468019[_0x1d8b('0x3a')]);_0xefe6eb['filters']=_['intersection'](_0xefe6eb[_0x1d8b('0x3d')],_0xefe6eb[_0x1d8b('0x3a')]);_0x3f7dd3[_0x1d8b('0x3e')]=_['intersection'](_0xefe6eb[_0x1d8b('0x3d')],qs[_0x1d8b('0x3f')](_0x468019[_0x1d8b('0x3a')][_0x1d8b('0x3f')]));_0x3f7dd3[_0x1d8b('0x3e')]=_0x3f7dd3[_0x1d8b('0x3e')][_0x1d8b('0x40')]?_0x3f7dd3[_0x1d8b('0x3e')]:_0xefe6eb['model'];_0x3f7dd3[_0x1d8b('0x44')]=qs['sort'](_0x468019['query'][_0x1d8b('0x45')]);_0x3f7dd3[_0x1d8b('0x47')]=qs[_0x1d8b('0x3b')](_['pick'](_0x468019[_0x1d8b('0x3a')],_0xefe6eb[_0x1d8b('0x3b')]));if(_0x468019['query'][_0x1d8b('0x46')]){_0x3f7dd3[_0x1d8b('0x47')]=_[_0x1d8b('0x48')](_0x3f7dd3['where'],{'$or':_[_0x1d8b('0x35')](_0x3f7dd3[_0x1d8b('0x3e')],function(_0x13e84d){var _0xf33602={};_0xf33602[_0x13e84d]={'$like':'%'+_0x468019[_0x1d8b('0x3a')][_0x1d8b('0x46')]+'%'};return _0xf33602;})});}_0x3f7dd3=_[_0x1d8b('0x48')]({},_0x3f7dd3,_0x468019[_0x1d8b('0x4a')]);return _0x122b20[_0x1d8b('0x58')](_0x3f7dd3);}})[_0x1d8b('0x31')](function(_0x449903){if(_0x449903){_0x1af8bf=_0x449903[_0x1d8b('0x40')];if(!_0x468019[_0x1d8b('0x3a')][_0x1d8b('0x41')](_0x1d8b('0x42'))){_0x3f7dd3['limit']=qs[_0x1d8b('0x29')](_0x468019[_0x1d8b('0x3a')]['limit']);_0x3f7dd3[_0x1d8b('0x43')]=qs[_0x1d8b('0x43')](_0x468019[_0x1d8b('0x3a')]['offset']);}return _0x122b20[_0x1d8b('0x58')](_0x3f7dd3);}})[_0x1d8b('0x31')](function(_0x1a019a){if(_0x1a019a){return _0x1a019a?{'count':_0x1af8bf,'rows':_0x1a019a}:null;}})[_0x1d8b('0x31')](respondWithResult(_0x4f76d4,null))['catch'](handleError(_0x4f76d4,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 794987a..1534359 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 _0x7799=['define','SalesforceConfiguration','lodash','util','../../config/logger','api','request-promise','rimraf','./intSalesforceConfiguration.attributes','exports'];(function(_0xb27f0d,_0x2a387b){var _0x17b400=function(_0x3e4d40){while(--_0x3e4d40){_0xb27f0d['push'](_0xb27f0d['shift']());}};_0x17b400(++_0x2a387b);}(_0x7799,0x17e));var _0x9779=function(_0x14674d,_0x88c7ff){_0x14674d=_0x14674d-0x0;var _0x556c64=_0x7799[_0x14674d];return _0x556c64;};'use strict';var _=require(_0x9779('0x0'));var util=require(_0x9779('0x1'));var logger=require(_0x9779('0x2'))(_0x9779('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x9779('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9779('0x5'));var config=require('../../config/environment');var attributes=require(_0x9779('0x6'));module[_0x9779('0x7')]=function(_0xf0a292,_0x2274b6){return _0xf0a292[_0x9779('0x8')](_0x9779('0x9'),attributes,{'tableName':'int_salesforce_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa4f3=['SalesforceConfiguration','lodash','util','api','moment','request-promise','path','../../config/environment','./intSalesforceConfiguration.attributes','exports','define'];(function(_0x31a4e1,_0xa554c4){var _0x4db045=function(_0x4043af){while(--_0x4043af){_0x31a4e1['push'](_0x31a4e1['shift']());}};_0x4db045(++_0xa554c4);}(_0xa4f3,0x64));var _0x3a4f=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xa4f3[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x3a4f('0x0'));var util=require(_0x3a4f('0x1'));var logger=require('../../config/logger')(_0x3a4f('0x2'));var moment=require(_0x3a4f('0x3'));var BPromise=require('bluebird');var rp=require(_0x3a4f('0x4'));var fs=require('fs');var path=require(_0x3a4f('0x5'));var rimraf=require('rimraf');var config=require(_0x3a4f('0x6'));var attributes=require(_0x3a4f('0x7'));module[_0x3a4f('0x8')]=function(_0x28bff3,_0x1e00d7){return _0x28bff3[_0x3a4f('0x9')](_0x3a4f('0xa'),attributes,{'tableName':'int_salesforce_configurations','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 f0f82c7..05d69d5 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 _0x52d9=['moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','catch'];(function(_0x3e8c4c,_0x271745){var _0x3ad976=function(_0x21b8e2){while(--_0x21b8e2){_0x3e8c4c['push'](_0x3e8c4c['shift']());}};_0x3ad976(++_0x271745);}(_0x52d9,0x17a));var _0x952d=function(_0x2649e2,_0x3e73be){_0x2649e2=_0x2649e2-0x0;var _0x4797d4=_0x52d9[_0x2649e2];return _0x4797d4;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x952d('0x0'));var BPromise=require(_0x952d('0x1'));var rs=require(_0x952d('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x952d('0x3'));var logger=require(_0x952d('0x4'))(_0x952d('0x5'));var config=require(_0x952d('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x952d('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x40b745,_0x3773f9,_0x70a6c5){return new BPromise(function(_0x227d6a,_0x2c3ad0){return client[_0x952d('0x8')](_0x40b745,_0x70a6c5)['then'](function(_0x4019f8){logger[_0x952d('0x9')](_0x952d('0xa'),_0x3773f9,_0x952d('0xb'));logger[_0x952d('0xc')](_0x952d('0xd'),_0x3773f9,'request\x20sent',JSON[_0x952d('0xe')](_0x4019f8));if(_0x4019f8[_0x952d('0xf')]){if(_0x4019f8[_0x952d('0xf')]['code']===0x1f4){logger[_0x952d('0xf')]('SalesforceConfiguration,\x20%s,\x20%s',_0x3773f9,_0x4019f8['error'][_0x952d('0x10')]);return _0x2c3ad0(_0x4019f8[_0x952d('0xf')][_0x952d('0x10')]);}logger[_0x952d('0xf')](_0x952d('0xa'),_0x3773f9,_0x4019f8[_0x952d('0xf')]['message']);return _0x227d6a(_0x4019f8[_0x952d('0xf')][_0x952d('0x10')]);}else{logger[_0x952d('0x9')]('SalesforceConfiguration,\x20%s,\x20%s',_0x3773f9,_0x952d('0xb'));_0x227d6a(_0x4019f8['result']['message']);}})[_0x952d('0x11')](function(_0x380767){logger[_0x952d('0xf')](_0x952d('0xa'),_0x3773f9,_0x380767);_0x2c3ad0(_0x380767);});});} \ No newline at end of file +var _0xf159=['lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','request\x20sent','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','SalesforceConfiguration,\x20%s,\x20%s','message','result','catch'];(function(_0x31d17c,_0x371945){var _0x9a774b=function(_0x54a2a4){while(--_0x54a2a4){_0x31d17c['push'](_0x31d17c['shift']());}};_0x9a774b(++_0x371945);}(_0xf159,0x17c));var _0x9f15=function(_0x3c807e,_0xa3d0dd){_0x3c807e=_0x3c807e-0x0;var _0x366407=_0xf159[_0x3c807e];return _0x366407;};'use strict';var _=require(_0x9f15('0x0'));var util=require(_0x9f15('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x9f15('0x2'));var fs=require('fs');var Redis=require(_0x9f15('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x9f15('0x4'));var logger=require(_0x9f15('0x5'))('rpc');var config=require(_0x9f15('0x6'));var jayson=require(_0x9f15('0x7'));var client=jayson['client'][_0x9f15('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1f9a80,_0x3fedca,_0x1827ac){return new BPromise(function(_0x46bed3,_0x121956){return client[_0x9f15('0x9')](_0x1f9a80,_0x1827ac)['then'](function(_0x144d05){logger[_0x9f15('0xa')]('SalesforceConfiguration,\x20%s,\x20%s',_0x3fedca,_0x9f15('0xb'));logger['debug'](_0x9f15('0xc'),_0x3fedca,_0x9f15('0xb'),JSON[_0x9f15('0xd')](_0x144d05));if(_0x144d05[_0x9f15('0xe')]){if(_0x144d05[_0x9f15('0xe')][_0x9f15('0xf')]===0x1f4){logger[_0x9f15('0xe')](_0x9f15('0x10'),_0x3fedca,_0x144d05[_0x9f15('0xe')][_0x9f15('0x11')]);return _0x121956(_0x144d05[_0x9f15('0xe')][_0x9f15('0x11')]);}logger[_0x9f15('0xe')](_0x9f15('0x10'),_0x3fedca,_0x144d05[_0x9f15('0xe')]['message']);return _0x46bed3(_0x144d05['error'][_0x9f15('0x11')]);}else{logger[_0x9f15('0xa')](_0x9f15('0x10'),_0x3fedca,'request\x20sent');_0x46bed3(_0x144d05[_0x9f15('0x12')][_0x9f15('0x11')]);}})[_0x9f15('0x13')](function(_0x2140fc){logger[_0x9f15('0xe')](_0x9f15('0x10'),_0x3fedca,_0x2140fc);_0x121956(_0x2140fc);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 60be0fa..f765a2b 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 _0xcd59=['get','isAuthenticated','index','/:id','show','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intSalesforceField.controller'];(function(_0x1faf34,_0x5a96e7){var _0x294624=function(_0x9679ec){while(--_0x9679ec){_0x1faf34['push'](_0x1faf34['shift']());}};_0x294624(++_0x5a96e7);}(_0xcd59,0x14b));var _0x9cd5=function(_0x4c74f4,_0x2f93c4){_0x4c74f4=_0x4c74f4-0x0;var _0x5aaee1=_0xcd59[_0x4c74f4];return _0x5aaee1;};'use strict';var multer=require(_0x9cd5('0x0'));var util=require(_0x9cd5('0x1'));var path=require(_0x9cd5('0x2'));var timeout=require(_0x9cd5('0x3'));var express=require(_0x9cd5('0x4'));var router=express[_0x9cd5('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x9cd5('0x6'));var config=require(_0x9cd5('0x7'));var controller=require(_0x9cd5('0x8'));router[_0x9cd5('0x9')]('/',auth[_0x9cd5('0xa')](),controller[_0x9cd5('0xb')]);router[_0x9cd5('0x9')](_0x9cd5('0xc'),auth[_0x9cd5('0xa')](),controller[_0x9cd5('0xd')]);router['post']('/',auth[_0x9cd5('0xa')](),controller[_0x9cd5('0xe')]);router[_0x9cd5('0xf')](_0x9cd5('0xc'),auth[_0x9cd5('0xa')](),controller[_0x9cd5('0x10')]);router[_0x9cd5('0x11')](_0x9cd5('0xc'),auth['isAuthenticated'](),controller[_0x9cd5('0x12')]);module[_0x9cd5('0x13')]=router; \ No newline at end of file +var _0xf69d=['get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xf69d,0xd3));var _0xdf69=function(_0x530cda,_0x462f34){_0x530cda=_0x530cda-0x0;var _0xb2bc28=_0xf69d[_0x530cda];return _0xb2bc28;};'use strict';var multer=require(_0xdf69('0x0'));var util=require(_0xdf69('0x1'));var path=require(_0xdf69('0x2'));var timeout=require(_0xdf69('0x3'));var express=require(_0xdf69('0x4'));var router=express['Router']();var auth=require(_0xdf69('0x5'));var interaction=require(_0xdf69('0x6'));var config=require(_0xdf69('0x7'));var controller=require(_0xdf69('0x8'));router[_0xdf69('0x9')]('/',auth[_0xdf69('0xa')](),controller[_0xdf69('0xb')]);router[_0xdf69('0x9')](_0xdf69('0xc'),auth[_0xdf69('0xa')](),controller[_0xdf69('0xd')]);router[_0xdf69('0xe')]('/',auth[_0xdf69('0xa')](),controller[_0xdf69('0xf')]);router[_0xdf69('0x10')](_0xdf69('0xc'),auth[_0xdf69('0xa')](),controller['update']);router[_0xdf69('0x11')](_0xdf69('0xc'),auth[_0xdf69('0xa')](),controller[_0xdf69('0x12')]);module[_0xdf69('0x13')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 1f6c384..f6d5b97 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 _0xf090=['customVariable','sequelize','exports','ENUM','string','variable','keyValue','STRING'];(function(_0x302e77,_0x10b50a){var _0x5283f3=function(_0x34ecc3){while(--_0x34ecc3){_0x302e77['push'](_0x302e77['shift']());}};_0x5283f3(++_0x10b50a);}(_0xf090,0xf9));var _0x0f09=function(_0x5c5135,_0x3af41e){_0x5c5135=_0x5c5135-0x0;var _0x2f50d7=_0xf090[_0x5c5135];return _0x2f50d7;};'use strict';var Sequelize=require(_0x0f09('0x0'));module[_0x0f09('0x1')]={'type':{'type':Sequelize[_0x0f09('0x2')](_0x0f09('0x3'),_0x0f09('0x4'),'customVariable',_0x0f09('0x5')),'defaultValue':_0x0f09('0x3')},'content':{'type':Sequelize[_0x0f09('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x0f09('0x2')](_0x0f09('0x3'),_0x0f09('0x4'),_0x0f09('0x7'))},'keyContent':{'type':Sequelize[_0x0f09('0x6')]},'idField':{'type':Sequelize[_0x0f09('0x6')]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x12e8=['string','keyValue','STRING','ENUM','variable','customVariable','sequelize'];(function(_0x477252,_0x46f2dd){var _0x52a600=function(_0x3fe47a){while(--_0x3fe47a){_0x477252['push'](_0x477252['shift']());}};_0x52a600(++_0x46f2dd);}(_0x12e8,0x179));var _0x812e=function(_0x2ec60b,_0x143127){_0x2ec60b=_0x2ec60b-0x0;var _0xd0e2be=_0x12e8[_0x2ec60b];return _0xd0e2be;};'use strict';var Sequelize=require(_0x812e('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0x812e('0x1'),'variable','customVariable',_0x812e('0x2')),'defaultValue':_0x812e('0x1')},'content':{'type':Sequelize[_0x812e('0x3')]},'key':{'type':Sequelize[_0x812e('0x3')]},'keyType':{'type':Sequelize[_0x812e('0x4')](_0x812e('0x1'),_0x812e('0x5'),_0x812e('0x6'))},'keyContent':{'type':Sequelize[_0x812e('0x3')]},'idField':{'type':Sequelize[_0x812e('0x3')]},'variableName':{'type':Sequelize[_0x812e('0x3')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 29bd310..76473ab 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 _0x12bd=['index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','SalesforceField','includeAll','findAll','rows','catch','show','params','length','find','create','body','update','html-pdf','eml-format','zip-dir','request-promise','mustache','path','sox','to-csv','ejs','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/environment','../../mysqldb','status','end','count','offset','limit','set','json','apply','reject','then','destroy','sendStatus','error','stack','name'];(function(_0x378720,_0xa711f1){var _0x47920a=function(_0xc5056){while(--_0xc5056){_0x378720['push'](_0x378720['shift']());}};_0x47920a(++_0xa711f1);}(_0x12bd,0x1f0));var _0xd12b=function(_0x3363ae,_0x5c3f3f){_0x3363ae=_0x3363ae-0x0;var _0x2bc795=_0x12bd[_0x3363ae];return _0x2bc795;};'use strict';var pdf=require(_0xd12b('0x0'));var emlformat=require(_0xd12b('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xd12b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd12b('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xd12b('0x4'));var util=require('util');var path=require(_0xd12b('0x5'));var sox=require(_0xd12b('0x6'));var csv=require(_0xd12b('0x7'));var ejs=require(_0xd12b('0x8'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd12b('0x9'));var deskjs=require(_0xd12b('0xa'));var toCsv=require(_0xd12b('0x7'));var querystring=require('querystring');var Papa=require(_0xd12b('0xb'));var Redis=require(_0xd12b('0xc'));var authService=require('../../components/auth/service');var qs=require(_0xd12b('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd12b('0xe'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xd12b('0xf'));var db=require(_0xd12b('0x10'))['db'];function respondWithStatusCode(_0x14bb80,_0x138f88){_0x138f88=_0x138f88||0xcc;return function(_0x31a5c1){if(_0x31a5c1){return _0x14bb80['sendStatus'](_0x138f88);}return _0x14bb80[_0xd12b('0x11')](_0x138f88)[_0xd12b('0x12')]();};}function respondWithResult(_0x213902,_0x3bbe44){_0x3bbe44=_0x3bbe44||0xc8;return function(_0x56f639){if(_0x56f639){return _0x213902[_0xd12b('0x11')](_0x3bbe44)['json'](_0x56f639);}};}function respondWithFilteredResult(_0xacb27c,_0x2c7810){return function(_0x101dcb){if(_0x101dcb){var _0x426a61=_0x101dcb[_0xd12b('0x13')],_0x1d34e6=_0x2c7810[_0xd12b('0x14')],_0x2146d1=_0x2c7810['offset']+_0x2c7810[_0xd12b('0x15')],_0x23c818;if(_0x2146d1>=_0x426a61){_0x2146d1=_0x426a61;_0x23c818=0xc8;}else{_0x23c818=0xce;}_0xacb27c[_0xd12b('0x11')](_0x23c818);return _0xacb27c[_0xd12b('0x16')]('Content-Range',_0x1d34e6+'-'+_0x2146d1+'/'+_0x426a61)[_0xd12b('0x17')](_0x101dcb);}return null;};}function patchUpdates(_0x56cf84){return function(_0x4e4d3a){try{jsonpatch[_0xd12b('0x18')](_0x4e4d3a,_0x56cf84,!![]);}catch(_0x34c17c){return BPromise[_0xd12b('0x19')](_0x34c17c);}return _0x4e4d3a['save']();};}function saveUpdates(_0x5b9786,_0x3bb3c5){return function(_0x226562){if(_0x226562){return _0x226562['update'](_0x5b9786)[_0xd12b('0x1a')](function(_0x83f19d){return _0x83f19d;});}return null;};}function removeEntity(_0x5e5627,_0x34d1d5){return function(_0x56b3db){if(_0x56b3db){return _0x56b3db[_0xd12b('0x1b')]()[_0xd12b('0x1a')](function(){_0x5e5627[_0xd12b('0x11')](0xcc)[_0xd12b('0x12')]();});}};}function handleEntityNotFound(_0x4928cb,_0x35e408){return function(_0x37c19f){if(!_0x37c19f){_0x4928cb[_0xd12b('0x1c')](0x194);}return _0x37c19f;};}function handleError(_0x28ccb5,_0x59666b){_0x59666b=_0x59666b||0x1f4;return function(_0x5f5de3){logger[_0xd12b('0x1d')](_0x5f5de3[_0xd12b('0x1e')]);if(_0x5f5de3[_0xd12b('0x1f')]){delete _0x5f5de3[_0xd12b('0x1f')];}_0x28ccb5['status'](_0x59666b)['send'](_0x5f5de3);};}exports[_0xd12b('0x20')]=function(_0x2edbb0,_0x5c3767){var _0x5936f2={},_0x195c54={},_0x35e7de={'count':0x0,'rows':[]};var _0x1bd4b6=_[_0xd12b('0x21')](db['SalesforceField'][_0xd12b('0x22')],function(_0x4a7c06){return{'name':_0x4a7c06[_0xd12b('0x23')],'type':_0x4a7c06[_0xd12b('0x24')][_0xd12b('0x25')]};});_0x195c54[_0xd12b('0x26')]=_[_0xd12b('0x21')](_0x1bd4b6,_0xd12b('0x1f'));_0x195c54[_0xd12b('0x27')]=_[_0xd12b('0x28')](_0x2edbb0['query']);_0x195c54[_0xd12b('0x29')]=_[_0xd12b('0x2a')](_0x195c54[_0xd12b('0x26')],_0x195c54[_0xd12b('0x27')]);_0x5936f2[_0xd12b('0x2b')]=_['intersection'](_0x195c54[_0xd12b('0x26')],qs['fields'](_0x2edbb0[_0xd12b('0x27')][_0xd12b('0x2c')]));_0x5936f2[_0xd12b('0x2b')]=_0x5936f2[_0xd12b('0x2b')]['length']?_0x5936f2[_0xd12b('0x2b')]:_0x195c54[_0xd12b('0x26')];if(!_0x2edbb0[_0xd12b('0x27')][_0xd12b('0x2d')](_0xd12b('0x2e'))){_0x5936f2[_0xd12b('0x15')]=qs[_0xd12b('0x15')](_0x2edbb0[_0xd12b('0x27')][_0xd12b('0x15')]);_0x5936f2[_0xd12b('0x14')]=qs[_0xd12b('0x14')](_0x2edbb0[_0xd12b('0x27')][_0xd12b('0x14')]);}_0x5936f2['order']=qs[_0xd12b('0x2f')](_0x2edbb0[_0xd12b('0x27')][_0xd12b('0x2f')]);_0x5936f2[_0xd12b('0x30')]=qs[_0xd12b('0x29')](_[_0xd12b('0x31')](_0x2edbb0[_0xd12b('0x27')],_0x195c54[_0xd12b('0x29')]),_0x1bd4b6);if(_0x2edbb0[_0xd12b('0x27')][_0xd12b('0x32')]){_0x5936f2[_0xd12b('0x30')]=_[_0xd12b('0x33')](_0x5936f2[_0xd12b('0x30')],{'$or':_[_0xd12b('0x21')](_0x1bd4b6,function(_0x177a9b){if(_0x177a9b[_0xd12b('0x24')]!==_0xd12b('0x34')){var _0x341488={};_0x341488[_0x177a9b[_0xd12b('0x1f')]]={'$like':'%'+_0x2edbb0[_0xd12b('0x27')][_0xd12b('0x32')]+'%'};return _0x341488;}})});}_0x5936f2=_['merge']({},_0x5936f2,_0x2edbb0[_0xd12b('0x35')]);var _0x5e18c7={'where':_0x5936f2[_0xd12b('0x30')]};return db[_0xd12b('0x36')][_0xd12b('0x13')](_0x5e18c7)[_0xd12b('0x1a')](function(_0x2bedf9){_0x35e7de[_0xd12b('0x13')]=_0x2bedf9;if(_0x2edbb0[_0xd12b('0x27')][_0xd12b('0x37')]){_0x5936f2['include']=[{'all':!![]}];}return db[_0xd12b('0x36')][_0xd12b('0x38')](_0x5936f2);})[_0xd12b('0x1a')](function(_0x4ec587){_0x35e7de[_0xd12b('0x39')]=_0x4ec587;return _0x35e7de;})[_0xd12b('0x1a')](respondWithFilteredResult(_0x5c3767,_0x5936f2))[_0xd12b('0x3a')](handleError(_0x5c3767,null));};exports[_0xd12b('0x3b')]=function(_0x1b02b6,_0x5256cc){var _0xf774b2={'raw':!![],'where':{'id':_0x1b02b6[_0xd12b('0x3c')]['id']}},_0x2a84d9={};_0x2a84d9[_0xd12b('0x26')]=_[_0xd12b('0x28')](db[_0xd12b('0x36')]['rawAttributes']);_0x2a84d9['query']=_[_0xd12b('0x28')](_0x1b02b6[_0xd12b('0x27')]);_0x2a84d9[_0xd12b('0x29')]=_[_0xd12b('0x2a')](_0x2a84d9['model'],_0x2a84d9[_0xd12b('0x27')]);_0xf774b2[_0xd12b('0x2b')]=_['intersection'](_0x2a84d9['model'],qs['fields'](_0x1b02b6['query'][_0xd12b('0x2c')]));_0xf774b2[_0xd12b('0x2b')]=_0xf774b2[_0xd12b('0x2b')][_0xd12b('0x3d')]?_0xf774b2[_0xd12b('0x2b')]:_0x2a84d9[_0xd12b('0x26')];if(_0x1b02b6[_0xd12b('0x27')][_0xd12b('0x37')]){_0xf774b2['include']=[{'all':!![]}];}_0xf774b2=_[_0xd12b('0x33')]({},_0xf774b2,_0x1b02b6[_0xd12b('0x35')]);return db[_0xd12b('0x36')][_0xd12b('0x3e')](_0xf774b2)[_0xd12b('0x1a')](handleEntityNotFound(_0x5256cc,null))['then'](respondWithResult(_0x5256cc,null))['catch'](handleError(_0x5256cc,null));};exports['create']=function(_0x3f75bb,_0x23ed06){return db[_0xd12b('0x36')][_0xd12b('0x3f')](_0x3f75bb[_0xd12b('0x40')],{})[_0xd12b('0x1a')](respondWithResult(_0x23ed06,0xc9))['catch'](handleError(_0x23ed06,null));};exports[_0xd12b('0x41')]=function(_0x2d1e30,_0x46d1aa){if(_0x2d1e30[_0xd12b('0x40')]['id']){delete _0x2d1e30[_0xd12b('0x40')]['id'];}return db[_0xd12b('0x36')][_0xd12b('0x3e')]({'where':{'id':_0x2d1e30['params']['id']}})[_0xd12b('0x1a')](handleEntityNotFound(_0x46d1aa,null))[_0xd12b('0x1a')](saveUpdates(_0x2d1e30['body'],null))[_0xd12b('0x1a')](respondWithResult(_0x46d1aa,null))[_0xd12b('0x3a')](handleError(_0x46d1aa,null));};exports[_0xd12b('0x1b')]=function(_0x21b021,_0x559f32){return db[_0xd12b('0x36')][_0xd12b('0x3e')]({'where':{'id':_0x21b021['params']['id']}})[_0xd12b('0x1a')](handleEntityNotFound(_0x559f32,null))[_0xd12b('0x1a')](removeEntity(_0x559f32,null))['catch'](handleError(_0x559f32,null));}; \ No newline at end of file +var _0x6502=['../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','update','then','destroy','error','name','send','index','map','SalesforceField','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','merge','VIRTUAL','filter','options','where','includeAll','include','findAll','rows','catch','keys','find','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','squel','crypto','jsforce','desk.js','ioredis'];(function(_0x54be7c,_0x149e75){var _0x46d170=function(_0x49098e){while(--_0x49098e){_0x54be7c['push'](_0x54be7c['shift']());}};_0x46d170(++_0x149e75);}(_0x6502,0x1ae));var _0x2650=function(_0x1f7a83,_0x409f6a){_0x1f7a83=_0x1f7a83-0x0;var _0x29e1be=_0x6502[_0x1f7a83];return _0x29e1be;};'use strict';var pdf=require(_0x2650('0x0'));var emlformat=require(_0x2650('0x1'));var rimraf=require(_0x2650('0x2'));var zipdir=require(_0x2650('0x3'));var jsonpatch=require(_0x2650('0x4'));var rp=require(_0x2650('0x5'));var moment=require(_0x2650('0x6'));var BPromise=require(_0x2650('0x7'));var Mustache=require(_0x2650('0x8'));var util=require(_0x2650('0x9'));var path=require(_0x2650('0xa'));var sox=require(_0x2650('0xb'));var csv=require(_0x2650('0xc'));var ejs=require(_0x2650('0xd'));var fs=require('fs');var _=require(_0x2650('0xe'));var squel=require(_0x2650('0xf'));var crypto=require(_0x2650('0x10'));var jsforce=require(_0x2650('0x11'));var deskjs=require(_0x2650('0x12'));var toCsv=require(_0x2650('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x2650('0x13'));var authService=require(_0x2650('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x2650('0x15'));var hardwareService=require(_0x2650('0x16'));var logger=require(_0x2650('0x17'))(_0x2650('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x2650('0x19'))['db'];function respondWithStatusCode(_0xcb8861,_0x3ce010){_0x3ce010=_0x3ce010||0xcc;return function(_0x29ed92){if(_0x29ed92){return _0xcb8861['sendStatus'](_0x3ce010);}return _0xcb8861[_0x2650('0x1a')](_0x3ce010)[_0x2650('0x1b')]();};}function respondWithResult(_0x10c092,_0xb8184b){_0xb8184b=_0xb8184b||0xc8;return function(_0x4d4400){if(_0x4d4400){return _0x10c092['status'](_0xb8184b)[_0x2650('0x1c')](_0x4d4400);}};}function respondWithFilteredResult(_0xa63c6b,_0x5b9f44){return function(_0x57ecc4){if(_0x57ecc4){var _0x526c3d=_0x57ecc4[_0x2650('0x1d')],_0x44f3a6=_0x5b9f44[_0x2650('0x1e')],_0x43de72=_0x5b9f44['offset']+_0x5b9f44[_0x2650('0x1f')],_0x3507ea;if(_0x43de72>=_0x526c3d){_0x43de72=_0x526c3d;_0x3507ea=0xc8;}else{_0x3507ea=0xce;}_0xa63c6b[_0x2650('0x1a')](_0x3507ea);return _0xa63c6b[_0x2650('0x20')](_0x2650('0x21'),_0x44f3a6+'-'+_0x43de72+'/'+_0x526c3d)[_0x2650('0x1c')](_0x57ecc4);}return null;};}function patchUpdates(_0xcbf89a){return function(_0x5f4d62){try{jsonpatch[_0x2650('0x22')](_0x5f4d62,_0xcbf89a,!![]);}catch(_0x24f601){return BPromise['reject'](_0x24f601);}return _0x5f4d62['save']();};}function saveUpdates(_0x15ae53,_0xdeb686){return function(_0x3ea8d5){if(_0x3ea8d5){return _0x3ea8d5[_0x2650('0x23')](_0x15ae53)[_0x2650('0x24')](function(_0x12875a){return _0x12875a;});}return null;};}function removeEntity(_0x231326,_0x43d100){return function(_0x869223){if(_0x869223){return _0x869223[_0x2650('0x25')]()['then'](function(){_0x231326[_0x2650('0x1a')](0xcc)[_0x2650('0x1b')]();});}};}function handleEntityNotFound(_0x42efcb,_0x22efe5){return function(_0x49ca98){if(!_0x49ca98){_0x42efcb['sendStatus'](0x194);}return _0x49ca98;};}function handleError(_0x46520b,_0x2be485){_0x2be485=_0x2be485||0x1f4;return function(_0x5e5ab6){logger[_0x2650('0x26')](_0x5e5ab6['stack']);if(_0x5e5ab6['name']){delete _0x5e5ab6[_0x2650('0x27')];}_0x46520b['status'](_0x2be485)[_0x2650('0x28')](_0x5e5ab6);};}exports[_0x2650('0x29')]=function(_0x11278b,_0x23ff0a){var _0x360c05={},_0x5f4367={},_0x5cfc47={'count':0x0,'rows':[]};var _0x23654c=_[_0x2650('0x2a')](db[_0x2650('0x2b')][_0x2650('0x2c')],function(_0x31c289){return{'name':_0x31c289[_0x2650('0x2d')],'type':_0x31c289[_0x2650('0x2e')][_0x2650('0x2f')]};});_0x5f4367[_0x2650('0x30')]=_[_0x2650('0x2a')](_0x23654c,'name');_0x5f4367['query']=_['keys'](_0x11278b[_0x2650('0x31')]);_0x5f4367[_0x2650('0x32')]=_[_0x2650('0x33')](_0x5f4367[_0x2650('0x30')],_0x5f4367[_0x2650('0x31')]);_0x360c05[_0x2650('0x34')]=_['intersection'](_0x5f4367[_0x2650('0x30')],qs[_0x2650('0x35')](_0x11278b[_0x2650('0x31')][_0x2650('0x35')]));_0x360c05[_0x2650('0x34')]=_0x360c05[_0x2650('0x34')][_0x2650('0x36')]?_0x360c05[_0x2650('0x34')]:_0x5f4367[_0x2650('0x30')];if(!_0x11278b[_0x2650('0x31')][_0x2650('0x37')](_0x2650('0x38'))){_0x360c05[_0x2650('0x1f')]=qs[_0x2650('0x1f')](_0x11278b[_0x2650('0x31')][_0x2650('0x1f')]);_0x360c05[_0x2650('0x1e')]=qs['offset'](_0x11278b[_0x2650('0x31')][_0x2650('0x1e')]);}_0x360c05[_0x2650('0x39')]=qs[_0x2650('0x3a')](_0x11278b[_0x2650('0x31')]['sort']);_0x360c05['where']=qs[_0x2650('0x32')](_[_0x2650('0x3b')](_0x11278b[_0x2650('0x31')],_0x5f4367['filters']),_0x23654c);if(_0x11278b[_0x2650('0x31')]['filter']){_0x360c05['where']=_[_0x2650('0x3c')](_0x360c05['where'],{'$or':_['map'](_0x23654c,function(_0x1fef48){if(_0x1fef48[_0x2650('0x2e')]!==_0x2650('0x3d')){var _0x50cee8={};_0x50cee8[_0x1fef48[_0x2650('0x27')]]={'$like':'%'+_0x11278b[_0x2650('0x31')][_0x2650('0x3e')]+'%'};return _0x50cee8;}})});}_0x360c05=_[_0x2650('0x3c')]({},_0x360c05,_0x11278b[_0x2650('0x3f')]);var _0x931788={'where':_0x360c05[_0x2650('0x40')]};return db[_0x2650('0x2b')][_0x2650('0x1d')](_0x931788)[_0x2650('0x24')](function(_0x1a051e){_0x5cfc47[_0x2650('0x1d')]=_0x1a051e;if(_0x11278b[_0x2650('0x31')][_0x2650('0x41')]){_0x360c05[_0x2650('0x42')]=[{'all':!![]}];}return db['SalesforceField'][_0x2650('0x43')](_0x360c05);})['then'](function(_0x933cf9){_0x5cfc47[_0x2650('0x44')]=_0x933cf9;return _0x5cfc47;})['then'](respondWithFilteredResult(_0x23ff0a,_0x360c05))[_0x2650('0x45')](handleError(_0x23ff0a,null));};exports['show']=function(_0x1de04a,_0x5f5c88){var _0x109622={'raw':!![],'where':{'id':_0x1de04a['params']['id']}},_0x322bd5={};_0x322bd5[_0x2650('0x30')]=_[_0x2650('0x46')](db['SalesforceField'][_0x2650('0x2c')]);_0x322bd5['query']=_[_0x2650('0x46')](_0x1de04a[_0x2650('0x31')]);_0x322bd5[_0x2650('0x32')]=_[_0x2650('0x33')](_0x322bd5[_0x2650('0x30')],_0x322bd5['query']);_0x109622[_0x2650('0x34')]=_[_0x2650('0x33')](_0x322bd5[_0x2650('0x30')],qs[_0x2650('0x35')](_0x1de04a[_0x2650('0x31')][_0x2650('0x35')]));_0x109622['attributes']=_0x109622[_0x2650('0x34')][_0x2650('0x36')]?_0x109622[_0x2650('0x34')]:_0x322bd5['model'];if(_0x1de04a['query']['includeAll']){_0x109622[_0x2650('0x42')]=[{'all':!![]}];}_0x109622=_[_0x2650('0x3c')]({},_0x109622,_0x1de04a[_0x2650('0x3f')]);return db[_0x2650('0x2b')][_0x2650('0x47')](_0x109622)[_0x2650('0x24')](handleEntityNotFound(_0x5f5c88,null))[_0x2650('0x24')](respondWithResult(_0x5f5c88,null))['catch'](handleError(_0x5f5c88,null));};exports[_0x2650('0x48')]=function(_0x4e6e2f,_0x112aa3){return db[_0x2650('0x2b')][_0x2650('0x48')](_0x4e6e2f[_0x2650('0x49')],{})[_0x2650('0x24')](respondWithResult(_0x112aa3,0xc9))[_0x2650('0x45')](handleError(_0x112aa3,null));};exports[_0x2650('0x23')]=function(_0x10e299,_0x11b19c){if(_0x10e299[_0x2650('0x49')]['id']){delete _0x10e299[_0x2650('0x49')]['id'];}return db[_0x2650('0x2b')][_0x2650('0x47')]({'where':{'id':_0x10e299[_0x2650('0x4a')]['id']}})[_0x2650('0x24')](handleEntityNotFound(_0x11b19c,null))[_0x2650('0x24')](saveUpdates(_0x10e299[_0x2650('0x49')],null))['then'](respondWithResult(_0x11b19c,null))[_0x2650('0x45')](handleError(_0x11b19c,null));};exports[_0x2650('0x25')]=function(_0x1407d3,_0x252ee3){return db[_0x2650('0x2b')][_0x2650('0x47')]({'where':{'id':_0x1407d3[_0x2650('0x4a')]['id']}})[_0x2650('0x24')](handleEntityNotFound(_0x252ee3,null))[_0x2650('0x24')](removeEntity(_0x252ee3,null))[_0x2650('0x45')](handleError(_0x252ee3,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index b36de4a..0f441eb 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 _0xfd9e=['../../config/environment','./intSalesforceField.attributes','exports','define','SalesforceField','int_salesforce_fields','salesforce_unique_index','idField','FieldId','lodash','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x64a811,_0x4887b7){var _0x3d8099=function(_0x3cb2b0){while(--_0x3cb2b0){_0x64a811['push'](_0x64a811['shift']());}};_0x3d8099(++_0x4887b7);}(_0xfd9e,0x15d));var _0xefd9=function(_0x704d9d,_0x5de4e4){_0x704d9d=_0x704d9d-0x0;var _0x16f99f=_0xfd9e[_0x704d9d];return _0x16f99f;};'use strict';var _=require(_0xefd9('0x0'));var util=require(_0xefd9('0x1'));var logger=require('../../config/logger')(_0xefd9('0x2'));var moment=require(_0xefd9('0x3'));var BPromise=require(_0xefd9('0x4'));var rp=require(_0xefd9('0x5'));var fs=require('fs');var path=require(_0xefd9('0x6'));var rimraf=require(_0xefd9('0x7'));var config=require(_0xefd9('0x8'));var attributes=require(_0xefd9('0x9'));module[_0xefd9('0xa')]=function(_0x4470b8,_0x5e1557){return _0x4470b8[_0xefd9('0xb')](_0xefd9('0xc'),attributes,{'tableName':_0xefd9('0xd'),'paranoid':![],'indexes':[{'name':_0xefd9('0xe'),'fields':[_0xefd9('0xf'),_0xefd9('0x10')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x854a=['lodash','util','api','moment','./intSalesforceField.attributes','exports','define','idField'];(function(_0x469a2d,_0x53bcbe){var _0x148147=function(_0xe46eea){while(--_0xe46eea){_0x469a2d['push'](_0x469a2d['shift']());}};_0x148147(++_0x53bcbe);}(_0x854a,0x1e8));var _0xa854=function(_0x172686,_0x1e2a50){_0x172686=_0x172686-0x0;var _0x605829=_0x854a[_0x172686];return _0x605829;};'use strict';var _=require(_0xa854('0x0'));var util=require(_0xa854('0x1'));var logger=require('../../config/logger')(_0xa854('0x2'));var moment=require(_0xa854('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa854('0x4'));module[_0xa854('0x5')]=function(_0x10050d,_0x3456f2){return _0x10050d[_0xa854('0x6')]('SalesforceField',attributes,{'tableName':'int_salesforce_fields','paranoid':![],'indexes':[{'name':'salesforce_unique_index','fields':[_0xa854('0x7'),'FieldId'],'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 d82a0a8..7d2a15e 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(_0x189490,_0x578e67){var _0x190302=function(_0x48654a){while(--_0x48654a){_0x189490['push'](_0x189490['shift']());}};_0x190302(++_0x578e67);}(_0x750a,0x140));var _0xa750=function(_0xdb2328,_0x5f0285){_0xdb2328=_0xdb2328-0x0;var _0x9d56ee=_0x750a[_0xdb2328];return _0x9d56ee;};'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 _0x9ffd=['SalesforceField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','SalesforceField,\x20%s,\x20%s','info','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','debug'];(function(_0x25fc4f,_0x1fd85b){var _0x110dd0=function(_0x1e30d0){while(--_0x1e30d0){_0x25fc4f['push'](_0x25fc4f['shift']());}};_0x110dd0(++_0x1fd85b);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x5e92b3,_0x3c8a41){_0x5e92b3=_0x5e92b3-0x0;var _0xbb66f2=_0x9ffd[_0x5e92b3];return _0xbb66f2;};'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']('SalesforceField,\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')]('SalesforceField,\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')]('SalesforceField,\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 diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 7b0f30b..b5d00d4 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 _0x3edb=['../../components/auth/service','../../config/environment','get','index','/:id','show','/:id/configurations','isAuthenticated','getConfigurations','create','post','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router'];(function(_0x5eca6f,_0x76ec15){var _0x4c34b7=function(_0x52cbe1){while(--_0x52cbe1){_0x5eca6f['push'](_0x5eca6f['shift']());}};_0x4c34b7(++_0x76ec15);}(_0x3edb,0x1c9));var _0xb3ed=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0x3edb[_0x49ca18];return _0x145d54;};'use strict';var multer=require(_0xb3ed('0x0'));var util=require(_0xb3ed('0x1'));var path=require('path');var timeout=require(_0xb3ed('0x2'));var express=require(_0xb3ed('0x3'));var router=express[_0xb3ed('0x4')]();var auth=require(_0xb3ed('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xb3ed('0x6'));var controller=require('./intServicenowAccount.controller');router[_0xb3ed('0x7')]('/',auth['isAuthenticated'](),controller[_0xb3ed('0x8')]);router[_0xb3ed('0x7')](_0xb3ed('0x9'),auth['isAuthenticated'](),controller[_0xb3ed('0xa')]);router[_0xb3ed('0x7')](_0xb3ed('0xb'),auth[_0xb3ed('0xc')](),controller[_0xb3ed('0xd')]);router[_0xb3ed('0x7')]('/:id/fields',auth[_0xb3ed('0xc')](),controller['getFields']);router['post']('/',auth[_0xb3ed('0xc')](),controller[_0xb3ed('0xe')]);router[_0xb3ed('0xf')](_0xb3ed('0xb'),auth[_0xb3ed('0xc')](),controller['addConfiguration']);router[_0xb3ed('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xb3ed('0x11')]);router[_0xb3ed('0x12')]('/:id',auth[_0xb3ed('0xc')](),controller[_0xb3ed('0x13')]);module[_0xb3ed('0x14')]=router; \ No newline at end of file +var _0x68f5=['addConfiguration','put','/:id','update','delete','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields','post','create'];(function(_0x27e044,_0x14d79a){var _0xec6967=function(_0x33fa6e){while(--_0x33fa6e){_0x27e044['push'](_0x27e044['shift']());}};_0xec6967(++_0x14d79a);}(_0x68f5,0x11a));var _0x568f=function(_0x49883a,_0x45184c){_0x49883a=_0x49883a-0x0;var _0x5aca4c=_0x68f5[_0x49883a];return _0x5aca4c;};'use strict';var multer=require(_0x568f('0x0'));var util=require(_0x568f('0x1'));var path=require(_0x568f('0x2'));var timeout=require('connect-timeout');var express=require(_0x568f('0x3'));var router=express[_0x568f('0x4')]();var auth=require(_0x568f('0x5'));var interaction=require(_0x568f('0x6'));var config=require(_0x568f('0x7'));var controller=require('./intServicenowAccount.controller');router[_0x568f('0x8')]('/',auth[_0x568f('0x9')](),controller[_0x568f('0xa')]);router[_0x568f('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x568f('0xb')]);router[_0x568f('0x8')](_0x568f('0xc'),auth['isAuthenticated'](),controller[_0x568f('0xd')]);router['get'](_0x568f('0xe'),auth[_0x568f('0x9')](),controller['getFields']);router[_0x568f('0xf')]('/',auth[_0x568f('0x9')](),controller[_0x568f('0x10')]);router[_0x568f('0xf')](_0x568f('0xc'),auth[_0x568f('0x9')](),controller[_0x568f('0x11')]);router[_0x568f('0x12')](_0x568f('0x13'),auth['isAuthenticated'](),controller[_0x568f('0x14')]);router[_0x568f('0x15')](_0x568f('0x13'),auth[_0x568f('0x9')](),controller['destroy']);module[_0x568f('0x16')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index 7444c26..7b4e86f 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 _0x9491=['sequelize','STRING','username','remoteUri'];(function(_0x21fe3,_0x1e76e8){var _0x26812b=function(_0x1c4600){while(--_0x1c4600){_0x21fe3['push'](_0x21fe3['shift']());}};_0x26812b(++_0x1e76e8);}(_0x9491,0x1e0));var _0x1949=function(_0x4f9b88,_0x39065a){_0x4f9b88=_0x4f9b88-0x0;var _0x2521aa=_0x9491[_0x4f9b88];return _0x2521aa;};'use strict';var Sequelize=require(_0x1949('0x0'));module['exports']={'name':{'type':Sequelize[_0x1949('0x1')]},'description':{'type':Sequelize[_0x1949('0x1')]},'username':{'type':Sequelize[_0x1949('0x1')],'unique':_0x1949('0x2')},'password':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x1949('0x1')],'unique':_0x1949('0x3')},'serverUrl':{'type':Sequelize[_0x1949('0x1')]}}; \ No newline at end of file +var _0x80fa=['STRING','username','remoteUri','sequelize'];(function(_0x134de4,_0x49c839){var _0xe97f36=function(_0x2ffa31){while(--_0x2ffa31){_0x134de4['push'](_0x134de4['shift']());}};_0xe97f36(++_0x49c839);}(_0x80fa,0x1a7));var _0xa80f=function(_0x4684bf,_0xc726d5){_0x4684bf=_0x4684bf-0x0;var _0x230b59=_0x80fa[_0x4684bf];return _0x230b59;};'use strict';var Sequelize=require(_0xa80f('0x0'));module['exports']={'name':{'type':Sequelize[_0xa80f('0x1')]},'description':{'type':Sequelize[_0xa80f('0x1')]},'username':{'type':Sequelize[_0xa80f('0x1')],'unique':_0xa80f('0x2')},'password':{'type':Sequelize[_0xa80f('0x1')]},'email':{'type':Sequelize[_0xa80f('0x1')]},'remoteUri':{'type':Sequelize[_0xa80f('0x1')],'unique':_0xa80f('0x3')},'serverUrl':{'type':Sequelize[_0xa80f('0x1')]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index 7a51dd6..7d5f6bc 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 _0x9dad=['catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','destroy','stack','name','send','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','ServicenowAccount','includeAll','findAll','rows','show','params','length','include','create','body','find','getConfigurations','findOne','ServicenowConfiguration','hasOwnProperty','addConfiguration','Subjects','channel','Descriptions','getDescriptions','ServicenowField','getFields','made_sla','hold_reason','knowledge','subcategory','close_code','notify','category','parent','caused_by','watch_list','upon_reject','sys_updated_on','number','resolved_by','sys_updated_by','sys_created_on','sys_domain','state','sys_created_by','calendar_stc','closed_at','delivery_plan','impact','active','work_notes_list','business_service','priority','sys_domain_path','rfc','time_worked','expected_start','group_list','reopened_time','approval_set','work_notes','short_description','correlation_display','delivery_task','work_start','assignment_group','business_stc','additional_assignee_list','description','sys_class_name','close_notes','closed_by','follow_up','parent_incident','sys_id','contact_type','incident_state','urgency','problem_id','company','reassignment_count','activity_due','assigned_to','comments','sla_due','comments_and_work_notes','due_date','reopen_count','sys_tags','escalation','upon_approval','correlation_id','location','password','remoteUri','serverUrl','substring','lastIndexOf','format','username','GET','incident?sysparm_display_value=all','log','assign','remove','includes','forEach','internalType','label','push','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','all','concat','ServiceNow\x20error:\x20','statusCode','Wrong\x20credentials','boolean','True','true','False','false','sys_choice?sysparm_query=name=incident^element=','inactive','value','html-pdf','eml-format','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x21ee11,_0x172225){var _0xb4c64e=function(_0x157c8f){while(--_0x157c8f){_0x21ee11['push'](_0x21ee11['shift']());}};_0xb4c64e(++_0x172225);}(_0x9dad,0x165));var _0xd9da=function(_0x195179,_0x39e64e){_0x195179=_0x195179-0x0;var _0x4b3720=_0x9dad[_0x195179];return _0x4b3720;};'use strict';var pdf=require(_0xd9da('0x0'));var emlformat=require(_0xd9da('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xd9da('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd9da('0x3'));var Mustache=require('mustache');var util=require(_0xd9da('0x4'));var path=require(_0xd9da('0x5'));var sox=require(_0xd9da('0x6'));var csv=require(_0xd9da('0x7'));var ejs=require(_0xd9da('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0xd9da('0x9'));var crypto=require(_0xd9da('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xd9da('0xb'));var toCsv=require(_0xd9da('0x7'));var querystring=require(_0xd9da('0xc'));var Papa=require(_0xd9da('0xd'));var Redis=require(_0xd9da('0xe'));var authService=require(_0xd9da('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xd9da('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd9da('0x11'))('api');var utils=require(_0xd9da('0x12'));var config=require(_0xd9da('0x13'));var db=require(_0xd9da('0x14'))['db'];var integrations=require(_0xd9da('0x15'));var jayson=require('jayson/promise');var client=jayson[_0xd9da('0x16')][_0xd9da('0x17')]({'port':0x232a});function checkPasswordPattern(_0x26781d,_0x3036a6,_0x45e961){if(_0x45e961){var _0x358eff=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x358eff[_0xd9da('0x18')](_0x3036a6)){return _0x26781d;}else{throw new db[(_0xd9da('0x19'))][(_0xd9da('0x1a'))](_0xd9da('0x1b'));}}else{return _0x26781d;}}function respondWithRpcPromise(_0x2d6065,_0x25eb16,_0x3d9651,_0x42bfb4){return new BPromise(function(_0x43a0c3,_0x415fe2){var _0x202556=_0x42bfb4||client;return _0x202556[_0xd9da('0x1c')](_0x2d6065,_0x3d9651)[_0xd9da('0x1d')](function(_0x3ee003){logger[_0xd9da('0x1e')](_0xd9da('0x1f'),_0x25eb16,_0xd9da('0x20'));logger['debug'](_0xd9da('0x21'),_0x25eb16,'request\x20sent',JSON[_0xd9da('0x22')](_0x3ee003));if(_0x3ee003[_0xd9da('0x23')]){if(_0x3ee003[_0xd9da('0x23')][_0xd9da('0x24')]===0x1f4){logger['error']('ServicenowAccount,\x20%s,\x20%s',_0x25eb16,_0x3ee003[_0xd9da('0x23')][_0xd9da('0x25')]);return _0x415fe2(_0x3ee003[_0xd9da('0x23')][_0xd9da('0x25')]);}logger[_0xd9da('0x23')](_0xd9da('0x1f'),_0x25eb16,_0x3ee003[_0xd9da('0x23')][_0xd9da('0x25')]);return _0x43a0c3(_0x3ee003['error'][_0xd9da('0x25')]);}else{logger[_0xd9da('0x1e')](_0xd9da('0x1f'),_0x25eb16,_0xd9da('0x20'));_0x43a0c3(_0x3ee003[_0xd9da('0x26')]['message']);}})[_0xd9da('0x27')](function(_0x34daea){logger[_0xd9da('0x23')](_0xd9da('0x1f'),_0x25eb16,_0x34daea);_0x415fe2(_0x34daea);});});}function respondWithStatusCode(_0x2059d3,_0x3d3d19){_0x3d3d19=_0x3d3d19||0xcc;return function(_0x1d5047){if(_0x1d5047){return _0x2059d3[_0xd9da('0x28')](_0x3d3d19);}return _0x2059d3[_0xd9da('0x29')](_0x3d3d19)[_0xd9da('0x2a')]();};}function respondWithResult(_0x34166b,_0x299461){_0x299461=_0x299461||0xc8;return function(_0x17952e){if(_0x17952e){return _0x34166b[_0xd9da('0x29')](_0x299461)[_0xd9da('0x2b')](_0x17952e);}};}function respondWithFilteredResult(_0x57e469,_0x5f37e5){return function(_0x3a9348){if(_0x3a9348){var _0x49022b=_0x3a9348[_0xd9da('0x2c')],_0x2df8d7=_0x5f37e5[_0xd9da('0x2d')],_0x37053b=_0x5f37e5[_0xd9da('0x2d')]+_0x5f37e5[_0xd9da('0x2e')],_0x26515a;if(_0x37053b>=_0x49022b){_0x37053b=_0x49022b;_0x26515a=0xc8;}else{_0x26515a=0xce;}_0x57e469['status'](_0x26515a);return _0x57e469[_0xd9da('0x2f')](_0xd9da('0x30'),_0x2df8d7+'-'+_0x37053b+'/'+_0x49022b)[_0xd9da('0x2b')](_0x3a9348);}return null;};}function patchUpdates(_0x45da00){return function(_0x391ba4){try{jsonpatch['apply'](_0x391ba4,_0x45da00,!![]);}catch(_0xfd05fb){return BPromise[_0xd9da('0x31')](_0xfd05fb);}return _0x391ba4[_0xd9da('0x32')]();};}function saveUpdates(_0x5ce572,_0x1c69f8){return function(_0x2c9b82){if(_0x2c9b82){return _0x2c9b82[_0xd9da('0x33')](_0x5ce572)[_0xd9da('0x1d')](function(_0x3e9425){return _0x3e9425;});}return null;};}function removeEntity(_0x2cdfb0,_0x23c8b0){return function(_0x4a2c6b){if(_0x4a2c6b){return _0x4a2c6b[_0xd9da('0x34')]()[_0xd9da('0x1d')](function(){_0x2cdfb0[_0xd9da('0x29')](0xcc)[_0xd9da('0x2a')]();});}};}function handleEntityNotFound(_0x3b8101,_0x4aa6cf){return function(_0x544e91){if(!_0x544e91){_0x3b8101['sendStatus'](0x194);}return _0x544e91;};}function handleError(_0x43a398,_0x1695db){_0x1695db=_0x1695db||0x1f4;return function(_0x5d56ee){logger[_0xd9da('0x23')](_0x5d56ee[_0xd9da('0x35')]);if(_0x5d56ee[_0xd9da('0x36')]){delete _0x5d56ee[_0xd9da('0x36')];}_0x43a398['status'](_0x1695db)[_0xd9da('0x37')](_0x5d56ee);};}exports['index']=function(_0x1b410b,_0x2bb08a){var _0x4ee6c2={},_0x733d6c={},_0x3c32af={'count':0x0,'rows':[]};var _0x533dbe=_['map'](db['ServicenowAccount'][_0xd9da('0x38')],function(_0x4fad97){return{'name':_0x4fad97[_0xd9da('0x39')],'type':_0x4fad97[_0xd9da('0x3a')][_0xd9da('0x3b')]};});_0x733d6c[_0xd9da('0x3c')]=_[_0xd9da('0x3d')](_0x533dbe,'name');_0x733d6c[_0xd9da('0x3e')]=_[_0xd9da('0x3f')](_0x1b410b[_0xd9da('0x3e')]);_0x733d6c[_0xd9da('0x40')]=_[_0xd9da('0x41')](_0x733d6c[_0xd9da('0x3c')],_0x733d6c[_0xd9da('0x3e')]);_0x4ee6c2[_0xd9da('0x42')]=_['intersection'](_0x733d6c[_0xd9da('0x3c')],qs[_0xd9da('0x43')](_0x1b410b[_0xd9da('0x3e')][_0xd9da('0x43')]));_0x4ee6c2[_0xd9da('0x42')]=_0x4ee6c2[_0xd9da('0x42')]['length']?_0x4ee6c2[_0xd9da('0x42')]:_0x733d6c[_0xd9da('0x3c')];if(!_0x1b410b['query']['hasOwnProperty'](_0xd9da('0x44'))){_0x4ee6c2[_0xd9da('0x2e')]=qs[_0xd9da('0x2e')](_0x1b410b[_0xd9da('0x3e')][_0xd9da('0x2e')]);_0x4ee6c2['offset']=qs[_0xd9da('0x2d')](_0x1b410b[_0xd9da('0x3e')][_0xd9da('0x2d')]);}_0x4ee6c2[_0xd9da('0x45')]=qs[_0xd9da('0x46')](_0x1b410b['query'][_0xd9da('0x46')]);_0x4ee6c2['where']=qs[_0xd9da('0x40')](_[_0xd9da('0x47')](_0x1b410b['query'],_0x733d6c['filters']),_0x533dbe);if(_0x1b410b[_0xd9da('0x3e')][_0xd9da('0x48')]){_0x4ee6c2[_0xd9da('0x49')]=_[_0xd9da('0x4a')](_0x4ee6c2[_0xd9da('0x49')],{'$or':_[_0xd9da('0x3d')](_0x533dbe,function(_0x593cd7){if(_0x593cd7[_0xd9da('0x3a')]!==_0xd9da('0x4b')){var _0x3139e1={};_0x3139e1[_0x593cd7['name']]={'$like':'%'+_0x1b410b[_0xd9da('0x3e')]['filter']+'%'};return _0x3139e1;}})});}_0x4ee6c2=_[_0xd9da('0x4a')]({},_0x4ee6c2,_0x1b410b[_0xd9da('0x4c')]);var _0x333216={'where':_0x4ee6c2[_0xd9da('0x49')]};return db[_0xd9da('0x4d')][_0xd9da('0x2c')](_0x333216)[_0xd9da('0x1d')](function(_0x3005ce){_0x3c32af[_0xd9da('0x2c')]=_0x3005ce;if(_0x1b410b[_0xd9da('0x3e')][_0xd9da('0x4e')]){_0x4ee6c2['include']=[{'all':!![]}];}return db[_0xd9da('0x4d')][_0xd9da('0x4f')](_0x4ee6c2);})[_0xd9da('0x1d')](function(_0x9a6370){_0x3c32af[_0xd9da('0x50')]=_0x9a6370;return _0x3c32af;})[_0xd9da('0x1d')](respondWithFilteredResult(_0x2bb08a,_0x4ee6c2))[_0xd9da('0x27')](handleError(_0x2bb08a,null));};exports[_0xd9da('0x51')]=function(_0x4cfb87,_0x3609af){var _0x42fced={'raw':![],'where':{'id':_0x4cfb87[_0xd9da('0x52')]['id']}},_0x4a6279={};_0x4a6279[_0xd9da('0x3c')]=_[_0xd9da('0x3f')](db[_0xd9da('0x4d')][_0xd9da('0x38')]);_0x4a6279['query']=_[_0xd9da('0x3f')](_0x4cfb87[_0xd9da('0x3e')]);_0x4a6279[_0xd9da('0x40')]=_['intersection'](_0x4a6279[_0xd9da('0x3c')],_0x4a6279[_0xd9da('0x3e')]);_0x42fced[_0xd9da('0x42')]=_[_0xd9da('0x41')](_0x4a6279[_0xd9da('0x3c')],qs[_0xd9da('0x43')](_0x4cfb87[_0xd9da('0x3e')][_0xd9da('0x43')]));_0x42fced[_0xd9da('0x42')]=_0x42fced['attributes'][_0xd9da('0x53')]?_0x42fced[_0xd9da('0x42')]:_0x4a6279[_0xd9da('0x3c')];if(_0x4cfb87['query']['includeAll']){_0x42fced[_0xd9da('0x54')]=[{'all':!![]}];}_0x42fced=_[_0xd9da('0x4a')]({},_0x42fced,_0x4cfb87['options']);return db[_0xd9da('0x4d')]['find'](_0x42fced)['then'](handleEntityNotFound(_0x3609af,null))[_0xd9da('0x1d')](respondWithResult(_0x3609af,null))[_0xd9da('0x27')](handleError(_0x3609af,null));};exports[_0xd9da('0x55')]=function(_0x200756,_0x17de82){return db[_0xd9da('0x4d')][_0xd9da('0x55')](_0x200756[_0xd9da('0x56')],{})['then'](respondWithResult(_0x17de82,0xc9))[_0xd9da('0x27')](handleError(_0x17de82,null));};exports[_0xd9da('0x33')]=function(_0x99381e,_0xb52661){if(_0x99381e['body']['id']){delete _0x99381e[_0xd9da('0x56')]['id'];}return db[_0xd9da('0x4d')]['find']({'where':{'id':_0x99381e[_0xd9da('0x52')]['id']}})[_0xd9da('0x1d')](handleEntityNotFound(_0xb52661,null))[_0xd9da('0x1d')](saveUpdates(_0x99381e[_0xd9da('0x56')],null))['then'](respondWithResult(_0xb52661,null))[_0xd9da('0x27')](handleError(_0xb52661,null));};exports[_0xd9da('0x34')]=function(_0x5d6f3d,_0x2a777e){return db['ServicenowAccount'][_0xd9da('0x57')]({'where':{'id':_0x5d6f3d[_0xd9da('0x52')]['id']}})[_0xd9da('0x1d')](handleEntityNotFound(_0x2a777e,null))[_0xd9da('0x1d')](removeEntity(_0x2a777e,null))[_0xd9da('0x27')](handleError(_0x2a777e,null));};exports[_0xd9da('0x58')]=function(_0x1a2066,_0x3e910f,_0x361899){var _0x3b4428={};var _0x10001a={};var _0xd077a6;var _0x5dbbee;return db[_0xd9da('0x4d')][_0xd9da('0x59')]({'where':{'id':_0x1a2066[_0xd9da('0x52')]['id']}})[_0xd9da('0x1d')](handleEntityNotFound(_0x3e910f,null))[_0xd9da('0x1d')](function(_0x5c66d7){if(_0x5c66d7){_0xd077a6=_0x5c66d7;_0x10001a[_0xd9da('0x3c')]=_[_0xd9da('0x3f')](db[_0xd9da('0x5a')][_0xd9da('0x38')]);_0x10001a[_0xd9da('0x3e')]=_[_0xd9da('0x3f')](_0x1a2066[_0xd9da('0x3e')]);_0x10001a['filters']=_['intersection'](_0x10001a[_0xd9da('0x3c')],_0x10001a[_0xd9da('0x3e')]);_0x3b4428[_0xd9da('0x42')]=_[_0xd9da('0x41')](_0x10001a[_0xd9da('0x3c')],qs[_0xd9da('0x43')](_0x1a2066[_0xd9da('0x3e')][_0xd9da('0x43')]));_0x3b4428[_0xd9da('0x42')]=_0x3b4428[_0xd9da('0x42')][_0xd9da('0x53')]?_0x3b4428[_0xd9da('0x42')]:_0x10001a[_0xd9da('0x3c')];_0x3b4428[_0xd9da('0x45')]=qs[_0xd9da('0x46')](_0x1a2066[_0xd9da('0x3e')][_0xd9da('0x46')]);_0x3b4428[_0xd9da('0x49')]=qs[_0xd9da('0x40')](_['pick'](_0x1a2066[_0xd9da('0x3e')],_0x10001a[_0xd9da('0x40')]));if(_0x1a2066[_0xd9da('0x3e')]['filter']){_0x3b4428[_0xd9da('0x49')]=_[_0xd9da('0x4a')](_0x3b4428[_0xd9da('0x49')],{'$or':_[_0xd9da('0x3d')](_0x3b4428['attributes'],function(_0x21a80f){var _0x124bdc={};_0x124bdc[_0x21a80f]={'$like':'%'+_0x1a2066['query']['filter']+'%'};return _0x124bdc;})});}_0x3b4428=_['merge']({},_0x3b4428,_0x1a2066[_0xd9da('0x4c')]);return _0xd077a6[_0xd9da('0x58')](_0x3b4428);}})[_0xd9da('0x1d')](function(_0x5752d9){if(_0x5752d9){_0x5dbbee=_0x5752d9[_0xd9da('0x53')];if(!_0x1a2066[_0xd9da('0x3e')][_0xd9da('0x5b')](_0xd9da('0x44'))){_0x3b4428[_0xd9da('0x2e')]=qs['limit'](_0x1a2066[_0xd9da('0x3e')][_0xd9da('0x2e')]);_0x3b4428[_0xd9da('0x2d')]=qs[_0xd9da('0x2d')](_0x1a2066[_0xd9da('0x3e')][_0xd9da('0x2d')]);}return _0xd077a6['getConfigurations'](_0x3b4428);}})[_0xd9da('0x1d')](function(_0xe20c32){if(_0xe20c32){return _0xe20c32?{'count':_0x5dbbee,'rows':_0xe20c32}:null;}})[_0xd9da('0x1d')](respondWithResult(_0x3e910f,null))[_0xd9da('0x27')](handleError(_0x3e910f,null));};exports[_0xd9da('0x5c')]=function(_0x3e8f28,_0x275b14,_0x105fe1){if(_0x3e8f28[_0xd9da('0x56')]['id']){delete _0x3e8f28[_0xd9da('0x56')]['id'];}return db[_0xd9da('0x4d')][_0xd9da('0x59')]({'where':{'id':_0x3e8f28['params']['id']}})[_0xd9da('0x1d')](handleEntityNotFound(_0x275b14,null))[_0xd9da('0x1d')](function(_0x4e888e){if(_0x4e888e){_0x3e8f28[_0xd9da('0x56')]['AccountId']=_0x4e888e['id'];_0x3e8f28['body'][_0xd9da('0x5d')]=integrations['getSubjects'](_0x3e8f28['body'][_0xd9da('0x5e')],_0x3e8f28['body']['type']);_0x3e8f28['body'][_0xd9da('0x5f')]=integrations[_0xd9da('0x60')](_0x3e8f28['body'][_0xd9da('0x5e')],_0x3e8f28[_0xd9da('0x56')][_0xd9da('0x3a')]);return db[_0xd9da('0x5a')]['create'](_0x3e8f28[_0xd9da('0x56')],{'include':[{'model':db['ServicenowField'],'as':_0xd9da('0x5d')},{'model':db[_0xd9da('0x61')],'as':_0xd9da('0x5f')}]});}return null;})[_0xd9da('0x1d')](respondWithResult(_0x275b14,null))[_0xd9da('0x27')](handleError(_0x275b14,null));};exports[_0xd9da('0x62')]=function(_0x1f15e5,_0x578acd,_0x59d9a0){var _0x23bdfd=[_0xd9da('0x63'),_0xd9da('0x64'),_0xd9da('0x65'),_0xd9da('0x66'),_0xd9da('0x67'),_0xd9da('0x68'),'incident_state','severity',_0xd9da('0x69')];var _0x253505=[_0xd9da('0x6a'),_0xd9da('0x63'),_0xd9da('0x6b'),_0xd9da('0x6c'),_0xd9da('0x6d'),_0xd9da('0x6e'),'child_incidents',_0xd9da('0x64'),'approval_history',_0xd9da('0x6f'),_0xd9da('0x70'),_0xd9da('0x71'),'opened_by','user_input',_0xd9da('0x72'),_0xd9da('0x73'),_0xd9da('0x74'),_0xd9da('0x75'),_0xd9da('0x65'),_0xd9da('0x45'),_0xd9da('0x76'),_0xd9da('0x77'),'cmdb_ci',_0xd9da('0x78'),_0xd9da('0x79'),_0xd9da('0x7a'),_0xd9da('0x7b'),_0xd9da('0x7c'),_0xd9da('0x7d'),_0xd9da('0x7e'),_0xd9da('0x7f'),_0xd9da('0x80'),_0xd9da('0x81'),'opened_at','business_duration',_0xd9da('0x82'),'work_end',_0xd9da('0x83'),'resolved_at','caller_id',_0xd9da('0x84'),_0xd9da('0x66'),_0xd9da('0x85'),_0xd9da('0x86'),_0xd9da('0x67'),_0xd9da('0x87'),_0xd9da('0x88'),_0xd9da('0x89'),_0xd9da('0x8a'),_0xd9da('0x8b'),_0xd9da('0x8c'),_0xd9da('0x8d'),'calendar_duration',_0xd9da('0x68'),_0xd9da('0x8e'),_0xd9da('0x8f'),_0xd9da('0x90'),_0xd9da('0x91'),_0xd9da('0x92'),_0xd9da('0x93'),_0xd9da('0x94'),'reopened_by',_0xd9da('0x95'),_0xd9da('0x96'),_0xd9da('0x97'),_0xd9da('0x98'),_0xd9da('0x99'),_0xd9da('0x9a'),_0xd9da('0x9b'),'severity',_0xd9da('0x9c'),_0xd9da('0x9d'),'approval',_0xd9da('0x9e'),_0xd9da('0x9f'),'sys_mod_count',_0xd9da('0xa0'),_0xd9da('0xa1'),_0xd9da('0xa2'),_0xd9da('0xa3'),_0xd9da('0xa4'),_0xd9da('0xa5'),_0xd9da('0x69')];var _0x5d80d9='';var _0x366e66='';var _0x4fe79a=[];var _0x4a0545='';var _0x51a408='';var _0x994f4b=[];var _0x3fdf9c='';var _0x166e24='';var _0x1734a6={};var _0x4be638='';return db[_0xd9da('0x4d')][_0xd9da('0x59')]({'where':{'id':_0x1f15e5[_0xd9da('0x52')]['id']},'attributes':['id','username',_0xd9da('0xa6'),'email',_0xd9da('0xa7'),_0xd9da('0xa8')]})[_0xd9da('0x1d')](handleEntityNotFound(_0x578acd,null))[_0xd9da('0x1d')](function(_0x553661){if(_0x553661){_0x4be638=_0x553661[_0xd9da('0xa7')];var _0x83fa95=_0x4be638['slice'](-0x1);if(_0x83fa95==='/'){_0x4be638=_0x4be638[_0xd9da('0xa9')](0x0,_0x4be638[_0xd9da('0xaa')](_0x83fa95));}_0x166e24=util[_0xd9da('0xab')]('%s/api/now/doc/table/schema/',_0x4be638);_0x3fdf9c=util[_0xd9da('0xab')]('%s/api/now/table/',_0x4be638);_0x1734a6={'user':_0x553661[_0xd9da('0xac')],'pass':_0x553661[_0xd9da('0xa6')]};var _0x465808={'method':_0xd9da('0xad'),'uri':_0x166e24+_0xd9da('0xae'),'auth':_0x1734a6,'json':!![]};return rp(_0x465808);}})['then'](function(_0x264fad){if(_0x264fad[_0xd9da('0x26')][_0xd9da('0x53')]>0x0){_0x5d80d9=_0x264fad['result'];}console[_0xd9da('0xaf')]('incident\x20table\x20objects',_0x5d80d9);_0x994f4b=[];_0x366e66=Object[_0xd9da('0xb0')]([],_0x5d80d9);_[_0xd9da('0xb1')](_0x366e66,function(_0x237d40){return!_0x23bdfd[_0xd9da('0xb2')](_0x237d40[_0xd9da('0x36')]);});_0x366e66[_0xd9da('0xb3')](function(_0x44b501){var _0x34d7e8=createFieldObject(_0x3fdf9c,_0x1734a6,_0x44b501[_0xd9da('0xb4')],_0x44b501['name'],_0x44b501[_0xd9da('0xb5')],![]);_0x994f4b[_0xd9da('0xb6')](_0x34d7e8);});return Promise['all'](_0x994f4b);})[_0xd9da('0x1d')](function(_0x393c8f){_0x4fe79a=_0x393c8f;_0x4a0545=Object['assign']([],_0x5d80d9);console[_0xd9da('0xaf')](_0xd9da('0xb7'),_0x5d80d9);_[_0xd9da('0xb1')](_0x4a0545,function(_0x86bf17){return _0x253505['includes'](_0x86bf17[_0xd9da('0x36')]);});console['log'](_0xd9da('0xb8'),_0x4a0545);_0x994f4b=[];_0x4a0545['forEach'](function(_0x2b6c98){var _0x49d55d=createFieldObject(_0x3fdf9c,_0x1734a6,_0x2b6c98[_0xd9da('0xb4')],_0x2b6c98[_0xd9da('0x36')],_0x2b6c98['label'],!![]);_0x994f4b['push'](_0x49d55d);});return Promise[_0xd9da('0xb9')](_0x994f4b);})[_0xd9da('0x1d')](function(_0x5f4e09){_0x51a408=_0x5f4e09;var _0x1bd4b1=_0x4fe79a[_0xd9da('0xba')](_0x51a408);return{'count':_0x1bd4b1['length'],'rows':_0x1bd4b1};})[_0xd9da('0x1d')](respondWithResult(_0x578acd,null))[_0xd9da('0x27')](function(_0x5a8b05){console[_0xd9da('0xaf')](_0xd9da('0xbb')+_0x5a8b05);var _0x47c2a9=_0x1f15e5[_0xd9da('0x3e')][_0xd9da('0x18')]?0x1f4:_0x5a8b05[_0xd9da('0xbc')]||0x1f4;logger[_0xd9da('0x23')](_0x5a8b05['stack']);delete _0x5a8b05[_0xd9da('0x36')];if(_0x47c2a9===0x191){_0x47c2a9=0x190;}_0x578acd[_0xd9da('0x29')](_0x47c2a9)[_0xd9da('0x37')](_0x1f15e5[_0xd9da('0x3e')][_0xd9da('0x18')]?{'message':_0xd9da('0xbd'),'statusCode':_0x5a8b05[_0xd9da('0xbc')]}:_0x5a8b05);});};function createFieldObject(_0x1997bb,_0x5586a9,_0x2d278d,_0x107413,_0x27c52e,_0x46ead1){return new Promise(function(_0x340c48,_0x19b363){var _0x2291d7={'id':_0x107413,'name':_0x27c52e,'custom':_0x46ead1};if(_0x2d278d===_0xd9da('0xbe')){_0x2291d7[_0xd9da('0x4c')]=[{'name':_0xd9da('0xbf'),'value':_0xd9da('0xc0')},{'name':_0xd9da('0xc1'),'value':_0xd9da('0xc2')}];_0x340c48(_0x2291d7);}else{var _0x19012e={'method':'GET','uri':_0x1997bb+_0xd9da('0xc3')+_0x107413,'auth':_0x5586a9,'json':!![]};return rp(_0x19012e)['then'](function(_0x3c2eb6){var _0x2bf299=[];if(_0x3c2eb6[_0xd9da('0x26')]['length']>0x0){_0x3c2eb6[_0xd9da('0x26')]['forEach'](function(_0x27dfe7){if(_0x27dfe7[_0xd9da('0xc4')]==='false'){var _0x4f7554={'name':_0x27dfe7[_0xd9da('0xb5')],'value':_0x27dfe7[_0xd9da('0xc5')]};_0x2bf299[_0xd9da('0xb6')](_0x4f7554);}});}_0x2291d7[_0xd9da('0x4c')]=_0x2bf299;if(_0x2291d7['options'][_0xd9da('0x53')]>0x0){_0x340c48(_0x2291d7);}else{if(_0x46ead1==![]){_0x340c48();}else{_0x340c48(_0x2291d7);}}});}});} \ No newline at end of file +var _0x6b4e=['time_worked','expected_start','opened_at','business_duration','group_list','work_end','reopened_time','caller_id','approval_set','short_description','correlation_display','delivery_task','work_start','assignment_group','business_stc','closed_by','follow_up','parent_incident','contact_type','urgency','company','reassignment_count','activity_due','severity','approval','comments_and_work_notes','sys_mod_count','escalation','location','username','password','email','remoteUri','slice','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','GET','incident?sysparm_display_value=all','assign','remove','includes','forEach','internalType','label','push','all','log','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','statusCode','boolean','True','true','False','inactive','false','value','eml-format','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../components/integrations/configuration','jayson/promise','client','http','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~!@#$%^&-_=+[{]}.','request','ServicenowAccount,\x20%s,\x20%s','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','json','count','offset','limit','status','set','reject','save','update','then','destroy','stack','name','send','ServicenowAccount','rawAttributes','fieldName','type','key','model','map','keys','intersection','query','attributes','fields','length','hasOwnProperty','order','sort','where','filters','filter','merge','options','includeAll','include','rows','show','params','find','create','body','getConfigurations','findOne','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','ServicenowConfiguration','ServicenowField','hold_reason','close_code','notify','incident_state','category','parent','made_sla','watch_list','upon_reject','sys_updated_on','child_incidents','approval_history','sys_updated_by','opened_by','user_input','sys_created_on','sys_domain','state','sys_created_by','knowledge','calendar_stc','closed_at','cmdb_ci','impact','active','work_notes_list','priority','sys_domain_path','rfc'];(function(_0x568bb6,_0x4241a8){var _0x4186fa=function(_0x2d5ff2){while(--_0x2d5ff2){_0x568bb6['push'](_0x568bb6['shift']());}};_0x4186fa(++_0x4241a8);}(_0x6b4e,0x1a8));var _0xe6b4=function(_0x17bd98,_0x247e05){_0x17bd98=_0x17bd98-0x0;var _0x13ff66=_0x6b4e[_0x17bd98];return _0x13ff66;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe6b4('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xe6b4('0x1'));var BPromise=require(_0xe6b4('0x2'));var Mustache=require(_0xe6b4('0x3'));var util=require(_0xe6b4('0x4'));var path=require(_0xe6b4('0x5'));var sox=require(_0xe6b4('0x6'));var csv=require('to-csv');var ejs=require(_0xe6b4('0x7'));var fs=require('fs');var _=require(_0xe6b4('0x8'));var squel=require(_0xe6b4('0x9'));var crypto=require(_0xe6b4('0xa'));var jsforce=require(_0xe6b4('0xb'));var deskjs=require(_0xe6b4('0xc'));var toCsv=require(_0xe6b4('0xd'));var querystring=require(_0xe6b4('0xe'));var Papa=require(_0xe6b4('0xf'));var Redis=require(_0xe6b4('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xe6b4('0x11'));var as=require(_0xe6b4('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xe6b4('0x13'));var config=require(_0xe6b4('0x14'));var db=require('../../mysqldb')['db'];var integrations=require(_0xe6b4('0x15'));var jayson=require(_0xe6b4('0x16'));var client=jayson[_0xe6b4('0x17')][_0xe6b4('0x18')]({'port':0x232a});function checkPasswordPattern(_0x2ef521,_0x51b0fb,_0x190b7f){if(_0x190b7f){var _0x184353=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x184353[_0xe6b4('0x19')](_0x51b0fb)){return _0x2ef521;}else{throw new db[(_0xe6b4('0x1a'))]['ValidationError'](_0xe6b4('0x1b'));}}else{return _0x2ef521;}}function respondWithRpcPromise(_0x2022ca,_0x2e3eff,_0x42876a,_0x25ad62){return new BPromise(function(_0x5ec51c,_0x3a64a5){var _0x2c9335=_0x25ad62||client;return _0x2c9335[_0xe6b4('0x1c')](_0x2022ca,_0x42876a)['then'](function(_0x59925c){logger['info'](_0xe6b4('0x1d'),_0x2e3eff,'request\x20sent');logger['debug'](_0xe6b4('0x1e'),_0x2e3eff,'request\x20sent',JSON[_0xe6b4('0x1f')](_0x59925c));if(_0x59925c[_0xe6b4('0x20')]){if(_0x59925c[_0xe6b4('0x20')][_0xe6b4('0x21')]===0x1f4){logger[_0xe6b4('0x20')](_0xe6b4('0x1d'),_0x2e3eff,_0x59925c[_0xe6b4('0x20')][_0xe6b4('0x22')]);return _0x3a64a5(_0x59925c['error'][_0xe6b4('0x22')]);}logger['error'](_0xe6b4('0x1d'),_0x2e3eff,_0x59925c[_0xe6b4('0x20')][_0xe6b4('0x22')]);return _0x5ec51c(_0x59925c[_0xe6b4('0x20')][_0xe6b4('0x22')]);}else{logger['info']('ServicenowAccount,\x20%s,\x20%s',_0x2e3eff,'request\x20sent');_0x5ec51c(_0x59925c[_0xe6b4('0x23')]['message']);}})[_0xe6b4('0x24')](function(_0x31b451){logger[_0xe6b4('0x20')](_0xe6b4('0x1d'),_0x2e3eff,_0x31b451);_0x3a64a5(_0x31b451);});});}function respondWithStatusCode(_0x4bcbc9,_0x191ae2){_0x191ae2=_0x191ae2||0xcc;return function(_0x3e7a90){if(_0x3e7a90){return _0x4bcbc9[_0xe6b4('0x25')](_0x191ae2);}return _0x4bcbc9['status'](_0x191ae2)[_0xe6b4('0x26')]();};}function respondWithResult(_0x5a448c,_0x32e635){_0x32e635=_0x32e635||0xc8;return function(_0x45168a){if(_0x45168a){return _0x5a448c['status'](_0x32e635)[_0xe6b4('0x27')](_0x45168a);}};}function respondWithFilteredResult(_0x31df4a,_0x3f6b24){return function(_0x54b5db){if(_0x54b5db){var _0x49bee2=_0x54b5db[_0xe6b4('0x28')],_0x383223=_0x3f6b24[_0xe6b4('0x29')],_0x223239=_0x3f6b24[_0xe6b4('0x29')]+_0x3f6b24[_0xe6b4('0x2a')],_0x22dcfb;if(_0x223239>=_0x49bee2){_0x223239=_0x49bee2;_0x22dcfb=0xc8;}else{_0x22dcfb=0xce;}_0x31df4a[_0xe6b4('0x2b')](_0x22dcfb);return _0x31df4a[_0xe6b4('0x2c')]('Content-Range',_0x383223+'-'+_0x223239+'/'+_0x49bee2)['json'](_0x54b5db);}return null;};}function patchUpdates(_0x1e236b){return function(_0x40f0dc){try{jsonpatch['apply'](_0x40f0dc,_0x1e236b,!![]);}catch(_0x2e5874){return BPromise[_0xe6b4('0x2d')](_0x2e5874);}return _0x40f0dc[_0xe6b4('0x2e')]();};}function saveUpdates(_0x4cd803,_0x21937f){return function(_0x3a9c18){if(_0x3a9c18){return _0x3a9c18[_0xe6b4('0x2f')](_0x4cd803)[_0xe6b4('0x30')](function(_0x8cb879){return _0x8cb879;});}return null;};}function removeEntity(_0x12e9a9,_0xd86f63){return function(_0x47c1ba){if(_0x47c1ba){return _0x47c1ba[_0xe6b4('0x31')]()[_0xe6b4('0x30')](function(){_0x12e9a9[_0xe6b4('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2fd6aa,_0x222901){return function(_0x5b7c79){if(!_0x5b7c79){_0x2fd6aa[_0xe6b4('0x25')](0x194);}return _0x5b7c79;};}function handleError(_0x425b84,_0x2b846a){_0x2b846a=_0x2b846a||0x1f4;return function(_0x46ea16){logger['error'](_0x46ea16[_0xe6b4('0x32')]);if(_0x46ea16[_0xe6b4('0x33')]){delete _0x46ea16[_0xe6b4('0x33')];}_0x425b84['status'](_0x2b846a)[_0xe6b4('0x34')](_0x46ea16);};}exports['index']=function(_0x3b496d,_0x4b49c2){var _0x4c947c={},_0x1ad1e7={},_0x13e85c={'count':0x0,'rows':[]};var _0x575c11=_['map'](db[_0xe6b4('0x35')][_0xe6b4('0x36')],function(_0x417787){return{'name':_0x417787[_0xe6b4('0x37')],'type':_0x417787[_0xe6b4('0x38')][_0xe6b4('0x39')]};});_0x1ad1e7[_0xe6b4('0x3a')]=_[_0xe6b4('0x3b')](_0x575c11,_0xe6b4('0x33'));_0x1ad1e7['query']=_[_0xe6b4('0x3c')](_0x3b496d['query']);_0x1ad1e7['filters']=_[_0xe6b4('0x3d')](_0x1ad1e7[_0xe6b4('0x3a')],_0x1ad1e7[_0xe6b4('0x3e')]);_0x4c947c[_0xe6b4('0x3f')]=_['intersection'](_0x1ad1e7[_0xe6b4('0x3a')],qs[_0xe6b4('0x40')](_0x3b496d[_0xe6b4('0x3e')]['fields']));_0x4c947c[_0xe6b4('0x3f')]=_0x4c947c[_0xe6b4('0x3f')][_0xe6b4('0x41')]?_0x4c947c[_0xe6b4('0x3f')]:_0x1ad1e7[_0xe6b4('0x3a')];if(!_0x3b496d['query'][_0xe6b4('0x42')]('nolimit')){_0x4c947c[_0xe6b4('0x2a')]=qs[_0xe6b4('0x2a')](_0x3b496d[_0xe6b4('0x3e')]['limit']);_0x4c947c[_0xe6b4('0x29')]=qs['offset'](_0x3b496d[_0xe6b4('0x3e')][_0xe6b4('0x29')]);}_0x4c947c[_0xe6b4('0x43')]=qs[_0xe6b4('0x44')](_0x3b496d[_0xe6b4('0x3e')][_0xe6b4('0x44')]);_0x4c947c[_0xe6b4('0x45')]=qs[_0xe6b4('0x46')](_['pick'](_0x3b496d[_0xe6b4('0x3e')],_0x1ad1e7['filters']),_0x575c11);if(_0x3b496d[_0xe6b4('0x3e')][_0xe6b4('0x47')]){_0x4c947c[_0xe6b4('0x45')]=_[_0xe6b4('0x48')](_0x4c947c[_0xe6b4('0x45')],{'$or':_[_0xe6b4('0x3b')](_0x575c11,function(_0x19a9a9){if(_0x19a9a9['type']!=='VIRTUAL'){var _0x1ee558={};_0x1ee558[_0x19a9a9['name']]={'$like':'%'+_0x3b496d[_0xe6b4('0x3e')][_0xe6b4('0x47')]+'%'};return _0x1ee558;}})});}_0x4c947c=_[_0xe6b4('0x48')]({},_0x4c947c,_0x3b496d[_0xe6b4('0x49')]);var _0x8fe9bc={'where':_0x4c947c[_0xe6b4('0x45')]};return db[_0xe6b4('0x35')][_0xe6b4('0x28')](_0x8fe9bc)[_0xe6b4('0x30')](function(_0x1b1cd6){_0x13e85c['count']=_0x1b1cd6;if(_0x3b496d['query'][_0xe6b4('0x4a')]){_0x4c947c[_0xe6b4('0x4b')]=[{'all':!![]}];}return db[_0xe6b4('0x35')]['findAll'](_0x4c947c);})[_0xe6b4('0x30')](function(_0x200b9e){_0x13e85c[_0xe6b4('0x4c')]=_0x200b9e;return _0x13e85c;})[_0xe6b4('0x30')](respondWithFilteredResult(_0x4b49c2,_0x4c947c))[_0xe6b4('0x24')](handleError(_0x4b49c2,null));};exports[_0xe6b4('0x4d')]=function(_0x28c1cc,_0x299387){var _0x104084={'raw':![],'where':{'id':_0x28c1cc[_0xe6b4('0x4e')]['id']}},_0x447b53={};_0x447b53[_0xe6b4('0x3a')]=_[_0xe6b4('0x3c')](db[_0xe6b4('0x35')][_0xe6b4('0x36')]);_0x447b53[_0xe6b4('0x3e')]=_[_0xe6b4('0x3c')](_0x28c1cc[_0xe6b4('0x3e')]);_0x447b53[_0xe6b4('0x46')]=_[_0xe6b4('0x3d')](_0x447b53['model'],_0x447b53['query']);_0x104084[_0xe6b4('0x3f')]=_['intersection'](_0x447b53[_0xe6b4('0x3a')],qs[_0xe6b4('0x40')](_0x28c1cc[_0xe6b4('0x3e')]['fields']));_0x104084[_0xe6b4('0x3f')]=_0x104084[_0xe6b4('0x3f')][_0xe6b4('0x41')]?_0x104084[_0xe6b4('0x3f')]:_0x447b53[_0xe6b4('0x3a')];if(_0x28c1cc[_0xe6b4('0x3e')][_0xe6b4('0x4a')]){_0x104084['include']=[{'all':!![]}];}_0x104084=_[_0xe6b4('0x48')]({},_0x104084,_0x28c1cc[_0xe6b4('0x49')]);return db[_0xe6b4('0x35')][_0xe6b4('0x4f')](_0x104084)[_0xe6b4('0x30')](handleEntityNotFound(_0x299387,null))['then'](respondWithResult(_0x299387,null))[_0xe6b4('0x24')](handleError(_0x299387,null));};exports[_0xe6b4('0x50')]=function(_0xc9b063,_0x1da4be){return db[_0xe6b4('0x35')][_0xe6b4('0x50')](_0xc9b063[_0xe6b4('0x51')],{})[_0xe6b4('0x30')](respondWithResult(_0x1da4be,0xc9))[_0xe6b4('0x24')](handleError(_0x1da4be,null));};exports['update']=function(_0x5e5ab4,_0x464dd4){if(_0x5e5ab4['body']['id']){delete _0x5e5ab4[_0xe6b4('0x51')]['id'];}return db['ServicenowAccount']['find']({'where':{'id':_0x5e5ab4[_0xe6b4('0x4e')]['id']}})[_0xe6b4('0x30')](handleEntityNotFound(_0x464dd4,null))[_0xe6b4('0x30')](saveUpdates(_0x5e5ab4[_0xe6b4('0x51')],null))[_0xe6b4('0x30')](respondWithResult(_0x464dd4,null))['catch'](handleError(_0x464dd4,null));};exports[_0xe6b4('0x31')]=function(_0x123933,_0x139d61){return db[_0xe6b4('0x35')]['find']({'where':{'id':_0x123933['params']['id']}})[_0xe6b4('0x30')](handleEntityNotFound(_0x139d61,null))['then'](removeEntity(_0x139d61,null))['catch'](handleError(_0x139d61,null));};exports[_0xe6b4('0x52')]=function(_0x52e32f,_0x4488de,_0x263736){var _0x2ca8b4={};var _0xf7e8fb={};var _0x3ea085;var _0x1afd41;return db[_0xe6b4('0x35')][_0xe6b4('0x53')]({'where':{'id':_0x52e32f[_0xe6b4('0x4e')]['id']}})[_0xe6b4('0x30')](handleEntityNotFound(_0x4488de,null))[_0xe6b4('0x30')](function(_0x37c0aa){if(_0x37c0aa){_0x3ea085=_0x37c0aa;_0xf7e8fb[_0xe6b4('0x3a')]=_[_0xe6b4('0x3c')](db['ServicenowConfiguration'][_0xe6b4('0x36')]);_0xf7e8fb[_0xe6b4('0x3e')]=_[_0xe6b4('0x3c')](_0x52e32f['query']);_0xf7e8fb[_0xe6b4('0x46')]=_['intersection'](_0xf7e8fb[_0xe6b4('0x3a')],_0xf7e8fb[_0xe6b4('0x3e')]);_0x2ca8b4[_0xe6b4('0x3f')]=_[_0xe6b4('0x3d')](_0xf7e8fb[_0xe6b4('0x3a')],qs[_0xe6b4('0x40')](_0x52e32f[_0xe6b4('0x3e')][_0xe6b4('0x40')]));_0x2ca8b4['attributes']=_0x2ca8b4['attributes'][_0xe6b4('0x41')]?_0x2ca8b4[_0xe6b4('0x3f')]:_0xf7e8fb[_0xe6b4('0x3a')];_0x2ca8b4['order']=qs[_0xe6b4('0x44')](_0x52e32f[_0xe6b4('0x3e')][_0xe6b4('0x44')]);_0x2ca8b4['where']=qs[_0xe6b4('0x46')](_['pick'](_0x52e32f[_0xe6b4('0x3e')],_0xf7e8fb[_0xe6b4('0x46')]));if(_0x52e32f['query'][_0xe6b4('0x47')]){_0x2ca8b4['where']=_[_0xe6b4('0x48')](_0x2ca8b4[_0xe6b4('0x45')],{'$or':_['map'](_0x2ca8b4[_0xe6b4('0x3f')],function(_0x48a536){var _0x4029a7={};_0x4029a7[_0x48a536]={'$like':'%'+_0x52e32f[_0xe6b4('0x3e')][_0xe6b4('0x47')]+'%'};return _0x4029a7;})});}_0x2ca8b4=_[_0xe6b4('0x48')]({},_0x2ca8b4,_0x52e32f['options']);return _0x3ea085[_0xe6b4('0x52')](_0x2ca8b4);}})[_0xe6b4('0x30')](function(_0x47e07b){if(_0x47e07b){_0x1afd41=_0x47e07b[_0xe6b4('0x41')];if(!_0x52e32f[_0xe6b4('0x3e')][_0xe6b4('0x42')](_0xe6b4('0x54'))){_0x2ca8b4[_0xe6b4('0x2a')]=qs[_0xe6b4('0x2a')](_0x52e32f['query']['limit']);_0x2ca8b4[_0xe6b4('0x29')]=qs[_0xe6b4('0x29')](_0x52e32f[_0xe6b4('0x3e')]['offset']);}return _0x3ea085[_0xe6b4('0x52')](_0x2ca8b4);}})[_0xe6b4('0x30')](function(_0x5dbbec){if(_0x5dbbec){return _0x5dbbec?{'count':_0x1afd41,'rows':_0x5dbbec}:null;}})['then'](respondWithResult(_0x4488de,null))[_0xe6b4('0x24')](handleError(_0x4488de,null));};exports[_0xe6b4('0x55')]=function(_0x5d84af,_0x4b008d,_0x9f665d){if(_0x5d84af['body']['id']){delete _0x5d84af[_0xe6b4('0x51')]['id'];}return db['ServicenowAccount'][_0xe6b4('0x53')]({'where':{'id':_0x5d84af[_0xe6b4('0x4e')]['id']}})[_0xe6b4('0x30')](handleEntityNotFound(_0x4b008d,null))[_0xe6b4('0x30')](function(_0x11a439){if(_0x11a439){_0x5d84af[_0xe6b4('0x51')][_0xe6b4('0x56')]=_0x11a439['id'];_0x5d84af[_0xe6b4('0x51')][_0xe6b4('0x57')]=integrations[_0xe6b4('0x58')](_0x5d84af['body'][_0xe6b4('0x59')],_0x5d84af['body'][_0xe6b4('0x38')]);_0x5d84af[_0xe6b4('0x51')][_0xe6b4('0x5a')]=integrations['getDescriptions'](_0x5d84af[_0xe6b4('0x51')][_0xe6b4('0x59')],_0x5d84af[_0xe6b4('0x51')]['type']);return db[_0xe6b4('0x5b')]['create'](_0x5d84af[_0xe6b4('0x51')],{'include':[{'model':db[_0xe6b4('0x5c')],'as':_0xe6b4('0x57')},{'model':db[_0xe6b4('0x5c')],'as':_0xe6b4('0x5a')}]});}return null;})[_0xe6b4('0x30')](respondWithResult(_0x4b008d,null))[_0xe6b4('0x24')](handleError(_0x4b008d,null));};exports['getFields']=function(_0x38ed7a,_0x432340,_0x217865){var _0x13c9bc=['made_sla',_0xe6b4('0x5d'),'knowledge','subcategory',_0xe6b4('0x5e'),_0xe6b4('0x5f'),_0xe6b4('0x60'),'severity',_0xe6b4('0x61')];var _0x149264=[_0xe6b4('0x62'),_0xe6b4('0x63'),'caused_by',_0xe6b4('0x64'),_0xe6b4('0x65'),_0xe6b4('0x66'),_0xe6b4('0x67'),'hold_reason',_0xe6b4('0x68'),'number','resolved_by',_0xe6b4('0x69'),_0xe6b4('0x6a'),_0xe6b4('0x6b'),_0xe6b4('0x6c'),_0xe6b4('0x6d'),_0xe6b4('0x6e'),_0xe6b4('0x6f'),_0xe6b4('0x70'),'order',_0xe6b4('0x71'),_0xe6b4('0x72'),_0xe6b4('0x73'),'delivery_plan',_0xe6b4('0x74'),_0xe6b4('0x75'),_0xe6b4('0x76'),'business_service',_0xe6b4('0x77'),_0xe6b4('0x78'),_0xe6b4('0x79'),_0xe6b4('0x7a'),_0xe6b4('0x7b'),_0xe6b4('0x7c'),_0xe6b4('0x7d'),_0xe6b4('0x7e'),_0xe6b4('0x7f'),_0xe6b4('0x80'),'resolved_at',_0xe6b4('0x81'),_0xe6b4('0x82'),'subcategory','work_notes',_0xe6b4('0x83'),_0xe6b4('0x5e'),_0xe6b4('0x84'),_0xe6b4('0x85'),_0xe6b4('0x86'),_0xe6b4('0x87'),_0xe6b4('0x88'),'additional_assignee_list','description','calendar_duration',_0xe6b4('0x5f'),'sys_class_name','close_notes',_0xe6b4('0x89'),_0xe6b4('0x8a'),_0xe6b4('0x8b'),'sys_id',_0xe6b4('0x8c'),'reopened_by','incident_state',_0xe6b4('0x8d'),'problem_id',_0xe6b4('0x8e'),_0xe6b4('0x8f'),_0xe6b4('0x90'),'assigned_to',_0xe6b4('0x91'),'comments','sla_due',_0xe6b4('0x92'),_0xe6b4('0x93'),'due_date',_0xe6b4('0x94'),'reopen_count','sys_tags',_0xe6b4('0x95'),'upon_approval','correlation_id',_0xe6b4('0x96'),_0xe6b4('0x61')];var _0x11791a='';var _0x49227b='';var _0x36973a=[];var _0x48f071='';var _0x409f99='';var _0x46bf22=[];var _0x768fa9='';var _0x553b1d='';var _0x37192e={};var _0x105df9='';return db[_0xe6b4('0x35')][_0xe6b4('0x53')]({'where':{'id':_0x38ed7a['params']['id']},'attributes':['id',_0xe6b4('0x97'),_0xe6b4('0x98'),_0xe6b4('0x99'),_0xe6b4('0x9a'),'serverUrl']})[_0xe6b4('0x30')](handleEntityNotFound(_0x432340,null))[_0xe6b4('0x30')](function(_0xcebb8c){if(_0xcebb8c){_0x105df9=_0xcebb8c[_0xe6b4('0x9a')];var _0x2c3a99=_0x105df9[_0xe6b4('0x9b')](-0x1);if(_0x2c3a99==='/'){_0x105df9=_0x105df9[_0xe6b4('0x9c')](0x0,_0x105df9[_0xe6b4('0x9d')](_0x2c3a99));}_0x553b1d=util[_0xe6b4('0x9e')](_0xe6b4('0x9f'),_0x105df9);_0x768fa9=util['format'](_0xe6b4('0xa0'),_0x105df9);_0x37192e={'user':_0xcebb8c[_0xe6b4('0x97')],'pass':_0xcebb8c[_0xe6b4('0x98')]};var _0x418681={'method':_0xe6b4('0xa1'),'uri':_0x553b1d+_0xe6b4('0xa2'),'auth':_0x37192e,'json':!![]};return rp(_0x418681);}})['then'](function(_0x5dfd90){if(_0x5dfd90['result'][_0xe6b4('0x41')]>0x0){_0x11791a=_0x5dfd90[_0xe6b4('0x23')];}console['log']('incident\x20table\x20objects',_0x11791a);_0x46bf22=[];_0x49227b=Object[_0xe6b4('0xa3')]([],_0x11791a);_[_0xe6b4('0xa4')](_0x49227b,function(_0x535cb2){return!_0x13c9bc[_0xe6b4('0xa5')](_0x535cb2[_0xe6b4('0x33')]);});_0x49227b[_0xe6b4('0xa6')](function(_0x5a252d){var _0x2a7bb4=createFieldObject(_0x768fa9,_0x37192e,_0x5a252d[_0xe6b4('0xa7')],_0x5a252d[_0xe6b4('0x33')],_0x5a252d[_0xe6b4('0xa8')],![]);_0x46bf22[_0xe6b4('0xa9')](_0x2a7bb4);});return Promise[_0xe6b4('0xaa')](_0x46bf22);})[_0xe6b4('0x30')](function(_0xa319da){_0x36973a=_0xa319da;_0x48f071=Object['assign']([],_0x11791a);console[_0xe6b4('0xab')](_0xe6b4('0xac'),_0x11791a);_[_0xe6b4('0xa4')](_0x48f071,function(_0x337810){return _0x149264[_0xe6b4('0xa5')](_0x337810[_0xe6b4('0x33')]);});console[_0xe6b4('0xab')](_0xe6b4('0xad'),_0x48f071);_0x46bf22=[];_0x48f071[_0xe6b4('0xa6')](function(_0xbcf66){var _0x4d77bf=createFieldObject(_0x768fa9,_0x37192e,_0xbcf66[_0xe6b4('0xa7')],_0xbcf66['name'],_0xbcf66[_0xe6b4('0xa8')],!![]);_0x46bf22['push'](_0x4d77bf);});return Promise['all'](_0x46bf22);})[_0xe6b4('0x30')](function(_0x5090db){_0x409f99=_0x5090db;var _0x1ff93a=_0x36973a['concat'](_0x409f99);return{'count':_0x1ff93a[_0xe6b4('0x41')],'rows':_0x1ff93a};})['then'](respondWithResult(_0x432340,null))['catch'](function(_0x5df64c){console['log']('ServiceNow\x20error:\x20'+_0x5df64c);var _0x5c1e4d=_0x38ed7a[_0xe6b4('0x3e')]['test']?0x1f4:_0x5df64c[_0xe6b4('0xae')]||0x1f4;logger[_0xe6b4('0x20')](_0x5df64c[_0xe6b4('0x32')]);delete _0x5df64c[_0xe6b4('0x33')];if(_0x5c1e4d===0x191){_0x5c1e4d=0x190;}_0x432340[_0xe6b4('0x2b')](_0x5c1e4d)['send'](_0x38ed7a[_0xe6b4('0x3e')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x5df64c[_0xe6b4('0xae')]}:_0x5df64c);});};function createFieldObject(_0x3a86b4,_0x207248,_0x5bdad3,_0x30f3f4,_0x10be17,_0x8cb966){return new Promise(function(_0x5c6260,_0xbaa7cd){var _0x56d339={'id':_0x30f3f4,'name':_0x10be17,'custom':_0x8cb966};if(_0x5bdad3===_0xe6b4('0xaf')){_0x56d339[_0xe6b4('0x49')]=[{'name':_0xe6b4('0xb0'),'value':_0xe6b4('0xb1')},{'name':_0xe6b4('0xb2'),'value':'false'}];_0x5c6260(_0x56d339);}else{var _0x39bca2={'method':'GET','uri':_0x3a86b4+'sys_choice?sysparm_query=name=incident^element='+_0x30f3f4,'auth':_0x207248,'json':!![]};return rp(_0x39bca2)['then'](function(_0xcddc82){var _0x29da7b=[];if(_0xcddc82[_0xe6b4('0x23')]['length']>0x0){_0xcddc82[_0xe6b4('0x23')][_0xe6b4('0xa6')](function(_0x43b1fe){if(_0x43b1fe[_0xe6b4('0xb3')]===_0xe6b4('0xb4')){var _0x6ec853={'name':_0x43b1fe[_0xe6b4('0xa8')],'value':_0x43b1fe[_0xe6b4('0xb5')]};_0x29da7b[_0xe6b4('0xa9')](_0x6ec853);}});}_0x56d339['options']=_0x29da7b;if(_0x56d339[_0xe6b4('0x49')]['length']>0x0){_0x5c6260(_0x56d339);}else{if(_0x8cb966==![]){_0x5c6260();}else{_0x5c6260(_0x56d339);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index bf1684b..e620d62 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 _0x5ad3=['../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','ServicenowAccount','int_servicenow_accounts','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x2c6717,_0x240ba5){var _0x5395f6=function(_0x4184c5){while(--_0x4184c5){_0x2c6717['push'](_0x2c6717['shift']());}};_0x5395f6(++_0x240ba5);}(_0x5ad3,0x1e2));var _0x35ad=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x5ad3[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x35ad('0x0'));var util=require(_0x35ad('0x1'));var logger=require(_0x35ad('0x2'))(_0x35ad('0x3'));var moment=require('moment');var BPromise=require(_0x35ad('0x4'));var rp=require(_0x35ad('0x5'));var fs=require('fs');var path=require(_0x35ad('0x6'));var rimraf=require(_0x35ad('0x7'));var config=require(_0x35ad('0x8'));var attributes=require(_0x35ad('0x9'));var integrations=require(_0x35ad('0xa'));module[_0x35ad('0xb')]=function(_0x36c606,_0x31cc6a){return _0x36c606['define'](_0x35ad('0xc'),attributes,{'tableName':_0x35ad('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0e85=['define','ServicenowAccount','int_servicenow_accounts','lodash','util','api','moment','rimraf','./intServicenowAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x0e85,0x7c));var _0x50e8=function(_0x39c734,_0x2f3e06){_0x39c734=_0x39c734-0x0;var _0xb2a2f9=_0x0e85[_0x39c734];return _0xb2a2f9;};'use strict';var _=require(_0x50e8('0x0'));var util=require(_0x50e8('0x1'));var logger=require('../../config/logger')(_0x50e8('0x2'));var moment=require(_0x50e8('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x50e8('0x4'));var config=require('../../config/environment');var attributes=require(_0x50e8('0x5'));var integrations=require(_0x50e8('0x6'));module[_0x50e8('0x7')]=function(_0xfde42,_0x5e8b01){return _0xfde42[_0x50e8('0x8')](_0x50e8('0x9'),attributes,{'tableName':_0x50e8('0xa'),'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 3c118e2..1b6266a 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 _0x09fc=['client','http','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','findAll','options','raw','where','attributes','include','map','model','GetServicenowAccount','debug','ShowServicenowAccount','ServicenowAccount','find','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x4ed4d2,_0x47acf7){var _0x15ae2e=function(_0x3199f0){while(--_0x3199f0){_0x4ed4d2['push'](_0x4ed4d2['shift']());}};_0x15ae2e(++_0x47acf7);}(_0x09fc,0x163));var _0xc09f=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0x09fc[_0x2064e5];return _0x21a233;};'use strict';var _=require('lodash');var util=require(_0xc09f('0x0'));var moment=require(_0xc09f('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc09f('0x2'))['db'];var utils=require(_0xc09f('0x3'));var logger=require(_0xc09f('0x4'))(_0xc09f('0x5'));var config=require(_0xc09f('0x6'));var jayson=require(_0xc09f('0x7'));var client=jayson[_0xc09f('0x8')][_0xc09f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x294259,_0x21058a,_0x756aeb){return new BPromise(function(_0x1eff26,_0x529f44){return client[_0xc09f('0xa')](_0x294259,_0x756aeb)[_0xc09f('0xb')](function(_0x268818){logger[_0xc09f('0xc')](_0xc09f('0xd'),_0x21058a,_0xc09f('0xe'));logger['debug']('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x21058a,_0xc09f('0xe'),JSON[_0xc09f('0xf')](_0x268818));if(_0x268818['error']){if(_0x268818[_0xc09f('0x10')]['code']===0x1f4){logger[_0xc09f('0x10')](_0xc09f('0xd'),_0x21058a,_0x268818[_0xc09f('0x10')][_0xc09f('0x11')]);return _0x529f44(_0x268818['error'][_0xc09f('0x11')]);}logger[_0xc09f('0x10')](_0xc09f('0xd'),_0x21058a,_0x268818['error'][_0xc09f('0x11')]);return _0x1eff26(_0x268818[_0xc09f('0x10')][_0xc09f('0x11')]);}else{logger[_0xc09f('0xc')](_0xc09f('0xd'),_0x21058a,_0xc09f('0xe'));_0x1eff26(_0x268818[_0xc09f('0x12')][_0xc09f('0x11')]);}})[_0xc09f('0x13')](function(_0x4066ab){logger[_0xc09f('0x10')](_0xc09f('0xd'),_0x21058a,_0x4066ab);_0x529f44(_0x4066ab);});});}exports['GetServicenowAccount']=function(_0x40c00c){var _0x6bb629=this;return new Promise(function(_0x3ff8b5,_0x5c6295){return db['ServicenowAccount'][_0xc09f('0x14')]({'raw':_0x40c00c[_0xc09f('0x15')]?_0x40c00c[_0xc09f('0x15')][_0xc09f('0x16')]===undefined?!![]:![]:!![],'where':_0x40c00c[_0xc09f('0x15')]?_0x40c00c[_0xc09f('0x15')][_0xc09f('0x17')]||null:null,'attributes':_0x40c00c[_0xc09f('0x15')]?_0x40c00c['options'][_0xc09f('0x18')]||null:null,'limit':_0x40c00c[_0xc09f('0x15')]?_0x40c00c[_0xc09f('0x15')]['limit']||null:null,'include':_0x40c00c['options']?_0x40c00c['options'][_0xc09f('0x19')]?_[_0xc09f('0x1a')](_0x40c00c[_0xc09f('0x15')][_0xc09f('0x19')],function(_0x3514c2){return{'model':db[_0x3514c2[_0xc09f('0x1b')]],'as':_0x3514c2['as'],'attributes':_0x3514c2['attributes'],'include':_0x3514c2[_0xc09f('0x19')]?_[_0xc09f('0x1a')](_0x3514c2[_0xc09f('0x19')],function(_0x3d352f){return{'model':db[_0x3d352f[_0xc09f('0x1b')]],'as':_0x3d352f['as'],'attributes':_0x3d352f['attributes'],'include':_0x3d352f[_0xc09f('0x19')]?_[_0xc09f('0x1a')](_0x3d352f['include'],function(_0x57cadf){return{'model':db[_0x57cadf['model']],'as':_0x57cadf['as'],'attributes':_0x57cadf[_0xc09f('0x18')]};}):[]};}):[]};}):[]:[]})[_0xc09f('0xb')](function(_0x88f850){logger[_0xc09f('0xc')](_0xc09f('0x1c'),_0x40c00c);logger[_0xc09f('0x1d')](_0xc09f('0x1c'),_0x40c00c,JSON[_0xc09f('0xf')](_0x88f850));_0x3ff8b5(_0x88f850);})[_0xc09f('0x13')](function(_0x28af50){logger[_0xc09f('0x10')](_0xc09f('0x1c'),_0x28af50[_0xc09f('0x11')],_0x40c00c);_0x5c6295(_0x6bb629['error'](0x1f4,_0x28af50['message']));});});};exports[_0xc09f('0x1e')]=function(_0x54a9f5){var _0x164711=this;return new Promise(function(_0x480e9d,_0x37c6f7){return db[_0xc09f('0x1f')][_0xc09f('0x20')]({'raw':_0x54a9f5[_0xc09f('0x15')]?_0x54a9f5['options']['raw']===undefined?!![]:![]:!![],'where':_0x54a9f5['options']?_0x54a9f5['options'][_0xc09f('0x17')]||null:null,'attributes':_0x54a9f5[_0xc09f('0x15')]?_0x54a9f5['options']['attributes']||null:null,'include':_0x54a9f5[_0xc09f('0x15')]?_0x54a9f5['options']['include']?_[_0xc09f('0x1a')](_0x54a9f5['options'][_0xc09f('0x19')],function(_0x431ca0){return{'model':db[_0x431ca0[_0xc09f('0x1b')]],'as':_0x431ca0['as'],'attributes':_0x431ca0[_0xc09f('0x18')],'include':_0x431ca0['include']?_[_0xc09f('0x1a')](_0x431ca0[_0xc09f('0x19')],function(_0xf6f97a){return{'model':db[_0xf6f97a[_0xc09f('0x1b')]],'as':_0xf6f97a['as'],'attributes':_0xf6f97a[_0xc09f('0x18')],'include':_0xf6f97a[_0xc09f('0x19')]?_[_0xc09f('0x1a')](_0xf6f97a[_0xc09f('0x19')],function(_0x2aef08){return{'model':db[_0x2aef08[_0xc09f('0x1b')]],'as':_0x2aef08['as'],'attributes':_0x2aef08['attributes']};}):[]};}):[]};}):[]:[]})[_0xc09f('0xb')](function(_0xd71590){logger[_0xc09f('0xc')]('ShowServicenowAccount',_0x54a9f5);logger[_0xc09f('0x1d')](_0xc09f('0x1e'),_0x54a9f5,JSON[_0xc09f('0xf')](_0xd71590));_0x480e9d(_0xd71590);})[_0xc09f('0x13')](function(_0x41b12f){logger['error']('ShowServicenowAccount',_0x41b12f['message'],_0x54a9f5);_0x37c6f7(_0x164711[_0xc09f('0x10')](0x1f4,_0x41b12f[_0xc09f('0x11')]));});});}; \ No newline at end of file +var _0xf9fd=['map','model','debug','ShowServicenowAccount','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','ServicenowAccount,\x20%s,\x20%s','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetServicenowAccount','ServicenowAccount','findAll','options','raw','where','attributes','limit','include'];(function(_0x3c0420,_0x55f286){var _0x1628c8=function(_0x513579){while(--_0x513579){_0x3c0420['push'](_0x3c0420['shift']());}};_0x1628c8(++_0x55f286);}(_0xf9fd,0x19d));var _0xdf9f=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xf9fd[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0xdf9f('0x0'));var util=require(_0xdf9f('0x1'));var moment=require(_0xdf9f('0x2'));var BPromise=require(_0xdf9f('0x3'));var rs=require(_0xdf9f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xdf9f('0x5'));var logger=require('../../config/logger')(_0xdf9f('0x6'));var config=require(_0xdf9f('0x7'));var jayson=require(_0xdf9f('0x8'));var client=jayson[_0xdf9f('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x476c49,_0x722e26,_0x299846){return new BPromise(function(_0x3fa664,_0xef06bb){return client[_0xdf9f('0xa')](_0x476c49,_0x299846)[_0xdf9f('0xb')](function(_0xb05486){logger[_0xdf9f('0xc')](_0xdf9f('0xd'),_0x722e26,'request\x20sent');logger['debug'](_0xdf9f('0xe'),_0x722e26,'request\x20sent',JSON[_0xdf9f('0xf')](_0xb05486));if(_0xb05486[_0xdf9f('0x10')]){if(_0xb05486['error'][_0xdf9f('0x11')]===0x1f4){logger[_0xdf9f('0x10')](_0xdf9f('0xd'),_0x722e26,_0xb05486[_0xdf9f('0x10')][_0xdf9f('0x12')]);return _0xef06bb(_0xb05486[_0xdf9f('0x10')][_0xdf9f('0x12')]);}logger[_0xdf9f('0x10')]('ServicenowAccount,\x20%s,\x20%s',_0x722e26,_0xb05486['error'][_0xdf9f('0x12')]);return _0x3fa664(_0xb05486[_0xdf9f('0x10')][_0xdf9f('0x12')]);}else{logger[_0xdf9f('0xc')]('ServicenowAccount,\x20%s,\x20%s',_0x722e26,'request\x20sent');_0x3fa664(_0xb05486[_0xdf9f('0x13')][_0xdf9f('0x12')]);}})['catch'](function(_0x4dd9d5){logger[_0xdf9f('0x10')](_0xdf9f('0xd'),_0x722e26,_0x4dd9d5);_0xef06bb(_0x4dd9d5);});});}exports[_0xdf9f('0x14')]=function(_0x132f67){var _0x168f17=this;return new Promise(function(_0x1d7959,_0x2f3e12){return db[_0xdf9f('0x15')][_0xdf9f('0x16')]({'raw':_0x132f67[_0xdf9f('0x17')]?_0x132f67[_0xdf9f('0x17')][_0xdf9f('0x18')]===undefined?!![]:![]:!![],'where':_0x132f67[_0xdf9f('0x17')]?_0x132f67[_0xdf9f('0x17')][_0xdf9f('0x19')]||null:null,'attributes':_0x132f67[_0xdf9f('0x17')]?_0x132f67[_0xdf9f('0x17')][_0xdf9f('0x1a')]||null:null,'limit':_0x132f67['options']?_0x132f67[_0xdf9f('0x17')][_0xdf9f('0x1b')]||null:null,'include':_0x132f67['options']?_0x132f67[_0xdf9f('0x17')][_0xdf9f('0x1c')]?_[_0xdf9f('0x1d')](_0x132f67[_0xdf9f('0x17')][_0xdf9f('0x1c')],function(_0x24637a){return{'model':db[_0x24637a[_0xdf9f('0x1e')]],'as':_0x24637a['as'],'attributes':_0x24637a[_0xdf9f('0x1a')],'include':_0x24637a[_0xdf9f('0x1c')]?_[_0xdf9f('0x1d')](_0x24637a[_0xdf9f('0x1c')],function(_0x38f53f){return{'model':db[_0x38f53f[_0xdf9f('0x1e')]],'as':_0x38f53f['as'],'attributes':_0x38f53f[_0xdf9f('0x1a')],'include':_0x38f53f[_0xdf9f('0x1c')]?_[_0xdf9f('0x1d')](_0x38f53f['include'],function(_0x56e362){return{'model':db[_0x56e362[_0xdf9f('0x1e')]],'as':_0x56e362['as'],'attributes':_0x56e362[_0xdf9f('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x344437){logger[_0xdf9f('0xc')]('GetServicenowAccount',_0x132f67);logger[_0xdf9f('0x1f')]('GetServicenowAccount',_0x132f67,JSON[_0xdf9f('0xf')](_0x344437));_0x1d7959(_0x344437);})['catch'](function(_0x508cc3){logger[_0xdf9f('0x10')]('GetServicenowAccount',_0x508cc3[_0xdf9f('0x12')],_0x132f67);_0x2f3e12(_0x168f17[_0xdf9f('0x10')](0x1f4,_0x508cc3[_0xdf9f('0x12')]));});});};exports[_0xdf9f('0x20')]=function(_0x259a14){var _0x5217fd=this;return new Promise(function(_0x135a54,_0x444a9a){return db['ServicenowAccount']['find']({'raw':_0x259a14[_0xdf9f('0x17')]?_0x259a14[_0xdf9f('0x17')][_0xdf9f('0x18')]===undefined?!![]:![]:!![],'where':_0x259a14['options']?_0x259a14['options']['where']||null:null,'attributes':_0x259a14[_0xdf9f('0x17')]?_0x259a14[_0xdf9f('0x17')][_0xdf9f('0x1a')]||null:null,'include':_0x259a14[_0xdf9f('0x17')]?_0x259a14[_0xdf9f('0x17')]['include']?_[_0xdf9f('0x1d')](_0x259a14[_0xdf9f('0x17')][_0xdf9f('0x1c')],function(_0xe11b12){return{'model':db[_0xe11b12['model']],'as':_0xe11b12['as'],'attributes':_0xe11b12[_0xdf9f('0x1a')],'include':_0xe11b12['include']?_[_0xdf9f('0x1d')](_0xe11b12[_0xdf9f('0x1c')],function(_0x3b803a){return{'model':db[_0x3b803a[_0xdf9f('0x1e')]],'as':_0x3b803a['as'],'attributes':_0x3b803a[_0xdf9f('0x1a')],'include':_0x3b803a[_0xdf9f('0x1c')]?_['map'](_0x3b803a[_0xdf9f('0x1c')],function(_0x432146){return{'model':db[_0x432146[_0xdf9f('0x1e')]],'as':_0x432146['as'],'attributes':_0x432146['attributes']};}):[]};}):[]};}):[]:[]})[_0xdf9f('0xb')](function(_0x4da103){logger[_0xdf9f('0xc')](_0xdf9f('0x20'),_0x259a14);logger[_0xdf9f('0x1f')](_0xdf9f('0x20'),_0x259a14,JSON[_0xdf9f('0xf')](_0x4da103));_0x135a54(_0x4da103);})[_0xdf9f('0x21')](function(_0xe09de9){logger['error']('ShowServicenowAccount',_0xe09de9[_0xdf9f('0x12')],_0x259a14);_0x444a9a(_0x5217fd[_0xdf9f('0x10')](0x1f4,_0xe09de9[_0xdf9f('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 68e4438..9f898c5 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 _0x1cfc=['delete','destroy','util','path','connect-timeout','Router','../../components/interaction/service','./intServicenowConfiguration.controller','get','/:id','show','/:id/fields','isAuthenticated','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','put','update'];(function(_0xfa17e5,_0x3fc7ed){var _0x4c8ffe=function(_0x3b82a0){while(--_0x3b82a0){_0xfa17e5['push'](_0xfa17e5['shift']());}};_0x4c8ffe(++_0x3fc7ed);}(_0x1cfc,0xde));var _0xc1cf=function(_0x58ed44,_0x194894){_0x58ed44=_0x58ed44-0x0;var _0x4b01ad=_0x1cfc[_0x58ed44];return _0x4b01ad;};'use strict';var multer=require('multer');var util=require(_0xc1cf('0x0'));var path=require(_0xc1cf('0x1'));var timeout=require(_0xc1cf('0x2'));var express=require('express');var router=express[_0xc1cf('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xc1cf('0x4'));var config=require('../../config/environment');var controller=require(_0xc1cf('0x5'));router[_0xc1cf('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0xc1cf('0x6')](_0xc1cf('0x7'),auth['isAuthenticated'](),controller[_0xc1cf('0x8')]);router['get'](_0xc1cf('0x9'),auth[_0xc1cf('0xa')](),controller[_0xc1cf('0xb')]);router[_0xc1cf('0x6')](_0xc1cf('0xc'),auth[_0xc1cf('0xa')](),controller[_0xc1cf('0xd')]);router[_0xc1cf('0x6')](_0xc1cf('0xe'),auth[_0xc1cf('0xa')](),controller[_0xc1cf('0xf')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xc1cf('0x10')](_0xc1cf('0x7'),auth['isAuthenticated'](),controller[_0xc1cf('0x11')]);router[_0xc1cf('0x12')](_0xc1cf('0x7'),auth['isAuthenticated'](),controller[_0xc1cf('0x13')]);module['exports']=router; \ No newline at end of file +var _0xd48a=['multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','create','put','update','delete','destroy'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd48a,0x138));var _0xad48=function(_0x255011,_0x33cadf){_0x255011=_0x255011-0x0;var _0x2e6b3c=_0xd48a[_0x255011];return _0x2e6b3c;};'use strict';var multer=require(_0xad48('0x0'));var util=require(_0xad48('0x1'));var path=require('path');var timeout=require(_0xad48('0x2'));var express=require(_0xad48('0x3'));var router=express[_0xad48('0x4')]();var auth=require(_0xad48('0x5'));var interaction=require(_0xad48('0x6'));var config=require(_0xad48('0x7'));var controller=require(_0xad48('0x8'));router[_0xad48('0x9')]('/',auth[_0xad48('0xa')](),controller['index']);router['get'](_0xad48('0xb'),auth['isAuthenticated'](),controller[_0xad48('0xc')]);router[_0xad48('0x9')](_0xad48('0xd'),auth[_0xad48('0xa')](),controller[_0xad48('0xe')]);router[_0xad48('0x9')](_0xad48('0xf'),auth[_0xad48('0xa')](),controller[_0xad48('0x10')]);router['get'](_0xad48('0x11'),auth[_0xad48('0xa')](),controller['getDescriptions']);router[_0xad48('0x12')]('/',auth['isAuthenticated'](),controller[_0xad48('0x13')]);router[_0xad48('0x14')](_0xad48('0xb'),auth[_0xad48('0xa')](),controller[_0xad48('0x15')]);router[_0xad48('0x16')](_0xad48('0xb'),auth[_0xad48('0xa')](),controller[_0xad48('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 44df15e..e5b9489 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 _0xe7d3=['sequelize','exports','STRING'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xe7d3,0xc3));var _0x3e7d=function(_0x41a09b,_0x3e02cb){_0x41a09b=_0x41a09b-0x0;var _0x377214=_0xe7d3[_0x41a09b];return _0x377214;};'use strict';var Sequelize=require(_0x3e7d('0x0'));module[_0x3e7d('0x1')]={'name':{'type':Sequelize[_0x3e7d('0x2')]},'description':{'type':Sequelize[_0x3e7d('0x2')]}}; \ No newline at end of file +var _0xa2fc=['sequelize','STRING'];(function(_0x50e6b4,_0x4b9170){var _0x56ab1f=function(_0x1d039e){while(--_0x1d039e){_0x50e6b4['push'](_0x50e6b4['shift']());}};_0x56ab1f(++_0x4b9170);}(_0xa2fc,0x192));var _0xca2f=function(_0x9fd887,_0x47f76c){_0x9fd887=_0x9fd887-0x0;var _0x1a54ab=_0xa2fc[_0x9fd887];return _0x1a54ab;};'use strict';var Sequelize=require(_0xca2f('0x0'));module['exports']={'name':{'type':Sequelize[_0xca2f('0x1')]},'description':{'type':Sequelize[_0xca2f('0x1')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 28c6eae..e617a63 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 _0x2547=['findOne','ServicenowField','nolimit','getSubjects','getDescriptions','hasOwnProperty','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','jayson/promise','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','sendStatus','status','end','json','count','offset','set','reject','save','update','destroy','stack','name','send','index','map','ServicenowConfiguration','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','limit','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','rows','params','find','create','body','getFields'];(function(_0x1207e8,_0x2633b6){var _0x69cf5c=function(_0x5bb40f){while(--_0x5bb40f){_0x1207e8['push'](_0x1207e8['shift']());}};_0x69cf5c(++_0x2633b6);}(_0x2547,0x1cd));var _0x7254=function(_0x53c4cc,_0x3105b7){_0x53c4cc=_0x53c4cc-0x0;var _0x7a0a71=_0x2547[_0x53c4cc];return _0x7a0a71;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x7254('0x0'));var rimraf=require(_0x7254('0x1'));var zipdir=require(_0x7254('0x2'));var jsonpatch=require(_0x7254('0x3'));var rp=require(_0x7254('0x4'));var moment=require(_0x7254('0x5'));var BPromise=require(_0x7254('0x6'));var Mustache=require(_0x7254('0x7'));var util=require('util');var path=require(_0x7254('0x8'));var sox=require(_0x7254('0x9'));var csv=require(_0x7254('0xa'));var ejs=require(_0x7254('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x7254('0xc'));var crypto=require(_0x7254('0xd'));var jsforce=require(_0x7254('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x7254('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7254('0xf'));var qs=require(_0x7254('0x10'));var as=require(_0x7254('0x11'));var hardwareService=require(_0x7254('0x12'));var logger=require(_0x7254('0x13'))(_0x7254('0x14'));var utils=require('../../config/utils');var config=require(_0x7254('0x15'));var db=require('../../mysqldb')['db'];var jayson=require(_0x7254('0x16'));var client=jayson['client'][_0x7254('0x17')]({'port':0x232a});function checkPasswordPattern(_0x2bfff8,_0x348d4e,_0x120780){if(_0x120780){var _0x15f92e=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x15f92e[_0x7254('0x18')](_0x348d4e)){return _0x2bfff8;}else{throw new db[(_0x7254('0x19'))][(_0x7254('0x1a'))](_0x7254('0x1b'));}}else{return _0x2bfff8;}}function respondWithRpcPromise(_0x362a1,_0x38a99c,_0x1ee5cb,_0x163c8c){return new BPromise(function(_0x535065,_0x265293){var _0x4395fb=_0x163c8c||client;return _0x4395fb[_0x7254('0x1c')](_0x362a1,_0x1ee5cb)[_0x7254('0x1d')](function(_0x3b5f06){logger[_0x7254('0x1e')](_0x7254('0x1f'),_0x38a99c,'request\x20sent');logger[_0x7254('0x20')](_0x7254('0x21'),_0x38a99c,_0x7254('0x22'),JSON[_0x7254('0x23')](_0x3b5f06));if(_0x3b5f06[_0x7254('0x24')]){if(_0x3b5f06[_0x7254('0x24')][_0x7254('0x25')]===0x1f4){logger[_0x7254('0x24')](_0x7254('0x1f'),_0x38a99c,_0x3b5f06[_0x7254('0x24')][_0x7254('0x26')]);return _0x265293(_0x3b5f06[_0x7254('0x24')][_0x7254('0x26')]);}logger[_0x7254('0x24')](_0x7254('0x1f'),_0x38a99c,_0x3b5f06[_0x7254('0x24')][_0x7254('0x26')]);return _0x535065(_0x3b5f06[_0x7254('0x24')][_0x7254('0x26')]);}else{logger[_0x7254('0x1e')](_0x7254('0x1f'),_0x38a99c,'request\x20sent');_0x535065(_0x3b5f06['result'][_0x7254('0x26')]);}})[_0x7254('0x27')](function(_0x1c24ea){logger[_0x7254('0x24')](_0x7254('0x1f'),_0x38a99c,_0x1c24ea);_0x265293(_0x1c24ea);});});}function respondWithStatusCode(_0x36b5d5,_0x133aee){_0x133aee=_0x133aee||0xcc;return function(_0x5d6df5){if(_0x5d6df5){return _0x36b5d5[_0x7254('0x28')](_0x133aee);}return _0x36b5d5[_0x7254('0x29')](_0x133aee)[_0x7254('0x2a')]();};}function respondWithResult(_0x494cdb,_0x3c22d0){_0x3c22d0=_0x3c22d0||0xc8;return function(_0x594a63){if(_0x594a63){return _0x494cdb[_0x7254('0x29')](_0x3c22d0)[_0x7254('0x2b')](_0x594a63);}};}function respondWithFilteredResult(_0x5702fe,_0x17bb46){return function(_0x158356){if(_0x158356){var _0x4f684c=_0x158356[_0x7254('0x2c')],_0x14cbea=_0x17bb46[_0x7254('0x2d')],_0x6c4927=_0x17bb46[_0x7254('0x2d')]+_0x17bb46['limit'],_0x37cb5c;if(_0x6c4927>=_0x4f684c){_0x6c4927=_0x4f684c;_0x37cb5c=0xc8;}else{_0x37cb5c=0xce;}_0x5702fe[_0x7254('0x29')](_0x37cb5c);return _0x5702fe[_0x7254('0x2e')]('Content-Range',_0x14cbea+'-'+_0x6c4927+'/'+_0x4f684c)[_0x7254('0x2b')](_0x158356);}return null;};}function patchUpdates(_0x1279cd){return function(_0x2be5fc){try{jsonpatch['apply'](_0x2be5fc,_0x1279cd,!![]);}catch(_0x3261fb){return BPromise[_0x7254('0x2f')](_0x3261fb);}return _0x2be5fc[_0x7254('0x30')]();};}function saveUpdates(_0x173b6b,_0x40a137){return function(_0x16bf19){if(_0x16bf19){return _0x16bf19[_0x7254('0x31')](_0x173b6b)['then'](function(_0x276db8){return _0x276db8;});}return null;};}function removeEntity(_0x5a1e41,_0x53d799){return function(_0x31471a){if(_0x31471a){return _0x31471a[_0x7254('0x32')]()[_0x7254('0x1d')](function(){_0x5a1e41[_0x7254('0x29')](0xcc)[_0x7254('0x2a')]();});}};}function handleEntityNotFound(_0x430420,_0x282206){return function(_0x147cef){if(!_0x147cef){_0x430420[_0x7254('0x28')](0x194);}return _0x147cef;};}function handleError(_0x24b629,_0x235822){_0x235822=_0x235822||0x1f4;return function(_0x3b0abd){logger[_0x7254('0x24')](_0x3b0abd[_0x7254('0x33')]);if(_0x3b0abd['name']){delete _0x3b0abd[_0x7254('0x34')];}_0x24b629[_0x7254('0x29')](_0x235822)[_0x7254('0x35')](_0x3b0abd);};}exports[_0x7254('0x36')]=function(_0x92b0e3,_0x5e100e){var _0x140bb2={},_0x5e36b0={},_0x64067b={'count':0x0,'rows':[]};var _0xb7716a=_[_0x7254('0x37')](db[_0x7254('0x38')][_0x7254('0x39')],function(_0x4e6213){return{'name':_0x4e6213[_0x7254('0x3a')],'type':_0x4e6213['type'][_0x7254('0x3b')]};});_0x5e36b0[_0x7254('0x3c')]=_['map'](_0xb7716a,_0x7254('0x34'));_0x5e36b0[_0x7254('0x3d')]=_[_0x7254('0x3e')](_0x92b0e3[_0x7254('0x3d')]);_0x5e36b0[_0x7254('0x3f')]=_[_0x7254('0x40')](_0x5e36b0['model'],_0x5e36b0[_0x7254('0x3d')]);_0x140bb2[_0x7254('0x41')]=_[_0x7254('0x40')](_0x5e36b0['model'],qs[_0x7254('0x42')](_0x92b0e3[_0x7254('0x3d')][_0x7254('0x42')]));_0x140bb2['attributes']=_0x140bb2[_0x7254('0x41')][_0x7254('0x43')]?_0x140bb2[_0x7254('0x41')]:_0x5e36b0[_0x7254('0x3c')];if(!_0x92b0e3[_0x7254('0x3d')]['hasOwnProperty']('nolimit')){_0x140bb2[_0x7254('0x44')]=qs[_0x7254('0x44')](_0x92b0e3[_0x7254('0x3d')][_0x7254('0x44')]);_0x140bb2['offset']=qs['offset'](_0x92b0e3[_0x7254('0x3d')]['offset']);}_0x140bb2[_0x7254('0x45')]=qs[_0x7254('0x46')](_0x92b0e3[_0x7254('0x3d')][_0x7254('0x46')]);_0x140bb2['where']=qs['filters'](_[_0x7254('0x47')](_0x92b0e3[_0x7254('0x3d')],_0x5e36b0[_0x7254('0x3f')]),_0xb7716a);if(_0x92b0e3[_0x7254('0x3d')][_0x7254('0x48')]){_0x140bb2['where']=_['merge'](_0x140bb2[_0x7254('0x49')],{'$or':_[_0x7254('0x37')](_0xb7716a,function(_0x10fef6){if(_0x10fef6['type']!==_0x7254('0x4a')){var _0x33604e={};_0x33604e[_0x10fef6['name']]={'$like':'%'+_0x92b0e3[_0x7254('0x3d')][_0x7254('0x48')]+'%'};return _0x33604e;}})});}_0x140bb2=_[_0x7254('0x4b')]({},_0x140bb2,_0x92b0e3[_0x7254('0x4c')]);var _0x553917={'where':_0x140bb2[_0x7254('0x49')]};return db[_0x7254('0x38')]['count'](_0x553917)[_0x7254('0x1d')](function(_0x22c7ae){_0x64067b[_0x7254('0x2c')]=_0x22c7ae;if(_0x92b0e3['query'][_0x7254('0x4d')]){_0x140bb2[_0x7254('0x4e')]=[{'all':!![]}];}return db['ServicenowConfiguration']['findAll'](_0x140bb2);})[_0x7254('0x1d')](function(_0x54c792){_0x64067b[_0x7254('0x4f')]=_0x54c792;return _0x64067b;})[_0x7254('0x1d')](respondWithFilteredResult(_0x5e100e,_0x140bb2))['catch'](handleError(_0x5e100e,null));};exports['show']=function(_0x1bc070,_0xc40bc5){var _0x38bcd5={'raw':![],'where':{'id':_0x1bc070[_0x7254('0x50')]['id']}},_0x104d98={};_0x104d98[_0x7254('0x3c')]=_['keys'](db[_0x7254('0x38')]['rawAttributes']);_0x104d98[_0x7254('0x3d')]=_[_0x7254('0x3e')](_0x1bc070[_0x7254('0x3d')]);_0x104d98['filters']=_[_0x7254('0x40')](_0x104d98[_0x7254('0x3c')],_0x104d98[_0x7254('0x3d')]);_0x38bcd5['attributes']=_[_0x7254('0x40')](_0x104d98[_0x7254('0x3c')],qs[_0x7254('0x42')](_0x1bc070[_0x7254('0x3d')][_0x7254('0x42')]));_0x38bcd5['attributes']=_0x38bcd5['attributes'][_0x7254('0x43')]?_0x38bcd5[_0x7254('0x41')]:_0x104d98[_0x7254('0x3c')];if(_0x1bc070[_0x7254('0x3d')][_0x7254('0x4d')]){_0x38bcd5['include']=[{'all':!![]}];}_0x38bcd5=_['merge']({},_0x38bcd5,_0x1bc070[_0x7254('0x4c')]);return db[_0x7254('0x38')][_0x7254('0x51')](_0x38bcd5)[_0x7254('0x1d')](handleEntityNotFound(_0xc40bc5,null))['then'](respondWithResult(_0xc40bc5,null))[_0x7254('0x27')](handleError(_0xc40bc5,null));};exports[_0x7254('0x52')]=function(_0x5d54e4,_0x460766){return db['ServicenowConfiguration'][_0x7254('0x52')](_0x5d54e4['body'],{})[_0x7254('0x1d')](respondWithResult(_0x460766,0xc9))['catch'](handleError(_0x460766,null));};exports['update']=function(_0x302ffc,_0x2ef688){if(_0x302ffc[_0x7254('0x53')]['id']){delete _0x302ffc[_0x7254('0x53')]['id'];}return db['ServicenowConfiguration'][_0x7254('0x51')]({'where':{'id':_0x302ffc['params']['id']}})[_0x7254('0x1d')](handleEntityNotFound(_0x2ef688,null))[_0x7254('0x1d')](saveUpdates(_0x302ffc[_0x7254('0x53')],null))[_0x7254('0x1d')](respondWithResult(_0x2ef688,null))[_0x7254('0x27')](handleError(_0x2ef688,null));};exports[_0x7254('0x32')]=function(_0x48b69a,_0x1ca394){return db[_0x7254('0x38')][_0x7254('0x51')]({'where':{'id':_0x48b69a[_0x7254('0x50')]['id']}})[_0x7254('0x1d')](handleEntityNotFound(_0x1ca394,null))[_0x7254('0x1d')](removeEntity(_0x1ca394,null))['catch'](handleError(_0x1ca394,null));};exports[_0x7254('0x54')]=function(_0x457f71,_0x215304,_0x2ed808){var _0x380dc0={};var _0x2396ce={};var _0xf70c29;var _0x4e5857;return db['ServicenowConfiguration'][_0x7254('0x55')]({'where':{'id':_0x457f71['params']['id']}})['then'](handleEntityNotFound(_0x215304,null))[_0x7254('0x1d')](function(_0xbddcbb){if(_0xbddcbb){_0xf70c29=_0xbddcbb;_0x2396ce[_0x7254('0x3c')]=_['keys'](db[_0x7254('0x56')]['rawAttributes']);_0x2396ce[_0x7254('0x3d')]=_[_0x7254('0x3e')](_0x457f71[_0x7254('0x3d')]);_0x2396ce[_0x7254('0x3f')]=_[_0x7254('0x40')](_0x2396ce['model'],_0x2396ce[_0x7254('0x3d')]);_0x380dc0[_0x7254('0x41')]=_[_0x7254('0x40')](_0x2396ce[_0x7254('0x3c')],qs['fields'](_0x457f71['query'][_0x7254('0x42')]));_0x380dc0[_0x7254('0x41')]=_0x380dc0[_0x7254('0x41')][_0x7254('0x43')]?_0x380dc0[_0x7254('0x41')]:_0x2396ce[_0x7254('0x3c')];_0x380dc0[_0x7254('0x45')]=qs[_0x7254('0x46')](_0x457f71[_0x7254('0x3d')][_0x7254('0x46')]);_0x380dc0[_0x7254('0x49')]=qs[_0x7254('0x3f')](_[_0x7254('0x47')](_0x457f71['query'],_0x2396ce[_0x7254('0x3f')]));if(_0x457f71[_0x7254('0x3d')][_0x7254('0x48')]){_0x380dc0['where']=_[_0x7254('0x4b')](_0x380dc0[_0x7254('0x49')],{'$or':_[_0x7254('0x37')](_0x380dc0[_0x7254('0x41')],function(_0x49f62d){var _0x1d9238={};_0x1d9238[_0x49f62d]={'$like':'%'+_0x457f71['query'][_0x7254('0x48')]+'%'};return _0x1d9238;})});}_0x380dc0=_[_0x7254('0x4b')]({},_0x380dc0,_0x457f71[_0x7254('0x4c')]);return _0xf70c29[_0x7254('0x54')](_0x380dc0);}})['then'](function(_0xc9bb71){if(_0xc9bb71){_0x4e5857=_0xc9bb71['length'];if(!_0x457f71[_0x7254('0x3d')]['hasOwnProperty'](_0x7254('0x57'))){_0x380dc0[_0x7254('0x44')]=qs[_0x7254('0x44')](_0x457f71[_0x7254('0x3d')][_0x7254('0x44')]);_0x380dc0[_0x7254('0x2d')]=qs[_0x7254('0x2d')](_0x457f71[_0x7254('0x3d')]['offset']);}return _0xf70c29[_0x7254('0x54')](_0x380dc0);}})['then'](function(_0x12c36e){if(_0x12c36e){return _0x12c36e?{'count':_0x4e5857,'rows':_0x12c36e}:null;}})[_0x7254('0x1d')](respondWithResult(_0x215304,null))[_0x7254('0x27')](handleError(_0x215304,null));};exports[_0x7254('0x58')]=function(_0x1a9970,_0x2988cf,_0xd38c4b){var _0x41e546={};var _0x599ffa={};var _0x19cc97;var _0x5324cd;return db[_0x7254('0x38')][_0x7254('0x55')]({'where':{'id':_0x1a9970[_0x7254('0x50')]['id']}})[_0x7254('0x1d')](handleEntityNotFound(_0x2988cf,null))[_0x7254('0x1d')](function(_0x28abbf){if(_0x28abbf){_0x19cc97=_0x28abbf;_0x599ffa[_0x7254('0x3c')]=_[_0x7254('0x3e')](db[_0x7254('0x56')][_0x7254('0x39')]);_0x599ffa[_0x7254('0x3d')]=_[_0x7254('0x3e')](_0x1a9970[_0x7254('0x3d')]);_0x599ffa[_0x7254('0x3f')]=_[_0x7254('0x40')](_0x599ffa[_0x7254('0x3c')],_0x599ffa[_0x7254('0x3d')]);_0x41e546['attributes']=_['intersection'](_0x599ffa[_0x7254('0x3c')],qs[_0x7254('0x42')](_0x1a9970['query']['fields']));_0x41e546['attributes']=_0x41e546[_0x7254('0x41')][_0x7254('0x43')]?_0x41e546[_0x7254('0x41')]:_0x599ffa[_0x7254('0x3c')];_0x41e546['order']=qs[_0x7254('0x46')](_0x1a9970[_0x7254('0x3d')]['sort']);_0x41e546[_0x7254('0x49')]=qs[_0x7254('0x3f')](_[_0x7254('0x47')](_0x1a9970['query'],_0x599ffa['filters']));if(_0x1a9970[_0x7254('0x3d')][_0x7254('0x48')]){_0x41e546['where']=_[_0x7254('0x4b')](_0x41e546[_0x7254('0x49')],{'$or':_[_0x7254('0x37')](_0x41e546[_0x7254('0x41')],function(_0x24fcb1){var _0x5bebeb={};_0x5bebeb[_0x24fcb1]={'$like':'%'+_0x1a9970[_0x7254('0x3d')][_0x7254('0x48')]+'%'};return _0x5bebeb;})});}_0x41e546=_[_0x7254('0x4b')]({},_0x41e546,_0x1a9970['options']);return _0x19cc97[_0x7254('0x58')](_0x41e546);}})['then'](function(_0x4870c9){if(_0x4870c9){_0x5324cd=_0x4870c9['length'];if(!_0x1a9970[_0x7254('0x3d')]['hasOwnProperty']('nolimit')){_0x41e546[_0x7254('0x44')]=qs[_0x7254('0x44')](_0x1a9970[_0x7254('0x3d')]['limit']);_0x41e546[_0x7254('0x2d')]=qs['offset'](_0x1a9970[_0x7254('0x3d')][_0x7254('0x2d')]);}return _0x19cc97['getSubjects'](_0x41e546);}})[_0x7254('0x1d')](function(_0x3fec88){if(_0x3fec88){return _0x3fec88?{'count':_0x5324cd,'rows':_0x3fec88}:null;}})[_0x7254('0x1d')](respondWithResult(_0x2988cf,null))[_0x7254('0x27')](handleError(_0x2988cf,null));};exports[_0x7254('0x59')]=function(_0x26887a,_0x34053d,_0x4f7bb2){var _0x13f3d1={};var _0x4bdda1={};var _0x4aef90;var _0x186e93;return db[_0x7254('0x38')][_0x7254('0x55')]({'where':{'id':_0x26887a[_0x7254('0x50')]['id']}})['then'](handleEntityNotFound(_0x34053d,null))[_0x7254('0x1d')](function(_0x223a4f){if(_0x223a4f){_0x4aef90=_0x223a4f;_0x4bdda1[_0x7254('0x3c')]=_[_0x7254('0x3e')](db['ServicenowField'][_0x7254('0x39')]);_0x4bdda1['query']=_['keys'](_0x26887a['query']);_0x4bdda1[_0x7254('0x3f')]=_[_0x7254('0x40')](_0x4bdda1['model'],_0x4bdda1['query']);_0x13f3d1[_0x7254('0x41')]=_['intersection'](_0x4bdda1['model'],qs['fields'](_0x26887a['query'][_0x7254('0x42')]));_0x13f3d1[_0x7254('0x41')]=_0x13f3d1['attributes']['length']?_0x13f3d1[_0x7254('0x41')]:_0x4bdda1[_0x7254('0x3c')];_0x13f3d1[_0x7254('0x45')]=qs[_0x7254('0x46')](_0x26887a[_0x7254('0x3d')]['sort']);_0x13f3d1[_0x7254('0x49')]=qs[_0x7254('0x3f')](_[_0x7254('0x47')](_0x26887a[_0x7254('0x3d')],_0x4bdda1[_0x7254('0x3f')]));if(_0x26887a[_0x7254('0x3d')][_0x7254('0x48')]){_0x13f3d1[_0x7254('0x49')]=_['merge'](_0x13f3d1['where'],{'$or':_[_0x7254('0x37')](_0x13f3d1[_0x7254('0x41')],function(_0x348f85){var _0x108db5={};_0x108db5[_0x348f85]={'$like':'%'+_0x26887a[_0x7254('0x3d')][_0x7254('0x48')]+'%'};return _0x108db5;})});}_0x13f3d1=_['merge']({},_0x13f3d1,_0x26887a[_0x7254('0x4c')]);return _0x4aef90[_0x7254('0x59')](_0x13f3d1);}})['then'](function(_0x2bb853){if(_0x2bb853){_0x186e93=_0x2bb853['length'];if(!_0x26887a['query'][_0x7254('0x5a')]('nolimit')){_0x13f3d1['limit']=qs[_0x7254('0x44')](_0x26887a[_0x7254('0x3d')]['limit']);_0x13f3d1['offset']=qs[_0x7254('0x2d')](_0x26887a['query']['offset']);}return _0x4aef90[_0x7254('0x59')](_0x13f3d1);}})[_0x7254('0x1d')](function(_0x512e52){if(_0x512e52){return _0x512e52?{'count':_0x186e93,'rows':_0x512e52}:null;}})[_0x7254('0x1d')](respondWithResult(_0x34053d,null))[_0x7254('0x27')](handleError(_0x34053d,null));}; \ No newline at end of file +var _0x9348=['to-csv','ejs','lodash','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','debug','request\x20sent','stringify','error','code','ServicenowConfiguration,\x20%s,\x20%s','message','info','result','catch','sendStatus','status','count','offset','set','json','apply','reject','save','destroy','end','name','index','map','ServicenowConfiguration','rawAttributes','type','key','query','keys','attributes','intersection','fields','model','hasOwnProperty','limit','order','sort','filters','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','length','options','find','create','body','update','getFields','findOne','nolimit','getSubjects','getDescriptions','ServicenowField','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox'];(function(_0x270891,_0xc0f01b){var _0x1faad7=function(_0x3eb1f0){while(--_0x3eb1f0){_0x270891['push'](_0x270891['shift']());}};_0x1faad7(++_0xc0f01b);}(_0x9348,0x10d));var _0x8934=function(_0x2d73ec,_0x1daaeb){_0x2d73ec=_0x2d73ec-0x0;var _0x2a4437=_0x9348[_0x2d73ec];return _0x2a4437;};'use strict';var pdf=require(_0x8934('0x0'));var emlformat=require(_0x8934('0x1'));var rimraf=require(_0x8934('0x2'));var zipdir=require(_0x8934('0x3'));var jsonpatch=require(_0x8934('0x4'));var rp=require('request-promise');var moment=require(_0x8934('0x5'));var BPromise=require(_0x8934('0x6'));var Mustache=require('mustache');var util=require(_0x8934('0x7'));var path=require(_0x8934('0x8'));var sox=require(_0x8934('0x9'));var csv=require(_0x8934('0xa'));var ejs=require(_0x8934('0xb'));var fs=require('fs');var _=require(_0x8934('0xc'));var squel=require('squel');var crypto=require(_0x8934('0xd'));var jsforce=require(_0x8934('0xe'));var deskjs=require(_0x8934('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8934('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x8934('0x11'));var hardwareService=require(_0x8934('0x12'));var logger=require(_0x8934('0x13'))(_0x8934('0x14'));var utils=require(_0x8934('0x15'));var config=require(_0x8934('0x16'));var db=require(_0x8934('0x17'))['db'];var jayson=require(_0x8934('0x18'));var client=jayson['client'][_0x8934('0x19')]({'port':0x232a});function checkPasswordPattern(_0x108eab,_0x46bca5,_0x1906d0){if(_0x1906d0){var _0xbc487e=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xbc487e[_0x8934('0x1a')](_0x46bca5)){return _0x108eab;}else{throw new db['Sequelize'][(_0x8934('0x1b'))](_0x8934('0x1c'));}}else{return _0x108eab;}}function respondWithRpcPromise(_0xdfc97c,_0x94b948,_0x34d4dc,_0x41e6a9){return new BPromise(function(_0x2a5b04,_0x357cf8){var _0x52de6a=_0x41e6a9||client;return _0x52de6a[_0x8934('0x1d')](_0xdfc97c,_0x34d4dc)[_0x8934('0x1e')](function(_0x261c78){logger['info']('ServicenowConfiguration,\x20%s,\x20%s',_0x94b948,'request\x20sent');logger[_0x8934('0x1f')]('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x94b948,_0x8934('0x20'),JSON[_0x8934('0x21')](_0x261c78));if(_0x261c78[_0x8934('0x22')]){if(_0x261c78[_0x8934('0x22')][_0x8934('0x23')]===0x1f4){logger['error'](_0x8934('0x24'),_0x94b948,_0x261c78['error'][_0x8934('0x25')]);return _0x357cf8(_0x261c78[_0x8934('0x22')][_0x8934('0x25')]);}logger[_0x8934('0x22')](_0x8934('0x24'),_0x94b948,_0x261c78[_0x8934('0x22')][_0x8934('0x25')]);return _0x2a5b04(_0x261c78['error'][_0x8934('0x25')]);}else{logger[_0x8934('0x26')](_0x8934('0x24'),_0x94b948,_0x8934('0x20'));_0x2a5b04(_0x261c78[_0x8934('0x27')]['message']);}})[_0x8934('0x28')](function(_0x1c15c5){logger[_0x8934('0x22')]('ServicenowConfiguration,\x20%s,\x20%s',_0x94b948,_0x1c15c5);_0x357cf8(_0x1c15c5);});});}function respondWithStatusCode(_0x16cfc2,_0x561df2){_0x561df2=_0x561df2||0xcc;return function(_0x14c5f0){if(_0x14c5f0){return _0x16cfc2[_0x8934('0x29')](_0x561df2);}return _0x16cfc2[_0x8934('0x2a')](_0x561df2)['end']();};}function respondWithResult(_0x1fd5eb,_0x15910b){_0x15910b=_0x15910b||0xc8;return function(_0x310454){if(_0x310454){return _0x1fd5eb[_0x8934('0x2a')](_0x15910b)['json'](_0x310454);}};}function respondWithFilteredResult(_0x3db790,_0x249031){return function(_0x358445){if(_0x358445){var _0x3d93c7=_0x358445[_0x8934('0x2b')],_0x44972b=_0x249031[_0x8934('0x2c')],_0x20d448=_0x249031[_0x8934('0x2c')]+_0x249031['limit'],_0x3f328a;if(_0x20d448>=_0x3d93c7){_0x20d448=_0x3d93c7;_0x3f328a=0xc8;}else{_0x3f328a=0xce;}_0x3db790[_0x8934('0x2a')](_0x3f328a);return _0x3db790[_0x8934('0x2d')]('Content-Range',_0x44972b+'-'+_0x20d448+'/'+_0x3d93c7)[_0x8934('0x2e')](_0x358445);}return null;};}function patchUpdates(_0x3d60f9){return function(_0x1a17b5){try{jsonpatch[_0x8934('0x2f')](_0x1a17b5,_0x3d60f9,!![]);}catch(_0x4b3cb9){return BPromise[_0x8934('0x30')](_0x4b3cb9);}return _0x1a17b5[_0x8934('0x31')]();};}function saveUpdates(_0x11844a,_0x1af54b){return function(_0x382d81){if(_0x382d81){return _0x382d81['update'](_0x11844a)[_0x8934('0x1e')](function(_0x59a6bf){return _0x59a6bf;});}return null;};}function removeEntity(_0x5559f1,_0xff95be){return function(_0x2447e6){if(_0x2447e6){return _0x2447e6[_0x8934('0x32')]()[_0x8934('0x1e')](function(){_0x5559f1['status'](0xcc)[_0x8934('0x33')]();});}};}function handleEntityNotFound(_0x22aebe,_0x380d47){return function(_0x1439ef){if(!_0x1439ef){_0x22aebe[_0x8934('0x29')](0x194);}return _0x1439ef;};}function handleError(_0x4cd282,_0x6764f8){_0x6764f8=_0x6764f8||0x1f4;return function(_0x1ea0cd){logger['error'](_0x1ea0cd['stack']);if(_0x1ea0cd[_0x8934('0x34')]){delete _0x1ea0cd[_0x8934('0x34')];}_0x4cd282['status'](_0x6764f8)['send'](_0x1ea0cd);};}exports[_0x8934('0x35')]=function(_0x177a57,_0x2f710a){var _0x207ad4={},_0x834d54={},_0x1c624f={'count':0x0,'rows':[]};var _0x30f8c6=_[_0x8934('0x36')](db[_0x8934('0x37')][_0x8934('0x38')],function(_0x46611c){return{'name':_0x46611c['fieldName'],'type':_0x46611c[_0x8934('0x39')][_0x8934('0x3a')]};});_0x834d54['model']=_[_0x8934('0x36')](_0x30f8c6,_0x8934('0x34'));_0x834d54[_0x8934('0x3b')]=_[_0x8934('0x3c')](_0x177a57[_0x8934('0x3b')]);_0x834d54['filters']=_['intersection'](_0x834d54['model'],_0x834d54[_0x8934('0x3b')]);_0x207ad4[_0x8934('0x3d')]=_[_0x8934('0x3e')](_0x834d54['model'],qs[_0x8934('0x3f')](_0x177a57['query']['fields']));_0x207ad4[_0x8934('0x3d')]=_0x207ad4[_0x8934('0x3d')]['length']?_0x207ad4['attributes']:_0x834d54[_0x8934('0x40')];if(!_0x177a57[_0x8934('0x3b')][_0x8934('0x41')]('nolimit')){_0x207ad4[_0x8934('0x42')]=qs['limit'](_0x177a57[_0x8934('0x3b')]['limit']);_0x207ad4[_0x8934('0x2c')]=qs[_0x8934('0x2c')](_0x177a57[_0x8934('0x3b')]['offset']);}_0x207ad4[_0x8934('0x43')]=qs[_0x8934('0x44')](_0x177a57[_0x8934('0x3b')][_0x8934('0x44')]);_0x207ad4['where']=qs[_0x8934('0x45')](_[_0x8934('0x46')](_0x177a57[_0x8934('0x3b')],_0x834d54[_0x8934('0x45')]),_0x30f8c6);if(_0x177a57[_0x8934('0x3b')][_0x8934('0x47')]){_0x207ad4[_0x8934('0x48')]=_[_0x8934('0x49')](_0x207ad4['where'],{'$or':_['map'](_0x30f8c6,function(_0x510152){if(_0x510152[_0x8934('0x39')]!==_0x8934('0x4a')){var _0x58206c={};_0x58206c[_0x510152[_0x8934('0x34')]]={'$like':'%'+_0x177a57['query'][_0x8934('0x47')]+'%'};return _0x58206c;}})});}_0x207ad4=_[_0x8934('0x49')]({},_0x207ad4,_0x177a57['options']);var _0x3561da={'where':_0x207ad4[_0x8934('0x48')]};return db[_0x8934('0x37')][_0x8934('0x2b')](_0x3561da)['then'](function(_0x2adb63){_0x1c624f[_0x8934('0x2b')]=_0x2adb63;if(_0x177a57['query'][_0x8934('0x4b')]){_0x207ad4[_0x8934('0x4c')]=[{'all':!![]}];}return db[_0x8934('0x37')][_0x8934('0x4d')](_0x207ad4);})[_0x8934('0x1e')](function(_0x419e30){_0x1c624f[_0x8934('0x4e')]=_0x419e30;return _0x1c624f;})[_0x8934('0x1e')](respondWithFilteredResult(_0x2f710a,_0x207ad4))[_0x8934('0x28')](handleError(_0x2f710a,null));};exports[_0x8934('0x4f')]=function(_0x1e2175,_0xe212bc){var _0x2c322d={'raw':![],'where':{'id':_0x1e2175[_0x8934('0x50')]['id']}},_0x2febf5={};_0x2febf5[_0x8934('0x40')]=_[_0x8934('0x3c')](db[_0x8934('0x37')]['rawAttributes']);_0x2febf5[_0x8934('0x3b')]=_[_0x8934('0x3c')](_0x1e2175['query']);_0x2febf5['filters']=_['intersection'](_0x2febf5['model'],_0x2febf5[_0x8934('0x3b')]);_0x2c322d[_0x8934('0x3d')]=_[_0x8934('0x3e')](_0x2febf5['model'],qs['fields'](_0x1e2175[_0x8934('0x3b')]['fields']));_0x2c322d['attributes']=_0x2c322d[_0x8934('0x3d')][_0x8934('0x51')]?_0x2c322d[_0x8934('0x3d')]:_0x2febf5[_0x8934('0x40')];if(_0x1e2175[_0x8934('0x3b')][_0x8934('0x4b')]){_0x2c322d[_0x8934('0x4c')]=[{'all':!![]}];}_0x2c322d=_['merge']({},_0x2c322d,_0x1e2175[_0x8934('0x52')]);return db['ServicenowConfiguration'][_0x8934('0x53')](_0x2c322d)[_0x8934('0x1e')](handleEntityNotFound(_0xe212bc,null))[_0x8934('0x1e')](respondWithResult(_0xe212bc,null))[_0x8934('0x28')](handleError(_0xe212bc,null));};exports[_0x8934('0x54')]=function(_0x265b0a,_0x1f6c5f){return db[_0x8934('0x37')]['create'](_0x265b0a[_0x8934('0x55')],{})[_0x8934('0x1e')](respondWithResult(_0x1f6c5f,0xc9))[_0x8934('0x28')](handleError(_0x1f6c5f,null));};exports[_0x8934('0x56')]=function(_0x2ab06d,_0x5a791a){if(_0x2ab06d[_0x8934('0x55')]['id']){delete _0x2ab06d[_0x8934('0x55')]['id'];}return db[_0x8934('0x37')]['find']({'where':{'id':_0x2ab06d[_0x8934('0x50')]['id']}})[_0x8934('0x1e')](handleEntityNotFound(_0x5a791a,null))[_0x8934('0x1e')](saveUpdates(_0x2ab06d['body'],null))['then'](respondWithResult(_0x5a791a,null))['catch'](handleError(_0x5a791a,null));};exports[_0x8934('0x32')]=function(_0x8e3e85,_0x3aab00){return db['ServicenowConfiguration'][_0x8934('0x53')]({'where':{'id':_0x8e3e85[_0x8934('0x50')]['id']}})['then'](handleEntityNotFound(_0x3aab00,null))['then'](removeEntity(_0x3aab00,null))[_0x8934('0x28')](handleError(_0x3aab00,null));};exports[_0x8934('0x57')]=function(_0x44d892,_0xb9e4ac,_0x4bcf77){var _0x4d2e41={};var _0x4ea19e={};var _0x4a9089;var _0x43933f;return db[_0x8934('0x37')][_0x8934('0x58')]({'where':{'id':_0x44d892[_0x8934('0x50')]['id']}})[_0x8934('0x1e')](handleEntityNotFound(_0xb9e4ac,null))[_0x8934('0x1e')](function(_0x5a487e){if(_0x5a487e){_0x4a9089=_0x5a487e;_0x4ea19e[_0x8934('0x40')]=_[_0x8934('0x3c')](db['ServicenowField'][_0x8934('0x38')]);_0x4ea19e['query']=_[_0x8934('0x3c')](_0x44d892['query']);_0x4ea19e[_0x8934('0x45')]=_[_0x8934('0x3e')](_0x4ea19e[_0x8934('0x40')],_0x4ea19e[_0x8934('0x3b')]);_0x4d2e41[_0x8934('0x3d')]=_[_0x8934('0x3e')](_0x4ea19e[_0x8934('0x40')],qs['fields'](_0x44d892['query'][_0x8934('0x3f')]));_0x4d2e41[_0x8934('0x3d')]=_0x4d2e41[_0x8934('0x3d')][_0x8934('0x51')]?_0x4d2e41[_0x8934('0x3d')]:_0x4ea19e[_0x8934('0x40')];_0x4d2e41[_0x8934('0x43')]=qs[_0x8934('0x44')](_0x44d892[_0x8934('0x3b')][_0x8934('0x44')]);_0x4d2e41[_0x8934('0x48')]=qs[_0x8934('0x45')](_[_0x8934('0x46')](_0x44d892[_0x8934('0x3b')],_0x4ea19e['filters']));if(_0x44d892['query'][_0x8934('0x47')]){_0x4d2e41[_0x8934('0x48')]=_[_0x8934('0x49')](_0x4d2e41[_0x8934('0x48')],{'$or':_[_0x8934('0x36')](_0x4d2e41[_0x8934('0x3d')],function(_0x2f8318){var _0x5ed8ff={};_0x5ed8ff[_0x2f8318]={'$like':'%'+_0x44d892[_0x8934('0x3b')][_0x8934('0x47')]+'%'};return _0x5ed8ff;})});}_0x4d2e41=_['merge']({},_0x4d2e41,_0x44d892[_0x8934('0x52')]);return _0x4a9089['getFields'](_0x4d2e41);}})[_0x8934('0x1e')](function(_0x301967){if(_0x301967){_0x43933f=_0x301967[_0x8934('0x51')];if(!_0x44d892['query'][_0x8934('0x41')](_0x8934('0x59'))){_0x4d2e41['limit']=qs[_0x8934('0x42')](_0x44d892['query'][_0x8934('0x42')]);_0x4d2e41['offset']=qs[_0x8934('0x2c')](_0x44d892[_0x8934('0x3b')][_0x8934('0x2c')]);}return _0x4a9089['getFields'](_0x4d2e41);}})[_0x8934('0x1e')](function(_0xfbad9){if(_0xfbad9){return _0xfbad9?{'count':_0x43933f,'rows':_0xfbad9}:null;}})[_0x8934('0x1e')](respondWithResult(_0xb9e4ac,null))[_0x8934('0x28')](handleError(_0xb9e4ac,null));};exports['getSubjects']=function(_0x378e28,_0x4af42b,_0x10f552){var _0x2571ea={};var _0x14992b={};var _0x18afaa;var _0x5880d0;return db[_0x8934('0x37')][_0x8934('0x58')]({'where':{'id':_0x378e28[_0x8934('0x50')]['id']}})['then'](handleEntityNotFound(_0x4af42b,null))[_0x8934('0x1e')](function(_0xa869e8){if(_0xa869e8){_0x18afaa=_0xa869e8;_0x14992b[_0x8934('0x40')]=_['keys'](db['ServicenowField'][_0x8934('0x38')]);_0x14992b[_0x8934('0x3b')]=_[_0x8934('0x3c')](_0x378e28[_0x8934('0x3b')]);_0x14992b[_0x8934('0x45')]=_[_0x8934('0x3e')](_0x14992b[_0x8934('0x40')],_0x14992b[_0x8934('0x3b')]);_0x2571ea[_0x8934('0x3d')]=_['intersection'](_0x14992b[_0x8934('0x40')],qs[_0x8934('0x3f')](_0x378e28[_0x8934('0x3b')][_0x8934('0x3f')]));_0x2571ea[_0x8934('0x3d')]=_0x2571ea['attributes'][_0x8934('0x51')]?_0x2571ea[_0x8934('0x3d')]:_0x14992b['model'];_0x2571ea[_0x8934('0x43')]=qs['sort'](_0x378e28['query']['sort']);_0x2571ea[_0x8934('0x48')]=qs[_0x8934('0x45')](_[_0x8934('0x46')](_0x378e28['query'],_0x14992b[_0x8934('0x45')]));if(_0x378e28[_0x8934('0x3b')]['filter']){_0x2571ea[_0x8934('0x48')]=_[_0x8934('0x49')](_0x2571ea[_0x8934('0x48')],{'$or':_[_0x8934('0x36')](_0x2571ea[_0x8934('0x3d')],function(_0x324722){var _0x293bb8={};_0x293bb8[_0x324722]={'$like':'%'+_0x378e28[_0x8934('0x3b')][_0x8934('0x47')]+'%'};return _0x293bb8;})});}_0x2571ea=_[_0x8934('0x49')]({},_0x2571ea,_0x378e28['options']);return _0x18afaa[_0x8934('0x5a')](_0x2571ea);}})[_0x8934('0x1e')](function(_0xe9991f){if(_0xe9991f){_0x5880d0=_0xe9991f[_0x8934('0x51')];if(!_0x378e28[_0x8934('0x3b')][_0x8934('0x41')](_0x8934('0x59'))){_0x2571ea['limit']=qs[_0x8934('0x42')](_0x378e28[_0x8934('0x3b')][_0x8934('0x42')]);_0x2571ea[_0x8934('0x2c')]=qs[_0x8934('0x2c')](_0x378e28[_0x8934('0x3b')][_0x8934('0x2c')]);}return _0x18afaa[_0x8934('0x5a')](_0x2571ea);}})[_0x8934('0x1e')](function(_0x52b25e){if(_0x52b25e){return _0x52b25e?{'count':_0x5880d0,'rows':_0x52b25e}:null;}})['then'](respondWithResult(_0x4af42b,null))[_0x8934('0x28')](handleError(_0x4af42b,null));};exports[_0x8934('0x5b')]=function(_0x4faab2,_0x2becdf,_0x258bac){var _0x1ff259={};var _0xba3619={};var _0x25c4ac;var _0x1894ff;return db[_0x8934('0x37')][_0x8934('0x58')]({'where':{'id':_0x4faab2[_0x8934('0x50')]['id']}})[_0x8934('0x1e')](handleEntityNotFound(_0x2becdf,null))[_0x8934('0x1e')](function(_0x556b70){if(_0x556b70){_0x25c4ac=_0x556b70;_0xba3619[_0x8934('0x40')]=_[_0x8934('0x3c')](db[_0x8934('0x5c')]['rawAttributes']);_0xba3619[_0x8934('0x3b')]=_['keys'](_0x4faab2[_0x8934('0x3b')]);_0xba3619[_0x8934('0x45')]=_[_0x8934('0x3e')](_0xba3619[_0x8934('0x40')],_0xba3619['query']);_0x1ff259['attributes']=_[_0x8934('0x3e')](_0xba3619['model'],qs[_0x8934('0x3f')](_0x4faab2[_0x8934('0x3b')][_0x8934('0x3f')]));_0x1ff259[_0x8934('0x3d')]=_0x1ff259['attributes'][_0x8934('0x51')]?_0x1ff259['attributes']:_0xba3619['model'];_0x1ff259['order']=qs['sort'](_0x4faab2[_0x8934('0x3b')][_0x8934('0x44')]);_0x1ff259[_0x8934('0x48')]=qs[_0x8934('0x45')](_[_0x8934('0x46')](_0x4faab2['query'],_0xba3619['filters']));if(_0x4faab2[_0x8934('0x3b')][_0x8934('0x47')]){_0x1ff259[_0x8934('0x48')]=_[_0x8934('0x49')](_0x1ff259[_0x8934('0x48')],{'$or':_[_0x8934('0x36')](_0x1ff259[_0x8934('0x3d')],function(_0x2839dd){var _0x261887={};_0x261887[_0x2839dd]={'$like':'%'+_0x4faab2[_0x8934('0x3b')][_0x8934('0x47')]+'%'};return _0x261887;})});}_0x1ff259=_[_0x8934('0x49')]({},_0x1ff259,_0x4faab2[_0x8934('0x52')]);return _0x25c4ac[_0x8934('0x5b')](_0x1ff259);}})[_0x8934('0x1e')](function(_0x40a47a){if(_0x40a47a){_0x1894ff=_0x40a47a['length'];if(!_0x4faab2['query'][_0x8934('0x41')](_0x8934('0x59'))){_0x1ff259['limit']=qs[_0x8934('0x42')](_0x4faab2[_0x8934('0x3b')][_0x8934('0x42')]);_0x1ff259[_0x8934('0x2c')]=qs[_0x8934('0x2c')](_0x4faab2[_0x8934('0x3b')][_0x8934('0x2c')]);}return _0x25c4ac['getDescriptions'](_0x1ff259);}})[_0x8934('0x1e')](function(_0x5aab65){if(_0x5aab65){return _0x5aab65?{'count':_0x1894ff,'rows':_0x5aab65}:null;}})[_0x8934('0x1e')](respondWithResult(_0x2becdf,null))[_0x8934('0x28')](handleError(_0x2becdf,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 954ed9f..48da286 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 _0x4c2b=['request-promise','path','./intServicenowConfiguration.attributes','exports','define','int_servicenow_configurations','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x2bf141,_0x31eac7){var _0x48277b=function(_0x9fe560){while(--_0x9fe560){_0x2bf141['push'](_0x2bf141['shift']());}};_0x48277b(++_0x31eac7);}(_0x4c2b,0xa2));var _0xb4c2=function(_0x956efd,_0x50b0fd){_0x956efd=_0x956efd-0x0;var _0x27784d=_0x4c2b[_0x956efd];return _0x27784d;};'use strict';var _=require(_0xb4c2('0x0'));var util=require(_0xb4c2('0x1'));var logger=require(_0xb4c2('0x2'))(_0xb4c2('0x3'));var moment=require(_0xb4c2('0x4'));var BPromise=require(_0xb4c2('0x5'));var rp=require(_0xb4c2('0x6'));var fs=require('fs');var path=require(_0xb4c2('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xb4c2('0x8'));module[_0xb4c2('0x9')]=function(_0x114cc7,_0x5f4f57){return _0x114cc7[_0xb4c2('0xa')]('ServicenowConfiguration',attributes,{'tableName':_0xb4c2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x23e1=['ServicenowConfiguration','int_servicenow_configurations','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intServicenowConfiguration.attributes','exports'];(function(_0x4fe62a,_0x9bf04c){var _0x2beffb=function(_0x1ee012){while(--_0x1ee012){_0x4fe62a['push'](_0x4fe62a['shift']());}};_0x2beffb(++_0x9bf04c);}(_0x23e1,0x19a));var _0x123e=function(_0x13f7af,_0x4ca557){_0x13f7af=_0x13f7af-0x0;var _0x590357=_0x23e1[_0x13f7af];return _0x590357;};'use strict';var _=require(_0x123e('0x0'));var util=require('util');var logger=require(_0x123e('0x1'))(_0x123e('0x2'));var moment=require(_0x123e('0x3'));var BPromise=require(_0x123e('0x4'));var rp=require(_0x123e('0x5'));var fs=require('fs');var path=require(_0x123e('0x6'));var rimraf=require(_0x123e('0x7'));var config=require('../../config/environment');var attributes=require(_0x123e('0x8'));module[_0x123e('0x9')]=function(_0xaea588,_0x26ac75){return _0xaea588['define'](_0x123e('0xa'),attributes,{'tableName':_0x123e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js index fb74854..2b639a6 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 _0x10e9=['code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','ServicenowConfiguration,\x20%s,\x20%s','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x576170,_0x1712ae){var _0x397c70=function(_0x2eb9de){while(--_0x2eb9de){_0x576170['push'](_0x576170['shift']());}};_0x397c70(++_0x1712ae);}(_0x10e9,0x124));var _0x910e=function(_0x5694cd,_0x2fefe4){_0x5694cd=_0x5694cd-0x0;var _0x5235d6=_0x10e9[_0x5694cd];return _0x5235d6;};'use strict';var _=require(_0x910e('0x0'));var util=require(_0x910e('0x1'));var moment=require(_0x910e('0x2'));var BPromise=require('bluebird');var rs=require(_0x910e('0x3'));var fs=require('fs');var Redis=require(_0x910e('0x4'));var db=require(_0x910e('0x5'))['db'];var utils=require(_0x910e('0x6'));var logger=require('../../config/logger')(_0x910e('0x7'));var config=require(_0x910e('0x8'));var jayson=require(_0x910e('0x9'));var client=jayson[_0x910e('0xa')][_0x910e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x21de42,_0x56f3f6,_0x324827){return new BPromise(function(_0xca5b1f,_0x219fc9){return client[_0x910e('0xc')](_0x21de42,_0x324827)['then'](function(_0x1f1a1e){logger[_0x910e('0xd')](_0x910e('0xe'),_0x56f3f6,'request\x20sent');logger[_0x910e('0xf')](_0x910e('0x10'),_0x56f3f6,_0x910e('0x11'),JSON[_0x910e('0x12')](_0x1f1a1e));if(_0x1f1a1e[_0x910e('0x13')]){if(_0x1f1a1e['error'][_0x910e('0x14')]===0x1f4){logger['error'](_0x910e('0xe'),_0x56f3f6,_0x1f1a1e['error']['message']);return _0x219fc9(_0x1f1a1e[_0x910e('0x13')]['message']);}logger[_0x910e('0x13')](_0x910e('0xe'),_0x56f3f6,_0x1f1a1e['error'][_0x910e('0x15')]);return _0xca5b1f(_0x1f1a1e[_0x910e('0x13')][_0x910e('0x15')]);}else{logger['info'](_0x910e('0xe'),_0x56f3f6,_0x910e('0x11'));_0xca5b1f(_0x1f1a1e[_0x910e('0x16')][_0x910e('0x15')]);}})[_0x910e('0x17')](function(_0x48398e){logger[_0x910e('0x13')]('ServicenowConfiguration,\x20%s,\x20%s',_0x56f3f6,_0x48398e);_0x219fc9(_0x48398e);});});} \ No newline at end of file +var _0xb016=['error','message','result','bluebird','ioredis','../../config/logger','rpc','jayson/promise','client','http','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x50e640,_0x5aa83a){var _0x5a6e12=function(_0x4467d2){while(--_0x4467d2){_0x50e640['push'](_0x50e640['shift']());}};_0x5a6e12(++_0x5aa83a);}(_0xb016,0x7a));var _0x6b01=function(_0x26de64,_0x187dca){_0x26de64=_0x26de64-0x0;var _0x1719a1=_0xb016[_0x26de64];return _0x1719a1;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x6b01('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6b01('0x1'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6b01('0x2'))(_0x6b01('0x3'));var config=require('../../config/environment');var jayson=require(_0x6b01('0x4'));var client=jayson[_0x6b01('0x5')][_0x6b01('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x4e0698,_0x20bd04,_0x55440d){return new BPromise(function(_0x40f396,_0x8d6819){return client[_0x6b01('0x7')](_0x4e0698,_0x55440d)[_0x6b01('0x8')](function(_0x476690){logger[_0x6b01('0x9')](_0x6b01('0xa'),_0x20bd04,_0x6b01('0xb'));logger[_0x6b01('0xc')](_0x6b01('0xd'),_0x20bd04,'request\x20sent',JSON['stringify'](_0x476690));if(_0x476690[_0x6b01('0xe')]){if(_0x476690[_0x6b01('0xe')]['code']===0x1f4){logger[_0x6b01('0xe')](_0x6b01('0xa'),_0x20bd04,_0x476690[_0x6b01('0xe')][_0x6b01('0xf')]);return _0x8d6819(_0x476690[_0x6b01('0xe')]['message']);}logger['error']('ServicenowConfiguration,\x20%s,\x20%s',_0x20bd04,_0x476690[_0x6b01('0xe')][_0x6b01('0xf')]);return _0x40f396(_0x476690['error'][_0x6b01('0xf')]);}else{logger[_0x6b01('0x9')]('ServicenowConfiguration,\x20%s,\x20%s',_0x20bd04,_0x6b01('0xb'));_0x40f396(_0x476690[_0x6b01('0x10')][_0x6b01('0xf')]);}})['catch'](function(_0x35d954){logger[_0x6b01('0xe')](_0x6b01('0xa'),_0x20bd04,_0x35d954);_0x8d6819(_0x35d954);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 2309a94..3ebed9c 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 _0x5333=['put','update','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','get','isAuthenticated','index','/:id','show','post'];(function(_0x46431b,_0x282da4){var _0x2b45aa=function(_0x23be0a){while(--_0x23be0a){_0x46431b['push'](_0x46431b['shift']());}};_0x2b45aa(++_0x282da4);}(_0x5333,0x103));var _0x3533=function(_0x120c53,_0x5e4614){_0x120c53=_0x120c53-0x0;var _0x25a012=_0x5333[_0x120c53];return _0x25a012;};'use strict';var multer=require(_0x3533('0x0'));var util=require(_0x3533('0x1'));var path=require(_0x3533('0x2'));var timeout=require(_0x3533('0x3'));var express=require(_0x3533('0x4'));var router=express[_0x3533('0x5')]();var auth=require(_0x3533('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intServicenowField.controller');router[_0x3533('0x7')]('/',auth[_0x3533('0x8')](),controller[_0x3533('0x9')]);router[_0x3533('0x7')](_0x3533('0xa'),auth[_0x3533('0x8')](),controller[_0x3533('0xb')]);router[_0x3533('0xc')]('/',auth[_0x3533('0x8')](),controller['create']);router[_0x3533('0xd')](_0x3533('0xa'),auth[_0x3533('0x8')](),controller[_0x3533('0xe')]);router['delete'](_0x3533('0xa'),auth[_0x3533('0x8')](),controller[_0x3533('0xf')]);module['exports']=router; \ No newline at end of file +var _0x1286=['/:id','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','show','post','create','put'];(function(_0xa89d9c,_0x375f83){var _0x2cfe5e=function(_0x29fe06){while(--_0x29fe06){_0xa89d9c['push'](_0xa89d9c['shift']());}};_0x2cfe5e(++_0x375f83);}(_0x1286,0xfc));var _0x6128=function(_0x65c903,_0x41e920){_0x65c903=_0x65c903-0x0;var _0x23e1d7=_0x1286[_0x65c903];return _0x23e1d7;};'use strict';var multer=require(_0x6128('0x0'));var util=require('util');var path=require(_0x6128('0x1'));var timeout=require(_0x6128('0x2'));var express=require(_0x6128('0x3'));var router=express[_0x6128('0x4')]();var auth=require(_0x6128('0x5'));var interaction=require(_0x6128('0x6'));var config=require('../../config/environment');var controller=require('./intServicenowField.controller');router[_0x6128('0x7')]('/',auth[_0x6128('0x8')](),controller[_0x6128('0x9')]);router[_0x6128('0x7')]('/:id',auth[_0x6128('0x8')](),controller[_0x6128('0xa')]);router[_0x6128('0xb')]('/',auth[_0x6128('0x8')](),controller[_0x6128('0xc')]);router[_0x6128('0xd')](_0x6128('0xe'),auth[_0x6128('0x8')](),controller[_0x6128('0xf')]);router[_0x6128('0x10')](_0x6128('0xe'),auth[_0x6128('0x8')](),controller[_0x6128('0x11')]);module[_0x6128('0x12')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 49a6d7b..cf11303 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 _0xa4c3=['variable','keyValue','STRING','customVariable','sequelize','exports','ENUM','string'];(function(_0x1879d0,_0x381236){var _0x3060ae=function(_0xd3597a){while(--_0xd3597a){_0x1879d0['push'](_0x1879d0['shift']());}};_0x3060ae(++_0x381236);}(_0xa4c3,0xb4));var _0x3a4c=function(_0x19e25a,_0x2f62b8){_0x19e25a=_0x19e25a-0x0;var _0x1b5294=_0xa4c3[_0x19e25a];return _0x1b5294;};'use strict';var Sequelize=require(_0x3a4c('0x0'));module[_0x3a4c('0x1')]={'type':{'type':Sequelize[_0x3a4c('0x2')](_0x3a4c('0x3'),_0x3a4c('0x4'),'customVariable',_0x3a4c('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x3a4c('0x6')]},'key':{'type':Sequelize[_0x3a4c('0x6')]},'keyType':{'type':Sequelize[_0x3a4c('0x2')]('string','variable',_0x3a4c('0x7'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x3a4c('0x6')]}}; \ No newline at end of file +var _0x8bd1=['string','variable','customVariable','STRING','BOOLEAN','sequelize','ENUM'];(function(_0x26d386,_0x1660c0){var _0x4ef9a8=function(_0x55e2d3){while(--_0x55e2d3){_0x26d386['push'](_0x26d386['shift']());}};_0x4ef9a8(++_0x1660c0);}(_0x8bd1,0x1da));var _0x18bd=function(_0x5d5c57,_0x9f28d5){_0x5d5c57=_0x5d5c57-0x0;var _0xe437b=_0x8bd1[_0x5d5c57];return _0xe437b;};'use strict';var Sequelize=require(_0x18bd('0x0'));module['exports']={'type':{'type':Sequelize[_0x18bd('0x1')](_0x18bd('0x2'),_0x18bd('0x3'),_0x18bd('0x4'),'keyValue'),'defaultValue':_0x18bd('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x18bd('0x5')]},'keyType':{'type':Sequelize[_0x18bd('0x1')](_0x18bd('0x2'),_0x18bd('0x3'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x18bd('0x5')]},'nameField':{'type':Sequelize[_0x18bd('0x5')]},'customField':{'type':Sequelize[_0x18bd('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 33ac903..68ddf2e 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 _0xa9e0=['sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','catch','params','includeAll','create','body','find','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','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','index','map','ServicenowField','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit'];(function(_0xb9e7e,_0x40a9fc){var _0xc6f5d6=function(_0x4b3429){while(--_0x4b3429){_0xb9e7e['push'](_0xb9e7e['shift']());}};_0xc6f5d6(++_0x40a9fc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0xa9e0[_0x4e1d03];return _0x362d4b;};'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 db=require(_0x0a9e('0x13'))['db'];function respondWithStatusCode(_0x36471c,_0xd5b662){_0xd5b662=_0xd5b662||0xcc;return function(_0x26d672){if(_0x26d672){return _0x36471c[_0x0a9e('0x14')](_0xd5b662);}return _0x36471c[_0x0a9e('0x15')](_0xd5b662)['end']();};}function respondWithResult(_0x4283ce,_0x239b12){_0x239b12=_0x239b12||0xc8;return function(_0x2b4227){if(_0x2b4227){return _0x4283ce[_0x0a9e('0x15')](_0x239b12)[_0x0a9e('0x16')](_0x2b4227);}};}function respondWithFilteredResult(_0x4d5611,_0x52a03d){return function(_0x22dccb){if(_0x22dccb){var _0x5d0880=_0x22dccb[_0x0a9e('0x17')],_0x1985b6=_0x52a03d['offset'],_0x519dfd=_0x52a03d[_0x0a9e('0x18')]+_0x52a03d['limit'],_0x16033c;if(_0x519dfd>=_0x5d0880){_0x519dfd=_0x5d0880;_0x16033c=0xc8;}else{_0x16033c=0xce;}_0x4d5611[_0x0a9e('0x15')](_0x16033c);return _0x4d5611[_0x0a9e('0x19')](_0x0a9e('0x1a'),_0x1985b6+'-'+_0x519dfd+'/'+_0x5d0880)[_0x0a9e('0x16')](_0x22dccb);}return null;};}function patchUpdates(_0x31b1ca){return function(_0x2eb11f){try{jsonpatch[_0x0a9e('0x1b')](_0x2eb11f,_0x31b1ca,!![]);}catch(_0x20559e){return BPromise[_0x0a9e('0x1c')](_0x20559e);}return _0x2eb11f[_0x0a9e('0x1d')]();};}function saveUpdates(_0x1c696a,_0x105080){return function(_0x4bb1e3){if(_0x4bb1e3){return _0x4bb1e3[_0x0a9e('0x1e')](_0x1c696a)[_0x0a9e('0x1f')](function(_0x53682f){return _0x53682f;});}return null;};}function removeEntity(_0x20f109,_0x5a09ef){return function(_0x588269){if(_0x588269){return _0x588269[_0x0a9e('0x20')]()[_0x0a9e('0x1f')](function(){_0x20f109[_0x0a9e('0x15')](0xcc)[_0x0a9e('0x21')]();});}};}function handleEntityNotFound(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(!_0x2fb0e4){_0x4abc77[_0x0a9e('0x14')](0x194);}return _0x2fb0e4;};}function handleError(_0x4d00e6,_0x370d86){_0x370d86=_0x370d86||0x1f4;return function(_0x42ac8f){logger[_0x0a9e('0x22')](_0x42ac8f['stack']);if(_0x42ac8f['name']){delete _0x42ac8f[_0x0a9e('0x23')];}_0x4d00e6[_0x0a9e('0x15')](_0x370d86)[_0x0a9e('0x24')](_0x42ac8f);};}exports[_0x0a9e('0x25')]=function(_0x526cf3,_0x384319){var _0x479bc4={},_0x45a1e7={},_0x5bfb33={'count':0x0,'rows':[]};var _0x1dc186=_[_0x0a9e('0x26')](db[_0x0a9e('0x27')][_0x0a9e('0x28')],function(_0x140511){return{'name':_0x140511[_0x0a9e('0x29')],'type':_0x140511[_0x0a9e('0x2a')][_0x0a9e('0x2b')]};});_0x45a1e7['model']=_[_0x0a9e('0x26')](_0x1dc186,_0x0a9e('0x23'));_0x45a1e7[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x526cf3['query']);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],_0x45a1e7[_0x0a9e('0x2c')]);_0x479bc4[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],qs[_0x0a9e('0x32')](_0x526cf3[_0x0a9e('0x2c')]['fields']));_0x479bc4[_0x0a9e('0x31')]=_0x479bc4['attributes'][_0x0a9e('0x33')]?_0x479bc4[_0x0a9e('0x31')]:_0x45a1e7[_0x0a9e('0x30')];if(!_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x34')]('nolimit')){_0x479bc4[_0x0a9e('0x35')]=qs[_0x0a9e('0x35')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x35')]);_0x479bc4[_0x0a9e('0x18')]=qs[_0x0a9e('0x18')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x18')]);}_0x479bc4['order']=qs[_0x0a9e('0x36')](_0x526cf3['query'][_0x0a9e('0x36')]);_0x479bc4[_0x0a9e('0x37')]=qs[_0x0a9e('0x2e')](_[_0x0a9e('0x38')](_0x526cf3['query'],_0x45a1e7[_0x0a9e('0x2e')]),_0x1dc186);if(_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x39')]){_0x479bc4[_0x0a9e('0x37')]=_['merge'](_0x479bc4['where'],{'$or':_[_0x0a9e('0x26')](_0x1dc186,function(_0x5640eb){if(_0x5640eb[_0x0a9e('0x2a')]!==_0x0a9e('0x3a')){var _0x381c37={};_0x381c37[_0x5640eb[_0x0a9e('0x23')]]={'$like':'%'+_0x526cf3['query'][_0x0a9e('0x39')]+'%'};return _0x381c37;}})});}_0x479bc4=_[_0x0a9e('0x3b')]({},_0x479bc4,_0x526cf3[_0x0a9e('0x3c')]);var _0x533942={'where':_0x479bc4[_0x0a9e('0x37')]};return db[_0x0a9e('0x27')][_0x0a9e('0x17')](_0x533942)['then'](function(_0x546ef8){_0x5bfb33[_0x0a9e('0x17')]=_0x546ef8;if(_0x526cf3[_0x0a9e('0x2c')]['includeAll']){_0x479bc4[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x27')][_0x0a9e('0x3e')](_0x479bc4);})[_0x0a9e('0x1f')](function(_0x4b38d9){_0x5bfb33['rows']=_0x4b38d9;return _0x5bfb33;})[_0x0a9e('0x1f')](respondWithFilteredResult(_0x384319,_0x479bc4))[_0x0a9e('0x3f')](handleError(_0x384319,null));};exports['show']=function(_0x183991,_0x1dec2e){var _0x1459bb={'raw':!![],'where':{'id':_0x183991[_0x0a9e('0x40')]['id']}},_0x5b4f5e={};_0x5b4f5e[_0x0a9e('0x30')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x27')][_0x0a9e('0x28')]);_0x5b4f5e[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x183991[_0x0a9e('0x2c')]);_0x5b4f5e[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],_0x5b4f5e[_0x0a9e('0x2c')]);_0x1459bb[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],qs['fields'](_0x183991['query'][_0x0a9e('0x32')]));_0x1459bb[_0x0a9e('0x31')]=_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x33')]?_0x1459bb[_0x0a9e('0x31')]:_0x5b4f5e[_0x0a9e('0x30')];if(_0x183991[_0x0a9e('0x2c')][_0x0a9e('0x41')]){_0x1459bb[_0x0a9e('0x3d')]=[{'all':!![]}];}_0x1459bb=_[_0x0a9e('0x3b')]({},_0x1459bb,_0x183991[_0x0a9e('0x3c')]);return db[_0x0a9e('0x27')]['find'](_0x1459bb)[_0x0a9e('0x1f')](handleEntityNotFound(_0x1dec2e,null))[_0x0a9e('0x1f')](respondWithResult(_0x1dec2e,null))[_0x0a9e('0x3f')](handleError(_0x1dec2e,null));};exports[_0x0a9e('0x42')]=function(_0x2e8caf,_0xbe9d19){return db[_0x0a9e('0x27')][_0x0a9e('0x42')](_0x2e8caf['body'],{})[_0x0a9e('0x1f')](respondWithResult(_0xbe9d19,0xc9))['catch'](handleError(_0xbe9d19,null));};exports[_0x0a9e('0x1e')]=function(_0x476688,_0x8d6dd1){if(_0x476688['body']['id']){delete _0x476688[_0x0a9e('0x43')]['id'];}return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x476688[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x8d6dd1,null))[_0x0a9e('0x1f')](saveUpdates(_0x476688[_0x0a9e('0x43')],null))['then'](respondWithResult(_0x8d6dd1,null))[_0x0a9e('0x3f')](handleError(_0x8d6dd1,null));};exports[_0x0a9e('0x20')]=function(_0x1b5e80,_0x16f976){return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x1b5e80[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x16f976,null))[_0x0a9e('0x1f')](removeEntity(_0x16f976,null))['catch'](handleError(_0x16f976,null));}; \ No newline at end of file +var _0xa9e0=['sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','catch','params','includeAll','create','body','find','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','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','index','map','ServicenowField','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit'];(function(_0xdb77b9,_0x472ad7){var _0x4ea885=function(_0xa0fd72){while(--_0xa0fd72){_0xdb77b9['push'](_0xdb77b9['shift']());}};_0x4ea885(++_0x472ad7);}(_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 db=require(_0x0a9e('0x13'))['db'];function respondWithStatusCode(_0x36471c,_0xd5b662){_0xd5b662=_0xd5b662||0xcc;return function(_0x26d672){if(_0x26d672){return _0x36471c[_0x0a9e('0x14')](_0xd5b662);}return _0x36471c[_0x0a9e('0x15')](_0xd5b662)['end']();};}function respondWithResult(_0x4283ce,_0x239b12){_0x239b12=_0x239b12||0xc8;return function(_0x2b4227){if(_0x2b4227){return _0x4283ce[_0x0a9e('0x15')](_0x239b12)[_0x0a9e('0x16')](_0x2b4227);}};}function respondWithFilteredResult(_0x4d5611,_0x52a03d){return function(_0x22dccb){if(_0x22dccb){var _0x5d0880=_0x22dccb[_0x0a9e('0x17')],_0x1985b6=_0x52a03d['offset'],_0x519dfd=_0x52a03d[_0x0a9e('0x18')]+_0x52a03d['limit'],_0x16033c;if(_0x519dfd>=_0x5d0880){_0x519dfd=_0x5d0880;_0x16033c=0xc8;}else{_0x16033c=0xce;}_0x4d5611[_0x0a9e('0x15')](_0x16033c);return _0x4d5611[_0x0a9e('0x19')](_0x0a9e('0x1a'),_0x1985b6+'-'+_0x519dfd+'/'+_0x5d0880)[_0x0a9e('0x16')](_0x22dccb);}return null;};}function patchUpdates(_0x31b1ca){return function(_0x2eb11f){try{jsonpatch[_0x0a9e('0x1b')](_0x2eb11f,_0x31b1ca,!![]);}catch(_0x20559e){return BPromise[_0x0a9e('0x1c')](_0x20559e);}return _0x2eb11f[_0x0a9e('0x1d')]();};}function saveUpdates(_0x1c696a,_0x105080){return function(_0x4bb1e3){if(_0x4bb1e3){return _0x4bb1e3[_0x0a9e('0x1e')](_0x1c696a)[_0x0a9e('0x1f')](function(_0x53682f){return _0x53682f;});}return null;};}function removeEntity(_0x20f109,_0x5a09ef){return function(_0x588269){if(_0x588269){return _0x588269[_0x0a9e('0x20')]()[_0x0a9e('0x1f')](function(){_0x20f109[_0x0a9e('0x15')](0xcc)[_0x0a9e('0x21')]();});}};}function handleEntityNotFound(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(!_0x2fb0e4){_0x4abc77[_0x0a9e('0x14')](0x194);}return _0x2fb0e4;};}function handleError(_0x4d00e6,_0x370d86){_0x370d86=_0x370d86||0x1f4;return function(_0x42ac8f){logger[_0x0a9e('0x22')](_0x42ac8f['stack']);if(_0x42ac8f['name']){delete _0x42ac8f[_0x0a9e('0x23')];}_0x4d00e6[_0x0a9e('0x15')](_0x370d86)[_0x0a9e('0x24')](_0x42ac8f);};}exports[_0x0a9e('0x25')]=function(_0x526cf3,_0x384319){var _0x479bc4={},_0x45a1e7={},_0x5bfb33={'count':0x0,'rows':[]};var _0x1dc186=_[_0x0a9e('0x26')](db[_0x0a9e('0x27')][_0x0a9e('0x28')],function(_0x140511){return{'name':_0x140511[_0x0a9e('0x29')],'type':_0x140511[_0x0a9e('0x2a')][_0x0a9e('0x2b')]};});_0x45a1e7['model']=_[_0x0a9e('0x26')](_0x1dc186,_0x0a9e('0x23'));_0x45a1e7[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x526cf3['query']);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],_0x45a1e7[_0x0a9e('0x2c')]);_0x479bc4[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],qs[_0x0a9e('0x32')](_0x526cf3[_0x0a9e('0x2c')]['fields']));_0x479bc4[_0x0a9e('0x31')]=_0x479bc4['attributes'][_0x0a9e('0x33')]?_0x479bc4[_0x0a9e('0x31')]:_0x45a1e7[_0x0a9e('0x30')];if(!_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x34')]('nolimit')){_0x479bc4[_0x0a9e('0x35')]=qs[_0x0a9e('0x35')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x35')]);_0x479bc4[_0x0a9e('0x18')]=qs[_0x0a9e('0x18')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x18')]);}_0x479bc4['order']=qs[_0x0a9e('0x36')](_0x526cf3['query'][_0x0a9e('0x36')]);_0x479bc4[_0x0a9e('0x37')]=qs[_0x0a9e('0x2e')](_[_0x0a9e('0x38')](_0x526cf3['query'],_0x45a1e7[_0x0a9e('0x2e')]),_0x1dc186);if(_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x39')]){_0x479bc4[_0x0a9e('0x37')]=_['merge'](_0x479bc4['where'],{'$or':_[_0x0a9e('0x26')](_0x1dc186,function(_0x5640eb){if(_0x5640eb[_0x0a9e('0x2a')]!==_0x0a9e('0x3a')){var _0x381c37={};_0x381c37[_0x5640eb[_0x0a9e('0x23')]]={'$like':'%'+_0x526cf3['query'][_0x0a9e('0x39')]+'%'};return _0x381c37;}})});}_0x479bc4=_[_0x0a9e('0x3b')]({},_0x479bc4,_0x526cf3[_0x0a9e('0x3c')]);var _0x533942={'where':_0x479bc4[_0x0a9e('0x37')]};return db[_0x0a9e('0x27')][_0x0a9e('0x17')](_0x533942)['then'](function(_0x546ef8){_0x5bfb33[_0x0a9e('0x17')]=_0x546ef8;if(_0x526cf3[_0x0a9e('0x2c')]['includeAll']){_0x479bc4[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x27')][_0x0a9e('0x3e')](_0x479bc4);})[_0x0a9e('0x1f')](function(_0x4b38d9){_0x5bfb33['rows']=_0x4b38d9;return _0x5bfb33;})[_0x0a9e('0x1f')](respondWithFilteredResult(_0x384319,_0x479bc4))[_0x0a9e('0x3f')](handleError(_0x384319,null));};exports['show']=function(_0x183991,_0x1dec2e){var _0x1459bb={'raw':!![],'where':{'id':_0x183991[_0x0a9e('0x40')]['id']}},_0x5b4f5e={};_0x5b4f5e[_0x0a9e('0x30')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x27')][_0x0a9e('0x28')]);_0x5b4f5e[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x183991[_0x0a9e('0x2c')]);_0x5b4f5e[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],_0x5b4f5e[_0x0a9e('0x2c')]);_0x1459bb[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],qs['fields'](_0x183991['query'][_0x0a9e('0x32')]));_0x1459bb[_0x0a9e('0x31')]=_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x33')]?_0x1459bb[_0x0a9e('0x31')]:_0x5b4f5e[_0x0a9e('0x30')];if(_0x183991[_0x0a9e('0x2c')][_0x0a9e('0x41')]){_0x1459bb[_0x0a9e('0x3d')]=[{'all':!![]}];}_0x1459bb=_[_0x0a9e('0x3b')]({},_0x1459bb,_0x183991[_0x0a9e('0x3c')]);return db[_0x0a9e('0x27')]['find'](_0x1459bb)[_0x0a9e('0x1f')](handleEntityNotFound(_0x1dec2e,null))[_0x0a9e('0x1f')](respondWithResult(_0x1dec2e,null))[_0x0a9e('0x3f')](handleError(_0x1dec2e,null));};exports[_0x0a9e('0x42')]=function(_0x2e8caf,_0xbe9d19){return db[_0x0a9e('0x27')][_0x0a9e('0x42')](_0x2e8caf['body'],{})[_0x0a9e('0x1f')](respondWithResult(_0xbe9d19,0xc9))['catch'](handleError(_0xbe9d19,null));};exports[_0x0a9e('0x1e')]=function(_0x476688,_0x8d6dd1){if(_0x476688['body']['id']){delete _0x476688[_0x0a9e('0x43')]['id'];}return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x476688[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x8d6dd1,null))[_0x0a9e('0x1f')](saveUpdates(_0x476688[_0x0a9e('0x43')],null))['then'](respondWithResult(_0x8d6dd1,null))[_0x0a9e('0x3f')](handleError(_0x8d6dd1,null));};exports[_0x0a9e('0x20')]=function(_0x1b5e80,_0x16f976){return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x1b5e80[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x16f976,null))[_0x0a9e('0x1f')](removeEntity(_0x16f976,null))['catch'](handleError(_0x16f976,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index bcdec45..18a4902 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 _0xb1ed=['rimraf','../../config/environment','./intServicenowField.attributes','exports','ServicenowField','int_servicenow_fields','servicenow_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x346d45,_0x6db175){var _0x548330=function(_0x41e453){while(--_0x41e453){_0x346d45['push'](_0x346d45['shift']());}};_0x548330(++_0x6db175);}(_0xb1ed,0x169));var _0xdb1e=function(_0x2408cc,_0x394561){_0x2408cc=_0x2408cc-0x0;var _0x22174d=_0xb1ed[_0x2408cc];return _0x22174d;};'use strict';var _=require(_0xdb1e('0x0'));var util=require(_0xdb1e('0x1'));var logger=require(_0xdb1e('0x2'))(_0xdb1e('0x3'));var moment=require(_0xdb1e('0x4'));var BPromise=require(_0xdb1e('0x5'));var rp=require(_0xdb1e('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdb1e('0x7'));var config=require(_0xdb1e('0x8'));var attributes=require(_0xdb1e('0x9'));module[_0xdb1e('0xa')]=function(_0x16e8c2,_0x4850ff){return _0x16e8c2['define'](_0xdb1e('0xb'),attributes,{'tableName':_0xdb1e('0xc'),'paranoid':![],'indexes':[{'name':_0xdb1e('0xd'),'fields':[_0xdb1e('0xe'),_0xdb1e('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa98b=['path','../../config/environment','define','int_servicenow_fields','servicenow_unique_index','idField','FieldId','lodash','util','../../config/logger','moment','bluebird'];(function(_0x504f05,_0x33c9e1){var _0xd9fec8=function(_0x5846aa){while(--_0x5846aa){_0x504f05['push'](_0x504f05['shift']());}};_0xd9fec8(++_0x33c9e1);}(_0xa98b,0x73));var _0xba98=function(_0x19f430,_0x1bc73a){_0x19f430=_0x19f430-0x0;var _0xcd262c=_0xa98b[_0x19f430];return _0xcd262c;};'use strict';var _=require(_0xba98('0x0'));var util=require(_0xba98('0x1'));var logger=require(_0xba98('0x2'))('api');var moment=require(_0xba98('0x3'));var BPromise=require(_0xba98('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xba98('0x5'));var rimraf=require('rimraf');var config=require(_0xba98('0x6'));var attributes=require('./intServicenowField.attributes');module['exports']=function(_0x2db59c,_0xf1f5e3){return _0x2db59c[_0xba98('0x7')]('ServicenowField',attributes,{'tableName':_0xba98('0x8'),'paranoid':![],'indexes':[{'name':_0xba98('0x9'),'fields':[_0xba98('0xa'),_0xba98('0xb')],'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 d736063..0ce2bae 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 _0x8198=['error','message','ServicenowField,\x20%s,\x20%s','bluebird','randomstring','ioredis','rpc','jayson/promise','client','http','request','info','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s'];(function(_0x36a79c,_0x478fdd){var _0x7b198d=function(_0x5c952c){while(--_0x5c952c){_0x36a79c['push'](_0x36a79c['shift']());}};_0x7b198d(++_0x478fdd);}(_0x8198,0x198));var _0x8819=function(_0x3817a9,_0x29e215){_0x3817a9=_0x3817a9-0x0;var _0x443f30=_0x8198[_0x3817a9];return _0x443f30;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x8819('0x0'));var rs=require(_0x8819('0x1'));var fs=require('fs');var Redis=require(_0x8819('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x8819('0x3'));var config=require('../../config/environment');var jayson=require(_0x8819('0x4'));var client=jayson[_0x8819('0x5')][_0x8819('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x1e8992,_0x3edb83,_0x106280){return new BPromise(function(_0x1d15c1,_0x18ae9e){return client[_0x8819('0x7')](_0x1e8992,_0x106280)['then'](function(_0x353876){logger[_0x8819('0x8')]('ServicenowField,\x20%s,\x20%s',_0x3edb83,_0x8819('0x9'));logger[_0x8819('0xa')](_0x8819('0xb'),_0x3edb83,_0x8819('0x9'),JSON['stringify'](_0x353876));if(_0x353876[_0x8819('0xc')]){if(_0x353876[_0x8819('0xc')]['code']===0x1f4){logger[_0x8819('0xc')]('ServicenowField,\x20%s,\x20%s',_0x3edb83,_0x353876['error'][_0x8819('0xd')]);return _0x18ae9e(_0x353876[_0x8819('0xc')][_0x8819('0xd')]);}logger[_0x8819('0xc')]('ServicenowField,\x20%s,\x20%s',_0x3edb83,_0x353876[_0x8819('0xc')][_0x8819('0xd')]);return _0x1d15c1(_0x353876[_0x8819('0xc')][_0x8819('0xd')]);}else{logger[_0x8819('0x8')](_0x8819('0xe'),_0x3edb83,_0x8819('0x9'));_0x1d15c1(_0x353876['result'][_0x8819('0xd')]);}})['catch'](function(_0x10551f){logger['error'](_0x8819('0xe'),_0x3edb83,_0x10551f);_0x18ae9e(_0x10551f);});});} \ No newline at end of file +var _0xa88e=['catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','code','ServicenowField,\x20%s,\x20%s','message','result'];(function(_0xf7548f,_0x2c046d){var _0x42be93=function(_0x3972d5){while(--_0x3972d5){_0xf7548f['push'](_0xf7548f['shift']());}};_0x42be93(++_0x2c046d);}(_0xa88e,0x79));var _0xea88=function(_0x5d6a7c,_0x2b507a){_0x5d6a7c=_0x5d6a7c-0x0;var _0x5db973=_0xa88e[_0x5d6a7c];return _0x5db973;};'use strict';var _=require('lodash');var util=require(_0xea88('0x0'));var moment=require(_0xea88('0x1'));var BPromise=require(_0xea88('0x2'));var rs=require(_0xea88('0x3'));var fs=require('fs');var Redis=require(_0xea88('0x4'));var db=require(_0xea88('0x5'))['db'];var utils=require(_0xea88('0x6'));var logger=require(_0xea88('0x7'))('rpc');var config=require(_0xea88('0x8'));var jayson=require(_0xea88('0x9'));var client=jayson[_0xea88('0xa')][_0xea88('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4f4a77,_0xae27b5,_0x176489){return new BPromise(function(_0x399ca1,_0x564985){return client['request'](_0x4f4a77,_0x176489)[_0xea88('0xc')](function(_0x44d49d){logger[_0xea88('0xd')]('ServicenowField,\x20%s,\x20%s',_0xae27b5,_0xea88('0xe'));logger[_0xea88('0xf')](_0xea88('0x10'),_0xae27b5,_0xea88('0xe'),JSON[_0xea88('0x11')](_0x44d49d));if(_0x44d49d['error']){if(_0x44d49d[_0xea88('0x12')][_0xea88('0x13')]===0x1f4){logger[_0xea88('0x12')](_0xea88('0x14'),_0xae27b5,_0x44d49d[_0xea88('0x12')][_0xea88('0x15')]);return _0x564985(_0x44d49d[_0xea88('0x12')]['message']);}logger[_0xea88('0x12')](_0xea88('0x14'),_0xae27b5,_0x44d49d[_0xea88('0x12')][_0xea88('0x15')]);return _0x399ca1(_0x44d49d[_0xea88('0x12')][_0xea88('0x15')]);}else{logger[_0xea88('0xd')](_0xea88('0x14'),_0xae27b5,'request\x20sent');_0x399ca1(_0x44d49d[_0xea88('0x16')][_0xea88('0x15')]);}})[_0xea88('0x17')](function(_0x54bad7){logger[_0xea88('0x12')](_0xea88('0x14'),_0xae27b5,_0x54bad7);_0x564985(_0x54bad7);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 90a5cb8..db70a84 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 _0x6e76=['destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','delete'];(function(_0x4a9959,_0x32ff35){var _0x5b788e=function(_0xca151c){while(--_0xca151c){_0x4a9959['push'](_0x4a9959['shift']());}};_0x5b788e(++_0x32ff35);}(_0x6e76,0x86));var _0x66e7=function(_0x9b7386,_0x130ff1){_0x9b7386=_0x9b7386-0x0;var _0x3366db=_0x6e76[_0x9b7386];return _0x3366db;};'use strict';var multer=require(_0x66e7('0x0'));var util=require(_0x66e7('0x1'));var path=require(_0x66e7('0x2'));var timeout=require('connect-timeout');var express=require(_0x66e7('0x3'));var router=express[_0x66e7('0x4')]();var auth=require(_0x66e7('0x5'));var interaction=require(_0x66e7('0x6'));var config=require('../../config/environment');var controller=require(_0x66e7('0x7'));router[_0x66e7('0x8')]('/',auth[_0x66e7('0x9')](),controller[_0x66e7('0xa')]);router['get'](_0x66e7('0xb'),auth[_0x66e7('0x9')](),controller[_0x66e7('0xc')]);router[_0x66e7('0x8')](_0x66e7('0xd'),auth[_0x66e7('0x9')](),controller[_0x66e7('0xe')]);router['get'](_0x66e7('0xf'),auth[_0x66e7('0x9')](),controller['getFields']);router[_0x66e7('0x10')]('/',auth['isAuthenticated'](),controller[_0x66e7('0x11')]);router[_0x66e7('0x10')](_0x66e7('0xd'),auth[_0x66e7('0x9')](),controller[_0x66e7('0x12')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0x66e7('0x13')](_0x66e7('0xb'),auth[_0x66e7('0x9')](),controller[_0x66e7('0x14')]);module[_0x66e7('0x15')]=router; \ No newline at end of file +var _0x9ce1=['create','post','addConfiguration','put','delete','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/:id','getConfigurations','/:id/fields','getFields'];(function(_0xf672ed,_0x57d550){var _0x50bfce=function(_0x2bec1a){while(--_0x2bec1a){_0xf672ed['push'](_0xf672ed['shift']());}};_0x50bfce(++_0x57d550);}(_0x9ce1,0x1bb));var _0x19ce=function(_0x35ba3f,_0x6353e){_0x35ba3f=_0x35ba3f-0x0;var _0x3d7537=_0x9ce1[_0x35ba3f];return _0x3d7537;};'use strict';var multer=require(_0x19ce('0x0'));var util=require(_0x19ce('0x1'));var path=require('path');var timeout=require(_0x19ce('0x2'));var express=require(_0x19ce('0x3'));var router=express[_0x19ce('0x4')]();var auth=require(_0x19ce('0x5'));var interaction=require(_0x19ce('0x6'));var config=require('../../config/environment');var controller=require('./intSugarcrmAccount.controller');router[_0x19ce('0x7')]('/',auth[_0x19ce('0x8')](),controller['index']);router[_0x19ce('0x7')](_0x19ce('0x9'),auth[_0x19ce('0x8')](),controller['show']);router['get']('/:id/configurations',auth['isAuthenticated'](),controller[_0x19ce('0xa')]);router[_0x19ce('0x7')](_0x19ce('0xb'),auth['isAuthenticated'](),controller[_0x19ce('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x19ce('0xd')]);router[_0x19ce('0xe')]('/:id/configurations',auth[_0x19ce('0x8')](),controller[_0x19ce('0xf')]);router[_0x19ce('0x10')](_0x19ce('0x9'),auth[_0x19ce('0x8')](),controller['update']);router[_0x19ce('0x11')](_0x19ce('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0x19ce('0x12')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index 2a694be..79b9c1c 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 _0x9c5b=['STRING','sequelize','exports'];(function(_0x363a40,_0x48feb8){var _0x55a7fa=function(_0x4230c3){while(--_0x4230c3){_0x363a40['push'](_0x363a40['shift']());}};_0x55a7fa(++_0x48feb8);}(_0x9c5b,0x127));var _0xb9c5=function(_0x23648b,_0x51a25f){_0x23648b=_0x23648b-0x0;var _0x2b5a63=_0x9c5b[_0x23648b];return _0x2b5a63;};'use strict';var Sequelize=require(_0xb9c5('0x0'));module[_0xb9c5('0x1')]={'name':{'type':Sequelize[_0xb9c5('0x2')]},'description':{'type':Sequelize[_0xb9c5('0x2')]},'username':{'type':Sequelize[_0xb9c5('0x2')],'unique':'username'},'password':{'type':Sequelize[_0xb9c5('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0xb9c5('0x2')]}}; \ No newline at end of file +var _0x427f=['STRING','username','sequelize','exports'];(function(_0x4776a0,_0x49baf2){var _0x32cd4e=function(_0x1833b7){while(--_0x1833b7){_0x4776a0['push'](_0x4776a0['shift']());}};_0x32cd4e(++_0x49baf2);}(_0x427f,0x1ba));var _0xf427=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x427f[_0x4cf98e];return _0x1623ac;};'use strict';var Sequelize=require(_0xf427('0x0'));module[_0xf427('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xf427('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0xf427('0x3')},'password':{'type':Sequelize[_0xf427('0x2')]},'remoteUri':{'type':Sequelize[_0xf427('0x2')],'unique':'remoteUri'},'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 6c4c3ee..27889c6 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 _0xa848=['debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','SugarcrmAccount,\x20%s,\x20%s','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','stack','name','send','index','map','SugarcrmAccount','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','filter','where','merge','VIRTUAL','options','includeAll','rows','show','create','body','params','destroy','getConfigurations','SugarcrmConfiguration','pick','findOne','AccountId','channel','getDescriptions','SugarcrmField','Descriptions','getFields','description','date_start','duration_hours','parent_id','parent_type','parent_name','direction','username','remoteUri','slice','lastIndexOf','POST','format','%s%s','/service/v4_1/rest.php','login','JSON','password','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','get_module_fields','Calls','module_fields','includes','label','values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','eml-format','rimraf','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','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','request\x20sent'];(function(_0x5e71a9,_0x3c8fe8){var _0x2240df=function(_0x1b1a4d){while(--_0x1b1a4d){_0x5e71a9['push'](_0x5e71a9['shift']());}};_0x2240df(++_0x3c8fe8);}(_0xa848,0x169));var _0x8a84=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa848[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x8a84('0x0'));var emlformat=require(_0x8a84('0x1'));var rimraf=require(_0x8a84('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8a84('0x3'));var rp=require(_0x8a84('0x4'));var moment=require(_0x8a84('0x5'));var BPromise=require(_0x8a84('0x6'));var Mustache=require(_0x8a84('0x7'));var util=require(_0x8a84('0x8'));var path=require(_0x8a84('0x9'));var sox=require(_0x8a84('0xa'));var csv=require(_0x8a84('0xb'));var ejs=require(_0x8a84('0xc'));var fs=require('fs');var _=require(_0x8a84('0xd'));var squel=require('squel');var crypto=require(_0x8a84('0xe'));var jsforce=require(_0x8a84('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x8a84('0xb'));var querystring=require('querystring');var Papa=require(_0x8a84('0x10'));var Redis=require(_0x8a84('0x11'));var authService=require(_0x8a84('0x12'));var qs=require(_0x8a84('0x13'));var as=require(_0x8a84('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8a84('0x15'))(_0x8a84('0x16'));var utils=require(_0x8a84('0x17'));var config=require('../../config/environment');var db=require(_0x8a84('0x18'))['db'];var integrations=require(_0x8a84('0x19'));var jayson=require(_0x8a84('0x1a'));var client=jayson[_0x8a84('0x1b')][_0x8a84('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x6e279e,_0x2bfcf6,_0x52d654){if(_0x52d654){var _0x4301a1=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4301a1['test'](_0x2bfcf6)){return _0x6e279e;}else{throw new db[(_0x8a84('0x1d'))][(_0x8a84('0x1e'))](_0x8a84('0x1f'));}}else{return _0x6e279e;}}function respondWithRpcPromise(_0x4b09b2,_0x31aedf,_0x152a39,_0x178129){return new BPromise(function(_0x4fed07,_0x4df547){var _0x287cea=_0x178129||client;return _0x287cea[_0x8a84('0x20')](_0x4b09b2,_0x152a39)['then'](function(_0x356460){logger[_0x8a84('0x21')]('SugarcrmAccount,\x20%s,\x20%s',_0x31aedf,_0x8a84('0x22'));logger[_0x8a84('0x23')](_0x8a84('0x24'),_0x31aedf,_0x8a84('0x22'),JSON[_0x8a84('0x25')](_0x356460));if(_0x356460[_0x8a84('0x26')]){if(_0x356460['error']['code']===0x1f4){logger[_0x8a84('0x26')]('SugarcrmAccount,\x20%s,\x20%s',_0x31aedf,_0x356460['error'][_0x8a84('0x27')]);return _0x4df547(_0x356460['error'][_0x8a84('0x27')]);}logger[_0x8a84('0x26')](_0x8a84('0x28'),_0x31aedf,_0x356460[_0x8a84('0x26')][_0x8a84('0x27')]);return _0x4fed07(_0x356460[_0x8a84('0x26')][_0x8a84('0x27')]);}else{logger[_0x8a84('0x21')](_0x8a84('0x28'),_0x31aedf,_0x8a84('0x22'));_0x4fed07(_0x356460[_0x8a84('0x29')][_0x8a84('0x27')]);}})[_0x8a84('0x2a')](function(_0x4abd7c){logger[_0x8a84('0x26')]('SugarcrmAccount,\x20%s,\x20%s',_0x31aedf,_0x4abd7c);_0x4df547(_0x4abd7c);});});}function respondWithStatusCode(_0x44f4c6,_0x3a329b){_0x3a329b=_0x3a329b||0xcc;return function(_0x51c151){if(_0x51c151){return _0x44f4c6[_0x8a84('0x2b')](_0x3a329b);}return _0x44f4c6[_0x8a84('0x2c')](_0x3a329b)[_0x8a84('0x2d')]();};}function respondWithResult(_0x876dc8,_0x5ded84){_0x5ded84=_0x5ded84||0xc8;return function(_0x57c9c9){if(_0x57c9c9){return _0x876dc8[_0x8a84('0x2c')](_0x5ded84)[_0x8a84('0x2e')](_0x57c9c9);}};}function respondWithFilteredResult(_0x170bd6,_0x8a571f){return function(_0x3eba6e){if(_0x3eba6e){var _0x27bf55=_0x3eba6e[_0x8a84('0x2f')],_0x1178ab=_0x8a571f['offset'],_0x3c24f7=_0x8a571f[_0x8a84('0x30')]+_0x8a571f[_0x8a84('0x31')],_0x5614e3;if(_0x3c24f7>=_0x27bf55){_0x3c24f7=_0x27bf55;_0x5614e3=0xc8;}else{_0x5614e3=0xce;}_0x170bd6[_0x8a84('0x2c')](_0x5614e3);return _0x170bd6[_0x8a84('0x32')](_0x8a84('0x33'),_0x1178ab+'-'+_0x3c24f7+'/'+_0x27bf55)[_0x8a84('0x2e')](_0x3eba6e);}return null;};}function patchUpdates(_0x2c78c5){return function(_0x25ef19){try{jsonpatch[_0x8a84('0x34')](_0x25ef19,_0x2c78c5,!![]);}catch(_0x437345){return BPromise[_0x8a84('0x35')](_0x437345);}return _0x25ef19[_0x8a84('0x36')]();};}function saveUpdates(_0x22a6e9,_0x9b2f6f){return function(_0x20550b){if(_0x20550b){return _0x20550b[_0x8a84('0x37')](_0x22a6e9)[_0x8a84('0x38')](function(_0x1d65c4){return _0x1d65c4;});}return null;};}function removeEntity(_0xe660f7,_0x3a8ac2){return function(_0x1845c5){if(_0x1845c5){return _0x1845c5['destroy']()[_0x8a84('0x38')](function(){_0xe660f7['status'](0xcc)[_0x8a84('0x2d')]();});}};}function handleEntityNotFound(_0xf1e024,_0x5145d2){return function(_0x19e0bf){if(!_0x19e0bf){_0xf1e024[_0x8a84('0x2b')](0x194);}return _0x19e0bf;};}function handleError(_0x1151e6,_0x4ad27c){_0x4ad27c=_0x4ad27c||0x1f4;return function(_0x5e4e70){logger[_0x8a84('0x26')](_0x5e4e70[_0x8a84('0x39')]);if(_0x5e4e70[_0x8a84('0x3a')]){delete _0x5e4e70[_0x8a84('0x3a')];}_0x1151e6[_0x8a84('0x2c')](_0x4ad27c)[_0x8a84('0x3b')](_0x5e4e70);};}exports[_0x8a84('0x3c')]=function(_0x5ae3d5,_0x4a2614){var _0x1a13b3={},_0x3cac22={},_0xc4731a={'count':0x0,'rows':[]};var _0x463b99=_[_0x8a84('0x3d')](db[_0x8a84('0x3e')][_0x8a84('0x3f')],function(_0x3b46b4){return{'name':_0x3b46b4[_0x8a84('0x40')],'type':_0x3b46b4[_0x8a84('0x41')][_0x8a84('0x42')]};});_0x3cac22['model']=_['map'](_0x463b99,_0x8a84('0x3a'));_0x3cac22[_0x8a84('0x43')]=_[_0x8a84('0x44')](_0x5ae3d5[_0x8a84('0x43')]);_0x3cac22[_0x8a84('0x45')]=_[_0x8a84('0x46')](_0x3cac22[_0x8a84('0x47')],_0x3cac22['query']);_0x1a13b3['attributes']=_[_0x8a84('0x46')](_0x3cac22[_0x8a84('0x47')],qs[_0x8a84('0x48')](_0x5ae3d5[_0x8a84('0x43')][_0x8a84('0x48')]));_0x1a13b3['attributes']=_0x1a13b3[_0x8a84('0x49')][_0x8a84('0x4a')]?_0x1a13b3[_0x8a84('0x49')]:_0x3cac22['model'];if(!_0x5ae3d5[_0x8a84('0x43')][_0x8a84('0x4b')](_0x8a84('0x4c'))){_0x1a13b3[_0x8a84('0x31')]=qs['limit'](_0x5ae3d5[_0x8a84('0x43')][_0x8a84('0x31')]);_0x1a13b3[_0x8a84('0x30')]=qs[_0x8a84('0x30')](_0x5ae3d5['query'][_0x8a84('0x30')]);}_0x1a13b3['order']=qs['sort'](_0x5ae3d5[_0x8a84('0x43')][_0x8a84('0x4d')]);_0x1a13b3['where']=qs['filters'](_['pick'](_0x5ae3d5[_0x8a84('0x43')],_0x3cac22['filters']),_0x463b99);if(_0x5ae3d5['query'][_0x8a84('0x4e')]){_0x1a13b3[_0x8a84('0x4f')]=_[_0x8a84('0x50')](_0x1a13b3[_0x8a84('0x4f')],{'$or':_['map'](_0x463b99,function(_0x7de2eb){if(_0x7de2eb[_0x8a84('0x41')]!==_0x8a84('0x51')){var _0x19b6cf={};_0x19b6cf[_0x7de2eb['name']]={'$like':'%'+_0x5ae3d5['query'][_0x8a84('0x4e')]+'%'};return _0x19b6cf;}})});}_0x1a13b3=_['merge']({},_0x1a13b3,_0x5ae3d5[_0x8a84('0x52')]);var _0x995765={'where':_0x1a13b3[_0x8a84('0x4f')]};return db[_0x8a84('0x3e')][_0x8a84('0x2f')](_0x995765)[_0x8a84('0x38')](function(_0x3318be){_0xc4731a[_0x8a84('0x2f')]=_0x3318be;if(_0x5ae3d5[_0x8a84('0x43')][_0x8a84('0x53')]){_0x1a13b3['include']=[{'all':!![]}];}return db['SugarcrmAccount']['findAll'](_0x1a13b3);})[_0x8a84('0x38')](function(_0x4418d9){_0xc4731a[_0x8a84('0x54')]=_0x4418d9;return _0xc4731a;})[_0x8a84('0x38')](respondWithFilteredResult(_0x4a2614,_0x1a13b3))[_0x8a84('0x2a')](handleError(_0x4a2614,null));};exports[_0x8a84('0x55')]=function(_0x348651,_0x4ea096){var _0x3053a0={'raw':![],'where':{'id':_0x348651['params']['id']}},_0x7d11c0={};_0x7d11c0['model']=_[_0x8a84('0x44')](db[_0x8a84('0x3e')][_0x8a84('0x3f')]);_0x7d11c0[_0x8a84('0x43')]=_[_0x8a84('0x44')](_0x348651['query']);_0x7d11c0[_0x8a84('0x45')]=_['intersection'](_0x7d11c0['model'],_0x7d11c0[_0x8a84('0x43')]);_0x3053a0[_0x8a84('0x49')]=_[_0x8a84('0x46')](_0x7d11c0[_0x8a84('0x47')],qs['fields'](_0x348651[_0x8a84('0x43')][_0x8a84('0x48')]));_0x3053a0[_0x8a84('0x49')]=_0x3053a0[_0x8a84('0x49')][_0x8a84('0x4a')]?_0x3053a0['attributes']:_0x7d11c0[_0x8a84('0x47')];if(_0x348651['query']['includeAll']){_0x3053a0['include']=[{'all':!![]}];}_0x3053a0=_['merge']({},_0x3053a0,_0x348651[_0x8a84('0x52')]);return db[_0x8a84('0x3e')]['find'](_0x3053a0)[_0x8a84('0x38')](handleEntityNotFound(_0x4ea096,null))[_0x8a84('0x38')](respondWithResult(_0x4ea096,null))['catch'](handleError(_0x4ea096,null));};exports['create']=function(_0xfe67c0,_0x269264){return db[_0x8a84('0x3e')][_0x8a84('0x56')](_0xfe67c0[_0x8a84('0x57')],{})[_0x8a84('0x38')](respondWithResult(_0x269264,0xc9))[_0x8a84('0x2a')](handleError(_0x269264,null));};exports[_0x8a84('0x37')]=function(_0x734e0e,_0x4d5afb){if(_0x734e0e[_0x8a84('0x57')]['id']){delete _0x734e0e[_0x8a84('0x57')]['id'];}return db['SugarcrmAccount']['find']({'where':{'id':_0x734e0e[_0x8a84('0x58')]['id']}})[_0x8a84('0x38')](handleEntityNotFound(_0x4d5afb,null))['then'](saveUpdates(_0x734e0e['body'],null))[_0x8a84('0x38')](respondWithResult(_0x4d5afb,null))[_0x8a84('0x2a')](handleError(_0x4d5afb,null));};exports[_0x8a84('0x59')]=function(_0x1046ac,_0x59ea55){return db[_0x8a84('0x3e')]['find']({'where':{'id':_0x1046ac[_0x8a84('0x58')]['id']}})[_0x8a84('0x38')](handleEntityNotFound(_0x59ea55,null))['then'](removeEntity(_0x59ea55,null))[_0x8a84('0x2a')](handleError(_0x59ea55,null));};exports[_0x8a84('0x5a')]=function(_0x154ac8,_0x11a7f5,_0x8d00d5){var _0x477c3f={};var _0x5cde26={};var _0x33125e;var _0x76a806;return db['SugarcrmAccount']['findOne']({'where':{'id':_0x154ac8[_0x8a84('0x58')]['id']}})[_0x8a84('0x38')](handleEntityNotFound(_0x11a7f5,null))[_0x8a84('0x38')](function(_0x349e6f){if(_0x349e6f){_0x33125e=_0x349e6f;_0x5cde26[_0x8a84('0x47')]=_[_0x8a84('0x44')](db[_0x8a84('0x5b')]['rawAttributes']);_0x5cde26[_0x8a84('0x43')]=_['keys'](_0x154ac8[_0x8a84('0x43')]);_0x5cde26[_0x8a84('0x45')]=_[_0x8a84('0x46')](_0x5cde26[_0x8a84('0x47')],_0x5cde26[_0x8a84('0x43')]);_0x477c3f[_0x8a84('0x49')]=_['intersection'](_0x5cde26[_0x8a84('0x47')],qs[_0x8a84('0x48')](_0x154ac8['query'][_0x8a84('0x48')]));_0x477c3f[_0x8a84('0x49')]=_0x477c3f[_0x8a84('0x49')][_0x8a84('0x4a')]?_0x477c3f[_0x8a84('0x49')]:_0x5cde26[_0x8a84('0x47')];_0x477c3f['order']=qs[_0x8a84('0x4d')](_0x154ac8[_0x8a84('0x43')][_0x8a84('0x4d')]);_0x477c3f[_0x8a84('0x4f')]=qs[_0x8a84('0x45')](_[_0x8a84('0x5c')](_0x154ac8['query'],_0x5cde26['filters']));if(_0x154ac8[_0x8a84('0x43')][_0x8a84('0x4e')]){_0x477c3f[_0x8a84('0x4f')]=_[_0x8a84('0x50')](_0x477c3f['where'],{'$or':_['map'](_0x477c3f[_0x8a84('0x49')],function(_0x5b0fbe){var _0x34d3e6={};_0x34d3e6[_0x5b0fbe]={'$like':'%'+_0x154ac8[_0x8a84('0x43')][_0x8a84('0x4e')]+'%'};return _0x34d3e6;})});}_0x477c3f=_[_0x8a84('0x50')]({},_0x477c3f,_0x154ac8[_0x8a84('0x52')]);return _0x33125e[_0x8a84('0x5a')](_0x477c3f);}})[_0x8a84('0x38')](function(_0x1cdb49){if(_0x1cdb49){_0x76a806=_0x1cdb49[_0x8a84('0x4a')];if(!_0x154ac8['query']['hasOwnProperty'](_0x8a84('0x4c'))){_0x477c3f[_0x8a84('0x31')]=qs[_0x8a84('0x31')](_0x154ac8[_0x8a84('0x43')][_0x8a84('0x31')]);_0x477c3f['offset']=qs[_0x8a84('0x30')](_0x154ac8[_0x8a84('0x43')][_0x8a84('0x30')]);}return _0x33125e[_0x8a84('0x5a')](_0x477c3f);}})['then'](function(_0x5c7e69){if(_0x5c7e69){return _0x5c7e69?{'count':_0x76a806,'rows':_0x5c7e69}:null;}})[_0x8a84('0x38')](respondWithResult(_0x11a7f5,null))[_0x8a84('0x2a')](handleError(_0x11a7f5,null));};exports['addConfiguration']=function(_0x3335a6,_0x105614,_0x8a9607){if(_0x3335a6[_0x8a84('0x57')]['id']){delete _0x3335a6[_0x8a84('0x57')]['id'];}return db[_0x8a84('0x3e')][_0x8a84('0x5d')]({'where':{'id':_0x3335a6[_0x8a84('0x58')]['id']}})[_0x8a84('0x38')](handleEntityNotFound(_0x105614,null))['then'](function(_0x2542c9){if(_0x2542c9){_0x3335a6[_0x8a84('0x57')][_0x8a84('0x5e')]=_0x2542c9['id'];_0x3335a6[_0x8a84('0x57')]['Subjects']=integrations['getSubjects'](_0x3335a6[_0x8a84('0x57')][_0x8a84('0x5f')],_0x3335a6['body'][_0x8a84('0x41')]);_0x3335a6[_0x8a84('0x57')]['Descriptions']=integrations[_0x8a84('0x60')](_0x3335a6[_0x8a84('0x57')][_0x8a84('0x5f')],_0x3335a6[_0x8a84('0x57')][_0x8a84('0x41')]);return db[_0x8a84('0x5b')][_0x8a84('0x56')](_0x3335a6[_0x8a84('0x57')],{'include':[{'model':db[_0x8a84('0x61')],'as':'Subjects'},{'model':db['SugarcrmField'],'as':_0x8a84('0x62')}]});}return null;})[_0x8a84('0x38')](respondWithResult(_0x105614,null))['catch'](handleError(_0x105614,null));};exports[_0x8a84('0x63')]=function(_0xead7dc,_0x4dee5f,_0x543aa4){var _0x1bbafa='';var _0x547802=['id',_0x8a84('0x3a'),'assigned_user_id','created_by',_0x8a84('0x64'),_0x8a84('0x65'),_0x8a84('0x66'),'duration_minutes',_0x8a84('0x67'),_0x8a84('0x68'),_0x8a84('0x69'),_0x8a84('0x6a')];return db[_0x8a84('0x3e')][_0x8a84('0x5d')]({'where':{'id':_0xead7dc[_0x8a84('0x58')]['id']},'attributes':['id',_0x8a84('0x6b'),'password',_0x8a84('0x6c')]})[_0x8a84('0x38')](handleEntityNotFound(_0x4dee5f,null))[_0x8a84('0x38')](function(_0x5577d5){if(_0x5577d5){_0x1bbafa=_0x5577d5['remoteUri'];var _0x4c1bb8=_0x1bbafa[_0x8a84('0x6d')](-0x1);if(_0x4c1bb8==='/'){_0x1bbafa=_0x1bbafa['substring'](0x0,_0x1bbafa[_0x8a84('0x6e')](_0x4c1bb8));}return rp({'method':_0x8a84('0x6f'),'uri':util[_0x8a84('0x70')](_0x8a84('0x71'),_0x1bbafa,_0x8a84('0x72')),'json':!![],'form':{'method':_0x8a84('0x73'),'input_type':_0x8a84('0x74'),'response_type':_0x8a84('0x74'),'rest_data':JSON[_0x8a84('0x25')]({'user_auth':{'user_name':_0x5577d5[_0x8a84('0x6b')],'password':_0x5577d5[_0x8a84('0x75')],'encryption':_0x8a84('0x76')},'application':_0x8a84('0x77')})}});}})['then'](function(_0x397aca){if(_0x397aca&&_0x397aca['name']!==_0x8a84('0x78')&&_0x397aca[_0x8a84('0x3a')]!==_0x8a84('0x79')){return rp({'method':_0x8a84('0x6f'),'uri':util[_0x8a84('0x70')]('%s%s',_0x1bbafa,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0x8a84('0x7a'),'input_type':_0x8a84('0x74'),'response_type':_0x8a84('0x74'),'rest_data':JSON[_0x8a84('0x25')]({'session':_0x397aca['id'],'module_name':_0x8a84('0x7b')})}})['then'](function(_0x3de9a3){if(_0x3de9a3){var _0x347553=_['values'](_0x3de9a3[_0x8a84('0x7c')]);_['remove'](_0x347553,function(_0x5f44ac){return _0x547802[_0x8a84('0x7d')](_0x5f44ac[_0x8a84('0x3a')]);});return{'count':_0x347553[_0x8a84('0x4a')],'rows':_[_0x8a84('0x3d')](_0x347553,function(_0x537091){return{'id':_0x537091[_0x8a84('0x3a')],'name':_0x537091[_0x8a84('0x7e')],'custom':_['endsWith'](_0x537091[_0x8a84('0x3a')],'_c')?!![]:![],'options':_0x537091[_0x8a84('0x52')]?_[_0x8a84('0x3d')](_[_0x8a84('0x7f')](_0x537091[_0x8a84('0x52')]),function(_0x45cff0){return{'name':_0x45cff0['value'],'value':_0x45cff0[_0x8a84('0x3a')]};}):[]};})};}})[_0x8a84('0x38')](respondWithResult(_0x4dee5f,null))['catch'](function(_0x4ce7e6){var _0x229635=_0xead7dc[_0x8a84('0x43')][_0x8a84('0x80')]?0x1f4:_0x4ce7e6[_0x8a84('0x81')]||0x1f4;logger[_0x8a84('0x26')](_0x8a84('0x82'),_0x8a84('0x63'),_0x229635,JSON[_0x8a84('0x25')](_0x4ce7e6));delete _0x4ce7e6[_0x8a84('0x3a')];if(_0x229635===0x191){_0x229635=0x190;}_0x4dee5f[_0x8a84('0x2c')](_0x229635)[_0x8a84('0x3b')](_0xead7dc[_0x8a84('0x43')]['test']?{'message':_0x8a84('0x83'),'statusCode':_0x4ce7e6[_0x8a84('0x81')]}:_0x4ce7e6);});}else{var _0x4304c0=0x1f4;_0x4dee5f[_0x8a84('0x2c')](_0x4304c0)[_0x8a84('0x3b')]({'message':_0x8a84('0x83'),'statusCode':0x190});}});}; \ No newline at end of file +var _0x9c4b=['Calls','values','module_fields','includes','label','statusCode','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','ejs','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','sendStatus','status','json','count','limit','set','Content-Range','reject','save','update','destroy','name','send','index','rawAttributes','type','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','offset','order','sort','filters','filter','where','merge','map','options','SugarcrmAccount','includeAll','include','findAll','rows','params','find','create','body','getConfigurations','findOne','SugarcrmConfiguration','pick','nolimit','AccountId','Subjects','getSubjects','channel','Descriptions','SugarcrmField','assigned_user_id','description','date_start','duration_hours','parent_type','username','password','remoteUri','slice','substring','POST','format','%s%s','login','JSON','xCALLY\x20Motion\x20Integration','Password\x20Expired','/service/v4_1/rest.php','get_module_fields'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0x9c4b,0xed));var _0xb9c4=function(_0x461587,_0x1ab500){_0x461587=_0x461587-0x0;var _0x1427d7=_0x9c4b[_0x461587];return _0x1427d7;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb9c4('0x0'));var rimraf=require(_0xb9c4('0x1'));var zipdir=require(_0xb9c4('0x2'));var jsonpatch=require(_0xb9c4('0x3'));var rp=require(_0xb9c4('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xb9c4('0x5'));var util=require('util');var path=require(_0xb9c4('0x6'));var sox=require(_0xb9c4('0x7'));var csv=require('to-csv');var ejs=require(_0xb9c4('0x8'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xb9c4('0x9'));var deskjs=require(_0xb9c4('0xa'));var toCsv=require(_0xb9c4('0xb'));var querystring=require(_0xb9c4('0xc'));var Papa=require('papaparse');var Redis=require(_0xb9c4('0xd'));var authService=require(_0xb9c4('0xe'));var qs=require(_0xb9c4('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xb9c4('0x10'))('api');var utils=require('../../config/utils');var config=require(_0xb9c4('0x11'));var db=require(_0xb9c4('0x12'))['db'];var integrations=require(_0xb9c4('0x13'));var jayson=require(_0xb9c4('0x14'));var client=jayson[_0xb9c4('0x15')][_0xb9c4('0x16')]({'port':0x232a});function checkPasswordPattern(_0xc6385e,_0x66f0e7,_0x3fc5bc){if(_0x3fc5bc){var _0x3c24df=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3c24df[_0xb9c4('0x17')](_0x66f0e7)){return _0xc6385e;}else{throw new db[(_0xb9c4('0x18'))][(_0xb9c4('0x19'))](_0xb9c4('0x1a'));}}else{return _0xc6385e;}}function respondWithRpcPromise(_0x388a48,_0x15256d,_0x240700,_0x2f4024){return new BPromise(function(_0x3a09fc,_0x1841f5){var _0x25fc69=_0x2f4024||client;return _0x25fc69['request'](_0x388a48,_0x240700)[_0xb9c4('0x1b')](function(_0xad0b0d){logger[_0xb9c4('0x1c')](_0xb9c4('0x1d'),_0x15256d,_0xb9c4('0x1e'));logger['debug']('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x15256d,_0xb9c4('0x1e'),JSON[_0xb9c4('0x1f')](_0xad0b0d));if(_0xad0b0d[_0xb9c4('0x20')]){if(_0xad0b0d[_0xb9c4('0x20')]['code']===0x1f4){logger[_0xb9c4('0x20')](_0xb9c4('0x1d'),_0x15256d,_0xad0b0d[_0xb9c4('0x20')][_0xb9c4('0x21')]);return _0x1841f5(_0xad0b0d[_0xb9c4('0x20')][_0xb9c4('0x21')]);}logger['error'](_0xb9c4('0x1d'),_0x15256d,_0xad0b0d[_0xb9c4('0x20')][_0xb9c4('0x21')]);return _0x3a09fc(_0xad0b0d[_0xb9c4('0x20')][_0xb9c4('0x21')]);}else{logger[_0xb9c4('0x1c')](_0xb9c4('0x1d'),_0x15256d,_0xb9c4('0x1e'));_0x3a09fc(_0xad0b0d[_0xb9c4('0x22')][_0xb9c4('0x21')]);}})[_0xb9c4('0x23')](function(_0x37ce99){logger['error'](_0xb9c4('0x1d'),_0x15256d,_0x37ce99);_0x1841f5(_0x37ce99);});});}function respondWithStatusCode(_0x1b555d,_0x573304){_0x573304=_0x573304||0xcc;return function(_0x5c476b){if(_0x5c476b){return _0x1b555d[_0xb9c4('0x24')](_0x573304);}return _0x1b555d['status'](_0x573304)['end']();};}function respondWithResult(_0x48ce45,_0x19b03b){_0x19b03b=_0x19b03b||0xc8;return function(_0x5a37f9){if(_0x5a37f9){return _0x48ce45[_0xb9c4('0x25')](_0x19b03b)[_0xb9c4('0x26')](_0x5a37f9);}};}function respondWithFilteredResult(_0x5437e1,_0x1600d3){return function(_0x314896){if(_0x314896){var _0x3ea41f=_0x314896[_0xb9c4('0x27')],_0x563bff=_0x1600d3['offset'],_0x222737=_0x1600d3['offset']+_0x1600d3[_0xb9c4('0x28')],_0x47dcb3;if(_0x222737>=_0x3ea41f){_0x222737=_0x3ea41f;_0x47dcb3=0xc8;}else{_0x47dcb3=0xce;}_0x5437e1[_0xb9c4('0x25')](_0x47dcb3);return _0x5437e1[_0xb9c4('0x29')](_0xb9c4('0x2a'),_0x563bff+'-'+_0x222737+'/'+_0x3ea41f)[_0xb9c4('0x26')](_0x314896);}return null;};}function patchUpdates(_0x12ed91){return function(_0x179229){try{jsonpatch['apply'](_0x179229,_0x12ed91,!![]);}catch(_0x1d4265){return BPromise[_0xb9c4('0x2b')](_0x1d4265);}return _0x179229[_0xb9c4('0x2c')]();};}function saveUpdates(_0x294d2,_0x5c3567){return function(_0x3ade2f){if(_0x3ade2f){return _0x3ade2f[_0xb9c4('0x2d')](_0x294d2)[_0xb9c4('0x1b')](function(_0x5907db){return _0x5907db;});}return null;};}function removeEntity(_0xc925b2,_0x9dd90d){return function(_0x3a5404){if(_0x3a5404){return _0x3a5404[_0xb9c4('0x2e')]()[_0xb9c4('0x1b')](function(){_0xc925b2[_0xb9c4('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0x34c249,_0x41b3b6){return function(_0x4a9f24){if(!_0x4a9f24){_0x34c249['sendStatus'](0x194);}return _0x4a9f24;};}function handleError(_0x135e44,_0x31636c){_0x31636c=_0x31636c||0x1f4;return function(_0x1654e2){logger[_0xb9c4('0x20')](_0x1654e2['stack']);if(_0x1654e2['name']){delete _0x1654e2[_0xb9c4('0x2f')];}_0x135e44[_0xb9c4('0x25')](_0x31636c)[_0xb9c4('0x30')](_0x1654e2);};}exports[_0xb9c4('0x31')]=function(_0x4dfef7,_0x4cfbce){var _0x2ce5d0={},_0x979098={},_0x2c948b={'count':0x0,'rows':[]};var _0x2394a5=_['map'](db['SugarcrmAccount'][_0xb9c4('0x32')],function(_0x1cd01e){return{'name':_0x1cd01e['fieldName'],'type':_0x1cd01e[_0xb9c4('0x33')]['key']};});_0x979098[_0xb9c4('0x34')]=_['map'](_0x2394a5,_0xb9c4('0x2f'));_0x979098['query']=_[_0xb9c4('0x35')](_0x4dfef7[_0xb9c4('0x36')]);_0x979098['filters']=_[_0xb9c4('0x37')](_0x979098[_0xb9c4('0x34')],_0x979098[_0xb9c4('0x36')]);_0x2ce5d0[_0xb9c4('0x38')]=_[_0xb9c4('0x37')](_0x979098['model'],qs[_0xb9c4('0x39')](_0x4dfef7[_0xb9c4('0x36')]['fields']));_0x2ce5d0[_0xb9c4('0x38')]=_0x2ce5d0[_0xb9c4('0x38')][_0xb9c4('0x3a')]?_0x2ce5d0['attributes']:_0x979098[_0xb9c4('0x34')];if(!_0x4dfef7[_0xb9c4('0x36')][_0xb9c4('0x3b')]('nolimit')){_0x2ce5d0[_0xb9c4('0x28')]=qs['limit'](_0x4dfef7[_0xb9c4('0x36')]['limit']);_0x2ce5d0[_0xb9c4('0x3c')]=qs['offset'](_0x4dfef7[_0xb9c4('0x36')][_0xb9c4('0x3c')]);}_0x2ce5d0[_0xb9c4('0x3d')]=qs[_0xb9c4('0x3e')](_0x4dfef7['query'][_0xb9c4('0x3e')]);_0x2ce5d0['where']=qs[_0xb9c4('0x3f')](_['pick'](_0x4dfef7[_0xb9c4('0x36')],_0x979098['filters']),_0x2394a5);if(_0x4dfef7[_0xb9c4('0x36')][_0xb9c4('0x40')]){_0x2ce5d0[_0xb9c4('0x41')]=_[_0xb9c4('0x42')](_0x2ce5d0[_0xb9c4('0x41')],{'$or':_[_0xb9c4('0x43')](_0x2394a5,function(_0x4364d4){if(_0x4364d4[_0xb9c4('0x33')]!=='VIRTUAL'){var _0x1638d5={};_0x1638d5[_0x4364d4[_0xb9c4('0x2f')]]={'$like':'%'+_0x4dfef7[_0xb9c4('0x36')][_0xb9c4('0x40')]+'%'};return _0x1638d5;}})});}_0x2ce5d0=_[_0xb9c4('0x42')]({},_0x2ce5d0,_0x4dfef7[_0xb9c4('0x44')]);var _0x53240e={'where':_0x2ce5d0['where']};return db[_0xb9c4('0x45')][_0xb9c4('0x27')](_0x53240e)[_0xb9c4('0x1b')](function(_0x3ae5fa){_0x2c948b[_0xb9c4('0x27')]=_0x3ae5fa;if(_0x4dfef7[_0xb9c4('0x36')][_0xb9c4('0x46')]){_0x2ce5d0[_0xb9c4('0x47')]=[{'all':!![]}];}return db[_0xb9c4('0x45')][_0xb9c4('0x48')](_0x2ce5d0);})[_0xb9c4('0x1b')](function(_0x2d6ed3){_0x2c948b[_0xb9c4('0x49')]=_0x2d6ed3;return _0x2c948b;})['then'](respondWithFilteredResult(_0x4cfbce,_0x2ce5d0))[_0xb9c4('0x23')](handleError(_0x4cfbce,null));};exports['show']=function(_0x16fe1f,_0x312c04){var _0x1757b9={'raw':![],'where':{'id':_0x16fe1f[_0xb9c4('0x4a')]['id']}},_0x59c7fa={};_0x59c7fa[_0xb9c4('0x34')]=_[_0xb9c4('0x35')](db['SugarcrmAccount'][_0xb9c4('0x32')]);_0x59c7fa[_0xb9c4('0x36')]=_[_0xb9c4('0x35')](_0x16fe1f['query']);_0x59c7fa['filters']=_[_0xb9c4('0x37')](_0x59c7fa[_0xb9c4('0x34')],_0x59c7fa['query']);_0x1757b9['attributes']=_[_0xb9c4('0x37')](_0x59c7fa[_0xb9c4('0x34')],qs[_0xb9c4('0x39')](_0x16fe1f[_0xb9c4('0x36')][_0xb9c4('0x39')]));_0x1757b9['attributes']=_0x1757b9[_0xb9c4('0x38')]['length']?_0x1757b9[_0xb9c4('0x38')]:_0x59c7fa['model'];if(_0x16fe1f[_0xb9c4('0x36')][_0xb9c4('0x46')]){_0x1757b9[_0xb9c4('0x47')]=[{'all':!![]}];}_0x1757b9=_['merge']({},_0x1757b9,_0x16fe1f[_0xb9c4('0x44')]);return db[_0xb9c4('0x45')][_0xb9c4('0x4b')](_0x1757b9)[_0xb9c4('0x1b')](handleEntityNotFound(_0x312c04,null))[_0xb9c4('0x1b')](respondWithResult(_0x312c04,null))[_0xb9c4('0x23')](handleError(_0x312c04,null));};exports[_0xb9c4('0x4c')]=function(_0x3547d7,_0x4905e8){return db[_0xb9c4('0x45')][_0xb9c4('0x4c')](_0x3547d7['body'],{})[_0xb9c4('0x1b')](respondWithResult(_0x4905e8,0xc9))[_0xb9c4('0x23')](handleError(_0x4905e8,null));};exports[_0xb9c4('0x2d')]=function(_0x2ae7e7,_0x4ac710){if(_0x2ae7e7[_0xb9c4('0x4d')]['id']){delete _0x2ae7e7[_0xb9c4('0x4d')]['id'];}return db['SugarcrmAccount'][_0xb9c4('0x4b')]({'where':{'id':_0x2ae7e7[_0xb9c4('0x4a')]['id']}})[_0xb9c4('0x1b')](handleEntityNotFound(_0x4ac710,null))[_0xb9c4('0x1b')](saveUpdates(_0x2ae7e7[_0xb9c4('0x4d')],null))['then'](respondWithResult(_0x4ac710,null))[_0xb9c4('0x23')](handleError(_0x4ac710,null));};exports[_0xb9c4('0x2e')]=function(_0xfe336a,_0x32a757){return db[_0xb9c4('0x45')][_0xb9c4('0x4b')]({'where':{'id':_0xfe336a[_0xb9c4('0x4a')]['id']}})[_0xb9c4('0x1b')](handleEntityNotFound(_0x32a757,null))[_0xb9c4('0x1b')](removeEntity(_0x32a757,null))[_0xb9c4('0x23')](handleError(_0x32a757,null));};exports[_0xb9c4('0x4e')]=function(_0x4e18b0,_0x32a63a,_0x4d5ea8){var _0x38976e={};var _0x35cc35={};var _0xbbc6d;var _0x4a4c8e;return db[_0xb9c4('0x45')][_0xb9c4('0x4f')]({'where':{'id':_0x4e18b0[_0xb9c4('0x4a')]['id']}})[_0xb9c4('0x1b')](handleEntityNotFound(_0x32a63a,null))['then'](function(_0x34a73f){if(_0x34a73f){_0xbbc6d=_0x34a73f;_0x35cc35['model']=_[_0xb9c4('0x35')](db[_0xb9c4('0x50')][_0xb9c4('0x32')]);_0x35cc35[_0xb9c4('0x36')]=_[_0xb9c4('0x35')](_0x4e18b0[_0xb9c4('0x36')]);_0x35cc35['filters']=_[_0xb9c4('0x37')](_0x35cc35[_0xb9c4('0x34')],_0x35cc35['query']);_0x38976e['attributes']=_[_0xb9c4('0x37')](_0x35cc35[_0xb9c4('0x34')],qs[_0xb9c4('0x39')](_0x4e18b0[_0xb9c4('0x36')][_0xb9c4('0x39')]));_0x38976e[_0xb9c4('0x38')]=_0x38976e[_0xb9c4('0x38')][_0xb9c4('0x3a')]?_0x38976e['attributes']:_0x35cc35[_0xb9c4('0x34')];_0x38976e[_0xb9c4('0x3d')]=qs['sort'](_0x4e18b0[_0xb9c4('0x36')]['sort']);_0x38976e[_0xb9c4('0x41')]=qs[_0xb9c4('0x3f')](_[_0xb9c4('0x51')](_0x4e18b0[_0xb9c4('0x36')],_0x35cc35[_0xb9c4('0x3f')]));if(_0x4e18b0['query'][_0xb9c4('0x40')]){_0x38976e['where']=_[_0xb9c4('0x42')](_0x38976e[_0xb9c4('0x41')],{'$or':_[_0xb9c4('0x43')](_0x38976e[_0xb9c4('0x38')],function(_0x48a0a3){var _0x326ee3={};_0x326ee3[_0x48a0a3]={'$like':'%'+_0x4e18b0[_0xb9c4('0x36')][_0xb9c4('0x40')]+'%'};return _0x326ee3;})});}_0x38976e=_[_0xb9c4('0x42')]({},_0x38976e,_0x4e18b0[_0xb9c4('0x44')]);return _0xbbc6d[_0xb9c4('0x4e')](_0x38976e);}})[_0xb9c4('0x1b')](function(_0x50d561){if(_0x50d561){_0x4a4c8e=_0x50d561['length'];if(!_0x4e18b0['query']['hasOwnProperty'](_0xb9c4('0x52'))){_0x38976e[_0xb9c4('0x28')]=qs['limit'](_0x4e18b0[_0xb9c4('0x36')][_0xb9c4('0x28')]);_0x38976e['offset']=qs['offset'](_0x4e18b0[_0xb9c4('0x36')]['offset']);}return _0xbbc6d[_0xb9c4('0x4e')](_0x38976e);}})[_0xb9c4('0x1b')](function(_0x1eaa26){if(_0x1eaa26){return _0x1eaa26?{'count':_0x4a4c8e,'rows':_0x1eaa26}:null;}})[_0xb9c4('0x1b')](respondWithResult(_0x32a63a,null))[_0xb9c4('0x23')](handleError(_0x32a63a,null));};exports['addConfiguration']=function(_0x454258,_0x1a3ece,_0x1b4478){if(_0x454258[_0xb9c4('0x4d')]['id']){delete _0x454258[_0xb9c4('0x4d')]['id'];}return db[_0xb9c4('0x45')][_0xb9c4('0x4f')]({'where':{'id':_0x454258[_0xb9c4('0x4a')]['id']}})[_0xb9c4('0x1b')](handleEntityNotFound(_0x1a3ece,null))[_0xb9c4('0x1b')](function(_0x551003){if(_0x551003){_0x454258[_0xb9c4('0x4d')][_0xb9c4('0x53')]=_0x551003['id'];_0x454258[_0xb9c4('0x4d')][_0xb9c4('0x54')]=integrations[_0xb9c4('0x55')](_0x454258[_0xb9c4('0x4d')][_0xb9c4('0x56')],_0x454258[_0xb9c4('0x4d')][_0xb9c4('0x33')]);_0x454258[_0xb9c4('0x4d')][_0xb9c4('0x57')]=integrations['getDescriptions'](_0x454258[_0xb9c4('0x4d')]['channel'],_0x454258[_0xb9c4('0x4d')]['type']);return db[_0xb9c4('0x50')][_0xb9c4('0x4c')](_0x454258['body'],{'include':[{'model':db[_0xb9c4('0x58')],'as':_0xb9c4('0x54')},{'model':db['SugarcrmField'],'as':_0xb9c4('0x57')}]});}return null;})[_0xb9c4('0x1b')](respondWithResult(_0x1a3ece,null))['catch'](handleError(_0x1a3ece,null));};exports['getFields']=function(_0x43282e,_0x2c47ad,_0x19319a){var _0xafc983='';var _0x433321=['id','name',_0xb9c4('0x59'),'created_by',_0xb9c4('0x5a'),_0xb9c4('0x5b'),_0xb9c4('0x5c'),'duration_minutes','parent_id',_0xb9c4('0x5d'),'parent_name','direction'];return db['SugarcrmAccount'][_0xb9c4('0x4f')]({'where':{'id':_0x43282e[_0xb9c4('0x4a')]['id']},'attributes':['id',_0xb9c4('0x5e'),_0xb9c4('0x5f'),_0xb9c4('0x60')]})[_0xb9c4('0x1b')](handleEntityNotFound(_0x2c47ad,null))[_0xb9c4('0x1b')](function(_0x3e2b3b){if(_0x3e2b3b){_0xafc983=_0x3e2b3b['remoteUri'];var _0x4b26b3=_0xafc983[_0xb9c4('0x61')](-0x1);if(_0x4b26b3==='/'){_0xafc983=_0xafc983[_0xb9c4('0x62')](0x0,_0xafc983['lastIndexOf'](_0x4b26b3));}return rp({'method':_0xb9c4('0x63'),'uri':util[_0xb9c4('0x64')](_0xb9c4('0x65'),_0xafc983,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0xb9c4('0x66'),'input_type':'JSON','response_type':_0xb9c4('0x67'),'rest_data':JSON[_0xb9c4('0x1f')]({'user_auth':{'user_name':_0x3e2b3b[_0xb9c4('0x5e')],'password':_0x3e2b3b[_0xb9c4('0x5f')],'encryption':'PLAIN'},'application':_0xb9c4('0x68')})}});}})[_0xb9c4('0x1b')](function(_0x103d0d){if(_0x103d0d&&_0x103d0d[_0xb9c4('0x2f')]!=='Invalid\x20Login'&&_0x103d0d[_0xb9c4('0x2f')]!==_0xb9c4('0x69')){return rp({'method':_0xb9c4('0x63'),'uri':util['format']('%s%s',_0xafc983,_0xb9c4('0x6a')),'json':!![],'form':{'method':_0xb9c4('0x6b'),'input_type':_0xb9c4('0x67'),'response_type':'JSON','rest_data':JSON[_0xb9c4('0x1f')]({'session':_0x103d0d['id'],'module_name':_0xb9c4('0x6c')})}})[_0xb9c4('0x1b')](function(_0x1a53e5){if(_0x1a53e5){var _0x560c31=_[_0xb9c4('0x6d')](_0x1a53e5[_0xb9c4('0x6e')]);_['remove'](_0x560c31,function(_0x48d634){return _0x433321[_0xb9c4('0x6f')](_0x48d634['name']);});return{'count':_0x560c31[_0xb9c4('0x3a')],'rows':_['map'](_0x560c31,function(_0x207df6){return{'id':_0x207df6['name'],'name':_0x207df6[_0xb9c4('0x70')],'custom':_['endsWith'](_0x207df6[_0xb9c4('0x2f')],'_c')?!![]:![],'options':_0x207df6[_0xb9c4('0x44')]?_[_0xb9c4('0x43')](_[_0xb9c4('0x6d')](_0x207df6[_0xb9c4('0x44')]),function(_0x1dea27){return{'name':_0x1dea27['value'],'value':_0x1dea27['name']};}):[]};})};}})[_0xb9c4('0x1b')](respondWithResult(_0x2c47ad,null))[_0xb9c4('0x23')](function(_0x1ddfc0){var _0x4edb3b=_0x43282e[_0xb9c4('0x36')][_0xb9c4('0x17')]?0x1f4:_0x1ddfc0[_0xb9c4('0x71')]||0x1f4;logger[_0xb9c4('0x20')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x4edb3b,JSON['stringify'](_0x1ddfc0));delete _0x1ddfc0[_0xb9c4('0x2f')];if(_0x4edb3b===0x191){_0x4edb3b=0x190;}_0x2c47ad[_0xb9c4('0x25')](_0x4edb3b)[_0xb9c4('0x30')](_0x43282e[_0xb9c4('0x36')][_0xb9c4('0x17')]?{'message':_0xb9c4('0x72'),'statusCode':_0x1ddfc0[_0xb9c4('0x71')]}:_0x1ddfc0);});}else{var _0x25a113=0x1f4;_0x2c47ad['status'](_0x25a113)[_0xb9c4('0x30')]({'message':_0xb9c4('0x72'),'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 42b3a9b..fdd591d 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 _0xf730=['lodash','util','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','../../components/integrations/configuration','exports','define','int_sugarcrm_accounts'];(function(_0x1c546c,_0x5c57cb){var _0x2cc384=function(_0x4dee11){while(--_0x4dee11){_0x1c546c['push'](_0x1c546c['shift']());}};_0x2cc384(++_0x5c57cb);}(_0xf730,0xbb));var _0x0f73=function(_0xd5f8c9,_0xdf425b){_0xd5f8c9=_0xd5f8c9-0x0;var _0x5ae8f6=_0xf730[_0xd5f8c9];return _0x5ae8f6;};'use strict';var _=require(_0x0f73('0x0'));var util=require(_0x0f73('0x1'));var logger=require(_0x0f73('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0f73('0x3'));var rp=require(_0x0f73('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0f73('0x5'));var config=require(_0x0f73('0x6'));var attributes=require('./intSugarcrmAccount.attributes');var integrations=require(_0x0f73('0x7'));module[_0x0f73('0x8')]=function(_0x525d7d,_0x3c5ccc){return _0x525d7d[_0x0f73('0x9')]('SugarcrmAccount',attributes,{'tableName':_0x0f73('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa263=['int_sugarcrm_accounts','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmAccount.attributes','exports','define','SugarcrmAccount'];(function(_0x326ac6,_0x20e9c8){var _0x5378c8=function(_0x1bf223){while(--_0x1bf223){_0x326ac6['push'](_0x326ac6['shift']());}};_0x5378c8(++_0x20e9c8);}(_0xa263,0x135));var _0x3a26=function(_0x3b47a4,_0x2d3b0){_0x3b47a4=_0x3b47a4-0x0;var _0x4b9586=_0xa263[_0x3b47a4];return _0x4b9586;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x3a26('0x0'));var BPromise=require(_0x3a26('0x1'));var rp=require(_0x3a26('0x2'));var fs=require('fs');var path=require(_0x3a26('0x3'));var rimraf=require(_0x3a26('0x4'));var config=require(_0x3a26('0x5'));var attributes=require(_0x3a26('0x6'));var integrations=require('../../components/integrations/configuration');module[_0x3a26('0x7')]=function(_0x5f9ead,_0x47940f){return _0x5f9ead[_0x3a26('0x8')](_0x3a26('0x9'),attributes,{'tableName':_0x3a26('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js index e110cee..ebe760f 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 _0x63f6=['../../config/logger','rpc','jayson/promise','request','then','info','SugarcrmAccount,\x20%s,\x20%s','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','findAll','options','raw','where','limit','include','map','model','attributes','GetSugarcrmAccount','ShowSugarcrmAccount','SugarcrmAccount','find','lodash','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x5948dc,_0x4e17e0){var _0x5424cf=function(_0x37ddee){while(--_0x37ddee){_0x5948dc['push'](_0x5948dc['shift']());}};_0x5424cf(++_0x4e17e0);}(_0x63f6,0x14e));var _0x663f=function(_0x4a0f62,_0x19f781){_0x4a0f62=_0x4a0f62-0x0;var _0x3ffcc1=_0x63f6[_0x4a0f62];return _0x3ffcc1;};'use strict';var _=require(_0x663f('0x0'));var util=require(_0x663f('0x1'));var moment=require(_0x663f('0x2'));var BPromise=require(_0x663f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x663f('0x4'));var db=require(_0x663f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x663f('0x6'))(_0x663f('0x7'));var config=require('../../config/environment');var jayson=require(_0x663f('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x12e9da,_0x1522af,_0x2cfe5e){return new BPromise(function(_0x22a87d,_0x75ac11){return client[_0x663f('0x9')](_0x12e9da,_0x2cfe5e)[_0x663f('0xa')](function(_0x30c217){logger[_0x663f('0xb')](_0x663f('0xc'),_0x1522af,'request\x20sent');logger[_0x663f('0xd')](_0x663f('0xe'),_0x1522af,_0x663f('0xf'),JSON[_0x663f('0x10')](_0x30c217));if(_0x30c217[_0x663f('0x11')]){if(_0x30c217['error'][_0x663f('0x12')]===0x1f4){logger[_0x663f('0x11')](_0x663f('0xc'),_0x1522af,_0x30c217[_0x663f('0x11')][_0x663f('0x13')]);return _0x75ac11(_0x30c217['error'][_0x663f('0x13')]);}logger[_0x663f('0x11')](_0x663f('0xc'),_0x1522af,_0x30c217[_0x663f('0x11')][_0x663f('0x13')]);return _0x22a87d(_0x30c217[_0x663f('0x11')][_0x663f('0x13')]);}else{logger[_0x663f('0xb')]('SugarcrmAccount,\x20%s,\x20%s',_0x1522af,'request\x20sent');_0x22a87d(_0x30c217['result']['message']);}})[_0x663f('0x14')](function(_0x581f3b){logger[_0x663f('0x11')]('SugarcrmAccount,\x20%s,\x20%s',_0x1522af,_0x581f3b);_0x75ac11(_0x581f3b);});});}exports['GetSugarcrmAccount']=function(_0x44559b){var _0x1f7cda=this;return new Promise(function(_0x329e1e,_0x40d44d){return db['SugarcrmAccount'][_0x663f('0x15')]({'raw':_0x44559b[_0x663f('0x16')]?_0x44559b[_0x663f('0x16')][_0x663f('0x17')]===undefined?!![]:![]:!![],'where':_0x44559b[_0x663f('0x16')]?_0x44559b[_0x663f('0x16')][_0x663f('0x18')]||null:null,'attributes':_0x44559b['options']?_0x44559b['options']['attributes']||null:null,'limit':_0x44559b['options']?_0x44559b[_0x663f('0x16')][_0x663f('0x19')]||null:null,'include':_0x44559b[_0x663f('0x16')]?_0x44559b[_0x663f('0x16')][_0x663f('0x1a')]?_[_0x663f('0x1b')](_0x44559b[_0x663f('0x16')][_0x663f('0x1a')],function(_0x59f119){return{'model':db[_0x59f119[_0x663f('0x1c')]],'as':_0x59f119['as'],'attributes':_0x59f119[_0x663f('0x1d')],'include':_0x59f119[_0x663f('0x1a')]?_['map'](_0x59f119[_0x663f('0x1a')],function(_0x1f033c){return{'model':db[_0x1f033c[_0x663f('0x1c')]],'as':_0x1f033c['as'],'attributes':_0x1f033c[_0x663f('0x1d')],'include':_0x1f033c[_0x663f('0x1a')]?_[_0x663f('0x1b')](_0x1f033c[_0x663f('0x1a')],function(_0x55ba87){return{'model':db[_0x55ba87[_0x663f('0x1c')]],'as':_0x55ba87['as'],'attributes':_0x55ba87[_0x663f('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x663f('0xa')](function(_0x380f6){logger[_0x663f('0xb')](_0x663f('0x1e'),_0x44559b);logger[_0x663f('0xd')](_0x663f('0x1e'),_0x44559b,JSON[_0x663f('0x10')](_0x380f6));_0x329e1e(_0x380f6);})[_0x663f('0x14')](function(_0x652382){logger['error'](_0x663f('0x1e'),_0x652382['message'],_0x44559b);_0x40d44d(_0x1f7cda[_0x663f('0x11')](0x1f4,_0x652382['message']));});});};exports[_0x663f('0x1f')]=function(_0x247eb9){var _0x512eec=this;return new Promise(function(_0x3e4191,_0x2446b3){return db[_0x663f('0x20')][_0x663f('0x21')]({'raw':_0x247eb9[_0x663f('0x16')]?_0x247eb9[_0x663f('0x16')][_0x663f('0x17')]===undefined?!![]:![]:!![],'where':_0x247eb9[_0x663f('0x16')]?_0x247eb9[_0x663f('0x16')]['where']||null:null,'attributes':_0x247eb9[_0x663f('0x16')]?_0x247eb9[_0x663f('0x16')][_0x663f('0x1d')]||null:null,'include':_0x247eb9['options']?_0x247eb9[_0x663f('0x16')][_0x663f('0x1a')]?_[_0x663f('0x1b')](_0x247eb9[_0x663f('0x16')][_0x663f('0x1a')],function(_0x2d111a){return{'model':db[_0x2d111a[_0x663f('0x1c')]],'as':_0x2d111a['as'],'attributes':_0x2d111a['attributes'],'include':_0x2d111a[_0x663f('0x1a')]?_[_0x663f('0x1b')](_0x2d111a[_0x663f('0x1a')],function(_0x59544a){return{'model':db[_0x59544a['model']],'as':_0x59544a['as'],'attributes':_0x59544a[_0x663f('0x1d')],'include':_0x59544a['include']?_[_0x663f('0x1b')](_0x59544a[_0x663f('0x1a')],function(_0x17dd9e){return{'model':db[_0x17dd9e[_0x663f('0x1c')]],'as':_0x17dd9e['as'],'attributes':_0x17dd9e[_0x663f('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x663f('0xa')](function(_0x3c0743){logger[_0x663f('0xb')](_0x663f('0x1f'),_0x247eb9);logger['debug']('ShowSugarcrmAccount',_0x247eb9,JSON[_0x663f('0x10')](_0x3c0743));_0x3e4191(_0x3c0743);})['catch'](function(_0x2d83b3){logger['error'](_0x663f('0x1f'),_0x2d83b3['message'],_0x247eb9);_0x2446b3(_0x512eec[_0x663f('0x11')](0x1f4,_0x2d83b3[_0x663f('0x13')]));});});}; \ No newline at end of file +var _0xb7cd=['rpc','jayson/promise','http','then','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','GetSugarcrmAccount','options','raw','where','attributes','limit','include','map','model','stringify','SugarcrmAccount','find','ShowSugarcrmAccount','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x184438,_0x3ea61c){var _0x1f2c93=function(_0x5ed587){while(--_0x5ed587){_0x184438['push'](_0x184438['shift']());}};_0x1f2c93(++_0x3ea61c);}(_0xb7cd,0x1b2));var _0xdb7c=function(_0x490532,_0x50cb77){_0x490532=_0x490532-0x0;var _0x5993e5=_0xb7cd[_0x490532];return _0x5993e5;};'use strict';var _=require(_0xdb7c('0x0'));var util=require(_0xdb7c('0x1'));var moment=require(_0xdb7c('0x2'));var BPromise=require(_0xdb7c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdb7c('0x4'));var db=require(_0xdb7c('0x5'))['db'];var utils=require(_0xdb7c('0x6'));var logger=require(_0xdb7c('0x7'))(_0xdb7c('0x8'));var config=require('../../config/environment');var jayson=require(_0xdb7c('0x9'));var client=jayson['client'][_0xdb7c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xf60f09,_0x22bd36,_0x328a59){return new BPromise(function(_0x2fc46b,_0x3132c5){return client['request'](_0xf60f09,_0x328a59)[_0xdb7c('0xb')](function(_0x1960cd){logger['info'](_0xdb7c('0xc'),_0x22bd36,_0xdb7c('0xd'));logger[_0xdb7c('0xe')](_0xdb7c('0xf'),_0x22bd36,'request\x20sent',JSON['stringify'](_0x1960cd));if(_0x1960cd['error']){if(_0x1960cd[_0xdb7c('0x10')][_0xdb7c('0x11')]===0x1f4){logger[_0xdb7c('0x10')](_0xdb7c('0xc'),_0x22bd36,_0x1960cd[_0xdb7c('0x10')][_0xdb7c('0x12')]);return _0x3132c5(_0x1960cd[_0xdb7c('0x10')][_0xdb7c('0x12')]);}logger[_0xdb7c('0x10')](_0xdb7c('0xc'),_0x22bd36,_0x1960cd['error'][_0xdb7c('0x12')]);return _0x2fc46b(_0x1960cd[_0xdb7c('0x10')][_0xdb7c('0x12')]);}else{logger[_0xdb7c('0x13')](_0xdb7c('0xc'),_0x22bd36,_0xdb7c('0xd'));_0x2fc46b(_0x1960cd['result'][_0xdb7c('0x12')]);}})[_0xdb7c('0x14')](function(_0x5e2247){logger[_0xdb7c('0x10')](_0xdb7c('0xc'),_0x22bd36,_0x5e2247);_0x3132c5(_0x5e2247);});});}exports[_0xdb7c('0x15')]=function(_0x3ccbd5){var _0x5d2a9c=this;return new Promise(function(_0x26ecfe,_0x41a1cb){return db['SugarcrmAccount']['findAll']({'raw':_0x3ccbd5['options']?_0x3ccbd5[_0xdb7c('0x16')][_0xdb7c('0x17')]===undefined?!![]:![]:!![],'where':_0x3ccbd5[_0xdb7c('0x16')]?_0x3ccbd5[_0xdb7c('0x16')][_0xdb7c('0x18')]||null:null,'attributes':_0x3ccbd5['options']?_0x3ccbd5[_0xdb7c('0x16')][_0xdb7c('0x19')]||null:null,'limit':_0x3ccbd5[_0xdb7c('0x16')]?_0x3ccbd5['options'][_0xdb7c('0x1a')]||null:null,'include':_0x3ccbd5[_0xdb7c('0x16')]?_0x3ccbd5[_0xdb7c('0x16')][_0xdb7c('0x1b')]?_[_0xdb7c('0x1c')](_0x3ccbd5[_0xdb7c('0x16')][_0xdb7c('0x1b')],function(_0xfe7ef2){return{'model':db[_0xfe7ef2['model']],'as':_0xfe7ef2['as'],'attributes':_0xfe7ef2['attributes'],'include':_0xfe7ef2[_0xdb7c('0x1b')]?_[_0xdb7c('0x1c')](_0xfe7ef2[_0xdb7c('0x1b')],function(_0x1c4ef4){return{'model':db[_0x1c4ef4[_0xdb7c('0x1d')]],'as':_0x1c4ef4['as'],'attributes':_0x1c4ef4[_0xdb7c('0x19')],'include':_0x1c4ef4[_0xdb7c('0x1b')]?_[_0xdb7c('0x1c')](_0x1c4ef4[_0xdb7c('0x1b')],function(_0x57933f){return{'model':db[_0x57933f[_0xdb7c('0x1d')]],'as':_0x57933f['as'],'attributes':_0x57933f[_0xdb7c('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4edcf0){logger['info'](_0xdb7c('0x15'),_0x3ccbd5);logger[_0xdb7c('0xe')](_0xdb7c('0x15'),_0x3ccbd5,JSON[_0xdb7c('0x1e')](_0x4edcf0));_0x26ecfe(_0x4edcf0);})[_0xdb7c('0x14')](function(_0x18a014){logger[_0xdb7c('0x10')](_0xdb7c('0x15'),_0x18a014[_0xdb7c('0x12')],_0x3ccbd5);_0x41a1cb(_0x5d2a9c[_0xdb7c('0x10')](0x1f4,_0x18a014['message']));});});};exports['ShowSugarcrmAccount']=function(_0x34b948){var _0x4c1429=this;return new Promise(function(_0x5af9aa,_0x1c0461){return db[_0xdb7c('0x1f')][_0xdb7c('0x20')]({'raw':_0x34b948[_0xdb7c('0x16')]?_0x34b948['options']['raw']===undefined?!![]:![]:!![],'where':_0x34b948['options']?_0x34b948[_0xdb7c('0x16')][_0xdb7c('0x18')]||null:null,'attributes':_0x34b948[_0xdb7c('0x16')]?_0x34b948[_0xdb7c('0x16')][_0xdb7c('0x19')]||null:null,'include':_0x34b948[_0xdb7c('0x16')]?_0x34b948[_0xdb7c('0x16')][_0xdb7c('0x1b')]?_['map'](_0x34b948[_0xdb7c('0x16')][_0xdb7c('0x1b')],function(_0x504348){return{'model':db[_0x504348[_0xdb7c('0x1d')]],'as':_0x504348['as'],'attributes':_0x504348[_0xdb7c('0x19')],'include':_0x504348[_0xdb7c('0x1b')]?_['map'](_0x504348[_0xdb7c('0x1b')],function(_0x5e526){return{'model':db[_0x5e526[_0xdb7c('0x1d')]],'as':_0x5e526['as'],'attributes':_0x5e526[_0xdb7c('0x19')],'include':_0x5e526['include']?_['map'](_0x5e526[_0xdb7c('0x1b')],function(_0x2f25f9){return{'model':db[_0x2f25f9[_0xdb7c('0x1d')]],'as':_0x2f25f9['as'],'attributes':_0x2f25f9[_0xdb7c('0x19')]};}):[]};}):[]};}):[]:[]})[_0xdb7c('0xb')](function(_0x153246){logger[_0xdb7c('0x13')]('ShowSugarcrmAccount',_0x34b948);logger['debug']('ShowSugarcrmAccount',_0x34b948,JSON[_0xdb7c('0x1e')](_0x153246));_0x5af9aa(_0x153246);})[_0xdb7c('0x14')](function(_0x284801){logger[_0xdb7c('0x10')](_0xdb7c('0x21'),_0x284801[_0xdb7c('0x12')],_0x34b948);_0x1c0461(_0x4c1429[_0xdb7c('0x10')](0x1f4,_0x284801[_0xdb7c('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 1c62236..d248173 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 _0x9b86=['update','/:id','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','isAuthenticated','index','get','show','/:id/fields','/:id/subjects','/:id/descriptions','create','put'];(function(_0x22f11e,_0x23d641){var _0x322fc6=function(_0x2b6ced){while(--_0x2b6ced){_0x22f11e['push'](_0x22f11e['shift']());}};_0x322fc6(++_0x23d641);}(_0x9b86,0xb8));var _0x69b8=function(_0x4a52b2,_0x2f21b6){_0x4a52b2=_0x4a52b2-0x0;var _0x1ce864=_0x9b86[_0x4a52b2];return _0x1ce864;};'use strict';var multer=require('multer');var util=require(_0x69b8('0x0'));var path=require(_0x69b8('0x1'));var timeout=require(_0x69b8('0x2'));var express=require('express');var router=express[_0x69b8('0x3')]();var auth=require(_0x69b8('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intSugarcrmConfiguration.controller');router['get']('/',auth[_0x69b8('0x5')](),controller[_0x69b8('0x6')]);router[_0x69b8('0x7')]('/:id',auth[_0x69b8('0x5')](),controller[_0x69b8('0x8')]);router[_0x69b8('0x7')](_0x69b8('0x9'),auth[_0x69b8('0x5')](),controller['getFields']);router[_0x69b8('0x7')](_0x69b8('0xa'),auth[_0x69b8('0x5')](),controller['getSubjects']);router['get'](_0x69b8('0xb'),auth['isAuthenticated'](),controller['getDescriptions']);router['post']('/',auth[_0x69b8('0x5')](),controller[_0x69b8('0xc')]);router[_0x69b8('0xd')]('/:id',auth[_0x69b8('0x5')](),controller[_0x69b8('0xe')]);router['delete'](_0x69b8('0xf'),auth[_0x69b8('0x5')](),controller[_0x69b8('0x10')]);module[_0x69b8('0x11')]=router; \ No newline at end of file +var _0x4cf2=['multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/descriptions','post','create','put','delete','destroy'];(function(_0x412b69,_0x19e9b7){var _0x2edc60=function(_0x21a7fe){while(--_0x21a7fe){_0x412b69['push'](_0x412b69['shift']());}};_0x2edc60(++_0x19e9b7);}(_0x4cf2,0x1a4));var _0x24cf=function(_0x460666,_0x24bfa0){_0x460666=_0x460666-0x0;var _0x555cbf=_0x4cf2[_0x460666];return _0x555cbf;};'use strict';var multer=require(_0x24cf('0x0'));var util=require(_0x24cf('0x1'));var path=require('path');var timeout=require(_0x24cf('0x2'));var express=require(_0x24cf('0x3'));var router=express['Router']();var auth=require(_0x24cf('0x4'));var interaction=require(_0x24cf('0x5'));var config=require(_0x24cf('0x6'));var controller=require(_0x24cf('0x7'));router[_0x24cf('0x8')]('/',auth['isAuthenticated'](),controller[_0x24cf('0x9')]);router[_0x24cf('0x8')](_0x24cf('0xa'),auth[_0x24cf('0xb')](),controller[_0x24cf('0xc')]);router['get'](_0x24cf('0xd'),auth[_0x24cf('0xb')](),controller[_0x24cf('0xe')]);router[_0x24cf('0x8')]('/:id/subjects',auth[_0x24cf('0xb')](),controller['getSubjects']);router[_0x24cf('0x8')](_0x24cf('0xf'),auth[_0x24cf('0xb')](),controller['getDescriptions']);router[_0x24cf('0x10')]('/',auth[_0x24cf('0xb')](),controller[_0x24cf('0x11')]);router[_0x24cf('0x12')](_0x24cf('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x24cf('0x13')](_0x24cf('0xa'),auth['isAuthenticated'](),controller[_0x24cf('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 2be282a..81342e6 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 _0xf914=['exports','STRING','sequelize'];(function(_0x390a19,_0x5dd137){var _0x5d8230=function(_0x2e6234){while(--_0x2e6234){_0x390a19['push'](_0x390a19['shift']());}};_0x5d8230(++_0x5dd137);}(_0xf914,0x7a));var _0x4f91=function(_0x736eb,_0x345088){_0x736eb=_0x736eb-0x0;var _0x30ea13=_0xf914[_0x736eb];return _0x30ea13;};'use strict';var Sequelize=require(_0x4f91('0x0'));module[_0x4f91('0x1')]={'name':{'type':Sequelize[_0x4f91('0x2')]},'description':{'type':Sequelize[_0x4f91('0x2')]}}; \ No newline at end of file +var _0x3830=['exports','STRING','sequelize'];(function(_0x5a621d,_0x32b544){var _0x43925c=function(_0x2c9e0f){while(--_0x2c9e0f){_0x5a621d['push'](_0x5a621d['shift']());}};_0x43925c(++_0x32b544);}(_0x3830,0x10d));var _0x0383=function(_0x35ad5c,_0x58ccf7){_0x35ad5c=_0x35ad5c-0x0;var _0x2bd8aa=_0x3830[_0x35ad5c];return _0x2bd8aa;};'use strict';var Sequelize=require(_0x0383('0x0'));module[_0x0383('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x0383('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 297b409..a41a131 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 _0xc4c4=['../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','jayson/promise','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','status','count','offset','set','Content-Range','reject','save','update','end','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','SugarcrmConfiguration','includeAll','include','findAll','catch','show','params','length','create','body','find','getFields','findOne','SugarcrmField','getSubjects','getDescriptions','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x485b5a,_0x2b289b){var _0xd2b34d=function(_0x34dcbd){while(--_0x34dcbd){_0x485b5a['push'](_0x485b5a['shift']());}};_0xd2b34d(++_0x2b289b);}(_0xc4c4,0xfb));var _0x4c4c=function(_0x24697b,_0x2eb072){_0x24697b=_0x24697b-0x0;var _0x585b99=_0xc4c4[_0x24697b];return _0x585b99;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x4c4c('0x0'));var zipdir=require(_0x4c4c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4c4c('0x2'));var moment=require(_0x4c4c('0x3'));var BPromise=require(_0x4c4c('0x4'));var Mustache=require('mustache');var util=require(_0x4c4c('0x5'));var path=require(_0x4c4c('0x6'));var sox=require(_0x4c4c('0x7'));var csv=require(_0x4c4c('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x4c4c('0x9'));var squel=require(_0x4c4c('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4c4c('0xb'));var toCsv=require('to-csv');var querystring=require(_0x4c4c('0xc'));var Papa=require('papaparse');var Redis=require(_0x4c4c('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x4c4c('0xe'));var as=require(_0x4c4c('0xf'));var hardwareService=require(_0x4c4c('0x10'));var logger=require(_0x4c4c('0x11'))('api');var utils=require(_0x4c4c('0x12'));var config=require('../../config/environment');var db=require(_0x4c4c('0x13'))['db'];var jayson=require(_0x4c4c('0x14'));var client=jayson['client'][_0x4c4c('0x15')]({'port':0x232a});function checkPasswordPattern(_0xa68994,_0x2007b9,_0x402652){if(_0x402652){var _0x3d647b=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3d647b[_0x4c4c('0x16')](_0x2007b9)){return _0xa68994;}else{throw new db[(_0x4c4c('0x17'))][(_0x4c4c('0x18'))](_0x4c4c('0x19'));}}else{return _0xa68994;}}function respondWithRpcPromise(_0x1bf115,_0x426c21,_0x467942,_0x3f9bf0){return new BPromise(function(_0x4cd114,_0x2ff8af){var _0x3c5591=_0x3f9bf0||client;return _0x3c5591[_0x4c4c('0x1a')](_0x1bf115,_0x467942)[_0x4c4c('0x1b')](function(_0x92a223){logger[_0x4c4c('0x1c')](_0x4c4c('0x1d'),_0x426c21,_0x4c4c('0x1e'));logger[_0x4c4c('0x1f')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x426c21,_0x4c4c('0x1e'),JSON[_0x4c4c('0x20')](_0x92a223));if(_0x92a223['error']){if(_0x92a223['error'][_0x4c4c('0x21')]===0x1f4){logger[_0x4c4c('0x22')](_0x4c4c('0x1d'),_0x426c21,_0x92a223[_0x4c4c('0x22')][_0x4c4c('0x23')]);return _0x2ff8af(_0x92a223['error'][_0x4c4c('0x23')]);}logger['error']('SugarcrmConfiguration,\x20%s,\x20%s',_0x426c21,_0x92a223[_0x4c4c('0x22')][_0x4c4c('0x23')]);return _0x4cd114(_0x92a223[_0x4c4c('0x22')][_0x4c4c('0x23')]);}else{logger[_0x4c4c('0x1c')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x426c21,'request\x20sent');_0x4cd114(_0x92a223[_0x4c4c('0x24')][_0x4c4c('0x23')]);}})['catch'](function(_0x4497a1){logger['error'](_0x4c4c('0x1d'),_0x426c21,_0x4497a1);_0x2ff8af(_0x4497a1);});});}function respondWithStatusCode(_0x456359,_0x428c7e){_0x428c7e=_0x428c7e||0xcc;return function(_0x1b59bb){if(_0x1b59bb){return _0x456359['sendStatus'](_0x428c7e);}return _0x456359[_0x4c4c('0x25')](_0x428c7e)['end']();};}function respondWithResult(_0x53fa73,_0xc5ec3a){_0xc5ec3a=_0xc5ec3a||0xc8;return function(_0x23b466){if(_0x23b466){return _0x53fa73[_0x4c4c('0x25')](_0xc5ec3a)['json'](_0x23b466);}};}function respondWithFilteredResult(_0x439043,_0x4ba702){return function(_0x550301){if(_0x550301){var _0x313de3=_0x550301[_0x4c4c('0x26')],_0x16ca08=_0x4ba702[_0x4c4c('0x27')],_0x5e307e=_0x4ba702[_0x4c4c('0x27')]+_0x4ba702['limit'],_0x169a25;if(_0x5e307e>=_0x313de3){_0x5e307e=_0x313de3;_0x169a25=0xc8;}else{_0x169a25=0xce;}_0x439043[_0x4c4c('0x25')](_0x169a25);return _0x439043[_0x4c4c('0x28')](_0x4c4c('0x29'),_0x16ca08+'-'+_0x5e307e+'/'+_0x313de3)['json'](_0x550301);}return null;};}function patchUpdates(_0x43cc95){return function(_0x5f0fbe){try{jsonpatch['apply'](_0x5f0fbe,_0x43cc95,!![]);}catch(_0x1eab24){return BPromise[_0x4c4c('0x2a')](_0x1eab24);}return _0x5f0fbe[_0x4c4c('0x2b')]();};}function saveUpdates(_0x2aa2de,_0x539758){return function(_0x5f2e81){if(_0x5f2e81){return _0x5f2e81[_0x4c4c('0x2c')](_0x2aa2de)['then'](function(_0x22f434){return _0x22f434;});}return null;};}function removeEntity(_0x47863c,_0x28911a){return function(_0x21f6a1){if(_0x21f6a1){return _0x21f6a1['destroy']()[_0x4c4c('0x1b')](function(){_0x47863c[_0x4c4c('0x25')](0xcc)[_0x4c4c('0x2d')]();});}};}function handleEntityNotFound(_0x3556b0,_0x294e54){return function(_0xa98232){if(!_0xa98232){_0x3556b0[_0x4c4c('0x2e')](0x194);}return _0xa98232;};}function handleError(_0x2be7d3,_0x1d2942){_0x1d2942=_0x1d2942||0x1f4;return function(_0x3da1ec){logger[_0x4c4c('0x22')](_0x3da1ec[_0x4c4c('0x2f')]);if(_0x3da1ec[_0x4c4c('0x30')]){delete _0x3da1ec[_0x4c4c('0x30')];}_0x2be7d3[_0x4c4c('0x25')](_0x1d2942)[_0x4c4c('0x31')](_0x3da1ec);};}exports[_0x4c4c('0x32')]=function(_0x5b4249,_0xc81825){var _0x4eb6ef={},_0x45803f={},_0xe8ea84={'count':0x0,'rows':[]};var _0x1d02e5=_[_0x4c4c('0x33')](db['SugarcrmConfiguration'][_0x4c4c('0x34')],function(_0x1c43c1){return{'name':_0x1c43c1[_0x4c4c('0x35')],'type':_0x1c43c1[_0x4c4c('0x36')][_0x4c4c('0x37')]};});_0x45803f[_0x4c4c('0x38')]=_['map'](_0x1d02e5,_0x4c4c('0x30'));_0x45803f[_0x4c4c('0x39')]=_[_0x4c4c('0x3a')](_0x5b4249[_0x4c4c('0x39')]);_0x45803f[_0x4c4c('0x3b')]=_['intersection'](_0x45803f[_0x4c4c('0x38')],_0x45803f[_0x4c4c('0x39')]);_0x4eb6ef[_0x4c4c('0x3c')]=_[_0x4c4c('0x3d')](_0x45803f[_0x4c4c('0x38')],qs[_0x4c4c('0x3e')](_0x5b4249[_0x4c4c('0x39')]['fields']));_0x4eb6ef['attributes']=_0x4eb6ef[_0x4c4c('0x3c')]['length']?_0x4eb6ef['attributes']:_0x45803f[_0x4c4c('0x38')];if(!_0x5b4249['query'][_0x4c4c('0x3f')]('nolimit')){_0x4eb6ef[_0x4c4c('0x40')]=qs[_0x4c4c('0x40')](_0x5b4249[_0x4c4c('0x39')][_0x4c4c('0x40')]);_0x4eb6ef[_0x4c4c('0x27')]=qs['offset'](_0x5b4249['query'][_0x4c4c('0x27')]);}_0x4eb6ef[_0x4c4c('0x41')]=qs[_0x4c4c('0x42')](_0x5b4249[_0x4c4c('0x39')][_0x4c4c('0x42')]);_0x4eb6ef[_0x4c4c('0x43')]=qs['filters'](_[_0x4c4c('0x44')](_0x5b4249[_0x4c4c('0x39')],_0x45803f[_0x4c4c('0x3b')]),_0x1d02e5);if(_0x5b4249[_0x4c4c('0x39')][_0x4c4c('0x45')]){_0x4eb6ef['where']=_[_0x4c4c('0x46')](_0x4eb6ef[_0x4c4c('0x43')],{'$or':_[_0x4c4c('0x33')](_0x1d02e5,function(_0x42ee4b){if(_0x42ee4b[_0x4c4c('0x36')]!==_0x4c4c('0x47')){var _0x4ed756={};_0x4ed756[_0x42ee4b[_0x4c4c('0x30')]]={'$like':'%'+_0x5b4249[_0x4c4c('0x39')][_0x4c4c('0x45')]+'%'};return _0x4ed756;}})});}_0x4eb6ef=_['merge']({},_0x4eb6ef,_0x5b4249[_0x4c4c('0x48')]);var _0xc1b2c2={'where':_0x4eb6ef[_0x4c4c('0x43')]};return db[_0x4c4c('0x49')]['count'](_0xc1b2c2)['then'](function(_0x3a5208){_0xe8ea84[_0x4c4c('0x26')]=_0x3a5208;if(_0x5b4249[_0x4c4c('0x39')][_0x4c4c('0x4a')]){_0x4eb6ef[_0x4c4c('0x4b')]=[{'all':!![]}];}return db[_0x4c4c('0x49')][_0x4c4c('0x4c')](_0x4eb6ef);})[_0x4c4c('0x1b')](function(_0x410da1){_0xe8ea84['rows']=_0x410da1;return _0xe8ea84;})[_0x4c4c('0x1b')](respondWithFilteredResult(_0xc81825,_0x4eb6ef))[_0x4c4c('0x4d')](handleError(_0xc81825,null));};exports[_0x4c4c('0x4e')]=function(_0xefad7e,_0x575495){var _0x8c9fd2={'raw':![],'where':{'id':_0xefad7e[_0x4c4c('0x4f')]['id']}},_0x778b75={};_0x778b75[_0x4c4c('0x38')]=_[_0x4c4c('0x3a')](db[_0x4c4c('0x49')]['rawAttributes']);_0x778b75[_0x4c4c('0x39')]=_[_0x4c4c('0x3a')](_0xefad7e[_0x4c4c('0x39')]);_0x778b75[_0x4c4c('0x3b')]=_[_0x4c4c('0x3d')](_0x778b75[_0x4c4c('0x38')],_0x778b75[_0x4c4c('0x39')]);_0x8c9fd2[_0x4c4c('0x3c')]=_[_0x4c4c('0x3d')](_0x778b75[_0x4c4c('0x38')],qs[_0x4c4c('0x3e')](_0xefad7e[_0x4c4c('0x39')][_0x4c4c('0x3e')]));_0x8c9fd2['attributes']=_0x8c9fd2[_0x4c4c('0x3c')][_0x4c4c('0x50')]?_0x8c9fd2[_0x4c4c('0x3c')]:_0x778b75['model'];if(_0xefad7e[_0x4c4c('0x39')]['includeAll']){_0x8c9fd2[_0x4c4c('0x4b')]=[{'all':!![]}];}_0x8c9fd2=_[_0x4c4c('0x46')]({},_0x8c9fd2,_0xefad7e[_0x4c4c('0x48')]);return db[_0x4c4c('0x49')]['find'](_0x8c9fd2)[_0x4c4c('0x1b')](handleEntityNotFound(_0x575495,null))[_0x4c4c('0x1b')](respondWithResult(_0x575495,null))[_0x4c4c('0x4d')](handleError(_0x575495,null));};exports[_0x4c4c('0x51')]=function(_0x4d450b,_0x55c1f1){return db[_0x4c4c('0x49')][_0x4c4c('0x51')](_0x4d450b[_0x4c4c('0x52')],{})[_0x4c4c('0x1b')](respondWithResult(_0x55c1f1,0xc9))[_0x4c4c('0x4d')](handleError(_0x55c1f1,null));};exports[_0x4c4c('0x2c')]=function(_0x2c0695,_0x4c0961){if(_0x2c0695[_0x4c4c('0x52')]['id']){delete _0x2c0695['body']['id'];}return db[_0x4c4c('0x49')][_0x4c4c('0x53')]({'where':{'id':_0x2c0695[_0x4c4c('0x4f')]['id']}})['then'](handleEntityNotFound(_0x4c0961,null))[_0x4c4c('0x1b')](saveUpdates(_0x2c0695[_0x4c4c('0x52')],null))[_0x4c4c('0x1b')](respondWithResult(_0x4c0961,null))[_0x4c4c('0x4d')](handleError(_0x4c0961,null));};exports['destroy']=function(_0x3aed24,_0x562e2e){return db[_0x4c4c('0x49')]['find']({'where':{'id':_0x3aed24[_0x4c4c('0x4f')]['id']}})[_0x4c4c('0x1b')](handleEntityNotFound(_0x562e2e,null))[_0x4c4c('0x1b')](removeEntity(_0x562e2e,null))[_0x4c4c('0x4d')](handleError(_0x562e2e,null));};exports[_0x4c4c('0x54')]=function(_0x3ca25c,_0x54357f,_0x5bf06d){var _0x206651={};var _0x3ece58={};var _0x6101fc;var _0x50aea7;return db['SugarcrmConfiguration'][_0x4c4c('0x55')]({'where':{'id':_0x3ca25c['params']['id']}})[_0x4c4c('0x1b')](handleEntityNotFound(_0x54357f,null))['then'](function(_0x330fe1){if(_0x330fe1){_0x6101fc=_0x330fe1;_0x3ece58[_0x4c4c('0x38')]=_[_0x4c4c('0x3a')](db[_0x4c4c('0x56')][_0x4c4c('0x34')]);_0x3ece58[_0x4c4c('0x39')]=_[_0x4c4c('0x3a')](_0x3ca25c['query']);_0x3ece58['filters']=_[_0x4c4c('0x3d')](_0x3ece58['model'],_0x3ece58[_0x4c4c('0x39')]);_0x206651[_0x4c4c('0x3c')]=_[_0x4c4c('0x3d')](_0x3ece58['model'],qs[_0x4c4c('0x3e')](_0x3ca25c[_0x4c4c('0x39')][_0x4c4c('0x3e')]));_0x206651[_0x4c4c('0x3c')]=_0x206651[_0x4c4c('0x3c')][_0x4c4c('0x50')]?_0x206651[_0x4c4c('0x3c')]:_0x3ece58[_0x4c4c('0x38')];_0x206651[_0x4c4c('0x41')]=qs[_0x4c4c('0x42')](_0x3ca25c['query']['sort']);_0x206651['where']=qs['filters'](_['pick'](_0x3ca25c[_0x4c4c('0x39')],_0x3ece58['filters']));if(_0x3ca25c[_0x4c4c('0x39')][_0x4c4c('0x45')]){_0x206651[_0x4c4c('0x43')]=_[_0x4c4c('0x46')](_0x206651[_0x4c4c('0x43')],{'$or':_[_0x4c4c('0x33')](_0x206651['attributes'],function(_0x590606){var _0x5767aa={};_0x5767aa[_0x590606]={'$like':'%'+_0x3ca25c[_0x4c4c('0x39')][_0x4c4c('0x45')]+'%'};return _0x5767aa;})});}_0x206651=_[_0x4c4c('0x46')]({},_0x206651,_0x3ca25c[_0x4c4c('0x48')]);return _0x6101fc[_0x4c4c('0x54')](_0x206651);}})[_0x4c4c('0x1b')](function(_0x5e0988){if(_0x5e0988){_0x50aea7=_0x5e0988[_0x4c4c('0x50')];if(!_0x3ca25c['query'][_0x4c4c('0x3f')]('nolimit')){_0x206651[_0x4c4c('0x40')]=qs[_0x4c4c('0x40')](_0x3ca25c[_0x4c4c('0x39')][_0x4c4c('0x40')]);_0x206651[_0x4c4c('0x27')]=qs['offset'](_0x3ca25c['query'][_0x4c4c('0x27')]);}return _0x6101fc['getFields'](_0x206651);}})[_0x4c4c('0x1b')](function(_0x39b796){if(_0x39b796){return _0x39b796?{'count':_0x50aea7,'rows':_0x39b796}:null;}})[_0x4c4c('0x1b')](respondWithResult(_0x54357f,null))[_0x4c4c('0x4d')](handleError(_0x54357f,null));};exports[_0x4c4c('0x57')]=function(_0x5e08bc,_0x79c292,_0x28f321){var _0x131682={};var _0x1648ac={};var _0x5c21d0;var _0x1cef8a;return db[_0x4c4c('0x49')][_0x4c4c('0x55')]({'where':{'id':_0x5e08bc[_0x4c4c('0x4f')]['id']}})['then'](handleEntityNotFound(_0x79c292,null))[_0x4c4c('0x1b')](function(_0x2f7d8d){if(_0x2f7d8d){_0x5c21d0=_0x2f7d8d;_0x1648ac[_0x4c4c('0x38')]=_['keys'](db[_0x4c4c('0x56')][_0x4c4c('0x34')]);_0x1648ac['query']=_[_0x4c4c('0x3a')](_0x5e08bc['query']);_0x1648ac[_0x4c4c('0x3b')]=_[_0x4c4c('0x3d')](_0x1648ac['model'],_0x1648ac[_0x4c4c('0x39')]);_0x131682['attributes']=_['intersection'](_0x1648ac[_0x4c4c('0x38')],qs[_0x4c4c('0x3e')](_0x5e08bc[_0x4c4c('0x39')][_0x4c4c('0x3e')]));_0x131682['attributes']=_0x131682[_0x4c4c('0x3c')][_0x4c4c('0x50')]?_0x131682[_0x4c4c('0x3c')]:_0x1648ac[_0x4c4c('0x38')];_0x131682['order']=qs[_0x4c4c('0x42')](_0x5e08bc[_0x4c4c('0x39')][_0x4c4c('0x42')]);_0x131682[_0x4c4c('0x43')]=qs[_0x4c4c('0x3b')](_[_0x4c4c('0x44')](_0x5e08bc[_0x4c4c('0x39')],_0x1648ac[_0x4c4c('0x3b')]));if(_0x5e08bc[_0x4c4c('0x39')][_0x4c4c('0x45')]){_0x131682[_0x4c4c('0x43')]=_[_0x4c4c('0x46')](_0x131682[_0x4c4c('0x43')],{'$or':_[_0x4c4c('0x33')](_0x131682[_0x4c4c('0x3c')],function(_0x19fb92){var _0x30acb4={};_0x30acb4[_0x19fb92]={'$like':'%'+_0x5e08bc['query'][_0x4c4c('0x45')]+'%'};return _0x30acb4;})});}_0x131682=_[_0x4c4c('0x46')]({},_0x131682,_0x5e08bc[_0x4c4c('0x48')]);return _0x5c21d0[_0x4c4c('0x57')](_0x131682);}})[_0x4c4c('0x1b')](function(_0xa19e07){if(_0xa19e07){_0x1cef8a=_0xa19e07[_0x4c4c('0x50')];if(!_0x5e08bc[_0x4c4c('0x39')][_0x4c4c('0x3f')]('nolimit')){_0x131682[_0x4c4c('0x40')]=qs[_0x4c4c('0x40')](_0x5e08bc[_0x4c4c('0x39')]['limit']);_0x131682[_0x4c4c('0x27')]=qs[_0x4c4c('0x27')](_0x5e08bc[_0x4c4c('0x39')][_0x4c4c('0x27')]);}return _0x5c21d0[_0x4c4c('0x57')](_0x131682);}})[_0x4c4c('0x1b')](function(_0x251e12){if(_0x251e12){return _0x251e12?{'count':_0x1cef8a,'rows':_0x251e12}:null;}})[_0x4c4c('0x1b')](respondWithResult(_0x79c292,null))['catch'](handleError(_0x79c292,null));};exports['getDescriptions']=function(_0x5c15b0,_0x6bf1c0,_0x20f7c1){var _0x22aaa6={};var _0x16211f={};var _0x5ab9d5;var _0x28508e;return db[_0x4c4c('0x49')][_0x4c4c('0x55')]({'where':{'id':_0x5c15b0[_0x4c4c('0x4f')]['id']}})[_0x4c4c('0x1b')](handleEntityNotFound(_0x6bf1c0,null))[_0x4c4c('0x1b')](function(_0x399fff){if(_0x399fff){_0x5ab9d5=_0x399fff;_0x16211f['model']=_[_0x4c4c('0x3a')](db[_0x4c4c('0x56')][_0x4c4c('0x34')]);_0x16211f[_0x4c4c('0x39')]=_[_0x4c4c('0x3a')](_0x5c15b0[_0x4c4c('0x39')]);_0x16211f[_0x4c4c('0x3b')]=_[_0x4c4c('0x3d')](_0x16211f[_0x4c4c('0x38')],_0x16211f[_0x4c4c('0x39')]);_0x22aaa6[_0x4c4c('0x3c')]=_[_0x4c4c('0x3d')](_0x16211f[_0x4c4c('0x38')],qs['fields'](_0x5c15b0[_0x4c4c('0x39')][_0x4c4c('0x3e')]));_0x22aaa6[_0x4c4c('0x3c')]=_0x22aaa6[_0x4c4c('0x3c')][_0x4c4c('0x50')]?_0x22aaa6['attributes']:_0x16211f[_0x4c4c('0x38')];_0x22aaa6[_0x4c4c('0x41')]=qs[_0x4c4c('0x42')](_0x5c15b0[_0x4c4c('0x39')][_0x4c4c('0x42')]);_0x22aaa6[_0x4c4c('0x43')]=qs[_0x4c4c('0x3b')](_[_0x4c4c('0x44')](_0x5c15b0[_0x4c4c('0x39')],_0x16211f[_0x4c4c('0x3b')]));if(_0x5c15b0['query']['filter']){_0x22aaa6[_0x4c4c('0x43')]=_['merge'](_0x22aaa6['where'],{'$or':_[_0x4c4c('0x33')](_0x22aaa6[_0x4c4c('0x3c')],function(_0x22d22b){var _0x4cda29={};_0x4cda29[_0x22d22b]={'$like':'%'+_0x5c15b0[_0x4c4c('0x39')]['filter']+'%'};return _0x4cda29;})});}_0x22aaa6=_[_0x4c4c('0x46')]({},_0x22aaa6,_0x5c15b0['options']);return _0x5ab9d5[_0x4c4c('0x58')](_0x22aaa6);}})[_0x4c4c('0x1b')](function(_0x2c7c7c){if(_0x2c7c7c){_0x28508e=_0x2c7c7c[_0x4c4c('0x50')];if(!_0x5c15b0['query'][_0x4c4c('0x3f')]('nolimit')){_0x22aaa6[_0x4c4c('0x40')]=qs[_0x4c4c('0x40')](_0x5c15b0[_0x4c4c('0x39')][_0x4c4c('0x40')]);_0x22aaa6[_0x4c4c('0x27')]=qs['offset'](_0x5c15b0[_0x4c4c('0x39')][_0x4c4c('0x27')]);}return _0x5ab9d5[_0x4c4c('0x58')](_0x22aaa6);}})[_0x4c4c('0x1b')](function(_0x454527){if(_0x454527){return _0x454527?{'count':_0x28508e,'rows':_0x454527}:null;}})[_0x4c4c('0x1b')](respondWithResult(_0x6bf1c0,null))[_0x4c4c('0x4d')](handleError(_0x6bf1c0,null));}; \ No newline at end of file +var _0xc9fb=['debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','SugarcrmConfiguration,\x20%s,\x20%s','sendStatus','status','offset','limit','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','SugarcrmConfiguration','rawAttributes','fieldName','key','model','query','filters','attributes','intersection','fields','length','nolimit','sort','where','pick','merge','map','type','options','count','includeAll','include','findAll','rows','catch','keys','create','body','find','params','getFields','findOne','order','filter','getSubjects','SugarcrmField','hasOwnProperty','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','path','sox','to-csv','lodash','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','jayson/promise','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','request\x20sent'];(function(_0x7f748d,_0x323f3e){var _0x28f549=function(_0x184a7e){while(--_0x184a7e){_0x7f748d['push'](_0x7f748d['shift']());}};_0x28f549(++_0x323f3e);}(_0xc9fb,0xe8));var _0xbc9f=function(_0x563564,_0xa684e6){_0x563564=_0x563564-0x0;var _0x3bb2f5=_0xc9fb[_0x563564];return _0x3bb2f5;};'use strict';var pdf=require(_0xbc9f('0x0'));var emlformat=require(_0xbc9f('0x1'));var rimraf=require(_0xbc9f('0x2'));var zipdir=require(_0xbc9f('0x3'));var jsonpatch=require(_0xbc9f('0x4'));var rp=require('request-promise');var moment=require(_0xbc9f('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xbc9f('0x6'));var path=require(_0xbc9f('0x7'));var sox=require(_0xbc9f('0x8'));var csv=require(_0xbc9f('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xbc9f('0xa'));var squel=require('squel');var crypto=require(_0xbc9f('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xbc9f('0xc'));var Papa=require('papaparse');var Redis=require(_0xbc9f('0xd'));var authService=require(_0xbc9f('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xbc9f('0xf'));var hardwareService=require(_0xbc9f('0x10'));var logger=require(_0xbc9f('0x11'))(_0xbc9f('0x12'));var utils=require(_0xbc9f('0x13'));var config=require(_0xbc9f('0x14'));var db=require('../../mysqldb')['db'];var jayson=require(_0xbc9f('0x15'));var client=jayson['client']['http']({'port':0x232a});function checkPasswordPattern(_0x3e18d1,_0x2826df,_0x2ca4dc){if(_0x2ca4dc){var _0x58ca54=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x58ca54[_0xbc9f('0x16')](_0x2826df)){return _0x3e18d1;}else{throw new db['Sequelize'][(_0xbc9f('0x17'))](_0xbc9f('0x18'));}}else{return _0x3e18d1;}}function respondWithRpcPromise(_0x5cf349,_0x262709,_0x2f1c2a,_0x57dc21){return new BPromise(function(_0x31ce73,_0x54ff54){var _0x1f2b73=_0x57dc21||client;return _0x1f2b73[_0xbc9f('0x19')](_0x5cf349,_0x2f1c2a)[_0xbc9f('0x1a')](function(_0x307d7a){logger[_0xbc9f('0x1b')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x262709,_0xbc9f('0x1c'));logger[_0xbc9f('0x1d')](_0xbc9f('0x1e'),_0x262709,_0xbc9f('0x1c'),JSON['stringify'](_0x307d7a));if(_0x307d7a[_0xbc9f('0x1f')]){if(_0x307d7a[_0xbc9f('0x1f')][_0xbc9f('0x20')]===0x1f4){logger[_0xbc9f('0x1f')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x262709,_0x307d7a[_0xbc9f('0x1f')][_0xbc9f('0x21')]);return _0x54ff54(_0x307d7a[_0xbc9f('0x1f')]['message']);}logger[_0xbc9f('0x1f')](_0xbc9f('0x22'),_0x262709,_0x307d7a[_0xbc9f('0x1f')][_0xbc9f('0x21')]);return _0x31ce73(_0x307d7a['error'][_0xbc9f('0x21')]);}else{logger[_0xbc9f('0x1b')](_0xbc9f('0x22'),_0x262709,_0xbc9f('0x1c'));_0x31ce73(_0x307d7a['result'][_0xbc9f('0x21')]);}})['catch'](function(_0x5ecea4){logger[_0xbc9f('0x1f')](_0xbc9f('0x22'),_0x262709,_0x5ecea4);_0x54ff54(_0x5ecea4);});});}function respondWithStatusCode(_0x3ba7aa,_0x75ea1d){_0x75ea1d=_0x75ea1d||0xcc;return function(_0x42d026){if(_0x42d026){return _0x3ba7aa[_0xbc9f('0x23')](_0x75ea1d);}return _0x3ba7aa[_0xbc9f('0x24')](_0x75ea1d)['end']();};}function respondWithResult(_0x2e3a68,_0x313512){_0x313512=_0x313512||0xc8;return function(_0x5dedd1){if(_0x5dedd1){return _0x2e3a68['status'](_0x313512)['json'](_0x5dedd1);}};}function respondWithFilteredResult(_0x36ffac,_0x39557a){return function(_0x315fa4){if(_0x315fa4){var _0x14c7cb=_0x315fa4['count'],_0x1aa012=_0x39557a['offset'],_0xc49d5e=_0x39557a[_0xbc9f('0x25')]+_0x39557a[_0xbc9f('0x26')],_0x7460d5;if(_0xc49d5e>=_0x14c7cb){_0xc49d5e=_0x14c7cb;_0x7460d5=0xc8;}else{_0x7460d5=0xce;}_0x36ffac[_0xbc9f('0x24')](_0x7460d5);return _0x36ffac[_0xbc9f('0x27')](_0xbc9f('0x28'),_0x1aa012+'-'+_0xc49d5e+'/'+_0x14c7cb)['json'](_0x315fa4);}return null;};}function patchUpdates(_0xac6056){return function(_0x2538d8){try{jsonpatch[_0xbc9f('0x29')](_0x2538d8,_0xac6056,!![]);}catch(_0x41ee85){return BPromise[_0xbc9f('0x2a')](_0x41ee85);}return _0x2538d8[_0xbc9f('0x2b')]();};}function saveUpdates(_0x198bc4,_0x802096){return function(_0x5bb6be){if(_0x5bb6be){return _0x5bb6be[_0xbc9f('0x2c')](_0x198bc4)[_0xbc9f('0x1a')](function(_0x5677be){return _0x5677be;});}return null;};}function removeEntity(_0x468c49,_0x266cb7){return function(_0x51c7d2){if(_0x51c7d2){return _0x51c7d2[_0xbc9f('0x2d')]()[_0xbc9f('0x1a')](function(){_0x468c49[_0xbc9f('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2cfe2d,_0x2efe37){return function(_0x1664d6){if(!_0x1664d6){_0x2cfe2d['sendStatus'](0x194);}return _0x1664d6;};}function handleError(_0x77c02d,_0x55ab6e){_0x55ab6e=_0x55ab6e||0x1f4;return function(_0x23a473){logger[_0xbc9f('0x1f')](_0x23a473[_0xbc9f('0x2e')]);if(_0x23a473[_0xbc9f('0x2f')]){delete _0x23a473['name'];}_0x77c02d['status'](_0x55ab6e)[_0xbc9f('0x30')](_0x23a473);};}exports['index']=function(_0x250a44,_0x2b4828){var _0x4c958f={},_0x493cba={},_0x35cf90={'count':0x0,'rows':[]};var _0x297f4e=_['map'](db[_0xbc9f('0x31')][_0xbc9f('0x32')],function(_0x78a191){return{'name':_0x78a191[_0xbc9f('0x33')],'type':_0x78a191['type'][_0xbc9f('0x34')]};});_0x493cba[_0xbc9f('0x35')]=_['map'](_0x297f4e,_0xbc9f('0x2f'));_0x493cba['query']=_['keys'](_0x250a44[_0xbc9f('0x36')]);_0x493cba[_0xbc9f('0x37')]=_['intersection'](_0x493cba['model'],_0x493cba['query']);_0x4c958f[_0xbc9f('0x38')]=_[_0xbc9f('0x39')](_0x493cba[_0xbc9f('0x35')],qs[_0xbc9f('0x3a')](_0x250a44['query'][_0xbc9f('0x3a')]));_0x4c958f[_0xbc9f('0x38')]=_0x4c958f['attributes'][_0xbc9f('0x3b')]?_0x4c958f[_0xbc9f('0x38')]:_0x493cba[_0xbc9f('0x35')];if(!_0x250a44[_0xbc9f('0x36')]['hasOwnProperty'](_0xbc9f('0x3c'))){_0x4c958f[_0xbc9f('0x26')]=qs['limit'](_0x250a44[_0xbc9f('0x36')]['limit']);_0x4c958f['offset']=qs['offset'](_0x250a44[_0xbc9f('0x36')]['offset']);}_0x4c958f['order']=qs[_0xbc9f('0x3d')](_0x250a44['query'][_0xbc9f('0x3d')]);_0x4c958f[_0xbc9f('0x3e')]=qs[_0xbc9f('0x37')](_[_0xbc9f('0x3f')](_0x250a44[_0xbc9f('0x36')],_0x493cba['filters']),_0x297f4e);if(_0x250a44['query']['filter']){_0x4c958f['where']=_[_0xbc9f('0x40')](_0x4c958f[_0xbc9f('0x3e')],{'$or':_[_0xbc9f('0x41')](_0x297f4e,function(_0x3c16f9){if(_0x3c16f9[_0xbc9f('0x42')]!=='VIRTUAL'){var _0x448487={};_0x448487[_0x3c16f9['name']]={'$like':'%'+_0x250a44[_0xbc9f('0x36')]['filter']+'%'};return _0x448487;}})});}_0x4c958f=_[_0xbc9f('0x40')]({},_0x4c958f,_0x250a44[_0xbc9f('0x43')]);var _0x457aed={'where':_0x4c958f[_0xbc9f('0x3e')]};return db[_0xbc9f('0x31')][_0xbc9f('0x44')](_0x457aed)[_0xbc9f('0x1a')](function(_0x113143){_0x35cf90[_0xbc9f('0x44')]=_0x113143;if(_0x250a44['query'][_0xbc9f('0x45')]){_0x4c958f[_0xbc9f('0x46')]=[{'all':!![]}];}return db['SugarcrmConfiguration'][_0xbc9f('0x47')](_0x4c958f);})[_0xbc9f('0x1a')](function(_0x2a46ad){_0x35cf90[_0xbc9f('0x48')]=_0x2a46ad;return _0x35cf90;})['then'](respondWithFilteredResult(_0x2b4828,_0x4c958f))[_0xbc9f('0x49')](handleError(_0x2b4828,null));};exports['show']=function(_0x5888e9,_0x6ae145){var _0x28de56={'raw':![],'where':{'id':_0x5888e9['params']['id']}},_0x5d2ba1={};_0x5d2ba1['model']=_['keys'](db['SugarcrmConfiguration'][_0xbc9f('0x32')]);_0x5d2ba1[_0xbc9f('0x36')]=_[_0xbc9f('0x4a')](_0x5888e9['query']);_0x5d2ba1['filters']=_[_0xbc9f('0x39')](_0x5d2ba1['model'],_0x5d2ba1[_0xbc9f('0x36')]);_0x28de56[_0xbc9f('0x38')]=_[_0xbc9f('0x39')](_0x5d2ba1[_0xbc9f('0x35')],qs[_0xbc9f('0x3a')](_0x5888e9[_0xbc9f('0x36')][_0xbc9f('0x3a')]));_0x28de56[_0xbc9f('0x38')]=_0x28de56[_0xbc9f('0x38')]['length']?_0x28de56[_0xbc9f('0x38')]:_0x5d2ba1['model'];if(_0x5888e9[_0xbc9f('0x36')]['includeAll']){_0x28de56[_0xbc9f('0x46')]=[{'all':!![]}];}_0x28de56=_[_0xbc9f('0x40')]({},_0x28de56,_0x5888e9['options']);return db['SugarcrmConfiguration']['find'](_0x28de56)['then'](handleEntityNotFound(_0x6ae145,null))['then'](respondWithResult(_0x6ae145,null))['catch'](handleError(_0x6ae145,null));};exports[_0xbc9f('0x4b')]=function(_0x5e0ba1,_0x174911){return db['SugarcrmConfiguration'][_0xbc9f('0x4b')](_0x5e0ba1[_0xbc9f('0x4c')],{})[_0xbc9f('0x1a')](respondWithResult(_0x174911,0xc9))[_0xbc9f('0x49')](handleError(_0x174911,null));};exports[_0xbc9f('0x2c')]=function(_0xb5c13a,_0x4ad850){if(_0xb5c13a[_0xbc9f('0x4c')]['id']){delete _0xb5c13a['body']['id'];}return db['SugarcrmConfiguration'][_0xbc9f('0x4d')]({'where':{'id':_0xb5c13a[_0xbc9f('0x4e')]['id']}})[_0xbc9f('0x1a')](handleEntityNotFound(_0x4ad850,null))['then'](saveUpdates(_0xb5c13a[_0xbc9f('0x4c')],null))['then'](respondWithResult(_0x4ad850,null))[_0xbc9f('0x49')](handleError(_0x4ad850,null));};exports[_0xbc9f('0x2d')]=function(_0x404b6f,_0x23d2e7){return db[_0xbc9f('0x31')][_0xbc9f('0x4d')]({'where':{'id':_0x404b6f[_0xbc9f('0x4e')]['id']}})[_0xbc9f('0x1a')](handleEntityNotFound(_0x23d2e7,null))[_0xbc9f('0x1a')](removeEntity(_0x23d2e7,null))[_0xbc9f('0x49')](handleError(_0x23d2e7,null));};exports[_0xbc9f('0x4f')]=function(_0x70f383,_0x45f5ea,_0xa5d58f){var _0x179728={};var _0x4447ec={};var _0x50385b;var _0x1444db;return db[_0xbc9f('0x31')][_0xbc9f('0x50')]({'where':{'id':_0x70f383[_0xbc9f('0x4e')]['id']}})[_0xbc9f('0x1a')](handleEntityNotFound(_0x45f5ea,null))[_0xbc9f('0x1a')](function(_0x256baf){if(_0x256baf){_0x50385b=_0x256baf;_0x4447ec[_0xbc9f('0x35')]=_[_0xbc9f('0x4a')](db['SugarcrmField']['rawAttributes']);_0x4447ec[_0xbc9f('0x36')]=_['keys'](_0x70f383[_0xbc9f('0x36')]);_0x4447ec['filters']=_[_0xbc9f('0x39')](_0x4447ec['model'],_0x4447ec[_0xbc9f('0x36')]);_0x179728[_0xbc9f('0x38')]=_[_0xbc9f('0x39')](_0x4447ec[_0xbc9f('0x35')],qs[_0xbc9f('0x3a')](_0x70f383['query'][_0xbc9f('0x3a')]));_0x179728['attributes']=_0x179728[_0xbc9f('0x38')]['length']?_0x179728[_0xbc9f('0x38')]:_0x4447ec[_0xbc9f('0x35')];_0x179728[_0xbc9f('0x51')]=qs[_0xbc9f('0x3d')](_0x70f383['query'][_0xbc9f('0x3d')]);_0x179728['where']=qs[_0xbc9f('0x37')](_[_0xbc9f('0x3f')](_0x70f383[_0xbc9f('0x36')],_0x4447ec['filters']));if(_0x70f383[_0xbc9f('0x36')][_0xbc9f('0x52')]){_0x179728['where']=_['merge'](_0x179728['where'],{'$or':_[_0xbc9f('0x41')](_0x179728[_0xbc9f('0x38')],function(_0x4c5bcb){var _0xbbbdbb={};_0xbbbdbb[_0x4c5bcb]={'$like':'%'+_0x70f383[_0xbc9f('0x36')][_0xbc9f('0x52')]+'%'};return _0xbbbdbb;})});}_0x179728=_[_0xbc9f('0x40')]({},_0x179728,_0x70f383[_0xbc9f('0x43')]);return _0x50385b[_0xbc9f('0x4f')](_0x179728);}})[_0xbc9f('0x1a')](function(_0x49995c){if(_0x49995c){_0x1444db=_0x49995c[_0xbc9f('0x3b')];if(!_0x70f383[_0xbc9f('0x36')]['hasOwnProperty'](_0xbc9f('0x3c'))){_0x179728['limit']=qs[_0xbc9f('0x26')](_0x70f383[_0xbc9f('0x36')][_0xbc9f('0x26')]);_0x179728['offset']=qs[_0xbc9f('0x25')](_0x70f383[_0xbc9f('0x36')][_0xbc9f('0x25')]);}return _0x50385b['getFields'](_0x179728);}})[_0xbc9f('0x1a')](function(_0xe627d9){if(_0xe627d9){return _0xe627d9?{'count':_0x1444db,'rows':_0xe627d9}:null;}})[_0xbc9f('0x1a')](respondWithResult(_0x45f5ea,null))[_0xbc9f('0x49')](handleError(_0x45f5ea,null));};exports[_0xbc9f('0x53')]=function(_0x48e06e,_0x5ee67f,_0x569f58){var _0x450672={};var _0x1489f5={};var _0x2591a7;var _0x212b16;return db[_0xbc9f('0x31')][_0xbc9f('0x50')]({'where':{'id':_0x48e06e[_0xbc9f('0x4e')]['id']}})['then'](handleEntityNotFound(_0x5ee67f,null))[_0xbc9f('0x1a')](function(_0x114d15){if(_0x114d15){_0x2591a7=_0x114d15;_0x1489f5[_0xbc9f('0x35')]=_[_0xbc9f('0x4a')](db[_0xbc9f('0x54')][_0xbc9f('0x32')]);_0x1489f5[_0xbc9f('0x36')]=_['keys'](_0x48e06e[_0xbc9f('0x36')]);_0x1489f5[_0xbc9f('0x37')]=_[_0xbc9f('0x39')](_0x1489f5[_0xbc9f('0x35')],_0x1489f5['query']);_0x450672['attributes']=_[_0xbc9f('0x39')](_0x1489f5['model'],qs[_0xbc9f('0x3a')](_0x48e06e[_0xbc9f('0x36')][_0xbc9f('0x3a')]));_0x450672[_0xbc9f('0x38')]=_0x450672[_0xbc9f('0x38')][_0xbc9f('0x3b')]?_0x450672['attributes']:_0x1489f5['model'];_0x450672['order']=qs[_0xbc9f('0x3d')](_0x48e06e[_0xbc9f('0x36')][_0xbc9f('0x3d')]);_0x450672[_0xbc9f('0x3e')]=qs[_0xbc9f('0x37')](_[_0xbc9f('0x3f')](_0x48e06e[_0xbc9f('0x36')],_0x1489f5[_0xbc9f('0x37')]));if(_0x48e06e[_0xbc9f('0x36')][_0xbc9f('0x52')]){_0x450672[_0xbc9f('0x3e')]=_['merge'](_0x450672['where'],{'$or':_['map'](_0x450672[_0xbc9f('0x38')],function(_0x2abd4c){var _0x317096={};_0x317096[_0x2abd4c]={'$like':'%'+_0x48e06e[_0xbc9f('0x36')]['filter']+'%'};return _0x317096;})});}_0x450672=_[_0xbc9f('0x40')]({},_0x450672,_0x48e06e[_0xbc9f('0x43')]);return _0x2591a7[_0xbc9f('0x53')](_0x450672);}})['then'](function(_0x14bf4b){if(_0x14bf4b){_0x212b16=_0x14bf4b['length'];if(!_0x48e06e[_0xbc9f('0x36')][_0xbc9f('0x55')](_0xbc9f('0x3c'))){_0x450672[_0xbc9f('0x26')]=qs[_0xbc9f('0x26')](_0x48e06e[_0xbc9f('0x36')]['limit']);_0x450672['offset']=qs[_0xbc9f('0x25')](_0x48e06e[_0xbc9f('0x36')][_0xbc9f('0x25')]);}return _0x2591a7[_0xbc9f('0x53')](_0x450672);}})['then'](function(_0x17ba05){if(_0x17ba05){return _0x17ba05?{'count':_0x212b16,'rows':_0x17ba05}:null;}})['then'](respondWithResult(_0x5ee67f,null))[_0xbc9f('0x49')](handleError(_0x5ee67f,null));};exports[_0xbc9f('0x56')]=function(_0x293697,_0x1411a6,_0x1e9a8c){var _0x2e7439={};var _0x1946c4={};var _0x4ae13d;var _0x199cbe;return db[_0xbc9f('0x31')]['findOne']({'where':{'id':_0x293697[_0xbc9f('0x4e')]['id']}})['then'](handleEntityNotFound(_0x1411a6,null))[_0xbc9f('0x1a')](function(_0x1b9fd5){if(_0x1b9fd5){_0x4ae13d=_0x1b9fd5;_0x1946c4[_0xbc9f('0x35')]=_['keys'](db[_0xbc9f('0x54')]['rawAttributes']);_0x1946c4['query']=_['keys'](_0x293697[_0xbc9f('0x36')]);_0x1946c4['filters']=_[_0xbc9f('0x39')](_0x1946c4[_0xbc9f('0x35')],_0x1946c4[_0xbc9f('0x36')]);_0x2e7439[_0xbc9f('0x38')]=_[_0xbc9f('0x39')](_0x1946c4[_0xbc9f('0x35')],qs[_0xbc9f('0x3a')](_0x293697[_0xbc9f('0x36')][_0xbc9f('0x3a')]));_0x2e7439[_0xbc9f('0x38')]=_0x2e7439['attributes']['length']?_0x2e7439[_0xbc9f('0x38')]:_0x1946c4[_0xbc9f('0x35')];_0x2e7439[_0xbc9f('0x51')]=qs['sort'](_0x293697[_0xbc9f('0x36')][_0xbc9f('0x3d')]);_0x2e7439['where']=qs['filters'](_[_0xbc9f('0x3f')](_0x293697[_0xbc9f('0x36')],_0x1946c4[_0xbc9f('0x37')]));if(_0x293697[_0xbc9f('0x36')][_0xbc9f('0x52')]){_0x2e7439[_0xbc9f('0x3e')]=_[_0xbc9f('0x40')](_0x2e7439['where'],{'$or':_['map'](_0x2e7439['attributes'],function(_0x247039){var _0x24f2b3={};_0x24f2b3[_0x247039]={'$like':'%'+_0x293697[_0xbc9f('0x36')][_0xbc9f('0x52')]+'%'};return _0x24f2b3;})});}_0x2e7439=_[_0xbc9f('0x40')]({},_0x2e7439,_0x293697[_0xbc9f('0x43')]);return _0x4ae13d[_0xbc9f('0x56')](_0x2e7439);}})[_0xbc9f('0x1a')](function(_0x4cac50){if(_0x4cac50){_0x199cbe=_0x4cac50[_0xbc9f('0x3b')];if(!_0x293697[_0xbc9f('0x36')][_0xbc9f('0x55')](_0xbc9f('0x3c'))){_0x2e7439[_0xbc9f('0x26')]=qs[_0xbc9f('0x26')](_0x293697[_0xbc9f('0x36')][_0xbc9f('0x26')]);_0x2e7439[_0xbc9f('0x25')]=qs['offset'](_0x293697[_0xbc9f('0x36')][_0xbc9f('0x25')]);}return _0x4ae13d[_0xbc9f('0x56')](_0x2e7439);}})[_0xbc9f('0x1a')](function(_0x10d953){if(_0x10d953){return _0x10d953?{'count':_0x199cbe,'rows':_0x10d953}:null;}})['then'](respondWithResult(_0x1411a6,null))['catch'](handleError(_0x1411a6,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 2722b36..5b79031 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 _0x62e6=['util','../../config/logger','bluebird','request-promise','../../config/environment','define','SugarcrmConfiguration','lodash'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0x62e6,0xff));var _0x662e=function(_0x28ee74,_0x289441){_0x28ee74=_0x28ee74-0x0;var _0x6cc80c=_0x62e6[_0x28ee74];return _0x6cc80c;};'use strict';var _=require(_0x662e('0x0'));var util=require(_0x662e('0x1'));var logger=require(_0x662e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x662e('0x3'));var rp=require(_0x662e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x662e('0x5'));var attributes=require('./intSugarcrmConfiguration.attributes');module['exports']=function(_0xa9be6,_0x3f041d){return _0xa9be6[_0x662e('0x6')](_0x662e('0x7'),attributes,{'tableName':'int_sugarcrm_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x59cf=['define','SugarcrmConfiguration','int_sugarcrm_configurations','util','api','bluebird','path','rimraf','./intSugarcrmConfiguration.attributes','exports'];(function(_0x52f93a,_0x2f819a){var _0x4cacfd=function(_0x17f2dc){while(--_0x17f2dc){_0x52f93a['push'](_0x52f93a['shift']());}};_0x4cacfd(++_0x2f819a);}(_0x59cf,0x1cf));var _0xf59c=function(_0x15cbce,_0xda8402){_0x15cbce=_0x15cbce-0x0;var _0x257f29=_0x59cf[_0x15cbce];return _0x257f29;};'use strict';var _=require('lodash');var util=require(_0xf59c('0x0'));var logger=require('../../config/logger')(_0xf59c('0x1'));var moment=require('moment');var BPromise=require(_0xf59c('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf59c('0x3'));var rimraf=require(_0xf59c('0x4'));var config=require('../../config/environment');var attributes=require(_0xf59c('0x5'));module[_0xf59c('0x6')]=function(_0x4c3348,_0x438943){return _0x4c3348[_0xf59c('0x7')](_0xf59c('0x8'),attributes,{'tableName':_0xf59c('0x9'),'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 79066e8..9e2abf7 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 _0x386a=['../../mysqldb','../../config/logger','rpc','../../config/environment','request','then','debug','request\x20sent','error','code','SugarcrmConfiguration,\x20%s,\x20%s','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x55cbf9,_0x38f1ec){var _0x582a5b=function(_0xd968f2){while(--_0xd968f2){_0x55cbf9['push'](_0x55cbf9['shift']());}};_0x582a5b(++_0x38f1ec);}(_0x386a,0x126));var _0xa386=function(_0x574f47,_0x2e649a){_0x574f47=_0x574f47-0x0;var _0x74d1ca=_0x386a[_0x574f47];return _0x74d1ca;};'use strict';var _=require(_0xa386('0x0'));var util=require(_0xa386('0x1'));var moment=require(_0xa386('0x2'));var BPromise=require(_0xa386('0x3'));var rs=require(_0xa386('0x4'));var fs=require('fs');var Redis=require(_0xa386('0x5'));var db=require(_0xa386('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xa386('0x7'))(_0xa386('0x8'));var config=require(_0xa386('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4c47dc,_0x2ae52f,_0x2db17d){return new BPromise(function(_0x5abad7,_0x49b0ab){return client[_0xa386('0xa')](_0x4c47dc,_0x2db17d)[_0xa386('0xb')](function(_0x318654){logger['info']('SugarcrmConfiguration,\x20%s,\x20%s',_0x2ae52f,'request\x20sent');logger[_0xa386('0xc')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x2ae52f,_0xa386('0xd'),JSON['stringify'](_0x318654));if(_0x318654['error']){if(_0x318654[_0xa386('0xe')][_0xa386('0xf')]===0x1f4){logger[_0xa386('0xe')](_0xa386('0x10'),_0x2ae52f,_0x318654[_0xa386('0xe')][_0xa386('0x11')]);return _0x49b0ab(_0x318654[_0xa386('0xe')][_0xa386('0x11')]);}logger[_0xa386('0xe')](_0xa386('0x10'),_0x2ae52f,_0x318654[_0xa386('0xe')][_0xa386('0x11')]);return _0x5abad7(_0x318654[_0xa386('0xe')]['message']);}else{logger[_0xa386('0x12')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x2ae52f,_0xa386('0xd'));_0x5abad7(_0x318654[_0xa386('0x13')][_0xa386('0x11')]);}})['catch'](function(_0x1cd189){logger['error'](_0xa386('0x10'),_0x2ae52f,_0x1cd189);_0x49b0ab(_0x1cd189);});});} \ No newline at end of file +var _0x4c5a=['util','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','stringify','error','code','SugarcrmConfiguration,\x20%s,\x20%s','message','result','catch','lodash'];(function(_0x3405f7,_0x1d05f9){var _0x1c74ed=function(_0x5b4d72){while(--_0x5b4d72){_0x3405f7['push'](_0x3405f7['shift']());}};_0x1c74ed(++_0x1d05f9);}(_0x4c5a,0x1e3));var _0xa4c5=function(_0x5d4328,_0x26238d){_0x5d4328=_0x5d4328-0x0;var _0xc5d009=_0x4c5a[_0x5d4328];return _0xc5d009;};'use strict';var _=require(_0xa4c5('0x0'));var util=require(_0xa4c5('0x1'));var moment=require(_0xa4c5('0x2'));var BPromise=require(_0xa4c5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa4c5('0x4'))['db'];var utils=require(_0xa4c5('0x5'));var logger=require('../../config/logger')(_0xa4c5('0x6'));var config=require(_0xa4c5('0x7'));var jayson=require(_0xa4c5('0x8'));var client=jayson[_0xa4c5('0x9')][_0xa4c5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4e0730,_0x516b78,_0x46c83a){return new BPromise(function(_0xd1df64,_0x4513a1){return client['request'](_0x4e0730,_0x46c83a)[_0xa4c5('0xb')](function(_0xec15df){logger[_0xa4c5('0xc')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x516b78,_0xa4c5('0xd'));logger[_0xa4c5('0xe')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x516b78,_0xa4c5('0xd'),JSON[_0xa4c5('0xf')](_0xec15df));if(_0xec15df[_0xa4c5('0x10')]){if(_0xec15df['error'][_0xa4c5('0x11')]===0x1f4){logger[_0xa4c5('0x10')](_0xa4c5('0x12'),_0x516b78,_0xec15df[_0xa4c5('0x10')][_0xa4c5('0x13')]);return _0x4513a1(_0xec15df['error'][_0xa4c5('0x13')]);}logger[_0xa4c5('0x10')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x516b78,_0xec15df[_0xa4c5('0x10')][_0xa4c5('0x13')]);return _0xd1df64(_0xec15df[_0xa4c5('0x10')][_0xa4c5('0x13')]);}else{logger[_0xa4c5('0xc')](_0xa4c5('0x12'),_0x516b78,_0xa4c5('0xd'));_0xd1df64(_0xec15df[_0xa4c5('0x14')]['message']);}})[_0xa4c5('0x15')](function(_0x162711){logger[_0xa4c5('0x10')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x516b78,_0x162711);_0x4513a1(_0x162711);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index e129e5e..5b1022e 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 _0x5776=['delete','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','get','index','/:id','isAuthenticated','show','post','create','update'];(function(_0x338728,_0x4d1f3a){var _0x396bb7=function(_0x2f107c){while(--_0x2f107c){_0x338728['push'](_0x338728['shift']());}};_0x396bb7(++_0x4d1f3a);}(_0x5776,0x10c));var _0x6577=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x5776[_0x40a045];return _0x1a687c;};'use strict';var multer=require(_0x6577('0x0'));var util=require('util');var path=require(_0x6577('0x1'));var timeout=require(_0x6577('0x2'));var express=require(_0x6577('0x3'));var router=express[_0x6577('0x4')]();var auth=require(_0x6577('0x5'));var interaction=require(_0x6577('0x6'));var config=require(_0x6577('0x7'));var controller=require(_0x6577('0x8'));router[_0x6577('0x9')]('/',auth['isAuthenticated'](),controller[_0x6577('0xa')]);router[_0x6577('0x9')](_0x6577('0xb'),auth[_0x6577('0xc')](),controller[_0x6577('0xd')]);router[_0x6577('0xe')]('/',auth[_0x6577('0xc')](),controller[_0x6577('0xf')]);router['put'](_0x6577('0xb'),auth[_0x6577('0xc')](),controller[_0x6577('0x10')]);router[_0x6577('0x11')](_0x6577('0xb'),auth[_0x6577('0xc')](),controller['destroy']);module[_0x6577('0x12')]=router; \ No newline at end of file +var _0x61df=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','update','delete','exports'];(function(_0x5796d9,_0x4b511e){var _0x21c43d=function(_0x3b7b9d){while(--_0x3b7b9d){_0x5796d9['push'](_0x5796d9['shift']());}};_0x21c43d(++_0x4b511e);}(_0x61df,0x10e));var _0xf61d=function(_0xf5a583,_0x4d14d6){_0xf5a583=_0xf5a583-0x0;var _0x11d16d=_0x61df[_0xf5a583];return _0x11d16d;};'use strict';var multer=require('multer');var util=require(_0xf61d('0x0'));var path=require(_0xf61d('0x1'));var timeout=require(_0xf61d('0x2'));var express=require(_0xf61d('0x3'));var router=express[_0xf61d('0x4')]();var auth=require(_0xf61d('0x5'));var interaction=require(_0xf61d('0x6'));var config=require(_0xf61d('0x7'));var controller=require('./intSugarcrmField.controller');router[_0xf61d('0x8')]('/',auth[_0xf61d('0x9')](),controller[_0xf61d('0xa')]);router[_0xf61d('0x8')](_0xf61d('0xb'),auth[_0xf61d('0x9')](),controller[_0xf61d('0xc')]);router[_0xf61d('0xd')]('/',auth['isAuthenticated'](),controller[_0xf61d('0xe')]);router['put'](_0xf61d('0xb'),auth[_0xf61d('0x9')](),controller[_0xf61d('0xf')]);router[_0xf61d('0x10')]('/:id',auth[_0xf61d('0x9')](),controller['destroy']);module[_0xf61d('0x11')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 24da881..250157a 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 _0x3e25=['customVariable','BOOLEAN','sequelize','exports','ENUM','variable','keyValue','STRING','string'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0x3e25,0x14f));var _0x53e2=function(_0x23d9b0,_0x174e84){_0x23d9b0=_0x23d9b0-0x0;var _0x26651a=_0x3e25[_0x23d9b0];return _0x26651a;};'use strict';var Sequelize=require(_0x53e2('0x0'));module[_0x53e2('0x1')]={'type':{'type':Sequelize[_0x53e2('0x2')]('string',_0x53e2('0x3'),'customVariable',_0x53e2('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0x53e2('0x5')]},'key':{'type':Sequelize[_0x53e2('0x5')]},'keyType':{'type':Sequelize[_0x53e2('0x2')](_0x53e2('0x6'),_0x53e2('0x3'),_0x53e2('0x7'))},'keyContent':{'type':Sequelize[_0x53e2('0x5')]},'idField':{'type':Sequelize[_0x53e2('0x5')]},'nameField':{'type':Sequelize[_0x53e2('0x5')]},'customField':{'type':Sequelize[_0x53e2('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x53e2('0x5')]}}; \ No newline at end of file +var _0xaa9d=['exports','ENUM','string','variable','STRING','BOOLEAN','sequelize'];(function(_0x578365,_0x1a3ef6){var _0x402aef=function(_0x50c018){while(--_0x50c018){_0x578365['push'](_0x578365['shift']());}};_0x402aef(++_0x1a3ef6);}(_0xaa9d,0x1aa));var _0xdaa9=function(_0x99bc18,_0x5082cc){_0x99bc18=_0x99bc18-0x0;var _0x3371b1=_0xaa9d[_0x99bc18];return _0x3371b1;};'use strict';var Sequelize=require(_0xdaa9('0x0'));module[_0xdaa9('0x1')]={'type':{'type':Sequelize[_0xdaa9('0x2')](_0xdaa9('0x3'),_0xdaa9('0x4'),'customVariable','keyValue'),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xdaa9('0x5')]},'keyType':{'type':Sequelize[_0xdaa9('0x2')](_0xdaa9('0x3'),_0xdaa9('0x4'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xdaa9('0x5')]},'nameField':{'type':Sequelize[_0xdaa9('0x5')]},'customField':{'type':Sequelize[_0xdaa9('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xdaa9('0x5')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 338a6ef..2d51ec8 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 _0xff34=['VIRTUAL','merge','options','count','includeAll','include','findAll','catch','show','keys','find','create','body','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','status','offset','set','Content-Range','json','apply','reject','save','update','destroy','then','end','sendStatus','error','stack','name','send','index','map','SugarcrmField','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','where','filters','pick'];(function(_0x3c5c61,_0x496f54){var _0x21f8a2=function(_0x36b99c){while(--_0x36b99c){_0x3c5c61['push'](_0x3c5c61['shift']());}};_0x21f8a2(++_0x496f54);}(_0xff34,0xec));var _0x4ff3=function(_0x4737a0,_0x36520e){_0x4737a0=_0x4737a0-0x0;var _0x4d558b=_0xff34[_0x4737a0];return _0x4d558b;};'use strict';var pdf=require(_0x4ff3('0x0'));var emlformat=require(_0x4ff3('0x1'));var rimraf=require(_0x4ff3('0x2'));var zipdir=require(_0x4ff3('0x3'));var jsonpatch=require(_0x4ff3('0x4'));var rp=require('request-promise');var moment=require(_0x4ff3('0x5'));var BPromise=require(_0x4ff3('0x6'));var Mustache=require(_0x4ff3('0x7'));var util=require('util');var path=require(_0x4ff3('0x8'));var sox=require(_0x4ff3('0x9'));var csv=require(_0x4ff3('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x4ff3('0xb'));var squel=require('squel');var crypto=require(_0x4ff3('0xc'));var jsforce=require(_0x4ff3('0xd'));var deskjs=require(_0x4ff3('0xe'));var toCsv=require(_0x4ff3('0xa'));var querystring=require(_0x4ff3('0xf'));var Papa=require(_0x4ff3('0x10'));var Redis=require(_0x4ff3('0x11'));var authService=require(_0x4ff3('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x4ff3('0x13'));var hardwareService=require(_0x4ff3('0x14'));var logger=require(_0x4ff3('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x4ff3('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x179def,_0x4b10e1){_0x4b10e1=_0x4b10e1||0xcc;return function(_0x543631){if(_0x543631){return _0x179def['sendStatus'](_0x4b10e1);}return _0x179def[_0x4ff3('0x17')](_0x4b10e1)['end']();};}function respondWithResult(_0x30c35d,_0x41eda4){_0x41eda4=_0x41eda4||0xc8;return function(_0x16e61c){if(_0x16e61c){return _0x30c35d[_0x4ff3('0x17')](_0x41eda4)['json'](_0x16e61c);}};}function respondWithFilteredResult(_0x31ea7e,_0x3769e0){return function(_0x4a7245){if(_0x4a7245){var _0x355f2a=_0x4a7245['count'],_0xad666d=_0x3769e0[_0x4ff3('0x18')],_0x1c5c8b=_0x3769e0['offset']+_0x3769e0['limit'],_0x4c3821;if(_0x1c5c8b>=_0x355f2a){_0x1c5c8b=_0x355f2a;_0x4c3821=0xc8;}else{_0x4c3821=0xce;}_0x31ea7e[_0x4ff3('0x17')](_0x4c3821);return _0x31ea7e[_0x4ff3('0x19')](_0x4ff3('0x1a'),_0xad666d+'-'+_0x1c5c8b+'/'+_0x355f2a)[_0x4ff3('0x1b')](_0x4a7245);}return null;};}function patchUpdates(_0x268039){return function(_0x256b65){try{jsonpatch[_0x4ff3('0x1c')](_0x256b65,_0x268039,!![]);}catch(_0x16cf5){return BPromise[_0x4ff3('0x1d')](_0x16cf5);}return _0x256b65[_0x4ff3('0x1e')]();};}function saveUpdates(_0x151463,_0x53c452){return function(_0xceec96){if(_0xceec96){return _0xceec96[_0x4ff3('0x1f')](_0x151463)['then'](function(_0x2903f8){return _0x2903f8;});}return null;};}function removeEntity(_0x306479,_0x596c4f){return function(_0x4c9ab5){if(_0x4c9ab5){return _0x4c9ab5[_0x4ff3('0x20')]()[_0x4ff3('0x21')](function(){_0x306479[_0x4ff3('0x17')](0xcc)[_0x4ff3('0x22')]();});}};}function handleEntityNotFound(_0x4d1ba3,_0x586e94){return function(_0x37a2c){if(!_0x37a2c){_0x4d1ba3[_0x4ff3('0x23')](0x194);}return _0x37a2c;};}function handleError(_0x3fdc9d,_0x319adf){_0x319adf=_0x319adf||0x1f4;return function(_0x1061a4){logger[_0x4ff3('0x24')](_0x1061a4[_0x4ff3('0x25')]);if(_0x1061a4[_0x4ff3('0x26')]){delete _0x1061a4[_0x4ff3('0x26')];}_0x3fdc9d['status'](_0x319adf)[_0x4ff3('0x27')](_0x1061a4);};}exports[_0x4ff3('0x28')]=function(_0x3a2800,_0x58721e){var _0x50be1f={},_0x1abfd4={},_0x4ef59f={'count':0x0,'rows':[]};var _0x1197f8=_[_0x4ff3('0x29')](db[_0x4ff3('0x2a')][_0x4ff3('0x2b')],function(_0x473e98){return{'name':_0x473e98[_0x4ff3('0x2c')],'type':_0x473e98[_0x4ff3('0x2d')][_0x4ff3('0x2e')]};});_0x1abfd4[_0x4ff3('0x2f')]=_[_0x4ff3('0x29')](_0x1197f8,'name');_0x1abfd4[_0x4ff3('0x30')]=_['keys'](_0x3a2800[_0x4ff3('0x30')]);_0x1abfd4['filters']=_[_0x4ff3('0x31')](_0x1abfd4[_0x4ff3('0x2f')],_0x1abfd4['query']);_0x50be1f['attributes']=_[_0x4ff3('0x31')](_0x1abfd4[_0x4ff3('0x2f')],qs[_0x4ff3('0x32')](_0x3a2800[_0x4ff3('0x30')][_0x4ff3('0x32')]));_0x50be1f[_0x4ff3('0x33')]=_0x50be1f[_0x4ff3('0x33')][_0x4ff3('0x34')]?_0x50be1f[_0x4ff3('0x33')]:_0x1abfd4[_0x4ff3('0x2f')];if(!_0x3a2800['query'][_0x4ff3('0x35')](_0x4ff3('0x36'))){_0x50be1f[_0x4ff3('0x37')]=qs[_0x4ff3('0x37')](_0x3a2800['query'][_0x4ff3('0x37')]);_0x50be1f[_0x4ff3('0x18')]=qs[_0x4ff3('0x18')](_0x3a2800[_0x4ff3('0x30')][_0x4ff3('0x18')]);}_0x50be1f['order']=qs['sort'](_0x3a2800[_0x4ff3('0x30')][_0x4ff3('0x38')]);_0x50be1f[_0x4ff3('0x39')]=qs[_0x4ff3('0x3a')](_[_0x4ff3('0x3b')](_0x3a2800[_0x4ff3('0x30')],_0x1abfd4[_0x4ff3('0x3a')]),_0x1197f8);if(_0x3a2800['query']['filter']){_0x50be1f[_0x4ff3('0x39')]=_['merge'](_0x50be1f[_0x4ff3('0x39')],{'$or':_[_0x4ff3('0x29')](_0x1197f8,function(_0x49a573){if(_0x49a573[_0x4ff3('0x2d')]!==_0x4ff3('0x3c')){var _0x30da53={};_0x30da53[_0x49a573['name']]={'$like':'%'+_0x3a2800[_0x4ff3('0x30')]['filter']+'%'};return _0x30da53;}})});}_0x50be1f=_[_0x4ff3('0x3d')]({},_0x50be1f,_0x3a2800[_0x4ff3('0x3e')]);var _0x3a725f={'where':_0x50be1f['where']};return db['SugarcrmField'][_0x4ff3('0x3f')](_0x3a725f)[_0x4ff3('0x21')](function(_0x52c817){_0x4ef59f['count']=_0x52c817;if(_0x3a2800[_0x4ff3('0x30')][_0x4ff3('0x40')]){_0x50be1f[_0x4ff3('0x41')]=[{'all':!![]}];}return db[_0x4ff3('0x2a')][_0x4ff3('0x42')](_0x50be1f);})[_0x4ff3('0x21')](function(_0x35f719){_0x4ef59f['rows']=_0x35f719;return _0x4ef59f;})[_0x4ff3('0x21')](respondWithFilteredResult(_0x58721e,_0x50be1f))[_0x4ff3('0x43')](handleError(_0x58721e,null));};exports[_0x4ff3('0x44')]=function(_0xbbaa7,_0x108015){var _0x2d7c1a={'raw':!![],'where':{'id':_0xbbaa7['params']['id']}},_0x486f63={};_0x486f63[_0x4ff3('0x2f')]=_['keys'](db['SugarcrmField'][_0x4ff3('0x2b')]);_0x486f63['query']=_[_0x4ff3('0x45')](_0xbbaa7[_0x4ff3('0x30')]);_0x486f63[_0x4ff3('0x3a')]=_['intersection'](_0x486f63[_0x4ff3('0x2f')],_0x486f63[_0x4ff3('0x30')]);_0x2d7c1a[_0x4ff3('0x33')]=_[_0x4ff3('0x31')](_0x486f63['model'],qs[_0x4ff3('0x32')](_0xbbaa7['query']['fields']));_0x2d7c1a[_0x4ff3('0x33')]=_0x2d7c1a[_0x4ff3('0x33')][_0x4ff3('0x34')]?_0x2d7c1a[_0x4ff3('0x33')]:_0x486f63[_0x4ff3('0x2f')];if(_0xbbaa7[_0x4ff3('0x30')]['includeAll']){_0x2d7c1a[_0x4ff3('0x41')]=[{'all':!![]}];}_0x2d7c1a=_['merge']({},_0x2d7c1a,_0xbbaa7['options']);return db[_0x4ff3('0x2a')][_0x4ff3('0x46')](_0x2d7c1a)[_0x4ff3('0x21')](handleEntityNotFound(_0x108015,null))['then'](respondWithResult(_0x108015,null))[_0x4ff3('0x43')](handleError(_0x108015,null));};exports['create']=function(_0x16ac88,_0x174a29){return db['SugarcrmField'][_0x4ff3('0x47')](_0x16ac88['body'],{})[_0x4ff3('0x21')](respondWithResult(_0x174a29,0xc9))[_0x4ff3('0x43')](handleError(_0x174a29,null));};exports[_0x4ff3('0x1f')]=function(_0x1d1a06,_0x1cc17d){if(_0x1d1a06['body']['id']){delete _0x1d1a06[_0x4ff3('0x48')]['id'];}return db[_0x4ff3('0x2a')][_0x4ff3('0x46')]({'where':{'id':_0x1d1a06[_0x4ff3('0x49')]['id']}})[_0x4ff3('0x21')](handleEntityNotFound(_0x1cc17d,null))[_0x4ff3('0x21')](saveUpdates(_0x1d1a06[_0x4ff3('0x48')],null))[_0x4ff3('0x21')](respondWithResult(_0x1cc17d,null))[_0x4ff3('0x43')](handleError(_0x1cc17d,null));};exports[_0x4ff3('0x20')]=function(_0x2c8d5f,_0x2b9eb5){return db[_0x4ff3('0x2a')]['find']({'where':{'id':_0x2c8d5f[_0x4ff3('0x49')]['id']}})[_0x4ff3('0x21')](handleEntityNotFound(_0x2b9eb5,null))[_0x4ff3('0x21')](removeEntity(_0x2b9eb5,null))[_0x4ff3('0x43')](handleError(_0x2b9eb5,null));}; \ No newline at end of file +var _0x8d36=['../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','Content-Range','json','apply','update','then','destroy','stack','name','send','index','SugarcrmField','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','rows','catch','show','params','rawAttributes','length','include','find','create','body','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x559dad,_0x1cf1e3){var _0x2c492e=function(_0x4b6823){while(--_0x4b6823){_0x559dad['push'](_0x559dad['shift']());}};_0x2c492e(++_0x1cf1e3);}(_0x8d36,0x1e5));var _0x68d3=function(_0x493a51,_0x45128c){_0x493a51=_0x493a51-0x0;var _0xc85756=_0x8d36[_0x493a51];return _0xc85756;};'use strict';var pdf=require(_0x68d3('0x0'));var emlformat=require(_0x68d3('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x68d3('0x2'));var jsonpatch=require(_0x68d3('0x3'));var rp=require('request-promise');var moment=require(_0x68d3('0x4'));var BPromise=require(_0x68d3('0x5'));var Mustache=require('mustache');var util=require(_0x68d3('0x6'));var path=require(_0x68d3('0x7'));var sox=require(_0x68d3('0x8'));var csv=require(_0x68d3('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x68d3('0xa'));var squel=require(_0x68d3('0xb'));var crypto=require(_0x68d3('0xc'));var jsforce=require(_0x68d3('0xd'));var deskjs=require(_0x68d3('0xe'));var toCsv=require(_0x68d3('0x9'));var querystring=require('querystring');var Papa=require(_0x68d3('0xf'));var Redis=require(_0x68d3('0x10'));var authService=require(_0x68d3('0x11'));var qs=require(_0x68d3('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x68d3('0x13'));var logger=require(_0x68d3('0x14'))(_0x68d3('0x15'));var utils=require('../../config/utils');var config=require(_0x68d3('0x16'));var db=require(_0x68d3('0x17'))['db'];function respondWithStatusCode(_0x48442c,_0x6b639e){_0x6b639e=_0x6b639e||0xcc;return function(_0x439db8){if(_0x439db8){return _0x48442c[_0x68d3('0x18')](_0x6b639e);}return _0x48442c[_0x68d3('0x19')](_0x6b639e)[_0x68d3('0x1a')]();};}function respondWithResult(_0x39ef1e,_0x4d4e98){_0x4d4e98=_0x4d4e98||0xc8;return function(_0x55bf06){if(_0x55bf06){return _0x39ef1e['status'](_0x4d4e98)['json'](_0x55bf06);}};}function respondWithFilteredResult(_0x3f461f,_0x1af2c6){return function(_0x4b9c87){if(_0x4b9c87){var _0x3a09e5=_0x4b9c87['count'],_0x11e994=_0x1af2c6[_0x68d3('0x1b')],_0x579354=_0x1af2c6[_0x68d3('0x1b')]+_0x1af2c6[_0x68d3('0x1c')],_0x51dfd0;if(_0x579354>=_0x3a09e5){_0x579354=_0x3a09e5;_0x51dfd0=0xc8;}else{_0x51dfd0=0xce;}_0x3f461f[_0x68d3('0x19')](_0x51dfd0);return _0x3f461f['set'](_0x68d3('0x1d'),_0x11e994+'-'+_0x579354+'/'+_0x3a09e5)[_0x68d3('0x1e')](_0x4b9c87);}return null;};}function patchUpdates(_0x4ec837){return function(_0x39cf04){try{jsonpatch[_0x68d3('0x1f')](_0x39cf04,_0x4ec837,!![]);}catch(_0x2c3730){return BPromise['reject'](_0x2c3730);}return _0x39cf04['save']();};}function saveUpdates(_0x4b7bb1,_0x32c98b){return function(_0x439fea){if(_0x439fea){return _0x439fea[_0x68d3('0x20')](_0x4b7bb1)[_0x68d3('0x21')](function(_0x592807){return _0x592807;});}return null;};}function removeEntity(_0x4dd04b,_0x3fc3fb){return function(_0x1d4ecd){if(_0x1d4ecd){return _0x1d4ecd[_0x68d3('0x22')]()[_0x68d3('0x21')](function(){_0x4dd04b[_0x68d3('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x48968b,_0x1c41e9){return function(_0x4cf0bb){if(!_0x4cf0bb){_0x48968b[_0x68d3('0x18')](0x194);}return _0x4cf0bb;};}function handleError(_0x58d2bc,_0x464591){_0x464591=_0x464591||0x1f4;return function(_0x29be40){logger['error'](_0x29be40[_0x68d3('0x23')]);if(_0x29be40[_0x68d3('0x24')]){delete _0x29be40[_0x68d3('0x24')];}_0x58d2bc[_0x68d3('0x19')](_0x464591)[_0x68d3('0x25')](_0x29be40);};}exports[_0x68d3('0x26')]=function(_0x28cc95,_0x28547d){var _0x44cfb6={},_0x49422f={},_0x2f446d={'count':0x0,'rows':[]};var _0x36fdfe=_['map'](db[_0x68d3('0x27')]['rawAttributes'],function(_0x4e8d2b){return{'name':_0x4e8d2b[_0x68d3('0x28')],'type':_0x4e8d2b[_0x68d3('0x29')][_0x68d3('0x2a')]};});_0x49422f[_0x68d3('0x2b')]=_[_0x68d3('0x2c')](_0x36fdfe,'name');_0x49422f[_0x68d3('0x2d')]=_[_0x68d3('0x2e')](_0x28cc95[_0x68d3('0x2d')]);_0x49422f[_0x68d3('0x2f')]=_[_0x68d3('0x30')](_0x49422f[_0x68d3('0x2b')],_0x49422f[_0x68d3('0x2d')]);_0x44cfb6[_0x68d3('0x31')]=_[_0x68d3('0x30')](_0x49422f[_0x68d3('0x2b')],qs[_0x68d3('0x32')](_0x28cc95[_0x68d3('0x2d')]['fields']));_0x44cfb6[_0x68d3('0x31')]=_0x44cfb6[_0x68d3('0x31')]['length']?_0x44cfb6['attributes']:_0x49422f[_0x68d3('0x2b')];if(!_0x28cc95['query']['hasOwnProperty'](_0x68d3('0x33'))){_0x44cfb6[_0x68d3('0x1c')]=qs[_0x68d3('0x1c')](_0x28cc95['query'][_0x68d3('0x1c')]);_0x44cfb6['offset']=qs[_0x68d3('0x1b')](_0x28cc95['query'][_0x68d3('0x1b')]);}_0x44cfb6[_0x68d3('0x34')]=qs['sort'](_0x28cc95[_0x68d3('0x2d')][_0x68d3('0x35')]);_0x44cfb6[_0x68d3('0x36')]=qs[_0x68d3('0x2f')](_[_0x68d3('0x37')](_0x28cc95[_0x68d3('0x2d')],_0x49422f[_0x68d3('0x2f')]),_0x36fdfe);if(_0x28cc95[_0x68d3('0x2d')][_0x68d3('0x38')]){_0x44cfb6[_0x68d3('0x36')]=_[_0x68d3('0x39')](_0x44cfb6['where'],{'$or':_[_0x68d3('0x2c')](_0x36fdfe,function(_0x219926){if(_0x219926['type']!==_0x68d3('0x3a')){var _0x511465={};_0x511465[_0x219926[_0x68d3('0x24')]]={'$like':'%'+_0x28cc95[_0x68d3('0x2d')]['filter']+'%'};return _0x511465;}})});}_0x44cfb6=_['merge']({},_0x44cfb6,_0x28cc95[_0x68d3('0x3b')]);var _0x212a3d={'where':_0x44cfb6[_0x68d3('0x36')]};return db['SugarcrmField'][_0x68d3('0x3c')](_0x212a3d)[_0x68d3('0x21')](function(_0x2d0f6a){_0x2f446d['count']=_0x2d0f6a;if(_0x28cc95['query'][_0x68d3('0x3d')]){_0x44cfb6['include']=[{'all':!![]}];}return db[_0x68d3('0x27')]['findAll'](_0x44cfb6);})[_0x68d3('0x21')](function(_0x42e9a4){_0x2f446d[_0x68d3('0x3e')]=_0x42e9a4;return _0x2f446d;})['then'](respondWithFilteredResult(_0x28547d,_0x44cfb6))[_0x68d3('0x3f')](handleError(_0x28547d,null));};exports[_0x68d3('0x40')]=function(_0x890699,_0x58997c){var _0x37180f={'raw':!![],'where':{'id':_0x890699[_0x68d3('0x41')]['id']}},_0x2f7f38={};_0x2f7f38['model']=_['keys'](db['SugarcrmField'][_0x68d3('0x42')]);_0x2f7f38[_0x68d3('0x2d')]=_[_0x68d3('0x2e')](_0x890699['query']);_0x2f7f38[_0x68d3('0x2f')]=_['intersection'](_0x2f7f38['model'],_0x2f7f38[_0x68d3('0x2d')]);_0x37180f[_0x68d3('0x31')]=_[_0x68d3('0x30')](_0x2f7f38[_0x68d3('0x2b')],qs[_0x68d3('0x32')](_0x890699[_0x68d3('0x2d')]['fields']));_0x37180f[_0x68d3('0x31')]=_0x37180f['attributes'][_0x68d3('0x43')]?_0x37180f[_0x68d3('0x31')]:_0x2f7f38[_0x68d3('0x2b')];if(_0x890699[_0x68d3('0x2d')][_0x68d3('0x3d')]){_0x37180f[_0x68d3('0x44')]=[{'all':!![]}];}_0x37180f=_['merge']({},_0x37180f,_0x890699[_0x68d3('0x3b')]);return db['SugarcrmField'][_0x68d3('0x45')](_0x37180f)['then'](handleEntityNotFound(_0x58997c,null))[_0x68d3('0x21')](respondWithResult(_0x58997c,null))[_0x68d3('0x3f')](handleError(_0x58997c,null));};exports['create']=function(_0x241f67,_0x528aa0){return db[_0x68d3('0x27')][_0x68d3('0x46')](_0x241f67['body'],{})[_0x68d3('0x21')](respondWithResult(_0x528aa0,0xc9))[_0x68d3('0x3f')](handleError(_0x528aa0,null));};exports[_0x68d3('0x20')]=function(_0x4d444e,_0x17148d){if(_0x4d444e[_0x68d3('0x47')]['id']){delete _0x4d444e['body']['id'];}return db['SugarcrmField'][_0x68d3('0x45')]({'where':{'id':_0x4d444e['params']['id']}})['then'](handleEntityNotFound(_0x17148d,null))['then'](saveUpdates(_0x4d444e[_0x68d3('0x47')],null))['then'](respondWithResult(_0x17148d,null))[_0x68d3('0x3f')](handleError(_0x17148d,null));};exports['destroy']=function(_0x32b2ff,_0x56dece){return db[_0x68d3('0x27')][_0x68d3('0x45')]({'where':{'id':_0x32b2ff[_0x68d3('0x41')]['id']}})['then'](handleEntityNotFound(_0x56dece,null))[_0x68d3('0x21')](removeEntity(_0x56dece,null))['catch'](handleError(_0x56dece,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index db6abfb..425d060 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 _0xdd10=['moment','rimraf','./intSugarcrmField.attributes','exports','define','sugarcrm_unique_index','idField','../../config/logger','api'];(function(_0x27596e,_0x579f83){var _0x1cb6ad=function(_0x1581a5){while(--_0x1581a5){_0x27596e['push'](_0x27596e['shift']());}};_0x1cb6ad(++_0x579f83);}(_0xdd10,0x178));var _0x0dd1=function(_0x2baac2,_0x1d7a00){_0x2baac2=_0x2baac2-0x0;var _0x565870=_0xdd10[_0x2baac2];return _0x565870;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0dd1('0x0'))(_0x0dd1('0x1'));var moment=require(_0x0dd1('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0dd1('0x3'));var config=require('../../config/environment');var attributes=require(_0x0dd1('0x4'));module[_0x0dd1('0x5')]=function(_0x13788a,_0x263783){return _0x13788a[_0x0dd1('0x6')]('SugarcrmField',attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':_0x0dd1('0x7'),'fields':[_0x0dd1('0x8'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x751b=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmField.attributes','exports','define','SugarcrmField','int_sugarcrm_fields','FieldId','lodash','util'];(function(_0x491bbb,_0x387cd1){var _0x487832=function(_0x31554d){while(--_0x31554d){_0x491bbb['push'](_0x491bbb['shift']());}};_0x487832(++_0x387cd1);}(_0x751b,0xfd));var _0xb751=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x751b[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0xb751('0x0'));var util=require(_0xb751('0x1'));var logger=require(_0xb751('0x2'))(_0xb751('0x3'));var moment=require('moment');var BPromise=require(_0xb751('0x4'));var rp=require(_0xb751('0x5'));var fs=require('fs');var path=require(_0xb751('0x6'));var rimraf=require(_0xb751('0x7'));var config=require(_0xb751('0x8'));var attributes=require(_0xb751('0x9'));module[_0xb751('0xa')]=function(_0x132c95,_0x43905c){return _0x132c95[_0xb751('0xb')](_0xb751('0xc'),attributes,{'tableName':_0xb751('0xd'),'paranoid':![],'indexes':[{'name':'sugarcrm_unique_index','fields':['idField',_0xb751('0xe')],'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 52f0811..c758687 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 _0xbaf0=['client','http','then','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x215e65,_0x183f97){var _0xa85842=function(_0x43bf45){while(--_0x43bf45){_0x215e65['push'](_0x215e65['shift']());}};_0xa85842(++_0x183f97);}(_0xbaf0,0x12a));var _0x0baf=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xbaf0[_0x1facfa];return _0x9ec701;};'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')]('SugarcrmField,\x20%s,\x20%s',_0x2dcaac,_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);return _0x5f5030(_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);}else{logger[_0x0baf('0xd')](_0x0baf('0xe'),_0x2dcaac,'request\x20sent');_0x5f5030(_0x2c7442['result'][_0x0baf('0x14')]);}})[_0x0baf('0x15')](function(_0x283408){logger[_0x0baf('0x13')](_0x0baf('0xe'),_0x2dcaac,_0x283408);_0x11b947(_0x283408);});});} \ No newline at end of file +var _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(_0x216214,_0x300f2b){var _0x1539fc=function(_0x115492){while(--_0x115492){_0x216214['push'](_0x216214['shift']());}};_0x1539fc(++_0x300f2b);}(_0x14a0,0x8e));var _0x014a=function(_0x1c06fa,_0x15e4b5){_0x1c06fa=_0x1c06fa-0x0;var _0x11f1e8=_0x14a0[_0x1c06fa];return _0x11f1e8;};'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 aec2c1f..84b20aa 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 _0x21c8=['/:id/fields','getFields','post','create','/:id/configurations','put','update','delete','exports','multer','connect-timeout','Router','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show'];(function(_0x8c9741,_0x1362c8){var _0x580e3e=function(_0x31ee83){while(--_0x31ee83){_0x8c9741['push'](_0x8c9741['shift']());}};_0x580e3e(++_0x1362c8);}(_0x21c8,0x113));var _0x821c=function(_0x42b030,_0x252cb6){_0x42b030=_0x42b030-0x0;var _0x112303=_0x21c8[_0x42b030];return _0x112303;};'use strict';var multer=require(_0x821c('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x821c('0x1'));var express=require('express');var router=express[_0x821c('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x821c('0x3'));var config=require(_0x821c('0x4'));var controller=require('./intVtigerAccount.controller');router[_0x821c('0x5')]('/',auth['isAuthenticated'](),controller[_0x821c('0x6')]);router[_0x821c('0x5')](_0x821c('0x7'),auth[_0x821c('0x8')](),controller[_0x821c('0x9')]);router[_0x821c('0x5')]('/:id/configurations',auth[_0x821c('0x8')](),controller['getConfigurations']);router['get'](_0x821c('0xa'),auth[_0x821c('0x8')](),controller[_0x821c('0xb')]);router[_0x821c('0xc')]('/',auth['isAuthenticated'](),controller[_0x821c('0xd')]);router[_0x821c('0xc')](_0x821c('0xe'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0x821c('0xf')]('/:id',auth[_0x821c('0x8')](),controller[_0x821c('0x10')]);router[_0x821c('0x11')]('/:id',auth[_0x821c('0x8')](),controller['destroy']);module[_0x821c('0x12')]=router; \ No newline at end of file +var _0xfd92=['getFields','create','addConfiguration','put','destroy','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','index','/:id','/:id/configurations','/:id/fields'];(function(_0x552f56,_0x16e3d1){var _0x23843b=function(_0x1bfba2){while(--_0x1bfba2){_0x552f56['push'](_0x552f56['shift']());}};_0x23843b(++_0x16e3d1);}(_0xfd92,0xe2));var _0x2fd9=function(_0x2014e7,_0x2bd284){_0x2014e7=_0x2014e7-0x0;var _0x29452d=_0xfd92[_0x2014e7];return _0x29452d;};'use strict';var multer=require(_0x2fd9('0x0'));var util=require(_0x2fd9('0x1'));var path=require('path');var timeout=require(_0x2fd9('0x2'));var express=require('express');var router=express[_0x2fd9('0x3')]();var auth=require(_0x2fd9('0x4'));var interaction=require(_0x2fd9('0x5'));var config=require(_0x2fd9('0x6'));var controller=require(_0x2fd9('0x7'));router[_0x2fd9('0x8')]('/',auth[_0x2fd9('0x9')](),controller[_0x2fd9('0xa')]);router['get'](_0x2fd9('0xb'),auth[_0x2fd9('0x9')](),controller['show']);router[_0x2fd9('0x8')](_0x2fd9('0xc'),auth[_0x2fd9('0x9')](),controller['getConfigurations']);router[_0x2fd9('0x8')](_0x2fd9('0xd'),auth[_0x2fd9('0x9')](),controller[_0x2fd9('0xe')]);router['post']('/',auth[_0x2fd9('0x9')](),controller[_0x2fd9('0xf')]);router['post'](_0x2fd9('0xc'),auth[_0x2fd9('0x9')](),controller[_0x2fd9('0x10')]);router[_0x2fd9('0x11')](_0x2fd9('0xb'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x2fd9('0xb'),auth[_0x2fd9('0x9')](),controller[_0x2fd9('0x12')]);module[_0x2fd9('0x13')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 4c2e7fb..77ab0d9 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 _0x7338=['HelpDesk','exports','STRING'];(function(_0x436943,_0x4d9536){var _0x33963e=function(_0x1c6fec){while(--_0x1c6fec){_0x436943['push'](_0x436943['shift']());}};_0x33963e(++_0x4d9536);}(_0x7338,0x148));var _0x8733=function(_0x616290,_0x280b7f){_0x616290=_0x616290-0x0;var _0x453879=_0x7338[_0x616290];return _0x453879;};'use strict';var Sequelize=require('sequelize');module[_0x8733('0x0')]={'name':{'type':Sequelize[_0x8733('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x8733('0x1')]},'username':{'type':Sequelize[_0x8733('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x8733('0x2')},'remoteUri':{'type':Sequelize[_0x8733('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x8733('0x1')]},'accessKey':{'type':Sequelize[_0x8733('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x4be2=['HelpDesk','sequelize','STRING'];(function(_0x36caff,_0x26651d){var _0x143688=function(_0x213ea9){while(--_0x213ea9){_0x36caff['push'](_0x36caff['shift']());}};_0x143688(++_0x26651d);}(_0x4be2,0x109));var _0x24be=function(_0x4b6969,_0x76dafa){_0x4b6969=_0x4b6969-0x0;var _0x21b82a=_0x4be2[_0x4b6969];return _0x21b82a;};'use strict';var Sequelize=require(_0x24be('0x0'));module['exports']={'name':{'type':Sequelize[_0x24be('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x24be('0x1')]},'username':{'type':Sequelize[_0x24be('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x24be('0x1')],'allowNull':![],'defaultValue':_0x24be('0x2')},'remoteUri':{'type':Sequelize[_0x24be('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x24be('0x1')]},'accessKey':{'type':Sequelize[_0x24be('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index 1a507da..b206f05 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 _0x57d2=['send','index','VtigerAccount','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','type','merge','count','includeAll','findAll','rows','params','rawAttributes','include','options','find','create','body','getConfigurations','pick','filter','hasOwnProperty','getSubjects','Descriptions','getDescriptions','channel','VtigerConfiguration','VtigerField','Subjects','md5','getFields','findOne','username','description','moduleName','remoteUri','serverUrl','accessKey','slice','lastIndexOf','format','%s/webservice.php','POST','login','result','success','GET','describe','sessionName','autogenerated','owner','remove','includes','editable','false','cf_','picklist','picklistValues','label','value','vTiger\x20error:\x20','statusCode','Wrong\x20credentials','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','test','Sequelize','ValidationError','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','end','status','json','offset','limit','set','Content-Range','reject','update','destroy','sendStatus','stack','name'];(function(_0x385dbf,_0x5c27f5){var _0x239097=function(_0x34338f){while(--_0x34338f){_0x385dbf['push'](_0x385dbf['shift']());}};_0x239097(++_0x5c27f5);}(_0x57d2,0xcf));var _0x257d=function(_0x4f2be1,_0xea1319){_0x4f2be1=_0x4f2be1-0x0;var _0x846f9b=_0x57d2[_0x4f2be1];return _0x846f9b;};'use strict';var pdf=require(_0x257d('0x0'));var emlformat=require(_0x257d('0x1'));var rimraf=require(_0x257d('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x257d('0x3'));var moment=require(_0x257d('0x4'));var BPromise=require(_0x257d('0x5'));var Mustache=require(_0x257d('0x6'));var util=require(_0x257d('0x7'));var path=require(_0x257d('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x257d('0x9'));var fs=require('fs');var _=require(_0x257d('0xa'));var squel=require('squel');var crypto=require(_0x257d('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x257d('0xc'));var toCsv=require(_0x257d('0xd'));var querystring=require(_0x257d('0xe'));var Papa=require(_0x257d('0xf'));var Redis=require(_0x257d('0x10'));var authService=require(_0x257d('0x11'));var qs=require(_0x257d('0x12'));var as=require(_0x257d('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x257d('0x14'));var utils=require('../../config/utils');var config=require(_0x257d('0x15'));var db=require(_0x257d('0x16'))['db'];var integrations=require(_0x257d('0x17'));var jayson=require(_0x257d('0x18'));var client=jayson[_0x257d('0x19')][_0x257d('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x2a9146,_0x356600,_0x445eb8){if(_0x445eb8){var _0x5efe72=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5efe72[_0x257d('0x1b')](_0x356600)){return _0x2a9146;}else{throw new db[(_0x257d('0x1c'))][(_0x257d('0x1d'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x2a9146;}}function respondWithRpcPromise(_0x5e7900,_0xf4bf2d,_0x6f1bb3,_0xbde14){return new BPromise(function(_0x29f70a,_0x2be7d2){var _0x323e40=_0xbde14||client;return _0x323e40[_0x257d('0x1e')](_0x5e7900,_0x6f1bb3)[_0x257d('0x1f')](function(_0x104978){logger[_0x257d('0x20')](_0x257d('0x21'),_0xf4bf2d,_0x257d('0x22'));logger[_0x257d('0x23')](_0x257d('0x24'),_0xf4bf2d,_0x257d('0x22'),JSON[_0x257d('0x25')](_0x104978));if(_0x104978['error']){if(_0x104978[_0x257d('0x26')][_0x257d('0x27')]===0x1f4){logger['error'](_0x257d('0x21'),_0xf4bf2d,_0x104978[_0x257d('0x26')]['message']);return _0x2be7d2(_0x104978[_0x257d('0x26')][_0x257d('0x28')]);}logger[_0x257d('0x26')](_0x257d('0x21'),_0xf4bf2d,_0x104978['error'][_0x257d('0x28')]);return _0x29f70a(_0x104978['error'][_0x257d('0x28')]);}else{logger[_0x257d('0x20')]('VtigerAccount,\x20%s,\x20%s',_0xf4bf2d,_0x257d('0x22'));_0x29f70a(_0x104978['result'][_0x257d('0x28')]);}})[_0x257d('0x29')](function(_0x330c8c){logger[_0x257d('0x26')](_0x257d('0x21'),_0xf4bf2d,_0x330c8c);_0x2be7d2(_0x330c8c);});});}function respondWithStatusCode(_0x10fcfe,_0x36d798){_0x36d798=_0x36d798||0xcc;return function(_0x1eb29f){if(_0x1eb29f){return _0x10fcfe['sendStatus'](_0x36d798);}return _0x10fcfe['status'](_0x36d798)[_0x257d('0x2a')]();};}function respondWithResult(_0x3d3794,_0xa3c772){_0xa3c772=_0xa3c772||0xc8;return function(_0x129d9e){if(_0x129d9e){return _0x3d3794[_0x257d('0x2b')](_0xa3c772)[_0x257d('0x2c')](_0x129d9e);}};}function respondWithFilteredResult(_0x4bfd58,_0x1b93a7){return function(_0x37ab32){if(_0x37ab32){var _0x110486=_0x37ab32['count'],_0x1c87cc=_0x1b93a7['offset'],_0x31afcb=_0x1b93a7[_0x257d('0x2d')]+_0x1b93a7[_0x257d('0x2e')],_0x2dee03;if(_0x31afcb>=_0x110486){_0x31afcb=_0x110486;_0x2dee03=0xc8;}else{_0x2dee03=0xce;}_0x4bfd58[_0x257d('0x2b')](_0x2dee03);return _0x4bfd58[_0x257d('0x2f')](_0x257d('0x30'),_0x1c87cc+'-'+_0x31afcb+'/'+_0x110486)[_0x257d('0x2c')](_0x37ab32);}return null;};}function patchUpdates(_0xf99b41){return function(_0x3a7639){try{jsonpatch['apply'](_0x3a7639,_0xf99b41,!![]);}catch(_0x49f16e){return BPromise[_0x257d('0x31')](_0x49f16e);}return _0x3a7639['save']();};}function saveUpdates(_0x117a44,_0x221435){return function(_0x589789){if(_0x589789){return _0x589789[_0x257d('0x32')](_0x117a44)[_0x257d('0x1f')](function(_0x43fa37){return _0x43fa37;});}return null;};}function removeEntity(_0x20f98e,_0x36806e){return function(_0x5628fc){if(_0x5628fc){return _0x5628fc[_0x257d('0x33')]()[_0x257d('0x1f')](function(){_0x20f98e[_0x257d('0x2b')](0xcc)[_0x257d('0x2a')]();});}};}function handleEntityNotFound(_0x16db82,_0x387442){return function(_0x889076){if(!_0x889076){_0x16db82[_0x257d('0x34')](0x194);}return _0x889076;};}function handleError(_0x1b6b29,_0x20fed9){_0x20fed9=_0x20fed9||0x1f4;return function(_0x294128){logger['error'](_0x294128[_0x257d('0x35')]);if(_0x294128[_0x257d('0x36')]){delete _0x294128[_0x257d('0x36')];}_0x1b6b29[_0x257d('0x2b')](_0x20fed9)[_0x257d('0x37')](_0x294128);};}exports[_0x257d('0x38')]=function(_0x30b01c,_0x2bfe56){var _0x544c86={},_0x45654d={},_0x17d890={'count':0x0,'rows':[]};var _0x361619=_['map'](db[_0x257d('0x39')]['rawAttributes'],function(_0x373b7a){return{'name':_0x373b7a[_0x257d('0x3a')],'type':_0x373b7a['type'][_0x257d('0x3b')]};});_0x45654d[_0x257d('0x3c')]=_[_0x257d('0x3d')](_0x361619,_0x257d('0x36'));_0x45654d[_0x257d('0x3e')]=_[_0x257d('0x3f')](_0x30b01c[_0x257d('0x3e')]);_0x45654d[_0x257d('0x40')]=_[_0x257d('0x41')](_0x45654d['model'],_0x45654d['query']);_0x544c86[_0x257d('0x42')]=_['intersection'](_0x45654d[_0x257d('0x3c')],qs[_0x257d('0x43')](_0x30b01c[_0x257d('0x3e')][_0x257d('0x43')]));_0x544c86[_0x257d('0x42')]=_0x544c86['attributes'][_0x257d('0x44')]?_0x544c86[_0x257d('0x42')]:_0x45654d[_0x257d('0x3c')];if(!_0x30b01c[_0x257d('0x3e')]['hasOwnProperty'](_0x257d('0x45'))){_0x544c86['limit']=qs[_0x257d('0x2e')](_0x30b01c[_0x257d('0x3e')][_0x257d('0x2e')]);_0x544c86[_0x257d('0x2d')]=qs['offset'](_0x30b01c[_0x257d('0x3e')][_0x257d('0x2d')]);}_0x544c86[_0x257d('0x46')]=qs[_0x257d('0x47')](_0x30b01c['query']['sort']);_0x544c86[_0x257d('0x48')]=qs['filters'](_['pick'](_0x30b01c[_0x257d('0x3e')],_0x45654d[_0x257d('0x40')]),_0x361619);if(_0x30b01c['query']['filter']){_0x544c86[_0x257d('0x48')]=_['merge'](_0x544c86[_0x257d('0x48')],{'$or':_[_0x257d('0x3d')](_0x361619,function(_0x25614d){if(_0x25614d[_0x257d('0x49')]!=='VIRTUAL'){var _0x19c606={};_0x19c606[_0x25614d[_0x257d('0x36')]]={'$like':'%'+_0x30b01c[_0x257d('0x3e')]['filter']+'%'};return _0x19c606;}})});}_0x544c86=_[_0x257d('0x4a')]({},_0x544c86,_0x30b01c['options']);var _0x581184={'where':_0x544c86['where']};return db['VtigerAccount'][_0x257d('0x4b')](_0x581184)[_0x257d('0x1f')](function(_0x3a0bec){_0x17d890[_0x257d('0x4b')]=_0x3a0bec;if(_0x30b01c[_0x257d('0x3e')][_0x257d('0x4c')]){_0x544c86['include']=[{'all':!![]}];}return db['VtigerAccount'][_0x257d('0x4d')](_0x544c86);})['then'](function(_0xdfb397){_0x17d890[_0x257d('0x4e')]=_0xdfb397;return _0x17d890;})['then'](respondWithFilteredResult(_0x2bfe56,_0x544c86))[_0x257d('0x29')](handleError(_0x2bfe56,null));};exports['show']=function(_0x18510f,_0x1748f1){var _0x344546={'raw':![],'where':{'id':_0x18510f[_0x257d('0x4f')]['id']}},_0x5af75c={};_0x5af75c[_0x257d('0x3c')]=_[_0x257d('0x3f')](db[_0x257d('0x39')][_0x257d('0x50')]);_0x5af75c[_0x257d('0x3e')]=_[_0x257d('0x3f')](_0x18510f[_0x257d('0x3e')]);_0x5af75c['filters']=_[_0x257d('0x41')](_0x5af75c['model'],_0x5af75c[_0x257d('0x3e')]);_0x344546[_0x257d('0x42')]=_['intersection'](_0x5af75c[_0x257d('0x3c')],qs[_0x257d('0x43')](_0x18510f[_0x257d('0x3e')]['fields']));_0x344546[_0x257d('0x42')]=_0x344546[_0x257d('0x42')][_0x257d('0x44')]?_0x344546[_0x257d('0x42')]:_0x5af75c[_0x257d('0x3c')];if(_0x18510f[_0x257d('0x3e')]['includeAll']){_0x344546[_0x257d('0x51')]=[{'all':!![]}];}_0x344546=_['merge']({},_0x344546,_0x18510f[_0x257d('0x52')]);return db['VtigerAccount'][_0x257d('0x53')](_0x344546)[_0x257d('0x1f')](handleEntityNotFound(_0x1748f1,null))[_0x257d('0x1f')](respondWithResult(_0x1748f1,null))[_0x257d('0x29')](handleError(_0x1748f1,null));};exports[_0x257d('0x54')]=function(_0x3eef53,_0x91d4df){return db['VtigerAccount']['create'](_0x3eef53[_0x257d('0x55')],{})[_0x257d('0x1f')](respondWithResult(_0x91d4df,0xc9))[_0x257d('0x29')](handleError(_0x91d4df,null));};exports['update']=function(_0x5a0699,_0x1efec3){if(_0x5a0699[_0x257d('0x55')]['id']){delete _0x5a0699[_0x257d('0x55')]['id'];}return db[_0x257d('0x39')][_0x257d('0x53')]({'where':{'id':_0x5a0699[_0x257d('0x4f')]['id']}})[_0x257d('0x1f')](handleEntityNotFound(_0x1efec3,null))[_0x257d('0x1f')](saveUpdates(_0x5a0699[_0x257d('0x55')],null))[_0x257d('0x1f')](respondWithResult(_0x1efec3,null))['catch'](handleError(_0x1efec3,null));};exports['destroy']=function(_0x480884,_0x14351b){return db['VtigerAccount'][_0x257d('0x53')]({'where':{'id':_0x480884[_0x257d('0x4f')]['id']}})[_0x257d('0x1f')](handleEntityNotFound(_0x14351b,null))[_0x257d('0x1f')](removeEntity(_0x14351b,null))[_0x257d('0x29')](handleError(_0x14351b,null));};exports[_0x257d('0x56')]=function(_0x4fe848,_0x2c5d05,_0x3433e1){var _0x321a7d={};var _0x24473d={};var _0x14f6e9;var _0x1c1699;return db['VtigerAccount']['findOne']({'where':{'id':_0x4fe848['params']['id']}})[_0x257d('0x1f')](handleEntityNotFound(_0x2c5d05,null))['then'](function(_0xfb1338){if(_0xfb1338){_0x14f6e9=_0xfb1338;_0x24473d[_0x257d('0x3c')]=_['keys'](db['VtigerConfiguration']['rawAttributes']);_0x24473d[_0x257d('0x3e')]=_['keys'](_0x4fe848['query']);_0x24473d['filters']=_[_0x257d('0x41')](_0x24473d[_0x257d('0x3c')],_0x24473d[_0x257d('0x3e')]);_0x321a7d[_0x257d('0x42')]=_[_0x257d('0x41')](_0x24473d[_0x257d('0x3c')],qs[_0x257d('0x43')](_0x4fe848[_0x257d('0x3e')][_0x257d('0x43')]));_0x321a7d[_0x257d('0x42')]=_0x321a7d[_0x257d('0x42')][_0x257d('0x44')]?_0x321a7d[_0x257d('0x42')]:_0x24473d[_0x257d('0x3c')];_0x321a7d[_0x257d('0x46')]=qs[_0x257d('0x47')](_0x4fe848[_0x257d('0x3e')][_0x257d('0x47')]);_0x321a7d[_0x257d('0x48')]=qs['filters'](_[_0x257d('0x57')](_0x4fe848[_0x257d('0x3e')],_0x24473d['filters']));if(_0x4fe848[_0x257d('0x3e')][_0x257d('0x58')]){_0x321a7d['where']=_[_0x257d('0x4a')](_0x321a7d[_0x257d('0x48')],{'$or':_[_0x257d('0x3d')](_0x321a7d['attributes'],function(_0x452c97){var _0xef3943={};_0xef3943[_0x452c97]={'$like':'%'+_0x4fe848[_0x257d('0x3e')]['filter']+'%'};return _0xef3943;})});}_0x321a7d=_['merge']({},_0x321a7d,_0x4fe848[_0x257d('0x52')]);return _0x14f6e9[_0x257d('0x56')](_0x321a7d);}})[_0x257d('0x1f')](function(_0xcbda47){if(_0xcbda47){_0x1c1699=_0xcbda47[_0x257d('0x44')];if(!_0x4fe848[_0x257d('0x3e')][_0x257d('0x59')](_0x257d('0x45'))){_0x321a7d[_0x257d('0x2e')]=qs[_0x257d('0x2e')](_0x4fe848[_0x257d('0x3e')][_0x257d('0x2e')]);_0x321a7d[_0x257d('0x2d')]=qs[_0x257d('0x2d')](_0x4fe848[_0x257d('0x3e')][_0x257d('0x2d')]);}return _0x14f6e9[_0x257d('0x56')](_0x321a7d);}})[_0x257d('0x1f')](function(_0x1e2e99){if(_0x1e2e99){return _0x1e2e99?{'count':_0x1c1699,'rows':_0x1e2e99}:null;}})[_0x257d('0x1f')](respondWithResult(_0x2c5d05,null))[_0x257d('0x29')](handleError(_0x2c5d05,null));};exports['addConfiguration']=function(_0x94a74b,_0x1edc2a,_0x4e52d4){if(_0x94a74b[_0x257d('0x55')]['id']){delete _0x94a74b[_0x257d('0x55')]['id'];}return db['VtigerAccount']['findOne']({'where':{'id':_0x94a74b['params']['id']}})['then'](handleEntityNotFound(_0x1edc2a,null))[_0x257d('0x1f')](function(_0xe5da1c){if(_0xe5da1c){_0x94a74b[_0x257d('0x55')]['AccountId']=_0xe5da1c['id'];_0x94a74b[_0x257d('0x55')]['Subjects']=integrations[_0x257d('0x5a')](_0x94a74b[_0x257d('0x55')]['channel'],_0x94a74b['body'][_0x257d('0x49')]);_0x94a74b['body'][_0x257d('0x5b')]=integrations[_0x257d('0x5c')](_0x94a74b['body'][_0x257d('0x5d')],_0x94a74b[_0x257d('0x55')][_0x257d('0x49')]);return db[_0x257d('0x5e')][_0x257d('0x54')](_0x94a74b[_0x257d('0x55')],{'include':[{'model':db[_0x257d('0x5f')],'as':_0x257d('0x60')},{'model':db[_0x257d('0x5f')],'as':_0x257d('0x5b')}]});}return null;})[_0x257d('0x1f')](respondWithResult(_0x1edc2a,null))['catch'](handleError(_0x1edc2a,null));};var md5=require(_0x257d('0x61'));exports[_0x257d('0x62')]=function(_0x5d64f0,_0x495bd5,_0x3893fa){var _0x2f59b7=null;var _0x5d27b9=null;var _0x17c83c=null;var _0x2f117c=null;var _0x1f7e43='';return db[_0x257d('0x39')][_0x257d('0x63')]({'where':{'id':_0x5d64f0['params']['id']},'attributes':['id',_0x257d('0x36'),_0x257d('0x64'),_0x257d('0x65'),_0x257d('0x66'),_0x257d('0x67'),_0x257d('0x68'),_0x257d('0x69')]})[_0x257d('0x1f')](handleEntityNotFound(_0x495bd5,null))['then'](function(_0x4e77a4){if(_0x4e77a4){_0x2f59b7=_0x4e77a4[_0x257d('0x64')];_0x5d27b9=_0x4e77a4[_0x257d('0x69')];_0x17c83c=_0x4e77a4[_0x257d('0x66')];_0x1f7e43=_0x4e77a4[_0x257d('0x67')];var _0x3fe2c6=_0x1f7e43[_0x257d('0x6a')](-0x1);if(_0x3fe2c6==='/'){_0x1f7e43=_0x1f7e43['substring'](0x0,_0x1f7e43[_0x257d('0x6b')](_0x3fe2c6));}_0x2f117c=util[_0x257d('0x6c')](_0x257d('0x6d'),_0x1f7e43);var _0x467b2a={'method':'GET','uri':_0x2f117c,'qs':{'operation':'getchallenge','username':_0x4e77a4['username']},'json':!![]};return rp(_0x467b2a);}})[_0x257d('0x1f')](function(_0x382970){if(_0x382970['success']){var _0x51a7b2={'method':_0x257d('0x6e'),'uri':_0x2f117c,'form':{'operation':_0x257d('0x6f'),'username':_0x2f59b7,'accessKey':md5(_0x382970[_0x257d('0x70')]['token']+_0x5d27b9)},'json':!![]};return rp(_0x51a7b2);}})[_0x257d('0x1f')](function(_0x5bee8c){if(_0x5bee8c[_0x257d('0x71')]){var _0x2771f3={'method':_0x257d('0x72'),'uri':_0x2f117c,'qs':{'operation':_0x257d('0x73'),'username':_0x2f59b7,'sessionName':_0x5bee8c[_0x257d('0x70')][_0x257d('0x74')],'elementType':_0x17c83c},'json':!![]};return rp(_0x2771f3);}})['then'](function(_0xfe9a3d){if(_0xfe9a3d['success']){var _0x2e53f6=[_0x257d('0x75'),'reference',_0x257d('0x76')];_[_0x257d('0x77')](_0xfe9a3d[_0x257d('0x70')][_0x257d('0x43')],function(_0x46ec76){return _0x2e53f6[_0x257d('0x78')](_0x46ec76[_0x257d('0x49')][_0x257d('0x36')]);});_[_0x257d('0x77')](_0xfe9a3d[_0x257d('0x70')][_0x257d('0x43')],function(_0x10c750){return _0x10c750[_0x257d('0x79')]===_0x257d('0x7a');});return{'count':_0xfe9a3d[_0x257d('0x70')][_0x257d('0x43')][_0x257d('0x44')],'rows':_[_0x257d('0x3d')](_0xfe9a3d[_0x257d('0x70')][_0x257d('0x43')],function(_0x2b9294){return{'id':_0x2b9294[_0x257d('0x36')],'name':_0x2b9294['label'],'custom':_['startsWith'](_0x2b9294['name'],_0x257d('0x7b'))?!![]:![],'options':_0x2b9294[_0x257d('0x49')][_0x257d('0x36')]===_0x257d('0x7c')&&_0x2b9294['type'][_0x257d('0x7d')][_0x257d('0x44')]>0x0?_[_0x257d('0x3d')](_0x2b9294['type']['picklistValues'],function(_0x3bdfa1){return{'name':_0x3bdfa1[_0x257d('0x7e')],'value':_0x3bdfa1[_0x257d('0x7f')]};}):[]};})};}})[_0x257d('0x1f')](respondWithResult(_0x495bd5,null))['catch'](function(_0x36136d){console['log'](_0x257d('0x80')+_0x36136d);var _0x327c20=_0x5d64f0[_0x257d('0x3e')][_0x257d('0x1b')]?0x1f4:_0x36136d[_0x257d('0x81')]||0x1f4;logger[_0x257d('0x26')]('getFields,\x20%s,\x20%s,\x20%s',_0x257d('0x62'),_0x327c20,JSON[_0x257d('0x25')](_0x36136d));delete _0x36136d[_0x257d('0x36')];if(_0x327c20===0x191){_0x327c20=0x190;}_0x495bd5[_0x257d('0x2b')](_0x327c20)[_0x257d('0x37')](_0x5d64f0[_0x257d('0x3e')][_0x257d('0x1b')]?{'message':_0x257d('0x82'),'statusCode':_0x36136d[_0x257d('0x81')]}:_0x36136d);});}; \ No newline at end of file +var _0x5697=['test','request','then','info','request\x20sent','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VtigerAccount,\x20%s,\x20%s','result','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','map','VtigerAccount','rawAttributes','fieldName','type','key','query','keys','filters','intersection','fields','attributes','length','model','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','catch','params','find','create','body','getConfigurations','findOne','pick','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','VtigerConfiguration','VtigerField','md5','getFields','username','moduleName','remoteUri','serverUrl','accessKey','substring','lastIndexOf','%s/webservice.php','getchallenge','success','login','GET','describe','sessionName','owner','includes','editable','false','label','startsWith','cf_','picklist','picklistValues','log','vTiger\x20error:\x20','statusCode','Wrong\x20credentials','html-pdf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http'];(function(_0x328371,_0xe64310){var _0x271499=function(_0x4fa5c3){while(--_0x4fa5c3){_0x328371['push'](_0x328371['shift']());}};_0x271499(++_0xe64310);}(_0x5697,0x64));var _0x7569=function(_0x32e94b,_0x38c7a7){_0x32e94b=_0x32e94b-0x0;var _0x3b1567=_0x5697[_0x32e94b];return _0x3b1567;};'use strict';var pdf=require(_0x7569('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x7569('0x1'));var jsonpatch=require(_0x7569('0x2'));var rp=require(_0x7569('0x3'));var moment=require(_0x7569('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7569('0x5'));var util=require(_0x7569('0x6'));var path=require(_0x7569('0x7'));var sox=require(_0x7569('0x8'));var csv=require(_0x7569('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x7569('0xa'));var squel=require(_0x7569('0xb'));var crypto=require(_0x7569('0xc'));var jsforce=require(_0x7569('0xd'));var deskjs=require(_0x7569('0xe'));var toCsv=require(_0x7569('0x9'));var querystring=require(_0x7569('0xf'));var Papa=require(_0x7569('0x10'));var Redis=require(_0x7569('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x7569('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7569('0x13'))(_0x7569('0x14'));var utils=require(_0x7569('0x15'));var config=require(_0x7569('0x16'));var db=require(_0x7569('0x17'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x7569('0x18'));var client=jayson[_0x7569('0x19')][_0x7569('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x1ad8f6,_0x580ee6,_0x1fdf7e){if(_0x1fdf7e){var _0x30a16e=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x30a16e[_0x7569('0x1b')](_0x580ee6)){return _0x1ad8f6;}else{throw new db['Sequelize']['ValidationError']('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x1ad8f6;}}function respondWithRpcPromise(_0x4b4d4f,_0x373f80,_0x3a9976,_0x2b42c3){return new BPromise(function(_0xf1e1b6,_0x44cd1d){var _0x19f5b9=_0x2b42c3||client;return _0x19f5b9[_0x7569('0x1c')](_0x4b4d4f,_0x3a9976)[_0x7569('0x1d')](function(_0x40898d){logger[_0x7569('0x1e')]('VtigerAccount,\x20%s,\x20%s',_0x373f80,_0x7569('0x1f'));logger['debug'](_0x7569('0x20'),_0x373f80,_0x7569('0x1f'),JSON[_0x7569('0x21')](_0x40898d));if(_0x40898d[_0x7569('0x22')]){if(_0x40898d[_0x7569('0x22')][_0x7569('0x23')]===0x1f4){logger['error']('VtigerAccount,\x20%s,\x20%s',_0x373f80,_0x40898d[_0x7569('0x22')][_0x7569('0x24')]);return _0x44cd1d(_0x40898d[_0x7569('0x22')][_0x7569('0x24')]);}logger[_0x7569('0x22')](_0x7569('0x25'),_0x373f80,_0x40898d['error'][_0x7569('0x24')]);return _0xf1e1b6(_0x40898d[_0x7569('0x22')][_0x7569('0x24')]);}else{logger[_0x7569('0x1e')](_0x7569('0x25'),_0x373f80,'request\x20sent');_0xf1e1b6(_0x40898d[_0x7569('0x26')]['message']);}})['catch'](function(_0x591e77){logger['error'](_0x7569('0x25'),_0x373f80,_0x591e77);_0x44cd1d(_0x591e77);});});}function respondWithStatusCode(_0x769506,_0x113c6c){_0x113c6c=_0x113c6c||0xcc;return function(_0x5af8f7){if(_0x5af8f7){return _0x769506[_0x7569('0x27')](_0x113c6c);}return _0x769506[_0x7569('0x28')](_0x113c6c)[_0x7569('0x29')]();};}function respondWithResult(_0x3f035f,_0x5b64c1){_0x5b64c1=_0x5b64c1||0xc8;return function(_0x5847cd){if(_0x5847cd){return _0x3f035f['status'](_0x5b64c1)[_0x7569('0x2a')](_0x5847cd);}};}function respondWithFilteredResult(_0x5cbf3f,_0x476589){return function(_0x5b6d17){if(_0x5b6d17){var _0x331780=_0x5b6d17[_0x7569('0x2b')],_0x598817=_0x476589[_0x7569('0x2c')],_0x39c110=_0x476589[_0x7569('0x2c')]+_0x476589[_0x7569('0x2d')],_0x128f1d;if(_0x39c110>=_0x331780){_0x39c110=_0x331780;_0x128f1d=0xc8;}else{_0x128f1d=0xce;}_0x5cbf3f[_0x7569('0x28')](_0x128f1d);return _0x5cbf3f[_0x7569('0x2e')](_0x7569('0x2f'),_0x598817+'-'+_0x39c110+'/'+_0x331780)[_0x7569('0x2a')](_0x5b6d17);}return null;};}function patchUpdates(_0x4188b){return function(_0x2e63be){try{jsonpatch[_0x7569('0x30')](_0x2e63be,_0x4188b,!![]);}catch(_0x9ee744){return BPromise[_0x7569('0x31')](_0x9ee744);}return _0x2e63be[_0x7569('0x32')]();};}function saveUpdates(_0x19ceb6,_0x45b386){return function(_0x18f215){if(_0x18f215){return _0x18f215[_0x7569('0x33')](_0x19ceb6)['then'](function(_0x52b669){return _0x52b669;});}return null;};}function removeEntity(_0x108bb1,_0x4cb065){return function(_0x5a92f7){if(_0x5a92f7){return _0x5a92f7[_0x7569('0x34')]()[_0x7569('0x1d')](function(){_0x108bb1['status'](0xcc)[_0x7569('0x29')]();});}};}function handleEntityNotFound(_0x36857d,_0xb64572){return function(_0x822e19){if(!_0x822e19){_0x36857d['sendStatus'](0x194);}return _0x822e19;};}function handleError(_0x261266,_0x24bb11){_0x24bb11=_0x24bb11||0x1f4;return function(_0x5d464){logger['error'](_0x5d464[_0x7569('0x35')]);if(_0x5d464[_0x7569('0x36')]){delete _0x5d464['name'];}_0x261266[_0x7569('0x28')](_0x24bb11)[_0x7569('0x37')](_0x5d464);};}exports['index']=function(_0x147a43,_0x3e96de){var _0x513df3={},_0x2f1b67={},_0x49c867={'count':0x0,'rows':[]};var _0x54f3f0=_[_0x7569('0x38')](db[_0x7569('0x39')][_0x7569('0x3a')],function(_0x52d8a2){return{'name':_0x52d8a2[_0x7569('0x3b')],'type':_0x52d8a2[_0x7569('0x3c')][_0x7569('0x3d')]};});_0x2f1b67['model']=_[_0x7569('0x38')](_0x54f3f0,_0x7569('0x36'));_0x2f1b67[_0x7569('0x3e')]=_[_0x7569('0x3f')](_0x147a43['query']);_0x2f1b67[_0x7569('0x40')]=_['intersection'](_0x2f1b67['model'],_0x2f1b67['query']);_0x513df3['attributes']=_[_0x7569('0x41')](_0x2f1b67['model'],qs[_0x7569('0x42')](_0x147a43[_0x7569('0x3e')][_0x7569('0x42')]));_0x513df3['attributes']=_0x513df3[_0x7569('0x43')][_0x7569('0x44')]?_0x513df3[_0x7569('0x43')]:_0x2f1b67[_0x7569('0x45')];if(!_0x147a43[_0x7569('0x3e')][_0x7569('0x46')](_0x7569('0x47'))){_0x513df3[_0x7569('0x2d')]=qs[_0x7569('0x2d')](_0x147a43[_0x7569('0x3e')]['limit']);_0x513df3['offset']=qs['offset'](_0x147a43[_0x7569('0x3e')][_0x7569('0x2c')]);}_0x513df3[_0x7569('0x48')]=qs[_0x7569('0x49')](_0x147a43[_0x7569('0x3e')][_0x7569('0x49')]);_0x513df3[_0x7569('0x4a')]=qs['filters'](_['pick'](_0x147a43[_0x7569('0x3e')],_0x2f1b67[_0x7569('0x40')]),_0x54f3f0);if(_0x147a43[_0x7569('0x3e')][_0x7569('0x4b')]){_0x513df3[_0x7569('0x4a')]=_[_0x7569('0x4c')](_0x513df3[_0x7569('0x4a')],{'$or':_[_0x7569('0x38')](_0x54f3f0,function(_0x55d5b2){if(_0x55d5b2[_0x7569('0x3c')]!==_0x7569('0x4d')){var _0x4647bb={};_0x4647bb[_0x55d5b2['name']]={'$like':'%'+_0x147a43[_0x7569('0x3e')][_0x7569('0x4b')]+'%'};return _0x4647bb;}})});}_0x513df3=_[_0x7569('0x4c')]({},_0x513df3,_0x147a43[_0x7569('0x4e')]);var _0x4eae3c={'where':_0x513df3[_0x7569('0x4a')]};return db[_0x7569('0x39')]['count'](_0x4eae3c)[_0x7569('0x1d')](function(_0x21dd29){_0x49c867[_0x7569('0x2b')]=_0x21dd29;if(_0x147a43[_0x7569('0x3e')]['includeAll']){_0x513df3[_0x7569('0x4f')]=[{'all':!![]}];}return db[_0x7569('0x39')][_0x7569('0x50')](_0x513df3);})[_0x7569('0x1d')](function(_0xa90b0e){_0x49c867[_0x7569('0x51')]=_0xa90b0e;return _0x49c867;})[_0x7569('0x1d')](respondWithFilteredResult(_0x3e96de,_0x513df3))[_0x7569('0x52')](handleError(_0x3e96de,null));};exports['show']=function(_0x26205b,_0x5b91ff){var _0x414647={'raw':![],'where':{'id':_0x26205b[_0x7569('0x53')]['id']}},_0xec657f={};_0xec657f[_0x7569('0x45')]=_[_0x7569('0x3f')](db['VtigerAccount'][_0x7569('0x3a')]);_0xec657f['query']=_[_0x7569('0x3f')](_0x26205b['query']);_0xec657f[_0x7569('0x40')]=_[_0x7569('0x41')](_0xec657f['model'],_0xec657f[_0x7569('0x3e')]);_0x414647[_0x7569('0x43')]=_[_0x7569('0x41')](_0xec657f[_0x7569('0x45')],qs[_0x7569('0x42')](_0x26205b[_0x7569('0x3e')][_0x7569('0x42')]));_0x414647[_0x7569('0x43')]=_0x414647[_0x7569('0x43')][_0x7569('0x44')]?_0x414647['attributes']:_0xec657f[_0x7569('0x45')];if(_0x26205b['query']['includeAll']){_0x414647['include']=[{'all':!![]}];}_0x414647=_[_0x7569('0x4c')]({},_0x414647,_0x26205b[_0x7569('0x4e')]);return db[_0x7569('0x39')][_0x7569('0x54')](_0x414647)[_0x7569('0x1d')](handleEntityNotFound(_0x5b91ff,null))[_0x7569('0x1d')](respondWithResult(_0x5b91ff,null))['catch'](handleError(_0x5b91ff,null));};exports[_0x7569('0x55')]=function(_0x36af72,_0x120621){return db[_0x7569('0x39')][_0x7569('0x55')](_0x36af72[_0x7569('0x56')],{})[_0x7569('0x1d')](respondWithResult(_0x120621,0xc9))[_0x7569('0x52')](handleError(_0x120621,null));};exports[_0x7569('0x33')]=function(_0x56d498,_0x3e48df){if(_0x56d498[_0x7569('0x56')]['id']){delete _0x56d498['body']['id'];}return db[_0x7569('0x39')][_0x7569('0x54')]({'where':{'id':_0x56d498[_0x7569('0x53')]['id']}})[_0x7569('0x1d')](handleEntityNotFound(_0x3e48df,null))['then'](saveUpdates(_0x56d498[_0x7569('0x56')],null))[_0x7569('0x1d')](respondWithResult(_0x3e48df,null))[_0x7569('0x52')](handleError(_0x3e48df,null));};exports[_0x7569('0x34')]=function(_0x1df9f7,_0x329bbf){return db[_0x7569('0x39')]['find']({'where':{'id':_0x1df9f7['params']['id']}})[_0x7569('0x1d')](handleEntityNotFound(_0x329bbf,null))[_0x7569('0x1d')](removeEntity(_0x329bbf,null))['catch'](handleError(_0x329bbf,null));};exports[_0x7569('0x57')]=function(_0x2f6706,_0x3e103d,_0x344210){var _0xe60eb8={};var _0x3e4ce3={};var _0x186613;var _0x45de1f;return db[_0x7569('0x39')][_0x7569('0x58')]({'where':{'id':_0x2f6706[_0x7569('0x53')]['id']}})[_0x7569('0x1d')](handleEntityNotFound(_0x3e103d,null))['then'](function(_0x1a558c){if(_0x1a558c){_0x186613=_0x1a558c;_0x3e4ce3[_0x7569('0x45')]=_[_0x7569('0x3f')](db['VtigerConfiguration'][_0x7569('0x3a')]);_0x3e4ce3[_0x7569('0x3e')]=_[_0x7569('0x3f')](_0x2f6706[_0x7569('0x3e')]);_0x3e4ce3[_0x7569('0x40')]=_[_0x7569('0x41')](_0x3e4ce3['model'],_0x3e4ce3[_0x7569('0x3e')]);_0xe60eb8[_0x7569('0x43')]=_[_0x7569('0x41')](_0x3e4ce3[_0x7569('0x45')],qs[_0x7569('0x42')](_0x2f6706[_0x7569('0x3e')][_0x7569('0x42')]));_0xe60eb8[_0x7569('0x43')]=_0xe60eb8[_0x7569('0x43')][_0x7569('0x44')]?_0xe60eb8[_0x7569('0x43')]:_0x3e4ce3[_0x7569('0x45')];_0xe60eb8['order']=qs[_0x7569('0x49')](_0x2f6706[_0x7569('0x3e')][_0x7569('0x49')]);_0xe60eb8[_0x7569('0x4a')]=qs[_0x7569('0x40')](_[_0x7569('0x59')](_0x2f6706['query'],_0x3e4ce3[_0x7569('0x40')]));if(_0x2f6706[_0x7569('0x3e')][_0x7569('0x4b')]){_0xe60eb8[_0x7569('0x4a')]=_[_0x7569('0x4c')](_0xe60eb8[_0x7569('0x4a')],{'$or':_['map'](_0xe60eb8['attributes'],function(_0x394487){var _0x55bf06={};_0x55bf06[_0x394487]={'$like':'%'+_0x2f6706[_0x7569('0x3e')][_0x7569('0x4b')]+'%'};return _0x55bf06;})});}_0xe60eb8=_[_0x7569('0x4c')]({},_0xe60eb8,_0x2f6706[_0x7569('0x4e')]);return _0x186613['getConfigurations'](_0xe60eb8);}})[_0x7569('0x1d')](function(_0x527e71){if(_0x527e71){_0x45de1f=_0x527e71[_0x7569('0x44')];if(!_0x2f6706[_0x7569('0x3e')][_0x7569('0x46')](_0x7569('0x47'))){_0xe60eb8[_0x7569('0x2d')]=qs[_0x7569('0x2d')](_0x2f6706[_0x7569('0x3e')][_0x7569('0x2d')]);_0xe60eb8[_0x7569('0x2c')]=qs['offset'](_0x2f6706[_0x7569('0x3e')][_0x7569('0x2c')]);}return _0x186613[_0x7569('0x57')](_0xe60eb8);}})['then'](function(_0x3618dd){if(_0x3618dd){return _0x3618dd?{'count':_0x45de1f,'rows':_0x3618dd}:null;}})[_0x7569('0x1d')](respondWithResult(_0x3e103d,null))[_0x7569('0x52')](handleError(_0x3e103d,null));};exports[_0x7569('0x5a')]=function(_0x61f45b,_0x2856fd,_0x53c4cb){if(_0x61f45b[_0x7569('0x56')]['id']){delete _0x61f45b[_0x7569('0x56')]['id'];}return db['VtigerAccount'][_0x7569('0x58')]({'where':{'id':_0x61f45b['params']['id']}})[_0x7569('0x1d')](handleEntityNotFound(_0x2856fd,null))[_0x7569('0x1d')](function(_0x38670e){if(_0x38670e){_0x61f45b[_0x7569('0x56')][_0x7569('0x5b')]=_0x38670e['id'];_0x61f45b[_0x7569('0x56')][_0x7569('0x5c')]=integrations['getSubjects'](_0x61f45b['body'][_0x7569('0x5d')],_0x61f45b[_0x7569('0x56')][_0x7569('0x3c')]);_0x61f45b[_0x7569('0x56')][_0x7569('0x5e')]=integrations[_0x7569('0x5f')](_0x61f45b[_0x7569('0x56')][_0x7569('0x5d')],_0x61f45b[_0x7569('0x56')][_0x7569('0x3c')]);return db[_0x7569('0x60')][_0x7569('0x55')](_0x61f45b[_0x7569('0x56')],{'include':[{'model':db[_0x7569('0x61')],'as':_0x7569('0x5c')},{'model':db[_0x7569('0x61')],'as':_0x7569('0x5e')}]});}return null;})[_0x7569('0x1d')](respondWithResult(_0x2856fd,null))[_0x7569('0x52')](handleError(_0x2856fd,null));};var md5=require(_0x7569('0x62'));exports[_0x7569('0x63')]=function(_0x52eb26,_0xe70c06,_0x4520b6){var _0x31048e=null;var _0x471f74=null;var _0x653d06=null;var _0x44a736=null;var _0x5c7a09='';return db[_0x7569('0x39')][_0x7569('0x58')]({'where':{'id':_0x52eb26[_0x7569('0x53')]['id']},'attributes':['id',_0x7569('0x36'),_0x7569('0x64'),'description',_0x7569('0x65'),_0x7569('0x66'),_0x7569('0x67'),_0x7569('0x68')]})[_0x7569('0x1d')](handleEntityNotFound(_0xe70c06,null))[_0x7569('0x1d')](function(_0x1261b8){if(_0x1261b8){_0x31048e=_0x1261b8[_0x7569('0x64')];_0x471f74=_0x1261b8[_0x7569('0x68')];_0x653d06=_0x1261b8[_0x7569('0x65')];_0x5c7a09=_0x1261b8[_0x7569('0x66')];var _0xaf329d=_0x5c7a09['slice'](-0x1);if(_0xaf329d==='/'){_0x5c7a09=_0x5c7a09[_0x7569('0x69')](0x0,_0x5c7a09[_0x7569('0x6a')](_0xaf329d));}_0x44a736=util['format'](_0x7569('0x6b'),_0x5c7a09);var _0x2c2b09={'method':'GET','uri':_0x44a736,'qs':{'operation':_0x7569('0x6c'),'username':_0x1261b8['username']},'json':!![]};return rp(_0x2c2b09);}})['then'](function(_0x17a704){if(_0x17a704[_0x7569('0x6d')]){var _0x189cef={'method':'POST','uri':_0x44a736,'form':{'operation':_0x7569('0x6e'),'username':_0x31048e,'accessKey':md5(_0x17a704['result']['token']+_0x471f74)},'json':!![]};return rp(_0x189cef);}})[_0x7569('0x1d')](function(_0x4df8ab){if(_0x4df8ab[_0x7569('0x6d')]){var _0x1c63cc={'method':_0x7569('0x6f'),'uri':_0x44a736,'qs':{'operation':_0x7569('0x70'),'username':_0x31048e,'sessionName':_0x4df8ab[_0x7569('0x26')][_0x7569('0x71')],'elementType':_0x653d06},'json':!![]};return rp(_0x1c63cc);}})[_0x7569('0x1d')](function(_0x20b35f){if(_0x20b35f['success']){var _0x2ead4b=['autogenerated','reference',_0x7569('0x72')];_['remove'](_0x20b35f[_0x7569('0x26')][_0x7569('0x42')],function(_0x3d2781){return _0x2ead4b[_0x7569('0x73')](_0x3d2781['type']['name']);});_['remove'](_0x20b35f[_0x7569('0x26')][_0x7569('0x42')],function(_0x305241){return _0x305241[_0x7569('0x74')]===_0x7569('0x75');});return{'count':_0x20b35f['result']['fields'][_0x7569('0x44')],'rows':_['map'](_0x20b35f[_0x7569('0x26')][_0x7569('0x42')],function(_0x1260ae){return{'id':_0x1260ae[_0x7569('0x36')],'name':_0x1260ae[_0x7569('0x76')],'custom':_[_0x7569('0x77')](_0x1260ae[_0x7569('0x36')],_0x7569('0x78'))?!![]:![],'options':_0x1260ae['type'][_0x7569('0x36')]===_0x7569('0x79')&&_0x1260ae[_0x7569('0x3c')][_0x7569('0x7a')][_0x7569('0x44')]>0x0?_[_0x7569('0x38')](_0x1260ae[_0x7569('0x3c')][_0x7569('0x7a')],function(_0x3c119b){return{'name':_0x3c119b[_0x7569('0x76')],'value':_0x3c119b['value']};}):[]};})};}})['then'](respondWithResult(_0xe70c06,null))[_0x7569('0x52')](function(_0xae42db){console[_0x7569('0x7b')](_0x7569('0x7c')+_0xae42db);var _0x158907=_0x52eb26[_0x7569('0x3e')][_0x7569('0x1b')]?0x1f4:_0xae42db[_0x7569('0x7d')]||0x1f4;logger[_0x7569('0x22')]('getFields,\x20%s,\x20%s,\x20%s',_0x7569('0x63'),_0x158907,JSON[_0x7569('0x21')](_0xae42db));delete _0xae42db[_0x7569('0x36')];if(_0x158907===0x191){_0x158907=0x190;}_0xe70c06[_0x7569('0x28')](_0x158907)[_0x7569('0x37')](_0x52eb26[_0x7569('0x3e')][_0x7569('0x1b')]?{'message':_0x7569('0x7e'),'statusCode':_0xae42db['statusCode']}:_0xae42db);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 3fd8750..29761fc 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 _0x1774=['../../components/integrations/configuration','VtigerAccount','int_vtiger_accounts','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerAccount.attributes'];(function(_0x5dd31e,_0x1fed2f){var _0x5d6230=function(_0x7a514b){while(--_0x7a514b){_0x5dd31e['push'](_0x5dd31e['shift']());}};_0x5d6230(++_0x1fed2f);}(_0x1774,0x1bf));var _0x4177=function(_0xe25f69,_0x189354){_0xe25f69=_0xe25f69-0x0;var _0x4d4507=_0x1774[_0xe25f69];return _0x4d4507;};'use strict';var _=require(_0x4177('0x0'));var util=require('util');var logger=require(_0x4177('0x1'))('api');var moment=require(_0x4177('0x2'));var BPromise=require(_0x4177('0x3'));var rp=require(_0x4177('0x4'));var fs=require('fs');var path=require(_0x4177('0x5'));var rimraf=require(_0x4177('0x6'));var config=require(_0x4177('0x7'));var attributes=require(_0x4177('0x8'));var integrations=require(_0x4177('0x9'));module['exports']=function(_0x39dfb5,_0x5c02f7){return _0x39dfb5['define'](_0x4177('0xa'),attributes,{'tableName':_0x4177('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x558c=['exports','VtigerAccount','int_vtiger_accounts','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','../../components/integrations/configuration'];(function(_0x3108d9,_0xf08d6){var _0x1455e6=function(_0xfd5906){while(--_0xfd5906){_0x3108d9['push'](_0x3108d9['shift']());}};_0x1455e6(++_0xf08d6);}(_0x558c,0xed));var _0xc558=function(_0x4e15f7,_0x54527a){_0x4e15f7=_0x4e15f7-0x0;var _0x22f968=_0x558c[_0x4e15f7];return _0x22f968;};'use strict';var _=require(_0xc558('0x0'));var util=require(_0xc558('0x1'));var logger=require(_0xc558('0x2'))(_0xc558('0x3'));var moment=require(_0xc558('0x4'));var BPromise=require(_0xc558('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc558('0x6'));var rimraf=require(_0xc558('0x7'));var config=require(_0xc558('0x8'));var attributes=require('./intVtigerAccount.attributes');var integrations=require(_0xc558('0x9'));module[_0xc558('0xa')]=function(_0x77c465,_0x5f294a){return _0x77c465['define'](_0xc558('0xb'),attributes,{'tableName':_0xc558('0xc'),'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 67154cc..753a6b1 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 _0x5729=['attributes','limit','include','model','map','GetVtigerAccount','find','raw','where','ShowVtigerAccount','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','VtigerAccount','findAll','options'];(function(_0x42cd21,_0x5454a8){var _0x563dc3=function(_0x2ee443){while(--_0x2ee443){_0x42cd21['push'](_0x42cd21['shift']());}};_0x563dc3(++_0x5454a8);}(_0x5729,0x1a1));var _0x9572=function(_0x484195,_0x25a4d2){_0x484195=_0x484195-0x0;var _0xd057ff=_0x5729[_0x484195];return _0xd057ff;};'use strict';var _=require(_0x9572('0x0'));var util=require(_0x9572('0x1'));var moment=require('moment');var BPromise=require(_0x9572('0x2'));var rs=require(_0x9572('0x3'));var fs=require('fs');var Redis=require(_0x9572('0x4'));var db=require(_0x9572('0x5'))['db'];var utils=require(_0x9572('0x6'));var logger=require('../../config/logger')(_0x9572('0x7'));var config=require(_0x9572('0x8'));var jayson=require(_0x9572('0x9'));var client=jayson[_0x9572('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x404a82,_0xb3743b,_0x4a31de){return new BPromise(function(_0x35d2dd,_0x1666b0){return client[_0x9572('0xb')](_0x404a82,_0x4a31de)[_0x9572('0xc')](function(_0x1b2893){logger['info'](_0x9572('0xd'),_0xb3743b,_0x9572('0xe'));logger[_0x9572('0xf')](_0x9572('0x10'),_0xb3743b,_0x9572('0xe'),JSON[_0x9572('0x11')](_0x1b2893));if(_0x1b2893[_0x9572('0x12')]){if(_0x1b2893[_0x9572('0x12')][_0x9572('0x13')]===0x1f4){logger[_0x9572('0x12')](_0x9572('0xd'),_0xb3743b,_0x1b2893[_0x9572('0x12')][_0x9572('0x14')]);return _0x1666b0(_0x1b2893[_0x9572('0x12')][_0x9572('0x14')]);}logger[_0x9572('0x12')](_0x9572('0xd'),_0xb3743b,_0x1b2893[_0x9572('0x12')][_0x9572('0x14')]);return _0x35d2dd(_0x1b2893[_0x9572('0x12')]['message']);}else{logger[_0x9572('0x15')](_0x9572('0xd'),_0xb3743b,_0x9572('0xe'));_0x35d2dd(_0x1b2893[_0x9572('0x16')][_0x9572('0x14')]);}})[_0x9572('0x17')](function(_0x77903b){logger[_0x9572('0x12')](_0x9572('0xd'),_0xb3743b,_0x77903b);_0x1666b0(_0x77903b);});});}exports['GetVtigerAccount']=function(_0x58df9a){var _0x1807f0=this;return new Promise(function(_0xc86f2c,_0x1a4bff){return db[_0x9572('0x18')][_0x9572('0x19')]({'raw':_0x58df9a[_0x9572('0x1a')]?_0x58df9a[_0x9572('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x58df9a['options']?_0x58df9a['options']['where']||null:null,'attributes':_0x58df9a[_0x9572('0x1a')]?_0x58df9a[_0x9572('0x1a')][_0x9572('0x1b')]||null:null,'limit':_0x58df9a['options']?_0x58df9a[_0x9572('0x1a')][_0x9572('0x1c')]||null:null,'include':_0x58df9a[_0x9572('0x1a')]?_0x58df9a[_0x9572('0x1a')][_0x9572('0x1d')]?_['map'](_0x58df9a['options'][_0x9572('0x1d')],function(_0x175e23){return{'model':db[_0x175e23[_0x9572('0x1e')]],'as':_0x175e23['as'],'attributes':_0x175e23[_0x9572('0x1b')],'include':_0x175e23[_0x9572('0x1d')]?_[_0x9572('0x1f')](_0x175e23[_0x9572('0x1d')],function(_0x4f8f43){return{'model':db[_0x4f8f43[_0x9572('0x1e')]],'as':_0x4f8f43['as'],'attributes':_0x4f8f43['attributes'],'include':_0x4f8f43[_0x9572('0x1d')]?_[_0x9572('0x1f')](_0x4f8f43['include'],function(_0xafc181){return{'model':db[_0xafc181[_0x9572('0x1e')]],'as':_0xafc181['as'],'attributes':_0xafc181['attributes']};}):[]};}):[]};}):[]:[]})[_0x9572('0xc')](function(_0x4983ab){logger[_0x9572('0x15')]('GetVtigerAccount',_0x58df9a);logger[_0x9572('0xf')](_0x9572('0x20'),_0x58df9a,JSON[_0x9572('0x11')](_0x4983ab));_0xc86f2c(_0x4983ab);})[_0x9572('0x17')](function(_0x808784){logger[_0x9572('0x12')]('GetVtigerAccount',_0x808784[_0x9572('0x14')],_0x58df9a);_0x1a4bff(_0x1807f0['error'](0x1f4,_0x808784['message']));});});};exports['ShowVtigerAccount']=function(_0x4d1d14){var _0x50abc9=this;return new Promise(function(_0x4d4b61,_0x28e74a){return db[_0x9572('0x18')][_0x9572('0x21')]({'raw':_0x4d1d14[_0x9572('0x1a')]?_0x4d1d14['options'][_0x9572('0x22')]===undefined?!![]:![]:!![],'where':_0x4d1d14[_0x9572('0x1a')]?_0x4d1d14[_0x9572('0x1a')][_0x9572('0x23')]||null:null,'attributes':_0x4d1d14[_0x9572('0x1a')]?_0x4d1d14[_0x9572('0x1a')][_0x9572('0x1b')]||null:null,'include':_0x4d1d14[_0x9572('0x1a')]?_0x4d1d14['options'][_0x9572('0x1d')]?_[_0x9572('0x1f')](_0x4d1d14['options']['include'],function(_0x47bdef){return{'model':db[_0x47bdef[_0x9572('0x1e')]],'as':_0x47bdef['as'],'attributes':_0x47bdef[_0x9572('0x1b')],'include':_0x47bdef['include']?_[_0x9572('0x1f')](_0x47bdef[_0x9572('0x1d')],function(_0x37a505){return{'model':db[_0x37a505[_0x9572('0x1e')]],'as':_0x37a505['as'],'attributes':_0x37a505[_0x9572('0x1b')],'include':_0x37a505['include']?_['map'](_0x37a505[_0x9572('0x1d')],function(_0x4188d1){return{'model':db[_0x4188d1[_0x9572('0x1e')]],'as':_0x4188d1['as'],'attributes':_0x4188d1['attributes']};}):[]};}):[]};}):[]:[]})[_0x9572('0xc')](function(_0x16217f){logger[_0x9572('0x15')]('ShowVtigerAccount',_0x4d1d14);logger['debug'](_0x9572('0x24'),_0x4d1d14,JSON[_0x9572('0x11')](_0x16217f));_0x4d4b61(_0x16217f);})['catch'](function(_0x43e568){logger['error'](_0x9572('0x24'),_0x43e568['message'],_0x4d1d14);_0x28e74a(_0x50abc9[_0x9572('0x12')](0x1f4,_0x43e568[_0x9572('0x14')]));});});}; \ No newline at end of file +var _0x6eda=['result','catch','findAll','options','raw','where','attributes','limit','include','map','model','GetVtigerAccount','VtigerAccount','find','ShowVtigerAccount','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','then','info','request\x20sent','debug','error','VtigerAccount,\x20%s,\x20%s','message'];(function(_0x3e20a3,_0xdbaf2f){var _0x27d1e6=function(_0x5b653d){while(--_0x5b653d){_0x3e20a3['push'](_0x3e20a3['shift']());}};_0x27d1e6(++_0xdbaf2f);}(_0x6eda,0x14f));var _0xa6ed=function(_0x51145a,_0x3feda0){_0x51145a=_0x51145a-0x0;var _0x30eb81=_0x6eda[_0x51145a];return _0x30eb81;};'use strict';var _=require(_0xa6ed('0x0'));var util=require(_0xa6ed('0x1'));var moment=require('moment');var BPromise=require(_0xa6ed('0x2'));var rs=require(_0xa6ed('0x3'));var fs=require('fs');var Redis=require(_0xa6ed('0x4'));var db=require(_0xa6ed('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa6ed('0x6'))(_0xa6ed('0x7'));var config=require(_0xa6ed('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xa6ed('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5a760f,_0x1b423d,_0x3c8cff){return new BPromise(function(_0x278e69,_0x11f6ee){return client['request'](_0x5a760f,_0x3c8cff)[_0xa6ed('0xa')](function(_0x5bdb70){logger[_0xa6ed('0xb')]('VtigerAccount,\x20%s,\x20%s',_0x1b423d,_0xa6ed('0xc'));logger[_0xa6ed('0xd')]('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x1b423d,_0xa6ed('0xc'),JSON['stringify'](_0x5bdb70));if(_0x5bdb70[_0xa6ed('0xe')]){if(_0x5bdb70[_0xa6ed('0xe')]['code']===0x1f4){logger[_0xa6ed('0xe')](_0xa6ed('0xf'),_0x1b423d,_0x5bdb70['error']['message']);return _0x11f6ee(_0x5bdb70['error']['message']);}logger['error']('VtigerAccount,\x20%s,\x20%s',_0x1b423d,_0x5bdb70[_0xa6ed('0xe')][_0xa6ed('0x10')]);return _0x278e69(_0x5bdb70[_0xa6ed('0xe')]['message']);}else{logger[_0xa6ed('0xb')](_0xa6ed('0xf'),_0x1b423d,_0xa6ed('0xc'));_0x278e69(_0x5bdb70[_0xa6ed('0x11')][_0xa6ed('0x10')]);}})[_0xa6ed('0x12')](function(_0x1f6b5b){logger[_0xa6ed('0xe')](_0xa6ed('0xf'),_0x1b423d,_0x1f6b5b);_0x11f6ee(_0x1f6b5b);});});}exports['GetVtigerAccount']=function(_0x30842f){var _0x2cbf9f=this;return new Promise(function(_0x3c0362,_0x56de3b){return db['VtigerAccount'][_0xa6ed('0x13')]({'raw':_0x30842f[_0xa6ed('0x14')]?_0x30842f[_0xa6ed('0x14')][_0xa6ed('0x15')]===undefined?!![]:![]:!![],'where':_0x30842f[_0xa6ed('0x14')]?_0x30842f[_0xa6ed('0x14')][_0xa6ed('0x16')]||null:null,'attributes':_0x30842f[_0xa6ed('0x14')]?_0x30842f[_0xa6ed('0x14')][_0xa6ed('0x17')]||null:null,'limit':_0x30842f[_0xa6ed('0x14')]?_0x30842f['options'][_0xa6ed('0x18')]||null:null,'include':_0x30842f[_0xa6ed('0x14')]?_0x30842f['options'][_0xa6ed('0x19')]?_[_0xa6ed('0x1a')](_0x30842f[_0xa6ed('0x14')]['include'],function(_0x2fff17){return{'model':db[_0x2fff17[_0xa6ed('0x1b')]],'as':_0x2fff17['as'],'attributes':_0x2fff17[_0xa6ed('0x17')],'include':_0x2fff17[_0xa6ed('0x19')]?_['map'](_0x2fff17['include'],function(_0xb319c){return{'model':db[_0xb319c[_0xa6ed('0x1b')]],'as':_0xb319c['as'],'attributes':_0xb319c[_0xa6ed('0x17')],'include':_0xb319c[_0xa6ed('0x19')]?_['map'](_0xb319c[_0xa6ed('0x19')],function(_0x7c5681){return{'model':db[_0x7c5681[_0xa6ed('0x1b')]],'as':_0x7c5681['as'],'attributes':_0x7c5681[_0xa6ed('0x17')]};}):[]};}):[]};}):[]:[]})[_0xa6ed('0xa')](function(_0x1bc1dd){logger[_0xa6ed('0xb')](_0xa6ed('0x1c'),_0x30842f);logger[_0xa6ed('0xd')](_0xa6ed('0x1c'),_0x30842f,JSON['stringify'](_0x1bc1dd));_0x3c0362(_0x1bc1dd);})[_0xa6ed('0x12')](function(_0x137098){logger['error']('GetVtigerAccount',_0x137098[_0xa6ed('0x10')],_0x30842f);_0x56de3b(_0x2cbf9f['error'](0x1f4,_0x137098[_0xa6ed('0x10')]));});});};exports['ShowVtigerAccount']=function(_0x2ecabc){var _0x39c125=this;return new Promise(function(_0x2b011b,_0x3172cd){return db[_0xa6ed('0x1d')][_0xa6ed('0x1e')]({'raw':_0x2ecabc[_0xa6ed('0x14')]?_0x2ecabc['options'][_0xa6ed('0x15')]===undefined?!![]:![]:!![],'where':_0x2ecabc[_0xa6ed('0x14')]?_0x2ecabc[_0xa6ed('0x14')]['where']||null:null,'attributes':_0x2ecabc['options']?_0x2ecabc['options'][_0xa6ed('0x17')]||null:null,'include':_0x2ecabc[_0xa6ed('0x14')]?_0x2ecabc[_0xa6ed('0x14')][_0xa6ed('0x19')]?_[_0xa6ed('0x1a')](_0x2ecabc[_0xa6ed('0x14')][_0xa6ed('0x19')],function(_0x82a53c){return{'model':db[_0x82a53c[_0xa6ed('0x1b')]],'as':_0x82a53c['as'],'attributes':_0x82a53c[_0xa6ed('0x17')],'include':_0x82a53c['include']?_['map'](_0x82a53c[_0xa6ed('0x19')],function(_0x361767){return{'model':db[_0x361767[_0xa6ed('0x1b')]],'as':_0x361767['as'],'attributes':_0x361767[_0xa6ed('0x17')],'include':_0x361767['include']?_[_0xa6ed('0x1a')](_0x361767[_0xa6ed('0x19')],function(_0x131efc){return{'model':db[_0x131efc['model']],'as':_0x131efc['as'],'attributes':_0x131efc[_0xa6ed('0x17')]};}):[]};}):[]};}):[]:[]})[_0xa6ed('0xa')](function(_0x5dc2fa){logger[_0xa6ed('0xb')]('ShowVtigerAccount',_0x2ecabc);logger[_0xa6ed('0xd')](_0xa6ed('0x1f'),_0x2ecabc,JSON['stringify'](_0x5dc2fa));_0x2b011b(_0x5dc2fa);})[_0xa6ed('0x12')](function(_0x4132a9){logger[_0xa6ed('0xe')](_0xa6ed('0x1f'),_0x4132a9[_0xa6ed('0x10')],_0x2ecabc);_0x3172cd(_0x39c125[_0xa6ed('0xe')](0x1f4,_0x4132a9[_0xa6ed('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 16a943f..371a9bf 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(_0x34466a,_0x31c8ca){var _0x579cda=function(_0xc5846d){while(--_0xc5846d){_0x34466a['push'](_0x34466a['shift']());}};_0x579cda(++_0x31c8ca);}(_0xb10b,0x12a));var _0xbb10=function(_0x576d8a,_0x2d7bde){_0x576d8a=_0x576d8a-0x0;var _0x3dc3ef=_0xb10b[_0x576d8a];return _0x3dc3ef;};'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(_0x5ad718,_0x538f9c){var _0x13660d=function(_0x2459ef){while(--_0x2459ef){_0x5ad718['push'](_0x5ad718['shift']());}};_0x13660d(++_0x538f9c);}(_0xb10b,0x12a));var _0xbb10=function(_0x915a15,_0x31b9d2){_0x915a15=_0x915a15-0x0;var _0x24f642=_0xb10b[_0x915a15];return _0x24f642;};'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 f467062..58f6036 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 _0xc1d2=['STRING','sequelize'];(function(_0x4fab1a,_0x2a819b){var _0xdd4a=function(_0x4a7cb1){while(--_0x4a7cb1){_0x4fab1a['push'](_0x4fab1a['shift']());}};_0xdd4a(++_0x2a819b);}(_0xc1d2,0x129));var _0x2c1d=function(_0x545c84,_0x1ad760){_0x545c84=_0x545c84-0x0;var _0xc0de48=_0xc1d2[_0x545c84];return _0xc0de48;};'use strict';var Sequelize=require(_0x2c1d('0x0'));module['exports']={'name':{'type':Sequelize[_0x2c1d('0x1')]},'description':{'type':Sequelize[_0x2c1d('0x1')]}}; \ No newline at end of file +var _0xcdf1=['STRING','exports'];(function(_0x474128,_0x5f4065){var _0x1aa478=function(_0x2edf33){while(--_0x2edf33){_0x474128['push'](_0x474128['shift']());}};_0x1aa478(++_0x5f4065);}(_0xcdf1,0xa5));var _0x1cdf=function(_0x37931a,_0x37f53c){_0x37931a=_0x37931a-0x0;var _0x506e66=_0xcdf1[_0x37931a];return _0x506e66;};'use strict';var Sequelize=require('sequelize');module[_0x1cdf('0x0')]={'name':{'type':Sequelize[_0x1cdf('0x1')]},'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 185a710..787c45a 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 _0x5c1b=['map','options','includeAll','include','rows','catch','create','body','find','params','getFields','findOne','VtigerField','getSubjects','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','to-csv','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','http','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','request\x20sent','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','VtigerConfiguration,\x20%s,\x20%s','message','result','sendStatus','end','json','count','offset','limit','status','Content-Range','apply','save','update','destroy','stack','name','send','VtigerConfiguration','rawAttributes','fieldName','type','key','keys','query','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x5c1b,0x65));var _0xb5c1=function(_0x54f8ee,_0x1c0493){_0x54f8ee=_0x54f8ee-0x0;var _0x3c50c7=_0x5c1b[_0x54f8ee];return _0x3c50c7;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb5c1('0x0'));var rimraf=require(_0xb5c1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb5c1('0x2'));var rp=require(_0xb5c1('0x3'));var moment=require('moment');var BPromise=require(_0xb5c1('0x4'));var Mustache=require('mustache');var util=require(_0xb5c1('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xb5c1('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xb5c1('0x7'));var squel=require(_0xb5c1('0x8'));var crypto=require(_0xb5c1('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xb5c1('0xa'));var toCsv=require(_0xb5c1('0x6'));var querystring=require('querystring');var Papa=require(_0xb5c1('0xb'));var Redis=require(_0xb5c1('0xc'));var authService=require(_0xb5c1('0xd'));var qs=require(_0xb5c1('0xe'));var as=require(_0xb5c1('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb5c1('0x10'))('api');var utils=require(_0xb5c1('0x11'));var config=require(_0xb5c1('0x12'));var db=require(_0xb5c1('0x13'))['db'];var jayson=require(_0xb5c1('0x14'));var client=jayson['client'][_0xb5c1('0x15')]({'port':0x232a});function checkPasswordPattern(_0x380d82,_0x11ea2e,_0x109da2){if(_0x109da2){var _0x4e63b2=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4e63b2['test'](_0x11ea2e)){return _0x380d82;}else{throw new db['Sequelize'][(_0xb5c1('0x16'))](_0xb5c1('0x17'));}}else{return _0x380d82;}}function respondWithRpcPromise(_0x258769,_0x2f3893,_0x34658b,_0x17964e){return new BPromise(function(_0x4906ac,_0x339bb9){var _0x5c9c9a=_0x17964e||client;return _0x5c9c9a[_0xb5c1('0x18')](_0x258769,_0x34658b)[_0xb5c1('0x19')](function(_0x4c2332){logger[_0xb5c1('0x1a')]('VtigerConfiguration,\x20%s,\x20%s',_0x2f3893,_0xb5c1('0x1b'));logger['debug'](_0xb5c1('0x1c'),_0x2f3893,_0xb5c1('0x1b'),JSON[_0xb5c1('0x1d')](_0x4c2332));if(_0x4c2332[_0xb5c1('0x1e')]){if(_0x4c2332['error'][_0xb5c1('0x1f')]===0x1f4){logger[_0xb5c1('0x1e')](_0xb5c1('0x20'),_0x2f3893,_0x4c2332[_0xb5c1('0x1e')][_0xb5c1('0x21')]);return _0x339bb9(_0x4c2332[_0xb5c1('0x1e')]['message']);}logger[_0xb5c1('0x1e')](_0xb5c1('0x20'),_0x2f3893,_0x4c2332[_0xb5c1('0x1e')][_0xb5c1('0x21')]);return _0x4906ac(_0x4c2332[_0xb5c1('0x1e')][_0xb5c1('0x21')]);}else{logger[_0xb5c1('0x1a')](_0xb5c1('0x20'),_0x2f3893,_0xb5c1('0x1b'));_0x4906ac(_0x4c2332[_0xb5c1('0x22')][_0xb5c1('0x21')]);}})['catch'](function(_0x33f3c7){logger['error'](_0xb5c1('0x20'),_0x2f3893,_0x33f3c7);_0x339bb9(_0x33f3c7);});});}function respondWithStatusCode(_0x184209,_0x38594d){_0x38594d=_0x38594d||0xcc;return function(_0x41a920){if(_0x41a920){return _0x184209[_0xb5c1('0x23')](_0x38594d);}return _0x184209['status'](_0x38594d)[_0xb5c1('0x24')]();};}function respondWithResult(_0x55745d,_0x1b8ef5){_0x1b8ef5=_0x1b8ef5||0xc8;return function(_0x2a2095){if(_0x2a2095){return _0x55745d['status'](_0x1b8ef5)[_0xb5c1('0x25')](_0x2a2095);}};}function respondWithFilteredResult(_0x123608,_0x27692e){return function(_0x1924f4){if(_0x1924f4){var _0x135c8b=_0x1924f4[_0xb5c1('0x26')],_0x4b4d2a=_0x27692e[_0xb5c1('0x27')],_0x5e1e90=_0x27692e[_0xb5c1('0x27')]+_0x27692e[_0xb5c1('0x28')],_0x34c9f5;if(_0x5e1e90>=_0x135c8b){_0x5e1e90=_0x135c8b;_0x34c9f5=0xc8;}else{_0x34c9f5=0xce;}_0x123608[_0xb5c1('0x29')](_0x34c9f5);return _0x123608['set'](_0xb5c1('0x2a'),_0x4b4d2a+'-'+_0x5e1e90+'/'+_0x135c8b)[_0xb5c1('0x25')](_0x1924f4);}return null;};}function patchUpdates(_0x54df17){return function(_0x80b507){try{jsonpatch[_0xb5c1('0x2b')](_0x80b507,_0x54df17,!![]);}catch(_0x33c86f){return BPromise['reject'](_0x33c86f);}return _0x80b507[_0xb5c1('0x2c')]();};}function saveUpdates(_0x397311,_0x3c6d53){return function(_0x57b516){if(_0x57b516){return _0x57b516[_0xb5c1('0x2d')](_0x397311)[_0xb5c1('0x19')](function(_0x40017d){return _0x40017d;});}return null;};}function removeEntity(_0x166b40,_0x33f44f){return function(_0x50e694){if(_0x50e694){return _0x50e694[_0xb5c1('0x2e')]()[_0xb5c1('0x19')](function(){_0x166b40[_0xb5c1('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x32196c,_0x17f822){return function(_0x283eb3){if(!_0x283eb3){_0x32196c[_0xb5c1('0x23')](0x194);}return _0x283eb3;};}function handleError(_0x5b594b,_0x58607c){_0x58607c=_0x58607c||0x1f4;return function(_0x35fe20){logger[_0xb5c1('0x1e')](_0x35fe20[_0xb5c1('0x2f')]);if(_0x35fe20['name']){delete _0x35fe20[_0xb5c1('0x30')];}_0x5b594b[_0xb5c1('0x29')](_0x58607c)[_0xb5c1('0x31')](_0x35fe20);};}exports['index']=function(_0x5eaa6f,_0x1ce00e){var _0xee10ee={},_0x544aaf={},_0x1dae83={'count':0x0,'rows':[]};var _0x106ad8=_['map'](db[_0xb5c1('0x32')][_0xb5c1('0x33')],function(_0x17fa88){return{'name':_0x17fa88[_0xb5c1('0x34')],'type':_0x17fa88[_0xb5c1('0x35')][_0xb5c1('0x36')]};});_0x544aaf['model']=_['map'](_0x106ad8,_0xb5c1('0x30'));_0x544aaf['query']=_[_0xb5c1('0x37')](_0x5eaa6f[_0xb5c1('0x38')]);_0x544aaf[_0xb5c1('0x39')]=_[_0xb5c1('0x3a')](_0x544aaf['model'],_0x544aaf[_0xb5c1('0x38')]);_0xee10ee[_0xb5c1('0x3b')]=_[_0xb5c1('0x3a')](_0x544aaf['model'],qs[_0xb5c1('0x3c')](_0x5eaa6f['query']['fields']));_0xee10ee[_0xb5c1('0x3b')]=_0xee10ee[_0xb5c1('0x3b')][_0xb5c1('0x3d')]?_0xee10ee[_0xb5c1('0x3b')]:_0x544aaf[_0xb5c1('0x3e')];if(!_0x5eaa6f[_0xb5c1('0x38')][_0xb5c1('0x3f')](_0xb5c1('0x40'))){_0xee10ee[_0xb5c1('0x28')]=qs[_0xb5c1('0x28')](_0x5eaa6f[_0xb5c1('0x38')]['limit']);_0xee10ee[_0xb5c1('0x27')]=qs['offset'](_0x5eaa6f[_0xb5c1('0x38')][_0xb5c1('0x27')]);}_0xee10ee[_0xb5c1('0x41')]=qs[_0xb5c1('0x42')](_0x5eaa6f[_0xb5c1('0x38')][_0xb5c1('0x42')]);_0xee10ee[_0xb5c1('0x43')]=qs['filters'](_[_0xb5c1('0x44')](_0x5eaa6f[_0xb5c1('0x38')],_0x544aaf[_0xb5c1('0x39')]),_0x106ad8);if(_0x5eaa6f[_0xb5c1('0x38')][_0xb5c1('0x45')]){_0xee10ee[_0xb5c1('0x43')]=_[_0xb5c1('0x46')](_0xee10ee[_0xb5c1('0x43')],{'$or':_[_0xb5c1('0x47')](_0x106ad8,function(_0x214caf){if(_0x214caf[_0xb5c1('0x35')]!=='VIRTUAL'){var _0x40f529={};_0x40f529[_0x214caf[_0xb5c1('0x30')]]={'$like':'%'+_0x5eaa6f['query'][_0xb5c1('0x45')]+'%'};return _0x40f529;}})});}_0xee10ee=_[_0xb5c1('0x46')]({},_0xee10ee,_0x5eaa6f[_0xb5c1('0x48')]);var _0x462b43={'where':_0xee10ee[_0xb5c1('0x43')]};return db['VtigerConfiguration']['count'](_0x462b43)[_0xb5c1('0x19')](function(_0x461036){_0x1dae83['count']=_0x461036;if(_0x5eaa6f[_0xb5c1('0x38')][_0xb5c1('0x49')]){_0xee10ee[_0xb5c1('0x4a')]=[{'all':!![]}];}return db[_0xb5c1('0x32')]['findAll'](_0xee10ee);})['then'](function(_0x1f2a2c){_0x1dae83[_0xb5c1('0x4b')]=_0x1f2a2c;return _0x1dae83;})[_0xb5c1('0x19')](respondWithFilteredResult(_0x1ce00e,_0xee10ee))[_0xb5c1('0x4c')](handleError(_0x1ce00e,null));};exports['show']=function(_0x20b489,_0x3c05ce){var _0x79cc02={'raw':![],'where':{'id':_0x20b489['params']['id']}},_0x5129eb={};_0x5129eb[_0xb5c1('0x3e')]=_[_0xb5c1('0x37')](db[_0xb5c1('0x32')][_0xb5c1('0x33')]);_0x5129eb['query']=_[_0xb5c1('0x37')](_0x20b489['query']);_0x5129eb[_0xb5c1('0x39')]=_['intersection'](_0x5129eb[_0xb5c1('0x3e')],_0x5129eb[_0xb5c1('0x38')]);_0x79cc02['attributes']=_[_0xb5c1('0x3a')](_0x5129eb[_0xb5c1('0x3e')],qs['fields'](_0x20b489['query']['fields']));_0x79cc02[_0xb5c1('0x3b')]=_0x79cc02[_0xb5c1('0x3b')]['length']?_0x79cc02[_0xb5c1('0x3b')]:_0x5129eb[_0xb5c1('0x3e')];if(_0x20b489[_0xb5c1('0x38')][_0xb5c1('0x49')]){_0x79cc02['include']=[{'all':!![]}];}_0x79cc02=_[_0xb5c1('0x46')]({},_0x79cc02,_0x20b489['options']);return db[_0xb5c1('0x32')]['find'](_0x79cc02)[_0xb5c1('0x19')](handleEntityNotFound(_0x3c05ce,null))['then'](respondWithResult(_0x3c05ce,null))[_0xb5c1('0x4c')](handleError(_0x3c05ce,null));};exports[_0xb5c1('0x4d')]=function(_0x2a05d7,_0x474632){return db[_0xb5c1('0x32')]['create'](_0x2a05d7[_0xb5c1('0x4e')],{})['then'](respondWithResult(_0x474632,0xc9))[_0xb5c1('0x4c')](handleError(_0x474632,null));};exports[_0xb5c1('0x2d')]=function(_0x3bbe7e,_0x1a043b){if(_0x3bbe7e[_0xb5c1('0x4e')]['id']){delete _0x3bbe7e[_0xb5c1('0x4e')]['id'];}return db[_0xb5c1('0x32')][_0xb5c1('0x4f')]({'where':{'id':_0x3bbe7e[_0xb5c1('0x50')]['id']}})['then'](handleEntityNotFound(_0x1a043b,null))[_0xb5c1('0x19')](saveUpdates(_0x3bbe7e['body'],null))[_0xb5c1('0x19')](respondWithResult(_0x1a043b,null))['catch'](handleError(_0x1a043b,null));};exports['destroy']=function(_0x1881aa,_0x250fc9){return db[_0xb5c1('0x32')][_0xb5c1('0x4f')]({'where':{'id':_0x1881aa[_0xb5c1('0x50')]['id']}})[_0xb5c1('0x19')](handleEntityNotFound(_0x250fc9,null))[_0xb5c1('0x19')](removeEntity(_0x250fc9,null))['catch'](handleError(_0x250fc9,null));};exports[_0xb5c1('0x51')]=function(_0x1305f1,_0x1aeab7,_0x5e6d31){var _0x5c543c={};var _0x24a8e0={};var _0x563012;var _0x1299e9;return db['VtigerConfiguration'][_0xb5c1('0x52')]({'where':{'id':_0x1305f1['params']['id']}})['then'](handleEntityNotFound(_0x1aeab7,null))['then'](function(_0x2f67e8){if(_0x2f67e8){_0x563012=_0x2f67e8;_0x24a8e0[_0xb5c1('0x3e')]=_[_0xb5c1('0x37')](db[_0xb5c1('0x53')][_0xb5c1('0x33')]);_0x24a8e0[_0xb5c1('0x38')]=_[_0xb5c1('0x37')](_0x1305f1[_0xb5c1('0x38')]);_0x24a8e0[_0xb5c1('0x39')]=_[_0xb5c1('0x3a')](_0x24a8e0['model'],_0x24a8e0['query']);_0x5c543c['attributes']=_['intersection'](_0x24a8e0[_0xb5c1('0x3e')],qs[_0xb5c1('0x3c')](_0x1305f1[_0xb5c1('0x38')][_0xb5c1('0x3c')]));_0x5c543c[_0xb5c1('0x3b')]=_0x5c543c[_0xb5c1('0x3b')][_0xb5c1('0x3d')]?_0x5c543c[_0xb5c1('0x3b')]:_0x24a8e0[_0xb5c1('0x3e')];_0x5c543c['order']=qs['sort'](_0x1305f1[_0xb5c1('0x38')][_0xb5c1('0x42')]);_0x5c543c[_0xb5c1('0x43')]=qs['filters'](_[_0xb5c1('0x44')](_0x1305f1[_0xb5c1('0x38')],_0x24a8e0[_0xb5c1('0x39')]));if(_0x1305f1[_0xb5c1('0x38')][_0xb5c1('0x45')]){_0x5c543c['where']=_['merge'](_0x5c543c[_0xb5c1('0x43')],{'$or':_[_0xb5c1('0x47')](_0x5c543c['attributes'],function(_0x113ee5){var _0x14f38e={};_0x14f38e[_0x113ee5]={'$like':'%'+_0x1305f1[_0xb5c1('0x38')][_0xb5c1('0x45')]+'%'};return _0x14f38e;})});}_0x5c543c=_[_0xb5c1('0x46')]({},_0x5c543c,_0x1305f1['options']);return _0x563012[_0xb5c1('0x51')](_0x5c543c);}})['then'](function(_0x82a29f){if(_0x82a29f){_0x1299e9=_0x82a29f['length'];if(!_0x1305f1[_0xb5c1('0x38')][_0xb5c1('0x3f')]('nolimit')){_0x5c543c[_0xb5c1('0x28')]=qs[_0xb5c1('0x28')](_0x1305f1[_0xb5c1('0x38')][_0xb5c1('0x28')]);_0x5c543c[_0xb5c1('0x27')]=qs[_0xb5c1('0x27')](_0x1305f1['query'][_0xb5c1('0x27')]);}return _0x563012['getFields'](_0x5c543c);}})[_0xb5c1('0x19')](function(_0x29d602){if(_0x29d602){return _0x29d602?{'count':_0x1299e9,'rows':_0x29d602}:null;}})[_0xb5c1('0x19')](respondWithResult(_0x1aeab7,null))['catch'](handleError(_0x1aeab7,null));};exports[_0xb5c1('0x54')]=function(_0x3ec084,_0x8150f4,_0xb5499d){var _0x11000c={};var _0x37ab14={};var _0x5347c5;var _0x2dcb09;return db['VtigerConfiguration'][_0xb5c1('0x52')]({'where':{'id':_0x3ec084['params']['id']}})[_0xb5c1('0x19')](handleEntityNotFound(_0x8150f4,null))[_0xb5c1('0x19')](function(_0x311e6e){if(_0x311e6e){_0x5347c5=_0x311e6e;_0x37ab14[_0xb5c1('0x3e')]=_[_0xb5c1('0x37')](db[_0xb5c1('0x53')]['rawAttributes']);_0x37ab14[_0xb5c1('0x38')]=_['keys'](_0x3ec084[_0xb5c1('0x38')]);_0x37ab14[_0xb5c1('0x39')]=_[_0xb5c1('0x3a')](_0x37ab14['model'],_0x37ab14[_0xb5c1('0x38')]);_0x11000c[_0xb5c1('0x3b')]=_[_0xb5c1('0x3a')](_0x37ab14['model'],qs[_0xb5c1('0x3c')](_0x3ec084['query'][_0xb5c1('0x3c')]));_0x11000c[_0xb5c1('0x3b')]=_0x11000c[_0xb5c1('0x3b')][_0xb5c1('0x3d')]?_0x11000c[_0xb5c1('0x3b')]:_0x37ab14[_0xb5c1('0x3e')];_0x11000c[_0xb5c1('0x41')]=qs[_0xb5c1('0x42')](_0x3ec084[_0xb5c1('0x38')][_0xb5c1('0x42')]);_0x11000c[_0xb5c1('0x43')]=qs[_0xb5c1('0x39')](_[_0xb5c1('0x44')](_0x3ec084['query'],_0x37ab14[_0xb5c1('0x39')]));if(_0x3ec084[_0xb5c1('0x38')][_0xb5c1('0x45')]){_0x11000c[_0xb5c1('0x43')]=_['merge'](_0x11000c[_0xb5c1('0x43')],{'$or':_[_0xb5c1('0x47')](_0x11000c[_0xb5c1('0x3b')],function(_0x669106){var _0x33cb9b={};_0x33cb9b[_0x669106]={'$like':'%'+_0x3ec084[_0xb5c1('0x38')]['filter']+'%'};return _0x33cb9b;})});}_0x11000c=_['merge']({},_0x11000c,_0x3ec084[_0xb5c1('0x48')]);return _0x5347c5[_0xb5c1('0x54')](_0x11000c);}})['then'](function(_0x960a3f){if(_0x960a3f){_0x2dcb09=_0x960a3f[_0xb5c1('0x3d')];if(!_0x3ec084['query'][_0xb5c1('0x3f')](_0xb5c1('0x40'))){_0x11000c['limit']=qs['limit'](_0x3ec084['query']['limit']);_0x11000c['offset']=qs[_0xb5c1('0x27')](_0x3ec084['query'][_0xb5c1('0x27')]);}return _0x5347c5[_0xb5c1('0x54')](_0x11000c);}})[_0xb5c1('0x19')](function(_0x28b2dc){if(_0x28b2dc){return _0x28b2dc?{'count':_0x2dcb09,'rows':_0x28b2dc}:null;}})[_0xb5c1('0x19')](respondWithResult(_0x8150f4,null))[_0xb5c1('0x4c')](handleError(_0x8150f4,null));};exports[_0xb5c1('0x55')]=function(_0x56d67f,_0x476aee,_0x14a1a0){var _0x307b24={};var _0x33ad4d={};var _0x438220;var _0x5415c3;return db[_0xb5c1('0x32')][_0xb5c1('0x52')]({'where':{'id':_0x56d67f['params']['id']}})[_0xb5c1('0x19')](handleEntityNotFound(_0x476aee,null))[_0xb5c1('0x19')](function(_0x5348d4){if(_0x5348d4){_0x438220=_0x5348d4;_0x33ad4d[_0xb5c1('0x3e')]=_[_0xb5c1('0x37')](db[_0xb5c1('0x53')][_0xb5c1('0x33')]);_0x33ad4d['query']=_[_0xb5c1('0x37')](_0x56d67f['query']);_0x33ad4d[_0xb5c1('0x39')]=_['intersection'](_0x33ad4d['model'],_0x33ad4d[_0xb5c1('0x38')]);_0x307b24[_0xb5c1('0x3b')]=_['intersection'](_0x33ad4d[_0xb5c1('0x3e')],qs[_0xb5c1('0x3c')](_0x56d67f['query']['fields']));_0x307b24[_0xb5c1('0x3b')]=_0x307b24['attributes'][_0xb5c1('0x3d')]?_0x307b24['attributes']:_0x33ad4d[_0xb5c1('0x3e')];_0x307b24[_0xb5c1('0x41')]=qs[_0xb5c1('0x42')](_0x56d67f['query'][_0xb5c1('0x42')]);_0x307b24['where']=qs['filters'](_[_0xb5c1('0x44')](_0x56d67f[_0xb5c1('0x38')],_0x33ad4d['filters']));if(_0x56d67f[_0xb5c1('0x38')]['filter']){_0x307b24['where']=_[_0xb5c1('0x46')](_0x307b24[_0xb5c1('0x43')],{'$or':_[_0xb5c1('0x47')](_0x307b24[_0xb5c1('0x3b')],function(_0x7ef461){var _0x42c40c={};_0x42c40c[_0x7ef461]={'$like':'%'+_0x56d67f[_0xb5c1('0x38')][_0xb5c1('0x45')]+'%'};return _0x42c40c;})});}_0x307b24=_['merge']({},_0x307b24,_0x56d67f['options']);return _0x438220[_0xb5c1('0x55')](_0x307b24);}})[_0xb5c1('0x19')](function(_0x28d916){if(_0x28d916){_0x5415c3=_0x28d916[_0xb5c1('0x3d')];if(!_0x56d67f['query']['hasOwnProperty'](_0xb5c1('0x40'))){_0x307b24[_0xb5c1('0x28')]=qs[_0xb5c1('0x28')](_0x56d67f['query'][_0xb5c1('0x28')]);_0x307b24['offset']=qs[_0xb5c1('0x27')](_0x56d67f[_0xb5c1('0x38')][_0xb5c1('0x27')]);}return _0x438220[_0xb5c1('0x55')](_0x307b24);}})[_0xb5c1('0x19')](function(_0x41fb16){if(_0x41fb16){return _0x41fb16?{'count':_0x5415c3,'rows':_0x41fb16}:null;}})['then'](respondWithResult(_0x476aee,null))['catch'](handleError(_0x476aee,null));}; \ No newline at end of file +var _0x4e5c=['code','message','request\x20sent','catch','end','status','json','count','offset','limit','set','update','sendStatus','stack','name','index','map','VtigerConfiguration','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','order','sort','pick','filter','where','merge','includeAll','include','findAll','rows','params','rawAttributes','fields','options','find','create','body','destroy','getFields','findOne','VtigerField','nolimit','getSubjects','getDescriptions','html-pdf','rimraf','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','VtigerConfiguration,\x20%s,\x20%s','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x11120b,_0x3bf875){var _0x451b82=function(_0x233a41){while(--_0x233a41){_0x11120b['push'](_0x11120b['shift']());}};_0x451b82(++_0x3bf875);}(_0x4e5c,0x149));var _0xc4e5=function(_0xd0b415,_0x149675){_0xd0b415=_0xd0b415-0x0;var _0x2bdf2c=_0x4e5c[_0xd0b415];return _0x2bdf2c;};'use strict';var pdf=require(_0xc4e5('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xc4e5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc4e5('0x2'));var rp=require(_0xc4e5('0x3'));var moment=require(_0xc4e5('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xc4e5('0x5'));var sox=require(_0xc4e5('0x6'));var csv=require(_0xc4e5('0x7'));var ejs=require(_0xc4e5('0x8'));var fs=require('fs');var _=require(_0xc4e5('0x9'));var squel=require(_0xc4e5('0xa'));var crypto=require(_0xc4e5('0xb'));var jsforce=require(_0xc4e5('0xc'));var deskjs=require(_0xc4e5('0xd'));var toCsv=require(_0xc4e5('0x7'));var querystring=require(_0xc4e5('0xe'));var Papa=require(_0xc4e5('0xf'));var Redis=require('ioredis');var authService=require(_0xc4e5('0x10'));var qs=require(_0xc4e5('0x11'));var as=require(_0xc4e5('0x12'));var hardwareService=require(_0xc4e5('0x13'));var logger=require('../../config/logger')(_0xc4e5('0x14'));var utils=require(_0xc4e5('0x15'));var config=require(_0xc4e5('0x16'));var db=require(_0xc4e5('0x17'))['db'];var jayson=require(_0xc4e5('0x18'));var client=jayson[_0xc4e5('0x19')][_0xc4e5('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x54c5a7,_0x5f00d8,_0x465424){if(_0x465424){var _0x5db493=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5db493[_0xc4e5('0x1b')](_0x5f00d8)){return _0x54c5a7;}else{throw new db[(_0xc4e5('0x1c'))][(_0xc4e5('0x1d'))](_0xc4e5('0x1e'));}}else{return _0x54c5a7;}}function respondWithRpcPromise(_0x4881e5,_0x1b7d62,_0x528de4,_0x338c37){return new BPromise(function(_0x3beb59,_0x2937d9){var _0x9e1e26=_0x338c37||client;return _0x9e1e26[_0xc4e5('0x1f')](_0x4881e5,_0x528de4)[_0xc4e5('0x20')](function(_0x228232){logger[_0xc4e5('0x21')](_0xc4e5('0x22'),_0x1b7d62,'request\x20sent');logger[_0xc4e5('0x23')](_0xc4e5('0x24'),_0x1b7d62,'request\x20sent',JSON[_0xc4e5('0x25')](_0x228232));if(_0x228232[_0xc4e5('0x26')]){if(_0x228232['error'][_0xc4e5('0x27')]===0x1f4){logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x1b7d62,_0x228232[_0xc4e5('0x26')][_0xc4e5('0x28')]);return _0x2937d9(_0x228232['error'][_0xc4e5('0x28')]);}logger['error'](_0xc4e5('0x22'),_0x1b7d62,_0x228232[_0xc4e5('0x26')][_0xc4e5('0x28')]);return _0x3beb59(_0x228232['error'][_0xc4e5('0x28')]);}else{logger['info'](_0xc4e5('0x22'),_0x1b7d62,_0xc4e5('0x29'));_0x3beb59(_0x228232['result']['message']);}})[_0xc4e5('0x2a')](function(_0x4d2962){logger[_0xc4e5('0x26')]('VtigerConfiguration,\x20%s,\x20%s',_0x1b7d62,_0x4d2962);_0x2937d9(_0x4d2962);});});}function respondWithStatusCode(_0x460fd8,_0x234b31){_0x234b31=_0x234b31||0xcc;return function(_0x53f7cd){if(_0x53f7cd){return _0x460fd8['sendStatus'](_0x234b31);}return _0x460fd8['status'](_0x234b31)[_0xc4e5('0x2b')]();};}function respondWithResult(_0x183ec7,_0x143e66){_0x143e66=_0x143e66||0xc8;return function(_0x428323){if(_0x428323){return _0x183ec7[_0xc4e5('0x2c')](_0x143e66)[_0xc4e5('0x2d')](_0x428323);}};}function respondWithFilteredResult(_0x3be034,_0x458f3a){return function(_0x4b41c8){if(_0x4b41c8){var _0x1cd4d9=_0x4b41c8[_0xc4e5('0x2e')],_0x2ad4be=_0x458f3a['offset'],_0x261b88=_0x458f3a[_0xc4e5('0x2f')]+_0x458f3a[_0xc4e5('0x30')],_0x23383b;if(_0x261b88>=_0x1cd4d9){_0x261b88=_0x1cd4d9;_0x23383b=0xc8;}else{_0x23383b=0xce;}_0x3be034['status'](_0x23383b);return _0x3be034[_0xc4e5('0x31')]('Content-Range',_0x2ad4be+'-'+_0x261b88+'/'+_0x1cd4d9)[_0xc4e5('0x2d')](_0x4b41c8);}return null;};}function patchUpdates(_0x4efd6c){return function(_0xcc5bb0){try{jsonpatch['apply'](_0xcc5bb0,_0x4efd6c,!![]);}catch(_0x379d71){return BPromise['reject'](_0x379d71);}return _0xcc5bb0['save']();};}function saveUpdates(_0x12d56f,_0x371ff4){return function(_0x2e836c){if(_0x2e836c){return _0x2e836c[_0xc4e5('0x32')](_0x12d56f)['then'](function(_0x29d89b){return _0x29d89b;});}return null;};}function removeEntity(_0x393107,_0x7f384){return function(_0x1162b9){if(_0x1162b9){return _0x1162b9['destroy']()[_0xc4e5('0x20')](function(){_0x393107[_0xc4e5('0x2c')](0xcc)[_0xc4e5('0x2b')]();});}};}function handleEntityNotFound(_0x11b91f,_0x118bf4){return function(_0x58fd80){if(!_0x58fd80){_0x11b91f[_0xc4e5('0x33')](0x194);}return _0x58fd80;};}function handleError(_0x34fd36,_0xd58654){_0xd58654=_0xd58654||0x1f4;return function(_0x4e35ef){logger[_0xc4e5('0x26')](_0x4e35ef[_0xc4e5('0x34')]);if(_0x4e35ef[_0xc4e5('0x35')]){delete _0x4e35ef[_0xc4e5('0x35')];}_0x34fd36['status'](_0xd58654)['send'](_0x4e35ef);};}exports[_0xc4e5('0x36')]=function(_0x1a3f10,_0x22442b){var _0x694e2={},_0x1afd5f={},_0x3e93d5={'count':0x0,'rows':[]};var _0x31aaa9=_[_0xc4e5('0x37')](db[_0xc4e5('0x38')]['rawAttributes'],function(_0x555b93){return{'name':_0x555b93[_0xc4e5('0x39')],'type':_0x555b93[_0xc4e5('0x3a')][_0xc4e5('0x3b')]};});_0x1afd5f[_0xc4e5('0x3c')]=_[_0xc4e5('0x37')](_0x31aaa9,'name');_0x1afd5f[_0xc4e5('0x3d')]=_[_0xc4e5('0x3e')](_0x1a3f10[_0xc4e5('0x3d')]);_0x1afd5f[_0xc4e5('0x3f')]=_[_0xc4e5('0x40')](_0x1afd5f['model'],_0x1afd5f[_0xc4e5('0x3d')]);_0x694e2[_0xc4e5('0x41')]=_[_0xc4e5('0x40')](_0x1afd5f[_0xc4e5('0x3c')],qs['fields'](_0x1a3f10['query']['fields']));_0x694e2[_0xc4e5('0x41')]=_0x694e2['attributes'][_0xc4e5('0x42')]?_0x694e2[_0xc4e5('0x41')]:_0x1afd5f[_0xc4e5('0x3c')];if(!_0x1a3f10['query'][_0xc4e5('0x43')]('nolimit')){_0x694e2[_0xc4e5('0x30')]=qs[_0xc4e5('0x30')](_0x1a3f10[_0xc4e5('0x3d')]['limit']);_0x694e2[_0xc4e5('0x2f')]=qs[_0xc4e5('0x2f')](_0x1a3f10[_0xc4e5('0x3d')][_0xc4e5('0x2f')]);}_0x694e2[_0xc4e5('0x44')]=qs[_0xc4e5('0x45')](_0x1a3f10[_0xc4e5('0x3d')][_0xc4e5('0x45')]);_0x694e2['where']=qs[_0xc4e5('0x3f')](_[_0xc4e5('0x46')](_0x1a3f10[_0xc4e5('0x3d')],_0x1afd5f[_0xc4e5('0x3f')]),_0x31aaa9);if(_0x1a3f10[_0xc4e5('0x3d')][_0xc4e5('0x47')]){_0x694e2[_0xc4e5('0x48')]=_[_0xc4e5('0x49')](_0x694e2[_0xc4e5('0x48')],{'$or':_[_0xc4e5('0x37')](_0x31aaa9,function(_0x10951e){if(_0x10951e[_0xc4e5('0x3a')]!=='VIRTUAL'){var _0x529253={};_0x529253[_0x10951e[_0xc4e5('0x35')]]={'$like':'%'+_0x1a3f10[_0xc4e5('0x3d')][_0xc4e5('0x47')]+'%'};return _0x529253;}})});}_0x694e2=_[_0xc4e5('0x49')]({},_0x694e2,_0x1a3f10['options']);var _0x22ef2a={'where':_0x694e2['where']};return db['VtigerConfiguration'][_0xc4e5('0x2e')](_0x22ef2a)[_0xc4e5('0x20')](function(_0x5def78){_0x3e93d5[_0xc4e5('0x2e')]=_0x5def78;if(_0x1a3f10['query'][_0xc4e5('0x4a')]){_0x694e2[_0xc4e5('0x4b')]=[{'all':!![]}];}return db[_0xc4e5('0x38')][_0xc4e5('0x4c')](_0x694e2);})[_0xc4e5('0x20')](function(_0x347d7c){_0x3e93d5[_0xc4e5('0x4d')]=_0x347d7c;return _0x3e93d5;})[_0xc4e5('0x20')](respondWithFilteredResult(_0x22442b,_0x694e2))[_0xc4e5('0x2a')](handleError(_0x22442b,null));};exports['show']=function(_0x347277,_0xfcb088){var _0x452a5e={'raw':![],'where':{'id':_0x347277[_0xc4e5('0x4e')]['id']}},_0x14614b={};_0x14614b[_0xc4e5('0x3c')]=_[_0xc4e5('0x3e')](db['VtigerConfiguration'][_0xc4e5('0x4f')]);_0x14614b['query']=_[_0xc4e5('0x3e')](_0x347277[_0xc4e5('0x3d')]);_0x14614b['filters']=_[_0xc4e5('0x40')](_0x14614b[_0xc4e5('0x3c')],_0x14614b['query']);_0x452a5e['attributes']=_[_0xc4e5('0x40')](_0x14614b[_0xc4e5('0x3c')],qs[_0xc4e5('0x50')](_0x347277[_0xc4e5('0x3d')]['fields']));_0x452a5e[_0xc4e5('0x41')]=_0x452a5e['attributes'][_0xc4e5('0x42')]?_0x452a5e[_0xc4e5('0x41')]:_0x14614b[_0xc4e5('0x3c')];if(_0x347277[_0xc4e5('0x3d')][_0xc4e5('0x4a')]){_0x452a5e['include']=[{'all':!![]}];}_0x452a5e=_[_0xc4e5('0x49')]({},_0x452a5e,_0x347277[_0xc4e5('0x51')]);return db[_0xc4e5('0x38')][_0xc4e5('0x52')](_0x452a5e)[_0xc4e5('0x20')](handleEntityNotFound(_0xfcb088,null))[_0xc4e5('0x20')](respondWithResult(_0xfcb088,null))[_0xc4e5('0x2a')](handleError(_0xfcb088,null));};exports['create']=function(_0x2df297,_0xf2a334){return db[_0xc4e5('0x38')][_0xc4e5('0x53')](_0x2df297[_0xc4e5('0x54')],{})[_0xc4e5('0x20')](respondWithResult(_0xf2a334,0xc9))[_0xc4e5('0x2a')](handleError(_0xf2a334,null));};exports[_0xc4e5('0x32')]=function(_0x324be6,_0x6f4fae){if(_0x324be6[_0xc4e5('0x54')]['id']){delete _0x324be6['body']['id'];}return db['VtigerConfiguration'][_0xc4e5('0x52')]({'where':{'id':_0x324be6['params']['id']}})['then'](handleEntityNotFound(_0x6f4fae,null))[_0xc4e5('0x20')](saveUpdates(_0x324be6[_0xc4e5('0x54')],null))[_0xc4e5('0x20')](respondWithResult(_0x6f4fae,null))['catch'](handleError(_0x6f4fae,null));};exports[_0xc4e5('0x55')]=function(_0x23bd14,_0x453a66){return db[_0xc4e5('0x38')][_0xc4e5('0x52')]({'where':{'id':_0x23bd14['params']['id']}})[_0xc4e5('0x20')](handleEntityNotFound(_0x453a66,null))[_0xc4e5('0x20')](removeEntity(_0x453a66,null))[_0xc4e5('0x2a')](handleError(_0x453a66,null));};exports[_0xc4e5('0x56')]=function(_0x320957,_0x2368e7,_0x49e593){var _0x1334e1={};var _0x38f8d7={};var _0x338dae;var _0x17461e;return db[_0xc4e5('0x38')][_0xc4e5('0x57')]({'where':{'id':_0x320957[_0xc4e5('0x4e')]['id']}})[_0xc4e5('0x20')](handleEntityNotFound(_0x2368e7,null))[_0xc4e5('0x20')](function(_0x37027d){if(_0x37027d){_0x338dae=_0x37027d;_0x38f8d7[_0xc4e5('0x3c')]=_[_0xc4e5('0x3e')](db[_0xc4e5('0x58')]['rawAttributes']);_0x38f8d7[_0xc4e5('0x3d')]=_['keys'](_0x320957[_0xc4e5('0x3d')]);_0x38f8d7[_0xc4e5('0x3f')]=_[_0xc4e5('0x40')](_0x38f8d7[_0xc4e5('0x3c')],_0x38f8d7[_0xc4e5('0x3d')]);_0x1334e1[_0xc4e5('0x41')]=_[_0xc4e5('0x40')](_0x38f8d7['model'],qs[_0xc4e5('0x50')](_0x320957['query'][_0xc4e5('0x50')]));_0x1334e1['attributes']=_0x1334e1[_0xc4e5('0x41')]['length']?_0x1334e1[_0xc4e5('0x41')]:_0x38f8d7[_0xc4e5('0x3c')];_0x1334e1[_0xc4e5('0x44')]=qs['sort'](_0x320957[_0xc4e5('0x3d')]['sort']);_0x1334e1[_0xc4e5('0x48')]=qs[_0xc4e5('0x3f')](_[_0xc4e5('0x46')](_0x320957[_0xc4e5('0x3d')],_0x38f8d7[_0xc4e5('0x3f')]));if(_0x320957[_0xc4e5('0x3d')]['filter']){_0x1334e1[_0xc4e5('0x48')]=_[_0xc4e5('0x49')](_0x1334e1[_0xc4e5('0x48')],{'$or':_[_0xc4e5('0x37')](_0x1334e1[_0xc4e5('0x41')],function(_0x260bfd){var _0x2d3951={};_0x2d3951[_0x260bfd]={'$like':'%'+_0x320957[_0xc4e5('0x3d')][_0xc4e5('0x47')]+'%'};return _0x2d3951;})});}_0x1334e1=_[_0xc4e5('0x49')]({},_0x1334e1,_0x320957[_0xc4e5('0x51')]);return _0x338dae['getFields'](_0x1334e1);}})[_0xc4e5('0x20')](function(_0x38fb9b){if(_0x38fb9b){_0x17461e=_0x38fb9b['length'];if(!_0x320957[_0xc4e5('0x3d')][_0xc4e5('0x43')](_0xc4e5('0x59'))){_0x1334e1[_0xc4e5('0x30')]=qs[_0xc4e5('0x30')](_0x320957[_0xc4e5('0x3d')]['limit']);_0x1334e1[_0xc4e5('0x2f')]=qs[_0xc4e5('0x2f')](_0x320957['query'][_0xc4e5('0x2f')]);}return _0x338dae[_0xc4e5('0x56')](_0x1334e1);}})['then'](function(_0x4bc266){if(_0x4bc266){return _0x4bc266?{'count':_0x17461e,'rows':_0x4bc266}:null;}})[_0xc4e5('0x20')](respondWithResult(_0x2368e7,null))[_0xc4e5('0x2a')](handleError(_0x2368e7,null));};exports[_0xc4e5('0x5a')]=function(_0x120440,_0x1cac7f,_0xfd12){var _0x4a602e={};var _0x5ba867={};var _0x3dc437;var _0xc14634;return db[_0xc4e5('0x38')][_0xc4e5('0x57')]({'where':{'id':_0x120440[_0xc4e5('0x4e')]['id']}})['then'](handleEntityNotFound(_0x1cac7f,null))[_0xc4e5('0x20')](function(_0x2c7ee4){if(_0x2c7ee4){_0x3dc437=_0x2c7ee4;_0x5ba867[_0xc4e5('0x3c')]=_[_0xc4e5('0x3e')](db['VtigerField'][_0xc4e5('0x4f')]);_0x5ba867['query']=_[_0xc4e5('0x3e')](_0x120440[_0xc4e5('0x3d')]);_0x5ba867[_0xc4e5('0x3f')]=_['intersection'](_0x5ba867['model'],_0x5ba867['query']);_0x4a602e['attributes']=_[_0xc4e5('0x40')](_0x5ba867[_0xc4e5('0x3c')],qs['fields'](_0x120440['query'][_0xc4e5('0x50')]));_0x4a602e[_0xc4e5('0x41')]=_0x4a602e['attributes'][_0xc4e5('0x42')]?_0x4a602e[_0xc4e5('0x41')]:_0x5ba867[_0xc4e5('0x3c')];_0x4a602e[_0xc4e5('0x44')]=qs[_0xc4e5('0x45')](_0x120440['query'][_0xc4e5('0x45')]);_0x4a602e[_0xc4e5('0x48')]=qs[_0xc4e5('0x3f')](_[_0xc4e5('0x46')](_0x120440['query'],_0x5ba867['filters']));if(_0x120440[_0xc4e5('0x3d')][_0xc4e5('0x47')]){_0x4a602e[_0xc4e5('0x48')]=_['merge'](_0x4a602e['where'],{'$or':_[_0xc4e5('0x37')](_0x4a602e[_0xc4e5('0x41')],function(_0x5f2589){var _0x76b406={};_0x76b406[_0x5f2589]={'$like':'%'+_0x120440[_0xc4e5('0x3d')]['filter']+'%'};return _0x76b406;})});}_0x4a602e=_['merge']({},_0x4a602e,_0x120440[_0xc4e5('0x51')]);return _0x3dc437[_0xc4e5('0x5a')](_0x4a602e);}})[_0xc4e5('0x20')](function(_0x199d34){if(_0x199d34){_0xc14634=_0x199d34[_0xc4e5('0x42')];if(!_0x120440[_0xc4e5('0x3d')][_0xc4e5('0x43')]('nolimit')){_0x4a602e[_0xc4e5('0x30')]=qs[_0xc4e5('0x30')](_0x120440['query'][_0xc4e5('0x30')]);_0x4a602e['offset']=qs[_0xc4e5('0x2f')](_0x120440[_0xc4e5('0x3d')]['offset']);}return _0x3dc437[_0xc4e5('0x5a')](_0x4a602e);}})[_0xc4e5('0x20')](function(_0x2158ad){if(_0x2158ad){return _0x2158ad?{'count':_0xc14634,'rows':_0x2158ad}:null;}})['then'](respondWithResult(_0x1cac7f,null))['catch'](handleError(_0x1cac7f,null));};exports['getDescriptions']=function(_0x4276e3,_0x2ef5c0,_0x2aed2f){var _0x5ec653={};var _0x23c577={};var _0x4f575f;var _0x5c753c;return db[_0xc4e5('0x38')][_0xc4e5('0x57')]({'where':{'id':_0x4276e3['params']['id']}})['then'](handleEntityNotFound(_0x2ef5c0,null))[_0xc4e5('0x20')](function(_0x4431bb){if(_0x4431bb){_0x4f575f=_0x4431bb;_0x23c577[_0xc4e5('0x3c')]=_[_0xc4e5('0x3e')](db[_0xc4e5('0x58')]['rawAttributes']);_0x23c577[_0xc4e5('0x3d')]=_[_0xc4e5('0x3e')](_0x4276e3[_0xc4e5('0x3d')]);_0x23c577[_0xc4e5('0x3f')]=_[_0xc4e5('0x40')](_0x23c577['model'],_0x23c577[_0xc4e5('0x3d')]);_0x5ec653['attributes']=_[_0xc4e5('0x40')](_0x23c577[_0xc4e5('0x3c')],qs[_0xc4e5('0x50')](_0x4276e3[_0xc4e5('0x3d')][_0xc4e5('0x50')]));_0x5ec653[_0xc4e5('0x41')]=_0x5ec653[_0xc4e5('0x41')][_0xc4e5('0x42')]?_0x5ec653['attributes']:_0x23c577[_0xc4e5('0x3c')];_0x5ec653[_0xc4e5('0x44')]=qs[_0xc4e5('0x45')](_0x4276e3[_0xc4e5('0x3d')]['sort']);_0x5ec653[_0xc4e5('0x48')]=qs['filters'](_[_0xc4e5('0x46')](_0x4276e3['query'],_0x23c577[_0xc4e5('0x3f')]));if(_0x4276e3['query'][_0xc4e5('0x47')]){_0x5ec653[_0xc4e5('0x48')]=_[_0xc4e5('0x49')](_0x5ec653[_0xc4e5('0x48')],{'$or':_[_0xc4e5('0x37')](_0x5ec653[_0xc4e5('0x41')],function(_0x4f379a){var _0x1dfb57={};_0x1dfb57[_0x4f379a]={'$like':'%'+_0x4276e3[_0xc4e5('0x3d')][_0xc4e5('0x47')]+'%'};return _0x1dfb57;})});}_0x5ec653=_['merge']({},_0x5ec653,_0x4276e3[_0xc4e5('0x51')]);return _0x4f575f[_0xc4e5('0x5b')](_0x5ec653);}})['then'](function(_0xc4225e){if(_0xc4225e){_0x5c753c=_0xc4225e[_0xc4e5('0x42')];if(!_0x4276e3[_0xc4e5('0x3d')]['hasOwnProperty'](_0xc4e5('0x59'))){_0x5ec653[_0xc4e5('0x30')]=qs[_0xc4e5('0x30')](_0x4276e3[_0xc4e5('0x3d')][_0xc4e5('0x30')]);_0x5ec653['offset']=qs[_0xc4e5('0x2f')](_0x4276e3[_0xc4e5('0x3d')][_0xc4e5('0x2f')]);}return _0x4f575f[_0xc4e5('0x5b')](_0x5ec653);}})[_0xc4e5('0x20')](function(_0x4ae2b0){if(_0x4ae2b0){return _0x4ae2b0?{'count':_0x5c753c,'rows':_0x4ae2b0}:null;}})[_0xc4e5('0x20')](respondWithResult(_0x2ef5c0,null))[_0xc4e5('0x2a')](handleError(_0x2ef5c0,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 0b625a7..b0447fa 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 _0xb85f=['int_vtiger_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerConfiguration.attributes','exports','define','VtigerConfiguration'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xb85f,0x1c3));var _0xfb85=function(_0x1aa8e4,_0x422beb){_0x1aa8e4=_0x1aa8e4-0x0;var _0x335a4d=_0xb85f[_0x1aa8e4];return _0x335a4d;};'use strict';var _=require(_0xfb85('0x0'));var util=require(_0xfb85('0x1'));var logger=require(_0xfb85('0x2'))(_0xfb85('0x3'));var moment=require(_0xfb85('0x4'));var BPromise=require(_0xfb85('0x5'));var rp=require(_0xfb85('0x6'));var fs=require('fs');var path=require(_0xfb85('0x7'));var rimraf=require(_0xfb85('0x8'));var config=require(_0xfb85('0x9'));var attributes=require(_0xfb85('0xa'));module[_0xfb85('0xb')]=function(_0x51c9a5,_0x1452ae){return _0x51c9a5[_0xfb85('0xc')](_0xfb85('0xd'),attributes,{'tableName':_0xfb85('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9a3c=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerConfiguration.attributes','define','VtigerConfiguration','int_vtiger_configurations','../../config/logger'];(function(_0x4e9e9a,_0x589998){var _0x134fd7=function(_0x24eb00){while(--_0x24eb00){_0x4e9e9a['push'](_0x4e9e9a['shift']());}};_0x134fd7(++_0x589998);}(_0x9a3c,0xa7));var _0xc9a3=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0x9a3c[_0x934425];return _0x31d596;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xc9a3('0x0'))(_0xc9a3('0x1'));var moment=require(_0xc9a3('0x2'));var BPromise=require(_0xc9a3('0x3'));var rp=require(_0xc9a3('0x4'));var fs=require('fs');var path=require(_0xc9a3('0x5'));var rimraf=require(_0xc9a3('0x6'));var config=require(_0xc9a3('0x7'));var attributes=require(_0xc9a3('0x8'));module['exports']=function(_0xd09e0b,_0x2bee15){return _0xd09e0b[_0xc9a3('0x9')](_0xc9a3('0xa'),attributes,{'tableName':_0xc9a3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js index 0fee7a1..c696824 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 _0xa410=['error','code','message','result','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','info','VtigerConfiguration,\x20%s,\x20%s','VtigerConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xa410,0x89));var _0x0a41=function(_0x128e3b,_0x17564f){_0x128e3b=_0x128e3b-0x0;var _0x25cb51=_0xa410[_0x128e3b];return _0x25cb51;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0a41('0x0'));var BPromise=require(_0x0a41('0x1'));var rs=require(_0x0a41('0x2'));var fs=require('fs');var Redis=require(_0x0a41('0x3'));var db=require(_0x0a41('0x4'))['db'];var utils=require(_0x0a41('0x5'));var logger=require(_0x0a41('0x6'))('rpc');var config=require(_0x0a41('0x7'));var jayson=require(_0x0a41('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5bd0fb,_0xe68597,_0x471e6d){return new BPromise(function(_0x48de58,_0x16977f){return client[_0x0a41('0x9')](_0x5bd0fb,_0x471e6d)['then'](function(_0x4d7d32){logger[_0x0a41('0xa')](_0x0a41('0xb'),_0xe68597,'request\x20sent');logger['debug'](_0x0a41('0xc'),_0xe68597,_0x0a41('0xd'),JSON[_0x0a41('0xe')](_0x4d7d32));if(_0x4d7d32[_0x0a41('0xf')]){if(_0x4d7d32[_0x0a41('0xf')][_0x0a41('0x10')]===0x1f4){logger[_0x0a41('0xf')](_0x0a41('0xb'),_0xe68597,_0x4d7d32[_0x0a41('0xf')]['message']);return _0x16977f(_0x4d7d32[_0x0a41('0xf')][_0x0a41('0x11')]);}logger[_0x0a41('0xf')](_0x0a41('0xb'),_0xe68597,_0x4d7d32['error'][_0x0a41('0x11')]);return _0x48de58(_0x4d7d32[_0x0a41('0xf')][_0x0a41('0x11')]);}else{logger['info'](_0x0a41('0xb'),_0xe68597,_0x0a41('0xd'));_0x48de58(_0x4d7d32[_0x0a41('0x12')]['message']);}})['catch'](function(_0x118553){logger[_0x0a41('0xf')](_0x0a41('0xb'),_0xe68597,_0x118553);_0x16977f(_0x118553);});});} \ No newline at end of file +var _0xf4f8=['jayson/promise','client','request','then','info','VtigerConfiguration,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0xf4f8,0x81));var _0x8f4f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf4f8[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x8f4f('0x0'));var util=require(_0x8f4f('0x1'));var moment=require('moment');var BPromise=require(_0x8f4f('0x2'));var rs=require(_0x8f4f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8f4f('0x4'))['db'];var utils=require(_0x8f4f('0x5'));var logger=require(_0x8f4f('0x6'))(_0x8f4f('0x7'));var config=require(_0x8f4f('0x8'));var jayson=require(_0x8f4f('0x9'));var client=jayson[_0x8f4f('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5e584a,_0xa4dad7,_0x9dcbee){return new BPromise(function(_0x266563,_0x2ae8e8){return client[_0x8f4f('0xb')](_0x5e584a,_0x9dcbee)[_0x8f4f('0xc')](function(_0x48fe47){logger[_0x8f4f('0xd')](_0x8f4f('0xe'),_0xa4dad7,'request\x20sent');logger[_0x8f4f('0xf')]('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0xa4dad7,_0x8f4f('0x10'),JSON[_0x8f4f('0x11')](_0x48fe47));if(_0x48fe47['error']){if(_0x48fe47[_0x8f4f('0x12')][_0x8f4f('0x13')]===0x1f4){logger[_0x8f4f('0x12')](_0x8f4f('0xe'),_0xa4dad7,_0x48fe47[_0x8f4f('0x12')][_0x8f4f('0x14')]);return _0x2ae8e8(_0x48fe47[_0x8f4f('0x12')]['message']);}logger[_0x8f4f('0x12')](_0x8f4f('0xe'),_0xa4dad7,_0x48fe47[_0x8f4f('0x12')][_0x8f4f('0x14')]);return _0x266563(_0x48fe47[_0x8f4f('0x12')][_0x8f4f('0x14')]);}else{logger[_0x8f4f('0xd')]('VtigerConfiguration,\x20%s,\x20%s',_0xa4dad7,'request\x20sent');_0x266563(_0x48fe47[_0x8f4f('0x15')][_0x8f4f('0x14')]);}})[_0x8f4f('0x16')](function(_0x34a061){logger['error'](_0x8f4f('0xe'),_0xa4dad7,_0x34a061);_0x2ae8e8(_0x34a061);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 14ec53e..11ae445 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 _0x1729=['multer','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerField.controller','get','/:id','isAuthenticated','post','create','put','update','delete','destroy','exports'];(function(_0x42a584,_0x2d9ee3){var _0x56be59=function(_0x5809dd){while(--_0x5809dd){_0x42a584['push'](_0x42a584['shift']());}};_0x56be59(++_0x2d9ee3);}(_0x1729,0x1dc));var _0x9172=function(_0x47fd36,_0x41535d){_0x47fd36=_0x47fd36-0x0;var _0x21a0fc=_0x1729[_0x47fd36];return _0x21a0fc;};'use strict';var multer=require(_0x9172('0x0'));var util=require('util');var path=require(_0x9172('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9172('0x2')]();var auth=require(_0x9172('0x3'));var interaction=require(_0x9172('0x4'));var config=require(_0x9172('0x5'));var controller=require(_0x9172('0x6'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x9172('0x7')](_0x9172('0x8'),auth[_0x9172('0x9')](),controller['show']);router[_0x9172('0xa')]('/',auth[_0x9172('0x9')](),controller[_0x9172('0xb')]);router[_0x9172('0xc')]('/:id',auth['isAuthenticated'](),controller[_0x9172('0xd')]);router[_0x9172('0xe')]('/:id',auth[_0x9172('0x9')](),controller[_0x9172('0xf')]);module[_0x9172('0x10')]=router; \ No newline at end of file +var _0xa292=['multer','connect-timeout','express','./intVtigerField.controller','index','get','/:id','isAuthenticated','show','post','create','update','exports'];(function(_0x4ca88f,_0xbd5b23){var _0x4bd853=function(_0xac771f){while(--_0xac771f){_0x4ca88f['push'](_0x4ca88f['shift']());}};_0x4bd853(++_0xbd5b23);}(_0xa292,0x9c));var _0x2a29=function(_0x563129,_0x26d5f9){_0x563129=_0x563129-0x0;var _0x28d1a3=_0xa292[_0x563129];return _0x28d1a3;};'use strict';var multer=require(_0x2a29('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x2a29('0x1'));var express=require(_0x2a29('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x2a29('0x3'));router['get']('/',auth['isAuthenticated'](),controller[_0x2a29('0x4')]);router[_0x2a29('0x5')](_0x2a29('0x6'),auth[_0x2a29('0x7')](),controller[_0x2a29('0x8')]);router[_0x2a29('0x9')]('/',auth[_0x2a29('0x7')](),controller[_0x2a29('0xa')]);router['put']('/:id',auth[_0x2a29('0x7')](),controller[_0x2a29('0xb')]);router['delete'](_0x2a29('0x6'),auth[_0x2a29('0x7')](),controller['destroy']);module[_0x2a29('0xc')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index d77e43c..4869603 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 _0xcc92=['BOOLEAN','sequelize','exports','ENUM','variable','customVariable','keyValue','STRING'];(function(_0x2da8af,_0x439eb1){var _0x21bee1=function(_0x2d021e){while(--_0x2d021e){_0x2da8af['push'](_0x2da8af['shift']());}};_0x21bee1(++_0x439eb1);}(_0xcc92,0x141));var _0x2cc9=function(_0x17784a,_0x42fe44){_0x17784a=_0x17784a-0x0;var _0x41aded=_0xcc92[_0x17784a];return _0x41aded;};'use strict';var Sequelize=require(_0x2cc9('0x0'));module[_0x2cc9('0x1')]={'type':{'type':Sequelize[_0x2cc9('0x2')]('string',_0x2cc9('0x3'),_0x2cc9('0x4'),_0x2cc9('0x5')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x2cc9('0x6')]},'keyType':{'type':Sequelize[_0x2cc9('0x2')]('string',_0x2cc9('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x2cc9('0x6')]},'idField':{'type':Sequelize[_0x2cc9('0x6')]},'nameField':{'type':Sequelize[_0x2cc9('0x6')]},'customField':{'type':Sequelize[_0x2cc9('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x2208=['customVariable','keyValue','STRING','ENUM','variable','BOOLEAN','exports','string'];(function(_0x447b2e,_0x3ba56e){var _0x46d27f=function(_0x34eba6){while(--_0x34eba6){_0x447b2e['push'](_0x447b2e['shift']());}};_0x46d27f(++_0x3ba56e);}(_0x2208,0x11e));var _0x8220=function(_0x31f433,_0x3026f4){_0x31f433=_0x31f433-0x0;var _0x185f84=_0x2208[_0x31f433];return _0x185f84;};'use strict';var Sequelize=require('sequelize');module[_0x8220('0x0')]={'type':{'type':Sequelize['ENUM'](_0x8220('0x1'),'variable',_0x8220('0x2'),_0x8220('0x3')),'defaultValue':_0x8220('0x1')},'content':{'type':Sequelize[_0x8220('0x4')]},'key':{'type':Sequelize[_0x8220('0x4')]},'keyType':{'type':Sequelize[_0x8220('0x5')]('string',_0x8220('0x6'),'customVariable')},'keyContent':{'type':Sequelize[_0x8220('0x4')]},'idField':{'type':Sequelize[_0x8220('0x4')]},'nameField':{'type':Sequelize[_0x8220('0x4')]},'customField':{'type':Sequelize[_0x8220('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8220('0x4')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 321dd51..d55a65e 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 _0xa090=['error','stack','name','index','VtigerField','rawAttributes','fieldName','type','key','map','query','keys','filters','model','attributes','intersection','length','hasOwnProperty','order','sort','where','VIRTUAL','filter','merge','options','includeAll','include','rows','catch','show','params','fields','find','create','body','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','save','update','then','destroy'];(function(_0x42962d,_0x5e58de){var _0x1e768c=function(_0x23e827){while(--_0x23e827){_0x42962d['push'](_0x42962d['shift']());}};_0x1e768c(++_0x5e58de);}(_0xa090,0x6c));var _0x0a09=function(_0x52f1e6,_0xf70489){_0x52f1e6=_0x52f1e6-0x0;var _0x21f104=_0xa090[_0x52f1e6];return _0x21f104;};'use strict';var pdf=require(_0x0a09('0x0'));var emlformat=require(_0x0a09('0x1'));var rimraf=require(_0x0a09('0x2'));var zipdir=require(_0x0a09('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0a09('0x4'));var moment=require(_0x0a09('0x5'));var BPromise=require(_0x0a09('0x6'));var Mustache=require(_0x0a09('0x7'));var util=require(_0x0a09('0x8'));var path=require(_0x0a09('0x9'));var sox=require(_0x0a09('0xa'));var csv=require(_0x0a09('0xb'));var ejs=require(_0x0a09('0xc'));var fs=require('fs');var _=require(_0x0a09('0xd'));var squel=require('squel');var crypto=require(_0x0a09('0xe'));var jsforce=require(_0x0a09('0xf'));var deskjs=require(_0x0a09('0x10'));var toCsv=require(_0x0a09('0xb'));var querystring=require(_0x0a09('0x11'));var Papa=require(_0x0a09('0x12'));var Redis=require(_0x0a09('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0a09('0x14'));var hardwareService=require(_0x0a09('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x0a09('0x16'));var config=require(_0x0a09('0x17'));var db=require(_0x0a09('0x18'))['db'];function respondWithStatusCode(_0x2ed63d,_0x4169c4){_0x4169c4=_0x4169c4||0xcc;return function(_0x35ea6a){if(_0x35ea6a){return _0x2ed63d[_0x0a09('0x19')](_0x4169c4);}return _0x2ed63d[_0x0a09('0x1a')](_0x4169c4)[_0x0a09('0x1b')]();};}function respondWithResult(_0x2f53e4,_0xfe2c49){_0xfe2c49=_0xfe2c49||0xc8;return function(_0x16750a){if(_0x16750a){return _0x2f53e4['status'](_0xfe2c49)[_0x0a09('0x1c')](_0x16750a);}};}function respondWithFilteredResult(_0x439f16,_0x41fbe0){return function(_0x51378b){if(_0x51378b){var _0x10d321=_0x51378b[_0x0a09('0x1d')],_0x2818ab=_0x41fbe0[_0x0a09('0x1e')],_0x1bcc31=_0x41fbe0[_0x0a09('0x1e')]+_0x41fbe0[_0x0a09('0x1f')],_0xe1a665;if(_0x1bcc31>=_0x10d321){_0x1bcc31=_0x10d321;_0xe1a665=0xc8;}else{_0xe1a665=0xce;}_0x439f16[_0x0a09('0x1a')](_0xe1a665);return _0x439f16[_0x0a09('0x20')]('Content-Range',_0x2818ab+'-'+_0x1bcc31+'/'+_0x10d321)['json'](_0x51378b);}return null;};}function patchUpdates(_0x3b573a){return function(_0x3e4971){try{jsonpatch[_0x0a09('0x21')](_0x3e4971,_0x3b573a,!![]);}catch(_0x4dd1db){return BPromise['reject'](_0x4dd1db);}return _0x3e4971[_0x0a09('0x22')]();};}function saveUpdates(_0x250c91,_0x33a735){return function(_0x590e67){if(_0x590e67){return _0x590e67[_0x0a09('0x23')](_0x250c91)[_0x0a09('0x24')](function(_0xd53a19){return _0xd53a19;});}return null;};}function removeEntity(_0x1f5fcb,_0x43f6c4){return function(_0x524013){if(_0x524013){return _0x524013[_0x0a09('0x25')]()[_0x0a09('0x24')](function(){_0x1f5fcb[_0x0a09('0x1a')](0xcc)[_0x0a09('0x1b')]();});}};}function handleEntityNotFound(_0x3de3a0,_0x53efc7){return function(_0x3b9524){if(!_0x3b9524){_0x3de3a0['sendStatus'](0x194);}return _0x3b9524;};}function handleError(_0x3f132d,_0x3cd2a4){_0x3cd2a4=_0x3cd2a4||0x1f4;return function(_0x894541){logger[_0x0a09('0x26')](_0x894541[_0x0a09('0x27')]);if(_0x894541['name']){delete _0x894541[_0x0a09('0x28')];}_0x3f132d[_0x0a09('0x1a')](_0x3cd2a4)['send'](_0x894541);};}exports[_0x0a09('0x29')]=function(_0x4d6939,_0x3db7fb){var _0x30b277={},_0x2bc64d={},_0x4069f1={'count':0x0,'rows':[]};var _0x19f14a=_['map'](db[_0x0a09('0x2a')][_0x0a09('0x2b')],function(_0xe4b7d8){return{'name':_0xe4b7d8[_0x0a09('0x2c')],'type':_0xe4b7d8[_0x0a09('0x2d')][_0x0a09('0x2e')]};});_0x2bc64d['model']=_[_0x0a09('0x2f')](_0x19f14a,_0x0a09('0x28'));_0x2bc64d[_0x0a09('0x30')]=_[_0x0a09('0x31')](_0x4d6939[_0x0a09('0x30')]);_0x2bc64d[_0x0a09('0x32')]=_['intersection'](_0x2bc64d[_0x0a09('0x33')],_0x2bc64d[_0x0a09('0x30')]);_0x30b277[_0x0a09('0x34')]=_[_0x0a09('0x35')](_0x2bc64d[_0x0a09('0x33')],qs['fields'](_0x4d6939[_0x0a09('0x30')]['fields']));_0x30b277[_0x0a09('0x34')]=_0x30b277[_0x0a09('0x34')][_0x0a09('0x36')]?_0x30b277[_0x0a09('0x34')]:_0x2bc64d[_0x0a09('0x33')];if(!_0x4d6939[_0x0a09('0x30')][_0x0a09('0x37')]('nolimit')){_0x30b277[_0x0a09('0x1f')]=qs[_0x0a09('0x1f')](_0x4d6939[_0x0a09('0x30')]['limit']);_0x30b277['offset']=qs[_0x0a09('0x1e')](_0x4d6939[_0x0a09('0x30')][_0x0a09('0x1e')]);}_0x30b277[_0x0a09('0x38')]=qs['sort'](_0x4d6939[_0x0a09('0x30')][_0x0a09('0x39')]);_0x30b277['where']=qs['filters'](_['pick'](_0x4d6939[_0x0a09('0x30')],_0x2bc64d[_0x0a09('0x32')]),_0x19f14a);if(_0x4d6939[_0x0a09('0x30')]['filter']){_0x30b277[_0x0a09('0x3a')]=_['merge'](_0x30b277[_0x0a09('0x3a')],{'$or':_['map'](_0x19f14a,function(_0x20c1c3){if(_0x20c1c3[_0x0a09('0x2d')]!==_0x0a09('0x3b')){var _0x5fd7e4={};_0x5fd7e4[_0x20c1c3[_0x0a09('0x28')]]={'$like':'%'+_0x4d6939[_0x0a09('0x30')][_0x0a09('0x3c')]+'%'};return _0x5fd7e4;}})});}_0x30b277=_[_0x0a09('0x3d')]({},_0x30b277,_0x4d6939[_0x0a09('0x3e')]);var _0x366851={'where':_0x30b277[_0x0a09('0x3a')]};return db[_0x0a09('0x2a')]['count'](_0x366851)[_0x0a09('0x24')](function(_0x486fa7){_0x4069f1[_0x0a09('0x1d')]=_0x486fa7;if(_0x4d6939[_0x0a09('0x30')][_0x0a09('0x3f')]){_0x30b277[_0x0a09('0x40')]=[{'all':!![]}];}return db[_0x0a09('0x2a')]['findAll'](_0x30b277);})[_0x0a09('0x24')](function(_0x56207b){_0x4069f1[_0x0a09('0x41')]=_0x56207b;return _0x4069f1;})[_0x0a09('0x24')](respondWithFilteredResult(_0x3db7fb,_0x30b277))[_0x0a09('0x42')](handleError(_0x3db7fb,null));};exports[_0x0a09('0x43')]=function(_0x32ae7d,_0x4a7dad){var _0x56b7ef={'raw':!![],'where':{'id':_0x32ae7d[_0x0a09('0x44')]['id']}},_0x2139ef={};_0x2139ef['model']=_['keys'](db[_0x0a09('0x2a')][_0x0a09('0x2b')]);_0x2139ef[_0x0a09('0x30')]=_[_0x0a09('0x31')](_0x32ae7d[_0x0a09('0x30')]);_0x2139ef['filters']=_['intersection'](_0x2139ef[_0x0a09('0x33')],_0x2139ef['query']);_0x56b7ef['attributes']=_[_0x0a09('0x35')](_0x2139ef[_0x0a09('0x33')],qs[_0x0a09('0x45')](_0x32ae7d['query'][_0x0a09('0x45')]));_0x56b7ef['attributes']=_0x56b7ef['attributes'][_0x0a09('0x36')]?_0x56b7ef[_0x0a09('0x34')]:_0x2139ef[_0x0a09('0x33')];if(_0x32ae7d[_0x0a09('0x30')][_0x0a09('0x3f')]){_0x56b7ef[_0x0a09('0x40')]=[{'all':!![]}];}_0x56b7ef=_['merge']({},_0x56b7ef,_0x32ae7d[_0x0a09('0x3e')]);return db[_0x0a09('0x2a')][_0x0a09('0x46')](_0x56b7ef)['then'](handleEntityNotFound(_0x4a7dad,null))[_0x0a09('0x24')](respondWithResult(_0x4a7dad,null))[_0x0a09('0x42')](handleError(_0x4a7dad,null));};exports['create']=function(_0x2a49e5,_0x218400){return db[_0x0a09('0x2a')][_0x0a09('0x47')](_0x2a49e5[_0x0a09('0x48')],{})[_0x0a09('0x24')](respondWithResult(_0x218400,0xc9))['catch'](handleError(_0x218400,null));};exports[_0x0a09('0x23')]=function(_0x5156fd,_0x4d6ef3){if(_0x5156fd[_0x0a09('0x48')]['id']){delete _0x5156fd[_0x0a09('0x48')]['id'];}return db[_0x0a09('0x2a')]['find']({'where':{'id':_0x5156fd[_0x0a09('0x44')]['id']}})['then'](handleEntityNotFound(_0x4d6ef3,null))[_0x0a09('0x24')](saveUpdates(_0x5156fd[_0x0a09('0x48')],null))[_0x0a09('0x24')](respondWithResult(_0x4d6ef3,null))[_0x0a09('0x42')](handleError(_0x4d6ef3,null));};exports['destroy']=function(_0x1860ca,_0xc7e195){return db[_0x0a09('0x2a')][_0x0a09('0x46')]({'where':{'id':_0x1860ca[_0x0a09('0x44')]['id']}})[_0x0a09('0x24')](handleEntityNotFound(_0xc7e195,null))[_0x0a09('0x24')](removeEntity(_0xc7e195,null))['catch'](handleError(_0xc7e195,null));}; \ No newline at end of file +var _0x0545=['findAll','rows','catch','params','body','update','find','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','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','merge','where','VIRTUAL','filter','options','VtigerField','include'];(function(_0x119ffe,_0x395b43){var _0x1e25c5=function(_0x2144f3){while(--_0x2144f3){_0x119ffe['push'](_0x119ffe['shift']());}};_0x1e25c5(++_0x395b43);}(_0x0545,0x17e));var _0x5054=function(_0x5bcb0c,_0x5ee36b){_0x5bcb0c=_0x5bcb0c-0x0;var _0x177948=_0x0545[_0x5bcb0c];return _0x177948;};'use strict';var pdf=require(_0x5054('0x0'));var emlformat=require(_0x5054('0x1'));var rimraf=require(_0x5054('0x2'));var zipdir=require(_0x5054('0x3'));var jsonpatch=require(_0x5054('0x4'));var rp=require(_0x5054('0x5'));var moment=require(_0x5054('0x6'));var BPromise=require(_0x5054('0x7'));var Mustache=require(_0x5054('0x8'));var util=require(_0x5054('0x9'));var path=require(_0x5054('0xa'));var sox=require(_0x5054('0xb'));var csv=require(_0x5054('0xc'));var ejs=require(_0x5054('0xd'));var fs=require('fs');var _=require(_0x5054('0xe'));var squel=require(_0x5054('0xf'));var crypto=require(_0x5054('0x10'));var jsforce=require(_0x5054('0x11'));var deskjs=require(_0x5054('0x12'));var toCsv=require(_0x5054('0xc'));var querystring=require('querystring');var Papa=require(_0x5054('0x13'));var Redis=require(_0x5054('0x14'));var authService=require(_0x5054('0x15'));var qs=require(_0x5054('0x16'));var as=require(_0x5054('0x17'));var hardwareService=require(_0x5054('0x18'));var logger=require(_0x5054('0x19'))('api');var utils=require('../../config/utils');var config=require(_0x5054('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x435d4d,_0x195818){_0x195818=_0x195818||0xcc;return function(_0x36ff82){if(_0x36ff82){return _0x435d4d[_0x5054('0x1b')](_0x195818);}return _0x435d4d[_0x5054('0x1c')](_0x195818)[_0x5054('0x1d')]();};}function respondWithResult(_0x29516d,_0x2741fb){_0x2741fb=_0x2741fb||0xc8;return function(_0x72d0de){if(_0x72d0de){return _0x29516d[_0x5054('0x1c')](_0x2741fb)[_0x5054('0x1e')](_0x72d0de);}};}function respondWithFilteredResult(_0x4038d1,_0x555825){return function(_0x24fac4){if(_0x24fac4){var _0x5d2a07=_0x24fac4[_0x5054('0x1f')],_0x4dc372=_0x555825['offset'],_0x2034bf=_0x555825[_0x5054('0x20')]+_0x555825[_0x5054('0x21')],_0x2249b0;if(_0x2034bf>=_0x5d2a07){_0x2034bf=_0x5d2a07;_0x2249b0=0xc8;}else{_0x2249b0=0xce;}_0x4038d1[_0x5054('0x1c')](_0x2249b0);return _0x4038d1[_0x5054('0x22')](_0x5054('0x23'),_0x4dc372+'-'+_0x2034bf+'/'+_0x5d2a07)[_0x5054('0x1e')](_0x24fac4);}return null;};}function patchUpdates(_0x1891e2){return function(_0x1ecb8a){try{jsonpatch[_0x5054('0x24')](_0x1ecb8a,_0x1891e2,!![]);}catch(_0x3fdaf3){return BPromise[_0x5054('0x25')](_0x3fdaf3);}return _0x1ecb8a[_0x5054('0x26')]();};}function saveUpdates(_0x1d2997,_0x46383e){return function(_0x32c568){if(_0x32c568){return _0x32c568['update'](_0x1d2997)[_0x5054('0x27')](function(_0x48ab77){return _0x48ab77;});}return null;};}function removeEntity(_0xe68e74,_0x2679b2){return function(_0x2f185e){if(_0x2f185e){return _0x2f185e[_0x5054('0x28')]()[_0x5054('0x27')](function(){_0xe68e74[_0x5054('0x1c')](0xcc)[_0x5054('0x1d')]();});}};}function handleEntityNotFound(_0x336d1d,_0x470b35){return function(_0x5a2072){if(!_0x5a2072){_0x336d1d[_0x5054('0x1b')](0x194);}return _0x5a2072;};}function handleError(_0x52af49,_0xc61103){_0xc61103=_0xc61103||0x1f4;return function(_0x4f84f3){logger[_0x5054('0x29')](_0x4f84f3[_0x5054('0x2a')]);if(_0x4f84f3[_0x5054('0x2b')]){delete _0x4f84f3['name'];}_0x52af49[_0x5054('0x1c')](_0xc61103)[_0x5054('0x2c')](_0x4f84f3);};}exports[_0x5054('0x2d')]=function(_0x3300ab,_0x353dc8){var _0x15f340={},_0x452066={},_0x5d17b7={'count':0x0,'rows':[]};var _0x511754=_['map'](db['VtigerField']['rawAttributes'],function(_0x141f27){return{'name':_0x141f27[_0x5054('0x2e')],'type':_0x141f27[_0x5054('0x2f')][_0x5054('0x30')]};});_0x452066[_0x5054('0x31')]=_[_0x5054('0x32')](_0x511754,_0x5054('0x2b'));_0x452066[_0x5054('0x33')]=_[_0x5054('0x34')](_0x3300ab[_0x5054('0x33')]);_0x452066[_0x5054('0x35')]=_['intersection'](_0x452066['model'],_0x452066['query']);_0x15f340[_0x5054('0x36')]=_[_0x5054('0x37')](_0x452066['model'],qs['fields'](_0x3300ab[_0x5054('0x33')][_0x5054('0x38')]));_0x15f340['attributes']=_0x15f340[_0x5054('0x36')][_0x5054('0x39')]?_0x15f340[_0x5054('0x36')]:_0x452066[_0x5054('0x31')];if(!_0x3300ab[_0x5054('0x33')][_0x5054('0x3a')](_0x5054('0x3b'))){_0x15f340[_0x5054('0x21')]=qs['limit'](_0x3300ab[_0x5054('0x33')][_0x5054('0x21')]);_0x15f340['offset']=qs[_0x5054('0x20')](_0x3300ab['query'][_0x5054('0x20')]);}_0x15f340['order']=qs[_0x5054('0x3c')](_0x3300ab[_0x5054('0x33')][_0x5054('0x3c')]);_0x15f340['where']=qs['filters'](_['pick'](_0x3300ab[_0x5054('0x33')],_0x452066[_0x5054('0x35')]),_0x511754);if(_0x3300ab[_0x5054('0x33')]['filter']){_0x15f340['where']=_[_0x5054('0x3d')](_0x15f340[_0x5054('0x3e')],{'$or':_['map'](_0x511754,function(_0x176cad){if(_0x176cad['type']!==_0x5054('0x3f')){var _0x5e2fd8={};_0x5e2fd8[_0x176cad[_0x5054('0x2b')]]={'$like':'%'+_0x3300ab[_0x5054('0x33')][_0x5054('0x40')]+'%'};return _0x5e2fd8;}})});}_0x15f340=_[_0x5054('0x3d')]({},_0x15f340,_0x3300ab[_0x5054('0x41')]);var _0x2ec62f={'where':_0x15f340[_0x5054('0x3e')]};return db[_0x5054('0x42')][_0x5054('0x1f')](_0x2ec62f)[_0x5054('0x27')](function(_0x2fccfe){_0x5d17b7['count']=_0x2fccfe;if(_0x3300ab[_0x5054('0x33')]['includeAll']){_0x15f340[_0x5054('0x43')]=[{'all':!![]}];}return db[_0x5054('0x42')][_0x5054('0x44')](_0x15f340);})[_0x5054('0x27')](function(_0x2bebff){_0x5d17b7[_0x5054('0x45')]=_0x2bebff;return _0x5d17b7;})['then'](respondWithFilteredResult(_0x353dc8,_0x15f340))[_0x5054('0x46')](handleError(_0x353dc8,null));};exports['show']=function(_0x3670a5,_0x48fb44){var _0x124eb6={'raw':!![],'where':{'id':_0x3670a5[_0x5054('0x47')]['id']}},_0x16ddbf={};_0x16ddbf[_0x5054('0x31')]=_[_0x5054('0x34')](db['VtigerField']['rawAttributes']);_0x16ddbf[_0x5054('0x33')]=_[_0x5054('0x34')](_0x3670a5[_0x5054('0x33')]);_0x16ddbf[_0x5054('0x35')]=_[_0x5054('0x37')](_0x16ddbf[_0x5054('0x31')],_0x16ddbf[_0x5054('0x33')]);_0x124eb6[_0x5054('0x36')]=_['intersection'](_0x16ddbf['model'],qs[_0x5054('0x38')](_0x3670a5['query'][_0x5054('0x38')]));_0x124eb6[_0x5054('0x36')]=_0x124eb6[_0x5054('0x36')][_0x5054('0x39')]?_0x124eb6['attributes']:_0x16ddbf[_0x5054('0x31')];if(_0x3670a5[_0x5054('0x33')]['includeAll']){_0x124eb6['include']=[{'all':!![]}];}_0x124eb6=_[_0x5054('0x3d')]({},_0x124eb6,_0x3670a5[_0x5054('0x41')]);return db[_0x5054('0x42')]['find'](_0x124eb6)['then'](handleEntityNotFound(_0x48fb44,null))[_0x5054('0x27')](respondWithResult(_0x48fb44,null))[_0x5054('0x46')](handleError(_0x48fb44,null));};exports['create']=function(_0x312767,_0x53e22c){return db[_0x5054('0x42')]['create'](_0x312767[_0x5054('0x48')],{})['then'](respondWithResult(_0x53e22c,0xc9))['catch'](handleError(_0x53e22c,null));};exports[_0x5054('0x49')]=function(_0x1a22c1,_0x1acbd0){if(_0x1a22c1[_0x5054('0x48')]['id']){delete _0x1a22c1[_0x5054('0x48')]['id'];}return db[_0x5054('0x42')][_0x5054('0x4a')]({'where':{'id':_0x1a22c1[_0x5054('0x47')]['id']}})[_0x5054('0x27')](handleEntityNotFound(_0x1acbd0,null))[_0x5054('0x27')](saveUpdates(_0x1a22c1[_0x5054('0x48')],null))[_0x5054('0x27')](respondWithResult(_0x1acbd0,null))[_0x5054('0x46')](handleError(_0x1acbd0,null));};exports[_0x5054('0x28')]=function(_0x3be2c2,_0x41e8d3){return db[_0x5054('0x42')][_0x5054('0x4a')]({'where':{'id':_0x3be2c2[_0x5054('0x47')]['id']}})[_0x5054('0x27')](handleEntityNotFound(_0x41e8d3,null))[_0x5054('0x27')](removeEntity(_0x41e8d3,null))['catch'](handleError(_0x41e8d3,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 3e63ed6..2a62d33 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(_0x219400,_0x30e814){var _0xad55cf=function(_0x394b01){while(--_0x394b01){_0x219400['push'](_0x219400['shift']());}};_0xad55cf(++_0x30e814);}(_0x7a54,0x106));var _0x47a5=function(_0x17f157,_0x2ef9da){_0x17f157=_0x17f157-0x0;var _0x455418=_0x7a54[_0x17f157];return _0x455418;};'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 _0x9957=['rimraf','./intVtigerField.attributes','exports','define','VtigerField','vtiger_unique_index','idField','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x710815,_0x520da8){var _0x5b3b89=function(_0x2e1a8e){while(--_0x2e1a8e){_0x710815['push'](_0x710815['shift']());}};_0x5b3b89(++_0x520da8);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.rpc.js b/server/api/intVtigerField/intVtigerField.rpc.js index b6f0b42..a08aaba 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 _0xae60=['../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','then','info','VtigerField,\x20%s,\x20%s','debug','VtigerField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis'];(function(_0xeb2a27,_0x56f6bd){var _0xdd48ba=function(_0x3ce62b){while(--_0x3ce62b){_0xeb2a27['push'](_0xeb2a27['shift']());}};_0xdd48ba(++_0x56f6bd);}(_0xae60,0x1c7));var _0x0ae6=function(_0x1477ef,_0x54a5d6){_0x1477ef=_0x1477ef-0x0;var _0x164acd=_0xae60[_0x1477ef];return _0x164acd;};'use strict';var _=require(_0x0ae6('0x0'));var util=require(_0x0ae6('0x1'));var moment=require(_0x0ae6('0x2'));var BPromise=require('bluebird');var rs=require(_0x0ae6('0x3'));var fs=require('fs');var Redis=require(_0x0ae6('0x4'));var db=require(_0x0ae6('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0ae6('0x6'))(_0x0ae6('0x7'));var config=require('../../config/environment');var jayson=require(_0x0ae6('0x8'));var client=jayson[_0x0ae6('0x9')][_0x0ae6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x46fed4,_0xbb596c,_0x447a1d){return new BPromise(function(_0x120910,_0x1b5e80){return client['request'](_0x46fed4,_0x447a1d)[_0x0ae6('0xb')](function(_0x36a5e0){logger[_0x0ae6('0xc')](_0x0ae6('0xd'),_0xbb596c,'request\x20sent');logger[_0x0ae6('0xe')](_0x0ae6('0xf'),_0xbb596c,_0x0ae6('0x10'),JSON[_0x0ae6('0x11')](_0x36a5e0));if(_0x36a5e0[_0x0ae6('0x12')]){if(_0x36a5e0[_0x0ae6('0x12')][_0x0ae6('0x13')]===0x1f4){logger[_0x0ae6('0x12')](_0x0ae6('0xd'),_0xbb596c,_0x36a5e0[_0x0ae6('0x12')][_0x0ae6('0x14')]);return _0x1b5e80(_0x36a5e0[_0x0ae6('0x12')][_0x0ae6('0x14')]);}logger[_0x0ae6('0x12')]('VtigerField,\x20%s,\x20%s',_0xbb596c,_0x36a5e0[_0x0ae6('0x12')][_0x0ae6('0x14')]);return _0x120910(_0x36a5e0[_0x0ae6('0x12')][_0x0ae6('0x14')]);}else{logger[_0x0ae6('0xc')](_0x0ae6('0xd'),_0xbb596c,_0x0ae6('0x10'));_0x120910(_0x36a5e0[_0x0ae6('0x15')][_0x0ae6('0x14')]);}})[_0x0ae6('0x16')](function(_0x8a4c9a){logger[_0x0ae6('0x12')](_0x0ae6('0xd'),_0xbb596c,_0x8a4c9a);_0x1b5e80(_0x8a4c9a);});});} \ No newline at end of file +var _0xa3b7=['info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then'];(function(_0x317725,_0x1bd734){var _0x1e08cb=function(_0x42d51c){while(--_0x42d51c){_0x317725['push'](_0x317725['shift']());}};_0x1e08cb(++_0x1bd734);}(_0xa3b7,0xe6));var _0x7a3b=function(_0x59b2a1,_0x1f631f){_0x59b2a1=_0x59b2a1-0x0;var _0x4908d1=_0xa3b7[_0x59b2a1];return _0x4908d1;};'use strict';var _=require(_0x7a3b('0x0'));var util=require('util');var moment=require(_0x7a3b('0x1'));var BPromise=require('bluebird');var rs=require(_0x7a3b('0x2'));var fs=require('fs');var Redis=require(_0x7a3b('0x3'));var db=require(_0x7a3b('0x4'))['db'];var utils=require(_0x7a3b('0x5'));var logger=require(_0x7a3b('0x6'))(_0x7a3b('0x7'));var config=require(_0x7a3b('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x7a3b('0x9')][_0x7a3b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x31274f,_0x43c083,_0x63f93d){return new BPromise(function(_0x560f45,_0x1d6e53){return client['request'](_0x31274f,_0x63f93d)[_0x7a3b('0xb')](function(_0x60adf9){logger[_0x7a3b('0xc')](_0x7a3b('0xd'),_0x43c083,_0x7a3b('0xe'));logger[_0x7a3b('0xf')]('VtigerField,\x20%s,\x20%s,\x20%s',_0x43c083,_0x7a3b('0xe'),JSON[_0x7a3b('0x10')](_0x60adf9));if(_0x60adf9[_0x7a3b('0x11')]){if(_0x60adf9['error'][_0x7a3b('0x12')]===0x1f4){logger[_0x7a3b('0x11')]('VtigerField,\x20%s,\x20%s',_0x43c083,_0x60adf9[_0x7a3b('0x11')][_0x7a3b('0x13')]);return _0x1d6e53(_0x60adf9[_0x7a3b('0x11')]['message']);}logger[_0x7a3b('0x11')](_0x7a3b('0xd'),_0x43c083,_0x60adf9[_0x7a3b('0x11')]['message']);return _0x560f45(_0x60adf9[_0x7a3b('0x11')][_0x7a3b('0x13')]);}else{logger['info'](_0x7a3b('0xd'),_0x43c083,_0x7a3b('0xe'));_0x560f45(_0x60adf9[_0x7a3b('0x14')]['message']);}})[_0x7a3b('0x15')](function(_0x414a5b){logger['error'](_0x7a3b('0xd'),_0x43c083,_0x414a5b);_0x1d6e53(_0x414a5b);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 6c4b42f..2098a6d 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 _0x2700=['index','/:id','show','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','get','isAuthenticated'];(function(_0xdc37a1,_0x53ebb9){var _0x99b4fe=function(_0x2811e3){while(--_0x2811e3){_0xdc37a1['push'](_0xdc37a1['shift']());}};_0x99b4fe(++_0x53ebb9);}(_0x2700,0x1d0));var _0x0270=function(_0x4c399,_0x53188f){_0x4c399=_0x4c399-0x0;var _0x240111=_0x2700[_0x4c399];return _0x240111;};'use strict';var multer=require(_0x0270('0x0'));var util=require('util');var path=require(_0x0270('0x1'));var timeout=require(_0x0270('0x2'));var express=require(_0x0270('0x3'));var router=express[_0x0270('0x4')]();var auth=require(_0x0270('0x5'));var interaction=require(_0x0270('0x6'));var config=require(_0x0270('0x7'));var controller=require(_0x0270('0x8'));router[_0x0270('0x9')]('/',auth[_0x0270('0xa')](),controller[_0x0270('0xb')]);router[_0x0270('0x9')](_0x0270('0xc'),auth['isAuthenticated'](),controller[_0x0270('0xd')]);router[_0x0270('0x9')](_0x0270('0xe'),auth[_0x0270('0xa')](),controller[_0x0270('0xf')]);router['get']('/:id/fields',auth[_0x0270('0xa')](),controller[_0x0270('0x10')]);router[_0x0270('0x11')]('/',auth[_0x0270('0xa')](),controller[_0x0270('0x12')]);router[_0x0270('0x11')]('/:id/configurations',auth[_0x0270('0xa')](),controller[_0x0270('0x13')]);router[_0x0270('0x14')](_0x0270('0xc'),auth[_0x0270('0xa')](),controller[_0x0270('0x15')]);router[_0x0270('0x16')](_0x0270('0xc'),auth[_0x0270('0xa')](),controller[_0x0270('0x17')]);module[_0x0270('0x18')]=router; \ No newline at end of file +var _0x754d=['/:id/configurations','getConfigurations','/:id/fields','create','post','addConfiguration','put','update','delete','destroy','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','get','isAuthenticated','index','/:id','show'];(function(_0x29fbf3,_0x130494){var _0x49829a=function(_0x13dc89){while(--_0x13dc89){_0x29fbf3['push'](_0x29fbf3['shift']());}};_0x49829a(++_0x130494);}(_0x754d,0x135));var _0xd754=function(_0x2391de,_0x21c85f){_0x2391de=_0x2391de-0x0;var _0x4ae234=_0x754d[_0x2391de];return _0x4ae234;};'use strict';var multer=require(_0xd754('0x0'));var util=require('util');var path=require(_0xd754('0x1'));var timeout=require(_0xd754('0x2'));var express=require(_0xd754('0x3'));var router=express[_0xd754('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xd754('0x5'));var config=require(_0xd754('0x6'));var controller=require(_0xd754('0x7'));router[_0xd754('0x8')]('/',auth[_0xd754('0x9')](),controller[_0xd754('0xa')]);router[_0xd754('0x8')](_0xd754('0xb'),auth[_0xd754('0x9')](),controller[_0xd754('0xc')]);router[_0xd754('0x8')](_0xd754('0xd'),auth[_0xd754('0x9')](),controller[_0xd754('0xe')]);router[_0xd754('0x8')](_0xd754('0xf'),auth[_0xd754('0x9')](),controller['getFields']);router['post']('/',auth[_0xd754('0x9')](),controller[_0xd754('0x10')]);router[_0xd754('0x11')](_0xd754('0xd'),auth[_0xd754('0x9')](),controller[_0xd754('0x12')]);router[_0xd754('0x13')](_0xd754('0xb'),auth['isAuthenticated'](),controller[_0xd754('0x14')]);router[_0xd754('0x15')](_0xd754('0xb'),auth[_0xd754('0x9')](),controller[_0xd754('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index fc00177..263aab2 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 _0x1bc3=['token','newTab','integrationTab','sequelize','STRING','username','remoteUri','ENUM','password'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0x1bc3,0x81));var _0x31bc=function(_0x3bfd96,_0x1e6de6){_0x3bfd96=_0x3bfd96-0x0;var _0x143a8c=_0x1bc3[_0x3bfd96];return _0x143a8c;};'use strict';var Sequelize=require(_0x31bc('0x0'));module['exports']={'name':{'type':Sequelize[_0x31bc('0x1')]},'description':{'type':Sequelize[_0x31bc('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0x31bc('0x2')},'password':{'type':Sequelize[_0x31bc('0x1')]},'token':{'type':Sequelize[_0x31bc('0x1')]},'remoteUri':{'type':Sequelize[_0x31bc('0x1')],'unique':_0x31bc('0x3')},'authType':{'type':Sequelize[_0x31bc('0x4')](_0x31bc('0x5'),_0x31bc('0x6')),'defaultValue':_0x31bc('0x5')},'serverUrl':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x31bc('0x4')]('integrationTab',_0x31bc('0x7')),'defaultValue':_0x31bc('0x8')}}; \ No newline at end of file +var _0x0a12=['newTab','sequelize','STRING','remoteUri','ENUM','password','token','integrationTab'];(function(_0x53790d,_0x337e90){var _0x4696a9=function(_0x22b897){while(--_0x22b897){_0x53790d['push'](_0x53790d['shift']());}};_0x4696a9(++_0x337e90);}(_0x0a12,0x169));var _0x20a1=function(_0x62c958,_0x2bfdbc){_0x62c958=_0x62c958-0x0;var _0x57ec61=_0x0a12[_0x62c958];return _0x57ec61;};'use strict';var Sequelize=require(_0x20a1('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x20a1('0x1')]},'username':{'type':Sequelize[_0x20a1('0x1')],'unique':'username'},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x20a1('0x1')]},'remoteUri':{'type':Sequelize[_0x20a1('0x1')],'unique':_0x20a1('0x2')},'authType':{'type':Sequelize[_0x20a1('0x3')](_0x20a1('0x4'),_0x20a1('0x5')),'defaultValue':_0x20a1('0x4')},'serverUrl':{'type':Sequelize[_0x20a1('0x1')]},'type':{'type':Sequelize[_0x20a1('0x3')](_0x20a1('0x6'),_0x20a1('0x7')),'defaultValue':_0x20a1('0x6')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 2c282a9..110d4f1 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 _0x1687=['stack','name','send','index','map','ZendeskAccount','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','where','filter','merge','type','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','getConfigurations','order','sort','pick','hasOwnProperty','findOne','channel','Descriptions','getDescriptions','ZendeskField','Subjects','username','password','authType','remoteUri','slice','substring','lastIndexOf','GET','format','%s/%s','ticket_fields','headers','Basic\x20%s','%s:%s','toString','base64','token','Unknown\x20authentication\x20type','description','assignee','remove','includes','position','title','system_field_options','custom_field_options','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','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','client','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','request\x20sent','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','ZendeskAccount,\x20%s,\x20%s','sendStatus','end','status','count','offset','limit','set','apply','reject','save','update','destroy'];(function(_0x1591f7,_0x5aedd6){var _0x4e1517=function(_0x544aff){while(--_0x544aff){_0x1591f7['push'](_0x1591f7['shift']());}};_0x4e1517(++_0x5aedd6);}(_0x1687,0x145));var _0x7168=function(_0x282393,_0x3b2b82){_0x282393=_0x282393-0x0;var _0x206507=_0x1687[_0x282393];return _0x206507;};'use strict';var pdf=require(_0x7168('0x0'));var emlformat=require(_0x7168('0x1'));var rimraf=require(_0x7168('0x2'));var zipdir=require(_0x7168('0x3'));var jsonpatch=require(_0x7168('0x4'));var rp=require(_0x7168('0x5'));var moment=require('moment');var BPromise=require(_0x7168('0x6'));var Mustache=require(_0x7168('0x7'));var util=require('util');var path=require(_0x7168('0x8'));var sox=require(_0x7168('0x9'));var csv=require(_0x7168('0xa'));var ejs=require(_0x7168('0xb'));var fs=require('fs');var _=require(_0x7168('0xc'));var squel=require(_0x7168('0xd'));var crypto=require(_0x7168('0xe'));var jsforce=require(_0x7168('0xf'));var deskjs=require(_0x7168('0x10'));var toCsv=require(_0x7168('0xa'));var querystring=require(_0x7168('0x11'));var Papa=require('papaparse');var Redis=require(_0x7168('0x12'));var authService=require(_0x7168('0x13'));var qs=require(_0x7168('0x14'));var as=require(_0x7168('0x15'));var hardwareService=require(_0x7168('0x16'));var logger=require(_0x7168('0x17'))(_0x7168('0x18'));var utils=require('../../config/utils');var config=require(_0x7168('0x19'));var db=require(_0x7168('0x1a'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require('jayson/promise');var client=jayson[_0x7168('0x1b')]['http']({'port':0x232a});function checkPasswordPattern(_0x1afe72,_0x2ad3d0,_0xcf0fd5){if(_0xcf0fd5){var _0x1326fd=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1326fd[_0x7168('0x1c')](_0x2ad3d0)){return _0x1afe72;}else{throw new db[(_0x7168('0x1d'))][(_0x7168('0x1e'))](_0x7168('0x1f'));}}else{return _0x1afe72;}}function respondWithRpcPromise(_0x727dce,_0x3a402f,_0x1daf68,_0x36bc40){return new BPromise(function(_0xacabd7,_0x3afe9b){var _0x2cc543=_0x36bc40||client;return _0x2cc543[_0x7168('0x20')](_0x727dce,_0x1daf68)[_0x7168('0x21')](function(_0x1d142c){logger[_0x7168('0x22')]('ZendeskAccount,\x20%s,\x20%s',_0x3a402f,_0x7168('0x23'));logger['debug'](_0x7168('0x24'),_0x3a402f,_0x7168('0x23'),JSON[_0x7168('0x25')](_0x1d142c));if(_0x1d142c['error']){if(_0x1d142c[_0x7168('0x26')]['code']===0x1f4){logger[_0x7168('0x26')]('ZendeskAccount,\x20%s,\x20%s',_0x3a402f,_0x1d142c[_0x7168('0x26')][_0x7168('0x27')]);return _0x3afe9b(_0x1d142c[_0x7168('0x26')][_0x7168('0x27')]);}logger[_0x7168('0x26')]('ZendeskAccount,\x20%s,\x20%s',_0x3a402f,_0x1d142c['error']['message']);return _0xacabd7(_0x1d142c[_0x7168('0x26')][_0x7168('0x27')]);}else{logger['info'](_0x7168('0x28'),_0x3a402f,_0x7168('0x23'));_0xacabd7(_0x1d142c['result'][_0x7168('0x27')]);}})['catch'](function(_0x36e4fc){logger[_0x7168('0x26')](_0x7168('0x28'),_0x3a402f,_0x36e4fc);_0x3afe9b(_0x36e4fc);});});}function respondWithStatusCode(_0x1a4045,_0xb354bc){_0xb354bc=_0xb354bc||0xcc;return function(_0x1de8f0){if(_0x1de8f0){return _0x1a4045[_0x7168('0x29')](_0xb354bc);}return _0x1a4045['status'](_0xb354bc)[_0x7168('0x2a')]();};}function respondWithResult(_0x27071d,_0x2e134f){_0x2e134f=_0x2e134f||0xc8;return function(_0x4d9873){if(_0x4d9873){return _0x27071d[_0x7168('0x2b')](_0x2e134f)['json'](_0x4d9873);}};}function respondWithFilteredResult(_0x415d83,_0x396018){return function(_0x1aa620){if(_0x1aa620){var _0x42c6ff=_0x1aa620[_0x7168('0x2c')],_0x4f6d25=_0x396018[_0x7168('0x2d')],_0x1ff8af=_0x396018[_0x7168('0x2d')]+_0x396018[_0x7168('0x2e')],_0x4b924b;if(_0x1ff8af>=_0x42c6ff){_0x1ff8af=_0x42c6ff;_0x4b924b=0xc8;}else{_0x4b924b=0xce;}_0x415d83[_0x7168('0x2b')](_0x4b924b);return _0x415d83[_0x7168('0x2f')]('Content-Range',_0x4f6d25+'-'+_0x1ff8af+'/'+_0x42c6ff)['json'](_0x1aa620);}return null;};}function patchUpdates(_0x439efb){return function(_0x56ef45){try{jsonpatch[_0x7168('0x30')](_0x56ef45,_0x439efb,!![]);}catch(_0xc0811c){return BPromise[_0x7168('0x31')](_0xc0811c);}return _0x56ef45[_0x7168('0x32')]();};}function saveUpdates(_0xf348f9,_0x3ccef3){return function(_0x15274b){if(_0x15274b){return _0x15274b[_0x7168('0x33')](_0xf348f9)['then'](function(_0x2836ae){return _0x2836ae;});}return null;};}function removeEntity(_0x5d232d,_0xbacd18){return function(_0x661734){if(_0x661734){return _0x661734[_0x7168('0x34')]()['then'](function(){_0x5d232d[_0x7168('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3f41a4,_0x2036ab){return function(_0x4badcc){if(!_0x4badcc){_0x3f41a4[_0x7168('0x29')](0x194);}return _0x4badcc;};}function handleError(_0x1915c1,_0x4d9478){_0x4d9478=_0x4d9478||0x1f4;return function(_0x5621c5){logger[_0x7168('0x26')](_0x5621c5[_0x7168('0x35')]);if(_0x5621c5[_0x7168('0x36')]){delete _0x5621c5[_0x7168('0x36')];}_0x1915c1['status'](_0x4d9478)[_0x7168('0x37')](_0x5621c5);};}exports[_0x7168('0x38')]=function(_0x137be4,_0x374791){var _0xbf7a62={},_0x4f7f19={},_0x23e020={'count':0x0,'rows':[]};var _0x213741=_[_0x7168('0x39')](db[_0x7168('0x3a')][_0x7168('0x3b')],function(_0x447581){return{'name':_0x447581['fieldName'],'type':_0x447581['type'][_0x7168('0x3c')]};});_0x4f7f19[_0x7168('0x3d')]=_[_0x7168('0x39')](_0x213741,_0x7168('0x36'));_0x4f7f19[_0x7168('0x3e')]=_[_0x7168('0x3f')](_0x137be4[_0x7168('0x3e')]);_0x4f7f19[_0x7168('0x40')]=_[_0x7168('0x41')](_0x4f7f19[_0x7168('0x3d')],_0x4f7f19[_0x7168('0x3e')]);_0xbf7a62[_0x7168('0x42')]=_[_0x7168('0x41')](_0x4f7f19['model'],qs[_0x7168('0x43')](_0x137be4['query'][_0x7168('0x43')]));_0xbf7a62['attributes']=_0xbf7a62[_0x7168('0x42')][_0x7168('0x44')]?_0xbf7a62[_0x7168('0x42')]:_0x4f7f19[_0x7168('0x3d')];if(!_0x137be4[_0x7168('0x3e')]['hasOwnProperty'](_0x7168('0x45'))){_0xbf7a62['limit']=qs[_0x7168('0x2e')](_0x137be4['query'][_0x7168('0x2e')]);_0xbf7a62['offset']=qs[_0x7168('0x2d')](_0x137be4[_0x7168('0x3e')]['offset']);}_0xbf7a62['order']=qs['sort'](_0x137be4['query']['sort']);_0xbf7a62[_0x7168('0x46')]=qs['filters'](_['pick'](_0x137be4[_0x7168('0x3e')],_0x4f7f19[_0x7168('0x40')]),_0x213741);if(_0x137be4[_0x7168('0x3e')][_0x7168('0x47')]){_0xbf7a62[_0x7168('0x46')]=_[_0x7168('0x48')](_0xbf7a62[_0x7168('0x46')],{'$or':_[_0x7168('0x39')](_0x213741,function(_0x43bff7){if(_0x43bff7[_0x7168('0x49')]!=='VIRTUAL'){var _0x4a43ec={};_0x4a43ec[_0x43bff7[_0x7168('0x36')]]={'$like':'%'+_0x137be4[_0x7168('0x3e')][_0x7168('0x47')]+'%'};return _0x4a43ec;}})});}_0xbf7a62=_[_0x7168('0x48')]({},_0xbf7a62,_0x137be4[_0x7168('0x4a')]);var _0x10b96a={'where':_0xbf7a62[_0x7168('0x46')]};return db[_0x7168('0x3a')]['count'](_0x10b96a)[_0x7168('0x21')](function(_0x3d332e){_0x23e020['count']=_0x3d332e;if(_0x137be4[_0x7168('0x3e')][_0x7168('0x4b')]){_0xbf7a62['include']=[{'all':!![]}];}return db[_0x7168('0x3a')][_0x7168('0x4c')](_0xbf7a62);})[_0x7168('0x21')](function(_0x576bf1){_0x23e020[_0x7168('0x4d')]=_0x576bf1;return _0x23e020;})[_0x7168('0x21')](respondWithFilteredResult(_0x374791,_0xbf7a62))[_0x7168('0x4e')](handleError(_0x374791,null));};exports[_0x7168('0x4f')]=function(_0x4131d8,_0x40aabc){var _0x2b26df={'raw':![],'where':{'id':_0x4131d8[_0x7168('0x50')]['id']}},_0x4de3e4={};_0x4de3e4[_0x7168('0x3d')]=_['keys'](db[_0x7168('0x3a')][_0x7168('0x3b')]);_0x4de3e4[_0x7168('0x3e')]=_[_0x7168('0x3f')](_0x4131d8[_0x7168('0x3e')]);_0x4de3e4['filters']=_['intersection'](_0x4de3e4['model'],_0x4de3e4[_0x7168('0x3e')]);_0x2b26df[_0x7168('0x42')]=_[_0x7168('0x41')](_0x4de3e4['model'],qs[_0x7168('0x43')](_0x4131d8[_0x7168('0x3e')]['fields']));_0x2b26df[_0x7168('0x42')]=_0x2b26df[_0x7168('0x42')][_0x7168('0x44')]?_0x2b26df['attributes']:_0x4de3e4[_0x7168('0x3d')];if(_0x4131d8[_0x7168('0x3e')][_0x7168('0x4b')]){_0x2b26df[_0x7168('0x51')]=[{'all':!![]}];}_0x2b26df=_[_0x7168('0x48')]({},_0x2b26df,_0x4131d8[_0x7168('0x4a')]);return db[_0x7168('0x3a')][_0x7168('0x52')](_0x2b26df)[_0x7168('0x21')](handleEntityNotFound(_0x40aabc,null))[_0x7168('0x21')](respondWithResult(_0x40aabc,null))[_0x7168('0x4e')](handleError(_0x40aabc,null));};exports[_0x7168('0x53')]=function(_0x306c92,_0x28969a){return db[_0x7168('0x3a')][_0x7168('0x53')](_0x306c92[_0x7168('0x54')],{})[_0x7168('0x21')](respondWithResult(_0x28969a,0xc9))[_0x7168('0x4e')](handleError(_0x28969a,null));};exports[_0x7168('0x33')]=function(_0x4ed3fa,_0x37bd80){if(_0x4ed3fa[_0x7168('0x54')]['id']){delete _0x4ed3fa[_0x7168('0x54')]['id'];}return db[_0x7168('0x3a')][_0x7168('0x52')]({'where':{'id':_0x4ed3fa[_0x7168('0x50')]['id']}})['then'](handleEntityNotFound(_0x37bd80,null))[_0x7168('0x21')](saveUpdates(_0x4ed3fa[_0x7168('0x54')],null))[_0x7168('0x21')](respondWithResult(_0x37bd80,null))[_0x7168('0x4e')](handleError(_0x37bd80,null));};exports[_0x7168('0x34')]=function(_0xe6961b,_0x20b53b){return db[_0x7168('0x3a')][_0x7168('0x52')]({'where':{'id':_0xe6961b['params']['id']}})['then'](handleEntityNotFound(_0x20b53b,null))[_0x7168('0x21')](removeEntity(_0x20b53b,null))['catch'](handleError(_0x20b53b,null));};exports[_0x7168('0x55')]=function(_0x51bab8,_0x169917,_0x2c2f0f){var _0x2508ca={};var _0x436b62={};var _0x155329;var _0x5f1979;return db[_0x7168('0x3a')]['findOne']({'where':{'id':_0x51bab8[_0x7168('0x50')]['id']}})[_0x7168('0x21')](handleEntityNotFound(_0x169917,null))['then'](function(_0x5f54fd){if(_0x5f54fd){_0x155329=_0x5f54fd;_0x436b62[_0x7168('0x3d')]=_[_0x7168('0x3f')](db['ZendeskConfiguration'][_0x7168('0x3b')]);_0x436b62[_0x7168('0x3e')]=_[_0x7168('0x3f')](_0x51bab8['query']);_0x436b62[_0x7168('0x40')]=_[_0x7168('0x41')](_0x436b62[_0x7168('0x3d')],_0x436b62[_0x7168('0x3e')]);_0x2508ca[_0x7168('0x42')]=_['intersection'](_0x436b62[_0x7168('0x3d')],qs[_0x7168('0x43')](_0x51bab8['query']['fields']));_0x2508ca['attributes']=_0x2508ca['attributes'][_0x7168('0x44')]?_0x2508ca['attributes']:_0x436b62[_0x7168('0x3d')];_0x2508ca[_0x7168('0x56')]=qs[_0x7168('0x57')](_0x51bab8[_0x7168('0x3e')][_0x7168('0x57')]);_0x2508ca[_0x7168('0x46')]=qs['filters'](_[_0x7168('0x58')](_0x51bab8[_0x7168('0x3e')],_0x436b62[_0x7168('0x40')]));if(_0x51bab8['query'][_0x7168('0x47')]){_0x2508ca[_0x7168('0x46')]=_['merge'](_0x2508ca[_0x7168('0x46')],{'$or':_[_0x7168('0x39')](_0x2508ca[_0x7168('0x42')],function(_0x5e0197){var _0x3ff203={};_0x3ff203[_0x5e0197]={'$like':'%'+_0x51bab8[_0x7168('0x3e')]['filter']+'%'};return _0x3ff203;})});}_0x2508ca=_[_0x7168('0x48')]({},_0x2508ca,_0x51bab8[_0x7168('0x4a')]);return _0x155329[_0x7168('0x55')](_0x2508ca);}})[_0x7168('0x21')](function(_0x3aa5d3){if(_0x3aa5d3){_0x5f1979=_0x3aa5d3[_0x7168('0x44')];if(!_0x51bab8[_0x7168('0x3e')][_0x7168('0x59')](_0x7168('0x45'))){_0x2508ca[_0x7168('0x2e')]=qs[_0x7168('0x2e')](_0x51bab8[_0x7168('0x3e')][_0x7168('0x2e')]);_0x2508ca[_0x7168('0x2d')]=qs[_0x7168('0x2d')](_0x51bab8[_0x7168('0x3e')][_0x7168('0x2d')]);}return _0x155329[_0x7168('0x55')](_0x2508ca);}})[_0x7168('0x21')](function(_0x4326d4){if(_0x4326d4){return _0x4326d4?{'count':_0x5f1979,'rows':_0x4326d4}:null;}})[_0x7168('0x21')](respondWithResult(_0x169917,null))[_0x7168('0x4e')](handleError(_0x169917,null));};exports['addConfiguration']=function(_0x81b06b,_0xeb232a,_0x44e498){if(_0x81b06b[_0x7168('0x54')]['id']){delete _0x81b06b[_0x7168('0x54')]['id'];}return db['ZendeskAccount'][_0x7168('0x5a')]({'where':{'id':_0x81b06b[_0x7168('0x50')]['id']}})[_0x7168('0x21')](handleEntityNotFound(_0xeb232a,null))[_0x7168('0x21')](function(_0x21c8fc){if(_0x21c8fc){_0x81b06b[_0x7168('0x54')]['AccountId']=_0x21c8fc['id'];_0x81b06b[_0x7168('0x54')]['Subjects']=integrations['getSubjects'](_0x81b06b[_0x7168('0x54')][_0x7168('0x5b')],_0x81b06b[_0x7168('0x54')][_0x7168('0x49')]);_0x81b06b[_0x7168('0x54')][_0x7168('0x5c')]=integrations[_0x7168('0x5d')](_0x81b06b[_0x7168('0x54')][_0x7168('0x5b')],_0x81b06b[_0x7168('0x54')][_0x7168('0x49')]);return db['ZendeskConfiguration'][_0x7168('0x53')](_0x81b06b[_0x7168('0x54')],{'include':[{'model':db[_0x7168('0x5e')],'as':_0x7168('0x5f')},{'model':db[_0x7168('0x5e')],'as':_0x7168('0x5c')}]});}return null;})[_0x7168('0x21')](respondWithResult(_0xeb232a,null))[_0x7168('0x4e')](handleError(_0xeb232a,null));};exports['getFields']=function(_0x50ef61,_0x370603,_0x734e41){var _0x66477='';return db[_0x7168('0x3a')][_0x7168('0x5a')]({'where':{'id':_0x50ef61['params']['id']},'attributes':['id',_0x7168('0x60'),_0x7168('0x61'),'token',_0x7168('0x62'),_0x7168('0x63')]})[_0x7168('0x21')](handleEntityNotFound(_0x370603,null))[_0x7168('0x21')](function(_0x3ae5ec){if(_0x3ae5ec){_0x66477=_0x3ae5ec[_0x7168('0x63')];var _0x5a3f61=_0x66477[_0x7168('0x64')](-0x1);if(_0x5a3f61==='/'){_0x66477=_0x66477[_0x7168('0x65')](0x0,_0x66477[_0x7168('0x66')](_0x5a3f61));}var _0x1267d={'method':_0x7168('0x67'),'uri':util[_0x7168('0x68')](_0x7168('0x69'),_0x66477,_0x7168('0x6a')),'json':!![]};switch(_0x3ae5ec['authType']){case _0x7168('0x61'):_0x1267d[_0x7168('0x6b')]={'Authorization':util[_0x7168('0x68')](_0x7168('0x6c'),new Buffer(util[_0x7168('0x68')](_0x7168('0x6d'),_0x3ae5ec[_0x7168('0x60')],_0x3ae5ec[_0x7168('0x61')]))[_0x7168('0x6e')](_0x7168('0x6f')))};break;case _0x7168('0x70'):_0x1267d[_0x7168('0x6b')]={'Authorization':util[_0x7168('0x68')](_0x7168('0x6c'),new Buffer(util[_0x7168('0x68')]('%s/token:%s',_0x3ae5ec[_0x7168('0x60')],_0x3ae5ec[_0x7168('0x70')]))[_0x7168('0x6e')](_0x7168('0x6f')))};break;default:throw new db[(_0x7168('0x1d'))][(_0x7168('0x1e'))](_0x7168('0x71'));}return rp(_0x1267d);}})['then'](function(_0x5c6446){if(_0x5c6446){var _0xe81936=['subject',_0x7168('0x72'),'group',_0x7168('0x73')];_[_0x7168('0x74')](_0x5c6446['ticket_fields'],function(_0x4d0b42){return _0xe81936[_0x7168('0x75')](_0x4d0b42['type']);});return{'count':_0x5c6446[_0x7168('0x6a')][_0x7168('0x44')],'rows':_[_0x7168('0x39')](_0x5c6446['ticket_fields'],function(_0x45bfce){return{'id':_0x45bfce['id'],'name':_0x45bfce[_0x7168('0x76')]>0x7?_0x45bfce[_0x7168('0x77')]:_0x45bfce[_0x7168('0x49')],'custom':_0x45bfce[_0x7168('0x76')]>0x7?!![]:![],'options':_0x45bfce[_0x7168('0x78')]?_0x45bfce[_0x7168('0x78')]:_0x45bfce['custom_field_options']?_0x45bfce[_0x7168('0x79')]:[]};})};}})[_0x7168('0x21')](respondWithResult(_0x370603,null))[_0x7168('0x4e')](function(_0x5de158){var _0x2e3364=_0x50ef61[_0x7168('0x3e')][_0x7168('0x1c')]?0x1f4:_0x5de158[_0x7168('0x7a')]||0x1f4;logger[_0x7168('0x26')](_0x7168('0x7b'),_0x7168('0x7c'),_0x2e3364,JSON['stringify'](_0x5de158));delete _0x5de158[_0x7168('0x36')];if(_0x2e3364===0x191){_0x2e3364=0x190;}_0x370603['status'](_0x2e3364)['send'](_0x50ef61[_0x7168('0x3e')]['test']?{'message':_0x7168('0x7d'),'statusCode':_0x5de158[_0x7168('0x7a')]}:_0x5de158);});}; \ No newline at end of file +var _0x1dbe=['options','find','create','body','destroy','getConfigurations','ZendeskConfiguration','pick','filter','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','ZendeskField','getFields','findOne','password','token','authType','remoteUri','lastIndexOf','GET','format','ticket_fields','headers','Basic\x20%s','%s:%s','toString','base64','Sequelize','Unknown\x20authentication\x20type','subject','assignee','position','system_field_options','custom_field_options','statusCode','getFields,\x20%s,\x20%s,\x20%s','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','mustache','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','../../components/integrations/configuration','client','http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','stack','name','send','index','map','ZendeskAccount','rawAttributes','fieldName','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','type','VIRTUAL','include','catch','params','includeAll'];(function(_0x528f21,_0x48743c){var _0x1d9bb2=function(_0x589f43){while(--_0x589f43){_0x528f21['push'](_0x528f21['shift']());}};_0x1d9bb2(++_0x48743c);}(_0x1dbe,0x116));var _0xe1db=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1dbe[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xe1db('0x0'));var emlformat=require(_0xe1db('0x1'));var rimraf=require(_0xe1db('0x2'));var zipdir=require(_0xe1db('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe1db('0x4'));var moment=require(_0xe1db('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xe1db('0x6'));var util=require('util');var path=require(_0xe1db('0x7'));var sox=require(_0xe1db('0x8'));var csv=require(_0xe1db('0x9'));var ejs=require(_0xe1db('0xa'));var fs=require('fs');var _=require(_0xe1db('0xb'));var squel=require(_0xe1db('0xc'));var crypto=require(_0xe1db('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xe1db('0xe'));var toCsv=require(_0xe1db('0x9'));var querystring=require(_0xe1db('0xf'));var Papa=require(_0xe1db('0x10'));var Redis=require('ioredis');var authService=require(_0xe1db('0x11'));var qs=require(_0xe1db('0x12'));var as=require(_0xe1db('0x13'));var hardwareService=require(_0xe1db('0x14'));var logger=require(_0xe1db('0x15'))('api');var utils=require(_0xe1db('0x16'));var config=require(_0xe1db('0x17'));var db=require(_0xe1db('0x18'))['db'];var integrations=require(_0xe1db('0x19'));var jayson=require('jayson/promise');var client=jayson[_0xe1db('0x1a')][_0xe1db('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x34973e,_0x5f5879,_0x27dd11){if(_0x27dd11){var _0xaa2d9b=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xaa2d9b[_0xe1db('0x1c')](_0x5f5879)){return _0x34973e;}else{throw new db['Sequelize'][(_0xe1db('0x1d'))](_0xe1db('0x1e'));}}else{return _0x34973e;}}function respondWithRpcPromise(_0x2c4503,_0x2ba4b9,_0x4af166,_0x4bbc4c){return new BPromise(function(_0x15745e,_0xdcec64){var _0x143ecd=_0x4bbc4c||client;return _0x143ecd['request'](_0x2c4503,_0x4af166)[_0xe1db('0x1f')](function(_0x174b00){logger[_0xe1db('0x20')](_0xe1db('0x21'),_0x2ba4b9,_0xe1db('0x22'));logger[_0xe1db('0x23')]('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0x2ba4b9,'request\x20sent',JSON[_0xe1db('0x24')](_0x174b00));if(_0x174b00[_0xe1db('0x25')]){if(_0x174b00[_0xe1db('0x25')]['code']===0x1f4){logger[_0xe1db('0x25')]('ZendeskAccount,\x20%s,\x20%s',_0x2ba4b9,_0x174b00[_0xe1db('0x25')][_0xe1db('0x26')]);return _0xdcec64(_0x174b00['error'][_0xe1db('0x26')]);}logger[_0xe1db('0x25')](_0xe1db('0x21'),_0x2ba4b9,_0x174b00['error'][_0xe1db('0x26')]);return _0x15745e(_0x174b00[_0xe1db('0x25')][_0xe1db('0x26')]);}else{logger[_0xe1db('0x20')](_0xe1db('0x21'),_0x2ba4b9,_0xe1db('0x22'));_0x15745e(_0x174b00['result'][_0xe1db('0x26')]);}})['catch'](function(_0x64ac90){logger[_0xe1db('0x25')](_0xe1db('0x21'),_0x2ba4b9,_0x64ac90);_0xdcec64(_0x64ac90);});});}function respondWithStatusCode(_0x2ff2f0,_0x2f5dfa){_0x2f5dfa=_0x2f5dfa||0xcc;return function(_0x685701){if(_0x685701){return _0x2ff2f0[_0xe1db('0x27')](_0x2f5dfa);}return _0x2ff2f0[_0xe1db('0x28')](_0x2f5dfa)[_0xe1db('0x29')]();};}function respondWithResult(_0x21fd23,_0x253db6){_0x253db6=_0x253db6||0xc8;return function(_0x3cd7d6){if(_0x3cd7d6){return _0x21fd23[_0xe1db('0x28')](_0x253db6)[_0xe1db('0x2a')](_0x3cd7d6);}};}function respondWithFilteredResult(_0x23b565,_0x2b9bf8){return function(_0x1782b8){if(_0x1782b8){var _0x4a8b67=_0x1782b8[_0xe1db('0x2b')],_0x43f926=_0x2b9bf8[_0xe1db('0x2c')],_0x79d6=_0x2b9bf8[_0xe1db('0x2c')]+_0x2b9bf8[_0xe1db('0x2d')],_0x228fba;if(_0x79d6>=_0x4a8b67){_0x79d6=_0x4a8b67;_0x228fba=0xc8;}else{_0x228fba=0xce;}_0x23b565[_0xe1db('0x28')](_0x228fba);return _0x23b565['set'](_0xe1db('0x2e'),_0x43f926+'-'+_0x79d6+'/'+_0x4a8b67)['json'](_0x1782b8);}return null;};}function patchUpdates(_0x58c3ea){return function(_0x2137c0){try{jsonpatch[_0xe1db('0x2f')](_0x2137c0,_0x58c3ea,!![]);}catch(_0x3feb2f){return BPromise[_0xe1db('0x30')](_0x3feb2f);}return _0x2137c0[_0xe1db('0x31')]();};}function saveUpdates(_0x2cf69f,_0x11dc98){return function(_0x2a668d){if(_0x2a668d){return _0x2a668d[_0xe1db('0x32')](_0x2cf69f)[_0xe1db('0x1f')](function(_0xdc611c){return _0xdc611c;});}return null;};}function removeEntity(_0x1e5ff3,_0x2b7ffe){return function(_0x13653e){if(_0x13653e){return _0x13653e['destroy']()[_0xe1db('0x1f')](function(){_0x1e5ff3['status'](0xcc)[_0xe1db('0x29')]();});}};}function handleEntityNotFound(_0x2bc04b,_0xd29bbb){return function(_0x25f147){if(!_0x25f147){_0x2bc04b[_0xe1db('0x27')](0x194);}return _0x25f147;};}function handleError(_0xe07f23,_0x2d5cb3){_0x2d5cb3=_0x2d5cb3||0x1f4;return function(_0x505072){logger['error'](_0x505072[_0xe1db('0x33')]);if(_0x505072[_0xe1db('0x34')]){delete _0x505072['name'];}_0xe07f23['status'](_0x2d5cb3)[_0xe1db('0x35')](_0x505072);};}exports[_0xe1db('0x36')]=function(_0x55c717,_0x5b43bc){var _0x5a5752={},_0x2ea280={},_0xc9d565={'count':0x0,'rows':[]};var _0x1e312d=_[_0xe1db('0x37')](db[_0xe1db('0x38')][_0xe1db('0x39')],function(_0x405ca1){return{'name':_0x405ca1[_0xe1db('0x3a')],'type':_0x405ca1['type']['key']};});_0x2ea280['model']=_['map'](_0x1e312d,_0xe1db('0x34'));_0x2ea280[_0xe1db('0x3b')]=_[_0xe1db('0x3c')](_0x55c717[_0xe1db('0x3b')]);_0x2ea280[_0xe1db('0x3d')]=_[_0xe1db('0x3e')](_0x2ea280[_0xe1db('0x3f')],_0x2ea280[_0xe1db('0x3b')]);_0x5a5752['attributes']=_[_0xe1db('0x3e')](_0x2ea280[_0xe1db('0x3f')],qs['fields'](_0x55c717[_0xe1db('0x3b')][_0xe1db('0x40')]));_0x5a5752[_0xe1db('0x41')]=_0x5a5752[_0xe1db('0x41')][_0xe1db('0x42')]?_0x5a5752[_0xe1db('0x41')]:_0x2ea280[_0xe1db('0x3f')];if(!_0x55c717[_0xe1db('0x3b')][_0xe1db('0x43')](_0xe1db('0x44'))){_0x5a5752[_0xe1db('0x2d')]=qs['limit'](_0x55c717['query'][_0xe1db('0x2d')]);_0x5a5752[_0xe1db('0x2c')]=qs[_0xe1db('0x2c')](_0x55c717[_0xe1db('0x3b')][_0xe1db('0x2c')]);}_0x5a5752[_0xe1db('0x45')]=qs['sort'](_0x55c717[_0xe1db('0x3b')][_0xe1db('0x46')]);_0x5a5752[_0xe1db('0x47')]=qs[_0xe1db('0x3d')](_['pick'](_0x55c717[_0xe1db('0x3b')],_0x2ea280[_0xe1db('0x3d')]),_0x1e312d);if(_0x55c717[_0xe1db('0x3b')]['filter']){_0x5a5752[_0xe1db('0x47')]=_[_0xe1db('0x48')](_0x5a5752['where'],{'$or':_[_0xe1db('0x37')](_0x1e312d,function(_0x2a117a){if(_0x2a117a[_0xe1db('0x49')]!==_0xe1db('0x4a')){var _0x3b1210={};_0x3b1210[_0x2a117a[_0xe1db('0x34')]]={'$like':'%'+_0x55c717['query']['filter']+'%'};return _0x3b1210;}})});}_0x5a5752=_[_0xe1db('0x48')]({},_0x5a5752,_0x55c717['options']);var _0x413254={'where':_0x5a5752[_0xe1db('0x47')]};return db[_0xe1db('0x38')][_0xe1db('0x2b')](_0x413254)[_0xe1db('0x1f')](function(_0x55b69a){_0xc9d565[_0xe1db('0x2b')]=_0x55b69a;if(_0x55c717['query']['includeAll']){_0x5a5752[_0xe1db('0x4b')]=[{'all':!![]}];}return db[_0xe1db('0x38')]['findAll'](_0x5a5752);})[_0xe1db('0x1f')](function(_0x30b631){_0xc9d565['rows']=_0x30b631;return _0xc9d565;})['then'](respondWithFilteredResult(_0x5b43bc,_0x5a5752))[_0xe1db('0x4c')](handleError(_0x5b43bc,null));};exports['show']=function(_0x19571b,_0x54ef0d){var _0xbb7b88={'raw':![],'where':{'id':_0x19571b[_0xe1db('0x4d')]['id']}},_0x194202={};_0x194202[_0xe1db('0x3f')]=_[_0xe1db('0x3c')](db[_0xe1db('0x38')][_0xe1db('0x39')]);_0x194202[_0xe1db('0x3b')]=_['keys'](_0x19571b[_0xe1db('0x3b')]);_0x194202[_0xe1db('0x3d')]=_['intersection'](_0x194202[_0xe1db('0x3f')],_0x194202[_0xe1db('0x3b')]);_0xbb7b88[_0xe1db('0x41')]=_[_0xe1db('0x3e')](_0x194202[_0xe1db('0x3f')],qs[_0xe1db('0x40')](_0x19571b[_0xe1db('0x3b')][_0xe1db('0x40')]));_0xbb7b88[_0xe1db('0x41')]=_0xbb7b88[_0xe1db('0x41')][_0xe1db('0x42')]?_0xbb7b88[_0xe1db('0x41')]:_0x194202[_0xe1db('0x3f')];if(_0x19571b['query'][_0xe1db('0x4e')]){_0xbb7b88[_0xe1db('0x4b')]=[{'all':!![]}];}_0xbb7b88=_[_0xe1db('0x48')]({},_0xbb7b88,_0x19571b[_0xe1db('0x4f')]);return db[_0xe1db('0x38')][_0xe1db('0x50')](_0xbb7b88)[_0xe1db('0x1f')](handleEntityNotFound(_0x54ef0d,null))[_0xe1db('0x1f')](respondWithResult(_0x54ef0d,null))[_0xe1db('0x4c')](handleError(_0x54ef0d,null));};exports[_0xe1db('0x51')]=function(_0x35124e,_0x2c92b5){return db[_0xe1db('0x38')][_0xe1db('0x51')](_0x35124e['body'],{})[_0xe1db('0x1f')](respondWithResult(_0x2c92b5,0xc9))[_0xe1db('0x4c')](handleError(_0x2c92b5,null));};exports[_0xe1db('0x32')]=function(_0x39763b,_0xb3fe21){if(_0x39763b['body']['id']){delete _0x39763b[_0xe1db('0x52')]['id'];}return db[_0xe1db('0x38')][_0xe1db('0x50')]({'where':{'id':_0x39763b[_0xe1db('0x4d')]['id']}})[_0xe1db('0x1f')](handleEntityNotFound(_0xb3fe21,null))['then'](saveUpdates(_0x39763b[_0xe1db('0x52')],null))[_0xe1db('0x1f')](respondWithResult(_0xb3fe21,null))[_0xe1db('0x4c')](handleError(_0xb3fe21,null));};exports[_0xe1db('0x53')]=function(_0xf4815c,_0x53638e){return db[_0xe1db('0x38')][_0xe1db('0x50')]({'where':{'id':_0xf4815c['params']['id']}})['then'](handleEntityNotFound(_0x53638e,null))[_0xe1db('0x1f')](removeEntity(_0x53638e,null))[_0xe1db('0x4c')](handleError(_0x53638e,null));};exports[_0xe1db('0x54')]=function(_0x41ab82,_0x1d61d2,_0x515d1a){var _0x31aa76={};var _0x5d64ce={};var _0x5b062b;var _0x4bac00;return db[_0xe1db('0x38')]['findOne']({'where':{'id':_0x41ab82[_0xe1db('0x4d')]['id']}})[_0xe1db('0x1f')](handleEntityNotFound(_0x1d61d2,null))[_0xe1db('0x1f')](function(_0x365e80){if(_0x365e80){_0x5b062b=_0x365e80;_0x5d64ce[_0xe1db('0x3f')]=_[_0xe1db('0x3c')](db[_0xe1db('0x55')][_0xe1db('0x39')]);_0x5d64ce['query']=_[_0xe1db('0x3c')](_0x41ab82['query']);_0x5d64ce[_0xe1db('0x3d')]=_[_0xe1db('0x3e')](_0x5d64ce[_0xe1db('0x3f')],_0x5d64ce[_0xe1db('0x3b')]);_0x31aa76[_0xe1db('0x41')]=_[_0xe1db('0x3e')](_0x5d64ce[_0xe1db('0x3f')],qs[_0xe1db('0x40')](_0x41ab82[_0xe1db('0x3b')][_0xe1db('0x40')]));_0x31aa76[_0xe1db('0x41')]=_0x31aa76[_0xe1db('0x41')][_0xe1db('0x42')]?_0x31aa76[_0xe1db('0x41')]:_0x5d64ce[_0xe1db('0x3f')];_0x31aa76[_0xe1db('0x45')]=qs['sort'](_0x41ab82[_0xe1db('0x3b')]['sort']);_0x31aa76['where']=qs['filters'](_[_0xe1db('0x56')](_0x41ab82['query'],_0x5d64ce[_0xe1db('0x3d')]));if(_0x41ab82['query']['filter']){_0x31aa76[_0xe1db('0x47')]=_[_0xe1db('0x48')](_0x31aa76[_0xe1db('0x47')],{'$or':_['map'](_0x31aa76[_0xe1db('0x41')],function(_0xdf5d0d){var _0x22a849={};_0x22a849[_0xdf5d0d]={'$like':'%'+_0x41ab82[_0xe1db('0x3b')][_0xe1db('0x57')]+'%'};return _0x22a849;})});}_0x31aa76=_[_0xe1db('0x48')]({},_0x31aa76,_0x41ab82['options']);return _0x5b062b['getConfigurations'](_0x31aa76);}})['then'](function(_0x3dd82b){if(_0x3dd82b){_0x4bac00=_0x3dd82b[_0xe1db('0x42')];if(!_0x41ab82[_0xe1db('0x3b')][_0xe1db('0x43')](_0xe1db('0x44'))){_0x31aa76[_0xe1db('0x2d')]=qs[_0xe1db('0x2d')](_0x41ab82[_0xe1db('0x3b')][_0xe1db('0x2d')]);_0x31aa76['offset']=qs[_0xe1db('0x2c')](_0x41ab82['query'][_0xe1db('0x2c')]);}return _0x5b062b[_0xe1db('0x54')](_0x31aa76);}})[_0xe1db('0x1f')](function(_0x28a17c){if(_0x28a17c){return _0x28a17c?{'count':_0x4bac00,'rows':_0x28a17c}:null;}})[_0xe1db('0x1f')](respondWithResult(_0x1d61d2,null))[_0xe1db('0x4c')](handleError(_0x1d61d2,null));};exports[_0xe1db('0x58')]=function(_0x552f96,_0x35d216,_0x1f6a98){if(_0x552f96['body']['id']){delete _0x552f96[_0xe1db('0x52')]['id'];}return db[_0xe1db('0x38')]['findOne']({'where':{'id':_0x552f96[_0xe1db('0x4d')]['id']}})[_0xe1db('0x1f')](handleEntityNotFound(_0x35d216,null))[_0xe1db('0x1f')](function(_0x53c4f1){if(_0x53c4f1){_0x552f96['body'][_0xe1db('0x59')]=_0x53c4f1['id'];_0x552f96[_0xe1db('0x52')][_0xe1db('0x5a')]=integrations[_0xe1db('0x5b')](_0x552f96[_0xe1db('0x52')][_0xe1db('0x5c')],_0x552f96['body'][_0xe1db('0x49')]);_0x552f96[_0xe1db('0x52')][_0xe1db('0x5d')]=integrations['getDescriptions'](_0x552f96[_0xe1db('0x52')]['channel'],_0x552f96[_0xe1db('0x52')][_0xe1db('0x49')]);return db['ZendeskConfiguration'][_0xe1db('0x51')](_0x552f96[_0xe1db('0x52')],{'include':[{'model':db[_0xe1db('0x5e')],'as':_0xe1db('0x5a')},{'model':db[_0xe1db('0x5e')],'as':_0xe1db('0x5d')}]});}return null;})[_0xe1db('0x1f')](respondWithResult(_0x35d216,null))[_0xe1db('0x4c')](handleError(_0x35d216,null));};exports[_0xe1db('0x5f')]=function(_0x4b19a4,_0x46266a,_0xd3c68f){var _0x57180c='';return db[_0xe1db('0x38')][_0xe1db('0x60')]({'where':{'id':_0x4b19a4['params']['id']},'attributes':['id','username',_0xe1db('0x61'),_0xe1db('0x62'),_0xe1db('0x63'),_0xe1db('0x64')]})[_0xe1db('0x1f')](handleEntityNotFound(_0x46266a,null))[_0xe1db('0x1f')](function(_0xc76f7b){if(_0xc76f7b){_0x57180c=_0xc76f7b[_0xe1db('0x64')];var _0x5ebe44=_0x57180c['slice'](-0x1);if(_0x5ebe44==='/'){_0x57180c=_0x57180c['substring'](0x0,_0x57180c[_0xe1db('0x65')](_0x5ebe44));}var _0x48027d={'method':_0xe1db('0x66'),'uri':util[_0xe1db('0x67')]('%s/%s',_0x57180c,_0xe1db('0x68')),'json':!![]};switch(_0xc76f7b[_0xe1db('0x63')]){case _0xe1db('0x61'):_0x48027d[_0xe1db('0x69')]={'Authorization':util[_0xe1db('0x67')](_0xe1db('0x6a'),new Buffer(util[_0xe1db('0x67')](_0xe1db('0x6b'),_0xc76f7b['username'],_0xc76f7b['password']))[_0xe1db('0x6c')]('base64'))};break;case _0xe1db('0x62'):_0x48027d[_0xe1db('0x69')]={'Authorization':util[_0xe1db('0x67')]('Basic\x20%s',new Buffer(util[_0xe1db('0x67')]('%s/token:%s',_0xc76f7b['username'],_0xc76f7b['token']))[_0xe1db('0x6c')](_0xe1db('0x6d')))};break;default:throw new db[(_0xe1db('0x6e'))][(_0xe1db('0x1d'))](_0xe1db('0x6f'));}return rp(_0x48027d);}})['then'](function(_0x2d77e7){if(_0x2d77e7){var _0xbe3dc0=[_0xe1db('0x70'),'description','group',_0xe1db('0x71')];_['remove'](_0x2d77e7[_0xe1db('0x68')],function(_0x2cd2ac){return _0xbe3dc0['includes'](_0x2cd2ac['type']);});return{'count':_0x2d77e7['ticket_fields']['length'],'rows':_[_0xe1db('0x37')](_0x2d77e7[_0xe1db('0x68')],function(_0x254a45){return{'id':_0x254a45['id'],'name':_0x254a45[_0xe1db('0x72')]>0x7?_0x254a45['title']:_0x254a45[_0xe1db('0x49')],'custom':_0x254a45['position']>0x7?!![]:![],'options':_0x254a45[_0xe1db('0x73')]?_0x254a45[_0xe1db('0x73')]:_0x254a45[_0xe1db('0x74')]?_0x254a45[_0xe1db('0x74')]:[]};})};}})[_0xe1db('0x1f')](respondWithResult(_0x46266a,null))[_0xe1db('0x4c')](function(_0x4ad5a6){var _0x2036cd=_0x4b19a4[_0xe1db('0x3b')][_0xe1db('0x1c')]?0x1f4:_0x4ad5a6[_0xe1db('0x75')]||0x1f4;logger[_0xe1db('0x25')](_0xe1db('0x76'),_0xe1db('0x5f'),_0x2036cd,JSON[_0xe1db('0x24')](_0x4ad5a6));delete _0x4ad5a6['name'];if(_0x2036cd===0x191){_0x2036cd=0x190;}_0x46266a[_0xe1db('0x28')](_0x2036cd)['send'](_0x4b19a4[_0xe1db('0x3b')][_0xe1db('0x1c')]?{'message':'Wrong\x20credentials','statusCode':_0x4ad5a6[_0xe1db('0x75')]}:_0x4ad5a6);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 6057878..943f961 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 _0x341c=['../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','define','ZendeskAccount','int_zendesk_accounts','../../config/logger','path','rimraf'];(function(_0x3c4737,_0x2329ec){var _0x2bb926=function(_0x3b9605){while(--_0x3b9605){_0x3c4737['push'](_0x3c4737['shift']());}};_0x2bb926(++_0x2329ec);}(_0x341c,0x165));var _0xc341=function(_0x554b32,_0x577efd){_0x554b32=_0x554b32-0x0;var _0x2d896d=_0x341c[_0x554b32];return _0x2d896d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xc341('0x0'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xc341('0x1'));var rimraf=require(_0xc341('0x2'));var config=require(_0xc341('0x3'));var attributes=require(_0xc341('0x4'));var integrations=require(_0xc341('0x5'));module['exports']=function(_0x3944df,_0x31f0c1){return _0x3944df[_0xc341('0x6')](_0xc341('0x7'),attributes,{'tableName':_0xc341('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6a35=['moment','path','../../config/environment','../../components/integrations/configuration','exports','define','ZendeskAccount','int_zendesk_accounts','lodash','util','../../config/logger','api'];(function(_0x2e50a2,_0x27f31e){var _0x47e5de=function(_0x4e1f70){while(--_0x4e1f70){_0x2e50a2['push'](_0x2e50a2['shift']());}};_0x47e5de(++_0x27f31e);}(_0x6a35,0xd4));var _0x56a3=function(_0x725b8e,_0xc22b48){_0x725b8e=_0x725b8e-0x0;var _0x43ac45=_0x6a35[_0x725b8e];return _0x43ac45;};'use strict';var _=require(_0x56a3('0x0'));var util=require(_0x56a3('0x1'));var logger=require(_0x56a3('0x2'))(_0x56a3('0x3'));var moment=require(_0x56a3('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x56a3('0x5'));var rimraf=require('rimraf');var config=require(_0x56a3('0x6'));var attributes=require('./intZendeskAccount.attributes');var integrations=require(_0x56a3('0x7'));module[_0x56a3('0x8')]=function(_0x213d87,_0x23b205){return _0x213d87[_0x56a3('0x9')](_0x56a3('0xa'),attributes,{'tableName':_0x56a3('0xb'),'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 de09b5e..be22f05 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 _0xe706=['options','raw','where','attributes','limit','include','map','model','stringify','ShowZendeskAccount','ZendeskAccount','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../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','error','code','message','result','catch','GetZendeskAccount','findAll'];(function(_0x4379a4,_0x54e696){var _0x44ba8c=function(_0x24ae2d){while(--_0x24ae2d){_0x4379a4['push'](_0x4379a4['shift']());}};_0x44ba8c(++_0x54e696);}(_0xe706,0xa3));var _0x6e70=function(_0x5089ea,_0x3d8378){_0x5089ea=_0x5089ea-0x0;var _0xabe953=_0xe706[_0x5089ea];return _0xabe953;};'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']('ZendeskAccount,\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']('ZendeskAccount,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});}exports[_0x6e70('0x19')]=function(_0x5ea7a5){var _0x28a21f=this;return new Promise(function(_0x173afe,_0x53acdc){return db['ZendeskAccount'][_0x6e70('0x1a')]({'raw':_0x5ea7a5[_0x6e70('0x1b')]?_0x5ea7a5[_0x6e70('0x1b')][_0x6e70('0x1c')]===undefined?!![]:![]:!![],'where':_0x5ea7a5[_0x6e70('0x1b')]?_0x5ea7a5[_0x6e70('0x1b')][_0x6e70('0x1d')]||null:null,'attributes':_0x5ea7a5[_0x6e70('0x1b')]?_0x5ea7a5[_0x6e70('0x1b')][_0x6e70('0x1e')]||null:null,'limit':_0x5ea7a5['options']?_0x5ea7a5[_0x6e70('0x1b')][_0x6e70('0x1f')]||null:null,'include':_0x5ea7a5[_0x6e70('0x1b')]?_0x5ea7a5['options'][_0x6e70('0x20')]?_[_0x6e70('0x21')](_0x5ea7a5[_0x6e70('0x1b')]['include'],function(_0x10fc91){return{'model':db[_0x10fc91['model']],'as':_0x10fc91['as'],'attributes':_0x10fc91['attributes'],'include':_0x10fc91['include']?_[_0x6e70('0x21')](_0x10fc91[_0x6e70('0x20')],function(_0x51d292){return{'model':db[_0x51d292[_0x6e70('0x22')]],'as':_0x51d292['as'],'attributes':_0x51d292[_0x6e70('0x1e')],'include':_0x51d292['include']?_[_0x6e70('0x21')](_0x51d292[_0x6e70('0x20')],function(_0x2bb231){return{'model':db[_0x2bb231['model']],'as':_0x2bb231['as'],'attributes':_0x2bb231['attributes']};}):[]};}):[]};}):[]:[]})[_0x6e70('0xe')](function(_0x3af17f){logger[_0x6e70('0xf')](_0x6e70('0x19'),_0x5ea7a5);logger[_0x6e70('0x12')]('GetZendeskAccount',_0x5ea7a5,JSON[_0x6e70('0x23')](_0x3af17f));_0x173afe(_0x3af17f);})[_0x6e70('0x18')](function(_0xecf336){logger[_0x6e70('0x14')](_0x6e70('0x19'),_0xecf336[_0x6e70('0x16')],_0x5ea7a5);_0x53acdc(_0x28a21f[_0x6e70('0x14')](0x1f4,_0xecf336[_0x6e70('0x16')]));});});};exports[_0x6e70('0x24')]=function(_0x3a5d30){var _0x4b1229=this;return new Promise(function(_0x1b27d8,_0x50d60b){return db[_0x6e70('0x25')]['find']({'raw':_0x3a5d30[_0x6e70('0x1b')]?_0x3a5d30[_0x6e70('0x1b')][_0x6e70('0x1c')]===undefined?!![]:![]:!![],'where':_0x3a5d30['options']?_0x3a5d30[_0x6e70('0x1b')][_0x6e70('0x1d')]||null:null,'attributes':_0x3a5d30['options']?_0x3a5d30[_0x6e70('0x1b')][_0x6e70('0x1e')]||null:null,'include':_0x3a5d30['options']?_0x3a5d30[_0x6e70('0x1b')][_0x6e70('0x20')]?_[_0x6e70('0x21')](_0x3a5d30[_0x6e70('0x1b')][_0x6e70('0x20')],function(_0x1e3e76){return{'model':db[_0x1e3e76[_0x6e70('0x22')]],'as':_0x1e3e76['as'],'attributes':_0x1e3e76[_0x6e70('0x1e')],'include':_0x1e3e76[_0x6e70('0x20')]?_[_0x6e70('0x21')](_0x1e3e76['include'],function(_0x3b9c06){return{'model':db[_0x3b9c06['model']],'as':_0x3b9c06['as'],'attributes':_0x3b9c06[_0x6e70('0x1e')],'include':_0x3b9c06[_0x6e70('0x20')]?_[_0x6e70('0x21')](_0x3b9c06[_0x6e70('0x20')],function(_0x233a83){return{'model':db[_0x233a83[_0x6e70('0x22')]],'as':_0x233a83['as'],'attributes':_0x233a83[_0x6e70('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x6e70('0xe')](function(_0x80bebb){logger[_0x6e70('0xf')](_0x6e70('0x24'),_0x3a5d30);logger[_0x6e70('0x12')](_0x6e70('0x24'),_0x3a5d30,JSON['stringify'](_0x80bebb));_0x1b27d8(_0x80bebb);})['catch'](function(_0x5424eb){logger[_0x6e70('0x14')](_0x6e70('0x24'),_0x5424eb[_0x6e70('0x16')],_0x3a5d30);_0x50d60b(_0x4b1229[_0x6e70('0x14')](0x1f4,_0x5424eb[_0x6e70('0x16')]));});});}; \ No newline at end of file +var _0xd8b0=['raw','where','include','map','model','attributes','ShowZendeskAccount','find','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','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','options'];(function(_0x3b14ad,_0x5e4401){var _0x392677=function(_0x4c9139){while(--_0x4c9139){_0x3b14ad['push'](_0x3b14ad['shift']());}};_0x392677(++_0x5e4401);}(_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')]['findAll']({'raw':_0x5fecbd[_0x0d8b('0x18')]?_0x5fecbd[_0x0d8b('0x18')][_0x0d8b('0x19')]===undefined?!![]:![]:!![],'where':_0x5fecbd[_0x0d8b('0x18')]?_0x5fecbd[_0x0d8b('0x18')][_0x0d8b('0x1a')]||null:null,'attributes':_0x5fecbd[_0x0d8b('0x18')]?_0x5fecbd[_0x0d8b('0x18')]['attributes']||null:null,'limit':_0x5fecbd['options']?_0x5fecbd[_0x0d8b('0x18')]['limit']||null:null,'include':_0x5fecbd['options']?_0x5fecbd['options'][_0x0d8b('0x1b')]?_[_0x0d8b('0x1c')](_0x5fecbd[_0x0d8b('0x18')][_0x0d8b('0x1b')],function(_0x221071){return{'model':db[_0x221071[_0x0d8b('0x1d')]],'as':_0x221071['as'],'attributes':_0x221071[_0x0d8b('0x1e')],'include':_0x221071[_0x0d8b('0x1b')]?_[_0x0d8b('0x1c')](_0x221071['include'],function(_0xe8bbee){return{'model':db[_0xe8bbee[_0x0d8b('0x1d')]],'as':_0xe8bbee['as'],'attributes':_0xe8bbee['attributes'],'include':_0xe8bbee[_0x0d8b('0x1b')]?_['map'](_0xe8bbee[_0x0d8b('0x1b')],function(_0x234bdd){return{'model':db[_0x234bdd[_0x0d8b('0x1d')]],'as':_0x234bdd['as'],'attributes':_0x234bdd['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x28f639){logger[_0x0d8b('0xb')]('GetZendeskAccount',_0x5fecbd);logger[_0x0d8b('0xe')]('GetZendeskAccount',_0x5fecbd,JSON[_0x0d8b('0x10')](_0x28f639));_0x18dd2d(_0x28f639);})['catch'](function(_0x97050a){logger['error'](_0x0d8b('0x16'),_0x97050a['message'],_0x5fecbd);_0x264b39(_0x333674[_0x0d8b('0x11')](0x1f4,_0x97050a['message']));});});};exports[_0x0d8b('0x1f')]=function(_0x106e4c){var _0x2c058d=this;return new Promise(function(_0x56120a,_0x4c80a2){return db['ZendeskAccount'][_0x0d8b('0x20')]({'raw':_0x106e4c['options']?_0x106e4c[_0x0d8b('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x106e4c['options']?_0x106e4c[_0x0d8b('0x18')][_0x0d8b('0x1a')]||null:null,'attributes':_0x106e4c[_0x0d8b('0x18')]?_0x106e4c[_0x0d8b('0x18')][_0x0d8b('0x1e')]||null:null,'include':_0x106e4c[_0x0d8b('0x18')]?_0x106e4c[_0x0d8b('0x18')][_0x0d8b('0x1b')]?_['map'](_0x106e4c[_0x0d8b('0x18')][_0x0d8b('0x1b')],function(_0x4b3ea0){return{'model':db[_0x4b3ea0[_0x0d8b('0x1d')]],'as':_0x4b3ea0['as'],'attributes':_0x4b3ea0[_0x0d8b('0x1e')],'include':_0x4b3ea0[_0x0d8b('0x1b')]?_['map'](_0x4b3ea0[_0x0d8b('0x1b')],function(_0x2c507e){return{'model':db[_0x2c507e[_0x0d8b('0x1d')]],'as':_0x2c507e['as'],'attributes':_0x2c507e[_0x0d8b('0x1e')],'include':_0x2c507e[_0x0d8b('0x1b')]?_['map'](_0x2c507e[_0x0d8b('0x1b')],function(_0x1649fc){return{'model':db[_0x1649fc['model']],'as':_0x1649fc['as'],'attributes':_0x1649fc[_0x0d8b('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x0d8b('0xa')](function(_0x188af2){logger[_0x0d8b('0xb')](_0x0d8b('0x1f'),_0x106e4c);logger['debug']('ShowZendeskAccount',_0x106e4c,JSON[_0x0d8b('0x10')](_0x188af2));_0x56120a(_0x188af2);})['catch'](function(_0x531c55){logger[_0x0d8b('0x11')](_0x0d8b('0x1f'),_0x531c55[_0x0d8b('0x13')],_0x106e4c);_0x4c80a2(_0x2c058d[_0x0d8b('0x11')](0x1f4,_0x531c55[_0x0d8b('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index f72156b..2a4fe65 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 _0x4637=['getSubjects','/:id/descriptions','getDescriptions','getTags','post','create','/:id/tags','setTags','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','/:id','show','get','/:id/fields','/:id/subjects','isAuthenticated'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4637,0x1ac));var _0x7463=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0x4637[_0x110c3d];return _0x226d67;};'use strict';var multer=require(_0x7463('0x0'));var util=require(_0x7463('0x1'));var path=require(_0x7463('0x2'));var timeout=require(_0x7463('0x3'));var express=require(_0x7463('0x4'));var router=express[_0x7463('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x7463('0x6'));var config=require(_0x7463('0x7'));var controller=require('./intZendeskConfiguration.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x7463('0x8'),auth['isAuthenticated'](),controller[_0x7463('0x9')]);router[_0x7463('0xa')](_0x7463('0xb'),auth['isAuthenticated'](),controller['getFields']);router[_0x7463('0xa')](_0x7463('0xc'),auth[_0x7463('0xd')](),controller[_0x7463('0xe')]);router[_0x7463('0xa')](_0x7463('0xf'),auth[_0x7463('0xd')](),controller[_0x7463('0x10')]);router[_0x7463('0xa')]('/:id/tags',auth[_0x7463('0xd')](),controller[_0x7463('0x11')]);router[_0x7463('0x12')]('/',auth[_0x7463('0xd')](),controller[_0x7463('0x13')]);router['post'](_0x7463('0x14'),auth['isAuthenticated'](),controller[_0x7463('0x15')]);router[_0x7463('0x16')]('/:id',auth[_0x7463('0xd')](),controller['update']);router[_0x7463('0x17')](_0x7463('0x8'),auth[_0x7463('0xd')](),controller[_0x7463('0x18')]);module[_0x7463('0x19')]=router; \ No newline at end of file +var _0xefd6=['/:id/tags','getTags','post','create','put','/:id','update','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','isAuthenticated','index','get','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions'];(function(_0x5a17e7,_0x528c7e){var _0xb8e1f1=function(_0x2fd92c){while(--_0x2fd92c){_0x5a17e7['push'](_0x5a17e7['shift']());}};_0xb8e1f1(++_0x528c7e);}(_0xefd6,0x1ad));var _0x6efd=function(_0x366a84,_0x277083){_0x366a84=_0x366a84-0x0;var _0x190f5f=_0xefd6[_0x366a84];return _0x190f5f;};'use strict';var multer=require(_0x6efd('0x0'));var util=require(_0x6efd('0x1'));var path=require('path');var timeout=require(_0x6efd('0x2'));var express=require(_0x6efd('0x3'));var router=express[_0x6efd('0x4')]();var auth=require(_0x6efd('0x5'));var interaction=require(_0x6efd('0x6'));var config=require(_0x6efd('0x7'));var controller=require(_0x6efd('0x8'));router['get']('/',auth[_0x6efd('0x9')](),controller[_0x6efd('0xa')]);router[_0x6efd('0xb')]('/:id',auth[_0x6efd('0x9')](),controller[_0x6efd('0xc')]);router[_0x6efd('0xb')](_0x6efd('0xd'),auth[_0x6efd('0x9')](),controller[_0x6efd('0xe')]);router[_0x6efd('0xb')](_0x6efd('0xf'),auth['isAuthenticated'](),controller[_0x6efd('0x10')]);router['get'](_0x6efd('0x11'),auth['isAuthenticated'](),controller[_0x6efd('0x12')]);router[_0x6efd('0xb')](_0x6efd('0x13'),auth['isAuthenticated'](),controller[_0x6efd('0x14')]);router[_0x6efd('0x15')]('/',auth[_0x6efd('0x9')](),controller[_0x6efd('0x16')]);router[_0x6efd('0x15')](_0x6efd('0x13'),auth['isAuthenticated'](),controller['setTags']);router[_0x6efd('0x17')](_0x6efd('0x18'),auth[_0x6efd('0x9')](),controller[_0x6efd('0x19')]);router['delete']('/:id',auth[_0x6efd('0x9')](),controller[_0x6efd('0x1a')]);module[_0x6efd('0x1b')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 51f16e5..c842eed 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 _0xe9c5=['STRING','sequelize'];(function(_0x25e647,_0x55bb46){var _0x10c43a=function(_0x304bef){while(--_0x304bef){_0x25e647['push'](_0x25e647['shift']());}};_0x10c43a(++_0x55bb46);}(_0xe9c5,0x85));var _0x5e9c=function(_0x3763cb,_0x3fdc1b){_0x3763cb=_0x3763cb-0x0;var _0x13a588=_0xe9c5[_0x3763cb];return _0x13a588;};'use strict';var Sequelize=require(_0x5e9c('0x0'));module['exports']={'name':{'type':Sequelize[_0x5e9c('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x9cac=['STRING','sequelize','exports'];(function(_0x5a071c,_0x4db13f){var _0x5ad8b6=function(_0xea47a4){while(--_0xea47a4){_0x5a071c['push'](_0x5a071c['shift']());}};_0x5ad8b6(++_0x4db13f);}(_0x9cac,0x82));var _0xc9ca=function(_0x363392,_0x19410f){_0x363392=_0x363392-0x0;var _0x51087d=_0x9cac[_0x363392];return _0x51087d;};'use strict';var Sequelize=require(_0xc9ca('0x0'));module[_0xc9ca('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xc9ca('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 81cb466..a5773af 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 _0x4f02=['crypto','jsforce','desk.js','papaparse','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','limit','set','Content-Range','apply','reject','update','destroy','stack','name','send','index','map','ZendeskConfiguration','rawAttributes','type','query','keys','intersection','model','attributes','length','hasOwnProperty','nolimit','offset','order','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','rows','includeAll','find','create','body','params','getFields','findOne','ZendeskField','fields','sort','getSubjects','getDescriptions','getTags','Tag','setTags','ids','html-pdf','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel'];(function(_0x1e250b,_0x2320e3){var _0x35928d=function(_0x1adcbb){while(--_0x1adcbb){_0x1e250b['push'](_0x1e250b['shift']());}};_0x35928d(++_0x2320e3);}(_0x4f02,0x173));var _0x24f0=function(_0x165ba3,_0x312607){_0x165ba3=_0x165ba3-0x0;var _0x22f74d=_0x4f02[_0x165ba3];return _0x22f74d;};'use strict';var pdf=require(_0x24f0('0x0'));var emlformat=require(_0x24f0('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x24f0('0x2'));var jsonpatch=require(_0x24f0('0x3'));var rp=require('request-promise');var moment=require(_0x24f0('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x24f0('0x5'));var util=require(_0x24f0('0x6'));var path=require(_0x24f0('0x7'));var sox=require(_0x24f0('0x8'));var csv=require(_0x24f0('0x9'));var ejs=require(_0x24f0('0xa'));var fs=require('fs');var _=require(_0x24f0('0xb'));var squel=require(_0x24f0('0xc'));var crypto=require(_0x24f0('0xd'));var jsforce=require(_0x24f0('0xe'));var deskjs=require(_0x24f0('0xf'));var toCsv=require(_0x24f0('0x9'));var querystring=require('querystring');var Papa=require(_0x24f0('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x24f0('0x11'));var logger=require(_0x24f0('0x12'))('api');var utils=require(_0x24f0('0x13'));var config=require('../../config/environment');var db=require(_0x24f0('0x14'))['db'];var jayson=require(_0x24f0('0x15'));var client=jayson[_0x24f0('0x16')][_0x24f0('0x17')]({'port':0x232a});function checkPasswordPattern(_0x494426,_0x2b5644,_0x3560e4){if(_0x3560e4){var _0x1f6556=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1f6556[_0x24f0('0x18')](_0x2b5644)){return _0x494426;}else{throw new db[(_0x24f0('0x19'))][(_0x24f0('0x1a'))](_0x24f0('0x1b'));}}else{return _0x494426;}}function respondWithRpcPromise(_0x47eedc,_0x366422,_0x485943,_0x4c0001){return new BPromise(function(_0x2bc9f5,_0x3a0878){var _0x1fb4f9=_0x4c0001||client;return _0x1fb4f9[_0x24f0('0x1c')](_0x47eedc,_0x485943)[_0x24f0('0x1d')](function(_0x21bc54){logger[_0x24f0('0x1e')](_0x24f0('0x1f'),_0x366422,_0x24f0('0x20'));logger[_0x24f0('0x21')]('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x366422,'request\x20sent',JSON[_0x24f0('0x22')](_0x21bc54));if(_0x21bc54[_0x24f0('0x23')]){if(_0x21bc54[_0x24f0('0x23')][_0x24f0('0x24')]===0x1f4){logger[_0x24f0('0x23')](_0x24f0('0x1f'),_0x366422,_0x21bc54['error']['message']);return _0x3a0878(_0x21bc54['error'][_0x24f0('0x25')]);}logger[_0x24f0('0x23')](_0x24f0('0x1f'),_0x366422,_0x21bc54['error'][_0x24f0('0x25')]);return _0x2bc9f5(_0x21bc54[_0x24f0('0x23')]['message']);}else{logger['info'](_0x24f0('0x1f'),_0x366422,_0x24f0('0x20'));_0x2bc9f5(_0x21bc54[_0x24f0('0x26')][_0x24f0('0x25')]);}})[_0x24f0('0x27')](function(_0x4110de){logger[_0x24f0('0x23')](_0x24f0('0x1f'),_0x366422,_0x4110de);_0x3a0878(_0x4110de);});});}function respondWithStatusCode(_0x5ca0e7,_0x1282e9){_0x1282e9=_0x1282e9||0xcc;return function(_0x44261a){if(_0x44261a){return _0x5ca0e7[_0x24f0('0x28')](_0x1282e9);}return _0x5ca0e7[_0x24f0('0x29')](_0x1282e9)[_0x24f0('0x2a')]();};}function respondWithResult(_0x337f64,_0x59e740){_0x59e740=_0x59e740||0xc8;return function(_0x3a1d85){if(_0x3a1d85){return _0x337f64[_0x24f0('0x29')](_0x59e740)[_0x24f0('0x2b')](_0x3a1d85);}};}function respondWithFilteredResult(_0x43ac03,_0x15dff9){return function(_0x14b37c){if(_0x14b37c){var _0x2ab44e=_0x14b37c[_0x24f0('0x2c')],_0x45e20b=_0x15dff9['offset'],_0x2fca53=_0x15dff9['offset']+_0x15dff9[_0x24f0('0x2d')],_0x171dd3;if(_0x2fca53>=_0x2ab44e){_0x2fca53=_0x2ab44e;_0x171dd3=0xc8;}else{_0x171dd3=0xce;}_0x43ac03[_0x24f0('0x29')](_0x171dd3);return _0x43ac03[_0x24f0('0x2e')](_0x24f0('0x2f'),_0x45e20b+'-'+_0x2fca53+'/'+_0x2ab44e)['json'](_0x14b37c);}return null;};}function patchUpdates(_0x5a78e0){return function(_0x4af8a9){try{jsonpatch[_0x24f0('0x30')](_0x4af8a9,_0x5a78e0,!![]);}catch(_0x246ed4){return BPromise[_0x24f0('0x31')](_0x246ed4);}return _0x4af8a9['save']();};}function saveUpdates(_0x386fca,_0x34c72e){return function(_0x5ecd56){if(_0x5ecd56){return _0x5ecd56[_0x24f0('0x32')](_0x386fca)['then'](function(_0x5dfcfd){return _0x5dfcfd;});}return null;};}function removeEntity(_0x30dc62,_0x2f78ec){return function(_0x459ad0){if(_0x459ad0){return _0x459ad0[_0x24f0('0x33')]()[_0x24f0('0x1d')](function(){_0x30dc62[_0x24f0('0x29')](0xcc)[_0x24f0('0x2a')]();});}};}function handleEntityNotFound(_0x5d77e0,_0x3d04c5){return function(_0x295bf2){if(!_0x295bf2){_0x5d77e0[_0x24f0('0x28')](0x194);}return _0x295bf2;};}function handleError(_0x44cc32,_0x1192ac){_0x1192ac=_0x1192ac||0x1f4;return function(_0x3e18a1){logger[_0x24f0('0x23')](_0x3e18a1[_0x24f0('0x34')]);if(_0x3e18a1[_0x24f0('0x35')]){delete _0x3e18a1[_0x24f0('0x35')];}_0x44cc32[_0x24f0('0x29')](_0x1192ac)[_0x24f0('0x36')](_0x3e18a1);};}exports[_0x24f0('0x37')]=function(_0x324c23,_0x43d746){var _0x1459f5={},_0x4fbaaf={},_0x5cd3f8={'count':0x0,'rows':[]};var _0x373c48=_[_0x24f0('0x38')](db[_0x24f0('0x39')][_0x24f0('0x3a')],function(_0x46715f){return{'name':_0x46715f['fieldName'],'type':_0x46715f[_0x24f0('0x3b')]['key']};});_0x4fbaaf['model']=_[_0x24f0('0x38')](_0x373c48,_0x24f0('0x35'));_0x4fbaaf[_0x24f0('0x3c')]=_[_0x24f0('0x3d')](_0x324c23[_0x24f0('0x3c')]);_0x4fbaaf['filters']=_[_0x24f0('0x3e')](_0x4fbaaf[_0x24f0('0x3f')],_0x4fbaaf['query']);_0x1459f5[_0x24f0('0x40')]=_[_0x24f0('0x3e')](_0x4fbaaf[_0x24f0('0x3f')],qs['fields'](_0x324c23[_0x24f0('0x3c')]['fields']));_0x1459f5['attributes']=_0x1459f5[_0x24f0('0x40')][_0x24f0('0x41')]?_0x1459f5[_0x24f0('0x40')]:_0x4fbaaf[_0x24f0('0x3f')];if(!_0x324c23[_0x24f0('0x3c')][_0x24f0('0x42')](_0x24f0('0x43'))){_0x1459f5[_0x24f0('0x2d')]=qs[_0x24f0('0x2d')](_0x324c23['query']['limit']);_0x1459f5[_0x24f0('0x44')]=qs[_0x24f0('0x44')](_0x324c23[_0x24f0('0x3c')]['offset']);}_0x1459f5[_0x24f0('0x45')]=qs['sort'](_0x324c23['query']['sort']);_0x1459f5[_0x24f0('0x46')]=qs[_0x24f0('0x47')](_[_0x24f0('0x48')](_0x324c23[_0x24f0('0x3c')],_0x4fbaaf[_0x24f0('0x47')]),_0x373c48);if(_0x324c23[_0x24f0('0x3c')][_0x24f0('0x49')]){_0x1459f5[_0x24f0('0x46')]=_[_0x24f0('0x4a')](_0x1459f5['where'],{'$or':_[_0x24f0('0x38')](_0x373c48,function(_0x421e97){if(_0x421e97[_0x24f0('0x3b')]!==_0x24f0('0x4b')){var _0xe8fc68={};_0xe8fc68[_0x421e97[_0x24f0('0x35')]]={'$like':'%'+_0x324c23[_0x24f0('0x3c')][_0x24f0('0x49')]+'%'};return _0xe8fc68;}})});}_0x1459f5=_[_0x24f0('0x4a')]({},_0x1459f5,_0x324c23[_0x24f0('0x4c')]);var _0x54ee7f={'where':_0x1459f5[_0x24f0('0x46')]};return db[_0x24f0('0x39')][_0x24f0('0x2c')](_0x54ee7f)['then'](function(_0x557b15){_0x5cd3f8['count']=_0x557b15;if(_0x324c23['query']['includeAll']){_0x1459f5[_0x24f0('0x4d')]=[{'all':!![]}];}return db['ZendeskConfiguration'][_0x24f0('0x4e')](_0x1459f5);})[_0x24f0('0x1d')](function(_0x38aace){_0x5cd3f8[_0x24f0('0x4f')]=_0x38aace;return _0x5cd3f8;})[_0x24f0('0x1d')](respondWithFilteredResult(_0x43d746,_0x1459f5))[_0x24f0('0x27')](handleError(_0x43d746,null));};exports['show']=function(_0x246cd1,_0x5b5e10){var _0x21c333={'raw':![],'where':{'id':_0x246cd1['params']['id']}},_0x236265={};_0x236265[_0x24f0('0x3f')]=_[_0x24f0('0x3d')](db[_0x24f0('0x39')][_0x24f0('0x3a')]);_0x236265[_0x24f0('0x3c')]=_[_0x24f0('0x3d')](_0x246cd1[_0x24f0('0x3c')]);_0x236265['filters']=_[_0x24f0('0x3e')](_0x236265[_0x24f0('0x3f')],_0x236265[_0x24f0('0x3c')]);_0x21c333[_0x24f0('0x40')]=_[_0x24f0('0x3e')](_0x236265[_0x24f0('0x3f')],qs['fields'](_0x246cd1[_0x24f0('0x3c')]['fields']));_0x21c333[_0x24f0('0x40')]=_0x21c333[_0x24f0('0x40')][_0x24f0('0x41')]?_0x21c333[_0x24f0('0x40')]:_0x236265[_0x24f0('0x3f')];if(_0x246cd1['query'][_0x24f0('0x50')]){_0x21c333['include']=[{'all':!![]}];}_0x21c333=_[_0x24f0('0x4a')]({},_0x21c333,_0x246cd1[_0x24f0('0x4c')]);return db[_0x24f0('0x39')][_0x24f0('0x51')](_0x21c333)['then'](handleEntityNotFound(_0x5b5e10,null))[_0x24f0('0x1d')](respondWithResult(_0x5b5e10,null))[_0x24f0('0x27')](handleError(_0x5b5e10,null));};exports[_0x24f0('0x52')]=function(_0x19da8f,_0x5bc12d){return db[_0x24f0('0x39')][_0x24f0('0x52')](_0x19da8f['body'],{})[_0x24f0('0x1d')](respondWithResult(_0x5bc12d,0xc9))[_0x24f0('0x27')](handleError(_0x5bc12d,null));};exports['update']=function(_0x1bcc49,_0x3c0a87){if(_0x1bcc49[_0x24f0('0x53')]['id']){delete _0x1bcc49[_0x24f0('0x53')]['id'];}return db[_0x24f0('0x39')][_0x24f0('0x51')]({'where':{'id':_0x1bcc49[_0x24f0('0x54')]['id']}})['then'](handleEntityNotFound(_0x3c0a87,null))[_0x24f0('0x1d')](saveUpdates(_0x1bcc49[_0x24f0('0x53')],null))[_0x24f0('0x1d')](respondWithResult(_0x3c0a87,null))[_0x24f0('0x27')](handleError(_0x3c0a87,null));};exports[_0x24f0('0x33')]=function(_0x2a28d8,_0x45884c){return db[_0x24f0('0x39')][_0x24f0('0x51')]({'where':{'id':_0x2a28d8['params']['id']}})[_0x24f0('0x1d')](handleEntityNotFound(_0x45884c,null))[_0x24f0('0x1d')](removeEntity(_0x45884c,null))['catch'](handleError(_0x45884c,null));};exports[_0x24f0('0x55')]=function(_0x305501,_0x18c30a,_0x109d51){var _0x6deabe={};var _0x165901={};var _0x20a1fe;var _0x48dac4;return db['ZendeskConfiguration'][_0x24f0('0x56')]({'where':{'id':_0x305501[_0x24f0('0x54')]['id']}})[_0x24f0('0x1d')](handleEntityNotFound(_0x18c30a,null))[_0x24f0('0x1d')](function(_0x99670e){if(_0x99670e){_0x20a1fe=_0x99670e;_0x165901['model']=_['keys'](db[_0x24f0('0x57')]['rawAttributes']);_0x165901[_0x24f0('0x3c')]=_[_0x24f0('0x3d')](_0x305501[_0x24f0('0x3c')]);_0x165901['filters']=_[_0x24f0('0x3e')](_0x165901[_0x24f0('0x3f')],_0x165901[_0x24f0('0x3c')]);_0x6deabe[_0x24f0('0x40')]=_[_0x24f0('0x3e')](_0x165901[_0x24f0('0x3f')],qs['fields'](_0x305501[_0x24f0('0x3c')][_0x24f0('0x58')]));_0x6deabe['attributes']=_0x6deabe[_0x24f0('0x40')][_0x24f0('0x41')]?_0x6deabe[_0x24f0('0x40')]:_0x165901[_0x24f0('0x3f')];_0x6deabe['order']=qs['sort'](_0x305501['query'][_0x24f0('0x59')]);_0x6deabe[_0x24f0('0x46')]=qs[_0x24f0('0x47')](_[_0x24f0('0x48')](_0x305501['query'],_0x165901['filters']));if(_0x305501[_0x24f0('0x3c')][_0x24f0('0x49')]){_0x6deabe['where']=_['merge'](_0x6deabe[_0x24f0('0x46')],{'$or':_[_0x24f0('0x38')](_0x6deabe[_0x24f0('0x40')],function(_0x2e7fda){var _0x3db0c9={};_0x3db0c9[_0x2e7fda]={'$like':'%'+_0x305501[_0x24f0('0x3c')]['filter']+'%'};return _0x3db0c9;})});}_0x6deabe=_[_0x24f0('0x4a')]({},_0x6deabe,_0x305501[_0x24f0('0x4c')]);return _0x20a1fe[_0x24f0('0x55')](_0x6deabe);}})[_0x24f0('0x1d')](function(_0x29555e){if(_0x29555e){_0x48dac4=_0x29555e['length'];if(!_0x305501['query'][_0x24f0('0x42')](_0x24f0('0x43'))){_0x6deabe[_0x24f0('0x2d')]=qs[_0x24f0('0x2d')](_0x305501[_0x24f0('0x3c')][_0x24f0('0x2d')]);_0x6deabe[_0x24f0('0x44')]=qs[_0x24f0('0x44')](_0x305501[_0x24f0('0x3c')]['offset']);}return _0x20a1fe[_0x24f0('0x55')](_0x6deabe);}})[_0x24f0('0x1d')](function(_0x20ea5c){if(_0x20ea5c){return _0x20ea5c?{'count':_0x48dac4,'rows':_0x20ea5c}:null;}})['then'](respondWithResult(_0x18c30a,null))[_0x24f0('0x27')](handleError(_0x18c30a,null));};exports['getSubjects']=function(_0x1b90f5,_0x219ad0,_0x592ecb){var _0x580d96={};var _0x55c403={};var _0x21a485;var _0x396dd4;return db[_0x24f0('0x39')][_0x24f0('0x56')]({'where':{'id':_0x1b90f5[_0x24f0('0x54')]['id']}})[_0x24f0('0x1d')](handleEntityNotFound(_0x219ad0,null))[_0x24f0('0x1d')](function(_0x3fe6b0){if(_0x3fe6b0){_0x21a485=_0x3fe6b0;_0x55c403[_0x24f0('0x3f')]=_[_0x24f0('0x3d')](db[_0x24f0('0x57')][_0x24f0('0x3a')]);_0x55c403['query']=_[_0x24f0('0x3d')](_0x1b90f5[_0x24f0('0x3c')]);_0x55c403[_0x24f0('0x47')]=_[_0x24f0('0x3e')](_0x55c403[_0x24f0('0x3f')],_0x55c403[_0x24f0('0x3c')]);_0x580d96['attributes']=_[_0x24f0('0x3e')](_0x55c403['model'],qs[_0x24f0('0x58')](_0x1b90f5[_0x24f0('0x3c')]['fields']));_0x580d96[_0x24f0('0x40')]=_0x580d96[_0x24f0('0x40')][_0x24f0('0x41')]?_0x580d96[_0x24f0('0x40')]:_0x55c403[_0x24f0('0x3f')];_0x580d96['order']=qs['sort'](_0x1b90f5['query'][_0x24f0('0x59')]);_0x580d96[_0x24f0('0x46')]=qs[_0x24f0('0x47')](_['pick'](_0x1b90f5['query'],_0x55c403['filters']));if(_0x1b90f5[_0x24f0('0x3c')][_0x24f0('0x49')]){_0x580d96['where']=_['merge'](_0x580d96[_0x24f0('0x46')],{'$or':_[_0x24f0('0x38')](_0x580d96[_0x24f0('0x40')],function(_0x3cd8de){var _0x512560={};_0x512560[_0x3cd8de]={'$like':'%'+_0x1b90f5['query']['filter']+'%'};return _0x512560;})});}_0x580d96=_[_0x24f0('0x4a')]({},_0x580d96,_0x1b90f5['options']);return _0x21a485[_0x24f0('0x5a')](_0x580d96);}})[_0x24f0('0x1d')](function(_0x2ccbda){if(_0x2ccbda){_0x396dd4=_0x2ccbda[_0x24f0('0x41')];if(!_0x1b90f5[_0x24f0('0x3c')][_0x24f0('0x42')](_0x24f0('0x43'))){_0x580d96[_0x24f0('0x2d')]=qs[_0x24f0('0x2d')](_0x1b90f5['query'][_0x24f0('0x2d')]);_0x580d96[_0x24f0('0x44')]=qs[_0x24f0('0x44')](_0x1b90f5[_0x24f0('0x3c')][_0x24f0('0x44')]);}return _0x21a485[_0x24f0('0x5a')](_0x580d96);}})[_0x24f0('0x1d')](function(_0x13da1f){if(_0x13da1f){return _0x13da1f?{'count':_0x396dd4,'rows':_0x13da1f}:null;}})[_0x24f0('0x1d')](respondWithResult(_0x219ad0,null))[_0x24f0('0x27')](handleError(_0x219ad0,null));};exports[_0x24f0('0x5b')]=function(_0x58f0d2,_0x4e1025,_0x57b7c6){var _0x4e2a0a={};var _0x40f2e6={};var _0x32a304;var _0x48e228;return db[_0x24f0('0x39')]['findOne']({'where':{'id':_0x58f0d2[_0x24f0('0x54')]['id']}})[_0x24f0('0x1d')](handleEntityNotFound(_0x4e1025,null))['then'](function(_0x3d397b){if(_0x3d397b){_0x32a304=_0x3d397b;_0x40f2e6[_0x24f0('0x3f')]=_['keys'](db['ZendeskField'][_0x24f0('0x3a')]);_0x40f2e6[_0x24f0('0x3c')]=_[_0x24f0('0x3d')](_0x58f0d2[_0x24f0('0x3c')]);_0x40f2e6[_0x24f0('0x47')]=_[_0x24f0('0x3e')](_0x40f2e6[_0x24f0('0x3f')],_0x40f2e6[_0x24f0('0x3c')]);_0x4e2a0a[_0x24f0('0x40')]=_[_0x24f0('0x3e')](_0x40f2e6['model'],qs[_0x24f0('0x58')](_0x58f0d2[_0x24f0('0x3c')][_0x24f0('0x58')]));_0x4e2a0a['attributes']=_0x4e2a0a['attributes'][_0x24f0('0x41')]?_0x4e2a0a[_0x24f0('0x40')]:_0x40f2e6[_0x24f0('0x3f')];_0x4e2a0a['order']=qs['sort'](_0x58f0d2[_0x24f0('0x3c')][_0x24f0('0x59')]);_0x4e2a0a[_0x24f0('0x46')]=qs['filters'](_[_0x24f0('0x48')](_0x58f0d2[_0x24f0('0x3c')],_0x40f2e6[_0x24f0('0x47')]));if(_0x58f0d2['query'][_0x24f0('0x49')]){_0x4e2a0a[_0x24f0('0x46')]=_[_0x24f0('0x4a')](_0x4e2a0a[_0x24f0('0x46')],{'$or':_[_0x24f0('0x38')](_0x4e2a0a['attributes'],function(_0x4d82af){var _0x457034={};_0x457034[_0x4d82af]={'$like':'%'+_0x58f0d2['query'][_0x24f0('0x49')]+'%'};return _0x457034;})});}_0x4e2a0a=_[_0x24f0('0x4a')]({},_0x4e2a0a,_0x58f0d2[_0x24f0('0x4c')]);return _0x32a304[_0x24f0('0x5b')](_0x4e2a0a);}})[_0x24f0('0x1d')](function(_0x690355){if(_0x690355){_0x48e228=_0x690355[_0x24f0('0x41')];if(!_0x58f0d2[_0x24f0('0x3c')][_0x24f0('0x42')](_0x24f0('0x43'))){_0x4e2a0a[_0x24f0('0x2d')]=qs[_0x24f0('0x2d')](_0x58f0d2[_0x24f0('0x3c')][_0x24f0('0x2d')]);_0x4e2a0a[_0x24f0('0x44')]=qs[_0x24f0('0x44')](_0x58f0d2[_0x24f0('0x3c')]['offset']);}return _0x32a304[_0x24f0('0x5b')](_0x4e2a0a);}})['then'](function(_0x216333){if(_0x216333){return _0x216333?{'count':_0x48e228,'rows':_0x216333}:null;}})[_0x24f0('0x1d')](respondWithResult(_0x4e1025,null))['catch'](handleError(_0x4e1025,null));};exports[_0x24f0('0x5c')]=function(_0x91ae68,_0x4a274e,_0x218b7c){var _0x330e2f={};var _0x3f0d67={};var _0x1556f3;var _0x5247d0;return db[_0x24f0('0x39')]['findOne']({'where':{'id':_0x91ae68['params']['id']}})[_0x24f0('0x1d')](handleEntityNotFound(_0x4a274e,null))[_0x24f0('0x1d')](function(_0x3d0ca3){if(_0x3d0ca3){_0x1556f3=_0x3d0ca3;_0x3f0d67[_0x24f0('0x3f')]=_['keys'](db[_0x24f0('0x5d')][_0x24f0('0x3a')]);_0x3f0d67['query']=_[_0x24f0('0x3d')](_0x91ae68['query']);_0x3f0d67[_0x24f0('0x47')]=_[_0x24f0('0x3e')](_0x3f0d67[_0x24f0('0x3f')],_0x3f0d67[_0x24f0('0x3c')]);_0x330e2f[_0x24f0('0x40')]=_['intersection'](_0x3f0d67[_0x24f0('0x3f')],qs[_0x24f0('0x58')](_0x91ae68[_0x24f0('0x3c')]['fields']));_0x330e2f[_0x24f0('0x40')]=_0x330e2f[_0x24f0('0x40')][_0x24f0('0x41')]?_0x330e2f[_0x24f0('0x40')]:_0x3f0d67[_0x24f0('0x3f')];_0x330e2f[_0x24f0('0x45')]=qs[_0x24f0('0x59')](_0x91ae68[_0x24f0('0x3c')][_0x24f0('0x59')]);_0x330e2f[_0x24f0('0x46')]=qs[_0x24f0('0x47')](_['pick'](_0x91ae68['query'],_0x3f0d67[_0x24f0('0x47')]));if(_0x91ae68['query']['filter']){_0x330e2f[_0x24f0('0x46')]=_[_0x24f0('0x4a')](_0x330e2f[_0x24f0('0x46')],{'$or':_[_0x24f0('0x38')](_0x330e2f[_0x24f0('0x40')],function(_0x2743a3){var _0x5481d0={};_0x5481d0[_0x2743a3]={'$like':'%'+_0x91ae68[_0x24f0('0x3c')][_0x24f0('0x49')]+'%'};return _0x5481d0;})});}_0x330e2f=_[_0x24f0('0x4a')]({},_0x330e2f,_0x91ae68[_0x24f0('0x4c')]);return _0x1556f3[_0x24f0('0x5c')](_0x330e2f);}})['then'](function(_0x39c6fa){if(_0x39c6fa){_0x5247d0=_0x39c6fa['length'];if(!_0x91ae68[_0x24f0('0x3c')][_0x24f0('0x42')](_0x24f0('0x43'))){_0x330e2f[_0x24f0('0x2d')]=qs[_0x24f0('0x2d')](_0x91ae68[_0x24f0('0x3c')][_0x24f0('0x2d')]);_0x330e2f[_0x24f0('0x44')]=qs[_0x24f0('0x44')](_0x91ae68[_0x24f0('0x3c')]['offset']);}return _0x1556f3[_0x24f0('0x5c')](_0x330e2f);}})[_0x24f0('0x1d')](function(_0x5798df){if(_0x5798df){return _0x5798df?{'count':_0x5247d0,'rows':_0x5798df}:null;}})[_0x24f0('0x1d')](respondWithResult(_0x4a274e,null))[_0x24f0('0x27')](handleError(_0x4a274e,null));};exports[_0x24f0('0x5e')]=function(_0xdc485,_0x41cd80,_0x46b169){if(_0xdc485[_0x24f0('0x53')]['id']){delete _0xdc485[_0x24f0('0x53')]['id'];}return db['ZendeskConfiguration'][_0x24f0('0x56')]({'where':{'id':_0xdc485[_0x24f0('0x54')]['id']}})[_0x24f0('0x1d')](handleEntityNotFound(_0x41cd80,null))[_0x24f0('0x1d')](function(_0x9dfda2){if(_0x9dfda2){return _0x9dfda2[_0x24f0('0x5e')](_0xdc485[_0x24f0('0x53')][_0x24f0('0x5f')]||[]);}return null;})[_0x24f0('0x1d')](respondWithResult(_0x41cd80,null))[_0x24f0('0x27')](handleError(_0x41cd80,null));}; \ No newline at end of file +var _0xe8ef=['crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','sendStatus','status','count','offset','set','json','apply','reject','save','destroy','end','stack','name','send','index','map','ZendeskConfiguration','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','length','hasOwnProperty','limit','order','sort','where','VIRTUAL','filter','merge','options','include','rows','show','params','keys','fields','find','create','update','body','getFields','findOne','ZendeskField','pick','getSubjects','getDescriptions','nolimit','getTags','setTags','ids','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel'];(function(_0x1400aa,_0x19b528){var _0x29bbe7=function(_0x6fc6c7){while(--_0x6fc6c7){_0x1400aa['push'](_0x1400aa['shift']());}};_0x29bbe7(++_0x19b528);}(_0xe8ef,0xb5));var _0xfe8e=function(_0x2c9a85,_0x3698d0){_0x2c9a85=_0x2c9a85-0x0;var _0x35bdb2=_0xe8ef[_0x2c9a85];return _0x35bdb2;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xfe8e('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xfe8e('0x1'));var rp=require(_0xfe8e('0x2'));var moment=require(_0xfe8e('0x3'));var BPromise=require(_0xfe8e('0x4'));var Mustache=require(_0xfe8e('0x5'));var util=require('util');var path=require(_0xfe8e('0x6'));var sox=require('sox');var csv=require(_0xfe8e('0x7'));var ejs=require(_0xfe8e('0x8'));var fs=require('fs');var _=require(_0xfe8e('0x9'));var squel=require(_0xfe8e('0xa'));var crypto=require(_0xfe8e('0xb'));var jsforce=require(_0xfe8e('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xfe8e('0xd'));var Papa=require(_0xfe8e('0xe'));var Redis=require(_0xfe8e('0xf'));var authService=require(_0xfe8e('0x10'));var qs=require(_0xfe8e('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfe8e('0x12'));var logger=require(_0xfe8e('0x13'))(_0xfe8e('0x14'));var utils=require(_0xfe8e('0x15'));var config=require(_0xfe8e('0x16'));var db=require('../../mysqldb')['db'];var jayson=require(_0xfe8e('0x17'));var client=jayson[_0xfe8e('0x18')][_0xfe8e('0x19')]({'port':0x232a});function checkPasswordPattern(_0x5d92d8,_0x31f442,_0x1bcd8e){if(_0x1bcd8e){var _0x38bdfb=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x38bdfb[_0xfe8e('0x1a')](_0x31f442)){return _0x5d92d8;}else{throw new db[(_0xfe8e('0x1b'))][(_0xfe8e('0x1c'))](_0xfe8e('0x1d'));}}else{return _0x5d92d8;}}function respondWithRpcPromise(_0x2965a5,_0x23b96e,_0x4e10d6,_0x1e1cdc){return new BPromise(function(_0x9aaa46,_0x4cda71){var _0x1ed899=_0x1e1cdc||client;return _0x1ed899['request'](_0x2965a5,_0x4e10d6)[_0xfe8e('0x1e')](function(_0x1b9da1){logger[_0xfe8e('0x1f')](_0xfe8e('0x20'),_0x23b96e,_0xfe8e('0x21'));logger[_0xfe8e('0x22')](_0xfe8e('0x23'),_0x23b96e,_0xfe8e('0x21'),JSON[_0xfe8e('0x24')](_0x1b9da1));if(_0x1b9da1[_0xfe8e('0x25')]){if(_0x1b9da1[_0xfe8e('0x25')]['code']===0x1f4){logger[_0xfe8e('0x25')](_0xfe8e('0x20'),_0x23b96e,_0x1b9da1['error']['message']);return _0x4cda71(_0x1b9da1['error'][_0xfe8e('0x26')]);}logger[_0xfe8e('0x25')]('ZendeskConfiguration,\x20%s,\x20%s',_0x23b96e,_0x1b9da1[_0xfe8e('0x25')]['message']);return _0x9aaa46(_0x1b9da1['error'][_0xfe8e('0x26')]);}else{logger[_0xfe8e('0x1f')]('ZendeskConfiguration,\x20%s,\x20%s',_0x23b96e,'request\x20sent');_0x9aaa46(_0x1b9da1['result'][_0xfe8e('0x26')]);}})[_0xfe8e('0x27')](function(_0x5107c3){logger['error'](_0xfe8e('0x20'),_0x23b96e,_0x5107c3);_0x4cda71(_0x5107c3);});});}function respondWithStatusCode(_0x550550,_0xa76db6){_0xa76db6=_0xa76db6||0xcc;return function(_0x4d01e6){if(_0x4d01e6){return _0x550550[_0xfe8e('0x28')](_0xa76db6);}return _0x550550['status'](_0xa76db6)['end']();};}function respondWithResult(_0x467f6e,_0xbbb48){_0xbbb48=_0xbbb48||0xc8;return function(_0x249fcc){if(_0x249fcc){return _0x467f6e[_0xfe8e('0x29')](_0xbbb48)['json'](_0x249fcc);}};}function respondWithFilteredResult(_0x44ef57,_0x5c0272){return function(_0x4bea74){if(_0x4bea74){var _0x4b2cc5=_0x4bea74[_0xfe8e('0x2a')],_0x51d3eb=_0x5c0272[_0xfe8e('0x2b')],_0x5ca09c=_0x5c0272[_0xfe8e('0x2b')]+_0x5c0272['limit'],_0x51e136;if(_0x5ca09c>=_0x4b2cc5){_0x5ca09c=_0x4b2cc5;_0x51e136=0xc8;}else{_0x51e136=0xce;}_0x44ef57[_0xfe8e('0x29')](_0x51e136);return _0x44ef57[_0xfe8e('0x2c')]('Content-Range',_0x51d3eb+'-'+_0x5ca09c+'/'+_0x4b2cc5)[_0xfe8e('0x2d')](_0x4bea74);}return null;};}function patchUpdates(_0x3d9152){return function(_0x215a88){try{jsonpatch[_0xfe8e('0x2e')](_0x215a88,_0x3d9152,!![]);}catch(_0x4565dd){return BPromise[_0xfe8e('0x2f')](_0x4565dd);}return _0x215a88[_0xfe8e('0x30')]();};}function saveUpdates(_0x3f7027,_0x462dae){return function(_0x383389){if(_0x383389){return _0x383389['update'](_0x3f7027)[_0xfe8e('0x1e')](function(_0x3d8c49){return _0x3d8c49;});}return null;};}function removeEntity(_0x56c7a8,_0x594cb8){return function(_0x1bb323){if(_0x1bb323){return _0x1bb323[_0xfe8e('0x31')]()[_0xfe8e('0x1e')](function(){_0x56c7a8['status'](0xcc)[_0xfe8e('0x32')]();});}};}function handleEntityNotFound(_0x53323d,_0x4cb1e1){return function(_0x2c566a){if(!_0x2c566a){_0x53323d[_0xfe8e('0x28')](0x194);}return _0x2c566a;};}function handleError(_0x3e2da3,_0x36092f){_0x36092f=_0x36092f||0x1f4;return function(_0x408f6d){logger[_0xfe8e('0x25')](_0x408f6d[_0xfe8e('0x33')]);if(_0x408f6d[_0xfe8e('0x34')]){delete _0x408f6d[_0xfe8e('0x34')];}_0x3e2da3[_0xfe8e('0x29')](_0x36092f)[_0xfe8e('0x35')](_0x408f6d);};}exports[_0xfe8e('0x36')]=function(_0x372262,_0x242e8c){var _0x576aba={},_0x427fa3={},_0x20622e={'count':0x0,'rows':[]};var _0x5ae651=_[_0xfe8e('0x37')](db[_0xfe8e('0x38')][_0xfe8e('0x39')],function(_0x1ebf35){return{'name':_0x1ebf35[_0xfe8e('0x3a')],'type':_0x1ebf35[_0xfe8e('0x3b')][_0xfe8e('0x3c')]};});_0x427fa3[_0xfe8e('0x3d')]=_[_0xfe8e('0x37')](_0x5ae651,_0xfe8e('0x34'));_0x427fa3[_0xfe8e('0x3e')]=_['keys'](_0x372262['query']);_0x427fa3[_0xfe8e('0x3f')]=_['intersection'](_0x427fa3[_0xfe8e('0x3d')],_0x427fa3[_0xfe8e('0x3e')]);_0x576aba[_0xfe8e('0x40')]=_[_0xfe8e('0x41')](_0x427fa3[_0xfe8e('0x3d')],qs['fields'](_0x372262[_0xfe8e('0x3e')]['fields']));_0x576aba[_0xfe8e('0x40')]=_0x576aba[_0xfe8e('0x40')][_0xfe8e('0x42')]?_0x576aba[_0xfe8e('0x40')]:_0x427fa3[_0xfe8e('0x3d')];if(!_0x372262[_0xfe8e('0x3e')][_0xfe8e('0x43')]('nolimit')){_0x576aba[_0xfe8e('0x44')]=qs[_0xfe8e('0x44')](_0x372262[_0xfe8e('0x3e')][_0xfe8e('0x44')]);_0x576aba[_0xfe8e('0x2b')]=qs[_0xfe8e('0x2b')](_0x372262[_0xfe8e('0x3e')][_0xfe8e('0x2b')]);}_0x576aba[_0xfe8e('0x45')]=qs['sort'](_0x372262[_0xfe8e('0x3e')][_0xfe8e('0x46')]);_0x576aba['where']=qs[_0xfe8e('0x3f')](_['pick'](_0x372262[_0xfe8e('0x3e')],_0x427fa3[_0xfe8e('0x3f')]),_0x5ae651);if(_0x372262['query']['filter']){_0x576aba[_0xfe8e('0x47')]=_['merge'](_0x576aba[_0xfe8e('0x47')],{'$or':_[_0xfe8e('0x37')](_0x5ae651,function(_0x37ecda){if(_0x37ecda[_0xfe8e('0x3b')]!==_0xfe8e('0x48')){var _0x376ba1={};_0x376ba1[_0x37ecda['name']]={'$like':'%'+_0x372262['query'][_0xfe8e('0x49')]+'%'};return _0x376ba1;}})});}_0x576aba=_[_0xfe8e('0x4a')]({},_0x576aba,_0x372262[_0xfe8e('0x4b')]);var _0x3bcc90={'where':_0x576aba['where']};return db[_0xfe8e('0x38')][_0xfe8e('0x2a')](_0x3bcc90)[_0xfe8e('0x1e')](function(_0x1830a3){_0x20622e[_0xfe8e('0x2a')]=_0x1830a3;if(_0x372262[_0xfe8e('0x3e')]['includeAll']){_0x576aba[_0xfe8e('0x4c')]=[{'all':!![]}];}return db[_0xfe8e('0x38')]['findAll'](_0x576aba);})[_0xfe8e('0x1e')](function(_0xcbb7fd){_0x20622e[_0xfe8e('0x4d')]=_0xcbb7fd;return _0x20622e;})[_0xfe8e('0x1e')](respondWithFilteredResult(_0x242e8c,_0x576aba))[_0xfe8e('0x27')](handleError(_0x242e8c,null));};exports[_0xfe8e('0x4e')]=function(_0x595c5d,_0x46f323){var _0xca1257={'raw':![],'where':{'id':_0x595c5d[_0xfe8e('0x4f')]['id']}},_0x54467e={};_0x54467e['model']=_[_0xfe8e('0x50')](db['ZendeskConfiguration'][_0xfe8e('0x39')]);_0x54467e[_0xfe8e('0x3e')]=_[_0xfe8e('0x50')](_0x595c5d[_0xfe8e('0x3e')]);_0x54467e['filters']=_[_0xfe8e('0x41')](_0x54467e[_0xfe8e('0x3d')],_0x54467e[_0xfe8e('0x3e')]);_0xca1257[_0xfe8e('0x40')]=_[_0xfe8e('0x41')](_0x54467e[_0xfe8e('0x3d')],qs[_0xfe8e('0x51')](_0x595c5d[_0xfe8e('0x3e')]['fields']));_0xca1257['attributes']=_0xca1257[_0xfe8e('0x40')]['length']?_0xca1257[_0xfe8e('0x40')]:_0x54467e['model'];if(_0x595c5d[_0xfe8e('0x3e')]['includeAll']){_0xca1257['include']=[{'all':!![]}];}_0xca1257=_[_0xfe8e('0x4a')]({},_0xca1257,_0x595c5d[_0xfe8e('0x4b')]);return db['ZendeskConfiguration'][_0xfe8e('0x52')](_0xca1257)['then'](handleEntityNotFound(_0x46f323,null))[_0xfe8e('0x1e')](respondWithResult(_0x46f323,null))[_0xfe8e('0x27')](handleError(_0x46f323,null));};exports[_0xfe8e('0x53')]=function(_0x336328,_0x66522d){return db[_0xfe8e('0x38')][_0xfe8e('0x53')](_0x336328['body'],{})[_0xfe8e('0x1e')](respondWithResult(_0x66522d,0xc9))[_0xfe8e('0x27')](handleError(_0x66522d,null));};exports[_0xfe8e('0x54')]=function(_0x3e6815,_0x296c78){if(_0x3e6815[_0xfe8e('0x55')]['id']){delete _0x3e6815['body']['id'];}return db[_0xfe8e('0x38')][_0xfe8e('0x52')]({'where':{'id':_0x3e6815[_0xfe8e('0x4f')]['id']}})[_0xfe8e('0x1e')](handleEntityNotFound(_0x296c78,null))['then'](saveUpdates(_0x3e6815[_0xfe8e('0x55')],null))['then'](respondWithResult(_0x296c78,null))[_0xfe8e('0x27')](handleError(_0x296c78,null));};exports[_0xfe8e('0x31')]=function(_0x5a04c9,_0xef1216){return db[_0xfe8e('0x38')][_0xfe8e('0x52')]({'where':{'id':_0x5a04c9[_0xfe8e('0x4f')]['id']}})['then'](handleEntityNotFound(_0xef1216,null))[_0xfe8e('0x1e')](removeEntity(_0xef1216,null))['catch'](handleError(_0xef1216,null));};exports[_0xfe8e('0x56')]=function(_0x448812,_0x59a79e,_0x173d55){var _0x1eff4d={};var _0x292f60={};var _0x2af863;var _0x495f59;return db[_0xfe8e('0x38')][_0xfe8e('0x57')]({'where':{'id':_0x448812['params']['id']}})[_0xfe8e('0x1e')](handleEntityNotFound(_0x59a79e,null))[_0xfe8e('0x1e')](function(_0x2caa61){if(_0x2caa61){_0x2af863=_0x2caa61;_0x292f60[_0xfe8e('0x3d')]=_['keys'](db[_0xfe8e('0x58')][_0xfe8e('0x39')]);_0x292f60['query']=_['keys'](_0x448812['query']);_0x292f60[_0xfe8e('0x3f')]=_['intersection'](_0x292f60[_0xfe8e('0x3d')],_0x292f60[_0xfe8e('0x3e')]);_0x1eff4d['attributes']=_[_0xfe8e('0x41')](_0x292f60[_0xfe8e('0x3d')],qs[_0xfe8e('0x51')](_0x448812[_0xfe8e('0x3e')]['fields']));_0x1eff4d[_0xfe8e('0x40')]=_0x1eff4d['attributes'][_0xfe8e('0x42')]?_0x1eff4d[_0xfe8e('0x40')]:_0x292f60[_0xfe8e('0x3d')];_0x1eff4d[_0xfe8e('0x45')]=qs[_0xfe8e('0x46')](_0x448812[_0xfe8e('0x3e')][_0xfe8e('0x46')]);_0x1eff4d[_0xfe8e('0x47')]=qs['filters'](_[_0xfe8e('0x59')](_0x448812[_0xfe8e('0x3e')],_0x292f60[_0xfe8e('0x3f')]));if(_0x448812[_0xfe8e('0x3e')][_0xfe8e('0x49')]){_0x1eff4d['where']=_[_0xfe8e('0x4a')](_0x1eff4d['where'],{'$or':_[_0xfe8e('0x37')](_0x1eff4d[_0xfe8e('0x40')],function(_0x4a1ac5){var _0x142f70={};_0x142f70[_0x4a1ac5]={'$like':'%'+_0x448812[_0xfe8e('0x3e')]['filter']+'%'};return _0x142f70;})});}_0x1eff4d=_[_0xfe8e('0x4a')]({},_0x1eff4d,_0x448812[_0xfe8e('0x4b')]);return _0x2af863[_0xfe8e('0x56')](_0x1eff4d);}})[_0xfe8e('0x1e')](function(_0x57cf1d){if(_0x57cf1d){_0x495f59=_0x57cf1d[_0xfe8e('0x42')];if(!_0x448812[_0xfe8e('0x3e')]['hasOwnProperty']('nolimit')){_0x1eff4d[_0xfe8e('0x44')]=qs[_0xfe8e('0x44')](_0x448812[_0xfe8e('0x3e')][_0xfe8e('0x44')]);_0x1eff4d[_0xfe8e('0x2b')]=qs['offset'](_0x448812[_0xfe8e('0x3e')]['offset']);}return _0x2af863[_0xfe8e('0x56')](_0x1eff4d);}})['then'](function(_0x364325){if(_0x364325){return _0x364325?{'count':_0x495f59,'rows':_0x364325}:null;}})[_0xfe8e('0x1e')](respondWithResult(_0x59a79e,null))[_0xfe8e('0x27')](handleError(_0x59a79e,null));};exports[_0xfe8e('0x5a')]=function(_0x428968,_0x445985,_0x3aa379){var _0x8329d2={};var _0x4c3478={};var _0x3ad168;var _0x220751;return db[_0xfe8e('0x38')][_0xfe8e('0x57')]({'where':{'id':_0x428968[_0xfe8e('0x4f')]['id']}})[_0xfe8e('0x1e')](handleEntityNotFound(_0x445985,null))['then'](function(_0x581e85){if(_0x581e85){_0x3ad168=_0x581e85;_0x4c3478['model']=_[_0xfe8e('0x50')](db[_0xfe8e('0x58')]['rawAttributes']);_0x4c3478[_0xfe8e('0x3e')]=_[_0xfe8e('0x50')](_0x428968[_0xfe8e('0x3e')]);_0x4c3478[_0xfe8e('0x3f')]=_[_0xfe8e('0x41')](_0x4c3478[_0xfe8e('0x3d')],_0x4c3478[_0xfe8e('0x3e')]);_0x8329d2[_0xfe8e('0x40')]=_[_0xfe8e('0x41')](_0x4c3478[_0xfe8e('0x3d')],qs['fields'](_0x428968[_0xfe8e('0x3e')][_0xfe8e('0x51')]));_0x8329d2[_0xfe8e('0x40')]=_0x8329d2[_0xfe8e('0x40')][_0xfe8e('0x42')]?_0x8329d2['attributes']:_0x4c3478[_0xfe8e('0x3d')];_0x8329d2[_0xfe8e('0x45')]=qs[_0xfe8e('0x46')](_0x428968['query'][_0xfe8e('0x46')]);_0x8329d2[_0xfe8e('0x47')]=qs[_0xfe8e('0x3f')](_[_0xfe8e('0x59')](_0x428968['query'],_0x4c3478['filters']));if(_0x428968[_0xfe8e('0x3e')][_0xfe8e('0x49')]){_0x8329d2[_0xfe8e('0x47')]=_[_0xfe8e('0x4a')](_0x8329d2[_0xfe8e('0x47')],{'$or':_[_0xfe8e('0x37')](_0x8329d2['attributes'],function(_0x54ba78){var _0x358f98={};_0x358f98[_0x54ba78]={'$like':'%'+_0x428968[_0xfe8e('0x3e')][_0xfe8e('0x49')]+'%'};return _0x358f98;})});}_0x8329d2=_[_0xfe8e('0x4a')]({},_0x8329d2,_0x428968[_0xfe8e('0x4b')]);return _0x3ad168[_0xfe8e('0x5a')](_0x8329d2);}})[_0xfe8e('0x1e')](function(_0x431da8){if(_0x431da8){_0x220751=_0x431da8[_0xfe8e('0x42')];if(!_0x428968[_0xfe8e('0x3e')][_0xfe8e('0x43')]('nolimit')){_0x8329d2[_0xfe8e('0x44')]=qs[_0xfe8e('0x44')](_0x428968[_0xfe8e('0x3e')][_0xfe8e('0x44')]);_0x8329d2[_0xfe8e('0x2b')]=qs['offset'](_0x428968[_0xfe8e('0x3e')]['offset']);}return _0x3ad168[_0xfe8e('0x5a')](_0x8329d2);}})[_0xfe8e('0x1e')](function(_0x4cdac0){if(_0x4cdac0){return _0x4cdac0?{'count':_0x220751,'rows':_0x4cdac0}:null;}})['then'](respondWithResult(_0x445985,null))[_0xfe8e('0x27')](handleError(_0x445985,null));};exports[_0xfe8e('0x5b')]=function(_0x5d154c,_0x1ec400,_0x485949){var _0x4d7de0={};var _0x42b448={};var _0x512de0;var _0x98b483;return db[_0xfe8e('0x38')]['findOne']({'where':{'id':_0x5d154c['params']['id']}})[_0xfe8e('0x1e')](handleEntityNotFound(_0x1ec400,null))[_0xfe8e('0x1e')](function(_0x3b2cad){if(_0x3b2cad){_0x512de0=_0x3b2cad;_0x42b448[_0xfe8e('0x3d')]=_[_0xfe8e('0x50')](db[_0xfe8e('0x58')][_0xfe8e('0x39')]);_0x42b448[_0xfe8e('0x3e')]=_[_0xfe8e('0x50')](_0x5d154c['query']);_0x42b448[_0xfe8e('0x3f')]=_['intersection'](_0x42b448[_0xfe8e('0x3d')],_0x42b448[_0xfe8e('0x3e')]);_0x4d7de0[_0xfe8e('0x40')]=_['intersection'](_0x42b448['model'],qs[_0xfe8e('0x51')](_0x5d154c[_0xfe8e('0x3e')]['fields']));_0x4d7de0[_0xfe8e('0x40')]=_0x4d7de0['attributes'][_0xfe8e('0x42')]?_0x4d7de0[_0xfe8e('0x40')]:_0x42b448[_0xfe8e('0x3d')];_0x4d7de0[_0xfe8e('0x45')]=qs[_0xfe8e('0x46')](_0x5d154c[_0xfe8e('0x3e')]['sort']);_0x4d7de0[_0xfe8e('0x47')]=qs[_0xfe8e('0x3f')](_[_0xfe8e('0x59')](_0x5d154c[_0xfe8e('0x3e')],_0x42b448[_0xfe8e('0x3f')]));if(_0x5d154c[_0xfe8e('0x3e')][_0xfe8e('0x49')]){_0x4d7de0['where']=_[_0xfe8e('0x4a')](_0x4d7de0[_0xfe8e('0x47')],{'$or':_[_0xfe8e('0x37')](_0x4d7de0[_0xfe8e('0x40')],function(_0x4a9b52){var _0x3bcacd={};_0x3bcacd[_0x4a9b52]={'$like':'%'+_0x5d154c[_0xfe8e('0x3e')][_0xfe8e('0x49')]+'%'};return _0x3bcacd;})});}_0x4d7de0=_[_0xfe8e('0x4a')]({},_0x4d7de0,_0x5d154c[_0xfe8e('0x4b')]);return _0x512de0[_0xfe8e('0x5b')](_0x4d7de0);}})[_0xfe8e('0x1e')](function(_0x23efc3){if(_0x23efc3){_0x98b483=_0x23efc3[_0xfe8e('0x42')];if(!_0x5d154c[_0xfe8e('0x3e')][_0xfe8e('0x43')](_0xfe8e('0x5c'))){_0x4d7de0[_0xfe8e('0x44')]=qs[_0xfe8e('0x44')](_0x5d154c[_0xfe8e('0x3e')][_0xfe8e('0x44')]);_0x4d7de0['offset']=qs[_0xfe8e('0x2b')](_0x5d154c[_0xfe8e('0x3e')][_0xfe8e('0x2b')]);}return _0x512de0[_0xfe8e('0x5b')](_0x4d7de0);}})[_0xfe8e('0x1e')](function(_0x241db8){if(_0x241db8){return _0x241db8?{'count':_0x98b483,'rows':_0x241db8}:null;}})[_0xfe8e('0x1e')](respondWithResult(_0x1ec400,null))[_0xfe8e('0x27')](handleError(_0x1ec400,null));};exports[_0xfe8e('0x5d')]=function(_0x13e7c8,_0x43c740,_0x562243){var _0x39f2cc={};var _0x1b9074={};var _0xb9b3a8;var _0xe1b188;return db[_0xfe8e('0x38')][_0xfe8e('0x57')]({'where':{'id':_0x13e7c8[_0xfe8e('0x4f')]['id']}})['then'](handleEntityNotFound(_0x43c740,null))[_0xfe8e('0x1e')](function(_0x5d9871){if(_0x5d9871){_0xb9b3a8=_0x5d9871;_0x1b9074[_0xfe8e('0x3d')]=_['keys'](db['Tag'][_0xfe8e('0x39')]);_0x1b9074['query']=_[_0xfe8e('0x50')](_0x13e7c8[_0xfe8e('0x3e')]);_0x1b9074[_0xfe8e('0x3f')]=_[_0xfe8e('0x41')](_0x1b9074[_0xfe8e('0x3d')],_0x1b9074[_0xfe8e('0x3e')]);_0x39f2cc[_0xfe8e('0x40')]=_[_0xfe8e('0x41')](_0x1b9074[_0xfe8e('0x3d')],qs['fields'](_0x13e7c8[_0xfe8e('0x3e')][_0xfe8e('0x51')]));_0x39f2cc[_0xfe8e('0x40')]=_0x39f2cc[_0xfe8e('0x40')][_0xfe8e('0x42')]?_0x39f2cc['attributes']:_0x1b9074[_0xfe8e('0x3d')];_0x39f2cc[_0xfe8e('0x45')]=qs[_0xfe8e('0x46')](_0x13e7c8[_0xfe8e('0x3e')][_0xfe8e('0x46')]);_0x39f2cc[_0xfe8e('0x47')]=qs[_0xfe8e('0x3f')](_[_0xfe8e('0x59')](_0x13e7c8[_0xfe8e('0x3e')],_0x1b9074[_0xfe8e('0x3f')]));if(_0x13e7c8[_0xfe8e('0x3e')][_0xfe8e('0x49')]){_0x39f2cc[_0xfe8e('0x47')]=_[_0xfe8e('0x4a')](_0x39f2cc['where'],{'$or':_[_0xfe8e('0x37')](_0x39f2cc['attributes'],function(_0x7d6a6d){var _0x46bf52={};_0x46bf52[_0x7d6a6d]={'$like':'%'+_0x13e7c8[_0xfe8e('0x3e')][_0xfe8e('0x49')]+'%'};return _0x46bf52;})});}_0x39f2cc=_[_0xfe8e('0x4a')]({},_0x39f2cc,_0x13e7c8[_0xfe8e('0x4b')]);return _0xb9b3a8[_0xfe8e('0x5d')](_0x39f2cc);}})[_0xfe8e('0x1e')](function(_0xf5f80c){if(_0xf5f80c){_0xe1b188=_0xf5f80c[_0xfe8e('0x42')];if(!_0x13e7c8[_0xfe8e('0x3e')][_0xfe8e('0x43')](_0xfe8e('0x5c'))){_0x39f2cc[_0xfe8e('0x44')]=qs[_0xfe8e('0x44')](_0x13e7c8['query']['limit']);_0x39f2cc[_0xfe8e('0x2b')]=qs[_0xfe8e('0x2b')](_0x13e7c8[_0xfe8e('0x3e')][_0xfe8e('0x2b')]);}return _0xb9b3a8['getTags'](_0x39f2cc);}})[_0xfe8e('0x1e')](function(_0xbb7103){if(_0xbb7103){return _0xbb7103?{'count':_0xe1b188,'rows':_0xbb7103}:null;}})['then'](respondWithResult(_0x43c740,null))[_0xfe8e('0x27')](handleError(_0x43c740,null));};exports[_0xfe8e('0x5e')]=function(_0x1ca9b4,_0x4acba6,_0x16c09c){if(_0x1ca9b4[_0xfe8e('0x55')]['id']){delete _0x1ca9b4[_0xfe8e('0x55')]['id'];}return db[_0xfe8e('0x38')][_0xfe8e('0x57')]({'where':{'id':_0x1ca9b4[_0xfe8e('0x4f')]['id']}})[_0xfe8e('0x1e')](handleEntityNotFound(_0x4acba6,null))[_0xfe8e('0x1e')](function(_0x4c7be9){if(_0x4c7be9){return _0x4c7be9[_0xfe8e('0x5e')](_0x1ca9b4[_0xfe8e('0x55')][_0xfe8e('0x5f')]||[]);}return null;})[_0xfe8e('0x1e')](respondWithResult(_0x4acba6,null))[_0xfe8e('0x27')](handleError(_0x4acba6,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 6741a2f..283164a 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 _0x7019=['../../config/environment','./intZendeskConfiguration.attributes','exports','define','lodash','util','../../config/logger','api','request-promise','path'];(function(_0x15c421,_0x6366f7){var _0x5e5ed5=function(_0x206e66){while(--_0x206e66){_0x15c421['push'](_0x15c421['shift']());}};_0x5e5ed5(++_0x6366f7);}(_0x7019,0x194));var _0x9701=function(_0xd09418,_0x5aaa65){_0xd09418=_0xd09418-0x0;var _0x41db75=_0x7019[_0xd09418];return _0x41db75;};'use strict';var _=require(_0x9701('0x0'));var util=require(_0x9701('0x1'));var logger=require(_0x9701('0x2'))(_0x9701('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x9701('0x4'));var fs=require('fs');var path=require(_0x9701('0x5'));var rimraf=require('rimraf');var config=require(_0x9701('0x6'));var attributes=require(_0x9701('0x7'));module[_0x9701('0x8')]=function(_0x52278d,_0x22d24a){return _0x52278d[_0x9701('0x9')]('ZendeskConfiguration',attributes,{'tableName':'int_zendesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcca6=['request-promise','rimraf','./intZendeskConfiguration.attributes','define','ZendeskConfiguration','int_zendesk_configurations','../../config/logger','api','bluebird'];(function(_0x5a23e5,_0x235f58){var _0x4f4e67=function(_0x43c602){while(--_0x43c602){_0x5a23e5['push'](_0x5a23e5['shift']());}};_0x4f4e67(++_0x235f58);}(_0xcca6,0xd5));var _0x6cca=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0xcca6[_0x55e08b];return _0xd1a7ff;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6cca('0x0'))(_0x6cca('0x1'));var moment=require('moment');var BPromise=require(_0x6cca('0x2'));var rp=require(_0x6cca('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6cca('0x4'));var config=require('../../config/environment');var attributes=require(_0x6cca('0x5'));module['exports']=function(_0x4424ad,_0x2cc7a6){return _0x4424ad[_0x6cca('0x6')](_0x6cca('0x7'),attributes,{'tableName':_0x6cca('0x8'),'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 b515e12..32cbef5 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 _0xd9c7=['stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','http','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x23ca4d,_0x5c2a32){var _0x435432=function(_0xe1a5e5){while(--_0xe1a5e5){_0x23ca4d['push'](_0x23ca4d['shift']());}};_0x435432(++_0x5c2a32);}(_0xd9c7,0x103));var _0x7d9c=function(_0x2159dd,_0x2f894e){_0x2159dd=_0x2159dd-0x0;var _0x3c6274=_0xd9c7[_0x2159dd];return _0x3c6274;};'use strict';var _=require(_0x7d9c('0x0'));var util=require('util');var moment=require(_0x7d9c('0x1'));var BPromise=require(_0x7d9c('0x2'));var rs=require(_0x7d9c('0x3'));var fs=require('fs');var Redis=require(_0x7d9c('0x4'));var db=require(_0x7d9c('0x5'))['db'];var utils=require(_0x7d9c('0x6'));var logger=require('../../config/logger')(_0x7d9c('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7d9c('0x8')][_0x7d9c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x379b82,_0x315401,_0x1e197f){return new BPromise(function(_0x966142,_0x45bc8d){return client[_0x7d9c('0xa')](_0x379b82,_0x1e197f)[_0x7d9c('0xb')](function(_0x2f5fe8){logger[_0x7d9c('0xc')](_0x7d9c('0xd'),_0x315401,_0x7d9c('0xe'));logger[_0x7d9c('0xf')](_0x7d9c('0x10'),_0x315401,_0x7d9c('0xe'),JSON[_0x7d9c('0x11')](_0x2f5fe8));if(_0x2f5fe8[_0x7d9c('0x12')]){if(_0x2f5fe8[_0x7d9c('0x12')][_0x7d9c('0x13')]===0x1f4){logger[_0x7d9c('0x12')](_0x7d9c('0xd'),_0x315401,_0x2f5fe8[_0x7d9c('0x12')][_0x7d9c('0x14')]);return _0x45bc8d(_0x2f5fe8[_0x7d9c('0x12')][_0x7d9c('0x14')]);}logger[_0x7d9c('0x12')](_0x7d9c('0xd'),_0x315401,_0x2f5fe8[_0x7d9c('0x12')][_0x7d9c('0x14')]);return _0x966142(_0x2f5fe8[_0x7d9c('0x12')]['message']);}else{logger['info'](_0x7d9c('0xd'),_0x315401,_0x7d9c('0xe'));_0x966142(_0x2f5fe8[_0x7d9c('0x15')][_0x7d9c('0x14')]);}})[_0x7d9c('0x16')](function(_0x5f028f){logger[_0x7d9c('0x12')]('ZendeskConfiguration,\x20%s,\x20%s',_0x315401,_0x5f028f);_0x45bc8d(_0x5f028f);});});} \ No newline at end of file +var _0xbabd=['code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0xbabd,0x77));var _0xdbab=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbabd[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xdbab('0x0'));var util=require('util');var moment=require(_0xdbab('0x1'));var BPromise=require(_0xdbab('0x2'));var rs=require(_0xdbab('0x3'));var fs=require('fs');var Redis=require(_0xdbab('0x4'));var db=require(_0xdbab('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xdbab('0x6'));var config=require(_0xdbab('0x7'));var jayson=require(_0xdbab('0x8'));var client=jayson[_0xdbab('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x15f8a8,_0x1fe1f5,_0x3bb46c){return new BPromise(function(_0x3f11e0,_0xbd3795){return client[_0xdbab('0xa')](_0x15f8a8,_0x3bb46c)[_0xdbab('0xb')](function(_0x260230){logger[_0xdbab('0xc')](_0xdbab('0xd'),_0x1fe1f5,_0xdbab('0xe'));logger[_0xdbab('0xf')](_0xdbab('0x10'),_0x1fe1f5,_0xdbab('0xe'),JSON[_0xdbab('0x11')](_0x260230));if(_0x260230[_0xdbab('0x12')]){if(_0x260230[_0xdbab('0x12')][_0xdbab('0x13')]===0x1f4){logger[_0xdbab('0x12')](_0xdbab('0xd'),_0x1fe1f5,_0x260230[_0xdbab('0x12')][_0xdbab('0x14')]);return _0xbd3795(_0x260230[_0xdbab('0x12')][_0xdbab('0x14')]);}logger[_0xdbab('0x12')](_0xdbab('0xd'),_0x1fe1f5,_0x260230[_0xdbab('0x12')][_0xdbab('0x14')]);return _0x3f11e0(_0x260230[_0xdbab('0x12')][_0xdbab('0x14')]);}else{logger[_0xdbab('0xc')]('ZendeskConfiguration,\x20%s,\x20%s',_0x1fe1f5,_0xdbab('0xe'));_0x3f11e0(_0x260230[_0xdbab('0x15')][_0xdbab('0x14')]);}})[_0xdbab('0x16')](function(_0x2c3d52){logger['error']('ZendeskConfiguration,\x20%s,\x20%s',_0x1fe1f5,_0x2c3d52);_0xbd3795(_0x2c3d52);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 5f603ac..77770ac 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 _0x11a0=['Router','../../components/interaction/service','./intZendeskField.controller','get','isAuthenticated','index','show','post','put','/:id','update','exports','multer','path','connect-timeout'];(function(_0x22f2eb,_0xed5647){var _0xc0256d=function(_0x3c1d31){while(--_0x3c1d31){_0x22f2eb['push'](_0x22f2eb['shift']());}};_0xc0256d(++_0xed5647);}(_0x11a0,0x84));var _0x011a=function(_0x2e2e0d,_0xa2a795){_0x2e2e0d=_0x2e2e0d-0x0;var _0x1f3914=_0x11a0[_0x2e2e0d];return _0x1f3914;};'use strict';var multer=require(_0x011a('0x0'));var util=require('util');var path=require(_0x011a('0x1'));var timeout=require(_0x011a('0x2'));var express=require('express');var router=express[_0x011a('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x011a('0x4'));var config=require('../../config/environment');var controller=require(_0x011a('0x5'));router[_0x011a('0x6')]('/',auth[_0x011a('0x7')](),controller[_0x011a('0x8')]);router[_0x011a('0x6')]('/:id',auth[_0x011a('0x7')](),controller[_0x011a('0x9')]);router[_0x011a('0xa')]('/',auth[_0x011a('0x7')](),controller['create']);router[_0x011a('0xb')](_0x011a('0xc'),auth[_0x011a('0x7')](),controller[_0x011a('0xd')]);router['delete'](_0x011a('0xc'),auth[_0x011a('0x7')](),controller['destroy']);module[_0x011a('0xe')]=router; \ No newline at end of file +var _0x615a=['exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x615a,0x8d));var _0xa615=function(_0x4ae459,_0x3bf329){_0x4ae459=_0x4ae459-0x0;var _0x51d0c9=_0x615a[_0x4ae459];return _0x51d0c9;};'use strict';var multer=require('multer');var util=require(_0xa615('0x0'));var path=require(_0xa615('0x1'));var timeout=require(_0xa615('0x2'));var express=require(_0xa615('0x3'));var router=express[_0xa615('0x4')]();var auth=require(_0xa615('0x5'));var interaction=require(_0xa615('0x6'));var config=require(_0xa615('0x7'));var controller=require(_0xa615('0x8'));router[_0xa615('0x9')]('/',auth[_0xa615('0xa')](),controller['index']);router[_0xa615('0x9')](_0xa615('0xb'),auth[_0xa615('0xa')](),controller[_0xa615('0xc')]);router[_0xa615('0xd')]('/',auth[_0xa615('0xa')](),controller[_0xa615('0xe')]);router[_0xa615('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xa615('0x10')]);router[_0xa615('0x11')](_0xa615('0xb'),auth[_0xa615('0xa')](),controller[_0xa615('0x12')]);module[_0xa615('0x13')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 8d7e87b..f08b972 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 _0xe9b9=['variable','customVariable','keyValue','STRING','BOOLEAN','sequelize','exports','ENUM','string'];(function(_0x503da5,_0x36cdd8){var _0x227228=function(_0x404734){while(--_0x404734){_0x503da5['push'](_0x503da5['shift']());}};_0x227228(++_0x36cdd8);}(_0xe9b9,0xd4));var _0x9e9b=function(_0x2cac2e,_0x59d4c3){_0x2cac2e=_0x2cac2e-0x0;var _0x19ffe8=_0xe9b9[_0x2cac2e];return _0x19ffe8;};'use strict';var Sequelize=require(_0x9e9b('0x0'));module[_0x9e9b('0x1')]={'type':{'type':Sequelize[_0x9e9b('0x2')](_0x9e9b('0x3'),_0x9e9b('0x4'),_0x9e9b('0x5'),_0x9e9b('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0x9e9b('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x9e9b('0x3'),_0x9e9b('0x4'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x9e9b('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x9e9b('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9e9b('0x7')]}}; \ No newline at end of file +var _0x535f=['STRING','BOOLEAN','ENUM','string','variable','customVariable','keyValue'];(function(_0x2f7042,_0x50bcd1){var _0x240d8c=function(_0x9d5640){while(--_0x9d5640){_0x2f7042['push'](_0x2f7042['shift']());}};_0x240d8c(++_0x50bcd1);}(_0x535f,0x160));var _0xf535=function(_0x4fb8e4,_0x4446dd){_0x4fb8e4=_0x4fb8e4-0x0;var _0x177a44=_0x535f[_0x4fb8e4];return _0x177a44;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0xf535('0x0')](_0xf535('0x1'),_0xf535('0x2'),_0xf535('0x3'),_0xf535('0x4')),'defaultValue':_0xf535('0x1')},'content':{'type':Sequelize[_0xf535('0x5')]},'key':{'type':Sequelize[_0xf535('0x5')]},'keyType':{'type':Sequelize[_0xf535('0x0')]('string',_0xf535('0x2'),_0xf535('0x3'))},'keyContent':{'type':Sequelize[_0xf535('0x5')]},'idField':{'type':Sequelize[_0xf535('0x5')]},'nameField':{'type':Sequelize[_0xf535('0x5')]},'customField':{'type':Sequelize[_0xf535('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf535('0x5')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 690e75d..6a1ad5a 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 _0x51a6=['create','body','update','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','destroy','then','stack','name','send','index','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','nolimit','order','sort','filters','pick','filter','where','merge','map','VIRTUAL','options','ZendeskField','includeAll','include','findAll','rows','catch','params','keys','length','find'];(function(_0x253cdb,_0x142a36){var _0x1ae7f4=function(_0x476a82){while(--_0x476a82){_0x253cdb['push'](_0x253cdb['shift']());}};_0x1ae7f4(++_0x142a36);}(_0x51a6,0x166));var _0x651a=function(_0x17158c,_0x58cb92){_0x17158c=_0x17158c-0x0;var _0x734f31=_0x51a6[_0x17158c];return _0x734f31;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x651a('0x0'));var zipdir=require(_0x651a('0x1'));var jsonpatch=require(_0x651a('0x2'));var rp=require(_0x651a('0x3'));var moment=require(_0x651a('0x4'));var BPromise=require(_0x651a('0x5'));var Mustache=require(_0x651a('0x6'));var util=require(_0x651a('0x7'));var path=require(_0x651a('0x8'));var sox=require('sox');var csv=require(_0x651a('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x651a('0xa'));var deskjs=require(_0x651a('0xb'));var toCsv=require('to-csv');var querystring=require(_0x651a('0xc'));var Papa=require(_0x651a('0xd'));var Redis=require(_0x651a('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x651a('0xf'));var as=require(_0x651a('0x10'));var hardwareService=require(_0x651a('0x11'));var logger=require(_0x651a('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x651a('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2348a9,_0x302411){_0x302411=_0x302411||0xcc;return function(_0x2c07e0){if(_0x2c07e0){return _0x2348a9[_0x651a('0x14')](_0x302411);}return _0x2348a9[_0x651a('0x15')](_0x302411)[_0x651a('0x16')]();};}function respondWithResult(_0x1613b4,_0x279f45){_0x279f45=_0x279f45||0xc8;return function(_0x3dc0b7){if(_0x3dc0b7){return _0x1613b4[_0x651a('0x15')](_0x279f45)['json'](_0x3dc0b7);}};}function respondWithFilteredResult(_0xaf2ae,_0x13967a){return function(_0xd0bafd){if(_0xd0bafd){var _0x1f010b=_0xd0bafd[_0x651a('0x17')],_0x153d68=_0x13967a[_0x651a('0x18')],_0x40f76b=_0x13967a[_0x651a('0x18')]+_0x13967a[_0x651a('0x19')],_0x438e36;if(_0x40f76b>=_0x1f010b){_0x40f76b=_0x1f010b;_0x438e36=0xc8;}else{_0x438e36=0xce;}_0xaf2ae['status'](_0x438e36);return _0xaf2ae[_0x651a('0x1a')](_0x651a('0x1b'),_0x153d68+'-'+_0x40f76b+'/'+_0x1f010b)[_0x651a('0x1c')](_0xd0bafd);}return null;};}function patchUpdates(_0x4c7dd4){return function(_0x1970d1){try{jsonpatch[_0x651a('0x1d')](_0x1970d1,_0x4c7dd4,!![]);}catch(_0x260f6c){return BPromise[_0x651a('0x1e')](_0x260f6c);}return _0x1970d1[_0x651a('0x1f')]();};}function saveUpdates(_0x3aaea3,_0x565544){return function(_0xb02ca0){if(_0xb02ca0){return _0xb02ca0['update'](_0x3aaea3)['then'](function(_0x41d1cc){return _0x41d1cc;});}return null;};}function removeEntity(_0x5e615a,_0x12da2a){return function(_0x226b0f){if(_0x226b0f){return _0x226b0f[_0x651a('0x20')]()[_0x651a('0x21')](function(){_0x5e615a[_0x651a('0x15')](0xcc)[_0x651a('0x16')]();});}};}function handleEntityNotFound(_0x2f8602,_0x3e3b8a){return function(_0x2d3960){if(!_0x2d3960){_0x2f8602['sendStatus'](0x194);}return _0x2d3960;};}function handleError(_0xa5e8f7,_0x10d5f8){_0x10d5f8=_0x10d5f8||0x1f4;return function(_0x5de277){logger['error'](_0x5de277[_0x651a('0x22')]);if(_0x5de277[_0x651a('0x23')]){delete _0x5de277['name'];}_0xa5e8f7[_0x651a('0x15')](_0x10d5f8)[_0x651a('0x24')](_0x5de277);};}exports[_0x651a('0x25')]=function(_0x422148,_0x527c03){var _0x1d5ef9={},_0x363a89={},_0xc643f1={'count':0x0,'rows':[]};var _0x5d81df=_['map'](db['ZendeskField'][_0x651a('0x26')],function(_0x36a9ba){return{'name':_0x36a9ba[_0x651a('0x27')],'type':_0x36a9ba[_0x651a('0x28')][_0x651a('0x29')]};});_0x363a89[_0x651a('0x2a')]=_['map'](_0x5d81df,_0x651a('0x23'));_0x363a89[_0x651a('0x2b')]=_['keys'](_0x422148[_0x651a('0x2b')]);_0x363a89['filters']=_[_0x651a('0x2c')](_0x363a89[_0x651a('0x2a')],_0x363a89['query']);_0x1d5ef9[_0x651a('0x2d')]=_[_0x651a('0x2c')](_0x363a89['model'],qs[_0x651a('0x2e')](_0x422148['query']['fields']));_0x1d5ef9[_0x651a('0x2d')]=_0x1d5ef9[_0x651a('0x2d')]['length']?_0x1d5ef9['attributes']:_0x363a89[_0x651a('0x2a')];if(!_0x422148[_0x651a('0x2b')]['hasOwnProperty'](_0x651a('0x2f'))){_0x1d5ef9[_0x651a('0x19')]=qs[_0x651a('0x19')](_0x422148[_0x651a('0x2b')][_0x651a('0x19')]);_0x1d5ef9[_0x651a('0x18')]=qs[_0x651a('0x18')](_0x422148[_0x651a('0x2b')][_0x651a('0x18')]);}_0x1d5ef9[_0x651a('0x30')]=qs[_0x651a('0x31')](_0x422148[_0x651a('0x2b')][_0x651a('0x31')]);_0x1d5ef9['where']=qs[_0x651a('0x32')](_[_0x651a('0x33')](_0x422148[_0x651a('0x2b')],_0x363a89['filters']),_0x5d81df);if(_0x422148[_0x651a('0x2b')][_0x651a('0x34')]){_0x1d5ef9[_0x651a('0x35')]=_[_0x651a('0x36')](_0x1d5ef9[_0x651a('0x35')],{'$or':_[_0x651a('0x37')](_0x5d81df,function(_0x1d7d47){if(_0x1d7d47[_0x651a('0x28')]!==_0x651a('0x38')){var _0x4a422b={};_0x4a422b[_0x1d7d47[_0x651a('0x23')]]={'$like':'%'+_0x422148[_0x651a('0x2b')][_0x651a('0x34')]+'%'};return _0x4a422b;}})});}_0x1d5ef9=_[_0x651a('0x36')]({},_0x1d5ef9,_0x422148[_0x651a('0x39')]);var _0x3cf986={'where':_0x1d5ef9[_0x651a('0x35')]};return db[_0x651a('0x3a')][_0x651a('0x17')](_0x3cf986)['then'](function(_0x4f09ba){_0xc643f1[_0x651a('0x17')]=_0x4f09ba;if(_0x422148[_0x651a('0x2b')][_0x651a('0x3b')]){_0x1d5ef9[_0x651a('0x3c')]=[{'all':!![]}];}return db[_0x651a('0x3a')][_0x651a('0x3d')](_0x1d5ef9);})['then'](function(_0x57caac){_0xc643f1[_0x651a('0x3e')]=_0x57caac;return _0xc643f1;})[_0x651a('0x21')](respondWithFilteredResult(_0x527c03,_0x1d5ef9))[_0x651a('0x3f')](handleError(_0x527c03,null));};exports['show']=function(_0x34a283,_0x511a8b){var _0x57797f={'raw':!![],'where':{'id':_0x34a283[_0x651a('0x40')]['id']}},_0x420e6e={};_0x420e6e[_0x651a('0x2a')]=_[_0x651a('0x41')](db[_0x651a('0x3a')][_0x651a('0x26')]);_0x420e6e[_0x651a('0x2b')]=_[_0x651a('0x41')](_0x34a283['query']);_0x420e6e['filters']=_[_0x651a('0x2c')](_0x420e6e['model'],_0x420e6e[_0x651a('0x2b')]);_0x57797f[_0x651a('0x2d')]=_[_0x651a('0x2c')](_0x420e6e[_0x651a('0x2a')],qs[_0x651a('0x2e')](_0x34a283[_0x651a('0x2b')]['fields']));_0x57797f[_0x651a('0x2d')]=_0x57797f[_0x651a('0x2d')][_0x651a('0x42')]?_0x57797f['attributes']:_0x420e6e['model'];if(_0x34a283[_0x651a('0x2b')][_0x651a('0x3b')]){_0x57797f[_0x651a('0x3c')]=[{'all':!![]}];}_0x57797f=_[_0x651a('0x36')]({},_0x57797f,_0x34a283['options']);return db[_0x651a('0x3a')][_0x651a('0x43')](_0x57797f)['then'](handleEntityNotFound(_0x511a8b,null))[_0x651a('0x21')](respondWithResult(_0x511a8b,null))['catch'](handleError(_0x511a8b,null));};exports[_0x651a('0x44')]=function(_0x13980d,_0x8a26b4){return db[_0x651a('0x3a')][_0x651a('0x44')](_0x13980d[_0x651a('0x45')],{})['then'](respondWithResult(_0x8a26b4,0xc9))[_0x651a('0x3f')](handleError(_0x8a26b4,null));};exports[_0x651a('0x46')]=function(_0x5d0c85,_0x5cb0b0){if(_0x5d0c85['body']['id']){delete _0x5d0c85[_0x651a('0x45')]['id'];}return db['ZendeskField'][_0x651a('0x43')]({'where':{'id':_0x5d0c85[_0x651a('0x40')]['id']}})[_0x651a('0x21')](handleEntityNotFound(_0x5cb0b0,null))[_0x651a('0x21')](saveUpdates(_0x5d0c85[_0x651a('0x45')],null))[_0x651a('0x21')](respondWithResult(_0x5cb0b0,null))[_0x651a('0x3f')](handleError(_0x5cb0b0,null));};exports[_0x651a('0x20')]=function(_0x512bdd,_0xac541e){return db[_0x651a('0x3a')][_0x651a('0x43')]({'where':{'id':_0x512bdd[_0x651a('0x40')]['id']}})[_0x651a('0x21')](handleEntityNotFound(_0xac541e,null))['then'](removeEntity(_0xac541e,null))[_0x651a('0x3f')](handleError(_0xac541e,null));}; \ No newline at end of file +var _0x2f40=['rimraf','fast-json-patch','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','count','offset','limit','set','save','update','then','destroy','end','stack','send','index','map','ZendeskField','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','params','options','find','create','body','eml-format'];(function(_0x3ba4a1,_0x755d8f){var _0x2618cb=function(_0x67c061){while(--_0x67c061){_0x3ba4a1['push'](_0x3ba4a1['shift']());}};_0x2618cb(++_0x755d8f);}(_0x2f40,0x149));var _0x02f4=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0x2f40[_0x5b561d];return _0x431060;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x02f4('0x0'));var rimraf=require(_0x02f4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x02f4('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x02f4('0x3'));var util=require(_0x02f4('0x4'));var path=require(_0x02f4('0x5'));var sox=require(_0x02f4('0x6'));var csv=require(_0x02f4('0x7'));var ejs=require(_0x02f4('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x02f4('0x9'));var crypto=require(_0x02f4('0xa'));var jsforce=require(_0x02f4('0xb'));var deskjs=require(_0x02f4('0xc'));var toCsv=require('to-csv');var querystring=require(_0x02f4('0xd'));var Papa=require(_0x02f4('0xe'));var Redis=require('ioredis');var authService=require(_0x02f4('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x02f4('0x10'));var logger=require(_0x02f4('0x11'))(_0x02f4('0x12'));var utils=require(_0x02f4('0x13'));var config=require(_0x02f4('0x14'));var db=require(_0x02f4('0x15'))['db'];function respondWithStatusCode(_0xb5098,_0x5a99e2){_0x5a99e2=_0x5a99e2||0xcc;return function(_0x3fc060){if(_0x3fc060){return _0xb5098['sendStatus'](_0x5a99e2);}return _0xb5098[_0x02f4('0x16')](_0x5a99e2)['end']();};}function respondWithResult(_0xfa1ca6,_0x26d543){_0x26d543=_0x26d543||0xc8;return function(_0x4827fa){if(_0x4827fa){return _0xfa1ca6[_0x02f4('0x16')](_0x26d543)[_0x02f4('0x17')](_0x4827fa);}};}function respondWithFilteredResult(_0x1a4da9,_0x2f39b3){return function(_0x2fa324){if(_0x2fa324){var _0xc2f961=_0x2fa324[_0x02f4('0x18')],_0x185831=_0x2f39b3[_0x02f4('0x19')],_0x33cfa3=_0x2f39b3[_0x02f4('0x19')]+_0x2f39b3[_0x02f4('0x1a')],_0x4397e3;if(_0x33cfa3>=_0xc2f961){_0x33cfa3=_0xc2f961;_0x4397e3=0xc8;}else{_0x4397e3=0xce;}_0x1a4da9[_0x02f4('0x16')](_0x4397e3);return _0x1a4da9[_0x02f4('0x1b')]('Content-Range',_0x185831+'-'+_0x33cfa3+'/'+_0xc2f961)[_0x02f4('0x17')](_0x2fa324);}return null;};}function patchUpdates(_0x33bfae){return function(_0x29b0dd){try{jsonpatch['apply'](_0x29b0dd,_0x33bfae,!![]);}catch(_0x551bb2){return BPromise['reject'](_0x551bb2);}return _0x29b0dd[_0x02f4('0x1c')]();};}function saveUpdates(_0x3d9c85,_0x166f14){return function(_0x573a9e){if(_0x573a9e){return _0x573a9e[_0x02f4('0x1d')](_0x3d9c85)[_0x02f4('0x1e')](function(_0x260e42){return _0x260e42;});}return null;};}function removeEntity(_0xdbdc39,_0x1efb7a){return function(_0x22508a){if(_0x22508a){return _0x22508a[_0x02f4('0x1f')]()['then'](function(){_0xdbdc39[_0x02f4('0x16')](0xcc)[_0x02f4('0x20')]();});}};}function handleEntityNotFound(_0x21a512,_0x13b479){return function(_0xcd4013){if(!_0xcd4013){_0x21a512['sendStatus'](0x194);}return _0xcd4013;};}function handleError(_0x33a964,_0xb9fa07){_0xb9fa07=_0xb9fa07||0x1f4;return function(_0x5de864){logger['error'](_0x5de864[_0x02f4('0x21')]);if(_0x5de864['name']){delete _0x5de864['name'];}_0x33a964[_0x02f4('0x16')](_0xb9fa07)[_0x02f4('0x22')](_0x5de864);};}exports[_0x02f4('0x23')]=function(_0x368804,_0x11c9fe){var _0x129005={},_0x3e0873={},_0x207115={'count':0x0,'rows':[]};var _0x4019c0=_[_0x02f4('0x24')](db[_0x02f4('0x25')]['rawAttributes'],function(_0x3052f8){return{'name':_0x3052f8['fieldName'],'type':_0x3052f8[_0x02f4('0x26')][_0x02f4('0x27')]};});_0x3e0873[_0x02f4('0x28')]=_[_0x02f4('0x24')](_0x4019c0,'name');_0x3e0873[_0x02f4('0x29')]=_[_0x02f4('0x2a')](_0x368804[_0x02f4('0x29')]);_0x3e0873[_0x02f4('0x2b')]=_['intersection'](_0x3e0873[_0x02f4('0x28')],_0x3e0873['query']);_0x129005[_0x02f4('0x2c')]=_[_0x02f4('0x2d')](_0x3e0873[_0x02f4('0x28')],qs['fields'](_0x368804[_0x02f4('0x29')][_0x02f4('0x2e')]));_0x129005[_0x02f4('0x2c')]=_0x129005[_0x02f4('0x2c')][_0x02f4('0x2f')]?_0x129005['attributes']:_0x3e0873['model'];if(!_0x368804[_0x02f4('0x29')]['hasOwnProperty'](_0x02f4('0x30'))){_0x129005[_0x02f4('0x1a')]=qs[_0x02f4('0x1a')](_0x368804[_0x02f4('0x29')][_0x02f4('0x1a')]);_0x129005[_0x02f4('0x19')]=qs['offset'](_0x368804[_0x02f4('0x29')][_0x02f4('0x19')]);}_0x129005[_0x02f4('0x31')]=qs[_0x02f4('0x32')](_0x368804['query'][_0x02f4('0x32')]);_0x129005[_0x02f4('0x33')]=qs['filters'](_[_0x02f4('0x34')](_0x368804[_0x02f4('0x29')],_0x3e0873[_0x02f4('0x2b')]),_0x4019c0);if(_0x368804[_0x02f4('0x29')][_0x02f4('0x35')]){_0x129005[_0x02f4('0x33')]=_[_0x02f4('0x36')](_0x129005[_0x02f4('0x33')],{'$or':_[_0x02f4('0x24')](_0x4019c0,function(_0x2bf2d9){if(_0x2bf2d9[_0x02f4('0x26')]!==_0x02f4('0x37')){var _0x402052={};_0x402052[_0x2bf2d9['name']]={'$like':'%'+_0x368804[_0x02f4('0x29')]['filter']+'%'};return _0x402052;}})});}_0x129005=_[_0x02f4('0x36')]({},_0x129005,_0x368804['options']);var _0x172935={'where':_0x129005[_0x02f4('0x33')]};return db[_0x02f4('0x25')][_0x02f4('0x18')](_0x172935)[_0x02f4('0x1e')](function(_0x274dee){_0x207115[_0x02f4('0x18')]=_0x274dee;if(_0x368804[_0x02f4('0x29')][_0x02f4('0x38')]){_0x129005[_0x02f4('0x39')]=[{'all':!![]}];}return db[_0x02f4('0x25')][_0x02f4('0x3a')](_0x129005);})[_0x02f4('0x1e')](function(_0x40b01e){_0x207115[_0x02f4('0x3b')]=_0x40b01e;return _0x207115;})[_0x02f4('0x1e')](respondWithFilteredResult(_0x11c9fe,_0x129005))[_0x02f4('0x3c')](handleError(_0x11c9fe,null));};exports['show']=function(_0x32a7b4,_0x515ac1){var _0x227aa3={'raw':!![],'where':{'id':_0x32a7b4[_0x02f4('0x3d')]['id']}},_0x52880d={};_0x52880d['model']=_[_0x02f4('0x2a')](db['ZendeskField']['rawAttributes']);_0x52880d[_0x02f4('0x29')]=_[_0x02f4('0x2a')](_0x32a7b4[_0x02f4('0x29')]);_0x52880d[_0x02f4('0x2b')]=_[_0x02f4('0x2d')](_0x52880d['model'],_0x52880d['query']);_0x227aa3['attributes']=_[_0x02f4('0x2d')](_0x52880d[_0x02f4('0x28')],qs[_0x02f4('0x2e')](_0x32a7b4[_0x02f4('0x29')][_0x02f4('0x2e')]));_0x227aa3[_0x02f4('0x2c')]=_0x227aa3[_0x02f4('0x2c')][_0x02f4('0x2f')]?_0x227aa3[_0x02f4('0x2c')]:_0x52880d[_0x02f4('0x28')];if(_0x32a7b4[_0x02f4('0x29')][_0x02f4('0x38')]){_0x227aa3[_0x02f4('0x39')]=[{'all':!![]}];}_0x227aa3=_[_0x02f4('0x36')]({},_0x227aa3,_0x32a7b4[_0x02f4('0x3e')]);return db[_0x02f4('0x25')][_0x02f4('0x3f')](_0x227aa3)[_0x02f4('0x1e')](handleEntityNotFound(_0x515ac1,null))[_0x02f4('0x1e')](respondWithResult(_0x515ac1,null))['catch'](handleError(_0x515ac1,null));};exports[_0x02f4('0x40')]=function(_0x727d9,_0x253eb5){return db[_0x02f4('0x25')][_0x02f4('0x40')](_0x727d9[_0x02f4('0x41')],{})[_0x02f4('0x1e')](respondWithResult(_0x253eb5,0xc9))[_0x02f4('0x3c')](handleError(_0x253eb5,null));};exports[_0x02f4('0x1d')]=function(_0x16d293,_0x4413df){if(_0x16d293[_0x02f4('0x41')]['id']){delete _0x16d293['body']['id'];}return db[_0x02f4('0x25')]['find']({'where':{'id':_0x16d293[_0x02f4('0x3d')]['id']}})['then'](handleEntityNotFound(_0x4413df,null))[_0x02f4('0x1e')](saveUpdates(_0x16d293['body'],null))['then'](respondWithResult(_0x4413df,null))['catch'](handleError(_0x4413df,null));};exports[_0x02f4('0x1f')]=function(_0x260e62,_0x32fdb7){return db[_0x02f4('0x25')]['find']({'where':{'id':_0x260e62[_0x02f4('0x3d')]['id']}})[_0x02f4('0x1e')](handleEntityNotFound(_0x32fdb7,null))[_0x02f4('0x1e')](removeEntity(_0x32fdb7,null))[_0x02f4('0x3c')](handleError(_0x32fdb7,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 2142aba..54e9c19 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 _0x91a7=['util','../../config/logger','api','bluebird','path','./intZendeskField.attributes','exports','ZendeskField','int_zendesk_fields','idField','FieldId'];(function(_0x444ec3,_0x177e63){var _0x4f10fa=function(_0x4d45e9){while(--_0x4d45e9){_0x444ec3['push'](_0x444ec3['shift']());}};_0x4f10fa(++_0x177e63);}(_0x91a7,0xe7));var _0x791a=function(_0x17cb67,_0x5e7b03){_0x17cb67=_0x17cb67-0x0;var _0x324e8f=_0x91a7[_0x17cb67];return _0x324e8f;};'use strict';var _=require('lodash');var util=require(_0x791a('0x0'));var logger=require(_0x791a('0x1'))(_0x791a('0x2'));var moment=require('moment');var BPromise=require(_0x791a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x791a('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x791a('0x5'));module[_0x791a('0x6')]=function(_0x49a9b7,_0x361f53){return _0x49a9b7['define'](_0x791a('0x7'),attributes,{'tableName':_0x791a('0x8'),'paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':[_0x791a('0x9'),_0x791a('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xaaa2=['define','int_zendesk_fields','FieldId','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./intZendeskField.attributes','exports'];(function(_0x1247d2,_0x439ba8){var _0x1b2e59=function(_0x25908b){while(--_0x25908b){_0x1247d2['push'](_0x1247d2['shift']());}};_0x1b2e59(++_0x439ba8);}(_0xaaa2,0xac));var _0x2aaa=function(_0x3367df,_0x3ea183){_0x3367df=_0x3367df-0x0;var _0x2e547b=_0xaaa2[_0x3367df];return _0x2e547b;};'use strict';var _=require(_0x2aaa('0x0'));var util=require(_0x2aaa('0x1'));var logger=require(_0x2aaa('0x2'))(_0x2aaa('0x3'));var moment=require(_0x2aaa('0x4'));var BPromise=require(_0x2aaa('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2aaa('0x6'));var rimraf=require('rimraf');var config=require(_0x2aaa('0x7'));var attributes=require(_0x2aaa('0x8'));module[_0x2aaa('0x9')]=function(_0x25cb1d,_0x1ef101){return _0x25cb1d[_0x2aaa('0xa')]('ZendeskField',attributes,{'tableName':_0x2aaa('0xb'),'paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':['idField',_0x2aaa('0xc')],'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 7edb6bd..a16cc52 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 _0x92ab=['debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','ZendeskField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','then','info','request\x20sent'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x92ab,0xfb));var _0xb92a=function(_0x19ee96,_0x446b40){_0x19ee96=_0x19ee96-0x0;var _0x295cda=_0x92ab[_0x19ee96];return _0x295cda;};'use strict';var _=require(_0xb92a('0x0'));var util=require(_0xb92a('0x1'));var moment=require(_0xb92a('0x2'));var BPromise=require(_0xb92a('0x3'));var rs=require(_0xb92a('0x4'));var fs=require('fs');var Redis=require(_0xb92a('0x5'));var db=require(_0xb92a('0x6'))['db'];var utils=require(_0xb92a('0x7'));var logger=require(_0xb92a('0x8'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb92a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1ae81c,_0x2da1ba,_0xb441c2){return new BPromise(function(_0x275515,_0x3e8f10){return client['request'](_0x1ae81c,_0xb441c2)[_0xb92a('0xa')](function(_0x4aca1a){logger[_0xb92a('0xb')]('ZendeskField,\x20%s,\x20%s',_0x2da1ba,_0xb92a('0xc'));logger[_0xb92a('0xd')](_0xb92a('0xe'),_0x2da1ba,_0xb92a('0xc'),JSON[_0xb92a('0xf')](_0x4aca1a));if(_0x4aca1a[_0xb92a('0x10')]){if(_0x4aca1a[_0xb92a('0x10')][_0xb92a('0x11')]===0x1f4){logger[_0xb92a('0x10')](_0xb92a('0x12'),_0x2da1ba,_0x4aca1a[_0xb92a('0x10')][_0xb92a('0x13')]);return _0x3e8f10(_0x4aca1a[_0xb92a('0x10')][_0xb92a('0x13')]);}logger['error'](_0xb92a('0x12'),_0x2da1ba,_0x4aca1a[_0xb92a('0x10')][_0xb92a('0x13')]);return _0x275515(_0x4aca1a['error'][_0xb92a('0x13')]);}else{logger[_0xb92a('0xb')]('ZendeskField,\x20%s,\x20%s',_0x2da1ba,_0xb92a('0xc'));_0x275515(_0x4aca1a[_0xb92a('0x14')]['message']);}})[_0xb92a('0x15')](function(_0x37d292){logger[_0xb92a('0x10')](_0xb92a('0x12'),_0x2da1ba,_0x37d292);_0x3e8f10(_0x37d292);});});} \ No newline at end of file +var _0xe8d0=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','error','message','result','util'];(function(_0x28ea3b,_0x13d7a1){var _0x5ac766=function(_0x1ea77b){while(--_0x1ea77b){_0x28ea3b['push'](_0x28ea3b['shift']());}};_0x5ac766(++_0x13d7a1);}(_0xe8d0,0x77));var _0x0e8d=function(_0x5cdb1a,_0x5af0c2){_0x5cdb1a=_0x5cdb1a-0x0;var _0x269752=_0xe8d0[_0x5cdb1a];return _0x269752;};'use strict';var _=require('lodash');var util=require(_0x0e8d('0x0'));var moment=require(_0x0e8d('0x1'));var BPromise=require('bluebird');var rs=require(_0x0e8d('0x2'));var fs=require('fs');var Redis=require(_0x0e8d('0x3'));var db=require(_0x0e8d('0x4'))['db'];var utils=require(_0x0e8d('0x5'));var logger=require('../../config/logger')(_0x0e8d('0x6'));var config=require(_0x0e8d('0x7'));var jayson=require(_0x0e8d('0x8'));var client=jayson[_0x0e8d('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5b4707,_0x310488,_0x499891){return new BPromise(function(_0x929388,_0x17f713){return client[_0x0e8d('0xa')](_0x5b4707,_0x499891)[_0x0e8d('0xb')](function(_0x4ef2f1){logger[_0x0e8d('0xc')](_0x0e8d('0xd'),_0x310488,_0x0e8d('0xe'));logger[_0x0e8d('0xf')](_0x0e8d('0x10'),_0x310488,_0x0e8d('0xe'),JSON['stringify'](_0x4ef2f1));if(_0x4ef2f1[_0x0e8d('0x11')]){if(_0x4ef2f1[_0x0e8d('0x11')]['code']===0x1f4){logger[_0x0e8d('0x11')](_0x0e8d('0xd'),_0x310488,_0x4ef2f1['error'][_0x0e8d('0x12')]);return _0x17f713(_0x4ef2f1[_0x0e8d('0x11')][_0x0e8d('0x12')]);}logger[_0x0e8d('0x11')]('ZendeskField,\x20%s,\x20%s',_0x310488,_0x4ef2f1[_0x0e8d('0x11')][_0x0e8d('0x12')]);return _0x929388(_0x4ef2f1['error'][_0x0e8d('0x12')]);}else{logger[_0x0e8d('0xc')](_0x0e8d('0xd'),_0x310488,_0x0e8d('0xe'));_0x929388(_0x4ef2f1[_0x0e8d('0x13')][_0x0e8d('0x12')]);}})['catch'](function(_0x3df1b5){logger[_0x0e8d('0x11')](_0x0e8d('0xd'),_0x310488,_0x3df1b5);_0x17f713(_0x3df1b5);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 2e19db1..d6acb7a 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 _0xcb2a=['../../components/auth/service','../../components/interaction/service','./intZohoAccount.controller','get','index','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','update','delete','destroy','path','connect-timeout','express','Router'];(function(_0x903228,_0x42c429){var _0xcec81d=function(_0x4da97a){while(--_0x4da97a){_0x903228['push'](_0x903228['shift']());}};_0xcec81d(++_0x42c429);}(_0xcb2a,0xee));var _0xacb2=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xcb2a[_0x501510];return _0x1e6ee5;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xacb2('0x0'));var timeout=require(_0xacb2('0x1'));var express=require(_0xacb2('0x2'));var router=express[_0xacb2('0x3')]();var auth=require(_0xacb2('0x4'));var interaction=require(_0xacb2('0x5'));var config=require('../../config/environment');var controller=require(_0xacb2('0x6'));router[_0xacb2('0x7')]('/',auth['isAuthenticated'](),controller[_0xacb2('0x8')]);router[_0xacb2('0x7')](_0xacb2('0x9'),auth[_0xacb2('0xa')](),controller[_0xacb2('0xb')]);router[_0xacb2('0x7')](_0xacb2('0xc'),auth['isAuthenticated'](),controller[_0xacb2('0xd')]);router[_0xacb2('0x7')](_0xacb2('0xe'),auth['isAuthenticated'](),controller[_0xacb2('0xf')]);router[_0xacb2('0x10')]('/',auth[_0xacb2('0xa')](),controller['create']);router[_0xacb2('0x10')](_0xacb2('0xc'),auth['isAuthenticated'](),controller[_0xacb2('0x11')]);router[_0xacb2('0x12')](_0xacb2('0x9'),auth[_0xacb2('0xa')](),controller[_0xacb2('0x13')]);router[_0xacb2('0x14')]('/:id',auth[_0xacb2('0xa')](),controller[_0xacb2('0x15')]);module['exports']=router; \ No newline at end of file +var _0x6c52=['post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','getFields'];(function(_0x1a0022,_0x2b72d8){var _0x2a18b0=function(_0x2c06d3){while(--_0x2c06d3){_0x1a0022['push'](_0x1a0022['shift']());}};_0x2a18b0(++_0x2b72d8);}(_0x6c52,0x1eb));var _0x26c5=function(_0x30631b,_0x3dbe5f){_0x30631b=_0x30631b-0x0;var _0x47e314=_0x6c52[_0x30631b];return _0x47e314;};'use strict';var multer=require(_0x26c5('0x0'));var util=require(_0x26c5('0x1'));var path=require(_0x26c5('0x2'));var timeout=require(_0x26c5('0x3'));var express=require(_0x26c5('0x4'));var router=express['Router']();var auth=require(_0x26c5('0x5'));var interaction=require(_0x26c5('0x6'));var config=require('../../config/environment');var controller=require('./intZohoAccount.controller');router[_0x26c5('0x7')]('/',auth[_0x26c5('0x8')](),controller[_0x26c5('0x9')]);router[_0x26c5('0x7')](_0x26c5('0xa'),auth[_0x26c5('0x8')](),controller[_0x26c5('0xb')]);router[_0x26c5('0x7')](_0x26c5('0xc'),auth[_0x26c5('0x8')](),controller[_0x26c5('0xd')]);router[_0x26c5('0x7')]('/:id/fields',auth['isAuthenticated'](),controller[_0x26c5('0xe')]);router[_0x26c5('0xf')]('/',auth['isAuthenticated'](),controller[_0x26c5('0x10')]);router[_0x26c5('0xf')](_0x26c5('0xc'),auth[_0x26c5('0x8')](),controller[_0x26c5('0x11')]);router[_0x26c5('0x12')](_0x26c5('0xa'),auth['isAuthenticated'](),controller[_0x26c5('0x13')]);router[_0x26c5('0x14')](_0x26c5('0xa'),auth['isAuthenticated'](),controller[_0x26c5('0x15')]);module[_0x26c5('0x16')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index 1bed1f7..c0afc87 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 _0x58ea=['STRING','sequelize','exports'];(function(_0x5b8230,_0x1242eb){var _0x379f8e=function(_0xf8f669){while(--_0xf8f669){_0x5b8230['push'](_0x5b8230['shift']());}};_0x379f8e(++_0x1242eb);}(_0x58ea,0x190));var _0xa58e=function(_0x3ca9c1,_0x5c99b7){_0x3ca9c1=_0x3ca9c1-0x0;var _0x37a3da=_0x58ea[_0x3ca9c1];return _0x37a3da;};'use strict';var Sequelize=require(_0xa58e('0x0'));module[_0xa58e('0x1')]={'name':{'type':Sequelize[_0xa58e('0x2')]},'description':{'type':Sequelize[_0xa58e('0x2')]},'host':{'type':Sequelize[_0xa58e('0x2')]},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xa58e('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize['STRING']},'code':{'type':Sequelize[_0xa58e('0x2')]},'refreshToken':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6184=['STRING','sequelize','exports'];(function(_0x9d5569,_0xe6ba2f){var _0x5e0137=function(_0x97b2cc){while(--_0x97b2cc){_0x9d5569['push'](_0x9d5569['shift']());}};_0x5e0137(++_0xe6ba2f);}(_0x6184,0xdc));var _0x4618=function(_0x32b122,_0x1ad490){_0x32b122=_0x32b122-0x0;var _0x4ad25a=_0x6184[_0x32b122];return _0x4ad25a;};'use strict';var Sequelize=require(_0x4618('0x0'));module[_0x4618('0x1')]={'name':{'type':Sequelize[_0x4618('0x2')]},'description':{'type':Sequelize[_0x4618('0x2')]},'host':{'type':Sequelize[_0x4618('0x2')]},'zone':{'type':Sequelize[_0x4618('0x2')]},'clientId':{'type':Sequelize[_0x4618('0x2')]},'clientSecret':{'type':Sequelize[_0x4618('0x2')]},'serverUrl':{'type':Sequelize[_0x4618('0x2')]},'code':{'type':Sequelize[_0x4618('0x2')]},'refreshToken':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 8d0d51e..41f6a58 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 _0xe6f7=['../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','jayson/promise','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','update','destroy','name','send','index','map','ZohoAccount','fieldName','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','where','type','filter','merge','options','includeAll','include','show','params','rawAttributes','find','create','body','getConfigurations','findOne','ZohoConfiguration','addConfiguration','Subjects','getSubjects','ZohoField','Descriptions','zone','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','access_token','getFields','host','serverUrl','zoho.eu','com','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','Calls','Zoho-oauthtoken\x20','response','Subject','Description','Call_Duration','Call_Type','remove','system_mandatory','push','display_label','custom_field','data_type','picklist','pick_list_values','getFields,\x20%s,\x20%s,\x20%s','statusCode','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','path','sox','to-csv','ejs','lodash','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x4394b6,_0x12357f){var _0x360244=function(_0x5689a1){while(--_0x5689a1){_0x4394b6['push'](_0x4394b6['shift']());}};_0x360244(++_0x12357f);}(_0xe6f7,0x1e6));var _0x7e6f=function(_0x47e549,_0x2e53d6){_0x47e549=_0x47e549-0x0;var _0x251374=_0xe6f7[_0x47e549];return _0x251374;};'use strict';var pdf=require(_0x7e6f('0x0'));var emlformat=require(_0x7e6f('0x1'));var rimraf=require(_0x7e6f('0x2'));var zipdir=require(_0x7e6f('0x3'));var jsonpatch=require(_0x7e6f('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x7e6f('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x7e6f('0x6'));var sox=require(_0x7e6f('0x7'));var csv=require(_0x7e6f('0x8'));var ejs=require(_0x7e6f('0x9'));var fs=require('fs');var _=require(_0x7e6f('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x7e6f('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7e6f('0xb'));var qs=require(_0x7e6f('0xc'));var as=require(_0x7e6f('0xd'));var hardwareService=require(_0x7e6f('0xe'));var logger=require(_0x7e6f('0xf'))('api');var utils=require(_0x7e6f('0x10'));var config=require(_0x7e6f('0x11'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x7e6f('0x12'));var client=jayson['client'][_0x7e6f('0x13')]({'port':0x232a});function checkPasswordPattern(_0x4ea34d,_0x1815bb,_0x5ce6ba){if(_0x5ce6ba){var _0x4b0f54=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4b0f54[_0x7e6f('0x14')](_0x1815bb)){return _0x4ea34d;}else{throw new db[(_0x7e6f('0x15'))][(_0x7e6f('0x16'))](_0x7e6f('0x17'));}}else{return _0x4ea34d;}}function respondWithRpcPromise(_0x45210c,_0x512a02,_0x4d91ec,_0x223e9a){return new BPromise(function(_0x177522,_0x24ce35){var _0x1ad636=_0x223e9a||client;return _0x1ad636['request'](_0x45210c,_0x4d91ec)[_0x7e6f('0x18')](function(_0x458584){logger['info'](_0x7e6f('0x19'),_0x512a02,_0x7e6f('0x1a'));logger[_0x7e6f('0x1b')](_0x7e6f('0x1c'),_0x512a02,'request\x20sent',JSON[_0x7e6f('0x1d')](_0x458584));if(_0x458584['error']){if(_0x458584[_0x7e6f('0x1e')][_0x7e6f('0x1f')]===0x1f4){logger[_0x7e6f('0x1e')](_0x7e6f('0x19'),_0x512a02,_0x458584[_0x7e6f('0x1e')][_0x7e6f('0x20')]);return _0x24ce35(_0x458584[_0x7e6f('0x1e')][_0x7e6f('0x20')]);}logger[_0x7e6f('0x1e')](_0x7e6f('0x19'),_0x512a02,_0x458584[_0x7e6f('0x1e')][_0x7e6f('0x20')]);return _0x177522(_0x458584['error'][_0x7e6f('0x20')]);}else{logger['info'](_0x7e6f('0x19'),_0x512a02,'request\x20sent');_0x177522(_0x458584['result']['message']);}})[_0x7e6f('0x21')](function(_0x576b40){logger[_0x7e6f('0x1e')]('ZohoAccount,\x20%s,\x20%s',_0x512a02,_0x576b40);_0x24ce35(_0x576b40);});});}function respondWithStatusCode(_0x40f3d7,_0x3cc33b){_0x3cc33b=_0x3cc33b||0xcc;return function(_0x4cc88d){if(_0x4cc88d){return _0x40f3d7[_0x7e6f('0x22')](_0x3cc33b);}return _0x40f3d7[_0x7e6f('0x23')](_0x3cc33b)[_0x7e6f('0x24')]();};}function respondWithResult(_0x375023,_0xe1c9e0){_0xe1c9e0=_0xe1c9e0||0xc8;return function(_0x43e1a9){if(_0x43e1a9){return _0x375023[_0x7e6f('0x23')](_0xe1c9e0)['json'](_0x43e1a9);}};}function respondWithFilteredResult(_0x594ada,_0x2ec9a9){return function(_0x45cdb2){if(_0x45cdb2){var _0x507715=_0x45cdb2[_0x7e6f('0x25')],_0x5a0162=_0x2ec9a9[_0x7e6f('0x26')],_0x20fa3a=_0x2ec9a9[_0x7e6f('0x26')]+_0x2ec9a9[_0x7e6f('0x27')],_0x1255da;if(_0x20fa3a>=_0x507715){_0x20fa3a=_0x507715;_0x1255da=0xc8;}else{_0x1255da=0xce;}_0x594ada[_0x7e6f('0x23')](_0x1255da);return _0x594ada[_0x7e6f('0x28')](_0x7e6f('0x29'),_0x5a0162+'-'+_0x20fa3a+'/'+_0x507715)[_0x7e6f('0x2a')](_0x45cdb2);}return null;};}function patchUpdates(_0x435de0){return function(_0x1e4dcb){try{jsonpatch[_0x7e6f('0x2b')](_0x1e4dcb,_0x435de0,!![]);}catch(_0x47c43b){return BPromise[_0x7e6f('0x2c')](_0x47c43b);}return _0x1e4dcb['save']();};}function saveUpdates(_0x1c7fcc,_0x570516){return function(_0x266802){if(_0x266802){return _0x266802[_0x7e6f('0x2d')](_0x1c7fcc)[_0x7e6f('0x18')](function(_0xb2ee02){return _0xb2ee02;});}return null;};}function removeEntity(_0x4acfaf,_0x20cacb){return function(_0x5e27e2){if(_0x5e27e2){return _0x5e27e2[_0x7e6f('0x2e')]()[_0x7e6f('0x18')](function(){_0x4acfaf['status'](0xcc)[_0x7e6f('0x24')]();});}};}function handleEntityNotFound(_0x4af899,_0x466188){return function(_0x2fdb9c){if(!_0x2fdb9c){_0x4af899[_0x7e6f('0x22')](0x194);}return _0x2fdb9c;};}function handleError(_0x263b74,_0x2c9db0){_0x2c9db0=_0x2c9db0||0x1f4;return function(_0x1a1518){logger[_0x7e6f('0x1e')](_0x1a1518['stack']);if(_0x1a1518[_0x7e6f('0x2f')]){delete _0x1a1518[_0x7e6f('0x2f')];}_0x263b74[_0x7e6f('0x23')](_0x2c9db0)[_0x7e6f('0x30')](_0x1a1518);};}exports[_0x7e6f('0x31')]=function(_0x3305ad,_0x3f45a2){var _0x227eaa={},_0x1dec6c={},_0x3bffaf={'count':0x0,'rows':[]};var _0xefc612=_[_0x7e6f('0x32')](db[_0x7e6f('0x33')]['rawAttributes'],function(_0x4725be){return{'name':_0x4725be[_0x7e6f('0x34')],'type':_0x4725be['type'][_0x7e6f('0x35')]};});_0x1dec6c[_0x7e6f('0x36')]=_[_0x7e6f('0x32')](_0xefc612,_0x7e6f('0x2f'));_0x1dec6c['query']=_[_0x7e6f('0x37')](_0x3305ad[_0x7e6f('0x38')]);_0x1dec6c[_0x7e6f('0x39')]=_[_0x7e6f('0x3a')](_0x1dec6c[_0x7e6f('0x36')],_0x1dec6c[_0x7e6f('0x38')]);_0x227eaa['attributes']=_[_0x7e6f('0x3a')](_0x1dec6c[_0x7e6f('0x36')],qs['fields'](_0x3305ad[_0x7e6f('0x38')][_0x7e6f('0x3b')]));_0x227eaa[_0x7e6f('0x3c')]=_0x227eaa[_0x7e6f('0x3c')][_0x7e6f('0x3d')]?_0x227eaa[_0x7e6f('0x3c')]:_0x1dec6c['model'];if(!_0x3305ad[_0x7e6f('0x38')][_0x7e6f('0x3e')](_0x7e6f('0x3f'))){_0x227eaa[_0x7e6f('0x27')]=qs[_0x7e6f('0x27')](_0x3305ad['query']['limit']);_0x227eaa['offset']=qs[_0x7e6f('0x26')](_0x3305ad[_0x7e6f('0x38')]['offset']);}_0x227eaa['order']=qs[_0x7e6f('0x40')](_0x3305ad[_0x7e6f('0x38')]['sort']);_0x227eaa['where']=qs[_0x7e6f('0x39')](_[_0x7e6f('0x41')](_0x3305ad[_0x7e6f('0x38')],_0x1dec6c['filters']),_0xefc612);if(_0x3305ad[_0x7e6f('0x38')]['filter']){_0x227eaa[_0x7e6f('0x42')]=_['merge'](_0x227eaa[_0x7e6f('0x42')],{'$or':_[_0x7e6f('0x32')](_0xefc612,function(_0x6b36b1){if(_0x6b36b1[_0x7e6f('0x43')]!=='VIRTUAL'){var _0x3ab6be={};_0x3ab6be[_0x6b36b1[_0x7e6f('0x2f')]]={'$like':'%'+_0x3305ad[_0x7e6f('0x38')][_0x7e6f('0x44')]+'%'};return _0x3ab6be;}})});}_0x227eaa=_[_0x7e6f('0x45')]({},_0x227eaa,_0x3305ad[_0x7e6f('0x46')]);var _0x54e5cb={'where':_0x227eaa[_0x7e6f('0x42')]};return db['ZohoAccount']['count'](_0x54e5cb)[_0x7e6f('0x18')](function(_0x32c7e7){_0x3bffaf[_0x7e6f('0x25')]=_0x32c7e7;if(_0x3305ad[_0x7e6f('0x38')][_0x7e6f('0x47')]){_0x227eaa[_0x7e6f('0x48')]=[{'all':!![]}];}return db[_0x7e6f('0x33')]['findAll'](_0x227eaa);})[_0x7e6f('0x18')](function(_0x2155c8){_0x3bffaf['rows']=_0x2155c8;return _0x3bffaf;})[_0x7e6f('0x18')](respondWithFilteredResult(_0x3f45a2,_0x227eaa))[_0x7e6f('0x21')](handleError(_0x3f45a2,null));};exports[_0x7e6f('0x49')]=function(_0x5d4b9a,_0x2f9f8){var _0x2c1cbe={'raw':![],'where':{'id':_0x5d4b9a[_0x7e6f('0x4a')]['id']}},_0x3aa7bf={};_0x3aa7bf[_0x7e6f('0x36')]=_[_0x7e6f('0x37')](db[_0x7e6f('0x33')][_0x7e6f('0x4b')]);_0x3aa7bf[_0x7e6f('0x38')]=_[_0x7e6f('0x37')](_0x5d4b9a[_0x7e6f('0x38')]);_0x3aa7bf['filters']=_['intersection'](_0x3aa7bf[_0x7e6f('0x36')],_0x3aa7bf['query']);_0x2c1cbe[_0x7e6f('0x3c')]=_[_0x7e6f('0x3a')](_0x3aa7bf[_0x7e6f('0x36')],qs[_0x7e6f('0x3b')](_0x5d4b9a['query']['fields']));_0x2c1cbe[_0x7e6f('0x3c')]=_0x2c1cbe[_0x7e6f('0x3c')][_0x7e6f('0x3d')]?_0x2c1cbe[_0x7e6f('0x3c')]:_0x3aa7bf['model'];if(_0x5d4b9a['query'][_0x7e6f('0x47')]){_0x2c1cbe[_0x7e6f('0x48')]=[{'all':!![]}];}_0x2c1cbe=_['merge']({},_0x2c1cbe,_0x5d4b9a[_0x7e6f('0x46')]);return db['ZohoAccount'][_0x7e6f('0x4c')](_0x2c1cbe)['then'](handleEntityNotFound(_0x2f9f8,null))[_0x7e6f('0x18')](respondWithResult(_0x2f9f8,null))['catch'](handleError(_0x2f9f8,null));};exports[_0x7e6f('0x4d')]=function(_0x9262a,_0x529460){return db[_0x7e6f('0x33')][_0x7e6f('0x4d')](_0x9262a[_0x7e6f('0x4e')],{})[_0x7e6f('0x18')](respondWithResult(_0x529460,0xc9))[_0x7e6f('0x21')](handleError(_0x529460,null));};exports['update']=function(_0x16be08,_0x5bdedf){if(_0x16be08[_0x7e6f('0x4e')]['id']){delete _0x16be08[_0x7e6f('0x4e')]['id'];}return db['ZohoAccount'][_0x7e6f('0x4c')]({'where':{'id':_0x16be08[_0x7e6f('0x4a')]['id']}})[_0x7e6f('0x18')](handleEntityNotFound(_0x5bdedf,null))[_0x7e6f('0x18')](saveUpdates(_0x16be08[_0x7e6f('0x4e')],null))[_0x7e6f('0x18')](respondWithResult(_0x5bdedf,null))[_0x7e6f('0x21')](handleError(_0x5bdedf,null));};exports[_0x7e6f('0x2e')]=function(_0x23e2ce,_0x12a08a){return db['ZohoAccount'][_0x7e6f('0x4c')]({'where':{'id':_0x23e2ce[_0x7e6f('0x4a')]['id']}})[_0x7e6f('0x18')](handleEntityNotFound(_0x12a08a,null))[_0x7e6f('0x18')](removeEntity(_0x12a08a,null))[_0x7e6f('0x21')](handleError(_0x12a08a,null));};exports[_0x7e6f('0x4f')]=function(_0x1ec59d,_0x493edd,_0x1caf0e){var _0x4ce570={};var _0xecf860={};var _0x2f792b;var _0x43e081;return db[_0x7e6f('0x33')][_0x7e6f('0x50')]({'where':{'id':_0x1ec59d[_0x7e6f('0x4a')]['id']}})[_0x7e6f('0x18')](handleEntityNotFound(_0x493edd,null))[_0x7e6f('0x18')](function(_0x3048fb){if(_0x3048fb){_0x2f792b=_0x3048fb;_0xecf860['model']=_['keys'](db[_0x7e6f('0x51')]['rawAttributes']);_0xecf860[_0x7e6f('0x38')]=_['keys'](_0x1ec59d[_0x7e6f('0x38')]);_0xecf860['filters']=_[_0x7e6f('0x3a')](_0xecf860['model'],_0xecf860[_0x7e6f('0x38')]);_0x4ce570['attributes']=_[_0x7e6f('0x3a')](_0xecf860[_0x7e6f('0x36')],qs[_0x7e6f('0x3b')](_0x1ec59d[_0x7e6f('0x38')][_0x7e6f('0x3b')]));_0x4ce570[_0x7e6f('0x3c')]=_0x4ce570['attributes'][_0x7e6f('0x3d')]?_0x4ce570[_0x7e6f('0x3c')]:_0xecf860[_0x7e6f('0x36')];_0x4ce570['order']=qs[_0x7e6f('0x40')](_0x1ec59d['query'][_0x7e6f('0x40')]);_0x4ce570[_0x7e6f('0x42')]=qs[_0x7e6f('0x39')](_[_0x7e6f('0x41')](_0x1ec59d[_0x7e6f('0x38')],_0xecf860[_0x7e6f('0x39')]));if(_0x1ec59d['query'][_0x7e6f('0x44')]){_0x4ce570[_0x7e6f('0x42')]=_[_0x7e6f('0x45')](_0x4ce570[_0x7e6f('0x42')],{'$or':_['map'](_0x4ce570[_0x7e6f('0x3c')],function(_0x23bdc9){var _0x5d1318={};_0x5d1318[_0x23bdc9]={'$like':'%'+_0x1ec59d[_0x7e6f('0x38')][_0x7e6f('0x44')]+'%'};return _0x5d1318;})});}_0x4ce570=_[_0x7e6f('0x45')]({},_0x4ce570,_0x1ec59d['options']);return _0x2f792b[_0x7e6f('0x4f')](_0x4ce570);}})[_0x7e6f('0x18')](function(_0x41e2c1){if(_0x41e2c1){_0x43e081=_0x41e2c1['length'];if(!_0x1ec59d[_0x7e6f('0x38')][_0x7e6f('0x3e')](_0x7e6f('0x3f'))){_0x4ce570[_0x7e6f('0x27')]=qs[_0x7e6f('0x27')](_0x1ec59d['query'][_0x7e6f('0x27')]);_0x4ce570['offset']=qs[_0x7e6f('0x26')](_0x1ec59d[_0x7e6f('0x38')][_0x7e6f('0x26')]);}return _0x2f792b['getConfigurations'](_0x4ce570);}})[_0x7e6f('0x18')](function(_0x5cc3a6){if(_0x5cc3a6){return _0x5cc3a6?{'count':_0x43e081,'rows':_0x5cc3a6}:null;}})[_0x7e6f('0x18')](respondWithResult(_0x493edd,null))[_0x7e6f('0x21')](handleError(_0x493edd,null));};exports[_0x7e6f('0x52')]=function(_0x297f6e,_0x3474b5,_0x41d848){if(_0x297f6e[_0x7e6f('0x4e')]['id']){delete _0x297f6e['body']['id'];}return db[_0x7e6f('0x33')][_0x7e6f('0x50')]({'where':{'id':_0x297f6e['params']['id']}})[_0x7e6f('0x18')](handleEntityNotFound(_0x3474b5,null))[_0x7e6f('0x18')](function(_0x5e981a){if(_0x5e981a){_0x297f6e['body']['AccountId']=_0x5e981a['id'];_0x297f6e[_0x7e6f('0x4e')][_0x7e6f('0x53')]=integrations[_0x7e6f('0x54')](_0x297f6e[_0x7e6f('0x4e')]['channel'],_0x297f6e[_0x7e6f('0x4e')][_0x7e6f('0x43')]);_0x297f6e[_0x7e6f('0x4e')]['Descriptions']=integrations['getDescriptions'](_0x297f6e[_0x7e6f('0x4e')]['channel'],_0x297f6e['body'][_0x7e6f('0x43')]);return db['ZohoConfiguration'][_0x7e6f('0x4d')](_0x297f6e[_0x7e6f('0x4e')],{'include':[{'model':db['ZohoField'],'as':'Subjects'},{'model':db[_0x7e6f('0x55')],'as':_0x7e6f('0x56')}]});}return null;})[_0x7e6f('0x18')](respondWithResult(_0x3474b5,null))[_0x7e6f('0x21')](handleError(_0x3474b5,null));};function getAccessToken(_0x4e04f3){return new Promise(function(_0x2b3b3f,_0x2830f5){var _0x6edbdd;switch(_0x4e04f3[_0x7e6f('0x57')]){case'US':_0x6edbdd='https://accounts.zoho.com';break;case'AU':_0x6edbdd=_0x7e6f('0x58');break;case'EU':_0x6edbdd=_0x7e6f('0x59');break;case'IN':_0x6edbdd=_0x7e6f('0x5a');break;case'CN':_0x6edbdd='https://accounts.zoho.com.cn';break;default:_0x6edbdd='https://accounts.zoho.eu';break;}var _0x5236c3={'method':_0x7e6f('0x5b'),'uri':_0x6edbdd+_0x7e6f('0x5c'),'qs':{'refresh_token':_0x4e04f3[_0x7e6f('0x5d')],'client_id':_0x4e04f3[_0x7e6f('0x5e')],'client_secret':_0x4e04f3[_0x7e6f('0x5f')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x5236c3)[_0x7e6f('0x18')](function(_0x18f935){if(_0x18f935[_0x7e6f('0x60')]){_0x2b3b3f(_0x18f935[_0x7e6f('0x60')]);}else{_0x2830f5('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})[_0x7e6f('0x21')](function(_0x2502a1){_0x2830f5(_0x2502a1);});});}exports[_0x7e6f('0x61')]=function(_0x476346,_0xcb40e,_0x577c37){var _0xb54372,_0x49194e,_0x1ae9df,_0x3ef434,_0x553d9a;return db[_0x7e6f('0x33')]['findOne']({'where':{'id':_0x476346[_0x7e6f('0x4a')]['id']},'attributes':['id',_0x7e6f('0x62'),'zone','clientId',_0x7e6f('0x5f'),_0x7e6f('0x63'),_0x7e6f('0x1f'),_0x7e6f('0x5d')]})[_0x7e6f('0x18')](handleEntityNotFound(_0xcb40e,null))[_0x7e6f('0x18')](function(_0x4fd429){_0x553d9a=_0x4fd429;_0xb54372=_0x553d9a[_0x7e6f('0x62')];_0x49194e=_0xb54372===_0x7e6f('0x64')?'eu':_0x7e6f('0x65');_0x1ae9df=_0x553d9a[_0x7e6f('0x63')];var _0xb23d83=_0x1ae9df[_0x7e6f('0x66')](-0x1);if(_0xb23d83==='/'||_0xb23d83==='\x5c'||_0xb23d83===':'){_0x1ae9df=_0x1ae9df[_0x7e6f('0x67')](0x0,_0x1ae9df[_0x7e6f('0x68')](_0xb23d83));}if(!_0x553d9a['refreshToken']){throw new Error(_0x7e6f('0x69'));}return getAccessToken(_0x553d9a);})[_0x7e6f('0x18')](function(_0x35cac8){if(_0x35cac8){return rp({'method':_0x7e6f('0x6a'),'uri':util[_0x7e6f('0x6b')]('https://www.zohoapis.%s/crm/v2/settings/fields',_0x49194e),'qs':{'module':_0x7e6f('0x6c')},'headers':{'Authorization':_0x7e6f('0x6d')+_0x35cac8},'json':!![]});}})[_0x7e6f('0x18')](function(_0x2901cc){if(_0x2901cc){if(_0x2901cc[_0x7e6f('0x6e')]&&_0x2901cc['response'][_0x7e6f('0x1e')]){throw new Error(_0x2901cc[_0x7e6f('0x6e')]['error']['message']);}var _0x3a024a=[];var _0x338119=[];var _0x24d441=['Owner',_0x7e6f('0x6f'),_0x7e6f('0x70'),'WhoId',_0x7e6f('0x71'),'Call_Result','Call_Start_Time',_0x7e6f('0x72')];_0x338119=_[_0x7e6f('0x73')](_0x2901cc[_0x7e6f('0x3b')],function(_0x16c758){return _0x24d441['includes'](_0x16c758['api_name']);});for(var _0x202e24=0x0;_0x202e24<_0x338119[_0x7e6f('0x3d')];_0x202e24++){if(_0x338119[_0x202e24][_0x7e6f('0x74')]===![]){_0x3a024a[_0x7e6f('0x75')]({'id':_0x338119[_0x202e24]['id'],'name':_0x338119[_0x202e24][_0x7e6f('0x76')],'custom':_0x338119[_0x202e24][_0x7e6f('0x77')],'options':_0x338119[_0x202e24][_0x7e6f('0x78')]===_0x7e6f('0x79')&&_0x338119[_0x202e24][_0x7e6f('0x7a')][_0x7e6f('0x3d')]>-0x1?_[_0x7e6f('0x32')](_0x338119[_0x202e24][_0x7e6f('0x7a')],function(_0x429cdd){return{'name':_0x429cdd,'value':_0x429cdd};}):[]});}}return{'count':_0x3a024a[_0x7e6f('0x3d')],'rows':_0x3a024a};}else{return{'count':0x0,'rows':[]};}})[_0x7e6f('0x18')](respondWithResult(_0xcb40e,null))[_0x7e6f('0x21')](function(_0xb4049c){var _0x423811=_0x476346[_0x7e6f('0x38')]['test']?0x1f4:_0xb4049c['statusCode']||0x1f4;logger['error'](_0x7e6f('0x7b'),_0x7e6f('0x61'),_0x423811,JSON['stringify'](_0xb4049c));delete _0xb4049c[_0x7e6f('0x2f')];if(_0x423811===0x191){_0x423811=0x190;}_0xcb40e[_0x7e6f('0x23')](_0x423811)[_0x7e6f('0x30')](_0x476346[_0x7e6f('0x38')][_0x7e6f('0x14')]?{'message':'Wrong\x20credentials','statusCode':_0xb4049c[_0x7e6f('0x7c')]}:_0xb4049c);});}; \ No newline at end of file +var _0xc06d=['request\x20sent','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','sendStatus','status','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','end','stack','name','send','index','map','ZohoAccount','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','count','includeAll','include','findAll','rows','show','params','find','body','getConfigurations','findOne','ZohoConfiguration','rawAttributes','AccountId','getSubjects','channel','Descriptions','getDescriptions','create','ZohoField','Subjects','zone','https://accounts.zoho.com','https://accounts.zoho.eu','/oauth/v2/token','refreshToken','clientId','clientSecret','access_token','host','code','zoho.eu','serverUrl','slice','substring','lastIndexOf','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','Subject','WhoId','Call_Duration','Call_Result','Call_Start_Time','Call_Type','includes','system_mandatory','display_label','custom_field','picklist','pick_list_values','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','ZohoAccount,\x20%s,\x20%s'];(function(_0x2a9ec5,_0xed23b){var _0x52c7c0=function(_0x54b22d){while(--_0x54b22d){_0x2a9ec5['push'](_0x2a9ec5['shift']());}};_0x52c7c0(++_0xed23b);}(_0xc06d,0xef));var _0xdc06=function(_0x1dbb68,_0x49cf7c){_0x1dbb68=_0x1dbb68-0x0;var _0x1c17d7=_0xc06d[_0x1dbb68];return _0x1c17d7;};'use strict';var pdf=require(_0xdc06('0x0'));var emlformat=require(_0xdc06('0x1'));var rimraf=require(_0xdc06('0x2'));var zipdir=require(_0xdc06('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdc06('0x4'));var moment=require(_0xdc06('0x5'));var BPromise=require(_0xdc06('0x6'));var Mustache=require(_0xdc06('0x7'));var util=require(_0xdc06('0x8'));var path=require(_0xdc06('0x9'));var sox=require(_0xdc06('0xa'));var csv=require(_0xdc06('0xb'));var ejs=require(_0xdc06('0xc'));var fs=require('fs');var _=require(_0xdc06('0xd'));var squel=require(_0xdc06('0xe'));var crypto=require(_0xdc06('0xf'));var jsforce=require(_0xdc06('0x10'));var deskjs=require(_0xdc06('0x11'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xdc06('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xdc06('0x13'));var as=require(_0xdc06('0x14'));var hardwareService=require(_0xdc06('0x15'));var logger=require(_0xdc06('0x16'))(_0xdc06('0x17'));var utils=require(_0xdc06('0x18'));var config=require('../../config/environment');var db=require(_0xdc06('0x19'))['db'];var integrations=require(_0xdc06('0x1a'));var jayson=require(_0xdc06('0x1b'));var client=jayson[_0xdc06('0x1c')]['http']({'port':0x232a});function checkPasswordPattern(_0x536f6c,_0x34f835,_0x164e5f){if(_0x164e5f){var _0x5e5f9a=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5e5f9a[_0xdc06('0x1d')](_0x34f835)){return _0x536f6c;}else{throw new db[(_0xdc06('0x1e'))][(_0xdc06('0x1f'))](_0xdc06('0x20'));}}else{return _0x536f6c;}}function respondWithRpcPromise(_0x30def2,_0x466cd9,_0x47fe38,_0x2d3bae){return new BPromise(function(_0x522b29,_0x179c63){var _0x1c7c50=_0x2d3bae||client;return _0x1c7c50['request'](_0x30def2,_0x47fe38)[_0xdc06('0x21')](function(_0x32d1a9){logger['info'](_0xdc06('0x22'),_0x466cd9,_0xdc06('0x23'));logger['debug'](_0xdc06('0x24'),_0x466cd9,_0xdc06('0x23'),JSON[_0xdc06('0x25')](_0x32d1a9));if(_0x32d1a9[_0xdc06('0x26')]){if(_0x32d1a9[_0xdc06('0x26')]['code']===0x1f4){logger[_0xdc06('0x26')](_0xdc06('0x22'),_0x466cd9,_0x32d1a9[_0xdc06('0x26')][_0xdc06('0x27')]);return _0x179c63(_0x32d1a9[_0xdc06('0x26')][_0xdc06('0x27')]);}logger[_0xdc06('0x26')](_0xdc06('0x22'),_0x466cd9,_0x32d1a9[_0xdc06('0x26')][_0xdc06('0x27')]);return _0x522b29(_0x32d1a9[_0xdc06('0x26')]['message']);}else{logger[_0xdc06('0x28')](_0xdc06('0x22'),_0x466cd9,'request\x20sent');_0x522b29(_0x32d1a9['result'][_0xdc06('0x27')]);}})[_0xdc06('0x29')](function(_0x4bcfd5){logger[_0xdc06('0x26')]('ZohoAccount,\x20%s,\x20%s',_0x466cd9,_0x4bcfd5);_0x179c63(_0x4bcfd5);});});}function respondWithStatusCode(_0x587feb,_0x53f651){_0x53f651=_0x53f651||0xcc;return function(_0x9c8818){if(_0x9c8818){return _0x587feb[_0xdc06('0x2a')](_0x53f651);}return _0x587feb['status'](_0x53f651)['end']();};}function respondWithResult(_0x3ed272,_0x834517){_0x834517=_0x834517||0xc8;return function(_0x3500c4){if(_0x3500c4){return _0x3ed272[_0xdc06('0x2b')](_0x834517)[_0xdc06('0x2c')](_0x3500c4);}};}function respondWithFilteredResult(_0x2771a4,_0x1366b0){return function(_0x492373){if(_0x492373){var _0x5a7f91=_0x492373['count'],_0x432cbb=_0x1366b0[_0xdc06('0x2d')],_0x4d6f77=_0x1366b0[_0xdc06('0x2d')]+_0x1366b0[_0xdc06('0x2e')],_0x34b18f;if(_0x4d6f77>=_0x5a7f91){_0x4d6f77=_0x5a7f91;_0x34b18f=0xc8;}else{_0x34b18f=0xce;}_0x2771a4['status'](_0x34b18f);return _0x2771a4[_0xdc06('0x2f')](_0xdc06('0x30'),_0x432cbb+'-'+_0x4d6f77+'/'+_0x5a7f91)['json'](_0x492373);}return null;};}function patchUpdates(_0x23a765){return function(_0xf68fde){try{jsonpatch[_0xdc06('0x31')](_0xf68fde,_0x23a765,!![]);}catch(_0x19a6de){return BPromise[_0xdc06('0x32')](_0x19a6de);}return _0xf68fde[_0xdc06('0x33')]();};}function saveUpdates(_0x4f1e98,_0x146c98){return function(_0x59aa4c){if(_0x59aa4c){return _0x59aa4c[_0xdc06('0x34')](_0x4f1e98)[_0xdc06('0x21')](function(_0x581a53){return _0x581a53;});}return null;};}function removeEntity(_0x31e555,_0x15911c){return function(_0x11bbc8){if(_0x11bbc8){return _0x11bbc8[_0xdc06('0x35')]()['then'](function(){_0x31e555[_0xdc06('0x2b')](0xcc)[_0xdc06('0x36')]();});}};}function handleEntityNotFound(_0x2bf552,_0xb0b83c){return function(_0x5ba0e5){if(!_0x5ba0e5){_0x2bf552[_0xdc06('0x2a')](0x194);}return _0x5ba0e5;};}function handleError(_0x564ad0,_0x4436ed){_0x4436ed=_0x4436ed||0x1f4;return function(_0x4d40dd){logger[_0xdc06('0x26')](_0x4d40dd[_0xdc06('0x37')]);if(_0x4d40dd[_0xdc06('0x38')]){delete _0x4d40dd[_0xdc06('0x38')];}_0x564ad0['status'](_0x4436ed)[_0xdc06('0x39')](_0x4d40dd);};}exports[_0xdc06('0x3a')]=function(_0x1a086d,_0x33754d){var _0x58ee57={},_0x29919d={},_0x3dfb6e={'count':0x0,'rows':[]};var _0xdd2e49=_[_0xdc06('0x3b')](db[_0xdc06('0x3c')]['rawAttributes'],function(_0x49d7ea){return{'name':_0x49d7ea[_0xdc06('0x3d')],'type':_0x49d7ea[_0xdc06('0x3e')]['key']};});_0x29919d[_0xdc06('0x3f')]=_[_0xdc06('0x3b')](_0xdd2e49,_0xdc06('0x38'));_0x29919d['query']=_[_0xdc06('0x40')](_0x1a086d[_0xdc06('0x41')]);_0x29919d[_0xdc06('0x42')]=_[_0xdc06('0x43')](_0x29919d[_0xdc06('0x3f')],_0x29919d['query']);_0x58ee57[_0xdc06('0x44')]=_[_0xdc06('0x43')](_0x29919d[_0xdc06('0x3f')],qs[_0xdc06('0x45')](_0x1a086d[_0xdc06('0x41')]['fields']));_0x58ee57['attributes']=_0x58ee57[_0xdc06('0x44')][_0xdc06('0x46')]?_0x58ee57['attributes']:_0x29919d[_0xdc06('0x3f')];if(!_0x1a086d[_0xdc06('0x41')][_0xdc06('0x47')](_0xdc06('0x48'))){_0x58ee57[_0xdc06('0x2e')]=qs[_0xdc06('0x2e')](_0x1a086d[_0xdc06('0x41')]['limit']);_0x58ee57[_0xdc06('0x2d')]=qs['offset'](_0x1a086d[_0xdc06('0x41')]['offset']);}_0x58ee57[_0xdc06('0x49')]=qs[_0xdc06('0x4a')](_0x1a086d[_0xdc06('0x41')][_0xdc06('0x4a')]);_0x58ee57[_0xdc06('0x4b')]=qs[_0xdc06('0x42')](_[_0xdc06('0x4c')](_0x1a086d[_0xdc06('0x41')],_0x29919d[_0xdc06('0x42')]),_0xdd2e49);if(_0x1a086d['query'][_0xdc06('0x4d')]){_0x58ee57[_0xdc06('0x4b')]=_[_0xdc06('0x4e')](_0x58ee57[_0xdc06('0x4b')],{'$or':_['map'](_0xdd2e49,function(_0x17bef8){if(_0x17bef8[_0xdc06('0x3e')]!=='VIRTUAL'){var _0x3ea139={};_0x3ea139[_0x17bef8[_0xdc06('0x38')]]={'$like':'%'+_0x1a086d[_0xdc06('0x41')][_0xdc06('0x4d')]+'%'};return _0x3ea139;}})});}_0x58ee57=_[_0xdc06('0x4e')]({},_0x58ee57,_0x1a086d[_0xdc06('0x4f')]);var _0xd94d25={'where':_0x58ee57[_0xdc06('0x4b')]};return db[_0xdc06('0x3c')][_0xdc06('0x50')](_0xd94d25)[_0xdc06('0x21')](function(_0x47bddd){_0x3dfb6e['count']=_0x47bddd;if(_0x1a086d[_0xdc06('0x41')][_0xdc06('0x51')]){_0x58ee57[_0xdc06('0x52')]=[{'all':!![]}];}return db[_0xdc06('0x3c')][_0xdc06('0x53')](_0x58ee57);})[_0xdc06('0x21')](function(_0x53b722){_0x3dfb6e[_0xdc06('0x54')]=_0x53b722;return _0x3dfb6e;})[_0xdc06('0x21')](respondWithFilteredResult(_0x33754d,_0x58ee57))['catch'](handleError(_0x33754d,null));};exports[_0xdc06('0x55')]=function(_0x46382c,_0x2bae65){var _0x4fc376={'raw':![],'where':{'id':_0x46382c[_0xdc06('0x56')]['id']}},_0x21807a={};_0x21807a['model']=_[_0xdc06('0x40')](db['ZohoAccount']['rawAttributes']);_0x21807a[_0xdc06('0x41')]=_[_0xdc06('0x40')](_0x46382c[_0xdc06('0x41')]);_0x21807a['filters']=_[_0xdc06('0x43')](_0x21807a[_0xdc06('0x3f')],_0x21807a['query']);_0x4fc376[_0xdc06('0x44')]=_[_0xdc06('0x43')](_0x21807a['model'],qs[_0xdc06('0x45')](_0x46382c['query']['fields']));_0x4fc376[_0xdc06('0x44')]=_0x4fc376[_0xdc06('0x44')][_0xdc06('0x46')]?_0x4fc376[_0xdc06('0x44')]:_0x21807a['model'];if(_0x46382c['query']['includeAll']){_0x4fc376['include']=[{'all':!![]}];}_0x4fc376=_['merge']({},_0x4fc376,_0x46382c['options']);return db['ZohoAccount'][_0xdc06('0x57')](_0x4fc376)[_0xdc06('0x21')](handleEntityNotFound(_0x2bae65,null))[_0xdc06('0x21')](respondWithResult(_0x2bae65,null))[_0xdc06('0x29')](handleError(_0x2bae65,null));};exports['create']=function(_0x1abf99,_0x572b5a){return db[_0xdc06('0x3c')]['create'](_0x1abf99[_0xdc06('0x58')],{})['then'](respondWithResult(_0x572b5a,0xc9))[_0xdc06('0x29')](handleError(_0x572b5a,null));};exports['update']=function(_0x4a634d,_0x172824){if(_0x4a634d[_0xdc06('0x58')]['id']){delete _0x4a634d['body']['id'];}return db['ZohoAccount'][_0xdc06('0x57')]({'where':{'id':_0x4a634d[_0xdc06('0x56')]['id']}})[_0xdc06('0x21')](handleEntityNotFound(_0x172824,null))[_0xdc06('0x21')](saveUpdates(_0x4a634d[_0xdc06('0x58')],null))[_0xdc06('0x21')](respondWithResult(_0x172824,null))[_0xdc06('0x29')](handleError(_0x172824,null));};exports[_0xdc06('0x35')]=function(_0x16009f,_0xdee814){return db[_0xdc06('0x3c')]['find']({'where':{'id':_0x16009f[_0xdc06('0x56')]['id']}})[_0xdc06('0x21')](handleEntityNotFound(_0xdee814,null))[_0xdc06('0x21')](removeEntity(_0xdee814,null))['catch'](handleError(_0xdee814,null));};exports[_0xdc06('0x59')]=function(_0x41002b,_0x10554a,_0x2815ac){var _0x8abd86={};var _0x656f9b={};var _0x3159b3;var _0x54b63a;return db['ZohoAccount'][_0xdc06('0x5a')]({'where':{'id':_0x41002b[_0xdc06('0x56')]['id']}})['then'](handleEntityNotFound(_0x10554a,null))[_0xdc06('0x21')](function(_0x53ed66){if(_0x53ed66){_0x3159b3=_0x53ed66;_0x656f9b['model']=_['keys'](db[_0xdc06('0x5b')][_0xdc06('0x5c')]);_0x656f9b[_0xdc06('0x41')]=_[_0xdc06('0x40')](_0x41002b['query']);_0x656f9b[_0xdc06('0x42')]=_[_0xdc06('0x43')](_0x656f9b[_0xdc06('0x3f')],_0x656f9b['query']);_0x8abd86['attributes']=_[_0xdc06('0x43')](_0x656f9b['model'],qs[_0xdc06('0x45')](_0x41002b[_0xdc06('0x41')][_0xdc06('0x45')]));_0x8abd86[_0xdc06('0x44')]=_0x8abd86[_0xdc06('0x44')][_0xdc06('0x46')]?_0x8abd86[_0xdc06('0x44')]:_0x656f9b[_0xdc06('0x3f')];_0x8abd86[_0xdc06('0x49')]=qs['sort'](_0x41002b['query'][_0xdc06('0x4a')]);_0x8abd86[_0xdc06('0x4b')]=qs[_0xdc06('0x42')](_[_0xdc06('0x4c')](_0x41002b[_0xdc06('0x41')],_0x656f9b[_0xdc06('0x42')]));if(_0x41002b[_0xdc06('0x41')][_0xdc06('0x4d')]){_0x8abd86[_0xdc06('0x4b')]=_[_0xdc06('0x4e')](_0x8abd86[_0xdc06('0x4b')],{'$or':_[_0xdc06('0x3b')](_0x8abd86[_0xdc06('0x44')],function(_0x593cb8){var _0x12b645={};_0x12b645[_0x593cb8]={'$like':'%'+_0x41002b['query']['filter']+'%'};return _0x12b645;})});}_0x8abd86=_[_0xdc06('0x4e')]({},_0x8abd86,_0x41002b[_0xdc06('0x4f')]);return _0x3159b3[_0xdc06('0x59')](_0x8abd86);}})[_0xdc06('0x21')](function(_0x34b854){if(_0x34b854){_0x54b63a=_0x34b854[_0xdc06('0x46')];if(!_0x41002b['query'][_0xdc06('0x47')](_0xdc06('0x48'))){_0x8abd86['limit']=qs['limit'](_0x41002b['query'][_0xdc06('0x2e')]);_0x8abd86[_0xdc06('0x2d')]=qs[_0xdc06('0x2d')](_0x41002b[_0xdc06('0x41')]['offset']);}return _0x3159b3[_0xdc06('0x59')](_0x8abd86);}})[_0xdc06('0x21')](function(_0x4140a7){if(_0x4140a7){return _0x4140a7?{'count':_0x54b63a,'rows':_0x4140a7}:null;}})['then'](respondWithResult(_0x10554a,null))[_0xdc06('0x29')](handleError(_0x10554a,null));};exports['addConfiguration']=function(_0x4bc5d0,_0x5ab23f,_0x34748a){if(_0x4bc5d0[_0xdc06('0x58')]['id']){delete _0x4bc5d0[_0xdc06('0x58')]['id'];}return db[_0xdc06('0x3c')][_0xdc06('0x5a')]({'where':{'id':_0x4bc5d0[_0xdc06('0x56')]['id']}})['then'](handleEntityNotFound(_0x5ab23f,null))[_0xdc06('0x21')](function(_0x57c22b){if(_0x57c22b){_0x4bc5d0[_0xdc06('0x58')][_0xdc06('0x5d')]=_0x57c22b['id'];_0x4bc5d0['body']['Subjects']=integrations[_0xdc06('0x5e')](_0x4bc5d0['body'][_0xdc06('0x5f')],_0x4bc5d0['body'][_0xdc06('0x3e')]);_0x4bc5d0[_0xdc06('0x58')][_0xdc06('0x60')]=integrations[_0xdc06('0x61')](_0x4bc5d0[_0xdc06('0x58')]['channel'],_0x4bc5d0['body'][_0xdc06('0x3e')]);return db[_0xdc06('0x5b')][_0xdc06('0x62')](_0x4bc5d0[_0xdc06('0x58')],{'include':[{'model':db[_0xdc06('0x63')],'as':_0xdc06('0x64')},{'model':db['ZohoField'],'as':_0xdc06('0x60')}]});}return null;})[_0xdc06('0x21')](respondWithResult(_0x5ab23f,null))[_0xdc06('0x29')](handleError(_0x5ab23f,null));};function getAccessToken(_0x2def4a){return new Promise(function(_0x4623da,_0x37325e){var _0x490e6e;switch(_0x2def4a[_0xdc06('0x65')]){case'US':_0x490e6e=_0xdc06('0x66');break;case'AU':_0x490e6e='https://accounts.zoho.com.au';break;case'EU':_0x490e6e=_0xdc06('0x67');break;case'IN':_0x490e6e='https://accounts.zoho.in';break;case'CN':_0x490e6e='https://accounts.zoho.com.cn';break;default:_0x490e6e=_0xdc06('0x67');break;}var _0x5d82c0={'method':'POST','uri':_0x490e6e+_0xdc06('0x68'),'qs':{'refresh_token':_0x2def4a[_0xdc06('0x69')],'client_id':_0x2def4a[_0xdc06('0x6a')],'client_secret':_0x2def4a[_0xdc06('0x6b')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x5d82c0)[_0xdc06('0x21')](function(_0x1d51b2){if(_0x1d51b2[_0xdc06('0x6c')]){_0x4623da(_0x1d51b2[_0xdc06('0x6c')]);}else{_0x37325e('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})[_0xdc06('0x29')](function(_0x315f2f){_0x37325e(_0x315f2f);});});}exports['getFields']=function(_0x3c0afa,_0x11eb49,_0x293e5a){var _0x2b0d2a,_0x25cb41,_0x436660,_0x5dbfe0,_0x443d73;return db[_0xdc06('0x3c')]['findOne']({'where':{'id':_0x3c0afa[_0xdc06('0x56')]['id']},'attributes':['id',_0xdc06('0x6d'),_0xdc06('0x65'),_0xdc06('0x6a'),_0xdc06('0x6b'),'serverUrl',_0xdc06('0x6e'),_0xdc06('0x69')]})['then'](handleEntityNotFound(_0x11eb49,null))[_0xdc06('0x21')](function(_0x4775c2){_0x443d73=_0x4775c2;_0x2b0d2a=_0x443d73[_0xdc06('0x6d')];_0x25cb41=_0x2b0d2a===_0xdc06('0x6f')?'eu':'com';_0x436660=_0x443d73[_0xdc06('0x70')];var _0x39e1c1=_0x436660[_0xdc06('0x71')](-0x1);if(_0x39e1c1==='/'||_0x39e1c1==='\x5c'||_0x39e1c1===':'){_0x436660=_0x436660[_0xdc06('0x72')](0x0,_0x436660[_0xdc06('0x73')](_0x39e1c1));}if(!_0x443d73[_0xdc06('0x69')]){throw new Error('Refresh\x20Token\x20not\x20available\x20for\x20the\x20account');}return getAccessToken(_0x443d73);})[_0xdc06('0x21')](function(_0x285011){if(_0x285011){return rp({'method':'GET','uri':util[_0xdc06('0x74')](_0xdc06('0x75'),_0x25cb41),'qs':{'module':_0xdc06('0x76')},'headers':{'Authorization':_0xdc06('0x77')+_0x285011},'json':!![]});}})[_0xdc06('0x21')](function(_0x3beaec){if(_0x3beaec){if(_0x3beaec[_0xdc06('0x78')]&&_0x3beaec[_0xdc06('0x78')][_0xdc06('0x26')]){throw new Error(_0x3beaec['response'][_0xdc06('0x26')][_0xdc06('0x27')]);}var _0x231c61=[];var _0x6f149=[];var _0x481421=['Owner',_0xdc06('0x79'),'Description',_0xdc06('0x7a'),_0xdc06('0x7b'),_0xdc06('0x7c'),_0xdc06('0x7d'),_0xdc06('0x7e')];_0x6f149=_['remove'](_0x3beaec[_0xdc06('0x45')],function(_0x113a5b){return _0x481421[_0xdc06('0x7f')](_0x113a5b['api_name']);});for(var _0x510c96=0x0;_0x510c96<_0x6f149[_0xdc06('0x46')];_0x510c96++){if(_0x6f149[_0x510c96][_0xdc06('0x80')]===![]){_0x231c61['push']({'id':_0x6f149[_0x510c96]['id'],'name':_0x6f149[_0x510c96][_0xdc06('0x81')],'custom':_0x6f149[_0x510c96][_0xdc06('0x82')],'options':_0x6f149[_0x510c96]['data_type']===_0xdc06('0x83')&&_0x6f149[_0x510c96]['pick_list_values']['length']>-0x1?_[_0xdc06('0x3b')](_0x6f149[_0x510c96][_0xdc06('0x84')],function(_0x7307d9){return{'name':_0x7307d9,'value':_0x7307d9};}):[]});}}return{'count':_0x231c61['length'],'rows':_0x231c61};}else{return{'count':0x0,'rows':[]};}})[_0xdc06('0x21')](respondWithResult(_0x11eb49,null))[_0xdc06('0x29')](function(_0x3cc8a1){var _0x3152ef=_0x3c0afa['query'][_0xdc06('0x1d')]?0x1f4:_0x3cc8a1[_0xdc06('0x85')]||0x1f4;logger[_0xdc06('0x26')](_0xdc06('0x86'),_0xdc06('0x87'),_0x3152ef,JSON[_0xdc06('0x25')](_0x3cc8a1));delete _0x3cc8a1[_0xdc06('0x38')];if(_0x3152ef===0x191){_0x3152ef=0x190;}_0x11eb49['status'](_0x3152ef)['send'](_0x3c0afa[_0xdc06('0x41')]['test']?{'message':_0xdc06('0x88'),'statusCode':_0x3cc8a1[_0xdc06('0x85')]}:_0x3cc8a1);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index d0bafb7..bc170e8 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 _0x8ba9=['format','inspect','catch','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','slice','https://accounts.zoho.com.au','https://accounts.zoho.com.cn','https://accounts.zoho.eu','info','name','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','ZohoAccount','changed','zone','clientId','host','serverUrl','substring','lastIndexOf','https://accounts.zoho.in','POST','/oauth/v2/token','authorization_code','clientSecret','code','application/x-www-form-urlencoded','then','refresh_token','refreshToken'];(function(_0x1cb18a,_0x33167a){var _0x22442e=function(_0x46c611){while(--_0x46c611){_0x1cb18a['push'](_0x1cb18a['shift']());}};_0x22442e(++_0x33167a);}(_0x8ba9,0x14a));var _0x98ba=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0x8ba9[_0x580576];return _0x3f55a0;};'use strict';var _=require(_0x98ba('0x0'));var util=require(_0x98ba('0x1'));var logger=require(_0x98ba('0x2'))(_0x98ba('0x3'));var moment=require('moment');var BPromise=require(_0x98ba('0x4'));var rp=require(_0x98ba('0x5'));var fs=require('fs');var path=require(_0x98ba('0x6'));var rimraf=require('rimraf');var config=require(_0x98ba('0x7'));var attributes=require(_0x98ba('0x8'));var integrations=require(_0x98ba('0x9'));module[_0x98ba('0xa')]=function(_0x38170b,_0x3f280f){return _0x38170b[_0x98ba('0xb')](_0x98ba('0xc'),attributes,{'tableName':'int_zoho_accounts','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x429f6d,_0x286a68,_0x1dc553){if(_0x429f6d[_0x98ba('0xd')](_0x98ba('0xe'))||_0x429f6d[_0x98ba('0xd')]('serverUrl')||_0x429f6d[_0x98ba('0xd')](_0x98ba('0xf'))||_0x429f6d[_0x98ba('0xd')]('clientSecret')||_0x429f6d[_0x98ba('0xd')]('code')||_0x429f6d[_0x98ba('0xd')](_0x98ba('0x10'))){var _0x550f57,_0x5f3ab1;_0x550f57=_0x429f6d[_0x98ba('0x11')];var _0x55ec57=_0x550f57['slice'](-0x1);if(_0x55ec57==='/'||_0x55ec57==='\x5c'||_0x55ec57===':'){_0x550f57=_0x550f57[_0x98ba('0x12')](0x0,_0x550f57[_0x98ba('0x13')](_0x55ec57));}switch(_0x429f6d[_0x98ba('0xe')]){case'US':_0x5f3ab1='https://accounts.zoho.com';break;case'AU':_0x5f3ab1='https://accounts.zoho.com.au';break;case'IN':_0x5f3ab1=_0x98ba('0x14');break;case'CN':_0x5f3ab1='https://accounts.zoho.com.cn';break;default:_0x5f3ab1='https://accounts.zoho.eu';break;}var _0x1d6bd3={'method':_0x98ba('0x15'),'uri':_0x5f3ab1+_0x98ba('0x16'),'form':{'grant_type':_0x98ba('0x17'),'client_id':_0x429f6d[_0x98ba('0xf')],'client_secret':_0x429f6d[_0x98ba('0x18')],'redirect_uri':_0x429f6d[_0x98ba('0x11')],'code':_0x429f6d[_0x98ba('0x19')]},'headers':{'Content-Type':_0x98ba('0x1a')}};return rp(_0x1d6bd3)[_0x98ba('0x1b')](function(_0x1c1ab2){var _0x58aa07=JSON['parse'](_0x1c1ab2);if(_0x58aa07[_0x98ba('0x1c')]){_0x429f6d[_0x98ba('0x1d')]=_0x58aa07[_0x98ba('0x1c')];logger['info'](util['format']('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x429f6d['name'],_0x429f6d['id']));}else{logger['error'](util[_0x98ba('0x1e')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x429f6d['name'],_0x429f6d['id']),util[_0x98ba('0x1f')](_0x58aa07,{'showHidden':![],'depth':null}));}return _0x1dc553(null,_0x286a68);})[_0x98ba('0x20')](function(_0x22c715){logger['error'](util['format'](_0x98ba('0x21'),_0x429f6d['name'],_0x429f6d['id']),util[_0x98ba('0x1f')](parsedResult,{'showHidden':![],'depth':null}));return _0x1dc553(_0x22c715);});}else{return _0x1dc553(null,_0x286a68);}},'beforeUpdate':function(_0x591d42,_0x17aeac,_0x54046f){if(_0x591d42[_0x98ba('0xd')](_0x98ba('0xe'))||_0x591d42['changed']('serverUrl')||_0x591d42[_0x98ba('0xd')](_0x98ba('0xf'))||_0x591d42[_0x98ba('0xd')]('clientSecret')||_0x591d42[_0x98ba('0xd')](_0x98ba('0x19'))||_0x591d42['changed']('host')){var _0x3fd058,_0x21018e;_0x3fd058=_0x591d42[_0x98ba('0x11')];var _0x5da904=_0x3fd058[_0x98ba('0x22')](-0x1);if(_0x5da904==='/'||_0x5da904==='\x5c'||_0x5da904===':'){_0x3fd058=_0x3fd058['substring'](0x0,_0x3fd058[_0x98ba('0x13')](_0x5da904));}switch(_0x591d42['zone']){case'US':_0x21018e='https://accounts.zoho.com';break;case'AU':_0x21018e=_0x98ba('0x23');break;case'IN':_0x21018e=_0x98ba('0x14');break;case'CN':_0x21018e=_0x98ba('0x24');break;default:_0x21018e=_0x98ba('0x25');break;}var _0x40881f={'method':'POST','uri':_0x21018e+_0x98ba('0x16'),'form':{'grant_type':'authorization_code','client_id':_0x591d42[_0x98ba('0xf')],'client_secret':_0x591d42[_0x98ba('0x18')],'redirect_uri':_0x591d42[_0x98ba('0x11')],'code':_0x591d42[_0x98ba('0x19')]},'headers':{'Content-Type':_0x98ba('0x1a')}};return rp(_0x40881f)[_0x98ba('0x1b')](function(_0x5b749f){var _0x173621=JSON['parse'](_0x5b749f);if(_0x173621['refresh_token']){_0x591d42[_0x98ba('0x1d')]=_0x173621[_0x98ba('0x1c')];logger[_0x98ba('0x26')](util[_0x98ba('0x1e')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x591d42[_0x98ba('0x27')],_0x591d42['id']));}else{logger['error'](util[_0x98ba('0x1e')](_0x98ba('0x21'),_0x591d42[_0x98ba('0x27')],_0x591d42['id']),util[_0x98ba('0x1f')](_0x173621,{'showHidden':![],'depth':null}));}return _0x54046f(null,_0x17aeac);})[_0x98ba('0x20')](function(_0x404283){logger['error'](util[_0x98ba('0x1e')](_0x98ba('0x21'),_0x591d42['name'],_0x591d42['id']),util[_0x98ba('0x1f')](parsedResult,{'showHidden':![],'depth':null}));return _0x54046f(_0x404283);});}else{return _0x54046f(null,_0x17aeac);}}}});}; \ No newline at end of file +var _0x9f8c=['ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','catch','zone','https://accounts.zoho.in','/oauth/v2/token','parse','refreshToken','info','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','lodash','util','api','bluebird','path','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','ZohoAccount','int_zoho_accounts','changed','serverUrl','clientId','clientSecret','host','slice','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','authorization_code','code','application/x-www-form-urlencoded','then','refresh_token','format','name','error'];(function(_0x56f062,_0x1ab396){var _0x17fe67=function(_0x1b99c0){while(--_0x1b99c0){_0x56f062['push'](_0x56f062['shift']());}};_0x17fe67(++_0x1ab396);}(_0x9f8c,0x162));var _0xc9f8=function(_0x3327e3,_0x52758e){_0x3327e3=_0x3327e3-0x0;var _0x1e9859=_0x9f8c[_0x3327e3];return _0x1e9859;};'use strict';var _=require(_0xc9f8('0x0'));var util=require(_0xc9f8('0x1'));var logger=require('../../config/logger')(_0xc9f8('0x2'));var moment=require('moment');var BPromise=require(_0xc9f8('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc9f8('0x4'));var rimraf=require('rimraf');var config=require(_0xc9f8('0x5'));var attributes=require(_0xc9f8('0x6'));var integrations=require(_0xc9f8('0x7'));module[_0xc9f8('0x8')]=function(_0x15ce9b,_0x102710){return _0x15ce9b[_0xc9f8('0x9')](_0xc9f8('0xa'),attributes,{'tableName':_0xc9f8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x385a5c,_0x88c96,_0x289e10){if(_0x385a5c[_0xc9f8('0xc')]('zone')||_0x385a5c[_0xc9f8('0xc')](_0xc9f8('0xd'))||_0x385a5c[_0xc9f8('0xc')](_0xc9f8('0xe'))||_0x385a5c[_0xc9f8('0xc')](_0xc9f8('0xf'))||_0x385a5c[_0xc9f8('0xc')]('code')||_0x385a5c[_0xc9f8('0xc')](_0xc9f8('0x10'))){var _0x5f0a31,_0x59babd;_0x5f0a31=_0x385a5c['serverUrl'];var _0x43c7a5=_0x5f0a31[_0xc9f8('0x11')](-0x1);if(_0x43c7a5==='/'||_0x43c7a5==='\x5c'||_0x43c7a5===':'){_0x5f0a31=_0x5f0a31[_0xc9f8('0x12')](0x0,_0x5f0a31[_0xc9f8('0x13')](_0x43c7a5));}switch(_0x385a5c['zone']){case'US':_0x59babd=_0xc9f8('0x14');break;case'AU':_0x59babd=_0xc9f8('0x15');break;case'IN':_0x59babd='https://accounts.zoho.in';break;case'CN':_0x59babd=_0xc9f8('0x16');break;default:_0x59babd=_0xc9f8('0x17');break;}var _0x5cb9c4={'method':_0xc9f8('0x18'),'uri':_0x59babd+'/oauth/v2/token','form':{'grant_type':_0xc9f8('0x19'),'client_id':_0x385a5c[_0xc9f8('0xe')],'client_secret':_0x385a5c['clientSecret'],'redirect_uri':_0x385a5c['serverUrl'],'code':_0x385a5c[_0xc9f8('0x1a')]},'headers':{'Content-Type':_0xc9f8('0x1b')}};return rp(_0x5cb9c4)[_0xc9f8('0x1c')](function(_0x157e56){var _0x4730c0=JSON['parse'](_0x157e56);if(_0x4730c0['refresh_token']){_0x385a5c['refreshToken']=_0x4730c0[_0xc9f8('0x1d')];logger['info'](util[_0xc9f8('0x1e')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x385a5c[_0xc9f8('0x1f')],_0x385a5c['id']));}else{logger[_0xc9f8('0x20')](util[_0xc9f8('0x1e')](_0xc9f8('0x21'),_0x385a5c[_0xc9f8('0x1f')],_0x385a5c['id']),util[_0xc9f8('0x22')](_0x4730c0,{'showHidden':![],'depth':null}));}return _0x289e10(null,_0x88c96);})[_0xc9f8('0x23')](function(_0xf4b030){logger[_0xc9f8('0x20')](util[_0xc9f8('0x1e')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x385a5c[_0xc9f8('0x1f')],_0x385a5c['id']),util[_0xc9f8('0x22')](parsedResult,{'showHidden':![],'depth':null}));return _0x289e10(_0xf4b030);});}else{return _0x289e10(null,_0x88c96);}},'beforeUpdate':function(_0x2ac84f,_0x4598fb,_0x3b02ca){if(_0x2ac84f[_0xc9f8('0xc')]('zone')||_0x2ac84f[_0xc9f8('0xc')]('serverUrl')||_0x2ac84f[_0xc9f8('0xc')](_0xc9f8('0xe'))||_0x2ac84f[_0xc9f8('0xc')](_0xc9f8('0xf'))||_0x2ac84f[_0xc9f8('0xc')](_0xc9f8('0x1a'))||_0x2ac84f[_0xc9f8('0xc')](_0xc9f8('0x10'))){var _0x2273f0,_0x1ad176;_0x2273f0=_0x2ac84f[_0xc9f8('0xd')];var _0x53e19f=_0x2273f0[_0xc9f8('0x11')](-0x1);if(_0x53e19f==='/'||_0x53e19f==='\x5c'||_0x53e19f===':'){_0x2273f0=_0x2273f0[_0xc9f8('0x12')](0x0,_0x2273f0[_0xc9f8('0x13')](_0x53e19f));}switch(_0x2ac84f[_0xc9f8('0x24')]){case'US':_0x1ad176=_0xc9f8('0x14');break;case'AU':_0x1ad176=_0xc9f8('0x15');break;case'IN':_0x1ad176=_0xc9f8('0x25');break;case'CN':_0x1ad176='https://accounts.zoho.com.cn';break;default:_0x1ad176=_0xc9f8('0x17');break;}var _0x2f12f2={'method':'POST','uri':_0x1ad176+_0xc9f8('0x26'),'form':{'grant_type':_0xc9f8('0x19'),'client_id':_0x2ac84f[_0xc9f8('0xe')],'client_secret':_0x2ac84f['clientSecret'],'redirect_uri':_0x2ac84f['serverUrl'],'code':_0x2ac84f['code']},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x2f12f2)['then'](function(_0x49c837){var _0x20b3bb=JSON[_0xc9f8('0x27')](_0x49c837);if(_0x20b3bb[_0xc9f8('0x1d')]){_0x2ac84f[_0xc9f8('0x28')]=_0x20b3bb[_0xc9f8('0x1d')];logger[_0xc9f8('0x29')](util[_0xc9f8('0x1e')](_0xc9f8('0x2a'),_0x2ac84f[_0xc9f8('0x1f')],_0x2ac84f['id']));}else{logger['error'](util['format'](_0xc9f8('0x21'),_0x2ac84f[_0xc9f8('0x1f')],_0x2ac84f['id']),util[_0xc9f8('0x22')](_0x20b3bb,{'showHidden':![],'depth':null}));}return _0x3b02ca(null,_0x4598fb);})[_0xc9f8('0x23')](function(_0x4cf27e){logger[_0xc9f8('0x20')](util['format'](_0xc9f8('0x21'),_0x2ac84f['name'],_0x2ac84f['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x3b02ca(_0x4cf27e);});}else{return _0x3b02ca(null,_0x4598fb);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index fbabb04..17590af 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 _0x4128=['GetZohoAccount','ZohoAccount','findAll','options','raw','where','include','model','attributes','then','find','map','ShowZohoAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','request','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch'];(function(_0x5447fd,_0x52a6b5){var _0x15b28a=function(_0x370d4f){while(--_0x370d4f){_0x5447fd['push'](_0x5447fd['shift']());}};_0x15b28a(++_0x52a6b5);}(_0x4128,0x1a5));var _0x8412=function(_0x395e49,_0x390eac){_0x395e49=_0x395e49-0x0;var _0x5b9e39=_0x4128[_0x395e49];return _0x5b9e39;};'use strict';var _=require(_0x8412('0x0'));var util=require(_0x8412('0x1'));var moment=require(_0x8412('0x2'));var BPromise=require(_0x8412('0x3'));var rs=require(_0x8412('0x4'));var fs=require('fs');var Redis=require(_0x8412('0x5'));var db=require(_0x8412('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x8412('0x7'))('rpc');var config=require(_0x8412('0x8'));var jayson=require(_0x8412('0x9'));var client=jayson['client'][_0x8412('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x58c017,_0x49b9bb,_0x2b6c91){return new BPromise(function(_0x259221,_0x3d86a8){return client[_0x8412('0xb')](_0x58c017,_0x2b6c91)['then'](function(_0x348845){logger[_0x8412('0xc')](_0x8412('0xd'),_0x49b9bb,_0x8412('0xe'));logger[_0x8412('0xf')]('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x49b9bb,_0x8412('0xe'),JSON[_0x8412('0x10')](_0x348845));if(_0x348845[_0x8412('0x11')]){if(_0x348845[_0x8412('0x11')]['code']===0x1f4){logger['error'](_0x8412('0xd'),_0x49b9bb,_0x348845[_0x8412('0x11')][_0x8412('0x12')]);return _0x3d86a8(_0x348845[_0x8412('0x11')]['message']);}logger[_0x8412('0x11')]('ZohoAccount,\x20%s,\x20%s',_0x49b9bb,_0x348845[_0x8412('0x11')][_0x8412('0x12')]);return _0x259221(_0x348845[_0x8412('0x11')]['message']);}else{logger['info'](_0x8412('0xd'),_0x49b9bb,_0x8412('0xe'));_0x259221(_0x348845[_0x8412('0x13')]['message']);}})[_0x8412('0x14')](function(_0x11667b){logger[_0x8412('0x11')](_0x8412('0xd'),_0x49b9bb,_0x11667b);_0x3d86a8(_0x11667b);});});}exports[_0x8412('0x15')]=function(_0x55fabf){var _0x409c6a=this;return new Promise(function(_0x5eb565,_0x402c6f){return db[_0x8412('0x16')][_0x8412('0x17')]({'raw':_0x55fabf[_0x8412('0x18')]?_0x55fabf[_0x8412('0x18')][_0x8412('0x19')]===undefined?!![]:![]:!![],'where':_0x55fabf[_0x8412('0x18')]?_0x55fabf[_0x8412('0x18')][_0x8412('0x1a')]||null:null,'attributes':_0x55fabf[_0x8412('0x18')]?_0x55fabf['options']['attributes']||null:null,'limit':_0x55fabf[_0x8412('0x18')]?_0x55fabf[_0x8412('0x18')]['limit']||null:null,'include':_0x55fabf['options']?_0x55fabf['options'][_0x8412('0x1b')]?_['map'](_0x55fabf[_0x8412('0x18')][_0x8412('0x1b')],function(_0x4c512c){return{'model':db[_0x4c512c[_0x8412('0x1c')]],'as':_0x4c512c['as'],'attributes':_0x4c512c[_0x8412('0x1d')],'include':_0x4c512c[_0x8412('0x1b')]?_['map'](_0x4c512c['include'],function(_0x132065){return{'model':db[_0x132065[_0x8412('0x1c')]],'as':_0x132065['as'],'attributes':_0x132065[_0x8412('0x1d')],'include':_0x132065[_0x8412('0x1b')]?_['map'](_0x132065[_0x8412('0x1b')],function(_0x2d32cf){return{'model':db[_0x2d32cf['model']],'as':_0x2d32cf['as'],'attributes':_0x2d32cf['attributes']};}):[]};}):[]};}):[]:[]})[_0x8412('0x1e')](function(_0x174c6c){logger['info']('GetZohoAccount',_0x55fabf);logger[_0x8412('0xf')](_0x8412('0x15'),_0x55fabf,JSON[_0x8412('0x10')](_0x174c6c));_0x5eb565(_0x174c6c);})[_0x8412('0x14')](function(_0x19e3a6){logger[_0x8412('0x11')](_0x8412('0x15'),_0x19e3a6[_0x8412('0x12')],_0x55fabf);_0x402c6f(_0x409c6a['error'](0x1f4,_0x19e3a6[_0x8412('0x12')]));});});};exports['ShowZohoAccount']=function(_0x3054a3){var _0x2ef3b5=this;return new Promise(function(_0x317f7a,_0x3ce9ca){return db[_0x8412('0x16')][_0x8412('0x1f')]({'raw':_0x3054a3[_0x8412('0x18')]?_0x3054a3[_0x8412('0x18')][_0x8412('0x19')]===undefined?!![]:![]:!![],'where':_0x3054a3[_0x8412('0x18')]?_0x3054a3[_0x8412('0x18')][_0x8412('0x1a')]||null:null,'attributes':_0x3054a3[_0x8412('0x18')]?_0x3054a3[_0x8412('0x18')][_0x8412('0x1d')]||null:null,'include':_0x3054a3[_0x8412('0x18')]?_0x3054a3['options'][_0x8412('0x1b')]?_['map'](_0x3054a3[_0x8412('0x18')][_0x8412('0x1b')],function(_0x58eb3f){return{'model':db[_0x58eb3f[_0x8412('0x1c')]],'as':_0x58eb3f['as'],'attributes':_0x58eb3f[_0x8412('0x1d')],'include':_0x58eb3f['include']?_['map'](_0x58eb3f[_0x8412('0x1b')],function(_0x18a24b){return{'model':db[_0x18a24b[_0x8412('0x1c')]],'as':_0x18a24b['as'],'attributes':_0x18a24b[_0x8412('0x1d')],'include':_0x18a24b['include']?_[_0x8412('0x20')](_0x18a24b['include'],function(_0x192c26){return{'model':db[_0x192c26['model']],'as':_0x192c26['as'],'attributes':_0x192c26['attributes']};}):[]};}):[]};}):[]:[]})[_0x8412('0x1e')](function(_0x492853){logger[_0x8412('0xc')](_0x8412('0x21'),_0x3054a3);logger[_0x8412('0xf')](_0x8412('0x21'),_0x3054a3,JSON['stringify'](_0x492853));_0x317f7a(_0x492853);})[_0x8412('0x14')](function(_0x2e44fb){logger[_0x8412('0x11')](_0x8412('0x21'),_0x2e44fb['message'],_0x3054a3);_0x3ce9ca(_0x2ef3b5['error'](0x1f4,_0x2e44fb[_0x8412('0x12')]));});});}; \ No newline at end of file +var _0x0fdd=['util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','GetZohoAccount','ZohoAccount','findAll','options','raw','attributes','limit','include','map','model','where','ShowZohoAccount','debug','lodash'];(function(_0x48c826,_0x2123c5){var _0x45b966=function(_0x1c3b9b){while(--_0x1c3b9b){_0x48c826['push'](_0x48c826['shift']());}};_0x45b966(++_0x2123c5);}(_0x0fdd,0x1c6));var _0xd0fd=function(_0x1c2ec4,_0x18c549){_0x1c2ec4=_0x1c2ec4-0x0;var _0xed6c15=_0x0fdd[_0x1c2ec4];return _0xed6c15;};'use strict';var _=require(_0xd0fd('0x0'));var util=require(_0xd0fd('0x1'));var moment=require(_0xd0fd('0x2'));var BPromise=require('bluebird');var rs=require(_0xd0fd('0x3'));var fs=require('fs');var Redis=require(_0xd0fd('0x4'));var db=require(_0xd0fd('0x5'))['db'];var utils=require(_0xd0fd('0x6'));var logger=require(_0xd0fd('0x7'))(_0xd0fd('0x8'));var config=require(_0xd0fd('0x9'));var jayson=require(_0xd0fd('0xa'));var client=jayson[_0xd0fd('0xb')][_0xd0fd('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x8c4b36,_0x14b6ed,_0x22fa2f){return new BPromise(function(_0x551e95,_0x476e94){return client['request'](_0x8c4b36,_0x22fa2f)[_0xd0fd('0xd')](function(_0xdb7c20){logger[_0xd0fd('0xe')](_0xd0fd('0xf'),_0x14b6ed,_0xd0fd('0x10'));logger['debug']('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x14b6ed,_0xd0fd('0x10'),JSON[_0xd0fd('0x11')](_0xdb7c20));if(_0xdb7c20[_0xd0fd('0x12')]){if(_0xdb7c20[_0xd0fd('0x12')]['code']===0x1f4){logger[_0xd0fd('0x12')](_0xd0fd('0xf'),_0x14b6ed,_0xdb7c20[_0xd0fd('0x12')][_0xd0fd('0x13')]);return _0x476e94(_0xdb7c20[_0xd0fd('0x12')][_0xd0fd('0x13')]);}logger[_0xd0fd('0x12')](_0xd0fd('0xf'),_0x14b6ed,_0xdb7c20[_0xd0fd('0x12')][_0xd0fd('0x13')]);return _0x551e95(_0xdb7c20[_0xd0fd('0x12')][_0xd0fd('0x13')]);}else{logger[_0xd0fd('0xe')](_0xd0fd('0xf'),_0x14b6ed,_0xd0fd('0x10'));_0x551e95(_0xdb7c20[_0xd0fd('0x14')][_0xd0fd('0x13')]);}})[_0xd0fd('0x15')](function(_0x2e7b49){logger[_0xd0fd('0x12')](_0xd0fd('0xf'),_0x14b6ed,_0x2e7b49);_0x476e94(_0x2e7b49);});});}exports[_0xd0fd('0x16')]=function(_0x32a4f5){var _0x31a46d=this;return new Promise(function(_0x26a385,_0x33aae9){return db[_0xd0fd('0x17')][_0xd0fd('0x18')]({'raw':_0x32a4f5['options']?_0x32a4f5[_0xd0fd('0x19')][_0xd0fd('0x1a')]===undefined?!![]:![]:!![],'where':_0x32a4f5[_0xd0fd('0x19')]?_0x32a4f5['options']['where']||null:null,'attributes':_0x32a4f5['options']?_0x32a4f5[_0xd0fd('0x19')][_0xd0fd('0x1b')]||null:null,'limit':_0x32a4f5[_0xd0fd('0x19')]?_0x32a4f5[_0xd0fd('0x19')][_0xd0fd('0x1c')]||null:null,'include':_0x32a4f5[_0xd0fd('0x19')]?_0x32a4f5[_0xd0fd('0x19')][_0xd0fd('0x1d')]?_[_0xd0fd('0x1e')](_0x32a4f5[_0xd0fd('0x19')]['include'],function(_0x30ec40){return{'model':db[_0x30ec40[_0xd0fd('0x1f')]],'as':_0x30ec40['as'],'attributes':_0x30ec40[_0xd0fd('0x1b')],'include':_0x30ec40['include']?_[_0xd0fd('0x1e')](_0x30ec40[_0xd0fd('0x1d')],function(_0x1672f9){return{'model':db[_0x1672f9[_0xd0fd('0x1f')]],'as':_0x1672f9['as'],'attributes':_0x1672f9[_0xd0fd('0x1b')],'include':_0x1672f9['include']?_[_0xd0fd('0x1e')](_0x1672f9[_0xd0fd('0x1d')],function(_0x4b3a86){return{'model':db[_0x4b3a86[_0xd0fd('0x1f')]],'as':_0x4b3a86['as'],'attributes':_0x4b3a86[_0xd0fd('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xd0fd('0xd')](function(_0x4e2160){logger[_0xd0fd('0xe')]('GetZohoAccount',_0x32a4f5);logger['debug'](_0xd0fd('0x16'),_0x32a4f5,JSON[_0xd0fd('0x11')](_0x4e2160));_0x26a385(_0x4e2160);})[_0xd0fd('0x15')](function(_0x37ebf5){logger[_0xd0fd('0x12')](_0xd0fd('0x16'),_0x37ebf5[_0xd0fd('0x13')],_0x32a4f5);_0x33aae9(_0x31a46d[_0xd0fd('0x12')](0x1f4,_0x37ebf5['message']));});});};exports['ShowZohoAccount']=function(_0x4f5862){var _0x2cc7e2=this;return new Promise(function(_0x4b9d1b,_0x5c000f){return db['ZohoAccount']['find']({'raw':_0x4f5862[_0xd0fd('0x19')]?_0x4f5862[_0xd0fd('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x4f5862['options']?_0x4f5862[_0xd0fd('0x19')][_0xd0fd('0x20')]||null:null,'attributes':_0x4f5862['options']?_0x4f5862[_0xd0fd('0x19')]['attributes']||null:null,'include':_0x4f5862[_0xd0fd('0x19')]?_0x4f5862['options'][_0xd0fd('0x1d')]?_['map'](_0x4f5862[_0xd0fd('0x19')][_0xd0fd('0x1d')],function(_0x5900bc){return{'model':db[_0x5900bc['model']],'as':_0x5900bc['as'],'attributes':_0x5900bc[_0xd0fd('0x1b')],'include':_0x5900bc[_0xd0fd('0x1d')]?_['map'](_0x5900bc[_0xd0fd('0x1d')],function(_0x46b524){return{'model':db[_0x46b524[_0xd0fd('0x1f')]],'as':_0x46b524['as'],'attributes':_0x46b524[_0xd0fd('0x1b')],'include':_0x46b524['include']?_['map'](_0x46b524[_0xd0fd('0x1d')],function(_0x198dc6){return{'model':db[_0x198dc6[_0xd0fd('0x1f')]],'as':_0x198dc6['as'],'attributes':_0x198dc6[_0xd0fd('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xd0fd('0xd')](function(_0x15b5f2){logger[_0xd0fd('0xe')](_0xd0fd('0x21'),_0x4f5862);logger[_0xd0fd('0x22')](_0xd0fd('0x21'),_0x4f5862,JSON[_0xd0fd('0x11')](_0x15b5f2));_0x4b9d1b(_0x15b5f2);})[_0xd0fd('0x15')](function(_0x170e21){logger[_0xd0fd('0x12')](_0xd0fd('0x21'),_0x170e21[_0xd0fd('0x13')],_0x4f5862);_0x5c000f(_0x2cc7e2[_0xd0fd('0x12')](0x1f4,_0x170e21[_0xd0fd('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 667ea99..9f15582 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 _0x049e=['show','getFields','getSubjects','/:id/descriptions','create','put','update','delete','destroy','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','isAuthenticated','index','get','/:id'];(function(_0x1db6e1,_0x27673b){var _0x2f53ab=function(_0x4947c2){while(--_0x4947c2){_0x1db6e1['push'](_0x1db6e1['shift']());}};_0x2f53ab(++_0x27673b);}(_0x049e,0x16a));var _0xe049=function(_0x5ed54b,_0x3a2827){_0x5ed54b=_0x5ed54b-0x0;var _0x4b58c7=_0x049e[_0x5ed54b];return _0x4b58c7;};'use strict';var multer=require(_0xe049('0x0'));var util=require(_0xe049('0x1'));var path=require('path');var timeout=require(_0xe049('0x2'));var express=require('express');var router=express[_0xe049('0x3')]();var auth=require(_0xe049('0x4'));var interaction=require(_0xe049('0x5'));var config=require(_0xe049('0x6'));var controller=require(_0xe049('0x7'));router['get']('/',auth[_0xe049('0x8')](),controller[_0xe049('0x9')]);router[_0xe049('0xa')](_0xe049('0xb'),auth[_0xe049('0x8')](),controller[_0xe049('0xc')]);router[_0xe049('0xa')]('/:id/fields',auth[_0xe049('0x8')](),controller[_0xe049('0xd')]);router[_0xe049('0xa')]('/:id/subjects',auth['isAuthenticated'](),controller[_0xe049('0xe')]);router[_0xe049('0xa')](_0xe049('0xf'),auth['isAuthenticated'](),controller['getDescriptions']);router['post']('/',auth[_0xe049('0x8')](),controller[_0xe049('0x10')]);router[_0xe049('0x11')](_0xe049('0xb'),auth[_0xe049('0x8')](),controller[_0xe049('0x12')]);router[_0xe049('0x13')](_0xe049('0xb'),auth['isAuthenticated'](),controller[_0xe049('0x14')]);module[_0xe049('0x15')]=router; \ No newline at end of file +var _0x6324=['index','get','/:id','show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','post','create','update','delete','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','./intZohoConfiguration.controller','isAuthenticated'];(function(_0x28f1de,_0x355054){var _0x5b5dad=function(_0x399b72){while(--_0x399b72){_0x28f1de['push'](_0x28f1de['shift']());}};_0x5b5dad(++_0x355054);}(_0x6324,0x142));var _0x4632=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0x6324[_0x18a79d];return _0x4f8848;};'use strict';var multer=require(_0x4632('0x0'));var util=require(_0x4632('0x1'));var path=require(_0x4632('0x2'));var timeout=require(_0x4632('0x3'));var express=require('express');var router=express[_0x4632('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x4632('0x5'));var config=require('../../config/environment');var controller=require(_0x4632('0x6'));router['get']('/',auth[_0x4632('0x7')](),controller[_0x4632('0x8')]);router[_0x4632('0x9')](_0x4632('0xa'),auth['isAuthenticated'](),controller[_0x4632('0xb')]);router[_0x4632('0x9')](_0x4632('0xc'),auth['isAuthenticated'](),controller[_0x4632('0xd')]);router[_0x4632('0x9')]('/:id/subjects',auth['isAuthenticated'](),controller[_0x4632('0xe')]);router[_0x4632('0x9')](_0x4632('0xf'),auth[_0x4632('0x7')](),controller[_0x4632('0x10')]);router[_0x4632('0x11')]('/',auth[_0x4632('0x7')](),controller[_0x4632('0x12')]);router['put'](_0x4632('0xa'),auth['isAuthenticated'](),controller[_0x4632('0x13')]);router[_0x4632('0x14')](_0x4632('0xa'),auth[_0x4632('0x7')](),controller['destroy']);module[_0x4632('0x15')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 95c8cbb..b9d8c85 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 _0xae5b=['sequelize','exports','STRING','ENUM','lead','contact','nothing','contact_lead'];(function(_0x446142,_0x977d0e){var _0xf58be2=function(_0x586abd){while(--_0x586abd){_0x446142['push'](_0x446142['shift']());}};_0xf58be2(++_0x977d0e);}(_0xae5b,0x1b0));var _0xbae5=function(_0x3938b6,_0x651004){_0x3938b6=_0x3938b6-0x0;var _0x3d2f63=_0xae5b[_0x3938b6];return _0x3d2f63;};'use strict';var Sequelize=require(_0xbae5('0x0'));module[_0xbae5('0x1')]={'name':{'type':Sequelize[_0xbae5('0x2')]},'moduleCreate':{'type':Sequelize[_0xbae5('0x3')](_0xbae5('0x4'),_0xbae5('0x5'),_0xbae5('0x6')),'defaultValue':_0xbae5('0x4')},'moduleSearch':{'type':Sequelize[_0xbae5('0x3')](_0xbae5('0x7'),'contact',_0xbae5('0x4')),'defaultValue':_0xbae5('0x7')},'description':{'type':Sequelize[_0xbae5('0x2')]}}; \ No newline at end of file +var _0xab18=['lead','contact','nothing','contact_lead','sequelize','exports','STRING','ENUM'];(function(_0x5c46a5,_0x4eb4df){var _0x2e7013=function(_0x48f0dd){while(--_0x48f0dd){_0x5c46a5['push'](_0x5c46a5['shift']());}};_0x2e7013(++_0x4eb4df);}(_0xab18,0x7c));var _0x8ab1=function(_0x37a0f4,_0x204c9d){_0x37a0f4=_0x37a0f4-0x0;var _0x59df6e=_0xab18[_0x37a0f4];return _0x59df6e;};'use strict';var Sequelize=require(_0x8ab1('0x0'));module[_0x8ab1('0x1')]={'name':{'type':Sequelize[_0x8ab1('0x2')]},'moduleCreate':{'type':Sequelize[_0x8ab1('0x3')](_0x8ab1('0x4'),_0x8ab1('0x5'),_0x8ab1('0x6')),'defaultValue':_0x8ab1('0x4')},'moduleSearch':{'type':Sequelize['ENUM'](_0x8ab1('0x7'),'contact',_0x8ab1('0x4')),'defaultValue':_0x8ab1('0x7')},'description':{'type':Sequelize[_0x8ab1('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index e20bac3..734a7a0 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 _0x9156=['error','message','result','catch','sendStatus','status','end','count','offset','set','Content-Range','json','apply','reject','save','update','destroy','stack','name','send','index','map','ZohoConfiguration','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','show','length','find','create','body','params','getFields','ZohoField','pick','getSubjects','getDescriptions','findOne','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','jayson/promise','client','http','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~!@#$%^&-_=+[{]}.','request','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x2df5e9,_0x3f8482){var _0x44aac3=function(_0x4fbbf4){while(--_0x4fbbf4){_0x2df5e9['push'](_0x2df5e9['shift']());}};_0x44aac3(++_0x3f8482);}(_0x9156,0xef));var _0x6915=function(_0x46c538,_0x551641){_0x46c538=_0x46c538-0x0;var _0x519290=_0x9156[_0x46c538];return _0x519290;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x6915('0x0'));var jsonpatch=require(_0x6915('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x6915('0x2'));var Mustache=require(_0x6915('0x3'));var util=require(_0x6915('0x4'));var path=require('path');var sox=require(_0x6915('0x5'));var csv=require(_0x6915('0x6'));var ejs=require(_0x6915('0x7'));var fs=require('fs');var _=require(_0x6915('0x8'));var squel=require(_0x6915('0x9'));var crypto=require(_0x6915('0xa'));var jsforce=require(_0x6915('0xb'));var deskjs=require(_0x6915('0xc'));var toCsv=require('to-csv');var querystring=require(_0x6915('0xd'));var Papa=require(_0x6915('0xe'));var Redis=require(_0x6915('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x6915('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6915('0x11'));var logger=require(_0x6915('0x12'))('api');var utils=require(_0x6915('0x13'));var config=require('../../config/environment');var db=require(_0x6915('0x14'))['db'];var jayson=require(_0x6915('0x15'));var client=jayson[_0x6915('0x16')][_0x6915('0x17')]({'port':0x232a});function checkPasswordPattern(_0x5a143a,_0x327e73,_0x5f4bda){if(_0x5f4bda){var _0x1ec5a4=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1ec5a4[_0x6915('0x18')](_0x327e73)){return _0x5a143a;}else{throw new db[(_0x6915('0x19'))]['ValidationError'](_0x6915('0x1a'));}}else{return _0x5a143a;}}function respondWithRpcPromise(_0x1a7884,_0x200316,_0x592e,_0x5c25ec){return new BPromise(function(_0x3774e8,_0x56f6dc){var _0x2328d0=_0x5c25ec||client;return _0x2328d0[_0x6915('0x1b')](_0x1a7884,_0x592e)[_0x6915('0x1c')](function(_0x20a78e){logger[_0x6915('0x1d')](_0x6915('0x1e'),_0x200316,_0x6915('0x1f'));logger[_0x6915('0x20')]('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x200316,_0x6915('0x1f'),JSON[_0x6915('0x21')](_0x20a78e));if(_0x20a78e[_0x6915('0x22')]){if(_0x20a78e[_0x6915('0x22')]['code']===0x1f4){logger[_0x6915('0x22')](_0x6915('0x1e'),_0x200316,_0x20a78e[_0x6915('0x22')]['message']);return _0x56f6dc(_0x20a78e['error']['message']);}logger[_0x6915('0x22')](_0x6915('0x1e'),_0x200316,_0x20a78e['error'][_0x6915('0x23')]);return _0x3774e8(_0x20a78e['error']['message']);}else{logger[_0x6915('0x1d')](_0x6915('0x1e'),_0x200316,_0x6915('0x1f'));_0x3774e8(_0x20a78e[_0x6915('0x24')][_0x6915('0x23')]);}})[_0x6915('0x25')](function(_0x11bf33){logger[_0x6915('0x22')]('ZohoConfiguration,\x20%s,\x20%s',_0x200316,_0x11bf33);_0x56f6dc(_0x11bf33);});});}function respondWithStatusCode(_0x1a6085,_0x1c5e08){_0x1c5e08=_0x1c5e08||0xcc;return function(_0x3a6be6){if(_0x3a6be6){return _0x1a6085[_0x6915('0x26')](_0x1c5e08);}return _0x1a6085[_0x6915('0x27')](_0x1c5e08)[_0x6915('0x28')]();};}function respondWithResult(_0xb4bdd8,_0x145e2b){_0x145e2b=_0x145e2b||0xc8;return function(_0x24cbcc){if(_0x24cbcc){return _0xb4bdd8[_0x6915('0x27')](_0x145e2b)['json'](_0x24cbcc);}};}function respondWithFilteredResult(_0x6cb5a4,_0x17f358){return function(_0x465b2a){if(_0x465b2a){var _0x457750=_0x465b2a[_0x6915('0x29')],_0x1cbb7b=_0x17f358[_0x6915('0x2a')],_0x4f06ed=_0x17f358['offset']+_0x17f358['limit'],_0x5d8e91;if(_0x4f06ed>=_0x457750){_0x4f06ed=_0x457750;_0x5d8e91=0xc8;}else{_0x5d8e91=0xce;}_0x6cb5a4['status'](_0x5d8e91);return _0x6cb5a4[_0x6915('0x2b')](_0x6915('0x2c'),_0x1cbb7b+'-'+_0x4f06ed+'/'+_0x457750)[_0x6915('0x2d')](_0x465b2a);}return null;};}function patchUpdates(_0x1becb8){return function(_0x550f16){try{jsonpatch[_0x6915('0x2e')](_0x550f16,_0x1becb8,!![]);}catch(_0x2deb15){return BPromise[_0x6915('0x2f')](_0x2deb15);}return _0x550f16[_0x6915('0x30')]();};}function saveUpdates(_0x1fe2b2,_0x3efc00){return function(_0x4ad5e3){if(_0x4ad5e3){return _0x4ad5e3[_0x6915('0x31')](_0x1fe2b2)['then'](function(_0x1bff29){return _0x1bff29;});}return null;};}function removeEntity(_0x40ca16,_0x4a65e1){return function(_0x209028){if(_0x209028){return _0x209028[_0x6915('0x32')]()[_0x6915('0x1c')](function(){_0x40ca16[_0x6915('0x27')](0xcc)[_0x6915('0x28')]();});}};}function handleEntityNotFound(_0x57d215,_0x35d3a0){return function(_0x407bf3){if(!_0x407bf3){_0x57d215[_0x6915('0x26')](0x194);}return _0x407bf3;};}function handleError(_0x57279d,_0x30937c){_0x30937c=_0x30937c||0x1f4;return function(_0x3103ae){logger[_0x6915('0x22')](_0x3103ae[_0x6915('0x33')]);if(_0x3103ae[_0x6915('0x34')]){delete _0x3103ae['name'];}_0x57279d[_0x6915('0x27')](_0x30937c)[_0x6915('0x35')](_0x3103ae);};}exports[_0x6915('0x36')]=function(_0x1724a1,_0x558823){var _0x5e76bf={},_0x111fcf={},_0x583322={'count':0x0,'rows':[]};var _0x49c7ee=_[_0x6915('0x37')](db[_0x6915('0x38')][_0x6915('0x39')],function(_0x413d0e){return{'name':_0x413d0e['fieldName'],'type':_0x413d0e[_0x6915('0x3a')]['key']};});_0x111fcf[_0x6915('0x3b')]=_[_0x6915('0x37')](_0x49c7ee,_0x6915('0x34'));_0x111fcf[_0x6915('0x3c')]=_[_0x6915('0x3d')](_0x1724a1['query']);_0x111fcf[_0x6915('0x3e')]=_[_0x6915('0x3f')](_0x111fcf[_0x6915('0x3b')],_0x111fcf[_0x6915('0x3c')]);_0x5e76bf[_0x6915('0x40')]=_[_0x6915('0x3f')](_0x111fcf[_0x6915('0x3b')],qs[_0x6915('0x41')](_0x1724a1['query']['fields']));_0x5e76bf[_0x6915('0x40')]=_0x5e76bf[_0x6915('0x40')]['length']?_0x5e76bf[_0x6915('0x40')]:_0x111fcf[_0x6915('0x3b')];if(!_0x1724a1[_0x6915('0x3c')][_0x6915('0x42')](_0x6915('0x43'))){_0x5e76bf[_0x6915('0x44')]=qs[_0x6915('0x44')](_0x1724a1[_0x6915('0x3c')][_0x6915('0x44')]);_0x5e76bf[_0x6915('0x2a')]=qs[_0x6915('0x2a')](_0x1724a1[_0x6915('0x3c')][_0x6915('0x2a')]);}_0x5e76bf[_0x6915('0x45')]=qs[_0x6915('0x46')](_0x1724a1[_0x6915('0x3c')][_0x6915('0x46')]);_0x5e76bf[_0x6915('0x47')]=qs[_0x6915('0x3e')](_['pick'](_0x1724a1['query'],_0x111fcf['filters']),_0x49c7ee);if(_0x1724a1[_0x6915('0x3c')][_0x6915('0x48')]){_0x5e76bf['where']=_[_0x6915('0x49')](_0x5e76bf[_0x6915('0x47')],{'$or':_['map'](_0x49c7ee,function(_0x32c548){if(_0x32c548['type']!==_0x6915('0x4a')){var _0x2cd023={};_0x2cd023[_0x32c548['name']]={'$like':'%'+_0x1724a1[_0x6915('0x3c')][_0x6915('0x48')]+'%'};return _0x2cd023;}})});}_0x5e76bf=_[_0x6915('0x49')]({},_0x5e76bf,_0x1724a1[_0x6915('0x4b')]);var _0x33d448={'where':_0x5e76bf[_0x6915('0x47')]};return db[_0x6915('0x38')]['count'](_0x33d448)[_0x6915('0x1c')](function(_0x13ae58){_0x583322[_0x6915('0x29')]=_0x13ae58;if(_0x1724a1['query']['includeAll']){_0x5e76bf[_0x6915('0x4c')]=[{'all':!![]}];}return db[_0x6915('0x38')][_0x6915('0x4d')](_0x5e76bf);})['then'](function(_0x241eb2){_0x583322[_0x6915('0x4e')]=_0x241eb2;return _0x583322;})[_0x6915('0x1c')](respondWithFilteredResult(_0x558823,_0x5e76bf))['catch'](handleError(_0x558823,null));};exports[_0x6915('0x4f')]=function(_0x3efcd0,_0x2029f6){var _0x1a8f0b={'raw':![],'where':{'id':_0x3efcd0['params']['id']}},_0x1b4100={};_0x1b4100[_0x6915('0x3b')]=_[_0x6915('0x3d')](db[_0x6915('0x38')][_0x6915('0x39')]);_0x1b4100[_0x6915('0x3c')]=_[_0x6915('0x3d')](_0x3efcd0[_0x6915('0x3c')]);_0x1b4100['filters']=_[_0x6915('0x3f')](_0x1b4100['model'],_0x1b4100[_0x6915('0x3c')]);_0x1a8f0b['attributes']=_[_0x6915('0x3f')](_0x1b4100[_0x6915('0x3b')],qs[_0x6915('0x41')](_0x3efcd0['query'][_0x6915('0x41')]));_0x1a8f0b[_0x6915('0x40')]=_0x1a8f0b['attributes'][_0x6915('0x50')]?_0x1a8f0b[_0x6915('0x40')]:_0x1b4100['model'];if(_0x3efcd0['query']['includeAll']){_0x1a8f0b[_0x6915('0x4c')]=[{'all':!![]}];}_0x1a8f0b=_['merge']({},_0x1a8f0b,_0x3efcd0['options']);return db[_0x6915('0x38')][_0x6915('0x51')](_0x1a8f0b)[_0x6915('0x1c')](handleEntityNotFound(_0x2029f6,null))['then'](respondWithResult(_0x2029f6,null))[_0x6915('0x25')](handleError(_0x2029f6,null));};exports[_0x6915('0x52')]=function(_0x56f008,_0x33cd76){return db['ZohoConfiguration']['create'](_0x56f008[_0x6915('0x53')],{})[_0x6915('0x1c')](respondWithResult(_0x33cd76,0xc9))[_0x6915('0x25')](handleError(_0x33cd76,null));};exports[_0x6915('0x31')]=function(_0x19eda1,_0x517b5f){if(_0x19eda1[_0x6915('0x53')]['id']){delete _0x19eda1[_0x6915('0x53')]['id'];}return db[_0x6915('0x38')][_0x6915('0x51')]({'where':{'id':_0x19eda1['params']['id']}})['then'](handleEntityNotFound(_0x517b5f,null))[_0x6915('0x1c')](saveUpdates(_0x19eda1[_0x6915('0x53')],null))[_0x6915('0x1c')](respondWithResult(_0x517b5f,null))[_0x6915('0x25')](handleError(_0x517b5f,null));};exports[_0x6915('0x32')]=function(_0x2e2eeb,_0x80191c){return db[_0x6915('0x38')]['find']({'where':{'id':_0x2e2eeb[_0x6915('0x54')]['id']}})[_0x6915('0x1c')](handleEntityNotFound(_0x80191c,null))['then'](removeEntity(_0x80191c,null))[_0x6915('0x25')](handleError(_0x80191c,null));};exports[_0x6915('0x55')]=function(_0x244cbb,_0x48cdfb,_0x570b5a){var _0x327db9={};var _0x471363={};var _0x374260;var _0x5e52d1;return db[_0x6915('0x38')]['findOne']({'where':{'id':_0x244cbb[_0x6915('0x54')]['id']}})[_0x6915('0x1c')](handleEntityNotFound(_0x48cdfb,null))['then'](function(_0x472b4c){if(_0x472b4c){_0x374260=_0x472b4c;_0x471363[_0x6915('0x3b')]=_[_0x6915('0x3d')](db[_0x6915('0x56')][_0x6915('0x39')]);_0x471363[_0x6915('0x3c')]=_[_0x6915('0x3d')](_0x244cbb['query']);_0x471363['filters']=_[_0x6915('0x3f')](_0x471363[_0x6915('0x3b')],_0x471363[_0x6915('0x3c')]);_0x327db9[_0x6915('0x40')]=_['intersection'](_0x471363[_0x6915('0x3b')],qs[_0x6915('0x41')](_0x244cbb[_0x6915('0x3c')]['fields']));_0x327db9[_0x6915('0x40')]=_0x327db9[_0x6915('0x40')][_0x6915('0x50')]?_0x327db9[_0x6915('0x40')]:_0x471363[_0x6915('0x3b')];_0x327db9[_0x6915('0x45')]=qs['sort'](_0x244cbb[_0x6915('0x3c')][_0x6915('0x46')]);_0x327db9[_0x6915('0x47')]=qs['filters'](_[_0x6915('0x57')](_0x244cbb['query'],_0x471363['filters']));if(_0x244cbb[_0x6915('0x3c')][_0x6915('0x48')]){_0x327db9['where']=_['merge'](_0x327db9[_0x6915('0x47')],{'$or':_[_0x6915('0x37')](_0x327db9['attributes'],function(_0x17d0ae){var _0x38bc45={};_0x38bc45[_0x17d0ae]={'$like':'%'+_0x244cbb[_0x6915('0x3c')][_0x6915('0x48')]+'%'};return _0x38bc45;})});}_0x327db9=_['merge']({},_0x327db9,_0x244cbb[_0x6915('0x4b')]);return _0x374260[_0x6915('0x55')](_0x327db9);}})['then'](function(_0x130e63){if(_0x130e63){_0x5e52d1=_0x130e63[_0x6915('0x50')];if(!_0x244cbb[_0x6915('0x3c')][_0x6915('0x42')]('nolimit')){_0x327db9[_0x6915('0x44')]=qs['limit'](_0x244cbb['query'][_0x6915('0x44')]);_0x327db9['offset']=qs[_0x6915('0x2a')](_0x244cbb[_0x6915('0x3c')]['offset']);}return _0x374260[_0x6915('0x55')](_0x327db9);}})[_0x6915('0x1c')](function(_0x4f1b01){if(_0x4f1b01){return _0x4f1b01?{'count':_0x5e52d1,'rows':_0x4f1b01}:null;}})[_0x6915('0x1c')](respondWithResult(_0x48cdfb,null))['catch'](handleError(_0x48cdfb,null));};exports['getSubjects']=function(_0x44af90,_0x7cd09a,_0x42115c){var _0x3eb603={};var _0x3ef554={};var _0x597e19;var _0x3f0ef1;return db['ZohoConfiguration']['findOne']({'where':{'id':_0x44af90['params']['id']}})[_0x6915('0x1c')](handleEntityNotFound(_0x7cd09a,null))[_0x6915('0x1c')](function(_0x25813a){if(_0x25813a){_0x597e19=_0x25813a;_0x3ef554[_0x6915('0x3b')]=_['keys'](db[_0x6915('0x56')][_0x6915('0x39')]);_0x3ef554[_0x6915('0x3c')]=_['keys'](_0x44af90[_0x6915('0x3c')]);_0x3ef554['filters']=_['intersection'](_0x3ef554[_0x6915('0x3b')],_0x3ef554['query']);_0x3eb603[_0x6915('0x40')]=_[_0x6915('0x3f')](_0x3ef554[_0x6915('0x3b')],qs[_0x6915('0x41')](_0x44af90[_0x6915('0x3c')][_0x6915('0x41')]));_0x3eb603['attributes']=_0x3eb603[_0x6915('0x40')][_0x6915('0x50')]?_0x3eb603['attributes']:_0x3ef554[_0x6915('0x3b')];_0x3eb603[_0x6915('0x45')]=qs[_0x6915('0x46')](_0x44af90[_0x6915('0x3c')][_0x6915('0x46')]);_0x3eb603['where']=qs[_0x6915('0x3e')](_[_0x6915('0x57')](_0x44af90[_0x6915('0x3c')],_0x3ef554[_0x6915('0x3e')]));if(_0x44af90[_0x6915('0x3c')][_0x6915('0x48')]){_0x3eb603[_0x6915('0x47')]=_[_0x6915('0x49')](_0x3eb603[_0x6915('0x47')],{'$or':_[_0x6915('0x37')](_0x3eb603[_0x6915('0x40')],function(_0x2be883){var _0x56c962={};_0x56c962[_0x2be883]={'$like':'%'+_0x44af90['query'][_0x6915('0x48')]+'%'};return _0x56c962;})});}_0x3eb603=_['merge']({},_0x3eb603,_0x44af90[_0x6915('0x4b')]);return _0x597e19[_0x6915('0x58')](_0x3eb603);}})[_0x6915('0x1c')](function(_0x52fc09){if(_0x52fc09){_0x3f0ef1=_0x52fc09[_0x6915('0x50')];if(!_0x44af90[_0x6915('0x3c')]['hasOwnProperty'](_0x6915('0x43'))){_0x3eb603['limit']=qs[_0x6915('0x44')](_0x44af90[_0x6915('0x3c')][_0x6915('0x44')]);_0x3eb603[_0x6915('0x2a')]=qs[_0x6915('0x2a')](_0x44af90[_0x6915('0x3c')]['offset']);}return _0x597e19[_0x6915('0x58')](_0x3eb603);}})['then'](function(_0x9f0fb2){if(_0x9f0fb2){return _0x9f0fb2?{'count':_0x3f0ef1,'rows':_0x9f0fb2}:null;}})[_0x6915('0x1c')](respondWithResult(_0x7cd09a,null))['catch'](handleError(_0x7cd09a,null));};exports[_0x6915('0x59')]=function(_0x2424c6,_0x300e93,_0xd06b90){var _0x23ab91={};var _0xa99d6f={};var _0x21ac38;var _0x41b8f7;return db['ZohoConfiguration'][_0x6915('0x5a')]({'where':{'id':_0x2424c6[_0x6915('0x54')]['id']}})[_0x6915('0x1c')](handleEntityNotFound(_0x300e93,null))[_0x6915('0x1c')](function(_0x47c0d0){if(_0x47c0d0){_0x21ac38=_0x47c0d0;_0xa99d6f['model']=_[_0x6915('0x3d')](db['ZohoField'][_0x6915('0x39')]);_0xa99d6f[_0x6915('0x3c')]=_[_0x6915('0x3d')](_0x2424c6[_0x6915('0x3c')]);_0xa99d6f[_0x6915('0x3e')]=_[_0x6915('0x3f')](_0xa99d6f[_0x6915('0x3b')],_0xa99d6f[_0x6915('0x3c')]);_0x23ab91[_0x6915('0x40')]=_['intersection'](_0xa99d6f['model'],qs[_0x6915('0x41')](_0x2424c6[_0x6915('0x3c')][_0x6915('0x41')]));_0x23ab91[_0x6915('0x40')]=_0x23ab91['attributes'][_0x6915('0x50')]?_0x23ab91[_0x6915('0x40')]:_0xa99d6f[_0x6915('0x3b')];_0x23ab91[_0x6915('0x45')]=qs[_0x6915('0x46')](_0x2424c6['query'][_0x6915('0x46')]);_0x23ab91['where']=qs[_0x6915('0x3e')](_[_0x6915('0x57')](_0x2424c6[_0x6915('0x3c')],_0xa99d6f[_0x6915('0x3e')]));if(_0x2424c6[_0x6915('0x3c')][_0x6915('0x48')]){_0x23ab91['where']=_['merge'](_0x23ab91[_0x6915('0x47')],{'$or':_[_0x6915('0x37')](_0x23ab91[_0x6915('0x40')],function(_0x46f70c){var _0x87f859={};_0x87f859[_0x46f70c]={'$like':'%'+_0x2424c6[_0x6915('0x3c')]['filter']+'%'};return _0x87f859;})});}_0x23ab91=_[_0x6915('0x49')]({},_0x23ab91,_0x2424c6['options']);return _0x21ac38[_0x6915('0x59')](_0x23ab91);}})[_0x6915('0x1c')](function(_0x220475){if(_0x220475){_0x41b8f7=_0x220475[_0x6915('0x50')];if(!_0x2424c6['query']['hasOwnProperty'](_0x6915('0x43'))){_0x23ab91['limit']=qs['limit'](_0x2424c6[_0x6915('0x3c')]['limit']);_0x23ab91[_0x6915('0x2a')]=qs[_0x6915('0x2a')](_0x2424c6[_0x6915('0x3c')][_0x6915('0x2a')]);}return _0x21ac38[_0x6915('0x59')](_0x23ab91);}})['then'](function(_0x44fe29){if(_0x44fe29){return _0x44fe29?{'count':_0x41b8f7,'rows':_0x44fe29}:null;}})[_0x6915('0x1c')](respondWithResult(_0x300e93,null))['catch'](handleError(_0x300e93,null));}; \ No newline at end of file +var _0x44c2=['update','destroy','stack','name','send','map','type','model','query','intersection','fields','attributes','length','order','sort','where','filters','filter','merge','options','ZohoConfiguration','includeAll','include','findAll','rows','show','rawAttributes','keys','find','catch','create','body','params','getFields','findOne','pick','hasOwnProperty','nolimit','ZohoField','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','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~!@#$%^&-_=+[{]}.','request','then','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','end','status','json','count','offset','limit','set','Content-Range','apply','reject'];(function(_0x19dd8a,_0x4af545){var _0x6245d3=function(_0x16e70b){while(--_0x16e70b){_0x19dd8a['push'](_0x19dd8a['shift']());}};_0x6245d3(++_0x4af545);}(_0x44c2,0x1ad));var _0x244c=function(_0x4f32de,_0x5bd4a){_0x4f32de=_0x4f32de-0x0;var _0x149821=_0x44c2[_0x4f32de];return _0x149821;};'use strict';var pdf=require(_0x244c('0x0'));var emlformat=require(_0x244c('0x1'));var rimraf=require(_0x244c('0x2'));var zipdir=require(_0x244c('0x3'));var jsonpatch=require(_0x244c('0x4'));var rp=require(_0x244c('0x5'));var moment=require(_0x244c('0x6'));var BPromise=require(_0x244c('0x7'));var Mustache=require(_0x244c('0x8'));var util=require(_0x244c('0x9'));var path=require(_0x244c('0xa'));var sox=require(_0x244c('0xb'));var csv=require(_0x244c('0xc'));var ejs=require(_0x244c('0xd'));var fs=require('fs');var _=require(_0x244c('0xe'));var squel=require(_0x244c('0xf'));var crypto=require(_0x244c('0x10'));var jsforce=require('jsforce');var deskjs=require(_0x244c('0x11'));var toCsv=require(_0x244c('0xc'));var querystring=require(_0x244c('0x12'));var Papa=require(_0x244c('0x13'));var Redis=require(_0x244c('0x14'));var authService=require(_0x244c('0x15'));var qs=require(_0x244c('0x16'));var as=require(_0x244c('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x244c('0x18'))(_0x244c('0x19'));var utils=require(_0x244c('0x1a'));var config=require(_0x244c('0x1b'));var db=require(_0x244c('0x1c'))['db'];var jayson=require(_0x244c('0x1d'));var client=jayson[_0x244c('0x1e')][_0x244c('0x1f')]({'port':0x232a});function checkPasswordPattern(_0x1f3b47,_0x42a3c7,_0x2ff75a){if(_0x2ff75a){var _0x38b9ac=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x38b9ac[_0x244c('0x20')](_0x42a3c7)){return _0x1f3b47;}else{throw new db[(_0x244c('0x21'))]['ValidationError'](_0x244c('0x22'));}}else{return _0x1f3b47;}}function respondWithRpcPromise(_0x1ad47f,_0x5acf22,_0x2b712c,_0x1f15a4){return new BPromise(function(_0x5719d3,_0x4a6362){var _0x190c7e=_0x1f15a4||client;return _0x190c7e[_0x244c('0x23')](_0x1ad47f,_0x2b712c)[_0x244c('0x24')](function(_0x4aa526){logger['info'](_0x244c('0x25'),_0x5acf22,_0x244c('0x26'));logger[_0x244c('0x27')](_0x244c('0x28'),_0x5acf22,_0x244c('0x26'),JSON[_0x244c('0x29')](_0x4aa526));if(_0x4aa526[_0x244c('0x2a')]){if(_0x4aa526[_0x244c('0x2a')]['code']===0x1f4){logger['error'](_0x244c('0x25'),_0x5acf22,_0x4aa526[_0x244c('0x2a')]['message']);return _0x4a6362(_0x4aa526[_0x244c('0x2a')]['message']);}logger[_0x244c('0x2a')]('ZohoConfiguration,\x20%s,\x20%s',_0x5acf22,_0x4aa526['error'][_0x244c('0x2b')]);return _0x5719d3(_0x4aa526[_0x244c('0x2a')][_0x244c('0x2b')]);}else{logger[_0x244c('0x2c')](_0x244c('0x25'),_0x5acf22,_0x244c('0x26'));_0x5719d3(_0x4aa526[_0x244c('0x2d')][_0x244c('0x2b')]);}})['catch'](function(_0x53bf75){logger[_0x244c('0x2a')](_0x244c('0x25'),_0x5acf22,_0x53bf75);_0x4a6362(_0x53bf75);});});}function respondWithStatusCode(_0x169889,_0x120f9f){_0x120f9f=_0x120f9f||0xcc;return function(_0x55fe2e){if(_0x55fe2e){return _0x169889['sendStatus'](_0x120f9f);}return _0x169889['status'](_0x120f9f)[_0x244c('0x2e')]();};}function respondWithResult(_0x18ffba,_0x55efd2){_0x55efd2=_0x55efd2||0xc8;return function(_0x14be8a){if(_0x14be8a){return _0x18ffba[_0x244c('0x2f')](_0x55efd2)[_0x244c('0x30')](_0x14be8a);}};}function respondWithFilteredResult(_0x17e020,_0x3742d5){return function(_0x5ee36d){if(_0x5ee36d){var _0x5c5f32=_0x5ee36d[_0x244c('0x31')],_0x15939b=_0x3742d5[_0x244c('0x32')],_0xbcd8be=_0x3742d5[_0x244c('0x32')]+_0x3742d5[_0x244c('0x33')],_0x512641;if(_0xbcd8be>=_0x5c5f32){_0xbcd8be=_0x5c5f32;_0x512641=0xc8;}else{_0x512641=0xce;}_0x17e020[_0x244c('0x2f')](_0x512641);return _0x17e020[_0x244c('0x34')](_0x244c('0x35'),_0x15939b+'-'+_0xbcd8be+'/'+_0x5c5f32)[_0x244c('0x30')](_0x5ee36d);}return null;};}function patchUpdates(_0x231c5e){return function(_0x4e8669){try{jsonpatch[_0x244c('0x36')](_0x4e8669,_0x231c5e,!![]);}catch(_0x573d4d){return BPromise[_0x244c('0x37')](_0x573d4d);}return _0x4e8669['save']();};}function saveUpdates(_0x191343,_0x52a684){return function(_0x4f1c72){if(_0x4f1c72){return _0x4f1c72[_0x244c('0x38')](_0x191343)[_0x244c('0x24')](function(_0x3b9c26){return _0x3b9c26;});}return null;};}function removeEntity(_0x2dde42,_0x112187){return function(_0x3f63bf){if(_0x3f63bf){return _0x3f63bf[_0x244c('0x39')]()[_0x244c('0x24')](function(){_0x2dde42['status'](0xcc)[_0x244c('0x2e')]();});}};}function handleEntityNotFound(_0x3c0181,_0x2db5e9){return function(_0x2d0562){if(!_0x2d0562){_0x3c0181['sendStatus'](0x194);}return _0x2d0562;};}function handleError(_0x59f164,_0x181a3a){_0x181a3a=_0x181a3a||0x1f4;return function(_0x5d4bf){logger[_0x244c('0x2a')](_0x5d4bf[_0x244c('0x3a')]);if(_0x5d4bf['name']){delete _0x5d4bf[_0x244c('0x3b')];}_0x59f164[_0x244c('0x2f')](_0x181a3a)[_0x244c('0x3c')](_0x5d4bf);};}exports['index']=function(_0x321a7b,_0x2b5604){var _0x45feba={},_0x215c2c={},_0xd36276={'count':0x0,'rows':[]};var _0x1c6bac=_[_0x244c('0x3d')](db['ZohoConfiguration']['rawAttributes'],function(_0xc7f866){return{'name':_0xc7f866['fieldName'],'type':_0xc7f866[_0x244c('0x3e')]['key']};});_0x215c2c[_0x244c('0x3f')]=_['map'](_0x1c6bac,_0x244c('0x3b'));_0x215c2c[_0x244c('0x40')]=_['keys'](_0x321a7b[_0x244c('0x40')]);_0x215c2c['filters']=_[_0x244c('0x41')](_0x215c2c[_0x244c('0x3f')],_0x215c2c[_0x244c('0x40')]);_0x45feba['attributes']=_[_0x244c('0x41')](_0x215c2c['model'],qs[_0x244c('0x42')](_0x321a7b['query'][_0x244c('0x42')]));_0x45feba[_0x244c('0x43')]=_0x45feba[_0x244c('0x43')][_0x244c('0x44')]?_0x45feba[_0x244c('0x43')]:_0x215c2c['model'];if(!_0x321a7b[_0x244c('0x40')]['hasOwnProperty']('nolimit')){_0x45feba['limit']=qs[_0x244c('0x33')](_0x321a7b['query']['limit']);_0x45feba[_0x244c('0x32')]=qs['offset'](_0x321a7b['query'][_0x244c('0x32')]);}_0x45feba[_0x244c('0x45')]=qs[_0x244c('0x46')](_0x321a7b[_0x244c('0x40')][_0x244c('0x46')]);_0x45feba[_0x244c('0x47')]=qs['filters'](_['pick'](_0x321a7b['query'],_0x215c2c[_0x244c('0x48')]),_0x1c6bac);if(_0x321a7b[_0x244c('0x40')][_0x244c('0x49')]){_0x45feba['where']=_['merge'](_0x45feba[_0x244c('0x47')],{'$or':_[_0x244c('0x3d')](_0x1c6bac,function(_0x3e5db9){if(_0x3e5db9[_0x244c('0x3e')]!=='VIRTUAL'){var _0x9ac7d4={};_0x9ac7d4[_0x3e5db9[_0x244c('0x3b')]]={'$like':'%'+_0x321a7b[_0x244c('0x40')]['filter']+'%'};return _0x9ac7d4;}})});}_0x45feba=_[_0x244c('0x4a')]({},_0x45feba,_0x321a7b[_0x244c('0x4b')]);var _0x2ccb65={'where':_0x45feba[_0x244c('0x47')]};return db[_0x244c('0x4c')]['count'](_0x2ccb65)['then'](function(_0x282367){_0xd36276['count']=_0x282367;if(_0x321a7b[_0x244c('0x40')][_0x244c('0x4d')]){_0x45feba[_0x244c('0x4e')]=[{'all':!![]}];}return db['ZohoConfiguration'][_0x244c('0x4f')](_0x45feba);})['then'](function(_0x44ba4c){_0xd36276[_0x244c('0x50')]=_0x44ba4c;return _0xd36276;})['then'](respondWithFilteredResult(_0x2b5604,_0x45feba))['catch'](handleError(_0x2b5604,null));};exports[_0x244c('0x51')]=function(_0x984237,_0x14e037){var _0x4b50e8={'raw':![],'where':{'id':_0x984237['params']['id']}},_0x248de9={};_0x248de9[_0x244c('0x3f')]=_['keys'](db['ZohoConfiguration'][_0x244c('0x52')]);_0x248de9[_0x244c('0x40')]=_[_0x244c('0x53')](_0x984237[_0x244c('0x40')]);_0x248de9[_0x244c('0x48')]=_[_0x244c('0x41')](_0x248de9[_0x244c('0x3f')],_0x248de9[_0x244c('0x40')]);_0x4b50e8[_0x244c('0x43')]=_[_0x244c('0x41')](_0x248de9[_0x244c('0x3f')],qs[_0x244c('0x42')](_0x984237[_0x244c('0x40')][_0x244c('0x42')]));_0x4b50e8[_0x244c('0x43')]=_0x4b50e8[_0x244c('0x43')][_0x244c('0x44')]?_0x4b50e8[_0x244c('0x43')]:_0x248de9[_0x244c('0x3f')];if(_0x984237[_0x244c('0x40')]['includeAll']){_0x4b50e8[_0x244c('0x4e')]=[{'all':!![]}];}_0x4b50e8=_[_0x244c('0x4a')]({},_0x4b50e8,_0x984237[_0x244c('0x4b')]);return db[_0x244c('0x4c')][_0x244c('0x54')](_0x4b50e8)[_0x244c('0x24')](handleEntityNotFound(_0x14e037,null))[_0x244c('0x24')](respondWithResult(_0x14e037,null))[_0x244c('0x55')](handleError(_0x14e037,null));};exports[_0x244c('0x56')]=function(_0x582144,_0x11947b){return db[_0x244c('0x4c')][_0x244c('0x56')](_0x582144['body'],{})['then'](respondWithResult(_0x11947b,0xc9))[_0x244c('0x55')](handleError(_0x11947b,null));};exports['update']=function(_0x4b7f63,_0x2a4d53){if(_0x4b7f63[_0x244c('0x57')]['id']){delete _0x4b7f63[_0x244c('0x57')]['id'];}return db[_0x244c('0x4c')][_0x244c('0x54')]({'where':{'id':_0x4b7f63[_0x244c('0x58')]['id']}})[_0x244c('0x24')](handleEntityNotFound(_0x2a4d53,null))[_0x244c('0x24')](saveUpdates(_0x4b7f63[_0x244c('0x57')],null))[_0x244c('0x24')](respondWithResult(_0x2a4d53,null))['catch'](handleError(_0x2a4d53,null));};exports[_0x244c('0x39')]=function(_0x2ee2ea,_0x531334){return db['ZohoConfiguration']['find']({'where':{'id':_0x2ee2ea[_0x244c('0x58')]['id']}})['then'](handleEntityNotFound(_0x531334,null))[_0x244c('0x24')](removeEntity(_0x531334,null))[_0x244c('0x55')](handleError(_0x531334,null));};exports[_0x244c('0x59')]=function(_0x26bf24,_0x52db96,_0x1d700f){var _0x463bf8={};var _0x4b11bb={};var _0x14423d;var _0x9d92d5;return db['ZohoConfiguration'][_0x244c('0x5a')]({'where':{'id':_0x26bf24['params']['id']}})['then'](handleEntityNotFound(_0x52db96,null))[_0x244c('0x24')](function(_0xb95117){if(_0xb95117){_0x14423d=_0xb95117;_0x4b11bb['model']=_[_0x244c('0x53')](db['ZohoField'][_0x244c('0x52')]);_0x4b11bb[_0x244c('0x40')]=_['keys'](_0x26bf24[_0x244c('0x40')]);_0x4b11bb[_0x244c('0x48')]=_['intersection'](_0x4b11bb[_0x244c('0x3f')],_0x4b11bb[_0x244c('0x40')]);_0x463bf8[_0x244c('0x43')]=_[_0x244c('0x41')](_0x4b11bb[_0x244c('0x3f')],qs[_0x244c('0x42')](_0x26bf24[_0x244c('0x40')][_0x244c('0x42')]));_0x463bf8[_0x244c('0x43')]=_0x463bf8[_0x244c('0x43')][_0x244c('0x44')]?_0x463bf8[_0x244c('0x43')]:_0x4b11bb[_0x244c('0x3f')];_0x463bf8[_0x244c('0x45')]=qs[_0x244c('0x46')](_0x26bf24['query'][_0x244c('0x46')]);_0x463bf8['where']=qs[_0x244c('0x48')](_[_0x244c('0x5b')](_0x26bf24[_0x244c('0x40')],_0x4b11bb[_0x244c('0x48')]));if(_0x26bf24[_0x244c('0x40')][_0x244c('0x49')]){_0x463bf8['where']=_[_0x244c('0x4a')](_0x463bf8[_0x244c('0x47')],{'$or':_['map'](_0x463bf8[_0x244c('0x43')],function(_0x21f200){var _0x21aad3={};_0x21aad3[_0x21f200]={'$like':'%'+_0x26bf24[_0x244c('0x40')][_0x244c('0x49')]+'%'};return _0x21aad3;})});}_0x463bf8=_[_0x244c('0x4a')]({},_0x463bf8,_0x26bf24[_0x244c('0x4b')]);return _0x14423d[_0x244c('0x59')](_0x463bf8);}})[_0x244c('0x24')](function(_0x49be5d){if(_0x49be5d){_0x9d92d5=_0x49be5d[_0x244c('0x44')];if(!_0x26bf24['query'][_0x244c('0x5c')](_0x244c('0x5d'))){_0x463bf8[_0x244c('0x33')]=qs[_0x244c('0x33')](_0x26bf24[_0x244c('0x40')]['limit']);_0x463bf8['offset']=qs['offset'](_0x26bf24[_0x244c('0x40')][_0x244c('0x32')]);}return _0x14423d[_0x244c('0x59')](_0x463bf8);}})['then'](function(_0x5afb6b){if(_0x5afb6b){return _0x5afb6b?{'count':_0x9d92d5,'rows':_0x5afb6b}:null;}})[_0x244c('0x24')](respondWithResult(_0x52db96,null))[_0x244c('0x55')](handleError(_0x52db96,null));};exports['getSubjects']=function(_0x13895f,_0x826722,_0x9bd900){var _0xc4d093={};var _0x224d84={};var _0x699288;var _0x35ca62;return db[_0x244c('0x4c')][_0x244c('0x5a')]({'where':{'id':_0x13895f['params']['id']}})[_0x244c('0x24')](handleEntityNotFound(_0x826722,null))['then'](function(_0x1afa40){if(_0x1afa40){_0x699288=_0x1afa40;_0x224d84['model']=_[_0x244c('0x53')](db[_0x244c('0x5e')][_0x244c('0x52')]);_0x224d84['query']=_[_0x244c('0x53')](_0x13895f['query']);_0x224d84[_0x244c('0x48')]=_['intersection'](_0x224d84[_0x244c('0x3f')],_0x224d84['query']);_0xc4d093['attributes']=_[_0x244c('0x41')](_0x224d84[_0x244c('0x3f')],qs[_0x244c('0x42')](_0x13895f[_0x244c('0x40')]['fields']));_0xc4d093[_0x244c('0x43')]=_0xc4d093['attributes'][_0x244c('0x44')]?_0xc4d093[_0x244c('0x43')]:_0x224d84['model'];_0xc4d093[_0x244c('0x45')]=qs[_0x244c('0x46')](_0x13895f[_0x244c('0x40')][_0x244c('0x46')]);_0xc4d093[_0x244c('0x47')]=qs[_0x244c('0x48')](_[_0x244c('0x5b')](_0x13895f['query'],_0x224d84[_0x244c('0x48')]));if(_0x13895f['query'][_0x244c('0x49')]){_0xc4d093[_0x244c('0x47')]=_['merge'](_0xc4d093[_0x244c('0x47')],{'$or':_['map'](_0xc4d093[_0x244c('0x43')],function(_0x58d7ae){var _0x32d10d={};_0x32d10d[_0x58d7ae]={'$like':'%'+_0x13895f[_0x244c('0x40')]['filter']+'%'};return _0x32d10d;})});}_0xc4d093=_['merge']({},_0xc4d093,_0x13895f[_0x244c('0x4b')]);return _0x699288[_0x244c('0x5f')](_0xc4d093);}})[_0x244c('0x24')](function(_0x56df67){if(_0x56df67){_0x35ca62=_0x56df67[_0x244c('0x44')];if(!_0x13895f[_0x244c('0x40')][_0x244c('0x5c')]('nolimit')){_0xc4d093[_0x244c('0x33')]=qs[_0x244c('0x33')](_0x13895f[_0x244c('0x40')][_0x244c('0x33')]);_0xc4d093['offset']=qs[_0x244c('0x32')](_0x13895f[_0x244c('0x40')]['offset']);}return _0x699288['getSubjects'](_0xc4d093);}})[_0x244c('0x24')](function(_0x4e6597){if(_0x4e6597){return _0x4e6597?{'count':_0x35ca62,'rows':_0x4e6597}:null;}})[_0x244c('0x24')](respondWithResult(_0x826722,null))[_0x244c('0x55')](handleError(_0x826722,null));};exports['getDescriptions']=function(_0x101f3d,_0x3c6e23,_0xa85c0c){var _0x10eacb={};var _0x1a73ac={};var _0x5c2b4f;var _0x5e708e;return db[_0x244c('0x4c')][_0x244c('0x5a')]({'where':{'id':_0x101f3d['params']['id']}})[_0x244c('0x24')](handleEntityNotFound(_0x3c6e23,null))[_0x244c('0x24')](function(_0x530434){if(_0x530434){_0x5c2b4f=_0x530434;_0x1a73ac[_0x244c('0x3f')]=_[_0x244c('0x53')](db['ZohoField'][_0x244c('0x52')]);_0x1a73ac[_0x244c('0x40')]=_[_0x244c('0x53')](_0x101f3d[_0x244c('0x40')]);_0x1a73ac[_0x244c('0x48')]=_[_0x244c('0x41')](_0x1a73ac[_0x244c('0x3f')],_0x1a73ac['query']);_0x10eacb['attributes']=_[_0x244c('0x41')](_0x1a73ac[_0x244c('0x3f')],qs['fields'](_0x101f3d[_0x244c('0x40')][_0x244c('0x42')]));_0x10eacb[_0x244c('0x43')]=_0x10eacb[_0x244c('0x43')][_0x244c('0x44')]?_0x10eacb[_0x244c('0x43')]:_0x1a73ac[_0x244c('0x3f')];_0x10eacb['order']=qs[_0x244c('0x46')](_0x101f3d['query'][_0x244c('0x46')]);_0x10eacb[_0x244c('0x47')]=qs[_0x244c('0x48')](_[_0x244c('0x5b')](_0x101f3d['query'],_0x1a73ac[_0x244c('0x48')]));if(_0x101f3d[_0x244c('0x40')][_0x244c('0x49')]){_0x10eacb['where']=_[_0x244c('0x4a')](_0x10eacb[_0x244c('0x47')],{'$or':_['map'](_0x10eacb[_0x244c('0x43')],function(_0x200fa8){var _0x8ac12b={};_0x8ac12b[_0x200fa8]={'$like':'%'+_0x101f3d[_0x244c('0x40')][_0x244c('0x49')]+'%'};return _0x8ac12b;})});}_0x10eacb=_[_0x244c('0x4a')]({},_0x10eacb,_0x101f3d['options']);return _0x5c2b4f['getDescriptions'](_0x10eacb);}})[_0x244c('0x24')](function(_0x30e418){if(_0x30e418){_0x5e708e=_0x30e418[_0x244c('0x44')];if(!_0x101f3d['query']['hasOwnProperty']('nolimit')){_0x10eacb[_0x244c('0x33')]=qs['limit'](_0x101f3d[_0x244c('0x40')]['limit']);_0x10eacb[_0x244c('0x32')]=qs[_0x244c('0x32')](_0x101f3d[_0x244c('0x40')]['offset']);}return _0x5c2b4f[_0x244c('0x60')](_0x10eacb);}})['then'](function(_0x39ef8f){if(_0x39ef8f){return _0x39ef8f?{'count':_0x5e708e,'rows':_0x39ef8f}:null;}})[_0x244c('0x24')](respondWithResult(_0x3c6e23,null))['catch'](handleError(_0x3c6e23,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 48b3add..712b82b 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 _0xbd98=['define','ZohoConfiguration','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./intZohoConfiguration.attributes','exports'];(function(_0x1e70ad,_0xa167c4){var _0x3ff82a=function(_0x402615){while(--_0x402615){_0x1e70ad['push'](_0x1e70ad['shift']());}};_0x3ff82a(++_0xa167c4);}(_0xbd98,0x1ee));var _0x8bd9=function(_0x3cdbef,_0x3b0d10){_0x3cdbef=_0x3cdbef-0x0;var _0x1d05d6=_0xbd98[_0x3cdbef];return _0x1d05d6;};'use strict';var _=require(_0x8bd9('0x0'));var util=require(_0x8bd9('0x1'));var logger=require(_0x8bd9('0x2'))('api');var moment=require(_0x8bd9('0x3'));var BPromise=require(_0x8bd9('0x4'));var rp=require(_0x8bd9('0x5'));var fs=require('fs');var path=require(_0x8bd9('0x6'));var rimraf=require('rimraf');var config=require(_0x8bd9('0x7'));var attributes=require(_0x8bd9('0x8'));module[_0x8bd9('0x9')]=function(_0x40eeb4,_0x680b3){return _0x40eeb4[_0x8bd9('0xa')](_0x8bd9('0xb'),attributes,{'tableName':'int_zoho_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe367=['int_zoho_configurations','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intZohoConfiguration.attributes','define','ZohoConfiguration'];(function(_0x171ac3,_0x3e1807){var _0xdee135=function(_0x158a9c){while(--_0x158a9c){_0x171ac3['push'](_0x171ac3['shift']());}};_0xdee135(++_0x3e1807);}(_0xe367,0x1e2));var _0x7e36=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0xe367[_0x46698a];return _0x356db0;};'use strict';var _=require(_0x7e36('0x0'));var util=require(_0x7e36('0x1'));var logger=require(_0x7e36('0x2'))(_0x7e36('0x3'));var moment=require(_0x7e36('0x4'));var BPromise=require('bluebird');var rp=require(_0x7e36('0x5'));var fs=require('fs');var path=require(_0x7e36('0x6'));var rimraf=require(_0x7e36('0x7'));var config=require(_0x7e36('0x8'));var attributes=require(_0x7e36('0x9'));module['exports']=function(_0x5f8e49,_0x1859f5){return _0x5f8e49[_0x7e36('0xa')](_0x7e36('0xb'),attributes,{'tableName':_0x7e36('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js b/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js index a5bd0eb..6eacb4b 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 _0x3706=['jayson/promise','client','http','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x2a802f,_0x267939){var _0x38fbd8=function(_0x17fc82){while(--_0x17fc82){_0x2a802f['push'](_0x2a802f['shift']());}};_0x38fbd8(++_0x267939);}(_0x3706,0x1dc));var _0x6370=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x3706[_0x4154a6];return _0x3b2786;};'use strict';var _=require(_0x6370('0x0'));var util=require(_0x6370('0x1'));var moment=require('moment');var BPromise=require(_0x6370('0x2'));var rs=require(_0x6370('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6370('0x4'))['db'];var utils=require(_0x6370('0x5'));var logger=require(_0x6370('0x6'))('rpc');var config=require(_0x6370('0x7'));var jayson=require(_0x6370('0x8'));var client=jayson[_0x6370('0x9')][_0x6370('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x23c872,_0x175041,_0x3137ab){return new BPromise(function(_0x3b8ed7,_0x5a7401){return client['request'](_0x23c872,_0x3137ab)[_0x6370('0xb')](function(_0x192810){logger[_0x6370('0xc')](_0x6370('0xd'),_0x175041,_0x6370('0xe'));logger[_0x6370('0xf')](_0x6370('0x10'),_0x175041,_0x6370('0xe'),JSON[_0x6370('0x11')](_0x192810));if(_0x192810[_0x6370('0x12')]){if(_0x192810[_0x6370('0x12')]['code']===0x1f4){logger[_0x6370('0x12')](_0x6370('0xd'),_0x175041,_0x192810[_0x6370('0x12')]['message']);return _0x5a7401(_0x192810[_0x6370('0x12')]['message']);}logger[_0x6370('0x12')](_0x6370('0xd'),_0x175041,_0x192810[_0x6370('0x12')][_0x6370('0x13')]);return _0x3b8ed7(_0x192810[_0x6370('0x12')][_0x6370('0x13')]);}else{logger[_0x6370('0xc')](_0x6370('0xd'),_0x175041,_0x6370('0xe'));_0x3b8ed7(_0x192810[_0x6370('0x14')][_0x6370('0x13')]);}})[_0x6370('0x15')](function(_0x331eb0){logger[_0x6370('0x12')](_0x6370('0xd'),_0x175041,_0x331eb0);_0x5a7401(_0x331eb0);});});} \ No newline at end of file +var _0xfccb=['error','code','ZohoConfiguration,\x20%s,\x20%s','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x2241e0,_0x42b9bf){var _0x446b18=function(_0x13817f){while(--_0x13817f){_0x2241e0['push'](_0x2241e0['shift']());}};_0x446b18(++_0x42b9bf);}(_0xfccb,0x148));var _0xbfcc=function(_0x135233,_0x24606f){_0x135233=_0x135233-0x0;var _0x3eb699=_0xfccb[_0x135233];return _0x3eb699;};'use strict';var _=require(_0xbfcc('0x0'));var util=require(_0xbfcc('0x1'));var moment=require(_0xbfcc('0x2'));var BPromise=require(_0xbfcc('0x3'));var rs=require(_0xbfcc('0x4'));var fs=require('fs');var Redis=require(_0xbfcc('0x5'));var db=require(_0xbfcc('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xbfcc('0x7'))(_0xbfcc('0x8'));var config=require(_0xbfcc('0x9'));var jayson=require(_0xbfcc('0xa'));var client=jayson[_0xbfcc('0xb')][_0xbfcc('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1529b2,_0x75f1ce,_0x1ef59d){return new BPromise(function(_0xb7f97c,_0x316f4a){return client[_0xbfcc('0xd')](_0x1529b2,_0x1ef59d)['then'](function(_0x55528f){logger['info']('ZohoConfiguration,\x20%s,\x20%s',_0x75f1ce,_0xbfcc('0xe'));logger[_0xbfcc('0xf')](_0xbfcc('0x10'),_0x75f1ce,'request\x20sent',JSON['stringify'](_0x55528f));if(_0x55528f[_0xbfcc('0x11')]){if(_0x55528f[_0xbfcc('0x11')][_0xbfcc('0x12')]===0x1f4){logger[_0xbfcc('0x11')](_0xbfcc('0x13'),_0x75f1ce,_0x55528f[_0xbfcc('0x11')][_0xbfcc('0x14')]);return _0x316f4a(_0x55528f[_0xbfcc('0x11')]['message']);}logger[_0xbfcc('0x11')](_0xbfcc('0x13'),_0x75f1ce,_0x55528f[_0xbfcc('0x11')][_0xbfcc('0x14')]);return _0xb7f97c(_0x55528f[_0xbfcc('0x11')][_0xbfcc('0x14')]);}else{logger[_0xbfcc('0x15')]('ZohoConfiguration,\x20%s,\x20%s',_0x75f1ce,_0xbfcc('0xe'));_0xb7f97c(_0x55528f[_0xbfcc('0x16')][_0xbfcc('0x14')]);}})['catch'](function(_0x61852d){logger[_0xbfcc('0x11')]('ZohoConfiguration,\x20%s,\x20%s',_0x75f1ce,_0x61852d);_0x316f4a(_0x61852d);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 41b0be6..a28ba8a 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 _0x1c9a=['path','express','Router','../../components/auth/service','../../config/environment','./intZohoField.controller','get','isAuthenticated','show','post','create','put','/:id','delete','destroy','exports','multer'];(function(_0x2c0767,_0x444da4){var _0x22962a=function(_0x1238f1){while(--_0x1238f1){_0x2c0767['push'](_0x2c0767['shift']());}};_0x22962a(++_0x444da4);}(_0x1c9a,0x98));var _0xa1c9=function(_0x41535c,_0x21cb69){_0x41535c=_0x41535c-0x0;var _0x2dad7c=_0x1c9a[_0x41535c];return _0x2dad7c;};'use strict';var multer=require(_0xa1c9('0x0'));var util=require('util');var path=require(_0xa1c9('0x1'));var timeout=require('connect-timeout');var express=require(_0xa1c9('0x2'));var router=express[_0xa1c9('0x3')]();var auth=require(_0xa1c9('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xa1c9('0x5'));var controller=require(_0xa1c9('0x6'));router[_0xa1c9('0x7')]('/',auth[_0xa1c9('0x8')](),controller['index']);router[_0xa1c9('0x7')]('/:id',auth[_0xa1c9('0x8')](),controller[_0xa1c9('0x9')]);router[_0xa1c9('0xa')]('/',auth['isAuthenticated'](),controller[_0xa1c9('0xb')]);router[_0xa1c9('0xc')](_0xa1c9('0xd'),auth[_0xa1c9('0x8')](),controller['update']);router[_0xa1c9('0xe')](_0xa1c9('0xd'),auth[_0xa1c9('0x8')](),controller[_0xa1c9('0xf')]);module[_0xa1c9('0x10')]=router; \ No newline at end of file +var _0x9536=['connect-timeout','Router','../../components/interaction/service','../../config/environment','./intZohoField.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path'];(function(_0x137c70,_0xda8581){var _0x1ab709=function(_0x32675e){while(--_0x32675e){_0x137c70['push'](_0x137c70['shift']());}};_0x1ab709(++_0xda8581);}(_0x9536,0x179));var _0x6953=function(_0x2b5eae,_0x55010d){_0x2b5eae=_0x2b5eae-0x0;var _0x5f3ac9=_0x9536[_0x2b5eae];return _0x5f3ac9;};'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/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 3d52b11..0c86084 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 _0x8137=['customVariable','keyValue','string','variable','STRING','BOOLEAN','sequelize'];(function(_0x4dfddb,_0x1ca382){var _0x5f5962=function(_0x139992){while(--_0x139992){_0x4dfddb['push'](_0x4dfddb['shift']());}};_0x5f5962(++_0x1ca382);}(_0x8137,0x16b));var _0x7813=function(_0x1b6186,_0x1ec7f2){_0x1b6186=_0x1b6186-0x0;var _0x186121=_0x8137[_0x1b6186];return _0x186121;};'use strict';var Sequelize=require(_0x7813('0x0'));module['exports']={'type':{'type':Sequelize['ENUM']('string','variable',_0x7813('0x1'),_0x7813('0x2')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x7813('0x3'),_0x7813('0x4'),_0x7813('0x1'))},'keyContent':{'type':Sequelize[_0x7813('0x5')]},'idField':{'type':Sequelize[_0x7813('0x5')]},'nameField':{'type':Sequelize[_0x7813('0x5')]},'customField':{'type':Sequelize[_0x7813('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x7813('0x5')]}}; \ No newline at end of file +var _0x3fc6=['string','STRING','BOOLEAN','sequelize','exports','ENUM','variable','customVariable','keyValue'];(function(_0x3871d7,_0x3cfcc5){var _0x28ec09=function(_0x2bb918){while(--_0x2bb918){_0x3871d7['push'](_0x3871d7['shift']());}};_0x28ec09(++_0x3cfcc5);}(_0x3fc6,0x159));var _0x63fc=function(_0x5e9784,_0x530ef1){_0x5e9784=_0x5e9784-0x0;var _0x592765=_0x3fc6[_0x5e9784];return _0x592765;};'use strict';var Sequelize=require(_0x63fc('0x0'));module[_0x63fc('0x1')]={'type':{'type':Sequelize[_0x63fc('0x2')]('string',_0x63fc('0x3'),_0x63fc('0x4'),_0x63fc('0x5')),'defaultValue':_0x63fc('0x6')},'content':{'type':Sequelize[_0x63fc('0x7')]},'key':{'type':Sequelize[_0x63fc('0x7')]},'keyType':{'type':Sequelize['ENUM']('string',_0x63fc('0x3'),_0x63fc('0x4'))},'keyContent':{'type':Sequelize[_0x63fc('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x63fc('0x7')]},'customField':{'type':Sequelize[_0x63fc('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index a0d7465..a12423f 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 _0xa9e0=['sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','catch','params','includeAll','create','body','find','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','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','index','map','ZohoField','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit'];(function(_0x5e58f5,_0x16896a){var _0x5e3df3=function(_0x23114d){while(--_0x23114d){_0x5e58f5['push'](_0x5e58f5['shift']());}};_0x5e3df3(++_0x16896a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0xa9e0[_0x49ca18];return _0x145d54;};'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 db=require(_0x0a9e('0x13'))['db'];function respondWithStatusCode(_0x36471c,_0xd5b662){_0xd5b662=_0xd5b662||0xcc;return function(_0x26d672){if(_0x26d672){return _0x36471c[_0x0a9e('0x14')](_0xd5b662);}return _0x36471c[_0x0a9e('0x15')](_0xd5b662)['end']();};}function respondWithResult(_0x4283ce,_0x239b12){_0x239b12=_0x239b12||0xc8;return function(_0x2b4227){if(_0x2b4227){return _0x4283ce[_0x0a9e('0x15')](_0x239b12)[_0x0a9e('0x16')](_0x2b4227);}};}function respondWithFilteredResult(_0x4d5611,_0x52a03d){return function(_0x22dccb){if(_0x22dccb){var _0x5d0880=_0x22dccb[_0x0a9e('0x17')],_0x1985b6=_0x52a03d['offset'],_0x519dfd=_0x52a03d[_0x0a9e('0x18')]+_0x52a03d['limit'],_0x16033c;if(_0x519dfd>=_0x5d0880){_0x519dfd=_0x5d0880;_0x16033c=0xc8;}else{_0x16033c=0xce;}_0x4d5611[_0x0a9e('0x15')](_0x16033c);return _0x4d5611[_0x0a9e('0x19')](_0x0a9e('0x1a'),_0x1985b6+'-'+_0x519dfd+'/'+_0x5d0880)[_0x0a9e('0x16')](_0x22dccb);}return null;};}function patchUpdates(_0x31b1ca){return function(_0x2eb11f){try{jsonpatch[_0x0a9e('0x1b')](_0x2eb11f,_0x31b1ca,!![]);}catch(_0x20559e){return BPromise[_0x0a9e('0x1c')](_0x20559e);}return _0x2eb11f[_0x0a9e('0x1d')]();};}function saveUpdates(_0x1c696a,_0x105080){return function(_0x4bb1e3){if(_0x4bb1e3){return _0x4bb1e3[_0x0a9e('0x1e')](_0x1c696a)[_0x0a9e('0x1f')](function(_0x53682f){return _0x53682f;});}return null;};}function removeEntity(_0x20f109,_0x5a09ef){return function(_0x588269){if(_0x588269){return _0x588269[_0x0a9e('0x20')]()[_0x0a9e('0x1f')](function(){_0x20f109[_0x0a9e('0x15')](0xcc)[_0x0a9e('0x21')]();});}};}function handleEntityNotFound(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(!_0x2fb0e4){_0x4abc77[_0x0a9e('0x14')](0x194);}return _0x2fb0e4;};}function handleError(_0x4d00e6,_0x370d86){_0x370d86=_0x370d86||0x1f4;return function(_0x42ac8f){logger[_0x0a9e('0x22')](_0x42ac8f['stack']);if(_0x42ac8f['name']){delete _0x42ac8f[_0x0a9e('0x23')];}_0x4d00e6[_0x0a9e('0x15')](_0x370d86)[_0x0a9e('0x24')](_0x42ac8f);};}exports[_0x0a9e('0x25')]=function(_0x526cf3,_0x384319){var _0x479bc4={},_0x45a1e7={},_0x5bfb33={'count':0x0,'rows':[]};var _0x1dc186=_[_0x0a9e('0x26')](db[_0x0a9e('0x27')][_0x0a9e('0x28')],function(_0x140511){return{'name':_0x140511[_0x0a9e('0x29')],'type':_0x140511[_0x0a9e('0x2a')][_0x0a9e('0x2b')]};});_0x45a1e7['model']=_[_0x0a9e('0x26')](_0x1dc186,_0x0a9e('0x23'));_0x45a1e7[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x526cf3['query']);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],_0x45a1e7[_0x0a9e('0x2c')]);_0x479bc4[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],qs[_0x0a9e('0x32')](_0x526cf3[_0x0a9e('0x2c')]['fields']));_0x479bc4[_0x0a9e('0x31')]=_0x479bc4['attributes'][_0x0a9e('0x33')]?_0x479bc4[_0x0a9e('0x31')]:_0x45a1e7[_0x0a9e('0x30')];if(!_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x34')]('nolimit')){_0x479bc4[_0x0a9e('0x35')]=qs[_0x0a9e('0x35')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x35')]);_0x479bc4[_0x0a9e('0x18')]=qs[_0x0a9e('0x18')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x18')]);}_0x479bc4['order']=qs[_0x0a9e('0x36')](_0x526cf3['query'][_0x0a9e('0x36')]);_0x479bc4[_0x0a9e('0x37')]=qs[_0x0a9e('0x2e')](_[_0x0a9e('0x38')](_0x526cf3['query'],_0x45a1e7[_0x0a9e('0x2e')]),_0x1dc186);if(_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x39')]){_0x479bc4[_0x0a9e('0x37')]=_['merge'](_0x479bc4['where'],{'$or':_[_0x0a9e('0x26')](_0x1dc186,function(_0x5640eb){if(_0x5640eb[_0x0a9e('0x2a')]!==_0x0a9e('0x3a')){var _0x381c37={};_0x381c37[_0x5640eb[_0x0a9e('0x23')]]={'$like':'%'+_0x526cf3['query'][_0x0a9e('0x39')]+'%'};return _0x381c37;}})});}_0x479bc4=_[_0x0a9e('0x3b')]({},_0x479bc4,_0x526cf3[_0x0a9e('0x3c')]);var _0x533942={'where':_0x479bc4[_0x0a9e('0x37')]};return db[_0x0a9e('0x27')][_0x0a9e('0x17')](_0x533942)['then'](function(_0x546ef8){_0x5bfb33[_0x0a9e('0x17')]=_0x546ef8;if(_0x526cf3[_0x0a9e('0x2c')]['includeAll']){_0x479bc4[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x27')][_0x0a9e('0x3e')](_0x479bc4);})[_0x0a9e('0x1f')](function(_0x4b38d9){_0x5bfb33['rows']=_0x4b38d9;return _0x5bfb33;})[_0x0a9e('0x1f')](respondWithFilteredResult(_0x384319,_0x479bc4))[_0x0a9e('0x3f')](handleError(_0x384319,null));};exports['show']=function(_0x183991,_0x1dec2e){var _0x1459bb={'raw':!![],'where':{'id':_0x183991[_0x0a9e('0x40')]['id']}},_0x5b4f5e={};_0x5b4f5e[_0x0a9e('0x30')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x27')][_0x0a9e('0x28')]);_0x5b4f5e[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x183991[_0x0a9e('0x2c')]);_0x5b4f5e[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],_0x5b4f5e[_0x0a9e('0x2c')]);_0x1459bb[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],qs['fields'](_0x183991['query'][_0x0a9e('0x32')]));_0x1459bb[_0x0a9e('0x31')]=_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x33')]?_0x1459bb[_0x0a9e('0x31')]:_0x5b4f5e[_0x0a9e('0x30')];if(_0x183991[_0x0a9e('0x2c')][_0x0a9e('0x41')]){_0x1459bb[_0x0a9e('0x3d')]=[{'all':!![]}];}_0x1459bb=_[_0x0a9e('0x3b')]({},_0x1459bb,_0x183991[_0x0a9e('0x3c')]);return db[_0x0a9e('0x27')]['find'](_0x1459bb)[_0x0a9e('0x1f')](handleEntityNotFound(_0x1dec2e,null))[_0x0a9e('0x1f')](respondWithResult(_0x1dec2e,null))[_0x0a9e('0x3f')](handleError(_0x1dec2e,null));};exports[_0x0a9e('0x42')]=function(_0x2e8caf,_0xbe9d19){return db[_0x0a9e('0x27')][_0x0a9e('0x42')](_0x2e8caf['body'],{})[_0x0a9e('0x1f')](respondWithResult(_0xbe9d19,0xc9))['catch'](handleError(_0xbe9d19,null));};exports[_0x0a9e('0x1e')]=function(_0x476688,_0x8d6dd1){if(_0x476688['body']['id']){delete _0x476688[_0x0a9e('0x43')]['id'];}return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x476688[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x8d6dd1,null))[_0x0a9e('0x1f')](saveUpdates(_0x476688[_0x0a9e('0x43')],null))['then'](respondWithResult(_0x8d6dd1,null))[_0x0a9e('0x3f')](handleError(_0x8d6dd1,null));};exports[_0x0a9e('0x20')]=function(_0x1b5e80,_0x16f976){return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x1b5e80[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x16f976,null))[_0x0a9e('0x1f')](removeEntity(_0x16f976,null))['catch'](handleError(_0x16f976,null));}; \ No newline at end of file +var _0xa9e0=['sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','catch','params','includeAll','create','body','find','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','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','index','map','ZohoField','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit'];(function(_0x1bf8ab,_0x387079){var _0x258385=function(_0x306186){while(--_0x306186){_0x1bf8ab['push'](_0x1bf8ab['shift']());}};_0x258385(++_0x387079);}(_0xa9e0,0x123));var _0x0a9e=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0xa9e0[_0x36dfbd];return _0x4ecad9;};'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 db=require(_0x0a9e('0x13'))['db'];function respondWithStatusCode(_0x36471c,_0xd5b662){_0xd5b662=_0xd5b662||0xcc;return function(_0x26d672){if(_0x26d672){return _0x36471c[_0x0a9e('0x14')](_0xd5b662);}return _0x36471c[_0x0a9e('0x15')](_0xd5b662)['end']();};}function respondWithResult(_0x4283ce,_0x239b12){_0x239b12=_0x239b12||0xc8;return function(_0x2b4227){if(_0x2b4227){return _0x4283ce[_0x0a9e('0x15')](_0x239b12)[_0x0a9e('0x16')](_0x2b4227);}};}function respondWithFilteredResult(_0x4d5611,_0x52a03d){return function(_0x22dccb){if(_0x22dccb){var _0x5d0880=_0x22dccb[_0x0a9e('0x17')],_0x1985b6=_0x52a03d['offset'],_0x519dfd=_0x52a03d[_0x0a9e('0x18')]+_0x52a03d['limit'],_0x16033c;if(_0x519dfd>=_0x5d0880){_0x519dfd=_0x5d0880;_0x16033c=0xc8;}else{_0x16033c=0xce;}_0x4d5611[_0x0a9e('0x15')](_0x16033c);return _0x4d5611[_0x0a9e('0x19')](_0x0a9e('0x1a'),_0x1985b6+'-'+_0x519dfd+'/'+_0x5d0880)[_0x0a9e('0x16')](_0x22dccb);}return null;};}function patchUpdates(_0x31b1ca){return function(_0x2eb11f){try{jsonpatch[_0x0a9e('0x1b')](_0x2eb11f,_0x31b1ca,!![]);}catch(_0x20559e){return BPromise[_0x0a9e('0x1c')](_0x20559e);}return _0x2eb11f[_0x0a9e('0x1d')]();};}function saveUpdates(_0x1c696a,_0x105080){return function(_0x4bb1e3){if(_0x4bb1e3){return _0x4bb1e3[_0x0a9e('0x1e')](_0x1c696a)[_0x0a9e('0x1f')](function(_0x53682f){return _0x53682f;});}return null;};}function removeEntity(_0x20f109,_0x5a09ef){return function(_0x588269){if(_0x588269){return _0x588269[_0x0a9e('0x20')]()[_0x0a9e('0x1f')](function(){_0x20f109[_0x0a9e('0x15')](0xcc)[_0x0a9e('0x21')]();});}};}function handleEntityNotFound(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(!_0x2fb0e4){_0x4abc77[_0x0a9e('0x14')](0x194);}return _0x2fb0e4;};}function handleError(_0x4d00e6,_0x370d86){_0x370d86=_0x370d86||0x1f4;return function(_0x42ac8f){logger[_0x0a9e('0x22')](_0x42ac8f['stack']);if(_0x42ac8f['name']){delete _0x42ac8f[_0x0a9e('0x23')];}_0x4d00e6[_0x0a9e('0x15')](_0x370d86)[_0x0a9e('0x24')](_0x42ac8f);};}exports[_0x0a9e('0x25')]=function(_0x526cf3,_0x384319){var _0x479bc4={},_0x45a1e7={},_0x5bfb33={'count':0x0,'rows':[]};var _0x1dc186=_[_0x0a9e('0x26')](db[_0x0a9e('0x27')][_0x0a9e('0x28')],function(_0x140511){return{'name':_0x140511[_0x0a9e('0x29')],'type':_0x140511[_0x0a9e('0x2a')][_0x0a9e('0x2b')]};});_0x45a1e7['model']=_[_0x0a9e('0x26')](_0x1dc186,_0x0a9e('0x23'));_0x45a1e7[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x526cf3['query']);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],_0x45a1e7[_0x0a9e('0x2c')]);_0x479bc4[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],qs[_0x0a9e('0x32')](_0x526cf3[_0x0a9e('0x2c')]['fields']));_0x479bc4[_0x0a9e('0x31')]=_0x479bc4['attributes'][_0x0a9e('0x33')]?_0x479bc4[_0x0a9e('0x31')]:_0x45a1e7[_0x0a9e('0x30')];if(!_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x34')]('nolimit')){_0x479bc4[_0x0a9e('0x35')]=qs[_0x0a9e('0x35')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x35')]);_0x479bc4[_0x0a9e('0x18')]=qs[_0x0a9e('0x18')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x18')]);}_0x479bc4['order']=qs[_0x0a9e('0x36')](_0x526cf3['query'][_0x0a9e('0x36')]);_0x479bc4[_0x0a9e('0x37')]=qs[_0x0a9e('0x2e')](_[_0x0a9e('0x38')](_0x526cf3['query'],_0x45a1e7[_0x0a9e('0x2e')]),_0x1dc186);if(_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x39')]){_0x479bc4[_0x0a9e('0x37')]=_['merge'](_0x479bc4['where'],{'$or':_[_0x0a9e('0x26')](_0x1dc186,function(_0x5640eb){if(_0x5640eb[_0x0a9e('0x2a')]!==_0x0a9e('0x3a')){var _0x381c37={};_0x381c37[_0x5640eb[_0x0a9e('0x23')]]={'$like':'%'+_0x526cf3['query'][_0x0a9e('0x39')]+'%'};return _0x381c37;}})});}_0x479bc4=_[_0x0a9e('0x3b')]({},_0x479bc4,_0x526cf3[_0x0a9e('0x3c')]);var _0x533942={'where':_0x479bc4[_0x0a9e('0x37')]};return db[_0x0a9e('0x27')][_0x0a9e('0x17')](_0x533942)['then'](function(_0x546ef8){_0x5bfb33[_0x0a9e('0x17')]=_0x546ef8;if(_0x526cf3[_0x0a9e('0x2c')]['includeAll']){_0x479bc4[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x27')][_0x0a9e('0x3e')](_0x479bc4);})[_0x0a9e('0x1f')](function(_0x4b38d9){_0x5bfb33['rows']=_0x4b38d9;return _0x5bfb33;})[_0x0a9e('0x1f')](respondWithFilteredResult(_0x384319,_0x479bc4))[_0x0a9e('0x3f')](handleError(_0x384319,null));};exports['show']=function(_0x183991,_0x1dec2e){var _0x1459bb={'raw':!![],'where':{'id':_0x183991[_0x0a9e('0x40')]['id']}},_0x5b4f5e={};_0x5b4f5e[_0x0a9e('0x30')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x27')][_0x0a9e('0x28')]);_0x5b4f5e[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x183991[_0x0a9e('0x2c')]);_0x5b4f5e[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],_0x5b4f5e[_0x0a9e('0x2c')]);_0x1459bb[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],qs['fields'](_0x183991['query'][_0x0a9e('0x32')]));_0x1459bb[_0x0a9e('0x31')]=_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x33')]?_0x1459bb[_0x0a9e('0x31')]:_0x5b4f5e[_0x0a9e('0x30')];if(_0x183991[_0x0a9e('0x2c')][_0x0a9e('0x41')]){_0x1459bb[_0x0a9e('0x3d')]=[{'all':!![]}];}_0x1459bb=_[_0x0a9e('0x3b')]({},_0x1459bb,_0x183991[_0x0a9e('0x3c')]);return db[_0x0a9e('0x27')]['find'](_0x1459bb)[_0x0a9e('0x1f')](handleEntityNotFound(_0x1dec2e,null))[_0x0a9e('0x1f')](respondWithResult(_0x1dec2e,null))[_0x0a9e('0x3f')](handleError(_0x1dec2e,null));};exports[_0x0a9e('0x42')]=function(_0x2e8caf,_0xbe9d19){return db[_0x0a9e('0x27')][_0x0a9e('0x42')](_0x2e8caf['body'],{})[_0x0a9e('0x1f')](respondWithResult(_0xbe9d19,0xc9))['catch'](handleError(_0xbe9d19,null));};exports[_0x0a9e('0x1e')]=function(_0x476688,_0x8d6dd1){if(_0x476688['body']['id']){delete _0x476688[_0x0a9e('0x43')]['id'];}return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x476688[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x8d6dd1,null))[_0x0a9e('0x1f')](saveUpdates(_0x476688[_0x0a9e('0x43')],null))['then'](respondWithResult(_0x8d6dd1,null))[_0x0a9e('0x3f')](handleError(_0x8d6dd1,null));};exports[_0x0a9e('0x20')]=function(_0x1b5e80,_0x16f976){return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x1b5e80[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x16f976,null))[_0x0a9e('0x1f')](removeEntity(_0x16f976,null))['catch'](handleError(_0x16f976,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 53de464..690d0ab 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 _0xa7e4=['bluebird','request-promise','path','rimraf','define','ZohoField','zoho_unique_index','lodash','util','api','moment'];(function(_0x30f8c9,_0x34068e){var _0x5caa4f=function(_0x3f8f5a){while(--_0x3f8f5a){_0x30f8c9['push'](_0x30f8c9['shift']());}};_0x5caa4f(++_0x34068e);}(_0xa7e4,0xc2));var _0x4a7e=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0xa7e4[_0x178e48];return _0x440d7e;};'use strict';var _=require(_0x4a7e('0x0'));var util=require(_0x4a7e('0x1'));var logger=require('../../config/logger')(_0x4a7e('0x2'));var moment=require(_0x4a7e('0x3'));var BPromise=require(_0x4a7e('0x4'));var rp=require(_0x4a7e('0x5'));var fs=require('fs');var path=require(_0x4a7e('0x6'));var rimraf=require(_0x4a7e('0x7'));var config=require('../../config/environment');var attributes=require('./intZohoField.attributes');module['exports']=function(_0x546ba7,_0x34db52){return _0x546ba7[_0x4a7e('0x8')](_0x4a7e('0x9'),attributes,{'tableName':'int_zoho_fields','paranoid':![],'indexes':[{'name':_0x4a7e('0xa'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb38a=['rimraf','define','int_zoho_fields','zoho_unique_index','idField','util','moment','bluebird','request-promise','path'];(function(_0x186a9a,_0x5e3ac2){var _0x27d6e8=function(_0x286649){while(--_0x286649){_0x186a9a['push'](_0x186a9a['shift']());}};_0x27d6e8(++_0x5e3ac2);}(_0xb38a,0x1b3));var _0xab38=function(_0x33a919,_0x37b321){_0x33a919=_0x33a919-0x0;var _0x59f4ae=_0xb38a[_0x33a919];return _0x59f4ae;};'use strict';var _=require('lodash');var util=require(_0xab38('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xab38('0x1'));var BPromise=require(_0xab38('0x2'));var rp=require(_0xab38('0x3'));var fs=require('fs');var path=require(_0xab38('0x4'));var rimraf=require(_0xab38('0x5'));var config=require('../../config/environment');var attributes=require('./intZohoField.attributes');module['exports']=function(_0x545247,_0x2ed0fe){return _0x545247[_0xab38('0x6')]('ZohoField',attributes,{'tableName':_0xab38('0x7'),'paranoid':![],'indexes':[{'name':_0xab38('0x8'),'fields':[_0xab38('0x9'),'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 1ea243b..9c5bca4 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 _0xe14d=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZohoField,\x20%s,\x20%s','debug','ZohoField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x5a5af6,_0x1859de){var _0xddbe9b=function(_0x10be7c){while(--_0x10be7c){_0x5a5af6['push'](_0x5a5af6['shift']());}};_0xddbe9b(++_0x1859de);}(_0xe14d,0x1ee));var _0xde14=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xe14d[_0x56482c];return _0x5aae7a;};'use strict';var _=require(_0xde14('0x0'));var util=require(_0xde14('0x1'));var moment=require(_0xde14('0x2'));var BPromise=require(_0xde14('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xde14('0x4'));var db=require(_0xde14('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xde14('0x6'))(_0xde14('0x7'));var config=require(_0xde14('0x8'));var jayson=require(_0xde14('0x9'));var client=jayson[_0xde14('0xa')][_0xde14('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4b1f6b,_0x5a1344,_0x1bd49d){return new BPromise(function(_0x115b7d,_0x2b0e7c){return client[_0xde14('0xc')](_0x4b1f6b,_0x1bd49d)[_0xde14('0xd')](function(_0x176909){logger[_0xde14('0xe')](_0xde14('0xf'),_0x5a1344,'request\x20sent');logger[_0xde14('0x10')](_0xde14('0x11'),_0x5a1344,_0xde14('0x12'),JSON[_0xde14('0x13')](_0x176909));if(_0x176909[_0xde14('0x14')]){if(_0x176909[_0xde14('0x14')][_0xde14('0x15')]===0x1f4){logger[_0xde14('0x14')](_0xde14('0xf'),_0x5a1344,_0x176909[_0xde14('0x14')][_0xde14('0x16')]);return _0x2b0e7c(_0x176909[_0xde14('0x14')][_0xde14('0x16')]);}logger[_0xde14('0x14')](_0xde14('0xf'),_0x5a1344,_0x176909['error']['message']);return _0x115b7d(_0x176909[_0xde14('0x14')][_0xde14('0x16')]);}else{logger[_0xde14('0xe')]('ZohoField,\x20%s,\x20%s',_0x5a1344,_0xde14('0x12'));_0x115b7d(_0x176909[_0xde14('0x17')][_0xde14('0x16')]);}})[_0xde14('0x18')](function(_0x3de959){logger[_0xde14('0x14')](_0xde14('0xf'),_0x5a1344,_0x3de959);_0x2b0e7c(_0x3de959);});});} \ No newline at end of file +var _0xbd50=['ZohoField,\x20%s,\x20%s','request\x20sent','ZohoField,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','request','then'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xbd50,0x196));var _0x0bd5=function(_0x5d6dfc,_0x43d8d4){_0x5d6dfc=_0x5d6dfc-0x0;var _0x1bfa18=_0xbd50[_0x5d6dfc];return _0x1bfa18;};'use strict';var _=require(_0x0bd5('0x0'));var util=require(_0x0bd5('0x1'));var moment=require(_0x0bd5('0x2'));var BPromise=require('bluebird');var rs=require(_0x0bd5('0x3'));var fs=require('fs');var Redis=require(_0x0bd5('0x4'));var db=require(_0x0bd5('0x5'))['db'];var utils=require(_0x0bd5('0x6'));var logger=require(_0x0bd5('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0bd5('0x8')][_0x0bd5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xcc6cfa,_0x2c0db1,_0x1b99f3){return new BPromise(function(_0x5ebe64,_0x47e78d){return client[_0x0bd5('0xa')](_0xcc6cfa,_0x1b99f3)[_0x0bd5('0xb')](function(_0x259f4c){logger['info'](_0x0bd5('0xc'),_0x2c0db1,_0x0bd5('0xd'));logger['debug'](_0x0bd5('0xe'),_0x2c0db1,_0x0bd5('0xd'),JSON['stringify'](_0x259f4c));if(_0x259f4c[_0x0bd5('0xf')]){if(_0x259f4c[_0x0bd5('0xf')][_0x0bd5('0x10')]===0x1f4){logger['error'](_0x0bd5('0xc'),_0x2c0db1,_0x259f4c[_0x0bd5('0xf')][_0x0bd5('0x11')]);return _0x47e78d(_0x259f4c[_0x0bd5('0xf')][_0x0bd5('0x11')]);}logger[_0x0bd5('0xf')](_0x0bd5('0xc'),_0x2c0db1,_0x259f4c[_0x0bd5('0xf')]['message']);return _0x5ebe64(_0x259f4c[_0x0bd5('0xf')][_0x0bd5('0x11')]);}else{logger['info'](_0x0bd5('0xc'),_0x2c0db1,_0x0bd5('0xd'));_0x5ebe64(_0x259f4c[_0x0bd5('0x12')][_0x0bd5('0x11')]);}})['catch'](function(_0x14f32c){logger[_0x0bd5('0xf')](_0x0bd5('0xc'),_0x2c0db1,_0x14f32c);_0x47e78d(_0x14f32c);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index c17c312..ec74eb1 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 _0x2e4d=['connect-timeout','express','../../components/interaction/service','../../config/environment','exports','multer','util','path'];(function(_0xe22c2c,_0x191d1e){var _0x2792e4=function(_0x4fb703){while(--_0x4fb703){_0xe22c2c['push'](_0xe22c2c['shift']());}};_0x2792e4(++_0x191d1e);}(_0x2e4d,0x1ed));var _0xd2e4=function(_0x43f528,_0x3471f2){_0x43f528=_0x43f528-0x0;var _0x309445=_0x2e4d[_0x43f528];return _0x309445;};'use strict';var multer=require(_0xd2e4('0x0'));var util=require(_0xd2e4('0x1'));var path=require(_0xd2e4('0x2'));var timeout=require(_0xd2e4('0x3'));var express=require(_0xd2e4('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xd2e4('0x5'));var config=require(_0xd2e4('0x6'));module[_0xd2e4('0x7')]=router; \ No newline at end of file +var _0xf1fa=['Router','../../components/auth/service','exports','multer','util','path','connect-timeout','express'];(function(_0x596643,_0x476631){var _0x3614f1=function(_0x5a28e1){while(--_0x5a28e1){_0x596643['push'](_0x596643['shift']());}};_0x3614f1(++_0x476631);}(_0xf1fa,0x1db));var _0xaf1f=function(_0xc02fd5,_0x1c656d){_0xc02fd5=_0xc02fd5-0x0;var _0x259e6d=_0xf1fa[_0xc02fd5];return _0x259e6d;};'use strict';var multer=require(_0xaf1f('0x0'));var util=require(_0xaf1f('0x1'));var path=require(_0xaf1f('0x2'));var timeout=require(_0xaf1f('0x3'));var express=require(_0xaf1f('0x4'));var router=express[_0xaf1f('0x5')]();var auth=require(_0xaf1f('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0xaf1f('0x7')]=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 643a6aa..40662ad 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 _0xc7be=['INTEGER','BOOLEAN','state','sequelize','exports','STRING','unique_name_and_version','app.js'];(function(_0x41456d,_0x464b02){var _0x136775=function(_0x20327e){while(--_0x20327e){_0x41456d['push'](_0x41456d['shift']());}};_0x136775(++_0x464b02);}(_0xc7be,0x1f3));var _0xec7b=function(_0x61b761,_0x4ef502){_0x61b761=_0x61b761-0x0;var _0x535a54=_0xc7be[_0x61b761];return _0x535a54;};'use strict';var Sequelize=require(_0xec7b('0x0'));module[_0xec7b('0x1')]={'name':{'type':Sequelize[_0xec7b('0x2')],'allowNull':![],'unique':_0xec7b('0x3')},'version':{'type':Sequelize[_0xec7b('0x2')],'allowNull':![],'unique':_0xec7b('0x3')},'main':{'type':Sequelize[_0xec7b('0x2')],'defaultValue':_0xec7b('0x4')},'filename':{'type':Sequelize['STRING']},'path':{'type':Sequelize[_0xec7b('0x2')]},'type':{'type':Sequelize['STRING']},'size':{'type':Sequelize[_0xec7b('0x5')]},'active':{'type':Sequelize[_0xec7b('0x6')],'defaultValue':![]},'author':{'type':Sequelize['STRING']},'logo':{'type':Sequelize[_0xec7b('0x2')]},'state':{'type':Sequelize[_0xec7b('0x2')],'unique':_0xec7b('0x7')},'description':{'type':Sequelize[_0xec7b('0x2')]},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xec7b('0x2')]},'link':{'type':Sequelize[_0xec7b('0x2')],'defaultValue':'#'}}; \ No newline at end of file +var _0x4b63=['app.js','INTEGER','sequelize','exports','unique_name_and_version','STRING'];(function(_0x2f4977,_0x3cfdbe){var _0x2903ba=function(_0x58dd18){while(--_0x58dd18){_0x2f4977['push'](_0x2f4977['shift']());}};_0x2903ba(++_0x3cfdbe);}(_0x4b63,0x164));var _0x34b6=function(_0x2f8431,_0x2850c8){_0x2f8431=_0x2f8431-0x0;var _0x313498=_0x4b63[_0x2f8431];return _0x313498;};'use strict';var Sequelize=require(_0x34b6('0x0'));module[_0x34b6('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x34b6('0x2')},'version':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x34b6('0x2')},'main':{'type':Sequelize[_0x34b6('0x3')],'defaultValue':_0x34b6('0x4')},'filename':{'type':Sequelize[_0x34b6('0x3')]},'path':{'type':Sequelize[_0x34b6('0x3')]},'type':{'type':Sequelize['STRING']},'size':{'type':Sequelize[_0x34b6('0x5')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'author':{'type':Sequelize[_0x34b6('0x3')]},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize['STRING'],'unique':'state'},'description':{'type':Sequelize[_0x34b6('0x3')]},'title':{'type':Sequelize[_0x34b6('0x3')]},'remoteUri':{'type':Sequelize[_0x34b6('0x3')]},'link':{'type':Sequelize['STRING'],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index 5859521..30ba3b1 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 _0xb2e6=['html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','count','offset','limit','set','reject','save','then','destroy','error','name','send','index','map','Integration','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','params','find','create','update','body'];(function(_0x2186bb,_0x2804bd){var _0x4afbfa=function(_0xc45745){while(--_0xc45745){_0x2186bb['push'](_0x2186bb['shift']());}};_0x4afbfa(++_0x2804bd);}(_0xb2e6,0x1a4));var _0x6b2e=function(_0x566929,_0x498e41){_0x566929=_0x566929-0x0;var _0x55b33c=_0xb2e6[_0x566929];return _0x55b33c;};'use strict';var pdf=require(_0x6b2e('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x6b2e('0x1'));var zipdir=require(_0x6b2e('0x2'));var jsonpatch=require(_0x6b2e('0x3'));var rp=require(_0x6b2e('0x4'));var moment=require(_0x6b2e('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x6b2e('0x6'));var util=require(_0x6b2e('0x7'));var path=require(_0x6b2e('0x8'));var sox=require(_0x6b2e('0x9'));var csv=require(_0x6b2e('0xa'));var ejs=require(_0x6b2e('0xb'));var fs=require('fs');var _=require(_0x6b2e('0xc'));var squel=require(_0x6b2e('0xd'));var crypto=require(_0x6b2e('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x6b2e('0xf'));var toCsv=require(_0x6b2e('0xa'));var querystring=require(_0x6b2e('0x10'));var Papa=require(_0x6b2e('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6b2e('0x12'));var as=require(_0x6b2e('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6b2e('0x14'))(_0x6b2e('0x15'));var utils=require(_0x6b2e('0x16'));var config=require(_0x6b2e('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x40721d,_0x4ecdd8){_0x4ecdd8=_0x4ecdd8||0xcc;return function(_0x5ea4e6){if(_0x5ea4e6){return _0x40721d[_0x6b2e('0x18')](_0x4ecdd8);}return _0x40721d['status'](_0x4ecdd8)['end']();};}function respondWithResult(_0x262451,_0x14063c){_0x14063c=_0x14063c||0xc8;return function(_0x3a1ad8){if(_0x3a1ad8){return _0x262451[_0x6b2e('0x19')](_0x14063c)['json'](_0x3a1ad8);}};}function respondWithFilteredResult(_0x13e728,_0x59e93e){return function(_0x3791b7){if(_0x3791b7){var _0x1e48a6=_0x3791b7[_0x6b2e('0x1a')],_0x204d71=_0x59e93e[_0x6b2e('0x1b')],_0xbb7dc1=_0x59e93e['offset']+_0x59e93e[_0x6b2e('0x1c')],_0x336078;if(_0xbb7dc1>=_0x1e48a6){_0xbb7dc1=_0x1e48a6;_0x336078=0xc8;}else{_0x336078=0xce;}_0x13e728[_0x6b2e('0x19')](_0x336078);return _0x13e728[_0x6b2e('0x1d')]('Content-Range',_0x204d71+'-'+_0xbb7dc1+'/'+_0x1e48a6)['json'](_0x3791b7);}return null;};}function patchUpdates(_0x457964){return function(_0x28a733){try{jsonpatch['apply'](_0x28a733,_0x457964,!![]);}catch(_0x27d48a){return BPromise[_0x6b2e('0x1e')](_0x27d48a);}return _0x28a733[_0x6b2e('0x1f')]();};}function saveUpdates(_0x285d3a,_0x4c5193){return function(_0x2eaf9e){if(_0x2eaf9e){return _0x2eaf9e['update'](_0x285d3a)[_0x6b2e('0x20')](function(_0x23492d){return _0x23492d;});}return null;};}function removeEntity(_0x3d23ad,_0x53cef1){return function(_0x22555c){if(_0x22555c){return _0x22555c[_0x6b2e('0x21')]()[_0x6b2e('0x20')](function(){_0x3d23ad[_0x6b2e('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5d0616,_0x32563a){return function(_0x1e0a30){if(!_0x1e0a30){_0x5d0616[_0x6b2e('0x18')](0x194);}return _0x1e0a30;};}function handleError(_0x65fc95,_0x1cd6bd){_0x1cd6bd=_0x1cd6bd||0x1f4;return function(_0x36b7ca){logger[_0x6b2e('0x22')](_0x36b7ca['stack']);if(_0x36b7ca[_0x6b2e('0x23')]){delete _0x36b7ca['name'];}_0x65fc95[_0x6b2e('0x19')](_0x1cd6bd)[_0x6b2e('0x24')](_0x36b7ca);};}exports[_0x6b2e('0x25')]=function(_0x58ea55,_0x1d2802){var _0x3a814a={},_0x595985={},_0x88a988={'count':0x0,'rows':[]};var _0x586827=_[_0x6b2e('0x26')](db[_0x6b2e('0x27')][_0x6b2e('0x28')],function(_0x40c7f3){return{'name':_0x40c7f3[_0x6b2e('0x29')],'type':_0x40c7f3['type'][_0x6b2e('0x2a')]};});_0x595985[_0x6b2e('0x2b')]=_[_0x6b2e('0x26')](_0x586827,'name');_0x595985[_0x6b2e('0x2c')]=_[_0x6b2e('0x2d')](_0x58ea55[_0x6b2e('0x2c')]);_0x595985[_0x6b2e('0x2e')]=_['intersection'](_0x595985[_0x6b2e('0x2b')],_0x595985['query']);_0x3a814a[_0x6b2e('0x2f')]=_[_0x6b2e('0x30')](_0x595985['model'],qs[_0x6b2e('0x31')](_0x58ea55[_0x6b2e('0x2c')]['fields']));_0x3a814a['attributes']=_0x3a814a[_0x6b2e('0x2f')][_0x6b2e('0x32')]?_0x3a814a[_0x6b2e('0x2f')]:_0x595985[_0x6b2e('0x2b')];if(!_0x58ea55[_0x6b2e('0x2c')][_0x6b2e('0x33')](_0x6b2e('0x34'))){_0x3a814a['limit']=qs[_0x6b2e('0x1c')](_0x58ea55['query'][_0x6b2e('0x1c')]);_0x3a814a['offset']=qs['offset'](_0x58ea55['query'][_0x6b2e('0x1b')]);}_0x3a814a[_0x6b2e('0x35')]=qs[_0x6b2e('0x36')](_0x58ea55[_0x6b2e('0x2c')][_0x6b2e('0x36')]);_0x3a814a[_0x6b2e('0x37')]=qs[_0x6b2e('0x2e')](_['pick'](_0x58ea55[_0x6b2e('0x2c')],_0x595985[_0x6b2e('0x2e')]),_0x586827);if(_0x58ea55[_0x6b2e('0x2c')][_0x6b2e('0x38')]){_0x3a814a['where']=_['merge'](_0x3a814a[_0x6b2e('0x37')],{'$or':_['map'](_0x586827,function(_0x26821a){if(_0x26821a['type']!==_0x6b2e('0x39')){var _0x5c1842={};_0x5c1842[_0x26821a[_0x6b2e('0x23')]]={'$like':'%'+_0x58ea55[_0x6b2e('0x2c')][_0x6b2e('0x38')]+'%'};return _0x5c1842;}})});}_0x3a814a=_[_0x6b2e('0x3a')]({},_0x3a814a,_0x58ea55[_0x6b2e('0x3b')]);var _0x4a266d={'where':_0x3a814a[_0x6b2e('0x37')]};return db['Integration'][_0x6b2e('0x1a')](_0x4a266d)['then'](function(_0x393937){_0x88a988[_0x6b2e('0x1a')]=_0x393937;if(_0x58ea55['query'][_0x6b2e('0x3c')]){_0x3a814a[_0x6b2e('0x3d')]=[{'all':!![]}];}return db[_0x6b2e('0x27')][_0x6b2e('0x3e')](_0x3a814a);})[_0x6b2e('0x20')](function(_0x2538c3){_0x88a988['rows']=_0x2538c3;return _0x88a988;})[_0x6b2e('0x20')](respondWithFilteredResult(_0x1d2802,_0x3a814a))[_0x6b2e('0x3f')](handleError(_0x1d2802,null));};exports[_0x6b2e('0x40')]=function(_0x1c4eca,_0x4121ef){var _0x22971b={'raw':![],'where':{'id':_0x1c4eca[_0x6b2e('0x41')]['id']}},_0x25ce11={};_0x25ce11[_0x6b2e('0x2b')]=_['keys'](db[_0x6b2e('0x27')][_0x6b2e('0x28')]);_0x25ce11[_0x6b2e('0x2c')]=_[_0x6b2e('0x2d')](_0x1c4eca[_0x6b2e('0x2c')]);_0x25ce11[_0x6b2e('0x2e')]=_[_0x6b2e('0x30')](_0x25ce11[_0x6b2e('0x2b')],_0x25ce11[_0x6b2e('0x2c')]);_0x22971b[_0x6b2e('0x2f')]=_[_0x6b2e('0x30')](_0x25ce11[_0x6b2e('0x2b')],qs[_0x6b2e('0x31')](_0x1c4eca[_0x6b2e('0x2c')][_0x6b2e('0x31')]));_0x22971b[_0x6b2e('0x2f')]=_0x22971b[_0x6b2e('0x2f')][_0x6b2e('0x32')]?_0x22971b[_0x6b2e('0x2f')]:_0x25ce11[_0x6b2e('0x2b')];if(_0x1c4eca[_0x6b2e('0x2c')][_0x6b2e('0x3c')]){_0x22971b[_0x6b2e('0x3d')]=[{'all':!![]}];}_0x22971b=_[_0x6b2e('0x3a')]({},_0x22971b,_0x1c4eca[_0x6b2e('0x3b')]);return db[_0x6b2e('0x27')][_0x6b2e('0x42')](_0x22971b)[_0x6b2e('0x20')](handleEntityNotFound(_0x4121ef,null))[_0x6b2e('0x20')](respondWithResult(_0x4121ef,null))['catch'](handleError(_0x4121ef,null));};exports[_0x6b2e('0x43')]=function(_0xf9d551,_0x226846){return db[_0x6b2e('0x27')][_0x6b2e('0x43')](_0xf9d551['body'],{})[_0x6b2e('0x20')](respondWithResult(_0x226846,0xc9))[_0x6b2e('0x3f')](handleError(_0x226846,null));};exports[_0x6b2e('0x44')]=function(_0x338c90,_0x216324){if(_0x338c90[_0x6b2e('0x45')]['id']){delete _0x338c90[_0x6b2e('0x45')]['id'];}return db[_0x6b2e('0x27')]['find']({'where':{'id':_0x338c90[_0x6b2e('0x41')]['id']}})[_0x6b2e('0x20')](handleEntityNotFound(_0x216324,null))[_0x6b2e('0x20')](saveUpdates(_0x338c90[_0x6b2e('0x45')],null))[_0x6b2e('0x20')](respondWithResult(_0x216324,null))[_0x6b2e('0x3f')](handleError(_0x216324,null));};exports[_0x6b2e('0x21')]=function(_0x363f46,_0x10d471){return db[_0x6b2e('0x27')]['find']({'where':{'id':_0x363f46[_0x6b2e('0x41')]['id']}})[_0x6b2e('0x20')](handleEntityNotFound(_0x10d471,null))[_0x6b2e('0x20')](removeEntity(_0x10d471,null))[_0x6b2e('0x3f')](handleError(_0x10d471,null));}; \ No newline at end of file +var _0xfbda=['map','Integration','rawAttributes','fieldName','keys','filters','intersection','model','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','type','VIRTUAL','filter','options','include','findAll','rows','catch','show','params','includeAll','find','body','update','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index'];(function(_0x1d0cd6,_0x5853dc){var _0x43d4ab=function(_0xc08af5){while(--_0xc08af5){_0x1d0cd6['push'](_0x1d0cd6['shift']());}};_0x43d4ab(++_0x5853dc);}(_0xfbda,0x197));var _0xafbd=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xfbda[_0x34bc30];return _0x5706de;};'use strict';var pdf=require(_0xafbd('0x0'));var emlformat=require(_0xafbd('0x1'));var rimraf=require(_0xafbd('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xafbd('0x3'));var rp=require(_0xafbd('0x4'));var moment=require(_0xafbd('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xafbd('0x6'));var util=require('util');var path=require('path');var sox=require(_0xafbd('0x7'));var csv=require('to-csv');var ejs=require(_0xafbd('0x8'));var fs=require('fs');var _=require(_0xafbd('0x9'));var squel=require(_0xafbd('0xa'));var crypto=require(_0xafbd('0xb'));var jsforce=require(_0xafbd('0xc'));var deskjs=require(_0xafbd('0xd'));var toCsv=require('to-csv');var querystring=require(_0xafbd('0xe'));var Papa=require(_0xafbd('0xf'));var Redis=require(_0xafbd('0x10'));var authService=require(_0xafbd('0x11'));var qs=require(_0xafbd('0x12'));var as=require(_0xafbd('0x13'));var hardwareService=require(_0xafbd('0x14'));var logger=require('../../config/logger')(_0xafbd('0x15'));var utils=require('../../config/utils');var config=require(_0xafbd('0x16'));var db=require(_0xafbd('0x17'))['db'];function respondWithStatusCode(_0x20e5d9,_0x5696da){_0x5696da=_0x5696da||0xcc;return function(_0x31a651){if(_0x31a651){return _0x20e5d9[_0xafbd('0x18')](_0x5696da);}return _0x20e5d9['status'](_0x5696da)[_0xafbd('0x19')]();};}function respondWithResult(_0x35af5f,_0x5d2194){_0x5d2194=_0x5d2194||0xc8;return function(_0x33b8bf){if(_0x33b8bf){return _0x35af5f[_0xafbd('0x1a')](_0x5d2194)[_0xafbd('0x1b')](_0x33b8bf);}};}function respondWithFilteredResult(_0x1e80ac,_0x4c9145){return function(_0x1f645a){if(_0x1f645a){var _0x152727=_0x1f645a[_0xafbd('0x1c')],_0x1c0566=_0x4c9145[_0xafbd('0x1d')],_0x3b47f9=_0x4c9145[_0xafbd('0x1d')]+_0x4c9145[_0xafbd('0x1e')],_0x753df8;if(_0x3b47f9>=_0x152727){_0x3b47f9=_0x152727;_0x753df8=0xc8;}else{_0x753df8=0xce;}_0x1e80ac[_0xafbd('0x1a')](_0x753df8);return _0x1e80ac[_0xafbd('0x1f')](_0xafbd('0x20'),_0x1c0566+'-'+_0x3b47f9+'/'+_0x152727)['json'](_0x1f645a);}return null;};}function patchUpdates(_0x376618){return function(_0x263638){try{jsonpatch[_0xafbd('0x21')](_0x263638,_0x376618,!![]);}catch(_0x294ae1){return BPromise[_0xafbd('0x22')](_0x294ae1);}return _0x263638[_0xafbd('0x23')]();};}function saveUpdates(_0x1a803a,_0xc0cdd){return function(_0x8023b5){if(_0x8023b5){return _0x8023b5['update'](_0x1a803a)[_0xafbd('0x24')](function(_0xeaa765){return _0xeaa765;});}return null;};}function removeEntity(_0x2052ac,_0x39c513){return function(_0x27d3d2){if(_0x27d3d2){return _0x27d3d2[_0xafbd('0x25')]()['then'](function(){_0x2052ac[_0xafbd('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f37a9,_0x187647){return function(_0x4c45b3){if(!_0x4c45b3){_0x1f37a9[_0xafbd('0x18')](0x194);}return _0x4c45b3;};}function handleError(_0x4a83cb,_0x1f4ce6){_0x1f4ce6=_0x1f4ce6||0x1f4;return function(_0x5a4b3d){logger[_0xafbd('0x26')](_0x5a4b3d[_0xafbd('0x27')]);if(_0x5a4b3d[_0xafbd('0x28')]){delete _0x5a4b3d[_0xafbd('0x28')];}_0x4a83cb[_0xafbd('0x1a')](_0x1f4ce6)[_0xafbd('0x29')](_0x5a4b3d);};}exports[_0xafbd('0x2a')]=function(_0x2046c2,_0x18e215){var _0x47a32d={},_0x124d83={},_0xb2ac33={'count':0x0,'rows':[]};var _0x2c38d9=_[_0xafbd('0x2b')](db[_0xafbd('0x2c')][_0xafbd('0x2d')],function(_0x1903ca){return{'name':_0x1903ca[_0xafbd('0x2e')],'type':_0x1903ca['type']['key']};});_0x124d83['model']=_['map'](_0x2c38d9,_0xafbd('0x28'));_0x124d83['query']=_[_0xafbd('0x2f')](_0x2046c2['query']);_0x124d83[_0xafbd('0x30')]=_[_0xafbd('0x31')](_0x124d83[_0xafbd('0x32')],_0x124d83[_0xafbd('0x33')]);_0x47a32d[_0xafbd('0x34')]=_['intersection'](_0x124d83[_0xafbd('0x32')],qs[_0xafbd('0x35')](_0x2046c2['query'][_0xafbd('0x35')]));_0x47a32d[_0xafbd('0x34')]=_0x47a32d[_0xafbd('0x34')][_0xafbd('0x36')]?_0x47a32d[_0xafbd('0x34')]:_0x124d83[_0xafbd('0x32')];if(!_0x2046c2[_0xafbd('0x33')][_0xafbd('0x37')](_0xafbd('0x38'))){_0x47a32d[_0xafbd('0x1e')]=qs[_0xafbd('0x1e')](_0x2046c2[_0xafbd('0x33')][_0xafbd('0x1e')]);_0x47a32d[_0xafbd('0x1d')]=qs['offset'](_0x2046c2[_0xafbd('0x33')][_0xafbd('0x1d')]);}_0x47a32d[_0xafbd('0x39')]=qs[_0xafbd('0x3a')](_0x2046c2[_0xafbd('0x33')][_0xafbd('0x3a')]);_0x47a32d[_0xafbd('0x3b')]=qs[_0xafbd('0x30')](_['pick'](_0x2046c2[_0xafbd('0x33')],_0x124d83['filters']),_0x2c38d9);if(_0x2046c2[_0xafbd('0x33')]['filter']){_0x47a32d[_0xafbd('0x3b')]=_[_0xafbd('0x3c')](_0x47a32d[_0xafbd('0x3b')],{'$or':_[_0xafbd('0x2b')](_0x2c38d9,function(_0x80839b){if(_0x80839b[_0xafbd('0x3d')]!==_0xafbd('0x3e')){var _0x4ff330={};_0x4ff330[_0x80839b[_0xafbd('0x28')]]={'$like':'%'+_0x2046c2['query'][_0xafbd('0x3f')]+'%'};return _0x4ff330;}})});}_0x47a32d=_[_0xafbd('0x3c')]({},_0x47a32d,_0x2046c2[_0xafbd('0x40')]);var _0x54fbab={'where':_0x47a32d['where']};return db['Integration'][_0xafbd('0x1c')](_0x54fbab)['then'](function(_0x5b16ed){_0xb2ac33[_0xafbd('0x1c')]=_0x5b16ed;if(_0x2046c2['query']['includeAll']){_0x47a32d[_0xafbd('0x41')]=[{'all':!![]}];}return db[_0xafbd('0x2c')][_0xafbd('0x42')](_0x47a32d);})[_0xafbd('0x24')](function(_0x357a38){_0xb2ac33[_0xafbd('0x43')]=_0x357a38;return _0xb2ac33;})['then'](respondWithFilteredResult(_0x18e215,_0x47a32d))[_0xafbd('0x44')](handleError(_0x18e215,null));};exports[_0xafbd('0x45')]=function(_0x5ab154,_0x34459a){var _0x50686d={'raw':![],'where':{'id':_0x5ab154[_0xafbd('0x46')]['id']}},_0x56c079={};_0x56c079['model']=_[_0xafbd('0x2f')](db[_0xafbd('0x2c')][_0xafbd('0x2d')]);_0x56c079['query']=_['keys'](_0x5ab154['query']);_0x56c079[_0xafbd('0x30')]=_[_0xafbd('0x31')](_0x56c079[_0xafbd('0x32')],_0x56c079[_0xafbd('0x33')]);_0x50686d[_0xafbd('0x34')]=_[_0xafbd('0x31')](_0x56c079[_0xafbd('0x32')],qs[_0xafbd('0x35')](_0x5ab154['query'][_0xafbd('0x35')]));_0x50686d[_0xafbd('0x34')]=_0x50686d['attributes']['length']?_0x50686d[_0xafbd('0x34')]:_0x56c079[_0xafbd('0x32')];if(_0x5ab154[_0xafbd('0x33')][_0xafbd('0x47')]){_0x50686d['include']=[{'all':!![]}];}_0x50686d=_[_0xafbd('0x3c')]({},_0x50686d,_0x5ab154[_0xafbd('0x40')]);return db[_0xafbd('0x2c')][_0xafbd('0x48')](_0x50686d)[_0xafbd('0x24')](handleEntityNotFound(_0x34459a,null))[_0xafbd('0x24')](respondWithResult(_0x34459a,null))['catch'](handleError(_0x34459a,null));};exports['create']=function(_0x3bd789,_0x4402ba){return db['Integration']['create'](_0x3bd789[_0xafbd('0x49')],{})[_0xafbd('0x24')](respondWithResult(_0x4402ba,0xc9))[_0xafbd('0x44')](handleError(_0x4402ba,null));};exports[_0xafbd('0x4a')]=function(_0x239577,_0x123c7a){if(_0x239577['body']['id']){delete _0x239577[_0xafbd('0x49')]['id'];}return db['Integration'][_0xafbd('0x48')]({'where':{'id':_0x239577[_0xafbd('0x46')]['id']}})[_0xafbd('0x24')](handleEntityNotFound(_0x123c7a,null))[_0xafbd('0x24')](saveUpdates(_0x239577[_0xafbd('0x49')],null))[_0xafbd('0x24')](respondWithResult(_0x123c7a,null))[_0xafbd('0x44')](handleError(_0x123c7a,null));};exports['destroy']=function(_0x5be8f9,_0x3718ba){return db[_0xafbd('0x2c')][_0xafbd('0x48')]({'where':{'id':_0x5be8f9[_0xafbd('0x46')]['id']}})[_0xafbd('0x24')](handleEntityNotFound(_0x3718ba,null))['then'](removeEntity(_0x3718ba,null))[_0xafbd('0x44')](handleError(_0x3718ba,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 91885aa..140c919 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 _0xb061=['request-promise','path','rimraf','../../config/environment','./integration.attributes','define','Integration','lodash','../../config/logger','api','bluebird'];(function(_0x361c74,_0x11d6ff){var _0x279933=function(_0x206368){while(--_0x206368){_0x361c74['push'](_0x361c74['shift']());}};_0x279933(++_0x11d6ff);}(_0xb061,0x8b));var _0x1b06=function(_0xffdd08,_0x5cfdbc){_0xffdd08=_0xffdd08-0x0;var _0x2cb77f=_0xb061[_0xffdd08];return _0x2cb77f;};'use strict';var _=require(_0x1b06('0x0'));var util=require('util');var logger=require(_0x1b06('0x1'))(_0x1b06('0x2'));var moment=require('moment');var BPromise=require(_0x1b06('0x3'));var rp=require(_0x1b06('0x4'));var fs=require('fs');var path=require(_0x1b06('0x5'));var rimraf=require(_0x1b06('0x6'));var config=require(_0x1b06('0x7'));var attributes=require(_0x1b06('0x8'));module['exports']=function(_0x3aaa0f,_0x32dfdb){return _0x3aaa0f[_0x1b06('0x9')](_0x1b06('0xa'),attributes,{'tableName':'integrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x77d3=['Integration','integrations','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x236cd5,_0x3f4e5a){var _0x56d69c=function(_0x2e147c){while(--_0x2e147c){_0x236cd5['push'](_0x236cd5['shift']());}};_0x56d69c(++_0x3f4e5a);}(_0x77d3,0x122));var _0x377d=function(_0xadcfdc,_0x4bd341){_0xadcfdc=_0xadcfdc-0x0;var _0x119c5e=_0x77d3[_0xadcfdc];return _0x119c5e;};'use strict';var _=require(_0x377d('0x0'));var util=require(_0x377d('0x1'));var logger=require('../../config/logger')(_0x377d('0x2'));var moment=require('moment');var BPromise=require(_0x377d('0x3'));var rp=require(_0x377d('0x4'));var fs=require('fs');var path=require(_0x377d('0x5'));var rimraf=require(_0x377d('0x6'));var config=require(_0x377d('0x7'));var attributes=require('./integration.attributes');module[_0x377d('0x8')]=function(_0x27f477,_0x57b60e){return _0x27f477[_0x377d('0x9')](_0x377d('0xa'),attributes,{'tableName':_0x377d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integration/integration.rpc.js b/server/api/integration/integration.rpc.js index 3240916..ace100a 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 _0xab29=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','bluebird','ioredis'];(function(_0x4808fd,_0x409407){var _0x2aa850=function(_0x10cd03){while(--_0x10cd03){_0x4808fd['push'](_0x4808fd['shift']());}};_0x2aa850(++_0x409407);}(_0xab29,0x145));var _0x9ab2=function(_0x44a8ef,_0x55b134){_0x44a8ef=_0x44a8ef-0x0;var _0x36ea0f=_0xab29[_0x44a8ef];return _0x36ea0f;};'use strict';var _=require(_0x9ab2('0x0'));var util=require(_0x9ab2('0x1'));var moment=require(_0x9ab2('0x2'));var BPromise=require(_0x9ab2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9ab2('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9ab2('0x5'));var logger=require(_0x9ab2('0x6'))(_0x9ab2('0x7'));var config=require(_0x9ab2('0x8'));var jayson=require(_0x9ab2('0x9'));var client=jayson['client'][_0x9ab2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3739c8,_0x42d544,_0x3c73e5){return new BPromise(function(_0x3a3553,_0x564109){return client[_0x9ab2('0xb')](_0x3739c8,_0x3c73e5)[_0x9ab2('0xc')](function(_0x398547){logger[_0x9ab2('0xd')](_0x9ab2('0xe'),_0x42d544,_0x9ab2('0xf'));logger[_0x9ab2('0x10')](_0x9ab2('0x11'),_0x42d544,_0x9ab2('0xf'),JSON['stringify'](_0x398547));if(_0x398547[_0x9ab2('0x12')]){if(_0x398547[_0x9ab2('0x12')]['code']===0x1f4){logger['error'](_0x9ab2('0xe'),_0x42d544,_0x398547[_0x9ab2('0x12')][_0x9ab2('0x13')]);return _0x564109(_0x398547['error'][_0x9ab2('0x13')]);}logger[_0x9ab2('0x12')]('Integration,\x20%s,\x20%s',_0x42d544,_0x398547[_0x9ab2('0x12')][_0x9ab2('0x13')]);return _0x3a3553(_0x398547[_0x9ab2('0x12')][_0x9ab2('0x13')]);}else{logger[_0x9ab2('0xd')](_0x9ab2('0xe'),_0x42d544,_0x9ab2('0xf'));_0x3a3553(_0x398547[_0x9ab2('0x14')]['message']);}})[_0x9ab2('0x15')](function(_0x273e07){logger[_0x9ab2('0x12')](_0x9ab2('0xe'),_0x42d544,_0x273e07);_0x564109(_0x273e07);});});} \ No newline at end of file +var _0x0683=['stringify','error','code','message','catch','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Integration,\x20%s,\x20%s','debug','Integration,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x12e824,_0x2aea84){var _0x13c134=function(_0x5a91c1){while(--_0x5a91c1){_0x12e824['push'](_0x12e824['shift']());}};_0x13c134(++_0x2aea84);}(_0x0683,0xe1));var _0x3068=function(_0x1cfd9c,_0x3c0dd6){_0x1cfd9c=_0x1cfd9c-0x0;var _0xa68ac4=_0x0683[_0x1cfd9c];return _0xa68ac4;};'use strict';var _=require('lodash');var util=require(_0x3068('0x0'));var moment=require('moment');var BPromise=require(_0x3068('0x1'));var rs=require(_0x3068('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3068('0x3'))['db'];var utils=require(_0x3068('0x4'));var logger=require(_0x3068('0x5'))(_0x3068('0x6'));var config=require(_0x3068('0x7'));var jayson=require(_0x3068('0x8'));var client=jayson['client'][_0x3068('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x35c655,_0x5c7ca0,_0x38d93a){return new BPromise(function(_0x1aec00,_0x39dcbc){return client[_0x3068('0xa')](_0x35c655,_0x38d93a)[_0x3068('0xb')](function(_0x2a5f00){logger[_0x3068('0xc')](_0x3068('0xd'),_0x5c7ca0,'request\x20sent');logger[_0x3068('0xe')](_0x3068('0xf'),_0x5c7ca0,_0x3068('0x10'),JSON[_0x3068('0x11')](_0x2a5f00));if(_0x2a5f00[_0x3068('0x12')]){if(_0x2a5f00[_0x3068('0x12')][_0x3068('0x13')]===0x1f4){logger['error'](_0x3068('0xd'),_0x5c7ca0,_0x2a5f00[_0x3068('0x12')][_0x3068('0x14')]);return _0x39dcbc(_0x2a5f00[_0x3068('0x12')][_0x3068('0x14')]);}logger['error'](_0x3068('0xd'),_0x5c7ca0,_0x2a5f00['error'][_0x3068('0x14')]);return _0x1aec00(_0x2a5f00[_0x3068('0x12')][_0x3068('0x14')]);}else{logger['info'](_0x3068('0xd'),_0x5c7ca0,_0x3068('0x10'));_0x1aec00(_0x2a5f00['result'][_0x3068('0x14')]);}})[_0x3068('0x15')](function(_0x512d78){logger[_0x3068('0x12')](_0x3068('0xd'),_0x5c7ca0,_0x512d78);_0x39dcbc(_0x512d78);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 3322168..e3cbb60 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 _0x80c7=['./integrationReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../config/environment'];(function(_0x460bac,_0x1f11b1){var _0x17b493=function(_0x3dee94){while(--_0x3dee94){_0x460bac['push'](_0x460bac['shift']());}};_0x17b493(++_0x1f11b1);}(_0x80c7,0x8d));var _0x780c=function(_0x546f4b,_0x471ce5){_0x546f4b=_0x546f4b-0x0;var _0x5897b4=_0x80c7[_0x546f4b];return _0x5897b4;};'use strict';var multer=require(_0x780c('0x0'));var util=require(_0x780c('0x1'));var path=require(_0x780c('0x2'));var timeout=require(_0x780c('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x780c('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x780c('0x5'));var controller=require(_0x780c('0x6'));router[_0x780c('0x7')]('/',auth[_0x780c('0x8')](),controller[_0x780c('0x9')]);router[_0x780c('0x7')](_0x780c('0xa'),auth[_0x780c('0x8')](),controller[_0x780c('0xb')]);router[_0x780c('0x7')](_0x780c('0xc'),auth['isAuthenticated'](),controller[_0x780c('0xd')]);router[_0x780c('0xe')]('/',auth['isAuthenticated'](),controller[_0x780c('0xf')]);router[_0x780c('0x10')](_0x780c('0xc'),auth['isAuthenticated'](),controller[_0x780c('0x11')]);router[_0x780c('0x12')](_0x780c('0xc'),auth[_0x780c('0x8')](),controller[_0x780c('0x13')]);module[_0x780c('0x14')]=router; \ No newline at end of file +var _0x4bec=['multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./integrationReport.controller','get','/describe','describe','/:id','isAuthenticated','post','create','put','update','delete','destroy','exports'];(function(_0x2ee053,_0x1a5580){var _0x2d50ed=function(_0x108592){while(--_0x108592){_0x2ee053['push'](_0x2ee053['shift']());}};_0x2d50ed(++_0x1a5580);}(_0x4bec,0xdc));var _0xc4be=function(_0x491e75,_0x11d693){_0x491e75=_0x491e75-0x0;var _0x4f7522=_0x4bec[_0x491e75];return _0x4f7522;};'use strict';var multer=require(_0xc4be('0x0'));var util=require(_0xc4be('0x1'));var path=require('path');var timeout=require(_0xc4be('0x2'));var express=require(_0xc4be('0x3'));var router=express[_0xc4be('0x4')]();var auth=require(_0xc4be('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xc4be('0x6'));var controller=require(_0xc4be('0x7'));router[_0xc4be('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xc4be('0x8')](_0xc4be('0x9'),auth['isAuthenticated'](),controller[_0xc4be('0xa')]);router[_0xc4be('0x8')](_0xc4be('0xb'),auth[_0xc4be('0xc')](),controller['show']);router[_0xc4be('0xd')]('/',auth[_0xc4be('0xc')](),controller[_0xc4be('0xe')]);router[_0xc4be('0xf')]('/:id',auth[_0xc4be('0xc')](),controller[_0xc4be('0x10')]);router[_0xc4be('0x11')]('/:id',auth[_0xc4be('0xc')](),controller[_0xc4be('0x12')]);module[_0xc4be('0x13')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index b456ab6..2890ef2 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 _0x3a96=['SENT','SENDING','sequelize','exports','STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM'];(function(_0x56cffb,_0x1328f4){var _0xcf62b1=function(_0x2f0a83){while(--_0x2f0a83){_0x56cffb['push'](_0x56cffb['shift']());}};_0xcf62b1(++_0x1328f4);}(_0x3a96,0xf2));var _0x63a9=function(_0x9ef177,_0x3eb331){_0x9ef177=_0x9ef177-0x0;var _0x32fa65=_0x3a96[_0x9ef177];return _0x32fa65;};'use strict';var Sequelize=require(_0x63a9('0x0'));module[_0x63a9('0x1')]={'integration':{'type':Sequelize[_0x63a9('0x2')]},'eventChannel':{'type':Sequelize[_0x63a9('0x2')]},'exitStatus':{'type':Sequelize[_0x63a9('0x2')]},'ticketId':{'type':Sequelize[_0x63a9('0x2')]},'integrationId':{'type':Sequelize[_0x63a9('0x3')]},'contacts':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x63a9('0x2')]},'calleridnum':{'type':Sequelize[_0x63a9('0x2')]},'calleridname':{'type':Sequelize[_0x63a9('0x2')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x63a9('0x2')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x63a9('0x4')]},'agentconnectAt':{'type':Sequelize[_0x63a9('0x4')]},'holdtime':{'type':Sequelize[_0x63a9('0x3')]},'agentcomplete':{'type':Sequelize[_0x63a9('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x63a9('0x4')]},'talktime':{'type':Sequelize[_0x63a9('0x3')]},'agentacw':{'type':Sequelize[_0x63a9('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x63a9('0x3')]},'reason':{'type':Sequelize[_0x63a9('0x2')]},'agentringnoanswer':{'type':Sequelize[_0x63a9('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x63a9('0x4')]},'agentdump':{'type':Sequelize[_0x63a9('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x63a9('0x4')]},'lastevent':{'type':Sequelize[_0x63a9('0x2')]},'channel':{'type':Sequelize[_0x63a9('0x2')]},'channelstate':{'type':Sequelize[_0x63a9('0x3')]},'channelstatedesc':{'type':Sequelize[_0x63a9('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x63a9('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x63a9('0x2')]},'exten':{'type':Sequelize[_0x63a9('0x2')]},'priority':{'type':Sequelize[_0x63a9('0x2')]},'destchannel':{'type':Sequelize[_0x63a9('0x2')]},'destchannelstate':{'type':Sequelize[_0x63a9('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x63a9('0x2')]},'destcalleridnum':{'type':Sequelize[_0x63a9('0x2')]},'destcalleridname':{'type':Sequelize[_0x63a9('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x63a9('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x63a9('0x2')]},'destlanguage':{'type':Sequelize[_0x63a9('0x2')]},'destaccountcode':{'type':Sequelize[_0x63a9('0x2')]},'destcontext':{'type':Sequelize[_0x63a9('0x2')]},'destexten':{'type':Sequelize[_0x63a9('0x2')]},'destpriority':{'type':Sequelize[_0x63a9('0x2')]},'destuniqueid':{'type':Sequelize[_0x63a9('0x2')]},'messageId':{'type':Sequelize[_0x63a9('0x2')]},'inReplyTo':{'type':Sequelize[_0x63a9('0x2')]},'subject':{'type':Sequelize[_0x63a9('0x2')]},'from':{'type':Sequelize[_0x63a9('0x2')]},'to':{'type':Sequelize[_0x63a9('0x2')]},'cc':{'type':Sequelize[_0x63a9('0x2')]},'attachment':{'type':Sequelize[_0x63a9('0x6')]},'html':{'type':Sequelize[_0x63a9('0x6')]},'text':{'type':Sequelize[_0x63a9('0x6')]},'status':{'type':Sequelize[_0x63a9('0x7')](_0x63a9('0x8'),_0x63a9('0x9'),'RECEIVED','FAILED')},'url':{'type':Sequelize[_0x63a9('0x2')]},'app':{'type':Sequelize[_0x63a9('0x2')]},'appdata':{'type':Sequelize[_0x63a9('0x2')]},'projectId':{'type':Sequelize[_0x63a9('0x3')]}}; \ No newline at end of file +var _0x5e71=['STRING','DATE','INTEGER','BOOLEAN','TEXT','ENUM','SENT','SENDING','RECEIVED','FAILED','sequelize','exports'];(function(_0x22badb,_0x3ef08b){var _0x331a9a=function(_0x44c01c){while(--_0x44c01c){_0x22badb['push'](_0x22badb['shift']());}};_0x331a9a(++_0x3ef08b);}(_0x5e71,0x6a));var _0x15e7=function(_0x44a7d2,_0x9833e7){_0x44a7d2=_0x44a7d2-0x0;var _0x16d944=_0x5e71[_0x44a7d2];return _0x16d944;};'use strict';var Sequelize=require(_0x15e7('0x0'));module[_0x15e7('0x1')]={'integration':{'type':Sequelize[_0x15e7('0x2')]},'eventChannel':{'type':Sequelize[_0x15e7('0x2')]},'exitStatus':{'type':Sequelize[_0x15e7('0x2')]},'ticketId':{'type':Sequelize[_0x15e7('0x2')]},'integrationId':{'type':Sequelize['INTEGER']},'contacts':{'type':Sequelize[_0x15e7('0x2')]},'uniqueid':{'type':Sequelize[_0x15e7('0x2')]},'calleridnum':{'type':Sequelize[_0x15e7('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x15e7('0x2')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0x15e7('0x3')]},'holdtime':{'type':Sequelize[_0x15e7('0x4')]},'agentcomplete':{'type':Sequelize[_0x15e7('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x15e7('0x3')]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0x15e7('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0x15e7('0x2')]},'agentringnoanswer':{'type':Sequelize[_0x15e7('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x15e7('0x3')]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x15e7('0x3')]},'lastevent':{'type':Sequelize[_0x15e7('0x2')]},'channel':{'type':Sequelize[_0x15e7('0x2')]},'channelstate':{'type':Sequelize[_0x15e7('0x4')]},'channelstatedesc':{'type':Sequelize[_0x15e7('0x2')]},'connectedlinenum':{'type':Sequelize[_0x15e7('0x2')]},'connectedlinename':{'type':Sequelize[_0x15e7('0x2')]},'language':{'type':Sequelize[_0x15e7('0x2')]},'accountcode':{'type':Sequelize[_0x15e7('0x2')]},'context':{'type':Sequelize[_0x15e7('0x2')]},'exten':{'type':Sequelize[_0x15e7('0x2')]},'priority':{'type':Sequelize[_0x15e7('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x15e7('0x4')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x15e7('0x2')]},'destcalleridname':{'type':Sequelize[_0x15e7('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x15e7('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x15e7('0x2')]},'destaccountcode':{'type':Sequelize[_0x15e7('0x2')]},'destcontext':{'type':Sequelize[_0x15e7('0x2')]},'destexten':{'type':Sequelize[_0x15e7('0x2')]},'destpriority':{'type':Sequelize[_0x15e7('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'messageId':{'type':Sequelize[_0x15e7('0x2')]},'inReplyTo':{'type':Sequelize[_0x15e7('0x2')]},'subject':{'type':Sequelize[_0x15e7('0x2')]},'from':{'type':Sequelize[_0x15e7('0x2')]},'to':{'type':Sequelize[_0x15e7('0x2')]},'cc':{'type':Sequelize['STRING']},'attachment':{'type':Sequelize[_0x15e7('0x6')]},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize['TEXT']},'status':{'type':Sequelize[_0x15e7('0x7')](_0x15e7('0x8'),_0x15e7('0x9'),_0x15e7('0xa'),_0x15e7('0xb'))},'url':{'type':Sequelize[_0x15e7('0x2')]},'app':{'type':Sequelize[_0x15e7('0x2')]},'appdata':{'type':Sequelize[_0x15e7('0x2')]},'projectId':{'type':Sequelize[_0x15e7('0x4')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 151cc0c..6b14d77 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 _0x8e65=['save','then','destroy','error','stack','name','send','IntegrationReport','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','VIRTUAL','merge','options','rows','show','params','fields','include','find','body','catch','update','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject'];(function(_0x4f665f,_0x22745e){var _0x4994eb=function(_0x578885){while(--_0x578885){_0x4f665f['push'](_0x4f665f['shift']());}};_0x4994eb(++_0x22745e);}(_0x8e65,0x1a0));var _0x58e6=function(_0x80578c,_0x1a7499){_0x80578c=_0x80578c-0x0;var _0x1389a3=_0x8e65[_0x80578c];return _0x1389a3;};'use strict';var pdf=require(_0x58e6('0x0'));var emlformat=require(_0x58e6('0x1'));var rimraf=require(_0x58e6('0x2'));var zipdir=require(_0x58e6('0x3'));var jsonpatch=require(_0x58e6('0x4'));var rp=require('request-promise');var moment=require(_0x58e6('0x5'));var BPromise=require(_0x58e6('0x6'));var Mustache=require(_0x58e6('0x7'));var util=require(_0x58e6('0x8'));var path=require(_0x58e6('0x9'));var sox=require(_0x58e6('0xa'));var csv=require(_0x58e6('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x58e6('0xc'));var squel=require(_0x58e6('0xd'));var crypto=require('crypto');var jsforce=require(_0x58e6('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x58e6('0xb'));var querystring=require(_0x58e6('0xf'));var Papa=require(_0x58e6('0x10'));var Redis=require(_0x58e6('0x11'));var authService=require(_0x58e6('0x12'));var qs=require(_0x58e6('0x13'));var as=require(_0x58e6('0x14'));var hardwareService=require(_0x58e6('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x58e6('0x16'));var config=require(_0x58e6('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x24e7e6,_0xc66776){_0xc66776=_0xc66776||0xcc;return function(_0x386513){if(_0x386513){return _0x24e7e6[_0x58e6('0x18')](_0xc66776);}return _0x24e7e6[_0x58e6('0x19')](_0xc66776)[_0x58e6('0x1a')]();};}function respondWithResult(_0x21564c,_0x55a9ee){_0x55a9ee=_0x55a9ee||0xc8;return function(_0x1cc5df){if(_0x1cc5df){return _0x21564c['status'](_0x55a9ee)[_0x58e6('0x1b')](_0x1cc5df);}};}function respondWithFilteredResult(_0x1d33de,_0x19c0ae){return function(_0x1bab9c){if(_0x1bab9c){var _0x4ed4e3=_0x1bab9c[_0x58e6('0x1c')],_0x4e2c2f=_0x19c0ae[_0x58e6('0x1d')],_0x3a026f=_0x19c0ae[_0x58e6('0x1d')]+_0x19c0ae['limit'],_0x59fce5;if(_0x3a026f>=_0x4ed4e3){_0x3a026f=_0x4ed4e3;_0x59fce5=0xc8;}else{_0x59fce5=0xce;}_0x1d33de['status'](_0x59fce5);return _0x1d33de[_0x58e6('0x1e')](_0x58e6('0x1f'),_0x4e2c2f+'-'+_0x3a026f+'/'+_0x4ed4e3)[_0x58e6('0x1b')](_0x1bab9c);}return null;};}function patchUpdates(_0x4f1acc){return function(_0xcd4b1c){try{jsonpatch[_0x58e6('0x20')](_0xcd4b1c,_0x4f1acc,!![]);}catch(_0x57386b){return BPromise[_0x58e6('0x21')](_0x57386b);}return _0xcd4b1c[_0x58e6('0x22')]();};}function saveUpdates(_0x169b73,_0x557ec4){return function(_0x2f4b7b){if(_0x2f4b7b){return _0x2f4b7b['update'](_0x169b73)[_0x58e6('0x23')](function(_0xd1585a){return _0xd1585a;});}return null;};}function removeEntity(_0x3ee06f,_0x376798){return function(_0xdaff3){if(_0xdaff3){return _0xdaff3[_0x58e6('0x24')]()[_0x58e6('0x23')](function(){_0x3ee06f['status'](0xcc)[_0x58e6('0x1a')]();});}};}function handleEntityNotFound(_0x13c3e6,_0x2d1e4b){return function(_0x5af00f){if(!_0x5af00f){_0x13c3e6[_0x58e6('0x18')](0x194);}return _0x5af00f;};}function handleError(_0x1915ef,_0x410ecb){_0x410ecb=_0x410ecb||0x1f4;return function(_0x4fff60){logger[_0x58e6('0x25')](_0x4fff60[_0x58e6('0x26')]);if(_0x4fff60['name']){delete _0x4fff60[_0x58e6('0x27')];}_0x1915ef['status'](_0x410ecb)[_0x58e6('0x28')](_0x4fff60);};}exports['index']=function(_0x36e54d,_0xa366a6){var _0x5cbe40={},_0x31a305={},_0x269b68={'count':0x0,'rows':[]};var _0x2a3951=_['map'](db[_0x58e6('0x29')][_0x58e6('0x2a')],function(_0x526d44){return{'name':_0x526d44[_0x58e6('0x2b')],'type':_0x526d44[_0x58e6('0x2c')][_0x58e6('0x2d')]};});_0x31a305[_0x58e6('0x2e')]=_[_0x58e6('0x2f')](_0x2a3951,_0x58e6('0x27'));_0x31a305['query']=_[_0x58e6('0x30')](_0x36e54d[_0x58e6('0x31')]);_0x31a305[_0x58e6('0x32')]=_[_0x58e6('0x33')](_0x31a305[_0x58e6('0x2e')],_0x31a305[_0x58e6('0x31')]);_0x5cbe40[_0x58e6('0x34')]=_[_0x58e6('0x33')](_0x31a305['model'],qs['fields'](_0x36e54d[_0x58e6('0x31')]['fields']));_0x5cbe40[_0x58e6('0x34')]=_0x5cbe40['attributes'][_0x58e6('0x35')]?_0x5cbe40[_0x58e6('0x34')]:_0x31a305['model'];if(!_0x36e54d[_0x58e6('0x31')][_0x58e6('0x36')](_0x58e6('0x37'))){_0x5cbe40[_0x58e6('0x38')]=qs[_0x58e6('0x38')](_0x36e54d['query']['limit']);_0x5cbe40[_0x58e6('0x1d')]=qs[_0x58e6('0x1d')](_0x36e54d[_0x58e6('0x31')]['offset']);}_0x5cbe40[_0x58e6('0x39')]=qs[_0x58e6('0x3a')](_0x36e54d[_0x58e6('0x31')][_0x58e6('0x3a')]);_0x5cbe40[_0x58e6('0x3b')]=qs['filters'](_[_0x58e6('0x3c')](_0x36e54d[_0x58e6('0x31')],_0x31a305[_0x58e6('0x32')]),_0x2a3951);if(_0x36e54d[_0x58e6('0x31')][_0x58e6('0x3d')]){_0x5cbe40['where']=_['merge'](_0x5cbe40['where'],{'$or':_[_0x58e6('0x2f')](_0x2a3951,function(_0x3ad2b0){if(_0x3ad2b0[_0x58e6('0x2c')]!==_0x58e6('0x3e')){var _0x61096c={};_0x61096c[_0x3ad2b0[_0x58e6('0x27')]]={'$like':'%'+_0x36e54d['query'][_0x58e6('0x3d')]+'%'};return _0x61096c;}})});}_0x5cbe40=_[_0x58e6('0x3f')]({},_0x5cbe40,_0x36e54d[_0x58e6('0x40')]);var _0x3ce46a={'where':_0x5cbe40[_0x58e6('0x3b')]};return db[_0x58e6('0x29')]['count'](_0x3ce46a)['then'](function(_0x3d800e){_0x269b68[_0x58e6('0x1c')]=_0x3d800e;if(_0x36e54d[_0x58e6('0x31')]['includeAll']){_0x5cbe40['include']=[{'all':!![]}];}return db[_0x58e6('0x29')]['findAll'](_0x5cbe40);})['then'](function(_0x50719d){_0x269b68[_0x58e6('0x41')]=_0x50719d;return _0x269b68;})[_0x58e6('0x23')](respondWithFilteredResult(_0xa366a6,_0x5cbe40))['catch'](handleError(_0xa366a6,null));};exports[_0x58e6('0x42')]=function(_0x2e2f8b,_0x2df1e2){var _0x17202e={'raw':![],'where':{'id':_0x2e2f8b[_0x58e6('0x43')]['id']}},_0x1390df={};_0x1390df[_0x58e6('0x2e')]=_['keys'](db[_0x58e6('0x29')][_0x58e6('0x2a')]);_0x1390df[_0x58e6('0x31')]=_[_0x58e6('0x30')](_0x2e2f8b[_0x58e6('0x31')]);_0x1390df[_0x58e6('0x32')]=_[_0x58e6('0x33')](_0x1390df[_0x58e6('0x2e')],_0x1390df[_0x58e6('0x31')]);_0x17202e['attributes']=_[_0x58e6('0x33')](_0x1390df['model'],qs[_0x58e6('0x44')](_0x2e2f8b[_0x58e6('0x31')][_0x58e6('0x44')]));_0x17202e[_0x58e6('0x34')]=_0x17202e['attributes']['length']?_0x17202e['attributes']:_0x1390df[_0x58e6('0x2e')];if(_0x2e2f8b[_0x58e6('0x31')]['includeAll']){_0x17202e[_0x58e6('0x45')]=[{'all':!![]}];}_0x17202e=_[_0x58e6('0x3f')]({},_0x17202e,_0x2e2f8b['options']);return db[_0x58e6('0x29')][_0x58e6('0x46')](_0x17202e)[_0x58e6('0x23')](handleEntityNotFound(_0x2df1e2,null))[_0x58e6('0x23')](respondWithResult(_0x2df1e2,null))['catch'](handleError(_0x2df1e2,null));};exports['create']=function(_0xc133cb,_0x5b51de){return db['IntegrationReport']['create'](_0xc133cb[_0x58e6('0x47')],{})['then'](respondWithResult(_0x5b51de,0xc9))[_0x58e6('0x48')](handleError(_0x5b51de,null));};exports[_0x58e6('0x49')]=function(_0x53b018,_0x4a0a16){if(_0x53b018[_0x58e6('0x47')]['id']){delete _0x53b018[_0x58e6('0x47')]['id'];}return db[_0x58e6('0x29')]['find']({'where':{'id':_0x53b018['params']['id']}})[_0x58e6('0x23')](handleEntityNotFound(_0x4a0a16,null))[_0x58e6('0x23')](saveUpdates(_0x53b018[_0x58e6('0x47')],null))[_0x58e6('0x23')](respondWithResult(_0x4a0a16,null))[_0x58e6('0x48')](handleError(_0x4a0a16,null));};exports[_0x58e6('0x24')]=function(_0x4116c2,_0x3039c5){return db[_0x58e6('0x29')][_0x58e6('0x46')]({'where':{'id':_0x4116c2[_0x58e6('0x43')]['id']}})[_0x58e6('0x23')](handleEntityNotFound(_0x3039c5,null))[_0x58e6('0x23')](removeEntity(_0x3039c5,null))[_0x58e6('0x48')](handleError(_0x3039c5,null));};exports['describe']=function(_0x423f01,_0x3e056c){return db[_0x58e6('0x29')][_0x58e6('0x4a')]()[_0x58e6('0x23')](respondWithResult(_0x3e056c,null))['catch'](handleError(_0x3e056c,null));}; \ No newline at end of file +var _0x8d24=['destroy','error','stack','name','send','map','IntegrationReport','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','count','includeAll','include','findAll','catch','show','keys','create','body','find','params','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','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','status','end','json','offset','set','apply','reject','save','then'];(function(_0xd93cbe,_0x11202e){var _0xe0bb40=function(_0x50f4cc){while(--_0x50f4cc){_0xd93cbe['push'](_0xd93cbe['shift']());}};_0xe0bb40(++_0x11202e);}(_0x8d24,0x74));var _0x48d2=function(_0x44e7b6,_0x227953){_0x44e7b6=_0x44e7b6-0x0;var _0x325047=_0x8d24[_0x44e7b6];return _0x325047;};'use strict';var pdf=require(_0x48d2('0x0'));var emlformat=require(_0x48d2('0x1'));var rimraf=require(_0x48d2('0x2'));var zipdir=require(_0x48d2('0x3'));var jsonpatch=require(_0x48d2('0x4'));var rp=require(_0x48d2('0x5'));var moment=require(_0x48d2('0x6'));var BPromise=require(_0x48d2('0x7'));var Mustache=require('mustache');var util=require(_0x48d2('0x8'));var path=require(_0x48d2('0x9'));var sox=require('sox');var csv=require(_0x48d2('0xa'));var ejs=require(_0x48d2('0xb'));var fs=require('fs');var _=require(_0x48d2('0xc'));var squel=require(_0x48d2('0xd'));var crypto=require(_0x48d2('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x48d2('0xf'));var toCsv=require(_0x48d2('0xa'));var querystring=require(_0x48d2('0x10'));var Papa=require(_0x48d2('0x11'));var Redis=require(_0x48d2('0x12'));var authService=require(_0x48d2('0x13'));var qs=require(_0x48d2('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x48d2('0x15'));var logger=require(_0x48d2('0x16'))(_0x48d2('0x17'));var utils=require(_0x48d2('0x18'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5cd33e,_0x4d2830){_0x4d2830=_0x4d2830||0xcc;return function(_0x58469c){if(_0x58469c){return _0x5cd33e['sendStatus'](_0x4d2830);}return _0x5cd33e[_0x48d2('0x19')](_0x4d2830)[_0x48d2('0x1a')]();};}function respondWithResult(_0x346dbd,_0xdda0d4){_0xdda0d4=_0xdda0d4||0xc8;return function(_0x3b11a1){if(_0x3b11a1){return _0x346dbd[_0x48d2('0x19')](_0xdda0d4)[_0x48d2('0x1b')](_0x3b11a1);}};}function respondWithFilteredResult(_0x2f7a07,_0x25707d){return function(_0x485667){if(_0x485667){var _0x20e470=_0x485667['count'],_0x1f0526=_0x25707d[_0x48d2('0x1c')],_0x33b950=_0x25707d[_0x48d2('0x1c')]+_0x25707d['limit'],_0x49007c;if(_0x33b950>=_0x20e470){_0x33b950=_0x20e470;_0x49007c=0xc8;}else{_0x49007c=0xce;}_0x2f7a07['status'](_0x49007c);return _0x2f7a07[_0x48d2('0x1d')]('Content-Range',_0x1f0526+'-'+_0x33b950+'/'+_0x20e470)[_0x48d2('0x1b')](_0x485667);}return null;};}function patchUpdates(_0x54f008){return function(_0x42fcbd){try{jsonpatch[_0x48d2('0x1e')](_0x42fcbd,_0x54f008,!![]);}catch(_0x3bf1cc){return BPromise[_0x48d2('0x1f')](_0x3bf1cc);}return _0x42fcbd[_0x48d2('0x20')]();};}function saveUpdates(_0x159c70,_0x416f41){return function(_0x19bbac){if(_0x19bbac){return _0x19bbac['update'](_0x159c70)[_0x48d2('0x21')](function(_0x46a96f){return _0x46a96f;});}return null;};}function removeEntity(_0x30e1bf,_0x989d62){return function(_0x305424){if(_0x305424){return _0x305424[_0x48d2('0x22')]()[_0x48d2('0x21')](function(){_0x30e1bf['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x464e73,_0x45350d){return function(_0x516274){if(!_0x516274){_0x464e73['sendStatus'](0x194);}return _0x516274;};}function handleError(_0xc5daaa,_0x3d8bbe){_0x3d8bbe=_0x3d8bbe||0x1f4;return function(_0x849d74){logger[_0x48d2('0x23')](_0x849d74[_0x48d2('0x24')]);if(_0x849d74[_0x48d2('0x25')]){delete _0x849d74[_0x48d2('0x25')];}_0xc5daaa[_0x48d2('0x19')](_0x3d8bbe)[_0x48d2('0x26')](_0x849d74);};}exports['index']=function(_0x17e323,_0x6fdd86){var _0x227733={},_0x6ef42={},_0x23190b={'count':0x0,'rows':[]};var _0x1011b5=_[_0x48d2('0x27')](db[_0x48d2('0x28')][_0x48d2('0x29')],function(_0x1461a5){return{'name':_0x1461a5[_0x48d2('0x2a')],'type':_0x1461a5['type'][_0x48d2('0x2b')]};});_0x6ef42[_0x48d2('0x2c')]=_[_0x48d2('0x27')](_0x1011b5,'name');_0x6ef42['query']=_['keys'](_0x17e323[_0x48d2('0x2d')]);_0x6ef42[_0x48d2('0x2e')]=_[_0x48d2('0x2f')](_0x6ef42['model'],_0x6ef42[_0x48d2('0x2d')]);_0x227733[_0x48d2('0x30')]=_[_0x48d2('0x2f')](_0x6ef42['model'],qs[_0x48d2('0x31')](_0x17e323[_0x48d2('0x2d')][_0x48d2('0x31')]));_0x227733[_0x48d2('0x30')]=_0x227733['attributes'][_0x48d2('0x32')]?_0x227733[_0x48d2('0x30')]:_0x6ef42[_0x48d2('0x2c')];if(!_0x17e323['query'][_0x48d2('0x33')](_0x48d2('0x34'))){_0x227733[_0x48d2('0x35')]=qs['limit'](_0x17e323[_0x48d2('0x2d')][_0x48d2('0x35')]);_0x227733[_0x48d2('0x1c')]=qs[_0x48d2('0x1c')](_0x17e323[_0x48d2('0x2d')]['offset']);}_0x227733[_0x48d2('0x36')]=qs['sort'](_0x17e323[_0x48d2('0x2d')][_0x48d2('0x37')]);_0x227733['where']=qs['filters'](_[_0x48d2('0x38')](_0x17e323[_0x48d2('0x2d')],_0x6ef42[_0x48d2('0x2e')]),_0x1011b5);if(_0x17e323[_0x48d2('0x2d')][_0x48d2('0x39')]){_0x227733[_0x48d2('0x3a')]=_[_0x48d2('0x3b')](_0x227733['where'],{'$or':_[_0x48d2('0x27')](_0x1011b5,function(_0x49e9ba){if(_0x49e9ba[_0x48d2('0x3c')]!==_0x48d2('0x3d')){var _0x23a6d2={};_0x23a6d2[_0x49e9ba[_0x48d2('0x25')]]={'$like':'%'+_0x17e323[_0x48d2('0x2d')]['filter']+'%'};return _0x23a6d2;}})});}_0x227733=_[_0x48d2('0x3b')]({},_0x227733,_0x17e323[_0x48d2('0x3e')]);var _0xe8f8c0={'where':_0x227733[_0x48d2('0x3a')]};return db['IntegrationReport'][_0x48d2('0x3f')](_0xe8f8c0)['then'](function(_0xda8429){_0x23190b[_0x48d2('0x3f')]=_0xda8429;if(_0x17e323[_0x48d2('0x2d')][_0x48d2('0x40')]){_0x227733[_0x48d2('0x41')]=[{'all':!![]}];}return db[_0x48d2('0x28')][_0x48d2('0x42')](_0x227733);})[_0x48d2('0x21')](function(_0x5b74cb){_0x23190b['rows']=_0x5b74cb;return _0x23190b;})[_0x48d2('0x21')](respondWithFilteredResult(_0x6fdd86,_0x227733))[_0x48d2('0x43')](handleError(_0x6fdd86,null));};exports[_0x48d2('0x44')]=function(_0x3b863b,_0x110c26){var _0x2e3af6={'raw':![],'where':{'id':_0x3b863b['params']['id']}},_0x4a255c={};_0x4a255c[_0x48d2('0x2c')]=_[_0x48d2('0x45')](db[_0x48d2('0x28')][_0x48d2('0x29')]);_0x4a255c[_0x48d2('0x2d')]=_['keys'](_0x3b863b[_0x48d2('0x2d')]);_0x4a255c[_0x48d2('0x2e')]=_['intersection'](_0x4a255c[_0x48d2('0x2c')],_0x4a255c['query']);_0x2e3af6[_0x48d2('0x30')]=_[_0x48d2('0x2f')](_0x4a255c[_0x48d2('0x2c')],qs[_0x48d2('0x31')](_0x3b863b[_0x48d2('0x2d')]['fields']));_0x2e3af6[_0x48d2('0x30')]=_0x2e3af6[_0x48d2('0x30')]['length']?_0x2e3af6[_0x48d2('0x30')]:_0x4a255c[_0x48d2('0x2c')];if(_0x3b863b[_0x48d2('0x2d')][_0x48d2('0x40')]){_0x2e3af6['include']=[{'all':!![]}];}_0x2e3af6=_[_0x48d2('0x3b')]({},_0x2e3af6,_0x3b863b[_0x48d2('0x3e')]);return db[_0x48d2('0x28')]['find'](_0x2e3af6)[_0x48d2('0x21')](handleEntityNotFound(_0x110c26,null))[_0x48d2('0x21')](respondWithResult(_0x110c26,null))[_0x48d2('0x43')](handleError(_0x110c26,null));};exports[_0x48d2('0x46')]=function(_0x10e1bc,_0x47c3ce){return db[_0x48d2('0x28')][_0x48d2('0x46')](_0x10e1bc['body'],{})[_0x48d2('0x21')](respondWithResult(_0x47c3ce,0xc9))['catch'](handleError(_0x47c3ce,null));};exports['update']=function(_0x2c0a05,_0x4df254){if(_0x2c0a05['body']['id']){delete _0x2c0a05[_0x48d2('0x47')]['id'];}return db['IntegrationReport'][_0x48d2('0x48')]({'where':{'id':_0x2c0a05[_0x48d2('0x49')]['id']}})['then'](handleEntityNotFound(_0x4df254,null))[_0x48d2('0x21')](saveUpdates(_0x2c0a05[_0x48d2('0x47')],null))[_0x48d2('0x21')](respondWithResult(_0x4df254,null))[_0x48d2('0x43')](handleError(_0x4df254,null));};exports['destroy']=function(_0x387580,_0x529ad3){return db['IntegrationReport'][_0x48d2('0x48')]({'where':{'id':_0x387580['params']['id']}})[_0x48d2('0x21')](handleEntityNotFound(_0x529ad3,null))['then'](removeEntity(_0x529ad3,null))[_0x48d2('0x43')](handleError(_0x529ad3,null));};exports['describe']=function(_0x40cbd7,_0x208de9){return db[_0x48d2('0x28')][_0x48d2('0x4a')]()['then'](respondWithResult(_0x208de9,null))[_0x48d2('0x43')](handleError(_0x208de9,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index c90fc71..0cba367 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 _0x4e7c=['lodash','util','../../config/logger','api','moment','request-promise','rimraf','exports','define','IntegrationReport','report_integration'];(function(_0x438e18,_0x52e2c5){var _0x50c6ea=function(_0x7ae358){while(--_0x7ae358){_0x438e18['push'](_0x438e18['shift']());}};_0x50c6ea(++_0x52e2c5);}(_0x4e7c,0x13f));var _0xc4e7=function(_0x31f89b,_0x146f7e){_0x31f89b=_0x31f89b-0x0;var _0x1ee03c=_0x4e7c[_0x31f89b];return _0x1ee03c;};'use strict';var _=require(_0xc4e7('0x0'));var util=require(_0xc4e7('0x1'));var logger=require(_0xc4e7('0x2'))(_0xc4e7('0x3'));var moment=require(_0xc4e7('0x4'));var BPromise=require('bluebird');var rp=require(_0xc4e7('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc4e7('0x6'));var config=require('../../config/environment');var attributes=require('./integrationReport.attributes');module[_0xc4e7('0x7')]=function(_0x4fd0a8,_0x4c595d){return _0x4fd0a8[_0xc4e7('0x8')](_0xc4e7('0x9'),attributes,{'tableName':_0xc4e7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2c3a=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','IntegrationReport','report_integration','lodash','util','../../config/logger','moment'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x2c3a,0x1ea));var _0xa2c3=function(_0x1538f4,_0x3759c2){_0x1538f4=_0x1538f4-0x0;var _0x12d288=_0x2c3a[_0x1538f4];return _0x12d288;};'use strict';var _=require(_0xa2c3('0x0'));var util=require(_0xa2c3('0x1'));var logger=require(_0xa2c3('0x2'))('api');var moment=require(_0xa2c3('0x3'));var BPromise=require(_0xa2c3('0x4'));var rp=require(_0xa2c3('0x5'));var fs=require('fs');var path=require(_0xa2c3('0x6'));var rimraf=require(_0xa2c3('0x7'));var config=require(_0xa2c3('0x8'));var attributes=require('./integrationReport.attributes');module[_0xa2c3('0x9')]=function(_0x573374,_0x437acc){return _0x573374[_0xa2c3('0xa')](_0xa2c3('0xb'),attributes,{'tableName':_0xa2c3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.rpc.js b/server/api/integrationReport/integrationReport.rpc.js index 818d494..ae81b40 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 _0x0713=['IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x25ee8d,_0x437416){var _0x2b6757=function(_0xc607b){while(--_0xc607b){_0x25ee8d['push'](_0x25ee8d['shift']());}};_0x2b6757(++_0x437416);}(_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')]('IntegrationReport,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec['error'][_0x3071('0x15')]);return _0x3e9a5e(_0x4a36ec['error'][_0x3071('0x15')]);}logger[_0x3071('0x13')]('IntegrationReport,\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')]('IntegrationReport,\x20%s,\x20%s',_0x2f1e87,_0x21aad3);_0x3e9a5e(_0x21aad3);});});} \ No newline at end of file +var _0x757a=['request','then','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x4b85cc,_0x53094a){var _0x2bc235=function(_0x22b04f){while(--_0x22b04f){_0x4b85cc['push'](_0x4b85cc['shift']());}};_0x2bc235(++_0x53094a);}(_0x757a,0xde));var _0xa757=function(_0x256f50,_0xa1af1d){_0x256f50=_0x256f50-0x0;var _0x490142=_0x757a[_0x256f50];return _0x490142;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var moment=require(_0xa757('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa757('0x2'))['db'];var utils=require(_0xa757('0x3'));var logger=require(_0xa757('0x4'))(_0xa757('0x5'));var config=require(_0xa757('0x6'));var jayson=require(_0xa757('0x7'));var client=jayson['client'][_0xa757('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4343b6,_0x53be0e,_0x2930fa){return new BPromise(function(_0x2f7793,_0x447344){return client[_0xa757('0x9')](_0x4343b6,_0x2930fa)[_0xa757('0xa')](function(_0x5aef8a){logger[_0xa757('0xb')](_0xa757('0xc'),_0x53be0e,_0xa757('0xd'));logger[_0xa757('0xe')](_0xa757('0xf'),_0x53be0e,_0xa757('0xd'),JSON[_0xa757('0x10')](_0x5aef8a));if(_0x5aef8a['error']){if(_0x5aef8a['error']['code']===0x1f4){logger['error']('IntegrationReport,\x20%s,\x20%s',_0x53be0e,_0x5aef8a[_0xa757('0x11')]['message']);return _0x447344(_0x5aef8a['error'][_0xa757('0x12')]);}logger['error']('IntegrationReport,\x20%s,\x20%s',_0x53be0e,_0x5aef8a[_0xa757('0x11')][_0xa757('0x12')]);return _0x2f7793(_0x5aef8a[_0xa757('0x11')][_0xa757('0x12')]);}else{logger[_0xa757('0xb')](_0xa757('0xc'),_0x53be0e,_0xa757('0xd'));_0x2f7793(_0x5aef8a[_0xa757('0x13')][_0xa757('0x12')]);}})[_0xa757('0x14')](function(_0x50aac1){logger[_0xa757('0x11')](_0xa757('0xc'),_0x53be0e,_0x50aac1);_0x447344(_0x50aac1);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 4d370b5..3f85ca9 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 _0x9957=['../../config/environment','get','isAuthenticated','index','/:id','/:id/sub_intervals','getIntervals','post','create','/:id/sub_intervals/create_many','addIntervals','put','update','delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x2aec52,_0x59d962){var _0x3b8835=function(_0x3e2604){while(--_0x3e2604){_0x2aec52['push'](_0x2aec52['shift']());}};_0x3b8835(++_0x59d962);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'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('./interval.controller');router[_0x7995('0x8')]('/',auth[_0x7995('0x9')](),controller[_0x7995('0xa')]);router[_0x7995('0x8')](_0x7995('0xb'),auth[_0x7995('0x9')](),controller['show']);router[_0x7995('0x8')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0xe')]('/',auth[_0x7995('0x9')](),controller[_0x7995('0xf')]);router[_0x7995('0xe')](_0x7995('0xc'),auth[_0x7995('0x9')](),controller['addInterval']);router[_0x7995('0xe')](_0x7995('0x10'),auth['isAuthenticated'](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xb'),auth[_0x7995('0x9')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x7995('0x15')]=router; \ No newline at end of file +var _0x34e8=['./interval.controller','get','isAuthenticated','show','/:id/sub_intervals','getIntervals','post','create','addInterval','/:id/sub_intervals/create_many','addIntervals','/:id','delete','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x520c14,_0x1b0965){var _0x4cbc33=function(_0x342c9b){while(--_0x342c9b){_0x520c14['push'](_0x520c14['shift']());}};_0x4cbc33(++_0x1b0965);}(_0x34e8,0x12c));var _0x834e=function(_0x3199ff,_0x465ece){_0x3199ff=_0x3199ff-0x0;var _0x218afa=_0x34e8[_0x3199ff];return _0x218afa;};'use strict';var multer=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var path=require(_0x834e('0x2'));var timeout=require(_0x834e('0x3'));var express=require('express');var router=express[_0x834e('0x4')]();var auth=require(_0x834e('0x5'));var interaction=require(_0x834e('0x6'));var config=require(_0x834e('0x7'));var controller=require(_0x834e('0x8'));router[_0x834e('0x9')]('/',auth[_0x834e('0xa')](),controller['index']);router[_0x834e('0x9')]('/:id',auth[_0x834e('0xa')](),controller[_0x834e('0xb')]);router[_0x834e('0x9')](_0x834e('0xc'),auth[_0x834e('0xa')](),controller[_0x834e('0xd')]);router[_0x834e('0xe')]('/',auth[_0x834e('0xa')](),controller[_0x834e('0xf')]);router[_0x834e('0xe')](_0x834e('0xc'),auth[_0x834e('0xa')](),controller[_0x834e('0x10')]);router[_0x834e('0xe')](_0x834e('0x11'),auth[_0x834e('0xa')](),controller[_0x834e('0x12')]);router['put'](_0x834e('0x13'),auth[_0x834e('0xa')](),controller['update']);router[_0x834e('0x14')](_0x834e('0x13'),auth[_0x834e('0xa')](),controller[_0x834e('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index 94f6f60..0c72692 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 _0xeabb=['STRING','sequelize'];(function(_0xfa634c,_0x414e0e){var _0x73e478=function(_0xac2a51){while(--_0xac2a51){_0xfa634c['push'](_0xfa634c['shift']());}};_0x73e478(++_0x414e0e);}(_0xeabb,0x103));var _0xbeab=function(_0x17516a,_0x2824c1){_0x17516a=_0x17516a-0x0;var _0x22e61f=_0xeabb[_0x17516a];return _0x22e61f;};'use strict';var Sequelize=require(_0xbeab('0x0'));module['exports']={'name':{'type':Sequelize[_0xbeab('0x1')]},'description':{'type':Sequelize[_0xbeab('0x1')]},'interval':{'type':Sequelize[_0xbeab('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0x00dc=['STRING','sequelize','exports'];(function(_0x4ce39b,_0x30dca9){var _0x25957c=function(_0x398953){while(--_0x398953){_0x4ce39b['push'](_0x4ce39b['shift']());}};_0x25957c(++_0x30dca9);}(_0x00dc,0x115));var _0xc00d=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x00dc[_0x3947c9];return _0x2e7871;};'use strict';var Sequelize=require(_0xc00d('0x0'));module[_0xc00d('0x1')]={'name':{'type':Sequelize[_0xc00d('0x2')]},'description':{'type':Sequelize[_0xc00d('0x2')]},'interval':{'type':Sequelize[_0xc00d('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 a679eea..7874059 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 _0xf37f=['sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','get','Intervals','destroy','error','stack','name','send','index','map','type','key','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','filters','filter','merge','options','includeAll','include','Interval','rows','catch','show','params','keys','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addInterval','IntervalId','getIntervals','length','pick','addIntervals','transaction','bulkCreate','findAll','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','../../components/extensions/rewrite'];(function(_0x5e7ddf,_0x3baba1){var _0x275d12=function(_0x515b65){while(--_0x515b65){_0x5e7ddf['push'](_0x5e7ddf['shift']());}};_0x275d12(++_0x3baba1);}(_0xf37f,0x15a));var _0xff37=function(_0x2e0979,_0x1d6067){_0x2e0979=_0x2e0979-0x0;var _0x486780=_0xf37f[_0x2e0979];return _0x486780;};'use strict';var pdf=require(_0xff37('0x0'));var emlformat=require(_0xff37('0x1'));var rimraf=require(_0xff37('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xff37('0x3'));var rp=require(_0xff37('0x4'));var moment=require(_0xff37('0x5'));var BPromise=require(_0xff37('0x6'));var Mustache=require(_0xff37('0x7'));var util=require(_0xff37('0x8'));var path=require(_0xff37('0x9'));var sox=require(_0xff37('0xa'));var csv=require(_0xff37('0xb'));var ejs=require(_0xff37('0xc'));var fs=require('fs');var _=require(_0xff37('0xd'));var squel=require('squel');var crypto=require(_0xff37('0xe'));var jsforce=require(_0xff37('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xff37('0xb'));var querystring=require(_0xff37('0x10'));var Papa=require('papaparse');var Redis=require(_0xff37('0x11'));var authService=require(_0xff37('0x12'));var qs=require(_0xff37('0x13'));var as=require(_0xff37('0x14'));var hardwareService=require(_0xff37('0x15'));var logger=require('../../config/logger')(_0xff37('0x16'));var utils=require(_0xff37('0x17'));var config=require('../../config/environment');var db=require(_0xff37('0x18'))['db'];var extensions=require(_0xff37('0x19'));function respondWithStatusCode(_0x30f56e,_0x147cea){_0x147cea=_0x147cea||0xcc;return function(_0x49bfee){if(_0x49bfee){return _0x30f56e[_0xff37('0x1a')](_0x147cea);}return _0x30f56e[_0xff37('0x1b')](_0x147cea)[_0xff37('0x1c')]();};}function respondWithResult(_0x6e84f0,_0xa27f04){_0xa27f04=_0xa27f04||0xc8;return function(_0x1fbb3d){if(_0x1fbb3d){return _0x6e84f0['status'](_0xa27f04)[_0xff37('0x1d')](_0x1fbb3d);}};}function respondWithFilteredResult(_0x865f8d,_0x533c6f){return function(_0x1c1c30){if(_0x1c1c30){var _0x532193=_0x1c1c30[_0xff37('0x1e')],_0x1a6443=_0x533c6f[_0xff37('0x1f')],_0x89742=_0x533c6f['offset']+_0x533c6f['limit'],_0x330f9c;if(_0x89742>=_0x532193){_0x89742=_0x532193;_0x330f9c=0xc8;}else{_0x330f9c=0xce;}_0x865f8d[_0xff37('0x1b')](_0x330f9c);return _0x865f8d[_0xff37('0x20')](_0xff37('0x21'),_0x1a6443+'-'+_0x89742+'/'+_0x532193)['json'](_0x1c1c30);}return null;};}function patchUpdates(_0x5c8e75){return function(_0x338b26){try{jsonpatch[_0xff37('0x22')](_0x338b26,_0x5c8e75,!![]);}catch(_0x412439){return BPromise[_0xff37('0x23')](_0x412439);}return _0x338b26[_0xff37('0x24')]();};}function saveUpdates(_0x2be538,_0x151ea4){return function(_0x120788){if(_0x120788){return _0x120788[_0xff37('0x25')](_0x2be538)[_0xff37('0x26')](function(_0x4bc972){return _0x4bc972;});}return null;};}function removeEntity(_0x54f24e,_0x470e9a){return function(_0x2f47f1){if(_0x2f47f1){return _0x2f47f1['destroy']()[_0xff37('0x26')](function(){var _0xe82050=_0x2f47f1[_0xff37('0x27')]({'plain':!![]});var _0x578b1c=_0xff37('0x28');return db['UserProfileResource'][_0xff37('0x29')]({'where':{'type':_0x578b1c,'resourceId':_0xe82050['id']}})[_0xff37('0x26')](function(){return _0x2f47f1;});})[_0xff37('0x26')](function(){_0x54f24e['status'](0xcc)[_0xff37('0x1c')]();});}};}function handleEntityNotFound(_0x5e6de2,_0xe59c11){return function(_0x5e05d6){if(!_0x5e05d6){_0x5e6de2[_0xff37('0x1a')](0x194);}return _0x5e05d6;};}function handleError(_0x59d995,_0x12a554){_0x12a554=_0x12a554||0x1f4;return function(_0x20e609){logger[_0xff37('0x2a')](_0x20e609[_0xff37('0x2b')]);if(_0x20e609[_0xff37('0x2c')]){delete _0x20e609[_0xff37('0x2c')];}_0x59d995[_0xff37('0x1b')](_0x12a554)[_0xff37('0x2d')](_0x20e609);};}exports[_0xff37('0x2e')]=function(_0x3c40b4,_0x12f317){var _0x2bda2e={},_0x4428c2={},_0x9efab6={'count':0x0,'rows':[]};var _0x14f4d5=_[_0xff37('0x2f')](db['Interval']['rawAttributes'],function(_0x289f1c){return{'name':_0x289f1c['fieldName'],'type':_0x289f1c[_0xff37('0x30')][_0xff37('0x31')]};});_0x4428c2[_0xff37('0x32')]=_[_0xff37('0x2f')](_0x14f4d5,'name');_0x4428c2['query']=_['keys'](_0x3c40b4[_0xff37('0x33')]);_0x4428c2['filters']=_[_0xff37('0x34')](_0x4428c2[_0xff37('0x32')],_0x4428c2[_0xff37('0x33')]);_0x2bda2e[_0xff37('0x35')]=_[_0xff37('0x34')](_0x4428c2[_0xff37('0x32')],qs[_0xff37('0x36')](_0x3c40b4[_0xff37('0x33')]['fields']));_0x2bda2e[_0xff37('0x35')]=_0x2bda2e[_0xff37('0x35')]['length']?_0x2bda2e['attributes']:_0x4428c2['model'];if(!_0x3c40b4[_0xff37('0x33')][_0xff37('0x37')](_0xff37('0x38'))){_0x2bda2e[_0xff37('0x39')]=qs[_0xff37('0x39')](_0x3c40b4['query']['limit']);_0x2bda2e[_0xff37('0x1f')]=qs['offset'](_0x3c40b4[_0xff37('0x33')][_0xff37('0x1f')]);}_0x2bda2e[_0xff37('0x3a')]=qs[_0xff37('0x3b')](_0x3c40b4['query']['sort']);_0x2bda2e[_0xff37('0x3c')]=qs[_0xff37('0x3d')](_['pick'](_0x3c40b4[_0xff37('0x33')],_0x4428c2[_0xff37('0x3d')]),_0x14f4d5);if(_0x3c40b4[_0xff37('0x33')][_0xff37('0x3e')]){_0x2bda2e['where']=_['merge'](_0x2bda2e[_0xff37('0x3c')],{'$or':_['map'](_0x14f4d5,function(_0x27f7d6){if(_0x27f7d6[_0xff37('0x30')]!=='VIRTUAL'){var _0x4b1982={};_0x4b1982[_0x27f7d6[_0xff37('0x2c')]]={'$like':'%'+_0x3c40b4[_0xff37('0x33')]['filter']+'%'};return _0x4b1982;}})});}_0x2bda2e=_[_0xff37('0x3f')]({},_0x2bda2e,_0x3c40b4[_0xff37('0x40')]);var _0x245994={'where':_0x2bda2e['where']};return db['Interval'][_0xff37('0x1e')](_0x245994)[_0xff37('0x26')](function(_0x4db806){_0x9efab6[_0xff37('0x1e')]=_0x4db806;if(_0x3c40b4[_0xff37('0x33')][_0xff37('0x41')]){_0x2bda2e[_0xff37('0x42')]=[{'all':!![]}];}return db[_0xff37('0x43')]['findAll'](_0x2bda2e);})[_0xff37('0x26')](function(_0x24b81a){_0x9efab6[_0xff37('0x44')]=_0x24b81a;return _0x9efab6;})[_0xff37('0x26')](respondWithFilteredResult(_0x12f317,_0x2bda2e))[_0xff37('0x45')](handleError(_0x12f317,null));};exports[_0xff37('0x46')]=function(_0x44992b,_0x5d4835){var _0x1722dd={'raw':!![],'where':{'id':_0x44992b[_0xff37('0x47')]['id']}},_0x3e1f4b={};_0x3e1f4b[_0xff37('0x32')]=_[_0xff37('0x48')](db[_0xff37('0x43')][_0xff37('0x49')]);_0x3e1f4b[_0xff37('0x33')]=_['keys'](_0x44992b['query']);_0x3e1f4b[_0xff37('0x3d')]=_[_0xff37('0x34')](_0x3e1f4b['model'],_0x3e1f4b['query']);_0x1722dd['attributes']=_[_0xff37('0x34')](_0x3e1f4b['model'],qs[_0xff37('0x36')](_0x44992b['query'][_0xff37('0x36')]));_0x1722dd[_0xff37('0x35')]=_0x1722dd['attributes']['length']?_0x1722dd[_0xff37('0x35')]:_0x3e1f4b['model'];if(_0x44992b[_0xff37('0x33')][_0xff37('0x41')]){_0x1722dd[_0xff37('0x42')]=[{'all':!![]}];}_0x1722dd=_[_0xff37('0x3f')]({},_0x1722dd,_0x44992b['options']);return db['Interval'][_0xff37('0x4a')](_0x1722dd)['then'](handleEntityNotFound(_0x5d4835,null))[_0xff37('0x26')](respondWithResult(_0x5d4835,null))[_0xff37('0x45')](handleError(_0x5d4835,null));};exports[_0xff37('0x4b')]=function(_0x4400db,_0x386ec4){return db[_0xff37('0x43')][_0xff37('0x4b')](_0x4400db[_0xff37('0x4c')],{})[_0xff37('0x26')](function(_0x2cab19){var _0x1ea937=_0x4400db[_0xff37('0x4d')][_0xff37('0x27')]({'plain':!![]});if(!_0x1ea937)throw new Error(_0xff37('0x4e'));if(_0x1ea937[_0xff37('0x4f')]===_0xff37('0x4d')){var _0x56a314=_0x2cab19['get']({'plain':!![]});var _0xa4ef23='Intervals';return db[_0xff37('0x50')]['find']({'where':{'name':_0xa4ef23,'userProfileId':_0x1ea937['userProfileId']},'raw':!![]})[_0xff37('0x26')](function(_0x1dce0c){if(_0x1dce0c&&_0x1dce0c[_0xff37('0x51')]===0x0){return db[_0xff37('0x52')][_0xff37('0x4b')]({'name':_0x56a314[_0xff37('0x2c')],'resourceId':_0x56a314['id'],'type':_0x1dce0c['name'],'sectionId':_0x1dce0c['id']},{})[_0xff37('0x26')](function(){return _0x2cab19;});}else{return _0x2cab19;}})[_0xff37('0x45')](function(_0x16673b){logger[_0xff37('0x2a')](_0xff37('0x53'),_0x16673b);throw _0x16673b;});}return _0x2cab19;})[_0xff37('0x26')](respondWithResult(_0x386ec4,0xc9))[_0xff37('0x45')](handleError(_0x386ec4,null));};exports[_0xff37('0x25')]=function(_0x4e82a2,_0x2a1d09){if(_0x4e82a2[_0xff37('0x4c')]['id']){delete _0x4e82a2[_0xff37('0x4c')]['id'];}return db['Interval']['find']({'where':{'id':_0x4e82a2[_0xff37('0x47')]['id']}})[_0xff37('0x26')](handleEntityNotFound(_0x2a1d09,null))[_0xff37('0x26')](saveUpdates(_0x4e82a2[_0xff37('0x4c')],null))[_0xff37('0x26')](respondWithResult(_0x2a1d09,null))[_0xff37('0x45')](handleError(_0x2a1d09,null));};exports[_0xff37('0x29')]=function(_0x2aac1b,_0x14d736){return db[_0xff37('0x43')]['find']({'where':{'id':_0x2aac1b[_0xff37('0x47')]['id']}})[_0xff37('0x26')](handleEntityNotFound(_0x14d736,null))[_0xff37('0x26')](removeEntity(_0x14d736,null))[_0xff37('0x45')](handleError(_0x14d736,null));};exports[_0xff37('0x54')]=function(_0x3b5c51,_0x584a01,_0xf36c7f){if(_0x3b5c51[_0xff37('0x4c')]['id']){delete _0x3b5c51[_0xff37('0x4c')]['id'];}return db[_0xff37('0x43')][_0xff37('0x4a')]({'where':{'id':_0x3b5c51[_0xff37('0x47')]['id']}})[_0xff37('0x26')](handleEntityNotFound(_0x584a01,null))[_0xff37('0x26')](function(_0x564556){if(_0x564556){_0x3b5c51[_0xff37('0x4c')][_0xff37('0x55')]=_0x564556['id'];return db[_0xff37('0x43')][_0xff37('0x4b')](_0x3b5c51['body']);}})[_0xff37('0x26')](respondWithResult(_0x584a01,null))['catch'](handleError(_0x584a01,null));};exports[_0xff37('0x56')]=function(_0x308aa2,_0x4ab30e,_0x532a17){var _0x4784a1={};var _0x1852e7={};var _0x321601;var _0x5a92d9;return db[_0xff37('0x43')]['findOne']({'where':{'id':_0x308aa2[_0xff37('0x47')]['id']}})['then'](handleEntityNotFound(_0x4ab30e,null))[_0xff37('0x26')](function(_0x3d8efe){if(_0x3d8efe){_0x321601=_0x3d8efe;_0x1852e7[_0xff37('0x32')]=_[_0xff37('0x48')](db[_0xff37('0x43')][_0xff37('0x49')]);_0x1852e7[_0xff37('0x33')]=_[_0xff37('0x48')](_0x308aa2['query']);_0x1852e7[_0xff37('0x3d')]=_[_0xff37('0x34')](_0x1852e7[_0xff37('0x32')],_0x1852e7[_0xff37('0x33')]);_0x4784a1[_0xff37('0x35')]=_[_0xff37('0x34')](_0x1852e7[_0xff37('0x32')],qs['fields'](_0x308aa2['query']['fields']));_0x4784a1[_0xff37('0x35')]=_0x4784a1[_0xff37('0x35')][_0xff37('0x57')]?_0x4784a1['attributes']:_0x1852e7['model'];_0x4784a1[_0xff37('0x3a')]=qs[_0xff37('0x3b')](_0x308aa2['query'][_0xff37('0x3b')]);_0x4784a1[_0xff37('0x3c')]=qs[_0xff37('0x3d')](_[_0xff37('0x58')](_0x308aa2[_0xff37('0x33')],_0x1852e7[_0xff37('0x3d')]));if(_0x308aa2[_0xff37('0x33')][_0xff37('0x3e')]){_0x4784a1['where']=_[_0xff37('0x3f')](_0x4784a1[_0xff37('0x3c')],{'$or':_[_0xff37('0x2f')](_0x4784a1['attributes'],function(_0xd77598){var _0x5ca440={};_0x5ca440[_0xd77598]={'$like':'%'+_0x308aa2[_0xff37('0x33')]['filter']+'%'};return _0x5ca440;})});}_0x4784a1=_[_0xff37('0x3f')]({},_0x4784a1,_0x308aa2[_0xff37('0x40')]);return _0x321601[_0xff37('0x56')](_0x4784a1);}})[_0xff37('0x26')](function(_0x3cc162){if(_0x3cc162){_0x5a92d9=_0x3cc162[_0xff37('0x57')];if(!_0x308aa2['query'][_0xff37('0x37')](_0xff37('0x38'))){_0x4784a1['limit']=qs[_0xff37('0x39')](_0x308aa2[_0xff37('0x33')][_0xff37('0x39')]);_0x4784a1[_0xff37('0x1f')]=qs[_0xff37('0x1f')](_0x308aa2[_0xff37('0x33')][_0xff37('0x1f')]);}return _0x321601[_0xff37('0x56')](_0x4784a1);}})[_0xff37('0x26')](function(_0x2e8a6e){if(_0x2e8a6e){return _0x2e8a6e?{'count':_0x5a92d9,'rows':_0x2e8a6e}:null;}})[_0xff37('0x26')](respondWithResult(_0x4ab30e,null))[_0xff37('0x45')](handleError(_0x4ab30e,null));};exports[_0xff37('0x59')]=function(_0x1f8030,_0x1331dc,_0x19fea0){return db[_0xff37('0x43')]['findOne']({'where':{'id':_0x1f8030[_0xff37('0x47')]['id']}})['then'](handleEntityNotFound(_0x1331dc,null))[_0xff37('0x26')](function(_0x15cb31){if(_0x15cb31){return db['sequelize'][_0xff37('0x5a')](function(_0x3f17d7){return db[_0xff37('0x43')][_0xff37('0x29')]({'where':{'IntervalId':_0x1f8030[_0xff37('0x47')]['id']},'transaction':_0x3f17d7})[_0xff37('0x26')](function(_0x28e23e){var _0x45fca9=_[_0xff37('0x2f')](_0x1f8030[_0xff37('0x4c')],function(_0x4c4ffe){delete _0x4c4ffe['id'];_0x4c4ffe[_0xff37('0x55')]=_0x1f8030[_0xff37('0x47')]['id'];return _0x4c4ffe;});return db[_0xff37('0x43')][_0xff37('0x5b')](_0x45fca9,{'transaction':_0x3f17d7});});})[_0xff37('0x26')](function(){return db[_0xff37('0x43')][_0xff37('0x5c')]({'where':{'IntervalId':_0x1f8030[_0xff37('0x47')]['id']}});});}})['then'](respondWithResult(_0x1331dc,null))[_0xff37('0x45')](handleError(_0x1331dc,null));}; \ No newline at end of file +var _0xa7f2=['bulkCreate','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','end','json','offset','limit','set','then','destroy','get','UserProfileResource','error','stack','name','send','map','Interval','rawAttributes','type','key','keys','query','model','fields','attributes','length','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','params','intersection','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','addInterval','IntervalId','getIntervals','hasOwnProperty','addIntervals','findOne','sequelize','transaction'];(function(_0x4c1eec,_0x515aa1){var _0x5d8475=function(_0xd50a8e){while(--_0xd50a8e){_0x4c1eec['push'](_0x4c1eec['shift']());}};_0x5d8475(++_0x515aa1);}(_0xa7f2,0xfd));var _0x2a7f=function(_0x31b90f,_0x35ef73){_0x31b90f=_0x31b90f-0x0;var _0x15653b=_0xa7f2[_0x31b90f];return _0x15653b;};'use strict';var pdf=require(_0x2a7f('0x0'));var emlformat=require(_0x2a7f('0x1'));var rimraf=require(_0x2a7f('0x2'));var zipdir=require(_0x2a7f('0x3'));var jsonpatch=require(_0x2a7f('0x4'));var rp=require(_0x2a7f('0x5'));var moment=require(_0x2a7f('0x6'));var BPromise=require(_0x2a7f('0x7'));var Mustache=require(_0x2a7f('0x8'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x2a7f('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x2a7f('0xa'));var crypto=require(_0x2a7f('0xb'));var jsforce=require(_0x2a7f('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x2a7f('0x9'));var querystring=require('querystring');var Papa=require(_0x2a7f('0xd'));var Redis=require('ioredis');var authService=require(_0x2a7f('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x2a7f('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2a7f('0x10'))(_0x2a7f('0x11'));var utils=require(_0x2a7f('0x12'));var config=require('../../config/environment');var db=require(_0x2a7f('0x13'))['db'];var extensions=require(_0x2a7f('0x14'));function respondWithStatusCode(_0x13339d,_0x62e487){_0x62e487=_0x62e487||0xcc;return function(_0x53550b){if(_0x53550b){return _0x13339d[_0x2a7f('0x15')](_0x62e487);}return _0x13339d[_0x2a7f('0x16')](_0x62e487)[_0x2a7f('0x17')]();};}function respondWithResult(_0x483977,_0x2ce0e6){_0x2ce0e6=_0x2ce0e6||0xc8;return function(_0x3766a7){if(_0x3766a7){return _0x483977[_0x2a7f('0x16')](_0x2ce0e6)[_0x2a7f('0x18')](_0x3766a7);}};}function respondWithFilteredResult(_0x46524d,_0x1da32f){return function(_0x5ae725){if(_0x5ae725){var _0x194fc9=_0x5ae725['count'],_0x402800=_0x1da32f[_0x2a7f('0x19')],_0xcdbfdd=_0x1da32f[_0x2a7f('0x19')]+_0x1da32f[_0x2a7f('0x1a')],_0x645b85;if(_0xcdbfdd>=_0x194fc9){_0xcdbfdd=_0x194fc9;_0x645b85=0xc8;}else{_0x645b85=0xce;}_0x46524d[_0x2a7f('0x16')](_0x645b85);return _0x46524d[_0x2a7f('0x1b')]('Content-Range',_0x402800+'-'+_0xcdbfdd+'/'+_0x194fc9)['json'](_0x5ae725);}return null;};}function patchUpdates(_0x106ee9){return function(_0x2874ec){try{jsonpatch['apply'](_0x2874ec,_0x106ee9,!![]);}catch(_0x1bd1a0){return BPromise['reject'](_0x1bd1a0);}return _0x2874ec['save']();};}function saveUpdates(_0x2f47be,_0x1fa864){return function(_0x4955e1){if(_0x4955e1){return _0x4955e1['update'](_0x2f47be)[_0x2a7f('0x1c')](function(_0x5709cf){return _0x5709cf;});}return null;};}function removeEntity(_0x3487ca,_0x3cad4a){return function(_0x31e84a){if(_0x31e84a){return _0x31e84a[_0x2a7f('0x1d')]()[_0x2a7f('0x1c')](function(){var _0x334dd9=_0x31e84a[_0x2a7f('0x1e')]({'plain':!![]});var _0x594cd0='Intervals';return db[_0x2a7f('0x1f')]['destroy']({'where':{'type':_0x594cd0,'resourceId':_0x334dd9['id']}})[_0x2a7f('0x1c')](function(){return _0x31e84a;});})[_0x2a7f('0x1c')](function(){_0x3487ca['status'](0xcc)[_0x2a7f('0x17')]();});}};}function handleEntityNotFound(_0x2f5de0,_0x5ac908){return function(_0x22525c){if(!_0x22525c){_0x2f5de0[_0x2a7f('0x15')](0x194);}return _0x22525c;};}function handleError(_0x425e58,_0x5824fa){_0x5824fa=_0x5824fa||0x1f4;return function(_0x378807){logger[_0x2a7f('0x20')](_0x378807[_0x2a7f('0x21')]);if(_0x378807[_0x2a7f('0x22')]){delete _0x378807[_0x2a7f('0x22')];}_0x425e58[_0x2a7f('0x16')](_0x5824fa)[_0x2a7f('0x23')](_0x378807);};}exports['index']=function(_0x2a37a6,_0x4a8415){var _0x28fa58={},_0x1d324c={},_0x30a10d={'count':0x0,'rows':[]};var _0xf235d7=_[_0x2a7f('0x24')](db[_0x2a7f('0x25')][_0x2a7f('0x26')],function(_0xd2cdf){return{'name':_0xd2cdf['fieldName'],'type':_0xd2cdf[_0x2a7f('0x27')][_0x2a7f('0x28')]};});_0x1d324c['model']=_[_0x2a7f('0x24')](_0xf235d7,_0x2a7f('0x22'));_0x1d324c['query']=_[_0x2a7f('0x29')](_0x2a37a6[_0x2a7f('0x2a')]);_0x1d324c['filters']=_['intersection'](_0x1d324c[_0x2a7f('0x2b')],_0x1d324c[_0x2a7f('0x2a')]);_0x28fa58['attributes']=_['intersection'](_0x1d324c[_0x2a7f('0x2b')],qs[_0x2a7f('0x2c')](_0x2a37a6[_0x2a7f('0x2a')]['fields']));_0x28fa58[_0x2a7f('0x2d')]=_0x28fa58[_0x2a7f('0x2d')][_0x2a7f('0x2e')]?_0x28fa58[_0x2a7f('0x2d')]:_0x1d324c[_0x2a7f('0x2b')];if(!_0x2a37a6[_0x2a7f('0x2a')]['hasOwnProperty'](_0x2a7f('0x2f'))){_0x28fa58['limit']=qs[_0x2a7f('0x1a')](_0x2a37a6[_0x2a7f('0x2a')][_0x2a7f('0x1a')]);_0x28fa58[_0x2a7f('0x19')]=qs[_0x2a7f('0x19')](_0x2a37a6['query'][_0x2a7f('0x19')]);}_0x28fa58[_0x2a7f('0x30')]=qs[_0x2a7f('0x31')](_0x2a37a6[_0x2a7f('0x2a')][_0x2a7f('0x31')]);_0x28fa58['where']=qs[_0x2a7f('0x32')](_[_0x2a7f('0x33')](_0x2a37a6[_0x2a7f('0x2a')],_0x1d324c['filters']),_0xf235d7);if(_0x2a37a6[_0x2a7f('0x2a')][_0x2a7f('0x34')]){_0x28fa58[_0x2a7f('0x35')]=_[_0x2a7f('0x36')](_0x28fa58[_0x2a7f('0x35')],{'$or':_[_0x2a7f('0x24')](_0xf235d7,function(_0x50046a){if(_0x50046a['type']!==_0x2a7f('0x37')){var _0x346c44={};_0x346c44[_0x50046a['name']]={'$like':'%'+_0x2a37a6[_0x2a7f('0x2a')]['filter']+'%'};return _0x346c44;}})});}_0x28fa58=_['merge']({},_0x28fa58,_0x2a37a6[_0x2a7f('0x38')]);var _0x4f4f7d={'where':_0x28fa58[_0x2a7f('0x35')]};return db[_0x2a7f('0x25')][_0x2a7f('0x39')](_0x4f4f7d)[_0x2a7f('0x1c')](function(_0x55a427){_0x30a10d[_0x2a7f('0x39')]=_0x55a427;if(_0x2a37a6[_0x2a7f('0x2a')][_0x2a7f('0x3a')]){_0x28fa58[_0x2a7f('0x3b')]=[{'all':!![]}];}return db[_0x2a7f('0x25')][_0x2a7f('0x3c')](_0x28fa58);})[_0x2a7f('0x1c')](function(_0x30ffd7){_0x30a10d[_0x2a7f('0x3d')]=_0x30ffd7;return _0x30a10d;})[_0x2a7f('0x1c')](respondWithFilteredResult(_0x4a8415,_0x28fa58))[_0x2a7f('0x3e')](handleError(_0x4a8415,null));};exports['show']=function(_0x347fd1,_0x4cc52e){var _0x2ed518={'raw':!![],'where':{'id':_0x347fd1[_0x2a7f('0x3f')]['id']}},_0xed73c6={};_0xed73c6[_0x2a7f('0x2b')]=_[_0x2a7f('0x29')](db[_0x2a7f('0x25')][_0x2a7f('0x26')]);_0xed73c6[_0x2a7f('0x2a')]=_[_0x2a7f('0x29')](_0x347fd1[_0x2a7f('0x2a')]);_0xed73c6[_0x2a7f('0x32')]=_['intersection'](_0xed73c6[_0x2a7f('0x2b')],_0xed73c6['query']);_0x2ed518[_0x2a7f('0x2d')]=_[_0x2a7f('0x40')](_0xed73c6[_0x2a7f('0x2b')],qs['fields'](_0x347fd1[_0x2a7f('0x2a')]['fields']));_0x2ed518['attributes']=_0x2ed518[_0x2a7f('0x2d')][_0x2a7f('0x2e')]?_0x2ed518[_0x2a7f('0x2d')]:_0xed73c6['model'];if(_0x347fd1[_0x2a7f('0x2a')]['includeAll']){_0x2ed518['include']=[{'all':!![]}];}_0x2ed518=_[_0x2a7f('0x36')]({},_0x2ed518,_0x347fd1[_0x2a7f('0x38')]);return db[_0x2a7f('0x25')][_0x2a7f('0x41')](_0x2ed518)['then'](handleEntityNotFound(_0x4cc52e,null))['then'](respondWithResult(_0x4cc52e,null))[_0x2a7f('0x3e')](handleError(_0x4cc52e,null));};exports[_0x2a7f('0x42')]=function(_0x15da85,_0x5e0c89){return db['Interval'][_0x2a7f('0x42')](_0x15da85[_0x2a7f('0x43')],{})['then'](function(_0x31e081){var _0x81a3ad=_0x15da85[_0x2a7f('0x44')][_0x2a7f('0x1e')]({'plain':!![]});if(!_0x81a3ad)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x81a3ad[_0x2a7f('0x45')]===_0x2a7f('0x44')){var _0x153801=_0x31e081['get']({'plain':!![]});var _0x1b39fa='Intervals';return db[_0x2a7f('0x46')]['find']({'where':{'name':_0x1b39fa,'userProfileId':_0x81a3ad[_0x2a7f('0x47')]},'raw':!![]})[_0x2a7f('0x1c')](function(_0x166621){if(_0x166621&&_0x166621[_0x2a7f('0x48')]===0x0){return db[_0x2a7f('0x1f')][_0x2a7f('0x42')]({'name':_0x153801[_0x2a7f('0x22')],'resourceId':_0x153801['id'],'type':_0x166621[_0x2a7f('0x22')],'sectionId':_0x166621['id']},{})[_0x2a7f('0x1c')](function(){return _0x31e081;});}else{return _0x31e081;}})[_0x2a7f('0x3e')](function(_0x1c1afc){logger[_0x2a7f('0x20')](_0x2a7f('0x49'),_0x1c1afc);throw _0x1c1afc;});}return _0x31e081;})[_0x2a7f('0x1c')](respondWithResult(_0x5e0c89,0xc9))['catch'](handleError(_0x5e0c89,null));};exports[_0x2a7f('0x4a')]=function(_0x35b4e9,_0x1f3400){if(_0x35b4e9[_0x2a7f('0x43')]['id']){delete _0x35b4e9[_0x2a7f('0x43')]['id'];}return db['Interval'][_0x2a7f('0x41')]({'where':{'id':_0x35b4e9[_0x2a7f('0x3f')]['id']}})['then'](handleEntityNotFound(_0x1f3400,null))[_0x2a7f('0x1c')](saveUpdates(_0x35b4e9[_0x2a7f('0x43')],null))['then'](respondWithResult(_0x1f3400,null))[_0x2a7f('0x3e')](handleError(_0x1f3400,null));};exports[_0x2a7f('0x1d')]=function(_0xdfae89,_0x222b92){return db[_0x2a7f('0x25')][_0x2a7f('0x41')]({'where':{'id':_0xdfae89[_0x2a7f('0x3f')]['id']}})['then'](handleEntityNotFound(_0x222b92,null))[_0x2a7f('0x1c')](removeEntity(_0x222b92,null))[_0x2a7f('0x3e')](handleError(_0x222b92,null));};exports[_0x2a7f('0x4b')]=function(_0x2c44d6,_0x5c6446,_0x40f4fe){if(_0x2c44d6[_0x2a7f('0x43')]['id']){delete _0x2c44d6[_0x2a7f('0x43')]['id'];}return db[_0x2a7f('0x25')]['find']({'where':{'id':_0x2c44d6['params']['id']}})[_0x2a7f('0x1c')](handleEntityNotFound(_0x5c6446,null))['then'](function(_0x47d233){if(_0x47d233){_0x2c44d6[_0x2a7f('0x43')][_0x2a7f('0x4c')]=_0x47d233['id'];return db[_0x2a7f('0x25')][_0x2a7f('0x42')](_0x2c44d6[_0x2a7f('0x43')]);}})[_0x2a7f('0x1c')](respondWithResult(_0x5c6446,null))[_0x2a7f('0x3e')](handleError(_0x5c6446,null));};exports[_0x2a7f('0x4d')]=function(_0x5a8a8f,_0x21cc44,_0x317aff){var _0x30bd42={};var _0x5e75cc={};var _0x13691c;var _0x4ca99f;return db[_0x2a7f('0x25')]['findOne']({'where':{'id':_0x5a8a8f[_0x2a7f('0x3f')]['id']}})['then'](handleEntityNotFound(_0x21cc44,null))[_0x2a7f('0x1c')](function(_0x5186e8){if(_0x5186e8){_0x13691c=_0x5186e8;_0x5e75cc[_0x2a7f('0x2b')]=_['keys'](db[_0x2a7f('0x25')][_0x2a7f('0x26')]);_0x5e75cc[_0x2a7f('0x2a')]=_[_0x2a7f('0x29')](_0x5a8a8f[_0x2a7f('0x2a')]);_0x5e75cc[_0x2a7f('0x32')]=_[_0x2a7f('0x40')](_0x5e75cc['model'],_0x5e75cc['query']);_0x30bd42[_0x2a7f('0x2d')]=_['intersection'](_0x5e75cc[_0x2a7f('0x2b')],qs[_0x2a7f('0x2c')](_0x5a8a8f[_0x2a7f('0x2a')][_0x2a7f('0x2c')]));_0x30bd42[_0x2a7f('0x2d')]=_0x30bd42['attributes'][_0x2a7f('0x2e')]?_0x30bd42[_0x2a7f('0x2d')]:_0x5e75cc['model'];_0x30bd42['order']=qs['sort'](_0x5a8a8f[_0x2a7f('0x2a')][_0x2a7f('0x31')]);_0x30bd42[_0x2a7f('0x35')]=qs[_0x2a7f('0x32')](_[_0x2a7f('0x33')](_0x5a8a8f['query'],_0x5e75cc[_0x2a7f('0x32')]));if(_0x5a8a8f[_0x2a7f('0x2a')][_0x2a7f('0x34')]){_0x30bd42[_0x2a7f('0x35')]=_[_0x2a7f('0x36')](_0x30bd42[_0x2a7f('0x35')],{'$or':_[_0x2a7f('0x24')](_0x30bd42[_0x2a7f('0x2d')],function(_0x5c08ad){var _0x3e4ee9={};_0x3e4ee9[_0x5c08ad]={'$like':'%'+_0x5a8a8f[_0x2a7f('0x2a')]['filter']+'%'};return _0x3e4ee9;})});}_0x30bd42=_[_0x2a7f('0x36')]({},_0x30bd42,_0x5a8a8f['options']);return _0x13691c['getIntervals'](_0x30bd42);}})[_0x2a7f('0x1c')](function(_0x7961a0){if(_0x7961a0){_0x4ca99f=_0x7961a0['length'];if(!_0x5a8a8f['query'][_0x2a7f('0x4e')]('nolimit')){_0x30bd42['limit']=qs[_0x2a7f('0x1a')](_0x5a8a8f['query']['limit']);_0x30bd42[_0x2a7f('0x19')]=qs['offset'](_0x5a8a8f[_0x2a7f('0x2a')][_0x2a7f('0x19')]);}return _0x13691c[_0x2a7f('0x4d')](_0x30bd42);}})['then'](function(_0x34d799){if(_0x34d799){return _0x34d799?{'count':_0x4ca99f,'rows':_0x34d799}:null;}})[_0x2a7f('0x1c')](respondWithResult(_0x21cc44,null))['catch'](handleError(_0x21cc44,null));};exports[_0x2a7f('0x4f')]=function(_0xc5a545,_0x54a614,_0x4bb610){return db[_0x2a7f('0x25')][_0x2a7f('0x50')]({'where':{'id':_0xc5a545[_0x2a7f('0x3f')]['id']}})[_0x2a7f('0x1c')](handleEntityNotFound(_0x54a614,null))['then'](function(_0x4666b3){if(_0x4666b3){return db[_0x2a7f('0x51')][_0x2a7f('0x52')](function(_0x3963a3){return db[_0x2a7f('0x25')][_0x2a7f('0x1d')]({'where':{'IntervalId':_0xc5a545[_0x2a7f('0x3f')]['id']},'transaction':_0x3963a3})[_0x2a7f('0x1c')](function(_0x783b58){var _0x1ebca8=_['map'](_0xc5a545[_0x2a7f('0x43')],function(_0x3e3d36){delete _0x3e3d36['id'];_0x3e3d36[_0x2a7f('0x4c')]=_0xc5a545[_0x2a7f('0x3f')]['id'];return _0x3e3d36;});return db['Interval'][_0x2a7f('0x53')](_0x1ebca8,{'transaction':_0x3963a3});});})['then'](function(){return db[_0x2a7f('0x25')]['findAll']({'where':{'IntervalId':_0xc5a545[_0x2a7f('0x3f')]['id']}});});}})[_0x2a7f('0x1c')](respondWithResult(_0x54a614,null))[_0x2a7f('0x3e')](handleError(_0x54a614,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index de35908..29afa3e 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 _0x29c1=['bluebird','request-promise','path','rimraf','../../config/environment','./interval.attributes','../../components/extensions/rewrite','define','Interval','rewrite','util','../../config/logger','api'];(function(_0x4b4656,_0x59e985){var _0x2f0ac1=function(_0x104d9c){while(--_0x104d9c){_0x4b4656['push'](_0x4b4656['shift']());}};_0x2f0ac1(++_0x59e985);}(_0x29c1,0x72));var _0x129c=function(_0x5e8f9d,_0x578251){_0x5e8f9d=_0x5e8f9d-0x0;var _0x594f53=_0x29c1[_0x5e8f9d];return _0x594f53;};'use strict';var _=require('lodash');var util=require(_0x129c('0x0'));var logger=require(_0x129c('0x1'))(_0x129c('0x2'));var moment=require('moment');var BPromise=require(_0x129c('0x3'));var rp=require(_0x129c('0x4'));var fs=require('fs');var path=require(_0x129c('0x5'));var rimraf=require(_0x129c('0x6'));var config=require(_0x129c('0x7'));var attributes=require(_0x129c('0x8'));var extensions=require(_0x129c('0x9'));module['exports']=function(_0x3e241f,_0x1e146e){return _0x3e241f[_0x129c('0xa')](_0x129c('0xb'),attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x303ad7,_0x1e8f06){extensions[_0x129c('0xc')](_0x3e241f,_0x303ad7);},'afterBulkCreate':function(_0x59d810,_0x141347,_0x47ee8d){_0x47ee8d();extensions[_0x129c('0xc')](_0x3e241f,_0x59d810[0x0]);},'afterUpdate':function(_0x1bf4f2,_0x2f0a99){extensions[_0x129c('0xc')](_0x3e241f,_0x1bf4f2);},'afterDestroy':function(_0x11319b,_0x19722e){extensions[_0x129c('0xc')](_0x3e241f,_0x11319b);}}});}; \ No newline at end of file +var _0x9aea=['./interval.attributes','../../components/extensions/rewrite','define','tools_intervals','rewrite','lodash','../../config/logger','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x3f6b08,_0x24c46f){var _0x3ff668=function(_0x4ff2cc){while(--_0x4ff2cc){_0x3f6b08['push'](_0x3f6b08['shift']());}};_0x3ff668(++_0x24c46f);}(_0x9aea,0xdd));var _0xa9ae=function(_0x336c32,_0x22f93){_0x336c32=_0x336c32-0x0;var _0x254a04=_0x9aea[_0x336c32];return _0x254a04;};'use strict';var _=require(_0xa9ae('0x0'));var util=require('util');var logger=require(_0xa9ae('0x1'))('api');var moment=require(_0xa9ae('0x2'));var BPromise=require(_0xa9ae('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa9ae('0x4'));var rimraf=require(_0xa9ae('0x5'));var config=require(_0xa9ae('0x6'));var attributes=require(_0xa9ae('0x7'));var extensions=require(_0xa9ae('0x8'));module['exports']=function(_0x1aa3b9,_0x22734b){return _0x1aa3b9[_0xa9ae('0x9')]('Interval',attributes,{'tableName':_0xa9ae('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x3917f0,_0x465bd2){extensions[_0xa9ae('0xb')](_0x1aa3b9,_0x3917f0);},'afterBulkCreate':function(_0x1882dc,_0x2d1188,_0x1816c2){_0x1816c2();extensions[_0xa9ae('0xb')](_0x1aa3b9,_0x1882dc[0x0]);},'afterUpdate':function(_0x2f238f,_0x5a8178){extensions[_0xa9ae('0xb')](_0x1aa3b9,_0x2f238f);},'afterDestroy':function(_0x4fbf0e,_0x2addd2){extensions[_0xa9ae('0xb')](_0x1aa3b9,_0x4fbf0e);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 43e5253..535f43d 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 _0x9674=['then','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s','stringify','error','Interval,\x20%s,\x20%s','message','info','result','catch','GetInterval','Interval','findAll','options','raw','where','attributes','map','include','model','ShowInterval','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x3ef7b5,_0x3c06e6){var _0x325acf=function(_0x34e915){while(--_0x34e915){_0x3ef7b5['push'](_0x3ef7b5['shift']());}};_0x325acf(++_0x3c06e6);}(_0x9674,0x104));var _0x4967=function(_0x1b4c04,_0x8d961d){_0x1b4c04=_0x1b4c04-0x0;var _0x374f5d=_0x9674[_0x1b4c04];return _0x374f5d;};'use strict';var _=require(_0x4967('0x0'));var util=require('util');var moment=require(_0x4967('0x1'));var BPromise=require(_0x4967('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4967('0x3'));var db=require(_0x4967('0x4'))['db'];var utils=require(_0x4967('0x5'));var logger=require(_0x4967('0x6'))(_0x4967('0x7'));var config=require(_0x4967('0x8'));var jayson=require(_0x4967('0x9'));var client=jayson['client'][_0x4967('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2f3d02,_0x1dbeec,_0x28d363){return new BPromise(function(_0x30d0cd,_0x226079){return client[_0x4967('0xb')](_0x2f3d02,_0x28d363)[_0x4967('0xc')](function(_0x2742ef){logger['info']('Interval,\x20%s,\x20%s',_0x1dbeec,_0x4967('0xd'));logger[_0x4967('0xe')](_0x4967('0xf'),_0x1dbeec,'request\x20sent',JSON[_0x4967('0x10')](_0x2742ef));if(_0x2742ef[_0x4967('0x11')]){if(_0x2742ef[_0x4967('0x11')]['code']===0x1f4){logger[_0x4967('0x11')](_0x4967('0x12'),_0x1dbeec,_0x2742ef['error']['message']);return _0x226079(_0x2742ef[_0x4967('0x11')][_0x4967('0x13')]);}logger['error']('Interval,\x20%s,\x20%s',_0x1dbeec,_0x2742ef[_0x4967('0x11')][_0x4967('0x13')]);return _0x30d0cd(_0x2742ef[_0x4967('0x11')]['message']);}else{logger[_0x4967('0x14')]('Interval,\x20%s,\x20%s',_0x1dbeec,_0x4967('0xd'));_0x30d0cd(_0x2742ef[_0x4967('0x15')]['message']);}})[_0x4967('0x16')](function(_0x194912){logger[_0x4967('0x11')](_0x4967('0x12'),_0x1dbeec,_0x194912);_0x226079(_0x194912);});});}exports[_0x4967('0x17')]=function(_0x5643ae){var _0x5787ca=this;return new Promise(function(_0x2e905b,_0x2c3532){return db[_0x4967('0x18')][_0x4967('0x19')]({'raw':_0x5643ae[_0x4967('0x1a')]?_0x5643ae[_0x4967('0x1a')][_0x4967('0x1b')]===undefined?!![]:![]:!![],'where':_0x5643ae[_0x4967('0x1a')]?_0x5643ae[_0x4967('0x1a')][_0x4967('0x1c')]||null:null,'attributes':_0x5643ae[_0x4967('0x1a')]?_0x5643ae[_0x4967('0x1a')][_0x4967('0x1d')]||null:null,'limit':_0x5643ae[_0x4967('0x1a')]?_0x5643ae[_0x4967('0x1a')]['limit']||null:null,'include':_0x5643ae[_0x4967('0x1a')]?_0x5643ae[_0x4967('0x1a')]['include']?_[_0x4967('0x1e')](_0x5643ae[_0x4967('0x1a')][_0x4967('0x1f')],function(_0x50836d){return{'model':db[_0x50836d[_0x4967('0x20')]],'as':_0x50836d['as'],'attributes':_0x50836d['attributes'],'include':_0x50836d['include']?_[_0x4967('0x1e')](_0x50836d[_0x4967('0x1f')],function(_0x46bcc7){return{'model':db[_0x46bcc7[_0x4967('0x20')]],'as':_0x46bcc7['as'],'attributes':_0x46bcc7['attributes'],'include':_0x46bcc7['include']?_[_0x4967('0x1e')](_0x46bcc7[_0x4967('0x1f')],function(_0x18ff04){return{'model':db[_0x18ff04['model']],'as':_0x18ff04['as'],'attributes':_0x18ff04['attributes']};}):[]};}):[]};}):[]:[]})[_0x4967('0xc')](function(_0x100826){logger[_0x4967('0x14')]('GetInterval',_0x5643ae);logger[_0x4967('0xe')](_0x4967('0x17'),_0x5643ae,JSON[_0x4967('0x10')](_0x100826));_0x2e905b(_0x100826);})[_0x4967('0x16')](function(_0x42743b){logger[_0x4967('0x11')](_0x4967('0x17'),_0x42743b['message'],_0x5643ae);_0x2c3532(_0x5787ca[_0x4967('0x11')](0x1f4,_0x42743b[_0x4967('0x13')]));});});};exports[_0x4967('0x21')]=function(_0x265dcd){var _0x9ee4f4=this;return new Promise(function(_0x52cc95,_0x4d04a4){return db[_0x4967('0x18')]['find']({'raw':_0x265dcd[_0x4967('0x1a')]?_0x265dcd[_0x4967('0x1a')][_0x4967('0x1b')]===undefined?!![]:![]:!![],'where':_0x265dcd[_0x4967('0x1a')]?_0x265dcd[_0x4967('0x1a')]['where']||null:null,'attributes':_0x265dcd[_0x4967('0x1a')]?_0x265dcd[_0x4967('0x1a')][_0x4967('0x1d')]||null:null,'include':_0x265dcd['options']?_0x265dcd[_0x4967('0x1a')][_0x4967('0x1f')]?_['map'](_0x265dcd[_0x4967('0x1a')][_0x4967('0x1f')],function(_0x5ebda4){return{'model':db[_0x5ebda4[_0x4967('0x20')]],'as':_0x5ebda4['as'],'attributes':_0x5ebda4[_0x4967('0x1d')],'include':_0x5ebda4[_0x4967('0x1f')]?_[_0x4967('0x1e')](_0x5ebda4['include'],function(_0x29d5fc){return{'model':db[_0x29d5fc['model']],'as':_0x29d5fc['as'],'attributes':_0x29d5fc[_0x4967('0x1d')],'include':_0x29d5fc[_0x4967('0x1f')]?_[_0x4967('0x1e')](_0x29d5fc[_0x4967('0x1f')],function(_0x37548d){return{'model':db[_0x37548d[_0x4967('0x20')]],'as':_0x37548d['as'],'attributes':_0x37548d[_0x4967('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x261ec5){logger[_0x4967('0x14')](_0x4967('0x21'),_0x265dcd);logger[_0x4967('0xe')](_0x4967('0x21'),_0x265dcd,JSON[_0x4967('0x10')](_0x261ec5));_0x52cc95(_0x261ec5);})[_0x4967('0x16')](function(_0x54ea5f){logger[_0x4967('0x11')]('ShowInterval',_0x54ea5f[_0x4967('0x13')],_0x265dcd);_0x4d04a4(_0x9ee4f4[_0x4967('0x11')](0x1f4,_0x54ea5f[_0x4967('0x13')]));});});}; \ No newline at end of file +var _0xe36a=['result','GetInterval','Interval','findAll','options','raw','where','limit','map','model','include','attributes','catch','ShowInterval','find','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','Interval,\x20%s,\x20%s','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x45b380,_0x478cbd){var _0x4cdb76=function(_0x1b6a75){while(--_0x1b6a75){_0x45b380['push'](_0x45b380['shift']());}};_0x4cdb76(++_0x478cbd);}(_0xe36a,0x7e));var _0xae36=function(_0x4f7e5b,_0x452c65){_0x4f7e5b=_0x4f7e5b-0x0;var _0x13ea34=_0xe36a[_0x4f7e5b];return _0x13ea34;};'use strict';var _=require(_0xae36('0x0'));var util=require(_0xae36('0x1'));var moment=require('moment');var BPromise=require(_0xae36('0x2'));var rs=require(_0xae36('0x3'));var fs=require('fs');var Redis=require(_0xae36('0x4'));var db=require(_0xae36('0x5'))['db'];var utils=require(_0xae36('0x6'));var logger=require(_0xae36('0x7'))('rpc');var config=require(_0xae36('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xae36('0x9')][_0xae36('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x41dcf5,_0x56faa6,_0x44f329){return new BPromise(function(_0x24e3c5,_0x3162f9){return client[_0xae36('0xb')](_0x41dcf5,_0x44f329)[_0xae36('0xc')](function(_0x50ec14){logger[_0xae36('0xd')](_0xae36('0xe'),_0x56faa6,_0xae36('0xf'));logger[_0xae36('0x10')](_0xae36('0x11'),_0x56faa6,'request\x20sent',JSON[_0xae36('0x12')](_0x50ec14));if(_0x50ec14[_0xae36('0x13')]){if(_0x50ec14[_0xae36('0x13')][_0xae36('0x14')]===0x1f4){logger['error'](_0xae36('0xe'),_0x56faa6,_0x50ec14[_0xae36('0x13')]['message']);return _0x3162f9(_0x50ec14[_0xae36('0x13')][_0xae36('0x15')]);}logger[_0xae36('0x13')](_0xae36('0xe'),_0x56faa6,_0x50ec14[_0xae36('0x13')][_0xae36('0x15')]);return _0x24e3c5(_0x50ec14[_0xae36('0x13')][_0xae36('0x15')]);}else{logger[_0xae36('0xd')](_0xae36('0xe'),_0x56faa6,'request\x20sent');_0x24e3c5(_0x50ec14[_0xae36('0x16')][_0xae36('0x15')]);}})['catch'](function(_0x545082){logger[_0xae36('0x13')](_0xae36('0xe'),_0x56faa6,_0x545082);_0x3162f9(_0x545082);});});}exports[_0xae36('0x17')]=function(_0x59d3be){var _0x2bf0a7=this;return new Promise(function(_0x2a06cc,_0x459f5c){return db[_0xae36('0x18')][_0xae36('0x19')]({'raw':_0x59d3be['options']?_0x59d3be[_0xae36('0x1a')][_0xae36('0x1b')]===undefined?!![]:![]:!![],'where':_0x59d3be[_0xae36('0x1a')]?_0x59d3be[_0xae36('0x1a')][_0xae36('0x1c')]||null:null,'attributes':_0x59d3be[_0xae36('0x1a')]?_0x59d3be[_0xae36('0x1a')]['attributes']||null:null,'limit':_0x59d3be[_0xae36('0x1a')]?_0x59d3be[_0xae36('0x1a')][_0xae36('0x1d')]||null:null,'include':_0x59d3be['options']?_0x59d3be[_0xae36('0x1a')]['include']?_[_0xae36('0x1e')](_0x59d3be[_0xae36('0x1a')]['include'],function(_0x433573){return{'model':db[_0x433573[_0xae36('0x1f')]],'as':_0x433573['as'],'attributes':_0x433573['attributes'],'include':_0x433573[_0xae36('0x20')]?_[_0xae36('0x1e')](_0x433573['include'],function(_0x150f88){return{'model':db[_0x150f88[_0xae36('0x1f')]],'as':_0x150f88['as'],'attributes':_0x150f88[_0xae36('0x21')],'include':_0x150f88[_0xae36('0x20')]?_[_0xae36('0x1e')](_0x150f88[_0xae36('0x20')],function(_0x34ad60){return{'model':db[_0x34ad60[_0xae36('0x1f')]],'as':_0x34ad60['as'],'attributes':_0x34ad60[_0xae36('0x21')]};}):[]};}):[]};}):[]:[]})[_0xae36('0xc')](function(_0x3cbf81){logger['info'](_0xae36('0x17'),_0x59d3be);logger[_0xae36('0x10')](_0xae36('0x17'),_0x59d3be,JSON['stringify'](_0x3cbf81));_0x2a06cc(_0x3cbf81);})[_0xae36('0x22')](function(_0x367e18){logger[_0xae36('0x13')](_0xae36('0x17'),_0x367e18[_0xae36('0x15')],_0x59d3be);_0x459f5c(_0x2bf0a7[_0xae36('0x13')](0x1f4,_0x367e18[_0xae36('0x15')]));});});};exports[_0xae36('0x23')]=function(_0x5421fa){var _0x14d062=this;return new Promise(function(_0x290cdc,_0x5a69e2){return db[_0xae36('0x18')][_0xae36('0x24')]({'raw':_0x5421fa[_0xae36('0x1a')]?_0x5421fa['options'][_0xae36('0x1b')]===undefined?!![]:![]:!![],'where':_0x5421fa[_0xae36('0x1a')]?_0x5421fa[_0xae36('0x1a')][_0xae36('0x1c')]||null:null,'attributes':_0x5421fa[_0xae36('0x1a')]?_0x5421fa[_0xae36('0x1a')][_0xae36('0x21')]||null:null,'include':_0x5421fa[_0xae36('0x1a')]?_0x5421fa[_0xae36('0x1a')][_0xae36('0x20')]?_[_0xae36('0x1e')](_0x5421fa['options']['include'],function(_0xb49d53){return{'model':db[_0xb49d53[_0xae36('0x1f')]],'as':_0xb49d53['as'],'attributes':_0xb49d53[_0xae36('0x21')],'include':_0xb49d53[_0xae36('0x20')]?_['map'](_0xb49d53[_0xae36('0x20')],function(_0x4bf7cd){return{'model':db[_0x4bf7cd[_0xae36('0x1f')]],'as':_0x4bf7cd['as'],'attributes':_0x4bf7cd[_0xae36('0x21')],'include':_0x4bf7cd['include']?_[_0xae36('0x1e')](_0x4bf7cd[_0xae36('0x20')],function(_0x14f2cd){return{'model':db[_0x14f2cd[_0xae36('0x1f')]],'as':_0x14f2cd['as'],'attributes':_0x14f2cd[_0xae36('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x330076){logger[_0xae36('0xd')](_0xae36('0x23'),_0x5421fa);logger[_0xae36('0x10')](_0xae36('0x23'),_0x5421fa,JSON['stringify'](_0x330076));_0x290cdc(_0x330076);})[_0xae36('0x22')](function(_0x261948){logger[_0xae36('0x13')](_0xae36('0x23'),_0x261948[_0xae36('0x15')],_0x5421fa);_0x5a69e2(_0x14d062[_0xae36('0x13')](0x1f4,_0x261948[_0xae36('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 56a0f3a..b851ad1 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 _0x44ed=['post','isAuthenticated','send','express','Router','./jira.controller'];(function(_0x23a9bc,_0x3f1a25){var _0x55d674=function(_0xa7fc73){while(--_0xa7fc73){_0x23a9bc['push'](_0x23a9bc['shift']());}};_0x55d674(++_0x3f1a25);}(_0x44ed,0x183));var _0xd44e=function(_0x124bfa,_0x257315){_0x124bfa=_0x124bfa-0x0;var _0x2a9424=_0x44ed[_0x124bfa];return _0x2a9424;};'use strict';var express=require(_0xd44e('0x0'));var router=express[_0xd44e('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0xd44e('0x2'));router[_0xd44e('0x3')]('/',auth[_0xd44e('0x4')](),controller[_0xd44e('0x5')]);module['exports']=router; \ No newline at end of file +var _0x3090=['exports','express','Router','../../components/auth/service','./jira.controller','post','isAuthenticated','send'];(function(_0x109c0b,_0x2c11bb){var _0x2b3397=function(_0x2c9793){while(--_0x2c9793){_0x109c0b['push'](_0x109c0b['shift']());}};_0x2b3397(++_0x2c11bb);}(_0x3090,0x131));var _0x0309=function(_0x199c8c,_0x3924d6){_0x199c8c=_0x199c8c-0x0;var _0x29b154=_0x3090[_0x199c8c];return _0x29b154;};'use strict';var express=require(_0x0309('0x0'));var router=express[_0x0309('0x1')]();var auth=require(_0x0309('0x2'));var controller=require(_0x0309('0x3'));router[_0x0309('0x4')]('/',auth[_0x0309('0x5')](),controller[_0x0309('0x6')]);module[_0x0309('0x7')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index 7d116d5..c88df01 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 _0xc0db=['POST','application/json','toString','request','setEncoding','utf8','json','error','status','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','end','openIssue','send','body','headers','x-forwarded-for','connection','remoteAddress','socket','https','../../config/logger','support','key','MOTGUI','\x20from\x20','stringify','issuetype','customfield_11500','email','customfield_11501','oldToken','fields','customfield_11502','customfield_11503','name','customfield_11504','customfield_10102','track.xcallymotion.com','/rest/api/2/issue'];(function(_0x4d669e,_0x868e40){var _0x484ff3=function(_0x51ecec){while(--_0x51ecec){_0x4d669e['push'](_0x4d669e['shift']());}};_0x484ff3(++_0x868e40);}(_0xc0db,0x1f4));var _0xbc0d=function(_0x4663d3,_0x23b246){_0x4663d3=_0x4663d3-0x0;var _0xc4b1e6=_0xc0db[_0x4663d3];return _0xc4b1e6;};'use strict';var BPromise=require('bluebird');var https=require(_0xbc0d('0x0'));var logger=require(_0xbc0d('0x1'))('api');var USERNAME=_0xbc0d('0x2');var PASSWORD='3eAmWpBVP0';function openIssue(_0x282458,_0x345408){var _0x1259e7={'fields':{'project':{'key':_0x282458[_0xbc0d('0x3')]||_0xbc0d('0x4')},'summary':(_0x282458['summary']||'Report')+_0xbc0d('0x5')+_0x282458['ip'],'description':_0x282458['description']||JSON[_0xbc0d('0x6')](_0x282458),'issuetype':{'name':_0x282458[_0xbc0d('0x7')]||'Bug'}}};_0x1259e7['fields'][_0xbc0d('0x8')]=_0x282458[_0xbc0d('0x9')];_0x1259e7['fields'][_0xbc0d('0xa')]=_0x282458[_0xbc0d('0xb')];_0x1259e7[_0xbc0d('0xc')][_0xbc0d('0xd')]=_0x282458['newToken'];_0x1259e7[_0xbc0d('0xc')][_0xbc0d('0xe')]=_0x282458[_0xbc0d('0xf')];_0x1259e7[_0xbc0d('0xc')][_0xbc0d('0x10')]=_0x282458['reason'];_0x1259e7['fields'][_0xbc0d('0x11')]=_0x282458['ip'];var _0x32e7ec={'host':_0xbc0d('0x12'),'port':0x1bb,'path':_0xbc0d('0x13'),'method':_0xbc0d('0x14'),'timeout':0x4e20,'headers':{'Content-Type':_0xbc0d('0x15'),'Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)[_0xbc0d('0x16')]('base64')}};var _0x10b94d=JSON[_0xbc0d('0x6')](_0x1259e7);var _0x222efc=https[_0xbc0d('0x17')](_0x32e7ec,function(_0x274154){_0x274154[_0xbc0d('0x18')](_0xbc0d('0x19'));var _0x110590='';_0x274154['on']('data',function(_0x5beae7){_0x110590+=_0x5beae7;});_0x274154['on']('end',function(){if(_0x345408){return _0x345408['status'](_0x274154['statusCode'])[_0xbc0d('0x1a')](JSON['parse'](_0x110590));}});});_0x222efc['on'](_0xbc0d('0x1b'),function(_0x247f9e){if(_0x345408){return _0x345408[_0xbc0d('0x1c')](0x1f4)[_0xbc0d('0x1a')]({'errors':[{'message':_0xbc0d('0x1d'),'type':_0xbc0d('0x1e')}]});}});_0x222efc['write'](_0x10b94d);_0x222efc[_0xbc0d('0x1f')]();}exports[_0xbc0d('0x20')]=openIssue;exports[_0xbc0d('0x21')]=function(_0x59069c,_0x2c2e30){_0x59069c[_0xbc0d('0x22')]['ip']=_0x59069c[_0xbc0d('0x23')][_0xbc0d('0x24')]||_0x59069c[_0xbc0d('0x25')]['remoteAddress']||_0x59069c['socket'][_0xbc0d('0x26')]||_0x59069c[_0xbc0d('0x25')][_0xbc0d('0x27')][_0xbc0d('0x26')];return openIssue(_0x59069c[_0xbc0d('0x22')],_0x2c2e30);}; \ No newline at end of file +var _0xa155=['https','../../config/logger','api','support','3eAmWpBVP0','MOTGUI','summary','\x20from\x20','description','stringify','issuetype','Bug','customfield_11500','fields','oldToken','customfield_11502','customfield_11503','name','customfield_11504','reason','customfield_10102','/rest/api/2/issue','application/json','toString','base64','request','setEncoding','data','end','status','statusCode','parse','error','json','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','remoteAddress','socket','bluebird'];(function(_0x4fc421,_0x94e88){var _0x8c6d63=function(_0x5b8b42){while(--_0x5b8b42){_0x4fc421['push'](_0x4fc421['shift']());}};_0x8c6d63(++_0x94e88);}(_0xa155,0xe5));var _0x5a15=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa155[_0x24237f];return _0x48298e;};'use strict';var BPromise=require(_0x5a15('0x0'));var https=require(_0x5a15('0x1'));var logger=require(_0x5a15('0x2'))(_0x5a15('0x3'));var USERNAME=_0x5a15('0x4');var PASSWORD=_0x5a15('0x5');function openIssue(_0x529eb1,_0x1a63a5){var _0x42d4e0={'fields':{'project':{'key':_0x529eb1['key']||_0x5a15('0x6')},'summary':(_0x529eb1[_0x5a15('0x7')]||'Report')+_0x5a15('0x8')+_0x529eb1['ip'],'description':_0x529eb1[_0x5a15('0x9')]||JSON[_0x5a15('0xa')](_0x529eb1),'issuetype':{'name':_0x529eb1[_0x5a15('0xb')]||_0x5a15('0xc')}}};_0x42d4e0['fields'][_0x5a15('0xd')]=_0x529eb1['email'];_0x42d4e0[_0x5a15('0xe')]['customfield_11501']=_0x529eb1[_0x5a15('0xf')];_0x42d4e0[_0x5a15('0xe')][_0x5a15('0x10')]=_0x529eb1['newToken'];_0x42d4e0[_0x5a15('0xe')][_0x5a15('0x11')]=_0x529eb1[_0x5a15('0x12')];_0x42d4e0[_0x5a15('0xe')][_0x5a15('0x13')]=_0x529eb1[_0x5a15('0x14')];_0x42d4e0[_0x5a15('0xe')][_0x5a15('0x15')]=_0x529eb1['ip'];var _0x3efa82={'host':'track.xcallymotion.com','port':0x1bb,'path':_0x5a15('0x16'),'method':'POST','timeout':0x4e20,'headers':{'Content-Type':_0x5a15('0x17'),'Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)[_0x5a15('0x18')](_0x5a15('0x19'))}};var _0x335c3d=JSON['stringify'](_0x42d4e0);var _0x4ef2d4=https[_0x5a15('0x1a')](_0x3efa82,function(_0x51472b){_0x51472b[_0x5a15('0x1b')]('utf8');var _0x525bed='';_0x51472b['on'](_0x5a15('0x1c'),function(_0x1a20c4){_0x525bed+=_0x1a20c4;});_0x51472b['on'](_0x5a15('0x1d'),function(){if(_0x1a63a5){return _0x1a63a5[_0x5a15('0x1e')](_0x51472b[_0x5a15('0x1f')])['json'](JSON[_0x5a15('0x20')](_0x525bed));}});});_0x4ef2d4['on'](_0x5a15('0x21'),function(_0x28f695){if(_0x1a63a5){return _0x1a63a5[_0x5a15('0x1e')](0x1f4)[_0x5a15('0x22')]({'errors':[{'message':_0x5a15('0x23'),'type':_0x5a15('0x24')}]});}});_0x4ef2d4[_0x5a15('0x25')](_0x335c3d);_0x4ef2d4[_0x5a15('0x1d')]();}exports[_0x5a15('0x26')]=openIssue;exports[_0x5a15('0x27')]=function(_0x57c8c7,_0xfc9fbf){_0x57c8c7[_0x5a15('0x28')]['ip']=_0x57c8c7[_0x5a15('0x29')][_0x5a15('0x2a')]||_0x57c8c7[_0x5a15('0x2b')][_0x5a15('0x2c')]||_0x57c8c7[_0x5a15('0x2d')][_0x5a15('0x2c')]||_0x57c8c7[_0x5a15('0x2b')][_0x5a15('0x2d')][_0x5a15('0x2c')];return openIssue(_0x57c8c7['body'],_0xfc9fbf);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 7770362..ce30f9b 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 _0x6a7c=['/:id','show','put','delete','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x1fafa5,_0x1aa281){var _0xcf08c9=function(_0x3af1b4){while(--_0x3af1b4){_0x1fafa5['push'](_0x1fafa5['shift']());}};_0xcf08c9(++_0x1aa281);}(_0x6a7c,0xc3));var _0xc6a7=function(_0x998263,_0x485b47){_0x998263=_0x998263-0x0;var _0x26fabe=_0x6a7c[_0x998263];return _0x26fabe;};'use strict';var multer=require(_0xc6a7('0x0'));var util=require(_0xc6a7('0x1'));var path=require(_0xc6a7('0x2'));var timeout=require(_0xc6a7('0x3'));var express=require(_0xc6a7('0x4'));var router=express['Router']();var auth=require(_0xc6a7('0x5'));var interaction=require(_0xc6a7('0x6'));var config=require(_0xc6a7('0x7'));var controller=require(_0xc6a7('0x8'));router[_0xc6a7('0x9')]('/',auth[_0xc6a7('0xa')](),controller[_0xc6a7('0xb')]);router[_0xc6a7('0x9')](_0xc6a7('0xc'),auth[_0xc6a7('0xa')](),controller[_0xc6a7('0xd')]);router[_0xc6a7('0x9')](_0xc6a7('0xe'),auth['isAuthenticated'](),controller[_0xc6a7('0xf')]);router['post']('/',auth[_0xc6a7('0xa')](),controller['create']);router[_0xc6a7('0x10')](_0xc6a7('0xe'),auth[_0xc6a7('0xa')](),controller['update']);router[_0xc6a7('0x11')](_0xc6a7('0xe'),auth[_0xc6a7('0xa')](),controller['destroy']);module[_0xc6a7('0x12')]=router; \ No newline at end of file +var _0x97f8=['get','/describe','isAuthenticated','/:id','post','create','delete','destroy','exports','multer','util','connect-timeout','express','../../config/environment'];(function(_0x5a5365,_0x4a3c7f){var _0x2b1919=function(_0xaa73c8){while(--_0xaa73c8){_0x5a5365['push'](_0x5a5365['shift']());}};_0x2b1919(++_0x4a3c7f);}(_0x97f8,0xcd));var _0x897f=function(_0x1951fd,_0x2a91df){_0x1951fd=_0x1951fd-0x0;var _0xe45e33=_0x97f8[_0x1951fd];return _0xe45e33;};'use strict';var multer=require(_0x897f('0x0'));var util=require(_0x897f('0x1'));var path=require('path');var timeout=require(_0x897f('0x2'));var express=require(_0x897f('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x897f('0x4'));var controller=require('./jscriptyAnswerReport.controller');router[_0x897f('0x5')]('/',auth['isAuthenticated'](),controller['index']);router[_0x897f('0x5')](_0x897f('0x6'),auth[_0x897f('0x7')](),controller['describe']);router[_0x897f('0x5')](_0x897f('0x8'),auth[_0x897f('0x7')](),controller['show']);router[_0x897f('0x9')]('/',auth[_0x897f('0x7')](),controller[_0x897f('0xa')]);router['put']('/:id',auth[_0x897f('0x7')](),controller['update']);router[_0x897f('0xb')](_0x897f('0x8'),auth[_0x897f('0x7')](),controller[_0x897f('0xc')]);module[_0x897f('0xd')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 86672c9..9395e6f 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 _0x5384=['long','sequelize','STRING'];(function(_0x49cd9,_0x3c937f){var _0x5c0a00=function(_0x53b601){while(--_0x53b601){_0x49cd9['push'](_0x49cd9['shift']());}};_0x5c0a00(++_0x3c937f);}(_0x5384,0x17b));var _0x4538=function(_0xaea167,_0x1c04f2){_0xaea167=_0xaea167-0x0;var _0x43d12d=_0x5384[_0xaea167];return _0x43d12d;};'use strict';var Sequelize=require(_0x4538('0x0'));module['exports']={'question':{'type':Sequelize[_0x4538('0x1')]},'answer':{'type':Sequelize['TEXT'](_0x4538('0x2'))},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0x4538('0x1')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x4538('0x1')]},'calleridname':{'type':Sequelize[_0x4538('0x1')]},'calleridnum':{'type':Sequelize[_0x4538('0x1')]},'questionId':{'type':Sequelize[_0x4538('0x1')]}}; \ No newline at end of file +var _0xfdf5=['STRING','sequelize','exports','long'];(function(_0x2544f1,_0xb653af){var _0x3cab4f=function(_0x5e535c){while(--_0x5e535c){_0x2544f1['push'](_0x2544f1['shift']());}};_0x3cab4f(++_0xb653af);}(_0xfdf5,0x69));var _0x5fdf=function(_0x253476,_0x16b31a){_0x253476=_0x253476-0x0;var _0x134271=_0xfdf5[_0x253476];return _0x134271;};'use strict';var Sequelize=require(_0x5fdf('0x0'));module[_0x5fdf('0x1')]={'question':{'type':Sequelize['STRING']},'answer':{'type':Sequelize['TEXT'](_0x5fdf('0x2'))},'membername':{'type':Sequelize[_0x5fdf('0x3')]},'projectname':{'type':Sequelize[_0x5fdf('0x3')]},'queue':{'type':Sequelize[_0x5fdf('0x3')]},'uniqueid':{'type':Sequelize[_0x5fdf('0x3')]},'calleridname':{'type':Sequelize[_0x5fdf('0x3')]},'calleridnum':{'type':Sequelize[_0x5fdf('0x3')]},'questionId':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js index c614944..0b537a1 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 _0x2287=['findAll','rows','catch','show','rawAttributes','options','create','body','find','params','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','reject','save','update','then','destroy','stack','name','send','index','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','VIRTUAL','merge','JscriptyAnswerReport','includeAll','include'];(function(_0x4e8ae2,_0x4e310b){var _0x4b763f=function(_0x1275c9){while(--_0x1275c9){_0x4e8ae2['push'](_0x4e8ae2['shift']());}};_0x4b763f(++_0x4e310b);}(_0x2287,0xe3));var _0x7228=function(_0x5bff80,_0x35c63d){_0x5bff80=_0x5bff80-0x0;var _0x54b465=_0x2287[_0x5bff80];return _0x54b465;};'use strict';var pdf=require(_0x7228('0x0'));var emlformat=require(_0x7228('0x1'));var rimraf=require(_0x7228('0x2'));var zipdir=require(_0x7228('0x3'));var jsonpatch=require(_0x7228('0x4'));var rp=require('request-promise');var moment=require(_0x7228('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x7228('0x6'));var util=require(_0x7228('0x7'));var path=require(_0x7228('0x8'));var sox=require(_0x7228('0x9'));var csv=require(_0x7228('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x7228('0xb'));var squel=require('squel');var crypto=require(_0x7228('0xc'));var jsforce=require(_0x7228('0xd'));var deskjs=require(_0x7228('0xe'));var toCsv=require('to-csv');var querystring=require(_0x7228('0xf'));var Papa=require('papaparse');var Redis=require(_0x7228('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x7228('0x11'));var as=require(_0x7228('0x12'));var hardwareService=require(_0x7228('0x13'));var logger=require('../../config/logger')(_0x7228('0x14'));var utils=require(_0x7228('0x15'));var config=require(_0x7228('0x16'));var db=require(_0x7228('0x17'))['db'];function respondWithStatusCode(_0x5e2709,_0x1454c1){_0x1454c1=_0x1454c1||0xcc;return function(_0x44aa6a){if(_0x44aa6a){return _0x5e2709[_0x7228('0x18')](_0x1454c1);}return _0x5e2709[_0x7228('0x19')](_0x1454c1)[_0x7228('0x1a')]();};}function respondWithResult(_0x308620,_0x1ab4ba){_0x1ab4ba=_0x1ab4ba||0xc8;return function(_0x3b60ca){if(_0x3b60ca){return _0x308620[_0x7228('0x19')](_0x1ab4ba)['json'](_0x3b60ca);}};}function respondWithFilteredResult(_0x56242f,_0x5d6227){return function(_0x1003b7){if(_0x1003b7){var _0x5bbb86=_0x1003b7[_0x7228('0x1b')],_0x184ede=_0x5d6227[_0x7228('0x1c')],_0x5e1560=_0x5d6227[_0x7228('0x1c')]+_0x5d6227[_0x7228('0x1d')],_0x48a841;if(_0x5e1560>=_0x5bbb86){_0x5e1560=_0x5bbb86;_0x48a841=0xc8;}else{_0x48a841=0xce;}_0x56242f['status'](_0x48a841);return _0x56242f['set']('Content-Range',_0x184ede+'-'+_0x5e1560+'/'+_0x5bbb86)['json'](_0x1003b7);}return null;};}function patchUpdates(_0x2e85ca){return function(_0x135b70){try{jsonpatch['apply'](_0x135b70,_0x2e85ca,!![]);}catch(_0x38ac16){return BPromise[_0x7228('0x1e')](_0x38ac16);}return _0x135b70[_0x7228('0x1f')]();};}function saveUpdates(_0x3dd7f9,_0x4c071c){return function(_0x22ae9c){if(_0x22ae9c){return _0x22ae9c[_0x7228('0x20')](_0x3dd7f9)[_0x7228('0x21')](function(_0x41073c){return _0x41073c;});}return null;};}function removeEntity(_0x1f209e,_0x2983a8){return function(_0x469045){if(_0x469045){return _0x469045[_0x7228('0x22')]()[_0x7228('0x21')](function(){_0x1f209e[_0x7228('0x19')](0xcc)[_0x7228('0x1a')]();});}};}function handleEntityNotFound(_0x56f184,_0x492397){return function(_0xa5cfe4){if(!_0xa5cfe4){_0x56f184[_0x7228('0x18')](0x194);}return _0xa5cfe4;};}function handleError(_0x8fecd4,_0x63b022){_0x63b022=_0x63b022||0x1f4;return function(_0x179e35){logger['error'](_0x179e35[_0x7228('0x23')]);if(_0x179e35[_0x7228('0x24')]){delete _0x179e35['name'];}_0x8fecd4[_0x7228('0x19')](_0x63b022)[_0x7228('0x25')](_0x179e35);};}exports[_0x7228('0x26')]=function(_0x3b7b09,_0x17ad16){var _0x40ad91={},_0x3f8b1b={},_0x150ba0={'count':0x0,'rows':[]};var _0x443590=_['map'](db['JscriptyAnswerReport']['rawAttributes'],function(_0x3c3639){return{'name':_0x3c3639[_0x7228('0x27')],'type':_0x3c3639[_0x7228('0x28')][_0x7228('0x29')]};});_0x3f8b1b[_0x7228('0x2a')]=_[_0x7228('0x2b')](_0x443590,_0x7228('0x24'));_0x3f8b1b[_0x7228('0x2c')]=_[_0x7228('0x2d')](_0x3b7b09[_0x7228('0x2c')]);_0x3f8b1b[_0x7228('0x2e')]=_[_0x7228('0x2f')](_0x3f8b1b['model'],_0x3f8b1b[_0x7228('0x2c')]);_0x40ad91[_0x7228('0x30')]=_[_0x7228('0x2f')](_0x3f8b1b[_0x7228('0x2a')],qs[_0x7228('0x31')](_0x3b7b09[_0x7228('0x2c')]['fields']));_0x40ad91[_0x7228('0x30')]=_0x40ad91['attributes'][_0x7228('0x32')]?_0x40ad91['attributes']:_0x3f8b1b[_0x7228('0x2a')];if(!_0x3b7b09[_0x7228('0x2c')][_0x7228('0x33')]('nolimit')){_0x40ad91[_0x7228('0x1d')]=qs['limit'](_0x3b7b09['query'][_0x7228('0x1d')]);_0x40ad91[_0x7228('0x1c')]=qs[_0x7228('0x1c')](_0x3b7b09[_0x7228('0x2c')][_0x7228('0x1c')]);}_0x40ad91[_0x7228('0x34')]=qs[_0x7228('0x35')](_0x3b7b09['query'][_0x7228('0x35')]);_0x40ad91[_0x7228('0x36')]=qs[_0x7228('0x2e')](_['pick'](_0x3b7b09[_0x7228('0x2c')],_0x3f8b1b['filters']),_0x443590);if(_0x3b7b09[_0x7228('0x2c')][_0x7228('0x37')]){_0x40ad91[_0x7228('0x36')]=_['merge'](_0x40ad91[_0x7228('0x36')],{'$or':_['map'](_0x443590,function(_0x210314){if(_0x210314[_0x7228('0x28')]!==_0x7228('0x38')){var _0x2cf6b6={};_0x2cf6b6[_0x210314[_0x7228('0x24')]]={'$like':'%'+_0x3b7b09['query'][_0x7228('0x37')]+'%'};return _0x2cf6b6;}})});}_0x40ad91=_[_0x7228('0x39')]({},_0x40ad91,_0x3b7b09['options']);var _0x188c1a={'where':_0x40ad91[_0x7228('0x36')]};return db[_0x7228('0x3a')][_0x7228('0x1b')](_0x188c1a)['then'](function(_0x45e780){_0x150ba0[_0x7228('0x1b')]=_0x45e780;if(_0x3b7b09[_0x7228('0x2c')][_0x7228('0x3b')]){_0x40ad91[_0x7228('0x3c')]=[{'all':!![]}];}return db[_0x7228('0x3a')][_0x7228('0x3d')](_0x40ad91);})['then'](function(_0x11d0e8){_0x150ba0[_0x7228('0x3e')]=_0x11d0e8;return _0x150ba0;})['then'](respondWithFilteredResult(_0x17ad16,_0x40ad91))[_0x7228('0x3f')](handleError(_0x17ad16,null));};exports[_0x7228('0x40')]=function(_0x878b53,_0x4a4a2c){var _0x377957={'raw':!![],'where':{'id':_0x878b53['params']['id']}},_0x29be99={};_0x29be99[_0x7228('0x2a')]=_['keys'](db[_0x7228('0x3a')][_0x7228('0x41')]);_0x29be99[_0x7228('0x2c')]=_[_0x7228('0x2d')](_0x878b53[_0x7228('0x2c')]);_0x29be99['filters']=_[_0x7228('0x2f')](_0x29be99['model'],_0x29be99['query']);_0x377957['attributes']=_[_0x7228('0x2f')](_0x29be99['model'],qs[_0x7228('0x31')](_0x878b53['query']['fields']));_0x377957['attributes']=_0x377957[_0x7228('0x30')]['length']?_0x377957[_0x7228('0x30')]:_0x29be99[_0x7228('0x2a')];if(_0x878b53[_0x7228('0x2c')][_0x7228('0x3b')]){_0x377957[_0x7228('0x3c')]=[{'all':!![]}];}_0x377957=_[_0x7228('0x39')]({},_0x377957,_0x878b53[_0x7228('0x42')]);return db[_0x7228('0x3a')]['find'](_0x377957)[_0x7228('0x21')](handleEntityNotFound(_0x4a4a2c,null))[_0x7228('0x21')](respondWithResult(_0x4a4a2c,null))[_0x7228('0x3f')](handleError(_0x4a4a2c,null));};exports['create']=function(_0x3d0642,_0xd51a92){return db[_0x7228('0x3a')][_0x7228('0x43')](_0x3d0642[_0x7228('0x44')],{})[_0x7228('0x21')](respondWithResult(_0xd51a92,0xc9))['catch'](handleError(_0xd51a92,null));};exports[_0x7228('0x20')]=function(_0x44152d,_0x1a4377){if(_0x44152d[_0x7228('0x44')]['id']){delete _0x44152d[_0x7228('0x44')]['id'];}return db[_0x7228('0x3a')][_0x7228('0x45')]({'where':{'id':_0x44152d[_0x7228('0x46')]['id']}})['then'](handleEntityNotFound(_0x1a4377,null))[_0x7228('0x21')](saveUpdates(_0x44152d[_0x7228('0x44')],null))[_0x7228('0x21')](respondWithResult(_0x1a4377,null))[_0x7228('0x3f')](handleError(_0x1a4377,null));};exports['destroy']=function(_0x2412f6,_0x2fe6fc){return db[_0x7228('0x3a')][_0x7228('0x45')]({'where':{'id':_0x2412f6['params']['id']}})[_0x7228('0x21')](handleEntityNotFound(_0x2fe6fc,null))[_0x7228('0x21')](removeEntity(_0x2fe6fc,null))[_0x7228('0x3f')](handleError(_0x2fe6fc,null));};exports['describe']=function(_0x37fd26,_0x199f0a){return db[_0x7228('0x3a')][_0x7228('0x47')]()['then'](respondWithResult(_0x199f0a,null))[_0x7228('0x3f')](handleError(_0x199f0a,null));}; \ No newline at end of file +var _0xe52a=['then','destroy','error','stack','name','index','JscriptyAnswerReport','fieldName','type','key','model','map','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','keys','rawAttributes','options','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','limit','set','Content-Range','apply','save','update'];(function(_0x3cab4a,_0x58357e){var _0x4f73c8=function(_0x3eae9d){while(--_0x3eae9d){_0x3cab4a['push'](_0x3cab4a['shift']());}};_0x4f73c8(++_0x58357e);}(_0xe52a,0x1e4));var _0xae52=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xe52a[_0x2cfb58];return _0xd99951;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xae52('0x0'));var rimraf=require(_0xae52('0x1'));var zipdir=require(_0xae52('0x2'));var jsonpatch=require(_0xae52('0x3'));var rp=require('request-promise');var moment=require(_0xae52('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xae52('0x5'));var path=require(_0xae52('0x6'));var sox=require(_0xae52('0x7'));var csv=require(_0xae52('0x8'));var ejs=require(_0xae52('0x9'));var fs=require('fs');var _=require(_0xae52('0xa'));var squel=require('squel');var crypto=require(_0xae52('0xb'));var jsforce=require(_0xae52('0xc'));var deskjs=require(_0xae52('0xd'));var toCsv=require(_0xae52('0x8'));var querystring=require(_0xae52('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xae52('0xf'));var qs=require(_0xae52('0x10'));var as=require(_0xae52('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xae52('0x12'))(_0xae52('0x13'));var utils=require(_0xae52('0x14'));var config=require(_0xae52('0x15'));var db=require(_0xae52('0x16'))['db'];function respondWithStatusCode(_0x31e049,_0x470bc3){_0x470bc3=_0x470bc3||0xcc;return function(_0x1e994b){if(_0x1e994b){return _0x31e049[_0xae52('0x17')](_0x470bc3);}return _0x31e049['status'](_0x470bc3)[_0xae52('0x18')]();};}function respondWithResult(_0x35c20e,_0x3bf674){_0x3bf674=_0x3bf674||0xc8;return function(_0x214250){if(_0x214250){return _0x35c20e[_0xae52('0x19')](_0x3bf674)[_0xae52('0x1a')](_0x214250);}};}function respondWithFilteredResult(_0x2c077e,_0xd8da6f){return function(_0x3cf0ab){if(_0x3cf0ab){var _0x2ea11b=_0x3cf0ab[_0xae52('0x1b')],_0x14f16f=_0xd8da6f['offset'],_0x42d53d=_0xd8da6f['offset']+_0xd8da6f[_0xae52('0x1c')],_0x31ce3e;if(_0x42d53d>=_0x2ea11b){_0x42d53d=_0x2ea11b;_0x31ce3e=0xc8;}else{_0x31ce3e=0xce;}_0x2c077e[_0xae52('0x19')](_0x31ce3e);return _0x2c077e[_0xae52('0x1d')](_0xae52('0x1e'),_0x14f16f+'-'+_0x42d53d+'/'+_0x2ea11b)['json'](_0x3cf0ab);}return null;};}function patchUpdates(_0x217465){return function(_0xb82b6f){try{jsonpatch[_0xae52('0x1f')](_0xb82b6f,_0x217465,!![]);}catch(_0x1e13c5){return BPromise['reject'](_0x1e13c5);}return _0xb82b6f[_0xae52('0x20')]();};}function saveUpdates(_0x318333,_0x94140b){return function(_0x32db7c){if(_0x32db7c){return _0x32db7c[_0xae52('0x21')](_0x318333)[_0xae52('0x22')](function(_0x3a702c){return _0x3a702c;});}return null;};}function removeEntity(_0x2a8a6c,_0x4868cf){return function(_0x1a8394){if(_0x1a8394){return _0x1a8394[_0xae52('0x23')]()[_0xae52('0x22')](function(){_0x2a8a6c[_0xae52('0x19')](0xcc)[_0xae52('0x18')]();});}};}function handleEntityNotFound(_0xbab4ed,_0x520b19){return function(_0x5903ae){if(!_0x5903ae){_0xbab4ed[_0xae52('0x17')](0x194);}return _0x5903ae;};}function handleError(_0x21802e,_0x21496a){_0x21496a=_0x21496a||0x1f4;return function(_0x3c703d){logger[_0xae52('0x24')](_0x3c703d[_0xae52('0x25')]);if(_0x3c703d['name']){delete _0x3c703d[_0xae52('0x26')];}_0x21802e[_0xae52('0x19')](_0x21496a)['send'](_0x3c703d);};}exports[_0xae52('0x27')]=function(_0x1fd9ec,_0x3162e7){var _0x33e40b={},_0x2de25f={},_0x33eddc={'count':0x0,'rows':[]};var _0x4a13bd=_['map'](db[_0xae52('0x28')]['rawAttributes'],function(_0x49eb68){return{'name':_0x49eb68[_0xae52('0x29')],'type':_0x49eb68[_0xae52('0x2a')][_0xae52('0x2b')]};});_0x2de25f[_0xae52('0x2c')]=_[_0xae52('0x2d')](_0x4a13bd,_0xae52('0x26'));_0x2de25f[_0xae52('0x2e')]=_['keys'](_0x1fd9ec[_0xae52('0x2e')]);_0x2de25f['filters']=_[_0xae52('0x2f')](_0x2de25f[_0xae52('0x2c')],_0x2de25f['query']);_0x33e40b[_0xae52('0x30')]=_[_0xae52('0x2f')](_0x2de25f[_0xae52('0x2c')],qs[_0xae52('0x31')](_0x1fd9ec[_0xae52('0x2e')][_0xae52('0x31')]));_0x33e40b[_0xae52('0x30')]=_0x33e40b[_0xae52('0x30')][_0xae52('0x32')]?_0x33e40b[_0xae52('0x30')]:_0x2de25f[_0xae52('0x2c')];if(!_0x1fd9ec[_0xae52('0x2e')][_0xae52('0x33')](_0xae52('0x34'))){_0x33e40b['limit']=qs['limit'](_0x1fd9ec[_0xae52('0x2e')]['limit']);_0x33e40b[_0xae52('0x35')]=qs[_0xae52('0x35')](_0x1fd9ec[_0xae52('0x2e')]['offset']);}_0x33e40b['order']=qs[_0xae52('0x36')](_0x1fd9ec[_0xae52('0x2e')]['sort']);_0x33e40b[_0xae52('0x37')]=qs[_0xae52('0x38')](_[_0xae52('0x39')](_0x1fd9ec[_0xae52('0x2e')],_0x2de25f[_0xae52('0x38')]),_0x4a13bd);if(_0x1fd9ec[_0xae52('0x2e')][_0xae52('0x3a')]){_0x33e40b[_0xae52('0x37')]=_[_0xae52('0x3b')](_0x33e40b[_0xae52('0x37')],{'$or':_['map'](_0x4a13bd,function(_0xd8a584){if(_0xd8a584['type']!==_0xae52('0x3c')){var _0x78dfc4={};_0x78dfc4[_0xd8a584[_0xae52('0x26')]]={'$like':'%'+_0x1fd9ec['query'][_0xae52('0x3a')]+'%'};return _0x78dfc4;}})});}_0x33e40b=_[_0xae52('0x3b')]({},_0x33e40b,_0x1fd9ec['options']);var _0x255974={'where':_0x33e40b['where']};return db[_0xae52('0x28')][_0xae52('0x1b')](_0x255974)['then'](function(_0x1a6f1b){_0x33eddc[_0xae52('0x1b')]=_0x1a6f1b;if(_0x1fd9ec[_0xae52('0x2e')][_0xae52('0x3d')]){_0x33e40b[_0xae52('0x3e')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0xae52('0x3f')](_0x33e40b);})[_0xae52('0x22')](function(_0x15cbdc){_0x33eddc[_0xae52('0x40')]=_0x15cbdc;return _0x33eddc;})[_0xae52('0x22')](respondWithFilteredResult(_0x3162e7,_0x33e40b))['catch'](handleError(_0x3162e7,null));};exports[_0xae52('0x41')]=function(_0x184fea,_0x36d61a){var _0x49b20a={'raw':!![],'where':{'id':_0x184fea[_0xae52('0x42')]['id']}},_0x26d414={};_0x26d414[_0xae52('0x2c')]=_[_0xae52('0x43')](db[_0xae52('0x28')][_0xae52('0x44')]);_0x26d414['query']=_[_0xae52('0x43')](_0x184fea[_0xae52('0x2e')]);_0x26d414[_0xae52('0x38')]=_['intersection'](_0x26d414[_0xae52('0x2c')],_0x26d414[_0xae52('0x2e')]);_0x49b20a[_0xae52('0x30')]=_['intersection'](_0x26d414[_0xae52('0x2c')],qs['fields'](_0x184fea[_0xae52('0x2e')][_0xae52('0x31')]));_0x49b20a['attributes']=_0x49b20a['attributes'][_0xae52('0x32')]?_0x49b20a[_0xae52('0x30')]:_0x26d414[_0xae52('0x2c')];if(_0x184fea[_0xae52('0x2e')][_0xae52('0x3d')]){_0x49b20a[_0xae52('0x3e')]=[{'all':!![]}];}_0x49b20a=_[_0xae52('0x3b')]({},_0x49b20a,_0x184fea[_0xae52('0x45')]);return db['JscriptyAnswerReport']['find'](_0x49b20a)[_0xae52('0x22')](handleEntityNotFound(_0x36d61a,null))[_0xae52('0x22')](respondWithResult(_0x36d61a,null))[_0xae52('0x46')](handleError(_0x36d61a,null));};exports[_0xae52('0x47')]=function(_0x2349be,_0x20edab){return db['JscriptyAnswerReport'][_0xae52('0x47')](_0x2349be[_0xae52('0x48')],{})[_0xae52('0x22')](respondWithResult(_0x20edab,0xc9))[_0xae52('0x46')](handleError(_0x20edab,null));};exports['update']=function(_0x23ccf0,_0x4a61de){if(_0x23ccf0[_0xae52('0x48')]['id']){delete _0x23ccf0[_0xae52('0x48')]['id'];}return db[_0xae52('0x28')]['find']({'where':{'id':_0x23ccf0[_0xae52('0x42')]['id']}})['then'](handleEntityNotFound(_0x4a61de,null))[_0xae52('0x22')](saveUpdates(_0x23ccf0['body'],null))['then'](respondWithResult(_0x4a61de,null))[_0xae52('0x46')](handleError(_0x4a61de,null));};exports['destroy']=function(_0x562f9e,_0x53366e){return db[_0xae52('0x28')]['find']({'where':{'id':_0x562f9e[_0xae52('0x42')]['id']}})[_0xae52('0x22')](handleEntityNotFound(_0x53366e,null))['then'](removeEntity(_0x53366e,null))['catch'](handleError(_0x53366e,null));};exports[_0xae52('0x49')]=function(_0x1de65d,_0x2008b8){return db[_0xae52('0x28')][_0xae52('0x49')]()[_0xae52('0x22')](respondWithResult(_0x2008b8,null))[_0xae52('0x46')](handleError(_0x2008b8,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 771da84..5f91b27 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 _0xf19f=['../../config/environment','./jscriptyAnswerReport.attributes','exports','define','JscriptyAnswerReport','report_jscripty_answers','lodash','util','../../config/logger','moment','request-promise','path','rimraf'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0xf19f,0x18c));var _0xff19=function(_0x3e5bc8,_0x457d89){_0x3e5bc8=_0x3e5bc8-0x0;var _0xfd84bc=_0xf19f[_0x3e5bc8];return _0xfd84bc;};'use strict';var _=require(_0xff19('0x0'));var util=require(_0xff19('0x1'));var logger=require(_0xff19('0x2'))('api');var moment=require(_0xff19('0x3'));var BPromise=require('bluebird');var rp=require(_0xff19('0x4'));var fs=require('fs');var path=require(_0xff19('0x5'));var rimraf=require(_0xff19('0x6'));var config=require(_0xff19('0x7'));var attributes=require(_0xff19('0x8'));module[_0xff19('0x9')]=function(_0x2687be,_0x481689){return _0x2687be[_0xff19('0xa')](_0xff19('0xb'),attributes,{'tableName':_0xff19('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x97cf=['moment','request-promise','path','./jscriptyAnswerReport.attributes','exports','define','report_jscripty_answers','util','../../config/logger'];(function(_0x2e89c1,_0x36b7a5){var _0x5001aa=function(_0x2e495d){while(--_0x2e495d){_0x2e89c1['push'](_0x2e89c1['shift']());}};_0x5001aa(++_0x36b7a5);}(_0x97cf,0x8e));var _0xf97c=function(_0x1abafe,_0x572047){_0x1abafe=_0x1abafe-0x0;var _0x4fae5a=_0x97cf[_0x1abafe];return _0x4fae5a;};'use strict';var _=require('lodash');var util=require(_0xf97c('0x0'));var logger=require(_0xf97c('0x1'))('api');var moment=require(_0xf97c('0x2'));var BPromise=require('bluebird');var rp=require(_0xf97c('0x3'));var fs=require('fs');var path=require(_0xf97c('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf97c('0x5'));module[_0xf97c('0x6')]=function(_0x540c2f,_0x495be7){return _0x540c2f[_0xf97c('0x7')]('JscriptyAnswerReport',attributes,{'tableName':_0xf97c('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 c1022af..b4207b7 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 _0x461f=['JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info'];(function(_0x5366c7,_0x10430b){var _0x3022cf=function(_0x484bfc){while(--_0x484bfc){_0x5366c7['push'](_0x5366c7['shift']());}};_0x3022cf(++_0x10430b);}(_0x461f,0x198));var _0xf461=function(_0x250071,_0x301941){_0x250071=_0x250071-0x0;var _0x34e574=_0x461f[_0x250071];return _0x34e574;};'use strict';var _=require('lodash');var util=require(_0xf461('0x0'));var moment=require('moment');var BPromise=require(_0xf461('0x1'));var rs=require(_0xf461('0x2'));var fs=require('fs');var Redis=require(_0xf461('0x3'));var db=require(_0xf461('0x4'))['db'];var utils=require(_0xf461('0x5'));var logger=require(_0xf461('0x6'))(_0xf461('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf461('0x8')][_0xf461('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x16d91e,_0x5a8918,_0x2f93d1){return new BPromise(function(_0x36a52c,_0x23d66f){return client['request'](_0x16d91e,_0x2f93d1)[_0xf461('0xa')](function(_0x1c03ad){logger[_0xf461('0xb')](_0xf461('0xc'),_0x5a8918,_0xf461('0xd'));logger[_0xf461('0xe')]('JscriptyAnswerReport,\x20%s,\x20%s,\x20%s',_0x5a8918,_0xf461('0xd'),JSON[_0xf461('0xf')](_0x1c03ad));if(_0x1c03ad['error']){if(_0x1c03ad['error'][_0xf461('0x10')]===0x1f4){logger['error'](_0xf461('0xc'),_0x5a8918,_0x1c03ad[_0xf461('0x11')]['message']);return _0x23d66f(_0x1c03ad[_0xf461('0x11')]['message']);}logger['error'](_0xf461('0xc'),_0x5a8918,_0x1c03ad[_0xf461('0x11')][_0xf461('0x12')]);return _0x36a52c(_0x1c03ad[_0xf461('0x11')]['message']);}else{logger[_0xf461('0xb')](_0xf461('0xc'),_0x5a8918,_0xf461('0xd'));_0x36a52c(_0x1c03ad[_0xf461('0x13')][_0xf461('0x12')]);}})[_0xf461('0x14')](function(_0x5d061c){logger[_0xf461('0x11')](_0xf461('0xc'),_0x5a8918,_0x5d061c);_0x23d66f(_0x5d061c);});});} \ No newline at end of file +var _0x7bbd=['request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','error','code','JscriptyAnswerReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','request','info'];(function(_0x4d0979,_0x5b79ea){var _0x415cf3=function(_0x29032c){while(--_0x29032c){_0x4d0979['push'](_0x4d0979['shift']());}};_0x415cf3(++_0x5b79ea);}(_0x7bbd,0xf0));var _0xd7bb=function(_0x4059ee,_0x201b9a){_0x4059ee=_0x4059ee-0x0;var _0x210bfd=_0x7bbd[_0x4059ee];return _0x210bfd;};'use strict';var _=require(_0xd7bb('0x0'));var util=require(_0xd7bb('0x1'));var moment=require(_0xd7bb('0x2'));var BPromise=require(_0xd7bb('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd7bb('0x4'));var db=require(_0xd7bb('0x5'))['db'];var utils=require(_0xd7bb('0x6'));var logger=require(_0xd7bb('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd7bb('0x8')][_0xd7bb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x25115f,_0x3fb52e,_0x2e81ec){return new BPromise(function(_0xffde0,_0x58945c){return client[_0xd7bb('0xa')](_0x25115f,_0x2e81ec)['then'](function(_0x42a44f){logger[_0xd7bb('0xb')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x3fb52e,_0xd7bb('0xc'));logger[_0xd7bb('0xd')](_0xd7bb('0xe'),_0x3fb52e,_0xd7bb('0xc'),JSON['stringify'](_0x42a44f));if(_0x42a44f['error']){if(_0x42a44f[_0xd7bb('0xf')][_0xd7bb('0x10')]===0x1f4){logger[_0xd7bb('0xf')](_0xd7bb('0x11'),_0x3fb52e,_0x42a44f[_0xd7bb('0xf')][_0xd7bb('0x12')]);return _0x58945c(_0x42a44f[_0xd7bb('0xf')][_0xd7bb('0x12')]);}logger['error'](_0xd7bb('0x11'),_0x3fb52e,_0x42a44f[_0xd7bb('0xf')][_0xd7bb('0x12')]);return _0xffde0(_0x42a44f[_0xd7bb('0xf')][_0xd7bb('0x12')]);}else{logger[_0xd7bb('0xb')](_0xd7bb('0x11'),_0x3fb52e,_0xd7bb('0xc'));_0xffde0(_0x42a44f[_0xd7bb('0x13')][_0xd7bb('0x12')]);}})[_0xd7bb('0x14')](function(_0x1dd0ef){logger[_0xd7bb('0xf')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x3fb52e,_0x1dd0ef);_0x58945c(_0x1dd0ef);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 6e6a0ff..4272323 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 _0x36be=['30s','getSummary','create','clone','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','getSessions','/:id/summary'];(function(_0x485381,_0x4713fd){var _0x1f2550=function(_0x941e64){while(--_0x941e64){_0x485381['push'](_0x485381['shift']());}};_0x1f2550(++_0x4713fd);}(_0x36be,0x198));var _0xe36b=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x36be[_0x4b369d];return _0x571a98;};'use strict';var multer=require(_0xe36b('0x0'));var util=require(_0xe36b('0x1'));var path=require('path');var timeout=require(_0xe36b('0x2'));var express=require(_0xe36b('0x3'));var router=express[_0xe36b('0x4')]();var auth=require(_0xe36b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xe36b('0x6'));var controller=require('./jscriptyProject.controller');router[_0xe36b('0x7')]('/',auth[_0xe36b('0x8')](),controller[_0xe36b('0x9')]);router[_0xe36b('0x7')]('/:id',auth[_0xe36b('0x8')](),controller['show']);router[_0xe36b('0x7')]('/:id/sessions',auth['isAuthenticated'](),controller[_0xe36b('0xa')]);router[_0xe36b('0x7')]('/:id/answers',auth['isAuthenticated'](),controller['getAnswers']);router[_0xe36b('0x7')](_0xe36b('0xb'),auth['isAuthenticated'](),timeout(_0xe36b('0xc')),controller[_0xe36b('0xd')]);router['post']('/',auth[_0xe36b('0x8')](),controller[_0xe36b('0xe')]);router['post']('/:id/clone',auth['isAuthenticated'](),controller[_0xe36b('0xf')]);router['put'](_0xe36b('0x10'),auth[_0xe36b('0x8')](),controller[_0xe36b('0x11')]);router[_0xe36b('0x12')](_0xe36b('0x10'),auth[_0xe36b('0x8')](),controller[_0xe36b('0x13')]);module[_0xe36b('0x14')]=router; \ No newline at end of file +var _0x5325=['show','/:id/sessions','/:id/answers','getAnswers','/:id/summary','30s','getSummary','post','create','clone','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./jscriptyProject.controller','get','isAuthenticated','index','/:id'];(function(_0x12c86a,_0x48039c){var _0x75e5fe=function(_0x54ad97){while(--_0x54ad97){_0x12c86a['push'](_0x12c86a['shift']());}};_0x75e5fe(++_0x48039c);}(_0x5325,0x1bf));var _0x5532=function(_0x14b680,_0x1279cf){_0x14b680=_0x14b680-0x0;var _0x4782ff=_0x5325[_0x14b680];return _0x4782ff;};'use strict';var multer=require(_0x5532('0x0'));var util=require('util');var path=require(_0x5532('0x1'));var timeout=require(_0x5532('0x2'));var express=require(_0x5532('0x3'));var router=express[_0x5532('0x4')]();var auth=require(_0x5532('0x5'));var interaction=require(_0x5532('0x6'));var config=require('../../config/environment');var controller=require(_0x5532('0x7'));router[_0x5532('0x8')]('/',auth[_0x5532('0x9')](),controller[_0x5532('0xa')]);router[_0x5532('0x8')](_0x5532('0xb'),auth[_0x5532('0x9')](),controller[_0x5532('0xc')]);router[_0x5532('0x8')](_0x5532('0xd'),auth[_0x5532('0x9')](),controller['getSessions']);router['get'](_0x5532('0xe'),auth['isAuthenticated'](),controller[_0x5532('0xf')]);router[_0x5532('0x8')](_0x5532('0x10'),auth[_0x5532('0x9')](),timeout(_0x5532('0x11')),controller[_0x5532('0x12')]);router[_0x5532('0x13')]('/',auth[_0x5532('0x9')](),controller[_0x5532('0x14')]);router[_0x5532('0x13')]('/:id/clone',auth[_0x5532('0x9')](),controller[_0x5532('0x15')]);router[_0x5532('0x16')](_0x5532('0xb'),auth[_0x5532('0x9')](),controller[_0x5532('0x17')]);router[_0x5532('0x18')](_0x5532('0xb'),auth['isAuthenticated'](),controller[_0x5532('0x19')]);module[_0x5532('0x1a')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 490fa19..ecb47ed 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 _0x200e=['setDataValue','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','util','exports','STRING','name','TEXT','long','isObjectLike','formData','isString'];(function(_0x26d993,_0x559ddb){var _0x1807e0=function(_0xa71bbb){while(--_0xa71bbb){_0x26d993['push'](_0x26d993['shift']());}};_0x1807e0(++_0x559ddb);}(_0x200e,0x1ef));var _0xe200=function(_0x2f2b55,_0x474fa2){_0x2f2b55=_0x2f2b55-0x0;var _0x4060cb=_0x200e[_0x2f2b55];return _0x4060cb;};'use strict';var Sequelize=require('sequelize');var _=require('lodash');var util=require(_0xe200('0x0'));module[_0xe200('0x1')]={'name':{'type':Sequelize[_0xe200('0x2')],'unique':_0xe200('0x3')},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0xe200('0x4')](_0xe200('0x5')),'set':function(_0x1a3945){if(_[_0xe200('0x6')](_0x1a3945)){this['setDataValue'](_0xe200('0x7'),JSON['stringify'](_0x1a3945));}else if(_[_0xe200('0x8')](_0x1a3945)){this[_0xe200('0x9')]('formData',_0x1a3945);}else{this[_0xe200('0x9')](_0xe200('0x7'),util[_0xe200('0xa')](_0xe200('0xb'),this['getDataValue'](_0xe200('0x3'))||'',this['getDataValue']('description')||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xad73=['formData','stringify','isString','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','name','getDataValue','description','BOOLEAN','sequelize','lodash','util','STRING','long','isObjectLike','setDataValue'];(function(_0x24f19d,_0x1c6940){var _0x45462e=function(_0x3e2d45){while(--_0x3e2d45){_0x24f19d['push'](_0x24f19d['shift']());}};_0x45462e(++_0x1c6940);}(_0xad73,0x1c9));var _0x3ad7=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xad73[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x3ad7('0x0'));var _=require(_0x3ad7('0x1'));var util=require(_0x3ad7('0x2'));module['exports']={'name':{'type':Sequelize[_0x3ad7('0x3')],'unique':'name'},'description':{'type':Sequelize[_0x3ad7('0x3')]},'formData':{'type':Sequelize['TEXT'](_0x3ad7('0x4')),'set':function(_0x5435aa){if(_[_0x3ad7('0x5')](_0x5435aa)){this[_0x3ad7('0x6')](_0x3ad7('0x7'),JSON[_0x3ad7('0x8')](_0x5435aa));}else if(_[_0x3ad7('0x9')](_0x5435aa)){this['setDataValue'](_0x3ad7('0x7'),_0x5435aa);}else{this['setDataValue']('formData',util[_0x3ad7('0xa')](_0x3ad7('0xb'),this['getDataValue'](_0x3ad7('0xc'))||'',this[_0x3ad7('0xd')](_0x3ad7('0xe'))||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x3ad7('0xf')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index 701059b..1358d03 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 _0x2416=['html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','update','then','destroy','get','UserProfileResource','end','error','name','send','JscriptyProject','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Projects','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','options','omit','updatedAt','getSessions','JscriptySessionReport','ProjectId','map','findOne','JscriptyAnswerReport','number','toString','indexOf','getSummary','startTime','starttime','parse','-createdAt','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','isEmpty','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type'];(function(_0xb8fdcf,_0x4257fe){var _0x46da7e=function(_0x4e9e2a){while(--_0x4e9e2a){_0xb8fdcf['push'](_0xb8fdcf['shift']());}};_0x46da7e(++_0x4257fe);}(_0x2416,0x72));var _0x6241=function(_0x38cec3,_0x45da59){_0x38cec3=_0x38cec3-0x0;var _0x774574=_0x2416[_0x38cec3];return _0x774574;};'use strict';var pdf=require(_0x6241('0x0'));var emlformat=require(_0x6241('0x1'));var rimraf=require(_0x6241('0x2'));var zipdir=require(_0x6241('0x3'));var jsonpatch=require(_0x6241('0x4'));var rp=require(_0x6241('0x5'));var moment=require(_0x6241('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x6241('0x7'));var util=require('util');var path=require(_0x6241('0x8'));var sox=require(_0x6241('0x9'));var csv=require(_0x6241('0xa'));var ejs=require(_0x6241('0xb'));var fs=require('fs');var _=require(_0x6241('0xc'));var squel=require(_0x6241('0xd'));var crypto=require(_0x6241('0xe'));var jsforce=require(_0x6241('0xf'));var deskjs=require(_0x6241('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x6241('0x11'));var authService=require(_0x6241('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x6241('0x13'));var hardwareService=require(_0x6241('0x14'));var logger=require(_0x6241('0x15'))('api');var utils=require(_0x6241('0x16'));var config=require(_0x6241('0x17'));var db=require(_0x6241('0x18'))['db'];function respondWithStatusCode(_0x297bd0,_0x228750){_0x228750=_0x228750||0xcc;return function(_0x20dc13){if(_0x20dc13){return _0x297bd0[_0x6241('0x19')](_0x228750);}return _0x297bd0[_0x6241('0x1a')](_0x228750)['end']();};}function respondWithResult(_0x349684,_0x129b28){_0x129b28=_0x129b28||0xc8;return function(_0x37e729){if(_0x37e729){return _0x349684['status'](_0x129b28)[_0x6241('0x1b')](_0x37e729);}};}function respondWithFilteredResult(_0x277225,_0x2e7f48){return function(_0x136fc1){if(_0x136fc1){var _0x558712=_0x136fc1[_0x6241('0x1c')],_0x1655d3=_0x2e7f48[_0x6241('0x1d')],_0x404d5a=_0x2e7f48[_0x6241('0x1d')]+_0x2e7f48[_0x6241('0x1e')],_0x3295dc;if(_0x404d5a>=_0x558712){_0x404d5a=_0x558712;_0x3295dc=0xc8;}else{_0x3295dc=0xce;}_0x277225['status'](_0x3295dc);return _0x277225[_0x6241('0x1f')](_0x6241('0x20'),_0x1655d3+'-'+_0x404d5a+'/'+_0x558712)[_0x6241('0x1b')](_0x136fc1);}return null;};}function patchUpdates(_0x50573f){return function(_0x4ddfae){try{jsonpatch[_0x6241('0x21')](_0x4ddfae,_0x50573f,!![]);}catch(_0x3f9d40){return BPromise['reject'](_0x3f9d40);}return _0x4ddfae['save']();};}function saveUpdates(_0x46456c,_0x22118e){return function(_0x3e68df){if(_0x3e68df){return _0x3e68df[_0x6241('0x22')](_0x46456c)[_0x6241('0x23')](function(_0x2bac9e){return _0x2bac9e;});}return null;};}function removeEntity(_0x2032e6,_0x47be8d){return function(_0x3d44ea){if(_0x3d44ea){return _0x3d44ea[_0x6241('0x24')]()[_0x6241('0x23')](function(){var _0x18ae8f=_0x3d44ea[_0x6241('0x25')]({'plain':!![]});var _0x52f3eb='Projects';return db[_0x6241('0x26')][_0x6241('0x24')]({'where':{'type':_0x52f3eb,'resourceId':_0x18ae8f['id']}})[_0x6241('0x23')](function(){return _0x3d44ea;});})[_0x6241('0x23')](function(){_0x2032e6[_0x6241('0x1a')](0xcc)[_0x6241('0x27')]();});}};}function handleEntityNotFound(_0x28199a,_0x12e819){return function(_0x4f1c7d){if(!_0x4f1c7d){_0x28199a[_0x6241('0x19')](0x194);}return _0x4f1c7d;};}function handleError(_0x178616,_0xe68382){_0xe68382=_0xe68382||0x1f4;return function(_0x372a43){logger[_0x6241('0x28')](_0x372a43['stack']);if(_0x372a43[_0x6241('0x29')]){delete _0x372a43[_0x6241('0x29')];}_0x178616[_0x6241('0x1a')](_0xe68382)[_0x6241('0x2a')](_0x372a43);};}exports['index']=function(_0x2783c3,_0x382249){var _0x192b4f={},_0x3f858a={},_0x3373ab={'count':0x0,'rows':[]};var _0x430c87=_['map'](db[_0x6241('0x2b')][_0x6241('0x2c')],function(_0xc15a41){return{'name':_0xc15a41['fieldName'],'type':_0xc15a41[_0x6241('0x2d')][_0x6241('0x2e')]};});_0x3f858a[_0x6241('0x2f')]=_['map'](_0x430c87,_0x6241('0x29'));_0x3f858a[_0x6241('0x30')]=_[_0x6241('0x31')](_0x2783c3[_0x6241('0x30')]);_0x3f858a[_0x6241('0x32')]=_[_0x6241('0x33')](_0x3f858a[_0x6241('0x2f')],_0x3f858a[_0x6241('0x30')]);_0x192b4f[_0x6241('0x34')]=_[_0x6241('0x33')](_0x3f858a[_0x6241('0x2f')],qs[_0x6241('0x35')](_0x2783c3[_0x6241('0x30')][_0x6241('0x35')]));_0x192b4f['attributes']=_0x192b4f[_0x6241('0x34')][_0x6241('0x36')]?_0x192b4f[_0x6241('0x34')]:_0x3f858a[_0x6241('0x2f')];if(!_0x2783c3[_0x6241('0x30')][_0x6241('0x37')](_0x6241('0x38'))){_0x192b4f[_0x6241('0x1e')]=qs[_0x6241('0x1e')](_0x2783c3[_0x6241('0x30')][_0x6241('0x1e')]);_0x192b4f[_0x6241('0x1d')]=qs['offset'](_0x2783c3[_0x6241('0x30')][_0x6241('0x1d')]);}_0x192b4f[_0x6241('0x39')]=qs[_0x6241('0x3a')](_0x2783c3['query'][_0x6241('0x3a')]);_0x192b4f[_0x6241('0x3b')]=qs[_0x6241('0x32')](_[_0x6241('0x3c')](_0x2783c3[_0x6241('0x30')],_0x3f858a[_0x6241('0x32')]),_0x430c87);if(_0x2783c3[_0x6241('0x30')][_0x6241('0x3d')]){_0x192b4f[_0x6241('0x3b')]=_[_0x6241('0x3e')](_0x192b4f[_0x6241('0x3b')],{'$or':_['map'](_0x430c87,function(_0x5e70c1){if(_0x5e70c1[_0x6241('0x2d')]!==_0x6241('0x3f')){var _0x4a19e0={};_0x4a19e0[_0x5e70c1[_0x6241('0x29')]]={'$like':'%'+_0x2783c3[_0x6241('0x30')][_0x6241('0x3d')]+'%'};return _0x4a19e0;}})});}_0x192b4f=_['merge']({},_0x192b4f,_0x2783c3['options']);var _0x12f8aa={'where':_0x192b4f['where']};return db[_0x6241('0x2b')][_0x6241('0x1c')](_0x12f8aa)[_0x6241('0x23')](function(_0x35508a){_0x3373ab['count']=_0x35508a;if(_0x2783c3[_0x6241('0x30')][_0x6241('0x40')]){_0x192b4f[_0x6241('0x41')]=[{'all':!![]}];}return db[_0x6241('0x2b')][_0x6241('0x42')](_0x192b4f);})[_0x6241('0x23')](function(_0x44d6bd){_0x3373ab[_0x6241('0x43')]=_0x44d6bd;return _0x3373ab;})['then'](respondWithFilteredResult(_0x382249,_0x192b4f))[_0x6241('0x44')](handleError(_0x382249,null));};exports['show']=function(_0x43821e,_0x5e8238){var _0x198ceb={'raw':![],'where':{'id':_0x43821e[_0x6241('0x45')]['id']}},_0xf6131b={};_0xf6131b[_0x6241('0x2f')]=_[_0x6241('0x31')](db[_0x6241('0x2b')][_0x6241('0x2c')]);_0xf6131b[_0x6241('0x30')]=_[_0x6241('0x31')](_0x43821e['query']);_0xf6131b['filters']=_[_0x6241('0x33')](_0xf6131b[_0x6241('0x2f')],_0xf6131b[_0x6241('0x30')]);_0x198ceb[_0x6241('0x34')]=_[_0x6241('0x33')](_0xf6131b['model'],qs[_0x6241('0x35')](_0x43821e[_0x6241('0x30')][_0x6241('0x35')]));_0x198ceb[_0x6241('0x34')]=_0x198ceb[_0x6241('0x34')][_0x6241('0x36')]?_0x198ceb[_0x6241('0x34')]:_0xf6131b[_0x6241('0x2f')];if(_0x43821e['query'][_0x6241('0x40')]){_0x198ceb[_0x6241('0x41')]=[{'all':!![]}];}_0x198ceb=_[_0x6241('0x3e')]({},_0x198ceb,_0x43821e['options']);return db[_0x6241('0x2b')][_0x6241('0x46')](_0x198ceb)[_0x6241('0x23')](handleEntityNotFound(_0x5e8238,null))[_0x6241('0x23')](respondWithResult(_0x5e8238,null))[_0x6241('0x44')](handleError(_0x5e8238,null));};exports['create']=function(_0x5df24e,_0x18ad47){return db[_0x6241('0x2b')][_0x6241('0x47')](_0x5df24e[_0x6241('0x48')],{})[_0x6241('0x23')](function(_0x1aa02d){var _0x265e9c=_0x5df24e[_0x6241('0x49')][_0x6241('0x25')]({'plain':!![]});if(!_0x265e9c)throw new Error(_0x6241('0x4a'));if(_0x265e9c[_0x6241('0x4b')]===_0x6241('0x49')){var _0x47136e=_0x1aa02d['get']({'plain':!![]});var _0x197eb5=_0x6241('0x4c');return db[_0x6241('0x4d')][_0x6241('0x46')]({'where':{'name':_0x197eb5,'userProfileId':_0x265e9c[_0x6241('0x4e')]},'raw':!![]})[_0x6241('0x23')](function(_0x127786){if(_0x127786&&_0x127786[_0x6241('0x4f')]===0x0){return db[_0x6241('0x26')][_0x6241('0x47')]({'name':_0x47136e['name'],'resourceId':_0x47136e['id'],'type':_0x127786[_0x6241('0x29')],'sectionId':_0x127786['id']},{})[_0x6241('0x23')](function(){return _0x1aa02d;});}else{return _0x1aa02d;}})[_0x6241('0x44')](function(_0xf63613){logger[_0x6241('0x28')](_0x6241('0x50'),_0xf63613);throw _0xf63613;});}return _0x1aa02d;})[_0x6241('0x23')](respondWithResult(_0x18ad47,0xc9))[_0x6241('0x44')](handleError(_0x18ad47,null));};exports['clone']=function(_0x3bcb66,_0x74842c){var _0xb3cf0c={'where':{'id':_0x3bcb66['params']['id']}},_0x13cbc7={};_0x13cbc7[_0x6241('0x2f')]=_[_0x6241('0x31')](db[_0x6241('0x2b')][_0x6241('0x2c')]);_0xb3cf0c['attributes']=_[_0x6241('0x33')](_0x13cbc7[_0x6241('0x2f')],qs['fields'](_0x3bcb66[_0x6241('0x30')][_0x6241('0x35')]));_0xb3cf0c[_0x6241('0x34')]=_0xb3cf0c[_0x6241('0x34')]['length']?_0xb3cf0c[_0x6241('0x34')]:_0x13cbc7['model'];if(_0x3bcb66[_0x6241('0x30')][_0x6241('0x40')]){_0xb3cf0c['include']=[{'all':!![]}];}_0xb3cf0c=_[_0x6241('0x3e')]({},_0xb3cf0c,_0x3bcb66[_0x6241('0x51')]);return db[_0x6241('0x2b')][_0x6241('0x46')](_0xb3cf0c)['then'](handleEntityNotFound(_0x74842c,null))[_0x6241('0x23')](function(_0x21e701){if(_0x21e701){var _0x3b2305=_0x21e701[_0x6241('0x25')]({'plain':!![]});_0x3b2305=qs[_0x6241('0x52')](_0x3b2305,['id','createdAt',_0x6241('0x53')]);_0x3bcb66[_0x6241('0x48')]=_[_0x6241('0x52')](_0x3bcb66[_0x6241('0x48')],['id','createdAt',_0x6241('0x53')]);return db[_0x6241('0x2b')]['create'](_[_0x6241('0x3e')](_0x3b2305,_0x3bcb66['body']),{'include':_0x3bcb66['query'][_0x6241('0x40')]?[{'all':!![]}]:undefined})[_0x6241('0x23')](function(_0x302abb){var _0x4d4aeb=_0x3bcb66[_0x6241('0x49')][_0x6241('0x25')]({'plain':!![]});if(!_0x4d4aeb)throw new Error(_0x6241('0x4a'));if(_0x4d4aeb[_0x6241('0x4b')]===_0x6241('0x49')){var _0xae26af=_0x302abb[_0x6241('0x25')]({'plain':!![]});var _0x5265cd=_0x6241('0x4c');return db['UserProfileSection']['find']({'where':{'name':_0x5265cd,'userProfileId':_0x4d4aeb[_0x6241('0x4e')]},'raw':!![]})[_0x6241('0x23')](function(_0x3e348a){if(_0x3e348a&&_0x3e348a[_0x6241('0x4f')]===0x0){return db[_0x6241('0x26')][_0x6241('0x47')]({'name':_0xae26af[_0x6241('0x29')],'resourceId':_0xae26af['id'],'type':_0x3e348a[_0x6241('0x29')],'sectionId':_0x3e348a['id']},{})[_0x6241('0x23')](function(){return _0x302abb;});}else{return _0x302abb;}})[_0x6241('0x44')](function(_0x5c71ce){logger[_0x6241('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5c71ce);throw _0x5c71ce;});}return _0x302abb;});}})[_0x6241('0x23')](respondWithResult(_0x74842c,0xc9))[_0x6241('0x44')](handleError(_0x74842c,null));};exports[_0x6241('0x22')]=function(_0xdda896,_0xa3fe8){if(_0xdda896['body']['id']){delete _0xdda896['body']['id'];}return db[_0x6241('0x2b')][_0x6241('0x46')]({'where':{'id':_0xdda896[_0x6241('0x45')]['id']}})[_0x6241('0x23')](handleEntityNotFound(_0xa3fe8,null))['then'](saveUpdates(_0xdda896[_0x6241('0x48')],null))['then'](respondWithResult(_0xa3fe8,null))[_0x6241('0x44')](handleError(_0xa3fe8,null));};exports[_0x6241('0x24')]=function(_0x18c1c2,_0x488db5){return db['JscriptyProject']['find']({'where':{'id':_0x18c1c2[_0x6241('0x45')]['id']}})[_0x6241('0x23')](handleEntityNotFound(_0x488db5,null))[_0x6241('0x23')](removeEntity(_0x488db5,null))[_0x6241('0x44')](handleError(_0x488db5,null));};exports[_0x6241('0x54')]=function(_0x2cec50,_0x5b7c1f,_0x35383a){var _0x17e793={'raw':!![],'where':{}};var _0x58d5d6={};var _0x52562c={'count':0x0,'rows':[]};return db[_0x6241('0x2b')]['findOne']({'where':{'id':_0x2cec50['params']['id']}})[_0x6241('0x23')](handleEntityNotFound(_0x5b7c1f,null))[_0x6241('0x23')](function(_0x2f462d){if(_0x2f462d){_0x58d5d6['model']=_[_0x6241('0x31')](db[_0x6241('0x55')]['rawAttributes']);_0x58d5d6['query']=_[_0x6241('0x31')](_0x2cec50[_0x6241('0x30')]);_0x58d5d6['filters']=_[_0x6241('0x33')](_0x58d5d6[_0x6241('0x2f')],_0x58d5d6['query']);_0x17e793['attributes']=_[_0x6241('0x33')](_0x58d5d6[_0x6241('0x2f')],qs[_0x6241('0x35')](_0x2cec50[_0x6241('0x30')][_0x6241('0x35')]));_0x17e793[_0x6241('0x34')]=_0x17e793[_0x6241('0x34')][_0x6241('0x36')]?_0x17e793[_0x6241('0x34')]:_0x58d5d6[_0x6241('0x2f')];if(!_0x2cec50[_0x6241('0x30')][_0x6241('0x37')]('nolimit')){_0x17e793[_0x6241('0x1e')]=qs[_0x6241('0x1e')](_0x2cec50['query'][_0x6241('0x1e')]);_0x17e793[_0x6241('0x1d')]=qs[_0x6241('0x1d')](_0x2cec50[_0x6241('0x30')][_0x6241('0x1d')]);}_0x17e793[_0x6241('0x39')]=qs['sort'](_0x2cec50['query']['sort']);_0x17e793['where']=qs[_0x6241('0x32')](_[_0x6241('0x3c')](_0x2cec50[_0x6241('0x30')],_0x58d5d6[_0x6241('0x32')]));_0x17e793[_0x6241('0x3b')][_0x6241('0x56')]=_0x2f462d['id'];if(_0x2cec50[_0x6241('0x30')][_0x6241('0x3d')]){_0x17e793[_0x6241('0x3b')]=_['merge'](_0x17e793[_0x6241('0x3b')],{'$or':_[_0x6241('0x57')](_0x17e793[_0x6241('0x34')],function(_0x37b0ed){var _0x31c713={};_0x31c713[_0x37b0ed]={'$like':'%'+_0x2cec50[_0x6241('0x30')][_0x6241('0x3d')]+'%'};return _0x31c713;})});}_0x17e793=_['merge']({},_0x17e793,_0x2cec50['options']);return db[_0x6241('0x55')][_0x6241('0x1c')]({'where':_0x17e793[_0x6241('0x3b')]})['then'](function(_0x5ba60c){_0x52562c[_0x6241('0x1c')]=_0x5ba60c;if(_0x2cec50[_0x6241('0x30')][_0x6241('0x40')]){_0x17e793[_0x6241('0x41')]=[{'all':!![]}];}return db[_0x6241('0x55')]['findAll'](_0x17e793);})[_0x6241('0x23')](function(_0x56bf7a){_0x52562c[_0x6241('0x43')]=_0x56bf7a;return _0x52562c;});}})[_0x6241('0x23')](respondWithFilteredResult(_0x5b7c1f,_0x17e793))[_0x6241('0x44')](handleError(_0x5b7c1f,null));};exports['getAnswers']=function(_0x5a566f,_0x572009,_0x3dae07){var _0x4d7018={'raw':!![],'where':{}};var _0x4af564={};var _0x2c13ae={'count':0x0,'rows':[]};return db[_0x6241('0x2b')][_0x6241('0x58')]({'where':{'id':_0x5a566f['params']['id']}})['then'](handleEntityNotFound(_0x572009,null))[_0x6241('0x23')](function(_0x156430){if(_0x156430){_0x4af564['model']=_[_0x6241('0x31')](db['JscriptyAnswerReport'][_0x6241('0x2c')]);_0x4af564[_0x6241('0x30')]=_[_0x6241('0x31')](_0x5a566f[_0x6241('0x30')]);_0x4af564['filters']=_[_0x6241('0x33')](_0x4af564[_0x6241('0x2f')],_0x4af564[_0x6241('0x30')]);_0x4d7018[_0x6241('0x34')]=_[_0x6241('0x33')](_0x4af564['model'],qs[_0x6241('0x35')](_0x5a566f['query'][_0x6241('0x35')]));_0x4d7018['attributes']=_0x4d7018[_0x6241('0x34')][_0x6241('0x36')]?_0x4d7018['attributes']:_0x4af564[_0x6241('0x2f')];if(!_0x5a566f[_0x6241('0x30')][_0x6241('0x37')](_0x6241('0x38'))){_0x4d7018['limit']=qs[_0x6241('0x1e')](_0x5a566f[_0x6241('0x30')][_0x6241('0x1e')]);_0x4d7018[_0x6241('0x1d')]=qs[_0x6241('0x1d')](_0x5a566f['query'][_0x6241('0x1d')]);}_0x4d7018[_0x6241('0x39')]=qs[_0x6241('0x3a')](_0x5a566f[_0x6241('0x30')][_0x6241('0x3a')]);_0x4d7018[_0x6241('0x3b')]=qs[_0x6241('0x32')](_[_0x6241('0x3c')](_0x5a566f['query'],_0x4af564[_0x6241('0x32')]));_0x4d7018[_0x6241('0x3b')]['ProjectId']=_0x156430['id'];if(_0x5a566f[_0x6241('0x30')]['filter']){_0x4d7018[_0x6241('0x3b')]=_['merge'](_0x4d7018[_0x6241('0x3b')],{'$or':_[_0x6241('0x57')](_0x4d7018[_0x6241('0x34')],function(_0x4568c9){var _0x490dda={};_0x490dda[_0x4568c9]={'$like':'%'+_0x5a566f[_0x6241('0x30')][_0x6241('0x3d')]+'%'};return _0x490dda;})});}_0x4d7018=_[_0x6241('0x3e')]({},_0x4d7018,_0x5a566f['options']);return db[_0x6241('0x59')][_0x6241('0x1c')]({'where':_0x4d7018[_0x6241('0x3b')]})[_0x6241('0x23')](function(_0x40f8c7){_0x2c13ae['count']=_0x40f8c7;if(_0x5a566f[_0x6241('0x30')]['includeAll']){_0x4d7018['include']=[{'all':!![]}];}return db[_0x6241('0x59')][_0x6241('0x42')](_0x4d7018);})[_0x6241('0x23')](function(_0x19260b){_0x2c13ae['rows']=_0x19260b;return _0x2c13ae;});}})['then'](respondWithFilteredResult(_0x572009,_0x4d7018))[_0x6241('0x44')](handleError(_0x572009,null));};function char(_0x1e3b46){return _0x6241('0x5a')===typeof _0x1e3b46?String['fromCharCode']['apply'](null,arguments):_0x1e3b46;}function needsEncapsulation(_0x164994){return!!_0x164994&&(_0x164994[_0x6241('0x5b')]()[_0x6241('0x5c')](char(0xd))>=0x0||_0x164994[_0x6241('0x5b')]()[_0x6241('0x5c')](char(0xa))>=0x0||_0x164994[_0x6241('0x5b')]()['indexOf'](char(0x2c))>=0x0||_0x164994[_0x6241('0x5b')]()[_0x6241('0x5c')](char(0x22))>=0x0);}function encapsulate(_0x44c65e){var _0x335fca=char(0x22),_0x585075='\x5c'+char(0x22),_0x3d803b=_0x44c65e[_0x6241('0x5b')]()['replace'](new RegExp(_0x335fca,'g'),_0x585075);return _0x335fca+_0x3d803b+_0x335fca;}exports[_0x6241('0x5d')]=function(_0x5e4c7c,_0x460b2e,_0x238a97){var _0x202211,_0x359e45;var _0x406afb={'where':{'ProjectId':_0x5e4c7c[_0x6241('0x45')]['id']}};if(_0x5e4c7c[_0x6241('0x30')][_0x6241('0x5e')]){_0x406afb[_0x6241('0x3b')][_0x6241('0x5f')]=JSON[_0x6241('0x60')](_0x5e4c7c[_0x6241('0x30')][_0x6241('0x5e')]);}return db[_0x6241('0x55')][_0x6241('0x42')](_0x406afb)[_0x6241('0x23')](handleEntityNotFound(_0x460b2e,null))['then'](function(_0x527352){if(_0x527352){_0x202211=_0x527352;return db['JscriptyQuestionReport'][_0x6241('0x42')]({'where':{'SessionId':{'$in':_[_0x6241('0x57')](_0x202211,'id')},'ProjectId':_0x5e4c7c['params']['id']},'order':_0x6241('0x61')});}})[_0x6241('0x23')](handleEntityNotFound(_0x460b2e,null))[_0x6241('0x23')](function(_0x2f73e7){if(_0x2f73e7){_0x359e45=_0x2f73e7;var _0x57efc1={};for(var _0x1c4794=0x0,_0x47a885=_0x359e45[_0x6241('0x36')];_0x1c4794<_0x47a885;_0x1c4794++){if(!_0x57efc1[_0x6241('0x37')](_0x359e45[_0x1c4794]['questionId'])){_0x57efc1[_0x359e45[_0x1c4794][_0x6241('0x62')]]=needsEncapsulation(_0x359e45[_0x1c4794][_0x6241('0x63')])?encapsulate(_0x359e45[_0x1c4794][_0x6241('0x63')]):_0x359e45[_0x1c4794][_0x6241('0x63')];}}var _0x4a25d7=[],_0x3544ad={};for(var _0x35d5c7=0x0,_0x399b41=_0x202211[_0x6241('0x36')];_0x35d5c7<_0x399b41;_0x35d5c7++){_0x3544ad={'ProjectId':_0x5e4c7c[_0x6241('0x45')]['id'],'SessionId':_0x202211[_0x35d5c7]['id'],'StartTime':moment(_0x202211[_0x35d5c7][_0x6241('0x5f')])[_0x6241('0x64')](_0x6241('0x65'))};for(var _0x5d42ec=0x0,_0x3a714f=_0x359e45['length'];_0x5d42ec<_0x3a714f;_0x5d42ec++){if(_0x359e45[_0x5d42ec][_0x6241('0x66')]==_0x202211[_0x35d5c7]['id']&&_0x57efc1[_0x6241('0x37')](_0x359e45[_0x5d42ec][_0x6241('0x62')])){_0x3544ad[_0x57efc1[_0x359e45[_0x5d42ec][_0x6241('0x62')]]]=_0x359e45[_0x5d42ec][_0x6241('0x67')];}}for(var _0x33277e in _0x57efc1){if(!_0x3544ad[_0x6241('0x37')](_0x57efc1[_0x33277e])){_0x3544ad[_0x57efc1[_0x33277e]]=null;}}_0x4a25d7[_0x6241('0x68')](_0x3544ad);}return _0x4a25d7;}})['then'](function(_0x536c2f){if(!_[_0x6241('0x69')](_0x536c2f)){var _0x853ac2=toCsv(_0x536c2f);var _0x27ac34=Date[_0x6241('0x6a')]();fs[_0x6241('0x6b')](util[_0x6241('0x64')](_0x6241('0x6c'),_0x5e4c7c[_0x6241('0x45')]['id'],_0x27ac34),_0x853ac2);_0x460b2e[_0x6241('0x6d')](_0x6241('0x6e'),_0x6241('0x6f')+util[_0x6241('0x64')](_0x6241('0x70'),_0x5e4c7c[_0x6241('0x45')]['id'],_0x27ac34));_0x460b2e[_0x6241('0x6d')](_0x6241('0x71'),'text/csv');return _0x460b2e['download'](util[_0x6241('0x64')](_0x6241('0x6c'),_0x5e4c7c[_0x6241('0x45')]['id'],_0x27ac34));}else{return _0x460b2e[_0x6241('0x19')](0xcc);}})[_0x6241('0x44')](handleError(_0x460b2e,null));}; \ No newline at end of file +var _0x7550=['parse','JscriptyQuestionReport','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','questionId','isEmpty','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-type','text/csv','download','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','limit','set','Content-Range','save','destroy','then','get','Projects','UserProfileResource','error','stack','name','send','index','map','JscriptyProject','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','type','VIRTUAL','merge','count','include','findAll','rows','catch','show','params','includeAll','options','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','body','createdAt','user','role','update','getSessions','findOne','JscriptySessionReport','order','ProjectId','getAnswers','JscriptyAnswerReport','fromCharCode','apply','toString','indexOf','getSummary','startTime','starttime'];(function(_0x54535b,_0x53d3e6){var _0x5d9d17=function(_0x2fc402){while(--_0x2fc402){_0x54535b['push'](_0x54535b['shift']());}};_0x5d9d17(++_0x53d3e6);}(_0x7550,0xf9));var _0x0755=function(_0x166603,_0x2a8544){_0x166603=_0x166603-0x0;var _0x20922f=_0x7550[_0x166603];return _0x20922f;};'use strict';var pdf=require(_0x0755('0x0'));var emlformat=require(_0x0755('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x0755('0x2'));var jsonpatch=require(_0x0755('0x3'));var rp=require('request-promise');var moment=require(_0x0755('0x4'));var BPromise=require(_0x0755('0x5'));var Mustache=require(_0x0755('0x6'));var util=require('util');var path=require(_0x0755('0x7'));var sox=require(_0x0755('0x8'));var csv=require(_0x0755('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x0755('0xa'));var jsforce=require(_0x0755('0xb'));var deskjs=require(_0x0755('0xc'));var toCsv=require(_0x0755('0x9'));var querystring=require(_0x0755('0xd'));var Papa=require(_0x0755('0xe'));var Redis=require(_0x0755('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0755('0x10'));var hardwareService=require(_0x0755('0x11'));var logger=require('../../config/logger')(_0x0755('0x12'));var utils=require(_0x0755('0x13'));var config=require(_0x0755('0x14'));var db=require(_0x0755('0x15'))['db'];function respondWithStatusCode(_0x431038,_0x28446e){_0x28446e=_0x28446e||0xcc;return function(_0x4b8af0){if(_0x4b8af0){return _0x431038[_0x0755('0x16')](_0x28446e);}return _0x431038['status'](_0x28446e)[_0x0755('0x17')]();};}function respondWithResult(_0xed2182,_0x56dfb7){_0x56dfb7=_0x56dfb7||0xc8;return function(_0x53baab){if(_0x53baab){return _0xed2182[_0x0755('0x18')](_0x56dfb7)[_0x0755('0x19')](_0x53baab);}};}function respondWithFilteredResult(_0x1dba8e,_0x38aa2d){return function(_0x5d1e51){if(_0x5d1e51){var _0x3eef24=_0x5d1e51['count'],_0x495cad=_0x38aa2d[_0x0755('0x1a')],_0x3e7d15=_0x38aa2d[_0x0755('0x1a')]+_0x38aa2d[_0x0755('0x1b')],_0x3cfd48;if(_0x3e7d15>=_0x3eef24){_0x3e7d15=_0x3eef24;_0x3cfd48=0xc8;}else{_0x3cfd48=0xce;}_0x1dba8e['status'](_0x3cfd48);return _0x1dba8e[_0x0755('0x1c')](_0x0755('0x1d'),_0x495cad+'-'+_0x3e7d15+'/'+_0x3eef24)[_0x0755('0x19')](_0x5d1e51);}return null;};}function patchUpdates(_0x1ce39c){return function(_0x17c2f3){try{jsonpatch['apply'](_0x17c2f3,_0x1ce39c,!![]);}catch(_0x23a215){return BPromise['reject'](_0x23a215);}return _0x17c2f3[_0x0755('0x1e')]();};}function saveUpdates(_0x40062f,_0x578c52){return function(_0x33259e){if(_0x33259e){return _0x33259e['update'](_0x40062f)['then'](function(_0x2ae669){return _0x2ae669;});}return null;};}function removeEntity(_0x37f895,_0x348b1a){return function(_0x41f4e2){if(_0x41f4e2){return _0x41f4e2[_0x0755('0x1f')]()[_0x0755('0x20')](function(){var _0x1ae8a9=_0x41f4e2[_0x0755('0x21')]({'plain':!![]});var _0x3bea5a=_0x0755('0x22');return db[_0x0755('0x23')][_0x0755('0x1f')]({'where':{'type':_0x3bea5a,'resourceId':_0x1ae8a9['id']}})[_0x0755('0x20')](function(){return _0x41f4e2;});})['then'](function(){_0x37f895['status'](0xcc)[_0x0755('0x17')]();});}};}function handleEntityNotFound(_0x431ca1,_0x58a71d){return function(_0x3022ae){if(!_0x3022ae){_0x431ca1[_0x0755('0x16')](0x194);}return _0x3022ae;};}function handleError(_0x925208,_0x47d6a4){_0x47d6a4=_0x47d6a4||0x1f4;return function(_0x268ba0){logger[_0x0755('0x24')](_0x268ba0[_0x0755('0x25')]);if(_0x268ba0[_0x0755('0x26')]){delete _0x268ba0[_0x0755('0x26')];}_0x925208[_0x0755('0x18')](_0x47d6a4)[_0x0755('0x27')](_0x268ba0);};}exports[_0x0755('0x28')]=function(_0x28cd3c,_0x2ef91d){var _0x2851c0={},_0x3bd045={},_0xa1c755={'count':0x0,'rows':[]};var _0x302130=_[_0x0755('0x29')](db[_0x0755('0x2a')][_0x0755('0x2b')],function(_0x2d6066){return{'name':_0x2d6066[_0x0755('0x2c')],'type':_0x2d6066['type'][_0x0755('0x2d')]};});_0x3bd045[_0x0755('0x2e')]=_[_0x0755('0x29')](_0x302130,_0x0755('0x26'));_0x3bd045[_0x0755('0x2f')]=_[_0x0755('0x30')](_0x28cd3c[_0x0755('0x2f')]);_0x3bd045[_0x0755('0x31')]=_[_0x0755('0x32')](_0x3bd045[_0x0755('0x2e')],_0x3bd045['query']);_0x2851c0[_0x0755('0x33')]=_[_0x0755('0x32')](_0x3bd045[_0x0755('0x2e')],qs[_0x0755('0x34')](_0x28cd3c[_0x0755('0x2f')]['fields']));_0x2851c0['attributes']=_0x2851c0[_0x0755('0x33')][_0x0755('0x35')]?_0x2851c0[_0x0755('0x33')]:_0x3bd045[_0x0755('0x2e')];if(!_0x28cd3c[_0x0755('0x2f')][_0x0755('0x36')](_0x0755('0x37'))){_0x2851c0[_0x0755('0x1b')]=qs[_0x0755('0x1b')](_0x28cd3c[_0x0755('0x2f')][_0x0755('0x1b')]);_0x2851c0[_0x0755('0x1a')]=qs['offset'](_0x28cd3c[_0x0755('0x2f')][_0x0755('0x1a')]);}_0x2851c0['order']=qs[_0x0755('0x38')](_0x28cd3c[_0x0755('0x2f')][_0x0755('0x38')]);_0x2851c0[_0x0755('0x39')]=qs['filters'](_[_0x0755('0x3a')](_0x28cd3c[_0x0755('0x2f')],_0x3bd045['filters']),_0x302130);if(_0x28cd3c[_0x0755('0x2f')][_0x0755('0x3b')]){_0x2851c0[_0x0755('0x39')]=_['merge'](_0x2851c0[_0x0755('0x39')],{'$or':_[_0x0755('0x29')](_0x302130,function(_0x5c0a72){if(_0x5c0a72[_0x0755('0x3c')]!==_0x0755('0x3d')){var _0x25226a={};_0x25226a[_0x5c0a72[_0x0755('0x26')]]={'$like':'%'+_0x28cd3c['query'][_0x0755('0x3b')]+'%'};return _0x25226a;}})});}_0x2851c0=_[_0x0755('0x3e')]({},_0x2851c0,_0x28cd3c['options']);var _0x36a7fb={'where':_0x2851c0['where']};return db['JscriptyProject'][_0x0755('0x3f')](_0x36a7fb)[_0x0755('0x20')](function(_0x3aa5fd){_0xa1c755[_0x0755('0x3f')]=_0x3aa5fd;if(_0x28cd3c['query']['includeAll']){_0x2851c0[_0x0755('0x40')]=[{'all':!![]}];}return db[_0x0755('0x2a')][_0x0755('0x41')](_0x2851c0);})[_0x0755('0x20')](function(_0x180ca9){_0xa1c755[_0x0755('0x42')]=_0x180ca9;return _0xa1c755;})[_0x0755('0x20')](respondWithFilteredResult(_0x2ef91d,_0x2851c0))[_0x0755('0x43')](handleError(_0x2ef91d,null));};exports[_0x0755('0x44')]=function(_0x415bbf,_0x146282){var _0x2ce358={'raw':![],'where':{'id':_0x415bbf[_0x0755('0x45')]['id']}},_0x24f6bf={};_0x24f6bf[_0x0755('0x2e')]=_[_0x0755('0x30')](db[_0x0755('0x2a')]['rawAttributes']);_0x24f6bf[_0x0755('0x2f')]=_[_0x0755('0x30')](_0x415bbf['query']);_0x24f6bf[_0x0755('0x31')]=_[_0x0755('0x32')](_0x24f6bf[_0x0755('0x2e')],_0x24f6bf[_0x0755('0x2f')]);_0x2ce358[_0x0755('0x33')]=_[_0x0755('0x32')](_0x24f6bf[_0x0755('0x2e')],qs[_0x0755('0x34')](_0x415bbf[_0x0755('0x2f')]['fields']));_0x2ce358['attributes']=_0x2ce358[_0x0755('0x33')]['length']?_0x2ce358[_0x0755('0x33')]:_0x24f6bf['model'];if(_0x415bbf[_0x0755('0x2f')][_0x0755('0x46')]){_0x2ce358[_0x0755('0x40')]=[{'all':!![]}];}_0x2ce358=_['merge']({},_0x2ce358,_0x415bbf[_0x0755('0x47')]);return db[_0x0755('0x2a')][_0x0755('0x48')](_0x2ce358)[_0x0755('0x20')](handleEntityNotFound(_0x146282,null))[_0x0755('0x20')](respondWithResult(_0x146282,null))[_0x0755('0x43')](handleError(_0x146282,null));};exports[_0x0755('0x49')]=function(_0x9eafa1,_0x5e8ccf){return db[_0x0755('0x2a')][_0x0755('0x49')](_0x9eafa1['body'],{})[_0x0755('0x20')](function(_0x2c4fdb){var _0x452e9c=_0x9eafa1['user'][_0x0755('0x21')]({'plain':!![]});if(!_0x452e9c)throw new Error(_0x0755('0x4a'));if(_0x452e9c['role']==='user'){var _0x990142=_0x2c4fdb['get']({'plain':!![]});var _0x3909fa=_0x0755('0x22');return db[_0x0755('0x4b')][_0x0755('0x48')]({'where':{'name':_0x3909fa,'userProfileId':_0x452e9c[_0x0755('0x4c')]},'raw':!![]})[_0x0755('0x20')](function(_0x4b9420){if(_0x4b9420&&_0x4b9420['autoAssociation']===0x0){return db[_0x0755('0x23')][_0x0755('0x49')]({'name':_0x990142[_0x0755('0x26')],'resourceId':_0x990142['id'],'type':_0x4b9420[_0x0755('0x26')],'sectionId':_0x4b9420['id']},{})[_0x0755('0x20')](function(){return _0x2c4fdb;});}else{return _0x2c4fdb;}})[_0x0755('0x43')](function(_0x59bf13){logger[_0x0755('0x24')](_0x0755('0x4d'),_0x59bf13);throw _0x59bf13;});}return _0x2c4fdb;})[_0x0755('0x20')](respondWithResult(_0x5e8ccf,0xc9))[_0x0755('0x43')](handleError(_0x5e8ccf,null));};exports[_0x0755('0x4e')]=function(_0x259be0,_0x2ccf24){var _0x322b93={'where':{'id':_0x259be0[_0x0755('0x45')]['id']}},_0x1ca8a2={};_0x1ca8a2[_0x0755('0x2e')]=_[_0x0755('0x30')](db[_0x0755('0x2a')][_0x0755('0x2b')]);_0x322b93[_0x0755('0x33')]=_['intersection'](_0x1ca8a2['model'],qs[_0x0755('0x34')](_0x259be0[_0x0755('0x2f')]['fields']));_0x322b93[_0x0755('0x33')]=_0x322b93[_0x0755('0x33')][_0x0755('0x35')]?_0x322b93['attributes']:_0x1ca8a2[_0x0755('0x2e')];if(_0x259be0[_0x0755('0x2f')][_0x0755('0x46')]){_0x322b93['include']=[{'all':!![]}];}_0x322b93=_[_0x0755('0x3e')]({},_0x322b93,_0x259be0[_0x0755('0x47')]);return db[_0x0755('0x2a')][_0x0755('0x48')](_0x322b93)[_0x0755('0x20')](handleEntityNotFound(_0x2ccf24,null))['then'](function(_0x1bf673){if(_0x1bf673){var _0x3e79ba=_0x1bf673[_0x0755('0x21')]({'plain':!![]});_0x3e79ba=qs[_0x0755('0x4f')](_0x3e79ba,['id','createdAt','updatedAt']);_0x259be0[_0x0755('0x50')]=_['omit'](_0x259be0[_0x0755('0x50')],['id',_0x0755('0x51'),'updatedAt']);return db[_0x0755('0x2a')][_0x0755('0x49')](_[_0x0755('0x3e')](_0x3e79ba,_0x259be0['body']),{'include':_0x259be0['query'][_0x0755('0x46')]?[{'all':!![]}]:undefined})[_0x0755('0x20')](function(_0x880a7c){var _0x4a1eff=_0x259be0[_0x0755('0x52')][_0x0755('0x21')]({'plain':!![]});if(!_0x4a1eff)throw new Error(_0x0755('0x4a'));if(_0x4a1eff[_0x0755('0x53')]===_0x0755('0x52')){var _0x4b5ee6=_0x880a7c['get']({'plain':!![]});var _0x54e87d='Projects';return db[_0x0755('0x4b')][_0x0755('0x48')]({'where':{'name':_0x54e87d,'userProfileId':_0x4a1eff[_0x0755('0x4c')]},'raw':!![]})[_0x0755('0x20')](function(_0xbf00d1){if(_0xbf00d1&&_0xbf00d1['autoAssociation']===0x0){return db[_0x0755('0x23')][_0x0755('0x49')]({'name':_0x4b5ee6['name'],'resourceId':_0x4b5ee6['id'],'type':_0xbf00d1['name'],'sectionId':_0xbf00d1['id']},{})[_0x0755('0x20')](function(){return _0x880a7c;});}else{return _0x880a7c;}})['catch'](function(_0x3a22ec){logger[_0x0755('0x24')](_0x0755('0x4d'),_0x3a22ec);throw _0x3a22ec;});}return _0x880a7c;});}})['then'](respondWithResult(_0x2ccf24,0xc9))['catch'](handleError(_0x2ccf24,null));};exports[_0x0755('0x54')]=function(_0x3c697b,_0x395c94){if(_0x3c697b[_0x0755('0x50')]['id']){delete _0x3c697b[_0x0755('0x50')]['id'];}return db['JscriptyProject'][_0x0755('0x48')]({'where':{'id':_0x3c697b[_0x0755('0x45')]['id']}})[_0x0755('0x20')](handleEntityNotFound(_0x395c94,null))[_0x0755('0x20')](saveUpdates(_0x3c697b['body'],null))[_0x0755('0x20')](respondWithResult(_0x395c94,null))[_0x0755('0x43')](handleError(_0x395c94,null));};exports[_0x0755('0x1f')]=function(_0x2f2b72,_0x41241f){return db[_0x0755('0x2a')]['find']({'where':{'id':_0x2f2b72['params']['id']}})[_0x0755('0x20')](handleEntityNotFound(_0x41241f,null))['then'](removeEntity(_0x41241f,null))['catch'](handleError(_0x41241f,null));};exports[_0x0755('0x55')]=function(_0x23f20f,_0x4627af,_0x1afbd9){var _0x31e713={'raw':!![],'where':{}};var _0x1c8304={};var _0x18fee2={'count':0x0,'rows':[]};return db[_0x0755('0x2a')][_0x0755('0x56')]({'where':{'id':_0x23f20f['params']['id']}})[_0x0755('0x20')](handleEntityNotFound(_0x4627af,null))['then'](function(_0x2d6d1e){if(_0x2d6d1e){_0x1c8304[_0x0755('0x2e')]=_[_0x0755('0x30')](db[_0x0755('0x57')][_0x0755('0x2b')]);_0x1c8304[_0x0755('0x2f')]=_[_0x0755('0x30')](_0x23f20f['query']);_0x1c8304['filters']=_[_0x0755('0x32')](_0x1c8304['model'],_0x1c8304['query']);_0x31e713['attributes']=_['intersection'](_0x1c8304[_0x0755('0x2e')],qs['fields'](_0x23f20f[_0x0755('0x2f')][_0x0755('0x34')]));_0x31e713['attributes']=_0x31e713[_0x0755('0x33')][_0x0755('0x35')]?_0x31e713[_0x0755('0x33')]:_0x1c8304[_0x0755('0x2e')];if(!_0x23f20f[_0x0755('0x2f')][_0x0755('0x36')](_0x0755('0x37'))){_0x31e713[_0x0755('0x1b')]=qs[_0x0755('0x1b')](_0x23f20f[_0x0755('0x2f')][_0x0755('0x1b')]);_0x31e713['offset']=qs[_0x0755('0x1a')](_0x23f20f[_0x0755('0x2f')][_0x0755('0x1a')]);}_0x31e713[_0x0755('0x58')]=qs[_0x0755('0x38')](_0x23f20f['query'][_0x0755('0x38')]);_0x31e713[_0x0755('0x39')]=qs[_0x0755('0x31')](_[_0x0755('0x3a')](_0x23f20f[_0x0755('0x2f')],_0x1c8304[_0x0755('0x31')]));_0x31e713[_0x0755('0x39')][_0x0755('0x59')]=_0x2d6d1e['id'];if(_0x23f20f['query']['filter']){_0x31e713[_0x0755('0x39')]=_[_0x0755('0x3e')](_0x31e713[_0x0755('0x39')],{'$or':_['map'](_0x31e713[_0x0755('0x33')],function(_0x3dd690){var _0x1f904d={};_0x1f904d[_0x3dd690]={'$like':'%'+_0x23f20f[_0x0755('0x2f')][_0x0755('0x3b')]+'%'};return _0x1f904d;})});}_0x31e713=_[_0x0755('0x3e')]({},_0x31e713,_0x23f20f[_0x0755('0x47')]);return db[_0x0755('0x57')][_0x0755('0x3f')]({'where':_0x31e713['where']})[_0x0755('0x20')](function(_0x4f0e80){_0x18fee2['count']=_0x4f0e80;if(_0x23f20f[_0x0755('0x2f')][_0x0755('0x46')]){_0x31e713[_0x0755('0x40')]=[{'all':!![]}];}return db[_0x0755('0x57')][_0x0755('0x41')](_0x31e713);})[_0x0755('0x20')](function(_0x282da8){_0x18fee2[_0x0755('0x42')]=_0x282da8;return _0x18fee2;});}})['then'](respondWithFilteredResult(_0x4627af,_0x31e713))['catch'](handleError(_0x4627af,null));};exports[_0x0755('0x5a')]=function(_0x294dd8,_0x9b701,_0x58dd73){var _0x3b5333={'raw':!![],'where':{}};var _0x44466c={};var _0x229998={'count':0x0,'rows':[]};return db['JscriptyProject'][_0x0755('0x56')]({'where':{'id':_0x294dd8[_0x0755('0x45')]['id']}})[_0x0755('0x20')](handleEntityNotFound(_0x9b701,null))['then'](function(_0x4a3a62){if(_0x4a3a62){_0x44466c[_0x0755('0x2e')]=_[_0x0755('0x30')](db['JscriptyAnswerReport'][_0x0755('0x2b')]);_0x44466c[_0x0755('0x2f')]=_['keys'](_0x294dd8[_0x0755('0x2f')]);_0x44466c[_0x0755('0x31')]=_[_0x0755('0x32')](_0x44466c[_0x0755('0x2e')],_0x44466c[_0x0755('0x2f')]);_0x3b5333['attributes']=_['intersection'](_0x44466c['model'],qs['fields'](_0x294dd8['query'][_0x0755('0x34')]));_0x3b5333[_0x0755('0x33')]=_0x3b5333[_0x0755('0x33')]['length']?_0x3b5333[_0x0755('0x33')]:_0x44466c[_0x0755('0x2e')];if(!_0x294dd8['query'][_0x0755('0x36')]('nolimit')){_0x3b5333['limit']=qs[_0x0755('0x1b')](_0x294dd8[_0x0755('0x2f')]['limit']);_0x3b5333[_0x0755('0x1a')]=qs[_0x0755('0x1a')](_0x294dd8[_0x0755('0x2f')][_0x0755('0x1a')]);}_0x3b5333['order']=qs[_0x0755('0x38')](_0x294dd8['query'][_0x0755('0x38')]);_0x3b5333[_0x0755('0x39')]=qs['filters'](_['pick'](_0x294dd8[_0x0755('0x2f')],_0x44466c[_0x0755('0x31')]));_0x3b5333[_0x0755('0x39')][_0x0755('0x59')]=_0x4a3a62['id'];if(_0x294dd8[_0x0755('0x2f')][_0x0755('0x3b')]){_0x3b5333[_0x0755('0x39')]=_[_0x0755('0x3e')](_0x3b5333[_0x0755('0x39')],{'$or':_[_0x0755('0x29')](_0x3b5333[_0x0755('0x33')],function(_0x465483){var _0x2daaf2={};_0x2daaf2[_0x465483]={'$like':'%'+_0x294dd8['query'][_0x0755('0x3b')]+'%'};return _0x2daaf2;})});}_0x3b5333=_[_0x0755('0x3e')]({},_0x3b5333,_0x294dd8[_0x0755('0x47')]);return db['JscriptyAnswerReport'][_0x0755('0x3f')]({'where':_0x3b5333['where']})[_0x0755('0x20')](function(_0xac30da){_0x229998[_0x0755('0x3f')]=_0xac30da;if(_0x294dd8[_0x0755('0x2f')]['includeAll']){_0x3b5333[_0x0755('0x40')]=[{'all':!![]}];}return db[_0x0755('0x5b')]['findAll'](_0x3b5333);})[_0x0755('0x20')](function(_0x1cdfee){_0x229998['rows']=_0x1cdfee;return _0x229998;});}})[_0x0755('0x20')](respondWithFilteredResult(_0x9b701,_0x3b5333))[_0x0755('0x43')](handleError(_0x9b701,null));};function char(_0x1744df){return'number'===typeof _0x1744df?String[_0x0755('0x5c')][_0x0755('0x5d')](null,arguments):_0x1744df;}function needsEncapsulation(_0x4ad07b){return!!_0x4ad07b&&(_0x4ad07b[_0x0755('0x5e')]()['indexOf'](char(0xd))>=0x0||_0x4ad07b[_0x0755('0x5e')]()['indexOf'](char(0xa))>=0x0||_0x4ad07b[_0x0755('0x5e')]()[_0x0755('0x5f')](char(0x2c))>=0x0||_0x4ad07b[_0x0755('0x5e')]()[_0x0755('0x5f')](char(0x22))>=0x0);}function encapsulate(_0x3c6dc4){var _0x2e114b=char(0x22),_0x5cf1a5='\x5c'+char(0x22),_0x48e3d0=_0x3c6dc4['toString']()['replace'](new RegExp(_0x2e114b,'g'),_0x5cf1a5);return _0x2e114b+_0x48e3d0+_0x2e114b;}exports[_0x0755('0x60')]=function(_0x1cacec,_0x6e9930,_0x27d718){var _0x14a981,_0x152d5e;var _0x30a94a={'where':{'ProjectId':_0x1cacec[_0x0755('0x45')]['id']}};if(_0x1cacec['query'][_0x0755('0x61')]){_0x30a94a[_0x0755('0x39')][_0x0755('0x62')]=JSON[_0x0755('0x63')](_0x1cacec[_0x0755('0x2f')][_0x0755('0x61')]);}return db[_0x0755('0x57')][_0x0755('0x41')](_0x30a94a)[_0x0755('0x20')](handleEntityNotFound(_0x6e9930,null))[_0x0755('0x20')](function(_0x5bce33){if(_0x5bce33){_0x14a981=_0x5bce33;return db[_0x0755('0x64')][_0x0755('0x41')]({'where':{'SessionId':{'$in':_[_0x0755('0x29')](_0x14a981,'id')},'ProjectId':_0x1cacec[_0x0755('0x45')]['id']},'order':'-createdAt'});}})[_0x0755('0x20')](handleEntityNotFound(_0x6e9930,null))[_0x0755('0x20')](function(_0x2061e5){if(_0x2061e5){_0x152d5e=_0x2061e5;var _0x19b088={};for(var _0x4db746=0x0,_0x4353aa=_0x152d5e[_0x0755('0x35')];_0x4db746<_0x4353aa;_0x4db746++){if(!_0x19b088[_0x0755('0x36')](_0x152d5e[_0x4db746]['questionId'])){_0x19b088[_0x152d5e[_0x4db746]['questionId']]=needsEncapsulation(_0x152d5e[_0x4db746][_0x0755('0x65')])?encapsulate(_0x152d5e[_0x4db746][_0x0755('0x65')]):_0x152d5e[_0x4db746][_0x0755('0x65')];}}var _0x2fa805=[],_0x1972e4={};for(var _0x2c21e9=0x0,_0x19c0f5=_0x14a981[_0x0755('0x35')];_0x2c21e9<_0x19c0f5;_0x2c21e9++){_0x1972e4={'ProjectId':_0x1cacec[_0x0755('0x45')]['id'],'SessionId':_0x14a981[_0x2c21e9]['id'],'StartTime':moment(_0x14a981[_0x2c21e9][_0x0755('0x62')])[_0x0755('0x66')](_0x0755('0x67'))};for(var _0x3ff7a2=0x0,_0x35aebf=_0x152d5e['length'];_0x3ff7a2<_0x35aebf;_0x3ff7a2++){if(_0x152d5e[_0x3ff7a2][_0x0755('0x68')]==_0x14a981[_0x2c21e9]['id']&&_0x19b088[_0x0755('0x36')](_0x152d5e[_0x3ff7a2][_0x0755('0x69')])){_0x1972e4[_0x19b088[_0x152d5e[_0x3ff7a2][_0x0755('0x69')]]]=_0x152d5e[_0x3ff7a2]['answer'];}}for(var _0x2021e0 in _0x19b088){if(!_0x1972e4[_0x0755('0x36')](_0x19b088[_0x2021e0])){_0x1972e4[_0x19b088[_0x2021e0]]=null;}}_0x2fa805['push'](_0x1972e4);}return _0x2fa805;}})[_0x0755('0x20')](function(_0xe29f99){if(!_[_0x0755('0x6a')](_0xe29f99)){var _0x345348=toCsv(_0xe29f99);var _0x220050=Date[_0x0755('0x6b')]();fs[_0x0755('0x6c')](util[_0x0755('0x66')](_0x0755('0x6d'),_0x1cacec[_0x0755('0x45')]['id'],_0x220050),_0x345348);_0x6e9930['setHeader']('Content-disposition',_0x0755('0x6e')+util[_0x0755('0x66')](_0x0755('0x6f'),_0x1cacec[_0x0755('0x45')]['id'],_0x220050));_0x6e9930[_0x0755('0x70')](_0x0755('0x71'),_0x0755('0x72'));return _0x6e9930[_0x0755('0x73')](util[_0x0755('0x66')](_0x0755('0x6d'),_0x1cacec[_0x0755('0x45')]['id'],_0x220050));}else{return _0x6e9930['sendStatus'](0xcc);}})[_0x0755('0x43')](handleError(_0x6e9930,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 9181034..90813dd 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 _0xdac3=['moment','bluebird','request-promise','rimraf','../../config/environment','./jscriptyProject.attributes','exports','JscriptyProject','lodash','util','../../config/logger'];(function(_0xfb949e,_0x384f65){var _0x14dcef=function(_0x41dbbe){while(--_0x41dbbe){_0xfb949e['push'](_0xfb949e['shift']());}};_0x14dcef(++_0x384f65);}(_0xdac3,0x1ec));var _0x3dac=function(_0x5dcbf0,_0x101d9d){_0x5dcbf0=_0x5dcbf0-0x0;var _0xcf87aa=_0xdac3[_0x5dcbf0];return _0xcf87aa;};'use strict';var _=require(_0x3dac('0x0'));var util=require(_0x3dac('0x1'));var logger=require(_0x3dac('0x2'))('api');var moment=require(_0x3dac('0x3'));var BPromise=require(_0x3dac('0x4'));var rp=require(_0x3dac('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3dac('0x6'));var config=require(_0x3dac('0x7'));var attributes=require(_0x3dac('0x8'));module[_0x3dac('0x9')]=function(_0x466516,_0x4bca4c){return _0x466516['define'](_0x3dac('0xa'),attributes,{'tableName':'jscripty_projects','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3a2b=['rimraf','../../config/environment','exports','define','JscriptyProject','jscripty_projects','../../config/logger','moment','bluebird','path'];(function(_0x421e36,_0x18776e){var _0x20b3e3=function(_0x767de4){while(--_0x767de4){_0x421e36['push'](_0x421e36['shift']());}};_0x20b3e3(++_0x18776e);}(_0x3a2b,0x114));var _0xb3a2=function(_0x5d8533,_0x528a1d){_0x5d8533=_0x5d8533-0x0;var _0x12a235=_0x3a2b[_0x5d8533];return _0x12a235;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb3a2('0x0'))('api');var moment=require(_0xb3a2('0x1'));var BPromise=require(_0xb3a2('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb3a2('0x3'));var rimraf=require(_0xb3a2('0x4'));var config=require(_0xb3a2('0x5'));var attributes=require('./jscriptyProject.attributes');module[_0xb3a2('0x6')]=function(_0x87f535,_0x1c37f8){return _0x87f535[_0xb3a2('0x7')](_0xb3a2('0x8'),attributes,{'tableName':_0xb3a2('0x9'),'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 7d8561a..e5d1183 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 _0xea5b=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request','then','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xea5b,0x172));var _0xbea5=function(_0x3070dc,_0x40cf11){_0x3070dc=_0x3070dc-0x0;var _0x431489=_0xea5b[_0x3070dc];return _0x431489;};'use strict';var _=require(_0xbea5('0x0'));var util=require(_0xbea5('0x1'));var moment=require(_0xbea5('0x2'));var BPromise=require(_0xbea5('0x3'));var rs=require(_0xbea5('0x4'));var fs=require('fs');var Redis=require(_0xbea5('0x5'));var db=require(_0xbea5('0x6'))['db'];var utils=require(_0xbea5('0x7'));var logger=require('../../config/logger')(_0xbea5('0x8'));var config=require(_0xbea5('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xbea5('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x46b7a0,_0x573bbc,_0x25a26b){return new BPromise(function(_0x2002ba,_0x47717c){return client[_0xbea5('0xb')](_0x46b7a0,_0x25a26b)[_0xbea5('0xc')](function(_0xdff8fc){logger[_0xbea5('0xd')](_0xbea5('0xe'),_0x573bbc,_0xbea5('0xf'));logger[_0xbea5('0x10')](_0xbea5('0x11'),_0x573bbc,_0xbea5('0xf'),JSON['stringify'](_0xdff8fc));if(_0xdff8fc[_0xbea5('0x12')]){if(_0xdff8fc[_0xbea5('0x12')]['code']===0x1f4){logger[_0xbea5('0x12')](_0xbea5('0xe'),_0x573bbc,_0xdff8fc[_0xbea5('0x12')][_0xbea5('0x13')]);return _0x47717c(_0xdff8fc[_0xbea5('0x12')]['message']);}logger[_0xbea5('0x12')]('JscriptyProject,\x20%s,\x20%s',_0x573bbc,_0xdff8fc[_0xbea5('0x12')][_0xbea5('0x13')]);return _0x2002ba(_0xdff8fc[_0xbea5('0x12')][_0xbea5('0x13')]);}else{logger[_0xbea5('0xd')]('JscriptyProject,\x20%s,\x20%s',_0x573bbc,_0xbea5('0xf'));_0x2002ba(_0xdff8fc[_0xbea5('0x14')][_0xbea5('0x13')]);}})[_0xbea5('0x15')](function(_0x2b8c0e){logger[_0xbea5('0x12')](_0xbea5('0xe'),_0x573bbc,_0x2b8c0e);_0x47717c(_0x2b8c0e);});});} \ No newline at end of file +var _0x61fe=['JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','JscriptyProject,\x20%s,\x20%s','request\x20sent'];(function(_0x506970,_0x2cd1c3){var _0x1d95b=function(_0xc7b5d4){while(--_0xc7b5d4){_0x506970['push'](_0x506970['shift']());}};_0x1d95b(++_0x2cd1c3);}(_0x61fe,0x17d));var _0xe61f=function(_0x20056d,_0x242089){_0x20056d=_0x20056d-0x0;var _0x3bb318=_0x61fe[_0x20056d];return _0x3bb318;};'use strict';var _=require(_0xe61f('0x0'));var util=require(_0xe61f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xe61f('0x2'));var fs=require('fs');var Redis=require(_0xe61f('0x3'));var db=require(_0xe61f('0x4'))['db'];var utils=require(_0xe61f('0x5'));var logger=require(_0xe61f('0x6'))(_0xe61f('0x7'));var config=require(_0xe61f('0x8'));var jayson=require(_0xe61f('0x9'));var client=jayson[_0xe61f('0xa')][_0xe61f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1dfeab,_0x50df5b,_0x26bdb0){return new BPromise(function(_0x59f90d,_0x37cf92){return client[_0xe61f('0xc')](_0x1dfeab,_0x26bdb0)['then'](function(_0x1f7c27){logger['info'](_0xe61f('0xd'),_0x50df5b,_0xe61f('0xe'));logger['debug'](_0xe61f('0xf'),_0x50df5b,'request\x20sent',JSON[_0xe61f('0x10')](_0x1f7c27));if(_0x1f7c27[_0xe61f('0x11')]){if(_0x1f7c27[_0xe61f('0x11')][_0xe61f('0x12')]===0x1f4){logger[_0xe61f('0x11')]('JscriptyProject,\x20%s,\x20%s',_0x50df5b,_0x1f7c27['error'][_0xe61f('0x13')]);return _0x37cf92(_0x1f7c27['error'][_0xe61f('0x13')]);}logger[_0xe61f('0x11')](_0xe61f('0xd'),_0x50df5b,_0x1f7c27['error']['message']);return _0x59f90d(_0x1f7c27['error'][_0xe61f('0x13')]);}else{logger[_0xe61f('0x14')]('JscriptyProject,\x20%s,\x20%s',_0x50df5b,_0xe61f('0xe'));_0x59f90d(_0x1f7c27[_0xe61f('0x15')]['message']);}})['catch'](function(_0x4989f4){logger[_0xe61f('0x11')](_0xe61f('0xd'),_0x50df5b,_0x4989f4);_0x37cf92(_0x4989f4);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 108a6b9..ed5fe21 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 _0xefc6=['destroy','multer','util','path','connect-timeout','../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','put','update','delete'];(function(_0x2bfe52,_0x43946e){var _0x1cf649=function(_0xc8300c){while(--_0xc8300c){_0x2bfe52['push'](_0x2bfe52['shift']());}};_0x1cf649(++_0x43946e);}(_0xefc6,0x166));var _0x6efc=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xefc6[_0x21a9d9];return _0x46adce;};'use strict';var multer=require(_0x6efc('0x0'));var util=require(_0x6efc('0x1'));var path=require(_0x6efc('0x2'));var timeout=require(_0x6efc('0x3'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x6efc('0x4'));var controller=require(_0x6efc('0x5'));router[_0x6efc('0x6')]('/',auth[_0x6efc('0x7')](),controller[_0x6efc('0x8')]);router['get'](_0x6efc('0x9'),auth['isAuthenticated'](),controller[_0x6efc('0xa')]);router[_0x6efc('0x6')](_0x6efc('0xb'),auth['isAuthenticated'](),controller[_0x6efc('0xc')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x6efc('0xd')](_0x6efc('0xb'),auth[_0x6efc('0x7')](),controller[_0x6efc('0xe')]);router[_0x6efc('0xf')]('/:id',auth[_0x6efc('0x7')](),controller[_0x6efc('0x10')]);module['exports']=router; \ No newline at end of file +var _0xa6fb=['isAuthenticated','index','/describe','describe','/:id','show','post','create','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./jscriptyQuestionReport.controller','get'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0xa6fb,0x132));var _0xba6f=function(_0x48e0c4,_0xd18d98){_0x48e0c4=_0x48e0c4-0x0;var _0x46a778=_0xa6fb[_0x48e0c4];return _0x46a778;};'use strict';var multer=require(_0xba6f('0x0'));var util=require(_0xba6f('0x1'));var path=require('path');var timeout=require(_0xba6f('0x2'));var express=require(_0xba6f('0x3'));var router=express[_0xba6f('0x4')]();var auth=require(_0xba6f('0x5'));var interaction=require(_0xba6f('0x6'));var config=require('../../config/environment');var controller=require(_0xba6f('0x7'));router[_0xba6f('0x8')]('/',auth[_0xba6f('0x9')](),controller[_0xba6f('0xa')]);router[_0xba6f('0x8')](_0xba6f('0xb'),auth[_0xba6f('0x9')](),controller[_0xba6f('0xc')]);router[_0xba6f('0x8')](_0xba6f('0xd'),auth['isAuthenticated'](),controller[_0xba6f('0xe')]);router[_0xba6f('0xf')]('/',auth['isAuthenticated'](),controller[_0xba6f('0x10')]);router['put'](_0xba6f('0xd'),auth[_0xba6f('0x9')](),controller[_0xba6f('0x11')]);router[_0xba6f('0x12')](_0xba6f('0xd'),auth[_0xba6f('0x9')](),controller[_0xba6f('0x13')]);module[_0xba6f('0x14')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 9b1e23c..dce6a01 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 _0x32c2=['sequelize','STRING'];(function(_0x57f855,_0x17b5bc){var _0x4f7c3e=function(_0x347d53){while(--_0x347d53){_0x57f855['push'](_0x57f855['shift']());}};_0x4f7c3e(++_0x17b5bc);}(_0x32c2,0xd4));var _0x232c=function(_0x1791b0,_0x3c82f6){_0x1791b0=_0x1791b0-0x0;var _0x23974e=_0x32c2[_0x1791b0];return _0x23974e;};'use strict';var Sequelize=require(_0x232c('0x0'));module['exports']={'question':{'type':Sequelize[_0x232c('0x1')]},'answer':{'type':Sequelize['TEXT']('long')},'membername':{'type':Sequelize[_0x232c('0x1')]},'projectname':{'type':Sequelize[_0x232c('0x1')]},'queue':{'type':Sequelize[_0x232c('0x1')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x232c('0x1')]},'questionId':{'type':Sequelize[_0x232c('0x1')]}}; \ No newline at end of file +var _0x06c7=['exports','STRING','TEXT','long','sequelize'];(function(_0x4f09c6,_0x32d8ef){var _0xbd33b9=function(_0xd2051a){while(--_0xd2051a){_0x4f09c6['push'](_0x4f09c6['shift']());}};_0xbd33b9(++_0x32d8ef);}(_0x06c7,0xfe));var _0x706c=function(_0x99012c,_0x3933f7){_0x99012c=_0x99012c-0x0;var _0x4c9fc4=_0x06c7[_0x99012c];return _0x4c9fc4;};'use strict';var Sequelize=require(_0x706c('0x0'));module[_0x706c('0x1')]={'question':{'type':Sequelize[_0x706c('0x2')]},'answer':{'type':Sequelize[_0x706c('0x3')](_0x706c('0x4'))},'membername':{'type':Sequelize[_0x706c('0x2')]},'projectname':{'type':Sequelize[_0x706c('0x2')]},'queue':{'type':Sequelize[_0x706c('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x706c('0x2')]},'calleridnum':{'type':Sequelize[_0x706c('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 0f17aca..ee41f98 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 _0xaa5a=['Content-Range','apply','reject','update','then','stack','name','index','JscriptyQuestionReport','rawAttributes','fieldName','type','key','map','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','keys','find','create','body','params','destroy','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','json','count','offset','limit','set'];(function(_0x5d1f03,_0x206425){var _0x366fa2=function(_0x5b0b6d){while(--_0x5b0b6d){_0x5d1f03['push'](_0x5d1f03['shift']());}};_0x366fa2(++_0x206425);}(_0xaa5a,0x109));var _0xaaa5=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xaa5a[_0x14add3];return _0x4a174f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xaaa5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xaaa5('0x1'));var jsonpatch=require(_0xaaa5('0x2'));var rp=require(_0xaaa5('0x3'));var moment=require(_0xaaa5('0x4'));var BPromise=require(_0xaaa5('0x5'));var Mustache=require(_0xaaa5('0x6'));var util=require(_0xaaa5('0x7'));var path=require('path');var sox=require(_0xaaa5('0x8'));var csv=require(_0xaaa5('0x9'));var ejs=require(_0xaaa5('0xa'));var fs=require('fs');var _=require(_0xaaa5('0xb'));var squel=require(_0xaaa5('0xc'));var crypto=require('crypto');var jsforce=require(_0xaaa5('0xd'));var deskjs=require(_0xaaa5('0xe'));var toCsv=require(_0xaaa5('0x9'));var querystring=require(_0xaaa5('0xf'));var Papa=require(_0xaaa5('0x10'));var Redis=require(_0xaaa5('0x11'));var authService=require(_0xaaa5('0x12'));var qs=require(_0xaaa5('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xaaa5('0x14'));var logger=require(_0xaaa5('0x15'))(_0xaaa5('0x16'));var utils=require('../../config/utils');var config=require(_0xaaa5('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x35d83c,_0x46e11f){_0x46e11f=_0x46e11f||0xcc;return function(_0x496516){if(_0x496516){return _0x35d83c[_0xaaa5('0x18')](_0x46e11f);}return _0x35d83c[_0xaaa5('0x19')](_0x46e11f)['end']();};}function respondWithResult(_0x243c35,_0x18566d){_0x18566d=_0x18566d||0xc8;return function(_0x28d522){if(_0x28d522){return _0x243c35[_0xaaa5('0x19')](_0x18566d)[_0xaaa5('0x1a')](_0x28d522);}};}function respondWithFilteredResult(_0x4be044,_0x62dd40){return function(_0x3d788a){if(_0x3d788a){var _0x3e1ff6=_0x3d788a[_0xaaa5('0x1b')],_0x6f17c0=_0x62dd40[_0xaaa5('0x1c')],_0x4d6f17=_0x62dd40['offset']+_0x62dd40[_0xaaa5('0x1d')],_0x5c55a8;if(_0x4d6f17>=_0x3e1ff6){_0x4d6f17=_0x3e1ff6;_0x5c55a8=0xc8;}else{_0x5c55a8=0xce;}_0x4be044[_0xaaa5('0x19')](_0x5c55a8);return _0x4be044[_0xaaa5('0x1e')](_0xaaa5('0x1f'),_0x6f17c0+'-'+_0x4d6f17+'/'+_0x3e1ff6)[_0xaaa5('0x1a')](_0x3d788a);}return null;};}function patchUpdates(_0x3de085){return function(_0x2b1ed3){try{jsonpatch[_0xaaa5('0x20')](_0x2b1ed3,_0x3de085,!![]);}catch(_0xeb6226){return BPromise[_0xaaa5('0x21')](_0xeb6226);}return _0x2b1ed3['save']();};}function saveUpdates(_0x420dd6,_0x4c2861){return function(_0x4db045){if(_0x4db045){return _0x4db045[_0xaaa5('0x22')](_0x420dd6)[_0xaaa5('0x23')](function(_0xe87fc){return _0xe87fc;});}return null;};}function removeEntity(_0x1a8f02,_0x18a234){return function(_0x1e9ebf){if(_0x1e9ebf){return _0x1e9ebf['destroy']()[_0xaaa5('0x23')](function(){_0x1a8f02[_0xaaa5('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2faa5f,_0x2072ae){return function(_0x1847fb){if(!_0x1847fb){_0x2faa5f['sendStatus'](0x194);}return _0x1847fb;};}function handleError(_0x245ee4,_0x5a588d){_0x5a588d=_0x5a588d||0x1f4;return function(_0x295f4c){logger['error'](_0x295f4c[_0xaaa5('0x24')]);if(_0x295f4c['name']){delete _0x295f4c[_0xaaa5('0x25')];}_0x245ee4[_0xaaa5('0x19')](_0x5a588d)['send'](_0x295f4c);};}exports[_0xaaa5('0x26')]=function(_0x1b926c,_0x574146){var _0x3d46e6={},_0x13258e={},_0x4e5fca={'count':0x0,'rows':[]};var _0x220fc1=_['map'](db[_0xaaa5('0x27')][_0xaaa5('0x28')],function(_0x20d270){return{'name':_0x20d270[_0xaaa5('0x29')],'type':_0x20d270[_0xaaa5('0x2a')][_0xaaa5('0x2b')]};});_0x13258e['model']=_[_0xaaa5('0x2c')](_0x220fc1,'name');_0x13258e[_0xaaa5('0x2d')]=_['keys'](_0x1b926c[_0xaaa5('0x2d')]);_0x13258e['filters']=_[_0xaaa5('0x2e')](_0x13258e[_0xaaa5('0x2f')],_0x13258e[_0xaaa5('0x2d')]);_0x3d46e6[_0xaaa5('0x30')]=_[_0xaaa5('0x2e')](_0x13258e[_0xaaa5('0x2f')],qs[_0xaaa5('0x31')](_0x1b926c[_0xaaa5('0x2d')]['fields']));_0x3d46e6[_0xaaa5('0x30')]=_0x3d46e6[_0xaaa5('0x30')][_0xaaa5('0x32')]?_0x3d46e6[_0xaaa5('0x30')]:_0x13258e[_0xaaa5('0x2f')];if(!_0x1b926c['query'][_0xaaa5('0x33')](_0xaaa5('0x34'))){_0x3d46e6[_0xaaa5('0x1d')]=qs[_0xaaa5('0x1d')](_0x1b926c[_0xaaa5('0x2d')][_0xaaa5('0x1d')]);_0x3d46e6[_0xaaa5('0x1c')]=qs['offset'](_0x1b926c[_0xaaa5('0x2d')][_0xaaa5('0x1c')]);}_0x3d46e6[_0xaaa5('0x35')]=qs[_0xaaa5('0x36')](_0x1b926c[_0xaaa5('0x2d')][_0xaaa5('0x36')]);_0x3d46e6['where']=qs[_0xaaa5('0x37')](_['pick'](_0x1b926c[_0xaaa5('0x2d')],_0x13258e[_0xaaa5('0x37')]),_0x220fc1);if(_0x1b926c[_0xaaa5('0x2d')][_0xaaa5('0x38')]){_0x3d46e6[_0xaaa5('0x39')]=_[_0xaaa5('0x3a')](_0x3d46e6['where'],{'$or':_[_0xaaa5('0x2c')](_0x220fc1,function(_0x18fcb8){if(_0x18fcb8[_0xaaa5('0x2a')]!==_0xaaa5('0x3b')){var _0x2039a9={};_0x2039a9[_0x18fcb8[_0xaaa5('0x25')]]={'$like':'%'+_0x1b926c[_0xaaa5('0x2d')][_0xaaa5('0x38')]+'%'};return _0x2039a9;}})});}_0x3d46e6=_[_0xaaa5('0x3a')]({},_0x3d46e6,_0x1b926c[_0xaaa5('0x3c')]);var _0x463547={'where':_0x3d46e6['where']};return db['JscriptyQuestionReport'][_0xaaa5('0x1b')](_0x463547)['then'](function(_0xce50e1){_0x4e5fca[_0xaaa5('0x1b')]=_0xce50e1;if(_0x1b926c[_0xaaa5('0x2d')][_0xaaa5('0x3d')]){_0x3d46e6[_0xaaa5('0x3e')]=[{'all':!![]}];}return db[_0xaaa5('0x27')][_0xaaa5('0x3f')](_0x3d46e6);})[_0xaaa5('0x23')](function(_0x103397){_0x4e5fca[_0xaaa5('0x40')]=_0x103397;return _0x4e5fca;})[_0xaaa5('0x23')](respondWithFilteredResult(_0x574146,_0x3d46e6))[_0xaaa5('0x41')](handleError(_0x574146,null));};exports[_0xaaa5('0x42')]=function(_0x110f3d,_0x1d12ef){var _0xf606f3={'raw':!![],'where':{'id':_0x110f3d['params']['id']}},_0x41fc89={};_0x41fc89['model']=_[_0xaaa5('0x43')](db[_0xaaa5('0x27')][_0xaaa5('0x28')]);_0x41fc89['query']=_[_0xaaa5('0x43')](_0x110f3d[_0xaaa5('0x2d')]);_0x41fc89['filters']=_[_0xaaa5('0x2e')](_0x41fc89[_0xaaa5('0x2f')],_0x41fc89[_0xaaa5('0x2d')]);_0xf606f3[_0xaaa5('0x30')]=_['intersection'](_0x41fc89[_0xaaa5('0x2f')],qs[_0xaaa5('0x31')](_0x110f3d[_0xaaa5('0x2d')]['fields']));_0xf606f3['attributes']=_0xf606f3[_0xaaa5('0x30')][_0xaaa5('0x32')]?_0xf606f3[_0xaaa5('0x30')]:_0x41fc89[_0xaaa5('0x2f')];if(_0x110f3d[_0xaaa5('0x2d')]['includeAll']){_0xf606f3[_0xaaa5('0x3e')]=[{'all':!![]}];}_0xf606f3=_['merge']({},_0xf606f3,_0x110f3d['options']);return db[_0xaaa5('0x27')][_0xaaa5('0x44')](_0xf606f3)['then'](handleEntityNotFound(_0x1d12ef,null))['then'](respondWithResult(_0x1d12ef,null))[_0xaaa5('0x41')](handleError(_0x1d12ef,null));};exports[_0xaaa5('0x45')]=function(_0x4fe99a,_0x5a77b2){return db[_0xaaa5('0x27')][_0xaaa5('0x45')](_0x4fe99a[_0xaaa5('0x46')],{})[_0xaaa5('0x23')](respondWithResult(_0x5a77b2,0xc9))[_0xaaa5('0x41')](handleError(_0x5a77b2,null));};exports['update']=function(_0x366ecf,_0x1aa989){if(_0x366ecf[_0xaaa5('0x46')]['id']){delete _0x366ecf['body']['id'];}return db[_0xaaa5('0x27')][_0xaaa5('0x44')]({'where':{'id':_0x366ecf[_0xaaa5('0x47')]['id']}})[_0xaaa5('0x23')](handleEntityNotFound(_0x1aa989,null))[_0xaaa5('0x23')](saveUpdates(_0x366ecf[_0xaaa5('0x46')],null))['then'](respondWithResult(_0x1aa989,null))[_0xaaa5('0x41')](handleError(_0x1aa989,null));};exports[_0xaaa5('0x48')]=function(_0x4ce20f,_0x40bdef){return db[_0xaaa5('0x27')][_0xaaa5('0x44')]({'where':{'id':_0x4ce20f['params']['id']}})[_0xaaa5('0x23')](handleEntityNotFound(_0x40bdef,null))[_0xaaa5('0x23')](removeEntity(_0x40bdef,null))[_0xaaa5('0x41')](handleError(_0x40bdef,null));};exports[_0xaaa5('0x49')]=function(_0x316aee,_0x2ac5a0){return db['JscriptyQuestionReport']['describe']()[_0xaaa5('0x23')](respondWithResult(_0x2ac5a0,null))[_0xaaa5('0x41')](handleError(_0x2ac5a0,null));}; \ No newline at end of file +var _0xc68c=['model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','include','rows','catch','show','params','options','create','body','find','describe','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','JscriptyQuestionReport','rawAttributes','fieldName','type'];(function(_0xbeb808,_0x881ddf){var _0x5d6909=function(_0x37d652){while(--_0x37d652){_0xbeb808['push'](_0xbeb808['shift']());}};_0x5d6909(++_0x881ddf);}(_0xc68c,0x1dd));var _0xcc68=function(_0x17ee45,_0x1458c1){_0x17ee45=_0x17ee45-0x0;var _0x2b6b12=_0xc68c[_0x17ee45];return _0x2b6b12;};'use strict';var pdf=require(_0xcc68('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xcc68('0x1'));var zipdir=require(_0xcc68('0x2'));var jsonpatch=require(_0xcc68('0x3'));var rp=require('request-promise');var moment=require(_0xcc68('0x4'));var BPromise=require(_0xcc68('0x5'));var Mustache=require(_0xcc68('0x6'));var util=require('util');var path=require(_0xcc68('0x7'));var sox=require(_0xcc68('0x8'));var csv=require('to-csv');var ejs=require(_0xcc68('0x9'));var fs=require('fs');var _=require(_0xcc68('0xa'));var squel=require(_0xcc68('0xb'));var crypto=require(_0xcc68('0xc'));var jsforce=require(_0xcc68('0xd'));var deskjs=require(_0xcc68('0xe'));var toCsv=require(_0xcc68('0xf'));var querystring=require(_0xcc68('0x10'));var Papa=require(_0xcc68('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xcc68('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcc68('0x13'));var logger=require(_0xcc68('0x14'))('api');var utils=require(_0xcc68('0x15'));var config=require(_0xcc68('0x16'));var db=require(_0xcc68('0x17'))['db'];function respondWithStatusCode(_0x5edc10,_0x1bde00){_0x1bde00=_0x1bde00||0xcc;return function(_0x3b1f3){if(_0x3b1f3){return _0x5edc10[_0xcc68('0x18')](_0x1bde00);}return _0x5edc10[_0xcc68('0x19')](_0x1bde00)[_0xcc68('0x1a')]();};}function respondWithResult(_0xe106f6,_0x554a83){_0x554a83=_0x554a83||0xc8;return function(_0x5ce65d){if(_0x5ce65d){return _0xe106f6[_0xcc68('0x19')](_0x554a83)[_0xcc68('0x1b')](_0x5ce65d);}};}function respondWithFilteredResult(_0x94eb11,_0x5b6c21){return function(_0x5c46b9){if(_0x5c46b9){var _0x2a4488=_0x5c46b9[_0xcc68('0x1c')],_0x575fd0=_0x5b6c21[_0xcc68('0x1d')],_0x4b39c9=_0x5b6c21[_0xcc68('0x1d')]+_0x5b6c21[_0xcc68('0x1e')],_0x27ec5b;if(_0x4b39c9>=_0x2a4488){_0x4b39c9=_0x2a4488;_0x27ec5b=0xc8;}else{_0x27ec5b=0xce;}_0x94eb11[_0xcc68('0x19')](_0x27ec5b);return _0x94eb11[_0xcc68('0x1f')](_0xcc68('0x20'),_0x575fd0+'-'+_0x4b39c9+'/'+_0x2a4488)[_0xcc68('0x1b')](_0x5c46b9);}return null;};}function patchUpdates(_0x1f89fe){return function(_0x1d35ff){try{jsonpatch[_0xcc68('0x21')](_0x1d35ff,_0x1f89fe,!![]);}catch(_0x4e2ec2){return BPromise[_0xcc68('0x22')](_0x4e2ec2);}return _0x1d35ff[_0xcc68('0x23')]();};}function saveUpdates(_0xc172a2,_0x5128eb){return function(_0x24f410){if(_0x24f410){return _0x24f410[_0xcc68('0x24')](_0xc172a2)[_0xcc68('0x25')](function(_0x123cd5){return _0x123cd5;});}return null;};}function removeEntity(_0x138082,_0x1a7306){return function(_0x1d97a8){if(_0x1d97a8){return _0x1d97a8[_0xcc68('0x26')]()[_0xcc68('0x25')](function(){_0x138082['status'](0xcc)[_0xcc68('0x1a')]();});}};}function handleEntityNotFound(_0x100171,_0x3cb6a3){return function(_0x402cc1){if(!_0x402cc1){_0x100171[_0xcc68('0x18')](0x194);}return _0x402cc1;};}function handleError(_0x5b289b,_0x26fe34){_0x26fe34=_0x26fe34||0x1f4;return function(_0x4d4c5e){logger['error'](_0x4d4c5e[_0xcc68('0x27')]);if(_0x4d4c5e[_0xcc68('0x28')]){delete _0x4d4c5e[_0xcc68('0x28')];}_0x5b289b[_0xcc68('0x19')](_0x26fe34)[_0xcc68('0x29')](_0x4d4c5e);};}exports[_0xcc68('0x2a')]=function(_0x1e7ab5,_0x17c07){var _0x37cd74={},_0x4832cf={},_0x758754={'count':0x0,'rows':[]};var _0x4b6d22=_[_0xcc68('0x2b')](db[_0xcc68('0x2c')][_0xcc68('0x2d')],function(_0x5d8cf9){return{'name':_0x5d8cf9[_0xcc68('0x2e')],'type':_0x5d8cf9[_0xcc68('0x2f')]['key']};});_0x4832cf[_0xcc68('0x30')]=_[_0xcc68('0x2b')](_0x4b6d22,_0xcc68('0x28'));_0x4832cf['query']=_[_0xcc68('0x31')](_0x1e7ab5[_0xcc68('0x32')]);_0x4832cf[_0xcc68('0x33')]=_[_0xcc68('0x34')](_0x4832cf[_0xcc68('0x30')],_0x4832cf['query']);_0x37cd74[_0xcc68('0x35')]=_[_0xcc68('0x34')](_0x4832cf['model'],qs[_0xcc68('0x36')](_0x1e7ab5[_0xcc68('0x32')][_0xcc68('0x36')]));_0x37cd74[_0xcc68('0x35')]=_0x37cd74[_0xcc68('0x35')][_0xcc68('0x37')]?_0x37cd74[_0xcc68('0x35')]:_0x4832cf['model'];if(!_0x1e7ab5['query'][_0xcc68('0x38')](_0xcc68('0x39'))){_0x37cd74[_0xcc68('0x1e')]=qs[_0xcc68('0x1e')](_0x1e7ab5[_0xcc68('0x32')][_0xcc68('0x1e')]);_0x37cd74[_0xcc68('0x1d')]=qs[_0xcc68('0x1d')](_0x1e7ab5['query'][_0xcc68('0x1d')]);}_0x37cd74[_0xcc68('0x3a')]=qs[_0xcc68('0x3b')](_0x1e7ab5[_0xcc68('0x32')][_0xcc68('0x3b')]);_0x37cd74[_0xcc68('0x3c')]=qs[_0xcc68('0x33')](_[_0xcc68('0x3d')](_0x1e7ab5[_0xcc68('0x32')],_0x4832cf[_0xcc68('0x33')]),_0x4b6d22);if(_0x1e7ab5['query'][_0xcc68('0x3e')]){_0x37cd74[_0xcc68('0x3c')]=_['merge'](_0x37cd74[_0xcc68('0x3c')],{'$or':_[_0xcc68('0x2b')](_0x4b6d22,function(_0x39f430){if(_0x39f430[_0xcc68('0x2f')]!=='VIRTUAL'){var _0x3206c6={};_0x3206c6[_0x39f430[_0xcc68('0x28')]]={'$like':'%'+_0x1e7ab5[_0xcc68('0x32')][_0xcc68('0x3e')]+'%'};return _0x3206c6;}})});}_0x37cd74=_[_0xcc68('0x3f')]({},_0x37cd74,_0x1e7ab5['options']);var _0x16a5d8={'where':_0x37cd74[_0xcc68('0x3c')]};return db['JscriptyQuestionReport'][_0xcc68('0x1c')](_0x16a5d8)[_0xcc68('0x25')](function(_0x54c5aa){_0x758754[_0xcc68('0x1c')]=_0x54c5aa;if(_0x1e7ab5[_0xcc68('0x32')][_0xcc68('0x40')]){_0x37cd74[_0xcc68('0x41')]=[{'all':!![]}];}return db[_0xcc68('0x2c')]['findAll'](_0x37cd74);})[_0xcc68('0x25')](function(_0x8f06bf){_0x758754[_0xcc68('0x42')]=_0x8f06bf;return _0x758754;})['then'](respondWithFilteredResult(_0x17c07,_0x37cd74))[_0xcc68('0x43')](handleError(_0x17c07,null));};exports[_0xcc68('0x44')]=function(_0x28cdf5,_0x42dc5d){var _0x1c6b0b={'raw':!![],'where':{'id':_0x28cdf5[_0xcc68('0x45')]['id']}},_0x3df7ca={};_0x3df7ca[_0xcc68('0x30')]=_[_0xcc68('0x31')](db[_0xcc68('0x2c')][_0xcc68('0x2d')]);_0x3df7ca[_0xcc68('0x32')]=_['keys'](_0x28cdf5[_0xcc68('0x32')]);_0x3df7ca[_0xcc68('0x33')]=_[_0xcc68('0x34')](_0x3df7ca[_0xcc68('0x30')],_0x3df7ca[_0xcc68('0x32')]);_0x1c6b0b['attributes']=_[_0xcc68('0x34')](_0x3df7ca[_0xcc68('0x30')],qs[_0xcc68('0x36')](_0x28cdf5[_0xcc68('0x32')][_0xcc68('0x36')]));_0x1c6b0b['attributes']=_0x1c6b0b[_0xcc68('0x35')][_0xcc68('0x37')]?_0x1c6b0b[_0xcc68('0x35')]:_0x3df7ca['model'];if(_0x28cdf5[_0xcc68('0x32')][_0xcc68('0x40')]){_0x1c6b0b[_0xcc68('0x41')]=[{'all':!![]}];}_0x1c6b0b=_['merge']({},_0x1c6b0b,_0x28cdf5[_0xcc68('0x46')]);return db[_0xcc68('0x2c')]['find'](_0x1c6b0b)['then'](handleEntityNotFound(_0x42dc5d,null))[_0xcc68('0x25')](respondWithResult(_0x42dc5d,null))['catch'](handleError(_0x42dc5d,null));};exports['create']=function(_0x23ae5a,_0x585b8f){return db[_0xcc68('0x2c')][_0xcc68('0x47')](_0x23ae5a['body'],{})[_0xcc68('0x25')](respondWithResult(_0x585b8f,0xc9))['catch'](handleError(_0x585b8f,null));};exports[_0xcc68('0x24')]=function(_0x1da61e,_0x1ba634){if(_0x1da61e[_0xcc68('0x48')]['id']){delete _0x1da61e[_0xcc68('0x48')]['id'];}return db[_0xcc68('0x2c')][_0xcc68('0x49')]({'where':{'id':_0x1da61e[_0xcc68('0x45')]['id']}})['then'](handleEntityNotFound(_0x1ba634,null))[_0xcc68('0x25')](saveUpdates(_0x1da61e[_0xcc68('0x48')],null))[_0xcc68('0x25')](respondWithResult(_0x1ba634,null))['catch'](handleError(_0x1ba634,null));};exports[_0xcc68('0x26')]=function(_0x13253a,_0x21e999){return db['JscriptyQuestionReport'][_0xcc68('0x49')]({'where':{'id':_0x13253a[_0xcc68('0x45')]['id']}})[_0xcc68('0x25')](handleEntityNotFound(_0x21e999,null))[_0xcc68('0x25')](removeEntity(_0x21e999,null))[_0xcc68('0x43')](handleError(_0x21e999,null));};exports['describe']=function(_0x3d12b5,_0x20ebd0){return db[_0xcc68('0x2c')][_0xcc68('0x4a')]()[_0xcc68('0x25')](respondWithResult(_0x20ebd0,null))[_0xcc68('0x43')](handleError(_0x20ebd0,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index e663bcc..f17565d 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 _0xaf0c=['JscriptyQuestionReport','report_jscripty_questions','lodash','util','bluebird','path','../../config/environment','exports','define'];(function(_0x4855a5,_0x2b95a3){var _0x5b5bf3=function(_0x5b4974){while(--_0x5b4974){_0x4855a5['push'](_0x4855a5['shift']());}};_0x5b5bf3(++_0x2b95a3);}(_0xaf0c,0x12b));var _0xcaf0=function(_0x3f1a8a,_0x5e6b68){_0x3f1a8a=_0x3f1a8a-0x0;var _0x3e34da=_0xaf0c[_0x3f1a8a];return _0x3e34da;};'use strict';var _=require(_0xcaf0('0x0'));var util=require(_0xcaf0('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xcaf0('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcaf0('0x3'));var rimraf=require('rimraf');var config=require(_0xcaf0('0x4'));var attributes=require('./jscriptyQuestionReport.attributes');module[_0xcaf0('0x5')]=function(_0x47a96,_0x134a89){return _0x47a96[_0xcaf0('0x6')](_0xcaf0('0x7'),attributes,{'tableName':_0xcaf0('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfa4e=['../../config/environment','./jscriptyQuestionReport.attributes','exports','JscriptyQuestionReport','report_jscripty_questions','lodash','util','../../config/logger','api','path','rimraf'];(function(_0x163837,_0x5b0365){var _0x154f34=function(_0x50c018){while(--_0x50c018){_0x163837['push'](_0x163837['shift']());}};_0x154f34(++_0x5b0365);}(_0xfa4e,0x9f));var _0xefa4=function(_0x4f1d08,_0x24621b){_0x4f1d08=_0x4f1d08-0x0;var _0x19c582=_0xfa4e[_0x4f1d08];return _0x19c582;};'use strict';var _=require(_0xefa4('0x0'));var util=require(_0xefa4('0x1'));var logger=require(_0xefa4('0x2'))(_0xefa4('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xefa4('0x4'));var rimraf=require(_0xefa4('0x5'));var config=require(_0xefa4('0x6'));var attributes=require(_0xefa4('0x7'));module[_0xefa4('0x8')]=function(_0x3c0086,_0x51e5f5){return _0x3c0086['define'](_0xefa4('0x9'),attributes,{'tableName':_0xefa4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js index 72585c7..5478610 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 _0x2b35=['../../config/environment','jayson/promise','http','request','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x33fcbb,_0x291d0f){var _0x2efe40=function(_0x2e9442){while(--_0x2e9442){_0x33fcbb['push'](_0x33fcbb['shift']());}};_0x2efe40(++_0x291d0f);}(_0x2b35,0x1ee));var _0x52b3=function(_0x4e2301,_0x5373d5){_0x4e2301=_0x4e2301-0x0;var _0xcd0a9=_0x2b35[_0x4e2301];return _0xcd0a9;};'use strict';var _=require(_0x52b3('0x0'));var util=require(_0x52b3('0x1'));var moment=require(_0x52b3('0x2'));var BPromise=require(_0x52b3('0x3'));var rs=require(_0x52b3('0x4'));var fs=require('fs');var Redis=require(_0x52b3('0x5'));var db=require(_0x52b3('0x6'))['db'];var utils=require(_0x52b3('0x7'));var logger=require(_0x52b3('0x8'))(_0x52b3('0x9'));var config=require(_0x52b3('0xa'));var jayson=require(_0x52b3('0xb'));var client=jayson['client'][_0x52b3('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x688b6f,_0x584b2f,_0x454f33){return new BPromise(function(_0x11547d,_0x58f12f){return client[_0x52b3('0xd')](_0x688b6f,_0x454f33)['then'](function(_0x49a9bd){logger[_0x52b3('0xe')](_0x52b3('0xf'),_0x584b2f,_0x52b3('0x10'));logger[_0x52b3('0x11')](_0x52b3('0x12'),_0x584b2f,_0x52b3('0x10'),JSON[_0x52b3('0x13')](_0x49a9bd));if(_0x49a9bd['error']){if(_0x49a9bd[_0x52b3('0x14')]['code']===0x1f4){logger[_0x52b3('0x14')](_0x52b3('0xf'),_0x584b2f,_0x49a9bd[_0x52b3('0x14')][_0x52b3('0x15')]);return _0x58f12f(_0x49a9bd[_0x52b3('0x14')][_0x52b3('0x15')]);}logger[_0x52b3('0x14')](_0x52b3('0xf'),_0x584b2f,_0x49a9bd[_0x52b3('0x14')][_0x52b3('0x15')]);return _0x11547d(_0x49a9bd['error'][_0x52b3('0x15')]);}else{logger[_0x52b3('0xe')](_0x52b3('0xf'),_0x584b2f,'request\x20sent');_0x11547d(_0x49a9bd[_0x52b3('0x16')][_0x52b3('0x15')]);}})[_0x52b3('0x17')](function(_0x5ea982){logger['error'](_0x52b3('0xf'),_0x584b2f,_0x5ea982);_0x58f12f(_0x5ea982);});});} \ No newline at end of file +var _0x81b6=['then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x199b1f,_0x4ed849){var _0x267ac9=function(_0x184ac6){while(--_0x184ac6){_0x199b1f['push'](_0x199b1f['shift']());}};_0x267ac9(++_0x4ed849);}(_0x81b6,0x12b));var _0x681b=function(_0x348fea,_0x381c0e){_0x348fea=_0x348fea-0x0;var _0x3302cd=_0x81b6[_0x348fea];return _0x3302cd;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x681b('0x0'));var BPromise=require(_0x681b('0x1'));var rs=require(_0x681b('0x2'));var fs=require('fs');var Redis=require(_0x681b('0x3'));var db=require(_0x681b('0x4'))['db'];var utils=require(_0x681b('0x5'));var logger=require(_0x681b('0x6'))(_0x681b('0x7'));var config=require(_0x681b('0x8'));var jayson=require(_0x681b('0x9'));var client=jayson[_0x681b('0xa')][_0x681b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5aea00,_0x3b6473,_0x204d44){return new BPromise(function(_0x2d23ea,_0x58b93a){return client[_0x681b('0xc')](_0x5aea00,_0x204d44)[_0x681b('0xd')](function(_0x6b4720){logger[_0x681b('0xe')](_0x681b('0xf'),_0x3b6473,_0x681b('0x10'));logger[_0x681b('0x11')](_0x681b('0x12'),_0x3b6473,_0x681b('0x10'),JSON[_0x681b('0x13')](_0x6b4720));if(_0x6b4720[_0x681b('0x14')]){if(_0x6b4720[_0x681b('0x14')][_0x681b('0x15')]===0x1f4){logger[_0x681b('0x14')](_0x681b('0xf'),_0x3b6473,_0x6b4720[_0x681b('0x14')][_0x681b('0x16')]);return _0x58b93a(_0x6b4720[_0x681b('0x14')][_0x681b('0x16')]);}logger[_0x681b('0x14')](_0x681b('0xf'),_0x3b6473,_0x6b4720[_0x681b('0x14')][_0x681b('0x16')]);return _0x2d23ea(_0x6b4720[_0x681b('0x14')]['message']);}else{logger[_0x681b('0xe')](_0x681b('0xf'),_0x3b6473,'request\x20sent');_0x2d23ea(_0x6b4720[_0x681b('0x17')][_0x681b('0x16')]);}})['catch'](function(_0x2eaa96){logger[_0x681b('0x14')](_0x681b('0xf'),_0x3b6473,_0x2eaa96);_0x58b93a(_0x2eaa96);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index c31fe6d..0155c1b 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 _0x6108=['show','/:id/questions','getQuestions','post','create','update','destroy','exports','multer','path','connect-timeout','express','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id'];(function(_0x14dc63,_0x557137){var _0x2084cd=function(_0x34869f){while(--_0x34869f){_0x14dc63['push'](_0x14dc63['shift']());}};_0x2084cd(++_0x557137);}(_0x6108,0xbc));var _0x8610=function(_0xeb972f,_0x3076be){_0xeb972f=_0xeb972f-0x0;var _0x27b39b=_0x6108[_0xeb972f];return _0x27b39b;};'use strict';var multer=require(_0x8610('0x0'));var util=require('util');var path=require(_0x8610('0x1'));var timeout=require(_0x8610('0x2'));var express=require(_0x8610('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x8610('0x4'));var config=require(_0x8610('0x5'));var controller=require('./jscriptySessionReport.controller');router['get']('/',auth[_0x8610('0x6')](),controller[_0x8610('0x7')]);router[_0x8610('0x8')](_0x8610('0x9'),auth['isAuthenticated'](),controller[_0x8610('0xa')]);router['get'](_0x8610('0xb'),auth[_0x8610('0x6')](),controller[_0x8610('0xc')]);router['get'](_0x8610('0xd'),auth[_0x8610('0x6')](),controller[_0x8610('0xe')]);router[_0x8610('0xf')]('/',auth[_0x8610('0x6')](),controller[_0x8610('0x10')]);router['put'](_0x8610('0xb'),auth[_0x8610('0x6')](),controller[_0x8610('0x11')]);router['delete'](_0x8610('0xb'),auth['isAuthenticated'](),controller[_0x8610('0x12')]);module[_0x8610('0x13')]=router; \ No newline at end of file +var _0xcb66=['../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/questions','getQuestions','post','update','delete','exports','util','path','connect-timeout','express','Router'];(function(_0x3bfdd3,_0x1305a1){var _0x3ec597=function(_0xd8d862){while(--_0xd8d862){_0x3bfdd3['push'](_0x3bfdd3['shift']());}};_0x3ec597(++_0x1305a1);}(_0xcb66,0x19f));var _0x6cb6=function(_0x2a558d,_0x2df0ff){_0x2a558d=_0x2a558d-0x0;var _0xa7bc9c=_0xcb66[_0x2a558d];return _0xa7bc9c;};'use strict';var multer=require('multer');var util=require(_0x6cb6('0x0'));var path=require(_0x6cb6('0x1'));var timeout=require(_0x6cb6('0x2'));var express=require(_0x6cb6('0x3'));var router=express[_0x6cb6('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x6cb6('0x5'));var config=require(_0x6cb6('0x6'));var controller=require(_0x6cb6('0x7'));router[_0x6cb6('0x8')]('/',auth[_0x6cb6('0x9')](),controller['index']);router['get'](_0x6cb6('0xa'),auth[_0x6cb6('0x9')](),controller[_0x6cb6('0xb')]);router[_0x6cb6('0x8')](_0x6cb6('0xc'),auth[_0x6cb6('0x9')](),controller[_0x6cb6('0xd')]);router[_0x6cb6('0x8')](_0x6cb6('0xe'),auth[_0x6cb6('0x9')](),controller[_0x6cb6('0xf')]);router[_0x6cb6('0x10')]('/',auth[_0x6cb6('0x9')](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x6cb6('0x11')]);router[_0x6cb6('0x12')](_0x6cb6('0xc'),auth[_0x6cb6('0x9')](),controller['destroy']);module[_0x6cb6('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 27155ab..a9081db 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 _0x683f=['sequelize','exports','DATE','setDataValue','endtime','format','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','moment'];(function(_0x551e8f,_0x47b713){var _0x5295a0=function(_0x4d4863){while(--_0x4d4863){_0x551e8f['push'](_0x551e8f['shift']());}};_0x5295a0(++_0x47b713);}(_0x683f,0xc7));var _0xf683=function(_0x2fa1c6,_0x4a5b8d){_0x2fa1c6=_0x2fa1c6-0x0;var _0x5f3257=_0x683f[_0x2fa1c6];return _0x5f3257;};'use strict';var moment=require(_0xf683('0x0'));var Sequelize=require(_0xf683('0x1'));module[_0xf683('0x2')]={'starttime':{'type':Sequelize[_0xf683('0x3')],'set':function(_0x3f8f64){this[_0xf683('0x4')]('starttime',_0x3f8f64);this['setDataValue'](_0xf683('0x5'),moment()[_0xf683('0x6')](_0xf683('0x7')));}},'endtime':{'type':Sequelize[_0xf683('0x3')]},'membername':{'type':Sequelize[_0xf683('0x8')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xf683('0x8')]},'uniqueid':{'type':Sequelize[_0xf683('0x8')]},'calleridname':{'type':Sequelize[_0xf683('0x8')]},'calleridnum':{'type':Sequelize[_0xf683('0x8')]},'completed':{'type':Sequelize[_0xf683('0x9')],'defaultValue':![]}}; \ No newline at end of file +var _0x4166=['DATE','setDataValue','starttime','endtime','STRING','BOOLEAN','moment','sequelize','exports'];(function(_0x429f37,_0x315b0c){var _0x4aad11=function(_0x2981f1){while(--_0x2981f1){_0x429f37['push'](_0x429f37['shift']());}};_0x4aad11(++_0x315b0c);}(_0x4166,0xf0));var _0x6416=function(_0x332e95,_0x3dcf3c){_0x332e95=_0x332e95-0x0;var _0x37841f=_0x4166[_0x332e95];return _0x37841f;};'use strict';var moment=require(_0x6416('0x0'));var Sequelize=require(_0x6416('0x1'));module[_0x6416('0x2')]={'starttime':{'type':Sequelize[_0x6416('0x3')],'set':function(_0x547611){this[_0x6416('0x4')](_0x6416('0x5'),_0x547611);this[_0x6416('0x4')](_0x6416('0x6'),moment()['format']('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize[_0x6416('0x3')]},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x6416('0x7')]},'uniqueid':{'type':Sequelize[_0x6416('0x7')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'completed':{'type':Sequelize[_0x6416('0x8')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index b06c31b..5ba043e 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 _0xde3a=['params','includeAll','find','create','body','update','describe','getQuestions','findOne','JscriptyQuestionReport','nolimit','SessionId','map','eml-format','zip-dir','moment','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','json','offset','Content-Range','apply','save','then','destroy','end','error','stack','name','send','index','JscriptySessionReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','VIRTUAL','merge','options','count','include','findAll','rows','catch'];(function(_0x5c257f,_0x54cbd5){var _0x1e3cde=function(_0x36da08){while(--_0x36da08){_0x5c257f['push'](_0x5c257f['shift']());}};_0x1e3cde(++_0x54cbd5);}(_0xde3a,0xa1));var _0xade3=function(_0x402895,_0x1beae7){_0x402895=_0x402895-0x0;var _0x1e3c81=_0xde3a[_0x402895];return _0x1e3c81;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xade3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xade3('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xade3('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xade3('0x3'));var csv=require(_0xade3('0x4'));var ejs=require(_0xade3('0x5'));var fs=require('fs');var _=require(_0xade3('0x6'));var squel=require(_0xade3('0x7'));var crypto=require(_0xade3('0x8'));var jsforce=require(_0xade3('0x9'));var deskjs=require('desk.js');var toCsv=require(_0xade3('0x4'));var querystring=require('querystring');var Papa=require(_0xade3('0xa'));var Redis=require(_0xade3('0xb'));var authService=require('../../components/auth/service');var qs=require(_0xade3('0xc'));var as=require(_0xade3('0xd'));var hardwareService=require(_0xade3('0xe'));var logger=require(_0xade3('0xf'))(_0xade3('0x10'));var utils=require(_0xade3('0x11'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xa0d664,_0x43f21e){_0x43f21e=_0x43f21e||0xcc;return function(_0x275ab9){if(_0x275ab9){return _0xa0d664[_0xade3('0x12')](_0x43f21e);}return _0xa0d664[_0xade3('0x13')](_0x43f21e)['end']();};}function respondWithResult(_0x3751a5,_0x256109){_0x256109=_0x256109||0xc8;return function(_0x31e2c0){if(_0x31e2c0){return _0x3751a5[_0xade3('0x13')](_0x256109)[_0xade3('0x14')](_0x31e2c0);}};}function respondWithFilteredResult(_0x397d8f,_0x178922){return function(_0x535c6e){if(_0x535c6e){var _0x108d16=_0x535c6e['count'],_0x4f36fa=_0x178922[_0xade3('0x15')],_0x176083=_0x178922[_0xade3('0x15')]+_0x178922['limit'],_0x205d13;if(_0x176083>=_0x108d16){_0x176083=_0x108d16;_0x205d13=0xc8;}else{_0x205d13=0xce;}_0x397d8f[_0xade3('0x13')](_0x205d13);return _0x397d8f['set'](_0xade3('0x16'),_0x4f36fa+'-'+_0x176083+'/'+_0x108d16)['json'](_0x535c6e);}return null;};}function patchUpdates(_0x293cb7){return function(_0xd16bd3){try{jsonpatch[_0xade3('0x17')](_0xd16bd3,_0x293cb7,!![]);}catch(_0x497888){return BPromise['reject'](_0x497888);}return _0xd16bd3[_0xade3('0x18')]();};}function saveUpdates(_0x3528ab,_0x570a97){return function(_0x531674){if(_0x531674){return _0x531674['update'](_0x3528ab)[_0xade3('0x19')](function(_0x292e91){return _0x292e91;});}return null;};}function removeEntity(_0x3f8bbf,_0x3c6668){return function(_0x33854a){if(_0x33854a){return _0x33854a[_0xade3('0x1a')]()['then'](function(){_0x3f8bbf['status'](0xcc)[_0xade3('0x1b')]();});}};}function handleEntityNotFound(_0x5745c3,_0x4785e5){return function(_0x5c5371){if(!_0x5c5371){_0x5745c3[_0xade3('0x12')](0x194);}return _0x5c5371;};}function handleError(_0x265525,_0x239cfd){_0x239cfd=_0x239cfd||0x1f4;return function(_0x635267){logger[_0xade3('0x1c')](_0x635267[_0xade3('0x1d')]);if(_0x635267[_0xade3('0x1e')]){delete _0x635267[_0xade3('0x1e')];}_0x265525[_0xade3('0x13')](_0x239cfd)[_0xade3('0x1f')](_0x635267);};}exports[_0xade3('0x20')]=function(_0x2fd89f,_0x4742fe){var _0x1e22d1={},_0x181ff0={},_0x1f03ff={'count':0x0,'rows':[]};var _0x3345b2=_['map'](db[_0xade3('0x21')][_0xade3('0x22')],function(_0x3b386f){return{'name':_0x3b386f[_0xade3('0x23')],'type':_0x3b386f[_0xade3('0x24')][_0xade3('0x25')]};});_0x181ff0[_0xade3('0x26')]=_['map'](_0x3345b2,'name');_0x181ff0[_0xade3('0x27')]=_[_0xade3('0x28')](_0x2fd89f['query']);_0x181ff0[_0xade3('0x29')]=_[_0xade3('0x2a')](_0x181ff0[_0xade3('0x26')],_0x181ff0[_0xade3('0x27')]);_0x1e22d1[_0xade3('0x2b')]=_['intersection'](_0x181ff0[_0xade3('0x26')],qs['fields'](_0x2fd89f[_0xade3('0x27')][_0xade3('0x2c')]));_0x1e22d1[_0xade3('0x2b')]=_0x1e22d1[_0xade3('0x2b')][_0xade3('0x2d')]?_0x1e22d1[_0xade3('0x2b')]:_0x181ff0[_0xade3('0x26')];if(!_0x2fd89f[_0xade3('0x27')][_0xade3('0x2e')]('nolimit')){_0x1e22d1[_0xade3('0x2f')]=qs[_0xade3('0x2f')](_0x2fd89f['query'][_0xade3('0x2f')]);_0x1e22d1[_0xade3('0x15')]=qs[_0xade3('0x15')](_0x2fd89f[_0xade3('0x27')][_0xade3('0x15')]);}_0x1e22d1[_0xade3('0x30')]=qs[_0xade3('0x31')](_0x2fd89f['query'][_0xade3('0x31')]);_0x1e22d1[_0xade3('0x32')]=qs[_0xade3('0x29')](_[_0xade3('0x33')](_0x2fd89f['query'],_0x181ff0[_0xade3('0x29')]),_0x3345b2);if(_0x2fd89f[_0xade3('0x27')][_0xade3('0x34')]){_0x1e22d1[_0xade3('0x32')]=_['merge'](_0x1e22d1['where'],{'$or':_['map'](_0x3345b2,function(_0x5c623a){if(_0x5c623a[_0xade3('0x24')]!==_0xade3('0x35')){var _0x2e8a8a={};_0x2e8a8a[_0x5c623a[_0xade3('0x1e')]]={'$like':'%'+_0x2fd89f['query'][_0xade3('0x34')]+'%'};return _0x2e8a8a;}})});}_0x1e22d1=_[_0xade3('0x36')]({},_0x1e22d1,_0x2fd89f[_0xade3('0x37')]);var _0x2dcb43={'where':_0x1e22d1[_0xade3('0x32')]};return db['JscriptySessionReport']['count'](_0x2dcb43)['then'](function(_0x5d3dc2){_0x1f03ff[_0xade3('0x38')]=_0x5d3dc2;if(_0x2fd89f[_0xade3('0x27')]['includeAll']){_0x1e22d1[_0xade3('0x39')]=[{'all':!![]}];}return db[_0xade3('0x21')][_0xade3('0x3a')](_0x1e22d1);})['then'](function(_0x41b05c){_0x1f03ff[_0xade3('0x3b')]=_0x41b05c;return _0x1f03ff;})['then'](respondWithFilteredResult(_0x4742fe,_0x1e22d1))[_0xade3('0x3c')](handleError(_0x4742fe,null));};exports['show']=function(_0x55bfbc,_0x365ee0){var _0x2d08b0={'raw':!![],'where':{'id':_0x55bfbc[_0xade3('0x3d')]['id']}},_0x328d37={};_0x328d37[_0xade3('0x26')]=_['keys'](db[_0xade3('0x21')][_0xade3('0x22')]);_0x328d37[_0xade3('0x27')]=_[_0xade3('0x28')](_0x55bfbc[_0xade3('0x27')]);_0x328d37[_0xade3('0x29')]=_[_0xade3('0x2a')](_0x328d37[_0xade3('0x26')],_0x328d37[_0xade3('0x27')]);_0x2d08b0['attributes']=_[_0xade3('0x2a')](_0x328d37['model'],qs[_0xade3('0x2c')](_0x55bfbc[_0xade3('0x27')]['fields']));_0x2d08b0[_0xade3('0x2b')]=_0x2d08b0[_0xade3('0x2b')][_0xade3('0x2d')]?_0x2d08b0[_0xade3('0x2b')]:_0x328d37[_0xade3('0x26')];if(_0x55bfbc[_0xade3('0x27')][_0xade3('0x3e')]){_0x2d08b0[_0xade3('0x39')]=[{'all':!![]}];}_0x2d08b0=_['merge']({},_0x2d08b0,_0x55bfbc['options']);return db['JscriptySessionReport'][_0xade3('0x3f')](_0x2d08b0)['then'](handleEntityNotFound(_0x365ee0,null))[_0xade3('0x19')](respondWithResult(_0x365ee0,null))[_0xade3('0x3c')](handleError(_0x365ee0,null));};exports[_0xade3('0x40')]=function(_0x5473fe,_0x2d0a9c){return db[_0xade3('0x21')][_0xade3('0x40')](_0x5473fe[_0xade3('0x41')],{})[_0xade3('0x19')](respondWithResult(_0x2d0a9c,0xc9))[_0xade3('0x3c')](handleError(_0x2d0a9c,null));};exports[_0xade3('0x42')]=function(_0x195593,_0x4fd77e){if(_0x195593[_0xade3('0x41')]['id']){delete _0x195593[_0xade3('0x41')]['id'];}return db[_0xade3('0x21')]['find']({'where':{'id':_0x195593[_0xade3('0x3d')]['id']}})[_0xade3('0x19')](handleEntityNotFound(_0x4fd77e,null))[_0xade3('0x19')](saveUpdates(_0x195593[_0xade3('0x41')],null))['then'](respondWithResult(_0x4fd77e,null))['catch'](handleError(_0x4fd77e,null));};exports[_0xade3('0x1a')]=function(_0x316426,_0x543e5a){return db[_0xade3('0x21')][_0xade3('0x3f')]({'where':{'id':_0x316426[_0xade3('0x3d')]['id']}})[_0xade3('0x19')](handleEntityNotFound(_0x543e5a,null))['then'](removeEntity(_0x543e5a,null))[_0xade3('0x3c')](handleError(_0x543e5a,null));};exports[_0xade3('0x43')]=function(_0x5052f5,_0x2d1f3b){return db[_0xade3('0x21')][_0xade3('0x43')]()[_0xade3('0x19')](respondWithResult(_0x2d1f3b,null))[_0xade3('0x3c')](handleError(_0x2d1f3b,null));};exports[_0xade3('0x44')]=function(_0x5f12f7,_0x44c539,_0x5cc9b2){var _0x45928a={'raw':!![],'where':{}};var _0xab9a42={};var _0x14d88a={'count':0x0,'rows':[]};return db['JscriptySessionReport'][_0xade3('0x45')]({'where':{'id':_0x5f12f7['params']['id']}})[_0xade3('0x19')](handleEntityNotFound(_0x44c539,null))[_0xade3('0x19')](function(_0x1ca5e6){if(_0x1ca5e6){_0xab9a42[_0xade3('0x26')]=_[_0xade3('0x28')](db[_0xade3('0x46')][_0xade3('0x22')]);_0xab9a42['query']=_[_0xade3('0x28')](_0x5f12f7[_0xade3('0x27')]);_0xab9a42['filters']=_['intersection'](_0xab9a42[_0xade3('0x26')],_0xab9a42[_0xade3('0x27')]);_0x45928a['attributes']=_['intersection'](_0xab9a42[_0xade3('0x26')],qs[_0xade3('0x2c')](_0x5f12f7[_0xade3('0x27')][_0xade3('0x2c')]));_0x45928a[_0xade3('0x2b')]=_0x45928a[_0xade3('0x2b')][_0xade3('0x2d')]?_0x45928a[_0xade3('0x2b')]:_0xab9a42[_0xade3('0x26')];if(!_0x5f12f7[_0xade3('0x27')]['hasOwnProperty'](_0xade3('0x47'))){_0x45928a[_0xade3('0x2f')]=qs[_0xade3('0x2f')](_0x5f12f7['query']['limit']);_0x45928a[_0xade3('0x15')]=qs[_0xade3('0x15')](_0x5f12f7[_0xade3('0x27')][_0xade3('0x15')]);}_0x45928a[_0xade3('0x30')]=qs[_0xade3('0x31')](_0x5f12f7[_0xade3('0x27')][_0xade3('0x31')]);_0x45928a[_0xade3('0x32')]=qs['filters'](_['pick'](_0x5f12f7[_0xade3('0x27')],_0xab9a42['filters']));_0x45928a[_0xade3('0x32')][_0xade3('0x48')]=_0x1ca5e6['id'];if(_0x5f12f7['query'][_0xade3('0x34')]){_0x45928a[_0xade3('0x32')]=_[_0xade3('0x36')](_0x45928a['where'],{'$or':_[_0xade3('0x49')](_0x45928a[_0xade3('0x2b')],function(_0x43638e){var _0x93f49={};_0x93f49[_0x43638e]={'$like':'%'+_0x5f12f7[_0xade3('0x27')][_0xade3('0x34')]+'%'};return _0x93f49;})});}_0x45928a=_[_0xade3('0x36')]({},_0x45928a,_0x5f12f7[_0xade3('0x37')]);return db['JscriptyQuestionReport'][_0xade3('0x38')]({'where':_0x45928a[_0xade3('0x32')]})[_0xade3('0x19')](function(_0x322801){_0x14d88a[_0xade3('0x38')]=_0x322801;if(_0x5f12f7[_0xade3('0x27')][_0xade3('0x3e')]){_0x45928a[_0xade3('0x39')]=[{'all':!![]}];}return db[_0xade3('0x46')][_0xade3('0x3a')](_0x45928a);})[_0xade3('0x19')](function(_0x237cde){_0x14d88a[_0xade3('0x3b')]=_0x237cde;return _0x14d88a;});}})[_0xade3('0x19')](respondWithFilteredResult(_0x44c539,_0x45928a))[_0xade3('0x3c')](handleError(_0x44c539,null));}; \ No newline at end of file +var _0x8d87=['then','end','name','send','index','map','JscriptySessionReport','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','options','includeAll','include','findAll','show','params','keys','length','find','catch','create','body','describe','getQuestions','JscriptyQuestionReport','SessionId','rows','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','count','offset','limit','set','apply','reject','update','destroy'];(function(_0x1e9449,_0x422da){var _0x1740ab=function(_0x2562b8){while(--_0x2562b8){_0x1e9449['push'](_0x1e9449['shift']());}};_0x1740ab(++_0x422da);}(_0x8d87,0x1a5));var _0x78d8=function(_0x46ae87,_0x4bd053){_0x46ae87=_0x46ae87-0x0;var _0x303fcc=_0x8d87[_0x46ae87];return _0x303fcc;};'use strict';var pdf=require(_0x78d8('0x0'));var emlformat=require(_0x78d8('0x1'));var rimraf=require(_0x78d8('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x78d8('0x3'));var moment=require('moment');var BPromise=require(_0x78d8('0x4'));var Mustache=require(_0x78d8('0x5'));var util=require(_0x78d8('0x6'));var path=require('path');var sox=require(_0x78d8('0x7'));var csv=require(_0x78d8('0x8'));var ejs=require(_0x78d8('0x9'));var fs=require('fs');var _=require(_0x78d8('0xa'));var squel=require('squel');var crypto=require(_0x78d8('0xb'));var jsforce=require(_0x78d8('0xc'));var deskjs=require(_0x78d8('0xd'));var toCsv=require(_0x78d8('0x8'));var querystring=require(_0x78d8('0xe'));var Papa=require('papaparse');var Redis=require(_0x78d8('0xf'));var authService=require(_0x78d8('0x10'));var qs=require(_0x78d8('0x11'));var as=require(_0x78d8('0x12'));var hardwareService=require(_0x78d8('0x13'));var logger=require(_0x78d8('0x14'))(_0x78d8('0x15'));var utils=require(_0x78d8('0x16'));var config=require('../../config/environment');var db=require(_0x78d8('0x17'))['db'];function respondWithStatusCode(_0x3a6f89,_0x2b9e72){_0x2b9e72=_0x2b9e72||0xcc;return function(_0x39e0cd){if(_0x39e0cd){return _0x3a6f89[_0x78d8('0x18')](_0x2b9e72);}return _0x3a6f89[_0x78d8('0x19')](_0x2b9e72)['end']();};}function respondWithResult(_0xe4bd48,_0x562207){_0x562207=_0x562207||0xc8;return function(_0x446757){if(_0x446757){return _0xe4bd48['status'](_0x562207)[_0x78d8('0x1a')](_0x446757);}};}function respondWithFilteredResult(_0x3349bc,_0x1ae69e){return function(_0x2e740f){if(_0x2e740f){var _0x2c798e=_0x2e740f[_0x78d8('0x1b')],_0x299e78=_0x1ae69e[_0x78d8('0x1c')],_0x21eae2=_0x1ae69e[_0x78d8('0x1c')]+_0x1ae69e[_0x78d8('0x1d')],_0x433346;if(_0x21eae2>=_0x2c798e){_0x21eae2=_0x2c798e;_0x433346=0xc8;}else{_0x433346=0xce;}_0x3349bc[_0x78d8('0x19')](_0x433346);return _0x3349bc[_0x78d8('0x1e')]('Content-Range',_0x299e78+'-'+_0x21eae2+'/'+_0x2c798e)['json'](_0x2e740f);}return null;};}function patchUpdates(_0x52af8f){return function(_0x4ac653){try{jsonpatch[_0x78d8('0x1f')](_0x4ac653,_0x52af8f,!![]);}catch(_0x5ba2c2){return BPromise[_0x78d8('0x20')](_0x5ba2c2);}return _0x4ac653['save']();};}function saveUpdates(_0x5d2659,_0xd68717){return function(_0x448688){if(_0x448688){return _0x448688[_0x78d8('0x21')](_0x5d2659)['then'](function(_0x3508e9){return _0x3508e9;});}return null;};}function removeEntity(_0x5a135c,_0x2f60a3){return function(_0x5d32f7){if(_0x5d32f7){return _0x5d32f7[_0x78d8('0x22')]()[_0x78d8('0x23')](function(){_0x5a135c[_0x78d8('0x19')](0xcc)[_0x78d8('0x24')]();});}};}function handleEntityNotFound(_0xbbabf8,_0x20654e){return function(_0x525fcf){if(!_0x525fcf){_0xbbabf8[_0x78d8('0x18')](0x194);}return _0x525fcf;};}function handleError(_0xb50666,_0xf04dcb){_0xf04dcb=_0xf04dcb||0x1f4;return function(_0x38aca9){logger['error'](_0x38aca9['stack']);if(_0x38aca9[_0x78d8('0x25')]){delete _0x38aca9[_0x78d8('0x25')];}_0xb50666['status'](_0xf04dcb)[_0x78d8('0x26')](_0x38aca9);};}exports[_0x78d8('0x27')]=function(_0x5460d8,_0x1012f2){var _0x35c716={},_0x5b6008={},_0x30cb84={'count':0x0,'rows':[]};var _0xbb2790=_[_0x78d8('0x28')](db[_0x78d8('0x29')][_0x78d8('0x2a')],function(_0x5eb823){return{'name':_0x5eb823[_0x78d8('0x2b')],'type':_0x5eb823[_0x78d8('0x2c')][_0x78d8('0x2d')]};});_0x5b6008[_0x78d8('0x2e')]=_['map'](_0xbb2790,_0x78d8('0x25'));_0x5b6008[_0x78d8('0x2f')]=_['keys'](_0x5460d8['query']);_0x5b6008['filters']=_[_0x78d8('0x30')](_0x5b6008[_0x78d8('0x2e')],_0x5b6008[_0x78d8('0x2f')]);_0x35c716[_0x78d8('0x31')]=_[_0x78d8('0x30')](_0x5b6008['model'],qs[_0x78d8('0x32')](_0x5460d8['query'][_0x78d8('0x32')]));_0x35c716[_0x78d8('0x31')]=_0x35c716[_0x78d8('0x31')]['length']?_0x35c716['attributes']:_0x5b6008[_0x78d8('0x2e')];if(!_0x5460d8[_0x78d8('0x2f')][_0x78d8('0x33')](_0x78d8('0x34'))){_0x35c716[_0x78d8('0x1d')]=qs[_0x78d8('0x1d')](_0x5460d8[_0x78d8('0x2f')][_0x78d8('0x1d')]);_0x35c716[_0x78d8('0x1c')]=qs[_0x78d8('0x1c')](_0x5460d8[_0x78d8('0x2f')][_0x78d8('0x1c')]);}_0x35c716[_0x78d8('0x35')]=qs[_0x78d8('0x36')](_0x5460d8[_0x78d8('0x2f')][_0x78d8('0x36')]);_0x35c716[_0x78d8('0x37')]=qs[_0x78d8('0x38')](_['pick'](_0x5460d8['query'],_0x5b6008[_0x78d8('0x38')]),_0xbb2790);if(_0x5460d8['query'][_0x78d8('0x39')]){_0x35c716[_0x78d8('0x37')]=_[_0x78d8('0x3a')](_0x35c716[_0x78d8('0x37')],{'$or':_[_0x78d8('0x28')](_0xbb2790,function(_0x232a1d){if(_0x232a1d['type']!=='VIRTUAL'){var _0x2fd30c={};_0x2fd30c[_0x232a1d[_0x78d8('0x25')]]={'$like':'%'+_0x5460d8[_0x78d8('0x2f')]['filter']+'%'};return _0x2fd30c;}})});}_0x35c716=_[_0x78d8('0x3a')]({},_0x35c716,_0x5460d8[_0x78d8('0x3b')]);var _0x2833be={'where':_0x35c716[_0x78d8('0x37')]};return db[_0x78d8('0x29')]['count'](_0x2833be)['then'](function(_0x23429c){_0x30cb84[_0x78d8('0x1b')]=_0x23429c;if(_0x5460d8[_0x78d8('0x2f')][_0x78d8('0x3c')]){_0x35c716[_0x78d8('0x3d')]=[{'all':!![]}];}return db[_0x78d8('0x29')][_0x78d8('0x3e')](_0x35c716);})[_0x78d8('0x23')](function(_0x4b47ef){_0x30cb84['rows']=_0x4b47ef;return _0x30cb84;})[_0x78d8('0x23')](respondWithFilteredResult(_0x1012f2,_0x35c716))['catch'](handleError(_0x1012f2,null));};exports[_0x78d8('0x3f')]=function(_0x571870,_0x5ef44d){var _0x2ff6e6={'raw':!![],'where':{'id':_0x571870[_0x78d8('0x40')]['id']}},_0x109a53={};_0x109a53[_0x78d8('0x2e')]=_[_0x78d8('0x41')](db[_0x78d8('0x29')][_0x78d8('0x2a')]);_0x109a53[_0x78d8('0x2f')]=_['keys'](_0x571870['query']);_0x109a53[_0x78d8('0x38')]=_[_0x78d8('0x30')](_0x109a53[_0x78d8('0x2e')],_0x109a53[_0x78d8('0x2f')]);_0x2ff6e6[_0x78d8('0x31')]=_[_0x78d8('0x30')](_0x109a53[_0x78d8('0x2e')],qs['fields'](_0x571870['query'][_0x78d8('0x32')]));_0x2ff6e6[_0x78d8('0x31')]=_0x2ff6e6['attributes'][_0x78d8('0x42')]?_0x2ff6e6[_0x78d8('0x31')]:_0x109a53[_0x78d8('0x2e')];if(_0x571870['query'][_0x78d8('0x3c')]){_0x2ff6e6['include']=[{'all':!![]}];}_0x2ff6e6=_[_0x78d8('0x3a')]({},_0x2ff6e6,_0x571870[_0x78d8('0x3b')]);return db[_0x78d8('0x29')][_0x78d8('0x43')](_0x2ff6e6)[_0x78d8('0x23')](handleEntityNotFound(_0x5ef44d,null))[_0x78d8('0x23')](respondWithResult(_0x5ef44d,null))[_0x78d8('0x44')](handleError(_0x5ef44d,null));};exports[_0x78d8('0x45')]=function(_0x5aa15a,_0x2d4e10){return db[_0x78d8('0x29')][_0x78d8('0x45')](_0x5aa15a[_0x78d8('0x46')],{})[_0x78d8('0x23')](respondWithResult(_0x2d4e10,0xc9))['catch'](handleError(_0x2d4e10,null));};exports[_0x78d8('0x21')]=function(_0x51b219,_0x50110b){if(_0x51b219['body']['id']){delete _0x51b219[_0x78d8('0x46')]['id'];}return db[_0x78d8('0x29')][_0x78d8('0x43')]({'where':{'id':_0x51b219['params']['id']}})['then'](handleEntityNotFound(_0x50110b,null))['then'](saveUpdates(_0x51b219['body'],null))[_0x78d8('0x23')](respondWithResult(_0x50110b,null))[_0x78d8('0x44')](handleError(_0x50110b,null));};exports[_0x78d8('0x22')]=function(_0x55f544,_0x36b8d3){return db[_0x78d8('0x29')][_0x78d8('0x43')]({'where':{'id':_0x55f544[_0x78d8('0x40')]['id']}})[_0x78d8('0x23')](handleEntityNotFound(_0x36b8d3,null))[_0x78d8('0x23')](removeEntity(_0x36b8d3,null))[_0x78d8('0x44')](handleError(_0x36b8d3,null));};exports['describe']=function(_0x2b06a5,_0x7bc470){return db[_0x78d8('0x29')][_0x78d8('0x47')]()[_0x78d8('0x23')](respondWithResult(_0x7bc470,null))[_0x78d8('0x44')](handleError(_0x7bc470,null));};exports[_0x78d8('0x48')]=function(_0x1dd078,_0x5ebb59,_0x221567){var _0x4dc2b5={'raw':!![],'where':{}};var _0x46517f={};var _0x9e947a={'count':0x0,'rows':[]};return db['JscriptySessionReport']['findOne']({'where':{'id':_0x1dd078[_0x78d8('0x40')]['id']}})[_0x78d8('0x23')](handleEntityNotFound(_0x5ebb59,null))[_0x78d8('0x23')](function(_0x2c677e){if(_0x2c677e){_0x46517f[_0x78d8('0x2e')]=_[_0x78d8('0x41')](db[_0x78d8('0x49')][_0x78d8('0x2a')]);_0x46517f['query']=_[_0x78d8('0x41')](_0x1dd078[_0x78d8('0x2f')]);_0x46517f[_0x78d8('0x38')]=_[_0x78d8('0x30')](_0x46517f['model'],_0x46517f[_0x78d8('0x2f')]);_0x4dc2b5[_0x78d8('0x31')]=_[_0x78d8('0x30')](_0x46517f[_0x78d8('0x2e')],qs['fields'](_0x1dd078[_0x78d8('0x2f')][_0x78d8('0x32')]));_0x4dc2b5['attributes']=_0x4dc2b5[_0x78d8('0x31')][_0x78d8('0x42')]?_0x4dc2b5[_0x78d8('0x31')]:_0x46517f['model'];if(!_0x1dd078['query'][_0x78d8('0x33')](_0x78d8('0x34'))){_0x4dc2b5['limit']=qs[_0x78d8('0x1d')](_0x1dd078[_0x78d8('0x2f')][_0x78d8('0x1d')]);_0x4dc2b5['offset']=qs[_0x78d8('0x1c')](_0x1dd078[_0x78d8('0x2f')]['offset']);}_0x4dc2b5[_0x78d8('0x35')]=qs[_0x78d8('0x36')](_0x1dd078[_0x78d8('0x2f')][_0x78d8('0x36')]);_0x4dc2b5[_0x78d8('0x37')]=qs['filters'](_['pick'](_0x1dd078[_0x78d8('0x2f')],_0x46517f[_0x78d8('0x38')]));_0x4dc2b5[_0x78d8('0x37')][_0x78d8('0x4a')]=_0x2c677e['id'];if(_0x1dd078[_0x78d8('0x2f')][_0x78d8('0x39')]){_0x4dc2b5[_0x78d8('0x37')]=_[_0x78d8('0x3a')](_0x4dc2b5[_0x78d8('0x37')],{'$or':_[_0x78d8('0x28')](_0x4dc2b5[_0x78d8('0x31')],function(_0xaa6ca7){var _0x18339a={};_0x18339a[_0xaa6ca7]={'$like':'%'+_0x1dd078['query'][_0x78d8('0x39')]+'%'};return _0x18339a;})});}_0x4dc2b5=_[_0x78d8('0x3a')]({},_0x4dc2b5,_0x1dd078[_0x78d8('0x3b')]);return db[_0x78d8('0x49')][_0x78d8('0x1b')]({'where':_0x4dc2b5[_0x78d8('0x37')]})[_0x78d8('0x23')](function(_0xb66ca){_0x9e947a[_0x78d8('0x1b')]=_0xb66ca;if(_0x1dd078['query'][_0x78d8('0x3c')]){_0x4dc2b5['include']=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x78d8('0x3e')](_0x4dc2b5);})[_0x78d8('0x23')](function(_0xa61b09){_0x9e947a[_0x78d8('0x4b')]=_0xa61b09;return _0x9e947a;});}})[_0x78d8('0x23')](respondWithFilteredResult(_0x5ebb59,_0x4dc2b5))[_0x78d8('0x44')](handleError(_0x5ebb59,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 9149a0b..b5f5a2a 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 _0x7430=['../../config/logger','moment','request-promise','path','../../config/environment','./jscriptySessionReport.attributes','exports','JscriptySessionReport','report_jscripty_sessions','lodash','util'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x7430,0xfb));var _0x0743=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x7430[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0x0743('0x0'));var util=require(_0x0743('0x1'));var logger=require(_0x0743('0x2'))('api');var moment=require(_0x0743('0x3'));var BPromise=require('bluebird');var rp=require(_0x0743('0x4'));var fs=require('fs');var path=require(_0x0743('0x5'));var rimraf=require('rimraf');var config=require(_0x0743('0x6'));var attributes=require(_0x0743('0x7'));module[_0x0743('0x8')]=function(_0x33336f,_0x440dd2){return _0x33336f['define'](_0x0743('0x9'),attributes,{'tableName':_0x0743('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8ec7=['define','JscriptySessionReport','report_jscripty_sessions','lodash','util','../../config/logger','api','moment','path','../../config/environment','exports'];(function(_0x46b5f4,_0x26f7fe){var _0xb3bcd3=function(_0x592f9c){while(--_0x592f9c){_0x46b5f4['push'](_0x46b5f4['shift']());}};_0xb3bcd3(++_0x26f7fe);}(_0x8ec7,0x1bb));var _0x78ec=function(_0x2a3c4d,_0x9c6b37){_0x2a3c4d=_0x2a3c4d-0x0;var _0x55c390=_0x8ec7[_0x2a3c4d];return _0x55c390;};'use strict';var _=require(_0x78ec('0x0'));var util=require(_0x78ec('0x1'));var logger=require(_0x78ec('0x2'))(_0x78ec('0x3'));var moment=require(_0x78ec('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x78ec('0x5'));var rimraf=require('rimraf');var config=require(_0x78ec('0x6'));var attributes=require('./jscriptySessionReport.attributes');module[_0x78ec('0x7')]=function(_0x32991b,_0xc3a39c){return _0x32991b[_0x78ec('0x8')](_0x78ec('0x9'),attributes,{'tableName':_0x78ec('0xa'),'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 710b4ad..28c3605 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 _0xfc84=['request','then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','bluebird','ioredis','../../config/utils','rpc','client','http'];(function(_0x25a6a7,_0x1986cb){var _0x20cfd1=function(_0x520e35){while(--_0x520e35){_0x25a6a7['push'](_0x25a6a7['shift']());}};_0x20cfd1(++_0x1986cb);}(_0xfc84,0x184));var _0x4fc8=function(_0x29f9ac,_0x2444e8){_0x29f9ac=_0x29f9ac-0x0;var _0x5d8328=_0xfc84[_0x29f9ac];return _0x5d8328;};'use strict';var _=require(_0x4fc8('0x0'));var util=require(_0x4fc8('0x1'));var moment=require('moment');var BPromise=require(_0x4fc8('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4fc8('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4fc8('0x4'));var logger=require('../../config/logger')(_0x4fc8('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4fc8('0x6')][_0x4fc8('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x495be0,_0x36af17,_0x5e57ae){return new BPromise(function(_0x12d75c,_0x586802){return client[_0x4fc8('0x8')](_0x495be0,_0x5e57ae)[_0x4fc8('0x9')](function(_0x1cdc74){logger[_0x4fc8('0xa')](_0x4fc8('0xb'),_0x36af17,_0x4fc8('0xc'));logger['debug']('JscriptySessionReport,\x20%s,\x20%s,\x20%s',_0x36af17,_0x4fc8('0xc'),JSON['stringify'](_0x1cdc74));if(_0x1cdc74[_0x4fc8('0xd')]){if(_0x1cdc74[_0x4fc8('0xd')][_0x4fc8('0xe')]===0x1f4){logger[_0x4fc8('0xd')](_0x4fc8('0xb'),_0x36af17,_0x1cdc74['error'][_0x4fc8('0xf')]);return _0x586802(_0x1cdc74[_0x4fc8('0xd')]['message']);}logger[_0x4fc8('0xd')](_0x4fc8('0xb'),_0x36af17,_0x1cdc74[_0x4fc8('0xd')][_0x4fc8('0xf')]);return _0x12d75c(_0x1cdc74[_0x4fc8('0xd')][_0x4fc8('0xf')]);}else{logger[_0x4fc8('0xa')](_0x4fc8('0xb'),_0x36af17,'request\x20sent');_0x12d75c(_0x1cdc74[_0x4fc8('0x10')][_0x4fc8('0xf')]);}})[_0x4fc8('0x11')](function(_0x56ed69){logger[_0x4fc8('0xd')](_0x4fc8('0xb'),_0x36af17,_0x56ed69);_0x586802(_0x56ed69);});});} \ No newline at end of file +var _0x304d=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','JscriptySessionReport,\x20%s,\x20%s','JscriptySessionReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x304d,0xd2));var _0xd304=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x304d[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xd304('0x0'));var util=require(_0xd304('0x1'));var moment=require(_0xd304('0x2'));var BPromise=require(_0xd304('0x3'));var rs=require(_0xd304('0x4'));var fs=require('fs');var Redis=require(_0xd304('0x5'));var db=require(_0xd304('0x6'))['db'];var utils=require(_0xd304('0x7'));var logger=require(_0xd304('0x8'))(_0xd304('0x9'));var config=require('../../config/environment');var jayson=require(_0xd304('0xa'));var client=jayson[_0xd304('0xb')][_0xd304('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2dc7f7,_0x2edf84,_0x44357d){return new BPromise(function(_0x51604b,_0x443b5a){return client[_0xd304('0xd')](_0x2dc7f7,_0x44357d)[_0xd304('0xe')](function(_0x544f0a){logger[_0xd304('0xf')](_0xd304('0x10'),_0x2edf84,'request\x20sent');logger['debug'](_0xd304('0x11'),_0x2edf84,_0xd304('0x12'),JSON[_0xd304('0x13')](_0x544f0a));if(_0x544f0a[_0xd304('0x14')]){if(_0x544f0a['error'][_0xd304('0x15')]===0x1f4){logger[_0xd304('0x14')]('JscriptySessionReport,\x20%s,\x20%s',_0x2edf84,_0x544f0a[_0xd304('0x14')][_0xd304('0x16')]);return _0x443b5a(_0x544f0a[_0xd304('0x14')][_0xd304('0x16')]);}logger['error'](_0xd304('0x10'),_0x2edf84,_0x544f0a[_0xd304('0x14')][_0xd304('0x16')]);return _0x51604b(_0x544f0a['error'][_0xd304('0x16')]);}else{logger[_0xd304('0xf')](_0xd304('0x10'),_0x2edf84,_0xd304('0x12'));_0x51604b(_0x544f0a['result'][_0xd304('0x16')]);}})[_0xd304('0x17')](function(_0x872bbc){logger['error'](_0xd304('0x10'),_0x2edf84,_0x872bbc);_0x443b5a(_0x872bbc);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 08e3c51..9508a8f 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 _0xf378=['/:id','update','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','put'];(function(_0x38c5a5,_0x30842e){var _0x26315f=function(_0x46de5a){while(--_0x46de5a){_0x38c5a5['push'](_0x38c5a5['shift']());}};_0x26315f(++_0x30842e);}(_0xf378,0x1f0));var _0x8f37=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0xf378[_0x36c5b0];return _0xf19333;};'use strict';var multer=require(_0x8f37('0x0'));var util=require(_0x8f37('0x1'));var path=require(_0x8f37('0x2'));var timeout=require(_0x8f37('0x3'));var express=require(_0x8f37('0x4'));var router=express[_0x8f37('0x5')]();var auth=require(_0x8f37('0x6'));var interaction=require(_0x8f37('0x7'));var config=require(_0x8f37('0x8'));var controller=require('./license.controller');router[_0x8f37('0x9')]('/',controller['index']);router[_0x8f37('0xa')](_0x8f37('0xb'),auth['isAuthenticated'](),controller[_0x8f37('0xc')]);module['exports']=router; \ No newline at end of file +var _0x01f4=['/:id','isAuthenticated','update','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./license.controller','get','index'];(function(_0x58e242,_0x17b6ef){var _0xb5c4cc=function(_0x3bcd9a){while(--_0x3bcd9a){_0x58e242['push'](_0x58e242['shift']());}};_0xb5c4cc(++_0x17b6ef);}(_0x01f4,0xed));var _0x401f=function(_0xc4f6b9,_0x11a4d5){_0xc4f6b9=_0xc4f6b9-0x0;var _0x592f32=_0x01f4[_0xc4f6b9];return _0x592f32;};'use strict';var multer=require(_0x401f('0x0'));var util=require(_0x401f('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x401f('0x2'));var router=express[_0x401f('0x3')]();var auth=require(_0x401f('0x4'));var interaction=require(_0x401f('0x5'));var config=require(_0x401f('0x6'));var controller=require(_0x401f('0x7'));router[_0x401f('0x8')]('/',controller[_0x401f('0x9')]);router['put'](_0x401f('0xa'),auth[_0x401f('0xb')](),controller[_0x401f('0xc')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 4c692af..cd4c8b3 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 _0x46ed=['sequelize','exports','STRING','INTEGER'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_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 +var _0x0295=['sequelize','STRING'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x0295,0x1f0));var _0x5029=function(_0x51fd25,_0x2fcbb){_0x51fd25=_0x51fd25-0x0;var _0x4529ae=_0x0295[_0x51fd25];return _0x4529ae;};'use strict';var Sequelize=require(_0x5029('0x0'));module['exports']={'license':{'type':Sequelize['TEXT']},'data1':{'type':Sequelize[_0x5029('0x1')]},'data2':{'type':Sequelize['STRING']},'chatLicenseExceeded':{'type':Sequelize['INTEGER'],'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 663c7e8..55f3ebd 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 _0x052f=['ejs','lodash','squel','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','model','keys','rawAttributes','query','filters','attributes','intersection','fields','length','options','catch','body','License','find','params','checkLicense','key','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox'];(function(_0x243871,_0x2369ce){var _0x1baee1=function(_0x4e19ad){while(--_0x4e19ad){_0x243871['push'](_0x243871['shift']());}};_0x1baee1(++_0x2369ce);}(_0x052f,0x6b));var _0xf052=function(_0x16df5d,_0xb082bf){_0x16df5d=_0x16df5d-0x0;var _0x5d5694=_0x052f[_0x16df5d];return _0x5d5694;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xf052('0x0'));var rimraf=require(_0xf052('0x1'));var zipdir=require(_0xf052('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf052('0x3'));var moment=require('moment');var BPromise=require(_0xf052('0x4'));var Mustache=require(_0xf052('0x5'));var util=require(_0xf052('0x6'));var path=require(_0xf052('0x7'));var sox=require(_0xf052('0x8'));var csv=require('to-csv');var ejs=require(_0xf052('0x9'));var fs=require('fs');var _=require(_0xf052('0xa'));var squel=require(_0xf052('0xb'));var crypto=require('crypto');var jsforce=require(_0xf052('0xc'));var deskjs=require(_0xf052('0xd'));var toCsv=require(_0xf052('0xe'));var querystring=require('querystring');var Papa=require(_0xf052('0xf'));var Redis=require(_0xf052('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xf052('0x11'));var hardwareService=require(_0xf052('0x12'));var logger=require(_0xf052('0x13'))('api');var utils=require(_0xf052('0x14'));var config=require(_0xf052('0x15'));var db=require(_0xf052('0x16'))['db'];function respondWithStatusCode(_0x4c507e,_0x42734a){_0x42734a=_0x42734a||0xcc;return function(_0x52b4fb){if(_0x52b4fb){return _0x4c507e[_0xf052('0x17')](_0x42734a);}return _0x4c507e['status'](_0x42734a)[_0xf052('0x18')]();};}function respondWithResult(_0x32d1a1,_0x17b2f7){_0x17b2f7=_0x17b2f7||0xc8;return function(_0x1cd9ab){if(_0x1cd9ab){return _0x32d1a1[_0xf052('0x19')](_0x17b2f7)[_0xf052('0x1a')](_0x1cd9ab);}};}function respondWithFilteredResult(_0x3d2b4d,_0xd5ed75){return function(_0x2f15fe){if(_0x2f15fe){var _0x7cdef7=_0x2f15fe[_0xf052('0x1b')],_0x26754e=_0xd5ed75['offset'],_0x72d497=_0xd5ed75['offset']+_0xd5ed75[_0xf052('0x1c')],_0x4311ee;if(_0x72d497>=_0x7cdef7){_0x72d497=_0x7cdef7;_0x4311ee=0xc8;}else{_0x4311ee=0xce;}_0x3d2b4d['status'](_0x4311ee);return _0x3d2b4d[_0xf052('0x1d')](_0xf052('0x1e'),_0x26754e+'-'+_0x72d497+'/'+_0x7cdef7)[_0xf052('0x1a')](_0x2f15fe);}return null;};}function patchUpdates(_0x4bf2a){return function(_0xe3bfc9){try{jsonpatch[_0xf052('0x1f')](_0xe3bfc9,_0x4bf2a,!![]);}catch(_0x4b799c){return BPromise[_0xf052('0x20')](_0x4b799c);}return _0xe3bfc9[_0xf052('0x21')]();};}function saveUpdates(_0x98d12c,_0x1475db){return function(_0x140c73){if(_0x140c73){return _0x140c73[_0xf052('0x22')](_0x98d12c)[_0xf052('0x23')](function(_0x35a137){return _0x35a137;});}return null;};}function removeEntity(_0x2e4b24,_0x4b00e9){return function(_0x16bab4){if(_0x16bab4){return _0x16bab4[_0xf052('0x24')]()[_0xf052('0x23')](function(){_0x2e4b24[_0xf052('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x223abf,_0x4f5cdd){return function(_0x4a9f1d){if(!_0x4a9f1d){_0x223abf[_0xf052('0x17')](0x194);}return _0x4a9f1d;};}function handleError(_0x420bc4,_0xa74d41){_0xa74d41=_0xa74d41||0x1f4;return function(_0x1d1baf){logger[_0xf052('0x25')](_0x1d1baf['stack']);if(_0x1d1baf[_0xf052('0x26')]){delete _0x1d1baf[_0xf052('0x26')];}_0x420bc4[_0xf052('0x19')](_0xa74d41)[_0xf052('0x27')](_0x1d1baf);};}var utilLicense=require('../../config/license/util');exports[_0xf052('0x28')]=function(_0x424a5c,_0x34a6df){var _0x4d2fac={'raw':!![],'where':{'id':0x1}},_0x189c1e={};_0x189c1e[_0xf052('0x29')]=_[_0xf052('0x2a')](db['License'][_0xf052('0x2b')]);_0x189c1e[_0xf052('0x2c')]=_[_0xf052('0x2a')](_0x424a5c['query']);_0x189c1e[_0xf052('0x2d')]=_['intersection'](_0x189c1e[_0xf052('0x29')],_0x189c1e['query']);_0x4d2fac[_0xf052('0x2e')]=_[_0xf052('0x2f')](_0x189c1e[_0xf052('0x29')],qs[_0xf052('0x30')](_0x424a5c[_0xf052('0x2c')][_0xf052('0x30')]));_0x4d2fac[_0xf052('0x2e')]=_0x4d2fac['attributes'][_0xf052('0x31')]?_0x4d2fac[_0xf052('0x2e')]:_0x189c1e[_0xf052('0x29')];_0x4d2fac=_['merge']({},_0x4d2fac,_0x424a5c[_0xf052('0x32')]);return utilLicense['getLicense'](_0x4d2fac)[_0xf052('0x23')](respondWithResult(_0x34a6df,null))[_0xf052('0x33')](handleError(_0x34a6df,null));};exports['update']=function(_0x351c3d,_0x22a37f){if(_0x351c3d[_0xf052('0x34')]['id']){delete _0x351c3d[_0xf052('0x34')]['id'];}return db[_0xf052('0x35')][_0xf052('0x36')]({'where':{'id':_0x351c3d[_0xf052('0x37')]['id']}})['then'](handleEntityNotFound(_0x22a37f,null))[_0xf052('0x23')](function(_0x9266ef){var _0x356f54=_0x9266ef['get']({'plain':!![]});return utilLicense[_0xf052('0x38')](_0x356f54,_0x351c3d['body'][_0xf052('0x39')]);})[_0xf052('0x23')](function(_0x4b48b2){if(!_0x4b48b2['demo']){return saveUpdates(_0x351c3d['body'],null);}return _0x4b48b2;})[_0xf052('0x23')](respondWithResult(_0x22a37f,null))['catch'](handleError(_0x22a37f,null));}; \ No newline at end of file +var _0xe558=['checkLicense','body','key','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','apply','save','update','then','end','error','stack','name','send','../../config/license/util','index','keys','rawAttributes','query','filters','intersection','model','attributes','fields','length','merge','options','getLicense','catch','License','find','params','get'];(function(_0x404cde,_0x27b51c){var _0x139882=function(_0x1f31d1){while(--_0x1f31d1){_0x404cde['push'](_0x404cde['shift']());}};_0x139882(++_0x27b51c);}(_0xe558,0x13e));var _0x8e55=function(_0x5649ef,_0x3745d5){_0x5649ef=_0x5649ef-0x0;var _0x97109=_0xe558[_0x5649ef];return _0x97109;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8e55('0x0'));var rimraf=require(_0x8e55('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8e55('0x2'));var rp=require(_0x8e55('0x3'));var moment=require(_0x8e55('0x4'));var BPromise=require(_0x8e55('0x5'));var Mustache=require(_0x8e55('0x6'));var util=require('util');var path=require(_0x8e55('0x7'));var sox=require(_0x8e55('0x8'));var csv=require(_0x8e55('0x9'));var ejs=require(_0x8e55('0xa'));var fs=require('fs');var _=require(_0x8e55('0xb'));var squel=require('squel');var crypto=require(_0x8e55('0xc'));var jsforce=require(_0x8e55('0xd'));var deskjs=require(_0x8e55('0xe'));var toCsv=require(_0x8e55('0x9'));var querystring=require(_0x8e55('0xf'));var Papa=require(_0x8e55('0x10'));var Redis=require(_0x8e55('0x11'));var authService=require(_0x8e55('0x12'));var qs=require(_0x8e55('0x13'));var as=require(_0x8e55('0x14'));var hardwareService=require(_0x8e55('0x15'));var logger=require(_0x8e55('0x16'))('api');var utils=require(_0x8e55('0x17'));var config=require(_0x8e55('0x18'));var db=require(_0x8e55('0x19'))['db'];function respondWithStatusCode(_0x4a827b,_0x490571){_0x490571=_0x490571||0xcc;return function(_0x428076){if(_0x428076){return _0x4a827b[_0x8e55('0x1a')](_0x490571);}return _0x4a827b[_0x8e55('0x1b')](_0x490571)['end']();};}function respondWithResult(_0x57a06e,_0x4ec72c){_0x4ec72c=_0x4ec72c||0xc8;return function(_0x1700f7){if(_0x1700f7){return _0x57a06e['status'](_0x4ec72c)[_0x8e55('0x1c')](_0x1700f7);}};}function respondWithFilteredResult(_0x190bba,_0x20de6e){return function(_0x590e15){if(_0x590e15){var _0x3b33bf=_0x590e15[_0x8e55('0x1d')],_0x597dc2=_0x20de6e[_0x8e55('0x1e')],_0x4fe050=_0x20de6e[_0x8e55('0x1e')]+_0x20de6e[_0x8e55('0x1f')],_0x27aabe;if(_0x4fe050>=_0x3b33bf){_0x4fe050=_0x3b33bf;_0x27aabe=0xc8;}else{_0x27aabe=0xce;}_0x190bba[_0x8e55('0x1b')](_0x27aabe);return _0x190bba['set']('Content-Range',_0x597dc2+'-'+_0x4fe050+'/'+_0x3b33bf)[_0x8e55('0x1c')](_0x590e15);}return null;};}function patchUpdates(_0x13497b){return function(_0x549ebe){try{jsonpatch[_0x8e55('0x20')](_0x549ebe,_0x13497b,!![]);}catch(_0xde0c4f){return BPromise['reject'](_0xde0c4f);}return _0x549ebe[_0x8e55('0x21')]();};}function saveUpdates(_0x5cf703,_0x3235fd){return function(_0x353b7f){if(_0x353b7f){return _0x353b7f[_0x8e55('0x22')](_0x5cf703)[_0x8e55('0x23')](function(_0x80ba9f){return _0x80ba9f;});}return null;};}function removeEntity(_0x45ad2b,_0xe25622){return function(_0x470be5){if(_0x470be5){return _0x470be5['destroy']()['then'](function(){_0x45ad2b[_0x8e55('0x1b')](0xcc)[_0x8e55('0x24')]();});}};}function handleEntityNotFound(_0x45424e,_0xd48a6c){return function(_0x442b71){if(!_0x442b71){_0x45424e['sendStatus'](0x194);}return _0x442b71;};}function handleError(_0x596a82,_0x3ec7de){_0x3ec7de=_0x3ec7de||0x1f4;return function(_0x160d4d){logger[_0x8e55('0x25')](_0x160d4d[_0x8e55('0x26')]);if(_0x160d4d['name']){delete _0x160d4d[_0x8e55('0x27')];}_0x596a82[_0x8e55('0x1b')](_0x3ec7de)[_0x8e55('0x28')](_0x160d4d);};}var utilLicense=require(_0x8e55('0x29'));exports[_0x8e55('0x2a')]=function(_0x4f3feb,_0x530837){var _0x4ffaa0={'raw':!![],'where':{'id':0x1}},_0x1e8e3e={};_0x1e8e3e['model']=_[_0x8e55('0x2b')](db['License'][_0x8e55('0x2c')]);_0x1e8e3e[_0x8e55('0x2d')]=_[_0x8e55('0x2b')](_0x4f3feb[_0x8e55('0x2d')]);_0x1e8e3e[_0x8e55('0x2e')]=_[_0x8e55('0x2f')](_0x1e8e3e[_0x8e55('0x30')],_0x1e8e3e[_0x8e55('0x2d')]);_0x4ffaa0[_0x8e55('0x31')]=_[_0x8e55('0x2f')](_0x1e8e3e[_0x8e55('0x30')],qs[_0x8e55('0x32')](_0x4f3feb[_0x8e55('0x2d')][_0x8e55('0x32')]));_0x4ffaa0['attributes']=_0x4ffaa0[_0x8e55('0x31')][_0x8e55('0x33')]?_0x4ffaa0['attributes']:_0x1e8e3e['model'];_0x4ffaa0=_[_0x8e55('0x34')]({},_0x4ffaa0,_0x4f3feb[_0x8e55('0x35')]);return utilLicense[_0x8e55('0x36')](_0x4ffaa0)[_0x8e55('0x23')](respondWithResult(_0x530837,null))[_0x8e55('0x37')](handleError(_0x530837,null));};exports[_0x8e55('0x22')]=function(_0x58fc14,_0x192195){if(_0x58fc14['body']['id']){delete _0x58fc14['body']['id'];}return db[_0x8e55('0x38')][_0x8e55('0x39')]({'where':{'id':_0x58fc14[_0x8e55('0x3a')]['id']}})[_0x8e55('0x23')](handleEntityNotFound(_0x192195,null))[_0x8e55('0x23')](function(_0x3ad427){var _0xfb925b=_0x3ad427[_0x8e55('0x3b')]({'plain':!![]});return utilLicense[_0x8e55('0x3c')](_0xfb925b,_0x58fc14[_0x8e55('0x3d')][_0x8e55('0x3e')]);})[_0x8e55('0x23')](function(_0x5ba551){if(!_0x5ba551['demo']){return saveUpdates(_0x58fc14[_0x8e55('0x3d')],null);}return _0x5ba551;})['then'](respondWithResult(_0x192195,null))['catch'](handleError(_0x192195,null));}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 1092984..425602e 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 _0xfc76=['license','util','../../config/logger','api','moment','bluebird','path','rimraf','./license.attributes','define'];(function(_0x5f4537,_0x278cc3){var _0x2e82f3=function(_0x493142){while(--_0x493142){_0x5f4537['push'](_0x5f4537['shift']());}};_0x2e82f3(++_0x278cc3);}(_0xfc76,0xb5));var _0x6fc7=function(_0x6dbdde,_0x47e1e3){_0x6dbdde=_0x6dbdde-0x0;var _0x55787a=_0xfc76[_0x6dbdde];return _0x55787a;};'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')]('License',attributes,{'tableName':_0x6fc7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9ac9=['License','lodash','../../config/logger','api','moment','bluebird','path','../../config/environment','./license.attributes','exports','define'];(function(_0x2d45f7,_0x2b9673){var _0x3757b3=function(_0x12c4ef){while(--_0x12c4ef){_0x2d45f7['push'](_0x2d45f7['shift']());}};_0x3757b3(++_0x2b9673);}(_0x9ac9,0x1b9));var _0x99ac=function(_0x1ccf71,_0x4d574c){_0x1ccf71=_0x1ccf71-0x0;var _0xaaf685=_0x9ac9[_0x1ccf71];return _0xaaf685;};'use strict';var _=require(_0x99ac('0x0'));var util=require('util');var logger=require(_0x99ac('0x1'))(_0x99ac('0x2'));var moment=require(_0x99ac('0x3'));var BPromise=require(_0x99ac('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x99ac('0x5'));var rimraf=require('rimraf');var config=require(_0x99ac('0x6'));var attributes=require(_0x99ac('0x7'));module[_0x99ac('0x8')]=function(_0xaf1fff,_0x2cfb38){return _0xaf1fff[_0x99ac('0x9')](_0x99ac('0xa'),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 1e2e8b7..d7b6949 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 _0x710e=['result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','http','info','License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x40f873,_0x361d57){var _0x3efb4a=function(_0x24695f){while(--_0x24695f){_0x40f873['push'](_0x40f873['shift']());}};_0x3efb4a(++_0x361d57);}(_0x710e,0xb6));var _0xe710=function(_0x345d4d,_0x203ce0){_0x345d4d=_0x345d4d-0x0;var _0x1fadf0=_0x710e[_0x345d4d];return _0x1fadf0;};'use strict';var _=require(_0xe710('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xe710('0x1'));var rs=require(_0xe710('0x2'));var fs=require('fs');var Redis=require(_0xe710('0x3'));var db=require(_0xe710('0x4'))['db'];var utils=require(_0xe710('0x5'));var logger=require('../../config/logger')(_0xe710('0x6'));var config=require(_0xe710('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xe710('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x302291,_0x205db2,_0x211a33){return new BPromise(function(_0xf86a0f,_0x19ab1d){return client['request'](_0x302291,_0x211a33)['then'](function(_0x58d510){logger[_0xe710('0x9')](_0xe710('0xa'),_0x205db2,_0xe710('0xb'));logger[_0xe710('0xc')](_0xe710('0xd'),_0x205db2,_0xe710('0xb'),JSON[_0xe710('0xe')](_0x58d510));if(_0x58d510[_0xe710('0xf')]){if(_0x58d510[_0xe710('0xf')][_0xe710('0x10')]===0x1f4){logger[_0xe710('0xf')](_0xe710('0xa'),_0x205db2,_0x58d510[_0xe710('0xf')]['message']);return _0x19ab1d(_0x58d510['error'][_0xe710('0x11')]);}logger[_0xe710('0xf')](_0xe710('0xa'),_0x205db2,_0x58d510[_0xe710('0xf')][_0xe710('0x11')]);return _0xf86a0f(_0x58d510[_0xe710('0xf')]['message']);}else{logger[_0xe710('0x9')](_0xe710('0xa'),_0x205db2,_0xe710('0xb'));_0xf86a0f(_0x58d510[_0xe710('0x12')][_0xe710('0x11')]);}})[_0xe710('0x13')](function(_0x39bdf7){logger[_0xe710('0xf')](_0xe710('0xa'),_0x205db2,_0x39bdf7);_0x19ab1d(_0x39bdf7);});});} \ No newline at end of file +var _0xbee3=['error','code','message','catch','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s'];(function(_0x3e70dd,_0x5f4fdd){var _0x4e26fd=function(_0x3714e){while(--_0x3714e){_0x3e70dd['push'](_0x3e70dd['shift']());}};_0x4e26fd(++_0x5f4fdd);}(_0xbee3,0xd5));var _0x3bee=function(_0x1e62d1,_0x2e53a3){_0x1e62d1=_0x1e62d1-0x0;var _0x560ed8=_0xbee3[_0x1e62d1];return _0x560ed8;};'use strict';var _=require('lodash');var util=require(_0x3bee('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x3bee('0x1'));var fs=require('fs');var Redis=require(_0x3bee('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x3bee('0x3'));var logger=require(_0x3bee('0x4'))(_0x3bee('0x5'));var config=require('../../config/environment');var jayson=require(_0x3bee('0x6'));var client=jayson[_0x3bee('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2fdeec,_0x28d912,_0x1b510d){return new BPromise(function(_0x339223,_0xbdd5d5){return client[_0x3bee('0x8')](_0x2fdeec,_0x1b510d)[_0x3bee('0x9')](function(_0x518e2d){logger[_0x3bee('0xa')](_0x3bee('0xb'),_0x28d912,_0x3bee('0xc'));logger[_0x3bee('0xd')](_0x3bee('0xe'),_0x28d912,_0x3bee('0xc'),JSON['stringify'](_0x518e2d));if(_0x518e2d[_0x3bee('0xf')]){if(_0x518e2d['error'][_0x3bee('0x10')]===0x1f4){logger[_0x3bee('0xf')](_0x3bee('0xb'),_0x28d912,_0x518e2d[_0x3bee('0xf')][_0x3bee('0x11')]);return _0xbdd5d5(_0x518e2d[_0x3bee('0xf')][_0x3bee('0x11')]);}logger['error'](_0x3bee('0xb'),_0x28d912,_0x518e2d[_0x3bee('0xf')][_0x3bee('0x11')]);return _0x339223(_0x518e2d[_0x3bee('0xf')][_0x3bee('0x11')]);}else{logger['info']('License,\x20%s,\x20%s',_0x28d912,_0x3bee('0xc'));_0x339223(_0x518e2d['result'][_0x3bee('0x11')]);}})[_0x3bee('0x12')](function(_0x57d42c){logger['error'](_0x3bee('0xb'),_0x28d912,_0x57d42c);_0xbdd5d5(_0x57d42c);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index cc000ad..255bd69 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 _0x5fda=['/:id/messages','getMessages','/:id/verify','verifySmtp','/:id/users','getAgents','post','addDisposition','create','addImap','/:id/out_servers','send','addAgents','put','update','delete','removeDispositions','removeAnswers','removeSmtp','destroy','removeAgents','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','isAuthenticated','index','get','/describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getSmtp','/:id/interactions','getInteractions','/:id/applications','getApplications'];(function(_0x1fb312,_0x5984bd){var _0x3c1217=function(_0x5baa05){while(--_0x5baa05){_0x1fb312['push'](_0x1fb312['shift']());}};_0x3c1217(++_0x5984bd);}(_0x5fda,0x130));var _0xa5fd=function(_0x5b88f1,_0x9555f0){_0x5b88f1=_0x5b88f1-0x0;var _0x41f6c2=_0x5fda[_0x5b88f1];return _0x41f6c2;};'use strict';var multer=require(_0xa5fd('0x0'));var util=require(_0xa5fd('0x1'));var path=require('path');var timeout=require(_0xa5fd('0x2'));var express=require(_0xa5fd('0x3'));var router=express[_0xa5fd('0x4')]();var auth=require(_0xa5fd('0x5'));var interaction=require(_0xa5fd('0x6'));var config=require(_0xa5fd('0x7'));var controller=require(_0xa5fd('0x8'));router['get']('/',auth[_0xa5fd('0x9')](),controller[_0xa5fd('0xa')]);router[_0xa5fd('0xb')](_0xa5fd('0xc'),auth[_0xa5fd('0x9')](),controller['describe']);router[_0xa5fd('0xb')](_0xa5fd('0xd'),auth[_0xa5fd('0x9')](),controller[_0xa5fd('0xe')]);router[_0xa5fd('0xb')](_0xa5fd('0xf'),auth[_0xa5fd('0x9')](),controller[_0xa5fd('0x10')]);router[_0xa5fd('0xb')](_0xa5fd('0x11'),auth['isAuthenticated'](),controller[_0xa5fd('0x12')]);router[_0xa5fd('0xb')](_0xa5fd('0x13'),auth['isAuthenticated'](),controller['getImap']);router['get']('/:id/out_servers',auth[_0xa5fd('0x9')](),controller[_0xa5fd('0x14')]);router[_0xa5fd('0xb')](_0xa5fd('0x15'),auth['isAuthenticated'](),controller[_0xa5fd('0x16')]);router['get'](_0xa5fd('0x17'),auth['isAuthenticated'](),controller[_0xa5fd('0x18')]);router[_0xa5fd('0xb')](_0xa5fd('0x19'),auth['isAuthenticated'](),controller[_0xa5fd('0x1a')]);router['get'](_0xa5fd('0x1b'),auth[_0xa5fd('0x9')](),controller[_0xa5fd('0x1c')]);router[_0xa5fd('0xb')](_0xa5fd('0x1d'),auth[_0xa5fd('0x9')](),controller[_0xa5fd('0x1e')]);router[_0xa5fd('0x1f')](_0xa5fd('0xf'),auth[_0xa5fd('0x9')](),controller[_0xa5fd('0x20')]);router[_0xa5fd('0x1f')](_0xa5fd('0x11'),auth['isAuthenticated'](),controller['addAnswer']);router['post']('/',auth[_0xa5fd('0x9')](),controller[_0xa5fd('0x21')]);router[_0xa5fd('0x1f')](_0xa5fd('0x13'),auth[_0xa5fd('0x9')](),controller[_0xa5fd('0x22')]);router[_0xa5fd('0x1f')](_0xa5fd('0x23'),auth[_0xa5fd('0x9')](),controller['addSmtp']);router[_0xa5fd('0x1f')](_0xa5fd('0x15'),auth[_0xa5fd('0x9')](),controller['addInteraction']);router[_0xa5fd('0x1f')]('/:id/applications',auth[_0xa5fd('0x9')](),controller['addApplications']);router[_0xa5fd('0x1f')]('/:id/send',auth[_0xa5fd('0x9')](),controller[_0xa5fd('0x24')]);router['post'](_0xa5fd('0x1d'),auth[_0xa5fd('0x9')](),controller[_0xa5fd('0x25')]);router[_0xa5fd('0x26')](_0xa5fd('0xd'),auth[_0xa5fd('0x9')](),controller[_0xa5fd('0x27')]);router[_0xa5fd('0x28')]('/:id/dispositions',auth[_0xa5fd('0x9')](),controller[_0xa5fd('0x29')]);router[_0xa5fd('0x28')](_0xa5fd('0x11'),auth[_0xa5fd('0x9')](),controller[_0xa5fd('0x2a')]);router[_0xa5fd('0x28')]('/:id/in_servers',auth[_0xa5fd('0x9')](),controller['removeImap']);router[_0xa5fd('0x28')](_0xa5fd('0x23'),auth[_0xa5fd('0x9')](),controller[_0xa5fd('0x2b')]);router[_0xa5fd('0x28')](_0xa5fd('0xd'),auth[_0xa5fd('0x9')](),controller[_0xa5fd('0x2c')]);router[_0xa5fd('0x28')](_0xa5fd('0x1d'),auth[_0xa5fd('0x9')](),controller[_0xa5fd('0x2d')]);module[_0xa5fd('0x2e')]=router; \ No newline at end of file +var _0xa1a1=['getDispositions','/:id/out_servers','getSmtp','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/verify','/:id/users','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','create','/:id/interactions','addInteraction','addApplications','/:id/send','addAgents','put','delete','/:id/in_servers','removeImap','removeSmtp','destroy','removeAgents','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/dispositions'];(function(_0x1c4085,_0x3ccc32){var _0x1a7022=function(_0x2d3c63){while(--_0x2d3c63){_0x1c4085['push'](_0x1c4085['shift']());}};_0x1a7022(++_0x3ccc32);}(_0xa1a1,0x72));var _0x1a1a=function(_0x142020,_0x1f7233){_0x142020=_0x142020-0x0;var _0x40da8f=_0xa1a1[_0x142020];return _0x40da8f;};'use strict';var multer=require(_0x1a1a('0x0'));var util=require(_0x1a1a('0x1'));var path=require(_0x1a1a('0x2'));var timeout=require(_0x1a1a('0x3'));var express=require(_0x1a1a('0x4'));var router=express['Router']();var auth=require(_0x1a1a('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x1a1a('0x6'));var controller=require('./mailAccount.controller');router[_0x1a1a('0x7')]('/',auth['isAuthenticated'](),controller[_0x1a1a('0x8')]);router['get'](_0x1a1a('0x9'),auth[_0x1a1a('0xa')](),controller[_0x1a1a('0xb')]);router[_0x1a1a('0x7')](_0x1a1a('0xc'),auth['isAuthenticated'](),controller[_0x1a1a('0xd')]);router['get'](_0x1a1a('0xe'),auth[_0x1a1a('0xa')](),controller[_0x1a1a('0xf')]);router['get']('/:id/canned_answers',auth[_0x1a1a('0xa')](),controller['getAnswers']);router[_0x1a1a('0x7')]('/:id/in_servers',auth[_0x1a1a('0xa')](),controller['getImap']);router['get'](_0x1a1a('0x10'),auth[_0x1a1a('0xa')](),controller[_0x1a1a('0x11')]);router[_0x1a1a('0x7')]('/:id/interactions',auth[_0x1a1a('0xa')](),controller[_0x1a1a('0x12')]);router[_0x1a1a('0x7')](_0x1a1a('0x13'),auth[_0x1a1a('0xa')](),controller[_0x1a1a('0x14')]);router[_0x1a1a('0x7')](_0x1a1a('0x15'),auth['isAuthenticated'](),controller[_0x1a1a('0x16')]);router[_0x1a1a('0x7')](_0x1a1a('0x17'),auth[_0x1a1a('0xa')](),controller['verifySmtp']);router['get'](_0x1a1a('0x18'),auth[_0x1a1a('0xa')](),controller[_0x1a1a('0x19')]);router[_0x1a1a('0x1a')](_0x1a1a('0xe'),auth[_0x1a1a('0xa')](),controller[_0x1a1a('0x1b')]);router[_0x1a1a('0x1a')](_0x1a1a('0x1c'),auth[_0x1a1a('0xa')](),controller[_0x1a1a('0x1d')]);router[_0x1a1a('0x1a')]('/',auth[_0x1a1a('0xa')](),controller[_0x1a1a('0x1e')]);router[_0x1a1a('0x1a')]('/:id/in_servers',auth[_0x1a1a('0xa')](),controller['addImap']);router['post'](_0x1a1a('0x10'),auth['isAuthenticated'](),controller['addSmtp']);router['post'](_0x1a1a('0x1f'),auth['isAuthenticated'](),controller[_0x1a1a('0x20')]);router['post']('/:id/applications',auth[_0x1a1a('0xa')](),controller[_0x1a1a('0x21')]);router[_0x1a1a('0x1a')](_0x1a1a('0x22'),auth[_0x1a1a('0xa')](),controller['send']);router[_0x1a1a('0x1a')](_0x1a1a('0x18'),auth[_0x1a1a('0xa')](),controller[_0x1a1a('0x23')]);router[_0x1a1a('0x24')](_0x1a1a('0xc'),auth[_0x1a1a('0xa')](),controller['update']);router[_0x1a1a('0x25')](_0x1a1a('0xe'),auth[_0x1a1a('0xa')](),controller['removeDispositions']);router[_0x1a1a('0x25')](_0x1a1a('0x1c'),auth[_0x1a1a('0xa')](),controller['removeAnswers']);router[_0x1a1a('0x25')](_0x1a1a('0x26'),auth['isAuthenticated'](),controller[_0x1a1a('0x27')]);router[_0x1a1a('0x25')]('/:id/out_servers',auth[_0x1a1a('0xa')](),controller[_0x1a1a('0x28')]);router['delete'](_0x1a1a('0xc'),auth[_0x1a1a('0xa')](),controller[_0x1a1a('0x29')]);router[_0x1a1a('0x25')]('/:id/users',auth[_0x1a1a('0xa')](),controller[_0x1a1a('0x2a')]);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 3cdd31e..11290e6 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 _0x279c=['STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','exports'];(function(_0x2980c4,_0x3940ae){var _0xc5bb32=function(_0x42a599){while(--_0x42a599){_0x2980c4['push'](_0x2980c4['shift']());}};_0xc5bb32(++_0x3940ae);}(_0x279c,0x184));var _0xc279=function(_0x1d24eb,_0x12295b){_0x1d24eb=_0x1d24eb-0x0;var _0x1dc576=_0x279c[_0x1d24eb];return _0x1dc576;};'use strict';var Sequelize=require(_0xc279('0x0'));module[_0xc279('0x1')]={'description':{'type':Sequelize[_0xc279('0x2')]},'name':{'type':Sequelize[_0xc279('0x2')],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0xc279('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0xc279('0x3')],'defaultValue':!![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'template':{'type':Sequelize[_0xc279('0x4')]},'markAsUnread':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fontFamily':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xc279('0x5')},'fontSize':{'type':Sequelize[_0xc279('0x6')](0x2)[_0xc279('0x7')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xc279('0x4')],'defaultValue':function(){return _0xc279('0x8');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xc279('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xc279('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xc279('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xc279('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xc279('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0xc279('0x9')},'mandatoryDisposition':{'type':Sequelize[_0xc279('0x3')],'defaultValue':![],'comment':_0xc279('0xa'),'set':function(_0x4ff0e4){if(!_0x4ff0e4)this[_0xc279('0xb')]('mandatoryDispositionPauseId',null);this[_0xc279('0xb')](_0xc279('0xc'),_0x4ff0e4);}}}; \ No newline at end of file +var _0xbbd7=['TEXT','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','sequelize','exports','STRING','BOOLEAN'];(function(_0x51af02,_0x27fcc7){var _0x25fa6f=function(_0x1ae9ff){while(--_0x1ae9ff){_0x51af02['push'](_0x51af02['shift']());}};_0x25fa6f(++_0x27fcc7);}(_0xbbd7,0x11a));var _0x7bbd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbbd7[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x7bbd('0x0'));module[_0x7bbd('0x1')]={'description':{'type':Sequelize[_0x7bbd('0x2')]},'name':{'type':Sequelize[_0x7bbd('0x2')],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x7bbd('0x3')],'defaultValue':!![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'template':{'type':Sequelize[_0x7bbd('0x4')]},'markAsUnread':{'type':Sequelize[_0x7bbd('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x7bbd('0x2')],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize[_0x7bbd('0x5')](0x2)['UNSIGNED'],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x7bbd('0x4')],'defaultValue':function(){return _0x7bbd('0x6');}},'notificationSound':{'type':Sequelize[_0x7bbd('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x7bbd('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x7bbd('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x7bbd('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x7bbd('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x7bbd('0x5')],'allowNull':!![],'defaultValue':null,'comment':_0x7bbd('0x7')},'mandatoryDisposition':{'type':Sequelize[_0x7bbd('0x3')],'defaultValue':![],'comment':_0x7bbd('0x8'),'set':function(_0x302bdd){if(!_0x302bdd)this[_0x7bbd('0x9')](_0x7bbd('0xa'),null);this['setDataValue']('mandatoryDisposition',_0x302bdd);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 4ca1e1a..ad04cef 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 _0x8bc4=['cpassword','authentication','host','port','service','cuser','role','get','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','omit','CmContact','fullname','Tag','Tags','color','tag','transaction','MailApplication','bulkCreate','priority','getApplications','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','MailMessage','send','CmList','Contacts','updatedAt','DESC','from','%s\x20<%s>','attachments','join','root','server/files/attachments','auth','secure','SendMail','sendMail','List\x20not\x20found','List','messageId','subject','attach','out','Interaction','Messages','verifySmtp','addAgents','emit','userMailAccount:save','removeAgents','userMailAccount:remove','getAgents','eml-format','zip-dir','fast-json-patch','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','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','./mailAccount.socket','register','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','MailAccount,\x20%s,\x20%s','debug','error','code','message','info','result','catch','end','status','json','offset','limit','save','update','MailAccounts','UserProfileResource','destroy','sendStatus','stack','name','index','MailServerIn','Imap','MailServerOut','mandatoryDispositionPause','map','MailAccount','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','findAll','rows','show','params','rawAttributes','include','find','body','Smtp','Pause','describe','Disposition','create','getDispositions','findOne','removeDispositions','ids','addAnswer','CannedAnswer','MailAccountId','removeAnswers','email','ListId','isNil','active','cservice','cauthentication','user','password','pass'];(function(_0x4bee3c,_0xa3439b){var _0x44c98f=function(_0x4dbbe7){while(--_0x4dbbe7){_0x4bee3c['push'](_0x4bee3c['shift']());}};_0x44c98f(++_0xa3439b);}(_0x8bc4,0x1b0));var _0x48bc=function(_0x57562e,_0x5b5895){_0x57562e=_0x57562e-0x0;var _0x12d8f7=_0x8bc4[_0x57562e];return _0x12d8f7;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x48bc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x48bc('0x1'));var jsonpatch=require(_0x48bc('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x48bc('0x3'));var util=require(_0x48bc('0x4'));var path=require(_0x48bc('0x5'));var sox=require(_0x48bc('0x6'));var csv=require(_0x48bc('0x7'));var ejs=require(_0x48bc('0x8'));var fs=require('fs');var _=require(_0x48bc('0x9'));var squel=require(_0x48bc('0xa'));var crypto=require(_0x48bc('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x48bc('0xc'));var toCsv=require(_0x48bc('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x48bc('0xd'));var authService=require(_0x48bc('0xe'));var qs=require(_0x48bc('0xf'));var as=require(_0x48bc('0x10'));var hardwareService=require(_0x48bc('0x11'));var logger=require(_0x48bc('0x12'))(_0x48bc('0x13'));var utils=require(_0x48bc('0x14'));var config=require(_0x48bc('0x15'));var db=require(_0x48bc('0x16'))['db'];config[_0x48bc('0x17')]=_[_0x48bc('0x18')](config[_0x48bc('0x17')],{'host':_0x48bc('0x19'),'port':0x18eb});var socket=require(_0x48bc('0x1a'))(new Redis(config['redis']));require(_0x48bc('0x1b'))[_0x48bc('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x48bc('0x1d')]({'port':0x232b});function checkPasswordPattern(_0x27053e,_0x53db19,_0x58bf7a){if(_0x58bf7a){var _0x2290ec=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2290ec[_0x48bc('0x1e')](_0x53db19)){return _0x27053e;}else{throw new db[(_0x48bc('0x1f'))][(_0x48bc('0x20'))](_0x48bc('0x21'));}}else{return _0x27053e;}}function respondWithRpcPromise(_0x1e9031,_0xd46832,_0x7d422c,_0x14926b){return new BPromise(function(_0x318147,_0x48ed63){var _0x11a5fc=_0x14926b||client;return _0x11a5fc[_0x48bc('0x22')](_0x1e9031,_0x7d422c)[_0x48bc('0x23')](function(_0x29dece){logger['info'](_0x48bc('0x24'),_0xd46832,'request\x20sent');logger[_0x48bc('0x25')]('MailAccount,\x20%s,\x20%s,\x20%s',_0xd46832,'request\x20sent',JSON['stringify'](_0x29dece));if(_0x29dece[_0x48bc('0x26')]){if(_0x29dece[_0x48bc('0x26')][_0x48bc('0x27')]===0x1f4){logger[_0x48bc('0x26')](_0x48bc('0x24'),_0xd46832,_0x29dece[_0x48bc('0x26')][_0x48bc('0x28')]);return _0x48ed63(_0x29dece['error']['message']);}logger[_0x48bc('0x26')](_0x48bc('0x24'),_0xd46832,_0x29dece[_0x48bc('0x26')][_0x48bc('0x28')]);return _0x318147(_0x29dece[_0x48bc('0x26')][_0x48bc('0x28')]);}else{logger[_0x48bc('0x29')](_0x48bc('0x24'),_0xd46832,'request\x20sent');_0x318147(_0x29dece[_0x48bc('0x2a')][_0x48bc('0x28')]);}})[_0x48bc('0x2b')](function(_0x4c6d97){logger['error'](_0x48bc('0x24'),_0xd46832,_0x4c6d97);_0x48ed63(_0x4c6d97);});});}function respondWithStatusCode(_0x441213,_0x9bbab2){_0x9bbab2=_0x9bbab2||0xcc;return function(_0x1269b6){if(_0x1269b6){return _0x441213['sendStatus'](_0x9bbab2);}return _0x441213['status'](_0x9bbab2)[_0x48bc('0x2c')]();};}function respondWithResult(_0x33a2fe,_0x5c32e8){_0x5c32e8=_0x5c32e8||0xc8;return function(_0x157a20){if(_0x157a20){return _0x33a2fe[_0x48bc('0x2d')](_0x5c32e8)[_0x48bc('0x2e')](_0x157a20);}};}function respondWithFilteredResult(_0x111b1e,_0x269b02){return function(_0x2abe54){if(_0x2abe54){var _0x323c84=_0x2abe54['count'],_0x5d7c67=_0x269b02[_0x48bc('0x2f')],_0x252de9=_0x269b02['offset']+_0x269b02[_0x48bc('0x30')],_0x31fe7a;if(_0x252de9>=_0x323c84){_0x252de9=_0x323c84;_0x31fe7a=0xc8;}else{_0x31fe7a=0xce;}_0x111b1e[_0x48bc('0x2d')](_0x31fe7a);return _0x111b1e['set']('Content-Range',_0x5d7c67+'-'+_0x252de9+'/'+_0x323c84)[_0x48bc('0x2e')](_0x2abe54);}return null;};}function patchUpdates(_0x46812f){return function(_0x56787b){try{jsonpatch['apply'](_0x56787b,_0x46812f,!![]);}catch(_0x1a75b9){return BPromise['reject'](_0x1a75b9);}return _0x56787b[_0x48bc('0x31')]();};}function saveUpdates(_0x3334b6,_0x127a6){return function(_0x3e8616){if(_0x3e8616){return _0x3e8616[_0x48bc('0x32')](_0x3334b6)[_0x48bc('0x23')](function(_0x5428b0){return _0x5428b0;});}return null;};}function removeEntity(_0x404b61,_0x4e7c80){return function(_0x1a67b7){if(_0x1a67b7){return _0x1a67b7['destroy']()[_0x48bc('0x23')](function(){var _0x904d22=_0x1a67b7['get']({'plain':!![]});var _0x6b4577=_0x48bc('0x33');return db[_0x48bc('0x34')][_0x48bc('0x35')]({'where':{'type':_0x6b4577,'resourceId':_0x904d22['id']}})[_0x48bc('0x23')](function(){return _0x1a67b7;});})[_0x48bc('0x23')](function(){_0x404b61['status'](0xcc)[_0x48bc('0x2c')]();});}};}function handleEntityNotFound(_0x42f4ca,_0x55b4c2){return function(_0x1aceb2){if(!_0x1aceb2){_0x42f4ca[_0x48bc('0x36')](0x194);}return _0x1aceb2;};}function handleError(_0x191119,_0x5502a9){_0x5502a9=_0x5502a9||0x1f4;return function(_0x197167){logger['error'](_0x197167[_0x48bc('0x37')]);if(_0x197167[_0x48bc('0x38')]){delete _0x197167[_0x48bc('0x38')];}_0x191119[_0x48bc('0x2d')](_0x5502a9)['send'](_0x197167);};}exports[_0x48bc('0x39')]=function(_0x51c70d,_0x1547df){var _0x479bc5={'include':[{'model':db[_0x48bc('0x3a')],'as':_0x48bc('0x3b')},{'model':db[_0x48bc('0x3c')],'as':'Smtp'},{'model':db['Pause'],'as':_0x48bc('0x3d')}]},_0x5b1932={},_0x4a7b69={'count':0x0,'rows':[]};var _0x50451c=_[_0x48bc('0x3e')](db[_0x48bc('0x3f')]['rawAttributes'],function(_0x4e47c8){return{'name':_0x4e47c8[_0x48bc('0x40')],'type':_0x4e47c8[_0x48bc('0x41')][_0x48bc('0x42')]};});_0x5b1932['model']=_[_0x48bc('0x3e')](_0x50451c,'name');_0x5b1932[_0x48bc('0x43')]=_[_0x48bc('0x44')](_0x51c70d[_0x48bc('0x43')]);_0x5b1932[_0x48bc('0x45')]=_[_0x48bc('0x46')](_0x5b1932['model'],_0x5b1932[_0x48bc('0x43')]);_0x479bc5[_0x48bc('0x47')]=_[_0x48bc('0x46')](_0x5b1932[_0x48bc('0x48')],qs['fields'](_0x51c70d[_0x48bc('0x43')][_0x48bc('0x49')]));_0x479bc5[_0x48bc('0x47')]=_0x479bc5[_0x48bc('0x47')][_0x48bc('0x4a')]?_0x479bc5[_0x48bc('0x47')]:_0x5b1932[_0x48bc('0x48')];if(!_0x51c70d[_0x48bc('0x43')][_0x48bc('0x4b')](_0x48bc('0x4c'))){_0x479bc5[_0x48bc('0x30')]=qs[_0x48bc('0x30')](_0x51c70d['query'][_0x48bc('0x30')]);_0x479bc5[_0x48bc('0x2f')]=qs[_0x48bc('0x2f')](_0x51c70d['query'][_0x48bc('0x2f')]);}_0x479bc5[_0x48bc('0x4d')]=qs[_0x48bc('0x4e')](_0x51c70d[_0x48bc('0x43')][_0x48bc('0x4e')]);_0x479bc5[_0x48bc('0x4f')]=qs[_0x48bc('0x45')](_[_0x48bc('0x50')](_0x51c70d[_0x48bc('0x43')],_0x5b1932[_0x48bc('0x45')]),_0x50451c);if(_0x51c70d[_0x48bc('0x43')][_0x48bc('0x51')]){_0x479bc5['where']=_[_0x48bc('0x52')](_0x479bc5[_0x48bc('0x4f')],{'$or':_[_0x48bc('0x3e')](_0x50451c,function(_0x3357bb){if(_0x3357bb['type']!==_0x48bc('0x53')){var _0x1ddd99={};_0x1ddd99[_0x3357bb[_0x48bc('0x38')]]={'$like':'%'+_0x51c70d[_0x48bc('0x43')][_0x48bc('0x51')]+'%'};return _0x1ddd99;}})});}_0x479bc5=_[_0x48bc('0x52')]({},_0x479bc5,_0x51c70d[_0x48bc('0x54')]);var _0x3087d6={'where':_0x479bc5[_0x48bc('0x4f')]};return db['MailAccount'][_0x48bc('0x55')](_0x3087d6)['then'](function(_0x3d8d09){_0x4a7b69[_0x48bc('0x55')]=_0x3d8d09;if(_0x51c70d[_0x48bc('0x43')][_0x48bc('0x56')]){_0x479bc5['include']=[{'all':!![]}];}return db[_0x48bc('0x3f')][_0x48bc('0x57')](_0x479bc5);})[_0x48bc('0x23')](function(_0x359e5f){_0x4a7b69[_0x48bc('0x58')]=_0x359e5f;return _0x4a7b69;})[_0x48bc('0x23')](respondWithFilteredResult(_0x1547df,_0x479bc5))[_0x48bc('0x2b')](handleError(_0x1547df,null));};exports[_0x48bc('0x59')]=function(_0x12fb90,_0x20d3b7){var _0x1fd047={'raw':![],'where':{'id':_0x12fb90[_0x48bc('0x5a')]['id']},'include':[{'model':db[_0x48bc('0x3a')],'as':_0x48bc('0x3b')},{'model':db[_0x48bc('0x3c')],'as':'Smtp'},{'model':db['Pause'],'as':_0x48bc('0x3d')}]},_0xe2f614={};_0xe2f614[_0x48bc('0x48')]=_[_0x48bc('0x44')](db['MailAccount'][_0x48bc('0x5b')]);_0xe2f614['query']=_['keys'](_0x12fb90[_0x48bc('0x43')]);_0xe2f614[_0x48bc('0x45')]=_[_0x48bc('0x46')](_0xe2f614[_0x48bc('0x48')],_0xe2f614[_0x48bc('0x43')]);_0x1fd047[_0x48bc('0x47')]=_[_0x48bc('0x46')](_0xe2f614['model'],qs[_0x48bc('0x49')](_0x12fb90[_0x48bc('0x43')][_0x48bc('0x49')]));_0x1fd047[_0x48bc('0x47')]=_0x1fd047[_0x48bc('0x47')][_0x48bc('0x4a')]?_0x1fd047[_0x48bc('0x47')]:_0xe2f614[_0x48bc('0x48')];if(_0x12fb90['query'][_0x48bc('0x56')]){_0x1fd047[_0x48bc('0x5c')]=[{'all':!![]}];}_0x1fd047=_[_0x48bc('0x52')]({},_0x1fd047,_0x12fb90[_0x48bc('0x54')]);return db[_0x48bc('0x3f')][_0x48bc('0x5d')](_0x1fd047)['then'](handleEntityNotFound(_0x20d3b7,null))[_0x48bc('0x23')](respondWithResult(_0x20d3b7,null))[_0x48bc('0x2b')](handleError(_0x20d3b7,null));};exports['update']=function(_0x3bf11d,_0x48944b){if(_0x3bf11d['body']['id']){delete _0x3bf11d[_0x48bc('0x5e')]['id'];}return db[_0x48bc('0x3f')]['find']({'where':{'id':_0x3bf11d[_0x48bc('0x5a')]['id']},'include':[{'model':db[_0x48bc('0x3a')],'as':_0x48bc('0x3b')},{'model':db['MailServerOut'],'as':_0x48bc('0x5f')},{'model':db[_0x48bc('0x60')],'as':'mandatoryDispositionPause'}]})[_0x48bc('0x23')](handleEntityNotFound(_0x48944b,null))[_0x48bc('0x23')](saveUpdates(_0x3bf11d[_0x48bc('0x5e')],null))[_0x48bc('0x23')](function(_0x2459f3){if(_0x2459f3&&_0x3bf11d[_0x48bc('0x5e')][_0x48bc('0x3b')]){return db[_0x48bc('0x3a')][_0x48bc('0x32')](_0x3bf11d['body'][_0x48bc('0x3b')],{'where':{'MailAccountId':_0x2459f3['id']}})[_0x48bc('0x23')](function(){return _0x2459f3;});}return _0x2459f3;})[_0x48bc('0x23')](function(_0x4e151e){if(_0x4e151e&&_0x3bf11d[_0x48bc('0x5e')][_0x48bc('0x5f')]){return db[_0x48bc('0x3c')][_0x48bc('0x32')](_0x3bf11d[_0x48bc('0x5e')][_0x48bc('0x5f')],{'where':{'MailAccountId':_0x4e151e['id']}})['then'](function(){return _0x4e151e;});}return _0x4e151e;})[_0x48bc('0x23')](respondWithResult(_0x48944b,null))[_0x48bc('0x2b')](handleError(_0x48944b,null));};exports[_0x48bc('0x61')]=function(_0x3558ac,_0x23170c){return db['MailAccount']['describe']()[_0x48bc('0x23')](respondWithResult(_0x23170c,null))[_0x48bc('0x2b')](handleError(_0x23170c,null));};exports['addDisposition']=function(_0x4ff36e,_0x350f5e,_0x154530){if(_0x4ff36e[_0x48bc('0x5e')]['id']){delete _0x4ff36e[_0x48bc('0x5e')]['id'];}return db[_0x48bc('0x3f')][_0x48bc('0x5d')]({'where':{'id':_0x4ff36e[_0x48bc('0x5a')]['id']}})[_0x48bc('0x23')](handleEntityNotFound(_0x350f5e,null))['then'](function(_0x2ad7a3){if(_0x2ad7a3){_0x4ff36e['body']['MailAccountId']=_0x2ad7a3['id'];return db[_0x48bc('0x62')][_0x48bc('0x63')](_0x4ff36e[_0x48bc('0x5e')]);}})[_0x48bc('0x23')](respondWithResult(_0x350f5e,null))[_0x48bc('0x2b')](handleError(_0x350f5e,null));};exports[_0x48bc('0x64')]=function(_0x146ca8,_0x3e49b5,_0x6e828c){var _0x4a7875={'raw':![],'where':{}};var _0x2f5490={};var _0xcf6634={'count':0x0,'rows':[]};return db[_0x48bc('0x3f')][_0x48bc('0x65')]({'where':{'id':_0x146ca8[_0x48bc('0x5a')]['id']}})[_0x48bc('0x23')](handleEntityNotFound(_0x3e49b5,null))['then'](function(_0x13bc01){if(_0x13bc01){_0x2f5490[_0x48bc('0x48')]=_[_0x48bc('0x44')](db[_0x48bc('0x62')][_0x48bc('0x5b')]);_0x2f5490[_0x48bc('0x43')]=_[_0x48bc('0x44')](_0x146ca8[_0x48bc('0x43')]);_0x2f5490[_0x48bc('0x45')]=_[_0x48bc('0x46')](_0x2f5490[_0x48bc('0x48')],_0x2f5490[_0x48bc('0x43')]);_0x4a7875[_0x48bc('0x47')]=_['intersection'](_0x2f5490[_0x48bc('0x48')],qs[_0x48bc('0x49')](_0x146ca8[_0x48bc('0x43')][_0x48bc('0x49')]));_0x4a7875['attributes']=_0x4a7875['attributes'][_0x48bc('0x4a')]?_0x4a7875[_0x48bc('0x47')]:_0x2f5490[_0x48bc('0x48')];if(!_0x146ca8[_0x48bc('0x43')]['hasOwnProperty'](_0x48bc('0x4c'))){_0x4a7875[_0x48bc('0x30')]=qs[_0x48bc('0x30')](_0x146ca8[_0x48bc('0x43')]['limit']);_0x4a7875['offset']=qs['offset'](_0x146ca8['query'][_0x48bc('0x2f')]);}_0x4a7875[_0x48bc('0x4d')]=qs[_0x48bc('0x4e')](_0x146ca8[_0x48bc('0x43')][_0x48bc('0x4e')]);_0x4a7875[_0x48bc('0x4f')]=qs[_0x48bc('0x45')](_[_0x48bc('0x50')](_0x146ca8[_0x48bc('0x43')],_0x2f5490[_0x48bc('0x45')]));_0x4a7875['where']['MailAccountId']=_0x13bc01['id'];if(_0x146ca8[_0x48bc('0x43')][_0x48bc('0x51')]){_0x4a7875['where']=_['merge'](_0x4a7875[_0x48bc('0x4f')],{'$or':_['map'](_0x4a7875['attributes'],function(_0xad3e0d){var _0x46dc81={};_0x46dc81[_0xad3e0d]={'$like':'%'+_0x146ca8['query'][_0x48bc('0x51')]+'%'};return _0x46dc81;})});}_0x4a7875=_[_0x48bc('0x52')]({},_0x4a7875,_0x146ca8['options']);return db[_0x48bc('0x62')][_0x48bc('0x55')]({'where':_0x4a7875[_0x48bc('0x4f')]})[_0x48bc('0x23')](function(_0x1f9fc3){_0xcf6634['count']=_0x1f9fc3;if(_0x146ca8[_0x48bc('0x43')][_0x48bc('0x56')]){_0x4a7875[_0x48bc('0x5c')]=[{'all':!![]}];}return db[_0x48bc('0x62')]['findAll'](_0x4a7875);})['then'](function(_0x32a5b6){_0xcf6634['rows']=_0x32a5b6;return _0xcf6634;});}})[_0x48bc('0x23')](respondWithFilteredResult(_0x3e49b5,_0x4a7875))[_0x48bc('0x2b')](handleError(_0x3e49b5,null));};exports['removeDispositions']=function(_0x3dfe54,_0x29fabd,_0x5b0c1e){return db['MailAccount'][_0x48bc('0x5d')]({'where':{'id':_0x3dfe54[_0x48bc('0x5a')]['id']}})[_0x48bc('0x23')](handleEntityNotFound(_0x29fabd,null))['then'](function(_0x3b71e1){if(_0x3b71e1){return _0x3b71e1[_0x48bc('0x66')](_0x3dfe54[_0x48bc('0x43')][_0x48bc('0x67')]);}})['then'](respondWithStatusCode(_0x29fabd,null))[_0x48bc('0x2b')](handleError(_0x29fabd,null));};exports[_0x48bc('0x68')]=function(_0x2226b9,_0x4c6ada,_0x4b4349){if(_0x2226b9[_0x48bc('0x5e')]['id']){delete _0x2226b9['body']['id'];}return db[_0x48bc('0x3f')][_0x48bc('0x5d')]({'where':{'id':_0x2226b9['params']['id']}})[_0x48bc('0x23')](handleEntityNotFound(_0x4c6ada,null))['then'](function(_0x41dfd5){if(_0x41dfd5){_0x2226b9[_0x48bc('0x5e')]['MailAccountId']=_0x41dfd5['id'];return db[_0x48bc('0x69')][_0x48bc('0x63')](_0x2226b9[_0x48bc('0x5e')]);}})['then'](respondWithResult(_0x4c6ada,null))[_0x48bc('0x2b')](handleError(_0x4c6ada,null));};exports['getAnswers']=function(_0x47b1dc,_0x5a911a,_0x23e320){var _0x4c54ac={'raw':![],'where':{}};var _0x1edad0={};var _0x3ab744={'count':0x0,'rows':[]};return db['MailAccount'][_0x48bc('0x65')]({'where':{'id':_0x47b1dc[_0x48bc('0x5a')]['id']}})[_0x48bc('0x23')](handleEntityNotFound(_0x5a911a,null))[_0x48bc('0x23')](function(_0x59654a){if(_0x59654a){_0x1edad0[_0x48bc('0x48')]=_[_0x48bc('0x44')](db[_0x48bc('0x69')][_0x48bc('0x5b')]);_0x1edad0['query']=_[_0x48bc('0x44')](_0x47b1dc['query']);_0x1edad0[_0x48bc('0x45')]=_[_0x48bc('0x46')](_0x1edad0[_0x48bc('0x48')],_0x1edad0[_0x48bc('0x43')]);_0x4c54ac['attributes']=_[_0x48bc('0x46')](_0x1edad0['model'],qs[_0x48bc('0x49')](_0x47b1dc[_0x48bc('0x43')][_0x48bc('0x49')]));_0x4c54ac[_0x48bc('0x47')]=_0x4c54ac[_0x48bc('0x47')][_0x48bc('0x4a')]?_0x4c54ac[_0x48bc('0x47')]:_0x1edad0[_0x48bc('0x48')];if(!_0x47b1dc[_0x48bc('0x43')][_0x48bc('0x4b')](_0x48bc('0x4c'))){_0x4c54ac[_0x48bc('0x30')]=qs[_0x48bc('0x30')](_0x47b1dc['query'][_0x48bc('0x30')]);_0x4c54ac['offset']=qs[_0x48bc('0x2f')](_0x47b1dc[_0x48bc('0x43')][_0x48bc('0x2f')]);}_0x4c54ac[_0x48bc('0x4d')]=qs['sort'](_0x47b1dc['query'][_0x48bc('0x4e')]);_0x4c54ac[_0x48bc('0x4f')]=qs['filters'](_['pick'](_0x47b1dc['query'],_0x1edad0[_0x48bc('0x45')]));_0x4c54ac[_0x48bc('0x4f')][_0x48bc('0x6a')]=_0x59654a['id'];if(_0x47b1dc['query'][_0x48bc('0x51')]){_0x4c54ac[_0x48bc('0x4f')]=_[_0x48bc('0x52')](_0x4c54ac[_0x48bc('0x4f')],{'$or':_[_0x48bc('0x3e')](_0x4c54ac[_0x48bc('0x47')],function(_0x2e1986){var _0x5a76ce={};_0x5a76ce[_0x2e1986]={'$like':'%'+_0x47b1dc[_0x48bc('0x43')]['filter']+'%'};return _0x5a76ce;})});}_0x4c54ac=_[_0x48bc('0x52')]({},_0x4c54ac,_0x47b1dc[_0x48bc('0x54')]);return db[_0x48bc('0x69')]['count']({'where':_0x4c54ac[_0x48bc('0x4f')]})[_0x48bc('0x23')](function(_0xf082a7){_0x3ab744[_0x48bc('0x55')]=_0xf082a7;if(_0x47b1dc[_0x48bc('0x43')][_0x48bc('0x56')]){_0x4c54ac['include']=[{'all':!![]}];}return db['CannedAnswer'][_0x48bc('0x57')](_0x4c54ac);})[_0x48bc('0x23')](function(_0x59390d){_0x3ab744[_0x48bc('0x58')]=_0x59390d;return _0x3ab744;});}})['then'](respondWithFilteredResult(_0x5a911a,_0x4c54ac))[_0x48bc('0x2b')](handleError(_0x5a911a,null));};exports['removeAnswers']=function(_0x23cbcf,_0x7a3dcf,_0x4a35fa){return db[_0x48bc('0x3f')][_0x48bc('0x5d')]({'where':{'id':_0x23cbcf[_0x48bc('0x5a')]['id']}})[_0x48bc('0x23')](handleEntityNotFound(_0x7a3dcf,null))[_0x48bc('0x23')](function(_0x2358d0){if(_0x2358d0){return _0x2358d0[_0x48bc('0x6b')](_0x23cbcf[_0x48bc('0x43')][_0x48bc('0x67')]);}})[_0x48bc('0x23')](respondWithStatusCode(_0x7a3dcf,null))[_0x48bc('0x2b')](handleError(_0x7a3dcf,null));};exports['create']=function(_0xf536a,_0x5f12df){var _0x3fb0e1={'name':_0xf536a[_0x48bc('0x5e')][_0x48bc('0x38')],'key':_0xf536a[_0x48bc('0x5e')][_0x48bc('0x42')],'email':_0xf536a[_0x48bc('0x5e')][_0x48bc('0x6c')],'ListId':_0xf536a[_0x48bc('0x5e')][_0x48bc('0x6d')],'active':!_[_0x48bc('0x6e')](_0xf536a[_0x48bc('0x5e')][_0x48bc('0x6f')])?_0xf536a[_0x48bc('0x5e')][_0x48bc('0x6f')]:!![],'description':_0xf536a['body']['description']||null,'Imap':{},'Smtp':{}};if(_[_0x48bc('0x6e')](_0xf536a['body'][_0x48bc('0x70')])){if(_0xf536a[_0x48bc('0x5e')][_0x48bc('0x71')]){_0x3fb0e1[_0x48bc('0x3b')]['user']=_0x3fb0e1[_0x48bc('0x5f')][_0x48bc('0x72')]=_0xf536a[_0x48bc('0x5e')]['cuser'];_0x3fb0e1[_0x48bc('0x3b')][_0x48bc('0x73')]=_0x3fb0e1[_0x48bc('0x5f')][_0x48bc('0x74')]=_0xf536a['body'][_0x48bc('0x75')];}else{_0x3fb0e1[_0x48bc('0x3b')]['authentication']=_0x3fb0e1[_0x48bc('0x5f')][_0x48bc('0x76')]=![];}_0x3fb0e1[_0x48bc('0x3b')][_0x48bc('0x77')]=_0xf536a[_0x48bc('0x5e')][_0x48bc('0x3b')][_0x48bc('0x77')];_0x3fb0e1[_0x48bc('0x3b')][_0x48bc('0x78')]=_0xf536a['body'][_0x48bc('0x3b')]['port'];_0x3fb0e1[_0x48bc('0x5f')][_0x48bc('0x77')]=_0xf536a[_0x48bc('0x5e')][_0x48bc('0x5f')][_0x48bc('0x77')];_0x3fb0e1[_0x48bc('0x5f')][_0x48bc('0x78')]=_0xf536a[_0x48bc('0x5e')]['Smtp'][_0x48bc('0x78')];}else{_0x3fb0e1[_0x48bc('0x3b')][_0x48bc('0x79')]=_0x3fb0e1[_0x48bc('0x5f')][_0x48bc('0x79')]=_0xf536a[_0x48bc('0x5e')][_0x48bc('0x70')];_0x3fb0e1[_0x48bc('0x3b')][_0x48bc('0x72')]=_0x3fb0e1[_0x48bc('0x5f')][_0x48bc('0x72')]=_0xf536a['body'][_0x48bc('0x7a')];_0x3fb0e1[_0x48bc('0x3b')]['password']=_0x3fb0e1[_0x48bc('0x5f')][_0x48bc('0x74')]=_0xf536a[_0x48bc('0x5e')]['cpassword'];}return db[_0x48bc('0x3f')]['create'](_0x3fb0e1,{'include':[{'model':db[_0x48bc('0x3c')],'as':'Smtp'},{'model':db[_0x48bc('0x3a')],'as':_0x48bc('0x3b')}]})[_0x48bc('0x23')](function(_0x30006d){var _0x26ab5a=_0xf536a[_0x48bc('0x72')]['get']({'plain':!![]});if(!_0x26ab5a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x26ab5a[_0x48bc('0x7b')]===_0x48bc('0x72')){var _0x32d0a4=_0x30006d[_0x48bc('0x7c')]({'plain':!![]});return db[_0x48bc('0x7d')][_0x48bc('0x5d')]({'where':{'name':_0x48bc('0x33'),'userProfileId':_0x26ab5a['userProfileId']},'raw':!![]})[_0x48bc('0x23')](function(_0x3dc212){if(_0x3dc212&&_0x3dc212['autoAssociation']===0x0){return db[_0x48bc('0x34')][_0x48bc('0x63')]({'name':_0x32d0a4[_0x48bc('0x38')],'resourceId':_0x32d0a4['id'],'type':_0x3dc212[_0x48bc('0x38')],'sectionId':_0x3dc212['id']},{})[_0x48bc('0x23')](function(){return _0x30006d;});}else{return _0x30006d;}})[_0x48bc('0x2b')](function(_0x284709){logger[_0x48bc('0x26')](_0x48bc('0x7e'),_0x284709);throw _0x284709;});}return _0x30006d;})['then'](respondWithResult(_0x5f12df,0xc9))['catch'](handleError(_0x5f12df,null));};exports[_0x48bc('0x7f')]=function(_0x59bca6,_0x21a223,_0x587422){return db[_0x48bc('0x3f')][_0x48bc('0x65')]({'where':{'id':_0x59bca6[_0x48bc('0x5a')]['id']}})[_0x48bc('0x23')](handleEntityNotFound(_0x21a223,null))[_0x48bc('0x23')](function(_0x5bf26c){if(_0x5bf26c){return _0x5bf26c['getImap']();}return null;})['then'](respondWithResult(_0x21a223,null))[_0x48bc('0x2b')](handleError(_0x21a223,null));};exports['addImap']=function(_0x1821ad,_0x2c3f3d,_0x54ca6d){if(_0x1821ad[_0x48bc('0x5e')]['id']){delete _0x1821ad[_0x48bc('0x5e')]['id'];}return db[_0x48bc('0x3f')]['find']({'where':{'id':_0x1821ad['params']['id']}})['then'](handleEntityNotFound(_0x2c3f3d,null))[_0x48bc('0x23')](function(_0x261294){if(_0x261294){_0x1821ad[_0x48bc('0x5e')]['MailAccountId']=_0x261294['id'];return db[_0x48bc('0x3a')][_0x48bc('0x63')](_0x1821ad[_0x48bc('0x5e')]);}})['then'](respondWithResult(_0x2c3f3d,null))[_0x48bc('0x2b')](handleError(_0x2c3f3d,null));};exports['removeImap']=function(_0x5d5544,_0x688f60,_0x4c8ea2){return db[_0x48bc('0x3f')][_0x48bc('0x65')]({'where':{'id':_0x5d5544[_0x48bc('0x5a')]['id']}})[_0x48bc('0x23')](handleEntityNotFound(_0x688f60,null))[_0x48bc('0x23')](function(_0x5c67b8){if(_0x5c67b8){return _0x5c67b8[_0x48bc('0x80')](null);}return null;})[_0x48bc('0x23')](respondWithStatusCode(_0x688f60,null))[_0x48bc('0x2b')](handleError(_0x688f60,null));};exports[_0x48bc('0x81')]=function(_0xf1b784,_0x9b079b,_0x2d4b7e){return db[_0x48bc('0x3f')][_0x48bc('0x65')]({'where':{'id':_0xf1b784['params']['id']}})[_0x48bc('0x23')](handleEntityNotFound(_0x9b079b,null))[_0x48bc('0x23')](function(_0x1065c2){if(_0x1065c2){return _0x1065c2[_0x48bc('0x81')]();}return null;})[_0x48bc('0x23')](respondWithResult(_0x9b079b,null))[_0x48bc('0x2b')](handleError(_0x9b079b,null));};exports[_0x48bc('0x82')]=function(_0x5b07ee,_0x5404e3,_0x35b9ee){if(_0x5b07ee[_0x48bc('0x5e')]['id']){delete _0x5b07ee[_0x48bc('0x5e')]['id'];}return db['MailAccount']['find']({'where':{'id':_0x5b07ee[_0x48bc('0x5a')]['id']}})[_0x48bc('0x23')](handleEntityNotFound(_0x5404e3,null))[_0x48bc('0x23')](function(_0x4e64d7){if(_0x4e64d7){_0x5b07ee[_0x48bc('0x5e')][_0x48bc('0x6a')]=_0x4e64d7['id'];return db[_0x48bc('0x3c')]['create'](_0x5b07ee['body']);}})[_0x48bc('0x23')](respondWithResult(_0x5404e3,null))[_0x48bc('0x2b')](handleError(_0x5404e3,null));};exports[_0x48bc('0x83')]=function(_0x5b7e45,_0x552927,_0x1dd3be){return db[_0x48bc('0x3f')][_0x48bc('0x65')]({'where':{'id':_0x5b7e45[_0x48bc('0x5a')]['id']}})['then'](handleEntityNotFound(_0x552927,null))[_0x48bc('0x23')](function(_0x2813ce){if(_0x2813ce){return _0x2813ce[_0x48bc('0x84')](null);}return null;})[_0x48bc('0x23')](respondWithStatusCode(_0x552927,null))[_0x48bc('0x2b')](handleError(_0x552927,null));};exports[_0x48bc('0x85')]=function(_0x428ccb,_0x16a9c7,_0x2ec9f1){return db[_0x48bc('0x86')][_0x48bc('0x5d')]({'where':{'id':_0x428ccb[_0x48bc('0x5a')]['id']}})[_0x48bc('0x23')](handleEntityNotFound(_0x16a9c7,null))[_0x48bc('0x23')](function(_0x3d5604){if(_0x3d5604){return _0x3d5604[_0x48bc('0x85')](_0x428ccb[_0x48bc('0x5e')][_0x48bc('0x67')],_[_0x48bc('0x87')](_0x428ccb[_0x48bc('0x5e')],[_0x48bc('0x67'),'id'])||{});}})[_0x48bc('0x23')](respondWithResult(_0x16a9c7,null))[_0x48bc('0x2b')](handleError(_0x16a9c7,null));};exports['getInteractions']=function(_0x2367b2,_0x45ea9f,_0x2f2980){var _0x2f0fe0={'raw':![],'where':{}};var _0x1322d1={};var _0x106aab={'count':0x0,'rows':[]};return db[_0x48bc('0x3f')][_0x48bc('0x65')]({'where':{'id':_0x2367b2[_0x48bc('0x5a')]['id']}})[_0x48bc('0x23')](handleEntityNotFound(_0x45ea9f,null))[_0x48bc('0x23')](function(_0x37717e){if(_0x37717e){_0x1322d1['model']=_[_0x48bc('0x44')](db[_0x48bc('0x86')][_0x48bc('0x5b')]);_0x1322d1[_0x48bc('0x43')]=_[_0x48bc('0x44')](_0x2367b2[_0x48bc('0x43')]);_0x1322d1[_0x48bc('0x45')]=_['intersection'](_0x1322d1[_0x48bc('0x48')],_0x1322d1[_0x48bc('0x43')]);_0x2f0fe0[_0x48bc('0x47')]=_['intersection'](_0x1322d1['model'],qs[_0x48bc('0x49')](_0x2367b2['query'][_0x48bc('0x49')]));_0x2f0fe0[_0x48bc('0x47')]=_0x2f0fe0[_0x48bc('0x47')][_0x48bc('0x4a')]?_0x2f0fe0[_0x48bc('0x47')]:_0x1322d1['model'];if(!_0x2367b2[_0x48bc('0x43')][_0x48bc('0x4b')]('nolimit')){_0x2f0fe0[_0x48bc('0x30')]=qs[_0x48bc('0x30')](_0x2367b2[_0x48bc('0x43')][_0x48bc('0x30')]);_0x2f0fe0[_0x48bc('0x2f')]=qs['offset'](_0x2367b2[_0x48bc('0x43')]['offset']);}_0x2f0fe0[_0x48bc('0x4d')]=qs['sort'](_0x2367b2['query']['sort']);_0x2f0fe0[_0x48bc('0x4f')]=qs['filters'](_[_0x48bc('0x50')](_0x2367b2['query'],_0x1322d1[_0x48bc('0x45')]));_0x2f0fe0[_0x48bc('0x4f')][_0x48bc('0x6a')]=_0x37717e['id'];if(_0x2367b2[_0x48bc('0x43')][_0x48bc('0x51')]){_0x2f0fe0[_0x48bc('0x4f')]=_[_0x48bc('0x52')](_0x2f0fe0['where'],{'$or':_[_0x48bc('0x3e')](_0x2f0fe0[_0x48bc('0x47')],function(_0x32cee6){var _0x4f361e={};_0x4f361e[_0x32cee6]={'$like':'%'+_0x2367b2[_0x48bc('0x43')]['filter']+'%'};return _0x4f361e;})});}_0x2f0fe0=_['merge']({},_0x2f0fe0,_0x2367b2[_0x48bc('0x54')]);return db[_0x48bc('0x86')][_0x48bc('0x55')]({'where':_0x2f0fe0['where']})[_0x48bc('0x23')](function(_0x4c7112){_0x106aab[_0x48bc('0x55')]=_0x4c7112;if(_0x2367b2[_0x48bc('0x43')]['includeAll']){_0x2f0fe0[_0x48bc('0x5c')]=[{'model':db[_0x48bc('0x88')],'as':'Contact','required':![]},{'model':db['User'],'as':'Owner','attributes':['name',_0x48bc('0x89'),'internal'],'required':![]},{'model':db[_0x48bc('0x8a')],'as':_0x48bc('0x8b'),'attributes':['id',_0x48bc('0x38'),_0x48bc('0x8c')],'where':_0x2367b2[_0x48bc('0x43')]['tag']?{'id':_0x2367b2[_0x48bc('0x43')]['tag']}:undefined,'required':_0x2367b2[_0x48bc('0x43')][_0x48bc('0x8d')]?!![]:![]}];}return db[_0x48bc('0x86')]['findAll'](_0x2f0fe0);})[_0x48bc('0x23')](function(_0x11c62c){_0x106aab[_0x48bc('0x58')]=_0x11c62c;return _0x106aab;});}})[_0x48bc('0x23')](respondWithFilteredResult(_0x45ea9f,_0x2f0fe0))[_0x48bc('0x2b')](handleError(_0x45ea9f,null));};exports['addApplications']=function(_0x33e67f,_0x3b0afd,_0x2385f6){return db[_0x48bc('0x3f')][_0x48bc('0x65')]({'where':{'id':_0x33e67f[_0x48bc('0x5a')]['id']}})[_0x48bc('0x23')](handleEntityNotFound(_0x3b0afd,null))[_0x48bc('0x23')](function(_0x4cd65f){if(_0x4cd65f){return db['sequelize'][_0x48bc('0x8e')](function(_0x3ba390){return db[_0x48bc('0x8f')]['destroy']({'where':{'MailAccountId':_0x33e67f['params']['id']},'transaction':_0x3ba390})[_0x48bc('0x23')](function(_0x444ba0){var _0x493f3e=_[_0x48bc('0x3e')](_0x33e67f['body'],function(_0x51a409){_0x51a409[_0x48bc('0x6a')]=_0x33e67f[_0x48bc('0x5a')]['id'];return _0x51a409;});return db['MailApplication'][_0x48bc('0x90')](_0x493f3e,{'transaction':_0x3ba390});});})[_0x48bc('0x23')](function(){return db[_0x48bc('0x8f')]['findAndCountAll']({'where':{'MailAccountId':_0x33e67f[_0x48bc('0x5a')]['id']},'order':_0x48bc('0x91')});});}})[_0x48bc('0x23')](respondWithResult(_0x3b0afd,null))['catch'](handleError(_0x3b0afd,null));};exports[_0x48bc('0x92')]=function(_0x2408bb,_0x546575,_0xe6b935){var _0x4519f4={};var _0x2c7402={};var _0x4d78ea;var _0x469559;return db[_0x48bc('0x3f')]['findOne']({'where':{'id':_0x2408bb['params']['id']}})[_0x48bc('0x23')](handleEntityNotFound(_0x546575,null))['then'](function(_0x385c05){if(_0x385c05){_0x4d78ea=_0x385c05;_0x2c7402[_0x48bc('0x48')]=_[_0x48bc('0x44')](db[_0x48bc('0x8f')]['rawAttributes']);_0x2c7402[_0x48bc('0x43')]=_[_0x48bc('0x44')](_0x2408bb['query']);_0x2c7402[_0x48bc('0x45')]=_[_0x48bc('0x46')](_0x2c7402[_0x48bc('0x48')],_0x2c7402[_0x48bc('0x43')]);_0x4519f4['attributes']=_[_0x48bc('0x46')](_0x2c7402['model'],qs[_0x48bc('0x49')](_0x2408bb['query'][_0x48bc('0x49')]));_0x4519f4[_0x48bc('0x47')]=_0x4519f4[_0x48bc('0x47')]['length']?_0x4519f4[_0x48bc('0x47')]:_0x2c7402['model'];_0x4519f4[_0x48bc('0x4d')]=qs[_0x48bc('0x4e')](_0x2408bb[_0x48bc('0x43')]['sort']);_0x4519f4[_0x48bc('0x4f')]=qs[_0x48bc('0x45')](_[_0x48bc('0x50')](_0x2408bb['query'],_0x2c7402[_0x48bc('0x45')]));if(_0x2408bb['query']['filter']){_0x4519f4[_0x48bc('0x4f')]=_[_0x48bc('0x52')](_0x4519f4['where'],{'$or':_[_0x48bc('0x3e')](_0x4519f4[_0x48bc('0x47')],function(_0x5180d7){var _0x4bc230={};_0x4bc230[_0x5180d7]={'$like':'%'+_0x2408bb[_0x48bc('0x43')]['filter']+'%'};return _0x4bc230;})});}_0x4519f4=_[_0x48bc('0x52')]({},_0x4519f4,_0x2408bb[_0x48bc('0x54')]);return _0x4d78ea[_0x48bc('0x92')](_0x4519f4);}})[_0x48bc('0x23')](function(_0x5e0e09){if(_0x5e0e09){_0x469559=_0x5e0e09[_0x48bc('0x4a')];if(!_0x2408bb[_0x48bc('0x43')][_0x48bc('0x4b')]('nolimit')){_0x4519f4[_0x48bc('0x30')]=qs['limit'](_0x2408bb[_0x48bc('0x43')][_0x48bc('0x30')]);_0x4519f4[_0x48bc('0x2f')]=qs[_0x48bc('0x2f')](_0x2408bb[_0x48bc('0x43')][_0x48bc('0x2f')]);}return _0x4d78ea[_0x48bc('0x92')](_0x4519f4);}})['then'](function(_0x3c441d){if(_0x3c441d){return _0x3c441d?{'count':_0x469559,'rows':_0x3c441d}:null;}})[_0x48bc('0x23')](respondWithResult(_0x546575,null))[_0x48bc('0x2b')](handleError(_0x546575,null));};exports[_0x48bc('0x93')]=function(_0x5b578c,_0x19794d,_0xe6134a){var _0x30c9df={'raw':!![],'where':{}};var _0x22216e={};var _0x5f0bcf={'count':0x0,'rows':[]};return db[_0x48bc('0x3f')]['findOne']({'where':{'id':_0x5b578c[_0x48bc('0x5a')]['id']}})[_0x48bc('0x23')](handleEntityNotFound(_0x19794d,null))['then'](function(_0x348644){if(_0x348644){_0x22216e['model']=_[_0x48bc('0x44')](db['MailMessage'][_0x48bc('0x5b')]);_0x22216e[_0x48bc('0x43')]=_[_0x48bc('0x44')](_0x5b578c[_0x48bc('0x43')]);_0x22216e[_0x48bc('0x45')]=_[_0x48bc('0x46')](_0x22216e['model'],_0x22216e[_0x48bc('0x43')]);_0x30c9df[_0x48bc('0x47')]=_[_0x48bc('0x46')](_0x22216e[_0x48bc('0x48')],qs[_0x48bc('0x49')](_0x5b578c[_0x48bc('0x43')][_0x48bc('0x49')]));_0x30c9df[_0x48bc('0x47')]=_0x30c9df['attributes'][_0x48bc('0x4a')]?_0x30c9df['attributes']:_0x22216e[_0x48bc('0x48')];if(!_0x5b578c[_0x48bc('0x43')]['hasOwnProperty']('nolimit')){_0x30c9df[_0x48bc('0x30')]=qs[_0x48bc('0x30')](_0x5b578c[_0x48bc('0x43')][_0x48bc('0x30')]);_0x30c9df['offset']=qs[_0x48bc('0x2f')](_0x5b578c['query']['offset']);}_0x30c9df[_0x48bc('0x4d')]=qs[_0x48bc('0x4e')](_0x5b578c[_0x48bc('0x43')][_0x48bc('0x4e')]);_0x30c9df[_0x48bc('0x4f')]=qs[_0x48bc('0x45')](_[_0x48bc('0x50')](_0x5b578c[_0x48bc('0x43')],_0x22216e['filters']));_0x30c9df[_0x48bc('0x4f')]['MailAccountId']=_0x348644['id'];if(_0x5b578c[_0x48bc('0x43')]['filter']){_0x30c9df['where']=_['merge'](_0x30c9df[_0x48bc('0x4f')],{'$or':_['map'](_0x30c9df['attributes'],function(_0x278b57){var _0x2b5a69={};_0x2b5a69[_0x278b57]={'$like':'%'+_0x5b578c['query'][_0x48bc('0x51')]+'%'};return _0x2b5a69;})});}if(_0x5b578c[_0x48bc('0x43')][_0x48bc('0x94')]){var _0x3266c1=_0x5b578c[_0x48bc('0x43')]['$gte'][_0x48bc('0x95')](',');var _0x440f3f={};_0x440f3f[_0x3266c1[0x0]]={'$gte':moment(_0x3266c1[0x1])[_0x48bc('0x96')](_0x48bc('0x97'))};_0x30c9df[_0x48bc('0x4f')]=_[_0x48bc('0x52')](_0x30c9df[_0x48bc('0x4f')],_0x440f3f);}_0x30c9df=_[_0x48bc('0x52')]({},_0x30c9df,_0x5b578c[_0x48bc('0x54')]);return db['MailMessage'][_0x48bc('0x55')]({'where':_0x30c9df[_0x48bc('0x4f')]})['then'](function(_0x30aac2){_0x5f0bcf['count']=_0x30aac2;if(_0x5b578c[_0x48bc('0x43')][_0x48bc('0x56')]){_0x30c9df[_0x48bc('0x5c')]=[{'all':!![]}];}return db[_0x48bc('0x98')][_0x48bc('0x57')](_0x30c9df);})[_0x48bc('0x23')](function(_0x5428bf){_0x5f0bcf['rows']=_0x5428bf;return _0x5f0bcf;});}})[_0x48bc('0x23')](respondWithFilteredResult(_0x19794d,_0x30c9df))[_0x48bc('0x2b')](handleError(_0x19794d,null));};exports[_0x48bc('0x99')]=function(_0x50d8a2,_0x1eda53,_0x581099){var _0x498bc7,_0x30c25f={},_0x2366ac;if(_0x50d8a2[_0x48bc('0x5e')]['to']){_0x2366ac=_0x50d8a2['body']['to'][_0x48bc('0x95')](',')[0x0];}return db['MailAccount'][_0x48bc('0x5d')]({'where':{'id':_0x50d8a2[_0x48bc('0x5a')]['id']},'include':[{'model':db[_0x48bc('0x9a')],'as':'List','include':[{'model':db[_0x48bc('0x88')],'as':_0x48bc('0x9b'),'where':{'email':_0x2366ac},'limit':0x1,'order':[[_0x48bc('0x9c'),_0x48bc('0x9d')]]}]},{'model':db[_0x48bc('0x3c')],'as':_0x48bc('0x5f'),'raw':!![]}]})['then'](handleEntityNotFound(_0x1eda53,null))['then'](function(_0x317c8f){if(_0x317c8f){_0x498bc7=_0x317c8f;if(_0x317c8f['Smtp']){if(_[_0x48bc('0x6e')](_0x50d8a2['body']['from'])){_0x50d8a2[_0x48bc('0x5e')][_0x48bc('0x9e')]=util[_0x48bc('0x96')](_0x48bc('0x9f'),_0x317c8f[_0x48bc('0x38')],_0x317c8f[_0x48bc('0x6c')]||_0x317c8f[_0x48bc('0x5f')][_0x48bc('0x72')]);}if(_0x50d8a2[_0x48bc('0x5e')]['attachments']&&_0x50d8a2[_0x48bc('0x5e')][_0x48bc('0xa0')]['length']){for(var _0x434e22=0x0;_0x434e22<_0x50d8a2[_0x48bc('0x5e')][_0x48bc('0xa0')][_0x48bc('0x4a')];_0x434e22+=0x1){_0x50d8a2['body'][_0x48bc('0xa0')][_0x434e22]={'filename':_0x50d8a2[_0x48bc('0x5e')][_0x48bc('0xa0')][_0x434e22][_0x48bc('0x38')],'path':path[_0x48bc('0xa1')](config[_0x48bc('0xa2')],_0x48bc('0xa3'),_0x50d8a2[_0x48bc('0x5e')][_0x48bc('0xa0')][_0x434e22]['basename'])};}}var _0x9a4298={'tls':{'rejectUnauthorized':![]}};if(_[_0x48bc('0x6e')](_0x317c8f[_0x48bc('0x5f')][_0x48bc('0x79')])){if(_0x317c8f[_0x48bc('0x5f')][_0x48bc('0x76')]){_0x9a4298[_0x48bc('0xa4')]={'user':_0x317c8f[_0x48bc('0x5f')]['user'],'pass':_0x317c8f['Smtp']['pass']};}_0x9a4298['host']=_0x317c8f[_0x48bc('0x5f')][_0x48bc('0x77')];_0x9a4298[_0x48bc('0x78')]=_0x317c8f[_0x48bc('0x5f')][_0x48bc('0x78')];_0x9a4298[_0x48bc('0xa5')]=_0x317c8f[_0x48bc('0x5f')][_0x48bc('0xa5')];}else{_0x9a4298[_0x48bc('0x79')]=_0x317c8f[_0x48bc('0x5f')][_0x48bc('0x79')];_0x9a4298[_0x48bc('0xa4')]={'user':_0x317c8f[_0x48bc('0x5f')][_0x48bc('0x72')],'pass':_0x317c8f['Smtp'][_0x48bc('0x74')]};}return respondWithRpcPromise(_0x48bc('0xa6'),_0x48bc('0xa7'),{'account':_0x9a4298,'message':_0x50d8a2[_0x48bc('0x5e')]});}else{throw new Error(_0x48bc('0xa8'));}}})['then'](function(_0x5406b5){if(_0x5406b5){_0x30c25f=_0x5406b5;if(_0x498bc7['List']){if(_0x498bc7[_0x48bc('0xa9')][_0x48bc('0x9b')]['length']){return _0x498bc7[_0x48bc('0xa9')][_0x48bc('0x9b')][0x0];}else{return db['CmContact'][_0x48bc('0x63')](_[_0x48bc('0x18')](_0x50d8a2[_0x48bc('0x5e')],{'firstName':_0x50d8a2[_0x48bc('0x5e')]['to'],'email':_0x50d8a2['body']['to'],'phone':_0x50d8a2[_0x48bc('0x5e')]['to'],'ListId':_0x498bc7[_0x48bc('0x6d')]}));}}else{throw new Error(_0x48bc('0xa8'));}}})[_0x48bc('0x23')](function(_0xe3f949){if(_0xe3f949){var _0x1e65b8={'UserId':_0x50d8a2[_0x48bc('0x72')]['id'],'ContactId':_0xe3f949['id'],'MailAccountId':_0x498bc7['id'],'inReplyTo':_0x30c25f[_0x48bc('0xaa')],'to':_0x50d8a2[_0x48bc('0x5e')][_0x48bc('0x9e')],'cc':_0x50d8a2['body']['cc'],'subject':_0x50d8a2[_0x48bc('0x5e')][_0x48bc('0xab')],'attach':_0x50d8a2[_0x48bc('0x5e')][_0x48bc('0xac')],'firstMsgDirection':'out','lastMsgAt':moment()[_0x48bc('0x96')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':_0x48bc('0xad'),'lastMsgBody':_0x50d8a2[_0x48bc('0x5e')]['body'],'Messages':[_[_0x48bc('0x52')](_0x50d8a2['body'],{'messageId':_0x30c25f[_0x48bc('0xaa')],'sentAt':moment()['format'](_0x48bc('0x97')),'read':!![],'MailAccountId':_0x498bc7['id'],'UserId':_0x50d8a2[_0x48bc('0x72')]['id'],'ContactId':_0xe3f949['id']})]};if(_0x50d8a2['body'][_0x48bc('0xae')]){_0x1e65b8=_[_0x48bc('0x52')](_0x1e65b8,_0x50d8a2[_0x48bc('0x5e')][_0x48bc('0xae')]);}return db['MailInteraction'][_0x48bc('0x63')](_0x1e65b8,{'include':[{'model':db[_0x48bc('0x98')],'as':_0x48bc('0xaf')}]});}})['then'](respondWithResult(_0x1eda53,null))[_0x48bc('0x2b')](handleError(_0x1eda53,null));};exports[_0x48bc('0xb0')]=function(_0x4db5b3,_0x4be757,_0x812d50){return db[_0x48bc('0x3f')][_0x48bc('0x5d')]({'where':{'id':_0x4db5b3[_0x48bc('0x5a')]['id']},'include':[{'model':db[_0x48bc('0x3c')],'as':_0x48bc('0x5f'),'raw':!![]}]})[_0x48bc('0x23')](handleEntityNotFound(_0x4be757,null))[_0x48bc('0x23')](function(_0x75d0){if(_0x75d0&&_0x75d0['Smtp']){var _0x234735={'id':_0x75d0['id'],'tls':{'rejectUnauthorized':![]}};if(_0x75d0['Smtp'][_0x48bc('0x79')]){_0x234735['service']=_0x75d0[_0x48bc('0x5f')][_0x48bc('0x79')];}else{_0x234735['host']=_0x75d0[_0x48bc('0x5f')][_0x48bc('0x77')];_0x234735[_0x48bc('0x78')]=_0x75d0['Smtp'][_0x48bc('0x78')];_0x234735['secure']=_0x75d0['Smtp'][_0x48bc('0xa5')];}if(_0x75d0[_0x48bc('0x5f')][_0x48bc('0x76')]){_0x234735['auth']={'user':_0x75d0[_0x48bc('0x5f')][_0x48bc('0x72')],'pass':_0x75d0[_0x48bc('0x5f')][_0x48bc('0x74')]};}return respondWithRpcPromise('VerifySmtp','verifySmtp',{'account':_0x234735});}})[_0x48bc('0x23')](respondWithResult(_0x4be757,null))[_0x48bc('0x2b')](handleError(_0x4be757,null));};exports[_0x48bc('0x35')]=function(_0x55a24e,_0x1836e1){return db['MailAccount'][_0x48bc('0x5d')]({'where':{'id':_0x55a24e[_0x48bc('0x5a')]['id']}})[_0x48bc('0x23')](handleEntityNotFound(_0x1836e1,null))[_0x48bc('0x23')](function(_0x237916){if(_0x237916&&_0x237916['service']){throw new db['Sequelize'][(_0x48bc('0x20'))]('You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account');}return _0x237916;})[_0x48bc('0x23')](removeEntity(_0x1836e1,null))[_0x48bc('0x2b')](handleError(_0x1836e1,null));};exports[_0x48bc('0xb1')]=function(_0x5529fc,_0x16ddef,_0x55fc0a){return db[_0x48bc('0x3f')][_0x48bc('0x5d')]({'where':{'id':_0x5529fc[_0x48bc('0x5a')]['id']}})[_0x48bc('0x23')](handleEntityNotFound(_0x16ddef,null))[_0x48bc('0x23')](function(_0x2f1a97){if(_0x2f1a97){return _0x2f1a97[_0x48bc('0xb1')](_0x5529fc['body'][_0x48bc('0x67')],_[_0x48bc('0x87')](_0x5529fc['body'],[_0x48bc('0x67'),'id'])||{})['spread'](function(_0x7bf5ec){for(var _0x12debf=0x0;_0x12debf<_0x5529fc['body'][_0x48bc('0x67')][_0x48bc('0x4a')];_0x12debf+=0x1){socket[_0x48bc('0xb2')](_0x48bc('0xb3'),{'UserId':_0x5529fc[_0x48bc('0x5e')][_0x48bc('0x67')][_0x12debf],'MailAccountId':_0x5529fc['params']['id']});}return _0x7bf5ec;});}})[_0x48bc('0x23')](respondWithResult(_0x16ddef,null))['catch'](handleError(_0x16ddef,null));};exports[_0x48bc('0xb4')]=function(_0x52de96,_0x3a0aba,_0x1724d9){return db[_0x48bc('0x3f')][_0x48bc('0x5d')]({'where':{'id':_0x52de96[_0x48bc('0x5a')]['id']}})['then'](handleEntityNotFound(_0x3a0aba,null))[_0x48bc('0x23')](function(_0x4b6585){if(_0x4b6585){return _0x4b6585['removeAgents'](_0x52de96[_0x48bc('0x43')][_0x48bc('0x67')])[_0x48bc('0x23')](function(){if(_['isArray'](_0x52de96['query'][_0x48bc('0x67')])){for(var _0xa63494=0x0;_0xa63494<_0x52de96[_0x48bc('0x43')][_0x48bc('0x67')][_0x48bc('0x4a')];_0xa63494+=0x1){socket[_0x48bc('0xb2')]('userMailAccount:remove',{'UserId':Number(_0x52de96[_0x48bc('0x43')]['ids'][_0xa63494]),'MailAccountId':Number(_0x52de96[_0x48bc('0x5a')]['id'])});}}else{socket[_0x48bc('0xb2')](_0x48bc('0xb5'),{'UserId':Number(_0x52de96[_0x48bc('0x43')]['ids']),'MailAccountId':Number(_0x52de96['params']['id'])});}});}})[_0x48bc('0x23')](respondWithStatusCode(_0x3a0aba,null))[_0x48bc('0x2b')](handleError(_0x3a0aba,null));};exports[_0x48bc('0xb6')]=function(_0x30d8df,_0x1cbc20,_0x2039ba){var _0x174670={};var _0x2471d0={};var _0x406b9a;var _0xdaa3c;return db[_0x48bc('0x3f')][_0x48bc('0x65')]({'where':{'id':_0x30d8df[_0x48bc('0x5a')]['id']}})['then'](handleEntityNotFound(_0x1cbc20,null))[_0x48bc('0x23')](function(_0x3a85b){if(_0x3a85b){_0x406b9a=_0x3a85b;_0x2471d0[_0x48bc('0x48')]=_[_0x48bc('0x44')](db['User']['rawAttributes']);_0x2471d0[_0x48bc('0x43')]=_[_0x48bc('0x44')](_0x30d8df[_0x48bc('0x43')]);_0x2471d0['filters']=_[_0x48bc('0x46')](_0x2471d0[_0x48bc('0x48')],_0x2471d0[_0x48bc('0x43')]);_0x174670['attributes']=_[_0x48bc('0x46')](_0x2471d0[_0x48bc('0x48')],qs[_0x48bc('0x49')](_0x30d8df[_0x48bc('0x43')][_0x48bc('0x49')]));_0x174670[_0x48bc('0x47')]=_0x174670[_0x48bc('0x47')][_0x48bc('0x4a')]?_0x174670[_0x48bc('0x47')]:_0x2471d0[_0x48bc('0x48')];_0x174670['order']=qs[_0x48bc('0x4e')](_0x30d8df[_0x48bc('0x43')]['sort']);_0x174670['where']=qs[_0x48bc('0x45')](_[_0x48bc('0x50')](_0x30d8df[_0x48bc('0x43')],_0x2471d0['filters']));if(_0x30d8df['query'][_0x48bc('0x51')]){_0x174670[_0x48bc('0x4f')]=_[_0x48bc('0x52')](_0x174670[_0x48bc('0x4f')],{'$or':_[_0x48bc('0x3e')](_0x174670[_0x48bc('0x47')],function(_0x25cf71){var _0x1d05db={};_0x1d05db[_0x25cf71]={'$like':'%'+_0x30d8df[_0x48bc('0x43')]['filter']+'%'};return _0x1d05db;})});}_0x174670=_[_0x48bc('0x52')]({},_0x174670,_0x30d8df[_0x48bc('0x54')]);return _0x406b9a['getAgents'](_0x174670);}})[_0x48bc('0x23')](function(_0x32363a){if(_0x32363a){_0xdaa3c=_0x32363a[_0x48bc('0x4a')];if(!_0x30d8df[_0x48bc('0x43')]['hasOwnProperty']('nolimit')){_0x174670['limit']=qs['limit'](_0x30d8df[_0x48bc('0x43')][_0x48bc('0x30')]);_0x174670[_0x48bc('0x2f')]=qs[_0x48bc('0x2f')](_0x30d8df[_0x48bc('0x43')]['offset']);}return _0x406b9a['getAgents'](_0x174670);}})[_0x48bc('0x23')](function(_0x1eaa4b){if(_0x1eaa4b){return _0x1eaa4b?{'count':_0xdaa3c,'rows':_0x1eaa4b}:null;}})['then'](respondWithResult(_0x1cbc20,null))[_0x48bc('0x2b')](handleError(_0x1cbc20,null));}; \ No newline at end of file +var _0xfda8=['MailServerIn','Smtp','Pause','mandatoryDispositionPause','map','MailAccount','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','filters','pick','filter','VIRTUAL','merge','options','count','includeAll','include','findAll','params','Imap','keys','rawAttributes','find','body','describe','addDisposition','MailAccountId','Disposition','create','getDispositions','order','rows','removeDispositions','ids','addAnswer','CannedAnswer','ListId','isNil','active','description','cservice','user','cuser','password','pass','authentication','host','port','service','cpassword','MailServerOut','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','findOne','removeImap','setImap','getSmtp','addSmtp','removeSmtp','MailInteraction','addInteraction','omit','getInteractions','CmContact','Contact','User','Owner','fullname','internal','Tag','Tags','tag','addApplications','sequelize','transaction','MailApplication','bulkCreate','findAndCountAll','priority','getApplications','getMessages','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','List','Contacts','updatedAt','DESC','from','%s\x20<%s>','email','attachments','root','basename','auth','secure','SendMail','sendMail','messageId','attach','out','Interaction','Messages','verifySmtp','VerifySmtp','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','userMailAccount:save','removeAgents','emit','userMailAccount:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','moment','path','sox','to-csv','ejs','lodash','squel','crypto','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','./mailAccount.socket','register','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','request\x20sent','debug','stringify','error','MailAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','set','apply','reject','save','update','destroy','get','MailAccounts','UserProfileResource','stack','name','send','index'];(function(_0x13b8f3,_0x442821){var _0x1a6d06=function(_0x5126f2){while(--_0x5126f2){_0x13b8f3['push'](_0x13b8f3['shift']());}};_0x1a6d06(++_0x442821);}(_0xfda8,0x144));var _0x8fda=function(_0x11bec1,_0x27abcc){_0x11bec1=_0x11bec1-0x0;var _0x36035e=_0xfda8[_0x11bec1];return _0x36035e;};'use strict';var pdf=require(_0x8fda('0x0'));var emlformat=require(_0x8fda('0x1'));var rimraf=require(_0x8fda('0x2'));var zipdir=require(_0x8fda('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x8fda('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x8fda('0x5'));var sox=require(_0x8fda('0x6'));var csv=require(_0x8fda('0x7'));var ejs=require(_0x8fda('0x8'));var fs=require('fs');var _=require(_0x8fda('0x9'));var squel=require(_0x8fda('0xa'));var crypto=require(_0x8fda('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x8fda('0xc'));var Papa=require(_0x8fda('0xd'));var Redis=require(_0x8fda('0xe'));var authService=require(_0x8fda('0xf'));var qs=require(_0x8fda('0x10'));var as=require(_0x8fda('0x11'));var hardwareService=require(_0x8fda('0x12'));var logger=require(_0x8fda('0x13'))(_0x8fda('0x14'));var utils=require(_0x8fda('0x15'));var config=require(_0x8fda('0x16'));var db=require(_0x8fda('0x17'))['db'];config[_0x8fda('0x18')]=_[_0x8fda('0x19')](config['redis'],{'host':_0x8fda('0x1a'),'port':0x18eb});var socket=require(_0x8fda('0x1b'))(new Redis(config[_0x8fda('0x18')]));require(_0x8fda('0x1c'))[_0x8fda('0x1d')](socket);var jayson=require(_0x8fda('0x1e'));var client=jayson[_0x8fda('0x1f')][_0x8fda('0x20')]({'port':0x232b});function checkPasswordPattern(_0x4dcd93,_0xd0f265,_0x3e8e66){if(_0x3e8e66){var _0x58f627=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x58f627[_0x8fda('0x21')](_0xd0f265)){return _0x4dcd93;}else{throw new db[(_0x8fda('0x22'))][(_0x8fda('0x23'))](_0x8fda('0x24'));}}else{return _0x4dcd93;}}function respondWithRpcPromise(_0x43ab14,_0x422f8b,_0x89c81,_0x4289b9){return new BPromise(function(_0x5ca251,_0x274c7b){var _0x4437c0=_0x4289b9||client;return _0x4437c0[_0x8fda('0x25')](_0x43ab14,_0x89c81)[_0x8fda('0x26')](function(_0x3de938){logger[_0x8fda('0x27')]('MailAccount,\x20%s,\x20%s',_0x422f8b,_0x8fda('0x28'));logger[_0x8fda('0x29')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x422f8b,'request\x20sent',JSON[_0x8fda('0x2a')](_0x3de938));if(_0x3de938[_0x8fda('0x2b')]){if(_0x3de938['error']['code']===0x1f4){logger[_0x8fda('0x2b')](_0x8fda('0x2c'),_0x422f8b,_0x3de938[_0x8fda('0x2b')][_0x8fda('0x2d')]);return _0x274c7b(_0x3de938[_0x8fda('0x2b')][_0x8fda('0x2d')]);}logger['error'](_0x8fda('0x2c'),_0x422f8b,_0x3de938['error'][_0x8fda('0x2d')]);return _0x5ca251(_0x3de938[_0x8fda('0x2b')][_0x8fda('0x2d')]);}else{logger[_0x8fda('0x27')](_0x8fda('0x2c'),_0x422f8b,_0x8fda('0x28'));_0x5ca251(_0x3de938[_0x8fda('0x2e')][_0x8fda('0x2d')]);}})[_0x8fda('0x2f')](function(_0x277761){logger['error'](_0x8fda('0x2c'),_0x422f8b,_0x277761);_0x274c7b(_0x277761);});});}function respondWithStatusCode(_0x3f2dfa,_0x4877d0){_0x4877d0=_0x4877d0||0xcc;return function(_0x4dee8c){if(_0x4dee8c){return _0x3f2dfa[_0x8fda('0x30')](_0x4877d0);}return _0x3f2dfa[_0x8fda('0x31')](_0x4877d0)[_0x8fda('0x32')]();};}function respondWithResult(_0x37f1f9,_0x20a46a){_0x20a46a=_0x20a46a||0xc8;return function(_0x1952ed){if(_0x1952ed){return _0x37f1f9[_0x8fda('0x31')](_0x20a46a)[_0x8fda('0x33')](_0x1952ed);}};}function respondWithFilteredResult(_0x169400,_0x20d434){return function(_0x5e0f02){if(_0x5e0f02){var _0x1eea3d=_0x5e0f02['count'],_0x3d0505=_0x20d434[_0x8fda('0x34')],_0x4b08cb=_0x20d434['offset']+_0x20d434['limit'],_0x42f5cd;if(_0x4b08cb>=_0x1eea3d){_0x4b08cb=_0x1eea3d;_0x42f5cd=0xc8;}else{_0x42f5cd=0xce;}_0x169400[_0x8fda('0x31')](_0x42f5cd);return _0x169400[_0x8fda('0x35')]('Content-Range',_0x3d0505+'-'+_0x4b08cb+'/'+_0x1eea3d)['json'](_0x5e0f02);}return null;};}function patchUpdates(_0x3ddf9c){return function(_0x2a8683){try{jsonpatch[_0x8fda('0x36')](_0x2a8683,_0x3ddf9c,!![]);}catch(_0x54afa0){return BPromise[_0x8fda('0x37')](_0x54afa0);}return _0x2a8683[_0x8fda('0x38')]();};}function saveUpdates(_0x103f58,_0x55e0b5){return function(_0x5509f5){if(_0x5509f5){return _0x5509f5[_0x8fda('0x39')](_0x103f58)[_0x8fda('0x26')](function(_0x1af83b){return _0x1af83b;});}return null;};}function removeEntity(_0x338f48,_0xc111cb){return function(_0x1c52ec){if(_0x1c52ec){return _0x1c52ec[_0x8fda('0x3a')]()['then'](function(){var _0x17e579=_0x1c52ec[_0x8fda('0x3b')]({'plain':!![]});var _0x3af1c0=_0x8fda('0x3c');return db[_0x8fda('0x3d')][_0x8fda('0x3a')]({'where':{'type':_0x3af1c0,'resourceId':_0x17e579['id']}})[_0x8fda('0x26')](function(){return _0x1c52ec;});})[_0x8fda('0x26')](function(){_0x338f48[_0x8fda('0x31')](0xcc)[_0x8fda('0x32')]();});}};}function handleEntityNotFound(_0x1d65e9,_0x1eaac7){return function(_0x4376ce){if(!_0x4376ce){_0x1d65e9['sendStatus'](0x194);}return _0x4376ce;};}function handleError(_0x8c177d,_0x31f743){_0x31f743=_0x31f743||0x1f4;return function(_0x4cf56b){logger[_0x8fda('0x2b')](_0x4cf56b[_0x8fda('0x3e')]);if(_0x4cf56b['name']){delete _0x4cf56b[_0x8fda('0x3f')];}_0x8c177d[_0x8fda('0x31')](_0x31f743)[_0x8fda('0x40')](_0x4cf56b);};}exports[_0x8fda('0x41')]=function(_0xdedb9f,_0xf6fb71){var _0x3b4af9={'include':[{'model':db[_0x8fda('0x42')],'as':'Imap'},{'model':db['MailServerOut'],'as':_0x8fda('0x43')},{'model':db[_0x8fda('0x44')],'as':_0x8fda('0x45')}]},_0x1cf0dc={},_0x163b81={'count':0x0,'rows':[]};var _0x4bf208=_[_0x8fda('0x46')](db[_0x8fda('0x47')]['rawAttributes'],function(_0x5c4e4a){return{'name':_0x5c4e4a['fieldName'],'type':_0x5c4e4a[_0x8fda('0x48')][_0x8fda('0x49')]};});_0x1cf0dc[_0x8fda('0x4a')]=_[_0x8fda('0x46')](_0x4bf208,'name');_0x1cf0dc[_0x8fda('0x4b')]=_['keys'](_0xdedb9f['query']);_0x1cf0dc['filters']=_[_0x8fda('0x4c')](_0x1cf0dc[_0x8fda('0x4a')],_0x1cf0dc['query']);_0x3b4af9[_0x8fda('0x4d')]=_[_0x8fda('0x4c')](_0x1cf0dc['model'],qs[_0x8fda('0x4e')](_0xdedb9f[_0x8fda('0x4b')][_0x8fda('0x4e')]));_0x3b4af9[_0x8fda('0x4d')]=_0x3b4af9[_0x8fda('0x4d')][_0x8fda('0x4f')]?_0x3b4af9[_0x8fda('0x4d')]:_0x1cf0dc[_0x8fda('0x4a')];if(!_0xdedb9f[_0x8fda('0x4b')][_0x8fda('0x50')](_0x8fda('0x51'))){_0x3b4af9['limit']=qs[_0x8fda('0x52')](_0xdedb9f['query'][_0x8fda('0x52')]);_0x3b4af9[_0x8fda('0x34')]=qs[_0x8fda('0x34')](_0xdedb9f[_0x8fda('0x4b')][_0x8fda('0x34')]);}_0x3b4af9['order']=qs[_0x8fda('0x53')](_0xdedb9f[_0x8fda('0x4b')][_0x8fda('0x53')]);_0x3b4af9[_0x8fda('0x54')]=qs[_0x8fda('0x55')](_[_0x8fda('0x56')](_0xdedb9f['query'],_0x1cf0dc['filters']),_0x4bf208);if(_0xdedb9f[_0x8fda('0x4b')][_0x8fda('0x57')]){_0x3b4af9['where']=_['merge'](_0x3b4af9[_0x8fda('0x54')],{'$or':_[_0x8fda('0x46')](_0x4bf208,function(_0x12fec4){if(_0x12fec4['type']!==_0x8fda('0x58')){var _0x3db237={};_0x3db237[_0x12fec4[_0x8fda('0x3f')]]={'$like':'%'+_0xdedb9f[_0x8fda('0x4b')][_0x8fda('0x57')]+'%'};return _0x3db237;}})});}_0x3b4af9=_[_0x8fda('0x59')]({},_0x3b4af9,_0xdedb9f[_0x8fda('0x5a')]);var _0x1e1a2f={'where':_0x3b4af9[_0x8fda('0x54')]};return db[_0x8fda('0x47')][_0x8fda('0x5b')](_0x1e1a2f)['then'](function(_0x90599d){_0x163b81[_0x8fda('0x5b')]=_0x90599d;if(_0xdedb9f['query'][_0x8fda('0x5c')]){_0x3b4af9[_0x8fda('0x5d')]=[{'all':!![]}];}return db['MailAccount'][_0x8fda('0x5e')](_0x3b4af9);})[_0x8fda('0x26')](function(_0x134545){_0x163b81['rows']=_0x134545;return _0x163b81;})['then'](respondWithFilteredResult(_0xf6fb71,_0x3b4af9))['catch'](handleError(_0xf6fb71,null));};exports['show']=function(_0x3ba9a6,_0x14844e){var _0x1ec954={'raw':![],'where':{'id':_0x3ba9a6[_0x8fda('0x5f')]['id']},'include':[{'model':db[_0x8fda('0x42')],'as':_0x8fda('0x60')},{'model':db['MailServerOut'],'as':_0x8fda('0x43')},{'model':db[_0x8fda('0x44')],'as':_0x8fda('0x45')}]},_0x41f2b9={};_0x41f2b9[_0x8fda('0x4a')]=_[_0x8fda('0x61')](db['MailAccount'][_0x8fda('0x62')]);_0x41f2b9[_0x8fda('0x4b')]=_[_0x8fda('0x61')](_0x3ba9a6[_0x8fda('0x4b')]);_0x41f2b9[_0x8fda('0x55')]=_['intersection'](_0x41f2b9['model'],_0x41f2b9[_0x8fda('0x4b')]);_0x1ec954['attributes']=_[_0x8fda('0x4c')](_0x41f2b9['model'],qs[_0x8fda('0x4e')](_0x3ba9a6[_0x8fda('0x4b')][_0x8fda('0x4e')]));_0x1ec954[_0x8fda('0x4d')]=_0x1ec954['attributes']['length']?_0x1ec954[_0x8fda('0x4d')]:_0x41f2b9[_0x8fda('0x4a')];if(_0x3ba9a6[_0x8fda('0x4b')][_0x8fda('0x5c')]){_0x1ec954[_0x8fda('0x5d')]=[{'all':!![]}];}_0x1ec954=_[_0x8fda('0x59')]({},_0x1ec954,_0x3ba9a6[_0x8fda('0x5a')]);return db[_0x8fda('0x47')][_0x8fda('0x63')](_0x1ec954)['then'](handleEntityNotFound(_0x14844e,null))[_0x8fda('0x26')](respondWithResult(_0x14844e,null))[_0x8fda('0x2f')](handleError(_0x14844e,null));};exports[_0x8fda('0x39')]=function(_0x472250,_0x24d9bb){if(_0x472250[_0x8fda('0x64')]['id']){delete _0x472250['body']['id'];}return db[_0x8fda('0x47')][_0x8fda('0x63')]({'where':{'id':_0x472250[_0x8fda('0x5f')]['id']},'include':[{'model':db[_0x8fda('0x42')],'as':_0x8fda('0x60')},{'model':db['MailServerOut'],'as':_0x8fda('0x43')},{'model':db[_0x8fda('0x44')],'as':_0x8fda('0x45')}]})[_0x8fda('0x26')](handleEntityNotFound(_0x24d9bb,null))[_0x8fda('0x26')](saveUpdates(_0x472250['body'],null))[_0x8fda('0x26')](function(_0x2693e9){if(_0x2693e9&&_0x472250[_0x8fda('0x64')][_0x8fda('0x60')]){return db['MailServerIn'][_0x8fda('0x39')](_0x472250[_0x8fda('0x64')][_0x8fda('0x60')],{'where':{'MailAccountId':_0x2693e9['id']}})[_0x8fda('0x26')](function(){return _0x2693e9;});}return _0x2693e9;})[_0x8fda('0x26')](function(_0x1a103f){if(_0x1a103f&&_0x472250[_0x8fda('0x64')]['Smtp']){return db['MailServerOut']['update'](_0x472250[_0x8fda('0x64')][_0x8fda('0x43')],{'where':{'MailAccountId':_0x1a103f['id']}})[_0x8fda('0x26')](function(){return _0x1a103f;});}return _0x1a103f;})[_0x8fda('0x26')](respondWithResult(_0x24d9bb,null))['catch'](handleError(_0x24d9bb,null));};exports[_0x8fda('0x65')]=function(_0x147479,_0x1cbe61){return db['MailAccount'][_0x8fda('0x65')]()[_0x8fda('0x26')](respondWithResult(_0x1cbe61,null))['catch'](handleError(_0x1cbe61,null));};exports[_0x8fda('0x66')]=function(_0x465b0e,_0x77f842,_0x42b656){if(_0x465b0e['body']['id']){delete _0x465b0e[_0x8fda('0x64')]['id'];}return db[_0x8fda('0x47')]['find']({'where':{'id':_0x465b0e['params']['id']}})[_0x8fda('0x26')](handleEntityNotFound(_0x77f842,null))[_0x8fda('0x26')](function(_0x12270f){if(_0x12270f){_0x465b0e[_0x8fda('0x64')][_0x8fda('0x67')]=_0x12270f['id'];return db[_0x8fda('0x68')][_0x8fda('0x69')](_0x465b0e[_0x8fda('0x64')]);}})[_0x8fda('0x26')](respondWithResult(_0x77f842,null))[_0x8fda('0x2f')](handleError(_0x77f842,null));};exports[_0x8fda('0x6a')]=function(_0x39d889,_0x543379,_0x599c08){var _0x4c8e72={'raw':![],'where':{}};var _0x3e187c={};var _0x566dee={'count':0x0,'rows':[]};return db[_0x8fda('0x47')]['findOne']({'where':{'id':_0x39d889['params']['id']}})[_0x8fda('0x26')](handleEntityNotFound(_0x543379,null))[_0x8fda('0x26')](function(_0x24df68){if(_0x24df68){_0x3e187c[_0x8fda('0x4a')]=_[_0x8fda('0x61')](db[_0x8fda('0x68')][_0x8fda('0x62')]);_0x3e187c[_0x8fda('0x4b')]=_[_0x8fda('0x61')](_0x39d889[_0x8fda('0x4b')]);_0x3e187c[_0x8fda('0x55')]=_[_0x8fda('0x4c')](_0x3e187c[_0x8fda('0x4a')],_0x3e187c[_0x8fda('0x4b')]);_0x4c8e72['attributes']=_[_0x8fda('0x4c')](_0x3e187c[_0x8fda('0x4a')],qs[_0x8fda('0x4e')](_0x39d889[_0x8fda('0x4b')][_0x8fda('0x4e')]));_0x4c8e72[_0x8fda('0x4d')]=_0x4c8e72[_0x8fda('0x4d')]['length']?_0x4c8e72['attributes']:_0x3e187c['model'];if(!_0x39d889[_0x8fda('0x4b')]['hasOwnProperty'](_0x8fda('0x51'))){_0x4c8e72['limit']=qs[_0x8fda('0x52')](_0x39d889[_0x8fda('0x4b')][_0x8fda('0x52')]);_0x4c8e72[_0x8fda('0x34')]=qs[_0x8fda('0x34')](_0x39d889[_0x8fda('0x4b')][_0x8fda('0x34')]);}_0x4c8e72[_0x8fda('0x6b')]=qs[_0x8fda('0x53')](_0x39d889[_0x8fda('0x4b')][_0x8fda('0x53')]);_0x4c8e72['where']=qs[_0x8fda('0x55')](_[_0x8fda('0x56')](_0x39d889[_0x8fda('0x4b')],_0x3e187c[_0x8fda('0x55')]));_0x4c8e72['where'][_0x8fda('0x67')]=_0x24df68['id'];if(_0x39d889[_0x8fda('0x4b')][_0x8fda('0x57')]){_0x4c8e72[_0x8fda('0x54')]=_['merge'](_0x4c8e72['where'],{'$or':_[_0x8fda('0x46')](_0x4c8e72[_0x8fda('0x4d')],function(_0x58fd86){var _0x14aea8={};_0x14aea8[_0x58fd86]={'$like':'%'+_0x39d889[_0x8fda('0x4b')][_0x8fda('0x57')]+'%'};return _0x14aea8;})});}_0x4c8e72=_[_0x8fda('0x59')]({},_0x4c8e72,_0x39d889[_0x8fda('0x5a')]);return db['Disposition'][_0x8fda('0x5b')]({'where':_0x4c8e72['where']})[_0x8fda('0x26')](function(_0xb6f8cc){_0x566dee['count']=_0xb6f8cc;if(_0x39d889[_0x8fda('0x4b')][_0x8fda('0x5c')]){_0x4c8e72[_0x8fda('0x5d')]=[{'all':!![]}];}return db['Disposition'][_0x8fda('0x5e')](_0x4c8e72);})['then'](function(_0x4d48af){_0x566dee[_0x8fda('0x6c')]=_0x4d48af;return _0x566dee;});}})['then'](respondWithFilteredResult(_0x543379,_0x4c8e72))[_0x8fda('0x2f')](handleError(_0x543379,null));};exports[_0x8fda('0x6d')]=function(_0x36aa88,_0x10236e,_0x49f4c8){return db[_0x8fda('0x47')][_0x8fda('0x63')]({'where':{'id':_0x36aa88[_0x8fda('0x5f')]['id']}})['then'](handleEntityNotFound(_0x10236e,null))[_0x8fda('0x26')](function(_0x2a16dc){if(_0x2a16dc){return _0x2a16dc['removeDispositions'](_0x36aa88['query'][_0x8fda('0x6e')]);}})[_0x8fda('0x26')](respondWithStatusCode(_0x10236e,null))[_0x8fda('0x2f')](handleError(_0x10236e,null));};exports[_0x8fda('0x6f')]=function(_0x1a4c47,_0x4479e0,_0x57131c){if(_0x1a4c47['body']['id']){delete _0x1a4c47[_0x8fda('0x64')]['id'];}return db[_0x8fda('0x47')][_0x8fda('0x63')]({'where':{'id':_0x1a4c47['params']['id']}})[_0x8fda('0x26')](handleEntityNotFound(_0x4479e0,null))[_0x8fda('0x26')](function(_0x28aae3){if(_0x28aae3){_0x1a4c47[_0x8fda('0x64')][_0x8fda('0x67')]=_0x28aae3['id'];return db[_0x8fda('0x70')]['create'](_0x1a4c47[_0x8fda('0x64')]);}})['then'](respondWithResult(_0x4479e0,null))[_0x8fda('0x2f')](handleError(_0x4479e0,null));};exports['getAnswers']=function(_0x14e4c3,_0x3a25b1,_0xa0bdea){var _0x17595e={'raw':![],'where':{}};var _0x34d35e={};var _0x28b5aa={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x14e4c3['params']['id']}})['then'](handleEntityNotFound(_0x3a25b1,null))['then'](function(_0x36ab0d){if(_0x36ab0d){_0x34d35e[_0x8fda('0x4a')]=_['keys'](db[_0x8fda('0x70')][_0x8fda('0x62')]);_0x34d35e['query']=_['keys'](_0x14e4c3['query']);_0x34d35e['filters']=_[_0x8fda('0x4c')](_0x34d35e[_0x8fda('0x4a')],_0x34d35e[_0x8fda('0x4b')]);_0x17595e[_0x8fda('0x4d')]=_['intersection'](_0x34d35e[_0x8fda('0x4a')],qs['fields'](_0x14e4c3[_0x8fda('0x4b')]['fields']));_0x17595e[_0x8fda('0x4d')]=_0x17595e[_0x8fda('0x4d')]['length']?_0x17595e[_0x8fda('0x4d')]:_0x34d35e['model'];if(!_0x14e4c3[_0x8fda('0x4b')][_0x8fda('0x50')]('nolimit')){_0x17595e[_0x8fda('0x52')]=qs['limit'](_0x14e4c3[_0x8fda('0x4b')][_0x8fda('0x52')]);_0x17595e[_0x8fda('0x34')]=qs['offset'](_0x14e4c3[_0x8fda('0x4b')][_0x8fda('0x34')]);}_0x17595e[_0x8fda('0x6b')]=qs[_0x8fda('0x53')](_0x14e4c3[_0x8fda('0x4b')][_0x8fda('0x53')]);_0x17595e[_0x8fda('0x54')]=qs[_0x8fda('0x55')](_[_0x8fda('0x56')](_0x14e4c3[_0x8fda('0x4b')],_0x34d35e['filters']));_0x17595e[_0x8fda('0x54')][_0x8fda('0x67')]=_0x36ab0d['id'];if(_0x14e4c3['query'][_0x8fda('0x57')]){_0x17595e[_0x8fda('0x54')]=_[_0x8fda('0x59')](_0x17595e[_0x8fda('0x54')],{'$or':_[_0x8fda('0x46')](_0x17595e[_0x8fda('0x4d')],function(_0x3c9650){var _0x33e206={};_0x33e206[_0x3c9650]={'$like':'%'+_0x14e4c3['query']['filter']+'%'};return _0x33e206;})});}_0x17595e=_[_0x8fda('0x59')]({},_0x17595e,_0x14e4c3[_0x8fda('0x5a')]);return db[_0x8fda('0x70')][_0x8fda('0x5b')]({'where':_0x17595e['where']})[_0x8fda('0x26')](function(_0xe36edd){_0x28b5aa[_0x8fda('0x5b')]=_0xe36edd;if(_0x14e4c3[_0x8fda('0x4b')][_0x8fda('0x5c')]){_0x17595e[_0x8fda('0x5d')]=[{'all':!![]}];}return db['CannedAnswer'][_0x8fda('0x5e')](_0x17595e);})[_0x8fda('0x26')](function(_0x447eb8){_0x28b5aa[_0x8fda('0x6c')]=_0x447eb8;return _0x28b5aa;});}})[_0x8fda('0x26')](respondWithFilteredResult(_0x3a25b1,_0x17595e))[_0x8fda('0x2f')](handleError(_0x3a25b1,null));};exports['removeAnswers']=function(_0x5e4b7a,_0x4fc924,_0x2036c6){return db[_0x8fda('0x47')][_0x8fda('0x63')]({'where':{'id':_0x5e4b7a[_0x8fda('0x5f')]['id']}})[_0x8fda('0x26')](handleEntityNotFound(_0x4fc924,null))[_0x8fda('0x26')](function(_0x252c47){if(_0x252c47){return _0x252c47['removeAnswers'](_0x5e4b7a[_0x8fda('0x4b')][_0x8fda('0x6e')]);}})['then'](respondWithStatusCode(_0x4fc924,null))[_0x8fda('0x2f')](handleError(_0x4fc924,null));};exports['create']=function(_0x33e6a3,_0x63f36c){var _0x35412e={'name':_0x33e6a3[_0x8fda('0x64')][_0x8fda('0x3f')],'key':_0x33e6a3[_0x8fda('0x64')][_0x8fda('0x49')],'email':_0x33e6a3[_0x8fda('0x64')]['email'],'ListId':_0x33e6a3['body'][_0x8fda('0x71')],'active':!_[_0x8fda('0x72')](_0x33e6a3['body'][_0x8fda('0x73')])?_0x33e6a3[_0x8fda('0x64')][_0x8fda('0x73')]:!![],'description':_0x33e6a3[_0x8fda('0x64')][_0x8fda('0x74')]||null,'Imap':{},'Smtp':{}};if(_[_0x8fda('0x72')](_0x33e6a3['body'][_0x8fda('0x75')])){if(_0x33e6a3['body']['cauthentication']){_0x35412e[_0x8fda('0x60')][_0x8fda('0x76')]=_0x35412e[_0x8fda('0x43')][_0x8fda('0x76')]=_0x33e6a3[_0x8fda('0x64')][_0x8fda('0x77')];_0x35412e['Imap'][_0x8fda('0x78')]=_0x35412e['Smtp'][_0x8fda('0x79')]=_0x33e6a3['body']['cpassword'];}else{_0x35412e[_0x8fda('0x60')][_0x8fda('0x7a')]=_0x35412e[_0x8fda('0x43')][_0x8fda('0x7a')]=![];}_0x35412e['Imap'][_0x8fda('0x7b')]=_0x33e6a3[_0x8fda('0x64')]['Imap'][_0x8fda('0x7b')];_0x35412e[_0x8fda('0x60')][_0x8fda('0x7c')]=_0x33e6a3['body'][_0x8fda('0x60')][_0x8fda('0x7c')];_0x35412e['Smtp'][_0x8fda('0x7b')]=_0x33e6a3[_0x8fda('0x64')][_0x8fda('0x43')][_0x8fda('0x7b')];_0x35412e[_0x8fda('0x43')][_0x8fda('0x7c')]=_0x33e6a3['body'][_0x8fda('0x43')]['port'];}else{_0x35412e[_0x8fda('0x60')][_0x8fda('0x7d')]=_0x35412e[_0x8fda('0x43')][_0x8fda('0x7d')]=_0x33e6a3['body'][_0x8fda('0x75')];_0x35412e[_0x8fda('0x60')][_0x8fda('0x76')]=_0x35412e[_0x8fda('0x43')]['user']=_0x33e6a3[_0x8fda('0x64')][_0x8fda('0x77')];_0x35412e['Imap'][_0x8fda('0x78')]=_0x35412e[_0x8fda('0x43')][_0x8fda('0x79')]=_0x33e6a3[_0x8fda('0x64')][_0x8fda('0x7e')];}return db['MailAccount']['create'](_0x35412e,{'include':[{'model':db[_0x8fda('0x7f')],'as':_0x8fda('0x43')},{'model':db[_0x8fda('0x42')],'as':'Imap'}]})[_0x8fda('0x26')](function(_0x96bfae){var _0x4614f6=_0x33e6a3['user'][_0x8fda('0x3b')]({'plain':!![]});if(!_0x4614f6)throw new Error(_0x8fda('0x80'));if(_0x4614f6[_0x8fda('0x81')]===_0x8fda('0x76')){var _0x174812=_0x96bfae[_0x8fda('0x3b')]({'plain':!![]});return db[_0x8fda('0x82')][_0x8fda('0x63')]({'where':{'name':_0x8fda('0x3c'),'userProfileId':_0x4614f6['userProfileId']},'raw':!![]})[_0x8fda('0x26')](function(_0x2c48ac){if(_0x2c48ac&&_0x2c48ac['autoAssociation']===0x0){return db[_0x8fda('0x3d')][_0x8fda('0x69')]({'name':_0x174812[_0x8fda('0x3f')],'resourceId':_0x174812['id'],'type':_0x2c48ac[_0x8fda('0x3f')],'sectionId':_0x2c48ac['id']},{})[_0x8fda('0x26')](function(){return _0x96bfae;});}else{return _0x96bfae;}})[_0x8fda('0x2f')](function(_0xed79e7){logger['error'](_0x8fda('0x83'),_0xed79e7);throw _0xed79e7;});}return _0x96bfae;})[_0x8fda('0x26')](respondWithResult(_0x63f36c,0xc9))['catch'](handleError(_0x63f36c,null));};exports[_0x8fda('0x84')]=function(_0x53692d,_0x5c3b21,_0x4b9a1e){return db[_0x8fda('0x47')][_0x8fda('0x85')]({'where':{'id':_0x53692d['params']['id']}})['then'](handleEntityNotFound(_0x5c3b21,null))['then'](function(_0x55b777){if(_0x55b777){return _0x55b777[_0x8fda('0x84')]();}return null;})[_0x8fda('0x26')](respondWithResult(_0x5c3b21,null))[_0x8fda('0x2f')](handleError(_0x5c3b21,null));};exports['addImap']=function(_0x1b2690,_0x59e510,_0x482f7e){if(_0x1b2690['body']['id']){delete _0x1b2690[_0x8fda('0x64')]['id'];}return db[_0x8fda('0x47')][_0x8fda('0x63')]({'where':{'id':_0x1b2690[_0x8fda('0x5f')]['id']}})[_0x8fda('0x26')](handleEntityNotFound(_0x59e510,null))[_0x8fda('0x26')](function(_0x3db47d){if(_0x3db47d){_0x1b2690[_0x8fda('0x64')][_0x8fda('0x67')]=_0x3db47d['id'];return db[_0x8fda('0x42')][_0x8fda('0x69')](_0x1b2690[_0x8fda('0x64')]);}})[_0x8fda('0x26')](respondWithResult(_0x59e510,null))[_0x8fda('0x2f')](handleError(_0x59e510,null));};exports[_0x8fda('0x86')]=function(_0x4e8e9b,_0x27a14c,_0x44ce22){return db['MailAccount'][_0x8fda('0x85')]({'where':{'id':_0x4e8e9b['params']['id']}})[_0x8fda('0x26')](handleEntityNotFound(_0x27a14c,null))[_0x8fda('0x26')](function(_0x113af7){if(_0x113af7){return _0x113af7[_0x8fda('0x87')](null);}return null;})['then'](respondWithStatusCode(_0x27a14c,null))[_0x8fda('0x2f')](handleError(_0x27a14c,null));};exports['getSmtp']=function(_0x52e5f4,_0x6f0264,_0x1d9a37){return db[_0x8fda('0x47')][_0x8fda('0x85')]({'where':{'id':_0x52e5f4[_0x8fda('0x5f')]['id']}})[_0x8fda('0x26')](handleEntityNotFound(_0x6f0264,null))[_0x8fda('0x26')](function(_0x3fc25f){if(_0x3fc25f){return _0x3fc25f[_0x8fda('0x88')]();}return null;})['then'](respondWithResult(_0x6f0264,null))[_0x8fda('0x2f')](handleError(_0x6f0264,null));};exports[_0x8fda('0x89')]=function(_0x33a2ec,_0x142fdc,_0x5c69ea){if(_0x33a2ec[_0x8fda('0x64')]['id']){delete _0x33a2ec[_0x8fda('0x64')]['id'];}return db[_0x8fda('0x47')]['find']({'where':{'id':_0x33a2ec[_0x8fda('0x5f')]['id']}})[_0x8fda('0x26')](handleEntityNotFound(_0x142fdc,null))[_0x8fda('0x26')](function(_0x209873){if(_0x209873){_0x33a2ec[_0x8fda('0x64')][_0x8fda('0x67')]=_0x209873['id'];return db['MailServerOut'][_0x8fda('0x69')](_0x33a2ec[_0x8fda('0x64')]);}})['then'](respondWithResult(_0x142fdc,null))[_0x8fda('0x2f')](handleError(_0x142fdc,null));};exports[_0x8fda('0x8a')]=function(_0x1badf5,_0x27eb9f,_0x5bf90c){return db[_0x8fda('0x47')][_0x8fda('0x85')]({'where':{'id':_0x1badf5['params']['id']}})[_0x8fda('0x26')](handleEntityNotFound(_0x27eb9f,null))[_0x8fda('0x26')](function(_0x231e60){if(_0x231e60){return _0x231e60['setSmtp'](null);}return null;})[_0x8fda('0x26')](respondWithStatusCode(_0x27eb9f,null))[_0x8fda('0x2f')](handleError(_0x27eb9f,null));};exports['addInteraction']=function(_0x248ff2,_0xaf8aea,_0x413665){return db[_0x8fda('0x8b')][_0x8fda('0x63')]({'where':{'id':_0x248ff2[_0x8fda('0x5f')]['id']}})[_0x8fda('0x26')](handleEntityNotFound(_0xaf8aea,null))[_0x8fda('0x26')](function(_0x50aa56){if(_0x50aa56){return _0x50aa56[_0x8fda('0x8c')](_0x248ff2[_0x8fda('0x64')][_0x8fda('0x6e')],_[_0x8fda('0x8d')](_0x248ff2[_0x8fda('0x64')],[_0x8fda('0x6e'),'id'])||{});}})['then'](respondWithResult(_0xaf8aea,null))['catch'](handleError(_0xaf8aea,null));};exports[_0x8fda('0x8e')]=function(_0x458c1c,_0xa176f3,_0x3a2d11){var _0x5f28c7={'raw':![],'where':{}};var _0x29e026={};var _0x395c58={'count':0x0,'rows':[]};return db[_0x8fda('0x47')][_0x8fda('0x85')]({'where':{'id':_0x458c1c[_0x8fda('0x5f')]['id']}})['then'](handleEntityNotFound(_0xa176f3,null))['then'](function(_0x4147a4){if(_0x4147a4){_0x29e026[_0x8fda('0x4a')]=_[_0x8fda('0x61')](db[_0x8fda('0x8b')][_0x8fda('0x62')]);_0x29e026[_0x8fda('0x4b')]=_[_0x8fda('0x61')](_0x458c1c[_0x8fda('0x4b')]);_0x29e026['filters']=_[_0x8fda('0x4c')](_0x29e026[_0x8fda('0x4a')],_0x29e026[_0x8fda('0x4b')]);_0x5f28c7[_0x8fda('0x4d')]=_[_0x8fda('0x4c')](_0x29e026[_0x8fda('0x4a')],qs[_0x8fda('0x4e')](_0x458c1c[_0x8fda('0x4b')][_0x8fda('0x4e')]));_0x5f28c7[_0x8fda('0x4d')]=_0x5f28c7[_0x8fda('0x4d')][_0x8fda('0x4f')]?_0x5f28c7[_0x8fda('0x4d')]:_0x29e026[_0x8fda('0x4a')];if(!_0x458c1c[_0x8fda('0x4b')][_0x8fda('0x50')](_0x8fda('0x51'))){_0x5f28c7[_0x8fda('0x52')]=qs[_0x8fda('0x52')](_0x458c1c[_0x8fda('0x4b')][_0x8fda('0x52')]);_0x5f28c7[_0x8fda('0x34')]=qs[_0x8fda('0x34')](_0x458c1c[_0x8fda('0x4b')][_0x8fda('0x34')]);}_0x5f28c7[_0x8fda('0x6b')]=qs[_0x8fda('0x53')](_0x458c1c[_0x8fda('0x4b')]['sort']);_0x5f28c7['where']=qs[_0x8fda('0x55')](_[_0x8fda('0x56')](_0x458c1c['query'],_0x29e026[_0x8fda('0x55')]));_0x5f28c7['where'][_0x8fda('0x67')]=_0x4147a4['id'];if(_0x458c1c[_0x8fda('0x4b')]['filter']){_0x5f28c7[_0x8fda('0x54')]=_[_0x8fda('0x59')](_0x5f28c7[_0x8fda('0x54')],{'$or':_[_0x8fda('0x46')](_0x5f28c7[_0x8fda('0x4d')],function(_0x332460){var _0x54a785={};_0x54a785[_0x332460]={'$like':'%'+_0x458c1c[_0x8fda('0x4b')][_0x8fda('0x57')]+'%'};return _0x54a785;})});}_0x5f28c7=_['merge']({},_0x5f28c7,_0x458c1c[_0x8fda('0x5a')]);return db[_0x8fda('0x8b')][_0x8fda('0x5b')]({'where':_0x5f28c7[_0x8fda('0x54')]})[_0x8fda('0x26')](function(_0x1045cd){_0x395c58[_0x8fda('0x5b')]=_0x1045cd;if(_0x458c1c[_0x8fda('0x4b')][_0x8fda('0x5c')]){_0x5f28c7[_0x8fda('0x5d')]=[{'model':db[_0x8fda('0x8f')],'as':_0x8fda('0x90'),'required':![]},{'model':db[_0x8fda('0x91')],'as':_0x8fda('0x92'),'attributes':[_0x8fda('0x3f'),_0x8fda('0x93'),_0x8fda('0x94')],'required':![]},{'model':db[_0x8fda('0x95')],'as':_0x8fda('0x96'),'attributes':['id','name','color'],'where':_0x458c1c[_0x8fda('0x4b')][_0x8fda('0x97')]?{'id':_0x458c1c['query'][_0x8fda('0x97')]}:undefined,'required':_0x458c1c[_0x8fda('0x4b')][_0x8fda('0x97')]?!![]:![]}];}return db['MailInteraction']['findAll'](_0x5f28c7);})[_0x8fda('0x26')](function(_0x48186f){_0x395c58['rows']=_0x48186f;return _0x395c58;});}})[_0x8fda('0x26')](respondWithFilteredResult(_0xa176f3,_0x5f28c7))[_0x8fda('0x2f')](handleError(_0xa176f3,null));};exports[_0x8fda('0x98')]=function(_0x445a12,_0x1564c3,_0x46e075){return db[_0x8fda('0x47')][_0x8fda('0x85')]({'where':{'id':_0x445a12[_0x8fda('0x5f')]['id']}})['then'](handleEntityNotFound(_0x1564c3,null))[_0x8fda('0x26')](function(_0xf664d0){if(_0xf664d0){return db[_0x8fda('0x99')][_0x8fda('0x9a')](function(_0x14cf3e){return db[_0x8fda('0x9b')][_0x8fda('0x3a')]({'where':{'MailAccountId':_0x445a12[_0x8fda('0x5f')]['id']},'transaction':_0x14cf3e})['then'](function(_0x5a4353){var _0xbe97c2=_[_0x8fda('0x46')](_0x445a12[_0x8fda('0x64')],function(_0x4925fd){_0x4925fd[_0x8fda('0x67')]=_0x445a12[_0x8fda('0x5f')]['id'];return _0x4925fd;});return db['MailApplication'][_0x8fda('0x9c')](_0xbe97c2,{'transaction':_0x14cf3e});});})[_0x8fda('0x26')](function(){return db[_0x8fda('0x9b')][_0x8fda('0x9d')]({'where':{'MailAccountId':_0x445a12['params']['id']},'order':_0x8fda('0x9e')});});}})['then'](respondWithResult(_0x1564c3,null))['catch'](handleError(_0x1564c3,null));};exports[_0x8fda('0x9f')]=function(_0xba0fcf,_0x41b732,_0x21fe49){var _0x385ca6={};var _0x43b720={};var _0x1b5e7a;var _0x44bea8;return db[_0x8fda('0x47')][_0x8fda('0x85')]({'where':{'id':_0xba0fcf[_0x8fda('0x5f')]['id']}})[_0x8fda('0x26')](handleEntityNotFound(_0x41b732,null))['then'](function(_0x32e4f5){if(_0x32e4f5){_0x1b5e7a=_0x32e4f5;_0x43b720[_0x8fda('0x4a')]=_[_0x8fda('0x61')](db[_0x8fda('0x9b')][_0x8fda('0x62')]);_0x43b720['query']=_[_0x8fda('0x61')](_0xba0fcf[_0x8fda('0x4b')]);_0x43b720[_0x8fda('0x55')]=_[_0x8fda('0x4c')](_0x43b720[_0x8fda('0x4a')],_0x43b720[_0x8fda('0x4b')]);_0x385ca6['attributes']=_[_0x8fda('0x4c')](_0x43b720[_0x8fda('0x4a')],qs[_0x8fda('0x4e')](_0xba0fcf['query'][_0x8fda('0x4e')]));_0x385ca6[_0x8fda('0x4d')]=_0x385ca6['attributes'][_0x8fda('0x4f')]?_0x385ca6[_0x8fda('0x4d')]:_0x43b720[_0x8fda('0x4a')];_0x385ca6[_0x8fda('0x6b')]=qs[_0x8fda('0x53')](_0xba0fcf[_0x8fda('0x4b')][_0x8fda('0x53')]);_0x385ca6['where']=qs[_0x8fda('0x55')](_['pick'](_0xba0fcf[_0x8fda('0x4b')],_0x43b720['filters']));if(_0xba0fcf[_0x8fda('0x4b')]['filter']){_0x385ca6[_0x8fda('0x54')]=_[_0x8fda('0x59')](_0x385ca6[_0x8fda('0x54')],{'$or':_['map'](_0x385ca6[_0x8fda('0x4d')],function(_0x14a2c5){var _0x1af564={};_0x1af564[_0x14a2c5]={'$like':'%'+_0xba0fcf['query'][_0x8fda('0x57')]+'%'};return _0x1af564;})});}_0x385ca6=_[_0x8fda('0x59')]({},_0x385ca6,_0xba0fcf['options']);return _0x1b5e7a[_0x8fda('0x9f')](_0x385ca6);}})[_0x8fda('0x26')](function(_0x3d596a){if(_0x3d596a){_0x44bea8=_0x3d596a[_0x8fda('0x4f')];if(!_0xba0fcf['query'][_0x8fda('0x50')](_0x8fda('0x51'))){_0x385ca6[_0x8fda('0x52')]=qs['limit'](_0xba0fcf[_0x8fda('0x4b')][_0x8fda('0x52')]);_0x385ca6[_0x8fda('0x34')]=qs[_0x8fda('0x34')](_0xba0fcf[_0x8fda('0x4b')][_0x8fda('0x34')]);}return _0x1b5e7a[_0x8fda('0x9f')](_0x385ca6);}})['then'](function(_0x1e1be5){if(_0x1e1be5){return _0x1e1be5?{'count':_0x44bea8,'rows':_0x1e1be5}:null;}})['then'](respondWithResult(_0x41b732,null))[_0x8fda('0x2f')](handleError(_0x41b732,null));};exports[_0x8fda('0xa0')]=function(_0xeb360a,_0x5a86cb,_0x320dd9){var _0x5d2709={'raw':!![],'where':{}};var _0xeea0e1={};var _0x9ae604={'count':0x0,'rows':[]};return db[_0x8fda('0x47')]['findOne']({'where':{'id':_0xeb360a[_0x8fda('0x5f')]['id']}})[_0x8fda('0x26')](handleEntityNotFound(_0x5a86cb,null))[_0x8fda('0x26')](function(_0xf9a5d5){if(_0xf9a5d5){_0xeea0e1[_0x8fda('0x4a')]=_['keys'](db[_0x8fda('0xa1')][_0x8fda('0x62')]);_0xeea0e1[_0x8fda('0x4b')]=_['keys'](_0xeb360a[_0x8fda('0x4b')]);_0xeea0e1[_0x8fda('0x55')]=_[_0x8fda('0x4c')](_0xeea0e1[_0x8fda('0x4a')],_0xeea0e1[_0x8fda('0x4b')]);_0x5d2709[_0x8fda('0x4d')]=_[_0x8fda('0x4c')](_0xeea0e1[_0x8fda('0x4a')],qs['fields'](_0xeb360a['query'][_0x8fda('0x4e')]));_0x5d2709[_0x8fda('0x4d')]=_0x5d2709[_0x8fda('0x4d')][_0x8fda('0x4f')]?_0x5d2709[_0x8fda('0x4d')]:_0xeea0e1[_0x8fda('0x4a')];if(!_0xeb360a[_0x8fda('0x4b')][_0x8fda('0x50')]('nolimit')){_0x5d2709['limit']=qs['limit'](_0xeb360a[_0x8fda('0x4b')][_0x8fda('0x52')]);_0x5d2709['offset']=qs[_0x8fda('0x34')](_0xeb360a[_0x8fda('0x4b')][_0x8fda('0x34')]);}_0x5d2709['order']=qs[_0x8fda('0x53')](_0xeb360a[_0x8fda('0x4b')][_0x8fda('0x53')]);_0x5d2709['where']=qs[_0x8fda('0x55')](_['pick'](_0xeb360a[_0x8fda('0x4b')],_0xeea0e1[_0x8fda('0x55')]));_0x5d2709[_0x8fda('0x54')]['MailAccountId']=_0xf9a5d5['id'];if(_0xeb360a[_0x8fda('0x4b')][_0x8fda('0x57')]){_0x5d2709[_0x8fda('0x54')]=_[_0x8fda('0x59')](_0x5d2709['where'],{'$or':_[_0x8fda('0x46')](_0x5d2709[_0x8fda('0x4d')],function(_0x2b9667){var _0x556782={};_0x556782[_0x2b9667]={'$like':'%'+_0xeb360a['query'][_0x8fda('0x57')]+'%'};return _0x556782;})});}if(_0xeb360a[_0x8fda('0x4b')][_0x8fda('0xa2')]){var _0x504a79=_0xeb360a[_0x8fda('0x4b')]['$gte'][_0x8fda('0xa3')](',');var _0x27cd83={};_0x27cd83[_0x504a79[0x0]]={'$gte':moment(_0x504a79[0x1])[_0x8fda('0xa4')](_0x8fda('0xa5'))};_0x5d2709[_0x8fda('0x54')]=_['merge'](_0x5d2709[_0x8fda('0x54')],_0x27cd83);}_0x5d2709=_[_0x8fda('0x59')]({},_0x5d2709,_0xeb360a[_0x8fda('0x5a')]);return db[_0x8fda('0xa1')][_0x8fda('0x5b')]({'where':_0x5d2709[_0x8fda('0x54')]})[_0x8fda('0x26')](function(_0x172cf9){_0x9ae604[_0x8fda('0x5b')]=_0x172cf9;if(_0xeb360a[_0x8fda('0x4b')]['includeAll']){_0x5d2709[_0x8fda('0x5d')]=[{'all':!![]}];}return db[_0x8fda('0xa1')][_0x8fda('0x5e')](_0x5d2709);})[_0x8fda('0x26')](function(_0x251d6f){_0x9ae604[_0x8fda('0x6c')]=_0x251d6f;return _0x9ae604;});}})[_0x8fda('0x26')](respondWithFilteredResult(_0x5a86cb,_0x5d2709))['catch'](handleError(_0x5a86cb,null));};exports[_0x8fda('0x40')]=function(_0x213c22,_0x5e3e74,_0x427f7b){var _0x220980,_0x41b9d9={},_0x21b7b3;if(_0x213c22[_0x8fda('0x64')]['to']){_0x21b7b3=_0x213c22['body']['to']['split'](',')[0x0];}return db[_0x8fda('0x47')][_0x8fda('0x63')]({'where':{'id':_0x213c22[_0x8fda('0x5f')]['id']},'include':[{'model':db[_0x8fda('0xa6')],'as':_0x8fda('0xa7'),'include':[{'model':db[_0x8fda('0x8f')],'as':_0x8fda('0xa8'),'where':{'email':_0x21b7b3},'limit':0x1,'order':[[_0x8fda('0xa9'),_0x8fda('0xaa')]]}]},{'model':db['MailServerOut'],'as':_0x8fda('0x43'),'raw':!![]}]})[_0x8fda('0x26')](handleEntityNotFound(_0x5e3e74,null))[_0x8fda('0x26')](function(_0xad3b5b){if(_0xad3b5b){_0x220980=_0xad3b5b;if(_0xad3b5b[_0x8fda('0x43')]){if(_[_0x8fda('0x72')](_0x213c22['body']['from'])){_0x213c22[_0x8fda('0x64')][_0x8fda('0xab')]=util['format'](_0x8fda('0xac'),_0xad3b5b[_0x8fda('0x3f')],_0xad3b5b[_0x8fda('0xad')]||_0xad3b5b[_0x8fda('0x43')]['user']);}if(_0x213c22[_0x8fda('0x64')][_0x8fda('0xae')]&&_0x213c22[_0x8fda('0x64')][_0x8fda('0xae')]['length']){for(var _0x2be6cd=0x0;_0x2be6cd<_0x213c22[_0x8fda('0x64')][_0x8fda('0xae')][_0x8fda('0x4f')];_0x2be6cd+=0x1){_0x213c22[_0x8fda('0x64')][_0x8fda('0xae')][_0x2be6cd]={'filename':_0x213c22[_0x8fda('0x64')][_0x8fda('0xae')][_0x2be6cd][_0x8fda('0x3f')],'path':path['join'](config[_0x8fda('0xaf')],'server/files/attachments',_0x213c22[_0x8fda('0x64')]['attachments'][_0x2be6cd][_0x8fda('0xb0')])};}}var _0x46b290={'tls':{'rejectUnauthorized':![]}};if(_[_0x8fda('0x72')](_0xad3b5b[_0x8fda('0x43')][_0x8fda('0x7d')])){if(_0xad3b5b[_0x8fda('0x43')][_0x8fda('0x7a')]){_0x46b290[_0x8fda('0xb1')]={'user':_0xad3b5b[_0x8fda('0x43')]['user'],'pass':_0xad3b5b[_0x8fda('0x43')][_0x8fda('0x79')]};}_0x46b290[_0x8fda('0x7b')]=_0xad3b5b[_0x8fda('0x43')][_0x8fda('0x7b')];_0x46b290['port']=_0xad3b5b[_0x8fda('0x43')][_0x8fda('0x7c')];_0x46b290[_0x8fda('0xb2')]=_0xad3b5b[_0x8fda('0x43')][_0x8fda('0xb2')];}else{_0x46b290['service']=_0xad3b5b[_0x8fda('0x43')][_0x8fda('0x7d')];_0x46b290['auth']={'user':_0xad3b5b['Smtp'][_0x8fda('0x76')],'pass':_0xad3b5b['Smtp'][_0x8fda('0x79')]};}return respondWithRpcPromise(_0x8fda('0xb3'),_0x8fda('0xb4'),{'account':_0x46b290,'message':_0x213c22[_0x8fda('0x64')]});}else{throw new Error('List\x20not\x20found');}}})[_0x8fda('0x26')](function(_0xd6fd67){if(_0xd6fd67){_0x41b9d9=_0xd6fd67;if(_0x220980['List']){if(_0x220980[_0x8fda('0xa7')][_0x8fda('0xa8')][_0x8fda('0x4f')]){return _0x220980[_0x8fda('0xa7')][_0x8fda('0xa8')][0x0];}else{return db[_0x8fda('0x8f')][_0x8fda('0x69')](_[_0x8fda('0x19')](_0x213c22[_0x8fda('0x64')],{'firstName':_0x213c22[_0x8fda('0x64')]['to'],'email':_0x213c22['body']['to'],'phone':_0x213c22['body']['to'],'ListId':_0x220980[_0x8fda('0x71')]}));}}else{throw new Error('List\x20not\x20found');}}})[_0x8fda('0x26')](function(_0x1092d4){if(_0x1092d4){var _0x410088={'UserId':_0x213c22[_0x8fda('0x76')]['id'],'ContactId':_0x1092d4['id'],'MailAccountId':_0x220980['id'],'inReplyTo':_0x41b9d9[_0x8fda('0xb5')],'to':_0x213c22[_0x8fda('0x64')]['from'],'cc':_0x213c22[_0x8fda('0x64')]['cc'],'subject':_0x213c22[_0x8fda('0x64')]['subject'],'attach':_0x213c22[_0x8fda('0x64')][_0x8fda('0xb6')],'firstMsgDirection':_0x8fda('0xb7'),'lastMsgAt':moment()[_0x8fda('0xa4')](_0x8fda('0xa5')),'lastMsgDirection':_0x8fda('0xb7'),'lastMsgBody':_0x213c22['body'][_0x8fda('0x64')],'Messages':[_[_0x8fda('0x59')](_0x213c22[_0x8fda('0x64')],{'messageId':_0x41b9d9[_0x8fda('0xb5')],'sentAt':moment()[_0x8fda('0xa4')](_0x8fda('0xa5')),'read':!![],'MailAccountId':_0x220980['id'],'UserId':_0x213c22[_0x8fda('0x76')]['id'],'ContactId':_0x1092d4['id']})]};if(_0x213c22[_0x8fda('0x64')]['Interaction']){_0x410088=_['merge'](_0x410088,_0x213c22[_0x8fda('0x64')][_0x8fda('0xb8')]);}return db[_0x8fda('0x8b')]['create'](_0x410088,{'include':[{'model':db[_0x8fda('0xa1')],'as':_0x8fda('0xb9')}]});}})[_0x8fda('0x26')](respondWithResult(_0x5e3e74,null))[_0x8fda('0x2f')](handleError(_0x5e3e74,null));};exports[_0x8fda('0xba')]=function(_0x275fc3,_0x5d3eb3,_0xcca57c){return db[_0x8fda('0x47')][_0x8fda('0x63')]({'where':{'id':_0x275fc3[_0x8fda('0x5f')]['id']},'include':[{'model':db[_0x8fda('0x7f')],'as':'Smtp','raw':!![]}]})[_0x8fda('0x26')](handleEntityNotFound(_0x5d3eb3,null))[_0x8fda('0x26')](function(_0x5d6151){if(_0x5d6151&&_0x5d6151[_0x8fda('0x43')]){var _0x1b0a5e={'id':_0x5d6151['id'],'tls':{'rejectUnauthorized':![]}};if(_0x5d6151[_0x8fda('0x43')][_0x8fda('0x7d')]){_0x1b0a5e['service']=_0x5d6151['Smtp'][_0x8fda('0x7d')];}else{_0x1b0a5e[_0x8fda('0x7b')]=_0x5d6151[_0x8fda('0x43')][_0x8fda('0x7b')];_0x1b0a5e['port']=_0x5d6151[_0x8fda('0x43')]['port'];_0x1b0a5e[_0x8fda('0xb2')]=_0x5d6151[_0x8fda('0x43')][_0x8fda('0xb2')];}if(_0x5d6151[_0x8fda('0x43')]['authentication']){_0x1b0a5e['auth']={'user':_0x5d6151[_0x8fda('0x43')]['user'],'pass':_0x5d6151[_0x8fda('0x43')][_0x8fda('0x79')]};}return respondWithRpcPromise(_0x8fda('0xbb'),_0x8fda('0xba'),{'account':_0x1b0a5e});}})[_0x8fda('0x26')](respondWithResult(_0x5d3eb3,null))[_0x8fda('0x2f')](handleError(_0x5d3eb3,null));};exports[_0x8fda('0x3a')]=function(_0x56be50,_0x341376){return db['MailAccount'][_0x8fda('0x63')]({'where':{'id':_0x56be50[_0x8fda('0x5f')]['id']}})['then'](handleEntityNotFound(_0x341376,null))[_0x8fda('0x26')](function(_0x579c51){if(_0x579c51&&_0x579c51[_0x8fda('0x7d')]){throw new db[(_0x8fda('0x22'))][(_0x8fda('0x23'))](_0x8fda('0xbc'));}return _0x579c51;})['then'](removeEntity(_0x341376,null))[_0x8fda('0x2f')](handleError(_0x341376,null));};exports[_0x8fda('0xbd')]=function(_0x22fa68,_0x470e08,_0xeb4ea){return db['MailAccount'][_0x8fda('0x63')]({'where':{'id':_0x22fa68[_0x8fda('0x5f')]['id']}})['then'](handleEntityNotFound(_0x470e08,null))['then'](function(_0x3e1b4d){if(_0x3e1b4d){return _0x3e1b4d[_0x8fda('0xbd')](_0x22fa68[_0x8fda('0x64')][_0x8fda('0x6e')],_['omit'](_0x22fa68[_0x8fda('0x64')],[_0x8fda('0x6e'),'id'])||{})['spread'](function(_0x1ad40a){for(var _0x46c940=0x0;_0x46c940<_0x22fa68[_0x8fda('0x64')][_0x8fda('0x6e')][_0x8fda('0x4f')];_0x46c940+=0x1){socket['emit'](_0x8fda('0xbe'),{'UserId':_0x22fa68[_0x8fda('0x64')][_0x8fda('0x6e')][_0x46c940],'MailAccountId':_0x22fa68[_0x8fda('0x5f')]['id']});}return _0x1ad40a;});}})[_0x8fda('0x26')](respondWithResult(_0x470e08,null))['catch'](handleError(_0x470e08,null));};exports[_0x8fda('0xbf')]=function(_0x352680,_0x3a4081,_0x3dacdb){return db[_0x8fda('0x47')][_0x8fda('0x63')]({'where':{'id':_0x352680[_0x8fda('0x5f')]['id']}})['then'](handleEntityNotFound(_0x3a4081,null))['then'](function(_0x2fd9ad){if(_0x2fd9ad){return _0x2fd9ad[_0x8fda('0xbf')](_0x352680[_0x8fda('0x4b')][_0x8fda('0x6e')])[_0x8fda('0x26')](function(){if(_['isArray'](_0x352680[_0x8fda('0x4b')][_0x8fda('0x6e')])){for(var _0xee32c1=0x0;_0xee32c1<_0x352680[_0x8fda('0x4b')][_0x8fda('0x6e')][_0x8fda('0x4f')];_0xee32c1+=0x1){socket[_0x8fda('0xc0')](_0x8fda('0xc1'),{'UserId':Number(_0x352680['query']['ids'][_0xee32c1]),'MailAccountId':Number(_0x352680[_0x8fda('0x5f')]['id'])});}}else{socket[_0x8fda('0xc0')](_0x8fda('0xc1'),{'UserId':Number(_0x352680[_0x8fda('0x4b')][_0x8fda('0x6e')]),'MailAccountId':Number(_0x352680[_0x8fda('0x5f')]['id'])});}});}})[_0x8fda('0x26')](respondWithStatusCode(_0x3a4081,null))[_0x8fda('0x2f')](handleError(_0x3a4081,null));};exports[_0x8fda('0xc2')]=function(_0x206035,_0x2ece9d,_0x528ac2){var _0x19cdca={};var _0x12acd7={};var _0x287527;var _0xa54c9e;return db[_0x8fda('0x47')][_0x8fda('0x85')]({'where':{'id':_0x206035[_0x8fda('0x5f')]['id']}})['then'](handleEntityNotFound(_0x2ece9d,null))[_0x8fda('0x26')](function(_0xbe85f6){if(_0xbe85f6){_0x287527=_0xbe85f6;_0x12acd7[_0x8fda('0x4a')]=_[_0x8fda('0x61')](db[_0x8fda('0x91')][_0x8fda('0x62')]);_0x12acd7[_0x8fda('0x4b')]=_[_0x8fda('0x61')](_0x206035['query']);_0x12acd7[_0x8fda('0x55')]=_['intersection'](_0x12acd7[_0x8fda('0x4a')],_0x12acd7['query']);_0x19cdca[_0x8fda('0x4d')]=_[_0x8fda('0x4c')](_0x12acd7[_0x8fda('0x4a')],qs[_0x8fda('0x4e')](_0x206035[_0x8fda('0x4b')][_0x8fda('0x4e')]));_0x19cdca[_0x8fda('0x4d')]=_0x19cdca[_0x8fda('0x4d')][_0x8fda('0x4f')]?_0x19cdca[_0x8fda('0x4d')]:_0x12acd7[_0x8fda('0x4a')];_0x19cdca[_0x8fda('0x6b')]=qs['sort'](_0x206035['query'][_0x8fda('0x53')]);_0x19cdca[_0x8fda('0x54')]=qs[_0x8fda('0x55')](_[_0x8fda('0x56')](_0x206035['query'],_0x12acd7[_0x8fda('0x55')]));if(_0x206035[_0x8fda('0x4b')]['filter']){_0x19cdca[_0x8fda('0x54')]=_[_0x8fda('0x59')](_0x19cdca[_0x8fda('0x54')],{'$or':_[_0x8fda('0x46')](_0x19cdca['attributes'],function(_0x394eff){var _0x5e508a={};_0x5e508a[_0x394eff]={'$like':'%'+_0x206035['query'][_0x8fda('0x57')]+'%'};return _0x5e508a;})});}_0x19cdca=_[_0x8fda('0x59')]({},_0x19cdca,_0x206035[_0x8fda('0x5a')]);return _0x287527[_0x8fda('0xc2')](_0x19cdca);}})[_0x8fda('0x26')](function(_0x5d1235){if(_0x5d1235){_0xa54c9e=_0x5d1235[_0x8fda('0x4f')];if(!_0x206035[_0x8fda('0x4b')][_0x8fda('0x50')](_0x8fda('0x51'))){_0x19cdca[_0x8fda('0x52')]=qs['limit'](_0x206035[_0x8fda('0x4b')][_0x8fda('0x52')]);_0x19cdca[_0x8fda('0x34')]=qs[_0x8fda('0x34')](_0x206035['query']['offset']);}return _0x287527['getAgents'](_0x19cdca);}})[_0x8fda('0x26')](function(_0x1620a8){if(_0x1620a8){return _0x1620a8?{'count':_0xa54c9e,'rows':_0x1620a8}:null;}})[_0x8fda('0x26')](respondWithResult(_0x2ece9d,null))[_0x8fda('0x2f')](handleError(_0x2ece9d,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 3beab63..d7e3180 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 _0x9c59=['../../mysqldb','MailAccount','save','update','remove','emit','hasOwnProperty','exports','events'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x9c59,0x155));var _0x99c5=function(_0x33425d,_0x4204aa){_0x33425d=_0x33425d-0x0;var _0x2d926b=_0x9c59[_0x33425d];return _0x2d926b;};'use strict';var EventEmitter=require(_0x99c5('0x0'));var MailAccount=require(_0x99c5('0x1'))['db'][_0x99c5('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x99c5('0x3'),'afterUpdate':_0x99c5('0x4'),'afterDestroy':_0x99c5('0x5')};function emitEvent(_0x1494f5){return function(_0x16e287,_0x3b2106,_0x12ad22){MailAccountEvents[_0x99c5('0x6')](_0x1494f5+':'+_0x16e287['id'],_0x16e287);MailAccountEvents['emit'](_0x1494f5,_0x16e287);_0x12ad22(null);};}for(var e in events){if(events[_0x99c5('0x7')](e)){var event=events[e];MailAccount['hook'](e,emitEvent(event));}}module[_0x99c5('0x8')]=MailAccountEvents; \ No newline at end of file +var _0x61d7=['setMaxListeners','save','remove','emit','hasOwnProperty','hook','events','../../mysqldb','MailAccount'];(function(_0x57b3bf,_0x13ad53){var _0xaa9348=function(_0x417451){while(--_0x417451){_0x57b3bf['push'](_0x57b3bf['shift']());}};_0xaa9348(++_0x13ad53);}(_0x61d7,0x69));var _0x761d=function(_0x3f9a41,_0x44d54f){_0x3f9a41=_0x3f9a41-0x0;var _0x105d74=_0x61d7[_0x3f9a41];return _0x105d74;};'use strict';var EventEmitter=require(_0x761d('0x0'));var MailAccount=require(_0x761d('0x1'))['db'][_0x761d('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x761d('0x3')](0x0);var events={'afterCreate':_0x761d('0x4'),'afterUpdate':'update','afterDestroy':_0x761d('0x5')};function emitEvent(_0x5337a4){return function(_0x22ffd1,_0x554d3e,_0x4e5a82){MailAccountEvents[_0x761d('0x6')](_0x5337a4+':'+_0x22ffd1['id'],_0x22ffd1);MailAccountEvents[_0x761d('0x6')](_0x5337a4,_0x22ffd1);_0x4e5a82(null);};}for(var e in events){if(events[_0x761d('0x7')](e)){var event=events[e];MailAccount[_0x761d('0x8')](e,emitEvent(event));}}module['exports']=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 2ff638c..961dc5d 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 _0x6b0c=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailAccount.attributes','exports','define','MailAccount','mail_accounts','lodash','util','../../config/logger'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x6b0c,0x1af));var _0xc6b0=function(_0x2eca15,_0x33be5d){_0x2eca15=_0x2eca15-0x0;var _0x5a2ed6=_0x6b0c[_0x2eca15];return _0x5a2ed6;};'use strict';var _=require(_0xc6b0('0x0'));var util=require(_0xc6b0('0x1'));var logger=require(_0xc6b0('0x2'))('api');var moment=require(_0xc6b0('0x3'));var BPromise=require(_0xc6b0('0x4'));var rp=require(_0xc6b0('0x5'));var fs=require('fs');var path=require(_0xc6b0('0x6'));var rimraf=require(_0xc6b0('0x7'));var config=require(_0xc6b0('0x8'));var attributes=require(_0xc6b0('0x9'));module[_0xc6b0('0xa')]=function(_0x1cb31b,_0xb9035c){return _0x1cb31b[_0xc6b0('0xb')](_0xc6b0('0xc'),attributes,{'tableName':_0xc6b0('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf505=['api','moment','bluebird','request-promise','path','rimraf','exports','define','MailAccount','mail_accounts','lodash','../../config/logger'];(function(_0x28edaf,_0x33e817){var _0x32a5e6=function(_0x3256c4){while(--_0x3256c4){_0x28edaf['push'](_0x28edaf['shift']());}};_0x32a5e6(++_0x33e817);}(_0xf505,0x172));var _0x5f50=function(_0x3a19d4,_0x3f19a4){_0x3a19d4=_0x3a19d4-0x0;var _0x5b858b=_0xf505[_0x3a19d4];return _0x5b858b;};'use strict';var _=require(_0x5f50('0x0'));var util=require('util');var logger=require(_0x5f50('0x1'))(_0x5f50('0x2'));var moment=require(_0x5f50('0x3'));var BPromise=require(_0x5f50('0x4'));var rp=require(_0x5f50('0x5'));var fs=require('fs');var path=require(_0x5f50('0x6'));var rimraf=require(_0x5f50('0x7'));var config=require('../../config/environment');var attributes=require('./mailAccount.attributes');module[_0x5f50('0x8')]=function(_0x34ceb0,_0x30891b){return _0x34ceb0[_0x5f50('0x9')](_0x5f50('0xa'),attributes,{'tableName':_0x5f50('0xb'),'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 584647e..87a1f2e 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 _0x1ddc=['spread','update','originTo','Attachment','Attachments','UserId','User','interaction','agent','name','waitForTheAssignedAgent','Start','startRouting','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','redis','defaults','socket.io-emitter','./mailAccount.socket','register','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetMailAccount','MailAccount','findAll','options','raw','where','attributes','include','map','model','ShowMailAccount','find','NotifyMailAccount','body','mail','difference','keys','CmContact','rawAttributes','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','List','DESC','MailApplication','MailServerOut','Smtp','get','Applications','list','applications','priority','asc','autoclose','push','length','close','*,*,*,*','Contacts','create','List\x20not\x20found','contact','messageId','generate','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','inReplyTo','Contact\x20not\x20found'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x1ddc,0x6e));var _0xc1dd=function(_0x213a03,_0x327412){_0x213a03=_0x213a03-0x0;var _0x2c7ff2=_0x1ddc[_0x213a03];return _0x2c7ff2;};'use strict';var _=require('lodash');var util=require(_0xc1dd('0x0'));var moment=require(_0xc1dd('0x1'));var BPromise=require(_0xc1dd('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc1dd('0x3'));var db=require(_0xc1dd('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xc1dd('0x5'))(_0xc1dd('0x6'));var config=require('../../config/environment');var jayson=require(_0xc1dd('0x7'));var client=jayson[_0xc1dd('0x8')]['http']({'port':0x232c});config[_0xc1dd('0x9')]=_[_0xc1dd('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xc1dd('0xb'))(new Redis(config[_0xc1dd('0x9')]));require(_0xc1dd('0xc'))[_0xc1dd('0xd')](socket);function respondWithRpcPromise(_0x495e17,_0x38b62e,_0x1b4b3f){return new BPromise(function(_0xa720ed,_0xccdb4e){return client['request'](_0x495e17,_0x1b4b3f)[_0xc1dd('0xe')](function(_0x1d28a7){logger[_0xc1dd('0xf')](_0xc1dd('0x10'),_0x38b62e,_0xc1dd('0x11'));logger[_0xc1dd('0x12')](_0xc1dd('0x13'),_0x38b62e,_0xc1dd('0x11'),JSON[_0xc1dd('0x14')](_0x1d28a7));if(_0x1d28a7[_0xc1dd('0x15')]){if(_0x1d28a7[_0xc1dd('0x15')]['code']===0x1f4){logger[_0xc1dd('0x15')](_0xc1dd('0x10'),_0x38b62e,_0x1d28a7[_0xc1dd('0x15')][_0xc1dd('0x16')]);return _0xccdb4e(_0x1d28a7[_0xc1dd('0x15')]['message']);}logger[_0xc1dd('0x15')](_0xc1dd('0x10'),_0x38b62e,_0x1d28a7[_0xc1dd('0x15')][_0xc1dd('0x16')]);return _0xa720ed(_0x1d28a7['error']['message']);}else{logger[_0xc1dd('0xf')]('MailAccount,\x20%s,\x20%s',_0x38b62e,_0xc1dd('0x11'));_0xa720ed(_0x1d28a7['result'][_0xc1dd('0x16')]);}})[_0xc1dd('0x17')](function(_0x288abd){logger[_0xc1dd('0x15')](_0xc1dd('0x10'),_0x38b62e,_0x288abd);_0xccdb4e(_0x288abd);});});}exports[_0xc1dd('0x18')]=function(_0x568a6b){var _0x459da6=this;return new Promise(function(_0x1ab21b,_0x5e99a6){return db[_0xc1dd('0x19')][_0xc1dd('0x1a')]({'raw':_0x568a6b[_0xc1dd('0x1b')]?_0x568a6b[_0xc1dd('0x1b')][_0xc1dd('0x1c')]===undefined?!![]:![]:!![],'where':_0x568a6b[_0xc1dd('0x1b')]?_0x568a6b[_0xc1dd('0x1b')][_0xc1dd('0x1d')]||null:null,'attributes':_0x568a6b['options']?_0x568a6b[_0xc1dd('0x1b')][_0xc1dd('0x1e')]||null:null,'limit':_0x568a6b[_0xc1dd('0x1b')]?_0x568a6b[_0xc1dd('0x1b')]['limit']||null:null,'include':_0x568a6b[_0xc1dd('0x1b')]?_0x568a6b[_0xc1dd('0x1b')][_0xc1dd('0x1f')]?_[_0xc1dd('0x20')](_0x568a6b[_0xc1dd('0x1b')][_0xc1dd('0x1f')],function(_0x3c3a32){return{'model':db[_0x3c3a32[_0xc1dd('0x21')]],'as':_0x3c3a32['as'],'attributes':_0x3c3a32[_0xc1dd('0x1e')],'include':_0x3c3a32[_0xc1dd('0x1f')]?_[_0xc1dd('0x20')](_0x3c3a32[_0xc1dd('0x1f')],function(_0x1d3b04){return{'model':db[_0x1d3b04[_0xc1dd('0x21')]],'as':_0x1d3b04['as'],'attributes':_0x1d3b04['attributes'],'include':_0x1d3b04['include']?_[_0xc1dd('0x20')](_0x1d3b04[_0xc1dd('0x1f')],function(_0x25a651){return{'model':db[_0x25a651[_0xc1dd('0x21')]],'as':_0x25a651['as'],'attributes':_0x25a651[_0xc1dd('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xc1dd('0xe')](function(_0x16ee31){logger['info'](_0xc1dd('0x18'),_0x568a6b);logger[_0xc1dd('0x12')](_0xc1dd('0x18'),_0x568a6b,JSON[_0xc1dd('0x14')](_0x16ee31));_0x1ab21b(_0x16ee31);})['catch'](function(_0x14b1d4){logger[_0xc1dd('0x15')](_0xc1dd('0x18'),_0x14b1d4['message'],_0x568a6b);_0x5e99a6(_0x459da6[_0xc1dd('0x15')](0x1f4,_0x14b1d4['message']));});});};exports[_0xc1dd('0x22')]=function(_0x2b7eb0){var _0x3fe749=this;return new Promise(function(_0x5a60dd,_0x7541a2){return db[_0xc1dd('0x19')][_0xc1dd('0x23')]({'raw':_0x2b7eb0[_0xc1dd('0x1b')]?_0x2b7eb0['options'][_0xc1dd('0x1c')]===undefined?!![]:![]:!![],'where':_0x2b7eb0[_0xc1dd('0x1b')]?_0x2b7eb0[_0xc1dd('0x1b')]['where']||null:null,'attributes':_0x2b7eb0['options']?_0x2b7eb0[_0xc1dd('0x1b')][_0xc1dd('0x1e')]||null:null,'include':_0x2b7eb0[_0xc1dd('0x1b')]?_0x2b7eb0[_0xc1dd('0x1b')][_0xc1dd('0x1f')]?_['map'](_0x2b7eb0[_0xc1dd('0x1b')][_0xc1dd('0x1f')],function(_0x544b71){return{'model':db[_0x544b71[_0xc1dd('0x21')]],'as':_0x544b71['as'],'attributes':_0x544b71[_0xc1dd('0x1e')],'include':_0x544b71[_0xc1dd('0x1f')]?_['map'](_0x544b71[_0xc1dd('0x1f')],function(_0x537f1b){return{'model':db[_0x537f1b[_0xc1dd('0x21')]],'as':_0x537f1b['as'],'attributes':_0x537f1b[_0xc1dd('0x1e')],'include':_0x537f1b['include']?_[_0xc1dd('0x20')](_0x537f1b[_0xc1dd('0x1f')],function(_0x28723c){return{'model':db[_0x28723c[_0xc1dd('0x21')]],'as':_0x28723c['as'],'attributes':_0x28723c[_0xc1dd('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xc1dd('0xe')](function(_0x257b69){logger[_0xc1dd('0xf')](_0xc1dd('0x22'),_0x2b7eb0);logger[_0xc1dd('0x12')](_0xc1dd('0x22'),_0x2b7eb0,JSON[_0xc1dd('0x14')](_0x257b69));_0x5a60dd(_0x257b69);})['catch'](function(_0x3f7a0f){logger['error'](_0xc1dd('0x22'),_0x3f7a0f[_0xc1dd('0x16')],_0x2b7eb0);_0x7541a2(_0x3fe749[_0xc1dd('0x15')](0x1f4,_0x3f7a0f[_0xc1dd('0x16')]));});});};exports[_0xc1dd('0x24')]=function(_0x45919b){var _0x17743b=this;return new Promise(function(_0x583688,_0x12c56d){var _0x5b5d76={'body':_0x45919b[_0xc1dd('0x25')],'channel':_0xc1dd('0x26')};var _0x6b416d=_[_0xc1dd('0x27')](_[_0xc1dd('0x28')](db[_0xc1dd('0x29')][_0xc1dd('0x2a')]),['createdAt',_0xc1dd('0x2b'),_0xc1dd('0x2c'),_0xc1dd('0x2d')]);var _0x5207f2=![];if(_0x45919b[_0xc1dd('0x25')]['id']){delete _0x45919b[_0xc1dd('0x25')]['id'];}if(_[_0xc1dd('0x2e')](_0x45919b[_0xc1dd('0x25')][_0xc1dd('0x2f')])){return _0x12c56d(_0x17743b[_0xc1dd('0x15')](0x1f4,_0xc1dd('0x30')));}if(_[_0xc1dd('0x2e')](_0x45919b[_0xc1dd('0x25')]['body'])||_0x45919b[_0xc1dd('0x25')][_0xc1dd('0x25')]===''){return _0x12c56d(_0x17743b[_0xc1dd('0x15')](0x1f4,_0xc1dd('0x31')));}if(_[_0xc1dd('0x2e')](_0x45919b[_0xc1dd('0x25')][_0xc1dd('0x32')])){return _0x12c56d(_0x17743b[_0xc1dd('0x15')](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x6b416d));}if(!_['includes'](_0x6b416d,_0x45919b[_0xc1dd('0x25')][_0xc1dd('0x32')])){return _0x12c56d(_0x17743b[_0xc1dd('0x15')](0x1f4,_0xc1dd('0x33')+_0x6b416d));}var _0x1c95f3={};_0x1c95f3[_0x45919b[_0xc1dd('0x25')]['mapKey']]=_0x45919b[_0xc1dd('0x25')][_0xc1dd('0x2f')];return db[_0xc1dd('0x19')][_0xc1dd('0x23')]({'where':{'id':_0x45919b[_0xc1dd('0x34')]['id']},'include':[{'model':db['CmList'],'as':_0xc1dd('0x35'),'include':[{'model':db[_0xc1dd('0x29')],'as':'Contacts','where':_0x1c95f3,'limit':0x1,'order':[[_0xc1dd('0x2b'),_0xc1dd('0x36')]]}]},{'model':db[_0xc1dd('0x37')],'as':'Applications'},{'model':db[_0xc1dd('0x38')],'as':_0xc1dd('0x39')}]})['then'](function(_0x32c086){if(_0x32c086&&_0x32c086[_0xc1dd('0x35')]){var _0x4188ae=_0x32c086[_0xc1dd('0x3a')]({'plain':!![]});_0x5b5d76['account']=_['omit'](_0x4188ae,[_0xc1dd('0x3b'),'List']);_0x5b5d76['applications']=_0x4188ae['Applications'];_0x5b5d76[_0xc1dd('0x3c')]=_0x4188ae[_0xc1dd('0x35')];_0x5b5d76[_0xc1dd('0x3d')]=_['orderBy'](_0x5b5d76[_0xc1dd('0x3d')],[_0xc1dd('0x3e')],[_0xc1dd('0x3f')]);if(_0x5b5d76[_0xc1dd('0x34')]&&_0x5b5d76[_0xc1dd('0x34')][_0xc1dd('0x40')]){_0x5b5d76[_0xc1dd('0x3d')][_0xc1dd('0x41')]({'id':0x0,'priority':_0x5b5d76[_0xc1dd('0x3d')][_0xc1dd('0x42')]+0x1,'app':_0xc1dd('0x43'),'appdata':'autoclose','interval':_0xc1dd('0x44')});}if(_0x5b5d76[_0xc1dd('0x34')]['Applications']){delete _0x5b5d76[_0xc1dd('0x34')][_0xc1dd('0x3b')];}if(_0x5b5d76[_0xc1dd('0x34')]['List']){delete _0x5b5d76[_0xc1dd('0x34')]['List'];}if(_0x4188ae[_0xc1dd('0x35')][_0xc1dd('0x45')][_0xc1dd('0x42')]){return _0x4188ae[_0xc1dd('0x35')][_0xc1dd('0x45')][0x0];}var _0x5980c8=_['defaults'](_0x45919b[_0xc1dd('0x25')],{'firstName':_0x45919b[_0xc1dd('0x25')][_0xc1dd('0x2f')],'ListId':_0x4188ae[_0xc1dd('0x2d')]});_0x5980c8[_0x45919b[_0xc1dd('0x25')][_0xc1dd('0x32')]]=_0x45919b[_0xc1dd('0x25')][_0xc1dd('0x2f')];return db[_0xc1dd('0x29')][_0xc1dd('0x46')](_0x5980c8);}else{throw new Error(_0xc1dd('0x47'));}})[_0xc1dd('0xe')](function(_0x1618c9){_0x5b5d76[_0xc1dd('0x48')]=_0x1618c9;if(_0x1618c9){if(!_0x45919b[_0xc1dd('0x25')][_0xc1dd('0x16')][_0xc1dd('0x49')]){_0x45919b[_0xc1dd('0x25')][_0xc1dd('0x16')][_0xc1dd('0x49')]=rs[_0xc1dd('0x4a')]()+'\x20'+_0x45919b[_0xc1dd('0x25')][_0xc1dd('0x16')][_0xc1dd('0x2f')];}var _0x523e99={'ContactId':_0x1618c9['id'],'MailAccountId':_0x45919b[_0xc1dd('0x34')]['id'],'inReplyTo':_0x45919b[_0xc1dd('0x25')][_0xc1dd('0x16')][_0xc1dd('0x49')],'to':_0x45919b[_0xc1dd('0x25')][_0xc1dd('0x16')][_0xc1dd('0x2f')],'cc':_0x45919b[_0xc1dd('0x25')][_0xc1dd('0x16')]['cc'],'subject':_0x45919b[_0xc1dd('0x25')][_0xc1dd('0x16')][_0xc1dd('0x4b')],'attach':_0x45919b[_0xc1dd('0x25')][_0xc1dd('0x16')][_0xc1dd('0x4c')],'lastMsgAt':moment()[_0xc1dd('0x4d')](_0xc1dd('0x4e')),'lastMsgDirection':'in','lastMsgBody':_0x45919b[_0xc1dd('0x25')][_0xc1dd('0x25')]};return db[_0xc1dd('0x4f')][_0xc1dd('0x23')]({'where':{'closed':![],'MailAccountId':_0x45919b[_0xc1dd('0x34')]['id']},'include':[{'model':db[_0xc1dd('0x50')],'as':_0xc1dd('0x51'),'attributes':[_0xc1dd('0x49')],'where':{'messageId':_0x45919b['body'][_0xc1dd('0x16')][_0xc1dd('0x52')]}}]})[_0xc1dd('0xe')](function(_0x57891e){if(_0x57891e){return[_0x57891e,![]];}return db[_0xc1dd('0x4f')][_0xc1dd('0x46')](_0x523e99)[_0xc1dd('0xe')](function(_0x51ef0b){return[_0x51ef0b,!![]];});});}else{throw new Error(_0xc1dd('0x53'));}})[_0xc1dd('0x54')](function(_0x71e293,_0x2f306d){if(_0x71e293){_0x5207f2=_0x2f306d;if(!_0x2f306d){return _0x71e293[_0xc1dd('0x55')]({'inReplyTo':_0x45919b[_0xc1dd('0x25')][_0xc1dd('0x16')][_0xc1dd('0x49')],'to':_0x45919b[_0xc1dd('0x25')][_0xc1dd('0x16')]['from'],'cc':_0x45919b[_0xc1dd('0x25')][_0xc1dd('0x16')]['cc'],'subject':_0x45919b[_0xc1dd('0x25')][_0xc1dd('0x16')][_0xc1dd('0x4b')],'attach':_0x71e293[_0xc1dd('0x4c')]?_0x71e293[_0xc1dd('0x4c')]:_0x45919b['body'][_0xc1dd('0x16')][_0xc1dd('0x4c')],'substatus':null,'substatusAt':moment()[_0xc1dd('0x4d')](_0xc1dd('0x4e')),'lastMsgAt':moment()[_0xc1dd('0x4d')](_0xc1dd('0x4e')),'lastMsgDirection':'in','lastMsgBody':_0x45919b['body'][_0xc1dd('0x25')]});}else{return _0x71e293;}}})[_0xc1dd('0xe')](function(_0x36f969){_0x5b5d76['interaction']=_0x36f969[_0xc1dd('0x3a')]({'plain':!![]});_0x5b5d76['interaction']['created']=_0x5207f2;return db['MailMessage'][_0xc1dd('0x46')]({'body':_0x45919b['body'][_0xc1dd('0x25')],'MailAccountId':_0x45919b[_0xc1dd('0x34')]['id'],'MailInteractionId':_0x36f969['id'],'direction':'in','ContactId':_0x5b5d76[_0xc1dd('0x48')]['id'],'messageId':_0x45919b[_0xc1dd('0x25')][_0xc1dd('0x16')][_0xc1dd('0x49')],'from':_0x45919b[_0xc1dd('0x25')]['message'][_0xc1dd('0x2f')],'to':_0x45919b[_0xc1dd('0x25')]['message']['to'],'cc':_0x45919b[_0xc1dd('0x25')][_0xc1dd('0x16')]['cc'],'subject':_0x45919b[_0xc1dd('0x25')]['message']['subject'],'attach':_0x45919b[_0xc1dd('0x25')]['message'][_0xc1dd('0x4c')],'Attachments':_0x45919b[_0xc1dd('0x25')][_0xc1dd('0x16')]['attachments'],'originTo':_0x45919b[_0xc1dd('0x25')][_0xc1dd('0x16')][_0xc1dd('0x56')],'originCc':_0x45919b[_0xc1dd('0x25')]['message']['originCc'],'bcc':_0x45919b[_0xc1dd('0x25')][_0xc1dd('0x16')]['bcc']},{'include':[{'model':db[_0xc1dd('0x57')],'as':_0xc1dd('0x58')}]});})[_0xc1dd('0xe')](function(_0x181311){_0x5b5d76['message']=_0x181311;if(_0x5b5d76['interaction'][_0xc1dd('0x59')]){return db[_0xc1dd('0x5a')][_0xc1dd('0x23')]({'attributes':['id','name'],'where':{'id':_0x5b5d76[_0xc1dd('0x5b')]['UserId']}})[_0xc1dd('0xe')](function(_0x3cea20){if(_0x3cea20){_0x5b5d76['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0xc1dd('0x5c'),'appdata':_0x3cea20[_0xc1dd('0x5d')]+','+(_0x5b5d76[_0xc1dd('0x34')][_0xc1dd('0x5e')]||0xa),'interval':_0xc1dd('0x44')});}return respondWithRpcPromise(_0xc1dd('0x5f'),_0xc1dd('0x60'),_0x5b5d76);});}return respondWithRpcPromise('Start',_0xc1dd('0x60'),_0x5b5d76);})[_0xc1dd('0xe')](function(_0x4ffb8c){_0x583688(_0x4ffb8c);})[_0xc1dd('0x17')](function(_0x558bd9){_0x12c56d(_0x17743b[_0xc1dd('0x15')](0x1f4,_0x558bd9[_0xc1dd('0x16')]));});});}; \ No newline at end of file +var _0x8d53=['isNil','from','from\x20is\x20mandatory','mapKey','find','account','CmList','List','Contacts','DESC','MailApplication','Applications','MailServerOut','Smtp','omit','applications','list','orderBy','priority','asc','push','length','autoclose','defaults','create','contact','messageId','generate','subject','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','Messages','inReplyTo','spread','attach','get','attachments','originTo','originCc','Attachment','Attachments','interaction','User','name','UserId','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','./mailAccount.socket','request','then','MailAccount,\x20%s,\x20%s','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','findAll','options','where','limit','include','map','attributes','model','GetMailAccount','debug','catch','ShowMailAccount','MailAccount','NotifyMailAccount','body','mail','difference','keys','CmContact','createdAt','updatedAt','CompanyId','ListId'];(function(_0x1341a8,_0x31b787){var _0x551b2d=function(_0x537f98){while(--_0x537f98){_0x1341a8['push'](_0x1341a8['shift']());}};_0x551b2d(++_0x31b787);}(_0x8d53,0x1c2));var _0x38d5=function(_0x6bb4fa,_0x4603e3){_0x6bb4fa=_0x6bb4fa-0x0;var _0x4cd4d0=_0x8d53[_0x6bb4fa];return _0x4cd4d0;};'use strict';var _=require(_0x38d5('0x0'));var util=require(_0x38d5('0x1'));var moment=require('moment');var BPromise=require(_0x38d5('0x2'));var rs=require(_0x38d5('0x3'));var fs=require('fs');var Redis=require(_0x38d5('0x4'));var db=require(_0x38d5('0x5'))['db'];var utils=require(_0x38d5('0x6'));var logger=require(_0x38d5('0x7'))(_0x38d5('0x8'));var config=require(_0x38d5('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x38d5('0xa')][_0x38d5('0xb')]({'port':0x232c});config[_0x38d5('0xc')]=_['defaults'](config[_0x38d5('0xc')],{'host':_0x38d5('0xd'),'port':0x18eb});var socket=require(_0x38d5('0xe'))(new Redis(config[_0x38d5('0xc')]));require(_0x38d5('0xf'))['register'](socket);function respondWithRpcPromise(_0x2c874b,_0x347b2f,_0x49fa2b){return new BPromise(function(_0x22a846,_0x549db){return client[_0x38d5('0x10')](_0x2c874b,_0x49fa2b)[_0x38d5('0x11')](function(_0x505f9c){logger['info'](_0x38d5('0x12'),_0x347b2f,_0x38d5('0x13'));logger['debug'](_0x38d5('0x14'),_0x347b2f,'request\x20sent',JSON[_0x38d5('0x15')](_0x505f9c));if(_0x505f9c[_0x38d5('0x16')]){if(_0x505f9c[_0x38d5('0x16')][_0x38d5('0x17')]===0x1f4){logger[_0x38d5('0x16')](_0x38d5('0x12'),_0x347b2f,_0x505f9c['error'][_0x38d5('0x18')]);return _0x549db(_0x505f9c['error'][_0x38d5('0x18')]);}logger['error'](_0x38d5('0x12'),_0x347b2f,_0x505f9c[_0x38d5('0x16')][_0x38d5('0x18')]);return _0x22a846(_0x505f9c['error'][_0x38d5('0x18')]);}else{logger[_0x38d5('0x19')](_0x38d5('0x12'),_0x347b2f,_0x38d5('0x13'));_0x22a846(_0x505f9c[_0x38d5('0x1a')][_0x38d5('0x18')]);}})['catch'](function(_0x566828){logger['error']('MailAccount,\x20%s,\x20%s',_0x347b2f,_0x566828);_0x549db(_0x566828);});});}exports['GetMailAccount']=function(_0x1fd88f){var _0x1c91a7=this;return new Promise(function(_0x1feb40,_0x4c7ce3){return db['MailAccount'][_0x38d5('0x1b')]({'raw':_0x1fd88f[_0x38d5('0x1c')]?_0x1fd88f[_0x38d5('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x1fd88f[_0x38d5('0x1c')]?_0x1fd88f['options'][_0x38d5('0x1d')]||null:null,'attributes':_0x1fd88f[_0x38d5('0x1c')]?_0x1fd88f['options']['attributes']||null:null,'limit':_0x1fd88f[_0x38d5('0x1c')]?_0x1fd88f['options'][_0x38d5('0x1e')]||null:null,'include':_0x1fd88f['options']?_0x1fd88f[_0x38d5('0x1c')][_0x38d5('0x1f')]?_[_0x38d5('0x20')](_0x1fd88f['options'][_0x38d5('0x1f')],function(_0x44b0d5){return{'model':db[_0x44b0d5['model']],'as':_0x44b0d5['as'],'attributes':_0x44b0d5[_0x38d5('0x21')],'include':_0x44b0d5[_0x38d5('0x1f')]?_[_0x38d5('0x20')](_0x44b0d5[_0x38d5('0x1f')],function(_0x3d8d86){return{'model':db[_0x3d8d86[_0x38d5('0x22')]],'as':_0x3d8d86['as'],'attributes':_0x3d8d86[_0x38d5('0x21')],'include':_0x3d8d86[_0x38d5('0x1f')]?_[_0x38d5('0x20')](_0x3d8d86[_0x38d5('0x1f')],function(_0x33d883){return{'model':db[_0x33d883[_0x38d5('0x22')]],'as':_0x33d883['as'],'attributes':_0x33d883[_0x38d5('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x514d2f){logger['info'](_0x38d5('0x23'),_0x1fd88f);logger[_0x38d5('0x24')]('GetMailAccount',_0x1fd88f,JSON[_0x38d5('0x15')](_0x514d2f));_0x1feb40(_0x514d2f);})[_0x38d5('0x25')](function(_0x2f18e4){logger[_0x38d5('0x16')](_0x38d5('0x23'),_0x2f18e4['message'],_0x1fd88f);_0x4c7ce3(_0x1c91a7[_0x38d5('0x16')](0x1f4,_0x2f18e4[_0x38d5('0x18')]));});});};exports[_0x38d5('0x26')]=function(_0x1e9ba3){var _0x4c9cb7=this;return new Promise(function(_0x10d1b4,_0x56752f){return db[_0x38d5('0x27')]['find']({'raw':_0x1e9ba3[_0x38d5('0x1c')]?_0x1e9ba3[_0x38d5('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x1e9ba3[_0x38d5('0x1c')]?_0x1e9ba3[_0x38d5('0x1c')][_0x38d5('0x1d')]||null:null,'attributes':_0x1e9ba3['options']?_0x1e9ba3[_0x38d5('0x1c')]['attributes']||null:null,'include':_0x1e9ba3[_0x38d5('0x1c')]?_0x1e9ba3[_0x38d5('0x1c')][_0x38d5('0x1f')]?_[_0x38d5('0x20')](_0x1e9ba3['options'][_0x38d5('0x1f')],function(_0x1dcc96){return{'model':db[_0x1dcc96['model']],'as':_0x1dcc96['as'],'attributes':_0x1dcc96[_0x38d5('0x21')],'include':_0x1dcc96[_0x38d5('0x1f')]?_[_0x38d5('0x20')](_0x1dcc96[_0x38d5('0x1f')],function(_0xe70c92){return{'model':db[_0xe70c92[_0x38d5('0x22')]],'as':_0xe70c92['as'],'attributes':_0xe70c92[_0x38d5('0x21')],'include':_0xe70c92[_0x38d5('0x1f')]?_['map'](_0xe70c92[_0x38d5('0x1f')],function(_0x511cfc){return{'model':db[_0x511cfc[_0x38d5('0x22')]],'as':_0x511cfc['as'],'attributes':_0x511cfc[_0x38d5('0x21')]};}):[]};}):[]};}):[]:[]})[_0x38d5('0x11')](function(_0x59ebab){logger['info'](_0x38d5('0x26'),_0x1e9ba3);logger[_0x38d5('0x24')](_0x38d5('0x26'),_0x1e9ba3,JSON['stringify'](_0x59ebab));_0x10d1b4(_0x59ebab);})['catch'](function(_0x4643b9){logger[_0x38d5('0x16')](_0x38d5('0x26'),_0x4643b9[_0x38d5('0x18')],_0x1e9ba3);_0x56752f(_0x4c9cb7['error'](0x1f4,_0x4643b9[_0x38d5('0x18')]));});});};exports[_0x38d5('0x28')]=function(_0x3d16eb){var _0x431fbc=this;return new Promise(function(_0x5c45da,_0x4d197e){var _0x53b425={'body':_0x3d16eb[_0x38d5('0x29')],'channel':_0x38d5('0x2a')};var _0x6a018b=_[_0x38d5('0x2b')](_[_0x38d5('0x2c')](db[_0x38d5('0x2d')]['rawAttributes']),[_0x38d5('0x2e'),_0x38d5('0x2f'),_0x38d5('0x30'),_0x38d5('0x31')]);var _0x23def4=![];if(_0x3d16eb[_0x38d5('0x29')]['id']){delete _0x3d16eb['body']['id'];}if(_[_0x38d5('0x32')](_0x3d16eb[_0x38d5('0x29')][_0x38d5('0x33')])){return _0x4d197e(_0x431fbc[_0x38d5('0x16')](0x1f4,_0x38d5('0x34')));}if(_[_0x38d5('0x32')](_0x3d16eb[_0x38d5('0x29')][_0x38d5('0x29')])||_0x3d16eb[_0x38d5('0x29')][_0x38d5('0x29')]===''){return _0x4d197e(_0x431fbc[_0x38d5('0x16')](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0x38d5('0x32')](_0x3d16eb['body']['mapKey'])){return _0x4d197e(_0x431fbc[_0x38d5('0x16')](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x6a018b));}if(!_['includes'](_0x6a018b,_0x3d16eb['body']['mapKey'])){return _0x4d197e(_0x431fbc['error'](0x1f4,'mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x6a018b));}var _0x5dd53a={};_0x5dd53a[_0x3d16eb['body'][_0x38d5('0x35')]]=_0x3d16eb[_0x38d5('0x29')][_0x38d5('0x33')];return db[_0x38d5('0x27')][_0x38d5('0x36')]({'where':{'id':_0x3d16eb[_0x38d5('0x37')]['id']},'include':[{'model':db[_0x38d5('0x38')],'as':_0x38d5('0x39'),'include':[{'model':db[_0x38d5('0x2d')],'as':_0x38d5('0x3a'),'where':_0x5dd53a,'limit':0x1,'order':[[_0x38d5('0x2f'),_0x38d5('0x3b')]]}]},{'model':db[_0x38d5('0x3c')],'as':_0x38d5('0x3d')},{'model':db[_0x38d5('0x3e')],'as':_0x38d5('0x3f')}]})[_0x38d5('0x11')](function(_0x44644a){if(_0x44644a&&_0x44644a[_0x38d5('0x39')]){var _0x59923b=_0x44644a['get']({'plain':!![]});_0x53b425['account']=_[_0x38d5('0x40')](_0x59923b,[_0x38d5('0x3d'),_0x38d5('0x39')]);_0x53b425[_0x38d5('0x41')]=_0x59923b[_0x38d5('0x3d')];_0x53b425[_0x38d5('0x42')]=_0x59923b[_0x38d5('0x39')];_0x53b425[_0x38d5('0x41')]=_[_0x38d5('0x43')](_0x53b425[_0x38d5('0x41')],[_0x38d5('0x44')],[_0x38d5('0x45')]);if(_0x53b425[_0x38d5('0x37')]&&_0x53b425[_0x38d5('0x37')]['autoclose']){_0x53b425[_0x38d5('0x41')][_0x38d5('0x46')]({'id':0x0,'priority':_0x53b425[_0x38d5('0x41')][_0x38d5('0x47')]+0x1,'app':'close','appdata':_0x38d5('0x48'),'interval':'*,*,*,*'});}if(_0x53b425['account'][_0x38d5('0x3d')]){delete _0x53b425[_0x38d5('0x37')][_0x38d5('0x3d')];}if(_0x53b425[_0x38d5('0x37')][_0x38d5('0x39')]){delete _0x53b425[_0x38d5('0x37')][_0x38d5('0x39')];}if(_0x59923b['List'][_0x38d5('0x3a')][_0x38d5('0x47')]){return _0x59923b['List']['Contacts'][0x0];}var _0x522d13=_[_0x38d5('0x49')](_0x3d16eb['body'],{'firstName':_0x3d16eb[_0x38d5('0x29')][_0x38d5('0x33')],'ListId':_0x59923b[_0x38d5('0x31')]});_0x522d13[_0x3d16eb[_0x38d5('0x29')][_0x38d5('0x35')]]=_0x3d16eb[_0x38d5('0x29')][_0x38d5('0x33')];return db[_0x38d5('0x2d')][_0x38d5('0x4a')](_0x522d13);}else{throw new Error('List\x20not\x20found');}})[_0x38d5('0x11')](function(_0x5e2ccb){_0x53b425[_0x38d5('0x4b')]=_0x5e2ccb;if(_0x5e2ccb){if(!_0x3d16eb[_0x38d5('0x29')]['message']['messageId']){_0x3d16eb[_0x38d5('0x29')][_0x38d5('0x18')][_0x38d5('0x4c')]=rs[_0x38d5('0x4d')]()+'\x20'+_0x3d16eb[_0x38d5('0x29')][_0x38d5('0x18')][_0x38d5('0x33')];}var _0x481846={'ContactId':_0x5e2ccb['id'],'MailAccountId':_0x3d16eb['account']['id'],'inReplyTo':_0x3d16eb[_0x38d5('0x29')][_0x38d5('0x18')][_0x38d5('0x4c')],'to':_0x3d16eb['body']['message'][_0x38d5('0x33')],'cc':_0x3d16eb[_0x38d5('0x29')][_0x38d5('0x18')]['cc'],'subject':_0x3d16eb[_0x38d5('0x29')][_0x38d5('0x18')][_0x38d5('0x4e')],'attach':_0x3d16eb[_0x38d5('0x29')][_0x38d5('0x18')]['attach'],'lastMsgAt':moment()[_0x38d5('0x4f')](_0x38d5('0x50')),'lastMsgDirection':'in','lastMsgBody':_0x3d16eb[_0x38d5('0x29')]['body']};return db[_0x38d5('0x51')][_0x38d5('0x36')]({'where':{'closed':![],'MailAccountId':_0x3d16eb[_0x38d5('0x37')]['id']},'include':[{'model':db['MailMessage'],'as':_0x38d5('0x52'),'attributes':[_0x38d5('0x4c')],'where':{'messageId':_0x3d16eb[_0x38d5('0x29')][_0x38d5('0x18')][_0x38d5('0x53')]}}]})[_0x38d5('0x11')](function(_0x3d2bdf){if(_0x3d2bdf){return[_0x3d2bdf,![]];}return db['MailInteraction'][_0x38d5('0x4a')](_0x481846)[_0x38d5('0x11')](function(_0x4ea326){return[_0x4ea326,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x38d5('0x54')](function(_0x4bfcee,_0x3d0849){if(_0x4bfcee){_0x23def4=_0x3d0849;if(!_0x3d0849){return _0x4bfcee['update']({'inReplyTo':_0x3d16eb[_0x38d5('0x29')][_0x38d5('0x18')][_0x38d5('0x4c')],'to':_0x3d16eb[_0x38d5('0x29')][_0x38d5('0x18')]['from'],'cc':_0x3d16eb[_0x38d5('0x29')][_0x38d5('0x18')]['cc'],'subject':_0x3d16eb[_0x38d5('0x29')][_0x38d5('0x18')]['subject'],'attach':_0x4bfcee['attach']?_0x4bfcee[_0x38d5('0x55')]:_0x3d16eb[_0x38d5('0x29')][_0x38d5('0x18')][_0x38d5('0x55')],'substatus':null,'substatusAt':moment()[_0x38d5('0x4f')](_0x38d5('0x50')),'lastMsgAt':moment()['format'](_0x38d5('0x50')),'lastMsgDirection':'in','lastMsgBody':_0x3d16eb[_0x38d5('0x29')]['body']});}else{return _0x4bfcee;}}})['then'](function(_0x27e577){_0x53b425['interaction']=_0x27e577[_0x38d5('0x56')]({'plain':!![]});_0x53b425['interaction']['created']=_0x23def4;return db['MailMessage'][_0x38d5('0x4a')]({'body':_0x3d16eb[_0x38d5('0x29')]['body'],'MailAccountId':_0x3d16eb[_0x38d5('0x37')]['id'],'MailInteractionId':_0x27e577['id'],'direction':'in','ContactId':_0x53b425[_0x38d5('0x4b')]['id'],'messageId':_0x3d16eb[_0x38d5('0x29')][_0x38d5('0x18')][_0x38d5('0x4c')],'from':_0x3d16eb['body'][_0x38d5('0x18')][_0x38d5('0x33')],'to':_0x3d16eb['body'][_0x38d5('0x18')]['to'],'cc':_0x3d16eb[_0x38d5('0x29')][_0x38d5('0x18')]['cc'],'subject':_0x3d16eb[_0x38d5('0x29')][_0x38d5('0x18')][_0x38d5('0x4e')],'attach':_0x3d16eb[_0x38d5('0x29')][_0x38d5('0x18')]['attach'],'Attachments':_0x3d16eb[_0x38d5('0x29')][_0x38d5('0x18')][_0x38d5('0x57')],'originTo':_0x3d16eb[_0x38d5('0x29')][_0x38d5('0x18')][_0x38d5('0x58')],'originCc':_0x3d16eb[_0x38d5('0x29')][_0x38d5('0x18')][_0x38d5('0x59')],'bcc':_0x3d16eb[_0x38d5('0x29')]['message']['bcc']},{'include':[{'model':db[_0x38d5('0x5a')],'as':_0x38d5('0x5b')}]});})[_0x38d5('0x11')](function(_0x164c91){_0x53b425['message']=_0x164c91;if(_0x53b425[_0x38d5('0x5c')]['UserId']){return db[_0x38d5('0x5d')][_0x38d5('0x36')]({'attributes':['id',_0x38d5('0x5e')],'where':{'id':_0x53b425[_0x38d5('0x5c')][_0x38d5('0x5f')]}})[_0x38d5('0x11')](function(_0x3f8862){if(_0x3f8862){_0x53b425[_0x38d5('0x41')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x3f8862[_0x38d5('0x5e')]+','+(_0x53b425[_0x38d5('0x37')][_0x38d5('0x60')]||0xa),'interval':_0x38d5('0x61')});}return respondWithRpcPromise(_0x38d5('0x62'),_0x38d5('0x63'),_0x53b425);});}return respondWithRpcPromise('Start',_0x38d5('0x63'),_0x53b425);})['then'](function(_0x312f57){_0x5c45da(_0x312f57);})[_0x38d5('0x25')](function(_0x277c72){_0x4d197e(_0x431fbc[_0x38d5('0x16')](0x1f4,_0x277c72[_0x38d5('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 1913151..f19518a 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 _0xd8fb=['./mailAccount.events','save','remove','update','emit','removeListener','register','length','mailAccount:'];(function(_0x570ac8,_0x53ec66){var _0xe7632d=function(_0x410771){while(--_0x410771){_0x570ac8['push'](_0x570ac8['shift']());}};_0xe7632d(++_0x53ec66);}(_0xd8fb,0x99));var _0xbd8f=function(_0xffb6ab,_0x4ee9ea){_0xffb6ab=_0xffb6ab-0x0;var _0x572758=_0xd8fb[_0xffb6ab];return _0x572758;};'use strict';var MailAccountEvents=require(_0xbd8f('0x0'));var events=[_0xbd8f('0x1'),_0xbd8f('0x2'),_0xbd8f('0x3')];function createListener(_0x52724c,_0x5ea933){return function(_0x4e9545){_0x5ea933[_0xbd8f('0x4')](_0x52724c,_0x4e9545);};}function removeListener(_0x43d177,_0x53cccc){return function(){MailAccountEvents[_0xbd8f('0x5')](_0x43d177,_0x53cccc);};}exports[_0xbd8f('0x6')]=function(_0x5543b2){for(var _0x33d541=0x0,_0x4e97cf=events[_0xbd8f('0x7')];_0x33d541<_0x4e97cf;_0x33d541++){var _0x578499=events[_0x33d541];var _0x197827=createListener(_0xbd8f('0x8')+_0x578499,_0x5543b2);MailAccountEvents['on'](_0x578499,_0x197827);}}; \ No newline at end of file +var _0xf1c6=['remove','update','register','length','mailAccount:'];(function(_0x29279c,_0x570176){var _0x279b1f=function(_0xd36d1f){while(--_0xd36d1f){_0x29279c['push'](_0x29279c['shift']());}};_0x279b1f(++_0x570176);}(_0xf1c6,0x145));var _0x6f1c=function(_0x55bc47,_0xfecfb0){_0x55bc47=_0x55bc47-0x0;var _0x29a3b5=_0xf1c6[_0x55bc47];return _0x29a3b5;};'use strict';var MailAccountEvents=require('./mailAccount.events');var events=['save',_0x6f1c('0x0'),_0x6f1c('0x1')];function createListener(_0x26cd1b,_0x405b3c){return function(_0xc393e2){_0x405b3c['emit'](_0x26cd1b,_0xc393e2);};}function removeListener(_0x5f0d77,_0x43775d){return function(){MailAccountEvents['removeListener'](_0x5f0d77,_0x43775d);};}exports[_0x6f1c('0x2')]=function(_0xa275f4){for(var _0x462c85=0x0,_0x537c4f=events[_0x6f1c('0x3')];_0x462c85<_0x537c4f;_0x462c85++){var _0x564a8f=events[_0x462c85];var _0x275f11=createListener(_0x6f1c('0x4')+_0x564a8f,_0xa275f4);MailAccountEvents['on'](_0x564a8f,_0x275f11);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index a7b702a..9e30bdd 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 _0xac4a=['../../config/environment','./mailApplication.controller','get','isAuthenticated','put','update','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x186376,_0x5d988a){var _0x2dbdd9=function(_0x96908e){while(--_0x96908e){_0x186376['push'](_0x186376['shift']());}};_0x2dbdd9(++_0x5d988a);}(_0xac4a,0x13f));var _0xaac4=function(_0x114037,_0x5c95d4){_0x114037=_0x114037-0x0;var _0x26d89d=_0xac4a[_0x114037];return _0x26d89d;};'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')]('/:id',auth[_0xaac4('0x9')](),controller['show']);router[_0xaac4('0xa')]('/:id',auth[_0xaac4('0x9')](),controller[_0xaac4('0xb')]);router['delete']('/:id',auth[_0xaac4('0x9')](),controller['destroy']);module[_0xaac4('0xc')]=router; \ No newline at end of file +var _0xf4eb=['isAuthenticated','show','put','destroy','exports','multer','Router','../../config/environment','./mailApplication.controller','get','/:id'];(function(_0xf64e5,_0x4a3232){var _0x5f312c=function(_0x4d816c){while(--_0x4d816c){_0xf64e5['push'](_0xf64e5['shift']());}};_0x5f312c(++_0x4a3232);}(_0xf4eb,0xec));var _0xbf4e=function(_0x371fea,_0xbe70e5){_0x371fea=_0x371fea-0x0;var _0x472e03=_0xf4eb[_0x371fea];return _0x472e03;};'use strict';var multer=require(_0xbf4e('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xbf4e('0x1')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xbf4e('0x2'));var controller=require(_0xbf4e('0x3'));router[_0xbf4e('0x4')](_0xbf4e('0x5'),auth[_0xbf4e('0x6')](),controller[_0xbf4e('0x7')]);router[_0xbf4e('0x8')]('/:id',auth[_0xbf4e('0x6')](),controller['update']);router['delete'](_0xbf4e('0x5'),auth[_0xbf4e('0x6')](),controller[_0xbf4e('0x9')]);module[_0xbf4e('0xa')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 295ae9e..4a19f50 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 _0x422a=['exports','INTEGER','noop','TEXT','STRING','*,*,*,*','sequelize'];(function(_0x219536,_0x8e0b9b){var _0x231e4d=function(_0x37b376){while(--_0x37b376){_0x219536['push'](_0x219536['shift']());}};_0x231e4d(++_0x8e0b9b);}(_0x422a,0x195));var _0xa422=function(_0x17e541,_0x4ca4dc){_0x17e541=_0x17e541-0x0;var _0x31b296=_0x422a[_0x17e541];return _0x31b296;};'use strict';var Sequelize=require(_0xa422('0x0'));module[_0xa422('0x1')]={'priority':{'type':Sequelize[_0xa422('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xa422('0x3')},'appdata':{'type':Sequelize[_0xa422('0x4')]()},'description':{'type':Sequelize[_0xa422('0x5')]},'interval':{'type':Sequelize[_0xa422('0x5')],'defaultValue':_0xa422('0x6')}}; \ No newline at end of file +var _0x20d8=['INTEGER','TEXT','STRING','*,*,*,*','sequelize','exports'];(function(_0x231a47,_0x46a963){var _0x48d7c9=function(_0x1e69b1){while(--_0x1e69b1){_0x231a47['push'](_0x231a47['shift']());}};_0x48d7c9(++_0x46a963);}(_0x20d8,0xee));var _0x820d=function(_0x3976d2,_0x5a8b8e){_0x3976d2=_0x3976d2-0x0;var _0x1b85d3=_0x20d8[_0x3976d2];return _0x1b85d3;};'use strict';var Sequelize=require(_0x820d('0x0'));module[_0x820d('0x1')]={'priority':{'type':Sequelize[_0x820d('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x820d('0x3')]()},'description':{'type':Sequelize[_0x820d('0x4')]},'interval':{'type':Sequelize[_0x820d('0x4')],'defaultValue':_0x820d('0x5')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 7ae5004..8f7ec75 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 _0x5824=['request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','end','json','count','offset','set','Content-Range','reject','save','update','destroy','then','sendStatus','name','send','show','params','model','keys','MailApplication','rawAttributes','query','filters','intersection','attributes','includeAll','include','merge','options','find','catch','body','html-pdf','rimraf','zip-dir','fast-json-patch'];(function(_0x4417b7,_0x5c9044){var _0x319dfd=function(_0x5b8177){while(--_0x5b8177){_0x4417b7['push'](_0x4417b7['shift']());}};_0x319dfd(++_0x5c9044);}(_0x5824,0x14c));var _0x4582=function(_0x2424a2,_0x594db4){_0x2424a2=_0x2424a2-0x0;var _0x5abcc7=_0x5824[_0x2424a2];return _0x5abcc7;};'use strict';var pdf=require(_0x4582('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x4582('0x1'));var zipdir=require(_0x4582('0x2'));var jsonpatch=require(_0x4582('0x3'));var rp=require(_0x4582('0x4'));var moment=require(_0x4582('0x5'));var BPromise=require(_0x4582('0x6'));var Mustache=require(_0x4582('0x7'));var util=require(_0x4582('0x8'));var path=require(_0x4582('0x9'));var sox=require(_0x4582('0xa'));var csv=require(_0x4582('0xb'));var ejs=require(_0x4582('0xc'));var fs=require('fs');var _=require(_0x4582('0xd'));var squel=require('squel');var crypto=require(_0x4582('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x4582('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x4582('0x10'));var qs=require(_0x4582('0x11'));var as=require(_0x4582('0x12'));var hardwareService=require(_0x4582('0x13'));var logger=require(_0x4582('0x14'))(_0x4582('0x15'));var utils=require(_0x4582('0x16'));var config=require('../../config/environment');var db=require(_0x4582('0x17'))['db'];function respondWithStatusCode(_0xbf3a10,_0x7dbee7){_0x7dbee7=_0x7dbee7||0xcc;return function(_0x3c8883){if(_0x3c8883){return _0xbf3a10['sendStatus'](_0x7dbee7);}return _0xbf3a10[_0x4582('0x18')](_0x7dbee7)[_0x4582('0x19')]();};}function respondWithResult(_0x3f1ac4,_0x141b49){_0x141b49=_0x141b49||0xc8;return function(_0x27a4ef){if(_0x27a4ef){return _0x3f1ac4['status'](_0x141b49)[_0x4582('0x1a')](_0x27a4ef);}};}function respondWithFilteredResult(_0x51dd72,_0x9ec576){return function(_0x127e29){if(_0x127e29){var _0x140af7=_0x127e29[_0x4582('0x1b')],_0x19ae22=_0x9ec576[_0x4582('0x1c')],_0x201ac4=_0x9ec576['offset']+_0x9ec576['limit'],_0x278306;if(_0x201ac4>=_0x140af7){_0x201ac4=_0x140af7;_0x278306=0xc8;}else{_0x278306=0xce;}_0x51dd72[_0x4582('0x18')](_0x278306);return _0x51dd72[_0x4582('0x1d')](_0x4582('0x1e'),_0x19ae22+'-'+_0x201ac4+'/'+_0x140af7)[_0x4582('0x1a')](_0x127e29);}return null;};}function patchUpdates(_0xdc0c62){return function(_0x161658){try{jsonpatch['apply'](_0x161658,_0xdc0c62,!![]);}catch(_0x345758){return BPromise[_0x4582('0x1f')](_0x345758);}return _0x161658[_0x4582('0x20')]();};}function saveUpdates(_0x49981f,_0x355a3c){return function(_0x1368cc){if(_0x1368cc){return _0x1368cc[_0x4582('0x21')](_0x49981f)['then'](function(_0xa3ed38){return _0xa3ed38;});}return null;};}function removeEntity(_0x4af7ad,_0x52ceca){return function(_0x2c8110){if(_0x2c8110){return _0x2c8110[_0x4582('0x22')]()[_0x4582('0x23')](function(){_0x4af7ad[_0x4582('0x18')](0xcc)[_0x4582('0x19')]();});}};}function handleEntityNotFound(_0x258d96,_0x192004){return function(_0x46edbb){if(!_0x46edbb){_0x258d96[_0x4582('0x24')](0x194);}return _0x46edbb;};}function handleError(_0x292506,_0x2be989){_0x2be989=_0x2be989||0x1f4;return function(_0x570e6d){logger['error'](_0x570e6d['stack']);if(_0x570e6d['name']){delete _0x570e6d[_0x4582('0x25')];}_0x292506[_0x4582('0x18')](_0x2be989)[_0x4582('0x26')](_0x570e6d);};}exports[_0x4582('0x27')]=function(_0x4cbebf,_0x25abae){var _0x549437={'raw':!![],'where':{'id':_0x4cbebf[_0x4582('0x28')]['id']}},_0x3e5781={};_0x3e5781[_0x4582('0x29')]=_[_0x4582('0x2a')](db[_0x4582('0x2b')][_0x4582('0x2c')]);_0x3e5781[_0x4582('0x2d')]=_[_0x4582('0x2a')](_0x4cbebf['query']);_0x3e5781[_0x4582('0x2e')]=_[_0x4582('0x2f')](_0x3e5781[_0x4582('0x29')],_0x3e5781['query']);_0x549437[_0x4582('0x30')]=_[_0x4582('0x2f')](_0x3e5781[_0x4582('0x29')],qs['fields'](_0x4cbebf['query']['fields']));_0x549437[_0x4582('0x30')]=_0x549437[_0x4582('0x30')]['length']?_0x549437[_0x4582('0x30')]:_0x3e5781[_0x4582('0x29')];if(_0x4cbebf[_0x4582('0x2d')][_0x4582('0x31')]){_0x549437[_0x4582('0x32')]=[{'all':!![]}];}_0x549437=_[_0x4582('0x33')]({},_0x549437,_0x4cbebf[_0x4582('0x34')]);return db[_0x4582('0x2b')][_0x4582('0x35')](_0x549437)[_0x4582('0x23')](handleEntityNotFound(_0x25abae,null))[_0x4582('0x23')](respondWithResult(_0x25abae,null))[_0x4582('0x36')](handleError(_0x25abae,null));};exports['update']=function(_0x7feb36,_0x3f6d55){if(_0x7feb36[_0x4582('0x37')]['id']){delete _0x7feb36['body']['id'];}return db[_0x4582('0x2b')][_0x4582('0x35')]({'where':{'id':_0x7feb36[_0x4582('0x28')]['id']}})[_0x4582('0x23')](handleEntityNotFound(_0x3f6d55,null))[_0x4582('0x23')](saveUpdates(_0x7feb36[_0x4582('0x37')],null))[_0x4582('0x23')](respondWithResult(_0x3f6d55,null))[_0x4582('0x36')](handleError(_0x3f6d55,null));};exports[_0x4582('0x22')]=function(_0x32d8fc,_0x3c1896){return db[_0x4582('0x2b')][_0x4582('0x35')]({'where':{'id':_0x32d8fc[_0x4582('0x28')]['id']}})[_0x4582('0x23')](handleEntityNotFound(_0x3c1896,null))[_0x4582('0x23')](removeEntity(_0x3c1896,null))[_0x4582('0x36')](handleError(_0x3c1896,null));}; \ No newline at end of file +var _0x10b2=['query','fields','attributes','length','includeAll','include','merge','options','then','catch','body','destroy','find','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','offset','set','Content-Range','json','reject','update','error','stack','name','send','params','model','keys','MailApplication'];(function(_0x2e198d,_0x294522){var _0x36e239=function(_0x326416){while(--_0x326416){_0x2e198d['push'](_0x2e198d['shift']());}};_0x36e239(++_0x294522);}(_0x10b2,0x18e));var _0x210b=function(_0x355e24,_0x22b865){_0x355e24=_0x355e24-0x0;var _0x2d3366=_0x10b2[_0x355e24];return _0x2d3366;};'use strict';var pdf=require(_0x210b('0x0'));var emlformat=require(_0x210b('0x1'));var rimraf=require(_0x210b('0x2'));var zipdir=require(_0x210b('0x3'));var jsonpatch=require(_0x210b('0x4'));var rp=require(_0x210b('0x5'));var moment=require('moment');var BPromise=require(_0x210b('0x6'));var Mustache=require(_0x210b('0x7'));var util=require(_0x210b('0x8'));var path=require(_0x210b('0x9'));var sox=require(_0x210b('0xa'));var csv=require(_0x210b('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x210b('0xc'));var jsforce=require(_0x210b('0xd'));var deskjs=require(_0x210b('0xe'));var toCsv=require(_0x210b('0xb'));var querystring=require(_0x210b('0xf'));var Papa=require(_0x210b('0x10'));var Redis=require('ioredis');var authService=require(_0x210b('0x11'));var qs=require(_0x210b('0x12'));var as=require(_0x210b('0x13'));var hardwareService=require(_0x210b('0x14'));var logger=require(_0x210b('0x15'))(_0x210b('0x16'));var utils=require(_0x210b('0x17'));var config=require('../../config/environment');var db=require(_0x210b('0x18'))['db'];function respondWithStatusCode(_0x7eb31e,_0x39c824){_0x39c824=_0x39c824||0xcc;return function(_0x994725){if(_0x994725){return _0x7eb31e[_0x210b('0x19')](_0x39c824);}return _0x7eb31e[_0x210b('0x1a')](_0x39c824)[_0x210b('0x1b')]();};}function respondWithResult(_0x274fbc,_0x1c08c3){_0x1c08c3=_0x1c08c3||0xc8;return function(_0x1c604e){if(_0x1c604e){return _0x274fbc[_0x210b('0x1a')](_0x1c08c3)['json'](_0x1c604e);}};}function respondWithFilteredResult(_0x44d182,_0x309362){return function(_0x1bc2de){if(_0x1bc2de){var _0x5dca5b=_0x1bc2de['count'],_0x467f52=_0x309362['offset'],_0x5e7c57=_0x309362[_0x210b('0x1c')]+_0x309362['limit'],_0x3ee4ac;if(_0x5e7c57>=_0x5dca5b){_0x5e7c57=_0x5dca5b;_0x3ee4ac=0xc8;}else{_0x3ee4ac=0xce;}_0x44d182[_0x210b('0x1a')](_0x3ee4ac);return _0x44d182[_0x210b('0x1d')](_0x210b('0x1e'),_0x467f52+'-'+_0x5e7c57+'/'+_0x5dca5b)[_0x210b('0x1f')](_0x1bc2de);}return null;};}function patchUpdates(_0x38bf83){return function(_0x19f688){try{jsonpatch['apply'](_0x19f688,_0x38bf83,!![]);}catch(_0xd5c4ab){return BPromise[_0x210b('0x20')](_0xd5c4ab);}return _0x19f688['save']();};}function saveUpdates(_0x499ca4,_0x28f388){return function(_0x4f0a35){if(_0x4f0a35){return _0x4f0a35[_0x210b('0x21')](_0x499ca4)['then'](function(_0x129332){return _0x129332;});}return null;};}function removeEntity(_0xa3138f,_0x3a7aa2){return function(_0x366bce){if(_0x366bce){return _0x366bce['destroy']()['then'](function(){_0xa3138f['status'](0xcc)[_0x210b('0x1b')]();});}};}function handleEntityNotFound(_0x47e4c5,_0x14bc1a){return function(_0x342934){if(!_0x342934){_0x47e4c5[_0x210b('0x19')](0x194);}return _0x342934;};}function handleError(_0x21c0ef,_0x120ef9){_0x120ef9=_0x120ef9||0x1f4;return function(_0x556682){logger[_0x210b('0x22')](_0x556682[_0x210b('0x23')]);if(_0x556682['name']){delete _0x556682[_0x210b('0x24')];}_0x21c0ef[_0x210b('0x1a')](_0x120ef9)[_0x210b('0x25')](_0x556682);};}exports['show']=function(_0x48ebed,_0x42f6a9){var _0x3cbc26={'raw':!![],'where':{'id':_0x48ebed[_0x210b('0x26')]['id']}},_0x5c940a={};_0x5c940a[_0x210b('0x27')]=_[_0x210b('0x28')](db[_0x210b('0x29')]['rawAttributes']);_0x5c940a[_0x210b('0x2a')]=_['keys'](_0x48ebed[_0x210b('0x2a')]);_0x5c940a['filters']=_['intersection'](_0x5c940a['model'],_0x5c940a['query']);_0x3cbc26['attributes']=_['intersection'](_0x5c940a['model'],qs[_0x210b('0x2b')](_0x48ebed[_0x210b('0x2a')][_0x210b('0x2b')]));_0x3cbc26[_0x210b('0x2c')]=_0x3cbc26[_0x210b('0x2c')][_0x210b('0x2d')]?_0x3cbc26[_0x210b('0x2c')]:_0x5c940a[_0x210b('0x27')];if(_0x48ebed[_0x210b('0x2a')][_0x210b('0x2e')]){_0x3cbc26[_0x210b('0x2f')]=[{'all':!![]}];}_0x3cbc26=_[_0x210b('0x30')]({},_0x3cbc26,_0x48ebed[_0x210b('0x31')]);return db[_0x210b('0x29')]['find'](_0x3cbc26)[_0x210b('0x32')](handleEntityNotFound(_0x42f6a9,null))[_0x210b('0x32')](respondWithResult(_0x42f6a9,null))[_0x210b('0x33')](handleError(_0x42f6a9,null));};exports[_0x210b('0x21')]=function(_0x6e4e11,_0xa8c9d6){if(_0x6e4e11[_0x210b('0x34')]['id']){delete _0x6e4e11[_0x210b('0x34')]['id'];}return db[_0x210b('0x29')]['find']({'where':{'id':_0x6e4e11[_0x210b('0x26')]['id']}})['then'](handleEntityNotFound(_0xa8c9d6,null))[_0x210b('0x32')](saveUpdates(_0x6e4e11[_0x210b('0x34')],null))[_0x210b('0x32')](respondWithResult(_0xa8c9d6,null))['catch'](handleError(_0xa8c9d6,null));};exports[_0x210b('0x35')]=function(_0xd4f260,_0x2e79d0){return db[_0x210b('0x29')][_0x210b('0x36')]({'where':{'id':_0xd4f260['params']['id']}})[_0x210b('0x32')](handleEntityNotFound(_0x2e79d0,null))['then'](removeEntity(_0x2e79d0,null))['catch'](handleError(_0x2e79d0,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 5a508ff..e1380fd 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 _0x9219=['moment','path','./mailApplication.attributes','exports','define','MailApplication','mail_applications','utf8mb4','utf8mb4_unicode_ci'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x9219,0x19e));var _0x9921=function(_0x1aad04,_0x26420d){_0x1aad04=_0x1aad04-0x0;var _0x1f2dfe=_0x9219[_0x1aad04];return _0x1f2dfe;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x9921('0x0'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x9921('0x1'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x9921('0x2'));module[_0x9921('0x3')]=function(_0x4f9708,_0x1f932b){return _0x4f9708[_0x9921('0x4')](_0x9921('0x5'),attributes,{'tableName':_0x9921('0x6'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x9921('0x7'),'collate':_0x9921('0x8')});}; \ No newline at end of file +var _0xa5c1=['util','../../config/logger','bluebird','path','rimraf','../../config/environment','./mailApplication.attributes','exports','define','mail_applications','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x358186,_0x4b0f41){var _0x57eb08=function(_0x4acf0b){while(--_0x4acf0b){_0x358186['push'](_0x358186['shift']());}};_0x57eb08(++_0x4b0f41);}(_0xa5c1,0x19f));var _0x1a5c=function(_0x2c66ca,_0x4f2a9a){_0x2c66ca=_0x2c66ca-0x0;var _0x4ce03f=_0xa5c1[_0x2c66ca];return _0x4ce03f;};'use strict';var _=require(_0x1a5c('0x0'));var util=require(_0x1a5c('0x1'));var logger=require(_0x1a5c('0x2'))('api');var moment=require('moment');var BPromise=require(_0x1a5c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1a5c('0x4'));var rimraf=require(_0x1a5c('0x5'));var config=require(_0x1a5c('0x6'));var attributes=require(_0x1a5c('0x7'));module[_0x1a5c('0x8')]=function(_0x3c3558,_0x4d7377){return _0x3c3558[_0x1a5c('0x9')]('MailApplication',attributes,{'tableName':_0x1a5c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x1a5c('0xb'),'collate':_0x1a5c('0xc')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 3bf55ef..54e6138 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 _0xa24c=['../../config/logger','../../config/environment','client','http','request','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','UpdateMailApplication','MailApplication','update','raw','options','attributes','then','stringify','lodash','moment','bluebird','randomstring','../../mysqldb'];(function(_0x16db8b,_0xca7d28){var _0x5ba017=function(_0x35b933){while(--_0x35b933){_0x16db8b['push'](_0x16db8b['shift']());}};_0x5ba017(++_0xca7d28);}(_0xa24c,0x1f3));var _0xca24=function(_0x405835,_0x2a8aed){_0x405835=_0x405835-0x0;var _0x36ce23=_0xa24c[_0x405835];return _0x36ce23;};'use strict';var _=require(_0xca24('0x0'));var util=require('util');var moment=require(_0xca24('0x1'));var BPromise=require(_0xca24('0x2'));var rs=require(_0xca24('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xca24('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xca24('0x5'))('rpc');var config=require(_0xca24('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xca24('0x7')][_0xca24('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2d7bed,_0x30a77b,_0x4d88af){return new BPromise(function(_0x1a60c6,_0x4d59d8){return client[_0xca24('0x9')](_0x2d7bed,_0x4d88af)['then'](function(_0x387d46){logger[_0xca24('0xa')](_0xca24('0xb'),_0x30a77b,_0xca24('0xc'));logger[_0xca24('0xd')](_0xca24('0xe'),_0x30a77b,_0xca24('0xc'),JSON['stringify'](_0x387d46));if(_0x387d46[_0xca24('0xf')]){if(_0x387d46['error'][_0xca24('0x10')]===0x1f4){logger[_0xca24('0xf')]('MailApplication,\x20%s,\x20%s',_0x30a77b,_0x387d46['error'][_0xca24('0x11')]);return _0x4d59d8(_0x387d46[_0xca24('0xf')]['message']);}logger[_0xca24('0xf')](_0xca24('0xb'),_0x30a77b,_0x387d46[_0xca24('0xf')][_0xca24('0x11')]);return _0x1a60c6(_0x387d46[_0xca24('0xf')][_0xca24('0x11')]);}else{logger[_0xca24('0xa')](_0xca24('0xb'),_0x30a77b,'request\x20sent');_0x1a60c6(_0x387d46[_0xca24('0x12')]['message']);}})[_0xca24('0x13')](function(_0xeead6c){logger['error']('MailApplication,\x20%s,\x20%s',_0x30a77b,_0xeead6c);_0x4d59d8(_0xeead6c);});});}exports[_0xca24('0x14')]=function(_0x19aebc){var _0x2fa7f8=this;return new Promise(function(_0x51a2fe,_0x1880a3){return db[_0xca24('0x15')][_0xca24('0x16')](_0x19aebc['body'],{'raw':_0x19aebc['options']?_0x19aebc['options'][_0xca24('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x19aebc['options']?_0x19aebc[_0xca24('0x18')]['where']||null:null,'attributes':_0x19aebc[_0xca24('0x18')]?_0x19aebc[_0xca24('0x18')][_0xca24('0x19')]||null:null,'limit':_0x19aebc[_0xca24('0x18')]?_0x19aebc[_0xca24('0x18')]['limit']||null:null})[_0xca24('0x1a')](function(_0x57c0b3){logger[_0xca24('0xa')](_0xca24('0x14'),_0x19aebc);logger[_0xca24('0xd')](_0xca24('0x14'),_0x19aebc,JSON[_0xca24('0x1b')](_0x57c0b3));_0x51a2fe(_0x57c0b3);})['catch'](function(_0x166ab0){logger[_0xca24('0xf')]('UpdateMailApplication',_0x166ab0[_0xca24('0x11')],_0x19aebc);_0x1880a3(_0x2fa7f8[_0xca24('0xf')](0x1f4,_0x166ab0[_0xca24('0x11')]));});});}; \ No newline at end of file +var _0x6054=['debug','stringify','catch','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','client','request','then','info','request\x20sent','error','MailApplication,\x20%s,\x20%s','message','result','UpdateMailApplication','MailApplication','body','options','raw','where','attributes'];(function(_0x1ce873,_0x5b09be){var _0x58eb22=function(_0x513ac6){while(--_0x513ac6){_0x1ce873['push'](_0x1ce873['shift']());}};_0x58eb22(++_0x5b09be);}(_0x6054,0x80));var _0x4605=function(_0x59ed8c,_0x497c0f){_0x59ed8c=_0x59ed8c-0x0;var _0x2ae760=_0x6054[_0x59ed8c];return _0x2ae760;};'use strict';var _=require(_0x4605('0x0'));var util=require('util');var moment=require(_0x4605('0x1'));var BPromise=require('bluebird');var rs=require(_0x4605('0x2'));var fs=require('fs');var Redis=require(_0x4605('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4605('0x4'));var logger=require(_0x4605('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4605('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1425b1,_0x537676,_0x1ba605){return new BPromise(function(_0x338f85,_0x3b4589){return client[_0x4605('0x7')](_0x1425b1,_0x1ba605)[_0x4605('0x8')](function(_0x29cb8e){logger[_0x4605('0x9')]('MailApplication,\x20%s,\x20%s',_0x537676,'request\x20sent');logger['debug']('MailApplication,\x20%s,\x20%s,\x20%s',_0x537676,_0x4605('0xa'),JSON['stringify'](_0x29cb8e));if(_0x29cb8e[_0x4605('0xb')]){if(_0x29cb8e[_0x4605('0xb')]['code']===0x1f4){logger['error'](_0x4605('0xc'),_0x537676,_0x29cb8e[_0x4605('0xb')]['message']);return _0x3b4589(_0x29cb8e[_0x4605('0xb')][_0x4605('0xd')]);}logger[_0x4605('0xb')](_0x4605('0xc'),_0x537676,_0x29cb8e[_0x4605('0xb')]['message']);return _0x338f85(_0x29cb8e['error'][_0x4605('0xd')]);}else{logger[_0x4605('0x9')](_0x4605('0xc'),_0x537676,'request\x20sent');_0x338f85(_0x29cb8e[_0x4605('0xe')][_0x4605('0xd')]);}})['catch'](function(_0x4ea133){logger[_0x4605('0xb')](_0x4605('0xc'),_0x537676,_0x4ea133);_0x3b4589(_0x4ea133);});});}exports[_0x4605('0xf')]=function(_0x1a477b){var _0x3074a5=this;return new Promise(function(_0x5d4691,_0x221dd0){return db[_0x4605('0x10')]['update'](_0x1a477b[_0x4605('0x11')],{'raw':_0x1a477b[_0x4605('0x12')]?_0x1a477b['options'][_0x4605('0x13')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1a477b[_0x4605('0x12')]?_0x1a477b[_0x4605('0x12')][_0x4605('0x14')]||null:null,'attributes':_0x1a477b[_0x4605('0x12')]?_0x1a477b[_0x4605('0x12')][_0x4605('0x15')]||null:null,'limit':_0x1a477b['options']?_0x1a477b[_0x4605('0x12')]['limit']||null:null})[_0x4605('0x8')](function(_0x4ef9ef){logger[_0x4605('0x9')](_0x4605('0xf'),_0x1a477b);logger[_0x4605('0x16')](_0x4605('0xf'),_0x1a477b,JSON[_0x4605('0x17')](_0x4ef9ef));_0x5d4691(_0x4ef9ef);})[_0x4605('0x18')](function(_0x2b7bd8){logger[_0x4605('0xb')](_0x4605('0xf'),_0x2b7bd8[_0x4605('0xd')],_0x1a477b);_0x221dd0(_0x3074a5[_0x4605('0xb')](0x1f4,_0x2b7bd8[_0x4605('0xd')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 494858a..46dcd1d 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 _0xde7f=['describe','/:id','show','getMessages','/:id/download','download','post','/:id/messages','addMessage','/:id/tags','tracked','mail','addTags','put','update','delete','mailinteraction:destroy','destroy','removeTags','multer','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailInteraction.controller','get','isAuthenticated','index'];(function(_0x18f43e,_0x5dab38){var _0x5c33e4=function(_0x1d5cbd){while(--_0x1d5cbd){_0x18f43e['push'](_0x18f43e['shift']());}};_0x5c33e4(++_0x5dab38);}(_0xde7f,0xa4));var _0xfde7=function(_0x7cde6e,_0x65fc4){_0x7cde6e=_0x7cde6e-0x0;var _0x187e40=_0xde7f[_0x7cde6e];return _0x187e40;};'use strict';var multer=require(_0xfde7('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xfde7('0x1'));var express=require('express');var router=express[_0xfde7('0x2')]();var auth=require(_0xfde7('0x3'));var interaction=require(_0xfde7('0x4'));var config=require(_0xfde7('0x5'));var controller=require(_0xfde7('0x6'));router[_0xfde7('0x7')]('/',auth[_0xfde7('0x8')](),controller[_0xfde7('0x9')]);router['get']('/describe',auth[_0xfde7('0x8')](),controller[_0xfde7('0xa')]);router[_0xfde7('0x7')](_0xfde7('0xb'),auth[_0xfde7('0x8')](),controller[_0xfde7('0xc')]);router[_0xfde7('0x7')]('/:id/messages',auth[_0xfde7('0x8')](),controller[_0xfde7('0xd')]);router[_0xfde7('0x7')](_0xfde7('0xe'),auth[_0xfde7('0x8')](),controller[_0xfde7('0xf')]);router[_0xfde7('0x10')]('/',auth[_0xfde7('0x8')](),controller['create']);router['post'](_0xfde7('0x11'),auth[_0xfde7('0x8')](),controller[_0xfde7('0x12')]);router['post'](_0xfde7('0x13'),auth[_0xfde7('0x8')](),interaction[_0xfde7('0x14')](_0xfde7('0x15'),'mailinteraction:addtags'),controller[_0xfde7('0x16')]);router[_0xfde7('0x17')](_0xfde7('0xb'),auth['isAuthenticated'](),interaction[_0xfde7('0x14')](_0xfde7('0x15'),'mailinteraction:update'),controller[_0xfde7('0x18')]);router[_0xfde7('0x19')](_0xfde7('0xb'),auth[_0xfde7('0x8')](),interaction[_0xfde7('0x14')](_0xfde7('0x15'),_0xfde7('0x1a')),controller[_0xfde7('0x1b')]);router['delete'](_0xfde7('0x13'),auth[_0xfde7('0x8')](),controller[_0xfde7('0x1c')]);module['exports']=router; \ No newline at end of file +var _0xed5f=['delete','mailinteraction:destroy','destroy','/:id/tags','removeTags','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','show','/:id/messages','getMessages','/:id/download','download','create','post','addMessage','tracked','mail','mailinteraction:addtags','addTags','mailinteraction:update','update'];(function(_0x4c437b,_0x2b4493){var _0x520c9d=function(_0x5ba63d){while(--_0x5ba63d){_0x4c437b['push'](_0x4c437b['shift']());}};_0x520c9d(++_0x2b4493);}(_0xed5f,0x1e6));var _0xfed5=function(_0x6cb4e9,_0x459813){_0x6cb4e9=_0x6cb4e9-0x0;var _0x5720c1=_0xed5f[_0x6cb4e9];return _0x5720c1;};'use strict';var multer=require('multer');var util=require(_0xfed5('0x0'));var path=require(_0xfed5('0x1'));var timeout=require(_0xfed5('0x2'));var express=require('express');var router=express[_0xfed5('0x3')]();var auth=require(_0xfed5('0x4'));var interaction=require(_0xfed5('0x5'));var config=require(_0xfed5('0x6'));var controller=require('./mailInteraction.controller');router[_0xfed5('0x7')]('/',auth[_0xfed5('0x8')](),controller[_0xfed5('0x9')]);router['get'](_0xfed5('0xa'),auth[_0xfed5('0x8')](),controller['describe']);router[_0xfed5('0x7')](_0xfed5('0xb'),auth[_0xfed5('0x8')](),controller[_0xfed5('0xc')]);router[_0xfed5('0x7')](_0xfed5('0xd'),auth[_0xfed5('0x8')](),controller[_0xfed5('0xe')]);router[_0xfed5('0x7')](_0xfed5('0xf'),auth[_0xfed5('0x8')](),controller[_0xfed5('0x10')]);router['post']('/',auth[_0xfed5('0x8')](),controller[_0xfed5('0x11')]);router[_0xfed5('0x12')](_0xfed5('0xd'),auth['isAuthenticated'](),controller[_0xfed5('0x13')]);router[_0xfed5('0x12')]('/:id/tags',auth[_0xfed5('0x8')](),interaction[_0xfed5('0x14')](_0xfed5('0x15'),_0xfed5('0x16')),controller[_0xfed5('0x17')]);router['put'](_0xfed5('0xb'),auth['isAuthenticated'](),interaction[_0xfed5('0x14')]('mail',_0xfed5('0x18')),controller[_0xfed5('0x19')]);router[_0xfed5('0x1a')](_0xfed5('0xb'),auth[_0xfed5('0x8')](),interaction[_0xfed5('0x14')](_0xfed5('0x15'),_0xfed5('0x1b')),controller[_0xfed5('0x1c')]);router[_0xfed5('0x1a')](_0xfed5('0x1d'),auth[_0xfed5('0x8')](),controller[_0xfed5('0x1e')]);module[_0xfed5('0x1f')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 45044ad..1b4537e 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 _0x4770=['iconv','exports','BOOLEAN','DATE','STRING','TEXT','long','ENUM','out'];(function(_0x799123,_0x4e7fbc){var _0x46d7bc=function(_0x2577c4){while(--_0x2577c4){_0x799123['push'](_0x799123['shift']());}};_0x46d7bc(++_0x4e7fbc);}(_0x4770,0x195));var _0x0477=function(_0x2e0cd5,_0xb9d51b){_0x2e0cd5=_0x2e0cd5-0x0;var _0x1da9c8=_0x4770[_0x2e0cd5];return _0x1da9c8;};'use strict';var Sequelize=require('sequelize');var iconv=require(_0x0477('0x0'));module[_0x0477('0x1')]={'closed':{'type':Sequelize[_0x0477('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x0477('0x3')]},'disposition':{'type':Sequelize[_0x0477('0x4')]},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0x0477('0x4')](0x1fe)},'to':{'type':Sequelize[_0x0477('0x4')]},'cc':{'type':Sequelize[_0x0477('0x5')](_0x0477('0x6'))},'subject':{'type':Sequelize[_0x0477('0x5')]()},'attach':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x0477('0x3')]},'substatus':{'type':Sequelize['STRING'](0x3c)},'substatusAt':{'type':Sequelize[_0x0477('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x0477('0x7')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x0477('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x0477('0x7')]('in',_0x0477('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgBody':{'type':Sequelize[_0x0477('0x5')](_0x0477('0x6'))},'lastMsgText':{'type':Sequelize[_0x0477('0x5')](_0x0477('0x6'))}}; \ No newline at end of file +var _0x0427=['BOOLEAN','DATE','STRING','TEXT','ENUM','long','sequelize','iconv','exports'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x0427,0x126));var _0x7042=function(_0x51d91a,_0x594008){_0x51d91a=_0x51d91a-0x0;var _0x3d991c=_0x0427[_0x51d91a];return _0x3d991c;};'use strict';var Sequelize=require(_0x7042('0x0'));var iconv=require(_0x7042('0x1'));module[_0x7042('0x2')]={'closed':{'type':Sequelize[_0x7042('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x7042('0x4')]},'disposition':{'type':Sequelize[_0x7042('0x5')]},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0x7042('0x5')](0x1fe)},'to':{'type':Sequelize[_0x7042('0x5')]},'cc':{'type':Sequelize['TEXT']('long')},'subject':{'type':Sequelize[_0x7042('0x6')]()},'attach':{'type':Sequelize[_0x7042('0x3')],'defaultValue':![]},'read1stAt':{'type':Sequelize['DATE']},'substatus':{'type':Sequelize[_0x7042('0x5')](0x3c)},'substatusAt':{'type':Sequelize[_0x7042('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x7042('0x7')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x7042('0x4')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgBody':{'type':Sequelize[_0x7042('0x6')](_0x7042('0x8'))},'lastMsgText':{'type':Sequelize[_0x7042('0x6')]('long')}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index a57e28f..ff24e5a 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 _0xa9e0=['MailInteractionId','Setting','enableEmailPreview','push','all','rows','show','params','include','merge','options','create','body','describe','addMessage','MailMessage','ids','omit','intersection','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','findAll','addTags','setTags','emit','mailInteractionTags:save','removeTags','unix','root','files','tmp','server','transcript-%d-%s.zip','join','attachments','Attachment','subject','Messages','get','mkdirSync','each','headers','bcc','Attachments','basename','existsSync','readFileSync','build','writeFileSync','download','log','err','unlinkSync','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','html-to-text','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../mysqldb','redis','defaults','localhost','./mailInteraction.socket','register','status','count','offset','limit','set','Content-Range','update','destroy','then','sendStatus','stack','name','send','Users','fullname','TagIds','Tags','split','forEach','MailInteraction','findOne','lastMsgText','trimStart','fromString','lastMsgBody','catch','index','map','rawAttributes','fieldName','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','select','field','color','from','tools_tags','ui.MailInteractionId','left_join','users','u.id\x20=\x20ui.UserId','mail_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','mail_accounts','a.id\x20=\x20i.MailAccountId','me.MailInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','conditions','value','having','Contact','$substring','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','text','start','end','Tag','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','plainBody','type','some','compact','isEmpty','MailAccountId','i.MailAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','null','\x20IS\x20NULL','\x20=\x20?','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','\x27\x27\x27\x27','isNumeric','i.id\x20LIKE\x20?','isEmail','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','order','t.id\x20IN\x20?','journey','i.MailAccountId\x20IS\x20NOT\x20NULL','user','getMailAccounts','i.MailAccountId\x20IS\x20NULL','sequelize','toString','keyBy','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgAt','i.subject','i.disposition','i.substatus','i.to','i.ContactId','i.MailAccountId','i.UserId','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','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.MailInteractionId\x20IN\x20?','groupBy'];(function(_0x3d107e,_0x303502){var _0x3f4171=function(_0x292c5c){while(--_0x292c5c){_0x3d107e['push'](_0x3d107e['shift']());}};_0x3f4171(++_0x303502);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xa9e0[_0x47a7d0];return _0xb9bd08;};'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 htmlToText=require(_0x0a9e('0xe'));var Redis=require(_0x0a9e('0xf'));var authService=require(_0x0a9e('0x10'));var qs=require(_0x0a9e('0x11'));var as=require(_0x0a9e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=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);};}function getInteractionUsers(_0x14433c,_0x140511){return new BPromise(function(_0x1538a4,_0x11c3b6){try{if(_0x140511[_0x14433c['id']]){_0x14433c[_0x0a9e('0x27')]=_['map'](_0x140511[_0x14433c['id']],function(_0x3652a7){return{'id':_0x3652a7['id'],'fullname':_0x3652a7[_0x0a9e('0x28')]};});}}catch(_0x2b1f27){_0x11c3b6(_0x2b1f27);}_0x1538a4(_0x14433c);});}function getInteractionTags(_0x2ec755,_0x5c877d){return new BPromise(function(_0x15b200,_0x40e7a3){try{if(_0x2ec755[_0x0a9e('0x29')]){_0x2ec755[_0x0a9e('0x2a')]=[];_0x2ec755[_0x0a9e('0x29')][_0x0a9e('0x2b')](',')[_0x0a9e('0x2c')](function(_0x2e8759){_0x2ec755[_0x0a9e('0x2a')]['push'](_0x5c877d[_0x2e8759]);});}delete _0x2ec755[_0x0a9e('0x29')];}catch(_0x5d1e0e){_0x40e7a3(_0x5d1e0e);}_0x15b200(_0x2ec755);});}function getLastMessageText(_0x2407f9){return new BPromise(function(_0x3ae878,_0x1122db){return db[_0x0a9e('0x2d')][_0x0a9e('0x2e')]({'where':{'id':_0x2407f9['id']},'attributes':['lastMsgBody',_0x0a9e('0x2f')],'raw':!![]})[_0x0a9e('0x22')](function(_0x40cb85){if(!_0x40cb85[_0x0a9e('0x2f')]){_0x2407f9[_0x0a9e('0x2f')]=_[_0x0a9e('0x30')](htmlToText[_0x0a9e('0x31')](_0x40cb85[_0x0a9e('0x32')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]}));}else{_0x2407f9['lastMsgText']=_0x40cb85[_0x0a9e('0x2f')];}_0x3ae878(_0x2407f9);})['catch'](function(_0x2cc7a0){_0x1122db(_0x2cc7a0);});});}function updateMailInteraction(_0x14b13f,_0x2b7e7f,_0x3f3d41,_0x567193){return new BPromise(function(_0x191e91,_0xd1836d){return getInteractionUsers(_0x14b13f,_0x3f3d41)[_0x0a9e('0x22')](function(_0x15de0e){return getInteractionTags(_0x15de0e,_0x2b7e7f);})['then'](function(_0x54135e){if(_0x567193){_0x191e91(getLastMessageText(_0x54135e));}else{_0x191e91(_0x54135e);}})[_0x0a9e('0x33')](function(_0x5640eb){_0xd1836d(_0x5640eb);});});}exports[_0x0a9e('0x34')]=function(_0x3d9717,_0x381c37){var _0x1ef87a={},_0x4f41ae={},_0x31916f={'count':0x0,'rows':[]};var _0x3bfce8=_[_0x0a9e('0x35')](db['MailInteraction'][_0x0a9e('0x36')],function(_0x1a180b){return{'name':_0x1a180b[_0x0a9e('0x37')],'type':_0x1a180b['type']['key']};});_0x4f41ae[_0x0a9e('0x38')]=_[_0x0a9e('0x35')](_0x3bfce8,'name');_0x4f41ae[_0x0a9e('0x39')]=_[_0x0a9e('0x3a')](_0x3d9717[_0x0a9e('0x39')]);_0x4f41ae[_0x0a9e('0x3b')]=_['intersection'](_0x4f41ae['model'],_0x4f41ae[_0x0a9e('0x39')]);_0x1ef87a[_0x0a9e('0x3c')]=_['intersection'](_0x4f41ae[_0x0a9e('0x38')],qs[_0x0a9e('0x3d')](_0x3d9717[_0x0a9e('0x39')]['fields']));_0x1ef87a[_0x0a9e('0x3c')]=_0x1ef87a[_0x0a9e('0x3c')][_0x0a9e('0x3e')]?_0x1ef87a[_0x0a9e('0x3c')]:_0x4f41ae[_0x0a9e('0x38')];if(!_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x3f')](_0x0a9e('0x40'))){_0x1ef87a[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x1d')]);_0x1ef87a[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x3d9717[_0x0a9e('0x39')]['offset']);}_0x1ef87a['order']=qs[_0x0a9e('0x41')](_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x41')]);_0x1ef87a[_0x0a9e('0x42')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x43')](_0x3d9717[_0x0a9e('0x39')],_0x4f41ae[_0x0a9e('0x3b')]),_0x3bfce8);var _0x432fcc=[];var _0x25c6e6=squel[_0x0a9e('0x44')]()[_0x0a9e('0x45')]('id')['field'](_0x0a9e('0x25'))[_0x0a9e('0x45')](_0x0a9e('0x46'))[_0x0a9e('0x47')](_0x0a9e('0x48'));var _0xbe9d19=squel[_0x0a9e('0x44')]()[_0x0a9e('0x45')]('u.id')[_0x0a9e('0x45')]('u.fullname')[_0x0a9e('0x45')](_0x0a9e('0x49'))[_0x0a9e('0x47')]('user_has_mail_interactions','ui')[_0x0a9e('0x4a')](_0x0a9e('0x4b'),'u',_0x0a9e('0x4c'));var _0x34aa5a=squel[_0x0a9e('0x44')]()[_0x0a9e('0x47')](_0x0a9e('0x4d'),'i')['left_join'](_0x0a9e('0x4e'),'c',_0x0a9e('0x4f'))[_0x0a9e('0x4a')](_0x0a9e('0x4b'),'o',_0x0a9e('0x50'))[_0x0a9e('0x4a')](_0x0a9e('0x51'),'a',_0x0a9e('0x52'))[_0x0a9e('0x4a')]('mail_messages','me',_0x0a9e('0x53'))[_0x0a9e('0x4a')]('mail_interaction_has_tags','it','it.MailInteractionId\x20=\x20i.id')['left_join'](_0x0a9e('0x48'),'t',_0x0a9e('0x54'));var _0x37edaa=squel[_0x0a9e('0x55')]();var _0x61bb17=[];var _0x30decb=squel[_0x0a9e('0x55')]();var _0x375c18;if(_0x3d9717['query']['search']){_0x375c18=as['parseSearch'](_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x56')]);var _0x14d602=_0x375c18['sqlOperator'];for(var _0x2b69d9=0x0;_0x2b69d9<_0x375c18[_0x0a9e('0x57')]['length'];_0x2b69d9++){var _0x5a88da=_0x375c18[_0x0a9e('0x57')][_0x2b69d9];var _0x59c6ff='i';var _0x443e72=_['find'](_0x3bfce8,[_0x0a9e('0x25'),_0x5a88da[_0x0a9e('0x45')]]);if(!_0x443e72){switch(_0x5a88da[_0x0a9e('0x45')]){case'unreadMessages':if(_0x5a88da[_0x0a9e('0x58')]==0x1){_0x34aa5a[_0x0a9e('0x59')]('`'+_0x5a88da['field']+'`\x20=\x200');}else{_0x34aa5a[_0x0a9e('0x59')]('`'+_0x5a88da[_0x0a9e('0x45')]+'`\x20>\x200');}break;case _0x0a9e('0x5a'):if(_0x5a88da['operator']===_0x0a9e('0x5b')){if(_0x5a88da['value'][_0x0a9e('0x2b')]('\x20')['length']>0x1){_0x37edaa[_0x14d602]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x5a88da[_0x0a9e('0x58')]),null);}else{var _0x47de4c='%'+_0x5a88da[_0x0a9e('0x58')]+'%';_0x37edaa[_0x14d602](_0x0a9e('0x5c'),_0x47de4c,_0x47de4c,_0x47de4c);}}else{_0x443e72=_[_0x0a9e('0x5d')](_0x3bfce8,[_0x0a9e('0x25'),_0x0a9e('0x5e')]);_0x5a88da[_0x0a9e('0x45')]=_0x0a9e('0x5e');_0x797b45=as[_0x0a9e('0x5f')](_0x59c6ff,_0x443e72['type'],_0x5a88da);_0x37edaa[_0x14d602](_0x797b45[_0x0a9e('0x60')],_0x797b45[_0x0a9e('0x58')][_0x0a9e('0x61')],_0x797b45[_0x0a9e('0x58')][_0x0a9e('0x62')]);}break;case _0x0a9e('0x63'):var _0x5d86e9=_0x5a88da[_0x0a9e('0x58')][_0x0a9e('0x2b')](',')['map'](function(_0x3649cc){return Number(_0x3649cc);});_0x5d86e9['forEach'](function(_0x20c668){_0x30decb['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x20c668+',%');});_0x61bb17=_['union'](_0x61bb17,_0x5d86e9);break;case'User':if(_0x5a88da[_0x0a9e('0x64')]==='$substring'){_0x37edaa[_0x14d602](_0x0a9e('0x65'),'%'+_0x5a88da[_0x0a9e('0x58')]+'%',null);}else{_0x443e72=_[_0x0a9e('0x5d')](_0x3bfce8,[_0x0a9e('0x25'),_0x0a9e('0x66')]);_0x5a88da[_0x0a9e('0x45')]='UserId';_0x797b45=as[_0x0a9e('0x5f')](_0x59c6ff,_0x443e72['type'],_0x5a88da);_0x37edaa[_0x14d602](_0x797b45[_0x0a9e('0x60')],_0x797b45[_0x0a9e('0x58')][_0x0a9e('0x61')],_0x797b45['value'][_0x0a9e('0x62')]);}break;case _0x0a9e('0x67'):_0x797b45=as[_0x0a9e('0x5f')]('me',null,_0x5a88da);_0x37edaa[_0x14d602](_0x797b45[_0x0a9e('0x60')],_0x797b45['value'][_0x0a9e('0x61')],_0x797b45[_0x0a9e('0x58')]['end']);break;}}else{var _0x797b45=as[_0x0a9e('0x5f')](_0x59c6ff,_0x443e72[_0x0a9e('0x68')],_0x5a88da);_0x37edaa[_0x14d602](_0x797b45[_0x0a9e('0x60')],_0x797b45[_0x0a9e('0x58')]['start'],_0x797b45[_0x0a9e('0x58')][_0x0a9e('0x62')]);}}}else{var _0x281c7d=_(_0x3d9717['query'])[_0x0a9e('0x3a')]()['map'](function(_0x5211e3){return _[_0x0a9e('0x69')](_0x3bfce8,[_0x0a9e('0x25'),_0x5211e3])?_0x5211e3:undefined;})[_0x0a9e('0x6a')]()[_0x0a9e('0x58')]();if(!_[_0x0a9e('0x6b')](_0x281c7d)){_0x281c7d[_0x0a9e('0x2c')](function(_0x387489){if(_0x387489===_0x0a9e('0x6c')){_0x34aa5a[_0x0a9e('0x42')](_0x0a9e('0x6d'),[][_0x0a9e('0x6e')](_0x3d9717[_0x0a9e('0x39')][_0x387489]));}else if(_0x387489===_0x0a9e('0x6f')){var _0x2b8192=JSON[_0x0a9e('0x70')](_0x3d9717[_0x0a9e('0x39')][_0x387489])[_0x0a9e('0x71')];var _0x4257c9=JSON['parse'](_0x3d9717[_0x0a9e('0x39')][_0x387489])[_0x0a9e('0x72')];_0x34aa5a[_0x0a9e('0x42')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x2b8192,_0x4257c9);}else{if(_0x3d9717[_0x0a9e('0x39')][_0x387489]===_0x0a9e('0x73')){_0x34aa5a['where']('i.'+_0x387489+_0x0a9e('0x74'));}else{_0x34aa5a[_0x0a9e('0x42')]('i.'+_0x387489+_0x0a9e('0x75'),_0x3d9717[_0x0a9e('0x39')][_0x387489]);}}});}if(_0x3d9717[_0x0a9e('0x39')]['read']){if(_0x3d9717['query']['read']==0x1){_0x34aa5a[_0x0a9e('0x59')](_0x0a9e('0x76'));}else{_0x34aa5a[_0x0a9e('0x59')](_0x0a9e('0x77'));}}if(_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x78')]){_0x61bb17=_[_0x0a9e('0x79')](_0x3d9717[_0x0a9e('0x39')]['tag'])?_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x78')]:new Array(_0x3d9717[_0x0a9e('0x39')]['tag']);_0x61bb17[_0x0a9e('0x2c')](function(_0x583b2e){_0x30decb['or'](_0x0a9e('0x7a'),'%,'+_0x583b2e+',%');});}if(_0x3d9717[_0x0a9e('0x39')]['filter']){var _0x2ed01e=_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x7b')][_0x0a9e('0x7c')]('\x5c','\x5c\x5c')['replace']('\x27\x27',_0x0a9e('0x7d'));if(qs[_0x0a9e('0x7e')](_0x2ed01e)){_0x37edaa['or'](_0x0a9e('0x7f'),_0x2ed01e+'%');}else if(qs[_0x0a9e('0x80')](_0x2ed01e)){_0x37edaa['or']('c.email\x20LIKE\x20?',_0x2ed01e+'%');}else{_0x37edaa['or'](_0x0a9e('0x81'),qs[_0x0a9e('0x82')](_0x2ed01e))['or'](_0x0a9e('0x83'),qs[_0x0a9e('0x82')](_0x2ed01e));}}}_0x34aa5a['where'](_0x37edaa);_0x34aa5a[_0x0a9e('0x84')](_0x0a9e('0x85'));var _0x30a4c7={'type':db[_0x0a9e('0x86')][_0x0a9e('0x87')][_0x0a9e('0x88')],'raw':!![]};var _0x40fc56=_0x34aa5a[_0x0a9e('0x89')]();_0x40fc56[_0x0a9e('0x45')](_0x0a9e('0x85'));_0x40fc56[_0x0a9e('0x45')](_0x0a9e('0x8a'),_0x0a9e('0x8b'));if(_0x1ef87a[_0x0a9e('0x8c')]){_0x1ef87a['order'][_0x0a9e('0x2c')](function(_0x11da9c){_0x34aa5a[_0x0a9e('0x8c')]('i.'+_0x11da9c[0x0],_0x11da9c[0x1]==='DESC'?![]:!![]);});}if(!_[_0x0a9e('0x6b')](_0x61bb17)){_0x34aa5a[_0x0a9e('0x59')](_0x30decb);_0x40fc56[_0x0a9e('0x42')](_0x0a9e('0x8d'),_0x61bb17);}BPromise['resolve']()['then'](function(){if(!_0x375c18){if(_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x6c')]||_0x3d9717['query'][_0x0a9e('0x8e')])return;_0x40fc56['where'](_0x0a9e('0x8f'));_0x34aa5a[_0x0a9e('0x42')]('i.MailAccountId\x20IS\x20NOT\x20NULL');return;}return _0x3d9717[_0x0a9e('0x90')][_0x0a9e('0x91')]({'attributes':['id'],'raw':!![]})[_0x0a9e('0x22')](function(_0x42b959){if(_[_0x0a9e('0x6b')](_0x42b959)){_0x40fc56[_0x0a9e('0x42')](_0x0a9e('0x92'));_0x34aa5a['where'](_0x0a9e('0x92'));}else{_0x40fc56[_0x0a9e('0x42')](_0x0a9e('0x6d'),_[_0x0a9e('0x35')](_0x42b959,'id'));_0x34aa5a['where'](_0x0a9e('0x6d'),_[_0x0a9e('0x35')](_0x42b959,'id'));}});})['then'](function(){db[_0x0a9e('0x93')]['query'](_0x40fc56[_0x0a9e('0x94')](),_0x30a4c7)[_0x0a9e('0x22')](function(_0x3003eb){_0x31916f[_0x0a9e('0x1b')]=_0x3003eb['length'];if(_0x31916f['count']===0x0)return[];return db[_0x0a9e('0x93')][_0x0a9e('0x39')](_0x25c6e6[_0x0a9e('0x94')](),_0x30a4c7)['then'](function(_0x3b4a9f){_0x432fcc=_[_0x0a9e('0x95')](_0x3b4a9f,'id');_0x30a4c7=_['merge'](_0x30a4c7,{'model':db['MailInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3d9717[_0x0a9e('0x39')]['fields']){_0x1ef87a['attributes']['forEach'](function(_0x81d748){_0x34aa5a[_0x0a9e('0x45')]('i.'+_0x81d748);});}else{_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x8a'),_0x0a9e('0x8b'));_0x34aa5a[_0x0a9e('0x45')]('a.key',_0x0a9e('0x96'));_0x34aa5a['field'](_0x0a9e('0x97'),_0x0a9e('0x98'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x85'));_0x34aa5a['field'](_0x0a9e('0x99'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x9a'));_0x34aa5a['field'](_0x0a9e('0x9b'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x9c'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x9d'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x9e'));_0x34aa5a[_0x0a9e('0x45')]('i.lastMsgDirection');_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x9f'));_0x34aa5a['field'](_0x0a9e('0xa0'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xa1'));_0x34aa5a['field'](_0x0a9e('0xa2'));_0x34aa5a['field'](_0x0a9e('0xa3'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xa4'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xa5'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xa6'),_0x0a9e('0xa7'));_0x34aa5a['field'](_0x0a9e('0xa8'),_0x0a9e('0xa9'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xaa'),_0x0a9e('0xab'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xac'),_0x0a9e('0xad'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xae'),_0x0a9e('0xaf'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xb0'),'Contact.fax');_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xb1'),_0x0a9e('0xb2'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xb3'),'Owner.internal');_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xb4'),'TagIds');}if(_0x1ef87a[_0x0a9e('0x1d')])_0x34aa5a['limit'](_0x1ef87a[_0x0a9e('0x1d')]);if(_0x1ef87a[_0x0a9e('0x1c')])_0x34aa5a[_0x0a9e('0x1c')](_0x1ef87a[_0x0a9e('0x1c')]);return db['sequelize'][_0x0a9e('0x39')](_0x34aa5a['toString'](),_0x30a4c7);})[_0x0a9e('0x22')](function(_0x3d0a77){_0xbe9d19['where'](_0x0a9e('0xb5'),_[_0x0a9e('0x35')](_0x3d0a77,'id'));return db[_0x0a9e('0x93')]['query'](_0xbe9d19['toString'](),_0x30a4c7)[_0x0a9e('0x22')](function(_0x6ba2be){var _0x1707dc=_[_0x0a9e('0xb6')](_0x6ba2be,_0x0a9e('0xb7'));var _0x2450a8=[];return db[_0x0a9e('0xb8')][_0x0a9e('0x2e')]({'attributes':[_0x0a9e('0xb9')],'raw':!![]})['then'](function(_0x3156c7){var _0x517081=_0x3156c7[_0x0a9e('0xb9')];_0x3d0a77[_0x0a9e('0x2c')](function(_0x34e745){_0x2450a8[_0x0a9e('0xba')](updateMailInteraction(_0x34e745,_0x432fcc,_0x1707dc,_0x517081));});return BPromise[_0x0a9e('0xbb')](_0x2450a8);});});});})['then'](function(_0x436313){_0x31916f[_0x0a9e('0xbc')]=_0x436313;return _0x31916f;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x381c37,_0x1ef87a));})[_0x0a9e('0x33')](handleError(_0x381c37,null));};exports[_0x0a9e('0xbd')]=function(_0x5c66ef,_0x4f074c){var _0x22a3cb={'raw':![],'where':{'id':_0x5c66ef[_0x0a9e('0xbe')]['id']}},_0x583662={};_0x583662[_0x0a9e('0x38')]=_[_0x0a9e('0x3a')](db[_0x0a9e('0x2d')][_0x0a9e('0x36')]);_0x583662[_0x0a9e('0x39')]=_['keys'](_0x5c66ef['query']);_0x583662[_0x0a9e('0x3b')]=_['intersection'](_0x583662[_0x0a9e('0x38')],_0x583662['query']);_0x22a3cb[_0x0a9e('0x3c')]=_['intersection'](_0x583662['model'],qs[_0x0a9e('0x3d')](_0x5c66ef[_0x0a9e('0x39')]['fields']));_0x22a3cb[_0x0a9e('0x3c')]=_0x22a3cb[_0x0a9e('0x3c')][_0x0a9e('0x3e')]?_0x22a3cb[_0x0a9e('0x3c')]:_0x583662[_0x0a9e('0x38')];if(_0x5c66ef['query']['includeAll']){_0x22a3cb[_0x0a9e('0xbf')]=[{'all':!![]}];}_0x22a3cb=_[_0x0a9e('0xc0')]({},_0x22a3cb,_0x5c66ef[_0x0a9e('0xc1')]);return db[_0x0a9e('0x2d')][_0x0a9e('0x5d')](_0x22a3cb)['then'](handleEntityNotFound(_0x4f074c,null))[_0x0a9e('0x22')](respondWithResult(_0x4f074c,null))[_0x0a9e('0x33')](handleError(_0x4f074c,null));};exports['create']=function(_0x3c313d,_0x19fd11){return db[_0x0a9e('0x2d')][_0x0a9e('0xc2')](_0x3c313d[_0x0a9e('0xc3')],{})[_0x0a9e('0x22')](respondWithResult(_0x19fd11,0xc9))[_0x0a9e('0x33')](handleError(_0x19fd11,null));};exports[_0x0a9e('0x20')]=function(_0x40dd2a,_0x16afb3){if(_0x40dd2a['body']['id']){delete _0x40dd2a[_0x0a9e('0xc3')]['id'];}return db[_0x0a9e('0x2d')][_0x0a9e('0x5d')]({'where':{'id':_0x40dd2a[_0x0a9e('0xbe')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x16afb3,null))['then'](saveUpdates(_0x40dd2a['body'],null))[_0x0a9e('0x22')](respondWithResult(_0x16afb3,null))[_0x0a9e('0x33')](handleError(_0x16afb3,null));};exports[_0x0a9e('0x21')]=function(_0x2fea95,_0x34f7b5){return db['MailInteraction'][_0x0a9e('0x5d')]({'where':{'id':_0x2fea95[_0x0a9e('0xbe')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x34f7b5,null))['then'](removeEntity(_0x34f7b5,null))[_0x0a9e('0x33')](handleError(_0x34f7b5,null));};exports['describe']=function(_0x2144ca,_0x4799d4){return db[_0x0a9e('0x2d')][_0x0a9e('0xc4')]()[_0x0a9e('0x22')](respondWithResult(_0x4799d4,null))['catch'](handleError(_0x4799d4,null));};exports[_0x0a9e('0xc5')]=function(_0x5ed560,_0x4383da,_0x2b1824){return db[_0x0a9e('0xc6')][_0x0a9e('0x5d')]({'where':{'id':_0x5ed560[_0x0a9e('0xbe')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4383da,null))[_0x0a9e('0x22')](function(_0xe89aaa){if(_0xe89aaa){return _0xe89aaa[_0x0a9e('0xc5')](_0x5ed560[_0x0a9e('0xc3')][_0x0a9e('0xc7')],_[_0x0a9e('0xc8')](_0x5ed560[_0x0a9e('0xc3')],[_0x0a9e('0xc7'),'id'])||{});}})[_0x0a9e('0x22')](respondWithResult(_0x4383da,null))[_0x0a9e('0x33')](handleError(_0x4383da,null));};exports['getMessages']=function(_0x556443,_0x6eaaf0,_0x5c4be0){var _0x1d999b={'raw':![],'where':{}};var _0x3428c9={};var _0x5d6b69={'count':0x0,'rows':[]};return db[_0x0a9e('0x2d')][_0x0a9e('0x2e')]({'where':{'id':_0x556443[_0x0a9e('0xbe')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x6eaaf0,null))['then'](function(_0x148fd9){if(_0x148fd9){_0x3428c9[_0x0a9e('0x38')]=_[_0x0a9e('0x3a')](db[_0x0a9e('0xc6')]['rawAttributes']);_0x3428c9[_0x0a9e('0x39')]=_[_0x0a9e('0x3a')](_0x556443[_0x0a9e('0x39')]);_0x3428c9['filters']=_[_0x0a9e('0xc9')](_0x3428c9[_0x0a9e('0x38')],_0x3428c9[_0x0a9e('0x39')]);_0x1d999b['attributes']=_[_0x0a9e('0xc9')](_0x3428c9[_0x0a9e('0x38')],qs[_0x0a9e('0x3d')](_0x556443[_0x0a9e('0x39')][_0x0a9e('0x3d')]));_0x1d999b['attributes']=_0x1d999b[_0x0a9e('0x3c')][_0x0a9e('0x3e')]?_0x1d999b['attributes']:_0x3428c9[_0x0a9e('0x38')];if(!_0x556443[_0x0a9e('0x39')][_0x0a9e('0x3f')]('nolimit')){_0x1d999b['limit']=qs['limit'](_0x556443[_0x0a9e('0x39')][_0x0a9e('0x1d')]);_0x1d999b['offset']=qs[_0x0a9e('0x1c')](_0x556443[_0x0a9e('0x39')][_0x0a9e('0x1c')]);}_0x1d999b['order']=qs[_0x0a9e('0x41')](_0x556443[_0x0a9e('0x39')][_0x0a9e('0x41')]);_0x1d999b[_0x0a9e('0x42')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x43')](_0x556443[_0x0a9e('0x39')],_0x3428c9[_0x0a9e('0x3b')]));_0x1d999b[_0x0a9e('0x42')]['MailInteractionId']=_0x148fd9['id'];if(_0x556443[_0x0a9e('0x39')]['filter']){_0x1d999b[_0x0a9e('0x42')]=_[_0x0a9e('0xc0')](_0x1d999b[_0x0a9e('0x42')],{'$or':_[_0x0a9e('0x35')](_0x1d999b[_0x0a9e('0x3c')],function(_0x344cd4){var _0x53d9fc={};_0x53d9fc[_0x344cd4]={'$like':'%'+_0x556443[_0x0a9e('0x39')][_0x0a9e('0x7b')]+'%'};return _0x53d9fc;})});}if(_0x556443[_0x0a9e('0x39')][_0x0a9e('0x71')]){var _0x51aa2f=_0x556443[_0x0a9e('0x39')][_0x0a9e('0x71')][_0x0a9e('0x2b')](',');var _0x1c9539={};_0x1c9539[_0x51aa2f[0x0]]={'$gte':moment(_0x51aa2f[0x1])[_0x0a9e('0xca')](_0x0a9e('0xcb'))};_0x1d999b[_0x0a9e('0x42')]=_[_0x0a9e('0xc0')](_0x1d999b[_0x0a9e('0x42')],_0x1c9539);}_0x1d999b=_[_0x0a9e('0xc0')]({},_0x1d999b,_0x556443['options']);return db[_0x0a9e('0xc6')][_0x0a9e('0x1b')]({'where':_0x1d999b[_0x0a9e('0x42')]})[_0x0a9e('0x22')](function(_0xea8bd1){_0x5d6b69[_0x0a9e('0x1b')]=_0xea8bd1;if(_0x556443[_0x0a9e('0x39')][_0x0a9e('0xcc')]){_0x1d999b['include']=[{'all':!![]}];}return db[_0x0a9e('0xc6')][_0x0a9e('0xcd')](_0x1d999b);})[_0x0a9e('0x22')](function(_0x5c65fc){_0x5d6b69[_0x0a9e('0xbc')]=_0x5c65fc;return _0x5d6b69;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x6eaaf0,_0x1d999b))[_0x0a9e('0x33')](handleError(_0x6eaaf0,null));};exports[_0x0a9e('0xce')]=function(_0x370b5e,_0x1ba457,_0x424f1b){return db[_0x0a9e('0x2d')][_0x0a9e('0x5d')]({'where':{'id':_0x370b5e[_0x0a9e('0xbe')]['id']}})['then'](handleEntityNotFound(_0x1ba457,null))[_0x0a9e('0x22')](function(_0x446e6){if(_0x446e6){return _0x446e6[_0x0a9e('0xcf')](_0x370b5e[_0x0a9e('0xc3')][_0x0a9e('0xc7')],_[_0x0a9e('0xc8')](_0x370b5e['body'],[_0x0a9e('0xc7'),'id'])||{})['spread'](function(){return db['Tag']['findAll']({'attributes':['id',_0x0a9e('0x25'),_0x0a9e('0x46')],'where':{'id':_0x370b5e[_0x0a9e('0xc3')][_0x0a9e('0xc7')]}});})['then'](function(_0x4156a5){socket[_0x0a9e('0xd0')](_0x0a9e('0xd1'),{'id':Number(_0x370b5e[_0x0a9e('0xbe')]['id']),'tags':_0x4156a5||[]});return{'id':Number(_0x370b5e[_0x0a9e('0xbe')]['id']),'tags':_0x4156a5||[]};});}})['then'](respondWithResult(_0x1ba457,null))['catch'](handleError(_0x1ba457,null));};exports[_0x0a9e('0xd2')]=function(_0x33bcb2,_0x2a293f,_0x5e85d0){return db[_0x0a9e('0x2d')][_0x0a9e('0x5d')]({'where':{'id':_0x33bcb2[_0x0a9e('0xbe')]['id']}})['then'](handleEntityNotFound(_0x2a293f,null))[_0x0a9e('0x22')](function(_0x2bf85d){if(_0x2bf85d){return _0x2bf85d[_0x0a9e('0xd2')](_0x33bcb2['query'][_0x0a9e('0xc7')]);}})[_0x0a9e('0x22')](respondWithStatusCode(_0x2a293f,null))[_0x0a9e('0x33')](handleError(_0x2a293f,null));};exports['download']=function(_0x549697,_0x53ef46){var _0x3b04fd=moment()[_0x0a9e('0xd3')]()[_0x0a9e('0x94')]();var _0x26931c=path['join'](config[_0x0a9e('0xd4')],'server',_0x0a9e('0xd5'),_0x0a9e('0xd6'));var _0x242f23=path['join'](config[_0x0a9e('0xd4')],_0x0a9e('0xd7'),_0x0a9e('0xd5'),'attachments');var _0x40eb5d=path['join'](_0x26931c,_0x3b04fd);var _0x1b637c=util['format'](_0x0a9e('0xd8'),_0x549697['params']['id'],_0x3b04fd);var _0xb14971=path[_0x0a9e('0xd9')](_0x26931c,_0x1b637c);var _0xa288e4=[];if(_0x549697[_0x0a9e('0x39')][_0x0a9e('0xda')]){_0xa288e4[_0x0a9e('0xba')]({'model':db[_0x0a9e('0xdb')],'as':'Attachments','raw':!![]});}var _0x35ace3=[{'model':db[_0x0a9e('0xc6')],'as':'Messages','attributes':['id',_0x0a9e('0xc3'),_0x0a9e('0x47'),'to','cc','bcc',_0x0a9e('0xdc'),_0x0a9e('0x6f')],'where':{'secret':![]},'order':qs[_0x0a9e('0x41')]('id'),'include':_0xa288e4}];return db['MailInteraction'][_0x0a9e('0x5d')]({'where':{'id':_0x549697[_0x0a9e('0xbe')]['id']},'include':_0x35ace3})[_0x0a9e('0x22')](handleEntityNotFound(_0x53ef46,null))[_0x0a9e('0x22')](function(_0x2003bc){if(_0x2003bc&&_0x2003bc[_0x0a9e('0xdd')]){var _0x3ba897=_0x2003bc[_0x0a9e('0xde')]({'plain':!![]});fs[_0x0a9e('0xdf')](_0x40eb5d);return BPromise[_0x0a9e('0xe0')](_0x3ba897['Messages'],function(_0x1799d8,_0x53c7de){var _0x3c9854={'from':_0x1799d8[_0x0a9e('0x47')],'to':_0x1799d8['to'],'subject':_0x1799d8[_0x0a9e('0xdc')],'html':_0x1799d8[_0x0a9e('0xc3')],'headers':{'Date':moment(_0x1799d8[_0x0a9e('0x6f')])[_0x0a9e('0xca')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x1799d8['cc']){_0x3c9854[_0x0a9e('0xe1')]['Cc']=_0x1799d8['cc'];}if(_0x1799d8[_0x0a9e('0xe2')]){_0x3c9854[_0x0a9e('0xe1')]['Bcc']=_0x1799d8[_0x0a9e('0xe2')];}return new BPromise(function(_0x402544,_0x4435d2){if(_0x1799d8[_0x0a9e('0xe3')]){for(var _0x31e1e0=0x0;_0x31e1e0<_0x1799d8[_0x0a9e('0xe3')][_0x0a9e('0x3e')];_0x31e1e0++){var _0x5f2c51=_0x1799d8[_0x0a9e('0xe3')][_0x31e1e0];var _0x228c10=path[_0x0a9e('0xd9')](_0x242f23,_0x5f2c51[_0x0a9e('0xe4')]);if(fs[_0x0a9e('0xe5')](_0x228c10)){_0x3c9854[_0x0a9e('0xda')][_0x0a9e('0xba')]({'name':_0x5f2c51['name'],'contentType':_0x5f2c51['type'],'data':fs[_0x0a9e('0xe6')](_0x228c10)});}}}emlformat[_0x0a9e('0xe7')](_0x3c9854,function(_0x1f4929,_0x1bf692){if(_0x1f4929)return _0x4435d2(_0x1f4929);fs[_0x0a9e('0xe8')](path[_0x0a9e('0xd9')](_0x40eb5d,util[_0x0a9e('0xca')]('message%d.eml',_0x53c7de)),_0x1bf692);return _0x402544(_0x1bf692);});});})[_0x0a9e('0x22')](function(){return new BPromise(function(_0x1d7fc4,_0x2d8e91){zipdir(_0x40eb5d,{'saveTo':_0xb14971},function(_0x2675a5,_0x1b1757){if(_0x2675a5)return _0x2d8e91(_0x2675a5);return _0x1d7fc4(_0x1b1757);});})[_0x0a9e('0x22')](function(){return new BPromise(function(_0x16be7e,_0x54f0b8){rimraf(_0x40eb5d,function(_0x311288){if(_0x311288)_0x54f0b8(_0x311288);return _0x16be7e();});});})[_0x0a9e('0x22')](function(){return _0x53ef46[_0x0a9e('0xe9')](_0xb14971,_0x1b637c,function(_0x5885c3){if(_0x5885c3){console[_0x0a9e('0xea')](_0x0a9e('0xeb'),_0x5885c3);}else{fs[_0x0a9e('0xec')](_0xb14971);}});});});}else{return _0x53ef46[_0x0a9e('0x23')](0xc8);}})['catch'](handleError(_0x53ef46,null));}; \ No newline at end of file +var _0xa9e0=['MailInteractionId','Setting','enableEmailPreview','push','all','rows','show','params','include','merge','options','create','body','describe','addMessage','MailMessage','ids','omit','intersection','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','findAll','addTags','setTags','emit','mailInteractionTags:save','removeTags','unix','root','files','tmp','server','transcript-%d-%s.zip','join','attachments','Attachment','subject','Messages','get','mkdirSync','each','headers','bcc','Attachments','basename','existsSync','readFileSync','build','writeFileSync','download','log','err','unlinkSync','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','html-to-text','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../mysqldb','redis','defaults','localhost','./mailInteraction.socket','register','status','count','offset','limit','set','Content-Range','update','destroy','then','sendStatus','stack','name','send','Users','fullname','TagIds','Tags','split','forEach','MailInteraction','findOne','lastMsgText','trimStart','fromString','lastMsgBody','catch','index','map','rawAttributes','fieldName','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','select','field','color','from','tools_tags','ui.MailInteractionId','left_join','users','u.id\x20=\x20ui.UserId','mail_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','mail_accounts','a.id\x20=\x20i.MailAccountId','me.MailInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','conditions','value','having','Contact','$substring','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','text','start','end','Tag','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','plainBody','type','some','compact','isEmpty','MailAccountId','i.MailAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','null','\x20IS\x20NULL','\x20=\x20?','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','\x27\x27\x27\x27','isNumeric','i.id\x20LIKE\x20?','isEmail','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','order','t.id\x20IN\x20?','journey','i.MailAccountId\x20IS\x20NOT\x20NULL','user','getMailAccounts','i.MailAccountId\x20IS\x20NULL','sequelize','toString','keyBy','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgAt','i.subject','i.disposition','i.substatus','i.to','i.ContactId','i.MailAccountId','i.UserId','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','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.MailInteractionId\x20IN\x20?','groupBy'];(function(_0x27dff7,_0x166a28){var _0x17228c=function(_0x2ed2de){while(--_0x2ed2de){_0x27dff7['push'](_0x27dff7['shift']());}};_0x17228c(++_0x166a28);}(_0xa9e0,0x123));var _0x0a9e=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xa9e0[_0x45e98e];return _0x374dba;};'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 htmlToText=require(_0x0a9e('0xe'));var Redis=require(_0x0a9e('0xf'));var authService=require(_0x0a9e('0x10'));var qs=require(_0x0a9e('0x11'));var as=require(_0x0a9e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=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);};}function getInteractionUsers(_0x14433c,_0x140511){return new BPromise(function(_0x1538a4,_0x11c3b6){try{if(_0x140511[_0x14433c['id']]){_0x14433c[_0x0a9e('0x27')]=_['map'](_0x140511[_0x14433c['id']],function(_0x3652a7){return{'id':_0x3652a7['id'],'fullname':_0x3652a7[_0x0a9e('0x28')]};});}}catch(_0x2b1f27){_0x11c3b6(_0x2b1f27);}_0x1538a4(_0x14433c);});}function getInteractionTags(_0x2ec755,_0x5c877d){return new BPromise(function(_0x15b200,_0x40e7a3){try{if(_0x2ec755[_0x0a9e('0x29')]){_0x2ec755[_0x0a9e('0x2a')]=[];_0x2ec755[_0x0a9e('0x29')][_0x0a9e('0x2b')](',')[_0x0a9e('0x2c')](function(_0x2e8759){_0x2ec755[_0x0a9e('0x2a')]['push'](_0x5c877d[_0x2e8759]);});}delete _0x2ec755[_0x0a9e('0x29')];}catch(_0x5d1e0e){_0x40e7a3(_0x5d1e0e);}_0x15b200(_0x2ec755);});}function getLastMessageText(_0x2407f9){return new BPromise(function(_0x3ae878,_0x1122db){return db[_0x0a9e('0x2d')][_0x0a9e('0x2e')]({'where':{'id':_0x2407f9['id']},'attributes':['lastMsgBody',_0x0a9e('0x2f')],'raw':!![]})[_0x0a9e('0x22')](function(_0x40cb85){if(!_0x40cb85[_0x0a9e('0x2f')]){_0x2407f9[_0x0a9e('0x2f')]=_[_0x0a9e('0x30')](htmlToText[_0x0a9e('0x31')](_0x40cb85[_0x0a9e('0x32')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]}));}else{_0x2407f9['lastMsgText']=_0x40cb85[_0x0a9e('0x2f')];}_0x3ae878(_0x2407f9);})['catch'](function(_0x2cc7a0){_0x1122db(_0x2cc7a0);});});}function updateMailInteraction(_0x14b13f,_0x2b7e7f,_0x3f3d41,_0x567193){return new BPromise(function(_0x191e91,_0xd1836d){return getInteractionUsers(_0x14b13f,_0x3f3d41)[_0x0a9e('0x22')](function(_0x15de0e){return getInteractionTags(_0x15de0e,_0x2b7e7f);})['then'](function(_0x54135e){if(_0x567193){_0x191e91(getLastMessageText(_0x54135e));}else{_0x191e91(_0x54135e);}})[_0x0a9e('0x33')](function(_0x5640eb){_0xd1836d(_0x5640eb);});});}exports[_0x0a9e('0x34')]=function(_0x3d9717,_0x381c37){var _0x1ef87a={},_0x4f41ae={},_0x31916f={'count':0x0,'rows':[]};var _0x3bfce8=_[_0x0a9e('0x35')](db['MailInteraction'][_0x0a9e('0x36')],function(_0x1a180b){return{'name':_0x1a180b[_0x0a9e('0x37')],'type':_0x1a180b['type']['key']};});_0x4f41ae[_0x0a9e('0x38')]=_[_0x0a9e('0x35')](_0x3bfce8,'name');_0x4f41ae[_0x0a9e('0x39')]=_[_0x0a9e('0x3a')](_0x3d9717[_0x0a9e('0x39')]);_0x4f41ae[_0x0a9e('0x3b')]=_['intersection'](_0x4f41ae['model'],_0x4f41ae[_0x0a9e('0x39')]);_0x1ef87a[_0x0a9e('0x3c')]=_['intersection'](_0x4f41ae[_0x0a9e('0x38')],qs[_0x0a9e('0x3d')](_0x3d9717[_0x0a9e('0x39')]['fields']));_0x1ef87a[_0x0a9e('0x3c')]=_0x1ef87a[_0x0a9e('0x3c')][_0x0a9e('0x3e')]?_0x1ef87a[_0x0a9e('0x3c')]:_0x4f41ae[_0x0a9e('0x38')];if(!_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x3f')](_0x0a9e('0x40'))){_0x1ef87a[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x1d')]);_0x1ef87a[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x3d9717[_0x0a9e('0x39')]['offset']);}_0x1ef87a['order']=qs[_0x0a9e('0x41')](_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x41')]);_0x1ef87a[_0x0a9e('0x42')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x43')](_0x3d9717[_0x0a9e('0x39')],_0x4f41ae[_0x0a9e('0x3b')]),_0x3bfce8);var _0x432fcc=[];var _0x25c6e6=squel[_0x0a9e('0x44')]()[_0x0a9e('0x45')]('id')['field'](_0x0a9e('0x25'))[_0x0a9e('0x45')](_0x0a9e('0x46'))[_0x0a9e('0x47')](_0x0a9e('0x48'));var _0xbe9d19=squel[_0x0a9e('0x44')]()[_0x0a9e('0x45')]('u.id')[_0x0a9e('0x45')]('u.fullname')[_0x0a9e('0x45')](_0x0a9e('0x49'))[_0x0a9e('0x47')]('user_has_mail_interactions','ui')[_0x0a9e('0x4a')](_0x0a9e('0x4b'),'u',_0x0a9e('0x4c'));var _0x34aa5a=squel[_0x0a9e('0x44')]()[_0x0a9e('0x47')](_0x0a9e('0x4d'),'i')['left_join'](_0x0a9e('0x4e'),'c',_0x0a9e('0x4f'))[_0x0a9e('0x4a')](_0x0a9e('0x4b'),'o',_0x0a9e('0x50'))[_0x0a9e('0x4a')](_0x0a9e('0x51'),'a',_0x0a9e('0x52'))[_0x0a9e('0x4a')]('mail_messages','me',_0x0a9e('0x53'))[_0x0a9e('0x4a')]('mail_interaction_has_tags','it','it.MailInteractionId\x20=\x20i.id')['left_join'](_0x0a9e('0x48'),'t',_0x0a9e('0x54'));var _0x37edaa=squel[_0x0a9e('0x55')]();var _0x61bb17=[];var _0x30decb=squel[_0x0a9e('0x55')]();var _0x375c18;if(_0x3d9717['query']['search']){_0x375c18=as['parseSearch'](_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x56')]);var _0x14d602=_0x375c18['sqlOperator'];for(var _0x2b69d9=0x0;_0x2b69d9<_0x375c18[_0x0a9e('0x57')]['length'];_0x2b69d9++){var _0x5a88da=_0x375c18[_0x0a9e('0x57')][_0x2b69d9];var _0x59c6ff='i';var _0x443e72=_['find'](_0x3bfce8,[_0x0a9e('0x25'),_0x5a88da[_0x0a9e('0x45')]]);if(!_0x443e72){switch(_0x5a88da[_0x0a9e('0x45')]){case'unreadMessages':if(_0x5a88da[_0x0a9e('0x58')]==0x1){_0x34aa5a[_0x0a9e('0x59')]('`'+_0x5a88da['field']+'`\x20=\x200');}else{_0x34aa5a[_0x0a9e('0x59')]('`'+_0x5a88da[_0x0a9e('0x45')]+'`\x20>\x200');}break;case _0x0a9e('0x5a'):if(_0x5a88da['operator']===_0x0a9e('0x5b')){if(_0x5a88da['value'][_0x0a9e('0x2b')]('\x20')['length']>0x1){_0x37edaa[_0x14d602]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x5a88da[_0x0a9e('0x58')]),null);}else{var _0x47de4c='%'+_0x5a88da[_0x0a9e('0x58')]+'%';_0x37edaa[_0x14d602](_0x0a9e('0x5c'),_0x47de4c,_0x47de4c,_0x47de4c);}}else{_0x443e72=_[_0x0a9e('0x5d')](_0x3bfce8,[_0x0a9e('0x25'),_0x0a9e('0x5e')]);_0x5a88da[_0x0a9e('0x45')]=_0x0a9e('0x5e');_0x797b45=as[_0x0a9e('0x5f')](_0x59c6ff,_0x443e72['type'],_0x5a88da);_0x37edaa[_0x14d602](_0x797b45[_0x0a9e('0x60')],_0x797b45[_0x0a9e('0x58')][_0x0a9e('0x61')],_0x797b45[_0x0a9e('0x58')][_0x0a9e('0x62')]);}break;case _0x0a9e('0x63'):var _0x5d86e9=_0x5a88da[_0x0a9e('0x58')][_0x0a9e('0x2b')](',')['map'](function(_0x3649cc){return Number(_0x3649cc);});_0x5d86e9['forEach'](function(_0x20c668){_0x30decb['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x20c668+',%');});_0x61bb17=_['union'](_0x61bb17,_0x5d86e9);break;case'User':if(_0x5a88da[_0x0a9e('0x64')]==='$substring'){_0x37edaa[_0x14d602](_0x0a9e('0x65'),'%'+_0x5a88da[_0x0a9e('0x58')]+'%',null);}else{_0x443e72=_[_0x0a9e('0x5d')](_0x3bfce8,[_0x0a9e('0x25'),_0x0a9e('0x66')]);_0x5a88da[_0x0a9e('0x45')]='UserId';_0x797b45=as[_0x0a9e('0x5f')](_0x59c6ff,_0x443e72['type'],_0x5a88da);_0x37edaa[_0x14d602](_0x797b45[_0x0a9e('0x60')],_0x797b45[_0x0a9e('0x58')][_0x0a9e('0x61')],_0x797b45['value'][_0x0a9e('0x62')]);}break;case _0x0a9e('0x67'):_0x797b45=as[_0x0a9e('0x5f')]('me',null,_0x5a88da);_0x37edaa[_0x14d602](_0x797b45[_0x0a9e('0x60')],_0x797b45['value'][_0x0a9e('0x61')],_0x797b45[_0x0a9e('0x58')]['end']);break;}}else{var _0x797b45=as[_0x0a9e('0x5f')](_0x59c6ff,_0x443e72[_0x0a9e('0x68')],_0x5a88da);_0x37edaa[_0x14d602](_0x797b45[_0x0a9e('0x60')],_0x797b45[_0x0a9e('0x58')]['start'],_0x797b45[_0x0a9e('0x58')][_0x0a9e('0x62')]);}}}else{var _0x281c7d=_(_0x3d9717['query'])[_0x0a9e('0x3a')]()['map'](function(_0x5211e3){return _[_0x0a9e('0x69')](_0x3bfce8,[_0x0a9e('0x25'),_0x5211e3])?_0x5211e3:undefined;})[_0x0a9e('0x6a')]()[_0x0a9e('0x58')]();if(!_[_0x0a9e('0x6b')](_0x281c7d)){_0x281c7d[_0x0a9e('0x2c')](function(_0x387489){if(_0x387489===_0x0a9e('0x6c')){_0x34aa5a[_0x0a9e('0x42')](_0x0a9e('0x6d'),[][_0x0a9e('0x6e')](_0x3d9717[_0x0a9e('0x39')][_0x387489]));}else if(_0x387489===_0x0a9e('0x6f')){var _0x2b8192=JSON[_0x0a9e('0x70')](_0x3d9717[_0x0a9e('0x39')][_0x387489])[_0x0a9e('0x71')];var _0x4257c9=JSON['parse'](_0x3d9717[_0x0a9e('0x39')][_0x387489])[_0x0a9e('0x72')];_0x34aa5a[_0x0a9e('0x42')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x2b8192,_0x4257c9);}else{if(_0x3d9717[_0x0a9e('0x39')][_0x387489]===_0x0a9e('0x73')){_0x34aa5a['where']('i.'+_0x387489+_0x0a9e('0x74'));}else{_0x34aa5a[_0x0a9e('0x42')]('i.'+_0x387489+_0x0a9e('0x75'),_0x3d9717[_0x0a9e('0x39')][_0x387489]);}}});}if(_0x3d9717[_0x0a9e('0x39')]['read']){if(_0x3d9717['query']['read']==0x1){_0x34aa5a[_0x0a9e('0x59')](_0x0a9e('0x76'));}else{_0x34aa5a[_0x0a9e('0x59')](_0x0a9e('0x77'));}}if(_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x78')]){_0x61bb17=_[_0x0a9e('0x79')](_0x3d9717[_0x0a9e('0x39')]['tag'])?_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x78')]:new Array(_0x3d9717[_0x0a9e('0x39')]['tag']);_0x61bb17[_0x0a9e('0x2c')](function(_0x583b2e){_0x30decb['or'](_0x0a9e('0x7a'),'%,'+_0x583b2e+',%');});}if(_0x3d9717[_0x0a9e('0x39')]['filter']){var _0x2ed01e=_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x7b')][_0x0a9e('0x7c')]('\x5c','\x5c\x5c')['replace']('\x27\x27',_0x0a9e('0x7d'));if(qs[_0x0a9e('0x7e')](_0x2ed01e)){_0x37edaa['or'](_0x0a9e('0x7f'),_0x2ed01e+'%');}else if(qs[_0x0a9e('0x80')](_0x2ed01e)){_0x37edaa['or']('c.email\x20LIKE\x20?',_0x2ed01e+'%');}else{_0x37edaa['or'](_0x0a9e('0x81'),qs[_0x0a9e('0x82')](_0x2ed01e))['or'](_0x0a9e('0x83'),qs[_0x0a9e('0x82')](_0x2ed01e));}}}_0x34aa5a['where'](_0x37edaa);_0x34aa5a[_0x0a9e('0x84')](_0x0a9e('0x85'));var _0x30a4c7={'type':db[_0x0a9e('0x86')][_0x0a9e('0x87')][_0x0a9e('0x88')],'raw':!![]};var _0x40fc56=_0x34aa5a[_0x0a9e('0x89')]();_0x40fc56[_0x0a9e('0x45')](_0x0a9e('0x85'));_0x40fc56[_0x0a9e('0x45')](_0x0a9e('0x8a'),_0x0a9e('0x8b'));if(_0x1ef87a[_0x0a9e('0x8c')]){_0x1ef87a['order'][_0x0a9e('0x2c')](function(_0x11da9c){_0x34aa5a[_0x0a9e('0x8c')]('i.'+_0x11da9c[0x0],_0x11da9c[0x1]==='DESC'?![]:!![]);});}if(!_[_0x0a9e('0x6b')](_0x61bb17)){_0x34aa5a[_0x0a9e('0x59')](_0x30decb);_0x40fc56[_0x0a9e('0x42')](_0x0a9e('0x8d'),_0x61bb17);}BPromise['resolve']()['then'](function(){if(!_0x375c18){if(_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x6c')]||_0x3d9717['query'][_0x0a9e('0x8e')])return;_0x40fc56['where'](_0x0a9e('0x8f'));_0x34aa5a[_0x0a9e('0x42')]('i.MailAccountId\x20IS\x20NOT\x20NULL');return;}return _0x3d9717[_0x0a9e('0x90')][_0x0a9e('0x91')]({'attributes':['id'],'raw':!![]})[_0x0a9e('0x22')](function(_0x42b959){if(_[_0x0a9e('0x6b')](_0x42b959)){_0x40fc56[_0x0a9e('0x42')](_0x0a9e('0x92'));_0x34aa5a['where'](_0x0a9e('0x92'));}else{_0x40fc56[_0x0a9e('0x42')](_0x0a9e('0x6d'),_[_0x0a9e('0x35')](_0x42b959,'id'));_0x34aa5a['where'](_0x0a9e('0x6d'),_[_0x0a9e('0x35')](_0x42b959,'id'));}});})['then'](function(){db[_0x0a9e('0x93')]['query'](_0x40fc56[_0x0a9e('0x94')](),_0x30a4c7)[_0x0a9e('0x22')](function(_0x3003eb){_0x31916f[_0x0a9e('0x1b')]=_0x3003eb['length'];if(_0x31916f['count']===0x0)return[];return db[_0x0a9e('0x93')][_0x0a9e('0x39')](_0x25c6e6[_0x0a9e('0x94')](),_0x30a4c7)['then'](function(_0x3b4a9f){_0x432fcc=_[_0x0a9e('0x95')](_0x3b4a9f,'id');_0x30a4c7=_['merge'](_0x30a4c7,{'model':db['MailInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3d9717[_0x0a9e('0x39')]['fields']){_0x1ef87a['attributes']['forEach'](function(_0x81d748){_0x34aa5a[_0x0a9e('0x45')]('i.'+_0x81d748);});}else{_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x8a'),_0x0a9e('0x8b'));_0x34aa5a[_0x0a9e('0x45')]('a.key',_0x0a9e('0x96'));_0x34aa5a['field'](_0x0a9e('0x97'),_0x0a9e('0x98'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x85'));_0x34aa5a['field'](_0x0a9e('0x99'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x9a'));_0x34aa5a['field'](_0x0a9e('0x9b'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x9c'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x9d'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x9e'));_0x34aa5a[_0x0a9e('0x45')]('i.lastMsgDirection');_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x9f'));_0x34aa5a['field'](_0x0a9e('0xa0'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xa1'));_0x34aa5a['field'](_0x0a9e('0xa2'));_0x34aa5a['field'](_0x0a9e('0xa3'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xa4'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xa5'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xa6'),_0x0a9e('0xa7'));_0x34aa5a['field'](_0x0a9e('0xa8'),_0x0a9e('0xa9'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xaa'),_0x0a9e('0xab'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xac'),_0x0a9e('0xad'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xae'),_0x0a9e('0xaf'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xb0'),'Contact.fax');_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xb1'),_0x0a9e('0xb2'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xb3'),'Owner.internal');_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xb4'),'TagIds');}if(_0x1ef87a[_0x0a9e('0x1d')])_0x34aa5a['limit'](_0x1ef87a[_0x0a9e('0x1d')]);if(_0x1ef87a[_0x0a9e('0x1c')])_0x34aa5a[_0x0a9e('0x1c')](_0x1ef87a[_0x0a9e('0x1c')]);return db['sequelize'][_0x0a9e('0x39')](_0x34aa5a['toString'](),_0x30a4c7);})[_0x0a9e('0x22')](function(_0x3d0a77){_0xbe9d19['where'](_0x0a9e('0xb5'),_[_0x0a9e('0x35')](_0x3d0a77,'id'));return db[_0x0a9e('0x93')]['query'](_0xbe9d19['toString'](),_0x30a4c7)[_0x0a9e('0x22')](function(_0x6ba2be){var _0x1707dc=_[_0x0a9e('0xb6')](_0x6ba2be,_0x0a9e('0xb7'));var _0x2450a8=[];return db[_0x0a9e('0xb8')][_0x0a9e('0x2e')]({'attributes':[_0x0a9e('0xb9')],'raw':!![]})['then'](function(_0x3156c7){var _0x517081=_0x3156c7[_0x0a9e('0xb9')];_0x3d0a77[_0x0a9e('0x2c')](function(_0x34e745){_0x2450a8[_0x0a9e('0xba')](updateMailInteraction(_0x34e745,_0x432fcc,_0x1707dc,_0x517081));});return BPromise[_0x0a9e('0xbb')](_0x2450a8);});});});})['then'](function(_0x436313){_0x31916f[_0x0a9e('0xbc')]=_0x436313;return _0x31916f;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x381c37,_0x1ef87a));})[_0x0a9e('0x33')](handleError(_0x381c37,null));};exports[_0x0a9e('0xbd')]=function(_0x5c66ef,_0x4f074c){var _0x22a3cb={'raw':![],'where':{'id':_0x5c66ef[_0x0a9e('0xbe')]['id']}},_0x583662={};_0x583662[_0x0a9e('0x38')]=_[_0x0a9e('0x3a')](db[_0x0a9e('0x2d')][_0x0a9e('0x36')]);_0x583662[_0x0a9e('0x39')]=_['keys'](_0x5c66ef['query']);_0x583662[_0x0a9e('0x3b')]=_['intersection'](_0x583662[_0x0a9e('0x38')],_0x583662['query']);_0x22a3cb[_0x0a9e('0x3c')]=_['intersection'](_0x583662['model'],qs[_0x0a9e('0x3d')](_0x5c66ef[_0x0a9e('0x39')]['fields']));_0x22a3cb[_0x0a9e('0x3c')]=_0x22a3cb[_0x0a9e('0x3c')][_0x0a9e('0x3e')]?_0x22a3cb[_0x0a9e('0x3c')]:_0x583662[_0x0a9e('0x38')];if(_0x5c66ef['query']['includeAll']){_0x22a3cb[_0x0a9e('0xbf')]=[{'all':!![]}];}_0x22a3cb=_[_0x0a9e('0xc0')]({},_0x22a3cb,_0x5c66ef[_0x0a9e('0xc1')]);return db[_0x0a9e('0x2d')][_0x0a9e('0x5d')](_0x22a3cb)['then'](handleEntityNotFound(_0x4f074c,null))[_0x0a9e('0x22')](respondWithResult(_0x4f074c,null))[_0x0a9e('0x33')](handleError(_0x4f074c,null));};exports['create']=function(_0x3c313d,_0x19fd11){return db[_0x0a9e('0x2d')][_0x0a9e('0xc2')](_0x3c313d[_0x0a9e('0xc3')],{})[_0x0a9e('0x22')](respondWithResult(_0x19fd11,0xc9))[_0x0a9e('0x33')](handleError(_0x19fd11,null));};exports[_0x0a9e('0x20')]=function(_0x40dd2a,_0x16afb3){if(_0x40dd2a['body']['id']){delete _0x40dd2a[_0x0a9e('0xc3')]['id'];}return db[_0x0a9e('0x2d')][_0x0a9e('0x5d')]({'where':{'id':_0x40dd2a[_0x0a9e('0xbe')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x16afb3,null))['then'](saveUpdates(_0x40dd2a['body'],null))[_0x0a9e('0x22')](respondWithResult(_0x16afb3,null))[_0x0a9e('0x33')](handleError(_0x16afb3,null));};exports[_0x0a9e('0x21')]=function(_0x2fea95,_0x34f7b5){return db['MailInteraction'][_0x0a9e('0x5d')]({'where':{'id':_0x2fea95[_0x0a9e('0xbe')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x34f7b5,null))['then'](removeEntity(_0x34f7b5,null))[_0x0a9e('0x33')](handleError(_0x34f7b5,null));};exports['describe']=function(_0x2144ca,_0x4799d4){return db[_0x0a9e('0x2d')][_0x0a9e('0xc4')]()[_0x0a9e('0x22')](respondWithResult(_0x4799d4,null))['catch'](handleError(_0x4799d4,null));};exports[_0x0a9e('0xc5')]=function(_0x5ed560,_0x4383da,_0x2b1824){return db[_0x0a9e('0xc6')][_0x0a9e('0x5d')]({'where':{'id':_0x5ed560[_0x0a9e('0xbe')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4383da,null))[_0x0a9e('0x22')](function(_0xe89aaa){if(_0xe89aaa){return _0xe89aaa[_0x0a9e('0xc5')](_0x5ed560[_0x0a9e('0xc3')][_0x0a9e('0xc7')],_[_0x0a9e('0xc8')](_0x5ed560[_0x0a9e('0xc3')],[_0x0a9e('0xc7'),'id'])||{});}})[_0x0a9e('0x22')](respondWithResult(_0x4383da,null))[_0x0a9e('0x33')](handleError(_0x4383da,null));};exports['getMessages']=function(_0x556443,_0x6eaaf0,_0x5c4be0){var _0x1d999b={'raw':![],'where':{}};var _0x3428c9={};var _0x5d6b69={'count':0x0,'rows':[]};return db[_0x0a9e('0x2d')][_0x0a9e('0x2e')]({'where':{'id':_0x556443[_0x0a9e('0xbe')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x6eaaf0,null))['then'](function(_0x148fd9){if(_0x148fd9){_0x3428c9[_0x0a9e('0x38')]=_[_0x0a9e('0x3a')](db[_0x0a9e('0xc6')]['rawAttributes']);_0x3428c9[_0x0a9e('0x39')]=_[_0x0a9e('0x3a')](_0x556443[_0x0a9e('0x39')]);_0x3428c9['filters']=_[_0x0a9e('0xc9')](_0x3428c9[_0x0a9e('0x38')],_0x3428c9[_0x0a9e('0x39')]);_0x1d999b['attributes']=_[_0x0a9e('0xc9')](_0x3428c9[_0x0a9e('0x38')],qs[_0x0a9e('0x3d')](_0x556443[_0x0a9e('0x39')][_0x0a9e('0x3d')]));_0x1d999b['attributes']=_0x1d999b[_0x0a9e('0x3c')][_0x0a9e('0x3e')]?_0x1d999b['attributes']:_0x3428c9[_0x0a9e('0x38')];if(!_0x556443[_0x0a9e('0x39')][_0x0a9e('0x3f')]('nolimit')){_0x1d999b['limit']=qs['limit'](_0x556443[_0x0a9e('0x39')][_0x0a9e('0x1d')]);_0x1d999b['offset']=qs[_0x0a9e('0x1c')](_0x556443[_0x0a9e('0x39')][_0x0a9e('0x1c')]);}_0x1d999b['order']=qs[_0x0a9e('0x41')](_0x556443[_0x0a9e('0x39')][_0x0a9e('0x41')]);_0x1d999b[_0x0a9e('0x42')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x43')](_0x556443[_0x0a9e('0x39')],_0x3428c9[_0x0a9e('0x3b')]));_0x1d999b[_0x0a9e('0x42')]['MailInteractionId']=_0x148fd9['id'];if(_0x556443[_0x0a9e('0x39')]['filter']){_0x1d999b[_0x0a9e('0x42')]=_[_0x0a9e('0xc0')](_0x1d999b[_0x0a9e('0x42')],{'$or':_[_0x0a9e('0x35')](_0x1d999b[_0x0a9e('0x3c')],function(_0x344cd4){var _0x53d9fc={};_0x53d9fc[_0x344cd4]={'$like':'%'+_0x556443[_0x0a9e('0x39')][_0x0a9e('0x7b')]+'%'};return _0x53d9fc;})});}if(_0x556443[_0x0a9e('0x39')][_0x0a9e('0x71')]){var _0x51aa2f=_0x556443[_0x0a9e('0x39')][_0x0a9e('0x71')][_0x0a9e('0x2b')](',');var _0x1c9539={};_0x1c9539[_0x51aa2f[0x0]]={'$gte':moment(_0x51aa2f[0x1])[_0x0a9e('0xca')](_0x0a9e('0xcb'))};_0x1d999b[_0x0a9e('0x42')]=_[_0x0a9e('0xc0')](_0x1d999b[_0x0a9e('0x42')],_0x1c9539);}_0x1d999b=_[_0x0a9e('0xc0')]({},_0x1d999b,_0x556443['options']);return db[_0x0a9e('0xc6')][_0x0a9e('0x1b')]({'where':_0x1d999b[_0x0a9e('0x42')]})[_0x0a9e('0x22')](function(_0xea8bd1){_0x5d6b69[_0x0a9e('0x1b')]=_0xea8bd1;if(_0x556443[_0x0a9e('0x39')][_0x0a9e('0xcc')]){_0x1d999b['include']=[{'all':!![]}];}return db[_0x0a9e('0xc6')][_0x0a9e('0xcd')](_0x1d999b);})[_0x0a9e('0x22')](function(_0x5c65fc){_0x5d6b69[_0x0a9e('0xbc')]=_0x5c65fc;return _0x5d6b69;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x6eaaf0,_0x1d999b))[_0x0a9e('0x33')](handleError(_0x6eaaf0,null));};exports[_0x0a9e('0xce')]=function(_0x370b5e,_0x1ba457,_0x424f1b){return db[_0x0a9e('0x2d')][_0x0a9e('0x5d')]({'where':{'id':_0x370b5e[_0x0a9e('0xbe')]['id']}})['then'](handleEntityNotFound(_0x1ba457,null))[_0x0a9e('0x22')](function(_0x446e6){if(_0x446e6){return _0x446e6[_0x0a9e('0xcf')](_0x370b5e[_0x0a9e('0xc3')][_0x0a9e('0xc7')],_[_0x0a9e('0xc8')](_0x370b5e['body'],[_0x0a9e('0xc7'),'id'])||{})['spread'](function(){return db['Tag']['findAll']({'attributes':['id',_0x0a9e('0x25'),_0x0a9e('0x46')],'where':{'id':_0x370b5e[_0x0a9e('0xc3')][_0x0a9e('0xc7')]}});})['then'](function(_0x4156a5){socket[_0x0a9e('0xd0')](_0x0a9e('0xd1'),{'id':Number(_0x370b5e[_0x0a9e('0xbe')]['id']),'tags':_0x4156a5||[]});return{'id':Number(_0x370b5e[_0x0a9e('0xbe')]['id']),'tags':_0x4156a5||[]};});}})['then'](respondWithResult(_0x1ba457,null))['catch'](handleError(_0x1ba457,null));};exports[_0x0a9e('0xd2')]=function(_0x33bcb2,_0x2a293f,_0x5e85d0){return db[_0x0a9e('0x2d')][_0x0a9e('0x5d')]({'where':{'id':_0x33bcb2[_0x0a9e('0xbe')]['id']}})['then'](handleEntityNotFound(_0x2a293f,null))[_0x0a9e('0x22')](function(_0x2bf85d){if(_0x2bf85d){return _0x2bf85d[_0x0a9e('0xd2')](_0x33bcb2['query'][_0x0a9e('0xc7')]);}})[_0x0a9e('0x22')](respondWithStatusCode(_0x2a293f,null))[_0x0a9e('0x33')](handleError(_0x2a293f,null));};exports['download']=function(_0x549697,_0x53ef46){var _0x3b04fd=moment()[_0x0a9e('0xd3')]()[_0x0a9e('0x94')]();var _0x26931c=path['join'](config[_0x0a9e('0xd4')],'server',_0x0a9e('0xd5'),_0x0a9e('0xd6'));var _0x242f23=path['join'](config[_0x0a9e('0xd4')],_0x0a9e('0xd7'),_0x0a9e('0xd5'),'attachments');var _0x40eb5d=path['join'](_0x26931c,_0x3b04fd);var _0x1b637c=util['format'](_0x0a9e('0xd8'),_0x549697['params']['id'],_0x3b04fd);var _0xb14971=path[_0x0a9e('0xd9')](_0x26931c,_0x1b637c);var _0xa288e4=[];if(_0x549697[_0x0a9e('0x39')][_0x0a9e('0xda')]){_0xa288e4[_0x0a9e('0xba')]({'model':db[_0x0a9e('0xdb')],'as':'Attachments','raw':!![]});}var _0x35ace3=[{'model':db[_0x0a9e('0xc6')],'as':'Messages','attributes':['id',_0x0a9e('0xc3'),_0x0a9e('0x47'),'to','cc','bcc',_0x0a9e('0xdc'),_0x0a9e('0x6f')],'where':{'secret':![]},'order':qs[_0x0a9e('0x41')]('id'),'include':_0xa288e4}];return db['MailInteraction'][_0x0a9e('0x5d')]({'where':{'id':_0x549697[_0x0a9e('0xbe')]['id']},'include':_0x35ace3})[_0x0a9e('0x22')](handleEntityNotFound(_0x53ef46,null))[_0x0a9e('0x22')](function(_0x2003bc){if(_0x2003bc&&_0x2003bc[_0x0a9e('0xdd')]){var _0x3ba897=_0x2003bc[_0x0a9e('0xde')]({'plain':!![]});fs[_0x0a9e('0xdf')](_0x40eb5d);return BPromise[_0x0a9e('0xe0')](_0x3ba897['Messages'],function(_0x1799d8,_0x53c7de){var _0x3c9854={'from':_0x1799d8[_0x0a9e('0x47')],'to':_0x1799d8['to'],'subject':_0x1799d8[_0x0a9e('0xdc')],'html':_0x1799d8[_0x0a9e('0xc3')],'headers':{'Date':moment(_0x1799d8[_0x0a9e('0x6f')])[_0x0a9e('0xca')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x1799d8['cc']){_0x3c9854[_0x0a9e('0xe1')]['Cc']=_0x1799d8['cc'];}if(_0x1799d8[_0x0a9e('0xe2')]){_0x3c9854[_0x0a9e('0xe1')]['Bcc']=_0x1799d8[_0x0a9e('0xe2')];}return new BPromise(function(_0x402544,_0x4435d2){if(_0x1799d8[_0x0a9e('0xe3')]){for(var _0x31e1e0=0x0;_0x31e1e0<_0x1799d8[_0x0a9e('0xe3')][_0x0a9e('0x3e')];_0x31e1e0++){var _0x5f2c51=_0x1799d8[_0x0a9e('0xe3')][_0x31e1e0];var _0x228c10=path[_0x0a9e('0xd9')](_0x242f23,_0x5f2c51[_0x0a9e('0xe4')]);if(fs[_0x0a9e('0xe5')](_0x228c10)){_0x3c9854[_0x0a9e('0xda')][_0x0a9e('0xba')]({'name':_0x5f2c51['name'],'contentType':_0x5f2c51['type'],'data':fs[_0x0a9e('0xe6')](_0x228c10)});}}}emlformat[_0x0a9e('0xe7')](_0x3c9854,function(_0x1f4929,_0x1bf692){if(_0x1f4929)return _0x4435d2(_0x1f4929);fs[_0x0a9e('0xe8')](path[_0x0a9e('0xd9')](_0x40eb5d,util[_0x0a9e('0xca')]('message%d.eml',_0x53c7de)),_0x1bf692);return _0x402544(_0x1bf692);});});})[_0x0a9e('0x22')](function(){return new BPromise(function(_0x1d7fc4,_0x2d8e91){zipdir(_0x40eb5d,{'saveTo':_0xb14971},function(_0x2675a5,_0x1b1757){if(_0x2675a5)return _0x2d8e91(_0x2675a5);return _0x1d7fc4(_0x1b1757);});})[_0x0a9e('0x22')](function(){return new BPromise(function(_0x16be7e,_0x54f0b8){rimraf(_0x40eb5d,function(_0x311288){if(_0x311288)_0x54f0b8(_0x311288);return _0x16be7e();});});})[_0x0a9e('0x22')](function(){return _0x53ef46[_0x0a9e('0xe9')](_0xb14971,_0x1b637c,function(_0x5885c3){if(_0x5885c3){console[_0x0a9e('0xea')](_0x0a9e('0xeb'),_0x5885c3);}else{fs[_0x0a9e('0xec')](_0xb14971);}});});});}else{return _0x53ef46[_0x0a9e('0x23')](0xc8);}})['catch'](handleError(_0x53ef46,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 4acc641..69057b3 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 _0x1f0f=['hasOwnProperty','hook','exports','events','MailInteraction','../../mysqldb','MailMessage','update','remove','getUsers','Users','map','findAll','setDataValue','unreadMessages','length','emit','catch'];(function(_0xea8947,_0x1b573d){var _0x2455e9=function(_0x18771e){while(--_0x18771e){_0xea8947['push'](_0xea8947['shift']());}};_0x2455e9(++_0x1b573d);}(_0x1f0f,0x1e9));var _0xf1f0=function(_0x4f3eea,_0x3f3199){_0x4f3eea=_0x4f3eea-0x0;var _0x57808d=_0x1f0f[_0x4f3eea];return _0x57808d;};'use strict';var EventEmitter=require(_0xf1f0('0x0'));var MailInteraction=require('../../mysqldb')['db'][_0xf1f0('0x1')];var MailMessage=require(_0xf1f0('0x2'))['db'][_0xf1f0('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xf1f0('0x4'),'afterDestroy':_0xf1f0('0x5')};function emitEvent(_0x14a177){return function(_0x1f20f8,_0x4694dd,_0x22735f){_0x1f20f8[_0xf1f0('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0x50d210){_0x1f20f8['setDataValue'](_0xf1f0('0x7'),_0x50d210[_0xf1f0('0x8')](function(_0x5d9a57){return{'id':_0x5d9a57['id']};}));return MailMessage[_0xf1f0('0x9')]({'where':{'MailInteractionId':_0x1f20f8['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x5ebdb1){_0x1f20f8[_0xf1f0('0xa')](_0xf1f0('0xb'),_0x5ebdb1[_0xf1f0('0xc')]);MailInteractionEvents[_0xf1f0('0xd')](_0x14a177+':'+_0x1f20f8['id'],_0x1f20f8);MailInteractionEvents[_0xf1f0('0xd')](_0x14a177,_0x1f20f8);_0x22735f(null);})[_0xf1f0('0xe')](_0x22735f(null));};}for(var e in events){if(events[_0xf1f0('0xf')](e)){var event=events[e];MailInteraction[_0xf1f0('0x10')](e,emitEvent(event));}}module[_0xf1f0('0x11')]=MailInteractionEvents; \ No newline at end of file +var _0xa266=['update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','hook','exports','events','../../mysqldb','MailInteraction','setMaxListeners','save'];(function(_0x405a02,_0x156783){var _0x567c1e=function(_0x4c5e4c){while(--_0x4c5e4c){_0x405a02['push'](_0x405a02['shift']());}};_0x567c1e(++_0x156783);}(_0xa266,0xc1));var _0x6a26=function(_0x5d7227,_0x12aebe){_0x5d7227=_0x5d7227-0x0;var _0x15ac55=_0xa266[_0x5d7227];return _0x15ac55;};'use strict';var EventEmitter=require(_0x6a26('0x0'));var MailInteraction=require(_0x6a26('0x1'))['db'][_0x6a26('0x2')];var MailMessage=require('../../mysqldb')['db']['MailMessage'];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x6a26('0x3')](0x0);var events={'afterCreate':_0x6a26('0x4'),'afterUpdate':_0x6a26('0x5'),'afterDestroy':_0x6a26('0x6')};function emitEvent(_0x45ed3a){return function(_0x2b6706,_0x25ba2a,_0x4f9802){_0x2b6706[_0x6a26('0x7')]({'attributes':['id'],'raw':!![]})[_0x6a26('0x8')](function(_0x1aa713){_0x2b6706[_0x6a26('0x9')](_0x6a26('0xa'),_0x1aa713[_0x6a26('0xb')](function(_0x273f33){return{'id':_0x273f33['id']};}));return MailMessage[_0x6a26('0xc')]({'where':{'MailInteractionId':_0x2b6706['id'],'direction':'in','read':![]},'raw':!![]});})[_0x6a26('0x8')](function(_0x306373){_0x2b6706[_0x6a26('0x9')](_0x6a26('0xd'),_0x306373[_0x6a26('0xe')]);MailInteractionEvents[_0x6a26('0xf')](_0x45ed3a+':'+_0x2b6706['id'],_0x2b6706);MailInteractionEvents[_0x6a26('0xf')](_0x45ed3a,_0x2b6706);_0x4f9802(null);})['catch'](_0x4f9802(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction[_0x6a26('0x10')](e,emitEvent(event));}}module[_0x6a26('0x11')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 4980d0d..a2dd7b5 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 _0x12c9=['changed','substatus','substatusAt','models','get','MailMessage','then','catch','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','path','rimraf','./mailInteraction.attributes','exports','define','MailInteraction','subject','FULLTEXT','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt'];(function(_0x56fe68,_0x40fdef){var _0x1eeb3b=function(_0x5a61a9){while(--_0x5a61a9){_0x56fe68['push'](_0x56fe68['shift']());}};_0x1eeb3b(++_0x40fdef);}(_0x12c9,0x10e));var _0x912c=function(_0x2667cf,_0x26d24f){_0x2667cf=_0x2667cf-0x0;var _0x33c5ff=_0x12c9[_0x2667cf];return _0x33c5ff;};'use strict';var _=require(_0x912c('0x0'));var util=require('util');var logger=require(_0x912c('0x1'))(_0x912c('0x2'));var moment=require(_0x912c('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x912c('0x4'));var rimraf=require(_0x912c('0x5'));var config=require('../../config/environment');var attributes=require(_0x912c('0x6'));module[_0x912c('0x7')]=function(_0x51a277,_0x3c595c){return _0x51a277[_0x912c('0x8')](_0x912c('0x9'),attributes,{'tableName':'mail_interactions','paranoid':![],'indexes':[{'name':'fti_mail_interactions','fields':[_0x912c('0xa'),'to'],'type':_0x912c('0xb')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4eb1c5,_0x42e836,_0x5be932){if(_0x4eb1c5['substatus']){_0x4eb1c5['substatusAt']=moment()[_0x912c('0xc')](_0x912c('0xd'));}if(_0x4eb1c5[_0x912c('0xe')]){_0x4eb1c5[_0x912c('0xf')]=moment()['format'](_0x912c('0xd'));}_0x5be932(null,_0x42e836);},'beforeUpdate':function(_0x5737a5,_0x5f1093,_0x2b03aa){if(_0x5737a5[_0x912c('0x10')](_0x912c('0x11'))){_0x5737a5[_0x912c('0x12')]=_0x5737a5[_0x912c('0x11')]?moment()['format'](_0x912c('0xd')):null;}if(_0x5737a5[_0x912c('0x10')](_0x912c('0xe'))){_0x5737a5[_0x912c('0xf')]=moment()[_0x912c('0xc')](_0x912c('0xd'));_0x5737a5[_0x912c('0x11')]=null;_0x5737a5[_0x912c('0x12')]=null;}_0x2b03aa(null,_0x5737a5);},'afterUpdate':function(_0x361d2b,_0x54caf3,_0x3c6031){var _0x17855b=_0x51a277[_0x912c('0x13')];var _0x53fe72=_0x361d2b[_0x912c('0x14')]({'plain':!![]});if(_0x53fe72[_0x912c('0xe')]){return _0x17855b[_0x912c('0x15')]['update']({'read':!![]},{'where':{'MailInteractionId':_0x53fe72['id']}})[_0x912c('0x16')](function(){_0x3c6031();})[_0x912c('0x17')](function(_0x51ca12){_0x3c6031(_0x51ca12);});}else{_0x3c6031();}}},'charset':_0x912c('0x18'),'collate':_0x912c('0x19')});}; \ No newline at end of file +var _0x6364=['FULLTEXT','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closedAt','changed','closed','get','MailMessage','then','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','MailInteraction','fti_mail_interactions','subject'];(function(_0x271060,_0x3f86b1){var _0x40540b=function(_0x1735a7){while(--_0x1735a7){_0x271060['push'](_0x271060['shift']());}};_0x40540b(++_0x3f86b1);}(_0x6364,0x8f));var _0x4636=function(_0x544946,_0x1e2a3f){_0x544946=_0x544946-0x0;var _0x584c15=_0x6364[_0x544946];return _0x584c15;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4636('0x0'))(_0x4636('0x1'));var moment=require(_0x4636('0x2'));var BPromise=require(_0x4636('0x3'));var rp=require(_0x4636('0x4'));var fs=require('fs');var path=require(_0x4636('0x5'));var rimraf=require(_0x4636('0x6'));var config=require(_0x4636('0x7'));var attributes=require('./mailInteraction.attributes');module[_0x4636('0x8')]=function(_0x30201f,_0x3e0ed6){return _0x30201f[_0x4636('0x9')](_0x4636('0xa'),attributes,{'tableName':'mail_interactions','paranoid':![],'indexes':[{'name':_0x4636('0xb'),'fields':[_0x4636('0xc'),'to'],'type':_0x4636('0xd')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x3e3f80,_0x498de6,_0x3e1628){if(_0x3e3f80[_0x4636('0xe')]){_0x3e3f80[_0x4636('0xf')]=moment()[_0x4636('0x10')](_0x4636('0x11'));}if(_0x3e3f80['closed']){_0x3e3f80[_0x4636('0x12')]=moment()[_0x4636('0x10')](_0x4636('0x11'));}_0x3e1628(null,_0x498de6);},'beforeUpdate':function(_0x3b305e,_0x4c904b,_0x13ee0e){if(_0x3b305e[_0x4636('0x13')](_0x4636('0xe'))){_0x3b305e[_0x4636('0xf')]=_0x3b305e[_0x4636('0xe')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):null;}if(_0x3b305e[_0x4636('0x13')](_0x4636('0x14'))){_0x3b305e[_0x4636('0x12')]=moment()[_0x4636('0x10')]('YYYY-MM-DD\x20HH:mm:ss');_0x3b305e[_0x4636('0xe')]=null;_0x3b305e[_0x4636('0xf')]=null;}_0x13ee0e(null,_0x3b305e);},'afterUpdate':function(_0x20859a,_0x1b047c,_0x445286){var _0x216748=_0x30201f['models'];var _0xc04acf=_0x20859a[_0x4636('0x15')]({'plain':!![]});if(_0xc04acf[_0x4636('0x14')]){return _0x216748[_0x4636('0x16')]['update']({'read':!![]},{'where':{'MailInteractionId':_0xc04acf['id']}})[_0x4636('0x17')](function(){_0x445286();})['catch'](function(_0x4bd7b9){_0x445286(_0x4bd7b9);});}else{_0x445286();}}},'charset':_0x4636('0x18'),'collate':_0x4636('0x19')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index ecfeb33..28abe54 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 _0xef38=['options','raw','limit','UpdateMailInteraction','AddTagsToMailInteraction','MailInteraction','where','addTags','spread','AddTags','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','./mailInteraction.socket','register','request','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','update','body'];(function(_0x4b7461,_0x43e496){var _0x451c99=function(_0x14ae20){while(--_0x14ae20){_0x4b7461['push'](_0x4b7461['shift']());}};_0x451c99(++_0x43e496);}(_0xef38,0x122));var _0x8ef3=function(_0x553af2,_0x11ab02){_0x553af2=_0x553af2-0x0;var _0x157446=_0xef38[_0x553af2];return _0x157446;};'use strict';var _=require('lodash');var util=require(_0x8ef3('0x0'));var moment=require(_0x8ef3('0x1'));var BPromise=require(_0x8ef3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8ef3('0x3'))['db'];var utils=require(_0x8ef3('0x4'));var logger=require(_0x8ef3('0x5'))(_0x8ef3('0x6'));var config=require(_0x8ef3('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x8ef3('0x8')][_0x8ef3('0x9')]({'port':0x232a});config['redis']=_[_0x8ef3('0xa')](config[_0x8ef3('0xb')],{'host':_0x8ef3('0xc'),'port':0x18eb});var socket=require(_0x8ef3('0xd'))(new Redis(config[_0x8ef3('0xb')]));require(_0x8ef3('0xe'))[_0x8ef3('0xf')](socket);function respondWithRpcPromise(_0x48d639,_0x3c4d82,_0x23533d){return new BPromise(function(_0x13a559,_0x37825a){return client[_0x8ef3('0x10')](_0x48d639,_0x23533d)[_0x8ef3('0x11')](function(_0x3664e4){logger[_0x8ef3('0x12')](_0x8ef3('0x13'),_0x3c4d82,_0x8ef3('0x14'));logger[_0x8ef3('0x15')](_0x8ef3('0x16'),_0x3c4d82,_0x8ef3('0x14'),JSON[_0x8ef3('0x17')](_0x3664e4));if(_0x3664e4[_0x8ef3('0x18')]){if(_0x3664e4[_0x8ef3('0x18')][_0x8ef3('0x19')]===0x1f4){logger[_0x8ef3('0x18')](_0x8ef3('0x13'),_0x3c4d82,_0x3664e4['error'][_0x8ef3('0x1a')]);return _0x37825a(_0x3664e4['error'][_0x8ef3('0x1a')]);}logger['error'](_0x8ef3('0x13'),_0x3c4d82,_0x3664e4[_0x8ef3('0x18')]['message']);return _0x13a559(_0x3664e4['error'][_0x8ef3('0x1a')]);}else{logger[_0x8ef3('0x12')](_0x8ef3('0x13'),_0x3c4d82,_0x8ef3('0x14'));_0x13a559(_0x3664e4['result']['message']);}})[_0x8ef3('0x1b')](function(_0x65e9f2){logger[_0x8ef3('0x18')](_0x8ef3('0x13'),_0x3c4d82,_0x65e9f2);_0x37825a(_0x65e9f2);});});}exports['UpdateMailInteraction']=function(_0xf6a763){var _0x185abf=this;return new Promise(function(_0x2a3e8c,_0x5856a0){return db['MailInteraction'][_0x8ef3('0x1c')](_0xf6a763[_0x8ef3('0x1d')],{'raw':_0xf6a763[_0x8ef3('0x1e')]?_0xf6a763[_0x8ef3('0x1e')][_0x8ef3('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xf6a763[_0x8ef3('0x1e')]?_0xf6a763[_0x8ef3('0x1e')]['where']||null:null,'attributes':_0xf6a763[_0x8ef3('0x1e')]?_0xf6a763[_0x8ef3('0x1e')]['attributes']||null:null,'limit':_0xf6a763[_0x8ef3('0x1e')]?_0xf6a763[_0x8ef3('0x1e')][_0x8ef3('0x20')]||null:null})[_0x8ef3('0x11')](function(_0x7d8a6c){logger['info'](_0x8ef3('0x21'),_0xf6a763);logger[_0x8ef3('0x15')](_0x8ef3('0x21'),_0xf6a763,JSON[_0x8ef3('0x17')](_0x7d8a6c));_0x2a3e8c(_0x7d8a6c);})['catch'](function(_0x3441ce){logger[_0x8ef3('0x18')](_0x8ef3('0x21'),_0x3441ce[_0x8ef3('0x1a')],_0xf6a763);_0x5856a0(_0x185abf[_0x8ef3('0x18')](0x1f4,_0x3441ce[_0x8ef3('0x1a')]));});});};exports[_0x8ef3('0x22')]=function(_0x39812d){return new Promise(function(_0x223f8e,_0xe4e2ba){return db[_0x8ef3('0x23')]['find']({'where':_0x39812d[_0x8ef3('0x1e')]?_0x39812d[_0x8ef3('0x1e')][_0x8ef3('0x24')]||null:null})[_0x8ef3('0x11')](function(_0x3b9d3a){if(_0x3b9d3a){return _0x3b9d3a[_0x8ef3('0x25')](_0x39812d[_0x8ef3('0x1d')]['ids'],_['omit'](_0x39812d[_0x8ef3('0x1d')],['ids','id'])||{});}})[_0x8ef3('0x26')](function(_0x182394){logger[_0x8ef3('0x12')]('AddTags',_0x39812d);logger['debug']('AddTags',_0x39812d,JSON['stringify'](_0x182394));_0x223f8e(_0x182394);})['catch'](function(_0x455da1){logger[_0x8ef3('0x18')](_0x8ef3('0x27'),_0x455da1['message'],_0x39812d);_0xe4e2ba(_this[_0x8ef3('0x18')](0x1f4,_0x455da1[_0x8ef3('0x1a')]));});});}; \ No newline at end of file +var _0x8130=['update','body','options','raw','where','attributes','limit','catch','AddTagsToMailInteraction','MailInteraction','find','addTags','ids','AddTags','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','register','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','UpdateMailInteraction'];(function(_0x31b9cf,_0x1a809b){var _0x357b8a=function(_0x50a273){while(--_0x50a273){_0x31b9cf['push'](_0x31b9cf['shift']());}};_0x357b8a(++_0x1a809b);}(_0x8130,0x146));var _0x0813=function(_0x588261,_0x62629e){_0x588261=_0x588261-0x0;var _0x498c90=_0x8130[_0x588261];return _0x498c90;};'use strict';var _=require(_0x0813('0x0'));var util=require(_0x0813('0x1'));var moment=require('moment');var BPromise=require(_0x0813('0x2'));var rs=require(_0x0813('0x3'));var fs=require('fs');var Redis=require(_0x0813('0x4'));var db=require(_0x0813('0x5'))['db'];var utils=require(_0x0813('0x6'));var logger=require(_0x0813('0x7'))('rpc');var config=require(_0x0813('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x0813('0x9')]({'port':0x232a});config[_0x0813('0xa')]=_[_0x0813('0xb')](config[_0x0813('0xa')],{'host':_0x0813('0xc'),'port':0x18eb});var socket=require(_0x0813('0xd'))(new Redis(config[_0x0813('0xa')]));require('./mailInteraction.socket')[_0x0813('0xe')](socket);function respondWithRpcPromise(_0x1815be,_0x251ca8,_0x5a9c5e){return new BPromise(function(_0x5550c8,_0x15f8d6){return client['request'](_0x1815be,_0x5a9c5e)[_0x0813('0xf')](function(_0x5b54ec){logger[_0x0813('0x10')](_0x0813('0x11'),_0x251ca8,_0x0813('0x12'));logger[_0x0813('0x13')]('MailInteraction,\x20%s,\x20%s,\x20%s',_0x251ca8,'request\x20sent',JSON[_0x0813('0x14')](_0x5b54ec));if(_0x5b54ec[_0x0813('0x15')]){if(_0x5b54ec['error'][_0x0813('0x16')]===0x1f4){logger['error']('MailInteraction,\x20%s,\x20%s',_0x251ca8,_0x5b54ec[_0x0813('0x15')][_0x0813('0x17')]);return _0x15f8d6(_0x5b54ec['error'][_0x0813('0x17')]);}logger['error'](_0x0813('0x11'),_0x251ca8,_0x5b54ec[_0x0813('0x15')][_0x0813('0x17')]);return _0x5550c8(_0x5b54ec[_0x0813('0x15')][_0x0813('0x17')]);}else{logger[_0x0813('0x10')](_0x0813('0x11'),_0x251ca8,_0x0813('0x12'));_0x5550c8(_0x5b54ec['result'][_0x0813('0x17')]);}})['catch'](function(_0x112720){logger[_0x0813('0x15')]('MailInteraction,\x20%s,\x20%s',_0x251ca8,_0x112720);_0x15f8d6(_0x112720);});});}exports[_0x0813('0x18')]=function(_0x3639fc){var _0x4945df=this;return new Promise(function(_0x1ee739,_0x334741){return db['MailInteraction'][_0x0813('0x19')](_0x3639fc[_0x0813('0x1a')],{'raw':_0x3639fc[_0x0813('0x1b')]?_0x3639fc[_0x0813('0x1b')][_0x0813('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3639fc['options']?_0x3639fc[_0x0813('0x1b')][_0x0813('0x1d')]||null:null,'attributes':_0x3639fc[_0x0813('0x1b')]?_0x3639fc['options'][_0x0813('0x1e')]||null:null,'limit':_0x3639fc['options']?_0x3639fc['options'][_0x0813('0x1f')]||null:null})['then'](function(_0x5eb50e){logger[_0x0813('0x10')](_0x0813('0x18'),_0x3639fc);logger[_0x0813('0x13')](_0x0813('0x18'),_0x3639fc,JSON[_0x0813('0x14')](_0x5eb50e));_0x1ee739(_0x5eb50e);})[_0x0813('0x20')](function(_0x42627c){logger[_0x0813('0x15')]('UpdateMailInteraction',_0x42627c[_0x0813('0x17')],_0x3639fc);_0x334741(_0x4945df[_0x0813('0x15')](0x1f4,_0x42627c[_0x0813('0x17')]));});});};exports[_0x0813('0x21')]=function(_0x355462){return new Promise(function(_0x373ad0,_0x55e115){return db[_0x0813('0x22')][_0x0813('0x23')]({'where':_0x355462['options']?_0x355462['options'][_0x0813('0x1d')]||null:null})[_0x0813('0xf')](function(_0x32086e){if(_0x32086e){return _0x32086e[_0x0813('0x24')](_0x355462[_0x0813('0x1a')][_0x0813('0x25')],_['omit'](_0x355462[_0x0813('0x1a')],[_0x0813('0x25'),'id'])||{});}})['spread'](function(_0x47ae8d){logger[_0x0813('0x10')](_0x0813('0x26'),_0x355462);logger[_0x0813('0x13')]('AddTags',_0x355462,JSON[_0x0813('0x14')](_0x47ae8d));_0x373ad0(_0x47ae8d);})[_0x0813('0x20')](function(_0x53d599){logger['error'](_0x0813('0x26'),_0x53d599[_0x0813('0x17')],_0x355462);_0x55e115(_this[_0x0813('0x15')](0x1f4,_0x53d599[_0x0813('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index fe08730..7be0ae8 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 _0x2b76=['length','mailInteraction:','save','remove','emit','removeListener'];(function(_0x7d74c4,_0x43664f){var _0x7e5b4d=function(_0x2ea614){while(--_0x2ea614){_0x7d74c4['push'](_0x7d74c4['shift']());}};_0x7e5b4d(++_0x43664f);}(_0x2b76,0x13a));var _0x62b7=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x2b76[_0xfae23b];return _0x200640;};'use strict';var MailInteractionEvents=require('./mailInteraction.events');var events=[_0x62b7('0x0'),_0x62b7('0x1'),'update'];function createListener(_0x35071d,_0x1d5c11){return function(_0x44db87){_0x1d5c11[_0x62b7('0x2')](_0x35071d,_0x44db87);};}function removeListener(_0x483387,_0x578ff7){return function(){MailInteractionEvents[_0x62b7('0x3')](_0x483387,_0x578ff7);};}exports['register']=function(_0x3495dd){for(var _0x474495=0x0,_0x48720e=events[_0x62b7('0x4')];_0x474495<_0x48720e;_0x474495++){var _0x189794=events[_0x474495];var _0x18686d=createListener(_0x62b7('0x5')+_0x189794,_0x3495dd);MailInteractionEvents['on'](_0x189794,_0x18686d);}}; \ No newline at end of file +var _0xd8f3=['remove','update','removeListener','register','length','mailInteraction:','./mailInteraction.events'];(function(_0x6c823,_0x3f5e35){var _0x1fda1b=function(_0x1eb5b5){while(--_0x1eb5b5){_0x6c823['push'](_0x6c823['shift']());}};_0x1fda1b(++_0x3f5e35);}(_0xd8f3,0x172));var _0x3d8f=function(_0xb4f9a,_0x482bc8){_0xb4f9a=_0xb4f9a-0x0;var _0x299e56=_0xd8f3[_0xb4f9a];return _0x299e56;};'use strict';var MailInteractionEvents=require(_0x3d8f('0x0'));var events=['save',_0x3d8f('0x1'),_0x3d8f('0x2')];function createListener(_0x1c3f6f,_0x98844){return function(_0xd2fc10){_0x98844['emit'](_0x1c3f6f,_0xd2fc10);};}function removeListener(_0x1015d8,_0xce431e){return function(){MailInteractionEvents[_0x3d8f('0x3')](_0x1015d8,_0xce431e);};}exports[_0x3d8f('0x4')]=function(_0x43dc5c){for(var _0x5efafb=0x0,_0x158c96=events[_0x3d8f('0x5')];_0x5efafb<_0x158c96;_0x5efafb++){var _0x4c33bf=events[_0x5efafb];var _0x1e4b1b=createListener(_0x3d8f('0x6')+_0x4c33bf,_0x43dc5c);MailInteractionEvents['on'](_0x4c33bf,_0x1e4b1b);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 1f71aa3..58663d6 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 _0x9957=['download','post','mail','mailmessage:create','put','update','/:id/accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','show','/:id/download'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var auth=require(_0x7995('0x5'));var interaction=require(_0x7995('0x6'));var config=require(_0x7995('0x7'));var controller=require('./mailMessage.controller');router[_0x7995('0x8')]('/',auth[_0x7995('0x9')](),controller[_0x7995('0xa')]);router[_0x7995('0x8')](_0x7995('0xb'),auth[_0x7995('0x9')](),controller['describe']);router[_0x7995('0x8')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x8')](_0x7995('0xe'),auth[_0x7995('0x9')](),controller[_0x7995('0xf')]);router[_0x7995('0x10')]('/',auth[_0x7995('0x9')](),interaction['tracked'](_0x7995('0x11'),_0x7995('0x12')),controller['create']);router[_0x7995('0x13')](_0x7995('0xc'),auth[_0x7995('0x9')](),controller[_0x7995('0x14')]);router[_0x7995('0x13')](_0x7995('0x15'),auth[_0x7995('0x9')](),controller['accept']);router['put'](_0x7995('0x16'),auth[_0x7995('0x9')](),controller[_0x7995('0x17')]);router[_0x7995('0x18')](_0x7995('0xc'),auth[_0x7995('0x9')](),controller[_0x7995('0x19')]);module[_0x7995('0x1a')]=router; \ No newline at end of file +var _0x7fbe=['update','/:id/accept','/:id/reject','reject','delete','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller','get','isAuthenticated','index','/describe','/:id','show','download','post','tracked','mail','mailmessage:create','create','put'];(function(_0x214174,_0x1dbae9){var _0x1231e4=function(_0x32206a){while(--_0x32206a){_0x214174['push'](_0x214174['shift']());}};_0x1231e4(++_0x1dbae9);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x3128f7,_0x5ec08a){_0x3128f7=_0x3128f7-0x0;var _0x5ce976=_0x7fbe[_0x3128f7];return _0x5ce976;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe7fb('0x0'));var timeout=require(_0xe7fb('0x1'));var express=require(_0xe7fb('0x2'));var router=express[_0xe7fb('0x3')]();var auth=require(_0xe7fb('0x4'));var interaction=require(_0xe7fb('0x5'));var config=require(_0xe7fb('0x6'));var controller=require(_0xe7fb('0x7'));router[_0xe7fb('0x8')]('/',auth[_0xe7fb('0x9')](),controller[_0xe7fb('0xa')]);router[_0xe7fb('0x8')](_0xe7fb('0xb'),auth[_0xe7fb('0x9')](),controller['describe']);router[_0xe7fb('0x8')](_0xe7fb('0xc'),auth[_0xe7fb('0x9')](),controller[_0xe7fb('0xd')]);router['get']('/:id/download',auth[_0xe7fb('0x9')](),controller[_0xe7fb('0xe')]);router[_0xe7fb('0xf')]('/',auth[_0xe7fb('0x9')](),interaction[_0xe7fb('0x10')](_0xe7fb('0x11'),_0xe7fb('0x12')),controller[_0xe7fb('0x13')]);router[_0xe7fb('0x14')](_0xe7fb('0xc'),auth[_0xe7fb('0x9')](),controller[_0xe7fb('0x15')]);router[_0xe7fb('0x14')](_0xe7fb('0x16'),auth[_0xe7fb('0x9')](),controller['accept']);router[_0xe7fb('0x14')](_0xe7fb('0x17'),auth['isAuthenticated'](),controller[_0xe7fb('0x18')]);router[_0xe7fb('0x19')]('/:id',auth[_0xe7fb('0x9')](),controller['destroy']);module[_0xe7fb('0x1a')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index c8c430d..f0e4b60 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 _0xf567=['ENUM','out','STRING','DATE','INTEGER','sequelize','lodash','exports','long','TEXT','BOOLEAN'];(function(_0x3f8264,_0xa6bc29){var _0x2aa220=function(_0x49b5f4){while(--_0x49b5f4){_0x3f8264['push'](_0x3f8264['shift']());}};_0x2aa220(++_0xa6bc29);}(_0xf567,0x118));var _0x7f56=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xf567[_0x21a9d9];return _0x46adce;};'use strict';var Sequelize=require(_0x7f56('0x0'));var _=require(_0x7f56('0x1'));module[_0x7f56('0x2')]={'body':{'type':Sequelize['TEXT'](_0x7f56('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x7f56('0x4')]('medium')},'read':{'type':Sequelize[_0x7f56('0x5')],'defaultValue':![]},'direction':{'type':Sequelize[_0x7f56('0x6')]('in',_0x7f56('0x7')),'defaultValue':_0x7f56('0x7'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize[_0x7f56('0x8')]},'to':{'type':Sequelize[_0x7f56('0x4')](_0x7f56('0x3'))},'cc':{'type':Sequelize['TEXT'](_0x7f56('0x3'))},'bcc':{'type':Sequelize[_0x7f56('0x4')](_0x7f56('0x3'))},'subject':{'type':Sequelize[_0x7f56('0x4')]},'sentAt':{'type':Sequelize[_0x7f56('0x9')]},'attach':{'type':Sequelize[_0x7f56('0xa')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x7f56('0x5')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x7f56('0x9')]},'originTo':{'type':Sequelize[_0x7f56('0x4')](_0x7f56('0x3'))},'originCc':{'type':Sequelize[_0x7f56('0x4')](_0x7f56('0x3'))}}; \ No newline at end of file +var _0x36fe=['medium','BOOLEAN','ENUM','out','STRING','DATE','INTEGER','sequelize','lodash','exports','TEXT','long'];(function(_0x280196,_0x4ee295){var _0x3c6cdc=function(_0x320672){while(--_0x320672){_0x280196['push'](_0x280196['shift']());}};_0x3c6cdc(++_0x4ee295);}(_0x36fe,0x127));var _0xe36f=function(_0x4c1ec2,_0x4f42b7){_0x4c1ec2=_0x4c1ec2-0x0;var _0x3f6f1c=_0x36fe[_0x4c1ec2];return _0x3f6f1c;};'use strict';var Sequelize=require(_0xe36f('0x0'));var _=require(_0xe36f('0x1'));module[_0xe36f('0x2')]={'body':{'type':Sequelize[_0xe36f('0x3')](_0xe36f('0x4')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xe36f('0x3')](_0xe36f('0x5'))},'read':{'type':Sequelize[_0xe36f('0x6')],'defaultValue':![]},'direction':{'type':Sequelize[_0xe36f('0x7')]('in',_0xe36f('0x8')),'defaultValue':_0xe36f('0x8'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize[_0xe36f('0x9')]},'to':{'type':Sequelize['TEXT'](_0xe36f('0x4'))},'cc':{'type':Sequelize[_0xe36f('0x3')]('long')},'bcc':{'type':Sequelize[_0xe36f('0x3')](_0xe36f('0x4'))},'subject':{'type':Sequelize['TEXT']},'sentAt':{'type':Sequelize[_0xe36f('0xa')]},'attach':{'type':Sequelize[_0xe36f('0xb')],'defaultValue':0x0},'secret':{'type':Sequelize[_0xe36f('0x6')],'defaultValue':![]},'readAt':{'type':Sequelize[_0xe36f('0xa')]},'originTo':{'type':Sequelize[_0xe36f('0x3')]('long')},'originCc':{'type':Sequelize[_0xe36f('0x3')]('long')}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 6fb2130..d7490b5 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 _0x1b94=['desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','jayson/promise','http','client','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','sendStatus','status','count','offset','limit','Content-Range','apply','reject','save','update','destroy','end','stack','name','send','index','MailMessage','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','fields','attributes','nolimit','order','sort','where','pick','merge','filter','options','includeAll','include','findAll','rows','keys','length','find','body','params','catch','describe','create','direction','out','secret','split','MailAccount','findOne','MailAccountId','CmList','List','CmContact','Contacts','updatedAt','DESC','MailServerOut','Smtp','isNil','host','port','secure','auth','user','pass','service','attachments','join','server/files/attachments','basename','ListId','List\x20not\x20found','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','stringify','mail-interactions','mail','read','readAt','UserId','Contact','MailInteraction','MailInteractionId','interaction','get','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SIP/%s','channel','EventManager','acceptmessage','agent','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','event','rejectmessage','download','unix','root','server','files','tmp','bcc','subject','createdAt','Attachment','Attachments','from','headers','Bcc','push','readFileSync','build','writeFileSync','log','err','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce'];(function(_0x220618,_0x30d97a){var _0x40cffb=function(_0x5d3d3f){while(--_0x5d3d3f){_0x220618['push'](_0x220618['shift']());}};_0x40cffb(++_0x30d97a);}(_0x1b94,0x1f2));var _0x41b9=function(_0x4fbfd9,_0x3ab91a){_0x4fbfd9=_0x4fbfd9-0x0;var _0x31dc94=_0x1b94[_0x4fbfd9];return _0x31dc94;};'use strict';var pdf=require(_0x41b9('0x0'));var emlformat=require(_0x41b9('0x1'));var rimraf=require(_0x41b9('0x2'));var zipdir=require(_0x41b9('0x3'));var jsonpatch=require(_0x41b9('0x4'));var rp=require('request-promise');var moment=require(_0x41b9('0x5'));var BPromise=require(_0x41b9('0x6'));var Mustache=require(_0x41b9('0x7'));var util=require('util');var path=require(_0x41b9('0x8'));var sox=require(_0x41b9('0x9'));var csv=require(_0x41b9('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x41b9('0xb'));var squel=require(_0x41b9('0xc'));var crypto=require(_0x41b9('0xd'));var jsforce=require(_0x41b9('0xe'));var deskjs=require(_0x41b9('0xf'));var toCsv=require('to-csv');var querystring=require(_0x41b9('0x10'));var Papa=require(_0x41b9('0x11'));var Redis=require('ioredis');var authService=require(_0x41b9('0x12'));var qs=require(_0x41b9('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x41b9('0x14'));var logger=require(_0x41b9('0x15'))('api');var utils=require(_0x41b9('0x16'));var config=require('../../config/environment');var db=require(_0x41b9('0x17'))['db'];config['redis']=_[_0x41b9('0x18')](config[_0x41b9('0x19')],{'host':_0x41b9('0x1a'),'port':0x18eb});var socket=require(_0x41b9('0x1b'))(new Redis(config[_0x41b9('0x19')]));require('./mailMessage.socket')[_0x41b9('0x1c')](socket);var jayson=require(_0x41b9('0x1d'));var client=jayson['client'][_0x41b9('0x1e')]({'port':0x232c});var client9003=jayson[_0x41b9('0x1f')][_0x41b9('0x1e')]({'port':0x232b});var client9002=jayson[_0x41b9('0x1f')]['http']({'port':0x232a});function checkPasswordPattern(_0x5849aa,_0x4a6357,_0x2d7bf0){if(_0x2d7bf0){var _0x432cd7=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x432cd7['test'](_0x4a6357)){return _0x5849aa;}else{throw new db['Sequelize'][(_0x41b9('0x20'))](_0x41b9('0x21'));}}else{return _0x5849aa;}}function respondWithRpcPromise(_0x17b811,_0x3ba9f3,_0x45b813,_0x475aa8){return new BPromise(function(_0x5d5828,_0x10bfdf){var _0x12cab8=_0x475aa8||client;return _0x12cab8['request'](_0x17b811,_0x45b813)[_0x41b9('0x22')](function(_0x2f6b69){logger[_0x41b9('0x23')](_0x41b9('0x24'),_0x3ba9f3,_0x41b9('0x25'));logger[_0x41b9('0x26')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x3ba9f3,_0x41b9('0x25'),JSON['stringify'](_0x2f6b69));if(_0x2f6b69[_0x41b9('0x27')]){if(_0x2f6b69[_0x41b9('0x27')][_0x41b9('0x28')]===0x1f4){logger[_0x41b9('0x27')](_0x41b9('0x24'),_0x3ba9f3,_0x2f6b69['error'][_0x41b9('0x29')]);return _0x10bfdf(_0x2f6b69['error']['message']);}logger['error'](_0x41b9('0x24'),_0x3ba9f3,_0x2f6b69[_0x41b9('0x27')][_0x41b9('0x29')]);return _0x5d5828(_0x2f6b69[_0x41b9('0x27')][_0x41b9('0x29')]);}else{logger[_0x41b9('0x23')](_0x41b9('0x24'),_0x3ba9f3,_0x41b9('0x25'));_0x5d5828(_0x2f6b69[_0x41b9('0x2a')]['message']);}})['catch'](function(_0x1a3aee){logger[_0x41b9('0x27')](_0x41b9('0x24'),_0x3ba9f3,_0x1a3aee);_0x10bfdf(_0x1a3aee);});});}function respondWithStatusCode(_0x1b96a9,_0x3dffb2){_0x3dffb2=_0x3dffb2||0xcc;return function(_0x16d96e){if(_0x16d96e){return _0x1b96a9[_0x41b9('0x2b')](_0x3dffb2);}return _0x1b96a9[_0x41b9('0x2c')](_0x3dffb2)['end']();};}function respondWithResult(_0x5eeb51,_0x1ae013){_0x1ae013=_0x1ae013||0xc8;return function(_0x5463e1){if(_0x5463e1){return _0x5eeb51[_0x41b9('0x2c')](_0x1ae013)['json'](_0x5463e1);}};}function respondWithFilteredResult(_0x4592ac,_0x24f46d){return function(_0x4be093){if(_0x4be093){var _0x4d01d7=_0x4be093[_0x41b9('0x2d')],_0x60b1ca=_0x24f46d[_0x41b9('0x2e')],_0x12178a=_0x24f46d['offset']+_0x24f46d[_0x41b9('0x2f')],_0x5de50a;if(_0x12178a>=_0x4d01d7){_0x12178a=_0x4d01d7;_0x5de50a=0xc8;}else{_0x5de50a=0xce;}_0x4592ac['status'](_0x5de50a);return _0x4592ac['set'](_0x41b9('0x30'),_0x60b1ca+'-'+_0x12178a+'/'+_0x4d01d7)['json'](_0x4be093);}return null;};}function patchUpdates(_0xaeeefd){return function(_0x1579e6){try{jsonpatch[_0x41b9('0x31')](_0x1579e6,_0xaeeefd,!![]);}catch(_0x55d6db){return BPromise[_0x41b9('0x32')](_0x55d6db);}return _0x1579e6[_0x41b9('0x33')]();};}function saveUpdates(_0x1c6817,_0x241395){return function(_0x699060){if(_0x699060){return _0x699060[_0x41b9('0x34')](_0x1c6817)[_0x41b9('0x22')](function(_0x395c1e){return _0x395c1e;});}return null;};}function removeEntity(_0x341ebf,_0x1434b8){return function(_0x272dfe){if(_0x272dfe){return _0x272dfe[_0x41b9('0x35')]()['then'](function(){_0x341ebf[_0x41b9('0x2c')](0xcc)[_0x41b9('0x36')]();});}};}function handleEntityNotFound(_0x471fef,_0x1bf311){return function(_0x582053){if(!_0x582053){_0x471fef[_0x41b9('0x2b')](0x194);}return _0x582053;};}function handleError(_0x50cb25,_0x57ed46){_0x57ed46=_0x57ed46||0x1f4;return function(_0x37398e){logger['error'](_0x37398e[_0x41b9('0x37')]);if(_0x37398e['name']){delete _0x37398e[_0x41b9('0x38')];}_0x50cb25[_0x41b9('0x2c')](_0x57ed46)[_0x41b9('0x39')](_0x37398e);};}exports[_0x41b9('0x3a')]=function(_0x1bb4c9,_0x473389){var _0x5d0e70={},_0x498b9d={},_0x193c3a={'count':0x0,'rows':[]};var _0x32196e=_['map'](db[_0x41b9('0x3b')][_0x41b9('0x3c')],function(_0x26f9a4){return{'name':_0x26f9a4[_0x41b9('0x3d')],'type':_0x26f9a4[_0x41b9('0x3e')][_0x41b9('0x3f')]};});_0x498b9d[_0x41b9('0x40')]=_[_0x41b9('0x41')](_0x32196e,_0x41b9('0x38'));_0x498b9d[_0x41b9('0x42')]=_['keys'](_0x1bb4c9['query']);_0x498b9d[_0x41b9('0x43')]=_[_0x41b9('0x44')](_0x498b9d[_0x41b9('0x40')],_0x498b9d[_0x41b9('0x42')]);_0x5d0e70['attributes']=_['intersection'](_0x498b9d['model'],qs[_0x41b9('0x45')](_0x1bb4c9[_0x41b9('0x42')][_0x41b9('0x45')]));_0x5d0e70['attributes']=_0x5d0e70['attributes']['length']?_0x5d0e70[_0x41b9('0x46')]:_0x498b9d[_0x41b9('0x40')];if(!_0x1bb4c9[_0x41b9('0x42')]['hasOwnProperty'](_0x41b9('0x47'))){_0x5d0e70[_0x41b9('0x2f')]=qs[_0x41b9('0x2f')](_0x1bb4c9['query']['limit']);_0x5d0e70[_0x41b9('0x2e')]=qs[_0x41b9('0x2e')](_0x1bb4c9[_0x41b9('0x42')]['offset']);}_0x5d0e70[_0x41b9('0x48')]=qs[_0x41b9('0x49')](_0x1bb4c9[_0x41b9('0x42')]['sort']);_0x5d0e70[_0x41b9('0x4a')]=qs[_0x41b9('0x43')](_[_0x41b9('0x4b')](_0x1bb4c9[_0x41b9('0x42')],_0x498b9d['filters']),_0x32196e);if(_0x1bb4c9[_0x41b9('0x42')]['filter']){_0x5d0e70[_0x41b9('0x4a')]=_[_0x41b9('0x4c')](_0x5d0e70['where'],{'$or':_[_0x41b9('0x41')](_0x32196e,function(_0x4d0c2c){if(_0x4d0c2c[_0x41b9('0x3e')]!=='VIRTUAL'){var _0x5427f7={};_0x5427f7[_0x4d0c2c[_0x41b9('0x38')]]={'$like':'%'+_0x1bb4c9['query'][_0x41b9('0x4d')]+'%'};return _0x5427f7;}})});}_0x5d0e70=_['merge']({},_0x5d0e70,_0x1bb4c9[_0x41b9('0x4e')]);var _0x42c126={'where':_0x5d0e70[_0x41b9('0x4a')]};return db[_0x41b9('0x3b')][_0x41b9('0x2d')](_0x42c126)[_0x41b9('0x22')](function(_0x365970){_0x193c3a['count']=_0x365970;if(_0x1bb4c9[_0x41b9('0x42')][_0x41b9('0x4f')]){_0x5d0e70[_0x41b9('0x50')]=[{'all':!![]}];}return db[_0x41b9('0x3b')][_0x41b9('0x51')](_0x5d0e70);})[_0x41b9('0x22')](function(_0xcfa119){_0x193c3a[_0x41b9('0x52')]=_0xcfa119;return _0x193c3a;})[_0x41b9('0x22')](respondWithFilteredResult(_0x473389,_0x5d0e70))['catch'](handleError(_0x473389,null));};exports['show']=function(_0x547037,_0x45b03e){var _0xebbc7c={'raw':!![],'where':{'id':_0x547037['params']['id']}},_0x490a08={};_0x490a08[_0x41b9('0x40')]=_[_0x41b9('0x53')](db[_0x41b9('0x3b')][_0x41b9('0x3c')]);_0x490a08[_0x41b9('0x42')]=_[_0x41b9('0x53')](_0x547037[_0x41b9('0x42')]);_0x490a08['filters']=_[_0x41b9('0x44')](_0x490a08[_0x41b9('0x40')],_0x490a08[_0x41b9('0x42')]);_0xebbc7c[_0x41b9('0x46')]=_['intersection'](_0x490a08['model'],qs[_0x41b9('0x45')](_0x547037[_0x41b9('0x42')][_0x41b9('0x45')]));_0xebbc7c['attributes']=_0xebbc7c[_0x41b9('0x46')][_0x41b9('0x54')]?_0xebbc7c[_0x41b9('0x46')]:_0x490a08[_0x41b9('0x40')];if(_0x547037[_0x41b9('0x42')][_0x41b9('0x4f')]){_0xebbc7c['include']=[{'all':!![]}];}_0xebbc7c=_[_0x41b9('0x4c')]({},_0xebbc7c,_0x547037[_0x41b9('0x4e')]);return db[_0x41b9('0x3b')][_0x41b9('0x55')](_0xebbc7c)[_0x41b9('0x22')](handleEntityNotFound(_0x45b03e,null))[_0x41b9('0x22')](respondWithResult(_0x45b03e,null))['catch'](handleError(_0x45b03e,null));};exports['update']=function(_0x1f817d,_0x4e1548){if(_0x1f817d[_0x41b9('0x56')]['id']){delete _0x1f817d[_0x41b9('0x56')]['id'];}return db['MailMessage'][_0x41b9('0x55')]({'where':{'id':_0x1f817d[_0x41b9('0x57')]['id']}})[_0x41b9('0x22')](handleEntityNotFound(_0x4e1548,null))['then'](saveUpdates(_0x1f817d['body'],null))['then'](respondWithResult(_0x4e1548,null))[_0x41b9('0x58')](handleError(_0x4e1548,null));};exports['destroy']=function(_0x34b8a4,_0x2913a4){return db['MailMessage']['find']({'where':{'id':_0x34b8a4[_0x41b9('0x57')]['id']}})[_0x41b9('0x22')](handleEntityNotFound(_0x2913a4,null))[_0x41b9('0x22')](removeEntity(_0x2913a4,null))['catch'](handleError(_0x2913a4,null));};exports[_0x41b9('0x59')]=function(_0x3f8f5a,_0x811d92){return db[_0x41b9('0x3b')]['describe']()[_0x41b9('0x22')](respondWithResult(_0x811d92,null))[_0x41b9('0x58')](handleError(_0x811d92,null));};exports[_0x41b9('0x5a')]=function(_0x5510a3,_0x1e317c){return db[_0x41b9('0x3b')][_0x41b9('0x5a')](_0x5510a3[_0x41b9('0x56')])[_0x41b9('0x22')](function(_0x448677){if(_0x448677){if(_0x448677[_0x41b9('0x5b')]===_0x41b9('0x5c')&&!_0x448677[_0x41b9('0x5d')]){var _0x32602,_0x4c2f8b,_0x243b84;if(_0x5510a3['body']['to']){_0x4c2f8b=_0x5510a3[_0x41b9('0x56')]['to'][_0x41b9('0x5e')](',')[0x0];}return db[_0x41b9('0x5f')][_0x41b9('0x60')]({'where':{'id':_0x448677[_0x41b9('0x61')]},'include':[{'model':db[_0x41b9('0x62')],'as':_0x41b9('0x63'),'include':[{'model':db[_0x41b9('0x64')],'as':_0x41b9('0x65'),'where':{'email':_0x4c2f8b},'limit':0x1,'order':[[_0x41b9('0x66'),_0x41b9('0x67')]]}]},{'model':db[_0x41b9('0x68')],'as':_0x41b9('0x69'),'raw':!![]}]})['then'](function(_0x5e6caf){_0x32602=_0x5e6caf;if(_0x32602&&_0x32602[_0x41b9('0x69')]){var _0x22273a={'tls':{'rejectUnauthorized':![]}};if(_[_0x41b9('0x6a')](_0x32602[_0x41b9('0x69')]['service'])){_0x22273a[_0x41b9('0x6b')]=_0x32602[_0x41b9('0x69')]['host'];_0x22273a[_0x41b9('0x6c')]=_0x32602[_0x41b9('0x69')][_0x41b9('0x6c')];_0x22273a[_0x41b9('0x6d')]=_0x32602[_0x41b9('0x69')][_0x41b9('0x6d')];if(_0x32602[_0x41b9('0x69')]['authentication']){_0x22273a[_0x41b9('0x6e')]={'user':_0x32602[_0x41b9('0x69')][_0x41b9('0x6f')],'pass':_0x32602[_0x41b9('0x69')][_0x41b9('0x70')]};}}else{_0x22273a[_0x41b9('0x71')]=_0x32602[_0x41b9('0x69')]['service'];_0x22273a[_0x41b9('0x6e')]={'user':_0x32602['Smtp'][_0x41b9('0x6f')],'pass':_0x32602[_0x41b9('0x69')][_0x41b9('0x70')]};_0x22273a[_0x41b9('0x6d')]=_0x32602['Smtp'][_0x41b9('0x6d')];}if(_0x5510a3[_0x41b9('0x56')]['attachments']&&_0x5510a3[_0x41b9('0x56')][_0x41b9('0x72')][_0x41b9('0x54')]){for(var _0x50b5b3=0x0;_0x50b5b3<_0x5510a3[_0x41b9('0x56')][_0x41b9('0x72')][_0x41b9('0x54')];_0x50b5b3+=0x1){_0x5510a3[_0x41b9('0x56')][_0x41b9('0x72')][_0x50b5b3]={'filename':_0x5510a3[_0x41b9('0x56')][_0x41b9('0x72')][_0x50b5b3][_0x41b9('0x38')],'path':path[_0x41b9('0x73')](config['root'],_0x41b9('0x74'),_0x5510a3[_0x41b9('0x56')][_0x41b9('0x72')][_0x50b5b3][_0x41b9('0x75')])};}}_0x243b84={'account':_0x22273a,'message':_0x5510a3[_0x41b9('0x56')]};return;}})[_0x41b9('0x22')](function(){if(_0x32602['List']){if(_0x32602['List'][_0x41b9('0x65')][_0x41b9('0x54')]){return _0x32602['List'][_0x41b9('0x65')][0x0];}else{return db['CmContact'][_0x41b9('0x5a')](_[_0x41b9('0x18')](_0x5510a3[_0x41b9('0x56')],{'firstName':_0x5510a3[_0x41b9('0x56')]['to'],'email':_0x5510a3[_0x41b9('0x56')]['to'],'phone':_0x5510a3['body']['to'],'ListId':_0x32602[_0x41b9('0x76')]}));}}else{throw new Error(_0x41b9('0x77'));}})[_0x41b9('0x22')](function(){if(_0x243b84){return respondWithRpcPromise('SendMail',_0x41b9('0x78'),_0x243b84,client9003)[_0x41b9('0x22')](function(_0x290a28){return _0x448677[_0x41b9('0x34')]({'read':!![],'messageId':_0x290a28[_0x41b9('0x79')],'sentAt':moment()[_0x41b9('0x7a')](_0x41b9('0x7b'))});})[_0x41b9('0x58')](function(_0x1e1106){logger[_0x41b9('0x27')]('%s',JSON[_0x41b9('0x7c')](_0x1e1106));return _0x448677;});}return _0x448677;});}return _0x448677;}})[_0x41b9('0x22')](respondWithResult(_0x1e317c,0xc9))['catch'](handleError(_0x1e317c,null));};var interaction_log=require('../../config/logger')(_0x41b9('0x7d'));exports['accept']=function(_0x5517f8,_0x11a02f,_0x542c29){var _0xfadedd={'channel':_0x41b9('0x7e')};if(_0x5517f8[_0x41b9('0x56')]['id']){delete _0x5517f8[_0x41b9('0x56')]['id'];}_0x5517f8[_0x41b9('0x56')][_0x41b9('0x7f')]=!![];_0x5517f8[_0x41b9('0x56')][_0x41b9('0x80')]=moment()[_0x41b9('0x7a')](_0x41b9('0x7b'));_0x5517f8[_0x41b9('0x56')][_0x41b9('0x81')]=_0x5517f8[_0x41b9('0x56')][_0x41b9('0x81')]||_0x5517f8[_0x41b9('0x6f')]['id'];return db[_0x41b9('0x3b')]['find']({'where':{'id':_0x5517f8[_0x41b9('0x57')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0x41b9('0x82')}]})[_0x41b9('0x22')](handleEntityNotFound(_0x11a02f,null))[_0x41b9('0x22')](saveUpdates(_0x5517f8['body'],null))[_0x41b9('0x22')](function(_0x250da0){if(_0x250da0){_0xfadedd[_0x41b9('0x29')]=_0x250da0['get']({'plain':!![]});return db[_0x41b9('0x83')][_0x41b9('0x55')]({'where':{'id':_0x250da0[_0x41b9('0x84')]}});}return null;})[_0x41b9('0x22')](handleEntityNotFound(_0x11a02f,null))[_0x41b9('0x22')](function(_0x234722){if(_0x234722){return _0x234722[_0x41b9('0x34')]({'UserId':_0x5517f8[_0x41b9('0x56')][_0x41b9('0x81')],'read1stAt':_['isNil'](_0x234722['read1stAt'])?moment()[_0x41b9('0x7a')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x41b9('0x22')](function(_0x3343cb){if(_0x3343cb){_0xfadedd[_0x41b9('0x85')]=_0x3343cb[_0x41b9('0x86')]({'plain':!![]});interaction_log[_0x41b9('0x23')](_0x41b9('0x87'),_0x5517f8['user']['id'],_0x5517f8[_0x41b9('0x6f')][_0x41b9('0x38')],_0x5517f8[_0x41b9('0x6f')][_0x41b9('0x88')],_0xfadedd[_0x41b9('0x85')]['id'],_0x5517f8[_0x41b9('0x56')]?JSON['stringify'](_0x5517f8[_0x41b9('0x56')]):_0x41b9('0x89'));return respondWithRpcPromise(_0x41b9('0x8a'),_0x41b9('0x8b'),_0xfadedd);}return null;})[_0x41b9('0x22')](function(_0x274f6e){if(_0x274f6e){if(_0x5517f8['body']['manual']){_0xfadedd['message']['interface']=util[_0x41b9('0x7a')](_0x41b9('0x8c'),_0x5517f8[_0x41b9('0x6f')]['name']);_0xfadedd['message'][_0x41b9('0x8d')]=_0xfadedd[_0x41b9('0x8d')];_0xfadedd[_0x41b9('0x29')]['event']='accept';return respondWithRpcPromise(_0x41b9('0x8e'),'EventManager',{'event':_0x41b9('0x8f'),'message':_0xfadedd['message']},client9002)[_0x41b9('0x22')](function(){return _0xfadedd;});}return _0xfadedd;}return null;})[_0x41b9('0x22')](respondWithResult(_0x11a02f,null))[_0x41b9('0x58')](handleError(_0x11a02f,null));};var interaction_log=require(_0x41b9('0x15'))('mail-interactions');exports['reject']=function(_0x1d5a4e,_0x43d548,_0x375e3e){var _0x47bb9a={'agent':{},'channel':_0x41b9('0x7e')};if(_0x1d5a4e[_0x41b9('0x56')]['id']){delete _0x1d5a4e[_0x41b9('0x56')]['id'];}_0x1d5a4e[_0x41b9('0x56')]['UserId']=_0x1d5a4e[_0x41b9('0x56')][_0x41b9('0x81')]||_0x1d5a4e[_0x41b9('0x6f')]['id'];_0x47bb9a[_0x41b9('0x90')]['id']=_0x1d5a4e['body'][_0x41b9('0x81')];return db['MailMessage'][_0x41b9('0x55')]({'where':{'id':_0x1d5a4e['params']['id'],'UserId':null}})[_0x41b9('0x22')](handleEntityNotFound(_0x43d548,null))[_0x41b9('0x22')](function(_0x5d8464){if(_0x5d8464){_0x47bb9a[_0x41b9('0x29')]=_0x5d8464['get']({'plain':!![]});return db[_0x41b9('0x83')]['find']({'where':{'id':_0x5d8464[_0x41b9('0x84')]}});}return null;})[_0x41b9('0x22')](handleEntityNotFound(_0x43d548,null))[_0x41b9('0x22')](function(_0x55fbef){if(_0x55fbef){_0x47bb9a['interaction']=_0x55fbef[_0x41b9('0x86')]({'plain':!![]});interaction_log[_0x41b9('0x23')](_0x41b9('0x91'),_0x1d5a4e['user']['id'],_0x1d5a4e['user'][_0x41b9('0x38')],_0x1d5a4e[_0x41b9('0x6f')]['role'],_0x47bb9a[_0x41b9('0x85')]['id'],_0x1d5a4e['body']?JSON['stringify'](_0x1d5a4e[_0x41b9('0x56')]):_0x41b9('0x89'));return respondWithRpcPromise(_0x41b9('0x92'),_0x41b9('0x93'),_0x47bb9a);}return null;})['then'](function(_0x22a8ac){if(_0x22a8ac){_0x22a8ac[_0x41b9('0x29')]['interface']=util[_0x41b9('0x7a')]('SIP/%s',_0x1d5a4e[_0x41b9('0x6f')][_0x41b9('0x38')]);_0x22a8ac[_0x41b9('0x29')][_0x41b9('0x8d')]=_0x47bb9a[_0x41b9('0x8d')];_0x22a8ac[_0x41b9('0x29')][_0x41b9('0x94')]=_0x41b9('0x32');respondWithRpcPromise(_0x41b9('0x8e'),_0x41b9('0x8e'),{'event':_0x41b9('0x95'),'message':_0x22a8ac[_0x41b9('0x29')]},client9002);return _0x47bb9a;}return null;})[_0x41b9('0x22')](respondWithResult(_0x43d548,null))[_0x41b9('0x58')](handleError(_0x43d548,null));};exports[_0x41b9('0x96')]=function(_0x380366,_0x188795){var _0x36ab37=moment()[_0x41b9('0x97')]()['toString']();var _0xf85cad=path['join'](config[_0x41b9('0x98')],_0x41b9('0x99'),_0x41b9('0x9a'),_0x41b9('0x9b'));var _0xe7e7d1=path['join'](config[_0x41b9('0x98')],'server','files','attachments');var _0x2f6080=util[_0x41b9('0x7a')]('message-%s.eml',_0x36ab37);return db['MailMessage'][_0x41b9('0x55')]({'where':{'id':_0x380366[_0x41b9('0x57')]['id']},'attributes':['id','body','from','to','cc',_0x41b9('0x9c'),_0x41b9('0x9d'),_0x41b9('0x9e')],'include':_0x380366[_0x41b9('0x42')][_0x41b9('0x72')]?[{'model':db[_0x41b9('0x9f')],'as':_0x41b9('0xa0')}]:undefined})[_0x41b9('0x22')](handleEntityNotFound(_0x188795,null))[_0x41b9('0x22')](function(_0xafe1b8){if(_0xafe1b8){var _0x40365f=_0xafe1b8;var _0xccf928={'from':_0x40365f[_0x41b9('0xa1')],'to':_0x40365f['to'],'subject':_0x40365f['subject'],'html':_0x40365f[_0x41b9('0x56')],'headers':{'Date':moment(_0x40365f[_0x41b9('0x9e')])[_0x41b9('0x7a')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0xafe1b8['cc']){_0xccf928[_0x41b9('0xa2')]['Cc']=_0xafe1b8['cc'];}if(_0xafe1b8[_0x41b9('0x9c')]){_0xccf928[_0x41b9('0xa2')][_0x41b9('0xa3')]=_0xafe1b8['bcc'];}return new BPromise(function(_0x238c74,_0x437026){if(_0xafe1b8[_0x41b9('0xa0')]){for(var _0x146c35=0x0;_0x146c35<_0xafe1b8[_0x41b9('0xa0')][_0x41b9('0x54')];_0x146c35++){var _0x4ea14b=_0xafe1b8['Attachments'][_0x146c35];var _0x1210b6=path[_0x41b9('0x73')](_0xe7e7d1,_0x4ea14b[_0x41b9('0x75')]);if(fs['existsSync'](_0x1210b6)){_0xccf928['attachments'][_0x41b9('0xa4')]({'name':_0x4ea14b[_0x41b9('0x38')],'contentType':_0x4ea14b[_0x41b9('0x3e')],'data':fs[_0x41b9('0xa5')](_0x1210b6)});}}}emlformat[_0x41b9('0xa6')](_0xccf928,function(_0x509c04,_0x55e04e){if(_0x509c04)return _0x437026(_0x509c04);fs[_0x41b9('0xa7')](path[_0x41b9('0x73')](_0xf85cad,_0x2f6080),_0x55e04e);return _0x238c74(_0x55e04e);});});}})[_0x41b9('0x22')](function(_0x570af3){if(_0x570af3){return _0x188795['download'](path[_0x41b9('0x73')](_0xf85cad,_0x2f6080),_0x2f6080,function(_0x16f9e5){if(_0x16f9e5){console[_0x41b9('0xa8')](_0x41b9('0xa9'),_0x16f9e5);}else{fs[_0x41b9('0xaa')](path['join'](_0xf85cad,_0x2f6080));}});}})['catch'](handleError(_0x188795,null));}; \ No newline at end of file +var _0xd1bd=['socket.io-emitter','./mailMessage.socket','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','json','count','offset','limit','apply','update','destroy','end','stack','name','send','map','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','MailMessage','rows','show','params','length','include','body','find','describe','create','out','secret','split','findOne','MailAccountId','CmList','List','Contacts','updatedAt','MailServerOut','Smtp','isNil','service','host','port','auth','user','pass','secure','attachments','join','root','basename','defaults','List\x20not\x20found','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','accept','read','readAt','CmContact','Contact','get','MailInteraction','MailInteractionId','read1stAt','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','interaction','null','AcceptMessage','manual','SIP/%s','channel','event','EventManager','mail-interactions','reject','mail','UserId','agent','role','rejectMessage','interface','rejectmessage','unix','toString','server','files','tmp','message-%s.eml','from','subject','createdAt','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','Attachments','existsSync','readFileSync','writeFileSync','download','err','html-pdf','rimraf','zip-dir','request-promise','moment','mustache','sox','ejs','lodash','squel','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost'];(function(_0x4c00fe,_0x5ae759){var _0x276ae7=function(_0x4fb260){while(--_0x4fb260){_0x4c00fe['push'](_0x4c00fe['shift']());}};_0x276ae7(++_0x5ae759);}(_0xd1bd,0x8a));var _0xdd1b=function(_0xa741fa,_0x14b888){_0xa741fa=_0xa741fa-0x0;var _0xfa882c=_0xd1bd[_0xa741fa];return _0xfa882c;};'use strict';var pdf=require(_0xdd1b('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xdd1b('0x1'));var zipdir=require(_0xdd1b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdd1b('0x3'));var moment=require(_0xdd1b('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xdd1b('0x5'));var util=require('util');var path=require('path');var sox=require(_0xdd1b('0x6'));var csv=require('to-csv');var ejs=require(_0xdd1b('0x7'));var fs=require('fs');var _=require(_0xdd1b('0x8'));var squel=require(_0xdd1b('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xdd1b('0xa'));var toCsv=require(_0xdd1b('0xb'));var querystring=require('querystring');var Papa=require(_0xdd1b('0xc'));var Redis=require('ioredis');var authService=require(_0xdd1b('0xd'));var qs=require(_0xdd1b('0xe'));var as=require(_0xdd1b('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdd1b('0x10'))(_0xdd1b('0x11'));var utils=require(_0xdd1b('0x12'));var config=require(_0xdd1b('0x13'));var db=require(_0xdd1b('0x14'))['db'];config['redis']=_['defaults'](config[_0xdd1b('0x15')],{'host':_0xdd1b('0x16'),'port':0x18eb});var socket=require(_0xdd1b('0x17'))(new Redis(config[_0xdd1b('0x15')]));require(_0xdd1b('0x18'))['register'](socket);var jayson=require(_0xdd1b('0x19'));var client=jayson[_0xdd1b('0x1a')]['http']({'port':0x232c});var client9003=jayson['client'][_0xdd1b('0x1b')]({'port':0x232b});var client9002=jayson[_0xdd1b('0x1a')][_0xdd1b('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x3f847f,_0x58f97b,_0x56453f){if(_0x56453f){var _0x2df349=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2df349[_0xdd1b('0x1c')](_0x58f97b)){return _0x3f847f;}else{throw new db[(_0xdd1b('0x1d'))][(_0xdd1b('0x1e'))](_0xdd1b('0x1f'));}}else{return _0x3f847f;}}function respondWithRpcPromise(_0x1c4021,_0x18d4f6,_0x47d5c2,_0x21429b){return new BPromise(function(_0x1dbe85,_0x4c7e48){var _0x4ed59f=_0x21429b||client;return _0x4ed59f[_0xdd1b('0x20')](_0x1c4021,_0x47d5c2)[_0xdd1b('0x21')](function(_0x5b3408){logger[_0xdd1b('0x22')](_0xdd1b('0x23'),_0x18d4f6,_0xdd1b('0x24'));logger[_0xdd1b('0x25')](_0xdd1b('0x26'),_0x18d4f6,_0xdd1b('0x24'),JSON[_0xdd1b('0x27')](_0x5b3408));if(_0x5b3408[_0xdd1b('0x28')]){if(_0x5b3408['error']['code']===0x1f4){logger['error'](_0xdd1b('0x23'),_0x18d4f6,_0x5b3408[_0xdd1b('0x28')][_0xdd1b('0x29')]);return _0x4c7e48(_0x5b3408[_0xdd1b('0x28')]['message']);}logger[_0xdd1b('0x28')](_0xdd1b('0x23'),_0x18d4f6,_0x5b3408['error'][_0xdd1b('0x29')]);return _0x1dbe85(_0x5b3408[_0xdd1b('0x28')][_0xdd1b('0x29')]);}else{logger[_0xdd1b('0x22')](_0xdd1b('0x23'),_0x18d4f6,'request\x20sent');_0x1dbe85(_0x5b3408[_0xdd1b('0x2a')][_0xdd1b('0x29')]);}})[_0xdd1b('0x2b')](function(_0x2ea17c){logger[_0xdd1b('0x28')]('MailMessage,\x20%s,\x20%s',_0x18d4f6,_0x2ea17c);_0x4c7e48(_0x2ea17c);});});}function respondWithStatusCode(_0x30a5b5,_0x24c28d){_0x24c28d=_0x24c28d||0xcc;return function(_0x386ad8){if(_0x386ad8){return _0x30a5b5[_0xdd1b('0x2c')](_0x24c28d);}return _0x30a5b5[_0xdd1b('0x2d')](_0x24c28d)['end']();};}function respondWithResult(_0x27b2b2,_0x41c857){_0x41c857=_0x41c857||0xc8;return function(_0x75ce65){if(_0x75ce65){return _0x27b2b2['status'](_0x41c857)[_0xdd1b('0x2e')](_0x75ce65);}};}function respondWithFilteredResult(_0x5c8c26,_0x4e56e7){return function(_0xa43682){if(_0xa43682){var _0x2677d4=_0xa43682[_0xdd1b('0x2f')],_0x2458ce=_0x4e56e7[_0xdd1b('0x30')],_0x208db4=_0x4e56e7[_0xdd1b('0x30')]+_0x4e56e7[_0xdd1b('0x31')],_0x4fc609;if(_0x208db4>=_0x2677d4){_0x208db4=_0x2677d4;_0x4fc609=0xc8;}else{_0x4fc609=0xce;}_0x5c8c26[_0xdd1b('0x2d')](_0x4fc609);return _0x5c8c26['set']('Content-Range',_0x2458ce+'-'+_0x208db4+'/'+_0x2677d4)['json'](_0xa43682);}return null;};}function patchUpdates(_0x11a58f){return function(_0x5eca17){try{jsonpatch[_0xdd1b('0x32')](_0x5eca17,_0x11a58f,!![]);}catch(_0x36df60){return BPromise['reject'](_0x36df60);}return _0x5eca17['save']();};}function saveUpdates(_0x58fb41,_0xbe7a14){return function(_0xc75bb5){if(_0xc75bb5){return _0xc75bb5[_0xdd1b('0x33')](_0x58fb41)[_0xdd1b('0x21')](function(_0xc57957){return _0xc57957;});}return null;};}function removeEntity(_0x43fce1,_0x4ff422){return function(_0x4b59fd){if(_0x4b59fd){return _0x4b59fd[_0xdd1b('0x34')]()[_0xdd1b('0x21')](function(){_0x43fce1[_0xdd1b('0x2d')](0xcc)[_0xdd1b('0x35')]();});}};}function handleEntityNotFound(_0x751f6f,_0x5b2f3f){return function(_0x15dd56){if(!_0x15dd56){_0x751f6f['sendStatus'](0x194);}return _0x15dd56;};}function handleError(_0xb8e95c,_0x17c775){_0x17c775=_0x17c775||0x1f4;return function(_0x2b5297){logger[_0xdd1b('0x28')](_0x2b5297[_0xdd1b('0x36')]);if(_0x2b5297['name']){delete _0x2b5297[_0xdd1b('0x37')];}_0xb8e95c[_0xdd1b('0x2d')](_0x17c775)[_0xdd1b('0x38')](_0x2b5297);};}exports['index']=function(_0x2fcfaa,_0x202e40){var _0x121fe1={},_0x46f5e3={},_0x35641e={'count':0x0,'rows':[]};var _0x4d7526=_[_0xdd1b('0x39')](db['MailMessage'][_0xdd1b('0x3a')],function(_0x21e660){return{'name':_0x21e660['fieldName'],'type':_0x21e660[_0xdd1b('0x3b')][_0xdd1b('0x3c')]};});_0x46f5e3['model']=_[_0xdd1b('0x39')](_0x4d7526,_0xdd1b('0x37'));_0x46f5e3[_0xdd1b('0x3d')]=_[_0xdd1b('0x3e')](_0x2fcfaa[_0xdd1b('0x3d')]);_0x46f5e3[_0xdd1b('0x3f')]=_[_0xdd1b('0x40')](_0x46f5e3[_0xdd1b('0x41')],_0x46f5e3[_0xdd1b('0x3d')]);_0x121fe1[_0xdd1b('0x42')]=_['intersection'](_0x46f5e3[_0xdd1b('0x41')],qs[_0xdd1b('0x43')](_0x2fcfaa['query'][_0xdd1b('0x43')]));_0x121fe1['attributes']=_0x121fe1[_0xdd1b('0x42')]['length']?_0x121fe1[_0xdd1b('0x42')]:_0x46f5e3['model'];if(!_0x2fcfaa[_0xdd1b('0x3d')]['hasOwnProperty']('nolimit')){_0x121fe1[_0xdd1b('0x31')]=qs['limit'](_0x2fcfaa[_0xdd1b('0x3d')][_0xdd1b('0x31')]);_0x121fe1['offset']=qs[_0xdd1b('0x30')](_0x2fcfaa[_0xdd1b('0x3d')][_0xdd1b('0x30')]);}_0x121fe1[_0xdd1b('0x44')]=qs[_0xdd1b('0x45')](_0x2fcfaa[_0xdd1b('0x3d')][_0xdd1b('0x45')]);_0x121fe1[_0xdd1b('0x46')]=qs['filters'](_[_0xdd1b('0x47')](_0x2fcfaa[_0xdd1b('0x3d')],_0x46f5e3[_0xdd1b('0x3f')]),_0x4d7526);if(_0x2fcfaa['query'][_0xdd1b('0x48')]){_0x121fe1[_0xdd1b('0x46')]=_['merge'](_0x121fe1[_0xdd1b('0x46')],{'$or':_[_0xdd1b('0x39')](_0x4d7526,function(_0x10019a){if(_0x10019a[_0xdd1b('0x3b')]!==_0xdd1b('0x49')){var _0x213d57={};_0x213d57[_0x10019a[_0xdd1b('0x37')]]={'$like':'%'+_0x2fcfaa[_0xdd1b('0x3d')][_0xdd1b('0x48')]+'%'};return _0x213d57;}})});}_0x121fe1=_[_0xdd1b('0x4a')]({},_0x121fe1,_0x2fcfaa[_0xdd1b('0x4b')]);var _0x1c1e19={'where':_0x121fe1[_0xdd1b('0x46')]};return db['MailMessage'][_0xdd1b('0x2f')](_0x1c1e19)[_0xdd1b('0x21')](function(_0x3880d6){_0x35641e[_0xdd1b('0x2f')]=_0x3880d6;if(_0x2fcfaa[_0xdd1b('0x3d')][_0xdd1b('0x4c')]){_0x121fe1['include']=[{'all':!![]}];}return db[_0xdd1b('0x4d')]['findAll'](_0x121fe1);})[_0xdd1b('0x21')](function(_0x1c0034){_0x35641e[_0xdd1b('0x4e')]=_0x1c0034;return _0x35641e;})[_0xdd1b('0x21')](respondWithFilteredResult(_0x202e40,_0x121fe1))[_0xdd1b('0x2b')](handleError(_0x202e40,null));};exports[_0xdd1b('0x4f')]=function(_0x51e172,_0x2e9b1f){var _0x460dec={'raw':!![],'where':{'id':_0x51e172[_0xdd1b('0x50')]['id']}},_0x4f1c7b={};_0x4f1c7b[_0xdd1b('0x41')]=_[_0xdd1b('0x3e')](db[_0xdd1b('0x4d')]['rawAttributes']);_0x4f1c7b[_0xdd1b('0x3d')]=_[_0xdd1b('0x3e')](_0x51e172['query']);_0x4f1c7b[_0xdd1b('0x3f')]=_[_0xdd1b('0x40')](_0x4f1c7b[_0xdd1b('0x41')],_0x4f1c7b[_0xdd1b('0x3d')]);_0x460dec[_0xdd1b('0x42')]=_[_0xdd1b('0x40')](_0x4f1c7b[_0xdd1b('0x41')],qs['fields'](_0x51e172[_0xdd1b('0x3d')][_0xdd1b('0x43')]));_0x460dec[_0xdd1b('0x42')]=_0x460dec[_0xdd1b('0x42')][_0xdd1b('0x51')]?_0x460dec[_0xdd1b('0x42')]:_0x4f1c7b[_0xdd1b('0x41')];if(_0x51e172[_0xdd1b('0x3d')][_0xdd1b('0x4c')]){_0x460dec[_0xdd1b('0x52')]=[{'all':!![]}];}_0x460dec=_[_0xdd1b('0x4a')]({},_0x460dec,_0x51e172[_0xdd1b('0x4b')]);return db['MailMessage']['find'](_0x460dec)['then'](handleEntityNotFound(_0x2e9b1f,null))['then'](respondWithResult(_0x2e9b1f,null))[_0xdd1b('0x2b')](handleError(_0x2e9b1f,null));};exports[_0xdd1b('0x33')]=function(_0x578ecf,_0x34f1dc){if(_0x578ecf['body']['id']){delete _0x578ecf[_0xdd1b('0x53')]['id'];}return db[_0xdd1b('0x4d')][_0xdd1b('0x54')]({'where':{'id':_0x578ecf['params']['id']}})[_0xdd1b('0x21')](handleEntityNotFound(_0x34f1dc,null))[_0xdd1b('0x21')](saveUpdates(_0x578ecf[_0xdd1b('0x53')],null))[_0xdd1b('0x21')](respondWithResult(_0x34f1dc,null))['catch'](handleError(_0x34f1dc,null));};exports[_0xdd1b('0x34')]=function(_0x2190bf,_0x2a490d){return db[_0xdd1b('0x4d')]['find']({'where':{'id':_0x2190bf['params']['id']}})[_0xdd1b('0x21')](handleEntityNotFound(_0x2a490d,null))['then'](removeEntity(_0x2a490d,null))[_0xdd1b('0x2b')](handleError(_0x2a490d,null));};exports[_0xdd1b('0x55')]=function(_0x51f310,_0x4d5347){return db[_0xdd1b('0x4d')][_0xdd1b('0x55')]()['then'](respondWithResult(_0x4d5347,null))[_0xdd1b('0x2b')](handleError(_0x4d5347,null));};exports[_0xdd1b('0x56')]=function(_0x209d56,_0x4f919f){return db[_0xdd1b('0x4d')][_0xdd1b('0x56')](_0x209d56[_0xdd1b('0x53')])[_0xdd1b('0x21')](function(_0x2f53fe){if(_0x2f53fe){if(_0x2f53fe['direction']===_0xdd1b('0x57')&&!_0x2f53fe[_0xdd1b('0x58')]){var _0x4a405f,_0x4ae1b8,_0x401c4c;if(_0x209d56['body']['to']){_0x4ae1b8=_0x209d56[_0xdd1b('0x53')]['to'][_0xdd1b('0x59')](',')[0x0];}return db['MailAccount'][_0xdd1b('0x5a')]({'where':{'id':_0x2f53fe[_0xdd1b('0x5b')]},'include':[{'model':db[_0xdd1b('0x5c')],'as':_0xdd1b('0x5d'),'include':[{'model':db['CmContact'],'as':_0xdd1b('0x5e'),'where':{'email':_0x4ae1b8},'limit':0x1,'order':[[_0xdd1b('0x5f'),'DESC']]}]},{'model':db[_0xdd1b('0x60')],'as':_0xdd1b('0x61'),'raw':!![]}]})['then'](function(_0x41d92){_0x4a405f=_0x41d92;if(_0x4a405f&&_0x4a405f[_0xdd1b('0x61')]){var _0x816941={'tls':{'rejectUnauthorized':![]}};if(_[_0xdd1b('0x62')](_0x4a405f['Smtp'][_0xdd1b('0x63')])){_0x816941['host']=_0x4a405f[_0xdd1b('0x61')][_0xdd1b('0x64')];_0x816941['port']=_0x4a405f[_0xdd1b('0x61')][_0xdd1b('0x65')];_0x816941['secure']=_0x4a405f[_0xdd1b('0x61')]['secure'];if(_0x4a405f[_0xdd1b('0x61')]['authentication']){_0x816941[_0xdd1b('0x66')]={'user':_0x4a405f[_0xdd1b('0x61')][_0xdd1b('0x67')],'pass':_0x4a405f[_0xdd1b('0x61')][_0xdd1b('0x68')]};}}else{_0x816941[_0xdd1b('0x63')]=_0x4a405f[_0xdd1b('0x61')]['service'];_0x816941[_0xdd1b('0x66')]={'user':_0x4a405f[_0xdd1b('0x61')][_0xdd1b('0x67')],'pass':_0x4a405f[_0xdd1b('0x61')][_0xdd1b('0x68')]};_0x816941['secure']=_0x4a405f[_0xdd1b('0x61')][_0xdd1b('0x69')];}if(_0x209d56[_0xdd1b('0x53')][_0xdd1b('0x6a')]&&_0x209d56['body'][_0xdd1b('0x6a')][_0xdd1b('0x51')]){for(var _0x100e54=0x0;_0x100e54<_0x209d56[_0xdd1b('0x53')][_0xdd1b('0x6a')]['length'];_0x100e54+=0x1){_0x209d56[_0xdd1b('0x53')]['attachments'][_0x100e54]={'filename':_0x209d56[_0xdd1b('0x53')][_0xdd1b('0x6a')][_0x100e54][_0xdd1b('0x37')],'path':path[_0xdd1b('0x6b')](config[_0xdd1b('0x6c')],'server/files/attachments',_0x209d56[_0xdd1b('0x53')][_0xdd1b('0x6a')][_0x100e54][_0xdd1b('0x6d')])};}}_0x401c4c={'account':_0x816941,'message':_0x209d56[_0xdd1b('0x53')]};return;}})[_0xdd1b('0x21')](function(){if(_0x4a405f[_0xdd1b('0x5d')]){if(_0x4a405f[_0xdd1b('0x5d')]['Contacts'][_0xdd1b('0x51')]){return _0x4a405f[_0xdd1b('0x5d')][_0xdd1b('0x5e')][0x0];}else{return db['CmContact'][_0xdd1b('0x56')](_[_0xdd1b('0x6e')](_0x209d56['body'],{'firstName':_0x209d56['body']['to'],'email':_0x209d56['body']['to'],'phone':_0x209d56[_0xdd1b('0x53')]['to'],'ListId':_0x4a405f['ListId']}));}}else{throw new Error(_0xdd1b('0x6f'));}})[_0xdd1b('0x21')](function(){if(_0x401c4c){return respondWithRpcPromise('SendMail',_0xdd1b('0x70'),_0x401c4c,client9003)[_0xdd1b('0x21')](function(_0x5dffca){return _0x2f53fe[_0xdd1b('0x33')]({'read':!![],'messageId':_0x5dffca[_0xdd1b('0x71')],'sentAt':moment()[_0xdd1b('0x72')](_0xdd1b('0x73'))});})[_0xdd1b('0x2b')](function(_0x43d91d){logger['error']('%s',JSON['stringify'](_0x43d91d));return _0x2f53fe;});}return _0x2f53fe;});}return _0x2f53fe;}})[_0xdd1b('0x21')](respondWithResult(_0x4f919f,0xc9))['catch'](handleError(_0x4f919f,null));};var interaction_log=require(_0xdd1b('0x10'))('mail-interactions');exports[_0xdd1b('0x74')]=function(_0xfcb06b,_0x2d3b7f,_0x56e696){var _0x2f2a35={'channel':'mail'};if(_0xfcb06b[_0xdd1b('0x53')]['id']){delete _0xfcb06b[_0xdd1b('0x53')]['id'];}_0xfcb06b[_0xdd1b('0x53')][_0xdd1b('0x75')]=!![];_0xfcb06b[_0xdd1b('0x53')][_0xdd1b('0x76')]=moment()[_0xdd1b('0x72')](_0xdd1b('0x73'));_0xfcb06b[_0xdd1b('0x53')]['UserId']=_0xfcb06b['body']['UserId']||_0xfcb06b[_0xdd1b('0x67')]['id'];return db['MailMessage']['find']({'where':{'id':_0xfcb06b[_0xdd1b('0x50')]['id'],'UserId':null},'include':[{'model':db[_0xdd1b('0x77')],'as':_0xdd1b('0x78')}]})[_0xdd1b('0x21')](handleEntityNotFound(_0x2d3b7f,null))[_0xdd1b('0x21')](saveUpdates(_0xfcb06b[_0xdd1b('0x53')],null))[_0xdd1b('0x21')](function(_0x5ad6d2){if(_0x5ad6d2){_0x2f2a35[_0xdd1b('0x29')]=_0x5ad6d2[_0xdd1b('0x79')]({'plain':!![]});return db[_0xdd1b('0x7a')]['find']({'where':{'id':_0x5ad6d2[_0xdd1b('0x7b')]}});}return null;})[_0xdd1b('0x21')](handleEntityNotFound(_0x2d3b7f,null))[_0xdd1b('0x21')](function(_0x181de3){if(_0x181de3){return _0x181de3[_0xdd1b('0x33')]({'UserId':_0xfcb06b[_0xdd1b('0x53')]['UserId'],'read1stAt':_[_0xdd1b('0x62')](_0x181de3[_0xdd1b('0x7c')])?moment()[_0xdd1b('0x72')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x37418b){if(_0x37418b){_0x2f2a35['interaction']=_0x37418b['get']({'plain':!![]});interaction_log[_0xdd1b('0x22')](_0xdd1b('0x7d'),_0xfcb06b[_0xdd1b('0x67')]['id'],_0xfcb06b['user'][_0xdd1b('0x37')],_0xfcb06b[_0xdd1b('0x67')]['role'],_0x2f2a35[_0xdd1b('0x7e')]['id'],_0xfcb06b[_0xdd1b('0x53')]?JSON[_0xdd1b('0x27')](_0xfcb06b[_0xdd1b('0x53')]):_0xdd1b('0x7f'));return respondWithRpcPromise(_0xdd1b('0x80'),'acceptMessage',_0x2f2a35);}return null;})[_0xdd1b('0x21')](function(_0x4c02a3){if(_0x4c02a3){if(_0xfcb06b[_0xdd1b('0x53')][_0xdd1b('0x81')]){_0x2f2a35[_0xdd1b('0x29')]['interface']=util[_0xdd1b('0x72')](_0xdd1b('0x82'),_0xfcb06b[_0xdd1b('0x67')][_0xdd1b('0x37')]);_0x2f2a35[_0xdd1b('0x29')][_0xdd1b('0x83')]=_0x2f2a35[_0xdd1b('0x83')];_0x2f2a35[_0xdd1b('0x29')][_0xdd1b('0x84')]='accept';return respondWithRpcPromise(_0xdd1b('0x85'),_0xdd1b('0x85'),{'event':'acceptmessage','message':_0x2f2a35[_0xdd1b('0x29')]},client9002)[_0xdd1b('0x21')](function(){return _0x2f2a35;});}return _0x2f2a35;}return null;})[_0xdd1b('0x21')](respondWithResult(_0x2d3b7f,null))[_0xdd1b('0x2b')](handleError(_0x2d3b7f,null));};var interaction_log=require(_0xdd1b('0x10'))(_0xdd1b('0x86'));exports[_0xdd1b('0x87')]=function(_0x10267f,_0x34d54e,_0x2af8f7){var _0x5821cf={'agent':{},'channel':_0xdd1b('0x88')};if(_0x10267f[_0xdd1b('0x53')]['id']){delete _0x10267f['body']['id'];}_0x10267f[_0xdd1b('0x53')][_0xdd1b('0x89')]=_0x10267f['body']['UserId']||_0x10267f[_0xdd1b('0x67')]['id'];_0x5821cf[_0xdd1b('0x8a')]['id']=_0x10267f['body'][_0xdd1b('0x89')];return db[_0xdd1b('0x4d')]['find']({'where':{'id':_0x10267f[_0xdd1b('0x50')]['id'],'UserId':null}})[_0xdd1b('0x21')](handleEntityNotFound(_0x34d54e,null))[_0xdd1b('0x21')](function(_0x542b46){if(_0x542b46){_0x5821cf[_0xdd1b('0x29')]=_0x542b46[_0xdd1b('0x79')]({'plain':!![]});return db['MailInteraction']['find']({'where':{'id':_0x542b46[_0xdd1b('0x7b')]}});}return null;})[_0xdd1b('0x21')](handleEntityNotFound(_0x34d54e,null))[_0xdd1b('0x21')](function(_0x5a5ee3){if(_0x5a5ee3){_0x5821cf['interaction']=_0x5a5ee3[_0xdd1b('0x79')]({'plain':!![]});interaction_log[_0xdd1b('0x22')]('[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x10267f['user']['id'],_0x10267f[_0xdd1b('0x67')][_0xdd1b('0x37')],_0x10267f['user'][_0xdd1b('0x8b')],_0x5821cf[_0xdd1b('0x7e')]['id'],_0x10267f[_0xdd1b('0x53')]?JSON[_0xdd1b('0x27')](_0x10267f['body']):_0xdd1b('0x7f'));return respondWithRpcPromise('RejectMessage',_0xdd1b('0x8c'),_0x5821cf);}return null;})[_0xdd1b('0x21')](function(_0x48c3a0){if(_0x48c3a0){_0x48c3a0[_0xdd1b('0x29')][_0xdd1b('0x8d')]=util[_0xdd1b('0x72')]('SIP/%s',_0x10267f['user'][_0xdd1b('0x37')]);_0x48c3a0[_0xdd1b('0x29')][_0xdd1b('0x83')]=_0x5821cf[_0xdd1b('0x83')];_0x48c3a0[_0xdd1b('0x29')][_0xdd1b('0x84')]=_0xdd1b('0x87');respondWithRpcPromise(_0xdd1b('0x85'),_0xdd1b('0x85'),{'event':_0xdd1b('0x8e'),'message':_0x48c3a0[_0xdd1b('0x29')]},client9002);return _0x5821cf;}return null;})['then'](respondWithResult(_0x34d54e,null))[_0xdd1b('0x2b')](handleError(_0x34d54e,null));};exports['download']=function(_0x55c8cf,_0x55ace7){var _0x5c0c03=moment()[_0xdd1b('0x8f')]()[_0xdd1b('0x90')]();var _0x1cfc73=path[_0xdd1b('0x6b')](config[_0xdd1b('0x6c')],_0xdd1b('0x91'),_0xdd1b('0x92'),_0xdd1b('0x93'));var _0x34e77e=path['join'](config[_0xdd1b('0x6c')],'server',_0xdd1b('0x92'),_0xdd1b('0x6a'));var _0x19de2b=util[_0xdd1b('0x72')](_0xdd1b('0x94'),_0x5c0c03);return db[_0xdd1b('0x4d')][_0xdd1b('0x54')]({'where':{'id':_0x55c8cf['params']['id']},'attributes':['id','body',_0xdd1b('0x95'),'to','cc','bcc',_0xdd1b('0x96'),'createdAt'],'include':_0x55c8cf[_0xdd1b('0x3d')][_0xdd1b('0x6a')]?[{'model':db['Attachment'],'as':'Attachments'}]:undefined})[_0xdd1b('0x21')](handleEntityNotFound(_0x55ace7,null))['then'](function(_0xb9223){if(_0xb9223){var _0x5812c7=_0xb9223;var _0x400bf5={'from':_0x5812c7[_0xdd1b('0x95')],'to':_0x5812c7['to'],'subject':_0x5812c7['subject'],'html':_0x5812c7[_0xdd1b('0x53')],'headers':{'Date':moment(_0x5812c7[_0xdd1b('0x97')])['format'](_0xdd1b('0x98'))},'attachments':[]};if(_0xb9223['cc']){_0x400bf5[_0xdd1b('0x99')]['Cc']=_0xb9223['cc'];}if(_0xb9223[_0xdd1b('0x9a')]){_0x400bf5[_0xdd1b('0x99')]['Bcc']=_0xb9223['bcc'];}return new BPromise(function(_0x1cd4df,_0x260297){if(_0xb9223[_0xdd1b('0x9b')]){for(var _0x182521=0x0;_0x182521<_0xb9223[_0xdd1b('0x9b')][_0xdd1b('0x51')];_0x182521++){var _0x56a96a=_0xb9223['Attachments'][_0x182521];var _0x270e4e=path[_0xdd1b('0x6b')](_0x34e77e,_0x56a96a['basename']);if(fs[_0xdd1b('0x9c')](_0x270e4e)){_0x400bf5[_0xdd1b('0x6a')]['push']({'name':_0x56a96a[_0xdd1b('0x37')],'contentType':_0x56a96a['type'],'data':fs[_0xdd1b('0x9d')](_0x270e4e)});}}}emlformat['build'](_0x400bf5,function(_0x230173,_0x4c6d28){if(_0x230173)return _0x260297(_0x230173);fs[_0xdd1b('0x9e')](path['join'](_0x1cfc73,_0x19de2b),_0x4c6d28);return _0x1cd4df(_0x4c6d28);});});}})[_0xdd1b('0x21')](function(_0x19b4b5){if(_0x19b4b5){return _0x55ace7[_0xdd1b('0x9f')](path[_0xdd1b('0x6b')](_0x1cfc73,_0x19de2b),_0x19de2b,function(_0x1dae72){if(_0x1dae72){console['log'](_0xdd1b('0xa0'),_0x1dae72);}else{fs['unlinkSync'](path[_0xdd1b('0x6b')](_0x1cfc73,_0x19de2b));}});}})[_0xdd1b('0x2b')](handleError(_0x55ace7,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index f70fde7..da8a765 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 _0x74a3=['../../mysqldb','MailMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','events'];(function(_0x510f1b,_0x30fbf2){var _0x51917d=function(_0x2552fe){while(--_0x2552fe){_0x510f1b['push'](_0x510f1b['shift']());}};_0x51917d(++_0x30fbf2);}(_0x74a3,0xf2));var _0x374a=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x74a3[_0x4154a6];return _0x3b2786;};'use strict';var EventEmitter=require(_0x374a('0x0'));var MailMessage=require(_0x374a('0x1'))['db'][_0x374a('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x374a('0x3')](0x0);var events={'afterCreate':_0x374a('0x4'),'afterUpdate':_0x374a('0x5'),'afterDestroy':_0x374a('0x6')};function emitEvent(_0x30a720){return function(_0xb423db,_0x178798,_0x4d7025){MailMessageEvents[_0x374a('0x7')](_0x30a720+':'+_0xb423db['id'],_0xb423db);MailMessageEvents[_0x374a('0x7')](_0x30a720,_0xb423db);_0x4d7025(null);};}for(var e in events){if(events[_0x374a('0x8')](e)){var event=events[e];MailMessage['hook'](e,emitEvent(event));}}module['exports']=MailMessageEvents; \ No newline at end of file +var _0xd7b8=['setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xd7b8,0x10f));var _0x8d7b=function(_0x43d8d9,_0x4c4177){_0x43d8d9=_0x43d8d9-0x0;var _0x38e64e=_0xd7b8[_0x43d8d9];return _0x38e64e;};'use strict';var EventEmitter=require(_0x8d7b('0x0'));var MailMessage=require('../../mysqldb')['db']['MailMessage'];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x8d7b('0x1')](0x0);var events={'afterCreate':_0x8d7b('0x2'),'afterUpdate':_0x8d7b('0x3'),'afterDestroy':_0x8d7b('0x4')};function emitEvent(_0x133ce3){return function(_0x5b94d4,_0x4413c6,_0x1b5ab6){MailMessageEvents['emit'](_0x133ce3+':'+_0x5b94d4['id'],_0x5b94d4);MailMessageEvents[_0x8d7b('0x5')](_0x133ce3,_0x5b94d4);_0x1b5ab6(null);};}for(var e in events){if(events[_0x8d7b('0x6')](e)){var event=events[e];MailMessage['hook'](e,emitEvent(event));}}module[_0x8d7b('0x7')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index e54c411..a3af864 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 _0x6e43=['path','rimraf','MailMessage','mail_messages','messageId','fti_mail_messages','plainBody','subject','body','models','get','direction','toLowerCase','out','secret','isNil','UserId','MailInteractionId','then','update','createdAt','catch','error','lodash','util','../../config/logger','api','moment','bluebird','request-promise','html-to-text'];(function(_0x316f63,_0x4c784c){var _0x3557ec=function(_0x2c1a86){while(--_0x2c1a86){_0x316f63['push'](_0x316f63['shift']());}};_0x3557ec(++_0x4c784c);}(_0x6e43,0x10f));var _0x36e4=function(_0x55455b,_0x31cdae){_0x55455b=_0x55455b-0x0;var _0x2c12e4=_0x6e43[_0x55455b];return _0x2c12e4;};'use strict';var _=require(_0x36e4('0x0'));var util=require(_0x36e4('0x1'));var logger=require(_0x36e4('0x2'))(_0x36e4('0x3'));var moment=require(_0x36e4('0x4'));var BPromise=require(_0x36e4('0x5'));var rp=require(_0x36e4('0x6'));var htmlToText=require(_0x36e4('0x7'));var fs=require('fs');var path=require(_0x36e4('0x8'));var rimraf=require(_0x36e4('0x9'));var config=require('../../config/environment');var attributes=require('./mailMessage.attributes');module['exports']=function(_0x1b9219,_0x20927e){return _0x1b9219['define'](_0x36e4('0xa'),attributes,{'tableName':_0x36e4('0xb'),'paranoid':![],'indexes':[{'name':_0x36e4('0xc'),'fields':['messageId']},{'name':_0x36e4('0xd'),'fields':[_0x36e4('0xe'),_0x36e4('0xf')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x623569,_0x2802e9,_0x1edfad){if(_0x623569[_0x36e4('0x10')]){_0x623569['plainBody']=htmlToText['fromString'](_0x623569['body'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x1edfad(null,_0x2802e9);},'afterCreate':function(_0x348c04,_0x5b29f4,_0x3acf40){var _0x39d630=_0x1b9219[_0x36e4('0x11')];var _0x59e7e9=_0x348c04[_0x36e4('0x12')]({'plain':!![]});if(_0x59e7e9[_0x36e4('0x13')]['toLowerCase']()==='in'||_0x59e7e9[_0x36e4('0x13')][_0x36e4('0x14')]()===_0x36e4('0x15')&&!_0x59e7e9[_0x36e4('0x16')]&&!_[_0x36e4('0x17')](_0x59e7e9[_0x36e4('0x18')])){_0x39d630['MailInteraction']['findOne']({'where':{'id':_0x59e7e9[_0x36e4('0x19')]}})[_0x36e4('0x1a')](function(_0x4b9547){if(_0x4b9547){_0x4b9547[_0x36e4('0x1b')]({'lastMsgAt':_0x59e7e9[_0x36e4('0x1c')],'lastMsgDirection':_0x59e7e9['direction'][_0x36e4('0x14')](),'lastMsgBody':_0x59e7e9[_0x36e4('0x10')]});}})[_0x36e4('0x1d')](function(_0x9c7143){console[_0x36e4('0x1e')](_0x9c7143);});}_0x3acf40();}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xa33e=['direction','toLowerCase','out','secret','UserId','findOne','MailInteractionId','update','createdAt','catch','utf8mb4','lodash','util','api','moment','bluebird','request-promise','html-to-text','path','rimraf','./mailMessage.attributes','exports','define','MailMessage','mail_messages','messageId','fti_mail_messages','plainBody','subject','FULLTEXT','fromString','models','get'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa33e,0x1d9));var _0xea33=function(_0x2caf99,_0x3d213d){_0x2caf99=_0x2caf99-0x0;var _0x25a5d7=_0xa33e[_0x2caf99];return _0x25a5d7;};'use strict';var _=require(_0xea33('0x0'));var util=require(_0xea33('0x1'));var logger=require('../../config/logger')(_0xea33('0x2'));var moment=require(_0xea33('0x3'));var BPromise=require(_0xea33('0x4'));var rp=require(_0xea33('0x5'));var htmlToText=require(_0xea33('0x6'));var fs=require('fs');var path=require(_0xea33('0x7'));var rimraf=require(_0xea33('0x8'));var config=require('../../config/environment');var attributes=require(_0xea33('0x9'));module[_0xea33('0xa')]=function(_0x231ccd,_0x483c74){return _0x231ccd[_0xea33('0xb')](_0xea33('0xc'),attributes,{'tableName':_0xea33('0xd'),'paranoid':![],'indexes':[{'name':_0xea33('0xe'),'fields':['messageId']},{'name':_0xea33('0xf'),'fields':[_0xea33('0x10'),_0xea33('0x11')],'type':_0xea33('0x12')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x122e4c,_0x142cd5,_0x50a5fd){if(_0x122e4c['body']){_0x122e4c[_0xea33('0x10')]=htmlToText[_0xea33('0x13')](_0x122e4c['body'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x50a5fd(null,_0x142cd5);},'afterCreate':function(_0x1904c6,_0x47ebbb,_0x10f0ac){var _0x4c698e=_0x231ccd[_0xea33('0x14')];var _0x4d1830=_0x1904c6[_0xea33('0x15')]({'plain':!![]});if(_0x4d1830[_0xea33('0x16')][_0xea33('0x17')]()==='in'||_0x4d1830[_0xea33('0x16')][_0xea33('0x17')]()===_0xea33('0x18')&&!_0x4d1830[_0xea33('0x19')]&&!_['isNil'](_0x4d1830[_0xea33('0x1a')])){_0x4c698e['MailInteraction'][_0xea33('0x1b')]({'where':{'id':_0x4d1830[_0xea33('0x1c')]}})['then'](function(_0x10e968){if(_0x10e968){_0x10e968[_0xea33('0x1d')]({'lastMsgAt':_0x4d1830[_0xea33('0x1e')],'lastMsgDirection':_0x4d1830[_0xea33('0x16')][_0xea33('0x17')](),'lastMsgBody':_0x4d1830['body']});}})[_0xea33('0x1f')](function(_0x17e3b7){console['error'](_0x17e3b7);});}_0x10f0ac();}},'charset':_0xea33('0x20'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index b58dbcf..270780e 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 _0x1fcc=['then','info','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','MailMessage,\x20%s,\x20%s','message','result','catch','CreateMailMessage','body','options','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','socket.io-emitter','register','request'];(function(_0x81fa30,_0x335716){var _0x241675=function(_0x1085f7){while(--_0x1085f7){_0x81fa30['push'](_0x81fa30['shift']());}};_0x241675(++_0x335716);}(_0x1fcc,0x125));var _0xc1fc=function(_0x256e32,_0x4013bc){_0x256e32=_0x256e32-0x0;var _0x464070=_0x1fcc[_0x256e32];return _0x464070;};'use strict';var _=require(_0xc1fc('0x0'));var util=require(_0xc1fc('0x1'));var moment=require('moment');var BPromise=require(_0xc1fc('0x2'));var rs=require(_0xc1fc('0x3'));var fs=require('fs');var Redis=require(_0xc1fc('0x4'));var db=require(_0xc1fc('0x5'))['db'];var utils=require(_0xc1fc('0x6'));var logger=require(_0xc1fc('0x7'))(_0xc1fc('0x8'));var config=require('../../config/environment');var jayson=require(_0xc1fc('0x9'));var client=jayson[_0xc1fc('0xa')][_0xc1fc('0xb')]({'port':0x232a});config['redis']=_[_0xc1fc('0xc')](config[_0xc1fc('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0xc1fc('0xe'))(new Redis(config[_0xc1fc('0xd')]));require('./mailMessage.socket')[_0xc1fc('0xf')](socket);function respondWithRpcPromise(_0x57df7c,_0x2bbfe7,_0x17a845){return new BPromise(function(_0x5a2fa3,_0x432861){return client[_0xc1fc('0x10')](_0x57df7c,_0x17a845)[_0xc1fc('0x11')](function(_0x119d27){logger[_0xc1fc('0x12')]('MailMessage,\x20%s,\x20%s',_0x2bbfe7,_0xc1fc('0x13'));logger[_0xc1fc('0x14')](_0xc1fc('0x15'),_0x2bbfe7,'request\x20sent',JSON[_0xc1fc('0x16')](_0x119d27));if(_0x119d27[_0xc1fc('0x17')]){if(_0x119d27[_0xc1fc('0x17')]['code']===0x1f4){logger[_0xc1fc('0x17')](_0xc1fc('0x18'),_0x2bbfe7,_0x119d27[_0xc1fc('0x17')][_0xc1fc('0x19')]);return _0x432861(_0x119d27[_0xc1fc('0x17')][_0xc1fc('0x19')]);}logger[_0xc1fc('0x17')](_0xc1fc('0x18'),_0x2bbfe7,_0x119d27[_0xc1fc('0x17')][_0xc1fc('0x19')]);return _0x5a2fa3(_0x119d27['error'][_0xc1fc('0x19')]);}else{logger['info']('MailMessage,\x20%s,\x20%s',_0x2bbfe7,_0xc1fc('0x13'));_0x5a2fa3(_0x119d27[_0xc1fc('0x1a')][_0xc1fc('0x19')]);}})[_0xc1fc('0x1b')](function(_0x364589){logger[_0xc1fc('0x17')](_0xc1fc('0x18'),_0x2bbfe7,_0x364589);_0x432861(_0x364589);});});}exports[_0xc1fc('0x1c')]=function(_0x2042b8){var _0x4fa5bd=this;return new Promise(function(_0x278721,_0x36122b){return db['MailMessage']['create'](_0x2042b8[_0xc1fc('0x1d')],{'raw':_0x2042b8[_0xc1fc('0x1e')]?_0x2042b8[_0xc1fc('0x1e')]['raw']===undefined?!![]:![]:!![]})[_0xc1fc('0x11')](function(_0x54d500){logger['info'](_0xc1fc('0x1c'),_0x2042b8);logger[_0xc1fc('0x14')](_0xc1fc('0x1c'),_0x2042b8,JSON[_0xc1fc('0x16')](_0x54d500));_0x278721(_0x54d500);})[_0xc1fc('0x1b')](function(_0x44236a){logger['error'](_0xc1fc('0x1c'),_0x44236a['message'],_0x2042b8);_0x36122b(_0x4fa5bd[_0xc1fc('0x17')](0x1f4,_0x44236a[_0xc1fc('0x19')]));});});}; \ No newline at end of file +var _0xe451=['MailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','MailMessage','body','raw','CreateMailMessage','stringify','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','./mailMessage.socket','register','then','info','MailMessage,\x20%s,\x20%s','debug'];(function(_0x2bb2ad,_0x1b5f00){var _0x131cc3=function(_0x3b8288){while(--_0x3b8288){_0x2bb2ad['push'](_0x2bb2ad['shift']());}};_0x131cc3(++_0x1b5f00);}(_0xe451,0xec));var _0x1e45=function(_0x2656c7,_0x53223d){_0x2656c7=_0x2656c7-0x0;var _0x303ab3=_0xe451[_0x2656c7];return _0x303ab3;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1e45('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1e45('0x1'))['db'];var utils=require(_0x1e45('0x2'));var logger=require(_0x1e45('0x3'))(_0x1e45('0x4'));var config=require('../../config/environment');var jayson=require(_0x1e45('0x5'));var client=jayson[_0x1e45('0x6')][_0x1e45('0x7')]({'port':0x232a});config['redis']=_[_0x1e45('0x8')](config[_0x1e45('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1e45('0x9')]));require(_0x1e45('0xa'))[_0x1e45('0xb')](socket);function respondWithRpcPromise(_0x4f8bd0,_0x22dbf8,_0x2e3ca9){return new BPromise(function(_0xdce498,_0x47dc82){return client['request'](_0x4f8bd0,_0x2e3ca9)[_0x1e45('0xc')](function(_0x21d968){logger[_0x1e45('0xd')](_0x1e45('0xe'),_0x22dbf8,'request\x20sent');logger[_0x1e45('0xf')](_0x1e45('0x10'),_0x22dbf8,_0x1e45('0x11'),JSON['stringify'](_0x21d968));if(_0x21d968[_0x1e45('0x12')]){if(_0x21d968[_0x1e45('0x12')][_0x1e45('0x13')]===0x1f4){logger[_0x1e45('0x12')]('MailMessage,\x20%s,\x20%s',_0x22dbf8,_0x21d968[_0x1e45('0x12')]['message']);return _0x47dc82(_0x21d968[_0x1e45('0x12')][_0x1e45('0x14')]);}logger['error'](_0x1e45('0xe'),_0x22dbf8,_0x21d968[_0x1e45('0x12')][_0x1e45('0x14')]);return _0xdce498(_0x21d968[_0x1e45('0x12')][_0x1e45('0x14')]);}else{logger[_0x1e45('0xd')](_0x1e45('0xe'),_0x22dbf8,_0x1e45('0x11'));_0xdce498(_0x21d968[_0x1e45('0x15')]['message']);}})[_0x1e45('0x16')](function(_0x50a16f){logger['error'](_0x1e45('0xe'),_0x22dbf8,_0x50a16f);_0x47dc82(_0x50a16f);});});}exports['CreateMailMessage']=function(_0x4e949d){var _0x479bfc=this;return new Promise(function(_0x56b30e,_0x207335){return db[_0x1e45('0x17')]['create'](_0x4e949d[_0x1e45('0x18')],{'raw':_0x4e949d['options']?_0x4e949d['options'][_0x1e45('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x4ffe97){logger[_0x1e45('0xd')](_0x1e45('0x1a'),_0x4e949d);logger['debug'](_0x1e45('0x1a'),_0x4e949d,JSON[_0x1e45('0x1b')](_0x4ffe97));_0x56b30e(_0x4ffe97);})[_0x1e45('0x16')](function(_0x2d3b49){logger[_0x1e45('0x12')](_0x1e45('0x1a'),_0x2d3b49[_0x1e45('0x14')],_0x4e949d);_0x207335(_0x479bfc['error'](0x1f4,_0x2d3b49[_0x1e45('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 07cc34f..082da87 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 _0x3442=['./mailMessage.events','save','update','emit','removeListener','register','length','mailMessage:'];(function(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0x3442,0x118));var _0x2344=function(_0x376bb5,_0x25f4df){_0x376bb5=_0x376bb5-0x0;var _0x146740=_0x3442[_0x376bb5];return _0x146740;};'use strict';var MailMessageEvents=require(_0x2344('0x0'));var events=[_0x2344('0x1'),'remove',_0x2344('0x2')];function createListener(_0x29d4c1,_0x30a30d){return function(_0x43462d){_0x30a30d[_0x2344('0x3')](_0x29d4c1,_0x43462d);};}function removeListener(_0x1903b9,_0xd13499){return function(){MailMessageEvents[_0x2344('0x4')](_0x1903b9,_0xd13499);};}exports[_0x2344('0x5')]=function(_0x4f1b1d){for(var _0x3dadde=0x0,_0x551057=events[_0x2344('0x6')];_0x3dadde<_0x551057;_0x3dadde++){var _0x522d36=events[_0x3dadde];var _0x13f55c=createListener(_0x2344('0x7')+_0x522d36,_0x4f1b1d);MailMessageEvents['on'](_0x522d36,_0x13f55c);}}; \ No newline at end of file +var _0x0852=['./mailMessage.events','save','remove','update','removeListener','register','length','mailMessage:'];(function(_0x60286b,_0x3247c1){var _0x5dff69=function(_0x4ecfcf){while(--_0x4ecfcf){_0x60286b['push'](_0x60286b['shift']());}};_0x5dff69(++_0x3247c1);}(_0x0852,0x130));var _0x2085=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0x0852[_0x5c2e3e];return _0x53f64a;};'use strict';var MailMessageEvents=require(_0x2085('0x0'));var events=[_0x2085('0x1'),_0x2085('0x2'),_0x2085('0x3')];function createListener(_0x35d8fb,_0x55c340){return function(_0x26a0ae){_0x55c340['emit'](_0x35d8fb,_0x26a0ae);};}function removeListener(_0x166484,_0x42d486){return function(){MailMessageEvents[_0x2085('0x4')](_0x166484,_0x42d486);};}exports[_0x2085('0x5')]=function(_0xf78836){for(var _0xdaf21=0x0,_0x5ddb75=events[_0x2085('0x6')];_0xdaf21<_0x5ddb75;_0xdaf21++){var _0x1fdc3e=events[_0xdaf21];var _0x1bfe16=createListener(_0x2085('0x7')+_0x1fdc3e,_0xf78836);MailMessageEvents['on'](_0x1fdc3e,_0x1bfe16);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 0c661fb..555aa3c 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 _0x4cfe=['delete','removeTeams','removeAgents','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','isAuthenticated','index','get','/describe','describe','/:id','/:id/members','getMembers','/:id/teams','post','create','addTeams','/:id/users','addAgents','put'];(function(_0x352e09,_0x37a7da){var _0x1b7094=function(_0x561074){while(--_0x561074){_0x352e09['push'](_0x352e09['shift']());}};_0x1b7094(++_0x37a7da);}(_0x4cfe,0x70));var _0xe4cf=function(_0x4b9b76,_0x2cd722){_0x4b9b76=_0x4b9b76-0x0;var _0x175747=_0x4cfe[_0x4b9b76];return _0x175747;};'use strict';var multer=require(_0xe4cf('0x0'));var util=require(_0xe4cf('0x1'));var path=require(_0xe4cf('0x2'));var timeout=require('connect-timeout');var express=require(_0xe4cf('0x3'));var router=express['Router']();var auth=require(_0xe4cf('0x4'));var interaction=require(_0xe4cf('0x5'));var config=require(_0xe4cf('0x6'));var controller=require(_0xe4cf('0x7'));router['get']('/',auth[_0xe4cf('0x8')](),controller[_0xe4cf('0x9')]);router[_0xe4cf('0xa')](_0xe4cf('0xb'),auth[_0xe4cf('0x8')](),controller[_0xe4cf('0xc')]);router[_0xe4cf('0xa')](_0xe4cf('0xd'),auth['isAuthenticated'](),controller['show']);router[_0xe4cf('0xa')](_0xe4cf('0xe'),auth[_0xe4cf('0x8')](),controller[_0xe4cf('0xf')]);router[_0xe4cf('0xa')](_0xe4cf('0x10'),auth[_0xe4cf('0x8')](),controller['getTeams']);router['get']('/:id/users',auth[_0xe4cf('0x8')](),controller['getAgents']);router[_0xe4cf('0x11')]('/',auth['isAuthenticated'](),controller[_0xe4cf('0x12')]);router[_0xe4cf('0x11')](_0xe4cf('0x10'),auth[_0xe4cf('0x8')](),controller[_0xe4cf('0x13')]);router[_0xe4cf('0x11')](_0xe4cf('0x14'),auth[_0xe4cf('0x8')](),controller[_0xe4cf('0x15')]);router[_0xe4cf('0x16')](_0xe4cf('0xd'),auth[_0xe4cf('0x8')](),controller['update']);router[_0xe4cf('0x17')]('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0xe4cf('0x17')]('/:id/teams',auth[_0xe4cf('0x8')](),controller[_0xe4cf('0x18')]);router[_0xe4cf('0x17')](_0xe4cf('0x14'),auth[_0xe4cf('0x8')](),controller[_0xe4cf('0x19')]);module[_0xe4cf('0x1a')]=router; \ No newline at end of file +var _0x4b3a=['removeTeams','/:id/users','removeAgents','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./mailQueue.controller','isAuthenticated','index','/describe','get','show','/:id/members','getMembers','/:id/teams','post','create','addTeams','addAgents','put','/:id','update','delete','destroy'];(function(_0x54f72b,_0x29edf8){var _0x23e02e=function(_0x22eb34){while(--_0x22eb34){_0x54f72b['push'](_0x54f72b['shift']());}};_0x23e02e(++_0x29edf8);}(_0x4b3a,0x1df));var _0xa4b3=function(_0x45150d,_0x5d3bcf){_0x45150d=_0x45150d-0x0;var _0x39a6c5=_0x4b3a[_0x45150d];return _0x39a6c5;};'use strict';var multer=require(_0xa4b3('0x0'));var util=require(_0xa4b3('0x1'));var path=require('path');var timeout=require(_0xa4b3('0x2'));var express=require(_0xa4b3('0x3'));var router=express[_0xa4b3('0x4')]();var auth=require(_0xa4b3('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xa4b3('0x6'));var controller=require(_0xa4b3('0x7'));router['get']('/',auth[_0xa4b3('0x8')](),controller[_0xa4b3('0x9')]);router['get'](_0xa4b3('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0xa4b3('0xb')]('/:id',auth[_0xa4b3('0x8')](),controller[_0xa4b3('0xc')]);router[_0xa4b3('0xb')](_0xa4b3('0xd'),auth[_0xa4b3('0x8')](),controller[_0xa4b3('0xe')]);router['get'](_0xa4b3('0xf'),auth[_0xa4b3('0x8')](),controller['getTeams']);router[_0xa4b3('0xb')]('/:id/users',auth['isAuthenticated'](),controller['getAgents']);router[_0xa4b3('0x10')]('/',auth[_0xa4b3('0x8')](),controller[_0xa4b3('0x11')]);router[_0xa4b3('0x10')](_0xa4b3('0xf'),auth[_0xa4b3('0x8')](),controller[_0xa4b3('0x12')]);router['post']('/:id/users',auth[_0xa4b3('0x8')](),controller[_0xa4b3('0x13')]);router[_0xa4b3('0x14')](_0xa4b3('0x15'),auth[_0xa4b3('0x8')](),controller[_0xa4b3('0x16')]);router[_0xa4b3('0x17')]('/:id',auth['isAuthenticated'](),controller[_0xa4b3('0x18')]);router[_0xa4b3('0x17')](_0xa4b3('0xf'),auth[_0xa4b3('0x8')](),controller[_0xa4b3('0x19')]);router[_0xa4b3('0x17')](_0xa4b3('0x1a'),auth[_0xa4b3('0x8')](),controller[_0xa4b3('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 98b6405..bd78dd5 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 _0x9231=['rrmemory','beepall','roundrobin','sequelize','exports','STRING','name','INTEGER','ENUM'];(function(_0x1c48d7,_0x12efeb){var _0x19d284=function(_0x26d73f){while(--_0x26d73f){_0x1c48d7['push'](_0x1c48d7['shift']());}};_0x19d284(++_0x12efeb);}(_0x9231,0x66));var _0x1923=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9231[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x1923('0x0'));module[_0x1923('0x1')]={'name':{'type':Sequelize[_0x1923('0x2')],'unique':_0x1923('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x1923('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x1923('0x5')](_0x1923('0x6'),_0x1923('0x7'),_0x1923('0x8'))}}; \ No newline at end of file +var _0xc2a2=['INTEGER','ENUM','rrmemory','roundrobin','sequelize','exports','STRING','name'];(function(_0x169a08,_0x571bfa){var _0x3d25a3=function(_0x94fa4b){while(--_0x94fa4b){_0x169a08['push'](_0x169a08['shift']());}};_0x3d25a3(++_0x571bfa);}(_0xc2a2,0x84));var _0x2c2a=function(_0x2b8fb4,_0xc507b6){_0x2b8fb4=_0x2b8fb4-0x0;var _0x332e4b=_0xc2a2[_0x2b8fb4];return _0x332e4b;};'use strict';var Sequelize=require(_0x2c2a('0x0'));module[_0x2c2a('0x1')]={'name':{'type':Sequelize[_0x2c2a('0x2')],'unique':_0x2c2a('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x2c2a('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x2c2a('0x5')](_0x2c2a('0x6'),'beepall',_0x2c2a('0x7'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index f7bd459..14d5af2 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 _0x0c08=['clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','removeAgents','userMailQueue:remove','addAgents','omit','spread','getAgents','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','redis','defaults','./mailQueue.socket','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','then','get','MailQueues','UserProfileResource','error','name','send','map','MailQueue','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','destroy','describe','findOne','UserMailQueue','nolimit','MailQueueId','User','UserId','agent','updatedAt','format','%s/%s','SIP','mailPause','createdAt','getTeams','Team','addTeams','ids','voicePause','interface','flatMap','Agents','sequelize','transaction','forEach','emit','userMailQueue:save','removeTeams','tq.TeamId','from','team_has_mail_queues','join','user_has_teams','MailQueueId\x20=\x20?'];(function(_0x3f9f9d,_0x923a36){var _0x3f9fc9=function(_0x1b0e3d){while(--_0x1b0e3d){_0x3f9f9d['push'](_0x3f9f9d['shift']());}};_0x3f9fc9(++_0x923a36);}(_0x0c08,0x9a));var _0x80c0=function(_0x11ba46,_0x1d6752){_0x11ba46=_0x11ba46-0x0;var _0x1c8c6f=_0x0c08[_0x11ba46];return _0x1c8c6f;};'use strict';var pdf=require(_0x80c0('0x0'));var emlformat=require(_0x80c0('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x80c0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x80c0('0x3'));var moment=require(_0x80c0('0x4'));var BPromise=require(_0x80c0('0x5'));var Mustache=require(_0x80c0('0x6'));var util=require(_0x80c0('0x7'));var path=require('path');var sox=require(_0x80c0('0x8'));var csv=require(_0x80c0('0x9'));var ejs=require(_0x80c0('0xa'));var fs=require('fs');var _=require(_0x80c0('0xb'));var squel=require(_0x80c0('0xc'));var crypto=require(_0x80c0('0xd'));var jsforce=require(_0x80c0('0xe'));var deskjs=require(_0x80c0('0xf'));var toCsv=require(_0x80c0('0x9'));var querystring=require('querystring');var Papa=require(_0x80c0('0x10'));var Redis=require(_0x80c0('0x11'));var authService=require(_0x80c0('0x12'));var qs=require(_0x80c0('0x13'));var as=require(_0x80c0('0x14'));var hardwareService=require(_0x80c0('0x15'));var logger=require('../../config/logger')(_0x80c0('0x16'));var utils=require(_0x80c0('0x17'));var config=require('../../config/environment');var db=require(_0x80c0('0x18'))['db'];config[_0x80c0('0x19')]=_[_0x80c0('0x1a')](config[_0x80c0('0x19')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x80c0('0x19')]));require(_0x80c0('0x1b'))['register'](socket);function respondWithStatusCode(_0x59561f,_0x13dc2a){_0x13dc2a=_0x13dc2a||0xcc;return function(_0x17be65){if(_0x17be65){return _0x59561f[_0x80c0('0x1c')](_0x13dc2a);}return _0x59561f['status'](_0x13dc2a)[_0x80c0('0x1d')]();};}function respondWithResult(_0x1f2798,_0x6b1ea6){_0x6b1ea6=_0x6b1ea6||0xc8;return function(_0x4b8845){if(_0x4b8845){return _0x1f2798[_0x80c0('0x1e')](_0x6b1ea6)[_0x80c0('0x1f')](_0x4b8845);}};}function respondWithFilteredResult(_0xf35b86,_0x406a1a){return function(_0x4f8f0f){if(_0x4f8f0f){var _0x42e91f=_0x4f8f0f[_0x80c0('0x20')],_0x5c2715=_0x406a1a['offset'],_0x3a73b8=_0x406a1a[_0x80c0('0x21')]+_0x406a1a[_0x80c0('0x22')],_0xabb789;if(_0x3a73b8>=_0x42e91f){_0x3a73b8=_0x42e91f;_0xabb789=0xc8;}else{_0xabb789=0xce;}_0xf35b86[_0x80c0('0x1e')](_0xabb789);return _0xf35b86[_0x80c0('0x23')](_0x80c0('0x24'),_0x5c2715+'-'+_0x3a73b8+'/'+_0x42e91f)[_0x80c0('0x1f')](_0x4f8f0f);}return null;};}function patchUpdates(_0x2b3a77){return function(_0x161f19){try{jsonpatch[_0x80c0('0x25')](_0x161f19,_0x2b3a77,!![]);}catch(_0x112337){return BPromise[_0x80c0('0x26')](_0x112337);}return _0x161f19[_0x80c0('0x27')]();};}function saveUpdates(_0xe47bec,_0x33258d){return function(_0x456027){if(_0x456027){return _0x456027['update'](_0xe47bec)[_0x80c0('0x28')](function(_0x132592){return _0x132592;});}return null;};}function removeEntity(_0x50d3ae,_0x5b85ba){return function(_0x3c29d1){if(_0x3c29d1){return _0x3c29d1['destroy']()['then'](function(){var _0xc81ff6=_0x3c29d1[_0x80c0('0x29')]({'plain':!![]});var _0x55a918=_0x80c0('0x2a');return db[_0x80c0('0x2b')]['destroy']({'where':{'type':_0x55a918,'resourceId':_0xc81ff6['id']}})['then'](function(){return _0x3c29d1;});})[_0x80c0('0x28')](function(){_0x50d3ae[_0x80c0('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x425433,_0x24d203){return function(_0x301ba9){if(!_0x301ba9){_0x425433[_0x80c0('0x1c')](0x194);}return _0x301ba9;};}function handleError(_0x11f3b7,_0x1b07b4){_0x1b07b4=_0x1b07b4||0x1f4;return function(_0x4e3226){logger[_0x80c0('0x2c')](_0x4e3226['stack']);if(_0x4e3226[_0x80c0('0x2d')]){delete _0x4e3226[_0x80c0('0x2d')];}_0x11f3b7['status'](_0x1b07b4)[_0x80c0('0x2e')](_0x4e3226);};}exports['index']=function(_0x1d506b,_0x1681a9){var _0x4d6f96={},_0x4d1e5b={},_0x3777e9={'count':0x0,'rows':[]};var _0x24159c=_[_0x80c0('0x2f')](db[_0x80c0('0x30')][_0x80c0('0x31')],function(_0x430827){return{'name':_0x430827[_0x80c0('0x32')],'type':_0x430827[_0x80c0('0x33')][_0x80c0('0x34')]};});_0x4d1e5b[_0x80c0('0x35')]=_[_0x80c0('0x2f')](_0x24159c,_0x80c0('0x2d'));_0x4d1e5b['query']=_[_0x80c0('0x36')](_0x1d506b[_0x80c0('0x37')]);_0x4d1e5b[_0x80c0('0x38')]=_['intersection'](_0x4d1e5b[_0x80c0('0x35')],_0x4d1e5b[_0x80c0('0x37')]);_0x4d6f96[_0x80c0('0x39')]=_[_0x80c0('0x3a')](_0x4d1e5b[_0x80c0('0x35')],qs[_0x80c0('0x3b')](_0x1d506b[_0x80c0('0x37')][_0x80c0('0x3b')]));_0x4d6f96[_0x80c0('0x39')]=_0x4d6f96[_0x80c0('0x39')]['length']?_0x4d6f96['attributes']:_0x4d1e5b[_0x80c0('0x35')];if(!_0x1d506b['query'][_0x80c0('0x3c')]('nolimit')){_0x4d6f96[_0x80c0('0x22')]=qs[_0x80c0('0x22')](_0x1d506b[_0x80c0('0x37')][_0x80c0('0x22')]);_0x4d6f96[_0x80c0('0x21')]=qs[_0x80c0('0x21')](_0x1d506b[_0x80c0('0x37')][_0x80c0('0x21')]);}_0x4d6f96[_0x80c0('0x3d')]=qs[_0x80c0('0x3e')](_0x1d506b[_0x80c0('0x37')][_0x80c0('0x3e')]);_0x4d6f96[_0x80c0('0x3f')]=qs[_0x80c0('0x38')](_[_0x80c0('0x40')](_0x1d506b[_0x80c0('0x37')],_0x4d1e5b[_0x80c0('0x38')]),_0x24159c);if(_0x1d506b[_0x80c0('0x37')]['filter']){_0x4d6f96[_0x80c0('0x3f')]=_[_0x80c0('0x41')](_0x4d6f96[_0x80c0('0x3f')],{'$or':_[_0x80c0('0x2f')](_0x24159c,function(_0x2ef4f){if(_0x2ef4f['type']!==_0x80c0('0x42')){var _0x26ceee={};_0x26ceee[_0x2ef4f['name']]={'$like':'%'+_0x1d506b[_0x80c0('0x37')][_0x80c0('0x43')]+'%'};return _0x26ceee;}})});}_0x4d6f96=_[_0x80c0('0x41')]({},_0x4d6f96,_0x1d506b[_0x80c0('0x44')]);var _0x3f2c29={'where':_0x4d6f96['where']};return db['MailQueue'][_0x80c0('0x20')](_0x3f2c29)[_0x80c0('0x28')](function(_0x23a33f){_0x3777e9[_0x80c0('0x20')]=_0x23a33f;if(_0x1d506b['query'][_0x80c0('0x45')]){_0x4d6f96[_0x80c0('0x46')]=[{'all':!![]}];}return db[_0x80c0('0x30')][_0x80c0('0x47')](_0x4d6f96);})[_0x80c0('0x28')](function(_0x540a41){_0x3777e9[_0x80c0('0x48')]=_0x540a41;return _0x3777e9;})[_0x80c0('0x28')](respondWithFilteredResult(_0x1681a9,_0x4d6f96))[_0x80c0('0x49')](handleError(_0x1681a9,null));};exports[_0x80c0('0x4a')]=function(_0x300359,_0x4ad353){var _0x2b2082={'raw':!![],'where':{'id':_0x300359[_0x80c0('0x4b')]['id']}},_0x21e9b6={};_0x21e9b6['model']=_[_0x80c0('0x36')](db[_0x80c0('0x30')]['rawAttributes']);_0x21e9b6[_0x80c0('0x37')]=_['keys'](_0x300359['query']);_0x21e9b6['filters']=_['intersection'](_0x21e9b6[_0x80c0('0x35')],_0x21e9b6[_0x80c0('0x37')]);_0x2b2082[_0x80c0('0x39')]=_[_0x80c0('0x3a')](_0x21e9b6[_0x80c0('0x35')],qs[_0x80c0('0x3b')](_0x300359[_0x80c0('0x37')][_0x80c0('0x3b')]));_0x2b2082[_0x80c0('0x39')]=_0x2b2082[_0x80c0('0x39')][_0x80c0('0x4c')]?_0x2b2082[_0x80c0('0x39')]:_0x21e9b6['model'];if(_0x300359[_0x80c0('0x37')][_0x80c0('0x45')]){_0x2b2082[_0x80c0('0x46')]=[{'all':!![]}];}_0x2b2082=_[_0x80c0('0x41')]({},_0x2b2082,_0x300359['options']);return db[_0x80c0('0x30')][_0x80c0('0x4d')](_0x2b2082)[_0x80c0('0x28')](handleEntityNotFound(_0x4ad353,null))[_0x80c0('0x28')](respondWithResult(_0x4ad353,null))[_0x80c0('0x49')](handleError(_0x4ad353,null));};exports[_0x80c0('0x4e')]=function(_0x29a698,_0x48e8a6){return db[_0x80c0('0x30')][_0x80c0('0x4e')](_0x29a698[_0x80c0('0x4f')],{})[_0x80c0('0x28')](function(_0x518491){var _0x4da34b=_0x29a698[_0x80c0('0x50')][_0x80c0('0x29')]({'plain':!![]});if(!_0x4da34b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4da34b[_0x80c0('0x51')]===_0x80c0('0x50')){var _0x117268=_0x518491[_0x80c0('0x29')]({'plain':!![]});var _0x3bc30d=_0x80c0('0x2a');return db[_0x80c0('0x52')][_0x80c0('0x4d')]({'where':{'name':_0x3bc30d,'userProfileId':_0x4da34b[_0x80c0('0x53')]},'raw':!![]})['then'](function(_0x3b652b){if(_0x3b652b&&_0x3b652b[_0x80c0('0x54')]===0x0){return db['UserProfileResource']['create']({'name':_0x117268[_0x80c0('0x2d')],'resourceId':_0x117268['id'],'type':_0x3b652b[_0x80c0('0x2d')],'sectionId':_0x3b652b['id']},{})[_0x80c0('0x28')](function(){return _0x518491;});}else{return _0x518491;}})[_0x80c0('0x49')](function(_0x16c146){logger[_0x80c0('0x2c')](_0x80c0('0x55'),_0x16c146);throw _0x16c146;});}return _0x518491;})[_0x80c0('0x28')](respondWithResult(_0x48e8a6,0xc9))[_0x80c0('0x49')](handleError(_0x48e8a6,null));};exports[_0x80c0('0x56')]=function(_0x273396,_0x2960f3){if(_0x273396[_0x80c0('0x4f')]['id']){delete _0x273396[_0x80c0('0x4f')]['id'];}return db[_0x80c0('0x30')]['find']({'where':{'id':_0x273396[_0x80c0('0x4b')]['id']}})[_0x80c0('0x28')](handleEntityNotFound(_0x2960f3,null))[_0x80c0('0x28')](saveUpdates(_0x273396[_0x80c0('0x4f')],null))[_0x80c0('0x28')](respondWithResult(_0x2960f3,null))[_0x80c0('0x49')](handleError(_0x2960f3,null));};exports[_0x80c0('0x57')]=function(_0xfd8b4e,_0x1590c4){return db[_0x80c0('0x30')]['find']({'where':{'id':_0xfd8b4e[_0x80c0('0x4b')]['id']}})[_0x80c0('0x28')](handleEntityNotFound(_0x1590c4,null))['then'](removeEntity(_0x1590c4,null))[_0x80c0('0x49')](handleError(_0x1590c4,null));};exports[_0x80c0('0x58')]=function(_0x1fd025,_0x3b8bb9){return db[_0x80c0('0x30')]['describe']()[_0x80c0('0x28')](respondWithResult(_0x3b8bb9,null))[_0x80c0('0x49')](handleError(_0x3b8bb9,null));};exports['getMembers']=function(_0x249f16,_0x5a78af,_0x54e407){var _0x4e3b4f={'raw':!![],'where':{}},_0x12b655={},_0x11cc80;return db['MailQueue'][_0x80c0('0x59')]({'where':{'id':_0x249f16[_0x80c0('0x4b')]['id']}})[_0x80c0('0x28')](handleEntityNotFound(_0x5a78af,null))[_0x80c0('0x28')](function(_0x377b20){if(_0x377b20){_0x11cc80=_0x377b20[_0x80c0('0x29')]({'plain':!![]});_0x12b655[_0x80c0('0x35')]=_['keys'](db[_0x80c0('0x5a')]['rawAttributes']);_0x12b655[_0x80c0('0x37')]=_[_0x80c0('0x36')](_0x249f16['query']);_0x12b655[_0x80c0('0x38')]=_[_0x80c0('0x3a')](_0x12b655[_0x80c0('0x35')],_0x12b655['query']);_0x4e3b4f[_0x80c0('0x39')]=_[_0x80c0('0x3a')](_0x12b655[_0x80c0('0x35')],qs[_0x80c0('0x3b')](_0x249f16[_0x80c0('0x37')][_0x80c0('0x3b')]));_0x4e3b4f['attributes']=_0x4e3b4f[_0x80c0('0x39')][_0x80c0('0x4c')]?_0x4e3b4f['attributes']:_0x12b655[_0x80c0('0x35')];if(!_0x249f16[_0x80c0('0x37')][_0x80c0('0x3c')](_0x80c0('0x5b'))){_0x4e3b4f[_0x80c0('0x22')]=qs[_0x80c0('0x22')](_0x249f16[_0x80c0('0x37')][_0x80c0('0x22')]);_0x4e3b4f['offset']=qs[_0x80c0('0x21')](_0x249f16[_0x80c0('0x37')][_0x80c0('0x21')]);}_0x4e3b4f['order']=qs[_0x80c0('0x3e')](_0x249f16[_0x80c0('0x37')][_0x80c0('0x3e')]);_0x4e3b4f[_0x80c0('0x3f')]=qs[_0x80c0('0x38')](_['pick'](_0x249f16['query'],_0x12b655[_0x80c0('0x38')]));_0x4e3b4f[_0x80c0('0x3f')][_0x80c0('0x5c')]=_0x377b20['id'];if(_0x249f16['query'][_0x80c0('0x43')]){_0x4e3b4f['where']=_[_0x80c0('0x41')](_0x4e3b4f['where'],{'$or':_['map'](_0x4e3b4f['attributes'],function(_0x51afb7){var _0x2b3f2c={};_0x2b3f2c[_0x51afb7]={'$like':'%'+_0x249f16[_0x80c0('0x37')][_0x80c0('0x43')]+'%'};return _0x2b3f2c;})});}_0x4e3b4f=_[_0x80c0('0x41')]({},_0x4e3b4f,_0x249f16['options']);return db[_0x80c0('0x5a')]['findAll'](_0x4e3b4f);}})[_0x80c0('0x28')](function(_0x293506){if(_0x293506){return db[_0x80c0('0x5d')]['findAndCountAll']({'where':{'id':_[_0x80c0('0x2f')](_0x293506,_0x80c0('0x5e')),'role':_0x80c0('0x5f')},'attributes':['id',_0x80c0('0x2d'),'mailPause',_0x80c0('0x60'),'createdAt']});}})[_0x80c0('0x28')](function(_0x2e1fd9){if(_0x2e1fd9){return{'count':_0x2e1fd9['count'],'rows':_['map'](_0x2e1fd9[_0x80c0('0x48')],function(_0x4762ea){return{'membername':_0x4762ea['name'],'UserId':_0x4762ea['id'],'queue_name':_0x11cc80[_0x80c0('0x2d')],'MailQueueId':_0x11cc80['id'],'interface':util[_0x80c0('0x61')](_0x80c0('0x62'),_0x80c0('0x63'),_0x4762ea[_0x80c0('0x2d')]),'penalty':0x0,'paused':_0x4762ea[_0x80c0('0x64')],'createdAt':_0x4762ea[_0x80c0('0x65')],'updatedAt':_0x4762ea[_0x80c0('0x60')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x80c0('0x28')](respondWithFilteredResult(_0x5a78af,_0x4e3b4f))['catch'](handleError(_0x5a78af,null));};exports[_0x80c0('0x66')]=function(_0x19204f,_0x23e353,_0x4a5a73){var _0x56ec6b={};var _0x33807c={};var _0x174d82;var _0x14da59;return db[_0x80c0('0x30')]['findOne']({'where':{'id':_0x19204f['params']['id']}})['then'](handleEntityNotFound(_0x23e353,null))[_0x80c0('0x28')](function(_0x28820e){if(_0x28820e){_0x174d82=_0x28820e;_0x33807c[_0x80c0('0x35')]=_[_0x80c0('0x36')](db[_0x80c0('0x67')][_0x80c0('0x31')]);_0x33807c[_0x80c0('0x37')]=_[_0x80c0('0x36')](_0x19204f['query']);_0x33807c[_0x80c0('0x38')]=_[_0x80c0('0x3a')](_0x33807c['model'],_0x33807c['query']);_0x56ec6b[_0x80c0('0x39')]=_[_0x80c0('0x3a')](_0x33807c[_0x80c0('0x35')],qs[_0x80c0('0x3b')](_0x19204f['query'][_0x80c0('0x3b')]));_0x56ec6b[_0x80c0('0x39')]=_0x56ec6b['attributes']['length']?_0x56ec6b[_0x80c0('0x39')]:_0x33807c[_0x80c0('0x35')];_0x56ec6b[_0x80c0('0x3d')]=qs[_0x80c0('0x3e')](_0x19204f['query']['sort']);_0x56ec6b[_0x80c0('0x3f')]=qs['filters'](_[_0x80c0('0x40')](_0x19204f[_0x80c0('0x37')],_0x33807c[_0x80c0('0x38')]));if(_0x19204f['query']['filter']){_0x56ec6b[_0x80c0('0x3f')]=_['merge'](_0x56ec6b[_0x80c0('0x3f')],{'$or':_[_0x80c0('0x2f')](_0x56ec6b[_0x80c0('0x39')],function(_0x46b9bd){var _0x28183f={};_0x28183f[_0x46b9bd]={'$like':'%'+_0x19204f[_0x80c0('0x37')][_0x80c0('0x43')]+'%'};return _0x28183f;})});}_0x56ec6b=_[_0x80c0('0x41')]({},_0x56ec6b,_0x19204f[_0x80c0('0x44')]);return _0x174d82['getTeams'](_0x56ec6b);}})['then'](function(_0x4cf789){if(_0x4cf789){_0x14da59=_0x4cf789[_0x80c0('0x4c')];if(!_0x19204f[_0x80c0('0x37')][_0x80c0('0x3c')](_0x80c0('0x5b'))){_0x56ec6b['limit']=qs['limit'](_0x19204f[_0x80c0('0x37')][_0x80c0('0x22')]);_0x56ec6b[_0x80c0('0x21')]=qs[_0x80c0('0x21')](_0x19204f['query']['offset']);}return _0x174d82['getTeams'](_0x56ec6b);}})[_0x80c0('0x28')](function(_0x2e1527){if(_0x2e1527){return _0x2e1527?{'count':_0x14da59,'rows':_0x2e1527}:null;}})[_0x80c0('0x28')](respondWithResult(_0x23e353,null))[_0x80c0('0x49')](handleError(_0x23e353,null));};exports[_0x80c0('0x68')]=function(_0x36b35e,_0x572e34,_0xbc849){var _0x4cbe20=_0x36b35e['body'][_0x80c0('0x69')];return db[_0x80c0('0x67')]['findAll']({'where':{'id':_0x4cbe20},'attributes':['id'],'include':[{'model':db[_0x80c0('0x5d')],'as':'Agents','attributes':['id',_0x80c0('0x2d'),'online',_0x80c0('0x6a'),_0x80c0('0x6b')],'raw':!![]}]})[_0x80c0('0x28')](function(_0xc98274){if(_0xc98274){var _0xa164df=_[_0x80c0('0x6c')](_0xc98274,function(_0x4bb3eb){var _0x387911=_0x4bb3eb['get']({'plain':!![]});return _0x387911[_0x80c0('0x6d')];});return db[_0x80c0('0x30')][_0x80c0('0x4d')]({'where':{'id':_0x36b35e['params']['id']}})[_0x80c0('0x28')](function(_0x1d71ef){return db[_0x80c0('0x6e')][_0x80c0('0x6f')](function(_0x32b132){return _0x1d71ef['addTeams'](_0x4cbe20,{'transaction':_0x32b132})[_0x80c0('0x28')](function(){return BPromise['each'](_0xa164df,function(_0x332a84){return db[_0x80c0('0x5a')]['findOrCreate']({'where':{'UserId':_0x332a84['id'],'MailQueueId':_0x36b35e[_0x80c0('0x4b')]['id']},'transaction':_0x32b132});});})[_0x80c0('0x28')](function(){_0xa164df[_0x80c0('0x70')](function(_0x2501a2){socket[_0x80c0('0x71')](_0x80c0('0x72'),{'UserId':_0x2501a2['id'],'MailQueueId':_0x1d71ef['id']});});});});});}})[_0x80c0('0x28')](respondWithStatusCode(_0x572e34,null))['catch'](handleError(_0x572e34,null));};exports[_0x80c0('0x73')]=function(_0x2576fd,_0x4b6f3e,_0x1e2c07){return db[_0x80c0('0x67')][_0x80c0('0x47')]({'where':{'id':_0x2576fd[_0x80c0('0x37')][_0x80c0('0x69')]},'attributes':['id'],'include':[{'model':db[_0x80c0('0x5d')],'as':_0x80c0('0x6d'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x4b6f3e,null))[_0x80c0('0x28')](function(_0x587f97){var _0x2c9e2d=_[_0x80c0('0x2f')](_0x587f97,'id');var _0x53bdac=[];var _0x371ebe=[];var _0x421656=squel['select']();_0x421656['field'](_0x80c0('0x74'))[_0x80c0('0x75')](_0x80c0('0x76'),'tq')[_0x80c0('0x77')](_0x80c0('0x78'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0x80c0('0x79'),_0x2576fd[_0x80c0('0x4b')]['id']);for(var _0x1a99d5=0x0;_0x1a99d5<_0x587f97['length'];_0x1a99d5+=0x1){let _0x4cd8c9=_0x587f97[_0x1a99d5];for(var _0x93bcf6=0x0;_0x93bcf6<_0x4cd8c9[_0x80c0('0x6d')][_0x80c0('0x4c')];_0x93bcf6+=0x1){let _0x1245fc=_0x4cd8c9[_0x80c0('0x6d')][_0x93bcf6];var _0x215e23=_0x421656[_0x80c0('0x7a')]();_0x215e23[_0x80c0('0x3f')](_0x80c0('0x7b'),_0x1245fc['id']);_0x371ebe[_0x80c0('0x7c')](db[_0x80c0('0x6e')]['query'](_0x215e23[_0x80c0('0x7d')](),{'type':db['sequelize'][_0x80c0('0x7e')][_0x80c0('0x7f')]})[_0x80c0('0x28')](function(_0x11a357){if(_0x11a357[_0x80c0('0x4c')]===0x1){return _0x1245fc['id'];}else{var _0xeff41d=_[_0x80c0('0x80')](_[_0x80c0('0x2f')](_0x11a357,_0x80c0('0x81')),function(_0x128117){return _[_0x80c0('0x82')](_0x2c9e2d,_0x128117);});if(_0xeff41d){return _0x1245fc['id'];}}}));}}return BPromise[_0x80c0('0x83')](_0x371ebe)[_0x80c0('0x28')](function(_0x2f359b){_0x53bdac=_(_0x53bdac)['union'](_0x2f359b)['compact']()['value']();return db[_0x80c0('0x30')][_0x80c0('0x4d')]({'where':{'id':_0x2576fd[_0x80c0('0x4b')]['id']}})[_0x80c0('0x28')](function(_0x4b3872){return db['sequelize'][_0x80c0('0x6f')](function(_0x4a7fd5){return _0x4b3872['removeTeams'](_0x2576fd[_0x80c0('0x37')]['ids'],{'transaction':_0x4a7fd5})[_0x80c0('0x28')](function(){if(!_['isEmpty'](_0x53bdac)){return _0x4b3872[_0x80c0('0x84')](_0x53bdac,{'transaction':_0x4a7fd5});}})[_0x80c0('0x28')](function(){_0x53bdac['forEach'](function(_0x37edce){socket[_0x80c0('0x71')](_0x80c0('0x85'),{'UserId':_0x37edce,'MailQueueId':_0x4b3872['id']});});});});});});})[_0x80c0('0x28')](respondWithStatusCode(_0x4b6f3e,null))['catch'](handleError(_0x4b6f3e,null));};exports[_0x80c0('0x86')]=function(_0x1616ac,_0x5c96e6,_0x17fd29){return db['MailQueue'][_0x80c0('0x4d')]({'where':{'id':_0x1616ac[_0x80c0('0x4b')]['id']}})[_0x80c0('0x28')](handleEntityNotFound(_0x5c96e6,null))[_0x80c0('0x28')](function(_0x2777ad){if(_0x2777ad){return _0x2777ad[_0x80c0('0x86')](_0x1616ac[_0x80c0('0x4f')]['ids'],_[_0x80c0('0x87')](_0x1616ac[_0x80c0('0x4f')],[_0x80c0('0x69'),'id'])||{})[_0x80c0('0x88')](function(_0x19149b){for(var _0x55ae13=0x0;_0x55ae13<_0x1616ac[_0x80c0('0x4f')][_0x80c0('0x69')][_0x80c0('0x4c')];_0x55ae13+=0x1){socket[_0x80c0('0x71')](_0x80c0('0x72'),{'UserId':_0x1616ac[_0x80c0('0x4f')][_0x80c0('0x69')][_0x55ae13],'MailQueueId':_0x1616ac[_0x80c0('0x4b')]['id']});}return _0x19149b;});}})[_0x80c0('0x28')](respondWithResult(_0x5c96e6,null))[_0x80c0('0x49')](handleError(_0x5c96e6,null));};exports[_0x80c0('0x84')]=function(_0x3bc270,_0x4ad9d4,_0x12b316){return db[_0x80c0('0x30')]['find']({'where':{'id':_0x3bc270[_0x80c0('0x4b')]['id']}})[_0x80c0('0x28')](handleEntityNotFound(_0x4ad9d4,null))[_0x80c0('0x28')](function(_0x8ed394){if(_0x8ed394){return _0x8ed394[_0x80c0('0x84')](_0x3bc270[_0x80c0('0x37')][_0x80c0('0x69')])['then'](function(){if(_['isArray'](_0x3bc270[_0x80c0('0x37')][_0x80c0('0x69')])){for(var _0x4dfb46=0x0;_0x4dfb46<_0x3bc270['query'][_0x80c0('0x69')]['length'];_0x4dfb46+=0x1){socket[_0x80c0('0x71')](_0x80c0('0x85'),{'UserId':Number(_0x3bc270[_0x80c0('0x37')]['ids'][_0x4dfb46]),'MailQueueId':Number(_0x3bc270[_0x80c0('0x4b')]['id'])});}}else{socket[_0x80c0('0x71')](_0x80c0('0x85'),{'UserId':Number(_0x3bc270['query'][_0x80c0('0x69')]),'MailQueueId':Number(_0x3bc270[_0x80c0('0x4b')]['id'])});}});}})[_0x80c0('0x28')](respondWithStatusCode(_0x4ad9d4,null))[_0x80c0('0x49')](handleError(_0x4ad9d4,null));};exports[_0x80c0('0x89')]=function(_0x197575,_0x2b2999,_0x571a92){var _0x1ae452={};var _0x2387ba={};var _0x139bef;var _0x469160;return db[_0x80c0('0x30')][_0x80c0('0x59')]({'where':{'id':_0x197575[_0x80c0('0x4b')]['id']}})[_0x80c0('0x28')](handleEntityNotFound(_0x2b2999,null))['then'](function(_0x54bd3c){if(_0x54bd3c){_0x139bef=_0x54bd3c;_0x2387ba[_0x80c0('0x35')]=_['keys'](db[_0x80c0('0x5d')][_0x80c0('0x31')]);_0x2387ba['query']=_[_0x80c0('0x36')](_0x197575[_0x80c0('0x37')]);_0x2387ba['filters']=_[_0x80c0('0x3a')](_0x2387ba['model'],_0x2387ba[_0x80c0('0x37')]);_0x1ae452[_0x80c0('0x39')]=_['intersection'](_0x2387ba[_0x80c0('0x35')],qs[_0x80c0('0x3b')](_0x197575[_0x80c0('0x37')][_0x80c0('0x3b')]));_0x1ae452[_0x80c0('0x39')]=_0x1ae452['attributes'][_0x80c0('0x4c')]?_0x1ae452['attributes']:_0x2387ba[_0x80c0('0x35')];_0x1ae452[_0x80c0('0x3d')]=qs['sort'](_0x197575['query'][_0x80c0('0x3e')]);_0x1ae452[_0x80c0('0x3f')]=qs['filters'](_[_0x80c0('0x40')](_0x197575[_0x80c0('0x37')],_0x2387ba[_0x80c0('0x38')]));if(_0x197575[_0x80c0('0x37')]['filter']){_0x1ae452[_0x80c0('0x3f')]=_[_0x80c0('0x41')](_0x1ae452['where'],{'$or':_[_0x80c0('0x2f')](_0x1ae452[_0x80c0('0x39')],function(_0x284381){var _0x4bcb73={};_0x4bcb73[_0x284381]={'$like':'%'+_0x197575[_0x80c0('0x37')][_0x80c0('0x43')]+'%'};return _0x4bcb73;})});}_0x1ae452=_[_0x80c0('0x41')]({},_0x1ae452,_0x197575['options']);return _0x139bef[_0x80c0('0x89')](_0x1ae452);}})[_0x80c0('0x28')](function(_0x2a6b92){if(_0x2a6b92){_0x469160=_0x2a6b92[_0x80c0('0x4c')];if(!_0x197575[_0x80c0('0x37')][_0x80c0('0x3c')](_0x80c0('0x5b'))){_0x1ae452[_0x80c0('0x22')]=qs['limit'](_0x197575['query'][_0x80c0('0x22')]);_0x1ae452[_0x80c0('0x21')]=qs[_0x80c0('0x21')](_0x197575[_0x80c0('0x37')][_0x80c0('0x21')]);}return _0x139bef[_0x80c0('0x89')](_0x1ae452);}})['then'](function(_0x24fc0a){if(_0x24fc0a){return _0x24fc0a?{'count':_0x469160,'rows':_0x24fc0a}:null;}})['then'](respondWithResult(_0x2b2999,null))[_0x80c0('0x49')](handleError(_0x2b2999,null));}; \ No newline at end of file +var _0x83e8=['%s/%s','SIP','updatedAt','getTeams','Team','addTeams','ids','online','Agents','sequelize','transaction','each','findOrCreate','forEach','emit','userMailQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_mail_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','TeamId','includes','union','compact','value','userMailQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','html-pdf','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','status','json','count','offset','limit','set','Content-Range','apply','reject','save','destroy','get','MailQueues','UserProfileResource','then','end','error','stack','name','send','index','MailQueue','rawAttributes','fieldName','type','key','map','query','filters','model','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','keys','length','options','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','findOne','UserMailQueue','order','pick','MailQueueId','filter','User','UserId','createdAt','format'];(function(_0x330770,_0x3aea5b){var _0x522153=function(_0x5cbe04){while(--_0x5cbe04){_0x330770['push'](_0x330770['shift']());}};_0x522153(++_0x3aea5b);}(_0x83e8,0xb6));var _0x883e=function(_0x52fe3d,_0x25cd2c){_0x52fe3d=_0x52fe3d-0x0;var _0x1202cb=_0x83e8[_0x52fe3d];return _0x1202cb;};'use strict';var pdf=require(_0x883e('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x883e('0x1'));var zipdir=require(_0x883e('0x2'));var jsonpatch=require(_0x883e('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x883e('0x4'));var Mustache=require(_0x883e('0x5'));var util=require(_0x883e('0x6'));var path=require(_0x883e('0x7'));var sox=require('sox');var csv=require(_0x883e('0x8'));var ejs=require(_0x883e('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x883e('0xa'));var crypto=require(_0x883e('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x883e('0xc'));var toCsv=require(_0x883e('0x8'));var querystring=require(_0x883e('0xd'));var Papa=require(_0x883e('0xe'));var Redis=require(_0x883e('0xf'));var authService=require(_0x883e('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x883e('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x883e('0x12'))(_0x883e('0x13'));var utils=require(_0x883e('0x14'));var config=require(_0x883e('0x15'));var db=require(_0x883e('0x16'))['db'];config['redis']=_[_0x883e('0x17')](config[_0x883e('0x18')],{'host':_0x883e('0x19'),'port':0x18eb});var socket=require(_0x883e('0x1a'))(new Redis(config[_0x883e('0x18')]));require('./mailQueue.socket')['register'](socket);function respondWithStatusCode(_0x439b59,_0x409e66){_0x409e66=_0x409e66||0xcc;return function(_0x37c0f6){if(_0x37c0f6){return _0x439b59['sendStatus'](_0x409e66);}return _0x439b59[_0x883e('0x1b')](_0x409e66)['end']();};}function respondWithResult(_0x3b32df,_0x5caf0a){_0x5caf0a=_0x5caf0a||0xc8;return function(_0x33c817){if(_0x33c817){return _0x3b32df[_0x883e('0x1b')](_0x5caf0a)[_0x883e('0x1c')](_0x33c817);}};}function respondWithFilteredResult(_0x10a4f1,_0x1adda7){return function(_0x4a11b1){if(_0x4a11b1){var _0x587748=_0x4a11b1[_0x883e('0x1d')],_0x562bc4=_0x1adda7[_0x883e('0x1e')],_0x52c1cf=_0x1adda7[_0x883e('0x1e')]+_0x1adda7[_0x883e('0x1f')],_0x21b456;if(_0x52c1cf>=_0x587748){_0x52c1cf=_0x587748;_0x21b456=0xc8;}else{_0x21b456=0xce;}_0x10a4f1['status'](_0x21b456);return _0x10a4f1[_0x883e('0x20')](_0x883e('0x21'),_0x562bc4+'-'+_0x52c1cf+'/'+_0x587748)[_0x883e('0x1c')](_0x4a11b1);}return null;};}function patchUpdates(_0x238415){return function(_0x2a86d){try{jsonpatch[_0x883e('0x22')](_0x2a86d,_0x238415,!![]);}catch(_0x390044){return BPromise[_0x883e('0x23')](_0x390044);}return _0x2a86d[_0x883e('0x24')]();};}function saveUpdates(_0x2beb08,_0x5cca52){return function(_0xe6d3f2){if(_0xe6d3f2){return _0xe6d3f2['update'](_0x2beb08)['then'](function(_0x5345e9){return _0x5345e9;});}return null;};}function removeEntity(_0x27feb4,_0x5263ff){return function(_0x25741a){if(_0x25741a){return _0x25741a[_0x883e('0x25')]()['then'](function(){var _0x52abab=_0x25741a[_0x883e('0x26')]({'plain':!![]});var _0x57336e=_0x883e('0x27');return db[_0x883e('0x28')][_0x883e('0x25')]({'where':{'type':_0x57336e,'resourceId':_0x52abab['id']}})[_0x883e('0x29')](function(){return _0x25741a;});})['then'](function(){_0x27feb4['status'](0xcc)[_0x883e('0x2a')]();});}};}function handleEntityNotFound(_0x1ee6cb,_0x5be3c5){return function(_0x4f1c51){if(!_0x4f1c51){_0x1ee6cb['sendStatus'](0x194);}return _0x4f1c51;};}function handleError(_0x3b7881,_0x189948){_0x189948=_0x189948||0x1f4;return function(_0x23435e){logger[_0x883e('0x2b')](_0x23435e[_0x883e('0x2c')]);if(_0x23435e[_0x883e('0x2d')]){delete _0x23435e['name'];}_0x3b7881['status'](_0x189948)[_0x883e('0x2e')](_0x23435e);};}exports[_0x883e('0x2f')]=function(_0x2f4c22,_0x1fb89b){var _0x3eefab={},_0x19c599={},_0x3a4ed2={'count':0x0,'rows':[]};var _0x54bc20=_['map'](db[_0x883e('0x30')][_0x883e('0x31')],function(_0x57a4b3){return{'name':_0x57a4b3[_0x883e('0x32')],'type':_0x57a4b3[_0x883e('0x33')][_0x883e('0x34')]};});_0x19c599['model']=_[_0x883e('0x35')](_0x54bc20,_0x883e('0x2d'));_0x19c599[_0x883e('0x36')]=_['keys'](_0x2f4c22[_0x883e('0x36')]);_0x19c599[_0x883e('0x37')]=_['intersection'](_0x19c599[_0x883e('0x38')],_0x19c599[_0x883e('0x36')]);_0x3eefab['attributes']=_[_0x883e('0x39')](_0x19c599[_0x883e('0x38')],qs[_0x883e('0x3a')](_0x2f4c22['query']['fields']));_0x3eefab[_0x883e('0x3b')]=_0x3eefab[_0x883e('0x3b')]['length']?_0x3eefab['attributes']:_0x19c599[_0x883e('0x38')];if(!_0x2f4c22[_0x883e('0x36')][_0x883e('0x3c')](_0x883e('0x3d'))){_0x3eefab[_0x883e('0x1f')]=qs[_0x883e('0x1f')](_0x2f4c22[_0x883e('0x36')]['limit']);_0x3eefab[_0x883e('0x1e')]=qs[_0x883e('0x1e')](_0x2f4c22[_0x883e('0x36')][_0x883e('0x1e')]);}_0x3eefab['order']=qs[_0x883e('0x3e')](_0x2f4c22[_0x883e('0x36')][_0x883e('0x3e')]);_0x3eefab[_0x883e('0x3f')]=qs[_0x883e('0x37')](_['pick'](_0x2f4c22[_0x883e('0x36')],_0x19c599[_0x883e('0x37')]),_0x54bc20);if(_0x2f4c22[_0x883e('0x36')]['filter']){_0x3eefab['where']=_[_0x883e('0x40')](_0x3eefab[_0x883e('0x3f')],{'$or':_[_0x883e('0x35')](_0x54bc20,function(_0xb952ac){if(_0xb952ac[_0x883e('0x33')]!==_0x883e('0x41')){var _0x3da090={};_0x3da090[_0xb952ac['name']]={'$like':'%'+_0x2f4c22['query']['filter']+'%'};return _0x3da090;}})});}_0x3eefab=_[_0x883e('0x40')]({},_0x3eefab,_0x2f4c22['options']);var _0x3c17bd={'where':_0x3eefab['where']};return db[_0x883e('0x30')][_0x883e('0x1d')](_0x3c17bd)[_0x883e('0x29')](function(_0x53b58e){_0x3a4ed2['count']=_0x53b58e;if(_0x2f4c22[_0x883e('0x36')][_0x883e('0x42')]){_0x3eefab[_0x883e('0x43')]=[{'all':!![]}];}return db[_0x883e('0x30')][_0x883e('0x44')](_0x3eefab);})[_0x883e('0x29')](function(_0x3f75c0){_0x3a4ed2[_0x883e('0x45')]=_0x3f75c0;return _0x3a4ed2;})['then'](respondWithFilteredResult(_0x1fb89b,_0x3eefab))['catch'](handleError(_0x1fb89b,null));};exports[_0x883e('0x46')]=function(_0x312447,_0x189f17){var _0x40bc19={'raw':!![],'where':{'id':_0x312447[_0x883e('0x47')]['id']}},_0x36d570={};_0x36d570[_0x883e('0x38')]=_[_0x883e('0x48')](db[_0x883e('0x30')][_0x883e('0x31')]);_0x36d570[_0x883e('0x36')]=_[_0x883e('0x48')](_0x312447[_0x883e('0x36')]);_0x36d570[_0x883e('0x37')]=_[_0x883e('0x39')](_0x36d570[_0x883e('0x38')],_0x36d570['query']);_0x40bc19[_0x883e('0x3b')]=_[_0x883e('0x39')](_0x36d570['model'],qs[_0x883e('0x3a')](_0x312447['query'][_0x883e('0x3a')]));_0x40bc19[_0x883e('0x3b')]=_0x40bc19['attributes'][_0x883e('0x49')]?_0x40bc19[_0x883e('0x3b')]:_0x36d570[_0x883e('0x38')];if(_0x312447[_0x883e('0x36')][_0x883e('0x42')]){_0x40bc19[_0x883e('0x43')]=[{'all':!![]}];}_0x40bc19=_[_0x883e('0x40')]({},_0x40bc19,_0x312447[_0x883e('0x4a')]);return db[_0x883e('0x30')][_0x883e('0x4b')](_0x40bc19)['then'](handleEntityNotFound(_0x189f17,null))[_0x883e('0x29')](respondWithResult(_0x189f17,null))[_0x883e('0x4c')](handleError(_0x189f17,null));};exports[_0x883e('0x4d')]=function(_0x3fa1cf,_0x152358){return db[_0x883e('0x30')][_0x883e('0x4d')](_0x3fa1cf[_0x883e('0x4e')],{})[_0x883e('0x29')](function(_0xb8889){var _0x4a4342=_0x3fa1cf[_0x883e('0x4f')][_0x883e('0x26')]({'plain':!![]});if(!_0x4a4342)throw new Error(_0x883e('0x50'));if(_0x4a4342['role']===_0x883e('0x4f')){var _0x1d5b04=_0xb8889[_0x883e('0x26')]({'plain':!![]});var _0x505ca3=_0x883e('0x27');return db['UserProfileSection']['find']({'where':{'name':_0x505ca3,'userProfileId':_0x4a4342[_0x883e('0x51')]},'raw':!![]})[_0x883e('0x29')](function(_0x1fddb2){if(_0x1fddb2&&_0x1fddb2['autoAssociation']===0x0){return db[_0x883e('0x28')]['create']({'name':_0x1d5b04[_0x883e('0x2d')],'resourceId':_0x1d5b04['id'],'type':_0x1fddb2[_0x883e('0x2d')],'sectionId':_0x1fddb2['id']},{})[_0x883e('0x29')](function(){return _0xb8889;});}else{return _0xb8889;}})['catch'](function(_0x2d112e){logger['error'](_0x883e('0x52'),_0x2d112e);throw _0x2d112e;});}return _0xb8889;})[_0x883e('0x29')](respondWithResult(_0x152358,0xc9))['catch'](handleError(_0x152358,null));};exports[_0x883e('0x53')]=function(_0x44673a,_0x4db439){if(_0x44673a['body']['id']){delete _0x44673a[_0x883e('0x4e')]['id'];}return db[_0x883e('0x30')]['find']({'where':{'id':_0x44673a[_0x883e('0x47')]['id']}})[_0x883e('0x29')](handleEntityNotFound(_0x4db439,null))[_0x883e('0x29')](saveUpdates(_0x44673a[_0x883e('0x4e')],null))['then'](respondWithResult(_0x4db439,null))['catch'](handleError(_0x4db439,null));};exports[_0x883e('0x25')]=function(_0x2c51d7,_0x57cbec){return db[_0x883e('0x30')][_0x883e('0x4b')]({'where':{'id':_0x2c51d7[_0x883e('0x47')]['id']}})[_0x883e('0x29')](handleEntityNotFound(_0x57cbec,null))['then'](removeEntity(_0x57cbec,null))[_0x883e('0x4c')](handleError(_0x57cbec,null));};exports['describe']=function(_0x376385,_0x245c0d){return db['MailQueue'][_0x883e('0x54')]()[_0x883e('0x29')](respondWithResult(_0x245c0d,null))['catch'](handleError(_0x245c0d,null));};exports[_0x883e('0x55')]=function(_0x480871,_0x2aa6e1,_0x5834da){var _0x4ff944={'raw':!![],'where':{}},_0x47f61c={},_0x15c839;return db[_0x883e('0x30')][_0x883e('0x56')]({'where':{'id':_0x480871[_0x883e('0x47')]['id']}})['then'](handleEntityNotFound(_0x2aa6e1,null))[_0x883e('0x29')](function(_0x593cc3){if(_0x593cc3){_0x15c839=_0x593cc3[_0x883e('0x26')]({'plain':!![]});_0x47f61c[_0x883e('0x38')]=_['keys'](db[_0x883e('0x57')][_0x883e('0x31')]);_0x47f61c[_0x883e('0x36')]=_['keys'](_0x480871[_0x883e('0x36')]);_0x47f61c[_0x883e('0x37')]=_[_0x883e('0x39')](_0x47f61c[_0x883e('0x38')],_0x47f61c[_0x883e('0x36')]);_0x4ff944[_0x883e('0x3b')]=_[_0x883e('0x39')](_0x47f61c['model'],qs[_0x883e('0x3a')](_0x480871[_0x883e('0x36')][_0x883e('0x3a')]));_0x4ff944[_0x883e('0x3b')]=_0x4ff944['attributes'][_0x883e('0x49')]?_0x4ff944[_0x883e('0x3b')]:_0x47f61c[_0x883e('0x38')];if(!_0x480871[_0x883e('0x36')][_0x883e('0x3c')]('nolimit')){_0x4ff944[_0x883e('0x1f')]=qs['limit'](_0x480871[_0x883e('0x36')]['limit']);_0x4ff944[_0x883e('0x1e')]=qs['offset'](_0x480871[_0x883e('0x36')][_0x883e('0x1e')]);}_0x4ff944[_0x883e('0x58')]=qs[_0x883e('0x3e')](_0x480871[_0x883e('0x36')]['sort']);_0x4ff944[_0x883e('0x3f')]=qs[_0x883e('0x37')](_[_0x883e('0x59')](_0x480871[_0x883e('0x36')],_0x47f61c[_0x883e('0x37')]));_0x4ff944[_0x883e('0x3f')][_0x883e('0x5a')]=_0x593cc3['id'];if(_0x480871[_0x883e('0x36')][_0x883e('0x5b')]){_0x4ff944[_0x883e('0x3f')]=_['merge'](_0x4ff944[_0x883e('0x3f')],{'$or':_[_0x883e('0x35')](_0x4ff944['attributes'],function(_0x3db1aa){var _0x134834={};_0x134834[_0x3db1aa]={'$like':'%'+_0x480871['query'][_0x883e('0x5b')]+'%'};return _0x134834;})});}_0x4ff944=_[_0x883e('0x40')]({},_0x4ff944,_0x480871[_0x883e('0x4a')]);return db[_0x883e('0x57')][_0x883e('0x44')](_0x4ff944);}})[_0x883e('0x29')](function(_0x2872fe){if(_0x2872fe){return db[_0x883e('0x5c')]['findAndCountAll']({'where':{'id':_[_0x883e('0x35')](_0x2872fe,_0x883e('0x5d')),'role':'agent'},'attributes':['id',_0x883e('0x2d'),'mailPause','updatedAt',_0x883e('0x5e')]});}})[_0x883e('0x29')](function(_0x4a8876){if(_0x4a8876){return{'count':_0x4a8876[_0x883e('0x1d')],'rows':_[_0x883e('0x35')](_0x4a8876[_0x883e('0x45')],function(_0x485948){return{'membername':_0x485948[_0x883e('0x2d')],'UserId':_0x485948['id'],'queue_name':_0x15c839['name'],'MailQueueId':_0x15c839['id'],'interface':util[_0x883e('0x5f')](_0x883e('0x60'),_0x883e('0x61'),_0x485948['name']),'penalty':0x0,'paused':_0x485948['mailPause'],'createdAt':_0x485948[_0x883e('0x5e')],'updatedAt':_0x485948[_0x883e('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x883e('0x29')](respondWithFilteredResult(_0x2aa6e1,_0x4ff944))[_0x883e('0x4c')](handleError(_0x2aa6e1,null));};exports[_0x883e('0x63')]=function(_0x4dfb42,_0x3b6b5a,_0xa7736c){var _0x325ee7={};var _0x5ad17c={};var _0x4a2c12;var _0x203eac;return db[_0x883e('0x30')][_0x883e('0x56')]({'where':{'id':_0x4dfb42[_0x883e('0x47')]['id']}})[_0x883e('0x29')](handleEntityNotFound(_0x3b6b5a,null))['then'](function(_0x57d5e1){if(_0x57d5e1){_0x4a2c12=_0x57d5e1;_0x5ad17c[_0x883e('0x38')]=_[_0x883e('0x48')](db[_0x883e('0x64')][_0x883e('0x31')]);_0x5ad17c[_0x883e('0x36')]=_[_0x883e('0x48')](_0x4dfb42[_0x883e('0x36')]);_0x5ad17c['filters']=_['intersection'](_0x5ad17c[_0x883e('0x38')],_0x5ad17c[_0x883e('0x36')]);_0x325ee7[_0x883e('0x3b')]=_[_0x883e('0x39')](_0x5ad17c['model'],qs[_0x883e('0x3a')](_0x4dfb42['query'][_0x883e('0x3a')]));_0x325ee7[_0x883e('0x3b')]=_0x325ee7[_0x883e('0x3b')][_0x883e('0x49')]?_0x325ee7[_0x883e('0x3b')]:_0x5ad17c[_0x883e('0x38')];_0x325ee7[_0x883e('0x58')]=qs[_0x883e('0x3e')](_0x4dfb42[_0x883e('0x36')]['sort']);_0x325ee7[_0x883e('0x3f')]=qs[_0x883e('0x37')](_[_0x883e('0x59')](_0x4dfb42[_0x883e('0x36')],_0x5ad17c['filters']));if(_0x4dfb42['query'][_0x883e('0x5b')]){_0x325ee7['where']=_['merge'](_0x325ee7['where'],{'$or':_['map'](_0x325ee7[_0x883e('0x3b')],function(_0x1cbe65){var _0x184960={};_0x184960[_0x1cbe65]={'$like':'%'+_0x4dfb42[_0x883e('0x36')]['filter']+'%'};return _0x184960;})});}_0x325ee7=_[_0x883e('0x40')]({},_0x325ee7,_0x4dfb42[_0x883e('0x4a')]);return _0x4a2c12[_0x883e('0x63')](_0x325ee7);}})[_0x883e('0x29')](function(_0x21b26e){if(_0x21b26e){_0x203eac=_0x21b26e[_0x883e('0x49')];if(!_0x4dfb42[_0x883e('0x36')][_0x883e('0x3c')](_0x883e('0x3d'))){_0x325ee7[_0x883e('0x1f')]=qs[_0x883e('0x1f')](_0x4dfb42[_0x883e('0x36')][_0x883e('0x1f')]);_0x325ee7[_0x883e('0x1e')]=qs[_0x883e('0x1e')](_0x4dfb42[_0x883e('0x36')][_0x883e('0x1e')]);}return _0x4a2c12[_0x883e('0x63')](_0x325ee7);}})[_0x883e('0x29')](function(_0x15baf){if(_0x15baf){return _0x15baf?{'count':_0x203eac,'rows':_0x15baf}:null;}})[_0x883e('0x29')](respondWithResult(_0x3b6b5a,null))[_0x883e('0x4c')](handleError(_0x3b6b5a,null));};exports[_0x883e('0x65')]=function(_0x2ae8db,_0xf3ed06,_0x1cd8cf){var _0x441a4=_0x2ae8db[_0x883e('0x4e')][_0x883e('0x66')];return db[_0x883e('0x64')][_0x883e('0x44')]({'where':{'id':_0x441a4},'attributes':['id'],'include':[{'model':db[_0x883e('0x5c')],'as':'Agents','attributes':['id',_0x883e('0x2d'),_0x883e('0x67'),'voicePause','interface'],'raw':!![]}]})[_0x883e('0x29')](function(_0x5c2384){if(_0x5c2384){var _0xae91ca=_['flatMap'](_0x5c2384,function(_0x5c2f05){var _0x3ce9e8=_0x5c2f05[_0x883e('0x26')]({'plain':!![]});return _0x3ce9e8[_0x883e('0x68')];});return db[_0x883e('0x30')][_0x883e('0x4b')]({'where':{'id':_0x2ae8db[_0x883e('0x47')]['id']}})[_0x883e('0x29')](function(_0x488ab2){return db[_0x883e('0x69')][_0x883e('0x6a')](function(_0x112306){return _0x488ab2[_0x883e('0x65')](_0x441a4,{'transaction':_0x112306})[_0x883e('0x29')](function(){return BPromise[_0x883e('0x6b')](_0xae91ca,function(_0x55bf67){return db[_0x883e('0x57')][_0x883e('0x6c')]({'where':{'UserId':_0x55bf67['id'],'MailQueueId':_0x2ae8db[_0x883e('0x47')]['id']},'transaction':_0x112306});});})['then'](function(){_0xae91ca[_0x883e('0x6d')](function(_0x5479e2){socket[_0x883e('0x6e')](_0x883e('0x6f'),{'UserId':_0x5479e2['id'],'MailQueueId':_0x488ab2['id']});});});});});}})[_0x883e('0x29')](respondWithStatusCode(_0xf3ed06,null))[_0x883e('0x4c')](handleError(_0xf3ed06,null));};exports[_0x883e('0x70')]=function(_0x2ae5ad,_0x2f1480,_0x3716c3){return db[_0x883e('0x64')][_0x883e('0x44')]({'where':{'id':_0x2ae5ad['query'][_0x883e('0x66')]},'attributes':['id'],'include':[{'model':db[_0x883e('0x5c')],'as':_0x883e('0x68'),'attributes':['id'],'raw':!![]}]})[_0x883e('0x29')](handleEntityNotFound(_0x2f1480,null))[_0x883e('0x29')](function(_0x3a3e06){var _0x236db6=_[_0x883e('0x35')](_0x3a3e06,'id');var _0x5b321c=[];var _0x2a0e53=[];var _0x498604=squel[_0x883e('0x71')]();_0x498604[_0x883e('0x72')](_0x883e('0x73'))[_0x883e('0x74')](_0x883e('0x75'),'tq')['join'](_0x883e('0x76'),'ut',_0x883e('0x77'))[_0x883e('0x3f')](_0x883e('0x78'),_0x2ae5ad[_0x883e('0x47')]['id']);for(var _0xe59e32=0x0;_0xe59e32<_0x3a3e06[_0x883e('0x49')];_0xe59e32+=0x1){let _0x2b7c4a=_0x3a3e06[_0xe59e32];for(var _0x5ca7a9=0x0;_0x5ca7a9<_0x2b7c4a['Agents'][_0x883e('0x49')];_0x5ca7a9+=0x1){let _0x4656b4=_0x2b7c4a[_0x883e('0x68')][_0x5ca7a9];var _0x5b43e1=_0x498604[_0x883e('0x79')]();_0x5b43e1[_0x883e('0x3f')](_0x883e('0x7a'),_0x4656b4['id']);_0x2a0e53[_0x883e('0x7b')](db[_0x883e('0x69')][_0x883e('0x36')](_0x5b43e1[_0x883e('0x7c')](),{'type':db[_0x883e('0x69')][_0x883e('0x7d')][_0x883e('0x7e')]})[_0x883e('0x29')](function(_0x48a172){if(_0x48a172[_0x883e('0x49')]===0x1){return _0x4656b4['id'];}else{var _0x38da84=_['every'](_[_0x883e('0x35')](_0x48a172,_0x883e('0x7f')),function(_0x30ed8b){return _[_0x883e('0x80')](_0x236db6,_0x30ed8b);});if(_0x38da84){return _0x4656b4['id'];}}}));}}return BPromise['all'](_0x2a0e53)['then'](function(_0xf24b33){_0x5b321c=_(_0x5b321c)[_0x883e('0x81')](_0xf24b33)[_0x883e('0x82')]()[_0x883e('0x83')]();return db[_0x883e('0x30')]['find']({'where':{'id':_0x2ae5ad['params']['id']}})[_0x883e('0x29')](function(_0x94f5ce){return db['sequelize'][_0x883e('0x6a')](function(_0x4e924f){return _0x94f5ce['removeTeams'](_0x2ae5ad[_0x883e('0x36')][_0x883e('0x66')],{'transaction':_0x4e924f})[_0x883e('0x29')](function(){if(!_['isEmpty'](_0x5b321c)){return _0x94f5ce['removeAgents'](_0x5b321c,{'transaction':_0x4e924f});}})[_0x883e('0x29')](function(){_0x5b321c[_0x883e('0x6d')](function(_0x4402aa){socket['emit'](_0x883e('0x84'),{'UserId':_0x4402aa,'MailQueueId':_0x94f5ce['id']});});});});});});})[_0x883e('0x29')](respondWithStatusCode(_0x2f1480,null))['catch'](handleError(_0x2f1480,null));};exports[_0x883e('0x85')]=function(_0xfd28cd,_0x2de485,_0x4797d4){return db[_0x883e('0x30')][_0x883e('0x4b')]({'where':{'id':_0xfd28cd[_0x883e('0x47')]['id']}})[_0x883e('0x29')](handleEntityNotFound(_0x2de485,null))[_0x883e('0x29')](function(_0x1653a8){if(_0x1653a8){return _0x1653a8['addAgents'](_0xfd28cd[_0x883e('0x4e')][_0x883e('0x66')],_[_0x883e('0x86')](_0xfd28cd[_0x883e('0x4e')],[_0x883e('0x66'),'id'])||{})[_0x883e('0x87')](function(_0x3cdf72){for(var _0x355eaa=0x0;_0x355eaa<_0xfd28cd[_0x883e('0x4e')][_0x883e('0x66')]['length'];_0x355eaa+=0x1){socket['emit'](_0x883e('0x6f'),{'UserId':_0xfd28cd['body'][_0x883e('0x66')][_0x355eaa],'MailQueueId':_0xfd28cd[_0x883e('0x47')]['id']});}return _0x3cdf72;});}})[_0x883e('0x29')](respondWithResult(_0x2de485,null))[_0x883e('0x4c')](handleError(_0x2de485,null));};exports['removeAgents']=function(_0x53ae22,_0x54a1a6,_0x26f080){return db['MailQueue'][_0x883e('0x4b')]({'where':{'id':_0x53ae22[_0x883e('0x47')]['id']}})[_0x883e('0x29')](handleEntityNotFound(_0x54a1a6,null))[_0x883e('0x29')](function(_0x509ace){if(_0x509ace){return _0x509ace[_0x883e('0x88')](_0x53ae22[_0x883e('0x36')]['ids'])[_0x883e('0x29')](function(){if(_[_0x883e('0x89')](_0x53ae22['query'][_0x883e('0x66')])){for(var _0x16ddfa=0x0;_0x16ddfa<_0x53ae22[_0x883e('0x36')][_0x883e('0x66')]['length'];_0x16ddfa+=0x1){socket[_0x883e('0x6e')](_0x883e('0x84'),{'UserId':Number(_0x53ae22['query']['ids'][_0x16ddfa]),'MailQueueId':Number(_0x53ae22[_0x883e('0x47')]['id'])});}}else{socket[_0x883e('0x6e')](_0x883e('0x84'),{'UserId':Number(_0x53ae22[_0x883e('0x36')][_0x883e('0x66')]),'MailQueueId':Number(_0x53ae22['params']['id'])});}});}})[_0x883e('0x29')](respondWithStatusCode(_0x54a1a6,null))[_0x883e('0x4c')](handleError(_0x54a1a6,null));};exports['getAgents']=function(_0x3964ef,_0x3ed634,_0x1d0462){var _0x13d3e0={};var _0x515c8e={};var _0x5ec739;var _0x58ce3a;return db[_0x883e('0x30')][_0x883e('0x56')]({'where':{'id':_0x3964ef[_0x883e('0x47')]['id']}})['then'](handleEntityNotFound(_0x3ed634,null))['then'](function(_0x295d9){if(_0x295d9){_0x5ec739=_0x295d9;_0x515c8e['model']=_['keys'](db[_0x883e('0x5c')]['rawAttributes']);_0x515c8e[_0x883e('0x36')]=_[_0x883e('0x48')](_0x3964ef[_0x883e('0x36')]);_0x515c8e['filters']=_['intersection'](_0x515c8e['model'],_0x515c8e['query']);_0x13d3e0[_0x883e('0x3b')]=_[_0x883e('0x39')](_0x515c8e[_0x883e('0x38')],qs[_0x883e('0x3a')](_0x3964ef[_0x883e('0x36')][_0x883e('0x3a')]));_0x13d3e0[_0x883e('0x3b')]=_0x13d3e0[_0x883e('0x3b')][_0x883e('0x49')]?_0x13d3e0['attributes']:_0x515c8e[_0x883e('0x38')];_0x13d3e0['order']=qs[_0x883e('0x3e')](_0x3964ef[_0x883e('0x36')][_0x883e('0x3e')]);_0x13d3e0[_0x883e('0x3f')]=qs[_0x883e('0x37')](_[_0x883e('0x59')](_0x3964ef[_0x883e('0x36')],_0x515c8e[_0x883e('0x37')]));if(_0x3964ef[_0x883e('0x36')][_0x883e('0x5b')]){_0x13d3e0[_0x883e('0x3f')]=_[_0x883e('0x40')](_0x13d3e0['where'],{'$or':_[_0x883e('0x35')](_0x13d3e0[_0x883e('0x3b')],function(_0x384fee){var _0x5b9f11={};_0x5b9f11[_0x384fee]={'$like':'%'+_0x3964ef[_0x883e('0x36')]['filter']+'%'};return _0x5b9f11;})});}_0x13d3e0=_[_0x883e('0x40')]({},_0x13d3e0,_0x3964ef[_0x883e('0x4a')]);return _0x5ec739['getAgents'](_0x13d3e0);}})['then'](function(_0x196755){if(_0x196755){_0x58ce3a=_0x196755[_0x883e('0x49')];if(!_0x3964ef[_0x883e('0x36')]['hasOwnProperty'](_0x883e('0x3d'))){_0x13d3e0[_0x883e('0x1f')]=qs[_0x883e('0x1f')](_0x3964ef['query'][_0x883e('0x1f')]);_0x13d3e0[_0x883e('0x1e')]=qs['offset'](_0x3964ef[_0x883e('0x36')][_0x883e('0x1e')]);}return _0x5ec739[_0x883e('0x8a')](_0x13d3e0);}})['then'](function(_0x559b9c){if(_0x559b9c){return _0x559b9c?{'count':_0x58ce3a,'rows':_0x559b9c}:null;}})[_0x883e('0x29')](respondWithResult(_0x3ed634,null))[_0x883e('0x4c')](handleError(_0x3ed634,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 41984e5..735914c 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 _0x4400=['setMaxListeners','save','update','remove','emit','hook','exports','events','../../mysqldb'];(function(_0x40eadc,_0x37af8d){var _0x6963b4=function(_0x4c2c9){while(--_0x4c2c9){_0x40eadc['push'](_0x40eadc['shift']());}};_0x6963b4(++_0x37af8d);}(_0x4400,0x18a));var _0x0440=function(_0x1ba92f,_0x767383){_0x1ba92f=_0x1ba92f-0x0;var _0x227a84=_0x4400[_0x1ba92f];return _0x227a84;};'use strict';var EventEmitter=require(_0x0440('0x0'));var MailQueue=require(_0x0440('0x1'))['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x0440('0x2')](0x0);var events={'afterCreate':_0x0440('0x3'),'afterUpdate':_0x0440('0x4'),'afterDestroy':_0x0440('0x5')};function emitEvent(_0x257a5){return function(_0x4eff1e,_0x4a3b3a,_0x5475e8){MailQueueEvents[_0x0440('0x6')](_0x257a5+':'+_0x4eff1e['id'],_0x4eff1e);MailQueueEvents[_0x0440('0x6')](_0x257a5,_0x4eff1e);_0x5475e8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue[_0x0440('0x7')](e,emitEvent(event));}}module[_0x0440('0x8')]=MailQueueEvents; \ No newline at end of file +var _0x73f7=['update','remove','emit','hook','exports','events','../../mysqldb','setMaxListeners','save'];(function(_0x4a9d73,_0x404b5f){var _0x2544c1=function(_0x45c894){while(--_0x45c894){_0x4a9d73['push'](_0x4a9d73['shift']());}};_0x2544c1(++_0x404b5f);}(_0x73f7,0xef));var _0x773f=function(_0x1caacc,_0x100964){_0x1caacc=_0x1caacc-0x0;var _0x36bb27=_0x73f7[_0x1caacc];return _0x36bb27;};'use strict';var EventEmitter=require(_0x773f('0x0'));var MailQueue=require(_0x773f('0x1'))['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x773f('0x2')](0x0);var events={'afterCreate':_0x773f('0x3'),'afterUpdate':_0x773f('0x4'),'afterDestroy':_0x773f('0x5')};function emitEvent(_0x44a2d0){return function(_0x3d70b2,_0x5c2f70,_0x1744d1){MailQueueEvents['emit'](_0x44a2d0+':'+_0x3d70b2['id'],_0x3d70b2);MailQueueEvents[_0x773f('0x6')](_0x44a2d0,_0x3d70b2);_0x1744d1(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue[_0x773f('0x7')](e,emitEvent(event));}}module[_0x773f('0x8')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index acad277..18a426d 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 _0xa18e=['rimraf','../../config/environment','./mailQueue.attributes','define','MailQueue','mail_queues','lodash','moment','bluebird','request-promise','path'];(function(_0x288ba7,_0x511651){var _0x127f4d=function(_0x38950e){while(--_0x38950e){_0x288ba7['push'](_0x288ba7['shift']());}};_0x127f4d(++_0x511651);}(_0xa18e,0x103));var _0xea18=function(_0x12fc8d,_0x19ee33){_0x12fc8d=_0x12fc8d-0x0;var _0x3f9d04=_0xa18e[_0x12fc8d];return _0x3f9d04;};'use strict';var _=require(_0xea18('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xea18('0x1'));var BPromise=require(_0xea18('0x2'));var rp=require(_0xea18('0x3'));var fs=require('fs');var path=require(_0xea18('0x4'));var rimraf=require(_0xea18('0x5'));var config=require(_0xea18('0x6'));var attributes=require(_0xea18('0x7'));module['exports']=function(_0x32b693,_0x2773e8){return _0x32b693[_0xea18('0x8')](_0xea18('0x9'),attributes,{'tableName':_0xea18('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3bbf=['rimraf','../../config/environment','exports','MailQueue','mail_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x3cb79e,_0x368779){var _0x179359=function(_0x278e86){while(--_0x278e86){_0x3cb79e['push'](_0x3cb79e['shift']());}};_0x179359(++_0x368779);}(_0x3bbf,0xc5));var _0xf3bb=function(_0x25498b,_0x201e61){_0x25498b=_0x25498b-0x0;var _0x1d15cc=_0x3bbf[_0x25498b];return _0x1d15cc;};'use strict';var _=require(_0xf3bb('0x0'));var util=require(_0xf3bb('0x1'));var logger=require(_0xf3bb('0x2'))(_0xf3bb('0x3'));var moment=require(_0xf3bb('0x4'));var BPromise=require(_0xf3bb('0x5'));var rp=require(_0xf3bb('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf3bb('0x7'));var config=require(_0xf3bb('0x8'));var attributes=require('./mailQueue.attributes');module[_0xf3bb('0x9')]=function(_0x4945f0,_0x4cdb07){return _0x4945f0['define'](_0xf3bb('0xa'),attributes,{'tableName':_0xf3bb('0xb'),'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 ab3f545..2d02fc3 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 _0xea49=['where','info','ShowMailQueue','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./mailQueue.socket','register','request','MailQueue,\x20%s,\x20%s','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','MailQueue','findAll','options','raw','attributes','limit','include','map','model','then','GetMailQueue'];(function(_0x20ef64,_0x4a8fe9){var _0x3707d8=function(_0x5b9a88){while(--_0x5b9a88){_0x20ef64['push'](_0x20ef64['shift']());}};_0x3707d8(++_0x4a8fe9);}(_0xea49,0x14b));var _0x9ea4=function(_0x54904e,_0x5647ff){_0x54904e=_0x54904e-0x0;var _0x179c42=_0xea49[_0x54904e];return _0x179c42;};'use strict';var _=require(_0x9ea4('0x0'));var util=require(_0x9ea4('0x1'));var moment=require('moment');var BPromise=require(_0x9ea4('0x2'));var rs=require(_0x9ea4('0x3'));var fs=require('fs');var Redis=require(_0x9ea4('0x4'));var db=require(_0x9ea4('0x5'))['db'];var utils=require(_0x9ea4('0x6'));var logger=require(_0x9ea4('0x7'))('rpc');var config=require(_0x9ea4('0x8'));var jayson=require(_0x9ea4('0x9'));var client=jayson[_0x9ea4('0xa')][_0x9ea4('0xb')]({'port':0x232a});config[_0x9ea4('0xc')]=_['defaults'](config['redis'],{'host':_0x9ea4('0xd'),'port':0x18eb});var socket=require(_0x9ea4('0xe'))(new Redis(config[_0x9ea4('0xc')]));require(_0x9ea4('0xf'))[_0x9ea4('0x10')](socket);function respondWithRpcPromise(_0x3e81b8,_0x4fbdf0,_0x7a0a1e){return new BPromise(function(_0x2f8309,_0xc82666){return client[_0x9ea4('0x11')](_0x3e81b8,_0x7a0a1e)['then'](function(_0x258d6e){logger['info'](_0x9ea4('0x12'),_0x4fbdf0,_0x9ea4('0x13'));logger[_0x9ea4('0x14')](_0x9ea4('0x15'),_0x4fbdf0,_0x9ea4('0x13'),JSON[_0x9ea4('0x16')](_0x258d6e));if(_0x258d6e['error']){if(_0x258d6e[_0x9ea4('0x17')]['code']===0x1f4){logger['error'](_0x9ea4('0x12'),_0x4fbdf0,_0x258d6e[_0x9ea4('0x17')][_0x9ea4('0x18')]);return _0xc82666(_0x258d6e[_0x9ea4('0x17')][_0x9ea4('0x18')]);}logger['error']('MailQueue,\x20%s,\x20%s',_0x4fbdf0,_0x258d6e[_0x9ea4('0x17')][_0x9ea4('0x18')]);return _0x2f8309(_0x258d6e[_0x9ea4('0x17')][_0x9ea4('0x18')]);}else{logger['info']('MailQueue,\x20%s,\x20%s',_0x4fbdf0,_0x9ea4('0x13'));_0x2f8309(_0x258d6e[_0x9ea4('0x19')]['message']);}})[_0x9ea4('0x1a')](function(_0x250e7f){logger[_0x9ea4('0x17')](_0x9ea4('0x12'),_0x4fbdf0,_0x250e7f);_0xc82666(_0x250e7f);});});}exports['GetMailQueue']=function(_0x5a0870){var _0x12867b=this;return new Promise(function(_0x2cbd87,_0x4599d3){return db[_0x9ea4('0x1b')][_0x9ea4('0x1c')]({'raw':_0x5a0870['options']?_0x5a0870[_0x9ea4('0x1d')][_0x9ea4('0x1e')]===undefined?!![]:![]:!![],'where':_0x5a0870[_0x9ea4('0x1d')]?_0x5a0870[_0x9ea4('0x1d')]['where']||null:null,'attributes':_0x5a0870[_0x9ea4('0x1d')]?_0x5a0870['options'][_0x9ea4('0x1f')]||null:null,'limit':_0x5a0870[_0x9ea4('0x1d')]?_0x5a0870[_0x9ea4('0x1d')][_0x9ea4('0x20')]||null:null,'include':_0x5a0870[_0x9ea4('0x1d')]?_0x5a0870[_0x9ea4('0x1d')][_0x9ea4('0x21')]?_[_0x9ea4('0x22')](_0x5a0870[_0x9ea4('0x1d')][_0x9ea4('0x21')],function(_0x1c456c){return{'model':db[_0x1c456c[_0x9ea4('0x23')]],'as':_0x1c456c['as'],'attributes':_0x1c456c[_0x9ea4('0x1f')],'include':_0x1c456c['include']?_[_0x9ea4('0x22')](_0x1c456c[_0x9ea4('0x21')],function(_0x283713){return{'model':db[_0x283713[_0x9ea4('0x23')]],'as':_0x283713['as'],'attributes':_0x283713[_0x9ea4('0x1f')],'include':_0x283713[_0x9ea4('0x21')]?_[_0x9ea4('0x22')](_0x283713['include'],function(_0x1b51bc){return{'model':db[_0x1b51bc[_0x9ea4('0x23')]],'as':_0x1b51bc['as'],'attributes':_0x1b51bc[_0x9ea4('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x9ea4('0x24')](function(_0x3bd439){logger['info'](_0x9ea4('0x25'),_0x5a0870);logger[_0x9ea4('0x14')](_0x9ea4('0x25'),_0x5a0870,JSON[_0x9ea4('0x16')](_0x3bd439));_0x2cbd87(_0x3bd439);})['catch'](function(_0x1cbe54){logger['error'](_0x9ea4('0x25'),_0x1cbe54[_0x9ea4('0x18')],_0x5a0870);_0x4599d3(_0x12867b[_0x9ea4('0x17')](0x1f4,_0x1cbe54[_0x9ea4('0x18')]));});});};exports['ShowMailQueue']=function(_0x505d03){var _0x305001=this;return new Promise(function(_0x3df288,_0x3ca2a3){return db['MailQueue']['find']({'raw':_0x505d03[_0x9ea4('0x1d')]?_0x505d03[_0x9ea4('0x1d')][_0x9ea4('0x1e')]===undefined?!![]:![]:!![],'where':_0x505d03['options']?_0x505d03[_0x9ea4('0x1d')][_0x9ea4('0x26')]||null:null,'attributes':_0x505d03['options']?_0x505d03[_0x9ea4('0x1d')][_0x9ea4('0x1f')]||null:null,'include':_0x505d03[_0x9ea4('0x1d')]?_0x505d03[_0x9ea4('0x1d')][_0x9ea4('0x21')]?_[_0x9ea4('0x22')](_0x505d03[_0x9ea4('0x1d')][_0x9ea4('0x21')],function(_0x361988){return{'model':db[_0x361988[_0x9ea4('0x23')]],'as':_0x361988['as'],'attributes':_0x361988[_0x9ea4('0x1f')],'include':_0x361988[_0x9ea4('0x21')]?_[_0x9ea4('0x22')](_0x361988[_0x9ea4('0x21')],function(_0x5e03b9){return{'model':db[_0x5e03b9['model']],'as':_0x5e03b9['as'],'attributes':_0x5e03b9[_0x9ea4('0x1f')],'include':_0x5e03b9[_0x9ea4('0x21')]?_[_0x9ea4('0x22')](_0x5e03b9[_0x9ea4('0x21')],function(_0xcb1bd9){return{'model':db[_0xcb1bd9[_0x9ea4('0x23')]],'as':_0xcb1bd9['as'],'attributes':_0xcb1bd9['attributes']};}):[]};}):[]};}):[]:[]})[_0x9ea4('0x24')](function(_0x45af32){logger[_0x9ea4('0x27')](_0x9ea4('0x28'),_0x505d03);logger['debug'](_0x9ea4('0x28'),_0x505d03,JSON[_0x9ea4('0x16')](_0x45af32));_0x3df288(_0x45af32);})[_0x9ea4('0x1a')](function(_0x36d1dd){logger[_0x9ea4('0x17')]('ShowMailQueue',_0x36d1dd[_0x9ea4('0x18')],_0x505d03);_0x3ca2a3(_0x305001[_0x9ea4('0x17')](0x1f4,_0x36d1dd[_0x9ea4('0x18')]));});});}; \ No newline at end of file +var _0xcbb7=['include','model','GetMailQueue','catch','ShowMailQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','./mailQueue.socket','register','request','then','info','MailQueue,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','MailQueue','options','raw','where','attributes','map'];(function(_0xcaf339,_0x4bd8ce){var _0x1eb36e=function(_0x22e888){while(--_0x22e888){_0xcaf339['push'](_0xcaf339['shift']());}};_0x1eb36e(++_0x4bd8ce);}(_0xcbb7,0x11e));var _0x7cbb=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xcbb7[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0x7cbb('0x0'));var util=require(_0x7cbb('0x1'));var moment=require(_0x7cbb('0x2'));var BPromise=require(_0x7cbb('0x3'));var rs=require(_0x7cbb('0x4'));var fs=require('fs');var Redis=require(_0x7cbb('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x7cbb('0x6'));var logger=require(_0x7cbb('0x7'))(_0x7cbb('0x8'));var config=require(_0x7cbb('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7cbb('0xa')][_0x7cbb('0xb')]({'port':0x232a});config['redis']=_[_0x7cbb('0xc')](config[_0x7cbb('0xd')],{'host':_0x7cbb('0xe'),'port':0x18eb});var socket=require(_0x7cbb('0xf'))(new Redis(config['redis']));require(_0x7cbb('0x10'))[_0x7cbb('0x11')](socket);function respondWithRpcPromise(_0x374c38,_0x50d515,_0x4ddc1a){return new BPromise(function(_0x5e26c5,_0x4cd7c3){return client[_0x7cbb('0x12')](_0x374c38,_0x4ddc1a)[_0x7cbb('0x13')](function(_0x33e4db){logger[_0x7cbb('0x14')](_0x7cbb('0x15'),_0x50d515,'request\x20sent');logger[_0x7cbb('0x16')]('MailQueue,\x20%s,\x20%s,\x20%s',_0x50d515,_0x7cbb('0x17'),JSON[_0x7cbb('0x18')](_0x33e4db));if(_0x33e4db[_0x7cbb('0x19')]){if(_0x33e4db[_0x7cbb('0x19')][_0x7cbb('0x1a')]===0x1f4){logger[_0x7cbb('0x19')](_0x7cbb('0x15'),_0x50d515,_0x33e4db['error']['message']);return _0x4cd7c3(_0x33e4db[_0x7cbb('0x19')][_0x7cbb('0x1b')]);}logger['error'](_0x7cbb('0x15'),_0x50d515,_0x33e4db[_0x7cbb('0x19')]['message']);return _0x5e26c5(_0x33e4db[_0x7cbb('0x19')]['message']);}else{logger[_0x7cbb('0x14')](_0x7cbb('0x15'),_0x50d515,'request\x20sent');_0x5e26c5(_0x33e4db['result'][_0x7cbb('0x1b')]);}})['catch'](function(_0x9c0612){logger[_0x7cbb('0x19')](_0x7cbb('0x15'),_0x50d515,_0x9c0612);_0x4cd7c3(_0x9c0612);});});}exports['GetMailQueue']=function(_0x4d7336){var _0x462631=this;return new Promise(function(_0x1fdc25,_0x4f109a){return db[_0x7cbb('0x1c')]['findAll']({'raw':_0x4d7336[_0x7cbb('0x1d')]?_0x4d7336['options'][_0x7cbb('0x1e')]===undefined?!![]:![]:!![],'where':_0x4d7336[_0x7cbb('0x1d')]?_0x4d7336[_0x7cbb('0x1d')][_0x7cbb('0x1f')]||null:null,'attributes':_0x4d7336['options']?_0x4d7336[_0x7cbb('0x1d')][_0x7cbb('0x20')]||null:null,'limit':_0x4d7336[_0x7cbb('0x1d')]?_0x4d7336[_0x7cbb('0x1d')]['limit']||null:null,'include':_0x4d7336[_0x7cbb('0x1d')]?_0x4d7336['options']['include']?_[_0x7cbb('0x21')](_0x4d7336[_0x7cbb('0x1d')][_0x7cbb('0x22')],function(_0x48b053){return{'model':db[_0x48b053[_0x7cbb('0x23')]],'as':_0x48b053['as'],'attributes':_0x48b053[_0x7cbb('0x20')],'include':_0x48b053[_0x7cbb('0x22')]?_[_0x7cbb('0x21')](_0x48b053[_0x7cbb('0x22')],function(_0x530b20){return{'model':db[_0x530b20[_0x7cbb('0x23')]],'as':_0x530b20['as'],'attributes':_0x530b20['attributes'],'include':_0x530b20[_0x7cbb('0x22')]?_[_0x7cbb('0x21')](_0x530b20['include'],function(_0x3bd941){return{'model':db[_0x3bd941[_0x7cbb('0x23')]],'as':_0x3bd941['as'],'attributes':_0x3bd941[_0x7cbb('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x32b9c9){logger['info'](_0x7cbb('0x24'),_0x4d7336);logger['debug'](_0x7cbb('0x24'),_0x4d7336,JSON[_0x7cbb('0x18')](_0x32b9c9));_0x1fdc25(_0x32b9c9);})[_0x7cbb('0x25')](function(_0x9af312){logger['error']('GetMailQueue',_0x9af312[_0x7cbb('0x1b')],_0x4d7336);_0x4f109a(_0x462631[_0x7cbb('0x19')](0x1f4,_0x9af312[_0x7cbb('0x1b')]));});});};exports[_0x7cbb('0x26')]=function(_0x699309){var _0x2a935e=this;return new Promise(function(_0x4667d6,_0x2d5612){return db[_0x7cbb('0x1c')][_0x7cbb('0x27')]({'raw':_0x699309[_0x7cbb('0x1d')]?_0x699309[_0x7cbb('0x1d')][_0x7cbb('0x1e')]===undefined?!![]:![]:!![],'where':_0x699309[_0x7cbb('0x1d')]?_0x699309['options'][_0x7cbb('0x1f')]||null:null,'attributes':_0x699309[_0x7cbb('0x1d')]?_0x699309[_0x7cbb('0x1d')]['attributes']||null:null,'include':_0x699309['options']?_0x699309[_0x7cbb('0x1d')]['include']?_[_0x7cbb('0x21')](_0x699309[_0x7cbb('0x1d')][_0x7cbb('0x22')],function(_0x1bdbf4){return{'model':db[_0x1bdbf4[_0x7cbb('0x23')]],'as':_0x1bdbf4['as'],'attributes':_0x1bdbf4['attributes'],'include':_0x1bdbf4[_0x7cbb('0x22')]?_[_0x7cbb('0x21')](_0x1bdbf4[_0x7cbb('0x22')],function(_0x49e53d){return{'model':db[_0x49e53d[_0x7cbb('0x23')]],'as':_0x49e53d['as'],'attributes':_0x49e53d[_0x7cbb('0x20')],'include':_0x49e53d[_0x7cbb('0x22')]?_[_0x7cbb('0x21')](_0x49e53d[_0x7cbb('0x22')],function(_0x3cd7c5){return{'model':db[_0x3cd7c5[_0x7cbb('0x23')]],'as':_0x3cd7c5['as'],'attributes':_0x3cd7c5[_0x7cbb('0x20')]};}):[]};}):[]};}):[]:[]})[_0x7cbb('0x13')](function(_0x3fe10a){logger[_0x7cbb('0x14')]('ShowMailQueue',_0x699309);logger['debug']('ShowMailQueue',_0x699309,JSON[_0x7cbb('0x18')](_0x3fe10a));_0x4667d6(_0x3fe10a);})[_0x7cbb('0x25')](function(_0x3b1184){logger[_0x7cbb('0x19')](_0x7cbb('0x26'),_0x3b1184[_0x7cbb('0x1b')],_0x699309);_0x2d5612(_0x2a935e[_0x7cbb('0x19')](0x1f4,_0x3b1184['message']));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 4d80c5b..e7963c1 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 _0x64c8=['removeListener','register','length','mailQueue:','save','remove','update','emit'];(function(_0x232eb7,_0x199b07){var _0xd7fb8=function(_0x149ed6){while(--_0x149ed6){_0x232eb7['push'](_0x232eb7['shift']());}};_0xd7fb8(++_0x199b07);}(_0x64c8,0x13c));var _0x864c=function(_0x5849af,_0x4f28c8){_0x5849af=_0x5849af-0x0;var _0x3ce263=_0x64c8[_0x5849af];return _0x3ce263;};'use strict';var MailQueueEvents=require('./mailQueue.events');var events=[_0x864c('0x0'),_0x864c('0x1'),_0x864c('0x2')];function createListener(_0x4b9dd4,_0x273185){return function(_0x14e936){_0x273185[_0x864c('0x3')](_0x4b9dd4,_0x14e936);};}function removeListener(_0xbb02,_0x225323){return function(){MailQueueEvents[_0x864c('0x4')](_0xbb02,_0x225323);};}exports[_0x864c('0x5')]=function(_0x1b110c){for(var _0x56ca20=0x0,_0x33ec0c=events[_0x864c('0x6')];_0x56ca20<_0x33ec0c;_0x56ca20++){var _0x4fbdfd=events[_0x56ca20];var _0x495ff5=createListener(_0x864c('0x7')+_0x4fbdfd,_0x1b110c);MailQueueEvents['on'](_0x4fbdfd,_0x495ff5);}}; \ No newline at end of file +var _0x7d9c=['emit','removeListener','length','./mailQueue.events','save','remove'];(function(_0x4809cf,_0xcacf22){var _0x43adfc=function(_0x5a59aa){while(--_0x5a59aa){_0x4809cf['push'](_0x4809cf['shift']());}};_0x43adfc(++_0xcacf22);}(_0x7d9c,0xbd));var _0xc7d9=function(_0x4bdb49,_0x325643){_0x4bdb49=_0x4bdb49-0x0;var _0x339d7b=_0x7d9c[_0x4bdb49];return _0x339d7b;};'use strict';var MailQueueEvents=require(_0xc7d9('0x0'));var events=[_0xc7d9('0x1'),_0xc7d9('0x2'),'update'];function createListener(_0x2cd57d,_0x46f9e1){return function(_0xd16d35){_0x46f9e1[_0xc7d9('0x3')](_0x2cd57d,_0xd16d35);};}function removeListener(_0x41dc3f,_0x22165a){return function(){MailQueueEvents[_0xc7d9('0x4')](_0x41dc3f,_0x22165a);};}exports['register']=function(_0xf7d79d){for(var _0x289a5e=0x0,_0x2a34a2=events[_0xc7d9('0x5')];_0x289a5e<_0x2a34a2;_0x289a5e++){var _0x51f37b=events[_0x289a5e];var _0xa90a6e=createListener('mailQueue:'+_0x51f37b,_0xf7d79d);MailQueueEvents['on'](_0x51f37b,_0xa90a6e);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 128ad1b..18fdc1d 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 _0x601c=['destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','get','isAuthenticated','describe','/:id','post','create','put','update','delete'];(function(_0x5b5817,_0x2e8f7f){var _0x4d60e9=function(_0x51f8ec){while(--_0x51f8ec){_0x5b5817['push'](_0x5b5817['shift']());}};_0x4d60e9(++_0x2e8f7f);}(_0x601c,0x11f));var _0xc601=function(_0x857c02,_0x3cc0b3){_0x857c02=_0x857c02-0x0;var _0x5bbbab=_0x601c[_0x857c02];return _0x5bbbab;};'use strict';var multer=require('multer');var util=require(_0xc601('0x0'));var path=require('path');var timeout=require(_0xc601('0x1'));var express=require(_0xc601('0x2'));var router=express[_0xc601('0x3')]();var auth=require(_0xc601('0x4'));var interaction=require(_0xc601('0x5'));var config=require(_0xc601('0x6'));var controller=require(_0xc601('0x7'));router[_0xc601('0x8')]('/',auth[_0xc601('0x9')](),controller['index']);router['get']('/describe',auth[_0xc601('0x9')](),controller[_0xc601('0xa')]);router[_0xc601('0x8')](_0xc601('0xb'),auth[_0xc601('0x9')](),controller['show']);router[_0xc601('0xc')]('/',auth[_0xc601('0x9')](),controller[_0xc601('0xd')]);router[_0xc601('0xe')](_0xc601('0xb'),auth['isAuthenticated'](),controller[_0xc601('0xf')]);router[_0xc601('0x10')](_0xc601('0xb'),auth[_0xc601('0x9')](),controller[_0xc601('0x11')]);module[_0xc601('0x12')]=router; \ No newline at end of file +var _0x6fb4=['../../config/environment','./mailQueueReport.controller','get','isAuthenticated','index','/describe','/:id','post','create','put','destroy','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x24caa3,_0x5c0bb1){var _0x29cd10=function(_0x5823b0){while(--_0x5823b0){_0x24caa3['push'](_0x24caa3['shift']());}};_0x29cd10(++_0x5c0bb1);}(_0x6fb4,0xae));var _0x46fb=function(_0x4119ab,_0xa1be6a){_0x4119ab=_0x4119ab-0x0;var _0x3f8b6c=_0x6fb4[_0x4119ab];return _0x3f8b6c;};'use strict';var multer=require('multer');var util=require(_0x46fb('0x0'));var path=require(_0x46fb('0x1'));var timeout=require('connect-timeout');var express=require(_0x46fb('0x2'));var router=express[_0x46fb('0x3')]();var auth=require(_0x46fb('0x4'));var interaction=require(_0x46fb('0x5'));var config=require(_0x46fb('0x6'));var controller=require(_0x46fb('0x7'));router[_0x46fb('0x8')]('/',auth[_0x46fb('0x9')](),controller[_0x46fb('0xa')]);router[_0x46fb('0x8')](_0x46fb('0xb'),auth[_0x46fb('0x9')](),controller['describe']);router[_0x46fb('0x8')](_0x46fb('0xc'),auth[_0x46fb('0x9')](),controller['show']);router[_0x46fb('0xd')]('/',auth['isAuthenticated'](),controller[_0x46fb('0xe')]);router[_0x46fb('0xf')]('/:id',auth[_0x46fb('0x9')](),controller['update']);router['delete']('/:id',auth[_0x46fb('0x9')](),controller[_0x46fb('0x10')]);module[_0x46fb('0x11')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index b40575b..cdacef5 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 _0x2ae3=['exports','STRING','DATE','moment','sequelize'];(function(_0x4934e3,_0x124098){var _0x86a0c3=function(_0x59da73){while(--_0x59da73){_0x4934e3['push'](_0x4934e3['shift']());}};_0x86a0c3(++_0x124098);}(_0x2ae3,0x6c));var _0x32ae=function(_0x3146e7,_0x1e5cda){_0x3146e7=_0x3146e7-0x0;var _0x440624=_0x2ae3[_0x3146e7];return _0x440624;};'use strict';var moment=require(_0x32ae('0x0'));var Sequelize=require(_0x32ae('0x1'));module[_0x32ae('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x32ae('0x3')]},'joinAt':{'type':Sequelize[_0x32ae('0x4')]},'leaveAt':{'type':Sequelize[_0x32ae('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x32ae('0x4')]},'reason':{'type':Sequelize[_0x32ae('0x3')]}}; \ No newline at end of file +var _0x3a8e=['DATE','moment','sequelize','exports','STRING'];(function(_0x16ea6f,_0x865613){var _0x1d9add=function(_0x181d94){while(--_0x181d94){_0x16ea6f['push'](_0x16ea6f['shift']());}};_0x1d9add(++_0x865613);}(_0x3a8e,0x8d));var _0xe3a8=function(_0x145f74,_0x346ce8){_0x145f74=_0x145f74-0x0;var _0x13ec90=_0x3a8e[_0x145f74];return _0x13ec90;};'use strict';var moment=require(_0xe3a8('0x0'));var Sequelize=require(_0xe3a8('0x1'));module[_0xe3a8('0x2')]={'uniqueid':{'type':Sequelize[_0xe3a8('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xe3a8('0x3')]},'joinAt':{'type':Sequelize[_0xe3a8('0x4')]},'leaveAt':{'type':Sequelize[_0xe3a8('0x4')]},'acceptAt':{'type':Sequelize[_0xe3a8('0x4')]},'exitAt':{'type':Sequelize[_0xe3a8('0x4')]},'reason':{'type':Sequelize[_0xe3a8('0x3')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index fc04862..663a00f 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 _0x9438=['eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','set','apply','reject','save','then','destroy','end','name','send','index','map','fieldName','type','model','query','filters','intersection','fields','attributes','length','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','MailQueueReport','includeAll','include','findAll','show','params','keys','options','find','catch','create','body','update','describe','html-pdf'];(function(_0x195224,_0x129ac3){var _0xc4a4c0=function(_0x1c1326){while(--_0x1c1326){_0x195224['push'](_0x195224['shift']());}};_0xc4a4c0(++_0x129ac3);}(_0x9438,0x8d));var _0x8943=function(_0x2f566f,_0x6bc94a){_0x2f566f=_0x2f566f-0x0;var _0x3f7fb0=_0x9438[_0x2f566f];return _0x3f7fb0;};'use strict';var pdf=require(_0x8943('0x0'));var emlformat=require(_0x8943('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x8943('0x2'));var jsonpatch=require(_0x8943('0x3'));var rp=require('request-promise');var moment=require(_0x8943('0x4'));var BPromise=require(_0x8943('0x5'));var Mustache=require(_0x8943('0x6'));var util=require(_0x8943('0x7'));var path=require(_0x8943('0x8'));var sox=require('sox');var csv=require(_0x8943('0x9'));var ejs=require(_0x8943('0xa'));var fs=require('fs');var _=require(_0x8943('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x8943('0xc'));var deskjs=require(_0x8943('0xd'));var toCsv=require(_0x8943('0x9'));var querystring=require(_0x8943('0xe'));var Papa=require(_0x8943('0xf'));var Redis=require(_0x8943('0x10'));var authService=require(_0x8943('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x8943('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8943('0x13'))(_0x8943('0x14'));var utils=require('../../config/utils');var config=require(_0x8943('0x15'));var db=require(_0x8943('0x16'))['db'];function respondWithStatusCode(_0x585dec,_0x38c7c6){_0x38c7c6=_0x38c7c6||0xcc;return function(_0x4e97b6){if(_0x4e97b6){return _0x585dec[_0x8943('0x17')](_0x38c7c6);}return _0x585dec['status'](_0x38c7c6)['end']();};}function respondWithResult(_0x2851ae,_0x573b27){_0x573b27=_0x573b27||0xc8;return function(_0x1d406d){if(_0x1d406d){return _0x2851ae[_0x8943('0x18')](_0x573b27)[_0x8943('0x19')](_0x1d406d);}};}function respondWithFilteredResult(_0x2846e0,_0x48a182){return function(_0x1fc5f4){if(_0x1fc5f4){var _0x2bb699=_0x1fc5f4[_0x8943('0x1a')],_0x1123b3=_0x48a182[_0x8943('0x1b')],_0x28baaa=_0x48a182[_0x8943('0x1b')]+_0x48a182['limit'],_0x17cc55;if(_0x28baaa>=_0x2bb699){_0x28baaa=_0x2bb699;_0x17cc55=0xc8;}else{_0x17cc55=0xce;}_0x2846e0[_0x8943('0x18')](_0x17cc55);return _0x2846e0[_0x8943('0x1c')]('Content-Range',_0x1123b3+'-'+_0x28baaa+'/'+_0x2bb699)[_0x8943('0x19')](_0x1fc5f4);}return null;};}function patchUpdates(_0x4a4396){return function(_0x174f55){try{jsonpatch[_0x8943('0x1d')](_0x174f55,_0x4a4396,!![]);}catch(_0x271f45){return BPromise[_0x8943('0x1e')](_0x271f45);}return _0x174f55[_0x8943('0x1f')]();};}function saveUpdates(_0x43b957,_0x57ca0b){return function(_0x22793b){if(_0x22793b){return _0x22793b['update'](_0x43b957)[_0x8943('0x20')](function(_0x1cb2b4){return _0x1cb2b4;});}return null;};}function removeEntity(_0xbc3dcc,_0x3ed907){return function(_0x15b5e6){if(_0x15b5e6){return _0x15b5e6[_0x8943('0x21')]()[_0x8943('0x20')](function(){_0xbc3dcc[_0x8943('0x18')](0xcc)[_0x8943('0x22')]();});}};}function handleEntityNotFound(_0xf08de2,_0xfbb66c){return function(_0x160463){if(!_0x160463){_0xf08de2[_0x8943('0x17')](0x194);}return _0x160463;};}function handleError(_0x824646,_0x3ec561){_0x3ec561=_0x3ec561||0x1f4;return function(_0x224701){logger['error'](_0x224701['stack']);if(_0x224701[_0x8943('0x23')]){delete _0x224701[_0x8943('0x23')];}_0x824646[_0x8943('0x18')](_0x3ec561)[_0x8943('0x24')](_0x224701);};}exports[_0x8943('0x25')]=function(_0x44dc55,_0x19eca5){var _0x13b4c2={},_0x30d92f={},_0x41ad7e={'count':0x0,'rows':[]};var _0x1f5963=_[_0x8943('0x26')](db['MailQueueReport']['rawAttributes'],function(_0x19f42a){return{'name':_0x19f42a[_0x8943('0x27')],'type':_0x19f42a[_0x8943('0x28')]['key']};});_0x30d92f[_0x8943('0x29')]=_[_0x8943('0x26')](_0x1f5963,_0x8943('0x23'));_0x30d92f[_0x8943('0x2a')]=_['keys'](_0x44dc55[_0x8943('0x2a')]);_0x30d92f[_0x8943('0x2b')]=_[_0x8943('0x2c')](_0x30d92f[_0x8943('0x29')],_0x30d92f[_0x8943('0x2a')]);_0x13b4c2['attributes']=_[_0x8943('0x2c')](_0x30d92f[_0x8943('0x29')],qs['fields'](_0x44dc55['query'][_0x8943('0x2d')]));_0x13b4c2[_0x8943('0x2e')]=_0x13b4c2[_0x8943('0x2e')][_0x8943('0x2f')]?_0x13b4c2[_0x8943('0x2e')]:_0x30d92f['model'];if(!_0x44dc55[_0x8943('0x2a')]['hasOwnProperty'](_0x8943('0x30'))){_0x13b4c2[_0x8943('0x31')]=qs['limit'](_0x44dc55[_0x8943('0x2a')]['limit']);_0x13b4c2[_0x8943('0x1b')]=qs['offset'](_0x44dc55[_0x8943('0x2a')]['offset']);}_0x13b4c2[_0x8943('0x32')]=qs['sort'](_0x44dc55[_0x8943('0x2a')][_0x8943('0x33')]);_0x13b4c2[_0x8943('0x34')]=qs[_0x8943('0x2b')](_[_0x8943('0x35')](_0x44dc55[_0x8943('0x2a')],_0x30d92f[_0x8943('0x2b')]),_0x1f5963);if(_0x44dc55[_0x8943('0x2a')][_0x8943('0x36')]){_0x13b4c2[_0x8943('0x34')]=_[_0x8943('0x37')](_0x13b4c2['where'],{'$or':_['map'](_0x1f5963,function(_0x18d996){if(_0x18d996[_0x8943('0x28')]!==_0x8943('0x38')){var _0x28cd5b={};_0x28cd5b[_0x18d996[_0x8943('0x23')]]={'$like':'%'+_0x44dc55[_0x8943('0x2a')][_0x8943('0x36')]+'%'};return _0x28cd5b;}})});}_0x13b4c2=_[_0x8943('0x37')]({},_0x13b4c2,_0x44dc55['options']);var _0x56a4da={'where':_0x13b4c2[_0x8943('0x34')]};return db[_0x8943('0x39')][_0x8943('0x1a')](_0x56a4da)[_0x8943('0x20')](function(_0x56e4b5){_0x41ad7e[_0x8943('0x1a')]=_0x56e4b5;if(_0x44dc55[_0x8943('0x2a')][_0x8943('0x3a')]){_0x13b4c2[_0x8943('0x3b')]=[{'all':!![]}];}return db['MailQueueReport'][_0x8943('0x3c')](_0x13b4c2);})[_0x8943('0x20')](function(_0x3f4410){_0x41ad7e['rows']=_0x3f4410;return _0x41ad7e;})[_0x8943('0x20')](respondWithFilteredResult(_0x19eca5,_0x13b4c2))['catch'](handleError(_0x19eca5,null));};exports[_0x8943('0x3d')]=function(_0x1d5997,_0x5b91e7){var _0x39d480={'raw':!![],'where':{'id':_0x1d5997[_0x8943('0x3e')]['id']}},_0x5c494a={};_0x5c494a[_0x8943('0x29')]=_[_0x8943('0x3f')](db[_0x8943('0x39')]['rawAttributes']);_0x5c494a[_0x8943('0x2a')]=_[_0x8943('0x3f')](_0x1d5997['query']);_0x5c494a['filters']=_[_0x8943('0x2c')](_0x5c494a[_0x8943('0x29')],_0x5c494a[_0x8943('0x2a')]);_0x39d480['attributes']=_[_0x8943('0x2c')](_0x5c494a[_0x8943('0x29')],qs[_0x8943('0x2d')](_0x1d5997[_0x8943('0x2a')][_0x8943('0x2d')]));_0x39d480[_0x8943('0x2e')]=_0x39d480['attributes'][_0x8943('0x2f')]?_0x39d480[_0x8943('0x2e')]:_0x5c494a[_0x8943('0x29')];if(_0x1d5997[_0x8943('0x2a')][_0x8943('0x3a')]){_0x39d480[_0x8943('0x3b')]=[{'all':!![]}];}_0x39d480=_[_0x8943('0x37')]({},_0x39d480,_0x1d5997[_0x8943('0x40')]);return db[_0x8943('0x39')][_0x8943('0x41')](_0x39d480)['then'](handleEntityNotFound(_0x5b91e7,null))[_0x8943('0x20')](respondWithResult(_0x5b91e7,null))[_0x8943('0x42')](handleError(_0x5b91e7,null));};exports[_0x8943('0x43')]=function(_0x1d432f,_0x31d515){return db[_0x8943('0x39')][_0x8943('0x43')](_0x1d432f[_0x8943('0x44')],{})[_0x8943('0x20')](respondWithResult(_0x31d515,0xc9))[_0x8943('0x42')](handleError(_0x31d515,null));};exports[_0x8943('0x45')]=function(_0x336576,_0x860956){if(_0x336576[_0x8943('0x44')]['id']){delete _0x336576[_0x8943('0x44')]['id'];}return db[_0x8943('0x39')]['find']({'where':{'id':_0x336576['params']['id']}})[_0x8943('0x20')](handleEntityNotFound(_0x860956,null))['then'](saveUpdates(_0x336576['body'],null))[_0x8943('0x20')](respondWithResult(_0x860956,null))[_0x8943('0x42')](handleError(_0x860956,null));};exports['destroy']=function(_0x5bd0a0,_0x328b6e){return db[_0x8943('0x39')]['find']({'where':{'id':_0x5bd0a0[_0x8943('0x3e')]['id']}})['then'](handleEntityNotFound(_0x328b6e,null))[_0x8943('0x20')](removeEntity(_0x328b6e,null))[_0x8943('0x42')](handleError(_0x328b6e,null));};exports['describe']=function(_0x2fa949,_0x4567e1){return db[_0x8943('0x39')][_0x8943('0x46')]()[_0x8943('0x20')](respondWithResult(_0x4567e1,null))[_0x8943('0x42')](handleError(_0x4567e1,null));}; \ No newline at end of file +var _0x9709=['util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','MailQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','params','intersection','find','create','body','describe','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0xe99253,_0x3a3b1e){var _0x2b5bd7=function(_0x1151b2){while(--_0x1151b2){_0xe99253['push'](_0xe99253['shift']());}};_0x2b5bd7(++_0x3a3b1e);}(_0x9709,0x91));var _0x9970=function(_0x41de3c,_0x284168){_0x41de3c=_0x41de3c-0x0;var _0x468351=_0x9709[_0x41de3c];return _0x468351;};'use strict';var pdf=require(_0x9970('0x0'));var emlformat=require(_0x9970('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x9970('0x2'));var rp=require(_0x9970('0x3'));var moment=require(_0x9970('0x4'));var BPromise=require(_0x9970('0x5'));var Mustache=require(_0x9970('0x6'));var util=require(_0x9970('0x7'));var path=require(_0x9970('0x8'));var sox=require(_0x9970('0x9'));var csv=require(_0x9970('0xa'));var ejs=require(_0x9970('0xb'));var fs=require('fs');var _=require(_0x9970('0xc'));var squel=require(_0x9970('0xd'));var crypto=require(_0x9970('0xe'));var jsforce=require(_0x9970('0xf'));var deskjs=require(_0x9970('0x10'));var toCsv=require(_0x9970('0xa'));var querystring=require('querystring');var Papa=require(_0x9970('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x9970('0x12'));var hardwareService=require(_0x9970('0x13'));var logger=require(_0x9970('0x14'))(_0x9970('0x15'));var utils=require(_0x9970('0x16'));var config=require(_0x9970('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3e638a,_0x1eefeb){_0x1eefeb=_0x1eefeb||0xcc;return function(_0x105ac2){if(_0x105ac2){return _0x3e638a[_0x9970('0x18')](_0x1eefeb);}return _0x3e638a[_0x9970('0x19')](_0x1eefeb)['end']();};}function respondWithResult(_0x2464d9,_0x5cb644){_0x5cb644=_0x5cb644||0xc8;return function(_0x487c1f){if(_0x487c1f){return _0x2464d9[_0x9970('0x19')](_0x5cb644)[_0x9970('0x1a')](_0x487c1f);}};}function respondWithFilteredResult(_0x402e2a,_0x5534af){return function(_0x2ba2b3){if(_0x2ba2b3){var _0x30c9d0=_0x2ba2b3[_0x9970('0x1b')],_0x9bcd35=_0x5534af[_0x9970('0x1c')],_0xbd0869=_0x5534af[_0x9970('0x1c')]+_0x5534af[_0x9970('0x1d')],_0x4e1736;if(_0xbd0869>=_0x30c9d0){_0xbd0869=_0x30c9d0;_0x4e1736=0xc8;}else{_0x4e1736=0xce;}_0x402e2a['status'](_0x4e1736);return _0x402e2a[_0x9970('0x1e')](_0x9970('0x1f'),_0x9bcd35+'-'+_0xbd0869+'/'+_0x30c9d0)[_0x9970('0x1a')](_0x2ba2b3);}return null;};}function patchUpdates(_0x5905a6){return function(_0x319200){try{jsonpatch[_0x9970('0x20')](_0x319200,_0x5905a6,!![]);}catch(_0x374d5e){return BPromise[_0x9970('0x21')](_0x374d5e);}return _0x319200[_0x9970('0x22')]();};}function saveUpdates(_0x5492af,_0x37afe5){return function(_0x27a447){if(_0x27a447){return _0x27a447[_0x9970('0x23')](_0x5492af)[_0x9970('0x24')](function(_0x28dc23){return _0x28dc23;});}return null;};}function removeEntity(_0x3c3898,_0x42ceb7){return function(_0xed5923){if(_0xed5923){return _0xed5923[_0x9970('0x25')]()[_0x9970('0x24')](function(){_0x3c3898[_0x9970('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x940d75,_0x5aa62e){return function(_0x216fa8){if(!_0x216fa8){_0x940d75[_0x9970('0x18')](0x194);}return _0x216fa8;};}function handleError(_0x328ad8,_0x46fdb3){_0x46fdb3=_0x46fdb3||0x1f4;return function(_0x32bbe7){logger[_0x9970('0x26')](_0x32bbe7[_0x9970('0x27')]);if(_0x32bbe7[_0x9970('0x28')]){delete _0x32bbe7['name'];}_0x328ad8['status'](_0x46fdb3)[_0x9970('0x29')](_0x32bbe7);};}exports[_0x9970('0x2a')]=function(_0x1d51c1,_0x360e20){var _0x5a6b5b={},_0x14db38={},_0x2b585a={'count':0x0,'rows':[]};var _0x3e58f8=_[_0x9970('0x2b')](db[_0x9970('0x2c')][_0x9970('0x2d')],function(_0x4a3d14){return{'name':_0x4a3d14[_0x9970('0x2e')],'type':_0x4a3d14[_0x9970('0x2f')][_0x9970('0x30')]};});_0x14db38[_0x9970('0x31')]=_[_0x9970('0x2b')](_0x3e58f8,'name');_0x14db38[_0x9970('0x32')]=_[_0x9970('0x33')](_0x1d51c1['query']);_0x14db38[_0x9970('0x34')]=_['intersection'](_0x14db38[_0x9970('0x31')],_0x14db38[_0x9970('0x32')]);_0x5a6b5b[_0x9970('0x35')]=_['intersection'](_0x14db38[_0x9970('0x31')],qs[_0x9970('0x36')](_0x1d51c1[_0x9970('0x32')][_0x9970('0x36')]));_0x5a6b5b[_0x9970('0x35')]=_0x5a6b5b[_0x9970('0x35')][_0x9970('0x37')]?_0x5a6b5b[_0x9970('0x35')]:_0x14db38[_0x9970('0x31')];if(!_0x1d51c1[_0x9970('0x32')][_0x9970('0x38')]('nolimit')){_0x5a6b5b[_0x9970('0x1d')]=qs[_0x9970('0x1d')](_0x1d51c1[_0x9970('0x32')][_0x9970('0x1d')]);_0x5a6b5b[_0x9970('0x1c')]=qs['offset'](_0x1d51c1[_0x9970('0x32')][_0x9970('0x1c')]);}_0x5a6b5b[_0x9970('0x39')]=qs['sort'](_0x1d51c1[_0x9970('0x32')][_0x9970('0x3a')]);_0x5a6b5b[_0x9970('0x3b')]=qs['filters'](_[_0x9970('0x3c')](_0x1d51c1[_0x9970('0x32')],_0x14db38[_0x9970('0x34')]),_0x3e58f8);if(_0x1d51c1[_0x9970('0x32')]['filter']){_0x5a6b5b['where']=_[_0x9970('0x3d')](_0x5a6b5b[_0x9970('0x3b')],{'$or':_['map'](_0x3e58f8,function(_0x50e0e9){if(_0x50e0e9[_0x9970('0x2f')]!==_0x9970('0x3e')){var _0xb05f01={};_0xb05f01[_0x50e0e9[_0x9970('0x28')]]={'$like':'%'+_0x1d51c1[_0x9970('0x32')][_0x9970('0x3f')]+'%'};return _0xb05f01;}})});}_0x5a6b5b=_[_0x9970('0x3d')]({},_0x5a6b5b,_0x1d51c1[_0x9970('0x40')]);var _0x13a1bb={'where':_0x5a6b5b['where']};return db[_0x9970('0x2c')][_0x9970('0x1b')](_0x13a1bb)['then'](function(_0xe48070){_0x2b585a[_0x9970('0x1b')]=_0xe48070;if(_0x1d51c1[_0x9970('0x32')][_0x9970('0x41')]){_0x5a6b5b['include']=[{'all':!![]}];}return db['MailQueueReport'][_0x9970('0x42')](_0x5a6b5b);})['then'](function(_0x18a89a){_0x2b585a[_0x9970('0x43')]=_0x18a89a;return _0x2b585a;})[_0x9970('0x24')](respondWithFilteredResult(_0x360e20,_0x5a6b5b))[_0x9970('0x44')](handleError(_0x360e20,null));};exports[_0x9970('0x45')]=function(_0x145715,_0x5bf1f0){var _0x2fb0f8={'raw':!![],'where':{'id':_0x145715[_0x9970('0x46')]['id']}},_0x4e9c3b={};_0x4e9c3b[_0x9970('0x31')]=_[_0x9970('0x33')](db[_0x9970('0x2c')][_0x9970('0x2d')]);_0x4e9c3b[_0x9970('0x32')]=_[_0x9970('0x33')](_0x145715[_0x9970('0x32')]);_0x4e9c3b[_0x9970('0x34')]=_[_0x9970('0x47')](_0x4e9c3b[_0x9970('0x31')],_0x4e9c3b['query']);_0x2fb0f8[_0x9970('0x35')]=_[_0x9970('0x47')](_0x4e9c3b['model'],qs[_0x9970('0x36')](_0x145715['query'][_0x9970('0x36')]));_0x2fb0f8[_0x9970('0x35')]=_0x2fb0f8[_0x9970('0x35')][_0x9970('0x37')]?_0x2fb0f8[_0x9970('0x35')]:_0x4e9c3b['model'];if(_0x145715[_0x9970('0x32')][_0x9970('0x41')]){_0x2fb0f8['include']=[{'all':!![]}];}_0x2fb0f8=_[_0x9970('0x3d')]({},_0x2fb0f8,_0x145715['options']);return db[_0x9970('0x2c')][_0x9970('0x48')](_0x2fb0f8)['then'](handleEntityNotFound(_0x5bf1f0,null))[_0x9970('0x24')](respondWithResult(_0x5bf1f0,null))[_0x9970('0x44')](handleError(_0x5bf1f0,null));};exports[_0x9970('0x49')]=function(_0x4d9212,_0x18ebea){return db[_0x9970('0x2c')]['create'](_0x4d9212['body'],{})['then'](respondWithResult(_0x18ebea,0xc9))[_0x9970('0x44')](handleError(_0x18ebea,null));};exports[_0x9970('0x23')]=function(_0x3aa2ef,_0x34b42a){if(_0x3aa2ef['body']['id']){delete _0x3aa2ef[_0x9970('0x4a')]['id'];}return db[_0x9970('0x2c')][_0x9970('0x48')]({'where':{'id':_0x3aa2ef[_0x9970('0x46')]['id']}})['then'](handleEntityNotFound(_0x34b42a,null))[_0x9970('0x24')](saveUpdates(_0x3aa2ef['body'],null))[_0x9970('0x24')](respondWithResult(_0x34b42a,null))[_0x9970('0x44')](handleError(_0x34b42a,null));};exports['destroy']=function(_0x1bd2de,_0x31b398){return db[_0x9970('0x2c')][_0x9970('0x48')]({'where':{'id':_0x1bd2de['params']['id']}})[_0x9970('0x24')](handleEntityNotFound(_0x31b398,null))[_0x9970('0x24')](removeEntity(_0x31b398,null))['catch'](handleError(_0x31b398,null));};exports[_0x9970('0x4b')]=function(_0x3d16f0,_0x530d59){return db[_0x9970('0x2c')][_0x9970('0x4b')]()[_0x9970('0x24')](respondWithResult(_0x530d59,null))[_0x9970('0x44')](handleError(_0x530d59,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index e6c80d0..308cb32 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 _0x38ca=['lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./mailQueueReport.attributes','report_mail_queue','uniqueid'];(function(_0x5a25b3,_0x2ea39f){var _0x5e5938=function(_0x10853e){while(--_0x10853e){_0x5a25b3['push'](_0x5a25b3['shift']());}};_0x5e5938(++_0x2ea39f);}(_0x38ca,0xb0));var _0xa38c=function(_0x4e82eb,_0x48201a){_0x4e82eb=_0x4e82eb-0x0;var _0x312271=_0x38ca[_0x4e82eb];return _0x312271;};'use strict';var _=require(_0xa38c('0x0'));var util=require('util');var logger=require(_0xa38c('0x1'))(_0xa38c('0x2'));var moment=require(_0xa38c('0x3'));var BPromise=require(_0xa38c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa38c('0x5'));var rimraf=require(_0xa38c('0x6'));var config=require(_0xa38c('0x7'));var attributes=require(_0xa38c('0x8'));module['exports']=function(_0xe4cde2,_0x4487ef){return _0xe4cde2['define']('MailQueueReport',attributes,{'tableName':_0xa38c('0x9'),'paranoid':![],'indexes':[{'name':_0xa38c('0xa'),'fields':[_0xa38c('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2b99=['lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','./mailQueueReport.attributes','exports','define','MailQueueReport','report_mail_queue','uniqueid'];(function(_0x3e112d,_0x2bb132){var _0x531c31=function(_0x1954bc){while(--_0x1954bc){_0x3e112d['push'](_0x3e112d['shift']());}};_0x531c31(++_0x2bb132);}(_0x2b99,0x1ea));var _0x92b9=function(_0x4b7895,_0x3c4f5d){_0x4b7895=_0x4b7895-0x0;var _0x264180=_0x2b99[_0x4b7895];return _0x264180;};'use strict';var _=require(_0x92b9('0x0'));var util=require(_0x92b9('0x1'));var logger=require('../../config/logger')(_0x92b9('0x2'));var moment=require(_0x92b9('0x3'));var BPromise=require('bluebird');var rp=require(_0x92b9('0x4'));var fs=require('fs');var path=require(_0x92b9('0x5'));var rimraf=require(_0x92b9('0x6'));var config=require(_0x92b9('0x7'));var attributes=require(_0x92b9('0x8'));module[_0x92b9('0x9')]=function(_0x5bfd9f,_0x3647e8){return _0x5bfd9f[_0x92b9('0xa')](_0x92b9('0xb'),attributes,{'tableName':_0x92b9('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x92b9('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 1f9b2a3..a2b2c6c 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 _0x781d=['request\x20sent','result','catch','MailQueueReport','create','body','options','raw','CreateMailQueueReport','UpdateMailQueueReport','update','where','attributes','limit','stringify','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','MailQueueReport,\x20%s,\x20%s','debug','MailQueueReport,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x5271b1,_0x184f54){var _0x5c460d=function(_0x49ed66){while(--_0x49ed66){_0x5271b1['push'](_0x5271b1['shift']());}};_0x5c460d(++_0x184f54);}(_0x781d,0x14a));var _0xd781=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x781d[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0xd781('0x0'));var util=require(_0xd781('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd781('0x2'));var fs=require('fs');var Redis=require(_0xd781('0x3'));var db=require(_0xd781('0x4'))['db'];var utils=require(_0xd781('0x5'));var logger=require(_0xd781('0x6'))(_0xd781('0x7'));var config=require(_0xd781('0x8'));var jayson=require(_0xd781('0x9'));var client=jayson[_0xd781('0xa')][_0xd781('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5a07f0,_0x133509,_0x1a242d){return new BPromise(function(_0x50610d,_0x248172){return client['request'](_0x5a07f0,_0x1a242d)[_0xd781('0xc')](function(_0x5c18c8){logger[_0xd781('0xd')](_0xd781('0xe'),_0x133509,'request\x20sent');logger[_0xd781('0xf')](_0xd781('0x10'),_0x133509,'request\x20sent',JSON['stringify'](_0x5c18c8));if(_0x5c18c8[_0xd781('0x11')]){if(_0x5c18c8[_0xd781('0x11')][_0xd781('0x12')]===0x1f4){logger[_0xd781('0x11')](_0xd781('0xe'),_0x133509,_0x5c18c8[_0xd781('0x11')][_0xd781('0x13')]);return _0x248172(_0x5c18c8[_0xd781('0x11')][_0xd781('0x13')]);}logger[_0xd781('0x11')](_0xd781('0xe'),_0x133509,_0x5c18c8['error'][_0xd781('0x13')]);return _0x50610d(_0x5c18c8[_0xd781('0x11')]['message']);}else{logger[_0xd781('0xd')]('MailQueueReport,\x20%s,\x20%s',_0x133509,_0xd781('0x14'));_0x50610d(_0x5c18c8[_0xd781('0x15')][_0xd781('0x13')]);}})[_0xd781('0x16')](function(_0x42a9c1){logger[_0xd781('0x11')](_0xd781('0xe'),_0x133509,_0x42a9c1);_0x248172(_0x42a9c1);});});}exports['CreateMailQueueReport']=function(_0x1407fc){var _0x3f2922=this;return new Promise(function(_0x395d9c,_0x2f1273){return db[_0xd781('0x17')][_0xd781('0x18')](_0x1407fc[_0xd781('0x19')],{'raw':_0x1407fc[_0xd781('0x1a')]?_0x1407fc['options'][_0xd781('0x1b')]===undefined?!![]:![]:!![]})[_0xd781('0xc')](function(_0x1036d3){logger[_0xd781('0xd')](_0xd781('0x1c'),_0x1407fc);logger[_0xd781('0xf')](_0xd781('0x1c'),_0x1407fc,JSON['stringify'](_0x1036d3));_0x395d9c(_0x1036d3);})[_0xd781('0x16')](function(_0x4e2c56){logger['error'](_0xd781('0x1c'),_0x4e2c56['message'],_0x1407fc);_0x2f1273(_0x3f2922[_0xd781('0x11')](0x1f4,_0x4e2c56[_0xd781('0x13')]));});});};exports[_0xd781('0x1d')]=function(_0x31bf57){var _0x391461=this;return new Promise(function(_0x28f4fe,_0x221f14){return db[_0xd781('0x17')][_0xd781('0x1e')](_0x31bf57['body'],{'raw':_0x31bf57['options']?_0x31bf57[_0xd781('0x1a')][_0xd781('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x31bf57[_0xd781('0x1a')]?_0x31bf57['options'][_0xd781('0x1f')]||null:null,'attributes':_0x31bf57['options']?_0x31bf57['options'][_0xd781('0x20')]||null:null,'limit':_0x31bf57['options']?_0x31bf57[_0xd781('0x1a')][_0xd781('0x21')]||null:null})['then'](function(_0x5b6b9d){logger[_0xd781('0xd')]('UpdateMailQueueReport',_0x31bf57);logger[_0xd781('0xf')]('UpdateMailQueueReport',_0x31bf57,JSON[_0xd781('0x22')](_0x5b6b9d));_0x28f4fe(_0x5b6b9d);})[_0xd781('0x16')](function(_0x556127){logger['error'](_0xd781('0x1d'),_0x556127[_0xd781('0x13')],_0x31bf57);_0x221f14(_0x391461[_0xd781('0x11')](0x1f4,_0x556127['message']));});});}; \ No newline at end of file +var _0xba34=['MailQueueReport','create','body','options','update','raw','where','attributes','UpdateMailQueueReport','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','MailQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateMailQueueReport'];(function(_0x3bbec6,_0x4c5db1){var _0x2fe214=function(_0x1a3759){while(--_0x1a3759){_0x3bbec6['push'](_0x3bbec6['shift']());}};_0x2fe214(++_0x4c5db1);}(_0xba34,0x119));var _0x4ba3=function(_0x1d1e03,_0x13a072){_0x1d1e03=_0x1d1e03-0x0;var _0x584055=_0xba34[_0x1d1e03];return _0x584055;};'use strict';var _=require(_0x4ba3('0x0'));var util=require(_0x4ba3('0x1'));var moment=require(_0x4ba3('0x2'));var BPromise=require(_0x4ba3('0x3'));var rs=require(_0x4ba3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4ba3('0x5'))(_0x4ba3('0x6'));var config=require(_0x4ba3('0x7'));var jayson=require(_0x4ba3('0x8'));var client=jayson[_0x4ba3('0x9')][_0x4ba3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe5f99a,_0x585f2d,_0x6254fb){return new BPromise(function(_0x368eee,_0x2df7f3){return client[_0x4ba3('0xb')](_0xe5f99a,_0x6254fb)[_0x4ba3('0xc')](function(_0xcf1ec3){logger[_0x4ba3('0xd')](_0x4ba3('0xe'),_0x585f2d,_0x4ba3('0xf'));logger[_0x4ba3('0x10')](_0x4ba3('0x11'),_0x585f2d,'request\x20sent',JSON[_0x4ba3('0x12')](_0xcf1ec3));if(_0xcf1ec3[_0x4ba3('0x13')]){if(_0xcf1ec3['error'][_0x4ba3('0x14')]===0x1f4){logger['error'](_0x4ba3('0xe'),_0x585f2d,_0xcf1ec3['error'][_0x4ba3('0x15')]);return _0x2df7f3(_0xcf1ec3[_0x4ba3('0x13')][_0x4ba3('0x15')]);}logger[_0x4ba3('0x13')](_0x4ba3('0xe'),_0x585f2d,_0xcf1ec3[_0x4ba3('0x13')][_0x4ba3('0x15')]);return _0x368eee(_0xcf1ec3[_0x4ba3('0x13')][_0x4ba3('0x15')]);}else{logger[_0x4ba3('0xd')](_0x4ba3('0xe'),_0x585f2d,_0x4ba3('0xf'));_0x368eee(_0xcf1ec3[_0x4ba3('0x16')][_0x4ba3('0x15')]);}})[_0x4ba3('0x17')](function(_0x1b7776){logger['error'](_0x4ba3('0xe'),_0x585f2d,_0x1b7776);_0x2df7f3(_0x1b7776);});});}exports[_0x4ba3('0x18')]=function(_0x5ff7ce){var _0x451c92=this;return new Promise(function(_0x556290,_0x2519bb){return db[_0x4ba3('0x19')][_0x4ba3('0x1a')](_0x5ff7ce[_0x4ba3('0x1b')],{'raw':_0x5ff7ce[_0x4ba3('0x1c')]?_0x5ff7ce[_0x4ba3('0x1c')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x2278b0){logger['info'](_0x4ba3('0x18'),_0x5ff7ce);logger[_0x4ba3('0x10')](_0x4ba3('0x18'),_0x5ff7ce,JSON[_0x4ba3('0x12')](_0x2278b0));_0x556290(_0x2278b0);})[_0x4ba3('0x17')](function(_0x278a23){logger['error'](_0x4ba3('0x18'),_0x278a23[_0x4ba3('0x15')],_0x5ff7ce);_0x2519bb(_0x451c92['error'](0x1f4,_0x278a23[_0x4ba3('0x15')]));});});};exports['UpdateMailQueueReport']=function(_0x1ae4de){var _0x18abb3=this;return new Promise(function(_0x11a917,_0x37e6f3){return db[_0x4ba3('0x19')][_0x4ba3('0x1d')](_0x1ae4de[_0x4ba3('0x1b')],{'raw':_0x1ae4de[_0x4ba3('0x1c')]?_0x1ae4de[_0x4ba3('0x1c')][_0x4ba3('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1ae4de['options']?_0x1ae4de[_0x4ba3('0x1c')][_0x4ba3('0x1f')]||null:null,'attributes':_0x1ae4de[_0x4ba3('0x1c')]?_0x1ae4de['options'][_0x4ba3('0x20')]||null:null,'limit':_0x1ae4de[_0x4ba3('0x1c')]?_0x1ae4de[_0x4ba3('0x1c')]['limit']||null:null})[_0x4ba3('0xc')](function(_0x843276){logger[_0x4ba3('0xd')](_0x4ba3('0x21'),_0x1ae4de);logger['debug']('UpdateMailQueueReport',_0x1ae4de,JSON[_0x4ba3('0x12')](_0x843276));_0x11a917(_0x843276);})[_0x4ba3('0x17')](function(_0x15cfae){logger[_0x4ba3('0x13')](_0x4ba3('0x21'),_0x15cfae[_0x4ba3('0x15')],_0x1ae4de);_0x37e6f3(_0x18abb3['error'](0x1f4,_0x15cfae[_0x4ba3('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index f3b66fc..7c5dde8 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 _0x1a2b=['Router','../../components/interaction/service','../../config/environment','exports','multer','connect-timeout','express'];(function(_0x211fef,_0x4ab716){var _0x5447bf=function(_0x306ea3){while(--_0x306ea3){_0x211fef['push'](_0x211fef['shift']());}};_0x5447bf(++_0x4ab716);}(_0x1a2b,0xa5));var _0xb1a2=function(_0x2584bc,_0x35d9f5){_0x2584bc=_0x2584bc-0x0;var _0x405f2c=_0x1a2b[_0x2584bc];return _0x405f2c;};'use strict';var multer=require(_0xb1a2('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xb1a2('0x1'));var express=require(_0xb1a2('0x2'));var router=express[_0xb1a2('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xb1a2('0x4'));var config=require(_0xb1a2('0x5'));module[_0xb1a2('0x6')]=router; \ No newline at end of file +var _0x75d8=['path','connect-timeout','../../components/auth/service','../../config/environment','exports','multer'];(function(_0x364c39,_0x325554){var _0x5f28d2=function(_0x55dff4){while(--_0x55dff4){_0x364c39['push'](_0x364c39['shift']());}};_0x5f28d2(++_0x325554);}(_0x75d8,0x101));var _0x875d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x75d8[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x875d('0x0'));var util=require('util');var path=require(_0x875d('0x1'));var timeout=require(_0x875d('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x875d('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x875d('0x4'));module[_0x875d('0x5')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index cf25182..cf93f48 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 _0x1e2a=['INTEGER','INBOX','sequelize','STRING','BOOLEAN','username'];(function(_0x2a5160,_0x5f068d){var _0x2b42c5=function(_0x350590){while(--_0x350590){_0x2a5160['push'](_0x2a5160['shift']());}};_0x2b42c5(++_0x5f068d);}(_0x1e2a,0x188));var _0xa1e2=function(_0x14a049,_0x1886e0){_0x14a049=_0x14a049-0x0;var _0x396605=_0x1e2a[_0x14a049];return _0x396605;};'use strict';var Sequelize=require(_0xa1e2('0x0'));module['exports']={'description':{'type':Sequelize[_0xa1e2('0x1')]},'host':{'type':Sequelize[_0xa1e2('0x1')]},'authentication':{'type':Sequelize[_0xa1e2('0x2')],'defaultValue':!![]},'user':{'type':Sequelize['STRING'],'unique':_0xa1e2('0x3')},'password':{'type':Sequelize[_0xa1e2('0x1')]},'port':{'type':Sequelize[_0xa1e2('0x4')]},'tls':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xa1e2('0x1')],'defaultValue':_0xa1e2('0x5')},'connTimeout':{'type':Sequelize[_0xa1e2('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xa1e2('0x4')],'defaultValue':0x5},'service':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6c8b=['BOOLEAN','STRING','username','INTEGER','INBOX','sequelize','exports'];(function(_0x138d78,_0x5034ec){var _0x36982b=function(_0x1f1b29){while(--_0x1f1b29){_0x138d78['push'](_0x138d78['shift']());}};_0x36982b(++_0x5034ec);}(_0x6c8b,0x1a2));var _0xb6c8=function(_0x455c51,_0x28c80d){_0x455c51=_0x455c51-0x0;var _0x36924e=_0x6c8b[_0x455c51];return _0x36924e;};'use strict';var Sequelize=require(_0xb6c8('0x0'));module[_0xb6c8('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0xb6c8('0x2')],'defaultValue':!![]},'user':{'type':Sequelize[_0xb6c8('0x3')],'unique':_0xb6c8('0x4')},'password':{'type':Sequelize[_0xb6c8('0x3')]},'port':{'type':Sequelize[_0xb6c8('0x5')]},'tls':{'type':Sequelize[_0xb6c8('0x2')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xb6c8('0x3')],'defaultValue':_0xb6c8('0x6')},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xb6c8('0x5')],'defaultValue':0x5},'service':{'type':Sequelize[_0xb6c8('0x3')]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 13bb7f6..3935466 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 _0xd523=['exports','MailServerIn','mail_servers_in','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./mailServerIn.attributes'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd523,0x153));var _0x3d52=function(_0x4ed8d4,_0x4d8e44){_0x4ed8d4=_0x4ed8d4-0x0;var _0x3cbf02=_0xd523[_0x4ed8d4];return _0x3cbf02;};'use strict';var _=require(_0x3d52('0x0'));var util=require(_0x3d52('0x1'));var logger=require(_0x3d52('0x2'))(_0x3d52('0x3'));var moment=require('moment');var BPromise=require(_0x3d52('0x4'));var rp=require(_0x3d52('0x5'));var fs=require('fs');var path=require(_0x3d52('0x6'));var rimraf=require('rimraf');var config=require(_0x3d52('0x7'));var attributes=require(_0x3d52('0x8'));module[_0x3d52('0x9')]=function(_0x46a0e9,_0x580f82){return _0x46a0e9['define'](_0x3d52('0xa'),attributes,{'tableName':_0x3d52('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7462=['path','rimraf','./mailServerIn.attributes','exports','define','MailServerIn','mail_servers_in','lodash','util','moment'];(function(_0x19331c,_0x4b1410){var _0x4dbe8b=function(_0x25efe4){while(--_0x25efe4){_0x19331c['push'](_0x19331c['shift']());}};_0x4dbe8b(++_0x4b1410);}(_0x7462,0x165));var _0x2746=function(_0x120bc2,_0x57a253){_0x120bc2=_0x120bc2-0x0;var _0x454a41=_0x7462[_0x120bc2];return _0x454a41;};'use strict';var _=require(_0x2746('0x0'));var util=require(_0x2746('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x2746('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2746('0x3'));var rimraf=require(_0x2746('0x4'));var config=require('../../config/environment');var attributes=require(_0x2746('0x5'));module[_0x2746('0x6')]=function(_0x1c3371,_0x280dfb){return _0x1c3371[_0x2746('0x7')](_0x2746('0x8'),attributes,{'tableName':_0x2746('0x9'),'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 2a7873e..f597888 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 _0x54b7=['raw','where','limit','include','map','model','attributes','GetMailServerIn','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','MailServerIn,\x20%s,\x20%s','message','info','result','MailServerIn','findAll','options'];(function(_0x485b01,_0x513b86){var _0x56388b=function(_0x5906e6){while(--_0x5906e6){_0x485b01['push'](_0x485b01['shift']());}};_0x56388b(++_0x513b86);}(_0x54b7,0xe1));var _0x754b=function(_0x4a0f87,_0x448d44){_0x4a0f87=_0x4a0f87-0x0;var _0x1b2544=_0x54b7[_0x4a0f87];return _0x1b2544;};'use strict';var _=require(_0x754b('0x0'));var util=require(_0x754b('0x1'));var moment=require(_0x754b('0x2'));var BPromise=require(_0x754b('0x3'));var rs=require(_0x754b('0x4'));var fs=require('fs');var Redis=require(_0x754b('0x5'));var db=require(_0x754b('0x6'))['db'];var utils=require(_0x754b('0x7'));var logger=require(_0x754b('0x8'))(_0x754b('0x9'));var config=require(_0x754b('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x754b('0xb')][_0x754b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x29bbb6,_0x131543,_0x580a70){return new BPromise(function(_0x17d599,_0x26a181){return client[_0x754b('0xd')](_0x29bbb6,_0x580a70)[_0x754b('0xe')](function(_0x87622){logger['info']('MailServerIn,\x20%s,\x20%s',_0x131543,_0x754b('0xf'));logger[_0x754b('0x10')](_0x754b('0x11'),_0x131543,_0x754b('0xf'),JSON[_0x754b('0x12')](_0x87622));if(_0x87622[_0x754b('0x13')]){if(_0x87622[_0x754b('0x13')]['code']===0x1f4){logger[_0x754b('0x13')](_0x754b('0x14'),_0x131543,_0x87622[_0x754b('0x13')][_0x754b('0x15')]);return _0x26a181(_0x87622[_0x754b('0x13')][_0x754b('0x15')]);}logger[_0x754b('0x13')]('MailServerIn,\x20%s,\x20%s',_0x131543,_0x87622['error'][_0x754b('0x15')]);return _0x17d599(_0x87622[_0x754b('0x13')][_0x754b('0x15')]);}else{logger[_0x754b('0x16')](_0x754b('0x14'),_0x131543,_0x754b('0xf'));_0x17d599(_0x87622[_0x754b('0x17')]['message']);}})['catch'](function(_0x5025b5){logger[_0x754b('0x13')](_0x754b('0x14'),_0x131543,_0x5025b5);_0x26a181(_0x5025b5);});});}exports['GetMailServerIn']=function(_0x13e96c){var _0x27b9f7=this;return new Promise(function(_0x192e0b,_0x8831dc){return db[_0x754b('0x18')][_0x754b('0x19')]({'raw':_0x13e96c[_0x754b('0x1a')]?_0x13e96c['options'][_0x754b('0x1b')]===undefined?!![]:![]:!![],'where':_0x13e96c[_0x754b('0x1a')]?_0x13e96c[_0x754b('0x1a')][_0x754b('0x1c')]||null:null,'attributes':_0x13e96c[_0x754b('0x1a')]?_0x13e96c[_0x754b('0x1a')]['attributes']||null:null,'limit':_0x13e96c[_0x754b('0x1a')]?_0x13e96c['options'][_0x754b('0x1d')]||null:null,'include':_0x13e96c[_0x754b('0x1a')]?_0x13e96c['options'][_0x754b('0x1e')]?_[_0x754b('0x1f')](_0x13e96c[_0x754b('0x1a')]['include'],function(_0x4dbd42){return{'model':db[_0x4dbd42[_0x754b('0x20')]],'as':_0x4dbd42['as'],'attributes':_0x4dbd42[_0x754b('0x21')],'include':_0x4dbd42['include']?_[_0x754b('0x1f')](_0x4dbd42[_0x754b('0x1e')],function(_0x5a7a8d){return{'model':db[_0x5a7a8d['model']],'as':_0x5a7a8d['as'],'attributes':_0x5a7a8d[_0x754b('0x21')],'include':_0x5a7a8d['include']?_[_0x754b('0x1f')](_0x5a7a8d[_0x754b('0x1e')],function(_0x3bd49e){return{'model':db[_0x3bd49e[_0x754b('0x20')]],'as':_0x3bd49e['as'],'attributes':_0x3bd49e[_0x754b('0x21')]};}):[]};}):[]};}):[]:[]})[_0x754b('0xe')](function(_0x4bca32){logger[_0x754b('0x16')](_0x754b('0x22'),_0x13e96c);logger[_0x754b('0x10')](_0x754b('0x22'),_0x13e96c,JSON[_0x754b('0x12')](_0x4bca32));_0x192e0b(_0x4bca32);})[_0x754b('0x23')](function(_0x14f538){logger[_0x754b('0x13')]('GetMailServerIn',_0x14f538[_0x754b('0x15')],_0x13e96c);_0x8831dc(_0x27b9f7['error'](0x1f4,_0x14f538[_0x754b('0x15')]));});});}; \ No newline at end of file +var _0xba0c=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','MailServerIn,\x20%s,\x20%s','debug','MailServerIn,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','options','raw','where','include','map','model','attributes','then','GetMailServerIn','util','moment','bluebird','randomstring'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xba0c,0x7c));var _0xcba0=function(_0x2fd547,_0x518b6f){_0x2fd547=_0x2fd547-0x0;var _0x33ecd4=_0xba0c[_0x2fd547];return _0x33ecd4;};'use strict';var _=require('lodash');var util=require(_0xcba0('0x0'));var moment=require(_0xcba0('0x1'));var BPromise=require(_0xcba0('0x2'));var rs=require(_0xcba0('0x3'));var fs=require('fs');var Redis=require(_0xcba0('0x4'));var db=require(_0xcba0('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xcba0('0x6'))(_0xcba0('0x7'));var config=require(_0xcba0('0x8'));var jayson=require(_0xcba0('0x9'));var client=jayson['client'][_0xcba0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5eca87,_0x17ae79,_0x4e19eb){return new BPromise(function(_0x2d43e6,_0x1eb7a8){return client[_0xcba0('0xb')](_0x5eca87,_0x4e19eb)['then'](function(_0x21ef85){logger['info'](_0xcba0('0xc'),_0x17ae79,'request\x20sent');logger[_0xcba0('0xd')](_0xcba0('0xe'),_0x17ae79,_0xcba0('0xf'),JSON[_0xcba0('0x10')](_0x21ef85));if(_0x21ef85[_0xcba0('0x11')]){if(_0x21ef85[_0xcba0('0x11')][_0xcba0('0x12')]===0x1f4){logger[_0xcba0('0x11')](_0xcba0('0xc'),_0x17ae79,_0x21ef85['error']['message']);return _0x1eb7a8(_0x21ef85[_0xcba0('0x11')]['message']);}logger[_0xcba0('0x11')](_0xcba0('0xc'),_0x17ae79,_0x21ef85[_0xcba0('0x11')][_0xcba0('0x13')]);return _0x2d43e6(_0x21ef85[_0xcba0('0x11')]['message']);}else{logger[_0xcba0('0x14')](_0xcba0('0xc'),_0x17ae79,_0xcba0('0xf'));_0x2d43e6(_0x21ef85[_0xcba0('0x15')][_0xcba0('0x13')]);}})[_0xcba0('0x16')](function(_0x120dc3){logger[_0xcba0('0x11')]('MailServerIn,\x20%s,\x20%s',_0x17ae79,_0x120dc3);_0x1eb7a8(_0x120dc3);});});}exports['GetMailServerIn']=function(_0x476130){var _0x2789f3=this;return new Promise(function(_0x268ce9,_0x46786d){return db['MailServerIn']['findAll']({'raw':_0x476130[_0xcba0('0x17')]?_0x476130[_0xcba0('0x17')][_0xcba0('0x18')]===undefined?!![]:![]:!![],'where':_0x476130[_0xcba0('0x17')]?_0x476130[_0xcba0('0x17')][_0xcba0('0x19')]||null:null,'attributes':_0x476130[_0xcba0('0x17')]?_0x476130[_0xcba0('0x17')]['attributes']||null:null,'limit':_0x476130[_0xcba0('0x17')]?_0x476130[_0xcba0('0x17')]['limit']||null:null,'include':_0x476130[_0xcba0('0x17')]?_0x476130[_0xcba0('0x17')][_0xcba0('0x1a')]?_[_0xcba0('0x1b')](_0x476130[_0xcba0('0x17')][_0xcba0('0x1a')],function(_0x50166a){return{'model':db[_0x50166a[_0xcba0('0x1c')]],'as':_0x50166a['as'],'attributes':_0x50166a['attributes'],'include':_0x50166a[_0xcba0('0x1a')]?_[_0xcba0('0x1b')](_0x50166a[_0xcba0('0x1a')],function(_0x3ded7c){return{'model':db[_0x3ded7c[_0xcba0('0x1c')]],'as':_0x3ded7c['as'],'attributes':_0x3ded7c['attributes'],'include':_0x3ded7c[_0xcba0('0x1a')]?_['map'](_0x3ded7c[_0xcba0('0x1a')],function(_0x368117){return{'model':db[_0x368117[_0xcba0('0x1c')]],'as':_0x368117['as'],'attributes':_0x368117[_0xcba0('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xcba0('0x1e')](function(_0x12bb90){logger[_0xcba0('0x14')]('GetMailServerIn',_0x476130);logger[_0xcba0('0xd')]('GetMailServerIn',_0x476130,JSON['stringify'](_0x12bb90));_0x268ce9(_0x12bb90);})[_0xcba0('0x16')](function(_0x3105d5){logger['error'](_0xcba0('0x1f'),_0x3105d5[_0xcba0('0x13')],_0x476130);_0x46786d(_0x2789f3[_0xcba0('0x11')](0x1f4,_0x3105d5[_0xcba0('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 9f4f522..a5ba039 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 _0x420f=['create','delete','destroy','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','isAuthenticated','index','get','/:id','show','post'];(function(_0x5cb2a3,_0x3ad870){var _0x17c539=function(_0x1462d3){while(--_0x1462d3){_0x5cb2a3['push'](_0x5cb2a3['shift']());}};_0x17c539(++_0x3ad870);}(_0x420f,0xa5));var _0xf420=function(_0x2f0971,_0x14a986){_0x2f0971=_0x2f0971-0x0;var _0x3cb533=_0x420f[_0x2f0971];return _0x3cb533;};'use strict';var multer=require(_0xf420('0x0'));var util=require('util');var path=require(_0xf420('0x1'));var timeout=require(_0xf420('0x2'));var express=require(_0xf420('0x3'));var router=express[_0xf420('0x4')]();var auth=require(_0xf420('0x5'));var interaction=require(_0xf420('0x6'));var config=require(_0xf420('0x7'));var controller=require(_0xf420('0x8'));router['get']('/',auth[_0xf420('0x9')](),controller[_0xf420('0xa')]);router[_0xf420('0xb')](_0xf420('0xc'),auth[_0xf420('0x9')](),controller[_0xf420('0xd')]);router[_0xf420('0xe')]('/',auth[_0xf420('0x9')](),controller[_0xf420('0xf')]);router['put']('/:id',auth[_0xf420('0x9')](),controller['update']);router[_0xf420('0x10')](_0xf420('0xc'),auth[_0xf420('0x9')](),controller[_0xf420('0x11')]);module['exports']=router; \ No newline at end of file +var _0x2641=['isAuthenticated','show','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get','index'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0x2641,0x15e));var _0x1264=function(_0x2a07b6,_0x44ae6f){_0x2a07b6=_0x2a07b6-0x0;var _0x55d52c=_0x2641[_0x2a07b6];return _0x55d52c;};'use strict';var multer=require('multer');var util=require(_0x1264('0x0'));var path=require(_0x1264('0x1'));var timeout=require(_0x1264('0x2'));var express=require(_0x1264('0x3'));var router=express[_0x1264('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x1264('0x5'));var config=require(_0x1264('0x6'));var controller=require(_0x1264('0x7'));router[_0x1264('0x8')]('/',auth['isAuthenticated'](),controller[_0x1264('0x9')]);router[_0x1264('0x8')]('/:id',auth[_0x1264('0xa')](),controller[_0x1264('0xb')]);router['post']('/',auth[_0x1264('0xa')](),controller['create']);router[_0x1264('0xc')](_0x1264('0xd'),auth['isAuthenticated'](),controller[_0x1264('0xe')]);router[_0x1264('0xf')](_0x1264('0xd'),auth[_0x1264('0xa')](),controller[_0x1264('0x10')]);module[_0x1264('0x11')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index 17c7a7c..f685b07 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 _0x49e5=['STRING','INTEGER','BOOLEAN','sequelize','exports'];(function(_0x2ff238,_0x1811d2){var _0x204a56=function(_0x5bf2e1){while(--_0x5bf2e1){_0x2ff238['push'](_0x2ff238['shift']());}};_0x204a56(++_0x1811d2);}(_0x49e5,0x71));var _0x549e=function(_0x229745,_0x170522){_0x229745=_0x229745-0x0;var _0x25e7f7=_0x49e5[_0x229745];return _0x25e7f7;};'use strict';var Sequelize=require(_0x549e('0x0'));module[_0x549e('0x1')]={'description':{'type':Sequelize[_0x549e('0x2')]},'host':{'type':Sequelize[_0x549e('0x2')]},'user':{'type':Sequelize[_0x549e('0x2')]},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x549e('0x3')]},'secure':{'type':Sequelize[_0x549e('0x4')],'defaultValue':![]},'service':{'type':Sequelize[_0x549e('0x2')]},'authentication':{'type':Sequelize[_0x549e('0x4')],'defaultValue':!![]}}; \ No newline at end of file +var _0x15ef=['exports','STRING','INTEGER','BOOLEAN'];(function(_0x3b18e6,_0x35e310){var _0xaf05b7=function(_0x5f0cc8){while(--_0x5f0cc8){_0x3b18e6['push'](_0x3b18e6['shift']());}};_0xaf05b7(++_0x35e310);}(_0x15ef,0x80));var _0xf15e=function(_0x48a253,_0xf7b95f){_0x48a253=_0x48a253-0x0;var _0x208889=_0x15ef[_0x48a253];return _0x208889;};'use strict';var Sequelize=require('sequelize');module[_0xf15e('0x0')]={'description':{'type':Sequelize[_0xf15e('0x1')]},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize[_0xf15e('0x1')]},'pass':{'type':Sequelize[_0xf15e('0x1')]},'port':{'type':Sequelize[_0xf15e('0x2')]},'secure':{'type':Sequelize[_0xf15e('0x3')],'defaultValue':![]},'service':{'type':Sequelize[_0xf15e('0x1')]},'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 9c9b86a..552fac8 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 _0x4abd=['../../mysqldb','sendStatus','status','end','json','count','offset','Content-Range','apply','error','stack','name','index','map','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','MailServerOut','then','rows','show','params','find','catch','body','destroy','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils'];(function(_0x5d455e,_0x33a90d){var _0x95f642=function(_0x447ae2){while(--_0x447ae2){_0x5d455e['push'](_0x5d455e['shift']());}};_0x95f642(++_0x33a90d);}(_0x4abd,0x1b9));var _0xd4ab=function(_0x7d4dc8,_0x14d70e){_0x7d4dc8=_0x7d4dc8-0x0;var _0x20b216=_0x4abd[_0x7d4dc8];return _0x20b216;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xd4ab('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd4ab('0x1'));var rp=require(_0xd4ab('0x2'));var moment=require(_0xd4ab('0x3'));var BPromise=require(_0xd4ab('0x4'));var Mustache=require(_0xd4ab('0x5'));var util=require('util');var path=require(_0xd4ab('0x6'));var sox=require(_0xd4ab('0x7'));var csv=require(_0xd4ab('0x8'));var ejs=require(_0xd4ab('0x9'));var fs=require('fs');var _=require(_0xd4ab('0xa'));var squel=require(_0xd4ab('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xd4ab('0xc'));var toCsv=require(_0xd4ab('0x8'));var querystring=require(_0xd4ab('0xd'));var Papa=require(_0xd4ab('0xe'));var Redis=require(_0xd4ab('0xf'));var authService=require(_0xd4ab('0x10'));var qs=require(_0xd4ab('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xd4ab('0x12'))(_0xd4ab('0x13'));var utils=require(_0xd4ab('0x14'));var config=require('../../config/environment');var db=require(_0xd4ab('0x15'))['db'];function respondWithStatusCode(_0x3439bf,_0x2908dc){_0x2908dc=_0x2908dc||0xcc;return function(_0x1463fd){if(_0x1463fd){return _0x3439bf[_0xd4ab('0x16')](_0x2908dc);}return _0x3439bf[_0xd4ab('0x17')](_0x2908dc)[_0xd4ab('0x18')]();};}function respondWithResult(_0x1451a3,_0xc2fdad){_0xc2fdad=_0xc2fdad||0xc8;return function(_0x4cc545){if(_0x4cc545){return _0x1451a3[_0xd4ab('0x17')](_0xc2fdad)[_0xd4ab('0x19')](_0x4cc545);}};}function respondWithFilteredResult(_0x45e628,_0x2dc45f){return function(_0x568508){if(_0x568508){var _0x332e41=_0x568508[_0xd4ab('0x1a')],_0x528c53=_0x2dc45f[_0xd4ab('0x1b')],_0x1d550b=_0x2dc45f[_0xd4ab('0x1b')]+_0x2dc45f['limit'],_0x38b71d;if(_0x1d550b>=_0x332e41){_0x1d550b=_0x332e41;_0x38b71d=0xc8;}else{_0x38b71d=0xce;}_0x45e628[_0xd4ab('0x17')](_0x38b71d);return _0x45e628['set'](_0xd4ab('0x1c'),_0x528c53+'-'+_0x1d550b+'/'+_0x332e41)['json'](_0x568508);}return null;};}function patchUpdates(_0x428b78){return function(_0x26d382){try{jsonpatch[_0xd4ab('0x1d')](_0x26d382,_0x428b78,!![]);}catch(_0x528e5f){return BPromise['reject'](_0x528e5f);}return _0x26d382['save']();};}function saveUpdates(_0x4c085c,_0x14ff47){return function(_0x12d631){if(_0x12d631){return _0x12d631['update'](_0x4c085c)['then'](function(_0xfced84){return _0xfced84;});}return null;};}function removeEntity(_0x5eea15,_0x5b2bd6){return function(_0x3c2a52){if(_0x3c2a52){return _0x3c2a52['destroy']()['then'](function(){_0x5eea15[_0xd4ab('0x17')](0xcc)[_0xd4ab('0x18')]();});}};}function handleEntityNotFound(_0x5c5ba4,_0x23125d){return function(_0x475f50){if(!_0x475f50){_0x5c5ba4[_0xd4ab('0x16')](0x194);}return _0x475f50;};}function handleError(_0x53eff0,_0x5b3c67){_0x5b3c67=_0x5b3c67||0x1f4;return function(_0x475724){logger[_0xd4ab('0x1e')](_0x475724[_0xd4ab('0x1f')]);if(_0x475724['name']){delete _0x475724[_0xd4ab('0x20')];}_0x53eff0['status'](_0x5b3c67)['send'](_0x475724);};}exports[_0xd4ab('0x21')]=function(_0xce04cd,_0x573ee7){var _0xfb45cc={},_0x51d35a={},_0x572b2c={'count':0x0,'rows':[]};var _0x32d1d8=_[_0xd4ab('0x22')](db['MailServerOut'][_0xd4ab('0x23')],function(_0x5f1980){return{'name':_0x5f1980[_0xd4ab('0x24')],'type':_0x5f1980[_0xd4ab('0x25')]['key']};});_0x51d35a[_0xd4ab('0x26')]=_[_0xd4ab('0x22')](_0x32d1d8,_0xd4ab('0x20'));_0x51d35a[_0xd4ab('0x27')]=_[_0xd4ab('0x28')](_0xce04cd['query']);_0x51d35a[_0xd4ab('0x29')]=_['intersection'](_0x51d35a['model'],_0x51d35a[_0xd4ab('0x27')]);_0xfb45cc[_0xd4ab('0x2a')]=_[_0xd4ab('0x2b')](_0x51d35a[_0xd4ab('0x26')],qs[_0xd4ab('0x2c')](_0xce04cd[_0xd4ab('0x27')]['fields']));_0xfb45cc[_0xd4ab('0x2a')]=_0xfb45cc[_0xd4ab('0x2a')]['length']?_0xfb45cc['attributes']:_0x51d35a[_0xd4ab('0x26')];if(!_0xce04cd[_0xd4ab('0x27')][_0xd4ab('0x2d')](_0xd4ab('0x2e'))){_0xfb45cc[_0xd4ab('0x2f')]=qs[_0xd4ab('0x2f')](_0xce04cd[_0xd4ab('0x27')]['limit']);_0xfb45cc[_0xd4ab('0x1b')]=qs[_0xd4ab('0x1b')](_0xce04cd[_0xd4ab('0x27')][_0xd4ab('0x1b')]);}_0xfb45cc[_0xd4ab('0x30')]=qs[_0xd4ab('0x31')](_0xce04cd[_0xd4ab('0x27')][_0xd4ab('0x31')]);_0xfb45cc[_0xd4ab('0x32')]=qs[_0xd4ab('0x29')](_[_0xd4ab('0x33')](_0xce04cd[_0xd4ab('0x27')],_0x51d35a[_0xd4ab('0x29')]),_0x32d1d8);if(_0xce04cd[_0xd4ab('0x27')]['filter']){_0xfb45cc[_0xd4ab('0x32')]=_[_0xd4ab('0x34')](_0xfb45cc['where'],{'$or':_[_0xd4ab('0x22')](_0x32d1d8,function(_0x17c333){if(_0x17c333[_0xd4ab('0x25')]!==_0xd4ab('0x35')){var _0x4b80c4={};_0x4b80c4[_0x17c333[_0xd4ab('0x20')]]={'$like':'%'+_0xce04cd[_0xd4ab('0x27')][_0xd4ab('0x36')]+'%'};return _0x4b80c4;}})});}_0xfb45cc=_['merge']({},_0xfb45cc,_0xce04cd['options']);var _0x25f159={'where':_0xfb45cc[_0xd4ab('0x32')]};return db['MailServerOut']['count'](_0x25f159)['then'](function(_0x24e64c){_0x572b2c[_0xd4ab('0x1a')]=_0x24e64c;if(_0xce04cd['query'][_0xd4ab('0x37')]){_0xfb45cc[_0xd4ab('0x38')]=[{'all':!![]}];}return db[_0xd4ab('0x39')]['findAll'](_0xfb45cc);})[_0xd4ab('0x3a')](function(_0x2907a1){_0x572b2c[_0xd4ab('0x3b')]=_0x2907a1;return _0x572b2c;})[_0xd4ab('0x3a')](respondWithFilteredResult(_0x573ee7,_0xfb45cc))['catch'](handleError(_0x573ee7,null));};exports[_0xd4ab('0x3c')]=function(_0x32aff8,_0x26a84b){var _0x3f2777={'raw':!![],'where':{'id':_0x32aff8[_0xd4ab('0x3d')]['id']}},_0x3a9323={};_0x3a9323[_0xd4ab('0x26')]=_[_0xd4ab('0x28')](db['MailServerOut'][_0xd4ab('0x23')]);_0x3a9323[_0xd4ab('0x27')]=_['keys'](_0x32aff8[_0xd4ab('0x27')]);_0x3a9323[_0xd4ab('0x29')]=_['intersection'](_0x3a9323[_0xd4ab('0x26')],_0x3a9323[_0xd4ab('0x27')]);_0x3f2777[_0xd4ab('0x2a')]=_[_0xd4ab('0x2b')](_0x3a9323[_0xd4ab('0x26')],qs[_0xd4ab('0x2c')](_0x32aff8[_0xd4ab('0x27')][_0xd4ab('0x2c')]));_0x3f2777[_0xd4ab('0x2a')]=_0x3f2777[_0xd4ab('0x2a')]['length']?_0x3f2777['attributes']:_0x3a9323['model'];if(_0x32aff8[_0xd4ab('0x27')][_0xd4ab('0x37')]){_0x3f2777[_0xd4ab('0x38')]=[{'all':!![]}];}_0x3f2777=_[_0xd4ab('0x34')]({},_0x3f2777,_0x32aff8['options']);return db[_0xd4ab('0x39')][_0xd4ab('0x3e')](_0x3f2777)['then'](handleEntityNotFound(_0x26a84b,null))[_0xd4ab('0x3a')](respondWithResult(_0x26a84b,null))[_0xd4ab('0x3f')](handleError(_0x26a84b,null));};exports['create']=function(_0x3878cd,_0x1cfb02){return db['MailServerOut']['create'](_0x3878cd[_0xd4ab('0x40')],{})[_0xd4ab('0x3a')](respondWithResult(_0x1cfb02,0xc9))['catch'](handleError(_0x1cfb02,null));};exports['update']=function(_0x10e1eb,_0x354367){if(_0x10e1eb[_0xd4ab('0x40')]['id']){delete _0x10e1eb[_0xd4ab('0x40')]['id'];}return db['MailServerOut']['find']({'where':{'id':_0x10e1eb[_0xd4ab('0x3d')]['id']}})[_0xd4ab('0x3a')](handleEntityNotFound(_0x354367,null))['then'](saveUpdates(_0x10e1eb[_0xd4ab('0x40')],null))[_0xd4ab('0x3a')](respondWithResult(_0x354367,null))[_0xd4ab('0x3f')](handleError(_0x354367,null));};exports[_0xd4ab('0x41')]=function(_0x2f96c9,_0x10454d){return db['MailServerOut'][_0xd4ab('0x3e')]({'where':{'id':_0x2f96c9[_0xd4ab('0x3d')]['id']}})['then'](handleEntityNotFound(_0x10454d,null))[_0xd4ab('0x3a')](removeEntity(_0x10454d,null))['catch'](handleError(_0x10454d,null));}; \ No newline at end of file +var _0x0cde=['pick','filter','merge','VIRTUAL','options','MailServerOut','includeAll','include','findAll','rows','catch','params','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters'];(function(_0x266cd7,_0x3b1aa2){var _0x5eb0be=function(_0x16d0d7){while(--_0x16d0d7){_0x266cd7['push'](_0x266cd7['shift']());}};_0x5eb0be(++_0x3b1aa2);}(_0x0cde,0x181));var _0xe0cd=function(_0x5e481f,_0x22eaa4){_0x5e481f=_0x5e481f-0x0;var _0x46e678=_0x0cde[_0x5e481f];return _0x46e678;};'use strict';var pdf=require(_0xe0cd('0x0'));var emlformat=require(_0xe0cd('0x1'));var rimraf=require(_0xe0cd('0x2'));var zipdir=require(_0xe0cd('0x3'));var jsonpatch=require(_0xe0cd('0x4'));var rp=require(_0xe0cd('0x5'));var moment=require(_0xe0cd('0x6'));var BPromise=require(_0xe0cd('0x7'));var Mustache=require(_0xe0cd('0x8'));var util=require(_0xe0cd('0x9'));var path=require(_0xe0cd('0xa'));var sox=require(_0xe0cd('0xb'));var csv=require('to-csv');var ejs=require(_0xe0cd('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0xe0cd('0xd'));var crypto=require(_0xe0cd('0xe'));var jsforce=require(_0xe0cd('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xe0cd('0x10'));var Papa=require(_0xe0cd('0x11'));var Redis=require(_0xe0cd('0x12'));var authService=require(_0xe0cd('0x13'));var qs=require(_0xe0cd('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe0cd('0x15'));var logger=require(_0xe0cd('0x16'))(_0xe0cd('0x17'));var utils=require(_0xe0cd('0x18'));var config=require(_0xe0cd('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x122970,_0x529a07){_0x529a07=_0x529a07||0xcc;return function(_0x537afc){if(_0x537afc){return _0x122970[_0xe0cd('0x1a')](_0x529a07);}return _0x122970['status'](_0x529a07)['end']();};}function respondWithResult(_0x2ce2f7,_0x3e097d){_0x3e097d=_0x3e097d||0xc8;return function(_0x4d5f77){if(_0x4d5f77){return _0x2ce2f7[_0xe0cd('0x1b')](_0x3e097d)[_0xe0cd('0x1c')](_0x4d5f77);}};}function respondWithFilteredResult(_0x506c1b,_0x1f4470){return function(_0x25a877){if(_0x25a877){var _0xdec1bd=_0x25a877[_0xe0cd('0x1d')],_0x39d492=_0x1f4470[_0xe0cd('0x1e')],_0x4a8c35=_0x1f4470[_0xe0cd('0x1e')]+_0x1f4470[_0xe0cd('0x1f')],_0x5b6e72;if(_0x4a8c35>=_0xdec1bd){_0x4a8c35=_0xdec1bd;_0x5b6e72=0xc8;}else{_0x5b6e72=0xce;}_0x506c1b['status'](_0x5b6e72);return _0x506c1b['set'](_0xe0cd('0x20'),_0x39d492+'-'+_0x4a8c35+'/'+_0xdec1bd)['json'](_0x25a877);}return null;};}function patchUpdates(_0x3aa86e){return function(_0x3dc74c){try{jsonpatch[_0xe0cd('0x21')](_0x3dc74c,_0x3aa86e,!![]);}catch(_0x430f62){return BPromise[_0xe0cd('0x22')](_0x430f62);}return _0x3dc74c[_0xe0cd('0x23')]();};}function saveUpdates(_0x322851,_0x1a64ff){return function(_0x4b5d0e){if(_0x4b5d0e){return _0x4b5d0e[_0xe0cd('0x24')](_0x322851)[_0xe0cd('0x25')](function(_0x2367b9){return _0x2367b9;});}return null;};}function removeEntity(_0x30505c,_0x23dc06){return function(_0x14ecb6){if(_0x14ecb6){return _0x14ecb6[_0xe0cd('0x26')]()[_0xe0cd('0x25')](function(){_0x30505c[_0xe0cd('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3dbb4b,_0x5749fe){return function(_0x38d9b8){if(!_0x38d9b8){_0x3dbb4b[_0xe0cd('0x1a')](0x194);}return _0x38d9b8;};}function handleError(_0x43bfe2,_0x1cd3a6){_0x1cd3a6=_0x1cd3a6||0x1f4;return function(_0x244f6e){logger['error'](_0x244f6e[_0xe0cd('0x27')]);if(_0x244f6e[_0xe0cd('0x28')]){delete _0x244f6e[_0xe0cd('0x28')];}_0x43bfe2['status'](_0x1cd3a6)[_0xe0cd('0x29')](_0x244f6e);};}exports[_0xe0cd('0x2a')]=function(_0x1b1bcd,_0x17935b){var _0x23f417={},_0xa8e4dd={},_0x311e3f={'count':0x0,'rows':[]};var _0x4a2d9e=_[_0xe0cd('0x2b')](db['MailServerOut'][_0xe0cd('0x2c')],function(_0x511cea){return{'name':_0x511cea['fieldName'],'type':_0x511cea[_0xe0cd('0x2d')][_0xe0cd('0x2e')]};});_0xa8e4dd[_0xe0cd('0x2f')]=_[_0xe0cd('0x2b')](_0x4a2d9e,_0xe0cd('0x28'));_0xa8e4dd[_0xe0cd('0x30')]=_[_0xe0cd('0x31')](_0x1b1bcd[_0xe0cd('0x30')]);_0xa8e4dd['filters']=_[_0xe0cd('0x32')](_0xa8e4dd[_0xe0cd('0x2f')],_0xa8e4dd[_0xe0cd('0x30')]);_0x23f417[_0xe0cd('0x33')]=_[_0xe0cd('0x32')](_0xa8e4dd[_0xe0cd('0x2f')],qs[_0xe0cd('0x34')](_0x1b1bcd[_0xe0cd('0x30')][_0xe0cd('0x34')]));_0x23f417[_0xe0cd('0x33')]=_0x23f417[_0xe0cd('0x33')][_0xe0cd('0x35')]?_0x23f417[_0xe0cd('0x33')]:_0xa8e4dd[_0xe0cd('0x2f')];if(!_0x1b1bcd[_0xe0cd('0x30')][_0xe0cd('0x36')]('nolimit')){_0x23f417[_0xe0cd('0x1f')]=qs[_0xe0cd('0x1f')](_0x1b1bcd['query'][_0xe0cd('0x1f')]);_0x23f417[_0xe0cd('0x1e')]=qs['offset'](_0x1b1bcd[_0xe0cd('0x30')][_0xe0cd('0x1e')]);}_0x23f417[_0xe0cd('0x37')]=qs[_0xe0cd('0x38')](_0x1b1bcd[_0xe0cd('0x30')][_0xe0cd('0x38')]);_0x23f417[_0xe0cd('0x39')]=qs[_0xe0cd('0x3a')](_[_0xe0cd('0x3b')](_0x1b1bcd[_0xe0cd('0x30')],_0xa8e4dd[_0xe0cd('0x3a')]),_0x4a2d9e);if(_0x1b1bcd['query'][_0xe0cd('0x3c')]){_0x23f417['where']=_[_0xe0cd('0x3d')](_0x23f417[_0xe0cd('0x39')],{'$or':_['map'](_0x4a2d9e,function(_0x10424b){if(_0x10424b['type']!==_0xe0cd('0x3e')){var _0x327ef4={};_0x327ef4[_0x10424b[_0xe0cd('0x28')]]={'$like':'%'+_0x1b1bcd[_0xe0cd('0x30')]['filter']+'%'};return _0x327ef4;}})});}_0x23f417=_[_0xe0cd('0x3d')]({},_0x23f417,_0x1b1bcd[_0xe0cd('0x3f')]);var _0x394f46={'where':_0x23f417[_0xe0cd('0x39')]};return db[_0xe0cd('0x40')][_0xe0cd('0x1d')](_0x394f46)[_0xe0cd('0x25')](function(_0x27b4b9){_0x311e3f[_0xe0cd('0x1d')]=_0x27b4b9;if(_0x1b1bcd[_0xe0cd('0x30')][_0xe0cd('0x41')]){_0x23f417[_0xe0cd('0x42')]=[{'all':!![]}];}return db[_0xe0cd('0x40')][_0xe0cd('0x43')](_0x23f417);})['then'](function(_0x1eff60){_0x311e3f[_0xe0cd('0x44')]=_0x1eff60;return _0x311e3f;})[_0xe0cd('0x25')](respondWithFilteredResult(_0x17935b,_0x23f417))[_0xe0cd('0x45')](handleError(_0x17935b,null));};exports['show']=function(_0x312f91,_0xf7b9f6){var _0x42c066={'raw':!![],'where':{'id':_0x312f91[_0xe0cd('0x46')]['id']}},_0x101751={};_0x101751[_0xe0cd('0x2f')]=_[_0xe0cd('0x31')](db['MailServerOut'][_0xe0cd('0x2c')]);_0x101751[_0xe0cd('0x30')]=_[_0xe0cd('0x31')](_0x312f91[_0xe0cd('0x30')]);_0x101751[_0xe0cd('0x3a')]=_[_0xe0cd('0x32')](_0x101751[_0xe0cd('0x2f')],_0x101751[_0xe0cd('0x30')]);_0x42c066[_0xe0cd('0x33')]=_[_0xe0cd('0x32')](_0x101751[_0xe0cd('0x2f')],qs[_0xe0cd('0x34')](_0x312f91[_0xe0cd('0x30')][_0xe0cd('0x34')]));_0x42c066[_0xe0cd('0x33')]=_0x42c066[_0xe0cd('0x33')][_0xe0cd('0x35')]?_0x42c066['attributes']:_0x101751['model'];if(_0x312f91[_0xe0cd('0x30')][_0xe0cd('0x41')]){_0x42c066[_0xe0cd('0x42')]=[{'all':!![]}];}_0x42c066=_[_0xe0cd('0x3d')]({},_0x42c066,_0x312f91[_0xe0cd('0x3f')]);return db['MailServerOut'][_0xe0cd('0x47')](_0x42c066)['then'](handleEntityNotFound(_0xf7b9f6,null))[_0xe0cd('0x25')](respondWithResult(_0xf7b9f6,null))['catch'](handleError(_0xf7b9f6,null));};exports[_0xe0cd('0x48')]=function(_0x26169c,_0x3e3127){return db[_0xe0cd('0x40')][_0xe0cd('0x48')](_0x26169c[_0xe0cd('0x49')],{})[_0xe0cd('0x25')](respondWithResult(_0x3e3127,0xc9))[_0xe0cd('0x45')](handleError(_0x3e3127,null));};exports[_0xe0cd('0x24')]=function(_0x365947,_0x64b1f0){if(_0x365947[_0xe0cd('0x49')]['id']){delete _0x365947[_0xe0cd('0x49')]['id'];}return db[_0xe0cd('0x40')][_0xe0cd('0x47')]({'where':{'id':_0x365947[_0xe0cd('0x46')]['id']}})[_0xe0cd('0x25')](handleEntityNotFound(_0x64b1f0,null))[_0xe0cd('0x25')](saveUpdates(_0x365947[_0xe0cd('0x49')],null))[_0xe0cd('0x25')](respondWithResult(_0x64b1f0,null))[_0xe0cd('0x45')](handleError(_0x64b1f0,null));};exports[_0xe0cd('0x26')]=function(_0x58b160,_0x279d21){return db[_0xe0cd('0x40')][_0xe0cd('0x47')]({'where':{'id':_0x58b160[_0xe0cd('0x46')]['id']}})[_0xe0cd('0x25')](handleEntityNotFound(_0x279d21,null))[_0xe0cd('0x25')](removeEntity(_0x279d21,null))[_0xe0cd('0x45')](handleError(_0x279d21,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 52ea730..28ce6ad 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 _0x187d=['define','MailServerOut','mail_servers_out','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./mailServerOut.attributes'];(function(_0x239df9,_0x13d9d1){var _0x11df94=function(_0x4cdc05){while(--_0x4cdc05){_0x239df9['push'](_0x239df9['shift']());}};_0x11df94(++_0x13d9d1);}(_0x187d,0x93));var _0xd187=function(_0x2b5eae,_0x55010d){_0x2b5eae=_0x2b5eae-0x0;var _0x5f3ac9=_0x187d[_0x2b5eae];return _0x5f3ac9;};'use strict';var _=require(_0xd187('0x0'));var util=require('util');var logger=require(_0xd187('0x1'))(_0xd187('0x2'));var moment=require(_0xd187('0x3'));var BPromise=require(_0xd187('0x4'));var rp=require(_0xd187('0x5'));var fs=require('fs');var path=require(_0xd187('0x6'));var rimraf=require('rimraf');var config=require(_0xd187('0x7'));var attributes=require(_0xd187('0x8'));module['exports']=function(_0x1d2533,_0x58ee7){return _0x1d2533[_0xd187('0x9')](_0xd187('0xa'),attributes,{'tableName':_0xd187('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1261=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailServerOut.attributes','define','mail_servers_out'];(function(_0x5a6cf8,_0x50439a){var _0x5e6d65=function(_0x3949fd){while(--_0x3949fd){_0x5a6cf8['push'](_0x5a6cf8['shift']());}};_0x5e6d65(++_0x50439a);}(_0x1261,0x144));var _0x1126=function(_0x4dd71c,_0x23a24e){_0x4dd71c=_0x4dd71c-0x0;var _0x8e4e36=_0x1261[_0x4dd71c];return _0x8e4e36;};'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 diff --git a/server/api/mailServerOut/mailServerOut.rpc.js b/server/api/mailServerOut/mailServerOut.rpc.js index e1f947b..03a00fa 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 _0xa259=['MailServerOut,\x20%s,\x20%s','debug','MailServerOut,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','catch','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info'];(function(_0x3054be,_0x1bdc8b){var _0x3df150=function(_0x56cfbf){while(--_0x56cfbf){_0x3054be['push'](_0x3054be['shift']());}};_0x3df150(++_0x1bdc8b);}(_0xa259,0x11a));var _0x9a25=function(_0x4cbf20,_0x1bfa66){_0x4cbf20=_0x4cbf20-0x0;var _0x582ae4=_0xa259[_0x4cbf20];return _0x582ae4;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9a25('0x0'));var BPromise=require(_0x9a25('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9a25('0x2'));var db=require(_0x9a25('0x3'))['db'];var utils=require(_0x9a25('0x4'));var logger=require(_0x9a25('0x5'))(_0x9a25('0x6'));var config=require('../../config/environment');var jayson=require(_0x9a25('0x7'));var client=jayson[_0x9a25('0x8')][_0x9a25('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x27037e,_0x4a5a7e,_0x6f5fdb){return new BPromise(function(_0x3283cc,_0x2cd96c){return client['request'](_0x27037e,_0x6f5fdb)[_0x9a25('0xa')](function(_0xfba739){logger[_0x9a25('0xb')](_0x9a25('0xc'),_0x4a5a7e,'request\x20sent');logger[_0x9a25('0xd')](_0x9a25('0xe'),_0x4a5a7e,_0x9a25('0xf'),JSON[_0x9a25('0x10')](_0xfba739));if(_0xfba739['error']){if(_0xfba739['error'][_0x9a25('0x11')]===0x1f4){logger['error'](_0x9a25('0xc'),_0x4a5a7e,_0xfba739[_0x9a25('0x12')]['message']);return _0x2cd96c(_0xfba739[_0x9a25('0x12')][_0x9a25('0x13')]);}logger[_0x9a25('0x12')](_0x9a25('0xc'),_0x4a5a7e,_0xfba739[_0x9a25('0x12')][_0x9a25('0x13')]);return _0x3283cc(_0xfba739[_0x9a25('0x12')][_0x9a25('0x13')]);}else{logger[_0x9a25('0xb')](_0x9a25('0xc'),_0x4a5a7e,_0x9a25('0xf'));_0x3283cc(_0xfba739['result'][_0x9a25('0x13')]);}})[_0x9a25('0x14')](function(_0x9776c0){logger[_0x9a25('0x12')](_0x9a25('0xc'),_0x4a5a7e,_0x9776c0);_0x2cd96c(_0x9776c0);});});} \ No newline at end of file +var _0xc9c8=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','MailServerOut,\x20%s,\x20%s,\x20%s','stringify','error','MailServerOut,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x5b50ae,_0x7da7e1){var _0x84eb56=function(_0xad6b38){while(--_0xad6b38){_0x5b50ae['push'](_0x5b50ae['shift']());}};_0x84eb56(++_0x7da7e1);}(_0xc9c8,0x169));var _0x8c9c=function(_0x5b6cba,_0x325ab5){_0x5b6cba=_0x5b6cba-0x0;var _0x50eae9=_0xc9c8[_0x5b6cba];return _0x50eae9;};'use strict';var _=require(_0x8c9c('0x0'));var util=require(_0x8c9c('0x1'));var moment=require(_0x8c9c('0x2'));var BPromise=require(_0x8c9c('0x3'));var rs=require(_0x8c9c('0x4'));var fs=require('fs');var Redis=require(_0x8c9c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x8c9c('0x6'));var logger=require(_0x8c9c('0x7'))(_0x8c9c('0x8'));var config=require(_0x8c9c('0x9'));var jayson=require(_0x8c9c('0xa'));var client=jayson[_0x8c9c('0xb')][_0x8c9c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4d2b73,_0x24249e,_0x1dfcb5){return new BPromise(function(_0x1eb44e,_0x2aee87){return client[_0x8c9c('0xd')](_0x4d2b73,_0x1dfcb5)[_0x8c9c('0xe')](function(_0x1cd533){logger[_0x8c9c('0xf')]('MailServerOut,\x20%s,\x20%s',_0x24249e,_0x8c9c('0x10'));logger['debug'](_0x8c9c('0x11'),_0x24249e,_0x8c9c('0x10'),JSON[_0x8c9c('0x12')](_0x1cd533));if(_0x1cd533[_0x8c9c('0x13')]){if(_0x1cd533['error']['code']===0x1f4){logger[_0x8c9c('0x13')](_0x8c9c('0x14'),_0x24249e,_0x1cd533[_0x8c9c('0x13')][_0x8c9c('0x15')]);return _0x2aee87(_0x1cd533[_0x8c9c('0x13')]['message']);}logger[_0x8c9c('0x13')](_0x8c9c('0x14'),_0x24249e,_0x1cd533[_0x8c9c('0x13')][_0x8c9c('0x15')]);return _0x1eb44e(_0x1cd533['error'][_0x8c9c('0x15')]);}else{logger['info'](_0x8c9c('0x14'),_0x24249e,_0x8c9c('0x10'));_0x1eb44e(_0x1cd533['result'][_0x8c9c('0x15')]);}})[_0x8c9c('0x16')](function(_0x135cab){logger[_0x8c9c('0x13')](_0x8c9c('0x14'),_0x24249e,_0x135cab);_0x2aee87(_0x135cab);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index 77e626e..53a604f 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 _0x10e3=['/describe','describe','show','post','create','put','/:id','destroy','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x36400b,_0x9ad645){var _0x425f1f=function(_0x1fcfe7){while(--_0x1fcfe7){_0x36400b['push'](_0x36400b['shift']());}};_0x425f1f(++_0x9ad645);}(_0x10e3,0x1d1));var _0x310e=function(_0x8864dd,_0x120434){_0x8864dd=_0x8864dd-0x0;var _0x4c1074=_0x10e3[_0x8864dd];return _0x4c1074;};'use strict';var multer=require(_0x310e('0x0'));var util=require('util');var path=require(_0x310e('0x1'));var timeout=require(_0x310e('0x2'));var express=require(_0x310e('0x3'));var router=express[_0x310e('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x310e('0x5'));var config=require(_0x310e('0x6'));var controller=require('./mailSubstatus.controller');router[_0x310e('0x7')]('/',auth[_0x310e('0x8')](),controller[_0x310e('0x9')]);router[_0x310e('0x7')](_0x310e('0xa'),auth[_0x310e('0x8')](),controller[_0x310e('0xb')]);router[_0x310e('0x7')]('/:id',auth[_0x310e('0x8')](),controller[_0x310e('0xc')]);router[_0x310e('0xd')]('/',auth[_0x310e('0x8')](),controller[_0x310e('0xe')]);router[_0x310e('0xf')](_0x310e('0x10'),auth[_0x310e('0x8')](),controller['update']);router['delete'](_0x310e('0x10'),auth[_0x310e('0x8')](),controller[_0x310e('0x11')]);module[_0x310e('0x12')]=router; \ No newline at end of file +var _0x22e0=['exports','multer','util','connect-timeout','Router','../../components/auth/service','../../config/environment','./mailSubstatus.controller','get','/describe','isAuthenticated','describe','/:id','post','put','delete','destroy'];(function(_0x348411,_0x557503){var _0x4187f9=function(_0x92991){while(--_0x92991){_0x348411['push'](_0x348411['shift']());}};_0x4187f9(++_0x557503);}(_0x22e0,0xbc));var _0x022e=function(_0x2dfad3,_0x3b4883){_0x2dfad3=_0x2dfad3-0x0;var _0x9d835c=_0x22e0[_0x2dfad3];return _0x9d835c;};'use strict';var multer=require(_0x022e('0x0'));var util=require(_0x022e('0x1'));var path=require('path');var timeout=require(_0x022e('0x2'));var express=require('express');var router=express[_0x022e('0x3')]();var auth=require(_0x022e('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x022e('0x5'));var controller=require(_0x022e('0x6'));router[_0x022e('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x022e('0x7')](_0x022e('0x8'),auth[_0x022e('0x9')](),controller[_0x022e('0xa')]);router[_0x022e('0x7')](_0x022e('0xb'),auth[_0x022e('0x9')](),controller['show']);router[_0x022e('0xc')]('/',auth[_0x022e('0x9')](),controller['create']);router[_0x022e('0xd')](_0x022e('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x022e('0xe')](_0x022e('0xb'),auth['isAuthenticated'](),controller[_0x022e('0xf')]);module[_0x022e('0x10')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 4637963..20a3726 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 _0xb7ae=['exports','STRING','name','sequelize'];(function(_0x50007c,_0x1cbf11){var _0x5c1ec7=function(_0x52d038){while(--_0x52d038){_0x50007c['push'](_0x50007c['shift']());}};_0x5c1ec7(++_0x1cbf11);}(_0xb7ae,0xf3));var _0xeb7a=function(_0x10599d,_0x5f4787){_0x10599d=_0x10599d-0x0;var _0x29ef53=_0xb7ae[_0x10599d];return _0x29ef53;};'use strict';var Sequelize=require(_0xeb7a('0x0'));module[_0xeb7a('0x1')]={'name':{'type':Sequelize[_0xeb7a('0x2')],'unique':_0xeb7a('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xeb7a('0x2')]}}; \ No newline at end of file +var _0x75dc=['exports','sequelize'];(function(_0x100e36,_0x4da225){var _0x1df0c9=function(_0xe4b84f){while(--_0xe4b84f){_0x100e36['push'](_0x100e36['shift']());}};_0x1df0c9(++_0x4da225);}(_0x75dc,0x1d7));var _0xc75d=function(_0x26224c,_0x1a354c){_0x26224c=_0x26224c-0x0;var _0x4c2bc5=_0x75dc[_0x26224c];return _0x4c2bc5;};'use strict';var Sequelize=require(_0xc75d('0x0'));module[_0xc75d('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 3162a41..ec32859 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 _0xac52=['lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','update','then','destroy','error','stack','name','send','map','MailSubstatus','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','find','catch','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs'];(function(_0x50059f,_0x1b78ed){var _0x1a06df=function(_0x3cfb82){while(--_0x3cfb82){_0x50059f['push'](_0x50059f['shift']());}};_0x1a06df(++_0x1b78ed);}(_0xac52,0x1a4));var _0x2ac5=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xac52[_0x3947c9];return _0x2e7871;};'use strict';var pdf=require(_0x2ac5('0x0'));var emlformat=require(_0x2ac5('0x1'));var rimraf=require(_0x2ac5('0x2'));var zipdir=require(_0x2ac5('0x3'));var jsonpatch=require(_0x2ac5('0x4'));var rp=require('request-promise');var moment=require(_0x2ac5('0x5'));var BPromise=require(_0x2ac5('0x6'));var Mustache=require(_0x2ac5('0x7'));var util=require('util');var path=require(_0x2ac5('0x8'));var sox=require(_0x2ac5('0x9'));var csv=require(_0x2ac5('0xa'));var ejs=require(_0x2ac5('0xb'));var fs=require('fs');var _=require(_0x2ac5('0xc'));var squel=require('squel');var crypto=require(_0x2ac5('0xd'));var jsforce=require(_0x2ac5('0xe'));var deskjs=require(_0x2ac5('0xf'));var toCsv=require(_0x2ac5('0xa'));var querystring=require(_0x2ac5('0x10'));var Papa=require('papaparse');var Redis=require(_0x2ac5('0x11'));var authService=require(_0x2ac5('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2ac5('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x2ac5('0x14'));var config=require(_0x2ac5('0x15'));var db=require(_0x2ac5('0x16'))['db'];function respondWithStatusCode(_0x3b42c3,_0x35b1e3){_0x35b1e3=_0x35b1e3||0xcc;return function(_0x3a9ac8){if(_0x3a9ac8){return _0x3b42c3[_0x2ac5('0x17')](_0x35b1e3);}return _0x3b42c3[_0x2ac5('0x18')](_0x35b1e3)[_0x2ac5('0x19')]();};}function respondWithResult(_0x21e3d7,_0x55e565){_0x55e565=_0x55e565||0xc8;return function(_0x4592fe){if(_0x4592fe){return _0x21e3d7[_0x2ac5('0x18')](_0x55e565)[_0x2ac5('0x1a')](_0x4592fe);}};}function respondWithFilteredResult(_0x566c13,_0x1fbb7c){return function(_0x14d3ee){if(_0x14d3ee){var _0x56dfc0=_0x14d3ee[_0x2ac5('0x1b')],_0x380369=_0x1fbb7c[_0x2ac5('0x1c')],_0x56650=_0x1fbb7c[_0x2ac5('0x1c')]+_0x1fbb7c['limit'],_0x593b29;if(_0x56650>=_0x56dfc0){_0x56650=_0x56dfc0;_0x593b29=0xc8;}else{_0x593b29=0xce;}_0x566c13[_0x2ac5('0x18')](_0x593b29);return _0x566c13[_0x2ac5('0x1d')](_0x2ac5('0x1e'),_0x380369+'-'+_0x56650+'/'+_0x56dfc0)[_0x2ac5('0x1a')](_0x14d3ee);}return null;};}function patchUpdates(_0x2bee9a){return function(_0x551100){try{jsonpatch['apply'](_0x551100,_0x2bee9a,!![]);}catch(_0x534dc2){return BPromise['reject'](_0x534dc2);}return _0x551100['save']();};}function saveUpdates(_0x8819b2,_0x5829cc){return function(_0x6e3b9b){if(_0x6e3b9b){return _0x6e3b9b[_0x2ac5('0x1f')](_0x8819b2)[_0x2ac5('0x20')](function(_0x5eba46){return _0x5eba46;});}return null;};}function removeEntity(_0x14a915,_0x20cb53){return function(_0x125ad2){if(_0x125ad2){return _0x125ad2[_0x2ac5('0x21')]()['then'](function(){_0x14a915['status'](0xcc)[_0x2ac5('0x19')]();});}};}function handleEntityNotFound(_0x2f572d,_0x4e9c5d){return function(_0x3e3694){if(!_0x3e3694){_0x2f572d['sendStatus'](0x194);}return _0x3e3694;};}function handleError(_0x1a037b,_0x2ffb04){_0x2ffb04=_0x2ffb04||0x1f4;return function(_0x1b19c0){logger[_0x2ac5('0x22')](_0x1b19c0[_0x2ac5('0x23')]);if(_0x1b19c0['name']){delete _0x1b19c0[_0x2ac5('0x24')];}_0x1a037b[_0x2ac5('0x18')](_0x2ffb04)[_0x2ac5('0x25')](_0x1b19c0);};}exports['index']=function(_0x4aea43,_0x1c8b91){var _0x1ee430={},_0x61233c={},_0xe83ef3={'count':0x0,'rows':[]};var _0x24a80a=_[_0x2ac5('0x26')](db[_0x2ac5('0x27')][_0x2ac5('0x28')],function(_0x270673){return{'name':_0x270673[_0x2ac5('0x29')],'type':_0x270673[_0x2ac5('0x2a')][_0x2ac5('0x2b')]};});_0x61233c[_0x2ac5('0x2c')]=_[_0x2ac5('0x26')](_0x24a80a,_0x2ac5('0x24'));_0x61233c[_0x2ac5('0x2d')]=_['keys'](_0x4aea43[_0x2ac5('0x2d')]);_0x61233c['filters']=_[_0x2ac5('0x2e')](_0x61233c[_0x2ac5('0x2c')],_0x61233c[_0x2ac5('0x2d')]);_0x1ee430[_0x2ac5('0x2f')]=_[_0x2ac5('0x2e')](_0x61233c[_0x2ac5('0x2c')],qs[_0x2ac5('0x30')](_0x4aea43['query'][_0x2ac5('0x30')]));_0x1ee430[_0x2ac5('0x2f')]=_0x1ee430[_0x2ac5('0x2f')][_0x2ac5('0x31')]?_0x1ee430[_0x2ac5('0x2f')]:_0x61233c[_0x2ac5('0x2c')];if(!_0x4aea43['query'][_0x2ac5('0x32')](_0x2ac5('0x33'))){_0x1ee430['limit']=qs['limit'](_0x4aea43[_0x2ac5('0x2d')][_0x2ac5('0x34')]);_0x1ee430['offset']=qs[_0x2ac5('0x1c')](_0x4aea43[_0x2ac5('0x2d')][_0x2ac5('0x1c')]);}_0x1ee430[_0x2ac5('0x35')]=qs['sort'](_0x4aea43[_0x2ac5('0x2d')][_0x2ac5('0x36')]);_0x1ee430[_0x2ac5('0x37')]=qs[_0x2ac5('0x38')](_['pick'](_0x4aea43[_0x2ac5('0x2d')],_0x61233c[_0x2ac5('0x38')]),_0x24a80a);if(_0x4aea43[_0x2ac5('0x2d')]['filter']){_0x1ee430[_0x2ac5('0x37')]=_[_0x2ac5('0x39')](_0x1ee430[_0x2ac5('0x37')],{'$or':_[_0x2ac5('0x26')](_0x24a80a,function(_0xbb3ca1){if(_0xbb3ca1['type']!==_0x2ac5('0x3a')){var _0x110e82={};_0x110e82[_0xbb3ca1[_0x2ac5('0x24')]]={'$like':'%'+_0x4aea43[_0x2ac5('0x2d')]['filter']+'%'};return _0x110e82;}})});}_0x1ee430=_[_0x2ac5('0x39')]({},_0x1ee430,_0x4aea43[_0x2ac5('0x3b')]);var _0x454bbf={'where':_0x1ee430[_0x2ac5('0x37')]};return db['MailSubstatus'][_0x2ac5('0x1b')](_0x454bbf)[_0x2ac5('0x20')](function(_0x168410){_0xe83ef3[_0x2ac5('0x1b')]=_0x168410;if(_0x4aea43[_0x2ac5('0x2d')][_0x2ac5('0x3c')]){_0x1ee430[_0x2ac5('0x3d')]=[{'all':!![]}];}return db[_0x2ac5('0x27')][_0x2ac5('0x3e')](_0x1ee430);})['then'](function(_0x566396){_0xe83ef3[_0x2ac5('0x3f')]=_0x566396;return _0xe83ef3;})[_0x2ac5('0x20')](respondWithFilteredResult(_0x1c8b91,_0x1ee430))['catch'](handleError(_0x1c8b91,null));};exports[_0x2ac5('0x40')]=function(_0x122f5a,_0x16cd94){var _0x23bc99={'raw':!![],'where':{'id':_0x122f5a[_0x2ac5('0x41')]['id']}},_0x58a90c={};_0x58a90c['model']=_[_0x2ac5('0x42')](db[_0x2ac5('0x27')][_0x2ac5('0x28')]);_0x58a90c[_0x2ac5('0x2d')]=_[_0x2ac5('0x42')](_0x122f5a[_0x2ac5('0x2d')]);_0x58a90c[_0x2ac5('0x38')]=_[_0x2ac5('0x2e')](_0x58a90c[_0x2ac5('0x2c')],_0x58a90c[_0x2ac5('0x2d')]);_0x23bc99[_0x2ac5('0x2f')]=_['intersection'](_0x58a90c['model'],qs[_0x2ac5('0x30')](_0x122f5a[_0x2ac5('0x2d')][_0x2ac5('0x30')]));_0x23bc99[_0x2ac5('0x2f')]=_0x23bc99['attributes']['length']?_0x23bc99[_0x2ac5('0x2f')]:_0x58a90c[_0x2ac5('0x2c')];if(_0x122f5a[_0x2ac5('0x2d')]['includeAll']){_0x23bc99[_0x2ac5('0x3d')]=[{'all':!![]}];}_0x23bc99=_[_0x2ac5('0x39')]({},_0x23bc99,_0x122f5a['options']);return db['MailSubstatus'][_0x2ac5('0x43')](_0x23bc99)[_0x2ac5('0x20')](handleEntityNotFound(_0x16cd94,null))[_0x2ac5('0x20')](respondWithResult(_0x16cd94,null))[_0x2ac5('0x44')](handleError(_0x16cd94,null));};exports[_0x2ac5('0x45')]=function(_0x2b444f,_0x2c0b3c){return db[_0x2ac5('0x27')][_0x2ac5('0x45')](_0x2b444f[_0x2ac5('0x46')],{})[_0x2ac5('0x20')](respondWithResult(_0x2c0b3c,0xc9))['catch'](handleError(_0x2c0b3c,null));};exports[_0x2ac5('0x1f')]=function(_0x1c135f,_0x231c4d){if(_0x1c135f['body']['id']){delete _0x1c135f[_0x2ac5('0x46')]['id'];}return db[_0x2ac5('0x27')][_0x2ac5('0x43')]({'where':{'id':_0x1c135f[_0x2ac5('0x41')]['id']}})['then'](handleEntityNotFound(_0x231c4d,null))['then'](saveUpdates(_0x1c135f['body'],null))[_0x2ac5('0x20')](respondWithResult(_0x231c4d,null))['catch'](handleError(_0x231c4d,null));};exports[_0x2ac5('0x21')]=function(_0x12e6fd,_0x11a377){return db[_0x2ac5('0x27')][_0x2ac5('0x43')]({'where':{'id':_0x12e6fd['params']['id']}})[_0x2ac5('0x20')](handleEntityNotFound(_0x11a377,null))[_0x2ac5('0x20')](removeEntity(_0x11a377,null))[_0x2ac5('0x44')](handleError(_0x11a377,null));};exports[_0x2ac5('0x47')]=function(_0x4ce791,_0x57f390){return db[_0x2ac5('0x27')]['describe']()[_0x2ac5('0x20')](respondWithResult(_0x57f390,null))[_0x2ac5('0x44')](handleError(_0x57f390,null));}; \ No newline at end of file +var _0x4301=['update','then','sendStatus','name','send','index','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','sort','where','pick','filter','map','VIRTUAL','merge','MailSubstatus','includeAll','include','rows','catch','show','length','options','find','create','body','params','destroy','describe','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','save'];(function(_0x1d9a5a,_0x53eb60){var _0x58b7bd=function(_0x141fd0){while(--_0x141fd0){_0x1d9a5a['push'](_0x1d9a5a['shift']());}};_0x58b7bd(++_0x53eb60);}(_0x4301,0x6d));var _0x1430=function(_0x849b41,_0xa5b3e){_0x849b41=_0x849b41-0x0;var _0x5bb3fa=_0x4301[_0x849b41];return _0x5bb3fa;};'use strict';var pdf=require(_0x1430('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x1430('0x1'));var zipdir=require(_0x1430('0x2'));var jsonpatch=require(_0x1430('0x3'));var rp=require('request-promise');var moment=require(_0x1430('0x4'));var BPromise=require(_0x1430('0x5'));var Mustache=require(_0x1430('0x6'));var util=require(_0x1430('0x7'));var path=require(_0x1430('0x8'));var sox=require(_0x1430('0x9'));var csv=require('to-csv');var ejs=require(_0x1430('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x1430('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x1430('0xc'));var toCsv=require(_0x1430('0xd'));var querystring=require(_0x1430('0xe'));var Papa=require(_0x1430('0xf'));var Redis=require('ioredis');var authService=require(_0x1430('0x10'));var qs=require(_0x1430('0x11'));var as=require(_0x1430('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1430('0x13'))(_0x1430('0x14'));var utils=require(_0x1430('0x15'));var config=require('../../config/environment');var db=require(_0x1430('0x16'))['db'];function respondWithStatusCode(_0x38474f,_0x11b0cb){_0x11b0cb=_0x11b0cb||0xcc;return function(_0x3b7628){if(_0x3b7628){return _0x38474f['sendStatus'](_0x11b0cb);}return _0x38474f[_0x1430('0x17')](_0x11b0cb)[_0x1430('0x18')]();};}function respondWithResult(_0x53eb93,_0x1c971e){_0x1c971e=_0x1c971e||0xc8;return function(_0x313834){if(_0x313834){return _0x53eb93[_0x1430('0x17')](_0x1c971e)[_0x1430('0x19')](_0x313834);}};}function respondWithFilteredResult(_0x4a5cf1,_0x43d140){return function(_0x26948f){if(_0x26948f){var _0x42228b=_0x26948f[_0x1430('0x1a')],_0x13ce44=_0x43d140[_0x1430('0x1b')],_0x29a68a=_0x43d140[_0x1430('0x1b')]+_0x43d140[_0x1430('0x1c')],_0x3d4c7a;if(_0x29a68a>=_0x42228b){_0x29a68a=_0x42228b;_0x3d4c7a=0xc8;}else{_0x3d4c7a=0xce;}_0x4a5cf1['status'](_0x3d4c7a);return _0x4a5cf1[_0x1430('0x1d')](_0x1430('0x1e'),_0x13ce44+'-'+_0x29a68a+'/'+_0x42228b)[_0x1430('0x19')](_0x26948f);}return null;};}function patchUpdates(_0x59e260){return function(_0x3b26c6){try{jsonpatch[_0x1430('0x1f')](_0x3b26c6,_0x59e260,!![]);}catch(_0x1bacf1){return BPromise['reject'](_0x1bacf1);}return _0x3b26c6[_0x1430('0x20')]();};}function saveUpdates(_0x3e3b03,_0x30c4e3){return function(_0x524309){if(_0x524309){return _0x524309[_0x1430('0x21')](_0x3e3b03)[_0x1430('0x22')](function(_0x261da2){return _0x261da2;});}return null;};}function removeEntity(_0x28fa4e,_0x502673){return function(_0xbfe017){if(_0xbfe017){return _0xbfe017['destroy']()[_0x1430('0x22')](function(){_0x28fa4e['status'](0xcc)[_0x1430('0x18')]();});}};}function handleEntityNotFound(_0x2e2866,_0x3fbb66){return function(_0x3a1719){if(!_0x3a1719){_0x2e2866[_0x1430('0x23')](0x194);}return _0x3a1719;};}function handleError(_0x20a65e,_0x309192){_0x309192=_0x309192||0x1f4;return function(_0x811be7){logger['error'](_0x811be7['stack']);if(_0x811be7['name']){delete _0x811be7[_0x1430('0x24')];}_0x20a65e[_0x1430('0x17')](_0x309192)[_0x1430('0x25')](_0x811be7);};}exports[_0x1430('0x26')]=function(_0x453e76,_0x19c2b3){var _0x148156={},_0x3143d9={},_0x456ee5={'count':0x0,'rows':[]};var _0x531ed5=_['map'](db['MailSubstatus'][_0x1430('0x27')],function(_0x431963){return{'name':_0x431963['fieldName'],'type':_0x431963[_0x1430('0x28')][_0x1430('0x29')]};});_0x3143d9[_0x1430('0x2a')]=_['map'](_0x531ed5,'name');_0x3143d9[_0x1430('0x2b')]=_[_0x1430('0x2c')](_0x453e76[_0x1430('0x2b')]);_0x3143d9[_0x1430('0x2d')]=_[_0x1430('0x2e')](_0x3143d9[_0x1430('0x2a')],_0x3143d9['query']);_0x148156['attributes']=_[_0x1430('0x2e')](_0x3143d9[_0x1430('0x2a')],qs[_0x1430('0x2f')](_0x453e76[_0x1430('0x2b')][_0x1430('0x2f')]));_0x148156[_0x1430('0x30')]=_0x148156['attributes']['length']?_0x148156['attributes']:_0x3143d9[_0x1430('0x2a')];if(!_0x453e76[_0x1430('0x2b')][_0x1430('0x31')]('nolimit')){_0x148156[_0x1430('0x1c')]=qs[_0x1430('0x1c')](_0x453e76[_0x1430('0x2b')]['limit']);_0x148156[_0x1430('0x1b')]=qs[_0x1430('0x1b')](_0x453e76[_0x1430('0x2b')][_0x1430('0x1b')]);}_0x148156['order']=qs[_0x1430('0x32')](_0x453e76[_0x1430('0x2b')][_0x1430('0x32')]);_0x148156[_0x1430('0x33')]=qs['filters'](_[_0x1430('0x34')](_0x453e76[_0x1430('0x2b')],_0x3143d9['filters']),_0x531ed5);if(_0x453e76[_0x1430('0x2b')][_0x1430('0x35')]){_0x148156[_0x1430('0x33')]=_['merge'](_0x148156['where'],{'$or':_[_0x1430('0x36')](_0x531ed5,function(_0x2b3020){if(_0x2b3020[_0x1430('0x28')]!==_0x1430('0x37')){var _0x139562={};_0x139562[_0x2b3020[_0x1430('0x24')]]={'$like':'%'+_0x453e76[_0x1430('0x2b')]['filter']+'%'};return _0x139562;}})});}_0x148156=_[_0x1430('0x38')]({},_0x148156,_0x453e76['options']);var _0x1b05cb={'where':_0x148156[_0x1430('0x33')]};return db[_0x1430('0x39')][_0x1430('0x1a')](_0x1b05cb)[_0x1430('0x22')](function(_0x17411a){_0x456ee5['count']=_0x17411a;if(_0x453e76[_0x1430('0x2b')][_0x1430('0x3a')]){_0x148156[_0x1430('0x3b')]=[{'all':!![]}];}return db[_0x1430('0x39')]['findAll'](_0x148156);})[_0x1430('0x22')](function(_0x7ce74f){_0x456ee5[_0x1430('0x3c')]=_0x7ce74f;return _0x456ee5;})[_0x1430('0x22')](respondWithFilteredResult(_0x19c2b3,_0x148156))[_0x1430('0x3d')](handleError(_0x19c2b3,null));};exports[_0x1430('0x3e')]=function(_0x36251d,_0x576cc5){var _0xf85858={'raw':!![],'where':{'id':_0x36251d['params']['id']}},_0x506db4={};_0x506db4['model']=_[_0x1430('0x2c')](db[_0x1430('0x39')][_0x1430('0x27')]);_0x506db4[_0x1430('0x2b')]=_[_0x1430('0x2c')](_0x36251d[_0x1430('0x2b')]);_0x506db4['filters']=_['intersection'](_0x506db4[_0x1430('0x2a')],_0x506db4[_0x1430('0x2b')]);_0xf85858[_0x1430('0x30')]=_[_0x1430('0x2e')](_0x506db4[_0x1430('0x2a')],qs[_0x1430('0x2f')](_0x36251d[_0x1430('0x2b')][_0x1430('0x2f')]));_0xf85858[_0x1430('0x30')]=_0xf85858[_0x1430('0x30')][_0x1430('0x3f')]?_0xf85858['attributes']:_0x506db4[_0x1430('0x2a')];if(_0x36251d['query'][_0x1430('0x3a')]){_0xf85858[_0x1430('0x3b')]=[{'all':!![]}];}_0xf85858=_[_0x1430('0x38')]({},_0xf85858,_0x36251d[_0x1430('0x40')]);return db['MailSubstatus'][_0x1430('0x41')](_0xf85858)[_0x1430('0x22')](handleEntityNotFound(_0x576cc5,null))[_0x1430('0x22')](respondWithResult(_0x576cc5,null))[_0x1430('0x3d')](handleError(_0x576cc5,null));};exports[_0x1430('0x42')]=function(_0x578210,_0xb9ae50){return db['MailSubstatus'][_0x1430('0x42')](_0x578210[_0x1430('0x43')],{})['then'](respondWithResult(_0xb9ae50,0xc9))[_0x1430('0x3d')](handleError(_0xb9ae50,null));};exports['update']=function(_0x1b64f6,_0x4f09a6){if(_0x1b64f6[_0x1430('0x43')]['id']){delete _0x1b64f6['body']['id'];}return db[_0x1430('0x39')][_0x1430('0x41')]({'where':{'id':_0x1b64f6[_0x1430('0x44')]['id']}})[_0x1430('0x22')](handleEntityNotFound(_0x4f09a6,null))[_0x1430('0x22')](saveUpdates(_0x1b64f6[_0x1430('0x43')],null))[_0x1430('0x22')](respondWithResult(_0x4f09a6,null))['catch'](handleError(_0x4f09a6,null));};exports[_0x1430('0x45')]=function(_0x37e26f,_0x2a4033){return db[_0x1430('0x39')][_0x1430('0x41')]({'where':{'id':_0x37e26f['params']['id']}})['then'](handleEntityNotFound(_0x2a4033,null))[_0x1430('0x22')](removeEntity(_0x2a4033,null))['catch'](handleError(_0x2a4033,null));};exports[_0x1430('0x46')]=function(_0x1ba7cb,_0x2613f0){return db[_0x1430('0x39')][_0x1430('0x46')]()['then'](respondWithResult(_0x2613f0,null))['catch'](handleError(_0x2613f0,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 928ffb3..b3b932b 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 _0x253d=['exports','define','MailSubstatus','lodash','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2aec52,_0x59d962){var _0x3b8835=function(_0x3e2604){while(--_0x3e2604){_0x2aec52['push'](_0x2aec52['shift']());}};_0x3b8835(++_0x59d962);}(_0x253d,0x1b3));var _0xd253=function(_0x3a4949,_0x3dffa6){_0x3a4949=_0x3a4949-0x0;var _0xcdadf=_0x253d[_0x3a4949];return _0xcdadf;};'use strict';var _=require(_0xd253('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xd253('0x1'));var rp=require(_0xd253('0x2'));var fs=require('fs');var path=require(_0xd253('0x3'));var rimraf=require(_0xd253('0x4'));var config=require(_0xd253('0x5'));var attributes=require('./mailSubstatus.attributes');module[_0xd253('0x6')]=function(_0x42d36c,_0x3dca3d){return _0x42d36c[_0xd253('0x7')](_0xd253('0x8'),attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcefd=['moment','bluebird','request-promise','rimraf','../../config/environment','./mailSubstatus.attributes','define','MailSubstatus','lodash','util','../../config/logger'];(function(_0xa807d1,_0x4c18b2){var _0x13e4a7=function(_0x5d16d7){while(--_0x5d16d7){_0xa807d1['push'](_0xa807d1['shift']());}};_0x13e4a7(++_0x4c18b2);}(_0xcefd,0x126));var _0xdcef=function(_0x2f07c1,_0x54af34){_0x2f07c1=_0x2f07c1-0x0;var _0x55cdf2=_0xcefd[_0x2f07c1];return _0x55cdf2;};'use strict';var _=require(_0xdcef('0x0'));var util=require(_0xdcef('0x1'));var logger=require(_0xdcef('0x2'))('api');var moment=require(_0xdcef('0x3'));var BPromise=require(_0xdcef('0x4'));var rp=require(_0xdcef('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdcef('0x6'));var config=require(_0xdcef('0x7'));var attributes=require(_0xdcef('0x8'));module['exports']=function(_0x2043a4,_0xcaa40a){return _0x2043a4[_0xdcef('0x9')](_0xdcef('0xa'),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 c1a3e15..dce2f23 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 _0x0713=['MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x245414,_0x2915dc){var _0x14c2a5=function(_0x204928){while(--_0x204928){_0x245414['push'](_0x245414['shift']());}};_0x14c2a5(++_0x2915dc);}(_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')]('MailSubstatus,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec['error'][_0x3071('0x15')]);return _0x3e9a5e(_0x4a36ec['error'][_0x3071('0x15')]);}logger[_0x3071('0x13')]('MailSubstatus,\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')]('MailSubstatus,\x20%s,\x20%s',_0x2f1e87,_0x21aad3);_0x3e9a5e(_0x21aad3);});});} \ No newline at end of file +var _0xa75b=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x15ed63,_0x21e098){var _0x35760d=function(_0x144569){while(--_0x144569){_0x15ed63['push'](_0x15ed63['shift']());}};_0x35760d(++_0x21e098);}(_0xa75b,0x170));var _0xba75=function(_0x2d57c1,_0x4b6773){_0x2d57c1=_0x2d57c1-0x0;var _0x196e57=_0xa75b[_0x2d57c1];return _0x196e57;};'use strict';var _=require(_0xba75('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xba75('0x1'));var rs=require(_0xba75('0x2'));var fs=require('fs');var Redis=require(_0xba75('0x3'));var db=require(_0xba75('0x4'))['db'];var utils=require(_0xba75('0x5'));var logger=require(_0xba75('0x6'))(_0xba75('0x7'));var config=require(_0xba75('0x8'));var jayson=require(_0xba75('0x9'));var client=jayson[_0xba75('0xa')][_0xba75('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x238a33,_0x3ccab5,_0x5c79e3){return new BPromise(function(_0x4b842d,_0x731cae){return client['request'](_0x238a33,_0x5c79e3)['then'](function(_0x218dbd){logger['info'](_0xba75('0xc'),_0x3ccab5,_0xba75('0xd'));logger[_0xba75('0xe')](_0xba75('0xf'),_0x3ccab5,_0xba75('0xd'),JSON[_0xba75('0x10')](_0x218dbd));if(_0x218dbd[_0xba75('0x11')]){if(_0x218dbd[_0xba75('0x11')][_0xba75('0x12')]===0x1f4){logger[_0xba75('0x11')](_0xba75('0xc'),_0x3ccab5,_0x218dbd[_0xba75('0x11')]['message']);return _0x731cae(_0x218dbd['error'][_0xba75('0x13')]);}logger['error'](_0xba75('0xc'),_0x3ccab5,_0x218dbd[_0xba75('0x11')][_0xba75('0x13')]);return _0x4b842d(_0x218dbd[_0xba75('0x11')]['message']);}else{logger[_0xba75('0x14')](_0xba75('0xc'),_0x3ccab5,_0xba75('0xd'));_0x4b842d(_0x218dbd[_0xba75('0x15')][_0xba75('0x13')]);}})['catch'](function(_0x350a9d){logger[_0xba75('0x11')](_0xba75('0xc'),_0x3ccab5,_0x350a9d);_0x731cae(_0x350a9d);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 8083933..2e08274 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 _0x560e=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update','delete','destroy','exports','multer'];(function(_0x4f8b6a,_0x2ead69){var _0x192d31=function(_0x43058f){while(--_0x43058f){_0x4f8b6a['push'](_0x4f8b6a['shift']());}};_0x192d31(++_0x2ead69);}(_0x560e,0xdb));var _0xe560=function(_0x15bbdd,_0x2ffbcb){_0x15bbdd=_0x15bbdd-0x0;var _0x3fff9c=_0x560e[_0x15bbdd];return _0x3fff9c;};'use strict';var multer=require(_0xe560('0x0'));var util=require('util');var path=require(_0xe560('0x1'));var timeout=require(_0xe560('0x2'));var express=require(_0xe560('0x3'));var router=express[_0xe560('0x4')]();var auth=require(_0xe560('0x5'));var interaction=require(_0xe560('0x6'));var config=require(_0xe560('0x7'));var controller=require(_0xe560('0x8'));router[_0xe560('0x9')]('/',auth[_0xe560('0xa')](),controller[_0xe560('0xb')]);router[_0xe560('0x9')](_0xe560('0xc'),auth[_0xe560('0xa')](),controller[_0xe560('0xd')]);router['get'](_0xe560('0xe'),auth[_0xe560('0xa')](),controller[_0xe560('0xf')]);router[_0xe560('0x10')]('/',auth['isAuthenticated'](),controller[_0xe560('0x11')]);router['put'](_0xe560('0xe'),auth[_0xe560('0xa')](),controller[_0xe560('0x12')]);router[_0xe560('0x13')](_0xe560('0xe'),auth['isAuthenticated'](),controller[_0xe560('0x14')]);module[_0xe560('0x15')]=router; \ No newline at end of file +var _0x1812=['../../components/interaction/service','../../config/environment','./mailTransferReport.controller','get','index','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','multer','path','connect-timeout','express','Router'];(function(_0x3a1244,_0x45f479){var _0x366e2f=function(_0x4d2b8c){while(--_0x4d2b8c){_0x3a1244['push'](_0x3a1244['shift']());}};_0x366e2f(++_0x45f479);}(_0x1812,0xcc));var _0x2181=function(_0x4216f0,_0x54f855){_0x4216f0=_0x4216f0-0x0;var _0x3415ea=_0x1812[_0x4216f0];return _0x3415ea;};'use strict';var multer=require(_0x2181('0x0'));var util=require('util');var path=require(_0x2181('0x1'));var timeout=require(_0x2181('0x2'));var express=require(_0x2181('0x3'));var router=express[_0x2181('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x2181('0x5'));var config=require(_0x2181('0x6'));var controller=require(_0x2181('0x7'));router[_0x2181('0x8')]('/',auth['isAuthenticated'](),controller[_0x2181('0x9')]);router['get']('/describe',auth[_0x2181('0xa')](),controller['describe']);router[_0x2181('0x8')](_0x2181('0xb'),auth[_0x2181('0xa')](),controller[_0x2181('0xc')]);router[_0x2181('0xd')]('/',auth['isAuthenticated'](),controller[_0x2181('0xe')]);router[_0x2181('0xf')](_0x2181('0xb'),auth[_0x2181('0xa')](),controller[_0x2181('0x10')]);router[_0x2181('0x11')](_0x2181('0xb'),auth[_0x2181('0xa')](),controller[_0x2181('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index 1a18184..b83887b 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 _0x71d7=['ENUM','account','queue','DATE','moment','STRING'];(function(_0x5661e6,_0x5cd714){var _0x3d456d=function(_0x409291){while(--_0x409291){_0x5661e6['push'](_0x5661e6['shift']());}};_0x3d456d(++_0x5cd714);}(_0x71d7,0x148));var _0x771d=function(_0x1ece97,_0x1b135d){_0x1ece97=_0x1ece97-0x0;var _0x4e4b91=_0x71d7[_0x1ece97];return _0x4e4b91;};'use strict';var moment=require(_0x771d('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x771d('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x771d('0x2')](_0x771d('0x3'),'agent',_0x771d('0x4')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0x771d('0x5')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0x8b7f=['account','queue','DATE','moment','sequelize'];(function(_0x30c6d3,_0x1e333f){var _0x438355=function(_0x4c3383){while(--_0x4c3383){_0x30c6d3['push'](_0x30c6d3['shift']());}};_0x438355(++_0x1e333f);}(_0x8b7f,0x184));var _0xf8b7=function(_0x2ae1e2,_0x12d582){_0x2ae1e2=_0x2ae1e2-0x0;var _0x41dbc3=_0x8b7f[_0x2ae1e2];return _0x41dbc3;};'use strict';var moment=require(_0xf8b7('0x0'));var Sequelize=require(_0xf8b7('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xf8b7('0x2'),'agent',_0xf8b7('0x3')),'allowNull':![],'defaultValue':_0xf8b7('0x3')},'transferredAt':{'type':Sequelize[_0xf8b7('0x4')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 67b6600..6b50443 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 _0x315b=['sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','end','status','count','offset','limit','set','Content-Range','apply','reject','save','destroy','then','error','stack','name','send','index','map','MailTransferReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','find','update','body','params','describe','eml-format','rimraf','zip-dir','moment','mustache','util'];(function(_0x1c0781,_0x4a19f1){var _0x1f577e=function(_0x396577){while(--_0x396577){_0x1c0781['push'](_0x1c0781['shift']());}};_0x1f577e(++_0x4a19f1);}(_0x315b,0x88));var _0xb315=function(_0x160eb5,_0x191ca9){_0x160eb5=_0x160eb5-0x0;var _0x33d9f5=_0x315b[_0x160eb5];return _0x33d9f5;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb315('0x0'));var rimraf=require(_0xb315('0x1'));var zipdir=require(_0xb315('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xb315('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xb315('0x4'));var util=require(_0xb315('0x5'));var path=require('path');var sox=require(_0xb315('0x6'));var csv=require(_0xb315('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xb315('0x8'));var squel=require(_0xb315('0x9'));var crypto=require(_0xb315('0xa'));var jsforce=require(_0xb315('0xb'));var deskjs=require(_0xb315('0xc'));var toCsv=require(_0xb315('0x7'));var querystring=require(_0xb315('0xd'));var Papa=require('papaparse');var Redis=require(_0xb315('0xe'));var authService=require(_0xb315('0xf'));var qs=require(_0xb315('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb315('0x11'));var logger=require(_0xb315('0x12'))('api');var utils=require(_0xb315('0x13'));var config=require('../../config/environment');var db=require(_0xb315('0x14'))['db'];function respondWithStatusCode(_0x446585,_0x4cd375){_0x4cd375=_0x4cd375||0xcc;return function(_0x413ed7){if(_0x413ed7){return _0x446585[_0xb315('0x15')](_0x4cd375);}return _0x446585['status'](_0x4cd375)[_0xb315('0x16')]();};}function respondWithResult(_0x42fc30,_0x1a09a1){_0x1a09a1=_0x1a09a1||0xc8;return function(_0x1b1abb){if(_0x1b1abb){return _0x42fc30[_0xb315('0x17')](_0x1a09a1)['json'](_0x1b1abb);}};}function respondWithFilteredResult(_0x3716c0,_0xaa8789){return function(_0x2c15eb){if(_0x2c15eb){var _0x288d7d=_0x2c15eb[_0xb315('0x18')],_0x37ca92=_0xaa8789[_0xb315('0x19')],_0x467343=_0xaa8789['offset']+_0xaa8789[_0xb315('0x1a')],_0x5145b6;if(_0x467343>=_0x288d7d){_0x467343=_0x288d7d;_0x5145b6=0xc8;}else{_0x5145b6=0xce;}_0x3716c0[_0xb315('0x17')](_0x5145b6);return _0x3716c0[_0xb315('0x1b')](_0xb315('0x1c'),_0x37ca92+'-'+_0x467343+'/'+_0x288d7d)['json'](_0x2c15eb);}return null;};}function patchUpdates(_0x4aa69f){return function(_0x4b2e00){try{jsonpatch[_0xb315('0x1d')](_0x4b2e00,_0x4aa69f,!![]);}catch(_0x43af9e){return BPromise[_0xb315('0x1e')](_0x43af9e);}return _0x4b2e00[_0xb315('0x1f')]();};}function saveUpdates(_0x36a6e4,_0x24d048){return function(_0x16246a){if(_0x16246a){return _0x16246a['update'](_0x36a6e4)['then'](function(_0x42a984){return _0x42a984;});}return null;};}function removeEntity(_0x20b50b,_0x1496d6){return function(_0x59045b){if(_0x59045b){return _0x59045b[_0xb315('0x20')]()[_0xb315('0x21')](function(){_0x20b50b[_0xb315('0x17')](0xcc)[_0xb315('0x16')]();});}};}function handleEntityNotFound(_0x27260b,_0x545656){return function(_0x1d8039){if(!_0x1d8039){_0x27260b['sendStatus'](0x194);}return _0x1d8039;};}function handleError(_0x1bd635,_0x5ecf88){_0x5ecf88=_0x5ecf88||0x1f4;return function(_0x55fe25){logger[_0xb315('0x22')](_0x55fe25[_0xb315('0x23')]);if(_0x55fe25[_0xb315('0x24')]){delete _0x55fe25[_0xb315('0x24')];}_0x1bd635['status'](_0x5ecf88)[_0xb315('0x25')](_0x55fe25);};}exports[_0xb315('0x26')]=function(_0x2bfc43,_0x1d4f10){var _0x255b48={},_0x292e03={},_0x455be5={'count':0x0,'rows':[]};var _0x48b5d3=_[_0xb315('0x27')](db[_0xb315('0x28')][_0xb315('0x29')],function(_0x5db011){return{'name':_0x5db011[_0xb315('0x2a')],'type':_0x5db011[_0xb315('0x2b')][_0xb315('0x2c')]};});_0x292e03['model']=_['map'](_0x48b5d3,_0xb315('0x24'));_0x292e03[_0xb315('0x2d')]=_[_0xb315('0x2e')](_0x2bfc43['query']);_0x292e03[_0xb315('0x2f')]=_[_0xb315('0x30')](_0x292e03[_0xb315('0x31')],_0x292e03[_0xb315('0x2d')]);_0x255b48[_0xb315('0x32')]=_[_0xb315('0x30')](_0x292e03[_0xb315('0x31')],qs[_0xb315('0x33')](_0x2bfc43[_0xb315('0x2d')][_0xb315('0x33')]));_0x255b48[_0xb315('0x32')]=_0x255b48['attributes'][_0xb315('0x34')]?_0x255b48[_0xb315('0x32')]:_0x292e03[_0xb315('0x31')];if(!_0x2bfc43[_0xb315('0x2d')][_0xb315('0x35')]('nolimit')){_0x255b48['limit']=qs[_0xb315('0x1a')](_0x2bfc43['query'][_0xb315('0x1a')]);_0x255b48[_0xb315('0x19')]=qs['offset'](_0x2bfc43[_0xb315('0x2d')][_0xb315('0x19')]);}_0x255b48['order']=qs[_0xb315('0x36')](_0x2bfc43['query']['sort']);_0x255b48[_0xb315('0x37')]=qs[_0xb315('0x2f')](_[_0xb315('0x38')](_0x2bfc43[_0xb315('0x2d')],_0x292e03[_0xb315('0x2f')]),_0x48b5d3);if(_0x2bfc43[_0xb315('0x2d')][_0xb315('0x39')]){_0x255b48[_0xb315('0x37')]=_['merge'](_0x255b48[_0xb315('0x37')],{'$or':_[_0xb315('0x27')](_0x48b5d3,function(_0x4f4732){if(_0x4f4732[_0xb315('0x2b')]!==_0xb315('0x3a')){var _0x487823={};_0x487823[_0x4f4732[_0xb315('0x24')]]={'$like':'%'+_0x2bfc43[_0xb315('0x2d')]['filter']+'%'};return _0x487823;}})});}_0x255b48=_[_0xb315('0x3b')]({},_0x255b48,_0x2bfc43['options']);var _0x2a67fe={'where':_0x255b48['where']};return db['MailTransferReport'][_0xb315('0x18')](_0x2a67fe)[_0xb315('0x21')](function(_0x307989){_0x455be5['count']=_0x307989;if(_0x2bfc43['query'][_0xb315('0x3c')]){_0x255b48[_0xb315('0x3d')]=[{'all':!![]}];}return db[_0xb315('0x28')][_0xb315('0x3e')](_0x255b48);})[_0xb315('0x21')](function(_0x1c30b2){_0x455be5[_0xb315('0x3f')]=_0x1c30b2;return _0x455be5;})[_0xb315('0x21')](respondWithFilteredResult(_0x1d4f10,_0x255b48))[_0xb315('0x40')](handleError(_0x1d4f10,null));};exports[_0xb315('0x41')]=function(_0x317b25,_0xc9866a){var _0x208252={'raw':!![],'where':{'id':_0x317b25['params']['id']}},_0x331055={};_0x331055[_0xb315('0x31')]=_['keys'](db[_0xb315('0x28')]['rawAttributes']);_0x331055[_0xb315('0x2d')]=_[_0xb315('0x2e')](_0x317b25['query']);_0x331055[_0xb315('0x2f')]=_[_0xb315('0x30')](_0x331055[_0xb315('0x31')],_0x331055['query']);_0x208252[_0xb315('0x32')]=_[_0xb315('0x30')](_0x331055[_0xb315('0x31')],qs[_0xb315('0x33')](_0x317b25[_0xb315('0x2d')][_0xb315('0x33')]));_0x208252['attributes']=_0x208252['attributes'][_0xb315('0x34')]?_0x208252[_0xb315('0x32')]:_0x331055['model'];if(_0x317b25[_0xb315('0x2d')]['includeAll']){_0x208252[_0xb315('0x3d')]=[{'all':!![]}];}_0x208252=_['merge']({},_0x208252,_0x317b25['options']);return db[_0xb315('0x28')][_0xb315('0x42')](_0x208252)[_0xb315('0x21')](handleEntityNotFound(_0xc9866a,null))[_0xb315('0x21')](respondWithResult(_0xc9866a,null))['catch'](handleError(_0xc9866a,null));};exports['create']=function(_0x4d896d,_0x5800ba){return db[_0xb315('0x28')]['create'](_0x4d896d['body'],{})['then'](respondWithResult(_0x5800ba,0xc9))[_0xb315('0x40')](handleError(_0x5800ba,null));};exports[_0xb315('0x43')]=function(_0x1a41e3,_0x3825bd){if(_0x1a41e3[_0xb315('0x44')]['id']){delete _0x1a41e3[_0xb315('0x44')]['id'];}return db[_0xb315('0x28')][_0xb315('0x42')]({'where':{'id':_0x1a41e3[_0xb315('0x45')]['id']}})[_0xb315('0x21')](handleEntityNotFound(_0x3825bd,null))['then'](saveUpdates(_0x1a41e3[_0xb315('0x44')],null))[_0xb315('0x21')](respondWithResult(_0x3825bd,null))['catch'](handleError(_0x3825bd,null));};exports[_0xb315('0x20')]=function(_0x16c44f,_0x2337e7){return db['MailTransferReport'][_0xb315('0x42')]({'where':{'id':_0x16c44f[_0xb315('0x45')]['id']}})['then'](handleEntityNotFound(_0x2337e7,null))[_0xb315('0x21')](removeEntity(_0x2337e7,null))[_0xb315('0x40')](handleError(_0x2337e7,null));};exports[_0xb315('0x46')]=function(_0x31214b,_0xad6b5b){return db['MailTransferReport'][_0xb315('0x46')]()[_0xb315('0x21')](respondWithResult(_0xad6b5b,null))[_0xb315('0x40')](handleError(_0xad6b5b,null));}; \ No newline at end of file +var _0xaf5d=['merge','VIRTUAL','includeAll','findAll','rows','catch','show','params','include','create','body','find','describe','eml-format','fast-json-patch','request-promise','moment','mustache','util','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','limit','set','reject','save','update','destroy','then','end','error','stack','name','send','index','map','MailTransferReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','offset','order','sort','where','pick','filter'];(function(_0x51b2f7,_0x303ad2){var _0x556d95=function(_0x43bbdb){while(--_0x43bbdb){_0x51b2f7['push'](_0x51b2f7['shift']());}};_0x556d95(++_0x303ad2);}(_0xaf5d,0x16b));var _0xdaf5=function(_0x5263c5,_0x542d32){_0x5263c5=_0x5263c5-0x0;var _0x200ac6=_0xaf5d[_0x5263c5];return _0x200ac6;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xdaf5('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xdaf5('0x1'));var rp=require(_0xdaf5('0x2'));var moment=require(_0xdaf5('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xdaf5('0x4'));var util=require(_0xdaf5('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xdaf5('0x6'));var ejs=require(_0xdaf5('0x7'));var fs=require('fs');var _=require(_0xdaf5('0x8'));var squel=require('squel');var crypto=require(_0xdaf5('0x9'));var jsforce=require(_0xdaf5('0xa'));var deskjs=require(_0xdaf5('0xb'));var toCsv=require(_0xdaf5('0x6'));var querystring=require(_0xdaf5('0xc'));var Papa=require('papaparse');var Redis=require(_0xdaf5('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xdaf5('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xdaf5('0xf'));var utils=require(_0xdaf5('0x10'));var config=require(_0xdaf5('0x11'));var db=require(_0xdaf5('0x12'))['db'];function respondWithStatusCode(_0x11ba33,_0x170f34){_0x170f34=_0x170f34||0xcc;return function(_0x571d7a){if(_0x571d7a){return _0x11ba33[_0xdaf5('0x13')](_0x170f34);}return _0x11ba33[_0xdaf5('0x14')](_0x170f34)['end']();};}function respondWithResult(_0x326ce0,_0x298c66){_0x298c66=_0x298c66||0xc8;return function(_0x4765b9){if(_0x4765b9){return _0x326ce0[_0xdaf5('0x14')](_0x298c66)[_0xdaf5('0x15')](_0x4765b9);}};}function respondWithFilteredResult(_0x13484d,_0x152345){return function(_0x237c41){if(_0x237c41){var _0x2c7bd8=_0x237c41[_0xdaf5('0x16')],_0x1a34cd=_0x152345['offset'],_0x4467c2=_0x152345['offset']+_0x152345[_0xdaf5('0x17')],_0x177638;if(_0x4467c2>=_0x2c7bd8){_0x4467c2=_0x2c7bd8;_0x177638=0xc8;}else{_0x177638=0xce;}_0x13484d[_0xdaf5('0x14')](_0x177638);return _0x13484d[_0xdaf5('0x18')]('Content-Range',_0x1a34cd+'-'+_0x4467c2+'/'+_0x2c7bd8)[_0xdaf5('0x15')](_0x237c41);}return null;};}function patchUpdates(_0xc144b0){return function(_0x223000){try{jsonpatch['apply'](_0x223000,_0xc144b0,!![]);}catch(_0x40d3c3){return BPromise[_0xdaf5('0x19')](_0x40d3c3);}return _0x223000[_0xdaf5('0x1a')]();};}function saveUpdates(_0x115e43,_0x4f1198){return function(_0x161df1){if(_0x161df1){return _0x161df1[_0xdaf5('0x1b')](_0x115e43)['then'](function(_0x5e872e){return _0x5e872e;});}return null;};}function removeEntity(_0x299abb,_0xbdde2){return function(_0x4b5fed){if(_0x4b5fed){return _0x4b5fed[_0xdaf5('0x1c')]()[_0xdaf5('0x1d')](function(){_0x299abb[_0xdaf5('0x14')](0xcc)[_0xdaf5('0x1e')]();});}};}function handleEntityNotFound(_0x20a718,_0x5cf4c0){return function(_0x3802d3){if(!_0x3802d3){_0x20a718['sendStatus'](0x194);}return _0x3802d3;};}function handleError(_0x28bb28,_0x2279f2){_0x2279f2=_0x2279f2||0x1f4;return function(_0x3a201a){logger[_0xdaf5('0x1f')](_0x3a201a[_0xdaf5('0x20')]);if(_0x3a201a[_0xdaf5('0x21')]){delete _0x3a201a[_0xdaf5('0x21')];}_0x28bb28[_0xdaf5('0x14')](_0x2279f2)[_0xdaf5('0x22')](_0x3a201a);};}exports[_0xdaf5('0x23')]=function(_0x24f451,_0x13b264){var _0xc31657={},_0x481963={},_0x441afa={'count':0x0,'rows':[]};var _0x5e5316=_[_0xdaf5('0x24')](db[_0xdaf5('0x25')][_0xdaf5('0x26')],function(_0x17a983){return{'name':_0x17a983[_0xdaf5('0x27')],'type':_0x17a983[_0xdaf5('0x28')][_0xdaf5('0x29')]};});_0x481963[_0xdaf5('0x2a')]=_[_0xdaf5('0x24')](_0x5e5316,_0xdaf5('0x21'));_0x481963['query']=_[_0xdaf5('0x2b')](_0x24f451[_0xdaf5('0x2c')]);_0x481963[_0xdaf5('0x2d')]=_[_0xdaf5('0x2e')](_0x481963[_0xdaf5('0x2a')],_0x481963['query']);_0xc31657[_0xdaf5('0x2f')]=_[_0xdaf5('0x2e')](_0x481963[_0xdaf5('0x2a')],qs[_0xdaf5('0x30')](_0x24f451[_0xdaf5('0x2c')][_0xdaf5('0x30')]));_0xc31657[_0xdaf5('0x2f')]=_0xc31657[_0xdaf5('0x2f')][_0xdaf5('0x31')]?_0xc31657[_0xdaf5('0x2f')]:_0x481963[_0xdaf5('0x2a')];if(!_0x24f451[_0xdaf5('0x2c')][_0xdaf5('0x32')]('nolimit')){_0xc31657[_0xdaf5('0x17')]=qs['limit'](_0x24f451[_0xdaf5('0x2c')][_0xdaf5('0x17')]);_0xc31657[_0xdaf5('0x33')]=qs['offset'](_0x24f451['query']['offset']);}_0xc31657[_0xdaf5('0x34')]=qs[_0xdaf5('0x35')](_0x24f451['query'][_0xdaf5('0x35')]);_0xc31657[_0xdaf5('0x36')]=qs['filters'](_[_0xdaf5('0x37')](_0x24f451[_0xdaf5('0x2c')],_0x481963[_0xdaf5('0x2d')]),_0x5e5316);if(_0x24f451[_0xdaf5('0x2c')][_0xdaf5('0x38')]){_0xc31657[_0xdaf5('0x36')]=_[_0xdaf5('0x39')](_0xc31657[_0xdaf5('0x36')],{'$or':_[_0xdaf5('0x24')](_0x5e5316,function(_0x1fd209){if(_0x1fd209[_0xdaf5('0x28')]!==_0xdaf5('0x3a')){var _0x42e2ec={};_0x42e2ec[_0x1fd209[_0xdaf5('0x21')]]={'$like':'%'+_0x24f451[_0xdaf5('0x2c')]['filter']+'%'};return _0x42e2ec;}})});}_0xc31657=_['merge']({},_0xc31657,_0x24f451['options']);var _0x3a852b={'where':_0xc31657[_0xdaf5('0x36')]};return db['MailTransferReport'][_0xdaf5('0x16')](_0x3a852b)[_0xdaf5('0x1d')](function(_0x512182){_0x441afa[_0xdaf5('0x16')]=_0x512182;if(_0x24f451[_0xdaf5('0x2c')][_0xdaf5('0x3b')]){_0xc31657['include']=[{'all':!![]}];}return db['MailTransferReport'][_0xdaf5('0x3c')](_0xc31657);})[_0xdaf5('0x1d')](function(_0x48166c){_0x441afa[_0xdaf5('0x3d')]=_0x48166c;return _0x441afa;})['then'](respondWithFilteredResult(_0x13b264,_0xc31657))[_0xdaf5('0x3e')](handleError(_0x13b264,null));};exports[_0xdaf5('0x3f')]=function(_0x326e51,_0x191473){var _0x45953a={'raw':!![],'where':{'id':_0x326e51[_0xdaf5('0x40')]['id']}},_0x34b1b4={};_0x34b1b4[_0xdaf5('0x2a')]=_['keys'](db[_0xdaf5('0x25')][_0xdaf5('0x26')]);_0x34b1b4[_0xdaf5('0x2c')]=_[_0xdaf5('0x2b')](_0x326e51[_0xdaf5('0x2c')]);_0x34b1b4['filters']=_[_0xdaf5('0x2e')](_0x34b1b4[_0xdaf5('0x2a')],_0x34b1b4[_0xdaf5('0x2c')]);_0x45953a[_0xdaf5('0x2f')]=_[_0xdaf5('0x2e')](_0x34b1b4[_0xdaf5('0x2a')],qs[_0xdaf5('0x30')](_0x326e51['query'][_0xdaf5('0x30')]));_0x45953a[_0xdaf5('0x2f')]=_0x45953a['attributes']['length']?_0x45953a[_0xdaf5('0x2f')]:_0x34b1b4[_0xdaf5('0x2a')];if(_0x326e51[_0xdaf5('0x2c')]['includeAll']){_0x45953a[_0xdaf5('0x41')]=[{'all':!![]}];}_0x45953a=_[_0xdaf5('0x39')]({},_0x45953a,_0x326e51['options']);return db[_0xdaf5('0x25')]['find'](_0x45953a)[_0xdaf5('0x1d')](handleEntityNotFound(_0x191473,null))[_0xdaf5('0x1d')](respondWithResult(_0x191473,null))[_0xdaf5('0x3e')](handleError(_0x191473,null));};exports[_0xdaf5('0x42')]=function(_0x1b972d,_0x5060da){return db[_0xdaf5('0x25')][_0xdaf5('0x42')](_0x1b972d[_0xdaf5('0x43')],{})[_0xdaf5('0x1d')](respondWithResult(_0x5060da,0xc9))[_0xdaf5('0x3e')](handleError(_0x5060da,null));};exports['update']=function(_0x1d199d,_0x4445ec){if(_0x1d199d['body']['id']){delete _0x1d199d[_0xdaf5('0x43')]['id'];}return db[_0xdaf5('0x25')][_0xdaf5('0x44')]({'where':{'id':_0x1d199d[_0xdaf5('0x40')]['id']}})[_0xdaf5('0x1d')](handleEntityNotFound(_0x4445ec,null))[_0xdaf5('0x1d')](saveUpdates(_0x1d199d[_0xdaf5('0x43')],null))[_0xdaf5('0x1d')](respondWithResult(_0x4445ec,null))[_0xdaf5('0x3e')](handleError(_0x4445ec,null));};exports[_0xdaf5('0x1c')]=function(_0xf6af07,_0x4d4ef2){return db[_0xdaf5('0x25')][_0xdaf5('0x44')]({'where':{'id':_0xf6af07[_0xdaf5('0x40')]['id']}})[_0xdaf5('0x1d')](handleEntityNotFound(_0x4d4ef2,null))[_0xdaf5('0x1d')](removeEntity(_0x4d4ef2,null))[_0xdaf5('0x3e')](handleError(_0x4d4ef2,null));};exports['describe']=function(_0x1037ff,_0x3a89bd){return db[_0xdaf5('0x25')][_0xdaf5('0x45')]()[_0xdaf5('0x1d')](respondWithResult(_0x3a89bd,null))[_0xdaf5('0x3e')](handleError(_0x3a89bd,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 9a4b0fb..bc6e34d 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 _0x321b=['MailTransferReport','report_mail_transfer','uniqueid','lodash','util','../../config/logger','api','bluebird','path','rimraf','./mailTransferReport.attributes','exports','define'];(function(_0x241422,_0x309162){var _0x3cd5d1=function(_0x3dbd59){while(--_0x3dbd59){_0x241422['push'](_0x241422['shift']());}};_0x3cd5d1(++_0x309162);}(_0x321b,0x6b));var _0xb321=function(_0xafb198,_0xc62598){_0xafb198=_0xafb198-0x0;var _0x1d5a7f=_0x321b[_0xafb198];return _0x1d5a7f;};'use strict';var _=require(_0xb321('0x0'));var util=require(_0xb321('0x1'));var logger=require(_0xb321('0x2'))(_0xb321('0x3'));var moment=require('moment');var BPromise=require(_0xb321('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb321('0x5'));var rimraf=require(_0xb321('0x6'));var config=require('../../config/environment');var attributes=require(_0xb321('0x7'));module[_0xb321('0x8')]=function(_0x37f407,_0x209679){return _0x37f407[_0xb321('0x9')](_0xb321('0xa'),attributes,{'tableName':_0xb321('0xb'),'paranoid':![],'indexes':[{'name':_0xb321('0xc'),'fields':[_0xb321('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd2ad=['exports','MailTransferReport','uniqueid','lodash','util','../../config/logger','api','moment','../../config/environment','./mailTransferReport.attributes'];(function(_0x37980a,_0x3425e7){var _0x4f9131=function(_0x483246){while(--_0x483246){_0x37980a['push'](_0x37980a['shift']());}};_0x4f9131(++_0x3425e7);}(_0xd2ad,0x1c5));var _0xdd2a=function(_0x5f49c0,_0x27a1b4){_0x5f49c0=_0x5f49c0-0x0;var _0x5ab653=_0xd2ad[_0x5f49c0];return _0x5ab653;};'use strict';var _=require(_0xdd2a('0x0'));var util=require(_0xdd2a('0x1'));var logger=require(_0xdd2a('0x2'))(_0xdd2a('0x3'));var moment=require(_0xdd2a('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xdd2a('0x5'));var attributes=require(_0xdd2a('0x6'));module[_0xdd2a('0x7')]=function(_0xfa7ae7,_0x37d23d){return _0xfa7ae7['define'](_0xdd2a('0x8'),attributes,{'tableName':'report_mail_transfer','paranoid':![],'indexes':[{'name':_0xdd2a('0x9'),'fields':[_0xdd2a('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 9ab0f77..f921451 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 _0x8ba4=['rpc','../../config/environment','jayson/promise','client','http','then','info','MailTransferReport,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x1408d1,_0x17ae0d){var _0x54cb69=function(_0x20db9f){while(--_0x20db9f){_0x1408d1['push'](_0x1408d1['shift']());}};_0x54cb69(++_0x17ae0d);}(_0x8ba4,0x19d));var _0x48ba=function(_0x2ed8f3,_0x4aa12f){_0x2ed8f3=_0x2ed8f3-0x0;var _0x525a55=_0x8ba4[_0x2ed8f3];return _0x525a55;};'use strict';var _=require(_0x48ba('0x0'));var util=require(_0x48ba('0x1'));var moment=require('moment');var BPromise=require(_0x48ba('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x48ba('0x3'));var db=require(_0x48ba('0x4'))['db'];var utils=require(_0x48ba('0x5'));var logger=require(_0x48ba('0x6'))(_0x48ba('0x7'));var config=require(_0x48ba('0x8'));var jayson=require(_0x48ba('0x9'));var client=jayson[_0x48ba('0xa')][_0x48ba('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbfbaff,_0x4e0186,_0x2903ec){return new BPromise(function(_0x14d3b0,_0x51b991){return client['request'](_0xbfbaff,_0x2903ec)[_0x48ba('0xc')](function(_0x155825){logger[_0x48ba('0xd')](_0x48ba('0xe'),_0x4e0186,'request\x20sent');logger[_0x48ba('0xf')]('MailTransferReport,\x20%s,\x20%s,\x20%s',_0x4e0186,_0x48ba('0x10'),JSON['stringify'](_0x155825));if(_0x155825[_0x48ba('0x11')]){if(_0x155825[_0x48ba('0x11')][_0x48ba('0x12')]===0x1f4){logger['error'](_0x48ba('0xe'),_0x4e0186,_0x155825[_0x48ba('0x11')][_0x48ba('0x13')]);return _0x51b991(_0x155825['error'][_0x48ba('0x13')]);}logger['error']('MailTransferReport,\x20%s,\x20%s',_0x4e0186,_0x155825['error']['message']);return _0x14d3b0(_0x155825[_0x48ba('0x11')][_0x48ba('0x13')]);}else{logger[_0x48ba('0xd')](_0x48ba('0xe'),_0x4e0186,_0x48ba('0x10'));_0x14d3b0(_0x155825[_0x48ba('0x14')][_0x48ba('0x13')]);}})['catch'](function(_0x429418){logger[_0x48ba('0x11')](_0x48ba('0xe'),_0x4e0186,_0x429418);_0x51b991(_0x429418);});});} \ No newline at end of file +var _0xc81a=['jayson/promise','request','then','info','MailTransferReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment'];(function(_0x6caf77,_0x2890b9){var _0x22aef6=function(_0xb80c22){while(--_0xb80c22){_0x6caf77['push'](_0x6caf77['shift']());}};_0x22aef6(++_0x2890b9);}(_0xc81a,0x188));var _0xac81=function(_0x4d2d24,_0x5e6915){_0x4d2d24=_0x4d2d24-0x0;var _0x1318a1=_0xc81a[_0x4d2d24];return _0x1318a1;};'use strict';var _=require(_0xac81('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xac81('0x1'));var rs=require(_0xac81('0x2'));var fs=require('fs');var Redis=require(_0xac81('0x3'));var db=require(_0xac81('0x4'))['db'];var utils=require(_0xac81('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xac81('0x6'));var jayson=require(_0xac81('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2547b2,_0x2de276,_0x2994d3){return new BPromise(function(_0x151709,_0x30128e){return client[_0xac81('0x8')](_0x2547b2,_0x2994d3)[_0xac81('0x9')](function(_0x87551d){logger[_0xac81('0xa')](_0xac81('0xb'),_0x2de276,'request\x20sent');logger[_0xac81('0xc')]('MailTransferReport,\x20%s,\x20%s,\x20%s',_0x2de276,_0xac81('0xd'),JSON[_0xac81('0xe')](_0x87551d));if(_0x87551d[_0xac81('0xf')]){if(_0x87551d['error'][_0xac81('0x10')]===0x1f4){logger[_0xac81('0xf')]('MailTransferReport,\x20%s,\x20%s',_0x2de276,_0x87551d['error'][_0xac81('0x11')]);return _0x30128e(_0x87551d[_0xac81('0xf')][_0xac81('0x11')]);}logger[_0xac81('0xf')](_0xac81('0xb'),_0x2de276,_0x87551d[_0xac81('0xf')]['message']);return _0x151709(_0x87551d[_0xac81('0xf')]['message']);}else{logger[_0xac81('0xa')]('MailTransferReport,\x20%s,\x20%s',_0x2de276,_0xac81('0xd'));_0x151709(_0x87551d['result'][_0xac81('0x11')]);}})[_0xac81('0x12')](function(_0x2d6552){logger['error'](_0xac81('0xb'),_0x2de276,_0x2d6552);_0x30128e(_0x2d6552);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 0551ae2..deeb5a6 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 _0x09f3=['update','delete','destroy','exports','path','express','../../components/auth/service','./memberReport.controller','isAuthenticated','index','/describe','describe','get','/:id','show','post','create'];(function(_0x6c0950,_0x3886d3){var _0x421637=function(_0x1ebfc7){while(--_0x1ebfc7){_0x6c0950['push'](_0x6c0950['shift']());}};_0x421637(++_0x3886d3);}(_0x09f3,0x8c));var _0x309f=function(_0x209803,_0x205d7e){_0x209803=_0x209803-0x0;var _0x53ef29=_0x09f3[_0x209803];return _0x53ef29;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x309f('0x0'));var timeout=require('connect-timeout');var express=require(_0x309f('0x1'));var router=express['Router']();var auth=require(_0x309f('0x2'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x309f('0x3'));router['get']('/',auth[_0x309f('0x4')](),controller[_0x309f('0x5')]);router['get'](_0x309f('0x6'),auth[_0x309f('0x4')](),controller[_0x309f('0x7')]);router[_0x309f('0x8')](_0x309f('0x9'),auth[_0x309f('0x4')](),controller[_0x309f('0xa')]);router[_0x309f('0xb')]('/',auth[_0x309f('0x4')](),controller[_0x309f('0xc')]);router['put'](_0x309f('0x9'),auth[_0x309f('0x4')](),controller[_0x309f('0xd')]);router[_0x309f('0xe')](_0x309f('0x9'),auth['isAuthenticated'](),controller[_0x309f('0xf')]);module[_0x309f('0x10')]=router; \ No newline at end of file +var _0x070e=['get','describe','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','index'];(function(_0x503ffd,_0x8ecde){var _0x160437=function(_0x2d45dd){while(--_0x2d45dd){_0x503ffd['push'](_0x503ffd['shift']());}};_0x160437(++_0x8ecde);}(_0x070e,0xc0));var _0xe070=function(_0x2f9e51,_0x3ddd7d){_0x2f9e51=_0x2f9e51-0x0;var _0x5d1db4=_0x070e[_0x2f9e51];return _0x5d1db4;};'use strict';var multer=require(_0xe070('0x0'));var util=require('util');var path=require(_0xe070('0x1'));var timeout=require(_0xe070('0x2'));var express=require(_0xe070('0x3'));var router=express['Router']();var auth=require(_0xe070('0x4'));var interaction=require(_0xe070('0x5'));var config=require(_0xe070('0x6'));var controller=require('./memberReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xe070('0x7')]);router[_0xe070('0x8')]('/describe',auth['isAuthenticated'](),controller[_0xe070('0x9')]);router[_0xe070('0x8')](_0xe070('0xa'),auth[_0xe070('0xb')](),controller[_0xe070('0xc')]);router[_0xe070('0xd')]('/',auth[_0xe070('0xb')](),controller[_0xe070('0xe')]);router[_0xe070('0xf')](_0xe070('0xa'),auth[_0xe070('0xb')](),controller[_0xe070('0x10')]);router[_0xe070('0x11')](_0xe070('0xa'),auth[_0xe070('0xb')](),controller[_0xe070('0x12')]);module[_0xe070('0x13')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index a82827e..d4fcf8d 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 _0x5b23=['DATE','getDataValue','enterAt','seconds','setDataValue','duration','talk:[start]','sequelize','STRING','DEFAULT\x20PAUSE','INTEGER'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0x5b23,0x1eb));var _0x35b2=function(_0x518189,_0x280941){_0x518189=_0x518189-0x0;var _0x14f749=_0x5b23[_0x518189];return _0x14f749;};'use strict';var Sequelize=require(_0x35b2('0x0'));var moment=require('moment');module['exports']={'channel':{'type':Sequelize[_0x35b2('0x1')]},'membername':{'type':Sequelize[_0x35b2('0x1')]},'interface':{'type':Sequelize[_0x35b2('0x1')]},'type':{'type':Sequelize[_0x35b2('0x1')],'defaultValue':_0x35b2('0x2'),'comment':'LOGIN,\x20PAUSE,\x20TALKING'},'duration':{'type':Sequelize[_0x35b2('0x3')]},'enterAt':{'type':Sequelize[_0x35b2('0x4')]},'exitAt':{'type':Sequelize[_0x35b2('0x4')],'set':function(_0x4ce1aa){var _0x202cb8=moment(_0x4ce1aa);var _0x331014=moment(this[_0x35b2('0x5')](_0x35b2('0x6')));var _0x47ec63=_0x202cb8['diff'](_0x331014,_0x35b2('0x7'));this[_0x35b2('0x8')]('exitAt',_0x4ce1aa);this[_0x35b2('0x8')](_0x35b2('0x9'),_0x47ec63||null);}},'data1':{'type':Sequelize[_0x35b2('0x1')],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize[_0x35b2('0x1')],'comment':_0x35b2('0xa')},'data3':{'type':Sequelize['STRING'],'comment':'talk:[destination]'},'data4':{'type':Sequelize[_0x35b2('0x1')],'comment':'talk:[dial\x20string]'},'data5':{'type':Sequelize[_0x35b2('0x1')],'comment':'talk:[queue]'},'role':{'type':Sequelize[_0x35b2('0x1')]},'internal':{'type':Sequelize[_0x35b2('0x3')]},'uniqueid':{'type':Sequelize[_0x35b2('0x1')]}}; \ No newline at end of file +var _0x8be5=['INTEGER','DATE','getDataValue','enterAt','diff','seconds','setDataValue','exitAt','duration','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize','moment','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING'];(function(_0x34ec21,_0x4305c2){var _0x10bfc1=function(_0x34d4ea){while(--_0x34d4ea){_0x34ec21['push'](_0x34ec21['shift']());}};_0x10bfc1(++_0x4305c2);}(_0x8be5,0xc1));var _0x58be=function(_0x2c13eb,_0x1cd398){_0x2c13eb=_0x2c13eb-0x0;var _0xef1886=_0x8be5[_0x2c13eb];return _0xef1886;};'use strict';var Sequelize=require(_0x58be('0x0'));var moment=require(_0x58be('0x1'));module['exports']={'channel':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x58be('0x2')]},'interface':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x58be('0x2')],'defaultValue':_0x58be('0x3'),'comment':_0x58be('0x4')},'duration':{'type':Sequelize[_0x58be('0x5')]},'enterAt':{'type':Sequelize[_0x58be('0x6')]},'exitAt':{'type':Sequelize['DATE'],'set':function(_0xde5bfc){var _0x4cb886=moment(_0xde5bfc);var _0xef60ef=moment(this[_0x58be('0x7')](_0x58be('0x8')));var _0x3f27e3=_0x4cb886[_0x58be('0x9')](_0xef60ef,_0x58be('0xa'));this[_0x58be('0xb')](_0x58be('0xc'),_0xde5bfc);this[_0x58be('0xb')](_0x58be('0xd'),_0x3f27e3||null);}},'data1':{'type':Sequelize[_0x58be('0x2')],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize[_0x58be('0x2')],'comment':_0x58be('0xe')},'data3':{'type':Sequelize['STRING'],'comment':_0x58be('0xf')},'data4':{'type':Sequelize[_0x58be('0x2')],'comment':_0x58be('0x10')},'data5':{'type':Sequelize['STRING'],'comment':_0x58be('0x11')},'role':{'type':Sequelize[_0x58be('0x2')]},'internal':{'type':Sequelize[_0x58be('0x5')]},'uniqueid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 032576e..c645e37 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 _0x1666=['attributes','intersection','fields','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','MemberReport','includeAll','include','findAll','rows','show','params','length','create','body','catch','update','find','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','Content-Range','reject','then','destroy','error','name','send','rawAttributes','fieldName','type','key','model','map','query','keys'];(function(_0x1acc03,_0x1794d6){var _0x51bc63=function(_0x5bbd7a){while(--_0x5bbd7a){_0x1acc03['push'](_0x1acc03['shift']());}};_0x51bc63(++_0x1794d6);}(_0x1666,0x133));var _0x6166=function(_0x1d4db6,_0x4173a9){_0x1d4db6=_0x1d4db6-0x0;var _0xdedcf3=_0x1666[_0x1d4db6];return _0xdedcf3;};'use strict';var pdf=require(_0x6166('0x0'));var emlformat=require(_0x6166('0x1'));var rimraf=require(_0x6166('0x2'));var zipdir=require(_0x6166('0x3'));var jsonpatch=require(_0x6166('0x4'));var rp=require('request-promise');var moment=require(_0x6166('0x5'));var BPromise=require(_0x6166('0x6'));var Mustache=require(_0x6166('0x7'));var util=require(_0x6166('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x6166('0x9'));var ejs=require(_0x6166('0xa'));var fs=require('fs');var _=require(_0x6166('0xb'));var squel=require(_0x6166('0xc'));var crypto=require(_0x6166('0xd'));var jsforce=require(_0x6166('0xe'));var deskjs=require(_0x6166('0xf'));var toCsv=require(_0x6166('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x6166('0x10'));var qs=require(_0x6166('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x6166('0x12'))('api');var utils=require(_0x6166('0x13'));var config=require(_0x6166('0x14'));var db=require(_0x6166('0x15'))['db'];function respondWithStatusCode(_0xb4477b,_0x58e6cd){_0x58e6cd=_0x58e6cd||0xcc;return function(_0x4e4a54){if(_0x4e4a54){return _0xb4477b[_0x6166('0x16')](_0x58e6cd);}return _0xb4477b[_0x6166('0x17')](_0x58e6cd)[_0x6166('0x18')]();};}function respondWithResult(_0x32c3a9,_0x2a489){_0x2a489=_0x2a489||0xc8;return function(_0x1f1e05){if(_0x1f1e05){return _0x32c3a9[_0x6166('0x17')](_0x2a489)['json'](_0x1f1e05);}};}function respondWithFilteredResult(_0x2792c4,_0x17960c){return function(_0x358ed5){if(_0x358ed5){var _0x41ad51=_0x358ed5[_0x6166('0x19')],_0x543b74=_0x17960c[_0x6166('0x1a')],_0x308cff=_0x17960c[_0x6166('0x1a')]+_0x17960c[_0x6166('0x1b')],_0x1209b3;if(_0x308cff>=_0x41ad51){_0x308cff=_0x41ad51;_0x1209b3=0xc8;}else{_0x1209b3=0xce;}_0x2792c4[_0x6166('0x17')](_0x1209b3);return _0x2792c4['set'](_0x6166('0x1c'),_0x543b74+'-'+_0x308cff+'/'+_0x41ad51)['json'](_0x358ed5);}return null;};}function patchUpdates(_0x2414bb){return function(_0x843aab){try{jsonpatch['apply'](_0x843aab,_0x2414bb,!![]);}catch(_0x5be79b){return BPromise[_0x6166('0x1d')](_0x5be79b);}return _0x843aab['save']();};}function saveUpdates(_0x30d532,_0x123e49){return function(_0x98ff2f){if(_0x98ff2f){return _0x98ff2f['update'](_0x30d532)[_0x6166('0x1e')](function(_0x369a08){return _0x369a08;});}return null;};}function removeEntity(_0x5d82e2,_0xcb1e0){return function(_0x32819c){if(_0x32819c){return _0x32819c[_0x6166('0x1f')]()[_0x6166('0x1e')](function(){_0x5d82e2['status'](0xcc)[_0x6166('0x18')]();});}};}function handleEntityNotFound(_0x2d863c,_0x36a056){return function(_0x487219){if(!_0x487219){_0x2d863c[_0x6166('0x16')](0x194);}return _0x487219;};}function handleError(_0x3d23a7,_0x3e95c7){_0x3e95c7=_0x3e95c7||0x1f4;return function(_0x5c7699){logger[_0x6166('0x20')](_0x5c7699['stack']);if(_0x5c7699['name']){delete _0x5c7699[_0x6166('0x21')];}_0x3d23a7[_0x6166('0x17')](_0x3e95c7)[_0x6166('0x22')](_0x5c7699);};}exports['index']=function(_0x20f762,_0x37b69a){var _0xde5866={},_0x596fc0={},_0x5a5384={'count':0x0,'rows':[]};var _0x1f318a=_['map'](db['MemberReport'][_0x6166('0x23')],function(_0x3c241f){return{'name':_0x3c241f[_0x6166('0x24')],'type':_0x3c241f[_0x6166('0x25')][_0x6166('0x26')]};});_0x596fc0[_0x6166('0x27')]=_[_0x6166('0x28')](_0x1f318a,_0x6166('0x21'));_0x596fc0[_0x6166('0x29')]=_[_0x6166('0x2a')](_0x20f762[_0x6166('0x29')]);_0x596fc0['filters']=_['intersection'](_0x596fc0[_0x6166('0x27')],_0x596fc0['query']);_0xde5866[_0x6166('0x2b')]=_[_0x6166('0x2c')](_0x596fc0[_0x6166('0x27')],qs[_0x6166('0x2d')](_0x20f762[_0x6166('0x29')][_0x6166('0x2d')]));_0xde5866['attributes']=_0xde5866[_0x6166('0x2b')]['length']?_0xde5866[_0x6166('0x2b')]:_0x596fc0[_0x6166('0x27')];if(!_0x20f762[_0x6166('0x29')]['hasOwnProperty'](_0x6166('0x2e'))){_0xde5866[_0x6166('0x1b')]=qs['limit'](_0x20f762[_0x6166('0x29')]['limit']);_0xde5866[_0x6166('0x1a')]=qs[_0x6166('0x1a')](_0x20f762['query'][_0x6166('0x1a')]);}_0xde5866[_0x6166('0x2f')]=qs[_0x6166('0x30')](_0x20f762[_0x6166('0x29')][_0x6166('0x30')]);_0xde5866[_0x6166('0x31')]=qs[_0x6166('0x32')](_[_0x6166('0x33')](_0x20f762[_0x6166('0x29')],_0x596fc0[_0x6166('0x32')]),_0x1f318a);if(_0x20f762['query'][_0x6166('0x34')]){_0xde5866[_0x6166('0x31')]=_[_0x6166('0x35')](_0xde5866[_0x6166('0x31')],{'$or':_[_0x6166('0x28')](_0x1f318a,function(_0x348866){if(_0x348866[_0x6166('0x25')]!==_0x6166('0x36')){var _0x4060b3={};_0x4060b3[_0x348866[_0x6166('0x21')]]={'$like':'%'+_0x20f762[_0x6166('0x29')][_0x6166('0x34')]+'%'};return _0x4060b3;}})});}_0xde5866=_['merge']({},_0xde5866,_0x20f762[_0x6166('0x37')]);var _0x214f3b={'where':_0xde5866['where']};return db[_0x6166('0x38')][_0x6166('0x19')](_0x214f3b)[_0x6166('0x1e')](function(_0x561136){_0x5a5384[_0x6166('0x19')]=_0x561136;if(_0x20f762[_0x6166('0x29')][_0x6166('0x39')]){_0xde5866[_0x6166('0x3a')]=[{'all':!![]}];}return db[_0x6166('0x38')][_0x6166('0x3b')](_0xde5866);})['then'](function(_0x49ea08){_0x5a5384[_0x6166('0x3c')]=_0x49ea08;return _0x5a5384;})[_0x6166('0x1e')](respondWithFilteredResult(_0x37b69a,_0xde5866))['catch'](handleError(_0x37b69a,null));};exports[_0x6166('0x3d')]=function(_0x4e0dc5,_0x24c7c5){var _0x53c72e={'raw':!![],'where':{'id':_0x4e0dc5[_0x6166('0x3e')]['id']}},_0x45f06d={};_0x45f06d['model']=_['keys'](db[_0x6166('0x38')][_0x6166('0x23')]);_0x45f06d[_0x6166('0x29')]=_['keys'](_0x4e0dc5[_0x6166('0x29')]);_0x45f06d['filters']=_['intersection'](_0x45f06d[_0x6166('0x27')],_0x45f06d[_0x6166('0x29')]);_0x53c72e[_0x6166('0x2b')]=_[_0x6166('0x2c')](_0x45f06d['model'],qs[_0x6166('0x2d')](_0x4e0dc5[_0x6166('0x29')][_0x6166('0x2d')]));_0x53c72e[_0x6166('0x2b')]=_0x53c72e[_0x6166('0x2b')][_0x6166('0x3f')]?_0x53c72e[_0x6166('0x2b')]:_0x45f06d[_0x6166('0x27')];if(_0x4e0dc5[_0x6166('0x29')]['includeAll']){_0x53c72e[_0x6166('0x3a')]=[{'all':!![]}];}_0x53c72e=_[_0x6166('0x35')]({},_0x53c72e,_0x4e0dc5[_0x6166('0x37')]);return db[_0x6166('0x38')]['find'](_0x53c72e)[_0x6166('0x1e')](handleEntityNotFound(_0x24c7c5,null))[_0x6166('0x1e')](respondWithResult(_0x24c7c5,null))['catch'](handleError(_0x24c7c5,null));};exports[_0x6166('0x40')]=function(_0x37e593,_0x262707){return db['MemberReport'][_0x6166('0x40')](_0x37e593[_0x6166('0x41')],{})['then'](respondWithResult(_0x262707,0xc9))[_0x6166('0x42')](handleError(_0x262707,null));};exports[_0x6166('0x43')]=function(_0x2eda14,_0x3dbff2){if(_0x2eda14[_0x6166('0x41')]['id']){delete _0x2eda14[_0x6166('0x41')]['id'];}return db[_0x6166('0x38')][_0x6166('0x44')]({'where':{'id':_0x2eda14[_0x6166('0x3e')]['id']}})[_0x6166('0x1e')](handleEntityNotFound(_0x3dbff2,null))[_0x6166('0x1e')](saveUpdates(_0x2eda14[_0x6166('0x41')],null))[_0x6166('0x1e')](respondWithResult(_0x3dbff2,null))[_0x6166('0x42')](handleError(_0x3dbff2,null));};exports[_0x6166('0x1f')]=function(_0x25384e,_0x47b9a4){return db[_0x6166('0x38')]['find']({'where':{'id':_0x25384e[_0x6166('0x3e')]['id']}})[_0x6166('0x1e')](handleEntityNotFound(_0x47b9a4,null))[_0x6166('0x1e')](removeEntity(_0x47b9a4,null))[_0x6166('0x42')](handleError(_0x47b9a4,null));};exports[_0x6166('0x45')]=function(_0x161033,_0x1d2098){return db[_0x6166('0x38')][_0x6166('0x45')]()[_0x6166('0x1e')](respondWithResult(_0x1d2098,null))[_0x6166('0x42')](handleError(_0x1d2098,null));}; \ No newline at end of file +var _0x5850=['fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','limit','Content-Range','reject','save','destroy','error','stack','name','send','map','MemberReport','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','merge','filter','options','count','includeAll','include','findAll','rows','then','catch','show','params','rawAttributes','create','update','body','find','describe','eml-format','zip-dir'];(function(_0x3b7956,_0x441060){var _0x9419d0=function(_0x1c3221){while(--_0x1c3221){_0x3b7956['push'](_0x3b7956['shift']());}};_0x9419d0(++_0x441060);}(_0x5850,0x166));var _0x0585=function(_0x105c27,_0x5e189b){_0x105c27=_0x105c27-0x0;var _0x360a90=_0x5850[_0x105c27];return _0x360a90;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x0585('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0585('0x1'));var jsonpatch=require(_0x0585('0x2'));var rp=require(_0x0585('0x3'));var moment=require(_0x0585('0x4'));var BPromise=require(_0x0585('0x5'));var Mustache=require(_0x0585('0x6'));var util=require(_0x0585('0x7'));var path=require(_0x0585('0x8'));var sox=require(_0x0585('0x9'));var csv=require(_0x0585('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x0585('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x0585('0xc'));var deskjs=require(_0x0585('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0585('0xe'));var Redis=require(_0x0585('0xf'));var authService=require(_0x0585('0x10'));var qs=require(_0x0585('0x11'));var as=require(_0x0585('0x12'));var hardwareService=require(_0x0585('0x13'));var logger=require('../../config/logger')(_0x0585('0x14'));var utils=require(_0x0585('0x15'));var config=require(_0x0585('0x16'));var db=require(_0x0585('0x17'))['db'];function respondWithStatusCode(_0x51521f,_0x2f25db){_0x2f25db=_0x2f25db||0xcc;return function(_0x52a0d4){if(_0x52a0d4){return _0x51521f[_0x0585('0x18')](_0x2f25db);}return _0x51521f[_0x0585('0x19')](_0x2f25db)['end']();};}function respondWithResult(_0x3ad80b,_0x11b67b){_0x11b67b=_0x11b67b||0xc8;return function(_0x23cafb){if(_0x23cafb){return _0x3ad80b[_0x0585('0x19')](_0x11b67b)[_0x0585('0x1a')](_0x23cafb);}};}function respondWithFilteredResult(_0x4cbf74,_0x553b60){return function(_0x449e5a){if(_0x449e5a){var _0x7db321=_0x449e5a['count'],_0x4c4522=_0x553b60['offset'],_0x306797=_0x553b60['offset']+_0x553b60[_0x0585('0x1b')],_0x3e2145;if(_0x306797>=_0x7db321){_0x306797=_0x7db321;_0x3e2145=0xc8;}else{_0x3e2145=0xce;}_0x4cbf74[_0x0585('0x19')](_0x3e2145);return _0x4cbf74['set'](_0x0585('0x1c'),_0x4c4522+'-'+_0x306797+'/'+_0x7db321)[_0x0585('0x1a')](_0x449e5a);}return null;};}function patchUpdates(_0x447760){return function(_0x301f7f){try{jsonpatch['apply'](_0x301f7f,_0x447760,!![]);}catch(_0x569974){return BPromise[_0x0585('0x1d')](_0x569974);}return _0x301f7f[_0x0585('0x1e')]();};}function saveUpdates(_0x41857f,_0xead70){return function(_0x517340){if(_0x517340){return _0x517340['update'](_0x41857f)['then'](function(_0x369795){return _0x369795;});}return null;};}function removeEntity(_0x3dc680,_0x46fc8f){return function(_0x137f45){if(_0x137f45){return _0x137f45[_0x0585('0x1f')]()['then'](function(){_0x3dc680['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x55dbb8,_0x594818){return function(_0x35cd67){if(!_0x35cd67){_0x55dbb8['sendStatus'](0x194);}return _0x35cd67;};}function handleError(_0x514dcd,_0x4dea97){_0x4dea97=_0x4dea97||0x1f4;return function(_0x9de642){logger[_0x0585('0x20')](_0x9de642[_0x0585('0x21')]);if(_0x9de642[_0x0585('0x22')]){delete _0x9de642[_0x0585('0x22')];}_0x514dcd[_0x0585('0x19')](_0x4dea97)[_0x0585('0x23')](_0x9de642);};}exports['index']=function(_0x49438a,_0x3821fe){var _0x176101={},_0x56dd42={},_0xe6873b={'count':0x0,'rows':[]};var _0x1f38c7=_[_0x0585('0x24')](db[_0x0585('0x25')]['rawAttributes'],function(_0x3cefb2){return{'name':_0x3cefb2['fieldName'],'type':_0x3cefb2[_0x0585('0x26')]['key']};});_0x56dd42[_0x0585('0x27')]=_[_0x0585('0x24')](_0x1f38c7,'name');_0x56dd42[_0x0585('0x28')]=_[_0x0585('0x29')](_0x49438a[_0x0585('0x28')]);_0x56dd42[_0x0585('0x2a')]=_[_0x0585('0x2b')](_0x56dd42['model'],_0x56dd42[_0x0585('0x28')]);_0x176101[_0x0585('0x2c')]=_[_0x0585('0x2b')](_0x56dd42['model'],qs[_0x0585('0x2d')](_0x49438a[_0x0585('0x28')]['fields']));_0x176101['attributes']=_0x176101[_0x0585('0x2c')][_0x0585('0x2e')]?_0x176101['attributes']:_0x56dd42['model'];if(!_0x49438a[_0x0585('0x28')][_0x0585('0x2f')](_0x0585('0x30'))){_0x176101[_0x0585('0x1b')]=qs[_0x0585('0x1b')](_0x49438a['query'][_0x0585('0x1b')]);_0x176101['offset']=qs[_0x0585('0x31')](_0x49438a[_0x0585('0x28')]['offset']);}_0x176101[_0x0585('0x32')]=qs[_0x0585('0x33')](_0x49438a['query'][_0x0585('0x33')]);_0x176101[_0x0585('0x34')]=qs[_0x0585('0x2a')](_[_0x0585('0x35')](_0x49438a[_0x0585('0x28')],_0x56dd42[_0x0585('0x2a')]),_0x1f38c7);if(_0x49438a[_0x0585('0x28')]['filter']){_0x176101[_0x0585('0x34')]=_[_0x0585('0x36')](_0x176101['where'],{'$or':_['map'](_0x1f38c7,function(_0x4f9a69){if(_0x4f9a69[_0x0585('0x26')]!=='VIRTUAL'){var _0x2bd1a4={};_0x2bd1a4[_0x4f9a69[_0x0585('0x22')]]={'$like':'%'+_0x49438a[_0x0585('0x28')][_0x0585('0x37')]+'%'};return _0x2bd1a4;}})});}_0x176101=_['merge']({},_0x176101,_0x49438a[_0x0585('0x38')]);var _0x723510={'where':_0x176101[_0x0585('0x34')]};return db[_0x0585('0x25')][_0x0585('0x39')](_0x723510)['then'](function(_0xb93160){_0xe6873b['count']=_0xb93160;if(_0x49438a[_0x0585('0x28')][_0x0585('0x3a')]){_0x176101[_0x0585('0x3b')]=[{'all':!![]}];}return db['MemberReport'][_0x0585('0x3c')](_0x176101);})['then'](function(_0x396240){_0xe6873b[_0x0585('0x3d')]=_0x396240;return _0xe6873b;})[_0x0585('0x3e')](respondWithFilteredResult(_0x3821fe,_0x176101))[_0x0585('0x3f')](handleError(_0x3821fe,null));};exports[_0x0585('0x40')]=function(_0x9070ed,_0x5811c4){var _0x11ff94={'raw':!![],'where':{'id':_0x9070ed[_0x0585('0x41')]['id']}},_0x297b71={};_0x297b71['model']=_[_0x0585('0x29')](db['MemberReport'][_0x0585('0x42')]);_0x297b71['query']=_['keys'](_0x9070ed[_0x0585('0x28')]);_0x297b71[_0x0585('0x2a')]=_['intersection'](_0x297b71[_0x0585('0x27')],_0x297b71[_0x0585('0x28')]);_0x11ff94['attributes']=_[_0x0585('0x2b')](_0x297b71[_0x0585('0x27')],qs[_0x0585('0x2d')](_0x9070ed[_0x0585('0x28')][_0x0585('0x2d')]));_0x11ff94[_0x0585('0x2c')]=_0x11ff94[_0x0585('0x2c')][_0x0585('0x2e')]?_0x11ff94[_0x0585('0x2c')]:_0x297b71['model'];if(_0x9070ed[_0x0585('0x28')][_0x0585('0x3a')]){_0x11ff94['include']=[{'all':!![]}];}_0x11ff94=_[_0x0585('0x36')]({},_0x11ff94,_0x9070ed[_0x0585('0x38')]);return db[_0x0585('0x25')]['find'](_0x11ff94)['then'](handleEntityNotFound(_0x5811c4,null))[_0x0585('0x3e')](respondWithResult(_0x5811c4,null))[_0x0585('0x3f')](handleError(_0x5811c4,null));};exports[_0x0585('0x43')]=function(_0x27323f,_0x41a76f){return db[_0x0585('0x25')][_0x0585('0x43')](_0x27323f['body'],{})[_0x0585('0x3e')](respondWithResult(_0x41a76f,0xc9))['catch'](handleError(_0x41a76f,null));};exports[_0x0585('0x44')]=function(_0x25e586,_0x579d4c){if(_0x25e586['body']['id']){delete _0x25e586[_0x0585('0x45')]['id'];}return db[_0x0585('0x25')]['find']({'where':{'id':_0x25e586['params']['id']}})[_0x0585('0x3e')](handleEntityNotFound(_0x579d4c,null))[_0x0585('0x3e')](saveUpdates(_0x25e586['body'],null))['then'](respondWithResult(_0x579d4c,null))['catch'](handleError(_0x579d4c,null));};exports[_0x0585('0x1f')]=function(_0x53e852,_0x273e22){return db['MemberReport'][_0x0585('0x46')]({'where':{'id':_0x53e852[_0x0585('0x41')]['id']}})['then'](handleEntityNotFound(_0x273e22,null))['then'](removeEntity(_0x273e22,null))[_0x0585('0x3f')](handleError(_0x273e22,null));};exports[_0x0585('0x47')]=function(_0x106a7f,_0xf158f4){return db[_0x0585('0x25')][_0x0585('0x47')]()[_0x0585('0x3e')](respondWithResult(_0xf158f4,null))[_0x0585('0x3f')](handleError(_0xf158f4,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index fcf43bd..078ba7d 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 _0x4887=['./memberReport.attributes','exports','define','MemberReport','report_member','membername_interface','membername','interface','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x4f9c1c,_0x3b8ea1){var _0x53d914=function(_0x2d0511){while(--_0x2d0511){_0x4f9c1c['push'](_0x4f9c1c['shift']());}};_0x53d914(++_0x3b8ea1);}(_0x4887,0x198));var _0x7488=function(_0x214a08,_0xe13a1){_0x214a08=_0x214a08-0x0;var _0x3472bb=_0x4887[_0x214a08];return _0x3472bb;};'use strict';var _=require(_0x7488('0x0'));var util=require(_0x7488('0x1'));var logger=require(_0x7488('0x2'))('api');var moment=require(_0x7488('0x3'));var BPromise=require('bluebird');var rp=require(_0x7488('0x4'));var fs=require('fs');var path=require(_0x7488('0x5'));var rimraf=require(_0x7488('0x6'));var config=require(_0x7488('0x7'));var attributes=require(_0x7488('0x8'));module[_0x7488('0x9')]=function(_0x28497f,_0x4c9813){return _0x28497f[_0x7488('0xa')](_0x7488('0xb'),attributes,{'tableName':_0x7488('0xc'),'paranoid':![],'indexes':[{'name':_0x7488('0xd'),'fields':[_0x7488('0xe'),_0x7488('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd980=['MemberReport','report_member','membername_interface','membername','interface','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./memberReport.attributes','exports','define'];(function(_0x40a3d6,_0x4fa5e6){var _0x413b75=function(_0x2f7669){while(--_0x2f7669){_0x40a3d6['push'](_0x40a3d6['shift']());}};_0x413b75(++_0x4fa5e6);}(_0xd980,0xd1));var _0x0d98=function(_0x18043a,_0x41e715){_0x18043a=_0x18043a-0x0;var _0x3a62bc=_0xd980[_0x18043a];return _0x3a62bc;};'use strict';var _=require(_0x0d98('0x0'));var util=require('util');var logger=require(_0x0d98('0x1'))(_0x0d98('0x2'));var moment=require(_0x0d98('0x3'));var BPromise=require(_0x0d98('0x4'));var rp=require(_0x0d98('0x5'));var fs=require('fs');var path=require(_0x0d98('0x6'));var rimraf=require(_0x0d98('0x7'));var config=require(_0x0d98('0x8'));var attributes=require(_0x0d98('0x9'));module[_0x0d98('0xa')]=function(_0x141f4b,_0x3f5adf){return _0x141f4b[_0x0d98('0xb')](_0x0d98('0xc'),attributes,{'tableName':_0x0d98('0xd'),'paranoid':![],'indexes':[{'name':_0x0d98('0xe'),'fields':[_0x0d98('0xf'),_0x0d98('0x10')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index 6d728f7..8442d11 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 _0xf6da=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','error','code','MemberReport,\x20%s,\x20%s','message','info','GetMemberReport','MemberReport','findAll','options','raw','where','attributes','limit','include','map','model','stringify','catch','CreateMemberReport','create','body','update','UpdateMemberReport','lodash','moment'];(function(_0x10dce2,_0x28d201){var _0x6926bd=function(_0x2cfeca){while(--_0x2cfeca){_0x10dce2['push'](_0x10dce2['shift']());}};_0x6926bd(++_0x28d201);}(_0xf6da,0xbc));var _0xaf6d=function(_0x3d72e5,_0x141c52){_0x3d72e5=_0x3d72e5-0x0;var _0xa79005=_0xf6da[_0x3d72e5];return _0xa79005;};'use strict';var _=require(_0xaf6d('0x0'));var util=require('util');var moment=require(_0xaf6d('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xaf6d('0x2'));var db=require(_0xaf6d('0x3'))['db'];var utils=require(_0xaf6d('0x4'));var logger=require(_0xaf6d('0x5'))(_0xaf6d('0x6'));var config=require(_0xaf6d('0x7'));var jayson=require(_0xaf6d('0x8'));var client=jayson[_0xaf6d('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5ada97,_0x156036,_0x117cce){return new BPromise(function(_0x3effec,_0x4f76b3){return client[_0xaf6d('0xa')](_0x5ada97,_0x117cce)[_0xaf6d('0xb')](function(_0x5a683d){logger['info']('MemberReport,\x20%s,\x20%s',_0x156036,_0xaf6d('0xc'));logger[_0xaf6d('0xd')](_0xaf6d('0xe'),_0x156036,_0xaf6d('0xc'),JSON['stringify'](_0x5a683d));if(_0x5a683d[_0xaf6d('0xf')]){if(_0x5a683d[_0xaf6d('0xf')][_0xaf6d('0x10')]===0x1f4){logger['error'](_0xaf6d('0x11'),_0x156036,_0x5a683d['error'][_0xaf6d('0x12')]);return _0x4f76b3(_0x5a683d[_0xaf6d('0xf')][_0xaf6d('0x12')]);}logger[_0xaf6d('0xf')](_0xaf6d('0x11'),_0x156036,_0x5a683d[_0xaf6d('0xf')]['message']);return _0x3effec(_0x5a683d[_0xaf6d('0xf')][_0xaf6d('0x12')]);}else{logger[_0xaf6d('0x13')]('MemberReport,\x20%s,\x20%s',_0x156036,_0xaf6d('0xc'));_0x3effec(_0x5a683d['result'][_0xaf6d('0x12')]);}})['catch'](function(_0x3a0cfb){logger[_0xaf6d('0xf')](_0xaf6d('0x11'),_0x156036,_0x3a0cfb);_0x4f76b3(_0x3a0cfb);});});}exports[_0xaf6d('0x14')]=function(_0x37bac2){var _0x142be1=this;return new Promise(function(_0x528e19,_0x35f292){return db[_0xaf6d('0x15')][_0xaf6d('0x16')]({'raw':_0x37bac2[_0xaf6d('0x17')]?_0x37bac2['options'][_0xaf6d('0x18')]===undefined?!![]:![]:!![],'where':_0x37bac2[_0xaf6d('0x17')]?_0x37bac2[_0xaf6d('0x17')][_0xaf6d('0x19')]||null:null,'attributes':_0x37bac2[_0xaf6d('0x17')]?_0x37bac2[_0xaf6d('0x17')][_0xaf6d('0x1a')]||null:null,'limit':_0x37bac2[_0xaf6d('0x17')]?_0x37bac2[_0xaf6d('0x17')][_0xaf6d('0x1b')]||null:null,'include':_0x37bac2['options']?_0x37bac2[_0xaf6d('0x17')][_0xaf6d('0x1c')]?_[_0xaf6d('0x1d')](_0x37bac2[_0xaf6d('0x17')][_0xaf6d('0x1c')],function(_0x2c7b7f){return{'model':db[_0x2c7b7f['model']],'as':_0x2c7b7f['as'],'attributes':_0x2c7b7f[_0xaf6d('0x1a')],'include':_0x2c7b7f['include']?_[_0xaf6d('0x1d')](_0x2c7b7f[_0xaf6d('0x1c')],function(_0x58b9c9){return{'model':db[_0x58b9c9[_0xaf6d('0x1e')]],'as':_0x58b9c9['as'],'attributes':_0x58b9c9[_0xaf6d('0x1a')],'include':_0x58b9c9[_0xaf6d('0x1c')]?_['map'](_0x58b9c9[_0xaf6d('0x1c')],function(_0x4743a8){return{'model':db[_0x4743a8[_0xaf6d('0x1e')]],'as':_0x4743a8['as'],'attributes':_0x4743a8[_0xaf6d('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xaf6d('0xb')](function(_0x3540ef){logger[_0xaf6d('0x13')](_0xaf6d('0x14'),_0x37bac2);logger[_0xaf6d('0xd')](_0xaf6d('0x14'),_0x37bac2,JSON[_0xaf6d('0x1f')](_0x3540ef));_0x528e19(_0x3540ef);})[_0xaf6d('0x20')](function(_0x1d8021){logger[_0xaf6d('0xf')](_0xaf6d('0x14'),_0x1d8021[_0xaf6d('0x12')],_0x37bac2);_0x35f292(_0x142be1[_0xaf6d('0xf')](0x1f4,_0x1d8021[_0xaf6d('0x12')]));});});};exports[_0xaf6d('0x21')]=function(_0x4d0c0a){var _0xa2d815=this;return new Promise(function(_0x1c96ef,_0x46b03b){return db['MemberReport'][_0xaf6d('0x22')](_0x4d0c0a[_0xaf6d('0x23')],{'raw':_0x4d0c0a[_0xaf6d('0x17')]?_0x4d0c0a['options'][_0xaf6d('0x18')]===undefined?!![]:![]:!![]})[_0xaf6d('0xb')](function(_0xa287a0){logger['info'](_0xaf6d('0x21'),_0x4d0c0a);logger['debug'](_0xaf6d('0x21'),_0x4d0c0a,JSON[_0xaf6d('0x1f')](_0xa287a0));_0x1c96ef(_0xa287a0);})[_0xaf6d('0x20')](function(_0x76114){logger[_0xaf6d('0xf')]('CreateMemberReport',_0x76114[_0xaf6d('0x12')],_0x4d0c0a);_0x46b03b(_0xa2d815[_0xaf6d('0xf')](0x1f4,_0x76114[_0xaf6d('0x12')]));});});};exports['UpdateMemberReport']=function(_0x15e4b3){var _0x3be8ef=this;return new Promise(function(_0x2abf05,_0x57ab2a){return db['MemberReport'][_0xaf6d('0x24')](_0x15e4b3[_0xaf6d('0x23')],{'raw':_0x15e4b3['options']?_0x15e4b3[_0xaf6d('0x17')][_0xaf6d('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x15e4b3['options']?_0x15e4b3['options'][_0xaf6d('0x19')]||null:null,'attributes':_0x15e4b3[_0xaf6d('0x17')]?_0x15e4b3[_0xaf6d('0x17')][_0xaf6d('0x1a')]||null:null,'limit':_0x15e4b3[_0xaf6d('0x17')]?_0x15e4b3[_0xaf6d('0x17')]['limit']||null:null})[_0xaf6d('0xb')](function(_0x52019e){logger[_0xaf6d('0x13')]('UpdateMemberReport',_0x15e4b3);logger[_0xaf6d('0xd')](_0xaf6d('0x25'),_0x15e4b3,JSON[_0xaf6d('0x1f')](_0x52019e));_0x2abf05(_0x52019e);})[_0xaf6d('0x20')](function(_0xff4131){logger[_0xaf6d('0xf')](_0xaf6d('0x25'),_0xff4131[_0xaf6d('0x12')],_0x15e4b3);_0x57ab2a(_0x3be8ef['error'](0x1f4,_0xff4131[_0xaf6d('0x12')]));});});}; \ No newline at end of file +var _0x39b0=['findAll','options','where','attributes','limit','include','map','model','CreateMemberReport','create','body','raw','UpdateMemberReport','update','lodash','util','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetMemberReport','MemberReport'];(function(_0x345df2,_0x239e19){var _0x22a468=function(_0x35fb98){while(--_0x35fb98){_0x345df2['push'](_0x345df2['shift']());}};_0x22a468(++_0x239e19);}(_0x39b0,0x9e));var _0x039b=function(_0xcf0697,_0x27c304){_0xcf0697=_0xcf0697-0x0;var _0x103ccf=_0x39b0[_0xcf0697];return _0x103ccf;};'use strict';var _=require(_0x039b('0x0'));var util=require(_0x039b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x039b('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x039b('0x3'));var logger=require(_0x039b('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0x039b('0x5'));var client=jayson[_0x039b('0x6')][_0x039b('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1cc8f7,_0x53dca1,_0x2afc76){return new BPromise(function(_0x3c8701,_0x5a34c5){return client[_0x039b('0x8')](_0x1cc8f7,_0x2afc76)[_0x039b('0x9')](function(_0x178f54){logger[_0x039b('0xa')](_0x039b('0xb'),_0x53dca1,_0x039b('0xc'));logger[_0x039b('0xd')](_0x039b('0xe'),_0x53dca1,_0x039b('0xc'),JSON[_0x039b('0xf')](_0x178f54));if(_0x178f54[_0x039b('0x10')]){if(_0x178f54['error']['code']===0x1f4){logger[_0x039b('0x10')]('MemberReport,\x20%s,\x20%s',_0x53dca1,_0x178f54[_0x039b('0x10')][_0x039b('0x11')]);return _0x5a34c5(_0x178f54[_0x039b('0x10')][_0x039b('0x11')]);}logger['error']('MemberReport,\x20%s,\x20%s',_0x53dca1,_0x178f54[_0x039b('0x10')][_0x039b('0x11')]);return _0x3c8701(_0x178f54[_0x039b('0x10')][_0x039b('0x11')]);}else{logger['info'](_0x039b('0xb'),_0x53dca1,_0x039b('0xc'));_0x3c8701(_0x178f54[_0x039b('0x12')]['message']);}})[_0x039b('0x13')](function(_0x17c65f){logger[_0x039b('0x10')](_0x039b('0xb'),_0x53dca1,_0x17c65f);_0x5a34c5(_0x17c65f);});});}exports[_0x039b('0x14')]=function(_0x578c22){var _0x493128=this;return new Promise(function(_0x3894d5,_0x35ea01){return db[_0x039b('0x15')][_0x039b('0x16')]({'raw':_0x578c22[_0x039b('0x17')]?_0x578c22[_0x039b('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x578c22[_0x039b('0x17')]?_0x578c22[_0x039b('0x17')][_0x039b('0x18')]||null:null,'attributes':_0x578c22[_0x039b('0x17')]?_0x578c22[_0x039b('0x17')][_0x039b('0x19')]||null:null,'limit':_0x578c22[_0x039b('0x17')]?_0x578c22[_0x039b('0x17')][_0x039b('0x1a')]||null:null,'include':_0x578c22[_0x039b('0x17')]?_0x578c22[_0x039b('0x17')][_0x039b('0x1b')]?_[_0x039b('0x1c')](_0x578c22[_0x039b('0x17')][_0x039b('0x1b')],function(_0x4cc4dd){return{'model':db[_0x4cc4dd[_0x039b('0x1d')]],'as':_0x4cc4dd['as'],'attributes':_0x4cc4dd[_0x039b('0x19')],'include':_0x4cc4dd[_0x039b('0x1b')]?_['map'](_0x4cc4dd['include'],function(_0x51610){return{'model':db[_0x51610['model']],'as':_0x51610['as'],'attributes':_0x51610[_0x039b('0x19')],'include':_0x51610[_0x039b('0x1b')]?_[_0x039b('0x1c')](_0x51610[_0x039b('0x1b')],function(_0x164037){return{'model':db[_0x164037[_0x039b('0x1d')]],'as':_0x164037['as'],'attributes':_0x164037[_0x039b('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x24b5c5){logger[_0x039b('0xa')]('GetMemberReport',_0x578c22);logger[_0x039b('0xd')](_0x039b('0x14'),_0x578c22,JSON[_0x039b('0xf')](_0x24b5c5));_0x3894d5(_0x24b5c5);})[_0x039b('0x13')](function(_0x266698){logger['error'](_0x039b('0x14'),_0x266698[_0x039b('0x11')],_0x578c22);_0x35ea01(_0x493128[_0x039b('0x10')](0x1f4,_0x266698[_0x039b('0x11')]));});});};exports[_0x039b('0x1e')]=function(_0x1087cf){var _0x505872=this;return new Promise(function(_0x271af3,_0x2c11f2){return db[_0x039b('0x15')][_0x039b('0x1f')](_0x1087cf[_0x039b('0x20')],{'raw':_0x1087cf[_0x039b('0x17')]?_0x1087cf[_0x039b('0x17')][_0x039b('0x21')]===undefined?!![]:![]:!![]})[_0x039b('0x9')](function(_0x4e2eb4){logger[_0x039b('0xa')]('CreateMemberReport',_0x1087cf);logger[_0x039b('0xd')](_0x039b('0x1e'),_0x1087cf,JSON['stringify'](_0x4e2eb4));_0x271af3(_0x4e2eb4);})[_0x039b('0x13')](function(_0x2a7417){logger[_0x039b('0x10')](_0x039b('0x1e'),_0x2a7417[_0x039b('0x11')],_0x1087cf);_0x2c11f2(_0x505872[_0x039b('0x10')](0x1f4,_0x2a7417[_0x039b('0x11')]));});});};exports[_0x039b('0x22')]=function(_0x597a19){var _0xbb90ef=this;return new Promise(function(_0x4bcb9b,_0x3a7b75){return db['MemberReport'][_0x039b('0x23')](_0x597a19[_0x039b('0x20')],{'raw':_0x597a19[_0x039b('0x17')]?_0x597a19[_0x039b('0x17')][_0x039b('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x597a19[_0x039b('0x17')]?_0x597a19['options'][_0x039b('0x18')]||null:null,'attributes':_0x597a19['options']?_0x597a19[_0x039b('0x17')][_0x039b('0x19')]||null:null,'limit':_0x597a19[_0x039b('0x17')]?_0x597a19['options'][_0x039b('0x1a')]||null:null})[_0x039b('0x9')](function(_0x1446b1){logger[_0x039b('0xa')](_0x039b('0x22'),_0x597a19);logger[_0x039b('0xd')](_0x039b('0x22'),_0x597a19,JSON[_0x039b('0xf')](_0x1446b1));_0x4bcb9b(_0x1446b1);})['catch'](function(_0x5114b1){logger[_0x039b('0x10')](_0x039b('0x22'),_0x5114b1[_0x039b('0x11')],_0x597a19);_0x3a7b75(_0xbb90ef[_0x039b('0x10')](0x1f4,_0x5114b1[_0x039b('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 17704ad..3f85a52 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 _0x9348=['../../components/interaction/service','./migration.controller','get','index','exports','multer','util','path','connect-timeout','express','../../components/auth/service'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x9348,0x10d));var _0x8934=function(_0x3d46e5,_0x565392){_0x3d46e5=_0x3d46e5-0x0;var _0x5b9e42=_0x9348[_0x3d46e5];return _0x5b9e42;};'use strict';var multer=require(_0x8934('0x0'));var util=require(_0x8934('0x1'));var path=require(_0x8934('0x2'));var timeout=require(_0x8934('0x3'));var express=require(_0x8934('0x4'));var router=express['Router']();var auth=require(_0x8934('0x5'));var interaction=require(_0x8934('0x6'));var config=require('../../config/environment');var controller=require(_0x8934('0x7'));router[_0x8934('0x8')]('/',controller[_0x8934('0x9')]);module[_0x8934('0xa')]=router; \ No newline at end of file +var _0x757a=['../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller','get','index','util','path'];(function(_0x9ac0fc,_0x23765c){var _0x4c441d=function(_0x36809d){while(--_0x36809d){_0x9ac0fc['push'](_0x9ac0fc['shift']());}};_0x4c441d(++_0x23765c);}(_0x757a,0xde));var _0xa757=function(_0x272302,_0x3bfb86){_0x272302=_0x272302-0x0;var _0x5f1fdd=_0x757a[_0x272302];return _0x5f1fdd;};'use strict';var multer=require('multer');var util=require(_0xa757('0x0'));var path=require(_0xa757('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0xa757('0x2'));var interaction=require(_0xa757('0x3'));var config=require(_0xa757('0x4'));var controller=require(_0xa757('0x5'));router[_0xa757('0x6')]('/',controller[_0xa757('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 46c6a80..89c6876 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 _0x83a8=['STRING','version','sequelize','exports'];(function(_0x372811,_0x204cf8){var _0x3dee6f=function(_0x3e42b9){while(--_0x3e42b9){_0x372811['push'](_0x372811['shift']());}};_0x3dee6f(++_0x204cf8);}(_0x83a8,0x9a));var _0x883a=function(_0x32a09f,_0x5b91a4){_0x32a09f=_0x32a09f-0x0;var _0x3fc5a2=_0x83a8[_0x32a09f];return _0x3fc5a2;};'use strict';var Sequelize=require(_0x883a('0x0'));module[_0x883a('0x1')]={'version':{'type':Sequelize[_0x883a('0x2')],'unique':_0x883a('0x3')}}; \ No newline at end of file +var _0xf2bc=['exports','STRING','sequelize'];(function(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0xf2bc,0x125));var _0xcf2b=function(_0x22cea4,_0x54f16a){_0x22cea4=_0x22cea4-0x0;var _0x59d75b=_0xf2bc[_0x22cea4];return _0x59d75b;};'use strict';var Sequelize=require(_0xcf2b('0x0'));module[_0xcf2b('0x1')]={'version':{'type':Sequelize[_0xcf2b('0x2')],'unique':'version'}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 9ed64e6..2693bba 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 _0x70e0=['desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','json','offset','limit','status','set','Content-Range','apply','reject','update','then','destroy','end','stack','send','index','map','Migration','rawAttributes','fieldName','key','model','keys','query','filters','attributes','intersection','length','hasOwnProperty','nolimit','sort','where','filter','type','VIRTUAL','name','merge','options','count','includeAll','findAll','rows','catch','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','to-csv','crypto','jsforce'];(function(_0x450076,_0x10983b){var _0x2029cc=function(_0x4a5e76){while(--_0x4a5e76){_0x450076['push'](_0x450076['shift']());}};_0x2029cc(++_0x10983b);}(_0x70e0,0x17b));var _0x070e=function(_0x4fae5c,_0x30df4d){_0x4fae5c=_0x4fae5c-0x0;var _0x43b149=_0x70e0[_0x4fae5c];return _0x43b149;};'use strict';var pdf=require(_0x070e('0x0'));var emlformat=require(_0x070e('0x1'));var rimraf=require(_0x070e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x070e('0x3'));var moment=require(_0x070e('0x4'));var BPromise=require(_0x070e('0x5'));var Mustache=require(_0x070e('0x6'));var util=require('util');var path=require(_0x070e('0x7'));var sox=require('sox');var csv=require(_0x070e('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x070e('0x9'));var jsforce=require(_0x070e('0xa'));var deskjs=require(_0x070e('0xb'));var toCsv=require(_0x070e('0x8'));var querystring=require(_0x070e('0xc'));var Papa=require(_0x070e('0xd'));var Redis=require(_0x070e('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x070e('0xf'));var hardwareService=require(_0x070e('0x10'));var logger=require(_0x070e('0x11'))(_0x070e('0x12'));var utils=require(_0x070e('0x13'));var config=require(_0x070e('0x14'));var db=require(_0x070e('0x15'))['db'];function respondWithStatusCode(_0x1baa12,_0x39d2b9){_0x39d2b9=_0x39d2b9||0xcc;return function(_0x5bf079){if(_0x5bf079){return _0x1baa12[_0x070e('0x16')](_0x39d2b9);}return _0x1baa12['status'](_0x39d2b9)['end']();};}function respondWithResult(_0x24baba,_0x56c7ba){_0x56c7ba=_0x56c7ba||0xc8;return function(_0x4a33d2){if(_0x4a33d2){return _0x24baba['status'](_0x56c7ba)[_0x070e('0x17')](_0x4a33d2);}};}function respondWithFilteredResult(_0x14c3fd,_0x51d14d){return function(_0x5d3a38){if(_0x5d3a38){var _0x373d86=_0x5d3a38['count'],_0xeae1a5=_0x51d14d['offset'],_0x180897=_0x51d14d[_0x070e('0x18')]+_0x51d14d[_0x070e('0x19')],_0x19d9da;if(_0x180897>=_0x373d86){_0x180897=_0x373d86;_0x19d9da=0xc8;}else{_0x19d9da=0xce;}_0x14c3fd[_0x070e('0x1a')](_0x19d9da);return _0x14c3fd[_0x070e('0x1b')](_0x070e('0x1c'),_0xeae1a5+'-'+_0x180897+'/'+_0x373d86)['json'](_0x5d3a38);}return null;};}function patchUpdates(_0x3938b5){return function(_0x168dc6){try{jsonpatch[_0x070e('0x1d')](_0x168dc6,_0x3938b5,!![]);}catch(_0x3ea105){return BPromise[_0x070e('0x1e')](_0x3ea105);}return _0x168dc6['save']();};}function saveUpdates(_0x5b2f48,_0x4e958f){return function(_0x9907cf){if(_0x9907cf){return _0x9907cf[_0x070e('0x1f')](_0x5b2f48)[_0x070e('0x20')](function(_0x4be0d7){return _0x4be0d7;});}return null;};}function removeEntity(_0x5b184,_0x5dc5d2){return function(_0xf8dd5d){if(_0xf8dd5d){return _0xf8dd5d[_0x070e('0x21')]()[_0x070e('0x20')](function(){_0x5b184[_0x070e('0x1a')](0xcc)[_0x070e('0x22')]();});}};}function handleEntityNotFound(_0xa86797,_0xe405e){return function(_0x164cdf){if(!_0x164cdf){_0xa86797['sendStatus'](0x194);}return _0x164cdf;};}function handleError(_0x2f8055,_0x270061){_0x270061=_0x270061||0x1f4;return function(_0x4790eb){logger['error'](_0x4790eb[_0x070e('0x23')]);if(_0x4790eb['name']){delete _0x4790eb['name'];}_0x2f8055[_0x070e('0x1a')](_0x270061)[_0x070e('0x24')](_0x4790eb);};}exports[_0x070e('0x25')]=function(_0x1743cc,_0x4763c6){var _0x497f58={},_0x374c54={},_0x219e48={'count':0x0,'rows':[]};var _0x1d72d6=_[_0x070e('0x26')](db[_0x070e('0x27')][_0x070e('0x28')],function(_0x1a1892){return{'name':_0x1a1892[_0x070e('0x29')],'type':_0x1a1892['type'][_0x070e('0x2a')]};});_0x374c54[_0x070e('0x2b')]=_[_0x070e('0x26')](_0x1d72d6,'name');_0x374c54['query']=_[_0x070e('0x2c')](_0x1743cc[_0x070e('0x2d')]);_0x374c54[_0x070e('0x2e')]=_['intersection'](_0x374c54[_0x070e('0x2b')],_0x374c54[_0x070e('0x2d')]);_0x497f58[_0x070e('0x2f')]=_[_0x070e('0x30')](_0x374c54['model'],qs['fields'](_0x1743cc['query']['fields']));_0x497f58[_0x070e('0x2f')]=_0x497f58['attributes'][_0x070e('0x31')]?_0x497f58[_0x070e('0x2f')]:_0x374c54['model'];if(!_0x1743cc['query'][_0x070e('0x32')](_0x070e('0x33'))){_0x497f58['limit']=qs['limit'](_0x1743cc[_0x070e('0x2d')][_0x070e('0x19')]);_0x497f58[_0x070e('0x18')]=qs[_0x070e('0x18')](_0x1743cc[_0x070e('0x2d')]['offset']);}_0x497f58['order']=qs[_0x070e('0x34')](_0x1743cc[_0x070e('0x2d')][_0x070e('0x34')]);_0x497f58[_0x070e('0x35')]=qs[_0x070e('0x2e')](_['pick'](_0x1743cc[_0x070e('0x2d')],_0x374c54[_0x070e('0x2e')]),_0x1d72d6);if(_0x1743cc['query'][_0x070e('0x36')]){_0x497f58[_0x070e('0x35')]=_['merge'](_0x497f58['where'],{'$or':_['map'](_0x1d72d6,function(_0x363bff){if(_0x363bff[_0x070e('0x37')]!==_0x070e('0x38')){var _0x334733={};_0x334733[_0x363bff[_0x070e('0x39')]]={'$like':'%'+_0x1743cc['query'][_0x070e('0x36')]+'%'};return _0x334733;}})});}_0x497f58=_[_0x070e('0x3a')]({},_0x497f58,_0x1743cc[_0x070e('0x3b')]);var _0x487276={'where':_0x497f58[_0x070e('0x35')]};return db[_0x070e('0x27')][_0x070e('0x3c')](_0x487276)['then'](function(_0x13982f){_0x219e48[_0x070e('0x3c')]=_0x13982f;if(_0x1743cc['query'][_0x070e('0x3d')]){_0x497f58['include']=[{'all':!![]}];}return db[_0x070e('0x27')][_0x070e('0x3e')](_0x497f58);})[_0x070e('0x20')](function(_0x30319c){_0x219e48[_0x070e('0x3f')]=_0x30319c;return _0x219e48;})['then'](respondWithFilteredResult(_0x4763c6,_0x497f58))[_0x070e('0x40')](handleError(_0x4763c6,null));}; \ No newline at end of file +var _0xb43b=['filters','pick','filter','merge','options','count','includeAll','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','ejs','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','offset','limit','Content-Range','reject','save','update','destroy','then','end','error','stack','name','send','index','map','Migration','rawAttributes','type','model','query','intersection','fields','attributes','length','hasOwnProperty','order','sort','where'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb43b,0x1b2));var _0xbb43=function(_0x208814,_0x391b1c){_0x208814=_0x208814-0x0;var _0x27f63e=_0xb43b[_0x208814];return _0x27f63e;};'use strict';var pdf=require(_0xbb43('0x0'));var emlformat=require(_0xbb43('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xbb43('0x2'));var jsonpatch=require(_0xbb43('0x3'));var rp=require(_0xbb43('0x4'));var moment=require('moment');var BPromise=require(_0xbb43('0x5'));var Mustache=require(_0xbb43('0x6'));var util=require(_0xbb43('0x7'));var path=require(_0xbb43('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xbb43('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xbb43('0xa'));var crypto=require(_0xbb43('0xb'));var jsforce=require(_0xbb43('0xc'));var deskjs=require(_0xbb43('0xd'));var toCsv=require(_0xbb43('0xe'));var querystring=require('querystring');var Papa=require(_0xbb43('0xf'));var Redis=require(_0xbb43('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xbb43('0x11'));var as=require(_0xbb43('0x12'));var hardwareService=require(_0xbb43('0x13'));var logger=require(_0xbb43('0x14'))(_0xbb43('0x15'));var utils=require(_0xbb43('0x16'));var config=require('../../config/environment');var db=require(_0xbb43('0x17'))['db'];function respondWithStatusCode(_0x2a5a4d,_0x50e2c0){_0x50e2c0=_0x50e2c0||0xcc;return function(_0x578392){if(_0x578392){return _0x2a5a4d[_0xbb43('0x18')](_0x50e2c0);}return _0x2a5a4d['status'](_0x50e2c0)['end']();};}function respondWithResult(_0x438591,_0x5a509f){_0x5a509f=_0x5a509f||0xc8;return function(_0x68d45d){if(_0x68d45d){return _0x438591[_0xbb43('0x19')](_0x5a509f)['json'](_0x68d45d);}};}function respondWithFilteredResult(_0x4a6e18,_0x4d5bcf){return function(_0x338120){if(_0x338120){var _0x2abce0=_0x338120['count'],_0x57bd1d=_0x4d5bcf['offset'],_0x526330=_0x4d5bcf[_0xbb43('0x1a')]+_0x4d5bcf[_0xbb43('0x1b')],_0x202980;if(_0x526330>=_0x2abce0){_0x526330=_0x2abce0;_0x202980=0xc8;}else{_0x202980=0xce;}_0x4a6e18[_0xbb43('0x19')](_0x202980);return _0x4a6e18['set'](_0xbb43('0x1c'),_0x57bd1d+'-'+_0x526330+'/'+_0x2abce0)['json'](_0x338120);}return null;};}function patchUpdates(_0x3bb57d){return function(_0x8e6429){try{jsonpatch['apply'](_0x8e6429,_0x3bb57d,!![]);}catch(_0x5d765b){return BPromise[_0xbb43('0x1d')](_0x5d765b);}return _0x8e6429[_0xbb43('0x1e')]();};}function saveUpdates(_0xdb7f2e,_0x2bf2d4){return function(_0x5bcce7){if(_0x5bcce7){return _0x5bcce7[_0xbb43('0x1f')](_0xdb7f2e)['then'](function(_0x3a257d){return _0x3a257d;});}return null;};}function removeEntity(_0x4bfaca,_0x2f5e31){return function(_0x565256){if(_0x565256){return _0x565256[_0xbb43('0x20')]()[_0xbb43('0x21')](function(){_0x4bfaca['status'](0xcc)[_0xbb43('0x22')]();});}};}function handleEntityNotFound(_0x4dfb7f,_0xf24e60){return function(_0x298ce2){if(!_0x298ce2){_0x4dfb7f[_0xbb43('0x18')](0x194);}return _0x298ce2;};}function handleError(_0x4d6d77,_0x53f0d5){_0x53f0d5=_0x53f0d5||0x1f4;return function(_0x59a24d){logger[_0xbb43('0x23')](_0x59a24d[_0xbb43('0x24')]);if(_0x59a24d['name']){delete _0x59a24d[_0xbb43('0x25')];}_0x4d6d77[_0xbb43('0x19')](_0x53f0d5)[_0xbb43('0x26')](_0x59a24d);};}exports[_0xbb43('0x27')]=function(_0x4ed43f,_0x4b5342){var _0x27fd7a={},_0x42800f={},_0xa88db0={'count':0x0,'rows':[]};var _0x8b3205=_[_0xbb43('0x28')](db[_0xbb43('0x29')][_0xbb43('0x2a')],function(_0x473828){return{'name':_0x473828['fieldName'],'type':_0x473828[_0xbb43('0x2b')]['key']};});_0x42800f[_0xbb43('0x2c')]=_[_0xbb43('0x28')](_0x8b3205,_0xbb43('0x25'));_0x42800f[_0xbb43('0x2d')]=_['keys'](_0x4ed43f[_0xbb43('0x2d')]);_0x42800f['filters']=_['intersection'](_0x42800f['model'],_0x42800f[_0xbb43('0x2d')]);_0x27fd7a['attributes']=_[_0xbb43('0x2e')](_0x42800f[_0xbb43('0x2c')],qs[_0xbb43('0x2f')](_0x4ed43f['query'][_0xbb43('0x2f')]));_0x27fd7a[_0xbb43('0x30')]=_0x27fd7a[_0xbb43('0x30')][_0xbb43('0x31')]?_0x27fd7a[_0xbb43('0x30')]:_0x42800f[_0xbb43('0x2c')];if(!_0x4ed43f[_0xbb43('0x2d')][_0xbb43('0x32')]('nolimit')){_0x27fd7a[_0xbb43('0x1b')]=qs[_0xbb43('0x1b')](_0x4ed43f[_0xbb43('0x2d')][_0xbb43('0x1b')]);_0x27fd7a[_0xbb43('0x1a')]=qs[_0xbb43('0x1a')](_0x4ed43f[_0xbb43('0x2d')][_0xbb43('0x1a')]);}_0x27fd7a[_0xbb43('0x33')]=qs[_0xbb43('0x34')](_0x4ed43f[_0xbb43('0x2d')][_0xbb43('0x34')]);_0x27fd7a[_0xbb43('0x35')]=qs[_0xbb43('0x36')](_[_0xbb43('0x37')](_0x4ed43f[_0xbb43('0x2d')],_0x42800f['filters']),_0x8b3205);if(_0x4ed43f[_0xbb43('0x2d')][_0xbb43('0x38')]){_0x27fd7a['where']=_[_0xbb43('0x39')](_0x27fd7a[_0xbb43('0x35')],{'$or':_[_0xbb43('0x28')](_0x8b3205,function(_0x5374a2){if(_0x5374a2['type']!=='VIRTUAL'){var _0x40df31={};_0x40df31[_0x5374a2[_0xbb43('0x25')]]={'$like':'%'+_0x4ed43f['query']['filter']+'%'};return _0x40df31;}})});}_0x27fd7a=_[_0xbb43('0x39')]({},_0x27fd7a,_0x4ed43f[_0xbb43('0x3a')]);var _0x29f6e5={'where':_0x27fd7a[_0xbb43('0x35')]};return db[_0xbb43('0x29')]['count'](_0x29f6e5)[_0xbb43('0x21')](function(_0x526cb8){_0xa88db0[_0xbb43('0x3b')]=_0x526cb8;if(_0x4ed43f[_0xbb43('0x2d')][_0xbb43('0x3c')]){_0x27fd7a['include']=[{'all':!![]}];}return db[_0xbb43('0x29')]['findAll'](_0x27fd7a);})[_0xbb43('0x21')](function(_0x93aa1c){_0xa88db0['rows']=_0x93aa1c;return _0xa88db0;})[_0xbb43('0x21')](respondWithFilteredResult(_0x4b5342,_0x27fd7a))['catch'](handleError(_0x4b5342,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index d77b462..df408f9 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 _0x096d=['../../config/environment','./migration.attributes','exports','define','Migration','migrations','util','../../config/logger','moment','request-promise','path'];(function(_0xf3c843,_0x8ff24e){var _0x3191c6=function(_0x2f1ef7){while(--_0x2f1ef7){_0xf3c843['push'](_0xf3c843['shift']());}};_0x3191c6(++_0x8ff24e);}(_0x096d,0x15b));var _0xd096=function(_0x150bbe,_0x412085){_0x150bbe=_0x150bbe-0x0;var _0x3418d5=_0x096d[_0x150bbe];return _0x3418d5;};'use strict';var _=require('lodash');var util=require(_0xd096('0x0'));var logger=require(_0xd096('0x1'))('api');var moment=require(_0xd096('0x2'));var BPromise=require('bluebird');var rp=require(_0xd096('0x3'));var fs=require('fs');var path=require(_0xd096('0x4'));var rimraf=require('rimraf');var config=require(_0xd096('0x5'));var attributes=require(_0xd096('0x6'));module[_0xd096('0x7')]=function(_0x3e4a20,_0x3be181){return _0x3e4a20[_0xd096('0x8')](_0xd096('0x9'),attributes,{'tableName':_0xd096('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0538=['../../config/logger','api','request-promise','../../config/environment','./migration.attributes','Migration','migrations','util'];(function(_0x1030ce,_0xbe3f74){var _0x3367fd=function(_0x387153){while(--_0x387153){_0x1030ce['push'](_0x1030ce['shift']());}};_0x3367fd(++_0xbe3f74);}(_0x0538,0x12f));var _0x8053=function(_0x1f44e4,_0x22d9fd){_0x1f44e4=_0x1f44e4-0x0;var _0x591989=_0x0538[_0x1f44e4];return _0x591989;};'use strict';var _=require('lodash');var util=require(_0x8053('0x0'));var logger=require(_0x8053('0x1'))(_0x8053('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8053('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8053('0x4'));var attributes=require(_0x8053('0x5'));module['exports']=function(_0x5698c6,_0x1d22d8){return _0x5698c6['define'](_0x8053('0x6'),attributes,{'tableName':_0x8053('0x7'),'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 9965abd..4cb4900 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 _0x7610=['moment','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','request','then','info','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash'];(function(_0x3cfb49,_0x466add){var _0x3b1fc5=function(_0x3d8dc1){while(--_0x3d8dc1){_0x3cfb49['push'](_0x3cfb49['shift']());}};_0x3b1fc5(++_0x466add);}(_0x7610,0x167));var _0x0761=function(_0x4bd737,_0x2eaea5){_0x4bd737=_0x4bd737-0x0;var _0x5e170a=_0x7610[_0x4bd737];return _0x5e170a;};'use strict';var _=require(_0x0761('0x0'));var util=require('util');var moment=require(_0x0761('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0761('0x2'));var db=require(_0x0761('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x0761('0x4'));var config=require(_0x0761('0x5'));var jayson=require(_0x0761('0x6'));var client=jayson['client'][_0x0761('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1741a4,_0x4e1816,_0x464c67){return new BPromise(function(_0x1cb241,_0x332704){return client[_0x0761('0x8')](_0x1741a4,_0x464c67)[_0x0761('0x9')](function(_0x596bda){logger[_0x0761('0xa')](_0x0761('0xb'),_0x4e1816,_0x0761('0xc'));logger[_0x0761('0xd')](_0x0761('0xe'),_0x4e1816,'request\x20sent',JSON[_0x0761('0xf')](_0x596bda));if(_0x596bda['error']){if(_0x596bda[_0x0761('0x10')][_0x0761('0x11')]===0x1f4){logger['error']('Migration,\x20%s,\x20%s',_0x4e1816,_0x596bda['error']['message']);return _0x332704(_0x596bda['error'][_0x0761('0x12')]);}logger[_0x0761('0x10')](_0x0761('0xb'),_0x4e1816,_0x596bda[_0x0761('0x10')]['message']);return _0x1cb241(_0x596bda[_0x0761('0x10')][_0x0761('0x12')]);}else{logger[_0x0761('0xa')]('Migration,\x20%s,\x20%s',_0x4e1816,'request\x20sent');_0x1cb241(_0x596bda['result']['message']);}})[_0x0761('0x13')](function(_0x1c379f){logger[_0x0761('0x10')](_0x0761('0xb'),_0x4e1816,_0x1c379f);_0x332704(_0x1c379f);});});} \ No newline at end of file +var _0x3275=['bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','Migration,\x20%s,\x20%s','message','result','lodash','util'];(function(_0x1e5326,_0x123058){var _0xc7ca8e=function(_0x13be1f){while(--_0x13be1f){_0x1e5326['push'](_0x1e5326['shift']());}};_0xc7ca8e(++_0x123058);}(_0x3275,0x1e1));var _0x5327=function(_0x3ffb48,_0x133d2d){_0x3ffb48=_0x3ffb48-0x0;var _0x55ed4c=_0x3275[_0x3ffb48];return _0x55ed4c;};'use strict';var _=require(_0x5327('0x0'));var util=require(_0x5327('0x1'));var moment=require('moment');var BPromise=require(_0x5327('0x2'));var rs=require(_0x5327('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5327('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x5327('0x5'))(_0x5327('0x6'));var config=require('../../config/environment');var jayson=require(_0x5327('0x7'));var client=jayson[_0x5327('0x8')][_0x5327('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x37f7ef,_0x58443b,_0x4d0be0){return new BPromise(function(_0x2d9a3e,_0x5cf8d1){return client[_0x5327('0xa')](_0x37f7ef,_0x4d0be0)[_0x5327('0xb')](function(_0x2b8ef5){logger[_0x5327('0xc')]('Migration,\x20%s,\x20%s',_0x58443b,_0x5327('0xd'));logger[_0x5327('0xe')](_0x5327('0xf'),_0x58443b,'request\x20sent',JSON[_0x5327('0x10')](_0x2b8ef5));if(_0x2b8ef5['error']){if(_0x2b8ef5[_0x5327('0x11')]['code']===0x1f4){logger[_0x5327('0x11')](_0x5327('0x12'),_0x58443b,_0x2b8ef5[_0x5327('0x11')][_0x5327('0x13')]);return _0x5cf8d1(_0x2b8ef5['error'][_0x5327('0x13')]);}logger[_0x5327('0x11')](_0x5327('0x12'),_0x58443b,_0x2b8ef5[_0x5327('0x11')][_0x5327('0x13')]);return _0x2d9a3e(_0x2b8ef5['error'][_0x5327('0x13')]);}else{logger[_0x5327('0xc')](_0x5327('0x12'),_0x58443b,_0x5327('0xd'));_0x2d9a3e(_0x2b8ef5[_0x5327('0x14')][_0x5327('0x13')]);}})['catch'](function(_0x1e04c3){logger[_0x5327('0x11')](_0x5327('0x12'),_0x58443b,_0x1e04c3);_0x5cf8d1(_0x1e04c3);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 3988494..99e4af6 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 _0x1d3c=['isAuthenticated','index','/:id','show','create','put','multer','util','path','connect-timeout','express','Router','../../config/environment','./network.controller','get'];(function(_0x3819f4,_0x1e1b98){var _0x32166e=function(_0xb77a03){while(--_0xb77a03){_0x3819f4['push'](_0x3819f4['shift']());}};_0x32166e(++_0x1e1b98);}(_0x1d3c,0x6f));var _0xc1d3=function(_0x258fb0,_0x5362dc){_0x258fb0=_0x258fb0-0x0;var _0x4d1afe=_0x1d3c[_0x258fb0];return _0x4d1afe;};'use strict';var multer=require(_0xc1d3('0x0'));var util=require(_0xc1d3('0x1'));var path=require(_0xc1d3('0x2'));var timeout=require(_0xc1d3('0x3'));var express=require(_0xc1d3('0x4'));var router=express[_0xc1d3('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc1d3('0x6'));var controller=require(_0xc1d3('0x7'));router[_0xc1d3('0x8')]('/',auth[_0xc1d3('0x9')](),controller[_0xc1d3('0xa')]);router[_0xc1d3('0x8')](_0xc1d3('0xb'),auth[_0xc1d3('0x9')](),controller[_0xc1d3('0xc')]);router['post']('/',auth[_0xc1d3('0x9')](),controller[_0xc1d3('0xd')]);router[_0xc1d3('0xe')](_0xc1d3('0xb'),auth[_0xc1d3('0x9')](),controller['update']);router['delete'](_0xc1d3('0xb'),auth[_0xc1d3('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x325a=['../../components/interaction/service','../../config/environment','./network.controller','get','index','/:id','isAuthenticated','show','post','create','delete','destroy','multer','util','connect-timeout','express','../../components/auth/service'];(function(_0x55e5b8,_0x1fd4c9){var _0x4cbd32=function(_0x5684c4){while(--_0x5684c4){_0x55e5b8['push'](_0x55e5b8['shift']());}};_0x4cbd32(++_0x1fd4c9);}(_0x325a,0x1b5));var _0xa325=function(_0x2a8310,_0x253674){_0x2a8310=_0x2a8310-0x0;var _0x5bdb53=_0x325a[_0x2a8310];return _0x5bdb53;};'use strict';var multer=require(_0xa325('0x0'));var util=require(_0xa325('0x1'));var path=require('path');var timeout=require(_0xa325('0x2'));var express=require(_0xa325('0x3'));var router=express['Router']();var auth=require(_0xa325('0x4'));var interaction=require(_0xa325('0x5'));var config=require(_0xa325('0x6'));var controller=require(_0xa325('0x7'));router[_0xa325('0x8')]('/',auth['isAuthenticated'](),controller[_0xa325('0x9')]);router[_0xa325('0x8')](_0xa325('0xa'),auth[_0xa325('0xb')](),controller[_0xa325('0xc')]);router[_0xa325('0xd')]('/',auth[_0xa325('0xb')](),controller[_0xa325('0xe')]);router['put'](_0xa325('0xa'),auth['isAuthenticated'](),controller['update']);router[_0xa325('0xf')](_0xa325('0xa'),auth[_0xa325('0xb')](),controller[_0xa325('0x10')]);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 b3a8e8f..dccd769 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(_0x5270ec,_0x43e2f4){var _0x3a6b14=function(_0x42e76d){while(--_0x42e76d){_0x5270ec['push'](_0x5270ec['shift']());}};_0x3a6b14(++_0x43e2f4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0xa9e0[_0x29b609];return _0x54c952;};'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(_0xb7229f,_0x329f36){var _0x271404=function(_0xc40b44){while(--_0xc40b44){_0xb7229f['push'](_0xb7229f['shift']());}};_0x271404(++_0x329f36);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0xa9e0[_0x1b349a];return _0x5d1f7c;};'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 e766d26..552aefd 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 _0x427f=['ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','Network,\x20%s,\x20%s','Network,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','save','update','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','include','findAll','rows','show','params','Network','intersection','length','includeAll','options','find','sequelize','create','body','toUpperCase','STUN','utf8','render','res_stun_monitor.so','TURN','readFileSync','root','server/files/templates/turn_multiple.ejs','writeFileSync','/etc/asterisk/turn_xcally.conf','Reload','join','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','server/files/templates/stun_multiple.ejs','server/files/templates/network.ejs','destroy','/etc/asterisk/stun_xcally.conf','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','test','Sequelize'];(function(_0x1110a2,_0x8a69de){var _0x12b069=function(_0x3c239f){while(--_0x3c239f){_0x1110a2['push'](_0x1110a2['shift']());}};_0x12b069(++_0x8a69de);}(_0x427f,0xc4));var _0xf427=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x427f[_0x2f5ac5];return _0x37c9a8;};'use strict';var pdf=require(_0xf427('0x0'));var emlformat=require(_0xf427('0x1'));var rimraf=require(_0xf427('0x2'));var zipdir=require(_0xf427('0x3'));var jsonpatch=require(_0xf427('0x4'));var rp=require(_0xf427('0x5'));var moment=require(_0xf427('0x6'));var BPromise=require(_0xf427('0x7'));var Mustache=require('mustache');var util=require(_0xf427('0x8'));var path=require(_0xf427('0x9'));var sox=require(_0xf427('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xf427('0xb'));var squel=require(_0xf427('0xc'));var crypto=require(_0xf427('0xd'));var jsforce=require(_0xf427('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf427('0xf'));var Papa=require(_0xf427('0x10'));var Redis=require(_0xf427('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xf427('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf427('0x13'));var logger=require(_0xf427('0x14'))(_0xf427('0x15'));var utils=require(_0xf427('0x16'));var config=require(_0xf427('0x17'));var db=require(_0xf427('0x18'))['db'];var jayson=require(_0xf427('0x19'));var client=jayson[_0xf427('0x1a')][_0xf427('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x558096,_0x46657e,_0x4ea2e1){if(_0x4ea2e1){var _0x1ba0f1=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1ba0f1[_0xf427('0x1c')](_0x46657e)){return _0x558096;}else{throw new db[(_0xf427('0x1d'))][(_0xf427('0x1e'))](_0xf427('0x1f'));}}else{return _0x558096;}}function respondWithRpcPromise(_0x397fce,_0x20a92a,_0x2f0c5b,_0x5ed5a8){return new BPromise(function(_0x5e5ec8,_0x1a512a){var _0x5a762e=_0x5ed5a8||client;return _0x5a762e[_0xf427('0x20')](_0x397fce,_0x2f0c5b)[_0xf427('0x21')](function(_0x4133a2){logger[_0xf427('0x22')](_0xf427('0x23'),_0x20a92a,'request\x20sent');logger['debug'](_0xf427('0x24'),_0x20a92a,_0xf427('0x25'),JSON[_0xf427('0x26')](_0x4133a2));if(_0x4133a2[_0xf427('0x27')]){if(_0x4133a2[_0xf427('0x27')]['code']===0x1f4){logger[_0xf427('0x27')]('Network,\x20%s,\x20%s',_0x20a92a,_0x4133a2[_0xf427('0x27')][_0xf427('0x28')]);return _0x1a512a(_0x4133a2['error'][_0xf427('0x28')]);}logger[_0xf427('0x27')](_0xf427('0x23'),_0x20a92a,_0x4133a2[_0xf427('0x27')]['message']);return _0x5e5ec8(_0x4133a2[_0xf427('0x27')][_0xf427('0x28')]);}else{logger[_0xf427('0x22')](_0xf427('0x23'),_0x20a92a,_0xf427('0x25'));_0x5e5ec8(_0x4133a2[_0xf427('0x29')][_0xf427('0x28')]);}})[_0xf427('0x2a')](function(_0x570e1c){logger[_0xf427('0x27')](_0xf427('0x23'),_0x20a92a,_0x570e1c);_0x1a512a(_0x570e1c);});});}function respondWithStatusCode(_0x305325,_0x12ee6d){_0x12ee6d=_0x12ee6d||0xcc;return function(_0x1cac3a){if(_0x1cac3a){return _0x305325[_0xf427('0x2b')](_0x12ee6d);}return _0x305325[_0xf427('0x2c')](_0x12ee6d)[_0xf427('0x2d')]();};}function respondWithResult(_0x17975e,_0x1bc62d){_0x1bc62d=_0x1bc62d||0xc8;return function(_0x41979c){if(_0x41979c){return _0x17975e[_0xf427('0x2c')](_0x1bc62d)[_0xf427('0x2e')](_0x41979c);}};}function respondWithFilteredResult(_0x3ae464,_0x1edfb4){return function(_0x157f22){if(_0x157f22){var _0x28c012=_0x157f22[_0xf427('0x2f')],_0x5909d5=_0x1edfb4['offset'],_0x3eabde=_0x1edfb4[_0xf427('0x30')]+_0x1edfb4[_0xf427('0x31')],_0xc5d0cd;if(_0x3eabde>=_0x28c012){_0x3eabde=_0x28c012;_0xc5d0cd=0xc8;}else{_0xc5d0cd=0xce;}_0x3ae464[_0xf427('0x2c')](_0xc5d0cd);return _0x3ae464[_0xf427('0x32')](_0xf427('0x33'),_0x5909d5+'-'+_0x3eabde+'/'+_0x28c012)['json'](_0x157f22);}return null;};}function patchUpdates(_0x339331){return function(_0x3aa827){try{jsonpatch['apply'](_0x3aa827,_0x339331,!![]);}catch(_0x43115c){return BPromise['reject'](_0x43115c);}return _0x3aa827[_0xf427('0x34')]();};}function saveUpdates(_0x35b344,_0x2c2345){return function(_0x2c109f){if(_0x2c109f){return _0x2c109f[_0xf427('0x35')](_0x35b344)[_0xf427('0x21')](function(_0x23327e){return _0x23327e;});}return null;};}function removeEntity(_0x5f458a,_0x59a89d){return function(_0x85d395){if(_0x85d395){return _0x85d395['destroy']()[_0xf427('0x21')](function(){_0x5f458a[_0xf427('0x2c')](0xcc)[_0xf427('0x2d')]();});}};}function handleEntityNotFound(_0x14571a,_0x196976){return function(_0x300346){if(!_0x300346){_0x14571a[_0xf427('0x2b')](0x194);}return _0x300346;};}function handleError(_0x2b1cef,_0x3f733a){_0x3f733a=_0x3f733a||0x1f4;return function(_0x53cb96){logger[_0xf427('0x27')](_0x53cb96[_0xf427('0x36')]);if(_0x53cb96['name']){delete _0x53cb96[_0xf427('0x37')];}_0x2b1cef['status'](_0x3f733a)[_0xf427('0x38')](_0x53cb96);};}exports[_0xf427('0x39')]=function(_0x26f029,_0x293c96){var _0x356085={},_0x32cf36={},_0x1f26fc={'count':0x0,'rows':[]};var _0x529a89=_['map'](db['Network'][_0xf427('0x3a')],function(_0x5d9ac7){return{'name':_0x5d9ac7[_0xf427('0x3b')],'type':_0x5d9ac7[_0xf427('0x3c')][_0xf427('0x3d')]};});_0x32cf36[_0xf427('0x3e')]=_[_0xf427('0x3f')](_0x529a89,'name');_0x32cf36[_0xf427('0x40')]=_[_0xf427('0x41')](_0x26f029[_0xf427('0x40')]);_0x32cf36[_0xf427('0x42')]=_['intersection'](_0x32cf36[_0xf427('0x3e')],_0x32cf36[_0xf427('0x40')]);_0x356085['attributes']=_['intersection'](_0x32cf36[_0xf427('0x3e')],qs[_0xf427('0x43')](_0x26f029[_0xf427('0x40')]['fields']));_0x356085[_0xf427('0x44')]=_0x356085[_0xf427('0x44')]['length']?_0x356085['attributes']:_0x32cf36['model'];if(!_0x26f029[_0xf427('0x40')][_0xf427('0x45')](_0xf427('0x46'))){_0x356085[_0xf427('0x31')]=qs[_0xf427('0x31')](_0x26f029['query'][_0xf427('0x31')]);_0x356085[_0xf427('0x30')]=qs[_0xf427('0x30')](_0x26f029[_0xf427('0x40')][_0xf427('0x30')]);}_0x356085[_0xf427('0x47')]=qs[_0xf427('0x48')](_0x26f029[_0xf427('0x40')][_0xf427('0x48')]);_0x356085['where']=qs[_0xf427('0x42')](_[_0xf427('0x49')](_0x26f029[_0xf427('0x40')],_0x32cf36[_0xf427('0x42')]),_0x529a89);if(_0x26f029[_0xf427('0x40')][_0xf427('0x4a')]){_0x356085[_0xf427('0x4b')]=_[_0xf427('0x4c')](_0x356085[_0xf427('0x4b')],{'$or':_[_0xf427('0x3f')](_0x529a89,function(_0x2a7a1f){if(_0x2a7a1f[_0xf427('0x3c')]!==_0xf427('0x4d')){var _0x22ab77={};_0x22ab77[_0x2a7a1f['name']]={'$like':'%'+_0x26f029[_0xf427('0x40')][_0xf427('0x4a')]+'%'};return _0x22ab77;}})});}_0x356085=_[_0xf427('0x4c')]({},_0x356085,_0x26f029['options']);var _0x59cb59={'where':_0x356085['where']};return db['Network'][_0xf427('0x2f')](_0x59cb59)[_0xf427('0x21')](function(_0xb0a8f4){_0x1f26fc['count']=_0xb0a8f4;if(_0x26f029[_0xf427('0x40')]['includeAll']){_0x356085[_0xf427('0x4e')]=[{'all':!![]}];}return db['Network'][_0xf427('0x4f')](_0x356085);})[_0xf427('0x21')](function(_0x207dac){_0x1f26fc[_0xf427('0x50')]=_0x207dac;return _0x1f26fc;})[_0xf427('0x21')](respondWithFilteredResult(_0x293c96,_0x356085))[_0xf427('0x2a')](handleError(_0x293c96,null));};exports[_0xf427('0x51')]=function(_0x5c2cce,_0x2ca267){var _0x197856={'raw':!![],'where':{'id':_0x5c2cce[_0xf427('0x52')]['id']}},_0x45500a={};_0x45500a[_0xf427('0x3e')]=_[_0xf427('0x41')](db[_0xf427('0x53')][_0xf427('0x3a')]);_0x45500a[_0xf427('0x40')]=_['keys'](_0x5c2cce[_0xf427('0x40')]);_0x45500a['filters']=_[_0xf427('0x54')](_0x45500a[_0xf427('0x3e')],_0x45500a['query']);_0x197856['attributes']=_[_0xf427('0x54')](_0x45500a[_0xf427('0x3e')],qs[_0xf427('0x43')](_0x5c2cce['query'][_0xf427('0x43')]));_0x197856[_0xf427('0x44')]=_0x197856[_0xf427('0x44')][_0xf427('0x55')]?_0x197856[_0xf427('0x44')]:_0x45500a[_0xf427('0x3e')];if(_0x5c2cce[_0xf427('0x40')][_0xf427('0x56')]){_0x197856[_0xf427('0x4e')]=[{'all':!![]}];}_0x197856=_[_0xf427('0x4c')]({},_0x197856,_0x5c2cce[_0xf427('0x57')]);return db[_0xf427('0x53')][_0xf427('0x58')](_0x197856)['then'](handleEntityNotFound(_0x2ca267,null))['then'](respondWithResult(_0x2ca267,null))[_0xf427('0x2a')](handleError(_0x2ca267,null));};exports['create']=function(_0x2d9cfb,_0x4a2835,_0x2af7fa){var _0x12c54c;return db[_0xf427('0x59')]['transaction'](function(_0x372be5){return db['Network'][_0xf427('0x5a')](_0x2d9cfb[_0xf427('0x5b')],{'raw':!![]})['then'](function(_0x50f66f){_0x12c54c=_0x50f66f;return db['Network'][_0xf427('0x4f')]({'where':{'type':_0x2d9cfb[_0xf427('0x5b')][_0xf427('0x3c')]},'raw':!![]});})[_0xf427('0x21')](function(_0x274a3f){if(_0x12c54c['type'][_0xf427('0x5c')]()==_0xf427('0x5d')){var _0x46b1ca=fs['readFileSync'](path['join'](config['root'],'server/files/templates/stun_multiple.ejs'),_0xf427('0x5e'));var _0x5b8927=ejs[_0xf427('0x5f')](_0x46b1ca,{'networks':_0x274a3f||[]});fs['writeFileSync']('/etc/asterisk/stun_xcally.conf',_0x5b8927);return respondWithRpcPromise('Reload','create',{'module':_0xf427('0x60')});}else if(_0x12c54c[_0xf427('0x3c')]['toUpperCase']()==_0xf427('0x61')){var _0x32f3f1=fs[_0xf427('0x62')](path['join'](config[_0xf427('0x63')],_0xf427('0x64')),_0xf427('0x5e'));var _0x1e15f8=ejs[_0xf427('0x5f')](_0x32f3f1,{'networks':_0x274a3f||[]});fs[_0xf427('0x65')](_0xf427('0x66'),_0x1e15f8);return respondWithRpcPromise(_0xf427('0x67'),_0xf427('0x5a'),{'module':_0xf427('0x60')});}else{var _0x4af236=fs[_0xf427('0x62')](path[_0xf427('0x68')](config[_0xf427('0x63')],'server/files/templates/network.ejs'),_0xf427('0x5e'));var _0x83a989=ejs[_0xf427('0x5f')](_0x4af236,{'networks':_0x274a3f||[]});fs[_0xf427('0x65')](util[_0xf427('0x69')](_0xf427('0x6a'),_0x2d9cfb['body'][_0xf427('0x3c')][_0xf427('0x6b')]()),_0x83a989);return respondWithRpcPromise('Reload',_0xf427('0x5a'),{'module':_0xf427('0x6c')});}return null;})[_0xf427('0x21')](function(){return _0x12c54c;});})['then'](respondWithResult(_0x4a2835,0xc9))[_0xf427('0x2a')](handleError(_0x4a2835,null));};exports[_0xf427('0x35')]=function(_0x331a3e,_0x3c1b4f,_0x3973aa){var _0x40bac0;return db[_0xf427('0x59')]['transaction'](function(_0x432cb9){return db['Network'][_0xf427('0x58')]({'where':{'id':_0x331a3e['params']['id']}})[_0xf427('0x21')](handleEntityNotFound(_0x3c1b4f,null))[_0xf427('0x21')](saveUpdates(_0x331a3e[_0xf427('0x5b')],null))[_0xf427('0x21')](function(_0x4a1067){if(_0x4a1067){_0x40bac0=_0x4a1067;return db[_0xf427('0x53')][_0xf427('0x4f')]({'where':{'type':_0x40bac0[_0xf427('0x3c')]},'raw':!![]});}return null;})[_0xf427('0x21')](function(_0x3cf752){if(_0x40bac0['type'][_0xf427('0x5c')]()==_0xf427('0x5d')){var _0x1cd96e=fs[_0xf427('0x62')](path[_0xf427('0x68')](config['root'],_0xf427('0x6d')),_0xf427('0x5e'));var _0x5ced40=ejs[_0xf427('0x5f')](_0x1cd96e,{'networks':_0x3cf752||[]});fs[_0xf427('0x65')]('/etc/asterisk/stun_xcally.conf',_0x5ced40);return respondWithRpcPromise(_0xf427('0x67'),_0xf427('0x35'),{'module':_0xf427('0x60')});}else if(_0x40bac0[_0xf427('0x3c')][_0xf427('0x5c')]()=='TURN'){var _0x5f485f=fs[_0xf427('0x62')](path['join'](config[_0xf427('0x63')],_0xf427('0x64')),_0xf427('0x5e'));var _0x51c9ea=ejs[_0xf427('0x5f')](_0x5f485f,{'networks':_0x3cf752||[]});fs[_0xf427('0x65')](_0xf427('0x66'),_0x51c9ea);return respondWithRpcPromise('Reload',_0xf427('0x35'),{'module':'res_stun_monitor.so'});}else{var _0x2650a9=fs[_0xf427('0x62')](path['join'](config[_0xf427('0x63')],_0xf427('0x6e')),_0xf427('0x5e'));var _0x27e05e=ejs['render'](_0x2650a9,{'networks':_0x3cf752||[]});fs[_0xf427('0x65')](util[_0xf427('0x69')](_0xf427('0x6a'),_0x331a3e['body'][_0xf427('0x3c')]['toLowerCase']()),_0x27e05e);return respondWithRpcPromise('Reload','update',{'module':_0xf427('0x6c')});}return null;})[_0xf427('0x21')](function(_0x13902b){if(_0x13902b){return _0x40bac0;}return null;});})[_0xf427('0x21')](respondWithResult(_0x3c1b4f,null))[_0xf427('0x2a')](handleError(_0x3c1b4f,null));};exports[_0xf427('0x6f')]=function(_0x4e8f2b,_0x4ed2a9,_0xd1559a){var _0x43ab78;return db[_0xf427('0x53')][_0xf427('0x58')]({'where':{'id':_0x4e8f2b[_0xf427('0x52')]['id']}})['then'](function(_0x5e942f){_0x43ab78=_0x5e942f;return _0x5e942f;})[_0xf427('0x21')](handleEntityNotFound(_0x4ed2a9,null))[_0xf427('0x21')](removeEntity(_0x4ed2a9,null))[_0xf427('0x21')](function(){if(_0x43ab78){return db[_0xf427('0x53')][_0xf427('0x4f')]({'where':{'type':_0x43ab78[_0xf427('0x3c')]},'raw':!![]});}})['then'](function(_0x7746e){if(_0x43ab78['type'][_0xf427('0x5c')]()==_0xf427('0x5d')){var _0x5d148=fs[_0xf427('0x62')](path[_0xf427('0x68')](config[_0xf427('0x63')],_0xf427('0x6d')),_0xf427('0x5e'));var _0x346b18=ejs[_0xf427('0x5f')](_0x5d148,{'networks':_0x7746e||[]});fs[_0xf427('0x65')](_0xf427('0x70'),_0x346b18);return respondWithRpcPromise(_0xf427('0x67'),_0xf427('0x6f'),{'module':'res_stun_monitor.so'});}else if(_0x43ab78[_0xf427('0x3c')][_0xf427('0x5c')]()==_0xf427('0x61')){var _0x166d24=fs['readFileSync'](path[_0xf427('0x68')](config[_0xf427('0x63')],'server/files/templates/turn_multiple.ejs'),_0xf427('0x5e'));var _0x42893f=ejs[_0xf427('0x5f')](_0x166d24,{'networks':_0x7746e||[]});fs['writeFileSync']('/etc/asterisk/turn_xcally.conf',_0x42893f);return respondWithRpcPromise(_0xf427('0x67'),_0xf427('0x6f'),{'module':'res_stun_monitor.so'});}else{var _0x1c9732=fs['readFileSync'](path[_0xf427('0x68')](config[_0xf427('0x63')],_0xf427('0x6e')),_0xf427('0x5e'));var _0xe097ad=ejs['render'](_0x1c9732,{'networks':_0x7746e||[]});fs['writeFileSync'](util[_0xf427('0x69')](_0xf427('0x6a'),_0x4e8f2b[_0xf427('0x5b')]['type'][_0xf427('0x6b')]()),_0xe097ad);return respondWithRpcPromise(_0xf427('0x67'),'destroy',{'module':_0xf427('0x6c')});}return null;})['catch'](handleError(_0x4ed2a9,null));}; \ No newline at end of file +var _0x5078=['stringify','code','Network,\x20%s,\x20%s','error','message','result','status','json','offset','limit','set','apply','reject','save','update','end','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','count','includeAll','include','rows','show','params','Network','find','create','sequelize','transaction','body','toUpperCase','STUN','readFileSync','root','server/files/templates/stun_multiple.ejs','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','TURN','server/files/templates/turn_multiple.ejs','utf8','join','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','catch','findAll','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','destroy','chan_sip.so','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','jayson/promise','client','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~!@#$%^&-_=+[{]}.','request','then','info','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s'];(function(_0x36f2b2,_0x4dea08){var _0x4a0f99=function(_0x5442b9){while(--_0x5442b9){_0x36f2b2['push'](_0x36f2b2['shift']());}};_0x4a0f99(++_0x4dea08);}(_0x5078,0x126));var _0x8507=function(_0x412818,_0xe8171a){_0x412818=_0x412818-0x0;var _0x2d40d1=_0x5078[_0x412818];return _0x2d40d1;};'use strict';var pdf=require(_0x8507('0x0'));var emlformat=require(_0x8507('0x1'));var rimraf=require(_0x8507('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8507('0x3'));var rp=require(_0x8507('0x4'));var moment=require(_0x8507('0x5'));var BPromise=require(_0x8507('0x6'));var Mustache=require(_0x8507('0x7'));var util=require('util');var path=require(_0x8507('0x8'));var sox=require(_0x8507('0x9'));var csv=require(_0x8507('0xa'));var ejs=require(_0x8507('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x8507('0xc'));var crypto=require(_0x8507('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8507('0xe'));var Redis=require(_0x8507('0xf'));var authService=require(_0x8507('0x10'));var qs=require(_0x8507('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8507('0x12'));var logger=require(_0x8507('0x13'))('api');var utils=require(_0x8507('0x14'));var config=require('../../config/environment');var db=require(_0x8507('0x15'))['db'];var jayson=require(_0x8507('0x16'));var client=jayson[_0x8507('0x17')]['http']({'port':0x232a});function checkPasswordPattern(_0x33c817,_0x5c7d98,_0x3779a5){if(_0x3779a5){var _0x273fe2=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x273fe2[_0x8507('0x18')](_0x5c7d98)){return _0x33c817;}else{throw new db[(_0x8507('0x19'))]['ValidationError'](_0x8507('0x1a'));}}else{return _0x33c817;}}function respondWithRpcPromise(_0x421947,_0x4ecd9e,_0x134699,_0x3364a2){return new BPromise(function(_0x14f965,_0x24d3a2){var _0x14aebf=_0x3364a2||client;return _0x14aebf[_0x8507('0x1b')](_0x421947,_0x134699)[_0x8507('0x1c')](function(_0x104415){logger[_0x8507('0x1d')]('Network,\x20%s,\x20%s',_0x4ecd9e,_0x8507('0x1e'));logger[_0x8507('0x1f')](_0x8507('0x20'),_0x4ecd9e,'request\x20sent',JSON[_0x8507('0x21')](_0x104415));if(_0x104415['error']){if(_0x104415['error'][_0x8507('0x22')]===0x1f4){logger['error'](_0x8507('0x23'),_0x4ecd9e,_0x104415[_0x8507('0x24')][_0x8507('0x25')]);return _0x24d3a2(_0x104415[_0x8507('0x24')][_0x8507('0x25')]);}logger[_0x8507('0x24')](_0x8507('0x23'),_0x4ecd9e,_0x104415[_0x8507('0x24')][_0x8507('0x25')]);return _0x14f965(_0x104415[_0x8507('0x24')][_0x8507('0x25')]);}else{logger[_0x8507('0x1d')](_0x8507('0x23'),_0x4ecd9e,'request\x20sent');_0x14f965(_0x104415[_0x8507('0x26')][_0x8507('0x25')]);}})['catch'](function(_0x44de0d){logger[_0x8507('0x24')](_0x8507('0x23'),_0x4ecd9e,_0x44de0d);_0x24d3a2(_0x44de0d);});});}function respondWithStatusCode(_0x10ec41,_0x5257e4){_0x5257e4=_0x5257e4||0xcc;return function(_0x16bf79){if(_0x16bf79){return _0x10ec41['sendStatus'](_0x5257e4);}return _0x10ec41[_0x8507('0x27')](_0x5257e4)['end']();};}function respondWithResult(_0x2aa2f9,_0x327167){_0x327167=_0x327167||0xc8;return function(_0x7febf){if(_0x7febf){return _0x2aa2f9[_0x8507('0x27')](_0x327167)[_0x8507('0x28')](_0x7febf);}};}function respondWithFilteredResult(_0x32e930,_0x3dd268){return function(_0x2d5e42){if(_0x2d5e42){var _0x1209fe=_0x2d5e42['count'],_0x4fd674=_0x3dd268[_0x8507('0x29')],_0x25118c=_0x3dd268[_0x8507('0x29')]+_0x3dd268[_0x8507('0x2a')],_0x4b65ac;if(_0x25118c>=_0x1209fe){_0x25118c=_0x1209fe;_0x4b65ac=0xc8;}else{_0x4b65ac=0xce;}_0x32e930['status'](_0x4b65ac);return _0x32e930[_0x8507('0x2b')]('Content-Range',_0x4fd674+'-'+_0x25118c+'/'+_0x1209fe)[_0x8507('0x28')](_0x2d5e42);}return null;};}function patchUpdates(_0x38427c){return function(_0x41b294){try{jsonpatch[_0x8507('0x2c')](_0x41b294,_0x38427c,!![]);}catch(_0x5e5fa6){return BPromise[_0x8507('0x2d')](_0x5e5fa6);}return _0x41b294[_0x8507('0x2e')]();};}function saveUpdates(_0x303153,_0x407ab7){return function(_0x1b5baa){if(_0x1b5baa){return _0x1b5baa[_0x8507('0x2f')](_0x303153)['then'](function(_0x4620a9){return _0x4620a9;});}return null;};}function removeEntity(_0x1a668e,_0x2d2a06){return function(_0x3677a1){if(_0x3677a1){return _0x3677a1['destroy']()[_0x8507('0x1c')](function(){_0x1a668e[_0x8507('0x27')](0xcc)[_0x8507('0x30')]();});}};}function handleEntityNotFound(_0x4a8a55,_0x4c9f69){return function(_0x2bd2b9){if(!_0x2bd2b9){_0x4a8a55[_0x8507('0x31')](0x194);}return _0x2bd2b9;};}function handleError(_0x227ec2,_0x5b686f){_0x5b686f=_0x5b686f||0x1f4;return function(_0x3977d1){logger[_0x8507('0x24')](_0x3977d1[_0x8507('0x32')]);if(_0x3977d1[_0x8507('0x33')]){delete _0x3977d1[_0x8507('0x33')];}_0x227ec2[_0x8507('0x27')](_0x5b686f)[_0x8507('0x34')](_0x3977d1);};}exports[_0x8507('0x35')]=function(_0x2eddf2,_0x1c1f4c){var _0x41573a={},_0xc51304={},_0x5d1c43={'count':0x0,'rows':[]};var _0x3e9171=_[_0x8507('0x36')](db['Network'][_0x8507('0x37')],function(_0x793a41){return{'name':_0x793a41[_0x8507('0x38')],'type':_0x793a41[_0x8507('0x39')][_0x8507('0x3a')]};});_0xc51304[_0x8507('0x3b')]=_[_0x8507('0x36')](_0x3e9171,_0x8507('0x33'));_0xc51304[_0x8507('0x3c')]=_[_0x8507('0x3d')](_0x2eddf2[_0x8507('0x3c')]);_0xc51304['filters']=_[_0x8507('0x3e')](_0xc51304[_0x8507('0x3b')],_0xc51304['query']);_0x41573a[_0x8507('0x3f')]=_[_0x8507('0x3e')](_0xc51304[_0x8507('0x3b')],qs[_0x8507('0x40')](_0x2eddf2[_0x8507('0x3c')][_0x8507('0x40')]));_0x41573a[_0x8507('0x3f')]=_0x41573a[_0x8507('0x3f')]['length']?_0x41573a[_0x8507('0x3f')]:_0xc51304[_0x8507('0x3b')];if(!_0x2eddf2[_0x8507('0x3c')]['hasOwnProperty'](_0x8507('0x41'))){_0x41573a['limit']=qs[_0x8507('0x2a')](_0x2eddf2[_0x8507('0x3c')][_0x8507('0x2a')]);_0x41573a[_0x8507('0x29')]=qs[_0x8507('0x29')](_0x2eddf2[_0x8507('0x3c')][_0x8507('0x29')]);}_0x41573a[_0x8507('0x42')]=qs[_0x8507('0x43')](_0x2eddf2[_0x8507('0x3c')][_0x8507('0x43')]);_0x41573a['where']=qs[_0x8507('0x44')](_[_0x8507('0x45')](_0x2eddf2[_0x8507('0x3c')],_0xc51304[_0x8507('0x44')]),_0x3e9171);if(_0x2eddf2[_0x8507('0x3c')][_0x8507('0x46')]){_0x41573a[_0x8507('0x47')]=_[_0x8507('0x48')](_0x41573a[_0x8507('0x47')],{'$or':_[_0x8507('0x36')](_0x3e9171,function(_0x300ec){if(_0x300ec[_0x8507('0x39')]!==_0x8507('0x49')){var _0x536218={};_0x536218[_0x300ec[_0x8507('0x33')]]={'$like':'%'+_0x2eddf2[_0x8507('0x3c')][_0x8507('0x46')]+'%'};return _0x536218;}})});}_0x41573a=_[_0x8507('0x48')]({},_0x41573a,_0x2eddf2['options']);var _0x52c7a7={'where':_0x41573a[_0x8507('0x47')]};return db['Network'][_0x8507('0x4a')](_0x52c7a7)[_0x8507('0x1c')](function(_0x5c1b54){_0x5d1c43[_0x8507('0x4a')]=_0x5c1b54;if(_0x2eddf2[_0x8507('0x3c')][_0x8507('0x4b')]){_0x41573a[_0x8507('0x4c')]=[{'all':!![]}];}return db['Network']['findAll'](_0x41573a);})['then'](function(_0x4c965a){_0x5d1c43[_0x8507('0x4d')]=_0x4c965a;return _0x5d1c43;})[_0x8507('0x1c')](respondWithFilteredResult(_0x1c1f4c,_0x41573a))['catch'](handleError(_0x1c1f4c,null));};exports[_0x8507('0x4e')]=function(_0x2461b6,_0x419cce){var _0x106519={'raw':!![],'where':{'id':_0x2461b6[_0x8507('0x4f')]['id']}},_0x23fb4b={};_0x23fb4b[_0x8507('0x3b')]=_[_0x8507('0x3d')](db[_0x8507('0x50')][_0x8507('0x37')]);_0x23fb4b[_0x8507('0x3c')]=_['keys'](_0x2461b6['query']);_0x23fb4b['filters']=_[_0x8507('0x3e')](_0x23fb4b['model'],_0x23fb4b[_0x8507('0x3c')]);_0x106519[_0x8507('0x3f')]=_[_0x8507('0x3e')](_0x23fb4b[_0x8507('0x3b')],qs[_0x8507('0x40')](_0x2461b6['query'][_0x8507('0x40')]));_0x106519[_0x8507('0x3f')]=_0x106519[_0x8507('0x3f')]['length']?_0x106519['attributes']:_0x23fb4b[_0x8507('0x3b')];if(_0x2461b6[_0x8507('0x3c')][_0x8507('0x4b')]){_0x106519[_0x8507('0x4c')]=[{'all':!![]}];}_0x106519=_['merge']({},_0x106519,_0x2461b6['options']);return db[_0x8507('0x50')][_0x8507('0x51')](_0x106519)[_0x8507('0x1c')](handleEntityNotFound(_0x419cce,null))[_0x8507('0x1c')](respondWithResult(_0x419cce,null))['catch'](handleError(_0x419cce,null));};exports[_0x8507('0x52')]=function(_0x48a8d4,_0x21e3b5,_0x1748c5){var _0x200a6e;return db[_0x8507('0x53')][_0x8507('0x54')](function(_0x5cba8f){return db[_0x8507('0x50')][_0x8507('0x52')](_0x48a8d4[_0x8507('0x55')],{'raw':!![]})[_0x8507('0x1c')](function(_0x290f53){_0x200a6e=_0x290f53;return db[_0x8507('0x50')]['findAll']({'where':{'type':_0x48a8d4[_0x8507('0x55')][_0x8507('0x39')]},'raw':!![]});})[_0x8507('0x1c')](function(_0x28d4a2){if(_0x200a6e[_0x8507('0x39')][_0x8507('0x56')]()==_0x8507('0x57')){var _0xd256b1=fs[_0x8507('0x58')](path['join'](config[_0x8507('0x59')],_0x8507('0x5a')),'utf8');var _0x5dbd76=ejs[_0x8507('0x5b')](_0xd256b1,{'networks':_0x28d4a2||[]});fs[_0x8507('0x5c')](_0x8507('0x5d'),_0x5dbd76);return respondWithRpcPromise(_0x8507('0x5e'),'create',{'module':_0x8507('0x5f')});}else if(_0x200a6e[_0x8507('0x39')][_0x8507('0x56')]()==_0x8507('0x60')){var _0x3b32e2=fs[_0x8507('0x58')](path['join'](config[_0x8507('0x59')],_0x8507('0x61')),_0x8507('0x62'));var _0x1d6928=ejs['render'](_0x3b32e2,{'networks':_0x28d4a2||[]});fs['writeFileSync']('/etc/asterisk/turn_xcally.conf',_0x1d6928);return respondWithRpcPromise('Reload',_0x8507('0x52'),{'module':_0x8507('0x5f')});}else{var _0x361fa9=fs[_0x8507('0x58')](path[_0x8507('0x63')](config[_0x8507('0x59')],'server/files/templates/network.ejs'),'utf8');var _0x4f7a1c=ejs[_0x8507('0x5b')](_0x361fa9,{'networks':_0x28d4a2||[]});fs[_0x8507('0x5c')](util[_0x8507('0x64')](_0x8507('0x65'),_0x48a8d4[_0x8507('0x55')][_0x8507('0x39')][_0x8507('0x66')]()),_0x4f7a1c);return respondWithRpcPromise(_0x8507('0x5e'),_0x8507('0x52'),{'module':'chan_sip.so'});}return null;})[_0x8507('0x1c')](function(){return _0x200a6e;});})[_0x8507('0x1c')](respondWithResult(_0x21e3b5,0xc9))[_0x8507('0x67')](handleError(_0x21e3b5,null));};exports[_0x8507('0x2f')]=function(_0x47e58c,_0x10626c,_0x199ebb){var _0x367e59;return db[_0x8507('0x53')][_0x8507('0x54')](function(_0x171620){return db[_0x8507('0x50')][_0x8507('0x51')]({'where':{'id':_0x47e58c[_0x8507('0x4f')]['id']}})[_0x8507('0x1c')](handleEntityNotFound(_0x10626c,null))[_0x8507('0x1c')](saveUpdates(_0x47e58c[_0x8507('0x55')],null))['then'](function(_0x4f4e3b){if(_0x4f4e3b){_0x367e59=_0x4f4e3b;return db['Network'][_0x8507('0x68')]({'where':{'type':_0x367e59[_0x8507('0x39')]},'raw':!![]});}return null;})['then'](function(_0x41755f){if(_0x367e59[_0x8507('0x39')][_0x8507('0x56')]()==_0x8507('0x57')){var _0x5cb24d=fs[_0x8507('0x58')](path['join'](config[_0x8507('0x59')],_0x8507('0x5a')),_0x8507('0x62'));var _0x10cdc6=ejs['render'](_0x5cb24d,{'networks':_0x41755f||[]});fs['writeFileSync'](_0x8507('0x5d'),_0x10cdc6);return respondWithRpcPromise('Reload','update',{'module':'res_stun_monitor.so'});}else if(_0x367e59['type']['toUpperCase']()==_0x8507('0x60')){var _0xe7abb5=fs[_0x8507('0x58')](path['join'](config[_0x8507('0x59')],_0x8507('0x61')),_0x8507('0x62'));var _0x166f83=ejs[_0x8507('0x5b')](_0xe7abb5,{'networks':_0x41755f||[]});fs['writeFileSync'](_0x8507('0x69'),_0x166f83);return respondWithRpcPromise(_0x8507('0x5e'),_0x8507('0x2f'),{'module':_0x8507('0x5f')});}else{var _0x16166b=fs[_0x8507('0x58')](path[_0x8507('0x63')](config[_0x8507('0x59')],_0x8507('0x6a')),_0x8507('0x62'));var _0x60ab62=ejs['render'](_0x16166b,{'networks':_0x41755f||[]});fs[_0x8507('0x5c')](util[_0x8507('0x64')]('/etc/asterisk/sip_xcally_%s.conf',_0x47e58c[_0x8507('0x55')]['type']['toLowerCase']()),_0x60ab62);return respondWithRpcPromise(_0x8507('0x5e'),'update',{'module':'chan_sip.so'});}return null;})[_0x8507('0x1c')](function(_0x345c9c){if(_0x345c9c){return _0x367e59;}return null;});})[_0x8507('0x1c')](respondWithResult(_0x10626c,null))['catch'](handleError(_0x10626c,null));};exports['destroy']=function(_0x2786cf,_0x36f40f,_0x2b118d){var _0x2c3ef3;return db['Network']['find']({'where':{'id':_0x2786cf['params']['id']}})['then'](function(_0x509325){_0x2c3ef3=_0x509325;return _0x509325;})[_0x8507('0x1c')](handleEntityNotFound(_0x36f40f,null))['then'](removeEntity(_0x36f40f,null))[_0x8507('0x1c')](function(){if(_0x2c3ef3){return db['Network'][_0x8507('0x68')]({'where':{'type':_0x2c3ef3[_0x8507('0x39')]},'raw':!![]});}})[_0x8507('0x1c')](function(_0x245d0d){if(_0x2c3ef3['type']['toUpperCase']()==_0x8507('0x57')){var _0x3b6175=fs['readFileSync'](path[_0x8507('0x63')](config['root'],_0x8507('0x5a')),_0x8507('0x62'));var _0x2bc198=ejs[_0x8507('0x5b')](_0x3b6175,{'networks':_0x245d0d||[]});fs[_0x8507('0x5c')](_0x8507('0x5d'),_0x2bc198);return respondWithRpcPromise('Reload',_0x8507('0x6b'),{'module':'res_stun_monitor.so'});}else if(_0x2c3ef3[_0x8507('0x39')][_0x8507('0x56')]()==_0x8507('0x60')){var _0x2a5e56=fs['readFileSync'](path[_0x8507('0x63')](config[_0x8507('0x59')],'server/files/templates/turn_multiple.ejs'),_0x8507('0x62'));var _0x44252e=ejs[_0x8507('0x5b')](_0x2a5e56,{'networks':_0x245d0d||[]});fs[_0x8507('0x5c')](_0x8507('0x69'),_0x44252e);return respondWithRpcPromise(_0x8507('0x5e'),_0x8507('0x6b'),{'module':_0x8507('0x5f')});}else{var _0xb7e77e=fs[_0x8507('0x58')](path[_0x8507('0x63')](config[_0x8507('0x59')],_0x8507('0x6a')),_0x8507('0x62'));var _0x5557e1=ejs['render'](_0xb7e77e,{'networks':_0x245d0d||[]});fs[_0x8507('0x5c')](util['format'](_0x8507('0x65'),_0x2786cf['body'][_0x8507('0x39')][_0x8507('0x66')]()),_0x5557e1);return respondWithRpcPromise(_0x8507('0x5e'),_0x8507('0x6b'),{'module':_0x8507('0x6c')});}return null;})[_0x8507('0x67')](handleError(_0x36f40f,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 8990209..513bacc 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 _0x1fc6=['network','lodash','util','request-promise','rimraf','./network.attributes','exports','define'];(function(_0x5166d2,_0x327d63){var _0x46a9f1=function(_0x542d20){while(--_0x542d20){_0x5166d2['push'](_0x5166d2['shift']());}};_0x46a9f1(++_0x327d63);}(_0x1fc6,0xe1));var _0x61fc=function(_0x11f249,_0x4ca4a8){_0x11f249=_0x11f249-0x0;var _0x5c3656=_0x1fc6[_0x11f249];return _0x5c3656;};'use strict';var _=require(_0x61fc('0x0'));var util=require(_0x61fc('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x61fc('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x61fc('0x3'));var config=require('../../config/environment');var attributes=require(_0x61fc('0x4'));module[_0x61fc('0x5')]=function(_0x260b92,_0xb9c712){return _0x260b92[_0x61fc('0x6')]('Network',attributes,{'tableName':_0x61fc('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfe11=['./network.attributes','exports','define','Network','lodash','util','api','moment','../../config/environment'];(function(_0x3000d1,_0x461383){var _0x3b9590=function(_0x2466e5){while(--_0x2466e5){_0x3000d1['push'](_0x3000d1['shift']());}};_0x3b9590(++_0x461383);}(_0xfe11,0x163));var _0x1fe1=function(_0x1a562f,_0x476596){_0x1a562f=_0x1a562f-0x0;var _0x921847=_0xfe11[_0x1a562f];return _0x921847;};'use strict';var _=require(_0x1fe1('0x0'));var util=require(_0x1fe1('0x1'));var logger=require('../../config/logger')(_0x1fe1('0x2'));var moment=require(_0x1fe1('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(_0x1fe1('0x4'));var attributes=require(_0x1fe1('0x5'));module[_0x1fe1('0x6')]=function(_0x594134,_0x167893){return _0x594134[_0x1fe1('0x7')](_0x1fe1('0x8'),attributes,{'tableName':'network','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/network/network.rpc.js b/server/api/network/network.rpc.js index bc1e1dc..e77d7bb 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 _0x38e7=['message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x29678a,_0xd09044){var _0xd762b6=function(_0x4c6944){while(--_0x4c6944){_0x29678a['push'](_0x29678a['shift']());}};_0xd762b6(++_0xd09044);}(_0x38e7,0x163));var _0x738e=function(_0x39c734,_0x2f3e06){_0x39c734=_0x39c734-0x0;var _0xb2a2f9=_0x38e7[_0x39c734];return _0xb2a2f9;};'use strict';var _=require(_0x738e('0x0'));var util=require('util');var moment=require(_0x738e('0x1'));var BPromise=require(_0x738e('0x2'));var rs=require(_0x738e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x738e('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x738e('0x5'))(_0x738e('0x6'));var config=require(_0x738e('0x7'));var jayson=require(_0x738e('0x8'));var client=jayson[_0x738e('0x9')][_0x738e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x458eb2,_0x1eb253,_0x4b92c5){return new BPromise(function(_0x699efe,_0x340679){return client[_0x738e('0xb')](_0x458eb2,_0x4b92c5)['then'](function(_0x388c84){logger['info'](_0x738e('0xc'),_0x1eb253,_0x738e('0xd'));logger[_0x738e('0xe')](_0x738e('0xf'),_0x1eb253,_0x738e('0xd'),JSON[_0x738e('0x10')](_0x388c84));if(_0x388c84[_0x738e('0x11')]){if(_0x388c84[_0x738e('0x11')][_0x738e('0x12')]===0x1f4){logger[_0x738e('0x11')]('Network,\x20%s,\x20%s',_0x1eb253,_0x388c84[_0x738e('0x11')]['message']);return _0x340679(_0x388c84[_0x738e('0x11')][_0x738e('0x13')]);}logger[_0x738e('0x11')](_0x738e('0xc'),_0x1eb253,_0x388c84[_0x738e('0x11')][_0x738e('0x13')]);return _0x699efe(_0x388c84[_0x738e('0x11')][_0x738e('0x13')]);}else{logger['info'](_0x738e('0xc'),_0x1eb253,_0x738e('0xd'));_0x699efe(_0x388c84[_0x738e('0x14')][_0x738e('0x13')]);}})[_0x738e('0x15')](function(_0x3a7125){logger[_0x738e('0x11')]('Network,\x20%s,\x20%s',_0x1eb253,_0x3a7125);_0x340679(_0x3a7125);});});} \ No newline at end of file +var _0x069b=['info','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then','Network,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x069b,0x10b));var _0xb069=function(_0x41f3a4,_0x57aa95){_0x41f3a4=_0x41f3a4-0x0;var _0x54e2c8=_0x069b[_0x41f3a4];return _0x54e2c8;};'use strict';var _=require(_0xb069('0x0'));var util=require(_0xb069('0x1'));var moment=require(_0xb069('0x2'));var BPromise=require(_0xb069('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb069('0x4'));var db=require(_0xb069('0x5'))['db'];var utils=require(_0xb069('0x6'));var logger=require(_0xb069('0x7'))(_0xb069('0x8'));var config=require(_0xb069('0x9'));var jayson=require(_0xb069('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x17d84b,_0x108c38,_0x1e8398){return new BPromise(function(_0x529766,_0xa2c30f){return client['request'](_0x17d84b,_0x1e8398)[_0xb069('0xb')](function(_0x1d3ec3){logger['info'](_0xb069('0xc'),_0x108c38,_0xb069('0xd'));logger[_0xb069('0xe')]('Network,\x20%s,\x20%s,\x20%s',_0x108c38,'request\x20sent',JSON[_0xb069('0xf')](_0x1d3ec3));if(_0x1d3ec3[_0xb069('0x10')]){if(_0x1d3ec3[_0xb069('0x10')][_0xb069('0x11')]===0x1f4){logger['error'](_0xb069('0xc'),_0x108c38,_0x1d3ec3[_0xb069('0x10')][_0xb069('0x12')]);return _0xa2c30f(_0x1d3ec3[_0xb069('0x10')][_0xb069('0x12')]);}logger[_0xb069('0x10')](_0xb069('0xc'),_0x108c38,_0x1d3ec3[_0xb069('0x10')][_0xb069('0x12')]);return _0x529766(_0x1d3ec3['error'][_0xb069('0x12')]);}else{logger[_0xb069('0x13')](_0xb069('0xc'),_0x108c38,_0xb069('0xd'));_0x529766(_0x1d3ec3[_0xb069('0x14')]['message']);}})[_0xb069('0x15')](function(_0x5d7f50){logger[_0xb069('0x10')](_0xb069('0xc'),_0x108c38,_0x5d7f50);_0xa2c30f(_0x5d7f50);});});} \ No newline at end of file diff --git a/server/api/notification/index.js b/server/api/notification/index.js index df5f495..40e29b7 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 _0x1cde=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./notification.controller','post','isAuthenticated','sendNotification','exports'];(function(_0x31eadf,_0x504e95){var _0x1ed651=function(_0x516330){while(--_0x516330){_0x31eadf['push'](_0x31eadf['shift']());}};_0x1ed651(++_0x504e95);}(_0x1cde,0x1dc));var _0xe1cd=function(_0x1ff9cf,_0x410efd){_0x1ff9cf=_0x1ff9cf-0x0;var _0x45f8ff=_0x1cde[_0x1ff9cf];return _0x45f8ff;};'use strict';var multer=require(_0xe1cd('0x0'));var util=require(_0xe1cd('0x1'));var path=require(_0xe1cd('0x2'));var timeout=require(_0xe1cd('0x3'));var express=require(_0xe1cd('0x4'));var router=express[_0xe1cd('0x5')]();var auth=require(_0xe1cd('0x6'));var interaction=require(_0xe1cd('0x7'));var config=require(_0xe1cd('0x8'));var controller=require(_0xe1cd('0x9'));router[_0xe1cd('0xa')]('/',auth[_0xe1cd('0xb')](),controller[_0xe1cd('0xc')]);module[_0xe1cd('0xd')]=router; \ No newline at end of file +var _0xc735=['./notification.controller','post','isAuthenticated','sendNotification','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service'];(function(_0x591a90,_0x5525b0){var _0x551587=function(_0xd6ad8e){while(--_0xd6ad8e){_0x591a90['push'](_0x591a90['shift']());}};_0x551587(++_0x5525b0);}(_0xc735,0x139));var _0x5c73=function(_0x52ec41,_0x12d2fa){_0x52ec41=_0x52ec41-0x0;var _0x50dd88=_0xc735[_0x52ec41];return _0x50dd88;};'use strict';var multer=require(_0x5c73('0x0'));var util=require(_0x5c73('0x1'));var path=require('path');var timeout=require(_0x5c73('0x2'));var express=require(_0x5c73('0x3'));var router=express['Router']();var auth=require(_0x5c73('0x4'));var interaction=require(_0x5c73('0x5'));var config=require('../../config/environment');var controller=require(_0x5c73('0x6'));router[_0x5c73('0x7')]('/',auth[_0x5c73('0x8')](),controller[_0x5c73('0x9')]);module[_0x5c73('0xa')]=router; \ No newline at end of file diff --git a/server/api/notification/notification.attributes.js b/server/api/notification/notification.attributes.js index eff7043..54fd9f0 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 _0x1bb6=['exports','TEXT','STRING','sequelize'];(function(_0x368fb9,_0x1a9895){var _0x4892fb=function(_0x28d735){while(--_0x28d735){_0x368fb9['push'](_0x368fb9['shift']());}};_0x4892fb(++_0x1a9895);}(_0x1bb6,0x10f));var _0x61bb=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x1bb6[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require(_0x61bb('0x0'));module[_0x61bb('0x1')]={'body':{'type':Sequelize[_0x61bb('0x2')]},'senderName':{'type':Sequelize[_0x61bb('0x3')]},'recipientsId':{'type':Sequelize[_0x61bb('0x2')]},'recipientsDescription':{'type':Sequelize[_0x61bb('0x3')]},'beep':{'type':Sequelize['BOOLEAN']}}; \ No newline at end of file +var _0x260c=['TEXT','STRING','BOOLEAN'];(function(_0x350514,_0x5f279f){var _0x4e9dfa=function(_0x287dd2){while(--_0x287dd2){_0x350514['push'](_0x350514['shift']());}};_0x4e9dfa(++_0x5f279f);}(_0x260c,0xab));var _0xc260=function(_0x1c223c,_0x16b3b3){_0x1c223c=_0x1c223c-0x0;var _0x23998a=_0x260c[_0x1c223c];return _0x23998a;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0xc260('0x0')]},'senderName':{'type':Sequelize[_0xc260('0x1')]},'recipientsId':{'type':Sequelize[_0xc260('0x0')]},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize[_0xc260('0x2')]}}; \ No newline at end of file diff --git a/server/api/notification/notification.controller.js b/server/api/notification/notification.controller.js index 26fe8bf..7875171 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 _0x15c8=['model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','beep','SenderId','recipientsId','sortBy','join','sequelize','transaction','create','forEach','recipient','emit','notification:send','catch','Template','html','Invalid\x20\x27TemplateId\x27\x20parameter','view','startCase','User','queue','replace','Queue','ids','all','union','flatten','getAgents','map','html-pdf','eml-format','rimraf','moment','bluebird','util','path','sox','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./notification.socket','register','sendStatus','json','offset','set','Content-Range','reject','update','then','destroy','end','error','name','status','send','sendNotification','body','hasOwnProperty','text','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','chatqueue','faxqueue','mailqueue','openchannelqueue','smsqueue','whatsappqueue','team','includes'];(function(_0x4d7169,_0x558b4e){var _0x59f92e=function(_0x586d7d){while(--_0x586d7d){_0x4d7169['push'](_0x4d7169['shift']());}};_0x59f92e(++_0x558b4e);}(_0x15c8,0x1a2));var _0x815c=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x15c8[_0x21a9d9];return _0x46adce;};'use strict';var pdf=require(_0x815c('0x0'));var emlformat=require(_0x815c('0x1'));var rimraf=require(_0x815c('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x815c('0x3'));var BPromise=require(_0x815c('0x4'));var Mustache=require('mustache');var util=require(_0x815c('0x5'));var path=require(_0x815c('0x6'));var sox=require(_0x815c('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x815c('0x8'));var squel=require(_0x815c('0x9'));var crypto=require('crypto');var jsforce=require(_0x815c('0xa'));var deskjs=require(_0x815c('0xb'));var toCsv=require('to-csv');var querystring=require(_0x815c('0xc'));var Papa=require('papaparse');var Redis=require(_0x815c('0xd'));var authService=require(_0x815c('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x815c('0xf'));var hardwareService=require(_0x815c('0x10'));var logger=require(_0x815c('0x11'))(_0x815c('0x12'));var utils=require(_0x815c('0x13'));var config=require(_0x815c('0x14'));var db=require(_0x815c('0x15'))['db'];config[_0x815c('0x16')]=_[_0x815c('0x17')](config['redis'],{'host':_0x815c('0x18'),'port':0x18eb});var socket=require(_0x815c('0x19'))(new Redis(config[_0x815c('0x16')]));require(_0x815c('0x1a'))[_0x815c('0x1b')](socket);function respondWithStatusCode(_0x1b4203,_0x42090c){_0x42090c=_0x42090c||0xcc;return function(_0x777c58){if(_0x777c58){return _0x1b4203[_0x815c('0x1c')](_0x42090c);}return _0x1b4203['status'](_0x42090c)['end']();};}function respondWithResult(_0x586443,_0x4e2403){_0x4e2403=_0x4e2403||0xc8;return function(_0xafba3b){if(_0xafba3b){return _0x586443['status'](_0x4e2403)[_0x815c('0x1d')](_0xafba3b);}};}function respondWithFilteredResult(_0x40b536,_0x32cb57){return function(_0x3f61f6){if(_0x3f61f6){var _0x1e9742=_0x3f61f6['count'],_0x1c7d1e=_0x32cb57[_0x815c('0x1e')],_0x13c4d3=_0x32cb57[_0x815c('0x1e')]+_0x32cb57['limit'],_0x492b88;if(_0x13c4d3>=_0x1e9742){_0x13c4d3=_0x1e9742;_0x492b88=0xc8;}else{_0x492b88=0xce;}_0x40b536['status'](_0x492b88);return _0x40b536[_0x815c('0x1f')](_0x815c('0x20'),_0x1c7d1e+'-'+_0x13c4d3+'/'+_0x1e9742)[_0x815c('0x1d')](_0x3f61f6);}return null;};}function patchUpdates(_0x1f29fe){return function(_0x4b0787){try{jsonpatch['apply'](_0x4b0787,_0x1f29fe,!![]);}catch(_0x46f01e){return BPromise[_0x815c('0x21')](_0x46f01e);}return _0x4b0787['save']();};}function saveUpdates(_0x2ca2c2,_0x407533){return function(_0x3ebb0c){if(_0x3ebb0c){return _0x3ebb0c[_0x815c('0x22')](_0x2ca2c2)[_0x815c('0x23')](function(_0x187d09){return _0x187d09;});}return null;};}function removeEntity(_0x5268cd,_0x19a00b){return function(_0x310444){if(_0x310444){return _0x310444[_0x815c('0x24')]()[_0x815c('0x23')](function(){_0x5268cd['status'](0xcc)[_0x815c('0x25')]();});}};}function handleEntityNotFound(_0x5efa3e,_0x47c3f0){return function(_0x1366af){if(!_0x1366af){_0x5efa3e[_0x815c('0x1c')](0x194);}return _0x1366af;};}function handleError(_0x2bcba3,_0x53e658){_0x53e658=_0x53e658||0x1f4;return function(_0x42ce7d){logger[_0x815c('0x26')](_0x42ce7d['stack']);if(_0x42ce7d[_0x815c('0x27')]){delete _0x42ce7d[_0x815c('0x27')];}_0x2bcba3[_0x815c('0x28')](_0x53e658)[_0x815c('0x29')](_0x42ce7d);};}exports[_0x815c('0x2a')]=function(_0x40c09b,_0x2cae21,_0x83f495){if(!_0x40c09b[_0x815c('0x2b')][_0x815c('0x2c')](_0x815c('0x2d'))&&!_0x40c09b['body'][_0x815c('0x2c')](_0x815c('0x2e'))){throw new db[(_0x815c('0x2f'))][(_0x815c('0x30'))](_0x815c('0x31'));}else{if(_0x40c09b['body'][_0x815c('0x2c')](_0x815c('0x2e'))&&!_0x40c09b[_0x815c('0x2b')]['hasOwnProperty']('view')){throw new db[(_0x815c('0x2f'))][(_0x815c('0x30'))](_0x815c('0x32'));}if(!_0x40c09b[_0x815c('0x2b')]['hasOwnProperty'](_0x815c('0x33'))){throw new db[(_0x815c('0x2f'))][(_0x815c('0x30'))](_0x815c('0x34'));}else{try{var _0x786a36=JSON[_0x815c('0x35')](_0x40c09b[_0x815c('0x2b')][_0x815c('0x33')]);}catch(_0x5e9b91){logger[_0x815c('0x26')](_0x5e9b91);throw new db[(_0x815c('0x2f'))]['ValidationError']('Invalid\x20\x27recipients\x27\x20object');}var _0x1dfc86=[_0x815c('0x36'),_0x815c('0x37'),_0x815c('0x38'),_0x815c('0x39'),_0x815c('0x3a'),'voicequeue',_0x815c('0x3b'),_0x815c('0x3c'),'user'];if(_['some'](_0x786a36,function(_0x4b8a9d){return!_[_0x815c('0x3d')](_0x1dfc86,_0x4b8a9d[_0x815c('0x3e')][_0x815c('0x3f')]());})){throw new db[(_0x815c('0x2f'))][(_0x815c('0x30'))](_0x815c('0x40'));}}}var _0x31cb1e={};_0x31cb1e[_0x815c('0x41')]=_0x40c09b['body'][_0x815c('0x2c')](_0x815c('0x41'))?_0x40c09b[_0x815c('0x2b')][_0x815c('0x41')]:_0x40c09b['user'][_0x815c('0x42')];_0x31cb1e['recipientsDescription']=_['isEmpty'](_0x40c09b[_0x815c('0x2b')][_0x815c('0x43')])?null:_0x40c09b[_0x815c('0x2b')]['recipientsDescription'];_0x31cb1e['beep']=_0x40c09b[_0x815c('0x2b')][_0x815c('0x44')]||![];_0x31cb1e[_0x815c('0x45')]=_0x40c09b['user']['id'];return getContent(_0x40c09b['body'])[_0x815c('0x23')](function(_0x283156){_0x31cb1e[_0x815c('0x2b')]=_0x283156;return getRecipients(_0x786a36);})[_0x815c('0x23')](function(_0x2111cd){_0x31cb1e[_0x815c('0x46')]=_[_0x815c('0x47')](_0x2111cd)[_0x815c('0x48')](',');return db[_0x815c('0x49')][_0x815c('0x4a')](function(_0x4ed2f7){return db['Notification'][_0x815c('0x4b')](_0x31cb1e,{'raw':!![],'transaction':_0x4ed2f7})[_0x815c('0x23')](function(_0x75998c){var _0x3ded79={'sender':_0x31cb1e[_0x815c('0x41')],'description':_0x31cb1e['recipientsDescription'],'content':_0x31cb1e[_0x815c('0x2b')],'beep':_0x31cb1e[_0x815c('0x44')]};_0x2111cd[_0x815c('0x4c')](function(_0x374b0d){_0x3ded79[_0x815c('0x4d')]=_0x374b0d;socket[_0x815c('0x4e')](_0x815c('0x4f'),_0x3ded79);});return _0x75998c;});});})[_0x815c('0x23')](respondWithResult(_0x2cae21,0xc9))[_0x815c('0x50')](handleError(_0x2cae21,null));};function getContent(_0x175f0e){return new BPromise(function(_0x178c10,_0x6b8ac6){if(_0x175f0e[_0x815c('0x2d')]){_0x178c10(_0x175f0e[_0x815c('0x2d')]);return;}return db[_0x815c('0x51')]['findOne']({'attributes':[_0x815c('0x52')],'where':{'id':_0x175f0e[_0x815c('0x2e')]},'raw':!![]})['then'](function(_0x53aa16){if(!_0x53aa16)throw new db['Sequelize'][(_0x815c('0x30'))](_0x815c('0x53'));var _0x561ab5=Mustache['render'](_0x53aa16[_0x815c('0x52')],_0x175f0e[_0x815c('0x54')]);_0x178c10(_0x561ab5);})[_0x815c('0x50')](function(_0x45ca2e){_0x6b8ac6(_0x45ca2e);});});}function getRecipients(_0x162b9a){return new BPromise(function(_0x368d5e,_0x157dc7){var _0x242021=[];var _0x644ce8=[];_0x162b9a[_0x815c('0x4c')](function(_0x1e25a3){var _0x35ddaa=_[_0x815c('0x55')](_0x1e25a3[_0x815c('0x3e')][_0x815c('0x3f')]());if(_0x35ddaa===_0x815c('0x56')){_0x242021=_['union'](_0x242021,_0x1e25a3['ids']);}else{if(_[_0x815c('0x3d')](_0x35ddaa,_0x815c('0x57')))_0x35ddaa=_0x35ddaa[_0x815c('0x58')](_0x815c('0x57'),_0x815c('0x59'));_0x1e25a3[_0x815c('0x5a')][_0x815c('0x4c')](function(_0x41b6e2){_0x644ce8['push'](getAgents(_0x35ddaa,_0x41b6e2));});}});return BPromise[_0x815c('0x5b')](_0x644ce8)[_0x815c('0x23')](function(_0x11cd3d){_0x242021=_[_0x815c('0x5c')](_0x242021,_[_0x815c('0x5d')](_0x11cd3d));_0x368d5e(_0x242021);})[_0x815c('0x50')](function(_0x523efd){_0x157dc7(_0x523efd);});});}function getAgents(_0x1e85ef,_0x49c27f){return new BPromise(function(_0x4b6b8d,_0x33937f){return db[_0x1e85ef]['findOne']({'where':{'id':_0x49c27f}})[_0x815c('0x23')](function(_0x25534b){return _0x25534b[_0x815c('0x5e')]({'attributes':['id'],'raw':!![]})['then'](function(_0xefad60){var _0x5392f5=_[_0x815c('0x5f')](_0xefad60,'id');_0x4b6b8d(_0x5392f5);});})[_0x815c('0x50')](function(_0x7c3d42){_0x33937f(_0x7c3d42);});});} \ No newline at end of file +var _0xeddd=['fullname','recipientsDescription','isEmpty','beep','SenderId','sortBy','sequelize','transaction','Notification','forEach','recipient','emit','notification:send','text','Template','html','catch','startCase','toLowerCase','ids','queue','replace','Queue','push','all','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','to-csv','ejs','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./notification.socket','register','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','save','update','then','destroy','error','stack','send','sendNotification','body','hasOwnProperty','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Missing\x20\x27view\x27\x20parameter','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','team','user','some','includes','model','senderName'];(function(_0x148ca6,_0x1f7867){var _0x353a38=function(_0x150536){while(--_0x150536){_0x148ca6['push'](_0x148ca6['shift']());}};_0x353a38(++_0x1f7867);}(_0xeddd,0xd5));var _0xdedd=function(_0x2e4aa2,_0x11956a){_0x2e4aa2=_0x2e4aa2-0x0;var _0x5e6092=_0xeddd[_0x2e4aa2];return _0x5e6092;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xdedd('0x0'));var rimraf=require(_0xdedd('0x1'));var zipdir=require(_0xdedd('0x2'));var jsonpatch=require(_0xdedd('0x3'));var rp=require(_0xdedd('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xdedd('0x5'));var util=require(_0xdedd('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xdedd('0x7'));var ejs=require(_0xdedd('0x8'));var fs=require('fs');var _=require(_0xdedd('0x9'));var squel=require(_0xdedd('0xa'));var crypto=require(_0xdedd('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xdedd('0xc'));var Redis=require(_0xdedd('0xd'));var authService=require(_0xdedd('0xe'));var qs=require(_0xdedd('0xf'));var as=require(_0xdedd('0x10'));var hardwareService=require(_0xdedd('0x11'));var logger=require(_0xdedd('0x12'))(_0xdedd('0x13'));var utils=require(_0xdedd('0x14'));var config=require(_0xdedd('0x15'));var db=require(_0xdedd('0x16'))['db'];config[_0xdedd('0x17')]=_[_0xdedd('0x18')](config[_0xdedd('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0xdedd('0x19'))(new Redis(config[_0xdedd('0x17')]));require(_0xdedd('0x1a'))[_0xdedd('0x1b')](socket);function respondWithStatusCode(_0xed1388,_0x3bbcb9){_0x3bbcb9=_0x3bbcb9||0xcc;return function(_0x1926e9){if(_0x1926e9){return _0xed1388[_0xdedd('0x1c')](_0x3bbcb9);}return _0xed1388[_0xdedd('0x1d')](_0x3bbcb9)[_0xdedd('0x1e')]();};}function respondWithResult(_0x27731f,_0x1e9a5a){_0x1e9a5a=_0x1e9a5a||0xc8;return function(_0x84e5da){if(_0x84e5da){return _0x27731f[_0xdedd('0x1d')](_0x1e9a5a)[_0xdedd('0x1f')](_0x84e5da);}};}function respondWithFilteredResult(_0x1d06a1,_0x453ced){return function(_0x288936){if(_0x288936){var _0x4ff8a3=_0x288936[_0xdedd('0x20')],_0x293b76=_0x453ced[_0xdedd('0x21')],_0x4fb8db=_0x453ced[_0xdedd('0x21')]+_0x453ced[_0xdedd('0x22')],_0x1e072a;if(_0x4fb8db>=_0x4ff8a3){_0x4fb8db=_0x4ff8a3;_0x1e072a=0xc8;}else{_0x1e072a=0xce;}_0x1d06a1[_0xdedd('0x1d')](_0x1e072a);return _0x1d06a1['set'](_0xdedd('0x23'),_0x293b76+'-'+_0x4fb8db+'/'+_0x4ff8a3)['json'](_0x288936);}return null;};}function patchUpdates(_0x2cc485){return function(_0x551925){try{jsonpatch[_0xdedd('0x24')](_0x551925,_0x2cc485,!![]);}catch(_0x6cfbc7){return BPromise['reject'](_0x6cfbc7);}return _0x551925[_0xdedd('0x25')]();};}function saveUpdates(_0x5c894,_0x2349a0){return function(_0x29a3d1){if(_0x29a3d1){return _0x29a3d1[_0xdedd('0x26')](_0x5c894)[_0xdedd('0x27')](function(_0x128fce){return _0x128fce;});}return null;};}function removeEntity(_0x5a5c64,_0xf13e5f){return function(_0xcfe07c){if(_0xcfe07c){return _0xcfe07c[_0xdedd('0x28')]()['then'](function(){_0x5a5c64['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xdc416a,_0x5e1407){return function(_0x29915d){if(!_0x29915d){_0xdc416a[_0xdedd('0x1c')](0x194);}return _0x29915d;};}function handleError(_0x54532a,_0xdfa691){_0xdfa691=_0xdfa691||0x1f4;return function(_0x5b2314){logger[_0xdedd('0x29')](_0x5b2314[_0xdedd('0x2a')]);if(_0x5b2314['name']){delete _0x5b2314['name'];}_0x54532a[_0xdedd('0x1d')](_0xdfa691)[_0xdedd('0x2b')](_0x5b2314);};}exports[_0xdedd('0x2c')]=function(_0x52ea48,_0x16f460,_0x374037){if(!_0x52ea48[_0xdedd('0x2d')][_0xdedd('0x2e')]('text')&&!_0x52ea48[_0xdedd('0x2d')][_0xdedd('0x2e')](_0xdedd('0x2f'))){throw new db[(_0xdedd('0x30'))][(_0xdedd('0x31'))](_0xdedd('0x32'));}else{if(_0x52ea48[_0xdedd('0x2d')][_0xdedd('0x2e')](_0xdedd('0x2f'))&&!_0x52ea48[_0xdedd('0x2d')][_0xdedd('0x2e')](_0xdedd('0x33'))){throw new db[(_0xdedd('0x30'))][(_0xdedd('0x31'))](_0xdedd('0x34'));}if(!_0x52ea48[_0xdedd('0x2d')][_0xdedd('0x2e')]('recipients')){throw new db[(_0xdedd('0x30'))][(_0xdedd('0x31'))](_0xdedd('0x35'));}else{try{var _0x5cc09d=JSON[_0xdedd('0x36')](_0x52ea48[_0xdedd('0x2d')]['recipients']);}catch(_0x293250){logger['error'](_0x293250);throw new db[(_0xdedd('0x30'))][(_0xdedd('0x31'))](_0xdedd('0x37'));}var _0x2dceba=[_0xdedd('0x38'),_0xdedd('0x39'),_0xdedd('0x3a'),_0xdedd('0x3b'),_0xdedd('0x3c'),_0xdedd('0x3d'),_0xdedd('0x3e'),_0xdedd('0x3f'),_0xdedd('0x40')];if(_[_0xdedd('0x41')](_0x5cc09d,function(_0x3e7528){return!_[_0xdedd('0x42')](_0x2dceba,_0x3e7528[_0xdedd('0x43')]['toLowerCase']());})){throw new db[(_0xdedd('0x30'))]['ValidationError']('Invalid\x20model\x20in\x20\x27recipients\x27\x20object');}}}var _0x93cdf7={};_0x93cdf7[_0xdedd('0x44')]=_0x52ea48['body'][_0xdedd('0x2e')](_0xdedd('0x44'))?_0x52ea48['body']['senderName']:_0x52ea48[_0xdedd('0x40')][_0xdedd('0x45')];_0x93cdf7[_0xdedd('0x46')]=_[_0xdedd('0x47')](_0x52ea48[_0xdedd('0x2d')]['recipientsDescription'])?null:_0x52ea48[_0xdedd('0x2d')][_0xdedd('0x46')];_0x93cdf7[_0xdedd('0x48')]=_0x52ea48[_0xdedd('0x2d')][_0xdedd('0x48')]||![];_0x93cdf7[_0xdedd('0x49')]=_0x52ea48[_0xdedd('0x40')]['id'];return getContent(_0x52ea48[_0xdedd('0x2d')])[_0xdedd('0x27')](function(_0x4b351b){_0x93cdf7[_0xdedd('0x2d')]=_0x4b351b;return getRecipients(_0x5cc09d);})['then'](function(_0x5e456d){_0x93cdf7['recipientsId']=_[_0xdedd('0x4a')](_0x5e456d)['join'](',');return db[_0xdedd('0x4b')][_0xdedd('0x4c')](function(_0x48f190){return db[_0xdedd('0x4d')]['create'](_0x93cdf7,{'raw':!![],'transaction':_0x48f190})[_0xdedd('0x27')](function(_0xfeec4){var _0x317637={'sender':_0x93cdf7[_0xdedd('0x44')],'description':_0x93cdf7[_0xdedd('0x46')],'content':_0x93cdf7[_0xdedd('0x2d')],'beep':_0x93cdf7['beep']};_0x5e456d[_0xdedd('0x4e')](function(_0x16448d){_0x317637[_0xdedd('0x4f')]=_0x16448d;socket[_0xdedd('0x50')](_0xdedd('0x51'),_0x317637);});return _0xfeec4;});});})[_0xdedd('0x27')](respondWithResult(_0x16f460,0xc9))['catch'](handleError(_0x16f460,null));};function getContent(_0xa72106){return new BPromise(function(_0x5aba28,_0x2e76c4){if(_0xa72106[_0xdedd('0x52')]){_0x5aba28(_0xa72106[_0xdedd('0x52')]);return;}return db[_0xdedd('0x53')]['findOne']({'attributes':['html'],'where':{'id':_0xa72106['TemplateId']},'raw':!![]})['then'](function(_0x495146){if(!_0x495146)throw new db[(_0xdedd('0x30'))][(_0xdedd('0x31'))]('Invalid\x20\x27TemplateId\x27\x20parameter');var _0x5d37e4=Mustache['render'](_0x495146[_0xdedd('0x54')],_0xa72106['view']);_0x5aba28(_0x5d37e4);})[_0xdedd('0x55')](function(_0x34f723){_0x2e76c4(_0x34f723);});});}function getRecipients(_0x2fba5b){return new BPromise(function(_0x289f16,_0x5bc3e6){var _0x11d7e3=[];var _0x1a45dd=[];_0x2fba5b[_0xdedd('0x4e')](function(_0x37a5d0){var _0x29caec=_[_0xdedd('0x56')](_0x37a5d0['model'][_0xdedd('0x57')]());if(_0x29caec==='User'){_0x11d7e3=_['union'](_0x11d7e3,_0x37a5d0[_0xdedd('0x58')]);}else{if(_['includes'](_0x29caec,_0xdedd('0x59')))_0x29caec=_0x29caec[_0xdedd('0x5a')](_0xdedd('0x59'),_0xdedd('0x5b'));_0x37a5d0[_0xdedd('0x58')][_0xdedd('0x4e')](function(_0x203e44){_0x1a45dd[_0xdedd('0x5c')](getAgents(_0x29caec,_0x203e44));});}});return BPromise[_0xdedd('0x5d')](_0x1a45dd)[_0xdedd('0x27')](function(_0x46cb3e){_0x11d7e3=_['union'](_0x11d7e3,_['flatten'](_0x46cb3e));_0x289f16(_0x11d7e3);})[_0xdedd('0x55')](function(_0x44815d){_0x5bc3e6(_0x44815d);});});}function getAgents(_0x3a41df,_0x19ac6c){return new BPromise(function(_0x5039ca,_0x4830f7){return db[_0x3a41df]['findOne']({'where':{'id':_0x19ac6c}})[_0xdedd('0x27')](function(_0xdf9a40){return _0xdf9a40['getAgents']({'attributes':['id'],'raw':!![]})[_0xdedd('0x27')](function(_0x4ff66c){var _0x558851=_['map'](_0x4ff66c,'id');_0x5039ca(_0x558851);});})[_0xdedd('0x55')](function(_0x1e973f){_0x4830f7(_0x1e973f);});});} \ No newline at end of file diff --git a/server/api/notification/notification.events.js b/server/api/notification/notification.events.js index 37e5747..effc345 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 _0x757a=['../../mysqldb','Notification','remove','emit','hasOwnProperty','hook'];(function(_0x491e09,_0xee12f3){var _0x2a9218=function(_0x57a635){while(--_0x57a635){_0x491e09['push'](_0x491e09['shift']());}};_0x2a9218(++_0xee12f3);}(_0x757a,0xde));var _0xa757=function(_0x2c347e,_0x29b29a){_0x2c347e=_0x2c347e-0x0;var _0x29603a=_0x757a[_0x2c347e];return _0x29603a;};'use strict';var EventEmitter=require('events');var Notification=require(_0xa757('0x0'))['db'][_0xa757('0x1')];var NotificationEvents=new EventEmitter();NotificationEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xa757('0x2')};function emitEvent(_0x1721c6){return function(_0x1c2932,_0x453d07,_0x32630d){NotificationEvents[_0xa757('0x3')](_0x1721c6+':'+_0x1c2932['id'],_0x1c2932);NotificationEvents['emit'](_0x1721c6,_0x1c2932);_0x32630d(null);};}for(var e in events){if(events[_0xa757('0x4')](e)){var event=events[e];Notification[_0xa757('0x5')](e,emitEvent(event));}}module['exports']=NotificationEvents; \ No newline at end of file +var _0xb10b=['hasOwnProperty','hook','events','Notification','setMaxListeners','save','remove','emit'];(function(_0x75a02a,_0x3953f5){var _0x593f3c=function(_0x4a6919){while(--_0x4a6919){_0x75a02a['push'](_0x75a02a['shift']());}};_0x593f3c(++_0x3953f5);}(_0xb10b,0x12a));var _0xbb10=function(_0x27062d,_0x24b179){_0x27062d=_0x27062d-0x0;var _0x4f1478=_0xb10b[_0x27062d];return _0x4f1478;};'use strict';var EventEmitter=require(_0xbb10('0x0'));var Notification=require('../../mysqldb')['db'][_0xbb10('0x1')];var NotificationEvents=new EventEmitter();NotificationEvents[_0xbb10('0x2')](0x0);var events={'afterCreate':_0xbb10('0x3'),'afterUpdate':'update','afterDestroy':_0xbb10('0x4')};function emitEvent(_0x9bbed){return function(_0x460981,_0x22320e,_0x49baf4){NotificationEvents[_0xbb10('0x5')](_0x9bbed+':'+_0x460981['id'],_0x460981);NotificationEvents['emit'](_0x9bbed,_0x460981);_0x49baf4(null);};}for(var e in events){if(events[_0xbb10('0x6')](e)){var event=events[e];Notification[_0xbb10('0x7')](e,emitEvent(event));}}module['exports']=NotificationEvents; \ No newline at end of file diff --git a/server/api/notification/notification.model.js b/server/api/notification/notification.model.js index 8ffa8b7..4ae5f92 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 _0x2fc1=['request-promise','../../config/environment','define','notifications','utf8mb4','utf8mb4_unicode_ci','lodash','util','moment','bluebird'];(function(_0x366e75,_0x533d1d){var _0x3b167b=function(_0x3e9f1d){while(--_0x3e9f1d){_0x366e75['push'](_0x366e75['shift']());}};_0x3b167b(++_0x533d1d);}(_0x2fc1,0xa6));var _0x12fc=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x2fc1[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x12fc('0x0'));var util=require(_0x12fc('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x12fc('0x2'));var BPromise=require(_0x12fc('0x3'));var rp=require(_0x12fc('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x12fc('0x5'));var attributes=require('./notification.attributes');module['exports']=function(_0x172dcd,_0x1b2bde){return _0x172dcd[_0x12fc('0x6')]('Notification',attributes,{'tableName':_0x12fc('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x12fc('0x8'),'collate':_0x12fc('0x9')});}; \ No newline at end of file +var _0x2a55=['exports','define','Notification','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x36859c,_0x185b34){var _0x5c057d=function(_0x4a1ff3){while(--_0x4a1ff3){_0x36859c['push'](_0x36859c['shift']());}};_0x5c057d(++_0x185b34);}(_0x2a55,0x1f2));var _0x52a5=function(_0x2f2e0e,_0x21a555){_0x2f2e0e=_0x2f2e0e-0x0;var _0xe1467c=_0x2a55[_0x2f2e0e];return _0xe1467c;};'use strict';var _=require(_0x52a5('0x0'));var util=require(_0x52a5('0x1'));var logger=require('../../config/logger')(_0x52a5('0x2'));var moment=require(_0x52a5('0x3'));var BPromise=require('bluebird');var rp=require(_0x52a5('0x4'));var fs=require('fs');var path=require(_0x52a5('0x5'));var rimraf=require(_0x52a5('0x6'));var config=require(_0x52a5('0x7'));var attributes=require('./notification.attributes');module[_0x52a5('0x8')]=function(_0x38e984,_0x47512e){return _0x38e984[_0x52a5('0x9')](_0x52a5('0xa'),attributes,{'tableName':'notifications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/notification/notification.rpc.js b/server/api/notification/notification.rpc.js index 70cff00..8b4413e 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 _0x33f0=['lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./notification.socket','register','request','Notification,\x20%s,\x20%s','debug','Notification,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch'];(function(_0x482c95,_0x504190){var _0x38c2e8=function(_0x5685df){while(--_0x5685df){_0x482c95['push'](_0x482c95['shift']());}};_0x38c2e8(++_0x504190);}(_0x33f0,0x1c2));var _0x033f=function(_0x5d1617,_0x105414){_0x5d1617=_0x5d1617-0x0;var _0x2ae921=_0x33f0[_0x5d1617];return _0x2ae921;};'use strict';var _=require(_0x033f('0x0'));var util=require('util');var moment=require(_0x033f('0x1'));var BPromise=require('bluebird');var rs=require(_0x033f('0x2'));var fs=require('fs');var Redis=require(_0x033f('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x033f('0x4'));var logger=require(_0x033f('0x5'))(_0x033f('0x6'));var config=require(_0x033f('0x7'));var jayson=require(_0x033f('0x8'));var client=jayson[_0x033f('0x9')][_0x033f('0xa')]({'port':0x232a});config[_0x033f('0xb')]=_['defaults'](config[_0x033f('0xb')],{'host':_0x033f('0xc'),'port':0x18eb});var socket=require(_0x033f('0xd'))(new Redis(config[_0x033f('0xb')]));require(_0x033f('0xe'))[_0x033f('0xf')](socket);function respondWithRpcPromise(_0x4cea78,_0x300310,_0xe81f73){return new BPromise(function(_0x24b821,_0x54fa63){return client[_0x033f('0x10')](_0x4cea78,_0xe81f73)['then'](function(_0x59792c){logger['info'](_0x033f('0x11'),_0x300310,'request\x20sent');logger[_0x033f('0x12')](_0x033f('0x13'),_0x300310,'request\x20sent',JSON[_0x033f('0x14')](_0x59792c));if(_0x59792c[_0x033f('0x15')]){if(_0x59792c['error']['code']===0x1f4){logger[_0x033f('0x15')]('Notification,\x20%s,\x20%s',_0x300310,_0x59792c[_0x033f('0x15')][_0x033f('0x16')]);return _0x54fa63(_0x59792c[_0x033f('0x15')][_0x033f('0x16')]);}logger['error'](_0x033f('0x11'),_0x300310,_0x59792c[_0x033f('0x15')]['message']);return _0x24b821(_0x59792c[_0x033f('0x15')][_0x033f('0x16')]);}else{logger[_0x033f('0x17')](_0x033f('0x11'),_0x300310,'request\x20sent');_0x24b821(_0x59792c['result']['message']);}})[_0x033f('0x18')](function(_0x59c97e){logger[_0x033f('0x15')](_0x033f('0x11'),_0x300310,_0x59c97e);_0x54fa63(_0x59c97e);});});} \ No newline at end of file +var _0x7b5e=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/logger','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./notification.socket','register','request','then','info','Notification,\x20%s,\x20%s','request\x20sent','Notification,\x20%s,\x20%s,\x20%s','code','error'];(function(_0x8de02f,_0x5438bd){var _0x14cba7=function(_0x2223df){while(--_0x2223df){_0x8de02f['push'](_0x8de02f['shift']());}};_0x14cba7(++_0x5438bd);}(_0x7b5e,0xe4));var _0xe7b5=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0x7b5e[_0x550d12];return _0x12103d;};'use strict';var _=require(_0xe7b5('0x0'));var util=require(_0xe7b5('0x1'));var moment=require(_0xe7b5('0x2'));var BPromise=require(_0xe7b5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe7b5('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xe7b5('0x5'))('rpc');var config=require(_0xe7b5('0x6'));var jayson=require(_0xe7b5('0x7'));var client=jayson[_0xe7b5('0x8')]['http']({'port':0x232a});config[_0xe7b5('0x9')]=_['defaults'](config[_0xe7b5('0x9')],{'host':_0xe7b5('0xa'),'port':0x18eb});var socket=require(_0xe7b5('0xb'))(new Redis(config[_0xe7b5('0x9')]));require(_0xe7b5('0xc'))[_0xe7b5('0xd')](socket);function respondWithRpcPromise(_0xb2142b,_0x3be9ea,_0x1573f6){return new BPromise(function(_0x402959,_0x5d0f47){return client[_0xe7b5('0xe')](_0xb2142b,_0x1573f6)[_0xe7b5('0xf')](function(_0x25fc71){logger[_0xe7b5('0x10')](_0xe7b5('0x11'),_0x3be9ea,_0xe7b5('0x12'));logger['debug'](_0xe7b5('0x13'),_0x3be9ea,_0xe7b5('0x12'),JSON['stringify'](_0x25fc71));if(_0x25fc71['error']){if(_0x25fc71['error'][_0xe7b5('0x14')]===0x1f4){logger[_0xe7b5('0x15')]('Notification,\x20%s,\x20%s',_0x3be9ea,_0x25fc71[_0xe7b5('0x15')]['message']);return _0x5d0f47(_0x25fc71[_0xe7b5('0x15')]['message']);}logger[_0xe7b5('0x15')](_0xe7b5('0x11'),_0x3be9ea,_0x25fc71[_0xe7b5('0x15')][_0xe7b5('0x16')]);return _0x402959(_0x25fc71[_0xe7b5('0x15')][_0xe7b5('0x16')]);}else{logger['info']('Notification,\x20%s,\x20%s',_0x3be9ea,_0xe7b5('0x12'));_0x402959(_0x25fc71[_0xe7b5('0x17')][_0xe7b5('0x16')]);}})[_0xe7b5('0x18')](function(_0x317a96){logger[_0xe7b5('0x15')](_0xe7b5('0x11'),_0x3be9ea,_0x317a96);_0x5d0f47(_0x317a96);});});} \ No newline at end of file diff --git a/server/api/notification/notification.socket.js b/server/api/notification/notification.socket.js index 1e82ae6..b288eda 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 _0xa687=['remove','update','emit','removeListener','register','length','notification:','./notification.events','save'];(function(_0x22a6f6,_0x5d6ea9){var _0x464440=function(_0x147c88){while(--_0x147c88){_0x22a6f6['push'](_0x22a6f6['shift']());}};_0x464440(++_0x5d6ea9);}(_0xa687,0x1e4));var _0x7a68=function(_0x6dd5c,_0x4bfc19){_0x6dd5c=_0x6dd5c-0x0;var _0x5a87fa=_0xa687[_0x6dd5c];return _0x5a87fa;};'use strict';var NotificationEvents=require(_0x7a68('0x0'));var events=[_0x7a68('0x1'),_0x7a68('0x2'),_0x7a68('0x3')];function createListener(_0xf3992e,_0x399524){return function(_0x118578){_0x399524[_0x7a68('0x4')](_0xf3992e,_0x118578);};}function removeListener(_0x5ddcb3,_0x1f899c){return function(){NotificationEvents[_0x7a68('0x5')](_0x5ddcb3,_0x1f899c);};}exports[_0x7a68('0x6')]=function(_0x42e2a5){for(var _0x18fbec=0x0,_0x2eb106=events[_0x7a68('0x7')];_0x18fbec<_0x2eb106;_0x18fbec++){var _0x2b9a17=events[_0x18fbec];var _0x19ad11=createListener(_0x7a68('0x8')+_0x2b9a17,_0x42e2a5);NotificationEvents['on'](_0x2b9a17,_0x19ad11);}}; \ No newline at end of file +var _0x4be9=['save','remove','update','emit','removeListener','register','length','notification:','./notification.events'];(function(_0x35181c,_0x82694a){var _0xe14bf9=function(_0x2be9b7){while(--_0x2be9b7){_0x35181c['push'](_0x35181c['shift']());}};_0xe14bf9(++_0x82694a);}(_0x4be9,0x7d));var _0x94be=function(_0x4854d6,_0x2f1264){_0x4854d6=_0x4854d6-0x0;var _0x3885c0=_0x4be9[_0x4854d6];return _0x3885c0;};'use strict';var NotificationEvents=require(_0x94be('0x0'));var events=[_0x94be('0x1'),_0x94be('0x2'),_0x94be('0x3')];function createListener(_0x2d6e7b,_0x519feb){return function(_0x3969ab){_0x519feb[_0x94be('0x4')](_0x2d6e7b,_0x3969ab);};}function removeListener(_0x234f40,_0x58193e){return function(){NotificationEvents[_0x94be('0x5')](_0x234f40,_0x58193e);};}exports[_0x94be('0x6')]=function(_0x34ebb0){for(var _0x2bf80a=0x0,_0x2cd1f0=events[_0x94be('0x7')];_0x2bf80a<_0x2cd1f0;_0x2bf80a++){var _0x15789a=events[_0x2bf80a];var _0x33dc5e=createListener(_0x94be('0x8')+_0x15789a,_0x34ebb0);NotificationEvents['on'](_0x15789a,_0x33dc5e);}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index fc2fbee..6b3a667 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 _0x946d=['addApplications','send','put','update','delete','destroy','removeDispositions','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./openchannelAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getApplications','getInteractions','/:id/users','getAgents','post','create','addDisposition','/:id/notify','/:id/applications'];(function(_0xeacdd0,_0x413eb9){var _0x224d1f=function(_0x2131b3){while(--_0x2131b3){_0xeacdd0['push'](_0xeacdd0['shift']());}};_0x224d1f(++_0x413eb9);}(_0x946d,0x170));var _0xd946=function(_0xe85c7f,_0x5c4c1e){_0xe85c7f=_0xe85c7f-0x0;var _0x1ce111=_0x946d[_0xe85c7f];return _0x1ce111;};'use strict';var multer=require(_0xd946('0x0'));var util=require('util');var path=require(_0xd946('0x1'));var timeout=require(_0xd946('0x2'));var express=require(_0xd946('0x3'));var router=express[_0xd946('0x4')]();var auth=require(_0xd946('0x5'));var interaction=require(_0xd946('0x6'));var config=require('../../config/environment');var controller=require(_0xd946('0x7'));router[_0xd946('0x8')]('/',auth[_0xd946('0x9')](),controller[_0xd946('0xa')]);router[_0xd946('0x8')](_0xd946('0xb'),auth['isAuthenticated'](),controller[_0xd946('0xc')]);router[_0xd946('0x8')](_0xd946('0xd'),auth[_0xd946('0x9')](),controller[_0xd946('0xe')]);router[_0xd946('0x8')](_0xd946('0xf'),auth['isAuthenticated'](),controller[_0xd946('0x10')]);router[_0xd946('0x8')](_0xd946('0x11'),auth[_0xd946('0x9')](),controller[_0xd946('0x12')]);router['get']('/:id/applications',auth[_0xd946('0x9')](),controller[_0xd946('0x13')]);router['get']('/:id/interactions',auth[_0xd946('0x9')](),controller[_0xd946('0x14')]);router[_0xd946('0x8')](_0xd946('0x15'),auth[_0xd946('0x9')](),controller[_0xd946('0x16')]);router[_0xd946('0x17')]('/',auth[_0xd946('0x9')](),controller[_0xd946('0x18')]);router[_0xd946('0x17')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0xd946('0x19')]);router['post'](_0xd946('0x11'),auth['isAuthenticated'](),controller['addAnswer']);router[_0xd946('0x17')](_0xd946('0x1a'),controller['notify']);router[_0xd946('0x17')](_0xd946('0x1b'),auth[_0xd946('0x9')](),controller[_0xd946('0x1c')]);router[_0xd946('0x17')](_0xd946('0x15'),auth[_0xd946('0x9')](),controller['addAgents']);router[_0xd946('0x17')]('/:id/send',auth[_0xd946('0x9')](),controller[_0xd946('0x1d')]);router[_0xd946('0x1e')](_0xd946('0xd'),auth[_0xd946('0x9')](),controller[_0xd946('0x1f')]);router[_0xd946('0x20')]('/:id',auth[_0xd946('0x9')](),controller[_0xd946('0x21')]);router['delete'](_0xd946('0xf'),auth['isAuthenticated'](),controller[_0xd946('0x22')]);router[_0xd946('0x20')](_0xd946('0x11'),auth[_0xd946('0x9')](),controller['removeAnswers']);router[_0xd946('0x20')](_0xd946('0x15'),auth[_0xd946('0x9')](),controller['removeAgents']);module[_0xd946('0x23')]=router; \ No newline at end of file +var _0x3e8f=['/:id/send','send','put','update','delete','destroy','removeDispositions','removeAnswers','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','isAuthenticated','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','getApplications','/:id/interactions','getInteractions','/:id/users','getAgents','post','create','addDisposition','addAnswer','notify','/:id/applications','addApplications','addAgents'];(function(_0x4baf82,_0x4e05f3){var _0x3985bd=function(_0x5db72b){while(--_0x5db72b){_0x4baf82['push'](_0x4baf82['shift']());}};_0x3985bd(++_0x4e05f3);}(_0x3e8f,0x17b));var _0xf3e8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3e8f[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0xf3e8('0x0'));var path=require(_0xf3e8('0x1'));var timeout=require(_0xf3e8('0x2'));var express=require('express');var router=express[_0xf3e8('0x3')]();var auth=require(_0xf3e8('0x4'));var interaction=require(_0xf3e8('0x5'));var config=require(_0xf3e8('0x6'));var controller=require('./openchannelAccount.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xf3e8('0x7')]);router[_0xf3e8('0x8')]('/describe',auth[_0xf3e8('0x9')](),controller['describe']);router[_0xf3e8('0x8')](_0xf3e8('0xa'),auth[_0xf3e8('0x9')](),controller[_0xf3e8('0xb')]);router[_0xf3e8('0x8')](_0xf3e8('0xc'),auth[_0xf3e8('0x9')](),controller['getDispositions']);router['get'](_0xf3e8('0xd'),auth[_0xf3e8('0x9')](),controller[_0xf3e8('0xe')]);router['get']('/:id/applications',auth[_0xf3e8('0x9')](),controller[_0xf3e8('0xf')]);router[_0xf3e8('0x8')](_0xf3e8('0x10'),auth['isAuthenticated'](),controller[_0xf3e8('0x11')]);router['get'](_0xf3e8('0x12'),auth[_0xf3e8('0x9')](),controller[_0xf3e8('0x13')]);router[_0xf3e8('0x14')]('/',auth[_0xf3e8('0x9')](),controller[_0xf3e8('0x15')]);router[_0xf3e8('0x14')](_0xf3e8('0xc'),auth[_0xf3e8('0x9')](),controller[_0xf3e8('0x16')]);router[_0xf3e8('0x14')]('/:id/canned_answers',auth[_0xf3e8('0x9')](),controller[_0xf3e8('0x17')]);router[_0xf3e8('0x14')]('/:id/notify',controller[_0xf3e8('0x18')]);router['post'](_0xf3e8('0x19'),auth[_0xf3e8('0x9')](),controller[_0xf3e8('0x1a')]);router[_0xf3e8('0x14')](_0xf3e8('0x12'),auth[_0xf3e8('0x9')](),controller[_0xf3e8('0x1b')]);router[_0xf3e8('0x14')](_0xf3e8('0x1c'),auth[_0xf3e8('0x9')](),controller[_0xf3e8('0x1d')]);router[_0xf3e8('0x1e')](_0xf3e8('0xa'),auth[_0xf3e8('0x9')](),controller[_0xf3e8('0x1f')]);router[_0xf3e8('0x20')](_0xf3e8('0xa'),auth['isAuthenticated'](),controller[_0xf3e8('0x21')]);router['delete'](_0xf3e8('0xc'),auth[_0xf3e8('0x9')](),controller[_0xf3e8('0x22')]);router['delete'](_0xf3e8('0xd'),auth['isAuthenticated'](),controller[_0xf3e8('0x23')]);router[_0xf3e8('0x20')](_0xf3e8('0x12'),auth[_0xf3e8('0x9')](),controller['removeAgents']);module[_0xf3e8('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 fa7d891..c134bae 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 _0xdb75=['generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDisposition','sequelize','randomstring','exports','STRING','name'];(function(_0x59069b,_0x2f3ac0){var _0x37b657=function(_0x2f9329){while(--_0x2f9329){_0x59069b['push'](_0x59069b['shift']());}};_0x37b657(++_0x2f3ac0);}(_0xdb75,0x14d));var _0x5db7=function(_0x20fb90,_0x4c9e4e){_0x20fb90=_0x20fb90-0x0;var _0x25cba1=_0xdb75[_0x20fb90];return _0x25cba1;};'use strict';var Sequelize=require(_0x5db7('0x0'));var rs=require(_0x5db7('0x1'));module[_0x5db7('0x2')]={'name':{'type':Sequelize[_0x5db7('0x3')],'unique':_0x5db7('0x4'),'allowNull':![]},'description':{'type':Sequelize[_0x5db7('0x3')]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x5db7('0x5')]();}},'replyUri':{'type':Sequelize['STRING'],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x5db7('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x5db7('0x6')],'defaultValue':function(){return _0x5db7('0x7');}},'notificationSound':{'type':Sequelize[_0x5db7('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x5db7('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x5db7('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x5db7('0x3')]},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x5db7('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x5db7('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x5db7('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x5db7('0x9')],'allowNull':!![],'defaultValue':null,'comment':_0x5db7('0xa')},'mandatoryDisposition':{'type':Sequelize[_0x5db7('0x8')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x171cb4){if(!_0x171cb4)this[_0x5db7('0xb')]('mandatoryDispositionPauseId',null);this['setDataValue'](_0x5db7('0xc'),_0x171cb4);}}}; \ No newline at end of file +var _0xcca3=['INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','name','STRING','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN'];(function(_0x47a5bd,_0x508329){var _0x5c2184=function(_0x40ddea){while(--_0x40ddea){_0x47a5bd['push'](_0x47a5bd['shift']());}};_0x5c2184(++_0x508329);}(_0xcca3,0x114));var _0x3cca=function(_0x6f114,_0x2ac0f9){_0x6f114=_0x6f114-0x0;var _0x40546b=_0xcca3[_0x6f114];return _0x40546b;};'use strict';var Sequelize=require(_0x3cca('0x0'));var rs=require(_0x3cca('0x1'));module[_0x3cca('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0x3cca('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x3cca('0x4')]},'token':{'type':Sequelize[_0x3cca('0x4')],'defaultValue':function(){return rs[_0x3cca('0x5')]();}},'replyUri':{'type':Sequelize[_0x3cca('0x4')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x3cca('0x4')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x3cca('0x6')],'defaultValue':function(){return _0x3cca('0x7');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x3cca('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x3cca('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x3cca('0x4')]},'queueTransfer':{'type':Sequelize[_0x3cca('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x3cca('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x3cca('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x3cca('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x3cca('0xa')},'mandatoryDisposition':{'type':Sequelize[_0x3cca('0x8')],'defaultValue':![],'comment':_0x3cca('0xb'),'set':function(_0x59e2dc){if(!_0x59e2dc)this[_0x3cca('0xc')](_0x3cca('0xd'),null);this[_0x3cca('0xc')](_0x3cca('0xe'),_0x59e2dc);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index a9dddfd..69b8eb4 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 _0xffef=['body','destroy','describe','OpnechannelAccountId','getDispositions','findOne','Disposition','hasOwnProperty','removeDispositions','OpenchannelAccountId','CannedAnswer','removeAnswers','ids','notify','openchannel','no\x20available\x20attributes','createdAt','updatedAt','difference','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','List','CmContact','Contacts','DESC','OpenchannelApplication','account','applications','Applications','list','priority','asc','contact','firstName','threadId','OpenchannelInteraction','ContactId','spread','messageId','interaction','created','autoclose','push','*,*,*,*','AttachmentId','UserId','User','agent','waitForTheAssignedAgent','Start','startRouting','EventManager','addApplications','sequelize','transaction','bulkCreate','findAndCountAll','getApplications','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','color','tag','addAgents','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','CmList','out','OpenchannelMessage','Messages','dataValues','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','jayson/promise','http','client','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','OpenchannelAccount,\x20%s,\x20%s','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','status','end','json','count','offset','Content-Range','reject','save','update','get','UserProfileResource','sendStatus','stack','name','Pause','mandatoryDispositionPause','map','type','model','query','keys','filters','fields','attributes','length','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','filter','options','OpenchannelAccount','includeAll','include','findAll','rows','show','params','rawAttributes','intersection','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xffef,0x1cb));var _0xfffe=function(_0x14d0d5,_0x5d25ac){_0x14d0d5=_0x14d0d5-0x0;var _0x2946b1=_0xffef[_0x14d0d5];return _0x2946b1;};'use strict';var pdf=require(_0xfffe('0x0'));var emlformat=require(_0xfffe('0x1'));var rimraf=require(_0xfffe('0x2'));var zipdir=require(_0xfffe('0x3'));var jsonpatch=require(_0xfffe('0x4'));var rp=require(_0xfffe('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xfffe('0x6'));var util=require(_0xfffe('0x7'));var path=require(_0xfffe('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xfffe('0x9'));var fs=require('fs');var _=require(_0xfffe('0xa'));var squel=require(_0xfffe('0xb'));var crypto=require(_0xfffe('0xc'));var jsforce=require(_0xfffe('0xd'));var deskjs=require(_0xfffe('0xe'));var toCsv=require(_0xfffe('0xf'));var querystring=require(_0xfffe('0x10'));var Papa=require(_0xfffe('0x11'));var Redis=require('ioredis');var authService=require(_0xfffe('0x12'));var qs=require(_0xfffe('0x13'));var as=require(_0xfffe('0x14'));var hardwareService=require(_0xfffe('0x15'));var logger=require(_0xfffe('0x16'))(_0xfffe('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xfffe('0x18'))['db'];config[_0xfffe('0x19')]=_[_0xfffe('0x1a')](config['redis'],{'host':_0xfffe('0x1b'),'port':0x18eb});var socket=require(_0xfffe('0x1c'))(new Redis(config[_0xfffe('0x19')]));require('./openchannelAccount.socket')['register'](socket);var jayson=require(_0xfffe('0x1d'));var client=jayson['client'][_0xfffe('0x1e')]({'port':0x232c});var client9002=jayson[_0xfffe('0x1f')]['http']({'port':0x232a});function checkPasswordPattern(_0x3f2769,_0x2fe068,_0xaf3baf){if(_0xaf3baf){var _0x2a5641=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2a5641[_0xfffe('0x20')](_0x2fe068)){return _0x3f2769;}else{throw new db[(_0xfffe('0x21'))][(_0xfffe('0x22'))](_0xfffe('0x23'));}}else{return _0x3f2769;}}function respondWithRpcPromise(_0x57e96e,_0x469513,_0x22c8c6,_0x2c3a9e){return new BPromise(function(_0x2de60a,_0xb60a58){var _0x3eef7a=_0x2c3a9e||client;return _0x3eef7a[_0xfffe('0x24')](_0x57e96e,_0x22c8c6)[_0xfffe('0x25')](function(_0x7c7eca){logger[_0xfffe('0x26')](_0xfffe('0x27'),_0x469513,'request\x20sent');logger[_0xfffe('0x28')](_0xfffe('0x29'),_0x469513,_0xfffe('0x2a'),JSON[_0xfffe('0x2b')](_0x7c7eca));if(_0x7c7eca[_0xfffe('0x2c')]){if(_0x7c7eca[_0xfffe('0x2c')][_0xfffe('0x2d')]===0x1f4){logger['error'](_0xfffe('0x27'),_0x469513,_0x7c7eca['error'][_0xfffe('0x2e')]);return _0xb60a58(_0x7c7eca['error'][_0xfffe('0x2e')]);}logger[_0xfffe('0x2c')]('OpenchannelAccount,\x20%s,\x20%s',_0x469513,_0x7c7eca['error'][_0xfffe('0x2e')]);return _0x2de60a(_0x7c7eca['error']['message']);}else{logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x469513,_0xfffe('0x2a'));_0x2de60a(_0x7c7eca[_0xfffe('0x2f')][_0xfffe('0x2e')]);}})[_0xfffe('0x30')](function(_0x1b90d6){logger[_0xfffe('0x2c')](_0xfffe('0x27'),_0x469513,_0x1b90d6);_0xb60a58(_0x1b90d6);});});}function respondWithStatusCode(_0x44b9d5,_0x2e8eae){_0x2e8eae=_0x2e8eae||0xcc;return function(_0x2f32cd){if(_0x2f32cd){return _0x44b9d5['sendStatus'](_0x2e8eae);}return _0x44b9d5[_0xfffe('0x31')](_0x2e8eae)[_0xfffe('0x32')]();};}function respondWithResult(_0x196d02,_0x16af9c){_0x16af9c=_0x16af9c||0xc8;return function(_0x4b325f){if(_0x4b325f){return _0x196d02['status'](_0x16af9c)[_0xfffe('0x33')](_0x4b325f);}};}function respondWithFilteredResult(_0x30eceb,_0x1f0a8d){return function(_0x4b8181){if(_0x4b8181){var _0x2ccce8=_0x4b8181[_0xfffe('0x34')],_0x328343=_0x1f0a8d[_0xfffe('0x35')],_0x285abc=_0x1f0a8d[_0xfffe('0x35')]+_0x1f0a8d['limit'],_0x5d9f60;if(_0x285abc>=_0x2ccce8){_0x285abc=_0x2ccce8;_0x5d9f60=0xc8;}else{_0x5d9f60=0xce;}_0x30eceb[_0xfffe('0x31')](_0x5d9f60);return _0x30eceb['set'](_0xfffe('0x36'),_0x328343+'-'+_0x285abc+'/'+_0x2ccce8)[_0xfffe('0x33')](_0x4b8181);}return null;};}function patchUpdates(_0x3919fd){return function(_0xcf9cbd){try{jsonpatch['apply'](_0xcf9cbd,_0x3919fd,!![]);}catch(_0x591b7a){return BPromise[_0xfffe('0x37')](_0x591b7a);}return _0xcf9cbd[_0xfffe('0x38')]();};}function saveUpdates(_0xf0b37c,_0x3c7b6b){return function(_0x256883){if(_0x256883){return _0x256883[_0xfffe('0x39')](_0xf0b37c)[_0xfffe('0x25')](function(_0x5f3917){return _0x5f3917;});}return null;};}function removeEntity(_0x471454,_0x371a49){return function(_0x12bed5){if(_0x12bed5){return _0x12bed5['destroy']()[_0xfffe('0x25')](function(){var _0xa259fe=_0x12bed5[_0xfffe('0x3a')]({'plain':!![]});var _0xab914d='OpenchannelAccounts';return db[_0xfffe('0x3b')]['destroy']({'where':{'type':_0xab914d,'resourceId':_0xa259fe['id']}})[_0xfffe('0x25')](function(){return _0x12bed5;});})['then'](function(){_0x471454[_0xfffe('0x31')](0xcc)[_0xfffe('0x32')]();});}};}function handleEntityNotFound(_0x2ff04d,_0x4e4988){return function(_0x41831b){if(!_0x41831b){_0x2ff04d[_0xfffe('0x3c')](0x194);}return _0x41831b;};}function handleError(_0x1d6771,_0x507964){_0x507964=_0x507964||0x1f4;return function(_0x5a2624){logger[_0xfffe('0x2c')](_0x5a2624[_0xfffe('0x3d')]);if(_0x5a2624[_0xfffe('0x3e')]){delete _0x5a2624[_0xfffe('0x3e')];}_0x1d6771['status'](_0x507964)['send'](_0x5a2624);};}exports['index']=function(_0x1329d6,_0x1cbf92){var _0x542dbf={'include':[{'model':db[_0xfffe('0x3f')],'as':_0xfffe('0x40')}]},_0x2b6e93={},_0x343ab9={'count':0x0,'rows':[]};var _0x47e353=_[_0xfffe('0x41')](db['OpenchannelAccount']['rawAttributes'],function(_0xe8d602){return{'name':_0xe8d602['fieldName'],'type':_0xe8d602[_0xfffe('0x42')]['key']};});_0x2b6e93[_0xfffe('0x43')]=_[_0xfffe('0x41')](_0x47e353,_0xfffe('0x3e'));_0x2b6e93[_0xfffe('0x44')]=_[_0xfffe('0x45')](_0x1329d6[_0xfffe('0x44')]);_0x2b6e93[_0xfffe('0x46')]=_['intersection'](_0x2b6e93[_0xfffe('0x43')],_0x2b6e93[_0xfffe('0x44')]);_0x542dbf['attributes']=_['intersection'](_0x2b6e93['model'],qs[_0xfffe('0x47')](_0x1329d6['query']['fields']));_0x542dbf[_0xfffe('0x48')]=_0x542dbf[_0xfffe('0x48')][_0xfffe('0x49')]?_0x542dbf[_0xfffe('0x48')]:_0x2b6e93[_0xfffe('0x43')];if(!_0x1329d6[_0xfffe('0x44')]['hasOwnProperty'](_0xfffe('0x4a'))){_0x542dbf['limit']=qs[_0xfffe('0x4b')](_0x1329d6[_0xfffe('0x44')][_0xfffe('0x4b')]);_0x542dbf[_0xfffe('0x35')]=qs[_0xfffe('0x35')](_0x1329d6[_0xfffe('0x44')][_0xfffe('0x35')]);}_0x542dbf[_0xfffe('0x4c')]=qs[_0xfffe('0x4d')](_0x1329d6[_0xfffe('0x44')]['sort']);_0x542dbf[_0xfffe('0x4e')]=qs[_0xfffe('0x46')](_[_0xfffe('0x4f')](_0x1329d6[_0xfffe('0x44')],_0x2b6e93[_0xfffe('0x46')]),_0x47e353);if(_0x1329d6[_0xfffe('0x44')]['filter']){_0x542dbf[_0xfffe('0x4e')]=_[_0xfffe('0x50')](_0x542dbf[_0xfffe('0x4e')],{'$or':_[_0xfffe('0x41')](_0x47e353,function(_0x16cf17){if(_0x16cf17[_0xfffe('0x42')]!==_0xfffe('0x51')){var _0x350c51={};_0x350c51[_0x16cf17[_0xfffe('0x3e')]]={'$like':'%'+_0x1329d6[_0xfffe('0x44')][_0xfffe('0x52')]+'%'};return _0x350c51;}})});}_0x542dbf=_[_0xfffe('0x50')]({},_0x542dbf,_0x1329d6[_0xfffe('0x53')]);var _0x104ec4={'where':_0x542dbf[_0xfffe('0x4e')]};return db[_0xfffe('0x54')][_0xfffe('0x34')](_0x104ec4)[_0xfffe('0x25')](function(_0x5430ef){_0x343ab9[_0xfffe('0x34')]=_0x5430ef;if(_0x1329d6[_0xfffe('0x44')][_0xfffe('0x55')]){_0x542dbf[_0xfffe('0x56')]=[{'all':!![]}];}return db[_0xfffe('0x54')][_0xfffe('0x57')](_0x542dbf);})['then'](function(_0x55326f){_0x343ab9[_0xfffe('0x58')]=_0x55326f;return _0x343ab9;})[_0xfffe('0x25')](respondWithFilteredResult(_0x1cbf92,_0x542dbf))[_0xfffe('0x30')](handleError(_0x1cbf92,null));};exports[_0xfffe('0x59')]=function(_0x47bdab,_0x346692){var _0x230f31={'raw':![],'where':{'id':_0x47bdab[_0xfffe('0x5a')]['id']},'include':[{'model':db[_0xfffe('0x3f')],'as':_0xfffe('0x40')}]},_0x358419={};_0x358419[_0xfffe('0x43')]=_['keys'](db['OpenchannelAccount'][_0xfffe('0x5b')]);_0x358419[_0xfffe('0x44')]=_['keys'](_0x47bdab[_0xfffe('0x44')]);_0x358419[_0xfffe('0x46')]=_[_0xfffe('0x5c')](_0x358419['model'],_0x358419[_0xfffe('0x44')]);_0x230f31[_0xfffe('0x48')]=_[_0xfffe('0x5c')](_0x358419['model'],qs[_0xfffe('0x47')](_0x47bdab[_0xfffe('0x44')][_0xfffe('0x47')]));_0x230f31[_0xfffe('0x48')]=_0x230f31['attributes']['length']?_0x230f31[_0xfffe('0x48')]:_0x358419[_0xfffe('0x43')];if(_0x47bdab[_0xfffe('0x44')]['includeAll']){_0x230f31['include']=[{'all':!![]}];}_0x230f31=_[_0xfffe('0x50')]({},_0x230f31,_0x47bdab[_0xfffe('0x53')]);return db[_0xfffe('0x54')][_0xfffe('0x5d')](_0x230f31)[_0xfffe('0x25')](handleEntityNotFound(_0x346692,null))[_0xfffe('0x25')](respondWithResult(_0x346692,null))['catch'](handleError(_0x346692,null));};exports[_0xfffe('0x5e')]=function(_0x378f6d,_0x3718e5){return db[_0xfffe('0x54')][_0xfffe('0x5e')](_0x378f6d['body'],{})['then'](function(_0x26defd){var _0x208d54=_0x378f6d[_0xfffe('0x5f')][_0xfffe('0x3a')]({'plain':!![]});if(!_0x208d54)throw new Error(_0xfffe('0x60'));if(_0x208d54['role']===_0xfffe('0x5f')){var _0x20c74b=_0x26defd['get']({'plain':!![]});var _0xa5546d='OpenchannelAccounts';return db['UserProfileSection'][_0xfffe('0x5d')]({'where':{'name':_0xa5546d,'userProfileId':_0x208d54['userProfileId']},'raw':!![]})['then'](function(_0xbb2e0a){if(_0xbb2e0a&&_0xbb2e0a[_0xfffe('0x61')]===0x0){return db[_0xfffe('0x3b')][_0xfffe('0x5e')]({'name':_0x20c74b[_0xfffe('0x3e')],'resourceId':_0x20c74b['id'],'type':_0xbb2e0a[_0xfffe('0x3e')],'sectionId':_0xbb2e0a['id']},{})[_0xfffe('0x25')](function(){return _0x26defd;});}else{return _0x26defd;}})[_0xfffe('0x30')](function(_0x46c672){logger[_0xfffe('0x2c')](_0xfffe('0x62'),_0x46c672);throw _0x46c672;});}return _0x26defd;})[_0xfffe('0x25')](respondWithResult(_0x3718e5,0xc9))[_0xfffe('0x30')](handleError(_0x3718e5,null));};exports[_0xfffe('0x39')]=function(_0x573652,_0x394b5d){if(_0x573652['body']['id']){delete _0x573652[_0xfffe('0x63')]['id'];}return db[_0xfffe('0x54')][_0xfffe('0x5d')]({'where':{'id':_0x573652[_0xfffe('0x5a')]['id']},'include':[{'model':db[_0xfffe('0x3f')],'as':_0xfffe('0x40')}]})[_0xfffe('0x25')](handleEntityNotFound(_0x394b5d,null))[_0xfffe('0x25')](saveUpdates(_0x573652[_0xfffe('0x63')],null))[_0xfffe('0x25')](respondWithResult(_0x394b5d,null))[_0xfffe('0x30')](handleError(_0x394b5d,null));};exports[_0xfffe('0x64')]=function(_0x35663a,_0x12c5be){return db[_0xfffe('0x54')][_0xfffe('0x5d')]({'where':{'id':_0x35663a['params']['id']}})['then'](handleEntityNotFound(_0x12c5be,null))[_0xfffe('0x25')](removeEntity(_0x12c5be,null))[_0xfffe('0x30')](handleError(_0x12c5be,null));};exports[_0xfffe('0x65')]=function(_0x24db5f,_0x16b683){return db[_0xfffe('0x54')][_0xfffe('0x65')]()[_0xfffe('0x25')](respondWithResult(_0x16b683,null))[_0xfffe('0x30')](handleError(_0x16b683,null));};exports['addDisposition']=function(_0x12387e,_0x5562a9,_0x5bce7d){if(_0x12387e['body']['id']){delete _0x12387e[_0xfffe('0x63')]['id'];}return db['OpenchannelAccount'][_0xfffe('0x5d')]({'where':{'id':_0x12387e['params']['id']}})[_0xfffe('0x25')](handleEntityNotFound(_0x5562a9,null))[_0xfffe('0x25')](function(_0x211da8){if(_0x211da8){_0x12387e[_0xfffe('0x63')][_0xfffe('0x66')]=_0x211da8['id'];return db['Disposition']['create'](_0x12387e[_0xfffe('0x63')]);}})[_0xfffe('0x25')](respondWithResult(_0x5562a9,null))[_0xfffe('0x30')](handleError(_0x5562a9,null));};exports[_0xfffe('0x67')]=function(_0x466b7b,_0x309978,_0x4d9dfe){var _0x59a25e={'raw':![],'where':{}};var _0x15397c={};var _0x264508={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xfffe('0x68')]({'where':{'id':_0x466b7b[_0xfffe('0x5a')]['id']}})[_0xfffe('0x25')](handleEntityNotFound(_0x309978,null))[_0xfffe('0x25')](function(_0x5a18a7){if(_0x5a18a7){_0x15397c[_0xfffe('0x43')]=_['keys'](db[_0xfffe('0x69')]['rawAttributes']);_0x15397c[_0xfffe('0x44')]=_[_0xfffe('0x45')](_0x466b7b[_0xfffe('0x44')]);_0x15397c[_0xfffe('0x46')]=_['intersection'](_0x15397c[_0xfffe('0x43')],_0x15397c['query']);_0x59a25e[_0xfffe('0x48')]=_[_0xfffe('0x5c')](_0x15397c[_0xfffe('0x43')],qs[_0xfffe('0x47')](_0x466b7b[_0xfffe('0x44')][_0xfffe('0x47')]));_0x59a25e[_0xfffe('0x48')]=_0x59a25e['attributes'][_0xfffe('0x49')]?_0x59a25e[_0xfffe('0x48')]:_0x15397c[_0xfffe('0x43')];if(!_0x466b7b[_0xfffe('0x44')][_0xfffe('0x6a')]('nolimit')){_0x59a25e[_0xfffe('0x4b')]=qs[_0xfffe('0x4b')](_0x466b7b[_0xfffe('0x44')][_0xfffe('0x4b')]);_0x59a25e[_0xfffe('0x35')]=qs[_0xfffe('0x35')](_0x466b7b['query'][_0xfffe('0x35')]);}_0x59a25e[_0xfffe('0x4c')]=qs[_0xfffe('0x4d')](_0x466b7b[_0xfffe('0x44')][_0xfffe('0x4d')]);_0x59a25e[_0xfffe('0x4e')]=qs[_0xfffe('0x46')](_[_0xfffe('0x4f')](_0x466b7b[_0xfffe('0x44')],_0x15397c[_0xfffe('0x46')]));_0x59a25e[_0xfffe('0x4e')]['OpenchannelAccountId']=_0x5a18a7['id'];if(_0x466b7b[_0xfffe('0x44')][_0xfffe('0x52')]){_0x59a25e[_0xfffe('0x4e')]=_[_0xfffe('0x50')](_0x59a25e[_0xfffe('0x4e')],{'$or':_['map'](_0x59a25e[_0xfffe('0x48')],function(_0x19f82a){var _0x4e461f={};_0x4e461f[_0x19f82a]={'$like':'%'+_0x466b7b[_0xfffe('0x44')][_0xfffe('0x52')]+'%'};return _0x4e461f;})});}_0x59a25e=_[_0xfffe('0x50')]({},_0x59a25e,_0x466b7b['options']);return db[_0xfffe('0x69')]['count']({'where':_0x59a25e[_0xfffe('0x4e')]})[_0xfffe('0x25')](function(_0x24b8fd){_0x264508[_0xfffe('0x34')]=_0x24b8fd;if(_0x466b7b[_0xfffe('0x44')][_0xfffe('0x55')]){_0x59a25e[_0xfffe('0x56')]=[{'all':!![]}];}return db['Disposition'][_0xfffe('0x57')](_0x59a25e);})[_0xfffe('0x25')](function(_0xe661d1){_0x264508[_0xfffe('0x58')]=_0xe661d1;return _0x264508;});}})[_0xfffe('0x25')](respondWithFilteredResult(_0x309978,_0x59a25e))[_0xfffe('0x30')](handleError(_0x309978,null));};exports[_0xfffe('0x6b')]=function(_0x1fe12c,_0x4e0077,_0x38012c){return db['OpenchannelAccount']['find']({'where':{'id':_0x1fe12c[_0xfffe('0x5a')]['id']}})['then'](handleEntityNotFound(_0x4e0077,null))[_0xfffe('0x25')](function(_0x372272){if(_0x372272){return _0x372272['removeDispositions'](_0x1fe12c['query']['ids']);}})[_0xfffe('0x25')](respondWithStatusCode(_0x4e0077,null))[_0xfffe('0x30')](handleError(_0x4e0077,null));};exports['addAnswer']=function(_0x56ba0a,_0x56066f,_0x243115){if(_0x56ba0a[_0xfffe('0x63')]['id']){delete _0x56ba0a['body']['id'];}return db[_0xfffe('0x54')]['find']({'where':{'id':_0x56ba0a[_0xfffe('0x5a')]['id']}})[_0xfffe('0x25')](handleEntityNotFound(_0x56066f,null))['then'](function(_0x166059){if(_0x166059){_0x56ba0a[_0xfffe('0x63')][_0xfffe('0x6c')]=_0x166059['id'];return db[_0xfffe('0x6d')][_0xfffe('0x5e')](_0x56ba0a['body']);}})[_0xfffe('0x25')](respondWithResult(_0x56066f,null))[_0xfffe('0x30')](handleError(_0x56066f,null));};exports['getAnswers']=function(_0x162191,_0x586712,_0x396e3b){var _0x18bfec={'raw':![],'where':{}};var _0x457edc={};var _0x1ecfd5={'count':0x0,'rows':[]};return db[_0xfffe('0x54')][_0xfffe('0x68')]({'where':{'id':_0x162191['params']['id']}})['then'](handleEntityNotFound(_0x586712,null))[_0xfffe('0x25')](function(_0x5627c9){if(_0x5627c9){_0x457edc[_0xfffe('0x43')]=_[_0xfffe('0x45')](db[_0xfffe('0x6d')]['rawAttributes']);_0x457edc[_0xfffe('0x44')]=_[_0xfffe('0x45')](_0x162191[_0xfffe('0x44')]);_0x457edc[_0xfffe('0x46')]=_[_0xfffe('0x5c')](_0x457edc['model'],_0x457edc['query']);_0x18bfec[_0xfffe('0x48')]=_[_0xfffe('0x5c')](_0x457edc['model'],qs[_0xfffe('0x47')](_0x162191[_0xfffe('0x44')]['fields']));_0x18bfec[_0xfffe('0x48')]=_0x18bfec[_0xfffe('0x48')][_0xfffe('0x49')]?_0x18bfec[_0xfffe('0x48')]:_0x457edc[_0xfffe('0x43')];if(!_0x162191['query'][_0xfffe('0x6a')]('nolimit')){_0x18bfec[_0xfffe('0x4b')]=qs[_0xfffe('0x4b')](_0x162191[_0xfffe('0x44')]['limit']);_0x18bfec[_0xfffe('0x35')]=qs['offset'](_0x162191[_0xfffe('0x44')]['offset']);}_0x18bfec['order']=qs['sort'](_0x162191['query'][_0xfffe('0x4d')]);_0x18bfec['where']=qs['filters'](_[_0xfffe('0x4f')](_0x162191['query'],_0x457edc[_0xfffe('0x46')]));_0x18bfec[_0xfffe('0x4e')][_0xfffe('0x6c')]=_0x5627c9['id'];if(_0x162191[_0xfffe('0x44')][_0xfffe('0x52')]){_0x18bfec[_0xfffe('0x4e')]=_[_0xfffe('0x50')](_0x18bfec[_0xfffe('0x4e')],{'$or':_[_0xfffe('0x41')](_0x18bfec[_0xfffe('0x48')],function(_0x1219ab){var _0x1b1bb1={};_0x1b1bb1[_0x1219ab]={'$like':'%'+_0x162191[_0xfffe('0x44')][_0xfffe('0x52')]+'%'};return _0x1b1bb1;})});}_0x18bfec=_[_0xfffe('0x50')]({},_0x18bfec,_0x162191[_0xfffe('0x53')]);return db[_0xfffe('0x6d')][_0xfffe('0x34')]({'where':_0x18bfec[_0xfffe('0x4e')]})[_0xfffe('0x25')](function(_0x3e8707){_0x1ecfd5[_0xfffe('0x34')]=_0x3e8707;if(_0x162191[_0xfffe('0x44')][_0xfffe('0x55')]){_0x18bfec[_0xfffe('0x56')]=[{'all':!![]}];}return db['CannedAnswer'][_0xfffe('0x57')](_0x18bfec);})[_0xfffe('0x25')](function(_0x5bb568){_0x1ecfd5[_0xfffe('0x58')]=_0x5bb568;return _0x1ecfd5;});}})[_0xfffe('0x25')](respondWithFilteredResult(_0x586712,_0x18bfec))['catch'](handleError(_0x586712,null));};exports['removeAnswers']=function(_0x569cc5,_0x119dd2,_0x545b54){return db[_0xfffe('0x54')][_0xfffe('0x5d')]({'where':{'id':_0x569cc5[_0xfffe('0x5a')]['id']}})['then'](handleEntityNotFound(_0x119dd2,null))[_0xfffe('0x25')](function(_0x1ce729){if(_0x1ce729){return _0x1ce729[_0xfffe('0x6e')](_0x569cc5[_0xfffe('0x44')][_0xfffe('0x6f')]);}})[_0xfffe('0x25')](respondWithStatusCode(_0x119dd2,null))[_0xfffe('0x30')](handleError(_0x119dd2,null));};exports[_0xfffe('0x70')]=function(_0x28aa8e,_0x17d464,_0x3e6706){var _0x4c68fd={'body':_0x28aa8e[_0xfffe('0x63')],'channel':_0xfffe('0x71')};var _0x58a61a=[];var _0x5b12a1=[];var _0x3e7b57={};var _0x562b69=![];return db['CmContact'][_0xfffe('0x65')]()[_0xfffe('0x25')](function(_0x19de43){if(!_0x19de43){throw new db[(_0xfffe('0x21'))][(_0xfffe('0x22'))](_0xfffe('0x72'));}_0x58a61a=_['difference'](_[_0xfffe('0x45')](_0x19de43),[_0xfffe('0x73'),_0xfffe('0x74')]);_0x5b12a1=_[_0xfffe('0x75')](_[_0xfffe('0x45')](_0x19de43),['createdAt',_0xfffe('0x74'),_0xfffe('0x76'),_0xfffe('0x77')]);if(_0x28aa8e[_0xfffe('0x63')]['id']){delete _0x28aa8e[_0xfffe('0x63')]['id'];}if(_[_0xfffe('0x78')](_0x28aa8e['body'][_0xfffe('0x79')])){throw new db[(_0xfffe('0x21'))][(_0xfffe('0x22'))](_0xfffe('0x7a'));}if(_['isNil'](_0x28aa8e[_0xfffe('0x63')][_0xfffe('0x63')])||_0x28aa8e[_0xfffe('0x63')][_0xfffe('0x63')]===''){throw new db[(_0xfffe('0x21'))][(_0xfffe('0x22'))](_0xfffe('0x7b'));}if(_[_0xfffe('0x78')](_0x28aa8e['body']['mapKey'])){throw new db[(_0xfffe('0x21'))][(_0xfffe('0x22'))](_0xfffe('0x7c')+_0x5b12a1);}if(!_[_0xfffe('0x7d')](_0x5b12a1,_0x28aa8e[_0xfffe('0x63')][_0xfffe('0x7e')])){throw new db[(_0xfffe('0x21'))]['ValidationError'](_0xfffe('0x7f')+_0x5b12a1);}_0x3e7b57[_0x28aa8e[_0xfffe('0x63')][_0xfffe('0x7e')]]=_0x28aa8e[_0xfffe('0x63')][_0xfffe('0x79')];})[_0xfffe('0x25')](function(){return db[_0xfffe('0x54')][_0xfffe('0x5d')]({'where':{'id':_0x28aa8e[_0xfffe('0x5a')]['id']},'include':[{'model':db['CmList'],'as':_0xfffe('0x80'),'include':[{'model':db[_0xfffe('0x81')],'as':_0xfffe('0x82'),'where':_0x3e7b57,'limit':0x1,'order':[[_0xfffe('0x74'),_0xfffe('0x83')]]}]},{'model':db[_0xfffe('0x84')],'as':'Applications'}]});})[_0xfffe('0x25')](handleEntityNotFound(_0x17d464,null))[_0xfffe('0x25')](function(_0x189669){if(_0x189669&&_0x189669[_0xfffe('0x80')]){_0x4c68fd[_0xfffe('0x85')]=_0x189669;_0x4c68fd[_0xfffe('0x86')]=_0x189669[_0xfffe('0x87')];_0x4c68fd[_0xfffe('0x88')]=_0x189669[_0xfffe('0x80')];_0x4c68fd[_0xfffe('0x86')]=_['orderBy'](_0x4c68fd['applications'],[_0xfffe('0x89')],[_0xfffe('0x8a')]);if(_0x4c68fd['account'][_0xfffe('0x87')]){delete _0x4c68fd[_0xfffe('0x85')]['Applications'];}if(_0x4c68fd[_0xfffe('0x85')][_0xfffe('0x80')]&&_0x4c68fd[_0xfffe('0x85')][_0xfffe('0x80')][_0xfffe('0x82')][_0xfffe('0x49')]){return _0x4c68fd[_0xfffe('0x85')]['List'][_0xfffe('0x82')][0x0];}var _0x435f76=_[_0xfffe('0x1a')](_0x28aa8e[_0xfffe('0x63')],{'firstName':_0x28aa8e[_0xfffe('0x63')][_0xfffe('0x79')],'ListId':_0x189669['ListId']});_0x435f76[_0x28aa8e[_0xfffe('0x63')][_0xfffe('0x7e')]]=_0x28aa8e[_0xfffe('0x63')]['from'];return db[_0xfffe('0x81')][_0xfffe('0x5e')](_0x435f76,{'fields':_0x58a61a,'raw':!![]});}})[_0xfffe('0x25')](handleEntityNotFound(_0x17d464,null))[_0xfffe('0x25')](function(_0x98172c){_0x4c68fd[_0xfffe('0x8b')]=_0x98172c;if(_0x98172c){var _0x2e426e={'ContactId':_0x98172c['id'],'OpenchannelAccountId':_0x28aa8e['params']['id'],'from':(_0x98172c[_0xfffe('0x8c')]||'')+'\x20'+(_0x98172c['lastName']||'')};var _0x2875e3={'OpenchannelAccountId':_0x28aa8e['params']['id'],'closed':![]};if(_0x28aa8e[_0xfffe('0x63')]['threadId']){_0x2875e3[_0xfffe('0x8d')]=_0x28aa8e['body']['threadId'];return db[_0xfffe('0x8e')][_0xfffe('0x5d')]({'where':_0x2875e3})[_0xfffe('0x25')](function(_0x53bb06){if(_0x53bb06){return[_0x53bb06,![]];}_0x2e426e[_0xfffe('0x8d')]=_0x28aa8e[_0xfffe('0x63')][_0xfffe('0x8d')];_0x2e426e['externalUrl']=_0x28aa8e[_0xfffe('0x63')]['externalUrl'];return db[_0xfffe('0x8e')][_0xfffe('0x5e')](_0x2e426e)[_0xfffe('0x25')](function(_0x54c027){return[_0x54c027,!![]];});});}else{_0x2875e3[_0xfffe('0x8d')]=null;}_0x2875e3[_0xfffe('0x8f')]=_0x98172c['id'];return db[_0xfffe('0x8e')][_0xfffe('0x5d')]({'where':_0x2875e3})[_0xfffe('0x25')](function(_0x45ded9){if(_0x45ded9){return[_0x45ded9,![]];}return db[_0xfffe('0x8e')]['create'](_0x2e426e)['then'](function(_0x5c0e4b){return[_0x5c0e4b,!![]];});});}})[_0xfffe('0x90')](function(_0x558005,_0x398892){if(_0x558005){_0x562b69=_0x398892;if(!_0x398892){var _0x17cdac={'from':(_0x4c68fd['contact'][_0xfffe('0x8c')]||'')+'\x20'+(_0x4c68fd[_0xfffe('0x8b')]['lastName']||'')};if(_0x28aa8e[_0xfffe('0x63')]['threadId']&&_0x28aa8e['body']['messageId']&&_0x28aa8e[_0xfffe('0x63')][_0xfffe('0x8d')]!=_0x28aa8e[_0xfffe('0x63')][_0xfffe('0x91')]){_0x17cdac[_0xfffe('0x8d')]=_0x28aa8e['body'][_0xfffe('0x91')];}return _0x558005[_0xfffe('0x39')](_0x17cdac);}else{return _0x558005;}}})[_0xfffe('0x25')](function(_0x371b64){_0x4c68fd[_0xfffe('0x92')]=_0x371b64[_0xfffe('0x3a')]({'plain':!![]});_0x4c68fd['interaction'][_0xfffe('0x93')]=_0x562b69;if(_0x4c68fd[_0xfffe('0x92')][_0xfffe('0x93')]){if(_0x4c68fd[_0xfffe('0x85')][_0xfffe('0x94')]){_0x4c68fd[_0xfffe('0x86')][_0xfffe('0x95')]({'id':0x0,'priority':_0x4c68fd[_0xfffe('0x86')][_0xfffe('0x49')]+0x1,'app':'close','appdata':'unmanaged','interval':_0xfffe('0x96')});}}return db['OpenchannelMessage']['create']({'body':_0x28aa8e[_0xfffe('0x63')][_0xfffe('0x63')],'OpenchannelAccountId':_0x28aa8e['params']['id'],'OpenchannelInteractionId':_0x371b64['id'],'direction':'in','ContactId':_0x4c68fd[_0xfffe('0x8b')]['id'],'AttachmentId':_0x28aa8e[_0xfffe('0x63')][_0xfffe('0x97')]});})[_0xfffe('0x25')](function(_0x175087){_0x4c68fd[_0xfffe('0x2e')]=_0x175087;if(_0x4c68fd[_0xfffe('0x92')][_0xfffe('0x98')]){return db[_0xfffe('0x99')][_0xfffe('0x5d')]({'attributes':['id',_0xfffe('0x3e')],'where':{'id':_0x4c68fd[_0xfffe('0x92')]['UserId']}})[_0xfffe('0x25')](function(_0x29ca07){if(_0x29ca07){_0x4c68fd[_0xfffe('0x86')]['unshift']({'id':0x0,'priority':0x0,'app':_0xfffe('0x9a'),'appdata':_0x29ca07[_0xfffe('0x3e')]+','+(_0x4c68fd[_0xfffe('0x85')][_0xfffe('0x9b')]||0xa),'interval':'*,*,*,*'});_0x4c68fd['forcedOwnership']=![];}return respondWithRpcPromise(_0xfffe('0x9c'),_0xfffe('0x9d'),_0x4c68fd);});}return respondWithRpcPromise(_0xfffe('0x9c'),_0xfffe('0x9d'),_0x4c68fd);})[_0xfffe('0x25')](function(_0x2f48d5){respondWithRpcPromise(_0xfffe('0x9e'),'EventManager',{'event':'notify','message':_0x2f48d5},client9002);return _0x2f48d5;})['then'](respondWithResult(_0x17d464,null))['catch'](handleError(_0x17d464,null));};exports[_0xfffe('0x9f')]=function(_0x797b5b,_0x53c93f,_0x5ce1d8){return db[_0xfffe('0x54')][_0xfffe('0x68')]({'where':{'id':_0x797b5b[_0xfffe('0x5a')]['id']}})[_0xfffe('0x25')](handleEntityNotFound(_0x53c93f,null))[_0xfffe('0x25')](function(_0x4e2426){if(_0x4e2426){return db[_0xfffe('0xa0')][_0xfffe('0xa1')](function(_0x361031){return db['OpenchannelApplication'][_0xfffe('0x64')]({'where':{'OpenchannelAccountId':_0x797b5b[_0xfffe('0x5a')]['id']},'transaction':_0x361031})[_0xfffe('0x25')](function(_0x2697ae){var _0x43210e=_[_0xfffe('0x41')](_0x797b5b['body'],function(_0xc5d3eb){_0xc5d3eb[_0xfffe('0x6c')]=_0x797b5b['params']['id'];return _0xc5d3eb;});return db[_0xfffe('0x84')][_0xfffe('0xa2')](_0x43210e,{'transaction':_0x361031});});})[_0xfffe('0x25')](function(){return db[_0xfffe('0x84')][_0xfffe('0xa3')]({'where':{'OpenchannelAccountId':_0x797b5b[_0xfffe('0x5a')]['id']},'order':_0xfffe('0x89')});});}})['then'](respondWithResult(_0x53c93f,null))[_0xfffe('0x30')](handleError(_0x53c93f,null));};exports[_0xfffe('0xa4')]=function(_0x37d2d1,_0x21bc00,_0x1bcc18){var _0x554912={};var _0x116618={};var _0x4f39d4;var _0x4449b2;return db[_0xfffe('0x54')]['findOne']({'where':{'id':_0x37d2d1[_0xfffe('0x5a')]['id']}})[_0xfffe('0x25')](handleEntityNotFound(_0x21bc00,null))[_0xfffe('0x25')](function(_0x1da333){if(_0x1da333){_0x4f39d4=_0x1da333;_0x116618[_0xfffe('0x43')]=_[_0xfffe('0x45')](db[_0xfffe('0x84')][_0xfffe('0x5b')]);_0x116618['query']=_[_0xfffe('0x45')](_0x37d2d1[_0xfffe('0x44')]);_0x116618[_0xfffe('0x46')]=_[_0xfffe('0x5c')](_0x116618[_0xfffe('0x43')],_0x116618[_0xfffe('0x44')]);_0x554912[_0xfffe('0x48')]=_[_0xfffe('0x5c')](_0x116618[_0xfffe('0x43')],qs[_0xfffe('0x47')](_0x37d2d1['query']['fields']));_0x554912[_0xfffe('0x48')]=_0x554912[_0xfffe('0x48')][_0xfffe('0x49')]?_0x554912[_0xfffe('0x48')]:_0x116618['model'];_0x554912['order']=qs[_0xfffe('0x4d')](_0x37d2d1[_0xfffe('0x44')]['sort']);_0x554912['where']=qs[_0xfffe('0x46')](_[_0xfffe('0x4f')](_0x37d2d1['query'],_0x116618['filters']));if(_0x37d2d1[_0xfffe('0x44')][_0xfffe('0x52')]){_0x554912['where']=_[_0xfffe('0x50')](_0x554912[_0xfffe('0x4e')],{'$or':_[_0xfffe('0x41')](_0x554912[_0xfffe('0x48')],function(_0x37d6c1){var _0x5b9c48={};_0x5b9c48[_0x37d6c1]={'$like':'%'+_0x37d2d1['query'][_0xfffe('0x52')]+'%'};return _0x5b9c48;})});}_0x554912=_[_0xfffe('0x50')]({},_0x554912,_0x37d2d1[_0xfffe('0x53')]);return _0x4f39d4[_0xfffe('0xa4')](_0x554912);}})['then'](function(_0x3e5c48){if(_0x3e5c48){_0x4449b2=_0x3e5c48[_0xfffe('0x49')];if(!_0x37d2d1[_0xfffe('0x44')][_0xfffe('0x6a')](_0xfffe('0x4a'))){_0x554912[_0xfffe('0x4b')]=qs[_0xfffe('0x4b')](_0x37d2d1[_0xfffe('0x44')]['limit']);_0x554912[_0xfffe('0x35')]=qs['offset'](_0x37d2d1[_0xfffe('0x44')][_0xfffe('0x35')]);}return _0x4f39d4[_0xfffe('0xa4')](_0x554912);}})[_0xfffe('0x25')](function(_0x15aba5){if(_0x15aba5){return _0x15aba5?{'count':_0x4449b2,'rows':_0x15aba5}:null;}})[_0xfffe('0x25')](respondWithResult(_0x21bc00,null))[_0xfffe('0x30')](handleError(_0x21bc00,null));};exports[_0xfffe('0xa5')]=function(_0x8318bf,_0x47a0f7,_0x29a008){var _0x2438ad={'raw':![],'where':{}};var _0x314851={};var _0x1766ad={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xfffe('0x68')]({'where':{'id':_0x8318bf[_0xfffe('0x5a')]['id']}})[_0xfffe('0x25')](handleEntityNotFound(_0x47a0f7,null))['then'](function(_0x1fdbf6){if(_0x1fdbf6){_0x314851[_0xfffe('0x43')]=_[_0xfffe('0x45')](db[_0xfffe('0x8e')]['rawAttributes']);_0x314851[_0xfffe('0x44')]=_[_0xfffe('0x45')](_0x8318bf[_0xfffe('0x44')]);_0x314851[_0xfffe('0x46')]=_[_0xfffe('0x5c')](_0x314851['model'],_0x314851[_0xfffe('0x44')]);_0x2438ad[_0xfffe('0x48')]=_['intersection'](_0x314851[_0xfffe('0x43')],qs[_0xfffe('0x47')](_0x8318bf['query']['fields']));_0x2438ad[_0xfffe('0x48')]=_0x2438ad[_0xfffe('0x48')]['length']?_0x2438ad[_0xfffe('0x48')]:_0x314851[_0xfffe('0x43')];if(!_0x8318bf[_0xfffe('0x44')][_0xfffe('0x6a')](_0xfffe('0x4a'))){_0x2438ad[_0xfffe('0x4b')]=qs['limit'](_0x8318bf[_0xfffe('0x44')][_0xfffe('0x4b')]);_0x2438ad['offset']=qs[_0xfffe('0x35')](_0x8318bf['query'][_0xfffe('0x35')]);}_0x2438ad[_0xfffe('0x4c')]=qs[_0xfffe('0x4d')](_0x8318bf[_0xfffe('0x44')][_0xfffe('0x4d')]);_0x2438ad[_0xfffe('0x4e')]=qs['filters'](_[_0xfffe('0x4f')](_0x8318bf[_0xfffe('0x44')],_0x314851[_0xfffe('0x46')]));_0x2438ad[_0xfffe('0x4e')][_0xfffe('0x6c')]=_0x1fdbf6['id'];if(_0x8318bf['query'][_0xfffe('0x52')]){_0x2438ad[_0xfffe('0x4e')]=_[_0xfffe('0x50')](_0x2438ad[_0xfffe('0x4e')],{'$or':_[_0xfffe('0x41')](_0x2438ad[_0xfffe('0x48')],function(_0x4d1826){var _0x506607={};_0x506607[_0x4d1826]={'$like':'%'+_0x8318bf[_0xfffe('0x44')]['filter']+'%'};return _0x506607;})});}_0x2438ad=_[_0xfffe('0x50')]({},_0x2438ad,_0x8318bf[_0xfffe('0x53')]);return db[_0xfffe('0x8e')]['count']({'where':_0x2438ad[_0xfffe('0x4e')]})[_0xfffe('0x25')](function(_0x5d8126){_0x1766ad[_0xfffe('0x34')]=_0x5d8126;if(_0x8318bf[_0xfffe('0x44')][_0xfffe('0x55')]){_0x2438ad['include']=[{'model':db['CmContact'],'as':_0xfffe('0xa6'),'required':![]},{'model':db[_0xfffe('0x99')],'as':_0xfffe('0xa7'),'attributes':['name',_0xfffe('0xa8'),_0xfffe('0xa9')],'required':![]},{'model':db[_0xfffe('0xaa')],'as':_0xfffe('0xab'),'attributes':['id',_0xfffe('0x3e'),_0xfffe('0xac')],'where':_0x8318bf[_0xfffe('0x44')][_0xfffe('0xad')]?{'id':_0x8318bf[_0xfffe('0x44')][_0xfffe('0xad')]}:undefined,'required':_0x8318bf['query'][_0xfffe('0xad')]?!![]:![]}];}return db[_0xfffe('0x8e')][_0xfffe('0x57')](_0x2438ad);})['then'](function(_0x5adf80){_0x1766ad[_0xfffe('0x58')]=_0x5adf80;return _0x1766ad;});}})[_0xfffe('0x25')](respondWithFilteredResult(_0x47a0f7,_0x2438ad))['catch'](handleError(_0x47a0f7,null));};exports[_0xfffe('0xae')]=function(_0x165eda,_0x47cd99,_0x4ca5a2){return db[_0xfffe('0x54')][_0xfffe('0x5d')]({'where':{'id':_0x165eda[_0xfffe('0x5a')]['id']}})[_0xfffe('0x25')](handleEntityNotFound(_0x47cd99,null))[_0xfffe('0x25')](function(_0xd15424){if(_0xd15424){return _0xd15424[_0xfffe('0xae')](_0x165eda['body'][_0xfffe('0x6f')],_['omit'](_0x165eda[_0xfffe('0x63')],['ids','id'])||{})[_0xfffe('0x90')](function(_0x587085){for(var _0x15ca80=0x0;_0x15ca80<_0x165eda['body'][_0xfffe('0x6f')]['length'];_0x15ca80+=0x1){socket[_0xfffe('0xaf')](_0xfffe('0xb0'),{'UserId':_0x165eda['body'][_0xfffe('0x6f')][_0x15ca80],'OpenchannelAccountId':_0x165eda[_0xfffe('0x5a')]['id']});}return _0x587085;});}})[_0xfffe('0x25')](respondWithResult(_0x47cd99,null))[_0xfffe('0x30')](handleError(_0x47cd99,null));};exports[_0xfffe('0xb1')]=function(_0x52d8ed,_0x8ba67b,_0x28c3f6){return db[_0xfffe('0x54')][_0xfffe('0x5d')]({'where':{'id':_0x52d8ed[_0xfffe('0x5a')]['id']}})['then'](handleEntityNotFound(_0x8ba67b,null))[_0xfffe('0x25')](function(_0x468e52){if(_0x468e52){return _0x468e52['removeAgents'](_0x52d8ed[_0xfffe('0x44')][_0xfffe('0x6f')])[_0xfffe('0x25')](function(){if(_[_0xfffe('0xb2')](_0x52d8ed[_0xfffe('0x44')][_0xfffe('0x6f')])){for(var _0x11f99e=0x0;_0x11f99e<_0x52d8ed['query']['ids'][_0xfffe('0x49')];_0x11f99e+=0x1){socket['emit'](_0xfffe('0xb3'),{'UserId':Number(_0x52d8ed['query']['ids'][_0x11f99e]),'OpenchannelAccountId':Number(_0x52d8ed[_0xfffe('0x5a')]['id'])});}}else{socket['emit'](_0xfffe('0xb3'),{'UserId':Number(_0x52d8ed[_0xfffe('0x44')][_0xfffe('0x6f')]),'OpenchannelAccountId':Number(_0x52d8ed[_0xfffe('0x5a')]['id'])});}});}})[_0xfffe('0x25')](respondWithStatusCode(_0x8ba67b,null))[_0xfffe('0x30')](handleError(_0x8ba67b,null));};exports[_0xfffe('0xb4')]=function(_0x10893a,_0x537220,_0xc884c3){var _0x33b092={};var _0x19dad4={};var _0xd71b63;var _0x5a30e0;return db[_0xfffe('0x54')][_0xfffe('0x68')]({'where':{'id':_0x10893a[_0xfffe('0x5a')]['id']}})[_0xfffe('0x25')](handleEntityNotFound(_0x537220,null))[_0xfffe('0x25')](function(_0x596022){if(_0x596022){_0xd71b63=_0x596022;_0x19dad4[_0xfffe('0x43')]=_[_0xfffe('0x45')](db[_0xfffe('0x99')][_0xfffe('0x5b')]);_0x19dad4[_0xfffe('0x44')]=_[_0xfffe('0x45')](_0x10893a[_0xfffe('0x44')]);_0x19dad4[_0xfffe('0x46')]=_[_0xfffe('0x5c')](_0x19dad4['model'],_0x19dad4[_0xfffe('0x44')]);_0x33b092['attributes']=_[_0xfffe('0x5c')](_0x19dad4[_0xfffe('0x43')],qs[_0xfffe('0x47')](_0x10893a[_0xfffe('0x44')][_0xfffe('0x47')]));_0x33b092['attributes']=_0x33b092[_0xfffe('0x48')][_0xfffe('0x49')]?_0x33b092['attributes']:_0x19dad4['model'];_0x33b092[_0xfffe('0x4c')]=qs['sort'](_0x10893a[_0xfffe('0x44')][_0xfffe('0x4d')]);_0x33b092[_0xfffe('0x4e')]=qs[_0xfffe('0x46')](_[_0xfffe('0x4f')](_0x10893a[_0xfffe('0x44')],_0x19dad4[_0xfffe('0x46')]));if(_0x10893a[_0xfffe('0x44')][_0xfffe('0x52')]){_0x33b092['where']=_[_0xfffe('0x50')](_0x33b092['where'],{'$or':_[_0xfffe('0x41')](_0x33b092[_0xfffe('0x48')],function(_0x5a1ce8){var _0x4d4a40={};_0x4d4a40[_0x5a1ce8]={'$like':'%'+_0x10893a[_0xfffe('0x44')][_0xfffe('0x52')]+'%'};return _0x4d4a40;})});}_0x33b092=_[_0xfffe('0x50')]({},_0x33b092,_0x10893a[_0xfffe('0x53')]);return _0xd71b63[_0xfffe('0xb4')](_0x33b092);}})[_0xfffe('0x25')](function(_0x5557f3){if(_0x5557f3){_0x5a30e0=_0x5557f3[_0xfffe('0x49')];if(!_0x10893a[_0xfffe('0x44')][_0xfffe('0x6a')]('nolimit')){_0x33b092[_0xfffe('0x4b')]=qs[_0xfffe('0x4b')](_0x10893a['query']['limit']);_0x33b092[_0xfffe('0x35')]=qs[_0xfffe('0x35')](_0x10893a[_0xfffe('0x44')][_0xfffe('0x35')]);}return _0xd71b63[_0xfffe('0xb4')](_0x33b092);}})['then'](function(_0x46da98){if(_0x46da98){return _0x46da98?{'count':_0x5a30e0,'rows':_0x46da98}:null;}})['then'](respondWithResult(_0x537220,null))[_0xfffe('0x30')](handleError(_0x537220,null));};exports['send']=function(_0x34abbb,_0x3502fd,_0xd65021){var _0x35d73c,_0x363c60,_0x11b5c4;if(_[_0xfffe('0x78')](_0x34abbb[_0xfffe('0x63')][_0xfffe('0x63')])||_0x34abbb[_0xfffe('0x63')]['body']===''){throw new db['Sequelize'][(_0xfffe('0x22'))](_0xfffe('0x7b'));}if(_[_0xfffe('0x78')](_0x34abbb[_0xfffe('0x63')]['to'])){}_0x35d73c=_0x34abbb['body']['to'];return db[_0xfffe('0x54')][_0xfffe('0x68')]({'where':{'id':_0x34abbb[_0xfffe('0x5a')]['id']}})[_0xfffe('0x25')](handleEntityNotFound(_0x3502fd,null))[_0xfffe('0x25')](function(_0x5bda18){if(_0x5bda18){return db[_0xfffe('0x54')]['find']({'where':{'id':_0x5bda18['id']},'include':[{'model':db[_0xfffe('0xb5')],'as':'List','include':[{'model':db['CmContact'],'as':'Contacts','where':{[_0x5bda18[_0xfffe('0x7e')]]:_0x35d73c},'limit':0x1,'order':[[_0xfffe('0x74'),_0xfffe('0x83')]]}]}]})[_0xfffe('0x25')](handleEntityNotFound(_0x3502fd,null))[_0xfffe('0x25')](function(_0x208cfb){if(_0x208cfb&&_0x208cfb[_0xfffe('0x80')]){_0x363c60=_0x208cfb[_0xfffe('0x3a')]({'plain':!![]});if(_0x363c60[_0xfffe('0x80')]&&_0x363c60[_0xfffe('0x80')][_0xfffe('0x82')][_0xfffe('0x49')]){return _0x363c60[_0xfffe('0x80')]['Contacts'][0x0];}return db[_0xfffe('0x81')][_0xfffe('0x5e')](_[_0xfffe('0x1a')](_0x34abbb[_0xfffe('0x63')],{'firstName':_0x35d73c,[_0x208cfb['mapKey']]:_0x35d73c,'phone':_0x35d73c,'ListId':_0x363c60['ListId']}));}})['then'](handleEntityNotFound(_0x3502fd,null))[_0xfffe('0x25')](function(_0xe3570b){if(_0xe3570b){_0x11b5c4=_0xe3570b;return db[_0xfffe('0x8e')][_0xfffe('0x5d')]({'where':{'ContactId':_0x11b5c4['id'],'closed':![],'OpenchannelAccountId':_0x363c60['id']}})[_0xfffe('0x25')](function(_0x13c00b){if(_0x13c00b){return[_0x13c00b,![]];}return db[_0xfffe('0x8e')][_0xfffe('0x5e')]({'UserId':_0x34abbb[_0xfffe('0x5f')]['id'],'ContactId':_0x11b5c4['id'],'OpenchannelAccountId':_0x363c60['id'],'lastMsgDirection':_0xfffe('0xb6'),'Messages':[_[_0xfffe('0x50')](_0x34abbb[_0xfffe('0x63')],{'read':![],'body':_0x34abbb['body']['body'],'OpenchannelAccountId':_0x363c60['id'],'UserId':_0x34abbb['user']['id'],'ContactId':_0x11b5c4['id']})]},{'include':[{'model':db[_0xfffe('0xb7')],'as':_0xfffe('0xb8')}]})[_0xfffe('0x25')](function(_0x5527e4){return[_0x5527e4,!![]];});});}})[_0xfffe('0x90')](function(_0x284c2f,_0x35723){if(_0x35723){return _0x284c2f;}return db[_0xfffe('0xb7')][_0xfffe('0x5e')](_['merge'](_0x34abbb['body'],{'read':![],'body':_0x34abbb['body'][_0xfffe('0x63')],'OpenchannelAccountId':_0x363c60['id'],'OpenchannelInteractionId':_0x284c2f['id'],'UserId':_0x34abbb[_0xfffe('0x5f')]['id'],'ContactId':_0x11b5c4['id']}))[_0xfffe('0x25')](function(_0x186605){_0x284c2f['dataValues']['Messages']=[];_0x284c2f[_0xfffe('0xb9')][_0xfffe('0xb8')]['push'](_0x186605[_0xfffe('0xb9')]);return _0x284c2f;});});}})[_0xfffe('0x25')](respondWithResult(_0x3502fd,null))[_0xfffe('0x30')](handleError(_0x3502fd,null));}; \ No newline at end of file +var _0xa0a0=['updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','OpenchannelApplication','Applications','List','account','applications','orderBy','priority','asc','contact','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','firstName','messageId','interaction','created','push','*,*,*,*','OpenchannelMessage','UserId','User','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','findOne','transaction','getApplications','Contact','Owner','Tags','color','tag','addAgents','omit','ids','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','DESC','out','user','Messages','dataValues','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','ejs','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','./openchannelAccount.socket','register','client','http','test','ValidationError','then','info','OpenchannelAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','catch','sendStatus','status','end','count','offset','limit','set','Content-Range','apply','reject','save','destroy','get','OpenchannelAccounts','UserProfileResource','name','send','index','Pause','mandatoryDispositionPause','map','OpenchannelAccount','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','rows','show','params','rawAttributes','length','includeAll','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','OpnechannelAccountId','Disposition','OpenchannelAccountId','CannedAnswer','getAnswers','nolimit','removeAnswers','notify','openchannel','CmContact','Sequelize','no\x20available\x20attributes','difference','createdAt'];(function(_0x135fe0,_0xa03c9b){var _0x3d1a5f=function(_0x35464b){while(--_0x35464b){_0x135fe0['push'](_0x135fe0['shift']());}};_0x3d1a5f(++_0xa03c9b);}(_0xa0a0,0xf1));var _0x0a0a=function(_0x5ad07c,_0x324dcd){_0x5ad07c=_0x5ad07c-0x0;var _0x204bae=_0xa0a0[_0x5ad07c];return _0x204bae;};'use strict';var pdf=require(_0x0a0a('0x0'));var emlformat=require(_0x0a0a('0x1'));var rimraf=require(_0x0a0a('0x2'));var zipdir=require(_0x0a0a('0x3'));var jsonpatch=require(_0x0a0a('0x4'));var rp=require(_0x0a0a('0x5'));var moment=require(_0x0a0a('0x6'));var BPromise=require(_0x0a0a('0x7'));var Mustache=require('mustache');var util=require(_0x0a0a('0x8'));var path=require(_0x0a0a('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0a0a('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x0a0a('0xb'));var jsforce=require(_0x0a0a('0xc'));var deskjs=require(_0x0a0a('0xd'));var toCsv=require(_0x0a0a('0xe'));var querystring=require(_0x0a0a('0xf'));var Papa=require(_0x0a0a('0x10'));var Redis=require(_0x0a0a('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0a0a('0x12'));var hardwareService=require(_0x0a0a('0x13'));var logger=require(_0x0a0a('0x14'))(_0x0a0a('0x15'));var utils=require(_0x0a0a('0x16'));var config=require('../../config/environment');var db=require(_0x0a0a('0x17'))['db'];config[_0x0a0a('0x18')]=_[_0x0a0a('0x19')](config[_0x0a0a('0x18')],{'host':_0x0a0a('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0a0a('0x18')]));require(_0x0a0a('0x1b'))[_0x0a0a('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson[_0x0a0a('0x1d')][_0x0a0a('0x1e')]({'port':0x232c});var client9002=jayson[_0x0a0a('0x1d')][_0x0a0a('0x1e')]({'port':0x232a});function checkPasswordPattern(_0x5e8f9f,_0x22f504,_0x20d0df){if(_0x20d0df){var _0x325c9c=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x325c9c[_0x0a0a('0x1f')](_0x22f504)){return _0x5e8f9f;}else{throw new db['Sequelize'][(_0x0a0a('0x20'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x5e8f9f;}}function respondWithRpcPromise(_0x397448,_0x4db129,_0x58ddcd,_0x541059){return new BPromise(function(_0x1513fe,_0x207ba5){var _0x29f106=_0x541059||client;return _0x29f106['request'](_0x397448,_0x58ddcd)[_0x0a0a('0x21')](function(_0x43fcdd){logger[_0x0a0a('0x22')](_0x0a0a('0x23'),_0x4db129,'request\x20sent');logger[_0x0a0a('0x24')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x4db129,_0x0a0a('0x25'),JSON[_0x0a0a('0x26')](_0x43fcdd));if(_0x43fcdd['error']){if(_0x43fcdd[_0x0a0a('0x27')]['code']===0x1f4){logger[_0x0a0a('0x27')]('OpenchannelAccount,\x20%s,\x20%s',_0x4db129,_0x43fcdd[_0x0a0a('0x27')]['message']);return _0x207ba5(_0x43fcdd[_0x0a0a('0x27')][_0x0a0a('0x28')]);}logger['error'](_0x0a0a('0x23'),_0x4db129,_0x43fcdd[_0x0a0a('0x27')]['message']);return _0x1513fe(_0x43fcdd[_0x0a0a('0x27')][_0x0a0a('0x28')]);}else{logger[_0x0a0a('0x22')](_0x0a0a('0x23'),_0x4db129,'request\x20sent');_0x1513fe(_0x43fcdd['result'][_0x0a0a('0x28')]);}})[_0x0a0a('0x29')](function(_0x577c8a){logger['error'](_0x0a0a('0x23'),_0x4db129,_0x577c8a);_0x207ba5(_0x577c8a);});});}function respondWithStatusCode(_0x242c01,_0x4ed01b){_0x4ed01b=_0x4ed01b||0xcc;return function(_0x471ea2){if(_0x471ea2){return _0x242c01[_0x0a0a('0x2a')](_0x4ed01b);}return _0x242c01[_0x0a0a('0x2b')](_0x4ed01b)[_0x0a0a('0x2c')]();};}function respondWithResult(_0x421cf8,_0x1764f1){_0x1764f1=_0x1764f1||0xc8;return function(_0x31b032){if(_0x31b032){return _0x421cf8[_0x0a0a('0x2b')](_0x1764f1)['json'](_0x31b032);}};}function respondWithFilteredResult(_0x165f5c,_0x2f4fd0){return function(_0x57a1e3){if(_0x57a1e3){var _0x340951=_0x57a1e3[_0x0a0a('0x2d')],_0x22f45e=_0x2f4fd0[_0x0a0a('0x2e')],_0x375af1=_0x2f4fd0[_0x0a0a('0x2e')]+_0x2f4fd0[_0x0a0a('0x2f')],_0x5206c5;if(_0x375af1>=_0x340951){_0x375af1=_0x340951;_0x5206c5=0xc8;}else{_0x5206c5=0xce;}_0x165f5c[_0x0a0a('0x2b')](_0x5206c5);return _0x165f5c[_0x0a0a('0x30')](_0x0a0a('0x31'),_0x22f45e+'-'+_0x375af1+'/'+_0x340951)['json'](_0x57a1e3);}return null;};}function patchUpdates(_0x414ca6){return function(_0x22a582){try{jsonpatch[_0x0a0a('0x32')](_0x22a582,_0x414ca6,!![]);}catch(_0x528bef){return BPromise[_0x0a0a('0x33')](_0x528bef);}return _0x22a582[_0x0a0a('0x34')]();};}function saveUpdates(_0x45ef98,_0x547e6f){return function(_0xd8f84b){if(_0xd8f84b){return _0xd8f84b['update'](_0x45ef98)[_0x0a0a('0x21')](function(_0x4cbc85){return _0x4cbc85;});}return null;};}function removeEntity(_0x392522,_0x4a709f){return function(_0x169114){if(_0x169114){return _0x169114[_0x0a0a('0x35')]()[_0x0a0a('0x21')](function(){var _0x490ea0=_0x169114[_0x0a0a('0x36')]({'plain':!![]});var _0x4b52e5=_0x0a0a('0x37');return db[_0x0a0a('0x38')][_0x0a0a('0x35')]({'where':{'type':_0x4b52e5,'resourceId':_0x490ea0['id']}})[_0x0a0a('0x21')](function(){return _0x169114;});})['then'](function(){_0x392522[_0x0a0a('0x2b')](0xcc)[_0x0a0a('0x2c')]();});}};}function handleEntityNotFound(_0x2dcb31,_0x2c8cf7){return function(_0x11aa4f){if(!_0x11aa4f){_0x2dcb31[_0x0a0a('0x2a')](0x194);}return _0x11aa4f;};}function handleError(_0x4582eb,_0x3ced24){_0x3ced24=_0x3ced24||0x1f4;return function(_0x5d0fe0){logger[_0x0a0a('0x27')](_0x5d0fe0['stack']);if(_0x5d0fe0['name']){delete _0x5d0fe0[_0x0a0a('0x39')];}_0x4582eb[_0x0a0a('0x2b')](_0x3ced24)[_0x0a0a('0x3a')](_0x5d0fe0);};}exports[_0x0a0a('0x3b')]=function(_0x54b1cb,_0x42c092){var _0x2520de={'include':[{'model':db[_0x0a0a('0x3c')],'as':_0x0a0a('0x3d')}]},_0x4246dd={},_0x5bf2c3={'count':0x0,'rows':[]};var _0xd0273a=_[_0x0a0a('0x3e')](db[_0x0a0a('0x3f')]['rawAttributes'],function(_0x58629d){return{'name':_0x58629d[_0x0a0a('0x40')],'type':_0x58629d['type'][_0x0a0a('0x41')]};});_0x4246dd[_0x0a0a('0x42')]=_[_0x0a0a('0x3e')](_0xd0273a,_0x0a0a('0x39'));_0x4246dd[_0x0a0a('0x43')]=_[_0x0a0a('0x44')](_0x54b1cb[_0x0a0a('0x43')]);_0x4246dd[_0x0a0a('0x45')]=_[_0x0a0a('0x46')](_0x4246dd[_0x0a0a('0x42')],_0x4246dd[_0x0a0a('0x43')]);_0x2520de[_0x0a0a('0x47')]=_[_0x0a0a('0x46')](_0x4246dd[_0x0a0a('0x42')],qs[_0x0a0a('0x48')](_0x54b1cb['query']['fields']));_0x2520de[_0x0a0a('0x47')]=_0x2520de['attributes']['length']?_0x2520de[_0x0a0a('0x47')]:_0x4246dd[_0x0a0a('0x42')];if(!_0x54b1cb['query'][_0x0a0a('0x49')]('nolimit')){_0x2520de['limit']=qs['limit'](_0x54b1cb[_0x0a0a('0x43')][_0x0a0a('0x2f')]);_0x2520de[_0x0a0a('0x2e')]=qs[_0x0a0a('0x2e')](_0x54b1cb['query'][_0x0a0a('0x2e')]);}_0x2520de[_0x0a0a('0x4a')]=qs[_0x0a0a('0x4b')](_0x54b1cb[_0x0a0a('0x43')]['sort']);_0x2520de[_0x0a0a('0x4c')]=qs[_0x0a0a('0x45')](_[_0x0a0a('0x4d')](_0x54b1cb['query'],_0x4246dd[_0x0a0a('0x45')]),_0xd0273a);if(_0x54b1cb[_0x0a0a('0x43')][_0x0a0a('0x4e')]){_0x2520de[_0x0a0a('0x4c')]=_[_0x0a0a('0x4f')](_0x2520de['where'],{'$or':_[_0x0a0a('0x3e')](_0xd0273a,function(_0x249ef9){if(_0x249ef9[_0x0a0a('0x50')]!==_0x0a0a('0x51')){var _0x42f7e0={};_0x42f7e0[_0x249ef9['name']]={'$like':'%'+_0x54b1cb[_0x0a0a('0x43')]['filter']+'%'};return _0x42f7e0;}})});}_0x2520de=_[_0x0a0a('0x4f')]({},_0x2520de,_0x54b1cb[_0x0a0a('0x52')]);var _0x17a86e={'where':_0x2520de[_0x0a0a('0x4c')]};return db[_0x0a0a('0x3f')][_0x0a0a('0x2d')](_0x17a86e)[_0x0a0a('0x21')](function(_0x3fda59){_0x5bf2c3['count']=_0x3fda59;if(_0x54b1cb['query']['includeAll']){_0x2520de[_0x0a0a('0x53')]=[{'all':!![]}];}return db[_0x0a0a('0x3f')][_0x0a0a('0x54')](_0x2520de);})[_0x0a0a('0x21')](function(_0x29fd31){_0x5bf2c3[_0x0a0a('0x55')]=_0x29fd31;return _0x5bf2c3;})[_0x0a0a('0x21')](respondWithFilteredResult(_0x42c092,_0x2520de))[_0x0a0a('0x29')](handleError(_0x42c092,null));};exports[_0x0a0a('0x56')]=function(_0xcf4683,_0x21e28a){var _0x2aa181={'raw':![],'where':{'id':_0xcf4683[_0x0a0a('0x57')]['id']},'include':[{'model':db[_0x0a0a('0x3c')],'as':_0x0a0a('0x3d')}]},_0x4f4ee0={};_0x4f4ee0[_0x0a0a('0x42')]=_[_0x0a0a('0x44')](db[_0x0a0a('0x3f')][_0x0a0a('0x58')]);_0x4f4ee0[_0x0a0a('0x43')]=_[_0x0a0a('0x44')](_0xcf4683[_0x0a0a('0x43')]);_0x4f4ee0['filters']=_[_0x0a0a('0x46')](_0x4f4ee0['model'],_0x4f4ee0[_0x0a0a('0x43')]);_0x2aa181['attributes']=_['intersection'](_0x4f4ee0['model'],qs[_0x0a0a('0x48')](_0xcf4683[_0x0a0a('0x43')][_0x0a0a('0x48')]));_0x2aa181[_0x0a0a('0x47')]=_0x2aa181[_0x0a0a('0x47')][_0x0a0a('0x59')]?_0x2aa181['attributes']:_0x4f4ee0[_0x0a0a('0x42')];if(_0xcf4683[_0x0a0a('0x43')][_0x0a0a('0x5a')]){_0x2aa181[_0x0a0a('0x53')]=[{'all':!![]}];}_0x2aa181=_[_0x0a0a('0x4f')]({},_0x2aa181,_0xcf4683[_0x0a0a('0x52')]);return db[_0x0a0a('0x3f')]['find'](_0x2aa181)[_0x0a0a('0x21')](handleEntityNotFound(_0x21e28a,null))[_0x0a0a('0x21')](respondWithResult(_0x21e28a,null))[_0x0a0a('0x29')](handleError(_0x21e28a,null));};exports['create']=function(_0x2572e7,_0x2a0c4b){return db[_0x0a0a('0x3f')][_0x0a0a('0x5b')](_0x2572e7[_0x0a0a('0x5c')],{})[_0x0a0a('0x21')](function(_0x49cebc){var _0x39533f=_0x2572e7['user']['get']({'plain':!![]});if(!_0x39533f)throw new Error(_0x0a0a('0x5d'));if(_0x39533f[_0x0a0a('0x5e')]==='user'){var _0x2e4894=_0x49cebc[_0x0a0a('0x36')]({'plain':!![]});var _0xe27b64=_0x0a0a('0x37');return db[_0x0a0a('0x5f')][_0x0a0a('0x60')]({'where':{'name':_0xe27b64,'userProfileId':_0x39533f['userProfileId']},'raw':!![]})[_0x0a0a('0x21')](function(_0x359821){if(_0x359821&&_0x359821[_0x0a0a('0x61')]===0x0){return db[_0x0a0a('0x38')][_0x0a0a('0x5b')]({'name':_0x2e4894[_0x0a0a('0x39')],'resourceId':_0x2e4894['id'],'type':_0x359821[_0x0a0a('0x39')],'sectionId':_0x359821['id']},{})[_0x0a0a('0x21')](function(){return _0x49cebc;});}else{return _0x49cebc;}})['catch'](function(_0x47fb10){logger[_0x0a0a('0x27')](_0x0a0a('0x62'),_0x47fb10);throw _0x47fb10;});}return _0x49cebc;})['then'](respondWithResult(_0x2a0c4b,0xc9))[_0x0a0a('0x29')](handleError(_0x2a0c4b,null));};exports[_0x0a0a('0x63')]=function(_0x371c57,_0x4936ff){if(_0x371c57['body']['id']){delete _0x371c57[_0x0a0a('0x5c')]['id'];}return db[_0x0a0a('0x3f')][_0x0a0a('0x60')]({'where':{'id':_0x371c57[_0x0a0a('0x57')]['id']},'include':[{'model':db[_0x0a0a('0x3c')],'as':_0x0a0a('0x3d')}]})[_0x0a0a('0x21')](handleEntityNotFound(_0x4936ff,null))[_0x0a0a('0x21')](saveUpdates(_0x371c57[_0x0a0a('0x5c')],null))['then'](respondWithResult(_0x4936ff,null))['catch'](handleError(_0x4936ff,null));};exports[_0x0a0a('0x35')]=function(_0x2470e7,_0x59e41b){return db[_0x0a0a('0x3f')][_0x0a0a('0x60')]({'where':{'id':_0x2470e7[_0x0a0a('0x57')]['id']}})[_0x0a0a('0x21')](handleEntityNotFound(_0x59e41b,null))[_0x0a0a('0x21')](removeEntity(_0x59e41b,null))[_0x0a0a('0x29')](handleError(_0x59e41b,null));};exports[_0x0a0a('0x64')]=function(_0x2c069c,_0x513ae6){return db['OpenchannelAccount'][_0x0a0a('0x64')]()[_0x0a0a('0x21')](respondWithResult(_0x513ae6,null))[_0x0a0a('0x29')](handleError(_0x513ae6,null));};exports['addDisposition']=function(_0x4f6cc6,_0x5bda71,_0x4513db){if(_0x4f6cc6[_0x0a0a('0x5c')]['id']){delete _0x4f6cc6[_0x0a0a('0x5c')]['id'];}return db['OpenchannelAccount'][_0x0a0a('0x60')]({'where':{'id':_0x4f6cc6[_0x0a0a('0x57')]['id']}})[_0x0a0a('0x21')](handleEntityNotFound(_0x5bda71,null))['then'](function(_0x70cc54){if(_0x70cc54){_0x4f6cc6[_0x0a0a('0x5c')][_0x0a0a('0x65')]=_0x70cc54['id'];return db[_0x0a0a('0x66')][_0x0a0a('0x5b')](_0x4f6cc6[_0x0a0a('0x5c')]);}})[_0x0a0a('0x21')](respondWithResult(_0x5bda71,null))['catch'](handleError(_0x5bda71,null));};exports['getDispositions']=function(_0x2ba8d0,_0x35bfd8,_0x1834c1){var _0x372820={'raw':![],'where':{}};var _0x44d759={};var _0x22c9b2={'count':0x0,'rows':[]};return db[_0x0a0a('0x3f')]['findOne']({'where':{'id':_0x2ba8d0['params']['id']}})[_0x0a0a('0x21')](handleEntityNotFound(_0x35bfd8,null))[_0x0a0a('0x21')](function(_0x5e6afe){if(_0x5e6afe){_0x44d759[_0x0a0a('0x42')]=_[_0x0a0a('0x44')](db[_0x0a0a('0x66')]['rawAttributes']);_0x44d759[_0x0a0a('0x43')]=_[_0x0a0a('0x44')](_0x2ba8d0['query']);_0x44d759[_0x0a0a('0x45')]=_[_0x0a0a('0x46')](_0x44d759[_0x0a0a('0x42')],_0x44d759[_0x0a0a('0x43')]);_0x372820['attributes']=_[_0x0a0a('0x46')](_0x44d759['model'],qs[_0x0a0a('0x48')](_0x2ba8d0['query'][_0x0a0a('0x48')]));_0x372820[_0x0a0a('0x47')]=_0x372820[_0x0a0a('0x47')][_0x0a0a('0x59')]?_0x372820[_0x0a0a('0x47')]:_0x44d759['model'];if(!_0x2ba8d0[_0x0a0a('0x43')]['hasOwnProperty']('nolimit')){_0x372820[_0x0a0a('0x2f')]=qs[_0x0a0a('0x2f')](_0x2ba8d0['query'][_0x0a0a('0x2f')]);_0x372820[_0x0a0a('0x2e')]=qs[_0x0a0a('0x2e')](_0x2ba8d0['query'][_0x0a0a('0x2e')]);}_0x372820[_0x0a0a('0x4a')]=qs[_0x0a0a('0x4b')](_0x2ba8d0[_0x0a0a('0x43')][_0x0a0a('0x4b')]);_0x372820[_0x0a0a('0x4c')]=qs[_0x0a0a('0x45')](_['pick'](_0x2ba8d0[_0x0a0a('0x43')],_0x44d759[_0x0a0a('0x45')]));_0x372820[_0x0a0a('0x4c')][_0x0a0a('0x67')]=_0x5e6afe['id'];if(_0x2ba8d0[_0x0a0a('0x43')]['filter']){_0x372820['where']=_[_0x0a0a('0x4f')](_0x372820[_0x0a0a('0x4c')],{'$or':_[_0x0a0a('0x3e')](_0x372820[_0x0a0a('0x47')],function(_0x438c00){var _0x1a2ef7={};_0x1a2ef7[_0x438c00]={'$like':'%'+_0x2ba8d0[_0x0a0a('0x43')][_0x0a0a('0x4e')]+'%'};return _0x1a2ef7;})});}_0x372820=_[_0x0a0a('0x4f')]({},_0x372820,_0x2ba8d0[_0x0a0a('0x52')]);return db[_0x0a0a('0x66')]['count']({'where':_0x372820['where']})[_0x0a0a('0x21')](function(_0x17ea88){_0x22c9b2[_0x0a0a('0x2d')]=_0x17ea88;if(_0x2ba8d0[_0x0a0a('0x43')][_0x0a0a('0x5a')]){_0x372820[_0x0a0a('0x53')]=[{'all':!![]}];}return db[_0x0a0a('0x66')]['findAll'](_0x372820);})['then'](function(_0x5deb0b){_0x22c9b2[_0x0a0a('0x55')]=_0x5deb0b;return _0x22c9b2;});}})['then'](respondWithFilteredResult(_0x35bfd8,_0x372820))[_0x0a0a('0x29')](handleError(_0x35bfd8,null));};exports['removeDispositions']=function(_0x521dbf,_0x446dc2,_0x2abd9a){return db[_0x0a0a('0x3f')]['find']({'where':{'id':_0x521dbf[_0x0a0a('0x57')]['id']}})['then'](handleEntityNotFound(_0x446dc2,null))[_0x0a0a('0x21')](function(_0x33a6d9){if(_0x33a6d9){return _0x33a6d9['removeDispositions'](_0x521dbf[_0x0a0a('0x43')]['ids']);}})[_0x0a0a('0x21')](respondWithStatusCode(_0x446dc2,null))[_0x0a0a('0x29')](handleError(_0x446dc2,null));};exports['addAnswer']=function(_0xdb8b73,_0xd1fda1,_0x14ed3d){if(_0xdb8b73['body']['id']){delete _0xdb8b73[_0x0a0a('0x5c')]['id'];}return db['OpenchannelAccount'][_0x0a0a('0x60')]({'where':{'id':_0xdb8b73[_0x0a0a('0x57')]['id']}})['then'](handleEntityNotFound(_0xd1fda1,null))[_0x0a0a('0x21')](function(_0x528a9c){if(_0x528a9c){_0xdb8b73['body'][_0x0a0a('0x67')]=_0x528a9c['id'];return db[_0x0a0a('0x68')][_0x0a0a('0x5b')](_0xdb8b73[_0x0a0a('0x5c')]);}})[_0x0a0a('0x21')](respondWithResult(_0xd1fda1,null))['catch'](handleError(_0xd1fda1,null));};exports[_0x0a0a('0x69')]=function(_0x3d805e,_0x4917da,_0x994b9b){var _0x1fcd97={'raw':![],'where':{}};var _0x35582e={};var _0x2a3f69={'count':0x0,'rows':[]};return db['OpenchannelAccount']['findOne']({'where':{'id':_0x3d805e[_0x0a0a('0x57')]['id']}})['then'](handleEntityNotFound(_0x4917da,null))[_0x0a0a('0x21')](function(_0x4f0bb0){if(_0x4f0bb0){_0x35582e[_0x0a0a('0x42')]=_[_0x0a0a('0x44')](db[_0x0a0a('0x68')][_0x0a0a('0x58')]);_0x35582e[_0x0a0a('0x43')]=_['keys'](_0x3d805e[_0x0a0a('0x43')]);_0x35582e['filters']=_[_0x0a0a('0x46')](_0x35582e[_0x0a0a('0x42')],_0x35582e[_0x0a0a('0x43')]);_0x1fcd97[_0x0a0a('0x47')]=_['intersection'](_0x35582e['model'],qs['fields'](_0x3d805e[_0x0a0a('0x43')]['fields']));_0x1fcd97[_0x0a0a('0x47')]=_0x1fcd97[_0x0a0a('0x47')][_0x0a0a('0x59')]?_0x1fcd97[_0x0a0a('0x47')]:_0x35582e[_0x0a0a('0x42')];if(!_0x3d805e[_0x0a0a('0x43')][_0x0a0a('0x49')](_0x0a0a('0x6a'))){_0x1fcd97['limit']=qs[_0x0a0a('0x2f')](_0x3d805e[_0x0a0a('0x43')]['limit']);_0x1fcd97[_0x0a0a('0x2e')]=qs[_0x0a0a('0x2e')](_0x3d805e[_0x0a0a('0x43')][_0x0a0a('0x2e')]);}_0x1fcd97[_0x0a0a('0x4a')]=qs[_0x0a0a('0x4b')](_0x3d805e[_0x0a0a('0x43')][_0x0a0a('0x4b')]);_0x1fcd97[_0x0a0a('0x4c')]=qs['filters'](_[_0x0a0a('0x4d')](_0x3d805e[_0x0a0a('0x43')],_0x35582e[_0x0a0a('0x45')]));_0x1fcd97[_0x0a0a('0x4c')][_0x0a0a('0x67')]=_0x4f0bb0['id'];if(_0x3d805e[_0x0a0a('0x43')][_0x0a0a('0x4e')]){_0x1fcd97[_0x0a0a('0x4c')]=_[_0x0a0a('0x4f')](_0x1fcd97[_0x0a0a('0x4c')],{'$or':_[_0x0a0a('0x3e')](_0x1fcd97['attributes'],function(_0x435fa6){var _0x1e90a0={};_0x1e90a0[_0x435fa6]={'$like':'%'+_0x3d805e[_0x0a0a('0x43')][_0x0a0a('0x4e')]+'%'};return _0x1e90a0;})});}_0x1fcd97=_[_0x0a0a('0x4f')]({},_0x1fcd97,_0x3d805e[_0x0a0a('0x52')]);return db[_0x0a0a('0x68')]['count']({'where':_0x1fcd97['where']})[_0x0a0a('0x21')](function(_0x1de3d0){_0x2a3f69['count']=_0x1de3d0;if(_0x3d805e['query'][_0x0a0a('0x5a')]){_0x1fcd97[_0x0a0a('0x53')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x1fcd97);})[_0x0a0a('0x21')](function(_0x2c6757){_0x2a3f69[_0x0a0a('0x55')]=_0x2c6757;return _0x2a3f69;});}})[_0x0a0a('0x21')](respondWithFilteredResult(_0x4917da,_0x1fcd97))[_0x0a0a('0x29')](handleError(_0x4917da,null));};exports[_0x0a0a('0x6b')]=function(_0x891838,_0x5bdc72,_0x1083b5){return db[_0x0a0a('0x3f')][_0x0a0a('0x60')]({'where':{'id':_0x891838['params']['id']}})[_0x0a0a('0x21')](handleEntityNotFound(_0x5bdc72,null))[_0x0a0a('0x21')](function(_0x461beb){if(_0x461beb){return _0x461beb['removeAnswers'](_0x891838[_0x0a0a('0x43')]['ids']);}})['then'](respondWithStatusCode(_0x5bdc72,null))[_0x0a0a('0x29')](handleError(_0x5bdc72,null));};exports[_0x0a0a('0x6c')]=function(_0x373170,_0x4eab42,_0x242cfa){var _0x3aaa13={'body':_0x373170[_0x0a0a('0x5c')],'channel':_0x0a0a('0x6d')};var _0x5ac76a=[];var _0x402d1c=[];var _0x2cbb6a={};var _0x387df3=![];return db[_0x0a0a('0x6e')]['describe']()[_0x0a0a('0x21')](function(_0x9a1814){if(!_0x9a1814){throw new db[(_0x0a0a('0x6f'))]['ValidationError'](_0x0a0a('0x70'));}_0x5ac76a=_[_0x0a0a('0x71')](_['keys'](_0x9a1814),['createdAt','updatedAt']);_0x402d1c=_[_0x0a0a('0x71')](_['keys'](_0x9a1814),[_0x0a0a('0x72'),_0x0a0a('0x73'),_0x0a0a('0x74'),_0x0a0a('0x75')]);if(_0x373170[_0x0a0a('0x5c')]['id']){delete _0x373170[_0x0a0a('0x5c')]['id'];}if(_[_0x0a0a('0x76')](_0x373170['body'][_0x0a0a('0x77')])){throw new db[(_0x0a0a('0x6f'))][(_0x0a0a('0x20'))](_0x0a0a('0x78'));}if(_['isNil'](_0x373170[_0x0a0a('0x5c')][_0x0a0a('0x5c')])||_0x373170[_0x0a0a('0x5c')][_0x0a0a('0x5c')]===''){throw new db[(_0x0a0a('0x6f'))][(_0x0a0a('0x20'))](_0x0a0a('0x79'));}if(_[_0x0a0a('0x76')](_0x373170[_0x0a0a('0x5c')][_0x0a0a('0x7a')])){throw new db['Sequelize'][(_0x0a0a('0x20'))](_0x0a0a('0x7b')+_0x402d1c);}if(!_['includes'](_0x402d1c,_0x373170[_0x0a0a('0x5c')][_0x0a0a('0x7a')])){throw new db[(_0x0a0a('0x6f'))][(_0x0a0a('0x20'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x402d1c);}_0x2cbb6a[_0x373170[_0x0a0a('0x5c')][_0x0a0a('0x7a')]]=_0x373170[_0x0a0a('0x5c')][_0x0a0a('0x77')];})['then'](function(){return db[_0x0a0a('0x3f')][_0x0a0a('0x60')]({'where':{'id':_0x373170[_0x0a0a('0x57')]['id']},'include':[{'model':db[_0x0a0a('0x7c')],'as':'List','include':[{'model':db[_0x0a0a('0x6e')],'as':_0x0a0a('0x7d'),'where':_0x2cbb6a,'limit':0x1,'order':[[_0x0a0a('0x73'),'DESC']]}]},{'model':db[_0x0a0a('0x7e')],'as':_0x0a0a('0x7f')}]});})[_0x0a0a('0x21')](handleEntityNotFound(_0x4eab42,null))[_0x0a0a('0x21')](function(_0x35b7b1){if(_0x35b7b1&&_0x35b7b1[_0x0a0a('0x80')]){_0x3aaa13[_0x0a0a('0x81')]=_0x35b7b1;_0x3aaa13[_0x0a0a('0x82')]=_0x35b7b1[_0x0a0a('0x7f')];_0x3aaa13['list']=_0x35b7b1[_0x0a0a('0x80')];_0x3aaa13[_0x0a0a('0x82')]=_[_0x0a0a('0x83')](_0x3aaa13['applications'],[_0x0a0a('0x84')],[_0x0a0a('0x85')]);if(_0x3aaa13[_0x0a0a('0x81')][_0x0a0a('0x7f')]){delete _0x3aaa13[_0x0a0a('0x81')][_0x0a0a('0x7f')];}if(_0x3aaa13[_0x0a0a('0x81')][_0x0a0a('0x80')]&&_0x3aaa13[_0x0a0a('0x81')][_0x0a0a('0x80')][_0x0a0a('0x7d')][_0x0a0a('0x59')]){return _0x3aaa13[_0x0a0a('0x81')][_0x0a0a('0x80')][_0x0a0a('0x7d')][0x0];}var _0x58aa36=_['defaults'](_0x373170[_0x0a0a('0x5c')],{'firstName':_0x373170['body'][_0x0a0a('0x77')],'ListId':_0x35b7b1[_0x0a0a('0x75')]});_0x58aa36[_0x373170[_0x0a0a('0x5c')]['mapKey']]=_0x373170['body'][_0x0a0a('0x77')];return db[_0x0a0a('0x6e')]['create'](_0x58aa36,{'fields':_0x5ac76a,'raw':!![]});}})[_0x0a0a('0x21')](handleEntityNotFound(_0x4eab42,null))['then'](function(_0x2e8623){_0x3aaa13[_0x0a0a('0x86')]=_0x2e8623;if(_0x2e8623){var _0x3be584={'ContactId':_0x2e8623['id'],'OpenchannelAccountId':_0x373170[_0x0a0a('0x57')]['id'],'from':(_0x2e8623['firstName']||'')+'\x20'+(_0x2e8623[_0x0a0a('0x87')]||'')};var _0x10075e={'OpenchannelAccountId':_0x373170[_0x0a0a('0x57')]['id'],'closed':![]};if(_0x373170[_0x0a0a('0x5c')][_0x0a0a('0x88')]){_0x10075e[_0x0a0a('0x88')]=_0x373170[_0x0a0a('0x5c')]['threadId'];return db[_0x0a0a('0x89')][_0x0a0a('0x60')]({'where':_0x10075e})['then'](function(_0x2e2105){if(_0x2e2105){return[_0x2e2105,![]];}_0x3be584[_0x0a0a('0x88')]=_0x373170['body']['threadId'];_0x3be584[_0x0a0a('0x8a')]=_0x373170[_0x0a0a('0x5c')]['externalUrl'];return db[_0x0a0a('0x89')][_0x0a0a('0x5b')](_0x3be584)['then'](function(_0x114e23){return[_0x114e23,!![]];});});}else{_0x10075e[_0x0a0a('0x88')]=null;}_0x10075e[_0x0a0a('0x8b')]=_0x2e8623['id'];return db[_0x0a0a('0x89')]['find']({'where':_0x10075e})[_0x0a0a('0x21')](function(_0xb08ea){if(_0xb08ea){return[_0xb08ea,![]];}return db[_0x0a0a('0x89')]['create'](_0x3be584)[_0x0a0a('0x21')](function(_0x2b0719){return[_0x2b0719,!![]];});});}})[_0x0a0a('0x8c')](function(_0x197933,_0x29d97b){if(_0x197933){_0x387df3=_0x29d97b;if(!_0x29d97b){var _0x29b706={'from':(_0x3aaa13[_0x0a0a('0x86')][_0x0a0a('0x8d')]||'')+'\x20'+(_0x3aaa13[_0x0a0a('0x86')][_0x0a0a('0x87')]||'')};if(_0x373170['body'][_0x0a0a('0x88')]&&_0x373170['body'][_0x0a0a('0x8e')]&&_0x373170[_0x0a0a('0x5c')][_0x0a0a('0x88')]!=_0x373170[_0x0a0a('0x5c')][_0x0a0a('0x8e')]){_0x29b706[_0x0a0a('0x88')]=_0x373170[_0x0a0a('0x5c')]['messageId'];}return _0x197933[_0x0a0a('0x63')](_0x29b706);}else{return _0x197933;}}})[_0x0a0a('0x21')](function(_0x15e604){_0x3aaa13[_0x0a0a('0x8f')]=_0x15e604['get']({'plain':!![]});_0x3aaa13['interaction'][_0x0a0a('0x90')]=_0x387df3;if(_0x3aaa13[_0x0a0a('0x8f')][_0x0a0a('0x90')]){if(_0x3aaa13['account']['autoclose']){_0x3aaa13[_0x0a0a('0x82')][_0x0a0a('0x91')]({'id':0x0,'priority':_0x3aaa13[_0x0a0a('0x82')][_0x0a0a('0x59')]+0x1,'app':'close','appdata':'unmanaged','interval':_0x0a0a('0x92')});}}return db[_0x0a0a('0x93')][_0x0a0a('0x5b')]({'body':_0x373170[_0x0a0a('0x5c')][_0x0a0a('0x5c')],'OpenchannelAccountId':_0x373170[_0x0a0a('0x57')]['id'],'OpenchannelInteractionId':_0x15e604['id'],'direction':'in','ContactId':_0x3aaa13[_0x0a0a('0x86')]['id'],'AttachmentId':_0x373170[_0x0a0a('0x5c')]['AttachmentId']});})[_0x0a0a('0x21')](function(_0xca4acf){_0x3aaa13[_0x0a0a('0x28')]=_0xca4acf;if(_0x3aaa13[_0x0a0a('0x8f')][_0x0a0a('0x94')]){return db[_0x0a0a('0x95')][_0x0a0a('0x60')]({'attributes':['id',_0x0a0a('0x39')],'where':{'id':_0x3aaa13[_0x0a0a('0x8f')][_0x0a0a('0x94')]}})[_0x0a0a('0x21')](function(_0x100cd5){if(_0x100cd5){_0x3aaa13[_0x0a0a('0x82')]['unshift']({'id':0x0,'priority':0x0,'app':_0x0a0a('0x96'),'appdata':_0x100cd5['name']+','+(_0x3aaa13[_0x0a0a('0x81')][_0x0a0a('0x97')]||0xa),'interval':_0x0a0a('0x92')});_0x3aaa13[_0x0a0a('0x98')]=![];}return respondWithRpcPromise(_0x0a0a('0x99'),_0x0a0a('0x9a'),_0x3aaa13);});}return respondWithRpcPromise(_0x0a0a('0x99'),_0x0a0a('0x9a'),_0x3aaa13);})[_0x0a0a('0x21')](function(_0x3bbedd){respondWithRpcPromise(_0x0a0a('0x9b'),'EventManager',{'event':_0x0a0a('0x6c'),'message':_0x3bbedd},client9002);return _0x3bbedd;})[_0x0a0a('0x21')](respondWithResult(_0x4eab42,null))[_0x0a0a('0x29')](handleError(_0x4eab42,null));};exports['addApplications']=function(_0x43dcce,_0x5a17c2,_0x47ca02){return db[_0x0a0a('0x3f')][_0x0a0a('0x9c')]({'where':{'id':_0x43dcce[_0x0a0a('0x57')]['id']}})[_0x0a0a('0x21')](handleEntityNotFound(_0x5a17c2,null))[_0x0a0a('0x21')](function(_0x105089){if(_0x105089){return db['sequelize'][_0x0a0a('0x9d')](function(_0x57e122){return db[_0x0a0a('0x7e')][_0x0a0a('0x35')]({'where':{'OpenchannelAccountId':_0x43dcce['params']['id']},'transaction':_0x57e122})[_0x0a0a('0x21')](function(_0xc4282d){var _0x28cffb=_[_0x0a0a('0x3e')](_0x43dcce['body'],function(_0x595fef){_0x595fef[_0x0a0a('0x67')]=_0x43dcce[_0x0a0a('0x57')]['id'];return _0x595fef;});return db[_0x0a0a('0x7e')]['bulkCreate'](_0x28cffb,{'transaction':_0x57e122});});})[_0x0a0a('0x21')](function(){return db[_0x0a0a('0x7e')]['findAndCountAll']({'where':{'OpenchannelAccountId':_0x43dcce[_0x0a0a('0x57')]['id']},'order':'priority'});});}})[_0x0a0a('0x21')](respondWithResult(_0x5a17c2,null))[_0x0a0a('0x29')](handleError(_0x5a17c2,null));};exports[_0x0a0a('0x9e')]=function(_0x8d0e0c,_0x2ae353,_0x2bcca6){var _0x99d26d={};var _0x292dbf={};var _0x2932e3;var _0x2a84e3;return db[_0x0a0a('0x3f')]['findOne']({'where':{'id':_0x8d0e0c[_0x0a0a('0x57')]['id']}})[_0x0a0a('0x21')](handleEntityNotFound(_0x2ae353,null))[_0x0a0a('0x21')](function(_0x1ac1c4){if(_0x1ac1c4){_0x2932e3=_0x1ac1c4;_0x292dbf[_0x0a0a('0x42')]=_['keys'](db[_0x0a0a('0x7e')][_0x0a0a('0x58')]);_0x292dbf[_0x0a0a('0x43')]=_[_0x0a0a('0x44')](_0x8d0e0c[_0x0a0a('0x43')]);_0x292dbf['filters']=_[_0x0a0a('0x46')](_0x292dbf[_0x0a0a('0x42')],_0x292dbf[_0x0a0a('0x43')]);_0x99d26d[_0x0a0a('0x47')]=_[_0x0a0a('0x46')](_0x292dbf['model'],qs['fields'](_0x8d0e0c[_0x0a0a('0x43')]['fields']));_0x99d26d[_0x0a0a('0x47')]=_0x99d26d[_0x0a0a('0x47')]['length']?_0x99d26d['attributes']:_0x292dbf[_0x0a0a('0x42')];_0x99d26d[_0x0a0a('0x4a')]=qs[_0x0a0a('0x4b')](_0x8d0e0c[_0x0a0a('0x43')][_0x0a0a('0x4b')]);_0x99d26d['where']=qs[_0x0a0a('0x45')](_[_0x0a0a('0x4d')](_0x8d0e0c[_0x0a0a('0x43')],_0x292dbf['filters']));if(_0x8d0e0c[_0x0a0a('0x43')][_0x0a0a('0x4e')]){_0x99d26d['where']=_[_0x0a0a('0x4f')](_0x99d26d[_0x0a0a('0x4c')],{'$or':_['map'](_0x99d26d[_0x0a0a('0x47')],function(_0x26ce6a){var _0x403e6e={};_0x403e6e[_0x26ce6a]={'$like':'%'+_0x8d0e0c[_0x0a0a('0x43')]['filter']+'%'};return _0x403e6e;})});}_0x99d26d=_[_0x0a0a('0x4f')]({},_0x99d26d,_0x8d0e0c[_0x0a0a('0x52')]);return _0x2932e3[_0x0a0a('0x9e')](_0x99d26d);}})[_0x0a0a('0x21')](function(_0x20ed66){if(_0x20ed66){_0x2a84e3=_0x20ed66[_0x0a0a('0x59')];if(!_0x8d0e0c[_0x0a0a('0x43')][_0x0a0a('0x49')](_0x0a0a('0x6a'))){_0x99d26d[_0x0a0a('0x2f')]=qs['limit'](_0x8d0e0c[_0x0a0a('0x43')][_0x0a0a('0x2f')]);_0x99d26d[_0x0a0a('0x2e')]=qs['offset'](_0x8d0e0c[_0x0a0a('0x43')][_0x0a0a('0x2e')]);}return _0x2932e3['getApplications'](_0x99d26d);}})[_0x0a0a('0x21')](function(_0x3edd35){if(_0x3edd35){return _0x3edd35?{'count':_0x2a84e3,'rows':_0x3edd35}:null;}})['then'](respondWithResult(_0x2ae353,null))[_0x0a0a('0x29')](handleError(_0x2ae353,null));};exports['getInteractions']=function(_0x1bbcb3,_0x416088,_0x3fea98){var _0x32fe8e={'raw':![],'where':{}};var _0x2102f1={};var _0xb716ce={'count':0x0,'rows':[]};return db[_0x0a0a('0x3f')][_0x0a0a('0x9c')]({'where':{'id':_0x1bbcb3[_0x0a0a('0x57')]['id']}})[_0x0a0a('0x21')](handleEntityNotFound(_0x416088,null))[_0x0a0a('0x21')](function(_0x59a7e3){if(_0x59a7e3){_0x2102f1[_0x0a0a('0x42')]=_[_0x0a0a('0x44')](db[_0x0a0a('0x89')]['rawAttributes']);_0x2102f1[_0x0a0a('0x43')]=_['keys'](_0x1bbcb3[_0x0a0a('0x43')]);_0x2102f1[_0x0a0a('0x45')]=_[_0x0a0a('0x46')](_0x2102f1[_0x0a0a('0x42')],_0x2102f1[_0x0a0a('0x43')]);_0x32fe8e[_0x0a0a('0x47')]=_['intersection'](_0x2102f1[_0x0a0a('0x42')],qs[_0x0a0a('0x48')](_0x1bbcb3[_0x0a0a('0x43')][_0x0a0a('0x48')]));_0x32fe8e[_0x0a0a('0x47')]=_0x32fe8e[_0x0a0a('0x47')]['length']?_0x32fe8e['attributes']:_0x2102f1[_0x0a0a('0x42')];if(!_0x1bbcb3[_0x0a0a('0x43')][_0x0a0a('0x49')](_0x0a0a('0x6a'))){_0x32fe8e['limit']=qs[_0x0a0a('0x2f')](_0x1bbcb3[_0x0a0a('0x43')][_0x0a0a('0x2f')]);_0x32fe8e['offset']=qs[_0x0a0a('0x2e')](_0x1bbcb3[_0x0a0a('0x43')][_0x0a0a('0x2e')]);}_0x32fe8e[_0x0a0a('0x4a')]=qs[_0x0a0a('0x4b')](_0x1bbcb3[_0x0a0a('0x43')][_0x0a0a('0x4b')]);_0x32fe8e[_0x0a0a('0x4c')]=qs['filters'](_['pick'](_0x1bbcb3[_0x0a0a('0x43')],_0x2102f1[_0x0a0a('0x45')]));_0x32fe8e[_0x0a0a('0x4c')]['OpenchannelAccountId']=_0x59a7e3['id'];if(_0x1bbcb3[_0x0a0a('0x43')][_0x0a0a('0x4e')]){_0x32fe8e[_0x0a0a('0x4c')]=_[_0x0a0a('0x4f')](_0x32fe8e[_0x0a0a('0x4c')],{'$or':_[_0x0a0a('0x3e')](_0x32fe8e[_0x0a0a('0x47')],function(_0x4a16eb){var _0xb2e24={};_0xb2e24[_0x4a16eb]={'$like':'%'+_0x1bbcb3[_0x0a0a('0x43')][_0x0a0a('0x4e')]+'%'};return _0xb2e24;})});}_0x32fe8e=_[_0x0a0a('0x4f')]({},_0x32fe8e,_0x1bbcb3[_0x0a0a('0x52')]);return db[_0x0a0a('0x89')]['count']({'where':_0x32fe8e[_0x0a0a('0x4c')]})[_0x0a0a('0x21')](function(_0x3ddb75){_0xb716ce['count']=_0x3ddb75;if(_0x1bbcb3['query'][_0x0a0a('0x5a')]){_0x32fe8e[_0x0a0a('0x53')]=[{'model':db[_0x0a0a('0x6e')],'as':_0x0a0a('0x9f'),'required':![]},{'model':db[_0x0a0a('0x95')],'as':_0x0a0a('0xa0'),'attributes':[_0x0a0a('0x39'),'fullname','internal'],'required':![]},{'model':db['Tag'],'as':_0x0a0a('0xa1'),'attributes':['id','name',_0x0a0a('0xa2')],'where':_0x1bbcb3[_0x0a0a('0x43')]['tag']?{'id':_0x1bbcb3[_0x0a0a('0x43')][_0x0a0a('0xa3')]}:undefined,'required':_0x1bbcb3['query']['tag']?!![]:![]}];}return db[_0x0a0a('0x89')][_0x0a0a('0x54')](_0x32fe8e);})['then'](function(_0x2928cd){_0xb716ce[_0x0a0a('0x55')]=_0x2928cd;return _0xb716ce;});}})[_0x0a0a('0x21')](respondWithFilteredResult(_0x416088,_0x32fe8e))[_0x0a0a('0x29')](handleError(_0x416088,null));};exports[_0x0a0a('0xa4')]=function(_0x601496,_0x3d7a91,_0x2d851c){return db['OpenchannelAccount'][_0x0a0a('0x60')]({'where':{'id':_0x601496[_0x0a0a('0x57')]['id']}})[_0x0a0a('0x21')](handleEntityNotFound(_0x3d7a91,null))['then'](function(_0x29167a){if(_0x29167a){return _0x29167a[_0x0a0a('0xa4')](_0x601496[_0x0a0a('0x5c')]['ids'],_[_0x0a0a('0xa5')](_0x601496[_0x0a0a('0x5c')],['ids','id'])||{})[_0x0a0a('0x8c')](function(_0x11f49d){for(var _0x107fe9=0x0;_0x107fe9<_0x601496[_0x0a0a('0x5c')][_0x0a0a('0xa6')][_0x0a0a('0x59')];_0x107fe9+=0x1){socket[_0x0a0a('0xa7')](_0x0a0a('0xa8'),{'UserId':_0x601496[_0x0a0a('0x5c')][_0x0a0a('0xa6')][_0x107fe9],'OpenchannelAccountId':_0x601496['params']['id']});}return _0x11f49d;});}})[_0x0a0a('0x21')](respondWithResult(_0x3d7a91,null))[_0x0a0a('0x29')](handleError(_0x3d7a91,null));};exports[_0x0a0a('0xa9')]=function(_0x38bd1e,_0x418cdb,_0x3da0a0){return db['OpenchannelAccount'][_0x0a0a('0x60')]({'where':{'id':_0x38bd1e[_0x0a0a('0x57')]['id']}})[_0x0a0a('0x21')](handleEntityNotFound(_0x418cdb,null))['then'](function(_0x49fb2a){if(_0x49fb2a){return _0x49fb2a[_0x0a0a('0xa9')](_0x38bd1e[_0x0a0a('0x43')][_0x0a0a('0xa6')])[_0x0a0a('0x21')](function(){if(_[_0x0a0a('0xaa')](_0x38bd1e[_0x0a0a('0x43')][_0x0a0a('0xa6')])){for(var _0x246483=0x0;_0x246483<_0x38bd1e[_0x0a0a('0x43')][_0x0a0a('0xa6')][_0x0a0a('0x59')];_0x246483+=0x1){socket[_0x0a0a('0xa7')](_0x0a0a('0xab'),{'UserId':Number(_0x38bd1e[_0x0a0a('0x43')][_0x0a0a('0xa6')][_0x246483]),'OpenchannelAccountId':Number(_0x38bd1e[_0x0a0a('0x57')]['id'])});}}else{socket[_0x0a0a('0xa7')](_0x0a0a('0xab'),{'UserId':Number(_0x38bd1e[_0x0a0a('0x43')][_0x0a0a('0xa6')]),'OpenchannelAccountId':Number(_0x38bd1e[_0x0a0a('0x57')]['id'])});}});}})[_0x0a0a('0x21')](respondWithStatusCode(_0x418cdb,null))[_0x0a0a('0x29')](handleError(_0x418cdb,null));};exports[_0x0a0a('0xac')]=function(_0x4fae2d,_0x30d143,_0x1db674){var _0xbb3fb8={};var _0xa18ec={};var _0x496857;var _0x5d4590;return db[_0x0a0a('0x3f')][_0x0a0a('0x9c')]({'where':{'id':_0x4fae2d['params']['id']}})[_0x0a0a('0x21')](handleEntityNotFound(_0x30d143,null))[_0x0a0a('0x21')](function(_0xe2b58f){if(_0xe2b58f){_0x496857=_0xe2b58f;_0xa18ec['model']=_[_0x0a0a('0x44')](db['User'][_0x0a0a('0x58')]);_0xa18ec[_0x0a0a('0x43')]=_[_0x0a0a('0x44')](_0x4fae2d[_0x0a0a('0x43')]);_0xa18ec[_0x0a0a('0x45')]=_['intersection'](_0xa18ec['model'],_0xa18ec['query']);_0xbb3fb8[_0x0a0a('0x47')]=_[_0x0a0a('0x46')](_0xa18ec[_0x0a0a('0x42')],qs[_0x0a0a('0x48')](_0x4fae2d[_0x0a0a('0x43')][_0x0a0a('0x48')]));_0xbb3fb8[_0x0a0a('0x47')]=_0xbb3fb8[_0x0a0a('0x47')][_0x0a0a('0x59')]?_0xbb3fb8[_0x0a0a('0x47')]:_0xa18ec[_0x0a0a('0x42')];_0xbb3fb8[_0x0a0a('0x4a')]=qs['sort'](_0x4fae2d['query'][_0x0a0a('0x4b')]);_0xbb3fb8[_0x0a0a('0x4c')]=qs[_0x0a0a('0x45')](_['pick'](_0x4fae2d[_0x0a0a('0x43')],_0xa18ec[_0x0a0a('0x45')]));if(_0x4fae2d['query']['filter']){_0xbb3fb8['where']=_['merge'](_0xbb3fb8[_0x0a0a('0x4c')],{'$or':_[_0x0a0a('0x3e')](_0xbb3fb8[_0x0a0a('0x47')],function(_0x5b9f1){var _0x596e3d={};_0x596e3d[_0x5b9f1]={'$like':'%'+_0x4fae2d['query'][_0x0a0a('0x4e')]+'%'};return _0x596e3d;})});}_0xbb3fb8=_['merge']({},_0xbb3fb8,_0x4fae2d['options']);return _0x496857[_0x0a0a('0xac')](_0xbb3fb8);}})[_0x0a0a('0x21')](function(_0x36c3e5){if(_0x36c3e5){_0x5d4590=_0x36c3e5[_0x0a0a('0x59')];if(!_0x4fae2d[_0x0a0a('0x43')][_0x0a0a('0x49')](_0x0a0a('0x6a'))){_0xbb3fb8[_0x0a0a('0x2f')]=qs[_0x0a0a('0x2f')](_0x4fae2d[_0x0a0a('0x43')]['limit']);_0xbb3fb8['offset']=qs[_0x0a0a('0x2e')](_0x4fae2d['query']['offset']);}return _0x496857[_0x0a0a('0xac')](_0xbb3fb8);}})['then'](function(_0x7517bd){if(_0x7517bd){return _0x7517bd?{'count':_0x5d4590,'rows':_0x7517bd}:null;}})['then'](respondWithResult(_0x30d143,null))[_0x0a0a('0x29')](handleError(_0x30d143,null));};exports['send']=function(_0x6ba88d,_0x228851,_0x441317){var _0x5c64e7,_0x1ba0a4,_0x470c97;if(_[_0x0a0a('0x76')](_0x6ba88d[_0x0a0a('0x5c')][_0x0a0a('0x5c')])||_0x6ba88d[_0x0a0a('0x5c')][_0x0a0a('0x5c')]===''){throw new db[(_0x0a0a('0x6f'))][(_0x0a0a('0x20'))](_0x0a0a('0x79'));}if(_[_0x0a0a('0x76')](_0x6ba88d[_0x0a0a('0x5c')]['to'])){}_0x5c64e7=_0x6ba88d['body']['to'];return db[_0x0a0a('0x3f')]['findOne']({'where':{'id':_0x6ba88d[_0x0a0a('0x57')]['id']}})[_0x0a0a('0x21')](handleEntityNotFound(_0x228851,null))[_0x0a0a('0x21')](function(_0x29d8c1){if(_0x29d8c1){return db[_0x0a0a('0x3f')][_0x0a0a('0x60')]({'where':{'id':_0x29d8c1['id']},'include':[{'model':db[_0x0a0a('0x7c')],'as':_0x0a0a('0x80'),'include':[{'model':db[_0x0a0a('0x6e')],'as':_0x0a0a('0x7d'),'where':{[_0x29d8c1[_0x0a0a('0x7a')]]:_0x5c64e7},'limit':0x1,'order':[[_0x0a0a('0x73'),_0x0a0a('0xad')]]}]}]})[_0x0a0a('0x21')](handleEntityNotFound(_0x228851,null))['then'](function(_0x4d8dc7){if(_0x4d8dc7&&_0x4d8dc7[_0x0a0a('0x80')]){_0x1ba0a4=_0x4d8dc7[_0x0a0a('0x36')]({'plain':!![]});if(_0x1ba0a4[_0x0a0a('0x80')]&&_0x1ba0a4[_0x0a0a('0x80')][_0x0a0a('0x7d')][_0x0a0a('0x59')]){return _0x1ba0a4[_0x0a0a('0x80')][_0x0a0a('0x7d')][0x0];}return db['CmContact'][_0x0a0a('0x5b')](_[_0x0a0a('0x19')](_0x6ba88d[_0x0a0a('0x5c')],{'firstName':_0x5c64e7,[_0x4d8dc7[_0x0a0a('0x7a')]]:_0x5c64e7,'phone':_0x5c64e7,'ListId':_0x1ba0a4[_0x0a0a('0x75')]}));}})[_0x0a0a('0x21')](handleEntityNotFound(_0x228851,null))[_0x0a0a('0x21')](function(_0x29a0e2){if(_0x29a0e2){_0x470c97=_0x29a0e2;return db[_0x0a0a('0x89')][_0x0a0a('0x60')]({'where':{'ContactId':_0x470c97['id'],'closed':![],'OpenchannelAccountId':_0x1ba0a4['id']}})[_0x0a0a('0x21')](function(_0x350926){if(_0x350926){return[_0x350926,![]];}return db[_0x0a0a('0x89')][_0x0a0a('0x5b')]({'UserId':_0x6ba88d['user']['id'],'ContactId':_0x470c97['id'],'OpenchannelAccountId':_0x1ba0a4['id'],'lastMsgDirection':_0x0a0a('0xae'),'Messages':[_['merge'](_0x6ba88d[_0x0a0a('0x5c')],{'read':![],'body':_0x6ba88d[_0x0a0a('0x5c')][_0x0a0a('0x5c')],'OpenchannelAccountId':_0x1ba0a4['id'],'UserId':_0x6ba88d[_0x0a0a('0xaf')]['id'],'ContactId':_0x470c97['id']})]},{'include':[{'model':db['OpenchannelMessage'],'as':_0x0a0a('0xb0')}]})['then'](function(_0x4a42ee){return[_0x4a42ee,!![]];});});}})[_0x0a0a('0x8c')](function(_0x211d12,_0x50a60f){if(_0x50a60f){return _0x211d12;}return db['OpenchannelMessage'][_0x0a0a('0x5b')](_[_0x0a0a('0x4f')](_0x6ba88d[_0x0a0a('0x5c')],{'read':![],'body':_0x6ba88d[_0x0a0a('0x5c')]['body'],'OpenchannelAccountId':_0x1ba0a4['id'],'OpenchannelInteractionId':_0x211d12['id'],'UserId':_0x6ba88d['user']['id'],'ContactId':_0x470c97['id']}))[_0x0a0a('0x21')](function(_0x23e105){_0x211d12[_0x0a0a('0xb1')][_0x0a0a('0xb0')]=[];_0x211d12['dataValues'][_0x0a0a('0xb0')]['push'](_0x23e105[_0x0a0a('0xb1')]);return _0x211d12;});});}})['then'](respondWithResult(_0x228851,null))['catch'](handleError(_0x228851,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 6bcf830..5606837 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 _0x0d56=['exports','OpenchannelAccount','setMaxListeners','save','update','remove','emit','hook'];(function(_0x4ade33,_0x103537){var _0x162cc1=function(_0x1c52ab){while(--_0x1c52ab){_0x4ade33['push'](_0x4ade33['shift']());}};_0x162cc1(++_0x103537);}(_0x0d56,0x181));var _0x60d5=function(_0x58d90a,_0x1a2ea6){_0x58d90a=_0x58d90a-0x0;var _0x3938a9=_0x0d56[_0x58d90a];return _0x3938a9;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require('../../mysqldb')['db'][_0x60d5('0x0')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x60d5('0x1')](0x0);var events={'afterCreate':_0x60d5('0x2'),'afterUpdate':_0x60d5('0x3'),'afterDestroy':_0x60d5('0x4')};function emitEvent(_0x3ccacd){return function(_0x33a1e2,_0xc96171,_0x1bf58e){OpenchannelAccountEvents[_0x60d5('0x5')](_0x3ccacd+':'+_0x33a1e2['id'],_0x33a1e2);OpenchannelAccountEvents[_0x60d5('0x5')](_0x3ccacd,_0x33a1e2);_0x1bf58e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelAccount[_0x60d5('0x6')](e,emitEvent(event));}}module[_0x60d5('0x7')]=OpenchannelAccountEvents; \ No newline at end of file +var _0x5f03=['setMaxListeners','save','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x8f6830,_0x7c8a1e){var _0x4ce2e5=function(_0x5b25ec){while(--_0x5b25ec){_0x8f6830['push'](_0x8f6830['shift']());}};_0x4ce2e5(++_0x7c8a1e);}(_0x5f03,0x1ae));var _0x35f0=function(_0x44f7dd,_0x1fa8b3){_0x44f7dd=_0x44f7dd-0x0;var _0x1a8093=_0x5f03[_0x44f7dd];return _0x1a8093;};'use strict';var EventEmitter=require(_0x35f0('0x0'));var OpenchannelAccount=require(_0x35f0('0x1'))['db']['OpenchannelAccount'];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x35f0('0x2')](0x0);var events={'afterCreate':_0x35f0('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x2d74bb){return function(_0x2e4382,_0x17e1b7,_0x1cf199){OpenchannelAccountEvents[_0x35f0('0x4')](_0x2d74bb+':'+_0x2e4382['id'],_0x2e4382);OpenchannelAccountEvents[_0x35f0('0x4')](_0x2d74bb,_0x2e4382);_0x1cf199(null);};}for(var e in events){if(events[_0x35f0('0x5')](e)){var event=events[e];OpenchannelAccount[_0x35f0('0x6')](e,emitEvent(event));}}module[_0x35f0('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 2362220..3eeff54 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 _0x63b7=['../../config/environment','./openchannelAccount.attributes','exports','define','OpenchannelAccount','openchannel_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x13f2b7,_0x224502){var _0x59c0d6=function(_0x2c60ce){while(--_0x2c60ce){_0x13f2b7['push'](_0x13f2b7['shift']());}};_0x59c0d6(++_0x224502);}(_0x63b7,0x12c));var _0x763b=function(_0x559a80,_0x3d193d){_0x559a80=_0x559a80-0x0;var _0x42f555=_0x63b7[_0x559a80];return _0x42f555;};'use strict';var _=require(_0x763b('0x0'));var util=require(_0x763b('0x1'));var logger=require(_0x763b('0x2'))(_0x763b('0x3'));var moment=require(_0x763b('0x4'));var BPromise=require(_0x763b('0x5'));var rp=require(_0x763b('0x6'));var fs=require('fs');var path=require(_0x763b('0x7'));var rimraf=require('rimraf');var config=require(_0x763b('0x8'));var attributes=require(_0x763b('0x9'));module[_0x763b('0xa')]=function(_0x433d11,_0x32ddf1){return _0x433d11[_0x763b('0xb')](_0x763b('0xc'),attributes,{'tableName':_0x763b('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x422b=['../../config/logger','api','moment','bluebird','path','../../config/environment','./openchannelAccount.attributes','define','OpenchannelAccount','lodash','util'];(function(_0xfdf7ad,_0x345ee3){var _0x51d483=function(_0x5bafed){while(--_0x5bafed){_0xfdf7ad['push'](_0xfdf7ad['shift']());}};_0x51d483(++_0x345ee3);}(_0x422b,0xf0));var _0xb422=function(_0x4bdf6b,_0x3cc158){_0x4bdf6b=_0x4bdf6b-0x0;var _0x22d293=_0x422b[_0x4bdf6b];return _0x22d293;};'use strict';var _=require(_0xb422('0x0'));var util=require(_0xb422('0x1'));var logger=require(_0xb422('0x2'))(_0xb422('0x3'));var moment=require(_0xb422('0x4'));var BPromise=require(_0xb422('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb422('0x6'));var rimraf=require('rimraf');var config=require(_0xb422('0x7'));var attributes=require(_0xb422('0x8'));module['exports']=function(_0x33f50c,_0x57eed0){return _0x33f50c[_0xb422('0x9')](_0xb422('0xa'),attributes,{'tableName':'openchannel_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.rpc.js b/server/api/openchannelAccount/openchannelAccount.rpc.js index b467a10..08604ca 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 _0x7ecc=['message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x3270cf,_0x2c29fb){var _0x139188=function(_0x2886fd){while(--_0x2886fd){_0x3270cf['push'](_0x3270cf['shift']());}};_0x139188(++_0x2c29fb);}(_0x7ecc,0xe3));var _0xc7ec=function(_0x5b1da2,_0x1b7bea){_0x5b1da2=_0x5b1da2-0x0;var _0x75bb6a=_0x7ecc[_0x5b1da2];return _0x75bb6a;};'use strict';var _=require(_0xc7ec('0x0'));var util=require(_0xc7ec('0x1'));var moment=require(_0xc7ec('0x2'));var BPromise=require(_0xc7ec('0x3'));var rs=require(_0xc7ec('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc7ec('0x5'))['db'];var utils=require(_0xc7ec('0x6'));var logger=require(_0xc7ec('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xc7ec('0x8'));var client=jayson[_0xc7ec('0x9')][_0xc7ec('0xa')]({'port':0x232a});config[_0xc7ec('0xb')]=_[_0xc7ec('0xc')](config['redis'],{'host':_0xc7ec('0xd'),'port':0x18eb});var socket=require(_0xc7ec('0xe'))(new Redis(config[_0xc7ec('0xb')]));require(_0xc7ec('0xf'))['register'](socket);function respondWithRpcPromise(_0xd8e712,_0x5139a5,_0x236fd8){return new BPromise(function(_0x20de72,_0x52e3b6){return client[_0xc7ec('0x10')](_0xd8e712,_0x236fd8)[_0xc7ec('0x11')](function(_0x54826a){logger[_0xc7ec('0x12')](_0xc7ec('0x13'),_0x5139a5,_0xc7ec('0x14'));logger[_0xc7ec('0x15')](_0xc7ec('0x16'),_0x5139a5,_0xc7ec('0x14'),JSON['stringify'](_0x54826a));if(_0x54826a[_0xc7ec('0x17')]){if(_0x54826a[_0xc7ec('0x17')][_0xc7ec('0x18')]===0x1f4){logger[_0xc7ec('0x17')](_0xc7ec('0x13'),_0x5139a5,_0x54826a['error'][_0xc7ec('0x19')]);return _0x52e3b6(_0x54826a['error']['message']);}logger[_0xc7ec('0x17')]('OpenchannelAccount,\x20%s,\x20%s',_0x5139a5,_0x54826a['error']['message']);return _0x20de72(_0x54826a[_0xc7ec('0x17')][_0xc7ec('0x19')]);}else{logger[_0xc7ec('0x12')](_0xc7ec('0x13'),_0x5139a5,_0xc7ec('0x14'));_0x20de72(_0x54826a[_0xc7ec('0x1a')]['message']);}})[_0xc7ec('0x1b')](function(_0x436a5c){logger[_0xc7ec('0x17')]('OpenchannelAccount,\x20%s,\x20%s',_0x5139a5,_0x436a5c);_0x52e3b6(_0x436a5c);});});} \ No newline at end of file +var _0xec72=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./openchannelAccount.socket','register','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','bluebird','randomstring','ioredis'];(function(_0x237714,_0x2d3f49){var _0x29afe4=function(_0x3a0963){while(--_0x3a0963){_0x237714['push'](_0x237714['shift']());}};_0x29afe4(++_0x2d3f49);}(_0xec72,0x68));var _0x2ec7=function(_0x348877,_0x52d538){_0x348877=_0x348877-0x0;var _0x3d13b9=_0xec72[_0x348877];return _0x3d13b9;};'use strict';var _=require(_0x2ec7('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x2ec7('0x1'));var rs=require(_0x2ec7('0x2'));var fs=require('fs');var Redis=require(_0x2ec7('0x3'));var db=require(_0x2ec7('0x4'))['db'];var utils=require(_0x2ec7('0x5'));var logger=require('../../config/logger')(_0x2ec7('0x6'));var config=require(_0x2ec7('0x7'));var jayson=require(_0x2ec7('0x8'));var client=jayson[_0x2ec7('0x9')][_0x2ec7('0xa')]({'port':0x232a});config[_0x2ec7('0xb')]=_[_0x2ec7('0xc')](config[_0x2ec7('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x2ec7('0xd'))(new Redis(config[_0x2ec7('0xb')]));require(_0x2ec7('0xe'))[_0x2ec7('0xf')](socket);function respondWithRpcPromise(_0x469657,_0x589b41,_0x5a1dd5){return new BPromise(function(_0x452a2d,_0x386fef){return client[_0x2ec7('0x10')](_0x469657,_0x5a1dd5)[_0x2ec7('0x11')](function(_0x3c0442){logger[_0x2ec7('0x12')](_0x2ec7('0x13'),_0x589b41,_0x2ec7('0x14'));logger[_0x2ec7('0x15')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x589b41,'request\x20sent',JSON[_0x2ec7('0x16')](_0x3c0442));if(_0x3c0442['error']){if(_0x3c0442[_0x2ec7('0x17')][_0x2ec7('0x18')]===0x1f4){logger[_0x2ec7('0x17')](_0x2ec7('0x13'),_0x589b41,_0x3c0442['error'][_0x2ec7('0x19')]);return _0x386fef(_0x3c0442[_0x2ec7('0x17')]['message']);}logger[_0x2ec7('0x17')](_0x2ec7('0x13'),_0x589b41,_0x3c0442['error'][_0x2ec7('0x19')]);return _0x452a2d(_0x3c0442[_0x2ec7('0x17')][_0x2ec7('0x19')]);}else{logger[_0x2ec7('0x12')](_0x2ec7('0x13'),_0x589b41,'request\x20sent');_0x452a2d(_0x3c0442['result'][_0x2ec7('0x19')]);}})[_0x2ec7('0x1a')](function(_0x42f6eb){logger[_0x2ec7('0x17')]('OpenchannelAccount,\x20%s,\x20%s',_0x589b41,_0x42f6eb);_0x386fef(_0x42f6eb);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 3333d7e..6212b04 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 _0xf657=['save','remove','update','emit','removeListener','register','length','openchannelAccount:','./openchannelAccount.events'];(function(_0x44e5f6,_0x1cdb43){var _0x350e0e=function(_0x329ed1){while(--_0x329ed1){_0x44e5f6['push'](_0x44e5f6['shift']());}};_0x350e0e(++_0x1cdb43);}(_0xf657,0x1a6));var _0x7f65=function(_0x3236cd,_0xddb386){_0x3236cd=_0x3236cd-0x0;var _0x538d66=_0xf657[_0x3236cd];return _0x538d66;};'use strict';var OpenchannelAccountEvents=require(_0x7f65('0x0'));var events=[_0x7f65('0x1'),_0x7f65('0x2'),_0x7f65('0x3')];function createListener(_0x474029,_0x42b724){return function(_0x25cdab){_0x42b724[_0x7f65('0x4')](_0x474029,_0x25cdab);};}function removeListener(_0x1eaa11,_0x384a59){return function(){OpenchannelAccountEvents[_0x7f65('0x5')](_0x1eaa11,_0x384a59);};}exports[_0x7f65('0x6')]=function(_0x353e7a){for(var _0xc87b43=0x0,_0x25ab91=events[_0x7f65('0x7')];_0xc87b43<_0x25ab91;_0xc87b43++){var _0x4bad85=events[_0xc87b43];var _0x1f6be1=createListener(_0x7f65('0x8')+_0x4bad85,_0x353e7a);OpenchannelAccountEvents['on'](_0x4bad85,_0x1f6be1);}}; \ No newline at end of file +var _0xc5b9=['openchannelAccount:','./openchannelAccount.events','save','remove','update','removeListener','register','length'];(function(_0x22ab64,_0x506558){var _0x1e85ec=function(_0x5f3c7b){while(--_0x5f3c7b){_0x22ab64['push'](_0x22ab64['shift']());}};_0x1e85ec(++_0x506558);}(_0xc5b9,0x1d9));var _0x9c5b=function(_0x163464,_0x51e2d8){_0x163464=_0x163464-0x0;var _0x4c3a04=_0xc5b9[_0x163464];return _0x4c3a04;};'use strict';var OpenchannelAccountEvents=require(_0x9c5b('0x0'));var events=[_0x9c5b('0x1'),_0x9c5b('0x2'),_0x9c5b('0x3')];function createListener(_0x3cd1ef,_0x376b72){return function(_0x2c2a8a){_0x376b72['emit'](_0x3cd1ef,_0x2c2a8a);};}function removeListener(_0x948ecc,_0xd30018){return function(){OpenchannelAccountEvents[_0x9c5b('0x4')](_0x948ecc,_0xd30018);};}exports[_0x9c5b('0x5')]=function(_0x23012b){for(var _0x434876=0x0,_0x25266a=events[_0x9c5b('0x6')];_0x434876<_0x25266a;_0x434876++){var _0x4f31dd=events[_0x434876];var _0x4f273e=createListener(_0x9c5b('0x7')+_0x4f31dd,_0x23012b);OpenchannelAccountEvents['on'](_0x4f31dd,_0x4f273e);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 3ef686d..bd64d5f 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 _0xca86=['update','delete','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','/:id','show','post','create','put'];(function(_0x39c006,_0x19f547){var _0x48061a=function(_0x2f364b){while(--_0x2f364b){_0x39c006['push'](_0x39c006['shift']());}};_0x48061a(++_0x19f547);}(_0xca86,0xc8));var _0x6ca8=function(_0x484f24,_0x5d4b8c){_0x484f24=_0x484f24-0x0;var _0xa4077d=_0xca86[_0x484f24];return _0xa4077d;};'use strict';var multer=require(_0x6ca8('0x0'));var util=require(_0x6ca8('0x1'));var path=require('path');var timeout=require(_0x6ca8('0x2'));var express=require(_0x6ca8('0x3'));var router=express[_0x6ca8('0x4')]();var auth=require(_0x6ca8('0x5'));var interaction=require(_0x6ca8('0x6'));var config=require(_0x6ca8('0x7'));var controller=require(_0x6ca8('0x8'));router[_0x6ca8('0x9')]('/',auth[_0x6ca8('0xa')](),controller['index']);router['get'](_0x6ca8('0xb'),auth[_0x6ca8('0xa')](),controller[_0x6ca8('0xc')]);router[_0x6ca8('0xd')]('/',auth[_0x6ca8('0xa')](),controller[_0x6ca8('0xe')]);router[_0x6ca8('0xf')]('/:id',auth[_0x6ca8('0xa')](),controller[_0x6ca8('0x10')]);router[_0x6ca8('0x11')](_0x6ca8('0xb'),auth[_0x6ca8('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xef59=['exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','./openchannelApplication.controller','get','isAuthenticated','index','/:id','show','post','create','update','delete','destroy'];(function(_0x4eb3a9,_0x454882){var _0x2a0f7a=function(_0x4383e6){while(--_0x4383e6){_0x4eb3a9['push'](_0x4eb3a9['shift']());}};_0x2a0f7a(++_0x454882);}(_0xef59,0x133));var _0x9ef5=function(_0x852450,_0xd2456e){_0x852450=_0x852450-0x0;var _0x329404=_0xef59[_0x852450];return _0x329404;};'use strict';var multer=require(_0x9ef5('0x0'));var util=require('util');var path=require(_0x9ef5('0x1'));var timeout=require(_0x9ef5('0x2'));var express=require(_0x9ef5('0x3'));var router=express[_0x9ef5('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x9ef5('0x5'));var config=require('../../config/environment');var controller=require(_0x9ef5('0x6'));router[_0x9ef5('0x7')]('/',auth[_0x9ef5('0x8')](),controller[_0x9ef5('0x9')]);router[_0x9ef5('0x7')](_0x9ef5('0xa'),auth['isAuthenticated'](),controller[_0x9ef5('0xb')]);router[_0x9ef5('0xc')]('/',auth[_0x9ef5('0x8')](),controller[_0x9ef5('0xd')]);router['put'](_0x9ef5('0xa'),auth[_0x9ef5('0x8')](),controller[_0x9ef5('0xe')]);router[_0x9ef5('0xf')](_0x9ef5('0xa'),auth[_0x9ef5('0x8')](),controller[_0x9ef5('0x10')]);module[_0x9ef5('0x11')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 95b80b1..6d2b431 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 _0x5d09=['TEXT','*,*,*,*','sequelize','INTEGER','STRING','noop'];(function(_0x1992f1,_0x5c61f0){var _0x413dfe=function(_0x2136e5){while(--_0x2136e5){_0x1992f1['push'](_0x1992f1['shift']());}};_0x413dfe(++_0x5c61f0);}(_0x5d09,0xe0));var _0x95d0=function(_0x2e846f,_0x57929a){_0x2e846f=_0x2e846f-0x0;var _0x42f147=_0x5d09[_0x2e846f];return _0x42f147;};'use strict';var Sequelize=require(_0x95d0('0x0'));module['exports']={'priority':{'type':Sequelize[_0x95d0('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x95d0('0x2')],'allowNull':![],'defaultValue':_0x95d0('0x3')},'appdata':{'type':Sequelize[_0x95d0('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x95d0('0x5')}}; \ No newline at end of file +var _0x31fa=['noop','TEXT','*,*,*,*','sequelize','STRING'];(function(_0x34bc30,_0x177cb0){var _0x5706de=function(_0x535a8c){while(--_0x535a8c){_0x34bc30['push'](_0x34bc30['shift']());}};_0x5706de(++_0x177cb0);}(_0x31fa,0x193));var _0xa31f=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x31fa[_0x53ccf2];return _0x5a2964;};'use strict';var Sequelize=require(_0xa31f('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xa31f('0x1')],'allowNull':![],'defaultValue':_0xa31f('0x2')},'appdata':{'type':Sequelize[_0xa31f('0x3')]()},'description':{'type':Sequelize[_0xa31f('0x1')]},'interval':{'type':Sequelize[_0xa31f('0x1')],'defaultValue':_0xa31f('0x4')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 424e3dc..649e35d 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 _0x06d8=['sendStatus','end','status','json','count','offset','limit','set','apply','reject','save','then','stack','name','send','index','map','OpenchannelApplication','fieldName','type','model','query','keys','filters','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','findAll','rows','show','params','rawAttributes','intersection','include','find','catch','create','body','update','destroy','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb'];(function(_0x1b2047,_0xabdf3b){var _0x3a8489=function(_0x1954b7){while(--_0x1954b7){_0x1b2047['push'](_0x1b2047['shift']());}};_0x3a8489(++_0xabdf3b);}(_0x06d8,0x7c));var _0x806d=function(_0x212971,_0x56bc42){_0x212971=_0x212971-0x0;var _0x220c2c=_0x06d8[_0x212971];return _0x220c2c;};'use strict';var pdf=require(_0x806d('0x0'));var emlformat=require(_0x806d('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x806d('0x2'));var jsonpatch=require(_0x806d('0x3'));var rp=require(_0x806d('0x4'));var moment=require('moment');var BPromise=require(_0x806d('0x5'));var Mustache=require(_0x806d('0x6'));var util=require('util');var path=require('path');var sox=require(_0x806d('0x7'));var csv=require(_0x806d('0x8'));var ejs=require(_0x806d('0x9'));var fs=require('fs');var _=require(_0x806d('0xa'));var squel=require(_0x806d('0xb'));var crypto=require('crypto');var jsforce=require(_0x806d('0xc'));var deskjs=require(_0x806d('0xd'));var toCsv=require('to-csv');var querystring=require(_0x806d('0xe'));var Papa=require(_0x806d('0xf'));var Redis=require('ioredis');var authService=require(_0x806d('0x10'));var qs=require(_0x806d('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x806d('0x12'));var logger=require(_0x806d('0x13'))(_0x806d('0x14'));var utils=require(_0x806d('0x15'));var config=require(_0x806d('0x16'));var db=require(_0x806d('0x17'))['db'];function respondWithStatusCode(_0x863642,_0x22fc53){_0x22fc53=_0x22fc53||0xcc;return function(_0x17cc8e){if(_0x17cc8e){return _0x863642[_0x806d('0x18')](_0x22fc53);}return _0x863642['status'](_0x22fc53)[_0x806d('0x19')]();};}function respondWithResult(_0x571459,_0x2f53b8){_0x2f53b8=_0x2f53b8||0xc8;return function(_0x45ee20){if(_0x45ee20){return _0x571459[_0x806d('0x1a')](_0x2f53b8)[_0x806d('0x1b')](_0x45ee20);}};}function respondWithFilteredResult(_0x1ad6ae,_0x260876){return function(_0x34b23b){if(_0x34b23b){var _0x4cdab0=_0x34b23b[_0x806d('0x1c')],_0x14a0e8=_0x260876[_0x806d('0x1d')],_0x2d53ee=_0x260876[_0x806d('0x1d')]+_0x260876[_0x806d('0x1e')],_0x4934c6;if(_0x2d53ee>=_0x4cdab0){_0x2d53ee=_0x4cdab0;_0x4934c6=0xc8;}else{_0x4934c6=0xce;}_0x1ad6ae[_0x806d('0x1a')](_0x4934c6);return _0x1ad6ae[_0x806d('0x1f')]('Content-Range',_0x14a0e8+'-'+_0x2d53ee+'/'+_0x4cdab0)['json'](_0x34b23b);}return null;};}function patchUpdates(_0x44b8ed){return function(_0xab7536){try{jsonpatch[_0x806d('0x20')](_0xab7536,_0x44b8ed,!![]);}catch(_0x5e585b){return BPromise[_0x806d('0x21')](_0x5e585b);}return _0xab7536[_0x806d('0x22')]();};}function saveUpdates(_0x491594,_0x22482c){return function(_0x4b0dc4){if(_0x4b0dc4){return _0x4b0dc4['update'](_0x491594)[_0x806d('0x23')](function(_0x4a54e5){return _0x4a54e5;});}return null;};}function removeEntity(_0x42f7e1,_0x5082ef){return function(_0x55b40d){if(_0x55b40d){return _0x55b40d['destroy']()[_0x806d('0x23')](function(){_0x42f7e1['status'](0xcc)[_0x806d('0x19')]();});}};}function handleEntityNotFound(_0x179746,_0x538513){return function(_0x21ecf4){if(!_0x21ecf4){_0x179746[_0x806d('0x18')](0x194);}return _0x21ecf4;};}function handleError(_0x3f6735,_0x593fbe){_0x593fbe=_0x593fbe||0x1f4;return function(_0x28e7ea){logger['error'](_0x28e7ea[_0x806d('0x24')]);if(_0x28e7ea[_0x806d('0x25')]){delete _0x28e7ea[_0x806d('0x25')];}_0x3f6735[_0x806d('0x1a')](_0x593fbe)[_0x806d('0x26')](_0x28e7ea);};}exports[_0x806d('0x27')]=function(_0x52a89b,_0x56fae8){var _0x57e83b={},_0x4eec09={},_0x59ecfc={'count':0x0,'rows':[]};var _0x4c8628=_[_0x806d('0x28')](db[_0x806d('0x29')]['rawAttributes'],function(_0x5235cb){return{'name':_0x5235cb[_0x806d('0x2a')],'type':_0x5235cb[_0x806d('0x2b')]['key']};});_0x4eec09[_0x806d('0x2c')]=_[_0x806d('0x28')](_0x4c8628,_0x806d('0x25'));_0x4eec09[_0x806d('0x2d')]=_[_0x806d('0x2e')](_0x52a89b[_0x806d('0x2d')]);_0x4eec09[_0x806d('0x2f')]=_['intersection'](_0x4eec09[_0x806d('0x2c')],_0x4eec09[_0x806d('0x2d')]);_0x57e83b['attributes']=_['intersection'](_0x4eec09[_0x806d('0x2c')],qs[_0x806d('0x30')](_0x52a89b[_0x806d('0x2d')][_0x806d('0x30')]));_0x57e83b[_0x806d('0x31')]=_0x57e83b[_0x806d('0x31')][_0x806d('0x32')]?_0x57e83b['attributes']:_0x4eec09['model'];if(!_0x52a89b['query'][_0x806d('0x33')](_0x806d('0x34'))){_0x57e83b[_0x806d('0x1e')]=qs['limit'](_0x52a89b['query']['limit']);_0x57e83b[_0x806d('0x1d')]=qs[_0x806d('0x1d')](_0x52a89b[_0x806d('0x2d')][_0x806d('0x1d')]);}_0x57e83b[_0x806d('0x35')]=qs[_0x806d('0x36')](_0x52a89b[_0x806d('0x2d')][_0x806d('0x36')]);_0x57e83b[_0x806d('0x37')]=qs[_0x806d('0x2f')](_[_0x806d('0x38')](_0x52a89b[_0x806d('0x2d')],_0x4eec09[_0x806d('0x2f')]),_0x4c8628);if(_0x52a89b[_0x806d('0x2d')][_0x806d('0x39')]){_0x57e83b[_0x806d('0x37')]=_['merge'](_0x57e83b['where'],{'$or':_['map'](_0x4c8628,function(_0x153568){if(_0x153568[_0x806d('0x2b')]!==_0x806d('0x3a')){var _0x44c79b={};_0x44c79b[_0x153568[_0x806d('0x25')]]={'$like':'%'+_0x52a89b[_0x806d('0x2d')][_0x806d('0x39')]+'%'};return _0x44c79b;}})});}_0x57e83b=_[_0x806d('0x3b')]({},_0x57e83b,_0x52a89b['options']);var _0x11ea84={'where':_0x57e83b[_0x806d('0x37')]};return db[_0x806d('0x29')][_0x806d('0x1c')](_0x11ea84)['then'](function(_0x2d1763){_0x59ecfc[_0x806d('0x1c')]=_0x2d1763;if(_0x52a89b[_0x806d('0x2d')][_0x806d('0x3c')]){_0x57e83b['include']=[{'all':!![]}];}return db['OpenchannelApplication'][_0x806d('0x3d')](_0x57e83b);})['then'](function(_0x5493f0){_0x59ecfc[_0x806d('0x3e')]=_0x5493f0;return _0x59ecfc;})[_0x806d('0x23')](respondWithFilteredResult(_0x56fae8,_0x57e83b))['catch'](handleError(_0x56fae8,null));};exports[_0x806d('0x3f')]=function(_0x57220f,_0x7606a3){var _0x4765b8={'raw':!![],'where':{'id':_0x57220f[_0x806d('0x40')]['id']}},_0x2f6102={};_0x2f6102[_0x806d('0x2c')]=_['keys'](db[_0x806d('0x29')][_0x806d('0x41')]);_0x2f6102[_0x806d('0x2d')]=_[_0x806d('0x2e')](_0x57220f[_0x806d('0x2d')]);_0x2f6102[_0x806d('0x2f')]=_[_0x806d('0x42')](_0x2f6102[_0x806d('0x2c')],_0x2f6102[_0x806d('0x2d')]);_0x4765b8['attributes']=_['intersection'](_0x2f6102[_0x806d('0x2c')],qs[_0x806d('0x30')](_0x57220f[_0x806d('0x2d')]['fields']));_0x4765b8[_0x806d('0x31')]=_0x4765b8[_0x806d('0x31')][_0x806d('0x32')]?_0x4765b8[_0x806d('0x31')]:_0x2f6102[_0x806d('0x2c')];if(_0x57220f['query'][_0x806d('0x3c')]){_0x4765b8[_0x806d('0x43')]=[{'all':!![]}];}_0x4765b8=_[_0x806d('0x3b')]({},_0x4765b8,_0x57220f['options']);return db[_0x806d('0x29')][_0x806d('0x44')](_0x4765b8)[_0x806d('0x23')](handleEntityNotFound(_0x7606a3,null))['then'](respondWithResult(_0x7606a3,null))[_0x806d('0x45')](handleError(_0x7606a3,null));};exports[_0x806d('0x46')]=function(_0x432677,_0x2e8cae){return db[_0x806d('0x29')]['create'](_0x432677[_0x806d('0x47')],{})[_0x806d('0x23')](respondWithResult(_0x2e8cae,0xc9))['catch'](handleError(_0x2e8cae,null));};exports[_0x806d('0x48')]=function(_0x336cd7,_0x29e120){if(_0x336cd7['body']['id']){delete _0x336cd7['body']['id'];}return db['OpenchannelApplication'][_0x806d('0x44')]({'where':{'id':_0x336cd7['params']['id']}})[_0x806d('0x23')](handleEntityNotFound(_0x29e120,null))['then'](saveUpdates(_0x336cd7[_0x806d('0x47')],null))[_0x806d('0x23')](respondWithResult(_0x29e120,null))['catch'](handleError(_0x29e120,null));};exports[_0x806d('0x49')]=function(_0x544aae,_0x5870d7){return db[_0x806d('0x29')][_0x806d('0x44')]({'where':{'id':_0x544aae[_0x806d('0x40')]['id']}})[_0x806d('0x23')](handleEntityNotFound(_0x5870d7,null))['then'](removeEntity(_0x5870d7,null))[_0x806d('0x45')](handleError(_0x5870d7,null));}; \ No newline at end of file +var _0x9ab3=['count','offset','limit','set','Content-Range','apply','reject','save','update','then','end','name','send','map','OpenchannelApplication','rawAttributes','fieldName','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','rows','catch','params','find','create','body','destroy','html-pdf','eml-format','rimraf','zip-dir','bluebird','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','json'];(function(_0x2910e9,_0x545660){var _0x3ebbfd=function(_0x270c61){while(--_0x270c61){_0x2910e9['push'](_0x2910e9['shift']());}};_0x3ebbfd(++_0x545660);}(_0x9ab3,0x149));var _0x39ab=function(_0x20f745,_0xcc1c7){_0x20f745=_0x20f745-0x0;var _0x3ef454=_0x9ab3[_0x20f745];return _0x3ef454;};'use strict';var pdf=require(_0x39ab('0x0'));var emlformat=require(_0x39ab('0x1'));var rimraf=require(_0x39ab('0x2'));var zipdir=require(_0x39ab('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x39ab('0x4'));var Mustache=require('mustache');var util=require(_0x39ab('0x5'));var path=require('path');var sox=require(_0x39ab('0x6'));var csv=require('to-csv');var ejs=require(_0x39ab('0x7'));var fs=require('fs');var _=require(_0x39ab('0x8'));var squel=require(_0x39ab('0x9'));var crypto=require(_0x39ab('0xa'));var jsforce=require(_0x39ab('0xb'));var deskjs=require(_0x39ab('0xc'));var toCsv=require(_0x39ab('0xd'));var querystring=require(_0x39ab('0xe'));var Papa=require('papaparse');var Redis=require(_0x39ab('0xf'));var authService=require(_0x39ab('0x10'));var qs=require(_0x39ab('0x11'));var as=require(_0x39ab('0x12'));var hardwareService=require(_0x39ab('0x13'));var logger=require(_0x39ab('0x14'))('api');var utils=require(_0x39ab('0x15'));var config=require('../../config/environment');var db=require(_0x39ab('0x16'))['db'];function respondWithStatusCode(_0x6c29e8,_0x1972c5){_0x1972c5=_0x1972c5||0xcc;return function(_0x9be483){if(_0x9be483){return _0x6c29e8[_0x39ab('0x17')](_0x1972c5);}return _0x6c29e8['status'](_0x1972c5)['end']();};}function respondWithResult(_0x4c1b5b,_0xca6fd1){_0xca6fd1=_0xca6fd1||0xc8;return function(_0x100bfa){if(_0x100bfa){return _0x4c1b5b[_0x39ab('0x18')](_0xca6fd1)[_0x39ab('0x19')](_0x100bfa);}};}function respondWithFilteredResult(_0x438b23,_0x139fed){return function(_0x4780e4){if(_0x4780e4){var _0x2081d8=_0x4780e4[_0x39ab('0x1a')],_0x4aa752=_0x139fed[_0x39ab('0x1b')],_0x37fcec=_0x139fed[_0x39ab('0x1b')]+_0x139fed[_0x39ab('0x1c')],_0x18bcad;if(_0x37fcec>=_0x2081d8){_0x37fcec=_0x2081d8;_0x18bcad=0xc8;}else{_0x18bcad=0xce;}_0x438b23[_0x39ab('0x18')](_0x18bcad);return _0x438b23[_0x39ab('0x1d')](_0x39ab('0x1e'),_0x4aa752+'-'+_0x37fcec+'/'+_0x2081d8)['json'](_0x4780e4);}return null;};}function patchUpdates(_0x2df5ce){return function(_0x158baf){try{jsonpatch[_0x39ab('0x1f')](_0x158baf,_0x2df5ce,!![]);}catch(_0x222c64){return BPromise[_0x39ab('0x20')](_0x222c64);}return _0x158baf[_0x39ab('0x21')]();};}function saveUpdates(_0x46477e,_0x4290d8){return function(_0x160b62){if(_0x160b62){return _0x160b62[_0x39ab('0x22')](_0x46477e)[_0x39ab('0x23')](function(_0x5aebb5){return _0x5aebb5;});}return null;};}function removeEntity(_0x8622f0,_0x24646c){return function(_0x3d6ec7){if(_0x3d6ec7){return _0x3d6ec7['destroy']()['then'](function(){_0x8622f0[_0x39ab('0x18')](0xcc)[_0x39ab('0x24')]();});}};}function handleEntityNotFound(_0x28bee7,_0x4026d3){return function(_0x2bc4ec){if(!_0x2bc4ec){_0x28bee7[_0x39ab('0x17')](0x194);}return _0x2bc4ec;};}function handleError(_0x2061d2,_0x2fd82b){_0x2fd82b=_0x2fd82b||0x1f4;return function(_0x1f059a){logger['error'](_0x1f059a['stack']);if(_0x1f059a[_0x39ab('0x25')]){delete _0x1f059a[_0x39ab('0x25')];}_0x2061d2[_0x39ab('0x18')](_0x2fd82b)[_0x39ab('0x26')](_0x1f059a);};}exports['index']=function(_0x3c9bf8,_0x230271){var _0x34aae0={},_0x29a931={},_0x344379={'count':0x0,'rows':[]};var _0x196d97=_[_0x39ab('0x27')](db[_0x39ab('0x28')][_0x39ab('0x29')],function(_0x1684e2){return{'name':_0x1684e2[_0x39ab('0x2a')],'type':_0x1684e2['type'][_0x39ab('0x2b')]};});_0x29a931[_0x39ab('0x2c')]=_[_0x39ab('0x27')](_0x196d97,_0x39ab('0x25'));_0x29a931['query']=_[_0x39ab('0x2d')](_0x3c9bf8['query']);_0x29a931[_0x39ab('0x2e')]=_[_0x39ab('0x2f')](_0x29a931[_0x39ab('0x2c')],_0x29a931[_0x39ab('0x30')]);_0x34aae0[_0x39ab('0x31')]=_[_0x39ab('0x2f')](_0x29a931[_0x39ab('0x2c')],qs[_0x39ab('0x32')](_0x3c9bf8[_0x39ab('0x30')][_0x39ab('0x32')]));_0x34aae0[_0x39ab('0x31')]=_0x34aae0['attributes'][_0x39ab('0x33')]?_0x34aae0[_0x39ab('0x31')]:_0x29a931[_0x39ab('0x2c')];if(!_0x3c9bf8[_0x39ab('0x30')][_0x39ab('0x34')](_0x39ab('0x35'))){_0x34aae0[_0x39ab('0x1c')]=qs[_0x39ab('0x1c')](_0x3c9bf8[_0x39ab('0x30')]['limit']);_0x34aae0[_0x39ab('0x1b')]=qs[_0x39ab('0x1b')](_0x3c9bf8[_0x39ab('0x30')][_0x39ab('0x1b')]);}_0x34aae0[_0x39ab('0x36')]=qs[_0x39ab('0x37')](_0x3c9bf8[_0x39ab('0x30')][_0x39ab('0x37')]);_0x34aae0[_0x39ab('0x38')]=qs[_0x39ab('0x2e')](_[_0x39ab('0x39')](_0x3c9bf8[_0x39ab('0x30')],_0x29a931[_0x39ab('0x2e')]),_0x196d97);if(_0x3c9bf8['query'][_0x39ab('0x3a')]){_0x34aae0[_0x39ab('0x38')]=_['merge'](_0x34aae0[_0x39ab('0x38')],{'$or':_[_0x39ab('0x27')](_0x196d97,function(_0x2d46c1){if(_0x2d46c1['type']!==_0x39ab('0x3b')){var _0x23c918={};_0x23c918[_0x2d46c1['name']]={'$like':'%'+_0x3c9bf8['query']['filter']+'%'};return _0x23c918;}})});}_0x34aae0=_[_0x39ab('0x3c')]({},_0x34aae0,_0x3c9bf8[_0x39ab('0x3d')]);var _0x4ca5f7={'where':_0x34aae0[_0x39ab('0x38')]};return db[_0x39ab('0x28')]['count'](_0x4ca5f7)[_0x39ab('0x23')](function(_0x250a25){_0x344379[_0x39ab('0x1a')]=_0x250a25;if(_0x3c9bf8['query']['includeAll']){_0x34aae0[_0x39ab('0x3e')]=[{'all':!![]}];}return db[_0x39ab('0x28')][_0x39ab('0x3f')](_0x34aae0);})[_0x39ab('0x23')](function(_0x4dd595){_0x344379[_0x39ab('0x40')]=_0x4dd595;return _0x344379;})[_0x39ab('0x23')](respondWithFilteredResult(_0x230271,_0x34aae0))[_0x39ab('0x41')](handleError(_0x230271,null));};exports['show']=function(_0x3a02c2,_0x34542c){var _0x21b5c2={'raw':!![],'where':{'id':_0x3a02c2[_0x39ab('0x42')]['id']}},_0x3ffb6f={};_0x3ffb6f['model']=_[_0x39ab('0x2d')](db[_0x39ab('0x28')][_0x39ab('0x29')]);_0x3ffb6f[_0x39ab('0x30')]=_[_0x39ab('0x2d')](_0x3a02c2['query']);_0x3ffb6f[_0x39ab('0x2e')]=_[_0x39ab('0x2f')](_0x3ffb6f[_0x39ab('0x2c')],_0x3ffb6f['query']);_0x21b5c2['attributes']=_['intersection'](_0x3ffb6f[_0x39ab('0x2c')],qs['fields'](_0x3a02c2['query'][_0x39ab('0x32')]));_0x21b5c2[_0x39ab('0x31')]=_0x21b5c2[_0x39ab('0x31')][_0x39ab('0x33')]?_0x21b5c2[_0x39ab('0x31')]:_0x3ffb6f['model'];if(_0x3a02c2[_0x39ab('0x30')]['includeAll']){_0x21b5c2['include']=[{'all':!![]}];}_0x21b5c2=_[_0x39ab('0x3c')]({},_0x21b5c2,_0x3a02c2[_0x39ab('0x3d')]);return db['OpenchannelApplication'][_0x39ab('0x43')](_0x21b5c2)[_0x39ab('0x23')](handleEntityNotFound(_0x34542c,null))['then'](respondWithResult(_0x34542c,null))[_0x39ab('0x41')](handleError(_0x34542c,null));};exports[_0x39ab('0x44')]=function(_0x481700,_0x37011d){return db[_0x39ab('0x28')][_0x39ab('0x44')](_0x481700[_0x39ab('0x45')],{})['then'](respondWithResult(_0x37011d,0xc9))['catch'](handleError(_0x37011d,null));};exports[_0x39ab('0x22')]=function(_0x21c82e,_0x350e46){if(_0x21c82e[_0x39ab('0x45')]['id']){delete _0x21c82e[_0x39ab('0x45')]['id'];}return db[_0x39ab('0x28')]['find']({'where':{'id':_0x21c82e[_0x39ab('0x42')]['id']}})['then'](handleEntityNotFound(_0x350e46,null))[_0x39ab('0x23')](saveUpdates(_0x21c82e[_0x39ab('0x45')],null))[_0x39ab('0x23')](respondWithResult(_0x350e46,null))['catch'](handleError(_0x350e46,null));};exports[_0x39ab('0x46')]=function(_0x3500d1,_0x1b3423){return db[_0x39ab('0x28')][_0x39ab('0x43')]({'where':{'id':_0x3500d1[_0x39ab('0x42')]['id']}})[_0x39ab('0x23')](handleEntityNotFound(_0x1b3423,null))[_0x39ab('0x23')](removeEntity(_0x1b3423,null))[_0x39ab('0x41')](handleError(_0x1b3423,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index f8b44e9..0d5db74 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 _0xbd26=['request-promise','path','rimraf','../../config/environment','./openchannelApplication.attributes','exports','define','OpenchannelApplication','openchannel_applications','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird'];(function(_0x97f80e,_0x6ab038){var _0x4195cc=function(_0x1821d0){while(--_0x1821d0){_0x97f80e['push'](_0x97f80e['shift']());}};_0x4195cc(++_0x6ab038);}(_0xbd26,0xfa));var _0x6bd2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbd26[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x6bd2('0x0'));var util=require(_0x6bd2('0x1'));var logger=require('../../config/logger')(_0x6bd2('0x2'));var moment=require(_0x6bd2('0x3'));var BPromise=require(_0x6bd2('0x4'));var rp=require(_0x6bd2('0x5'));var fs=require('fs');var path=require(_0x6bd2('0x6'));var rimraf=require(_0x6bd2('0x7'));var config=require(_0x6bd2('0x8'));var attributes=require(_0x6bd2('0x9'));module[_0x6bd2('0xa')]=function(_0xc77257,_0x3821de){return _0xc77257[_0x6bd2('0xb')](_0x6bd2('0xc'),attributes,{'tableName':_0x6bd2('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x6bd2('0xe')});}; \ No newline at end of file +var _0x54da=['openchannel_applications','utf8mb4','utf8mb4_unicode_ci','lodash','moment','request-promise','rimraf','../../config/environment','./openchannelApplication.attributes','define'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0x54da,0x111));var _0xa54d=function(_0x98c9b4,_0x31b540){_0x98c9b4=_0x98c9b4-0x0;var _0x57f252=_0x54da[_0x98c9b4];return _0x57f252;};'use strict';var _=require(_0xa54d('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xa54d('0x1'));var BPromise=require('bluebird');var rp=require(_0xa54d('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa54d('0x3'));var config=require(_0xa54d('0x4'));var attributes=require(_0xa54d('0x5'));module['exports']=function(_0x4ab924,_0x524a0a){return _0x4ab924[_0xa54d('0x6')]('OpenchannelApplication',attributes,{'tableName':_0xa54d('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa54d('0x8'),'collate':_0xa54d('0x9')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index daf2c42..c10ef87 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 _0x5f2f=['error','code','message','request\x20sent','result','catch','UpdateOpenchannelApplication','OpenchannelApplication','update','body','options','raw','where','attributes','limit','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','OpenchannelApplication,\x20%s,\x20%s','debug','stringify'];(function(_0x187045,_0x27442a){var _0x228241=function(_0x3c2a4f){while(--_0x3c2a4f){_0x187045['push'](_0x187045['shift']());}};_0x228241(++_0x27442a);}(_0x5f2f,0x73));var _0xf5f2=function(_0x401531,_0x582a70){_0x401531=_0x401531-0x0;var _0x51b83c=_0x5f2f[_0x401531];return _0x51b83c;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('OpenchannelApplication,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});}exports[_0xf5f2('0x17')]=function(_0x20fccd){var _0x28e097=this;return new Promise(function(_0x4ff59b,_0x3ee69){return db[_0xf5f2('0x18')][_0xf5f2('0x19')](_0x20fccd[_0xf5f2('0x1a')],{'raw':_0x20fccd['options']?_0x20fccd[_0xf5f2('0x1b')][_0xf5f2('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x20fccd['options']?_0x20fccd['options'][_0xf5f2('0x1d')]||null:null,'attributes':_0x20fccd[_0xf5f2('0x1b')]?_0x20fccd['options'][_0xf5f2('0x1e')]||null:null,'limit':_0x20fccd[_0xf5f2('0x1b')]?_0x20fccd[_0xf5f2('0x1b')][_0xf5f2('0x1f')]||null:null})[_0xf5f2('0x20')](function(_0x4c691a){logger[_0xf5f2('0xd')](_0xf5f2('0x17'),_0x20fccd);logger[_0xf5f2('0xf')](_0xf5f2('0x17'),_0x20fccd,JSON[_0xf5f2('0x10')](_0x4c691a));_0x4ff59b(_0x4c691a);})['catch'](function(_0x529f07){logger[_0xf5f2('0x11')](_0xf5f2('0x17'),_0x529f07[_0xf5f2('0x13')],_0x20fccd);_0x3ee69(_0x28e097[_0xf5f2('0x11')](0x1f4,_0x529f07[_0xf5f2('0x13')]));});});}; \ No newline at end of file +var _0x5f2f=['error','code','message','request\x20sent','result','catch','UpdateOpenchannelApplication','OpenchannelApplication','update','body','options','raw','where','attributes','limit','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','OpenchannelApplication,\x20%s,\x20%s','debug','stringify'];(function(_0x3d89ce,_0x5d5e4b){var _0x494a2e=function(_0x1222b8){while(--_0x1222b8){_0x3d89ce['push'](_0x3d89ce['shift']());}};_0x494a2e(++_0x5d5e4b);}(_0x5f2f,0x73));var _0xf5f2=function(_0x2ac0c8,_0xd79532){_0x2ac0c8=_0x2ac0c8-0x0;var _0x574c61=_0x5f2f[_0x2ac0c8];return _0x574c61;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('OpenchannelApplication,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});}exports[_0xf5f2('0x17')]=function(_0x20fccd){var _0x28e097=this;return new Promise(function(_0x4ff59b,_0x3ee69){return db[_0xf5f2('0x18')][_0xf5f2('0x19')](_0x20fccd[_0xf5f2('0x1a')],{'raw':_0x20fccd['options']?_0x20fccd[_0xf5f2('0x1b')][_0xf5f2('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x20fccd['options']?_0x20fccd['options'][_0xf5f2('0x1d')]||null:null,'attributes':_0x20fccd[_0xf5f2('0x1b')]?_0x20fccd['options'][_0xf5f2('0x1e')]||null:null,'limit':_0x20fccd[_0xf5f2('0x1b')]?_0x20fccd[_0xf5f2('0x1b')][_0xf5f2('0x1f')]||null:null})[_0xf5f2('0x20')](function(_0x4c691a){logger[_0xf5f2('0xd')](_0xf5f2('0x17'),_0x20fccd);logger[_0xf5f2('0xf')](_0xf5f2('0x17'),_0x20fccd,JSON[_0xf5f2('0x10')](_0x4c691a));_0x4ff59b(_0x4c691a);})['catch'](function(_0x529f07){logger[_0xf5f2('0x11')](_0xf5f2('0x17'),_0x529f07[_0xf5f2('0x13')],_0x20fccd);_0x3ee69(_0x28e097[_0xf5f2('0x11')](0x1f4,_0x529f07[_0xf5f2('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 7cc3f58..6caafab 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 _0x82dc=['/describe','describe','/:id','show','/:id/messages','download','post','create','addMessage','/:id/tags','openchannel','openchannelinteraction:addtags','addTags','tracked','openchannelinteraction:destroy','destroy','delete','removeTags','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x82dc,0x103));var _0xc82d=function(_0x429054,_0x353e19){_0x429054=_0x429054-0x0;var _0x155448=_0x82dc[_0x429054];return _0x155448;};'use strict';var multer=require(_0xc82d('0x0'));var util=require(_0xc82d('0x1'));var path=require(_0xc82d('0x2'));var timeout=require(_0xc82d('0x3'));var express=require(_0xc82d('0x4'));var router=express[_0xc82d('0x5')]();var auth=require(_0xc82d('0x6'));var interaction=require(_0xc82d('0x7'));var config=require(_0xc82d('0x8'));var controller=require('./openchannelInteraction.controller');router[_0xc82d('0x9')]('/',auth[_0xc82d('0xa')](),controller['index']);router[_0xc82d('0x9')](_0xc82d('0xb'),auth[_0xc82d('0xa')](),controller[_0xc82d('0xc')]);router[_0xc82d('0x9')](_0xc82d('0xd'),auth[_0xc82d('0xa')](),controller[_0xc82d('0xe')]);router[_0xc82d('0x9')](_0xc82d('0xf'),auth[_0xc82d('0xa')](),controller['getMessages']);router[_0xc82d('0x9')]('/:id/download',auth[_0xc82d('0xa')](),controller[_0xc82d('0x10')]);router[_0xc82d('0x11')]('/',auth[_0xc82d('0xa')](),controller[_0xc82d('0x12')]);router[_0xc82d('0x11')](_0xc82d('0xf'),auth[_0xc82d('0xa')](),controller[_0xc82d('0x13')]);router[_0xc82d('0x11')](_0xc82d('0x14'),auth[_0xc82d('0xa')](),interaction['tracked'](_0xc82d('0x15'),_0xc82d('0x16')),controller[_0xc82d('0x17')]);router['put'](_0xc82d('0xd'),auth[_0xc82d('0xa')](),interaction[_0xc82d('0x18')](_0xc82d('0x15'),'openchannelinteraction:update'),controller['update']);router['delete'](_0xc82d('0xd'),auth[_0xc82d('0xa')](),interaction['tracked']('openchannel',_0xc82d('0x19')),controller[_0xc82d('0x1a')]);router[_0xc82d('0x1b')](_0xc82d('0x14'),auth[_0xc82d('0xa')](),controller[_0xc82d('0x1c')]);module[_0xc82d('0x1d')]=router; \ No newline at end of file +var _0x6824=['tracked','openchannel','openchannelinteraction:update','delete','openchannelinteraction:destroy','removeTags','exports','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMessages','/:id/download','download','post','/:id/messages','addMessage','/:id/tags','openchannelinteraction:addtags','addTags','put'];(function(_0x77e7e8,_0x5a319f){var _0x205a3e=function(_0x2a0454){while(--_0x2a0454){_0x77e7e8['push'](_0x77e7e8['shift']());}};_0x205a3e(++_0x5a319f);}(_0x6824,0x13d));var _0x4682=function(_0x418424,_0x2b3825){_0x418424=_0x418424-0x0;var _0x5c4e19=_0x6824[_0x418424];return _0x5c4e19;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4682('0x0'));var timeout=require(_0x4682('0x1'));var express=require(_0x4682('0x2'));var router=express['Router']();var auth=require(_0x4682('0x3'));var interaction=require(_0x4682('0x4'));var config=require(_0x4682('0x5'));var controller=require(_0x4682('0x6'));router[_0x4682('0x7')]('/',auth[_0x4682('0x8')](),controller[_0x4682('0x9')]);router['get'](_0x4682('0xa'),auth[_0x4682('0x8')](),controller[_0x4682('0xb')]);router[_0x4682('0x7')](_0x4682('0xc'),auth[_0x4682('0x8')](),controller[_0x4682('0xd')]);router[_0x4682('0x7')]('/:id/messages',auth[_0x4682('0x8')](),controller[_0x4682('0xe')]);router[_0x4682('0x7')](_0x4682('0xf'),auth[_0x4682('0x8')](),controller[_0x4682('0x10')]);router[_0x4682('0x11')]('/',auth[_0x4682('0x8')](),controller['create']);router[_0x4682('0x11')](_0x4682('0x12'),auth['isAuthenticated'](),controller[_0x4682('0x13')]);router[_0x4682('0x11')](_0x4682('0x14'),auth[_0x4682('0x8')](),interaction['tracked']('openchannel',_0x4682('0x15')),controller[_0x4682('0x16')]);router[_0x4682('0x17')]('/:id',auth[_0x4682('0x8')](),interaction[_0x4682('0x18')](_0x4682('0x19'),_0x4682('0x1a')),controller['update']);router[_0x4682('0x1b')](_0x4682('0xc'),auth['isAuthenticated'](),interaction[_0x4682('0x18')]('openchannel',_0x4682('0x1c')),controller['destroy']);router[_0x4682('0x1b')]('/:id/tags',auth[_0x4682('0x8')](),controller[_0x4682('0x1d')]);module[_0x4682('0x1e')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 7123439..de7dec7 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 _0x3df8=['ENUM','out','exports','DATE','STRING'];(function(_0x129c27,_0x333c44){var _0x5a8017=function(_0x5c5083){while(--_0x5c5083){_0x129c27['push'](_0x129c27['shift']());}};_0x5a8017(++_0x333c44);}(_0x3df8,0xed));var _0x83df=function(_0x52c4e9,_0x5412d0){_0x52c4e9=_0x52c4e9-0x0;var _0x252a03=_0x3df8[_0x52c4e9];return _0x252a03;};'use strict';var Sequelize=require('sequelize');module[_0x83df('0x0')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x83df('0x1')]},'disposition':{'type':Sequelize[_0x83df('0x2')]},'note':{'type':Sequelize[_0x83df('0x2')]},'read1stAt':{'type':Sequelize['DATE']},'threadId':{'type':Sequelize[_0x83df('0x2')]},'externalUrl':{'type':Sequelize['STRING']},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x83df('0x3')]('in',_0x83df('0x4')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x83df('0x2')]}}; \ No newline at end of file +var _0xa778=['out','sequelize','exports','BOOLEAN','STRING','DATE','ENUM'];(function(_0x5c3ae9,_0x450f9a){var _0x3f5950=function(_0x594c1f){while(--_0x594c1f){_0x5c3ae9['push'](_0x5c3ae9['shift']());}};_0x3f5950(++_0x450f9a);}(_0xa778,0x17b));var _0x8a77=function(_0x163453,_0x317d0e){_0x163453=_0x163453-0x0;var _0x593329=_0xa778[_0x163453];return _0x593329;};'use strict';var Sequelize=require(_0x8a77('0x0'));module[_0x8a77('0x1')]={'closed':{'type':Sequelize[_0x8a77('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x8a77('0x3')]},'note':{'type':Sequelize[_0x8a77('0x3')]},'read1stAt':{'type':Sequelize[_0x8a77('0x4')]},'threadId':{'type':Sequelize[_0x8a77('0x3')]},'externalUrl':{'type':Sequelize['STRING']},'lastMsgAt':{'type':Sequelize[_0x8a77('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x8a77('0x5')]('in',_0x8a77('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x8a77('0x3')]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 8c3bdae..437562a 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 _0xc8bf=['search','parseSearch','length','conditions','value','having','`\x20=\x200','`\x20>\x200','Contact','$substring','split','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','text','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','keys','some','isEmpty','i.OpenchannelAccountId\x20IN\x20?','concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','\x27\x27\x27\x27','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','DESC','t.id\x20IN\x20?','resolve','OpenchannelAccountId','journey','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','i.OpenchannelAccountId\x20IS\x20NULL','sequelize','toString','merge','Account.key','a.mandatoryDisposition','i.*','c.firstName','Contact.firstName','Contact.lastName','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','OpenchannelInteractionId','all','rows','show','params','includeAll','include','options','create','body','describe','addMessage','OpenchannelMessage','ids','omit','getMessages','rawAttributes','hasOwnProperty','$gte','format','setTags','spread','Tag','findAll','color','removeTags','download','unix','server','files','tmp','join','root','attachments','transcript-%d-%s.zip','fullname','CmContact','lastName','Attachment','direction','secret','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','Openchannel','N.A.','YYYY-MM-DD\x20HH:mm:ss','disposition','Private','Messages','basename','createReadStream','pipe','createWriteStream','out','System','firstName','renderFile','views','downloadInteraction.html','toFile','.pdf','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','status','end','count','offset','limit','json','apply','reject','save','update','destroy','error','stack','name','send','Users','map','TagIds','forEach','Tags','push','then','catch','index','OpenchannelInteraction','fieldName','type','query','filters','intersection','model','attributes','fields','nolimit','order','sort','where','pick','select','field','from','tools_tags','u.id','u.fullname','ui.OpenchannelInteractionId','user_has_openchannel_interactions','users','openchannel_interactions','left_join','o.id\x20=\x20i.UserId','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr'];(function(_0x3153d8,_0x2586e6){var _0x20cd53=function(_0xc4bb1d){while(--_0xc4bb1d){_0x3153d8['push'](_0x3153d8['shift']());}};_0x20cd53(++_0x2586e6);}(_0xc8bf,0x181));var _0xfc8b=function(_0x1cb690,_0x57f491){_0x1cb690=_0x1cb690-0x0;var _0x221e97=_0xc8bf[_0x1cb690];return _0x221e97;};'use strict';var pdf=require(_0xfc8b('0x0'));var emlformat=require(_0xfc8b('0x1'));var rimraf=require(_0xfc8b('0x2'));var zipdir=require(_0xfc8b('0x3'));var jsonpatch=require(_0xfc8b('0x4'));var rp=require(_0xfc8b('0x5'));var moment=require(_0xfc8b('0x6'));var BPromise=require(_0xfc8b('0x7'));var Mustache=require('mustache');var util=require(_0xfc8b('0x8'));var path=require(_0xfc8b('0x9'));var sox=require(_0xfc8b('0xa'));var csv=require(_0xfc8b('0xb'));var ejs=require(_0xfc8b('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0xfc8b('0xd'));var crypto=require('crypto');var jsforce=require(_0xfc8b('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xfc8b('0xb'));var querystring=require('querystring');var Papa=require(_0xfc8b('0xf'));var Redis=require(_0xfc8b('0x10'));var authService=require(_0xfc8b('0x11'));var qs=require(_0xfc8b('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfc8b('0x13'));var logger=require('../../config/logger')(_0xfc8b('0x14'));var utils=require(_0xfc8b('0x15'));var config=require(_0xfc8b('0x16'));var db=require(_0xfc8b('0x17'))['db'];config[_0xfc8b('0x18')]=_[_0xfc8b('0x19')](config[_0xfc8b('0x18')],{'host':_0xfc8b('0x1a'),'port':0x18eb});var socket=require(_0xfc8b('0x1b'))(new Redis(config['redis']));require(_0xfc8b('0x1c'))[_0xfc8b('0x1d')](socket);function respondWithStatusCode(_0x5c7958,_0x78eb76){_0x78eb76=_0x78eb76||0xcc;return function(_0x4a06fc){if(_0x4a06fc){return _0x5c7958[_0xfc8b('0x1e')](_0x78eb76);}return _0x5c7958[_0xfc8b('0x1f')](_0x78eb76)[_0xfc8b('0x20')]();};}function respondWithResult(_0x1a32a0,_0x4bfee8){_0x4bfee8=_0x4bfee8||0xc8;return function(_0xdc5cd){if(_0xdc5cd){return _0x1a32a0[_0xfc8b('0x1f')](_0x4bfee8)['json'](_0xdc5cd);}};}function respondWithFilteredResult(_0x33a944,_0x3e4bc5){return function(_0x665416){if(_0x665416){var _0x49a80f=_0x665416[_0xfc8b('0x21')],_0x1957df=_0x3e4bc5[_0xfc8b('0x22')],_0x3ef7c5=_0x3e4bc5[_0xfc8b('0x22')]+_0x3e4bc5[_0xfc8b('0x23')],_0x56f1ee;if(_0x3ef7c5>=_0x49a80f){_0x3ef7c5=_0x49a80f;_0x56f1ee=0xc8;}else{_0x56f1ee=0xce;}_0x33a944[_0xfc8b('0x1f')](_0x56f1ee);return _0x33a944['set']('Content-Range',_0x1957df+'-'+_0x3ef7c5+'/'+_0x49a80f)[_0xfc8b('0x24')](_0x665416);}return null;};}function patchUpdates(_0x348b06){return function(_0x3e0998){try{jsonpatch[_0xfc8b('0x25')](_0x3e0998,_0x348b06,!![]);}catch(_0x349999){return BPromise[_0xfc8b('0x26')](_0x349999);}return _0x3e0998[_0xfc8b('0x27')]();};}function saveUpdates(_0x3ad123,_0x50ac51){return function(_0x4a7efe){if(_0x4a7efe){return _0x4a7efe[_0xfc8b('0x28')](_0x3ad123)['then'](function(_0x9ca658){return _0x9ca658;});}return null;};}function removeEntity(_0x416f04,_0x38add3){return function(_0x5cd101){if(_0x5cd101){return _0x5cd101[_0xfc8b('0x29')]()['then'](function(){_0x416f04['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x59b2bf,_0x5345ed){return function(_0x118153){if(!_0x118153){_0x59b2bf[_0xfc8b('0x1e')](0x194);}return _0x118153;};}function handleError(_0x44514c,_0x59c0dd){_0x59c0dd=_0x59c0dd||0x1f4;return function(_0x1cc011){logger[_0xfc8b('0x2a')](_0x1cc011[_0xfc8b('0x2b')]);if(_0x1cc011[_0xfc8b('0x2c')]){delete _0x1cc011['name'];}_0x44514c[_0xfc8b('0x1f')](_0x59c0dd)[_0xfc8b('0x2d')](_0x1cc011);};}function getInteractionUsers(_0x52b3ba,_0x346578){return new BPromise(function(_0x2f468c,_0x5837bb){try{if(_0x346578[_0x52b3ba['id']]){_0x52b3ba[_0xfc8b('0x2e')]=_[_0xfc8b('0x2f')](_0x346578[_0x52b3ba['id']],function(_0x4cf781){return{'id':_0x4cf781['id'],'fullname':_0x4cf781['fullname']};});}}catch(_0xf0d853){_0x5837bb(_0xf0d853);}_0x2f468c(_0x52b3ba);});}function getInteractionTags(_0x5821e0,_0x2912ba){return new BPromise(function(_0x28d045,_0x274f1d){try{if(_0x5821e0[_0xfc8b('0x30')]){_0x5821e0['Tags']=[];_0x5821e0[_0xfc8b('0x30')]['split'](',')[_0xfc8b('0x31')](function(_0xb55a29){_0x5821e0[_0xfc8b('0x32')][_0xfc8b('0x33')](_0x2912ba[_0xb55a29]);});}delete _0x5821e0[_0xfc8b('0x30')];}catch(_0x1cbb09){_0x274f1d(_0x1cbb09);}_0x28d045(_0x5821e0);});}function updateOpenchannelInteraction(_0x4dcd68,_0x51963a,_0x104a0b){return new BPromise(function(_0xc49e28,_0x47ec7d){return getInteractionUsers(_0x4dcd68,_0x104a0b)[_0xfc8b('0x34')](function(_0x5b62cf){return getInteractionTags(_0x5b62cf,_0x51963a);})[_0xfc8b('0x34')](function(_0x591030){_0xc49e28(_0x591030);})[_0xfc8b('0x35')](function(_0x11c972){_0x47ec7d(_0x11c972);});});}exports[_0xfc8b('0x36')]=function(_0x36f3a4,_0x174b9d){var _0x4759d7={},_0x5917dd={},_0x1a1623={'count':0x0,'rows':[]};var _0x5b5661=_[_0xfc8b('0x2f')](db[_0xfc8b('0x37')]['rawAttributes'],function(_0x162d39){return{'name':_0x162d39[_0xfc8b('0x38')],'type':_0x162d39[_0xfc8b('0x39')]['key']};});_0x5917dd['model']=_[_0xfc8b('0x2f')](_0x5b5661,_0xfc8b('0x2c'));_0x5917dd[_0xfc8b('0x3a')]=_['keys'](_0x36f3a4[_0xfc8b('0x3a')]);_0x5917dd[_0xfc8b('0x3b')]=_[_0xfc8b('0x3c')](_0x5917dd[_0xfc8b('0x3d')],_0x5917dd['query']);_0x4759d7[_0xfc8b('0x3e')]=_[_0xfc8b('0x3c')](_0x5917dd[_0xfc8b('0x3d')],qs[_0xfc8b('0x3f')](_0x36f3a4[_0xfc8b('0x3a')][_0xfc8b('0x3f')]));_0x4759d7['attributes']=_0x4759d7[_0xfc8b('0x3e')]['length']?_0x4759d7[_0xfc8b('0x3e')]:_0x5917dd[_0xfc8b('0x3d')];if(!_0x36f3a4[_0xfc8b('0x3a')]['hasOwnProperty'](_0xfc8b('0x40'))){_0x4759d7['limit']=qs[_0xfc8b('0x23')](_0x36f3a4[_0xfc8b('0x3a')][_0xfc8b('0x23')]);_0x4759d7[_0xfc8b('0x22')]=qs[_0xfc8b('0x22')](_0x36f3a4['query']['offset']);}_0x4759d7[_0xfc8b('0x41')]=qs[_0xfc8b('0x42')](_0x36f3a4[_0xfc8b('0x3a')][_0xfc8b('0x42')]);_0x4759d7[_0xfc8b('0x43')]=qs[_0xfc8b('0x3b')](_[_0xfc8b('0x44')](_0x36f3a4['query'],_0x5917dd[_0xfc8b('0x3b')]),_0x5b5661);var _0x5c9d7d=[];var _0x287b2c=squel[_0xfc8b('0x45')]()['field']('id')[_0xfc8b('0x46')](_0xfc8b('0x2c'))['field']('color')[_0xfc8b('0x47')](_0xfc8b('0x48'));var _0x4ce14b=squel['select']()[_0xfc8b('0x46')](_0xfc8b('0x49'))[_0xfc8b('0x46')](_0xfc8b('0x4a'))[_0xfc8b('0x46')](_0xfc8b('0x4b'))[_0xfc8b('0x47')](_0xfc8b('0x4c'),'ui')['left_join'](_0xfc8b('0x4d'),'u','u.id\x20=\x20ui.UserId');var _0x412245=squel[_0xfc8b('0x45')]()[_0xfc8b('0x47')](_0xfc8b('0x4e'),'i')[_0xfc8b('0x4f')]('cm_contacts','c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0xfc8b('0x4f')](_0xfc8b('0x4d'),'o',_0xfc8b('0x50'))[_0xfc8b('0x4f')]('openchannel_accounts','a',_0xfc8b('0x51'))['left_join'](_0xfc8b('0x52'),'me','me.OpenchannelInteractionId\x20=\x20i.id')[_0xfc8b('0x4f')](_0xfc8b('0x53'),'it',_0xfc8b('0x54'))[_0xfc8b('0x4f')](_0xfc8b('0x48'),'t',_0xfc8b('0x55'));var _0x310bbd=squel[_0xfc8b('0x56')]();var _0x542466=[];var _0x4aa1fa=squel[_0xfc8b('0x56')]();var _0x188c76;if(_0x36f3a4[_0xfc8b('0x3a')][_0xfc8b('0x57')]){_0x188c76=as[_0xfc8b('0x58')](_0x36f3a4[_0xfc8b('0x3a')][_0xfc8b('0x57')]);var _0x6290cd=_0x188c76['sqlOperator'];for(var _0x20fc8b=0x0;_0x20fc8b<_0x188c76['conditions'][_0xfc8b('0x59')];_0x20fc8b++){var _0x235ecd=_0x188c76[_0xfc8b('0x5a')][_0x20fc8b];var _0x4acbb7='i';var _0x23c923=_['find'](_0x5b5661,[_0xfc8b('0x2c'),_0x235ecd[_0xfc8b('0x46')]]);if(!_0x23c923){switch(_0x235ecd['field']){case'unreadMessages':if(_0x235ecd[_0xfc8b('0x5b')]==0x1){_0x412245[_0xfc8b('0x5c')]('`'+_0x235ecd['field']+_0xfc8b('0x5d'));}else{_0x412245['having']('`'+_0x235ecd[_0xfc8b('0x46')]+_0xfc8b('0x5e'));}break;case _0xfc8b('0x5f'):if(_0x235ecd['operator']===_0xfc8b('0x60')){if(_0x235ecd['value'][_0xfc8b('0x61')]('\x20')[_0xfc8b('0x59')]>0x1){_0x310bbd[_0x6290cd]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xfc8b('0x62')](_0x235ecd[_0xfc8b('0x5b')]),null);}else{var _0x2c5dfc='%'+_0x235ecd['value']+'%';_0x310bbd[_0x6290cd](_0xfc8b('0x63'),_0x2c5dfc,_0x2c5dfc,_0x2c5dfc);}}else{_0x23c923=_[_0xfc8b('0x64')](_0x5b5661,['name',_0xfc8b('0x65')]);_0x235ecd['field']='ContactId';_0x166fa9=as[_0xfc8b('0x66')](_0x4acbb7,_0x23c923['type'],_0x235ecd);_0x310bbd[_0x6290cd](_0x166fa9[_0xfc8b('0x67')],_0x166fa9[_0xfc8b('0x5b')][_0xfc8b('0x68')],_0x166fa9[_0xfc8b('0x5b')][_0xfc8b('0x20')]);}break;case'Tag':var _0x131931=_0x235ecd[_0xfc8b('0x5b')][_0xfc8b('0x61')](',')[_0xfc8b('0x2f')](function(_0x2bdbf2){return Number(_0x2bdbf2);});_0x131931[_0xfc8b('0x31')](function(_0x342612){_0x4aa1fa['or'](_0xfc8b('0x69'),'%,'+_0x342612+',%');});_0x542466=_[_0xfc8b('0x6a')](_0x542466,_0x131931);break;case _0xfc8b('0x6b'):if(_0x235ecd[_0xfc8b('0x6c')]===_0xfc8b('0x60')){_0x310bbd[_0x6290cd](_0xfc8b('0x6d'),'%'+_0x235ecd[_0xfc8b('0x5b')]+'%',null);}else{_0x23c923=_[_0xfc8b('0x64')](_0x5b5661,[_0xfc8b('0x2c'),_0xfc8b('0x6e')]);_0x235ecd[_0xfc8b('0x46')]='UserId';_0x166fa9=as[_0xfc8b('0x66')](_0x4acbb7,_0x23c923[_0xfc8b('0x39')],_0x235ecd);_0x310bbd[_0x6290cd](_0x166fa9['text'],_0x166fa9[_0xfc8b('0x5b')][_0xfc8b('0x68')],_0x166fa9[_0xfc8b('0x5b')][_0xfc8b('0x20')]);}break;case'body':_0x166fa9=as[_0xfc8b('0x66')]('me',null,_0x235ecd);_0x310bbd[_0x6290cd](_0x166fa9[_0xfc8b('0x67')],_0x166fa9['value'][_0xfc8b('0x68')],_0x166fa9[_0xfc8b('0x5b')]['end']);break;}}else{var _0x166fa9=as[_0xfc8b('0x66')](_0x4acbb7,_0x23c923[_0xfc8b('0x39')],_0x235ecd);_0x310bbd[_0x6290cd](_0x166fa9['text'],_0x166fa9[_0xfc8b('0x5b')][_0xfc8b('0x68')],_0x166fa9[_0xfc8b('0x5b')]['end']);}}}else{var _0x4fccda=_(_0x36f3a4[_0xfc8b('0x3a')])[_0xfc8b('0x6f')]()[_0xfc8b('0x2f')](function(_0x4fd995){return _[_0xfc8b('0x70')](_0x5b5661,['name',_0x4fd995])?_0x4fd995:undefined;})['compact']()[_0xfc8b('0x5b')]();if(!_[_0xfc8b('0x71')](_0x4fccda)){_0x4fccda[_0xfc8b('0x31')](function(_0x159a3b){if(_0x159a3b==='OpenchannelAccountId'){_0x412245['where'](_0xfc8b('0x72'),[][_0xfc8b('0x73')](_0x36f3a4['query'][_0x159a3b]));}else if(_0x159a3b===_0xfc8b('0x74')){var _0x3e0a0e=JSON[_0xfc8b('0x75')](_0x36f3a4[_0xfc8b('0x3a')][_0x159a3b])['$gte'];var _0x2a673e=JSON[_0xfc8b('0x75')](_0x36f3a4[_0xfc8b('0x3a')][_0x159a3b])[_0xfc8b('0x76')];_0x412245['where'](_0xfc8b('0x77'),_0x3e0a0e,_0x2a673e);}else{if(_0x36f3a4[_0xfc8b('0x3a')][_0x159a3b]===_0xfc8b('0x78')){_0x412245[_0xfc8b('0x43')]('i.'+_0x159a3b+'\x20IS\x20NULL');}else{_0x412245['where']('i.'+_0x159a3b+_0xfc8b('0x79'),_0x36f3a4[_0xfc8b('0x3a')][_0x159a3b]);}}});}if(_0x36f3a4[_0xfc8b('0x3a')][_0xfc8b('0x7a')]){if(_0x36f3a4[_0xfc8b('0x3a')][_0xfc8b('0x7a')]==0x1){_0x412245[_0xfc8b('0x5c')](_0xfc8b('0x7b'));}else{_0x412245[_0xfc8b('0x5c')](_0xfc8b('0x7c'));}}if(_0x36f3a4[_0xfc8b('0x3a')][_0xfc8b('0x7d')]){_0x542466=_[_0xfc8b('0x7e')](_0x36f3a4[_0xfc8b('0x3a')][_0xfc8b('0x7d')])?_0x36f3a4[_0xfc8b('0x3a')][_0xfc8b('0x7d')]:new Array(_0x36f3a4[_0xfc8b('0x3a')][_0xfc8b('0x7d')]);_0x542466[_0xfc8b('0x31')](function(_0x598ea8){_0x4aa1fa['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x598ea8+',%');});}if(_0x36f3a4[_0xfc8b('0x3a')][_0xfc8b('0x7f')]){var _0x47410d=_0x36f3a4['query'][_0xfc8b('0x7f')][_0xfc8b('0x80')]('\x5c','\x5c\x5c')[_0xfc8b('0x80')]('\x27\x27',_0xfc8b('0x81'));if(qs['isNumeric'](_0x47410d)){_0x310bbd['or'](_0xfc8b('0x82'),_0x47410d+'%');}else{_0x310bbd['or'](_0xfc8b('0x83'),qs['getFullTextValue'](_0x47410d))['or']('i.from\x20LIKE\x20?',_0x47410d+'%')['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x47410d+'%');}}}_0x412245[_0xfc8b('0x43')](_0x310bbd);_0x412245[_0xfc8b('0x84')](_0xfc8b('0x85'));var _0x73ea7={'type':db[_0xfc8b('0x86')][_0xfc8b('0x87')][_0xfc8b('0x88')],'raw':!![]};var _0x594269=_0x412245[_0xfc8b('0x89')]();_0x594269['field'](_0xfc8b('0x85'));_0x594269[_0xfc8b('0x46')](_0xfc8b('0x8a'),_0xfc8b('0x8b'));if(_0x4759d7[_0xfc8b('0x41')]){_0x4759d7['order'][_0xfc8b('0x31')](function(_0x2d0910){_0x412245[_0xfc8b('0x41')]('i.'+_0x2d0910[0x0],_0x2d0910[0x1]===_0xfc8b('0x8c')?![]:!![]);});}if(!_[_0xfc8b('0x71')](_0x542466)){_0x412245[_0xfc8b('0x5c')](_0x4aa1fa);_0x594269[_0xfc8b('0x43')](_0xfc8b('0x8d'),_0x542466);}BPromise[_0xfc8b('0x8e')]()[_0xfc8b('0x34')](function(){if(!_0x188c76){if(_0x36f3a4[_0xfc8b('0x3a')][_0xfc8b('0x8f')]||_0x36f3a4[_0xfc8b('0x3a')][_0xfc8b('0x90')])return;_0x594269[_0xfc8b('0x43')](_0xfc8b('0x91'));_0x412245[_0xfc8b('0x43')](_0xfc8b('0x91'));return;}return _0x36f3a4['user']['getOpenchannelAccounts']({'attributes':['id'],'raw':!![]})[_0xfc8b('0x34')](function(_0x58b0a8){if(_[_0xfc8b('0x71')](_0x58b0a8)){_0x594269[_0xfc8b('0x43')](_0xfc8b('0x92'));_0x412245[_0xfc8b('0x43')](_0xfc8b('0x92'));}else{_0x594269['where'](_0xfc8b('0x72'),_[_0xfc8b('0x2f')](_0x58b0a8,'id'));_0x412245[_0xfc8b('0x43')](_0xfc8b('0x72'),_[_0xfc8b('0x2f')](_0x58b0a8,'id'));}});})['then'](function(){db[_0xfc8b('0x93')]['query'](_0x594269[_0xfc8b('0x94')](),_0x73ea7)['then'](function(_0x1bac78){_0x1a1623[_0xfc8b('0x21')]=_0x1bac78[_0xfc8b('0x59')];if(_0x1a1623[_0xfc8b('0x21')]===0x0)return[];return db[_0xfc8b('0x93')][_0xfc8b('0x3a')](_0x287b2c['toString'](),_0x73ea7)[_0xfc8b('0x34')](function(_0x56441c){_0x5c9d7d=_['keyBy'](_0x56441c,'id');_0x73ea7=_[_0xfc8b('0x95')](_0x73ea7,{'model':db['OpenchannelInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x36f3a4[_0xfc8b('0x3a')][_0xfc8b('0x3f')]){_0x4759d7['attributes']['forEach'](function(_0x44e0f3){_0x412245[_0xfc8b('0x46')]('i.'+_0x44e0f3);});}else{_0x412245[_0xfc8b('0x46')](_0xfc8b('0x8a'),_0xfc8b('0x8b'));_0x412245[_0xfc8b('0x46')]('a.key',_0xfc8b('0x96'));_0x412245[_0xfc8b('0x46')](_0xfc8b('0x97'),'Account.mandatoryDisposition');_0x412245[_0xfc8b('0x46')](_0xfc8b('0x98'));_0x412245['field'](_0xfc8b('0x99'),_0xfc8b('0x9a'));_0x412245[_0xfc8b('0x46')]('c.lastName',_0xfc8b('0x9b'));_0x412245[_0xfc8b('0x46')]('c.email',_0xfc8b('0x9c'));_0x412245[_0xfc8b('0x46')](_0xfc8b('0x9d'),_0xfc8b('0x9e'));_0x412245[_0xfc8b('0x46')](_0xfc8b('0x9f'),_0xfc8b('0xa0'));_0x412245['field'](_0xfc8b('0xa1'),'Contact.fax');_0x412245['field'](_0xfc8b('0xa2'),'Owner.fullname');_0x412245[_0xfc8b('0x46')](_0xfc8b('0xa3'),_0xfc8b('0xa4'));_0x412245['field'](_0xfc8b('0xa5'),_0xfc8b('0x30'));}if(_0x4759d7['limit'])_0x412245['limit'](_0x4759d7[_0xfc8b('0x23')]);if(_0x4759d7[_0xfc8b('0x22')])_0x412245['offset'](_0x4759d7[_0xfc8b('0x22')]);return db[_0xfc8b('0x93')][_0xfc8b('0x3a')](_0x412245[_0xfc8b('0x94')](),_0x73ea7);})[_0xfc8b('0x34')](function(_0x3226ba){_0x4ce14b['where'](_0xfc8b('0xa6'),_['map'](_0x3226ba,'id'));return db['sequelize'][_0xfc8b('0x3a')](_0x4ce14b['toString'](),_0x73ea7)[_0xfc8b('0x34')](function(_0x3527d9){var _0x2434cd=_[_0xfc8b('0xa7')](_0x3527d9,_0xfc8b('0xa8'));var _0x1e1d14=[];_0x3226ba[_0xfc8b('0x31')](function(_0x388e0f){_0x1e1d14[_0xfc8b('0x33')](updateOpenchannelInteraction(_0x388e0f,_0x5c9d7d,_0x2434cd));});return BPromise[_0xfc8b('0xa9')](_0x1e1d14);});});})['then'](function(_0x4eeb9e){_0x1a1623[_0xfc8b('0xaa')]=_0x4eeb9e;return _0x1a1623;})[_0xfc8b('0x34')](respondWithFilteredResult(_0x174b9d,_0x4759d7));})[_0xfc8b('0x35')](handleError(_0x174b9d,null));};exports[_0xfc8b('0xab')]=function(_0x5d0039,_0x35f54b){var _0x4314ed={'raw':![],'where':{'id':_0x5d0039[_0xfc8b('0xac')]['id']}},_0x59673={};_0x59673['model']=_['keys'](db['OpenchannelInteraction']['rawAttributes']);_0x59673[_0xfc8b('0x3a')]=_[_0xfc8b('0x6f')](_0x5d0039[_0xfc8b('0x3a')]);_0x59673[_0xfc8b('0x3b')]=_[_0xfc8b('0x3c')](_0x59673[_0xfc8b('0x3d')],_0x59673[_0xfc8b('0x3a')]);_0x4314ed['attributes']=_[_0xfc8b('0x3c')](_0x59673['model'],qs[_0xfc8b('0x3f')](_0x5d0039[_0xfc8b('0x3a')]['fields']));_0x4314ed[_0xfc8b('0x3e')]=_0x4314ed[_0xfc8b('0x3e')][_0xfc8b('0x59')]?_0x4314ed[_0xfc8b('0x3e')]:_0x59673['model'];if(_0x5d0039[_0xfc8b('0x3a')][_0xfc8b('0xad')]){_0x4314ed[_0xfc8b('0xae')]=[{'all':!![]}];}_0x4314ed=_[_0xfc8b('0x95')]({},_0x4314ed,_0x5d0039[_0xfc8b('0xaf')]);return db[_0xfc8b('0x37')][_0xfc8b('0x64')](_0x4314ed)['then'](handleEntityNotFound(_0x35f54b,null))[_0xfc8b('0x34')](respondWithResult(_0x35f54b,null))['catch'](handleError(_0x35f54b,null));};exports['create']=function(_0x57dd3e,_0x14e86d){return db['OpenchannelInteraction'][_0xfc8b('0xb0')](_0x57dd3e[_0xfc8b('0xb1')],{})[_0xfc8b('0x34')](respondWithResult(_0x14e86d,0xc9))['catch'](handleError(_0x14e86d,null));};exports['update']=function(_0x19fb10,_0x47875f){if(_0x19fb10[_0xfc8b('0xb1')]['id']){delete _0x19fb10[_0xfc8b('0xb1')]['id'];}return db[_0xfc8b('0x37')][_0xfc8b('0x64')]({'where':{'id':_0x19fb10[_0xfc8b('0xac')]['id']}})[_0xfc8b('0x34')](handleEntityNotFound(_0x47875f,null))[_0xfc8b('0x34')](saveUpdates(_0x19fb10[_0xfc8b('0xb1')],null))[_0xfc8b('0x34')](respondWithResult(_0x47875f,null))['catch'](handleError(_0x47875f,null));};exports['destroy']=function(_0x561d5f,_0x1b65b4){return db[_0xfc8b('0x37')][_0xfc8b('0x64')]({'where':{'id':_0x561d5f[_0xfc8b('0xac')]['id']}})[_0xfc8b('0x34')](handleEntityNotFound(_0x1b65b4,null))[_0xfc8b('0x34')](removeEntity(_0x1b65b4,null))[_0xfc8b('0x35')](handleError(_0x1b65b4,null));};exports[_0xfc8b('0xb2')]=function(_0x414195,_0x1cc56f){return db['OpenchannelInteraction'][_0xfc8b('0xb2')]()[_0xfc8b('0x34')](respondWithResult(_0x1cc56f,null))[_0xfc8b('0x35')](handleError(_0x1cc56f,null));};exports[_0xfc8b('0xb3')]=function(_0x51f8d4,_0x5d2288,_0x3688ec){return db[_0xfc8b('0xb4')]['find']({'where':{'id':_0x51f8d4[_0xfc8b('0xac')]['id']}})[_0xfc8b('0x34')](handleEntityNotFound(_0x5d2288,null))[_0xfc8b('0x34')](function(_0x39bc7c){if(_0x39bc7c){return _0x39bc7c[_0xfc8b('0xb3')](_0x51f8d4[_0xfc8b('0xb1')][_0xfc8b('0xb5')],_[_0xfc8b('0xb6')](_0x51f8d4[_0xfc8b('0xb1')],['ids','id'])||{});}})['then'](respondWithResult(_0x5d2288,null))[_0xfc8b('0x35')](handleError(_0x5d2288,null));};exports[_0xfc8b('0xb7')]=function(_0x468ea5,_0x3de772,_0xe3ca63){var _0x161680={'raw':![],'where':{}};var _0x37e80f={};var _0x1a7387={'count':0x0,'rows':[]};return db['OpenchannelInteraction']['findOne']({'where':{'id':_0x468ea5[_0xfc8b('0xac')]['id']}})['then'](handleEntityNotFound(_0x3de772,null))[_0xfc8b('0x34')](function(_0x331f24){if(_0x331f24){_0x37e80f[_0xfc8b('0x3d')]=_[_0xfc8b('0x6f')](db[_0xfc8b('0xb4')][_0xfc8b('0xb8')]);_0x37e80f[_0xfc8b('0x3a')]=_[_0xfc8b('0x6f')](_0x468ea5[_0xfc8b('0x3a')]);_0x37e80f['filters']=_[_0xfc8b('0x3c')](_0x37e80f[_0xfc8b('0x3d')],_0x37e80f['query']);_0x161680['attributes']=_[_0xfc8b('0x3c')](_0x37e80f[_0xfc8b('0x3d')],qs[_0xfc8b('0x3f')](_0x468ea5[_0xfc8b('0x3a')][_0xfc8b('0x3f')]));_0x161680[_0xfc8b('0x3e')]=_0x161680[_0xfc8b('0x3e')][_0xfc8b('0x59')]?_0x161680['attributes']:_0x37e80f[_0xfc8b('0x3d')];if(!_0x468ea5['query'][_0xfc8b('0xb9')](_0xfc8b('0x40'))){_0x161680[_0xfc8b('0x23')]=qs[_0xfc8b('0x23')](_0x468ea5['query']['limit']);_0x161680['offset']=qs[_0xfc8b('0x22')](_0x468ea5[_0xfc8b('0x3a')][_0xfc8b('0x22')]);}_0x161680[_0xfc8b('0x41')]=qs[_0xfc8b('0x42')](_0x468ea5[_0xfc8b('0x3a')]['sort']);_0x161680[_0xfc8b('0x43')]=qs[_0xfc8b('0x3b')](_[_0xfc8b('0x44')](_0x468ea5['query'],_0x37e80f[_0xfc8b('0x3b')]));_0x161680['where'][_0xfc8b('0xa8')]=_0x331f24['id'];if(_0x468ea5[_0xfc8b('0x3a')][_0xfc8b('0x7f')]){_0x161680[_0xfc8b('0x43')]=_['merge'](_0x161680[_0xfc8b('0x43')],{'$or':_[_0xfc8b('0x2f')](_0x161680[_0xfc8b('0x3e')],function(_0x21d074){var _0x505568={};_0x505568[_0x21d074]={'$like':'%'+_0x468ea5[_0xfc8b('0x3a')][_0xfc8b('0x7f')]+'%'};return _0x505568;})});}if(_0x468ea5[_0xfc8b('0x3a')][_0xfc8b('0xba')]){var _0x22879a=_0x468ea5[_0xfc8b('0x3a')]['$gte'][_0xfc8b('0x61')](',');var _0x63245={};_0x63245[_0x22879a[0x0]]={'$gte':moment(_0x22879a[0x1])[_0xfc8b('0xbb')]('YYYY-MM-DD\x20HH:mm:ss')};_0x161680[_0xfc8b('0x43')]=_[_0xfc8b('0x95')](_0x161680[_0xfc8b('0x43')],_0x63245);}_0x161680=_['merge']({},_0x161680,_0x468ea5[_0xfc8b('0xaf')]);return db[_0xfc8b('0xb4')][_0xfc8b('0x21')]({'where':_0x161680['where']})[_0xfc8b('0x34')](function(_0x2a7f7b){_0x1a7387[_0xfc8b('0x21')]=_0x2a7f7b;if(_0x468ea5['query'][_0xfc8b('0xad')]){_0x161680['include']=[{'all':!![]}];}return db[_0xfc8b('0xb4')]['findAll'](_0x161680);})[_0xfc8b('0x34')](function(_0x4c92bc){_0x1a7387[_0xfc8b('0xaa')]=_0x4c92bc;return _0x1a7387;});}})[_0xfc8b('0x34')](respondWithFilteredResult(_0x3de772,_0x161680))['catch'](handleError(_0x3de772,null));};exports['addTags']=function(_0x37a171,_0x245dfb,_0x3e4e54){return db[_0xfc8b('0x37')]['find']({'where':{'id':_0x37a171[_0xfc8b('0xac')]['id']}})[_0xfc8b('0x34')](handleEntityNotFound(_0x245dfb,null))[_0xfc8b('0x34')](function(_0x38984e){if(_0x38984e){return _0x38984e[_0xfc8b('0xbc')](_0x37a171[_0xfc8b('0xb1')][_0xfc8b('0xb5')],_[_0xfc8b('0xb6')](_0x37a171[_0xfc8b('0xb1')],[_0xfc8b('0xb5'),'id'])||{})[_0xfc8b('0xbd')](function(){return db[_0xfc8b('0xbe')][_0xfc8b('0xbf')]({'attributes':['id',_0xfc8b('0x2c'),_0xfc8b('0xc0')],'where':{'id':_0x37a171[_0xfc8b('0xb1')][_0xfc8b('0xb5')]}});})[_0xfc8b('0x34')](function(_0x26abc1){socket['emit']('openchannelInteractionTags:save',{'id':Number(_0x37a171[_0xfc8b('0xac')]['id']),'tags':_0x26abc1||[]});return{'id':Number(_0x37a171['params']['id']),'tags':_0x26abc1||[]};});}})['then'](respondWithResult(_0x245dfb,null))[_0xfc8b('0x35')](handleError(_0x245dfb,null));};exports[_0xfc8b('0xc1')]=function(_0x430d74,_0x35299f,_0x56c32d){return db[_0xfc8b('0x37')][_0xfc8b('0x64')]({'where':{'id':_0x430d74[_0xfc8b('0xac')]['id']}})[_0xfc8b('0x34')](handleEntityNotFound(_0x35299f,null))[_0xfc8b('0x34')](function(_0x4ad6fb){if(_0x4ad6fb){return _0x4ad6fb[_0xfc8b('0xc1')](_0x430d74[_0xfc8b('0x3a')]['ids']);}})[_0xfc8b('0x34')](respondWithStatusCode(_0x35299f,null))[_0xfc8b('0x35')](handleError(_0x35299f,null));};exports[_0xfc8b('0xc2')]=function(_0x5b0d66,_0x151046){var _0x234862=moment()[_0xfc8b('0xc3')]()[_0xfc8b('0x94')]();var _0x3359ca=path['join'](config['root'],_0xfc8b('0xc4'),_0xfc8b('0xc5'),_0xfc8b('0xc6'));var _0x3c2fe7=path[_0xfc8b('0xc7')](config[_0xfc8b('0xc8')],_0xfc8b('0xc4'),_0xfc8b('0xc5'),_0xfc8b('0xc9'));var _0x4ae600=path[_0xfc8b('0xc7')](_0x3359ca,_0x234862);var _0x275122=util[_0xfc8b('0xbb')](_0xfc8b('0xca'),_0x5b0d66[_0xfc8b('0xac')]['id'],_0x234862);var _0xb09b9d=path['join'](_0x3359ca,_0x275122);var _0x582bb2=[];_0x582bb2[_0xfc8b('0x33')]({'model':db[_0xfc8b('0x6b')],'as':'User','attributes':['id',_0xfc8b('0xcb')],'raw':!![]});_0x582bb2['push']({'model':db[_0xfc8b('0xcc')],'as':_0xfc8b('0x5f'),'attributes':['id','firstName',_0xfc8b('0xcd')],'raw':!![]});if(_0x5b0d66[_0xfc8b('0x3a')][_0xfc8b('0xc9')]){_0x582bb2[_0xfc8b('0x33')]({'model':db[_0xfc8b('0xce')],'as':'Attachment','raw':!![]});}var _0x27d99e=[{'model':db['OpenchannelMessage'],'as':'Messages','attributes':['id',_0xfc8b('0xb1'),'createdAt',_0xfc8b('0xcf'),_0xfc8b('0xd0'),_0xfc8b('0x7a')],'include':_0x582bb2}];_0x27d99e[_0xfc8b('0x33')]({'model':db['OpenchannelAccount'],'as':_0xfc8b('0xd1'),'attributes':['id',_0xfc8b('0x2c')]});_0x27d99e[_0xfc8b('0x33')]({'model':db[_0xfc8b('0x6b')],'as':_0xfc8b('0xd2'),'attributes':['id',_0xfc8b('0xcb')]});return db[_0xfc8b('0x37')][_0xfc8b('0x64')]({'where':{'id':_0x5b0d66[_0xfc8b('0xac')]['id']},'include':_0x27d99e})[_0xfc8b('0x34')](handleEntityNotFound(_0x151046,null))[_0xfc8b('0x34')](function(_0x16b5db){if(_0x16b5db){var _0x214948=_0x16b5db[_0xfc8b('0xd3')]({'plain':!![]});fs['mkdirSync'](_0x4ae600);var _0x11ca4f={'format':'A4','border':_0xfc8b('0xd4'),'header':{'height':_0xfc8b('0xd5'),'contents':{'first':_0xfc8b('0xd6')}},'footer':{'height':_0xfc8b('0xd7'),'contents':{'default':util[_0xfc8b('0xbb')](_0xfc8b('0xd8'),util[_0xfc8b('0xbb')](_0xfc8b('0xd9'),_0xfc8b('0xda'),_0x214948['id']),moment()['format']('YYYY-MM-DD')['toString']())}}};var _0xd5b9b6={'channel':_0xfc8b('0xda'),'account':_0x214948[_0xfc8b('0xd1')][_0xfc8b('0x2c')],'agent':_0x214948[_0xfc8b('0xd2')]?_0x214948[_0xfc8b('0xd2')][_0xfc8b('0xcb')]:_0xfc8b('0xdb'),'createdAt':moment(_0x214948[_0xfc8b('0x74')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0xfc8b('0x94')](),'closedAt':_0x214948['closed']?moment(_0x214948['closedAt'])['format'](_0xfc8b('0xdc'))[_0xfc8b('0x94')]():'','disposition':_0x214948[_0xfc8b('0xdd')],'visibility':_0x214948['threadId']?'Public':_0xfc8b('0xde'),'messages':_(_0x214948[_0xfc8b('0xdf')])[_0xfc8b('0x7f')]({'secret':![]})['map'](function(_0x291715){if(_0x291715['Attachment']){var _0x23a045=path['join'](_0x3c2fe7,_0x291715[_0xfc8b('0xce')][_0xfc8b('0xe0')]);if(fs['existsSync'](_0x23a045)){fs[_0xfc8b('0xe1')](_0x23a045)[_0xfc8b('0xe2')](fs[_0xfc8b('0xe3')](path[_0xfc8b('0xc7')](_0x4ae600,_0x291715[_0xfc8b('0xce')]['basename'])));}}return{'date':moment(_0x291715[_0xfc8b('0x74')])[_0xfc8b('0xbb')](_0xfc8b('0xdc'))['toString'](),'sender':_0x291715['direction']===_0xfc8b('0xe4')?_0x291715['User']?_0x291715[_0xfc8b('0x6b')][_0xfc8b('0xcb')]:_0xfc8b('0xe5'):_0x291715[_0xfc8b('0x5f')][_0xfc8b('0xe6')]+(_0x291715[_0xfc8b('0x5f')][_0xfc8b('0xcd')]?'\x20'+_0x291715['Contact'][_0xfc8b('0xcd')]:''),'body':_0x291715[_0xfc8b('0xce')]?_0x291715['Attachment']['basename']:_0x291715[_0xfc8b('0xb1')],'direction':_0x291715[_0xfc8b('0xcf')]===_0xfc8b('0xe4')?'A':'C','secret':_0x291715['secret'],'read':_0x291715['read'],'attachment':_0x291715[_0xfc8b('0xce')]};})[_0xfc8b('0x5b')]()};return ejs[_0xfc8b('0xe7')](path[_0xfc8b('0xc7')](config[_0xfc8b('0xc8')],'server',_0xfc8b('0xe8'),_0xfc8b('0xe9')),{'interaction':_0xd5b9b6})[_0xfc8b('0x34')](function(_0x3ac5a0){return new BPromise(function(_0x28edc6,_0x4ecb80){pdf[_0xfc8b('0xb0')](_0x3ac5a0,_0x11ca4f)[_0xfc8b('0xea')](path[_0xfc8b('0xc7')](_0x4ae600,'transcript-'+_0x214948['id']+'-'+_0x234862+_0xfc8b('0xeb')),function(_0xbc75b8,_0x125a6d){if(_0xbc75b8)return _0x4ecb80(_0xbc75b8);_0x28edc6(_0x125a6d);});});})[_0xfc8b('0x34')](function(){return new BPromise(function(_0x282685,_0x3cdad3){zipdir(_0x4ae600,{'saveTo':_0xb09b9d},function(_0x50f694,_0x301fd1){if(_0x50f694)return _0x3cdad3(_0x50f694);return _0x282685(_0x301fd1);});})[_0xfc8b('0x34')](function(){return new BPromise(function(_0x3ccca6,_0xfa5c60){rimraf(_0x4ae600,function(_0x53e55e){if(_0x53e55e)_0xfa5c60(_0x53e55e);return _0x3ccca6();});});})[_0xfc8b('0x34')](function(){return _0x151046[_0xfc8b('0xc2')](_0xb09b9d,_0x275122,function(_0x44ce64){if(_0x44ce64){console['log']('err',_0x44ce64);}else{fs['unlinkSync'](_0xb09b9d);}});});});}else{return _0x151046['sendStatus'](0xc8);}})[_0xfc8b('0x35')](handleError(_0x151046,null));}; \ No newline at end of file +var _0x2f76=['then','destroy','error','stack','name','send','map','fullname','TagIds','Tags','forEach','push','catch','OpenchannelInteraction','fieldName','type','key','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filters','select','field','color','from','tools_tags','ui.OpenchannelInteractionId','left_join','openchannel_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages','it.OpenchannelInteractionId\x20=\x20i.id','expr','search','parseSearch','sqlOperator','find','unreadMessages','having','`\x20=\x200','Contact','operator','$substring','value','split','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','OpenchannelAccountId','concat','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','replace','\x27\x27\x27\x27','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.from\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','order','DESC','isEmpty','t.id\x20IN\x20?','resolve','journey','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','i.OpenchannelAccountId\x20IS\x20NULL','i.OpenchannelAccountId\x20IN\x20?','toString','count','sequelize','keyBy','merge','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.lastName','Contact.email','c.phone','Contact.phone','c.fax','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','OpenchannelInteractionId','all','show','params','includeAll','options','create','describe','addMessage','omit','ids','getMessages','keys','OpenchannelMessage','format','YYYY-MM-DD\x20HH:mm:ss','include','findAll','rows','addTags','openchannelInteractionTags:save','removeTags','download','unix','join','server','root','files','attachments','transcript-%d-%s.zip','CmContact','lastName','Attachment','Messages','direction','secret','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','YYYY-MM-DD','N.A.','closed','closedAt','Public','createReadStream','pipe','basename','out','System','firstName','views','downloadInteraction.html','toFile','transcript-','.pdf','log','unlinkSync','sendStatus','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../mysqldb','redis','socket.io-emitter','./openchannelInteraction.socket','register','status','end','json','offset','set','apply','save','update'];(function(_0x1fd89d,_0x4836a1){var _0x53b608=function(_0x158bcb){while(--_0x158bcb){_0x1fd89d['push'](_0x1fd89d['shift']());}};_0x53b608(++_0x4836a1);}(_0x2f76,0x1a5));var _0x62f7=function(_0x375fe0,_0x1100e8){_0x375fe0=_0x375fe0-0x0;var _0x332562=_0x2f76[_0x375fe0];return _0x332562;};'use strict';var pdf=require(_0x62f7('0x0'));var emlformat=require(_0x62f7('0x1'));var rimraf=require(_0x62f7('0x2'));var zipdir=require(_0x62f7('0x3'));var jsonpatch=require(_0x62f7('0x4'));var rp=require(_0x62f7('0x5'));var moment=require('moment');var BPromise=require(_0x62f7('0x6'));var Mustache=require(_0x62f7('0x7'));var util=require('util');var path=require(_0x62f7('0x8'));var sox=require(_0x62f7('0x9'));var csv=require(_0x62f7('0xa'));var ejs=require(_0x62f7('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x62f7('0xc'));var crypto=require('crypto');var jsforce=require(_0x62f7('0xd'));var deskjs=require(_0x62f7('0xe'));var toCsv=require(_0x62f7('0xa'));var querystring=require(_0x62f7('0xf'));var Papa=require(_0x62f7('0x10'));var Redis=require('ioredis');var authService=require(_0x62f7('0x11'));var qs=require(_0x62f7('0x12'));var as=require(_0x62f7('0x13'));var hardwareService=require(_0x62f7('0x14'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x62f7('0x15'));var db=require(_0x62f7('0x16'))['db'];config[_0x62f7('0x17')]=_['defaults'](config[_0x62f7('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x62f7('0x18'))(new Redis(config[_0x62f7('0x17')]));require(_0x62f7('0x19'))[_0x62f7('0x1a')](socket);function respondWithStatusCode(_0x1b316a,_0x1ef223){_0x1ef223=_0x1ef223||0xcc;return function(_0x12d0a7){if(_0x12d0a7){return _0x1b316a['sendStatus'](_0x1ef223);}return _0x1b316a[_0x62f7('0x1b')](_0x1ef223)[_0x62f7('0x1c')]();};}function respondWithResult(_0x52cd76,_0x4f94b9){_0x4f94b9=_0x4f94b9||0xc8;return function(_0x32890e){if(_0x32890e){return _0x52cd76[_0x62f7('0x1b')](_0x4f94b9)[_0x62f7('0x1d')](_0x32890e);}};}function respondWithFilteredResult(_0x15df76,_0x3f38db){return function(_0x3faa77){if(_0x3faa77){var _0x175e53=_0x3faa77['count'],_0x86620d=_0x3f38db[_0x62f7('0x1e')],_0x59a9f6=_0x3f38db[_0x62f7('0x1e')]+_0x3f38db['limit'],_0x3c0dc5;if(_0x59a9f6>=_0x175e53){_0x59a9f6=_0x175e53;_0x3c0dc5=0xc8;}else{_0x3c0dc5=0xce;}_0x15df76[_0x62f7('0x1b')](_0x3c0dc5);return _0x15df76[_0x62f7('0x1f')]('Content-Range',_0x86620d+'-'+_0x59a9f6+'/'+_0x175e53)[_0x62f7('0x1d')](_0x3faa77);}return null;};}function patchUpdates(_0x5138f0){return function(_0x21274c){try{jsonpatch[_0x62f7('0x20')](_0x21274c,_0x5138f0,!![]);}catch(_0x593a1f){return BPromise['reject'](_0x593a1f);}return _0x21274c[_0x62f7('0x21')]();};}function saveUpdates(_0x2e78b8,_0x5ac0e2){return function(_0x15a6b4){if(_0x15a6b4){return _0x15a6b4[_0x62f7('0x22')](_0x2e78b8)[_0x62f7('0x23')](function(_0x230831){return _0x230831;});}return null;};}function removeEntity(_0x47643e,_0x1d4be2){return function(_0x40cc49){if(_0x40cc49){return _0x40cc49[_0x62f7('0x24')]()[_0x62f7('0x23')](function(){_0x47643e[_0x62f7('0x1b')](0xcc)[_0x62f7('0x1c')]();});}};}function handleEntityNotFound(_0x397519,_0x8e29ed){return function(_0xda2835){if(!_0xda2835){_0x397519['sendStatus'](0x194);}return _0xda2835;};}function handleError(_0x13e98d,_0x2515b2){_0x2515b2=_0x2515b2||0x1f4;return function(_0x5b6fb9){logger[_0x62f7('0x25')](_0x5b6fb9[_0x62f7('0x26')]);if(_0x5b6fb9[_0x62f7('0x27')]){delete _0x5b6fb9['name'];}_0x13e98d[_0x62f7('0x1b')](_0x2515b2)[_0x62f7('0x28')](_0x5b6fb9);};}function getInteractionUsers(_0xc1f5f,_0x3f70f6){return new BPromise(function(_0x181431,_0x486c7f){try{if(_0x3f70f6[_0xc1f5f['id']]){_0xc1f5f['Users']=_[_0x62f7('0x29')](_0x3f70f6[_0xc1f5f['id']],function(_0x2422c9){return{'id':_0x2422c9['id'],'fullname':_0x2422c9[_0x62f7('0x2a')]};});}}catch(_0x5b3cf3){_0x486c7f(_0x5b3cf3);}_0x181431(_0xc1f5f);});}function getInteractionTags(_0x23973a,_0x2538e6){return new BPromise(function(_0x437931,_0x4a590e){try{if(_0x23973a[_0x62f7('0x2b')]){_0x23973a[_0x62f7('0x2c')]=[];_0x23973a[_0x62f7('0x2b')]['split'](',')[_0x62f7('0x2d')](function(_0x4a19b3){_0x23973a[_0x62f7('0x2c')][_0x62f7('0x2e')](_0x2538e6[_0x4a19b3]);});}delete _0x23973a['TagIds'];}catch(_0x32a2ac){_0x4a590e(_0x32a2ac);}_0x437931(_0x23973a);});}function updateOpenchannelInteraction(_0x3e3c8e,_0x21dc42,_0x244dc5){return new BPromise(function(_0x3bfeff,_0x4388c3){return getInteractionUsers(_0x3e3c8e,_0x244dc5)['then'](function(_0x533ff7){return getInteractionTags(_0x533ff7,_0x21dc42);})[_0x62f7('0x23')](function(_0x30c98d){_0x3bfeff(_0x30c98d);})[_0x62f7('0x2f')](function(_0x8f2106){_0x4388c3(_0x8f2106);});});}exports['index']=function(_0x4a7600,_0x1dc41d){var _0x59db23={},_0x94146c={},_0x3fc417={'count':0x0,'rows':[]};var _0x53a326=_[_0x62f7('0x29')](db[_0x62f7('0x30')]['rawAttributes'],function(_0x1ac187){return{'name':_0x1ac187[_0x62f7('0x31')],'type':_0x1ac187[_0x62f7('0x32')][_0x62f7('0x33')]};});_0x94146c[_0x62f7('0x34')]=_[_0x62f7('0x29')](_0x53a326,_0x62f7('0x27'));_0x94146c[_0x62f7('0x35')]=_['keys'](_0x4a7600[_0x62f7('0x35')]);_0x94146c['filters']=_['intersection'](_0x94146c[_0x62f7('0x34')],_0x94146c[_0x62f7('0x35')]);_0x59db23[_0x62f7('0x36')]=_[_0x62f7('0x37')](_0x94146c[_0x62f7('0x34')],qs[_0x62f7('0x38')](_0x4a7600['query'][_0x62f7('0x38')]));_0x59db23[_0x62f7('0x36')]=_0x59db23[_0x62f7('0x36')][_0x62f7('0x39')]?_0x59db23[_0x62f7('0x36')]:_0x94146c[_0x62f7('0x34')];if(!_0x4a7600['query'][_0x62f7('0x3a')](_0x62f7('0x3b'))){_0x59db23['limit']=qs['limit'](_0x4a7600[_0x62f7('0x35')][_0x62f7('0x3c')]);_0x59db23[_0x62f7('0x1e')]=qs[_0x62f7('0x1e')](_0x4a7600[_0x62f7('0x35')]['offset']);}_0x59db23['order']=qs[_0x62f7('0x3d')](_0x4a7600[_0x62f7('0x35')][_0x62f7('0x3d')]);_0x59db23[_0x62f7('0x3e')]=qs['filters'](_[_0x62f7('0x3f')](_0x4a7600[_0x62f7('0x35')],_0x94146c[_0x62f7('0x40')]),_0x53a326);var _0x1f8820=[];var _0x462595=squel[_0x62f7('0x41')]()['field']('id')[_0x62f7('0x42')](_0x62f7('0x27'))[_0x62f7('0x42')](_0x62f7('0x43'))[_0x62f7('0x44')](_0x62f7('0x45'));var _0x5cd452=squel[_0x62f7('0x41')]()[_0x62f7('0x42')]('u.id')[_0x62f7('0x42')]('u.fullname')[_0x62f7('0x42')](_0x62f7('0x46'))[_0x62f7('0x44')]('user_has_openchannel_interactions','ui')[_0x62f7('0x47')]('users','u','u.id\x20=\x20ui.UserId');var _0x1db780=squel[_0x62f7('0x41')]()[_0x62f7('0x44')](_0x62f7('0x48'),'i')[_0x62f7('0x47')](_0x62f7('0x49'),'c',_0x62f7('0x4a'))[_0x62f7('0x47')](_0x62f7('0x4b'),'o','o.id\x20=\x20i.UserId')[_0x62f7('0x47')](_0x62f7('0x4c'),'a',_0x62f7('0x4d'))[_0x62f7('0x47')](_0x62f7('0x4e'),'me','me.OpenchannelInteractionId\x20=\x20i.id')[_0x62f7('0x47')]('openchannel_interaction_has_tags','it',_0x62f7('0x4f'))[_0x62f7('0x47')](_0x62f7('0x45'),'t','t.id\x20=\x20it.TagId');var _0x201acd=squel[_0x62f7('0x50')]();var _0x189d8a=[];var _0x39f95d=squel[_0x62f7('0x50')]();var _0x4075ac;if(_0x4a7600[_0x62f7('0x35')][_0x62f7('0x51')]){_0x4075ac=as[_0x62f7('0x52')](_0x4a7600[_0x62f7('0x35')]['search']);var _0x26d849=_0x4075ac[_0x62f7('0x53')];for(var _0x3d3a41=0x0;_0x3d3a41<_0x4075ac['conditions'][_0x62f7('0x39')];_0x3d3a41++){var _0x3410dd=_0x4075ac['conditions'][_0x3d3a41];var _0x7eff6c='i';var _0x5f2c41=_[_0x62f7('0x54')](_0x53a326,[_0x62f7('0x27'),_0x3410dd['field']]);if(!_0x5f2c41){switch(_0x3410dd['field']){case _0x62f7('0x55'):if(_0x3410dd['value']==0x1){_0x1db780[_0x62f7('0x56')]('`'+_0x3410dd[_0x62f7('0x42')]+_0x62f7('0x57'));}else{_0x1db780[_0x62f7('0x56')]('`'+_0x3410dd['field']+'`\x20>\x200');}break;case _0x62f7('0x58'):if(_0x3410dd[_0x62f7('0x59')]===_0x62f7('0x5a')){if(_0x3410dd[_0x62f7('0x5b')][_0x62f7('0x5c')]('\x20')[_0x62f7('0x39')]>0x1){_0x201acd[_0x26d849]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x3410dd[_0x62f7('0x5b')]),null);}else{var _0x282793='%'+_0x3410dd[_0x62f7('0x5b')]+'%';_0x201acd[_0x26d849](_0x62f7('0x5d'),_0x282793,_0x282793,_0x282793);}}else{_0x5f2c41=_[_0x62f7('0x54')](_0x53a326,[_0x62f7('0x27'),_0x62f7('0x5e')]);_0x3410dd[_0x62f7('0x42')]=_0x62f7('0x5e');_0x2840e5=as['buildExpression'](_0x7eff6c,_0x5f2c41[_0x62f7('0x32')],_0x3410dd);_0x201acd[_0x26d849](_0x2840e5[_0x62f7('0x5f')],_0x2840e5[_0x62f7('0x5b')][_0x62f7('0x60')],_0x2840e5[_0x62f7('0x5b')]['end']);}break;case _0x62f7('0x61'):var _0x2b7716=_0x3410dd['value'][_0x62f7('0x5c')](',')[_0x62f7('0x29')](function(_0x516b39){return Number(_0x516b39);});_0x2b7716['forEach'](function(_0x591a84){_0x39f95d['or'](_0x62f7('0x62'),'%,'+_0x591a84+',%');});_0x189d8a=_[_0x62f7('0x63')](_0x189d8a,_0x2b7716);break;case _0x62f7('0x64'):if(_0x3410dd[_0x62f7('0x59')]===_0x62f7('0x5a')){_0x201acd[_0x26d849](_0x62f7('0x65'),'%'+_0x3410dd['value']+'%',null);}else{_0x5f2c41=_['find'](_0x53a326,['name','UserId']);_0x3410dd['field']=_0x62f7('0x66');_0x2840e5=as[_0x62f7('0x67')](_0x7eff6c,_0x5f2c41[_0x62f7('0x32')],_0x3410dd);_0x201acd[_0x26d849](_0x2840e5[_0x62f7('0x5f')],_0x2840e5[_0x62f7('0x5b')][_0x62f7('0x60')],_0x2840e5[_0x62f7('0x5b')][_0x62f7('0x1c')]);}break;case _0x62f7('0x68'):_0x2840e5=as[_0x62f7('0x67')]('me',null,_0x3410dd);_0x201acd[_0x26d849](_0x2840e5[_0x62f7('0x5f')],_0x2840e5[_0x62f7('0x5b')][_0x62f7('0x60')],_0x2840e5['value'][_0x62f7('0x1c')]);break;}}else{var _0x2840e5=as['buildExpression'](_0x7eff6c,_0x5f2c41['type'],_0x3410dd);_0x201acd[_0x26d849](_0x2840e5['text'],_0x2840e5[_0x62f7('0x5b')][_0x62f7('0x60')],_0x2840e5['value'][_0x62f7('0x1c')]);}}}else{var _0x3b71bf=_(_0x4a7600[_0x62f7('0x35')])['keys']()[_0x62f7('0x29')](function(_0x9833cd){return _[_0x62f7('0x69')](_0x53a326,['name',_0x9833cd])?_0x9833cd:undefined;})['compact']()['value']();if(!_['isEmpty'](_0x3b71bf)){_0x3b71bf[_0x62f7('0x2d')](function(_0x4eeeb3){if(_0x4eeeb3===_0x62f7('0x6a')){_0x1db780[_0x62f7('0x3e')]('i.OpenchannelAccountId\x20IN\x20?',[][_0x62f7('0x6b')](_0x4a7600['query'][_0x4eeeb3]));}else if(_0x4eeeb3===_0x62f7('0x6c')){var _0x783158=JSON[_0x62f7('0x6d')](_0x4a7600[_0x62f7('0x35')][_0x4eeeb3])[_0x62f7('0x6e')];var _0x5f3bab=JSON['parse'](_0x4a7600[_0x62f7('0x35')][_0x4eeeb3])['$lte'];_0x1db780[_0x62f7('0x3e')](_0x62f7('0x6f'),_0x783158,_0x5f3bab);}else{if(_0x4a7600[_0x62f7('0x35')][_0x4eeeb3]===_0x62f7('0x70')){_0x1db780[_0x62f7('0x3e')]('i.'+_0x4eeeb3+_0x62f7('0x71'));}else{_0x1db780[_0x62f7('0x3e')]('i.'+_0x4eeeb3+'\x20=\x20?',_0x4a7600[_0x62f7('0x35')][_0x4eeeb3]);}}});}if(_0x4a7600[_0x62f7('0x35')][_0x62f7('0x72')]){if(_0x4a7600[_0x62f7('0x35')][_0x62f7('0x72')]==0x1){_0x1db780['having'](_0x62f7('0x73'));}else{_0x1db780[_0x62f7('0x56')](_0x62f7('0x74'));}}if(_0x4a7600[_0x62f7('0x35')]['tag']){_0x189d8a=_['isArray'](_0x4a7600[_0x62f7('0x35')]['tag'])?_0x4a7600[_0x62f7('0x35')][_0x62f7('0x75')]:new Array(_0x4a7600[_0x62f7('0x35')][_0x62f7('0x75')]);_0x189d8a[_0x62f7('0x2d')](function(_0x5af85d){_0x39f95d['or'](_0x62f7('0x62'),'%,'+_0x5af85d+',%');});}if(_0x4a7600[_0x62f7('0x35')]['filter']){var _0x19836c=_0x4a7600['query'][_0x62f7('0x76')][_0x62f7('0x77')]('\x5c','\x5c\x5c')[_0x62f7('0x77')]('\x27\x27',_0x62f7('0x78'));if(qs[_0x62f7('0x79')](_0x19836c)){_0x201acd['or'](_0x62f7('0x7a'),_0x19836c+'%');}else{_0x201acd['or'](_0x62f7('0x7b'),qs['getFullTextValue'](_0x19836c))['or'](_0x62f7('0x7c'),_0x19836c+'%')['or'](_0x62f7('0x7d'),_0x19836c+'%');}}}_0x1db780[_0x62f7('0x3e')](_0x201acd);_0x1db780[_0x62f7('0x7e')](_0x62f7('0x7f'));var _0x2b7e7a={'type':db[_0x62f7('0x80')][_0x62f7('0x81')][_0x62f7('0x82')],'raw':!![]};var _0x207740=_0x1db780['clone']();_0x207740[_0x62f7('0x42')](_0x62f7('0x7f'));_0x207740[_0x62f7('0x42')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x62f7('0x55'));if(_0x59db23['order']){_0x59db23[_0x62f7('0x83')][_0x62f7('0x2d')](function(_0x3754c9){_0x1db780[_0x62f7('0x83')]('i.'+_0x3754c9[0x0],_0x3754c9[0x1]===_0x62f7('0x84')?![]:!![]);});}if(!_[_0x62f7('0x85')](_0x189d8a)){_0x1db780[_0x62f7('0x56')](_0x39f95d);_0x207740[_0x62f7('0x3e')](_0x62f7('0x86'),_0x189d8a);}BPromise[_0x62f7('0x87')]()[_0x62f7('0x23')](function(){if(!_0x4075ac){if(_0x4a7600[_0x62f7('0x35')][_0x62f7('0x6a')]||_0x4a7600[_0x62f7('0x35')][_0x62f7('0x88')])return;_0x207740[_0x62f7('0x3e')](_0x62f7('0x89'));_0x1db780['where']('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');return;}return _0x4a7600[_0x62f7('0x8a')]['getOpenchannelAccounts']({'attributes':['id'],'raw':!![]})[_0x62f7('0x23')](function(_0x25f164){if(_[_0x62f7('0x85')](_0x25f164)){_0x207740[_0x62f7('0x3e')](_0x62f7('0x8b'));_0x1db780['where']('i.OpenchannelAccountId\x20IS\x20NULL');}else{_0x207740['where'](_0x62f7('0x8c'),_[_0x62f7('0x29')](_0x25f164,'id'));_0x1db780[_0x62f7('0x3e')]('i.OpenchannelAccountId\x20IN\x20?',_[_0x62f7('0x29')](_0x25f164,'id'));}});})[_0x62f7('0x23')](function(){db['sequelize'][_0x62f7('0x35')](_0x207740[_0x62f7('0x8d')](),_0x2b7e7a)[_0x62f7('0x23')](function(_0x18f9cc){_0x3fc417[_0x62f7('0x8e')]=_0x18f9cc[_0x62f7('0x39')];if(_0x3fc417[_0x62f7('0x8e')]===0x0)return[];return db[_0x62f7('0x8f')]['query'](_0x462595[_0x62f7('0x8d')](),_0x2b7e7a)[_0x62f7('0x23')](function(_0x290a1f){_0x1f8820=_[_0x62f7('0x90')](_0x290a1f,'id');_0x2b7e7a=_[_0x62f7('0x91')](_0x2b7e7a,{'model':db[_0x62f7('0x30')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4a7600[_0x62f7('0x35')][_0x62f7('0x38')]){_0x59db23[_0x62f7('0x36')][_0x62f7('0x2d')](function(_0x1fefc6){_0x1db780[_0x62f7('0x42')]('i.'+_0x1fefc6);});}else{_0x1db780['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x62f7('0x55'));_0x1db780[_0x62f7('0x42')]('a.key','Account.key');_0x1db780['field'](_0x62f7('0x92'),_0x62f7('0x93'));_0x1db780[_0x62f7('0x42')](_0x62f7('0x94'));_0x1db780[_0x62f7('0x42')](_0x62f7('0x95'),_0x62f7('0x96'));_0x1db780['field'](_0x62f7('0x97'),'Contact.lastName');_0x1db780[_0x62f7('0x42')]('c.email',_0x62f7('0x98'));_0x1db780[_0x62f7('0x42')](_0x62f7('0x99'),_0x62f7('0x9a'));_0x1db780[_0x62f7('0x42')]('c.mobile','Contact.mobile');_0x1db780[_0x62f7('0x42')](_0x62f7('0x9b'),'Contact.fax');_0x1db780[_0x62f7('0x42')](_0x62f7('0x9c'),'Owner.fullname');_0x1db780['field'](_0x62f7('0x9d'),_0x62f7('0x9e'));_0x1db780[_0x62f7('0x42')](_0x62f7('0x9f'),_0x62f7('0x2b'));}if(_0x59db23[_0x62f7('0x3c')])_0x1db780[_0x62f7('0x3c')](_0x59db23[_0x62f7('0x3c')]);if(_0x59db23[_0x62f7('0x1e')])_0x1db780[_0x62f7('0x1e')](_0x59db23[_0x62f7('0x1e')]);return db[_0x62f7('0x8f')][_0x62f7('0x35')](_0x1db780['toString'](),_0x2b7e7a);})['then'](function(_0x53091f){_0x5cd452[_0x62f7('0x3e')](_0x62f7('0xa0'),_[_0x62f7('0x29')](_0x53091f,'id'));return db['sequelize'][_0x62f7('0x35')](_0x5cd452[_0x62f7('0x8d')](),_0x2b7e7a)['then'](function(_0x11327c){var _0x2a0e4c=_[_0x62f7('0xa1')](_0x11327c,_0x62f7('0xa2'));var _0x5e65c7=[];_0x53091f[_0x62f7('0x2d')](function(_0x53f149){_0x5e65c7[_0x62f7('0x2e')](updateOpenchannelInteraction(_0x53f149,_0x1f8820,_0x2a0e4c));});return BPromise[_0x62f7('0xa3')](_0x5e65c7);});});})['then'](function(_0x32ae27){_0x3fc417['rows']=_0x32ae27;return _0x3fc417;})[_0x62f7('0x23')](respondWithFilteredResult(_0x1dc41d,_0x59db23));})['catch'](handleError(_0x1dc41d,null));};exports[_0x62f7('0xa4')]=function(_0x433598,_0x3f60f3){var _0x383803={'raw':![],'where':{'id':_0x433598[_0x62f7('0xa5')]['id']}},_0x3490aa={};_0x3490aa[_0x62f7('0x34')]=_['keys'](db['OpenchannelInteraction']['rawAttributes']);_0x3490aa[_0x62f7('0x35')]=_['keys'](_0x433598[_0x62f7('0x35')]);_0x3490aa[_0x62f7('0x40')]=_[_0x62f7('0x37')](_0x3490aa[_0x62f7('0x34')],_0x3490aa[_0x62f7('0x35')]);_0x383803[_0x62f7('0x36')]=_[_0x62f7('0x37')](_0x3490aa['model'],qs['fields'](_0x433598[_0x62f7('0x35')][_0x62f7('0x38')]));_0x383803[_0x62f7('0x36')]=_0x383803['attributes'][_0x62f7('0x39')]?_0x383803[_0x62f7('0x36')]:_0x3490aa[_0x62f7('0x34')];if(_0x433598[_0x62f7('0x35')][_0x62f7('0xa6')]){_0x383803['include']=[{'all':!![]}];}_0x383803=_[_0x62f7('0x91')]({},_0x383803,_0x433598[_0x62f7('0xa7')]);return db[_0x62f7('0x30')][_0x62f7('0x54')](_0x383803)['then'](handleEntityNotFound(_0x3f60f3,null))[_0x62f7('0x23')](respondWithResult(_0x3f60f3,null))['catch'](handleError(_0x3f60f3,null));};exports[_0x62f7('0xa8')]=function(_0x3301b8,_0x2587a8){return db[_0x62f7('0x30')][_0x62f7('0xa8')](_0x3301b8[_0x62f7('0x68')],{})[_0x62f7('0x23')](respondWithResult(_0x2587a8,0xc9))[_0x62f7('0x2f')](handleError(_0x2587a8,null));};exports[_0x62f7('0x22')]=function(_0x273f52,_0x123249){if(_0x273f52[_0x62f7('0x68')]['id']){delete _0x273f52['body']['id'];}return db[_0x62f7('0x30')][_0x62f7('0x54')]({'where':{'id':_0x273f52['params']['id']}})[_0x62f7('0x23')](handleEntityNotFound(_0x123249,null))[_0x62f7('0x23')](saveUpdates(_0x273f52[_0x62f7('0x68')],null))[_0x62f7('0x23')](respondWithResult(_0x123249,null))[_0x62f7('0x2f')](handleError(_0x123249,null));};exports['destroy']=function(_0x921a54,_0x498ee8){return db[_0x62f7('0x30')][_0x62f7('0x54')]({'where':{'id':_0x921a54[_0x62f7('0xa5')]['id']}})[_0x62f7('0x23')](handleEntityNotFound(_0x498ee8,null))[_0x62f7('0x23')](removeEntity(_0x498ee8,null))['catch'](handleError(_0x498ee8,null));};exports[_0x62f7('0xa9')]=function(_0x32bf03,_0x4a12f9){return db[_0x62f7('0x30')][_0x62f7('0xa9')]()[_0x62f7('0x23')](respondWithResult(_0x4a12f9,null))[_0x62f7('0x2f')](handleError(_0x4a12f9,null));};exports[_0x62f7('0xaa')]=function(_0x3052c1,_0x52c2cf,_0x2aac28){return db['OpenchannelMessage'][_0x62f7('0x54')]({'where':{'id':_0x3052c1[_0x62f7('0xa5')]['id']}})[_0x62f7('0x23')](handleEntityNotFound(_0x52c2cf,null))['then'](function(_0x58015b){if(_0x58015b){return _0x58015b[_0x62f7('0xaa')](_0x3052c1['body']['ids'],_[_0x62f7('0xab')](_0x3052c1[_0x62f7('0x68')],[_0x62f7('0xac'),'id'])||{});}})['then'](respondWithResult(_0x52c2cf,null))[_0x62f7('0x2f')](handleError(_0x52c2cf,null));};exports[_0x62f7('0xad')]=function(_0x2dbdab,_0x337d10,_0x49cb86){var _0x5593ac={'raw':![],'where':{}};var _0x59f071={};var _0x22c435={'count':0x0,'rows':[]};return db['OpenchannelInteraction']['findOne']({'where':{'id':_0x2dbdab[_0x62f7('0xa5')]['id']}})[_0x62f7('0x23')](handleEntityNotFound(_0x337d10,null))[_0x62f7('0x23')](function(_0x4bf84e){if(_0x4bf84e){_0x59f071[_0x62f7('0x34')]=_[_0x62f7('0xae')](db[_0x62f7('0xaf')]['rawAttributes']);_0x59f071[_0x62f7('0x35')]=_[_0x62f7('0xae')](_0x2dbdab[_0x62f7('0x35')]);_0x59f071[_0x62f7('0x40')]=_[_0x62f7('0x37')](_0x59f071[_0x62f7('0x34')],_0x59f071[_0x62f7('0x35')]);_0x5593ac[_0x62f7('0x36')]=_[_0x62f7('0x37')](_0x59f071['model'],qs[_0x62f7('0x38')](_0x2dbdab['query']['fields']));_0x5593ac[_0x62f7('0x36')]=_0x5593ac['attributes']['length']?_0x5593ac[_0x62f7('0x36')]:_0x59f071[_0x62f7('0x34')];if(!_0x2dbdab['query'][_0x62f7('0x3a')](_0x62f7('0x3b'))){_0x5593ac[_0x62f7('0x3c')]=qs[_0x62f7('0x3c')](_0x2dbdab[_0x62f7('0x35')]['limit']);_0x5593ac[_0x62f7('0x1e')]=qs[_0x62f7('0x1e')](_0x2dbdab[_0x62f7('0x35')]['offset']);}_0x5593ac['order']=qs[_0x62f7('0x3d')](_0x2dbdab[_0x62f7('0x35')][_0x62f7('0x3d')]);_0x5593ac[_0x62f7('0x3e')]=qs[_0x62f7('0x40')](_['pick'](_0x2dbdab['query'],_0x59f071['filters']));_0x5593ac[_0x62f7('0x3e')]['OpenchannelInteractionId']=_0x4bf84e['id'];if(_0x2dbdab[_0x62f7('0x35')]['filter']){_0x5593ac[_0x62f7('0x3e')]=_[_0x62f7('0x91')](_0x5593ac[_0x62f7('0x3e')],{'$or':_[_0x62f7('0x29')](_0x5593ac[_0x62f7('0x36')],function(_0x2f9790){var _0x551f8a={};_0x551f8a[_0x2f9790]={'$like':'%'+_0x2dbdab['query'][_0x62f7('0x76')]+'%'};return _0x551f8a;})});}if(_0x2dbdab[_0x62f7('0x35')][_0x62f7('0x6e')]){var _0x400a42=_0x2dbdab[_0x62f7('0x35')][_0x62f7('0x6e')][_0x62f7('0x5c')](',');var _0x6e7411={};_0x6e7411[_0x400a42[0x0]]={'$gte':moment(_0x400a42[0x1])[_0x62f7('0xb0')](_0x62f7('0xb1'))};_0x5593ac[_0x62f7('0x3e')]=_[_0x62f7('0x91')](_0x5593ac[_0x62f7('0x3e')],_0x6e7411);}_0x5593ac=_[_0x62f7('0x91')]({},_0x5593ac,_0x2dbdab['options']);return db[_0x62f7('0xaf')][_0x62f7('0x8e')]({'where':_0x5593ac[_0x62f7('0x3e')]})['then'](function(_0x3f7727){_0x22c435['count']=_0x3f7727;if(_0x2dbdab[_0x62f7('0x35')][_0x62f7('0xa6')]){_0x5593ac[_0x62f7('0xb2')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0x62f7('0xb3')](_0x5593ac);})[_0x62f7('0x23')](function(_0x16158a){_0x22c435[_0x62f7('0xb4')]=_0x16158a;return _0x22c435;});}})[_0x62f7('0x23')](respondWithFilteredResult(_0x337d10,_0x5593ac))['catch'](handleError(_0x337d10,null));};exports[_0x62f7('0xb5')]=function(_0x497f32,_0x199abf,_0x34782c){return db[_0x62f7('0x30')][_0x62f7('0x54')]({'where':{'id':_0x497f32[_0x62f7('0xa5')]['id']}})['then'](handleEntityNotFound(_0x199abf,null))[_0x62f7('0x23')](function(_0x3c2c6f){if(_0x3c2c6f){return _0x3c2c6f['setTags'](_0x497f32[_0x62f7('0x68')]['ids'],_[_0x62f7('0xab')](_0x497f32[_0x62f7('0x68')],[_0x62f7('0xac'),'id'])||{})['spread'](function(){return db[_0x62f7('0x61')][_0x62f7('0xb3')]({'attributes':['id',_0x62f7('0x27'),_0x62f7('0x43')],'where':{'id':_0x497f32[_0x62f7('0x68')]['ids']}});})[_0x62f7('0x23')](function(_0x33d27c){socket['emit'](_0x62f7('0xb6'),{'id':Number(_0x497f32[_0x62f7('0xa5')]['id']),'tags':_0x33d27c||[]});return{'id':Number(_0x497f32[_0x62f7('0xa5')]['id']),'tags':_0x33d27c||[]};});}})[_0x62f7('0x23')](respondWithResult(_0x199abf,null))['catch'](handleError(_0x199abf,null));};exports[_0x62f7('0xb7')]=function(_0x13593d,_0x106637,_0x21d150){return db['OpenchannelInteraction'][_0x62f7('0x54')]({'where':{'id':_0x13593d['params']['id']}})[_0x62f7('0x23')](handleEntityNotFound(_0x106637,null))['then'](function(_0x324a29){if(_0x324a29){return _0x324a29['removeTags'](_0x13593d[_0x62f7('0x35')]['ids']);}})['then'](respondWithStatusCode(_0x106637,null))[_0x62f7('0x2f')](handleError(_0x106637,null));};exports[_0x62f7('0xb8')]=function(_0x2e8df8,_0x105044){var _0x16ab0b=moment()[_0x62f7('0xb9')]()[_0x62f7('0x8d')]();var _0x1ccce1=path[_0x62f7('0xba')](config['root'],_0x62f7('0xbb'),'files','tmp');var _0x65b689=path[_0x62f7('0xba')](config[_0x62f7('0xbc')],'server',_0x62f7('0xbd'),_0x62f7('0xbe'));var _0x37ec35=path[_0x62f7('0xba')](_0x1ccce1,_0x16ab0b);var _0x3c3028=util[_0x62f7('0xb0')](_0x62f7('0xbf'),_0x2e8df8[_0x62f7('0xa5')]['id'],_0x16ab0b);var _0x30df7a=path['join'](_0x1ccce1,_0x3c3028);var _0x8c3f02=[];_0x8c3f02[_0x62f7('0x2e')]({'model':db['User'],'as':_0x62f7('0x64'),'attributes':['id',_0x62f7('0x2a')],'raw':!![]});_0x8c3f02[_0x62f7('0x2e')]({'model':db[_0x62f7('0xc0')],'as':_0x62f7('0x58'),'attributes':['id','firstName',_0x62f7('0xc1')],'raw':!![]});if(_0x2e8df8['query']['attachments']){_0x8c3f02[_0x62f7('0x2e')]({'model':db[_0x62f7('0xc2')],'as':_0x62f7('0xc2'),'raw':!![]});}var _0x1adb27=[{'model':db[_0x62f7('0xaf')],'as':_0x62f7('0xc3'),'attributes':['id',_0x62f7('0x68'),_0x62f7('0x6c'),_0x62f7('0xc4'),_0x62f7('0xc5'),_0x62f7('0x72')],'include':_0x8c3f02}];_0x1adb27[_0x62f7('0x2e')]({'model':db['OpenchannelAccount'],'as':_0x62f7('0xc6'),'attributes':['id',_0x62f7('0x27')]});_0x1adb27[_0x62f7('0x2e')]({'model':db[_0x62f7('0x64')],'as':_0x62f7('0xc7'),'attributes':['id',_0x62f7('0x2a')]});return db[_0x62f7('0x30')][_0x62f7('0x54')]({'where':{'id':_0x2e8df8[_0x62f7('0xa5')]['id']},'include':_0x1adb27})[_0x62f7('0x23')](handleEntityNotFound(_0x105044,null))[_0x62f7('0x23')](function(_0x27284b){if(_0x27284b){var _0x2aee56=_0x27284b[_0x62f7('0xc8')]({'plain':!![]});fs[_0x62f7('0xc9')](_0x37ec35);var _0x4748af={'format':'A4','border':_0x62f7('0xca'),'header':{'height':_0x62f7('0xcb'),'contents':{'first':_0x62f7('0xcc')}},'footer':{'height':_0x62f7('0xcd'),'contents':{'default':util['format'](_0x62f7('0xce'),util[_0x62f7('0xb0')](_0x62f7('0xcf'),_0x62f7('0xd0'),_0x2aee56['id']),moment()['format'](_0x62f7('0xd1'))[_0x62f7('0x8d')]())}}};var _0x5906f6={'channel':_0x62f7('0xd0'),'account':_0x2aee56[_0x62f7('0xc6')][_0x62f7('0x27')],'agent':_0x2aee56['Owner']?_0x2aee56[_0x62f7('0xc7')][_0x62f7('0x2a')]:_0x62f7('0xd2'),'createdAt':moment(_0x2aee56['createdAt'])['format'](_0x62f7('0xb1'))['toString'](),'closedAt':_0x2aee56[_0x62f7('0xd3')]?moment(_0x2aee56[_0x62f7('0xd4')])[_0x62f7('0xb0')](_0x62f7('0xb1'))['toString']():'','disposition':_0x2aee56['disposition'],'visibility':_0x2aee56['threadId']?_0x62f7('0xd5'):'Private','messages':_(_0x2aee56[_0x62f7('0xc3')])['filter']({'secret':![]})[_0x62f7('0x29')](function(_0x372db3){if(_0x372db3[_0x62f7('0xc2')]){var _0x7cefff=path[_0x62f7('0xba')](_0x65b689,_0x372db3[_0x62f7('0xc2')]['basename']);if(fs['existsSync'](_0x7cefff)){fs[_0x62f7('0xd6')](_0x7cefff)[_0x62f7('0xd7')](fs['createWriteStream'](path[_0x62f7('0xba')](_0x37ec35,_0x372db3[_0x62f7('0xc2')][_0x62f7('0xd8')])));}}return{'date':moment(_0x372db3['createdAt'])['format'](_0x62f7('0xb1'))[_0x62f7('0x8d')](),'sender':_0x372db3[_0x62f7('0xc4')]===_0x62f7('0xd9')?_0x372db3[_0x62f7('0x64')]?_0x372db3['User']['fullname']:_0x62f7('0xda'):_0x372db3[_0x62f7('0x58')][_0x62f7('0xdb')]+(_0x372db3['Contact'][_0x62f7('0xc1')]?'\x20'+_0x372db3[_0x62f7('0x58')][_0x62f7('0xc1')]:''),'body':_0x372db3[_0x62f7('0xc2')]?_0x372db3[_0x62f7('0xc2')]['basename']:_0x372db3[_0x62f7('0x68')],'direction':_0x372db3[_0x62f7('0xc4')]===_0x62f7('0xd9')?'A':'C','secret':_0x372db3['secret'],'read':_0x372db3[_0x62f7('0x72')],'attachment':_0x372db3['Attachment']};})['value']()};return ejs['renderFile'](path['join'](config[_0x62f7('0xbc')],_0x62f7('0xbb'),_0x62f7('0xdc'),_0x62f7('0xdd')),{'interaction':_0x5906f6})[_0x62f7('0x23')](function(_0x35b548){return new BPromise(function(_0x15bfe4,_0x5bbc05){pdf[_0x62f7('0xa8')](_0x35b548,_0x4748af)[_0x62f7('0xde')](path[_0x62f7('0xba')](_0x37ec35,_0x62f7('0xdf')+_0x2aee56['id']+'-'+_0x16ab0b+_0x62f7('0xe0')),function(_0x746566,_0x3417d0){if(_0x746566)return _0x5bbc05(_0x746566);_0x15bfe4(_0x3417d0);});});})[_0x62f7('0x23')](function(){return new BPromise(function(_0x3ef1dd,_0x395e51){zipdir(_0x37ec35,{'saveTo':_0x30df7a},function(_0x2b2331,_0x1ecbff){if(_0x2b2331)return _0x395e51(_0x2b2331);return _0x3ef1dd(_0x1ecbff);});})[_0x62f7('0x23')](function(){return new BPromise(function(_0x130464,_0x11889f){rimraf(_0x37ec35,function(_0x91ef8d){if(_0x91ef8d)_0x11889f(_0x91ef8d);return _0x130464();});});})[_0x62f7('0x23')](function(){return _0x105044[_0x62f7('0xb8')](_0x30df7a,_0x3c3028,function(_0x1becfa){if(_0x1becfa){console[_0x62f7('0xe1')]('err',_0x1becfa);}else{fs[_0x62f7('0xe2')](_0x30df7a);}});});});}else{return _0x105044[_0x62f7('0xe3')](0xc8);}})[_0x62f7('0x2f')](handleError(_0x105044,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 2c735ef..f6a64ec 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 _0x6a51=['emit','catch','hook','events','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','setMaxListeners','save','update','getUsers','setDataValue','Users','map','then','unreadMessages'];(function(_0x2e71c5,_0x1aff5d){var _0x3bc153=function(_0xcd6378){while(--_0xcd6378){_0x2e71c5['push'](_0x2e71c5['shift']());}};_0x3bc153(++_0x1aff5d);}(_0x6a51,0x1f3));var _0x16a5=function(_0x33c9f8,_0x5aedbb){_0x33c9f8=_0x33c9f8-0x0;var _0x2d7004=_0x6a51[_0x33c9f8];return _0x2d7004;};'use strict';var EventEmitter=require(_0x16a5('0x0'));var OpenchannelInteraction=require(_0x16a5('0x1'))['db'][_0x16a5('0x2')];var OpenchannelMessage=require('../../mysqldb')['db'][_0x16a5('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x16a5('0x4')](0x0);var events={'afterCreate':_0x16a5('0x5'),'afterUpdate':_0x16a5('0x6'),'afterDestroy':'remove'};function emitEvent(_0x3134da){return function(_0x1a2599,_0x334825,_0x48004e){_0x1a2599[_0x16a5('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x5f1f3f){_0x1a2599[_0x16a5('0x8')](_0x16a5('0x9'),_0x5f1f3f[_0x16a5('0xa')](function(_0x367b88){return{'id':_0x367b88['id']};}));return OpenchannelMessage['findAll']({'where':{'OpenchannelInteractionId':_0x1a2599['id'],'direction':'in','read':![]},'raw':!![]});})[_0x16a5('0xb')](function(_0x14302e){_0x1a2599[_0x16a5('0x8')](_0x16a5('0xc'),_0x14302e['length']);OpenchannelInteractionEvents[_0x16a5('0xd')](_0x3134da+':'+_0x1a2599['id'],_0x1a2599);OpenchannelInteractionEvents['emit'](_0x3134da,_0x1a2599);_0x48004e(null);})[_0x16a5('0xe')](_0x48004e(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelInteraction[_0x16a5('0xf')](e,emitEvent(event));}}module['exports']=OpenchannelInteractionEvents; \ No newline at end of file +var _0xa3da=['emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','save','update','getUsers','then','setDataValue','Users','map','unreadMessages','length'];(function(_0x2dea24,_0x2fc021){var _0x309d58=function(_0x2eb89f){while(--_0x2eb89f){_0x2dea24['push'](_0x2dea24['shift']());}};_0x309d58(++_0x2fc021);}(_0xa3da,0xb9));var _0xaa3d=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xa3da[_0x46aff0];return _0x9d78cf;};'use strict';var EventEmitter=require(_0xaa3d('0x0'));var OpenchannelInteraction=require(_0xaa3d('0x1'))['db'][_0xaa3d('0x2')];var OpenchannelMessage=require('../../mysqldb')['db'][_0xaa3d('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xaa3d('0x4'),'afterUpdate':_0xaa3d('0x5'),'afterDestroy':'remove'};function emitEvent(_0x2b8e92){return function(_0x51f643,_0x2c3062,_0x2e554d){_0x51f643[_0xaa3d('0x6')]({'attributes':['id'],'raw':!![]})[_0xaa3d('0x7')](function(_0x5b3bd8){_0x51f643[_0xaa3d('0x8')](_0xaa3d('0x9'),_0x5b3bd8[_0xaa3d('0xa')](function(_0x5646ce){return{'id':_0x5646ce['id']};}));return OpenchannelMessage['findAll']({'where':{'OpenchannelInteractionId':_0x51f643['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x15762d){_0x51f643[_0xaa3d('0x8')](_0xaa3d('0xb'),_0x15762d[_0xaa3d('0xc')]);OpenchannelInteractionEvents['emit'](_0x2b8e92+':'+_0x51f643['id'],_0x51f643);OpenchannelInteractionEvents[_0xaa3d('0xd')](_0x2b8e92,_0x51f643);_0x2e554d(null);})[_0xaa3d('0xe')](_0x2e554d(null));};}for(var e in events){if(events[_0xaa3d('0xf')](e)){var event=events[e];OpenchannelInteraction[_0xaa3d('0x10')](e,emitEvent(event));}}module[_0xaa3d('0x11')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 0068aab..495bf99 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 _0x106f=['openchannel_interactions','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','api','moment','request-promise','rimraf','../../config/environment','./openchannelInteraction.attributes','exports','define'];(function(_0x469361,_0x42f6ab){var _0x418e39=function(_0x3b519f){while(--_0x3b519f){_0x469361['push'](_0x469361['shift']());}};_0x418e39(++_0x42f6ab);}(_0x106f,0x162));var _0xf106=function(_0x50d867,_0x27b599){_0x50d867=_0x50d867-0x0;var _0xb6674b=_0x106f[_0x50d867];return _0xb6674b;};'use strict';var _=require(_0xf106('0x0'));var util=require(_0xf106('0x1'));var logger=require('../../config/logger')(_0xf106('0x2'));var moment=require(_0xf106('0x3'));var BPromise=require('bluebird');var rp=require(_0xf106('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf106('0x5'));var config=require(_0xf106('0x6'));var attributes=require(_0xf106('0x7'));module[_0xf106('0x8')]=function(_0x253f6d,_0x282fd4){return _0x253f6d[_0xf106('0x9')]('OpenchannelInteraction',attributes,{'tableName':_0xf106('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3ac1bd,_0x5ea4f0,_0x4a35bc){if(_0x3ac1bd['changed']('closed')){_0x3ac1bd['closedAt']=moment()[_0xf106('0xb')](_0xf106('0xc'));}_0x4a35bc(null,_0x3ac1bd);}}});}; \ No newline at end of file +var _0x236d=['request-promise','path','rimraf','exports','define','changed','closed','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','api','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x236d,0x7e));var _0xd236=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x236d[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xd236('0x0'));var util=require(_0xd236('0x1'));var logger=require('../../config/logger')(_0xd236('0x2'));var moment=require('moment');var BPromise=require(_0xd236('0x3'));var rp=require(_0xd236('0x4'));var fs=require('fs');var path=require(_0xd236('0x5'));var rimraf=require(_0xd236('0x6'));var config=require('../../config/environment');var attributes=require('./openchannelInteraction.attributes');module[_0xd236('0x7')]=function(_0x29a67c,_0x75d84c){return _0x29a67c[_0xd236('0x8')]('OpenchannelInteraction',attributes,{'tableName':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2d9025,_0x18d969,_0x4e0460){if(_0x2d9025[_0xd236('0x9')](_0xd236('0xa'))){_0x2d9025['closedAt']=moment()[_0xd236('0xb')](_0xd236('0xc'));}_0x4e0460(null,_0x2d9025);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index b86f2df..cc52d26 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 _0xbf1f=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','./openchannelInteraction.socket','register','request','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelInteraction,\x20%s,\x20%s','message','info','result','options','raw','where','attributes','UpdateOpenchannelInteraction','catch','AddTagsToOpenchannelInteraction','OpenchannelInteraction','then','body','ids','spread','lodash','util','moment','bluebird'];(function(_0x673b8e,_0x105f4c){var _0xee868d=function(_0x21534d){while(--_0x21534d){_0x673b8e['push'](_0x673b8e['shift']());}};_0xee868d(++_0x105f4c);}(_0xbf1f,0x15b));var _0xfbf1=function(_0x2e3107,_0x25f970){_0x2e3107=_0x2e3107-0x0;var _0x833d69=_0xbf1f[_0x2e3107];return _0x833d69;};'use strict';var _=require(_0xfbf1('0x0'));var util=require(_0xfbf1('0x1'));var moment=require(_0xfbf1('0x2'));var BPromise=require(_0xfbf1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfbf1('0x4'));var db=require(_0xfbf1('0x5'))['db'];var utils=require(_0xfbf1('0x6'));var logger=require('../../config/logger')(_0xfbf1('0x7'));var config=require(_0xfbf1('0x8'));var jayson=require(_0xfbf1('0x9'));var client=jayson['client'][_0xfbf1('0xa')]({'port':0x232a});config[_0xfbf1('0xb')]=_[_0xfbf1('0xc')](config[_0xfbf1('0xb')],{'host':_0xfbf1('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfbf1('0xb')]));require(_0xfbf1('0xe'))[_0xfbf1('0xf')](socket);function respondWithRpcPromise(_0x3fc47f,_0x5a4240,_0x375fd5){return new BPromise(function(_0x1d8506,_0x20abf4){return client[_0xfbf1('0x10')](_0x3fc47f,_0x375fd5)['then'](function(_0x5b3b62){logger['info']('OpenchannelInteraction,\x20%s,\x20%s',_0x5a4240,_0xfbf1('0x11'));logger[_0xfbf1('0x12')](_0xfbf1('0x13'),_0x5a4240,_0xfbf1('0x11'),JSON[_0xfbf1('0x14')](_0x5b3b62));if(_0x5b3b62[_0xfbf1('0x15')]){if(_0x5b3b62[_0xfbf1('0x15')][_0xfbf1('0x16')]===0x1f4){logger['error'](_0xfbf1('0x17'),_0x5a4240,_0x5b3b62[_0xfbf1('0x15')][_0xfbf1('0x18')]);return _0x20abf4(_0x5b3b62[_0xfbf1('0x15')][_0xfbf1('0x18')]);}logger[_0xfbf1('0x15')](_0xfbf1('0x17'),_0x5a4240,_0x5b3b62[_0xfbf1('0x15')]['message']);return _0x1d8506(_0x5b3b62[_0xfbf1('0x15')][_0xfbf1('0x18')]);}else{logger[_0xfbf1('0x19')](_0xfbf1('0x17'),_0x5a4240,_0xfbf1('0x11'));_0x1d8506(_0x5b3b62[_0xfbf1('0x1a')]['message']);}})['catch'](function(_0x1ce562){logger['error']('OpenchannelInteraction,\x20%s,\x20%s',_0x5a4240,_0x1ce562);_0x20abf4(_0x1ce562);});});}exports['UpdateOpenchannelInteraction']=function(_0x2cee98){var _0x21c11a=this;return new Promise(function(_0x43d01c,_0x2573ed){return db['OpenchannelInteraction']['update'](_0x2cee98['body'],{'raw':_0x2cee98[_0xfbf1('0x1b')]?_0x2cee98['options'][_0xfbf1('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2cee98[_0xfbf1('0x1b')]?_0x2cee98['options'][_0xfbf1('0x1d')]||null:null,'attributes':_0x2cee98[_0xfbf1('0x1b')]?_0x2cee98[_0xfbf1('0x1b')][_0xfbf1('0x1e')]||null:null,'limit':_0x2cee98[_0xfbf1('0x1b')]?_0x2cee98['options']['limit']||null:null})['then'](function(_0x3b5052){logger[_0xfbf1('0x19')](_0xfbf1('0x1f'),_0x2cee98);logger[_0xfbf1('0x12')]('UpdateOpenchannelInteraction',_0x2cee98,JSON['stringify'](_0x3b5052));_0x43d01c(_0x3b5052);})[_0xfbf1('0x20')](function(_0x1ee687){logger['error'](_0xfbf1('0x1f'),_0x1ee687['message'],_0x2cee98);_0x2573ed(_0x21c11a[_0xfbf1('0x15')](0x1f4,_0x1ee687[_0xfbf1('0x18')]));});});};exports[_0xfbf1('0x21')]=function(_0x1e04ea){return new Promise(function(_0x2ac0f7,_0x2b6f82){return db[_0xfbf1('0x22')]['find']({'where':_0x1e04ea['options']?_0x1e04ea[_0xfbf1('0x1b')][_0xfbf1('0x1d')]||null:null})[_0xfbf1('0x23')](function(_0x3f9595){if(_0x3f9595){return _0x3f9595['addTags'](_0x1e04ea[_0xfbf1('0x24')][_0xfbf1('0x25')],_['omit'](_0x1e04ea['body'],[_0xfbf1('0x25'),'id'])||{});}})[_0xfbf1('0x26')](function(_0x12985b){logger['info']('AddTags',_0x1e04ea);logger[_0xfbf1('0x12')]('AddTags',_0x1e04ea,JSON[_0xfbf1('0x14')](_0x12985b));_0x2ac0f7(_0x12985b);})[_0xfbf1('0x20')](function(_0x496694){logger[_0xfbf1('0x15')]('AddTags',_0x496694[_0xfbf1('0x18')],_0x1e04ea);_0x2b6f82(_this[_0xfbf1('0x15')](0x1f4,_0x496694[_0xfbf1('0x18')]));});});}; \ No newline at end of file +var _0x08c0=['omit','AddTags','lodash','moment','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','register','request','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','UpdateOpenchannelInteraction','OpenchannelInteraction','update','raw','options','where','attributes','limit','then','debug','catch','find','addTags','body','ids'];(function(_0x284f28,_0x21d15b){var _0x25619f=function(_0x2b080d){while(--_0x2b080d){_0x284f28['push'](_0x284f28['shift']());}};_0x25619f(++_0x21d15b);}(_0x08c0,0xbb));var _0x008c=function(_0x1ba9df,_0x41e5de){_0x1ba9df=_0x1ba9df-0x0;var _0x1c778d=_0x08c0[_0x1ba9df];return _0x1c778d;};'use strict';var _=require(_0x008c('0x0'));var util=require('util');var moment=require(_0x008c('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x008c('0x2'));var db=require(_0x008c('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x008c('0x4'));var config=require(_0x008c('0x5'));var jayson=require(_0x008c('0x6'));var client=jayson[_0x008c('0x7')][_0x008c('0x8')]({'port':0x232a});config[_0x008c('0x9')]=_['defaults'](config['redis'],{'host':_0x008c('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x008c('0x9')]));require('./openchannelInteraction.socket')[_0x008c('0xb')](socket);function respondWithRpcPromise(_0x4cfb9d,_0x141680,_0x346810){return new BPromise(function(_0x290a00,_0x2ed0ab){return client[_0x008c('0xc')](_0x4cfb9d,_0x346810)['then'](function(_0x2ef421){logger[_0x008c('0xd')](_0x008c('0xe'),_0x141680,_0x008c('0xf'));logger['debug'](_0x008c('0x10'),_0x141680,_0x008c('0xf'),JSON[_0x008c('0x11')](_0x2ef421));if(_0x2ef421[_0x008c('0x12')]){if(_0x2ef421['error']['code']===0x1f4){logger[_0x008c('0x12')](_0x008c('0xe'),_0x141680,_0x2ef421[_0x008c('0x12')][_0x008c('0x13')]);return _0x2ed0ab(_0x2ef421[_0x008c('0x12')]['message']);}logger[_0x008c('0x12')](_0x008c('0xe'),_0x141680,_0x2ef421['error'][_0x008c('0x13')]);return _0x290a00(_0x2ef421[_0x008c('0x12')][_0x008c('0x13')]);}else{logger['info']('OpenchannelInteraction,\x20%s,\x20%s',_0x141680,_0x008c('0xf'));_0x290a00(_0x2ef421['result']['message']);}})['catch'](function(_0x380b3b){logger[_0x008c('0x12')](_0x008c('0xe'),_0x141680,_0x380b3b);_0x2ed0ab(_0x380b3b);});});}exports[_0x008c('0x14')]=function(_0x2fd152){var _0x19e483=this;return new Promise(function(_0x30224a,_0x4a9001){return db[_0x008c('0x15')][_0x008c('0x16')](_0x2fd152['body'],{'raw':_0x2fd152['options']?_0x2fd152['options'][_0x008c('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2fd152['options']?_0x2fd152[_0x008c('0x18')][_0x008c('0x19')]||null:null,'attributes':_0x2fd152[_0x008c('0x18')]?_0x2fd152[_0x008c('0x18')][_0x008c('0x1a')]||null:null,'limit':_0x2fd152[_0x008c('0x18')]?_0x2fd152[_0x008c('0x18')][_0x008c('0x1b')]||null:null})[_0x008c('0x1c')](function(_0x584022){logger[_0x008c('0xd')](_0x008c('0x14'),_0x2fd152);logger[_0x008c('0x1d')](_0x008c('0x14'),_0x2fd152,JSON[_0x008c('0x11')](_0x584022));_0x30224a(_0x584022);})[_0x008c('0x1e')](function(_0x32d0de){logger[_0x008c('0x12')](_0x008c('0x14'),_0x32d0de['message'],_0x2fd152);_0x4a9001(_0x19e483[_0x008c('0x12')](0x1f4,_0x32d0de[_0x008c('0x13')]));});});};exports['AddTagsToOpenchannelInteraction']=function(_0x2c519a){return new Promise(function(_0x275c10,_0x5af12e){return db[_0x008c('0x15')][_0x008c('0x1f')]({'where':_0x2c519a[_0x008c('0x18')]?_0x2c519a[_0x008c('0x18')]['where']||null:null})[_0x008c('0x1c')](function(_0x5d3827){if(_0x5d3827){return _0x5d3827[_0x008c('0x20')](_0x2c519a[_0x008c('0x21')][_0x008c('0x22')],_[_0x008c('0x23')](_0x2c519a['body'],[_0x008c('0x22'),'id'])||{});}})['spread'](function(_0x404f71){logger[_0x008c('0xd')]('AddTags',_0x2c519a);logger[_0x008c('0x1d')](_0x008c('0x24'),_0x2c519a,JSON[_0x008c('0x11')](_0x404f71));_0x275c10(_0x404f71);})['catch'](function(_0x2c82a4){logger[_0x008c('0x12')]('AddTags',_0x2c82a4[_0x008c('0x13')],_0x2c519a);_0x5af12e(_this['error'](0x1f4,_0x2c82a4['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 11622da..4ea24b5 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 _0x0ffa=['remove','emit','removeListener','length','openchannelInteraction:','./openchannelInteraction.events'];(function(_0x3625d6,_0x57f4c4){var _0x8df4d8=function(_0x7ba668){while(--_0x7ba668){_0x3625d6['push'](_0x3625d6['shift']());}};_0x8df4d8(++_0x57f4c4);}(_0x0ffa,0xbf));var _0xa0ff=function(_0x5bfba9,_0xe833c7){_0x5bfba9=_0x5bfba9-0x0;var _0x186754=_0x0ffa[_0x5bfba9];return _0x186754;};'use strict';var OpenchannelInteractionEvents=require(_0xa0ff('0x0'));var events=['save',_0xa0ff('0x1'),'update'];function createListener(_0x164c09,_0xd1d845){return function(_0x502aa6){_0xd1d845[_0xa0ff('0x2')](_0x164c09,_0x502aa6);};}function removeListener(_0x5771f0,_0x255ff9){return function(){OpenchannelInteractionEvents[_0xa0ff('0x3')](_0x5771f0,_0x255ff9);};}exports['register']=function(_0xdd652){for(var _0x4b847c=0x0,_0x27aa27=events[_0xa0ff('0x4')];_0x4b847c<_0x27aa27;_0x4b847c++){var _0x3f8796=events[_0x4b847c];var _0x6bb042=createListener(_0xa0ff('0x5')+_0x3f8796,_0xdd652);OpenchannelInteractionEvents['on'](_0x3f8796,_0x6bb042);}}; \ No newline at end of file +var _0x5fd5=['openchannelInteraction:','./openchannelInteraction.events','save','remove','update','emit','length'];(function(_0x44268d,_0xad8443){var _0x4be92d=function(_0x8a57ff){while(--_0x8a57ff){_0x44268d['push'](_0x44268d['shift']());}};_0x4be92d(++_0xad8443);}(_0x5fd5,0x151));var _0x55fd=function(_0x261d12,_0x1e093c){_0x261d12=_0x261d12-0x0;var _0x441715=_0x5fd5[_0x261d12];return _0x441715;};'use strict';var OpenchannelInteractionEvents=require(_0x55fd('0x0'));var events=[_0x55fd('0x1'),_0x55fd('0x2'),_0x55fd('0x3')];function createListener(_0x989da2,_0x503bfb){return function(_0x39f4d2){_0x503bfb[_0x55fd('0x4')](_0x989da2,_0x39f4d2);};}function removeListener(_0x17bd2f,_0x26b947){return function(){OpenchannelInteractionEvents['removeListener'](_0x17bd2f,_0x26b947);};}exports['register']=function(_0x9df9c6){for(var _0x1a72b8=0x0,_0x8effe2=events[_0x55fd('0x5')];_0x1a72b8<_0x8effe2;_0x1a72b8++){var _0x5396bf=events[_0x1a72b8];var _0x19c452=createListener(_0x55fd('0x6')+_0x5396bf,_0x9df9c6);OpenchannelInteractionEvents['on'](_0x5396bf,_0x19c452);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 631acfb..9e9ef34 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 _0xb9d8=['destroy','path','express','Router','../../components/auth/service','../../config/environment','./openchannelMessage.controller','isAuthenticated','get','describe','/:id','show','post','create','put','update','/:id/accept','accept','/:id/reject','reject','delete'];(function(_0x38d354,_0x322ab7){var _0x2eeb1a=function(_0xba8b8e){while(--_0xba8b8e){_0x38d354['push'](_0x38d354['shift']());}};_0x2eeb1a(++_0x322ab7);}(_0xb9d8,0x166));var _0x8b9d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb9d8[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x8b9d('0x0'));var timeout=require('connect-timeout');var express=require(_0x8b9d('0x1'));var router=express[_0x8b9d('0x2')]();var auth=require(_0x8b9d('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x8b9d('0x4'));var controller=require(_0x8b9d('0x5'));router['get']('/',auth[_0x8b9d('0x6')](),controller['index']);router[_0x8b9d('0x7')]('/describe',auth[_0x8b9d('0x6')](),controller[_0x8b9d('0x8')]);router[_0x8b9d('0x7')](_0x8b9d('0x9'),auth[_0x8b9d('0x6')](),controller[_0x8b9d('0xa')]);router[_0x8b9d('0xb')]('/',auth[_0x8b9d('0x6')](),interaction['tracked']('openchannel','openchannelmessage:create'),controller[_0x8b9d('0xc')]);router[_0x8b9d('0xd')]('/:id',auth[_0x8b9d('0x6')](),controller[_0x8b9d('0xe')]);router[_0x8b9d('0xd')](_0x8b9d('0xf'),auth['isAuthenticated'](),controller[_0x8b9d('0x10')]);router[_0x8b9d('0xd')](_0x8b9d('0x11'),auth[_0x8b9d('0x6')](),controller[_0x8b9d('0x12')]);router[_0x8b9d('0x13')](_0x8b9d('0x9'),auth[_0x8b9d('0x6')](),controller[_0x8b9d('0x14')]);module['exports']=router; \ No newline at end of file +var _0x5159=['path','express','Router','../../components/auth/service','./openchannelMessage.controller','get','isAuthenticated','index','/describe','/:id','show','tracked','openchannel','openchannelmessage:create','put','update','accept','reject','util'];(function(_0x1b4b23,_0x5dd6d6){var _0x2a325b=function(_0x175462){while(--_0x175462){_0x1b4b23['push'](_0x1b4b23['shift']());}};_0x2a325b(++_0x5dd6d6);}(_0x5159,0xbd));var _0x9515=function(_0x29ee22,_0x16804b){_0x29ee22=_0x29ee22-0x0;var _0x4fe7c6=_0x5159[_0x29ee22];return _0x4fe7c6;};'use strict';var multer=require('multer');var util=require(_0x9515('0x0'));var path=require(_0x9515('0x1'));var timeout=require('connect-timeout');var express=require(_0x9515('0x2'));var router=express[_0x9515('0x3')]();var auth=require(_0x9515('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x9515('0x5'));router[_0x9515('0x6')]('/',auth[_0x9515('0x7')](),controller[_0x9515('0x8')]);router[_0x9515('0x6')](_0x9515('0x9'),auth[_0x9515('0x7')](),controller['describe']);router[_0x9515('0x6')](_0x9515('0xa'),auth[_0x9515('0x7')](),controller[_0x9515('0xb')]);router['post']('/',auth[_0x9515('0x7')](),interaction[_0x9515('0xc')](_0x9515('0xd'),_0x9515('0xe')),controller['create']);router[_0x9515('0xf')](_0x9515('0xa'),auth['isAuthenticated'](),controller[_0x9515('0x10')]);router[_0x9515('0xf')]('/:id/accept',auth[_0x9515('0x7')](),controller[_0x9515('0x11')]);router[_0x9515('0xf')]('/:id/reject',auth[_0x9515('0x7')](),controller[_0x9515('0x12')]);router['delete'](_0x9515('0xa'),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 6fd6f0b..4cfb8c7 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 _0x1ef4=['medium','BOOLEAN','ENUM','out','exports'];(function(_0x5bc9c3,_0x4168c4){var _0x758fa6=function(_0x5d99f6){while(--_0x5d99f6){_0x5bc9c3['push'](_0x5bc9c3['shift']());}};_0x758fa6(++_0x4168c4);}(_0x1ef4,0xfe));var _0x41ef=function(_0x28f634,_0x35386f){_0x28f634=_0x28f634-0x0;var _0x10872d=_0x1ef4[_0x28f634];return _0x10872d;};'use strict';var Sequelize=require('sequelize');module[_0x41ef('0x0')]={'body':{'type':Sequelize['TEXT'](_0x41ef('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x41ef('0x2')],'defaultValue':![]},'secret':{'type':Sequelize[_0x41ef('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x41ef('0x3')]('in',_0x41ef('0x4')),'defaultValue':_0x41ef('0x4'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0x5684=['exports','TEXT','BOOLEAN','out','DATE','sequelize'];(function(_0x3f080d,_0x422b47){var _0x2d66d3=function(_0x46e355){while(--_0x46e355){_0x3f080d['push'](_0x3f080d['shift']());}};_0x2d66d3(++_0x422b47);}(_0x5684,0xd7));var _0x4568=function(_0x30967f,_0x2f27d4){_0x30967f=_0x30967f-0x0;var _0x3ed03b=_0x5684[_0x30967f];return _0x3ed03b;};'use strict';var Sequelize=require(_0x4568('0x0'));module[_0x4568('0x1')]={'body':{'type':Sequelize[_0x4568('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x4568('0x3')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0x4568('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0x4568('0x5')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index ffebe72..4bff2aa 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 _0x05ce=['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','localhost','socket.io-emitter','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','request\x20sent','debug','error','OpenchannelMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','name','send','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','order','pick','filter','where','VIRTUAL','options','OpenchannelMessage','includeAll','include','findAll','rows','params','merge','find','create','body','destroy','describe','accept','openchannel','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','OpenchannelInteraction','update','isNil','read1stAt','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','null','AcceptMessage','acceptMessage','interface','SIP/%s','channel','event','openchannel-interactions','OpenchannelInteractionId','RejectMessage','rejectMessage','EventManager','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','lodash','crypto'];(function(_0x455dd2,_0x56e6ef){var _0x13d632=function(_0x4f5a00){while(--_0x4f5a00){_0x455dd2['push'](_0x455dd2['shift']());}};_0x13d632(++_0x56e6ef);}(_0x05ce,0x15b));var _0xe05c=function(_0x426bb4,_0x49edf3){_0x426bb4=_0x426bb4-0x0;var _0x43a334=_0x05ce[_0x426bb4];return _0x43a334;};'use strict';var pdf=require(_0xe05c('0x0'));var emlformat=require(_0xe05c('0x1'));var rimraf=require(_0xe05c('0x2'));var zipdir=require(_0xe05c('0x3'));var jsonpatch=require(_0xe05c('0x4'));var rp=require(_0xe05c('0x5'));var moment=require('moment');var BPromise=require(_0xe05c('0x6'));var Mustache=require(_0xe05c('0x7'));var util=require(_0xe05c('0x8'));var path=require('path');var sox=require(_0xe05c('0x9'));var csv=require(_0xe05c('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xe05c('0xb'));var squel=require('squel');var crypto=require(_0xe05c('0xc'));var jsforce=require(_0xe05c('0xd'));var deskjs=require(_0xe05c('0xe'));var toCsv=require(_0xe05c('0xa'));var querystring=require(_0xe05c('0xf'));var Papa=require(_0xe05c('0x10'));var Redis=require(_0xe05c('0x11'));var authService=require(_0xe05c('0x12'));var qs=require(_0xe05c('0x13'));var as=require(_0xe05c('0x14'));var hardwareService=require(_0xe05c('0x15'));var logger=require(_0xe05c('0x16'))(_0xe05c('0x17'));var utils=require(_0xe05c('0x18'));var config=require(_0xe05c('0x19'));var db=require(_0xe05c('0x1a'))['db'];config[_0xe05c('0x1b')]=_[_0xe05c('0x1c')](config[_0xe05c('0x1b')],{'host':_0xe05c('0x1d'),'port':0x18eb});var socket=require(_0xe05c('0x1e'))(new Redis(config[_0xe05c('0x1b')]));require('./openchannelMessage.socket')['register'](socket);var jayson=require(_0xe05c('0x1f'));var client=jayson[_0xe05c('0x20')][_0xe05c('0x21')]({'port':0x232c});var client9002=jayson[_0xe05c('0x20')][_0xe05c('0x21')]({'port':0x232a});function checkPasswordPattern(_0x3e4da2,_0x24056d,_0x155c27){if(_0x155c27){var _0x2ae336=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2ae336[_0xe05c('0x22')](_0x24056d)){return _0x3e4da2;}else{throw new db[(_0xe05c('0x23'))][(_0xe05c('0x24'))](_0xe05c('0x25'));}}else{return _0x3e4da2;}}function respondWithRpcPromise(_0x267836,_0x5592bd,_0x20c16a,_0x192edf){return new BPromise(function(_0x29e064,_0x527bdc){var _0x29ae32=_0x192edf||client;return _0x29ae32[_0xe05c('0x26')](_0x267836,_0x20c16a)[_0xe05c('0x27')](function(_0x3815b5){logger[_0xe05c('0x28')]('OpenchannelMessage,\x20%s,\x20%s',_0x5592bd,_0xe05c('0x29'));logger[_0xe05c('0x2a')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x5592bd,_0xe05c('0x29'),JSON['stringify'](_0x3815b5));if(_0x3815b5[_0xe05c('0x2b')]){if(_0x3815b5['error']['code']===0x1f4){logger['error'](_0xe05c('0x2c'),_0x5592bd,_0x3815b5[_0xe05c('0x2b')]['message']);return _0x527bdc(_0x3815b5['error'][_0xe05c('0x2d')]);}logger[_0xe05c('0x2b')](_0xe05c('0x2c'),_0x5592bd,_0x3815b5[_0xe05c('0x2b')][_0xe05c('0x2d')]);return _0x29e064(_0x3815b5[_0xe05c('0x2b')][_0xe05c('0x2d')]);}else{logger[_0xe05c('0x28')](_0xe05c('0x2c'),_0x5592bd,'request\x20sent');_0x29e064(_0x3815b5[_0xe05c('0x2e')]['message']);}})[_0xe05c('0x2f')](function(_0x3b3c5e){logger['error'](_0xe05c('0x2c'),_0x5592bd,_0x3b3c5e);_0x527bdc(_0x3b3c5e);});});}function respondWithStatusCode(_0x59a90e,_0x6cfb52){_0x6cfb52=_0x6cfb52||0xcc;return function(_0x56ff89){if(_0x56ff89){return _0x59a90e[_0xe05c('0x30')](_0x6cfb52);}return _0x59a90e[_0xe05c('0x31')](_0x6cfb52)[_0xe05c('0x32')]();};}function respondWithResult(_0x213c65,_0xf0df31){_0xf0df31=_0xf0df31||0xc8;return function(_0x13d819){if(_0x13d819){return _0x213c65[_0xe05c('0x31')](_0xf0df31)[_0xe05c('0x33')](_0x13d819);}};}function respondWithFilteredResult(_0x5bbc66,_0x392db8){return function(_0xa21146){if(_0xa21146){var _0x1ac7f4=_0xa21146[_0xe05c('0x34')],_0x580f00=_0x392db8['offset'],_0x2dbcac=_0x392db8[_0xe05c('0x35')]+_0x392db8[_0xe05c('0x36')],_0x4965a5;if(_0x2dbcac>=_0x1ac7f4){_0x2dbcac=_0x1ac7f4;_0x4965a5=0xc8;}else{_0x4965a5=0xce;}_0x5bbc66[_0xe05c('0x31')](_0x4965a5);return _0x5bbc66[_0xe05c('0x37')](_0xe05c('0x38'),_0x580f00+'-'+_0x2dbcac+'/'+_0x1ac7f4)[_0xe05c('0x33')](_0xa21146);}return null;};}function patchUpdates(_0x2ea97a){return function(_0x28f40c){try{jsonpatch[_0xe05c('0x39')](_0x28f40c,_0x2ea97a,!![]);}catch(_0x4d194f){return BPromise[_0xe05c('0x3a')](_0x4d194f);}return _0x28f40c['save']();};}function saveUpdates(_0x4c5bbc,_0x17831d){return function(_0x8f29ea){if(_0x8f29ea){return _0x8f29ea['update'](_0x4c5bbc)['then'](function(_0x5ac4f3){return _0x5ac4f3;});}return null;};}function removeEntity(_0x379800,_0x3a05c3){return function(_0x24f8c9){if(_0x24f8c9){return _0x24f8c9['destroy']()[_0xe05c('0x27')](function(){_0x379800['status'](0xcc)[_0xe05c('0x32')]();});}};}function handleEntityNotFound(_0x81c197,_0x434abd){return function(_0x588ce6){if(!_0x588ce6){_0x81c197[_0xe05c('0x30')](0x194);}return _0x588ce6;};}function handleError(_0x1a1d5f,_0x2a8960){_0x2a8960=_0x2a8960||0x1f4;return function(_0x2dc3ac){logger[_0xe05c('0x2b')](_0x2dc3ac['stack']);if(_0x2dc3ac['name']){delete _0x2dc3ac[_0xe05c('0x3b')];}_0x1a1d5f[_0xe05c('0x31')](_0x2a8960)[_0xe05c('0x3c')](_0x2dc3ac);};}exports['index']=function(_0x2e2ef5,_0x13217a){var _0x54c4d={},_0x30ad56={},_0x34f65e={'count':0x0,'rows':[]};var _0x106d60=_[_0xe05c('0x3d')](db['OpenchannelMessage'][_0xe05c('0x3e')],function(_0x5a4755){return{'name':_0x5a4755[_0xe05c('0x3f')],'type':_0x5a4755[_0xe05c('0x40')]['key']};});_0x30ad56[_0xe05c('0x41')]=_[_0xe05c('0x3d')](_0x106d60,_0xe05c('0x3b'));_0x30ad56[_0xe05c('0x42')]=_[_0xe05c('0x43')](_0x2e2ef5[_0xe05c('0x42')]);_0x30ad56[_0xe05c('0x44')]=_[_0xe05c('0x45')](_0x30ad56[_0xe05c('0x41')],_0x30ad56[_0xe05c('0x42')]);_0x54c4d[_0xe05c('0x46')]=_[_0xe05c('0x45')](_0x30ad56[_0xe05c('0x41')],qs[_0xe05c('0x47')](_0x2e2ef5['query'][_0xe05c('0x47')]));_0x54c4d['attributes']=_0x54c4d[_0xe05c('0x46')][_0xe05c('0x48')]?_0x54c4d[_0xe05c('0x46')]:_0x30ad56[_0xe05c('0x41')];if(!_0x2e2ef5[_0xe05c('0x42')]['hasOwnProperty']('nolimit')){_0x54c4d['limit']=qs[_0xe05c('0x36')](_0x2e2ef5[_0xe05c('0x42')][_0xe05c('0x36')]);_0x54c4d[_0xe05c('0x35')]=qs[_0xe05c('0x35')](_0x2e2ef5[_0xe05c('0x42')][_0xe05c('0x35')]);}_0x54c4d[_0xe05c('0x49')]=qs['sort'](_0x2e2ef5[_0xe05c('0x42')]['sort']);_0x54c4d['where']=qs['filters'](_[_0xe05c('0x4a')](_0x2e2ef5['query'],_0x30ad56[_0xe05c('0x44')]),_0x106d60);if(_0x2e2ef5[_0xe05c('0x42')][_0xe05c('0x4b')]){_0x54c4d['where']=_['merge'](_0x54c4d[_0xe05c('0x4c')],{'$or':_[_0xe05c('0x3d')](_0x106d60,function(_0x5dec80){if(_0x5dec80[_0xe05c('0x40')]!==_0xe05c('0x4d')){var _0x381317={};_0x381317[_0x5dec80['name']]={'$like':'%'+_0x2e2ef5[_0xe05c('0x42')][_0xe05c('0x4b')]+'%'};return _0x381317;}})});}_0x54c4d=_['merge']({},_0x54c4d,_0x2e2ef5[_0xe05c('0x4e')]);var _0x22ac5a={'where':_0x54c4d[_0xe05c('0x4c')]};return db[_0xe05c('0x4f')][_0xe05c('0x34')](_0x22ac5a)[_0xe05c('0x27')](function(_0x43065f){_0x34f65e[_0xe05c('0x34')]=_0x43065f;if(_0x2e2ef5[_0xe05c('0x42')][_0xe05c('0x50')]){_0x54c4d[_0xe05c('0x51')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0xe05c('0x52')](_0x54c4d);})[_0xe05c('0x27')](function(_0x528b89){_0x34f65e[_0xe05c('0x53')]=_0x528b89;return _0x34f65e;})[_0xe05c('0x27')](respondWithFilteredResult(_0x13217a,_0x54c4d))[_0xe05c('0x2f')](handleError(_0x13217a,null));};exports['show']=function(_0x5c1a01,_0x5bc6f9){var _0x30b3d2={'raw':!![],'where':{'id':_0x5c1a01[_0xe05c('0x54')]['id']}},_0x533a44={};_0x533a44[_0xe05c('0x41')]=_[_0xe05c('0x43')](db[_0xe05c('0x4f')][_0xe05c('0x3e')]);_0x533a44[_0xe05c('0x42')]=_['keys'](_0x5c1a01[_0xe05c('0x42')]);_0x533a44[_0xe05c('0x44')]=_[_0xe05c('0x45')](_0x533a44[_0xe05c('0x41')],_0x533a44[_0xe05c('0x42')]);_0x30b3d2[_0xe05c('0x46')]=_[_0xe05c('0x45')](_0x533a44[_0xe05c('0x41')],qs[_0xe05c('0x47')](_0x5c1a01[_0xe05c('0x42')][_0xe05c('0x47')]));_0x30b3d2[_0xe05c('0x46')]=_0x30b3d2['attributes'][_0xe05c('0x48')]?_0x30b3d2[_0xe05c('0x46')]:_0x533a44[_0xe05c('0x41')];if(_0x5c1a01['query'][_0xe05c('0x50')]){_0x30b3d2[_0xe05c('0x51')]=[{'all':!![]}];}_0x30b3d2=_[_0xe05c('0x55')]({},_0x30b3d2,_0x5c1a01[_0xe05c('0x4e')]);return db[_0xe05c('0x4f')][_0xe05c('0x56')](_0x30b3d2)[_0xe05c('0x27')](handleEntityNotFound(_0x5bc6f9,null))['then'](respondWithResult(_0x5bc6f9,null))[_0xe05c('0x2f')](handleError(_0x5bc6f9,null));};exports[_0xe05c('0x57')]=function(_0x3381bd,_0x2fb6fa){return db[_0xe05c('0x4f')][_0xe05c('0x57')](_0x3381bd[_0xe05c('0x58')],{})[_0xe05c('0x27')](respondWithResult(_0x2fb6fa,0xc9))[_0xe05c('0x2f')](handleError(_0x2fb6fa,null));};exports['update']=function(_0x413e98,_0x595f33){if(_0x413e98[_0xe05c('0x58')]['id']){delete _0x413e98[_0xe05c('0x58')]['id'];}return db[_0xe05c('0x4f')][_0xe05c('0x56')]({'where':{'id':_0x413e98[_0xe05c('0x54')]['id']}})[_0xe05c('0x27')](handleEntityNotFound(_0x595f33,null))[_0xe05c('0x27')](saveUpdates(_0x413e98[_0xe05c('0x58')],null))[_0xe05c('0x27')](respondWithResult(_0x595f33,null))['catch'](handleError(_0x595f33,null));};exports[_0xe05c('0x59')]=function(_0x56ffb3,_0xe4d4bc){return db[_0xe05c('0x4f')]['find']({'where':{'id':_0x56ffb3[_0xe05c('0x54')]['id']}})['then'](handleEntityNotFound(_0xe4d4bc,null))[_0xe05c('0x27')](removeEntity(_0xe4d4bc,null))[_0xe05c('0x2f')](handleError(_0xe4d4bc,null));};exports[_0xe05c('0x5a')]=function(_0x229bf4,_0x2371dc){return db['OpenchannelMessage'][_0xe05c('0x5a')]()[_0xe05c('0x27')](respondWithResult(_0x2371dc,null))['catch'](handleError(_0x2371dc,null));};var interaction_log=require(_0xe05c('0x16'))('openchannel-interactions');exports[_0xe05c('0x5b')]=function(_0x26948b,_0x2e0312,_0x1d9030){var _0x5ae510={'channel':_0xe05c('0x5c')};if(_0x26948b[_0xe05c('0x58')]['id']){delete _0x26948b[_0xe05c('0x58')]['id'];}_0x26948b['body'][_0xe05c('0x5d')]=!![];_0x26948b['body'][_0xe05c('0x5e')]=moment()[_0xe05c('0x5f')](_0xe05c('0x60'));_0x26948b[_0xe05c('0x58')][_0xe05c('0x61')]=_0x26948b[_0xe05c('0x58')]['UserId']||_0x26948b[_0xe05c('0x62')]['id'];return db[_0xe05c('0x4f')][_0xe05c('0x56')]({'where':{'id':_0x26948b[_0xe05c('0x54')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':'Contact'}]})[_0xe05c('0x27')](handleEntityNotFound(_0x2e0312,null))['then'](saveUpdates(_0x26948b[_0xe05c('0x58')],null))[_0xe05c('0x27')](function(_0x455f1e){if(_0x455f1e){_0x5ae510[_0xe05c('0x2d')]=_0x455f1e[_0xe05c('0x63')]({'plain':!![]});return db[_0xe05c('0x64')][_0xe05c('0x56')]({'where':{'id':_0x455f1e['OpenchannelInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x2e0312,null))['then'](function(_0x318b09){if(_0x318b09){return _0x318b09[_0xe05c('0x65')]({'UserId':_0x26948b[_0xe05c('0x58')][_0xe05c('0x61')],'read1stAt':_[_0xe05c('0x66')](_0x318b09[_0xe05c('0x67')])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xe05c('0x27')](function(_0x19bcab){if(_0x19bcab){_0x5ae510[_0xe05c('0x68')]=_0x19bcab[_0xe05c('0x63')]({'plain':!![]});interaction_log[_0xe05c('0x28')](_0xe05c('0x69'),_0x26948b['user']['id'],_0x26948b[_0xe05c('0x62')][_0xe05c('0x3b')],_0x26948b[_0xe05c('0x62')][_0xe05c('0x6a')],_0x5ae510[_0xe05c('0x68')]['id'],_0x26948b[_0xe05c('0x58')]?JSON[_0xe05c('0x6b')](_0x26948b[_0xe05c('0x58')]):_0xe05c('0x6c'));return respondWithRpcPromise(_0xe05c('0x6d'),_0xe05c('0x6e'),_0x5ae510);}return null;})[_0xe05c('0x27')](function(_0x3d099c){if(_0x3d099c){if(_0x26948b[_0xe05c('0x58')]['manual']){_0x5ae510[_0xe05c('0x2d')][_0xe05c('0x6f')]=util[_0xe05c('0x5f')](_0xe05c('0x70'),_0x26948b['user'][_0xe05c('0x3b')]);_0x5ae510['message'][_0xe05c('0x71')]=_0x5ae510[_0xe05c('0x71')];_0x5ae510[_0xe05c('0x2d')][_0xe05c('0x72')]=_0xe05c('0x5b');return respondWithRpcPromise('EventManager','EventManager',{'event':'acceptmessage','message':_0x5ae510[_0xe05c('0x2d')]},client9002)[_0xe05c('0x27')](function(){return _0x5ae510;});}return _0x5ae510;}return null;})['then'](respondWithResult(_0x2e0312,null))[_0xe05c('0x2f')](handleError(_0x2e0312,null));};var interaction_log=require('../../config/logger')(_0xe05c('0x73'));exports[_0xe05c('0x3a')]=function(_0x3c10c7,_0x365644,_0x533019){var _0x1acb5c={'agent':{},'channel':_0xe05c('0x5c')};if(_0x3c10c7[_0xe05c('0x58')]['id']){delete _0x3c10c7[_0xe05c('0x58')]['id'];}_0x3c10c7[_0xe05c('0x58')]['UserId']=_0x3c10c7[_0xe05c('0x58')][_0xe05c('0x61')]||_0x3c10c7[_0xe05c('0x62')]['id'];_0x1acb5c['agent']['id']=_0x3c10c7[_0xe05c('0x58')][_0xe05c('0x61')];return db[_0xe05c('0x4f')][_0xe05c('0x56')]({'where':{'id':_0x3c10c7['params']['id'],'UserId':null}})[_0xe05c('0x27')](handleEntityNotFound(_0x365644,null))['then'](function(_0x3d6bf0){if(_0x3d6bf0){_0x1acb5c[_0xe05c('0x2d')]=_0x3d6bf0['get']({'plain':!![]});return db['OpenchannelInteraction'][_0xe05c('0x56')]({'where':{'id':_0x3d6bf0[_0xe05c('0x74')]}});}return null;})[_0xe05c('0x27')](handleEntityNotFound(_0x365644,null))[_0xe05c('0x27')](function(_0x5c4d58){if(_0x5c4d58){_0x1acb5c[_0xe05c('0x68')]=_0x5c4d58[_0xe05c('0x63')]({'plain':!![]});interaction_log[_0xe05c('0x28')]('[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3c10c7[_0xe05c('0x62')]['id'],_0x3c10c7[_0xe05c('0x62')]['name'],_0x3c10c7['user'][_0xe05c('0x6a')],_0x1acb5c[_0xe05c('0x68')]['id'],_0x3c10c7[_0xe05c('0x58')]?JSON['stringify'](_0x3c10c7['body']):'null');return respondWithRpcPromise(_0xe05c('0x75'),_0xe05c('0x76'),_0x1acb5c);}return null;})[_0xe05c('0x27')](function(_0x293bd9){if(_0x293bd9){_0x293bd9[_0xe05c('0x2d')][_0xe05c('0x6f')]=util[_0xe05c('0x5f')](_0xe05c('0x70'),_0x3c10c7[_0xe05c('0x62')][_0xe05c('0x3b')]);_0x293bd9['message'][_0xe05c('0x71')]=_0x1acb5c[_0xe05c('0x71')];_0x293bd9[_0xe05c('0x2d')][_0xe05c('0x72')]=_0xe05c('0x3a');respondWithRpcPromise(_0xe05c('0x77'),_0xe05c('0x77'),{'event':'rejectmessage','message':_0x293bd9[_0xe05c('0x2d')]},client9002);return _0x1acb5c;}return null;})['then'](respondWithResult(_0x365644,null))['catch'](handleError(_0x365644,null));}; \ No newline at end of file +var _0xa3df=['fieldName','type','key','query','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','include','rows','catch','show','params','keys','includeAll','create','update','body','find','destroy','describe','openchannel-interactions','accept','openchannel','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','get','OpenchannelInteraction','read1stAt','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','acceptMessage','interface','SIP/%s','channel','event','EventManager','acceptmessage','OpenchannelInteractionId','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','socket.io-emitter','./openchannelMessage.socket','register','jayson/promise','client','http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','info','request\x20sent','debug','stringify','error','code','OpenchannelMessage,\x20%s,\x20%s','message','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','then','name','index','map','OpenchannelMessage','rawAttributes'];(function(_0x9a4032,_0x2bff04){var _0x2771a1=function(_0x59a753){while(--_0x59a753){_0x9a4032['push'](_0x9a4032['shift']());}};_0x2771a1(++_0x2bff04);}(_0xa3df,0x1a2));var _0xfa3d=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0xa3df[_0x1b828b];return _0x98da1a;};'use strict';var pdf=require(_0xfa3d('0x0'));var emlformat=require(_0xfa3d('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xfa3d('0x2'));var jsonpatch=require(_0xfa3d('0x3'));var rp=require(_0xfa3d('0x4'));var moment=require(_0xfa3d('0x5'));var BPromise=require(_0xfa3d('0x6'));var Mustache=require('mustache');var util=require(_0xfa3d('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xfa3d('0x8'));var ejs=require(_0xfa3d('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xfa3d('0xa'));var crypto=require(_0xfa3d('0xb'));var jsforce=require(_0xfa3d('0xc'));var deskjs=require(_0xfa3d('0xd'));var toCsv=require(_0xfa3d('0x8'));var querystring=require(_0xfa3d('0xe'));var Papa=require('papaparse');var Redis=require(_0xfa3d('0xf'));var authService=require(_0xfa3d('0x10'));var qs=require(_0xfa3d('0x11'));var as=require(_0xfa3d('0x12'));var hardwareService=require(_0xfa3d('0x13'));var logger=require(_0xfa3d('0x14'))(_0xfa3d('0x15'));var utils=require(_0xfa3d('0x16'));var config=require('../../config/environment');var db=require(_0xfa3d('0x17'))['db'];config[_0xfa3d('0x18')]=_['defaults'](config[_0xfa3d('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0xfa3d('0x19'))(new Redis(config[_0xfa3d('0x18')]));require(_0xfa3d('0x1a'))[_0xfa3d('0x1b')](socket);var jayson=require(_0xfa3d('0x1c'));var client=jayson[_0xfa3d('0x1d')][_0xfa3d('0x1e')]({'port':0x232c});var client9002=jayson[_0xfa3d('0x1d')]['http']({'port':0x232a});function checkPasswordPattern(_0x57cde5,_0x4ab965,_0x1f08a0){if(_0x1f08a0){var _0x46b9ef=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x46b9ef[_0xfa3d('0x1f')](_0x4ab965)){return _0x57cde5;}else{throw new db['Sequelize'][(_0xfa3d('0x20'))](_0xfa3d('0x21'));}}else{return _0x57cde5;}}function respondWithRpcPromise(_0x3557d3,_0x5597b2,_0x1321e0,_0x4dadd5){return new BPromise(function(_0xc22fe8,_0x510245){var _0xc89b37=_0x4dadd5||client;return _0xc89b37['request'](_0x3557d3,_0x1321e0)['then'](function(_0x8d72e8){logger[_0xfa3d('0x22')]('OpenchannelMessage,\x20%s,\x20%s',_0x5597b2,_0xfa3d('0x23'));logger[_0xfa3d('0x24')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x5597b2,'request\x20sent',JSON[_0xfa3d('0x25')](_0x8d72e8));if(_0x8d72e8[_0xfa3d('0x26')]){if(_0x8d72e8[_0xfa3d('0x26')][_0xfa3d('0x27')]===0x1f4){logger[_0xfa3d('0x26')](_0xfa3d('0x28'),_0x5597b2,_0x8d72e8['error']['message']);return _0x510245(_0x8d72e8[_0xfa3d('0x26')][_0xfa3d('0x29')]);}logger['error'](_0xfa3d('0x28'),_0x5597b2,_0x8d72e8['error']['message']);return _0xc22fe8(_0x8d72e8[_0xfa3d('0x26')][_0xfa3d('0x29')]);}else{logger['info'](_0xfa3d('0x28'),_0x5597b2,_0xfa3d('0x23'));_0xc22fe8(_0x8d72e8['result'][_0xfa3d('0x29')]);}})['catch'](function(_0x26d99e){logger[_0xfa3d('0x26')](_0xfa3d('0x28'),_0x5597b2,_0x26d99e);_0x510245(_0x26d99e);});});}function respondWithStatusCode(_0x53b59f,_0x4a57b1){_0x4a57b1=_0x4a57b1||0xcc;return function(_0x30455d){if(_0x30455d){return _0x53b59f[_0xfa3d('0x2a')](_0x4a57b1);}return _0x53b59f[_0xfa3d('0x2b')](_0x4a57b1)[_0xfa3d('0x2c')]();};}function respondWithResult(_0x3c90dd,_0x683b05){_0x683b05=_0x683b05||0xc8;return function(_0x1edb35){if(_0x1edb35){return _0x3c90dd[_0xfa3d('0x2b')](_0x683b05)[_0xfa3d('0x2d')](_0x1edb35);}};}function respondWithFilteredResult(_0x3893c8,_0x39f702){return function(_0x407f40){if(_0x407f40){var _0x30db49=_0x407f40[_0xfa3d('0x2e')],_0x40591a=_0x39f702[_0xfa3d('0x2f')],_0xedaf3d=_0x39f702[_0xfa3d('0x2f')]+_0x39f702['limit'],_0xafa01f;if(_0xedaf3d>=_0x30db49){_0xedaf3d=_0x30db49;_0xafa01f=0xc8;}else{_0xafa01f=0xce;}_0x3893c8[_0xfa3d('0x2b')](_0xafa01f);return _0x3893c8[_0xfa3d('0x30')](_0xfa3d('0x31'),_0x40591a+'-'+_0xedaf3d+'/'+_0x30db49)[_0xfa3d('0x2d')](_0x407f40);}return null;};}function patchUpdates(_0x2ad6be){return function(_0x3a4edf){try{jsonpatch[_0xfa3d('0x32')](_0x3a4edf,_0x2ad6be,!![]);}catch(_0x3d5cc7){return BPromise[_0xfa3d('0x33')](_0x3d5cc7);}return _0x3a4edf['save']();};}function saveUpdates(_0x10629a,_0xc6bf77){return function(_0x563e80){if(_0x563e80){return _0x563e80['update'](_0x10629a)['then'](function(_0x284b29){return _0x284b29;});}return null;};}function removeEntity(_0x2f8a7a,_0x528d9f){return function(_0x3dd3d0){if(_0x3dd3d0){return _0x3dd3d0['destroy']()[_0xfa3d('0x34')](function(){_0x2f8a7a[_0xfa3d('0x2b')](0xcc)[_0xfa3d('0x2c')]();});}};}function handleEntityNotFound(_0x1c7aab,_0x42dda3){return function(_0x5b180b){if(!_0x5b180b){_0x1c7aab[_0xfa3d('0x2a')](0x194);}return _0x5b180b;};}function handleError(_0x1f07ea,_0x486fa0){_0x486fa0=_0x486fa0||0x1f4;return function(_0x2cb007){logger[_0xfa3d('0x26')](_0x2cb007['stack']);if(_0x2cb007[_0xfa3d('0x35')]){delete _0x2cb007[_0xfa3d('0x35')];}_0x1f07ea['status'](_0x486fa0)['send'](_0x2cb007);};}exports[_0xfa3d('0x36')]=function(_0x1a42ad,_0x35278e){var _0x5ef706={},_0x31d03a={},_0x37fbcd={'count':0x0,'rows':[]};var _0xfcd26c=_[_0xfa3d('0x37')](db[_0xfa3d('0x38')][_0xfa3d('0x39')],function(_0x27d717){return{'name':_0x27d717[_0xfa3d('0x3a')],'type':_0x27d717[_0xfa3d('0x3b')][_0xfa3d('0x3c')]};});_0x31d03a['model']=_[_0xfa3d('0x37')](_0xfcd26c,'name');_0x31d03a[_0xfa3d('0x3d')]=_['keys'](_0x1a42ad['query']);_0x31d03a['filters']=_['intersection'](_0x31d03a[_0xfa3d('0x3e')],_0x31d03a[_0xfa3d('0x3d')]);_0x5ef706[_0xfa3d('0x3f')]=_[_0xfa3d('0x40')](_0x31d03a['model'],qs[_0xfa3d('0x41')](_0x1a42ad['query']['fields']));_0x5ef706['attributes']=_0x5ef706['attributes'][_0xfa3d('0x42')]?_0x5ef706[_0xfa3d('0x3f')]:_0x31d03a['model'];if(!_0x1a42ad[_0xfa3d('0x3d')][_0xfa3d('0x43')](_0xfa3d('0x44'))){_0x5ef706[_0xfa3d('0x45')]=qs[_0xfa3d('0x45')](_0x1a42ad[_0xfa3d('0x3d')]['limit']);_0x5ef706['offset']=qs[_0xfa3d('0x2f')](_0x1a42ad[_0xfa3d('0x3d')][_0xfa3d('0x2f')]);}_0x5ef706[_0xfa3d('0x46')]=qs['sort'](_0x1a42ad[_0xfa3d('0x3d')][_0xfa3d('0x47')]);_0x5ef706[_0xfa3d('0x48')]=qs['filters'](_[_0xfa3d('0x49')](_0x1a42ad[_0xfa3d('0x3d')],_0x31d03a[_0xfa3d('0x4a')]),_0xfcd26c);if(_0x1a42ad[_0xfa3d('0x3d')][_0xfa3d('0x4b')]){_0x5ef706[_0xfa3d('0x48')]=_[_0xfa3d('0x4c')](_0x5ef706[_0xfa3d('0x48')],{'$or':_[_0xfa3d('0x37')](_0xfcd26c,function(_0x1ca53c){if(_0x1ca53c[_0xfa3d('0x3b')]!==_0xfa3d('0x4d')){var _0x3c16e6={};_0x3c16e6[_0x1ca53c[_0xfa3d('0x35')]]={'$like':'%'+_0x1a42ad['query'][_0xfa3d('0x4b')]+'%'};return _0x3c16e6;}})});}_0x5ef706=_[_0xfa3d('0x4c')]({},_0x5ef706,_0x1a42ad[_0xfa3d('0x4e')]);var _0x3094a6={'where':_0x5ef706[_0xfa3d('0x48')]};return db['OpenchannelMessage'][_0xfa3d('0x2e')](_0x3094a6)[_0xfa3d('0x34')](function(_0x316e72){_0x37fbcd[_0xfa3d('0x2e')]=_0x316e72;if(_0x1a42ad['query']['includeAll']){_0x5ef706[_0xfa3d('0x4f')]=[{'all':!![]}];}return db[_0xfa3d('0x38')]['findAll'](_0x5ef706);})[_0xfa3d('0x34')](function(_0x20d545){_0x37fbcd[_0xfa3d('0x50')]=_0x20d545;return _0x37fbcd;})[_0xfa3d('0x34')](respondWithFilteredResult(_0x35278e,_0x5ef706))[_0xfa3d('0x51')](handleError(_0x35278e,null));};exports[_0xfa3d('0x52')]=function(_0x518dd0,_0x555949){var _0x5a379d={'raw':!![],'where':{'id':_0x518dd0[_0xfa3d('0x53')]['id']}},_0x2a9b4f={};_0x2a9b4f[_0xfa3d('0x3e')]=_[_0xfa3d('0x54')](db[_0xfa3d('0x38')][_0xfa3d('0x39')]);_0x2a9b4f[_0xfa3d('0x3d')]=_[_0xfa3d('0x54')](_0x518dd0[_0xfa3d('0x3d')]);_0x2a9b4f[_0xfa3d('0x4a')]=_[_0xfa3d('0x40')](_0x2a9b4f[_0xfa3d('0x3e')],_0x2a9b4f[_0xfa3d('0x3d')]);_0x5a379d['attributes']=_[_0xfa3d('0x40')](_0x2a9b4f['model'],qs[_0xfa3d('0x41')](_0x518dd0[_0xfa3d('0x3d')]['fields']));_0x5a379d[_0xfa3d('0x3f')]=_0x5a379d['attributes'][_0xfa3d('0x42')]?_0x5a379d[_0xfa3d('0x3f')]:_0x2a9b4f[_0xfa3d('0x3e')];if(_0x518dd0[_0xfa3d('0x3d')][_0xfa3d('0x55')]){_0x5a379d[_0xfa3d('0x4f')]=[{'all':!![]}];}_0x5a379d=_['merge']({},_0x5a379d,_0x518dd0[_0xfa3d('0x4e')]);return db[_0xfa3d('0x38')]['find'](_0x5a379d)[_0xfa3d('0x34')](handleEntityNotFound(_0x555949,null))['then'](respondWithResult(_0x555949,null))['catch'](handleError(_0x555949,null));};exports['create']=function(_0xd2ed0f,_0x1bfaf3){return db[_0xfa3d('0x38')][_0xfa3d('0x56')](_0xd2ed0f['body'],{})[_0xfa3d('0x34')](respondWithResult(_0x1bfaf3,0xc9))[_0xfa3d('0x51')](handleError(_0x1bfaf3,null));};exports[_0xfa3d('0x57')]=function(_0x4938f0,_0x42ba60){if(_0x4938f0[_0xfa3d('0x58')]['id']){delete _0x4938f0[_0xfa3d('0x58')]['id'];}return db[_0xfa3d('0x38')][_0xfa3d('0x59')]({'where':{'id':_0x4938f0[_0xfa3d('0x53')]['id']}})[_0xfa3d('0x34')](handleEntityNotFound(_0x42ba60,null))[_0xfa3d('0x34')](saveUpdates(_0x4938f0[_0xfa3d('0x58')],null))[_0xfa3d('0x34')](respondWithResult(_0x42ba60,null))[_0xfa3d('0x51')](handleError(_0x42ba60,null));};exports[_0xfa3d('0x5a')]=function(_0x5cc8dd,_0x5d9bcc){return db[_0xfa3d('0x38')][_0xfa3d('0x59')]({'where':{'id':_0x5cc8dd[_0xfa3d('0x53')]['id']}})[_0xfa3d('0x34')](handleEntityNotFound(_0x5d9bcc,null))[_0xfa3d('0x34')](removeEntity(_0x5d9bcc,null))[_0xfa3d('0x51')](handleError(_0x5d9bcc,null));};exports[_0xfa3d('0x5b')]=function(_0x1dec31,_0x5dd3c1){return db[_0xfa3d('0x38')][_0xfa3d('0x5b')]()[_0xfa3d('0x34')](respondWithResult(_0x5dd3c1,null))[_0xfa3d('0x51')](handleError(_0x5dd3c1,null));};var interaction_log=require(_0xfa3d('0x14'))(_0xfa3d('0x5c'));exports[_0xfa3d('0x5d')]=function(_0x470a6f,_0x296f65,_0x327185){var _0x2edc04={'channel':_0xfa3d('0x5e')};if(_0x470a6f[_0xfa3d('0x58')]['id']){delete _0x470a6f[_0xfa3d('0x58')]['id'];}_0x470a6f[_0xfa3d('0x58')]['read']=!![];_0x470a6f[_0xfa3d('0x58')][_0xfa3d('0x5f')]=moment()[_0xfa3d('0x60')](_0xfa3d('0x61'));_0x470a6f[_0xfa3d('0x58')][_0xfa3d('0x62')]=_0x470a6f[_0xfa3d('0x58')]['UserId']||_0x470a6f[_0xfa3d('0x63')]['id'];return db[_0xfa3d('0x38')]['find']({'where':{'id':_0x470a6f[_0xfa3d('0x53')]['id'],'UserId':null},'include':[{'model':db[_0xfa3d('0x64')],'as':_0xfa3d('0x65')}]})[_0xfa3d('0x34')](handleEntityNotFound(_0x296f65,null))[_0xfa3d('0x34')](saveUpdates(_0x470a6f[_0xfa3d('0x58')],null))[_0xfa3d('0x34')](function(_0x3cfddc){if(_0x3cfddc){_0x2edc04[_0xfa3d('0x29')]=_0x3cfddc[_0xfa3d('0x66')]({'plain':!![]});return db[_0xfa3d('0x67')][_0xfa3d('0x59')]({'where':{'id':_0x3cfddc['OpenchannelInteractionId']}});}return null;})[_0xfa3d('0x34')](handleEntityNotFound(_0x296f65,null))[_0xfa3d('0x34')](function(_0x1119c0){if(_0x1119c0){return _0x1119c0['update']({'UserId':_0x470a6f[_0xfa3d('0x58')][_0xfa3d('0x62')],'read1stAt':_['isNil'](_0x1119c0[_0xfa3d('0x68')])?moment()['format'](_0xfa3d('0x61')):undefined});}return null;})['then'](function(_0x4ad432){if(_0x4ad432){_0x2edc04['interaction']=_0x4ad432[_0xfa3d('0x66')]({'plain':!![]});interaction_log[_0xfa3d('0x22')](_0xfa3d('0x69'),_0x470a6f[_0xfa3d('0x63')]['id'],_0x470a6f[_0xfa3d('0x63')][_0xfa3d('0x35')],_0x470a6f['user'][_0xfa3d('0x6a')],_0x2edc04[_0xfa3d('0x6b')]['id'],_0x470a6f[_0xfa3d('0x58')]?JSON[_0xfa3d('0x25')](_0x470a6f['body']):_0xfa3d('0x6c'));return respondWithRpcPromise('AcceptMessage',_0xfa3d('0x6d'),_0x2edc04);}return null;})[_0xfa3d('0x34')](function(_0x52999b){if(_0x52999b){if(_0x470a6f[_0xfa3d('0x58')]['manual']){_0x2edc04['message'][_0xfa3d('0x6e')]=util['format'](_0xfa3d('0x6f'),_0x470a6f[_0xfa3d('0x63')][_0xfa3d('0x35')]);_0x2edc04[_0xfa3d('0x29')][_0xfa3d('0x70')]=_0x2edc04[_0xfa3d('0x70')];_0x2edc04['message'][_0xfa3d('0x71')]=_0xfa3d('0x5d');return respondWithRpcPromise(_0xfa3d('0x72'),'EventManager',{'event':_0xfa3d('0x73'),'message':_0x2edc04[_0xfa3d('0x29')]},client9002)['then'](function(){return _0x2edc04;});}return _0x2edc04;}return null;})['then'](respondWithResult(_0x296f65,null))[_0xfa3d('0x51')](handleError(_0x296f65,null));};var interaction_log=require(_0xfa3d('0x14'))('openchannel-interactions');exports[_0xfa3d('0x33')]=function(_0x4ed029,_0x1f691f,_0xafd60){var _0x537513={'agent':{},'channel':'openchannel'};if(_0x4ed029[_0xfa3d('0x58')]['id']){delete _0x4ed029[_0xfa3d('0x58')]['id'];}_0x4ed029[_0xfa3d('0x58')]['UserId']=_0x4ed029[_0xfa3d('0x58')][_0xfa3d('0x62')]||_0x4ed029['user']['id'];_0x537513['agent']['id']=_0x4ed029['body'][_0xfa3d('0x62')];return db[_0xfa3d('0x38')]['find']({'where':{'id':_0x4ed029['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x1f691f,null))[_0xfa3d('0x34')](function(_0x592fb0){if(_0x592fb0){_0x537513[_0xfa3d('0x29')]=_0x592fb0['get']({'plain':!![]});return db[_0xfa3d('0x67')][_0xfa3d('0x59')]({'where':{'id':_0x592fb0[_0xfa3d('0x74')]}});}return null;})[_0xfa3d('0x34')](handleEntityNotFound(_0x1f691f,null))[_0xfa3d('0x34')](function(_0x2d0852){if(_0x2d0852){_0x537513[_0xfa3d('0x6b')]=_0x2d0852[_0xfa3d('0x66')]({'plain':!![]});interaction_log['info'](_0xfa3d('0x75'),_0x4ed029[_0xfa3d('0x63')]['id'],_0x4ed029['user'][_0xfa3d('0x35')],_0x4ed029[_0xfa3d('0x63')][_0xfa3d('0x6a')],_0x537513[_0xfa3d('0x6b')]['id'],_0x4ed029[_0xfa3d('0x58')]?JSON[_0xfa3d('0x25')](_0x4ed029[_0xfa3d('0x58')]):_0xfa3d('0x6c'));return respondWithRpcPromise('RejectMessage',_0xfa3d('0x76'),_0x537513);}return null;})[_0xfa3d('0x34')](function(_0x2b622b){if(_0x2b622b){_0x2b622b[_0xfa3d('0x29')][_0xfa3d('0x6e')]=util['format'](_0xfa3d('0x6f'),_0x4ed029[_0xfa3d('0x63')][_0xfa3d('0x35')]);_0x2b622b['message'][_0xfa3d('0x70')]=_0x537513[_0xfa3d('0x70')];_0x2b622b[_0xfa3d('0x29')]['event']=_0xfa3d('0x33');respondWithRpcPromise(_0xfa3d('0x72'),_0xfa3d('0x72'),{'event':'rejectmessage','message':_0x2b622b['message']},client9002);return _0x537513;}return null;})[_0xfa3d('0x34')](respondWithResult(_0x1f691f,null))[_0xfa3d('0x51')](handleError(_0x1f691f,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index ad9db55..20fc88c 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 _0x270f=['OpenchannelMessage','save','update','remove','emit','hasOwnProperty','events'];(function(_0x701566,_0x7de6cb){var _0x64b6c9=function(_0x7481f7){while(--_0x7481f7){_0x701566['push'](_0x701566['shift']());}};_0x64b6c9(++_0x7de6cb);}(_0x270f,0xe6));var _0xf270=function(_0x5ef55a,_0x2a03b1){_0x5ef55a=_0x5ef55a-0x0;var _0x20ae40=_0x270f[_0x5ef55a];return _0x20ae40;};'use strict';var EventEmitter=require(_0xf270('0x0'));var OpenchannelMessage=require('../../mysqldb')['db'][_0xf270('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf270('0x2'),'afterUpdate':_0xf270('0x3'),'afterDestroy':_0xf270('0x4')};function emitEvent(_0x56b58b){return function(_0x180186,_0x10c35f,_0xb7d3c5){OpenchannelMessageEvents[_0xf270('0x5')](_0x56b58b+':'+_0x180186['id'],_0x180186);OpenchannelMessageEvents[_0xf270('0x5')](_0x56b58b,_0x180186);_0xb7d3c5(null);};}for(var e in events){if(events[_0xf270('0x6')](e)){var event=events[e];OpenchannelMessage['hook'](e,emitEvent(event));}}module['exports']=OpenchannelMessageEvents; \ No newline at end of file +var _0x3876=['../../mysqldb','OpenchannelMessage','setMaxListeners','save','update','remove','emit','hook','exports'];(function(_0x1b86ac,_0x56fbcf){var _0x8169a3=function(_0x1a5759){while(--_0x1a5759){_0x1b86ac['push'](_0x1b86ac['shift']());}};_0x8169a3(++_0x56fbcf);}(_0x3876,0x99));var _0x6387=function(_0x40d54b,_0x165191){_0x40d54b=_0x40d54b-0x0;var _0x5012c2=_0x3876[_0x40d54b];return _0x5012c2;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require(_0x6387('0x0'))['db'][_0x6387('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x6387('0x2')](0x0);var events={'afterCreate':_0x6387('0x3'),'afterUpdate':_0x6387('0x4'),'afterDestroy':_0x6387('0x5')};function emitEvent(_0x4b0846){return function(_0x36757e,_0x1d6fa3,_0x762b03){OpenchannelMessageEvents['emit'](_0x4b0846+':'+_0x36757e['id'],_0x36757e);OpenchannelMessageEvents[_0x6387('0x6')](_0x4b0846,_0x36757e);_0x762b03(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage[_0x6387('0x7')](e,emitEvent(event));}}module[_0x6387('0x8')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index 3c8df31..674631f 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 _0x700f=['describe','find','OpenchannelAccountId','OpenchannelInteraction','Interactions','Contact','keys','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','length','Interaction','omit','method','GET','POST','Message\x20%d\x20forwarded\x20to\x20%s','threadId','update','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./openchannelMessage.attributes','exports','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','get','direction','toLowerCase','out','secret','UserId','OpenchannelInteractionId','error','CmContact'];(function(_0x5e5cf1,_0x449311){var _0x5a3465=function(_0x564746){while(--_0x564746){_0x5e5cf1['push'](_0x5e5cf1['shift']());}};_0x5a3465(++_0x449311);}(_0x700f,0x1c8));var _0xf700=function(_0x49ac8f,_0x2ea640){_0x49ac8f=_0x49ac8f-0x0;var _0x4a92cc=_0x700f[_0x49ac8f];return _0x4a92cc;};'use strict';var _=require('lodash');var util=require(_0xf700('0x0'));var logger=require(_0xf700('0x1'))(_0xf700('0x2'));var moment=require(_0xf700('0x3'));var BPromise=require(_0xf700('0x4'));var rp=require(_0xf700('0x5'));var fs=require('fs');var path=require(_0xf700('0x6'));var rimraf=require('rimraf');var config=require(_0xf700('0x7'));var attributes=require(_0xf700('0x8'));module[_0xf700('0x9')]=function(_0x7e1c95,_0x3d2420){return _0x7e1c95[_0xf700('0xa')](_0xf700('0xb'),attributes,{'tableName':_0xf700('0xc'),'paranoid':![],'indexes':[{'name':_0xf700('0xd'),'fields':[_0xf700('0xe')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x399021,_0x211620,_0x49dfbb){var _0x285a1f=_0x7e1c95['models'];var _0xcacf0a=_0x399021[_0xf700('0xf')]({'plain':!![]});if(_0xcacf0a[_0xf700('0x10')][_0xf700('0x11')]()==='in'||_0xcacf0a[_0xf700('0x10')][_0xf700('0x11')]()===_0xf700('0x12')&&!_0xcacf0a[_0xf700('0x13')]&&!_['isNil'](_0xcacf0a[_0xf700('0x14')])){_0x285a1f['OpenchannelInteraction']['findOne']({'where':{'id':_0xcacf0a[_0xf700('0x15')]}})['then'](function(_0x36e261){if(_0x36e261){_0x36e261['update']({'lastMsgAt':_0xcacf0a['createdAt'],'lastMsgDirection':_0xcacf0a[_0xf700('0x10')][_0xf700('0x11')]()});}})['catch'](function(_0x8add57){console[_0xf700('0x16')](_0x8add57);});}if(_0xcacf0a[_0xf700('0x10')]==='out'&&!_0xcacf0a['secret']){var _0x31debb;_0x285a1f[_0xf700('0x17')][_0xf700('0x18')]()['then'](function(_0x5bc0bc){return _0x285a1f['OpenchannelAccount'][_0xf700('0x19')]({'where':{'id':_0xcacf0a[_0xf700('0x1a')]},'include':[{'model':_0x285a1f[_0xf700('0x1b')],'as':_0xf700('0x1c'),'where':{'id':_0xcacf0a[_0xf700('0x15')]},'limit':0x1,'include':[{'model':_0x285a1f[_0xf700('0x17')],'as':_0xf700('0x1d'),'attributes':_[_0xf700('0x1e')](_0x5bc0bc)}]}]});})['then'](function(_0x238237){_0x31debb=_0x238237[_0xf700('0xf')]({'plain':!![]});if(_0x31debb&&_0x31debb[_0xf700('0x1f')]){logger[_0xf700('0x20')](_0xf700('0x21'),_0xf700('0x22'),util[_0xf700('0x23')](_0xf700('0x24'),_0xcacf0a['id'],_0x31debb['replyUri']));if(_0x31debb[_0xf700('0x1c')]&&_0x31debb[_0xf700('0x1c')][_0xf700('0x25')]){_0xcacf0a[_0xf700('0x26')]=_[_0xf700('0x27')](_0x31debb[_0xf700('0x1c')][0x0],'Contact');_0xcacf0a[_0xf700('0x1d')]=_0x31debb['Interactions'][0x0][_0xf700('0x1d')];}var _0x211620={'method':'POST','uri':encodeURI(_0x31debb[_0xf700('0x1f')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x211620[_0xf700('0x28')]){case _0xf700('0x29'):_0x211620['qs']=_0xcacf0a;break;case _0xf700('0x2a'):_0x211620[_0xf700('0xe')]=_0xcacf0a;break;}return rp(_0x211620)['then'](function(_0xc62130){logger[_0xf700('0x20')](_0xf700('0x21'),'afterCreate',util[_0xf700('0x23')](_0xf700('0x2b'),_0xcacf0a['id'],_0x31debb[_0xf700('0x1f')]));if(_0xc62130[_0xf700('0xe')][_0xf700('0x2c')]&&_0xc62130[_0xf700('0xe')]['threadId']!=_0xcacf0a['Interaction'][_0xf700('0x2c')]){return _0x285a1f[_0xf700('0x1b')][_0xf700('0x2d')]({'threadId':_0xc62130[_0xf700('0xe')][_0xf700('0x2c')]},{'logging':!![],'where':{'id':_0xcacf0a[_0xf700('0x26')]['id']}});}else{return;}})['then'](function(){return _0x399021[_0xf700('0x2d')]({'read':!![]});})['catch'](function(_0x3536fe){logger[_0xf700('0x16')](_0xf700('0x21'),'afterCreate',util['inspect'](_0x3536fe,{'showHidden':![],'depth':null}));_0x49dfbb();});}else{_0x49dfbb();}})['finally'](function(){_0x49dfbb();});}else{_0x49dfbb();}}},'charset':_0xf700('0x2e'),'collate':_0xf700('0x2f')});}; \ No newline at end of file +var _0x7e00=['findOne','OpenchannelInteractionId','then','update','createdAt','error','CmContact','describe','OpenchannelAccount','find','OpenchannelAccountId','Contact','get','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','format','Forwarding\x20message\x20%d\x20to\x20%s','Interactions','length','Interaction','omit','POST','method','Message\x20%d\x20forwarded\x20to\x20%s','threadId','catch','afterCreate','inspect','utf8mb4','utf8mb4_unicode_ci','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','body','models','direction','toLowerCase','out','secret','isNil','UserId'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x7e00,0x1a7));var _0x07e0=function(_0x3e11db,_0x1e6fdc){_0x3e11db=_0x3e11db-0x0;var _0x53dbbe=_0x7e00[_0x3e11db];return _0x53dbbe;};'use strict';var _=require('lodash');var util=require(_0x07e0('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x07e0('0x1'));var BPromise=require(_0x07e0('0x2'));var rp=require(_0x07e0('0x3'));var fs=require('fs');var path=require(_0x07e0('0x4'));var rimraf=require(_0x07e0('0x5'));var config=require(_0x07e0('0x6'));var attributes=require(_0x07e0('0x7'));module[_0x07e0('0x8')]=function(_0x46d70c,_0x1ac174){return _0x46d70c[_0x07e0('0x9')]('OpenchannelMessage',attributes,{'tableName':'openchannel_messages','paranoid':![],'indexes':[{'name':'fti_openchannel_messages','fields':[_0x07e0('0xa')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4ebe9a,_0x41ac33,_0x3bd1ea){var _0x4ff39b=_0x46d70c[_0x07e0('0xb')];var _0x5b7ed5=_0x4ebe9a['get']({'plain':!![]});if(_0x5b7ed5[_0x07e0('0xc')][_0x07e0('0xd')]()==='in'||_0x5b7ed5[_0x07e0('0xc')][_0x07e0('0xd')]()===_0x07e0('0xe')&&!_0x5b7ed5[_0x07e0('0xf')]&&!_[_0x07e0('0x10')](_0x5b7ed5[_0x07e0('0x11')])){_0x4ff39b['OpenchannelInteraction'][_0x07e0('0x12')]({'where':{'id':_0x5b7ed5[_0x07e0('0x13')]}})[_0x07e0('0x14')](function(_0x54112a){if(_0x54112a){_0x54112a[_0x07e0('0x15')]({'lastMsgAt':_0x5b7ed5[_0x07e0('0x16')],'lastMsgDirection':_0x5b7ed5['direction'][_0x07e0('0xd')]()});}})['catch'](function(_0x5982c5){console[_0x07e0('0x17')](_0x5982c5);});}if(_0x5b7ed5['direction']===_0x07e0('0xe')&&!_0x5b7ed5['secret']){var _0x21f684;_0x4ff39b[_0x07e0('0x18')][_0x07e0('0x19')]()['then'](function(_0x3a9d3b){return _0x4ff39b[_0x07e0('0x1a')][_0x07e0('0x1b')]({'where':{'id':_0x5b7ed5[_0x07e0('0x1c')]},'include':[{'model':_0x4ff39b['OpenchannelInteraction'],'as':'Interactions','where':{'id':_0x5b7ed5['OpenchannelInteractionId']},'limit':0x1,'include':[{'model':_0x4ff39b[_0x07e0('0x18')],'as':_0x07e0('0x1d'),'attributes':_['keys'](_0x3a9d3b)}]}]});})['then'](function(_0x5458fe){_0x21f684=_0x5458fe[_0x07e0('0x1e')]({'plain':!![]});if(_0x21f684&&_0x21f684[_0x07e0('0x1f')]){logger[_0x07e0('0x20')](_0x07e0('0x21'),'afterCreate',util[_0x07e0('0x22')](_0x07e0('0x23'),_0x5b7ed5['id'],_0x21f684['replyUri']));if(_0x21f684[_0x07e0('0x24')]&&_0x21f684[_0x07e0('0x24')][_0x07e0('0x25')]){_0x5b7ed5[_0x07e0('0x26')]=_[_0x07e0('0x27')](_0x21f684['Interactions'][0x0],_0x07e0('0x1d'));_0x5b7ed5[_0x07e0('0x1d')]=_0x21f684[_0x07e0('0x24')][0x0][_0x07e0('0x1d')];}var _0x41ac33={'method':_0x07e0('0x28'),'uri':encodeURI(_0x21f684[_0x07e0('0x1f')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x41ac33[_0x07e0('0x29')]){case'GET':_0x41ac33['qs']=_0x5b7ed5;break;case'POST':_0x41ac33['body']=_0x5b7ed5;break;}return rp(_0x41ac33)[_0x07e0('0x14')](function(_0x36134e){logger[_0x07e0('0x20')](_0x07e0('0x21'),'afterCreate',util[_0x07e0('0x22')](_0x07e0('0x2a'),_0x5b7ed5['id'],_0x21f684['replyUri']));if(_0x36134e[_0x07e0('0xa')][_0x07e0('0x2b')]&&_0x36134e[_0x07e0('0xa')][_0x07e0('0x2b')]!=_0x5b7ed5[_0x07e0('0x26')][_0x07e0('0x2b')]){return _0x4ff39b['OpenchannelInteraction'][_0x07e0('0x15')]({'threadId':_0x36134e[_0x07e0('0xa')][_0x07e0('0x2b')]},{'logging':!![],'where':{'id':_0x5b7ed5['Interaction']['id']}});}else{return;}})[_0x07e0('0x14')](function(){return _0x4ebe9a[_0x07e0('0x15')]({'read':!![]});})[_0x07e0('0x2c')](function(_0x268c51){logger[_0x07e0('0x17')]('OpenchannelMessage,\x20%s,\x20%s',_0x07e0('0x2d'),util[_0x07e0('0x2e')](_0x268c51,{'showHidden':![],'depth':null}));_0x3bd1ea();});}else{_0x3bd1ea();}})['finally'](function(){_0x3bd1ea();});}else{_0x3bd1ea();}}},'charset':_0x07e0('0x2f'),'collate':_0x07e0('0x30')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 41c27f2..726140e 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 _0xbbbc=['CreateOpenchannelMessage','OpenchannelMessage','create','body','options','raw','then','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','request','info','request\x20sent','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','OpenchannelMessage,\x20%s,\x20%s','message','result'];(function(_0x37bd26,_0x5ad346){var _0xe83dc4=function(_0x1ac229){while(--_0x1ac229){_0x37bd26['push'](_0x37bd26['shift']());}};_0xe83dc4(++_0x5ad346);}(_0xbbbc,0xf6));var _0xcbbb=function(_0x24a60f,_0x5ec8de){_0x24a60f=_0x24a60f-0x0;var _0x2ca7ea=_0xbbbc[_0x24a60f];return _0x2ca7ea;};'use strict';var _=require(_0xcbbb('0x0'));var util=require(_0xcbbb('0x1'));var moment=require(_0xcbbb('0x2'));var BPromise=require(_0xcbbb('0x3'));var rs=require(_0xcbbb('0x4'));var fs=require('fs');var Redis=require(_0xcbbb('0x5'));var db=require(_0xcbbb('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xcbbb('0x7'))(_0xcbbb('0x8'));var config=require(_0xcbbb('0x9'));var jayson=require(_0xcbbb('0xa'));var client=jayson[_0xcbbb('0xb')]['http']({'port':0x232a});config[_0xcbbb('0xc')]=_[_0xcbbb('0xd')](config[_0xcbbb('0xc')],{'host':_0xcbbb('0xe'),'port':0x18eb});var socket=require(_0xcbbb('0xf'))(new Redis(config[_0xcbbb('0xc')]));require(_0xcbbb('0x10'))['register'](socket);function respondWithRpcPromise(_0x225156,_0x4b0138,_0x5893f9){return new BPromise(function(_0x107c35,_0x56c7d0){return client[_0xcbbb('0x11')](_0x225156,_0x5893f9)['then'](function(_0x3766c2){logger[_0xcbbb('0x12')]('OpenchannelMessage,\x20%s,\x20%s',_0x4b0138,_0xcbbb('0x13'));logger['debug'](_0xcbbb('0x14'),_0x4b0138,'request\x20sent',JSON[_0xcbbb('0x15')](_0x3766c2));if(_0x3766c2[_0xcbbb('0x16')]){if(_0x3766c2[_0xcbbb('0x16')]['code']===0x1f4){logger[_0xcbbb('0x16')](_0xcbbb('0x17'),_0x4b0138,_0x3766c2[_0xcbbb('0x16')][_0xcbbb('0x18')]);return _0x56c7d0(_0x3766c2['error']['message']);}logger[_0xcbbb('0x16')](_0xcbbb('0x17'),_0x4b0138,_0x3766c2[_0xcbbb('0x16')][_0xcbbb('0x18')]);return _0x107c35(_0x3766c2['error'][_0xcbbb('0x18')]);}else{logger['info'](_0xcbbb('0x17'),_0x4b0138,_0xcbbb('0x13'));_0x107c35(_0x3766c2[_0xcbbb('0x19')]['message']);}})['catch'](function(_0x4bcd9a){logger[_0xcbbb('0x16')](_0xcbbb('0x17'),_0x4b0138,_0x4bcd9a);_0x56c7d0(_0x4bcd9a);});});}exports[_0xcbbb('0x1a')]=function(_0x25e92f){var _0x658337=this;return new Promise(function(_0x1cca90,_0x45de5f){return db[_0xcbbb('0x1b')][_0xcbbb('0x1c')](_0x25e92f[_0xcbbb('0x1d')],{'raw':_0x25e92f['options']?_0x25e92f[_0xcbbb('0x1e')][_0xcbbb('0x1f')]===undefined?!![]:![]:!![]})[_0xcbbb('0x20')](function(_0x42aaf1){logger[_0xcbbb('0x12')](_0xcbbb('0x1a'),_0x25e92f);logger[_0xcbbb('0x21')](_0xcbbb('0x1a'),_0x25e92f,JSON[_0xcbbb('0x15')](_0x42aaf1));_0x1cca90(_0x42aaf1);})['catch'](function(_0xf39ddd){logger[_0xcbbb('0x16')]('CreateOpenchannelMessage',_0xf39ddd[_0xcbbb('0x18')],_0x25e92f);_0x45de5f(_0x658337['error'](0x1f4,_0xf39ddd['message']));});});}; \ No newline at end of file +var _0x56b9=['moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','request','then','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','create','body','options','raw','CreateOpenchannelMessage','lodash','util'];(function(_0xd93cbe,_0x11202e){var _0xe0bb40=function(_0x50f4cc){while(--_0x50f4cc){_0xd93cbe['push'](_0xd93cbe['shift']());}};_0xe0bb40(++_0x11202e);}(_0x56b9,0x196));var _0x956b=function(_0x568f96,_0x32d489){_0x568f96=_0x568f96-0x0;var _0x5a053a=_0x56b9[_0x568f96];return _0x5a053a;};'use strict';var _=require(_0x956b('0x0'));var util=require(_0x956b('0x1'));var moment=require(_0x956b('0x2'));var BPromise=require(_0x956b('0x3'));var rs=require(_0x956b('0x4'));var fs=require('fs');var Redis=require(_0x956b('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x956b('0x6'));var logger=require('../../config/logger')(_0x956b('0x7'));var config=require(_0x956b('0x8'));var jayson=require(_0x956b('0x9'));var client=jayson['client'][_0x956b('0xa')]({'port':0x232a});config[_0x956b('0xb')]=_[_0x956b('0xc')](config[_0x956b('0xb')],{'host':_0x956b('0xd'),'port':0x18eb});var socket=require(_0x956b('0xe'))(new Redis(config[_0x956b('0xb')]));require(_0x956b('0xf'))['register'](socket);function respondWithRpcPromise(_0x3a48c6,_0x14336a,_0x5e2cb3){return new BPromise(function(_0x2cb25a,_0x36617d){return client[_0x956b('0x10')](_0x3a48c6,_0x5e2cb3)[_0x956b('0x11')](function(_0x69504e){logger['info'](_0x956b('0x12'),_0x14336a,_0x956b('0x13'));logger[_0x956b('0x14')](_0x956b('0x15'),_0x14336a,_0x956b('0x13'),JSON[_0x956b('0x16')](_0x69504e));if(_0x69504e[_0x956b('0x17')]){if(_0x69504e[_0x956b('0x17')][_0x956b('0x18')]===0x1f4){logger[_0x956b('0x17')](_0x956b('0x12'),_0x14336a,_0x69504e['error'][_0x956b('0x19')]);return _0x36617d(_0x69504e[_0x956b('0x17')][_0x956b('0x19')]);}logger['error'](_0x956b('0x12'),_0x14336a,_0x69504e[_0x956b('0x17')][_0x956b('0x19')]);return _0x2cb25a(_0x69504e[_0x956b('0x17')][_0x956b('0x19')]);}else{logger[_0x956b('0x1a')](_0x956b('0x12'),_0x14336a,'request\x20sent');_0x2cb25a(_0x69504e[_0x956b('0x1b')][_0x956b('0x19')]);}})[_0x956b('0x1c')](function(_0x4f724b){logger[_0x956b('0x17')](_0x956b('0x12'),_0x14336a,_0x4f724b);_0x36617d(_0x4f724b);});});}exports['CreateOpenchannelMessage']=function(_0x5dc7e0){var _0x1cb9fd=this;return new Promise(function(_0x218974,_0x21fee6){return db['OpenchannelMessage'][_0x956b('0x1d')](_0x5dc7e0[_0x956b('0x1e')],{'raw':_0x5dc7e0[_0x956b('0x1f')]?_0x5dc7e0[_0x956b('0x1f')][_0x956b('0x20')]===undefined?!![]:![]:!![]})[_0x956b('0x11')](function(_0x4ad9bb){logger[_0x956b('0x1a')](_0x956b('0x21'),_0x5dc7e0);logger[_0x956b('0x14')](_0x956b('0x21'),_0x5dc7e0,JSON[_0x956b('0x16')](_0x4ad9bb));_0x218974(_0x4ad9bb);})[_0x956b('0x1c')](function(_0x9ce16){logger[_0x956b('0x17')](_0x956b('0x21'),_0x9ce16[_0x956b('0x19')],_0x5dc7e0);_0x21fee6(_0x1cb9fd[_0x956b('0x17')](0x1f4,_0x9ce16['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 1dc6871..0500b93 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 _0xb43b=['./openchannelMessage.events','save','update','emit','removeListener','length','openchannelMessage:'];(function(_0x116c04,_0x4963da){var _0x9e011d=function(_0x143880){while(--_0x143880){_0x116c04['push'](_0x116c04['shift']());}};_0x9e011d(++_0x4963da);}(_0xb43b,0x1b2));var _0xbb43=function(_0x3e4def,_0x12301a){_0x3e4def=_0x3e4def-0x0;var _0x7360cb=_0xb43b[_0x3e4def];return _0x7360cb;};'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 +var _0xcb91=['remove','update','emit','removeListener','register'];(function(_0x587d7b,_0x211999){var _0xf69f37=function(_0x2acc01){while(--_0x2acc01){_0x587d7b['push'](_0x587d7b['shift']());}};_0xf69f37(++_0x211999);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x3fe6df,_0x5a04d4){_0x3fe6df=_0x3fe6df-0x0;var _0x372a0e=_0xcb91[_0x3fe6df];return _0x372a0e;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=['save',_0x1cb9('0x0'),_0x1cb9('0x1')];function createListener(_0x17d4ec,_0x22c4b8){return function(_0x4c37e8){_0x22c4b8[_0x1cb9('0x2')](_0x17d4ec,_0x4c37e8);};}function removeListener(_0x2c17b8,_0x545a34){return function(){OpenchannelMessageEvents[_0x1cb9('0x3')](_0x2c17b8,_0x545a34);};}exports[_0x1cb9('0x4')]=function(_0x53ffbd){for(var _0x226b69=0x0,_0x3f7deb=events['length'];_0x226b69<_0x3f7deb;_0x226b69++){var _0x38737d=events[_0x226b69];var _0x12567c=createListener('openchannelMessage:'+_0x38737d,_0x53ffbd);OpenchannelMessageEvents['on'](_0x38737d,_0x12567c);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 00b4843..dcf2473 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 _0x8ef6=['../../components/auth/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','getAgents','post','create','addTeams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x3c9ff9,_0x3255a0){var _0x34a960=function(_0x36e310){while(--_0x36e310){_0x3c9ff9['push'](_0x3c9ff9['shift']());}};_0x34a960(++_0x3255a0);}(_0x8ef6,0xf2));var _0x68ef=function(_0x8c8b0e,_0x58cdb4){_0x8c8b0e=_0x8c8b0e-0x0;var _0xfc9e21=_0x8ef6[_0x8c8b0e];return _0xfc9e21;};'use strict';var multer=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var path=require(_0x68ef('0x2'));var timeout=require(_0x68ef('0x3'));var express=require(_0x68ef('0x4'));var router=express[_0x68ef('0x5')]();var auth=require(_0x68ef('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x68ef('0x7'));var controller=require(_0x68ef('0x8'));router[_0x68ef('0x9')]('/',auth[_0x68ef('0xa')](),controller['index']);router['get'](_0x68ef('0xb'),auth[_0x68ef('0xa')](),controller[_0x68ef('0xc')]);router['get'](_0x68ef('0xd'),auth[_0x68ef('0xa')](),controller[_0x68ef('0xe')]);router[_0x68ef('0x9')](_0x68ef('0xf'),auth[_0x68ef('0xa')](),controller[_0x68ef('0x10')]);router[_0x68ef('0x9')](_0x68ef('0x11'),auth[_0x68ef('0xa')](),controller[_0x68ef('0x12')]);router[_0x68ef('0x9')]('/:id/users',auth[_0x68ef('0xa')](),controller[_0x68ef('0x13')]);router[_0x68ef('0x14')]('/',auth[_0x68ef('0xa')](),controller[_0x68ef('0x15')]);router[_0x68ef('0x14')]('/:id/teams',auth[_0x68ef('0xa')](),controller[_0x68ef('0x16')]);router[_0x68ef('0x14')]('/:id/users',auth[_0x68ef('0xa')](),controller[_0x68ef('0x17')]);router[_0x68ef('0x18')]('/:id',auth[_0x68ef('0xa')](),controller[_0x68ef('0x19')]);router[_0x68ef('0x1a')](_0x68ef('0xd'),auth['isAuthenticated'](),controller[_0x68ef('0x1b')]);router['delete']('/:id/teams',auth[_0x68ef('0xa')](),controller[_0x68ef('0x1c')]);router['delete']('/:id/users',auth[_0x68ef('0xa')](),controller[_0x68ef('0x1d')]);module[_0x68ef('0x1e')]=router; \ No newline at end of file +var _0x56a6=['/:id/members','getMembers','/:id/teams','getTeams','post','create','addTeams','/:id/users','addAgents','put','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x11adfa,_0x36ea57){var _0x1e68a9=function(_0x165ca8){while(--_0x165ca8){_0x11adfa['push'](_0x11adfa['shift']());}};_0x1e68a9(++_0x36ea57);}(_0x56a6,0x17b));var _0x656a=function(_0x2af855,_0x2b5341){_0x2af855=_0x2af855-0x0;var _0x442953=_0x56a6[_0x2af855];return _0x442953;};'use strict';var multer=require(_0x656a('0x0'));var util=require(_0x656a('0x1'));var path=require(_0x656a('0x2'));var timeout=require(_0x656a('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x656a('0x4'));var interaction=require(_0x656a('0x5'));var config=require(_0x656a('0x6'));var controller=require('./openchannelQueue.controller');router[_0x656a('0x7')]('/',auth[_0x656a('0x8')](),controller[_0x656a('0x9')]);router['get'](_0x656a('0xa'),auth[_0x656a('0x8')](),controller[_0x656a('0xb')]);router['get'](_0x656a('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x656a('0x7')](_0x656a('0xd'),auth[_0x656a('0x8')](),controller[_0x656a('0xe')]);router['get'](_0x656a('0xf'),auth[_0x656a('0x8')](),controller[_0x656a('0x10')]);router[_0x656a('0x7')]('/:id/users',auth['isAuthenticated'](),controller['getAgents']);router[_0x656a('0x11')]('/',auth[_0x656a('0x8')](),controller[_0x656a('0x12')]);router[_0x656a('0x11')](_0x656a('0xf'),auth['isAuthenticated'](),controller[_0x656a('0x13')]);router[_0x656a('0x11')](_0x656a('0x14'),auth[_0x656a('0x8')](),controller[_0x656a('0x15')]);router[_0x656a('0x16')](_0x656a('0xc'),auth[_0x656a('0x8')](),controller['update']);router[_0x656a('0x17')](_0x656a('0xc'),auth[_0x656a('0x8')](),controller[_0x656a('0x18')]);router[_0x656a('0x17')](_0x656a('0xf'),auth[_0x656a('0x8')](),controller[_0x656a('0x19')]);router[_0x656a('0x17')]('/:id/users',auth[_0x656a('0x8')](),controller[_0x656a('0x1a')]);module[_0x656a('0x1b')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index d395637..44bfbf1 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 _0xa5ab=['STRING','INTEGER','ENUM','roundrobin','sequelize','exports','name'];(function(_0x308e65,_0x50dd49){var _0x187503=function(_0x35fb84){while(--_0x35fb84){_0x308e65['push'](_0x308e65['shift']());}};_0x187503(++_0x50dd49);}(_0xa5ab,0xf2));var _0xba5a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa5ab[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xba5a('0x0'));module[_0xba5a('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xba5a('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xba5a('0x3')]},'timeout':{'type':Sequelize[_0xba5a('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xba5a('0x5')]('rrmemory','beepall',_0xba5a('0x6'))}}; \ No newline at end of file +var _0x8c6c=['roundrobin','sequelize','exports','name','INTEGER','beepall'];(function(_0x5130a4,_0x471208){var _0x31a37b=function(_0x289f0c){while(--_0x289f0c){_0x5130a4['push'](_0x5130a4['shift']());}};_0x31a37b(++_0x471208);}(_0x8c6c,0x133));var _0xc8c6=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x8c6c[_0x4b369d];return _0x571a98;};'use strict';var Sequelize=require(_0xc8c6('0x0'));module[_0xc8c6('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xc8c6('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xc8c6('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory',_0xc8c6('0x4'),_0xc8c6('0x5'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index b211726..2a75605 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 _0x3304=['fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','defaults','redis','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','status','json','count','offset','limit','set','Content-Range','save','update','destroy','get','OpenchannelQueues','UserProfileResource','then','end','stack','name','send','index','map','OpenchannelQueue','rawAttributes','fieldName','type','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','show','keys','options','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','error','body','params','describe','getMembers','findOne','UserOpenchannelQueue','pick','OpenchannelQueueId','User','findAndCountAll','UserId','agent','updatedAt','createdAt','format','%s/%s','Team','getTeams','ids','Agents','online','voicePause','interface','transaction','each','findOrCreate','forEach','emit','select','field','tq.TeamId','from','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','userOpenchannelQueue:save','isArray','getAgents','html-pdf','eml-format','zip-dir'];(function(_0x271973,_0x610a4b){var _0x4cc73f=function(_0x318856){while(--_0x318856){_0x271973['push'](_0x271973['shift']());}};_0x4cc73f(++_0x610a4b);}(_0x3304,0x1a1));var _0x4330=function(_0x5eb729,_0x282b42){_0x5eb729=_0x5eb729-0x0;var _0x432683=_0x3304[_0x5eb729];return _0x432683;};'use strict';var pdf=require(_0x4330('0x0'));var emlformat=require(_0x4330('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x4330('0x2'));var jsonpatch=require(_0x4330('0x3'));var rp=require(_0x4330('0x4'));var moment=require(_0x4330('0x5'));var BPromise=require(_0x4330('0x6'));var Mustache=require(_0x4330('0x7'));var util=require('util');var path=require('path');var sox=require(_0x4330('0x8'));var csv=require(_0x4330('0x9'));var ejs=require(_0x4330('0xa'));var fs=require('fs');var _=require(_0x4330('0xb'));var squel=require(_0x4330('0xc'));var crypto=require('crypto');var jsforce=require(_0x4330('0xd'));var deskjs=require(_0x4330('0xe'));var toCsv=require(_0x4330('0x9'));var querystring=require('querystring');var Papa=require(_0x4330('0xf'));var Redis=require(_0x4330('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x4330('0x11'));var as=require(_0x4330('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4330('0x13'))(_0x4330('0x14'));var utils=require(_0x4330('0x15'));var config=require('../../config/environment');var db=require(_0x4330('0x16'))['db'];config['redis']=_[_0x4330('0x17')](config[_0x4330('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x4330('0x19'))(new Redis(config[_0x4330('0x18')]));require(_0x4330('0x1a'))[_0x4330('0x1b')](socket);function respondWithStatusCode(_0x590096,_0x1c7147){_0x1c7147=_0x1c7147||0xcc;return function(_0x15f313){if(_0x15f313){return _0x590096[_0x4330('0x1c')](_0x1c7147);}return _0x590096[_0x4330('0x1d')](_0x1c7147)['end']();};}function respondWithResult(_0x555284,_0x26ff5f){_0x26ff5f=_0x26ff5f||0xc8;return function(_0xb8a4e5){if(_0xb8a4e5){return _0x555284[_0x4330('0x1d')](_0x26ff5f)[_0x4330('0x1e')](_0xb8a4e5);}};}function respondWithFilteredResult(_0x3da76b,_0x462427){return function(_0x928374){if(_0x928374){var _0x3b21c8=_0x928374[_0x4330('0x1f')],_0x5be06c=_0x462427[_0x4330('0x20')],_0x84ceaf=_0x462427[_0x4330('0x20')]+_0x462427[_0x4330('0x21')],_0x39d757;if(_0x84ceaf>=_0x3b21c8){_0x84ceaf=_0x3b21c8;_0x39d757=0xc8;}else{_0x39d757=0xce;}_0x3da76b[_0x4330('0x1d')](_0x39d757);return _0x3da76b[_0x4330('0x22')](_0x4330('0x23'),_0x5be06c+'-'+_0x84ceaf+'/'+_0x3b21c8)[_0x4330('0x1e')](_0x928374);}return null;};}function patchUpdates(_0x3be7f3){return function(_0x3647c9){try{jsonpatch['apply'](_0x3647c9,_0x3be7f3,!![]);}catch(_0x540855){return BPromise['reject'](_0x540855);}return _0x3647c9[_0x4330('0x24')]();};}function saveUpdates(_0x136c66,_0x34436d){return function(_0x189c21){if(_0x189c21){return _0x189c21[_0x4330('0x25')](_0x136c66)['then'](function(_0x4943b6){return _0x4943b6;});}return null;};}function removeEntity(_0x3a823a,_0x4439b8){return function(_0x17af9b){if(_0x17af9b){return _0x17af9b[_0x4330('0x26')]()['then'](function(){var _0x580532=_0x17af9b[_0x4330('0x27')]({'plain':!![]});var _0x16aa35=_0x4330('0x28');return db[_0x4330('0x29')][_0x4330('0x26')]({'where':{'type':_0x16aa35,'resourceId':_0x580532['id']}})[_0x4330('0x2a')](function(){return _0x17af9b;});})[_0x4330('0x2a')](function(){_0x3a823a[_0x4330('0x1d')](0xcc)[_0x4330('0x2b')]();});}};}function handleEntityNotFound(_0x3b0959,_0x4358ba){return function(_0x14992c){if(!_0x14992c){_0x3b0959['sendStatus'](0x194);}return _0x14992c;};}function handleError(_0x2add35,_0x558409){_0x558409=_0x558409||0x1f4;return function(_0x119eeb){logger['error'](_0x119eeb[_0x4330('0x2c')]);if(_0x119eeb[_0x4330('0x2d')]){delete _0x119eeb[_0x4330('0x2d')];}_0x2add35[_0x4330('0x1d')](_0x558409)[_0x4330('0x2e')](_0x119eeb);};}exports[_0x4330('0x2f')]=function(_0x20c53c,_0x25d687){var _0x42b1d9={},_0x1259ad={},_0x22b9f7={'count':0x0,'rows':[]};var _0xe2b595=_[_0x4330('0x30')](db[_0x4330('0x31')][_0x4330('0x32')],function(_0x12ed67){return{'name':_0x12ed67[_0x4330('0x33')],'type':_0x12ed67[_0x4330('0x34')]['key']};});_0x1259ad['model']=_[_0x4330('0x30')](_0xe2b595,'name');_0x1259ad[_0x4330('0x35')]=_['keys'](_0x20c53c[_0x4330('0x35')]);_0x1259ad[_0x4330('0x36')]=_[_0x4330('0x37')](_0x1259ad[_0x4330('0x38')],_0x1259ad['query']);_0x42b1d9['attributes']=_[_0x4330('0x37')](_0x1259ad[_0x4330('0x38')],qs[_0x4330('0x39')](_0x20c53c['query'][_0x4330('0x39')]));_0x42b1d9[_0x4330('0x3a')]=_0x42b1d9[_0x4330('0x3a')][_0x4330('0x3b')]?_0x42b1d9[_0x4330('0x3a')]:_0x1259ad[_0x4330('0x38')];if(!_0x20c53c[_0x4330('0x35')][_0x4330('0x3c')](_0x4330('0x3d'))){_0x42b1d9[_0x4330('0x21')]=qs[_0x4330('0x21')](_0x20c53c[_0x4330('0x35')]['limit']);_0x42b1d9[_0x4330('0x20')]=qs['offset'](_0x20c53c[_0x4330('0x35')]['offset']);}_0x42b1d9[_0x4330('0x3e')]=qs[_0x4330('0x3f')](_0x20c53c['query'][_0x4330('0x3f')]);_0x42b1d9['where']=qs[_0x4330('0x36')](_['pick'](_0x20c53c['query'],_0x1259ad[_0x4330('0x36')]),_0xe2b595);if(_0x20c53c[_0x4330('0x35')][_0x4330('0x40')]){_0x42b1d9[_0x4330('0x41')]=_[_0x4330('0x42')](_0x42b1d9['where'],{'$or':_[_0x4330('0x30')](_0xe2b595,function(_0x2842a0){if(_0x2842a0[_0x4330('0x34')]!==_0x4330('0x43')){var _0x1bb771={};_0x1bb771[_0x2842a0[_0x4330('0x2d')]]={'$like':'%'+_0x20c53c[_0x4330('0x35')][_0x4330('0x40')]+'%'};return _0x1bb771;}})});}_0x42b1d9=_[_0x4330('0x42')]({},_0x42b1d9,_0x20c53c['options']);var _0x3100c8={'where':_0x42b1d9[_0x4330('0x41')]};return db['OpenchannelQueue'][_0x4330('0x1f')](_0x3100c8)[_0x4330('0x2a')](function(_0x17ea7c){_0x22b9f7[_0x4330('0x1f')]=_0x17ea7c;if(_0x20c53c[_0x4330('0x35')][_0x4330('0x44')]){_0x42b1d9[_0x4330('0x45')]=[{'all':!![]}];}return db[_0x4330('0x31')][_0x4330('0x46')](_0x42b1d9);})['then'](function(_0xe90515){_0x22b9f7[_0x4330('0x47')]=_0xe90515;return _0x22b9f7;})[_0x4330('0x2a')](respondWithFilteredResult(_0x25d687,_0x42b1d9))['catch'](handleError(_0x25d687,null));};exports[_0x4330('0x48')]=function(_0x9dc95b,_0x3e3cb2){var _0x389262={'raw':!![],'where':{'id':_0x9dc95b['params']['id']}},_0x22b5df={};_0x22b5df['model']=_[_0x4330('0x49')](db[_0x4330('0x31')]['rawAttributes']);_0x22b5df['query']=_[_0x4330('0x49')](_0x9dc95b[_0x4330('0x35')]);_0x22b5df['filters']=_['intersection'](_0x22b5df[_0x4330('0x38')],_0x22b5df[_0x4330('0x35')]);_0x389262[_0x4330('0x3a')]=_[_0x4330('0x37')](_0x22b5df[_0x4330('0x38')],qs[_0x4330('0x39')](_0x9dc95b[_0x4330('0x35')][_0x4330('0x39')]));_0x389262['attributes']=_0x389262[_0x4330('0x3a')][_0x4330('0x3b')]?_0x389262['attributes']:_0x22b5df[_0x4330('0x38')];if(_0x9dc95b[_0x4330('0x35')][_0x4330('0x44')]){_0x389262['include']=[{'all':!![]}];}_0x389262=_[_0x4330('0x42')]({},_0x389262,_0x9dc95b[_0x4330('0x4a')]);return db[_0x4330('0x31')][_0x4330('0x4b')](_0x389262)[_0x4330('0x2a')](handleEntityNotFound(_0x3e3cb2,null))['then'](respondWithResult(_0x3e3cb2,null))[_0x4330('0x4c')](handleError(_0x3e3cb2,null));};exports[_0x4330('0x4d')]=function(_0x3ea336,_0x27f8c7){return db[_0x4330('0x31')][_0x4330('0x4d')](_0x3ea336['body'],{})[_0x4330('0x2a')](function(_0x2b3482){var _0x29927c=_0x3ea336[_0x4330('0x4e')][_0x4330('0x27')]({'plain':!![]});if(!_0x29927c)throw new Error(_0x4330('0x4f'));if(_0x29927c['role']==='user'){var _0x18593c=_0x2b3482[_0x4330('0x27')]({'plain':!![]});var _0x3e874b=_0x4330('0x28');return db[_0x4330('0x50')][_0x4330('0x4b')]({'where':{'name':_0x3e874b,'userProfileId':_0x29927c[_0x4330('0x51')]},'raw':!![]})[_0x4330('0x2a')](function(_0x116138){if(_0x116138&&_0x116138['autoAssociation']===0x0){return db[_0x4330('0x29')]['create']({'name':_0x18593c['name'],'resourceId':_0x18593c['id'],'type':_0x116138[_0x4330('0x2d')],'sectionId':_0x116138['id']},{})[_0x4330('0x2a')](function(){return _0x2b3482;});}else{return _0x2b3482;}})[_0x4330('0x4c')](function(_0x883a03){logger[_0x4330('0x52')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x883a03);throw _0x883a03;});}return _0x2b3482;})[_0x4330('0x2a')](respondWithResult(_0x27f8c7,0xc9))['catch'](handleError(_0x27f8c7,null));};exports[_0x4330('0x25')]=function(_0x21d1a1,_0x2f6e3a){if(_0x21d1a1[_0x4330('0x53')]['id']){delete _0x21d1a1[_0x4330('0x53')]['id'];}return db[_0x4330('0x31')][_0x4330('0x4b')]({'where':{'id':_0x21d1a1['params']['id']}})['then'](handleEntityNotFound(_0x2f6e3a,null))['then'](saveUpdates(_0x21d1a1[_0x4330('0x53')],null))['then'](respondWithResult(_0x2f6e3a,null))[_0x4330('0x4c')](handleError(_0x2f6e3a,null));};exports[_0x4330('0x26')]=function(_0x5c156f,_0x28d2b5){return db[_0x4330('0x31')][_0x4330('0x4b')]({'where':{'id':_0x5c156f[_0x4330('0x54')]['id']}})[_0x4330('0x2a')](handleEntityNotFound(_0x28d2b5,null))[_0x4330('0x2a')](removeEntity(_0x28d2b5,null))[_0x4330('0x4c')](handleError(_0x28d2b5,null));};exports[_0x4330('0x55')]=function(_0x52aa7c,_0x103221){return db[_0x4330('0x31')][_0x4330('0x55')]()[_0x4330('0x2a')](respondWithResult(_0x103221,null))[_0x4330('0x4c')](handleError(_0x103221,null));};exports[_0x4330('0x56')]=function(_0x97744d,_0x3c2618,_0x38c48d){var _0x1ee4c9={'raw':!![],'where':{}},_0x57bde1={},_0xdbc22b;return db['OpenchannelQueue'][_0x4330('0x57')]({'where':{'id':_0x97744d['params']['id']}})[_0x4330('0x2a')](handleEntityNotFound(_0x3c2618,null))[_0x4330('0x2a')](function(_0x3d1cfb){if(_0x3d1cfb){_0xdbc22b=_0x3d1cfb[_0x4330('0x27')]({'plain':!![]});_0x57bde1[_0x4330('0x38')]=_[_0x4330('0x49')](db[_0x4330('0x58')][_0x4330('0x32')]);_0x57bde1[_0x4330('0x35')]=_[_0x4330('0x49')](_0x97744d[_0x4330('0x35')]);_0x57bde1[_0x4330('0x36')]=_[_0x4330('0x37')](_0x57bde1[_0x4330('0x38')],_0x57bde1[_0x4330('0x35')]);_0x1ee4c9['attributes']=_[_0x4330('0x37')](_0x57bde1[_0x4330('0x38')],qs[_0x4330('0x39')](_0x97744d[_0x4330('0x35')]['fields']));_0x1ee4c9[_0x4330('0x3a')]=_0x1ee4c9[_0x4330('0x3a')]['length']?_0x1ee4c9[_0x4330('0x3a')]:_0x57bde1[_0x4330('0x38')];if(!_0x97744d[_0x4330('0x35')][_0x4330('0x3c')](_0x4330('0x3d'))){_0x1ee4c9[_0x4330('0x21')]=qs[_0x4330('0x21')](_0x97744d[_0x4330('0x35')][_0x4330('0x21')]);_0x1ee4c9[_0x4330('0x20')]=qs[_0x4330('0x20')](_0x97744d[_0x4330('0x35')][_0x4330('0x20')]);}_0x1ee4c9[_0x4330('0x3e')]=qs[_0x4330('0x3f')](_0x97744d[_0x4330('0x35')][_0x4330('0x3f')]);_0x1ee4c9[_0x4330('0x41')]=qs[_0x4330('0x36')](_[_0x4330('0x59')](_0x97744d[_0x4330('0x35')],_0x57bde1[_0x4330('0x36')]));_0x1ee4c9[_0x4330('0x41')][_0x4330('0x5a')]=_0x3d1cfb['id'];if(_0x97744d['query']['filter']){_0x1ee4c9[_0x4330('0x41')]=_['merge'](_0x1ee4c9['where'],{'$or':_['map'](_0x1ee4c9[_0x4330('0x3a')],function(_0x3b18d9){var _0x203892={};_0x203892[_0x3b18d9]={'$like':'%'+_0x97744d[_0x4330('0x35')][_0x4330('0x40')]+'%'};return _0x203892;})});}_0x1ee4c9=_[_0x4330('0x42')]({},_0x1ee4c9,_0x97744d[_0x4330('0x4a')]);return db[_0x4330('0x58')]['findAll'](_0x1ee4c9);}})['then'](function(_0x2952be){if(_0x2952be){return db[_0x4330('0x5b')][_0x4330('0x5c')]({'where':{'id':_[_0x4330('0x30')](_0x2952be,_0x4330('0x5d')),'role':_0x4330('0x5e')},'attributes':['id',_0x4330('0x2d'),'openchannelPause',_0x4330('0x5f'),_0x4330('0x60')]});}})['then'](function(_0x5ec185){if(_0x5ec185){return{'count':_0x5ec185['count'],'rows':_['map'](_0x5ec185[_0x4330('0x47')],function(_0xed3d55){return{'membername':_0xed3d55[_0x4330('0x2d')],'UserId':_0xed3d55['id'],'queue_name':_0xdbc22b[_0x4330('0x2d')],'OpenchannelQueueId':_0xdbc22b['id'],'interface':util[_0x4330('0x61')](_0x4330('0x62'),'SIP',_0xed3d55[_0x4330('0x2d')]),'penalty':0x0,'paused':_0xed3d55['openchannelPause'],'createdAt':_0xed3d55[_0x4330('0x60')],'updatedAt':_0xed3d55[_0x4330('0x5f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x4330('0x2a')](respondWithFilteredResult(_0x3c2618,_0x1ee4c9))['catch'](handleError(_0x3c2618,null));};exports['getTeams']=function(_0x294ea7,_0xfb7a8c,_0x21f19d){var _0x114a66={};var _0x1e51bb={};var _0x2b9146;var _0x22529a;return db[_0x4330('0x31')]['findOne']({'where':{'id':_0x294ea7[_0x4330('0x54')]['id']}})[_0x4330('0x2a')](handleEntityNotFound(_0xfb7a8c,null))[_0x4330('0x2a')](function(_0x239ad8){if(_0x239ad8){_0x2b9146=_0x239ad8;_0x1e51bb[_0x4330('0x38')]=_[_0x4330('0x49')](db[_0x4330('0x63')][_0x4330('0x32')]);_0x1e51bb['query']=_[_0x4330('0x49')](_0x294ea7[_0x4330('0x35')]);_0x1e51bb['filters']=_[_0x4330('0x37')](_0x1e51bb[_0x4330('0x38')],_0x1e51bb[_0x4330('0x35')]);_0x114a66[_0x4330('0x3a')]=_[_0x4330('0x37')](_0x1e51bb[_0x4330('0x38')],qs['fields'](_0x294ea7[_0x4330('0x35')][_0x4330('0x39')]));_0x114a66[_0x4330('0x3a')]=_0x114a66[_0x4330('0x3a')][_0x4330('0x3b')]?_0x114a66[_0x4330('0x3a')]:_0x1e51bb[_0x4330('0x38')];_0x114a66['order']=qs[_0x4330('0x3f')](_0x294ea7[_0x4330('0x35')]['sort']);_0x114a66[_0x4330('0x41')]=qs[_0x4330('0x36')](_[_0x4330('0x59')](_0x294ea7[_0x4330('0x35')],_0x1e51bb[_0x4330('0x36')]));if(_0x294ea7[_0x4330('0x35')][_0x4330('0x40')]){_0x114a66[_0x4330('0x41')]=_[_0x4330('0x42')](_0x114a66[_0x4330('0x41')],{'$or':_[_0x4330('0x30')](_0x114a66[_0x4330('0x3a')],function(_0x5df827){var _0x1f9a9e={};_0x1f9a9e[_0x5df827]={'$like':'%'+_0x294ea7[_0x4330('0x35')][_0x4330('0x40')]+'%'};return _0x1f9a9e;})});}_0x114a66=_[_0x4330('0x42')]({},_0x114a66,_0x294ea7[_0x4330('0x4a')]);return _0x2b9146['getTeams'](_0x114a66);}})[_0x4330('0x2a')](function(_0xee64b1){if(_0xee64b1){_0x22529a=_0xee64b1[_0x4330('0x3b')];if(!_0x294ea7[_0x4330('0x35')]['hasOwnProperty'](_0x4330('0x3d'))){_0x114a66[_0x4330('0x21')]=qs[_0x4330('0x21')](_0x294ea7['query'][_0x4330('0x21')]);_0x114a66['offset']=qs['offset'](_0x294ea7[_0x4330('0x35')][_0x4330('0x20')]);}return _0x2b9146[_0x4330('0x64')](_0x114a66);}})['then'](function(_0x16f014){if(_0x16f014){return _0x16f014?{'count':_0x22529a,'rows':_0x16f014}:null;}})[_0x4330('0x2a')](respondWithResult(_0xfb7a8c,null))[_0x4330('0x4c')](handleError(_0xfb7a8c,null));};exports['addTeams']=function(_0x3a7416,_0x21c802,_0x4cbc42){var _0x5b5328=_0x3a7416[_0x4330('0x53')][_0x4330('0x65')];return db[_0x4330('0x63')][_0x4330('0x46')]({'where':{'id':_0x5b5328},'attributes':['id'],'include':[{'model':db[_0x4330('0x5b')],'as':_0x4330('0x66'),'attributes':['id',_0x4330('0x2d'),_0x4330('0x67'),_0x4330('0x68'),_0x4330('0x69')],'raw':!![]}]})[_0x4330('0x2a')](function(_0x52316e){if(_0x52316e){var _0x36012c=_['flatMap'](_0x52316e,function(_0x18ab56){var _0x4aa522=_0x18ab56[_0x4330('0x27')]({'plain':!![]});return _0x4aa522['Agents'];});return db[_0x4330('0x31')][_0x4330('0x4b')]({'where':{'id':_0x3a7416[_0x4330('0x54')]['id']}})['then'](function(_0x64508){return db['sequelize'][_0x4330('0x6a')](function(_0x5d987a){return _0x64508['addTeams'](_0x5b5328,{'transaction':_0x5d987a})['then'](function(){return BPromise[_0x4330('0x6b')](_0x36012c,function(_0x2b9cbb){return db[_0x4330('0x58')][_0x4330('0x6c')]({'where':{'UserId':_0x2b9cbb['id'],'OpenchannelQueueId':_0x3a7416[_0x4330('0x54')]['id']},'transaction':_0x5d987a});});})[_0x4330('0x2a')](function(){_0x36012c[_0x4330('0x6d')](function(_0x4b79f7){socket[_0x4330('0x6e')]('userOpenchannelQueue:save',{'UserId':_0x4b79f7['id'],'OpenchannelQueueId':_0x64508['id']});});});});});}})[_0x4330('0x2a')](respondWithStatusCode(_0x21c802,null))[_0x4330('0x4c')](handleError(_0x21c802,null));};exports['removeTeams']=function(_0x26e64e,_0x1ec40d,_0x168b85){return db['Team'][_0x4330('0x46')]({'where':{'id':_0x26e64e[_0x4330('0x35')][_0x4330('0x65')]},'attributes':['id'],'include':[{'model':db[_0x4330('0x5b')],'as':_0x4330('0x66'),'attributes':['id'],'raw':!![]}]})[_0x4330('0x2a')](handleEntityNotFound(_0x1ec40d,null))[_0x4330('0x2a')](function(_0x24294f){var _0xc553b0=_[_0x4330('0x30')](_0x24294f,'id');var _0x40ba5b=[];var _0x1c1e33=[];var _0x468c5f=squel[_0x4330('0x6f')]();_0x468c5f[_0x4330('0x70')](_0x4330('0x71'))[_0x4330('0x72')](_0x4330('0x73'),'tq')[_0x4330('0x74')](_0x4330('0x75'),'ut',_0x4330('0x76'))[_0x4330('0x41')]('OpenchannelQueueId\x20=\x20?',_0x26e64e['params']['id']);for(var _0x51b4b1=0x0;_0x51b4b1<_0x24294f[_0x4330('0x3b')];_0x51b4b1+=0x1){let _0x2bac22=_0x24294f[_0x51b4b1];for(var _0x5b9a88=0x0;_0x5b9a88<_0x2bac22[_0x4330('0x66')][_0x4330('0x3b')];_0x5b9a88+=0x1){let _0x471557=_0x2bac22[_0x4330('0x66')][_0x5b9a88];var _0xa23c0b=_0x468c5f[_0x4330('0x77')]();_0xa23c0b[_0x4330('0x41')](_0x4330('0x78'),_0x471557['id']);_0x1c1e33[_0x4330('0x79')](db[_0x4330('0x7a')][_0x4330('0x35')](_0xa23c0b[_0x4330('0x7b')](),{'type':db['sequelize'][_0x4330('0x7c')][_0x4330('0x7d')]})[_0x4330('0x2a')](function(_0x3ccc61){if(_0x3ccc61['length']===0x1){return _0x471557['id'];}else{var _0x2fb9a7=_[_0x4330('0x7e')](_[_0x4330('0x30')](_0x3ccc61,_0x4330('0x7f')),function(_0xd692a0){return _[_0x4330('0x80')](_0xc553b0,_0xd692a0);});if(_0x2fb9a7){return _0x471557['id'];}}}));}}return BPromise[_0x4330('0x81')](_0x1c1e33)[_0x4330('0x2a')](function(_0x15168a){_0x40ba5b=_(_0x40ba5b)[_0x4330('0x82')](_0x15168a)[_0x4330('0x83')]()[_0x4330('0x84')]();return db[_0x4330('0x31')][_0x4330('0x4b')]({'where':{'id':_0x26e64e[_0x4330('0x54')]['id']}})[_0x4330('0x2a')](function(_0xcd38d){return db[_0x4330('0x7a')]['transaction'](function(_0x1c26ed){return _0xcd38d['removeTeams'](_0x26e64e[_0x4330('0x35')]['ids'],{'transaction':_0x1c26ed})['then'](function(){if(!_[_0x4330('0x85')](_0x40ba5b)){return _0xcd38d[_0x4330('0x86')](_0x40ba5b,{'transaction':_0x1c26ed});}})[_0x4330('0x2a')](function(){_0x40ba5b[_0x4330('0x6d')](function(_0x255f82){socket[_0x4330('0x6e')](_0x4330('0x87'),{'UserId':_0x255f82,'OpenchannelQueueId':_0xcd38d['id']});});});});});});})[_0x4330('0x2a')](respondWithStatusCode(_0x1ec40d,null))['catch'](handleError(_0x1ec40d,null));};exports[_0x4330('0x88')]=function(_0x3a789e,_0x371ba5,_0x56dd1c){return db[_0x4330('0x31')][_0x4330('0x4b')]({'where':{'id':_0x3a789e[_0x4330('0x54')]['id']}})['then'](handleEntityNotFound(_0x371ba5,null))[_0x4330('0x2a')](function(_0x22d1fd){if(_0x22d1fd){return _0x22d1fd['addAgents'](_0x3a789e[_0x4330('0x53')]['ids'],_['omit'](_0x3a789e[_0x4330('0x53')],['ids','id'])||{})['spread'](function(_0x1e7a49){for(var _0x56da94=0x0;_0x56da94<_0x3a789e[_0x4330('0x53')][_0x4330('0x65')][_0x4330('0x3b')];_0x56da94+=0x1){socket['emit'](_0x4330('0x89'),{'UserId':_0x3a789e['body']['ids'][_0x56da94],'OpenchannelQueueId':_0x3a789e[_0x4330('0x54')]['id']});}return _0x1e7a49;});}})[_0x4330('0x2a')](respondWithResult(_0x371ba5,null))[_0x4330('0x4c')](handleError(_0x371ba5,null));};exports['removeAgents']=function(_0x57b17c,_0x111b76,_0x4fb4a4){return db['OpenchannelQueue'][_0x4330('0x4b')]({'where':{'id':_0x57b17c[_0x4330('0x54')]['id']}})[_0x4330('0x2a')](handleEntityNotFound(_0x111b76,null))[_0x4330('0x2a')](function(_0x5b0969){if(_0x5b0969){return _0x5b0969['removeAgents'](_0x57b17c[_0x4330('0x35')][_0x4330('0x65')])['then'](function(){if(_[_0x4330('0x8a')](_0x57b17c[_0x4330('0x35')]['ids'])){for(var _0x54b393=0x0;_0x54b393<_0x57b17c[_0x4330('0x35')]['ids'][_0x4330('0x3b')];_0x54b393+=0x1){socket['emit'](_0x4330('0x87'),{'UserId':Number(_0x57b17c[_0x4330('0x35')]['ids'][_0x54b393]),'OpenchannelQueueId':Number(_0x57b17c[_0x4330('0x54')]['id'])});}}else{socket[_0x4330('0x6e')](_0x4330('0x87'),{'UserId':Number(_0x57b17c['query'][_0x4330('0x65')]),'OpenchannelQueueId':Number(_0x57b17c[_0x4330('0x54')]['id'])});}});}})['then'](respondWithStatusCode(_0x111b76,null))[_0x4330('0x4c')](handleError(_0x111b76,null));};exports[_0x4330('0x8b')]=function(_0x4b6206,_0x299177,_0x19af3c){var _0x145a03={};var _0x238e28={};var _0x40d5f5;var _0x4086e7;return db[_0x4330('0x31')][_0x4330('0x57')]({'where':{'id':_0x4b6206['params']['id']}})[_0x4330('0x2a')](handleEntityNotFound(_0x299177,null))['then'](function(_0x3c97ae){if(_0x3c97ae){_0x40d5f5=_0x3c97ae;_0x238e28['model']=_['keys'](db['User'][_0x4330('0x32')]);_0x238e28['query']=_[_0x4330('0x49')](_0x4b6206[_0x4330('0x35')]);_0x238e28[_0x4330('0x36')]=_[_0x4330('0x37')](_0x238e28[_0x4330('0x38')],_0x238e28[_0x4330('0x35')]);_0x145a03[_0x4330('0x3a')]=_[_0x4330('0x37')](_0x238e28['model'],qs[_0x4330('0x39')](_0x4b6206[_0x4330('0x35')][_0x4330('0x39')]));_0x145a03['attributes']=_0x145a03['attributes'][_0x4330('0x3b')]?_0x145a03[_0x4330('0x3a')]:_0x238e28[_0x4330('0x38')];_0x145a03[_0x4330('0x3e')]=qs['sort'](_0x4b6206[_0x4330('0x35')][_0x4330('0x3f')]);_0x145a03[_0x4330('0x41')]=qs['filters'](_[_0x4330('0x59')](_0x4b6206[_0x4330('0x35')],_0x238e28[_0x4330('0x36')]));if(_0x4b6206[_0x4330('0x35')]['filter']){_0x145a03[_0x4330('0x41')]=_[_0x4330('0x42')](_0x145a03['where'],{'$or':_[_0x4330('0x30')](_0x145a03[_0x4330('0x3a')],function(_0x5c33f4){var _0x220b12={};_0x220b12[_0x5c33f4]={'$like':'%'+_0x4b6206[_0x4330('0x35')][_0x4330('0x40')]+'%'};return _0x220b12;})});}_0x145a03=_[_0x4330('0x42')]({},_0x145a03,_0x4b6206[_0x4330('0x4a')]);return _0x40d5f5['getAgents'](_0x145a03);}})[_0x4330('0x2a')](function(_0x4524ca){if(_0x4524ca){_0x4086e7=_0x4524ca[_0x4330('0x3b')];if(!_0x4b6206[_0x4330('0x35')][_0x4330('0x3c')](_0x4330('0x3d'))){_0x145a03[_0x4330('0x21')]=qs[_0x4330('0x21')](_0x4b6206[_0x4330('0x35')]['limit']);_0x145a03['offset']=qs[_0x4330('0x20')](_0x4b6206[_0x4330('0x35')][_0x4330('0x20')]);}return _0x40d5f5[_0x4330('0x8b')](_0x145a03);}})[_0x4330('0x2a')](function(_0x19b6a4){if(_0x19b6a4){return _0x19b6a4?{'count':_0x4086e7,'rows':_0x19b6a4}:null;}})[_0x4330('0x2a')](respondWithResult(_0x299177,null))['catch'](handleError(_0x299177,null));}; \ No newline at end of file +var _0xab6e=['merge','VIRTUAL','OpenchannelQueue','count','includeAll','include','findAll','rows','catch','show','params','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','body','describe','getMembers','findOne','hasOwnProperty','OpenchannelQueueId','map','UserOpenchannelQueue','User','findAndCountAll','UserId','agent','updatedAt','createdAt','format','%s/%s','SIP','openchannelPause','getTeams','Team','addTeams','Agents','online','voicePause','flatMap','sequelize','transaction','each','emit','userOpenchannelQueue:save','removeTeams','ids','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','omit','spread','isArray','getAgents','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','defaults','redis','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','status','end','json','offset','limit','apply','save','update','destroy','then','get','OpenchannelQueues','UserProfileResource','error','stack','name','send','index','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xab6e,0x161));var _0xeab6=function(_0x616fb8,_0x177e11){_0x616fb8=_0x616fb8-0x0;var _0x739e20=_0xab6e[_0x616fb8];return _0x739e20;};'use strict';var pdf=require(_0xeab6('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xeab6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xeab6('0x2'));var rp=require(_0xeab6('0x3'));var moment=require(_0xeab6('0x4'));var BPromise=require(_0xeab6('0x5'));var Mustache=require(_0xeab6('0x6'));var util=require(_0xeab6('0x7'));var path=require('path');var sox=require(_0xeab6('0x8'));var csv=require(_0xeab6('0x9'));var ejs=require(_0xeab6('0xa'));var fs=require('fs');var _=require(_0xeab6('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xeab6('0xc'));var toCsv=require(_0xeab6('0x9'));var querystring=require(_0xeab6('0xd'));var Papa=require(_0xeab6('0xe'));var Redis=require(_0xeab6('0xf'));var authService=require(_0xeab6('0x10'));var qs=require(_0xeab6('0x11'));var as=require(_0xeab6('0x12'));var hardwareService=require(_0xeab6('0x13'));var logger=require('../../config/logger')(_0xeab6('0x14'));var utils=require(_0xeab6('0x15'));var config=require(_0xeab6('0x16'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xeab6('0x17')](config[_0xeab6('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0xeab6('0x19'))(new Redis(config[_0xeab6('0x18')]));require(_0xeab6('0x1a'))[_0xeab6('0x1b')](socket);function respondWithStatusCode(_0x5b6a5c,_0x4f8523){_0x4f8523=_0x4f8523||0xcc;return function(_0xc1b77b){if(_0xc1b77b){return _0x5b6a5c[_0xeab6('0x1c')](_0x4f8523);}return _0x5b6a5c[_0xeab6('0x1d')](_0x4f8523)[_0xeab6('0x1e')]();};}function respondWithResult(_0x272e3c,_0x30362b){_0x30362b=_0x30362b||0xc8;return function(_0x1d1d42){if(_0x1d1d42){return _0x272e3c[_0xeab6('0x1d')](_0x30362b)[_0xeab6('0x1f')](_0x1d1d42);}};}function respondWithFilteredResult(_0x530760,_0x8886b3){return function(_0x1a60e9){if(_0x1a60e9){var _0x1840b8=_0x1a60e9['count'],_0x308335=_0x8886b3[_0xeab6('0x20')],_0x1f6773=_0x8886b3[_0xeab6('0x20')]+_0x8886b3[_0xeab6('0x21')],_0x439f91;if(_0x1f6773>=_0x1840b8){_0x1f6773=_0x1840b8;_0x439f91=0xc8;}else{_0x439f91=0xce;}_0x530760[_0xeab6('0x1d')](_0x439f91);return _0x530760['set']('Content-Range',_0x308335+'-'+_0x1f6773+'/'+_0x1840b8)['json'](_0x1a60e9);}return null;};}function patchUpdates(_0x2e59d6){return function(_0xb45a46){try{jsonpatch[_0xeab6('0x22')](_0xb45a46,_0x2e59d6,!![]);}catch(_0x4a5fcc){return BPromise['reject'](_0x4a5fcc);}return _0xb45a46[_0xeab6('0x23')]();};}function saveUpdates(_0x4ce27a,_0x18f82f){return function(_0x52157d){if(_0x52157d){return _0x52157d[_0xeab6('0x24')](_0x4ce27a)['then'](function(_0x2ada85){return _0x2ada85;});}return null;};}function removeEntity(_0xf0c1fc,_0x1ffc21){return function(_0x578a6c){if(_0x578a6c){return _0x578a6c[_0xeab6('0x25')]()[_0xeab6('0x26')](function(){var _0x123046=_0x578a6c[_0xeab6('0x27')]({'plain':!![]});var _0x168cd2=_0xeab6('0x28');return db[_0xeab6('0x29')]['destroy']({'where':{'type':_0x168cd2,'resourceId':_0x123046['id']}})['then'](function(){return _0x578a6c;});})['then'](function(){_0xf0c1fc[_0xeab6('0x1d')](0xcc)[_0xeab6('0x1e')]();});}};}function handleEntityNotFound(_0x1b2d9d,_0x475118){return function(_0x5bcc24){if(!_0x5bcc24){_0x1b2d9d[_0xeab6('0x1c')](0x194);}return _0x5bcc24;};}function handleError(_0x57d16e,_0x365918){_0x365918=_0x365918||0x1f4;return function(_0xb3696e){logger[_0xeab6('0x2a')](_0xb3696e[_0xeab6('0x2b')]);if(_0xb3696e[_0xeab6('0x2c')]){delete _0xb3696e[_0xeab6('0x2c')];}_0x57d16e[_0xeab6('0x1d')](_0x365918)[_0xeab6('0x2d')](_0xb3696e);};}exports[_0xeab6('0x2e')]=function(_0x1c3e04,_0x1c1786){var _0x56d533={},_0x5e6329={},_0x18dfbc={'count':0x0,'rows':[]};var _0x50b5b6=_['map'](db['OpenchannelQueue'][_0xeab6('0x2f')],function(_0x8c7f94){return{'name':_0x8c7f94[_0xeab6('0x30')],'type':_0x8c7f94[_0xeab6('0x31')]['key']};});_0x5e6329[_0xeab6('0x32')]=_['map'](_0x50b5b6,_0xeab6('0x2c'));_0x5e6329[_0xeab6('0x33')]=_[_0xeab6('0x34')](_0x1c3e04[_0xeab6('0x33')]);_0x5e6329[_0xeab6('0x35')]=_['intersection'](_0x5e6329[_0xeab6('0x32')],_0x5e6329['query']);_0x56d533[_0xeab6('0x36')]=_[_0xeab6('0x37')](_0x5e6329['model'],qs[_0xeab6('0x38')](_0x1c3e04[_0xeab6('0x33')]['fields']));_0x56d533[_0xeab6('0x36')]=_0x56d533[_0xeab6('0x36')][_0xeab6('0x39')]?_0x56d533['attributes']:_0x5e6329[_0xeab6('0x32')];if(!_0x1c3e04[_0xeab6('0x33')]['hasOwnProperty'](_0xeab6('0x3a'))){_0x56d533[_0xeab6('0x21')]=qs[_0xeab6('0x21')](_0x1c3e04['query'][_0xeab6('0x21')]);_0x56d533[_0xeab6('0x20')]=qs[_0xeab6('0x20')](_0x1c3e04[_0xeab6('0x33')][_0xeab6('0x20')]);}_0x56d533[_0xeab6('0x3b')]=qs[_0xeab6('0x3c')](_0x1c3e04[_0xeab6('0x33')][_0xeab6('0x3c')]);_0x56d533[_0xeab6('0x3d')]=qs['filters'](_[_0xeab6('0x3e')](_0x1c3e04[_0xeab6('0x33')],_0x5e6329[_0xeab6('0x35')]),_0x50b5b6);if(_0x1c3e04[_0xeab6('0x33')][_0xeab6('0x3f')]){_0x56d533[_0xeab6('0x3d')]=_[_0xeab6('0x40')](_0x56d533[_0xeab6('0x3d')],{'$or':_['map'](_0x50b5b6,function(_0x2435db){if(_0x2435db[_0xeab6('0x31')]!==_0xeab6('0x41')){var _0x177ceb={};_0x177ceb[_0x2435db[_0xeab6('0x2c')]]={'$like':'%'+_0x1c3e04['query'][_0xeab6('0x3f')]+'%'};return _0x177ceb;}})});}_0x56d533=_['merge']({},_0x56d533,_0x1c3e04['options']);var _0x3b5942={'where':_0x56d533[_0xeab6('0x3d')]};return db[_0xeab6('0x42')][_0xeab6('0x43')](_0x3b5942)[_0xeab6('0x26')](function(_0x3c430f){_0x18dfbc[_0xeab6('0x43')]=_0x3c430f;if(_0x1c3e04[_0xeab6('0x33')][_0xeab6('0x44')]){_0x56d533[_0xeab6('0x45')]=[{'all':!![]}];}return db['OpenchannelQueue'][_0xeab6('0x46')](_0x56d533);})['then'](function(_0x42daf0){_0x18dfbc[_0xeab6('0x47')]=_0x42daf0;return _0x18dfbc;})[_0xeab6('0x26')](respondWithFilteredResult(_0x1c1786,_0x56d533))[_0xeab6('0x48')](handleError(_0x1c1786,null));};exports[_0xeab6('0x49')]=function(_0x5a99fd,_0x179839){var _0x330861={'raw':!![],'where':{'id':_0x5a99fd[_0xeab6('0x4a')]['id']}},_0x497685={};_0x497685['model']=_[_0xeab6('0x34')](db[_0xeab6('0x42')][_0xeab6('0x2f')]);_0x497685[_0xeab6('0x33')]=_[_0xeab6('0x34')](_0x5a99fd[_0xeab6('0x33')]);_0x497685[_0xeab6('0x35')]=_[_0xeab6('0x37')](_0x497685[_0xeab6('0x32')],_0x497685[_0xeab6('0x33')]);_0x330861[_0xeab6('0x36')]=_[_0xeab6('0x37')](_0x497685['model'],qs[_0xeab6('0x38')](_0x5a99fd[_0xeab6('0x33')][_0xeab6('0x38')]));_0x330861[_0xeab6('0x36')]=_0x330861[_0xeab6('0x36')]['length']?_0x330861[_0xeab6('0x36')]:_0x497685['model'];if(_0x5a99fd[_0xeab6('0x33')][_0xeab6('0x44')]){_0x330861[_0xeab6('0x45')]=[{'all':!![]}];}_0x330861=_[_0xeab6('0x40')]({},_0x330861,_0x5a99fd[_0xeab6('0x4b')]);return db[_0xeab6('0x42')][_0xeab6('0x4c')](_0x330861)[_0xeab6('0x26')](handleEntityNotFound(_0x179839,null))[_0xeab6('0x26')](respondWithResult(_0x179839,null))['catch'](handleError(_0x179839,null));};exports[_0xeab6('0x4d')]=function(_0x190bb0,_0x145660){return db[_0xeab6('0x42')][_0xeab6('0x4d')](_0x190bb0['body'],{})['then'](function(_0x13989a){var _0x1d427d=_0x190bb0[_0xeab6('0x4e')][_0xeab6('0x27')]({'plain':!![]});if(!_0x1d427d)throw new Error(_0xeab6('0x4f'));if(_0x1d427d[_0xeab6('0x50')]===_0xeab6('0x4e')){var _0x326def=_0x13989a['get']({'plain':!![]});var _0x68b46b='OpenchannelQueues';return db['UserProfileSection'][_0xeab6('0x4c')]({'where':{'name':_0x68b46b,'userProfileId':_0x1d427d[_0xeab6('0x51')]},'raw':!![]})[_0xeab6('0x26')](function(_0x2fa52b){if(_0x2fa52b&&_0x2fa52b['autoAssociation']===0x0){return db[_0xeab6('0x29')]['create']({'name':_0x326def[_0xeab6('0x2c')],'resourceId':_0x326def['id'],'type':_0x2fa52b[_0xeab6('0x2c')],'sectionId':_0x2fa52b['id']},{})[_0xeab6('0x26')](function(){return _0x13989a;});}else{return _0x13989a;}})[_0xeab6('0x48')](function(_0x590a37){logger[_0xeab6('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x590a37);throw _0x590a37;});}return _0x13989a;})[_0xeab6('0x26')](respondWithResult(_0x145660,0xc9))[_0xeab6('0x48')](handleError(_0x145660,null));};exports['update']=function(_0x49ce9c,_0x4a49bc){if(_0x49ce9c[_0xeab6('0x52')]['id']){delete _0x49ce9c[_0xeab6('0x52')]['id'];}return db[_0xeab6('0x42')]['find']({'where':{'id':_0x49ce9c[_0xeab6('0x4a')]['id']}})[_0xeab6('0x26')](handleEntityNotFound(_0x4a49bc,null))['then'](saveUpdates(_0x49ce9c[_0xeab6('0x52')],null))['then'](respondWithResult(_0x4a49bc,null))['catch'](handleError(_0x4a49bc,null));};exports[_0xeab6('0x25')]=function(_0x81ef1,_0x366e08){return db[_0xeab6('0x42')]['find']({'where':{'id':_0x81ef1[_0xeab6('0x4a')]['id']}})['then'](handleEntityNotFound(_0x366e08,null))[_0xeab6('0x26')](removeEntity(_0x366e08,null))[_0xeab6('0x48')](handleError(_0x366e08,null));};exports[_0xeab6('0x53')]=function(_0x5bba6d,_0x3a0227){return db[_0xeab6('0x42')][_0xeab6('0x53')]()[_0xeab6('0x26')](respondWithResult(_0x3a0227,null))[_0xeab6('0x48')](handleError(_0x3a0227,null));};exports[_0xeab6('0x54')]=function(_0x6fc983,_0x413523,_0x458fc9){var _0x2dc3a0={'raw':!![],'where':{}},_0x582024={},_0x3a6a0f;return db[_0xeab6('0x42')][_0xeab6('0x55')]({'where':{'id':_0x6fc983['params']['id']}})[_0xeab6('0x26')](handleEntityNotFound(_0x413523,null))['then'](function(_0x456cd0){if(_0x456cd0){_0x3a6a0f=_0x456cd0[_0xeab6('0x27')]({'plain':!![]});_0x582024[_0xeab6('0x32')]=_[_0xeab6('0x34')](db['UserOpenchannelQueue'][_0xeab6('0x2f')]);_0x582024[_0xeab6('0x33')]=_['keys'](_0x6fc983[_0xeab6('0x33')]);_0x582024['filters']=_[_0xeab6('0x37')](_0x582024[_0xeab6('0x32')],_0x582024['query']);_0x2dc3a0[_0xeab6('0x36')]=_[_0xeab6('0x37')](_0x582024[_0xeab6('0x32')],qs[_0xeab6('0x38')](_0x6fc983[_0xeab6('0x33')]['fields']));_0x2dc3a0[_0xeab6('0x36')]=_0x2dc3a0['attributes'][_0xeab6('0x39')]?_0x2dc3a0[_0xeab6('0x36')]:_0x582024[_0xeab6('0x32')];if(!_0x6fc983[_0xeab6('0x33')][_0xeab6('0x56')](_0xeab6('0x3a'))){_0x2dc3a0[_0xeab6('0x21')]=qs[_0xeab6('0x21')](_0x6fc983[_0xeab6('0x33')][_0xeab6('0x21')]);_0x2dc3a0[_0xeab6('0x20')]=qs[_0xeab6('0x20')](_0x6fc983[_0xeab6('0x33')][_0xeab6('0x20')]);}_0x2dc3a0[_0xeab6('0x3b')]=qs[_0xeab6('0x3c')](_0x6fc983[_0xeab6('0x33')][_0xeab6('0x3c')]);_0x2dc3a0[_0xeab6('0x3d')]=qs[_0xeab6('0x35')](_['pick'](_0x6fc983[_0xeab6('0x33')],_0x582024[_0xeab6('0x35')]));_0x2dc3a0['where'][_0xeab6('0x57')]=_0x456cd0['id'];if(_0x6fc983[_0xeab6('0x33')][_0xeab6('0x3f')]){_0x2dc3a0[_0xeab6('0x3d')]=_[_0xeab6('0x40')](_0x2dc3a0[_0xeab6('0x3d')],{'$or':_[_0xeab6('0x58')](_0x2dc3a0[_0xeab6('0x36')],function(_0x5a03b5){var _0x399db9={};_0x399db9[_0x5a03b5]={'$like':'%'+_0x6fc983['query'][_0xeab6('0x3f')]+'%'};return _0x399db9;})});}_0x2dc3a0=_[_0xeab6('0x40')]({},_0x2dc3a0,_0x6fc983[_0xeab6('0x4b')]);return db[_0xeab6('0x59')][_0xeab6('0x46')](_0x2dc3a0);}})[_0xeab6('0x26')](function(_0x24f577){if(_0x24f577){return db[_0xeab6('0x5a')][_0xeab6('0x5b')]({'where':{'id':_['map'](_0x24f577,_0xeab6('0x5c')),'role':_0xeab6('0x5d')},'attributes':['id',_0xeab6('0x2c'),'openchannelPause',_0xeab6('0x5e'),_0xeab6('0x5f')]});}})[_0xeab6('0x26')](function(_0x2b4671){if(_0x2b4671){return{'count':_0x2b4671[_0xeab6('0x43')],'rows':_[_0xeab6('0x58')](_0x2b4671[_0xeab6('0x47')],function(_0x41b007){return{'membername':_0x41b007['name'],'UserId':_0x41b007['id'],'queue_name':_0x3a6a0f['name'],'OpenchannelQueueId':_0x3a6a0f['id'],'interface':util[_0xeab6('0x60')](_0xeab6('0x61'),_0xeab6('0x62'),_0x41b007[_0xeab6('0x2c')]),'penalty':0x0,'paused':_0x41b007[_0xeab6('0x63')],'createdAt':_0x41b007[_0xeab6('0x5f')],'updatedAt':_0x41b007[_0xeab6('0x5e')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x413523,_0x2dc3a0))[_0xeab6('0x48')](handleError(_0x413523,null));};exports[_0xeab6('0x64')]=function(_0x42879f,_0x181c53,_0x310f42){var _0x569039={};var _0xd6d6aa={};var _0x2e8780;var _0x2ea510;return db[_0xeab6('0x42')][_0xeab6('0x55')]({'where':{'id':_0x42879f['params']['id']}})[_0xeab6('0x26')](handleEntityNotFound(_0x181c53,null))[_0xeab6('0x26')](function(_0x4379bf){if(_0x4379bf){_0x2e8780=_0x4379bf;_0xd6d6aa['model']=_[_0xeab6('0x34')](db[_0xeab6('0x65')][_0xeab6('0x2f')]);_0xd6d6aa[_0xeab6('0x33')]=_[_0xeab6('0x34')](_0x42879f[_0xeab6('0x33')]);_0xd6d6aa[_0xeab6('0x35')]=_[_0xeab6('0x37')](_0xd6d6aa[_0xeab6('0x32')],_0xd6d6aa[_0xeab6('0x33')]);_0x569039[_0xeab6('0x36')]=_['intersection'](_0xd6d6aa[_0xeab6('0x32')],qs[_0xeab6('0x38')](_0x42879f[_0xeab6('0x33')][_0xeab6('0x38')]));_0x569039[_0xeab6('0x36')]=_0x569039[_0xeab6('0x36')][_0xeab6('0x39')]?_0x569039['attributes']:_0xd6d6aa[_0xeab6('0x32')];_0x569039['order']=qs['sort'](_0x42879f[_0xeab6('0x33')][_0xeab6('0x3c')]);_0x569039['where']=qs['filters'](_['pick'](_0x42879f[_0xeab6('0x33')],_0xd6d6aa['filters']));if(_0x42879f[_0xeab6('0x33')][_0xeab6('0x3f')]){_0x569039[_0xeab6('0x3d')]=_['merge'](_0x569039['where'],{'$or':_[_0xeab6('0x58')](_0x569039[_0xeab6('0x36')],function(_0x51b6bf){var _0x4a348f={};_0x4a348f[_0x51b6bf]={'$like':'%'+_0x42879f[_0xeab6('0x33')][_0xeab6('0x3f')]+'%'};return _0x4a348f;})});}_0x569039=_[_0xeab6('0x40')]({},_0x569039,_0x42879f[_0xeab6('0x4b')]);return _0x2e8780['getTeams'](_0x569039);}})[_0xeab6('0x26')](function(_0x4a7b7d){if(_0x4a7b7d){_0x2ea510=_0x4a7b7d[_0xeab6('0x39')];if(!_0x42879f[_0xeab6('0x33')][_0xeab6('0x56')](_0xeab6('0x3a'))){_0x569039[_0xeab6('0x21')]=qs[_0xeab6('0x21')](_0x42879f[_0xeab6('0x33')][_0xeab6('0x21')]);_0x569039[_0xeab6('0x20')]=qs[_0xeab6('0x20')](_0x42879f['query']['offset']);}return _0x2e8780[_0xeab6('0x64')](_0x569039);}})[_0xeab6('0x26')](function(_0x49aee9){if(_0x49aee9){return _0x49aee9?{'count':_0x2ea510,'rows':_0x49aee9}:null;}})['then'](respondWithResult(_0x181c53,null))[_0xeab6('0x48')](handleError(_0x181c53,null));};exports[_0xeab6('0x66')]=function(_0x5036db,_0x38c580,_0x2ea3d8){var _0x2e7d6c=_0x5036db[_0xeab6('0x52')]['ids'];return db['Team'][_0xeab6('0x46')]({'where':{'id':_0x2e7d6c},'attributes':['id'],'include':[{'model':db['User'],'as':_0xeab6('0x67'),'attributes':['id',_0xeab6('0x2c'),_0xeab6('0x68'),_0xeab6('0x69'),'interface'],'raw':!![]}]})[_0xeab6('0x26')](function(_0x3b766a){if(_0x3b766a){var _0x37b4ca=_[_0xeab6('0x6a')](_0x3b766a,function(_0x56d951){var _0x4866b3=_0x56d951[_0xeab6('0x27')]({'plain':!![]});return _0x4866b3['Agents'];});return db[_0xeab6('0x42')]['find']({'where':{'id':_0x5036db['params']['id']}})['then'](function(_0x14b848){return db[_0xeab6('0x6b')][_0xeab6('0x6c')](function(_0x4e88d8){return _0x14b848[_0xeab6('0x66')](_0x2e7d6c,{'transaction':_0x4e88d8})[_0xeab6('0x26')](function(){return BPromise[_0xeab6('0x6d')](_0x37b4ca,function(_0x2d2395){return db[_0xeab6('0x59')]['findOrCreate']({'where':{'UserId':_0x2d2395['id'],'OpenchannelQueueId':_0x5036db[_0xeab6('0x4a')]['id']},'transaction':_0x4e88d8});});})['then'](function(){_0x37b4ca['forEach'](function(_0x396585){socket[_0xeab6('0x6e')](_0xeab6('0x6f'),{'UserId':_0x396585['id'],'OpenchannelQueueId':_0x14b848['id']});});});});});}})['then'](respondWithStatusCode(_0x38c580,null))[_0xeab6('0x48')](handleError(_0x38c580,null));};exports[_0xeab6('0x70')]=function(_0x28cf38,_0x2e62e2,_0x276a02){return db[_0xeab6('0x65')][_0xeab6('0x46')]({'where':{'id':_0x28cf38[_0xeab6('0x33')][_0xeab6('0x71')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xeab6('0x67'),'attributes':['id'],'raw':!![]}]})[_0xeab6('0x26')](handleEntityNotFound(_0x2e62e2,null))[_0xeab6('0x26')](function(_0x477c81){var _0x4f8cb9=_[_0xeab6('0x58')](_0x477c81,'id');var _0x141c98=[];var _0x2aeb6a=[];var _0x3137e3=squel['select']();_0x3137e3['field']('tq.TeamId')[_0xeab6('0x72')]('team_has_openchannel_queues','tq')[_0xeab6('0x73')](_0xeab6('0x74'),'ut',_0xeab6('0x75'))[_0xeab6('0x3d')](_0xeab6('0x76'),_0x28cf38['params']['id']);for(var _0xc5c23b=0x0;_0xc5c23b<_0x477c81[_0xeab6('0x39')];_0xc5c23b+=0x1){let _0x1cb229=_0x477c81[_0xc5c23b];for(var _0x5e6737=0x0;_0x5e6737<_0x1cb229[_0xeab6('0x67')]['length'];_0x5e6737+=0x1){let _0xc3e8fe=_0x1cb229[_0xeab6('0x67')][_0x5e6737];var _0x1de761=_0x3137e3[_0xeab6('0x77')]();_0x1de761[_0xeab6('0x3d')](_0xeab6('0x78'),_0xc3e8fe['id']);_0x2aeb6a['push'](db['sequelize'][_0xeab6('0x33')](_0x1de761[_0xeab6('0x79')](),{'type':db[_0xeab6('0x6b')][_0xeab6('0x7a')][_0xeab6('0x7b')]})[_0xeab6('0x26')](function(_0xab8ffe){if(_0xab8ffe['length']===0x1){return _0xc3e8fe['id'];}else{var _0x13969d=_[_0xeab6('0x7c')](_['map'](_0xab8ffe,_0xeab6('0x7d')),function(_0x26bee5){return _[_0xeab6('0x7e')](_0x4f8cb9,_0x26bee5);});if(_0x13969d){return _0xc3e8fe['id'];}}}));}}return BPromise[_0xeab6('0x7f')](_0x2aeb6a)[_0xeab6('0x26')](function(_0x5ca71f){_0x141c98=_(_0x141c98)[_0xeab6('0x80')](_0x5ca71f)[_0xeab6('0x81')]()[_0xeab6('0x82')]();return db[_0xeab6('0x42')][_0xeab6('0x4c')]({'where':{'id':_0x28cf38[_0xeab6('0x4a')]['id']}})['then'](function(_0x3853e){return db[_0xeab6('0x6b')][_0xeab6('0x6c')](function(_0x254591){return _0x3853e[_0xeab6('0x70')](_0x28cf38[_0xeab6('0x33')][_0xeab6('0x71')],{'transaction':_0x254591})[_0xeab6('0x26')](function(){if(!_[_0xeab6('0x83')](_0x141c98)){return _0x3853e[_0xeab6('0x84')](_0x141c98,{'transaction':_0x254591});}})['then'](function(){_0x141c98['forEach'](function(_0x2acea1){socket['emit'](_0xeab6('0x85'),{'UserId':_0x2acea1,'OpenchannelQueueId':_0x3853e['id']});});});});});});})[_0xeab6('0x26')](respondWithStatusCode(_0x2e62e2,null))[_0xeab6('0x48')](handleError(_0x2e62e2,null));};exports[_0xeab6('0x86')]=function(_0x298841,_0x5cf82c,_0x176649){return db['OpenchannelQueue']['find']({'where':{'id':_0x298841[_0xeab6('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5cf82c,null))[_0xeab6('0x26')](function(_0x22d386){if(_0x22d386){return _0x22d386[_0xeab6('0x86')](_0x298841['body'][_0xeab6('0x71')],_[_0xeab6('0x87')](_0x298841[_0xeab6('0x52')],[_0xeab6('0x71'),'id'])||{})[_0xeab6('0x88')](function(_0x5877b5){for(var _0x482413=0x0;_0x482413<_0x298841[_0xeab6('0x52')][_0xeab6('0x71')][_0xeab6('0x39')];_0x482413+=0x1){socket[_0xeab6('0x6e')](_0xeab6('0x6f'),{'UserId':_0x298841[_0xeab6('0x52')][_0xeab6('0x71')][_0x482413],'OpenchannelQueueId':_0x298841[_0xeab6('0x4a')]['id']});}return _0x5877b5;});}})[_0xeab6('0x26')](respondWithResult(_0x5cf82c,null))[_0xeab6('0x48')](handleError(_0x5cf82c,null));};exports['removeAgents']=function(_0x2c2cef,_0x526fb0,_0x3e31da){return db[_0xeab6('0x42')]['find']({'where':{'id':_0x2c2cef[_0xeab6('0x4a')]['id']}})[_0xeab6('0x26')](handleEntityNotFound(_0x526fb0,null))[_0xeab6('0x26')](function(_0x3e5342){if(_0x3e5342){return _0x3e5342['removeAgents'](_0x2c2cef[_0xeab6('0x33')][_0xeab6('0x71')])[_0xeab6('0x26')](function(){if(_[_0xeab6('0x89')](_0x2c2cef[_0xeab6('0x33')][_0xeab6('0x71')])){for(var _0x34b203=0x0;_0x34b203<_0x2c2cef['query'][_0xeab6('0x71')][_0xeab6('0x39')];_0x34b203+=0x1){socket[_0xeab6('0x6e')](_0xeab6('0x85'),{'UserId':Number(_0x2c2cef[_0xeab6('0x33')][_0xeab6('0x71')][_0x34b203]),'OpenchannelQueueId':Number(_0x2c2cef['params']['id'])});}}else{socket[_0xeab6('0x6e')](_0xeab6('0x85'),{'UserId':Number(_0x2c2cef[_0xeab6('0x33')][_0xeab6('0x71')]),'OpenchannelQueueId':Number(_0x2c2cef['params']['id'])});}});}})[_0xeab6('0x26')](respondWithStatusCode(_0x526fb0,null))['catch'](handleError(_0x526fb0,null));};exports[_0xeab6('0x8a')]=function(_0x535df0,_0x1d787b,_0xbaecba){var _0x478ff3={};var _0x1200f4={};var _0x50eee0;var _0x291f69;return db['OpenchannelQueue']['findOne']({'where':{'id':_0x535df0[_0xeab6('0x4a')]['id']}})[_0xeab6('0x26')](handleEntityNotFound(_0x1d787b,null))[_0xeab6('0x26')](function(_0x568b80){if(_0x568b80){_0x50eee0=_0x568b80;_0x1200f4['model']=_[_0xeab6('0x34')](db[_0xeab6('0x5a')][_0xeab6('0x2f')]);_0x1200f4['query']=_[_0xeab6('0x34')](_0x535df0[_0xeab6('0x33')]);_0x1200f4[_0xeab6('0x35')]=_['intersection'](_0x1200f4[_0xeab6('0x32')],_0x1200f4['query']);_0x478ff3[_0xeab6('0x36')]=_['intersection'](_0x1200f4[_0xeab6('0x32')],qs[_0xeab6('0x38')](_0x535df0[_0xeab6('0x33')][_0xeab6('0x38')]));_0x478ff3[_0xeab6('0x36')]=_0x478ff3[_0xeab6('0x36')][_0xeab6('0x39')]?_0x478ff3[_0xeab6('0x36')]:_0x1200f4['model'];_0x478ff3[_0xeab6('0x3b')]=qs['sort'](_0x535df0[_0xeab6('0x33')][_0xeab6('0x3c')]);_0x478ff3[_0xeab6('0x3d')]=qs[_0xeab6('0x35')](_['pick'](_0x535df0[_0xeab6('0x33')],_0x1200f4[_0xeab6('0x35')]));if(_0x535df0[_0xeab6('0x33')][_0xeab6('0x3f')]){_0x478ff3['where']=_['merge'](_0x478ff3[_0xeab6('0x3d')],{'$or':_[_0xeab6('0x58')](_0x478ff3['attributes'],function(_0x5cdfb6){var _0x5f00bb={};_0x5f00bb[_0x5cdfb6]={'$like':'%'+_0x535df0['query'][_0xeab6('0x3f')]+'%'};return _0x5f00bb;})});}_0x478ff3=_[_0xeab6('0x40')]({},_0x478ff3,_0x535df0[_0xeab6('0x4b')]);return _0x50eee0[_0xeab6('0x8a')](_0x478ff3);}})[_0xeab6('0x26')](function(_0x475c85){if(_0x475c85){_0x291f69=_0x475c85[_0xeab6('0x39')];if(!_0x535df0[_0xeab6('0x33')][_0xeab6('0x56')](_0xeab6('0x3a'))){_0x478ff3['limit']=qs['limit'](_0x535df0[_0xeab6('0x33')][_0xeab6('0x21')]);_0x478ff3[_0xeab6('0x20')]=qs[_0xeab6('0x20')](_0x535df0[_0xeab6('0x33')][_0xeab6('0x20')]);}return _0x50eee0[_0xeab6('0x8a')](_0x478ff3);}})[_0xeab6('0x26')](function(_0x377a37){if(_0x377a37){return _0x377a37?{'count':_0x291f69,'rows':_0x377a37}:null;}})[_0xeab6('0x26')](respondWithResult(_0x1d787b,null))['catch'](handleError(_0x1d787b,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 2750828..4cde9a1 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 _0xb4d9=['hasOwnProperty','hook','events','../../mysqldb','OpenchannelQueue','setMaxListeners','save','update','remove','emit'];(function(_0x1de215,_0x5e57b7){var _0x58bf22=function(_0x396c9a){while(--_0x396c9a){_0x1de215['push'](_0x1de215['shift']());}};_0x58bf22(++_0x5e57b7);}(_0xb4d9,0x84));var _0x9b4d=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0xb4d9[_0x36eaaa];return _0x461349;};'use strict';var EventEmitter=require(_0x9b4d('0x0'));var OpenchannelQueue=require(_0x9b4d('0x1'))['db'][_0x9b4d('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x9b4d('0x3')](0x0);var events={'afterCreate':_0x9b4d('0x4'),'afterUpdate':_0x9b4d('0x5'),'afterDestroy':_0x9b4d('0x6')};function emitEvent(_0x5ce6f8){return function(_0x828a8e,_0x1f9e2e,_0x17fae9){OpenchannelQueueEvents[_0x9b4d('0x7')](_0x5ce6f8+':'+_0x828a8e['id'],_0x828a8e);OpenchannelQueueEvents['emit'](_0x5ce6f8,_0x828a8e);_0x17fae9(null);};}for(var e in events){if(events[_0x9b4d('0x8')](e)){var event=events[e];OpenchannelQueue[_0x9b4d('0x9')](e,emitEvent(event));}}module['exports']=OpenchannelQueueEvents; \ No newline at end of file +var _0x187e=['remove','emit','hasOwnProperty','hook','events','../../mysqldb','OpenchannelQueue','setMaxListeners','update'];(function(_0x4c2cda,_0x5945b0){var _0x59c47d=function(_0x1df4c8){while(--_0x1df4c8){_0x4c2cda['push'](_0x4c2cda['shift']());}};_0x59c47d(++_0x5945b0);}(_0x187e,0x163));var _0xe187=function(_0x39a2ce,_0x2cd40a){_0x39a2ce=_0x39a2ce-0x0;var _0x4a15c2=_0x187e[_0x39a2ce];return _0x4a15c2;};'use strict';var EventEmitter=require(_0xe187('0x0'));var OpenchannelQueue=require(_0xe187('0x1'))['db'][_0xe187('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xe187('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xe187('0x4'),'afterDestroy':_0xe187('0x5')};function emitEvent(_0x5e2ae1){return function(_0x279dce,_0x16558c,_0x125776){OpenchannelQueueEvents['emit'](_0x5e2ae1+':'+_0x279dce['id'],_0x279dce);OpenchannelQueueEvents[_0xe187('0x6')](_0x5e2ae1,_0x279dce);_0x125776(null);};}for(var e in events){if(events[_0xe187('0x7')](e)){var event=events[e];OpenchannelQueue[_0xe187('0x8')](e,emitEvent(event));}}module['exports']=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index 78d89eb..f4158c2 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 _0x6a7b=['./openchannelQueue.attributes','OpenchannelQueue','openchannel_queues','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x55dc08,_0x48f8db){var _0x12d70a=function(_0x222dc9){while(--_0x222dc9){_0x55dc08['push'](_0x55dc08['shift']());}};_0x12d70a(++_0x48f8db);}(_0x6a7b,0x9d));var _0xb6a7=function(_0x29cb11,_0x51b883){_0x29cb11=_0x29cb11-0x0;var _0x4ec483=_0x6a7b[_0x29cb11];return _0x4ec483;};'use strict';var _=require(_0xb6a7('0x0'));var util=require('util');var logger=require(_0xb6a7('0x1'))(_0xb6a7('0x2'));var moment=require('moment');var BPromise=require(_0xb6a7('0x3'));var rp=require(_0xb6a7('0x4'));var fs=require('fs');var path=require(_0xb6a7('0x5'));var rimraf=require(_0xb6a7('0x6'));var config=require(_0xb6a7('0x7'));var attributes=require(_0xb6a7('0x8'));module['exports']=function(_0xcd6d17,_0x1157a4){return _0xcd6d17['define'](_0xb6a7('0x9'),attributes,{'tableName':_0xb6a7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbf1c=['api','moment','bluebird','rimraf','../../config/environment','./openchannelQueue.attributes','exports','define','OpenchannelQueue','lodash','util','../../config/logger'];(function(_0x20aaa2,_0x166cfd){var _0x430205=function(_0x30a211){while(--_0x30a211){_0x20aaa2['push'](_0x20aaa2['shift']());}};_0x430205(++_0x166cfd);}(_0xbf1c,0x1a1));var _0xcbf1=function(_0x617084,_0x27a65f){_0x617084=_0x617084-0x0;var _0x384ac0=_0xbf1c[_0x617084];return _0x384ac0;};'use strict';var _=require(_0xcbf1('0x0'));var util=require(_0xcbf1('0x1'));var logger=require(_0xcbf1('0x2'))(_0xcbf1('0x3'));var moment=require(_0xcbf1('0x4'));var BPromise=require(_0xcbf1('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xcbf1('0x6'));var config=require(_0xcbf1('0x7'));var attributes=require(_0xcbf1('0x8'));module[_0xcbf1('0x9')]=function(_0x3757c0,_0x4c2fe4){return _0x3757c0[_0xcbf1('0xa')](_0xcbf1('0xb'),attributes,{'tableName':'openchannel_queues','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 d77f0e7..0d6ab21 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 _0x1873=['ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./openchannelQueue.socket','request','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetOpenchannelQueue','options','include','map','model','attributes','then','catch','ShowOpenchannelQueue','OpenchannelQueue','raw','where','lodash','util','moment','randomstring'];(function(_0x3dde9b,_0x384897){var _0x3a3e8f=function(_0x1adb48){while(--_0x1adb48){_0x3dde9b['push'](_0x3dde9b['shift']());}};_0x3a3e8f(++_0x384897);}(_0x1873,0x10d));var _0x3187=function(_0x503916,_0xaaf27a){_0x503916=_0x503916-0x0;var _0x3c4e1d=_0x1873[_0x503916];return _0x3c4e1d;};'use strict';var _=require(_0x3187('0x0'));var util=require(_0x3187('0x1'));var moment=require(_0x3187('0x2'));var BPromise=require('bluebird');var rs=require(_0x3187('0x3'));var fs=require('fs');var Redis=require(_0x3187('0x4'));var db=require(_0x3187('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3187('0x6'));var config=require(_0x3187('0x7'));var jayson=require(_0x3187('0x8'));var client=jayson[_0x3187('0x9')][_0x3187('0xa')]({'port':0x232a});config['redis']=_[_0x3187('0xb')](config[_0x3187('0xc')],{'host':_0x3187('0xd'),'port':0x18eb});var socket=require(_0x3187('0xe'))(new Redis(config['redis']));require(_0x3187('0xf'))['register'](socket);function respondWithRpcPromise(_0x47bcf3,_0x4a46fe,_0x56494f){return new BPromise(function(_0x552316,_0x1dafff){return client[_0x3187('0x10')](_0x47bcf3,_0x56494f)['then'](function(_0x23ddcc){logger[_0x3187('0x11')](_0x3187('0x12'),_0x4a46fe,_0x3187('0x13'));logger[_0x3187('0x14')](_0x3187('0x15'),_0x4a46fe,_0x3187('0x13'),JSON[_0x3187('0x16')](_0x23ddcc));if(_0x23ddcc['error']){if(_0x23ddcc[_0x3187('0x17')][_0x3187('0x18')]===0x1f4){logger['error'](_0x3187('0x12'),_0x4a46fe,_0x23ddcc['error'][_0x3187('0x19')]);return _0x1dafff(_0x23ddcc['error'][_0x3187('0x19')]);}logger[_0x3187('0x17')](_0x3187('0x12'),_0x4a46fe,_0x23ddcc[_0x3187('0x17')][_0x3187('0x19')]);return _0x552316(_0x23ddcc[_0x3187('0x17')][_0x3187('0x19')]);}else{logger[_0x3187('0x11')](_0x3187('0x12'),_0x4a46fe,_0x3187('0x13'));_0x552316(_0x23ddcc[_0x3187('0x1a')][_0x3187('0x19')]);}})['catch'](function(_0x335ed7){logger[_0x3187('0x17')](_0x3187('0x12'),_0x4a46fe,_0x335ed7);_0x1dafff(_0x335ed7);});});}exports[_0x3187('0x1b')]=function(_0x4e11e0){var _0x1df6d2=this;return new Promise(function(_0x217d60,_0x57c2ab){return db['OpenchannelQueue']['findAll']({'raw':_0x4e11e0[_0x3187('0x1c')]?_0x4e11e0['options']['raw']===undefined?!![]:![]:!![],'where':_0x4e11e0['options']?_0x4e11e0[_0x3187('0x1c')]['where']||null:null,'attributes':_0x4e11e0[_0x3187('0x1c')]?_0x4e11e0[_0x3187('0x1c')]['attributes']||null:null,'limit':_0x4e11e0[_0x3187('0x1c')]?_0x4e11e0[_0x3187('0x1c')]['limit']||null:null,'include':_0x4e11e0[_0x3187('0x1c')]?_0x4e11e0[_0x3187('0x1c')][_0x3187('0x1d')]?_[_0x3187('0x1e')](_0x4e11e0[_0x3187('0x1c')]['include'],function(_0x50c828){return{'model':db[_0x50c828[_0x3187('0x1f')]],'as':_0x50c828['as'],'attributes':_0x50c828['attributes'],'include':_0x50c828[_0x3187('0x1d')]?_[_0x3187('0x1e')](_0x50c828[_0x3187('0x1d')],function(_0xc43a65){return{'model':db[_0xc43a65['model']],'as':_0xc43a65['as'],'attributes':_0xc43a65[_0x3187('0x20')],'include':_0xc43a65[_0x3187('0x1d')]?_['map'](_0xc43a65[_0x3187('0x1d')],function(_0x308e51){return{'model':db[_0x308e51[_0x3187('0x1f')]],'as':_0x308e51['as'],'attributes':_0x308e51[_0x3187('0x20')]};}):[]};}):[]};}):[]:[]})[_0x3187('0x21')](function(_0x5c660c){logger[_0x3187('0x11')]('GetOpenchannelQueue',_0x4e11e0);logger[_0x3187('0x14')](_0x3187('0x1b'),_0x4e11e0,JSON[_0x3187('0x16')](_0x5c660c));_0x217d60(_0x5c660c);})[_0x3187('0x22')](function(_0x4c4871){logger[_0x3187('0x17')](_0x3187('0x1b'),_0x4c4871[_0x3187('0x19')],_0x4e11e0);_0x57c2ab(_0x1df6d2['error'](0x1f4,_0x4c4871[_0x3187('0x19')]));});});};exports[_0x3187('0x23')]=function(_0x30c97a){var _0x486826=this;return new Promise(function(_0x40c04b,_0x4cbaba){return db[_0x3187('0x24')]['find']({'raw':_0x30c97a['options']?_0x30c97a[_0x3187('0x1c')][_0x3187('0x25')]===undefined?!![]:![]:!![],'where':_0x30c97a['options']?_0x30c97a[_0x3187('0x1c')][_0x3187('0x26')]||null:null,'attributes':_0x30c97a[_0x3187('0x1c')]?_0x30c97a['options'][_0x3187('0x20')]||null:null,'include':_0x30c97a[_0x3187('0x1c')]?_0x30c97a[_0x3187('0x1c')][_0x3187('0x1d')]?_['map'](_0x30c97a['options'][_0x3187('0x1d')],function(_0x4dc921){return{'model':db[_0x4dc921[_0x3187('0x1f')]],'as':_0x4dc921['as'],'attributes':_0x4dc921[_0x3187('0x20')],'include':_0x4dc921[_0x3187('0x1d')]?_[_0x3187('0x1e')](_0x4dc921['include'],function(_0x362a5c){return{'model':db[_0x362a5c['model']],'as':_0x362a5c['as'],'attributes':_0x362a5c[_0x3187('0x20')],'include':_0x362a5c[_0x3187('0x1d')]?_[_0x3187('0x1e')](_0x362a5c[_0x3187('0x1d')],function(_0x4ee78e){return{'model':db[_0x4ee78e[_0x3187('0x1f')]],'as':_0x4ee78e['as'],'attributes':_0x4ee78e[_0x3187('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4562b6){logger[_0x3187('0x11')]('ShowOpenchannelQueue',_0x30c97a);logger[_0x3187('0x14')]('ShowOpenchannelQueue',_0x30c97a,JSON[_0x3187('0x16')](_0x4562b6));_0x40c04b(_0x4562b6);})[_0x3187('0x22')](function(_0x2856b2){logger[_0x3187('0x17')](_0x3187('0x23'),_0x2856b2[_0x3187('0x19')],_0x30c97a);_0x4cbaba(_0x486826[_0x3187('0x17')](0x1f4,_0x2856b2[_0x3187('0x19')]));});});}; \ No newline at end of file +var _0xbdef=['result','catch','GetOpenchannelQueue','OpenchannelQueue','findAll','options','raw','limit','include','map','model','attributes','debug','find','ShowOpenchannelQueue','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','request','then','info','request\x20sent','stringify','error','message','OpenchannelQueue,\x20%s,\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbdef,0x1f0));var _0xfbde=function(_0x3ae9a2,_0x563f9c){_0x3ae9a2=_0x3ae9a2-0x0;var _0x4d83e6=_0xbdef[_0x3ae9a2];return _0x4d83e6;};'use strict';var _=require(_0xfbde('0x0'));var util=require(_0xfbde('0x1'));var moment=require('moment');var BPromise=require(_0xfbde('0x2'));var rs=require(_0xfbde('0x3'));var fs=require('fs');var Redis=require(_0xfbde('0x4'));var db=require(_0xfbde('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xfbde('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0xfbde('0x7')]({'port':0x232a});config[_0xfbde('0x8')]=_[_0xfbde('0x9')](config['redis'],{'host':_0xfbde('0xa'),'port':0x18eb});var socket=require(_0xfbde('0xb'))(new Redis(config[_0xfbde('0x8')]));require(_0xfbde('0xc'))[_0xfbde('0xd')](socket);function respondWithRpcPromise(_0x569761,_0x2154bb,_0x445de3){return new BPromise(function(_0x12a6d3,_0x4694cd){return client[_0xfbde('0xe')](_0x569761,_0x445de3)[_0xfbde('0xf')](function(_0x5636cf){logger[_0xfbde('0x10')]('OpenchannelQueue,\x20%s,\x20%s',_0x2154bb,'request\x20sent');logger['debug']('OpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x2154bb,_0xfbde('0x11'),JSON[_0xfbde('0x12')](_0x5636cf));if(_0x5636cf['error']){if(_0x5636cf[_0xfbde('0x13')]['code']===0x1f4){logger['error']('OpenchannelQueue,\x20%s,\x20%s',_0x2154bb,_0x5636cf[_0xfbde('0x13')][_0xfbde('0x14')]);return _0x4694cd(_0x5636cf['error']['message']);}logger[_0xfbde('0x13')](_0xfbde('0x15'),_0x2154bb,_0x5636cf[_0xfbde('0x13')]['message']);return _0x12a6d3(_0x5636cf['error'][_0xfbde('0x14')]);}else{logger[_0xfbde('0x10')](_0xfbde('0x15'),_0x2154bb,'request\x20sent');_0x12a6d3(_0x5636cf[_0xfbde('0x16')][_0xfbde('0x14')]);}})[_0xfbde('0x17')](function(_0x37a88d){logger[_0xfbde('0x13')](_0xfbde('0x15'),_0x2154bb,_0x37a88d);_0x4694cd(_0x37a88d);});});}exports[_0xfbde('0x18')]=function(_0x37be5b){var _0x19af38=this;return new Promise(function(_0x23fb45,_0x228638){return db[_0xfbde('0x19')][_0xfbde('0x1a')]({'raw':_0x37be5b[_0xfbde('0x1b')]?_0x37be5b[_0xfbde('0x1b')][_0xfbde('0x1c')]===undefined?!![]:![]:!![],'where':_0x37be5b[_0xfbde('0x1b')]?_0x37be5b[_0xfbde('0x1b')]['where']||null:null,'attributes':_0x37be5b[_0xfbde('0x1b')]?_0x37be5b[_0xfbde('0x1b')]['attributes']||null:null,'limit':_0x37be5b[_0xfbde('0x1b')]?_0x37be5b[_0xfbde('0x1b')][_0xfbde('0x1d')]||null:null,'include':_0x37be5b['options']?_0x37be5b[_0xfbde('0x1b')][_0xfbde('0x1e')]?_[_0xfbde('0x1f')](_0x37be5b['options'][_0xfbde('0x1e')],function(_0x2f0c17){return{'model':db[_0x2f0c17[_0xfbde('0x20')]],'as':_0x2f0c17['as'],'attributes':_0x2f0c17['attributes'],'include':_0x2f0c17['include']?_[_0xfbde('0x1f')](_0x2f0c17[_0xfbde('0x1e')],function(_0x4db7ae){return{'model':db[_0x4db7ae[_0xfbde('0x20')]],'as':_0x4db7ae['as'],'attributes':_0x4db7ae[_0xfbde('0x21')],'include':_0x4db7ae[_0xfbde('0x1e')]?_['map'](_0x4db7ae['include'],function(_0x3049e4){return{'model':db[_0x3049e4['model']],'as':_0x3049e4['as'],'attributes':_0x3049e4['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5ed577){logger[_0xfbde('0x10')](_0xfbde('0x18'),_0x37be5b);logger[_0xfbde('0x22')](_0xfbde('0x18'),_0x37be5b,JSON[_0xfbde('0x12')](_0x5ed577));_0x23fb45(_0x5ed577);})[_0xfbde('0x17')](function(_0x321d36){logger[_0xfbde('0x13')](_0xfbde('0x18'),_0x321d36[_0xfbde('0x14')],_0x37be5b);_0x228638(_0x19af38[_0xfbde('0x13')](0x1f4,_0x321d36[_0xfbde('0x14')]));});});};exports['ShowOpenchannelQueue']=function(_0xc546bc){var _0x4b4082=this;return new Promise(function(_0x9a6b7d,_0x5e0832){return db[_0xfbde('0x19')][_0xfbde('0x23')]({'raw':_0xc546bc[_0xfbde('0x1b')]?_0xc546bc['options'][_0xfbde('0x1c')]===undefined?!![]:![]:!![],'where':_0xc546bc['options']?_0xc546bc['options']['where']||null:null,'attributes':_0xc546bc[_0xfbde('0x1b')]?_0xc546bc[_0xfbde('0x1b')][_0xfbde('0x21')]||null:null,'include':_0xc546bc[_0xfbde('0x1b')]?_0xc546bc[_0xfbde('0x1b')][_0xfbde('0x1e')]?_[_0xfbde('0x1f')](_0xc546bc['options']['include'],function(_0x257344){return{'model':db[_0x257344[_0xfbde('0x20')]],'as':_0x257344['as'],'attributes':_0x257344['attributes'],'include':_0x257344['include']?_[_0xfbde('0x1f')](_0x257344['include'],function(_0x661427){return{'model':db[_0x661427[_0xfbde('0x20')]],'as':_0x661427['as'],'attributes':_0x661427[_0xfbde('0x21')],'include':_0x661427[_0xfbde('0x1e')]?_['map'](_0x661427[_0xfbde('0x1e')],function(_0x1efc9b){return{'model':db[_0x1efc9b['model']],'as':_0x1efc9b['as'],'attributes':_0x1efc9b[_0xfbde('0x21')]};}):[]};}):[]};}):[]:[]})[_0xfbde('0xf')](function(_0x100a61){logger['info'](_0xfbde('0x24'),_0xc546bc);logger[_0xfbde('0x22')]('ShowOpenchannelQueue',_0xc546bc,JSON[_0xfbde('0x12')](_0x100a61));_0x9a6b7d(_0x100a61);})[_0xfbde('0x17')](function(_0x211c81){logger[_0xfbde('0x13')]('ShowOpenchannelQueue',_0x211c81[_0xfbde('0x14')],_0xc546bc);_0x5e0832(_0x4b4082['error'](0x1f4,_0x211c81[_0xfbde('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 8bb0557..051aa11 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 _0xfa92=['length','openchannelQueue:','./openchannelQueue.events','save','update','emit','removeListener','register'];(function(_0x264060,_0x4781ed){var _0x59fa32=function(_0x478a93){while(--_0x478a93){_0x264060['push'](_0x264060['shift']());}};_0x59fa32(++_0x4781ed);}(_0xfa92,0x192));var _0x2fa9=function(_0x167f19,_0x12b72c){_0x167f19=_0x167f19-0x0;var _0xc9699=_0xfa92[_0x167f19];return _0xc9699;};'use strict';var OpenchannelQueueEvents=require(_0x2fa9('0x0'));var events=[_0x2fa9('0x1'),'remove',_0x2fa9('0x2')];function createListener(_0x2ab0de,_0x4daaea){return function(_0x70a595){_0x4daaea[_0x2fa9('0x3')](_0x2ab0de,_0x70a595);};}function removeListener(_0x54cdc6,_0x269fed){return function(){OpenchannelQueueEvents[_0x2fa9('0x4')](_0x54cdc6,_0x269fed);};}exports[_0x2fa9('0x5')]=function(_0x1e74b8){for(var _0x2f1c82=0x0,_0x286792=events[_0x2fa9('0x6')];_0x2f1c82<_0x286792;_0x2f1c82++){var _0x2b855f=events[_0x2f1c82];var _0x4a6ae0=createListener(_0x2fa9('0x7')+_0x2b855f,_0x1e74b8);OpenchannelQueueEvents['on'](_0x2b855f,_0x4a6ae0);}}; \ No newline at end of file +var _0xaaa8=['length','openchannelQueue:','remove','emit','removeListener'];(function(_0x24a7df,_0x4c6ec4){var _0x883e2b=function(_0x40d11d){while(--_0x40d11d){_0x24a7df['push'](_0x24a7df['shift']());}};_0x883e2b(++_0x4c6ec4);}(_0xaaa8,0xf7));var _0x8aaa=function(_0x5bd151,_0x177ad2){_0x5bd151=_0x5bd151-0x0;var _0x507cd8=_0xaaa8[_0x5bd151];return _0x507cd8;};'use strict';var OpenchannelQueueEvents=require('./openchannelQueue.events');var events=['save',_0x8aaa('0x0'),'update'];function createListener(_0x5969a6,_0x648a6c){return function(_0x52b7eb){_0x648a6c[_0x8aaa('0x1')](_0x5969a6,_0x52b7eb);};}function removeListener(_0x5ee057,_0x5bcedb){return function(){OpenchannelQueueEvents[_0x8aaa('0x2')](_0x5ee057,_0x5bcedb);};}exports['register']=function(_0x49a5f5){for(var _0x4e45e0=0x0,_0xe463b3=events[_0x8aaa('0x3')];_0x4e45e0<_0xe463b3;_0x4e45e0++){var _0x2f6e54=events[_0x4e45e0];var _0xc6ea70=createListener(_0x8aaa('0x4')+_0x2f6e54,_0x49a5f5);OpenchannelQueueEvents['on'](_0x2f6e54,_0xc6ea70);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index aa7bf17..9b7c0d9 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 _0x6c67=['get','/describe','describe','/:id','put','delete','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','isAuthenticated'];(function(_0x4b0a5a,_0x49f7ab){var _0x12d259=function(_0x3cc158){while(--_0x3cc158){_0x4b0a5a['push'](_0x4b0a5a['shift']());}};_0x12d259(++_0x49f7ab);}(_0x6c67,0xd9));var _0x76c6=function(_0x24f31b,_0x44b8f3){_0x24f31b=_0x24f31b-0x0;var _0x488401=_0x6c67[_0x24f31b];return _0x488401;};'use strict';var multer=require(_0x76c6('0x0'));var util=require(_0x76c6('0x1'));var path=require(_0x76c6('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x76c6('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x76c6('0x4'));var config=require(_0x76c6('0x5'));var controller=require('./openchannelQueueReport.controller');router['get']('/',auth[_0x76c6('0x6')](),controller['index']);router[_0x76c6('0x7')](_0x76c6('0x8'),auth['isAuthenticated'](),controller[_0x76c6('0x9')]);router['get'](_0x76c6('0xa'),auth[_0x76c6('0x6')](),controller['show']);router['post']('/',auth[_0x76c6('0x6')](),controller['create']);router[_0x76c6('0xb')](_0x76c6('0xa'),auth[_0x76c6('0x6')](),controller['update']);router[_0x76c6('0xc')](_0x76c6('0xa'),auth[_0x76c6('0x6')](),controller['destroy']);module[_0x76c6('0xd')]=router; \ No newline at end of file +var _0xf3c2=['/:id','delete','multer','path','connect-timeout','express','Router','../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated','index','/describe','show','post','create'];(function(_0x4148e3,_0x518fa9){var _0x36aa6c=function(_0x47317a){while(--_0x47317a){_0x4148e3['push'](_0x4148e3['shift']());}};_0x36aa6c(++_0x518fa9);}(_0xf3c2,0xb2));var _0x2f3c=function(_0x385847,_0x150ded){_0x385847=_0x385847-0x0;var _0x48e2f2=_0xf3c2[_0x385847];return _0x48e2f2;};'use strict';var multer=require(_0x2f3c('0x0'));var util=require('util');var path=require(_0x2f3c('0x1'));var timeout=require(_0x2f3c('0x2'));var express=require(_0x2f3c('0x3'));var router=express[_0x2f3c('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x2f3c('0x5'));var controller=require(_0x2f3c('0x6'));router[_0x2f3c('0x7')]('/',auth[_0x2f3c('0x8')](),controller[_0x2f3c('0x9')]);router[_0x2f3c('0x7')](_0x2f3c('0xa'),auth[_0x2f3c('0x8')](),controller['describe']);router[_0x2f3c('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x2f3c('0xb')]);router[_0x2f3c('0xc')]('/',auth['isAuthenticated'](),controller[_0x2f3c('0xd')]);router['put'](_0x2f3c('0xe'),auth[_0x2f3c('0x8')](),controller['update']);router[_0x2f3c('0xf')](_0x2f3c('0xe'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 8db6260..d36a543 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 _0xf839=['STRING','DATE','moment','sequelize'];(function(_0x4efa74,_0xacde8d){var _0xc92b1f=function(_0x43ac6c){while(--_0x43ac6c){_0x4efa74['push'](_0x4efa74['shift']());}};_0xc92b1f(++_0xacde8d);}(_0xf839,0x66));var _0x9f83=function(_0x54c500,_0x496b00){_0x54c500=_0x54c500-0x0;var _0x4aae64=_0xf839[_0x54c500];return _0x4aae64;};'use strict';var moment=require(_0x9f83('0x0'));var Sequelize=require(_0x9f83('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x9f83('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x9f83('0x3')]},'exitAt':{'type':Sequelize[_0x9f83('0x3')]},'reason':{'type':Sequelize[_0x9f83('0x2')]}}; \ No newline at end of file +var _0x9e85=['sequelize','exports','STRING','DATE'];(function(_0x491703,_0x1555a5){var _0x8d144a=function(_0x1a2664){while(--_0x1a2664){_0x491703['push'](_0x491703['shift']());}};_0x8d144a(++_0x1555a5);}(_0x9e85,0x144));var _0x59e8=function(_0x514727,_0x187a84){_0x514727=_0x514727-0x0;var _0x11ec78=_0x9e85[_0x514727];return _0x11ec78;};'use strict';var moment=require('moment');var Sequelize=require(_0x59e8('0x0'));module[_0x59e8('0x1')]={'uniqueid':{'type':Sequelize[_0x59e8('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x59e8('0x2')]},'joinAt':{'type':Sequelize[_0x59e8('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x59e8('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x59e8('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 698975c..cca0470 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 _0x37a7=['key','model','map','query','keys','attributes','intersection','fields','length','nolimit','limit','order','where','filters','pick','filter','merge','VIRTUAL','options','OpenchannelQueueReport','includeAll','include','findAll','rows','catch','params','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../config/utils','../../config/environment','status','json','count','offset','set','Content-Range','apply','reject','update','then','sendStatus','error','stack','name','send','index','rawAttributes','type'];(function(_0x35c14a,_0x1b9dc0){var _0x302d92=function(_0x401808){while(--_0x401808){_0x35c14a['push'](_0x35c14a['shift']());}};_0x302d92(++_0x1b9dc0);}(_0x37a7,0xe1));var _0x737a=function(_0x2d6aff,_0x175425){_0x2d6aff=_0x2d6aff-0x0;var _0x332d6d=_0x37a7[_0x2d6aff];return _0x332d6d;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x737a('0x0'));var rimraf=require(_0x737a('0x1'));var zipdir=require(_0x737a('0x2'));var jsonpatch=require(_0x737a('0x3'));var rp=require('request-promise');var moment=require(_0x737a('0x4'));var BPromise=require(_0x737a('0x5'));var Mustache=require('mustache');var util=require(_0x737a('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x737a('0x7'));var fs=require('fs');var _=require(_0x737a('0x8'));var squel=require(_0x737a('0x9'));var crypto=require(_0x737a('0xa'));var jsforce=require(_0x737a('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x737a('0xc'));var Papa=require(_0x737a('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x737a('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x737a('0xf'));var config=require(_0x737a('0x10'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3dc7a7,_0x10d015){_0x10d015=_0x10d015||0xcc;return function(_0x280306){if(_0x280306){return _0x3dc7a7['sendStatus'](_0x10d015);}return _0x3dc7a7[_0x737a('0x11')](_0x10d015)['end']();};}function respondWithResult(_0x225b1f,_0xadf5ba){_0xadf5ba=_0xadf5ba||0xc8;return function(_0x33d59e){if(_0x33d59e){return _0x225b1f[_0x737a('0x11')](_0xadf5ba)[_0x737a('0x12')](_0x33d59e);}};}function respondWithFilteredResult(_0x582f07,_0x3d28c2){return function(_0x20513f){if(_0x20513f){var _0x4a61ce=_0x20513f[_0x737a('0x13')],_0x4f6dba=_0x3d28c2[_0x737a('0x14')],_0x381cd5=_0x3d28c2['offset']+_0x3d28c2['limit'],_0x25d064;if(_0x381cd5>=_0x4a61ce){_0x381cd5=_0x4a61ce;_0x25d064=0xc8;}else{_0x25d064=0xce;}_0x582f07[_0x737a('0x11')](_0x25d064);return _0x582f07[_0x737a('0x15')](_0x737a('0x16'),_0x4f6dba+'-'+_0x381cd5+'/'+_0x4a61ce)['json'](_0x20513f);}return null;};}function patchUpdates(_0x2ece79){return function(_0xa1c2ac){try{jsonpatch[_0x737a('0x17')](_0xa1c2ac,_0x2ece79,!![]);}catch(_0xb96247){return BPromise[_0x737a('0x18')](_0xb96247);}return _0xa1c2ac['save']();};}function saveUpdates(_0x56116e,_0x2b0e91){return function(_0x1d3833){if(_0x1d3833){return _0x1d3833[_0x737a('0x19')](_0x56116e)[_0x737a('0x1a')](function(_0x3c39c8){return _0x3c39c8;});}return null;};}function removeEntity(_0x23e5f0,_0x3b5cbd){return function(_0x868d2a){if(_0x868d2a){return _0x868d2a['destroy']()[_0x737a('0x1a')](function(){_0x23e5f0[_0x737a('0x11')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1581be,_0x546535){return function(_0x232d62){if(!_0x232d62){_0x1581be[_0x737a('0x1b')](0x194);}return _0x232d62;};}function handleError(_0x55438a,_0x1cc36c){_0x1cc36c=_0x1cc36c||0x1f4;return function(_0x96ef2f){logger[_0x737a('0x1c')](_0x96ef2f[_0x737a('0x1d')]);if(_0x96ef2f[_0x737a('0x1e')]){delete _0x96ef2f[_0x737a('0x1e')];}_0x55438a['status'](_0x1cc36c)[_0x737a('0x1f')](_0x96ef2f);};}exports[_0x737a('0x20')]=function(_0x11420a,_0x390006){var _0xae1fd1={},_0x1f27f5={},_0x430772={'count':0x0,'rows':[]};var _0x5092d2=_['map'](db['OpenchannelQueueReport'][_0x737a('0x21')],function(_0x2b6983){return{'name':_0x2b6983['fieldName'],'type':_0x2b6983[_0x737a('0x22')][_0x737a('0x23')]};});_0x1f27f5[_0x737a('0x24')]=_[_0x737a('0x25')](_0x5092d2,_0x737a('0x1e'));_0x1f27f5[_0x737a('0x26')]=_[_0x737a('0x27')](_0x11420a[_0x737a('0x26')]);_0x1f27f5['filters']=_['intersection'](_0x1f27f5[_0x737a('0x24')],_0x1f27f5[_0x737a('0x26')]);_0xae1fd1[_0x737a('0x28')]=_[_0x737a('0x29')](_0x1f27f5[_0x737a('0x24')],qs[_0x737a('0x2a')](_0x11420a['query'][_0x737a('0x2a')]));_0xae1fd1[_0x737a('0x28')]=_0xae1fd1[_0x737a('0x28')][_0x737a('0x2b')]?_0xae1fd1[_0x737a('0x28')]:_0x1f27f5['model'];if(!_0x11420a['query']['hasOwnProperty'](_0x737a('0x2c'))){_0xae1fd1[_0x737a('0x2d')]=qs[_0x737a('0x2d')](_0x11420a['query'][_0x737a('0x2d')]);_0xae1fd1['offset']=qs['offset'](_0x11420a[_0x737a('0x26')]['offset']);}_0xae1fd1[_0x737a('0x2e')]=qs['sort'](_0x11420a[_0x737a('0x26')]['sort']);_0xae1fd1[_0x737a('0x2f')]=qs[_0x737a('0x30')](_[_0x737a('0x31')](_0x11420a[_0x737a('0x26')],_0x1f27f5[_0x737a('0x30')]),_0x5092d2);if(_0x11420a[_0x737a('0x26')][_0x737a('0x32')]){_0xae1fd1['where']=_[_0x737a('0x33')](_0xae1fd1[_0x737a('0x2f')],{'$or':_[_0x737a('0x25')](_0x5092d2,function(_0x4923e0){if(_0x4923e0[_0x737a('0x22')]!==_0x737a('0x34')){var _0x3bb67c={};_0x3bb67c[_0x4923e0[_0x737a('0x1e')]]={'$like':'%'+_0x11420a[_0x737a('0x26')][_0x737a('0x32')]+'%'};return _0x3bb67c;}})});}_0xae1fd1=_[_0x737a('0x33')]({},_0xae1fd1,_0x11420a[_0x737a('0x35')]);var _0x35b6ad={'where':_0xae1fd1[_0x737a('0x2f')]};return db[_0x737a('0x36')][_0x737a('0x13')](_0x35b6ad)['then'](function(_0x17f34f){_0x430772[_0x737a('0x13')]=_0x17f34f;if(_0x11420a['query'][_0x737a('0x37')]){_0xae1fd1[_0x737a('0x38')]=[{'all':!![]}];}return db['OpenchannelQueueReport'][_0x737a('0x39')](_0xae1fd1);})[_0x737a('0x1a')](function(_0x10622a){_0x430772[_0x737a('0x3a')]=_0x10622a;return _0x430772;})[_0x737a('0x1a')](respondWithFilteredResult(_0x390006,_0xae1fd1))[_0x737a('0x3b')](handleError(_0x390006,null));};exports['show']=function(_0x19c889,_0x145c3b){var _0x244acd={'raw':!![],'where':{'id':_0x19c889[_0x737a('0x3c')]['id']}},_0x1667fa={};_0x1667fa[_0x737a('0x24')]=_[_0x737a('0x27')](db['OpenchannelQueueReport'][_0x737a('0x21')]);_0x1667fa[_0x737a('0x26')]=_[_0x737a('0x27')](_0x19c889[_0x737a('0x26')]);_0x1667fa[_0x737a('0x30')]=_['intersection'](_0x1667fa[_0x737a('0x24')],_0x1667fa['query']);_0x244acd[_0x737a('0x28')]=_[_0x737a('0x29')](_0x1667fa[_0x737a('0x24')],qs[_0x737a('0x2a')](_0x19c889[_0x737a('0x26')][_0x737a('0x2a')]));_0x244acd['attributes']=_0x244acd['attributes'][_0x737a('0x2b')]?_0x244acd['attributes']:_0x1667fa['model'];if(_0x19c889[_0x737a('0x26')][_0x737a('0x37')]){_0x244acd['include']=[{'all':!![]}];}_0x244acd=_[_0x737a('0x33')]({},_0x244acd,_0x19c889[_0x737a('0x35')]);return db[_0x737a('0x36')][_0x737a('0x3d')](_0x244acd)[_0x737a('0x1a')](handleEntityNotFound(_0x145c3b,null))[_0x737a('0x1a')](respondWithResult(_0x145c3b,null))['catch'](handleError(_0x145c3b,null));};exports[_0x737a('0x3e')]=function(_0x35a326,_0x29bb03){return db['OpenchannelQueueReport']['create'](_0x35a326[_0x737a('0x3f')],{})['then'](respondWithResult(_0x29bb03,0xc9))[_0x737a('0x3b')](handleError(_0x29bb03,null));};exports[_0x737a('0x19')]=function(_0x1bd76c,_0xc9a497){if(_0x1bd76c[_0x737a('0x3f')]['id']){delete _0x1bd76c['body']['id'];}return db[_0x737a('0x36')][_0x737a('0x3d')]({'where':{'id':_0x1bd76c[_0x737a('0x3c')]['id']}})[_0x737a('0x1a')](handleEntityNotFound(_0xc9a497,null))['then'](saveUpdates(_0x1bd76c[_0x737a('0x3f')],null))[_0x737a('0x1a')](respondWithResult(_0xc9a497,null))['catch'](handleError(_0xc9a497,null));};exports[_0x737a('0x40')]=function(_0x3d0a80,_0x404fba){return db[_0x737a('0x36')][_0x737a('0x3d')]({'where':{'id':_0x3d0a80[_0x737a('0x3c')]['id']}})[_0x737a('0x1a')](handleEntityNotFound(_0x404fba,null))['then'](removeEntity(_0x404fba,null))[_0x737a('0x3b')](handleError(_0x404fba,null));};exports['describe']=function(_0x5472dc,_0x33630b){return db[_0x737a('0x36')]['describe']()['then'](respondWithResult(_0x33630b,null))[_0x737a('0x3b')](handleError(_0x33630b,null));}; \ No newline at end of file +var _0xee49=['ejs','squel','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','save','then','destroy','sendStatus','error','stack','name','send','index','OpenchannelQueueReport','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','VIRTUAL','merge','include','findAll','rows','show','params','includeAll','options','find','catch','create','update','body','describe','rimraf','zip-dir','moment','bluebird','util','path','sox','to-csv'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xee49,0x15b));var _0x9ee4=function(_0x134d1d,_0x22b473){_0x134d1d=_0x134d1d-0x0;var _0x30b003=_0xee49[_0x134d1d];return _0x30b003;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x9ee4('0x0'));var zipdir=require(_0x9ee4('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x9ee4('0x2'));var BPromise=require(_0x9ee4('0x3'));var Mustache=require('mustache');var util=require(_0x9ee4('0x4'));var path=require(_0x9ee4('0x5'));var sox=require(_0x9ee4('0x6'));var csv=require(_0x9ee4('0x7'));var ejs=require(_0x9ee4('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x9ee4('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x9ee4('0xa'));var toCsv=require(_0x9ee4('0x7'));var querystring=require(_0x9ee4('0xb'));var Papa=require('papaparse');var Redis=require(_0x9ee4('0xc'));var authService=require(_0x9ee4('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x9ee4('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9ee4('0xf'))('api');var utils=require(_0x9ee4('0x10'));var config=require(_0x9ee4('0x11'));var db=require(_0x9ee4('0x12'))['db'];function respondWithStatusCode(_0x2ac73e,_0x14a29f){_0x14a29f=_0x14a29f||0xcc;return function(_0x2844f7){if(_0x2844f7){return _0x2ac73e['sendStatus'](_0x14a29f);}return _0x2ac73e[_0x9ee4('0x13')](_0x14a29f)[_0x9ee4('0x14')]();};}function respondWithResult(_0x4da639,_0x58919b){_0x58919b=_0x58919b||0xc8;return function(_0x1148e5){if(_0x1148e5){return _0x4da639[_0x9ee4('0x13')](_0x58919b)[_0x9ee4('0x15')](_0x1148e5);}};}function respondWithFilteredResult(_0x2a5e6a,_0x7524c0){return function(_0x3a7642){if(_0x3a7642){var _0x5d4641=_0x3a7642[_0x9ee4('0x16')],_0x77f51f=_0x7524c0[_0x9ee4('0x17')],_0x20ee4b=_0x7524c0[_0x9ee4('0x17')]+_0x7524c0[_0x9ee4('0x18')],_0xc27f41;if(_0x20ee4b>=_0x5d4641){_0x20ee4b=_0x5d4641;_0xc27f41=0xc8;}else{_0xc27f41=0xce;}_0x2a5e6a[_0x9ee4('0x13')](_0xc27f41);return _0x2a5e6a[_0x9ee4('0x19')](_0x9ee4('0x1a'),_0x77f51f+'-'+_0x20ee4b+'/'+_0x5d4641)[_0x9ee4('0x15')](_0x3a7642);}return null;};}function patchUpdates(_0x2a745f){return function(_0x195424){try{jsonpatch[_0x9ee4('0x1b')](_0x195424,_0x2a745f,!![]);}catch(_0x234cc3){return BPromise['reject'](_0x234cc3);}return _0x195424[_0x9ee4('0x1c')]();};}function saveUpdates(_0x1e07cd,_0x448f39){return function(_0x54dc69){if(_0x54dc69){return _0x54dc69['update'](_0x1e07cd)[_0x9ee4('0x1d')](function(_0x1c3457){return _0x1c3457;});}return null;};}function removeEntity(_0x4cd8e6,_0x4f62bc){return function(_0x243192){if(_0x243192){return _0x243192[_0x9ee4('0x1e')]()[_0x9ee4('0x1d')](function(){_0x4cd8e6[_0x9ee4('0x13')](0xcc)[_0x9ee4('0x14')]();});}};}function handleEntityNotFound(_0x279ec3,_0x2c78b9){return function(_0x58c207){if(!_0x58c207){_0x279ec3[_0x9ee4('0x1f')](0x194);}return _0x58c207;};}function handleError(_0x5ac658,_0x55c764){_0x55c764=_0x55c764||0x1f4;return function(_0xe22ca0){logger[_0x9ee4('0x20')](_0xe22ca0[_0x9ee4('0x21')]);if(_0xe22ca0['name']){delete _0xe22ca0[_0x9ee4('0x22')];}_0x5ac658['status'](_0x55c764)[_0x9ee4('0x23')](_0xe22ca0);};}exports[_0x9ee4('0x24')]=function(_0x544591,_0x4d0443){var _0x420f39={},_0x7e162c={},_0x327328={'count':0x0,'rows':[]};var _0x4bcf42=_['map'](db[_0x9ee4('0x25')][_0x9ee4('0x26')],function(_0x431a21){return{'name':_0x431a21['fieldName'],'type':_0x431a21[_0x9ee4('0x27')][_0x9ee4('0x28')]};});_0x7e162c[_0x9ee4('0x29')]=_[_0x9ee4('0x2a')](_0x4bcf42,'name');_0x7e162c[_0x9ee4('0x2b')]=_[_0x9ee4('0x2c')](_0x544591[_0x9ee4('0x2b')]);_0x7e162c[_0x9ee4('0x2d')]=_[_0x9ee4('0x2e')](_0x7e162c['model'],_0x7e162c['query']);_0x420f39[_0x9ee4('0x2f')]=_[_0x9ee4('0x2e')](_0x7e162c[_0x9ee4('0x29')],qs[_0x9ee4('0x30')](_0x544591[_0x9ee4('0x2b')][_0x9ee4('0x30')]));_0x420f39[_0x9ee4('0x2f')]=_0x420f39[_0x9ee4('0x2f')][_0x9ee4('0x31')]?_0x420f39[_0x9ee4('0x2f')]:_0x7e162c[_0x9ee4('0x29')];if(!_0x544591[_0x9ee4('0x2b')][_0x9ee4('0x32')](_0x9ee4('0x33'))){_0x420f39[_0x9ee4('0x18')]=qs['limit'](_0x544591[_0x9ee4('0x2b')][_0x9ee4('0x18')]);_0x420f39[_0x9ee4('0x17')]=qs[_0x9ee4('0x17')](_0x544591[_0x9ee4('0x2b')]['offset']);}_0x420f39[_0x9ee4('0x34')]=qs[_0x9ee4('0x35')](_0x544591['query'][_0x9ee4('0x35')]);_0x420f39['where']=qs[_0x9ee4('0x2d')](_['pick'](_0x544591['query'],_0x7e162c[_0x9ee4('0x2d')]),_0x4bcf42);if(_0x544591[_0x9ee4('0x2b')][_0x9ee4('0x36')]){_0x420f39[_0x9ee4('0x37')]=_['merge'](_0x420f39['where'],{'$or':_[_0x9ee4('0x2a')](_0x4bcf42,function(_0x5112c5){if(_0x5112c5[_0x9ee4('0x27')]!==_0x9ee4('0x38')){var _0xa242fa={};_0xa242fa[_0x5112c5[_0x9ee4('0x22')]]={'$like':'%'+_0x544591['query'][_0x9ee4('0x36')]+'%'};return _0xa242fa;}})});}_0x420f39=_[_0x9ee4('0x39')]({},_0x420f39,_0x544591['options']);var _0x439fef={'where':_0x420f39[_0x9ee4('0x37')]};return db['OpenchannelQueueReport'][_0x9ee4('0x16')](_0x439fef)[_0x9ee4('0x1d')](function(_0x43f220){_0x327328[_0x9ee4('0x16')]=_0x43f220;if(_0x544591[_0x9ee4('0x2b')]['includeAll']){_0x420f39[_0x9ee4('0x3a')]=[{'all':!![]}];}return db[_0x9ee4('0x25')][_0x9ee4('0x3b')](_0x420f39);})['then'](function(_0x298f69){_0x327328[_0x9ee4('0x3c')]=_0x298f69;return _0x327328;})[_0x9ee4('0x1d')](respondWithFilteredResult(_0x4d0443,_0x420f39))['catch'](handleError(_0x4d0443,null));};exports[_0x9ee4('0x3d')]=function(_0x3c5f0c,_0x1ad9c8){var _0x4802a9={'raw':!![],'where':{'id':_0x3c5f0c[_0x9ee4('0x3e')]['id']}},_0x96edf5={};_0x96edf5[_0x9ee4('0x29')]=_[_0x9ee4('0x2c')](db[_0x9ee4('0x25')][_0x9ee4('0x26')]);_0x96edf5['query']=_[_0x9ee4('0x2c')](_0x3c5f0c['query']);_0x96edf5[_0x9ee4('0x2d')]=_[_0x9ee4('0x2e')](_0x96edf5[_0x9ee4('0x29')],_0x96edf5[_0x9ee4('0x2b')]);_0x4802a9[_0x9ee4('0x2f')]=_[_0x9ee4('0x2e')](_0x96edf5[_0x9ee4('0x29')],qs[_0x9ee4('0x30')](_0x3c5f0c[_0x9ee4('0x2b')][_0x9ee4('0x30')]));_0x4802a9[_0x9ee4('0x2f')]=_0x4802a9[_0x9ee4('0x2f')][_0x9ee4('0x31')]?_0x4802a9[_0x9ee4('0x2f')]:_0x96edf5[_0x9ee4('0x29')];if(_0x3c5f0c[_0x9ee4('0x2b')][_0x9ee4('0x3f')]){_0x4802a9[_0x9ee4('0x3a')]=[{'all':!![]}];}_0x4802a9=_[_0x9ee4('0x39')]({},_0x4802a9,_0x3c5f0c[_0x9ee4('0x40')]);return db[_0x9ee4('0x25')][_0x9ee4('0x41')](_0x4802a9)[_0x9ee4('0x1d')](handleEntityNotFound(_0x1ad9c8,null))['then'](respondWithResult(_0x1ad9c8,null))[_0x9ee4('0x42')](handleError(_0x1ad9c8,null));};exports['create']=function(_0xb25d32,_0x419e9c){return db[_0x9ee4('0x25')][_0x9ee4('0x43')](_0xb25d32['body'],{})[_0x9ee4('0x1d')](respondWithResult(_0x419e9c,0xc9))['catch'](handleError(_0x419e9c,null));};exports[_0x9ee4('0x44')]=function(_0x582082,_0x5d8906){if(_0x582082[_0x9ee4('0x45')]['id']){delete _0x582082[_0x9ee4('0x45')]['id'];}return db['OpenchannelQueueReport'][_0x9ee4('0x41')]({'where':{'id':_0x582082[_0x9ee4('0x3e')]['id']}})['then'](handleEntityNotFound(_0x5d8906,null))[_0x9ee4('0x1d')](saveUpdates(_0x582082['body'],null))[_0x9ee4('0x1d')](respondWithResult(_0x5d8906,null))[_0x9ee4('0x42')](handleError(_0x5d8906,null));};exports['destroy']=function(_0x5e5cdc,_0xb60ed8){return db['OpenchannelQueueReport'][_0x9ee4('0x41')]({'where':{'id':_0x5e5cdc[_0x9ee4('0x3e')]['id']}})[_0x9ee4('0x1d')](handleEntityNotFound(_0xb60ed8,null))[_0x9ee4('0x1d')](removeEntity(_0xb60ed8,null))[_0x9ee4('0x42')](handleError(_0xb60ed8,null));};exports[_0x9ee4('0x46')]=function(_0x27c87e,_0x15dd66){return db[_0x9ee4('0x25')][_0x9ee4('0x46')]()['then'](respondWithResult(_0x15dd66,null))[_0x9ee4('0x42')](handleError(_0x15dd66,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index b442dc5..920b856 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 _0xbe02=['uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','report_openchannel_queue'];(function(_0x1f864e,_0x332753){var _0x2370b2=function(_0x40bedd){while(--_0x40bedd){_0x1f864e['push'](_0x1f864e['shift']());}};_0x2370b2(++_0x332753);}(_0xbe02,0x146));var _0x2be0=function(_0x4b350b,_0x24bd15){_0x4b350b=_0x4b350b-0x0;var _0x63f720=_0xbe02[_0x4b350b];return _0x63f720;};'use strict';var _=require(_0x2be0('0x0'));var util=require(_0x2be0('0x1'));var logger=require(_0x2be0('0x2'))(_0x2be0('0x3'));var moment=require('moment');var BPromise=require(_0x2be0('0x4'));var rp=require(_0x2be0('0x5'));var fs=require('fs');var path=require(_0x2be0('0x6'));var rimraf=require(_0x2be0('0x7'));var config=require(_0x2be0('0x8'));var attributes=require(_0x2be0('0x9'));module[_0x2be0('0xa')]=function(_0x474a35,_0x39a2ca){return _0x474a35['define']('OpenchannelQueueReport',attributes,{'tableName':_0x2be0('0xb'),'paranoid':![],'indexes':[{'name':_0x2be0('0xc'),'fields':[_0x2be0('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe4d6=['request-promise','path','./openchannelQueueReport.attributes','define','OpenchannelQueueReport','report_openchannel_queue','lodash','util','../../config/logger','api','bluebird'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0xe4d6,0xd7));var _0x6e4d=function(_0x29c56d,_0x4b819c){_0x29c56d=_0x29c56d-0x0;var _0x350b11=_0xe4d6[_0x29c56d];return _0x350b11;};'use strict';var _=require(_0x6e4d('0x0'));var util=require(_0x6e4d('0x1'));var logger=require(_0x6e4d('0x2'))(_0x6e4d('0x3'));var moment=require('moment');var BPromise=require(_0x6e4d('0x4'));var rp=require(_0x6e4d('0x5'));var fs=require('fs');var path=require(_0x6e4d('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6e4d('0x7'));module['exports']=function(_0x34f714,_0x32a166){return _0x34f714[_0x6e4d('0x8')](_0x6e4d('0x9'),attributes,{'tableName':_0x6e4d('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 1ef02df..9274ee8 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 _0x5ed9=['create','body','options','raw','then','UpdateOpenchannelQueueReport','update','attributes','limit','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','request','info','OpenchannelQueueReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport'];(function(_0x4f5a88,_0x51eedf){var _0x38d3a4=function(_0x48278c){while(--_0x48278c){_0x4f5a88['push'](_0x4f5a88['shift']());}};_0x38d3a4(++_0x51eedf);}(_0x5ed9,0x1e9));var _0x95ed=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x5ed9[_0x3e5086];return _0xfeb102;};'use strict';var _=require(_0x95ed('0x0'));var util=require(_0x95ed('0x1'));var moment=require('moment');var BPromise=require(_0x95ed('0x2'));var rs=require(_0x95ed('0x3'));var fs=require('fs');var Redis=require(_0x95ed('0x4'));var db=require(_0x95ed('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x95ed('0x6'))(_0x95ed('0x7'));var config=require(_0x95ed('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x95ed('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32bf25,_0xaa1eb1,_0x3753b5){return new BPromise(function(_0x1df51f,_0x46ed43){return client[_0x95ed('0xa')](_0x32bf25,_0x3753b5)['then'](function(_0x2b59f5){logger[_0x95ed('0xb')](_0x95ed('0xc'),_0xaa1eb1,'request\x20sent');logger[_0x95ed('0xd')]('OpenchannelQueueReport,\x20%s,\x20%s,\x20%s',_0xaa1eb1,_0x95ed('0xe'),JSON[_0x95ed('0xf')](_0x2b59f5));if(_0x2b59f5[_0x95ed('0x10')]){if(_0x2b59f5[_0x95ed('0x10')][_0x95ed('0x11')]===0x1f4){logger['error']('OpenchannelQueueReport,\x20%s,\x20%s',_0xaa1eb1,_0x2b59f5[_0x95ed('0x10')][_0x95ed('0x12')]);return _0x46ed43(_0x2b59f5['error']['message']);}logger[_0x95ed('0x10')](_0x95ed('0xc'),_0xaa1eb1,_0x2b59f5[_0x95ed('0x10')][_0x95ed('0x12')]);return _0x1df51f(_0x2b59f5['error'][_0x95ed('0x12')]);}else{logger[_0x95ed('0xb')](_0x95ed('0xc'),_0xaa1eb1,_0x95ed('0xe'));_0x1df51f(_0x2b59f5[_0x95ed('0x13')]['message']);}})[_0x95ed('0x14')](function(_0x54ad78){logger['error']('OpenchannelQueueReport,\x20%s,\x20%s',_0xaa1eb1,_0x54ad78);_0x46ed43(_0x54ad78);});});}exports[_0x95ed('0x15')]=function(_0x58fb9e){var _0x421ab9=this;return new Promise(function(_0x1bc47c,_0x4ad26d){return db[_0x95ed('0x16')][_0x95ed('0x17')](_0x58fb9e[_0x95ed('0x18')],{'raw':_0x58fb9e[_0x95ed('0x19')]?_0x58fb9e[_0x95ed('0x19')][_0x95ed('0x1a')]===undefined?!![]:![]:!![]})[_0x95ed('0x1b')](function(_0x3e05cf){logger[_0x95ed('0xb')](_0x95ed('0x15'),_0x58fb9e);logger['debug'](_0x95ed('0x15'),_0x58fb9e,JSON[_0x95ed('0xf')](_0x3e05cf));_0x1bc47c(_0x3e05cf);})['catch'](function(_0x5d5afe){logger['error'](_0x95ed('0x15'),_0x5d5afe[_0x95ed('0x12')],_0x58fb9e);_0x4ad26d(_0x421ab9[_0x95ed('0x10')](0x1f4,_0x5d5afe[_0x95ed('0x12')]));});});};exports[_0x95ed('0x1c')]=function(_0x19b664){var _0x3ef74c=this;return new Promise(function(_0x416d23,_0x146f74){return db[_0x95ed('0x16')][_0x95ed('0x1d')](_0x19b664[_0x95ed('0x18')],{'raw':_0x19b664[_0x95ed('0x19')]?_0x19b664[_0x95ed('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x19b664[_0x95ed('0x19')]?_0x19b664['options']['where']||null:null,'attributes':_0x19b664[_0x95ed('0x19')]?_0x19b664[_0x95ed('0x19')][_0x95ed('0x1e')]||null:null,'limit':_0x19b664[_0x95ed('0x19')]?_0x19b664[_0x95ed('0x19')][_0x95ed('0x1f')]||null:null})[_0x95ed('0x1b')](function(_0x190620){logger[_0x95ed('0xb')](_0x95ed('0x1c'),_0x19b664);logger[_0x95ed('0xd')](_0x95ed('0x1c'),_0x19b664,JSON['stringify'](_0x190620));_0x416d23(_0x190620);})[_0x95ed('0x14')](function(_0xf73b6f){logger['error'](_0x95ed('0x1c'),_0xf73b6f['message'],_0x19b664);_0x146f74(_0x3ef74c['error'](0x1f4,_0xf73b6f['message']));});});}; \ No newline at end of file +var _0x06ae=['result','OpenchannelQueueReport','create','options','raw','CreateOpenchannelQueueReport','debug','catch','UpdateOpenchannelQueueReport','update','body','attributes','limit','then','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','request','info','request\x20sent','stringify','error','code','OpenchannelQueueReport,\x20%s,\x20%s','message'];(function(_0x28a94c,_0x560736){var _0x2260da=function(_0x265ab8){while(--_0x265ab8){_0x28a94c['push'](_0x28a94c['shift']());}};_0x2260da(++_0x560736);}(_0x06ae,0x16e));var _0xe06a=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x06ae[_0x2dafbe];return _0x58a45a;};'use strict';var _=require('lodash');var util=require(_0xe06a('0x0'));var moment=require(_0xe06a('0x1'));var BPromise=require(_0xe06a('0x2'));var rs=require(_0xe06a('0x3'));var fs=require('fs');var Redis=require(_0xe06a('0x4'));var db=require(_0xe06a('0x5'))['db'];var utils=require(_0xe06a('0x6'));var logger=require(_0xe06a('0x7'))(_0xe06a('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xe06a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x745f79,_0x20bd8a,_0x3dfa60){return new BPromise(function(_0x1ea66c,_0x563322){return client[_0xe06a('0xa')](_0x745f79,_0x3dfa60)['then'](function(_0x586e05){logger[_0xe06a('0xb')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x20bd8a,_0xe06a('0xc'));logger['debug']('OpenchannelQueueReport,\x20%s,\x20%s,\x20%s',_0x20bd8a,_0xe06a('0xc'),JSON[_0xe06a('0xd')](_0x586e05));if(_0x586e05['error']){if(_0x586e05[_0xe06a('0xe')][_0xe06a('0xf')]===0x1f4){logger['error'](_0xe06a('0x10'),_0x20bd8a,_0x586e05[_0xe06a('0xe')][_0xe06a('0x11')]);return _0x563322(_0x586e05['error'][_0xe06a('0x11')]);}logger[_0xe06a('0xe')](_0xe06a('0x10'),_0x20bd8a,_0x586e05[_0xe06a('0xe')][_0xe06a('0x11')]);return _0x1ea66c(_0x586e05['error'][_0xe06a('0x11')]);}else{logger[_0xe06a('0xb')](_0xe06a('0x10'),_0x20bd8a,_0xe06a('0xc'));_0x1ea66c(_0x586e05[_0xe06a('0x12')][_0xe06a('0x11')]);}})['catch'](function(_0xa9b1af){logger['error']('OpenchannelQueueReport,\x20%s,\x20%s',_0x20bd8a,_0xa9b1af);_0x563322(_0xa9b1af);});});}exports['CreateOpenchannelQueueReport']=function(_0x7a5a6f){var _0x43ce7b=this;return new Promise(function(_0xc62c1f,_0x57f5aa){return db[_0xe06a('0x13')][_0xe06a('0x14')](_0x7a5a6f['body'],{'raw':_0x7a5a6f[_0xe06a('0x15')]?_0x7a5a6f['options'][_0xe06a('0x16')]===undefined?!![]:![]:!![]})['then'](function(_0x550ff8){logger[_0xe06a('0xb')](_0xe06a('0x17'),_0x7a5a6f);logger[_0xe06a('0x18')](_0xe06a('0x17'),_0x7a5a6f,JSON[_0xe06a('0xd')](_0x550ff8));_0xc62c1f(_0x550ff8);})[_0xe06a('0x19')](function(_0x2ab25f){logger[_0xe06a('0xe')](_0xe06a('0x17'),_0x2ab25f[_0xe06a('0x11')],_0x7a5a6f);_0x57f5aa(_0x43ce7b['error'](0x1f4,_0x2ab25f[_0xe06a('0x11')]));});});};exports[_0xe06a('0x1a')]=function(_0xf13325){var _0x82ba72=this;return new Promise(function(_0x352434,_0x2c96bd){return db[_0xe06a('0x13')][_0xe06a('0x1b')](_0xf13325[_0xe06a('0x1c')],{'raw':_0xf13325['options']?_0xf13325['options'][_0xe06a('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xf13325['options']?_0xf13325[_0xe06a('0x15')]['where']||null:null,'attributes':_0xf13325['options']?_0xf13325['options'][_0xe06a('0x1d')]||null:null,'limit':_0xf13325[_0xe06a('0x15')]?_0xf13325['options'][_0xe06a('0x1e')]||null:null})[_0xe06a('0x1f')](function(_0x4506b3){logger[_0xe06a('0xb')](_0xe06a('0x1a'),_0xf13325);logger[_0xe06a('0x18')](_0xe06a('0x1a'),_0xf13325,JSON[_0xe06a('0xd')](_0x4506b3));_0x352434(_0x4506b3);})[_0xe06a('0x19')](function(_0x50aded){logger['error'](_0xe06a('0x1a'),_0x50aded[_0xe06a('0x11')],_0xf13325);_0x2c96bd(_0x82ba72[_0xe06a('0xe')](0x1f4,_0x50aded[_0xe06a('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index eec0618..6999344 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(_0x3d9176,_0x399d6f){var _0x12adc5=function(_0x700b01){while(--_0x700b01){_0x3d9176['push'](_0x3d9176['shift']());}};_0x12adc5(++_0x399d6f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0xa9e0[_0x1b828b];return _0x98da1a;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var 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(_0x8afdd0,_0x548ad1){var _0x3de7ac=function(_0x2dc2c4){while(--_0x2dc2c4){_0x8afdd0['push'](_0x8afdd0['shift']());}};_0x3de7ac(++_0x548ad1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xa9e0[_0x2f5ac5];return _0x37c9a8;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var 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 2a34299..e10fbeb 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 _0x4b63=['agent','queue','DATE','moment','sequelize','exports','STRING','ENUM'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x4b63,0x18b));var _0x34b6=function(_0x3edc22,_0x243990){_0x3edc22=_0x3edc22-0x0;var _0x1ddf50=_0x4b63[_0x3edc22];return _0x1ddf50;};'use strict';var moment=require(_0x34b6('0x0'));var Sequelize=require(_0x34b6('0x1'));module[_0x34b6('0x2')]={'uniqueid':{'type':Sequelize[_0x34b6('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x34b6('0x4')]('account',_0x34b6('0x5'),_0x34b6('0x6')),'allowNull':![],'defaultValue':_0x34b6('0x6')},'transferredAt':{'type':Sequelize[_0x34b6('0x7')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0x469d=['exports','agent','DATE','moment','sequelize'];(function(_0x163ce5,_0x465baf){var _0x448dce=function(_0xc2fc8){while(--_0xc2fc8){_0x163ce5['push'](_0x163ce5['shift']());}};_0x448dce(++_0x465baf);}(_0x469d,0x1e8));var _0xd469=function(_0x34b13e,_0x18c70b){_0x34b13e=_0x34b13e-0x0;var _0x4d343e=_0x469d[_0x34b13e];return _0x4d343e;};'use strict';var moment=require(_0xd469('0x0'));var Sequelize=require(_0xd469('0x1'));module[_0xd469('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM']('account',_0xd469('0x3'),'queue'),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xd469('0x4')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 22ed6c2..8b8f84d 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 _0xa8b2=['name','send','index','map','OpenchannelTransferReport','rawAttributes','fieldName','key','model','keys','query','filters','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','filter','where','merge','type','VIRTUAL','options','includeAll','findAll','catch','params','include','find','create','body','describe','request-promise','moment','mustache','sox','to-csv','ejs','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','sendStatus','status','json','count','offset','set','Content-Range','reject','save','then','destroy','end','error'];(function(_0x3391ec,_0xafa1ad){var _0x26c9d1=function(_0x32dd46){while(--_0x32dd46){_0x3391ec['push'](_0x3391ec['shift']());}};_0x26c9d1(++_0xafa1ad);}(_0xa8b2,0x159));var _0x2a8b=function(_0x852a89,_0x45e59b){_0x852a89=_0x852a89-0x0;var _0x1000c6=_0xa8b2[_0x852a89];return _0x1000c6;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x2a8b('0x0'));var moment=require(_0x2a8b('0x1'));var BPromise=require('bluebird');var Mustache=require(_0x2a8b('0x2'));var util=require('util');var path=require('path');var sox=require(_0x2a8b('0x3'));var csv=require(_0x2a8b('0x4'));var ejs=require(_0x2a8b('0x5'));var fs=require('fs');var _=require(_0x2a8b('0x6'));var squel=require(_0x2a8b('0x7'));var crypto=require('crypto');var jsforce=require(_0x2a8b('0x8'));var deskjs=require('desk.js');var toCsv=require(_0x2a8b('0x4'));var querystring=require(_0x2a8b('0x9'));var Papa=require('papaparse');var Redis=require(_0x2a8b('0xa'));var authService=require(_0x2a8b('0xb'));var qs=require('../../components/parsers/qs');var as=require(_0x2a8b('0xc'));var hardwareService=require(_0x2a8b('0xd'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3f3fc4,_0x142944){_0x142944=_0x142944||0xcc;return function(_0x336982){if(_0x336982){return _0x3f3fc4[_0x2a8b('0xe')](_0x142944);}return _0x3f3fc4[_0x2a8b('0xf')](_0x142944)['end']();};}function respondWithResult(_0x242bfc,_0x2002ca){_0x2002ca=_0x2002ca||0xc8;return function(_0x2ac750){if(_0x2ac750){return _0x242bfc['status'](_0x2002ca)[_0x2a8b('0x10')](_0x2ac750);}};}function respondWithFilteredResult(_0x2090f0,_0x54c99f){return function(_0x4d97c7){if(_0x4d97c7){var _0x17a6f2=_0x4d97c7[_0x2a8b('0x11')],_0x1b1d9f=_0x54c99f[_0x2a8b('0x12')],_0x29d359=_0x54c99f[_0x2a8b('0x12')]+_0x54c99f['limit'],_0x4966ce;if(_0x29d359>=_0x17a6f2){_0x29d359=_0x17a6f2;_0x4966ce=0xc8;}else{_0x4966ce=0xce;}_0x2090f0[_0x2a8b('0xf')](_0x4966ce);return _0x2090f0[_0x2a8b('0x13')](_0x2a8b('0x14'),_0x1b1d9f+'-'+_0x29d359+'/'+_0x17a6f2)[_0x2a8b('0x10')](_0x4d97c7);}return null;};}function patchUpdates(_0x7a74f1){return function(_0x30439f){try{jsonpatch['apply'](_0x30439f,_0x7a74f1,!![]);}catch(_0xc8fa66){return BPromise[_0x2a8b('0x15')](_0xc8fa66);}return _0x30439f[_0x2a8b('0x16')]();};}function saveUpdates(_0x3e64f7,_0x643d77){return function(_0x345995){if(_0x345995){return _0x345995['update'](_0x3e64f7)[_0x2a8b('0x17')](function(_0x33f7e1){return _0x33f7e1;});}return null;};}function removeEntity(_0x35496c,_0x9cbccb){return function(_0x1fd693){if(_0x1fd693){return _0x1fd693[_0x2a8b('0x18')]()[_0x2a8b('0x17')](function(){_0x35496c[_0x2a8b('0xf')](0xcc)[_0x2a8b('0x19')]();});}};}function handleEntityNotFound(_0x316848,_0x5e988d){return function(_0x2310c8){if(!_0x2310c8){_0x316848[_0x2a8b('0xe')](0x194);}return _0x2310c8;};}function handleError(_0x3e066c,_0x38b456){_0x38b456=_0x38b456||0x1f4;return function(_0xa01869){logger[_0x2a8b('0x1a')](_0xa01869['stack']);if(_0xa01869['name']){delete _0xa01869[_0x2a8b('0x1b')];}_0x3e066c[_0x2a8b('0xf')](_0x38b456)[_0x2a8b('0x1c')](_0xa01869);};}exports[_0x2a8b('0x1d')]=function(_0x177def,_0x361ace){var _0x3fc6cc={},_0x1d28c7={},_0x27c1eb={'count':0x0,'rows':[]};var _0x1f2dbe=_[_0x2a8b('0x1e')](db[_0x2a8b('0x1f')][_0x2a8b('0x20')],function(_0x1fd590){return{'name':_0x1fd590[_0x2a8b('0x21')],'type':_0x1fd590['type'][_0x2a8b('0x22')]};});_0x1d28c7[_0x2a8b('0x23')]=_['map'](_0x1f2dbe,_0x2a8b('0x1b'));_0x1d28c7['query']=_[_0x2a8b('0x24')](_0x177def[_0x2a8b('0x25')]);_0x1d28c7[_0x2a8b('0x26')]=_['intersection'](_0x1d28c7[_0x2a8b('0x23')],_0x1d28c7['query']);_0x3fc6cc[_0x2a8b('0x27')]=_['intersection'](_0x1d28c7[_0x2a8b('0x23')],qs['fields'](_0x177def[_0x2a8b('0x25')][_0x2a8b('0x28')]));_0x3fc6cc[_0x2a8b('0x27')]=_0x3fc6cc['attributes'][_0x2a8b('0x29')]?_0x3fc6cc[_0x2a8b('0x27')]:_0x1d28c7[_0x2a8b('0x23')];if(!_0x177def[_0x2a8b('0x25')][_0x2a8b('0x2a')](_0x2a8b('0x2b'))){_0x3fc6cc[_0x2a8b('0x2c')]=qs[_0x2a8b('0x2c')](_0x177def[_0x2a8b('0x25')]['limit']);_0x3fc6cc['offset']=qs[_0x2a8b('0x12')](_0x177def[_0x2a8b('0x25')][_0x2a8b('0x12')]);}_0x3fc6cc[_0x2a8b('0x2d')]=qs['sort'](_0x177def[_0x2a8b('0x25')][_0x2a8b('0x2e')]);_0x3fc6cc['where']=qs[_0x2a8b('0x26')](_['pick'](_0x177def['query'],_0x1d28c7[_0x2a8b('0x26')]),_0x1f2dbe);if(_0x177def['query'][_0x2a8b('0x2f')]){_0x3fc6cc[_0x2a8b('0x30')]=_[_0x2a8b('0x31')](_0x3fc6cc['where'],{'$or':_['map'](_0x1f2dbe,function(_0x38da8b){if(_0x38da8b[_0x2a8b('0x32')]!==_0x2a8b('0x33')){var _0x44b732={};_0x44b732[_0x38da8b[_0x2a8b('0x1b')]]={'$like':'%'+_0x177def[_0x2a8b('0x25')][_0x2a8b('0x2f')]+'%'};return _0x44b732;}})});}_0x3fc6cc=_[_0x2a8b('0x31')]({},_0x3fc6cc,_0x177def[_0x2a8b('0x34')]);var _0x446a5f={'where':_0x3fc6cc[_0x2a8b('0x30')]};return db[_0x2a8b('0x1f')]['count'](_0x446a5f)[_0x2a8b('0x17')](function(_0x20a2a2){_0x27c1eb['count']=_0x20a2a2;if(_0x177def[_0x2a8b('0x25')][_0x2a8b('0x35')]){_0x3fc6cc['include']=[{'all':!![]}];}return db[_0x2a8b('0x1f')][_0x2a8b('0x36')](_0x3fc6cc);})['then'](function(_0x3d4768){_0x27c1eb['rows']=_0x3d4768;return _0x27c1eb;})['then'](respondWithFilteredResult(_0x361ace,_0x3fc6cc))[_0x2a8b('0x37')](handleError(_0x361ace,null));};exports['show']=function(_0x32e2e9,_0x1a42e7){var _0x500125={'raw':!![],'where':{'id':_0x32e2e9[_0x2a8b('0x38')]['id']}},_0x24edf8={};_0x24edf8[_0x2a8b('0x23')]=_[_0x2a8b('0x24')](db[_0x2a8b('0x1f')][_0x2a8b('0x20')]);_0x24edf8[_0x2a8b('0x25')]=_[_0x2a8b('0x24')](_0x32e2e9[_0x2a8b('0x25')]);_0x24edf8['filters']=_['intersection'](_0x24edf8[_0x2a8b('0x23')],_0x24edf8[_0x2a8b('0x25')]);_0x500125[_0x2a8b('0x27')]=_['intersection'](_0x24edf8['model'],qs[_0x2a8b('0x28')](_0x32e2e9[_0x2a8b('0x25')]['fields']));_0x500125[_0x2a8b('0x27')]=_0x500125[_0x2a8b('0x27')][_0x2a8b('0x29')]?_0x500125['attributes']:_0x24edf8['model'];if(_0x32e2e9['query']['includeAll']){_0x500125[_0x2a8b('0x39')]=[{'all':!![]}];}_0x500125=_[_0x2a8b('0x31')]({},_0x500125,_0x32e2e9[_0x2a8b('0x34')]);return db[_0x2a8b('0x1f')][_0x2a8b('0x3a')](_0x500125)[_0x2a8b('0x17')](handleEntityNotFound(_0x1a42e7,null))[_0x2a8b('0x17')](respondWithResult(_0x1a42e7,null))[_0x2a8b('0x37')](handleError(_0x1a42e7,null));};exports[_0x2a8b('0x3b')]=function(_0x513eec,_0x2e1806){return db[_0x2a8b('0x1f')][_0x2a8b('0x3b')](_0x513eec['body'],{})[_0x2a8b('0x17')](respondWithResult(_0x2e1806,0xc9))['catch'](handleError(_0x2e1806,null));};exports['update']=function(_0x33aa22,_0x560e1a){if(_0x33aa22[_0x2a8b('0x3c')]['id']){delete _0x33aa22[_0x2a8b('0x3c')]['id'];}return db['OpenchannelTransferReport'][_0x2a8b('0x3a')]({'where':{'id':_0x33aa22[_0x2a8b('0x38')]['id']}})['then'](handleEntityNotFound(_0x560e1a,null))[_0x2a8b('0x17')](saveUpdates(_0x33aa22[_0x2a8b('0x3c')],null))[_0x2a8b('0x17')](respondWithResult(_0x560e1a,null))['catch'](handleError(_0x560e1a,null));};exports['destroy']=function(_0x3927a0,_0x1033df){return db[_0x2a8b('0x1f')][_0x2a8b('0x3a')]({'where':{'id':_0x3927a0[_0x2a8b('0x38')]['id']}})[_0x2a8b('0x17')](handleEntityNotFound(_0x1033df,null))['then'](removeEntity(_0x1033df,null))['catch'](handleError(_0x1033df,null));};exports[_0x2a8b('0x3d')]=function(_0x11826f,_0x232087){return db[_0x2a8b('0x1f')][_0x2a8b('0x3d')]()[_0x2a8b('0x17')](respondWithResult(_0x232087,null))['catch'](handleError(_0x232087,null));}; \ No newline at end of file +var _0xa17a=['../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','fieldName','key','model','query','keys','attributes','intersection','fields','length','sort','where','filters','pick','merge','type','filter','options','includeAll','findAll','rows','show','params','OpenchannelTransferReport','rawAttributes','include','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch'];(function(_0xbe200f,_0x4b50eb){var _0x192597=function(_0x106cfd){while(--_0x106cfd){_0xbe200f['push'](_0xbe200f['shift']());}};_0x192597(++_0x4b50eb);}(_0xa17a,0x197));var _0xaa17=function(_0xa72e3a,_0x4d3bd1){_0xa72e3a=_0xa72e3a-0x0;var _0x41cff3=_0xa17a[_0xa72e3a];return _0x41cff3;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xaa17('0x0'));var rimraf=require(_0xaa17('0x1'));var zipdir=require(_0xaa17('0x2'));var jsonpatch=require(_0xaa17('0x3'));var rp=require(_0xaa17('0x4'));var moment=require('moment');var BPromise=require(_0xaa17('0x5'));var Mustache=require('mustache');var util=require(_0xaa17('0x6'));var path=require(_0xaa17('0x7'));var sox=require(_0xaa17('0x8'));var csv=require(_0xaa17('0x9'));var ejs=require(_0xaa17('0xa'));var fs=require('fs');var _=require(_0xaa17('0xb'));var squel=require(_0xaa17('0xc'));var crypto=require(_0xaa17('0xd'));var jsforce=require(_0xaa17('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xaa17('0x9'));var querystring=require(_0xaa17('0xf'));var Papa=require(_0xaa17('0x10'));var Redis=require('ioredis');var authService=require(_0xaa17('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xaa17('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xaa17('0x13'))('api');var utils=require(_0xaa17('0x14'));var config=require('../../config/environment');var db=require(_0xaa17('0x15'))['db'];function respondWithStatusCode(_0x63172,_0x4ff411){_0x4ff411=_0x4ff411||0xcc;return function(_0x27fcef){if(_0x27fcef){return _0x63172[_0xaa17('0x16')](_0x4ff411);}return _0x63172[_0xaa17('0x17')](_0x4ff411)[_0xaa17('0x18')]();};}function respondWithResult(_0x4586f5,_0x2263ca){_0x2263ca=_0x2263ca||0xc8;return function(_0x4b22b1){if(_0x4b22b1){return _0x4586f5[_0xaa17('0x17')](_0x2263ca)[_0xaa17('0x19')](_0x4b22b1);}};}function respondWithFilteredResult(_0x46ee48,_0x52a1e2){return function(_0x4b8253){if(_0x4b8253){var _0x50d088=_0x4b8253[_0xaa17('0x1a')],_0x6c3053=_0x52a1e2['offset'],_0x22fed9=_0x52a1e2[_0xaa17('0x1b')]+_0x52a1e2[_0xaa17('0x1c')],_0x4bad7d;if(_0x22fed9>=_0x50d088){_0x22fed9=_0x50d088;_0x4bad7d=0xc8;}else{_0x4bad7d=0xce;}_0x46ee48['status'](_0x4bad7d);return _0x46ee48['set'](_0xaa17('0x1d'),_0x6c3053+'-'+_0x22fed9+'/'+_0x50d088)[_0xaa17('0x19')](_0x4b8253);}return null;};}function patchUpdates(_0x435298){return function(_0x28f3e5){try{jsonpatch[_0xaa17('0x1e')](_0x28f3e5,_0x435298,!![]);}catch(_0x4ca0a8){return BPromise[_0xaa17('0x1f')](_0x4ca0a8);}return _0x28f3e5[_0xaa17('0x20')]();};}function saveUpdates(_0x321a5b,_0x54babc){return function(_0x4ffa85){if(_0x4ffa85){return _0x4ffa85[_0xaa17('0x21')](_0x321a5b)[_0xaa17('0x22')](function(_0x4d8956){return _0x4d8956;});}return null;};}function removeEntity(_0x379c87,_0x5ccec8){return function(_0x279d42){if(_0x279d42){return _0x279d42[_0xaa17('0x23')]()[_0xaa17('0x22')](function(){_0x379c87[_0xaa17('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1479f7,_0x12cf00){return function(_0x4129c6){if(!_0x4129c6){_0x1479f7[_0xaa17('0x16')](0x194);}return _0x4129c6;};}function handleError(_0x5292be,_0xdd58ed){_0xdd58ed=_0xdd58ed||0x1f4;return function(_0x20c5f5){logger[_0xaa17('0x24')](_0x20c5f5[_0xaa17('0x25')]);if(_0x20c5f5[_0xaa17('0x26')]){delete _0x20c5f5[_0xaa17('0x26')];}_0x5292be['status'](_0xdd58ed)['send'](_0x20c5f5);};}exports[_0xaa17('0x27')]=function(_0x572229,_0x225260){var _0x5d7659={},_0x3a93e1={},_0x2b165a={'count':0x0,'rows':[]};var _0x4e3843=_[_0xaa17('0x28')](db['OpenchannelTransferReport']['rawAttributes'],function(_0x413062){return{'name':_0x413062[_0xaa17('0x29')],'type':_0x413062['type'][_0xaa17('0x2a')]};});_0x3a93e1[_0xaa17('0x2b')]=_[_0xaa17('0x28')](_0x4e3843,_0xaa17('0x26'));_0x3a93e1[_0xaa17('0x2c')]=_[_0xaa17('0x2d')](_0x572229[_0xaa17('0x2c')]);_0x3a93e1['filters']=_['intersection'](_0x3a93e1[_0xaa17('0x2b')],_0x3a93e1['query']);_0x5d7659[_0xaa17('0x2e')]=_[_0xaa17('0x2f')](_0x3a93e1[_0xaa17('0x2b')],qs[_0xaa17('0x30')](_0x572229[_0xaa17('0x2c')][_0xaa17('0x30')]));_0x5d7659[_0xaa17('0x2e')]=_0x5d7659[_0xaa17('0x2e')][_0xaa17('0x31')]?_0x5d7659[_0xaa17('0x2e')]:_0x3a93e1[_0xaa17('0x2b')];if(!_0x572229['query']['hasOwnProperty']('nolimit')){_0x5d7659[_0xaa17('0x1c')]=qs['limit'](_0x572229['query'][_0xaa17('0x1c')]);_0x5d7659[_0xaa17('0x1b')]=qs[_0xaa17('0x1b')](_0x572229['query']['offset']);}_0x5d7659['order']=qs[_0xaa17('0x32')](_0x572229[_0xaa17('0x2c')][_0xaa17('0x32')]);_0x5d7659[_0xaa17('0x33')]=qs[_0xaa17('0x34')](_[_0xaa17('0x35')](_0x572229['query'],_0x3a93e1[_0xaa17('0x34')]),_0x4e3843);if(_0x572229[_0xaa17('0x2c')]['filter']){_0x5d7659[_0xaa17('0x33')]=_[_0xaa17('0x36')](_0x5d7659[_0xaa17('0x33')],{'$or':_['map'](_0x4e3843,function(_0xe1fc62){if(_0xe1fc62[_0xaa17('0x37')]!=='VIRTUAL'){var _0x1505ef={};_0x1505ef[_0xe1fc62[_0xaa17('0x26')]]={'$like':'%'+_0x572229['query'][_0xaa17('0x38')]+'%'};return _0x1505ef;}})});}_0x5d7659=_[_0xaa17('0x36')]({},_0x5d7659,_0x572229[_0xaa17('0x39')]);var _0x1acffd={'where':_0x5d7659[_0xaa17('0x33')]};return db['OpenchannelTransferReport'][_0xaa17('0x1a')](_0x1acffd)[_0xaa17('0x22')](function(_0x1a0d28){_0x2b165a[_0xaa17('0x1a')]=_0x1a0d28;if(_0x572229[_0xaa17('0x2c')][_0xaa17('0x3a')]){_0x5d7659['include']=[{'all':!![]}];}return db['OpenchannelTransferReport'][_0xaa17('0x3b')](_0x5d7659);})[_0xaa17('0x22')](function(_0xca2ee){_0x2b165a[_0xaa17('0x3c')]=_0xca2ee;return _0x2b165a;})[_0xaa17('0x22')](respondWithFilteredResult(_0x225260,_0x5d7659))['catch'](handleError(_0x225260,null));};exports[_0xaa17('0x3d')]=function(_0x4233b5,_0x48349b){var _0x477b2c={'raw':!![],'where':{'id':_0x4233b5[_0xaa17('0x3e')]['id']}},_0x52eb50={};_0x52eb50['model']=_[_0xaa17('0x2d')](db[_0xaa17('0x3f')][_0xaa17('0x40')]);_0x52eb50[_0xaa17('0x2c')]=_[_0xaa17('0x2d')](_0x4233b5[_0xaa17('0x2c')]);_0x52eb50[_0xaa17('0x34')]=_[_0xaa17('0x2f')](_0x52eb50[_0xaa17('0x2b')],_0x52eb50[_0xaa17('0x2c')]);_0x477b2c['attributes']=_[_0xaa17('0x2f')](_0x52eb50[_0xaa17('0x2b')],qs[_0xaa17('0x30')](_0x4233b5[_0xaa17('0x2c')][_0xaa17('0x30')]));_0x477b2c['attributes']=_0x477b2c[_0xaa17('0x2e')]['length']?_0x477b2c[_0xaa17('0x2e')]:_0x52eb50[_0xaa17('0x2b')];if(_0x4233b5[_0xaa17('0x2c')][_0xaa17('0x3a')]){_0x477b2c[_0xaa17('0x41')]=[{'all':!![]}];}_0x477b2c=_['merge']({},_0x477b2c,_0x4233b5[_0xaa17('0x39')]);return db[_0xaa17('0x3f')][_0xaa17('0x42')](_0x477b2c)[_0xaa17('0x22')](handleEntityNotFound(_0x48349b,null))['then'](respondWithResult(_0x48349b,null))[_0xaa17('0x43')](handleError(_0x48349b,null));};exports[_0xaa17('0x44')]=function(_0x16ee3c,_0x555028){return db[_0xaa17('0x3f')][_0xaa17('0x44')](_0x16ee3c[_0xaa17('0x45')],{})[_0xaa17('0x22')](respondWithResult(_0x555028,0xc9))[_0xaa17('0x43')](handleError(_0x555028,null));};exports[_0xaa17('0x21')]=function(_0x359b5b,_0x1ef775){if(_0x359b5b[_0xaa17('0x45')]['id']){delete _0x359b5b[_0xaa17('0x45')]['id'];}return db[_0xaa17('0x3f')]['find']({'where':{'id':_0x359b5b['params']['id']}})[_0xaa17('0x22')](handleEntityNotFound(_0x1ef775,null))[_0xaa17('0x22')](saveUpdates(_0x359b5b[_0xaa17('0x45')],null))[_0xaa17('0x22')](respondWithResult(_0x1ef775,null))[_0xaa17('0x43')](handleError(_0x1ef775,null));};exports[_0xaa17('0x23')]=function(_0x1c0d88,_0x266652){return db[_0xaa17('0x3f')][_0xaa17('0x42')]({'where':{'id':_0x1c0d88[_0xaa17('0x3e')]['id']}})[_0xaa17('0x22')](handleEntityNotFound(_0x266652,null))['then'](removeEntity(_0x266652,null))[_0xaa17('0x43')](handleError(_0x266652,null));};exports['describe']=function(_0x3c849f,_0x5f470c){return db[_0xaa17('0x3f')][_0xaa17('0x46')]()['then'](respondWithResult(_0x5f470c,null))[_0xaa17('0x43')](handleError(_0x5f470c,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 8e38cb0..36dd6bb 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 _0x623a=['moment','bluebird','request-promise','path','../../config/environment','./openchannelTransferReport.attributes','define','report_openchannel_transfer','uniqueid','lodash','util','../../config/logger','api'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x623a,0x98));var _0xa623=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0x623a[_0x1d9aa0];return _0x226868;};'use strict';var _=require(_0xa623('0x0'));var util=require(_0xa623('0x1'));var logger=require(_0xa623('0x2'))(_0xa623('0x3'));var moment=require(_0xa623('0x4'));var BPromise=require(_0xa623('0x5'));var rp=require(_0xa623('0x6'));var fs=require('fs');var path=require(_0xa623('0x7'));var rimraf=require('rimraf');var config=require(_0xa623('0x8'));var attributes=require(_0xa623('0x9'));module['exports']=function(_0x154560,_0xcc500){return _0x154560[_0xa623('0xa')]('OpenchannelTransferReport',attributes,{'tableName':_0xa623('0xb'),'paranoid':![],'indexes':[{'name':_0xa623('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x25e7=['../../config/environment','./openchannelTransferReport.attributes','exports','OpenchannelTransferReport','uniqueid','util','api','request-promise','path','rimraf'];(function(_0x6173fc,_0x32aadf){var _0x965fbe=function(_0x50d5b3){while(--_0x50d5b3){_0x6173fc['push'](_0x6173fc['shift']());}};_0x965fbe(++_0x32aadf);}(_0x25e7,0x69));var _0x725e=function(_0x37cb61,_0xa49d0){_0x37cb61=_0x37cb61-0x0;var _0x4ca1c7=_0x25e7[_0x37cb61];return _0x4ca1c7;};'use strict';var _=require('lodash');var util=require(_0x725e('0x0'));var logger=require('../../config/logger')(_0x725e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x725e('0x2'));var fs=require('fs');var path=require(_0x725e('0x3'));var rimraf=require(_0x725e('0x4'));var config=require(_0x725e('0x5'));var attributes=require(_0x725e('0x6'));module[_0x725e('0x7')]=function(_0x372e88,_0xf5d78f){return _0x372e88['define'](_0x725e('0x8'),attributes,{'tableName':'report_openchannel_transfer','paranoid':![],'indexes':[{'name':_0x725e('0x9'),'fields':[_0x725e('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 2c28252..c9fc3c4 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 _0x6385=['OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then'];(function(_0x2c7d29,_0x519104){var _0x55ec63=function(_0x2e6aad){while(--_0x2e6aad){_0x2c7d29['push'](_0x2c7d29['shift']());}};_0x55ec63(++_0x519104);}(_0x6385,0xf9));var _0x5638=function(_0x3cc9d9,_0x69ed38){_0x3cc9d9=_0x3cc9d9-0x0;var _0x1a425d=_0x6385[_0x3cc9d9];return _0x1a425d;};'use strict';var _=require(_0x5638('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x5638('0x1'));var rs=require(_0x5638('0x2'));var fs=require('fs');var Redis=require(_0x5638('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5638('0x4'));var logger=require(_0x5638('0x5'))(_0x5638('0x6'));var config=require(_0x5638('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5638('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x160031,_0x4c7d44,_0x50acdf){return new BPromise(function(_0x394a7d,_0x11f903){return client[_0x5638('0x9')](_0x160031,_0x50acdf)[_0x5638('0xa')](function(_0x4a9deb){logger['info'](_0x5638('0xb'),_0x4c7d44,_0x5638('0xc'));logger[_0x5638('0xd')](_0x5638('0xe'),_0x4c7d44,'request\x20sent',JSON[_0x5638('0xf')](_0x4a9deb));if(_0x4a9deb['error']){if(_0x4a9deb[_0x5638('0x10')][_0x5638('0x11')]===0x1f4){logger['error'](_0x5638('0xb'),_0x4c7d44,_0x4a9deb['error']['message']);return _0x11f903(_0x4a9deb['error'][_0x5638('0x12')]);}logger['error']('OpenchannelTransferReport,\x20%s,\x20%s',_0x4c7d44,_0x4a9deb[_0x5638('0x10')]['message']);return _0x394a7d(_0x4a9deb['error'][_0x5638('0x12')]);}else{logger['info']('OpenchannelTransferReport,\x20%s,\x20%s',_0x4c7d44,_0x5638('0xc'));_0x394a7d(_0x4a9deb['result'][_0x5638('0x12')]);}})[_0x5638('0x13')](function(_0x27c094){logger[_0x5638('0x10')](_0x5638('0xb'),_0x4c7d44,_0x27c094);_0x11f903(_0x27c094);});});} \ No newline at end of file +var _0x75dd=['lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch'];(function(_0x150e54,_0x79f223){var _0x59a0be=function(_0x19b439){while(--_0x19b439){_0x150e54['push'](_0x150e54['shift']());}};_0x59a0be(++_0x79f223);}(_0x75dd,0x6e));var _0xd75d=function(_0x2110dd,_0x4c3caa){_0x2110dd=_0x2110dd-0x0;var _0x49dd23=_0x75dd[_0x2110dd];return _0x49dd23;};'use strict';var _=require(_0xd75d('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xd75d('0x1'));var rs=require(_0xd75d('0x2'));var fs=require('fs');var Redis=require(_0xd75d('0x3'));var db=require(_0xd75d('0x4'))['db'];var utils=require(_0xd75d('0x5'));var logger=require(_0xd75d('0x6'))('rpc');var config=require(_0xd75d('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xd75d('0x8')][_0xd75d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x88f516,_0x93feaf,_0x15525a){return new BPromise(function(_0xebff5f,_0x1c9010){return client[_0xd75d('0xa')](_0x88f516,_0x15525a)[_0xd75d('0xb')](function(_0x472517){logger[_0xd75d('0xc')](_0xd75d('0xd'),_0x93feaf,_0xd75d('0xe'));logger[_0xd75d('0xf')](_0xd75d('0x10'),_0x93feaf,'request\x20sent',JSON[_0xd75d('0x11')](_0x472517));if(_0x472517['error']){if(_0x472517[_0xd75d('0x12')]['code']===0x1f4){logger[_0xd75d('0x12')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x93feaf,_0x472517[_0xd75d('0x12')][_0xd75d('0x13')]);return _0x1c9010(_0x472517['error']['message']);}logger[_0xd75d('0x12')](_0xd75d('0xd'),_0x93feaf,_0x472517[_0xd75d('0x12')][_0xd75d('0x13')]);return _0xebff5f(_0x472517['error'][_0xd75d('0x13')]);}else{logger[_0xd75d('0xc')](_0xd75d('0xd'),_0x93feaf,_0xd75d('0xe'));_0xebff5f(_0x472517[_0xd75d('0x14')]['message']);}})[_0xd75d('0x15')](function(_0x315dc7){logger[_0xd75d('0x12')](_0xd75d('0xd'),_0x93feaf,_0x315dc7);_0x1c9010(_0x315dc7);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index daf56d6..1ecf192 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 _0x6662=['/:id','isAuthenticated','show','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./pause.controller','index','get'];(function(_0x39854c,_0x35cfaf){var _0x8945cf=function(_0x2a7f43){while(--_0x2a7f43){_0x39854c['push'](_0x39854c['shift']());}};_0x8945cf(++_0x35cfaf);}(_0x6662,0x116));var _0x2666=function(_0x127c7e,_0x470192){_0x127c7e=_0x127c7e-0x0;var _0x45f955=_0x6662[_0x127c7e];return _0x45f955;};'use strict';var multer=require(_0x2666('0x0'));var util=require(_0x2666('0x1'));var path=require(_0x2666('0x2'));var timeout=require(_0x2666('0x3'));var express=require(_0x2666('0x4'));var router=express[_0x2666('0x5')]();var auth=require(_0x2666('0x6'));var interaction=require(_0x2666('0x7'));var config=require('../../config/environment');var controller=require(_0x2666('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x2666('0x9')]);router[_0x2666('0xa')](_0x2666('0xb'),auth[_0x2666('0xc')](),controller[_0x2666('0xd')]);router['post']('/',auth[_0x2666('0xc')](),controller['create']);router['put']('/:id',auth[_0x2666('0xc')](),controller[_0x2666('0xe')]);router[_0x2666('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x2666('0x10')]);module['exports']=router; \ No newline at end of file +var _0x0d5c=['destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller','get','isAuthenticated','index','/:id','show','post','create','update','delete'];(function(_0x3d00db,_0x2d799f){var _0x4da409=function(_0x2cd37b){while(--_0x2cd37b){_0x3d00db['push'](_0x3d00db['shift']());}};_0x4da409(++_0x2d799f);}(_0x0d5c,0xa1));var _0xc0d5=function(_0x2b5b44,_0x17189c){_0x2b5b44=_0x2b5b44-0x0;var _0x32cb66=_0x0d5c[_0x2b5b44];return _0x32cb66;};'use strict';var multer=require(_0xc0d5('0x0'));var util=require(_0xc0d5('0x1'));var path=require(_0xc0d5('0x2'));var timeout=require(_0xc0d5('0x3'));var express=require(_0xc0d5('0x4'));var router=express[_0xc0d5('0x5')]();var auth=require(_0xc0d5('0x6'));var interaction=require(_0xc0d5('0x7'));var config=require(_0xc0d5('0x8'));var controller=require(_0xc0d5('0x9'));router[_0xc0d5('0xa')]('/',auth[_0xc0d5('0xb')](),controller[_0xc0d5('0xc')]);router[_0xc0d5('0xa')](_0xc0d5('0xd'),auth[_0xc0d5('0xb')](),controller[_0xc0d5('0xe')]);router[_0xc0d5('0xf')]('/',auth[_0xc0d5('0xb')](),controller[_0xc0d5('0x10')]);router['put'](_0xc0d5('0xd'),auth[_0xc0d5('0xb')](),controller[_0xc0d5('0x11')]);router[_0xc0d5('0x12')]('/:id',auth[_0xc0d5('0xb')](),controller[_0xc0d5('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 7e5d907..8f1349c 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 _0x50eb=['sequelize','exports','STRING'];(function(_0xd050c6,_0x58ffb4){var _0x7278a=function(_0x16d03e){while(--_0x16d03e){_0xd050c6['push'](_0xd050c6['shift']());}};_0x7278a(++_0x58ffb4);}(_0x50eb,0x1aa));var _0xb50e=function(_0x44bcb0,_0x235aa9){_0x44bcb0=_0x44bcb0-0x0;var _0xfaf881=_0x50eb[_0x44bcb0];return _0xfaf881;};'use strict';var Sequelize=require(_0xb50e('0x0'));module[_0xb50e('0x1')]={'name':{'type':Sequelize[_0xb50e('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0xb50e('0x2')]}}; \ No newline at end of file +var _0x906b=['name','STRING','sequelize'];(function(_0x3d7fb5,_0x16eb5c){var _0x3a9642=function(_0x3f5b2a){while(--_0x3f5b2a){_0x3d7fb5['push'](_0x3d7fb5['shift']());}};_0x3a9642(++_0x16eb5c);}(_0x906b,0xef));var _0xb906=function(_0x81dcac,_0x8ff7db){_0x81dcac=_0x81dcac-0x0;var _0xc7803b=_0x906b[_0x81dcac];return _0xc7803b;};'use strict';var Sequelize=require(_0xb906('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xb906('0x1'),'allowNull':![]},'description':{'type':Sequelize[_0xb906('0x2')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 7927343..e4ee989 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 _0xc7fd=['rows','catch','show','length','include','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','find','params','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','lodash','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','status','json','count','offset','limit','Content-Range','apply','reject','save','then','destroy','get','Pauses','UserProfileResource','error','stack','name','send','index','map','Pause','rawAttributes','type','key','keys','query','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filters','VIRTUAL','merge','options','includeAll','findAll'];(function(_0x2a18b5,_0x1851a1){var _0x3d3d7f=function(_0x31f571){while(--_0x31f571){_0x2a18b5['push'](_0x2a18b5['shift']());}};_0x3d3d7f(++_0x1851a1);}(_0xc7fd,0x14e));var _0xdc7f=function(_0x49dcf0,_0x4effb0){_0x49dcf0=_0x49dcf0-0x0;var _0x4d4d58=_0xc7fd[_0x49dcf0];return _0x4d4d58;};'use strict';var pdf=require(_0xdc7f('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xdc7f('0x1'));var zipdir=require(_0xdc7f('0x2'));var jsonpatch=require(_0xdc7f('0x3'));var rp=require(_0xdc7f('0x4'));var moment=require('moment');var BPromise=require(_0xdc7f('0x5'));var Mustache=require(_0xdc7f('0x6'));var util=require('util');var path=require(_0xdc7f('0x7'));var sox=require(_0xdc7f('0x8'));var csv=require('to-csv');var ejs=require(_0xdc7f('0x9'));var fs=require('fs');var _=require(_0xdc7f('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xdc7f('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xdc7f('0xc'));var querystring=require(_0xdc7f('0xd'));var Papa=require(_0xdc7f('0xe'));var Redis=require(_0xdc7f('0xf'));var authService=require(_0xdc7f('0x10'));var qs=require(_0xdc7f('0x11'));var as=require(_0xdc7f('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdc7f('0x13'))(_0xdc7f('0x14'));var utils=require(_0xdc7f('0x15'));var config=require(_0xdc7f('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3ff9c1,_0x3ec417){_0x3ec417=_0x3ec417||0xcc;return function(_0x55130b){if(_0x55130b){return _0x3ff9c1[_0xdc7f('0x17')](_0x3ec417);}return _0x3ff9c1['status'](_0x3ec417)[_0xdc7f('0x18')]();};}function respondWithResult(_0x56802d,_0x13eca5){_0x13eca5=_0x13eca5||0xc8;return function(_0x3eddf3){if(_0x3eddf3){return _0x56802d[_0xdc7f('0x19')](_0x13eca5)[_0xdc7f('0x1a')](_0x3eddf3);}};}function respondWithFilteredResult(_0x352707,_0xade325){return function(_0x17ed9e){if(_0x17ed9e){var _0x328803=_0x17ed9e[_0xdc7f('0x1b')],_0x4baa1b=_0xade325[_0xdc7f('0x1c')],_0x182f9a=_0xade325['offset']+_0xade325[_0xdc7f('0x1d')],_0x1f3dd2;if(_0x182f9a>=_0x328803){_0x182f9a=_0x328803;_0x1f3dd2=0xc8;}else{_0x1f3dd2=0xce;}_0x352707[_0xdc7f('0x19')](_0x1f3dd2);return _0x352707['set'](_0xdc7f('0x1e'),_0x4baa1b+'-'+_0x182f9a+'/'+_0x328803)['json'](_0x17ed9e);}return null;};}function patchUpdates(_0x26c63b){return function(_0x5622cc){try{jsonpatch[_0xdc7f('0x1f')](_0x5622cc,_0x26c63b,!![]);}catch(_0x539aca){return BPromise[_0xdc7f('0x20')](_0x539aca);}return _0x5622cc[_0xdc7f('0x21')]();};}function saveUpdates(_0x5c7530,_0x3889c6){return function(_0x1666ed){if(_0x1666ed){return _0x1666ed['update'](_0x5c7530)[_0xdc7f('0x22')](function(_0x4c4f54){return _0x4c4f54;});}return null;};}function removeEntity(_0x11e2d2,_0x692fd7){return function(_0x259d0c){if(_0x259d0c){return _0x259d0c[_0xdc7f('0x23')]()['then'](function(){var _0x5d084b=_0x259d0c[_0xdc7f('0x24')]({'plain':!![]});var _0x16c50a=_0xdc7f('0x25');return db[_0xdc7f('0x26')][_0xdc7f('0x23')]({'where':{'type':_0x16c50a,'resourceId':_0x5d084b['id']}})[_0xdc7f('0x22')](function(){return _0x259d0c;});})[_0xdc7f('0x22')](function(){_0x11e2d2[_0xdc7f('0x19')](0xcc)[_0xdc7f('0x18')]();});}};}function handleEntityNotFound(_0x6110,_0x57f86b){return function(_0x18eba6){if(!_0x18eba6){_0x6110[_0xdc7f('0x17')](0x194);}return _0x18eba6;};}function handleError(_0x18934a,_0x1156bb){_0x1156bb=_0x1156bb||0x1f4;return function(_0x588437){logger[_0xdc7f('0x27')](_0x588437[_0xdc7f('0x28')]);if(_0x588437[_0xdc7f('0x29')]){delete _0x588437[_0xdc7f('0x29')];}_0x18934a['status'](_0x1156bb)[_0xdc7f('0x2a')](_0x588437);};}exports[_0xdc7f('0x2b')]=function(_0x1d99d3,_0x1e2d60){var _0x3962c8={},_0x6ad49a={},_0x5315d1={'count':0x0,'rows':[]};var _0x5d00f4=_[_0xdc7f('0x2c')](db[_0xdc7f('0x2d')][_0xdc7f('0x2e')],function(_0x36cc95){return{'name':_0x36cc95['fieldName'],'type':_0x36cc95[_0xdc7f('0x2f')][_0xdc7f('0x30')]};});_0x6ad49a['model']=_[_0xdc7f('0x2c')](_0x5d00f4,_0xdc7f('0x29'));_0x6ad49a['query']=_[_0xdc7f('0x31')](_0x1d99d3[_0xdc7f('0x32')]);_0x6ad49a['filters']=_[_0xdc7f('0x33')](_0x6ad49a[_0xdc7f('0x34')],_0x6ad49a['query']);_0x3962c8[_0xdc7f('0x35')]=_[_0xdc7f('0x33')](_0x6ad49a[_0xdc7f('0x34')],qs[_0xdc7f('0x36')](_0x1d99d3[_0xdc7f('0x32')][_0xdc7f('0x36')]));_0x3962c8[_0xdc7f('0x35')]=_0x3962c8[_0xdc7f('0x35')]['length']?_0x3962c8[_0xdc7f('0x35')]:_0x6ad49a[_0xdc7f('0x34')];if(!_0x1d99d3['query'][_0xdc7f('0x37')](_0xdc7f('0x38'))){_0x3962c8[_0xdc7f('0x1d')]=qs['limit'](_0x1d99d3[_0xdc7f('0x32')][_0xdc7f('0x1d')]);_0x3962c8[_0xdc7f('0x1c')]=qs[_0xdc7f('0x1c')](_0x1d99d3[_0xdc7f('0x32')]['offset']);}_0x3962c8['order']=qs[_0xdc7f('0x39')](_0x1d99d3[_0xdc7f('0x32')][_0xdc7f('0x39')]);_0x3962c8[_0xdc7f('0x3a')]=qs['filters'](_[_0xdc7f('0x3b')](_0x1d99d3['query'],_0x6ad49a[_0xdc7f('0x3c')]),_0x5d00f4);if(_0x1d99d3[_0xdc7f('0x32')]['filter']){_0x3962c8[_0xdc7f('0x3a')]=_['merge'](_0x3962c8[_0xdc7f('0x3a')],{'$or':_[_0xdc7f('0x2c')](_0x5d00f4,function(_0x2aaf4a){if(_0x2aaf4a['type']!==_0xdc7f('0x3d')){var _0x224649={};_0x224649[_0x2aaf4a[_0xdc7f('0x29')]]={'$like':'%'+_0x1d99d3[_0xdc7f('0x32')]['filter']+'%'};return _0x224649;}})});}_0x3962c8=_[_0xdc7f('0x3e')]({},_0x3962c8,_0x1d99d3[_0xdc7f('0x3f')]);var _0x376b23={'where':_0x3962c8[_0xdc7f('0x3a')]};return db[_0xdc7f('0x2d')][_0xdc7f('0x1b')](_0x376b23)[_0xdc7f('0x22')](function(_0x235c77){_0x5315d1[_0xdc7f('0x1b')]=_0x235c77;if(_0x1d99d3[_0xdc7f('0x32')][_0xdc7f('0x40')]){_0x3962c8['include']=[{'all':!![]}];}return db[_0xdc7f('0x2d')][_0xdc7f('0x41')](_0x3962c8);})[_0xdc7f('0x22')](function(_0x271189){_0x5315d1[_0xdc7f('0x42')]=_0x271189;return _0x5315d1;})['then'](respondWithFilteredResult(_0x1e2d60,_0x3962c8))[_0xdc7f('0x43')](handleError(_0x1e2d60,null));};exports[_0xdc7f('0x44')]=function(_0x394c14,_0x460498){var _0x45caa6={'raw':!![],'where':{'id':_0x394c14['params']['id']}},_0x22afa2={};_0x22afa2[_0xdc7f('0x34')]=_[_0xdc7f('0x31')](db[_0xdc7f('0x2d')]['rawAttributes']);_0x22afa2['query']=_[_0xdc7f('0x31')](_0x394c14[_0xdc7f('0x32')]);_0x22afa2['filters']=_['intersection'](_0x22afa2['model'],_0x22afa2['query']);_0x45caa6[_0xdc7f('0x35')]=_[_0xdc7f('0x33')](_0x22afa2[_0xdc7f('0x34')],qs[_0xdc7f('0x36')](_0x394c14['query'][_0xdc7f('0x36')]));_0x45caa6[_0xdc7f('0x35')]=_0x45caa6[_0xdc7f('0x35')][_0xdc7f('0x45')]?_0x45caa6[_0xdc7f('0x35')]:_0x22afa2['model'];if(_0x394c14[_0xdc7f('0x32')][_0xdc7f('0x40')]){_0x45caa6[_0xdc7f('0x46')]=[{'all':!![]}];}_0x45caa6=_['merge']({},_0x45caa6,_0x394c14[_0xdc7f('0x3f')]);return db[_0xdc7f('0x2d')]['find'](_0x45caa6)['then'](handleEntityNotFound(_0x460498,null))[_0xdc7f('0x22')](respondWithResult(_0x460498,null))['catch'](handleError(_0x460498,null));};exports[_0xdc7f('0x47')]=function(_0x553d16,_0x2f2066){return db[_0xdc7f('0x2d')][_0xdc7f('0x47')](_0x553d16[_0xdc7f('0x48')],{})[_0xdc7f('0x22')](function(_0x5cb413){var _0x320d0d=_0x553d16[_0xdc7f('0x49')][_0xdc7f('0x24')]({'plain':!![]});if(!_0x320d0d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x320d0d[_0xdc7f('0x4a')]===_0xdc7f('0x49')){var _0x22f3db=_0x5cb413[_0xdc7f('0x24')]({'plain':!![]});var _0x1be3df=_0xdc7f('0x25');return db[_0xdc7f('0x4b')]['find']({'where':{'name':_0x1be3df,'userProfileId':_0x320d0d[_0xdc7f('0x4c')]},'raw':!![]})[_0xdc7f('0x22')](function(_0x318241){if(_0x318241&&_0x318241[_0xdc7f('0x4d')]===0x0){return db[_0xdc7f('0x26')]['create']({'name':_0x22f3db[_0xdc7f('0x29')],'resourceId':_0x22f3db['id'],'type':_0x318241[_0xdc7f('0x29')],'sectionId':_0x318241['id']},{})['then'](function(){return _0x5cb413;});}else{return _0x5cb413;}})['catch'](function(_0x1e23a){logger[_0xdc7f('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1e23a);throw _0x1e23a;});}return _0x5cb413;})['then'](respondWithResult(_0x2f2066,0xc9))[_0xdc7f('0x43')](handleError(_0x2f2066,null));};exports['update']=function(_0x2f5481,_0xedbedb){if(_0x2f5481[_0xdc7f('0x48')]['id']){delete _0x2f5481[_0xdc7f('0x48')]['id'];}return db[_0xdc7f('0x2d')][_0xdc7f('0x4e')]({'where':{'id':_0x2f5481[_0xdc7f('0x4f')]['id']}})[_0xdc7f('0x22')](handleEntityNotFound(_0xedbedb,null))['then'](saveUpdates(_0x2f5481['body'],null))[_0xdc7f('0x22')](respondWithResult(_0xedbedb,null))[_0xdc7f('0x43')](handleError(_0xedbedb,null));};exports[_0xdc7f('0x23')]=function(_0x4e6582,_0x35810d){return db[_0xdc7f('0x2d')]['find']({'where':{'id':_0x4e6582['params']['id']}})['then'](handleEntityNotFound(_0x35810d,null))[_0xdc7f('0x22')](removeEntity(_0x35810d,null))[_0xdc7f('0x43')](handleError(_0x35810d,null));}; \ No newline at end of file +var _0x941b=['show','params','rawAttributes','length','includeAll','create','body','user','role','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','html-pdf','eml-format','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','status','end','json','count','offset','limit','set','apply','save','destroy','then','get','Pauses','sendStatus','error','stack','name','map','fieldName','type','model','keys','query','filters','attributes','intersection','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','Pause','include','findAll','rows','catch'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x941b,0xab));var _0xb941=function(_0x2f3f70,_0x52fd85){_0x2f3f70=_0x2f3f70-0x0;var _0x202fde=_0x941b[_0x2f3f70];return _0x202fde;};'use strict';var pdf=require(_0xb941('0x0'));var emlformat=require(_0xb941('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xb941('0x2'));var moment=require(_0xb941('0x3'));var BPromise=require(_0xb941('0x4'));var Mustache=require('mustache');var util=require(_0xb941('0x5'));var path=require(_0xb941('0x6'));var sox=require(_0xb941('0x7'));var csv=require(_0xb941('0x8'));var ejs=require(_0xb941('0x9'));var fs=require('fs');var _=require(_0xb941('0xa'));var squel=require(_0xb941('0xb'));var crypto=require(_0xb941('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xb941('0xd'));var toCsv=require('to-csv');var querystring=require(_0xb941('0xe'));var Papa=require(_0xb941('0xf'));var Redis=require(_0xb941('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xb941('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xb941('0x12'))(_0xb941('0x13'));var utils=require(_0xb941('0x14'));var config=require(_0xb941('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x8de3d2,_0x5552ab){_0x5552ab=_0x5552ab||0xcc;return function(_0x306f94){if(_0x306f94){return _0x8de3d2['sendStatus'](_0x5552ab);}return _0x8de3d2[_0xb941('0x16')](_0x5552ab)[_0xb941('0x17')]();};}function respondWithResult(_0x438375,_0x50d1ab){_0x50d1ab=_0x50d1ab||0xc8;return function(_0x138779){if(_0x138779){return _0x438375[_0xb941('0x16')](_0x50d1ab)[_0xb941('0x18')](_0x138779);}};}function respondWithFilteredResult(_0x46857b,_0x459241){return function(_0x2fdbe2){if(_0x2fdbe2){var _0x445f6e=_0x2fdbe2[_0xb941('0x19')],_0x1b0ebd=_0x459241['offset'],_0x5bafe6=_0x459241[_0xb941('0x1a')]+_0x459241[_0xb941('0x1b')],_0x185d35;if(_0x5bafe6>=_0x445f6e){_0x5bafe6=_0x445f6e;_0x185d35=0xc8;}else{_0x185d35=0xce;}_0x46857b[_0xb941('0x16')](_0x185d35);return _0x46857b[_0xb941('0x1c')]('Content-Range',_0x1b0ebd+'-'+_0x5bafe6+'/'+_0x445f6e)[_0xb941('0x18')](_0x2fdbe2);}return null;};}function patchUpdates(_0xc88772){return function(_0x2e109d){try{jsonpatch[_0xb941('0x1d')](_0x2e109d,_0xc88772,!![]);}catch(_0x217a61){return BPromise['reject'](_0x217a61);}return _0x2e109d[_0xb941('0x1e')]();};}function saveUpdates(_0x119b31,_0x172a35){return function(_0x54a2aa){if(_0x54a2aa){return _0x54a2aa['update'](_0x119b31)['then'](function(_0x59ee4a){return _0x59ee4a;});}return null;};}function removeEntity(_0x23323f,_0x2a23b4){return function(_0x156845){if(_0x156845){return _0x156845[_0xb941('0x1f')]()[_0xb941('0x20')](function(){var _0x48104e=_0x156845[_0xb941('0x21')]({'plain':!![]});var _0x40030f=_0xb941('0x22');return db['UserProfileResource'][_0xb941('0x1f')]({'where':{'type':_0x40030f,'resourceId':_0x48104e['id']}})[_0xb941('0x20')](function(){return _0x156845;});})[_0xb941('0x20')](function(){_0x23323f['status'](0xcc)[_0xb941('0x17')]();});}};}function handleEntityNotFound(_0xcf7fc2,_0x4d4f3b){return function(_0x1c6c23){if(!_0x1c6c23){_0xcf7fc2[_0xb941('0x23')](0x194);}return _0x1c6c23;};}function handleError(_0x295927,_0x44f2bd){_0x44f2bd=_0x44f2bd||0x1f4;return function(_0x53512f){logger[_0xb941('0x24')](_0x53512f[_0xb941('0x25')]);if(_0x53512f[_0xb941('0x26')]){delete _0x53512f[_0xb941('0x26')];}_0x295927[_0xb941('0x16')](_0x44f2bd)['send'](_0x53512f);};}exports['index']=function(_0x474b58,_0x3f36ee){var _0x59392d={},_0x372002={},_0x1dfdbd={'count':0x0,'rows':[]};var _0xdc503f=_[_0xb941('0x27')](db['Pause']['rawAttributes'],function(_0x210ddc){return{'name':_0x210ddc[_0xb941('0x28')],'type':_0x210ddc[_0xb941('0x29')]['key']};});_0x372002[_0xb941('0x2a')]=_[_0xb941('0x27')](_0xdc503f,_0xb941('0x26'));_0x372002['query']=_[_0xb941('0x2b')](_0x474b58[_0xb941('0x2c')]);_0x372002[_0xb941('0x2d')]=_['intersection'](_0x372002[_0xb941('0x2a')],_0x372002['query']);_0x59392d[_0xb941('0x2e')]=_[_0xb941('0x2f')](_0x372002[_0xb941('0x2a')],qs[_0xb941('0x30')](_0x474b58[_0xb941('0x2c')][_0xb941('0x30')]));_0x59392d[_0xb941('0x2e')]=_0x59392d[_0xb941('0x2e')]['length']?_0x59392d['attributes']:_0x372002[_0xb941('0x2a')];if(!_0x474b58['query'][_0xb941('0x31')]('nolimit')){_0x59392d[_0xb941('0x1b')]=qs[_0xb941('0x1b')](_0x474b58[_0xb941('0x2c')][_0xb941('0x1b')]);_0x59392d[_0xb941('0x1a')]=qs['offset'](_0x474b58[_0xb941('0x2c')][_0xb941('0x1a')]);}_0x59392d[_0xb941('0x32')]=qs[_0xb941('0x33')](_0x474b58[_0xb941('0x2c')][_0xb941('0x33')]);_0x59392d[_0xb941('0x34')]=qs['filters'](_[_0xb941('0x35')](_0x474b58['query'],_0x372002['filters']),_0xdc503f);if(_0x474b58[_0xb941('0x2c')][_0xb941('0x36')]){_0x59392d[_0xb941('0x34')]=_[_0xb941('0x37')](_0x59392d[_0xb941('0x34')],{'$or':_['map'](_0xdc503f,function(_0x3c175e){if(_0x3c175e[_0xb941('0x29')]!==_0xb941('0x38')){var _0x2efa05={};_0x2efa05[_0x3c175e[_0xb941('0x26')]]={'$like':'%'+_0x474b58[_0xb941('0x2c')][_0xb941('0x36')]+'%'};return _0x2efa05;}})});}_0x59392d=_[_0xb941('0x37')]({},_0x59392d,_0x474b58[_0xb941('0x39')]);var _0x190e89={'where':_0x59392d[_0xb941('0x34')]};return db[_0xb941('0x3a')]['count'](_0x190e89)[_0xb941('0x20')](function(_0x183fb1){_0x1dfdbd['count']=_0x183fb1;if(_0x474b58[_0xb941('0x2c')]['includeAll']){_0x59392d[_0xb941('0x3b')]=[{'all':!![]}];}return db[_0xb941('0x3a')][_0xb941('0x3c')](_0x59392d);})['then'](function(_0x305d01){_0x1dfdbd[_0xb941('0x3d')]=_0x305d01;return _0x1dfdbd;})[_0xb941('0x20')](respondWithFilteredResult(_0x3f36ee,_0x59392d))[_0xb941('0x3e')](handleError(_0x3f36ee,null));};exports[_0xb941('0x3f')]=function(_0x7edea4,_0x17d812){var _0xff0d48={'raw':!![],'where':{'id':_0x7edea4[_0xb941('0x40')]['id']}},_0x5c6ecb={};_0x5c6ecb[_0xb941('0x2a')]=_['keys'](db[_0xb941('0x3a')][_0xb941('0x41')]);_0x5c6ecb[_0xb941('0x2c')]=_[_0xb941('0x2b')](_0x7edea4[_0xb941('0x2c')]);_0x5c6ecb[_0xb941('0x2d')]=_['intersection'](_0x5c6ecb[_0xb941('0x2a')],_0x5c6ecb[_0xb941('0x2c')]);_0xff0d48['attributes']=_[_0xb941('0x2f')](_0x5c6ecb['model'],qs[_0xb941('0x30')](_0x7edea4['query']['fields']));_0xff0d48[_0xb941('0x2e')]=_0xff0d48[_0xb941('0x2e')][_0xb941('0x42')]?_0xff0d48[_0xb941('0x2e')]:_0x5c6ecb['model'];if(_0x7edea4[_0xb941('0x2c')][_0xb941('0x43')]){_0xff0d48[_0xb941('0x3b')]=[{'all':!![]}];}_0xff0d48=_[_0xb941('0x37')]({},_0xff0d48,_0x7edea4[_0xb941('0x39')]);return db[_0xb941('0x3a')]['find'](_0xff0d48)[_0xb941('0x20')](handleEntityNotFound(_0x17d812,null))[_0xb941('0x20')](respondWithResult(_0x17d812,null))[_0xb941('0x3e')](handleError(_0x17d812,null));};exports[_0xb941('0x44')]=function(_0x3f8fb4,_0x3f3dab){return db[_0xb941('0x3a')]['create'](_0x3f8fb4[_0xb941('0x45')],{})[_0xb941('0x20')](function(_0x1bde16){var _0x585836=_0x3f8fb4[_0xb941('0x46')][_0xb941('0x21')]({'plain':!![]});if(!_0x585836)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x585836[_0xb941('0x47')]===_0xb941('0x46')){var _0x288b36=_0x1bde16[_0xb941('0x21')]({'plain':!![]});var _0x4b3b83='Pauses';return db['UserProfileSection'][_0xb941('0x48')]({'where':{'name':_0x4b3b83,'userProfileId':_0x585836[_0xb941('0x49')]},'raw':!![]})[_0xb941('0x20')](function(_0x32a34b){if(_0x32a34b&&_0x32a34b[_0xb941('0x4a')]===0x0){return db[_0xb941('0x4b')][_0xb941('0x44')]({'name':_0x288b36[_0xb941('0x26')],'resourceId':_0x288b36['id'],'type':_0x32a34b[_0xb941('0x26')],'sectionId':_0x32a34b['id']},{})[_0xb941('0x20')](function(){return _0x1bde16;});}else{return _0x1bde16;}})[_0xb941('0x3e')](function(_0x2a2291){logger['error'](_0xb941('0x4c'),_0x2a2291);throw _0x2a2291;});}return _0x1bde16;})[_0xb941('0x20')](respondWithResult(_0x3f3dab,0xc9))['catch'](handleError(_0x3f3dab,null));};exports[_0xb941('0x4d')]=function(_0x12eac9,_0xd823f8){if(_0x12eac9['body']['id']){delete _0x12eac9[_0xb941('0x45')]['id'];}return db[_0xb941('0x3a')][_0xb941('0x48')]({'where':{'id':_0x12eac9['params']['id']}})['then'](handleEntityNotFound(_0xd823f8,null))[_0xb941('0x20')](saveUpdates(_0x12eac9[_0xb941('0x45')],null))[_0xb941('0x20')](respondWithResult(_0xd823f8,null))['catch'](handleError(_0xd823f8,null));};exports[_0xb941('0x1f')]=function(_0x3f73d1,_0xa66cd1){return db[_0xb941('0x3a')]['find']({'where':{'id':_0x3f73d1[_0xb941('0x40')]['id']}})[_0xb941('0x20')](handleEntityNotFound(_0xa66cd1,null))[_0xb941('0x20')](removeEntity(_0xa66cd1,null))[_0xb941('0x3e')](handleError(_0xa66cd1,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index b64f822..47267f0 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 _0x8814=['api','bluebird','request-promise','path','rimraf','./pause.attributes','exports','Pause','lodash'];(function(_0x3b96cf,_0x1592f2){var _0x2e315a=function(_0x21fa50){while(--_0x21fa50){_0x3b96cf['push'](_0x3b96cf['shift']());}};_0x2e315a(++_0x1592f2);}(_0x8814,0x1b8));var _0x4881=function(_0x38b14f,_0xd08fa8){_0x38b14f=_0x38b14f-0x0;var _0x22a324=_0x8814[_0x38b14f];return _0x22a324;};'use strict';var _=require(_0x4881('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x4881('0x1'));var moment=require('moment');var BPromise=require(_0x4881('0x2'));var rp=require(_0x4881('0x3'));var fs=require('fs');var path=require(_0x4881('0x4'));var rimraf=require(_0x4881('0x5'));var config=require('../../config/environment');var attributes=require(_0x4881('0x6'));module[_0x4881('0x7')]=function(_0x20bc6c,_0x1f292f){return _0x20bc6c['define'](_0x4881('0x8'),attributes,{'tableName':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0c71=['api','moment','bluebird','rimraf','./pause.attributes','exports','define','Pause','util'];(function(_0x9df060,_0x253d33){var _0x338dfe=function(_0x17d9a5){while(--_0x17d9a5){_0x9df060['push'](_0x9df060['shift']());}};_0x338dfe(++_0x253d33);}(_0x0c71,0xfb));var _0x10c7=function(_0x4175e9,_0x3924b2){_0x4175e9=_0x4175e9-0x0;var _0x402ec8=_0x0c71[_0x4175e9];return _0x402ec8;};'use strict';var _=require('lodash');var util=require(_0x10c7('0x0'));var logger=require('../../config/logger')(_0x10c7('0x1'));var moment=require(_0x10c7('0x2'));var BPromise=require(_0x10c7('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x10c7('0x4'));var config=require('../../config/environment');var attributes=require(_0x10c7('0x5'));module[_0x10c7('0x6')]=function(_0x21da60,_0x4480c2){return _0x21da60[_0x10c7('0x7')](_0x10c7('0x8'),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 f156290..077f61e 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 _0x8d59=['model','attributes','debug','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','then','info','Pause,\x20%s,\x20%s','Pause,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','ShowPause','find','options','raw','include','map'];(function(_0x4c4c28,_0xc8431c){var _0x45537b=function(_0x5168a4){while(--_0x5168a4){_0x4c4c28['push'](_0x4c4c28['shift']());}};_0x45537b(++_0xc8431c);}(_0x8d59,0xa5));var _0x98d5=function(_0x34ccbb,_0x4f3dbc){_0x34ccbb=_0x34ccbb-0x0;var _0x1aea87=_0x8d59[_0x34ccbb];return _0x1aea87;};'use strict';var _=require('lodash');var util=require(_0x98d5('0x0'));var moment=require(_0x98d5('0x1'));var BPromise=require(_0x98d5('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x98d5('0x3'));var db=require(_0x98d5('0x4'))['db'];var utils=require(_0x98d5('0x5'));var logger=require('../../config/logger')(_0x98d5('0x6'));var config=require(_0x98d5('0x7'));var jayson=require(_0x98d5('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x72678c,_0x3bae2f,_0x1206ad){return new BPromise(function(_0x4889ee,_0x9317b2){return client[_0x98d5('0x9')](_0x72678c,_0x1206ad)[_0x98d5('0xa')](function(_0x3e540c){logger[_0x98d5('0xb')](_0x98d5('0xc'),_0x3bae2f,'request\x20sent');logger['debug'](_0x98d5('0xd'),_0x3bae2f,_0x98d5('0xe'),JSON['stringify'](_0x3e540c));if(_0x3e540c[_0x98d5('0xf')]){if(_0x3e540c[_0x98d5('0xf')][_0x98d5('0x10')]===0x1f4){logger[_0x98d5('0xf')]('Pause,\x20%s,\x20%s',_0x3bae2f,_0x3e540c['error'][_0x98d5('0x11')]);return _0x9317b2(_0x3e540c['error'][_0x98d5('0x11')]);}logger['error']('Pause,\x20%s,\x20%s',_0x3bae2f,_0x3e540c[_0x98d5('0xf')]['message']);return _0x4889ee(_0x3e540c['error'][_0x98d5('0x11')]);}else{logger[_0x98d5('0xb')](_0x98d5('0xc'),_0x3bae2f,_0x98d5('0xe'));_0x4889ee(_0x3e540c['result']['message']);}})['catch'](function(_0x331e54){logger['error']('Pause,\x20%s,\x20%s',_0x3bae2f,_0x331e54);_0x9317b2(_0x331e54);});});}exports[_0x98d5('0x12')]=function(_0x3bb2e1){var _0x43426f=this;return new Promise(function(_0x42074d,_0x14ed3a){return db['Pause'][_0x98d5('0x13')]({'raw':_0x3bb2e1[_0x98d5('0x14')]?_0x3bb2e1['options'][_0x98d5('0x15')]===undefined?!![]:![]:!![],'where':_0x3bb2e1[_0x98d5('0x14')]?_0x3bb2e1[_0x98d5('0x14')]['where']||null:null,'attributes':_0x3bb2e1[_0x98d5('0x14')]?_0x3bb2e1[_0x98d5('0x14')]['attributes']||null:null,'include':_0x3bb2e1[_0x98d5('0x14')]?_0x3bb2e1[_0x98d5('0x14')][_0x98d5('0x16')]?_[_0x98d5('0x17')](_0x3bb2e1[_0x98d5('0x14')]['include'],function(_0x5bbc84){return{'model':db[_0x5bbc84[_0x98d5('0x18')]],'as':_0x5bbc84['as'],'attributes':_0x5bbc84[_0x98d5('0x19')],'include':_0x5bbc84[_0x98d5('0x16')]?_[_0x98d5('0x17')](_0x5bbc84[_0x98d5('0x16')],function(_0x1bd0ef){return{'model':db[_0x1bd0ef[_0x98d5('0x18')]],'as':_0x1bd0ef['as'],'attributes':_0x1bd0ef[_0x98d5('0x19')],'include':_0x1bd0ef[_0x98d5('0x16')]?_[_0x98d5('0x17')](_0x1bd0ef[_0x98d5('0x16')],function(_0x15c924){return{'model':db[_0x15c924[_0x98d5('0x18')]],'as':_0x15c924['as'],'attributes':_0x15c924['attributes']};}):[]};}):[]};}):[]:[]})[_0x98d5('0xa')](function(_0x3b03a7){logger['info'](_0x98d5('0x12'),_0x3bb2e1);logger[_0x98d5('0x1a')](_0x98d5('0x12'),_0x3bb2e1,JSON['stringify'](_0x3b03a7));_0x42074d(_0x3b03a7);})['catch'](function(_0x4d794b){logger[_0x98d5('0xf')](_0x98d5('0x12'),_0x4d794b['message'],_0x3bb2e1);_0x14ed3a(_0x43426f[_0x98d5('0xf')](0x1f4,_0x4d794b[_0x98d5('0x11')]));});});}; \ No newline at end of file +var _0x87cb=['catch','raw','options','where','attributes','include','map','model','debug','ShowPause','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Pause,\x20%s,\x20%s','request\x20sent','Pause,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0x48bf7a,_0x4f297c){var _0x323e79=function(_0x4dc5d3){while(--_0x4dc5d3){_0x48bf7a['push'](_0x48bf7a['shift']());}};_0x323e79(++_0x4f297c);}(_0x87cb,0xaa));var _0xb87c=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0x87cb[_0x4c12ec];return _0x3ae42c;};'use strict';var _=require(_0xb87c('0x0'));var util=require(_0xb87c('0x1'));var moment=require(_0xb87c('0x2'));var BPromise=require(_0xb87c('0x3'));var rs=require(_0xb87c('0x4'));var fs=require('fs');var Redis=require(_0xb87c('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb87c('0x6'))(_0xb87c('0x7'));var config=require(_0xb87c('0x8'));var jayson=require(_0xb87c('0x9'));var client=jayson[_0xb87c('0xa')][_0xb87c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x49db0f,_0x492c54,_0xe3d2f4){return new BPromise(function(_0x465e3d,_0x3de604){return client[_0xb87c('0xc')](_0x49db0f,_0xe3d2f4)[_0xb87c('0xd')](function(_0x5c7805){logger[_0xb87c('0xe')](_0xb87c('0xf'),_0x492c54,_0xb87c('0x10'));logger['debug'](_0xb87c('0x11'),_0x492c54,_0xb87c('0x10'),JSON[_0xb87c('0x12')](_0x5c7805));if(_0x5c7805[_0xb87c('0x13')]){if(_0x5c7805[_0xb87c('0x13')]['code']===0x1f4){logger['error'](_0xb87c('0xf'),_0x492c54,_0x5c7805[_0xb87c('0x13')][_0xb87c('0x14')]);return _0x3de604(_0x5c7805['error'][_0xb87c('0x14')]);}logger[_0xb87c('0x13')](_0xb87c('0xf'),_0x492c54,_0x5c7805[_0xb87c('0x13')][_0xb87c('0x14')]);return _0x465e3d(_0x5c7805[_0xb87c('0x13')][_0xb87c('0x14')]);}else{logger[_0xb87c('0xe')](_0xb87c('0xf'),_0x492c54,'request\x20sent');_0x465e3d(_0x5c7805[_0xb87c('0x15')][_0xb87c('0x14')]);}})[_0xb87c('0x16')](function(_0x8cb26c){logger['error'](_0xb87c('0xf'),_0x492c54,_0x8cb26c);_0x3de604(_0x8cb26c);});});}exports['ShowPause']=function(_0x4c4b6a){var _0x2a64a9=this;return new Promise(function(_0x1244c9,_0x264ce7){return db['Pause']['find']({'raw':_0x4c4b6a['options']?_0x4c4b6a['options'][_0xb87c('0x17')]===undefined?!![]:![]:!![],'where':_0x4c4b6a['options']?_0x4c4b6a[_0xb87c('0x18')][_0xb87c('0x19')]||null:null,'attributes':_0x4c4b6a['options']?_0x4c4b6a[_0xb87c('0x18')][_0xb87c('0x1a')]||null:null,'include':_0x4c4b6a['options']?_0x4c4b6a['options'][_0xb87c('0x1b')]?_[_0xb87c('0x1c')](_0x4c4b6a[_0xb87c('0x18')][_0xb87c('0x1b')],function(_0x483ff2){return{'model':db[_0x483ff2[_0xb87c('0x1d')]],'as':_0x483ff2['as'],'attributes':_0x483ff2['attributes'],'include':_0x483ff2[_0xb87c('0x1b')]?_[_0xb87c('0x1c')](_0x483ff2[_0xb87c('0x1b')],function(_0xa2d4c9){return{'model':db[_0xa2d4c9[_0xb87c('0x1d')]],'as':_0xa2d4c9['as'],'attributes':_0xa2d4c9[_0xb87c('0x1a')],'include':_0xa2d4c9[_0xb87c('0x1b')]?_['map'](_0xa2d4c9['include'],function(_0x39a0c9){return{'model':db[_0x39a0c9[_0xb87c('0x1d')]],'as':_0x39a0c9['as'],'attributes':_0x39a0c9['attributes']};}):[]};}):[]};}):[]:[]})[_0xb87c('0xd')](function(_0x8205ea){logger[_0xb87c('0xe')]('ShowPause',_0x4c4b6a);logger[_0xb87c('0x1e')](_0xb87c('0x1f'),_0x4c4b6a,JSON[_0xb87c('0x12')](_0x8205ea));_0x1244c9(_0x8205ea);})[_0xb87c('0x16')](function(_0x4d6c1f){logger[_0xb87c('0x13')](_0xb87c('0x1f'),_0x4d6c1f[_0xb87c('0x14')],_0x4c4b6a);_0x264ce7(_0x2a64a9[_0xb87c('0x13')](0x1f4,_0x4d6c1f[_0xb87c('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index d129dfb..2820468 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 _0xa58b=['Router','../../components/interaction/service','../../config/environment','./plugin.controller','isAuthenticated','index','get','webhookGet','/:id','download','diskStorage','join','server/files/plugins','originalname','replace','format','%s-%s%s','basename','extname','now','post','single','file','upload','/webhook','webhookPost','put','delete','exports','multer','util','path','express'];(function(_0x4cb4a3,_0x3936e6){var _0x504ab9=function(_0x58d969){while(--_0x58d969){_0x4cb4a3['push'](_0x4cb4a3['shift']());}};_0x504ab9(++_0x3936e6);}(_0xa58b,0x104));var _0xba58=function(_0x49a1ec,_0x4f4a0e){_0x49a1ec=_0x49a1ec-0x0;var _0x271b28=_0xa58b[_0x49a1ec];return _0x271b28;};'use strict';var multer=require(_0xba58('0x0'));var util=require(_0xba58('0x1'));var path=require(_0xba58('0x2'));var timeout=require('connect-timeout');var express=require(_0xba58('0x3'));var router=express[_0xba58('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xba58('0x5'));var config=require(_0xba58('0x6'));var controller=require(_0xba58('0x7'));router['get']('/',auth[_0xba58('0x8')](),controller[_0xba58('0x9')]);router[_0xba58('0xa')]('/webhook',controller[_0xba58('0xb')]);router[_0xba58('0xa')](_0xba58('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xba58('0xa')]('/:id/download',auth[_0xba58('0x8')](),controller[_0xba58('0xd')]);var upload=multer({'storage':multer[_0xba58('0xe')]({'destination':function(_0x577c92,_0x3d9312,_0x4a85bc){_0x4a85bc(null,path[_0xba58('0xf')](config['root'],_0xba58('0x10')));},'filename':function(_0x370656,_0x154335,_0x1ca7c8){_0x154335['originalname']=_0x154335[_0xba58('0x11')][_0xba58('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x1ca7c8(null,util[_0xba58('0x13')](_0xba58('0x14'),path[_0xba58('0x15')](_0x154335[_0xba58('0x11')],path[_0xba58('0x16')](_0x154335['originalname'])),Date[_0xba58('0x17')](),path[_0xba58('0x16')](_0x154335[_0xba58('0x11')])));}})});router[_0xba58('0x18')]('/',upload[_0xba58('0x19')](_0xba58('0x1a')),controller[_0xba58('0x1b')]);router[_0xba58('0x18')](_0xba58('0x1c'),controller[_0xba58('0x1d')]);router[_0xba58('0x1e')](_0xba58('0xc'),auth[_0xba58('0x8')](),controller['update']);router['delete'](_0xba58('0xc'),auth['isAuthenticated'](),controller[_0xba58('0x1f')]);module[_0xba58('0x20')]=router; \ No newline at end of file +var _0x340d=['isAuthenticated','index','/webhook','webhookGet','get','/:id','show','download','diskStorage','join','originalname','replace','format','%s-%s%s','basename','extname','now','single','file','webhookPost','update','delete','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x154741,_0xe31187){var _0x46fb4f=function(_0x300ce1){while(--_0x300ce1){_0x154741['push'](_0x154741['shift']());}};_0x46fb4f(++_0xe31187);}(_0x340d,0xb2));var _0xd340=function(_0x18f988,_0x487971){_0x18f988=_0x18f988-0x0;var _0x549d8b=_0x340d[_0x18f988];return _0x549d8b;};'use strict';var multer=require(_0xd340('0x0'));var util=require(_0xd340('0x1'));var path=require(_0xd340('0x2'));var timeout=require('connect-timeout');var express=require(_0xd340('0x3'));var router=express[_0xd340('0x4')]();var auth=require(_0xd340('0x5'));var interaction=require(_0xd340('0x6'));var config=require(_0xd340('0x7'));var controller=require('./plugin.controller');router['get']('/',auth[_0xd340('0x8')](),controller[_0xd340('0x9')]);router['get'](_0xd340('0xa'),controller[_0xd340('0xb')]);router[_0xd340('0xc')](_0xd340('0xd'),auth['isAuthenticated'](),controller[_0xd340('0xe')]);router[_0xd340('0xc')]('/:id/download',auth['isAuthenticated'](),controller[_0xd340('0xf')]);var upload=multer({'storage':multer[_0xd340('0x10')]({'destination':function(_0x472cf9,_0x49280e,_0x36dd1b){_0x36dd1b(null,path[_0xd340('0x11')](config['root'],'server/files/plugins'));},'filename':function(_0x8d374b,_0x2a1cda,_0x58f48f){_0x2a1cda[_0xd340('0x12')]=_0x2a1cda[_0xd340('0x12')][_0xd340('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x58f48f(null,util[_0xd340('0x14')](_0xd340('0x15'),path[_0xd340('0x16')](_0x2a1cda[_0xd340('0x12')],path[_0xd340('0x17')](_0x2a1cda[_0xd340('0x12')])),Date[_0xd340('0x18')](),path[_0xd340('0x17')](_0x2a1cda[_0xd340('0x12')])));}})});router['post']('/',upload[_0xd340('0x19')](_0xd340('0x1a')),controller['upload']);router['post']('/webhook',controller[_0xd340('0x1b')]);router['put'](_0xd340('0xd'),auth[_0xd340('0x8')](),controller[_0xd340('0x1c')]);router[_0xd340('0x1d')](_0xd340('0xd'),auth[_0xd340('0x8')](),controller[_0xd340('0x1d')]);module[_0xd340('0x1e')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index b1ddd0f..db519d9 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 _0xeff6=['Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','exports','STRING','ENUM','html','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly','never'];(function(_0x18d5d4,_0x53f71c){var _0x5582a9=function(_0x5893d9){while(--_0x5893d9){_0x18d5d4['push'](_0x18d5d4['shift']());}};_0x5582a9(++_0x53f71c);}(_0xeff6,0x139));var _0x6eff=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xeff6[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');module[_0x6eff('0x0')]={'name':{'type':Sequelize[_0x6eff('0x1')]},'type':{'type':Sequelize[_0x6eff('0x2')](_0x6eff('0x3'),_0x6eff('0x4'))},'description':{'type':Sequelize[_0x6eff('0x5')]},'version':{'type':Sequelize[_0x6eff('0x5')]},'path':{'type':Sequelize[_0x6eff('0x1')],'comment':_0x6eff('0x6')},'active':{'type':Sequelize[_0x6eff('0x7')],'defaultValue':0x0,'comment':_0x6eff('0x8')},'sidebar':{'type':Sequelize[_0x6eff('0x2')](_0x6eff('0x9'),_0x6eff('0xa'),'always',_0x6eff('0xb')),'defaultValue':'always','comment':_0x6eff('0xc')},'icon':{'type':Sequelize[_0x6eff('0x1')]},'adminUrl':{'type':Sequelize[_0x6eff('0x1')]},'agentUrl':{'type':Sequelize[_0x6eff('0x1')]},'scriptName':{'type':Sequelize[_0x6eff('0x1')]},'scriptPath':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x54a4=['STRING','adminOnly','agentOnly','always','never','sequelize','exports','html','script','TEXT'];(function(_0x3d889d,_0x4b153d){var _0x13edaf=function(_0x540b7d){while(--_0x540b7d){_0x3d889d['push'](_0x3d889d['shift']());}};_0x13edaf(++_0x4b153d);}(_0x54a4,0x1db));var _0x454a=function(_0x58b292,_0x5bf4e0){_0x58b292=_0x58b292-0x0;var _0x1c403c=_0x54a4[_0x58b292];return _0x1c403c;};'use strict';var Sequelize=require(_0x454a('0x0'));module[_0x454a('0x1')]={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize['ENUM'](_0x454a('0x2'),_0x454a('0x3'))},'description':{'type':Sequelize[_0x454a('0x4')]},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize[_0x454a('0x5')],'comment':'The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize['ENUM'](_0x454a('0x6'),_0x454a('0x7'),_0x454a('0x8'),_0x454a('0x9')),'defaultValue':'always','comment':'Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'},'icon':{'type':Sequelize[_0x454a('0x5')]},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize[_0x454a('0x5')]},'scriptName':{'type':Sequelize[_0x454a('0x5')]},'scriptPath':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 723b272..4fa87d7 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 _0xca3c=['parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','Invalid\x20manifest:\x20views\x20missing','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','create','role','userProfileId','user','UserProfileSection','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','update','body','delete','destroy','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','hostname','encoding','method','%s%s','headers','content-length','endsWith','statusCode','send','webhookPost','\x27PORT\x27\x20parameter\x20not\x20specified','http://localhost:','content-type','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','extract-zip','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','end','json','offset','limit','status','set','Content-Range','apply','reject','then','Plugins','sendStatus','error','stack','name','Plugin','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','count','includeAll','findAll','rows','catch','show','params','length','include','find','download','format','%s.zip','createWriteStream','zip','warning','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','**/*','root','server/files/plugins','dirname','basename','join','attachments/**/*','finalize','existsSync','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','upload','file','filename','extname','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','some','manifest.json','readFileSync','parse','undefined','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified'];(function(_0x5a7dcc,_0x45f1ad){var _0x351e41=function(_0x1abfb6){while(--_0x1abfb6){_0x5a7dcc['push'](_0x5a7dcc['shift']());}};_0x351e41(++_0x45f1ad);}(_0xca3c,0x199));var _0xcca3=function(_0x55ff7a,_0x22b248){_0x55ff7a=_0x55ff7a-0x0;var _0x65966d=_0xca3c[_0x55ff7a];return _0x65966d;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xcca3('0x0'));var rimraf=require(_0xcca3('0x1'));var zipdir=require(_0xcca3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcca3('0x3'));var moment=require(_0xcca3('0x4'));var BPromise=require(_0xcca3('0x5'));var Mustache=require(_0xcca3('0x6'));var util=require('util');var path=require(_0xcca3('0x7'));var sox=require(_0xcca3('0x8'));var csv=require(_0xcca3('0x9'));var ejs=require(_0xcca3('0xa'));var fs=require('fs');var _=require(_0xcca3('0xb'));var squel=require(_0xcca3('0xc'));var crypto=require(_0xcca3('0xd'));var jsforce=require(_0xcca3('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xcca3('0x9'));var querystring=require(_0xcca3('0xf'));var Papa=require(_0xcca3('0x10'));var extract=require(_0xcca3('0x11'));var rimraf=require(_0xcca3('0x1'));var archiver=require(_0xcca3('0x12'));var Redis=require(_0xcca3('0x13'));var authService=require(_0xcca3('0x14'));var qs=require(_0xcca3('0x15'));var as=require(_0xcca3('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcca3('0x17'))(_0xcca3('0x18'));var utils=require(_0xcca3('0x19'));var config=require('../../config/environment');var db=require(_0xcca3('0x1a'))['db'];config[_0xcca3('0x1b')]=_[_0xcca3('0x1c')](config[_0xcca3('0x1b')],{'host':_0xcca3('0x1d'),'port':0x18eb});var socket=require(_0xcca3('0x1e'))(new Redis(config['redis']));require(_0xcca3('0x1f'))[_0xcca3('0x20')](socket);function respondWithStatusCode(_0x3c453c,_0x45c36b){_0x45c36b=_0x45c36b||0xcc;return function(_0x363365){if(_0x363365){return _0x3c453c['sendStatus'](_0x45c36b);}return _0x3c453c['status'](_0x45c36b)[_0xcca3('0x21')]();};}function respondWithResult(_0x25d463,_0x20e0a5){_0x20e0a5=_0x20e0a5||0xc8;return function(_0x4a4006){if(_0x4a4006){return _0x25d463['status'](_0x20e0a5)[_0xcca3('0x22')](_0x4a4006);}};}function respondWithFilteredResult(_0x26ae33,_0x30d3af){return function(_0x46f73d){if(_0x46f73d){var _0x1dfd0f=_0x46f73d['count'],_0x3ccce6=_0x30d3af[_0xcca3('0x23')],_0x4483dc=_0x30d3af[_0xcca3('0x23')]+_0x30d3af[_0xcca3('0x24')],_0x36a108;if(_0x4483dc>=_0x1dfd0f){_0x4483dc=_0x1dfd0f;_0x36a108=0xc8;}else{_0x36a108=0xce;}_0x26ae33[_0xcca3('0x25')](_0x36a108);return _0x26ae33[_0xcca3('0x26')](_0xcca3('0x27'),_0x3ccce6+'-'+_0x4483dc+'/'+_0x1dfd0f)['json'](_0x46f73d);}return null;};}function patchUpdates(_0x21fd59){return function(_0x38b58f){try{jsonpatch[_0xcca3('0x28')](_0x38b58f,_0x21fd59,!![]);}catch(_0x28980f){return BPromise[_0xcca3('0x29')](_0x28980f);}return _0x38b58f['save']();};}function saveUpdates(_0x9c0e7b,_0x1e804d){return function(_0x7bc0ba){if(_0x7bc0ba){return _0x7bc0ba['update'](_0x9c0e7b)[_0xcca3('0x2a')](function(_0x5007b7){return _0x5007b7;});}return null;};}function removeEntity(_0x1c2bfc,_0x42eb67){return function(_0x439360){if(_0x439360){return _0x439360['destroy']()[_0xcca3('0x2a')](function(){var _0x10807a=_0x439360['get']({'plain':!![]});var _0x34472d=_0xcca3('0x2b');return db['UserProfileResource']['destroy']({'where':{'type':_0x34472d,'resourceId':_0x10807a['id']}})[_0xcca3('0x2a')](function(){return _0x439360;});})[_0xcca3('0x2a')](function(){_0x1c2bfc[_0xcca3('0x25')](0xcc)[_0xcca3('0x21')]();});}};}function handleEntityNotFound(_0x423984,_0x1c8f3c){return function(_0x400932){if(!_0x400932){_0x423984[_0xcca3('0x2c')](0x194);}return _0x400932;};}function handleError(_0x254a6c,_0x40c9cf){_0x40c9cf=_0x40c9cf||0x1f4;return function(_0x1a1649){logger[_0xcca3('0x2d')](_0x1a1649[_0xcca3('0x2e')]);if(_0x1a1649[_0xcca3('0x2f')]){delete _0x1a1649['name'];}_0x254a6c[_0xcca3('0x25')](_0x40c9cf)['send'](_0x1a1649);};}exports['index']=function(_0x241de4,_0x510e90){var _0x20a2e2={},_0x420785={},_0x558ddd={'count':0x0,'rows':[]};var _0x5dd3a6=_['map'](db[_0xcca3('0x30')]['rawAttributes'],function(_0x440924){return{'name':_0x440924['fieldName'],'type':_0x440924[_0xcca3('0x31')][_0xcca3('0x32')]};});_0x420785[_0xcca3('0x33')]=_[_0xcca3('0x34')](_0x5dd3a6,_0xcca3('0x2f'));_0x420785[_0xcca3('0x35')]=_[_0xcca3('0x36')](_0x241de4[_0xcca3('0x35')]);_0x420785[_0xcca3('0x37')]=_[_0xcca3('0x38')](_0x420785[_0xcca3('0x33')],_0x420785[_0xcca3('0x35')]);_0x20a2e2[_0xcca3('0x39')]=_[_0xcca3('0x38')](_0x420785[_0xcca3('0x33')],qs[_0xcca3('0x3a')](_0x241de4[_0xcca3('0x35')][_0xcca3('0x3a')]));_0x20a2e2[_0xcca3('0x39')]=_0x20a2e2['attributes']['length']?_0x20a2e2[_0xcca3('0x39')]:_0x420785[_0xcca3('0x33')];if(!_0x241de4[_0xcca3('0x35')][_0xcca3('0x3b')](_0xcca3('0x3c'))){_0x20a2e2['limit']=qs[_0xcca3('0x24')](_0x241de4[_0xcca3('0x35')][_0xcca3('0x24')]);_0x20a2e2['offset']=qs[_0xcca3('0x23')](_0x241de4['query'][_0xcca3('0x23')]);}_0x20a2e2[_0xcca3('0x3d')]=qs[_0xcca3('0x3e')](_0x241de4['query'][_0xcca3('0x3e')]);_0x20a2e2['where']=qs[_0xcca3('0x37')](_[_0xcca3('0x3f')](_0x241de4['query'],_0x420785[_0xcca3('0x37')]),_0x5dd3a6);if(_0x241de4[_0xcca3('0x35')][_0xcca3('0x40')]){_0x20a2e2[_0xcca3('0x41')]=_[_0xcca3('0x42')](_0x20a2e2['where'],{'$or':_[_0xcca3('0x34')](_0x5dd3a6,function(_0x3d1436){if(_0x3d1436[_0xcca3('0x31')]!==_0xcca3('0x43')){var _0x3e808a={};_0x3e808a[_0x3d1436[_0xcca3('0x2f')]]={'$like':'%'+_0x241de4[_0xcca3('0x35')][_0xcca3('0x40')]+'%'};return _0x3e808a;}})});}_0x20a2e2=_[_0xcca3('0x42')]({},_0x20a2e2,_0x241de4[_0xcca3('0x44')]);var _0x19b70d={'where':_0x20a2e2[_0xcca3('0x41')]};return db[_0xcca3('0x30')]['count'](_0x19b70d)[_0xcca3('0x2a')](function(_0x380e97){_0x558ddd[_0xcca3('0x45')]=_0x380e97;if(_0x241de4[_0xcca3('0x35')][_0xcca3('0x46')]){_0x20a2e2['include']=[{'all':!![]}];}return db[_0xcca3('0x30')][_0xcca3('0x47')](_0x20a2e2);})[_0xcca3('0x2a')](function(_0x251033){_0x558ddd[_0xcca3('0x48')]=_0x251033;return _0x558ddd;})[_0xcca3('0x2a')](respondWithFilteredResult(_0x510e90,_0x20a2e2))[_0xcca3('0x49')](handleError(_0x510e90,null));};exports[_0xcca3('0x4a')]=function(_0x2c82f7,_0xe4deaa){var _0x1c29be={'raw':!![],'where':{'id':_0x2c82f7[_0xcca3('0x4b')]['id']}},_0x5698c3={};_0x5698c3[_0xcca3('0x33')]=_[_0xcca3('0x36')](db[_0xcca3('0x30')]['rawAttributes']);_0x5698c3[_0xcca3('0x35')]=_[_0xcca3('0x36')](_0x2c82f7[_0xcca3('0x35')]);_0x5698c3['filters']=_[_0xcca3('0x38')](_0x5698c3[_0xcca3('0x33')],_0x5698c3[_0xcca3('0x35')]);_0x1c29be[_0xcca3('0x39')]=_[_0xcca3('0x38')](_0x5698c3[_0xcca3('0x33')],qs[_0xcca3('0x3a')](_0x2c82f7[_0xcca3('0x35')][_0xcca3('0x3a')]));_0x1c29be[_0xcca3('0x39')]=_0x1c29be[_0xcca3('0x39')][_0xcca3('0x4c')]?_0x1c29be[_0xcca3('0x39')]:_0x5698c3[_0xcca3('0x33')];if(_0x2c82f7[_0xcca3('0x35')]['includeAll']){_0x1c29be[_0xcca3('0x4d')]=[{'all':!![]}];}_0x1c29be=_['merge']({},_0x1c29be,_0x2c82f7[_0xcca3('0x44')]);return db['Plugin'][_0xcca3('0x4e')](_0x1c29be)[_0xcca3('0x2a')](handleEntityNotFound(_0xe4deaa,null))[_0xcca3('0x2a')](respondWithResult(_0xe4deaa,null))['catch'](handleError(_0xe4deaa,null));};exports[_0xcca3('0x4f')]=function(_0x52949b,_0x104c61,_0xd2a572){return db[_0xcca3('0x30')][_0xcca3('0x4e')]({'where':{'id':_0x52949b[_0xcca3('0x4b')]['id']},'attributes':['name','path'],'raw':!![]})[_0xcca3('0x2a')](handleEntityNotFound(_0x104c61,null))[_0xcca3('0x2a')](function(_0x22eab2){if(_0x22eab2){var _0x3c07d3=path['join'](config['root'],'server/files/plugins',util[_0xcca3('0x50')](_0xcca3('0x51'),path['basename'](_0x22eab2[_0xcca3('0x7')])));var _0x404cec=fs[_0xcca3('0x52')](_0x3c07d3);var _0x1236f3=archiver(_0xcca3('0x53'),{'zlib':{'level':0x9}});_0x1236f3['on'](_0xcca3('0x54'),function(_0x25df7a){if(_0x25df7a['code']==='ENOENT'){logger[_0xcca3('0x2d')](_0x25df7a);}else{throw new db[(_0xcca3('0x55'))][(_0xcca3('0x56'))](_0xcca3('0x57'));}});_0x1236f3['on'](_0xcca3('0x2d'),function(_0x1a6a9c){throw new db[(_0xcca3('0x55'))]['Error'](_0xcca3('0x57'));});_0x1236f3[_0xcca3('0x58')](_0x404cec);_0x1236f3[_0xcca3('0x59')](_0xcca3('0x5a'),{'cwd':path['join'](config[_0xcca3('0x5b')],_0xcca3('0x5c'),path[_0xcca3('0x5d')](_0x22eab2[_0xcca3('0x7')])),'ignore':[path['join'](path[_0xcca3('0x5e')](_0x22eab2['path']),'node_modules/**/*'),path[_0xcca3('0x5f')](path[_0xcca3('0x5e')](_0x22eab2[_0xcca3('0x7')]),_0xcca3('0x60'))],'nodir':!![]})[_0xcca3('0x61')]();_0x404cec['on']('close',function(){if(!fs[_0xcca3('0x62')](_0x3c07d3)){throw new db[(_0xcca3('0x55'))]['Error']('Plugin\x20not\x20found');}return _0x104c61[_0xcca3('0x4f')](_0x3c07d3,util[_0xcca3('0x50')](_0xcca3('0x51'),path[_0xcca3('0x5e')](_0x22eab2['path'])),function(_0x3ee5ac){if(_0x3ee5ac){throw new db[(_0xcca3('0x55'))][(_0xcca3('0x56'))](_0xcca3('0x63'));}fs[_0xcca3('0x64')](_0x3c07d3);logger[_0xcca3('0x65')](_0xcca3('0x66'));logger['info'](_0xcca3('0x67'));});});}return null;})[_0xcca3('0x49')](handleError(_0x104c61,null));};exports[_0xcca3('0x68')]=function(_0x52d5cb,_0x55355d,_0x29a03e){var _0x3e0dd4=path[_0xcca3('0x5e')](_0x52d5cb[_0xcca3('0x69')][_0xcca3('0x6a')],path[_0xcca3('0x6b')](_0x52d5cb[_0xcca3('0x69')][_0xcca3('0x6a')]));var _0x1d9beb=path[_0xcca3('0x5f')](config[_0xcca3('0x5b')],'server/files/plugins',_0x52d5cb['file'][_0xcca3('0x6a')]);var _0x2a5337=path['join'](config[_0xcca3('0x5b')],_0xcca3('0x5c'),_0x3e0dd4);logger[_0xcca3('0x65')]('Plugin\x20upload\x20filepath:\x20%s',_0x1d9beb);logger[_0xcca3('0x65')](_0xcca3('0x6c'),_0x2a5337);try{fs[_0xcca3('0x6d')](_0x1d9beb,parseInt(_0xcca3('0x6e'),0x8));extract(_0x1d9beb,{'dir':_0x2a5337},function(_0x4f376d){if(_0x4f376d){logger[_0xcca3('0x2d')](_0x4f376d);handleError(_0x4f376d,!![]);};var _0x288a6f=fs[_0xcca3('0x6f')](_0x2a5337);if(_0x288a6f[_0xcca3('0x4c')]>0x1){removeReferences(_0x1d9beb,_0x2a5337);logger[_0xcca3('0x2d')](_0xcca3('0x70'));return _0x29a03e(new Error(_0xcca3('0x70')));}var _0x4b1e16=fs[_0xcca3('0x71')](path[_0xcca3('0x5f')](_0x2a5337,_0x288a6f[0x0]));if(_0x4b1e16[_0xcca3('0x72')]()){removeReferences(_0x1d9beb,_0x2a5337);logger[_0xcca3('0x2d')](_0xcca3('0x70'));return _0x29a03e(new Error('Invalid\x20plugin\x20structure'));}if(_0x4b1e16[_0xcca3('0x73')]()){var _0x280a36=fs[_0xcca3('0x6f')](path[_0xcca3('0x5f')](_0x2a5337,_0x288a6f[0x0]));if(_0x280a36[_0xcca3('0x4c')]===0x0){removeReferences(_0x1d9beb,_0x2a5337);logger[_0xcca3('0x2d')](_0xcca3('0x70'));return _0x29a03e(new Error(_0xcca3('0x70')));}var _0x5e7610=_0x280a36[_0xcca3('0x74')](function(_0x4b0234){return _0x4b0234===_0xcca3('0x75');});if(!_0x5e7610){return _0x29a03e(new Error('Plugin\x20manifest\x20missing'));}var _0x9d1f85=fs[_0xcca3('0x76')](path['join'](_0x2a5337,_0x288a6f[0x0],'manifest.json'));var _0x3d5efa=JSON[_0xcca3('0x77')](_0x9d1f85);if(_0xcca3('0x78')==typeof _0x3d5efa['name']){return _0x29a03e(new Error(_0xcca3('0x79')));}if(_0xcca3('0x78')==typeof _0x3d5efa[_0xcca3('0x31')]){return _0x29a03e(new Error(_0xcca3('0x7a')));}if(_0xcca3('0x78')==typeof _0x3d5efa[_0xcca3('0x7b')]){return _0x29a03e(new Error(_0xcca3('0x7c')));}if(_0xcca3('0x78')==typeof _0x3d5efa[_0xcca3('0x7d')]){return _0x29a03e(new Error(_0xcca3('0x7e')));}if(_0x3d5efa[_0xcca3('0x31')]===_0xcca3('0x7f')){if(_0xcca3('0x78')==typeof _0x3d5efa[_0xcca3('0x7d')][_0xcca3('0x80')]){return _0x29a03e(new Error(_0xcca3('0x81')));}if(_0xcca3('0x78')==typeof _0x3d5efa[_0xcca3('0x7d')][_0xcca3('0x80')][_0xcca3('0x82')]&&_0xcca3('0x78')==typeof _0x3d5efa['parameters']['views'][_0xcca3('0x83')]){return _0x29a03e(new Error(_0xcca3('0x84')));}}else if(_0x3d5efa[_0xcca3('0x31')]===_0xcca3('0x85')){if('undefined'==typeof _0x3d5efa[_0xcca3('0x7d')][_0xcca3('0x86')]){return _0x29a03e(new Error(_0xcca3('0x87')));}if(_0xcca3('0x78')==typeof _0x3d5efa[_0xcca3('0x7d')][_0xcca3('0x88')]){return _0x29a03e(new Error(_0xcca3('0x89')));}}else{return _0x29a03e(new Error(_0xcca3('0x8a')));}var _0x1abcd7=_0x3d5efa[_0xcca3('0x2f')];var _0x378a51=_0x3d5efa[_0xcca3('0x8b')];var _0x460c4e=_0x3d5efa[_0xcca3('0x31')];var _0x2ec668=_0x3d5efa[_0xcca3('0x8c')]?_0x3d5efa['sidebar']:_0xcca3('0x8d');var _0x4caaa1=_0x3d5efa[_0xcca3('0x8e')]?_0x3d5efa['icon']:_0xcca3('0x8f');var _0x5d1794='';var _0x4ec1f5='';var _0x879b0e='';var _0x2c8d69='';var _0x519afe=_0x3d5efa[_0xcca3('0x7b')];if(_0x460c4e===_0xcca3('0x7f')){if(_0xcca3('0x78')!=typeof _0x3d5efa['parameters'][_0xcca3('0x80')][_0xcca3('0x82')]){var _0x425c2b=_0x3d5efa[_0xcca3('0x7d')][_0xcca3('0x80')][_0xcca3('0x82')];if(!/^(f|ht)tps?:\/\//i[_0xcca3('0x90')](_0x425c2b)){_0x5d1794=path[_0xcca3('0x5f')](_0xcca3('0x91'),_0x3e0dd4,_0x288a6f[0x0],_0x425c2b);}else{_0x5d1794=_0x425c2b;}}else{logger[_0xcca3('0x65')](_0xcca3('0x92'));}if(_0xcca3('0x78')!=typeof _0x3d5efa[_0xcca3('0x7d')][_0xcca3('0x80')]['agent']){var _0x41c1f9=_0x3d5efa[_0xcca3('0x7d')]['views'][_0xcca3('0x83')];if(!/^(f|ht)tps?:\/\//i[_0xcca3('0x90')](_0x41c1f9)){_0x4ec1f5=path[_0xcca3('0x5f')](_0xcca3('0x91'),_0x3e0dd4,_0x288a6f[0x0],_0x41c1f9);}else{_0x4ec1f5=_0x41c1f9;}}else{logger[_0xcca3('0x65')](_0xcca3('0x93'));}}else if(_0x460c4e===_0xcca3('0x85')){_0x879b0e=_0x3d5efa[_0xcca3('0x7d')]['scriptName'];_0x2c8d69=_0x3d5efa[_0xcca3('0x7d')][_0xcca3('0x88')];if('undefined'!=typeof _0x3d5efa['parameters'][_0xcca3('0x80')]){if(_0xcca3('0x78')!=typeof _0x3d5efa[_0xcca3('0x7d')]['views'][_0xcca3('0x82')]){var _0x425c2b=_0x3d5efa['parameters'][_0xcca3('0x80')][_0xcca3('0x82')];if(!/^(f|ht)tps?:\/\//i[_0xcca3('0x90')](_0x425c2b)){_0x5d1794=path[_0xcca3('0x5f')](_0xcca3('0x91'),_0x3e0dd4,_0x288a6f[0x0],_0x425c2b);}else{_0x5d1794=_0x425c2b;}}if(_0xcca3('0x78')!=typeof _0x3d5efa['parameters'][_0xcca3('0x80')][_0xcca3('0x83')]){var _0x41c1f9=_0x3d5efa[_0xcca3('0x7d')][_0xcca3('0x80')][_0xcca3('0x83')];if(!/^(f|ht)tps?:\/\//i[_0xcca3('0x90')](_0x41c1f9)){_0x4ec1f5=path['join']('plugins',_0x3e0dd4,_0x288a6f[0x0],_0x41c1f9);}else{_0x4ec1f5=_0x41c1f9;}}}}var _0x13a662={'name':_0x1abcd7,'description':_0x378a51,'path':path[_0xcca3('0x5f')](_0x3e0dd4,_0x288a6f[0x0]),'type':_0x460c4e,'sidebar':_0x2ec668,'icon':_0x4caaa1,'adminUrl':_0x5d1794,'agentUrl':_0x4ec1f5,'scriptName':_0x879b0e,'scriptPath':_0x2c8d69,'version':_0x519afe};removeReferences(_0x1d9beb,null);return db[_0xcca3('0x30')][_0xcca3('0x94')](_0x13a662)[_0xcca3('0x2a')](function(_0x91f2ab){var _0x1cbee4={'role':_0x52d5cb['body'][_0xcca3('0x95')],'userProfileId':_0x52d5cb['body'][_0xcca3('0x96')]};if(!_0x1cbee4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1cbee4[_0xcca3('0x95')]===_0xcca3('0x97')){var _0x3b9ded=_0x91f2ab['get']({'plain':!![]});return db[_0xcca3('0x98')]['find']({'where':{'name':_0xcca3('0x2b'),'userProfileId':_0x1cbee4[_0xcca3('0x96')]},'raw':!![]})['then'](function(_0x306e63){if(_0x306e63&&_0x306e63['autoAssociation']===0x0){return db[_0xcca3('0x99')][_0xcca3('0x94')]({'name':_0x3b9ded[_0xcca3('0x2f')],'resourceId':_0x3b9ded['id'],'type':_0x306e63['name'],'sectionId':_0x306e63['id']},{})[_0xcca3('0x2a')](function(){return _0x91f2ab;});}else{return _0x91f2ab;}})[_0xcca3('0x49')](function(_0x35bc1c){logger[_0xcca3('0x2d')](_0xcca3('0x9a'),_0x35bc1c);throw _0x35bc1c;});}return _0x91f2ab;})['then'](respondWithResult(_0x55355d,null))[_0xcca3('0x49')](handleError(_0x55355d,null));}});}catch(_0x5374a2){_0x55355d[_0xcca3('0x25')](0x1f4)['send'](_0x5374a2);}};function removeReferences(_0xdc2e07,_0x59e7d6){try{if(_0xdc2e07){fs['unlinkSync'](_0xdc2e07);logger[_0xcca3('0x65')](_0xcca3('0x9b'));}if(_0x59e7d6){rimraf(_0x59e7d6,function(){});logger[_0xcca3('0x65')](_0xcca3('0x9c'));}}catch(_0x56d991){logger['error'](_0x56d991);}}exports[_0xcca3('0x9d')]=function(_0x4a1fec,_0x1dd466,_0x51bb4e){return db[_0xcca3('0x30')][_0xcca3('0x4e')]({'where':{'id':_0x4a1fec[_0xcca3('0x4b')]['id']}})[_0xcca3('0x2a')](handleEntityNotFound(_0x1dd466,null))[_0xcca3('0x2a')](saveUpdates(_0x4a1fec[_0xcca3('0x9e')],null))[_0xcca3('0x2a')](respondWithResult(_0x1dd466,null))['catch'](handleError(_0x1dd466,null));};exports[_0xcca3('0x9f')]=function(_0x4ab604,_0x3eb390,_0xf7406c){return db[_0xcca3('0x30')][_0xcca3('0x4e')]({'where':{'id':_0x4ab604[_0xcca3('0x4b')]['id']}})[_0xcca3('0x2a')](function(_0x50e706){if(_0x50e706){return _0x50e706[_0xcca3('0xa0')]();}})[_0xcca3('0x2a')](function(_0x5c3ef5){rimraf(path[_0xcca3('0x5f')](config[_0xcca3('0x5b')],_0xcca3('0x5c'),path[_0xcca3('0x5d')](_0x5c3ef5['path'])),function(){});return _0x5c3ef5;})[_0xcca3('0x2a')](handleEntityNotFound(_0x3eb390,null))[_0xcca3('0x2a')](respondWithStatusCode(_0x3eb390,null))[_0xcca3('0x49')](handleError(_0x3eb390,null));};exports[_0xcca3('0xa1')]=function(_0x4b8097,_0x169912,_0x344c6e){return BPromise[_0xcca3('0xa2')]()['then'](function(){if(!_0x4b8097[_0xcca3('0x35')][_0xcca3('0x7')]){throw new Error(_0xcca3('0xa3'));}if(!_0x4b8097[_0xcca3('0x35')][_0xcca3('0xa4')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x46ccc1=_0x4b8097['query'][_0xcca3('0xa5')]?_0x4b8097[_0xcca3('0x35')][_0xcca3('0xa5')]+':'+_0x4b8097[_0xcca3('0x35')][_0xcca3('0xa4')]:'http://localhost:'+_0x4b8097[_0xcca3('0x35')][_0xcca3('0xa4')];var _0x1c8af9=_0x4b8097[_0xcca3('0x35')][_0xcca3('0x22')]?_0x4b8097[_0xcca3('0x35')][_0xcca3('0x22')]:!![];var _0x518f9f=_0x4b8097['query'][_0xcca3('0xa6')]?_0x4b8097[_0xcca3('0x35')][_0xcca3('0xa6')]:null;var _0x1b60f3={'method':_0x4b8097[_0xcca3('0xa7')],'uri':util[_0xcca3('0x50')](_0xcca3('0xa8'),_0x46ccc1,_0x4b8097[_0xcca3('0x35')]['path']),'json':_0x1c8af9,'resolveWithFullResponse':!![],'encoding':_0x518f9f,'qs':_0x4b8097[_0xcca3('0x35')]};if(_0x4b8097[_0xcca3('0xa9')]){_0x1b60f3[_0xcca3('0xa9')]=_0x4b8097[_0xcca3('0xa9')];if(_0x1b60f3['headers'][_0xcca3('0xaa')]){delete _0x1b60f3['headers'][_0xcca3('0xaa')];}}if(_0x1b60f3[_0xcca3('0xa9')]['content-type']){delete _0x1b60f3['headers']['content-type'];}return rp(_0x1b60f3);})['then'](function(_0x5af249){if(_0x5af249){_0x169912[_0xcca3('0x26')](_0x5af249[_0xcca3('0xa9')]);logger[_0xcca3('0x65')](_0x5af249[_0xcca3('0x9e')]);if(_[_0xcca3('0xab')](_0x4b8097[_0xcca3('0x35')][_0xcca3('0x7')],_0xcca3('0x4f'))&&_0x5af249['statusCode']==0x1f4){return _0x169912[_0xcca3('0x2c')](_0x5af249[_0xcca3('0xac')]);}else{return _0x169912[_0xcca3('0x25')](_0x5af249[_0xcca3('0xac')])[_0xcca3('0xad')](_0x5af249[_0xcca3('0x9e')]);}}else{return _0x169912[_0xcca3('0x2c')](0xc8);}})[_0xcca3('0x49')](handleError(_0x169912,null));};exports[_0xcca3('0xae')]=function(_0x3ccda5,_0x4c35d0,_0x127577){return BPromise[_0xcca3('0xa2')]()[_0xcca3('0x2a')](function(){if(!_0x3ccda5[_0xcca3('0x35')]['path']){throw new Error(_0xcca3('0xa3'));}if(!_0x3ccda5[_0xcca3('0x35')]['port']){throw new Error(_0xcca3('0xaf'));}var _0x5e1b9f=_0x3ccda5['query']['hostname']?_0x3ccda5[_0xcca3('0x35')]['hostname']+':'+_0x3ccda5[_0xcca3('0x35')][_0xcca3('0xa4')]:_0xcca3('0xb0')+_0x3ccda5[_0xcca3('0x35')][_0xcca3('0xa4')];var _0x163d2b=_0x3ccda5[_0xcca3('0x35')][_0xcca3('0x22')]?_0x3ccda5[_0xcca3('0x35')][_0xcca3('0x22')]:!![];var _0x395a93=_0x3ccda5['query'][_0xcca3('0xa6')]?_0x3ccda5[_0xcca3('0x35')][_0xcca3('0xa6')]:null;var _0x3ee043={'method':_0x3ccda5[_0xcca3('0xa7')],'uri':util[_0xcca3('0x50')]('%s%s',_0x5e1b9f,_0x3ccda5[_0xcca3('0x35')][_0xcca3('0x7')]),'json':_0x163d2b,'resolveWithFullResponse':!![],'encoding':_0x395a93,'body':_0x3ccda5[_0xcca3('0x9e')]};if(_0x3ccda5[_0xcca3('0xa9')]){_0x3ee043[_0xcca3('0xa9')]=_0x3ccda5[_0xcca3('0xa9')];if(_0x3ee043['headers'][_0xcca3('0xaa')]){delete _0x3ee043['headers']['content-length'];}}if(_0x3ee043[_0xcca3('0xa9')][_0xcca3('0xb1')]){delete _0x3ee043[_0xcca3('0xa9')][_0xcca3('0xb1')];}return rp(_0x3ee043);})[_0xcca3('0x2a')](function(_0x51a7fa){if(_0x51a7fa){_0x4c35d0[_0xcca3('0x26')](_0x51a7fa['headers']);logger[_0xcca3('0x65')](_0x51a7fa[_0xcca3('0x9e')]);return _0x4c35d0[_0xcca3('0x25')](_0x51a7fa[_0xcca3('0xac')])['send'](_0x51a7fa[_0xcca3('0x9e')]);}else{return _0x4c35d0[_0xcca3('0x2c')](0xc8);}})[_0xcca3('0x49')](handleError(_0x4c35d0,null));}; \ No newline at end of file +var _0x2123=['register','sendStatus','status','json','count','offset','limit','apply','reject','save','update','then','get','Plugins','error','name','send','rawAttributes','fieldName','type','key','map','query','keys','filters','model','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','Plugin','includeAll','include','findAll','show','params','intersection','length','options','find','catch','join','root','server/files/plugins','format','%s.zip','basename','zip','warning','code','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','dirname','node_modules/**/*','attachments/**/*','finalize','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','info','Download\x20completed','Temporary\x20file\x20removed','filename','extname','file','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','readdirSync','lstatSync','Invalid\x20plugin\x20structure','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','undefined','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','html','views','agent','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','admin','test','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','plugins','create','body','role','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','destroy','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','%s%s','headers','content-length','content-type','set','endsWith','download','statusCode','webhookPost','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','jsforce','papaparse','extract-zip','archiver','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./plugin.socket'];(function(_0x1ad4a6,_0x5242f0){var _0x4f44fd=function(_0x4e82a0){while(--_0x4e82a0){_0x1ad4a6['push'](_0x1ad4a6['shift']());}};_0x4f44fd(++_0x5242f0);}(_0x2123,0x8c));var _0x3212=function(_0x263d7c,_0x333f2f){_0x263d7c=_0x263d7c-0x0;var _0xec45e0=_0x2123[_0x263d7c];return _0xec45e0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x3212('0x0'));var rimraf=require(_0x3212('0x1'));var zipdir=require(_0x3212('0x2'));var jsonpatch=require(_0x3212('0x3'));var rp=require(_0x3212('0x4'));var moment=require(_0x3212('0x5'));var BPromise=require(_0x3212('0x6'));var Mustache=require(_0x3212('0x7'));var util=require(_0x3212('0x8'));var path=require(_0x3212('0x9'));var sox=require(_0x3212('0xa'));var csv=require(_0x3212('0xb'));var ejs=require(_0x3212('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0x3212('0xd'));var crypto=require('crypto');var jsforce=require(_0x3212('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x3212('0xb'));var querystring=require('querystring');var Papa=require(_0x3212('0xf'));var extract=require(_0x3212('0x10'));var rimraf=require('rimraf');var archiver=require(_0x3212('0x11'));var Redis=require('ioredis');var authService=require(_0x3212('0x12'));var qs=require(_0x3212('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3212('0x14'));var logger=require(_0x3212('0x15'))(_0x3212('0x16'));var utils=require(_0x3212('0x17'));var config=require(_0x3212('0x18'));var db=require(_0x3212('0x19'))['db'];config[_0x3212('0x1a')]=_[_0x3212('0x1b')](config['redis'],{'host':_0x3212('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3212('0x1a')]));require(_0x3212('0x1d'))[_0x3212('0x1e')](socket);function respondWithStatusCode(_0x1f0b31,_0x4365d9){_0x4365d9=_0x4365d9||0xcc;return function(_0xaa4847){if(_0xaa4847){return _0x1f0b31[_0x3212('0x1f')](_0x4365d9);}return _0x1f0b31['status'](_0x4365d9)['end']();};}function respondWithResult(_0x232470,_0x19b459){_0x19b459=_0x19b459||0xc8;return function(_0x495cdf){if(_0x495cdf){return _0x232470[_0x3212('0x20')](_0x19b459)[_0x3212('0x21')](_0x495cdf);}};}function respondWithFilteredResult(_0x3b380b,_0x35f9eb){return function(_0x3a1598){if(_0x3a1598){var _0x2b7d30=_0x3a1598[_0x3212('0x22')],_0x52ac0d=_0x35f9eb[_0x3212('0x23')],_0x1c4b4f=_0x35f9eb[_0x3212('0x23')]+_0x35f9eb[_0x3212('0x24')],_0x27a2cf;if(_0x1c4b4f>=_0x2b7d30){_0x1c4b4f=_0x2b7d30;_0x27a2cf=0xc8;}else{_0x27a2cf=0xce;}_0x3b380b[_0x3212('0x20')](_0x27a2cf);return _0x3b380b['set']('Content-Range',_0x52ac0d+'-'+_0x1c4b4f+'/'+_0x2b7d30)[_0x3212('0x21')](_0x3a1598);}return null;};}function patchUpdates(_0x25cbc5){return function(_0x47c7c6){try{jsonpatch[_0x3212('0x25')](_0x47c7c6,_0x25cbc5,!![]);}catch(_0x569e85){return BPromise[_0x3212('0x26')](_0x569e85);}return _0x47c7c6[_0x3212('0x27')]();};}function saveUpdates(_0x255aa9,_0x9d88a4){return function(_0x141a45){if(_0x141a45){return _0x141a45[_0x3212('0x28')](_0x255aa9)[_0x3212('0x29')](function(_0x1407a8){return _0x1407a8;});}return null;};}function removeEntity(_0x275a6b,_0x506764){return function(_0x25b235){if(_0x25b235){return _0x25b235['destroy']()['then'](function(){var _0x12bc8b=_0x25b235[_0x3212('0x2a')]({'plain':!![]});var _0x1566a1=_0x3212('0x2b');return db['UserProfileResource']['destroy']({'where':{'type':_0x1566a1,'resourceId':_0x12bc8b['id']}})[_0x3212('0x29')](function(){return _0x25b235;});})[_0x3212('0x29')](function(){_0x275a6b[_0x3212('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1e8783,_0x3635d0){return function(_0x388855){if(!_0x388855){_0x1e8783[_0x3212('0x1f')](0x194);}return _0x388855;};}function handleError(_0x478c27,_0x2db398){_0x2db398=_0x2db398||0x1f4;return function(_0xfd44ae){logger[_0x3212('0x2c')](_0xfd44ae['stack']);if(_0xfd44ae['name']){delete _0xfd44ae[_0x3212('0x2d')];}_0x478c27['status'](_0x2db398)[_0x3212('0x2e')](_0xfd44ae);};}exports['index']=function(_0x3696c2,_0x4fcee3){var _0x3ba27e={},_0x30d7a0={},_0x350eab={'count':0x0,'rows':[]};var _0x5e6ed6=_['map'](db['Plugin'][_0x3212('0x2f')],function(_0x5c69d7){return{'name':_0x5c69d7[_0x3212('0x30')],'type':_0x5c69d7[_0x3212('0x31')][_0x3212('0x32')]};});_0x30d7a0['model']=_[_0x3212('0x33')](_0x5e6ed6,_0x3212('0x2d'));_0x30d7a0[_0x3212('0x34')]=_[_0x3212('0x35')](_0x3696c2[_0x3212('0x34')]);_0x30d7a0[_0x3212('0x36')]=_['intersection'](_0x30d7a0['model'],_0x30d7a0[_0x3212('0x34')]);_0x3ba27e['attributes']=_['intersection'](_0x30d7a0[_0x3212('0x37')],qs[_0x3212('0x38')](_0x3696c2[_0x3212('0x34')][_0x3212('0x38')]));_0x3ba27e[_0x3212('0x39')]=_0x3ba27e['attributes']['length']?_0x3ba27e['attributes']:_0x30d7a0[_0x3212('0x37')];if(!_0x3696c2[_0x3212('0x34')][_0x3212('0x3a')]('nolimit')){_0x3ba27e[_0x3212('0x24')]=qs[_0x3212('0x24')](_0x3696c2['query'][_0x3212('0x24')]);_0x3ba27e[_0x3212('0x23')]=qs[_0x3212('0x23')](_0x3696c2[_0x3212('0x34')][_0x3212('0x23')]);}_0x3ba27e[_0x3212('0x3b')]=qs[_0x3212('0x3c')](_0x3696c2[_0x3212('0x34')][_0x3212('0x3c')]);_0x3ba27e[_0x3212('0x3d')]=qs[_0x3212('0x36')](_[_0x3212('0x3e')](_0x3696c2['query'],_0x30d7a0[_0x3212('0x36')]),_0x5e6ed6);if(_0x3696c2['query'][_0x3212('0x3f')]){_0x3ba27e[_0x3212('0x3d')]=_[_0x3212('0x40')](_0x3ba27e['where'],{'$or':_['map'](_0x5e6ed6,function(_0x55ea17){if(_0x55ea17[_0x3212('0x31')]!==_0x3212('0x41')){var _0x4f975a={};_0x4f975a[_0x55ea17[_0x3212('0x2d')]]={'$like':'%'+_0x3696c2[_0x3212('0x34')][_0x3212('0x3f')]+'%'};return _0x4f975a;}})});}_0x3ba27e=_['merge']({},_0x3ba27e,_0x3696c2['options']);var _0x5810a4={'where':_0x3ba27e['where']};return db[_0x3212('0x42')][_0x3212('0x22')](_0x5810a4)[_0x3212('0x29')](function(_0x280cd1){_0x350eab[_0x3212('0x22')]=_0x280cd1;if(_0x3696c2[_0x3212('0x34')][_0x3212('0x43')]){_0x3ba27e[_0x3212('0x44')]=[{'all':!![]}];}return db[_0x3212('0x42')][_0x3212('0x45')](_0x3ba27e);})[_0x3212('0x29')](function(_0x12ce9c){_0x350eab['rows']=_0x12ce9c;return _0x350eab;})[_0x3212('0x29')](respondWithFilteredResult(_0x4fcee3,_0x3ba27e))['catch'](handleError(_0x4fcee3,null));};exports[_0x3212('0x46')]=function(_0xf31e56,_0x5f2319){var _0x5bebb5={'raw':!![],'where':{'id':_0xf31e56[_0x3212('0x47')]['id']}},_0x4250e4={};_0x4250e4[_0x3212('0x37')]=_[_0x3212('0x35')](db[_0x3212('0x42')][_0x3212('0x2f')]);_0x4250e4[_0x3212('0x34')]=_[_0x3212('0x35')](_0xf31e56[_0x3212('0x34')]);_0x4250e4[_0x3212('0x36')]=_[_0x3212('0x48')](_0x4250e4[_0x3212('0x37')],_0x4250e4['query']);_0x5bebb5[_0x3212('0x39')]=_['intersection'](_0x4250e4[_0x3212('0x37')],qs[_0x3212('0x38')](_0xf31e56['query'][_0x3212('0x38')]));_0x5bebb5[_0x3212('0x39')]=_0x5bebb5['attributes'][_0x3212('0x49')]?_0x5bebb5[_0x3212('0x39')]:_0x4250e4[_0x3212('0x37')];if(_0xf31e56[_0x3212('0x34')][_0x3212('0x43')]){_0x5bebb5[_0x3212('0x44')]=[{'all':!![]}];}_0x5bebb5=_[_0x3212('0x40')]({},_0x5bebb5,_0xf31e56[_0x3212('0x4a')]);return db['Plugin'][_0x3212('0x4b')](_0x5bebb5)['then'](handleEntityNotFound(_0x5f2319,null))[_0x3212('0x29')](respondWithResult(_0x5f2319,null))[_0x3212('0x4c')](handleError(_0x5f2319,null));};exports['download']=function(_0x400d4d,_0x71fafe,_0x841726){return db[_0x3212('0x42')][_0x3212('0x4b')]({'where':{'id':_0x400d4d[_0x3212('0x47')]['id']},'attributes':[_0x3212('0x2d'),_0x3212('0x9')],'raw':!![]})[_0x3212('0x29')](handleEntityNotFound(_0x71fafe,null))['then'](function(_0x29b425){if(_0x29b425){var _0x7fb641=path[_0x3212('0x4d')](config[_0x3212('0x4e')],_0x3212('0x4f'),util[_0x3212('0x50')](_0x3212('0x51'),path[_0x3212('0x52')](_0x29b425[_0x3212('0x9')])));var _0xf277ac=fs['createWriteStream'](_0x7fb641);var _0x2279d2=archiver(_0x3212('0x53'),{'zlib':{'level':0x9}});_0x2279d2['on'](_0x3212('0x54'),function(_0x5ea179){if(_0x5ea179[_0x3212('0x55')]==='ENOENT'){logger[_0x3212('0x2c')](_0x5ea179);}else{throw new db[(_0x3212('0x56'))][(_0x3212('0x57'))](_0x3212('0x58'));}});_0x2279d2['on'](_0x3212('0x2c'),function(_0x4eba69){throw new db[(_0x3212('0x56'))][(_0x3212('0x57'))](_0x3212('0x58'));});_0x2279d2[_0x3212('0x59')](_0xf277ac);_0x2279d2[_0x3212('0x5a')]('**/*',{'cwd':path[_0x3212('0x4d')](config[_0x3212('0x4e')],_0x3212('0x4f'),path[_0x3212('0x5b')](_0x29b425[_0x3212('0x9')])),'ignore':[path[_0x3212('0x4d')](path['basename'](_0x29b425['path']),_0x3212('0x5c')),path[_0x3212('0x4d')](path[_0x3212('0x52')](_0x29b425['path']),_0x3212('0x5d'))],'nodir':!![]})[_0x3212('0x5e')]();_0xf277ac['on']('close',function(){if(!fs['existsSync'](_0x7fb641)){throw new db[(_0x3212('0x56'))][(_0x3212('0x57'))](_0x3212('0x5f'));}return _0x71fafe['download'](_0x7fb641,util['format'](_0x3212('0x51'),path[_0x3212('0x52')](_0x29b425[_0x3212('0x9')])),function(_0x19cc07){if(_0x19cc07){throw new db[(_0x3212('0x56'))][(_0x3212('0x57'))](_0x3212('0x60'));}fs['unlinkSync'](_0x7fb641);logger[_0x3212('0x61')](_0x3212('0x62'));logger[_0x3212('0x61')](_0x3212('0x63'));});});}return null;})[_0x3212('0x4c')](handleError(_0x71fafe,null));};exports['upload']=function(_0x22a0fe,_0x258a28,_0x47971f){var _0x1f7ff9=path[_0x3212('0x52')](_0x22a0fe['file'][_0x3212('0x64')],path[_0x3212('0x65')](_0x22a0fe[_0x3212('0x66')][_0x3212('0x64')]));var _0xd60edd=path[_0x3212('0x4d')](config[_0x3212('0x4e')],_0x3212('0x4f'),_0x22a0fe['file'][_0x3212('0x64')]);var _0x336260=path['join'](config[_0x3212('0x4e')],_0x3212('0x4f'),_0x1f7ff9);logger[_0x3212('0x61')](_0x3212('0x67'),_0xd60edd);logger['info'](_0x3212('0x68'),_0x336260);try{fs['chmodSync'](_0xd60edd,parseInt('0777',0x8));extract(_0xd60edd,{'dir':_0x336260},function(_0x1be89d){if(_0x1be89d){logger[_0x3212('0x2c')](_0x1be89d);handleError(_0x1be89d,!![]);};var _0x4e8c6c=fs[_0x3212('0x69')](_0x336260);if(_0x4e8c6c[_0x3212('0x49')]>0x1){removeReferences(_0xd60edd,_0x336260);logger[_0x3212('0x2c')]('Invalid\x20plugin\x20structure');return _0x47971f(new Error('Invalid\x20plugin\x20structure'));}var _0x43b6f1=fs[_0x3212('0x6a')](path[_0x3212('0x4d')](_0x336260,_0x4e8c6c[0x0]));if(_0x43b6f1['isFile']()){removeReferences(_0xd60edd,_0x336260);logger[_0x3212('0x2c')]('Invalid\x20plugin\x20structure');return _0x47971f(new Error(_0x3212('0x6b')));}if(_0x43b6f1[_0x3212('0x6c')]()){var _0x2329ac=fs[_0x3212('0x69')](path[_0x3212('0x4d')](_0x336260,_0x4e8c6c[0x0]));if(_0x2329ac['length']===0x0){removeReferences(_0xd60edd,_0x336260);logger[_0x3212('0x2c')](_0x3212('0x6b'));return _0x47971f(new Error(_0x3212('0x6b')));}var _0x4dc619=_0x2329ac[_0x3212('0x6d')](function(_0x2534de){return _0x2534de===_0x3212('0x6e');});if(!_0x4dc619){return _0x47971f(new Error(_0x3212('0x6f')));}var _0x5a3933=fs[_0x3212('0x70')](path['join'](_0x336260,_0x4e8c6c[0x0],_0x3212('0x6e')));var _0x725fc5=JSON[_0x3212('0x71')](_0x5a3933);if(_0x3212('0x72')==typeof _0x725fc5['name']){return _0x47971f(new Error(_0x3212('0x73')));}if(_0x3212('0x72')==typeof _0x725fc5[_0x3212('0x31')]){return _0x47971f(new Error(_0x3212('0x74')));}if(_0x3212('0x72')==typeof _0x725fc5[_0x3212('0x75')]){return _0x47971f(new Error(_0x3212('0x76')));}if(_0x3212('0x72')==typeof _0x725fc5[_0x3212('0x77')]){return _0x47971f(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x725fc5[_0x3212('0x31')]===_0x3212('0x78')){if(_0x3212('0x72')==typeof _0x725fc5[_0x3212('0x77')][_0x3212('0x79')]){return _0x47971f(new Error('Invalid\x20manifest:\x20views\x20missing'));}if(_0x3212('0x72')==typeof _0x725fc5['parameters'][_0x3212('0x79')]['admin']&&_0x3212('0x72')==typeof _0x725fc5[_0x3212('0x77')][_0x3212('0x79')][_0x3212('0x7a')]){return _0x47971f(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x725fc5[_0x3212('0x31')]===_0x3212('0x7b')){if(_0x3212('0x72')==typeof _0x725fc5[_0x3212('0x77')][_0x3212('0x7c')]){return _0x47971f(new Error(_0x3212('0x7d')));}if(_0x3212('0x72')==typeof _0x725fc5[_0x3212('0x77')][_0x3212('0x7e')]){return _0x47971f(new Error(_0x3212('0x7f')));}}else{return _0x47971f(new Error(_0x3212('0x80')));}var _0x57d6dc=_0x725fc5['name'];var _0x52a57a=_0x725fc5[_0x3212('0x81')];var _0x4c3193=_0x725fc5['type'];var _0x28bc2d=_0x725fc5[_0x3212('0x82')]?_0x725fc5['sidebar']:_0x3212('0x83');var _0x2b829a=_0x725fc5[_0x3212('0x84')]?_0x725fc5[_0x3212('0x84')]:_0x3212('0x85');var _0x1eb502='';var _0x89cff6='';var _0x333c1a='';var _0x4ca952='';var _0x5197d6=_0x725fc5[_0x3212('0x75')];if(_0x4c3193===_0x3212('0x78')){if(_0x3212('0x72')!=typeof _0x725fc5['parameters'][_0x3212('0x79')]['admin']){var _0x20b56c=_0x725fc5[_0x3212('0x77')]['views'][_0x3212('0x86')];if(!/^(f|ht)tps?:\/\//i[_0x3212('0x87')](_0x20b56c)){_0x1eb502=path[_0x3212('0x4d')]('plugins',_0x1f7ff9,_0x4e8c6c[0x0],_0x20b56c);}else{_0x1eb502=_0x20b56c;}}else{logger[_0x3212('0x61')](_0x3212('0x88'));}if(_0x3212('0x72')!=typeof _0x725fc5[_0x3212('0x77')][_0x3212('0x79')][_0x3212('0x7a')]){var _0x56ad44=_0x725fc5[_0x3212('0x77')][_0x3212('0x79')][_0x3212('0x7a')];if(!/^(f|ht)tps?:\/\//i[_0x3212('0x87')](_0x56ad44)){_0x89cff6=path[_0x3212('0x4d')]('plugins',_0x1f7ff9,_0x4e8c6c[0x0],_0x56ad44);}else{_0x89cff6=_0x56ad44;}}else{logger[_0x3212('0x61')](_0x3212('0x89'));}}else if(_0x4c3193===_0x3212('0x7b')){_0x333c1a=_0x725fc5[_0x3212('0x77')][_0x3212('0x7c')];_0x4ca952=_0x725fc5[_0x3212('0x77')]['scriptPath'];if(_0x3212('0x72')!=typeof _0x725fc5[_0x3212('0x77')][_0x3212('0x79')]){if(_0x3212('0x72')!=typeof _0x725fc5[_0x3212('0x77')][_0x3212('0x79')][_0x3212('0x86')]){var _0x20b56c=_0x725fc5['parameters'][_0x3212('0x79')][_0x3212('0x86')];if(!/^(f|ht)tps?:\/\//i[_0x3212('0x87')](_0x20b56c)){_0x1eb502=path[_0x3212('0x4d')](_0x3212('0x8a'),_0x1f7ff9,_0x4e8c6c[0x0],_0x20b56c);}else{_0x1eb502=_0x20b56c;}}if(_0x3212('0x72')!=typeof _0x725fc5[_0x3212('0x77')][_0x3212('0x79')]['agent']){var _0x56ad44=_0x725fc5[_0x3212('0x77')][_0x3212('0x79')][_0x3212('0x7a')];if(!/^(f|ht)tps?:\/\//i[_0x3212('0x87')](_0x56ad44)){_0x89cff6=path[_0x3212('0x4d')](_0x3212('0x8a'),_0x1f7ff9,_0x4e8c6c[0x0],_0x56ad44);}else{_0x89cff6=_0x56ad44;}}}}var _0x4fcb03={'name':_0x57d6dc,'description':_0x52a57a,'path':path[_0x3212('0x4d')](_0x1f7ff9,_0x4e8c6c[0x0]),'type':_0x4c3193,'sidebar':_0x28bc2d,'icon':_0x2b829a,'adminUrl':_0x1eb502,'agentUrl':_0x89cff6,'scriptName':_0x333c1a,'scriptPath':_0x4ca952,'version':_0x5197d6};removeReferences(_0xd60edd,null);return db[_0x3212('0x42')][_0x3212('0x8b')](_0x4fcb03)[_0x3212('0x29')](function(_0x331902){var _0x58f226={'role':_0x22a0fe[_0x3212('0x8c')][_0x3212('0x8d')],'userProfileId':_0x22a0fe[_0x3212('0x8c')]['userProfileId']};if(!_0x58f226)throw new Error(_0x3212('0x8e'));if(_0x58f226[_0x3212('0x8d')]===_0x3212('0x8f')){var _0x8d0bcc=_0x331902[_0x3212('0x2a')]({'plain':!![]});return db[_0x3212('0x90')][_0x3212('0x4b')]({'where':{'name':'Plugins','userProfileId':_0x58f226[_0x3212('0x91')]},'raw':!![]})[_0x3212('0x29')](function(_0x4379c5){if(_0x4379c5&&_0x4379c5[_0x3212('0x92')]===0x0){return db[_0x3212('0x93')][_0x3212('0x8b')]({'name':_0x8d0bcc[_0x3212('0x2d')],'resourceId':_0x8d0bcc['id'],'type':_0x4379c5[_0x3212('0x2d')],'sectionId':_0x4379c5['id']},{})[_0x3212('0x29')](function(){return _0x331902;});}else{return _0x331902;}})[_0x3212('0x4c')](function(_0xb98aed){logger[_0x3212('0x2c')](_0x3212('0x94'),_0xb98aed);throw _0xb98aed;});}return _0x331902;})[_0x3212('0x29')](respondWithResult(_0x258a28,null))[_0x3212('0x4c')](handleError(_0x258a28,null));}});}catch(_0x50978e){_0x258a28['status'](0x1f4)[_0x3212('0x2e')](_0x50978e);}};function removeReferences(_0x34271a,_0x483b09){try{if(_0x34271a){fs['unlinkSync'](_0x34271a);logger[_0x3212('0x61')](_0x3212('0x95'));}if(_0x483b09){rimraf(_0x483b09,function(){});logger[_0x3212('0x61')](_0x3212('0x96'));}}catch(_0x2e0acc){logger[_0x3212('0x2c')](_0x2e0acc);}}exports[_0x3212('0x28')]=function(_0x5e8045,_0x3e488e,_0x5a0fa7){return db[_0x3212('0x42')][_0x3212('0x4b')]({'where':{'id':_0x5e8045[_0x3212('0x47')]['id']}})[_0x3212('0x29')](handleEntityNotFound(_0x3e488e,null))[_0x3212('0x29')](saveUpdates(_0x5e8045[_0x3212('0x8c')],null))['then'](respondWithResult(_0x3e488e,null))[_0x3212('0x4c')](handleError(_0x3e488e,null));};exports[_0x3212('0x97')]=function(_0x5d25ec,_0x55a3c3,_0x3fb920){return db[_0x3212('0x42')][_0x3212('0x4b')]({'where':{'id':_0x5d25ec[_0x3212('0x47')]['id']}})[_0x3212('0x29')](function(_0x21b796){if(_0x21b796){return _0x21b796[_0x3212('0x98')]();}})[_0x3212('0x29')](function(_0x53f214){rimraf(path[_0x3212('0x4d')](config[_0x3212('0x4e')],_0x3212('0x4f'),path[_0x3212('0x5b')](_0x53f214[_0x3212('0x9')])),function(){});return _0x53f214;})[_0x3212('0x29')](handleEntityNotFound(_0x55a3c3,null))[_0x3212('0x29')](respondWithStatusCode(_0x55a3c3,null))[_0x3212('0x4c')](handleError(_0x55a3c3,null));};exports[_0x3212('0x99')]=function(_0x130b54,_0x1e5dc9,_0x3e4ded){return BPromise[_0x3212('0x9a')]()[_0x3212('0x29')](function(){if(!_0x130b54[_0x3212('0x34')]['path']){throw new Error(_0x3212('0x9b'));}if(!_0x130b54[_0x3212('0x34')][_0x3212('0x9c')]){throw new Error(_0x3212('0x9d'));}var _0x236a80=_0x130b54[_0x3212('0x34')][_0x3212('0x9e')]?_0x130b54[_0x3212('0x34')][_0x3212('0x9e')]+':'+_0x130b54[_0x3212('0x34')]['port']:_0x3212('0x9f')+_0x130b54[_0x3212('0x34')]['port'];var _0x47c88c=_0x130b54[_0x3212('0x34')][_0x3212('0x21')]?_0x130b54[_0x3212('0x34')][_0x3212('0x21')]:!![];var _0x308897=_0x130b54[_0x3212('0x34')][_0x3212('0xa0')]?_0x130b54[_0x3212('0x34')][_0x3212('0xa0')]:null;var _0x54dba8={'method':_0x130b54['method'],'uri':util[_0x3212('0x50')](_0x3212('0xa1'),_0x236a80,_0x130b54['query'][_0x3212('0x9')]),'json':_0x47c88c,'resolveWithFullResponse':!![],'encoding':_0x308897,'qs':_0x130b54[_0x3212('0x34')]};if(_0x130b54[_0x3212('0xa2')]){_0x54dba8['headers']=_0x130b54[_0x3212('0xa2')];if(_0x54dba8['headers'][_0x3212('0xa3')]){delete _0x54dba8[_0x3212('0xa2')]['content-length'];}}if(_0x54dba8[_0x3212('0xa2')][_0x3212('0xa4')]){delete _0x54dba8['headers'][_0x3212('0xa4')];}return rp(_0x54dba8);})[_0x3212('0x29')](function(_0x59db20){if(_0x59db20){_0x1e5dc9[_0x3212('0xa5')](_0x59db20[_0x3212('0xa2')]);logger[_0x3212('0x61')](_0x59db20['body']);if(_[_0x3212('0xa6')](_0x130b54[_0x3212('0x34')][_0x3212('0x9')],_0x3212('0xa7'))&&_0x59db20[_0x3212('0xa8')]==0x1f4){return _0x1e5dc9[_0x3212('0x1f')](_0x59db20[_0x3212('0xa8')]);}else{return _0x1e5dc9[_0x3212('0x20')](_0x59db20['statusCode'])[_0x3212('0x2e')](_0x59db20[_0x3212('0x8c')]);}}else{return _0x1e5dc9[_0x3212('0x1f')](0xc8);}})[_0x3212('0x4c')](handleError(_0x1e5dc9,null));};exports[_0x3212('0xa9')]=function(_0x267b7e,_0x119223,_0x4d68ac){return BPromise[_0x3212('0x9a')]()['then'](function(){if(!_0x267b7e[_0x3212('0x34')][_0x3212('0x9')]){throw new Error(_0x3212('0x9b'));}if(!_0x267b7e[_0x3212('0x34')][_0x3212('0x9c')]){throw new Error(_0x3212('0x9d'));}var _0x565950=_0x267b7e[_0x3212('0x34')][_0x3212('0x9e')]?_0x267b7e[_0x3212('0x34')][_0x3212('0x9e')]+':'+_0x267b7e[_0x3212('0x34')][_0x3212('0x9c')]:_0x3212('0x9f')+_0x267b7e[_0x3212('0x34')][_0x3212('0x9c')];var _0x3773c4=_0x267b7e[_0x3212('0x34')][_0x3212('0x21')]?_0x267b7e[_0x3212('0x34')][_0x3212('0x21')]:!![];var _0x12ca36=_0x267b7e[_0x3212('0x34')][_0x3212('0xa0')]?_0x267b7e['query'][_0x3212('0xa0')]:null;var _0x1745f0={'method':_0x267b7e['method'],'uri':util[_0x3212('0x50')]('%s%s',_0x565950,_0x267b7e[_0x3212('0x34')][_0x3212('0x9')]),'json':_0x3773c4,'resolveWithFullResponse':!![],'encoding':_0x12ca36,'body':_0x267b7e['body']};if(_0x267b7e[_0x3212('0xa2')]){_0x1745f0[_0x3212('0xa2')]=_0x267b7e['headers'];if(_0x1745f0[_0x3212('0xa2')][_0x3212('0xa3')]){delete _0x1745f0[_0x3212('0xa2')][_0x3212('0xa3')];}}if(_0x1745f0[_0x3212('0xa2')]['content-type']){delete _0x1745f0[_0x3212('0xa2')][_0x3212('0xa4')];}return rp(_0x1745f0);})['then'](function(_0x10fb88){if(_0x10fb88){_0x119223[_0x3212('0xa5')](_0x10fb88[_0x3212('0xa2')]);logger[_0x3212('0x61')](_0x10fb88[_0x3212('0x8c')]);return _0x119223[_0x3212('0x20')](_0x10fb88[_0x3212('0xa8')])[_0x3212('0x2e')](_0x10fb88['body']);}else{return _0x119223[_0x3212('0x1f')](0xc8);}})[_0x3212('0x4c')](handleError(_0x119223,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 3ca4ab7..6e4b678 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 _0x4888=['emit','hasOwnProperty','hook','../../mysqldb','Plugin','setMaxListeners','save','update','remove'];(function(_0x342b4c,_0x381e5d){var _0x4aa2dc=function(_0x22c3d1){while(--_0x22c3d1){_0x342b4c['push'](_0x342b4c['shift']());}};_0x4aa2dc(++_0x381e5d);}(_0x4888,0x198));var _0x8488=function(_0x10a1ac,_0x25f5b0){_0x10a1ac=_0x10a1ac-0x0;var _0x45b99e=_0x4888[_0x10a1ac];return _0x45b99e;};'use strict';var EventEmitter=require('events');var Plugin=require(_0x8488('0x0'))['db'][_0x8488('0x1')];var PluginEvents=new EventEmitter();PluginEvents[_0x8488('0x2')](0x0);var events={'afterCreate':_0x8488('0x3'),'afterUpdate':_0x8488('0x4'),'afterDestroy':_0x8488('0x5')};function emitEvent(_0x19e51d){return function(_0x571e4b,_0x267093,_0xf45c3f){PluginEvents[_0x8488('0x6')](_0x19e51d+':'+_0x571e4b['id'],_0x571e4b);PluginEvents[_0x8488('0x6')](_0x19e51d,_0x571e4b);_0xf45c3f(null);};}for(var e in events){if(events[_0x8488('0x7')](e)){var event=events[e];Plugin[_0x8488('0x8')](e,emitEvent(event));}}module['exports']=PluginEvents; \ No newline at end of file +var _0x4b17=['Plugin','save','update','emit','hasOwnProperty','hook','exports','events'];(function(_0xddac5b,_0x477892){var _0x47fd76=function(_0x1fe841){while(--_0x1fe841){_0xddac5b['push'](_0xddac5b['shift']());}};_0x47fd76(++_0x477892);}(_0x4b17,0x10f));var _0x74b1=function(_0x5a8aa3,_0x2294d5){_0x5a8aa3=_0x5a8aa3-0x0;var _0x5d0458=_0x4b17[_0x5a8aa3];return _0x5d0458;};'use strict';var EventEmitter=require(_0x74b1('0x0'));var Plugin=require('../../mysqldb')['db'][_0x74b1('0x1')];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x74b1('0x2'),'afterUpdate':_0x74b1('0x3'),'afterDestroy':'remove'};function emitEvent(_0x17689a){return function(_0x4f206f,_0x4fdea2,_0x7b3c36){PluginEvents[_0x74b1('0x4')](_0x17689a+':'+_0x4f206f['id'],_0x4f206f);PluginEvents[_0x74b1('0x4')](_0x17689a,_0x4f206f);_0x7b3c36(null);};}for(var e in events){if(events[_0x74b1('0x5')](e)){var event=events[e];Plugin[_0x74b1('0x6')](e,emitEvent(event));}}module[_0x74b1('0x7')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index eb6987d..c94d1ec 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 _0x9c5a=['define','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports'];(function(_0x2b9d62,_0x4be267){var _0x34e95e=function(_0x5ee21d){while(--_0x5ee21d){_0x2b9d62['push'](_0x2b9d62['shift']());}};_0x34e95e(++_0x4be267);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x5a07a1,_0x573582){_0x5a07a1=_0x5a07a1-0x0;var _0x362ac2=_0x9c5a[_0x5a07a1];return _0x362ac2;};'use strict';var _=require(_0xa9c5('0x0'));var util=require(_0xa9c5('0x1'));var logger=require('../../config/logger')(_0xa9c5('0x2'));var moment=require(_0xa9c5('0x3'));var BPromise=require(_0xa9c5('0x4'));var rp=require(_0xa9c5('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa9c5('0x6'));var config=require(_0xa9c5('0x7'));var attributes=require('./plugin.attributes');module[_0xa9c5('0x8')]=function(_0x4d9c7a,_0x394d84){return _0x4d9c7a[_0xa9c5('0x9')]('Plugin',attributes,{'tableName':'plugins','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x17ba=['define','Plugin','plugins','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./plugin.attributes','exports'];(function(_0x1b1322,_0x14d6a1){var _0x53d7dc=function(_0x8f3088){while(--_0x8f3088){_0x1b1322['push'](_0x1b1322['shift']());}};_0x53d7dc(++_0x14d6a1);}(_0x17ba,0xab));var _0xa17b=function(_0x50d38e,_0x2b2def){_0x50d38e=_0x50d38e-0x0;var _0x1c8739=_0x17ba[_0x50d38e];return _0x1c8739;};'use strict';var _=require(_0xa17b('0x0'));var util=require(_0xa17b('0x1'));var logger=require('../../config/logger')(_0xa17b('0x2'));var moment=require(_0xa17b('0x3'));var BPromise=require(_0xa17b('0x4'));var rp=require(_0xa17b('0x5'));var fs=require('fs');var path=require(_0xa17b('0x6'));var rimraf=require(_0xa17b('0x7'));var config=require(_0xa17b('0x8'));var attributes=require(_0xa17b('0x9'));module[_0xa17b('0xa')]=function(_0x3cced2,_0xf72ed4){return _0x3cced2[_0xa17b('0xb')](_0xa17b('0xc'),attributes,{'tableName':_0xa17b('0xd'),'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 51fc9fa..8413597 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 _0x2ea8=['ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','socket.io-emitter','./plugin.socket','request','info','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','Plugin,\x20%s,\x20%s','message','request\x20sent','result','catch','CreatePlugin','Plugin','create','body','options','raw','then','lodash','util','moment','bluebird','randomstring'];(function(_0x31ac36,_0x29cad6){var _0x2d7552=function(_0x519ec0){while(--_0x519ec0){_0x31ac36['push'](_0x31ac36['shift']());}};_0x2d7552(++_0x29cad6);}(_0x2ea8,0x7f));var _0x82ea=function(_0x410b26,_0x2d8194){_0x410b26=_0x410b26-0x0;var _0x39d86d=_0x2ea8[_0x410b26];return _0x39d86d;};'use strict';var _=require(_0x82ea('0x0'));var util=require(_0x82ea('0x1'));var moment=require(_0x82ea('0x2'));var BPromise=require(_0x82ea('0x3'));var rs=require(_0x82ea('0x4'));var fs=require('fs');var Redis=require(_0x82ea('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x82ea('0x6'))(_0x82ea('0x7'));var config=require(_0x82ea('0x8'));var jayson=require(_0x82ea('0x9'));var client=jayson[_0x82ea('0xa')]['http']({'port':0x232a});config[_0x82ea('0xb')]=_['defaults'](config[_0x82ea('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x82ea('0xc'))(new Redis(config[_0x82ea('0xb')]));require(_0x82ea('0xd'))['register'](socket);function respondWithRpcPromise(_0x1cef75,_0x491ee8,_0x24ea4e){return new BPromise(function(_0x48ecb8,_0x496583){return client[_0x82ea('0xe')](_0x1cef75,_0x24ea4e)['then'](function(_0x4163a7){logger[_0x82ea('0xf')]('Plugin,\x20%s,\x20%s',_0x491ee8,'request\x20sent');logger[_0x82ea('0x10')](_0x82ea('0x11'),_0x491ee8,'request\x20sent',JSON[_0x82ea('0x12')](_0x4163a7));if(_0x4163a7[_0x82ea('0x13')]){if(_0x4163a7['error'][_0x82ea('0x14')]===0x1f4){logger[_0x82ea('0x13')](_0x82ea('0x15'),_0x491ee8,_0x4163a7[_0x82ea('0x13')]['message']);return _0x496583(_0x4163a7[_0x82ea('0x13')]['message']);}logger[_0x82ea('0x13')](_0x82ea('0x15'),_0x491ee8,_0x4163a7['error'][_0x82ea('0x16')]);return _0x48ecb8(_0x4163a7[_0x82ea('0x13')][_0x82ea('0x16')]);}else{logger[_0x82ea('0xf')]('Plugin,\x20%s,\x20%s',_0x491ee8,_0x82ea('0x17'));_0x48ecb8(_0x4163a7[_0x82ea('0x18')]['message']);}})[_0x82ea('0x19')](function(_0x41c6af){logger['error']('Plugin,\x20%s,\x20%s',_0x491ee8,_0x41c6af);_0x496583(_0x41c6af);});});}exports[_0x82ea('0x1a')]=function(_0x3d12a7){var _0x167cec=this;return new Promise(function(_0x2b4dfd,_0x136199){return db[_0x82ea('0x1b')][_0x82ea('0x1c')](_0x3d12a7[_0x82ea('0x1d')],{'raw':_0x3d12a7['options']?_0x3d12a7[_0x82ea('0x1e')][_0x82ea('0x1f')]===undefined?!![]:![]:!![]})[_0x82ea('0x20')](function(_0x248956){logger[_0x82ea('0xf')](_0x82ea('0x1a'),_0x3d12a7);logger[_0x82ea('0x10')]('CreatePlugin',_0x3d12a7,JSON[_0x82ea('0x12')](_0x248956));_0x2b4dfd(_0x248956);})[_0x82ea('0x19')](function(_0x51e9b5){logger['error'](_0x82ea('0x1a'),_0x51e9b5[_0x82ea('0x16')],_0x3d12a7);_0x136199(_0x167cec[_0x82ea('0x13')](0x1f4,_0x51e9b5['message']));});});}; \ No newline at end of file +var _0x52ee=['catch','CreatePlugin','Plugin','create','body','stringify','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','register','then','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','error','message','result'];(function(_0x318840,_0x561b1e){var _0x223da4=function(_0x510071){while(--_0x510071){_0x318840['push'](_0x318840['shift']());}};_0x223da4(++_0x561b1e);}(_0x52ee,0x1c8));var _0xe52e=function(_0x5aaf95,_0x5e8f9b){_0x5aaf95=_0x5aaf95-0x0;var _0x1eb0c5=_0x52ee[_0x5aaf95];return _0x1eb0c5;};'use strict';var _=require(_0xe52e('0x0'));var util=require('util');var moment=require(_0xe52e('0x1'));var BPromise=require(_0xe52e('0x2'));var rs=require(_0xe52e('0x3'));var fs=require('fs');var Redis=require(_0xe52e('0x4'));var db=require(_0xe52e('0x5'))['db'];var utils=require(_0xe52e('0x6'));var logger=require(_0xe52e('0x7'))('rpc');var config=require(_0xe52e('0x8'));var jayson=require(_0xe52e('0x9'));var client=jayson[_0xe52e('0xa')]['http']({'port':0x232a});config[_0xe52e('0xb')]=_[_0xe52e('0xc')](config[_0xe52e('0xb')],{'host':_0xe52e('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./plugin.socket')[_0xe52e('0xe')](socket);function respondWithRpcPromise(_0xcb86bd,_0x1c79d9,_0x50b7bf){return new BPromise(function(_0x316ea8,_0x3b13f0){return client['request'](_0xcb86bd,_0x50b7bf)[_0xe52e('0xf')](function(_0x2c5e98){logger[_0xe52e('0x10')](_0xe52e('0x11'),_0x1c79d9,_0xe52e('0x12'));logger[_0xe52e('0x13')](_0xe52e('0x14'),_0x1c79d9,'request\x20sent',JSON['stringify'](_0x2c5e98));if(_0x2c5e98[_0xe52e('0x15')]){if(_0x2c5e98[_0xe52e('0x15')]['code']===0x1f4){logger[_0xe52e('0x15')](_0xe52e('0x11'),_0x1c79d9,_0x2c5e98[_0xe52e('0x15')][_0xe52e('0x16')]);return _0x3b13f0(_0x2c5e98[_0xe52e('0x15')][_0xe52e('0x16')]);}logger['error']('Plugin,\x20%s,\x20%s',_0x1c79d9,_0x2c5e98['error'][_0xe52e('0x16')]);return _0x316ea8(_0x2c5e98[_0xe52e('0x15')][_0xe52e('0x16')]);}else{logger[_0xe52e('0x10')]('Plugin,\x20%s,\x20%s',_0x1c79d9,_0xe52e('0x12'));_0x316ea8(_0x2c5e98[_0xe52e('0x17')][_0xe52e('0x16')]);}})[_0xe52e('0x18')](function(_0x24a1a0){logger['error'](_0xe52e('0x11'),_0x1c79d9,_0x24a1a0);_0x3b13f0(_0x24a1a0);});});}exports[_0xe52e('0x19')]=function(_0x46ebf4){var _0x14c4c3=this;return new Promise(function(_0x12ba51,_0x4b6c92){return db[_0xe52e('0x1a')][_0xe52e('0x1b')](_0x46ebf4[_0xe52e('0x1c')],{'raw':_0x46ebf4['options']?_0x46ebf4['options']['raw']===undefined?!![]:![]:!![]})[_0xe52e('0xf')](function(_0x2ca54d){logger[_0xe52e('0x10')]('CreatePlugin',_0x46ebf4);logger['debug'](_0xe52e('0x19'),_0x46ebf4,JSON[_0xe52e('0x1d')](_0x2ca54d));_0x12ba51(_0x2ca54d);})[_0xe52e('0x18')](function(_0x25e522){logger[_0xe52e('0x15')](_0xe52e('0x19'),_0x25e522['message'],_0x46ebf4);_0x4b6c92(_0x14c4c3[_0xe52e('0x15')](0x1f4,_0x25e522[_0xe52e('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index c8e9c57..c1dc7a4 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 _0xeb3f=['./plugin.events','save','remove','update','emit','removeListener','register','plugin:'];(function(_0x201155,_0x465fe2){var _0x4fe9a8=function(_0x11fa93){while(--_0x11fa93){_0x201155['push'](_0x201155['shift']());}};_0x4fe9a8(++_0x465fe2);}(_0xeb3f,0xa8));var _0xfeb3=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xeb3f[_0x502c7d];return _0x30b7ed;};'use strict';var PluginEvents=require(_0xfeb3('0x0'));var events=[_0xfeb3('0x1'),_0xfeb3('0x2'),_0xfeb3('0x3')];function createListener(_0x35e554,_0x48b70c){return function(_0x2c0229){_0x48b70c[_0xfeb3('0x4')](_0x35e554,_0x2c0229);};}function removeListener(_0x1f27f4,_0x125a2f){return function(){PluginEvents[_0xfeb3('0x5')](_0x1f27f4,_0x125a2f);};}exports[_0xfeb3('0x6')]=function(_0x455738){for(var _0x10fa12=0x0,_0x38379c=events['length'];_0x10fa12<_0x38379c;_0x10fa12++){var _0x20dfc4=events[_0x10fa12];var _0x1a4e9c=createListener(_0xfeb3('0x7')+_0x20dfc4,_0x455738);PluginEvents['on'](_0x20dfc4,_0x1a4e9c);}}; \ No newline at end of file +var _0x3f74=['plugin:','./plugin.events','save','remove','update','emit','removeListener','length'];(function(_0x421703,_0x329bb4){var _0x5cafe3=function(_0x240d8f){while(--_0x240d8f){_0x421703['push'](_0x421703['shift']());}};_0x5cafe3(++_0x329bb4);}(_0x3f74,0x121));var _0x43f7=function(_0x46d7bf,_0x5f3216){_0x46d7bf=_0x46d7bf-0x0;var _0x39cd22=_0x3f74[_0x46d7bf];return _0x39cd22;};'use strict';var PluginEvents=require(_0x43f7('0x0'));var events=[_0x43f7('0x1'),_0x43f7('0x2'),_0x43f7('0x3')];function createListener(_0x20bda0,_0x90cc42){return function(_0x19286c){_0x90cc42[_0x43f7('0x4')](_0x20bda0,_0x19286c);};}function removeListener(_0x591452,_0x1f5e13){return function(){PluginEvents[_0x43f7('0x5')](_0x591452,_0x1f5e13);};}exports['register']=function(_0x4fa0e1){for(var _0x37e991=0x0,_0x4f64a6=events[_0x43f7('0x6')];_0x37e991<_0x4f64a6;_0x37e991++){var _0x574b8a=events[_0x37e991];var _0x115f89=createListener(_0x43f7('0x7')+_0x574b8a,_0x4fa0e1);PluginEvents['on'](_0x574b8a,_0x115f89);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 6aa9ecc..a5da3cd 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 _0xe235=['update','delete','exports','express','Router','./pm2.controller','get','isAuthenticated','index','/:id','show','post','create','put'];(function(_0x5b2592,_0xe9ed0a){var _0xfb2545=function(_0x1928a6){while(--_0x1928a6){_0x5b2592['push'](_0x5b2592['shift']());}};_0xfb2545(++_0xe9ed0a);}(_0xe235,0x199));var _0x5e23=function(_0x5a0c37,_0x3aaa26){_0x5a0c37=_0x5a0c37-0x0;var _0x42d188=_0xe235[_0x5a0c37];return _0x42d188;};'use strict';var express=require(_0x5e23('0x0'));var router=express[_0x5e23('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x5e23('0x2'));router[_0x5e23('0x3')]('/',auth[_0x5e23('0x4')](),controller[_0x5e23('0x5')]);router[_0x5e23('0x3')](_0x5e23('0x6'),auth['isAuthenticated'](),controller[_0x5e23('0x7')]);router[_0x5e23('0x8')]('/',auth[_0x5e23('0x4')](),controller[_0x5e23('0x9')]);router[_0x5e23('0xa')](_0x5e23('0x6'),auth[_0x5e23('0x4')](),controller[_0x5e23('0xb')]);router[_0x5e23('0xc')](_0x5e23('0x6'),auth[_0x5e23('0x4')](),controller['destroy']);module[_0x5e23('0xd')]=router; \ No newline at end of file +var _0xffd0=['exports','Router','../../components/auth/service','./pm2.controller','isAuthenticated','index','get','/:id','put','update','delete','destroy'];(function(_0x4314d7,_0x355218){var _0x5c599b=function(_0x556354){while(--_0x556354){_0x4314d7['push'](_0x4314d7['shift']());}};_0x5c599b(++_0x355218);}(_0xffd0,0x1b1));var _0x0ffd=function(_0x4da734,_0x54268b){_0x4da734=_0x4da734-0x0;var _0x49b915=_0xffd0[_0x4da734];return _0x49b915;};'use strict';var express=require('express');var router=express[_0x0ffd('0x0')]();var auth=require(_0x0ffd('0x1'));var controller=require(_0x0ffd('0x2'));router['get']('/',auth[_0x0ffd('0x3')](),controller[_0x0ffd('0x4')]);router[_0x0ffd('0x5')](_0x0ffd('0x6'),auth[_0x0ffd('0x3')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x0ffd('0x7')](_0x0ffd('0x6'),auth[_0x0ffd('0x3')](),controller[_0x0ffd('0x8')]);router[_0x0ffd('0x9')](_0x0ffd('0x6'),auth[_0x0ffd('0x3')](),controller[_0x0ffd('0xa')]);module[_0x0ffd('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 936fa89..c5866fc 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 _0xa5ff=['exec','bluebird','sendStatus','status','json','stack','name','send','npm\x20install','info','error','reject','length','then','show','catch','create','body','../../files/plugins','cwd','chdir','start','dump','update','hasOwnProperty','Unknown\x20status','destroy','params','delete','Unknown\x20id','../../config/pm2','../../config/logger','path','child_process'];(function(_0xc91b77,_0x2dd955){var _0x155aed=function(_0x116de5){while(--_0x116de5){_0xc91b77['push'](_0xc91b77['shift']());}};_0x155aed(++_0x2dd955);}(_0xa5ff,0xa6));var _0xfa5f=function(_0x5b6a6a,_0x193a87){_0x5b6a6a=_0x5b6a6a-0x0;var _0x3b3fc5=_0xa5ff[_0x5b6a6a];return _0x3b3fc5;};'use strict';var _=require('lodash');var pm2=require(_0xfa5f('0x0'));var logger=require(_0xfa5f('0x1'))('api');var path=require(_0xfa5f('0x2'));var exec=require(_0xfa5f('0x3'))[_0xfa5f('0x4')];var BPromise=require(_0xfa5f('0x5'));function handleEntityNotFound(_0x5b7b00,_0x4b247d){return function(_0x284fda){if(!_0x284fda){_0x5b7b00[_0xfa5f('0x6')](0x194);;}return _0x284fda;};}function respondWithResult(_0x330eda,_0x2e2ffb){_0x2e2ffb=_0x2e2ffb||0xc8;return function(_0x182016){if(_0x182016){return _0x330eda[_0xfa5f('0x7')](_0x2e2ffb)[_0xfa5f('0x8')](_0x182016);}return null;};}function handleError(_0x344253,_0x5ad6fc){_0x5ad6fc=_0x5ad6fc||0x1f4;return function(_0x590e14){logger['error'](_0x590e14[_0xfa5f('0x9')]);if(_0x590e14['name']){delete _0x590e14[_0xfa5f('0xa')];}_0x344253[_0xfa5f('0x7')](_0x5ad6fc)[_0xfa5f('0xb')](_0x590e14);};}function execChildProcess(){return new BPromise(function(_0x51cb84,_0x10c321){exec(_0xfa5f('0xc'),function(_0x596064,_0x190279,_0x14a071){logger[_0xfa5f('0xd')](_0x190279);logger[_0xfa5f('0xd')](_0x14a071);if(_0x596064){logger[_0xfa5f('0xe')](_0x596064);return _0x10c321(_0x596064);}return _0x51cb84(_0x190279);});});}exports['index']=function(_0x40100a,_0x96b759){return pm2['list']()['then'](function(_0x5bd8ee){if(_0x5bd8ee){var _0x34ae2f=_[_0xfa5f('0xf')](_0x5bd8ee,function(_0xc5891b){return _0xc5891b[_0xfa5f('0xa')]==='express'||_0xc5891b['name']==='motion2';});return{'rows':_0x34ae2f,'count':_0x34ae2f[_0xfa5f('0x10')]};}return null;})[_0xfa5f('0x11')](respondWithResult(_0x96b759,null))['catch'](handleError(_0x96b759,null));};exports[_0xfa5f('0x12')]=function(_0x53a015,_0x130855){return pm2['describe'](_0x53a015['params']['id'])[_0xfa5f('0x11')](respondWithResult(_0x130855,null))[_0xfa5f('0x11')](handleEntityNotFound(_0x130855,null))[_0xfa5f('0x13')](handleError(_0x130855,null));};exports[_0xfa5f('0x14')]=function(_0x1eea9b,_0x1d9166){if(_0x1eea9b[_0xfa5f('0x15')][_0xfa5f('0xa')]&&_0x1eea9b[_0xfa5f('0x15')]['script']){var _0x1c194b=path['join'](__dirname,_0xfa5f('0x16'),_0x1eea9b[_0xfa5f('0x15')]['script']);var _0x37eb0c=process[_0xfa5f('0x17')]();process['chdir'](path['dirname'](_0x1c194b));return execChildProcess()['then'](function(_0x4c1fea){process[_0xfa5f('0x18')](_0x37eb0c);return pm2[_0xfa5f('0x19')]({'name':_0x1eea9b[_0xfa5f('0x15')]['name'],'script':_0x1c194b});})[_0xfa5f('0x11')](function(_0x23be02){pm2[_0xfa5f('0x1a')]();return _0x23be02[0x0];})['then'](respondWithResult(_0x1d9166,0xc9))[_0xfa5f('0x13')](handleError(_0x1d9166,null));}else{return _0x1d9166['status'](0x1f4)[_0xfa5f('0xb')]({'message':'Missing\x20name\x20and/or\x20path'});}};exports[_0xfa5f('0x1b')]=function(_0x3decd2,_0x3ca88c){if(_0x3decd2[_0xfa5f('0x15')]['id']){delete _0x3decd2['body']['id'];}var _0x55ace8={'online':'restart','stopped':'stop'};if(_0x55ace8[_0xfa5f('0x1c')](_0x3decd2['body'][_0xfa5f('0x7')])){return pm2[_0x55ace8[_0x3decd2['body'][_0xfa5f('0x7')]]](_0x3decd2['params']['id'])[_0xfa5f('0x11')](respondWithResult(_0x3ca88c,0xc8))[_0xfa5f('0x13')](handleError(_0x3ca88c,null));}else{return _0x3ca88c[_0xfa5f('0x7')](0x1f4)['send']({'message':_0xfa5f('0x1d')});}};exports[_0xfa5f('0x1e')]=function(_0x33c644,_0x4b189e){if(_0x33c644['body']['id']){delete _0x33c644[_0xfa5f('0x15')]['id'];}if(_0x33c644[_0xfa5f('0x1f')]['id']){return pm2[_0xfa5f('0x20')](_0x33c644[_0xfa5f('0x1f')]['id'])['then'](function(_0x3aa3ad){pm2[_0xfa5f('0x1a')]();return _0x3aa3ad[0x0];})[_0xfa5f('0x11')](respondWithResult(_0x4b189e,null))['catch'](handleError(_0x4b189e,null));}else{return _0x4b189e['status'](0x1f4)[_0xfa5f('0xb')]({'message':_0xfa5f('0x21')});}}; \ No newline at end of file +var _0x9fe9=['stack','name','send','npm\x20install','info','error','index','list','then','express','motion2','length','show','describe','params','catch','create','body','script','../../files/plugins','chdir','dirname','dump','update','restart','stop','hasOwnProperty','Unknown\x20status','destroy','delete','Unknown\x20id','lodash','../../config/pm2','../../config/logger','api','child_process','exec','bluebird','sendStatus','status','json'];(function(_0x493ac0,_0x191aeb){var _0x327a4d=function(_0x19b00c){while(--_0x19b00c){_0x493ac0['push'](_0x493ac0['shift']());}};_0x327a4d(++_0x191aeb);}(_0x9fe9,0x9a));var _0x99fe=function(_0x169fca,_0x4cfa9c){_0x169fca=_0x169fca-0x0;var _0x10ae1a=_0x9fe9[_0x169fca];return _0x10ae1a;};'use strict';var _=require(_0x99fe('0x0'));var pm2=require(_0x99fe('0x1'));var logger=require(_0x99fe('0x2'))(_0x99fe('0x3'));var path=require('path');var exec=require(_0x99fe('0x4'))[_0x99fe('0x5')];var BPromise=require(_0x99fe('0x6'));function handleEntityNotFound(_0x2059b4,_0x53b2db){return function(_0x528307){if(!_0x528307){_0x2059b4[_0x99fe('0x7')](0x194);;}return _0x528307;};}function respondWithResult(_0x4179de,_0x48a2f5){_0x48a2f5=_0x48a2f5||0xc8;return function(_0x2b7b63){if(_0x2b7b63){return _0x4179de[_0x99fe('0x8')](_0x48a2f5)[_0x99fe('0x9')](_0x2b7b63);}return null;};}function handleError(_0x28f52e,_0x13aacf){_0x13aacf=_0x13aacf||0x1f4;return function(_0x511e71){logger['error'](_0x511e71[_0x99fe('0xa')]);if(_0x511e71['name']){delete _0x511e71[_0x99fe('0xb')];}_0x28f52e[_0x99fe('0x8')](_0x13aacf)[_0x99fe('0xc')](_0x511e71);};}function execChildProcess(){return new BPromise(function(_0x402d22,_0x4409bb){exec(_0x99fe('0xd'),function(_0x152ad8,_0x5bf467,_0x1085c3){logger[_0x99fe('0xe')](_0x5bf467);logger['info'](_0x1085c3);if(_0x152ad8){logger[_0x99fe('0xf')](_0x152ad8);return _0x4409bb(_0x152ad8);}return _0x402d22(_0x5bf467);});});}exports[_0x99fe('0x10')]=function(_0x163d0b,_0x4bbb26){return pm2[_0x99fe('0x11')]()[_0x99fe('0x12')](function(_0x4dfc1e){if(_0x4dfc1e){var _0x202d92=_['reject'](_0x4dfc1e,function(_0x23a8c2){return _0x23a8c2[_0x99fe('0xb')]===_0x99fe('0x13')||_0x23a8c2[_0x99fe('0xb')]===_0x99fe('0x14');});return{'rows':_0x202d92,'count':_0x202d92[_0x99fe('0x15')]};}return null;})[_0x99fe('0x12')](respondWithResult(_0x4bbb26,null))['catch'](handleError(_0x4bbb26,null));};exports[_0x99fe('0x16')]=function(_0x1fe208,_0x22544f){return pm2[_0x99fe('0x17')](_0x1fe208[_0x99fe('0x18')]['id'])[_0x99fe('0x12')](respondWithResult(_0x22544f,null))[_0x99fe('0x12')](handleEntityNotFound(_0x22544f,null))[_0x99fe('0x19')](handleError(_0x22544f,null));};exports[_0x99fe('0x1a')]=function(_0x44a633,_0x2d6029){if(_0x44a633[_0x99fe('0x1b')][_0x99fe('0xb')]&&_0x44a633['body'][_0x99fe('0x1c')]){var _0x5dbb54=path['join'](__dirname,_0x99fe('0x1d'),_0x44a633[_0x99fe('0x1b')][_0x99fe('0x1c')]);var _0x4d79ba=process['cwd']();process[_0x99fe('0x1e')](path[_0x99fe('0x1f')](_0x5dbb54));return execChildProcess()['then'](function(_0x490bcb){process['chdir'](_0x4d79ba);return pm2['start']({'name':_0x44a633[_0x99fe('0x1b')][_0x99fe('0xb')],'script':_0x5dbb54});})[_0x99fe('0x12')](function(_0x4a9fca){pm2[_0x99fe('0x20')]();return _0x4a9fca[0x0];})[_0x99fe('0x12')](respondWithResult(_0x2d6029,0xc9))['catch'](handleError(_0x2d6029,null));}else{return _0x2d6029['status'](0x1f4)[_0x99fe('0xc')]({'message':'Missing\x20name\x20and/or\x20path'});}};exports[_0x99fe('0x21')]=function(_0xdbbe3c,_0x336215){if(_0xdbbe3c[_0x99fe('0x1b')]['id']){delete _0xdbbe3c[_0x99fe('0x1b')]['id'];}var _0x39f164={'online':_0x99fe('0x22'),'stopped':_0x99fe('0x23')};if(_0x39f164[_0x99fe('0x24')](_0xdbbe3c['body'][_0x99fe('0x8')])){return pm2[_0x39f164[_0xdbbe3c[_0x99fe('0x1b')][_0x99fe('0x8')]]](_0xdbbe3c['params']['id'])[_0x99fe('0x12')](respondWithResult(_0x336215,0xc8))['catch'](handleError(_0x336215,null));}else{return _0x336215[_0x99fe('0x8')](0x1f4)[_0x99fe('0xc')]({'message':_0x99fe('0x25')});}};exports[_0x99fe('0x26')]=function(_0x257eb8,_0x27d984){if(_0x257eb8[_0x99fe('0x1b')]['id']){delete _0x257eb8[_0x99fe('0x1b')]['id'];}if(_0x257eb8[_0x99fe('0x18')]['id']){return pm2[_0x99fe('0x27')](_0x257eb8[_0x99fe('0x18')]['id'])['then'](function(_0x3153db){pm2[_0x99fe('0x20')]();return _0x3153db[0x0];})['then'](respondWithResult(_0x27d984,null))[_0x99fe('0x19')](handleError(_0x27d984,null));}else{return _0x27d984[_0x99fe('0x8')](0x1f4)['send']({'message':_0x99fe('0x28')});}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 9edbbd3..b3d7b5c 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 _0x9c51=['express','Router','../../components/interaction/service','exports','util','connect-timeout'];(function(_0x1dece7,_0x18cf0e){var _0x584962=function(_0x58f4b6){while(--_0x58f4b6){_0x1dece7['push'](_0x1dece7['shift']());}};_0x584962(++_0x18cf0e);}(_0x9c51,0x13c));var _0x19c5=function(_0x273553,_0x6c88af){_0x273553=_0x273553-0x0;var _0x456527=_0x9c51[_0x273553];return _0x456527;};'use strict';var multer=require('multer');var util=require(_0x19c5('0x0'));var path=require('path');var timeout=require(_0x19c5('0x1'));var express=require(_0x19c5('0x2'));var router=express[_0x19c5('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x19c5('0x4'));var config=require('../../config/environment');module[_0x19c5('0x5')]=router; \ No newline at end of file +var _0x8773=['Router','../../components/interaction/service','../../config/environment','exports','util','path','express'];(function(_0x414584,_0x1a1da6){var _0x50b255=function(_0x3ae5ce){while(--_0x3ae5ce){_0x414584['push'](_0x414584['shift']());}};_0x50b255(++_0x1a1da6);}(_0x8773,0x1bd));var _0x3877=function(_0x4fc3fb,_0x17b9fd){_0x4fc3fb=_0x4fc3fb-0x0;var _0x2c06d7=_0x8773[_0x4fc3fb];return _0x2c06d7;};'use strict';var multer=require('multer');var util=require(_0x3877('0x0'));var path=require(_0x3877('0x1'));var timeout=require('connect-timeout');var express=require(_0x3877('0x2'));var router=express[_0x3877('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x3877('0x4'));var config=require(_0x3877('0x5'));module[_0x3877('0x6')]=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 4dc2456..f072599 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 _0xaa66=['DATE','INTEGER','STRING'];(function(_0x4998e4,_0x47a4ed){var _0x1bef53=function(_0x458797){while(--_0x458797){_0x4998e4['push'](_0x4998e4['shift']());}};_0x1bef53(++_0x47a4ed);}(_0xaa66,0x73));var _0x6aa6=function(_0x4f56f4,_0x40fa78){_0x4f56f4=_0x4f56f4-0x0;var _0x2ef67f=_0xaa66[_0x4f56f4];return _0x2ef67f;};'use strict';var Sequelize=require('sequelize');module['exports']={'state':{'type':Sequelize[_0x6aa6('0x0')](0x2)},'statedesc':{'type':Sequelize[_0x6aa6('0x1')]},'scheduledat':{'type':Sequelize[_0x6aa6('0x2')]},'uniqueid':{'type':Sequelize[_0x6aa6('0x1')]},'starttime':{'type':Sequelize[_0x6aa6('0x2')]},'responsetime':{'type':Sequelize[_0x6aa6('0x2')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x6aa6('0x1')]}}; \ No newline at end of file +var _0xf7af=['STRING','DATE','exports','INTEGER'];(function(_0x1b25c1,_0x2c6ce6){var _0x1e4447=function(_0xaaafca){while(--_0xaaafca){_0x1b25c1['push'](_0x1b25c1['shift']());}};_0x1e4447(++_0x2c6ce6);}(_0xf7af,0x11e));var _0xff7a=function(_0x22c095,_0x18cf27){_0x22c095=_0x22c095-0x0;var _0x3a8b6d=_0xf7af[_0x22c095];return _0x3a8b6d;};'use strict';var Sequelize=require('sequelize');module[_0xff7a('0x0')]={'state':{'type':Sequelize[_0xff7a('0x1')](0x2)},'statedesc':{'type':Sequelize[_0xff7a('0x2')]},'scheduledat':{'type':Sequelize[_0xff7a('0x3')]},'uniqueid':{'type':Sequelize[_0xff7a('0x2')]},'starttime':{'type':Sequelize[_0xff7a('0x3')]},'responsetime':{'type':Sequelize[_0xff7a('0x3')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize[_0xff7a('0x2')]},'campaigntype':{'type':Sequelize[_0xff7a('0x2')]},'membername':{'type':Sequelize[_0xff7a('0x2')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index a543136..bdca318 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 _0x7d71=['request-promise','path','rimraf','../../config/environment','define','ReportAgentPreview','report_agent_preview','lodash','../../config/logger','api','moment','bluebird'];(function(_0x5425e2,_0x264270){var _0xe8616e=function(_0x39b971){while(--_0x39b971){_0x5425e2['push'](_0x5425e2['shift']());}};_0xe8616e(++_0x264270);}(_0x7d71,0x103));var _0x17d7=function(_0x3de8a4,_0x289a5c){_0x3de8a4=_0x3de8a4-0x0;var _0x4635cf=_0x7d71[_0x3de8a4];return _0x4635cf;};'use strict';var _=require(_0x17d7('0x0'));var util=require('util');var logger=require(_0x17d7('0x1'))(_0x17d7('0x2'));var moment=require(_0x17d7('0x3'));var BPromise=require(_0x17d7('0x4'));var rp=require(_0x17d7('0x5'));var fs=require('fs');var path=require(_0x17d7('0x6'));var rimraf=require(_0x17d7('0x7'));var config=require(_0x17d7('0x8'));var attributes=require('./reportAgentPreview.attributes');module['exports']=function(_0x4fd005,_0x540e18){return _0x4fd005[_0x17d7('0x9')](_0x17d7('0xa'),attributes,{'tableName':_0x17d7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3148=['request-promise','path','rimraf','./reportAgentPreview.attributes','exports','define','report_agent_preview','lodash','util','../../config/logger'];(function(_0x2f2107,_0x3868fa){var _0x1edc15=function(_0x4d7d11){while(--_0x4d7d11){_0x2f2107['push'](_0x2f2107['shift']());}};_0x1edc15(++_0x3868fa);}(_0x3148,0x93));var _0x8314=function(_0x320f22,_0x488293){_0x320f22=_0x320f22-0x0;var _0x281311=_0x3148[_0x320f22];return _0x281311;};'use strict';var _=require(_0x8314('0x0'));var util=require(_0x8314('0x1'));var logger=require(_0x8314('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8314('0x3'));var fs=require('fs');var path=require(_0x8314('0x4'));var rimraf=require(_0x8314('0x5'));var config=require('../../config/environment');var attributes=require(_0x8314('0x6'));module[_0x8314('0x7')]=function(_0xe5dff,_0x36bd4d){return _0xe5dff[_0x8314('0x8')]('ReportAgentPreview',attributes,{'tableName':_0x8314('0x9'),'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 f8798f4..6617d7b 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 _0x4177=['then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','create','body','options','raw','CreateReportAgentPreview','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise'];(function(_0x330571,_0x536e62){var _0xd418da=function(_0x1f611f){while(--_0x1f611f){_0x330571['push'](_0x330571['shift']());}};_0xd418da(++_0x536e62);}(_0x4177,0x130));var _0x7417=function(_0x19b6f4,_0x3e578e){_0x19b6f4=_0x19b6f4-0x0;var _0x1cda20=_0x4177[_0x19b6f4];return _0x1cda20;};'use strict';var _=require(_0x7417('0x0'));var util=require('util');var moment=require(_0x7417('0x1'));var BPromise=require(_0x7417('0x2'));var rs=require(_0x7417('0x3'));var fs=require('fs');var Redis=require(_0x7417('0x4'));var db=require(_0x7417('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7417('0x6'));var config=require('../../config/environment');var jayson=require(_0x7417('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x484f9d,_0x1138cf,_0x4e7b1d){return new BPromise(function(_0x2f440f,_0x2c7d92){return client['request'](_0x484f9d,_0x4e7b1d)[_0x7417('0x8')](function(_0x2034b9){logger[_0x7417('0x9')](_0x7417('0xa'),_0x1138cf,_0x7417('0xb'));logger[_0x7417('0xc')](_0x7417('0xd'),_0x1138cf,_0x7417('0xb'),JSON[_0x7417('0xe')](_0x2034b9));if(_0x2034b9['error']){if(_0x2034b9[_0x7417('0xf')]['code']===0x1f4){logger[_0x7417('0xf')](_0x7417('0xa'),_0x1138cf,_0x2034b9[_0x7417('0xf')]['message']);return _0x2c7d92(_0x2034b9[_0x7417('0xf')]['message']);}logger[_0x7417('0xf')](_0x7417('0xa'),_0x1138cf,_0x2034b9[_0x7417('0xf')][_0x7417('0x10')]);return _0x2f440f(_0x2034b9[_0x7417('0xf')][_0x7417('0x10')]);}else{logger['info'](_0x7417('0xa'),_0x1138cf,_0x7417('0xb'));_0x2f440f(_0x2034b9[_0x7417('0x11')]['message']);}})[_0x7417('0x12')](function(_0x39625c){logger['error'](_0x7417('0xa'),_0x1138cf,_0x39625c);_0x2c7d92(_0x39625c);});});}exports['CreateReportAgentPreview']=function(_0x5ccddf){var _0x13f036=this;return new Promise(function(_0x113751,_0x21ab8a){return db['ReportAgentPreview'][_0x7417('0x13')](_0x5ccddf[_0x7417('0x14')],{'raw':_0x5ccddf[_0x7417('0x15')]?_0x5ccddf[_0x7417('0x15')][_0x7417('0x16')]===undefined?!![]:![]:!![]})['then'](function(_0x2b960b){logger['info'](_0x7417('0x17'),_0x5ccddf);logger['debug']('CreateReportAgentPreview',_0x5ccddf,JSON[_0x7417('0xe')](_0x2b960b));_0x113751(_0x2b960b);})['catch'](function(_0x38fe20){logger[_0x7417('0xf')](_0x7417('0x17'),_0x38fe20['message'],_0x5ccddf);_0x21ab8a(_0x13f036[_0x7417('0xf')](0x1f4,_0x38fe20['message']));});});}; \ No newline at end of file +var _0xbfbb=['CreateReportAgentPreview','create','body','raw','then','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch'];(function(_0x2158d9,_0x1f0021){var _0x580f1a=function(_0x2e4f8a){while(--_0x2e4f8a){_0x2158d9['push'](_0x2158d9['shift']());}};_0x580f1a(++_0x1f0021);}(_0xbfbb,0x17c));var _0xbbfb=function(_0x23b352,_0x4ed14f){_0x23b352=_0x23b352-0x0;var _0x1cef26=_0xbfbb[_0x23b352];return _0x1cef26;};'use strict';var _=require(_0xbbfb('0x0'));var util=require(_0xbbfb('0x1'));var moment=require(_0xbbfb('0x2'));var BPromise=require(_0xbbfb('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbbfb('0x4'))['db'];var utils=require(_0xbbfb('0x5'));var logger=require(_0xbbfb('0x6'))('rpc');var config=require(_0xbbfb('0x7'));var jayson=require(_0xbbfb('0x8'));var client=jayson['client'][_0xbbfb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xabf312,_0x4f71ca,_0x4e692c){return new BPromise(function(_0xd4843e,_0x4f0979){return client[_0xbbfb('0xa')](_0xabf312,_0x4e692c)['then'](function(_0x4da70a){logger[_0xbbfb('0xb')](_0xbbfb('0xc'),_0x4f71ca,_0xbbfb('0xd'));logger[_0xbbfb('0xe')]('ReportAgentPreview,\x20%s,\x20%s,\x20%s',_0x4f71ca,_0xbbfb('0xd'),JSON[_0xbbfb('0xf')](_0x4da70a));if(_0x4da70a[_0xbbfb('0x10')]){if(_0x4da70a['error']['code']===0x1f4){logger[_0xbbfb('0x10')](_0xbbfb('0xc'),_0x4f71ca,_0x4da70a[_0xbbfb('0x10')][_0xbbfb('0x11')]);return _0x4f0979(_0x4da70a['error']['message']);}logger[_0xbbfb('0x10')](_0xbbfb('0xc'),_0x4f71ca,_0x4da70a[_0xbbfb('0x10')]['message']);return _0xd4843e(_0x4da70a[_0xbbfb('0x10')]['message']);}else{logger[_0xbbfb('0xb')]('ReportAgentPreview,\x20%s,\x20%s',_0x4f71ca,_0xbbfb('0xd'));_0xd4843e(_0x4da70a[_0xbbfb('0x12')]['message']);}})[_0xbbfb('0x13')](function(_0x2436e3){logger[_0xbbfb('0x10')](_0xbbfb('0xc'),_0x4f71ca,_0x2436e3);_0x4f0979(_0x2436e3);});});}exports[_0xbbfb('0x14')]=function(_0x516c29){var _0x128c65=this;return new Promise(function(_0x214f8e,_0x3f43cc){return db['ReportAgentPreview'][_0xbbfb('0x15')](_0x516c29[_0xbbfb('0x16')],{'raw':_0x516c29['options']?_0x516c29['options'][_0xbbfb('0x17')]===undefined?!![]:![]:!![]})[_0xbbfb('0x18')](function(_0x470fa8){logger['info'](_0xbbfb('0x14'),_0x516c29);logger[_0xbbfb('0xe')](_0xbbfb('0x14'),_0x516c29,JSON[_0xbbfb('0xf')](_0x470fa8));_0x214f8e(_0x470fa8);})[_0xbbfb('0x13')](function(_0x4c11f0){logger[_0xbbfb('0x10')](_0xbbfb('0x14'),_0x4c11f0[_0xbbfb('0x11')],_0x516c29);_0x3f43cc(_0x128c65[_0xbbfb('0x10')](0x1f4,_0x4c11f0[_0xbbfb('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index a55fc64..5b41168 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 _0xd99f=['mailAccounts','/openchannel/queues','openchannelQueues','whatsappQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','/outbound','outbound','outboundChannels','/agents','agents','put','/telephones','telephones','trunks','/campaigns','campaigns','faxAccounts','/chat/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/sms/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','showMailQueues','post','/chat/queues/:id/notify','/chat/queues/:id','showChatQueues','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','showWhatsappQueues','/agents/:id/notify','multer','util','path','Router','../../components/auth/service','./rpc.controller','/voice/channels','isAuthenticated','voiceChannels','get','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','/mail/queues','mailQueues'];(function(_0x24ae03,_0x334660){var _0x38a29e=function(_0x25e64b){while(--_0x25e64b){_0x24ae03['push'](_0x24ae03['shift']());}};_0x38a29e(++_0x334660);}(_0xd99f,0x17c));var _0xfd99=function(_0x374a99,_0x36d5d0){_0x374a99=_0x374a99-0x0;var _0x1bab09=_0xd99f[_0x374a99];return _0x1bab09;};'use strict';var multer=require(_0xfd99('0x0'));var util=require(_0xfd99('0x1'));var path=require(_0xfd99('0x2'));var express=require('express');var router=express[_0xfd99('0x3')]();var auth=require(_0xfd99('0x4'));var controller=require(_0xfd99('0x5'));router['get'](_0xfd99('0x6'),auth[_0xfd99('0x7')](),controller[_0xfd99('0x8')]);router[_0xfd99('0x9')](_0xfd99('0xa'),auth[_0xfd99('0x7')](),controller[_0xfd99('0xb')]);router[_0xfd99('0x9')](_0xfd99('0xc'),auth[_0xfd99('0x7')](),controller[_0xfd99('0xd')]);router[_0xfd99('0x9')](_0xfd99('0xe'),auth[_0xfd99('0x7')](),controller[_0xfd99('0xf')]);router[_0xfd99('0x9')](_0xfd99('0x10'),auth[_0xfd99('0x7')](),controller[_0xfd99('0x11')]);router[_0xfd99('0x9')](_0xfd99('0x12'),auth[_0xfd99('0x7')](),controller[_0xfd99('0x13')]);router[_0xfd99('0x9')]('/mail/accounts',auth['isAuthenticated'](),controller[_0xfd99('0x14')]);router[_0xfd99('0x9')](_0xfd99('0x15'),auth[_0xfd99('0x7')](),controller[_0xfd99('0x16')]);router[_0xfd99('0x9')]('/sms/queues',auth[_0xfd99('0x7')](),controller['smsQueues']);router[_0xfd99('0x9')]('/whatsapp/queues',auth[_0xfd99('0x7')](),controller[_0xfd99('0x17')]);router['get'](_0xfd99('0x18'),auth[_0xfd99('0x7')](),controller[_0xfd99('0x19')]);router[_0xfd99('0x9')](_0xfd99('0x1a'),auth['isAuthenticated'](),controller['voiceQueuesPreview']);router['get'](_0xfd99('0x1b'),auth['isAuthenticated'](),controller[_0xfd99('0x1c')]);router[_0xfd99('0x9')](_0xfd99('0x1d'),auth[_0xfd99('0x7')](),controller['voiceQueuesChannel']);router[_0xfd99('0x9')](_0xfd99('0x1e'),auth[_0xfd99('0x7')](),controller[_0xfd99('0x1f')]);router['get'](_0xfd99('0x20'),auth[_0xfd99('0x7')](),controller[_0xfd99('0x21')]);router['get'](_0xfd99('0x22'),auth[_0xfd99('0x7')](),controller[_0xfd99('0x23')]);router[_0xfd99('0x9')](_0xfd99('0x24'),auth[_0xfd99('0x7')](),controller[_0xfd99('0x25')]);router['get']('/outbound/channels',auth[_0xfd99('0x7')](),controller[_0xfd99('0x26')]);router[_0xfd99('0x9')](_0xfd99('0x27'),auth['isAuthenticated'](),controller[_0xfd99('0x28')]);router[_0xfd99('0x29')]('/agents/:id/capacity',auth[_0xfd99('0x7')](),controller['agentCapacity']);router[_0xfd99('0x9')](_0xfd99('0x2a'),auth['isAuthenticated'](),controller[_0xfd99('0x2b')]);router['get']('/trunks',auth[_0xfd99('0x7')](),controller[_0xfd99('0x2c')]);router[_0xfd99('0x9')](_0xfd99('0x2d'),auth['isAuthenticated'](),controller[_0xfd99('0x2e')]);router[_0xfd99('0x9')]('/fax/accounts',auth[_0xfd99('0x7')](),controller[_0xfd99('0x2f')]);router['get'](_0xfd99('0x30'),auth[_0xfd99('0x7')](),controller['chatQueuesWaitingInteractions']);router[_0xfd99('0x9')]('/mail/queues/waitinginteractions',auth[_0xfd99('0x7')](),controller[_0xfd99('0x31')]);router['get'](_0xfd99('0x32'),auth['isAuthenticated'](),controller[_0xfd99('0x33')]);router[_0xfd99('0x9')](_0xfd99('0x34'),auth[_0xfd99('0x7')](),controller['smsQueuesWaitingInteractions']);router['get']('/whatsapp/queues/waitinginteractions',auth[_0xfd99('0x7')](),controller[_0xfd99('0x35')]);router[_0xfd99('0x9')](_0xfd99('0x36'),auth[_0xfd99('0x7')](),controller[_0xfd99('0x37')]);router['post'](_0xfd99('0x38'),auth[_0xfd99('0x7')](),controller[_0xfd99('0x39')](_0xfd99('0x3a')));router[_0xfd99('0x9')](_0xfd99('0x3b'),auth[_0xfd99('0x7')](),controller[_0xfd99('0x3c')]);router[_0xfd99('0x3d')](_0xfd99('0x3e'),auth[_0xfd99('0x7')](),controller['queueNotify']('chat'));router['get'](_0xfd99('0x3f'),auth[_0xfd99('0x7')](),controller[_0xfd99('0x40')]);router['post']('/fax/queues/:id/notify',auth[_0xfd99('0x7')](),controller['queueNotify'](_0xfd99('0x41')));router[_0xfd99('0x9')](_0xfd99('0x42'),auth['isAuthenticated'](),controller[_0xfd99('0x43')]);router[_0xfd99('0x3d')](_0xfd99('0x44'),auth['isAuthenticated'](),controller['queueNotify'](_0xfd99('0x45')));router[_0xfd99('0x9')](_0xfd99('0x46'),auth[_0xfd99('0x7')](),controller[_0xfd99('0x47')]);router[_0xfd99('0x3d')](_0xfd99('0x48'),auth[_0xfd99('0x7')](),controller['queueNotify'](_0xfd99('0x49')));router[_0xfd99('0x3d')](_0xfd99('0x4a'),auth[_0xfd99('0x7')](),controller[_0xfd99('0x39')](_0xfd99('0x4b')));router[_0xfd99('0x9')](_0xfd99('0x4c'),auth[_0xfd99('0x7')](),controller[_0xfd99('0x4d')]);router['get']('/whatsapp/queues/:id',auth[_0xfd99('0x7')](),controller[_0xfd99('0x4e')]);router['post'](_0xfd99('0x4f'),auth[_0xfd99('0x7')](),controller['agentNotify']);module['exports']=router; \ No newline at end of file +var _0x5911=['telephones','trunks','/campaigns','campaigns','faxAccounts','/chat/queues/waitinginteractions','/mail/queues/waitinginteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','post','/mail/queues/:id/notify','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','queueNotify','chat','/chat/queues/:id','/fax/queues/:id/notify','/openchannel/queues/:id/notify','openchannel','showOpenchannelQueues','/sms/queues/:id/notify','sms','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','exports','multer','util','path','Router','../../components/auth/service','./rpc.controller','get','voiceChannels','/voice/channels/:uniqueid/mixmonitor','isAuthenticated','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','/outbound','outbound','/outbound/channels','outboundChannels','agents','put','/agents/:id/capacity','agentCapacity','/telephones'];(function(_0x3924d2,_0xf7250c){var _0x341739=function(_0x402ebf){while(--_0x402ebf){_0x3924d2['push'](_0x3924d2['shift']());}};_0x341739(++_0xf7250c);}(_0x5911,0x105));var _0x1591=function(_0x53ea79,_0x43532e){_0x53ea79=_0x53ea79-0x0;var _0x2cd6a3=_0x5911[_0x53ea79];return _0x2cd6a3;};'use strict';var multer=require(_0x1591('0x0'));var util=require(_0x1591('0x1'));var path=require(_0x1591('0x2'));var express=require('express');var router=express[_0x1591('0x3')]();var auth=require(_0x1591('0x4'));var controller=require(_0x1591('0x5'));router[_0x1591('0x6')]('/voice/channels',auth['isAuthenticated'](),controller[_0x1591('0x7')]);router['get'](_0x1591('0x8'),auth[_0x1591('0x9')](),controller[_0x1591('0xa')]);router[_0x1591('0x6')](_0x1591('0xb'),auth[_0x1591('0x9')](),controller[_0x1591('0xc')]);router[_0x1591('0x6')](_0x1591('0xd'),auth[_0x1591('0x9')](),controller[_0x1591('0xe')]);router[_0x1591('0x6')](_0x1591('0xf'),auth[_0x1591('0x9')](),controller[_0x1591('0x10')]);router[_0x1591('0x6')](_0x1591('0x11'),auth[_0x1591('0x9')](),controller[_0x1591('0x12')]);router[_0x1591('0x6')](_0x1591('0x13'),auth[_0x1591('0x9')](),controller[_0x1591('0x14')]);router['get'](_0x1591('0x15'),auth['isAuthenticated'](),controller['openchannelQueues']);router['get']('/sms/queues',auth['isAuthenticated'](),controller['smsQueues']);router[_0x1591('0x6')](_0x1591('0x16'),auth[_0x1591('0x9')](),controller[_0x1591('0x17')]);router[_0x1591('0x6')](_0x1591('0x18'),auth[_0x1591('0x9')](),controller[_0x1591('0x19')]);router['get'](_0x1591('0x1a'),auth[_0x1591('0x9')](),controller[_0x1591('0x1b')]);router[_0x1591('0x6')](_0x1591('0x1c'),auth[_0x1591('0x9')](),controller[_0x1591('0x1d')]);router[_0x1591('0x6')](_0x1591('0x1e'),auth[_0x1591('0x9')](),controller[_0x1591('0x1f')]);router[_0x1591('0x6')](_0x1591('0x20'),auth[_0x1591('0x9')](),controller[_0x1591('0x21')]);router[_0x1591('0x6')](_0x1591('0x22'),auth[_0x1591('0x9')](),controller[_0x1591('0x23')]);router[_0x1591('0x6')](_0x1591('0x24'),auth[_0x1591('0x9')](),controller[_0x1591('0x25')]);router[_0x1591('0x6')](_0x1591('0x26'),auth[_0x1591('0x9')](),controller[_0x1591('0x27')]);router[_0x1591('0x6')](_0x1591('0x28'),auth[_0x1591('0x9')](),controller[_0x1591('0x29')]);router['get']('/agents',auth[_0x1591('0x9')](),controller[_0x1591('0x2a')]);router[_0x1591('0x2b')](_0x1591('0x2c'),auth[_0x1591('0x9')](),controller[_0x1591('0x2d')]);router[_0x1591('0x6')](_0x1591('0x2e'),auth[_0x1591('0x9')](),controller[_0x1591('0x2f')]);router['get']('/trunks',auth[_0x1591('0x9')](),controller[_0x1591('0x30')]);router['get'](_0x1591('0x31'),auth['isAuthenticated'](),controller[_0x1591('0x32')]);router['get']('/fax/accounts',auth[_0x1591('0x9')](),controller[_0x1591('0x33')]);router[_0x1591('0x6')](_0x1591('0x34'),auth[_0x1591('0x9')](),controller['chatQueuesWaitingInteractions']);router[_0x1591('0x6')](_0x1591('0x35'),auth['isAuthenticated'](),controller['mailQueuesWaitingInteractions']);router[_0x1591('0x6')]('/openchannel/queues/waitinginteractions',auth['isAuthenticated'](),controller['openchannelQueuesWaitingInteractions']);router['get'](_0x1591('0x36'),auth[_0x1591('0x9')](),controller[_0x1591('0x37')]);router[_0x1591('0x6')](_0x1591('0x38'),auth[_0x1591('0x9')](),controller['whatsappQueuesWaitingInteractions']);router[_0x1591('0x6')]('/fax/queues/waitinginteractions',auth[_0x1591('0x9')](),controller['faxQueuesWaitingInteractions']);router[_0x1591('0x39')](_0x1591('0x3a'),auth[_0x1591('0x9')](),controller['queueNotify']('mail'));router[_0x1591('0x6')](_0x1591('0x3b'),auth[_0x1591('0x9')](),controller[_0x1591('0x3c')]);router[_0x1591('0x39')](_0x1591('0x3d'),auth['isAuthenticated'](),controller[_0x1591('0x3e')](_0x1591('0x3f')));router[_0x1591('0x6')](_0x1591('0x40'),auth[_0x1591('0x9')](),controller['showChatQueues']);router['post'](_0x1591('0x41'),auth['isAuthenticated'](),controller[_0x1591('0x3e')]('fax'));router['get']('/fax/queues/:id',auth['isAuthenticated'](),controller['showFaxQueues']);router['post'](_0x1591('0x42'),auth[_0x1591('0x9')](),controller[_0x1591('0x3e')](_0x1591('0x43')));router[_0x1591('0x6')]('/openchannel/queues/:id',auth[_0x1591('0x9')](),controller[_0x1591('0x44')]);router['post'](_0x1591('0x45'),auth[_0x1591('0x9')](),controller['queueNotify'](_0x1591('0x46')));router['post']('/whatsapp/queues/:id/notify',auth[_0x1591('0x9')](),controller['queueNotify']('whatsapp'));router[_0x1591('0x6')](_0x1591('0x47'),auth['isAuthenticated'](),controller[_0x1591('0x48')]);router[_0x1591('0x6')](_0x1591('0x49'),auth[_0x1591('0x9')](),controller[_0x1591('0x4a')]);router[_0x1591('0x39')](_0x1591('0x4b'),auth['isAuthenticated'](),controller['agentNotify']);module[_0x1591('0x4c')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index c8bdfb3..82202c3 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 _0x6453=['outbound','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','body','interaction','user','name','MemberReport','findAll','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','findOrCreate','interface','SIP/%s','internal','AgentCapacity','capacity','telephones','trunks','Trunks','campaigns','Campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','mailAccounts','openchannelQueues','showOpenchannelQueues','OpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','FaxQueuesWaitingInteractions','chat','Website','Queue','findOne','messageId','Interaction','\x20Message\x20not\x20found','update','queue','MessageId','InteractionId','From','Account','QueueId','TransferReport','create','Start','queueTransferTimeout','*,*,*,*','channel','capitalize','User','agent','Agent\x20not\x20found','Message','agentTransferTimeout','bluebird','moment','lodash','util','../../config/logger','jayson/promise','client','http','request','then','error','code','message','catch','status','json','sendStatus','stack','send','isNil','find','rows','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','query','showVoiceQueues','voiceQueuesPreview','VoiceQueuesPreview','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x6453,0x1c0));var _0x3645=function(_0x261522,_0x1adc1f){_0x261522=_0x261522-0x0;var _0x98a25a=_0x6453[_0x261522];return _0x98a25a;};'use strict';var BPromise=require(_0x3645('0x0'));var moment=require(_0x3645('0x1'));var _=require(_0x3645('0x2'));var util=require(_0x3645('0x3'));var db=require('../../mysqldb')['db'];var logger=require(_0x3645('0x4'))('api');var jayson=require(_0x3645('0x5'));var amiClient=jayson[_0x3645('0x6')][_0x3645('0x7')]({'port':0x232a});var mailClient=jayson['client'][_0x3645('0x7')]({'port':0x232b});var routingClient=jayson['client'][_0x3645('0x7')]({'port':0x232c});function respondWithRpcPromise(_0x4e4ed6,_0x34c468,_0x2d2fbf){return new BPromise(function(_0x4342ea,_0x1f2ee3){var _0x59828d=_0x2d2fbf?_0x2d2fbf:amiClient;return _0x59828d[_0x3645('0x8')](_0x4e4ed6,_0x34c468)[_0x3645('0x9')](function(_0x19d681){if(_0x19d681[_0x3645('0xa')]){if(_0x19d681[_0x3645('0xa')][_0x3645('0xb')]===0x1f4){return _0x1f2ee3(_0x19d681['error'][_0x3645('0xc')]);}return _0x4342ea(_0x19d681[_0x3645('0xa')]['message']);}else{_0x4342ea(_0x19d681['result']);}})[_0x3645('0xd')](function(_0x1c1811){_0x1f2ee3(_0x1c1811);});});}function respondWithResult(_0x4a69dc,_0x138b93){_0x138b93=_0x138b93||0xc8;return function(_0x5d2735){if(_0x5d2735){return _0x4a69dc[_0x3645('0xe')](_0x138b93)[_0x3645('0xf')](_0x5d2735);}return _0x4a69dc[_0x3645('0x10')](0x194);};}function handleError(_0x529b8f,_0xd5d8b4){_0xd5d8b4=_0xd5d8b4||0x1f4;return function(_0xccefd5){logger[_0x3645('0xa')](_0xccefd5[_0x3645('0x11')]);if(_0xccefd5['name']){delete _0xccefd5['name'];}_0x529b8f[_0x3645('0xe')](_0xd5d8b4)[_0x3645('0x12')](_0xccefd5);};}function findById(_0x4cc6d6){return function(_0x25b4e0){if(!_[_0x3645('0x13')](_0x4cc6d6)&&!_[_0x3645('0x13')](_0x25b4e0)&&!_[_0x3645('0x13')](_0x25b4e0['rows'])){return _[_0x3645('0x14')](_0x25b4e0[_0x3645('0x15')],function(_0x2351fa){return _0x2351fa['id']==_0x4cc6d6;});}return null;};}exports['voiceChannels']=function(_0x525642,_0x1cfc03){return respondWithRpcPromise('VoiceChannels',_0x525642['query'])[_0x3645('0x9')](respondWithResult(_0x1cfc03,null))[_0x3645('0xd')](handleError(_0x1cfc03,null));};exports[_0x3645('0x16')]=function(_0x29cfde,_0x539c59){return respondWithRpcPromise(_0x3645('0x17'),_[_0x3645('0x18')](_0x29cfde['query'],_0x29cfde[_0x3645('0x19')]))[_0x3645('0x9')](respondWithResult(_0x539c59,null))['catch'](handleError(_0x539c59,null));};exports[_0x3645('0x1a')]=function(_0x3200de,_0x394a42){return respondWithRpcPromise(_0x3645('0x1b'),_[_0x3645('0x18')](_0x3200de['query'],_0x3200de[_0x3645('0x19')]))[_0x3645('0x9')](respondWithResult(_0x394a42,null))[_0x3645('0xd')](handleError(_0x394a42,null));};exports[_0x3645('0x1c')]=function(_0x11fb50,_0x35ea8e){return respondWithRpcPromise(_0x3645('0x1d'),_0x11fb50[_0x3645('0x1e')])[_0x3645('0x9')](respondWithResult(_0x35ea8e,null))[_0x3645('0xd')](handleError(_0x35ea8e,null));};exports[_0x3645('0x1f')]=function(_0x16ec45,_0x4686dd){return respondWithRpcPromise(_0x3645('0x1d'),_0x16ec45[_0x3645('0x1e')])['then'](findById(_0x16ec45[_0x3645('0x19')]['id']))[_0x3645('0x9')](respondWithResult(_0x4686dd,null))[_0x3645('0xd')](handleError(_0x4686dd,null));};exports[_0x3645('0x20')]=function(_0x98f9ee,_0x2bdeaa){return respondWithRpcPromise(_0x3645('0x21'),_[_0x3645('0x18')](_0x98f9ee['query'],_0x98f9ee[_0x3645('0x19')]))[_0x3645('0x9')](respondWithResult(_0x2bdeaa,null))[_0x3645('0xd')](handleError(_0x2bdeaa,null));};exports['voiceQueuesChannels']=function(_0x127462,_0x29adc1){return respondWithRpcPromise(_0x3645('0x22'),_0x127462[_0x3645('0x1e')])[_0x3645('0x9')](respondWithResult(_0x29adc1,null))['catch'](handleError(_0x29adc1,null));};exports[_0x3645('0x23')]=function(_0x480ca7,_0x4beebd){return respondWithRpcPromise(_0x3645('0x24'),_[_0x3645('0x18')](_0x480ca7[_0x3645('0x1e')],_0x480ca7['params']))['then'](respondWithResult(_0x4beebd,null))[_0x3645('0xd')](handleError(_0x4beebd,null));};exports[_0x3645('0x25')]=function(_0x38a3e6,_0x580d74){return respondWithRpcPromise(_0x3645('0x26'),_[_0x3645('0x18')](_0x38a3e6[_0x3645('0x1e')],_0x38a3e6[_0x3645('0x19')]))[_0x3645('0x9')](respondWithResult(_0x580d74,null))[_0x3645('0xd')](handleError(_0x580d74,null));};exports[_0x3645('0x27')]=function(_0xb721e5,_0x10403b){return respondWithRpcPromise('VoiceQueuesChannelRedirect',_['merge'](_0xb721e5[_0x3645('0x1e')],_0xb721e5[_0x3645('0x19')]))[_0x3645('0x9')](respondWithResult(_0x10403b,null))[_0x3645('0xd')](handleError(_0x10403b,null));};exports[_0x3645('0x28')]=function(_0x54c2ed,_0x521300){return respondWithRpcPromise(_0x3645('0x29'),_0x54c2ed[_0x3645('0x1e')])['then'](respondWithResult(_0x521300,null))['catch'](handleError(_0x521300,null));};exports[_0x3645('0x2a')]=function(_0x33a581,_0x124889){return respondWithRpcPromise(_0x3645('0x2b'),_0x33a581[_0x3645('0x1e')])[_0x3645('0x9')](respondWithResult(_0x124889,null))[_0x3645('0xd')](handleError(_0x124889,null));};exports[_0x3645('0x2c')]=function(_0x56b6c0,_0x7c382e){var _0x11c9f9;return respondWithRpcPromise(_0x3645('0x2d'),_0x56b6c0[_0x3645('0x1e')])[_0x3645('0x9')](function(_0x49a9e3){_0x11c9f9=_0x49a9e3;return respondWithRpcPromise(_0x3645('0x2d'),_0x56b6c0[_0x3645('0x1e')],routingClient);})[_0x3645('0x9')](function(_0x1be51d){return _[_0x3645('0x18')]({},_0x1be51d,_0x11c9f9);})[_0x3645('0x9')](respondWithResult(_0x7c382e,null))['catch'](handleError(_0x7c382e,null));};exports[_0x3645('0x2e')]=function(_0x546dda,_0x94ae4e){if(_0x546dda['body']&&_0x546dda[_0x3645('0x2f')][_0x3645('0x30')]&&_0x546dda[_0x3645('0x31')]&&_0x546dda[_0x3645('0x31')][_0x3645('0x32')]){for(var _0x34a6de in _0x546dda[_0x3645('0x2f')][_0x3645('0x30')]){if(_0x546dda[_0x3645('0x2f')][_0x3645('0x30')]['hasOwnProperty'](_0x34a6de)){db[_0x3645('0x33')][_0x3645('0x34')]({'where':{'channel':_0x34a6de,'membername':_0x546dda[_0x3645('0x31')][_0x3645('0x32')],'type':_0x3645('0x35'),'exitAt':null,'uniqueid':_0x546dda['body'][_0x3645('0x30')][_0x34a6de]&&_0x546dda[_0x3645('0x2f')][_0x3645('0x30')][_0x34a6de][_0x3645('0x36')]?{'$notIn':_0x546dda[_0x3645('0x2f')][_0x3645('0x30')][_0x34a6de]}:{'$ne':null}}})[_0x3645('0x9')](function(_0x4ef382){var _0x1a2b79=moment()[_0x3645('0x37')](_0x3645('0x38'));for(var _0x1fa29d=0x0,_0x255691=_0x4ef382[_0x3645('0x36')];_0x1fa29d<_0x255691;_0x1fa29d+=0x1){_0x4ef382[_0x1fa29d][_0x3645('0x39')]({'exitAt':_0x1a2b79});}});for(var _0x1349ad=0x0;_0x1349ad<_0x546dda[_0x3645('0x2f')][_0x3645('0x30')][_0x34a6de][_0x3645('0x36')];_0x1349ad+=0x1){db['MemberReport'][_0x3645('0x3a')]({'where':{'channel':_0x34a6de,'membername':_0x546dda[_0x3645('0x31')][_0x3645('0x32')],'type':'INTERACTION','uniqueid':_0x546dda[_0x3645('0x2f')][_0x3645('0x30')][_0x34a6de][_0x1349ad],'exitAt':null},'defaults':{'channel':_0x34a6de,'membername':_0x546dda['user'][_0x3645('0x32')],'interface':_[_0x3645('0x13')](_0x546dda[_0x3645('0x31')][_0x3645('0x3b')])?util[_0x3645('0x37')](_0x3645('0x3c'),_0x546dda['user'][_0x3645('0x32')]):_0x546dda[_0x3645('0x31')]['interface'],'type':_0x3645('0x35'),'enterAt':moment()[_0x3645('0x37')](_0x3645('0x38')),'role':'agent','internal':_0x546dda[_0x3645('0x31')][_0x3645('0x3d')],'uniqueid':_0x546dda['body']['interaction'][_0x34a6de][_0x1349ad]}});}}}}return respondWithRpcPromise(_0x3645('0x3e'),{'id':_0x546dda[_0x3645('0x19')]['id'],'capacity':_0x546dda['body'][_0x3645('0x3f')]},routingClient)[_0x3645('0x9')](respondWithResult(_0x94ae4e,null))['catch'](handleError(_0x94ae4e,null));};exports[_0x3645('0x40')]=function(_0x516947,_0x459b46){return respondWithRpcPromise('Telephones',_0x516947[_0x3645('0x1e')])[_0x3645('0x9')](respondWithResult(_0x459b46,null))[_0x3645('0xd')](handleError(_0x459b46,null));};exports[_0x3645('0x41')]=function(_0x2b6252,_0x90261b){return respondWithRpcPromise(_0x3645('0x42'),_0x2b6252['query'])['then'](respondWithResult(_0x90261b,null))['catch'](handleError(_0x90261b,null));};exports[_0x3645('0x43')]=function(_0x363c65,_0x4f8824){return respondWithRpcPromise(_0x3645('0x44'),_0x363c65[_0x3645('0x1e')])['then'](respondWithResult(_0x4f8824,null))[_0x3645('0xd')](handleError(_0x4f8824,null));};exports[_0x3645('0x45')]=function(_0x59398a,_0x2cbdea){return respondWithRpcPromise(_0x3645('0x46'),_0x59398a[_0x3645('0x1e')],routingClient)[_0x3645('0x9')](respondWithResult(_0x2cbdea,null))['catch'](handleError(_0x2cbdea,null));};exports[_0x3645('0x47')]=function(_0x4f695f,_0x2aecd1){return respondWithRpcPromise(_0x3645('0x46'),_0x4f695f[_0x3645('0x1e')],routingClient)[_0x3645('0x9')](findById(_0x4f695f[_0x3645('0x19')]['id']))['then'](respondWithResult(_0x2aecd1,null))[_0x3645('0xd')](handleError(_0x2aecd1,null));};exports[_0x3645('0x48')]=function(_0x5439e6,_0x5348bf){return respondWithRpcPromise(_0x3645('0x49'),_0x5439e6['query'],routingClient)[_0x3645('0x9')](respondWithResult(_0x5348bf,null))[_0x3645('0xd')](handleError(_0x5348bf,null));};exports['showMailQueues']=function(_0x4cee0b,_0x44867b){return respondWithRpcPromise(_0x3645('0x49'),_0x4cee0b[_0x3645('0x1e')],routingClient)[_0x3645('0x9')](findById(_0x4cee0b[_0x3645('0x19')]['id']))[_0x3645('0x9')](respondWithResult(_0x44867b,null))[_0x3645('0xd')](handleError(_0x44867b,null));};exports[_0x3645('0x4a')]=function(_0x3211a2,_0x27c115){return respondWithRpcPromise('MailAccounts',_0x3211a2[_0x3645('0x1e')],mailClient)[_0x3645('0x9')](respondWithResult(_0x27c115,null))['catch'](handleError(_0x27c115,null));};exports[_0x3645('0x4b')]=function(_0x15a178,_0x48d1a1){return respondWithRpcPromise('OpenchannelQueues',_0x15a178[_0x3645('0x1e')],routingClient)['then'](respondWithResult(_0x48d1a1,null))[_0x3645('0xd')](handleError(_0x48d1a1,null));};exports[_0x3645('0x4c')]=function(_0x340c52,_0x1db856){return respondWithRpcPromise(_0x3645('0x4d'),_0x340c52[_0x3645('0x1e')],routingClient)[_0x3645('0x9')](findById(_0x340c52[_0x3645('0x19')]['id']))['then'](respondWithResult(_0x1db856,null))['catch'](handleError(_0x1db856,null));};exports[_0x3645('0x4e')]=function(_0x503e41,_0x3c7180){return respondWithRpcPromise(_0x3645('0x4f'),_0x503e41['query'],routingClient)['then'](respondWithResult(_0x3c7180,null))[_0x3645('0xd')](handleError(_0x3c7180,null));};exports[_0x3645('0x50')]=function(_0x111331,_0xb5885c){return respondWithRpcPromise('SmsQueues',_0x111331['query'],routingClient)['then'](findById(_0x111331[_0x3645('0x19')]['id']))['then'](respondWithResult(_0xb5885c,null))['catch'](handleError(_0xb5885c,null));};exports[_0x3645('0x51')]=function(_0xeabc65,_0x2b9a4e){return respondWithRpcPromise(_0x3645('0x52'),_0xeabc65[_0x3645('0x1e')],routingClient)['then'](respondWithResult(_0x2b9a4e,null))[_0x3645('0xd')](handleError(_0x2b9a4e,null));};exports[_0x3645('0x53')]=function(_0x1c6fb3,_0x1db4ad){return respondWithRpcPromise(_0x3645('0x52'),_0x1c6fb3[_0x3645('0x1e')],routingClient)[_0x3645('0x9')](findById(_0x1c6fb3[_0x3645('0x19')]['id']))['then'](respondWithResult(_0x1db4ad,null))[_0x3645('0xd')](handleError(_0x1db4ad,null));};exports[_0x3645('0x54')]=function(_0x420c47,_0x45b505){return respondWithRpcPromise(_0x3645('0x55'),_0x420c47[_0x3645('0x1e')],routingClient)['then'](respondWithResult(_0x45b505,null))['catch'](handleError(_0x45b505,null));};exports[_0x3645('0x56')]=function(_0x4d7603,_0x30804c){return respondWithRpcPromise('FaxQueues',_0x4d7603['query'],routingClient)[_0x3645('0x9')](findById(_0x4d7603[_0x3645('0x19')]['id']))[_0x3645('0x9')](respondWithResult(_0x30804c,null))['catch'](handleError(_0x30804c,null));};exports[_0x3645('0x57')]=function(_0x57f5ee,_0xf63124){return respondWithRpcPromise(_0x3645('0x58'),_0x57f5ee[_0x3645('0x1e')])['then'](respondWithResult(_0xf63124,null))[_0x3645('0xd')](handleError(_0xf63124,null));};exports['chatQueuesWaitingInteractions']=function(_0x42740d,_0x19e9e3){return respondWithRpcPromise(_0x3645('0x59'),_0x42740d[_0x3645('0x1e')],routingClient)[_0x3645('0x9')](respondWithResult(_0x19e9e3,null))['catch'](handleError(_0x19e9e3,null));};exports[_0x3645('0x5a')]=function(_0x46b4c6,_0x1b61eb){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x46b4c6['query'],routingClient)[_0x3645('0x9')](respondWithResult(_0x1b61eb,null))['catch'](handleError(_0x1b61eb,null));};exports[_0x3645('0x5b')]=function(_0x5dabb3,_0x734d14){return respondWithRpcPromise(_0x3645('0x5c'),_0x5dabb3['query'],routingClient)['then'](respondWithResult(_0x734d14,null))[_0x3645('0xd')](handleError(_0x734d14,null));};exports[_0x3645('0x5d')]=function(_0x18861d,_0x23745d){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x18861d['query'],routingClient)[_0x3645('0x9')](respondWithResult(_0x23745d,null))['catch'](handleError(_0x23745d,null));};exports['whatsappQueuesWaitingInteractions']=function(_0x28448d,_0x26ea7a){return respondWithRpcPromise(_0x3645('0x5e'),_0x28448d[_0x3645('0x1e')],routingClient)[_0x3645('0x9')](respondWithResult(_0x26ea7a,null))[_0x3645('0xd')](handleError(_0x26ea7a,null));};exports['faxQueuesWaitingInteractions']=function(_0x25bdc7,_0x279fe4){return respondWithRpcPromise(_0x3645('0x5f'),_0x25bdc7[_0x3645('0x1e')],routingClient)[_0x3645('0x9')](respondWithResult(_0x279fe4,null))['catch'](handleError(_0x279fe4,null));};exports['queueNotify']=function(_0x2be71c){return function(_0x576ce8,_0xa6852){var _0x4730c5,_0xd67501;var _0x295c55=_['capitalize'](_0x2be71c);var _0x234e06=_0x2be71c===_0x3645('0x60')?_0x3645('0x61'):'Account';return db[_0x295c55+_0x3645('0x62')]['findOne']({'raw':!![],'where':{'id':_0x576ce8[_0x3645('0x19')]['id']}})[_0x3645('0x9')](function(_0x360623){if(_[_0x3645('0x13')](_0x360623)){throw new Error(_0x295c55+'\x20Queue\x20not\x20found');}_0x4730c5=_0x360623;return db[_0x295c55+'Message'][_0x3645('0x63')]({'where':{'id':_0x576ce8[_0x3645('0x2f')][_0x3645('0x64')]},'include':[{'model':db[_0x295c55+'Interaction'],'as':_0x3645('0x65')},{'model':db[_0x295c55+_0x234e06],'as':'Account'}]});})[_0x3645('0x9')](function(_0x58e563){if(_[_0x3645('0x13')](_0x58e563)){throw new Error(_0x295c55+_0x3645('0x66'));}_0xd67501=_0x58e563;return _0x58e563[_0x3645('0x67')]({'read':0x0,'readAt':null,'UserId':null});})[_0x3645('0x9')](function(){var _0x9da8e1={'uniqueid':_0x2be71c+'.'+_0xd67501['id']+'.'+_0xd67501[_0x3645('0x65')]['id'],'FromUserId':_0x576ce8[_0x3645('0x31')]['id'],'type':_0x3645('0x68')};_0x9da8e1[_0x295c55+_0x3645('0x69')]=_0xd67501['id'];_0x9da8e1[_0x295c55+_0x3645('0x6a')]=_0xd67501[_0x3645('0x65')]['id'];_0x9da8e1[_0x3645('0x6b')+_0x295c55+_0x234e06+'Id']=_0xd67501[_0x3645('0x6c')]['id'];_0x9da8e1['To'+_0x295c55+_0x3645('0x6d')]=_0x4730c5['id'];return db[_0x295c55+_0x3645('0x6e')][_0x3645('0x6f')](_0x9da8e1);})[_0x3645('0x9')](function(){return respondWithRpcPromise(_0x3645('0x70'),{'channel':_0x2be71c,'interaction':_0xd67501['Interaction'],'message':_0xd67501,'account':_0xd67501[_0x3645('0x6c')],'applications':[{'id':0x0,'priority':0x1,'app':_0x3645('0x68'),'appdata':_0x4730c5[_0x3645('0x32')]+','+(_0xd67501[_0x3645('0x6c')][_0x3645('0x71')]||0x12c),'interval':_0x3645('0x72')}]},routingClient);})[_0x3645('0x9')](respondWithResult(_0xa6852,null))[_0x3645('0xd')](handleError(_0xa6852,null));};};exports['agentNotify']=function(_0x3b596c,_0x1a0c94){var _0x4118e8,_0x6e80e4;if(_[_0x3645('0x13')](_0x3b596c[_0x3645('0x2f')][_0x3645('0x73')])){throw new Error('Channel\x20field\x20is\x20mandatory');}var _0x5db326=_0x3b596c['body']['channel'];var _0x285bd6=_[_0x3645('0x74')](_0x5db326);var _0x43da11=_0x5db326===_0x3645('0x60')?_0x3645('0x61'):_0x3645('0x6c');return db[_0x3645('0x75')]['findOne']({'raw':!![],'where':{'id':_0x3b596c[_0x3645('0x19')]['id'],'role':_0x3645('0x76')}})['then'](function(_0x184dbc){if(_[_0x3645('0x13')](_0x184dbc)){throw new Error(_0x3645('0x77'));}_0x4118e8=_0x184dbc;return db[_0x285bd6+_0x3645('0x78')]['findOne']({'where':{'id':_0x3b596c[_0x3645('0x2f')]['messageId']},'include':[{'model':db[_0x285bd6+_0x3645('0x65')],'as':'Interaction'},{'model':db[_0x285bd6+_0x43da11],'as':'Account'}]});})[_0x3645('0x9')](function(_0x204b19){if(_[_0x3645('0x13')](_0x204b19)){throw new Error(_0x285bd6+_0x3645('0x66'));}_0x6e80e4=_0x204b19;return _0x204b19[_0x3645('0x67')]({'read':0x0,'readAt':null,'UserId':null});})[_0x3645('0x9')](function(){var _0x1a06ca={'uniqueid':_0x5db326+'.'+_0x6e80e4['id']+'.'+_0x6e80e4[_0x3645('0x65')]['id'],'FromUserId':_0x3b596c[_0x3645('0x31')]['id'],'type':_0x3645('0x68'),'ToUserId':_0x4118e8['id']};_0x1a06ca[_0x285bd6+'MessageId']=_0x6e80e4['id'];_0x1a06ca[_0x285bd6+'InteractionId']=_0x6e80e4[_0x3645('0x65')]['id'];_0x1a06ca[_0x3645('0x6b')+_0x285bd6+_0x43da11+'Id']=_0x6e80e4[_0x3645('0x6c')]['id'];return db[_0x285bd6+'TransferReport'][_0x3645('0x6f')](_0x1a06ca);})['then'](function(){return respondWithRpcPromise('Start',{'channel':_0x5db326,'interaction':_0x6e80e4['Interaction'],'message':_0x6e80e4,'account':_0x6e80e4[_0x3645('0x6c')],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x4118e8[_0x3645('0x32')]+','+(_0x6e80e4[_0x3645('0x6c')][_0x3645('0x79')]||0x12c),'interval':_0x3645('0x72')}]},routingClient);})[_0x3645('0x9')](respondWithResult(_0x1a0c94,null))[_0x3645('0xd')](handleError(_0x1a0c94,null));}; \ No newline at end of file +var _0x83e1=['agents','body','interaction','user','findAll','INTERACTION','format','YYYY-MM-DD\x20HH:mm:ss','length','updateAttributes','MemberReport','findOrCreate','interface','SIP/%s','agent','internal','AgentCapacity','capacity','telephones','Trunks','campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','showMailQueues','mailAccounts','MailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','WhatsappQueues','showWhatsappQueues','FaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','findOne','\x20Queue\x20not\x20found','Message','messageId','Interaction','Account','update','queue','MessageId','InteractionId','From','QueueId','TransferReport','create','Start','queueTransferTimeout','agentNotify','channel','Channel\x20field\x20is\x20mandatory','User','Agent\x20not\x20found','\x20Message\x20not\x20found','agentTransferTimeout','*,*,*,*','bluebird','moment','util','../../config/logger','client','http','then','error','code','message','result','catch','json','sendStatus','stack','name','status','send','isNil','find','rows','voiceChannels','query','voiceChannelMixMonitor','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','params','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannel','VoiceQueuesChannel','merge','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','outboundChannels','OutboundChannels'];(function(_0x177689,_0x401bd9){var _0x13b620=function(_0xb6c427){while(--_0xb6c427){_0x177689['push'](_0x177689['shift']());}};_0x13b620(++_0x401bd9);}(_0x83e1,0x1ad));var _0x183e=function(_0x54427e,_0x41e381){_0x54427e=_0x54427e-0x0;var _0x2bb46a=_0x83e1[_0x54427e];return _0x2bb46a;};'use strict';var BPromise=require(_0x183e('0x0'));var moment=require(_0x183e('0x1'));var _=require('lodash');var util=require(_0x183e('0x2'));var db=require('../../mysqldb')['db'];var logger=require(_0x183e('0x3'))('api');var jayson=require('jayson/promise');var amiClient=jayson[_0x183e('0x4')][_0x183e('0x5')]({'port':0x232a});var mailClient=jayson['client']['http']({'port':0x232b});var routingClient=jayson['client'][_0x183e('0x5')]({'port':0x232c});function respondWithRpcPromise(_0xab00d2,_0x14bea7,_0x4ee4bc){return new BPromise(function(_0x8e55be,_0x15be67){var _0x45ad78=_0x4ee4bc?_0x4ee4bc:amiClient;return _0x45ad78['request'](_0xab00d2,_0x14bea7)[_0x183e('0x6')](function(_0xa3916b){if(_0xa3916b[_0x183e('0x7')]){if(_0xa3916b['error'][_0x183e('0x8')]===0x1f4){return _0x15be67(_0xa3916b['error'][_0x183e('0x9')]);}return _0x8e55be(_0xa3916b[_0x183e('0x7')][_0x183e('0x9')]);}else{_0x8e55be(_0xa3916b[_0x183e('0xa')]);}})[_0x183e('0xb')](function(_0x15d10c){_0x15be67(_0x15d10c);});});}function respondWithResult(_0x192605,_0x5b86b3){_0x5b86b3=_0x5b86b3||0xc8;return function(_0x53e576){if(_0x53e576){return _0x192605['status'](_0x5b86b3)[_0x183e('0xc')](_0x53e576);}return _0x192605[_0x183e('0xd')](0x194);};}function handleError(_0x1aae2f,_0x5d4941){_0x5d4941=_0x5d4941||0x1f4;return function(_0x140a70){logger[_0x183e('0x7')](_0x140a70[_0x183e('0xe')]);if(_0x140a70['name']){delete _0x140a70[_0x183e('0xf')];}_0x1aae2f[_0x183e('0x10')](_0x5d4941)[_0x183e('0x11')](_0x140a70);};}function findById(_0xdbea2c){return function(_0x1d5780){if(!_[_0x183e('0x12')](_0xdbea2c)&&!_[_0x183e('0x12')](_0x1d5780)&&!_[_0x183e('0x12')](_0x1d5780['rows'])){return _[_0x183e('0x13')](_0x1d5780[_0x183e('0x14')],function(_0x322f56){return _0x322f56['id']==_0xdbea2c;});}return null;};}exports[_0x183e('0x15')]=function(_0xbeb289,_0x27d267){return respondWithRpcPromise('VoiceChannels',_0xbeb289[_0x183e('0x16')])[_0x183e('0x6')](respondWithResult(_0x27d267,null))[_0x183e('0xb')](handleError(_0x27d267,null));};exports[_0x183e('0x17')]=function(_0x4cf0da,_0x4d8102){return respondWithRpcPromise('VoiceChannelMixMonitor',_['merge'](_0x4cf0da[_0x183e('0x16')],_0x4cf0da['params']))['then'](respondWithResult(_0x4d8102,null))[_0x183e('0xb')](handleError(_0x4d8102,null));};exports[_0x183e('0x18')]=function(_0x455dab,_0x139145){return respondWithRpcPromise(_0x183e('0x19'),_['merge'](_0x455dab[_0x183e('0x16')],_0x455dab['params']))[_0x183e('0x6')](respondWithResult(_0x139145,null))[_0x183e('0xb')](handleError(_0x139145,null));};exports[_0x183e('0x1a')]=function(_0x46c2c5,_0x5a0d1d){return respondWithRpcPromise('VoiceQueues',_0x46c2c5[_0x183e('0x16')])[_0x183e('0x6')](respondWithResult(_0x5a0d1d,null))['catch'](handleError(_0x5a0d1d,null));};exports['showVoiceQueues']=function(_0x14522f,_0x267fff){return respondWithRpcPromise(_0x183e('0x1b'),_0x14522f['query'])[_0x183e('0x6')](findById(_0x14522f[_0x183e('0x1c')]['id']))[_0x183e('0x6')](respondWithResult(_0x267fff,null))[_0x183e('0xb')](handleError(_0x267fff,null));};exports[_0x183e('0x1d')]=function(_0x1f8603,_0x2f9657){return respondWithRpcPromise(_0x183e('0x1e'),_['merge'](_0x1f8603[_0x183e('0x16')],_0x1f8603['params']))[_0x183e('0x6')](respondWithResult(_0x2f9657,null))[_0x183e('0xb')](handleError(_0x2f9657,null));};exports['voiceQueuesChannels']=function(_0x21db26,_0x4c6aa4){return respondWithRpcPromise('VoiceQueuesChannels',_0x21db26[_0x183e('0x16')])['then'](respondWithResult(_0x4c6aa4,null))['catch'](handleError(_0x4c6aa4,null));};exports[_0x183e('0x1f')]=function(_0x1f21ad,_0x2fb176){return respondWithRpcPromise(_0x183e('0x20'),_[_0x183e('0x21')](_0x1f21ad[_0x183e('0x16')],_0x1f21ad[_0x183e('0x1c')]))['then'](respondWithResult(_0x2fb176,null))[_0x183e('0xb')](handleError(_0x2fb176,null));};exports['voiceQueuesChannelHangup']=function(_0xe282a,_0x10843c){return respondWithRpcPromise('VoiceQueuesChannelHangup',_[_0x183e('0x21')](_0xe282a[_0x183e('0x16')],_0xe282a['params']))['then'](respondWithResult(_0x10843c,null))[_0x183e('0xb')](handleError(_0x10843c,null));};exports[_0x183e('0x22')]=function(_0x2d291a,_0x68bb5d){return respondWithRpcPromise(_0x183e('0x23'),_[_0x183e('0x21')](_0x2d291a['query'],_0x2d291a[_0x183e('0x1c')]))['then'](respondWithResult(_0x68bb5d,null))['catch'](handleError(_0x68bb5d,null));};exports[_0x183e('0x24')]=function(_0x1bab79,_0x2b34b5){return respondWithRpcPromise('Outbound',_0x1bab79['query'])[_0x183e('0x6')](respondWithResult(_0x2b34b5,null))['catch'](handleError(_0x2b34b5,null));};exports[_0x183e('0x25')]=function(_0x3efe07,_0x52f113){return respondWithRpcPromise(_0x183e('0x26'),_0x3efe07[_0x183e('0x16')])[_0x183e('0x6')](respondWithResult(_0x52f113,null))[_0x183e('0xb')](handleError(_0x52f113,null));};exports[_0x183e('0x27')]=function(_0x37b751,_0x4095e5){var _0x2981c0;return respondWithRpcPromise('Agents',_0x37b751[_0x183e('0x16')])[_0x183e('0x6')](function(_0x5f2859){_0x2981c0=_0x5f2859;return respondWithRpcPromise('Agents',_0x37b751[_0x183e('0x16')],routingClient);})[_0x183e('0x6')](function(_0x3b5944){return _['merge']({},_0x3b5944,_0x2981c0);})[_0x183e('0x6')](respondWithResult(_0x4095e5,null))[_0x183e('0xb')](handleError(_0x4095e5,null));};exports['agentCapacity']=function(_0x19e2b9,_0x2df5d6){if(_0x19e2b9[_0x183e('0x28')]&&_0x19e2b9[_0x183e('0x28')][_0x183e('0x29')]&&_0x19e2b9['user']&&_0x19e2b9[_0x183e('0x2a')]['name']){for(var _0x4b21c2 in _0x19e2b9[_0x183e('0x28')][_0x183e('0x29')]){if(_0x19e2b9[_0x183e('0x28')]['interaction']['hasOwnProperty'](_0x4b21c2)){db['MemberReport'][_0x183e('0x2b')]({'where':{'channel':_0x4b21c2,'membername':_0x19e2b9[_0x183e('0x2a')]['name'],'type':_0x183e('0x2c'),'exitAt':null,'uniqueid':_0x19e2b9[_0x183e('0x28')][_0x183e('0x29')][_0x4b21c2]&&_0x19e2b9[_0x183e('0x28')][_0x183e('0x29')][_0x4b21c2]['length']?{'$notIn':_0x19e2b9[_0x183e('0x28')]['interaction'][_0x4b21c2]}:{'$ne':null}}})[_0x183e('0x6')](function(_0x7aca57){var _0x1f94f3=moment()[_0x183e('0x2d')](_0x183e('0x2e'));for(var _0x4aaa87=0x0,_0x129e92=_0x7aca57[_0x183e('0x2f')];_0x4aaa87<_0x129e92;_0x4aaa87+=0x1){_0x7aca57[_0x4aaa87][_0x183e('0x30')]({'exitAt':_0x1f94f3});}});for(var _0x2d5961=0x0;_0x2d5961<_0x19e2b9[_0x183e('0x28')][_0x183e('0x29')][_0x4b21c2][_0x183e('0x2f')];_0x2d5961+=0x1){db[_0x183e('0x31')][_0x183e('0x32')]({'where':{'channel':_0x4b21c2,'membername':_0x19e2b9['user']['name'],'type':_0x183e('0x2c'),'uniqueid':_0x19e2b9[_0x183e('0x28')][_0x183e('0x29')][_0x4b21c2][_0x2d5961],'exitAt':null},'defaults':{'channel':_0x4b21c2,'membername':_0x19e2b9[_0x183e('0x2a')][_0x183e('0xf')],'interface':_[_0x183e('0x12')](_0x19e2b9[_0x183e('0x2a')][_0x183e('0x33')])?util['format'](_0x183e('0x34'),_0x19e2b9['user'][_0x183e('0xf')]):_0x19e2b9['user']['interface'],'type':_0x183e('0x2c'),'enterAt':moment()[_0x183e('0x2d')](_0x183e('0x2e')),'role':_0x183e('0x35'),'internal':_0x19e2b9[_0x183e('0x2a')][_0x183e('0x36')],'uniqueid':_0x19e2b9[_0x183e('0x28')][_0x183e('0x29')][_0x4b21c2][_0x2d5961]}});}}}}return respondWithRpcPromise(_0x183e('0x37'),{'id':_0x19e2b9[_0x183e('0x1c')]['id'],'capacity':_0x19e2b9[_0x183e('0x28')][_0x183e('0x38')]},routingClient)[_0x183e('0x6')](respondWithResult(_0x2df5d6,null))[_0x183e('0xb')](handleError(_0x2df5d6,null));};exports[_0x183e('0x39')]=function(_0x1cdb1d,_0x41d772){return respondWithRpcPromise('Telephones',_0x1cdb1d['query'])['then'](respondWithResult(_0x41d772,null))[_0x183e('0xb')](handleError(_0x41d772,null));};exports['trunks']=function(_0x40c208,_0x5715ce){return respondWithRpcPromise(_0x183e('0x3a'),_0x40c208['query'])[_0x183e('0x6')](respondWithResult(_0x5715ce,null))[_0x183e('0xb')](handleError(_0x5715ce,null));};exports[_0x183e('0x3b')]=function(_0x34e60b,_0x3af772){return respondWithRpcPromise('Campaigns',_0x34e60b[_0x183e('0x16')])[_0x183e('0x6')](respondWithResult(_0x3af772,null))[_0x183e('0xb')](handleError(_0x3af772,null));};exports[_0x183e('0x3c')]=function(_0x1df347,_0x1c3497){return respondWithRpcPromise(_0x183e('0x3d'),_0x1df347[_0x183e('0x16')],routingClient)['then'](respondWithResult(_0x1c3497,null))[_0x183e('0xb')](handleError(_0x1c3497,null));};exports[_0x183e('0x3e')]=function(_0x40710b,_0x33c31e){return respondWithRpcPromise(_0x183e('0x3d'),_0x40710b[_0x183e('0x16')],routingClient)[_0x183e('0x6')](findById(_0x40710b[_0x183e('0x1c')]['id']))[_0x183e('0x6')](respondWithResult(_0x33c31e,null))['catch'](handleError(_0x33c31e,null));};exports[_0x183e('0x3f')]=function(_0x12e93f,_0x4f258c){return respondWithRpcPromise('MailQueues',_0x12e93f['query'],routingClient)['then'](respondWithResult(_0x4f258c,null))[_0x183e('0xb')](handleError(_0x4f258c,null));};exports[_0x183e('0x40')]=function(_0xf2b0df,_0x495bc5){return respondWithRpcPromise('MailQueues',_0xf2b0df[_0x183e('0x16')],routingClient)[_0x183e('0x6')](findById(_0xf2b0df[_0x183e('0x1c')]['id']))[_0x183e('0x6')](respondWithResult(_0x495bc5,null))['catch'](handleError(_0x495bc5,null));};exports[_0x183e('0x41')]=function(_0x267959,_0x2a0c19){return respondWithRpcPromise(_0x183e('0x42'),_0x267959['query'],mailClient)[_0x183e('0x6')](respondWithResult(_0x2a0c19,null))[_0x183e('0xb')](handleError(_0x2a0c19,null));};exports[_0x183e('0x43')]=function(_0x262893,_0xf4f758){return respondWithRpcPromise(_0x183e('0x44'),_0x262893[_0x183e('0x16')],routingClient)[_0x183e('0x6')](respondWithResult(_0xf4f758,null))[_0x183e('0xb')](handleError(_0xf4f758,null));};exports[_0x183e('0x45')]=function(_0x3bb1df,_0x19668c){return respondWithRpcPromise(_0x183e('0x44'),_0x3bb1df[_0x183e('0x16')],routingClient)[_0x183e('0x6')](findById(_0x3bb1df[_0x183e('0x1c')]['id']))['then'](respondWithResult(_0x19668c,null))[_0x183e('0xb')](handleError(_0x19668c,null));};exports[_0x183e('0x46')]=function(_0x5f5c96,_0x5b3595){return respondWithRpcPromise(_0x183e('0x47'),_0x5f5c96['query'],routingClient)[_0x183e('0x6')](respondWithResult(_0x5b3595,null))[_0x183e('0xb')](handleError(_0x5b3595,null));};exports[_0x183e('0x48')]=function(_0x2aa02d,_0xf94e58){return respondWithRpcPromise(_0x183e('0x47'),_0x2aa02d[_0x183e('0x16')],routingClient)[_0x183e('0x6')](findById(_0x2aa02d[_0x183e('0x1c')]['id']))['then'](respondWithResult(_0xf94e58,null))[_0x183e('0xb')](handleError(_0xf94e58,null));};exports['whatsappQueues']=function(_0x5bf9d9,_0x457f4f){return respondWithRpcPromise(_0x183e('0x49'),_0x5bf9d9[_0x183e('0x16')],routingClient)[_0x183e('0x6')](respondWithResult(_0x457f4f,null))[_0x183e('0xb')](handleError(_0x457f4f,null));};exports[_0x183e('0x4a')]=function(_0x5470d7,_0x359fef){return respondWithRpcPromise('WhatsappQueues',_0x5470d7[_0x183e('0x16')],routingClient)[_0x183e('0x6')](findById(_0x5470d7[_0x183e('0x1c')]['id']))[_0x183e('0x6')](respondWithResult(_0x359fef,null))[_0x183e('0xb')](handleError(_0x359fef,null));};exports['faxQueues']=function(_0x3aba35,_0x12502b){return respondWithRpcPromise('FaxQueues',_0x3aba35[_0x183e('0x16')],routingClient)[_0x183e('0x6')](respondWithResult(_0x12502b,null))[_0x183e('0xb')](handleError(_0x12502b,null));};exports['showFaxQueues']=function(_0xeb625a,_0x5a9da2){return respondWithRpcPromise(_0x183e('0x4b'),_0xeb625a[_0x183e('0x16')],routingClient)[_0x183e('0x6')](findById(_0xeb625a[_0x183e('0x1c')]['id']))[_0x183e('0x6')](respondWithResult(_0x5a9da2,null))[_0x183e('0xb')](handleError(_0x5a9da2,null));};exports[_0x183e('0x4c')]=function(_0x24a6d7,_0x423605){return respondWithRpcPromise(_0x183e('0x4d'),_0x24a6d7['query'])[_0x183e('0x6')](respondWithResult(_0x423605,null))['catch'](handleError(_0x423605,null));};exports[_0x183e('0x4e')]=function(_0x2d1ea2,_0x3ee2ad){return respondWithRpcPromise(_0x183e('0x4f'),_0x2d1ea2['query'],routingClient)[_0x183e('0x6')](respondWithResult(_0x3ee2ad,null))[_0x183e('0xb')](handleError(_0x3ee2ad,null));};exports[_0x183e('0x50')]=function(_0x43538d,_0x3b41c3){return respondWithRpcPromise(_0x183e('0x51'),_0x43538d[_0x183e('0x16')],routingClient)[_0x183e('0x6')](respondWithResult(_0x3b41c3,null))[_0x183e('0xb')](handleError(_0x3b41c3,null));};exports[_0x183e('0x52')]=function(_0x310713,_0x1989b7){return respondWithRpcPromise(_0x183e('0x53'),_0x310713[_0x183e('0x16')],routingClient)[_0x183e('0x6')](respondWithResult(_0x1989b7,null))['catch'](handleError(_0x1989b7,null));};exports[_0x183e('0x54')]=function(_0x5affea,_0x1bdaf7){return respondWithRpcPromise(_0x183e('0x55'),_0x5affea[_0x183e('0x16')],routingClient)[_0x183e('0x6')](respondWithResult(_0x1bdaf7,null))['catch'](handleError(_0x1bdaf7,null));};exports[_0x183e('0x56')]=function(_0x20fdd7,_0x3f0a97){return respondWithRpcPromise(_0x183e('0x57'),_0x20fdd7[_0x183e('0x16')],routingClient)[_0x183e('0x6')](respondWithResult(_0x3f0a97,null))[_0x183e('0xb')](handleError(_0x3f0a97,null));};exports['faxQueuesWaitingInteractions']=function(_0x3d15a2,_0x23b1f8){return respondWithRpcPromise(_0x183e('0x58'),_0x3d15a2[_0x183e('0x16')],routingClient)[_0x183e('0x6')](respondWithResult(_0x23b1f8,null))[_0x183e('0xb')](handleError(_0x23b1f8,null));};exports[_0x183e('0x59')]=function(_0x574c9e){return function(_0x37cf76,_0x2cacbf){var _0x4aee7d,_0x5136b5;var _0x458b54=_[_0x183e('0x5a')](_0x574c9e);var _0x13671e=_0x574c9e===_0x183e('0x5b')?_0x183e('0x5c'):'Account';return db[_0x458b54+'Queue'][_0x183e('0x5d')]({'raw':!![],'where':{'id':_0x37cf76[_0x183e('0x1c')]['id']}})[_0x183e('0x6')](function(_0x3618b7){if(_[_0x183e('0x12')](_0x3618b7)){throw new Error(_0x458b54+_0x183e('0x5e'));}_0x4aee7d=_0x3618b7;return db[_0x458b54+_0x183e('0x5f')]['findOne']({'where':{'id':_0x37cf76[_0x183e('0x28')][_0x183e('0x60')]},'include':[{'model':db[_0x458b54+'Interaction'],'as':_0x183e('0x61')},{'model':db[_0x458b54+_0x13671e],'as':_0x183e('0x62')}]});})[_0x183e('0x6')](function(_0x45c13e){if(_[_0x183e('0x12')](_0x45c13e)){throw new Error(_0x458b54+'\x20Message\x20not\x20found');}_0x5136b5=_0x45c13e;return _0x45c13e[_0x183e('0x63')]({'read':0x0,'readAt':null,'UserId':null});})[_0x183e('0x6')](function(){var _0x509207={'uniqueid':_0x574c9e+'.'+_0x5136b5['id']+'.'+_0x5136b5[_0x183e('0x61')]['id'],'FromUserId':_0x37cf76['user']['id'],'type':_0x183e('0x64')};_0x509207[_0x458b54+_0x183e('0x65')]=_0x5136b5['id'];_0x509207[_0x458b54+_0x183e('0x66')]=_0x5136b5[_0x183e('0x61')]['id'];_0x509207[_0x183e('0x67')+_0x458b54+_0x13671e+'Id']=_0x5136b5[_0x183e('0x62')]['id'];_0x509207['To'+_0x458b54+_0x183e('0x68')]=_0x4aee7d['id'];return db[_0x458b54+_0x183e('0x69')][_0x183e('0x6a')](_0x509207);})[_0x183e('0x6')](function(){return respondWithRpcPromise(_0x183e('0x6b'),{'channel':_0x574c9e,'interaction':_0x5136b5['Interaction'],'message':_0x5136b5,'account':_0x5136b5[_0x183e('0x62')],'applications':[{'id':0x0,'priority':0x1,'app':_0x183e('0x64'),'appdata':_0x4aee7d['name']+','+(_0x5136b5['Account'][_0x183e('0x6c')]||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0x183e('0x6')](respondWithResult(_0x2cacbf,null))[_0x183e('0xb')](handleError(_0x2cacbf,null));};};exports[_0x183e('0x6d')]=function(_0x2e524b,_0x19280e){var _0x237602,_0x594166;if(_[_0x183e('0x12')](_0x2e524b[_0x183e('0x28')][_0x183e('0x6e')])){throw new Error(_0x183e('0x6f'));}var _0x364763=_0x2e524b['body'][_0x183e('0x6e')];var _0x409772=_[_0x183e('0x5a')](_0x364763);var _0x508862=_0x364763===_0x183e('0x5b')?_0x183e('0x5c'):'Account';return db[_0x183e('0x70')][_0x183e('0x5d')]({'raw':!![],'where':{'id':_0x2e524b[_0x183e('0x1c')]['id'],'role':_0x183e('0x35')}})[_0x183e('0x6')](function(_0x3f496b){if(_[_0x183e('0x12')](_0x3f496b)){throw new Error(_0x183e('0x71'));}_0x237602=_0x3f496b;return db[_0x409772+_0x183e('0x5f')][_0x183e('0x5d')]({'where':{'id':_0x2e524b[_0x183e('0x28')][_0x183e('0x60')]},'include':[{'model':db[_0x409772+'Interaction'],'as':_0x183e('0x61')},{'model':db[_0x409772+_0x508862],'as':_0x183e('0x62')}]});})[_0x183e('0x6')](function(_0xdbccb7){if(_[_0x183e('0x12')](_0xdbccb7)){throw new Error(_0x409772+_0x183e('0x72'));}_0x594166=_0xdbccb7;return _0xdbccb7[_0x183e('0x63')]({'read':0x0,'readAt':null,'UserId':null});})[_0x183e('0x6')](function(){var _0x1c046e={'uniqueid':_0x364763+'.'+_0x594166['id']+'.'+_0x594166[_0x183e('0x61')]['id'],'FromUserId':_0x2e524b[_0x183e('0x2a')]['id'],'type':_0x183e('0x64'),'ToUserId':_0x237602['id']};_0x1c046e[_0x409772+_0x183e('0x65')]=_0x594166['id'];_0x1c046e[_0x409772+_0x183e('0x66')]=_0x594166[_0x183e('0x61')]['id'];_0x1c046e[_0x183e('0x67')+_0x409772+_0x508862+'Id']=_0x594166['Account']['id'];return db[_0x409772+_0x183e('0x69')][_0x183e('0x6a')](_0x1c046e);})['then'](function(){return respondWithRpcPromise(_0x183e('0x6b'),{'channel':_0x364763,'interaction':_0x594166[_0x183e('0x61')],'message':_0x594166,'account':_0x594166['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0x183e('0x35'),'appdata':_0x237602[_0x183e('0xf')]+','+(_0x594166[_0x183e('0x62')][_0x183e('0x73')]||0x12c),'interval':_0x183e('0x74')}]},routingClient);})[_0x183e('0x6')](respondWithResult(_0x19280e,null))['catch'](handleError(_0x19280e,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index ec42cd8..6f7003e 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 _0xed18=['express','Router','./schedule.controller','get','isAuthenticated','index','show','/:id/run','run','post','/:id','update','delete','exports','multer','util','path','connect-timeout'];(function(_0x2519bc,_0x3ec718){var _0x2be753=function(_0x464ab4){while(--_0x464ab4){_0x2519bc['push'](_0x2519bc['shift']());}};_0x2be753(++_0x3ec718);}(_0xed18,0x1d0));var _0x8ed1=function(_0x3a465a,_0x3e8001){_0x3a465a=_0x3a465a-0x0;var _0x1ed244=_0xed18[_0x3a465a];return _0x1ed244;};'use strict';var multer=require(_0x8ed1('0x0'));var util=require(_0x8ed1('0x1'));var path=require(_0x8ed1('0x2'));var timeout=require(_0x8ed1('0x3'));var express=require(_0x8ed1('0x4'));var router=express[_0x8ed1('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x8ed1('0x6'));router[_0x8ed1('0x7')]('/',auth[_0x8ed1('0x8')](),controller[_0x8ed1('0x9')]);router[_0x8ed1('0x7')]('/:id',auth[_0x8ed1('0x8')](),controller[_0x8ed1('0xa')]);router[_0x8ed1('0x7')](_0x8ed1('0xb'),auth[_0x8ed1('0x8')](),controller[_0x8ed1('0xc')]);router[_0x8ed1('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x8ed1('0xe'),auth[_0x8ed1('0x8')](),controller[_0x8ed1('0xf')]);router[_0x8ed1('0x10')](_0x8ed1('0xe'),auth[_0x8ed1('0x8')](),controller['destroy']);module[_0x8ed1('0x11')]=router; \ No newline at end of file +var _0xb37e=['show','/:id/run','run','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./schedule.controller','get','isAuthenticated','index','/:id'];(function(_0x3493c8,_0x3531ea){var _0x3fdb36=function(_0x5526ea){while(--_0x5526ea){_0x3493c8['push'](_0x3493c8['shift']());}};_0x3fdb36(++_0x3531ea);}(_0xb37e,0x111));var _0xeb37=function(_0x267bdc,_0x1d2899){_0x267bdc=_0x267bdc-0x0;var _0x58fc3c=_0xb37e[_0x267bdc];return _0x58fc3c;};'use strict';var multer=require(_0xeb37('0x0'));var util=require(_0xeb37('0x1'));var path=require(_0xeb37('0x2'));var timeout=require(_0xeb37('0x3'));var express=require(_0xeb37('0x4'));var router=express[_0xeb37('0x5')]();var auth=require(_0xeb37('0x6'));var interaction=require(_0xeb37('0x7'));var config=require('../../config/environment');var controller=require(_0xeb37('0x8'));router[_0xeb37('0x9')]('/',auth[_0xeb37('0xa')](),controller[_0xeb37('0xb')]);router['get'](_0xeb37('0xc'),auth['isAuthenticated'](),controller[_0xeb37('0xd')]);router[_0xeb37('0x9')](_0xeb37('0xe'),auth['isAuthenticated'](),controller[_0xeb37('0xf')]);router['post']('/',auth[_0xeb37('0xa')](),controller[_0xeb37('0x10')]);router[_0xeb37('0x11')](_0xeb37('0xc'),auth[_0xeb37('0xa')](),controller[_0xeb37('0x12')]);router[_0xeb37('0x13')](_0xeb37('0xc'),auth[_0xeb37('0xa')](),controller[_0xeb37('0x14')]);module[_0xeb37('0x15')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index a10f2ac..4ec139f 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 _0x14b2=['csv','custom','TEXT','sequelize','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','quarters','months','weeks','days','hours','minutes','ENUM','pdf'];(function(_0x26a80a,_0x48460d){var _0x3cf276=function(_0x29a291){while(--_0x29a291){_0x26a80a['push'](_0x26a80a['shift']());}};_0x3cf276(++_0x48460d);}(_0x14b2,0x1a1));var _0x214b=function(_0x1a1b4e,_0x15d0ee){_0x1a1b4e=_0x1a1b4e-0x0;var _0x5cc883=_0x14b2[_0x1a1b4e];return _0x5cc883;};'use strict';var Sequelize=require(_0x214b('0x0'));module[_0x214b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x214b('0x2')]},'active':{'type':Sequelize[_0x214b('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x214b('0x2')],'allowNull':![],'defaultValue':_0x214b('0x4')},'startAt':{'type':Sequelize['DATE'],'allowNull':![]},'endAt':{'type':Sequelize[_0x214b('0x5')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x214b('0x6')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize['ENUM']('years',_0x214b('0x7'),_0x214b('0x8'),_0x214b('0x9'),_0x214b('0xa'),_0x214b('0xb'),_0x214b('0xc')),'allowNull':![],'defaultValue':'days'},'output':{'type':Sequelize[_0x214b('0xd')]('csv',_0x214b('0xe'),'xlsx'),'allowNull':![],'defaultValue':_0x214b('0xf')},'type':{'type':Sequelize['ENUM']('custom','default'),'allowNull':![],'defaultValue':_0x214b('0x10')},'sendMail':{'type':Sequelize[_0x214b('0x3')],'defaultValue':![]},'email':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x214b('0x11')]},'bcc':{'type':Sequelize[_0x214b('0x11')]},'sendIfEmpty':{'type':Sequelize[_0x214b('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0xf96b=['pdf','xlsx','custom','default','TEXT','sequelize','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','years','quarters','weeks','days','hours','minutes','csv'];(function(_0x4154a6,_0x2c0b8e){var _0x3b2786=function(_0x2f5936){while(--_0x2f5936){_0x4154a6['push'](_0x4154a6['shift']());}};_0x3b2786(++_0x2c0b8e);}(_0xf96b,0x109));var _0xbf96=function(_0x26015e,_0x2d2d9c){_0x26015e=_0x26015e-0x0;var _0x164f02=_0xf96b[_0x26015e];return _0x164f02;};'use strict';var Sequelize=require(_0xbf96('0x0'));module[_0xbf96('0x1')]={'name':{'type':Sequelize[_0xbf96('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xbf96('0x2')]},'active':{'type':Sequelize[_0xbf96('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xbf96('0x2')],'allowNull':![],'defaultValue':_0xbf96('0x4')},'startAt':{'type':Sequelize[_0xbf96('0x5')],'allowNull':![]},'endAt':{'type':Sequelize[_0xbf96('0x5')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xbf96('0x6')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xbf96('0x7')](_0xbf96('0x8'),_0xbf96('0x9'),'months',_0xbf96('0xa'),_0xbf96('0xb'),_0xbf96('0xc'),_0xbf96('0xd')),'allowNull':![],'defaultValue':'days'},'output':{'type':Sequelize[_0xbf96('0x7')](_0xbf96('0xe'),_0xbf96('0xf'),_0xbf96('0x10')),'allowNull':![],'defaultValue':_0xbf96('0xe')},'type':{'type':Sequelize[_0xbf96('0x7')](_0xbf96('0x11'),_0xbf96('0x12')),'allowNull':![],'defaultValue':'custom'},'sendMail':{'type':Sequelize[_0xbf96('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0xbf96('0x2')]},'cc':{'type':Sequelize['TEXT']},'bcc':{'type':Sequelize[_0xbf96('0x13')]},'sendIfEmpty':{'type':Sequelize[_0xbf96('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 30f871a..0623aff 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 _0x9314=['include','catch','show','params','merge','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','update','body','run','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','limit','set','Content-Range','apply','reject','then','destroy','get','Scheduler','UserProfileResource','error','stack','name','send','index','rawAttributes','type','model','map','query','keys','attributes','intersection','fields','length','hasOwnProperty','offset','order','sort','where','filters','pick','VIRTUAL','filter','Schedule','includeAll'];(function(_0x47a7d0,_0x4e182d){var _0xb9bd08=function(_0x588ee2){while(--_0x588ee2){_0x47a7d0['push'](_0x47a7d0['shift']());}};_0xb9bd08(++_0x4e182d);}(_0x9314,0xb2));var _0x4931=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x9314[_0x4b369d];return _0x571a98;};'use strict';var pdf=require(_0x4931('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x4931('0x1'));var zipdir=require(_0x4931('0x2'));var jsonpatch=require(_0x4931('0x3'));var rp=require(_0x4931('0x4'));var moment=require(_0x4931('0x5'));var BPromise=require(_0x4931('0x6'));var Mustache=require(_0x4931('0x7'));var util=require(_0x4931('0x8'));var path=require(_0x4931('0x9'));var sox=require(_0x4931('0xa'));var csv=require('to-csv');var ejs=require(_0x4931('0xb'));var fs=require('fs');var _=require(_0x4931('0xc'));var squel=require(_0x4931('0xd'));var crypto=require(_0x4931('0xe'));var jsforce=require(_0x4931('0xf'));var deskjs=require(_0x4931('0x10'));var toCsv=require(_0x4931('0x11'));var querystring=require(_0x4931('0x12'));var Papa=require(_0x4931('0x13'));var Redis=require(_0x4931('0x14'));var authService=require(_0x4931('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0x4931('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4931('0x17'))(_0x4931('0x18'));var utils=require('../../config/utils');var config=require(_0x4931('0x19'));var db=require(_0x4931('0x1a'))['db'];function respondWithStatusCode(_0x45a95e,_0xd37a4f){_0xd37a4f=_0xd37a4f||0xcc;return function(_0x4278e7){if(_0x4278e7){return _0x45a95e[_0x4931('0x1b')](_0xd37a4f);}return _0x45a95e[_0x4931('0x1c')](_0xd37a4f)[_0x4931('0x1d')]();};}function respondWithResult(_0x3c6442,_0x1f2a66){_0x1f2a66=_0x1f2a66||0xc8;return function(_0x1a215a){if(_0x1a215a){return _0x3c6442['status'](_0x1f2a66)[_0x4931('0x1e')](_0x1a215a);}};}function respondWithFilteredResult(_0x231727,_0x149d32){return function(_0x1cbd48){if(_0x1cbd48){var _0x9cf636=_0x1cbd48[_0x4931('0x1f')],_0x19b80d=_0x149d32['offset'],_0x544e51=_0x149d32['offset']+_0x149d32[_0x4931('0x20')],_0x13851f;if(_0x544e51>=_0x9cf636){_0x544e51=_0x9cf636;_0x13851f=0xc8;}else{_0x13851f=0xce;}_0x231727['status'](_0x13851f);return _0x231727[_0x4931('0x21')](_0x4931('0x22'),_0x19b80d+'-'+_0x544e51+'/'+_0x9cf636)[_0x4931('0x1e')](_0x1cbd48);}return null;};}function patchUpdates(_0x219201){return function(_0x5771cf){try{jsonpatch[_0x4931('0x23')](_0x5771cf,_0x219201,!![]);}catch(_0x14d148){return BPromise[_0x4931('0x24')](_0x14d148);}return _0x5771cf['save']();};}function saveUpdates(_0x4cba9c,_0x8fa253){return function(_0x37c2b2){if(_0x37c2b2){return _0x37c2b2['update'](_0x4cba9c)[_0x4931('0x25')](function(_0x4c4d64){return _0x4c4d64;});}return null;};}function removeEntity(_0x48ca44,_0x3e9e2b){return function(_0x4fddc3){if(_0x4fddc3){return _0x4fddc3[_0x4931('0x26')]()['then'](function(){var _0x3029ae=_0x4fddc3[_0x4931('0x27')]({'plain':!![]});var _0x2bcca9=_0x4931('0x28');return db[_0x4931('0x29')][_0x4931('0x26')]({'where':{'type':_0x2bcca9,'resourceId':_0x3029ae['id']}})[_0x4931('0x25')](function(){return _0x4fddc3;});})[_0x4931('0x25')](function(){_0x48ca44[_0x4931('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0xc92044,_0x41fdb6){return function(_0x382a42){if(!_0x382a42){_0xc92044[_0x4931('0x1b')](0x194);}return _0x382a42;};}function handleError(_0x44a33f,_0x3b8592){_0x3b8592=_0x3b8592||0x1f4;return function(_0x52fb94){logger[_0x4931('0x2a')](_0x52fb94[_0x4931('0x2b')]);if(_0x52fb94['name']){delete _0x52fb94[_0x4931('0x2c')];}_0x44a33f['status'](_0x3b8592)[_0x4931('0x2d')](_0x52fb94);};}exports[_0x4931('0x2e')]=function(_0x17c504,_0x4598c4){var _0x459018={},_0x2acbe2={},_0x3f7f48={'count':0x0,'rows':[]};var _0x585c9a=_['map'](db['Schedule'][_0x4931('0x2f')],function(_0x407a8b){return{'name':_0x407a8b['fieldName'],'type':_0x407a8b[_0x4931('0x30')]['key']};});_0x2acbe2[_0x4931('0x31')]=_[_0x4931('0x32')](_0x585c9a,_0x4931('0x2c'));_0x2acbe2[_0x4931('0x33')]=_[_0x4931('0x34')](_0x17c504[_0x4931('0x33')]);_0x2acbe2['filters']=_['intersection'](_0x2acbe2['model'],_0x2acbe2['query']);_0x459018[_0x4931('0x35')]=_[_0x4931('0x36')](_0x2acbe2[_0x4931('0x31')],qs[_0x4931('0x37')](_0x17c504[_0x4931('0x33')][_0x4931('0x37')]));_0x459018[_0x4931('0x35')]=_0x459018[_0x4931('0x35')][_0x4931('0x38')]?_0x459018['attributes']:_0x2acbe2[_0x4931('0x31')];if(!_0x17c504[_0x4931('0x33')][_0x4931('0x39')]('nolimit')){_0x459018['limit']=qs[_0x4931('0x20')](_0x17c504['query']['limit']);_0x459018[_0x4931('0x3a')]=qs[_0x4931('0x3a')](_0x17c504[_0x4931('0x33')]['offset']);}_0x459018[_0x4931('0x3b')]=qs[_0x4931('0x3c')](_0x17c504[_0x4931('0x33')][_0x4931('0x3c')]);_0x459018[_0x4931('0x3d')]=qs[_0x4931('0x3e')](_[_0x4931('0x3f')](_0x17c504['query'],_0x2acbe2[_0x4931('0x3e')]),_0x585c9a);if(_0x17c504[_0x4931('0x33')]['filter']){_0x459018[_0x4931('0x3d')]=_['merge'](_0x459018[_0x4931('0x3d')],{'$or':_[_0x4931('0x32')](_0x585c9a,function(_0x4974af){if(_0x4974af[_0x4931('0x30')]!==_0x4931('0x40')){var _0x463fbd={};_0x463fbd[_0x4974af[_0x4931('0x2c')]]={'$like':'%'+_0x17c504[_0x4931('0x33')][_0x4931('0x41')]+'%'};return _0x463fbd;}})});}_0x459018=_['merge']({},_0x459018,_0x17c504['options']);var _0x4817d9={'where':_0x459018[_0x4931('0x3d')]};return db[_0x4931('0x42')]['count'](_0x4817d9)['then'](function(_0x52b9ab){_0x3f7f48[_0x4931('0x1f')]=_0x52b9ab;if(_0x17c504['query'][_0x4931('0x43')]){_0x459018[_0x4931('0x44')]=[{'all':!![]}];}return db[_0x4931('0x42')]['findAll'](_0x459018);})[_0x4931('0x25')](function(_0x17e547){_0x3f7f48['rows']=_0x17e547;return _0x3f7f48;})['then'](respondWithFilteredResult(_0x4598c4,_0x459018))[_0x4931('0x45')](handleError(_0x4598c4,null));};exports[_0x4931('0x46')]=function(_0x70407c,_0x12007e){var _0x12f8d7={'raw':![],'where':{'id':_0x70407c[_0x4931('0x47')]['id']}},_0x34d503={};_0x34d503[_0x4931('0x31')]=_[_0x4931('0x34')](db[_0x4931('0x42')][_0x4931('0x2f')]);_0x34d503[_0x4931('0x33')]=_[_0x4931('0x34')](_0x70407c[_0x4931('0x33')]);_0x34d503['filters']=_[_0x4931('0x36')](_0x34d503[_0x4931('0x31')],_0x34d503[_0x4931('0x33')]);_0x12f8d7[_0x4931('0x35')]=_[_0x4931('0x36')](_0x34d503[_0x4931('0x31')],qs['fields'](_0x70407c['query']['fields']));_0x12f8d7['attributes']=_0x12f8d7[_0x4931('0x35')][_0x4931('0x38')]?_0x12f8d7['attributes']:_0x34d503[_0x4931('0x31')];if(_0x70407c[_0x4931('0x33')][_0x4931('0x43')]){_0x12f8d7[_0x4931('0x44')]=[{'all':!![]}];}_0x12f8d7=_[_0x4931('0x48')]({},_0x12f8d7,_0x70407c['options']);return db[_0x4931('0x42')][_0x4931('0x49')](_0x12f8d7)[_0x4931('0x25')](handleEntityNotFound(_0x12007e,null))[_0x4931('0x25')](respondWithResult(_0x12007e,null))['catch'](handleError(_0x12007e,null));};exports[_0x4931('0x4a')]=function(_0x13d899,_0xd7d292){return db[_0x4931('0x42')][_0x4931('0x4a')](_0x13d899['body'],{})[_0x4931('0x25')](function(_0x299d4a){var _0x58fe2f=_0x13d899['user'][_0x4931('0x27')]({'plain':!![]});if(!_0x58fe2f)throw new Error(_0x4931('0x4b'));if(_0x58fe2f[_0x4931('0x4c')]==='user'){var _0x3b4bf0=_0x299d4a['get']({'plain':!![]});var _0x1c258a=_0x4931('0x28');return db['UserProfileSection'][_0x4931('0x49')]({'where':{'name':_0x1c258a,'userProfileId':_0x58fe2f[_0x4931('0x4d')]},'raw':!![]})[_0x4931('0x25')](function(_0x5bb46f){if(_0x5bb46f&&_0x5bb46f[_0x4931('0x4e')]===0x0){return db[_0x4931('0x29')][_0x4931('0x4a')]({'name':_0x3b4bf0[_0x4931('0x2c')],'resourceId':_0x3b4bf0['id'],'type':_0x5bb46f[_0x4931('0x2c')],'sectionId':_0x5bb46f['id']},{})[_0x4931('0x25')](function(){return _0x299d4a;});}else{return _0x299d4a;}})['catch'](function(_0x575280){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x575280);throw _0x575280;});}return _0x299d4a;})[_0x4931('0x25')](respondWithResult(_0xd7d292,0xc9))['catch'](handleError(_0xd7d292,null));};exports[_0x4931('0x4f')]=function(_0x28b55a,_0xa26fc5){if(_0x28b55a[_0x4931('0x50')]['id']){delete _0x28b55a['body']['id'];}return db['Schedule']['find']({'where':{'id':_0x28b55a['params']['id']}})[_0x4931('0x25')](handleEntityNotFound(_0xa26fc5,null))[_0x4931('0x25')](saveUpdates(_0x28b55a['body'],null))[_0x4931('0x25')](respondWithResult(_0xa26fc5,null))[_0x4931('0x45')](handleError(_0xa26fc5,null));};exports['destroy']=function(_0x1462c0,_0x26d7be){return db[_0x4931('0x42')][_0x4931('0x49')]({'where':{'id':_0x1462c0[_0x4931('0x47')]['id']}})[_0x4931('0x25')](handleEntityNotFound(_0x26d7be,null))['then'](removeEntity(_0x26d7be,null))[_0x4931('0x45')](handleError(_0x26d7be,null));};exports[_0x4931('0x51')]=function(_0x103ec9,_0x4dd562,_0x49d28d){var _0x228158=require('../../config/schedule');return db[_0x4931('0x42')]['find']({'where':{'id':_0x103ec9[_0x4931('0x47')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x4dd562,null))['then'](function(){_0x228158[_0x4931('0x51')](_0x103ec9[_0x4931('0x47')]['id']);})['then'](respondWithStatusCode(_0x4dd562,null))[_0x4931('0x45')](handleError(_0x4dd562,null));}; \ No newline at end of file +var _0xb1d4=['../../config/schedule','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','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','end','status','offset','limit','set','Content-Range','json','reject','save','then','get','sendStatus','stack','name','send','map','fieldName','type','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','merge','options','includeAll','include','Schedule','findAll','catch','show','params','rawAttributes','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Scheduler','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update'];(function(_0x39f425,_0x1b9150){var _0xc14c86=function(_0x11bbba){while(--_0x11bbba){_0x39f425['push'](_0x39f425['shift']());}};_0xc14c86(++_0x1b9150);}(_0xb1d4,0xf7));var _0x4b1d=function(_0x5da877,_0x361726){_0x5da877=_0x5da877-0x0;var _0x3f2c10=_0xb1d4[_0x5da877];return _0x3f2c10;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x4b1d('0x0'));var rimraf=require(_0x4b1d('0x1'));var zipdir=require(_0x4b1d('0x2'));var jsonpatch=require(_0x4b1d('0x3'));var rp=require(_0x4b1d('0x4'));var moment=require(_0x4b1d('0x5'));var BPromise=require(_0x4b1d('0x6'));var Mustache=require(_0x4b1d('0x7'));var util=require(_0x4b1d('0x8'));var path=require('path');var sox=require(_0x4b1d('0x9'));var csv=require(_0x4b1d('0xa'));var ejs=require(_0x4b1d('0xb'));var fs=require('fs');var _=require(_0x4b1d('0xc'));var squel=require(_0x4b1d('0xd'));var crypto=require('crypto');var jsforce=require(_0x4b1d('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4b1d('0xf'));var Papa=require(_0x4b1d('0x10'));var Redis=require(_0x4b1d('0x11'));var authService=require(_0x4b1d('0x12'));var qs=require(_0x4b1d('0x13'));var as=require(_0x4b1d('0x14'));var hardwareService=require(_0x4b1d('0x15'));var logger=require(_0x4b1d('0x16'))(_0x4b1d('0x17'));var utils=require(_0x4b1d('0x18'));var config=require(_0x4b1d('0x19'));var db=require(_0x4b1d('0x1a'))['db'];function respondWithStatusCode(_0x283d61,_0x214f3e){_0x214f3e=_0x214f3e||0xcc;return function(_0x2b0cd2){if(_0x2b0cd2){return _0x283d61['sendStatus'](_0x214f3e);}return _0x283d61['status'](_0x214f3e)[_0x4b1d('0x1b')]();};}function respondWithResult(_0x42d3b6,_0x1a28fc){_0x1a28fc=_0x1a28fc||0xc8;return function(_0x307096){if(_0x307096){return _0x42d3b6[_0x4b1d('0x1c')](_0x1a28fc)['json'](_0x307096);}};}function respondWithFilteredResult(_0x440602,_0x4a234f){return function(_0x18dc11){if(_0x18dc11){var _0x438cb4=_0x18dc11['count'],_0x13844b=_0x4a234f[_0x4b1d('0x1d')],_0x5c7f9c=_0x4a234f[_0x4b1d('0x1d')]+_0x4a234f[_0x4b1d('0x1e')],_0x226293;if(_0x5c7f9c>=_0x438cb4){_0x5c7f9c=_0x438cb4;_0x226293=0xc8;}else{_0x226293=0xce;}_0x440602[_0x4b1d('0x1c')](_0x226293);return _0x440602[_0x4b1d('0x1f')](_0x4b1d('0x20'),_0x13844b+'-'+_0x5c7f9c+'/'+_0x438cb4)[_0x4b1d('0x21')](_0x18dc11);}return null;};}function patchUpdates(_0x59a381){return function(_0xd69a2c){try{jsonpatch['apply'](_0xd69a2c,_0x59a381,!![]);}catch(_0x4430fc){return BPromise[_0x4b1d('0x22')](_0x4430fc);}return _0xd69a2c[_0x4b1d('0x23')]();};}function saveUpdates(_0x2efcfa,_0x3fe93c){return function(_0x47eedd){if(_0x47eedd){return _0x47eedd['update'](_0x2efcfa)[_0x4b1d('0x24')](function(_0x24f19b){return _0x24f19b;});}return null;};}function removeEntity(_0x5c4182,_0xc72da8){return function(_0x44bfd0){if(_0x44bfd0){return _0x44bfd0['destroy']()['then'](function(){var _0xab0997=_0x44bfd0[_0x4b1d('0x25')]({'plain':!![]});var _0x1b8196='Scheduler';return db['UserProfileResource']['destroy']({'where':{'type':_0x1b8196,'resourceId':_0xab0997['id']}})['then'](function(){return _0x44bfd0;});})[_0x4b1d('0x24')](function(){_0x5c4182[_0x4b1d('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4e3d90,_0x2d920b){return function(_0x3593c2){if(!_0x3593c2){_0x4e3d90[_0x4b1d('0x26')](0x194);}return _0x3593c2;};}function handleError(_0x30edcd,_0xa6b559){_0xa6b559=_0xa6b559||0x1f4;return function(_0x74babc){logger['error'](_0x74babc[_0x4b1d('0x27')]);if(_0x74babc[_0x4b1d('0x28')]){delete _0x74babc[_0x4b1d('0x28')];}_0x30edcd[_0x4b1d('0x1c')](_0xa6b559)[_0x4b1d('0x29')](_0x74babc);};}exports['index']=function(_0x2b47ff,_0x31344f){var _0x141edb={},_0x3a0345={},_0x328f5a={'count':0x0,'rows':[]};var _0x23bc1c=_[_0x4b1d('0x2a')](db['Schedule']['rawAttributes'],function(_0x20762f){return{'name':_0x20762f[_0x4b1d('0x2b')],'type':_0x20762f[_0x4b1d('0x2c')]['key']};});_0x3a0345['model']=_[_0x4b1d('0x2a')](_0x23bc1c,_0x4b1d('0x28'));_0x3a0345[_0x4b1d('0x2d')]=_[_0x4b1d('0x2e')](_0x2b47ff[_0x4b1d('0x2d')]);_0x3a0345[_0x4b1d('0x2f')]=_[_0x4b1d('0x30')](_0x3a0345[_0x4b1d('0x31')],_0x3a0345[_0x4b1d('0x2d')]);_0x141edb['attributes']=_['intersection'](_0x3a0345[_0x4b1d('0x31')],qs[_0x4b1d('0x32')](_0x2b47ff[_0x4b1d('0x2d')]['fields']));_0x141edb[_0x4b1d('0x33')]=_0x141edb['attributes'][_0x4b1d('0x34')]?_0x141edb[_0x4b1d('0x33')]:_0x3a0345[_0x4b1d('0x31')];if(!_0x2b47ff[_0x4b1d('0x2d')][_0x4b1d('0x35')](_0x4b1d('0x36'))){_0x141edb[_0x4b1d('0x1e')]=qs[_0x4b1d('0x1e')](_0x2b47ff['query']['limit']);_0x141edb[_0x4b1d('0x1d')]=qs[_0x4b1d('0x1d')](_0x2b47ff[_0x4b1d('0x2d')]['offset']);}_0x141edb[_0x4b1d('0x37')]=qs[_0x4b1d('0x38')](_0x2b47ff[_0x4b1d('0x2d')][_0x4b1d('0x38')]);_0x141edb[_0x4b1d('0x39')]=qs[_0x4b1d('0x2f')](_['pick'](_0x2b47ff[_0x4b1d('0x2d')],_0x3a0345[_0x4b1d('0x2f')]),_0x23bc1c);if(_0x2b47ff['query']['filter']){_0x141edb[_0x4b1d('0x39')]=_['merge'](_0x141edb[_0x4b1d('0x39')],{'$or':_[_0x4b1d('0x2a')](_0x23bc1c,function(_0x5cc171){if(_0x5cc171[_0x4b1d('0x2c')]!==_0x4b1d('0x3a')){var _0xaf1138={};_0xaf1138[_0x5cc171[_0x4b1d('0x28')]]={'$like':'%'+_0x2b47ff[_0x4b1d('0x2d')]['filter']+'%'};return _0xaf1138;}})});}_0x141edb=_[_0x4b1d('0x3b')]({},_0x141edb,_0x2b47ff[_0x4b1d('0x3c')]);var _0xeb1b65={'where':_0x141edb[_0x4b1d('0x39')]};return db['Schedule']['count'](_0xeb1b65)[_0x4b1d('0x24')](function(_0x3768a3){_0x328f5a['count']=_0x3768a3;if(_0x2b47ff[_0x4b1d('0x2d')][_0x4b1d('0x3d')]){_0x141edb[_0x4b1d('0x3e')]=[{'all':!![]}];}return db[_0x4b1d('0x3f')][_0x4b1d('0x40')](_0x141edb);})[_0x4b1d('0x24')](function(_0x5fdfb8){_0x328f5a['rows']=_0x5fdfb8;return _0x328f5a;})[_0x4b1d('0x24')](respondWithFilteredResult(_0x31344f,_0x141edb))[_0x4b1d('0x41')](handleError(_0x31344f,null));};exports[_0x4b1d('0x42')]=function(_0x1f3f09,_0x5bd35f){var _0x3a6e57={'raw':![],'where':{'id':_0x1f3f09[_0x4b1d('0x43')]['id']}},_0x1cd6b0={};_0x1cd6b0[_0x4b1d('0x31')]=_[_0x4b1d('0x2e')](db[_0x4b1d('0x3f')][_0x4b1d('0x44')]);_0x1cd6b0[_0x4b1d('0x2d')]=_['keys'](_0x1f3f09[_0x4b1d('0x2d')]);_0x1cd6b0[_0x4b1d('0x2f')]=_[_0x4b1d('0x30')](_0x1cd6b0[_0x4b1d('0x31')],_0x1cd6b0[_0x4b1d('0x2d')]);_0x3a6e57[_0x4b1d('0x33')]=_[_0x4b1d('0x30')](_0x1cd6b0[_0x4b1d('0x31')],qs[_0x4b1d('0x32')](_0x1f3f09[_0x4b1d('0x2d')][_0x4b1d('0x32')]));_0x3a6e57[_0x4b1d('0x33')]=_0x3a6e57[_0x4b1d('0x33')][_0x4b1d('0x34')]?_0x3a6e57[_0x4b1d('0x33')]:_0x1cd6b0[_0x4b1d('0x31')];if(_0x1f3f09[_0x4b1d('0x2d')]['includeAll']){_0x3a6e57[_0x4b1d('0x3e')]=[{'all':!![]}];}_0x3a6e57=_['merge']({},_0x3a6e57,_0x1f3f09[_0x4b1d('0x3c')]);return db[_0x4b1d('0x3f')][_0x4b1d('0x45')](_0x3a6e57)[_0x4b1d('0x24')](handleEntityNotFound(_0x5bd35f,null))[_0x4b1d('0x24')](respondWithResult(_0x5bd35f,null))[_0x4b1d('0x41')](handleError(_0x5bd35f,null));};exports[_0x4b1d('0x46')]=function(_0xde4a12,_0xf42a41){return db[_0x4b1d('0x3f')][_0x4b1d('0x46')](_0xde4a12[_0x4b1d('0x47')],{})[_0x4b1d('0x24')](function(_0x196b2c){var _0x39066c=_0xde4a12['user']['get']({'plain':!![]});if(!_0x39066c)throw new Error(_0x4b1d('0x48'));if(_0x39066c[_0x4b1d('0x49')]===_0x4b1d('0x4a')){var _0x28ec3f=_0x196b2c['get']({'plain':!![]});var _0x3ab6ce=_0x4b1d('0x4b');return db['UserProfileSection'][_0x4b1d('0x45')]({'where':{'name':_0x3ab6ce,'userProfileId':_0x39066c['userProfileId']},'raw':!![]})['then'](function(_0x5e7cb9){if(_0x5e7cb9&&_0x5e7cb9[_0x4b1d('0x4c')]===0x0){return db[_0x4b1d('0x4d')][_0x4b1d('0x46')]({'name':_0x28ec3f[_0x4b1d('0x28')],'resourceId':_0x28ec3f['id'],'type':_0x5e7cb9[_0x4b1d('0x28')],'sectionId':_0x5e7cb9['id']},{})['then'](function(){return _0x196b2c;});}else{return _0x196b2c;}})['catch'](function(_0x4f394c){logger[_0x4b1d('0x4e')](_0x4b1d('0x4f'),_0x4f394c);throw _0x4f394c;});}return _0x196b2c;})[_0x4b1d('0x24')](respondWithResult(_0xf42a41,0xc9))[_0x4b1d('0x41')](handleError(_0xf42a41,null));};exports[_0x4b1d('0x50')]=function(_0x324802,_0x2145d9){if(_0x324802[_0x4b1d('0x47')]['id']){delete _0x324802['body']['id'];}return db['Schedule'][_0x4b1d('0x45')]({'where':{'id':_0x324802[_0x4b1d('0x43')]['id']}})[_0x4b1d('0x24')](handleEntityNotFound(_0x2145d9,null))[_0x4b1d('0x24')](saveUpdates(_0x324802[_0x4b1d('0x47')],null))[_0x4b1d('0x24')](respondWithResult(_0x2145d9,null))['catch'](handleError(_0x2145d9,null));};exports['destroy']=function(_0x151f17,_0x2dfe08){return db[_0x4b1d('0x3f')][_0x4b1d('0x45')]({'where':{'id':_0x151f17[_0x4b1d('0x43')]['id']}})[_0x4b1d('0x24')](handleEntityNotFound(_0x2dfe08,null))[_0x4b1d('0x24')](removeEntity(_0x2dfe08,null))['catch'](handleError(_0x2dfe08,null));};exports['run']=function(_0x313967,_0x55ec66,_0x52d6ae){var _0x2bb6c8=require(_0x4b1d('0x51'));return db['Schedule'][_0x4b1d('0x45')]({'where':{'id':_0x313967[_0x4b1d('0x43')]['id']},'raw':!![]})[_0x4b1d('0x24')](handleEntityNotFound(_0x55ec66,null))[_0x4b1d('0x24')](function(){_0x2bb6c8['run'](_0x313967[_0x4b1d('0x43')]['id']);})[_0x4b1d('0x24')](respondWithStatusCode(_0x55ec66,null))[_0x4b1d('0x41')](handleError(_0x55ec66,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 04fce58..ee6ac69 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 _0x4a91=['tools_schedules','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./schedule.attributes','exports','define','Schedule'];(function(_0x1b05cd,_0x56e905){var _0x548bb7=function(_0x32df8f){while(--_0x32df8f){_0x1b05cd['push'](_0x1b05cd['shift']());}};_0x548bb7(++_0x56e905);}(_0x4a91,0xb7));var _0x14a9=function(_0x2f45ea,_0x15c656){_0x2f45ea=_0x2f45ea-0x0;var _0x485a84=_0x4a91[_0x2f45ea];return _0x485a84;};'use strict';var _=require(_0x14a9('0x0'));var util=require(_0x14a9('0x1'));var logger=require(_0x14a9('0x2'))('api');var moment=require(_0x14a9('0x3'));var BPromise=require(_0x14a9('0x4'));var rp=require(_0x14a9('0x5'));var fs=require('fs');var path=require(_0x14a9('0x6'));var rimraf=require(_0x14a9('0x7'));var config=require(_0x14a9('0x8'));var attributes=require(_0x14a9('0x9'));module[_0x14a9('0xa')]=function(_0x327fd6,_0x33b036){return _0x327fd6[_0x14a9('0xb')](_0x14a9('0xc'),attributes,{'tableName':_0x14a9('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc6fd=['./schedule.attributes','exports','define','Schedule','tools_schedules','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment'];(function(_0x1007ed,_0x5e841d){var _0x1c8fe1=function(_0x256135){while(--_0x256135){_0x1007ed['push'](_0x1007ed['shift']());}};_0x1c8fe1(++_0x5e841d);}(_0xc6fd,0x1bf));var _0xdc6f=function(_0x291cab,_0x17a287){_0x291cab=_0x291cab-0x0;var _0x5121ae=_0xc6fd[_0x291cab];return _0x5121ae;};'use strict';var _=require(_0xdc6f('0x0'));var util=require(_0xdc6f('0x1'));var logger=require(_0xdc6f('0x2'))(_0xdc6f('0x3'));var moment=require(_0xdc6f('0x4'));var BPromise=require('bluebird');var rp=require(_0xdc6f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdc6f('0x6'));var config=require(_0xdc6f('0x7'));var attributes=require(_0xdc6f('0x8'));module[_0xdc6f('0x9')]=function(_0x34aa6b,_0x3cd48e){return _0x34aa6b[_0xdc6f('0xa')](_0xdc6f('0xb'),attributes,{'tableName':_0xdc6f('0xc'),'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 454360b..2f4a2c4 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 _0x5a73=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','Schedule,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Schedule,\x20%s,\x20%s','message','result','catch','moment','bluebird','randomstring'];(function(_0x765050,_0x23b050){var _0x5a948e=function(_0x5dbe8e){while(--_0x5dbe8e){_0x765050['push'](_0x765050['shift']());}};_0x5a948e(++_0x23b050);}(_0x5a73,0x156));var _0x35a7=function(_0x15ae17,_0x5ee05c){_0x15ae17=_0x15ae17-0x0;var _0x4bea22=_0x5a73[_0x15ae17];return _0x4bea22;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x35a7('0x0'));var BPromise=require(_0x35a7('0x1'));var rs=require(_0x35a7('0x2'));var fs=require('fs');var Redis=require(_0x35a7('0x3'));var db=require(_0x35a7('0x4'))['db'];var utils=require(_0x35a7('0x5'));var logger=require(_0x35a7('0x6'))(_0x35a7('0x7'));var config=require(_0x35a7('0x8'));var jayson=require(_0x35a7('0x9'));var client=jayson[_0x35a7('0xa')][_0x35a7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x44d294,_0x167c8d,_0x43b8c5){return new BPromise(function(_0x513f92,_0x342e39){return client['request'](_0x44d294,_0x43b8c5)[_0x35a7('0xc')](function(_0x3a0f1d){logger[_0x35a7('0xd')]('Schedule,\x20%s,\x20%s',_0x167c8d,'request\x20sent');logger['debug'](_0x35a7('0xe'),_0x167c8d,_0x35a7('0xf'),JSON[_0x35a7('0x10')](_0x3a0f1d));if(_0x3a0f1d[_0x35a7('0x11')]){if(_0x3a0f1d['error'][_0x35a7('0x12')]===0x1f4){logger[_0x35a7('0x11')](_0x35a7('0x13'),_0x167c8d,_0x3a0f1d[_0x35a7('0x11')][_0x35a7('0x14')]);return _0x342e39(_0x3a0f1d[_0x35a7('0x11')][_0x35a7('0x14')]);}logger[_0x35a7('0x11')](_0x35a7('0x13'),_0x167c8d,_0x3a0f1d[_0x35a7('0x11')][_0x35a7('0x14')]);return _0x513f92(_0x3a0f1d[_0x35a7('0x11')][_0x35a7('0x14')]);}else{logger[_0x35a7('0xd')](_0x35a7('0x13'),_0x167c8d,_0x35a7('0xf'));_0x513f92(_0x3a0f1d[_0x35a7('0x15')][_0x35a7('0x14')]);}})[_0x35a7('0x16')](function(_0x347340){logger[_0x35a7('0x11')](_0x35a7('0x13'),_0x167c8d,_0x347340);_0x342e39(_0x347340);});});} \ No newline at end of file +var _0xa4da=['../../config/utils','../../config/logger','../../config/environment','client','http','request','Schedule,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x4e1d03,_0x786f3a){var _0x362d4b=function(_0x1924d2){while(--_0x1924d2){_0x4e1d03['push'](_0x4e1d03['shift']());}};_0x362d4b(++_0x786f3a);}(_0xa4da,0x134));var _0xaa4d=function(_0x20259c,_0xe43fb2){_0x20259c=_0x20259c-0x0;var _0x4d988e=_0xa4da[_0x20259c];return _0x4d988e;};'use strict';var _=require(_0xaa4d('0x0'));var util=require(_0xaa4d('0x1'));var moment=require(_0xaa4d('0x2'));var BPromise=require(_0xaa4d('0x3'));var rs=require(_0xaa4d('0x4'));var fs=require('fs');var Redis=require(_0xaa4d('0x5'));var db=require(_0xaa4d('0x6'))['db'];var utils=require(_0xaa4d('0x7'));var logger=require(_0xaa4d('0x8'))('rpc');var config=require(_0xaa4d('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xaa4d('0xa')][_0xaa4d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x332d5a,_0x27510f,_0x13e492){return new BPromise(function(_0x2331a1,_0x180f20){return client[_0xaa4d('0xc')](_0x332d5a,_0x13e492)['then'](function(_0x5c9783){logger['info'](_0xaa4d('0xd'),_0x27510f,_0xaa4d('0xe'));logger['debug']('Schedule,\x20%s,\x20%s,\x20%s',_0x27510f,'request\x20sent',JSON[_0xaa4d('0xf')](_0x5c9783));if(_0x5c9783[_0xaa4d('0x10')]){if(_0x5c9783[_0xaa4d('0x10')]['code']===0x1f4){logger[_0xaa4d('0x10')](_0xaa4d('0xd'),_0x27510f,_0x5c9783[_0xaa4d('0x10')][_0xaa4d('0x11')]);return _0x180f20(_0x5c9783[_0xaa4d('0x10')][_0xaa4d('0x11')]);}logger[_0xaa4d('0x10')]('Schedule,\x20%s,\x20%s',_0x27510f,_0x5c9783['error'][_0xaa4d('0x11')]);return _0x2331a1(_0x5c9783[_0xaa4d('0x10')][_0xaa4d('0x11')]);}else{logger[_0xaa4d('0x12')](_0xaa4d('0xd'),_0x27510f,'request\x20sent');_0x2331a1(_0x5c9783[_0xaa4d('0x13')][_0xaa4d('0x11')]);}})[_0xaa4d('0x14')](function(_0x548f53){logger[_0xaa4d('0x10')](_0xaa4d('0xd'),_0x27510f,_0x548f53);_0x180f20(_0x548f53);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 79e0b84..b2149b0 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 _0x660d=['index','/describe','describe','/:id','show','download','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./screenRecording.controller','get','isAuthenticated'];(function(_0x4e2ed7,_0x1f2a80){var _0x48b38a=function(_0x467256){while(--_0x467256){_0x4e2ed7['push'](_0x4e2ed7['shift']());}};_0x48b38a(++_0x1f2a80);}(_0x660d,0x1ef));var _0xd660=function(_0x1579c4,_0x189307){_0x1579c4=_0x1579c4-0x0;var _0x58e42d=_0x660d[_0x1579c4];return _0x58e42d;};'use strict';var multer=require(_0xd660('0x0'));var util=require(_0xd660('0x1'));var path=require(_0xd660('0x2'));var timeout=require(_0xd660('0x3'));var express=require(_0xd660('0x4'));var router=express[_0xd660('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xd660('0x6'));var config=require(_0xd660('0x7'));var controller=require(_0xd660('0x8'));router[_0xd660('0x9')]('/',auth[_0xd660('0xa')](),controller[_0xd660('0xb')]);router[_0xd660('0x9')](_0xd660('0xc'),auth['isAuthenticated'](),controller[_0xd660('0xd')]);router[_0xd660('0x9')](_0xd660('0xe'),auth[_0xd660('0xa')](),controller[_0xd660('0xf')]);router[_0xd660('0x9')]('/:id/download',auth[_0xd660('0xa')](),controller[_0xd660('0x10')]);router[_0xd660('0x11')]('/',auth['isAuthenticated'](),controller[_0xd660('0x12')]);router[_0xd660('0x13')](_0xd660('0xe'),auth[_0xd660('0xa')](),controller[_0xd660('0x14')]);router[_0xd660('0x15')](_0xd660('0xe'),auth[_0xd660('0xa')](),controller[_0xd660('0x16')]);module['exports']=router; \ No newline at end of file +var _0xf494=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./screenRecording.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/download','download','create','update'];(function(_0x4e7e36,_0xd06f05){var _0x2c40d7=function(_0x60f0cf){while(--_0x60f0cf){_0x4e7e36['push'](_0x4e7e36['shift']());}};_0x2c40d7(++_0xd06f05);}(_0xf494,0x100));var _0x4f49=function(_0x1a38c6,_0x2f277f){_0x1a38c6=_0x1a38c6-0x0;var _0x398215=_0xf494[_0x1a38c6];return _0x398215;};'use strict';var multer=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var path=require(_0x4f49('0x2'));var timeout=require(_0x4f49('0x3'));var express=require(_0x4f49('0x4'));var router=express[_0x4f49('0x5')]();var auth=require(_0x4f49('0x6'));var interaction=require(_0x4f49('0x7'));var config=require('../../config/environment');var controller=require(_0x4f49('0x8'));router['get']('/',auth[_0x4f49('0x9')](),controller[_0x4f49('0xa')]);router[_0x4f49('0xb')](_0x4f49('0xc'),auth[_0x4f49('0x9')](),controller[_0x4f49('0xd')]);router[_0x4f49('0xb')](_0x4f49('0xe'),auth[_0x4f49('0x9')](),controller[_0x4f49('0xf')]);router[_0x4f49('0xb')](_0x4f49('0x10'),auth[_0x4f49('0x9')](),controller[_0x4f49('0x11')]);router['post']('/',auth[_0x4f49('0x9')](),controller[_0x4f49('0x12')]);router['put']('/:id',auth[_0x4f49('0x9')](),controller[_0x4f49('0x13')]);router[_0x4f49('0x14')](_0x4f49('0xe'),auth[_0x4f49('0x9')](),controller[_0x4f49('0x15')]);module[_0x4f49('0x16')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index f88d0e0..04c95f6 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 _0x032e=['duration','DATE','MM-DD-YYYY\x20HH:mm','toString','format','createdAt','updatedAt','sequelize','path','../../config/environment','getDataValue','value','extname','STRING','replace','setDataValue','INTEGER','startedAt','closedAt'];(function(_0x3724e2,_0x41d318){var _0x5c5ab2=function(_0x4c57ae){while(--_0x4c57ae){_0x3724e2['push'](_0x3724e2['shift']());}};_0x5c5ab2(++_0x41d318);}(_0x032e,0x124));var _0xe032=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0x032e[_0x55f8b4];return _0x2475f9;};'use strict';var Sequelize=require(_0xe032('0x0'));var moment=require('moment');var path=require(_0xe032('0x1'));var config=require(_0xe032('0x2'));module['exports']={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xe032('0x3')](_0xe032('0x4'))?path[_0xe032('0x5')](this[_0xe032('0x3')](_0xe032('0x4'))):undefined;}},'interactionid':{'type':Sequelize[_0xe032('0x6')]},'channel':{'type':Sequelize[_0xe032('0x6')]},'value':{'type':Sequelize[_0xe032('0x6')],'set':function(_0x37432f){var _0x1576c8=_0x37432f[_0xe032('0x7')](/\\/g,'/');this[_0xe032('0x8')](_0xe032('0x4'),_0x1576c8);}},'rating':{'type':Sequelize[_0xe032('0x9')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0xe032('0x9')],'set':function(_0x2d8a14){this[_0xe032('0x8')](_0xe032('0xa'),moment()['subtract'](_0x2d8a14,'ms'));this[_0xe032('0x8')](_0xe032('0xb'),moment());this[_0xe032('0x8')](_0xe032('0xc'),_0x2d8a14);}},'startedAt':{'type':Sequelize[_0xe032('0xd')],'get':function(){return moment(this[_0xe032('0x3')](_0xe032('0xa')))['format'](_0xe032('0xe'))[_0xe032('0xf')]();}},'closedAt':{'type':Sequelize[_0xe032('0xd')],'get':function(){return moment(this[_0xe032('0x3')]('closedAt'))[_0xe032('0x10')](_0xe032('0xe'))[_0xe032('0xf')]();}},'createdAt':{'type':Sequelize[_0xe032('0xd')],'get':function(){return moment(this[_0xe032('0x3')](_0xe032('0x11')))[_0xe032('0x10')]('MM-DD-YYYY\x20HH:mm')[_0xe032('0xf')]();}},'updatedAt':{'type':Sequelize[_0xe032('0xd')],'get':function(){return moment(this[_0xe032('0x3')](_0xe032('0x12')))[_0xe032('0x10')](_0xe032('0xe'))['toString']();}}}; \ No newline at end of file +var _0x8958=['INTEGER','setDataValue','startedAt','subtract','closedAt','DATE','format','MM-DD-YYYY\x20HH:mm','toString','createdAt','updatedAt','moment','getDataValue','extname','value','STRING','replace'];(function(_0x77773a,_0x5a7026){var _0x1091a2=function(_0x276af5){while(--_0x276af5){_0x77773a['push'](_0x77773a['shift']());}};_0x1091a2(++_0x5a7026);}(_0x8958,0x93));var _0x8895=function(_0x20c525,_0x3accc2){_0x20c525=_0x20c525-0x0;var _0x3e950a=_0x8958[_0x20c525];return _0x3e950a;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x8895('0x0'));var path=require('path');var config=require('../../config/environment');module['exports']={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x8895('0x1')]('value')?path[_0x8895('0x2')](this[_0x8895('0x1')](_0x8895('0x3'))):undefined;}},'interactionid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x8895('0x4')]},'value':{'type':Sequelize[_0x8895('0x4')],'set':function(_0x124e1e){var _0x40cec6=_0x124e1e[_0x8895('0x5')](/\\/g,'/');this['setDataValue'](_0x8895('0x3'),_0x40cec6);}},'rating':{'type':Sequelize[_0x8895('0x6')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x8895('0x6')],'set':function(_0x24fe49){this[_0x8895('0x7')](_0x8895('0x8'),moment()[_0x8895('0x9')](_0x24fe49,'ms'));this[_0x8895('0x7')](_0x8895('0xa'),moment());this[_0x8895('0x7')]('duration',_0x24fe49);}},'startedAt':{'type':Sequelize[_0x8895('0xb')],'get':function(){return moment(this[_0x8895('0x1')](_0x8895('0x8')))[_0x8895('0xc')](_0x8895('0xd'))[_0x8895('0xe')]();}},'closedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x8895('0x1')](_0x8895('0xa')))[_0x8895('0xc')]('MM-DD-YYYY\x20HH:mm')['toString']();}},'createdAt':{'type':Sequelize[_0x8895('0xb')],'get':function(){return moment(this['getDataValue'](_0x8895('0xf')))[_0x8895('0xc')](_0x8895('0xd'))[_0x8895('0xe')]();}},'updatedAt':{'type':Sequelize[_0x8895('0xb')],'get':function(){return moment(this['getDataValue'](_0x8895('0x10')))[_0x8895('0xc')](_0x8895('0xd'))[_0x8895('0xe')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 559e11c..ad13bb7 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 _0x4fba=['../../config/utils','sendStatus','end','status','offset','limit','set','Content-Range','json','apply','save','then','destroy','stack','name','send','index','map','ScreenRecording','rawAttributes','fieldName','type','model','differenceBy','format','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','count','includeAll','findAll','rows','catch','show','keys','include','create','body','update','duration','createdAt','value','params','describe','download','../../components/encryptor','uniqueid','find','join','root','%s.cypher','existsSync','recording','server/files/screen_recordings','Sequelize','ScreenRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','cancellazione\x20fisica\x20documento\x20%s','isNil','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x5482ec,_0x23f6cd){var _0x197283=function(_0x6f592a){while(--_0x6f592a){_0x5482ec['push'](_0x5482ec['shift']());}};_0x197283(++_0x23f6cd);}(_0x4fba,0x11e));var _0xa4fb=function(_0x4517b2,_0x11a01a){_0x4517b2=_0x4517b2-0x0;var _0x3ee454=_0x4fba[_0x4517b2];return _0x3ee454;};'use strict';var pdf=require(_0xa4fb('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xa4fb('0x1'));var jsonpatch=require(_0xa4fb('0x2'));var rp=require(_0xa4fb('0x3'));var moment=require(_0xa4fb('0x4'));var BPromise=require(_0xa4fb('0x5'));var Mustache=require(_0xa4fb('0x6'));var util=require(_0xa4fb('0x7'));var path=require('path');var sox=require(_0xa4fb('0x8'));var csv=require(_0xa4fb('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xa4fb('0xa'));var squel=require(_0xa4fb('0xb'));var crypto=require(_0xa4fb('0xc'));var jsforce=require(_0xa4fb('0xd'));var deskjs=require(_0xa4fb('0xe'));var toCsv=require('to-csv');var querystring=require(_0xa4fb('0xf'));var Papa=require(_0xa4fb('0x10'));var Redis=require(_0xa4fb('0x11'));var authService=require(_0xa4fb('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xa4fb('0x13'));var hardwareService=require(_0xa4fb('0x14'));var logger=require(_0xa4fb('0x15'))(_0xa4fb('0x16'));var utils=require(_0xa4fb('0x17'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x26dbce,_0xadeb8f){_0xadeb8f=_0xadeb8f||0xcc;return function(_0x1f032f){if(_0x1f032f){return _0x26dbce[_0xa4fb('0x18')](_0xadeb8f);}return _0x26dbce['status'](_0xadeb8f)[_0xa4fb('0x19')]();};}function respondWithResult(_0x3fea02,_0x2fb990){_0x2fb990=_0x2fb990||0xc8;return function(_0x3b3383){if(_0x3b3383){return _0x3fea02[_0xa4fb('0x1a')](_0x2fb990)['json'](_0x3b3383);}};}function respondWithFilteredResult(_0x3ca782,_0x112594){return function(_0x4efbf5){if(_0x4efbf5){var _0x3969da=_0x4efbf5['count'],_0x8aa969=_0x112594[_0xa4fb('0x1b')],_0x3155cb=_0x112594[_0xa4fb('0x1b')]+_0x112594[_0xa4fb('0x1c')],_0x4ce68a;if(_0x3155cb>=_0x3969da){_0x3155cb=_0x3969da;_0x4ce68a=0xc8;}else{_0x4ce68a=0xce;}_0x3ca782[_0xa4fb('0x1a')](_0x4ce68a);return _0x3ca782[_0xa4fb('0x1d')](_0xa4fb('0x1e'),_0x8aa969+'-'+_0x3155cb+'/'+_0x3969da)[_0xa4fb('0x1f')](_0x4efbf5);}return null;};}function patchUpdates(_0x55e726){return function(_0x5baf45){try{jsonpatch[_0xa4fb('0x20')](_0x5baf45,_0x55e726,!![]);}catch(_0x1405ed){return BPromise['reject'](_0x1405ed);}return _0x5baf45[_0xa4fb('0x21')]();};}function saveUpdates(_0x4a32af,_0x318af4){return function(_0x17e721){if(_0x17e721){return _0x17e721['update'](_0x4a32af)[_0xa4fb('0x22')](function(_0x3847f4){return _0x3847f4;});}return null;};}function removeEntity(_0x23e411,_0x3b0864){return function(_0xb824c6){if(_0xb824c6){return _0xb824c6[_0xa4fb('0x23')]()[_0xa4fb('0x22')](function(){_0x23e411[_0xa4fb('0x1a')](0xcc)[_0xa4fb('0x19')]();});}};}function handleEntityNotFound(_0x93b16a,_0xb933e2){return function(_0x52fc90){if(!_0x52fc90){_0x93b16a['sendStatus'](0x194);}return _0x52fc90;};}function handleError(_0xe10d86,_0x5bb2f0){_0x5bb2f0=_0x5bb2f0||0x1f4;return function(_0x3a234f){logger['error'](_0x3a234f[_0xa4fb('0x24')]);if(_0x3a234f[_0xa4fb('0x25')]){delete _0x3a234f['name'];}_0xe10d86[_0xa4fb('0x1a')](_0x5bb2f0)[_0xa4fb('0x26')](_0x3a234f);};}exports[_0xa4fb('0x27')]=function(_0x2acc3e,_0x29293d){var _0x420f9d={},_0xa2c3e8={},_0x1a46b1={'count':0x0,'rows':[]};var _0x185d86=_[_0xa4fb('0x28')](db[_0xa4fb('0x29')][_0xa4fb('0x2a')],function(_0x465cfc){return{'name':_0x465cfc[_0xa4fb('0x2b')],'type':_0x465cfc[_0xa4fb('0x2c')]['key']};});_0xa2c3e8[_0xa4fb('0x2d')]=_[_0xa4fb('0x2e')](_[_0xa4fb('0x28')](_0x185d86,'name'),[_0xa4fb('0x2f')]);_0xa2c3e8[_0xa4fb('0x30')]=_['keys'](_0x2acc3e[_0xa4fb('0x30')]);_0xa2c3e8[_0xa4fb('0x31')]=_[_0xa4fb('0x32')](_0xa2c3e8[_0xa4fb('0x2d')],_0xa2c3e8['query']);_0x420f9d[_0xa4fb('0x33')]=_[_0xa4fb('0x32')](_0xa2c3e8[_0xa4fb('0x2d')],qs['fields'](_0x2acc3e[_0xa4fb('0x30')][_0xa4fb('0x34')]));_0x420f9d[_0xa4fb('0x33')]=_0x420f9d[_0xa4fb('0x33')][_0xa4fb('0x35')]?_0x420f9d[_0xa4fb('0x33')]:_0xa2c3e8['model'];if(!_0x2acc3e[_0xa4fb('0x30')][_0xa4fb('0x36')](_0xa4fb('0x37'))){_0x420f9d['limit']=qs[_0xa4fb('0x1c')](_0x2acc3e[_0xa4fb('0x30')]['limit']);_0x420f9d[_0xa4fb('0x1b')]=qs['offset'](_0x2acc3e[_0xa4fb('0x30')][_0xa4fb('0x1b')]);}_0x420f9d[_0xa4fb('0x38')]=qs[_0xa4fb('0x39')](_0x2acc3e[_0xa4fb('0x30')]['sort']);_0x420f9d[_0xa4fb('0x3a')]=qs['filters'](_[_0xa4fb('0x3b')](_0x2acc3e[_0xa4fb('0x30')],_0xa2c3e8[_0xa4fb('0x31')]),_0x185d86);if(_0x2acc3e[_0xa4fb('0x30')][_0xa4fb('0x3c')]){_0x420f9d[_0xa4fb('0x3a')]=_['merge'](_0x420f9d[_0xa4fb('0x3a')],{'$or':_[_0xa4fb('0x28')](_0x185d86,function(_0x210c56){if(_0x210c56[_0xa4fb('0x2c')]!==_0xa4fb('0x3d')){var _0x3dc969={};_0x3dc969[_0x210c56[_0xa4fb('0x25')]]={'$like':'%'+_0x2acc3e['query'][_0xa4fb('0x3c')]+'%'};return _0x3dc969;}})});}_0x420f9d=_[_0xa4fb('0x3e')]({},_0x420f9d,_0x2acc3e[_0xa4fb('0x3f')]);var _0x3bffe4={'where':_0x420f9d[_0xa4fb('0x3a')]};return db[_0xa4fb('0x29')][_0xa4fb('0x40')](_0x3bffe4)[_0xa4fb('0x22')](function(_0x459295){_0x1a46b1[_0xa4fb('0x40')]=_0x459295;if(_0x2acc3e[_0xa4fb('0x30')][_0xa4fb('0x41')]){_0x420f9d['include']=[{'all':!![]}];}return db[_0xa4fb('0x29')][_0xa4fb('0x42')](_0x420f9d);})[_0xa4fb('0x22')](function(_0x46230b){_0x1a46b1[_0xa4fb('0x43')]=_0x46230b;return _0x1a46b1;})[_0xa4fb('0x22')](respondWithFilteredResult(_0x29293d,_0x420f9d))[_0xa4fb('0x44')](handleError(_0x29293d,null));};exports[_0xa4fb('0x45')]=function(_0x213c49,_0x42daed){var _0x42644a={'raw':![],'where':{'id':_0x213c49['params']['id']}},_0x20ce34={};_0x20ce34[_0xa4fb('0x2d')]=_['keys'](db[_0xa4fb('0x29')][_0xa4fb('0x2a')]);_0x20ce34['query']=_[_0xa4fb('0x46')](_0x213c49[_0xa4fb('0x30')]);_0x20ce34['filters']=_[_0xa4fb('0x32')](_0x20ce34['model'],_0x20ce34['query']);_0x42644a['attributes']=_[_0xa4fb('0x32')](_0x20ce34[_0xa4fb('0x2d')],qs[_0xa4fb('0x34')](_0x213c49[_0xa4fb('0x30')][_0xa4fb('0x34')]));_0x42644a['attributes']=_0x42644a[_0xa4fb('0x33')][_0xa4fb('0x35')]?_0x42644a[_0xa4fb('0x33')]:_0x20ce34[_0xa4fb('0x2d')];if(_0x213c49[_0xa4fb('0x30')]['includeAll']){_0x42644a[_0xa4fb('0x47')]=[{'all':!![]}];}_0x42644a=_[_0xa4fb('0x3e')]({},_0x42644a,_0x213c49[_0xa4fb('0x3f')]);return db['ScreenRecording']['find'](_0x42644a)['then'](handleEntityNotFound(_0x42daed,null))['then'](respondWithResult(_0x42daed,null))[_0xa4fb('0x44')](handleError(_0x42daed,null));};exports[_0xa4fb('0x48')]=function(_0x33ca0e,_0x3889d8){return db['ScreenRecording'][_0xa4fb('0x48')](_0x33ca0e[_0xa4fb('0x49')],{})[_0xa4fb('0x22')](respondWithResult(_0x3889d8,0xc9))[_0xa4fb('0x44')](handleError(_0x3889d8,null));};exports[_0xa4fb('0x4a')]=function(_0x23880d,_0x124d57){if(_0x23880d[_0xa4fb('0x49')]['id']){delete _0x23880d['body']['id'];}delete _0x23880d[_0xa4fb('0x49')][_0xa4fb('0x4b')];delete _0x23880d['body'][_0xa4fb('0x4c')];delete _0x23880d['body']['closedAt'];delete _0x23880d[_0xa4fb('0x49')][_0xa4fb('0x4d')];return db[_0xa4fb('0x29')]['find']({'where':{'id':_0x23880d[_0xa4fb('0x4e')]['id']}})[_0xa4fb('0x22')](handleEntityNotFound(_0x124d57,null))[_0xa4fb('0x22')](saveUpdates(_0x23880d[_0xa4fb('0x49')],null))[_0xa4fb('0x22')](respondWithResult(_0x124d57,null))[_0xa4fb('0x44')](handleError(_0x124d57,null));};exports[_0xa4fb('0x4f')]=function(_0x529a4f,_0x2fcea3){return db['ScreenRecording'][_0xa4fb('0x4f')]()['then'](respondWithResult(_0x2fcea3,null))['catch'](handleError(_0x2fcea3,null));};exports[_0xa4fb('0x50')]=function(_0x19955b,_0x22cd89,_0x4e54c9){var _0x3fbf9c=require(_0xa4fb('0x51'));var _0x4d4541=![];var _0x493108={};if(_0x19955b[_0xa4fb('0x30')][_0xa4fb('0x2c')]&&_0x19955b[_0xa4fb('0x30')][_0xa4fb('0x2c')]===_0xa4fb('0x52')){_0x493108[_0xa4fb('0x52')]=_0x19955b[_0xa4fb('0x4e')]['id'];}else{_0x493108['id']=_0x19955b[_0xa4fb('0x4e')]['id'];}return db[_0xa4fb('0x29')][_0xa4fb('0x53')]({'where':_0x493108,'attributes':['id',_0xa4fb('0x4d')],'raw':!![]})[_0xa4fb('0x22')](handleEntityNotFound(_0x22cd89,null))[_0xa4fb('0x22')](function(_0x335fda){if(_0x335fda){var _0x299942=path[_0xa4fb('0x54')](config[_0xa4fb('0x55')],'server/files/screen_recordings',_0x335fda[_0xa4fb('0x4d')]);var _0x569fde=util[_0xa4fb('0x2f')](_0xa4fb('0x56'),_0x299942);if(fs[_0xa4fb('0x57')](_0x569fde)){_0x4d4541=!![];return _0x3fbf9c['decryptFile'](_0x569fde,_0x299942,config['secrets'][_0xa4fb('0x58')])[_0xa4fb('0x22')](function(){return _0x335fda;});}return _0x335fda;}})['then'](function(_0x6a78ea){if(_0x6a78ea){var _0x16ac5c=path[_0xa4fb('0x54')](config[_0xa4fb('0x55')],_0xa4fb('0x59'),_0x6a78ea[_0xa4fb('0x4d')]);if(!fs[_0xa4fb('0x57')](_0x16ac5c)){throw new db[(_0xa4fb('0x5a'))]['ValidationError'](_0xa4fb('0x5b'));}if(_0x6a78ea[_0xa4fb('0x5c')]){return _0x22cd89[_0xa4fb('0x50')](_0x16ac5c,_0x6a78ea[_0xa4fb('0x5c')]+path[_0xa4fb('0x5d')](_0x16ac5c),function(){if(_0x4d4541){fs['unlink'](_0x16ac5c);}});}else{return _0x22cd89['download'](_0x16ac5c,function(_0x4cdd8b){if(_0x4d4541){fs[_0xa4fb('0x5e')](_0x16ac5c);}});}}})['catch'](function(_0x2172c6){if(_0x2172c6[_0xa4fb('0x5f')]==='ScreenRecording\x20not\x20found'){_0x22cd89[_0xa4fb('0x1a')](0x194)[_0xa4fb('0x26')](_0xa4fb('0x60'));}else{return handleError(_0x22cd89,null);}});};exports['destroy']=function(_0x39ba1b,_0x4441a4){return db[_0xa4fb('0x29')][_0xa4fb('0x53')]({'where':{'id':_0x39ba1b['params']['id']}})[_0xa4fb('0x22')](function(_0xafe8ca){if(!_0xafe8ca)throw new ReferenceError('Entity\x20not\x20found');return _0xafe8ca;})[_0xa4fb('0x22')](function(_0x1975c0){var _0xdade81=path[_0xa4fb('0x54')](config[_0xa4fb('0x55')],_0xa4fb('0x59'),_0x1975c0[_0xa4fb('0x4d')]);logger['info'](_0xa4fb('0x61'),_0xdade81);if(!_[_0xa4fb('0x62')](_0x1975c0[_0xa4fb('0x4d')])&&fs['existsSync'](_0xdade81)){logger[_0xa4fb('0x63')](_0xa4fb('0x64')+_0xdade81+_0xa4fb('0x65'));fs[_0xa4fb('0x66')](_0xdade81);}_0xdade81=_0xdade81+'.cypher';if(!_['isNil'](_0x1975c0['value'])&&fs[_0xa4fb('0x57')](_0xdade81)){logger['info'](_0xa4fb('0x64')+_0xdade81+_0xa4fb('0x65'));fs[_0xa4fb('0x66')](_0xdade81);}return _0x1975c0;})[_0xa4fb('0x22')](function(_0xccf16b){if(!_0xccf16b)throw new InternalError();return _0xccf16b[_0xa4fb('0x23')]();})[_0xa4fb('0x22')](function(){_0x4441a4[_0xa4fb('0x1a')](0xcc)[_0xa4fb('0x19')]();})[_0xa4fb('0x44')](handleError(_0x4441a4,null));}; \ No newline at end of file +var _0x7ee9=['end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','send','map','ScreenRecording','rawAttributes','fieldName','key','model','format','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','name','merge','includeAll','include','findAll','rows','show','params','find','catch','create','body','duration','createdAt','value','describe','download','../../components/encryptor','uniqueid','join','server/files/screen_recordings','existsSync','decryptFile','recording','Sequelize','ScreenRecording\x20not\x20found','filename','unlink','Not\x20found','root','cancellazione\x20fisica\x20documento\x20%s','isNil','info','File:\x20\x22','unlinkSync','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../mysqldb','status'];(function(_0x5e2cb4,_0x592c64){var _0x282902=function(_0x1c1836){while(--_0x1c1836){_0x5e2cb4['push'](_0x5e2cb4['shift']());}};_0x282902(++_0x592c64);}(_0x7ee9,0x115));var _0x97ee=function(_0x7260d7,_0x505c4c){_0x7260d7=_0x7260d7-0x0;var _0x37caa0=_0x7ee9[_0x7260d7];return _0x37caa0;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x97ee('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x97ee('0x1'));var moment=require(_0x97ee('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x97ee('0x3'));var util=require(_0x97ee('0x4'));var path=require(_0x97ee('0x5'));var sox=require(_0x97ee('0x6'));var csv=require(_0x97ee('0x7'));var ejs=require(_0x97ee('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x97ee('0x9'));var crypto=require(_0x97ee('0xa'));var jsforce=require(_0x97ee('0xb'));var deskjs=require(_0x97ee('0xc'));var toCsv=require(_0x97ee('0x7'));var querystring=require(_0x97ee('0xd'));var Papa=require(_0x97ee('0xe'));var Redis=require(_0x97ee('0xf'));var authService=require(_0x97ee('0x10'));var qs=require(_0x97ee('0x11'));var as=require(_0x97ee('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x97ee('0x13'));var config=require(_0x97ee('0x14'));var db=require(_0x97ee('0x15'))['db'];function respondWithStatusCode(_0x47f2f7,_0x1be49e){_0x1be49e=_0x1be49e||0xcc;return function(_0x241f2b){if(_0x241f2b){return _0x47f2f7['sendStatus'](_0x1be49e);}return _0x47f2f7[_0x97ee('0x16')](_0x1be49e)[_0x97ee('0x17')]();};}function respondWithResult(_0x9f69e4,_0x2343a4){_0x2343a4=_0x2343a4||0xc8;return function(_0x10559a){if(_0x10559a){return _0x9f69e4['status'](_0x2343a4)[_0x97ee('0x18')](_0x10559a);}};}function respondWithFilteredResult(_0x577d09,_0x3948f5){return function(_0x21aaac){if(_0x21aaac){var _0x589816=_0x21aaac[_0x97ee('0x19')],_0x386cef=_0x3948f5[_0x97ee('0x1a')],_0x551acc=_0x3948f5['offset']+_0x3948f5[_0x97ee('0x1b')],_0x4c77fe;if(_0x551acc>=_0x589816){_0x551acc=_0x589816;_0x4c77fe=0xc8;}else{_0x4c77fe=0xce;}_0x577d09[_0x97ee('0x16')](_0x4c77fe);return _0x577d09[_0x97ee('0x1c')](_0x97ee('0x1d'),_0x386cef+'-'+_0x551acc+'/'+_0x589816)[_0x97ee('0x18')](_0x21aaac);}return null;};}function patchUpdates(_0x448b2e){return function(_0x17f9c0){try{jsonpatch[_0x97ee('0x1e')](_0x17f9c0,_0x448b2e,!![]);}catch(_0x3b1691){return BPromise[_0x97ee('0x1f')](_0x3b1691);}return _0x17f9c0[_0x97ee('0x20')]();};}function saveUpdates(_0x5c6c63,_0x56491d){return function(_0x94628f){if(_0x94628f){return _0x94628f[_0x97ee('0x21')](_0x5c6c63)[_0x97ee('0x22')](function(_0x4fea0d){return _0x4fea0d;});}return null;};}function removeEntity(_0x28f5b3,_0x38f101){return function(_0x2fccca){if(_0x2fccca){return _0x2fccca[_0x97ee('0x23')]()[_0x97ee('0x22')](function(){_0x28f5b3[_0x97ee('0x16')](0xcc)[_0x97ee('0x17')]();});}};}function handleEntityNotFound(_0x481dc3,_0x248924){return function(_0x1cbcc8){if(!_0x1cbcc8){_0x481dc3[_0x97ee('0x24')](0x194);}return _0x1cbcc8;};}function handleError(_0x2b7e9f,_0xafadd2){_0xafadd2=_0xafadd2||0x1f4;return function(_0x35f509){logger[_0x97ee('0x25')](_0x35f509[_0x97ee('0x26')]);if(_0x35f509['name']){delete _0x35f509['name'];}_0x2b7e9f[_0x97ee('0x16')](_0xafadd2)[_0x97ee('0x27')](_0x35f509);};}exports['index']=function(_0x58cc51,_0x2e5f92){var _0x1847d9={},_0x48a5bd={},_0x39f44d={'count':0x0,'rows':[]};var _0x382228=_[_0x97ee('0x28')](db[_0x97ee('0x29')][_0x97ee('0x2a')],function(_0x4d44c3){return{'name':_0x4d44c3[_0x97ee('0x2b')],'type':_0x4d44c3['type'][_0x97ee('0x2c')]};});_0x48a5bd[_0x97ee('0x2d')]=_['differenceBy'](_[_0x97ee('0x28')](_0x382228,'name'),[_0x97ee('0x2e')]);_0x48a5bd[_0x97ee('0x2f')]=_[_0x97ee('0x30')](_0x58cc51[_0x97ee('0x2f')]);_0x48a5bd[_0x97ee('0x31')]=_[_0x97ee('0x32')](_0x48a5bd[_0x97ee('0x2d')],_0x48a5bd[_0x97ee('0x2f')]);_0x1847d9[_0x97ee('0x33')]=_['intersection'](_0x48a5bd[_0x97ee('0x2d')],qs[_0x97ee('0x34')](_0x58cc51['query']['fields']));_0x1847d9[_0x97ee('0x33')]=_0x1847d9[_0x97ee('0x33')][_0x97ee('0x35')]?_0x1847d9[_0x97ee('0x33')]:_0x48a5bd[_0x97ee('0x2d')];if(!_0x58cc51['query'][_0x97ee('0x36')](_0x97ee('0x37'))){_0x1847d9[_0x97ee('0x1b')]=qs[_0x97ee('0x1b')](_0x58cc51['query'][_0x97ee('0x1b')]);_0x1847d9[_0x97ee('0x1a')]=qs[_0x97ee('0x1a')](_0x58cc51[_0x97ee('0x2f')][_0x97ee('0x1a')]);}_0x1847d9[_0x97ee('0x38')]=qs[_0x97ee('0x39')](_0x58cc51[_0x97ee('0x2f')][_0x97ee('0x39')]);_0x1847d9[_0x97ee('0x3a')]=qs[_0x97ee('0x31')](_[_0x97ee('0x3b')](_0x58cc51['query'],_0x48a5bd['filters']),_0x382228);if(_0x58cc51[_0x97ee('0x2f')][_0x97ee('0x3c')]){_0x1847d9['where']=_['merge'](_0x1847d9[_0x97ee('0x3a')],{'$or':_['map'](_0x382228,function(_0x183b6f){if(_0x183b6f[_0x97ee('0x3d')]!==_0x97ee('0x3e')){var _0x2ead38={};_0x2ead38[_0x183b6f[_0x97ee('0x3f')]]={'$like':'%'+_0x58cc51[_0x97ee('0x2f')]['filter']+'%'};return _0x2ead38;}})});}_0x1847d9=_[_0x97ee('0x40')]({},_0x1847d9,_0x58cc51['options']);var _0x19ad38={'where':_0x1847d9[_0x97ee('0x3a')]};return db['ScreenRecording'][_0x97ee('0x19')](_0x19ad38)['then'](function(_0x470979){_0x39f44d[_0x97ee('0x19')]=_0x470979;if(_0x58cc51[_0x97ee('0x2f')][_0x97ee('0x41')]){_0x1847d9[_0x97ee('0x42')]=[{'all':!![]}];}return db[_0x97ee('0x29')][_0x97ee('0x43')](_0x1847d9);})[_0x97ee('0x22')](function(_0x2aa11e){_0x39f44d[_0x97ee('0x44')]=_0x2aa11e;return _0x39f44d;})[_0x97ee('0x22')](respondWithFilteredResult(_0x2e5f92,_0x1847d9))['catch'](handleError(_0x2e5f92,null));};exports[_0x97ee('0x45')]=function(_0x51c55d,_0x463ec8){var _0x9d98b2={'raw':![],'where':{'id':_0x51c55d[_0x97ee('0x46')]['id']}},_0x3b1497={};_0x3b1497[_0x97ee('0x2d')]=_[_0x97ee('0x30')](db[_0x97ee('0x29')][_0x97ee('0x2a')]);_0x3b1497[_0x97ee('0x2f')]=_[_0x97ee('0x30')](_0x51c55d['query']);_0x3b1497[_0x97ee('0x31')]=_[_0x97ee('0x32')](_0x3b1497[_0x97ee('0x2d')],_0x3b1497[_0x97ee('0x2f')]);_0x9d98b2[_0x97ee('0x33')]=_[_0x97ee('0x32')](_0x3b1497[_0x97ee('0x2d')],qs[_0x97ee('0x34')](_0x51c55d[_0x97ee('0x2f')][_0x97ee('0x34')]));_0x9d98b2[_0x97ee('0x33')]=_0x9d98b2[_0x97ee('0x33')][_0x97ee('0x35')]?_0x9d98b2[_0x97ee('0x33')]:_0x3b1497[_0x97ee('0x2d')];if(_0x51c55d['query'][_0x97ee('0x41')]){_0x9d98b2[_0x97ee('0x42')]=[{'all':!![]}];}_0x9d98b2=_['merge']({},_0x9d98b2,_0x51c55d['options']);return db[_0x97ee('0x29')][_0x97ee('0x47')](_0x9d98b2)[_0x97ee('0x22')](handleEntityNotFound(_0x463ec8,null))[_0x97ee('0x22')](respondWithResult(_0x463ec8,null))[_0x97ee('0x48')](handleError(_0x463ec8,null));};exports[_0x97ee('0x49')]=function(_0x52fa9f,_0x2673ae){return db[_0x97ee('0x29')]['create'](_0x52fa9f[_0x97ee('0x4a')],{})[_0x97ee('0x22')](respondWithResult(_0x2673ae,0xc9))[_0x97ee('0x48')](handleError(_0x2673ae,null));};exports[_0x97ee('0x21')]=function(_0x41984a,_0x4394f5){if(_0x41984a[_0x97ee('0x4a')]['id']){delete _0x41984a['body']['id'];}delete _0x41984a[_0x97ee('0x4a')][_0x97ee('0x4b')];delete _0x41984a['body'][_0x97ee('0x4c')];delete _0x41984a['body']['closedAt'];delete _0x41984a['body'][_0x97ee('0x4d')];return db[_0x97ee('0x29')]['find']({'where':{'id':_0x41984a[_0x97ee('0x46')]['id']}})['then'](handleEntityNotFound(_0x4394f5,null))[_0x97ee('0x22')](saveUpdates(_0x41984a['body'],null))[_0x97ee('0x22')](respondWithResult(_0x4394f5,null))['catch'](handleError(_0x4394f5,null));};exports[_0x97ee('0x4e')]=function(_0x59fd8a,_0x22d5f0){return db[_0x97ee('0x29')]['describe']()[_0x97ee('0x22')](respondWithResult(_0x22d5f0,null))[_0x97ee('0x48')](handleError(_0x22d5f0,null));};exports[_0x97ee('0x4f')]=function(_0x5eba19,_0x65a649,_0x5cb361){var _0x32c14b=require(_0x97ee('0x50'));var _0x375840=![];var _0x46962f={};if(_0x5eba19[_0x97ee('0x2f')]['type']&&_0x5eba19[_0x97ee('0x2f')][_0x97ee('0x3d')]===_0x97ee('0x51')){_0x46962f[_0x97ee('0x51')]=_0x5eba19['params']['id'];}else{_0x46962f['id']=_0x5eba19[_0x97ee('0x46')]['id'];}return db[_0x97ee('0x29')][_0x97ee('0x47')]({'where':_0x46962f,'attributes':['id',_0x97ee('0x4d')],'raw':!![]})[_0x97ee('0x22')](handleEntityNotFound(_0x65a649,null))[_0x97ee('0x22')](function(_0x23ce5c){if(_0x23ce5c){var _0x1fa2db=path[_0x97ee('0x52')](config['root'],_0x97ee('0x53'),_0x23ce5c['value']);var _0x150d9b=util[_0x97ee('0x2e')]('%s.cypher',_0x1fa2db);if(fs[_0x97ee('0x54')](_0x150d9b)){_0x375840=!![];return _0x32c14b[_0x97ee('0x55')](_0x150d9b,_0x1fa2db,config['secrets'][_0x97ee('0x56')])['then'](function(){return _0x23ce5c;});}return _0x23ce5c;}})[_0x97ee('0x22')](function(_0x13577f){if(_0x13577f){var _0x1edc77=path[_0x97ee('0x52')](config['root'],'server/files/screen_recordings',_0x13577f[_0x97ee('0x4d')]);if(!fs[_0x97ee('0x54')](_0x1edc77)){throw new db[(_0x97ee('0x57'))]['ValidationError'](_0x97ee('0x58'));}if(_0x13577f['filename']){return _0x65a649[_0x97ee('0x4f')](_0x1edc77,_0x13577f[_0x97ee('0x59')]+path['extname'](_0x1edc77),function(){if(_0x375840){fs[_0x97ee('0x5a')](_0x1edc77);}});}else{return _0x65a649[_0x97ee('0x4f')](_0x1edc77,function(_0x189933){if(_0x375840){fs[_0x97ee('0x5a')](_0x1edc77);}});}}})[_0x97ee('0x48')](function(_0x43ad76){if(_0x43ad76['message']===_0x97ee('0x58')){_0x65a649['status'](0x194)[_0x97ee('0x27')](_0x97ee('0x5b'));}else{return handleError(_0x65a649,null);}});};exports[_0x97ee('0x23')]=function(_0x49725b,_0x2f3529){return db[_0x97ee('0x29')][_0x97ee('0x47')]({'where':{'id':_0x49725b[_0x97ee('0x46')]['id']}})['then'](function(_0x4d5f50){if(!_0x4d5f50)throw new ReferenceError('Entity\x20not\x20found');return _0x4d5f50;})[_0x97ee('0x22')](function(_0x5493ff){var _0x21f884=path[_0x97ee('0x52')](config[_0x97ee('0x5c')],'server/files/screen_recordings',_0x5493ff[_0x97ee('0x4d')]);logger['info'](_0x97ee('0x5d'),_0x21f884);if(!_[_0x97ee('0x5e')](_0x5493ff[_0x97ee('0x4d')])&&fs[_0x97ee('0x54')](_0x21f884)){logger[_0x97ee('0x5f')](_0x97ee('0x60')+_0x21f884+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x97ee('0x61')](_0x21f884);}_0x21f884=_0x21f884+_0x97ee('0x62');if(!_[_0x97ee('0x5e')](_0x5493ff[_0x97ee('0x4d')])&&fs[_0x97ee('0x54')](_0x21f884)){logger[_0x97ee('0x5f')]('File:\x20\x22'+_0x21f884+_0x97ee('0x63'));fs[_0x97ee('0x61')](_0x21f884);}return _0x5493ff;})[_0x97ee('0x22')](function(_0x10eb00){if(!_0x10eb00)throw new InternalError();return _0x10eb00['destroy']();})[_0x97ee('0x22')](function(){_0x2f3529[_0x97ee('0x16')](0xcc)[_0x97ee('0x17')]();})['catch'](handleError(_0x2f3529,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 47abb11..290b42f 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 _0xf144=['../../config/environment','./screenRecording.attributes','exports','define','ScreenRecording','screen_recordings','interactionid','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x451b60,_0x4dff45){var _0x2888fd=function(_0x25a6b2){while(--_0x25a6b2){_0x451b60['push'](_0x451b60['shift']());}};_0x2888fd(++_0x4dff45);}(_0xf144,0x7f));var _0x4f14=function(_0x27b59c,_0x560322){_0x27b59c=_0x27b59c-0x0;var _0xf5b383=_0xf144[_0x27b59c];return _0xf5b383;};'use strict';var _=require('lodash');var util=require(_0x4f14('0x0'));var logger=require(_0x4f14('0x1'))(_0x4f14('0x2'));var moment=require(_0x4f14('0x3'));var BPromise=require(_0x4f14('0x4'));var rp=require(_0x4f14('0x5'));var fs=require('fs');var path=require(_0x4f14('0x6'));var rimraf=require(_0x4f14('0x7'));var config=require(_0x4f14('0x8'));var attributes=require(_0x4f14('0x9'));module[_0x4f14('0xa')]=function(_0xf5e3d5,_0x511001){return _0xf5e3d5[_0x4f14('0xb')](_0x4f14('0xc'),attributes,{'tableName':_0x4f14('0xd'),'paranoid':![],'indexes':[{'name':_0x4f14('0xe'),'fields':[_0x4f14('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd0e6=['ScreenRecording','screen_recordings','interactionid','lodash','util','../../config/logger','api','bluebird','path','../../config/environment','./screenRecording.attributes','exports','define'];(function(_0x2a6e1f,_0x567986){var _0x556fc3=function(_0xb1c6e8){while(--_0xb1c6e8){_0x2a6e1f['push'](_0x2a6e1f['shift']());}};_0x556fc3(++_0x567986);}(_0xd0e6,0x1e4));var _0x6d0e=function(_0x5504fc,_0x2e161c){_0x5504fc=_0x5504fc-0x0;var _0xbad34c=_0xd0e6[_0x5504fc];return _0xbad34c;};'use strict';var _=require(_0x6d0e('0x0'));var util=require(_0x6d0e('0x1'));var logger=require(_0x6d0e('0x2'))(_0x6d0e('0x3'));var moment=require('moment');var BPromise=require(_0x6d0e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6d0e('0x5'));var rimraf=require('rimraf');var config=require(_0x6d0e('0x6'));var attributes=require(_0x6d0e('0x7'));module[_0x6d0e('0x8')]=function(_0x5e3f81,_0x461a69){return _0x5e3f81[_0x6d0e('0x9')](_0x6d0e('0xa'),attributes,{'tableName':_0x6d0e('0xb'),'paranoid':![],'indexes':[{'name':_0x6d0e('0xc'),'fields':[_0x6d0e('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index f48319e..a2000eb 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(_0x1e0502,_0xebe366){var _0x5a267c=function(_0x529962){while(--_0x529962){_0x1e0502['push'](_0x1e0502['shift']());}};_0x5a267c(++_0xebe366);}(_0xa9e0,0x123));var _0x0a9e=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xa9e0[_0x31e29a];return _0x32d892;};'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(_0x140182,_0x4d2db9){var _0x33a44c=function(_0xc1520d){while(--_0xc1520d){_0x140182['push'](_0x140182['shift']());}};_0x33a44c(++_0x4d2db9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xa9e0[_0x5ddb1c];return _0x354adc;};'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 21bb040..7ef7063 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 _0x2830=['multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','show','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','getPreferred','diskStorage','join','server/files/images/logos/','format','%s%s','logo','extname','originalname','file','addLogo','logologin','post','single','preferred','addPreferred','/:id/favicon','addFavicon','put','/:id','update'];(function(_0x1c335e,_0x482132){var _0x3c2ac8=function(_0x335a13){while(--_0x335a13){_0x1c335e['push'](_0x1c335e['shift']());}};_0x3c2ac8(++_0x482132);}(_0x2830,0x1d4));var _0x0283=function(_0x43caef,_0x5ea064){_0x43caef=_0x43caef-0x0;var _0x2f9fb2=_0x2830[_0x43caef];return _0x2f9fb2;};'use strict';var multer=require(_0x0283('0x0'));var util=require(_0x0283('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0283('0x2'));var router=express[_0x0283('0x3')]();var auth=require(_0x0283('0x4'));var interaction=require(_0x0283('0x5'));var config=require(_0x0283('0x6'));var controller=require('./setting.controller');router['get']('/',auth[_0x0283('0x7')](),controller[_0x0283('0x8')]);router[_0x0283('0x9')]('/:id',controller[_0x0283('0xa')]);router[_0x0283('0x9')](_0x0283('0xb'),controller[_0x0283('0xc')]);router[_0x0283('0x9')](_0x0283('0xd'),controller[_0x0283('0xe')]);router[_0x0283('0x9')](_0x0283('0xf'),controller[_0x0283('0x10')]);router[_0x0283('0x9')](_0x0283('0x11'),controller[_0x0283('0x12')]);router[_0x0283('0x9')]('/:id/favicon',controller['getFavicon']);var upload=multer({'storage':multer[_0x0283('0x13')]({'destination':function(_0x2d4bb0,_0x39331e,_0x468b7f){_0x468b7f(null,path[_0x0283('0x14')](config['root'],_0x0283('0x15')));},'filename':function(_0x24d4b1,_0x591a02,_0x98fe5){_0x98fe5(null,util[_0x0283('0x16')](_0x0283('0x17'),_0x0283('0x18'),path[_0x0283('0x19')](_0x591a02[_0x0283('0x1a')])));}})});router['post']('/:id/logo',upload['single'](_0x0283('0x1b')),controller[_0x0283('0x1c')]);var upload=multer({'storage':multer[_0x0283('0x13')]({'destination':function(_0x926c2b,_0x41c030,_0x8c1712){_0x8c1712(null,path[_0x0283('0x14')](config['root'],_0x0283('0x15')));},'filename':function(_0x754056,_0x4b2924,_0x640f94){_0x640f94(null,util[_0x0283('0x16')](_0x0283('0x17'),_0x0283('0x1d'),path[_0x0283('0x19')](_0x4b2924[_0x0283('0x1a')])));}})});router[_0x0283('0x1e')](_0x0283('0xd'),upload[_0x0283('0x1f')](_0x0283('0x1b')),controller['addLogoLogin']);var upload=multer({'storage':multer[_0x0283('0x13')]({'destination':function(_0x5cb443,_0xe7b828,_0x5e2030){_0x5e2030(null,path['join'](config['root'],_0x0283('0x15')));},'filename':function(_0x8c7545,_0x10be23,_0x1b297c){_0x1b297c(null,util[_0x0283('0x16')](_0x0283('0x17'),_0x0283('0x20'),path[_0x0283('0x19')](_0x10be23[_0x0283('0x1a')])));}})});router[_0x0283('0x1e')](_0x0283('0x11'),upload[_0x0283('0x1f')]('file'),controller[_0x0283('0x21')]);var upload=multer({'storage':multer[_0x0283('0x13')]({'destination':function(_0x8d1113,_0x45a6a1,_0x1c972c){_0x1c972c(null,path[_0x0283('0x14')](config['root'],_0x0283('0x15')));},'filename':function(_0x3e8034,_0x34d2cd,_0x1c23b5){_0x1c23b5(null,util[_0x0283('0x16')](_0x0283('0x17'),'favicon',path[_0x0283('0x19')](_0x34d2cd['originalname'])));}})});router[_0x0283('0x1e')](_0x0283('0x22'),upload[_0x0283('0x1f')]('file'),controller[_0x0283('0x23')]);router[_0x0283('0x24')](_0x0283('0x25'),auth['isAuthenticated'](),controller[_0x0283('0x26')]);module['exports']=router; \ No newline at end of file +var _0x56de=['getLogoLogin','/:id/gdpr','gdpr','/:id/favicon','getFavicon','diskStorage','join','root','server/files/images/logos/','format','logo','extname','originalname','post','single','addLogo','logologin','%s%s','preferred','/:id/preferred','file','put','/:id','update','multer','util','express','Router','../../components/auth/service','../../config/environment','./setting.controller','get','isAuthenticated','index','show','/:id/logo','getLogo','/:id/logo_login'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x56de,0x122));var _0xe56d=function(_0x4b7be5,_0x4b8b32){_0x4b7be5=_0x4b7be5-0x0;var _0x1fe3e5=_0x56de[_0x4b7be5];return _0x1fe3e5;};'use strict';var multer=require(_0xe56d('0x0'));var util=require(_0xe56d('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xe56d('0x2'));var router=express[_0xe56d('0x3')]();var auth=require(_0xe56d('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xe56d('0x5'));var controller=require(_0xe56d('0x6'));router[_0xe56d('0x7')]('/',auth[_0xe56d('0x8')](),controller[_0xe56d('0x9')]);router[_0xe56d('0x7')]('/:id',controller[_0xe56d('0xa')]);router[_0xe56d('0x7')](_0xe56d('0xb'),controller[_0xe56d('0xc')]);router['get'](_0xe56d('0xd'),controller[_0xe56d('0xe')]);router[_0xe56d('0x7')](_0xe56d('0xf'),controller[_0xe56d('0x10')]);router[_0xe56d('0x7')]('/:id/preferred',controller['getPreferred']);router[_0xe56d('0x7')](_0xe56d('0x11'),controller[_0xe56d('0x12')]);var upload=multer({'storage':multer[_0xe56d('0x13')]({'destination':function(_0x4ccf60,_0x2dbc18,_0x451b8c){_0x451b8c(null,path[_0xe56d('0x14')](config[_0xe56d('0x15')],_0xe56d('0x16')));},'filename':function(_0x41a9a5,_0x4a36c3,_0x4f7b26){_0x4f7b26(null,util[_0xe56d('0x17')]('%s%s',_0xe56d('0x18'),path[_0xe56d('0x19')](_0x4a36c3[_0xe56d('0x1a')])));}})});router[_0xe56d('0x1b')](_0xe56d('0xb'),upload[_0xe56d('0x1c')]('file'),controller[_0xe56d('0x1d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2c4142,_0x45982b,_0x47b6dc){_0x47b6dc(null,path['join'](config[_0xe56d('0x15')],_0xe56d('0x16')));},'filename':function(_0x2d5674,_0x1bced5,_0x2d759e){_0x2d759e(null,util[_0xe56d('0x17')]('%s%s',_0xe56d('0x1e'),path['extname'](_0x1bced5['originalname'])));}})});router[_0xe56d('0x1b')](_0xe56d('0xd'),upload['single']('file'),controller['addLogoLogin']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4962e9,_0x1fa11a,_0x42a6d2){_0x42a6d2(null,path['join'](config[_0xe56d('0x15')],_0xe56d('0x16')));},'filename':function(_0x1b6953,_0x7db87a,_0x2e4e6d){_0x2e4e6d(null,util[_0xe56d('0x17')](_0xe56d('0x1f'),_0xe56d('0x20'),path[_0xe56d('0x19')](_0x7db87a[_0xe56d('0x1a')])));}})});router[_0xe56d('0x1b')](_0xe56d('0x21'),upload[_0xe56d('0x1c')](_0xe56d('0x22')),controller['addPreferred']);var upload=multer({'storage':multer[_0xe56d('0x13')]({'destination':function(_0x374c67,_0x290822,_0xd77d0d){_0xd77d0d(null,path[_0xe56d('0x14')](config[_0xe56d('0x15')],_0xe56d('0x16')));},'filename':function(_0x215512,_0x19c023,_0x4fdaa7){_0x4fdaa7(null,util[_0xe56d('0x17')](_0xe56d('0x1f'),'favicon',path['extname'](_0x19c023[_0xe56d('0x1a')])));}})});router['post'](_0xe56d('0x11'),upload[_0xe56d('0x1c')](_0xe56d('0x22')),controller['addFavicon']);router[_0xe56d('0x23')](_0xe56d('0x24'),auth[_0xe56d('0x8')](),controller[_0xe56d('0x25')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index f535b43..a4818a9 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 _0x547f=['BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','sequelize','exports','INTEGER','min_internal','min_mailbox','/var/opt/motion2/server/files/sounds/converted','STRING'];(function(_0x287ec1,_0x56a4f1){var _0x24e131=function(_0x3af62b){while(--_0x3af62b){_0x287ec1['push'](_0x287ec1['shift']());}};_0x24e131(++_0x56a4f1);}(_0x547f,0x1cd));var _0xf547=function(_0x2dc41f,_0x4697b6){_0x2dc41f=_0x2dc41f-0x0;var _0x11c331=_0x547f[_0x2dc41f];return _0x11c331;};'use strict';var Sequelize=require(_0xf547('0x0'));module[_0xf547('0x1')]={'min_internal':{'type':Sequelize[_0xf547('0x2')](0xb),'unique':_0xf547('0x3'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0xf547('0x2')](0xb),'unique':_0xf547('0x4'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0xf547('0x2')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize['STRING'],'defaultValue':_0xf547('0x5')},'logo':{'type':Sequelize[_0xf547('0x6')]},'defaultLogo':{'type':Sequelize[_0xf547('0x7')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0xf547('0x6')]},'defaultLoginLogo':{'type':Sequelize[_0xf547('0x7')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0xf547('0x6')]},'defaultHeaderWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0xf547('0x7')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0xf547('0x7')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0xf547('0x6')]},'turnaddr':{'type':Sequelize[_0xf547('0x6')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0xf547('0x6')]},'defaultPageTitle':{'type':Sequelize[_0xf547('0x7')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0xf547('0x7')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0xf547('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0xf547('0x6')],'defaultValue':_0xf547('0x8')},'enableEmailPreview':{'type':Sequelize[_0xf547('0x7')],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0xf547('0x2')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0xf547('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0xf547('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0xf547('0x6')],'defaultValue':'alternate'},'chatTimeout':{'type':Sequelize[_0xf547('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0xf547('0x7')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0xf547('0x6')]},'defaultPreferred':{'type':Sequelize[_0xf547('0x7')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0xf547('0x7')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0xf547('0x6')]},'allowedLoginAttempts':{'type':Sequelize[_0xf547('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'favicon':{'type':Sequelize[_0xf547('0x6')]},'defaultFavicon':{'type':Sequelize[_0xf547('0x7')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize['INTEGER'],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0xf547('0x7')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0xf547('0x2')]},'transcribeRegion':{'type':Sequelize[_0xf547('0x6')]},'sentiment':{'type':Sequelize[_0xf547('0x7')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0xf547('0x7')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize['INTEGER']},'sentimentRegion':{'type':Sequelize[_0xf547('0x6')]},'language':{'type':Sequelize[_0xf547('0x6')]},'bucket':{'type':Sequelize[_0xf547('0x6')]},'googleSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x3310=['min_internal','INTEGER','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','sequelize'];(function(_0x546778,_0x5a5dfb){var _0x16b445=function(_0x283628){while(--_0x283628){_0x546778['push'](_0x546778['shift']());}};_0x16b445(++_0x5a5dfb);}(_0x3310,0xef));var _0x0331=function(_0x3d4bda,_0x377cdf){_0x3d4bda=_0x3d4bda-0x0;var _0x5847c6=_0x3310[_0x3d4bda];return _0x5847c6;};'use strict';var Sequelize=require(_0x0331('0x0'));module['exports']={'min_internal':{'type':Sequelize['INTEGER'](0xb),'unique':_0x0331('0x1'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x0331('0x2')](0xb),'unique':'min_mailbox','defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x0331('0x2')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x0331('0x3')],'defaultValue':_0x0331('0x4')},'logo':{'type':Sequelize[_0x0331('0x3')]},'defaultLogo':{'type':Sequelize[_0x0331('0x5')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x0331('0x3')]},'defaultLoginLogo':{'type':Sequelize[_0x0331('0x5')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize['STRING']},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x0331('0x5')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x0331('0x5')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x0331('0x3')]},'turnaddr':{'type':Sequelize[_0x0331('0x3')]},'turnusername':{'type':Sequelize[_0x0331('0x3')]},'turnpassword':{'type':Sequelize[_0x0331('0x3')]},'pageTitle':{'type':Sequelize['STRING']},'defaultPageTitle':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x0331('0x5')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x0331('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x0331('0x5')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x0331('0x3')],'defaultValue':_0x0331('0x6')},'enableEmailPreview':{'type':Sequelize[_0x0331('0x5')],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x0331('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x0331('0x3')],'defaultValue':_0x0331('0x7')},'chatTimeout':{'type':Sequelize[_0x0331('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x0331('0x5')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x0331('0x3')]},'defaultPreferred':{'type':Sequelize[_0x0331('0x5')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x0331('0x5')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x0331('0x3')]},'allowedLoginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x0331('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x0331('0x3')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x0331('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x0331('0x5')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x0331('0x5')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x0331('0x2')]},'transcribeRegion':{'type':Sequelize['STRING']},'sentiment':{'type':Sequelize[_0x0331('0x5')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x0331('0x5')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x0331('0x2')]},'sentimentRegion':{'type':Sequelize[_0x0331('0x3')]},'language':{'type':Sequelize[_0x0331('0x3')]},'bucket':{'type':Sequelize[_0x0331('0x3')]},'googleSsoEnabled':{'type':Sequelize[_0x0331('0x5')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index ddfd088..2ebb5ea 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 _0x075c=['keys','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','VIRTUAL','merge','options','includeAll','include','rows','show','find','body','params','addLogo','file','filename','logo','addLogoLogin','../../config/license/util','getLogo','getLicense','loginLogo','favicon','defaultLogo','defaultPreferred','defaultFavicon','existsSync','join','root','toLower','default_logo.svg','default','upperFirst','custom','ValidationError','download','defaultLoginLogo','default_loginLogo.svg','\x20not\x20found','gdpr','securePassword','addPreferred','getPreferred','server/files/images/logos','preferred','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','jayson/promise','http','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~!@#$%^&-_=+[{]}.','request','then','info','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','Setting,\x20%s,\x20%s','message','request\x20sent','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','stack','name','index','Setting','rawAttributes','type','key','map'];(function(_0x118305,_0x392afe){var _0x528027=function(_0xf3962b){while(--_0xf3962b){_0x118305['push'](_0x118305['shift']());}};_0x528027(++_0x392afe);}(_0x075c,0x130));var _0xc075=function(_0xa899ba,_0x1e6462){_0xa899ba=_0xa899ba-0x0;var _0x562076=_0x075c[_0xa899ba];return _0x562076;};'use strict';var pdf=require(_0xc075('0x0'));var emlformat=require(_0xc075('0x1'));var rimraf=require(_0xc075('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc075('0x3'));var rp=require('request-promise');var moment=require(_0xc075('0x4'));var BPromise=require(_0xc075('0x5'));var Mustache=require(_0xc075('0x6'));var util=require(_0xc075('0x7'));var path=require(_0xc075('0x8'));var sox=require(_0xc075('0x9'));var csv=require(_0xc075('0xa'));var ejs=require(_0xc075('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xc075('0xc'));var crypto=require(_0xc075('0xd'));var jsforce=require(_0xc075('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xc075('0xa'));var querystring=require(_0xc075('0xf'));var Papa=require(_0xc075('0x10'));var Redis=require(_0xc075('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xc075('0x12'));var hardwareService=require(_0xc075('0x13'));var logger=require(_0xc075('0x14'))('api');var utils=require(_0xc075('0x15'));var config=require('../../config/environment');var db=require(_0xc075('0x16'))['db'];var jayson=require(_0xc075('0x17'));var client=jayson['client'][_0xc075('0x18')]({'port':0x232a});function checkPasswordPattern(_0x26a627,_0x4d2736,_0x219f75){if(_0x219f75){var _0x16c53b=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x16c53b['test'](_0x4d2736)){return _0x26a627;}else{throw new db[(_0xc075('0x19'))]['ValidationError'](_0xc075('0x1a'));}}else{return _0x26a627;}}function respondWithRpcPromise(_0x2dc208,_0x19baf3,_0x3b5898,_0x199d0d){return new BPromise(function(_0x4a2a3e,_0x144030){var _0x182b12=_0x199d0d||client;return _0x182b12[_0xc075('0x1b')](_0x2dc208,_0x3b5898)[_0xc075('0x1c')](function(_0x5262d9){logger[_0xc075('0x1d')]('Setting,\x20%s,\x20%s',_0x19baf3,'request\x20sent');logger[_0xc075('0x1e')](_0xc075('0x1f'),_0x19baf3,'request\x20sent',JSON[_0xc075('0x20')](_0x5262d9));if(_0x5262d9[_0xc075('0x21')]){if(_0x5262d9[_0xc075('0x21')][_0xc075('0x22')]===0x1f4){logger[_0xc075('0x21')](_0xc075('0x23'),_0x19baf3,_0x5262d9['error'][_0xc075('0x24')]);return _0x144030(_0x5262d9[_0xc075('0x21')][_0xc075('0x24')]);}logger[_0xc075('0x21')](_0xc075('0x23'),_0x19baf3,_0x5262d9[_0xc075('0x21')][_0xc075('0x24')]);return _0x4a2a3e(_0x5262d9[_0xc075('0x21')][_0xc075('0x24')]);}else{logger[_0xc075('0x1d')](_0xc075('0x23'),_0x19baf3,_0xc075('0x25'));_0x4a2a3e(_0x5262d9[_0xc075('0x26')][_0xc075('0x24')]);}})[_0xc075('0x27')](function(_0x50cd44){logger[_0xc075('0x21')]('Setting,\x20%s,\x20%s',_0x19baf3,_0x50cd44);_0x144030(_0x50cd44);});});}function respondWithStatusCode(_0x1bbf44,_0x43054f){_0x43054f=_0x43054f||0xcc;return function(_0x2f0dc7){if(_0x2f0dc7){return _0x1bbf44[_0xc075('0x28')](_0x43054f);}return _0x1bbf44[_0xc075('0x29')](_0x43054f)[_0xc075('0x2a')]();};}function respondWithResult(_0x2883c0,_0x3b068d){_0x3b068d=_0x3b068d||0xc8;return function(_0x268be5){if(_0x268be5){return _0x2883c0[_0xc075('0x29')](_0x3b068d)[_0xc075('0x2b')](_0x268be5);}};}function respondWithFilteredResult(_0x3dbe34,_0x1a27aa){return function(_0x3e1b57){if(_0x3e1b57){var _0x4e9258=_0x3e1b57[_0xc075('0x2c')],_0x26e368=_0x1a27aa[_0xc075('0x2d')],_0x302ea4=_0x1a27aa[_0xc075('0x2d')]+_0x1a27aa[_0xc075('0x2e')],_0x19bf84;if(_0x302ea4>=_0x4e9258){_0x302ea4=_0x4e9258;_0x19bf84=0xc8;}else{_0x19bf84=0xce;}_0x3dbe34[_0xc075('0x29')](_0x19bf84);return _0x3dbe34[_0xc075('0x2f')](_0xc075('0x30'),_0x26e368+'-'+_0x302ea4+'/'+_0x4e9258)[_0xc075('0x2b')](_0x3e1b57);}return null;};}function patchUpdates(_0x404317){return function(_0x53aa4c){try{jsonpatch[_0xc075('0x31')](_0x53aa4c,_0x404317,!![]);}catch(_0x3bcb0a){return BPromise[_0xc075('0x32')](_0x3bcb0a);}return _0x53aa4c[_0xc075('0x33')]();};}function saveUpdates(_0x26b0a5,_0xb9720c){return function(_0x3ac5f3){if(_0x3ac5f3){return _0x3ac5f3[_0xc075('0x34')](_0x26b0a5)[_0xc075('0x1c')](function(_0x56940d){return _0x56940d;});}return null;};}function removeEntity(_0x4d5134,_0x21f1fd){return function(_0x16676b){if(_0x16676b){return _0x16676b[_0xc075('0x35')]()[_0xc075('0x1c')](function(){_0x4d5134[_0xc075('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x825a54,_0x3dd431){return function(_0x108fb3){if(!_0x108fb3){_0x825a54['sendStatus'](0x194);}return _0x108fb3;};}function handleError(_0x100c88,_0x5c2dd0){_0x5c2dd0=_0x5c2dd0||0x1f4;return function(_0x3f2f15){logger[_0xc075('0x21')](_0x3f2f15[_0xc075('0x36')]);if(_0x3f2f15['name']){delete _0x3f2f15[_0xc075('0x37')];}_0x100c88[_0xc075('0x29')](_0x5c2dd0)['send'](_0x3f2f15);};}exports[_0xc075('0x38')]=function(_0x3e51a3,_0x1ee9c0){var _0x146c02={},_0xca72b1={},_0x2c877a={'count':0x0,'rows':[]};var _0x4531f1=_['map'](db[_0xc075('0x39')][_0xc075('0x3a')],function(_0x5a3970){return{'name':_0x5a3970['fieldName'],'type':_0x5a3970[_0xc075('0x3b')][_0xc075('0x3c')]};});_0xca72b1['model']=_[_0xc075('0x3d')](_0x4531f1,_0xc075('0x37'));_0xca72b1['query']=_[_0xc075('0x3e')](_0x3e51a3[_0xc075('0x3f')]);_0xca72b1['filters']=_[_0xc075('0x40')](_0xca72b1[_0xc075('0x41')],_0xca72b1['query']);_0x146c02[_0xc075('0x42')]=_['intersection'](_0xca72b1[_0xc075('0x41')],qs[_0xc075('0x43')](_0x3e51a3[_0xc075('0x3f')][_0xc075('0x43')]));_0x146c02[_0xc075('0x42')]=_0x146c02[_0xc075('0x42')][_0xc075('0x44')]?_0x146c02['attributes']:_0xca72b1[_0xc075('0x41')];if(!_0x3e51a3[_0xc075('0x3f')][_0xc075('0x45')](_0xc075('0x46'))){_0x146c02['limit']=qs[_0xc075('0x2e')](_0x3e51a3['query'][_0xc075('0x2e')]);_0x146c02[_0xc075('0x2d')]=qs[_0xc075('0x2d')](_0x3e51a3[_0xc075('0x3f')]['offset']);}_0x146c02[_0xc075('0x47')]=qs[_0xc075('0x48')](_0x3e51a3[_0xc075('0x3f')][_0xc075('0x48')]);_0x146c02[_0xc075('0x49')]=qs[_0xc075('0x4a')](_['pick'](_0x3e51a3['query'],_0xca72b1['filters']),_0x4531f1);if(_0x3e51a3['query'][_0xc075('0x4b')]){_0x146c02[_0xc075('0x49')]=_['merge'](_0x146c02['where'],{'$or':_[_0xc075('0x3d')](_0x4531f1,function(_0x21b574){if(_0x21b574['type']!==_0xc075('0x4c')){var _0xdead9f={};_0xdead9f[_0x21b574['name']]={'$like':'%'+_0x3e51a3['query']['filter']+'%'};return _0xdead9f;}})});}_0x146c02=_[_0xc075('0x4d')]({},_0x146c02,_0x3e51a3[_0xc075('0x4e')]);var _0x3cf5f5={'where':_0x146c02[_0xc075('0x49')]};return db[_0xc075('0x39')][_0xc075('0x2c')](_0x3cf5f5)[_0xc075('0x1c')](function(_0x5b66fd){_0x2c877a[_0xc075('0x2c')]=_0x5b66fd;if(_0x3e51a3['query'][_0xc075('0x4f')]){_0x146c02[_0xc075('0x50')]=[{'all':!![]}];}return db['Setting']['findAll'](_0x146c02);})['then'](function(_0x430ad7){_0x2c877a[_0xc075('0x51')]=_0x430ad7;return _0x2c877a;})[_0xc075('0x1c')](respondWithFilteredResult(_0x1ee9c0,_0x146c02))['catch'](handleError(_0x1ee9c0,null));};exports[_0xc075('0x52')]=function(_0x21c48a,_0x375ccf){var _0x1cdcde={'raw':![],'where':{'id':_0x21c48a['params']['id']}},_0xbf0551={};_0xbf0551[_0xc075('0x41')]=_[_0xc075('0x3e')](db[_0xc075('0x39')]['rawAttributes']);_0xbf0551['query']=_[_0xc075('0x3e')](_0x21c48a[_0xc075('0x3f')]);_0xbf0551['filters']=_[_0xc075('0x40')](_0xbf0551[_0xc075('0x41')],_0xbf0551[_0xc075('0x3f')]);_0x1cdcde[_0xc075('0x42')]=_[_0xc075('0x40')](_0xbf0551[_0xc075('0x41')],qs[_0xc075('0x43')](_0x21c48a[_0xc075('0x3f')]['fields']));_0x1cdcde[_0xc075('0x42')]=_0x1cdcde['attributes']['length']?_0x1cdcde[_0xc075('0x42')]:_0xbf0551[_0xc075('0x41')];if(_0x21c48a['query'][_0xc075('0x4f')]){_0x1cdcde[_0xc075('0x50')]=[{'all':!![]}];}_0x1cdcde=_[_0xc075('0x4d')]({},_0x1cdcde,_0x21c48a[_0xc075('0x4e')]);return db[_0xc075('0x39')][_0xc075('0x53')](_0x1cdcde)[_0xc075('0x1c')](handleEntityNotFound(_0x375ccf,null))[_0xc075('0x1c')](respondWithResult(_0x375ccf,null))[_0xc075('0x27')](handleError(_0x375ccf,null));};exports['update']=function(_0x5da3ad,_0x3abb9d){if(_0x5da3ad[_0xc075('0x54')]['id']){delete _0x5da3ad[_0xc075('0x54')]['id'];}return db[_0xc075('0x39')][_0xc075('0x53')]({'where':{'id':_0x5da3ad[_0xc075('0x55')]['id']}})['then'](handleEntityNotFound(_0x3abb9d,null))[_0xc075('0x1c')](saveUpdates(_0x5da3ad[_0xc075('0x54')],null))[_0xc075('0x1c')](respondWithResult(_0x3abb9d,null))[_0xc075('0x27')](handleError(_0x3abb9d,null));};exports[_0xc075('0x56')]=function(_0x5ab28d,_0x432780,_0x3f3506){if(_0x5ab28d[_0xc075('0x57')]&&_0x5ab28d[_0xc075('0x57')][_0xc075('0x58')]){_0x5ab28d[_0xc075('0x54')][_0xc075('0x59')]=_0x5ab28d[_0xc075('0x57')][_0xc075('0x58')];}return db[_0xc075('0x39')]['find']({'where':{'id':_0x5ab28d[_0xc075('0x55')]['id']}})[_0xc075('0x1c')](handleEntityNotFound(_0x432780,null))[_0xc075('0x1c')](saveUpdates(_0x5ab28d[_0xc075('0x54')],null))[_0xc075('0x1c')](respondWithResult(_0x432780,null))[_0xc075('0x27')](handleError(_0x432780,null));};exports[_0xc075('0x5a')]=function(_0x17b128,_0x7b667e,_0x3f3bf2){if(_0x17b128[_0xc075('0x57')]&&_0x17b128['file']['filename']){_0x17b128['body']['loginLogo']=_0x17b128['file'][_0xc075('0x58')];}return db['Setting'][_0xc075('0x53')]({'where':{'id':_0x17b128[_0xc075('0x55')]['id']}})['then'](handleEntityNotFound(_0x7b667e,null))[_0xc075('0x1c')](saveUpdates(_0x17b128['body'],null))[_0xc075('0x1c')](respondWithResult(_0x7b667e,null))[_0xc075('0x27')](handleError(_0x7b667e,null));};var utilLicense=require(_0xc075('0x5b'));exports[_0xc075('0x5c')]=function(_0x50fa25,_0x3dddda,_0x402e1f){var _0x4ebc01='server/files/images/logos';var _0x1ff602={'custom':![]};return utilLicense[_0xc075('0x5d')]()[_0xc075('0x1c')](function(_0x1e16ea){if(_0x1e16ea){_0x1ff602=_0x1e16ea;}return db['Setting'][_0xc075('0x53')]({'where':{'id':_0x50fa25[_0xc075('0x55')]['id']},'attributes':['logo',_0xc075('0x5e'),'preferred',_0xc075('0x5f'),_0xc075('0x60'),'defaultLoginLogo',_0xc075('0x61'),_0xc075('0x62')],'raw':!![]});})[_0xc075('0x1c')](handleEntityNotFound(_0x3dddda,null))[_0xc075('0x1c')](function(_0x5322d6){if(_0x5322d6){var _0x303e2f=_0x5322d6[_0xc075('0x59')]&&fs[_0xc075('0x63')](path[_0xc075('0x64')](config[_0xc075('0x65')],_0x4ebc01,_[_0xc075('0x66')](_0x5322d6['logo'])))?path[_0xc075('0x64')](config['root'],_0x4ebc01,_[_0xc075('0x66')](_0x5322d6[_0xc075('0x59')])):path[_0xc075('0x64')](config['root'],_0x4ebc01,_[_0xc075('0x66')](_0xc075('0x67')));var _0x583bc4=_0xc075('0x68')+_[_0xc075('0x69')](_0xc075('0x59'));if(_0x5322d6[_0x583bc4]||!_0x1ff602[_0xc075('0x6a')]){_0x303e2f=path[_0xc075('0x64')](config['root'],_0x4ebc01,_[_0xc075('0x66')](_0xc075('0x67')));}if(!fs[_0xc075('0x63')](_0x303e2f)){throw new db[(_0xc075('0x19'))][(_0xc075('0x6b'))](_['upperFirst']('logo')+'\x20not\x20found');}return _0x3dddda[_0xc075('0x6c')](_0x303e2f);}})['catch'](handleError(_0x3dddda,null));};var utilLicense=require('../../config/license/util');exports['getLogoLogin']=function(_0x2a3138,_0x44d2c1,_0x1ce127){var _0x29b20e='server/files/images/logos';var _0x3354ad={'custom':![]};return utilLicense[_0xc075('0x5d')]()[_0xc075('0x1c')](function(_0x4f5a89){if(_0x4f5a89){_0x3354ad=_0x4f5a89;}return db[_0xc075('0x39')][_0xc075('0x53')]({'where':{'id':_0x2a3138[_0xc075('0x55')]['id']},'attributes':[_0xc075('0x59'),_0xc075('0x5e'),'preferred','favicon',_0xc075('0x60'),_0xc075('0x6d'),_0xc075('0x61'),_0xc075('0x62')],'raw':!![]});})[_0xc075('0x1c')](handleEntityNotFound(_0x44d2c1,null))['then'](function(_0xd5c697){if(_0xd5c697){var _0x366a16=_0xd5c697[_0xc075('0x5e')]&&fs['existsSync'](path['join'](config[_0xc075('0x65')],_0x29b20e,_[_0xc075('0x66')](_0xd5c697[_0xc075('0x5e')])))?path[_0xc075('0x64')](config['root'],_0x29b20e,_['toLower'](_0xd5c697[_0xc075('0x5e')])):path[_0xc075('0x64')](config[_0xc075('0x65')],_0x29b20e,_[_0xc075('0x66')](_0xc075('0x6e')));var _0x2b3e1c='default'+_[_0xc075('0x69')](_0xc075('0x5e'));if(_0xd5c697[_0x2b3e1c]||!_0x3354ad['custom']){_0x366a16=path[_0xc075('0x64')](config[_0xc075('0x65')],_0x29b20e,_[_0xc075('0x66')](_0xc075('0x6e')));}if(!fs['existsSync'](_0x366a16)){throw new db[(_0xc075('0x19'))][(_0xc075('0x6b'))](_['upperFirst'](_0xc075('0x5e'))+_0xc075('0x6f'));}return _0x44d2c1[_0xc075('0x6c')](_0x366a16);}})[_0xc075('0x27')](handleError(_0x44d2c1,null));};exports[_0xc075('0x70')]=function(_0x5e911c,_0x453d4d){return db[_0xc075('0x39')][_0xc075('0x53')]({'where':{'id':_0x5e911c[_0xc075('0x55')]['id']},'attributes':[_0xc075('0x71')]})[_0xc075('0x1c')](respondWithResult(_0x453d4d,null))[_0xc075('0x27')](handleError(_0x453d4d,null));};exports[_0xc075('0x72')]=function(_0x29038d,_0x399e95,_0x12e568){if(_0x29038d[_0xc075('0x57')]&&_0x29038d[_0xc075('0x57')]['filename']){_0x29038d['body']['preferred']=_0x29038d[_0xc075('0x57')]['filename'];}return db['Setting']['find']({'where':{'id':_0x29038d[_0xc075('0x55')]['id']}})[_0xc075('0x1c')](handleEntityNotFound(_0x399e95,null))[_0xc075('0x1c')](saveUpdates(_0x29038d[_0xc075('0x54')],null))['then'](respondWithResult(_0x399e95,null))['catch'](handleError(_0x399e95,null));};var utilLicense=require(_0xc075('0x5b'));exports[_0xc075('0x73')]=function(_0x88437,_0x1d41fa,_0x2890bf){var _0x812b13=_0xc075('0x74');var _0x12fd51={'custom':![]};return utilLicense[_0xc075('0x5d')]()[_0xc075('0x1c')](function(_0x3cabf3){if(_0x3cabf3){_0x12fd51=_0x3cabf3;}return db[_0xc075('0x39')]['find']({'where':{'id':_0x88437[_0xc075('0x55')]['id']},'attributes':[_0xc075('0x59'),_0xc075('0x5e'),'preferred',_0xc075('0x5f'),'defaultLogo',_0xc075('0x6d'),'defaultPreferred',_0xc075('0x62')],'raw':!![]});})[_0xc075('0x1c')](handleEntityNotFound(_0x1d41fa,null))[_0xc075('0x1c')](function(_0x339f4f){if(_0x339f4f){var _0x42de94=_0x339f4f[_0xc075('0x75')]&&fs[_0xc075('0x63')](path[_0xc075('0x64')](config[_0xc075('0x65')],_0x812b13,_[_0xc075('0x66')](_0x339f4f[_0xc075('0x75')])))?path[_0xc075('0x64')](config['root'],_0x812b13,_[_0xc075('0x66')](_0x339f4f[_0xc075('0x75')])):path[_0xc075('0x64')](config[_0xc075('0x65')],_0x812b13,_[_0xc075('0x66')](_0xc075('0x76')));var _0x17bc00=_0xc075('0x68')+_['upperFirst'](_0xc075('0x75'));if(_0x339f4f[_0x17bc00]||!_0x12fd51['custom']||!_0x12fd51[_0xc075('0x75')]){_0x42de94=path[_0xc075('0x64')](config[_0xc075('0x65')],_0x812b13,_[_0xc075('0x66')](_0xc075('0x76')));}if(!fs[_0xc075('0x63')](_0x42de94)){throw new db[(_0xc075('0x19'))][(_0xc075('0x6b'))](_[_0xc075('0x69')](_0xc075('0x75'))+'\x20not\x20found');}return _0x1d41fa['download'](_0x42de94);}})[_0xc075('0x27')](handleError(_0x1d41fa,null));};exports[_0xc075('0x77')]=function(_0x197c13,_0x26bcfd,_0x51fd72){if(_0x197c13[_0xc075('0x57')]&&_0x197c13[_0xc075('0x57')][_0xc075('0x58')]){_0x197c13[_0xc075('0x54')]['favicon']=_0x197c13['file'][_0xc075('0x58')];}return db[_0xc075('0x39')][_0xc075('0x53')]({'where':{'id':_0x197c13[_0xc075('0x55')]['id']}})[_0xc075('0x1c')](handleEntityNotFound(_0x26bcfd,null))[_0xc075('0x1c')](saveUpdates(_0x197c13[_0xc075('0x54')],null))[_0xc075('0x1c')](respondWithResult(_0x26bcfd,null))[_0xc075('0x27')](handleError(_0x26bcfd,null));};var utilLicense=require('../../config/license/util');exports[_0xc075('0x78')]=function(_0x21b38c,_0x223632,_0x370fb2){var _0x1ecb76=_0xc075('0x74');var _0x24c17d={'custom':![]};return utilLicense[_0xc075('0x5d')]()[_0xc075('0x1c')](function(_0x4f3a2f){if(_0x4f3a2f){_0x24c17d=_0x4f3a2f;}return db[_0xc075('0x39')][_0xc075('0x53')]({'where':{'id':_0x21b38c[_0xc075('0x55')]['id']},'attributes':['logo',_0xc075('0x5e'),_0xc075('0x75'),_0xc075('0x5f'),_0xc075('0x60'),_0xc075('0x6d'),_0xc075('0x61'),_0xc075('0x62')],'raw':!![]});})[_0xc075('0x1c')](handleEntityNotFound(_0x223632,null))[_0xc075('0x1c')](function(_0x57b04b){if(_0x57b04b){var _0x25ed7b=_0x57b04b[_0xc075('0x5f')]&&fs[_0xc075('0x63')](path[_0xc075('0x64')](config[_0xc075('0x65')],_0x1ecb76,_[_0xc075('0x66')](_0x57b04b[_0xc075('0x5f')])))?path['join'](config[_0xc075('0x65')],_0x1ecb76,_[_0xc075('0x66')](_0x57b04b['favicon'])):path[_0xc075('0x64')](config['root'],_0x1ecb76,_[_0xc075('0x66')](_0xc075('0x79')));var _0x5a6a2c=_0xc075('0x68')+_['upperFirst'](_0xc075('0x5f'));if(_0x57b04b[_0x5a6a2c]||!_0x24c17d['custom']){_0x25ed7b=path[_0xc075('0x64')](config[_0xc075('0x65')],_0x1ecb76,_[_0xc075('0x66')](_0xc075('0x79')));}if(!fs[_0xc075('0x63')](_0x25ed7b)){throw new db[(_0xc075('0x19'))][(_0xc075('0x6b'))](_[_0xc075('0x69')](_0xc075('0x5f'))+_0xc075('0x6f'));}return _0x223632[_0xc075('0x6c')](_0x25ed7b);}})[_0xc075('0x27')](handleError(_0x223632,null));}; \ No newline at end of file +var _0xb2f6=['Sequelize','preferred','defaultLogo','default_loginLogo.svg','custom','\x20not\x20found','download','gdpr','securePassword','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','eml-format','zip-dir','moment','bluebird','path','sox','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','jayson/promise','client','http','test','ValidationError','request','then','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','destroy','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','Setting','intersection','merge','find','update','body','addLogo','file','filename','logo','loginLogo','../../config/license/util','getLogo','server/files/images/logos','getLicense','favicon','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','join','root','toLower','default_logo.svg','default','upperFirst'];(function(_0x2b7794,_0x3f2b24){var _0x560d3a=function(_0x1b0a0a){while(--_0x1b0a0a){_0x2b7794['push'](_0x2b7794['shift']());}};_0x560d3a(++_0x3f2b24);}(_0xb2f6,0x1e1));var _0x6b2f=function(_0x41f1d9,_0xfb0112){_0x41f1d9=_0x41f1d9-0x0;var _0x29e23e=_0xb2f6[_0x41f1d9];return _0x29e23e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x6b2f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6b2f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6b2f('0x2'));var BPromise=require(_0x6b2f('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x6b2f('0x4'));var sox=require(_0x6b2f('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x6b2f('0x6'));var squel=require(_0x6b2f('0x7'));var crypto=require(_0x6b2f('0x8'));var jsforce=require('jsforce');var deskjs=require(_0x6b2f('0x9'));var toCsv=require(_0x6b2f('0xa'));var querystring=require(_0x6b2f('0xb'));var Papa=require(_0x6b2f('0xc'));var Redis=require(_0x6b2f('0xd'));var authService=require(_0x6b2f('0xe'));var qs=require(_0x6b2f('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6b2f('0x10'));var logger=require(_0x6b2f('0x11'))(_0x6b2f('0x12'));var utils=require(_0x6b2f('0x13'));var config=require(_0x6b2f('0x14'));var db=require('../../mysqldb')['db'];var jayson=require(_0x6b2f('0x15'));var client=jayson[_0x6b2f('0x16')][_0x6b2f('0x17')]({'port':0x232a});function checkPasswordPattern(_0x326431,_0x49bc08,_0x31ac37){if(_0x31ac37){var _0x4fbee8=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4fbee8[_0x6b2f('0x18')](_0x49bc08)){return _0x326431;}else{throw new db['Sequelize'][(_0x6b2f('0x19'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x326431;}}function respondWithRpcPromise(_0x16695f,_0x59327f,_0x332d2a,_0x5c717b){return new BPromise(function(_0x43a8ae,_0x5f4020){var _0x67c3c2=_0x5c717b||client;return _0x67c3c2[_0x6b2f('0x1a')](_0x16695f,_0x332d2a)[_0x6b2f('0x1b')](function(_0x3c420a){logger['info'](_0x6b2f('0x1c'),_0x59327f,_0x6b2f('0x1d'));logger[_0x6b2f('0x1e')](_0x6b2f('0x1f'),_0x59327f,_0x6b2f('0x1d'),JSON['stringify'](_0x3c420a));if(_0x3c420a[_0x6b2f('0x20')]){if(_0x3c420a[_0x6b2f('0x20')][_0x6b2f('0x21')]===0x1f4){logger[_0x6b2f('0x20')](_0x6b2f('0x1c'),_0x59327f,_0x3c420a[_0x6b2f('0x20')]['message']);return _0x5f4020(_0x3c420a[_0x6b2f('0x20')][_0x6b2f('0x22')]);}logger[_0x6b2f('0x20')](_0x6b2f('0x1c'),_0x59327f,_0x3c420a[_0x6b2f('0x20')][_0x6b2f('0x22')]);return _0x43a8ae(_0x3c420a[_0x6b2f('0x20')]['message']);}else{logger[_0x6b2f('0x23')](_0x6b2f('0x1c'),_0x59327f,_0x6b2f('0x1d'));_0x43a8ae(_0x3c420a[_0x6b2f('0x24')][_0x6b2f('0x22')]);}})[_0x6b2f('0x25')](function(_0x4847dc){logger[_0x6b2f('0x20')](_0x6b2f('0x1c'),_0x59327f,_0x4847dc);_0x5f4020(_0x4847dc);});});}function respondWithStatusCode(_0x5b6bed,_0x18af5f){_0x18af5f=_0x18af5f||0xcc;return function(_0x405e1a){if(_0x405e1a){return _0x5b6bed[_0x6b2f('0x26')](_0x18af5f);}return _0x5b6bed[_0x6b2f('0x27')](_0x18af5f)[_0x6b2f('0x28')]();};}function respondWithResult(_0x4e4ccd,_0x16f0e6){_0x16f0e6=_0x16f0e6||0xc8;return function(_0x5c1b32){if(_0x5c1b32){return _0x4e4ccd[_0x6b2f('0x27')](_0x16f0e6)[_0x6b2f('0x29')](_0x5c1b32);}};}function respondWithFilteredResult(_0x5f1e00,_0x521c40){return function(_0x484ad1){if(_0x484ad1){var _0x55a9a1=_0x484ad1[_0x6b2f('0x2a')],_0x2f56ff=_0x521c40[_0x6b2f('0x2b')],_0x46940d=_0x521c40[_0x6b2f('0x2b')]+_0x521c40[_0x6b2f('0x2c')],_0x47afee;if(_0x46940d>=_0x55a9a1){_0x46940d=_0x55a9a1;_0x47afee=0xc8;}else{_0x47afee=0xce;}_0x5f1e00[_0x6b2f('0x27')](_0x47afee);return _0x5f1e00[_0x6b2f('0x2d')](_0x6b2f('0x2e'),_0x2f56ff+'-'+_0x46940d+'/'+_0x55a9a1)[_0x6b2f('0x29')](_0x484ad1);}return null;};}function patchUpdates(_0x502a15){return function(_0x57de17){try{jsonpatch['apply'](_0x57de17,_0x502a15,!![]);}catch(_0x20e425){return BPromise[_0x6b2f('0x2f')](_0x20e425);}return _0x57de17['save']();};}function saveUpdates(_0x54c745,_0x2b69ea){return function(_0x1e5c62){if(_0x1e5c62){return _0x1e5c62['update'](_0x54c745)['then'](function(_0x4c87ed){return _0x4c87ed;});}return null;};}function removeEntity(_0x3d1d25,_0x51ba04){return function(_0x4d3cef){if(_0x4d3cef){return _0x4d3cef[_0x6b2f('0x30')]()[_0x6b2f('0x1b')](function(){_0x3d1d25['status'](0xcc)[_0x6b2f('0x28')]();});}};}function handleEntityNotFound(_0x1a1591,_0x5b7107){return function(_0x57da75){if(!_0x57da75){_0x1a1591[_0x6b2f('0x26')](0x194);}return _0x57da75;};}function handleError(_0xb62e74,_0x161947){_0x161947=_0x161947||0x1f4;return function(_0x2db458){logger[_0x6b2f('0x20')](_0x2db458[_0x6b2f('0x31')]);if(_0x2db458[_0x6b2f('0x32')]){delete _0x2db458['name'];}_0xb62e74[_0x6b2f('0x27')](_0x161947)[_0x6b2f('0x33')](_0x2db458);};}exports['index']=function(_0x275ebf,_0x441e85){var _0x34b16f={},_0xee1f29={},_0x3c6f74={'count':0x0,'rows':[]};var _0x65c009=_[_0x6b2f('0x34')](db['Setting'][_0x6b2f('0x35')],function(_0x58487b){return{'name':_0x58487b[_0x6b2f('0x36')],'type':_0x58487b[_0x6b2f('0x37')][_0x6b2f('0x38')]};});_0xee1f29[_0x6b2f('0x39')]=_[_0x6b2f('0x34')](_0x65c009,'name');_0xee1f29['query']=_['keys'](_0x275ebf[_0x6b2f('0x3a')]);_0xee1f29[_0x6b2f('0x3b')]=_['intersection'](_0xee1f29[_0x6b2f('0x39')],_0xee1f29[_0x6b2f('0x3a')]);_0x34b16f[_0x6b2f('0x3c')]=_['intersection'](_0xee1f29['model'],qs[_0x6b2f('0x3d')](_0x275ebf[_0x6b2f('0x3a')]['fields']));_0x34b16f[_0x6b2f('0x3c')]=_0x34b16f[_0x6b2f('0x3c')][_0x6b2f('0x3e')]?_0x34b16f['attributes']:_0xee1f29[_0x6b2f('0x39')];if(!_0x275ebf['query'][_0x6b2f('0x3f')]('nolimit')){_0x34b16f[_0x6b2f('0x2c')]=qs[_0x6b2f('0x2c')](_0x275ebf[_0x6b2f('0x3a')][_0x6b2f('0x2c')]);_0x34b16f[_0x6b2f('0x2b')]=qs[_0x6b2f('0x2b')](_0x275ebf[_0x6b2f('0x3a')][_0x6b2f('0x2b')]);}_0x34b16f[_0x6b2f('0x40')]=qs['sort'](_0x275ebf[_0x6b2f('0x3a')][_0x6b2f('0x41')]);_0x34b16f['where']=qs['filters'](_[_0x6b2f('0x42')](_0x275ebf[_0x6b2f('0x3a')],_0xee1f29[_0x6b2f('0x3b')]),_0x65c009);if(_0x275ebf[_0x6b2f('0x3a')][_0x6b2f('0x43')]){_0x34b16f[_0x6b2f('0x44')]=_['merge'](_0x34b16f['where'],{'$or':_[_0x6b2f('0x34')](_0x65c009,function(_0x20757b){if(_0x20757b[_0x6b2f('0x37')]!==_0x6b2f('0x45')){var _0x3fbe36={};_0x3fbe36[_0x20757b[_0x6b2f('0x32')]]={'$like':'%'+_0x275ebf['query']['filter']+'%'};return _0x3fbe36;}})});}_0x34b16f=_['merge']({},_0x34b16f,_0x275ebf[_0x6b2f('0x46')]);var _0x12b817={'where':_0x34b16f[_0x6b2f('0x44')]};return db['Setting'][_0x6b2f('0x2a')](_0x12b817)[_0x6b2f('0x1b')](function(_0x40f1c6){_0x3c6f74[_0x6b2f('0x2a')]=_0x40f1c6;if(_0x275ebf[_0x6b2f('0x3a')][_0x6b2f('0x47')]){_0x34b16f[_0x6b2f('0x48')]=[{'all':!![]}];}return db['Setting'][_0x6b2f('0x49')](_0x34b16f);})[_0x6b2f('0x1b')](function(_0x3843a7){_0x3c6f74[_0x6b2f('0x4a')]=_0x3843a7;return _0x3c6f74;})[_0x6b2f('0x1b')](respondWithFilteredResult(_0x441e85,_0x34b16f))[_0x6b2f('0x25')](handleError(_0x441e85,null));};exports[_0x6b2f('0x4b')]=function(_0x52d1de,_0x2091eb){var _0x345b17={'raw':![],'where':{'id':_0x52d1de[_0x6b2f('0x4c')]['id']}},_0x27d8e2={};_0x27d8e2[_0x6b2f('0x39')]=_[_0x6b2f('0x4d')](db[_0x6b2f('0x4e')][_0x6b2f('0x35')]);_0x27d8e2['query']=_['keys'](_0x52d1de[_0x6b2f('0x3a')]);_0x27d8e2[_0x6b2f('0x3b')]=_[_0x6b2f('0x4f')](_0x27d8e2[_0x6b2f('0x39')],_0x27d8e2['query']);_0x345b17[_0x6b2f('0x3c')]=_[_0x6b2f('0x4f')](_0x27d8e2[_0x6b2f('0x39')],qs[_0x6b2f('0x3d')](_0x52d1de[_0x6b2f('0x3a')]['fields']));_0x345b17[_0x6b2f('0x3c')]=_0x345b17[_0x6b2f('0x3c')][_0x6b2f('0x3e')]?_0x345b17[_0x6b2f('0x3c')]:_0x27d8e2['model'];if(_0x52d1de[_0x6b2f('0x3a')][_0x6b2f('0x47')]){_0x345b17['include']=[{'all':!![]}];}_0x345b17=_[_0x6b2f('0x50')]({},_0x345b17,_0x52d1de[_0x6b2f('0x46')]);return db[_0x6b2f('0x4e')][_0x6b2f('0x51')](_0x345b17)[_0x6b2f('0x1b')](handleEntityNotFound(_0x2091eb,null))[_0x6b2f('0x1b')](respondWithResult(_0x2091eb,null))[_0x6b2f('0x25')](handleError(_0x2091eb,null));};exports[_0x6b2f('0x52')]=function(_0x3b6d9a,_0x25c0aa){if(_0x3b6d9a[_0x6b2f('0x53')]['id']){delete _0x3b6d9a['body']['id'];}return db['Setting'][_0x6b2f('0x51')]({'where':{'id':_0x3b6d9a[_0x6b2f('0x4c')]['id']}})['then'](handleEntityNotFound(_0x25c0aa,null))[_0x6b2f('0x1b')](saveUpdates(_0x3b6d9a[_0x6b2f('0x53')],null))[_0x6b2f('0x1b')](respondWithResult(_0x25c0aa,null))[_0x6b2f('0x25')](handleError(_0x25c0aa,null));};exports[_0x6b2f('0x54')]=function(_0x3d9080,_0x1fbdbb,_0x1f32bb){if(_0x3d9080['file']&&_0x3d9080[_0x6b2f('0x55')][_0x6b2f('0x56')]){_0x3d9080['body'][_0x6b2f('0x57')]=_0x3d9080['file'][_0x6b2f('0x56')];}return db['Setting']['find']({'where':{'id':_0x3d9080[_0x6b2f('0x4c')]['id']}})[_0x6b2f('0x1b')](handleEntityNotFound(_0x1fbdbb,null))['then'](saveUpdates(_0x3d9080[_0x6b2f('0x53')],null))['then'](respondWithResult(_0x1fbdbb,null))[_0x6b2f('0x25')](handleError(_0x1fbdbb,null));};exports['addLogoLogin']=function(_0x263917,_0x4a4263,_0x404038){if(_0x263917[_0x6b2f('0x55')]&&_0x263917['file'][_0x6b2f('0x56')]){_0x263917[_0x6b2f('0x53')][_0x6b2f('0x58')]=_0x263917[_0x6b2f('0x55')][_0x6b2f('0x56')];}return db[_0x6b2f('0x4e')][_0x6b2f('0x51')]({'where':{'id':_0x263917[_0x6b2f('0x4c')]['id']}})[_0x6b2f('0x1b')](handleEntityNotFound(_0x4a4263,null))[_0x6b2f('0x1b')](saveUpdates(_0x263917['body'],null))[_0x6b2f('0x1b')](respondWithResult(_0x4a4263,null))[_0x6b2f('0x25')](handleError(_0x4a4263,null));};var utilLicense=require(_0x6b2f('0x59'));exports[_0x6b2f('0x5a')]=function(_0x2d283b,_0x5cd995,_0x356436){var _0x2b49f3=_0x6b2f('0x5b');var _0x402ef7={'custom':![]};return utilLicense[_0x6b2f('0x5c')]()[_0x6b2f('0x1b')](function(_0x38173a){if(_0x38173a){_0x402ef7=_0x38173a;}return db[_0x6b2f('0x4e')][_0x6b2f('0x51')]({'where':{'id':_0x2d283b['params']['id']},'attributes':[_0x6b2f('0x57'),'loginLogo','preferred',_0x6b2f('0x5d'),'defaultLogo',_0x6b2f('0x5e'),_0x6b2f('0x5f'),_0x6b2f('0x60')],'raw':!![]});})[_0x6b2f('0x1b')](handleEntityNotFound(_0x5cd995,null))['then'](function(_0x3b7dcd){if(_0x3b7dcd){var _0x39c1f9=_0x3b7dcd[_0x6b2f('0x57')]&&fs[_0x6b2f('0x61')](path[_0x6b2f('0x62')](config[_0x6b2f('0x63')],_0x2b49f3,_[_0x6b2f('0x64')](_0x3b7dcd['logo'])))?path[_0x6b2f('0x62')](config['root'],_0x2b49f3,_[_0x6b2f('0x64')](_0x3b7dcd[_0x6b2f('0x57')])):path['join'](config[_0x6b2f('0x63')],_0x2b49f3,_['toLower'](_0x6b2f('0x65')));var _0x264756=_0x6b2f('0x66')+_[_0x6b2f('0x67')](_0x6b2f('0x57'));if(_0x3b7dcd[_0x264756]||!_0x402ef7['custom']){_0x39c1f9=path['join'](config['root'],_0x2b49f3,_[_0x6b2f('0x64')](_0x6b2f('0x65')));}if(!fs[_0x6b2f('0x61')](_0x39c1f9)){throw new db[(_0x6b2f('0x68'))][(_0x6b2f('0x19'))](_[_0x6b2f('0x67')](_0x6b2f('0x57'))+'\x20not\x20found');}return _0x5cd995['download'](_0x39c1f9);}})['catch'](handleError(_0x5cd995,null));};var utilLicense=require('../../config/license/util');exports['getLogoLogin']=function(_0x1a2dbf,_0x2ced33,_0x173449){var _0x2356c8=_0x6b2f('0x5b');var _0x25f2dc={'custom':![]};return utilLicense[_0x6b2f('0x5c')]()[_0x6b2f('0x1b')](function(_0x4192e5){if(_0x4192e5){_0x25f2dc=_0x4192e5;}return db[_0x6b2f('0x4e')][_0x6b2f('0x51')]({'where':{'id':_0x1a2dbf[_0x6b2f('0x4c')]['id']},'attributes':[_0x6b2f('0x57'),_0x6b2f('0x58'),_0x6b2f('0x69'),_0x6b2f('0x5d'),_0x6b2f('0x6a'),_0x6b2f('0x5e'),'defaultPreferred',_0x6b2f('0x60')],'raw':!![]});})[_0x6b2f('0x1b')](handleEntityNotFound(_0x2ced33,null))['then'](function(_0x4f171b){if(_0x4f171b){var _0x438c70=_0x4f171b[_0x6b2f('0x58')]&&fs[_0x6b2f('0x61')](path[_0x6b2f('0x62')](config[_0x6b2f('0x63')],_0x2356c8,_[_0x6b2f('0x64')](_0x4f171b[_0x6b2f('0x58')])))?path[_0x6b2f('0x62')](config['root'],_0x2356c8,_[_0x6b2f('0x64')](_0x4f171b[_0x6b2f('0x58')])):path[_0x6b2f('0x62')](config['root'],_0x2356c8,_[_0x6b2f('0x64')](_0x6b2f('0x6b')));var _0x165bf8=_0x6b2f('0x66')+_[_0x6b2f('0x67')]('loginLogo');if(_0x4f171b[_0x165bf8]||!_0x25f2dc[_0x6b2f('0x6c')]){_0x438c70=path[_0x6b2f('0x62')](config[_0x6b2f('0x63')],_0x2356c8,_[_0x6b2f('0x64')]('default_loginLogo.svg'));}if(!fs[_0x6b2f('0x61')](_0x438c70)){throw new db[(_0x6b2f('0x68'))][(_0x6b2f('0x19'))](_[_0x6b2f('0x67')](_0x6b2f('0x58'))+_0x6b2f('0x6d'));}return _0x2ced33[_0x6b2f('0x6e')](_0x438c70);}})[_0x6b2f('0x25')](handleError(_0x2ced33,null));};exports[_0x6b2f('0x6f')]=function(_0xe8d4a6,_0xebcc06){return db['Setting'][_0x6b2f('0x51')]({'where':{'id':_0xe8d4a6[_0x6b2f('0x4c')]['id']},'attributes':[_0x6b2f('0x70')]})[_0x6b2f('0x1b')](respondWithResult(_0xebcc06,null))[_0x6b2f('0x25')](handleError(_0xebcc06,null));};exports['addPreferred']=function(_0x264755,_0x1b0744,_0x222713){if(_0x264755[_0x6b2f('0x55')]&&_0x264755[_0x6b2f('0x55')][_0x6b2f('0x56')]){_0x264755[_0x6b2f('0x53')][_0x6b2f('0x69')]=_0x264755[_0x6b2f('0x55')]['filename'];}return db[_0x6b2f('0x4e')][_0x6b2f('0x51')]({'where':{'id':_0x264755[_0x6b2f('0x4c')]['id']}})[_0x6b2f('0x1b')](handleEntityNotFound(_0x1b0744,null))[_0x6b2f('0x1b')](saveUpdates(_0x264755['body'],null))[_0x6b2f('0x1b')](respondWithResult(_0x1b0744,null))[_0x6b2f('0x25')](handleError(_0x1b0744,null));};var utilLicense=require('../../config/license/util');exports['getPreferred']=function(_0x28e2c9,_0x38224a,_0x3e7208){var _0x410f31=_0x6b2f('0x5b');var _0x1a9efd={'custom':![]};return utilLicense[_0x6b2f('0x5c')]()[_0x6b2f('0x1b')](function(_0x78095b){if(_0x78095b){_0x1a9efd=_0x78095b;}return db[_0x6b2f('0x4e')]['find']({'where':{'id':_0x28e2c9[_0x6b2f('0x4c')]['id']},'attributes':[_0x6b2f('0x57'),'loginLogo',_0x6b2f('0x69'),_0x6b2f('0x5d'),_0x6b2f('0x6a'),'defaultLoginLogo',_0x6b2f('0x5f'),'defaultFavicon'],'raw':!![]});})[_0x6b2f('0x1b')](handleEntityNotFound(_0x38224a,null))['then'](function(_0x21d8db){if(_0x21d8db){var _0x49fb63=_0x21d8db[_0x6b2f('0x69')]&&fs['existsSync'](path[_0x6b2f('0x62')](config[_0x6b2f('0x63')],_0x410f31,_['toLower'](_0x21d8db[_0x6b2f('0x69')])))?path[_0x6b2f('0x62')](config['root'],_0x410f31,_['toLower'](_0x21d8db[_0x6b2f('0x69')])):path['join'](config[_0x6b2f('0x63')],_0x410f31,_['toLower'](_0x6b2f('0x71')));var _0x590fd7=_0x6b2f('0x66')+_[_0x6b2f('0x67')]('preferred');if(_0x21d8db[_0x590fd7]||!_0x1a9efd[_0x6b2f('0x6c')]||!_0x1a9efd[_0x6b2f('0x69')]){_0x49fb63=path['join'](config[_0x6b2f('0x63')],_0x410f31,_[_0x6b2f('0x64')]('default_preferred.png'));}if(!fs[_0x6b2f('0x61')](_0x49fb63)){throw new db[(_0x6b2f('0x68'))]['ValidationError'](_[_0x6b2f('0x67')](_0x6b2f('0x69'))+_0x6b2f('0x6d'));}return _0x38224a[_0x6b2f('0x6e')](_0x49fb63);}})[_0x6b2f('0x25')](handleError(_0x38224a,null));};exports[_0x6b2f('0x72')]=function(_0x1a3298,_0x59b625,_0x3611ad){if(_0x1a3298[_0x6b2f('0x55')]&&_0x1a3298[_0x6b2f('0x55')][_0x6b2f('0x56')]){_0x1a3298[_0x6b2f('0x53')]['favicon']=_0x1a3298[_0x6b2f('0x55')]['filename'];}return db[_0x6b2f('0x4e')][_0x6b2f('0x51')]({'where':{'id':_0x1a3298[_0x6b2f('0x4c')]['id']}})[_0x6b2f('0x1b')](handleEntityNotFound(_0x59b625,null))['then'](saveUpdates(_0x1a3298[_0x6b2f('0x53')],null))['then'](respondWithResult(_0x59b625,null))[_0x6b2f('0x25')](handleError(_0x59b625,null));};var utilLicense=require('../../config/license/util');exports[_0x6b2f('0x73')]=function(_0x4ce982,_0x331336,_0xa15723){var _0x285b49='server/files/images/logos';var _0x396481={'custom':![]};return utilLicense[_0x6b2f('0x5c')]()[_0x6b2f('0x1b')](function(_0x17b36b){if(_0x17b36b){_0x396481=_0x17b36b;}return db[_0x6b2f('0x4e')][_0x6b2f('0x51')]({'where':{'id':_0x4ce982[_0x6b2f('0x4c')]['id']},'attributes':[_0x6b2f('0x57'),_0x6b2f('0x58'),_0x6b2f('0x69'),_0x6b2f('0x5d'),_0x6b2f('0x6a'),_0x6b2f('0x5e'),_0x6b2f('0x5f'),_0x6b2f('0x60')],'raw':!![]});})[_0x6b2f('0x1b')](handleEntityNotFound(_0x331336,null))[_0x6b2f('0x1b')](function(_0x2bd032){if(_0x2bd032){var _0xb5a56c=_0x2bd032[_0x6b2f('0x5d')]&&fs[_0x6b2f('0x61')](path[_0x6b2f('0x62')](config[_0x6b2f('0x63')],_0x285b49,_[_0x6b2f('0x64')](_0x2bd032[_0x6b2f('0x5d')])))?path[_0x6b2f('0x62')](config['root'],_0x285b49,_[_0x6b2f('0x64')](_0x2bd032['favicon'])):path[_0x6b2f('0x62')](config[_0x6b2f('0x63')],_0x285b49,_[_0x6b2f('0x64')](_0x6b2f('0x74')));var _0xf2281c=_0x6b2f('0x66')+_[_0x6b2f('0x67')](_0x6b2f('0x5d'));if(_0x2bd032[_0xf2281c]||!_0x396481[_0x6b2f('0x6c')]){_0xb5a56c=path[_0x6b2f('0x62')](config['root'],_0x285b49,_['toLower'](_0x6b2f('0x74')));}if(!fs['existsSync'](_0xb5a56c)){throw new db[(_0x6b2f('0x68'))][(_0x6b2f('0x19'))](_[_0x6b2f('0x67')]('favicon')+_0x6b2f('0x6d'));}return _0x331336['download'](_0xb5a56c);}})[_0x6b2f('0x25')](handleError(_0x331336,null));}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 363333d..18ad5f6 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 _0xeb62=['exports','define','Setting','settings','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xeb62,0x149));var _0x2eb6=function(_0x43b512,_0x35f42b){_0x43b512=_0x43b512-0x0;var _0x370cb3=_0xeb62[_0x43b512];return _0x370cb3;};'use strict';var _=require(_0x2eb6('0x0'));var util=require('util');var logger=require(_0x2eb6('0x1'))(_0x2eb6('0x2'));var moment=require(_0x2eb6('0x3'));var BPromise=require(_0x2eb6('0x4'));var rp=require(_0x2eb6('0x5'));var fs=require('fs');var path=require(_0x2eb6('0x6'));var rimraf=require(_0x2eb6('0x7'));var config=require(_0x2eb6('0x8'));var attributes=require('./setting.attributes');module[_0x2eb6('0x9')]=function(_0x3bcb2b,_0x3a23d6){return _0x3bcb2b[_0x2eb6('0xa')](_0x2eb6('0xb'),attributes,{'tableName':_0x2eb6('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa28b=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./setting.attributes','exports','Setting','lodash','util','../../config/logger'];(function(_0xb8e44,_0x2a6a20){var _0x3dbb16=function(_0x15fca8){while(--_0x15fca8){_0xb8e44['push'](_0xb8e44['shift']());}};_0x3dbb16(++_0x2a6a20);}(_0xa28b,0x1aa));var _0xba28=function(_0x5641d,_0x1c2398){_0x5641d=_0x5641d-0x0;var _0x548741=_0xa28b[_0x5641d];return _0x548741;};'use strict';var _=require(_0xba28('0x0'));var util=require(_0xba28('0x1'));var logger=require(_0xba28('0x2'))(_0xba28('0x3'));var moment=require(_0xba28('0x4'));var BPromise=require(_0xba28('0x5'));var rp=require(_0xba28('0x6'));var fs=require('fs');var path=require(_0xba28('0x7'));var rimraf=require(_0xba28('0x8'));var config=require(_0xba28('0x9'));var attributes=require(_0xba28('0xa'));module[_0xba28('0xb')]=function(_0x52548b,_0x4409f8){return _0x52548b['define'](_0xba28('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 9e34db4..44aa0b5 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 _0xa204=['jayson/promise','client','http','request','then','info','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Setting,\x20%s,\x20%s','result','catch','util','moment','randomstring','ioredis','../../config/utils','../../config/environment'];(function(_0x48de9e,_0x144e00){var _0x20e60f=function(_0x2f65a3){while(--_0x2f65a3){_0x48de9e['push'](_0x48de9e['shift']());}};_0x20e60f(++_0x144e00);}(_0xa204,0x19c));var _0x4a20=function(_0xe13339,_0x5d1dc2){_0xe13339=_0xe13339-0x0;var _0x550e7c=_0xa204[_0xe13339];return _0x550e7c;};'use strict';var _=require('lodash');var util=require(_0x4a20('0x0'));var moment=require(_0x4a20('0x1'));var BPromise=require('bluebird');var rs=require(_0x4a20('0x2'));var fs=require('fs');var Redis=require(_0x4a20('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4a20('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x4a20('0x5'));var jayson=require(_0x4a20('0x6'));var client=jayson[_0x4a20('0x7')][_0x4a20('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x121df4,_0x4b4b37,_0x665bee){return new BPromise(function(_0x225bd1,_0x2f13fe){return client[_0x4a20('0x9')](_0x121df4,_0x665bee)[_0x4a20('0xa')](function(_0x46a7f6){logger[_0x4a20('0xb')]('Setting,\x20%s,\x20%s',_0x4b4b37,_0x4a20('0xc'));logger[_0x4a20('0xd')](_0x4a20('0xe'),_0x4b4b37,_0x4a20('0xc'),JSON[_0x4a20('0xf')](_0x46a7f6));if(_0x46a7f6[_0x4a20('0x10')]){if(_0x46a7f6[_0x4a20('0x10')][_0x4a20('0x11')]===0x1f4){logger['error']('Setting,\x20%s,\x20%s',_0x4b4b37,_0x46a7f6['error'][_0x4a20('0x12')]);return _0x2f13fe(_0x46a7f6[_0x4a20('0x10')][_0x4a20('0x12')]);}logger['error'](_0x4a20('0x13'),_0x4b4b37,_0x46a7f6[_0x4a20('0x10')][_0x4a20('0x12')]);return _0x225bd1(_0x46a7f6[_0x4a20('0x10')]['message']);}else{logger[_0x4a20('0xb')](_0x4a20('0x13'),_0x4b4b37,_0x4a20('0xc'));_0x225bd1(_0x46a7f6[_0x4a20('0x14')]['message']);}})[_0x4a20('0x15')](function(_0xc96516){logger[_0x4a20('0x10')]('Setting,\x20%s,\x20%s',_0x4b4b37,_0xc96516);_0x2f13fe(_0xc96516);});});} \ No newline at end of file +var _0x7585=['error','message','result','catch','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x1f627,_0x93f7fc){var _0x423e99=function(_0x28538c){while(--_0x28538c){_0x1f627['push'](_0x1f627['shift']());}};_0x423e99(++_0x93f7fc);}(_0x7585,0x16c));var _0x5758=function(_0x10901e,_0x56fbdb){_0x10901e=_0x10901e-0x0;var _0x185fd2=_0x7585[_0x10901e];return _0x185fd2;};'use strict';var _=require(_0x5758('0x0'));var util=require('util');var moment=require(_0x5758('0x1'));var BPromise=require(_0x5758('0x2'));var rs=require(_0x5758('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x5758('0x4'));var logger=require(_0x5758('0x5'))(_0x5758('0x6'));var config=require(_0x5758('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5758('0x8')][_0x5758('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x34b9ec,_0x30f70b,_0x579c7d){return new BPromise(function(_0x20538d,_0x792315){return client[_0x5758('0xa')](_0x34b9ec,_0x579c7d)[_0x5758('0xb')](function(_0x32e02d){logger[_0x5758('0xc')](_0x5758('0xd'),_0x30f70b,_0x5758('0xe'));logger[_0x5758('0xf')]('Setting,\x20%s,\x20%s,\x20%s',_0x30f70b,_0x5758('0xe'),JSON['stringify'](_0x32e02d));if(_0x32e02d[_0x5758('0x10')]){if(_0x32e02d[_0x5758('0x10')]['code']===0x1f4){logger[_0x5758('0x10')]('Setting,\x20%s,\x20%s',_0x30f70b,_0x32e02d['error']['message']);return _0x792315(_0x32e02d[_0x5758('0x10')][_0x5758('0x11')]);}logger['error'](_0x5758('0xd'),_0x30f70b,_0x32e02d[_0x5758('0x10')][_0x5758('0x11')]);return _0x20538d(_0x32e02d['error']['message']);}else{logger[_0x5758('0xc')]('Setting,\x20%s,\x20%s',_0x30f70b,_0x5758('0xe'));_0x20538d(_0x32e02d[_0x5758('0x12')][_0x5758('0x11')]);}})[_0x5758('0x13')](function(_0x3209cd){logger[_0x5758('0x10')]('Setting,\x20%s,\x20%s',_0x30f70b,_0x3209cd);_0x792315(_0x3209cd);});});} \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 9c1fd62..020ce2e 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 _0xa16c=['getApplications','/:id/interactions','/:id/status','statusGet','/:id/users','getAgents','post','create','/:id/dispositions','addDisposition','notify','addApplications','/:id/send','send','status','addAgents','put','delete','destroy','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./smsAccount.controller','get','isAuthenticated','/describe','describe','/:id','show','getDispositions','/:id/canned_answers','getAnswers','/:id/applications'];(function(_0x3bbaf0,_0x10e62c){var _0x3be9f2=function(_0x1a5852){while(--_0x1a5852){_0x3bbaf0['push'](_0x3bbaf0['shift']());}};_0x3be9f2(++_0x10e62c);}(_0xa16c,0x66));var _0xca16=function(_0x475298,_0xa864e7){_0x475298=_0x475298-0x0;var _0x5ca4ba=_0xa16c[_0x475298];return _0x5ca4ba;};'use strict';var multer=require(_0xca16('0x0'));var util=require(_0xca16('0x1'));var path=require(_0xca16('0x2'));var timeout=require(_0xca16('0x3'));var express=require('express');var router=express[_0xca16('0x4')]();var auth=require(_0xca16('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xca16('0x6'));var controller=require(_0xca16('0x7'));router[_0xca16('0x8')]('/',auth[_0xca16('0x9')](),controller['index']);router['get'](_0xca16('0xa'),auth[_0xca16('0x9')](),controller[_0xca16('0xb')]);router[_0xca16('0x8')](_0xca16('0xc'),auth['isAuthenticated'](),controller[_0xca16('0xd')]);router[_0xca16('0x8')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0xca16('0xe')]);router[_0xca16('0x8')](_0xca16('0xf'),auth['isAuthenticated'](),controller[_0xca16('0x10')]);router[_0xca16('0x8')](_0xca16('0x11'),auth[_0xca16('0x9')](),controller[_0xca16('0x12')]);router[_0xca16('0x8')](_0xca16('0x13'),auth[_0xca16('0x9')](),controller['getInteractions']);router[_0xca16('0x8')](_0xca16('0x14'),controller[_0xca16('0x15')]);router[_0xca16('0x8')](_0xca16('0x16'),auth[_0xca16('0x9')](),controller[_0xca16('0x17')]);router[_0xca16('0x18')]('/',auth[_0xca16('0x9')](),controller[_0xca16('0x19')]);router[_0xca16('0x18')](_0xca16('0x1a'),auth['isAuthenticated'](),controller[_0xca16('0x1b')]);router[_0xca16('0x18')]('/:id/canned_answers',auth[_0xca16('0x9')](),controller['addAnswer']);router[_0xca16('0x18')]('/:id/notify',controller[_0xca16('0x1c')]);router[_0xca16('0x18')](_0xca16('0x11'),auth['isAuthenticated'](),controller[_0xca16('0x1d')]);router['post'](_0xca16('0x1e'),auth[_0xca16('0x9')](),controller[_0xca16('0x1f')]);router[_0xca16('0x18')](_0xca16('0x14'),controller[_0xca16('0x20')]);router[_0xca16('0x18')]('/:id/users',auth['isAuthenticated'](),controller[_0xca16('0x21')]);router[_0xca16('0x22')](_0xca16('0xc'),auth[_0xca16('0x9')](),controller['update']);router[_0xca16('0x23')]('/:id',auth['isAuthenticated'](),controller[_0xca16('0x24')]);router[_0xca16('0x23')]('/:id/dispositions',auth[_0xca16('0x9')](),controller['removeDispositions']);router[_0xca16('0x23')](_0xca16('0xf'),auth['isAuthenticated'](),controller[_0xca16('0x25')]);router['delete'](_0xca16('0x16'),auth['isAuthenticated'](),controller[_0xca16('0x26')]);module[_0xca16('0x27')]=router; \ No newline at end of file +var _0x5652=['describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/interactions','getInteractions','/:id/status','statusGet','/:id/users','getAgents','create','post','addAnswer','/:id/notify','notify','/:id/applications','addApplications','status','addAgents','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe'];(function(_0x30621d,_0x1a0688){var _0x350429=function(_0x379823){while(--_0x379823){_0x30621d['push'](_0x30621d['shift']());}};_0x350429(++_0x1a0688);}(_0x5652,0xea));var _0x2565=function(_0x5a6644,_0x45d612){_0x5a6644=_0x5a6644-0x0;var _0x3a2a5d=_0x5652[_0x5a6644];return _0x3a2a5d;};'use strict';var multer=require(_0x2565('0x0'));var util=require(_0x2565('0x1'));var path=require(_0x2565('0x2'));var timeout=require(_0x2565('0x3'));var express=require(_0x2565('0x4'));var router=express['Router']();var auth=require(_0x2565('0x5'));var interaction=require(_0x2565('0x6'));var config=require(_0x2565('0x7'));var controller=require('./smsAccount.controller');router[_0x2565('0x8')]('/',auth[_0x2565('0x9')](),controller[_0x2565('0xa')]);router[_0x2565('0x8')](_0x2565('0xb'),auth[_0x2565('0x9')](),controller[_0x2565('0xc')]);router[_0x2565('0x8')](_0x2565('0xd'),auth[_0x2565('0x9')](),controller[_0x2565('0xe')]);router['get'](_0x2565('0xf'),auth[_0x2565('0x9')](),controller[_0x2565('0x10')]);router[_0x2565('0x8')](_0x2565('0x11'),auth[_0x2565('0x9')](),controller['getAnswers']);router[_0x2565('0x8')]('/:id/applications',auth[_0x2565('0x9')](),controller['getApplications']);router[_0x2565('0x8')](_0x2565('0x12'),auth[_0x2565('0x9')](),controller[_0x2565('0x13')]);router['get'](_0x2565('0x14'),controller[_0x2565('0x15')]);router[_0x2565('0x8')](_0x2565('0x16'),auth[_0x2565('0x9')](),controller[_0x2565('0x17')]);router['post']('/',auth[_0x2565('0x9')](),controller[_0x2565('0x18')]);router['post']('/:id/dispositions',auth[_0x2565('0x9')](),controller['addDisposition']);router[_0x2565('0x19')](_0x2565('0x11'),auth[_0x2565('0x9')](),controller[_0x2565('0x1a')]);router[_0x2565('0x19')](_0x2565('0x1b'),controller[_0x2565('0x1c')]);router[_0x2565('0x19')](_0x2565('0x1d'),auth[_0x2565('0x9')](),controller[_0x2565('0x1e')]);router[_0x2565('0x19')]('/:id/send',auth['isAuthenticated'](),controller['send']);router[_0x2565('0x19')](_0x2565('0x14'),controller[_0x2565('0x1f')]);router[_0x2565('0x19')](_0x2565('0x16'),auth[_0x2565('0x9')](),controller[_0x2565('0x20')]);router[_0x2565('0x21')](_0x2565('0xd'),auth[_0x2565('0x9')](),controller[_0x2565('0x22')]);router[_0x2565('0x23')](_0x2565('0xd'),auth['isAuthenticated'](),controller[_0x2565('0x24')]);router[_0x2565('0x23')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x2565('0x25')]);router['delete']('/:id/canned_answers',auth[_0x2565('0x9')](),controller[_0x2565('0x26')]);router[_0x2565('0x23')]('/:id/users',auth[_0x2565('0x9')](),controller[_0x2565('0x27')]);module[_0x2565('0x28')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index a2e3297..ea3fe47 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 _0xe596=['csc','intelepeer','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','sequelize','randomstring','exports','STRING','name','generate','ENUM','twilio','connectel','clicksend','plivo'];(function(_0x330d68,_0x8b3926){var _0x435ba=function(_0x57996f){while(--_0x57996f){_0x330d68['push'](_0x330d68['shift']());}};_0x435ba(++_0x8b3926);}(_0xe596,0x155));var _0x6e59=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0xe596[_0x599f41];return _0x2e4d58;};'use strict';var Sequelize=require(_0x6e59('0x0'));var rs=require(_0x6e59('0x1'));module[_0x6e59('0x2')]={'name':{'type':Sequelize[_0x6e59('0x3')],'unique':_0x6e59('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0x6e59('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x6e59('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x6e59('0x3')],'defaultValue':function(){return rs[_0x6e59('0x5')]();}},'phone':{'type':Sequelize[_0x6e59('0x3')]},'type':{'type':Sequelize[_0x6e59('0x6')](_0x6e59('0x7'),'skebby',_0x6e59('0x8'),_0x6e59('0x9'),_0x6e59('0xa'),'clickatell',_0x6e59('0xb'),'infobip',_0x6e59('0xc'))},'accountSid':{'type':Sequelize[_0x6e59('0x3')]},'authId':{'type':Sequelize[_0x6e59('0x3')]},'authToken':{'type':Sequelize[_0x6e59('0x3')]},'smsMethod':{'type':Sequelize[_0x6e59('0x6')]('SI','TI','GP')},'username':{'type':Sequelize[_0x6e59('0x3')]},'password':{'type':Sequelize[_0x6e59('0x3')]},'apiKey':{'type':Sequelize[_0x6e59('0x3')]},'senderString':{'type':Sequelize[_0x6e59('0x3')]},'deliveryReport':{'type':Sequelize[_0x6e59('0xd')],'defaultValue':![]},'description':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x6e59('0xe')],'defaultValue':function(){return _0x6e59('0xf');}},'notificationSound':{'type':Sequelize[_0x6e59('0xd')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x6e59('0xd')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x6e59('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x6e59('0xd')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x6e59('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x6e59('0xd')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x6e59('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x6e59('0x10')],'comment':_0x6e59('0x11')},'mandatoryDisposition':{'type':Sequelize[_0x6e59('0xd')],'defaultValue':![],'comment':_0x6e59('0x12'),'set':function(_0x2e7a7e){if(!_0x2e7a7e)this['setDataValue'](_0x6e59('0x13'),null);this[_0x6e59('0x14')](_0x6e59('0x15'),_0x2e7a7e);}}}; \ No newline at end of file +var _0x2fa9=['twilio','connectel','plivo','clickatell','intelepeer','ENUM','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','randomstring','name','STRING','generate'];(function(_0x51ed82,_0x1d70bc){var _0x2a540f=function(_0x3cdb76){while(--_0x3cdb76){_0x51ed82['push'](_0x51ed82['shift']());}};_0x2a540f(++_0x1d70bc);}(_0x2fa9,0x1e9));var _0x92fa=function(_0x32281c,_0x557019){_0x32281c=_0x32281c-0x0;var _0xdedf=_0x2fa9[_0x32281c];return _0xdedf;};'use strict';var Sequelize=require(_0x92fa('0x0'));var rs=require(_0x92fa('0x1'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x92fa('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0x92fa('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x92fa('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x92fa('0x3')],'defaultValue':function(){return rs[_0x92fa('0x4')]();}},'phone':{'type':Sequelize[_0x92fa('0x3')]},'type':{'type':Sequelize['ENUM'](_0x92fa('0x5'),'skebby',_0x92fa('0x6'),'clicksend',_0x92fa('0x7'),_0x92fa('0x8'),'csc','infobip',_0x92fa('0x9'))},'accountSid':{'type':Sequelize[_0x92fa('0x3')]},'authId':{'type':Sequelize[_0x92fa('0x3')]},'authToken':{'type':Sequelize[_0x92fa('0x3')]},'smsMethod':{'type':Sequelize[_0x92fa('0xa')]('SI','TI','GP')},'username':{'type':Sequelize[_0x92fa('0x3')]},'password':{'type':Sequelize[_0x92fa('0x3')]},'apiKey':{'type':Sequelize[_0x92fa('0x3')]},'senderString':{'type':Sequelize['STRING']},'deliveryReport':{'type':Sequelize[_0x92fa('0xb')],'defaultValue':![]},'description':{'type':Sequelize[_0x92fa('0x3')]},'notificationTemplate':{'type':Sequelize[_0x92fa('0xc')],'defaultValue':function(){return _0x92fa('0xd');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x92fa('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x92fa('0xb')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x92fa('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x92fa('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x92fa('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x92fa('0xe')],'comment':_0x92fa('0xf')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x92fa('0x10'),'set':function(_0x12e79b){if(!_0x12e79b)this[_0x92fa('0x11')]('mandatoryDispositionPauseId',null);this[_0x92fa('0x11')](_0x92fa('0x12'),_0x12e79b);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 1585c1a..749d319 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 _0x9957=['show','params','fields','length','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','SmsAccountId','Disposition','getDispositions','findOne','nolimit','sort','pick','rows','removeDispositions','CannedAnswer','getAnswers','removeAnswers','ids','notify','sms','account','applications','orderBy','Applications','asc','CmContact','Sequelize','no\x20available\x20attributes','difference','createdAt','CompanyId','ListId','mobile','twilio','from','Body','messageId','MessageSid','skebby','sender','text','connectel','clicksend','message_id','plivo','MessageUUID','infobip','results','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','refid','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','updatedAt','list','omit','contact','SmsInteraction','spread','interaction','autoclose','push','close','unmanaged','*,*,*,*','created','SmsMessage','ContactId','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','debug','entity\x20found','stringify','Content-Type','text/xml','addApplications','sequelize','transaction','SmsApplication','bulkCreate','findAndCountAll','priority','getApplications','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','tag','to\x20is\x20mandatory','List','DESC','dataValues','Messages','log','endpoint\x20/status\x20POST\x20/','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','statusInt','requestid','status_code','groupName','intelepeer','DELIVERED','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','DELIVRD','ACCEPTD','message-id','state','addAgents','emit','removeAgents','userSmsAccount:remove','getAgents','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','../../mysqldb','redis','defaults','localhost','socket.io-emitter','jayson/promise','client','http','test','ValidationError','then','SmsAccount,\x20%s,\x20%s','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','count','offset','set','apply','save','destroy','SmsAccounts','stack','name','send','index','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','hasOwnProperty','limit','order','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll'];(function(_0x40b66c,_0x5c1d58){var _0x159671=function(_0x17a129){while(--_0x17a129){_0x40b66c['push'](_0x40b66c['shift']());}};_0x159671(++_0x5c1d58);}(_0x9957,0x93));var _0x7995=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9957[_0x618414];return _0x21c19a;};'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 db=require(_0x7995('0x19'))['db'];config[_0x7995('0x1a')]=_[_0x7995('0x1b')](config[_0x7995('0x1a')],{'host':_0x7995('0x1c'),'port':0x18eb});var socket=require(_0x7995('0x1d'))(new Redis(config[_0x7995('0x1a')]));require('./smsAccount.socket')['register'](socket);var jayson=require(_0x7995('0x1e'));var client=jayson[_0x7995('0x1f')][_0x7995('0x20')]({'port':0x232c});function checkPasswordPattern(_0x321ae8,_0x3f1d3e,_0x1a5310){if(_0x1a5310){var _0x2202ce=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2202ce[_0x7995('0x21')](_0x3f1d3e)){return _0x321ae8;}else{throw new db['Sequelize'][(_0x7995('0x22'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x321ae8;}}function respondWithRpcPromise(_0x2f832e,_0x37f297,_0x43d4b8,_0x291317){return new BPromise(function(_0x1e1415,_0x37a7d4){var _0x4faa60=_0x291317||client;return _0x4faa60['request'](_0x2f832e,_0x43d4b8)[_0x7995('0x23')](function(_0x5e6f90){logger['info'](_0x7995('0x24'),_0x37f297,_0x7995('0x25'));logger['debug'](_0x7995('0x26'),_0x37f297,'request\x20sent',JSON['stringify'](_0x5e6f90));if(_0x5e6f90[_0x7995('0x27')]){if(_0x5e6f90[_0x7995('0x27')][_0x7995('0x28')]===0x1f4){logger[_0x7995('0x27')](_0x7995('0x24'),_0x37f297,_0x5e6f90[_0x7995('0x27')]['message']);return _0x37a7d4(_0x5e6f90[_0x7995('0x27')][_0x7995('0x29')]);}logger[_0x7995('0x27')](_0x7995('0x24'),_0x37f297,_0x5e6f90[_0x7995('0x27')][_0x7995('0x29')]);return _0x1e1415(_0x5e6f90[_0x7995('0x27')][_0x7995('0x29')]);}else{logger['info'](_0x7995('0x24'),_0x37f297,_0x7995('0x25'));_0x1e1415(_0x5e6f90[_0x7995('0x2a')][_0x7995('0x29')]);}})[_0x7995('0x2b')](function(_0x2a307e){logger['error'](_0x7995('0x24'),_0x37f297,_0x2a307e);_0x37a7d4(_0x2a307e);});});}function respondWithStatusCode(_0x5911c3,_0x229742){_0x229742=_0x229742||0xcc;return function(_0x49bc7e){if(_0x49bc7e){return _0x5911c3[_0x7995('0x2c')](_0x229742);}return _0x5911c3[_0x7995('0x2d')](_0x229742)[_0x7995('0x2e')]();};}function respondWithResult(_0x4b6f99,_0x9b2a15){_0x9b2a15=_0x9b2a15||0xc8;return function(_0x514445){if(_0x514445){return _0x4b6f99[_0x7995('0x2d')](_0x9b2a15)[_0x7995('0x2f')](_0x514445);}};}function respondWithFilteredResult(_0x4253e5,_0x574574){return function(_0x530611){if(_0x530611){var _0x48e573=_0x530611[_0x7995('0x30')],_0x3573be=_0x574574[_0x7995('0x31')],_0xe6b0b3=_0x574574[_0x7995('0x31')]+_0x574574['limit'],_0x327a81;if(_0xe6b0b3>=_0x48e573){_0xe6b0b3=_0x48e573;_0x327a81=0xc8;}else{_0x327a81=0xce;}_0x4253e5['status'](_0x327a81);return _0x4253e5[_0x7995('0x32')]('Content-Range',_0x3573be+'-'+_0xe6b0b3+'/'+_0x48e573)[_0x7995('0x2f')](_0x530611);}return null;};}function patchUpdates(_0x3eb566){return function(_0x29fac5){try{jsonpatch[_0x7995('0x33')](_0x29fac5,_0x3eb566,!![]);}catch(_0x1f7d27){return BPromise['reject'](_0x1f7d27);}return _0x29fac5[_0x7995('0x34')]();};}function saveUpdates(_0x33e24e,_0x5dd802){return function(_0x48db25){if(_0x48db25){return _0x48db25['update'](_0x33e24e)[_0x7995('0x23')](function(_0x3acfc3){return _0x3acfc3;});}return null;};}function removeEntity(_0x4a176f,_0x3e7020){return function(_0x51b95d){if(_0x51b95d){return _0x51b95d[_0x7995('0x35')]()[_0x7995('0x23')](function(){var _0x177cb4=_0x51b95d['get']({'plain':!![]});var _0x52d76d=_0x7995('0x36');return db['UserProfileResource']['destroy']({'where':{'type':_0x52d76d,'resourceId':_0x177cb4['id']}})[_0x7995('0x23')](function(){return _0x51b95d;});})[_0x7995('0x23')](function(){_0x4a176f['status'](0xcc)[_0x7995('0x2e')]();});}};}function handleEntityNotFound(_0x1922b4,_0x2b772f){return function(_0x18667c){if(!_0x18667c){_0x1922b4[_0x7995('0x2c')](0x194);}return _0x18667c;};}function handleError(_0x53002a,_0x2d4285){_0x2d4285=_0x2d4285||0x1f4;return function(_0x242713){logger[_0x7995('0x27')](_0x242713[_0x7995('0x37')]);if(_0x242713['name']){delete _0x242713[_0x7995('0x38')];}_0x53002a[_0x7995('0x2d')](_0x2d4285)[_0x7995('0x39')](_0x242713);};}exports[_0x7995('0x3a')]=function(_0x1f5bee,_0x1035dc){var _0x5688a1={'include':[{'model':db[_0x7995('0x3b')],'as':_0x7995('0x3c')}]},_0x183a68={},_0x3be298={'count':0x0,'rows':[]};var _0x2e04cd=_[_0x7995('0x3d')](db[_0x7995('0x3e')][_0x7995('0x3f')],function(_0x1234e1){return{'name':_0x1234e1[_0x7995('0x40')],'type':_0x1234e1[_0x7995('0x41')][_0x7995('0x42')]};});_0x183a68[_0x7995('0x43')]=_['map'](_0x2e04cd,'name');_0x183a68[_0x7995('0x44')]=_[_0x7995('0x45')](_0x1f5bee['query']);_0x183a68['filters']=_[_0x7995('0x46')](_0x183a68['model'],_0x183a68['query']);_0x5688a1[_0x7995('0x47')]=_[_0x7995('0x46')](_0x183a68[_0x7995('0x43')],qs['fields'](_0x1f5bee[_0x7995('0x44')]['fields']));_0x5688a1[_0x7995('0x47')]=_0x5688a1['attributes']['length']?_0x5688a1[_0x7995('0x47')]:_0x183a68[_0x7995('0x43')];if(!_0x1f5bee[_0x7995('0x44')][_0x7995('0x48')]('nolimit')){_0x5688a1[_0x7995('0x49')]=qs[_0x7995('0x49')](_0x1f5bee[_0x7995('0x44')][_0x7995('0x49')]);_0x5688a1['offset']=qs['offset'](_0x1f5bee[_0x7995('0x44')]['offset']);}_0x5688a1[_0x7995('0x4a')]=qs['sort'](_0x1f5bee[_0x7995('0x44')]['sort']);_0x5688a1[_0x7995('0x4b')]=qs[_0x7995('0x4c')](_['pick'](_0x1f5bee[_0x7995('0x44')],_0x183a68[_0x7995('0x4c')]),_0x2e04cd);if(_0x1f5bee[_0x7995('0x44')][_0x7995('0x4d')]){_0x5688a1['where']=_[_0x7995('0x4e')](_0x5688a1[_0x7995('0x4b')],{'$or':_[_0x7995('0x3d')](_0x2e04cd,function(_0x491184){if(_0x491184[_0x7995('0x41')]!==_0x7995('0x4f')){var _0x511567={};_0x511567[_0x491184[_0x7995('0x38')]]={'$like':'%'+_0x1f5bee[_0x7995('0x44')]['filter']+'%'};return _0x511567;}})});}_0x5688a1=_[_0x7995('0x4e')]({},_0x5688a1,_0x1f5bee[_0x7995('0x50')]);var _0x5921b9={'where':_0x5688a1[_0x7995('0x4b')]};return db['SmsAccount'][_0x7995('0x30')](_0x5921b9)[_0x7995('0x23')](function(_0x1afab4){_0x3be298[_0x7995('0x30')]=_0x1afab4;if(_0x1f5bee[_0x7995('0x44')][_0x7995('0x51')]){_0x5688a1[_0x7995('0x52')]=[{'all':!![]}];}return db['SmsAccount'][_0x7995('0x53')](_0x5688a1);})[_0x7995('0x23')](function(_0x418eb9){_0x3be298['rows']=_0x418eb9;return _0x3be298;})[_0x7995('0x23')](respondWithFilteredResult(_0x1035dc,_0x5688a1))[_0x7995('0x2b')](handleError(_0x1035dc,null));};exports[_0x7995('0x54')]=function(_0x47d1d8,_0x4ec548){var _0x5a592e={'raw':![],'where':{'id':_0x47d1d8[_0x7995('0x55')]['id']},'include':[{'model':db['Pause'],'as':_0x7995('0x3c')}]},_0xb70620={};_0xb70620[_0x7995('0x43')]=_[_0x7995('0x45')](db[_0x7995('0x3e')][_0x7995('0x3f')]);_0xb70620['query']=_[_0x7995('0x45')](_0x47d1d8['query']);_0xb70620[_0x7995('0x4c')]=_[_0x7995('0x46')](_0xb70620[_0x7995('0x43')],_0xb70620['query']);_0x5a592e['attributes']=_['intersection'](_0xb70620['model'],qs[_0x7995('0x56')](_0x47d1d8[_0x7995('0x44')][_0x7995('0x56')]));_0x5a592e[_0x7995('0x47')]=_0x5a592e[_0x7995('0x47')][_0x7995('0x57')]?_0x5a592e[_0x7995('0x47')]:_0xb70620[_0x7995('0x43')];if(_0x47d1d8[_0x7995('0x44')][_0x7995('0x51')]){_0x5a592e[_0x7995('0x52')]=[{'all':!![]}];}_0x5a592e=_[_0x7995('0x4e')]({},_0x5a592e,_0x47d1d8[_0x7995('0x50')]);return db[_0x7995('0x3e')][_0x7995('0x58')](_0x5a592e)[_0x7995('0x23')](handleEntityNotFound(_0x4ec548,null))[_0x7995('0x23')](respondWithResult(_0x4ec548,null))[_0x7995('0x2b')](handleError(_0x4ec548,null));};exports[_0x7995('0x59')]=function(_0x50b7c2,_0x56a374){return db[_0x7995('0x3e')][_0x7995('0x59')](_0x50b7c2[_0x7995('0x5a')],{})['then'](function(_0x53125a){var _0x402fa0=_0x50b7c2[_0x7995('0x5b')][_0x7995('0x5c')]({'plain':!![]});if(!_0x402fa0)throw new Error(_0x7995('0x5d'));if(_0x402fa0['role']===_0x7995('0x5b')){var _0x74ff38=_0x53125a[_0x7995('0x5c')]({'plain':!![]});var _0x33c49c='SmsAccounts';return db['UserProfileSection'][_0x7995('0x58')]({'where':{'name':_0x33c49c,'userProfileId':_0x402fa0[_0x7995('0x5e')]},'raw':!![]})[_0x7995('0x23')](function(_0x1d69ce){if(_0x1d69ce&&_0x1d69ce[_0x7995('0x5f')]===0x0){return db[_0x7995('0x60')][_0x7995('0x59')]({'name':_0x74ff38[_0x7995('0x38')],'resourceId':_0x74ff38['id'],'type':_0x1d69ce[_0x7995('0x38')],'sectionId':_0x1d69ce['id']},{})['then'](function(){return _0x53125a;});}else{return _0x53125a;}})[_0x7995('0x2b')](function(_0x3ec5a8){logger[_0x7995('0x27')](_0x7995('0x61'),_0x3ec5a8);throw _0x3ec5a8;});}return _0x53125a;})['then'](respondWithResult(_0x56a374,0xc9))['catch'](handleError(_0x56a374,null));};exports[_0x7995('0x62')]=function(_0xebb5c8,_0x47d5d7){if(_0xebb5c8[_0x7995('0x5a')]['id']){delete _0xebb5c8[_0x7995('0x5a')]['id'];}return db[_0x7995('0x3e')][_0x7995('0x58')]({'where':{'id':_0xebb5c8[_0x7995('0x55')]['id']},'include':[{'model':db['Pause'],'as':_0x7995('0x3c')}]})['then'](handleEntityNotFound(_0x47d5d7,null))[_0x7995('0x23')](saveUpdates(_0xebb5c8[_0x7995('0x5a')],null))[_0x7995('0x23')](respondWithResult(_0x47d5d7,null))[_0x7995('0x2b')](handleError(_0x47d5d7,null));};exports[_0x7995('0x35')]=function(_0xeb8920,_0x2b3c1d){return db[_0x7995('0x3e')][_0x7995('0x58')]({'where':{'id':_0xeb8920[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x2b3c1d,null))[_0x7995('0x23')](removeEntity(_0x2b3c1d,null))['catch'](handleError(_0x2b3c1d,null));};exports[_0x7995('0x63')]=function(_0x23bbc1,_0x293480){return db[_0x7995('0x3e')][_0x7995('0x63')]()['then'](respondWithResult(_0x293480,null))['catch'](handleError(_0x293480,null));};exports[_0x7995('0x64')]=function(_0x87e38d,_0x221542,_0xae6166){if(_0x87e38d['body']['id']){delete _0x87e38d[_0x7995('0x5a')]['id'];}return db['SmsAccount']['find']({'where':{'id':_0x87e38d[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x221542,null))[_0x7995('0x23')](function(_0x44bf2b){if(_0x44bf2b){_0x87e38d[_0x7995('0x5a')][_0x7995('0x65')]=_0x44bf2b['id'];return db[_0x7995('0x66')][_0x7995('0x59')](_0x87e38d[_0x7995('0x5a')]);}})[_0x7995('0x23')](respondWithResult(_0x221542,null))['catch'](handleError(_0x221542,null));};exports[_0x7995('0x67')]=function(_0x8908cd,_0x3c5802,_0x4cc247){var _0x1fe1cb={'raw':![],'where':{}};var _0x1d2f9d={};var _0x705f0={'count':0x0,'rows':[]};return db[_0x7995('0x3e')][_0x7995('0x68')]({'where':{'id':_0x8908cd[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x3c5802,null))[_0x7995('0x23')](function(_0x2f94c4){if(_0x2f94c4){_0x1d2f9d[_0x7995('0x43')]=_[_0x7995('0x45')](db['Disposition']['rawAttributes']);_0x1d2f9d[_0x7995('0x44')]=_[_0x7995('0x45')](_0x8908cd[_0x7995('0x44')]);_0x1d2f9d[_0x7995('0x4c')]=_['intersection'](_0x1d2f9d[_0x7995('0x43')],_0x1d2f9d[_0x7995('0x44')]);_0x1fe1cb['attributes']=_['intersection'](_0x1d2f9d[_0x7995('0x43')],qs[_0x7995('0x56')](_0x8908cd['query'][_0x7995('0x56')]));_0x1fe1cb['attributes']=_0x1fe1cb[_0x7995('0x47')][_0x7995('0x57')]?_0x1fe1cb['attributes']:_0x1d2f9d['model'];if(!_0x8908cd[_0x7995('0x44')]['hasOwnProperty'](_0x7995('0x69'))){_0x1fe1cb[_0x7995('0x49')]=qs[_0x7995('0x49')](_0x8908cd[_0x7995('0x44')][_0x7995('0x49')]);_0x1fe1cb[_0x7995('0x31')]=qs[_0x7995('0x31')](_0x8908cd[_0x7995('0x44')][_0x7995('0x31')]);}_0x1fe1cb[_0x7995('0x4a')]=qs[_0x7995('0x6a')](_0x8908cd[_0x7995('0x44')][_0x7995('0x6a')]);_0x1fe1cb[_0x7995('0x4b')]=qs[_0x7995('0x4c')](_[_0x7995('0x6b')](_0x8908cd[_0x7995('0x44')],_0x1d2f9d[_0x7995('0x4c')]));_0x1fe1cb[_0x7995('0x4b')][_0x7995('0x65')]=_0x2f94c4['id'];if(_0x8908cd[_0x7995('0x44')][_0x7995('0x4d')]){_0x1fe1cb[_0x7995('0x4b')]=_[_0x7995('0x4e')](_0x1fe1cb[_0x7995('0x4b')],{'$or':_[_0x7995('0x3d')](_0x1fe1cb[_0x7995('0x47')],function(_0x34724d){var _0x59efff={};_0x59efff[_0x34724d]={'$like':'%'+_0x8908cd[_0x7995('0x44')][_0x7995('0x4d')]+'%'};return _0x59efff;})});}_0x1fe1cb=_['merge']({},_0x1fe1cb,_0x8908cd['options']);return db[_0x7995('0x66')][_0x7995('0x30')]({'where':_0x1fe1cb[_0x7995('0x4b')]})[_0x7995('0x23')](function(_0xe1ce4){_0x705f0[_0x7995('0x30')]=_0xe1ce4;if(_0x8908cd['query'][_0x7995('0x51')]){_0x1fe1cb[_0x7995('0x52')]=[{'all':!![]}];}return db[_0x7995('0x66')][_0x7995('0x53')](_0x1fe1cb);})[_0x7995('0x23')](function(_0x3f0bff){_0x705f0[_0x7995('0x6c')]=_0x3f0bff;return _0x705f0;});}})[_0x7995('0x23')](respondWithFilteredResult(_0x3c5802,_0x1fe1cb))['catch'](handleError(_0x3c5802,null));};exports[_0x7995('0x6d')]=function(_0x2b8217,_0x5c04c9,_0x479271){return db[_0x7995('0x3e')][_0x7995('0x58')]({'where':{'id':_0x2b8217[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x5c04c9,null))[_0x7995('0x23')](function(_0x4a02ea){if(_0x4a02ea){return _0x4a02ea[_0x7995('0x6d')](_0x2b8217[_0x7995('0x44')]['ids']);}})[_0x7995('0x23')](respondWithStatusCode(_0x5c04c9,null))[_0x7995('0x2b')](handleError(_0x5c04c9,null));};exports['addAnswer']=function(_0x1535a3,_0x4a5bc5,_0x135191){if(_0x1535a3[_0x7995('0x5a')]['id']){delete _0x1535a3[_0x7995('0x5a')]['id'];}return db[_0x7995('0x3e')][_0x7995('0x58')]({'where':{'id':_0x1535a3['params']['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x4a5bc5,null))[_0x7995('0x23')](function(_0x38b37f){if(_0x38b37f){_0x1535a3['body'][_0x7995('0x65')]=_0x38b37f['id'];return db[_0x7995('0x6e')][_0x7995('0x59')](_0x1535a3[_0x7995('0x5a')]);}})['then'](respondWithResult(_0x4a5bc5,null))[_0x7995('0x2b')](handleError(_0x4a5bc5,null));};exports[_0x7995('0x6f')]=function(_0x3a5f5e,_0x4aafa3,_0x5358d4){var _0x3fc10={'raw':![],'where':{}};var _0x333379={};var _0x4800a8={'count':0x0,'rows':[]};return db['SmsAccount'][_0x7995('0x68')]({'where':{'id':_0x3a5f5e[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x4aafa3,null))[_0x7995('0x23')](function(_0x2ba606){if(_0x2ba606){_0x333379['model']=_['keys'](db[_0x7995('0x6e')]['rawAttributes']);_0x333379['query']=_[_0x7995('0x45')](_0x3a5f5e[_0x7995('0x44')]);_0x333379[_0x7995('0x4c')]=_['intersection'](_0x333379[_0x7995('0x43')],_0x333379[_0x7995('0x44')]);_0x3fc10[_0x7995('0x47')]=_[_0x7995('0x46')](_0x333379[_0x7995('0x43')],qs['fields'](_0x3a5f5e[_0x7995('0x44')][_0x7995('0x56')]));_0x3fc10[_0x7995('0x47')]=_0x3fc10[_0x7995('0x47')]['length']?_0x3fc10[_0x7995('0x47')]:_0x333379[_0x7995('0x43')];if(!_0x3a5f5e['query'][_0x7995('0x48')](_0x7995('0x69'))){_0x3fc10['limit']=qs[_0x7995('0x49')](_0x3a5f5e['query'][_0x7995('0x49')]);_0x3fc10['offset']=qs[_0x7995('0x31')](_0x3a5f5e['query'][_0x7995('0x31')]);}_0x3fc10[_0x7995('0x4a')]=qs['sort'](_0x3a5f5e[_0x7995('0x44')]['sort']);_0x3fc10['where']=qs[_0x7995('0x4c')](_[_0x7995('0x6b')](_0x3a5f5e[_0x7995('0x44')],_0x333379[_0x7995('0x4c')]));_0x3fc10['where'][_0x7995('0x65')]=_0x2ba606['id'];if(_0x3a5f5e[_0x7995('0x44')]['filter']){_0x3fc10['where']=_[_0x7995('0x4e')](_0x3fc10['where'],{'$or':_[_0x7995('0x3d')](_0x3fc10[_0x7995('0x47')],function(_0xfb4479){var _0x5b42be={};_0x5b42be[_0xfb4479]={'$like':'%'+_0x3a5f5e['query'][_0x7995('0x4d')]+'%'};return _0x5b42be;})});}_0x3fc10=_['merge']({},_0x3fc10,_0x3a5f5e[_0x7995('0x50')]);return db[_0x7995('0x6e')][_0x7995('0x30')]({'where':_0x3fc10[_0x7995('0x4b')]})['then'](function(_0x52d102){_0x4800a8['count']=_0x52d102;if(_0x3a5f5e[_0x7995('0x44')][_0x7995('0x51')]){_0x3fc10[_0x7995('0x52')]=[{'all':!![]}];}return db[_0x7995('0x6e')][_0x7995('0x53')](_0x3fc10);})[_0x7995('0x23')](function(_0x59a793){_0x4800a8['rows']=_0x59a793;return _0x4800a8;});}})[_0x7995('0x23')](respondWithFilteredResult(_0x4aafa3,_0x3fc10))['catch'](handleError(_0x4aafa3,null));};exports['removeAnswers']=function(_0x17d00f,_0x5e95c0,_0x57a164){return db[_0x7995('0x3e')][_0x7995('0x58')]({'where':{'id':_0x17d00f[_0x7995('0x55')]['id']}})['then'](handleEntityNotFound(_0x5e95c0,null))[_0x7995('0x23')](function(_0xf604d9){if(_0xf604d9){return _0xf604d9[_0x7995('0x70')](_0x17d00f[_0x7995('0x44')][_0x7995('0x71')]);}})[_0x7995('0x23')](respondWithStatusCode(_0x5e95c0,null))[_0x7995('0x2b')](handleError(_0x5e95c0,null));};exports[_0x7995('0x72')]=function(_0x19d746,_0x570b71,_0x3eb3fa){var _0x87a539={'channel':_0x7995('0x73')};var _0x2056da=[];var _0x2a01d4=[];var _0x5a4695={};return db[_0x7995('0x3e')][_0x7995('0x58')]({'where':{'id':_0x19d746[_0x7995('0x55')]['id']},'include':[{'model':db['SmsApplication'],'as':'Applications'}]})['then'](handleEntityNotFound(_0x570b71,null))[_0x7995('0x23')](function(_0x17f7d6){_0x87a539[_0x7995('0x74')]=_0x17f7d6;_0x87a539[_0x7995('0x75')]=_[_0x7995('0x76')](_0x17f7d6[_0x7995('0x77')],['priority'],[_0x7995('0x78')]);if(_0x87a539['account'][_0x7995('0x77')]){delete _0x87a539[_0x7995('0x74')][_0x7995('0x77')];}return db[_0x7995('0x79')][_0x7995('0x63')]();})[_0x7995('0x23')](function(_0x4f929b){if(!_0x4f929b){throw new db[(_0x7995('0x7a'))][(_0x7995('0x22'))](_0x7995('0x7b'));}_0x2056da=_[_0x7995('0x7c')](_['keys'](_0x4f929b),[_0x7995('0x7d'),'updatedAt']);_0x2a01d4=_[_0x7995('0x7c')](_[_0x7995('0x45')](_0x4f929b),['createdAt','updatedAt',_0x7995('0x7e'),_0x7995('0x7f')]);_0x87a539[_0x7995('0x5a')]={'mapKey':_0x7995('0x80')};if(_0x87a539[_0x7995('0x74')][_0x7995('0x41')]){switch(_0x87a539[_0x7995('0x74')][_0x7995('0x41')]){case _0x7995('0x81'):_0x87a539[_0x7995('0x5a')][_0x7995('0x82')]=_0x19d746[_0x7995('0x5a')]['From'];_0x87a539['body'][_0x7995('0x5a')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x83')];_0x87a539[_0x7995('0x5a')][_0x7995('0x84')]=_0x19d746['body'][_0x7995('0x85')];break;case _0x7995('0x86'):_0x87a539['body'][_0x7995('0x82')]='+'+_0x19d746['body'][_0x7995('0x87')];_0x87a539[_0x7995('0x5a')][_0x7995('0x5a')]=_0x19d746['body'][_0x7995('0x88')];break;case _0x7995('0x89'):_0x87a539[_0x7995('0x5a')][_0x7995('0x82')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x82')];_0x87a539[_0x7995('0x5a')]['body']=_0x19d746['body']['message'];break;case _0x7995('0x8a'):_0x87a539[_0x7995('0x5a')]['from']=_0x19d746['body'][_0x7995('0x82')];_0x87a539[_0x7995('0x5a')]['body']=_0x19d746['body']['body'];_0x87a539['body'][_0x7995('0x84')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x8b')];break;case _0x7995('0x8c'):_0x87a539['body'][_0x7995('0x82')]=_0x19d746[_0x7995('0x5a')]['From'];_0x87a539[_0x7995('0x5a')][_0x7995('0x5a')]=_0x19d746[_0x7995('0x5a')]['Text'];_0x87a539[_0x7995('0x5a')][_0x7995('0x84')]=_0x19d746['body'][_0x7995('0x8d')];break;case _0x7995('0x8e'):_0x87a539[_0x7995('0x5a')][_0x7995('0x82')]='+'+_0x19d746[_0x7995('0x5a')][_0x7995('0x8f')][0x0][_0x7995('0x82')];_0x87a539[_0x7995('0x5a')][_0x7995('0x5a')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x8f')][0x0][_0x7995('0x88')];_0x87a539[_0x7995('0x5a')]['messageId']=_0x19d746[_0x7995('0x5a')][_0x7995('0x8f')][0x0][_0x7995('0x84')];break;case _0x7995('0x90'):_0x87a539['body'][_0x7995('0x82')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x91')];_0x87a539['body'][_0x7995('0x5a')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x92')][_0x7995('0x29')];break;case _0x7995('0x93'):_0x87a539[_0x7995('0x5a')][_0x7995('0x82')]=_0x19d746['body'][_0x7995('0x94')];_0x87a539['body'][_0x7995('0x5a')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x88')];_0x87a539['body'][_0x7995('0x84')]=_0x19d746['body']['replyMessageId'];break;case'intelepeer':_0x87a539['body'][_0x7995('0x82')]=_0x19d746[_0x7995('0x5a')]['from'];_0x87a539[_0x7995('0x5a')][_0x7995('0x5a')]=_0x19d746['body'][_0x7995('0x29')];_0x87a539[_0x7995('0x5a')][_0x7995('0x84')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x95')];break;}}if(_0x87a539['body']['id']){delete _0x87a539[_0x7995('0x5a')]['id'];}if(_[_0x7995('0x96')](_0x87a539[_0x7995('0x5a')][_0x7995('0x82')])){throw new db['Sequelize'][(_0x7995('0x22'))](_0x7995('0x97'));}if(_[_0x7995('0x96')](_0x87a539[_0x7995('0x5a')][_0x7995('0x5a')])||_0x87a539[_0x7995('0x5a')][_0x7995('0x5a')]===''){throw new db[(_0x7995('0x7a'))][(_0x7995('0x22'))](_0x7995('0x98'));}if(_['isNil'](_0x87a539[_0x7995('0x5a')]['mapKey'])){throw new db[(_0x7995('0x7a'))][(_0x7995('0x22'))](_0x7995('0x99')+_0x2a01d4);}if(!_['includes'](_0x2a01d4,_0x87a539['body'][_0x7995('0x9a')])){throw new db[(_0x7995('0x7a'))]['ValidationError'](_0x7995('0x9b')+_0x2a01d4);}_0x5a4695[_0x87a539['body'][_0x7995('0x9a')]]=_0x87a539[_0x7995('0x5a')][_0x7995('0x82')];return db[_0x7995('0x9c')]['find']({'where':{'id':_0x87a539['account'][_0x7995('0x7f')]},'include':[{'model':db[_0x7995('0x79')],'as':_0x7995('0x9d'),'where':_0x5a4695,'limit':0x1,'order':[[_0x7995('0x9e'),'DESC']]}]});})[_0x7995('0x23')](handleEntityNotFound(_0x570b71,null))[_0x7995('0x23')](function(_0x8b820b){if(_0x8b820b){_0x87a539[_0x7995('0x9f')]=_[_0x7995('0xa0')](_0x8b820b,['Contacts']);if(_0x8b820b['Contacts']['length']){return _0x8b820b[_0x7995('0x9d')][0x0];}var _0x24a3cf=_['defaults'](_0x87a539[_0x7995('0x5a')],{'firstName':_0x87a539['body'][_0x7995('0x82')],'ListId':_0x8b820b['id']});_0x24a3cf[_0x87a539[_0x7995('0x5a')][_0x7995('0x9a')]]=_0x87a539[_0x7995('0x5a')]['from'];return db[_0x7995('0x79')][_0x7995('0x59')](_0x24a3cf,{'fields':_0x2056da,'raw':!![]});}})[_0x7995('0x23')](handleEntityNotFound(_0x570b71,null))[_0x7995('0x23')](function(_0x2023a7){if(_0x2023a7){_0x87a539[_0x7995('0xa1')]=_0x2023a7;var _0x1d200d={'ContactId':_0x2023a7['id'],'phone':_0x87a539[_0x7995('0x5a')][_0x7995('0x82')],'SmsAccountId':_0x19d746[_0x7995('0x55')]['id']};var _0x30893a={'ContactId':_0x2023a7['id'],'SmsAccountId':_0x19d746[_0x7995('0x55')]['id'],'closed':![]};return db[_0x7995('0xa2')][_0x7995('0x58')]({'where':_0x30893a})['then'](function(_0x764245){if(_0x764245){return[_0x764245,![]];}return db['SmsInteraction'][_0x7995('0x59')](_0x1d200d)[_0x7995('0x23')](function(_0x5cf7b2){return[_0x5cf7b2,!![]];});});}})[_0x7995('0xa3')](function(_0x55dc6c,_0x17c3f9){_0x87a539[_0x7995('0xa4')]=_0x55dc6c['get']({'plain':!![]});_0x87a539['interaction']['created']=![];if(_0x17c3f9){if(_0x87a539[_0x7995('0x74')][_0x7995('0xa5')]){_0x87a539[_0x7995('0x75')][_0x7995('0xa6')]({'id':0x0,'priority':_0x87a539['applications'][_0x7995('0x57')]+0x1,'app':_0x7995('0xa7'),'appdata':_0x7995('0xa8'),'interval':_0x7995('0xa9')});}_0x87a539[_0x7995('0xa4')][_0x7995('0xaa')]=!![];}return db[_0x7995('0xab')][_0x7995('0x59')]({'phone':_0x87a539['body'][_0x7995('0x82')],'messageId':_0x87a539[_0x7995('0x5a')][_0x7995('0x84')],'body':_0x87a539[_0x7995('0x5a')]['body'],'SmsAccountId':_0x19d746[_0x7995('0x55')]['id'],'SmsInteractionId':_0x55dc6c['id'],'direction':'in','ContactId':_0x55dc6c[_0x7995('0xac')],'AttachmentId':_0x87a539[_0x7995('0x5a')][_0x7995('0xad')]});})[_0x7995('0x23')](function(_0x2e7416){_0x87a539['message']=_0x2e7416;if(_0x87a539[_0x7995('0xa4')][_0x7995('0xae')]){return db[_0x7995('0xaf')][_0x7995('0x58')]({'attributes':['id',_0x7995('0x38')],'where':{'id':_0x87a539[_0x7995('0xa4')][_0x7995('0xae')]}})[_0x7995('0x23')](function(_0xf76f46){if(_0xf76f46){_0x87a539[_0x7995('0x75')][_0x7995('0xb0')]({'id':0x0,'priority':0x0,'app':_0x7995('0xb1'),'appdata':_0xf76f46[_0x7995('0x38')]+','+(_0x87a539[_0x7995('0x74')][_0x7995('0xb2')]||0xa),'interval':_0x7995('0xa9')});}return respondWithRpcPromise(_0x7995('0xb3'),_0x7995('0xb4'),_0x87a539);});}return respondWithRpcPromise(_0x7995('0xb3'),_0x7995('0xb4'),_0x87a539);})[_0x7995('0x23')](function(_0x51f854){if(_0x51f854){var _0x4cf7f1=0xc8;var _0x1a980b=_0x7995('0xb5');logger['info'](_0x7995('0x26'),_0x1a980b,_0x4cf7f1,'entity\x20found');logger[_0x7995('0xb6')]('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x1a980b,_0x4cf7f1,_0x7995('0xb7'),JSON[_0x7995('0xb8')](_0x51f854));if(_0x87a539[_0x7995('0x74')][_0x7995('0x41')]===_0x7995('0x81')){return _0x570b71[_0x7995('0x2d')](_0x4cf7f1)[_0x7995('0x32')](_0x7995('0xb9'),_0x7995('0xba'))[_0x7995('0x39')]('\x0a');}else{return _0x570b71[_0x7995('0x2d')](_0x4cf7f1)[_0x7995('0x2f')](_0x51f854);}}})[_0x7995('0x2b')](handleError(_0x570b71,null));};exports[_0x7995('0xbb')]=function(_0x54b803,_0x408c22,_0x1d2afe){return db[_0x7995('0x3e')][_0x7995('0x68')]({'where':{'id':_0x54b803['params']['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x408c22,null))[_0x7995('0x23')](function(_0x31d0e9){if(_0x31d0e9){return db[_0x7995('0xbc')][_0x7995('0xbd')](function(_0x13dda4){return db[_0x7995('0xbe')][_0x7995('0x35')]({'where':{'SmsAccountId':_0x54b803[_0x7995('0x55')]['id']},'transaction':_0x13dda4})['then'](function(_0x3c81cc){var _0x5f5496=_[_0x7995('0x3d')](_0x54b803[_0x7995('0x5a')],function(_0x35b217){_0x35b217[_0x7995('0x65')]=_0x54b803['params']['id'];return _0x35b217;});return db[_0x7995('0xbe')][_0x7995('0xbf')](_0x5f5496,{'transaction':_0x13dda4});});})[_0x7995('0x23')](function(){return db[_0x7995('0xbe')][_0x7995('0xc0')]({'where':{'SmsAccountId':_0x54b803[_0x7995('0x55')]['id']},'order':_0x7995('0xc1')});});}})[_0x7995('0x23')](respondWithResult(_0x408c22,null))[_0x7995('0x2b')](handleError(_0x408c22,null));};exports[_0x7995('0xc2')]=function(_0x45f389,_0x44d6a8,_0x7d14e2){var _0x405711={};var _0x54e341={};var _0x5cb30e;var _0xdfc11d;return db[_0x7995('0x3e')][_0x7995('0x68')]({'where':{'id':_0x45f389['params']['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x44d6a8,null))[_0x7995('0x23')](function(_0x610b81){if(_0x610b81){_0x5cb30e=_0x610b81;_0x54e341['model']=_[_0x7995('0x45')](db[_0x7995('0xbe')][_0x7995('0x3f')]);_0x54e341[_0x7995('0x44')]=_[_0x7995('0x45')](_0x45f389[_0x7995('0x44')]);_0x54e341[_0x7995('0x4c')]=_[_0x7995('0x46')](_0x54e341[_0x7995('0x43')],_0x54e341[_0x7995('0x44')]);_0x405711[_0x7995('0x47')]=_['intersection'](_0x54e341['model'],qs[_0x7995('0x56')](_0x45f389['query'][_0x7995('0x56')]));_0x405711[_0x7995('0x47')]=_0x405711[_0x7995('0x47')][_0x7995('0x57')]?_0x405711[_0x7995('0x47')]:_0x54e341['model'];_0x405711['order']=qs[_0x7995('0x6a')](_0x45f389[_0x7995('0x44')][_0x7995('0x6a')]);_0x405711[_0x7995('0x4b')]=qs[_0x7995('0x4c')](_[_0x7995('0x6b')](_0x45f389[_0x7995('0x44')],_0x54e341[_0x7995('0x4c')]));if(_0x45f389[_0x7995('0x44')][_0x7995('0x4d')]){_0x405711['where']=_[_0x7995('0x4e')](_0x405711[_0x7995('0x4b')],{'$or':_[_0x7995('0x3d')](_0x405711[_0x7995('0x47')],function(_0x511cf8){var _0x4d6da0={};_0x4d6da0[_0x511cf8]={'$like':'%'+_0x45f389['query']['filter']+'%'};return _0x4d6da0;})});}_0x405711=_['merge']({},_0x405711,_0x45f389[_0x7995('0x50')]);return _0x5cb30e['getApplications'](_0x405711);}})['then'](function(_0x32f19d){if(_0x32f19d){_0xdfc11d=_0x32f19d[_0x7995('0x57')];if(!_0x45f389[_0x7995('0x44')]['hasOwnProperty'](_0x7995('0x69'))){_0x405711['limit']=qs[_0x7995('0x49')](_0x45f389[_0x7995('0x44')][_0x7995('0x49')]);_0x405711['offset']=qs[_0x7995('0x31')](_0x45f389[_0x7995('0x44')][_0x7995('0x31')]);}return _0x5cb30e['getApplications'](_0x405711);}})[_0x7995('0x23')](function(_0x15cfd3){if(_0x15cfd3){return _0x15cfd3?{'count':_0xdfc11d,'rows':_0x15cfd3}:null;}})[_0x7995('0x23')](respondWithResult(_0x44d6a8,null))[_0x7995('0x2b')](handleError(_0x44d6a8,null));};exports[_0x7995('0xc3')]=function(_0x574e2a,_0x1761e1,_0x2a4991){var _0xc8bbb4={'raw':![],'where':{}};var _0x484b6c={};var _0x20852c={'count':0x0,'rows':[]};return db[_0x7995('0x3e')][_0x7995('0x68')]({'where':{'id':_0x574e2a[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x1761e1,null))['then'](function(_0x2995a3){if(_0x2995a3){_0x484b6c[_0x7995('0x43')]=_[_0x7995('0x45')](db[_0x7995('0xa2')][_0x7995('0x3f')]);_0x484b6c[_0x7995('0x44')]=_[_0x7995('0x45')](_0x574e2a['query']);_0x484b6c['filters']=_[_0x7995('0x46')](_0x484b6c[_0x7995('0x43')],_0x484b6c['query']);_0xc8bbb4['attributes']=_[_0x7995('0x46')](_0x484b6c[_0x7995('0x43')],qs[_0x7995('0x56')](_0x574e2a[_0x7995('0x44')][_0x7995('0x56')]));_0xc8bbb4[_0x7995('0x47')]=_0xc8bbb4[_0x7995('0x47')]['length']?_0xc8bbb4[_0x7995('0x47')]:_0x484b6c[_0x7995('0x43')];if(!_0x574e2a[_0x7995('0x44')][_0x7995('0x48')](_0x7995('0x69'))){_0xc8bbb4[_0x7995('0x49')]=qs['limit'](_0x574e2a[_0x7995('0x44')][_0x7995('0x49')]);_0xc8bbb4[_0x7995('0x31')]=qs[_0x7995('0x31')](_0x574e2a[_0x7995('0x44')][_0x7995('0x31')]);}_0xc8bbb4[_0x7995('0x4a')]=qs['sort'](_0x574e2a[_0x7995('0x44')][_0x7995('0x6a')]);_0xc8bbb4[_0x7995('0x4b')]=qs[_0x7995('0x4c')](_['pick'](_0x574e2a[_0x7995('0x44')],_0x484b6c['filters']));_0xc8bbb4[_0x7995('0x4b')][_0x7995('0x65')]=_0x2995a3['id'];if(_0x574e2a['query']['filter']){_0xc8bbb4['where']=_[_0x7995('0x4e')](_0xc8bbb4[_0x7995('0x4b')],{'$or':_[_0x7995('0x3d')](_0xc8bbb4[_0x7995('0x47')],function(_0x503b32){var _0x2da21e={};_0x2da21e[_0x503b32]={'$like':'%'+_0x574e2a[_0x7995('0x44')][_0x7995('0x4d')]+'%'};return _0x2da21e;})});}_0xc8bbb4=_[_0x7995('0x4e')]({},_0xc8bbb4,_0x574e2a[_0x7995('0x50')]);return db[_0x7995('0xa2')][_0x7995('0x30')]({'where':_0xc8bbb4['where']})['then'](function(_0x2695eb){_0x20852c['count']=_0x2695eb;if(_0x574e2a['query'][_0x7995('0x51')]){_0xc8bbb4[_0x7995('0x52')]=[{'model':db[_0x7995('0x79')],'as':_0x7995('0xc4'),'required':![]},{'model':db[_0x7995('0xaf')],'as':_0x7995('0xc5'),'attributes':[_0x7995('0x38'),_0x7995('0xc6'),_0x7995('0xc7')],'required':![]},{'model':db[_0x7995('0xc8')],'as':_0x7995('0xc9'),'attributes':['id',_0x7995('0x38'),'color'],'where':_0x574e2a[_0x7995('0x44')][_0x7995('0xca')]?{'id':_0x574e2a[_0x7995('0x44')][_0x7995('0xca')]}:undefined,'required':_0x574e2a[_0x7995('0x44')][_0x7995('0xca')]?!![]:![]}];}return db[_0x7995('0xa2')]['findAll'](_0xc8bbb4);})[_0x7995('0x23')](function(_0x234832){_0x20852c[_0x7995('0x6c')]=_0x234832;return _0x20852c;});}})[_0x7995('0x23')](respondWithFilteredResult(_0x1761e1,_0xc8bbb4))[_0x7995('0x2b')](handleError(_0x1761e1,null));};exports['send']=function(_0x2d1c14,_0x5e7fde,_0x156b65){var _0x12f4c5,_0x221be8,_0x5150aa;if(_[_0x7995('0x96')](_0x2d1c14[_0x7995('0x5a')][_0x7995('0x5a')])||_0x2d1c14[_0x7995('0x5a')][_0x7995('0x5a')]===''){throw new db[(_0x7995('0x7a'))][(_0x7995('0x22'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x2d1c14[_0x7995('0x5a')]['to'])){throw new db[(_0x7995('0x7a'))][(_0x7995('0x22'))](_0x7995('0xcb'));}_0x12f4c5=_0x2d1c14[_0x7995('0x5a')]['to'];return db[_0x7995('0x3e')]['find']({'where':{'id':_0x2d1c14[_0x7995('0x55')]['id']},'include':[{'model':db[_0x7995('0x9c')],'as':_0x7995('0xcc'),'include':[{'model':db[_0x7995('0x79')],'as':'Contacts','where':{'mobile':_0x12f4c5},'limit':0x1,'order':[['updatedAt',_0x7995('0xcd')]]}]}]})[_0x7995('0x23')](handleEntityNotFound(_0x5e7fde,null))['then'](function(_0x3130f2){if(_0x3130f2&&_0x3130f2[_0x7995('0xcc')]){_0x221be8=_0x3130f2['get']({'plain':!![]});if(_0x221be8[_0x7995('0xcc')]&&_0x221be8[_0x7995('0xcc')][_0x7995('0x9d')][_0x7995('0x57')]){return _0x221be8[_0x7995('0xcc')]['Contacts'][0x0];}return db['CmContact'][_0x7995('0x59')](_[_0x7995('0x1b')](_0x2d1c14[_0x7995('0x5a')],{'firstName':_0x12f4c5,'mobile':_0x12f4c5,'phone':_0x12f4c5,'ListId':_0x221be8[_0x7995('0x7f')]}));}})[_0x7995('0x23')](handleEntityNotFound(_0x5e7fde,null))['then'](function(_0xd0da6e){if(_0xd0da6e){_0x5150aa=_0xd0da6e;return db[_0x7995('0xa2')][_0x7995('0x58')]({'where':{'ContactId':_0x5150aa['id'],'closed':![],'SmsAccountId':_0x221be8['id']}})[_0x7995('0x23')](function(_0x1949f5){if(_0x1949f5){return[_0x1949f5,![]];}return db['SmsInteraction']['create']({'UserId':_0x2d1c14['user']['id'],'ContactId':_0x5150aa['id'],'SmsAccountId':_0x221be8['id'],'phone':_0x12f4c5,'firstMsgDirection':'out','Messages':[_[_0x7995('0x4e')](_0x2d1c14[_0x7995('0x5a')],{'read':![],'body':_0x2d1c14['body'][_0x7995('0x5a')],'phone':_0x12f4c5,'SmsAccountId':_0x221be8['id'],'UserId':_0x2d1c14[_0x7995('0x5b')]['id'],'ContactId':_0x5150aa['id']})]},{'include':[{'model':db['SmsMessage'],'as':'Messages'}]})[_0x7995('0x23')](function(_0x3ee80c){return[_0x3ee80c,!![]];});});}})[_0x7995('0xa3')](function(_0x8bd55,_0x20a056){if(_0x20a056){return _0x8bd55;}return db[_0x7995('0xab')][_0x7995('0x59')](_['merge'](_0x2d1c14['body'],{'read':![],'body':_0x2d1c14[_0x7995('0x5a')][_0x7995('0x5a')],'phone':_0x12f4c5,'SmsAccountId':_0x221be8['id'],'SmsInteractionId':_0x8bd55['id'],'UserId':_0x2d1c14[_0x7995('0x5b')]['id'],'ContactId':_0x5150aa['id']}))['then'](function(_0x2f96fd){_0x8bd55[_0x7995('0xce')][_0x7995('0xcf')]=[];_0x8bd55[_0x7995('0xce')][_0x7995('0xcf')][_0x7995('0xa6')](_0x2f96fd[_0x7995('0xce')]);return _0x8bd55;});})[_0x7995('0x23')](respondWithResult(_0x5e7fde,null))[_0x7995('0x2b')](handleError(_0x5e7fde,null));};exports['status']=function(_0x5136f5,_0x1161f2,_0x4bd222){if(_0x5136f5[_0x7995('0x5a')]['id']){delete _0x5136f5['body']['id'];}console[_0x7995('0xd0')](_0x7995('0xd1'),_0x5136f5[_0x7995('0x5a')]);var _0x4a75d2,_0x4c810d,_0x1401b4;return db[_0x7995('0x3e')][_0x7995('0x58')]({'where':{'id':_0x5136f5[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x1161f2,null))[_0x7995('0x23')](function(_0xb0164a){if(_0xb0164a){_0x1401b4=_0xb0164a;logger[_0x7995('0xb6')](_0x7995('0x26'),_0x7995('0x2d'),_0x7995('0xd2'),_0xb0164a['type'],util[_0x7995('0xd3')](_0x5136f5[_0x7995('0x5a')],{'showHidden':![],'depth':null}));switch(_0xb0164a[_0x7995('0x41')]){case _0x7995('0x86'):if(_0x5136f5[_0x7995('0x5a')]['skebby_dispatch_id']&&_0x5136f5[_0x7995('0x5a')][_0x7995('0x2d')]){_0x4c810d=_0x5136f5[_0x7995('0x5a')][_0x7995('0x2d')];return db[_0x7995('0xab')][_0x7995('0x58')]({'where':{'messageId':_0x5136f5[_0x7995('0x5a')][_0x7995('0xd4')]}});}break;case _0x7995('0x89'):if(_0x5136f5['body']['requestid']&&_0x5136f5[_0x7995('0x5a')][_0x7995('0xd5')]){_0x4c810d=_0x5136f5[_0x7995('0x5a')][_0x7995('0xd5')];return db[_0x7995('0xab')]['find']({'where':{'messageId':_0x5136f5[_0x7995('0x5a')][_0x7995('0xd6')]}});}break;case _0x7995('0x8a'):if(_0x5136f5[_0x7995('0x5a')][_0x7995('0x8b')]&&_0x5136f5[_0x7995('0x5a')][_0x7995('0xd7')]){_0x4c810d=_0x5136f5[_0x7995('0x5a')][_0x7995('0xd7')];return db['SmsMessage']['find']({'where':{'messageId':_0x5136f5[_0x7995('0x5a')][_0x7995('0x8b')]}});}break;case _0x7995('0x8e'):var _0x296643=_0x5136f5[_0x7995('0x5a')][_0x7995('0x8f')][0x0];if(_0x296643[_0x7995('0x84')]&&_0x296643[_0x7995('0x2d')]['groupName']==='DELIVERED'){_0x4c810d=_0x296643[_0x7995('0x2d')][_0x7995('0xd8')];return db[_0x7995('0xab')][_0x7995('0x58')]({'where':{'messageId':_0x296643['messageId']}});}break;case'clickatell':if(_0x5136f5[_0x7995('0x5a')][_0x7995('0x84')]&&_0x5136f5[_0x7995('0x5a')][_0x7995('0x2d')]){_0x4c810d=_0x5136f5[_0x7995('0x5a')][_0x7995('0x2d')];return db[_0x7995('0xab')][_0x7995('0x58')]({'where':{'messageId':_0x5136f5[_0x7995('0x5a')][_0x7995('0x84')]}});}break;case _0x7995('0xd9'):if(_0x5136f5[_0x7995('0x5a')]['redif']&&_0x5136f5['body'][_0x7995('0x2d')]){_0x4c810d=_0x5136f5[_0x7995('0x5a')][_0x7995('0x2d')];return db[_0x7995('0xab')]['find']({'where':{'messageId':_0x5136f5[_0x7995('0x5a')]['redif']}});}break;}}})[_0x7995('0x23')](handleEntityNotFound(_0x1161f2,null))[_0x7995('0x23')](function(_0x308d0e){if(_0x308d0e){_0x4a75d2=_0x308d0e;switch(_0x1401b4[_0x7995('0x41')]){case _0x7995('0x86'):if(_0x4c810d===_0x7995('0xda')){return _0x4a75d2['update']({'read':!![]});}else{logger[_0x7995('0x27')](_0x7995('0x26'),_0x7995('0x2d'),_0x7995('0x86'),util['inspect'](_0x5136f5['body'],{'showHidden':![],'depth':null}));}break;case _0x7995('0x89'):if(_0x4c810d==='1'){return _0x4a75d2[_0x7995('0x62')]({'read':!![]});}else{logger[_0x7995('0x27')](_0x7995('0x26'),'status',_0x7995('0x86'),util[_0x7995('0xd3')](_0x5136f5[_0x7995('0x5a')],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x5136f5[_0x7995('0x5a')][_0x7995('0xdb')]&&_0x4c810d>=0xc8&&_0x4c810d<=0xce){return _0x4a75d2[_0x7995('0x62')]({'read':!![]});}else{logger['error'](_0x7995('0x26'),_0x7995('0x2d'),_0x7995('0x8a'),util[_0x7995('0xd3')](_0x5136f5[_0x7995('0x5a')],{'showHidden':![],'depth':null}));}break;case _0x7995('0x8e'):var _0x1f6c3e=_0x5136f5[_0x7995('0x5a')][_0x7995('0x8f')][0x0];if(_0x1f6c3e['status'][_0x7995('0xd8')]===_0x7995('0xda')){return _0x4a75d2[_0x7995('0x62')]({'read':!![]});}else{logger[_0x7995('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x7995('0x2d'),_0x7995('0x8e'),util[_0x7995('0xd3')](_0x5136f5[_0x7995('0x5a')],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x4c810d==_0x7995('0xdc')||_0x4c810d==_0x7995('0xdd')){return _0x4a75d2[_0x7995('0x62')]({'read':!![]});}else{logger[_0x7995('0x27')](_0x7995('0x26'),_0x7995('0x2d'),_0x7995('0x93'),util['inspect'](_0x5136f5[_0x7995('0x5a')],{'showHidden':![],'depth':null}));}break;case _0x7995('0xd9'):if(_0x4c810d===_0x7995('0xde')||_0x4c810d===_0x7995('0xdf')){return _0x4a75d2[_0x7995('0x62')]({'read':!![]});}else{logger['error'](_0x7995('0x26'),'status',_0x7995('0xd9'),util[_0x7995('0xd3')](_0x5136f5[_0x7995('0x5a')],{'showHidden':![],'depth':null}));}break;}return _0x4a75d2;}})['then'](respondWithResult(_0x1161f2,null))['catch'](handleError(_0x1161f2,null));};exports['statusGet']=function(_0x21ff84,_0x1763aa,_0x32e443){var _0x35b6f9,_0x17fab0,_0x4da0e8;return db['SmsAccount'][_0x7995('0x58')]({'where':{'id':_0x21ff84[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x1763aa,null))[_0x7995('0x23')](function(_0x5bc1b4){if(_0x5bc1b4){_0x4da0e8=_0x5bc1b4;logger[_0x7995('0xb6')](_0x7995('0x26'),'status',_0x7995('0xd2'),_0x5bc1b4['type'],util[_0x7995('0xd3')](_0x21ff84[_0x7995('0x44')],{'showHidden':![],'depth':null}));switch(_0x5bc1b4[_0x7995('0x41')]){case'csc':if(_0x21ff84['query'][_0x7995('0xe0')]&&_0x21ff84[_0x7995('0x44')][_0x7995('0xe1')]){_0x17fab0=_0x21ff84[_0x7995('0x44')][_0x7995('0xe1')];return db[_0x7995('0xab')][_0x7995('0x58')]({'where':{'messageId':_0x21ff84[_0x7995('0x44')][_0x7995('0xe0')]}});}break;}}})[_0x7995('0x23')](handleEntityNotFound(_0x1763aa,null))[_0x7995('0x23')](function(_0x48c9fc){if(_0x48c9fc){_0x35b6f9=_0x48c9fc;switch(_0x4da0e8['type']){case _0x7995('0x90'):if(_0x17fab0==='2'||_0x17fab0==='6'){return _0x35b6f9[_0x7995('0x62')]({'read':!![]});}else{logger[_0x7995('0x27')](_0x7995('0x26'),'status','csc',util[_0x7995('0xd3')](_0x21ff84[_0x7995('0x44')],{'showHidden':![],'depth':null}));};break;}return _0x35b6f9;}})['then'](respondWithResult(_0x1763aa,null))['catch'](handleError(_0x1763aa,null));};exports[_0x7995('0xe2')]=function(_0x469cd6,_0x3ad24,_0x17c27b){return db[_0x7995('0x3e')]['find']({'where':{'id':_0x469cd6[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x3ad24,null))['then'](function(_0xf9859c){if(_0xf9859c){return _0xf9859c[_0x7995('0xe2')](_0x469cd6[_0x7995('0x5a')]['ids'],_[_0x7995('0xa0')](_0x469cd6[_0x7995('0x5a')],[_0x7995('0x71'),'id'])||{})[_0x7995('0xa3')](function(_0x113e03){for(var _0x5348b1=0x0;_0x5348b1<_0x469cd6['body'][_0x7995('0x71')]['length'];_0x5348b1+=0x1){socket[_0x7995('0xe3')]('userSmsAccount:save',{'UserId':_0x469cd6[_0x7995('0x5a')][_0x7995('0x71')][_0x5348b1],'SmsAccountId':_0x469cd6[_0x7995('0x55')]['id']});}return _0x113e03;});}})['then'](respondWithResult(_0x3ad24,null))['catch'](handleError(_0x3ad24,null));};exports['removeAgents']=function(_0x362580,_0x1da57f,_0x270ef3){return db['SmsAccount'][_0x7995('0x58')]({'where':{'id':_0x362580[_0x7995('0x55')]['id']}})['then'](handleEntityNotFound(_0x1da57f,null))[_0x7995('0x23')](function(_0x39449e){if(_0x39449e){return _0x39449e[_0x7995('0xe4')](_0x362580[_0x7995('0x44')][_0x7995('0x71')])['then'](function(){if(_['isArray'](_0x362580[_0x7995('0x44')][_0x7995('0x71')])){for(var _0x134da2=0x0;_0x134da2<_0x362580[_0x7995('0x44')][_0x7995('0x71')][_0x7995('0x57')];_0x134da2+=0x1){socket[_0x7995('0xe3')](_0x7995('0xe5'),{'UserId':Number(_0x362580[_0x7995('0x44')][_0x7995('0x71')][_0x134da2]),'SmsAccountId':Number(_0x362580['params']['id'])});}}else{socket[_0x7995('0xe3')](_0x7995('0xe5'),{'UserId':Number(_0x362580[_0x7995('0x44')][_0x7995('0x71')]),'SmsAccountId':Number(_0x362580[_0x7995('0x55')]['id'])});}});}})[_0x7995('0x23')](respondWithStatusCode(_0x1da57f,null))[_0x7995('0x2b')](handleError(_0x1da57f,null));};exports['getAgents']=function(_0x5d0fe6,_0x43a8a4,_0x2aec8d){var _0x12df49={};var _0x1f4efc={};var _0x55ce63;var _0x572c53;return db['SmsAccount'][_0x7995('0x68')]({'where':{'id':_0x5d0fe6[_0x7995('0x55')]['id']}})['then'](handleEntityNotFound(_0x43a8a4,null))[_0x7995('0x23')](function(_0x2265cf){if(_0x2265cf){_0x55ce63=_0x2265cf;_0x1f4efc[_0x7995('0x43')]=_[_0x7995('0x45')](db[_0x7995('0xaf')][_0x7995('0x3f')]);_0x1f4efc[_0x7995('0x44')]=_[_0x7995('0x45')](_0x5d0fe6['query']);_0x1f4efc[_0x7995('0x4c')]=_[_0x7995('0x46')](_0x1f4efc[_0x7995('0x43')],_0x1f4efc['query']);_0x12df49[_0x7995('0x47')]=_['intersection'](_0x1f4efc['model'],qs['fields'](_0x5d0fe6['query'][_0x7995('0x56')]));_0x12df49['attributes']=_0x12df49[_0x7995('0x47')][_0x7995('0x57')]?_0x12df49['attributes']:_0x1f4efc[_0x7995('0x43')];_0x12df49[_0x7995('0x4a')]=qs[_0x7995('0x6a')](_0x5d0fe6[_0x7995('0x44')]['sort']);_0x12df49[_0x7995('0x4b')]=qs['filters'](_[_0x7995('0x6b')](_0x5d0fe6[_0x7995('0x44')],_0x1f4efc[_0x7995('0x4c')]));if(_0x5d0fe6[_0x7995('0x44')][_0x7995('0x4d')]){_0x12df49[_0x7995('0x4b')]=_[_0x7995('0x4e')](_0x12df49[_0x7995('0x4b')],{'$or':_[_0x7995('0x3d')](_0x12df49[_0x7995('0x47')],function(_0x4aa202){var _0x8c9b6f={};_0x8c9b6f[_0x4aa202]={'$like':'%'+_0x5d0fe6[_0x7995('0x44')]['filter']+'%'};return _0x8c9b6f;})});}_0x12df49=_[_0x7995('0x4e')]({},_0x12df49,_0x5d0fe6[_0x7995('0x50')]);return _0x55ce63[_0x7995('0xe6')](_0x12df49);}})[_0x7995('0x23')](function(_0x1a6f42){if(_0x1a6f42){_0x572c53=_0x1a6f42[_0x7995('0x57')];if(!_0x5d0fe6['query'][_0x7995('0x48')]('nolimit')){_0x12df49[_0x7995('0x49')]=qs[_0x7995('0x49')](_0x5d0fe6[_0x7995('0x44')][_0x7995('0x49')]);_0x12df49[_0x7995('0x31')]=qs[_0x7995('0x31')](_0x5d0fe6['query'][_0x7995('0x31')]);}return _0x55ce63[_0x7995('0xe6')](_0x12df49);}})[_0x7995('0x23')](function(_0x4c2faf){if(_0x4c2faf){return _0x4c2faf?{'count':_0x572c53,'rows':_0x4c2faf}:null;}})[_0x7995('0x23')](respondWithResult(_0x43a8a4,null))[_0x7995('0x2b')](handleError(_0x43a8a4,null));}; \ No newline at end of file +var _0x9957=['show','params','fields','length','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','SmsAccountId','Disposition','getDispositions','findOne','nolimit','sort','pick','rows','removeDispositions','CannedAnswer','getAnswers','removeAnswers','ids','notify','sms','account','applications','orderBy','Applications','asc','CmContact','Sequelize','no\x20available\x20attributes','difference','createdAt','CompanyId','ListId','mobile','twilio','from','Body','messageId','MessageSid','skebby','sender','text','connectel','clicksend','message_id','plivo','MessageUUID','infobip','results','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','refid','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','updatedAt','list','omit','contact','SmsInteraction','spread','interaction','autoclose','push','close','unmanaged','*,*,*,*','created','SmsMessage','ContactId','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','debug','entity\x20found','stringify','Content-Type','text/xml','addApplications','sequelize','transaction','SmsApplication','bulkCreate','findAndCountAll','priority','getApplications','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','tag','to\x20is\x20mandatory','List','DESC','dataValues','Messages','log','endpoint\x20/status\x20POST\x20/','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','statusInt','requestid','status_code','groupName','intelepeer','DELIVERED','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','DELIVRD','ACCEPTD','message-id','state','addAgents','emit','removeAgents','userSmsAccount:remove','getAgents','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','../../mysqldb','redis','defaults','localhost','socket.io-emitter','jayson/promise','client','http','test','ValidationError','then','SmsAccount,\x20%s,\x20%s','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','count','offset','set','apply','save','destroy','SmsAccounts','stack','name','send','index','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','hasOwnProperty','limit','order','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll'];(function(_0x590a38,_0x2bc65c){var _0xf36626=function(_0x551cd1){while(--_0x551cd1){_0x590a38['push'](_0x590a38['shift']());}};_0xf36626(++_0x2bc65c);}(_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 db=require(_0x7995('0x19'))['db'];config[_0x7995('0x1a')]=_[_0x7995('0x1b')](config[_0x7995('0x1a')],{'host':_0x7995('0x1c'),'port':0x18eb});var socket=require(_0x7995('0x1d'))(new Redis(config[_0x7995('0x1a')]));require('./smsAccount.socket')['register'](socket);var jayson=require(_0x7995('0x1e'));var client=jayson[_0x7995('0x1f')][_0x7995('0x20')]({'port':0x232c});function checkPasswordPattern(_0x321ae8,_0x3f1d3e,_0x1a5310){if(_0x1a5310){var _0x2202ce=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2202ce[_0x7995('0x21')](_0x3f1d3e)){return _0x321ae8;}else{throw new db['Sequelize'][(_0x7995('0x22'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x321ae8;}}function respondWithRpcPromise(_0x2f832e,_0x37f297,_0x43d4b8,_0x291317){return new BPromise(function(_0x1e1415,_0x37a7d4){var _0x4faa60=_0x291317||client;return _0x4faa60['request'](_0x2f832e,_0x43d4b8)[_0x7995('0x23')](function(_0x5e6f90){logger['info'](_0x7995('0x24'),_0x37f297,_0x7995('0x25'));logger['debug'](_0x7995('0x26'),_0x37f297,'request\x20sent',JSON['stringify'](_0x5e6f90));if(_0x5e6f90[_0x7995('0x27')]){if(_0x5e6f90[_0x7995('0x27')][_0x7995('0x28')]===0x1f4){logger[_0x7995('0x27')](_0x7995('0x24'),_0x37f297,_0x5e6f90[_0x7995('0x27')]['message']);return _0x37a7d4(_0x5e6f90[_0x7995('0x27')][_0x7995('0x29')]);}logger[_0x7995('0x27')](_0x7995('0x24'),_0x37f297,_0x5e6f90[_0x7995('0x27')][_0x7995('0x29')]);return _0x1e1415(_0x5e6f90[_0x7995('0x27')][_0x7995('0x29')]);}else{logger['info'](_0x7995('0x24'),_0x37f297,_0x7995('0x25'));_0x1e1415(_0x5e6f90[_0x7995('0x2a')][_0x7995('0x29')]);}})[_0x7995('0x2b')](function(_0x2a307e){logger['error'](_0x7995('0x24'),_0x37f297,_0x2a307e);_0x37a7d4(_0x2a307e);});});}function respondWithStatusCode(_0x5911c3,_0x229742){_0x229742=_0x229742||0xcc;return function(_0x49bc7e){if(_0x49bc7e){return _0x5911c3[_0x7995('0x2c')](_0x229742);}return _0x5911c3[_0x7995('0x2d')](_0x229742)[_0x7995('0x2e')]();};}function respondWithResult(_0x4b6f99,_0x9b2a15){_0x9b2a15=_0x9b2a15||0xc8;return function(_0x514445){if(_0x514445){return _0x4b6f99[_0x7995('0x2d')](_0x9b2a15)[_0x7995('0x2f')](_0x514445);}};}function respondWithFilteredResult(_0x4253e5,_0x574574){return function(_0x530611){if(_0x530611){var _0x48e573=_0x530611[_0x7995('0x30')],_0x3573be=_0x574574[_0x7995('0x31')],_0xe6b0b3=_0x574574[_0x7995('0x31')]+_0x574574['limit'],_0x327a81;if(_0xe6b0b3>=_0x48e573){_0xe6b0b3=_0x48e573;_0x327a81=0xc8;}else{_0x327a81=0xce;}_0x4253e5['status'](_0x327a81);return _0x4253e5[_0x7995('0x32')]('Content-Range',_0x3573be+'-'+_0xe6b0b3+'/'+_0x48e573)[_0x7995('0x2f')](_0x530611);}return null;};}function patchUpdates(_0x3eb566){return function(_0x29fac5){try{jsonpatch[_0x7995('0x33')](_0x29fac5,_0x3eb566,!![]);}catch(_0x1f7d27){return BPromise['reject'](_0x1f7d27);}return _0x29fac5[_0x7995('0x34')]();};}function saveUpdates(_0x33e24e,_0x5dd802){return function(_0x48db25){if(_0x48db25){return _0x48db25['update'](_0x33e24e)[_0x7995('0x23')](function(_0x3acfc3){return _0x3acfc3;});}return null;};}function removeEntity(_0x4a176f,_0x3e7020){return function(_0x51b95d){if(_0x51b95d){return _0x51b95d[_0x7995('0x35')]()[_0x7995('0x23')](function(){var _0x177cb4=_0x51b95d['get']({'plain':!![]});var _0x52d76d=_0x7995('0x36');return db['UserProfileResource']['destroy']({'where':{'type':_0x52d76d,'resourceId':_0x177cb4['id']}})[_0x7995('0x23')](function(){return _0x51b95d;});})[_0x7995('0x23')](function(){_0x4a176f['status'](0xcc)[_0x7995('0x2e')]();});}};}function handleEntityNotFound(_0x1922b4,_0x2b772f){return function(_0x18667c){if(!_0x18667c){_0x1922b4[_0x7995('0x2c')](0x194);}return _0x18667c;};}function handleError(_0x53002a,_0x2d4285){_0x2d4285=_0x2d4285||0x1f4;return function(_0x242713){logger[_0x7995('0x27')](_0x242713[_0x7995('0x37')]);if(_0x242713['name']){delete _0x242713[_0x7995('0x38')];}_0x53002a[_0x7995('0x2d')](_0x2d4285)[_0x7995('0x39')](_0x242713);};}exports[_0x7995('0x3a')]=function(_0x1f5bee,_0x1035dc){var _0x5688a1={'include':[{'model':db[_0x7995('0x3b')],'as':_0x7995('0x3c')}]},_0x183a68={},_0x3be298={'count':0x0,'rows':[]};var _0x2e04cd=_[_0x7995('0x3d')](db[_0x7995('0x3e')][_0x7995('0x3f')],function(_0x1234e1){return{'name':_0x1234e1[_0x7995('0x40')],'type':_0x1234e1[_0x7995('0x41')][_0x7995('0x42')]};});_0x183a68[_0x7995('0x43')]=_['map'](_0x2e04cd,'name');_0x183a68[_0x7995('0x44')]=_[_0x7995('0x45')](_0x1f5bee['query']);_0x183a68['filters']=_[_0x7995('0x46')](_0x183a68['model'],_0x183a68['query']);_0x5688a1[_0x7995('0x47')]=_[_0x7995('0x46')](_0x183a68[_0x7995('0x43')],qs['fields'](_0x1f5bee[_0x7995('0x44')]['fields']));_0x5688a1[_0x7995('0x47')]=_0x5688a1['attributes']['length']?_0x5688a1[_0x7995('0x47')]:_0x183a68[_0x7995('0x43')];if(!_0x1f5bee[_0x7995('0x44')][_0x7995('0x48')]('nolimit')){_0x5688a1[_0x7995('0x49')]=qs[_0x7995('0x49')](_0x1f5bee[_0x7995('0x44')][_0x7995('0x49')]);_0x5688a1['offset']=qs['offset'](_0x1f5bee[_0x7995('0x44')]['offset']);}_0x5688a1[_0x7995('0x4a')]=qs['sort'](_0x1f5bee[_0x7995('0x44')]['sort']);_0x5688a1[_0x7995('0x4b')]=qs[_0x7995('0x4c')](_['pick'](_0x1f5bee[_0x7995('0x44')],_0x183a68[_0x7995('0x4c')]),_0x2e04cd);if(_0x1f5bee[_0x7995('0x44')][_0x7995('0x4d')]){_0x5688a1['where']=_[_0x7995('0x4e')](_0x5688a1[_0x7995('0x4b')],{'$or':_[_0x7995('0x3d')](_0x2e04cd,function(_0x491184){if(_0x491184[_0x7995('0x41')]!==_0x7995('0x4f')){var _0x511567={};_0x511567[_0x491184[_0x7995('0x38')]]={'$like':'%'+_0x1f5bee[_0x7995('0x44')]['filter']+'%'};return _0x511567;}})});}_0x5688a1=_[_0x7995('0x4e')]({},_0x5688a1,_0x1f5bee[_0x7995('0x50')]);var _0x5921b9={'where':_0x5688a1[_0x7995('0x4b')]};return db['SmsAccount'][_0x7995('0x30')](_0x5921b9)[_0x7995('0x23')](function(_0x1afab4){_0x3be298[_0x7995('0x30')]=_0x1afab4;if(_0x1f5bee[_0x7995('0x44')][_0x7995('0x51')]){_0x5688a1[_0x7995('0x52')]=[{'all':!![]}];}return db['SmsAccount'][_0x7995('0x53')](_0x5688a1);})[_0x7995('0x23')](function(_0x418eb9){_0x3be298['rows']=_0x418eb9;return _0x3be298;})[_0x7995('0x23')](respondWithFilteredResult(_0x1035dc,_0x5688a1))[_0x7995('0x2b')](handleError(_0x1035dc,null));};exports[_0x7995('0x54')]=function(_0x47d1d8,_0x4ec548){var _0x5a592e={'raw':![],'where':{'id':_0x47d1d8[_0x7995('0x55')]['id']},'include':[{'model':db['Pause'],'as':_0x7995('0x3c')}]},_0xb70620={};_0xb70620[_0x7995('0x43')]=_[_0x7995('0x45')](db[_0x7995('0x3e')][_0x7995('0x3f')]);_0xb70620['query']=_[_0x7995('0x45')](_0x47d1d8['query']);_0xb70620[_0x7995('0x4c')]=_[_0x7995('0x46')](_0xb70620[_0x7995('0x43')],_0xb70620['query']);_0x5a592e['attributes']=_['intersection'](_0xb70620['model'],qs[_0x7995('0x56')](_0x47d1d8[_0x7995('0x44')][_0x7995('0x56')]));_0x5a592e[_0x7995('0x47')]=_0x5a592e[_0x7995('0x47')][_0x7995('0x57')]?_0x5a592e[_0x7995('0x47')]:_0xb70620[_0x7995('0x43')];if(_0x47d1d8[_0x7995('0x44')][_0x7995('0x51')]){_0x5a592e[_0x7995('0x52')]=[{'all':!![]}];}_0x5a592e=_[_0x7995('0x4e')]({},_0x5a592e,_0x47d1d8[_0x7995('0x50')]);return db[_0x7995('0x3e')][_0x7995('0x58')](_0x5a592e)[_0x7995('0x23')](handleEntityNotFound(_0x4ec548,null))[_0x7995('0x23')](respondWithResult(_0x4ec548,null))[_0x7995('0x2b')](handleError(_0x4ec548,null));};exports[_0x7995('0x59')]=function(_0x50b7c2,_0x56a374){return db[_0x7995('0x3e')][_0x7995('0x59')](_0x50b7c2[_0x7995('0x5a')],{})['then'](function(_0x53125a){var _0x402fa0=_0x50b7c2[_0x7995('0x5b')][_0x7995('0x5c')]({'plain':!![]});if(!_0x402fa0)throw new Error(_0x7995('0x5d'));if(_0x402fa0['role']===_0x7995('0x5b')){var _0x74ff38=_0x53125a[_0x7995('0x5c')]({'plain':!![]});var _0x33c49c='SmsAccounts';return db['UserProfileSection'][_0x7995('0x58')]({'where':{'name':_0x33c49c,'userProfileId':_0x402fa0[_0x7995('0x5e')]},'raw':!![]})[_0x7995('0x23')](function(_0x1d69ce){if(_0x1d69ce&&_0x1d69ce[_0x7995('0x5f')]===0x0){return db[_0x7995('0x60')][_0x7995('0x59')]({'name':_0x74ff38[_0x7995('0x38')],'resourceId':_0x74ff38['id'],'type':_0x1d69ce[_0x7995('0x38')],'sectionId':_0x1d69ce['id']},{})['then'](function(){return _0x53125a;});}else{return _0x53125a;}})[_0x7995('0x2b')](function(_0x3ec5a8){logger[_0x7995('0x27')](_0x7995('0x61'),_0x3ec5a8);throw _0x3ec5a8;});}return _0x53125a;})['then'](respondWithResult(_0x56a374,0xc9))['catch'](handleError(_0x56a374,null));};exports[_0x7995('0x62')]=function(_0xebb5c8,_0x47d5d7){if(_0xebb5c8[_0x7995('0x5a')]['id']){delete _0xebb5c8[_0x7995('0x5a')]['id'];}return db[_0x7995('0x3e')][_0x7995('0x58')]({'where':{'id':_0xebb5c8[_0x7995('0x55')]['id']},'include':[{'model':db['Pause'],'as':_0x7995('0x3c')}]})['then'](handleEntityNotFound(_0x47d5d7,null))[_0x7995('0x23')](saveUpdates(_0xebb5c8[_0x7995('0x5a')],null))[_0x7995('0x23')](respondWithResult(_0x47d5d7,null))[_0x7995('0x2b')](handleError(_0x47d5d7,null));};exports[_0x7995('0x35')]=function(_0xeb8920,_0x2b3c1d){return db[_0x7995('0x3e')][_0x7995('0x58')]({'where':{'id':_0xeb8920[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x2b3c1d,null))[_0x7995('0x23')](removeEntity(_0x2b3c1d,null))['catch'](handleError(_0x2b3c1d,null));};exports[_0x7995('0x63')]=function(_0x23bbc1,_0x293480){return db[_0x7995('0x3e')][_0x7995('0x63')]()['then'](respondWithResult(_0x293480,null))['catch'](handleError(_0x293480,null));};exports[_0x7995('0x64')]=function(_0x87e38d,_0x221542,_0xae6166){if(_0x87e38d['body']['id']){delete _0x87e38d[_0x7995('0x5a')]['id'];}return db['SmsAccount']['find']({'where':{'id':_0x87e38d[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x221542,null))[_0x7995('0x23')](function(_0x44bf2b){if(_0x44bf2b){_0x87e38d[_0x7995('0x5a')][_0x7995('0x65')]=_0x44bf2b['id'];return db[_0x7995('0x66')][_0x7995('0x59')](_0x87e38d[_0x7995('0x5a')]);}})[_0x7995('0x23')](respondWithResult(_0x221542,null))['catch'](handleError(_0x221542,null));};exports[_0x7995('0x67')]=function(_0x8908cd,_0x3c5802,_0x4cc247){var _0x1fe1cb={'raw':![],'where':{}};var _0x1d2f9d={};var _0x705f0={'count':0x0,'rows':[]};return db[_0x7995('0x3e')][_0x7995('0x68')]({'where':{'id':_0x8908cd[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x3c5802,null))[_0x7995('0x23')](function(_0x2f94c4){if(_0x2f94c4){_0x1d2f9d[_0x7995('0x43')]=_[_0x7995('0x45')](db['Disposition']['rawAttributes']);_0x1d2f9d[_0x7995('0x44')]=_[_0x7995('0x45')](_0x8908cd[_0x7995('0x44')]);_0x1d2f9d[_0x7995('0x4c')]=_['intersection'](_0x1d2f9d[_0x7995('0x43')],_0x1d2f9d[_0x7995('0x44')]);_0x1fe1cb['attributes']=_['intersection'](_0x1d2f9d[_0x7995('0x43')],qs[_0x7995('0x56')](_0x8908cd['query'][_0x7995('0x56')]));_0x1fe1cb['attributes']=_0x1fe1cb[_0x7995('0x47')][_0x7995('0x57')]?_0x1fe1cb['attributes']:_0x1d2f9d['model'];if(!_0x8908cd[_0x7995('0x44')]['hasOwnProperty'](_0x7995('0x69'))){_0x1fe1cb[_0x7995('0x49')]=qs[_0x7995('0x49')](_0x8908cd[_0x7995('0x44')][_0x7995('0x49')]);_0x1fe1cb[_0x7995('0x31')]=qs[_0x7995('0x31')](_0x8908cd[_0x7995('0x44')][_0x7995('0x31')]);}_0x1fe1cb[_0x7995('0x4a')]=qs[_0x7995('0x6a')](_0x8908cd[_0x7995('0x44')][_0x7995('0x6a')]);_0x1fe1cb[_0x7995('0x4b')]=qs[_0x7995('0x4c')](_[_0x7995('0x6b')](_0x8908cd[_0x7995('0x44')],_0x1d2f9d[_0x7995('0x4c')]));_0x1fe1cb[_0x7995('0x4b')][_0x7995('0x65')]=_0x2f94c4['id'];if(_0x8908cd[_0x7995('0x44')][_0x7995('0x4d')]){_0x1fe1cb[_0x7995('0x4b')]=_[_0x7995('0x4e')](_0x1fe1cb[_0x7995('0x4b')],{'$or':_[_0x7995('0x3d')](_0x1fe1cb[_0x7995('0x47')],function(_0x34724d){var _0x59efff={};_0x59efff[_0x34724d]={'$like':'%'+_0x8908cd[_0x7995('0x44')][_0x7995('0x4d')]+'%'};return _0x59efff;})});}_0x1fe1cb=_['merge']({},_0x1fe1cb,_0x8908cd['options']);return db[_0x7995('0x66')][_0x7995('0x30')]({'where':_0x1fe1cb[_0x7995('0x4b')]})[_0x7995('0x23')](function(_0xe1ce4){_0x705f0[_0x7995('0x30')]=_0xe1ce4;if(_0x8908cd['query'][_0x7995('0x51')]){_0x1fe1cb[_0x7995('0x52')]=[{'all':!![]}];}return db[_0x7995('0x66')][_0x7995('0x53')](_0x1fe1cb);})[_0x7995('0x23')](function(_0x3f0bff){_0x705f0[_0x7995('0x6c')]=_0x3f0bff;return _0x705f0;});}})[_0x7995('0x23')](respondWithFilteredResult(_0x3c5802,_0x1fe1cb))['catch'](handleError(_0x3c5802,null));};exports[_0x7995('0x6d')]=function(_0x2b8217,_0x5c04c9,_0x479271){return db[_0x7995('0x3e')][_0x7995('0x58')]({'where':{'id':_0x2b8217[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x5c04c9,null))[_0x7995('0x23')](function(_0x4a02ea){if(_0x4a02ea){return _0x4a02ea[_0x7995('0x6d')](_0x2b8217[_0x7995('0x44')]['ids']);}})[_0x7995('0x23')](respondWithStatusCode(_0x5c04c9,null))[_0x7995('0x2b')](handleError(_0x5c04c9,null));};exports['addAnswer']=function(_0x1535a3,_0x4a5bc5,_0x135191){if(_0x1535a3[_0x7995('0x5a')]['id']){delete _0x1535a3[_0x7995('0x5a')]['id'];}return db[_0x7995('0x3e')][_0x7995('0x58')]({'where':{'id':_0x1535a3['params']['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x4a5bc5,null))[_0x7995('0x23')](function(_0x38b37f){if(_0x38b37f){_0x1535a3['body'][_0x7995('0x65')]=_0x38b37f['id'];return db[_0x7995('0x6e')][_0x7995('0x59')](_0x1535a3[_0x7995('0x5a')]);}})['then'](respondWithResult(_0x4a5bc5,null))[_0x7995('0x2b')](handleError(_0x4a5bc5,null));};exports[_0x7995('0x6f')]=function(_0x3a5f5e,_0x4aafa3,_0x5358d4){var _0x3fc10={'raw':![],'where':{}};var _0x333379={};var _0x4800a8={'count':0x0,'rows':[]};return db['SmsAccount'][_0x7995('0x68')]({'where':{'id':_0x3a5f5e[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x4aafa3,null))[_0x7995('0x23')](function(_0x2ba606){if(_0x2ba606){_0x333379['model']=_['keys'](db[_0x7995('0x6e')]['rawAttributes']);_0x333379['query']=_[_0x7995('0x45')](_0x3a5f5e[_0x7995('0x44')]);_0x333379[_0x7995('0x4c')]=_['intersection'](_0x333379[_0x7995('0x43')],_0x333379[_0x7995('0x44')]);_0x3fc10[_0x7995('0x47')]=_[_0x7995('0x46')](_0x333379[_0x7995('0x43')],qs['fields'](_0x3a5f5e[_0x7995('0x44')][_0x7995('0x56')]));_0x3fc10[_0x7995('0x47')]=_0x3fc10[_0x7995('0x47')]['length']?_0x3fc10[_0x7995('0x47')]:_0x333379[_0x7995('0x43')];if(!_0x3a5f5e['query'][_0x7995('0x48')](_0x7995('0x69'))){_0x3fc10['limit']=qs[_0x7995('0x49')](_0x3a5f5e['query'][_0x7995('0x49')]);_0x3fc10['offset']=qs[_0x7995('0x31')](_0x3a5f5e['query'][_0x7995('0x31')]);}_0x3fc10[_0x7995('0x4a')]=qs['sort'](_0x3a5f5e[_0x7995('0x44')]['sort']);_0x3fc10['where']=qs[_0x7995('0x4c')](_[_0x7995('0x6b')](_0x3a5f5e[_0x7995('0x44')],_0x333379[_0x7995('0x4c')]));_0x3fc10['where'][_0x7995('0x65')]=_0x2ba606['id'];if(_0x3a5f5e[_0x7995('0x44')]['filter']){_0x3fc10['where']=_[_0x7995('0x4e')](_0x3fc10['where'],{'$or':_[_0x7995('0x3d')](_0x3fc10[_0x7995('0x47')],function(_0xfb4479){var _0x5b42be={};_0x5b42be[_0xfb4479]={'$like':'%'+_0x3a5f5e['query'][_0x7995('0x4d')]+'%'};return _0x5b42be;})});}_0x3fc10=_['merge']({},_0x3fc10,_0x3a5f5e[_0x7995('0x50')]);return db[_0x7995('0x6e')][_0x7995('0x30')]({'where':_0x3fc10[_0x7995('0x4b')]})['then'](function(_0x52d102){_0x4800a8['count']=_0x52d102;if(_0x3a5f5e[_0x7995('0x44')][_0x7995('0x51')]){_0x3fc10[_0x7995('0x52')]=[{'all':!![]}];}return db[_0x7995('0x6e')][_0x7995('0x53')](_0x3fc10);})[_0x7995('0x23')](function(_0x59a793){_0x4800a8['rows']=_0x59a793;return _0x4800a8;});}})[_0x7995('0x23')](respondWithFilteredResult(_0x4aafa3,_0x3fc10))['catch'](handleError(_0x4aafa3,null));};exports['removeAnswers']=function(_0x17d00f,_0x5e95c0,_0x57a164){return db[_0x7995('0x3e')][_0x7995('0x58')]({'where':{'id':_0x17d00f[_0x7995('0x55')]['id']}})['then'](handleEntityNotFound(_0x5e95c0,null))[_0x7995('0x23')](function(_0xf604d9){if(_0xf604d9){return _0xf604d9[_0x7995('0x70')](_0x17d00f[_0x7995('0x44')][_0x7995('0x71')]);}})[_0x7995('0x23')](respondWithStatusCode(_0x5e95c0,null))[_0x7995('0x2b')](handleError(_0x5e95c0,null));};exports[_0x7995('0x72')]=function(_0x19d746,_0x570b71,_0x3eb3fa){var _0x87a539={'channel':_0x7995('0x73')};var _0x2056da=[];var _0x2a01d4=[];var _0x5a4695={};return db[_0x7995('0x3e')][_0x7995('0x58')]({'where':{'id':_0x19d746[_0x7995('0x55')]['id']},'include':[{'model':db['SmsApplication'],'as':'Applications'}]})['then'](handleEntityNotFound(_0x570b71,null))[_0x7995('0x23')](function(_0x17f7d6){_0x87a539[_0x7995('0x74')]=_0x17f7d6;_0x87a539[_0x7995('0x75')]=_[_0x7995('0x76')](_0x17f7d6[_0x7995('0x77')],['priority'],[_0x7995('0x78')]);if(_0x87a539['account'][_0x7995('0x77')]){delete _0x87a539[_0x7995('0x74')][_0x7995('0x77')];}return db[_0x7995('0x79')][_0x7995('0x63')]();})[_0x7995('0x23')](function(_0x4f929b){if(!_0x4f929b){throw new db[(_0x7995('0x7a'))][(_0x7995('0x22'))](_0x7995('0x7b'));}_0x2056da=_[_0x7995('0x7c')](_['keys'](_0x4f929b),[_0x7995('0x7d'),'updatedAt']);_0x2a01d4=_[_0x7995('0x7c')](_[_0x7995('0x45')](_0x4f929b),['createdAt','updatedAt',_0x7995('0x7e'),_0x7995('0x7f')]);_0x87a539[_0x7995('0x5a')]={'mapKey':_0x7995('0x80')};if(_0x87a539[_0x7995('0x74')][_0x7995('0x41')]){switch(_0x87a539[_0x7995('0x74')][_0x7995('0x41')]){case _0x7995('0x81'):_0x87a539[_0x7995('0x5a')][_0x7995('0x82')]=_0x19d746[_0x7995('0x5a')]['From'];_0x87a539['body'][_0x7995('0x5a')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x83')];_0x87a539[_0x7995('0x5a')][_0x7995('0x84')]=_0x19d746['body'][_0x7995('0x85')];break;case _0x7995('0x86'):_0x87a539['body'][_0x7995('0x82')]='+'+_0x19d746['body'][_0x7995('0x87')];_0x87a539[_0x7995('0x5a')][_0x7995('0x5a')]=_0x19d746['body'][_0x7995('0x88')];break;case _0x7995('0x89'):_0x87a539[_0x7995('0x5a')][_0x7995('0x82')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x82')];_0x87a539[_0x7995('0x5a')]['body']=_0x19d746['body']['message'];break;case _0x7995('0x8a'):_0x87a539[_0x7995('0x5a')]['from']=_0x19d746['body'][_0x7995('0x82')];_0x87a539[_0x7995('0x5a')]['body']=_0x19d746['body']['body'];_0x87a539['body'][_0x7995('0x84')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x8b')];break;case _0x7995('0x8c'):_0x87a539['body'][_0x7995('0x82')]=_0x19d746[_0x7995('0x5a')]['From'];_0x87a539[_0x7995('0x5a')][_0x7995('0x5a')]=_0x19d746[_0x7995('0x5a')]['Text'];_0x87a539[_0x7995('0x5a')][_0x7995('0x84')]=_0x19d746['body'][_0x7995('0x8d')];break;case _0x7995('0x8e'):_0x87a539[_0x7995('0x5a')][_0x7995('0x82')]='+'+_0x19d746[_0x7995('0x5a')][_0x7995('0x8f')][0x0][_0x7995('0x82')];_0x87a539[_0x7995('0x5a')][_0x7995('0x5a')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x8f')][0x0][_0x7995('0x88')];_0x87a539[_0x7995('0x5a')]['messageId']=_0x19d746[_0x7995('0x5a')][_0x7995('0x8f')][0x0][_0x7995('0x84')];break;case _0x7995('0x90'):_0x87a539['body'][_0x7995('0x82')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x91')];_0x87a539['body'][_0x7995('0x5a')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x92')][_0x7995('0x29')];break;case _0x7995('0x93'):_0x87a539[_0x7995('0x5a')][_0x7995('0x82')]=_0x19d746['body'][_0x7995('0x94')];_0x87a539['body'][_0x7995('0x5a')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x88')];_0x87a539['body'][_0x7995('0x84')]=_0x19d746['body']['replyMessageId'];break;case'intelepeer':_0x87a539['body'][_0x7995('0x82')]=_0x19d746[_0x7995('0x5a')]['from'];_0x87a539[_0x7995('0x5a')][_0x7995('0x5a')]=_0x19d746['body'][_0x7995('0x29')];_0x87a539[_0x7995('0x5a')][_0x7995('0x84')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x95')];break;}}if(_0x87a539['body']['id']){delete _0x87a539[_0x7995('0x5a')]['id'];}if(_[_0x7995('0x96')](_0x87a539[_0x7995('0x5a')][_0x7995('0x82')])){throw new db['Sequelize'][(_0x7995('0x22'))](_0x7995('0x97'));}if(_[_0x7995('0x96')](_0x87a539[_0x7995('0x5a')][_0x7995('0x5a')])||_0x87a539[_0x7995('0x5a')][_0x7995('0x5a')]===''){throw new db[(_0x7995('0x7a'))][(_0x7995('0x22'))](_0x7995('0x98'));}if(_['isNil'](_0x87a539[_0x7995('0x5a')]['mapKey'])){throw new db[(_0x7995('0x7a'))][(_0x7995('0x22'))](_0x7995('0x99')+_0x2a01d4);}if(!_['includes'](_0x2a01d4,_0x87a539['body'][_0x7995('0x9a')])){throw new db[(_0x7995('0x7a'))]['ValidationError'](_0x7995('0x9b')+_0x2a01d4);}_0x5a4695[_0x87a539['body'][_0x7995('0x9a')]]=_0x87a539[_0x7995('0x5a')][_0x7995('0x82')];return db[_0x7995('0x9c')]['find']({'where':{'id':_0x87a539['account'][_0x7995('0x7f')]},'include':[{'model':db[_0x7995('0x79')],'as':_0x7995('0x9d'),'where':_0x5a4695,'limit':0x1,'order':[[_0x7995('0x9e'),'DESC']]}]});})[_0x7995('0x23')](handleEntityNotFound(_0x570b71,null))[_0x7995('0x23')](function(_0x8b820b){if(_0x8b820b){_0x87a539[_0x7995('0x9f')]=_[_0x7995('0xa0')](_0x8b820b,['Contacts']);if(_0x8b820b['Contacts']['length']){return _0x8b820b[_0x7995('0x9d')][0x0];}var _0x24a3cf=_['defaults'](_0x87a539[_0x7995('0x5a')],{'firstName':_0x87a539['body'][_0x7995('0x82')],'ListId':_0x8b820b['id']});_0x24a3cf[_0x87a539[_0x7995('0x5a')][_0x7995('0x9a')]]=_0x87a539[_0x7995('0x5a')]['from'];return db[_0x7995('0x79')][_0x7995('0x59')](_0x24a3cf,{'fields':_0x2056da,'raw':!![]});}})[_0x7995('0x23')](handleEntityNotFound(_0x570b71,null))[_0x7995('0x23')](function(_0x2023a7){if(_0x2023a7){_0x87a539[_0x7995('0xa1')]=_0x2023a7;var _0x1d200d={'ContactId':_0x2023a7['id'],'phone':_0x87a539[_0x7995('0x5a')][_0x7995('0x82')],'SmsAccountId':_0x19d746[_0x7995('0x55')]['id']};var _0x30893a={'ContactId':_0x2023a7['id'],'SmsAccountId':_0x19d746[_0x7995('0x55')]['id'],'closed':![]};return db[_0x7995('0xa2')][_0x7995('0x58')]({'where':_0x30893a})['then'](function(_0x764245){if(_0x764245){return[_0x764245,![]];}return db['SmsInteraction'][_0x7995('0x59')](_0x1d200d)[_0x7995('0x23')](function(_0x5cf7b2){return[_0x5cf7b2,!![]];});});}})[_0x7995('0xa3')](function(_0x55dc6c,_0x17c3f9){_0x87a539[_0x7995('0xa4')]=_0x55dc6c['get']({'plain':!![]});_0x87a539['interaction']['created']=![];if(_0x17c3f9){if(_0x87a539[_0x7995('0x74')][_0x7995('0xa5')]){_0x87a539[_0x7995('0x75')][_0x7995('0xa6')]({'id':0x0,'priority':_0x87a539['applications'][_0x7995('0x57')]+0x1,'app':_0x7995('0xa7'),'appdata':_0x7995('0xa8'),'interval':_0x7995('0xa9')});}_0x87a539[_0x7995('0xa4')][_0x7995('0xaa')]=!![];}return db[_0x7995('0xab')][_0x7995('0x59')]({'phone':_0x87a539['body'][_0x7995('0x82')],'messageId':_0x87a539[_0x7995('0x5a')][_0x7995('0x84')],'body':_0x87a539[_0x7995('0x5a')]['body'],'SmsAccountId':_0x19d746[_0x7995('0x55')]['id'],'SmsInteractionId':_0x55dc6c['id'],'direction':'in','ContactId':_0x55dc6c[_0x7995('0xac')],'AttachmentId':_0x87a539[_0x7995('0x5a')][_0x7995('0xad')]});})[_0x7995('0x23')](function(_0x2e7416){_0x87a539['message']=_0x2e7416;if(_0x87a539[_0x7995('0xa4')][_0x7995('0xae')]){return db[_0x7995('0xaf')][_0x7995('0x58')]({'attributes':['id',_0x7995('0x38')],'where':{'id':_0x87a539[_0x7995('0xa4')][_0x7995('0xae')]}})[_0x7995('0x23')](function(_0xf76f46){if(_0xf76f46){_0x87a539[_0x7995('0x75')][_0x7995('0xb0')]({'id':0x0,'priority':0x0,'app':_0x7995('0xb1'),'appdata':_0xf76f46[_0x7995('0x38')]+','+(_0x87a539[_0x7995('0x74')][_0x7995('0xb2')]||0xa),'interval':_0x7995('0xa9')});}return respondWithRpcPromise(_0x7995('0xb3'),_0x7995('0xb4'),_0x87a539);});}return respondWithRpcPromise(_0x7995('0xb3'),_0x7995('0xb4'),_0x87a539);})[_0x7995('0x23')](function(_0x51f854){if(_0x51f854){var _0x4cf7f1=0xc8;var _0x1a980b=_0x7995('0xb5');logger['info'](_0x7995('0x26'),_0x1a980b,_0x4cf7f1,'entity\x20found');logger[_0x7995('0xb6')]('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x1a980b,_0x4cf7f1,_0x7995('0xb7'),JSON[_0x7995('0xb8')](_0x51f854));if(_0x87a539[_0x7995('0x74')][_0x7995('0x41')]===_0x7995('0x81')){return _0x570b71[_0x7995('0x2d')](_0x4cf7f1)[_0x7995('0x32')](_0x7995('0xb9'),_0x7995('0xba'))[_0x7995('0x39')]('\x0a');}else{return _0x570b71[_0x7995('0x2d')](_0x4cf7f1)[_0x7995('0x2f')](_0x51f854);}}})[_0x7995('0x2b')](handleError(_0x570b71,null));};exports[_0x7995('0xbb')]=function(_0x54b803,_0x408c22,_0x1d2afe){return db[_0x7995('0x3e')][_0x7995('0x68')]({'where':{'id':_0x54b803['params']['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x408c22,null))[_0x7995('0x23')](function(_0x31d0e9){if(_0x31d0e9){return db[_0x7995('0xbc')][_0x7995('0xbd')](function(_0x13dda4){return db[_0x7995('0xbe')][_0x7995('0x35')]({'where':{'SmsAccountId':_0x54b803[_0x7995('0x55')]['id']},'transaction':_0x13dda4})['then'](function(_0x3c81cc){var _0x5f5496=_[_0x7995('0x3d')](_0x54b803[_0x7995('0x5a')],function(_0x35b217){_0x35b217[_0x7995('0x65')]=_0x54b803['params']['id'];return _0x35b217;});return db[_0x7995('0xbe')][_0x7995('0xbf')](_0x5f5496,{'transaction':_0x13dda4});});})[_0x7995('0x23')](function(){return db[_0x7995('0xbe')][_0x7995('0xc0')]({'where':{'SmsAccountId':_0x54b803[_0x7995('0x55')]['id']},'order':_0x7995('0xc1')});});}})[_0x7995('0x23')](respondWithResult(_0x408c22,null))[_0x7995('0x2b')](handleError(_0x408c22,null));};exports[_0x7995('0xc2')]=function(_0x45f389,_0x44d6a8,_0x7d14e2){var _0x405711={};var _0x54e341={};var _0x5cb30e;var _0xdfc11d;return db[_0x7995('0x3e')][_0x7995('0x68')]({'where':{'id':_0x45f389['params']['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x44d6a8,null))[_0x7995('0x23')](function(_0x610b81){if(_0x610b81){_0x5cb30e=_0x610b81;_0x54e341['model']=_[_0x7995('0x45')](db[_0x7995('0xbe')][_0x7995('0x3f')]);_0x54e341[_0x7995('0x44')]=_[_0x7995('0x45')](_0x45f389[_0x7995('0x44')]);_0x54e341[_0x7995('0x4c')]=_[_0x7995('0x46')](_0x54e341[_0x7995('0x43')],_0x54e341[_0x7995('0x44')]);_0x405711[_0x7995('0x47')]=_['intersection'](_0x54e341['model'],qs[_0x7995('0x56')](_0x45f389['query'][_0x7995('0x56')]));_0x405711[_0x7995('0x47')]=_0x405711[_0x7995('0x47')][_0x7995('0x57')]?_0x405711[_0x7995('0x47')]:_0x54e341['model'];_0x405711['order']=qs[_0x7995('0x6a')](_0x45f389[_0x7995('0x44')][_0x7995('0x6a')]);_0x405711[_0x7995('0x4b')]=qs[_0x7995('0x4c')](_[_0x7995('0x6b')](_0x45f389[_0x7995('0x44')],_0x54e341[_0x7995('0x4c')]));if(_0x45f389[_0x7995('0x44')][_0x7995('0x4d')]){_0x405711['where']=_[_0x7995('0x4e')](_0x405711[_0x7995('0x4b')],{'$or':_[_0x7995('0x3d')](_0x405711[_0x7995('0x47')],function(_0x511cf8){var _0x4d6da0={};_0x4d6da0[_0x511cf8]={'$like':'%'+_0x45f389['query']['filter']+'%'};return _0x4d6da0;})});}_0x405711=_['merge']({},_0x405711,_0x45f389[_0x7995('0x50')]);return _0x5cb30e['getApplications'](_0x405711);}})['then'](function(_0x32f19d){if(_0x32f19d){_0xdfc11d=_0x32f19d[_0x7995('0x57')];if(!_0x45f389[_0x7995('0x44')]['hasOwnProperty'](_0x7995('0x69'))){_0x405711['limit']=qs[_0x7995('0x49')](_0x45f389[_0x7995('0x44')][_0x7995('0x49')]);_0x405711['offset']=qs[_0x7995('0x31')](_0x45f389[_0x7995('0x44')][_0x7995('0x31')]);}return _0x5cb30e['getApplications'](_0x405711);}})[_0x7995('0x23')](function(_0x15cfd3){if(_0x15cfd3){return _0x15cfd3?{'count':_0xdfc11d,'rows':_0x15cfd3}:null;}})[_0x7995('0x23')](respondWithResult(_0x44d6a8,null))[_0x7995('0x2b')](handleError(_0x44d6a8,null));};exports[_0x7995('0xc3')]=function(_0x574e2a,_0x1761e1,_0x2a4991){var _0xc8bbb4={'raw':![],'where':{}};var _0x484b6c={};var _0x20852c={'count':0x0,'rows':[]};return db[_0x7995('0x3e')][_0x7995('0x68')]({'where':{'id':_0x574e2a[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x1761e1,null))['then'](function(_0x2995a3){if(_0x2995a3){_0x484b6c[_0x7995('0x43')]=_[_0x7995('0x45')](db[_0x7995('0xa2')][_0x7995('0x3f')]);_0x484b6c[_0x7995('0x44')]=_[_0x7995('0x45')](_0x574e2a['query']);_0x484b6c['filters']=_[_0x7995('0x46')](_0x484b6c[_0x7995('0x43')],_0x484b6c['query']);_0xc8bbb4['attributes']=_[_0x7995('0x46')](_0x484b6c[_0x7995('0x43')],qs[_0x7995('0x56')](_0x574e2a[_0x7995('0x44')][_0x7995('0x56')]));_0xc8bbb4[_0x7995('0x47')]=_0xc8bbb4[_0x7995('0x47')]['length']?_0xc8bbb4[_0x7995('0x47')]:_0x484b6c[_0x7995('0x43')];if(!_0x574e2a[_0x7995('0x44')][_0x7995('0x48')](_0x7995('0x69'))){_0xc8bbb4[_0x7995('0x49')]=qs['limit'](_0x574e2a[_0x7995('0x44')][_0x7995('0x49')]);_0xc8bbb4[_0x7995('0x31')]=qs[_0x7995('0x31')](_0x574e2a[_0x7995('0x44')][_0x7995('0x31')]);}_0xc8bbb4[_0x7995('0x4a')]=qs['sort'](_0x574e2a[_0x7995('0x44')][_0x7995('0x6a')]);_0xc8bbb4[_0x7995('0x4b')]=qs[_0x7995('0x4c')](_['pick'](_0x574e2a[_0x7995('0x44')],_0x484b6c['filters']));_0xc8bbb4[_0x7995('0x4b')][_0x7995('0x65')]=_0x2995a3['id'];if(_0x574e2a['query']['filter']){_0xc8bbb4['where']=_[_0x7995('0x4e')](_0xc8bbb4[_0x7995('0x4b')],{'$or':_[_0x7995('0x3d')](_0xc8bbb4[_0x7995('0x47')],function(_0x503b32){var _0x2da21e={};_0x2da21e[_0x503b32]={'$like':'%'+_0x574e2a[_0x7995('0x44')][_0x7995('0x4d')]+'%'};return _0x2da21e;})});}_0xc8bbb4=_[_0x7995('0x4e')]({},_0xc8bbb4,_0x574e2a[_0x7995('0x50')]);return db[_0x7995('0xa2')][_0x7995('0x30')]({'where':_0xc8bbb4['where']})['then'](function(_0x2695eb){_0x20852c['count']=_0x2695eb;if(_0x574e2a['query'][_0x7995('0x51')]){_0xc8bbb4[_0x7995('0x52')]=[{'model':db[_0x7995('0x79')],'as':_0x7995('0xc4'),'required':![]},{'model':db[_0x7995('0xaf')],'as':_0x7995('0xc5'),'attributes':[_0x7995('0x38'),_0x7995('0xc6'),_0x7995('0xc7')],'required':![]},{'model':db[_0x7995('0xc8')],'as':_0x7995('0xc9'),'attributes':['id',_0x7995('0x38'),'color'],'where':_0x574e2a[_0x7995('0x44')][_0x7995('0xca')]?{'id':_0x574e2a[_0x7995('0x44')][_0x7995('0xca')]}:undefined,'required':_0x574e2a[_0x7995('0x44')][_0x7995('0xca')]?!![]:![]}];}return db[_0x7995('0xa2')]['findAll'](_0xc8bbb4);})[_0x7995('0x23')](function(_0x234832){_0x20852c[_0x7995('0x6c')]=_0x234832;return _0x20852c;});}})[_0x7995('0x23')](respondWithFilteredResult(_0x1761e1,_0xc8bbb4))[_0x7995('0x2b')](handleError(_0x1761e1,null));};exports['send']=function(_0x2d1c14,_0x5e7fde,_0x156b65){var _0x12f4c5,_0x221be8,_0x5150aa;if(_[_0x7995('0x96')](_0x2d1c14[_0x7995('0x5a')][_0x7995('0x5a')])||_0x2d1c14[_0x7995('0x5a')][_0x7995('0x5a')]===''){throw new db[(_0x7995('0x7a'))][(_0x7995('0x22'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x2d1c14[_0x7995('0x5a')]['to'])){throw new db[(_0x7995('0x7a'))][(_0x7995('0x22'))](_0x7995('0xcb'));}_0x12f4c5=_0x2d1c14[_0x7995('0x5a')]['to'];return db[_0x7995('0x3e')]['find']({'where':{'id':_0x2d1c14[_0x7995('0x55')]['id']},'include':[{'model':db[_0x7995('0x9c')],'as':_0x7995('0xcc'),'include':[{'model':db[_0x7995('0x79')],'as':'Contacts','where':{'mobile':_0x12f4c5},'limit':0x1,'order':[['updatedAt',_0x7995('0xcd')]]}]}]})[_0x7995('0x23')](handleEntityNotFound(_0x5e7fde,null))['then'](function(_0x3130f2){if(_0x3130f2&&_0x3130f2[_0x7995('0xcc')]){_0x221be8=_0x3130f2['get']({'plain':!![]});if(_0x221be8[_0x7995('0xcc')]&&_0x221be8[_0x7995('0xcc')][_0x7995('0x9d')][_0x7995('0x57')]){return _0x221be8[_0x7995('0xcc')]['Contacts'][0x0];}return db['CmContact'][_0x7995('0x59')](_[_0x7995('0x1b')](_0x2d1c14[_0x7995('0x5a')],{'firstName':_0x12f4c5,'mobile':_0x12f4c5,'phone':_0x12f4c5,'ListId':_0x221be8[_0x7995('0x7f')]}));}})[_0x7995('0x23')](handleEntityNotFound(_0x5e7fde,null))['then'](function(_0xd0da6e){if(_0xd0da6e){_0x5150aa=_0xd0da6e;return db[_0x7995('0xa2')][_0x7995('0x58')]({'where':{'ContactId':_0x5150aa['id'],'closed':![],'SmsAccountId':_0x221be8['id']}})[_0x7995('0x23')](function(_0x1949f5){if(_0x1949f5){return[_0x1949f5,![]];}return db['SmsInteraction']['create']({'UserId':_0x2d1c14['user']['id'],'ContactId':_0x5150aa['id'],'SmsAccountId':_0x221be8['id'],'phone':_0x12f4c5,'firstMsgDirection':'out','Messages':[_[_0x7995('0x4e')](_0x2d1c14[_0x7995('0x5a')],{'read':![],'body':_0x2d1c14['body'][_0x7995('0x5a')],'phone':_0x12f4c5,'SmsAccountId':_0x221be8['id'],'UserId':_0x2d1c14[_0x7995('0x5b')]['id'],'ContactId':_0x5150aa['id']})]},{'include':[{'model':db['SmsMessage'],'as':'Messages'}]})[_0x7995('0x23')](function(_0x3ee80c){return[_0x3ee80c,!![]];});});}})[_0x7995('0xa3')](function(_0x8bd55,_0x20a056){if(_0x20a056){return _0x8bd55;}return db[_0x7995('0xab')][_0x7995('0x59')](_['merge'](_0x2d1c14['body'],{'read':![],'body':_0x2d1c14[_0x7995('0x5a')][_0x7995('0x5a')],'phone':_0x12f4c5,'SmsAccountId':_0x221be8['id'],'SmsInteractionId':_0x8bd55['id'],'UserId':_0x2d1c14[_0x7995('0x5b')]['id'],'ContactId':_0x5150aa['id']}))['then'](function(_0x2f96fd){_0x8bd55[_0x7995('0xce')][_0x7995('0xcf')]=[];_0x8bd55[_0x7995('0xce')][_0x7995('0xcf')][_0x7995('0xa6')](_0x2f96fd[_0x7995('0xce')]);return _0x8bd55;});})[_0x7995('0x23')](respondWithResult(_0x5e7fde,null))[_0x7995('0x2b')](handleError(_0x5e7fde,null));};exports['status']=function(_0x5136f5,_0x1161f2,_0x4bd222){if(_0x5136f5[_0x7995('0x5a')]['id']){delete _0x5136f5['body']['id'];}console[_0x7995('0xd0')](_0x7995('0xd1'),_0x5136f5[_0x7995('0x5a')]);var _0x4a75d2,_0x4c810d,_0x1401b4;return db[_0x7995('0x3e')][_0x7995('0x58')]({'where':{'id':_0x5136f5[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x1161f2,null))[_0x7995('0x23')](function(_0xb0164a){if(_0xb0164a){_0x1401b4=_0xb0164a;logger[_0x7995('0xb6')](_0x7995('0x26'),_0x7995('0x2d'),_0x7995('0xd2'),_0xb0164a['type'],util[_0x7995('0xd3')](_0x5136f5[_0x7995('0x5a')],{'showHidden':![],'depth':null}));switch(_0xb0164a[_0x7995('0x41')]){case _0x7995('0x86'):if(_0x5136f5[_0x7995('0x5a')]['skebby_dispatch_id']&&_0x5136f5[_0x7995('0x5a')][_0x7995('0x2d')]){_0x4c810d=_0x5136f5[_0x7995('0x5a')][_0x7995('0x2d')];return db[_0x7995('0xab')][_0x7995('0x58')]({'where':{'messageId':_0x5136f5[_0x7995('0x5a')][_0x7995('0xd4')]}});}break;case _0x7995('0x89'):if(_0x5136f5['body']['requestid']&&_0x5136f5[_0x7995('0x5a')][_0x7995('0xd5')]){_0x4c810d=_0x5136f5[_0x7995('0x5a')][_0x7995('0xd5')];return db[_0x7995('0xab')]['find']({'where':{'messageId':_0x5136f5[_0x7995('0x5a')][_0x7995('0xd6')]}});}break;case _0x7995('0x8a'):if(_0x5136f5[_0x7995('0x5a')][_0x7995('0x8b')]&&_0x5136f5[_0x7995('0x5a')][_0x7995('0xd7')]){_0x4c810d=_0x5136f5[_0x7995('0x5a')][_0x7995('0xd7')];return db['SmsMessage']['find']({'where':{'messageId':_0x5136f5[_0x7995('0x5a')][_0x7995('0x8b')]}});}break;case _0x7995('0x8e'):var _0x296643=_0x5136f5[_0x7995('0x5a')][_0x7995('0x8f')][0x0];if(_0x296643[_0x7995('0x84')]&&_0x296643[_0x7995('0x2d')]['groupName']==='DELIVERED'){_0x4c810d=_0x296643[_0x7995('0x2d')][_0x7995('0xd8')];return db[_0x7995('0xab')][_0x7995('0x58')]({'where':{'messageId':_0x296643['messageId']}});}break;case'clickatell':if(_0x5136f5[_0x7995('0x5a')][_0x7995('0x84')]&&_0x5136f5[_0x7995('0x5a')][_0x7995('0x2d')]){_0x4c810d=_0x5136f5[_0x7995('0x5a')][_0x7995('0x2d')];return db[_0x7995('0xab')][_0x7995('0x58')]({'where':{'messageId':_0x5136f5[_0x7995('0x5a')][_0x7995('0x84')]}});}break;case _0x7995('0xd9'):if(_0x5136f5[_0x7995('0x5a')]['redif']&&_0x5136f5['body'][_0x7995('0x2d')]){_0x4c810d=_0x5136f5[_0x7995('0x5a')][_0x7995('0x2d')];return db[_0x7995('0xab')]['find']({'where':{'messageId':_0x5136f5[_0x7995('0x5a')]['redif']}});}break;}}})[_0x7995('0x23')](handleEntityNotFound(_0x1161f2,null))[_0x7995('0x23')](function(_0x308d0e){if(_0x308d0e){_0x4a75d2=_0x308d0e;switch(_0x1401b4[_0x7995('0x41')]){case _0x7995('0x86'):if(_0x4c810d===_0x7995('0xda')){return _0x4a75d2['update']({'read':!![]});}else{logger[_0x7995('0x27')](_0x7995('0x26'),_0x7995('0x2d'),_0x7995('0x86'),util['inspect'](_0x5136f5['body'],{'showHidden':![],'depth':null}));}break;case _0x7995('0x89'):if(_0x4c810d==='1'){return _0x4a75d2[_0x7995('0x62')]({'read':!![]});}else{logger[_0x7995('0x27')](_0x7995('0x26'),'status',_0x7995('0x86'),util[_0x7995('0xd3')](_0x5136f5[_0x7995('0x5a')],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x5136f5[_0x7995('0x5a')][_0x7995('0xdb')]&&_0x4c810d>=0xc8&&_0x4c810d<=0xce){return _0x4a75d2[_0x7995('0x62')]({'read':!![]});}else{logger['error'](_0x7995('0x26'),_0x7995('0x2d'),_0x7995('0x8a'),util[_0x7995('0xd3')](_0x5136f5[_0x7995('0x5a')],{'showHidden':![],'depth':null}));}break;case _0x7995('0x8e'):var _0x1f6c3e=_0x5136f5[_0x7995('0x5a')][_0x7995('0x8f')][0x0];if(_0x1f6c3e['status'][_0x7995('0xd8')]===_0x7995('0xda')){return _0x4a75d2[_0x7995('0x62')]({'read':!![]});}else{logger[_0x7995('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x7995('0x2d'),_0x7995('0x8e'),util[_0x7995('0xd3')](_0x5136f5[_0x7995('0x5a')],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x4c810d==_0x7995('0xdc')||_0x4c810d==_0x7995('0xdd')){return _0x4a75d2[_0x7995('0x62')]({'read':!![]});}else{logger[_0x7995('0x27')](_0x7995('0x26'),_0x7995('0x2d'),_0x7995('0x93'),util['inspect'](_0x5136f5[_0x7995('0x5a')],{'showHidden':![],'depth':null}));}break;case _0x7995('0xd9'):if(_0x4c810d===_0x7995('0xde')||_0x4c810d===_0x7995('0xdf')){return _0x4a75d2[_0x7995('0x62')]({'read':!![]});}else{logger['error'](_0x7995('0x26'),'status',_0x7995('0xd9'),util[_0x7995('0xd3')](_0x5136f5[_0x7995('0x5a')],{'showHidden':![],'depth':null}));}break;}return _0x4a75d2;}})['then'](respondWithResult(_0x1161f2,null))['catch'](handleError(_0x1161f2,null));};exports['statusGet']=function(_0x21ff84,_0x1763aa,_0x32e443){var _0x35b6f9,_0x17fab0,_0x4da0e8;return db['SmsAccount'][_0x7995('0x58')]({'where':{'id':_0x21ff84[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x1763aa,null))[_0x7995('0x23')](function(_0x5bc1b4){if(_0x5bc1b4){_0x4da0e8=_0x5bc1b4;logger[_0x7995('0xb6')](_0x7995('0x26'),'status',_0x7995('0xd2'),_0x5bc1b4['type'],util[_0x7995('0xd3')](_0x21ff84[_0x7995('0x44')],{'showHidden':![],'depth':null}));switch(_0x5bc1b4[_0x7995('0x41')]){case'csc':if(_0x21ff84['query'][_0x7995('0xe0')]&&_0x21ff84[_0x7995('0x44')][_0x7995('0xe1')]){_0x17fab0=_0x21ff84[_0x7995('0x44')][_0x7995('0xe1')];return db[_0x7995('0xab')][_0x7995('0x58')]({'where':{'messageId':_0x21ff84[_0x7995('0x44')][_0x7995('0xe0')]}});}break;}}})[_0x7995('0x23')](handleEntityNotFound(_0x1763aa,null))[_0x7995('0x23')](function(_0x48c9fc){if(_0x48c9fc){_0x35b6f9=_0x48c9fc;switch(_0x4da0e8['type']){case _0x7995('0x90'):if(_0x17fab0==='2'||_0x17fab0==='6'){return _0x35b6f9[_0x7995('0x62')]({'read':!![]});}else{logger[_0x7995('0x27')](_0x7995('0x26'),'status','csc',util[_0x7995('0xd3')](_0x21ff84[_0x7995('0x44')],{'showHidden':![],'depth':null}));};break;}return _0x35b6f9;}})['then'](respondWithResult(_0x1763aa,null))['catch'](handleError(_0x1763aa,null));};exports[_0x7995('0xe2')]=function(_0x469cd6,_0x3ad24,_0x17c27b){return db[_0x7995('0x3e')]['find']({'where':{'id':_0x469cd6[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x3ad24,null))['then'](function(_0xf9859c){if(_0xf9859c){return _0xf9859c[_0x7995('0xe2')](_0x469cd6[_0x7995('0x5a')]['ids'],_[_0x7995('0xa0')](_0x469cd6[_0x7995('0x5a')],[_0x7995('0x71'),'id'])||{})[_0x7995('0xa3')](function(_0x113e03){for(var _0x5348b1=0x0;_0x5348b1<_0x469cd6['body'][_0x7995('0x71')]['length'];_0x5348b1+=0x1){socket[_0x7995('0xe3')]('userSmsAccount:save',{'UserId':_0x469cd6[_0x7995('0x5a')][_0x7995('0x71')][_0x5348b1],'SmsAccountId':_0x469cd6[_0x7995('0x55')]['id']});}return _0x113e03;});}})['then'](respondWithResult(_0x3ad24,null))['catch'](handleError(_0x3ad24,null));};exports['removeAgents']=function(_0x362580,_0x1da57f,_0x270ef3){return db['SmsAccount'][_0x7995('0x58')]({'where':{'id':_0x362580[_0x7995('0x55')]['id']}})['then'](handleEntityNotFound(_0x1da57f,null))[_0x7995('0x23')](function(_0x39449e){if(_0x39449e){return _0x39449e[_0x7995('0xe4')](_0x362580[_0x7995('0x44')][_0x7995('0x71')])['then'](function(){if(_['isArray'](_0x362580[_0x7995('0x44')][_0x7995('0x71')])){for(var _0x134da2=0x0;_0x134da2<_0x362580[_0x7995('0x44')][_0x7995('0x71')][_0x7995('0x57')];_0x134da2+=0x1){socket[_0x7995('0xe3')](_0x7995('0xe5'),{'UserId':Number(_0x362580[_0x7995('0x44')][_0x7995('0x71')][_0x134da2]),'SmsAccountId':Number(_0x362580['params']['id'])});}}else{socket[_0x7995('0xe3')](_0x7995('0xe5'),{'UserId':Number(_0x362580[_0x7995('0x44')][_0x7995('0x71')]),'SmsAccountId':Number(_0x362580[_0x7995('0x55')]['id'])});}});}})[_0x7995('0x23')](respondWithStatusCode(_0x1da57f,null))[_0x7995('0x2b')](handleError(_0x1da57f,null));};exports['getAgents']=function(_0x5d0fe6,_0x43a8a4,_0x2aec8d){var _0x12df49={};var _0x1f4efc={};var _0x55ce63;var _0x572c53;return db['SmsAccount'][_0x7995('0x68')]({'where':{'id':_0x5d0fe6[_0x7995('0x55')]['id']}})['then'](handleEntityNotFound(_0x43a8a4,null))[_0x7995('0x23')](function(_0x2265cf){if(_0x2265cf){_0x55ce63=_0x2265cf;_0x1f4efc[_0x7995('0x43')]=_[_0x7995('0x45')](db[_0x7995('0xaf')][_0x7995('0x3f')]);_0x1f4efc[_0x7995('0x44')]=_[_0x7995('0x45')](_0x5d0fe6['query']);_0x1f4efc[_0x7995('0x4c')]=_[_0x7995('0x46')](_0x1f4efc[_0x7995('0x43')],_0x1f4efc['query']);_0x12df49[_0x7995('0x47')]=_['intersection'](_0x1f4efc['model'],qs['fields'](_0x5d0fe6['query'][_0x7995('0x56')]));_0x12df49['attributes']=_0x12df49[_0x7995('0x47')][_0x7995('0x57')]?_0x12df49['attributes']:_0x1f4efc[_0x7995('0x43')];_0x12df49[_0x7995('0x4a')]=qs[_0x7995('0x6a')](_0x5d0fe6[_0x7995('0x44')]['sort']);_0x12df49[_0x7995('0x4b')]=qs['filters'](_[_0x7995('0x6b')](_0x5d0fe6[_0x7995('0x44')],_0x1f4efc[_0x7995('0x4c')]));if(_0x5d0fe6[_0x7995('0x44')][_0x7995('0x4d')]){_0x12df49[_0x7995('0x4b')]=_[_0x7995('0x4e')](_0x12df49[_0x7995('0x4b')],{'$or':_[_0x7995('0x3d')](_0x12df49[_0x7995('0x47')],function(_0x4aa202){var _0x8c9b6f={};_0x8c9b6f[_0x4aa202]={'$like':'%'+_0x5d0fe6[_0x7995('0x44')]['filter']+'%'};return _0x8c9b6f;})});}_0x12df49=_[_0x7995('0x4e')]({},_0x12df49,_0x5d0fe6[_0x7995('0x50')]);return _0x55ce63[_0x7995('0xe6')](_0x12df49);}})[_0x7995('0x23')](function(_0x1a6f42){if(_0x1a6f42){_0x572c53=_0x1a6f42[_0x7995('0x57')];if(!_0x5d0fe6['query'][_0x7995('0x48')]('nolimit')){_0x12df49[_0x7995('0x49')]=qs[_0x7995('0x49')](_0x5d0fe6[_0x7995('0x44')][_0x7995('0x49')]);_0x12df49[_0x7995('0x31')]=qs[_0x7995('0x31')](_0x5d0fe6['query'][_0x7995('0x31')]);}return _0x55ce63[_0x7995('0xe6')](_0x12df49);}})[_0x7995('0x23')](function(_0x4c2faf){if(_0x4c2faf){return _0x4c2faf?{'count':_0x572c53,'rows':_0x4c2faf}:null;}})[_0x7995('0x23')](respondWithResult(_0x43a8a4,null))[_0x7995('0x2b')](handleError(_0x43a8a4,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 1570172..8164402 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 _0x8873=['update','emit','hasOwnProperty','events','../../mysqldb','setMaxListeners','save'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8873,0xc7));var _0x3887=function(_0x39e283,_0x247e6b){_0x39e283=_0x39e283-0x0;var _0x7de89f=_0x8873[_0x39e283];return _0x7de89f;};'use strict';var EventEmitter=require(_0x3887('0x0'));var SmsAccount=require(_0x3887('0x1'))['db']['SmsAccount'];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x3887('0x2')](0x0);var events={'afterCreate':_0x3887('0x3'),'afterUpdate':_0x3887('0x4'),'afterDestroy':'remove'};function emitEvent(_0x2ba9f5){return function(_0x2b6466,_0x44a285,_0x241de6){SmsAccountEvents['emit'](_0x2ba9f5+':'+_0x2b6466['id'],_0x2b6466);SmsAccountEvents[_0x3887('0x5')](_0x2ba9f5,_0x2b6466);_0x241de6(null);};}for(var e in events){if(events[_0x3887('0x6')](e)){var event=events[e];SmsAccount['hook'](e,emitEvent(event));}}module['exports']=SmsAccountEvents; \ No newline at end of file +var _0x5392=['save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','SmsAccount','setMaxListeners'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x5392,0x75));var _0x2539=function(_0x53a305,_0x18a701){_0x53a305=_0x53a305-0x0;var _0x1f6030=_0x5392[_0x53a305];return _0x1f6030;};'use strict';var EventEmitter=require(_0x2539('0x0'));var SmsAccount=require(_0x2539('0x1'))['db'][_0x2539('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x2539('0x3')](0x0);var events={'afterCreate':_0x2539('0x4'),'afterUpdate':_0x2539('0x5'),'afterDestroy':_0x2539('0x6')};function emitEvent(_0x39fb0f){return function(_0x376f31,_0x5bc175,_0x45fbc7){SmsAccountEvents[_0x2539('0x7')](_0x39fb0f+':'+_0x376f31['id'],_0x376f31);SmsAccountEvents[_0x2539('0x7')](_0x39fb0f,_0x376f31);_0x45fbc7(null);};}for(var e in events){if(events[_0x2539('0x8')](e)){var event=events[e];SmsAccount[_0x2539('0x9')](e,emitEvent(event));}}module[_0x2539('0xa')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index 0107763..9b2cae6 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 _0x03c4=['api','moment','request-promise','path','rimraf','exports','sms_accounts','../../config/logger'];(function(_0x1e231b,_0x3bdc83){var _0x204724=function(_0x4e4d22){while(--_0x4e4d22){_0x1e231b['push'](_0x1e231b['shift']());}};_0x204724(++_0x3bdc83);}(_0x03c4,0x1b7));var _0x403c=function(_0x24804d,_0x496c9d){_0x24804d=_0x24804d-0x0;var _0xde4ca9=_0x03c4[_0x24804d];return _0xde4ca9;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x403c('0x0'))(_0x403c('0x1'));var moment=require(_0x403c('0x2'));var BPromise=require('bluebird');var rp=require(_0x403c('0x3'));var fs=require('fs');var path=require(_0x403c('0x4'));var rimraf=require(_0x403c('0x5'));var config=require('../../config/environment');var attributes=require('./smsAccount.attributes');module[_0x403c('0x6')]=function(_0x8ada7c,_0x14a2a9){return _0x8ada7c['define']('SmsAccount',attributes,{'tableName':_0x403c('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf47a=['lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','SmsAccount','sms_accounts'];(function(_0x450d4e,_0xcacc3){var _0x300304=function(_0x49ab27){while(--_0x49ab27){_0x450d4e['push'](_0x450d4e['shift']());}};_0x300304(++_0xcacc3);}(_0xf47a,0xfa));var _0xaf47=function(_0x363da2,_0x38bb35){_0x363da2=_0x363da2-0x0;var _0x30da96=_0xf47a[_0x363da2];return _0x30da96;};'use strict';var _=require(_0xaf47('0x0'));var util=require(_0xaf47('0x1'));var logger=require(_0xaf47('0x2'))(_0xaf47('0x3'));var moment=require('moment');var BPromise=require(_0xaf47('0x4'));var rp=require(_0xaf47('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xaf47('0x6'));var config=require(_0xaf47('0x7'));var attributes=require('./smsAccount.attributes');module['exports']=function(_0x32fcb2,_0x44bc96){return _0x32fcb2['define'](_0xaf47('0x8'),attributes,{'tableName':_0xaf47('0x9'),'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 2f4b9c0..3a6ee6d 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 _0x20f7=['message','catch','ShowSmsAccount','SmsAccount','find','options','include','map','model','attributes','then','stringify','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','defaults','redis','register','info','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','error','code','SmsAccount,\x20%s,\x20%s'];(function(_0xbfa4ea,_0x1fd2af){var _0x36e21e=function(_0x885712){while(--_0x885712){_0xbfa4ea['push'](_0xbfa4ea['shift']());}};_0x36e21e(++_0x1fd2af);}(_0x20f7,0x177));var _0x720f=function(_0xe73228,_0x226565){_0xe73228=_0xe73228-0x0;var _0x3288ea=_0x20f7[_0xe73228];return _0x3288ea;};'use strict';var _=require(_0x720f('0x0'));var util=require(_0x720f('0x1'));var moment=require(_0x720f('0x2'));var BPromise=require(_0x720f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x720f('0x4'));var db=require(_0x720f('0x5'))['db'];var utils=require(_0x720f('0x6'));var logger=require('../../config/logger')(_0x720f('0x7'));var config=require(_0x720f('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x720f('0x9')][_0x720f('0xa')]({'port':0x232a});config['redis']=_[_0x720f('0xb')](config[_0x720f('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x720f('0xc')]));require('./smsAccount.socket')[_0x720f('0xd')](socket);function respondWithRpcPromise(_0xc98cc,_0x56b904,_0x2a5ade){return new BPromise(function(_0x5882dc,_0x324450){return client['request'](_0xc98cc,_0x2a5ade)['then'](function(_0xdc783c){logger[_0x720f('0xe')]('SmsAccount,\x20%s,\x20%s',_0x56b904,_0x720f('0xf'));logger[_0x720f('0x10')](_0x720f('0x11'),_0x56b904,_0x720f('0xf'),JSON['stringify'](_0xdc783c));if(_0xdc783c[_0x720f('0x12')]){if(_0xdc783c[_0x720f('0x12')][_0x720f('0x13')]===0x1f4){logger[_0x720f('0x12')](_0x720f('0x14'),_0x56b904,_0xdc783c[_0x720f('0x12')][_0x720f('0x15')]);return _0x324450(_0xdc783c[_0x720f('0x12')]['message']);}logger['error'](_0x720f('0x14'),_0x56b904,_0xdc783c[_0x720f('0x12')][_0x720f('0x15')]);return _0x5882dc(_0xdc783c[_0x720f('0x12')][_0x720f('0x15')]);}else{logger[_0x720f('0xe')](_0x720f('0x14'),_0x56b904,_0x720f('0xf'));_0x5882dc(_0xdc783c['result'][_0x720f('0x15')]);}})[_0x720f('0x16')](function(_0x141da3){logger['error'](_0x720f('0x14'),_0x56b904,_0x141da3);_0x324450(_0x141da3);});});}exports[_0x720f('0x17')]=function(_0x25b6bc){var _0x334bc2=this;return new Promise(function(_0x178e49,_0x1ce216){return db[_0x720f('0x18')][_0x720f('0x19')]({'raw':_0x25b6bc[_0x720f('0x1a')]?_0x25b6bc['options']['raw']===undefined?!![]:![]:!![],'where':_0x25b6bc[_0x720f('0x1a')]?_0x25b6bc[_0x720f('0x1a')]['where']||null:null,'attributes':_0x25b6bc[_0x720f('0x1a')]?_0x25b6bc[_0x720f('0x1a')]['attributes']||null:null,'include':_0x25b6bc[_0x720f('0x1a')]?_0x25b6bc[_0x720f('0x1a')][_0x720f('0x1b')]?_[_0x720f('0x1c')](_0x25b6bc[_0x720f('0x1a')][_0x720f('0x1b')],function(_0x555795){return{'model':db[_0x555795[_0x720f('0x1d')]],'as':_0x555795['as'],'attributes':_0x555795[_0x720f('0x1e')],'include':_0x555795[_0x720f('0x1b')]?_[_0x720f('0x1c')](_0x555795[_0x720f('0x1b')],function(_0x463e3e){return{'model':db[_0x463e3e[_0x720f('0x1d')]],'as':_0x463e3e['as'],'attributes':_0x463e3e['attributes'],'include':_0x463e3e[_0x720f('0x1b')]?_[_0x720f('0x1c')](_0x463e3e['include'],function(_0xc3afe2){return{'model':db[_0xc3afe2['model']],'as':_0xc3afe2['as'],'attributes':_0xc3afe2[_0x720f('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x720f('0x1f')](function(_0x5dc10d){logger[_0x720f('0xe')](_0x720f('0x17'),_0x25b6bc);logger[_0x720f('0x10')]('ShowSmsAccount',_0x25b6bc,JSON[_0x720f('0x20')](_0x5dc10d));_0x178e49(_0x5dc10d);})['catch'](function(_0x2af552){logger[_0x720f('0x12')](_0x720f('0x17'),_0x2af552[_0x720f('0x15')],_0x25b6bc);_0x1ce216(_0x334bc2[_0x720f('0x12')](0x1f4,_0x2af552['message']));});});}; \ No newline at end of file +var _0x257b=['jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','ShowSmsAccount','SmsAccount','find','options','raw','where','attributes','include','model','map','stringify','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x257b,0x175));var _0xb257=function(_0x40913a,_0x4276d7){_0x40913a=_0x40913a-0x0;var _0x46b62b=_0x257b[_0x40913a];return _0x46b62b;};'use strict';var _=require('lodash');var util=require(_0xb257('0x0'));var moment=require(_0xb257('0x1'));var BPromise=require(_0xb257('0x2'));var rs=require(_0xb257('0x3'));var fs=require('fs');var Redis=require(_0xb257('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb257('0x5'));var logger=require('../../config/logger')(_0xb257('0x6'));var config=require('../../config/environment');var jayson=require(_0xb257('0x7'));var client=jayson[_0xb257('0x8')][_0xb257('0x9')]({'port':0x232a});config[_0xb257('0xa')]=_[_0xb257('0xb')](config[_0xb257('0xa')],{'host':_0xb257('0xc'),'port':0x18eb});var socket=require(_0xb257('0xd'))(new Redis(config[_0xb257('0xa')]));require(_0xb257('0xe'))[_0xb257('0xf')](socket);function respondWithRpcPromise(_0x1c70a8,_0x4459d3,_0xc9f678){return new BPromise(function(_0x213b33,_0x15e80e){return client[_0xb257('0x10')](_0x1c70a8,_0xc9f678)[_0xb257('0x11')](function(_0x104f0d){logger[_0xb257('0x12')](_0xb257('0x13'),_0x4459d3,_0xb257('0x14'));logger['debug'](_0xb257('0x15'),_0x4459d3,_0xb257('0x14'),JSON['stringify'](_0x104f0d));if(_0x104f0d[_0xb257('0x16')]){if(_0x104f0d[_0xb257('0x16')][_0xb257('0x17')]===0x1f4){logger[_0xb257('0x16')](_0xb257('0x13'),_0x4459d3,_0x104f0d[_0xb257('0x16')][_0xb257('0x18')]);return _0x15e80e(_0x104f0d['error'][_0xb257('0x18')]);}logger[_0xb257('0x16')](_0xb257('0x13'),_0x4459d3,_0x104f0d[_0xb257('0x16')]['message']);return _0x213b33(_0x104f0d[_0xb257('0x16')][_0xb257('0x18')]);}else{logger['info'](_0xb257('0x13'),_0x4459d3,_0xb257('0x14'));_0x213b33(_0x104f0d[_0xb257('0x19')][_0xb257('0x18')]);}})[_0xb257('0x1a')](function(_0x262de1){logger[_0xb257('0x16')](_0xb257('0x13'),_0x4459d3,_0x262de1);_0x15e80e(_0x262de1);});});}exports[_0xb257('0x1b')]=function(_0x3b3505){var _0x312826=this;return new Promise(function(_0x7c2471,_0x524af9){return db[_0xb257('0x1c')][_0xb257('0x1d')]({'raw':_0x3b3505[_0xb257('0x1e')]?_0x3b3505[_0xb257('0x1e')][_0xb257('0x1f')]===undefined?!![]:![]:!![],'where':_0x3b3505[_0xb257('0x1e')]?_0x3b3505[_0xb257('0x1e')][_0xb257('0x20')]||null:null,'attributes':_0x3b3505[_0xb257('0x1e')]?_0x3b3505[_0xb257('0x1e')][_0xb257('0x21')]||null:null,'include':_0x3b3505[_0xb257('0x1e')]?_0x3b3505['options'][_0xb257('0x22')]?_['map'](_0x3b3505[_0xb257('0x1e')][_0xb257('0x22')],function(_0x396af8){return{'model':db[_0x396af8[_0xb257('0x23')]],'as':_0x396af8['as'],'attributes':_0x396af8[_0xb257('0x21')],'include':_0x396af8[_0xb257('0x22')]?_[_0xb257('0x24')](_0x396af8['include'],function(_0x13e288){return{'model':db[_0x13e288[_0xb257('0x23')]],'as':_0x13e288['as'],'attributes':_0x13e288['attributes'],'include':_0x13e288[_0xb257('0x22')]?_['map'](_0x13e288[_0xb257('0x22')],function(_0x20c80c){return{'model':db[_0x20c80c[_0xb257('0x23')]],'as':_0x20c80c['as'],'attributes':_0x20c80c[_0xb257('0x21')]};}):[]};}):[]};}):[]:[]})[_0xb257('0x11')](function(_0x1fe05e){logger['info'](_0xb257('0x1b'),_0x3b3505);logger['debug'](_0xb257('0x1b'),_0x3b3505,JSON[_0xb257('0x25')](_0x1fe05e));_0x7c2471(_0x1fe05e);})['catch'](function(_0x315c39){logger['error'](_0xb257('0x1b'),_0x315c39['message'],_0x3b3505);_0x524af9(_0x312826[_0xb257('0x16')](0x1f4,_0x315c39[_0xb257('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 4f098fb..2c0d0d6 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 _0xc1a5=['register','length','./smsAccount.events','save','remove','update','emit','removeListener'];(function(_0xcd5a3d,_0x3c5b33){var _0xd43207=function(_0x17d976){while(--_0x17d976){_0xcd5a3d['push'](_0xcd5a3d['shift']());}};_0xd43207(++_0x3c5b33);}(_0xc1a5,0x132));var _0x5c1a=function(_0x31c910,_0x18554){_0x31c910=_0x31c910-0x0;var _0x7d9a41=_0xc1a5[_0x31c910];return _0x7d9a41;};'use strict';var SmsAccountEvents=require(_0x5c1a('0x0'));var events=[_0x5c1a('0x1'),_0x5c1a('0x2'),_0x5c1a('0x3')];function createListener(_0x26c05d,_0x2444b8){return function(_0x2da0ad){_0x2444b8[_0x5c1a('0x4')](_0x26c05d,_0x2da0ad);};}function removeListener(_0x351fb4,_0x2dbc91){return function(){SmsAccountEvents[_0x5c1a('0x5')](_0x351fb4,_0x2dbc91);};}exports[_0x5c1a('0x6')]=function(_0x32ce42){for(var _0x3e3f86=0x0,_0x297bfc=events[_0x5c1a('0x7')];_0x3e3f86<_0x297bfc;_0x3e3f86++){var _0xf04148=events[_0x3e3f86];var _0x526e89=createListener('smsAccount:'+_0xf04148,_0x32ce42);SmsAccountEvents['on'](_0xf04148,_0x526e89);}}; \ No newline at end of file +var _0x5522=['removeListener','register','length','smsAccount:','./smsAccount.events','save','remove','update','emit'];(function(_0x4fce5d,_0x59c7c5){var _0x1166f7=function(_0x142895){while(--_0x142895){_0x4fce5d['push'](_0x4fce5d['shift']());}};_0x1166f7(++_0x59c7c5);}(_0x5522,0x1bd));var _0x2552=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x5522[_0x14add3];return _0x4a174f;};'use strict';var SmsAccountEvents=require(_0x2552('0x0'));var events=[_0x2552('0x1'),_0x2552('0x2'),_0x2552('0x3')];function createListener(_0x19a079,_0x55044d){return function(_0x45a17a){_0x55044d[_0x2552('0x4')](_0x19a079,_0x45a17a);};}function removeListener(_0x133ba6,_0x5f3396){return function(){SmsAccountEvents[_0x2552('0x5')](_0x133ba6,_0x5f3396);};}exports[_0x2552('0x6')]=function(_0x53db98){for(var _0x45dbe9=0x0,_0x1b8d88=events[_0x2552('0x7')];_0x45dbe9<_0x1b8d88;_0x45dbe9++){var _0xdba28f=events[_0x45dbe9];var _0x8357e1=createListener(_0x2552('0x8')+_0xdba28f,_0x53db98);SmsAccountEvents['on'](_0xdba28f,_0x8357e1);}}; \ No newline at end of file diff --git a/server/api/smsApplication/index.js b/server/api/smsApplication/index.js index c45002e..bbf6fd7 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 _0x6f40=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','create','update','delete','destroy','util','path','connect-timeout','express'];(function(_0x26b1bf,_0x1fd2cf){var _0x35311e=function(_0x1e303f){while(--_0x1e303f){_0x26b1bf['push'](_0x26b1bf['shift']());}};_0x35311e(++_0x1fd2cf);}(_0x6f40,0x6e));var _0x06f4=function(_0x55fbd9,_0x1acfa2){_0x55fbd9=_0x55fbd9-0x0;var _0x464cbf=_0x6f40[_0x55fbd9];return _0x464cbf;};'use strict';var multer=require('multer');var util=require(_0x06f4('0x0'));var path=require(_0x06f4('0x1'));var timeout=require(_0x06f4('0x2'));var express=require(_0x06f4('0x3'));var router=express[_0x06f4('0x4')]();var auth=require(_0x06f4('0x5'));var interaction=require(_0x06f4('0x6'));var config=require(_0x06f4('0x7'));var controller=require(_0x06f4('0x8'));router[_0x06f4('0x9')]('/',auth[_0x06f4('0xa')](),controller[_0x06f4('0xb')]);router[_0x06f4('0x9')](_0x06f4('0xc'),auth[_0x06f4('0xa')](),controller[_0x06f4('0xd')]);router[_0x06f4('0xe')]('/',auth['isAuthenticated'](),controller[_0x06f4('0xf')]);router['put'](_0x06f4('0xc'),auth[_0x06f4('0xa')](),controller[_0x06f4('0x10')]);router[_0x06f4('0x11')](_0x06f4('0xc'),auth[_0x06f4('0xa')](),controller[_0x06f4('0x12')]);module['exports']=router; \ No newline at end of file +var _0xaaba=['destroy','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','post','put','delete','/:id'];(function(_0x308e4f,_0x134e25){var _0x17ab35=function(_0x2cfcd9){while(--_0x2cfcd9){_0x308e4f['push'](_0x308e4f['shift']());}};_0x17ab35(++_0x134e25);}(_0xaaba,0x162));var _0xaaab=function(_0x2fa157,_0x5376b){_0x2fa157=_0x2fa157-0x0;var _0x3c0392=_0xaaba[_0x2fa157];return _0x3c0392;};'use strict';var multer=require(_0xaaab('0x0'));var util=require('util');var path=require(_0xaaab('0x1'));var timeout=require(_0xaaab('0x2'));var express=require(_0xaaab('0x3'));var router=express[_0xaaab('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xaaab('0x5'));var config=require(_0xaaab('0x6'));var controller=require(_0xaaab('0x7'));router[_0xaaab('0x8')]('/',auth[_0xaaab('0x9')](),controller['index']);router[_0xaaab('0x8')]('/:id',auth[_0xaaab('0x9')](),controller['show']);router[_0xaaab('0xa')]('/',auth[_0xaaab('0x9')](),controller['create']);router[_0xaaab('0xb')]('/:id',auth[_0xaaab('0x9')](),controller['update']);router[_0xaaab('0xc')](_0xaaab('0xd'),auth[_0xaaab('0x9')](),controller[_0xaaab('0xe')]);module[_0xaaab('0xf')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index af5c2f3..4fbf8e2 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 _0xcd00=['exports','INTEGER','TEXT','STRING','sequelize'];(function(_0x25dd67,_0x5612cf){var _0x242672=function(_0x2c6869){while(--_0x2c6869){_0x25dd67['push'](_0x25dd67['shift']());}};_0x242672(++_0x5612cf);}(_0xcd00,0x16c));var _0x0cd0=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xcd00[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require(_0x0cd0('0x0'));module[_0x0cd0('0x1')]={'priority':{'type':Sequelize[_0x0cd0('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x0cd0('0x3')]()},'description':{'type':Sequelize[_0x0cd0('0x4')]},'interval':{'type':Sequelize[_0x0cd0('0x4')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x1bd3=['exports','INTEGER','STRING','noop','*,*,*,*','sequelize'];(function(_0x3d5371,_0x24ebd7){var _0x4631e3=function(_0x2a2e41){while(--_0x2a2e41){_0x3d5371['push'](_0x3d5371['shift']());}};_0x4631e3(++_0x24ebd7);}(_0x1bd3,0x95));var _0x31bd=function(_0x9455c1,_0x5dbc21){_0x9455c1=_0x9455c1-0x0;var _0x357f75=_0x1bd3[_0x9455c1];return _0x357f75;};'use strict';var Sequelize=require(_0x31bd('0x0'));module[_0x31bd('0x1')]={'priority':{'type':Sequelize[_0x31bd('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x31bd('0x3')],'allowNull':![],'defaultValue':_0x31bd('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x31bd('0x3')]},'interval':{'type':Sequelize[_0x31bd('0x3')],'defaultValue':_0x31bd('0x5')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 5af9040..1e7f0f0 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 _0xe2cf=['rawAttributes','fieldName','type','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filters','filter','merge','options','count','include','findAll','catch','show','params','includeAll','find','body','eml-format','zip-dir','request-promise','moment','bluebird','mustache','path','sox','lodash','squel','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','end','status','json','offset','limit','set','Content-Range','apply','save','update','then','error','stack','name','index','map','SmsApplication'];(function(_0x489641,_0x1be13e){var _0xb1e3de=function(_0x1f538a){while(--_0x1f538a){_0x489641['push'](_0x489641['shift']());}};_0xb1e3de(++_0x1be13e);}(_0xe2cf,0x1a1));var _0xfe2c=function(_0x411dc3,_0x47a8e4){_0x411dc3=_0x411dc3-0x0;var _0x5b870b=_0xe2cf[_0x411dc3];return _0x5b870b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xfe2c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfe2c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfe2c('0x2'));var moment=require(_0xfe2c('0x3'));var BPromise=require(_0xfe2c('0x4'));var Mustache=require(_0xfe2c('0x5'));var util=require('util');var path=require(_0xfe2c('0x6'));var sox=require(_0xfe2c('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xfe2c('0x8'));var squel=require(_0xfe2c('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xfe2c('0xa'));var toCsv=require(_0xfe2c('0xb'));var querystring=require(_0xfe2c('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xfe2c('0xd'));var qs=require(_0xfe2c('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfe2c('0xf'));var logger=require(_0xfe2c('0x10'))(_0xfe2c('0x11'));var utils=require(_0xfe2c('0x12'));var config=require(_0xfe2c('0x13'));var db=require(_0xfe2c('0x14'))['db'];function respondWithStatusCode(_0x39ce22,_0x4af8b7){_0x4af8b7=_0x4af8b7||0xcc;return function(_0x5e7389){if(_0x5e7389){return _0x39ce22['sendStatus'](_0x4af8b7);}return _0x39ce22['status'](_0x4af8b7)[_0xfe2c('0x15')]();};}function respondWithResult(_0x54d2d4,_0x5a6ad5){_0x5a6ad5=_0x5a6ad5||0xc8;return function(_0x38ba2c){if(_0x38ba2c){return _0x54d2d4[_0xfe2c('0x16')](_0x5a6ad5)[_0xfe2c('0x17')](_0x38ba2c);}};}function respondWithFilteredResult(_0x12e4c4,_0x522692){return function(_0x5039cb){if(_0x5039cb){var _0x1a4684=_0x5039cb['count'],_0x3b3ebd=_0x522692[_0xfe2c('0x18')],_0x1dbed4=_0x522692[_0xfe2c('0x18')]+_0x522692[_0xfe2c('0x19')],_0x56cebc;if(_0x1dbed4>=_0x1a4684){_0x1dbed4=_0x1a4684;_0x56cebc=0xc8;}else{_0x56cebc=0xce;}_0x12e4c4[_0xfe2c('0x16')](_0x56cebc);return _0x12e4c4[_0xfe2c('0x1a')](_0xfe2c('0x1b'),_0x3b3ebd+'-'+_0x1dbed4+'/'+_0x1a4684)['json'](_0x5039cb);}return null;};}function patchUpdates(_0x22481a){return function(_0xa9b1dc){try{jsonpatch[_0xfe2c('0x1c')](_0xa9b1dc,_0x22481a,!![]);}catch(_0x51086d){return BPromise['reject'](_0x51086d);}return _0xa9b1dc[_0xfe2c('0x1d')]();};}function saveUpdates(_0x59bdeb,_0x4e9137){return function(_0x408f31){if(_0x408f31){return _0x408f31[_0xfe2c('0x1e')](_0x59bdeb)['then'](function(_0xc42d82){return _0xc42d82;});}return null;};}function removeEntity(_0x1e2519,_0x5e609f){return function(_0x1bd50e){if(_0x1bd50e){return _0x1bd50e['destroy']()[_0xfe2c('0x1f')](function(){_0x1e2519[_0xfe2c('0x16')](0xcc)[_0xfe2c('0x15')]();});}};}function handleEntityNotFound(_0x298819,_0x360928){return function(_0x2ee3b3){if(!_0x2ee3b3){_0x298819['sendStatus'](0x194);}return _0x2ee3b3;};}function handleError(_0x41a545,_0x45a722){_0x45a722=_0x45a722||0x1f4;return function(_0xe74ca1){logger[_0xfe2c('0x20')](_0xe74ca1[_0xfe2c('0x21')]);if(_0xe74ca1[_0xfe2c('0x22')]){delete _0xe74ca1['name'];}_0x41a545[_0xfe2c('0x16')](_0x45a722)['send'](_0xe74ca1);};}exports[_0xfe2c('0x23')]=function(_0x2fcf5d,_0x1c35d3){var _0x54e356={},_0x377cc5={},_0x344ca0={'count':0x0,'rows':[]};var _0x59094a=_[_0xfe2c('0x24')](db[_0xfe2c('0x25')][_0xfe2c('0x26')],function(_0x53a8c1){return{'name':_0x53a8c1[_0xfe2c('0x27')],'type':_0x53a8c1[_0xfe2c('0x28')]['key']};});_0x377cc5['model']=_[_0xfe2c('0x24')](_0x59094a,_0xfe2c('0x22'));_0x377cc5[_0xfe2c('0x29')]=_[_0xfe2c('0x2a')](_0x2fcf5d[_0xfe2c('0x29')]);_0x377cc5['filters']=_[_0xfe2c('0x2b')](_0x377cc5[_0xfe2c('0x2c')],_0x377cc5[_0xfe2c('0x29')]);_0x54e356[_0xfe2c('0x2d')]=_[_0xfe2c('0x2b')](_0x377cc5[_0xfe2c('0x2c')],qs[_0xfe2c('0x2e')](_0x2fcf5d[_0xfe2c('0x29')][_0xfe2c('0x2e')]));_0x54e356[_0xfe2c('0x2d')]=_0x54e356[_0xfe2c('0x2d')][_0xfe2c('0x2f')]?_0x54e356['attributes']:_0x377cc5[_0xfe2c('0x2c')];if(!_0x2fcf5d[_0xfe2c('0x29')][_0xfe2c('0x30')]('nolimit')){_0x54e356[_0xfe2c('0x19')]=qs[_0xfe2c('0x19')](_0x2fcf5d['query'][_0xfe2c('0x19')]);_0x54e356[_0xfe2c('0x18')]=qs[_0xfe2c('0x18')](_0x2fcf5d['query'][_0xfe2c('0x18')]);}_0x54e356[_0xfe2c('0x31')]=qs[_0xfe2c('0x32')](_0x2fcf5d[_0xfe2c('0x29')][_0xfe2c('0x32')]);_0x54e356[_0xfe2c('0x33')]=qs[_0xfe2c('0x34')](_['pick'](_0x2fcf5d['query'],_0x377cc5[_0xfe2c('0x34')]),_0x59094a);if(_0x2fcf5d[_0xfe2c('0x29')][_0xfe2c('0x35')]){_0x54e356[_0xfe2c('0x33')]=_['merge'](_0x54e356[_0xfe2c('0x33')],{'$or':_['map'](_0x59094a,function(_0x35aaee){if(_0x35aaee[_0xfe2c('0x28')]!=='VIRTUAL'){var _0x1d5877={};_0x1d5877[_0x35aaee['name']]={'$like':'%'+_0x2fcf5d['query'][_0xfe2c('0x35')]+'%'};return _0x1d5877;}})});}_0x54e356=_[_0xfe2c('0x36')]({},_0x54e356,_0x2fcf5d[_0xfe2c('0x37')]);var _0x5e48bb={'where':_0x54e356[_0xfe2c('0x33')]};return db[_0xfe2c('0x25')][_0xfe2c('0x38')](_0x5e48bb)[_0xfe2c('0x1f')](function(_0x5d2811){_0x344ca0[_0xfe2c('0x38')]=_0x5d2811;if(_0x2fcf5d[_0xfe2c('0x29')]['includeAll']){_0x54e356[_0xfe2c('0x39')]=[{'all':!![]}];}return db[_0xfe2c('0x25')][_0xfe2c('0x3a')](_0x54e356);})['then'](function(_0x4c1e95){_0x344ca0['rows']=_0x4c1e95;return _0x344ca0;})[_0xfe2c('0x1f')](respondWithFilteredResult(_0x1c35d3,_0x54e356))[_0xfe2c('0x3b')](handleError(_0x1c35d3,null));};exports[_0xfe2c('0x3c')]=function(_0x1b9c5b,_0x5769f3){var _0x1ed30b={'raw':!![],'where':{'id':_0x1b9c5b[_0xfe2c('0x3d')]['id']}},_0x645585={};_0x645585[_0xfe2c('0x2c')]=_[_0xfe2c('0x2a')](db['SmsApplication'][_0xfe2c('0x26')]);_0x645585[_0xfe2c('0x29')]=_[_0xfe2c('0x2a')](_0x1b9c5b[_0xfe2c('0x29')]);_0x645585['filters']=_['intersection'](_0x645585[_0xfe2c('0x2c')],_0x645585[_0xfe2c('0x29')]);_0x1ed30b['attributes']=_[_0xfe2c('0x2b')](_0x645585[_0xfe2c('0x2c')],qs[_0xfe2c('0x2e')](_0x1b9c5b[_0xfe2c('0x29')]['fields']));_0x1ed30b[_0xfe2c('0x2d')]=_0x1ed30b[_0xfe2c('0x2d')][_0xfe2c('0x2f')]?_0x1ed30b[_0xfe2c('0x2d')]:_0x645585[_0xfe2c('0x2c')];if(_0x1b9c5b[_0xfe2c('0x29')][_0xfe2c('0x3e')]){_0x1ed30b[_0xfe2c('0x39')]=[{'all':!![]}];}_0x1ed30b=_['merge']({},_0x1ed30b,_0x1b9c5b[_0xfe2c('0x37')]);return db['SmsApplication'][_0xfe2c('0x3f')](_0x1ed30b)[_0xfe2c('0x1f')](handleEntityNotFound(_0x5769f3,null))[_0xfe2c('0x1f')](respondWithResult(_0x5769f3,null))[_0xfe2c('0x3b')](handleError(_0x5769f3,null));};exports['create']=function(_0x588e57,_0x47dfbc){return db['SmsApplication']['create'](_0x588e57[_0xfe2c('0x40')],{})['then'](respondWithResult(_0x47dfbc,0xc9))['catch'](handleError(_0x47dfbc,null));};exports[_0xfe2c('0x1e')]=function(_0x5d76be,_0x2c02d1){if(_0x5d76be['body']['id']){delete _0x5d76be[_0xfe2c('0x40')]['id'];}return db[_0xfe2c('0x25')][_0xfe2c('0x3f')]({'where':{'id':_0x5d76be[_0xfe2c('0x3d')]['id']}})[_0xfe2c('0x1f')](handleEntityNotFound(_0x2c02d1,null))['then'](saveUpdates(_0x5d76be[_0xfe2c('0x40')],null))[_0xfe2c('0x1f')](respondWithResult(_0x2c02d1,null))[_0xfe2c('0x3b')](handleError(_0x2c02d1,null));};exports['destroy']=function(_0x150762,_0x44f0ba){return db['SmsApplication']['find']({'where':{'id':_0x150762['params']['id']}})[_0xfe2c('0x1f')](handleEntityNotFound(_0x44f0ba,null))[_0xfe2c('0x1f')](removeEntity(_0x44f0ba,null))[_0xfe2c('0x3b')](handleError(_0x44f0ba,null));}; \ No newline at end of file +var _0x3de3=['count','offset','limit','set','Content-Range','reject','save','update','then','stack','name','send','map','SmsApplication','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','catch','show','params','fields','length','include','find','create','body','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','ejs','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json'];(function(_0x435020,_0x47bd57){var _0x3c3266=function(_0x8d1a32){while(--_0x8d1a32){_0x435020['push'](_0x435020['shift']());}};_0x3c3266(++_0x47bd57);}(_0x3de3,0x1ce));var _0x33de=function(_0x827c73,_0x17402c){_0x827c73=_0x827c73-0x0;var _0x2a0836=_0x3de3[_0x827c73];return _0x2a0836;};'use strict';var pdf=require(_0x33de('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x33de('0x1'));var zipdir=require(_0x33de('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x33de('0x3'));var moment=require(_0x33de('0x4'));var BPromise=require(_0x33de('0x5'));var Mustache=require(_0x33de('0x6'));var util=require('util');var path=require(_0x33de('0x7'));var sox=require(_0x33de('0x8'));var csv=require('to-csv');var ejs=require(_0x33de('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x33de('0xa'));var crypto=require(_0x33de('0xb'));var jsforce=require(_0x33de('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x33de('0xd'));var querystring=require(_0x33de('0xe'));var Papa=require(_0x33de('0xf'));var Redis=require('ioredis');var authService=require(_0x33de('0x10'));var qs=require(_0x33de('0x11'));var as=require(_0x33de('0x12'));var hardwareService=require(_0x33de('0x13'));var logger=require(_0x33de('0x14'))(_0x33de('0x15'));var utils=require(_0x33de('0x16'));var config=require(_0x33de('0x17'));var db=require(_0x33de('0x18'))['db'];function respondWithStatusCode(_0x306efc,_0x27d1d8){_0x27d1d8=_0x27d1d8||0xcc;return function(_0x5170ad){if(_0x5170ad){return _0x306efc[_0x33de('0x19')](_0x27d1d8);}return _0x306efc[_0x33de('0x1a')](_0x27d1d8)['end']();};}function respondWithResult(_0x5392c0,_0x4164ab){_0x4164ab=_0x4164ab||0xc8;return function(_0x22bda8){if(_0x22bda8){return _0x5392c0[_0x33de('0x1a')](_0x4164ab)[_0x33de('0x1b')](_0x22bda8);}};}function respondWithFilteredResult(_0x57aa73,_0x11e6b5){return function(_0x1b1166){if(_0x1b1166){var _0x522ba0=_0x1b1166[_0x33de('0x1c')],_0x4ff69f=_0x11e6b5['offset'],_0x185849=_0x11e6b5[_0x33de('0x1d')]+_0x11e6b5[_0x33de('0x1e')],_0x16c050;if(_0x185849>=_0x522ba0){_0x185849=_0x522ba0;_0x16c050=0xc8;}else{_0x16c050=0xce;}_0x57aa73['status'](_0x16c050);return _0x57aa73[_0x33de('0x1f')](_0x33de('0x20'),_0x4ff69f+'-'+_0x185849+'/'+_0x522ba0)['json'](_0x1b1166);}return null;};}function patchUpdates(_0x5bb74e){return function(_0x1cf3dd){try{jsonpatch['apply'](_0x1cf3dd,_0x5bb74e,!![]);}catch(_0x16255f){return BPromise[_0x33de('0x21')](_0x16255f);}return _0x1cf3dd[_0x33de('0x22')]();};}function saveUpdates(_0x315c9b,_0xc4f1a4){return function(_0x40a8e6){if(_0x40a8e6){return _0x40a8e6[_0x33de('0x23')](_0x315c9b)['then'](function(_0x571086){return _0x571086;});}return null;};}function removeEntity(_0x34e7ef,_0x5af3fa){return function(_0x8acd8d){if(_0x8acd8d){return _0x8acd8d['destroy']()[_0x33de('0x24')](function(){_0x34e7ef[_0x33de('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2dbcf2,_0x5cd77e){return function(_0x67d040){if(!_0x67d040){_0x2dbcf2['sendStatus'](0x194);}return _0x67d040;};}function handleError(_0x62743b,_0x24e282){_0x24e282=_0x24e282||0x1f4;return function(_0x1e3c61){logger['error'](_0x1e3c61[_0x33de('0x25')]);if(_0x1e3c61[_0x33de('0x26')]){delete _0x1e3c61[_0x33de('0x26')];}_0x62743b['status'](_0x24e282)[_0x33de('0x27')](_0x1e3c61);};}exports['index']=function(_0x566373,_0x1c8de9){var _0x17c760={},_0x1a870a={},_0x208d0d={'count':0x0,'rows':[]};var _0x44b10e=_[_0x33de('0x28')](db[_0x33de('0x29')][_0x33de('0x2a')],function(_0x59bc3b){return{'name':_0x59bc3b['fieldName'],'type':_0x59bc3b[_0x33de('0x2b')][_0x33de('0x2c')]};});_0x1a870a[_0x33de('0x2d')]=_[_0x33de('0x28')](_0x44b10e,_0x33de('0x26'));_0x1a870a[_0x33de('0x2e')]=_[_0x33de('0x2f')](_0x566373['query']);_0x1a870a[_0x33de('0x30')]=_[_0x33de('0x31')](_0x1a870a[_0x33de('0x2d')],_0x1a870a[_0x33de('0x2e')]);_0x17c760['attributes']=_[_0x33de('0x31')](_0x1a870a[_0x33de('0x2d')],qs['fields'](_0x566373['query']['fields']));_0x17c760[_0x33de('0x32')]=_0x17c760[_0x33de('0x32')]['length']?_0x17c760[_0x33de('0x32')]:_0x1a870a['model'];if(!_0x566373['query'][_0x33de('0x33')](_0x33de('0x34'))){_0x17c760[_0x33de('0x1e')]=qs[_0x33de('0x1e')](_0x566373[_0x33de('0x2e')][_0x33de('0x1e')]);_0x17c760[_0x33de('0x1d')]=qs[_0x33de('0x1d')](_0x566373['query'][_0x33de('0x1d')]);}_0x17c760['order']=qs[_0x33de('0x35')](_0x566373['query']['sort']);_0x17c760[_0x33de('0x36')]=qs[_0x33de('0x30')](_[_0x33de('0x37')](_0x566373[_0x33de('0x2e')],_0x1a870a[_0x33de('0x30')]),_0x44b10e);if(_0x566373[_0x33de('0x2e')]['filter']){_0x17c760[_0x33de('0x36')]=_[_0x33de('0x38')](_0x17c760[_0x33de('0x36')],{'$or':_[_0x33de('0x28')](_0x44b10e,function(_0x3a1398){if(_0x3a1398[_0x33de('0x2b')]!==_0x33de('0x39')){var _0x483c24={};_0x483c24[_0x3a1398[_0x33de('0x26')]]={'$like':'%'+_0x566373[_0x33de('0x2e')][_0x33de('0x3a')]+'%'};return _0x483c24;}})});}_0x17c760=_[_0x33de('0x38')]({},_0x17c760,_0x566373[_0x33de('0x3b')]);var _0x35064e={'where':_0x17c760[_0x33de('0x36')]};return db['SmsApplication'][_0x33de('0x1c')](_0x35064e)[_0x33de('0x24')](function(_0x1071fb){_0x208d0d[_0x33de('0x1c')]=_0x1071fb;if(_0x566373[_0x33de('0x2e')][_0x33de('0x3c')]){_0x17c760['include']=[{'all':!![]}];}return db[_0x33de('0x29')]['findAll'](_0x17c760);})[_0x33de('0x24')](function(_0x66897c){_0x208d0d['rows']=_0x66897c;return _0x208d0d;})[_0x33de('0x24')](respondWithFilteredResult(_0x1c8de9,_0x17c760))[_0x33de('0x3d')](handleError(_0x1c8de9,null));};exports[_0x33de('0x3e')]=function(_0x1de158,_0x127fde){var _0x4251e3={'raw':!![],'where':{'id':_0x1de158[_0x33de('0x3f')]['id']}},_0x22518d={};_0x22518d[_0x33de('0x2d')]=_['keys'](db['SmsApplication'][_0x33de('0x2a')]);_0x22518d[_0x33de('0x2e')]=_[_0x33de('0x2f')](_0x1de158[_0x33de('0x2e')]);_0x22518d['filters']=_[_0x33de('0x31')](_0x22518d['model'],_0x22518d['query']);_0x4251e3[_0x33de('0x32')]=_[_0x33de('0x31')](_0x22518d[_0x33de('0x2d')],qs[_0x33de('0x40')](_0x1de158[_0x33de('0x2e')][_0x33de('0x40')]));_0x4251e3[_0x33de('0x32')]=_0x4251e3['attributes'][_0x33de('0x41')]?_0x4251e3['attributes']:_0x22518d[_0x33de('0x2d')];if(_0x1de158['query'][_0x33de('0x3c')]){_0x4251e3[_0x33de('0x42')]=[{'all':!![]}];}_0x4251e3=_['merge']({},_0x4251e3,_0x1de158[_0x33de('0x3b')]);return db[_0x33de('0x29')][_0x33de('0x43')](_0x4251e3)['then'](handleEntityNotFound(_0x127fde,null))['then'](respondWithResult(_0x127fde,null))[_0x33de('0x3d')](handleError(_0x127fde,null));};exports[_0x33de('0x44')]=function(_0x4bf097,_0x5efc88){return db[_0x33de('0x29')]['create'](_0x4bf097['body'],{})['then'](respondWithResult(_0x5efc88,0xc9))[_0x33de('0x3d')](handleError(_0x5efc88,null));};exports[_0x33de('0x23')]=function(_0x9a816c,_0xce6079){if(_0x9a816c['body']['id']){delete _0x9a816c['body']['id'];}return db[_0x33de('0x29')][_0x33de('0x43')]({'where':{'id':_0x9a816c['params']['id']}})[_0x33de('0x24')](handleEntityNotFound(_0xce6079,null))[_0x33de('0x24')](saveUpdates(_0x9a816c[_0x33de('0x45')],null))[_0x33de('0x24')](respondWithResult(_0xce6079,null))[_0x33de('0x3d')](handleError(_0xce6079,null));};exports['destroy']=function(_0x185e5f,_0x3bf2e3){return db['SmsApplication'][_0x33de('0x43')]({'where':{'id':_0x185e5f[_0x33de('0x3f')]['id']}})[_0x33de('0x24')](handleEntityNotFound(_0x3bf2e3,null))[_0x33de('0x24')](removeEntity(_0x3bf2e3,null))[_0x33de('0x3d')](handleError(_0x3bf2e3,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 55e3734..1b56aeb 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 _0x5b76=['rimraf','../../config/environment','./smsApplication.attributes','exports','define','sms_applications','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','request-promise','path'];(function(_0x41582d,_0x291b1c){var _0x59c504=function(_0x4d967e){while(--_0x4d967e){_0x41582d['push'](_0x41582d['shift']());}};_0x59c504(++_0x291b1c);}(_0x5b76,0x118));var _0x65b7=function(_0x27e462,_0x6ba481){_0x27e462=_0x27e462-0x0;var _0x1520f7=_0x5b76[_0x27e462];return _0x1520f7;};'use strict';var _=require(_0x65b7('0x0'));var util=require(_0x65b7('0x1'));var logger=require(_0x65b7('0x2'))(_0x65b7('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x65b7('0x4'));var fs=require('fs');var path=require(_0x65b7('0x5'));var rimraf=require(_0x65b7('0x6'));var config=require(_0x65b7('0x7'));var attributes=require(_0x65b7('0x8'));module[_0x65b7('0x9')]=function(_0x4679a2,_0xe74d4){return _0x4679a2[_0x65b7('0xa')]('SmsApplication',attributes,{'tableName':_0x65b7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x65b7('0xc')});}; \ No newline at end of file +var _0xab7b=['./smsApplication.attributes','exports','define','SmsApplication','sms_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment'];(function(_0xfbdff6,_0x2af690){var _0x4cb9be=function(_0x4022d8){while(--_0x4022d8){_0xfbdff6['push'](_0xfbdff6['shift']());}};_0x4cb9be(++_0x2af690);}(_0xab7b,0x124));var _0xbab7=function(_0x195577,_0x5de53a){_0x195577=_0x195577-0x0;var _0x13c367=_0xab7b[_0x195577];return _0x13c367;};'use strict';var _=require(_0xbab7('0x0'));var util=require(_0xbab7('0x1'));var logger=require(_0xbab7('0x2'))(_0xbab7('0x3'));var moment=require(_0xbab7('0x4'));var BPromise=require(_0xbab7('0x5'));var rp=require(_0xbab7('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xbab7('0x7'));var attributes=require(_0xbab7('0x8'));module[_0xbab7('0x9')]=function(_0x1a8444,_0x1854f1){return _0x1a8444[_0xbab7('0xa')](_0xbab7('0xb'),attributes,{'tableName':_0xbab7('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xbab7('0xd'),'collate':_0xbab7('0xe')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 8aa477d..33e1a3e 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 _0x2e3b=['jayson/promise','http','request','then','info','SmsApplication,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x1cda82,_0x545bbe){var _0x5adf6e=function(_0x3adbce){while(--_0x3adbce){_0x1cda82['push'](_0x1cda82['shift']());}};_0x5adf6e(++_0x545bbe);}(_0x2e3b,0x81));var _0xb2e3=function(_0x4c859e,_0x5b048f){_0x4c859e=_0x4c859e-0x0;var _0xc8de25=_0x2e3b[_0x4c859e];return _0xc8de25;};'use strict';var _=require('lodash');var util=require(_0xb2e3('0x0'));var moment=require(_0xb2e3('0x1'));var BPromise=require(_0xb2e3('0x2'));var rs=require(_0xb2e3('0x3'));var fs=require('fs');var Redis=require(_0xb2e3('0x4'));var db=require(_0xb2e3('0x5'))['db'];var utils=require(_0xb2e3('0x6'));var logger=require(_0xb2e3('0x7'))('rpc');var config=require(_0xb2e3('0x8'));var jayson=require(_0xb2e3('0x9'));var client=jayson['client'][_0xb2e3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x108b1c,_0x4c006a,_0x14758e){return new BPromise(function(_0x2d952,_0x4fbc94){return client[_0xb2e3('0xb')](_0x108b1c,_0x14758e)[_0xb2e3('0xc')](function(_0x412912){logger[_0xb2e3('0xd')](_0xb2e3('0xe'),_0x4c006a,'request\x20sent');logger[_0xb2e3('0xf')]('SmsApplication,\x20%s,\x20%s,\x20%s',_0x4c006a,_0xb2e3('0x10'),JSON[_0xb2e3('0x11')](_0x412912));if(_0x412912[_0xb2e3('0x12')]){if(_0x412912[_0xb2e3('0x12')][_0xb2e3('0x13')]===0x1f4){logger[_0xb2e3('0x12')](_0xb2e3('0xe'),_0x4c006a,_0x412912['error']['message']);return _0x4fbc94(_0x412912['error'][_0xb2e3('0x14')]);}logger[_0xb2e3('0x12')](_0xb2e3('0xe'),_0x4c006a,_0x412912[_0xb2e3('0x12')]['message']);return _0x2d952(_0x412912[_0xb2e3('0x12')][_0xb2e3('0x14')]);}else{logger[_0xb2e3('0xd')](_0xb2e3('0xe'),_0x4c006a,_0xb2e3('0x10'));_0x2d952(_0x412912[_0xb2e3('0x15')][_0xb2e3('0x14')]);}})[_0xb2e3('0x16')](function(_0xa90515){logger['error']('SmsApplication,\x20%s,\x20%s',_0x4c006a,_0xa90515);_0x4fbc94(_0xa90515);});});} \ No newline at end of file +var _0x106f=['randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','util','bluebird'];(function(_0x23de56,_0x3ed0e4){var _0x1bccc7=function(_0x45a4c6){while(--_0x45a4c6){_0x23de56['push'](_0x23de56['shift']());}};_0x1bccc7(++_0x3ed0e4);}(_0x106f,0x162));var _0xf106=function(_0x1bee24,_0x3fbc01){_0x1bee24=_0x1bee24-0x0;var _0x30580a=_0x106f[_0x1bee24];return _0x30580a;};'use strict';var _=require(_0xf106('0x0'));var util=require(_0xf106('0x1'));var moment=require('moment');var BPromise=require(_0xf106('0x2'));var rs=require(_0xf106('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf106('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xf106('0x5'))(_0xf106('0x6'));var config=require(_0xf106('0x7'));var jayson=require(_0xf106('0x8'));var client=jayson[_0xf106('0x9')][_0xf106('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xc9588d,_0x546acc,_0x4ea3b8){return new BPromise(function(_0x3ac1bd,_0x5ea4f0){return client['request'](_0xc9588d,_0x4ea3b8)['then'](function(_0x4bd78d){logger['info'](_0xf106('0xb'),_0x546acc,_0xf106('0xc'));logger[_0xf106('0xd')](_0xf106('0xe'),_0x546acc,_0xf106('0xc'),JSON[_0xf106('0xf')](_0x4bd78d));if(_0x4bd78d[_0xf106('0x10')]){if(_0x4bd78d[_0xf106('0x10')][_0xf106('0x11')]===0x1f4){logger[_0xf106('0x10')](_0xf106('0xb'),_0x546acc,_0x4bd78d['error'][_0xf106('0x12')]);return _0x5ea4f0(_0x4bd78d[_0xf106('0x10')]['message']);}logger['error'](_0xf106('0xb'),_0x546acc,_0x4bd78d[_0xf106('0x10')][_0xf106('0x12')]);return _0x3ac1bd(_0x4bd78d['error'][_0xf106('0x12')]);}else{logger[_0xf106('0x13')](_0xf106('0xb'),_0x546acc,'request\x20sent');_0x3ac1bd(_0x4bd78d[_0xf106('0x14')][_0xf106('0x12')]);}})['catch'](function(_0x134f6d){logger[_0xf106('0x10')](_0xf106('0xb'),_0x546acc,_0x134f6d);_0x5ea4f0(_0x134f6d);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index c823c23..f0d7644 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 _0xa72d=['addMessage','post','/:id/tags','tracked','sms','smsinteraction:addtags','addTags','put','update','delete','destroy','removeTags','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','index','/describe','describe','/:id','isAuthenticated','show','/:id/messages','getMessages','create'];(function(_0x3ab393,_0x50d9c5){var _0x39d838=function(_0x9c0b89){while(--_0x9c0b89){_0x3ab393['push'](_0x3ab393['shift']());}};_0x39d838(++_0x50d9c5);}(_0xa72d,0x1bf));var _0xda72=function(_0x5ed207,_0x1ea18f){_0x5ed207=_0x5ed207-0x0;var _0xf5377d=_0xa72d[_0x5ed207];return _0xf5377d;};'use strict';var multer=require(_0xda72('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xda72('0x1'));var express=require(_0xda72('0x2'));var router=express[_0xda72('0x3')]();var auth=require(_0xda72('0x4'));var interaction=require(_0xda72('0x5'));var config=require(_0xda72('0x6'));var controller=require(_0xda72('0x7'));router[_0xda72('0x8')]('/',auth['isAuthenticated'](),controller[_0xda72('0x9')]);router[_0xda72('0x8')](_0xda72('0xa'),auth['isAuthenticated'](),controller[_0xda72('0xb')]);router[_0xda72('0x8')](_0xda72('0xc'),auth[_0xda72('0xd')](),controller[_0xda72('0xe')]);router[_0xda72('0x8')](_0xda72('0xf'),auth[_0xda72('0xd')](),controller[_0xda72('0x10')]);router['get']('/:id/download',auth[_0xda72('0xd')](),controller['download']);router['post']('/',auth[_0xda72('0xd')](),controller[_0xda72('0x11')]);router['post'](_0xda72('0xf'),auth[_0xda72('0xd')](),controller[_0xda72('0x12')]);router[_0xda72('0x13')](_0xda72('0x14'),auth['isAuthenticated'](),interaction[_0xda72('0x15')](_0xda72('0x16'),_0xda72('0x17')),controller[_0xda72('0x18')]);router[_0xda72('0x19')](_0xda72('0xc'),auth[_0xda72('0xd')](),interaction[_0xda72('0x15')]('sms','smsinteraction:update'),controller[_0xda72('0x1a')]);router[_0xda72('0x1b')](_0xda72('0xc'),auth[_0xda72('0xd')](),interaction[_0xda72('0x15')](_0xda72('0x16'),'smsinteraction:destroy'),controller[_0xda72('0x1c')]);router[_0xda72('0x1b')](_0xda72('0x14'),auth[_0xda72('0xd')](),controller[_0xda72('0x1d')]);module[_0xda72('0x1e')]=router; \ No newline at end of file +var _0xdf55=['/:id/tags','tracked','smsinteraction:addtags','put','/:id','sms','update','delete','smsinteraction:destroy','destroy','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','show','getMessages','/:id/download','create','post','/:id/messages','addMessage'];(function(_0x4d465c,_0x371dc7){var _0x2a958a=function(_0x4f3345){while(--_0x4f3345){_0x4d465c['push'](_0x4d465c['shift']());}};_0x2a958a(++_0x371dc7);}(_0xdf55,0x83));var _0x5df5=function(_0x57d628,_0xda6747){_0x57d628=_0x57d628-0x0;var _0x2f8486=_0xdf55[_0x57d628];return _0x2f8486;};'use strict';var multer=require(_0x5df5('0x0'));var util=require(_0x5df5('0x1'));var path=require('path');var timeout=require(_0x5df5('0x2'));var express=require(_0x5df5('0x3'));var router=express['Router']();var auth=require(_0x5df5('0x4'));var interaction=require(_0x5df5('0x5'));var config=require(_0x5df5('0x6'));var controller=require('./smsInteraction.controller');router[_0x5df5('0x7')]('/',auth[_0x5df5('0x8')](),controller[_0x5df5('0x9')]);router[_0x5df5('0x7')](_0x5df5('0xa'),auth[_0x5df5('0x8')](),controller[_0x5df5('0xb')]);router[_0x5df5('0x7')]('/:id',auth[_0x5df5('0x8')](),controller[_0x5df5('0xc')]);router[_0x5df5('0x7')]('/:id/messages',auth['isAuthenticated'](),controller[_0x5df5('0xd')]);router['get'](_0x5df5('0xe'),auth[_0x5df5('0x8')](),controller['download']);router['post']('/',auth[_0x5df5('0x8')](),controller[_0x5df5('0xf')]);router[_0x5df5('0x10')](_0x5df5('0x11'),auth[_0x5df5('0x8')](),controller[_0x5df5('0x12')]);router[_0x5df5('0x10')](_0x5df5('0x13'),auth[_0x5df5('0x8')](),interaction[_0x5df5('0x14')]('sms',_0x5df5('0x15')),controller['addTags']);router[_0x5df5('0x16')](_0x5df5('0x17'),auth[_0x5df5('0x8')](),interaction[_0x5df5('0x14')](_0x5df5('0x18'),'smsinteraction:update'),controller[_0x5df5('0x19')]);router[_0x5df5('0x1a')]('/:id',auth[_0x5df5('0x8')](),interaction[_0x5df5('0x14')](_0x5df5('0x18'),_0x5df5('0x1b')),controller[_0x5df5('0x1c')]);router['delete']('/:id/tags',auth[_0x5df5('0x8')](),controller['removeTags']);module[_0x5df5('0x1d')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 9afa0b6..0d44fdb 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 _0x757a=['moment','exports','STRING','DATE','ENUM','out'];(function(_0x5b086e,_0x5eb6c0){var _0x3e2c2c=function(_0x1c5de7){while(--_0x1c5de7){_0x5b086e['push'](_0x5b086e['shift']());}};_0x3e2c2c(++_0x5eb6c0);}(_0x757a,0xde));var _0xa757=function(_0x4412de,_0x20fe95){_0x4412de=_0x4412de-0x0;var _0x2e1031=_0x757a[_0x4412de];return _0x2e1031;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xa757('0x0'));module[_0xa757('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xa757('0x2')]},'phone':{'type':Sequelize[_0xa757('0x2')]},'read1stAt':{'type':Sequelize[_0xa757('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xa757('0x4')]('in',_0xa757('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xa757('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xa757('0x5')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0xb7e7=['out','sequelize','exports','DATE','STRING','ENUM'];(function(_0x35da61,_0x46648d){var _0xe00e97=function(_0x42855f){while(--_0x42855f){_0x35da61['push'](_0x35da61['shift']());}};_0xe00e97(++_0x46648d);}(_0xb7e7,0x121));var _0x7b7e=function(_0x369151,_0x179f72){_0x369151=_0x369151-0x0;var _0x4292d5=_0xb7e7[_0x369151];return _0x4292d5;};'use strict';var Sequelize=require(_0x7b7e('0x0'));var moment=require('moment');module[_0x7b7e('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x7b7e('0x2')]},'disposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x7b7e('0x3')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x7b7e('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x7b7e('0x4')]('in',_0x7b7e('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x7b7e('0x5')),'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 d41c2ae..2443227 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 _0xb903=['expr','search','parseSearch','sqlOperator','conditions','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','find','ContactId','buildExpression','text','start','Tag','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','compact','isEmpty','SmsAccountId','i.SmsAccountId\x20IN\x20?','concat','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','\x27\x27\x27\x27','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','DESC','journey','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','count','sequelize','toString','keyBy','merge','SmsInteraction','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','groupBy','SmsInteractionId','all','rows','catch','params','rawAttributes','include','options','create','destroy','describe','SmsMessage','addMessage','ids','omit','findOne','$gte','format','includeAll','findAll','spread','emit','smsInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','attachments','CmContact','firstName','Messages','secret','SmsAccount','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','\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.','createdAt','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','disposition','direction','out','System','lastName','renderFile','views','downloadInteraction.html','transcript-','.pdf','log','err','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','crypto','jsforce','desk.js','to-csv','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','redis','defaults','status','end','offset','limit','Content-Range','json','apply','reject','save','update','then','sendStatus','error','stack','name','send','Users','map','fullname','TagIds','Tags','split','push','index','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','u.id','u.fullname','ui.SmsInteractionId','from','user_has_sms_interactions','left_join','users','sms_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','a.id\x20=\x20i.SmsAccountId','sms_messages','me.SmsInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId'];(function(_0x3b7a6b,_0x2cf1c9){var _0x273b35=function(_0x359a24){while(--_0x359a24){_0x3b7a6b['push'](_0x3b7a6b['shift']());}};_0x273b35(++_0x2cf1c9);}(_0xb903,0x185));var _0x3b90=function(_0x30fa3e,_0x4fac93){_0x30fa3e=_0x30fa3e-0x0;var _0xca6401=_0xb903[_0x30fa3e];return _0xca6401;};'use strict';var pdf=require(_0x3b90('0x0'));var emlformat=require(_0x3b90('0x1'));var rimraf=require(_0x3b90('0x2'));var zipdir=require(_0x3b90('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3b90('0x4'));var moment=require(_0x3b90('0x5'));var BPromise=require(_0x3b90('0x6'));var Mustache=require(_0x3b90('0x7'));var util=require(_0x3b90('0x8'));var path=require(_0x3b90('0x9'));var sox=require(_0x3b90('0xa'));var csv=require('to-csv');var ejs=require(_0x3b90('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x3b90('0xc'));var jsforce=require(_0x3b90('0xd'));var deskjs=require(_0x3b90('0xe'));var toCsv=require(_0x3b90('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3b90('0x10'));var logger=require(_0x3b90('0x11'))('api');var utils=require(_0x3b90('0x12'));var config=require(_0x3b90('0x13'));var db=require('../../mysqldb')['db'];config[_0x3b90('0x14')]=_[_0x3b90('0x15')](config[_0x3b90('0x14')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3b90('0x14')]));require('./smsInteraction.socket')['register'](socket);function respondWithStatusCode(_0x3a0a55,_0x2c72fb){_0x2c72fb=_0x2c72fb||0xcc;return function(_0x4824f9){if(_0x4824f9){return _0x3a0a55['sendStatus'](_0x2c72fb);}return _0x3a0a55[_0x3b90('0x16')](_0x2c72fb)[_0x3b90('0x17')]();};}function respondWithResult(_0x381a9e,_0x1af265){_0x1af265=_0x1af265||0xc8;return function(_0x1efe01){if(_0x1efe01){return _0x381a9e['status'](_0x1af265)['json'](_0x1efe01);}};}function respondWithFilteredResult(_0xd83280,_0x5420dc){return function(_0x4e9120){if(_0x4e9120){var _0x269488=_0x4e9120['count'],_0x3cf281=_0x5420dc[_0x3b90('0x18')],_0x11ad7d=_0x5420dc['offset']+_0x5420dc[_0x3b90('0x19')],_0x131f3f;if(_0x11ad7d>=_0x269488){_0x11ad7d=_0x269488;_0x131f3f=0xc8;}else{_0x131f3f=0xce;}_0xd83280[_0x3b90('0x16')](_0x131f3f);return _0xd83280['set'](_0x3b90('0x1a'),_0x3cf281+'-'+_0x11ad7d+'/'+_0x269488)[_0x3b90('0x1b')](_0x4e9120);}return null;};}function patchUpdates(_0x3642c0){return function(_0x3ce411){try{jsonpatch[_0x3b90('0x1c')](_0x3ce411,_0x3642c0,!![]);}catch(_0x43deca){return BPromise[_0x3b90('0x1d')](_0x43deca);}return _0x3ce411[_0x3b90('0x1e')]();};}function saveUpdates(_0xa98414,_0x3e5bb8){return function(_0x4e2175){if(_0x4e2175){return _0x4e2175[_0x3b90('0x1f')](_0xa98414)[_0x3b90('0x20')](function(_0x175b42){return _0x175b42;});}return null;};}function removeEntity(_0x7faee,_0x1227ed){return function(_0x93b8e7){if(_0x93b8e7){return _0x93b8e7['destroy']()['then'](function(){_0x7faee[_0x3b90('0x16')](0xcc)[_0x3b90('0x17')]();});}};}function handleEntityNotFound(_0x103324,_0x2ffa1a){return function(_0x583523){if(!_0x583523){_0x103324[_0x3b90('0x21')](0x194);}return _0x583523;};}function handleError(_0x2936d7,_0x1787d1){_0x1787d1=_0x1787d1||0x1f4;return function(_0x4caead){logger[_0x3b90('0x22')](_0x4caead[_0x3b90('0x23')]);if(_0x4caead[_0x3b90('0x24')]){delete _0x4caead[_0x3b90('0x24')];}_0x2936d7[_0x3b90('0x16')](_0x1787d1)[_0x3b90('0x25')](_0x4caead);};}function getInteractionUsers(_0x4b4d33,_0x1a839d){return new BPromise(function(_0x595ac1,_0xaf453c){try{if(_0x1a839d[_0x4b4d33['id']]){_0x4b4d33[_0x3b90('0x26')]=_[_0x3b90('0x27')](_0x1a839d[_0x4b4d33['id']],function(_0x38eed0){return{'id':_0x38eed0['id'],'fullname':_0x38eed0[_0x3b90('0x28')]};});}}catch(_0x6704f){_0xaf453c(_0x6704f);}_0x595ac1(_0x4b4d33);});}function getInteractionTags(_0x290283,_0x2430ec){return new BPromise(function(_0x500ceb,_0x4d1f31){try{if(_0x290283[_0x3b90('0x29')]){_0x290283[_0x3b90('0x2a')]=[];_0x290283[_0x3b90('0x29')][_0x3b90('0x2b')](',')['forEach'](function(_0x543458){_0x290283[_0x3b90('0x2a')][_0x3b90('0x2c')](_0x2430ec[_0x543458]);});}delete _0x290283[_0x3b90('0x29')];}catch(_0x4f3ab5){_0x4d1f31(_0x4f3ab5);}_0x500ceb(_0x290283);});}function updateSmsInteraction(_0x41bd39,_0x4ca40e,_0x49b4d2){return new BPromise(function(_0x208f3e,_0x3fbc03){return getInteractionUsers(_0x41bd39,_0x49b4d2)['then'](function(_0x3e7c71){return getInteractionTags(_0x3e7c71,_0x4ca40e);})[_0x3b90('0x20')](function(_0x3e30b8){_0x208f3e(_0x3e30b8);})['catch'](function(_0x47cd8f){_0x3fbc03(_0x47cd8f);});});}exports[_0x3b90('0x2d')]=function(_0x143698,_0x64a5e){var _0x401dc5={},_0x5dacea={},_0x5a97fe={'count':0x0,'rows':[]};var _0x25ff34=_[_0x3b90('0x27')](db['SmsInteraction']['rawAttributes'],function(_0x201712){return{'name':_0x201712[_0x3b90('0x2e')],'type':_0x201712[_0x3b90('0x2f')][_0x3b90('0x30')]};});_0x5dacea['model']=_[_0x3b90('0x27')](_0x25ff34,'name');_0x5dacea[_0x3b90('0x31')]=_[_0x3b90('0x32')](_0x143698[_0x3b90('0x31')]);_0x5dacea[_0x3b90('0x33')]=_[_0x3b90('0x34')](_0x5dacea[_0x3b90('0x35')],_0x5dacea[_0x3b90('0x31')]);_0x401dc5['attributes']=_[_0x3b90('0x34')](_0x5dacea[_0x3b90('0x35')],qs[_0x3b90('0x36')](_0x143698[_0x3b90('0x31')][_0x3b90('0x36')]));_0x401dc5[_0x3b90('0x37')]=_0x401dc5[_0x3b90('0x37')][_0x3b90('0x38')]?_0x401dc5[_0x3b90('0x37')]:_0x5dacea['model'];if(!_0x143698[_0x3b90('0x31')][_0x3b90('0x39')](_0x3b90('0x3a'))){_0x401dc5[_0x3b90('0x19')]=qs[_0x3b90('0x19')](_0x143698[_0x3b90('0x31')][_0x3b90('0x19')]);_0x401dc5[_0x3b90('0x18')]=qs[_0x3b90('0x18')](_0x143698[_0x3b90('0x31')][_0x3b90('0x18')]);}_0x401dc5[_0x3b90('0x3b')]=qs[_0x3b90('0x3c')](_0x143698[_0x3b90('0x31')][_0x3b90('0x3c')]);_0x401dc5[_0x3b90('0x3d')]=qs[_0x3b90('0x33')](_[_0x3b90('0x3e')](_0x143698[_0x3b90('0x31')],_0x5dacea[_0x3b90('0x33')]),_0x25ff34);var _0x11698a=[];var _0x4d1157=squel[_0x3b90('0x3f')]()[_0x3b90('0x40')]('id')[_0x3b90('0x40')](_0x3b90('0x24'))['field'](_0x3b90('0x41'))['from']('tools_tags');var _0x283419=squel[_0x3b90('0x3f')]()['field'](_0x3b90('0x42'))[_0x3b90('0x40')](_0x3b90('0x43'))[_0x3b90('0x40')](_0x3b90('0x44'))[_0x3b90('0x45')](_0x3b90('0x46'),'ui')[_0x3b90('0x47')](_0x3b90('0x48'),'u','u.id\x20=\x20ui.UserId');var _0x3f71b0=squel[_0x3b90('0x3f')]()['from'](_0x3b90('0x49'),'i')[_0x3b90('0x47')](_0x3b90('0x4a'),'c',_0x3b90('0x4b'))[_0x3b90('0x47')]('users','o','o.id\x20=\x20i.UserId')[_0x3b90('0x47')]('sms_accounts','a',_0x3b90('0x4c'))[_0x3b90('0x47')](_0x3b90('0x4d'),'me',_0x3b90('0x4e'))[_0x3b90('0x47')]('sms_interaction_has_tags','it','it.SmsInteractionId\x20=\x20i.id')[_0x3b90('0x47')](_0x3b90('0x4f'),'t',_0x3b90('0x50'));var _0x5d7333=squel[_0x3b90('0x51')]();var _0x291279=[];var _0x18d59b=squel[_0x3b90('0x51')]();var _0x41e951;if(_0x143698[_0x3b90('0x31')][_0x3b90('0x52')]){_0x41e951=as[_0x3b90('0x53')](_0x143698[_0x3b90('0x31')]['search']);var _0xcc2f56=_0x41e951[_0x3b90('0x54')];for(var _0x2b5b6f=0x0;_0x2b5b6f<_0x41e951['conditions'][_0x3b90('0x38')];_0x2b5b6f++){var _0x4e9e75=_0x41e951[_0x3b90('0x55')][_0x2b5b6f];var _0x3fc270='i';var _0x98aeaf=_['find'](_0x25ff34,[_0x3b90('0x24'),_0x4e9e75[_0x3b90('0x40')]]);if(!_0x98aeaf){switch(_0x4e9e75['field']){case'unreadMessages':if(_0x4e9e75[_0x3b90('0x56')]==0x1){_0x3f71b0[_0x3b90('0x57')]('`'+_0x4e9e75[_0x3b90('0x40')]+_0x3b90('0x58'));}else{_0x3f71b0['having']('`'+_0x4e9e75['field']+_0x3b90('0x59'));}break;case _0x3b90('0x5a'):if(_0x4e9e75[_0x3b90('0x5b')]===_0x3b90('0x5c')){if(_0x4e9e75[_0x3b90('0x56')][_0x3b90('0x2b')]('\x20')[_0x3b90('0x38')]>0x1){_0x5d7333[_0xcc2f56](_0x3b90('0x5d'),qs[_0x3b90('0x5e')](_0x4e9e75['value']),null);}else{var _0x415a5d='%'+_0x4e9e75[_0x3b90('0x56')]+'%';_0x5d7333[_0xcc2f56]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x415a5d,_0x415a5d,_0x415a5d);}}else{_0x98aeaf=_[_0x3b90('0x5f')](_0x25ff34,[_0x3b90('0x24'),'ContactId']);_0x4e9e75[_0x3b90('0x40')]=_0x3b90('0x60');_0x536da7=as[_0x3b90('0x61')](_0x3fc270,_0x98aeaf[_0x3b90('0x2f')],_0x4e9e75);_0x5d7333[_0xcc2f56](_0x536da7[_0x3b90('0x62')],_0x536da7[_0x3b90('0x56')][_0x3b90('0x63')],_0x536da7['value'][_0x3b90('0x17')]);}break;case _0x3b90('0x64'):var _0x32a179=_0x4e9e75[_0x3b90('0x56')][_0x3b90('0x2b')](',')[_0x3b90('0x27')](function(_0x3ada12){return Number(_0x3ada12);});_0x32a179[_0x3b90('0x65')](function(_0x28ec05){_0x18d59b['or'](_0x3b90('0x66'),'%,'+_0x28ec05+',%');});_0x291279=_[_0x3b90('0x67')](_0x291279,_0x32a179);break;case _0x3b90('0x68'):if(_0x4e9e75[_0x3b90('0x5b')]===_0x3b90('0x5c')){_0x5d7333[_0xcc2f56](_0x3b90('0x69'),'%'+_0x4e9e75['value']+'%',null);}else{_0x98aeaf=_[_0x3b90('0x5f')](_0x25ff34,['name',_0x3b90('0x6a')]);_0x4e9e75[_0x3b90('0x40')]=_0x3b90('0x6a');_0x536da7=as[_0x3b90('0x61')](_0x3fc270,_0x98aeaf[_0x3b90('0x2f')],_0x4e9e75);_0x5d7333[_0xcc2f56](_0x536da7[_0x3b90('0x62')],_0x536da7['value'][_0x3b90('0x63')],_0x536da7[_0x3b90('0x56')][_0x3b90('0x17')]);}break;case _0x3b90('0x6b'):_0x536da7=as[_0x3b90('0x61')]('me',null,_0x4e9e75);_0x5d7333[_0xcc2f56](_0x536da7[_0x3b90('0x62')],_0x536da7['value'][_0x3b90('0x63')],_0x536da7[_0x3b90('0x56')][_0x3b90('0x17')]);break;}}else{var _0x536da7=as[_0x3b90('0x61')](_0x3fc270,_0x98aeaf[_0x3b90('0x2f')],_0x4e9e75);_0x5d7333[_0xcc2f56](_0x536da7[_0x3b90('0x62')],_0x536da7[_0x3b90('0x56')][_0x3b90('0x63')],_0x536da7[_0x3b90('0x56')][_0x3b90('0x17')]);}}}else{var _0x3e5bf7=_(_0x143698[_0x3b90('0x31')])['keys']()[_0x3b90('0x27')](function(_0x4a60f3){return _['some'](_0x25ff34,[_0x3b90('0x24'),_0x4a60f3])?_0x4a60f3:undefined;})[_0x3b90('0x6c')]()['value']();if(!_[_0x3b90('0x6d')](_0x3e5bf7)){_0x3e5bf7[_0x3b90('0x65')](function(_0x287be4){if(_0x287be4===_0x3b90('0x6e')){_0x3f71b0[_0x3b90('0x3d')](_0x3b90('0x6f'),[][_0x3b90('0x70')](_0x143698['query'][_0x287be4]));}else if(_0x287be4==='createdAt'){var _0x3e5532=JSON['parse'](_0x143698[_0x3b90('0x31')][_0x287be4])['$gte'];var _0x1a6d33=JSON['parse'](_0x143698['query'][_0x287be4])['$lte'];_0x3f71b0[_0x3b90('0x3d')](_0x3b90('0x71'),_0x3e5532,_0x1a6d33);}else{if(_0x143698[_0x3b90('0x31')][_0x287be4]===_0x3b90('0x72')){_0x3f71b0[_0x3b90('0x3d')]('i.'+_0x287be4+_0x3b90('0x73'));}else{_0x3f71b0[_0x3b90('0x3d')]('i.'+_0x287be4+'\x20=\x20?',_0x143698['query'][_0x287be4]);}}});}if(_0x143698['query'][_0x3b90('0x74')]){if(_0x143698[_0x3b90('0x31')]['read']==0x1){_0x3f71b0[_0x3b90('0x57')](_0x3b90('0x75'));}else{_0x3f71b0[_0x3b90('0x57')](_0x3b90('0x76'));}}if(_0x143698[_0x3b90('0x31')][_0x3b90('0x77')]){_0x291279=_[_0x3b90('0x78')](_0x143698[_0x3b90('0x31')][_0x3b90('0x77')])?_0x143698['query'][_0x3b90('0x77')]:new Array(_0x143698['query'][_0x3b90('0x77')]);_0x291279[_0x3b90('0x65')](function(_0x4b2c0f){_0x18d59b['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x4b2c0f+',%');});}if(_0x143698[_0x3b90('0x31')][_0x3b90('0x79')]){var _0x3f0f85=_0x143698[_0x3b90('0x31')][_0x3b90('0x79')][_0x3b90('0x7a')]('\x5c','\x5c\x5c')['replace']('\x27\x27',_0x3b90('0x7b'));if(qs[_0x3b90('0x7c')](_0x3f0f85)){_0x5d7333['or'](_0x3b90('0x7d'),_0x3f0f85+'%')['or']('i.phone\x20LIKE\x20?',_0x3f0f85+'%');}else{_0x5d7333['or'](_0x3b90('0x7e'),qs['getFullTextValue'](_0x3f0f85))['or'](_0x3b90('0x7f'),_0x3f0f85+'%');}}}_0x3f71b0[_0x3b90('0x3d')](_0x5d7333);_0x3f71b0[_0x3b90('0x80')](_0x3b90('0x81'));var _0x15fc75={'type':db[_0x3b90('0x82')]['QueryTypes'][_0x3b90('0x83')],'raw':!![]};var _0x230567=_0x3f71b0[_0x3b90('0x84')]();_0x230567[_0x3b90('0x40')](_0x3b90('0x81'));_0x230567[_0x3b90('0x40')](_0x3b90('0x85'),_0x3b90('0x86'));if(_0x401dc5['order']){_0x401dc5[_0x3b90('0x3b')][_0x3b90('0x65')](function(_0xb0160f){_0x3f71b0[_0x3b90('0x3b')]('i.'+_0xb0160f[0x0],_0xb0160f[0x1]===_0x3b90('0x87')?![]:!![]);});}if(!_[_0x3b90('0x6d')](_0x291279)){_0x3f71b0[_0x3b90('0x57')](_0x18d59b);_0x230567[_0x3b90('0x3d')]('t.id\x20IN\x20?',_0x291279);}BPromise['resolve']()[_0x3b90('0x20')](function(){if(!_0x41e951){if(_0x143698[_0x3b90('0x31')][_0x3b90('0x6e')]||_0x143698['query'][_0x3b90('0x88')])return;_0x230567['where']('i.SmsAccountId\x20IS\x20NOT\x20NULL');_0x3f71b0[_0x3b90('0x3d')](_0x3b90('0x89'));return;}return _0x143698[_0x3b90('0x8a')][_0x3b90('0x8b')]({'attributes':['id'],'raw':!![]})[_0x3b90('0x20')](function(_0x133c91){if(_[_0x3b90('0x6d')](_0x133c91)){_0x230567[_0x3b90('0x3d')](_0x3b90('0x8c'));_0x3f71b0[_0x3b90('0x3d')](_0x3b90('0x8c'));}else{_0x230567[_0x3b90('0x3d')](_0x3b90('0x6f'),_[_0x3b90('0x27')](_0x133c91,'id'));_0x3f71b0[_0x3b90('0x3d')]('i.SmsAccountId\x20IN\x20?',_[_0x3b90('0x27')](_0x133c91,'id'));}});})[_0x3b90('0x20')](function(){db['sequelize'][_0x3b90('0x31')](_0x230567['toString'](),_0x15fc75)[_0x3b90('0x20')](function(_0x38fab0){_0x5a97fe[_0x3b90('0x8d')]=_0x38fab0['length'];if(_0x5a97fe[_0x3b90('0x8d')]===0x0)return[];return db[_0x3b90('0x8e')][_0x3b90('0x31')](_0x4d1157[_0x3b90('0x8f')](),_0x15fc75)[_0x3b90('0x20')](function(_0x15befb){_0x11698a=_[_0x3b90('0x90')](_0x15befb,'id');_0x15fc75=_[_0x3b90('0x91')](_0x15fc75,{'model':db[_0x3b90('0x92')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x143698[_0x3b90('0x31')][_0x3b90('0x36')]){_0x401dc5[_0x3b90('0x37')]['forEach'](function(_0x5546af){_0x3f71b0['field']('i.'+_0x5546af);});}else{_0x3f71b0[_0x3b90('0x40')](_0x3b90('0x85'),_0x3b90('0x86'));_0x3f71b0[_0x3b90('0x40')](_0x3b90('0x93'),_0x3b90('0x94'));_0x3f71b0[_0x3b90('0x40')](_0x3b90('0x95'),_0x3b90('0x96'));_0x3f71b0[_0x3b90('0x40')](_0x3b90('0x97'));_0x3f71b0['field']('c.firstName',_0x3b90('0x98'));_0x3f71b0[_0x3b90('0x40')](_0x3b90('0x99'),_0x3b90('0x9a'));_0x3f71b0[_0x3b90('0x40')](_0x3b90('0x9b'),_0x3b90('0x9c'));_0x3f71b0[_0x3b90('0x40')](_0x3b90('0x9d'),_0x3b90('0x9e'));_0x3f71b0[_0x3b90('0x40')](_0x3b90('0x9f'),_0x3b90('0xa0'));_0x3f71b0[_0x3b90('0x40')](_0x3b90('0xa1'),_0x3b90('0xa2'));_0x3f71b0[_0x3b90('0x40')](_0x3b90('0xa3'),'Owner.fullname');_0x3f71b0[_0x3b90('0x40')](_0x3b90('0xa4'),_0x3b90('0xa5'));_0x3f71b0[_0x3b90('0x40')](_0x3b90('0xa6'),'TagIds');}if(_0x401dc5[_0x3b90('0x19')])_0x3f71b0[_0x3b90('0x19')](_0x401dc5[_0x3b90('0x19')]);if(_0x401dc5[_0x3b90('0x18')])_0x3f71b0[_0x3b90('0x18')](_0x401dc5[_0x3b90('0x18')]);return db['sequelize'][_0x3b90('0x31')](_0x3f71b0['toString'](),_0x15fc75);})['then'](function(_0x25b369){_0x283419[_0x3b90('0x3d')](_0x3b90('0xa7'),_[_0x3b90('0x27')](_0x25b369,'id'));return db[_0x3b90('0x8e')]['query'](_0x283419[_0x3b90('0x8f')](),_0x15fc75)[_0x3b90('0x20')](function(_0x429cd0){var _0x14d21d=_[_0x3b90('0xa8')](_0x429cd0,_0x3b90('0xa9'));var _0x19b070=[];_0x25b369[_0x3b90('0x65')](function(_0x2c2e24){_0x19b070[_0x3b90('0x2c')](updateSmsInteraction(_0x2c2e24,_0x11698a,_0x14d21d));});return BPromise[_0x3b90('0xaa')](_0x19b070);});});})[_0x3b90('0x20')](function(_0x468342){_0x5a97fe[_0x3b90('0xab')]=_0x468342;return _0x5a97fe;})[_0x3b90('0x20')](respondWithFilteredResult(_0x64a5e,_0x401dc5));})[_0x3b90('0xac')](handleError(_0x64a5e,null));};exports['show']=function(_0x13e661,_0x9fcc2){var _0x27100a={'raw':![],'where':{'id':_0x13e661[_0x3b90('0xad')]['id']}},_0x3c1958={};_0x3c1958[_0x3b90('0x35')]=_['keys'](db[_0x3b90('0x92')][_0x3b90('0xae')]);_0x3c1958[_0x3b90('0x31')]=_[_0x3b90('0x32')](_0x13e661[_0x3b90('0x31')]);_0x3c1958['filters']=_[_0x3b90('0x34')](_0x3c1958[_0x3b90('0x35')],_0x3c1958[_0x3b90('0x31')]);_0x27100a[_0x3b90('0x37')]=_['intersection'](_0x3c1958['model'],qs[_0x3b90('0x36')](_0x13e661['query'][_0x3b90('0x36')]));_0x27100a[_0x3b90('0x37')]=_0x27100a[_0x3b90('0x37')][_0x3b90('0x38')]?_0x27100a[_0x3b90('0x37')]:_0x3c1958['model'];if(_0x13e661[_0x3b90('0x31')]['includeAll']){_0x27100a[_0x3b90('0xaf')]=[{'all':!![]}];}_0x27100a=_[_0x3b90('0x91')]({},_0x27100a,_0x13e661[_0x3b90('0xb0')]);return db['SmsInteraction'][_0x3b90('0x5f')](_0x27100a)[_0x3b90('0x20')](handleEntityNotFound(_0x9fcc2,null))[_0x3b90('0x20')](respondWithResult(_0x9fcc2,null))['catch'](handleError(_0x9fcc2,null));};exports[_0x3b90('0xb1')]=function(_0x1dbc3d,_0x290a14){return db['SmsInteraction'][_0x3b90('0xb1')](_0x1dbc3d[_0x3b90('0x6b')],{})[_0x3b90('0x20')](respondWithResult(_0x290a14,0xc9))[_0x3b90('0xac')](handleError(_0x290a14,null));};exports[_0x3b90('0x1f')]=function(_0x456452,_0x50396d){if(_0x456452['body']['id']){delete _0x456452['body']['id'];}return db[_0x3b90('0x92')]['find']({'where':{'id':_0x456452[_0x3b90('0xad')]['id']}})[_0x3b90('0x20')](handleEntityNotFound(_0x50396d,null))[_0x3b90('0x20')](saveUpdates(_0x456452[_0x3b90('0x6b')],null))[_0x3b90('0x20')](respondWithResult(_0x50396d,null))['catch'](handleError(_0x50396d,null));};exports[_0x3b90('0xb2')]=function(_0x4b23be,_0x74241a){return db[_0x3b90('0x92')][_0x3b90('0x5f')]({'where':{'id':_0x4b23be['params']['id']}})[_0x3b90('0x20')](handleEntityNotFound(_0x74241a,null))[_0x3b90('0x20')](removeEntity(_0x74241a,null))[_0x3b90('0xac')](handleError(_0x74241a,null));};exports[_0x3b90('0xb3')]=function(_0x1be56f,_0x39eb5e){return db[_0x3b90('0x92')][_0x3b90('0xb3')]()['then'](respondWithResult(_0x39eb5e,null))[_0x3b90('0xac')](handleError(_0x39eb5e,null));};exports['addMessage']=function(_0x152170,_0x171ac6,_0x337da6){return db[_0x3b90('0xb4')][_0x3b90('0x5f')]({'where':{'id':_0x152170[_0x3b90('0xad')]['id']}})[_0x3b90('0x20')](handleEntityNotFound(_0x171ac6,null))['then'](function(_0x50ab1f){if(_0x50ab1f){return _0x50ab1f[_0x3b90('0xb5')](_0x152170[_0x3b90('0x6b')][_0x3b90('0xb6')],_[_0x3b90('0xb7')](_0x152170['body'],['ids','id'])||{});}})[_0x3b90('0x20')](respondWithResult(_0x171ac6,null))[_0x3b90('0xac')](handleError(_0x171ac6,null));};exports['getMessages']=function(_0x2c22e9,_0x3346d9,_0xabc9f9){var _0x1d3d2e={'raw':![],'where':{}};var _0x2cef2f={};var _0x4490da={'count':0x0,'rows':[]};return db['SmsInteraction'][_0x3b90('0xb8')]({'where':{'id':_0x2c22e9[_0x3b90('0xad')]['id']}})[_0x3b90('0x20')](handleEntityNotFound(_0x3346d9,null))[_0x3b90('0x20')](function(_0x13f288){if(_0x13f288){_0x2cef2f[_0x3b90('0x35')]=_[_0x3b90('0x32')](db[_0x3b90('0xb4')][_0x3b90('0xae')]);_0x2cef2f[_0x3b90('0x31')]=_[_0x3b90('0x32')](_0x2c22e9['query']);_0x2cef2f['filters']=_['intersection'](_0x2cef2f['model'],_0x2cef2f[_0x3b90('0x31')]);_0x1d3d2e[_0x3b90('0x37')]=_[_0x3b90('0x34')](_0x2cef2f[_0x3b90('0x35')],qs[_0x3b90('0x36')](_0x2c22e9[_0x3b90('0x31')][_0x3b90('0x36')]));_0x1d3d2e[_0x3b90('0x37')]=_0x1d3d2e[_0x3b90('0x37')]['length']?_0x1d3d2e[_0x3b90('0x37')]:_0x2cef2f['model'];if(!_0x2c22e9['query'][_0x3b90('0x39')](_0x3b90('0x3a'))){_0x1d3d2e[_0x3b90('0x19')]=qs[_0x3b90('0x19')](_0x2c22e9[_0x3b90('0x31')]['limit']);_0x1d3d2e[_0x3b90('0x18')]=qs['offset'](_0x2c22e9[_0x3b90('0x31')][_0x3b90('0x18')]);}_0x1d3d2e[_0x3b90('0x3b')]=qs[_0x3b90('0x3c')](_0x2c22e9[_0x3b90('0x31')][_0x3b90('0x3c')]);_0x1d3d2e[_0x3b90('0x3d')]=qs[_0x3b90('0x33')](_[_0x3b90('0x3e')](_0x2c22e9[_0x3b90('0x31')],_0x2cef2f['filters']));_0x1d3d2e[_0x3b90('0x3d')][_0x3b90('0xa9')]=_0x13f288['id'];if(_0x2c22e9[_0x3b90('0x31')][_0x3b90('0x79')]){_0x1d3d2e[_0x3b90('0x3d')]=_[_0x3b90('0x91')](_0x1d3d2e[_0x3b90('0x3d')],{'$or':_[_0x3b90('0x27')](_0x1d3d2e[_0x3b90('0x37')],function(_0x383979){var _0xc4bb54={};_0xc4bb54[_0x383979]={'$like':'%'+_0x2c22e9['query'][_0x3b90('0x79')]+'%'};return _0xc4bb54;})});}if(_0x2c22e9[_0x3b90('0x31')]['$gte']){var _0x3c042e=_0x2c22e9[_0x3b90('0x31')][_0x3b90('0xb9')][_0x3b90('0x2b')](',');var _0x57b104={};_0x57b104[_0x3c042e[0x0]]={'$gte':moment(_0x3c042e[0x1])[_0x3b90('0xba')]('YYYY-MM-DD\x20HH:mm:ss')};_0x1d3d2e['where']=_['merge'](_0x1d3d2e['where'],_0x57b104);}_0x1d3d2e=_[_0x3b90('0x91')]({},_0x1d3d2e,_0x2c22e9[_0x3b90('0xb0')]);return db[_0x3b90('0xb4')][_0x3b90('0x8d')]({'where':_0x1d3d2e[_0x3b90('0x3d')]})[_0x3b90('0x20')](function(_0x22ead2){_0x4490da[_0x3b90('0x8d')]=_0x22ead2;if(_0x2c22e9['query'][_0x3b90('0xbb')]){_0x1d3d2e[_0x3b90('0xaf')]=[{'all':!![]}];}return db['SmsMessage'][_0x3b90('0xbc')](_0x1d3d2e);})[_0x3b90('0x20')](function(_0x54bbba){_0x4490da[_0x3b90('0xab')]=_0x54bbba;return _0x4490da;});}})['then'](respondWithFilteredResult(_0x3346d9,_0x1d3d2e))[_0x3b90('0xac')](handleError(_0x3346d9,null));};exports['addTags']=function(_0x293642,_0x293197,_0x5b9fd1){return db['SmsInteraction'][_0x3b90('0x5f')]({'where':{'id':_0x293642[_0x3b90('0xad')]['id']}})[_0x3b90('0x20')](handleEntityNotFound(_0x293197,null))['then'](function(_0x27f114){if(_0x27f114){return _0x27f114['setTags'](_0x293642[_0x3b90('0x6b')]['ids'],_[_0x3b90('0xb7')](_0x293642[_0x3b90('0x6b')],[_0x3b90('0xb6'),'id'])||{})[_0x3b90('0xbd')](function(){return db[_0x3b90('0x64')][_0x3b90('0xbc')]({'attributes':['id','name',_0x3b90('0x41')],'where':{'id':_0x293642[_0x3b90('0x6b')]['ids']}});})[_0x3b90('0x20')](function(_0x379031){socket[_0x3b90('0xbe')](_0x3b90('0xbf'),{'id':Number(_0x293642['params']['id']),'tags':_0x379031||[]});return{'id':Number(_0x293642['params']['id']),'tags':_0x379031||[]};});}})[_0x3b90('0x20')](respondWithResult(_0x293197,null))[_0x3b90('0xac')](handleError(_0x293197,null));};exports['removeTags']=function(_0x4fe659,_0x352adc,_0x105b8e){return db[_0x3b90('0x92')]['find']({'where':{'id':_0x4fe659[_0x3b90('0xad')]['id']}})[_0x3b90('0x20')](handleEntityNotFound(_0x352adc,null))[_0x3b90('0x20')](function(_0x1b6c29){if(_0x1b6c29){return _0x1b6c29[_0x3b90('0xc0')](_0x4fe659[_0x3b90('0x31')][_0x3b90('0xb6')]);}})['then'](respondWithStatusCode(_0x352adc,null))[_0x3b90('0xac')](handleError(_0x352adc,null));};exports[_0x3b90('0xc1')]=function(_0xd84ba2,_0x364f0e){var _0x450a46=moment()[_0x3b90('0xc2')]()['toString']();var _0x4f154f=path[_0x3b90('0xc3')](config[_0x3b90('0xc4')],_0x3b90('0xc5'),_0x3b90('0xc6'),_0x3b90('0xc7'));var _0x5ce783=path[_0x3b90('0xc3')](config[_0x3b90('0xc4')],'server',_0x3b90('0xc6'),_0x3b90('0xc8'));var _0x4e1dac=path[_0x3b90('0xc3')](_0x4f154f,_0x450a46);var _0xbc60a4=util['format']('transcript-%d-%s.zip',_0xd84ba2['params']['id'],_0x450a46);var _0x5a4736=path[_0x3b90('0xc3')](_0x4f154f,_0xbc60a4);var _0x368a65=[];_0x368a65[_0x3b90('0x2c')]({'model':db['User'],'as':_0x3b90('0x68'),'attributes':['id',_0x3b90('0x28')],'raw':!![]});_0x368a65[_0x3b90('0x2c')]({'model':db[_0x3b90('0xc9')],'as':_0x3b90('0x5a'),'attributes':['id',_0x3b90('0xca'),'lastName'],'raw':!![]});var _0x428fc7=[{'model':db['SmsMessage'],'as':_0x3b90('0xcb'),'attributes':['id',_0x3b90('0x6b'),'createdAt','direction',_0x3b90('0xcc'),_0x3b90('0x74')],'include':_0x368a65}];_0x428fc7[_0x3b90('0x2c')]({'model':db[_0x3b90('0xcd')],'as':_0x3b90('0xce'),'attributes':['id',_0x3b90('0x24')]});_0x428fc7[_0x3b90('0x2c')]({'model':db[_0x3b90('0x68')],'as':_0x3b90('0xcf'),'attributes':['id',_0x3b90('0x28')]});return db[_0x3b90('0x92')][_0x3b90('0x5f')]({'where':{'id':_0xd84ba2['params']['id']},'include':_0x428fc7})[_0x3b90('0x20')](handleEntityNotFound(_0x364f0e,null))[_0x3b90('0x20')](function(_0x318679){if(_0x318679){var _0x462a16=_0x318679[_0x3b90('0xd0')]({'plain':!![]});fs[_0x3b90('0xd1')](_0x4e1dac);var _0x53df48={'format':'A4','border':_0x3b90('0xd2'),'header':{'height':_0x3b90('0xd3'),'contents':{'first':_0x3b90('0xd4')}},'footer':{'height':'30px','contents':{'default':util[_0x3b90('0xba')](_0x3b90('0xd5'),util['format'](_0x3b90('0xd6'),_0x3b90('0xd7'),_0x462a16['id']),moment()[_0x3b90('0xba')](_0x3b90('0xd8'))['toString']())}}};var _0x222229={'channel':_0x3b90('0xd7'),'account':_0x462a16[_0x3b90('0xce')][_0x3b90('0x24')],'agent':_0x462a16['Owner']?_0x462a16[_0x3b90('0xcf')][_0x3b90('0x28')]:_0x3b90('0xd9'),'createdAt':moment(_0x462a16[_0x3b90('0xda')])[_0x3b90('0xba')](_0x3b90('0xdb'))[_0x3b90('0x8f')](),'closedAt':_0x462a16[_0x3b90('0xdc')]?moment(_0x462a16[_0x3b90('0xdd')])[_0x3b90('0xba')](_0x3b90('0xdb'))[_0x3b90('0x8f')]():'','disposition':_0x462a16[_0x3b90('0xde')],'messages':_(_0x462a16[_0x3b90('0xcb')])[_0x3b90('0x79')]({'secret':![]})[_0x3b90('0x27')](function(_0x427ce8){return{'date':moment(_0x427ce8['createdAt'])[_0x3b90('0xba')]('YYYY-MM-DD\x20HH:mm:ss')[_0x3b90('0x8f')](),'sender':_0x427ce8[_0x3b90('0xdf')]===_0x3b90('0xe0')?_0x427ce8[_0x3b90('0x68')]?_0x427ce8[_0x3b90('0x68')][_0x3b90('0x28')]:_0x3b90('0xe1'):_0x427ce8[_0x3b90('0x5a')][_0x3b90('0xca')]+(_0x427ce8[_0x3b90('0x5a')][_0x3b90('0xe2')]?'\x20'+_0x427ce8[_0x3b90('0x5a')]['lastName']:''),'body':_0x427ce8['body'],'direction':_0x427ce8[_0x3b90('0xdf')]==='out'?'A':'C','secret':_0x427ce8[_0x3b90('0xcc')],'read':_0x427ce8[_0x3b90('0x74')]};})[_0x3b90('0x56')]()};return ejs[_0x3b90('0xe3')](path[_0x3b90('0xc3')](config[_0x3b90('0xc4')],'server',_0x3b90('0xe4'),_0x3b90('0xe5')),{'interaction':_0x222229})[_0x3b90('0x20')](function(_0x25a7b7){return new BPromise(function(_0x217be5,_0x46da40){pdf[_0x3b90('0xb1')](_0x25a7b7,_0x53df48)['toFile'](path['join'](_0x4e1dac,_0x3b90('0xe6')+_0x462a16['id']+'-'+_0x450a46+_0x3b90('0xe7')),function(_0x476605,_0x580cc3){if(_0x476605)return _0x46da40(_0x476605);_0x217be5(_0x580cc3);});});})[_0x3b90('0x20')](function(){return new BPromise(function(_0x1d5fe8,_0x115518){zipdir(_0x4e1dac,{'saveTo':_0x5a4736},function(_0x466166,_0x2e1a1e){if(_0x466166)return _0x115518(_0x466166);return _0x1d5fe8(_0x2e1a1e);});})[_0x3b90('0x20')](function(){return new BPromise(function(_0x1afa92,_0x49e993){rimraf(_0x4e1dac,function(_0x49c2cf){if(_0x49c2cf)_0x49e993(_0x49c2cf);return _0x1afa92();});});})[_0x3b90('0x20')](function(){return _0x364f0e[_0x3b90('0xc1')](_0x5a4736,_0xbc60a4,function(_0x175fe0){if(_0x175fe0){console[_0x3b90('0xe8')](_0x3b90('0xe9'),_0x175fe0);}else{fs[_0x3b90('0xea')](_0x5a4736);}});});});}else{return _0x364f0e[_0x3b90('0x21')](0xc8);}})['catch'](handleError(_0x364f0e,null));}; \ No newline at end of file +var _0xee5b=['download','unix','join','root','tmp','server','files','attachments','transcript-%d-%s.zip','CmContact','firstName','Messages','SmsAccount','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','%s\x20#%d','Sms','closed','disposition','direction','out','lastName','secret','renderFile','downloadInteraction.html','toFile','transcript-','.pdf','log','err','unlinkSync','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./smsInteraction.socket','register','status','json','count','offset','limit','set','Content-Range','reject','update','then','sendStatus','error','name','send','Users','map','fullname','Tags','split','push','TagIds','catch','SmsInteraction','type','key','model','query','keys','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','select','field','color','from','tools_tags','u.id','u.fullname','user_has_sms_interactions','u.id\x20=\x20ui.UserId','sms_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','left_join','users','o.id\x20=\x20i.UserId','sms_accounts','sms_messages','me.SmsInteractionId\x20=\x20i.id','it.SmsInteractionId\x20=\x20i.id','expr','search','parseSearch','sqlOperator','conditions','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','buildExpression','text','end','Tag','forEach','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','find','UserId','start','body','some','compact','concat','createdAt','$gte','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','DESC','isEmpty','t.id\x20IN\x20?','resolve','journey','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','i.SmsAccountId\x20IN\x20?','sequelize','toString','keyBy','merge','fields','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','Contact.fax','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','SmsInteractionId','all','rows','show','params','rawAttributes','includeAll','include','options','destroy','describe','addMessage','SmsMessage','ids','omit','getMessages','findOne','format','YYYY-MM-DD\x20HH:mm:ss','addTags','setTags','findAll','emit','smsInteractionTags:save'];(function(_0x1b828b,_0x344400){var _0x98da1a=function(_0x1a0f5b){while(--_0x1a0f5b){_0x1b828b['push'](_0x1b828b['shift']());}};_0x98da1a(++_0x344400);}(_0xee5b,0x1f4));var _0xbee5=function(_0xf5c6d5,_0x437dd2){_0xf5c6d5=_0xf5c6d5-0x0;var _0x24264d=_0xee5b[_0xf5c6d5];return _0x24264d;};'use strict';var pdf=require(_0xbee5('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xbee5('0x1'));var zipdir=require(_0xbee5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbee5('0x3'));var moment=require(_0xbee5('0x4'));var BPromise=require(_0xbee5('0x5'));var Mustache=require(_0xbee5('0x6'));var util=require('util');var path=require('path');var sox=require(_0xbee5('0x7'));var csv=require(_0xbee5('0x8'));var ejs=require(_0xbee5('0x9'));var fs=require('fs');var _=require(_0xbee5('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xbee5('0xb'));var Papa=require(_0xbee5('0xc'));var Redis=require(_0xbee5('0xd'));var authService=require(_0xbee5('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xbee5('0xf'));var hardwareService=require(_0xbee5('0x10'));var logger=require(_0xbee5('0x11'))(_0xbee5('0x12'));var utils=require(_0xbee5('0x13'));var config=require(_0xbee5('0x14'));var db=require(_0xbee5('0x15'))['db'];config[_0xbee5('0x16')]=_[_0xbee5('0x17')](config['redis'],{'host':_0xbee5('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbee5('0x16')]));require(_0xbee5('0x19'))[_0xbee5('0x1a')](socket);function respondWithStatusCode(_0x593ecb,_0x5092f2){_0x5092f2=_0x5092f2||0xcc;return function(_0x3c6e56){if(_0x3c6e56){return _0x593ecb['sendStatus'](_0x5092f2);}return _0x593ecb[_0xbee5('0x1b')](_0x5092f2)['end']();};}function respondWithResult(_0x1a24bd,_0x141878){_0x141878=_0x141878||0xc8;return function(_0xf676b1){if(_0xf676b1){return _0x1a24bd['status'](_0x141878)[_0xbee5('0x1c')](_0xf676b1);}};}function respondWithFilteredResult(_0x662d2c,_0x5a0ae5){return function(_0x254dd3){if(_0x254dd3){var _0x538460=_0x254dd3[_0xbee5('0x1d')],_0x11b4a3=_0x5a0ae5[_0xbee5('0x1e')],_0x3c3f4e=_0x5a0ae5[_0xbee5('0x1e')]+_0x5a0ae5[_0xbee5('0x1f')],_0x35eb5c;if(_0x3c3f4e>=_0x538460){_0x3c3f4e=_0x538460;_0x35eb5c=0xc8;}else{_0x35eb5c=0xce;}_0x662d2c[_0xbee5('0x1b')](_0x35eb5c);return _0x662d2c[_0xbee5('0x20')](_0xbee5('0x21'),_0x11b4a3+'-'+_0x3c3f4e+'/'+_0x538460)[_0xbee5('0x1c')](_0x254dd3);}return null;};}function patchUpdates(_0x40a06){return function(_0x450824){try{jsonpatch['apply'](_0x450824,_0x40a06,!![]);}catch(_0x550325){return BPromise[_0xbee5('0x22')](_0x550325);}return _0x450824['save']();};}function saveUpdates(_0x205491,_0x117cb3){return function(_0x3cee7f){if(_0x3cee7f){return _0x3cee7f[_0xbee5('0x23')](_0x205491)[_0xbee5('0x24')](function(_0xb665df){return _0xb665df;});}return null;};}function removeEntity(_0x359ccf,_0x3cfa8d){return function(_0xc79035){if(_0xc79035){return _0xc79035['destroy']()['then'](function(){_0x359ccf['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x50d774,_0x1af3de){return function(_0x18d7f4){if(!_0x18d7f4){_0x50d774[_0xbee5('0x25')](0x194);}return _0x18d7f4;};}function handleError(_0x28c74d,_0x169042){_0x169042=_0x169042||0x1f4;return function(_0x20e7e8){logger[_0xbee5('0x26')](_0x20e7e8['stack']);if(_0x20e7e8[_0xbee5('0x27')]){delete _0x20e7e8[_0xbee5('0x27')];}_0x28c74d[_0xbee5('0x1b')](_0x169042)[_0xbee5('0x28')](_0x20e7e8);};}function getInteractionUsers(_0x1a8bcc,_0x5f0419){return new BPromise(function(_0x21b993,_0x15ffb1){try{if(_0x5f0419[_0x1a8bcc['id']]){_0x1a8bcc[_0xbee5('0x29')]=_[_0xbee5('0x2a')](_0x5f0419[_0x1a8bcc['id']],function(_0xa57f85){return{'id':_0xa57f85['id'],'fullname':_0xa57f85[_0xbee5('0x2b')]};});}}catch(_0x34b7df){_0x15ffb1(_0x34b7df);}_0x21b993(_0x1a8bcc);});}function getInteractionTags(_0x36e8bb,_0x2ccb91){return new BPromise(function(_0x59c2e4,_0x22df5f){try{if(_0x36e8bb['TagIds']){_0x36e8bb[_0xbee5('0x2c')]=[];_0x36e8bb['TagIds'][_0xbee5('0x2d')](',')['forEach'](function(_0x35609d){_0x36e8bb['Tags'][_0xbee5('0x2e')](_0x2ccb91[_0x35609d]);});}delete _0x36e8bb[_0xbee5('0x2f')];}catch(_0x36eb70){_0x22df5f(_0x36eb70);}_0x59c2e4(_0x36e8bb);});}function updateSmsInteraction(_0x751489,_0x502e55,_0xefbf7c){return new BPromise(function(_0x17aa8d,_0x477a03){return getInteractionUsers(_0x751489,_0xefbf7c)[_0xbee5('0x24')](function(_0x57861d){return getInteractionTags(_0x57861d,_0x502e55);})[_0xbee5('0x24')](function(_0x28f8e3){_0x17aa8d(_0x28f8e3);})[_0xbee5('0x30')](function(_0x30a2fc){_0x477a03(_0x30a2fc);});});}exports['index']=function(_0x1b092d,_0xe61341){var _0x3e854={},_0x33aaba={},_0x52ecf1={'count':0x0,'rows':[]};var _0x3c8a87=_['map'](db[_0xbee5('0x31')]['rawAttributes'],function(_0x5edf19){return{'name':_0x5edf19['fieldName'],'type':_0x5edf19[_0xbee5('0x32')][_0xbee5('0x33')]};});_0x33aaba[_0xbee5('0x34')]=_[_0xbee5('0x2a')](_0x3c8a87,_0xbee5('0x27'));_0x33aaba[_0xbee5('0x35')]=_[_0xbee5('0x36')](_0x1b092d[_0xbee5('0x35')]);_0x33aaba['filters']=_[_0xbee5('0x37')](_0x33aaba['model'],_0x33aaba[_0xbee5('0x35')]);_0x3e854[_0xbee5('0x38')]=_[_0xbee5('0x37')](_0x33aaba[_0xbee5('0x34')],qs['fields'](_0x1b092d[_0xbee5('0x35')]['fields']));_0x3e854['attributes']=_0x3e854[_0xbee5('0x38')][_0xbee5('0x39')]?_0x3e854[_0xbee5('0x38')]:_0x33aaba[_0xbee5('0x34')];if(!_0x1b092d['query'][_0xbee5('0x3a')](_0xbee5('0x3b'))){_0x3e854[_0xbee5('0x1f')]=qs[_0xbee5('0x1f')](_0x1b092d[_0xbee5('0x35')][_0xbee5('0x1f')]);_0x3e854[_0xbee5('0x1e')]=qs[_0xbee5('0x1e')](_0x1b092d[_0xbee5('0x35')][_0xbee5('0x1e')]);}_0x3e854['order']=qs[_0xbee5('0x3c')](_0x1b092d[_0xbee5('0x35')]['sort']);_0x3e854[_0xbee5('0x3d')]=qs[_0xbee5('0x3e')](_[_0xbee5('0x3f')](_0x1b092d[_0xbee5('0x35')],_0x33aaba['filters']),_0x3c8a87);var _0x4cfe54=[];var _0x4b4641=squel[_0xbee5('0x40')]()[_0xbee5('0x41')]('id')[_0xbee5('0x41')](_0xbee5('0x27'))[_0xbee5('0x41')](_0xbee5('0x42'))[_0xbee5('0x43')](_0xbee5('0x44'));var _0x4772ae=squel['select']()['field'](_0xbee5('0x45'))['field'](_0xbee5('0x46'))[_0xbee5('0x41')]('ui.SmsInteractionId')[_0xbee5('0x43')](_0xbee5('0x47'),'ui')['left_join']('users','u',_0xbee5('0x48'));var _0xd805b1=squel['select']()[_0xbee5('0x43')](_0xbee5('0x49'),'i')['left_join'](_0xbee5('0x4a'),'c',_0xbee5('0x4b'))[_0xbee5('0x4c')](_0xbee5('0x4d'),'o',_0xbee5('0x4e'))[_0xbee5('0x4c')](_0xbee5('0x4f'),'a','a.id\x20=\x20i.SmsAccountId')[_0xbee5('0x4c')](_0xbee5('0x50'),'me',_0xbee5('0x51'))[_0xbee5('0x4c')]('sms_interaction_has_tags','it',_0xbee5('0x52'))[_0xbee5('0x4c')](_0xbee5('0x44'),'t','t.id\x20=\x20it.TagId');var _0x44d4b1=squel[_0xbee5('0x53')]();var _0x590f06=[];var _0x5a6cc2=squel['expr']();var _0x3a27bb;if(_0x1b092d['query'][_0xbee5('0x54')]){_0x3a27bb=as[_0xbee5('0x55')](_0x1b092d[_0xbee5('0x35')][_0xbee5('0x54')]);var _0x6db065=_0x3a27bb[_0xbee5('0x56')];for(var _0x55e654=0x0;_0x55e654<_0x3a27bb[_0xbee5('0x57')][_0xbee5('0x39')];_0x55e654++){var _0x3c7947=_0x3a27bb[_0xbee5('0x57')][_0x55e654];var _0x4a9f23='i';var _0x98b160=_['find'](_0x3c8a87,[_0xbee5('0x27'),_0x3c7947[_0xbee5('0x41')]]);if(!_0x98b160){switch(_0x3c7947[_0xbee5('0x41')]){case _0xbee5('0x58'):if(_0x3c7947[_0xbee5('0x59')]==0x1){_0xd805b1[_0xbee5('0x5a')]('`'+_0x3c7947[_0xbee5('0x41')]+_0xbee5('0x5b'));}else{_0xd805b1[_0xbee5('0x5a')]('`'+_0x3c7947[_0xbee5('0x41')]+_0xbee5('0x5c'));}break;case _0xbee5('0x5d'):if(_0x3c7947[_0xbee5('0x5e')]===_0xbee5('0x5f')){if(_0x3c7947[_0xbee5('0x59')]['split']('\x20')[_0xbee5('0x39')]>0x1){_0x44d4b1[_0x6db065](_0xbee5('0x60'),qs[_0xbee5('0x61')](_0x3c7947['value']),null);}else{var _0x281d1d='%'+_0x3c7947[_0xbee5('0x59')]+'%';_0x44d4b1[_0x6db065](_0xbee5('0x62'),_0x281d1d,_0x281d1d,_0x281d1d);}}else{_0x98b160=_['find'](_0x3c8a87,[_0xbee5('0x27'),'ContactId']);_0x3c7947[_0xbee5('0x41')]='ContactId';_0x9c0fbb=as[_0xbee5('0x63')](_0x4a9f23,_0x98b160[_0xbee5('0x32')],_0x3c7947);_0x44d4b1[_0x6db065](_0x9c0fbb[_0xbee5('0x64')],_0x9c0fbb['value']['start'],_0x9c0fbb['value'][_0xbee5('0x65')]);}break;case _0xbee5('0x66'):var _0xbc3da7=_0x3c7947['value'][_0xbee5('0x2d')](',')['map'](function(_0x21492a){return Number(_0x21492a);});_0xbc3da7[_0xbee5('0x67')](function(_0x32ec82){_0x5a6cc2['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x32ec82+',%');});_0x590f06=_[_0xbee5('0x68')](_0x590f06,_0xbc3da7);break;case _0xbee5('0x69'):if(_0x3c7947[_0xbee5('0x5e')]===_0xbee5('0x5f')){_0x44d4b1[_0x6db065](_0xbee5('0x6a'),'%'+_0x3c7947[_0xbee5('0x59')]+'%',null);}else{_0x98b160=_[_0xbee5('0x6b')](_0x3c8a87,[_0xbee5('0x27'),_0xbee5('0x6c')]);_0x3c7947[_0xbee5('0x41')]=_0xbee5('0x6c');_0x9c0fbb=as[_0xbee5('0x63')](_0x4a9f23,_0x98b160[_0xbee5('0x32')],_0x3c7947);_0x44d4b1[_0x6db065](_0x9c0fbb[_0xbee5('0x64')],_0x9c0fbb[_0xbee5('0x59')][_0xbee5('0x6d')],_0x9c0fbb[_0xbee5('0x59')]['end']);}break;case _0xbee5('0x6e'):_0x9c0fbb=as['buildExpression']('me',null,_0x3c7947);_0x44d4b1[_0x6db065](_0x9c0fbb['text'],_0x9c0fbb[_0xbee5('0x59')][_0xbee5('0x6d')],_0x9c0fbb['value']['end']);break;}}else{var _0x9c0fbb=as['buildExpression'](_0x4a9f23,_0x98b160[_0xbee5('0x32')],_0x3c7947);_0x44d4b1[_0x6db065](_0x9c0fbb[_0xbee5('0x64')],_0x9c0fbb['value'][_0xbee5('0x6d')],_0x9c0fbb[_0xbee5('0x59')][_0xbee5('0x65')]);}}}else{var _0x1be42a=_(_0x1b092d['query'])[_0xbee5('0x36')]()['map'](function(_0x3294f1){return _[_0xbee5('0x6f')](_0x3c8a87,['name',_0x3294f1])?_0x3294f1:undefined;})[_0xbee5('0x70')]()[_0xbee5('0x59')]();if(!_['isEmpty'](_0x1be42a)){_0x1be42a[_0xbee5('0x67')](function(_0x2b6d1a){if(_0x2b6d1a==='SmsAccountId'){_0xd805b1[_0xbee5('0x3d')]('i.SmsAccountId\x20IN\x20?',[][_0xbee5('0x71')](_0x1b092d['query'][_0x2b6d1a]));}else if(_0x2b6d1a===_0xbee5('0x72')){var _0x536269=JSON['parse'](_0x1b092d[_0xbee5('0x35')][_0x2b6d1a])[_0xbee5('0x73')];var _0x3b5eda=JSON[_0xbee5('0x74')](_0x1b092d[_0xbee5('0x35')][_0x2b6d1a])[_0xbee5('0x75')];_0xd805b1['where'](_0xbee5('0x76'),_0x536269,_0x3b5eda);}else{if(_0x1b092d[_0xbee5('0x35')][_0x2b6d1a]===_0xbee5('0x77')){_0xd805b1[_0xbee5('0x3d')]('i.'+_0x2b6d1a+_0xbee5('0x78'));}else{_0xd805b1[_0xbee5('0x3d')]('i.'+_0x2b6d1a+_0xbee5('0x79'),_0x1b092d[_0xbee5('0x35')][_0x2b6d1a]);}}});}if(_0x1b092d[_0xbee5('0x35')]['read']){if(_0x1b092d[_0xbee5('0x35')][_0xbee5('0x7a')]==0x1){_0xd805b1[_0xbee5('0x5a')](_0xbee5('0x7b'));}else{_0xd805b1['having'](_0xbee5('0x7c'));}}if(_0x1b092d[_0xbee5('0x35')][_0xbee5('0x7d')]){_0x590f06=_[_0xbee5('0x7e')](_0x1b092d[_0xbee5('0x35')][_0xbee5('0x7d')])?_0x1b092d[_0xbee5('0x35')][_0xbee5('0x7d')]:new Array(_0x1b092d[_0xbee5('0x35')][_0xbee5('0x7d')]);_0x590f06[_0xbee5('0x67')](function(_0x24cd85){_0x5a6cc2['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x24cd85+',%');});}if(_0x1b092d[_0xbee5('0x35')][_0xbee5('0x7f')]){var _0x522463=_0x1b092d[_0xbee5('0x35')]['filter'][_0xbee5('0x80')]('\x5c','\x5c\x5c')[_0xbee5('0x80')]('\x27\x27','\x27\x27\x27\x27');if(qs[_0xbee5('0x81')](_0x522463)){_0x44d4b1['or']('i.id\x20LIKE\x20?',_0x522463+'%')['or']('i.phone\x20LIKE\x20?',_0x522463+'%');}else{_0x44d4b1['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x522463))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x522463+'%');}}}_0xd805b1['where'](_0x44d4b1);_0xd805b1[_0xbee5('0x82')](_0xbee5('0x83'));var _0x35b5ff={'type':db[_0xbee5('0x84')][_0xbee5('0x85')][_0xbee5('0x86')],'raw':!![]};var _0x40cc07=_0xd805b1[_0xbee5('0x87')]();_0x40cc07[_0xbee5('0x41')](_0xbee5('0x83'));_0x40cc07[_0xbee5('0x41')](_0xbee5('0x88'),'unreadMessages');if(_0x3e854[_0xbee5('0x89')]){_0x3e854[_0xbee5('0x89')]['forEach'](function(_0x51309d){_0xd805b1[_0xbee5('0x89')]('i.'+_0x51309d[0x0],_0x51309d[0x1]===_0xbee5('0x8a')?![]:!![]);});}if(!_[_0xbee5('0x8b')](_0x590f06)){_0xd805b1['having'](_0x5a6cc2);_0x40cc07[_0xbee5('0x3d')](_0xbee5('0x8c'),_0x590f06);}BPromise[_0xbee5('0x8d')]()['then'](function(){if(!_0x3a27bb){if(_0x1b092d['query']['SmsAccountId']||_0x1b092d[_0xbee5('0x35')][_0xbee5('0x8e')])return;_0x40cc07[_0xbee5('0x3d')](_0xbee5('0x8f'));_0xd805b1[_0xbee5('0x3d')](_0xbee5('0x8f'));return;}return _0x1b092d[_0xbee5('0x90')][_0xbee5('0x91')]({'attributes':['id'],'raw':!![]})['then'](function(_0x593a8e){if(_[_0xbee5('0x8b')](_0x593a8e)){_0x40cc07[_0xbee5('0x3d')]('i.SmsAccountId\x20IS\x20NULL');_0xd805b1['where'](_0xbee5('0x92'));}else{_0x40cc07['where']('i.SmsAccountId\x20IN\x20?',_[_0xbee5('0x2a')](_0x593a8e,'id'));_0xd805b1['where'](_0xbee5('0x93'),_[_0xbee5('0x2a')](_0x593a8e,'id'));}});})['then'](function(){db[_0xbee5('0x94')][_0xbee5('0x35')](_0x40cc07[_0xbee5('0x95')](),_0x35b5ff)[_0xbee5('0x24')](function(_0x28f5a0){_0x52ecf1['count']=_0x28f5a0['length'];if(_0x52ecf1[_0xbee5('0x1d')]===0x0)return[];return db['sequelize'][_0xbee5('0x35')](_0x4b4641['toString'](),_0x35b5ff)[_0xbee5('0x24')](function(_0x387032){_0x4cfe54=_[_0xbee5('0x96')](_0x387032,'id');_0x35b5ff=_[_0xbee5('0x97')](_0x35b5ff,{'model':db[_0xbee5('0x31')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1b092d[_0xbee5('0x35')][_0xbee5('0x98')]){_0x3e854[_0xbee5('0x38')][_0xbee5('0x67')](function(_0xcd0388){_0xd805b1[_0xbee5('0x41')]('i.'+_0xcd0388);});}else{_0xd805b1[_0xbee5('0x41')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xbee5('0x58'));_0xd805b1[_0xbee5('0x41')](_0xbee5('0x99'),_0xbee5('0x9a'));_0xd805b1['field'](_0xbee5('0x9b'),_0xbee5('0x9c'));_0xd805b1[_0xbee5('0x41')](_0xbee5('0x9d'));_0xd805b1[_0xbee5('0x41')](_0xbee5('0x9e'),_0xbee5('0x9f'));_0xd805b1[_0xbee5('0x41')]('c.lastName',_0xbee5('0xa0'));_0xd805b1[_0xbee5('0x41')](_0xbee5('0xa1'),_0xbee5('0xa2'));_0xd805b1[_0xbee5('0x41')](_0xbee5('0xa3'),_0xbee5('0xa4'));_0xd805b1[_0xbee5('0x41')](_0xbee5('0xa5'),_0xbee5('0xa6'));_0xd805b1[_0xbee5('0x41')]('c.fax',_0xbee5('0xa7'));_0xd805b1[_0xbee5('0x41')]('o.fullname',_0xbee5('0xa8'));_0xd805b1[_0xbee5('0x41')](_0xbee5('0xa9'),'Owner.internal');_0xd805b1[_0xbee5('0x41')](_0xbee5('0xaa'),_0xbee5('0x2f'));}if(_0x3e854[_0xbee5('0x1f')])_0xd805b1[_0xbee5('0x1f')](_0x3e854[_0xbee5('0x1f')]);if(_0x3e854[_0xbee5('0x1e')])_0xd805b1[_0xbee5('0x1e')](_0x3e854[_0xbee5('0x1e')]);return db[_0xbee5('0x94')][_0xbee5('0x35')](_0xd805b1[_0xbee5('0x95')](),_0x35b5ff);})['then'](function(_0x2040eb){_0x4772ae['where']('ui.SmsInteractionId\x20IN\x20?',_[_0xbee5('0x2a')](_0x2040eb,'id'));return db[_0xbee5('0x94')]['query'](_0x4772ae['toString'](),_0x35b5ff)[_0xbee5('0x24')](function(_0x2fd1bd){var _0x72b574=_[_0xbee5('0xab')](_0x2fd1bd,_0xbee5('0xac'));var _0x360076=[];_0x2040eb[_0xbee5('0x67')](function(_0x48c92f){_0x360076[_0xbee5('0x2e')](updateSmsInteraction(_0x48c92f,_0x4cfe54,_0x72b574));});return BPromise[_0xbee5('0xad')](_0x360076);});});})[_0xbee5('0x24')](function(_0x7a3354){_0x52ecf1[_0xbee5('0xae')]=_0x7a3354;return _0x52ecf1;})[_0xbee5('0x24')](respondWithFilteredResult(_0xe61341,_0x3e854));})[_0xbee5('0x30')](handleError(_0xe61341,null));};exports[_0xbee5('0xaf')]=function(_0x4cade8,_0x5ac39b){var _0x4b4c2f={'raw':![],'where':{'id':_0x4cade8[_0xbee5('0xb0')]['id']}},_0x476d51={};_0x476d51[_0xbee5('0x34')]=_[_0xbee5('0x36')](db['SmsInteraction'][_0xbee5('0xb1')]);_0x476d51[_0xbee5('0x35')]=_[_0xbee5('0x36')](_0x4cade8['query']);_0x476d51[_0xbee5('0x3e')]=_['intersection'](_0x476d51[_0xbee5('0x34')],_0x476d51[_0xbee5('0x35')]);_0x4b4c2f['attributes']=_['intersection'](_0x476d51['model'],qs[_0xbee5('0x98')](_0x4cade8['query'][_0xbee5('0x98')]));_0x4b4c2f[_0xbee5('0x38')]=_0x4b4c2f['attributes']['length']?_0x4b4c2f[_0xbee5('0x38')]:_0x476d51['model'];if(_0x4cade8[_0xbee5('0x35')][_0xbee5('0xb2')]){_0x4b4c2f[_0xbee5('0xb3')]=[{'all':!![]}];}_0x4b4c2f=_['merge']({},_0x4b4c2f,_0x4cade8[_0xbee5('0xb4')]);return db[_0xbee5('0x31')][_0xbee5('0x6b')](_0x4b4c2f)[_0xbee5('0x24')](handleEntityNotFound(_0x5ac39b,null))[_0xbee5('0x24')](respondWithResult(_0x5ac39b,null))[_0xbee5('0x30')](handleError(_0x5ac39b,null));};exports['create']=function(_0x4b45d4,_0x18740c){return db['SmsInteraction']['create'](_0x4b45d4[_0xbee5('0x6e')],{})[_0xbee5('0x24')](respondWithResult(_0x18740c,0xc9))[_0xbee5('0x30')](handleError(_0x18740c,null));};exports[_0xbee5('0x23')]=function(_0x3672bf,_0xb4b1c){if(_0x3672bf[_0xbee5('0x6e')]['id']){delete _0x3672bf['body']['id'];}return db['SmsInteraction']['find']({'where':{'id':_0x3672bf['params']['id']}})[_0xbee5('0x24')](handleEntityNotFound(_0xb4b1c,null))[_0xbee5('0x24')](saveUpdates(_0x3672bf[_0xbee5('0x6e')],null))['then'](respondWithResult(_0xb4b1c,null))[_0xbee5('0x30')](handleError(_0xb4b1c,null));};exports[_0xbee5('0xb5')]=function(_0x2b29e8,_0x55405a){return db[_0xbee5('0x31')][_0xbee5('0x6b')]({'where':{'id':_0x2b29e8[_0xbee5('0xb0')]['id']}})[_0xbee5('0x24')](handleEntityNotFound(_0x55405a,null))[_0xbee5('0x24')](removeEntity(_0x55405a,null))['catch'](handleError(_0x55405a,null));};exports['describe']=function(_0x5940dc,_0x49eb71){return db[_0xbee5('0x31')][_0xbee5('0xb6')]()[_0xbee5('0x24')](respondWithResult(_0x49eb71,null))[_0xbee5('0x30')](handleError(_0x49eb71,null));};exports[_0xbee5('0xb7')]=function(_0xd70ec6,_0x4aaf7,_0x214e98){return db[_0xbee5('0xb8')][_0xbee5('0x6b')]({'where':{'id':_0xd70ec6[_0xbee5('0xb0')]['id']}})['then'](handleEntityNotFound(_0x4aaf7,null))[_0xbee5('0x24')](function(_0x3c05ad){if(_0x3c05ad){return _0x3c05ad[_0xbee5('0xb7')](_0xd70ec6[_0xbee5('0x6e')][_0xbee5('0xb9')],_[_0xbee5('0xba')](_0xd70ec6[_0xbee5('0x6e')],[_0xbee5('0xb9'),'id'])||{});}})[_0xbee5('0x24')](respondWithResult(_0x4aaf7,null))[_0xbee5('0x30')](handleError(_0x4aaf7,null));};exports[_0xbee5('0xbb')]=function(_0x4773dc,_0x2b076b,_0x26863c){var _0x3df92c={'raw':![],'where':{}};var _0x71b1ae={};var _0x33faa8={'count':0x0,'rows':[]};return db['SmsInteraction'][_0xbee5('0xbc')]({'where':{'id':_0x4773dc[_0xbee5('0xb0')]['id']}})[_0xbee5('0x24')](handleEntityNotFound(_0x2b076b,null))[_0xbee5('0x24')](function(_0x5f25c9){if(_0x5f25c9){_0x71b1ae[_0xbee5('0x34')]=_[_0xbee5('0x36')](db['SmsMessage'][_0xbee5('0xb1')]);_0x71b1ae[_0xbee5('0x35')]=_[_0xbee5('0x36')](_0x4773dc[_0xbee5('0x35')]);_0x71b1ae['filters']=_[_0xbee5('0x37')](_0x71b1ae['model'],_0x71b1ae[_0xbee5('0x35')]);_0x3df92c[_0xbee5('0x38')]=_['intersection'](_0x71b1ae[_0xbee5('0x34')],qs[_0xbee5('0x98')](_0x4773dc[_0xbee5('0x35')]['fields']));_0x3df92c[_0xbee5('0x38')]=_0x3df92c['attributes'][_0xbee5('0x39')]?_0x3df92c[_0xbee5('0x38')]:_0x71b1ae[_0xbee5('0x34')];if(!_0x4773dc['query']['hasOwnProperty'](_0xbee5('0x3b'))){_0x3df92c['limit']=qs[_0xbee5('0x1f')](_0x4773dc['query'][_0xbee5('0x1f')]);_0x3df92c[_0xbee5('0x1e')]=qs[_0xbee5('0x1e')](_0x4773dc[_0xbee5('0x35')][_0xbee5('0x1e')]);}_0x3df92c['order']=qs[_0xbee5('0x3c')](_0x4773dc[_0xbee5('0x35')]['sort']);_0x3df92c['where']=qs[_0xbee5('0x3e')](_[_0xbee5('0x3f')](_0x4773dc[_0xbee5('0x35')],_0x71b1ae['filters']));_0x3df92c['where'][_0xbee5('0xac')]=_0x5f25c9['id'];if(_0x4773dc['query'][_0xbee5('0x7f')]){_0x3df92c[_0xbee5('0x3d')]=_[_0xbee5('0x97')](_0x3df92c['where'],{'$or':_[_0xbee5('0x2a')](_0x3df92c[_0xbee5('0x38')],function(_0x188eb0){var _0x54f85c={};_0x54f85c[_0x188eb0]={'$like':'%'+_0x4773dc[_0xbee5('0x35')][_0xbee5('0x7f')]+'%'};return _0x54f85c;})});}if(_0x4773dc['query']['$gte']){var _0x575b3d=_0x4773dc['query'][_0xbee5('0x73')][_0xbee5('0x2d')](',');var _0x116a25={};_0x116a25[_0x575b3d[0x0]]={'$gte':moment(_0x575b3d[0x1])[_0xbee5('0xbd')](_0xbee5('0xbe'))};_0x3df92c['where']=_[_0xbee5('0x97')](_0x3df92c[_0xbee5('0x3d')],_0x116a25);}_0x3df92c=_['merge']({},_0x3df92c,_0x4773dc[_0xbee5('0xb4')]);return db[_0xbee5('0xb8')]['count']({'where':_0x3df92c[_0xbee5('0x3d')]})[_0xbee5('0x24')](function(_0x53bb79){_0x33faa8[_0xbee5('0x1d')]=_0x53bb79;if(_0x4773dc[_0xbee5('0x35')]['includeAll']){_0x3df92c[_0xbee5('0xb3')]=[{'all':!![]}];}return db[_0xbee5('0xb8')]['findAll'](_0x3df92c);})['then'](function(_0x14c6f4){_0x33faa8[_0xbee5('0xae')]=_0x14c6f4;return _0x33faa8;});}})[_0xbee5('0x24')](respondWithFilteredResult(_0x2b076b,_0x3df92c))[_0xbee5('0x30')](handleError(_0x2b076b,null));};exports[_0xbee5('0xbf')]=function(_0x53633d,_0x3780a4,_0xc0a129){return db[_0xbee5('0x31')][_0xbee5('0x6b')]({'where':{'id':_0x53633d[_0xbee5('0xb0')]['id']}})[_0xbee5('0x24')](handleEntityNotFound(_0x3780a4,null))['then'](function(_0x2825b7){if(_0x2825b7){return _0x2825b7[_0xbee5('0xc0')](_0x53633d[_0xbee5('0x6e')][_0xbee5('0xb9')],_['omit'](_0x53633d[_0xbee5('0x6e')],[_0xbee5('0xb9'),'id'])||{})['spread'](function(){return db['Tag'][_0xbee5('0xc1')]({'attributes':['id','name','color'],'where':{'id':_0x53633d[_0xbee5('0x6e')]['ids']}});})[_0xbee5('0x24')](function(_0x374781){socket[_0xbee5('0xc2')](_0xbee5('0xc3'),{'id':Number(_0x53633d[_0xbee5('0xb0')]['id']),'tags':_0x374781||[]});return{'id':Number(_0x53633d[_0xbee5('0xb0')]['id']),'tags':_0x374781||[]};});}})['then'](respondWithResult(_0x3780a4,null))['catch'](handleError(_0x3780a4,null));};exports['removeTags']=function(_0xa390f7,_0x400e10,_0x2216d6){return db[_0xbee5('0x31')]['find']({'where':{'id':_0xa390f7[_0xbee5('0xb0')]['id']}})[_0xbee5('0x24')](handleEntityNotFound(_0x400e10,null))[_0xbee5('0x24')](function(_0x3a900f){if(_0x3a900f){return _0x3a900f['removeTags'](_0xa390f7[_0xbee5('0x35')][_0xbee5('0xb9')]);}})[_0xbee5('0x24')](respondWithStatusCode(_0x400e10,null))[_0xbee5('0x30')](handleError(_0x400e10,null));};exports[_0xbee5('0xc4')]=function(_0x2b7b54,_0xd0296a){var _0x5ac370=moment()[_0xbee5('0xc5')]()[_0xbee5('0x95')]();var _0x2f44b9=path[_0xbee5('0xc6')](config[_0xbee5('0xc7')],'server','files',_0xbee5('0xc8'));var _0x4f7522=path['join'](config['root'],_0xbee5('0xc9'),_0xbee5('0xca'),_0xbee5('0xcb'));var _0x47c560=path[_0xbee5('0xc6')](_0x2f44b9,_0x5ac370);var _0x512089=util[_0xbee5('0xbd')](_0xbee5('0xcc'),_0x2b7b54['params']['id'],_0x5ac370);var _0x929027=path[_0xbee5('0xc6')](_0x2f44b9,_0x512089);var _0x5d0dd1=[];_0x5d0dd1['push']({'model':db[_0xbee5('0x69')],'as':_0xbee5('0x69'),'attributes':['id','fullname'],'raw':!![]});_0x5d0dd1['push']({'model':db[_0xbee5('0xcd')],'as':_0xbee5('0x5d'),'attributes':['id',_0xbee5('0xce'),'lastName'],'raw':!![]});var _0x49656e=[{'model':db[_0xbee5('0xb8')],'as':_0xbee5('0xcf'),'attributes':['id','body',_0xbee5('0x72'),'direction','secret',_0xbee5('0x7a')],'include':_0x5d0dd1}];_0x49656e['push']({'model':db[_0xbee5('0xd0')],'as':_0xbee5('0xd1'),'attributes':['id',_0xbee5('0x27')]});_0x49656e['push']({'model':db['User'],'as':_0xbee5('0xd2'),'attributes':['id',_0xbee5('0x2b')]});return db[_0xbee5('0x31')][_0xbee5('0x6b')]({'where':{'id':_0x2b7b54[_0xbee5('0xb0')]['id']},'include':_0x49656e})[_0xbee5('0x24')](handleEntityNotFound(_0xd0296a,null))[_0xbee5('0x24')](function(_0x9d944c){if(_0x9d944c){var _0x385776=_0x9d944c[_0xbee5('0xd3')]({'plain':!![]});fs[_0xbee5('0xd4')](_0x47c560);var _0x25a708={'format':'A4','border':'10px','header':{'height':_0xbee5('0xd5'),'contents':{'first':_0xbee5('0xd6')}},'footer':{'height':_0xbee5('0xd7'),'contents':{'default':util['format']('\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',util[_0xbee5('0xbd')](_0xbee5('0xd8'),_0xbee5('0xd9'),_0x385776['id']),moment()['format']('YYYY-MM-DD')['toString']())}}};var _0x186688={'channel':_0xbee5('0xd9'),'account':_0x385776[_0xbee5('0xd1')][_0xbee5('0x27')],'agent':_0x385776[_0xbee5('0xd2')]?_0x385776['Owner'][_0xbee5('0x2b')]:'N.A.','createdAt':moment(_0x385776[_0xbee5('0x72')])['format'](_0xbee5('0xbe'))[_0xbee5('0x95')](),'closedAt':_0x385776[_0xbee5('0xda')]?moment(_0x385776['closedAt'])[_0xbee5('0xbd')](_0xbee5('0xbe'))[_0xbee5('0x95')]():'','disposition':_0x385776[_0xbee5('0xdb')],'messages':_(_0x385776[_0xbee5('0xcf')])['filter']({'secret':![]})[_0xbee5('0x2a')](function(_0x1b2487){return{'date':moment(_0x1b2487[_0xbee5('0x72')])[_0xbee5('0xbd')](_0xbee5('0xbe'))[_0xbee5('0x95')](),'sender':_0x1b2487[_0xbee5('0xdc')]===_0xbee5('0xdd')?_0x1b2487[_0xbee5('0x69')]?_0x1b2487[_0xbee5('0x69')][_0xbee5('0x2b')]:'System':_0x1b2487[_0xbee5('0x5d')][_0xbee5('0xce')]+(_0x1b2487['Contact'][_0xbee5('0xde')]?'\x20'+_0x1b2487[_0xbee5('0x5d')][_0xbee5('0xde')]:''),'body':_0x1b2487['body'],'direction':_0x1b2487['direction']===_0xbee5('0xdd')?'A':'C','secret':_0x1b2487[_0xbee5('0xdf')],'read':_0x1b2487[_0xbee5('0x7a')]};})[_0xbee5('0x59')]()};return ejs[_0xbee5('0xe0')](path[_0xbee5('0xc6')](config[_0xbee5('0xc7')],_0xbee5('0xc9'),'views',_0xbee5('0xe1')),{'interaction':_0x186688})['then'](function(_0x121ee8){return new BPromise(function(_0x496ae0,_0x180285){pdf['create'](_0x121ee8,_0x25a708)[_0xbee5('0xe2')](path[_0xbee5('0xc6')](_0x47c560,_0xbee5('0xe3')+_0x385776['id']+'-'+_0x5ac370+_0xbee5('0xe4')),function(_0x2c6206,_0xdbc40f){if(_0x2c6206)return _0x180285(_0x2c6206);_0x496ae0(_0xdbc40f);});});})[_0xbee5('0x24')](function(){return new BPromise(function(_0x2c47c7,_0x30e16d){zipdir(_0x47c560,{'saveTo':_0x929027},function(_0x47a52f,_0x44c3da){if(_0x47a52f)return _0x30e16d(_0x47a52f);return _0x2c47c7(_0x44c3da);});})[_0xbee5('0x24')](function(){return new BPromise(function(_0x5dfc1f,_0xc48afb){rimraf(_0x47c560,function(_0x44278e){if(_0x44278e)_0xc48afb(_0x44278e);return _0x5dfc1f();});});})[_0xbee5('0x24')](function(){return _0xd0296a[_0xbee5('0xc4')](_0x929027,_0x512089,function(_0x5bab1d){if(_0x5bab1d){console[_0xbee5('0xe5')](_0xbee5('0xe6'),_0x5bab1d);}else{fs[_0xbee5('0xe7')](_0x929027);}});});});}else{return _0xd0296a['sendStatus'](0xc8);}})['catch'](handleError(_0xd0296a,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index d69d6ad..0450eb4 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 _0x4b84=['getUsers','Users','findAll','then','unreadMessages','length','emit','catch','hasOwnProperty','hook','events','../../mysqldb','SmsMessage','update','remove'];(function(_0x423bc4,_0x3c2186){var _0x1d9a75=function(_0x357da5){while(--_0x357da5){_0x423bc4['push'](_0x423bc4['shift']());}};_0x1d9a75(++_0x3c2186);}(_0x4b84,0x1cc));var _0x44b8=function(_0x3fb5eb,_0x5947a6){_0x3fb5eb=_0x3fb5eb-0x0;var _0x481291=_0x4b84[_0x3fb5eb];return _0x481291;};'use strict';var EventEmitter=require(_0x44b8('0x0'));var SmsInteraction=require(_0x44b8('0x1'))['db']['SmsInteraction'];var SmsMessage=require('../../mysqldb')['db'][_0x44b8('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x44b8('0x3'),'afterDestroy':_0x44b8('0x4')};function emitEvent(_0x39ad16){return function(_0x5766b0,_0x4f875e,_0x55f25d){_0x5766b0[_0x44b8('0x5')]({'attributes':['id'],'raw':!![]})['then'](function(_0x327f59){_0x5766b0['setDataValue'](_0x44b8('0x6'),_0x327f59['map'](function(_0x5034b6){return{'id':_0x5034b6['id']};}));return SmsMessage[_0x44b8('0x7')]({'where':{'SmsInteractionId':_0x5766b0['id'],'direction':'in','read':![]},'raw':!![]});})[_0x44b8('0x8')](function(_0x30ebc3){_0x5766b0['setDataValue'](_0x44b8('0x9'),_0x30ebc3[_0x44b8('0xa')]);SmsInteractionEvents[_0x44b8('0xb')](_0x39ad16+':'+_0x5766b0['id'],_0x5766b0);SmsInteractionEvents[_0x44b8('0xb')](_0x39ad16,_0x5766b0);_0x55f25d(null);})[_0x44b8('0xc')](_0x55f25d(null));};}for(var e in events){if(events[_0x44b8('0xd')](e)){var event=events[e];SmsInteraction[_0x44b8('0xe')](e,emitEvent(event));}}module['exports']=SmsInteractionEvents; \ No newline at end of file +var _0x4b84=['getUsers','Users','findAll','then','unreadMessages','length','emit','catch','hasOwnProperty','hook','events','../../mysqldb','SmsMessage','update','remove'];(function(_0xfec84f,_0x49ebb5){var _0x366586=function(_0x153742){while(--_0x153742){_0xfec84f['push'](_0xfec84f['shift']());}};_0x366586(++_0x49ebb5);}(_0x4b84,0x1cc));var _0x44b8=function(_0x2ee790,_0x5a8661){_0x2ee790=_0x2ee790-0x0;var _0x5a54a5=_0x4b84[_0x2ee790];return _0x5a54a5;};'use strict';var EventEmitter=require(_0x44b8('0x0'));var SmsInteraction=require(_0x44b8('0x1'))['db']['SmsInteraction'];var SmsMessage=require('../../mysqldb')['db'][_0x44b8('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x44b8('0x3'),'afterDestroy':_0x44b8('0x4')};function emitEvent(_0x39ad16){return function(_0x5766b0,_0x4f875e,_0x55f25d){_0x5766b0[_0x44b8('0x5')]({'attributes':['id'],'raw':!![]})['then'](function(_0x327f59){_0x5766b0['setDataValue'](_0x44b8('0x6'),_0x327f59['map'](function(_0x5034b6){return{'id':_0x5034b6['id']};}));return SmsMessage[_0x44b8('0x7')]({'where':{'SmsInteractionId':_0x5766b0['id'],'direction':'in','read':![]},'raw':!![]});})[_0x44b8('0x8')](function(_0x30ebc3){_0x5766b0['setDataValue'](_0x44b8('0x9'),_0x30ebc3[_0x44b8('0xa')]);SmsInteractionEvents[_0x44b8('0xb')](_0x39ad16+':'+_0x5766b0['id'],_0x5766b0);SmsInteractionEvents[_0x44b8('0xb')](_0x39ad16,_0x5766b0);_0x55f25d(null);})[_0x44b8('0xc')](_0x55f25d(null));};}for(var e in events){if(events[_0x44b8('0xd')](e)){var event=events[e];SmsInteraction[_0x44b8('0xe')](e,emitEvent(event));}}module['exports']=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 82b2c80..afcc77c 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 _0x2f14=['changed','closed','closedAt','format','util','../../config/logger','moment','request-promise','rimraf','../../config/environment','./smsInteraction.attributes','exports','define','SmsInteraction','sms_interactions'];(function(_0x293433,_0x22537a){var _0x172cc9=function(_0x156794){while(--_0x156794){_0x293433['push'](_0x293433['shift']());}};_0x172cc9(++_0x22537a);}(_0x2f14,0x199));var _0x42f1=function(_0x286f3a,_0x23f1f1){_0x286f3a=_0x286f3a-0x0;var _0x2fb34c=_0x2f14[_0x286f3a];return _0x2fb34c;};'use strict';var _=require('lodash');var util=require(_0x42f1('0x0'));var logger=require(_0x42f1('0x1'))('api');var moment=require(_0x42f1('0x2'));var BPromise=require('bluebird');var rp=require(_0x42f1('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x42f1('0x4'));var config=require(_0x42f1('0x5'));var attributes=require(_0x42f1('0x6'));module[_0x42f1('0x7')]=function(_0x210043,_0xd7e996){return _0x210043[_0x42f1('0x8')](_0x42f1('0x9'),attributes,{'tableName':_0x42f1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x516359,_0x2a77a6,_0xf535ab){if(_0x516359[_0x42f1('0xb')](_0x42f1('0xc'))){_0x516359[_0x42f1('0xd')]=moment()[_0x42f1('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}_0xf535ab(null,_0x516359);}}});}; \ No newline at end of file +var _0xca09=['api','moment','request-promise','path','rimraf','../../config/environment','./smsInteraction.attributes','exports','define','SmsInteraction','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger'];(function(_0x7f08b6,_0x23cc83){var _0x3c9ab1=function(_0x283836){while(--_0x283836){_0x7f08b6['push'](_0x7f08b6['shift']());}};_0x3c9ab1(++_0x23cc83);}(_0xca09,0xfd));var _0x9ca0=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xca09[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0x9ca0('0x0'));var util=require('util');var logger=require(_0x9ca0('0x1'))(_0x9ca0('0x2'));var moment=require(_0x9ca0('0x3'));var BPromise=require('bluebird');var rp=require(_0x9ca0('0x4'));var fs=require('fs');var path=require(_0x9ca0('0x5'));var rimraf=require(_0x9ca0('0x6'));var config=require(_0x9ca0('0x7'));var attributes=require(_0x9ca0('0x8'));module[_0x9ca0('0x9')]=function(_0x3aef58,_0x1e968d){return _0x3aef58[_0x9ca0('0xa')](_0x9ca0('0xb'),attributes,{'tableName':'sms_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x366076,_0x5d112d,_0x1fd0d7){if(_0x366076['changed']('closed')){_0x366076[_0x9ca0('0xc')]=moment()[_0x9ca0('0xd')](_0x9ca0('0xe'));}_0x1fd0d7(null,_0x366076);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 5ad7782..ea8277e 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 _0xf073=['AddTags','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','defaults','localhost','socket.io-emitter','redis','register','request\x20sent','debug','stringify','error','code','SmsInteraction,\x20%s,\x20%s','message','info','result','catch','SmsInteraction','update','body','options','raw','where','attributes','limit','then','UpdateSmsInteraction','AddTagsToSmsInteraction','find','omit','ids'];(function(_0x5c6299,_0x11bd28){var _0x23b564=function(_0x329ed6){while(--_0x329ed6){_0x5c6299['push'](_0x5c6299['shift']());}};_0x23b564(++_0x11bd28);}(_0xf073,0x17d));var _0x3f07=function(_0xafd9f9,_0x41e0c9){_0xafd9f9=_0xafd9f9-0x0;var _0x283a5b=_0xf073[_0xafd9f9];return _0x283a5b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3f07('0x0'));var BPromise=require(_0x3f07('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3f07('0x2'))['db'];var utils=require(_0x3f07('0x3'));var logger=require(_0x3f07('0x4'))('rpc');var config=require(_0x3f07('0x5'));var jayson=require(_0x3f07('0x6'));var client=jayson[_0x3f07('0x7')]['http']({'port':0x232a});config['redis']=_[_0x3f07('0x8')](config['redis'],{'host':_0x3f07('0x9'),'port':0x18eb});var socket=require(_0x3f07('0xa'))(new Redis(config[_0x3f07('0xb')]));require('./smsInteraction.socket')[_0x3f07('0xc')](socket);function respondWithRpcPromise(_0x590fa5,_0x63f77b,_0x1f0b83){return new BPromise(function(_0x1e54fb,_0x50c5a6){return client['request'](_0x590fa5,_0x1f0b83)['then'](function(_0x2c2a2c){logger['info']('SmsInteraction,\x20%s,\x20%s',_0x63f77b,_0x3f07('0xd'));logger[_0x3f07('0xe')]('SmsInteraction,\x20%s,\x20%s,\x20%s',_0x63f77b,'request\x20sent',JSON[_0x3f07('0xf')](_0x2c2a2c));if(_0x2c2a2c['error']){if(_0x2c2a2c[_0x3f07('0x10')][_0x3f07('0x11')]===0x1f4){logger[_0x3f07('0x10')](_0x3f07('0x12'),_0x63f77b,_0x2c2a2c[_0x3f07('0x10')][_0x3f07('0x13')]);return _0x50c5a6(_0x2c2a2c[_0x3f07('0x10')][_0x3f07('0x13')]);}logger[_0x3f07('0x10')](_0x3f07('0x12'),_0x63f77b,_0x2c2a2c[_0x3f07('0x10')][_0x3f07('0x13')]);return _0x1e54fb(_0x2c2a2c[_0x3f07('0x10')][_0x3f07('0x13')]);}else{logger[_0x3f07('0x14')](_0x3f07('0x12'),_0x63f77b,'request\x20sent');_0x1e54fb(_0x2c2a2c[_0x3f07('0x15')][_0x3f07('0x13')]);}})[_0x3f07('0x16')](function(_0x3b9174){logger['error'](_0x3f07('0x12'),_0x63f77b,_0x3b9174);_0x50c5a6(_0x3b9174);});});}exports['UpdateSmsInteraction']=function(_0x29758a){var _0x334d30=this;return new Promise(function(_0x501f1e,_0x2a942f){return db[_0x3f07('0x17')][_0x3f07('0x18')](_0x29758a[_0x3f07('0x19')],{'raw':_0x29758a['options']?_0x29758a[_0x3f07('0x1a')][_0x3f07('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x29758a[_0x3f07('0x1a')]?_0x29758a[_0x3f07('0x1a')][_0x3f07('0x1c')]||null:null,'attributes':_0x29758a['options']?_0x29758a['options'][_0x3f07('0x1d')]||null:null,'limit':_0x29758a[_0x3f07('0x1a')]?_0x29758a[_0x3f07('0x1a')][_0x3f07('0x1e')]||null:null})[_0x3f07('0x1f')](function(_0x15e6a6){logger[_0x3f07('0x14')](_0x3f07('0x20'),_0x29758a);logger[_0x3f07('0xe')](_0x3f07('0x20'),_0x29758a,JSON['stringify'](_0x15e6a6));_0x501f1e(_0x15e6a6);})['catch'](function(_0x214acc){logger[_0x3f07('0x10')](_0x3f07('0x20'),_0x214acc[_0x3f07('0x13')],_0x29758a);_0x2a942f(_0x334d30[_0x3f07('0x10')](0x1f4,_0x214acc[_0x3f07('0x13')]));});});};exports[_0x3f07('0x21')]=function(_0x14f3b4){return new Promise(function(_0x5d9dfb,_0x411a18){return db['SmsInteraction'][_0x3f07('0x22')]({'where':_0x14f3b4[_0x3f07('0x1a')]?_0x14f3b4[_0x3f07('0x1a')][_0x3f07('0x1c')]||null:null})[_0x3f07('0x1f')](function(_0x2adfda){if(_0x2adfda){return _0x2adfda['addTags'](_0x14f3b4[_0x3f07('0x19')]['ids'],_[_0x3f07('0x23')](_0x14f3b4[_0x3f07('0x19')],[_0x3f07('0x24'),'id'])||{});}})['spread'](function(_0x456f95){logger[_0x3f07('0x14')](_0x3f07('0x25'),_0x14f3b4);logger[_0x3f07('0xe')](_0x3f07('0x25'),_0x14f3b4,JSON[_0x3f07('0xf')](_0x456f95));_0x5d9dfb(_0x456f95);})['catch'](function(_0x269295){logger[_0x3f07('0x10')](_0x3f07('0x25'),_0x269295[_0x3f07('0x13')],_0x14f3b4);_0x411a18(_this[_0x3f07('0x10')](0x1f4,_0x269295[_0x3f07('0x13')]));});});}; \ No newline at end of file +var _0x8721=['defaults','localhost','./smsInteraction.socket','request','then','info','SmsInteraction,\x20%s,\x20%s','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','SmsInteraction','options','raw','where','attributes','UpdateSmsInteraction','stringify','AddTagsToSmsInteraction','find','addTags','body','ids','omit','spread','AddTags','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','redis'];(function(_0x133730,_0x3efeec){var _0x412543=function(_0x48401e){while(--_0x48401e){_0x133730['push'](_0x133730['shift']());}};_0x412543(++_0x3efeec);}(_0x8721,0x99));var _0x1872=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0x8721[_0x4ea69d];return _0x5318e0;};'use strict';var _=require('lodash');var util=require(_0x1872('0x0'));var moment=require(_0x1872('0x1'));var BPromise=require(_0x1872('0x2'));var rs=require(_0x1872('0x3'));var fs=require('fs');var Redis=require(_0x1872('0x4'));var db=require(_0x1872('0x5'))['db'];var utils=require(_0x1872('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x1872('0x7'));var jayson=require(_0x1872('0x8'));var client=jayson[_0x1872('0x9')]['http']({'port':0x232a});config[_0x1872('0xa')]=_[_0x1872('0xb')](config[_0x1872('0xa')],{'host':_0x1872('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x1872('0xd'))['register'](socket);function respondWithRpcPromise(_0x3b2b36,_0x5d8223,_0x24820e){return new BPromise(function(_0x17d209,_0x4fa553){return client[_0x1872('0xe')](_0x3b2b36,_0x24820e)[_0x1872('0xf')](function(_0xc61b80){logger[_0x1872('0x10')](_0x1872('0x11'),_0x5d8223,'request\x20sent');logger[_0x1872('0x12')](_0x1872('0x13'),_0x5d8223,_0x1872('0x14'),JSON['stringify'](_0xc61b80));if(_0xc61b80[_0x1872('0x15')]){if(_0xc61b80['error'][_0x1872('0x16')]===0x1f4){logger[_0x1872('0x15')](_0x1872('0x11'),_0x5d8223,_0xc61b80['error']['message']);return _0x4fa553(_0xc61b80[_0x1872('0x15')][_0x1872('0x17')]);}logger[_0x1872('0x15')](_0x1872('0x11'),_0x5d8223,_0xc61b80[_0x1872('0x15')][_0x1872('0x17')]);return _0x17d209(_0xc61b80[_0x1872('0x15')][_0x1872('0x17')]);}else{logger[_0x1872('0x10')]('SmsInteraction,\x20%s,\x20%s',_0x5d8223,'request\x20sent');_0x17d209(_0xc61b80[_0x1872('0x18')]['message']);}})[_0x1872('0x19')](function(_0x541906){logger['error'](_0x1872('0x11'),_0x5d8223,_0x541906);_0x4fa553(_0x541906);});});}exports['UpdateSmsInteraction']=function(_0x31d46e){var _0x1163a3=this;return new Promise(function(_0x700276,_0x4f077c){return db[_0x1872('0x1a')]['update'](_0x31d46e['body'],{'raw':_0x31d46e[_0x1872('0x1b')]?_0x31d46e[_0x1872('0x1b')][_0x1872('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x31d46e[_0x1872('0x1b')]?_0x31d46e[_0x1872('0x1b')][_0x1872('0x1d')]||null:null,'attributes':_0x31d46e[_0x1872('0x1b')]?_0x31d46e[_0x1872('0x1b')][_0x1872('0x1e')]||null:null,'limit':_0x31d46e[_0x1872('0x1b')]?_0x31d46e[_0x1872('0x1b')]['limit']||null:null})[_0x1872('0xf')](function(_0x5d0b45){logger[_0x1872('0x10')](_0x1872('0x1f'),_0x31d46e);logger[_0x1872('0x12')](_0x1872('0x1f'),_0x31d46e,JSON[_0x1872('0x20')](_0x5d0b45));_0x700276(_0x5d0b45);})[_0x1872('0x19')](function(_0x513cbc){logger['error']('UpdateSmsInteraction',_0x513cbc[_0x1872('0x17')],_0x31d46e);_0x4f077c(_0x1163a3[_0x1872('0x15')](0x1f4,_0x513cbc[_0x1872('0x17')]));});});};exports[_0x1872('0x21')]=function(_0x52c5d0){return new Promise(function(_0x4619eb,_0x32d7b8){return db[_0x1872('0x1a')][_0x1872('0x22')]({'where':_0x52c5d0[_0x1872('0x1b')]?_0x52c5d0['options'][_0x1872('0x1d')]||null:null})[_0x1872('0xf')](function(_0x230bcc){if(_0x230bcc){return _0x230bcc[_0x1872('0x23')](_0x52c5d0[_0x1872('0x24')][_0x1872('0x25')],_[_0x1872('0x26')](_0x52c5d0[_0x1872('0x24')],[_0x1872('0x25'),'id'])||{});}})[_0x1872('0x27')](function(_0x5a8169){logger['info'](_0x1872('0x28'),_0x52c5d0);logger[_0x1872('0x12')](_0x1872('0x28'),_0x52c5d0,JSON[_0x1872('0x20')](_0x5a8169));_0x4619eb(_0x5a8169);})[_0x1872('0x19')](function(_0x559063){logger['error'](_0x1872('0x28'),_0x559063[_0x1872('0x17')],_0x52c5d0);_0x32d7b8(_this['error'](0x1f4,_0x559063[_0x1872('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index f931b3b..15b55d4 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(_0x4ca6a4,_0x5e9694){var _0x120555=function(_0x56888c){while(--_0x56888c){_0x4ca6a4['push'](_0x4ca6a4['shift']());}};_0x120555(++_0x5e9694);}(_0x2032,0xd9));var _0x2203=function(_0x1d0464,_0x439143){_0x1d0464=_0x1d0464-0x0;var _0x18fa7d=_0x2032[_0x1d0464];return _0x18fa7d;};'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 _0xd8b0=['save','emit','./smsInteraction.events'];(function(_0x11a494,_0x8a10){var _0x494093=function(_0x44658d){while(--_0x44658d){_0x11a494['push'](_0x11a494['shift']());}};_0x494093(++_0x8a10);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var SmsInteractionEvents=require(_0x0d8b('0x0'));var events=[_0x0d8b('0x1'),'remove','update'];function createListener(_0x4b72b0,_0x3ff8df){return function(_0x5b9b89){_0x3ff8df[_0x0d8b('0x2')](_0x4b72b0,_0x5b9b89);};}function removeListener(_0x364286,_0x8196ed){return function(){SmsInteractionEvents['removeListener'](_0x364286,_0x8196ed);};}exports['register']=function(_0x3f8b6f){for(var _0x227c63=0x0,_0x39f43a=events['length'];_0x227c63<_0x39f43a;_0x227c63++){var _0x413284=events[_0x227c63];var _0x284169=createListener('smsInteraction:'+_0x413284,_0x3f8b6f);SmsInteractionEvents['on'](_0x413284,_0x284169);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index c01cada..0460939 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 _0xb951=['/:id/status','status','put','/:id/accept','reject','destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked','sms','smsmessage:create','create'];(function(_0x31dc7e,_0x2dd309){var _0x172eac=function(_0x25c92e){while(--_0x25c92e){_0x31dc7e['push'](_0x31dc7e['shift']());}};_0x172eac(++_0x2dd309);}(_0xb951,0x1c1));var _0x1b95=function(_0x31bb33,_0x11df38){_0x31bb33=_0x31bb33-0x0;var _0x4eae64=_0xb951[_0x31bb33];return _0x4eae64;};'use strict';var multer=require(_0x1b95('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x1b95('0x1'));var express=require(_0x1b95('0x2'));var router=express[_0x1b95('0x3')]();var auth=require(_0x1b95('0x4'));var interaction=require(_0x1b95('0x5'));var config=require(_0x1b95('0x6'));var controller=require('./smsMessage.controller');router[_0x1b95('0x7')]('/',auth[_0x1b95('0x8')](),controller[_0x1b95('0x9')]);router[_0x1b95('0x7')](_0x1b95('0xa'),auth[_0x1b95('0x8')](),controller[_0x1b95('0xb')]);router[_0x1b95('0x7')](_0x1b95('0xc'),auth[_0x1b95('0x8')](),controller[_0x1b95('0xd')]);router[_0x1b95('0xe')]('/',auth[_0x1b95('0x8')](),interaction[_0x1b95('0xf')](_0x1b95('0x10'),_0x1b95('0x11')),controller[_0x1b95('0x12')]);router[_0x1b95('0xe')](_0x1b95('0x13'),controller[_0x1b95('0x14')]);router[_0x1b95('0x15')]('/:id',auth[_0x1b95('0x8')](),controller['update']);router[_0x1b95('0x15')](_0x1b95('0x16'),auth['isAuthenticated'](),controller['accept']);router[_0x1b95('0x15')]('/:id/reject',auth['isAuthenticated'](),controller[_0x1b95('0x17')]);router['delete'](_0x1b95('0xc'),auth[_0x1b95('0x8')](),controller[_0x1b95('0x18')]);module[_0x1b95('0x19')]=router; \ No newline at end of file +var _0x38a6=['put','update','accept','/:id/reject','reject','delete','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsMessage.controller','index','get','isAuthenticated','describe','/:id','show','sms','create','post'];(function(_0x1905b0,_0x219c2a){var _0x56d6a4=function(_0x5d11c1){while(--_0x5d11c1){_0x1905b0['push'](_0x1905b0['shift']());}};_0x56d6a4(++_0x219c2a);}(_0x38a6,0xf7));var _0x638a=function(_0x1ba1eb,_0x1f04d1){_0x1ba1eb=_0x1ba1eb-0x0;var _0x338f23=_0x38a6[_0x1ba1eb];return _0x338f23;};'use strict';var multer=require(_0x638a('0x0'));var util=require(_0x638a('0x1'));var path=require('path');var timeout=require(_0x638a('0x2'));var express=require(_0x638a('0x3'));var router=express['Router']();var auth=require(_0x638a('0x4'));var interaction=require(_0x638a('0x5'));var config=require(_0x638a('0x6'));var controller=require(_0x638a('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x638a('0x8')]);router[_0x638a('0x9')]('/describe',auth[_0x638a('0xa')](),controller[_0x638a('0xb')]);router['get'](_0x638a('0xc'),auth['isAuthenticated'](),controller[_0x638a('0xd')]);router['post']('/',auth[_0x638a('0xa')](),interaction['tracked'](_0x638a('0xe'),'smsmessage:create'),controller[_0x638a('0xf')]);router[_0x638a('0x10')]('/:id/status',controller['status']);router[_0x638a('0x11')](_0x638a('0xc'),auth[_0x638a('0xa')](),controller[_0x638a('0x12')]);router[_0x638a('0x11')]('/:id/accept',auth[_0x638a('0xa')](),controller[_0x638a('0x13')]);router[_0x638a('0x11')](_0x638a('0x14'),auth[_0x638a('0xa')](),controller[_0x638a('0x15')]);router[_0x638a('0x16')](_0x638a('0xc'),auth[_0x638a('0xa')](),controller['destroy']);module[_0x638a('0x17')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index b01fd61..90e2cdd 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 _0x675e=['STRING','sequelize','exports','BOOLEAN','ENUM','out'];(function(_0x48eb0c,_0x1fb504){var _0x5c9aec=function(_0x1f1a39){while(--_0x1f1a39){_0x48eb0c['push'](_0x48eb0c['shift']());}};_0x5c9aec(++_0x1fb504);}(_0x675e,0xc1));var _0xe675=function(_0x1a89a1,_0x56d889){_0x1a89a1=_0x1a89a1-0x0;var _0x3d5b46=_0x675e[_0x1a89a1];return _0x3d5b46;};'use strict';var Sequelize=require(_0xe675('0x0'));module[_0xe675('0x1')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xe675('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0xe675('0x3')]('in',_0xe675('0x4')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0xe675('0x5')](0xbe)},'phone':{'type':Sequelize[_0xe675('0x5')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0xe675('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0xb1e0=['medium','BOOLEAN','ENUM','out','STRING','DATE','sequelize','exports'];(function(_0xe455e7,_0x29fb65){var _0xfc683e=function(_0x10ee38){while(--_0x10ee38){_0xe455e7['push'](_0xe455e7['shift']());}};_0xfc683e(++_0x29fb65);}(_0xb1e0,0x126));var _0x0b1e=function(_0xc85a,_0x12b6c3){_0xc85a=_0xc85a-0x0;var _0x3c06da=_0xb1e0[_0xc85a];return _0x3c06da;};'use strict';var Sequelize=require(_0x0b1e('0x0'));module[_0x0b1e('0x1')]={'body':{'type':Sequelize['TEXT'](_0x0b1e('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x0b1e('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x0b1e('0x4')]('in',_0x0b1e('0x5')),'defaultValue':_0x0b1e('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x0b1e('0x6')](0xbe)},'phone':{'type':Sequelize[_0x0b1e('0x6')]},'readAt':{'type':Sequelize[_0x0b1e('0x7')]},'secret':{'type':Sequelize[_0x0b1e('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 016be20..4b1b6bc 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 _0x823c=['filters','pick','filter','where','merge','options','includeAll','include','SmsMessage','catch','rawAttributes','find','create','body','params','describe','sms-interactions','sms','read','format','UserId','Contact','get','SmsInteraction','SmsInteractionId','read1stAt','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','acceptMessage','manual','interface','SIP/%s','channel','event','accept','EventManager','acceptmessage','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','SmsAccount','SmsAccountId','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','MessageUUID','sent','delivered','Status','infobip','results','groupName','DELIVERED','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','squel','crypto','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','json','count','offset','Content-Range','reject','save','update','destroy','stack','name','index','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','nolimit','limit','order','sort'];(function(_0x183607,_0x2d55cc){var _0x49f416=function(_0x4c01c3){while(--_0x4c01c3){_0x183607['push'](_0x183607['shift']());}};_0x49f416(++_0x2d55cc);}(_0x823c,0x143));var _0xc823=function(_0x491a46,_0x2e0dcb){_0x491a46=_0x491a46-0x0;var _0x3a70bf=_0x823c[_0x491a46];return _0x3a70bf;};'use strict';var pdf=require(_0xc823('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xc823('0x1'));var zipdir=require(_0xc823('0x2'));var jsonpatch=require(_0xc823('0x3'));var rp=require(_0xc823('0x4'));var moment=require(_0xc823('0x5'));var BPromise=require(_0xc823('0x6'));var Mustache=require('mustache');var util=require(_0xc823('0x7'));var path=require(_0xc823('0x8'));var sox=require(_0xc823('0x9'));var csv=require(_0xc823('0xa'));var ejs=require(_0xc823('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xc823('0xc'));var crypto=require(_0xc823('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xc823('0xa'));var querystring=require(_0xc823('0xe'));var Papa=require('papaparse');var Redis=require(_0xc823('0xf'));var authService=require(_0xc823('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc823('0x11'));var logger=require(_0xc823('0x12'))(_0xc823('0x13'));var utils=require(_0xc823('0x14'));var config=require(_0xc823('0x15'));var db=require('../../mysqldb')['db'];config[_0xc823('0x16')]=_[_0xc823('0x17')](config[_0xc823('0x16')],{'host':_0xc823('0x18'),'port':0x18eb});var socket=require(_0xc823('0x19'))(new Redis(config[_0xc823('0x16')]));require('./smsMessage.socket')[_0xc823('0x1a')](socket);var jayson=require(_0xc823('0x1b'));var client=jayson[_0xc823('0x1c')][_0xc823('0x1d')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function checkPasswordPattern(_0x59749d,_0x5bdfc9,_0x565aeb){if(_0x565aeb){var _0x5d3521=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5d3521[_0xc823('0x1e')](_0x5bdfc9)){return _0x59749d;}else{throw new db[(_0xc823('0x1f'))][(_0xc823('0x20'))](_0xc823('0x21'));}}else{return _0x59749d;}}function respondWithRpcPromise(_0x4417ee,_0x1aca6d,_0xfedc1d,_0x58b7c7){return new BPromise(function(_0x42843e,_0x4a713a){var _0xf52707=_0x58b7c7||client;return _0xf52707[_0xc823('0x22')](_0x4417ee,_0xfedc1d)[_0xc823('0x23')](function(_0x4fa275){logger[_0xc823('0x24')](_0xc823('0x25'),_0x1aca6d,_0xc823('0x26'));logger['debug'](_0xc823('0x27'),_0x1aca6d,_0xc823('0x26'),JSON[_0xc823('0x28')](_0x4fa275));if(_0x4fa275[_0xc823('0x29')]){if(_0x4fa275[_0xc823('0x29')][_0xc823('0x2a')]===0x1f4){logger['error'](_0xc823('0x25'),_0x1aca6d,_0x4fa275['error']['message']);return _0x4a713a(_0x4fa275[_0xc823('0x29')][_0xc823('0x2b')]);}logger['error'](_0xc823('0x25'),_0x1aca6d,_0x4fa275[_0xc823('0x29')][_0xc823('0x2b')]);return _0x42843e(_0x4fa275[_0xc823('0x29')][_0xc823('0x2b')]);}else{logger[_0xc823('0x24')](_0xc823('0x25'),_0x1aca6d,_0xc823('0x26'));_0x42843e(_0x4fa275[_0xc823('0x2c')][_0xc823('0x2b')]);}})['catch'](function(_0x3f175d){logger['error']('SmsMessage,\x20%s,\x20%s',_0x1aca6d,_0x3f175d);_0x4a713a(_0x3f175d);});});}function respondWithStatusCode(_0x15ac97,_0x21265a){_0x21265a=_0x21265a||0xcc;return function(_0x1c79dd){if(_0x1c79dd){return _0x15ac97[_0xc823('0x2d')](_0x21265a);}return _0x15ac97[_0xc823('0x2e')](_0x21265a)[_0xc823('0x2f')]();};}function respondWithResult(_0x1d20c6,_0xa5a380){_0xa5a380=_0xa5a380||0xc8;return function(_0x12f061){if(_0x12f061){return _0x1d20c6[_0xc823('0x2e')](_0xa5a380)[_0xc823('0x30')](_0x12f061);}};}function respondWithFilteredResult(_0x368d70,_0x352b61){return function(_0xda39a3){if(_0xda39a3){var _0x1c839f=_0xda39a3[_0xc823('0x31')],_0x52bd31=_0x352b61[_0xc823('0x32')],_0x1b492a=_0x352b61[_0xc823('0x32')]+_0x352b61['limit'],_0x34af84;if(_0x1b492a>=_0x1c839f){_0x1b492a=_0x1c839f;_0x34af84=0xc8;}else{_0x34af84=0xce;}_0x368d70['status'](_0x34af84);return _0x368d70['set'](_0xc823('0x33'),_0x52bd31+'-'+_0x1b492a+'/'+_0x1c839f)[_0xc823('0x30')](_0xda39a3);}return null;};}function patchUpdates(_0x20b4e7){return function(_0x2628be){try{jsonpatch['apply'](_0x2628be,_0x20b4e7,!![]);}catch(_0xc128c7){return BPromise[_0xc823('0x34')](_0xc128c7);}return _0x2628be[_0xc823('0x35')]();};}function saveUpdates(_0xd68524,_0x40fd2a){return function(_0x22601a){if(_0x22601a){return _0x22601a[_0xc823('0x36')](_0xd68524)[_0xc823('0x23')](function(_0xf69aea){return _0xf69aea;});}return null;};}function removeEntity(_0x1562fa,_0x40a11a){return function(_0x9fd3a2){if(_0x9fd3a2){return _0x9fd3a2[_0xc823('0x37')]()['then'](function(){_0x1562fa[_0xc823('0x2e')](0xcc)[_0xc823('0x2f')]();});}};}function handleEntityNotFound(_0x43e2ca,_0x1c4fb9){return function(_0x2b7273){if(!_0x2b7273){_0x43e2ca[_0xc823('0x2d')](0x194);}return _0x2b7273;};}function handleError(_0x48f688,_0xc1ba90){_0xc1ba90=_0xc1ba90||0x1f4;return function(_0x9972c0){logger['error'](_0x9972c0[_0xc823('0x38')]);if(_0x9972c0['name']){delete _0x9972c0[_0xc823('0x39')];}_0x48f688[_0xc823('0x2e')](_0xc1ba90)['send'](_0x9972c0);};}exports[_0xc823('0x3a')]=function(_0x27bb6c,_0x37aaf4){var _0x22eae8={},_0x3a2977={},_0x2c68fb={'count':0x0,'rows':[]};var _0x1fb5a4=_['map'](db['SmsMessage']['rawAttributes'],function(_0x1f7d4d){return{'name':_0x1f7d4d[_0xc823('0x3b')],'type':_0x1f7d4d[_0xc823('0x3c')][_0xc823('0x3d')]};});_0x3a2977[_0xc823('0x3e')]=_['map'](_0x1fb5a4,_0xc823('0x39'));_0x3a2977[_0xc823('0x3f')]=_[_0xc823('0x40')](_0x27bb6c[_0xc823('0x3f')]);_0x3a2977['filters']=_['intersection'](_0x3a2977['model'],_0x3a2977[_0xc823('0x3f')]);_0x22eae8[_0xc823('0x41')]=_[_0xc823('0x42')](_0x3a2977['model'],qs[_0xc823('0x43')](_0x27bb6c['query'][_0xc823('0x43')]));_0x22eae8[_0xc823('0x41')]=_0x22eae8[_0xc823('0x41')][_0xc823('0x44')]?_0x22eae8[_0xc823('0x41')]:_0x3a2977[_0xc823('0x3e')];if(!_0x27bb6c[_0xc823('0x3f')]['hasOwnProperty'](_0xc823('0x45'))){_0x22eae8['limit']=qs[_0xc823('0x46')](_0x27bb6c[_0xc823('0x3f')][_0xc823('0x46')]);_0x22eae8[_0xc823('0x32')]=qs[_0xc823('0x32')](_0x27bb6c[_0xc823('0x3f')][_0xc823('0x32')]);}_0x22eae8[_0xc823('0x47')]=qs['sort'](_0x27bb6c[_0xc823('0x3f')][_0xc823('0x48')]);_0x22eae8['where']=qs[_0xc823('0x49')](_[_0xc823('0x4a')](_0x27bb6c[_0xc823('0x3f')],_0x3a2977[_0xc823('0x49')]),_0x1fb5a4);if(_0x27bb6c[_0xc823('0x3f')][_0xc823('0x4b')]){_0x22eae8[_0xc823('0x4c')]=_[_0xc823('0x4d')](_0x22eae8[_0xc823('0x4c')],{'$or':_['map'](_0x1fb5a4,function(_0x153ca1){if(_0x153ca1[_0xc823('0x3c')]!=='VIRTUAL'){var _0x36a734={};_0x36a734[_0x153ca1[_0xc823('0x39')]]={'$like':'%'+_0x27bb6c['query'][_0xc823('0x4b')]+'%'};return _0x36a734;}})});}_0x22eae8=_['merge']({},_0x22eae8,_0x27bb6c[_0xc823('0x4e')]);var _0x2d80f3={'where':_0x22eae8['where']};return db['SmsMessage'][_0xc823('0x31')](_0x2d80f3)[_0xc823('0x23')](function(_0x3b10a0){_0x2c68fb[_0xc823('0x31')]=_0x3b10a0;if(_0x27bb6c[_0xc823('0x3f')][_0xc823('0x4f')]){_0x22eae8[_0xc823('0x50')]=[{'all':!![]}];}return db[_0xc823('0x51')]['findAll'](_0x22eae8);})[_0xc823('0x23')](function(_0x26b20a){_0x2c68fb['rows']=_0x26b20a;return _0x2c68fb;})['then'](respondWithFilteredResult(_0x37aaf4,_0x22eae8))[_0xc823('0x52')](handleError(_0x37aaf4,null));};exports['show']=function(_0x491928,_0x5c3217){var _0x4e1046={'raw':!![],'where':{'id':_0x491928['params']['id']}},_0x4c00f8={};_0x4c00f8[_0xc823('0x3e')]=_['keys'](db['SmsMessage'][_0xc823('0x53')]);_0x4c00f8['query']=_[_0xc823('0x40')](_0x491928[_0xc823('0x3f')]);_0x4c00f8['filters']=_[_0xc823('0x42')](_0x4c00f8[_0xc823('0x3e')],_0x4c00f8[_0xc823('0x3f')]);_0x4e1046['attributes']=_['intersection'](_0x4c00f8[_0xc823('0x3e')],qs[_0xc823('0x43')](_0x491928['query'][_0xc823('0x43')]));_0x4e1046[_0xc823('0x41')]=_0x4e1046[_0xc823('0x41')]['length']?_0x4e1046[_0xc823('0x41')]:_0x4c00f8[_0xc823('0x3e')];if(_0x491928[_0xc823('0x3f')][_0xc823('0x4f')]){_0x4e1046[_0xc823('0x50')]=[{'all':!![]}];}_0x4e1046=_[_0xc823('0x4d')]({},_0x4e1046,_0x491928[_0xc823('0x4e')]);return db['SmsMessage'][_0xc823('0x54')](_0x4e1046)[_0xc823('0x23')](handleEntityNotFound(_0x5c3217,null))[_0xc823('0x23')](respondWithResult(_0x5c3217,null))[_0xc823('0x52')](handleError(_0x5c3217,null));};exports[_0xc823('0x55')]=function(_0x31ba31,_0x37d7b4){return db['SmsMessage'][_0xc823('0x55')](_0x31ba31[_0xc823('0x56')],{})[_0xc823('0x23')](respondWithResult(_0x37d7b4,0xc9))[_0xc823('0x52')](handleError(_0x37d7b4,null));};exports[_0xc823('0x36')]=function(_0x2d20fc,_0x52adbb){if(_0x2d20fc[_0xc823('0x56')]['id']){delete _0x2d20fc['body']['id'];}return db['SmsMessage']['find']({'where':{'id':_0x2d20fc[_0xc823('0x57')]['id']}})['then'](handleEntityNotFound(_0x52adbb,null))[_0xc823('0x23')](saveUpdates(_0x2d20fc['body'],null))[_0xc823('0x23')](respondWithResult(_0x52adbb,null))[_0xc823('0x52')](handleError(_0x52adbb,null));};exports['destroy']=function(_0x2ae99e,_0x5592fa){return db['SmsMessage'][_0xc823('0x54')]({'where':{'id':_0x2ae99e['params']['id']}})[_0xc823('0x23')](handleEntityNotFound(_0x5592fa,null))['then'](removeEntity(_0x5592fa,null))[_0xc823('0x52')](handleError(_0x5592fa,null));};exports[_0xc823('0x58')]=function(_0x4b40e5,_0x41ae1a){return db[_0xc823('0x51')][_0xc823('0x58')]()[_0xc823('0x23')](respondWithResult(_0x41ae1a,null))['catch'](handleError(_0x41ae1a,null));};var interaction_log=require('../../config/logger')(_0xc823('0x59'));exports['accept']=function(_0x2240de,_0x2befd0,_0x1823f2){var _0x204c69={'channel':_0xc823('0x5a')};if(_0x2240de['body']['id']){delete _0x2240de[_0xc823('0x56')]['id'];}_0x2240de['body'][_0xc823('0x5b')]=!![];_0x2240de[_0xc823('0x56')]['readAt']=moment()[_0xc823('0x5c')]('YYYY-MM-DD\x20HH:mm:ss');_0x2240de[_0xc823('0x56')][_0xc823('0x5d')]=_0x2240de[_0xc823('0x56')][_0xc823('0x5d')]||_0x2240de['user']['id'];return db['SmsMessage']['find']({'where':{'id':_0x2240de['params']['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0xc823('0x5e')}]})[_0xc823('0x23')](handleEntityNotFound(_0x2befd0,null))['then'](saveUpdates(_0x2240de['body'],null))[_0xc823('0x23')](function(_0x13ff51){if(_0x13ff51){_0x204c69[_0xc823('0x2b')]=_0x13ff51[_0xc823('0x5f')]({'plain':!![]});return db[_0xc823('0x60')][_0xc823('0x54')]({'where':{'id':_0x13ff51[_0xc823('0x61')]}});}return null;})['then'](handleEntityNotFound(_0x2befd0,null))[_0xc823('0x23')](function(_0x371707){if(_0x371707){return _0x371707[_0xc823('0x36')]({'UserId':_0x2240de['body']['UserId'],'read1stAt':_['isNil'](_0x371707[_0xc823('0x62')])?moment()[_0xc823('0x5c')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xc823('0x23')](function(_0x41be34){if(_0x41be34){_0x204c69[_0xc823('0x63')]=_0x41be34[_0xc823('0x5f')]({'plain':!![]});interaction_log['info'](_0xc823('0x64'),_0x2240de[_0xc823('0x65')]['id'],_0x2240de[_0xc823('0x65')]['name'],_0x2240de[_0xc823('0x65')][_0xc823('0x66')],_0x204c69['interaction']['id'],_0x2240de[_0xc823('0x56')]?JSON[_0xc823('0x28')](_0x2240de['body']):'null');return respondWithRpcPromise('AcceptMessage',_0xc823('0x67'),_0x204c69);}return null;})[_0xc823('0x23')](function(_0x5dbe17){if(_0x5dbe17){if(_0x2240de[_0xc823('0x56')][_0xc823('0x68')]){_0x204c69[_0xc823('0x2b')][_0xc823('0x69')]=util[_0xc823('0x5c')](_0xc823('0x6a'),_0x2240de['user'][_0xc823('0x39')]);_0x204c69['message']['channel']=_0x204c69[_0xc823('0x6b')];_0x204c69['message'][_0xc823('0x6c')]=_0xc823('0x6d');return respondWithRpcPromise(_0xc823('0x6e'),_0xc823('0x6e'),{'event':_0xc823('0x6f'),'message':_0x204c69[_0xc823('0x2b')]},client9002)[_0xc823('0x23')](function(){return _0x204c69;});}return _0x204c69;}return null;})['then'](respondWithResult(_0x2befd0,null))[_0xc823('0x52')](handleError(_0x2befd0,null));};var interaction_log=require(_0xc823('0x12'))(_0xc823('0x59'));exports[_0xc823('0x34')]=function(_0x1f0ce3,_0x514138,_0x239a2d){var _0x1e9439={'agent':{},'channel':_0xc823('0x5a')};if(_0x1f0ce3[_0xc823('0x56')]['id']){delete _0x1f0ce3[_0xc823('0x56')]['id'];}_0x1f0ce3['body'][_0xc823('0x5d')]=_0x1f0ce3[_0xc823('0x56')][_0xc823('0x5d')]||_0x1f0ce3[_0xc823('0x65')]['id'];_0x1e9439['agent']['id']=_0x1f0ce3[_0xc823('0x56')][_0xc823('0x5d')];return db[_0xc823('0x51')][_0xc823('0x54')]({'where':{'id':_0x1f0ce3[_0xc823('0x57')]['id'],'UserId':null}})[_0xc823('0x23')](handleEntityNotFound(_0x514138,null))['then'](function(_0x2d2dc2){if(_0x2d2dc2){_0x1e9439['message']=_0x2d2dc2[_0xc823('0x5f')]({'plain':!![]});return db[_0xc823('0x60')][_0xc823('0x54')]({'where':{'id':_0x2d2dc2['SmsInteractionId']}});}return null;})[_0xc823('0x23')](handleEntityNotFound(_0x514138,null))[_0xc823('0x23')](function(_0x27d4b9){if(_0x27d4b9){_0x1e9439[_0xc823('0x63')]=_0x27d4b9[_0xc823('0x5f')]({'plain':!![]});interaction_log[_0xc823('0x24')](_0xc823('0x70'),_0x1f0ce3['user']['id'],_0x1f0ce3[_0xc823('0x65')][_0xc823('0x39')],_0x1f0ce3[_0xc823('0x65')][_0xc823('0x66')],_0x1e9439[_0xc823('0x63')]['id'],_0x1f0ce3[_0xc823('0x56')]?JSON[_0xc823('0x28')](_0x1f0ce3[_0xc823('0x56')]):_0xc823('0x71'));return respondWithRpcPromise(_0xc823('0x72'),_0xc823('0x73'),_0x1e9439);}return null;})[_0xc823('0x23')](function(_0x2091ab){if(_0x2091ab){_0x2091ab[_0xc823('0x2b')][_0xc823('0x69')]=util[_0xc823('0x5c')](_0xc823('0x6a'),_0x1f0ce3[_0xc823('0x65')][_0xc823('0x39')]);_0x2091ab[_0xc823('0x2b')]['channel']=_0x1e9439[_0xc823('0x6b')];_0x2091ab[_0xc823('0x2b')][_0xc823('0x6c')]=_0xc823('0x34');respondWithRpcPromise(_0xc823('0x6e'),_0xc823('0x6e'),{'event':'rejectmessage','message':_0x2091ab[_0xc823('0x2b')]},client9002);return _0x1e9439;}return null;})[_0xc823('0x23')](respondWithResult(_0x514138,null))[_0xc823('0x52')](handleError(_0x514138,null));};exports[_0xc823('0x2e')]=function(_0x2d250d,_0x397a29,_0x3dcd52){if(_0x2d250d['body']['id']){delete _0x2d250d[_0xc823('0x56')]['id'];}var _0x21438d;return db[_0xc823('0x51')][_0xc823('0x54')]({'where':{'id':_0x2d250d[_0xc823('0x57')]['id']}})[_0xc823('0x23')](handleEntityNotFound(_0x397a29,null))['then'](function(_0x222449){if(_0x222449){_0x21438d=_0x222449;return db[_0xc823('0x74')][_0xc823('0x54')]({'where':{'id':_0x222449[_0xc823('0x75')]}});}})[_0xc823('0x23')](handleEntityNotFound(_0x397a29,null))[_0xc823('0x23')](function(_0x2602e5){if(_0x2602e5){logger['debug']('SmsMessage,\x20%s,\x20%s,\x20%s','status',_0xc823('0x76'),_0x2602e5['type'],util[_0xc823('0x77')](_0x2d250d[_0xc823('0x56')],{'showHidden':![],'depth':null}));switch(_0x2602e5[_0xc823('0x3c')]){case _0xc823('0x78'):if(_0x2d250d['body'][_0xc823('0x79')]&&_0x2d250d[_0xc823('0x56')][_0xc823('0x79')]===_0x21438d[_0xc823('0x7a')]){return _0x21438d['update']({'read':!![]});}else{logger[_0xc823('0x29')](_0xc823('0x7b'),'status',_0xc823('0x78'),util['inspect'](_0x2d250d[_0xc823('0x56')],{'showHidden':![],'depth':null}));}break;case'plivo':if(_0x2d250d[_0xc823('0x56')][_0xc823('0x7c')]&&_0x2d250d[_0xc823('0x56')]['MessageUUID']===_0x21438d[_0xc823('0x7a')]&&_['indexOf']([_0xc823('0x7d'),_0xc823('0x7e')],_0x2d250d[_0xc823('0x56')][_0xc823('0x7f')])>=0x0){return _0x21438d[_0xc823('0x36')]({'read':!![]});}else{logger[_0xc823('0x29')](_0xc823('0x7b'),_0xc823('0x2e'),'plivio',util[_0xc823('0x77')](_0x2d250d[_0xc823('0x56')],{'showHidden':![],'depth':null}));}break;case _0xc823('0x80'):var _0x1ec68a=_0x2d250d[_0xc823('0x56')][_0xc823('0x81')][0x0];if(_0x1ec68a[_0xc823('0x2e')][_0xc823('0x82')]===_0xc823('0x83')){return _0x21438d[_0xc823('0x36')]({'read':!![]});}else{logger[_0xc823('0x29')](_0xc823('0x7b'),_0xc823('0x2e'),'infobip',util[_0xc823('0x77')](_0x2d250d[_0xc823('0x56')],{'showHidden':![],'depth':null}));}break;}return _0x21438d;}})[_0xc823('0x23')](respondWithResult(_0x397a29,null))[_0xc823('0x52')](handleError(_0x397a29,null));}; \ No newline at end of file +var _0x0caf=['acceptMessage','manual','interface','SIP/%s','channel','EventManager','acceptmessage','sms-interactions','SmsInteractionId','null','RejectMessage','rejectMessage','event','rejectmessage','SmsAccount','inspect','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','twilio','plivo','MessageUUID','indexOf','sent','plivio','infobip','results','groupName','zip-dir','fast-json-patch','request-promise','mustache','util','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','../../config/environment','redis','localhost','socket.io-emitter','./smsMessage.socket','register','client','http','ValidationError','then','info','SmsMessage,\x20%s,\x20%s','debug','SmsMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','name','send','index','SmsMessage','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','map','includeAll','findAll','rows','catch','show','rawAttributes','length','include','options','find','create','body','params','destroy','describe','accept','sms','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','Contact','get','SmsInteraction','isNil','read1stAt','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user'];(function(_0x52c3ec,_0x55b3ed){var _0x3fa422=function(_0x93170){while(--_0x93170){_0x52c3ec['push'](_0x52c3ec['shift']());}};_0x3fa422(++_0x55b3ed);}(_0x0caf,0x9f));var _0xf0ca=function(_0x19bae8,_0x3d7418){_0x19bae8=_0x19bae8-0x0;var _0x3abe9a=_0x0caf[_0x19bae8];return _0x3abe9a;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xf0ca('0x0'));var jsonpatch=require(_0xf0ca('0x1'));var rp=require(_0xf0ca('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xf0ca('0x3'));var util=require(_0xf0ca('0x4'));var path=require('path');var sox=require(_0xf0ca('0x5'));var csv=require(_0xf0ca('0x6'));var ejs=require(_0xf0ca('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0xf0ca('0x8'));var crypto=require(_0xf0ca('0x9'));var jsforce=require(_0xf0ca('0xa'));var deskjs=require(_0xf0ca('0xb'));var toCsv=require(_0xf0ca('0x6'));var querystring=require(_0xf0ca('0xc'));var Papa=require(_0xf0ca('0xd'));var Redis=require('ioredis');var authService=require(_0xf0ca('0xe'));var qs=require(_0xf0ca('0xf'));var as=require(_0xf0ca('0x10'));var hardwareService=require(_0xf0ca('0x11'));var logger=require(_0xf0ca('0x12'))('api');var utils=require('../../config/utils');var config=require(_0xf0ca('0x13'));var db=require('../../mysqldb')['db'];config[_0xf0ca('0x14')]=_['defaults'](config[_0xf0ca('0x14')],{'host':_0xf0ca('0x15'),'port':0x18eb});var socket=require(_0xf0ca('0x16'))(new Redis(config[_0xf0ca('0x14')]));require(_0xf0ca('0x17'))[_0xf0ca('0x18')](socket);var jayson=require('jayson/promise');var client=jayson[_0xf0ca('0x19')]['http']({'port':0x232c});var client9002=jayson['client'][_0xf0ca('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x34ea00,_0x3b1daa,_0x2b074e){if(_0x2b074e){var _0xc4ebc2=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xc4ebc2['test'](_0x3b1daa)){return _0x34ea00;}else{throw new db['Sequelize'][(_0xf0ca('0x1b'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x34ea00;}}function respondWithRpcPromise(_0x5af77f,_0x3245b2,_0x5eb7e8,_0x2473f0){return new BPromise(function(_0x239f38,_0x3a1466){var _0x1fe693=_0x2473f0||client;return _0x1fe693['request'](_0x5af77f,_0x5eb7e8)[_0xf0ca('0x1c')](function(_0x58bed2){logger[_0xf0ca('0x1d')](_0xf0ca('0x1e'),_0x3245b2,'request\x20sent');logger[_0xf0ca('0x1f')](_0xf0ca('0x20'),_0x3245b2,_0xf0ca('0x21'),JSON[_0xf0ca('0x22')](_0x58bed2));if(_0x58bed2[_0xf0ca('0x23')]){if(_0x58bed2[_0xf0ca('0x23')][_0xf0ca('0x24')]===0x1f4){logger['error'](_0xf0ca('0x1e'),_0x3245b2,_0x58bed2[_0xf0ca('0x23')][_0xf0ca('0x25')]);return _0x3a1466(_0x58bed2[_0xf0ca('0x23')][_0xf0ca('0x25')]);}logger[_0xf0ca('0x23')]('SmsMessage,\x20%s,\x20%s',_0x3245b2,_0x58bed2['error'][_0xf0ca('0x25')]);return _0x239f38(_0x58bed2[_0xf0ca('0x23')][_0xf0ca('0x25')]);}else{logger[_0xf0ca('0x1d')](_0xf0ca('0x1e'),_0x3245b2,_0xf0ca('0x21'));_0x239f38(_0x58bed2[_0xf0ca('0x26')][_0xf0ca('0x25')]);}})['catch'](function(_0x550e2e){logger[_0xf0ca('0x23')](_0xf0ca('0x1e'),_0x3245b2,_0x550e2e);_0x3a1466(_0x550e2e);});});}function respondWithStatusCode(_0x57ad7e,_0x23ac2c){_0x23ac2c=_0x23ac2c||0xcc;return function(_0x41708){if(_0x41708){return _0x57ad7e[_0xf0ca('0x27')](_0x23ac2c);}return _0x57ad7e[_0xf0ca('0x28')](_0x23ac2c)['end']();};}function respondWithResult(_0xb41d0a,_0xbefb0e){_0xbefb0e=_0xbefb0e||0xc8;return function(_0x35b78c){if(_0x35b78c){return _0xb41d0a[_0xf0ca('0x28')](_0xbefb0e)[_0xf0ca('0x29')](_0x35b78c);}};}function respondWithFilteredResult(_0x31b65c,_0x3ed79e){return function(_0x56bd3b){if(_0x56bd3b){var _0x6988a=_0x56bd3b[_0xf0ca('0x2a')],_0x4ba8ac=_0x3ed79e[_0xf0ca('0x2b')],_0x35d887=_0x3ed79e[_0xf0ca('0x2b')]+_0x3ed79e[_0xf0ca('0x2c')],_0x5c4625;if(_0x35d887>=_0x6988a){_0x35d887=_0x6988a;_0x5c4625=0xc8;}else{_0x5c4625=0xce;}_0x31b65c[_0xf0ca('0x28')](_0x5c4625);return _0x31b65c[_0xf0ca('0x2d')](_0xf0ca('0x2e'),_0x4ba8ac+'-'+_0x35d887+'/'+_0x6988a)[_0xf0ca('0x29')](_0x56bd3b);}return null;};}function patchUpdates(_0x35f0bd){return function(_0x3c53bf){try{jsonpatch[_0xf0ca('0x2f')](_0x3c53bf,_0x35f0bd,!![]);}catch(_0x242c6f){return BPromise[_0xf0ca('0x30')](_0x242c6f);}return _0x3c53bf[_0xf0ca('0x31')]();};}function saveUpdates(_0x4d7a1f,_0x3f9800){return function(_0x198d89){if(_0x198d89){return _0x198d89[_0xf0ca('0x32')](_0x4d7a1f)[_0xf0ca('0x1c')](function(_0x57109f){return _0x57109f;});}return null;};}function removeEntity(_0x147aeb,_0x5c4378){return function(_0x3fadd4){if(_0x3fadd4){return _0x3fadd4['destroy']()[_0xf0ca('0x1c')](function(){_0x147aeb[_0xf0ca('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x12ced5,_0x5aa016){return function(_0x4f8cf8){if(!_0x4f8cf8){_0x12ced5[_0xf0ca('0x27')](0x194);}return _0x4f8cf8;};}function handleError(_0x459169,_0x21a678){_0x21a678=_0x21a678||0x1f4;return function(_0x1ede94){logger[_0xf0ca('0x23')](_0x1ede94['stack']);if(_0x1ede94[_0xf0ca('0x33')]){delete _0x1ede94[_0xf0ca('0x33')];}_0x459169[_0xf0ca('0x28')](_0x21a678)[_0xf0ca('0x34')](_0x1ede94);};}exports[_0xf0ca('0x35')]=function(_0x46219a,_0x54c1c2){var _0x22f9fb={},_0x4204a7={},_0x30f82e={'count':0x0,'rows':[]};var _0x1fcc94=_['map'](db[_0xf0ca('0x36')]['rawAttributes'],function(_0x3a7f56){return{'name':_0x3a7f56[_0xf0ca('0x37')],'type':_0x3a7f56[_0xf0ca('0x38')][_0xf0ca('0x39')]};});_0x4204a7[_0xf0ca('0x3a')]=_['map'](_0x1fcc94,'name');_0x4204a7[_0xf0ca('0x3b')]=_[_0xf0ca('0x3c')](_0x46219a[_0xf0ca('0x3b')]);_0x4204a7[_0xf0ca('0x3d')]=_[_0xf0ca('0x3e')](_0x4204a7[_0xf0ca('0x3a')],_0x4204a7[_0xf0ca('0x3b')]);_0x22f9fb[_0xf0ca('0x3f')]=_[_0xf0ca('0x3e')](_0x4204a7[_0xf0ca('0x3a')],qs['fields'](_0x46219a[_0xf0ca('0x3b')][_0xf0ca('0x40')]));_0x22f9fb[_0xf0ca('0x3f')]=_0x22f9fb[_0xf0ca('0x3f')]['length']?_0x22f9fb['attributes']:_0x4204a7[_0xf0ca('0x3a')];if(!_0x46219a[_0xf0ca('0x3b')][_0xf0ca('0x41')]('nolimit')){_0x22f9fb[_0xf0ca('0x2c')]=qs[_0xf0ca('0x2c')](_0x46219a[_0xf0ca('0x3b')][_0xf0ca('0x2c')]);_0x22f9fb[_0xf0ca('0x2b')]=qs[_0xf0ca('0x2b')](_0x46219a[_0xf0ca('0x3b')][_0xf0ca('0x2b')]);}_0x22f9fb[_0xf0ca('0x42')]=qs[_0xf0ca('0x43')](_0x46219a[_0xf0ca('0x3b')][_0xf0ca('0x43')]);_0x22f9fb[_0xf0ca('0x44')]=qs[_0xf0ca('0x3d')](_[_0xf0ca('0x45')](_0x46219a[_0xf0ca('0x3b')],_0x4204a7[_0xf0ca('0x3d')]),_0x1fcc94);if(_0x46219a[_0xf0ca('0x3b')][_0xf0ca('0x46')]){_0x22f9fb[_0xf0ca('0x44')]=_[_0xf0ca('0x47')](_0x22f9fb[_0xf0ca('0x44')],{'$or':_[_0xf0ca('0x48')](_0x1fcc94,function(_0x403f7d){if(_0x403f7d[_0xf0ca('0x38')]!=='VIRTUAL'){var _0xcc2019={};_0xcc2019[_0x403f7d[_0xf0ca('0x33')]]={'$like':'%'+_0x46219a[_0xf0ca('0x3b')][_0xf0ca('0x46')]+'%'};return _0xcc2019;}})});}_0x22f9fb=_[_0xf0ca('0x47')]({},_0x22f9fb,_0x46219a['options']);var _0x2f91f9={'where':_0x22f9fb[_0xf0ca('0x44')]};return db['SmsMessage']['count'](_0x2f91f9)[_0xf0ca('0x1c')](function(_0x3e6b79){_0x30f82e[_0xf0ca('0x2a')]=_0x3e6b79;if(_0x46219a['query'][_0xf0ca('0x49')]){_0x22f9fb['include']=[{'all':!![]}];}return db['SmsMessage'][_0xf0ca('0x4a')](_0x22f9fb);})['then'](function(_0x5c4cc6){_0x30f82e[_0xf0ca('0x4b')]=_0x5c4cc6;return _0x30f82e;})['then'](respondWithFilteredResult(_0x54c1c2,_0x22f9fb))[_0xf0ca('0x4c')](handleError(_0x54c1c2,null));};exports[_0xf0ca('0x4d')]=function(_0x3d0ab3,_0x3883e9){var _0x17eef2={'raw':!![],'where':{'id':_0x3d0ab3['params']['id']}},_0x3fda02={};_0x3fda02[_0xf0ca('0x3a')]=_[_0xf0ca('0x3c')](db[_0xf0ca('0x36')][_0xf0ca('0x4e')]);_0x3fda02['query']=_[_0xf0ca('0x3c')](_0x3d0ab3[_0xf0ca('0x3b')]);_0x3fda02[_0xf0ca('0x3d')]=_[_0xf0ca('0x3e')](_0x3fda02[_0xf0ca('0x3a')],_0x3fda02[_0xf0ca('0x3b')]);_0x17eef2[_0xf0ca('0x3f')]=_[_0xf0ca('0x3e')](_0x3fda02['model'],qs['fields'](_0x3d0ab3[_0xf0ca('0x3b')][_0xf0ca('0x40')]));_0x17eef2[_0xf0ca('0x3f')]=_0x17eef2[_0xf0ca('0x3f')][_0xf0ca('0x4f')]?_0x17eef2[_0xf0ca('0x3f')]:_0x3fda02[_0xf0ca('0x3a')];if(_0x3d0ab3[_0xf0ca('0x3b')][_0xf0ca('0x49')]){_0x17eef2[_0xf0ca('0x50')]=[{'all':!![]}];}_0x17eef2=_[_0xf0ca('0x47')]({},_0x17eef2,_0x3d0ab3[_0xf0ca('0x51')]);return db[_0xf0ca('0x36')][_0xf0ca('0x52')](_0x17eef2)['then'](handleEntityNotFound(_0x3883e9,null))[_0xf0ca('0x1c')](respondWithResult(_0x3883e9,null))[_0xf0ca('0x4c')](handleError(_0x3883e9,null));};exports['create']=function(_0x24f0c8,_0x24143){return db['SmsMessage'][_0xf0ca('0x53')](_0x24f0c8['body'],{})[_0xf0ca('0x1c')](respondWithResult(_0x24143,0xc9))['catch'](handleError(_0x24143,null));};exports[_0xf0ca('0x32')]=function(_0x284450,_0x1d2265){if(_0x284450[_0xf0ca('0x54')]['id']){delete _0x284450[_0xf0ca('0x54')]['id'];}return db[_0xf0ca('0x36')][_0xf0ca('0x52')]({'where':{'id':_0x284450[_0xf0ca('0x55')]['id']}})[_0xf0ca('0x1c')](handleEntityNotFound(_0x1d2265,null))[_0xf0ca('0x1c')](saveUpdates(_0x284450[_0xf0ca('0x54')],null))[_0xf0ca('0x1c')](respondWithResult(_0x1d2265,null))[_0xf0ca('0x4c')](handleError(_0x1d2265,null));};exports[_0xf0ca('0x56')]=function(_0x4b7fc8,_0x26a764){return db[_0xf0ca('0x36')][_0xf0ca('0x52')]({'where':{'id':_0x4b7fc8[_0xf0ca('0x55')]['id']}})[_0xf0ca('0x1c')](handleEntityNotFound(_0x26a764,null))['then'](removeEntity(_0x26a764,null))['catch'](handleError(_0x26a764,null));};exports['describe']=function(_0x53fa28,_0x29b5be){return db[_0xf0ca('0x36')][_0xf0ca('0x57')]()[_0xf0ca('0x1c')](respondWithResult(_0x29b5be,null))['catch'](handleError(_0x29b5be,null));};var interaction_log=require(_0xf0ca('0x12'))('sms-interactions');exports[_0xf0ca('0x58')]=function(_0x28d7fb,_0x48dacb,_0x46c41e){var _0x68ff58={'channel':_0xf0ca('0x59')};if(_0x28d7fb['body']['id']){delete _0x28d7fb[_0xf0ca('0x54')]['id'];}_0x28d7fb['body'][_0xf0ca('0x5a')]=!![];_0x28d7fb[_0xf0ca('0x54')][_0xf0ca('0x5b')]=moment()[_0xf0ca('0x5c')](_0xf0ca('0x5d'));_0x28d7fb[_0xf0ca('0x54')][_0xf0ca('0x5e')]=_0x28d7fb[_0xf0ca('0x54')][_0xf0ca('0x5e')]||_0x28d7fb['user']['id'];return db[_0xf0ca('0x36')]['find']({'where':{'id':_0x28d7fb[_0xf0ca('0x55')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0xf0ca('0x5f')}]})[_0xf0ca('0x1c')](handleEntityNotFound(_0x48dacb,null))[_0xf0ca('0x1c')](saveUpdates(_0x28d7fb['body'],null))[_0xf0ca('0x1c')](function(_0x3712d8){if(_0x3712d8){_0x68ff58[_0xf0ca('0x25')]=_0x3712d8[_0xf0ca('0x60')]({'plain':!![]});return db[_0xf0ca('0x61')][_0xf0ca('0x52')]({'where':{'id':_0x3712d8['SmsInteractionId']}});}return null;})[_0xf0ca('0x1c')](handleEntityNotFound(_0x48dacb,null))['then'](function(_0x568d61){if(_0x568d61){return _0x568d61['update']({'UserId':_0x28d7fb['body'][_0xf0ca('0x5e')],'read1stAt':_[_0xf0ca('0x62')](_0x568d61[_0xf0ca('0x63')])?moment()[_0xf0ca('0x5c')](_0xf0ca('0x5d')):undefined});}return null;})[_0xf0ca('0x1c')](function(_0x2c0a9f){if(_0x2c0a9f){_0x68ff58[_0xf0ca('0x64')]=_0x2c0a9f['get']({'plain':!![]});interaction_log[_0xf0ca('0x1d')](_0xf0ca('0x65'),_0x28d7fb[_0xf0ca('0x66')]['id'],_0x28d7fb[_0xf0ca('0x66')][_0xf0ca('0x33')],_0x28d7fb[_0xf0ca('0x66')]['role'],_0x68ff58[_0xf0ca('0x64')]['id'],_0x28d7fb[_0xf0ca('0x54')]?JSON[_0xf0ca('0x22')](_0x28d7fb[_0xf0ca('0x54')]):'null');return respondWithRpcPromise('AcceptMessage',_0xf0ca('0x67'),_0x68ff58);}return null;})[_0xf0ca('0x1c')](function(_0x7ded2d){if(_0x7ded2d){if(_0x28d7fb[_0xf0ca('0x54')][_0xf0ca('0x68')]){_0x68ff58[_0xf0ca('0x25')][_0xf0ca('0x69')]=util[_0xf0ca('0x5c')](_0xf0ca('0x6a'),_0x28d7fb[_0xf0ca('0x66')][_0xf0ca('0x33')]);_0x68ff58[_0xf0ca('0x25')]['channel']=_0x68ff58[_0xf0ca('0x6b')];_0x68ff58[_0xf0ca('0x25')]['event']=_0xf0ca('0x58');return respondWithRpcPromise('EventManager',_0xf0ca('0x6c'),{'event':_0xf0ca('0x6d'),'message':_0x68ff58[_0xf0ca('0x25')]},client9002)['then'](function(){return _0x68ff58;});}return _0x68ff58;}return null;})[_0xf0ca('0x1c')](respondWithResult(_0x48dacb,null))[_0xf0ca('0x4c')](handleError(_0x48dacb,null));};var interaction_log=require(_0xf0ca('0x12'))(_0xf0ca('0x6e'));exports['reject']=function(_0x40f570,_0x3f5fef,_0x2b2617){var _0x4895fc={'agent':{},'channel':'sms'};if(_0x40f570[_0xf0ca('0x54')]['id']){delete _0x40f570['body']['id'];}_0x40f570['body'][_0xf0ca('0x5e')]=_0x40f570[_0xf0ca('0x54')][_0xf0ca('0x5e')]||_0x40f570[_0xf0ca('0x66')]['id'];_0x4895fc['agent']['id']=_0x40f570[_0xf0ca('0x54')][_0xf0ca('0x5e')];return db[_0xf0ca('0x36')][_0xf0ca('0x52')]({'where':{'id':_0x40f570[_0xf0ca('0x55')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x3f5fef,null))[_0xf0ca('0x1c')](function(_0x28f583){if(_0x28f583){_0x4895fc[_0xf0ca('0x25')]=_0x28f583[_0xf0ca('0x60')]({'plain':!![]});return db[_0xf0ca('0x61')]['find']({'where':{'id':_0x28f583[_0xf0ca('0x6f')]}});}return null;})[_0xf0ca('0x1c')](handleEntityNotFound(_0x3f5fef,null))[_0xf0ca('0x1c')](function(_0x367336){if(_0x367336){_0x4895fc[_0xf0ca('0x64')]=_0x367336[_0xf0ca('0x60')]({'plain':!![]});interaction_log[_0xf0ca('0x1d')]('[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x40f570[_0xf0ca('0x66')]['id'],_0x40f570[_0xf0ca('0x66')]['name'],_0x40f570[_0xf0ca('0x66')]['role'],_0x4895fc[_0xf0ca('0x64')]['id'],_0x40f570[_0xf0ca('0x54')]?JSON[_0xf0ca('0x22')](_0x40f570[_0xf0ca('0x54')]):_0xf0ca('0x70'));return respondWithRpcPromise(_0xf0ca('0x71'),_0xf0ca('0x72'),_0x4895fc);}return null;})[_0xf0ca('0x1c')](function(_0x4e9efb){if(_0x4e9efb){_0x4e9efb['message']['interface']=util['format'](_0xf0ca('0x6a'),_0x40f570[_0xf0ca('0x66')][_0xf0ca('0x33')]);_0x4e9efb[_0xf0ca('0x25')]['channel']=_0x4895fc[_0xf0ca('0x6b')];_0x4e9efb[_0xf0ca('0x25')][_0xf0ca('0x73')]='reject';respondWithRpcPromise(_0xf0ca('0x6c'),'EventManager',{'event':_0xf0ca('0x74'),'message':_0x4e9efb['message']},client9002);return _0x4895fc;}return null;})[_0xf0ca('0x1c')](respondWithResult(_0x3f5fef,null))['catch'](handleError(_0x3f5fef,null));};exports[_0xf0ca('0x28')]=function(_0x4cf2e7,_0x29ac00,_0x4ed757){if(_0x4cf2e7[_0xf0ca('0x54')]['id']){delete _0x4cf2e7[_0xf0ca('0x54')]['id'];}var _0x42caf1;return db[_0xf0ca('0x36')][_0xf0ca('0x52')]({'where':{'id':_0x4cf2e7['params']['id']}})[_0xf0ca('0x1c')](handleEntityNotFound(_0x29ac00,null))[_0xf0ca('0x1c')](function(_0xec6b4){if(_0xec6b4){_0x42caf1=_0xec6b4;return db[_0xf0ca('0x75')][_0xf0ca('0x52')]({'where':{'id':_0xec6b4['SmsAccountId']}});}})[_0xf0ca('0x1c')](handleEntityNotFound(_0x29ac00,null))[_0xf0ca('0x1c')](function(_0x34d2ff){if(_0x34d2ff){logger[_0xf0ca('0x1f')](_0xf0ca('0x20'),_0xf0ca('0x28'),'received\x20delivery\x20report\x20from',_0x34d2ff[_0xf0ca('0x38')],util[_0xf0ca('0x76')](_0x4cf2e7[_0xf0ca('0x54')],{'showHidden':![],'depth':null}));switch(_0x34d2ff[_0xf0ca('0x38')]){case'twilio':if(_0x4cf2e7[_0xf0ca('0x54')][_0xf0ca('0x77')]&&_0x4cf2e7[_0xf0ca('0x54')][_0xf0ca('0x77')]===_0x42caf1[_0xf0ca('0x78')]){return _0x42caf1['update']({'read':!![]});}else{logger[_0xf0ca('0x23')](_0xf0ca('0x79'),_0xf0ca('0x28'),_0xf0ca('0x7a'),util[_0xf0ca('0x76')](_0x4cf2e7['body'],{'showHidden':![],'depth':null}));}break;case _0xf0ca('0x7b'):if(_0x4cf2e7[_0xf0ca('0x54')][_0xf0ca('0x7c')]&&_0x4cf2e7[_0xf0ca('0x54')][_0xf0ca('0x7c')]===_0x42caf1[_0xf0ca('0x78')]&&_[_0xf0ca('0x7d')]([_0xf0ca('0x7e'),'delivered'],_0x4cf2e7[_0xf0ca('0x54')]['Status'])>=0x0){return _0x42caf1[_0xf0ca('0x32')]({'read':!![]});}else{logger[_0xf0ca('0x23')](_0xf0ca('0x79'),_0xf0ca('0x28'),_0xf0ca('0x7f'),util[_0xf0ca('0x76')](_0x4cf2e7[_0xf0ca('0x54')],{'showHidden':![],'depth':null}));}break;case _0xf0ca('0x80'):var _0x5d5d62=_0x4cf2e7['body'][_0xf0ca('0x81')][0x0];if(_0x5d5d62[_0xf0ca('0x28')][_0xf0ca('0x82')]==='DELIVERED'){return _0x42caf1[_0xf0ca('0x32')]({'read':!![]});}else{logger[_0xf0ca('0x23')](_0xf0ca('0x79'),_0xf0ca('0x28'),_0xf0ca('0x80'),util[_0xf0ca('0x76')](_0x4cf2e7[_0xf0ca('0x54')],{'showHidden':![],'depth':null}));}break;}return _0x42caf1;}})['then'](respondWithResult(_0x29ac00,null))[_0xf0ca('0x4c')](handleError(_0x29ac00,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index e295603..285d544 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 _0x72e1=['remove','emit','hasOwnProperty','hook','exports','SmsMessage','setMaxListeners','save','update'];(function(_0x5ea797,_0x2d39dd){var _0x500783=function(_0x4923f2){while(--_0x4923f2){_0x5ea797['push'](_0x5ea797['shift']());}};_0x500783(++_0x2d39dd);}(_0x72e1,0x8c));var _0x172e=function(_0x307fe6,_0x221515){_0x307fe6=_0x307fe6-0x0;var _0x149d27=_0x72e1[_0x307fe6];return _0x149d27;};'use strict';var EventEmitter=require('events');var SmsMessage=require('../../mysqldb')['db'][_0x172e('0x0')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x172e('0x1')](0x0);var events={'afterCreate':_0x172e('0x2'),'afterUpdate':_0x172e('0x3'),'afterDestroy':_0x172e('0x4')};function emitEvent(_0x48bb0c){return function(_0x43ccc0,_0x50b35b,_0x61aa84){SmsMessageEvents['emit'](_0x48bb0c+':'+_0x43ccc0['id'],_0x43ccc0);SmsMessageEvents[_0x172e('0x5')](_0x48bb0c,_0x43ccc0);_0x61aa84(null);};}for(var e in events){if(events[_0x172e('0x6')](e)){var event=events[e];SmsMessage[_0x172e('0x7')](e,emitEvent(event));}}module[_0x172e('0x8')]=SmsMessageEvents; \ No newline at end of file +var _0xa6b9=['../../mysqldb','SmsMessage','save','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x863735,_0x4e6ed2){var _0x51e3d0=function(_0x45ccea){while(--_0x45ccea){_0x863735['push'](_0x863735['shift']());}};_0x51e3d0(++_0x4e6ed2);}(_0xa6b9,0x19d));var _0x9a6b=function(_0x552e73,_0x5ecc9d){_0x552e73=_0x552e73-0x0;var _0x1ab8a5=_0xa6b9[_0x552e73];return _0x1ab8a5;};'use strict';var EventEmitter=require(_0x9a6b('0x0'));var SmsMessage=require(_0x9a6b('0x1'))['db'][_0x9a6b('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9a6b('0x3'),'afterUpdate':'update','afterDestroy':_0x9a6b('0x4')};function emitEvent(_0x52c290){return function(_0x3b10e8,_0x44d79a,_0x32b31e){SmsMessageEvents[_0x9a6b('0x5')](_0x52c290+':'+_0x3b10e8['id'],_0x3b10e8);SmsMessageEvents[_0x9a6b('0x5')](_0x52c290,_0x3b10e8);_0x32b31e(null);};}for(var e in events){if(events[_0x9a6b('0x6')](e)){var event=events[e];SmsMessage[_0x9a6b('0x7')](e,emitEvent(event));}}module[_0x9a6b('0x8')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index 5e8078a..4816392 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 _0x3930=['/status?token=','token','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','sender','login?username=','&password=','split','sms','user_key','internal_order_id','inspect','Missing\x20parameters:\x20username,\x20password','connectel','https://smsapi.connectel.se/api/send/','requestid','deliveryReport','read','Missing\x20parameters:\x20authToken','clicksend','format','%s:%s','POST','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','http_code','data','messages','message_id','clickSend','plivo','authId','senderString','https://api.plivo.com/v1/Account/%s/Message/','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','remote','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','apiKey','login','text','timestamp','keys','length','createHash','md5','signature=','GET','/external/get/send.php?','id_sms','clickatell','https://platform.clickatell.com/messages','UTF-8','apiMessageId','Missing\x20parameters:\x20apiKey','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','https://api.intelepeer.com/_rest/v4/app/sms/mdr','message','refid','status','utf8mb4','util','api','bluebird','path','../../config/environment','./smsMessage.attributes','exports','define','SmsMessage','sms_messages','messageId','fti_sms_messages','body','get','direction','toLowerCase','out','secret','isNil','SmsInteraction','then','update','createdAt','catch','error','SmsAccount','find','SmsAccountId','type','twilio','accountSid','authToken','phone','/api/sms/messages/'];(function(_0x1c100b,_0x5e17a0){var _0x2417fe=function(_0x4f5756){while(--_0x4f5756){_0x1c100b['push'](_0x1c100b['shift']());}};_0x2417fe(++_0x5e17a0);}(_0x3930,0x12e));var _0x0393=function(_0x1b2763,_0x49e0b5){_0x1b2763=_0x1b2763-0x0;var _0x5a02a5=_0x3930[_0x1b2763];return _0x5a02a5;};'use strict';var _=require('lodash');var util=require(_0x0393('0x0'));var logger=require('../../config/logger')(_0x0393('0x1'));var moment=require('moment');var BPromise=require(_0x0393('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0393('0x3'));var rimraf=require('rimraf');var config=require(_0x0393('0x4'));var attributes=require(_0x0393('0x5'));module[_0x0393('0x6')]=function(_0x1f7355,_0x5ec92d){return _0x1f7355[_0x0393('0x7')](_0x0393('0x8'),attributes,{'tableName':_0x0393('0x9'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0x0393('0xa')]},{'name':_0x0393('0xb'),'fields':[_0x0393('0xc')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0xac0ccc,_0x539d5c,_0x114a4e){var _0x4bc309=_0x1f7355['models'];var _0x5445c8=_0xac0ccc[_0x0393('0xd')]({'plain':!![]});if(_0x5445c8[_0x0393('0xe')][_0x0393('0xf')]()==='in'||_0x5445c8[_0x0393('0xe')]['toLowerCase']()===_0x0393('0x10')&&!_0x5445c8[_0x0393('0x11')]&&!_[_0x0393('0x12')](_0x5445c8['UserId'])){_0x4bc309[_0x0393('0x13')]['findOne']({'where':{'id':_0x5445c8['SmsInteractionId']}})[_0x0393('0x14')](function(_0x1e2972){if(_0x1e2972){_0x1e2972[_0x0393('0x15')]({'lastMsgAt':_0x5445c8[_0x0393('0x16')],'lastMsgDirection':_0x5445c8[_0x0393('0xe')][_0x0393('0xf')]()});}})[_0x0393('0x17')](function(_0x14dcde){console[_0x0393('0x18')](_0x14dcde);});}if(_0x5445c8[_0x0393('0xe')]==='out'&&!_0x5445c8[_0x0393('0x11')]){var _0x55aa48;_0x4bc309[_0x0393('0x19')][_0x0393('0x1a')]({'where':{'id':_0x5445c8[_0x0393('0x1b')]},'raw':!![]})[_0x0393('0x14')](function(_0x5beed4){_0x55aa48=_0x5beed4;if(_0x55aa48&&_0x55aa48['type']){switch(_0x55aa48[_0x0393('0x1c')]){case _0x0393('0x1d'):var _0x4a2087=require(_0x0393('0x1d'));if(_0x55aa48[_0x0393('0x1e')]&&_0x55aa48[_0x0393('0x1f')]&&_0x55aa48[_0x0393('0x20')]){var _0x4fc0c3=new _0x4a2087(_0x55aa48[_0x0393('0x1e')],_0x55aa48[_0x0393('0x1f')]);_0x4fc0c3['messages']['create']({'body':_0x5445c8[_0x0393('0xc')],'to':_0x5445c8[_0x0393('0x20')],'from':_0x55aa48[_0x0393('0x20')],'statusCallback':_0x55aa48['remote']+_0x0393('0x21')+_0x5445c8['id']+_0x0393('0x22')+_0x55aa48[_0x0393('0x23')]})[_0x0393('0x14')](function(_0x300b16){if(_0x300b16['sid']){return _0xac0ccc[_0x0393('0x15')]({'messageId':_0x300b16['sid']});}})[_0x0393('0x17')](function(_0x61feeb){logger['error'](_0x0393('0x24'),_0x0393('0x25'),_0x0393('0x1d'),util['inspect'](_0x61feeb,{'showHidden':![],'depth':null}));});}else{logger[_0x0393('0x18')](_0x0393('0x24'),_0x0393('0x25'),_0x0393('0x1d'),_0x0393('0x26'));}break;case _0x0393('0x27'):var _0x228d08=_0x0393('0x28');if(_0x55aa48[_0x0393('0x29')]&&_0x55aa48[_0x0393('0x2a')]){var _0x562611={'recipient':[_0x5445c8[_0x0393('0x20')]],'message':_0x5445c8[_0x0393('0xc')],'message_type':_0x55aa48['smsMethod']};if(_0x55aa48['smsMethod']&&_0x55aa48[_0x0393('0x2b')]!=='SI'){_0x562611[_0x0393('0x2c')]=_0x55aa48[_0x0393('0x20')];}var _0x2d841d={'url':_0x228d08+_0x0393('0x2d')+_0x55aa48[_0x0393('0x29')]+_0x0393('0x2e')+_0x55aa48[_0x0393('0x2a')],'method':'GET'};rp(_0x2d841d)['then'](function(_0x3ae10f){var _0x4bd9d8=_0x3ae10f[_0x0393('0x2f')](';');var _0x2cbc88={'user_key':_0x4bd9d8[0x0],'session_key':_0x4bd9d8[0x1]};_0x2d841d={'url':_0x228d08+_0x0393('0x30'),'method':'POST','headers':{'user_key':_0x2cbc88[_0x0393('0x31')],'Session_key':_0x2cbc88['session_key']},'json':!![],'body':_0x562611};return rp(_0x2d841d);})['then'](function(_0x4aec34){if(_0x4aec34['total_sent']>=0x1){var _0x286121={'messageId':_0x4aec34[_0x0393('0x32')]};if(_0x55aa48[_0x0393('0x2b')]!=='GP'||!_0x55aa48['deliveryReport']){_0x286121['read']=!![];}return _0xac0ccc[_0x0393('0x15')](_0x286121);}else{return logger[_0x0393('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x0393('0x25'),'skebby',util[_0x0393('0x33')](_0x4aec34,{'showHidden':![],'depth':null}));}})[_0x0393('0x17')](function(_0x549997){return logger[_0x0393('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x0393('0x25'),_0x0393('0x27'),util[_0x0393('0x33')](_0x549997,{'showHidden':![],'depth':null}));});}else{logger[_0x0393('0x18')](_0x0393('0x24'),'afterCreate',_0x0393('0x27'),_0x0393('0x34'));}break;case _0x0393('0x35'):if(_0x55aa48[_0x0393('0x1f')]){var _0x3c6f32={'recipient':_0x5445c8['phone'],'message':_0x5445c8[_0x0393('0xc')],'sender':_0x55aa48['senderString']||_0x55aa48[_0x0393('0x20')],'authorization':_0x55aa48[_0x0393('0x1f')]};var _0x539d5c={'method':'POST','uri':_0x0393('0x36'),'body':_0x3c6f32,'json':!![]};rp(_0x539d5c)['then'](function(_0x224e33){var _0x7d50dd={'messageId':_0x224e33[_0x0393('0x37')]};if(!_0x55aa48[_0x0393('0x38')]){_0x7d50dd[_0x0393('0x39')]=!![];}return _0xac0ccc[_0x0393('0x15')](_0x7d50dd);})[_0x0393('0x17')](function(_0x5e8f00){logger[_0x0393('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x0393('0x35'),util[_0x0393('0x33')](_0x5e8f00,{'showHidden':![],'depth':null}));});}else{logger[_0x0393('0x18')](_0x0393('0x24'),_0x0393('0x25'),'connectel',_0x0393('0x3a'));}break;case _0x0393('0x3b'):if(_0x55aa48['username']&&_0x55aa48['password']){var _0x3c6f32={'messages':[{'source':'xCALLY\x20Motion','to':_0x5445c8[_0x0393('0x20')],'body':_0x5445c8['body'],'from':_0x55aa48['senderString']||_0x55aa48[_0x0393('0x20')]}]};var _0x5a3fca=util[_0x0393('0x3c')](_0x0393('0x3d'),_0x55aa48[_0x0393('0x29')],_0x55aa48[_0x0393('0x2a')]);var _0x539d5c={'method':_0x0393('0x3e'),'uri':_0x0393('0x3f'),'body':_0x3c6f32,'headers':{'Authorization':util['format'](_0x0393('0x40'),new Buffer(_0x5a3fca)[_0x0393('0x41')](_0x0393('0x42')))},'json':!![]};rp(_0x539d5c)[_0x0393('0x14')](function(_0x3c389f){if(_0x3c389f[_0x0393('0x43')]>=0xc8&&_0x3c389f['http_code']<=0xce){if(_0x3c389f[_0x0393('0x44')]&&_0x3c389f[_0x0393('0x44')]['queued_count']>0x0){var _0x594c1f=_['head'](_0x3c389f[_0x0393('0x44')][_0x0393('0x45')]);var _0x3173a0={'messageId':_0x594c1f[_0x0393('0x46')]};if(!_0x55aa48['deliveryReport']){_0x3173a0[_0x0393('0x39')]=!![];}return _0xac0ccc[_0x0393('0x15')](_0x3173a0);}else{logger[_0x0393('0x18')](_0x0393('0x24'),_0x0393('0x25'),_0x0393('0x47'),util[_0x0393('0x33')](_0x3c389f,{'showHidden':![],'depth':null}));}}else{logger[_0x0393('0x18')](_0x0393('0x24'),_0x0393('0x25'),_0x0393('0x47'),util[_0x0393('0x33')](_0x3c389f,{'showHidden':![],'depth':null}));}})[_0x0393('0x17')](function(_0x4a2ffe){logger[_0x0393('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x0393('0x25'),_0x0393('0x47'),util[_0x0393('0x33')](_0x4a2ffe,{'showHidden':![],'depth':null}));});}else{logger[_0x0393('0x18')](_0x0393('0x24'),_0x0393('0x25'),_0x0393('0x47'),_0x0393('0x34'));}break;case _0x0393('0x48'):if(_0x55aa48[_0x0393('0x49')]&&_0x55aa48[_0x0393('0x1f')]){var _0x3c6f32={'dst':_0x5445c8['phone'],'text':_0x5445c8[_0x0393('0xc')],'src':_0x55aa48[_0x0393('0x4a')]||_0x55aa48[_0x0393('0x20')],'url':_0x55aa48['remote']+'/api/sms/messages/'+_0x5445c8['id']+'/status?token='+_0x55aa48['token']};var _0x5a3fca=util[_0x0393('0x3c')](_0x0393('0x3d'),_0x55aa48['authId'],_0x55aa48[_0x0393('0x1f')]);var _0x539d5c={'method':_0x0393('0x3e'),'uri':util[_0x0393('0x3c')](_0x0393('0x4b'),_0x55aa48[_0x0393('0x49')]),'body':_0x3c6f32,'headers':{'Authorization':util[_0x0393('0x3c')]('Basic\x20%s',new Buffer(_0x5a3fca)[_0x0393('0x41')](_0x0393('0x42')))},'json':!![]};rp(_0x539d5c)[_0x0393('0x14')](function(_0x311195){var _0x266782={'messageId':_0x311195['message_uuid'][0x0]};return _0xac0ccc[_0x0393('0x15')](_0x266782);})[_0x0393('0x17')](function(_0x4b9b1c){logger[_0x0393('0x18')](_0x0393('0x24'),'afterCreate',_0x0393('0x48'),util[_0x0393('0x33')](_0x4b9b1c,{'showHidden':![],'depth':null}));});}else{logger[_0x0393('0x18')](_0x0393('0x24'),_0x0393('0x25'),_0x0393('0x48'),_0x0393('0x4c'));}break;case _0x0393('0x4d'):if(_0x55aa48[_0x0393('0x29')]&&_0x55aa48[_0x0393('0x2a')]){if(_0x55aa48[_0x0393('0x4e')]){var _0x1ed21a={'method':_0x0393('0x3e'),'uri':_0x55aa48[_0x0393('0x4e')]+_0x0393('0x4f'),'body':{'username':_0x55aa48['username'],'password':_0x55aa48[_0x0393('0x2a')]},'json':!![]};return rp(_0x1ed21a)[_0x0393('0x14')](function(_0x25480d){var _0x1eab4c={'method':_0x0393('0x3e'),'uri':_0x55aa48[_0x0393('0x4e')]+_0x0393('0x50'),'body':{'messages':[{'from':_0x55aa48[_0x0393('0x20')],'destinations':[{'to':_0x5445c8[_0x0393('0x20')]}],'text':_0x5445c8[_0x0393('0xc')],'notifyUrl':_0x55aa48[_0x0393('0x51')]+'/api/sms/messages/'+_0x5445c8['id']+'/status?token='+_0x55aa48[_0x0393('0x23')],'notifyContentType':_0x0393('0x52'),'callbackData':_0x55aa48['phone']+';'+_0x5445c8[_0x0393('0xc')]}]},'headers':{'Authorization':_0x0393('0x53')+_0x25480d[_0x0393('0x23')]},'json':!![]};return rp(_0x1eab4c)[_0x0393('0x14')](function(_0x5d7eda){if(_0x5d7eda[_0x0393('0x45')]){var _0x509662={'messageId':_0x5d7eda['messages'][0x0][_0x0393('0xa')]};if(!_0x55aa48['deliveryReport']){_0x509662[_0x0393('0x39')]=!![];}return _0xac0ccc[_0x0393('0x15')](_0x509662);}else{return logger[_0x0393('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x0393('0x25'),_0x0393('0x4d'),util[_0x0393('0x33')](_0x5d7eda,{'showHidden':![],'depth':null}));}});})[_0x0393('0x17')](function(_0x4ef325){return logger['error'](_0x0393('0x24'),_0x0393('0x25'),_0x0393('0x4d'),util[_0x0393('0x33')](_0x4ef325,{'showHidden':![],'depth':null}));});}else{logger[_0x0393('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x0393('0x25'),_0x0393('0x4d'),_0x0393('0x54'));}}else{logger['error'](_0x0393('0x24'),'afterCreate',_0x0393('0x4d'),_0x0393('0x34'));}break;case _0x0393('0x55'):var _0x1b54d6=require('crypto');if(_0x55aa48[_0x0393('0x56')]){var _0x56c311={};_0x56c311[_0x0393('0x57')]=_0x55aa48[_0x0393('0x29')];_0x56c311[_0x0393('0x20')]=_0x5445c8[_0x0393('0x20')];_0x56c311[_0x0393('0x2c')]=_0x55aa48[_0x0393('0x20')];_0x56c311[_0x0393('0x58')]=_0x5445c8['body'];_0x56c311[_0x0393('0x59')]=+new Date();var _0x3de1ce='';var _0x1e2794='';var _0x1f7a11=Object[_0x0393('0x5a')](_0x56c311);_0x1f7a11['sort']();for(var _0x3da244=0x0;_0x3da244<_0x1f7a11[_0x0393('0x5b')];_0x3da244++){if(_0x3de1ce!=''){_0x3de1ce+='&';}_0x3de1ce+=_0x1f7a11[_0x3da244]+'='+encodeURIComponent(_0x56c311[_0x1f7a11[_0x3da244]]);_0x1e2794+=_0x56c311[_0x1f7a11[_0x3da244]];}_0x1e2794+=_0x55aa48[_0x0393('0x56')];_0x1e2794=_0x1b54d6[_0x0393('0x5c')](_0x0393('0x5d'))[_0x0393('0x15')](_0x1e2794)['digest']('hex');if(_0x3de1ce!==''){_0x3de1ce+='&';}_0x3de1ce+=_0x0393('0x5e')+_0x1e2794;var _0x2d841d={'method':_0x0393('0x5f'),'uri':_0x55aa48[_0x0393('0x4e')]+_0x0393('0x60')+_0x3de1ce,'json':!![]};return rp(_0x2d841d)[_0x0393('0x14')](function(_0x5b75fd){var _0x2eb5bd=Object['keys'](_0x5b75fd);if(_0x5b75fd[_0x2eb5bd[0x0]]['error']&&parseInt(_0x5b75fd[_0x2eb5bd[0x0]][_0x0393('0x18')])===0x0){var _0x79674b={'messageId':_0x5b75fd[_0x2eb5bd[0x0]][_0x0393('0x61')]};if(!_0x55aa48[_0x0393('0x38')]){_0x79674b[_0x0393('0x39')]=!![];}return _0xac0ccc[_0x0393('0x15')](_0x79674b);}else{return logger['error'](_0x0393('0x24'),_0x0393('0x25'),_0x0393('0x55'),util['inspect'](_0x5b75fd['error'],{'showHidden':![],'depth':null}));}})[_0x0393('0x17')](function(_0x8ef6b0){return logger[_0x0393('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','csc',util[_0x0393('0x33')](_0x8ef6b0,{'showHidden':![],'depth':null}));});}else{logger[_0x0393('0x18')](_0x0393('0x24'),_0x0393('0x25'),'csc','Missing\x20parameters:\x20apiKey');}break;case _0x0393('0x62'):if(_0x55aa48[_0x0393('0x56')]){var _0x3650ea={'method':'POST','uri':_0x0393('0x63'),'headers':{'Authorization':_0x55aa48[_0x0393('0x56')]},'body':{'content':_0x5445c8[_0x0393('0xc')],'to':[_0x5445c8[_0x0393('0x20')]],'from':_0x55aa48[_0x0393('0x20')],'binary':![],'clientMessageId':'uuid','charset':_0x0393('0x64')},'json':!![]};rp(_0x3650ea)[_0x0393('0x14')](function(_0x1e5659){if(!_0x1e5659['error']){var _0x5e06f8={'messageId':_0x1e5659['messages'][0x0][_0x0393('0x65')]};if(!_0x55aa48[_0x0393('0x38')]){_0x5e06f8['read']=!![];}return _0xac0ccc[_0x0393('0x15')](_0x5e06f8);}else{return logger[_0x0393('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x0393('0x62'),util[_0x0393('0x33')](_0x1e5659['error'],{'showHidden':![],'depth':null}));}})[_0x0393('0x17')](function(_0x12d5e8){return logger['error'](_0x0393('0x24'),_0x0393('0x25'),_0x0393('0x62'),util[_0x0393('0x33')](_0x12d5e8,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x0393('0x62'),_0x0393('0x66'));}break;case _0x0393('0x67'):if(_0x55aa48['apiKey']){var _0x32f578={};var _0x2d841d={'method':_0x0393('0x3e'),'uri':_0x0393('0x68'),'headers':{'Authorization':_0x0393('0x69')+_0x55aa48[_0x0393('0x56')],'Content-Type':_0x0393('0x52')},'body':{'from':_0x55aa48[_0x0393('0x20')],'to':_0x5445c8[_0x0393('0x20')],'text':_0x5445c8['body']},'json':!![]};return rp(_0x2d841d)[_0x0393('0x14')](function(_0x267850){if(_0x267850[_0x0393('0x6a')]==0xca){_0x32f578['message']=_0x267850;var _0x4fbdaf={'method':_0x0393('0x3e'),'uri':_0x0393('0x6b'),'headers':{'Authorization':_0x0393('0x69')+_0x55aa48['apiKey'],'Content-Type':_0x0393('0x52')},'body':{'refid':_0x32f578[_0x0393('0x6c')][_0x0393('0x6d')]},'json':!![]};return rp(_0x4fbdaf)[_0x0393('0x14')](function(_0x295682){_0x32f578[_0x0393('0x6e')]=_0x295682;var _0x4d7e4c={'messageId':_0x32f578[_0x0393('0x6c')][_0x0393('0x6d')],'read':!![]};return _0xac0ccc['update'](_0x4d7e4c);});}else{return logger[_0x0393('0x18')](_0x0393('0x24'),_0x0393('0x25'),_0x0393('0x67'),util[_0x0393('0x33')](_0x267850,{'showHidden':![],'depth':null}));}})[_0x0393('0x17')](function(_0x426fde){return logger[_0x0393('0x18')](_0x0393('0x24'),_0x0393('0x25'),_0x0393('0x67'),util['inspect'](_0x426fde,{'showHidden':![],'depth':null}));});}else{return logger['error'](_0x0393('0x24'),_0x0393('0x25'),_0x0393('0x67'),'Token\x20not\x20received');}break;}}})['finally'](function(){_0x114a4e();});}else{_0x114a4e();}}},'charset':_0x0393('0x6f'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x9000=['UTF-8','apiMessageId','Missing\x20parameters:\x20apiKey','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','https://api.intelepeer.com/_rest/v4/app/sms/mdr','message','refid','status','intelepeer','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path','rimraf','./smsMessage.attributes','define','SmsMessage','sms_messages','messageId','fti_sms_messages','body','FULLTEXT','models','direction','out','isNil','SmsInteraction','findOne','SmsInteractionId','then','update','createdAt','toLowerCase','catch','error','secret','find','SmsAccountId','type','twilio','accountSid','authToken','phone','messages','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','smsMethod','sender','&password=','password','GET','POST','user_key','read','senderString','https://smsapi.connectel.se/api/send/','requestid','deliveryReport','connectel','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','http_code','data','queued_count','head','message_id','clickSend','Missing\x20parameters:\x20username,\x20password','plivo','authId','token','https://api.plivo.com/v1/Account/%s/Message/','base64','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','csc','crypto','apiKey','login','keys','sort','length','md5','hex','signature=','/external/get/send.php?','id_sms','clickatell','https://platform.clickatell.com/messages','uuid'];(function(_0x148a38,_0x5deb40){var _0x25f236=function(_0x5f4e97){while(--_0x5f4e97){_0x148a38['push'](_0x148a38['shift']());}};_0x25f236(++_0x5deb40);}(_0x9000,0x173));var _0x0900=function(_0x335d2d,_0x26e065){_0x335d2d=_0x335d2d-0x0;var _0x379073=_0x9000[_0x335d2d];return _0x379073;};'use strict';var _=require(_0x0900('0x0'));var util=require(_0x0900('0x1'));var logger=require('../../config/logger')(_0x0900('0x2'));var moment=require(_0x0900('0x3'));var BPromise=require(_0x0900('0x4'));var rp=require(_0x0900('0x5'));var fs=require('fs');var path=require(_0x0900('0x6'));var rimraf=require(_0x0900('0x7'));var config=require('../../config/environment');var attributes=require(_0x0900('0x8'));module['exports']=function(_0x380f41,_0x274b04){return _0x380f41[_0x0900('0x9')](_0x0900('0xa'),attributes,{'tableName':_0x0900('0xb'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0x0900('0xc')]},{'name':_0x0900('0xd'),'fields':[_0x0900('0xe')],'type':_0x0900('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x28ded9,_0x590ce2,_0x543f82){var _0x2567bd=_0x380f41[_0x0900('0x10')];var _0x54cdfa=_0x28ded9['get']({'plain':!![]});if(_0x54cdfa[_0x0900('0x11')]['toLowerCase']()==='in'||_0x54cdfa[_0x0900('0x11')]['toLowerCase']()===_0x0900('0x12')&&!_0x54cdfa['secret']&&!_[_0x0900('0x13')](_0x54cdfa['UserId'])){_0x2567bd[_0x0900('0x14')][_0x0900('0x15')]({'where':{'id':_0x54cdfa[_0x0900('0x16')]}})[_0x0900('0x17')](function(_0x581025){if(_0x581025){_0x581025[_0x0900('0x18')]({'lastMsgAt':_0x54cdfa[_0x0900('0x19')],'lastMsgDirection':_0x54cdfa[_0x0900('0x11')][_0x0900('0x1a')]()});}})[_0x0900('0x1b')](function(_0x3d72c4){console[_0x0900('0x1c')](_0x3d72c4);});}if(_0x54cdfa[_0x0900('0x11')]===_0x0900('0x12')&&!_0x54cdfa[_0x0900('0x1d')]){var _0x5e256d;_0x2567bd['SmsAccount'][_0x0900('0x1e')]({'where':{'id':_0x54cdfa[_0x0900('0x1f')]},'raw':!![]})[_0x0900('0x17')](function(_0x5b49b9){_0x5e256d=_0x5b49b9;if(_0x5e256d&&_0x5e256d[_0x0900('0x20')]){switch(_0x5e256d['type']){case _0x0900('0x21'):var _0x19d043=require(_0x0900('0x21'));if(_0x5e256d[_0x0900('0x22')]&&_0x5e256d[_0x0900('0x23')]&&_0x5e256d[_0x0900('0x24')]){var _0x3b7676=new _0x19d043(_0x5e256d[_0x0900('0x22')],_0x5e256d[_0x0900('0x23')]);_0x3b7676[_0x0900('0x25')][_0x0900('0x26')]({'body':_0x54cdfa[_0x0900('0xe')],'to':_0x54cdfa[_0x0900('0x24')],'from':_0x5e256d[_0x0900('0x24')],'statusCallback':_0x5e256d[_0x0900('0x27')]+_0x0900('0x28')+_0x54cdfa['id']+_0x0900('0x29')+_0x5e256d['token']})['then'](function(_0x947b0a){if(_0x947b0a[_0x0900('0x2a')]){return _0x28ded9[_0x0900('0x18')]({'messageId':_0x947b0a[_0x0900('0x2a')]});}})[_0x0900('0x1b')](function(_0x4be0ba){logger[_0x0900('0x1c')](_0x0900('0x2b'),_0x0900('0x2c'),_0x0900('0x21'),util[_0x0900('0x2d')](_0x4be0ba,{'showHidden':![],'depth':null}));});}else{logger[_0x0900('0x1c')](_0x0900('0x2b'),_0x0900('0x2c'),_0x0900('0x21'),_0x0900('0x2e'));}break;case _0x0900('0x2f'):var _0x5977d5=_0x0900('0x30');if(_0x5e256d[_0x0900('0x31')]&&_0x5e256d['password']){var _0x7b3b0a={'recipient':[_0x54cdfa[_0x0900('0x24')]],'message':_0x54cdfa[_0x0900('0xe')],'message_type':_0x5e256d[_0x0900('0x32')]};if(_0x5e256d[_0x0900('0x32')]&&_0x5e256d[_0x0900('0x32')]!=='SI'){_0x7b3b0a[_0x0900('0x33')]=_0x5e256d['phone'];}var _0x312a4e={'url':_0x5977d5+'login?username='+_0x5e256d[_0x0900('0x31')]+_0x0900('0x34')+_0x5e256d[_0x0900('0x35')],'method':_0x0900('0x36')};rp(_0x312a4e)[_0x0900('0x17')](function(_0x271e4d){var _0x3e0026=_0x271e4d['split'](';');var _0x136de7={'user_key':_0x3e0026[0x0],'session_key':_0x3e0026[0x1]};_0x312a4e={'url':_0x5977d5+'sms','method':_0x0900('0x37'),'headers':{'user_key':_0x136de7[_0x0900('0x38')],'Session_key':_0x136de7['session_key']},'json':!![],'body':_0x7b3b0a};return rp(_0x312a4e);})[_0x0900('0x17')](function(_0x8a56bd){if(_0x8a56bd['total_sent']>=0x1){var _0x12d413={'messageId':_0x8a56bd['internal_order_id']};if(_0x5e256d[_0x0900('0x32')]!=='GP'||!_0x5e256d['deliveryReport']){_0x12d413[_0x0900('0x39')]=!![];}return _0x28ded9[_0x0900('0x18')](_0x12d413);}else{return logger[_0x0900('0x1c')](_0x0900('0x2b'),_0x0900('0x2c'),_0x0900('0x2f'),util[_0x0900('0x2d')](_0x8a56bd,{'showHidden':![],'depth':null}));}})[_0x0900('0x1b')](function(_0x254539){return logger[_0x0900('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','skebby',util[_0x0900('0x2d')](_0x254539,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x0900('0x2c'),_0x0900('0x2f'),'Missing\x20parameters:\x20username,\x20password');}break;case'connectel':if(_0x5e256d[_0x0900('0x23')]){var _0x1f5cd5={'recipient':_0x54cdfa[_0x0900('0x24')],'message':_0x54cdfa['body'],'sender':_0x5e256d[_0x0900('0x3a')]||_0x5e256d[_0x0900('0x24')],'authorization':_0x5e256d['authToken']};var _0x590ce2={'method':'POST','uri':_0x0900('0x3b'),'body':_0x1f5cd5,'json':!![]};rp(_0x590ce2)[_0x0900('0x17')](function(_0x17a030){var _0x2f72a0={'messageId':_0x17a030[_0x0900('0x3c')]};if(!_0x5e256d[_0x0900('0x3d')]){_0x2f72a0[_0x0900('0x39')]=!![];}return _0x28ded9[_0x0900('0x18')](_0x2f72a0);})['catch'](function(_0x6d6c1e){logger[_0x0900('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x0900('0x2c'),_0x0900('0x3e'),util['inspect'](_0x6d6c1e,{'showHidden':![],'depth':null}));});}else{logger[_0x0900('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x0900('0x2c'),_0x0900('0x3e'),_0x0900('0x3f'));}break;case _0x0900('0x40'):if(_0x5e256d['username']&&_0x5e256d[_0x0900('0x35')]){var _0x1f5cd5={'messages':[{'source':_0x0900('0x41'),'to':_0x54cdfa[_0x0900('0x24')],'body':_0x54cdfa[_0x0900('0xe')],'from':_0x5e256d[_0x0900('0x3a')]||_0x5e256d['phone']}]};var _0x233df6=util[_0x0900('0x42')](_0x0900('0x43'),_0x5e256d[_0x0900('0x31')],_0x5e256d[_0x0900('0x35')]);var _0x590ce2={'method':_0x0900('0x37'),'uri':_0x0900('0x44'),'body':_0x1f5cd5,'headers':{'Authorization':util[_0x0900('0x42')](_0x0900('0x45'),new Buffer(_0x233df6)[_0x0900('0x46')]('base64'))},'json':!![]};rp(_0x590ce2)[_0x0900('0x17')](function(_0x29e3cf){if(_0x29e3cf[_0x0900('0x47')]>=0xc8&&_0x29e3cf[_0x0900('0x47')]<=0xce){if(_0x29e3cf[_0x0900('0x48')]&&_0x29e3cf['data'][_0x0900('0x49')]>0x0){var _0x2fa557=_[_0x0900('0x4a')](_0x29e3cf[_0x0900('0x48')][_0x0900('0x25')]);var _0x52fdb7={'messageId':_0x2fa557[_0x0900('0x4b')]};if(!_0x5e256d['deliveryReport']){_0x52fdb7['read']=!![];}return _0x28ded9[_0x0900('0x18')](_0x52fdb7);}else{logger[_0x0900('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x0900('0x2c'),'clickSend',util[_0x0900('0x2d')](_0x29e3cf,{'showHidden':![],'depth':null}));}}else{logger[_0x0900('0x1c')](_0x0900('0x2b'),'afterCreate',_0x0900('0x4c'),util['inspect'](_0x29e3cf,{'showHidden':![],'depth':null}));}})[_0x0900('0x1b')](function(_0x1ddf11){logger[_0x0900('0x1c')](_0x0900('0x2b'),'afterCreate',_0x0900('0x4c'),util[_0x0900('0x2d')](_0x1ddf11,{'showHidden':![],'depth':null}));});}else{logger[_0x0900('0x1c')](_0x0900('0x2b'),_0x0900('0x2c'),_0x0900('0x4c'),_0x0900('0x4d'));}break;case _0x0900('0x4e'):if(_0x5e256d[_0x0900('0x4f')]&&_0x5e256d['authToken']){var _0x1f5cd5={'dst':_0x54cdfa[_0x0900('0x24')],'text':_0x54cdfa[_0x0900('0xe')],'src':_0x5e256d['senderString']||_0x5e256d[_0x0900('0x24')],'url':_0x5e256d['remote']+_0x0900('0x28')+_0x54cdfa['id']+_0x0900('0x29')+_0x5e256d[_0x0900('0x50')]};var _0x233df6=util[_0x0900('0x42')](_0x0900('0x43'),_0x5e256d[_0x0900('0x4f')],_0x5e256d[_0x0900('0x23')]);var _0x590ce2={'method':_0x0900('0x37'),'uri':util[_0x0900('0x42')](_0x0900('0x51'),_0x5e256d[_0x0900('0x4f')]),'body':_0x1f5cd5,'headers':{'Authorization':util['format']('Basic\x20%s',new Buffer(_0x233df6)[_0x0900('0x46')](_0x0900('0x52')))},'json':!![]};rp(_0x590ce2)[_0x0900('0x17')](function(_0x38edec){var _0x4f79a2={'messageId':_0x38edec[_0x0900('0x53')][0x0]};return _0x28ded9['update'](_0x4f79a2);})[_0x0900('0x1b')](function(_0x14def5){logger[_0x0900('0x1c')](_0x0900('0x2b'),_0x0900('0x2c'),_0x0900('0x4e'),util['inspect'](_0x14def5,{'showHidden':![],'depth':null}));});}else{logger[_0x0900('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x0900('0x2c'),_0x0900('0x4e'),_0x0900('0x54'));}break;case _0x0900('0x55'):if(_0x5e256d[_0x0900('0x31')]&&_0x5e256d['password']){if(_0x5e256d[_0x0900('0x56')]){var _0x14d1c3={'method':_0x0900('0x37'),'uri':_0x5e256d['baseUrl']+_0x0900('0x57'),'body':{'username':_0x5e256d[_0x0900('0x31')],'password':_0x5e256d[_0x0900('0x35')]},'json':!![]};return rp(_0x14d1c3)[_0x0900('0x17')](function(_0x474e06){var _0x502dab={'method':'POST','uri':_0x5e256d[_0x0900('0x56')]+_0x0900('0x58'),'body':{'messages':[{'from':_0x5e256d[_0x0900('0x24')],'destinations':[{'to':_0x54cdfa[_0x0900('0x24')]}],'text':_0x54cdfa[_0x0900('0xe')],'notifyUrl':_0x5e256d[_0x0900('0x27')]+_0x0900('0x28')+_0x54cdfa['id']+_0x0900('0x29')+_0x5e256d['token'],'notifyContentType':_0x0900('0x59'),'callbackData':_0x5e256d[_0x0900('0x24')]+';'+_0x54cdfa[_0x0900('0xe')]}]},'headers':{'Authorization':'IBSSO\x20'+_0x474e06[_0x0900('0x50')]},'json':!![]};return rp(_0x502dab)[_0x0900('0x17')](function(_0x32263f){if(_0x32263f[_0x0900('0x25')]){var _0x2297fa={'messageId':_0x32263f[_0x0900('0x25')][0x0]['messageId']};if(!_0x5e256d[_0x0900('0x3d')]){_0x2297fa[_0x0900('0x39')]=!![];}return _0x28ded9['update'](_0x2297fa);}else{return logger[_0x0900('0x1c')](_0x0900('0x2b'),_0x0900('0x2c'),_0x0900('0x55'),util[_0x0900('0x2d')](_0x32263f,{'showHidden':![],'depth':null}));}});})['catch'](function(_0x2e6d51){return logger[_0x0900('0x1c')](_0x0900('0x2b'),_0x0900('0x2c'),'infobip',util['inspect'](_0x2e6d51,{'showHidden':![],'depth':null}));});}else{logger[_0x0900('0x1c')](_0x0900('0x2b'),'afterCreate',_0x0900('0x55'),'Missing\x20parameters:\x20base_url');}}else{logger[_0x0900('0x1c')](_0x0900('0x2b'),_0x0900('0x2c'),_0x0900('0x55'),_0x0900('0x4d'));}break;case _0x0900('0x5a'):var _0x33b804=require(_0x0900('0x5b'));if(_0x5e256d[_0x0900('0x5c')]){var _0x368d36={};_0x368d36[_0x0900('0x5d')]=_0x5e256d[_0x0900('0x31')];_0x368d36[_0x0900('0x24')]=_0x54cdfa[_0x0900('0x24')];_0x368d36[_0x0900('0x33')]=_0x5e256d[_0x0900('0x24')];_0x368d36['text']=_0x54cdfa['body'];_0x368d36['timestamp']=+new Date();var _0x53acb1='';var _0x299f6c='';var _0x3d8c42=Object[_0x0900('0x5e')](_0x368d36);_0x3d8c42[_0x0900('0x5f')]();for(var _0x477416=0x0;_0x477416<_0x3d8c42[_0x0900('0x60')];_0x477416++){if(_0x53acb1!=''){_0x53acb1+='&';}_0x53acb1+=_0x3d8c42[_0x477416]+'='+encodeURIComponent(_0x368d36[_0x3d8c42[_0x477416]]);_0x299f6c+=_0x368d36[_0x3d8c42[_0x477416]];}_0x299f6c+=_0x5e256d[_0x0900('0x5c')];_0x299f6c=_0x33b804['createHash'](_0x0900('0x61'))[_0x0900('0x18')](_0x299f6c)['digest'](_0x0900('0x62'));if(_0x53acb1!==''){_0x53acb1+='&';}_0x53acb1+=_0x0900('0x63')+_0x299f6c;var _0x312a4e={'method':_0x0900('0x36'),'uri':_0x5e256d[_0x0900('0x56')]+_0x0900('0x64')+_0x53acb1,'json':!![]};return rp(_0x312a4e)[_0x0900('0x17')](function(_0x2feee9){var _0x6e80c9=Object[_0x0900('0x5e')](_0x2feee9);if(_0x2feee9[_0x6e80c9[0x0]][_0x0900('0x1c')]&&parseInt(_0x2feee9[_0x6e80c9[0x0]][_0x0900('0x1c')])===0x0){var _0xe07e52={'messageId':_0x2feee9[_0x6e80c9[0x0]][_0x0900('0x65')]};if(!_0x5e256d[_0x0900('0x3d')]){_0xe07e52[_0x0900('0x39')]=!![];}return _0x28ded9['update'](_0xe07e52);}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','csc',util[_0x0900('0x2d')](_0x2feee9[_0x0900('0x1c')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x8ad7c6){return logger[_0x0900('0x1c')](_0x0900('0x2b'),'afterCreate',_0x0900('0x5a'),util[_0x0900('0x2d')](_0x8ad7c6,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x0900('0x2b'),'afterCreate',_0x0900('0x5a'),'Missing\x20parameters:\x20apiKey');}break;case _0x0900('0x66'):if(_0x5e256d[_0x0900('0x5c')]){var _0x305391={'method':_0x0900('0x37'),'uri':_0x0900('0x67'),'headers':{'Authorization':_0x5e256d[_0x0900('0x5c')]},'body':{'content':_0x54cdfa[_0x0900('0xe')],'to':[_0x54cdfa[_0x0900('0x24')]],'from':_0x5e256d[_0x0900('0x24')],'binary':![],'clientMessageId':_0x0900('0x68'),'charset':_0x0900('0x69')},'json':!![]};rp(_0x305391)['then'](function(_0x3658b7){if(!_0x3658b7[_0x0900('0x1c')]){var _0x1111c6={'messageId':_0x3658b7[_0x0900('0x25')][0x0][_0x0900('0x6a')]};if(!_0x5e256d[_0x0900('0x3d')]){_0x1111c6[_0x0900('0x39')]=!![];}return _0x28ded9[_0x0900('0x18')](_0x1111c6);}else{return logger[_0x0900('0x1c')](_0x0900('0x2b'),'afterCreate',_0x0900('0x66'),util[_0x0900('0x2d')](_0x3658b7[_0x0900('0x1c')],{'showHidden':![],'depth':null}));}})[_0x0900('0x1b')](function(_0x3df21d){return logger[_0x0900('0x1c')](_0x0900('0x2b'),_0x0900('0x2c'),_0x0900('0x66'),util[_0x0900('0x2d')](_0x3df21d,{'showHidden':![],'depth':null}));});}else{logger[_0x0900('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x0900('0x66'),_0x0900('0x6b'));}break;case'intelepeer':if(_0x5e256d[_0x0900('0x5c')]){var _0x5d9ab6={};var _0x312a4e={'method':_0x0900('0x37'),'uri':_0x0900('0x6c'),'headers':{'Authorization':_0x0900('0x6d')+_0x5e256d[_0x0900('0x5c')],'Content-Type':_0x0900('0x59')},'body':{'from':_0x5e256d['phone'],'to':_0x54cdfa[_0x0900('0x24')],'text':_0x54cdfa[_0x0900('0xe')]},'json':!![]};return rp(_0x312a4e)[_0x0900('0x17')](function(_0x2331da){if(_0x2331da['code']==0xca){_0x5d9ab6['message']=_0x2331da;var _0x34c5d3={'method':_0x0900('0x37'),'uri':_0x0900('0x6e'),'headers':{'Authorization':_0x0900('0x6d')+_0x5e256d['apiKey'],'Content-Type':_0x0900('0x59')},'body':{'refid':_0x5d9ab6[_0x0900('0x6f')][_0x0900('0x70')]},'json':!![]};return rp(_0x34c5d3)['then'](function(_0x89e220){_0x5d9ab6[_0x0900('0x71')]=_0x89e220;var _0x77d75c={'messageId':_0x5d9ab6['message'][_0x0900('0x70')],'read':!![]};return _0x28ded9[_0x0900('0x18')](_0x77d75c);});}else{return logger[_0x0900('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x0900('0x2c'),_0x0900('0x72'),util[_0x0900('0x2d')](_0x2331da,{'showHidden':![],'depth':null}));}})[_0x0900('0x1b')](function(_0x100382){return logger['error'](_0x0900('0x2b'),_0x0900('0x2c'),'intelepeer',util[_0x0900('0x2d')](_0x100382,{'showHidden':![],'depth':null}));});}else{return logger[_0x0900('0x1c')](_0x0900('0x2b'),_0x0900('0x2c'),_0x0900('0x72'),_0x0900('0x73'));}break;}}})[_0x0900('0x74')](function(){_0x543f82();});}else{_0x543f82();}}},'charset':_0x0900('0x75'),'collate':_0x0900('0x76')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 1136df6..597e8f6 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 _0x57ca=['jayson/promise','client','http','redis','defaults','localhost','register','request','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','SmsMessage','create','body','options','raw','then','info','CreateSmsMessage','stringify','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x57ca,0x108));var _0xa57c=function(_0x17ebad,_0x575d46){_0x17ebad=_0x17ebad-0x0;var _0x4fddfe=_0x57ca[_0x17ebad];return _0x4fddfe;};'use strict';var _=require('lodash');var util=require(_0xa57c('0x0'));var moment=require(_0xa57c('0x1'));var BPromise=require('bluebird');var rs=require(_0xa57c('0x2'));var fs=require('fs');var Redis=require(_0xa57c('0x3'));var db=require(_0xa57c('0x4'))['db'];var utils=require(_0xa57c('0x5'));var logger=require(_0xa57c('0x6'))('rpc');var config=require(_0xa57c('0x7'));var jayson=require(_0xa57c('0x8'));var client=jayson[_0xa57c('0x9')][_0xa57c('0xa')]({'port':0x232a});config[_0xa57c('0xb')]=_[_0xa57c('0xc')](config[_0xa57c('0xb')],{'host':_0xa57c('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa57c('0xb')]));require('./smsMessage.socket')[_0xa57c('0xe')](socket);function respondWithRpcPromise(_0x932dcc,_0x4fa5ed,_0x156bca){return new BPromise(function(_0x51f287,_0x554101){return client[_0xa57c('0xf')](_0x932dcc,_0x156bca)['then'](function(_0x2ed4c6){logger['info'](_0xa57c('0x10'),_0x4fa5ed,_0xa57c('0x11'));logger[_0xa57c('0x12')](_0xa57c('0x13'),_0x4fa5ed,_0xa57c('0x11'),JSON['stringify'](_0x2ed4c6));if(_0x2ed4c6[_0xa57c('0x14')]){if(_0x2ed4c6['error'][_0xa57c('0x15')]===0x1f4){logger[_0xa57c('0x14')](_0xa57c('0x10'),_0x4fa5ed,_0x2ed4c6[_0xa57c('0x14')][_0xa57c('0x16')]);return _0x554101(_0x2ed4c6[_0xa57c('0x14')][_0xa57c('0x16')]);}logger['error'](_0xa57c('0x10'),_0x4fa5ed,_0x2ed4c6[_0xa57c('0x14')][_0xa57c('0x16')]);return _0x51f287(_0x2ed4c6['error'][_0xa57c('0x16')]);}else{logger['info'](_0xa57c('0x10'),_0x4fa5ed,_0xa57c('0x11'));_0x51f287(_0x2ed4c6[_0xa57c('0x17')][_0xa57c('0x16')]);}})[_0xa57c('0x18')](function(_0x4728f9){logger[_0xa57c('0x14')](_0xa57c('0x10'),_0x4fa5ed,_0x4728f9);_0x554101(_0x4728f9);});});}exports['CreateSmsMessage']=function(_0x8a8856){var _0x4a53ab=this;return new Promise(function(_0x4a35bb,_0x418415){return db[_0xa57c('0x19')][_0xa57c('0x1a')](_0x8a8856[_0xa57c('0x1b')],{'raw':_0x8a8856['options']?_0x8a8856[_0xa57c('0x1c')][_0xa57c('0x1d')]===undefined?!![]:![]:!![]})[_0xa57c('0x1e')](function(_0x2213b2){logger[_0xa57c('0x1f')](_0xa57c('0x20'),_0x8a8856);logger[_0xa57c('0x12')](_0xa57c('0x20'),_0x8a8856,JSON[_0xa57c('0x21')](_0x2213b2));_0x4a35bb(_0x2213b2);})[_0xa57c('0x18')](function(_0x382a26){logger[_0xa57c('0x14')](_0xa57c('0x20'),_0x382a26[_0xa57c('0x16')],_0x8a8856);_0x418415(_0x4a53ab[_0xa57c('0x14')](0x1f4,_0x382a26['message']));});});}; \ No newline at end of file +var _0x5f66=['stringify','error','code','message','info','result','SmsMessage','create','body','options','raw','CreateSmsMessage','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./smsMessage.socket','then','SmsMessage,\x20%s,\x20%s','debug','request\x20sent'];(function(_0x4e4616,_0x26648b){var _0x43008c=function(_0x2de750){while(--_0x2de750){_0x4e4616['push'](_0x4e4616['shift']());}};_0x43008c(++_0x26648b);}(_0x5f66,0x1a0));var _0x65f6=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0x5f66[_0x122096];return _0x3d1966;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var moment=require('moment');var BPromise=require(_0x65f6('0x1'));var rs=require(_0x65f6('0x2'));var fs=require('fs');var Redis=require(_0x65f6('0x3'));var db=require(_0x65f6('0x4'))['db'];var utils=require(_0x65f6('0x5'));var logger=require('../../config/logger')(_0x65f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x65f6('0x7'));var client=jayson[_0x65f6('0x8')]['http']({'port':0x232a});config['redis']=_[_0x65f6('0x9')](config[_0x65f6('0xa')],{'host':_0x65f6('0xb'),'port':0x18eb});var socket=require(_0x65f6('0xc'))(new Redis(config[_0x65f6('0xa')]));require(_0x65f6('0xd'))['register'](socket);function respondWithRpcPromise(_0x5123ee,_0x18fea1,_0x2f6d5b){return new BPromise(function(_0x264647,_0x25c416){return client['request'](_0x5123ee,_0x2f6d5b)[_0x65f6('0xe')](function(_0x571436){logger['info'](_0x65f6('0xf'),_0x18fea1,'request\x20sent');logger[_0x65f6('0x10')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x18fea1,_0x65f6('0x11'),JSON[_0x65f6('0x12')](_0x571436));if(_0x571436[_0x65f6('0x13')]){if(_0x571436[_0x65f6('0x13')][_0x65f6('0x14')]===0x1f4){logger[_0x65f6('0x13')](_0x65f6('0xf'),_0x18fea1,_0x571436[_0x65f6('0x13')][_0x65f6('0x15')]);return _0x25c416(_0x571436[_0x65f6('0x13')]['message']);}logger[_0x65f6('0x13')]('SmsMessage,\x20%s,\x20%s',_0x18fea1,_0x571436['error'][_0x65f6('0x15')]);return _0x264647(_0x571436[_0x65f6('0x13')][_0x65f6('0x15')]);}else{logger[_0x65f6('0x16')](_0x65f6('0xf'),_0x18fea1,_0x65f6('0x11'));_0x264647(_0x571436[_0x65f6('0x17')][_0x65f6('0x15')]);}})['catch'](function(_0x4d79a1){logger[_0x65f6('0x13')]('SmsMessage,\x20%s,\x20%s',_0x18fea1,_0x4d79a1);_0x25c416(_0x4d79a1);});});}exports['CreateSmsMessage']=function(_0x5c5b91){var _0x365159=this;return new Promise(function(_0x21ea88,_0x5114a4){return db[_0x65f6('0x18')][_0x65f6('0x19')](_0x5c5b91[_0x65f6('0x1a')],{'raw':_0x5c5b91[_0x65f6('0x1b')]?_0x5c5b91[_0x65f6('0x1b')][_0x65f6('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x197a49){logger['info']('CreateSmsMessage',_0x5c5b91);logger[_0x65f6('0x10')](_0x65f6('0x1d'),_0x5c5b91,JSON['stringify'](_0x197a49));_0x21ea88(_0x197a49);})[_0x65f6('0x1e')](function(_0x471a33){logger[_0x65f6('0x13')](_0x65f6('0x1d'),_0x471a33['message'],_0x5c5b91);_0x5114a4(_0x365159[_0x65f6('0x13')](0x1f4,_0x471a33[_0x65f6('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 943ed22..92029a5 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 _0xa369=['./smsMessage.events','save','remove','update','emit','register','length'];(function(_0x143565,_0x54d887){var _0x4dc1d9=function(_0x5e8838){while(--_0x5e8838){_0x143565['push'](_0x143565['shift']());}};_0x4dc1d9(++_0x54d887);}(_0xa369,0x1c0));var _0x9a36=function(_0x3d6ef9,_0xa3ab19){_0x3d6ef9=_0x3d6ef9-0x0;var _0x43bbee=_0xa369[_0x3d6ef9];return _0x43bbee;};'use strict';var SmsMessageEvents=require(_0x9a36('0x0'));var events=[_0x9a36('0x1'),_0x9a36('0x2'),_0x9a36('0x3')];function createListener(_0x1c5fcb,_0x1de91c){return function(_0x675b50){_0x1de91c[_0x9a36('0x4')](_0x1c5fcb,_0x675b50);};}function removeListener(_0x556d9a,_0x112732){return function(){SmsMessageEvents['removeListener'](_0x556d9a,_0x112732);};}exports[_0x9a36('0x5')]=function(_0x469721){for(var _0x366b4e=0x0,_0x59f921=events[_0x9a36('0x6')];_0x366b4e<_0x59f921;_0x366b4e++){var _0x171cee=events[_0x366b4e];var _0x563d87=createListener('smsMessage:'+_0x171cee,_0x469721);SmsMessageEvents['on'](_0x171cee,_0x563d87);}}; \ No newline at end of file +var _0x6fe4=['smsMessage:','./smsMessage.events','update','emit','removeListener'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6fe4,0xf6));var _0x46fe=function(_0x5646fd,_0x40c603){_0x5646fd=_0x5646fd-0x0;var _0x134727=_0x6fe4[_0x5646fd];return _0x134727;};'use strict';var SmsMessageEvents=require(_0x46fe('0x0'));var events=['save','remove',_0x46fe('0x1')];function createListener(_0x1bf330,_0x391b68){return function(_0xcf74ec){_0x391b68[_0x46fe('0x2')](_0x1bf330,_0xcf74ec);};}function removeListener(_0x41feca,_0x4e7755){return function(){SmsMessageEvents[_0x46fe('0x3')](_0x41feca,_0x4e7755);};}exports['register']=function(_0x5c8841){for(var _0x25ffbb=0x0,_0x4b7652=events['length'];_0x25ffbb<_0x4b7652;_0x25ffbb++){var _0x4458fe=events[_0x25ffbb];var _0x5ac7e0=createListener(_0x46fe('0x4')+_0x4458fe,_0x5c8841);SmsMessageEvents['on'](_0x4458fe,_0x5ac7e0);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 1772543..a5e10f4 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 _0xbea5=['express','Router','../../components/auth/service','../../components/interaction/service','get','index','isAuthenticated','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','delete','destroy','removeTeams','exports','multer','util','connect-timeout'];(function(_0x3324e5,_0x4eb1ef){var _0x33cb08=function(_0x2eb4e5){while(--_0x2eb4e5){_0x3324e5['push'](_0x3324e5['shift']());}};_0x33cb08(++_0x4eb1ef);}(_0xbea5,0x177));var _0x5bea=function(_0x385467,_0x298239){_0x385467=_0x385467-0x0;var _0x5ed67e=_0xbea5[_0x385467];return _0x5ed67e;};'use strict';var multer=require(_0x5bea('0x0'));var util=require(_0x5bea('0x1'));var path=require('path');var timeout=require(_0x5bea('0x2'));var express=require(_0x5bea('0x3'));var router=express[_0x5bea('0x4')]();var auth=require(_0x5bea('0x5'));var interaction=require(_0x5bea('0x6'));var config=require('../../config/environment');var controller=require('./smsQueue.controller');router[_0x5bea('0x7')]('/',auth['isAuthenticated'](),controller[_0x5bea('0x8')]);router['get']('/describe',auth[_0x5bea('0x9')](),controller['describe']);router['get'](_0x5bea('0xa'),auth[_0x5bea('0x9')](),controller[_0x5bea('0xb')]);router['get'](_0x5bea('0xc'),auth['isAuthenticated'](),controller['getMembers']);router[_0x5bea('0x7')](_0x5bea('0xd'),auth[_0x5bea('0x9')](),controller[_0x5bea('0xe')]);router[_0x5bea('0x7')](_0x5bea('0xf'),auth['isAuthenticated'](),controller[_0x5bea('0x10')]);router[_0x5bea('0x11')]('/',auth['isAuthenticated'](),controller[_0x5bea('0x12')]);router[_0x5bea('0x11')]('/:id/teams',auth[_0x5bea('0x9')](),controller[_0x5bea('0x13')]);router[_0x5bea('0x11')](_0x5bea('0xf'),auth[_0x5bea('0x9')](),controller[_0x5bea('0x14')]);router[_0x5bea('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x5bea('0x16')]);router[_0x5bea('0x17')](_0x5bea('0xa'),auth['isAuthenticated'](),controller[_0x5bea('0x18')]);router[_0x5bea('0x17')](_0x5bea('0xd'),auth['isAuthenticated'](),controller[_0x5bea('0x19')]);router[_0x5bea('0x17')]('/:id/users',auth[_0x5bea('0x9')](),controller['removeAgents']);module[_0x5bea('0x1a')]=router; \ No newline at end of file +var _0xcfef=['connect-timeout','../../config/environment','./smsQueue.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/teams','getTeams','/:id/users','getAgents','create','addTeams','post','addAgents','update','delete','removeAgents','util','path'];(function(_0x4161ac,_0xbc442d){var _0x5024fe=function(_0x57269c){while(--_0x57269c){_0x4161ac['push'](_0x4161ac['shift']());}};_0x5024fe(++_0xbc442d);}(_0xcfef,0x1cc));var _0xfcfe=function(_0x8cfa0,_0x2d8f26){_0x8cfa0=_0x8cfa0-0x0;var _0x2bdeb3=_0xcfef[_0x8cfa0];return _0x2bdeb3;};'use strict';var multer=require('multer');var util=require(_0xfcfe('0x0'));var path=require(_0xfcfe('0x1'));var timeout=require(_0xfcfe('0x2'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xfcfe('0x3'));var controller=require(_0xfcfe('0x4'));router[_0xfcfe('0x5')]('/',auth[_0xfcfe('0x6')](),controller['index']);router['get'](_0xfcfe('0x7'),auth['isAuthenticated'](),controller[_0xfcfe('0x8')]);router[_0xfcfe('0x5')](_0xfcfe('0x9'),auth['isAuthenticated'](),controller[_0xfcfe('0xa')]);router['get']('/:id/members',auth[_0xfcfe('0x6')](),controller['getMembers']);router[_0xfcfe('0x5')](_0xfcfe('0xb'),auth[_0xfcfe('0x6')](),controller[_0xfcfe('0xc')]);router[_0xfcfe('0x5')](_0xfcfe('0xd'),auth['isAuthenticated'](),controller[_0xfcfe('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0xfcfe('0xf')]);router['post'](_0xfcfe('0xb'),auth[_0xfcfe('0x6')](),controller[_0xfcfe('0x10')]);router[_0xfcfe('0x11')](_0xfcfe('0xd'),auth[_0xfcfe('0x6')](),controller[_0xfcfe('0x12')]);router['put']('/:id',auth[_0xfcfe('0x6')](),controller[_0xfcfe('0x13')]);router[_0xfcfe('0x14')](_0xfcfe('0x9'),auth['isAuthenticated'](),controller['destroy']);router[_0xfcfe('0x14')](_0xfcfe('0xb'),auth[_0xfcfe('0x6')](),controller['removeTeams']);router[_0xfcfe('0x14')]('/:id/users',auth[_0xfcfe('0x6')](),controller[_0xfcfe('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 6616054..ca57c7d 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 _0xd96f=['INTEGER','rrmemory','sequelize','exports','STRING'];(function(_0x11c573,_0x9e7c6e){var _0x6b72de=function(_0x2e8a61){while(--_0x2e8a61){_0x11c573['push'](_0x11c573['shift']());}};_0x6b72de(++_0x9e7c6e);}(_0xd96f,0x12e));var _0xfd96=function(_0x53fff3,_0x4ee805){_0x53fff3=_0x53fff3-0x0;var _0x42f577=_0xd96f[_0x53fff3];return _0x42f577;};'use strict';var Sequelize=require(_0xfd96('0x0'));module[_0xfd96('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xfd96('0x2')]},'timeout':{'type':Sequelize[_0xfd96('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xfd96('0x4'),'beepall','roundrobin')}}; \ No newline at end of file +var _0xdcc6=['STRING','name','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize','exports'];(function(_0x43571b,_0x1a233a){var _0x45670a=function(_0x3ec650){while(--_0x3ec650){_0x43571b['push'](_0x43571b['shift']());}};_0x45670a(++_0x1a233a);}(_0xdcc6,0x103));var _0x6dcc=function(_0x339fcf,_0x40de34){_0x339fcf=_0x339fcf-0x0;var _0x293f41=_0xdcc6[_0x339fcf];return _0x293f41;};'use strict';var Sequelize=require(_0x6dcc('0x0'));module[_0x6dcc('0x1')]={'name':{'type':Sequelize[_0x6dcc('0x2')],'unique':_0x6dcc('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x6dcc('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x6dcc('0x5')](_0x6dcc('0x6'),_0x6dcc('0x7'),_0x6dcc('0x8'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 73638a3..09aba04 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 _0x2937=['key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','limit','offset','sort','pick','filter','where','merge','VIRTUAL','options','count','includeAll','include','findAll','catch','show','params','find','create','user','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','destroy','describe','getMembers','findOne','UserSmsQueue','nolimit','order','SmsQueueId','User','findAndCountAll','UserId','agent','smsPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','addTeams','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','emit','userSmsQueue:save','removeTeams','ids','select','field','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','isEmpty','removeAgents','forEach','userSmsQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','socket.io-emitter','redis','./smsQueue.socket','register','sendStatus','status','end','json','set','Content-Range','reject','save','then','UserProfileResource','error','stack','name','send','index','map','SmsQueue','rawAttributes','type'];(function(_0x18ee5c,_0x4ff1cc){var _0x217a46=function(_0xba7336){while(--_0xba7336){_0x18ee5c['push'](_0x18ee5c['shift']());}};_0x217a46(++_0x4ff1cc);}(_0x2937,0xf2));var _0x7293=function(_0x15a937,_0x2ed73e){_0x15a937=_0x15a937-0x0;var _0x439acb=_0x2937[_0x15a937];return _0x439acb;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x7293('0x0'));var rimraf=require(_0x7293('0x1'));var zipdir=require(_0x7293('0x2'));var jsonpatch=require(_0x7293('0x3'));var rp=require(_0x7293('0x4'));var moment=require(_0x7293('0x5'));var BPromise=require(_0x7293('0x6'));var Mustache=require(_0x7293('0x7'));var util=require(_0x7293('0x8'));var path=require(_0x7293('0x9'));var sox=require(_0x7293('0xa'));var csv=require(_0x7293('0xb'));var ejs=require(_0x7293('0xc'));var fs=require('fs');var _=require(_0x7293('0xd'));var squel=require(_0x7293('0xe'));var crypto=require(_0x7293('0xf'));var jsforce=require(_0x7293('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x7293('0xb'));var querystring=require(_0x7293('0x11'));var Papa=require('papaparse');var Redis=require(_0x7293('0x12'));var authService=require(_0x7293('0x13'));var qs=require(_0x7293('0x14'));var as=require(_0x7293('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7293('0x16'))(_0x7293('0x17'));var utils=require(_0x7293('0x18'));var config=require(_0x7293('0x19'));var db=require(_0x7293('0x1a'))['db'];config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x7293('0x1b'))(new Redis(config[_0x7293('0x1c')]));require(_0x7293('0x1d'))[_0x7293('0x1e')](socket);function respondWithStatusCode(_0x5cf60a,_0x2a7ef0){_0x2a7ef0=_0x2a7ef0||0xcc;return function(_0x4113dc){if(_0x4113dc){return _0x5cf60a[_0x7293('0x1f')](_0x2a7ef0);}return _0x5cf60a[_0x7293('0x20')](_0x2a7ef0)[_0x7293('0x21')]();};}function respondWithResult(_0x3adea7,_0x405da3){_0x405da3=_0x405da3||0xc8;return function(_0x1d6a3e){if(_0x1d6a3e){return _0x3adea7[_0x7293('0x20')](_0x405da3)[_0x7293('0x22')](_0x1d6a3e);}};}function respondWithFilteredResult(_0x5578e6,_0x4ef085){return function(_0x3ee84f){if(_0x3ee84f){var _0x214524=_0x3ee84f['count'],_0x2b6516=_0x4ef085['offset'],_0x47fe59=_0x4ef085['offset']+_0x4ef085['limit'],_0x5148ea;if(_0x47fe59>=_0x214524){_0x47fe59=_0x214524;_0x5148ea=0xc8;}else{_0x5148ea=0xce;}_0x5578e6[_0x7293('0x20')](_0x5148ea);return _0x5578e6[_0x7293('0x23')](_0x7293('0x24'),_0x2b6516+'-'+_0x47fe59+'/'+_0x214524)[_0x7293('0x22')](_0x3ee84f);}return null;};}function patchUpdates(_0x381c2b){return function(_0x45a0c0){try{jsonpatch['apply'](_0x45a0c0,_0x381c2b,!![]);}catch(_0x482144){return BPromise[_0x7293('0x25')](_0x482144);}return _0x45a0c0[_0x7293('0x26')]();};}function saveUpdates(_0xea82a6,_0x3a6018){return function(_0x3971bb){if(_0x3971bb){return _0x3971bb['update'](_0xea82a6)[_0x7293('0x27')](function(_0xe409f6){return _0xe409f6;});}return null;};}function removeEntity(_0x3fafa6,_0x43b20e){return function(_0x438713){if(_0x438713){return _0x438713['destroy']()['then'](function(){var _0x16b514=_0x438713['get']({'plain':!![]});var _0x2e6388='SmsQueues';return db[_0x7293('0x28')]['destroy']({'where':{'type':_0x2e6388,'resourceId':_0x16b514['id']}})[_0x7293('0x27')](function(){return _0x438713;});})[_0x7293('0x27')](function(){_0x3fafa6[_0x7293('0x20')](0xcc)[_0x7293('0x21')]();});}};}function handleEntityNotFound(_0xe04dbb,_0x1c2f29){return function(_0x4b7b94){if(!_0x4b7b94){_0xe04dbb[_0x7293('0x1f')](0x194);}return _0x4b7b94;};}function handleError(_0x6135f,_0x51d137){_0x51d137=_0x51d137||0x1f4;return function(_0x46ccc8){logger[_0x7293('0x29')](_0x46ccc8[_0x7293('0x2a')]);if(_0x46ccc8[_0x7293('0x2b')]){delete _0x46ccc8[_0x7293('0x2b')];}_0x6135f[_0x7293('0x20')](_0x51d137)[_0x7293('0x2c')](_0x46ccc8);};}exports[_0x7293('0x2d')]=function(_0x41143e,_0x313f24){var _0x41ea24={},_0x4c3849={},_0x344053={'count':0x0,'rows':[]};var _0x5f026e=_[_0x7293('0x2e')](db[_0x7293('0x2f')][_0x7293('0x30')],function(_0x1c1a7b){return{'name':_0x1c1a7b['fieldName'],'type':_0x1c1a7b[_0x7293('0x31')][_0x7293('0x32')]};});_0x4c3849[_0x7293('0x33')]=_[_0x7293('0x2e')](_0x5f026e,_0x7293('0x2b'));_0x4c3849[_0x7293('0x34')]=_[_0x7293('0x35')](_0x41143e['query']);_0x4c3849[_0x7293('0x36')]=_['intersection'](_0x4c3849[_0x7293('0x33')],_0x4c3849[_0x7293('0x34')]);_0x41ea24['attributes']=_[_0x7293('0x37')](_0x4c3849[_0x7293('0x33')],qs[_0x7293('0x38')](_0x41143e[_0x7293('0x34')]['fields']));_0x41ea24[_0x7293('0x39')]=_0x41ea24[_0x7293('0x39')][_0x7293('0x3a')]?_0x41ea24[_0x7293('0x39')]:_0x4c3849['model'];if(!_0x41143e['query'][_0x7293('0x3b')]('nolimit')){_0x41ea24[_0x7293('0x3c')]=qs[_0x7293('0x3c')](_0x41143e[_0x7293('0x34')][_0x7293('0x3c')]);_0x41ea24['offset']=qs['offset'](_0x41143e[_0x7293('0x34')][_0x7293('0x3d')]);}_0x41ea24['order']=qs['sort'](_0x41143e[_0x7293('0x34')][_0x7293('0x3e')]);_0x41ea24['where']=qs[_0x7293('0x36')](_[_0x7293('0x3f')](_0x41143e[_0x7293('0x34')],_0x4c3849['filters']),_0x5f026e);if(_0x41143e[_0x7293('0x34')][_0x7293('0x40')]){_0x41ea24[_0x7293('0x41')]=_[_0x7293('0x42')](_0x41ea24[_0x7293('0x41')],{'$or':_['map'](_0x5f026e,function(_0x3c03ea){if(_0x3c03ea['type']!==_0x7293('0x43')){var _0x9b16be={};_0x9b16be[_0x3c03ea['name']]={'$like':'%'+_0x41143e['query'][_0x7293('0x40')]+'%'};return _0x9b16be;}})});}_0x41ea24=_[_0x7293('0x42')]({},_0x41ea24,_0x41143e[_0x7293('0x44')]);var _0x2b99b9={'where':_0x41ea24[_0x7293('0x41')]};return db[_0x7293('0x2f')]['count'](_0x2b99b9)[_0x7293('0x27')](function(_0x4092e3){_0x344053[_0x7293('0x45')]=_0x4092e3;if(_0x41143e[_0x7293('0x34')][_0x7293('0x46')]){_0x41ea24[_0x7293('0x47')]=[{'all':!![]}];}return db[_0x7293('0x2f')][_0x7293('0x48')](_0x41ea24);})[_0x7293('0x27')](function(_0x2b79cd){_0x344053['rows']=_0x2b79cd;return _0x344053;})[_0x7293('0x27')](respondWithFilteredResult(_0x313f24,_0x41ea24))[_0x7293('0x49')](handleError(_0x313f24,null));};exports[_0x7293('0x4a')]=function(_0x9f1c1b,_0xe3b3d6){var _0x3de316={'raw':!![],'where':{'id':_0x9f1c1b[_0x7293('0x4b')]['id']}},_0xa339c={};_0xa339c[_0x7293('0x33')]=_['keys'](db['SmsQueue'][_0x7293('0x30')]);_0xa339c[_0x7293('0x34')]=_[_0x7293('0x35')](_0x9f1c1b['query']);_0xa339c['filters']=_[_0x7293('0x37')](_0xa339c['model'],_0xa339c[_0x7293('0x34')]);_0x3de316[_0x7293('0x39')]=_['intersection'](_0xa339c[_0x7293('0x33')],qs['fields'](_0x9f1c1b[_0x7293('0x34')][_0x7293('0x38')]));_0x3de316[_0x7293('0x39')]=_0x3de316['attributes'][_0x7293('0x3a')]?_0x3de316[_0x7293('0x39')]:_0xa339c[_0x7293('0x33')];if(_0x9f1c1b[_0x7293('0x34')][_0x7293('0x46')]){_0x3de316[_0x7293('0x47')]=[{'all':!![]}];}_0x3de316=_[_0x7293('0x42')]({},_0x3de316,_0x9f1c1b[_0x7293('0x44')]);return db[_0x7293('0x2f')][_0x7293('0x4c')](_0x3de316)['then'](handleEntityNotFound(_0xe3b3d6,null))[_0x7293('0x27')](respondWithResult(_0xe3b3d6,null))['catch'](handleError(_0xe3b3d6,null));};exports[_0x7293('0x4d')]=function(_0x427a65,_0x5d236c){return db['SmsQueue'][_0x7293('0x4d')](_0x427a65['body'],{})[_0x7293('0x27')](function(_0x623340){var _0x1c6623=_0x427a65[_0x7293('0x4e')][_0x7293('0x4f')]({'plain':!![]});if(!_0x1c6623)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1c6623['role']===_0x7293('0x4e')){var _0x7b5b56=_0x623340[_0x7293('0x4f')]({'plain':!![]});var _0x53d6b8='SmsQueues';return db[_0x7293('0x50')][_0x7293('0x4c')]({'where':{'name':_0x53d6b8,'userProfileId':_0x1c6623[_0x7293('0x51')]},'raw':!![]})[_0x7293('0x27')](function(_0x117105){if(_0x117105&&_0x117105[_0x7293('0x52')]===0x0){return db[_0x7293('0x28')][_0x7293('0x4d')]({'name':_0x7b5b56[_0x7293('0x2b')],'resourceId':_0x7b5b56['id'],'type':_0x117105[_0x7293('0x2b')],'sectionId':_0x117105['id']},{})[_0x7293('0x27')](function(){return _0x623340;});}else{return _0x623340;}})['catch'](function(_0x1b03bd){logger['error'](_0x7293('0x53'),_0x1b03bd);throw _0x1b03bd;});}return _0x623340;})[_0x7293('0x27')](respondWithResult(_0x5d236c,0xc9))[_0x7293('0x49')](handleError(_0x5d236c,null));};exports['update']=function(_0x1a8d0d,_0x2f4666){if(_0x1a8d0d[_0x7293('0x54')]['id']){delete _0x1a8d0d[_0x7293('0x54')]['id'];}return db['SmsQueue']['find']({'where':{'id':_0x1a8d0d[_0x7293('0x4b')]['id']}})[_0x7293('0x27')](handleEntityNotFound(_0x2f4666,null))[_0x7293('0x27')](saveUpdates(_0x1a8d0d[_0x7293('0x54')],null))['then'](respondWithResult(_0x2f4666,null))[_0x7293('0x49')](handleError(_0x2f4666,null));};exports[_0x7293('0x55')]=function(_0x425b4b,_0x3ced5){return db[_0x7293('0x2f')][_0x7293('0x4c')]({'where':{'id':_0x425b4b[_0x7293('0x4b')]['id']}})['then'](handleEntityNotFound(_0x3ced5,null))[_0x7293('0x27')](removeEntity(_0x3ced5,null))[_0x7293('0x49')](handleError(_0x3ced5,null));};exports[_0x7293('0x56')]=function(_0x24fcf0,_0x446147){return db[_0x7293('0x2f')][_0x7293('0x56')]()[_0x7293('0x27')](respondWithResult(_0x446147,null))[_0x7293('0x49')](handleError(_0x446147,null));};exports[_0x7293('0x57')]=function(_0x4c958b,_0x45af29,_0x1e7b4c){var _0x4e9c66={'raw':!![],'where':{}},_0x4e4333={},_0x57e397;return db[_0x7293('0x2f')][_0x7293('0x58')]({'where':{'id':_0x4c958b['params']['id']}})[_0x7293('0x27')](handleEntityNotFound(_0x45af29,null))[_0x7293('0x27')](function(_0x245d27){if(_0x245d27){_0x57e397=_0x245d27['get']({'plain':!![]});_0x4e4333[_0x7293('0x33')]=_[_0x7293('0x35')](db[_0x7293('0x59')][_0x7293('0x30')]);_0x4e4333['query']=_['keys'](_0x4c958b[_0x7293('0x34')]);_0x4e4333[_0x7293('0x36')]=_[_0x7293('0x37')](_0x4e4333[_0x7293('0x33')],_0x4e4333[_0x7293('0x34')]);_0x4e9c66[_0x7293('0x39')]=_[_0x7293('0x37')](_0x4e4333['model'],qs[_0x7293('0x38')](_0x4c958b['query'][_0x7293('0x38')]));_0x4e9c66[_0x7293('0x39')]=_0x4e9c66[_0x7293('0x39')][_0x7293('0x3a')]?_0x4e9c66[_0x7293('0x39')]:_0x4e4333[_0x7293('0x33')];if(!_0x4c958b['query'][_0x7293('0x3b')](_0x7293('0x5a'))){_0x4e9c66[_0x7293('0x3c')]=qs[_0x7293('0x3c')](_0x4c958b[_0x7293('0x34')][_0x7293('0x3c')]);_0x4e9c66['offset']=qs['offset'](_0x4c958b[_0x7293('0x34')][_0x7293('0x3d')]);}_0x4e9c66[_0x7293('0x5b')]=qs[_0x7293('0x3e')](_0x4c958b['query']['sort']);_0x4e9c66[_0x7293('0x41')]=qs[_0x7293('0x36')](_[_0x7293('0x3f')](_0x4c958b[_0x7293('0x34')],_0x4e4333['filters']));_0x4e9c66['where'][_0x7293('0x5c')]=_0x245d27['id'];if(_0x4c958b[_0x7293('0x34')]['filter']){_0x4e9c66[_0x7293('0x41')]=_['merge'](_0x4e9c66[_0x7293('0x41')],{'$or':_['map'](_0x4e9c66[_0x7293('0x39')],function(_0x1f4ac7){var _0x45d18b={};_0x45d18b[_0x1f4ac7]={'$like':'%'+_0x4c958b[_0x7293('0x34')][_0x7293('0x40')]+'%'};return _0x45d18b;})});}_0x4e9c66=_[_0x7293('0x42')]({},_0x4e9c66,_0x4c958b[_0x7293('0x44')]);return db[_0x7293('0x59')][_0x7293('0x48')](_0x4e9c66);}})[_0x7293('0x27')](function(_0x158108){if(_0x158108){return db[_0x7293('0x5d')][_0x7293('0x5e')]({'where':{'id':_[_0x7293('0x2e')](_0x158108,_0x7293('0x5f')),'role':_0x7293('0x60')},'attributes':['id',_0x7293('0x2b'),_0x7293('0x61'),_0x7293('0x62'),_0x7293('0x63')]});}})[_0x7293('0x27')](function(_0x56810c){if(_0x56810c){return{'count':_0x56810c['count'],'rows':_['map'](_0x56810c['rows'],function(_0xcf2dc5){return{'membername':_0xcf2dc5[_0x7293('0x2b')],'UserId':_0xcf2dc5['id'],'queue_name':_0x57e397[_0x7293('0x2b')],'SmsQueueId':_0x57e397['id'],'interface':util[_0x7293('0x64')](_0x7293('0x65'),_0x7293('0x66'),_0xcf2dc5[_0x7293('0x2b')]),'penalty':0x0,'paused':_0xcf2dc5[_0x7293('0x61')],'createdAt':_0xcf2dc5[_0x7293('0x63')],'updatedAt':_0xcf2dc5[_0x7293('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x7293('0x27')](respondWithFilteredResult(_0x45af29,_0x4e9c66))['catch'](handleError(_0x45af29,null));};exports[_0x7293('0x67')]=function(_0x2b8433,_0x16e007,_0x3a38d5){var _0x44d89e={};var _0x317e41={};var _0x14913f;var _0x23a8d3;return db[_0x7293('0x2f')]['findOne']({'where':{'id':_0x2b8433[_0x7293('0x4b')]['id']}})[_0x7293('0x27')](handleEntityNotFound(_0x16e007,null))[_0x7293('0x27')](function(_0x3b118d){if(_0x3b118d){_0x14913f=_0x3b118d;_0x317e41[_0x7293('0x33')]=_[_0x7293('0x35')](db[_0x7293('0x68')][_0x7293('0x30')]);_0x317e41[_0x7293('0x34')]=_[_0x7293('0x35')](_0x2b8433[_0x7293('0x34')]);_0x317e41['filters']=_[_0x7293('0x37')](_0x317e41['model'],_0x317e41['query']);_0x44d89e[_0x7293('0x39')]=_[_0x7293('0x37')](_0x317e41[_0x7293('0x33')],qs[_0x7293('0x38')](_0x2b8433[_0x7293('0x34')][_0x7293('0x38')]));_0x44d89e['attributes']=_0x44d89e['attributes'][_0x7293('0x3a')]?_0x44d89e['attributes']:_0x317e41[_0x7293('0x33')];_0x44d89e[_0x7293('0x5b')]=qs[_0x7293('0x3e')](_0x2b8433[_0x7293('0x34')][_0x7293('0x3e')]);_0x44d89e[_0x7293('0x41')]=qs[_0x7293('0x36')](_[_0x7293('0x3f')](_0x2b8433[_0x7293('0x34')],_0x317e41[_0x7293('0x36')]));if(_0x2b8433[_0x7293('0x34')][_0x7293('0x40')]){_0x44d89e['where']=_[_0x7293('0x42')](_0x44d89e[_0x7293('0x41')],{'$or':_['map'](_0x44d89e[_0x7293('0x39')],function(_0x240d1e){var _0xee9cfa={};_0xee9cfa[_0x240d1e]={'$like':'%'+_0x2b8433[_0x7293('0x34')]['filter']+'%'};return _0xee9cfa;})});}_0x44d89e=_['merge']({},_0x44d89e,_0x2b8433[_0x7293('0x44')]);return _0x14913f[_0x7293('0x67')](_0x44d89e);}})[_0x7293('0x27')](function(_0x3f2df9){if(_0x3f2df9){_0x23a8d3=_0x3f2df9[_0x7293('0x3a')];if(!_0x2b8433[_0x7293('0x34')]['hasOwnProperty'](_0x7293('0x5a'))){_0x44d89e[_0x7293('0x3c')]=qs[_0x7293('0x3c')](_0x2b8433['query'][_0x7293('0x3c')]);_0x44d89e[_0x7293('0x3d')]=qs[_0x7293('0x3d')](_0x2b8433[_0x7293('0x34')]['offset']);}return _0x14913f[_0x7293('0x67')](_0x44d89e);}})['then'](function(_0x3c1330){if(_0x3c1330){return _0x3c1330?{'count':_0x23a8d3,'rows':_0x3c1330}:null;}})[_0x7293('0x27')](respondWithResult(_0x16e007,null))[_0x7293('0x49')](handleError(_0x16e007,null));};exports[_0x7293('0x69')]=function(_0x44e273,_0x919cfc,_0x26c612){var _0x478937=_0x44e273[_0x7293('0x54')]['ids'];return db[_0x7293('0x68')][_0x7293('0x48')]({'where':{'id':_0x478937},'attributes':['id'],'include':[{'model':db['User'],'as':_0x7293('0x6a'),'attributes':['id','name',_0x7293('0x6b'),_0x7293('0x6c'),_0x7293('0x6d')],'raw':!![]}]})[_0x7293('0x27')](function(_0x455825){if(_0x455825){var _0x4d3613=_[_0x7293('0x6e')](_0x455825,function(_0x474e03){var _0x4dd8f3=_0x474e03[_0x7293('0x4f')]({'plain':!![]});return _0x4dd8f3[_0x7293('0x6a')];});return db[_0x7293('0x2f')][_0x7293('0x4c')]({'where':{'id':_0x44e273[_0x7293('0x4b')]['id']}})[_0x7293('0x27')](function(_0x15f9fd){return db[_0x7293('0x6f')][_0x7293('0x70')](function(_0xb3b965){return _0x15f9fd[_0x7293('0x69')](_0x478937,{'transaction':_0xb3b965})['then'](function(){return BPromise[_0x7293('0x71')](_0x4d3613,function(_0x48d621){return db[_0x7293('0x59')][_0x7293('0x72')]({'where':{'UserId':_0x48d621['id'],'SmsQueueId':_0x44e273[_0x7293('0x4b')]['id']},'transaction':_0xb3b965});});})['then'](function(){_0x4d3613['forEach'](function(_0x129a7b){socket[_0x7293('0x73')](_0x7293('0x74'),{'UserId':_0x129a7b['id'],'SmsQueueId':_0x15f9fd['id']});});});});});}})[_0x7293('0x27')](respondWithStatusCode(_0x919cfc,null))['catch'](handleError(_0x919cfc,null));};exports[_0x7293('0x75')]=function(_0x2839a4,_0x42fb85,_0x345f06){return db[_0x7293('0x68')][_0x7293('0x48')]({'where':{'id':_0x2839a4[_0x7293('0x34')][_0x7293('0x76')]},'attributes':['id'],'include':[{'model':db[_0x7293('0x5d')],'as':_0x7293('0x6a'),'attributes':['id'],'raw':!![]}]})[_0x7293('0x27')](handleEntityNotFound(_0x42fb85,null))[_0x7293('0x27')](function(_0x49a1ae){var _0x5b9e93=_[_0x7293('0x2e')](_0x49a1ae,'id');var _0x5b5b80=[];var _0x48bf28=[];var _0x529f86=squel[_0x7293('0x77')]();_0x529f86[_0x7293('0x78')]('tq.TeamId')[_0x7293('0x79')]('team_has_sms_queues','tq')[_0x7293('0x7a')](_0x7293('0x7b'),'ut',_0x7293('0x7c'))['where'](_0x7293('0x7d'),_0x2839a4['params']['id']);for(var _0x39c027=0x0;_0x39c027<_0x49a1ae[_0x7293('0x3a')];_0x39c027+=0x1){let _0x3fa741=_0x49a1ae[_0x39c027];for(var _0x33a5bd=0x0;_0x33a5bd<_0x3fa741['Agents'][_0x7293('0x3a')];_0x33a5bd+=0x1){let _0x2b9c9f=_0x3fa741['Agents'][_0x33a5bd];var _0x1b412b=_0x529f86[_0x7293('0x7e')]();_0x1b412b[_0x7293('0x41')](_0x7293('0x7f'),_0x2b9c9f['id']);_0x48bf28['push'](db['sequelize'][_0x7293('0x34')](_0x1b412b[_0x7293('0x80')](),{'type':db['sequelize'][_0x7293('0x81')][_0x7293('0x82')]})[_0x7293('0x27')](function(_0x4dd91c){if(_0x4dd91c[_0x7293('0x3a')]===0x1){return _0x2b9c9f['id'];}else{var _0x27779e=_[_0x7293('0x83')](_[_0x7293('0x2e')](_0x4dd91c,_0x7293('0x84')),function(_0x3ca93d){return _[_0x7293('0x85')](_0x5b9e93,_0x3ca93d);});if(_0x27779e){return _0x2b9c9f['id'];}}}));}}return BPromise[_0x7293('0x86')](_0x48bf28)[_0x7293('0x27')](function(_0x573295){_0x5b5b80=_(_0x5b5b80)[_0x7293('0x87')](_0x573295)[_0x7293('0x88')]()['value']();return db[_0x7293('0x2f')][_0x7293('0x4c')]({'where':{'id':_0x2839a4['params']['id']}})[_0x7293('0x27')](function(_0x505781){return db['sequelize'][_0x7293('0x70')](function(_0x3e5afe){return _0x505781[_0x7293('0x75')](_0x2839a4[_0x7293('0x34')][_0x7293('0x76')],{'transaction':_0x3e5afe})[_0x7293('0x27')](function(){if(!_[_0x7293('0x89')](_0x5b5b80)){return _0x505781[_0x7293('0x8a')](_0x5b5b80,{'transaction':_0x3e5afe});}})[_0x7293('0x27')](function(){_0x5b5b80[_0x7293('0x8b')](function(_0x5c5f11){socket['emit'](_0x7293('0x8c'),{'UserId':_0x5c5f11,'SmsQueueId':_0x505781['id']});});});});});});})[_0x7293('0x27')](respondWithStatusCode(_0x42fb85,null))[_0x7293('0x49')](handleError(_0x42fb85,null));};exports[_0x7293('0x8d')]=function(_0x1c2335,_0x22538b,_0x249165){return db['SmsQueue'][_0x7293('0x4c')]({'where':{'id':_0x1c2335[_0x7293('0x4b')]['id']}})[_0x7293('0x27')](handleEntityNotFound(_0x22538b,null))[_0x7293('0x27')](function(_0x5e3740){if(_0x5e3740){return _0x5e3740[_0x7293('0x8d')](_0x1c2335[_0x7293('0x54')]['ids'],_[_0x7293('0x8e')](_0x1c2335[_0x7293('0x54')],[_0x7293('0x76'),'id'])||{})[_0x7293('0x8f')](function(_0x538fa2){for(var _0x488d88=0x0;_0x488d88<_0x1c2335[_0x7293('0x54')][_0x7293('0x76')][_0x7293('0x3a')];_0x488d88+=0x1){socket[_0x7293('0x73')](_0x7293('0x74'),{'UserId':_0x1c2335[_0x7293('0x54')][_0x7293('0x76')][_0x488d88],'SmsQueueId':_0x1c2335[_0x7293('0x4b')]['id']});}return _0x538fa2;});}})['then'](respondWithResult(_0x22538b,null))[_0x7293('0x49')](handleError(_0x22538b,null));};exports[_0x7293('0x8a')]=function(_0x253b6d,_0x45314f,_0x3d1990){return db[_0x7293('0x2f')][_0x7293('0x4c')]({'where':{'id':_0x253b6d[_0x7293('0x4b')]['id']}})[_0x7293('0x27')](handleEntityNotFound(_0x45314f,null))[_0x7293('0x27')](function(_0x5b0316){if(_0x5b0316){return _0x5b0316['removeAgents'](_0x253b6d[_0x7293('0x34')][_0x7293('0x76')])[_0x7293('0x27')](function(){if(_[_0x7293('0x90')](_0x253b6d[_0x7293('0x34')]['ids'])){for(var _0x1efd3a=0x0;_0x1efd3a<_0x253b6d['query'][_0x7293('0x76')]['length'];_0x1efd3a+=0x1){socket['emit']('userSmsQueue:remove',{'UserId':Number(_0x253b6d[_0x7293('0x34')][_0x7293('0x76')][_0x1efd3a]),'SmsQueueId':Number(_0x253b6d['params']['id'])});}}else{socket['emit'](_0x7293('0x8c'),{'UserId':Number(_0x253b6d[_0x7293('0x34')]['ids']),'SmsQueueId':Number(_0x253b6d[_0x7293('0x4b')]['id'])});}});}})[_0x7293('0x27')](respondWithStatusCode(_0x45314f,null))[_0x7293('0x49')](handleError(_0x45314f,null));};exports[_0x7293('0x91')]=function(_0x17cabb,_0x4c6606,_0x408fb6){var _0x15a1cb={};var _0x26918c={};var _0x10226e;var _0x5e7650;return db[_0x7293('0x2f')][_0x7293('0x58')]({'where':{'id':_0x17cabb[_0x7293('0x4b')]['id']}})[_0x7293('0x27')](handleEntityNotFound(_0x4c6606,null))[_0x7293('0x27')](function(_0x62544d){if(_0x62544d){_0x10226e=_0x62544d;_0x26918c['model']=_[_0x7293('0x35')](db['User'][_0x7293('0x30')]);_0x26918c[_0x7293('0x34')]=_[_0x7293('0x35')](_0x17cabb[_0x7293('0x34')]);_0x26918c[_0x7293('0x36')]=_[_0x7293('0x37')](_0x26918c[_0x7293('0x33')],_0x26918c['query']);_0x15a1cb[_0x7293('0x39')]=_['intersection'](_0x26918c[_0x7293('0x33')],qs[_0x7293('0x38')](_0x17cabb['query']['fields']));_0x15a1cb['attributes']=_0x15a1cb[_0x7293('0x39')]['length']?_0x15a1cb[_0x7293('0x39')]:_0x26918c[_0x7293('0x33')];_0x15a1cb[_0x7293('0x5b')]=qs[_0x7293('0x3e')](_0x17cabb[_0x7293('0x34')]['sort']);_0x15a1cb[_0x7293('0x41')]=qs['filters'](_[_0x7293('0x3f')](_0x17cabb[_0x7293('0x34')],_0x26918c[_0x7293('0x36')]));if(_0x17cabb[_0x7293('0x34')]['filter']){_0x15a1cb['where']=_['merge'](_0x15a1cb[_0x7293('0x41')],{'$or':_[_0x7293('0x2e')](_0x15a1cb['attributes'],function(_0x3867b2){var _0x5875a9={};_0x5875a9[_0x3867b2]={'$like':'%'+_0x17cabb[_0x7293('0x34')][_0x7293('0x40')]+'%'};return _0x5875a9;})});}_0x15a1cb=_[_0x7293('0x42')]({},_0x15a1cb,_0x17cabb[_0x7293('0x44')]);return _0x10226e[_0x7293('0x91')](_0x15a1cb);}})['then'](function(_0x1b40ab){if(_0x1b40ab){_0x5e7650=_0x1b40ab[_0x7293('0x3a')];if(!_0x17cabb[_0x7293('0x34')][_0x7293('0x3b')](_0x7293('0x5a'))){_0x15a1cb[_0x7293('0x3c')]=qs[_0x7293('0x3c')](_0x17cabb[_0x7293('0x34')][_0x7293('0x3c')]);_0x15a1cb['offset']=qs[_0x7293('0x3d')](_0x17cabb['query'][_0x7293('0x3d')]);}return _0x10226e[_0x7293('0x91')](_0x15a1cb);}})['then'](function(_0x21dac2){if(_0x21dac2){return _0x21dac2?{'count':_0x5e7650,'rows':_0x21dac2}:null;}})[_0x7293('0x27')](respondWithResult(_0x4c6606,null))[_0x7293('0x49')](handleError(_0x4c6606,null));}; \ No newline at end of file +var _0xe85c=['catch','includeAll','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','find','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','params','describe','getMembers','UserSmsQueue','hasOwnProperty','User','findAndCountAll','UserId','agent','smsPause','updatedAt','createdAt','format','%s/%s','findOne','Team','getTeams','addTeams','ids','Agents','online','voicePause','flatMap','sequelize','each','findOrCreate','forEach','emit','userSmsQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','includes','all','union','value','isEmpty','userSmsQueue:remove','addAgents','omit','removeAgents','isArray','getAgents','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','squel','desk.js','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','update','then','get','SmsQueues','UserProfileResource','end','stack','name','send','index','map','SmsQueue','rawAttributes','type','key','model','keys','query','intersection','attributes','fields','length','nolimit','sort','where','pick','filters','filter','VIRTUAL','merge','options','include','findAll','rows'];(function(_0x61617c,_0x21bcdb){var _0x1ad878=function(_0x23fd2b){while(--_0x23fd2b){_0x61617c['push'](_0x61617c['shift']());}};_0x1ad878(++_0x21bcdb);}(_0xe85c,0xcd));var _0xce85=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe85c[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xce85('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xce85('0x1'));var zipdir=require(_0xce85('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xce85('0x3'));var moment=require(_0xce85('0x4'));var BPromise=require(_0xce85('0x5'));var Mustache=require(_0xce85('0x6'));var util=require('util');var path=require(_0xce85('0x7'));var sox=require(_0xce85('0x8'));var csv=require('to-csv');var ejs=require(_0xce85('0x9'));var fs=require('fs');var _=require(_0xce85('0xa'));var squel=require(_0xce85('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xce85('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xce85('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xce85('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xce85('0xf'));var logger=require(_0xce85('0x10'))(_0xce85('0x11'));var utils=require(_0xce85('0x12'));var config=require(_0xce85('0x13'));var db=require(_0xce85('0x14'))['db'];config[_0xce85('0x15')]=_[_0xce85('0x16')](config[_0xce85('0x15')],{'host':_0xce85('0x17'),'port':0x18eb});var socket=require(_0xce85('0x18'))(new Redis(config[_0xce85('0x15')]));require(_0xce85('0x19'))['register'](socket);function respondWithStatusCode(_0x3ebe7a,_0x8d33a3){_0x8d33a3=_0x8d33a3||0xcc;return function(_0x3ce256){if(_0x3ce256){return _0x3ebe7a[_0xce85('0x1a')](_0x8d33a3);}return _0x3ebe7a['status'](_0x8d33a3)['end']();};}function respondWithResult(_0x1de74e,_0x22f181){_0x22f181=_0x22f181||0xc8;return function(_0xb56310){if(_0xb56310){return _0x1de74e[_0xce85('0x1b')](_0x22f181)[_0xce85('0x1c')](_0xb56310);}};}function respondWithFilteredResult(_0x1a5206,_0x381907){return function(_0x10ac8d){if(_0x10ac8d){var _0x3314a8=_0x10ac8d[_0xce85('0x1d')],_0x73360=_0x381907[_0xce85('0x1e')],_0x8ada06=_0x381907['offset']+_0x381907[_0xce85('0x1f')],_0x4fadeb;if(_0x8ada06>=_0x3314a8){_0x8ada06=_0x3314a8;_0x4fadeb=0xc8;}else{_0x4fadeb=0xce;}_0x1a5206[_0xce85('0x1b')](_0x4fadeb);return _0x1a5206[_0xce85('0x20')](_0xce85('0x21'),_0x73360+'-'+_0x8ada06+'/'+_0x3314a8)[_0xce85('0x1c')](_0x10ac8d);}return null;};}function patchUpdates(_0x24c821){return function(_0x369a30){try{jsonpatch['apply'](_0x369a30,_0x24c821,!![]);}catch(_0x25e31b){return BPromise[_0xce85('0x22')](_0x25e31b);}return _0x369a30['save']();};}function saveUpdates(_0x55c0c8,_0x4459fb){return function(_0x397960){if(_0x397960){return _0x397960[_0xce85('0x23')](_0x55c0c8)[_0xce85('0x24')](function(_0x3dfbcc){return _0x3dfbcc;});}return null;};}function removeEntity(_0x55b24b,_0x5f1137){return function(_0x5e38af){if(_0x5e38af){return _0x5e38af['destroy']()[_0xce85('0x24')](function(){var _0x35ee1e=_0x5e38af[_0xce85('0x25')]({'plain':!![]});var _0xb65821=_0xce85('0x26');return db[_0xce85('0x27')]['destroy']({'where':{'type':_0xb65821,'resourceId':_0x35ee1e['id']}})[_0xce85('0x24')](function(){return _0x5e38af;});})[_0xce85('0x24')](function(){_0x55b24b[_0xce85('0x1b')](0xcc)[_0xce85('0x28')]();});}};}function handleEntityNotFound(_0x385adc,_0x534183){return function(_0x5c70c5){if(!_0x5c70c5){_0x385adc[_0xce85('0x1a')](0x194);}return _0x5c70c5;};}function handleError(_0x518f6e,_0x1a4125){_0x1a4125=_0x1a4125||0x1f4;return function(_0x1467c5){logger['error'](_0x1467c5[_0xce85('0x29')]);if(_0x1467c5['name']){delete _0x1467c5[_0xce85('0x2a')];}_0x518f6e['status'](_0x1a4125)[_0xce85('0x2b')](_0x1467c5);};}exports[_0xce85('0x2c')]=function(_0x34c7e7,_0x593e91){var _0x24215e={},_0x2de802={},_0xb26d47={'count':0x0,'rows':[]};var _0x5e6f1a=_[_0xce85('0x2d')](db[_0xce85('0x2e')][_0xce85('0x2f')],function(_0x4c31fe){return{'name':_0x4c31fe['fieldName'],'type':_0x4c31fe[_0xce85('0x30')][_0xce85('0x31')]};});_0x2de802[_0xce85('0x32')]=_[_0xce85('0x2d')](_0x5e6f1a,_0xce85('0x2a'));_0x2de802['query']=_[_0xce85('0x33')](_0x34c7e7[_0xce85('0x34')]);_0x2de802['filters']=_[_0xce85('0x35')](_0x2de802[_0xce85('0x32')],_0x2de802[_0xce85('0x34')]);_0x24215e[_0xce85('0x36')]=_[_0xce85('0x35')](_0x2de802['model'],qs[_0xce85('0x37')](_0x34c7e7[_0xce85('0x34')]['fields']));_0x24215e[_0xce85('0x36')]=_0x24215e[_0xce85('0x36')][_0xce85('0x38')]?_0x24215e[_0xce85('0x36')]:_0x2de802[_0xce85('0x32')];if(!_0x34c7e7[_0xce85('0x34')]['hasOwnProperty'](_0xce85('0x39'))){_0x24215e[_0xce85('0x1f')]=qs[_0xce85('0x1f')](_0x34c7e7[_0xce85('0x34')][_0xce85('0x1f')]);_0x24215e['offset']=qs[_0xce85('0x1e')](_0x34c7e7[_0xce85('0x34')]['offset']);}_0x24215e['order']=qs[_0xce85('0x3a')](_0x34c7e7[_0xce85('0x34')][_0xce85('0x3a')]);_0x24215e[_0xce85('0x3b')]=qs['filters'](_[_0xce85('0x3c')](_0x34c7e7[_0xce85('0x34')],_0x2de802[_0xce85('0x3d')]),_0x5e6f1a);if(_0x34c7e7[_0xce85('0x34')][_0xce85('0x3e')]){_0x24215e['where']=_['merge'](_0x24215e['where'],{'$or':_[_0xce85('0x2d')](_0x5e6f1a,function(_0xfb8d95){if(_0xfb8d95[_0xce85('0x30')]!==_0xce85('0x3f')){var _0x18c7f1={};_0x18c7f1[_0xfb8d95[_0xce85('0x2a')]]={'$like':'%'+_0x34c7e7[_0xce85('0x34')]['filter']+'%'};return _0x18c7f1;}})});}_0x24215e=_[_0xce85('0x40')]({},_0x24215e,_0x34c7e7[_0xce85('0x41')]);var _0x2760ee={'where':_0x24215e[_0xce85('0x3b')]};return db[_0xce85('0x2e')][_0xce85('0x1d')](_0x2760ee)[_0xce85('0x24')](function(_0x3c2310){_0xb26d47['count']=_0x3c2310;if(_0x34c7e7[_0xce85('0x34')]['includeAll']){_0x24215e[_0xce85('0x42')]=[{'all':!![]}];}return db['SmsQueue'][_0xce85('0x43')](_0x24215e);})[_0xce85('0x24')](function(_0x4373d8){_0xb26d47[_0xce85('0x44')]=_0x4373d8;return _0xb26d47;})[_0xce85('0x24')](respondWithFilteredResult(_0x593e91,_0x24215e))[_0xce85('0x45')](handleError(_0x593e91,null));};exports['show']=function(_0x1f9703,_0x4a5193){var _0x1ec320={'raw':!![],'where':{'id':_0x1f9703['params']['id']}},_0x45b333={};_0x45b333['model']=_[_0xce85('0x33')](db[_0xce85('0x2e')]['rawAttributes']);_0x45b333[_0xce85('0x34')]=_[_0xce85('0x33')](_0x1f9703[_0xce85('0x34')]);_0x45b333[_0xce85('0x3d')]=_[_0xce85('0x35')](_0x45b333['model'],_0x45b333[_0xce85('0x34')]);_0x1ec320['attributes']=_[_0xce85('0x35')](_0x45b333[_0xce85('0x32')],qs[_0xce85('0x37')](_0x1f9703[_0xce85('0x34')]['fields']));_0x1ec320[_0xce85('0x36')]=_0x1ec320['attributes']['length']?_0x1ec320[_0xce85('0x36')]:_0x45b333['model'];if(_0x1f9703[_0xce85('0x34')][_0xce85('0x46')]){_0x1ec320[_0xce85('0x42')]=[{'all':!![]}];}_0x1ec320=_[_0xce85('0x40')]({},_0x1ec320,_0x1f9703[_0xce85('0x41')]);return db['SmsQueue']['find'](_0x1ec320)[_0xce85('0x24')](handleEntityNotFound(_0x4a5193,null))['then'](respondWithResult(_0x4a5193,null))['catch'](handleError(_0x4a5193,null));};exports[_0xce85('0x47')]=function(_0xbafa30,_0x2b3df5){return db[_0xce85('0x2e')][_0xce85('0x47')](_0xbafa30[_0xce85('0x48')],{})['then'](function(_0x13962){var _0x42ddd3=_0xbafa30['user'][_0xce85('0x25')]({'plain':!![]});if(!_0x42ddd3)throw new Error(_0xce85('0x49'));if(_0x42ddd3['role']===_0xce85('0x4a')){var _0x125584=_0x13962[_0xce85('0x25')]({'plain':!![]});var _0x270d76=_0xce85('0x26');return db[_0xce85('0x4b')][_0xce85('0x4c')]({'where':{'name':_0x270d76,'userProfileId':_0x42ddd3['userProfileId']},'raw':!![]})[_0xce85('0x24')](function(_0x2987e7){if(_0x2987e7&&_0x2987e7[_0xce85('0x4d')]===0x0){return db['UserProfileResource']['create']({'name':_0x125584[_0xce85('0x2a')],'resourceId':_0x125584['id'],'type':_0x2987e7[_0xce85('0x2a')],'sectionId':_0x2987e7['id']},{})[_0xce85('0x24')](function(){return _0x13962;});}else{return _0x13962;}})['catch'](function(_0x41591a){logger[_0xce85('0x4e')](_0xce85('0x4f'),_0x41591a);throw _0x41591a;});}return _0x13962;})['then'](respondWithResult(_0x2b3df5,0xc9))['catch'](handleError(_0x2b3df5,null));};exports[_0xce85('0x23')]=function(_0x457fb3,_0x361323){if(_0x457fb3[_0xce85('0x48')]['id']){delete _0x457fb3[_0xce85('0x48')]['id'];}return db['SmsQueue'][_0xce85('0x4c')]({'where':{'id':_0x457fb3['params']['id']}})[_0xce85('0x24')](handleEntityNotFound(_0x361323,null))[_0xce85('0x24')](saveUpdates(_0x457fb3[_0xce85('0x48')],null))[_0xce85('0x24')](respondWithResult(_0x361323,null))[_0xce85('0x45')](handleError(_0x361323,null));};exports[_0xce85('0x50')]=function(_0x3dce7e,_0x1d5092){return db['SmsQueue'][_0xce85('0x4c')]({'where':{'id':_0x3dce7e[_0xce85('0x51')]['id']}})[_0xce85('0x24')](handleEntityNotFound(_0x1d5092,null))[_0xce85('0x24')](removeEntity(_0x1d5092,null))[_0xce85('0x45')](handleError(_0x1d5092,null));};exports[_0xce85('0x52')]=function(_0x14a5b1,_0x1ed995){return db[_0xce85('0x2e')]['describe']()[_0xce85('0x24')](respondWithResult(_0x1ed995,null))[_0xce85('0x45')](handleError(_0x1ed995,null));};exports[_0xce85('0x53')]=function(_0x1afeb4,_0x570f6f,_0x1b8e9d){var _0x3afc1f={'raw':!![],'where':{}},_0x39efb7={},_0x5a03ba;return db['SmsQueue']['findOne']({'where':{'id':_0x1afeb4[_0xce85('0x51')]['id']}})['then'](handleEntityNotFound(_0x570f6f,null))[_0xce85('0x24')](function(_0x46ac51){if(_0x46ac51){_0x5a03ba=_0x46ac51[_0xce85('0x25')]({'plain':!![]});_0x39efb7[_0xce85('0x32')]=_[_0xce85('0x33')](db[_0xce85('0x54')]['rawAttributes']);_0x39efb7[_0xce85('0x34')]=_['keys'](_0x1afeb4[_0xce85('0x34')]);_0x39efb7['filters']=_[_0xce85('0x35')](_0x39efb7[_0xce85('0x32')],_0x39efb7[_0xce85('0x34')]);_0x3afc1f[_0xce85('0x36')]=_[_0xce85('0x35')](_0x39efb7[_0xce85('0x32')],qs[_0xce85('0x37')](_0x1afeb4[_0xce85('0x34')][_0xce85('0x37')]));_0x3afc1f['attributes']=_0x3afc1f[_0xce85('0x36')][_0xce85('0x38')]?_0x3afc1f[_0xce85('0x36')]:_0x39efb7[_0xce85('0x32')];if(!_0x1afeb4[_0xce85('0x34')][_0xce85('0x55')](_0xce85('0x39'))){_0x3afc1f[_0xce85('0x1f')]=qs[_0xce85('0x1f')](_0x1afeb4[_0xce85('0x34')][_0xce85('0x1f')]);_0x3afc1f[_0xce85('0x1e')]=qs[_0xce85('0x1e')](_0x1afeb4[_0xce85('0x34')][_0xce85('0x1e')]);}_0x3afc1f['order']=qs['sort'](_0x1afeb4[_0xce85('0x34')][_0xce85('0x3a')]);_0x3afc1f[_0xce85('0x3b')]=qs['filters'](_[_0xce85('0x3c')](_0x1afeb4['query'],_0x39efb7['filters']));_0x3afc1f[_0xce85('0x3b')]['SmsQueueId']=_0x46ac51['id'];if(_0x1afeb4['query'][_0xce85('0x3e')]){_0x3afc1f[_0xce85('0x3b')]=_[_0xce85('0x40')](_0x3afc1f['where'],{'$or':_[_0xce85('0x2d')](_0x3afc1f[_0xce85('0x36')],function(_0x4c90fa){var _0x2766f5={};_0x2766f5[_0x4c90fa]={'$like':'%'+_0x1afeb4['query'][_0xce85('0x3e')]+'%'};return _0x2766f5;})});}_0x3afc1f=_[_0xce85('0x40')]({},_0x3afc1f,_0x1afeb4[_0xce85('0x41')]);return db['UserSmsQueue'][_0xce85('0x43')](_0x3afc1f);}})['then'](function(_0x17242f){if(_0x17242f){return db[_0xce85('0x56')][_0xce85('0x57')]({'where':{'id':_['map'](_0x17242f,_0xce85('0x58')),'role':_0xce85('0x59')},'attributes':['id','name',_0xce85('0x5a'),_0xce85('0x5b'),_0xce85('0x5c')]});}})[_0xce85('0x24')](function(_0x5b84d0){if(_0x5b84d0){return{'count':_0x5b84d0[_0xce85('0x1d')],'rows':_['map'](_0x5b84d0['rows'],function(_0x1a7367){return{'membername':_0x1a7367[_0xce85('0x2a')],'UserId':_0x1a7367['id'],'queue_name':_0x5a03ba[_0xce85('0x2a')],'SmsQueueId':_0x5a03ba['id'],'interface':util[_0xce85('0x5d')](_0xce85('0x5e'),'SIP',_0x1a7367[_0xce85('0x2a')]),'penalty':0x0,'paused':_0x1a7367[_0xce85('0x5a')],'createdAt':_0x1a7367[_0xce85('0x5c')],'updatedAt':_0x1a7367[_0xce85('0x5b')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x570f6f,_0x3afc1f))[_0xce85('0x45')](handleError(_0x570f6f,null));};exports['getTeams']=function(_0x430264,_0x5b3a3b,_0x2e6d7c){var _0x4b5614={};var _0x145423={};var _0xf6b20e;var _0x5dd1a2;return db[_0xce85('0x2e')][_0xce85('0x5f')]({'where':{'id':_0x430264['params']['id']}})['then'](handleEntityNotFound(_0x5b3a3b,null))[_0xce85('0x24')](function(_0x425ac3){if(_0x425ac3){_0xf6b20e=_0x425ac3;_0x145423[_0xce85('0x32')]=_[_0xce85('0x33')](db[_0xce85('0x60')][_0xce85('0x2f')]);_0x145423[_0xce85('0x34')]=_[_0xce85('0x33')](_0x430264[_0xce85('0x34')]);_0x145423[_0xce85('0x3d')]=_[_0xce85('0x35')](_0x145423[_0xce85('0x32')],_0x145423[_0xce85('0x34')]);_0x4b5614[_0xce85('0x36')]=_[_0xce85('0x35')](_0x145423[_0xce85('0x32')],qs[_0xce85('0x37')](_0x430264[_0xce85('0x34')][_0xce85('0x37')]));_0x4b5614[_0xce85('0x36')]=_0x4b5614['attributes'][_0xce85('0x38')]?_0x4b5614[_0xce85('0x36')]:_0x145423[_0xce85('0x32')];_0x4b5614['order']=qs[_0xce85('0x3a')](_0x430264[_0xce85('0x34')][_0xce85('0x3a')]);_0x4b5614['where']=qs[_0xce85('0x3d')](_[_0xce85('0x3c')](_0x430264[_0xce85('0x34')],_0x145423[_0xce85('0x3d')]));if(_0x430264['query'][_0xce85('0x3e')]){_0x4b5614[_0xce85('0x3b')]=_['merge'](_0x4b5614['where'],{'$or':_[_0xce85('0x2d')](_0x4b5614[_0xce85('0x36')],function(_0x52ba6c){var _0x36d1ee={};_0x36d1ee[_0x52ba6c]={'$like':'%'+_0x430264[_0xce85('0x34')]['filter']+'%'};return _0x36d1ee;})});}_0x4b5614=_[_0xce85('0x40')]({},_0x4b5614,_0x430264[_0xce85('0x41')]);return _0xf6b20e[_0xce85('0x61')](_0x4b5614);}})['then'](function(_0x57d0b8){if(_0x57d0b8){_0x5dd1a2=_0x57d0b8['length'];if(!_0x430264[_0xce85('0x34')][_0xce85('0x55')](_0xce85('0x39'))){_0x4b5614['limit']=qs[_0xce85('0x1f')](_0x430264[_0xce85('0x34')][_0xce85('0x1f')]);_0x4b5614[_0xce85('0x1e')]=qs[_0xce85('0x1e')](_0x430264[_0xce85('0x34')][_0xce85('0x1e')]);}return _0xf6b20e[_0xce85('0x61')](_0x4b5614);}})['then'](function(_0x573c38){if(_0x573c38){return _0x573c38?{'count':_0x5dd1a2,'rows':_0x573c38}:null;}})['then'](respondWithResult(_0x5b3a3b,null))['catch'](handleError(_0x5b3a3b,null));};exports[_0xce85('0x62')]=function(_0xbda956,_0x33334e,_0x433f80){var _0x1b9807=_0xbda956[_0xce85('0x48')][_0xce85('0x63')];return db[_0xce85('0x60')][_0xce85('0x43')]({'where':{'id':_0x1b9807},'attributes':['id'],'include':[{'model':db[_0xce85('0x56')],'as':_0xce85('0x64'),'attributes':['id','name',_0xce85('0x65'),_0xce85('0x66'),'interface'],'raw':!![]}]})[_0xce85('0x24')](function(_0x5b4976){if(_0x5b4976){var _0x2fa530=_[_0xce85('0x67')](_0x5b4976,function(_0x212219){var _0x480f6c=_0x212219[_0xce85('0x25')]({'plain':!![]});return _0x480f6c[_0xce85('0x64')];});return db[_0xce85('0x2e')]['find']({'where':{'id':_0xbda956[_0xce85('0x51')]['id']}})['then'](function(_0x39942f){return db[_0xce85('0x68')]['transaction'](function(_0x278e0d){return _0x39942f[_0xce85('0x62')](_0x1b9807,{'transaction':_0x278e0d})[_0xce85('0x24')](function(){return BPromise[_0xce85('0x69')](_0x2fa530,function(_0x2efc7c){return db[_0xce85('0x54')][_0xce85('0x6a')]({'where':{'UserId':_0x2efc7c['id'],'SmsQueueId':_0xbda956[_0xce85('0x51')]['id']},'transaction':_0x278e0d});});})['then'](function(){_0x2fa530[_0xce85('0x6b')](function(_0x5e5614){socket[_0xce85('0x6c')](_0xce85('0x6d'),{'UserId':_0x5e5614['id'],'SmsQueueId':_0x39942f['id']});});});});});}})[_0xce85('0x24')](respondWithStatusCode(_0x33334e,null))[_0xce85('0x45')](handleError(_0x33334e,null));};exports[_0xce85('0x6e')]=function(_0x1cdeaf,_0x537526,_0x41a801){return db[_0xce85('0x60')][_0xce85('0x43')]({'where':{'id':_0x1cdeaf[_0xce85('0x34')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0xce85('0x64'),'attributes':['id'],'raw':!![]}]})[_0xce85('0x24')](handleEntityNotFound(_0x537526,null))[_0xce85('0x24')](function(_0x1c714c){var _0x46e88c=_[_0xce85('0x2d')](_0x1c714c,'id');var _0x7a7523=[];var _0x22b64a=[];var _0x2d5ced=squel[_0xce85('0x6f')]();_0x2d5ced[_0xce85('0x70')](_0xce85('0x71'))[_0xce85('0x72')](_0xce85('0x73'),'tq')[_0xce85('0x74')](_0xce85('0x75'),'ut',_0xce85('0x76'))['where'](_0xce85('0x77'),_0x1cdeaf[_0xce85('0x51')]['id']);for(var _0xe268b0=0x0;_0xe268b0<_0x1c714c['length'];_0xe268b0+=0x1){let _0x112d3f=_0x1c714c[_0xe268b0];for(var _0x3b2fdf=0x0;_0x3b2fdf<_0x112d3f[_0xce85('0x64')][_0xce85('0x38')];_0x3b2fdf+=0x1){let _0x206907=_0x112d3f['Agents'][_0x3b2fdf];var _0x48c1e1=_0x2d5ced[_0xce85('0x78')]();_0x48c1e1[_0xce85('0x3b')](_0xce85('0x79'),_0x206907['id']);_0x22b64a[_0xce85('0x7a')](db[_0xce85('0x68')][_0xce85('0x34')](_0x48c1e1[_0xce85('0x7b')](),{'type':db[_0xce85('0x68')][_0xce85('0x7c')][_0xce85('0x7d')]})[_0xce85('0x24')](function(_0x32c864){if(_0x32c864[_0xce85('0x38')]===0x1){return _0x206907['id'];}else{var _0x85d2ba=_['every'](_[_0xce85('0x2d')](_0x32c864,'TeamId'),function(_0x2015d2){return _[_0xce85('0x7e')](_0x46e88c,_0x2015d2);});if(_0x85d2ba){return _0x206907['id'];}}}));}}return BPromise[_0xce85('0x7f')](_0x22b64a)['then'](function(_0x54d209){_0x7a7523=_(_0x7a7523)[_0xce85('0x80')](_0x54d209)['compact']()[_0xce85('0x81')]();return db['SmsQueue'][_0xce85('0x4c')]({'where':{'id':_0x1cdeaf[_0xce85('0x51')]['id']}})[_0xce85('0x24')](function(_0x2ed947){return db[_0xce85('0x68')]['transaction'](function(_0x2f7e5e){return _0x2ed947[_0xce85('0x6e')](_0x1cdeaf[_0xce85('0x34')]['ids'],{'transaction':_0x2f7e5e})[_0xce85('0x24')](function(){if(!_[_0xce85('0x82')](_0x7a7523)){return _0x2ed947['removeAgents'](_0x7a7523,{'transaction':_0x2f7e5e});}})[_0xce85('0x24')](function(){_0x7a7523[_0xce85('0x6b')](function(_0x35e60e){socket[_0xce85('0x6c')](_0xce85('0x83'),{'UserId':_0x35e60e,'SmsQueueId':_0x2ed947['id']});});});});});});})[_0xce85('0x24')](respondWithStatusCode(_0x537526,null))[_0xce85('0x45')](handleError(_0x537526,null));};exports[_0xce85('0x84')]=function(_0x5d3773,_0x5f4247,_0x5441e0){return db[_0xce85('0x2e')]['find']({'where':{'id':_0x5d3773['params']['id']}})['then'](handleEntityNotFound(_0x5f4247,null))[_0xce85('0x24')](function(_0x40db83){if(_0x40db83){return _0x40db83['addAgents'](_0x5d3773[_0xce85('0x48')][_0xce85('0x63')],_[_0xce85('0x85')](_0x5d3773[_0xce85('0x48')],[_0xce85('0x63'),'id'])||{})['spread'](function(_0x4f4ffb){for(var _0x452a37=0x0;_0x452a37<_0x5d3773[_0xce85('0x48')][_0xce85('0x63')][_0xce85('0x38')];_0x452a37+=0x1){socket[_0xce85('0x6c')]('userSmsQueue:save',{'UserId':_0x5d3773[_0xce85('0x48')][_0xce85('0x63')][_0x452a37],'SmsQueueId':_0x5d3773[_0xce85('0x51')]['id']});}return _0x4f4ffb;});}})['then'](respondWithResult(_0x5f4247,null))[_0xce85('0x45')](handleError(_0x5f4247,null));};exports[_0xce85('0x86')]=function(_0x592f4e,_0x38a47a,_0x1309ea){return db[_0xce85('0x2e')]['find']({'where':{'id':_0x592f4e[_0xce85('0x51')]['id']}})[_0xce85('0x24')](handleEntityNotFound(_0x38a47a,null))[_0xce85('0x24')](function(_0x2ef8df){if(_0x2ef8df){return _0x2ef8df[_0xce85('0x86')](_0x592f4e[_0xce85('0x34')][_0xce85('0x63')])[_0xce85('0x24')](function(){if(_[_0xce85('0x87')](_0x592f4e['query'][_0xce85('0x63')])){for(var _0x18067a=0x0;_0x18067a<_0x592f4e[_0xce85('0x34')][_0xce85('0x63')][_0xce85('0x38')];_0x18067a+=0x1){socket[_0xce85('0x6c')]('userSmsQueue:remove',{'UserId':Number(_0x592f4e[_0xce85('0x34')][_0xce85('0x63')][_0x18067a]),'SmsQueueId':Number(_0x592f4e[_0xce85('0x51')]['id'])});}}else{socket[_0xce85('0x6c')](_0xce85('0x83'),{'UserId':Number(_0x592f4e[_0xce85('0x34')]['ids']),'SmsQueueId':Number(_0x592f4e['params']['id'])});}});}})[_0xce85('0x24')](respondWithStatusCode(_0x38a47a,null))['catch'](handleError(_0x38a47a,null));};exports[_0xce85('0x88')]=function(_0x4c7c0c,_0xbcf7f5,_0xf1af70){var _0x203a87={};var _0x4e056e={};var _0x2f456d;var _0x3d07ab;return db[_0xce85('0x2e')][_0xce85('0x5f')]({'where':{'id':_0x4c7c0c[_0xce85('0x51')]['id']}})['then'](handleEntityNotFound(_0xbcf7f5,null))[_0xce85('0x24')](function(_0x36bfb4){if(_0x36bfb4){_0x2f456d=_0x36bfb4;_0x4e056e['model']=_['keys'](db[_0xce85('0x56')][_0xce85('0x2f')]);_0x4e056e['query']=_['keys'](_0x4c7c0c[_0xce85('0x34')]);_0x4e056e['filters']=_['intersection'](_0x4e056e[_0xce85('0x32')],_0x4e056e['query']);_0x203a87[_0xce85('0x36')]=_[_0xce85('0x35')](_0x4e056e[_0xce85('0x32')],qs[_0xce85('0x37')](_0x4c7c0c[_0xce85('0x34')][_0xce85('0x37')]));_0x203a87['attributes']=_0x203a87[_0xce85('0x36')]['length']?_0x203a87[_0xce85('0x36')]:_0x4e056e['model'];_0x203a87['order']=qs[_0xce85('0x3a')](_0x4c7c0c[_0xce85('0x34')]['sort']);_0x203a87[_0xce85('0x3b')]=qs[_0xce85('0x3d')](_[_0xce85('0x3c')](_0x4c7c0c[_0xce85('0x34')],_0x4e056e[_0xce85('0x3d')]));if(_0x4c7c0c['query'][_0xce85('0x3e')]){_0x203a87[_0xce85('0x3b')]=_[_0xce85('0x40')](_0x203a87[_0xce85('0x3b')],{'$or':_['map'](_0x203a87[_0xce85('0x36')],function(_0x58e75f){var _0x4f9c21={};_0x4f9c21[_0x58e75f]={'$like':'%'+_0x4c7c0c['query'][_0xce85('0x3e')]+'%'};return _0x4f9c21;})});}_0x203a87=_[_0xce85('0x40')]({},_0x203a87,_0x4c7c0c['options']);return _0x2f456d[_0xce85('0x88')](_0x203a87);}})[_0xce85('0x24')](function(_0x412ce1){if(_0x412ce1){_0x3d07ab=_0x412ce1[_0xce85('0x38')];if(!_0x4c7c0c[_0xce85('0x34')]['hasOwnProperty'](_0xce85('0x39'))){_0x203a87[_0xce85('0x1f')]=qs[_0xce85('0x1f')](_0x4c7c0c[_0xce85('0x34')][_0xce85('0x1f')]);_0x203a87[_0xce85('0x1e')]=qs[_0xce85('0x1e')](_0x4c7c0c['query'][_0xce85('0x1e')]);}return _0x2f456d[_0xce85('0x88')](_0x203a87);}})[_0xce85('0x24')](function(_0x6ef82a){if(_0x6ef82a){return _0x6ef82a?{'count':_0x3d07ab,'rows':_0x6ef82a}:null;}})[_0xce85('0x24')](respondWithResult(_0xbcf7f5,null))[_0xce85('0x45')](handleError(_0xbcf7f5,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index b151309..b804716 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 _0xe98f=['exports','events','../../mysqldb','SmsQueue','setMaxListeners','save','update','emit'];(function(_0x3b7b8a,_0x52c3b0){var _0x441206=function(_0x5d34d3){while(--_0x5d34d3){_0x3b7b8a['push'](_0x3b7b8a['shift']());}};_0x441206(++_0x52c3b0);}(_0xe98f,0xc1));var _0xfe98=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xe98f[_0x4b369d];return _0x571a98;};'use strict';var EventEmitter=require(_0xfe98('0x0'));var SmsQueue=require(_0xfe98('0x1'))['db'][_0xfe98('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xfe98('0x3')](0x0);var events={'afterCreate':_0xfe98('0x4'),'afterUpdate':_0xfe98('0x5'),'afterDestroy':'remove'};function emitEvent(_0x34db78){return function(_0x1b7274,_0x13f20b,_0x345e0c){SmsQueueEvents[_0xfe98('0x6')](_0x34db78+':'+_0x1b7274['id'],_0x1b7274);SmsQueueEvents['emit'](_0x34db78,_0x1b7274);_0x345e0c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module[_0xfe98('0x7')]=SmsQueueEvents; \ No newline at end of file +var _0xe702=['save','update','emit','hasOwnProperty','hook','events','../../mysqldb','SmsQueue','setMaxListeners'];(function(_0x4c8a47,_0x5a1059){var _0x3851c7=function(_0x40a3af){while(--_0x40a3af){_0x4c8a47['push'](_0x4c8a47['shift']());}};_0x3851c7(++_0x5a1059);}(_0xe702,0x95));var _0x2e70=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0xe702[_0x55f8b4];return _0x2475f9;};'use strict';var EventEmitter=require(_0x2e70('0x0'));var SmsQueue=require(_0x2e70('0x1'))['db'][_0x2e70('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x2e70('0x3')](0x0);var events={'afterCreate':_0x2e70('0x4'),'afterUpdate':_0x2e70('0x5'),'afterDestroy':'remove'};function emitEvent(_0x52b520){return function(_0x3005cd,_0x4f71e3,_0x156906){SmsQueueEvents['emit'](_0x52b520+':'+_0x3005cd['id'],_0x3005cd);SmsQueueEvents[_0x2e70('0x6')](_0x52b520,_0x3005cd);_0x156906(null);};}for(var e in events){if(events[_0x2e70('0x7')](e)){var event=events[e];SmsQueue[_0x2e70('0x8')](e,emitEvent(event));}}module['exports']=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 39a0a75..9066a6a 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 _0x325a=['../../config/environment','./smsQueue.attributes','define','SmsQueue','sms_queues','lodash','util','api','moment','request-promise','path','rimraf'];(function(_0x37f2ee,_0x3f26f5){var _0x24f7fc=function(_0x29b5cf){while(--_0x29b5cf){_0x37f2ee['push'](_0x37f2ee['shift']());}};_0x24f7fc(++_0x3f26f5);}(_0x325a,0x1b5));var _0xa325=function(_0x2ebd4d,_0x32e249){_0x2ebd4d=_0x2ebd4d-0x0;var _0x69cba3=_0x325a[_0x2ebd4d];return _0x69cba3;};'use strict';var _=require(_0xa325('0x0'));var util=require(_0xa325('0x1'));var logger=require('../../config/logger')(_0xa325('0x2'));var moment=require(_0xa325('0x3'));var BPromise=require('bluebird');var rp=require(_0xa325('0x4'));var fs=require('fs');var path=require(_0xa325('0x5'));var rimraf=require(_0xa325('0x6'));var config=require(_0xa325('0x7'));var attributes=require(_0xa325('0x8'));module['exports']=function(_0x829ff,_0x230144){return _0x829ff[_0xa325('0x9')](_0xa325('0xa'),attributes,{'tableName':_0xa325('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7ffb=['request-promise','rimraf','./smsQueue.attributes','exports','define','SmsQueue','sms_queues','lodash','api','bluebird'];(function(_0x3a890f,_0x57325b){var _0x2b3dcb=function(_0x16bb39){while(--_0x16bb39){_0x3a890f['push'](_0x3a890f['shift']());}};_0x2b3dcb(++_0x57325b);}(_0x7ffb,0x197));var _0xb7ff=function(_0x2eac4f,_0x5173f9){_0x2eac4f=_0x2eac4f-0x0;var _0x58f73b=_0x7ffb[_0x2eac4f];return _0x58f73b;};'use strict';var _=require(_0xb7ff('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xb7ff('0x1'));var moment=require('moment');var BPromise=require(_0xb7ff('0x2'));var rp=require(_0xb7ff('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb7ff('0x4'));var config=require('../../config/environment');var attributes=require(_0xb7ff('0x5'));module[_0xb7ff('0x6')]=function(_0x9ce59,_0x262eb8){return _0x9ce59[_0xb7ff('0x7')](_0xb7ff('0x8'),attributes,{'tableName':_0xb7ff('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.rpc.js b/server/api/smsQueue/smsQueue.rpc.js index 0dcded8..319bf0b 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 _0x4ae6=['options','raw','where','attributes','limit','include','map','model','ShowSmsQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetSmsQueue','SmsQueue'];(function(_0x5cd5a0,_0x2c1335){var _0x5f2688=function(_0x2b3e19){while(--_0x2b3e19){_0x5cd5a0['push'](_0x5cd5a0['shift']());}};_0x5f2688(++_0x2c1335);}(_0x4ae6,0x7e));var _0x64ae=function(_0x53a375,_0x474d5c){_0x53a375=_0x53a375-0x0;var _0x3a46f4=_0x4ae6[_0x53a375];return _0x3a46f4;};'use strict';var _=require(_0x64ae('0x0'));var util=require(_0x64ae('0x1'));var moment=require(_0x64ae('0x2'));var BPromise=require(_0x64ae('0x3'));var rs=require(_0x64ae('0x4'));var fs=require('fs');var Redis=require(_0x64ae('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x64ae('0x6'))(_0x64ae('0x7'));var config=require(_0x64ae('0x8'));var jayson=require(_0x64ae('0x9'));var client=jayson[_0x64ae('0xa')]['http']({'port':0x232a});config[_0x64ae('0xb')]=_[_0x64ae('0xc')](config[_0x64ae('0xb')],{'host':_0x64ae('0xd'),'port':0x18eb});var socket=require(_0x64ae('0xe'))(new Redis(config[_0x64ae('0xb')]));require(_0x64ae('0xf'))[_0x64ae('0x10')](socket);function respondWithRpcPromise(_0x43922c,_0x32a0e4,_0x532ce9){return new BPromise(function(_0x1216e0,_0x586bd0){return client['request'](_0x43922c,_0x532ce9)[_0x64ae('0x11')](function(_0x897a3c){logger[_0x64ae('0x12')](_0x64ae('0x13'),_0x32a0e4,_0x64ae('0x14'));logger[_0x64ae('0x15')](_0x64ae('0x16'),_0x32a0e4,_0x64ae('0x14'),JSON[_0x64ae('0x17')](_0x897a3c));if(_0x897a3c[_0x64ae('0x18')]){if(_0x897a3c[_0x64ae('0x18')][_0x64ae('0x19')]===0x1f4){logger[_0x64ae('0x18')]('SmsQueue,\x20%s,\x20%s',_0x32a0e4,_0x897a3c[_0x64ae('0x18')][_0x64ae('0x1a')]);return _0x586bd0(_0x897a3c['error'][_0x64ae('0x1a')]);}logger[_0x64ae('0x18')](_0x64ae('0x13'),_0x32a0e4,_0x897a3c[_0x64ae('0x18')][_0x64ae('0x1a')]);return _0x1216e0(_0x897a3c[_0x64ae('0x18')][_0x64ae('0x1a')]);}else{logger['info']('SmsQueue,\x20%s,\x20%s',_0x32a0e4,_0x64ae('0x14'));_0x1216e0(_0x897a3c['result'][_0x64ae('0x1a')]);}})[_0x64ae('0x1b')](function(_0x5f3eda){logger['error'](_0x64ae('0x13'),_0x32a0e4,_0x5f3eda);_0x586bd0(_0x5f3eda);});});}exports[_0x64ae('0x1c')]=function(_0x267fd1){var _0x9303b1=this;return new Promise(function(_0x4396af,_0x11d356){return db[_0x64ae('0x1d')]['findAll']({'raw':_0x267fd1[_0x64ae('0x1e')]?_0x267fd1[_0x64ae('0x1e')][_0x64ae('0x1f')]===undefined?!![]:![]:!![],'where':_0x267fd1[_0x64ae('0x1e')]?_0x267fd1[_0x64ae('0x1e')][_0x64ae('0x20')]||null:null,'attributes':_0x267fd1[_0x64ae('0x1e')]?_0x267fd1[_0x64ae('0x1e')][_0x64ae('0x21')]||null:null,'limit':_0x267fd1[_0x64ae('0x1e')]?_0x267fd1[_0x64ae('0x1e')][_0x64ae('0x22')]||null:null,'include':_0x267fd1['options']?_0x267fd1['options'][_0x64ae('0x23')]?_[_0x64ae('0x24')](_0x267fd1[_0x64ae('0x1e')][_0x64ae('0x23')],function(_0x2f631e){return{'model':db[_0x2f631e[_0x64ae('0x25')]],'as':_0x2f631e['as'],'attributes':_0x2f631e[_0x64ae('0x21')],'include':_0x2f631e['include']?_[_0x64ae('0x24')](_0x2f631e[_0x64ae('0x23')],function(_0x1e3bbd){return{'model':db[_0x1e3bbd[_0x64ae('0x25')]],'as':_0x1e3bbd['as'],'attributes':_0x1e3bbd['attributes'],'include':_0x1e3bbd[_0x64ae('0x23')]?_[_0x64ae('0x24')](_0x1e3bbd[_0x64ae('0x23')],function(_0x28b749){return{'model':db[_0x28b749[_0x64ae('0x25')]],'as':_0x28b749['as'],'attributes':_0x28b749[_0x64ae('0x21')]};}):[]};}):[]};}):[]:[]})[_0x64ae('0x11')](function(_0x347309){logger[_0x64ae('0x12')](_0x64ae('0x1c'),_0x267fd1);logger[_0x64ae('0x15')]('GetSmsQueue',_0x267fd1,JSON[_0x64ae('0x17')](_0x347309));_0x4396af(_0x347309);})[_0x64ae('0x1b')](function(_0x1f99a9){logger[_0x64ae('0x18')]('GetSmsQueue',_0x1f99a9[_0x64ae('0x1a')],_0x267fd1);_0x11d356(_0x9303b1['error'](0x1f4,_0x1f99a9[_0x64ae('0x1a')]));});});};exports[_0x64ae('0x26')]=function(_0x2b0a8c){var _0x4fe9dd=this;return new Promise(function(_0x792df6,_0x5921de){return db[_0x64ae('0x1d')]['find']({'raw':_0x2b0a8c[_0x64ae('0x1e')]?_0x2b0a8c['options'][_0x64ae('0x1f')]===undefined?!![]:![]:!![],'where':_0x2b0a8c['options']?_0x2b0a8c[_0x64ae('0x1e')]['where']||null:null,'attributes':_0x2b0a8c[_0x64ae('0x1e')]?_0x2b0a8c[_0x64ae('0x1e')]['attributes']||null:null,'include':_0x2b0a8c['options']?_0x2b0a8c['options']['include']?_['map'](_0x2b0a8c[_0x64ae('0x1e')][_0x64ae('0x23')],function(_0x5d7da2){return{'model':db[_0x5d7da2[_0x64ae('0x25')]],'as':_0x5d7da2['as'],'attributes':_0x5d7da2[_0x64ae('0x21')],'include':_0x5d7da2['include']?_['map'](_0x5d7da2['include'],function(_0x5c5304){return{'model':db[_0x5c5304[_0x64ae('0x25')]],'as':_0x5c5304['as'],'attributes':_0x5c5304['attributes'],'include':_0x5c5304[_0x64ae('0x23')]?_[_0x64ae('0x24')](_0x5c5304[_0x64ae('0x23')],function(_0x2fe7a3){return{'model':db[_0x2fe7a3[_0x64ae('0x25')]],'as':_0x2fe7a3['as'],'attributes':_0x2fe7a3[_0x64ae('0x21')]};}):[]};}):[]};}):[]:[]})[_0x64ae('0x11')](function(_0x2d9de0){logger[_0x64ae('0x12')](_0x64ae('0x26'),_0x2b0a8c);logger['debug'](_0x64ae('0x26'),_0x2b0a8c,JSON[_0x64ae('0x17')](_0x2d9de0));_0x792df6(_0x2d9de0);})[_0x64ae('0x1b')](function(_0x39cf49){logger[_0x64ae('0x18')](_0x64ae('0x26'),_0x39cf49[_0x64ae('0x1a')],_0x2b0a8c);_0x5921de(_0x4fe9dd[_0x64ae('0x18')](0x1f4,_0x39cf49[_0x64ae('0x1a')]));});});}; \ No newline at end of file +var _0x85fb=['catch','GetSmsQueue','SmsQueue','findAll','options','raw','where','attributes','limit','include','map','model','find','ShowSmsQueue','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','request','then','info','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsQueue,\x20%s,\x20%s','message','request\x20sent','result'];(function(_0x37ae26,_0x2ecd70){var _0x1b1902=function(_0x5a6ae0){while(--_0x5a6ae0){_0x37ae26['push'](_0x37ae26['shift']());}};_0x1b1902(++_0x2ecd70);}(_0x85fb,0x64));var _0xb85f=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x85fb[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0xb85f('0x0'));var util=require(_0xb85f('0x1'));var moment=require(_0xb85f('0x2'));var BPromise=require('bluebird');var rs=require(_0xb85f('0x3'));var fs=require('fs');var Redis=require(_0xb85f('0x4'));var db=require(_0xb85f('0x5'))['db'];var utils=require(_0xb85f('0x6'));var logger=require(_0xb85f('0x7'))(_0xb85f('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb85f('0x9')][_0xb85f('0xa')]({'port':0x232a});config[_0xb85f('0xb')]=_[_0xb85f('0xc')](config[_0xb85f('0xb')],{'host':_0xb85f('0xd'),'port':0x18eb});var socket=require(_0xb85f('0xe'))(new Redis(config[_0xb85f('0xb')]));require(_0xb85f('0xf'))[_0xb85f('0x10')](socket);function respondWithRpcPromise(_0x3af5ec,_0x56a6af,_0x189770){return new BPromise(function(_0x248b3c,_0x4112aa){return client[_0xb85f('0x11')](_0x3af5ec,_0x189770)[_0xb85f('0x12')](function(_0x55af35){logger[_0xb85f('0x13')]('SmsQueue,\x20%s,\x20%s',_0x56a6af,'request\x20sent');logger[_0xb85f('0x14')](_0xb85f('0x15'),_0x56a6af,'request\x20sent',JSON[_0xb85f('0x16')](_0x55af35));if(_0x55af35[_0xb85f('0x17')]){if(_0x55af35[_0xb85f('0x17')][_0xb85f('0x18')]===0x1f4){logger[_0xb85f('0x17')](_0xb85f('0x19'),_0x56a6af,_0x55af35[_0xb85f('0x17')][_0xb85f('0x1a')]);return _0x4112aa(_0x55af35['error'][_0xb85f('0x1a')]);}logger[_0xb85f('0x17')](_0xb85f('0x19'),_0x56a6af,_0x55af35[_0xb85f('0x17')]['message']);return _0x248b3c(_0x55af35[_0xb85f('0x17')][_0xb85f('0x1a')]);}else{logger[_0xb85f('0x13')](_0xb85f('0x19'),_0x56a6af,_0xb85f('0x1b'));_0x248b3c(_0x55af35[_0xb85f('0x1c')]['message']);}})[_0xb85f('0x1d')](function(_0x5b6832){logger[_0xb85f('0x17')]('SmsQueue,\x20%s,\x20%s',_0x56a6af,_0x5b6832);_0x4112aa(_0x5b6832);});});}exports[_0xb85f('0x1e')]=function(_0x29e2e3){var _0x784e70=this;return new Promise(function(_0x28007c,_0xb1113a){return db[_0xb85f('0x1f')][_0xb85f('0x20')]({'raw':_0x29e2e3[_0xb85f('0x21')]?_0x29e2e3['options'][_0xb85f('0x22')]===undefined?!![]:![]:!![],'where':_0x29e2e3[_0xb85f('0x21')]?_0x29e2e3['options'][_0xb85f('0x23')]||null:null,'attributes':_0x29e2e3[_0xb85f('0x21')]?_0x29e2e3['options'][_0xb85f('0x24')]||null:null,'limit':_0x29e2e3[_0xb85f('0x21')]?_0x29e2e3[_0xb85f('0x21')][_0xb85f('0x25')]||null:null,'include':_0x29e2e3[_0xb85f('0x21')]?_0x29e2e3[_0xb85f('0x21')][_0xb85f('0x26')]?_[_0xb85f('0x27')](_0x29e2e3[_0xb85f('0x21')][_0xb85f('0x26')],function(_0x45f8fc){return{'model':db[_0x45f8fc['model']],'as':_0x45f8fc['as'],'attributes':_0x45f8fc[_0xb85f('0x24')],'include':_0x45f8fc[_0xb85f('0x26')]?_['map'](_0x45f8fc[_0xb85f('0x26')],function(_0x3d7f05){return{'model':db[_0x3d7f05[_0xb85f('0x28')]],'as':_0x3d7f05['as'],'attributes':_0x3d7f05['attributes'],'include':_0x3d7f05[_0xb85f('0x26')]?_['map'](_0x3d7f05[_0xb85f('0x26')],function(_0x3ac6cf){return{'model':db[_0x3ac6cf[_0xb85f('0x28')]],'as':_0x3ac6cf['as'],'attributes':_0x3ac6cf[_0xb85f('0x24')]};}):[]};}):[]};}):[]:[]})[_0xb85f('0x12')](function(_0x2444be){logger[_0xb85f('0x13')](_0xb85f('0x1e'),_0x29e2e3);logger[_0xb85f('0x14')]('GetSmsQueue',_0x29e2e3,JSON[_0xb85f('0x16')](_0x2444be));_0x28007c(_0x2444be);})[_0xb85f('0x1d')](function(_0x40c367){logger[_0xb85f('0x17')](_0xb85f('0x1e'),_0x40c367['message'],_0x29e2e3);_0xb1113a(_0x784e70[_0xb85f('0x17')](0x1f4,_0x40c367[_0xb85f('0x1a')]));});});};exports['ShowSmsQueue']=function(_0x533b02){var _0x84751d=this;return new Promise(function(_0x1e8951,_0x1adf5d){return db[_0xb85f('0x1f')][_0xb85f('0x29')]({'raw':_0x533b02['options']?_0x533b02[_0xb85f('0x21')][_0xb85f('0x22')]===undefined?!![]:![]:!![],'where':_0x533b02[_0xb85f('0x21')]?_0x533b02[_0xb85f('0x21')]['where']||null:null,'attributes':_0x533b02[_0xb85f('0x21')]?_0x533b02[_0xb85f('0x21')][_0xb85f('0x24')]||null:null,'include':_0x533b02[_0xb85f('0x21')]?_0x533b02['options'][_0xb85f('0x26')]?_[_0xb85f('0x27')](_0x533b02['options'][_0xb85f('0x26')],function(_0x102adb){return{'model':db[_0x102adb['model']],'as':_0x102adb['as'],'attributes':_0x102adb['attributes'],'include':_0x102adb[_0xb85f('0x26')]?_[_0xb85f('0x27')](_0x102adb[_0xb85f('0x26')],function(_0x305388){return{'model':db[_0x305388[_0xb85f('0x28')]],'as':_0x305388['as'],'attributes':_0x305388[_0xb85f('0x24')],'include':_0x305388[_0xb85f('0x26')]?_[_0xb85f('0x27')](_0x305388[_0xb85f('0x26')],function(_0x46d98e){return{'model':db[_0x46d98e[_0xb85f('0x28')]],'as':_0x46d98e['as'],'attributes':_0x46d98e[_0xb85f('0x24')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3732ef){logger[_0xb85f('0x13')](_0xb85f('0x2a'),_0x533b02);logger[_0xb85f('0x14')](_0xb85f('0x2a'),_0x533b02,JSON[_0xb85f('0x16')](_0x3732ef));_0x1e8951(_0x3732ef);})[_0xb85f('0x1d')](function(_0x221b48){logger[_0xb85f('0x17')](_0xb85f('0x2a'),_0x221b48[_0xb85f('0x1a')],_0x533b02);_0x1adf5d(_0x84751d['error'](0x1f4,_0x221b48['message']));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index c4bc5b0..f3cf06e 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 _0x1769=['smsQueue:','./smsQueue.events','save','removeListener','register'];(function(_0x68c979,_0x431cff){var _0x4f0001=function(_0xa7595d){while(--_0xa7595d){_0x68c979['push'](_0x68c979['shift']());}};_0x4f0001(++_0x431cff);}(_0x1769,0xf6));var _0x9176=function(_0x3821fb,_0x5df0d7){_0x3821fb=_0x3821fb-0x0;var _0x55fe75=_0x1769[_0x3821fb];return _0x55fe75;};'use strict';var SmsQueueEvents=require(_0x9176('0x0'));var events=[_0x9176('0x1'),'remove','update'];function createListener(_0xa3757c,_0x3ea7a7){return function(_0xa24789){_0x3ea7a7['emit'](_0xa3757c,_0xa24789);};}function removeListener(_0x29d6f9,_0x221ac9){return function(){SmsQueueEvents[_0x9176('0x2')](_0x29d6f9,_0x221ac9);};}exports[_0x9176('0x3')]=function(_0x2bdd2c){for(var _0xed6fc8=0x0,_0x140235=events['length'];_0xed6fc8<_0x140235;_0xed6fc8++){var _0x4b15ee=events[_0xed6fc8];var _0x4311b4=createListener(_0x9176('0x4')+_0x4b15ee,_0x2bdd2c);SmsQueueEvents['on'](_0x4b15ee,_0x4311b4);}}; \ No newline at end of file +var _0x0e73=['./smsQueue.events','remove','removeListener','register','length','smsQueue:'];(function(_0x535bcd,_0x1575af){var _0x42f269=function(_0x1463da){while(--_0x1463da){_0x535bcd['push'](_0x535bcd['shift']());}};_0x42f269(++_0x1575af);}(_0x0e73,0x17a));var _0x30e7=function(_0x2e9e7a,_0x5b939a){_0x2e9e7a=_0x2e9e7a-0x0;var _0x1608b0=_0x0e73[_0x2e9e7a];return _0x1608b0;};'use strict';var SmsQueueEvents=require(_0x30e7('0x0'));var events=['save',_0x30e7('0x1'),'update'];function createListener(_0x48e793,_0x3332cd){return function(_0x5106f8){_0x3332cd['emit'](_0x48e793,_0x5106f8);};}function removeListener(_0x1e5c12,_0x18c717){return function(){SmsQueueEvents[_0x30e7('0x2')](_0x1e5c12,_0x18c717);};}exports[_0x30e7('0x3')]=function(_0x28780c){for(var _0x3ad51a=0x0,_0x4f3657=events[_0x30e7('0x4')];_0x3ad51a<_0x4f3657;_0x3ad51a++){var _0x53ca2e=events[_0x3ad51a];var _0x152f15=createListener(_0x30e7('0x5')+_0x53ca2e,_0x28780c);SmsQueueEvents['on'](_0x53ca2e,_0x152f15);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 73ea517..91e9f92 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 _0x32a9=['./smsQueueReport.controller','get','isAuthenticated','index','/describe','/:id','show','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service'];(function(_0x11e7a7,_0x9c230a){var _0x16c26e=function(_0x39d7d6){while(--_0x39d7d6){_0x11e7a7['push'](_0x11e7a7['shift']());}};_0x16c26e(++_0x9c230a);}(_0x32a9,0xe3));var _0x932a=function(_0x29ce17,_0x100ee2){_0x29ce17=_0x29ce17-0x0;var _0x51bf75=_0x32a9[_0x29ce17];return _0x51bf75;};'use strict';var multer=require(_0x932a('0x0'));var util=require(_0x932a('0x1'));var path=require(_0x932a('0x2'));var timeout=require(_0x932a('0x3'));var express=require(_0x932a('0x4'));var router=express[_0x932a('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x932a('0x6'));var config=require('../../config/environment');var controller=require(_0x932a('0x7'));router[_0x932a('0x8')]('/',auth[_0x932a('0x9')](),controller[_0x932a('0xa')]);router[_0x932a('0x8')](_0x932a('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x932a('0x8')](_0x932a('0xc'),auth[_0x932a('0x9')](),controller[_0x932a('0xd')]);router['post']('/',auth[_0x932a('0x9')](),controller['create']);router['put'](_0x932a('0xc'),auth[_0x932a('0x9')](),controller[_0x932a('0xe')]);router[_0x932a('0xf')](_0x932a('0xc'),auth['isAuthenticated'](),controller[_0x932a('0x10')]);module[_0x932a('0x11')]=router; \ No newline at end of file +var _0x7f2a=['multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','isAuthenticated','index','get','describe','/:id','show','create','update','destroy','exports'];(function(_0x2b2cf2,_0x525996){var _0x2de8a6=function(_0xa4b8ab){while(--_0xa4b8ab){_0x2b2cf2['push'](_0x2b2cf2['shift']());}};_0x2de8a6(++_0x525996);}(_0x7f2a,0x90));var _0xa7f2=function(_0xcd8b6,_0x2ecb09){_0xcd8b6=_0xcd8b6-0x0;var _0x353ff0=_0x7f2a[_0xcd8b6];return _0x353ff0;};'use strict';var multer=require(_0xa7f2('0x0'));var util=require('util');var path=require(_0xa7f2('0x1'));var timeout=require(_0xa7f2('0x2'));var express=require(_0xa7f2('0x3'));var router=express[_0xa7f2('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xa7f2('0x5'));var config=require(_0xa7f2('0x6'));var controller=require(_0xa7f2('0x7'));router['get']('/',auth[_0xa7f2('0x8')](),controller[_0xa7f2('0x9')]);router[_0xa7f2('0xa')]('/describe',auth[_0xa7f2('0x8')](),controller[_0xa7f2('0xb')]);router[_0xa7f2('0xa')](_0xa7f2('0xc'),auth['isAuthenticated'](),controller[_0xa7f2('0xd')]);router['post']('/',auth[_0xa7f2('0x8')](),controller[_0xa7f2('0xe')]);router['put'](_0xa7f2('0xc'),auth[_0xa7f2('0x8')](),controller[_0xa7f2('0xf')]);router['delete'](_0xa7f2('0xc'),auth[_0xa7f2('0x8')](),controller[_0xa7f2('0x10')]);module[_0xa7f2('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 1c1d45e..34882f9 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 _0x850c=['DATE','moment','sequelize','exports','STRING'];(function(_0x1347ff,_0x2c9340){var _0x335d6a=function(_0x33eaa0){while(--_0x33eaa0){_0x1347ff['push'](_0x1347ff['shift']());}};_0x335d6a(++_0x2c9340);}(_0x850c,0x1cd));var _0xc850=function(_0x12a3e5,_0x972d2e){_0x12a3e5=_0x12a3e5-0x0;var _0x2ba48e=_0x850c[_0x12a3e5];return _0x2ba48e;};'use strict';var moment=require(_0xc850('0x0'));var Sequelize=require(_0xc850('0x1'));module[_0xc850('0x2')]={'uniqueid':{'type':Sequelize[_0xc850('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xc850('0x3')]},'joinAt':{'type':Sequelize[_0xc850('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xc850('0x4')]},'exitAt':{'type':Sequelize[_0xc850('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x865e=['STRING','DATE','moment','sequelize','exports'];(function(_0x408337,_0x3c47db){var _0x427c7a=function(_0x58704){while(--_0x58704){_0x408337['push'](_0x408337['shift']());}};_0x427c7a(++_0x3c47db);}(_0x865e,0x1b5));var _0xe865=function(_0x576170,_0x1712ae){_0x576170=_0x576170-0x0;var _0x397c70=_0x865e[_0x576170];return _0x397c70;};'use strict';var moment=require(_0xe865('0x0'));var Sequelize=require(_0xe865('0x1'));module[_0xe865('0x2')]={'uniqueid':{'type':Sequelize[_0xe865('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xe865('0x3')]},'joinAt':{'type':Sequelize[_0xe865('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xe865('0x4')]},'reason':{'type':Sequelize[_0xe865('0x3')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 0ec8ae4..481c21d 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 _0x814b=['index','map','rawAttributes','fieldName','key','model','keys','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','pick','filter','where','merge','VIRTUAL','include','findAll','rows','catch','show','SmsQueueReport','options','find','create','body','params','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','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','destroy','then','error','stack','name','send'];(function(_0x1b664d,_0x1d8695){var _0x43af6b=function(_0x7fe8b2){while(--_0x7fe8b2){_0x1b664d['push'](_0x1b664d['shift']());}};_0x43af6b(++_0x1d8695);}(_0x814b,0x1a2));var _0xb814=function(_0x5c96eb,_0x5404da){_0x5c96eb=_0x5c96eb-0x0;var _0x4ddbad=_0x814b[_0x5c96eb];return _0x4ddbad;};'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 db=require(_0xb814('0x19'))['db'];function respondWithStatusCode(_0x15d6ef,_0x35b10d){_0x35b10d=_0x35b10d||0xcc;return function(_0x2cc46b){if(_0x2cc46b){return _0x15d6ef[_0xb814('0x1a')](_0x35b10d);}return _0x15d6ef[_0xb814('0x1b')](_0x35b10d)[_0xb814('0x1c')]();};}function respondWithResult(_0x41ed7b,_0xa0a2e5){_0xa0a2e5=_0xa0a2e5||0xc8;return function(_0x2ab627){if(_0x2ab627){return _0x41ed7b[_0xb814('0x1b')](_0xa0a2e5)[_0xb814('0x1d')](_0x2ab627);}};}function respondWithFilteredResult(_0x17f5bd,_0x39bfcf){return function(_0x303aca){if(_0x303aca){var _0x3a71d6=_0x303aca[_0xb814('0x1e')],_0x45e0d0=_0x39bfcf[_0xb814('0x1f')],_0x265a83=_0x39bfcf['offset']+_0x39bfcf[_0xb814('0x20')],_0x125ce2;if(_0x265a83>=_0x3a71d6){_0x265a83=_0x3a71d6;_0x125ce2=0xc8;}else{_0x125ce2=0xce;}_0x17f5bd['status'](_0x125ce2);return _0x17f5bd[_0xb814('0x21')](_0xb814('0x22'),_0x45e0d0+'-'+_0x265a83+'/'+_0x3a71d6)['json'](_0x303aca);}return null;};}function patchUpdates(_0x4b55a7){return function(_0x55d63c){try{jsonpatch[_0xb814('0x23')](_0x55d63c,_0x4b55a7,!![]);}catch(_0x4d5276){return BPromise['reject'](_0x4d5276);}return _0x55d63c[_0xb814('0x24')]();};}function saveUpdates(_0x24211d,_0x25b6b6){return function(_0x4e139e){if(_0x4e139e){return _0x4e139e[_0xb814('0x25')](_0x24211d)['then'](function(_0x1e6393){return _0x1e6393;});}return null;};}function removeEntity(_0x1808a3,_0x3b267e){return function(_0x470e81){if(_0x470e81){return _0x470e81[_0xb814('0x26')]()[_0xb814('0x27')](function(){_0x1808a3[_0xb814('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ead86,_0x52b7a3){return function(_0x3f81d0){if(!_0x3f81d0){_0x2ead86[_0xb814('0x1a')](0x194);}return _0x3f81d0;};}function handleError(_0x31c7ec,_0x208927){_0x208927=_0x208927||0x1f4;return function(_0x1c8a2e){logger[_0xb814('0x28')](_0x1c8a2e[_0xb814('0x29')]);if(_0x1c8a2e['name']){delete _0x1c8a2e[_0xb814('0x2a')];}_0x31c7ec[_0xb814('0x1b')](_0x208927)[_0xb814('0x2b')](_0x1c8a2e);};}exports[_0xb814('0x2c')]=function(_0x32ed56,_0x1d5965){var _0x3f0150={},_0x1e4e89={},_0x5a6291={'count':0x0,'rows':[]};var _0x271aa8=_[_0xb814('0x2d')](db['SmsQueueReport'][_0xb814('0x2e')],function(_0x37d24d){return{'name':_0x37d24d[_0xb814('0x2f')],'type':_0x37d24d['type'][_0xb814('0x30')]};});_0x1e4e89[_0xb814('0x31')]=_['map'](_0x271aa8,_0xb814('0x2a'));_0x1e4e89['query']=_[_0xb814('0x32')](_0x32ed56['query']);_0x1e4e89['filters']=_[_0xb814('0x33')](_0x1e4e89['model'],_0x1e4e89[_0xb814('0x34')]);_0x3f0150[_0xb814('0x35')]=_[_0xb814('0x33')](_0x1e4e89['model'],qs['fields'](_0x32ed56[_0xb814('0x34')][_0xb814('0x36')]));_0x3f0150['attributes']=_0x3f0150[_0xb814('0x35')][_0xb814('0x37')]?_0x3f0150[_0xb814('0x35')]:_0x1e4e89[_0xb814('0x31')];if(!_0x32ed56[_0xb814('0x34')][_0xb814('0x38')](_0xb814('0x39'))){_0x3f0150['limit']=qs[_0xb814('0x20')](_0x32ed56[_0xb814('0x34')][_0xb814('0x20')]);_0x3f0150[_0xb814('0x1f')]=qs[_0xb814('0x1f')](_0x32ed56['query'][_0xb814('0x1f')]);}_0x3f0150['order']=qs[_0xb814('0x3a')](_0x32ed56[_0xb814('0x34')][_0xb814('0x3a')]);_0x3f0150['where']=qs[_0xb814('0x3b')](_[_0xb814('0x3c')](_0x32ed56['query'],_0x1e4e89[_0xb814('0x3b')]),_0x271aa8);if(_0x32ed56[_0xb814('0x34')][_0xb814('0x3d')]){_0x3f0150[_0xb814('0x3e')]=_[_0xb814('0x3f')](_0x3f0150[_0xb814('0x3e')],{'$or':_['map'](_0x271aa8,function(_0xa6ce87){if(_0xa6ce87['type']!==_0xb814('0x40')){var _0x4b5583={};_0x4b5583[_0xa6ce87[_0xb814('0x2a')]]={'$like':'%'+_0x32ed56['query'][_0xb814('0x3d')]+'%'};return _0x4b5583;}})});}_0x3f0150=_[_0xb814('0x3f')]({},_0x3f0150,_0x32ed56['options']);var _0x4d308a={'where':_0x3f0150['where']};return db['SmsQueueReport'][_0xb814('0x1e')](_0x4d308a)[_0xb814('0x27')](function(_0x38cdc2){_0x5a6291[_0xb814('0x1e')]=_0x38cdc2;if(_0x32ed56['query']['includeAll']){_0x3f0150[_0xb814('0x41')]=[{'all':!![]}];}return db['SmsQueueReport'][_0xb814('0x42')](_0x3f0150);})[_0xb814('0x27')](function(_0x178823){_0x5a6291[_0xb814('0x43')]=_0x178823;return _0x5a6291;})[_0xb814('0x27')](respondWithFilteredResult(_0x1d5965,_0x3f0150))[_0xb814('0x44')](handleError(_0x1d5965,null));};exports[_0xb814('0x45')]=function(_0x28b2b4,_0x31989d){var _0x4b6ff8={'raw':!![],'where':{'id':_0x28b2b4['params']['id']}},_0x544d36={};_0x544d36[_0xb814('0x31')]=_['keys'](db[_0xb814('0x46')]['rawAttributes']);_0x544d36[_0xb814('0x34')]=_[_0xb814('0x32')](_0x28b2b4[_0xb814('0x34')]);_0x544d36[_0xb814('0x3b')]=_['intersection'](_0x544d36[_0xb814('0x31')],_0x544d36[_0xb814('0x34')]);_0x4b6ff8[_0xb814('0x35')]=_[_0xb814('0x33')](_0x544d36[_0xb814('0x31')],qs[_0xb814('0x36')](_0x28b2b4['query'][_0xb814('0x36')]));_0x4b6ff8[_0xb814('0x35')]=_0x4b6ff8[_0xb814('0x35')][_0xb814('0x37')]?_0x4b6ff8[_0xb814('0x35')]:_0x544d36[_0xb814('0x31')];if(_0x28b2b4[_0xb814('0x34')]['includeAll']){_0x4b6ff8['include']=[{'all':!![]}];}_0x4b6ff8=_[_0xb814('0x3f')]({},_0x4b6ff8,_0x28b2b4[_0xb814('0x47')]);return db[_0xb814('0x46')][_0xb814('0x48')](_0x4b6ff8)[_0xb814('0x27')](handleEntityNotFound(_0x31989d,null))[_0xb814('0x27')](respondWithResult(_0x31989d,null))[_0xb814('0x44')](handleError(_0x31989d,null));};exports[_0xb814('0x49')]=function(_0x2eb9b6,_0x344198){return db[_0xb814('0x46')]['create'](_0x2eb9b6[_0xb814('0x4a')],{})[_0xb814('0x27')](respondWithResult(_0x344198,0xc9))['catch'](handleError(_0x344198,null));};exports[_0xb814('0x25')]=function(_0x55234d,_0x2fb0f7){if(_0x55234d[_0xb814('0x4a')]['id']){delete _0x55234d[_0xb814('0x4a')]['id'];}return db[_0xb814('0x46')][_0xb814('0x48')]({'where':{'id':_0x55234d[_0xb814('0x4b')]['id']}})[_0xb814('0x27')](handleEntityNotFound(_0x2fb0f7,null))[_0xb814('0x27')](saveUpdates(_0x55234d[_0xb814('0x4a')],null))[_0xb814('0x27')](respondWithResult(_0x2fb0f7,null))['catch'](handleError(_0x2fb0f7,null));};exports['destroy']=function(_0x32eca6,_0x30f07b){return db[_0xb814('0x46')][_0xb814('0x48')]({'where':{'id':_0x32eca6[_0xb814('0x4b')]['id']}})[_0xb814('0x27')](handleEntityNotFound(_0x30f07b,null))[_0xb814('0x27')](removeEntity(_0x30f07b,null))['catch'](handleError(_0x30f07b,null));};exports[_0xb814('0x4c')]=function(_0x388324,_0xf27a6e){return db['SmsQueueReport'][_0xb814('0x4c')]()['then'](respondWithResult(_0xf27a6e,null))[_0xb814('0x44')](handleError(_0xf27a6e,null));}; \ No newline at end of file +var _0x814b=['index','map','rawAttributes','fieldName','key','model','keys','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','pick','filter','where','merge','VIRTUAL','include','findAll','rows','catch','show','SmsQueueReport','options','find','create','body','params','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','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','destroy','then','error','stack','name','send'];(function(_0xe8668f,_0x42446c){var _0xf3d4ff=function(_0x5447d6){while(--_0x5447d6){_0xe8668f['push'](_0xe8668f['shift']());}};_0xf3d4ff(++_0x42446c);}(_0x814b,0x1a2));var _0xb814=function(_0x1c461e,_0x1b98ff){_0x1c461e=_0x1c461e-0x0;var _0x1dce4f=_0x814b[_0x1c461e];return _0x1dce4f;};'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 db=require(_0xb814('0x19'))['db'];function respondWithStatusCode(_0x15d6ef,_0x35b10d){_0x35b10d=_0x35b10d||0xcc;return function(_0x2cc46b){if(_0x2cc46b){return _0x15d6ef[_0xb814('0x1a')](_0x35b10d);}return _0x15d6ef[_0xb814('0x1b')](_0x35b10d)[_0xb814('0x1c')]();};}function respondWithResult(_0x41ed7b,_0xa0a2e5){_0xa0a2e5=_0xa0a2e5||0xc8;return function(_0x2ab627){if(_0x2ab627){return _0x41ed7b[_0xb814('0x1b')](_0xa0a2e5)[_0xb814('0x1d')](_0x2ab627);}};}function respondWithFilteredResult(_0x17f5bd,_0x39bfcf){return function(_0x303aca){if(_0x303aca){var _0x3a71d6=_0x303aca[_0xb814('0x1e')],_0x45e0d0=_0x39bfcf[_0xb814('0x1f')],_0x265a83=_0x39bfcf['offset']+_0x39bfcf[_0xb814('0x20')],_0x125ce2;if(_0x265a83>=_0x3a71d6){_0x265a83=_0x3a71d6;_0x125ce2=0xc8;}else{_0x125ce2=0xce;}_0x17f5bd['status'](_0x125ce2);return _0x17f5bd[_0xb814('0x21')](_0xb814('0x22'),_0x45e0d0+'-'+_0x265a83+'/'+_0x3a71d6)['json'](_0x303aca);}return null;};}function patchUpdates(_0x4b55a7){return function(_0x55d63c){try{jsonpatch[_0xb814('0x23')](_0x55d63c,_0x4b55a7,!![]);}catch(_0x4d5276){return BPromise['reject'](_0x4d5276);}return _0x55d63c[_0xb814('0x24')]();};}function saveUpdates(_0x24211d,_0x25b6b6){return function(_0x4e139e){if(_0x4e139e){return _0x4e139e[_0xb814('0x25')](_0x24211d)['then'](function(_0x1e6393){return _0x1e6393;});}return null;};}function removeEntity(_0x1808a3,_0x3b267e){return function(_0x470e81){if(_0x470e81){return _0x470e81[_0xb814('0x26')]()[_0xb814('0x27')](function(){_0x1808a3[_0xb814('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ead86,_0x52b7a3){return function(_0x3f81d0){if(!_0x3f81d0){_0x2ead86[_0xb814('0x1a')](0x194);}return _0x3f81d0;};}function handleError(_0x31c7ec,_0x208927){_0x208927=_0x208927||0x1f4;return function(_0x1c8a2e){logger[_0xb814('0x28')](_0x1c8a2e[_0xb814('0x29')]);if(_0x1c8a2e['name']){delete _0x1c8a2e[_0xb814('0x2a')];}_0x31c7ec[_0xb814('0x1b')](_0x208927)[_0xb814('0x2b')](_0x1c8a2e);};}exports[_0xb814('0x2c')]=function(_0x32ed56,_0x1d5965){var _0x3f0150={},_0x1e4e89={},_0x5a6291={'count':0x0,'rows':[]};var _0x271aa8=_[_0xb814('0x2d')](db['SmsQueueReport'][_0xb814('0x2e')],function(_0x37d24d){return{'name':_0x37d24d[_0xb814('0x2f')],'type':_0x37d24d['type'][_0xb814('0x30')]};});_0x1e4e89[_0xb814('0x31')]=_['map'](_0x271aa8,_0xb814('0x2a'));_0x1e4e89['query']=_[_0xb814('0x32')](_0x32ed56['query']);_0x1e4e89['filters']=_[_0xb814('0x33')](_0x1e4e89['model'],_0x1e4e89[_0xb814('0x34')]);_0x3f0150[_0xb814('0x35')]=_[_0xb814('0x33')](_0x1e4e89['model'],qs['fields'](_0x32ed56[_0xb814('0x34')][_0xb814('0x36')]));_0x3f0150['attributes']=_0x3f0150[_0xb814('0x35')][_0xb814('0x37')]?_0x3f0150[_0xb814('0x35')]:_0x1e4e89[_0xb814('0x31')];if(!_0x32ed56[_0xb814('0x34')][_0xb814('0x38')](_0xb814('0x39'))){_0x3f0150['limit']=qs[_0xb814('0x20')](_0x32ed56[_0xb814('0x34')][_0xb814('0x20')]);_0x3f0150[_0xb814('0x1f')]=qs[_0xb814('0x1f')](_0x32ed56['query'][_0xb814('0x1f')]);}_0x3f0150['order']=qs[_0xb814('0x3a')](_0x32ed56[_0xb814('0x34')][_0xb814('0x3a')]);_0x3f0150['where']=qs[_0xb814('0x3b')](_[_0xb814('0x3c')](_0x32ed56['query'],_0x1e4e89[_0xb814('0x3b')]),_0x271aa8);if(_0x32ed56[_0xb814('0x34')][_0xb814('0x3d')]){_0x3f0150[_0xb814('0x3e')]=_[_0xb814('0x3f')](_0x3f0150[_0xb814('0x3e')],{'$or':_['map'](_0x271aa8,function(_0xa6ce87){if(_0xa6ce87['type']!==_0xb814('0x40')){var _0x4b5583={};_0x4b5583[_0xa6ce87[_0xb814('0x2a')]]={'$like':'%'+_0x32ed56['query'][_0xb814('0x3d')]+'%'};return _0x4b5583;}})});}_0x3f0150=_[_0xb814('0x3f')]({},_0x3f0150,_0x32ed56['options']);var _0x4d308a={'where':_0x3f0150['where']};return db['SmsQueueReport'][_0xb814('0x1e')](_0x4d308a)[_0xb814('0x27')](function(_0x38cdc2){_0x5a6291[_0xb814('0x1e')]=_0x38cdc2;if(_0x32ed56['query']['includeAll']){_0x3f0150[_0xb814('0x41')]=[{'all':!![]}];}return db['SmsQueueReport'][_0xb814('0x42')](_0x3f0150);})[_0xb814('0x27')](function(_0x178823){_0x5a6291[_0xb814('0x43')]=_0x178823;return _0x5a6291;})[_0xb814('0x27')](respondWithFilteredResult(_0x1d5965,_0x3f0150))[_0xb814('0x44')](handleError(_0x1d5965,null));};exports[_0xb814('0x45')]=function(_0x28b2b4,_0x31989d){var _0x4b6ff8={'raw':!![],'where':{'id':_0x28b2b4['params']['id']}},_0x544d36={};_0x544d36[_0xb814('0x31')]=_['keys'](db[_0xb814('0x46')]['rawAttributes']);_0x544d36[_0xb814('0x34')]=_[_0xb814('0x32')](_0x28b2b4[_0xb814('0x34')]);_0x544d36[_0xb814('0x3b')]=_['intersection'](_0x544d36[_0xb814('0x31')],_0x544d36[_0xb814('0x34')]);_0x4b6ff8[_0xb814('0x35')]=_[_0xb814('0x33')](_0x544d36[_0xb814('0x31')],qs[_0xb814('0x36')](_0x28b2b4['query'][_0xb814('0x36')]));_0x4b6ff8[_0xb814('0x35')]=_0x4b6ff8[_0xb814('0x35')][_0xb814('0x37')]?_0x4b6ff8[_0xb814('0x35')]:_0x544d36[_0xb814('0x31')];if(_0x28b2b4[_0xb814('0x34')]['includeAll']){_0x4b6ff8['include']=[{'all':!![]}];}_0x4b6ff8=_[_0xb814('0x3f')]({},_0x4b6ff8,_0x28b2b4[_0xb814('0x47')]);return db[_0xb814('0x46')][_0xb814('0x48')](_0x4b6ff8)[_0xb814('0x27')](handleEntityNotFound(_0x31989d,null))[_0xb814('0x27')](respondWithResult(_0x31989d,null))[_0xb814('0x44')](handleError(_0x31989d,null));};exports[_0xb814('0x49')]=function(_0x2eb9b6,_0x344198){return db[_0xb814('0x46')]['create'](_0x2eb9b6[_0xb814('0x4a')],{})[_0xb814('0x27')](respondWithResult(_0x344198,0xc9))['catch'](handleError(_0x344198,null));};exports[_0xb814('0x25')]=function(_0x55234d,_0x2fb0f7){if(_0x55234d[_0xb814('0x4a')]['id']){delete _0x55234d[_0xb814('0x4a')]['id'];}return db[_0xb814('0x46')][_0xb814('0x48')]({'where':{'id':_0x55234d[_0xb814('0x4b')]['id']}})[_0xb814('0x27')](handleEntityNotFound(_0x2fb0f7,null))[_0xb814('0x27')](saveUpdates(_0x55234d[_0xb814('0x4a')],null))[_0xb814('0x27')](respondWithResult(_0x2fb0f7,null))['catch'](handleError(_0x2fb0f7,null));};exports['destroy']=function(_0x32eca6,_0x30f07b){return db[_0xb814('0x46')][_0xb814('0x48')]({'where':{'id':_0x32eca6[_0xb814('0x4b')]['id']}})[_0xb814('0x27')](handleEntityNotFound(_0x30f07b,null))[_0xb814('0x27')](removeEntity(_0x30f07b,null))['catch'](handleError(_0x30f07b,null));};exports[_0xb814('0x4c')]=function(_0x388324,_0xf27a6e){return db['SmsQueueReport'][_0xb814('0x4c')]()['then'](respondWithResult(_0xf27a6e,null))[_0xb814('0x44')](handleError(_0xf27a6e,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 2c32a19..41aa891 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 _0xe2b4=['exports','define','SmsQueueReport','report_sms_queue','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3c0b7d,_0xb0ac76){var _0x4596ee=function(_0x392b81){while(--_0x392b81){_0x3c0b7d['push'](_0x3c0b7d['shift']());}};_0x4596ee(++_0xb0ac76);}(_0xe2b4,0x1d3));var _0x4e2b=function(_0x1a0abf,_0xe9a497){_0x1a0abf=_0x1a0abf-0x0;var _0x25409c=_0xe2b4[_0x1a0abf];return _0x25409c;};'use strict';var _=require(_0x4e2b('0x0'));var util=require('util');var logger=require(_0x4e2b('0x1'))(_0x4e2b('0x2'));var moment=require(_0x4e2b('0x3'));var BPromise=require(_0x4e2b('0x4'));var rp=require(_0x4e2b('0x5'));var fs=require('fs');var path=require(_0x4e2b('0x6'));var rimraf=require(_0x4e2b('0x7'));var config=require(_0x4e2b('0x8'));var attributes=require('./smsQueueReport.attributes');module[_0x4e2b('0x9')]=function(_0x1fffcd,_0x85b152){return _0x1fffcd[_0x4e2b('0xa')](_0x4e2b('0xb'),attributes,{'tableName':_0x4e2b('0xc'),'paranoid':![],'indexes':[{'name':_0x4e2b('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x8146=['uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsQueueReport.attributes','exports','define','SmsQueueReport'];(function(_0x559056,_0xa84dcb){var _0x2fe42b=function(_0x594a6d){while(--_0x594a6d){_0x559056['push'](_0x559056['shift']());}};_0x2fe42b(++_0xa84dcb);}(_0x8146,0x194));var _0x6814=function(_0x32a69c,_0x40f56e){_0x32a69c=_0x32a69c-0x0;var _0x2f9cf3=_0x8146[_0x32a69c];return _0x2f9cf3;};'use strict';var _=require(_0x6814('0x0'));var util=require('util');var logger=require(_0x6814('0x1'))(_0x6814('0x2'));var moment=require(_0x6814('0x3'));var BPromise=require(_0x6814('0x4'));var rp=require(_0x6814('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6814('0x6'));var config=require(_0x6814('0x7'));var attributes=require(_0x6814('0x8'));module[_0x6814('0x9')]=function(_0x33f650,_0xa1ef3a){return _0x33f650[_0x6814('0xa')](_0x6814('0xb'),attributes,{'tableName':'report_sms_queue','paranoid':![],'indexes':[{'name':_0x6814('0xc'),'fields':[_0x6814('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index 08ee396..5a3420b 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 _0xed7c=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SmsQueueReport,\x20%s,\x20%s','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','SmsQueueReport','create','body','options','raw','CreateSmsQueueReport','update','where','limit','UpdateSmsQueueReport','lodash'];(function(_0x44606e,_0x2bf244){var _0xe68388=function(_0x488a30){while(--_0x488a30){_0x44606e['push'](_0x44606e['shift']());}};_0xe68388(++_0x2bf244);}(_0xed7c,0x1a3));var _0xced7=function(_0x2004f2,_0x31f4d3){_0x2004f2=_0x2004f2-0x0;var _0x1a860f=_0xed7c[_0x2004f2];return _0x1a860f;};'use strict';var _=require(_0xced7('0x0'));var util=require(_0xced7('0x1'));var moment=require(_0xced7('0x2'));var BPromise=require(_0xced7('0x3'));var rs=require(_0xced7('0x4'));var fs=require('fs');var Redis=require(_0xced7('0x5'));var db=require(_0xced7('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xced7('0x7'))(_0xced7('0x8'));var config=require(_0xced7('0x9'));var jayson=require(_0xced7('0xa'));var client=jayson[_0xced7('0xb')][_0xced7('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x549e03,_0x2af5ae,_0x412dad){return new BPromise(function(_0x1c255c,_0x30470f){return client[_0xced7('0xd')](_0x549e03,_0x412dad)[_0xced7('0xe')](function(_0x30a692){logger[_0xced7('0xf')](_0xced7('0x10'),_0x2af5ae,'request\x20sent');logger[_0xced7('0x11')](_0xced7('0x12'),_0x2af5ae,_0xced7('0x13'),JSON[_0xced7('0x14')](_0x30a692));if(_0x30a692[_0xced7('0x15')]){if(_0x30a692[_0xced7('0x15')]['code']===0x1f4){logger['error'](_0xced7('0x10'),_0x2af5ae,_0x30a692[_0xced7('0x15')]['message']);return _0x30470f(_0x30a692[_0xced7('0x15')][_0xced7('0x16')]);}logger['error']('SmsQueueReport,\x20%s,\x20%s',_0x2af5ae,_0x30a692['error'][_0xced7('0x16')]);return _0x1c255c(_0x30a692[_0xced7('0x15')][_0xced7('0x16')]);}else{logger[_0xced7('0xf')](_0xced7('0x10'),_0x2af5ae,'request\x20sent');_0x1c255c(_0x30a692[_0xced7('0x17')][_0xced7('0x16')]);}})[_0xced7('0x18')](function(_0x14c582){logger[_0xced7('0x15')](_0xced7('0x10'),_0x2af5ae,_0x14c582);_0x30470f(_0x14c582);});});}exports['CreateSmsQueueReport']=function(_0x4b1041){var _0x45ed60=this;return new Promise(function(_0x5c5476,_0x558646){return db[_0xced7('0x19')][_0xced7('0x1a')](_0x4b1041[_0xced7('0x1b')],{'raw':_0x4b1041[_0xced7('0x1c')]?_0x4b1041[_0xced7('0x1c')][_0xced7('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x5085b5){logger[_0xced7('0xf')]('CreateSmsQueueReport',_0x4b1041);logger['debug'](_0xced7('0x1e'),_0x4b1041,JSON[_0xced7('0x14')](_0x5085b5));_0x5c5476(_0x5085b5);})[_0xced7('0x18')](function(_0x30bf1a){logger['error']('CreateSmsQueueReport',_0x30bf1a[_0xced7('0x16')],_0x4b1041);_0x558646(_0x45ed60[_0xced7('0x15')](0x1f4,_0x30bf1a[_0xced7('0x16')]));});});};exports['UpdateSmsQueueReport']=function(_0x570e2a){var _0x2ae863=this;return new Promise(function(_0x4f09ec,_0x3322f3){return db[_0xced7('0x19')][_0xced7('0x1f')](_0x570e2a[_0xced7('0x1b')],{'raw':_0x570e2a[_0xced7('0x1c')]?_0x570e2a[_0xced7('0x1c')][_0xced7('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x570e2a[_0xced7('0x1c')]?_0x570e2a[_0xced7('0x1c')][_0xced7('0x20')]||null:null,'attributes':_0x570e2a['options']?_0x570e2a[_0xced7('0x1c')]['attributes']||null:null,'limit':_0x570e2a['options']?_0x570e2a[_0xced7('0x1c')][_0xced7('0x21')]||null:null})[_0xced7('0xe')](function(_0x36b1bd){logger[_0xced7('0xf')](_0xced7('0x22'),_0x570e2a);logger[_0xced7('0x11')](_0xced7('0x22'),_0x570e2a,JSON[_0xced7('0x14')](_0x36b1bd));_0x4f09ec(_0x36b1bd);})['catch'](function(_0x11f708){logger[_0xced7('0x15')](_0xced7('0x22'),_0x11f708[_0xced7('0x16')],_0x570e2a);_0x3322f3(_0x2ae863['error'](0x1f4,_0x11f708[_0xced7('0x16')]));});});}; \ No newline at end of file +var _0x7c53=['result','catch','CreateSmsQueueReport','SmsQueueReport','body','options','raw','UpdateSmsQueueReport','update','attributes','limit','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0x7c53,0x87));var _0x37c5=function(_0x664054,_0x37f01c){_0x664054=_0x664054-0x0;var _0x402cf4=_0x7c53[_0x664054];return _0x402cf4;};'use strict';var _=require(_0x37c5('0x0'));var util=require(_0x37c5('0x1'));var moment=require(_0x37c5('0x2'));var BPromise=require(_0x37c5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x37c5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x37c5('0x5'));var logger=require(_0x37c5('0x6'))(_0x37c5('0x7'));var config=require('../../config/environment');var jayson=require(_0x37c5('0x8'));var client=jayson[_0x37c5('0x9')][_0x37c5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x298ed7,_0x5801aa,_0x284c1b){return new BPromise(function(_0x18c5dd,_0x5e8708){return client[_0x37c5('0xb')](_0x298ed7,_0x284c1b)[_0x37c5('0xc')](function(_0x419e5a){logger[_0x37c5('0xd')](_0x37c5('0xe'),_0x5801aa,_0x37c5('0xf'));logger[_0x37c5('0x10')]('SmsQueueReport,\x20%s,\x20%s,\x20%s',_0x5801aa,_0x37c5('0xf'),JSON[_0x37c5('0x11')](_0x419e5a));if(_0x419e5a[_0x37c5('0x12')]){if(_0x419e5a[_0x37c5('0x12')]['code']===0x1f4){logger[_0x37c5('0x12')](_0x37c5('0xe'),_0x5801aa,_0x419e5a['error']['message']);return _0x5e8708(_0x419e5a[_0x37c5('0x12')][_0x37c5('0x13')]);}logger[_0x37c5('0x12')](_0x37c5('0xe'),_0x5801aa,_0x419e5a[_0x37c5('0x12')][_0x37c5('0x13')]);return _0x18c5dd(_0x419e5a[_0x37c5('0x12')]['message']);}else{logger[_0x37c5('0xd')](_0x37c5('0xe'),_0x5801aa,'request\x20sent');_0x18c5dd(_0x419e5a[_0x37c5('0x14')][_0x37c5('0x13')]);}})[_0x37c5('0x15')](function(_0x2bfd38){logger[_0x37c5('0x12')](_0x37c5('0xe'),_0x5801aa,_0x2bfd38);_0x5e8708(_0x2bfd38);});});}exports[_0x37c5('0x16')]=function(_0x5721fa){var _0xb5794b=this;return new Promise(function(_0x40c34e,_0x2fce74){return db[_0x37c5('0x17')]['create'](_0x5721fa[_0x37c5('0x18')],{'raw':_0x5721fa[_0x37c5('0x19')]?_0x5721fa['options'][_0x37c5('0x1a')]===undefined?!![]:![]:!![]})[_0x37c5('0xc')](function(_0x1b0156){logger[_0x37c5('0xd')]('CreateSmsQueueReport',_0x5721fa);logger['debug'](_0x37c5('0x16'),_0x5721fa,JSON['stringify'](_0x1b0156));_0x40c34e(_0x1b0156);})[_0x37c5('0x15')](function(_0x322925){logger[_0x37c5('0x12')]('CreateSmsQueueReport',_0x322925[_0x37c5('0x13')],_0x5721fa);_0x2fce74(_0xb5794b['error'](0x1f4,_0x322925[_0x37c5('0x13')]));});});};exports[_0x37c5('0x1b')]=function(_0x4764e7){var _0x1a8ec3=this;return new Promise(function(_0x3efdd0,_0x5dba3a){return db['SmsQueueReport'][_0x37c5('0x1c')](_0x4764e7['body'],{'raw':_0x4764e7['options']?_0x4764e7[_0x37c5('0x19')][_0x37c5('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4764e7['options']?_0x4764e7[_0x37c5('0x19')]['where']||null:null,'attributes':_0x4764e7[_0x37c5('0x19')]?_0x4764e7[_0x37c5('0x19')][_0x37c5('0x1d')]||null:null,'limit':_0x4764e7['options']?_0x4764e7['options'][_0x37c5('0x1e')]||null:null})[_0x37c5('0xc')](function(_0x259532){logger['info'](_0x37c5('0x1b'),_0x4764e7);logger[_0x37c5('0x10')](_0x37c5('0x1b'),_0x4764e7,JSON[_0x37c5('0x11')](_0x259532));_0x3efdd0(_0x259532);})[_0x37c5('0x15')](function(_0x3db419){logger['error'](_0x37c5('0x1b'),_0x3db419[_0x37c5('0x13')],_0x4764e7);_0x5dba3a(_0x1a8ec3[_0x37c5('0x12')](0x1f4,_0x3db419['message']));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 1c57171..0772946 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 _0x2547=['../../config/environment','get','isAuthenticated','index','describe','create','put','/:id','update','delete','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x9712cb,_0x265691){var _0xe189ca=function(_0x132ede){while(--_0x132ede){_0x9712cb['push'](_0x9712cb['shift']());}};_0xe189ca(++_0x265691);}(_0x2547,0x1cd));var _0x7254=function(_0x541914,_0x3ca679){_0x541914=_0x541914-0x0;var _0x56c3f9=_0x2547[_0x541914];return _0x56c3f9;};'use strict';var multer=require('multer');var util=require(_0x7254('0x0'));var path=require(_0x7254('0x1'));var timeout=require(_0x7254('0x2'));var express=require(_0x7254('0x3'));var router=express[_0x7254('0x4')]();var auth=require(_0x7254('0x5'));var interaction=require(_0x7254('0x6'));var config=require(_0x7254('0x7'));var controller=require('./smsTransferReport.controller');router[_0x7254('0x8')]('/',auth[_0x7254('0x9')](),controller[_0x7254('0xa')]);router[_0x7254('0x8')]('/describe',auth[_0x7254('0x9')](),controller[_0x7254('0xb')]);router[_0x7254('0x8')]('/:id',auth[_0x7254('0x9')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x7254('0xc')]);router[_0x7254('0xd')](_0x7254('0xe'),auth[_0x7254('0x9')](),controller[_0x7254('0xf')]);router[_0x7254('0x10')]('/:id',auth[_0x7254('0x9')](),controller['destroy']);module[_0x7254('0x11')]=router; \ No newline at end of file +var _0x0713=['create','put','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./smsTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x18b729,_0x3f159e){var _0x596825=function(_0x1e285d){while(--_0x1e285d){_0x18b729['push'](_0x18b729['shift']());}};_0x596825(++_0x3f159e);}(_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['post']('/',auth[_0x3071('0x8')](),controller[_0x3071('0xe')]);router[_0x3071('0xf')](_0x3071('0xc'),auth[_0x3071('0x8')](),controller['update']);router[_0x3071('0x10')](_0x3071('0xc'),auth[_0x3071('0x8')](),controller[_0x3071('0x11')]);module[_0x3071('0x12')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 377b979..201f430 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 _0x7998=['exports','STRING','ENUM','account','agent','queue','DATE','NOW','sequelize'];(function(_0x49cf25,_0x5b2381){var _0x2bcb71=function(_0x358dc7){while(--_0x358dc7){_0x49cf25['push'](_0x49cf25['shift']());}};_0x2bcb71(++_0x5b2381);}(_0x7998,0x10d));var _0x8799=function(_0x234545,_0x17b059){_0x234545=_0x234545-0x0;var _0x46159b=_0x7998[_0x234545];return _0x46159b;};'use strict';var moment=require('moment');var Sequelize=require(_0x8799('0x0'));module[_0x8799('0x1')]={'uniqueid':{'type':Sequelize[_0x8799('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x8799('0x3')](_0x8799('0x4'),_0x8799('0x5'),_0x8799('0x6')),'allowNull':![],'defaultValue':_0x8799('0x6')},'transferredAt':{'type':Sequelize[_0x8799('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x8799('0x8')]}}; \ No newline at end of file +var _0x853f=['agent','queue','DATE','NOW','exports','ENUM','account'];(function(_0x49bd32,_0x54c756){var _0x41f12d=function(_0x50dc15){while(--_0x50dc15){_0x49bd32['push'](_0x49bd32['shift']());}};_0x41f12d(++_0x54c756);}(_0x853f,0xdd));var _0xf853=function(_0x41058f,_0x27637b){_0x41058f=_0x41058f-0x0;var _0x2c5b88=_0x853f[_0x41058f];return _0x2c5b88;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0xf853('0x0')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xf853('0x1')](_0xf853('0x2'),_0xf853('0x3'),_0xf853('0x4')),'allowNull':![],'defaultValue':_0xf853('0x4')},'transferredAt':{'type':Sequelize[_0xf853('0x5')],'allowNull':![],'defaultValue':Sequelize[_0xf853('0x6')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 21d3f05..f1bf8a1 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 _0xa9e0=['merge','options','include','findAll','catch','params','includeAll','create','body','find','describe','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','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','index','map','SmsTransferReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit','sort','where','pick','filter','VIRTUAL'];(function(_0x5c5c44,_0x3f5404){var _0x16396f=function(_0x20cfb7){while(--_0x20cfb7){_0x5c5c44['push'](_0x5c5c44['shift']());}};_0x16396f(++_0x3f5404);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xa9e0[_0x47e7cb];return _0x2a8874;};'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 db=require(_0x0a9e('0x13'))['db'];function respondWithStatusCode(_0x36471c,_0xd5b662){_0xd5b662=_0xd5b662||0xcc;return function(_0x26d672){if(_0x26d672){return _0x36471c[_0x0a9e('0x14')](_0xd5b662);}return _0x36471c[_0x0a9e('0x15')](_0xd5b662)['end']();};}function respondWithResult(_0x4283ce,_0x239b12){_0x239b12=_0x239b12||0xc8;return function(_0x2b4227){if(_0x2b4227){return _0x4283ce[_0x0a9e('0x15')](_0x239b12)[_0x0a9e('0x16')](_0x2b4227);}};}function respondWithFilteredResult(_0x4d5611,_0x52a03d){return function(_0x22dccb){if(_0x22dccb){var _0x5d0880=_0x22dccb[_0x0a9e('0x17')],_0x1985b6=_0x52a03d['offset'],_0x519dfd=_0x52a03d[_0x0a9e('0x18')]+_0x52a03d['limit'],_0x16033c;if(_0x519dfd>=_0x5d0880){_0x519dfd=_0x5d0880;_0x16033c=0xc8;}else{_0x16033c=0xce;}_0x4d5611[_0x0a9e('0x15')](_0x16033c);return _0x4d5611[_0x0a9e('0x19')](_0x0a9e('0x1a'),_0x1985b6+'-'+_0x519dfd+'/'+_0x5d0880)[_0x0a9e('0x16')](_0x22dccb);}return null;};}function patchUpdates(_0x31b1ca){return function(_0x2eb11f){try{jsonpatch[_0x0a9e('0x1b')](_0x2eb11f,_0x31b1ca,!![]);}catch(_0x20559e){return BPromise[_0x0a9e('0x1c')](_0x20559e);}return _0x2eb11f[_0x0a9e('0x1d')]();};}function saveUpdates(_0x1c696a,_0x105080){return function(_0x4bb1e3){if(_0x4bb1e3){return _0x4bb1e3[_0x0a9e('0x1e')](_0x1c696a)[_0x0a9e('0x1f')](function(_0x53682f){return _0x53682f;});}return null;};}function removeEntity(_0x20f109,_0x5a09ef){return function(_0x588269){if(_0x588269){return _0x588269[_0x0a9e('0x20')]()[_0x0a9e('0x1f')](function(){_0x20f109[_0x0a9e('0x15')](0xcc)[_0x0a9e('0x21')]();});}};}function handleEntityNotFound(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(!_0x2fb0e4){_0x4abc77[_0x0a9e('0x14')](0x194);}return _0x2fb0e4;};}function handleError(_0x4d00e6,_0x370d86){_0x370d86=_0x370d86||0x1f4;return function(_0x42ac8f){logger[_0x0a9e('0x22')](_0x42ac8f['stack']);if(_0x42ac8f['name']){delete _0x42ac8f[_0x0a9e('0x23')];}_0x4d00e6[_0x0a9e('0x15')](_0x370d86)[_0x0a9e('0x24')](_0x42ac8f);};}exports[_0x0a9e('0x25')]=function(_0x526cf3,_0x384319){var _0x479bc4={},_0x45a1e7={},_0x5bfb33={'count':0x0,'rows':[]};var _0x1dc186=_[_0x0a9e('0x26')](db[_0x0a9e('0x27')][_0x0a9e('0x28')],function(_0x140511){return{'name':_0x140511[_0x0a9e('0x29')],'type':_0x140511[_0x0a9e('0x2a')][_0x0a9e('0x2b')]};});_0x45a1e7['model']=_[_0x0a9e('0x26')](_0x1dc186,_0x0a9e('0x23'));_0x45a1e7[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x526cf3['query']);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],_0x45a1e7[_0x0a9e('0x2c')]);_0x479bc4[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],qs[_0x0a9e('0x32')](_0x526cf3[_0x0a9e('0x2c')]['fields']));_0x479bc4[_0x0a9e('0x31')]=_0x479bc4['attributes'][_0x0a9e('0x33')]?_0x479bc4[_0x0a9e('0x31')]:_0x45a1e7[_0x0a9e('0x30')];if(!_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x34')]('nolimit')){_0x479bc4[_0x0a9e('0x35')]=qs[_0x0a9e('0x35')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x35')]);_0x479bc4[_0x0a9e('0x18')]=qs[_0x0a9e('0x18')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x18')]);}_0x479bc4['order']=qs[_0x0a9e('0x36')](_0x526cf3['query'][_0x0a9e('0x36')]);_0x479bc4[_0x0a9e('0x37')]=qs[_0x0a9e('0x2e')](_[_0x0a9e('0x38')](_0x526cf3['query'],_0x45a1e7[_0x0a9e('0x2e')]),_0x1dc186);if(_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x39')]){_0x479bc4[_0x0a9e('0x37')]=_['merge'](_0x479bc4['where'],{'$or':_[_0x0a9e('0x26')](_0x1dc186,function(_0x5640eb){if(_0x5640eb[_0x0a9e('0x2a')]!==_0x0a9e('0x3a')){var _0x381c37={};_0x381c37[_0x5640eb[_0x0a9e('0x23')]]={'$like':'%'+_0x526cf3['query'][_0x0a9e('0x39')]+'%'};return _0x381c37;}})});}_0x479bc4=_[_0x0a9e('0x3b')]({},_0x479bc4,_0x526cf3[_0x0a9e('0x3c')]);var _0x533942={'where':_0x479bc4[_0x0a9e('0x37')]};return db[_0x0a9e('0x27')][_0x0a9e('0x17')](_0x533942)['then'](function(_0x546ef8){_0x5bfb33[_0x0a9e('0x17')]=_0x546ef8;if(_0x526cf3[_0x0a9e('0x2c')]['includeAll']){_0x479bc4[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x27')][_0x0a9e('0x3e')](_0x479bc4);})[_0x0a9e('0x1f')](function(_0x4b38d9){_0x5bfb33['rows']=_0x4b38d9;return _0x5bfb33;})[_0x0a9e('0x1f')](respondWithFilteredResult(_0x384319,_0x479bc4))[_0x0a9e('0x3f')](handleError(_0x384319,null));};exports['show']=function(_0x183991,_0x1dec2e){var _0x1459bb={'raw':!![],'where':{'id':_0x183991[_0x0a9e('0x40')]['id']}},_0x5b4f5e={};_0x5b4f5e[_0x0a9e('0x30')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x27')][_0x0a9e('0x28')]);_0x5b4f5e[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x183991[_0x0a9e('0x2c')]);_0x5b4f5e[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],_0x5b4f5e[_0x0a9e('0x2c')]);_0x1459bb[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],qs['fields'](_0x183991['query'][_0x0a9e('0x32')]));_0x1459bb[_0x0a9e('0x31')]=_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x33')]?_0x1459bb[_0x0a9e('0x31')]:_0x5b4f5e[_0x0a9e('0x30')];if(_0x183991[_0x0a9e('0x2c')][_0x0a9e('0x41')]){_0x1459bb[_0x0a9e('0x3d')]=[{'all':!![]}];}_0x1459bb=_[_0x0a9e('0x3b')]({},_0x1459bb,_0x183991[_0x0a9e('0x3c')]);return db[_0x0a9e('0x27')]['find'](_0x1459bb)[_0x0a9e('0x1f')](handleEntityNotFound(_0x1dec2e,null))[_0x0a9e('0x1f')](respondWithResult(_0x1dec2e,null))[_0x0a9e('0x3f')](handleError(_0x1dec2e,null));};exports[_0x0a9e('0x42')]=function(_0x2e8caf,_0xbe9d19){return db[_0x0a9e('0x27')][_0x0a9e('0x42')](_0x2e8caf['body'],{})[_0x0a9e('0x1f')](respondWithResult(_0xbe9d19,0xc9))['catch'](handleError(_0xbe9d19,null));};exports[_0x0a9e('0x1e')]=function(_0x476688,_0x8d6dd1){if(_0x476688['body']['id']){delete _0x476688[_0x0a9e('0x43')]['id'];}return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x476688[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x8d6dd1,null))[_0x0a9e('0x1f')](saveUpdates(_0x476688[_0x0a9e('0x43')],null))['then'](respondWithResult(_0x8d6dd1,null))[_0x0a9e('0x3f')](handleError(_0x8d6dd1,null));};exports[_0x0a9e('0x20')]=function(_0x1b5e80,_0x16f976){return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x1b5e80[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x16f976,null))[_0x0a9e('0x1f')](removeEntity(_0x16f976,null))['catch'](handleError(_0x16f976,null));};exports[_0x0a9e('0x45')]=function(_0x3fe430,_0x4f7240){return db['SmsTransferReport']['describe']()[_0x0a9e('0x1f')](respondWithResult(_0x4f7240,null))[_0x0a9e('0x3f')](handleError(_0x4f7240,null));}; \ No newline at end of file +var _0x70e0=['attributes','intersection','length','hasOwnProperty','nolimit','sort','where','filter','type','VIRTUAL','name','merge','options','count','includeAll','findAll','rows','catch','include','find','create','body','params','describe','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','to-csv','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','json','offset','limit','status','set','Content-Range','apply','reject','update','then','destroy','end','stack','send','index','map','SmsTransferReport','rawAttributes','fieldName','key','model','keys','query','filters'];(function(_0x105736,_0x141625){var _0x55178c=function(_0x49bdc9){while(--_0x49bdc9){_0x105736['push'](_0x105736['shift']());}};_0x55178c(++_0x141625);}(_0x70e0,0x17b));var _0x070e=function(_0x51a231,_0x29d949){_0x51a231=_0x51a231-0x0;var _0xbbfb30=_0x70e0[_0x51a231];return _0xbbfb30;};'use strict';var pdf=require(_0x070e('0x0'));var emlformat=require(_0x070e('0x1'));var rimraf=require(_0x070e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x070e('0x3'));var moment=require(_0x070e('0x4'));var BPromise=require(_0x070e('0x5'));var Mustache=require(_0x070e('0x6'));var util=require('util');var path=require(_0x070e('0x7'));var sox=require('sox');var csv=require(_0x070e('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x070e('0x9'));var jsforce=require(_0x070e('0xa'));var deskjs=require(_0x070e('0xb'));var toCsv=require(_0x070e('0x8'));var querystring=require(_0x070e('0xc'));var Papa=require(_0x070e('0xd'));var Redis=require(_0x070e('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x070e('0xf'));var hardwareService=require(_0x070e('0x10'));var logger=require(_0x070e('0x11'))(_0x070e('0x12'));var utils=require(_0x070e('0x13'));var config=require(_0x070e('0x14'));var db=require(_0x070e('0x15'))['db'];function respondWithStatusCode(_0x1baa12,_0x39d2b9){_0x39d2b9=_0x39d2b9||0xcc;return function(_0x5bf079){if(_0x5bf079){return _0x1baa12[_0x070e('0x16')](_0x39d2b9);}return _0x1baa12['status'](_0x39d2b9)['end']();};}function respondWithResult(_0x24baba,_0x56c7ba){_0x56c7ba=_0x56c7ba||0xc8;return function(_0x4a33d2){if(_0x4a33d2){return _0x24baba['status'](_0x56c7ba)[_0x070e('0x17')](_0x4a33d2);}};}function respondWithFilteredResult(_0x14c3fd,_0x51d14d){return function(_0x5d3a38){if(_0x5d3a38){var _0x373d86=_0x5d3a38['count'],_0xeae1a5=_0x51d14d['offset'],_0x180897=_0x51d14d[_0x070e('0x18')]+_0x51d14d[_0x070e('0x19')],_0x19d9da;if(_0x180897>=_0x373d86){_0x180897=_0x373d86;_0x19d9da=0xc8;}else{_0x19d9da=0xce;}_0x14c3fd[_0x070e('0x1a')](_0x19d9da);return _0x14c3fd[_0x070e('0x1b')](_0x070e('0x1c'),_0xeae1a5+'-'+_0x180897+'/'+_0x373d86)['json'](_0x5d3a38);}return null;};}function patchUpdates(_0x3938b5){return function(_0x168dc6){try{jsonpatch[_0x070e('0x1d')](_0x168dc6,_0x3938b5,!![]);}catch(_0x3ea105){return BPromise[_0x070e('0x1e')](_0x3ea105);}return _0x168dc6['save']();};}function saveUpdates(_0x5b2f48,_0x4e958f){return function(_0x9907cf){if(_0x9907cf){return _0x9907cf[_0x070e('0x1f')](_0x5b2f48)[_0x070e('0x20')](function(_0x4be0d7){return _0x4be0d7;});}return null;};}function removeEntity(_0x5b184,_0x5dc5d2){return function(_0xf8dd5d){if(_0xf8dd5d){return _0xf8dd5d[_0x070e('0x21')]()[_0x070e('0x20')](function(){_0x5b184[_0x070e('0x1a')](0xcc)[_0x070e('0x22')]();});}};}function handleEntityNotFound(_0xa86797,_0xe405e){return function(_0x164cdf){if(!_0x164cdf){_0xa86797['sendStatus'](0x194);}return _0x164cdf;};}function handleError(_0x2f8055,_0x270061){_0x270061=_0x270061||0x1f4;return function(_0x4790eb){logger['error'](_0x4790eb[_0x070e('0x23')]);if(_0x4790eb['name']){delete _0x4790eb['name'];}_0x2f8055[_0x070e('0x1a')](_0x270061)[_0x070e('0x24')](_0x4790eb);};}exports[_0x070e('0x25')]=function(_0x1743cc,_0x4763c6){var _0x497f58={},_0x374c54={},_0x219e48={'count':0x0,'rows':[]};var _0x1d72d6=_[_0x070e('0x26')](db[_0x070e('0x27')][_0x070e('0x28')],function(_0x1a1892){return{'name':_0x1a1892[_0x070e('0x29')],'type':_0x1a1892['type'][_0x070e('0x2a')]};});_0x374c54[_0x070e('0x2b')]=_[_0x070e('0x26')](_0x1d72d6,'name');_0x374c54['query']=_[_0x070e('0x2c')](_0x1743cc[_0x070e('0x2d')]);_0x374c54[_0x070e('0x2e')]=_['intersection'](_0x374c54[_0x070e('0x2b')],_0x374c54[_0x070e('0x2d')]);_0x497f58[_0x070e('0x2f')]=_[_0x070e('0x30')](_0x374c54['model'],qs['fields'](_0x1743cc['query']['fields']));_0x497f58[_0x070e('0x2f')]=_0x497f58['attributes'][_0x070e('0x31')]?_0x497f58[_0x070e('0x2f')]:_0x374c54['model'];if(!_0x1743cc['query'][_0x070e('0x32')](_0x070e('0x33'))){_0x497f58['limit']=qs['limit'](_0x1743cc[_0x070e('0x2d')][_0x070e('0x19')]);_0x497f58[_0x070e('0x18')]=qs[_0x070e('0x18')](_0x1743cc[_0x070e('0x2d')]['offset']);}_0x497f58['order']=qs[_0x070e('0x34')](_0x1743cc[_0x070e('0x2d')][_0x070e('0x34')]);_0x497f58[_0x070e('0x35')]=qs[_0x070e('0x2e')](_['pick'](_0x1743cc[_0x070e('0x2d')],_0x374c54[_0x070e('0x2e')]),_0x1d72d6);if(_0x1743cc['query'][_0x070e('0x36')]){_0x497f58[_0x070e('0x35')]=_['merge'](_0x497f58['where'],{'$or':_['map'](_0x1d72d6,function(_0x363bff){if(_0x363bff[_0x070e('0x37')]!==_0x070e('0x38')){var _0x334733={};_0x334733[_0x363bff[_0x070e('0x39')]]={'$like':'%'+_0x1743cc['query'][_0x070e('0x36')]+'%'};return _0x334733;}})});}_0x497f58=_[_0x070e('0x3a')]({},_0x497f58,_0x1743cc[_0x070e('0x3b')]);var _0x487276={'where':_0x497f58[_0x070e('0x35')]};return db[_0x070e('0x27')][_0x070e('0x3c')](_0x487276)['then'](function(_0x13982f){_0x219e48[_0x070e('0x3c')]=_0x13982f;if(_0x1743cc['query'][_0x070e('0x3d')]){_0x497f58['include']=[{'all':!![]}];}return db[_0x070e('0x27')][_0x070e('0x3e')](_0x497f58);})[_0x070e('0x20')](function(_0x30319c){_0x219e48[_0x070e('0x3f')]=_0x30319c;return _0x219e48;})['then'](respondWithFilteredResult(_0x4763c6,_0x497f58))[_0x070e('0x40')](handleError(_0x4763c6,null));};exports['show']=function(_0x5bd39a,_0x398168){var _0x42c448={'raw':!![],'where':{'id':_0x5bd39a['params']['id']}},_0x38879f={};_0x38879f[_0x070e('0x2b')]=_[_0x070e('0x2c')](db[_0x070e('0x27')][_0x070e('0x28')]);_0x38879f['query']=_[_0x070e('0x2c')](_0x5bd39a['query']);_0x38879f['filters']=_['intersection'](_0x38879f[_0x070e('0x2b')],_0x38879f[_0x070e('0x2d')]);_0x42c448[_0x070e('0x2f')]=_[_0x070e('0x30')](_0x38879f[_0x070e('0x2b')],qs['fields'](_0x5bd39a[_0x070e('0x2d')]['fields']));_0x42c448[_0x070e('0x2f')]=_0x42c448[_0x070e('0x2f')][_0x070e('0x31')]?_0x42c448['attributes']:_0x38879f['model'];if(_0x5bd39a[_0x070e('0x2d')]['includeAll']){_0x42c448[_0x070e('0x41')]=[{'all':!![]}];}_0x42c448=_[_0x070e('0x3a')]({},_0x42c448,_0x5bd39a[_0x070e('0x3b')]);return db['SmsTransferReport'][_0x070e('0x42')](_0x42c448)[_0x070e('0x20')](handleEntityNotFound(_0x398168,null))['then'](respondWithResult(_0x398168,null))['catch'](handleError(_0x398168,null));};exports[_0x070e('0x43')]=function(_0x945901,_0x2d43ce){return db[_0x070e('0x27')][_0x070e('0x43')](_0x945901['body'],{})[_0x070e('0x20')](respondWithResult(_0x2d43ce,0xc9))[_0x070e('0x40')](handleError(_0x2d43ce,null));};exports[_0x070e('0x1f')]=function(_0x391dee,_0x79eaa0){if(_0x391dee[_0x070e('0x44')]['id']){delete _0x391dee[_0x070e('0x44')]['id'];}return db[_0x070e('0x27')][_0x070e('0x42')]({'where':{'id':_0x391dee[_0x070e('0x45')]['id']}})[_0x070e('0x20')](handleEntityNotFound(_0x79eaa0,null))[_0x070e('0x20')](saveUpdates(_0x391dee[_0x070e('0x44')],null))[_0x070e('0x20')](respondWithResult(_0x79eaa0,null))[_0x070e('0x40')](handleError(_0x79eaa0,null));};exports['destroy']=function(_0x171621,_0xa7a41b){return db[_0x070e('0x27')][_0x070e('0x42')]({'where':{'id':_0x171621[_0x070e('0x45')]['id']}})[_0x070e('0x20')](handleEntityNotFound(_0xa7a41b,null))[_0x070e('0x20')](removeEntity(_0xa7a41b,null))[_0x070e('0x40')](handleError(_0xa7a41b,null));};exports[_0x070e('0x46')]=function(_0x5744c5,_0x251696){return db['SmsTransferReport'][_0x070e('0x46')]()[_0x070e('0x20')](respondWithResult(_0x251696,null))['catch'](handleError(_0x251696,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 1c945dd..91f80f6 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 _0x5334=['api','moment','request-promise','rimraf','../../config/environment','uniqueid','lodash','util','../../config/logger'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0x5334,0x84));var _0x4533=function(_0x2cf24e,_0x41c166){_0x2cf24e=_0x2cf24e-0x0;var _0x5a9c66=_0x5334[_0x2cf24e];return _0x5a9c66;};'use strict';var _=require(_0x4533('0x0'));var util=require(_0x4533('0x1'));var logger=require(_0x4533('0x2'))(_0x4533('0x3'));var moment=require(_0x4533('0x4'));var BPromise=require('bluebird');var rp=require(_0x4533('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4533('0x6'));var config=require(_0x4533('0x7'));var attributes=require('./smsTransferReport.attributes');module['exports']=function(_0x51b4ce,_0x201673){return _0x51b4ce['define']('SmsTransferReport',attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':_0x4533('0x8'),'fields':[_0x4533('0x8')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xabce=['path','rimraf','../../config/environment','define','report_sms_transfer','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0x4c6910,_0x3dc234){var _0x4a660e=function(_0x784563){while(--_0x784563){_0x4c6910['push'](_0x4c6910['shift']());}};_0x4a660e(++_0x3dc234);}(_0xabce,0x103));var _0xeabc=function(_0x3826ad,_0x49a30d){_0x3826ad=_0x3826ad-0x0;var _0x17b900=_0xabce[_0x3826ad];return _0x17b900;};'use strict';var _=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var logger=require(_0xeabc('0x2'))(_0xeabc('0x3'));var moment=require(_0xeabc('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xeabc('0x5'));var rimraf=require(_0xeabc('0x6'));var config=require(_0xeabc('0x7'));var attributes=require('./smsTransferReport.attributes');module['exports']=function(_0x1b07a8,_0x52a4d7){return _0x1b07a8[_0xeabc('0x8')]('SmsTransferReport',attributes,{'tableName':_0xeabc('0x9'),'paranoid':![],'indexes':[{'name':_0xeabc('0xa'),'fields':[_0xeabc('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index a30f8c6..e7cee2b 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 _0x740e=['stringify','error','code','message','result','catch','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x2b309b,_0x58b4ed){var _0x2739b4=function(_0x1b418a){while(--_0x1b418a){_0x2b309b['push'](_0x2b309b['shift']());}};_0x2739b4(++_0x58b4ed);}(_0x740e,0x1ea));var _0xe740=function(_0x489cb5,_0x5d2b4f){_0x489cb5=_0x489cb5-0x0;var _0x5cb56b=_0x740e[_0x489cb5];return _0x5cb56b;};'use strict';var _=require('lodash');var util=require(_0xe740('0x0'));var moment=require('moment');var BPromise=require(_0xe740('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe740('0x2'));var db=require(_0xe740('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xe740('0x4'))(_0xe740('0x5'));var config=require(_0xe740('0x6'));var jayson=require(_0xe740('0x7'));var client=jayson[_0xe740('0x8')][_0xe740('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x479cd7,_0x376fc6,_0x520cd9){return new BPromise(function(_0x2e1061,_0xce3189){return client[_0xe740('0xa')](_0x479cd7,_0x520cd9)[_0xe740('0xb')](function(_0x4c8daf){logger[_0xe740('0xc')](_0xe740('0xd'),_0x376fc6,_0xe740('0xe'));logger[_0xe740('0xf')]('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0x376fc6,_0xe740('0xe'),JSON[_0xe740('0x10')](_0x4c8daf));if(_0x4c8daf[_0xe740('0x11')]){if(_0x4c8daf[_0xe740('0x11')][_0xe740('0x12')]===0x1f4){logger[_0xe740('0x11')](_0xe740('0xd'),_0x376fc6,_0x4c8daf[_0xe740('0x11')]['message']);return _0xce3189(_0x4c8daf['error'][_0xe740('0x13')]);}logger[_0xe740('0x11')](_0xe740('0xd'),_0x376fc6,_0x4c8daf[_0xe740('0x11')]['message']);return _0x2e1061(_0x4c8daf['error'][_0xe740('0x13')]);}else{logger['info'](_0xe740('0xd'),_0x376fc6,_0xe740('0xe'));_0x2e1061(_0x4c8daf[_0xe740('0x14')][_0xe740('0x13')]);}})[_0xe740('0x15')](function(_0xd7e9fb){logger[_0xe740('0x11')](_0xe740('0xd'),_0x376fc6,_0xd7e9fb);_0xce3189(_0xd7e9fb);});});} \ No newline at end of file +var _0xa8ba=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','util','moment'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0xa8ba,0x163));var _0xaa8b=function(_0x3cd0b9,_0x47c1f2){_0x3cd0b9=_0x3cd0b9-0x0;var _0x2ab9d6=_0xa8ba[_0x3cd0b9];return _0x2ab9d6;};'use strict';var _=require('lodash');var util=require(_0xaa8b('0x0'));var moment=require(_0xaa8b('0x1'));var BPromise=require(_0xaa8b('0x2'));var rs=require(_0xaa8b('0x3'));var fs=require('fs');var Redis=require(_0xaa8b('0x4'));var db=require(_0xaa8b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xaa8b('0x6'))(_0xaa8b('0x7'));var config=require(_0xaa8b('0x8'));var jayson=require(_0xaa8b('0x9'));var client=jayson[_0xaa8b('0xa')][_0xaa8b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xae4e74,_0x3765f7,_0x40dbdc){return new BPromise(function(_0x27e3c4,_0x438432){return client['request'](_0xae4e74,_0x40dbdc)['then'](function(_0xc26268){logger[_0xaa8b('0xc')](_0xaa8b('0xd'),_0x3765f7,_0xaa8b('0xe'));logger[_0xaa8b('0xf')]('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0x3765f7,_0xaa8b('0xe'),JSON[_0xaa8b('0x10')](_0xc26268));if(_0xc26268[_0xaa8b('0x11')]){if(_0xc26268['error'][_0xaa8b('0x12')]===0x1f4){logger[_0xaa8b('0x11')](_0xaa8b('0xd'),_0x3765f7,_0xc26268[_0xaa8b('0x11')]['message']);return _0x438432(_0xc26268[_0xaa8b('0x11')][_0xaa8b('0x13')]);}logger['error'](_0xaa8b('0xd'),_0x3765f7,_0xc26268[_0xaa8b('0x11')]['message']);return _0x27e3c4(_0xc26268[_0xaa8b('0x11')][_0xaa8b('0x13')]);}else{logger[_0xaa8b('0xc')](_0xaa8b('0xd'),_0x3765f7,'request\x20sent');_0x27e3c4(_0xc26268[_0xaa8b('0x14')][_0xaa8b('0x13')]);}})['catch'](function(_0x354b43){logger[_0xaa8b('0x11')]('SmsTransferReport,\x20%s,\x20%s',_0x3765f7,_0x354b43);_0x438432(_0x354b43);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 5869f36..a1e565d 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 _0xa3b9=['path','express','../../components/auth/service','../../components/interaction/service','./sound.controller','isAuthenticated','get','/:id','show','/:id/download','diskStorage','join','root','server/files/sounds/original/','originalname','replace','format','%s-%s%s','extname','now','post','single','file','create','put','update','exports','util'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0xa3b9,0xfb));var _0x9a3b=function(_0x5e688a,_0x3c521e){_0x5e688a=_0x5e688a-0x0;var _0x487b76=_0xa3b9[_0x5e688a];return _0x487b76;};'use strict';var multer=require('multer');var util=require(_0x9a3b('0x0'));var path=require(_0x9a3b('0x1'));var timeout=require('connect-timeout');var express=require(_0x9a3b('0x2'));var router=express['Router']();var auth=require(_0x9a3b('0x3'));var interaction=require(_0x9a3b('0x4'));var config=require('../../config/environment');var controller=require(_0x9a3b('0x5'));router['get']('/',auth[_0x9a3b('0x6')](),controller['index']);router[_0x9a3b('0x7')](_0x9a3b('0x8'),auth[_0x9a3b('0x6')](),controller[_0x9a3b('0x9')]);router[_0x9a3b('0x7')](_0x9a3b('0xa'),auth[_0x9a3b('0x6')](),controller['download']);var upload=multer({'storage':multer[_0x9a3b('0xb')]({'destination':function(_0x3df0ac,_0x4f2b8c,_0x114d2d){_0x114d2d(null,path[_0x9a3b('0xc')](config[_0x9a3b('0xd')],_0x9a3b('0xe')));},'filename':function(_0x299cd0,_0x580b65,_0x2b74ff){_0x580b65[_0x9a3b('0xf')]=_0x580b65['originalname'][_0x9a3b('0x10')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x2b74ff(null,util[_0x9a3b('0x11')](_0x9a3b('0x12'),path['basename'](_0x580b65[_0x9a3b('0xf')],path[_0x9a3b('0x13')](_0x580b65[_0x9a3b('0xf')])),Date[_0x9a3b('0x14')](),path[_0x9a3b('0x13')](_0x580b65[_0x9a3b('0xf')])));}})});router[_0x9a3b('0x15')]('/',upload[_0x9a3b('0x16')](_0x9a3b('0x17')),controller[_0x9a3b('0x18')]);router[_0x9a3b('0x19')](_0x9a3b('0x8'),auth[_0x9a3b('0x6')](),controller[_0x9a3b('0x1a')]);router['delete'](_0x9a3b('0x8'),auth['isAuthenticated'](),controller['delete']);module[_0x9a3b('0x1b')]=router; \ No newline at end of file +var _0xb187=['express','../../components/interaction/service','./sound.controller','get','isAuthenticated','index','/:id','/:id/download','download','diskStorage','root','server/files/sounds/original/','originalname','replace','format','%s-%s%s','extname','now','single','file','put','update','delete','multer','util','connect-timeout'];(function(_0xaa176a,_0x4570d6){var _0xc0388b=function(_0x4e3460){while(--_0x4e3460){_0xaa176a['push'](_0xaa176a['shift']());}};_0xc0388b(++_0x4570d6);}(_0xb187,0x19d));var _0x7b18=function(_0x4bfe08,_0x48ae7b){_0x4bfe08=_0x4bfe08-0x0;var _0x1f9125=_0xb187[_0x4bfe08];return _0x1f9125;};'use strict';var multer=require(_0x7b18('0x0'));var util=require(_0x7b18('0x1'));var path=require('path');var timeout=require(_0x7b18('0x2'));var express=require(_0x7b18('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x7b18('0x4'));var config=require('../../config/environment');var controller=require(_0x7b18('0x5'));router[_0x7b18('0x6')]('/',auth[_0x7b18('0x7')](),controller[_0x7b18('0x8')]);router[_0x7b18('0x6')](_0x7b18('0x9'),auth[_0x7b18('0x7')](),controller['show']);router[_0x7b18('0x6')](_0x7b18('0xa'),auth[_0x7b18('0x7')](),controller[_0x7b18('0xb')]);var upload=multer({'storage':multer[_0x7b18('0xc')]({'destination':function(_0x480004,_0x3bb6ec,_0x28911b){_0x28911b(null,path['join'](config[_0x7b18('0xd')],_0x7b18('0xe')));},'filename':function(_0x56b31f,_0xb5288c,_0x1997b3){_0xb5288c[_0x7b18('0xf')]=_0xb5288c['originalname'][_0x7b18('0x10')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x1997b3(null,util[_0x7b18('0x11')](_0x7b18('0x12'),path['basename'](_0xb5288c[_0x7b18('0xf')],path[_0x7b18('0x13')](_0xb5288c[_0x7b18('0xf')])),Date[_0x7b18('0x14')](),path[_0x7b18('0x13')](_0xb5288c[_0x7b18('0xf')])));}})});router['post']('/',upload[_0x7b18('0x15')](_0x7b18('0x16')),controller['create']);router[_0x7b18('0x17')]('/:id',auth['isAuthenticated'](),controller[_0x7b18('0x18')]);router[_0x7b18('0x19')](_0x7b18('0x9'),auth[_0x7b18('0x7')](),controller[_0x7b18('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index b25c63d..2649665 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 _0x9b13=['sequelize','STRING','name','BIGINT','INTEGER','FLOAT'];(function(_0x1f8dab,_0x1a3a74){var _0x1c163c=function(_0x4a9ab0){while(--_0x4a9ab0){_0x1f8dab['push'](_0x1f8dab['shift']());}};_0x1c163c(++_0x1a3a74);}(_0x9b13,0xde));var _0x39b1=function(_0x3446d9,_0x3f06a1){_0x3446d9=_0x3446d9-0x0;var _0x556541=_0x9b13[_0x3446d9];return _0x556541;};'use strict';var Sequelize=require(_0x39b1('0x0'));module['exports']={'name':{'type':Sequelize[_0x39b1('0x1')],'unique':_0x39b1('0x2'),'allowNull':![]},'save_name':{'type':Sequelize[_0x39b1('0x1')]},'display_name':{'type':Sequelize[_0x39b1('0x1')],'defaultValue':''},'description':{'type':Sequelize[_0x39b1('0x1')]},'original_format':{'type':Sequelize['STRING']},'original_duration':{'type':Sequelize['FLOAT']},'original_sampleCount':{'type':Sequelize[_0x39b1('0x3')]},'original_channelCount':{'type':Sequelize[_0x39b1('0x4')]},'original_bitRate':{'type':Sequelize[_0x39b1('0x3')]},'original_sampleRate':{'type':Sequelize['INTEGER']},'converted_format':{'type':Sequelize[_0x39b1('0x1')]},'converted_duration':{'type':Sequelize[_0x39b1('0x5')]},'converted_sampleCount':{'type':Sequelize[_0x39b1('0x3')]},'converted_channelCount':{'type':Sequelize['INTEGER']},'converted_bitRate':{'type':Sequelize[_0x39b1('0x3')]},'converted_sampleRate':{'type':Sequelize[_0x39b1('0x4')]}}; \ No newline at end of file +var _0x4bc6=['name','FLOAT','BIGINT','INTEGER','exports','STRING'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x4bc6,0xf4));var _0x64bc=function(_0x411017,_0x4a8117){_0x411017=_0x411017-0x0;var _0x2adeea=_0x4bc6[_0x411017];return _0x2adeea;};'use strict';var Sequelize=require('sequelize');module[_0x64bc('0x0')]={'name':{'type':Sequelize[_0x64bc('0x1')],'unique':_0x64bc('0x2'),'allowNull':![]},'save_name':{'type':Sequelize['STRING']},'display_name':{'type':Sequelize[_0x64bc('0x1')],'defaultValue':''},'description':{'type':Sequelize[_0x64bc('0x1')]},'original_format':{'type':Sequelize['STRING']},'original_duration':{'type':Sequelize[_0x64bc('0x3')]},'original_sampleCount':{'type':Sequelize[_0x64bc('0x4')]},'original_channelCount':{'type':Sequelize[_0x64bc('0x5')]},'original_bitRate':{'type':Sequelize[_0x64bc('0x4')]},'original_sampleRate':{'type':Sequelize[_0x64bc('0x5')]},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize[_0x64bc('0x3')]},'converted_sampleCount':{'type':Sequelize[_0x64bc('0x4')]},'converted_channelCount':{'type':Sequelize[_0x64bc('0x5')]},'converted_bitRate':{'type':Sequelize[_0x64bc('0x4')]},'converted_sampleRate':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 0177923..138eb4f 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 _0xe17d=['../../config/utils','sendStatus','end','count','offset','status','Content-Range','json','apply','save','update','destroy','get','Sounds','UserProfileResource','then','error','name','send','Sound','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','filters','filter','map','type','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','options','find','download','save_name','converted_format','existsSync','join','root','Sequelize','Sound\x20not\x20found','%s.%s','format','basename','file','originalname','extname','filename','substring','server/files/sounds/original','server/files/sounds/converted','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','wav','unlinkSync','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','role','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','create','description','delete','original_format','html-pdf','rimraf','request-promise','moment','bluebird','mustache','util','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(_0x168127,_0x59cea1){var _0x4c99ad=function(_0x4ab3f2){while(--_0x4ab3f2){_0x168127['push'](_0x168127['shift']());}};_0x4c99ad(++_0x59cea1);}(_0xe17d,0x164));var _0xde17=function(_0x52012c,_0x5866d4){_0x52012c=_0x52012c-0x0;var _0x38928e=_0xe17d[_0x52012c];return _0x38928e;};'use strict';var pdf=require(_0xde17('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xde17('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xde17('0x2'));var moment=require(_0xde17('0x3'));var BPromise=require(_0xde17('0x4'));var Mustache=require(_0xde17('0x5'));var util=require(_0xde17('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xde17('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xde17('0x8'));var squel=require(_0xde17('0x9'));var crypto=require(_0xde17('0xa'));var jsforce=require(_0xde17('0xb'));var deskjs=require(_0xde17('0xc'));var toCsv=require(_0xde17('0x7'));var querystring=require(_0xde17('0xd'));var Papa=require(_0xde17('0xe'));var Redis=require(_0xde17('0xf'));var authService=require(_0xde17('0x10'));var qs=require(_0xde17('0x11'));var as=require(_0xde17('0x12'));var hardwareService=require(_0xde17('0x13'));var logger=require(_0xde17('0x14'))(_0xde17('0x15'));var utils=require(_0xde17('0x16'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x43e8b9,_0x4c3074){_0x4c3074=_0x4c3074||0xcc;return function(_0x2df188){if(_0x2df188){return _0x43e8b9[_0xde17('0x17')](_0x4c3074);}return _0x43e8b9['status'](_0x4c3074)[_0xde17('0x18')]();};}function respondWithResult(_0x2a678,_0x34913d){_0x34913d=_0x34913d||0xc8;return function(_0x59e935){if(_0x59e935){return _0x2a678['status'](_0x34913d)['json'](_0x59e935);}};}function respondWithFilteredResult(_0x27c74c,_0x9c5ea5){return function(_0x562fdf){if(_0x562fdf){var _0x3f355c=_0x562fdf[_0xde17('0x19')],_0x26f2af=_0x9c5ea5[_0xde17('0x1a')],_0x5bfedb=_0x9c5ea5['offset']+_0x9c5ea5['limit'],_0x4dc73d;if(_0x5bfedb>=_0x3f355c){_0x5bfedb=_0x3f355c;_0x4dc73d=0xc8;}else{_0x4dc73d=0xce;}_0x27c74c[_0xde17('0x1b')](_0x4dc73d);return _0x27c74c['set'](_0xde17('0x1c'),_0x26f2af+'-'+_0x5bfedb+'/'+_0x3f355c)[_0xde17('0x1d')](_0x562fdf);}return null;};}function patchUpdates(_0x184ba0){return function(_0x38956f){try{jsonpatch[_0xde17('0x1e')](_0x38956f,_0x184ba0,!![]);}catch(_0x596679){return BPromise['reject'](_0x596679);}return _0x38956f[_0xde17('0x1f')]();};}function saveUpdates(_0x361402,_0x517cd5){return function(_0x3b89a1){if(_0x3b89a1){return _0x3b89a1[_0xde17('0x20')](_0x361402)['then'](function(_0x4e1cdf){return _0x4e1cdf;});}return null;};}function removeEntity(_0x3cf8f1,_0x63aaff){return function(_0x436844){if(_0x436844){return _0x436844[_0xde17('0x21')]()['then'](function(){var _0x16f89d=_0x436844[_0xde17('0x22')]({'plain':!![]});var _0xf2b24d=_0xde17('0x23');return db[_0xde17('0x24')][_0xde17('0x21')]({'where':{'type':_0xf2b24d,'resourceId':_0x16f89d['id']}})[_0xde17('0x25')](function(){return _0x436844;});})[_0xde17('0x25')](function(){_0x3cf8f1[_0xde17('0x1b')](0xcc)[_0xde17('0x18')]();});}};}function handleEntityNotFound(_0x44d94e,_0x57c7e8){return function(_0x30d4ce){if(!_0x30d4ce){_0x44d94e[_0xde17('0x17')](0x194);}return _0x30d4ce;};}function handleError(_0x3f0443,_0x3e0aa3){_0x3e0aa3=_0x3e0aa3||0x1f4;return function(_0x1cd2b9){logger[_0xde17('0x26')](_0x1cd2b9['stack']);if(_0x1cd2b9[_0xde17('0x27')]){delete _0x1cd2b9[_0xde17('0x27')];}_0x3f0443[_0xde17('0x1b')](_0x3e0aa3)[_0xde17('0x28')](_0x1cd2b9);};}exports['index']=function(_0x30dbfc,_0x1216f4){var _0x23c262={},_0x2ede7b={},_0x5dd0fa={'count':0x0,'rows':[]};var _0x3dd6a3=_['map'](db[_0xde17('0x29')][_0xde17('0x2a')],function(_0x2f6e9f){return{'name':_0x2f6e9f[_0xde17('0x2b')],'type':_0x2f6e9f['type'][_0xde17('0x2c')]};});_0x2ede7b[_0xde17('0x2d')]=_['map'](_0x3dd6a3,_0xde17('0x27'));_0x2ede7b[_0xde17('0x2e')]=_[_0xde17('0x2f')](_0x30dbfc[_0xde17('0x2e')]);_0x2ede7b['filters']=_[_0xde17('0x30')](_0x2ede7b['model'],_0x2ede7b[_0xde17('0x2e')]);_0x23c262[_0xde17('0x31')]=_[_0xde17('0x30')](_0x2ede7b[_0xde17('0x2d')],qs[_0xde17('0x32')](_0x30dbfc[_0xde17('0x2e')]['fields']));_0x23c262[_0xde17('0x31')]=_0x23c262[_0xde17('0x31')][_0xde17('0x33')]?_0x23c262[_0xde17('0x31')]:_0x2ede7b[_0xde17('0x2d')];if(!_0x30dbfc[_0xde17('0x2e')][_0xde17('0x34')]('nolimit')){_0x23c262[_0xde17('0x35')]=qs[_0xde17('0x35')](_0x30dbfc['query'][_0xde17('0x35')]);_0x23c262['offset']=qs[_0xde17('0x1a')](_0x30dbfc['query'][_0xde17('0x1a')]);}_0x23c262[_0xde17('0x36')]=qs[_0xde17('0x37')](_0x30dbfc[_0xde17('0x2e')][_0xde17('0x37')]);_0x23c262[_0xde17('0x38')]=qs['filters'](_[_0xde17('0x39')](_0x30dbfc['query'],_0x2ede7b[_0xde17('0x3a')]),_0x3dd6a3);if(_0x30dbfc[_0xde17('0x2e')][_0xde17('0x3b')]){_0x23c262[_0xde17('0x38')]=_['merge'](_0x23c262['where'],{'$or':_[_0xde17('0x3c')](_0x3dd6a3,function(_0x4487cc){if(_0x4487cc[_0xde17('0x3d')]!==_0xde17('0x3e')){var _0x2d1b64={};_0x2d1b64[_0x4487cc[_0xde17('0x27')]]={'$like':'%'+_0x30dbfc[_0xde17('0x2e')][_0xde17('0x3b')]+'%'};return _0x2d1b64;}})});}_0x23c262=_[_0xde17('0x3f')]({},_0x23c262,_0x30dbfc['options']);var _0x37496={'where':_0x23c262['where']};return db[_0xde17('0x29')][_0xde17('0x19')](_0x37496)['then'](function(_0x550e86){_0x5dd0fa[_0xde17('0x19')]=_0x550e86;if(_0x30dbfc[_0xde17('0x2e')][_0xde17('0x40')]){_0x23c262[_0xde17('0x41')]=[{'all':!![]}];}return db[_0xde17('0x29')][_0xde17('0x42')](_0x23c262);})[_0xde17('0x25')](function(_0x29bc41){_0x5dd0fa[_0xde17('0x43')]=_0x29bc41;return _0x5dd0fa;})['then'](respondWithFilteredResult(_0x1216f4,_0x23c262))[_0xde17('0x44')](handleError(_0x1216f4,null));};exports[_0xde17('0x45')]=function(_0x536656,_0x30e1b6){var _0x34ccaa={'raw':!![],'where':{'id':_0x536656[_0xde17('0x46')]['id']}},_0x803974={};_0x803974[_0xde17('0x2d')]=_[_0xde17('0x2f')](db[_0xde17('0x29')][_0xde17('0x2a')]);_0x803974['query']=_[_0xde17('0x2f')](_0x536656[_0xde17('0x2e')]);_0x803974[_0xde17('0x3a')]=_[_0xde17('0x30')](_0x803974[_0xde17('0x2d')],_0x803974['query']);_0x34ccaa[_0xde17('0x31')]=_[_0xde17('0x30')](_0x803974[_0xde17('0x2d')],qs[_0xde17('0x32')](_0x536656['query']['fields']));_0x34ccaa[_0xde17('0x31')]=_0x34ccaa[_0xde17('0x31')][_0xde17('0x33')]?_0x34ccaa[_0xde17('0x31')]:_0x803974[_0xde17('0x2d')];if(_0x536656[_0xde17('0x2e')][_0xde17('0x40')]){_0x34ccaa['include']=[{'all':!![]}];}_0x34ccaa=_['merge']({},_0x34ccaa,_0x536656[_0xde17('0x47')]);return db[_0xde17('0x29')][_0xde17('0x48')](_0x34ccaa)[_0xde17('0x25')](handleEntityNotFound(_0x30e1b6,null))['then'](respondWithResult(_0x30e1b6,null))[_0xde17('0x44')](handleError(_0x30e1b6,null));};exports[_0xde17('0x49')]=function(_0x2fc9f9,_0x330ff1,_0x8640d1){return db[_0xde17('0x29')][_0xde17('0x48')]({'where':{'id':_0x2fc9f9[_0xde17('0x46')]['id']},'attributes':['name',_0xde17('0x4a'),_0xde17('0x4b')],'raw':!![]})[_0xde17('0x25')](handleEntityNotFound(_0x330ff1,null))[_0xde17('0x25')](function(_0x307b49){if(_0x307b49){if(!fs[_0xde17('0x4c')](path[_0xde17('0x4d')](config[_0xde17('0x4e')],'server/files/sounds/converted',_0x307b49[_0xde17('0x4a')]+'.'+_0x307b49[_0xde17('0x4b')]))){throw new db[(_0xde17('0x4f'))]['ValidationError'](_0xde17('0x50'));}return _0x330ff1[_0xde17('0x49')](path[_0xde17('0x4d')](config[_0xde17('0x4e')],'server/files/sounds/converted',util['format'](_0xde17('0x51'),_0x307b49['save_name'],_0x307b49[_0xde17('0x4b')])),util[_0xde17('0x52')](_0xde17('0x51'),_0x307b49['name'],_0x307b49[_0xde17('0x4b')]));}return null;})[_0xde17('0x44')](handleError(_0x330ff1,null));};exports['create']=function(_0x4dabe3,_0xddd8fb,_0x12039e){var _0x58dd54={'name':path[_0xde17('0x53')](_0x4dabe3[_0xde17('0x54')][_0xde17('0x55')],path[_0xde17('0x56')](_0x4dabe3[_0xde17('0x54')]['originalname'])),'save_name':path[_0xde17('0x53')](_0x4dabe3[_0xde17('0x54')][_0xde17('0x57')],path[_0xde17('0x56')](_0x4dabe3[_0xde17('0x54')][_0xde17('0x57')])),'original_format':path[_0xde17('0x56')](_0x4dabe3[_0xde17('0x54')][_0xde17('0x55')])[_0xde17('0x58')](0x1),'converted_format':'wav'};var _0x4c3e48=path['join'](config[_0xde17('0x4e')],_0xde17('0x59'),_0x4dabe3[_0xde17('0x54')][_0xde17('0x57')]);var _0x5966aa=path['join'](config[_0xde17('0x4e')],_0xde17('0x5a'),util[_0xde17('0x52')]('%s.%s',path[_0xde17('0x53')](_0x4dabe3['file'][_0xde17('0x57')],path[_0xde17('0x56')](_0x4dabe3[_0xde17('0x54')][_0xde17('0x57')])),_0x58dd54[_0xde17('0x4b')]));logger[_0xde17('0x5b')](_0xde17('0x5c'),_0x4c3e48);logger['info'](_0xde17('0x5d'),_0x5966aa);try{fs[_0xde17('0x5e')](_0x4c3e48,parseInt(_0xde17('0x5f'),0x8));var _0x47031e=sox['transcode'](_0x4c3e48,_0x5966aa,{'sampleRate':0x1f40,'format':_0xde17('0x60'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x47031e['on'](_0xde17('0x26'),function(_0x5f1df9){fs[_0xde17('0x61')](_0x4c3e48);_0xddd8fb['status'](0x1f4)['send'](_0x5f1df9);});_0x47031e['on'](_0xde17('0x62'),function(_0x26e346){_0x58dd54[_0xde17('0x63')]=isNaN(_0x26e346[_0xde17('0x64')])?null:_0x26e346['duration']*0x3e8;_0x58dd54[_0xde17('0x65')]=isNaN(_0x26e346[_0xde17('0x66')])?null:_0x26e346['sampleCount'];_0x58dd54[_0xde17('0x67')]=isNaN(_0x26e346[_0xde17('0x68')])?null:_0x26e346[_0xde17('0x68')];_0x58dd54[_0xde17('0x69')]=isNaN(_0x26e346[_0xde17('0x6a')])?null:_0x26e346[_0xde17('0x6a')];_0x58dd54[_0xde17('0x6b')]=isNaN(_0x26e346[_0xde17('0x6c')])?null:_0x26e346[_0xde17('0x6c')];});_0x47031e['on'](_0xde17('0x6d'),function(_0x3290ef){_0x58dd54[_0xde17('0x6e')]=isNaN(_0x3290ef[_0xde17('0x64')])?null:_0x3290ef[_0xde17('0x64')]*0x3e8;_0x58dd54[_0xde17('0x6f')]=isNaN(_0x3290ef[_0xde17('0x66')])?null:_0x3290ef['sampleCount'];_0x58dd54[_0xde17('0x70')]=isNaN(_0x3290ef[_0xde17('0x68')])?null:_0x3290ef[_0xde17('0x68')];_0x58dd54[_0xde17('0x71')]=isNaN(_0x3290ef[_0xde17('0x6a')])?null:_0x3290ef[_0xde17('0x6a')];_0x58dd54[_0xde17('0x72')]=isNaN(_0x3290ef[_0xde17('0x6c')])?null:_0x3290ef['sampleRate'];});_0x47031e['on']('end',function(){fs[_0xde17('0x5e')](_0x5966aa,parseInt(_0xde17('0x5f'),0x8));return db[_0xde17('0x29')]['create'](_0x58dd54)[_0xde17('0x25')](function(_0x45260d){var _0x2d3c24={'role':_0x4dabe3['body'][_0xde17('0x73')],'userProfileId':_0x4dabe3[_0xde17('0x74')][_0xde17('0x75')]};if(!_0x2d3c24)throw new Error(_0xde17('0x76'));if(_0x2d3c24['role']===_0xde17('0x77')){var _0x1c97e7=_0x45260d[_0xde17('0x22')]({'plain':!![]});return db[_0xde17('0x78')]['find']({'where':{'name':_0xde17('0x23'),'userProfileId':_0x2d3c24[_0xde17('0x75')]},'raw':!![]})[_0xde17('0x25')](function(_0x4e7699){if(_0x4e7699&&_0x4e7699[_0xde17('0x79')]===0x0){return db['UserProfileResource'][_0xde17('0x7a')]({'name':_0x1c97e7[_0xde17('0x27')],'resourceId':_0x1c97e7['id'],'type':_0x4e7699[_0xde17('0x27')],'sectionId':_0x4e7699['id']},{})['then'](function(){return _0x45260d;});}else{return _0x45260d;}})[_0xde17('0x44')](function(_0x3128c4){logger[_0xde17('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3128c4);throw _0x3128c4;});}return _0x45260d;})[_0xde17('0x25')](respondWithResult(_0xddd8fb,null))['catch'](handleError(_0xddd8fb,null));});_0x47031e['start']();}catch(_0x3a12d7){_0xddd8fb['status'](0x1f4)[_0xde17('0x28')](_0x3a12d7);}};exports[_0xde17('0x20')]=function(_0x1a72aa,_0x5711ca,_0x2826aa){return db['Sound'][_0xde17('0x48')]({'where':{'id':_0x1a72aa[_0xde17('0x46')]['id']}})['then'](handleEntityNotFound(_0x5711ca,null))[_0xde17('0x25')](saveUpdates(_[_0xde17('0x39')](_0x1a72aa[_0xde17('0x74')],[_0xde17('0x27'),_0xde17('0x7b')]),null))[_0xde17('0x25')](respondWithResult(_0x5711ca,null))['catch'](handleError(_0x5711ca,null));};exports[_0xde17('0x7c')]=function(_0xc49568,_0x39a5f3,_0x290d46){return db[_0xde17('0x29')][_0xde17('0x48')]({'where':{'id':_0xc49568['params']['id']}})[_0xde17('0x25')](function(_0x3e44c2){if(_0x3e44c2){return _0x3e44c2[_0xde17('0x21')]();}})[_0xde17('0x25')](function(_0x49f975){var _0x32ea08=path[_0xde17('0x4d')](config[_0xde17('0x4e')],'server/files/sounds/original',util[_0xde17('0x52')](_0xde17('0x51'),_0x49f975['save_name'],_0x49f975[_0xde17('0x7d')]));var _0x5886bb=path[_0xde17('0x4d')](config[_0xde17('0x4e')],_0xde17('0x5a'),util[_0xde17('0x52')](_0xde17('0x51'),_0x49f975[_0xde17('0x4a')],_0x49f975[_0xde17('0x4b')]));fs[_0xde17('0x61')](_0x32ea08);fs[_0xde17('0x61')](_0x5886bb);return _0x49f975;})[_0xde17('0x25')](function(_0x274a3d){if(_0x274a3d){return _0x39a5f3['status'](0xcc)['end']();}})[_0xde17('0x25')](handleEntityNotFound(_0x39a5f3,null))[_0xde17('0x44')](handleError(_0x39a5f3,null));}; \ No newline at end of file +var _0x4b26=['../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','update','then','destroy','UserProfileResource','error','stack','name','send','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','Sound','includeAll','findAll','rows','catch','show','params','merge','download','find','existsSync','join','root','server/files/sounds/converted','converted_format','Sequelize','Sound\x20not\x20found','format','%s.%s','save_name','create','basename','originalname','extname','file','filename','substring','wav','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','transcode','src','duration','original_sampleCount','sampleCount','channelCount','bitRate','sampleRate','dest','converted_sampleCount','converted_channelCount','converted_bitRate','converted_sampleRate','chmodSync','0777','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Sounds','autoAssociation','description','delete','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils'];(function(_0x181363,_0x61e873){var _0x4062d5=function(_0x5bc094){while(--_0x5bc094){_0x181363['push'](_0x181363['shift']());}};_0x4062d5(++_0x61e873);}(_0x4b26,0xd7));var _0x64b2=function(_0x2a6895,_0x29b4b4){_0x2a6895=_0x2a6895-0x0;var _0x4854f9=_0x4b26[_0x2a6895];return _0x4854f9;};'use strict';var pdf=require(_0x64b2('0x0'));var emlformat=require(_0x64b2('0x1'));var rimraf=require(_0x64b2('0x2'));var zipdir=require(_0x64b2('0x3'));var jsonpatch=require(_0x64b2('0x4'));var rp=require(_0x64b2('0x5'));var moment=require(_0x64b2('0x6'));var BPromise=require(_0x64b2('0x7'));var Mustache=require(_0x64b2('0x8'));var util=require('util');var path=require(_0x64b2('0x9'));var sox=require(_0x64b2('0xa'));var csv=require(_0x64b2('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x64b2('0xc'));var squel=require(_0x64b2('0xd'));var crypto=require('crypto');var jsforce=require(_0x64b2('0xe'));var deskjs=require(_0x64b2('0xf'));var toCsv=require(_0x64b2('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x64b2('0x10'));var authService=require(_0x64b2('0x11'));var qs=require(_0x64b2('0x12'));var as=require(_0x64b2('0x13'));var hardwareService=require(_0x64b2('0x14'));var logger=require('../../config/logger')(_0x64b2('0x15'));var utils=require(_0x64b2('0x16'));var config=require(_0x64b2('0x17'));var db=require(_0x64b2('0x18'))['db'];function respondWithStatusCode(_0x5e84d7,_0x16a8b2){_0x16a8b2=_0x16a8b2||0xcc;return function(_0x3e7f61){if(_0x3e7f61){return _0x5e84d7[_0x64b2('0x19')](_0x16a8b2);}return _0x5e84d7[_0x64b2('0x1a')](_0x16a8b2)[_0x64b2('0x1b')]();};}function respondWithResult(_0xd50221,_0x20033e){_0x20033e=_0x20033e||0xc8;return function(_0x579f2c){if(_0x579f2c){return _0xd50221[_0x64b2('0x1a')](_0x20033e)[_0x64b2('0x1c')](_0x579f2c);}};}function respondWithFilteredResult(_0x22457e,_0x3c58e9){return function(_0x31615d){if(_0x31615d){var _0x3eccc3=_0x31615d[_0x64b2('0x1d')],_0x184d18=_0x3c58e9[_0x64b2('0x1e')],_0x2c6758=_0x3c58e9[_0x64b2('0x1e')]+_0x3c58e9[_0x64b2('0x1f')],_0x1c0b41;if(_0x2c6758>=_0x3eccc3){_0x2c6758=_0x3eccc3;_0x1c0b41=0xc8;}else{_0x1c0b41=0xce;}_0x22457e['status'](_0x1c0b41);return _0x22457e[_0x64b2('0x20')](_0x64b2('0x21'),_0x184d18+'-'+_0x2c6758+'/'+_0x3eccc3)['json'](_0x31615d);}return null;};}function patchUpdates(_0x64aeb0){return function(_0x18b85e){try{jsonpatch['apply'](_0x18b85e,_0x64aeb0,!![]);}catch(_0x3d0972){return BPromise[_0x64b2('0x22')](_0x3d0972);}return _0x18b85e['save']();};}function saveUpdates(_0x1f4de0,_0x55985c){return function(_0x119728){if(_0x119728){return _0x119728[_0x64b2('0x23')](_0x1f4de0)[_0x64b2('0x24')](function(_0x1c876e){return _0x1c876e;});}return null;};}function removeEntity(_0x2dadc3,_0x232733){return function(_0x2b35c2){if(_0x2b35c2){return _0x2b35c2[_0x64b2('0x25')]()[_0x64b2('0x24')](function(){var _0x40c773=_0x2b35c2['get']({'plain':!![]});var _0x310d9d='Sounds';return db[_0x64b2('0x26')][_0x64b2('0x25')]({'where':{'type':_0x310d9d,'resourceId':_0x40c773['id']}})[_0x64b2('0x24')](function(){return _0x2b35c2;});})[_0x64b2('0x24')](function(){_0x2dadc3[_0x64b2('0x1a')](0xcc)[_0x64b2('0x1b')]();});}};}function handleEntityNotFound(_0x47ffda,_0x1eec61){return function(_0x520795){if(!_0x520795){_0x47ffda['sendStatus'](0x194);}return _0x520795;};}function handleError(_0x4134af,_0x143f48){_0x143f48=_0x143f48||0x1f4;return function(_0x58ba05){logger[_0x64b2('0x27')](_0x58ba05[_0x64b2('0x28')]);if(_0x58ba05[_0x64b2('0x29')]){delete _0x58ba05[_0x64b2('0x29')];}_0x4134af[_0x64b2('0x1a')](_0x143f48)[_0x64b2('0x2a')](_0x58ba05);};}exports['index']=function(_0xeedbd8,_0x29d5a4){var _0x442553={},_0x45fce9={},_0x115957={'count':0x0,'rows':[]};var _0x292dab=_[_0x64b2('0x2b')](db['Sound'][_0x64b2('0x2c')],function(_0x293863){return{'name':_0x293863[_0x64b2('0x2d')],'type':_0x293863[_0x64b2('0x2e')]['key']};});_0x45fce9[_0x64b2('0x2f')]=_[_0x64b2('0x2b')](_0x292dab,_0x64b2('0x29'));_0x45fce9[_0x64b2('0x30')]=_[_0x64b2('0x31')](_0xeedbd8[_0x64b2('0x30')]);_0x45fce9[_0x64b2('0x32')]=_[_0x64b2('0x33')](_0x45fce9[_0x64b2('0x2f')],_0x45fce9[_0x64b2('0x30')]);_0x442553[_0x64b2('0x34')]=_[_0x64b2('0x33')](_0x45fce9[_0x64b2('0x2f')],qs[_0x64b2('0x35')](_0xeedbd8['query'][_0x64b2('0x35')]));_0x442553[_0x64b2('0x34')]=_0x442553[_0x64b2('0x34')][_0x64b2('0x36')]?_0x442553[_0x64b2('0x34')]:_0x45fce9[_0x64b2('0x2f')];if(!_0xeedbd8['query'][_0x64b2('0x37')](_0x64b2('0x38'))){_0x442553['limit']=qs[_0x64b2('0x1f')](_0xeedbd8['query']['limit']);_0x442553['offset']=qs[_0x64b2('0x1e')](_0xeedbd8[_0x64b2('0x30')][_0x64b2('0x1e')]);}_0x442553['order']=qs[_0x64b2('0x39')](_0xeedbd8[_0x64b2('0x30')][_0x64b2('0x39')]);_0x442553[_0x64b2('0x3a')]=qs[_0x64b2('0x32')](_[_0x64b2('0x3b')](_0xeedbd8[_0x64b2('0x30')],_0x45fce9[_0x64b2('0x32')]),_0x292dab);if(_0xeedbd8[_0x64b2('0x30')][_0x64b2('0x3c')]){_0x442553[_0x64b2('0x3a')]=_['merge'](_0x442553['where'],{'$or':_[_0x64b2('0x2b')](_0x292dab,function(_0x4dd3ca){if(_0x4dd3ca[_0x64b2('0x2e')]!==_0x64b2('0x3d')){var _0x575d86={};_0x575d86[_0x4dd3ca[_0x64b2('0x29')]]={'$like':'%'+_0xeedbd8['query'][_0x64b2('0x3c')]+'%'};return _0x575d86;}})});}_0x442553=_['merge']({},_0x442553,_0xeedbd8['options']);var _0xb4d4c5={'where':_0x442553[_0x64b2('0x3a')]};return db[_0x64b2('0x3e')][_0x64b2('0x1d')](_0xb4d4c5)[_0x64b2('0x24')](function(_0x3b4f0a){_0x115957[_0x64b2('0x1d')]=_0x3b4f0a;if(_0xeedbd8[_0x64b2('0x30')][_0x64b2('0x3f')]){_0x442553['include']=[{'all':!![]}];}return db['Sound'][_0x64b2('0x40')](_0x442553);})['then'](function(_0x1dc6b5){_0x115957[_0x64b2('0x41')]=_0x1dc6b5;return _0x115957;})[_0x64b2('0x24')](respondWithFilteredResult(_0x29d5a4,_0x442553))[_0x64b2('0x42')](handleError(_0x29d5a4,null));};exports[_0x64b2('0x43')]=function(_0x2514cd,_0x1ee10e){var _0x14f3a0={'raw':!![],'where':{'id':_0x2514cd[_0x64b2('0x44')]['id']}},_0x5cc5d1={};_0x5cc5d1[_0x64b2('0x2f')]=_[_0x64b2('0x31')](db[_0x64b2('0x3e')][_0x64b2('0x2c')]);_0x5cc5d1[_0x64b2('0x30')]=_[_0x64b2('0x31')](_0x2514cd[_0x64b2('0x30')]);_0x5cc5d1['filters']=_[_0x64b2('0x33')](_0x5cc5d1[_0x64b2('0x2f')],_0x5cc5d1[_0x64b2('0x30')]);_0x14f3a0[_0x64b2('0x34')]=_[_0x64b2('0x33')](_0x5cc5d1['model'],qs[_0x64b2('0x35')](_0x2514cd[_0x64b2('0x30')][_0x64b2('0x35')]));_0x14f3a0[_0x64b2('0x34')]=_0x14f3a0[_0x64b2('0x34')][_0x64b2('0x36')]?_0x14f3a0[_0x64b2('0x34')]:_0x5cc5d1[_0x64b2('0x2f')];if(_0x2514cd[_0x64b2('0x30')][_0x64b2('0x3f')]){_0x14f3a0['include']=[{'all':!![]}];}_0x14f3a0=_[_0x64b2('0x45')]({},_0x14f3a0,_0x2514cd['options']);return db[_0x64b2('0x3e')]['find'](_0x14f3a0)[_0x64b2('0x24')](handleEntityNotFound(_0x1ee10e,null))['then'](respondWithResult(_0x1ee10e,null))[_0x64b2('0x42')](handleError(_0x1ee10e,null));};exports[_0x64b2('0x46')]=function(_0x595d43,_0x459b34,_0x4ce7db){return db[_0x64b2('0x3e')][_0x64b2('0x47')]({'where':{'id':_0x595d43[_0x64b2('0x44')]['id']},'attributes':[_0x64b2('0x29'),'save_name','converted_format'],'raw':!![]})[_0x64b2('0x24')](handleEntityNotFound(_0x459b34,null))['then'](function(_0x2efa7b){if(_0x2efa7b){if(!fs[_0x64b2('0x48')](path[_0x64b2('0x49')](config[_0x64b2('0x4a')],_0x64b2('0x4b'),_0x2efa7b['save_name']+'.'+_0x2efa7b[_0x64b2('0x4c')]))){throw new db[(_0x64b2('0x4d'))]['ValidationError'](_0x64b2('0x4e'));}return _0x459b34['download'](path['join'](config[_0x64b2('0x4a')],_0x64b2('0x4b'),util[_0x64b2('0x4f')](_0x64b2('0x50'),_0x2efa7b[_0x64b2('0x51')],_0x2efa7b[_0x64b2('0x4c')])),util[_0x64b2('0x4f')](_0x64b2('0x50'),_0x2efa7b[_0x64b2('0x29')],_0x2efa7b['converted_format']));}return null;})[_0x64b2('0x42')](handleError(_0x459b34,null));};exports[_0x64b2('0x52')]=function(_0x121609,_0xe10930,_0x84c24f){var _0x3a484f={'name':path[_0x64b2('0x53')](_0x121609['file'][_0x64b2('0x54')],path[_0x64b2('0x55')](_0x121609[_0x64b2('0x56')][_0x64b2('0x54')])),'save_name':path[_0x64b2('0x53')](_0x121609[_0x64b2('0x56')]['filename'],path[_0x64b2('0x55')](_0x121609['file'][_0x64b2('0x57')])),'original_format':path['extname'](_0x121609['file'][_0x64b2('0x54')])[_0x64b2('0x58')](0x1),'converted_format':_0x64b2('0x59')};var _0x2b35d9=path['join'](config[_0x64b2('0x4a')],_0x64b2('0x5a'),_0x121609[_0x64b2('0x56')][_0x64b2('0x57')]);var _0x5c4c38=path[_0x64b2('0x49')](config[_0x64b2('0x4a')],'server/files/sounds/converted',util[_0x64b2('0x4f')](_0x64b2('0x50'),path[_0x64b2('0x53')](_0x121609[_0x64b2('0x56')]['filename'],path[_0x64b2('0x55')](_0x121609['file'][_0x64b2('0x57')])),_0x3a484f['converted_format']));logger[_0x64b2('0x5b')](_0x64b2('0x5c'),_0x2b35d9);logger[_0x64b2('0x5b')](_0x64b2('0x5d'),_0x5c4c38);try{fs['chmodSync'](_0x2b35d9,parseInt('0777',0x8));var _0x17337a=sox[_0x64b2('0x5e')](_0x2b35d9,_0x5c4c38,{'sampleRate':0x1f40,'format':_0x64b2('0x59'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x17337a['on']('error',function(_0x4339a7){fs['unlinkSync'](_0x2b35d9);_0xe10930[_0x64b2('0x1a')](0x1f4)[_0x64b2('0x2a')](_0x4339a7);});_0x17337a['on'](_0x64b2('0x5f'),function(_0x3ce267){_0x3a484f['original_duration']=isNaN(_0x3ce267[_0x64b2('0x60')])?null:_0x3ce267[_0x64b2('0x60')]*0x3e8;_0x3a484f[_0x64b2('0x61')]=isNaN(_0x3ce267['sampleCount'])?null:_0x3ce267[_0x64b2('0x62')];_0x3a484f['original_channelCount']=isNaN(_0x3ce267[_0x64b2('0x63')])?null:_0x3ce267[_0x64b2('0x63')];_0x3a484f['original_bitRate']=isNaN(_0x3ce267[_0x64b2('0x64')])?null:_0x3ce267[_0x64b2('0x64')];_0x3a484f['original_sampleRate']=isNaN(_0x3ce267[_0x64b2('0x65')])?null:_0x3ce267['sampleRate'];});_0x17337a['on'](_0x64b2('0x66'),function(_0x5a2b63){_0x3a484f['converted_duration']=isNaN(_0x5a2b63[_0x64b2('0x60')])?null:_0x5a2b63['duration']*0x3e8;_0x3a484f[_0x64b2('0x67')]=isNaN(_0x5a2b63[_0x64b2('0x62')])?null:_0x5a2b63[_0x64b2('0x62')];_0x3a484f[_0x64b2('0x68')]=isNaN(_0x5a2b63[_0x64b2('0x63')])?null:_0x5a2b63[_0x64b2('0x63')];_0x3a484f[_0x64b2('0x69')]=isNaN(_0x5a2b63[_0x64b2('0x64')])?null:_0x5a2b63[_0x64b2('0x64')];_0x3a484f[_0x64b2('0x6a')]=isNaN(_0x5a2b63[_0x64b2('0x65')])?null:_0x5a2b63['sampleRate'];});_0x17337a['on'](_0x64b2('0x1b'),function(){fs[_0x64b2('0x6b')](_0x5c4c38,parseInt(_0x64b2('0x6c'),0x8));return db[_0x64b2('0x3e')][_0x64b2('0x52')](_0x3a484f)[_0x64b2('0x24')](function(_0x207811){var _0x26cc16={'role':_0x121609[_0x64b2('0x6d')]['role'],'userProfileId':_0x121609[_0x64b2('0x6d')][_0x64b2('0x6e')]};if(!_0x26cc16)throw new Error(_0x64b2('0x6f'));if(_0x26cc16[_0x64b2('0x70')]==='user'){var _0x200d39=_0x207811['get']({'plain':!![]});return db[_0x64b2('0x71')][_0x64b2('0x47')]({'where':{'name':_0x64b2('0x72'),'userProfileId':_0x26cc16[_0x64b2('0x6e')]},'raw':!![]})[_0x64b2('0x24')](function(_0x3c5395){if(_0x3c5395&&_0x3c5395[_0x64b2('0x73')]===0x0){return db[_0x64b2('0x26')]['create']({'name':_0x200d39[_0x64b2('0x29')],'resourceId':_0x200d39['id'],'type':_0x3c5395['name'],'sectionId':_0x3c5395['id']},{})[_0x64b2('0x24')](function(){return _0x207811;});}else{return _0x207811;}})['catch'](function(_0x34ba5c){logger[_0x64b2('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x34ba5c);throw _0x34ba5c;});}return _0x207811;})[_0x64b2('0x24')](respondWithResult(_0xe10930,null))[_0x64b2('0x42')](handleError(_0xe10930,null));});_0x17337a['start']();}catch(_0x17281e){_0xe10930[_0x64b2('0x1a')](0x1f4)['send'](_0x17281e);}};exports[_0x64b2('0x23')]=function(_0x22649b,_0x13c954,_0x4b1b3b){return db['Sound'][_0x64b2('0x47')]({'where':{'id':_0x22649b['params']['id']}})['then'](handleEntityNotFound(_0x13c954,null))[_0x64b2('0x24')](saveUpdates(_[_0x64b2('0x3b')](_0x22649b['body'],[_0x64b2('0x29'),_0x64b2('0x74')]),null))[_0x64b2('0x24')](respondWithResult(_0x13c954,null))[_0x64b2('0x42')](handleError(_0x13c954,null));};exports[_0x64b2('0x75')]=function(_0x1953fc,_0x35d579,_0x30c40d){return db[_0x64b2('0x3e')][_0x64b2('0x47')]({'where':{'id':_0x1953fc[_0x64b2('0x44')]['id']}})['then'](function(_0x57c07b){if(_0x57c07b){return _0x57c07b[_0x64b2('0x25')]();}})[_0x64b2('0x24')](function(_0x1eebb4){var _0x466ab6=path[_0x64b2('0x49')](config[_0x64b2('0x4a')],_0x64b2('0x5a'),util[_0x64b2('0x4f')](_0x64b2('0x50'),_0x1eebb4[_0x64b2('0x51')],_0x1eebb4['original_format']));var _0x41a44c=path['join'](config['root'],'server/files/sounds/converted',util[_0x64b2('0x4f')](_0x64b2('0x50'),_0x1eebb4[_0x64b2('0x51')],_0x1eebb4[_0x64b2('0x4c')]));fs['unlinkSync'](_0x466ab6);fs[_0x64b2('0x76')](_0x41a44c);return _0x1eebb4;})[_0x64b2('0x24')](function(_0x10047d){if(_0x10047d){return _0x35d579[_0x64b2('0x1a')](0xcc)[_0x64b2('0x1b')]();}})['then'](handleEntityNotFound(_0x35d579,null))[_0x64b2('0x42')](handleError(_0x35d579,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index a15cfaf..a3dca75 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 _0x5a06=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./sound.attributes','define','Sound','api'];(function(_0x4da4a5,_0x58354f){var _0x1a8c00=function(_0x5746ef){while(--_0x5746ef){_0x4da4a5['push'](_0x4da4a5['shift']());}};_0x1a8c00(++_0x58354f);}(_0x5a06,0x10d));var _0x65a0=function(_0x36d2a1,_0x176456){_0x36d2a1=_0x36d2a1-0x0;var _0x5de65d=_0x5a06[_0x36d2a1];return _0x5de65d;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x65a0('0x0'));var moment=require(_0x65a0('0x1'));var BPromise=require(_0x65a0('0x2'));var rp=require(_0x65a0('0x3'));var fs=require('fs');var path=require(_0x65a0('0x4'));var rimraf=require(_0x65a0('0x5'));var config=require(_0x65a0('0x6'));var attributes=require(_0x65a0('0x7'));module['exports']=function(_0x506ec3,_0x4d8cf5){return _0x506ec3[_0x65a0('0x8')](_0x65a0('0x9'),attributes,{'tableName':'tools_sounds','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x269b=['define','Sound','tools_sounds','lodash','util','../../config/logger','bluebird','rimraf','../../config/environment'];(function(_0x32c521,_0x42440a){var _0x55a750=function(_0x3f96f6){while(--_0x3f96f6){_0x32c521['push'](_0x32c521['shift']());}};_0x55a750(++_0x42440a);}(_0x269b,0x9c));var _0xb269=function(_0x591cfd,_0x501204){_0x591cfd=_0x591cfd-0x0;var _0x4d0100=_0x269b[_0x591cfd];return _0x4d0100;};'use strict';var _=require(_0xb269('0x0'));var util=require(_0xb269('0x1'));var logger=require(_0xb269('0x2'))('api');var moment=require('moment');var BPromise=require(_0xb269('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xb269('0x4'));var config=require(_0xb269('0x5'));var attributes=require('./sound.attributes');module['exports']=function(_0x1944c8,_0x15f606){return _0x1944c8[_0xb269('0x6')](_0xb269('0x7'),attributes,{'tableName':_0xb269('0x8'),'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 7669ea2..bc7db73 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 _0xef28=['util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','info','Sound,\x20%s,\x20%s','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','Sound','find','options','raw','where','attributes','include','map','model','then','ShowSound','catch','lodash'];(function(_0x31b151,_0x42fc2a){var _0x325470=function(_0x2127b2){while(--_0x2127b2){_0x31b151['push'](_0x31b151['shift']());}};_0x325470(++_0x42fc2a);}(_0xef28,0xc5));var _0x8ef2=function(_0x595ab0,_0x34873a){_0x595ab0=_0x595ab0-0x0;var _0x5b0499=_0xef28[_0x595ab0];return _0x5b0499;};'use strict';var _=require(_0x8ef2('0x0'));var util=require(_0x8ef2('0x1'));var moment=require(_0x8ef2('0x2'));var BPromise=require(_0x8ef2('0x3'));var rs=require(_0x8ef2('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8ef2('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8ef2('0x6'))(_0x8ef2('0x7'));var config=require(_0x8ef2('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x8ef2('0x9')][_0x8ef2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x256f91,_0x429244,_0x6504a6){return new BPromise(function(_0x2740b2,_0x4d68b3){return client['request'](_0x256f91,_0x6504a6)['then'](function(_0x3cb381){logger[_0x8ef2('0xb')](_0x8ef2('0xc'),_0x429244,_0x8ef2('0xd'));logger[_0x8ef2('0xe')](_0x8ef2('0xf'),_0x429244,_0x8ef2('0xd'),JSON[_0x8ef2('0x10')](_0x3cb381));if(_0x3cb381[_0x8ef2('0x11')]){if(_0x3cb381[_0x8ef2('0x11')][_0x8ef2('0x12')]===0x1f4){logger['error'](_0x8ef2('0xc'),_0x429244,_0x3cb381['error']['message']);return _0x4d68b3(_0x3cb381[_0x8ef2('0x11')][_0x8ef2('0x13')]);}logger[_0x8ef2('0x11')](_0x8ef2('0xc'),_0x429244,_0x3cb381[_0x8ef2('0x11')][_0x8ef2('0x13')]);return _0x2740b2(_0x3cb381[_0x8ef2('0x11')][_0x8ef2('0x13')]);}else{logger[_0x8ef2('0xb')](_0x8ef2('0xc'),_0x429244,'request\x20sent');_0x2740b2(_0x3cb381[_0x8ef2('0x14')]['message']);}})['catch'](function(_0x15cd1a){logger[_0x8ef2('0x11')](_0x8ef2('0xc'),_0x429244,_0x15cd1a);_0x4d68b3(_0x15cd1a);});});}exports['ShowSound']=function(_0x20840c){var _0x19d696=this;return new Promise(function(_0x341fdb,_0x5e65be){return db[_0x8ef2('0x15')][_0x8ef2('0x16')]({'raw':_0x20840c[_0x8ef2('0x17')]?_0x20840c[_0x8ef2('0x17')][_0x8ef2('0x18')]===undefined?!![]:![]:!![],'where':_0x20840c[_0x8ef2('0x17')]?_0x20840c[_0x8ef2('0x17')][_0x8ef2('0x19')]||null:null,'attributes':_0x20840c['options']?_0x20840c['options'][_0x8ef2('0x1a')]||null:null,'include':_0x20840c[_0x8ef2('0x17')]?_0x20840c[_0x8ef2('0x17')][_0x8ef2('0x1b')]?_[_0x8ef2('0x1c')](_0x20840c[_0x8ef2('0x17')][_0x8ef2('0x1b')],function(_0x15a3b3){return{'model':db[_0x15a3b3['model']],'as':_0x15a3b3['as'],'attributes':_0x15a3b3['attributes'],'include':_0x15a3b3['include']?_[_0x8ef2('0x1c')](_0x15a3b3[_0x8ef2('0x1b')],function(_0x29b745){return{'model':db[_0x29b745[_0x8ef2('0x1d')]],'as':_0x29b745['as'],'attributes':_0x29b745['attributes'],'include':_0x29b745[_0x8ef2('0x1b')]?_[_0x8ef2('0x1c')](_0x29b745[_0x8ef2('0x1b')],function(_0x2a7267){return{'model':db[_0x2a7267[_0x8ef2('0x1d')]],'as':_0x2a7267['as'],'attributes':_0x2a7267[_0x8ef2('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x8ef2('0x1e')](function(_0x4dedc4){logger[_0x8ef2('0xb')](_0x8ef2('0x1f'),_0x20840c);logger[_0x8ef2('0xe')](_0x8ef2('0x1f'),_0x20840c,JSON[_0x8ef2('0x10')](_0x4dedc4));_0x341fdb(_0x4dedc4);})[_0x8ef2('0x20')](function(_0x134634){logger[_0x8ef2('0x11')](_0x8ef2('0x1f'),_0x134634[_0x8ef2('0x13')],_0x20840c);_0x5e65be(_0x19d696[_0x8ef2('0x11')](0x1f4,_0x134634[_0x8ef2('0x13')]));});});}; \ No newline at end of file +var _0x5e3c=['code','Sound,\x20%s,\x20%s','message','result','catch','ShowSound','find','options','raw','where','attributes','include','map','model','debug','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','Sound,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0x5e3c,0x1bc));var _0xc5e3=function(_0x3f2dce,_0x5a992c){_0x3f2dce=_0x3f2dce-0x0;var _0x5575f6=_0x5e3c[_0x3f2dce];return _0x5575f6;};'use strict';var _=require(_0xc5e3('0x0'));var util=require('util');var moment=require(_0xc5e3('0x1'));var BPromise=require(_0xc5e3('0x2'));var rs=require(_0xc5e3('0x3'));var fs=require('fs');var Redis=require(_0xc5e3('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc5e3('0x5'));var logger=require(_0xc5e3('0x6'))(_0xc5e3('0x7'));var config=require(_0xc5e3('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc5e3('0x9')][_0xc5e3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x8132,_0x4a49e9,_0x5e27ba){return new BPromise(function(_0x6355a,_0x4b9551){return client[_0xc5e3('0xb')](_0x8132,_0x5e27ba)[_0xc5e3('0xc')](function(_0x4b56b7){logger[_0xc5e3('0xd')]('Sound,\x20%s,\x20%s',_0x4a49e9,_0xc5e3('0xe'));logger['debug'](_0xc5e3('0xf'),_0x4a49e9,'request\x20sent',JSON[_0xc5e3('0x10')](_0x4b56b7));if(_0x4b56b7[_0xc5e3('0x11')]){if(_0x4b56b7[_0xc5e3('0x11')][_0xc5e3('0x12')]===0x1f4){logger['error'](_0xc5e3('0x13'),_0x4a49e9,_0x4b56b7['error'][_0xc5e3('0x14')]);return _0x4b9551(_0x4b56b7[_0xc5e3('0x11')]['message']);}logger[_0xc5e3('0x11')](_0xc5e3('0x13'),_0x4a49e9,_0x4b56b7['error'][_0xc5e3('0x14')]);return _0x6355a(_0x4b56b7[_0xc5e3('0x11')][_0xc5e3('0x14')]);}else{logger[_0xc5e3('0xd')]('Sound,\x20%s,\x20%s',_0x4a49e9,'request\x20sent');_0x6355a(_0x4b56b7[_0xc5e3('0x15')][_0xc5e3('0x14')]);}})[_0xc5e3('0x16')](function(_0x960231){logger[_0xc5e3('0x11')](_0xc5e3('0x13'),_0x4a49e9,_0x960231);_0x4b9551(_0x960231);});});}exports[_0xc5e3('0x17')]=function(_0x2a0566){var _0x168286=this;return new Promise(function(_0x4fd9b7,_0x56d069){return db['Sound'][_0xc5e3('0x18')]({'raw':_0x2a0566['options']?_0x2a0566[_0xc5e3('0x19')][_0xc5e3('0x1a')]===undefined?!![]:![]:!![],'where':_0x2a0566[_0xc5e3('0x19')]?_0x2a0566['options'][_0xc5e3('0x1b')]||null:null,'attributes':_0x2a0566[_0xc5e3('0x19')]?_0x2a0566['options'][_0xc5e3('0x1c')]||null:null,'include':_0x2a0566['options']?_0x2a0566[_0xc5e3('0x19')][_0xc5e3('0x1d')]?_[_0xc5e3('0x1e')](_0x2a0566['options'][_0xc5e3('0x1d')],function(_0x40926c){return{'model':db[_0x40926c[_0xc5e3('0x1f')]],'as':_0x40926c['as'],'attributes':_0x40926c[_0xc5e3('0x1c')],'include':_0x40926c[_0xc5e3('0x1d')]?_['map'](_0x40926c[_0xc5e3('0x1d')],function(_0x5c5795){return{'model':db[_0x5c5795[_0xc5e3('0x1f')]],'as':_0x5c5795['as'],'attributes':_0x5c5795[_0xc5e3('0x1c')],'include':_0x5c5795[_0xc5e3('0x1d')]?_[_0xc5e3('0x1e')](_0x5c5795[_0xc5e3('0x1d')],function(_0x4afc81){return{'model':db[_0x4afc81[_0xc5e3('0x1f')]],'as':_0x4afc81['as'],'attributes':_0x4afc81[_0xc5e3('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xc5e3('0xc')](function(_0x2255b0){logger[_0xc5e3('0xd')]('ShowSound',_0x2a0566);logger[_0xc5e3('0x20')](_0xc5e3('0x17'),_0x2a0566,JSON[_0xc5e3('0x10')](_0x2255b0));_0x4fd9b7(_0x2255b0);})[_0xc5e3('0x16')](function(_0x33921d){logger[_0xc5e3('0x11')](_0xc5e3('0x17'),_0x33921d[_0xc5e3('0x14')],_0x2a0566);_0x56d069(_0x168286[_0xc5e3('0x11')](0x1f4,_0x33921d[_0xc5e3('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 984d18b..26ce656 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 _0xab18=['../../config/environment','./squareMessage.controller','get','isAuthenticated','/:id','show','post','create','update','destroy','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x5b7788,_0x309ae5){var _0x573871=function(_0x5c79fd){while(--_0x5c79fd){_0x5b7788['push'](_0x5b7788['shift']());}};_0x573871(++_0x309ae5);}(_0xab18,0x191));var _0x8ab1=function(_0x52d4a9,_0x40e0fe){_0x52d4a9=_0x52d4a9-0x0;var _0x5d20f7=_0xab18[_0x52d4a9];return _0x5d20f7;};'use strict';var multer=require(_0x8ab1('0x0'));var util=require(_0x8ab1('0x1'));var path=require(_0x8ab1('0x2'));var timeout=require('connect-timeout');var express=require(_0x8ab1('0x3'));var router=express[_0x8ab1('0x4')]();var auth=require(_0x8ab1('0x5'));var interaction=require(_0x8ab1('0x6'));var config=require(_0x8ab1('0x7'));var controller=require(_0x8ab1('0x8'));router[_0x8ab1('0x9')]('/',auth[_0x8ab1('0xa')](),controller['index']);router[_0x8ab1('0x9')](_0x8ab1('0xb'),auth['isAuthenticated'](),controller[_0x8ab1('0xc')]);router[_0x8ab1('0xd')]('/',auth['isAuthenticated'](),controller[_0x8ab1('0xe')]);router['put'](_0x8ab1('0xb'),auth['isAuthenticated'](),controller[_0x8ab1('0xf')]);router['delete']('/:id',auth[_0x8ab1('0xa')](),controller[_0x8ab1('0x10')]);module['exports']=router; \ No newline at end of file +var _0xeec8=['connect-timeout','express','Router','../../components/auth/service','../../config/environment','./squareMessage.controller','isAuthenticated','get','/:id','show','create','put','update','delete','destroy','multer','util','path'];(function(_0x1ee942,_0xaa95e8){var _0x5a3521=function(_0x16637d){while(--_0x16637d){_0x1ee942['push'](_0x1ee942['shift']());}};_0x5a3521(++_0xaa95e8);}(_0xeec8,0x8d));var _0x8eec=function(_0x49f527,_0x1e5b87){_0x49f527=_0x49f527-0x0;var _0x35c5b7=_0xeec8[_0x49f527];return _0x35c5b7;};'use strict';var multer=require(_0x8eec('0x0'));var util=require(_0x8eec('0x1'));var path=require(_0x8eec('0x2'));var timeout=require(_0x8eec('0x3'));var express=require(_0x8eec('0x4'));var router=express[_0x8eec('0x5')]();var auth=require(_0x8eec('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x8eec('0x7'));var controller=require(_0x8eec('0x8'));router['get']('/',auth[_0x8eec('0x9')](),controller['index']);router[_0x8eec('0xa')](_0x8eec('0xb'),auth[_0x8eec('0x9')](),controller[_0x8eec('0xc')]);router['post']('/',auth[_0x8eec('0x9')](),controller[_0x8eec('0xd')]);router[_0x8eec('0xe')](_0x8eec('0xb'),auth[_0x8eec('0x9')](),controller[_0x8eec('0xf')]);router[_0x8eec('0x10')](_0x8eec('0xb'),auth['isAuthenticated'](),controller[_0x8eec('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 314abfa..cbd4864 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 _0xa024=['STRING','TEXT','medium','ENUM','out','sequelize','exports'];(function(_0x3351d7,_0x475cd2){var _0x36d366=function(_0x44f538){while(--_0x44f538){_0x3351d7['push'](_0x3351d7['shift']());}};_0x36d366(++_0x475cd2);}(_0xa024,0x19b));var _0x4a02=function(_0x44a1b0,_0x1e41ca){_0x44a1b0=_0x44a1b0-0x0;var _0x4d7b78=_0xa024[_0x44a1b0];return _0x4d7b78;};'use strict';var Sequelize=require(_0x4a02('0x0'));module[_0x4a02('0x1')]={'uniqueid':{'type':Sequelize[_0x4a02('0x2')]},'body':{'type':Sequelize[_0x4a02('0x3')](_0x4a02('0x4')),'allowNull':![]},'direction':{'type':Sequelize[_0x4a02('0x5')]('in','out'),'defaultValue':_0x4a02('0x6'),'allowNull':![]}}; \ No newline at end of file +var _0xb335=['medium','ENUM','out','sequelize','exports','TEXT'];(function(_0x16990b,_0x2549c3){var _0x496757=function(_0x32a3a3){while(--_0x32a3a3){_0x16990b['push'](_0x16990b['shift']());}};_0x496757(++_0x2549c3);}(_0xb335,0xf9));var _0x5b33=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb335[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x5b33('0x0'));module[_0x5b33('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'body':{'type':Sequelize[_0x5b33('0x2')](_0x5b33('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0x5b33('0x4')]('in',_0x5b33('0x5')),'defaultValue':_0x5b33('0x5'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 003e971..1a158af 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 _0xd10c=['create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','ejs','lodash','jsforce','desk.js','papaparse','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','update','then','error','stack','name','map','SquareMessage','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','rawAttributes','find','catch'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xd10c,0x10e));var _0xcd10=function(_0x24c68d,_0x107941){_0x24c68d=_0x24c68d-0x0;var _0x47c361=_0xd10c[_0x24c68d];return _0x47c361;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xcd10('0x0'));var rimraf=require(_0xcd10('0x1'));var zipdir=require(_0xcd10('0x2'));var jsonpatch=require(_0xcd10('0x3'));var rp=require('request-promise');var moment=require(_0xcd10('0x4'));var BPromise=require(_0xcd10('0x5'));var Mustache=require(_0xcd10('0x6'));var util=require('util');var path=require('path');var sox=require(_0xcd10('0x7'));var csv=require('to-csv');var ejs=require(_0xcd10('0x8'));var fs=require('fs');var _=require(_0xcd10('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xcd10('0xa'));var deskjs=require(_0xcd10('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xcd10('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xcd10('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcd10('0xe'))(_0xcd10('0xf'));var utils=require(_0xcd10('0x10'));var config=require(_0xcd10('0x11'));var db=require(_0xcd10('0x12'))['db'];function respondWithStatusCode(_0x60ecd4,_0x3b7a30){_0x3b7a30=_0x3b7a30||0xcc;return function(_0x1a4101){if(_0x1a4101){return _0x60ecd4[_0xcd10('0x13')](_0x3b7a30);}return _0x60ecd4[_0xcd10('0x14')](_0x3b7a30)[_0xcd10('0x15')]();};}function respondWithResult(_0x2d6cdd,_0x39cad4){_0x39cad4=_0x39cad4||0xc8;return function(_0x5c1ac0){if(_0x5c1ac0){return _0x2d6cdd[_0xcd10('0x14')](_0x39cad4)[_0xcd10('0x16')](_0x5c1ac0);}};}function respondWithFilteredResult(_0x4b6f72,_0xe56f9a){return function(_0xad11b5){if(_0xad11b5){var _0x1db8fa=_0xad11b5[_0xcd10('0x17')],_0x3d547d=_0xe56f9a[_0xcd10('0x18')],_0x2569d9=_0xe56f9a[_0xcd10('0x18')]+_0xe56f9a[_0xcd10('0x19')],_0x20e684;if(_0x2569d9>=_0x1db8fa){_0x2569d9=_0x1db8fa;_0x20e684=0xc8;}else{_0x20e684=0xce;}_0x4b6f72['status'](_0x20e684);return _0x4b6f72['set'](_0xcd10('0x1a'),_0x3d547d+'-'+_0x2569d9+'/'+_0x1db8fa)[_0xcd10('0x16')](_0xad11b5);}return null;};}function patchUpdates(_0x117f40){return function(_0x337fa8){try{jsonpatch[_0xcd10('0x1b')](_0x337fa8,_0x117f40,!![]);}catch(_0xabfdde){return BPromise[_0xcd10('0x1c')](_0xabfdde);}return _0x337fa8['save']();};}function saveUpdates(_0x598a4c,_0x49f98e){return function(_0x23c380){if(_0x23c380){return _0x23c380[_0xcd10('0x1d')](_0x598a4c)['then'](function(_0x2064c6){return _0x2064c6;});}return null;};}function removeEntity(_0x30d501,_0x7ced04){return function(_0x54d7ae){if(_0x54d7ae){return _0x54d7ae['destroy']()[_0xcd10('0x1e')](function(){_0x30d501[_0xcd10('0x14')](0xcc)[_0xcd10('0x15')]();});}};}function handleEntityNotFound(_0x1f8305,_0x257167){return function(_0x518c0d){if(!_0x518c0d){_0x1f8305['sendStatus'](0x194);}return _0x518c0d;};}function handleError(_0xb18dd3,_0x123b1a){_0x123b1a=_0x123b1a||0x1f4;return function(_0x3be9bb){logger[_0xcd10('0x1f')](_0x3be9bb[_0xcd10('0x20')]);if(_0x3be9bb['name']){delete _0x3be9bb[_0xcd10('0x21')];}_0xb18dd3[_0xcd10('0x14')](_0x123b1a)['send'](_0x3be9bb);};}exports['index']=function(_0x2aa397,_0x163ffa){var _0x1db8ae={},_0x37bd60={},_0x2b715f={'count':0x0,'rows':[]};var _0x205594=_[_0xcd10('0x22')](db[_0xcd10('0x23')]['rawAttributes'],function(_0x3d8d79){return{'name':_0x3d8d79[_0xcd10('0x24')],'type':_0x3d8d79[_0xcd10('0x25')][_0xcd10('0x26')]};});_0x37bd60[_0xcd10('0x27')]=_[_0xcd10('0x22')](_0x205594,_0xcd10('0x21'));_0x37bd60['query']=_[_0xcd10('0x28')](_0x2aa397[_0xcd10('0x29')]);_0x37bd60[_0xcd10('0x2a')]=_['intersection'](_0x37bd60['model'],_0x37bd60[_0xcd10('0x29')]);_0x1db8ae[_0xcd10('0x2b')]=_[_0xcd10('0x2c')](_0x37bd60[_0xcd10('0x27')],qs[_0xcd10('0x2d')](_0x2aa397[_0xcd10('0x29')][_0xcd10('0x2d')]));_0x1db8ae[_0xcd10('0x2b')]=_0x1db8ae[_0xcd10('0x2b')][_0xcd10('0x2e')]?_0x1db8ae[_0xcd10('0x2b')]:_0x37bd60[_0xcd10('0x27')];if(!_0x2aa397[_0xcd10('0x29')][_0xcd10('0x2f')](_0xcd10('0x30'))){_0x1db8ae[_0xcd10('0x19')]=qs[_0xcd10('0x19')](_0x2aa397[_0xcd10('0x29')][_0xcd10('0x19')]);_0x1db8ae[_0xcd10('0x18')]=qs['offset'](_0x2aa397[_0xcd10('0x29')][_0xcd10('0x18')]);}_0x1db8ae['order']=qs[_0xcd10('0x31')](_0x2aa397[_0xcd10('0x29')][_0xcd10('0x31')]);_0x1db8ae[_0xcd10('0x32')]=qs[_0xcd10('0x2a')](_[_0xcd10('0x33')](_0x2aa397[_0xcd10('0x29')],_0x37bd60[_0xcd10('0x2a')]),_0x205594);if(_0x2aa397[_0xcd10('0x29')]['filter']){_0x1db8ae[_0xcd10('0x32')]=_[_0xcd10('0x34')](_0x1db8ae[_0xcd10('0x32')],{'$or':_[_0xcd10('0x22')](_0x205594,function(_0x2ef4a3){if(_0x2ef4a3[_0xcd10('0x25')]!==_0xcd10('0x35')){var _0x47c723={};_0x47c723[_0x2ef4a3[_0xcd10('0x21')]]={'$like':'%'+_0x2aa397[_0xcd10('0x29')][_0xcd10('0x36')]+'%'};return _0x47c723;}})});}_0x1db8ae=_[_0xcd10('0x34')]({},_0x1db8ae,_0x2aa397[_0xcd10('0x37')]);var _0x560cb3={'where':_0x1db8ae['where']};return db['SquareMessage'][_0xcd10('0x17')](_0x560cb3)['then'](function(_0x46fa48){_0x2b715f[_0xcd10('0x17')]=_0x46fa48;if(_0x2aa397[_0xcd10('0x29')][_0xcd10('0x38')]){_0x1db8ae[_0xcd10('0x39')]=[{'all':!![]}];}return db[_0xcd10('0x23')][_0xcd10('0x3a')](_0x1db8ae);})[_0xcd10('0x1e')](function(_0x572181){_0x2b715f[_0xcd10('0x3b')]=_0x572181;return _0x2b715f;})[_0xcd10('0x1e')](respondWithFilteredResult(_0x163ffa,_0x1db8ae))['catch'](handleError(_0x163ffa,null));};exports[_0xcd10('0x3c')]=function(_0x22daff,_0x15fd5c){var _0x409619={'raw':!![],'where':{'id':_0x22daff[_0xcd10('0x3d')]['id']}},_0x31ea84={};_0x31ea84[_0xcd10('0x27')]=_[_0xcd10('0x28')](db[_0xcd10('0x23')][_0xcd10('0x3e')]);_0x31ea84[_0xcd10('0x29')]=_[_0xcd10('0x28')](_0x22daff['query']);_0x31ea84[_0xcd10('0x2a')]=_['intersection'](_0x31ea84[_0xcd10('0x27')],_0x31ea84[_0xcd10('0x29')]);_0x409619[_0xcd10('0x2b')]=_['intersection'](_0x31ea84[_0xcd10('0x27')],qs['fields'](_0x22daff['query']['fields']));_0x409619[_0xcd10('0x2b')]=_0x409619[_0xcd10('0x2b')][_0xcd10('0x2e')]?_0x409619['attributes']:_0x31ea84[_0xcd10('0x27')];if(_0x22daff[_0xcd10('0x29')][_0xcd10('0x38')]){_0x409619[_0xcd10('0x39')]=[{'all':!![]}];}_0x409619=_[_0xcd10('0x34')]({},_0x409619,_0x22daff[_0xcd10('0x37')]);return db[_0xcd10('0x23')][_0xcd10('0x3f')](_0x409619)[_0xcd10('0x1e')](handleEntityNotFound(_0x15fd5c,null))['then'](respondWithResult(_0x15fd5c,null))[_0xcd10('0x40')](handleError(_0x15fd5c,null));};exports[_0xcd10('0x41')]=function(_0x250d4f,_0x553fe5){return db[_0xcd10('0x23')]['create'](_0x250d4f['body'],{})[_0xcd10('0x1e')](respondWithResult(_0x553fe5,0xc9))[_0xcd10('0x40')](handleError(_0x553fe5,null));};exports[_0xcd10('0x1d')]=function(_0x53f6b7,_0x3caabe){if(_0x53f6b7[_0xcd10('0x42')]['id']){delete _0x53f6b7[_0xcd10('0x42')]['id'];}return db[_0xcd10('0x23')][_0xcd10('0x3f')]({'where':{'id':_0x53f6b7[_0xcd10('0x3d')]['id']}})[_0xcd10('0x1e')](handleEntityNotFound(_0x3caabe,null))['then'](saveUpdates(_0x53f6b7[_0xcd10('0x42')],null))[_0xcd10('0x1e')](respondWithResult(_0x3caabe,null))['catch'](handleError(_0x3caabe,null));};exports['destroy']=function(_0x412f7,_0x118910){return db[_0xcd10('0x23')][_0xcd10('0x3f')]({'where':{'id':_0x412f7[_0xcd10('0x3d')]['id']}})['then'](handleEntityNotFound(_0x118910,null))['then'](removeEntity(_0x118910,null))['catch'](handleError(_0x118910,null));}; \ No newline at end of file +var _0x6063=['params','find','create','body','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','pick','filter','merge','where','VIRTUAL','options','SquareMessage','includeAll','include','rows','catch','show'];(function(_0x5e0350,_0x21f126){var _0xbf4fbb=function(_0x33ddec){while(--_0x33ddec){_0x5e0350['push'](_0x5e0350['shift']());}};_0xbf4fbb(++_0x21f126);}(_0x6063,0xd9));var _0x3606=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6063[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x3606('0x0'));var emlformat=require(_0x3606('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x3606('0x2'));var jsonpatch=require(_0x3606('0x3'));var rp=require(_0x3606('0x4'));var moment=require(_0x3606('0x5'));var BPromise=require(_0x3606('0x6'));var Mustache=require(_0x3606('0x7'));var util=require(_0x3606('0x8'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x3606('0x9'));var jsforce=require(_0x3606('0xa'));var deskjs=require(_0x3606('0xb'));var toCsv=require('to-csv');var querystring=require(_0x3606('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3606('0xd'));var as=require(_0x3606('0xe'));var hardwareService=require(_0x3606('0xf'));var logger=require(_0x3606('0x10'))(_0x3606('0x11'));var utils=require(_0x3606('0x12'));var config=require(_0x3606('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3515a3,_0x5245ef){_0x5245ef=_0x5245ef||0xcc;return function(_0xb8f862){if(_0xb8f862){return _0x3515a3[_0x3606('0x14')](_0x5245ef);}return _0x3515a3[_0x3606('0x15')](_0x5245ef)[_0x3606('0x16')]();};}function respondWithResult(_0x26a071,_0x492fc2){_0x492fc2=_0x492fc2||0xc8;return function(_0x5a0572){if(_0x5a0572){return _0x26a071[_0x3606('0x15')](_0x492fc2)[_0x3606('0x17')](_0x5a0572);}};}function respondWithFilteredResult(_0x3e2e7b,_0x5b886f){return function(_0x556ccb){if(_0x556ccb){var _0x20564b=_0x556ccb[_0x3606('0x18')],_0x38c6de=_0x5b886f[_0x3606('0x19')],_0x55409b=_0x5b886f[_0x3606('0x19')]+_0x5b886f['limit'],_0x2d70a7;if(_0x55409b>=_0x20564b){_0x55409b=_0x20564b;_0x2d70a7=0xc8;}else{_0x2d70a7=0xce;}_0x3e2e7b[_0x3606('0x15')](_0x2d70a7);return _0x3e2e7b[_0x3606('0x1a')](_0x3606('0x1b'),_0x38c6de+'-'+_0x55409b+'/'+_0x20564b)[_0x3606('0x17')](_0x556ccb);}return null;};}function patchUpdates(_0x3a64db){return function(_0x1463de){try{jsonpatch[_0x3606('0x1c')](_0x1463de,_0x3a64db,!![]);}catch(_0x1f49e7){return BPromise[_0x3606('0x1d')](_0x1f49e7);}return _0x1463de[_0x3606('0x1e')]();};}function saveUpdates(_0x3672e9,_0x37b95d){return function(_0x4930de){if(_0x4930de){return _0x4930de[_0x3606('0x1f')](_0x3672e9)[_0x3606('0x20')](function(_0x3aa6cb){return _0x3aa6cb;});}return null;};}function removeEntity(_0x48b700,_0x5e421e){return function(_0x3fb90e){if(_0x3fb90e){return _0x3fb90e[_0x3606('0x21')]()['then'](function(){_0x48b700['status'](0xcc)[_0x3606('0x16')]();});}};}function handleEntityNotFound(_0x3322d6,_0x442328){return function(_0x7d11c){if(!_0x7d11c){_0x3322d6[_0x3606('0x14')](0x194);}return _0x7d11c;};}function handleError(_0x4c4610,_0x47b5eb){_0x47b5eb=_0x47b5eb||0x1f4;return function(_0x1089f9){logger[_0x3606('0x22')](_0x1089f9[_0x3606('0x23')]);if(_0x1089f9['name']){delete _0x1089f9[_0x3606('0x24')];}_0x4c4610[_0x3606('0x15')](_0x47b5eb)[_0x3606('0x25')](_0x1089f9);};}exports['index']=function(_0xed2457,_0x10571a){var _0x37626e={},_0x34c4e8={},_0x21368a={'count':0x0,'rows':[]};var _0x5ef85f=_[_0x3606('0x26')](db['SquareMessage'][_0x3606('0x27')],function(_0x417fe9){return{'name':_0x417fe9[_0x3606('0x28')],'type':_0x417fe9[_0x3606('0x29')][_0x3606('0x2a')]};});_0x34c4e8['model']=_['map'](_0x5ef85f,_0x3606('0x24'));_0x34c4e8[_0x3606('0x2b')]=_[_0x3606('0x2c')](_0xed2457['query']);_0x34c4e8[_0x3606('0x2d')]=_[_0x3606('0x2e')](_0x34c4e8[_0x3606('0x2f')],_0x34c4e8[_0x3606('0x2b')]);_0x37626e['attributes']=_[_0x3606('0x2e')](_0x34c4e8[_0x3606('0x2f')],qs[_0x3606('0x30')](_0xed2457[_0x3606('0x2b')][_0x3606('0x30')]));_0x37626e[_0x3606('0x31')]=_0x37626e[_0x3606('0x31')]['length']?_0x37626e[_0x3606('0x31')]:_0x34c4e8[_0x3606('0x2f')];if(!_0xed2457[_0x3606('0x2b')][_0x3606('0x32')](_0x3606('0x33'))){_0x37626e[_0x3606('0x34')]=qs[_0x3606('0x34')](_0xed2457['query'][_0x3606('0x34')]);_0x37626e[_0x3606('0x19')]=qs[_0x3606('0x19')](_0xed2457[_0x3606('0x2b')][_0x3606('0x19')]);}_0x37626e[_0x3606('0x35')]=qs[_0x3606('0x36')](_0xed2457[_0x3606('0x2b')][_0x3606('0x36')]);_0x37626e['where']=qs[_0x3606('0x2d')](_[_0x3606('0x37')](_0xed2457[_0x3606('0x2b')],_0x34c4e8[_0x3606('0x2d')]),_0x5ef85f);if(_0xed2457[_0x3606('0x2b')][_0x3606('0x38')]){_0x37626e['where']=_[_0x3606('0x39')](_0x37626e[_0x3606('0x3a')],{'$or':_[_0x3606('0x26')](_0x5ef85f,function(_0x5d185a){if(_0x5d185a['type']!==_0x3606('0x3b')){var _0x17c51b={};_0x17c51b[_0x5d185a[_0x3606('0x24')]]={'$like':'%'+_0xed2457['query'][_0x3606('0x38')]+'%'};return _0x17c51b;}})});}_0x37626e=_[_0x3606('0x39')]({},_0x37626e,_0xed2457[_0x3606('0x3c')]);var _0x35b61d={'where':_0x37626e[_0x3606('0x3a')]};return db[_0x3606('0x3d')][_0x3606('0x18')](_0x35b61d)[_0x3606('0x20')](function(_0x37e608){_0x21368a[_0x3606('0x18')]=_0x37e608;if(_0xed2457[_0x3606('0x2b')][_0x3606('0x3e')]){_0x37626e[_0x3606('0x3f')]=[{'all':!![]}];}return db['SquareMessage']['findAll'](_0x37626e);})[_0x3606('0x20')](function(_0x2d4f89){_0x21368a[_0x3606('0x40')]=_0x2d4f89;return _0x21368a;})['then'](respondWithFilteredResult(_0x10571a,_0x37626e))[_0x3606('0x41')](handleError(_0x10571a,null));};exports[_0x3606('0x42')]=function(_0x420398,_0x5861d6){var _0x57e24a={'raw':!![],'where':{'id':_0x420398[_0x3606('0x43')]['id']}},_0x3e2fa8={};_0x3e2fa8[_0x3606('0x2f')]=_[_0x3606('0x2c')](db[_0x3606('0x3d')][_0x3606('0x27')]);_0x3e2fa8[_0x3606('0x2b')]=_[_0x3606('0x2c')](_0x420398[_0x3606('0x2b')]);_0x3e2fa8['filters']=_['intersection'](_0x3e2fa8[_0x3606('0x2f')],_0x3e2fa8[_0x3606('0x2b')]);_0x57e24a['attributes']=_[_0x3606('0x2e')](_0x3e2fa8[_0x3606('0x2f')],qs['fields'](_0x420398[_0x3606('0x2b')][_0x3606('0x30')]));_0x57e24a['attributes']=_0x57e24a['attributes']['length']?_0x57e24a[_0x3606('0x31')]:_0x3e2fa8['model'];if(_0x420398[_0x3606('0x2b')][_0x3606('0x3e')]){_0x57e24a[_0x3606('0x3f')]=[{'all':!![]}];}_0x57e24a=_[_0x3606('0x39')]({},_0x57e24a,_0x420398['options']);return db['SquareMessage'][_0x3606('0x44')](_0x57e24a)[_0x3606('0x20')](handleEntityNotFound(_0x5861d6,null))[_0x3606('0x20')](respondWithResult(_0x5861d6,null))[_0x3606('0x41')](handleError(_0x5861d6,null));};exports[_0x3606('0x45')]=function(_0x367b25,_0x2291be){return db[_0x3606('0x3d')]['create'](_0x367b25[_0x3606('0x46')],{})[_0x3606('0x20')](respondWithResult(_0x2291be,0xc9))[_0x3606('0x41')](handleError(_0x2291be,null));};exports['update']=function(_0x356b4a,_0x6cf7e4){if(_0x356b4a[_0x3606('0x46')]['id']){delete _0x356b4a[_0x3606('0x46')]['id'];}return db[_0x3606('0x3d')]['find']({'where':{'id':_0x356b4a[_0x3606('0x43')]['id']}})[_0x3606('0x20')](handleEntityNotFound(_0x6cf7e4,null))[_0x3606('0x20')](saveUpdates(_0x356b4a[_0x3606('0x46')],null))[_0x3606('0x20')](respondWithResult(_0x6cf7e4,null))[_0x3606('0x41')](handleError(_0x6cf7e4,null));};exports[_0x3606('0x21')]=function(_0x1f3483,_0x40cd82){return db[_0x3606('0x3d')][_0x3606('0x44')]({'where':{'id':_0x1f3483[_0x3606('0x43')]['id']}})[_0x3606('0x20')](handleEntityNotFound(_0x40cd82,null))[_0x3606('0x20')](removeEntity(_0x40cd82,null))[_0x3606('0x41')](handleError(_0x40cd82,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 11ad735..312ed61 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 _0xaeeb=['../../config/environment','exports','define','SquareMessage','square_messages','lodash','util','api','request-promise','path','rimraf'];(function(_0x432d9d,_0x35a04a){var _0x49a10b=function(_0x2eed52){while(--_0x2eed52){_0x432d9d['push'](_0x432d9d['shift']());}};_0x49a10b(++_0x35a04a);}(_0xaeeb,0x1e9));var _0xbaee=function(_0x2401fc,_0xbc7845){_0x2401fc=_0x2401fc-0x0;var _0x23bb42=_0xaeeb[_0x2401fc];return _0x23bb42;};'use strict';var _=require(_0xbaee('0x0'));var util=require(_0xbaee('0x1'));var logger=require('../../config/logger')(_0xbaee('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xbaee('0x3'));var fs=require('fs');var path=require(_0xbaee('0x4'));var rimraf=require(_0xbaee('0x5'));var config=require(_0xbaee('0x6'));var attributes=require('./squareMessage.attributes');module[_0xbaee('0x7')]=function(_0x4cab10,_0x1edf10){return _0x4cab10[_0xbaee('0x8')](_0xbaee('0x9'),attributes,{'tableName':_0xbaee('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0185=['exports','SquareMessage','lodash','util','../../config/logger','moment','path','rimraf','../../config/environment','./squareMessage.attributes'];(function(_0x4d2566,_0x3a7d68){var _0x3bb19f=function(_0x270a2e){while(--_0x270a2e){_0x4d2566['push'](_0x4d2566['shift']());}};_0x3bb19f(++_0x3a7d68);}(_0x0185,0xb6));var _0x5018=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x0185[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require(_0x5018('0x0'));var util=require(_0x5018('0x1'));var logger=require(_0x5018('0x2'))('api');var moment=require(_0x5018('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5018('0x4'));var rimraf=require(_0x5018('0x5'));var config=require(_0x5018('0x6'));var attributes=require(_0x5018('0x7'));module[_0x5018('0x8')]=function(_0x4b5c42,_0x2de595){return _0x4b5c42['define'](_0x5018('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 ca7c615..cce85d0 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 _0xaf5a=['request','then','info','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareMessage,\x20%s,\x20%s','message','request\x20sent','result','catch','CreateSquareMessage','body','options','raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x4ed520,_0x21be63){var _0x4415a6=function(_0x14b151){while(--_0x14b151){_0x4ed520['push'](_0x4ed520['shift']());}};_0x4415a6(++_0x21be63);}(_0xaf5a,0x116));var _0xaaf5=function(_0x507d63,_0x375424){_0x507d63=_0x507d63-0x0;var _0x4f7124=_0xaf5a[_0x507d63];return _0x4f7124;};'use strict';var _=require('lodash');var util=require(_0xaaf5('0x0'));var moment=require(_0xaaf5('0x1'));var BPromise=require(_0xaaf5('0x2'));var rs=require(_0xaaf5('0x3'));var fs=require('fs');var Redis=require(_0xaaf5('0x4'));var db=require(_0xaaf5('0x5'))['db'];var utils=require(_0xaaf5('0x6'));var logger=require(_0xaaf5('0x7'))('rpc');var config=require(_0xaaf5('0x8'));var jayson=require(_0xaaf5('0x9'));var client=jayson[_0xaaf5('0xa')][_0xaaf5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5890d2,_0x57e7f9,_0x34a86f){return new BPromise(function(_0x2243cb,_0x408180){return client[_0xaaf5('0xc')](_0x5890d2,_0x34a86f)[_0xaaf5('0xd')](function(_0x488279){logger[_0xaaf5('0xe')]('SquareMessage,\x20%s,\x20%s',_0x57e7f9,'request\x20sent');logger[_0xaaf5('0xf')](_0xaaf5('0x10'),_0x57e7f9,'request\x20sent',JSON[_0xaaf5('0x11')](_0x488279));if(_0x488279[_0xaaf5('0x12')]){if(_0x488279[_0xaaf5('0x12')][_0xaaf5('0x13')]===0x1f4){logger['error'](_0xaaf5('0x14'),_0x57e7f9,_0x488279[_0xaaf5('0x12')]['message']);return _0x408180(_0x488279[_0xaaf5('0x12')]['message']);}logger[_0xaaf5('0x12')](_0xaaf5('0x14'),_0x57e7f9,_0x488279[_0xaaf5('0x12')][_0xaaf5('0x15')]);return _0x2243cb(_0x488279['error'][_0xaaf5('0x15')]);}else{logger[_0xaaf5('0xe')](_0xaaf5('0x14'),_0x57e7f9,_0xaaf5('0x16'));_0x2243cb(_0x488279[_0xaaf5('0x17')][_0xaaf5('0x15')]);}})[_0xaaf5('0x18')](function(_0x4b1693){logger[_0xaaf5('0x12')](_0xaaf5('0x14'),_0x57e7f9,_0x4b1693);_0x408180(_0x4b1693);});});}exports[_0xaaf5('0x19')]=function(_0x3a036d){var _0x318d47=this;return new Promise(function(_0x403bb2,_0x3e8576){return db['SquareMessage']['create'](_0x3a036d[_0xaaf5('0x1a')],{'raw':_0x3a036d[_0xaaf5('0x1b')]?_0x3a036d[_0xaaf5('0x1b')][_0xaaf5('0x1c')]===undefined?!![]:![]:!![]})[_0xaaf5('0xd')](function(_0x6131a3){logger['info']('CreateSquareMessage',_0x3a036d);logger[_0xaaf5('0xf')](_0xaaf5('0x19'),_0x3a036d,JSON[_0xaaf5('0x11')](_0x6131a3));_0x403bb2(_0x6131a3);})[_0xaaf5('0x18')](function(_0x3020b0){logger[_0xaaf5('0x12')](_0xaaf5('0x19'),_0x3020b0[_0xaaf5('0x15')],_0x3a036d);_0x3e8576(_0x318d47[_0xaaf5('0x12')](0x1f4,_0x3020b0[_0xaaf5('0x15')]));});});}; \ No newline at end of file +var _0xd634=['body','options','then','debug','util','moment','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','info','SquareMessage,\x20%s,\x20%s','request\x20sent','SquareMessage,\x20%s,\x20%s,\x20%s','error','message','result','catch','CreateSquareMessage','SquareMessage','create'];(function(_0x47b800,_0x45d50d){var _0x3ea026=function(_0x1adbc1){while(--_0x1adbc1){_0x47b800['push'](_0x47b800['shift']());}};_0x3ea026(++_0x45d50d);}(_0xd634,0xf4));var _0x4d63=function(_0x4d8dc3,_0x585fd1){_0x4d8dc3=_0x4d8dc3-0x0;var _0x9b03d9=_0xd634[_0x4d8dc3];return _0x9b03d9;};'use strict';var _=require('lodash');var util=require(_0x4d63('0x0'));var moment=require(_0x4d63('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4d63('0x2'));var db=require(_0x4d63('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4d63('0x4'));var config=require(_0x4d63('0x5'));var jayson=require(_0x4d63('0x6'));var client=jayson[_0x4d63('0x7')][_0x4d63('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x381601,_0x3e90e1,_0x6a60f4){return new BPromise(function(_0x49c1da,_0x5be18a){return client['request'](_0x381601,_0x6a60f4)['then'](function(_0x5cfc22){logger[_0x4d63('0x9')](_0x4d63('0xa'),_0x3e90e1,_0x4d63('0xb'));logger['debug'](_0x4d63('0xc'),_0x3e90e1,_0x4d63('0xb'),JSON['stringify'](_0x5cfc22));if(_0x5cfc22['error']){if(_0x5cfc22[_0x4d63('0xd')]['code']===0x1f4){logger[_0x4d63('0xd')](_0x4d63('0xa'),_0x3e90e1,_0x5cfc22[_0x4d63('0xd')][_0x4d63('0xe')]);return _0x5be18a(_0x5cfc22[_0x4d63('0xd')][_0x4d63('0xe')]);}logger['error']('SquareMessage,\x20%s,\x20%s',_0x3e90e1,_0x5cfc22['error'][_0x4d63('0xe')]);return _0x49c1da(_0x5cfc22[_0x4d63('0xd')][_0x4d63('0xe')]);}else{logger[_0x4d63('0x9')]('SquareMessage,\x20%s,\x20%s',_0x3e90e1,_0x4d63('0xb'));_0x49c1da(_0x5cfc22[_0x4d63('0xf')][_0x4d63('0xe')]);}})[_0x4d63('0x10')](function(_0x3c96b8){logger[_0x4d63('0xd')](_0x4d63('0xa'),_0x3e90e1,_0x3c96b8);_0x5be18a(_0x3c96b8);});});}exports[_0x4d63('0x11')]=function(_0x53bbb8){var _0x4fe175=this;return new Promise(function(_0x790e03,_0x4b849f){return db[_0x4d63('0x12')][_0x4d63('0x13')](_0x53bbb8[_0x4d63('0x14')],{'raw':_0x53bbb8[_0x4d63('0x15')]?_0x53bbb8[_0x4d63('0x15')]['raw']===undefined?!![]:![]:!![]})[_0x4d63('0x16')](function(_0x12ef62){logger['info'](_0x4d63('0x11'),_0x53bbb8);logger[_0x4d63('0x17')](_0x4d63('0x11'),_0x53bbb8,JSON['stringify'](_0x12ef62));_0x790e03(_0x12ef62);})[_0x4d63('0x10')](function(_0x131386){logger[_0x4d63('0xd')](_0x4d63('0x11'),_0x131386['message'],_0x53bbb8);_0x4b849f(_0x4fe175[_0x4d63('0xd')](0x1f4,_0x131386['message']));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 0f4f308..d74e004 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 _0xb31d=['./squareOdbc.controller','index','get','15s','test','isAuthenticated','create','put','/:id','update','delete','destroy','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment'];(function(_0x957f74,_0x687fe1){var _0x45347a=function(_0x433bbf){while(--_0x433bbf){_0x957f74['push'](_0x957f74['shift']());}};_0x45347a(++_0x687fe1);}(_0xb31d,0xca));var _0xdb31=function(_0xb6a5d5,_0x5bfdb1){_0xb6a5d5=_0xb6a5d5-0x0;var _0x16ef49=_0xb31d[_0xb6a5d5];return _0x16ef49;};'use strict';var multer=require(_0xdb31('0x0'));var util=require(_0xdb31('0x1'));var path=require(_0xdb31('0x2'));var timeout=require(_0xdb31('0x3'));var express=require('express');var router=express[_0xdb31('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xdb31('0x5'));var config=require(_0xdb31('0x6'));var controller=require(_0xdb31('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xdb31('0x8')]);router[_0xdb31('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xdb31('0x9')]('/:id/test',auth['isAuthenticated'](),timeout(_0xdb31('0xa')),controller[_0xdb31('0xb')]);router['post']('/',auth[_0xdb31('0xc')](),controller[_0xdb31('0xd')]);router[_0xdb31('0xe')](_0xdb31('0xf'),auth[_0xdb31('0xc')](),controller[_0xdb31('0x10')]);router[_0xdb31('0x11')]('/:id',auth[_0xdb31('0xc')](),controller[_0xdb31('0x12')]);module['exports']=router; \ No newline at end of file +var _0xf641=['exports','multer','util','connect-timeout','Router','../../components/auth/service','../../config/environment','./squareOdbc.controller','get','isAuthenticated','index','show','/:id/test','15s','test','create','put','/:id','update','delete'];(function(_0x13a262,_0x1683a8){var _0x2744ad=function(_0x48e049){while(--_0x48e049){_0x13a262['push'](_0x13a262['shift']());}};_0x2744ad(++_0x1683a8);}(_0xf641,0x17d));var _0x1f64=function(_0x2a2f7e,_0x27df25){_0x2a2f7e=_0x2a2f7e-0x0;var _0x18c674=_0xf641[_0x2a2f7e];return _0x18c674;};'use strict';var multer=require(_0x1f64('0x0'));var util=require(_0x1f64('0x1'));var path=require('path');var timeout=require(_0x1f64('0x2'));var express=require('express');var router=express[_0x1f64('0x3')]();var auth=require(_0x1f64('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x1f64('0x5'));var controller=require(_0x1f64('0x6'));router[_0x1f64('0x7')]('/',auth[_0x1f64('0x8')](),controller[_0x1f64('0x9')]);router[_0x1f64('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x1f64('0xa')]);router['get'](_0x1f64('0xb'),auth[_0x1f64('0x8')](),timeout(_0x1f64('0xc')),controller[_0x1f64('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x1f64('0xe')]);router[_0x1f64('0xf')](_0x1f64('0x10'),auth[_0x1f64('0x8')](),controller[_0x1f64('0x11')]);router[_0x1f64('0x12')](_0x1f64('0x10'),auth['isAuthenticated'](),controller['destroy']);module[_0x1f64('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 6d5939e..3786e21 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 _0x9502=['exports','STRING','sequelize'];(function(_0x2c29b3,_0x3b4a8c){var _0x52d58c=function(_0x15d6fc){while(--_0x15d6fc){_0x2c29b3['push'](_0x2c29b3['shift']());}};_0x52d58c(++_0x3b4a8c);}(_0x9502,0x13d));var _0x2950=function(_0x5caee2,_0x325a65){_0x5caee2=_0x5caee2-0x0;var _0x3f8747=_0x9502[_0x5caee2];return _0x3f8747;};'use strict';var Sequelize=require(_0x2950('0x0'));module[_0x2950('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'dsn':{'type':Sequelize[_0x2950('0x2')]},'description':{'type':Sequelize[_0x2950('0x2')]}}; \ No newline at end of file +var _0xac0f=['STRING','name','exports'];(function(_0x1051f4,_0x45c3a6){var _0x104ea0=function(_0x2bc69e){while(--_0x2bc69e){_0x1051f4['push'](_0x1051f4['shift']());}};_0x104ea0(++_0x45c3a6);}(_0xac0f,0x158));var _0xfac0=function(_0x477a38,_0x1c6b85){_0x477a38=_0x477a38-0x0;var _0x209089=_0xac0f[_0x477a38];return _0x209089;};'use strict';var Sequelize=require('sequelize');module[_0xfac0('0x0')]={'name':{'type':Sequelize[_0xfac0('0x1')],'unique':_0xfac0('0x2'),'allowNull':![]},'dsn':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xfac0('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index b82217d..c50a524 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 _0x8d20=['limit','set','Content-Range','json','apply','save','then','destroy','ODBC','UserProfileResource','end','stack','name','send','map','SquareOdbc','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','include','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','update','params','test','dsn','odbc','openSync','closeSync','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','count','offset'];(function(_0x4ccaa8,_0xcd8e01){var _0xfe2b4f=function(_0xfb2b28){while(--_0xfb2b28){_0x4ccaa8['push'](_0x4ccaa8['shift']());}};_0xfe2b4f(++_0xcd8e01);}(_0x8d20,0xe6));var _0x08d2=function(_0x53f189,_0x2c8a54){_0x53f189=_0x53f189-0x0;var _0x31469f=_0x8d20[_0x53f189];return _0x31469f;};'use strict';var pdf=require(_0x08d2('0x0'));var emlformat=require(_0x08d2('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x08d2('0x2'));var jsonpatch=require(_0x08d2('0x3'));var rp=require(_0x08d2('0x4'));var moment=require('moment');var BPromise=require(_0x08d2('0x5'));var Mustache=require(_0x08d2('0x6'));var util=require(_0x08d2('0x7'));var path=require('path');var sox=require(_0x08d2('0x8'));var csv=require(_0x08d2('0x9'));var ejs=require(_0x08d2('0xa'));var fs=require('fs');var _=require(_0x08d2('0xb'));var squel=require(_0x08d2('0xc'));var crypto=require(_0x08d2('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x08d2('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x08d2('0xf'));var authService=require(_0x08d2('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x08d2('0x11'));var hardwareService=require(_0x08d2('0x12'));var logger=require(_0x08d2('0x13'))(_0x08d2('0x14'));var utils=require(_0x08d2('0x15'));var config=require(_0x08d2('0x16'));var db=require(_0x08d2('0x17'))['db'];function respondWithStatusCode(_0x5d28d4,_0x12dcc0){_0x12dcc0=_0x12dcc0||0xcc;return function(_0xc695b9){if(_0xc695b9){return _0x5d28d4[_0x08d2('0x18')](_0x12dcc0);}return _0x5d28d4[_0x08d2('0x19')](_0x12dcc0)['end']();};}function respondWithResult(_0x2798c5,_0xd3cc3){_0xd3cc3=_0xd3cc3||0xc8;return function(_0x2f017a){if(_0x2f017a){return _0x2798c5[_0x08d2('0x19')](_0xd3cc3)['json'](_0x2f017a);}};}function respondWithFilteredResult(_0x4face0,_0x173263){return function(_0x2f4c5d){if(_0x2f4c5d){var _0x41221e=_0x2f4c5d[_0x08d2('0x1a')],_0x5df38c=_0x173263[_0x08d2('0x1b')],_0x5e8b92=_0x173263[_0x08d2('0x1b')]+_0x173263[_0x08d2('0x1c')],_0x329be2;if(_0x5e8b92>=_0x41221e){_0x5e8b92=_0x41221e;_0x329be2=0xc8;}else{_0x329be2=0xce;}_0x4face0[_0x08d2('0x19')](_0x329be2);return _0x4face0[_0x08d2('0x1d')](_0x08d2('0x1e'),_0x5df38c+'-'+_0x5e8b92+'/'+_0x41221e)[_0x08d2('0x1f')](_0x2f4c5d);}return null;};}function patchUpdates(_0x53c5cb){return function(_0xfc89db){try{jsonpatch[_0x08d2('0x20')](_0xfc89db,_0x53c5cb,!![]);}catch(_0xdeb15){return BPromise['reject'](_0xdeb15);}return _0xfc89db[_0x08d2('0x21')]();};}function saveUpdates(_0x4053cb,_0x27be5c){return function(_0x47054c){if(_0x47054c){return _0x47054c['update'](_0x4053cb)[_0x08d2('0x22')](function(_0x39d1a6){return _0x39d1a6;});}return null;};}function removeEntity(_0x21f759,_0x36030e){return function(_0x311cf6){if(_0x311cf6){return _0x311cf6[_0x08d2('0x23')]()[_0x08d2('0x22')](function(){var _0x565655=_0x311cf6['get']({'plain':!![]});var _0x49cb19=_0x08d2('0x24');return db[_0x08d2('0x25')][_0x08d2('0x23')]({'where':{'type':_0x49cb19,'resourceId':_0x565655['id']}})[_0x08d2('0x22')](function(){return _0x311cf6;});})['then'](function(){_0x21f759[_0x08d2('0x19')](0xcc)[_0x08d2('0x26')]();});}};}function handleEntityNotFound(_0x319d0f,_0x34d765){return function(_0xae8551){if(!_0xae8551){_0x319d0f['sendStatus'](0x194);}return _0xae8551;};}function handleError(_0x40dd1b,_0x4a0b24){_0x4a0b24=_0x4a0b24||0x1f4;return function(_0x2b4415){logger['error'](_0x2b4415[_0x08d2('0x27')]);if(_0x2b4415['name']){delete _0x2b4415[_0x08d2('0x28')];}_0x40dd1b['status'](_0x4a0b24)[_0x08d2('0x29')](_0x2b4415);};}exports['index']=function(_0x22523a,_0x43576e){var _0x4fe1a2={},_0x16a446={},_0x48ae8c={'count':0x0,'rows':[]};var _0x47ba9b=_[_0x08d2('0x2a')](db[_0x08d2('0x2b')][_0x08d2('0x2c')],function(_0x1aa8e6){return{'name':_0x1aa8e6[_0x08d2('0x2d')],'type':_0x1aa8e6[_0x08d2('0x2e')][_0x08d2('0x2f')]};});_0x16a446[_0x08d2('0x30')]=_[_0x08d2('0x2a')](_0x47ba9b,_0x08d2('0x28'));_0x16a446[_0x08d2('0x31')]=_[_0x08d2('0x32')](_0x22523a['query']);_0x16a446['filters']=_[_0x08d2('0x33')](_0x16a446[_0x08d2('0x30')],_0x16a446[_0x08d2('0x31')]);_0x4fe1a2[_0x08d2('0x34')]=_[_0x08d2('0x33')](_0x16a446[_0x08d2('0x30')],qs['fields'](_0x22523a['query'][_0x08d2('0x35')]));_0x4fe1a2[_0x08d2('0x34')]=_0x4fe1a2['attributes'][_0x08d2('0x36')]?_0x4fe1a2['attributes']:_0x16a446[_0x08d2('0x30')];if(!_0x22523a['query']['hasOwnProperty'](_0x08d2('0x37'))){_0x4fe1a2[_0x08d2('0x1c')]=qs[_0x08d2('0x1c')](_0x22523a[_0x08d2('0x31')][_0x08d2('0x1c')]);_0x4fe1a2[_0x08d2('0x1b')]=qs[_0x08d2('0x1b')](_0x22523a[_0x08d2('0x31')]['offset']);}_0x4fe1a2[_0x08d2('0x38')]=qs[_0x08d2('0x39')](_0x22523a[_0x08d2('0x31')][_0x08d2('0x39')]);_0x4fe1a2[_0x08d2('0x3a')]=qs[_0x08d2('0x3b')](_[_0x08d2('0x3c')](_0x22523a['query'],_0x16a446[_0x08d2('0x3b')]),_0x47ba9b);if(_0x22523a[_0x08d2('0x31')][_0x08d2('0x3d')]){_0x4fe1a2[_0x08d2('0x3a')]=_[_0x08d2('0x3e')](_0x4fe1a2[_0x08d2('0x3a')],{'$or':_[_0x08d2('0x2a')](_0x47ba9b,function(_0x464d19){if(_0x464d19[_0x08d2('0x2e')]!==_0x08d2('0x3f')){var _0x3612ea={};_0x3612ea[_0x464d19[_0x08d2('0x28')]]={'$like':'%'+_0x22523a['query'][_0x08d2('0x3d')]+'%'};return _0x3612ea;}})});}_0x4fe1a2=_[_0x08d2('0x3e')]({},_0x4fe1a2,_0x22523a[_0x08d2('0x40')]);var _0x331557={'where':_0x4fe1a2[_0x08d2('0x3a')]};return db[_0x08d2('0x2b')][_0x08d2('0x1a')](_0x331557)['then'](function(_0x484322){_0x48ae8c[_0x08d2('0x1a')]=_0x484322;if(_0x22523a['query'][_0x08d2('0x41')]){_0x4fe1a2['include']=[{'all':!![]}];}return db[_0x08d2('0x2b')][_0x08d2('0x42')](_0x4fe1a2);})[_0x08d2('0x22')](function(_0x22e882){_0x48ae8c[_0x08d2('0x43')]=_0x22e882;return _0x48ae8c;})['then'](respondWithFilteredResult(_0x43576e,_0x4fe1a2))[_0x08d2('0x44')](handleError(_0x43576e,null));};exports[_0x08d2('0x45')]=function(_0x3eefcd,_0xf22c20){var _0x4fb961={'raw':!![],'where':{'id':_0x3eefcd['params']['id']}},_0x1ba0f6={};_0x1ba0f6[_0x08d2('0x30')]=_['keys'](db[_0x08d2('0x2b')][_0x08d2('0x2c')]);_0x1ba0f6['query']=_['keys'](_0x3eefcd[_0x08d2('0x31')]);_0x1ba0f6[_0x08d2('0x3b')]=_[_0x08d2('0x33')](_0x1ba0f6['model'],_0x1ba0f6['query']);_0x4fb961[_0x08d2('0x34')]=_[_0x08d2('0x33')](_0x1ba0f6['model'],qs[_0x08d2('0x35')](_0x3eefcd[_0x08d2('0x31')][_0x08d2('0x35')]));_0x4fb961[_0x08d2('0x34')]=_0x4fb961[_0x08d2('0x34')][_0x08d2('0x36')]?_0x4fb961[_0x08d2('0x34')]:_0x1ba0f6['model'];if(_0x3eefcd[_0x08d2('0x31')][_0x08d2('0x41')]){_0x4fb961[_0x08d2('0x46')]=[{'all':!![]}];}_0x4fb961=_[_0x08d2('0x3e')]({},_0x4fb961,_0x3eefcd[_0x08d2('0x40')]);return db['SquareOdbc'][_0x08d2('0x47')](_0x4fb961)[_0x08d2('0x22')](handleEntityNotFound(_0xf22c20,null))[_0x08d2('0x22')](respondWithResult(_0xf22c20,null))['catch'](handleError(_0xf22c20,null));};exports[_0x08d2('0x48')]=function(_0x5bc75f,_0x376856){return db['SquareOdbc'][_0x08d2('0x48')](_0x5bc75f[_0x08d2('0x49')],{})[_0x08d2('0x22')](function(_0x25dbaa){var _0x33d907=_0x5bc75f[_0x08d2('0x4a')][_0x08d2('0x4b')]({'plain':!![]});if(!_0x33d907)throw new Error(_0x08d2('0x4c'));if(_0x33d907[_0x08d2('0x4d')]===_0x08d2('0x4a')){var _0x3f4a14=_0x25dbaa[_0x08d2('0x4b')]({'plain':!![]});var _0x2d6950=_0x08d2('0x24');return db['UserProfileSection'][_0x08d2('0x47')]({'where':{'name':_0x2d6950,'userProfileId':_0x33d907[_0x08d2('0x4e')]},'raw':!![]})[_0x08d2('0x22')](function(_0x33c5bd){if(_0x33c5bd&&_0x33c5bd['autoAssociation']===0x0){return db[_0x08d2('0x25')][_0x08d2('0x48')]({'name':_0x3f4a14[_0x08d2('0x28')],'resourceId':_0x3f4a14['id'],'type':_0x33c5bd['name'],'sectionId':_0x33c5bd['id']},{})['then'](function(){return _0x25dbaa;});}else{return _0x25dbaa;}})[_0x08d2('0x44')](function(_0x986ad3){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x986ad3);throw _0x986ad3;});}return _0x25dbaa;})[_0x08d2('0x22')](respondWithResult(_0x376856,0xc9))['catch'](handleError(_0x376856,null));};exports[_0x08d2('0x4f')]=function(_0x5a8603,_0x285883){if(_0x5a8603[_0x08d2('0x49')]['id']){delete _0x5a8603['body']['id'];}return db['SquareOdbc']['find']({'where':{'id':_0x5a8603[_0x08d2('0x50')]['id']}})[_0x08d2('0x22')](handleEntityNotFound(_0x285883,null))[_0x08d2('0x22')](saveUpdates(_0x5a8603['body'],null))[_0x08d2('0x22')](respondWithResult(_0x285883,null))['catch'](handleError(_0x285883,null));};exports[_0x08d2('0x23')]=function(_0xe563cc,_0x408257){return db['SquareOdbc']['find']({'where':{'id':_0xe563cc[_0x08d2('0x50')]['id']}})[_0x08d2('0x22')](handleEntityNotFound(_0x408257,null))[_0x08d2('0x22')](removeEntity(_0x408257,null))[_0x08d2('0x44')](handleError(_0x408257,null));};exports[_0x08d2('0x51')]=function(_0x58324d,_0x38f3cf,_0x1279ee){var _0x1ceb3c;return db[_0x08d2('0x2b')][_0x08d2('0x47')]({'where':{'id':_0x58324d[_0x08d2('0x50')]['id']},'attributes':['id',_0x08d2('0x52')]})[_0x08d2('0x22')](handleEntityNotFound(_0x38f3cf,null))[_0x08d2('0x22')](function(_0x4dccb4){if(_0x4dccb4){var _0x299783=require(_0x08d2('0x53'))();_0x299783[_0x08d2('0x54')](_0x4dccb4[_0x08d2('0x52')]);_0x299783[_0x08d2('0x55')]();return _0x4dccb4;}})[_0x08d2('0x22')](respondWithResult(_0x38f3cf,null))['catch'](handleError(_0x38f3cf,null));}; \ No newline at end of file +var _0x9963=['catch','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','params','test','odbc','openSync','dsn','closeSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','squel','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','get','ODBC','UserProfileResource','sendStatus','error','stack','name','send','map','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','where','merge','VIRTUAL','filter','options','SquareOdbc','includeAll','rows'];(function(_0x3aa27f,_0xfbbff0){var _0xd554ee=function(_0x473c60){while(--_0x473c60){_0x3aa27f['push'](_0x3aa27f['shift']());}};_0xd554ee(++_0xfbbff0);}(_0x9963,0x113));var _0x3996=function(_0x1cee55,_0xe75188){_0x1cee55=_0x1cee55-0x0;var _0x4f640a=_0x9963[_0x1cee55];return _0x4f640a;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x3996('0x0'));var rimraf=require(_0x3996('0x1'));var zipdir=require(_0x3996('0x2'));var jsonpatch=require(_0x3996('0x3'));var rp=require(_0x3996('0x4'));var moment=require('moment');var BPromise=require(_0x3996('0x5'));var Mustache=require(_0x3996('0x6'));var util=require(_0x3996('0x7'));var path=require(_0x3996('0x8'));var sox=require(_0x3996('0x9'));var csv=require('to-csv');var ejs=require(_0x3996('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x3996('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3996('0xc'));var toCsv=require(_0x3996('0xd'));var querystring=require(_0x3996('0xe'));var Papa=require(_0x3996('0xf'));var Redis=require('ioredis');var authService=require(_0x3996('0x10'));var qs=require(_0x3996('0x11'));var as=require(_0x3996('0x12'));var hardwareService=require(_0x3996('0x13'));var logger=require(_0x3996('0x14'))(_0x3996('0x15'));var utils=require(_0x3996('0x16'));var config=require(_0x3996('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3b239a,_0x3b9d10){_0x3b9d10=_0x3b9d10||0xcc;return function(_0x47af4c){if(_0x47af4c){return _0x3b239a['sendStatus'](_0x3b9d10);}return _0x3b239a[_0x3996('0x18')](_0x3b9d10)[_0x3996('0x19')]();};}function respondWithResult(_0x522ac0,_0x5f0ac7){_0x5f0ac7=_0x5f0ac7||0xc8;return function(_0x43968d){if(_0x43968d){return _0x522ac0[_0x3996('0x18')](_0x5f0ac7)[_0x3996('0x1a')](_0x43968d);}};}function respondWithFilteredResult(_0x4e7270,_0x2a21fa){return function(_0x83a77e){if(_0x83a77e){var _0x1a838a=_0x83a77e[_0x3996('0x1b')],_0x198612=_0x2a21fa[_0x3996('0x1c')],_0x24cc7e=_0x2a21fa[_0x3996('0x1c')]+_0x2a21fa[_0x3996('0x1d')],_0x1abbe0;if(_0x24cc7e>=_0x1a838a){_0x24cc7e=_0x1a838a;_0x1abbe0=0xc8;}else{_0x1abbe0=0xce;}_0x4e7270[_0x3996('0x18')](_0x1abbe0);return _0x4e7270[_0x3996('0x1e')](_0x3996('0x1f'),_0x198612+'-'+_0x24cc7e+'/'+_0x1a838a)[_0x3996('0x1a')](_0x83a77e);}return null;};}function patchUpdates(_0x4e9cc1){return function(_0x2fcaf0){try{jsonpatch[_0x3996('0x20')](_0x2fcaf0,_0x4e9cc1,!![]);}catch(_0x216fd2){return BPromise[_0x3996('0x21')](_0x216fd2);}return _0x2fcaf0[_0x3996('0x22')]();};}function saveUpdates(_0x1539e7,_0x4876cd){return function(_0x2a2d91){if(_0x2a2d91){return _0x2a2d91[_0x3996('0x23')](_0x1539e7)['then'](function(_0x24bef9){return _0x24bef9;});}return null;};}function removeEntity(_0x52faed,_0x3eca70){return function(_0x4f43d1){if(_0x4f43d1){return _0x4f43d1[_0x3996('0x24')]()[_0x3996('0x25')](function(){var _0x5c6367=_0x4f43d1[_0x3996('0x26')]({'plain':!![]});var _0x4e2ebc=_0x3996('0x27');return db[_0x3996('0x28')][_0x3996('0x24')]({'where':{'type':_0x4e2ebc,'resourceId':_0x5c6367['id']}})[_0x3996('0x25')](function(){return _0x4f43d1;});})['then'](function(){_0x52faed[_0x3996('0x18')](0xcc)[_0x3996('0x19')]();});}};}function handleEntityNotFound(_0x33efeb,_0x5cf7f7){return function(_0xd5f4cf){if(!_0xd5f4cf){_0x33efeb[_0x3996('0x29')](0x194);}return _0xd5f4cf;};}function handleError(_0x18c0aa,_0x30b50e){_0x30b50e=_0x30b50e||0x1f4;return function(_0x2b656a){logger[_0x3996('0x2a')](_0x2b656a[_0x3996('0x2b')]);if(_0x2b656a[_0x3996('0x2c')]){delete _0x2b656a[_0x3996('0x2c')];}_0x18c0aa[_0x3996('0x18')](_0x30b50e)[_0x3996('0x2d')](_0x2b656a);};}exports['index']=function(_0x11a411,_0x35897e){var _0x3e338b={},_0x455e0e={},_0x4cb3a8={'count':0x0,'rows':[]};var _0xf14ba5=_[_0x3996('0x2e')](db['SquareOdbc']['rawAttributes'],function(_0x123829){return{'name':_0x123829[_0x3996('0x2f')],'type':_0x123829[_0x3996('0x30')]['key']};});_0x455e0e[_0x3996('0x31')]=_[_0x3996('0x2e')](_0xf14ba5,_0x3996('0x2c'));_0x455e0e[_0x3996('0x32')]=_[_0x3996('0x33')](_0x11a411[_0x3996('0x32')]);_0x455e0e[_0x3996('0x34')]=_[_0x3996('0x35')](_0x455e0e[_0x3996('0x31')],_0x455e0e[_0x3996('0x32')]);_0x3e338b[_0x3996('0x36')]=_[_0x3996('0x35')](_0x455e0e[_0x3996('0x31')],qs[_0x3996('0x37')](_0x11a411[_0x3996('0x32')][_0x3996('0x37')]));_0x3e338b['attributes']=_0x3e338b[_0x3996('0x36')][_0x3996('0x38')]?_0x3e338b[_0x3996('0x36')]:_0x455e0e[_0x3996('0x31')];if(!_0x11a411[_0x3996('0x32')][_0x3996('0x39')](_0x3996('0x3a'))){_0x3e338b[_0x3996('0x1d')]=qs[_0x3996('0x1d')](_0x11a411[_0x3996('0x32')][_0x3996('0x1d')]);_0x3e338b[_0x3996('0x1c')]=qs[_0x3996('0x1c')](_0x11a411[_0x3996('0x32')][_0x3996('0x1c')]);}_0x3e338b['order']=qs[_0x3996('0x3b')](_0x11a411['query']['sort']);_0x3e338b['where']=qs[_0x3996('0x34')](_[_0x3996('0x3c')](_0x11a411[_0x3996('0x32')],_0x455e0e[_0x3996('0x34')]),_0xf14ba5);if(_0x11a411[_0x3996('0x32')]['filter']){_0x3e338b[_0x3996('0x3d')]=_[_0x3996('0x3e')](_0x3e338b[_0x3996('0x3d')],{'$or':_[_0x3996('0x2e')](_0xf14ba5,function(_0x106152){if(_0x106152['type']!==_0x3996('0x3f')){var _0x72e8b8={};_0x72e8b8[_0x106152['name']]={'$like':'%'+_0x11a411[_0x3996('0x32')][_0x3996('0x40')]+'%'};return _0x72e8b8;}})});}_0x3e338b=_[_0x3996('0x3e')]({},_0x3e338b,_0x11a411[_0x3996('0x41')]);var _0x116ba9={'where':_0x3e338b[_0x3996('0x3d')]};return db[_0x3996('0x42')][_0x3996('0x1b')](_0x116ba9)[_0x3996('0x25')](function(_0x266303){_0x4cb3a8['count']=_0x266303;if(_0x11a411[_0x3996('0x32')][_0x3996('0x43')]){_0x3e338b['include']=[{'all':!![]}];}return db[_0x3996('0x42')]['findAll'](_0x3e338b);})[_0x3996('0x25')](function(_0x48b9c8){_0x4cb3a8[_0x3996('0x44')]=_0x48b9c8;return _0x4cb3a8;})[_0x3996('0x25')](respondWithFilteredResult(_0x35897e,_0x3e338b))[_0x3996('0x45')](handleError(_0x35897e,null));};exports['show']=function(_0x46ccdf,_0x1eaff7){var _0x22ea1a={'raw':!![],'where':{'id':_0x46ccdf['params']['id']}},_0x5cb709={};_0x5cb709[_0x3996('0x31')]=_['keys'](db[_0x3996('0x42')]['rawAttributes']);_0x5cb709[_0x3996('0x32')]=_['keys'](_0x46ccdf[_0x3996('0x32')]);_0x5cb709[_0x3996('0x34')]=_[_0x3996('0x35')](_0x5cb709[_0x3996('0x31')],_0x5cb709[_0x3996('0x32')]);_0x22ea1a[_0x3996('0x36')]=_['intersection'](_0x5cb709[_0x3996('0x31')],qs[_0x3996('0x37')](_0x46ccdf[_0x3996('0x32')]['fields']));_0x22ea1a[_0x3996('0x36')]=_0x22ea1a[_0x3996('0x36')][_0x3996('0x38')]?_0x22ea1a['attributes']:_0x5cb709['model'];if(_0x46ccdf[_0x3996('0x32')][_0x3996('0x43')]){_0x22ea1a[_0x3996('0x46')]=[{'all':!![]}];}_0x22ea1a=_[_0x3996('0x3e')]({},_0x22ea1a,_0x46ccdf['options']);return db[_0x3996('0x42')]['find'](_0x22ea1a)[_0x3996('0x25')](handleEntityNotFound(_0x1eaff7,null))[_0x3996('0x25')](respondWithResult(_0x1eaff7,null))[_0x3996('0x45')](handleError(_0x1eaff7,null));};exports[_0x3996('0x47')]=function(_0x37c19c,_0x4e4881){return db[_0x3996('0x42')][_0x3996('0x47')](_0x37c19c[_0x3996('0x48')],{})[_0x3996('0x25')](function(_0x2ce733){var _0x4a7c68=_0x37c19c[_0x3996('0x49')][_0x3996('0x26')]({'plain':!![]});if(!_0x4a7c68)throw new Error(_0x3996('0x4a'));if(_0x4a7c68[_0x3996('0x4b')]===_0x3996('0x49')){var _0x1e3980=_0x2ce733[_0x3996('0x26')]({'plain':!![]});var _0x2a060e='ODBC';return db[_0x3996('0x4c')][_0x3996('0x4d')]({'where':{'name':_0x2a060e,'userProfileId':_0x4a7c68[_0x3996('0x4e')]},'raw':!![]})[_0x3996('0x25')](function(_0x233be9){if(_0x233be9&&_0x233be9[_0x3996('0x4f')]===0x0){return db['UserProfileResource'][_0x3996('0x47')]({'name':_0x1e3980[_0x3996('0x2c')],'resourceId':_0x1e3980['id'],'type':_0x233be9['name'],'sectionId':_0x233be9['id']},{})[_0x3996('0x25')](function(){return _0x2ce733;});}else{return _0x2ce733;}})[_0x3996('0x45')](function(_0x29d8d3){logger[_0x3996('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x29d8d3);throw _0x29d8d3;});}return _0x2ce733;})[_0x3996('0x25')](respondWithResult(_0x4e4881,0xc9))['catch'](handleError(_0x4e4881,null));};exports[_0x3996('0x23')]=function(_0x5b8326,_0x490247){if(_0x5b8326['body']['id']){delete _0x5b8326[_0x3996('0x48')]['id'];}return db[_0x3996('0x42')][_0x3996('0x4d')]({'where':{'id':_0x5b8326['params']['id']}})[_0x3996('0x25')](handleEntityNotFound(_0x490247,null))[_0x3996('0x25')](saveUpdates(_0x5b8326[_0x3996('0x48')],null))[_0x3996('0x25')](respondWithResult(_0x490247,null))[_0x3996('0x45')](handleError(_0x490247,null));};exports[_0x3996('0x24')]=function(_0x44bd28,_0x536288){return db['SquareOdbc'][_0x3996('0x4d')]({'where':{'id':_0x44bd28[_0x3996('0x50')]['id']}})[_0x3996('0x25')](handleEntityNotFound(_0x536288,null))[_0x3996('0x25')](removeEntity(_0x536288,null))[_0x3996('0x45')](handleError(_0x536288,null));};exports[_0x3996('0x51')]=function(_0xb9b328,_0x4a6022,_0x537d94){var _0x1b6b27;return db[_0x3996('0x42')]['find']({'where':{'id':_0xb9b328[_0x3996('0x50')]['id']},'attributes':['id','dsn']})['then'](handleEntityNotFound(_0x4a6022,null))[_0x3996('0x25')](function(_0x1bb547){if(_0x1bb547){var _0x53ba66=require(_0x3996('0x52'))();_0x53ba66[_0x3996('0x53')](_0x1bb547[_0x3996('0x54')]);_0x53ba66[_0x3996('0x55')]();return _0x1bb547;}})[_0x3996('0x25')](respondWithResult(_0x4a6022,null))[_0x3996('0x45')](handleError(_0x4a6022,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index d152424..017462c 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 _0x2fc9=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareOdbc.attributes','exports','SquareOdbc','square_odbc','util'];(function(_0x1e7a20,_0x292c7e){var _0x23cb44=function(_0x4dc876){while(--_0x4dc876){_0x1e7a20['push'](_0x1e7a20['shift']());}};_0x23cb44(++_0x292c7e);}(_0x2fc9,0xc2));var _0x92fc=function(_0x1deb03,_0xd05ad8){_0x1deb03=_0x1deb03-0x0;var _0x189fe7=_0x2fc9[_0x1deb03];return _0x189fe7;};'use strict';var _=require('lodash');var util=require(_0x92fc('0x0'));var logger=require(_0x92fc('0x1'))(_0x92fc('0x2'));var moment=require(_0x92fc('0x3'));var BPromise=require(_0x92fc('0x4'));var rp=require(_0x92fc('0x5'));var fs=require('fs');var path=require(_0x92fc('0x6'));var rimraf=require(_0x92fc('0x7'));var config=require(_0x92fc('0x8'));var attributes=require(_0x92fc('0x9'));module[_0x92fc('0xa')]=function(_0x5d492e,_0x580d4a){return _0x5d492e['define'](_0x92fc('0xb'),attributes,{'tableName':_0x92fc('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x89d3=['rimraf','exports','SquareOdbc','square_odbc','lodash','util','../../config/logger','api','path'];(function(_0x1187fc,_0x27a837){var _0xfcc967=function(_0x2978d7){while(--_0x2978d7){_0x1187fc['push'](_0x1187fc['shift']());}};_0xfcc967(++_0x27a837);}(_0x89d3,0x13f));var _0x389d=function(_0x102789,_0x24217f){_0x102789=_0x102789-0x0;var _0x4aeb4f=_0x89d3[_0x102789];return _0x4aeb4f;};'use strict';var _=require(_0x389d('0x0'));var util=require(_0x389d('0x1'));var logger=require(_0x389d('0x2'))(_0x389d('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x389d('0x4'));var rimraf=require(_0x389d('0x5'));var config=require('../../config/environment');var attributes=require('./squareOdbc.attributes');module[_0x389d('0x6')]=function(_0x2c37ee,_0x615a13){return _0x2c37ee['define'](_0x389d('0x7'),attributes,{'tableName':_0x389d('0x8'),'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 011f5d6..b0cfd00 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 _0xe14b=['ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','SquareOdbc,\x20%s,\x20%s','SquareOdbc,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','ShowSquareOdbc','SquareOdbc','find','options','raw','where','attributes','map','include','model','stringify','lodash','util','randomstring'];(function(_0x54c191,_0x4a04ef){var _0x40ee4a=function(_0x200a79){while(--_0x200a79){_0x54c191['push'](_0x54c191['shift']());}};_0x40ee4a(++_0x4a04ef);}(_0xe14b,0x93));var _0xbe14=function(_0x5cbf7b,_0x3f5dd8){_0x5cbf7b=_0x5cbf7b-0x0;var _0x346596=_0xe14b[_0x5cbf7b];return _0x346596;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbe14('0x2'));var fs=require('fs');var Redis=require(_0xbe14('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbe14('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xbe14('0x5'));var jayson=require(_0xbe14('0x6'));var client=jayson[_0xbe14('0x7')][_0xbe14('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1d9ade,_0x39387e,_0x196fca){return new BPromise(function(_0x566ae7,_0x50f909){return client['request'](_0x1d9ade,_0x196fca)[_0xbe14('0x9')](function(_0x6fceff){logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,'request\x20sent');logger['debug'](_0xbe14('0xc'),_0x39387e,_0xbe14('0xd'),JSON['stringify'](_0x6fceff));if(_0x6fceff[_0xbe14('0xe')]){if(_0x6fceff[_0xbe14('0xe')][_0xbe14('0xf')]===0x1f4){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x50f909(_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);}logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x566ae7(_0x6fceff['error']['message']);}else{logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,_0xbe14('0xd'));_0x566ae7(_0x6fceff[_0xbe14('0x11')]['message']);}})[_0xbe14('0x12')](function(_0xe9c3ec){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0xe9c3ec);_0x50f909(_0xe9c3ec);});});}exports[_0xbe14('0x13')]=function(_0x29ab73){var _0x17ae86=this;return new Promise(function(_0x5ea1f8,_0x137ee5){return db[_0xbe14('0x14')][_0xbe14('0x15')]({'raw':_0x29ab73[_0xbe14('0x16')]?_0x29ab73[_0xbe14('0x16')][_0xbe14('0x17')]===undefined?!![]:![]:!![],'where':_0x29ab73['options']?_0x29ab73[_0xbe14('0x16')][_0xbe14('0x18')]||null:null,'attributes':_0x29ab73[_0xbe14('0x16')]?_0x29ab73[_0xbe14('0x16')][_0xbe14('0x19')]||null:null,'include':_0x29ab73['options']?_0x29ab73[_0xbe14('0x16')]['include']?_[_0xbe14('0x1a')](_0x29ab73['options'][_0xbe14('0x1b')],function(_0x4a25fa){return{'model':db[_0x4a25fa[_0xbe14('0x1c')]],'as':_0x4a25fa['as'],'attributes':_0x4a25fa[_0xbe14('0x19')],'include':_0x4a25fa['include']?_[_0xbe14('0x1a')](_0x4a25fa['include'],function(_0x4587a8){return{'model':db[_0x4587a8['model']],'as':_0x4587a8['as'],'attributes':_0x4587a8[_0xbe14('0x19')],'include':_0x4587a8[_0xbe14('0x1b')]?_[_0xbe14('0x1a')](_0x4587a8[_0xbe14('0x1b')],function(_0x15ef02){return{'model':db[_0x15ef02[_0xbe14('0x1c')]],'as':_0x15ef02['as'],'attributes':_0x15ef02['attributes']};}):[]};}):[]};}):[]:[]})[_0xbe14('0x9')](function(_0x1ba46a){logger[_0xbe14('0xa')](_0xbe14('0x13'),_0x29ab73);logger['debug'](_0xbe14('0x13'),_0x29ab73,JSON[_0xbe14('0x1d')](_0x1ba46a));_0x5ea1f8(_0x1ba46a);})['catch'](function(_0x3c3613){logger[_0xbe14('0xe')](_0xbe14('0x13'),_0x3c3613[_0xbe14('0x10')],_0x29ab73);_0x137ee5(_0x17ae86[_0xbe14('0xe')](0x1f4,_0x3c3613[_0xbe14('0x10')]));});});}; \ No newline at end of file +var _0x9957=['stringify','error','code','message','result','catch','ShowSquareOdbc','find','raw','options','where','attributes','include','map','model','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s'];(function(_0x31be86,_0x14b363){var _0x563609=function(_0x55f6ee){while(--_0x55f6ee){_0x31be86['push'](_0x31be86['shift']());}};_0x563609(++_0x14b363);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var 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']('SquareOdbc,\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['SquareOdbc'][_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,'include':_0x291317[_0x7995('0x1b')]?_0x291317[_0x7995('0x1b')][_0x7995('0x1e')]?_[_0x7995('0x1f')](_0x291317[_0x7995('0x1b')]['include'],function(_0x32a09a){return{'model':db[_0x32a09a[_0x7995('0x20')]],'as':_0x32a09a['as'],'attributes':_0x32a09a[_0x7995('0x1d')],'include':_0x32a09a[_0x7995('0x1e')]?_[_0x7995('0x1f')](_0x32a09a[_0x7995('0x1e')],function(_0x475351){return{'model':db[_0x475351[_0x7995('0x20')]],'as':_0x475351['as'],'attributes':_0x475351['attributes'],'include':_0x475351[_0x7995('0x1e')]?_[_0x7995('0x1f')](_0x475351[_0x7995('0x1e')],function(_0x268ce7){return{'model':db[_0x268ce7[_0x7995('0x20')]],'as':_0x268ce7['as'],'attributes':_0x268ce7[_0x7995('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x47625f){logger['info'](_0x7995('0x18'),_0x291317);logger[_0x7995('0x10')](_0x7995('0x18'),_0x291317,JSON[_0x7995('0x12')](_0x47625f));_0x37a7d4(_0x47625f);})[_0x7995('0x17')](function(_0x4b6f99){logger[_0x7995('0x13')]('ShowSquareOdbc',_0x4b6f99[_0x7995('0x15')],_0x291317);_0x4faa60(_0x1e1415[_0x7995('0x13')](0x1f4,_0x4b6f99[_0x7995('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 0092d21..fd13d86 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 _0x58a4=['post','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','get','isAuthenticated','index','show','/:id/users','create'];(function(_0x44b13e,_0x4cdca5){var _0xe700cd=function(_0x2f389d){while(--_0x2f389d){_0x44b13e['push'](_0x44b13e['shift']());}};_0xe700cd(++_0x4cdca5);}(_0x58a4,0xbf));var _0x458a=function(_0x23895f,_0x43e4a9){_0x23895f=_0x23895f-0x0;var _0x39cfc9=_0x58a4[_0x23895f];return _0x39cfc9;};'use strict';var multer=require(_0x458a('0x0'));var util=require(_0x458a('0x1'));var path=require(_0x458a('0x2'));var timeout=require(_0x458a('0x3'));var express=require(_0x458a('0x4'));var router=express[_0x458a('0x5')]();var auth=require(_0x458a('0x6'));var interaction=require(_0x458a('0x7'));var config=require(_0x458a('0x8'));var controller=require(_0x458a('0x9'));router[_0x458a('0xa')]('/',auth[_0x458a('0xb')](),controller[_0x458a('0xc')]);router['get']('/:id',auth[_0x458a('0xb')](),controller[_0x458a('0xd')]);router[_0x458a('0xa')](_0x458a('0xe'),auth[_0x458a('0xb')](),controller['getUsers']);router['post']('/',auth[_0x458a('0xb')](),controller[_0x458a('0xf')]);router[_0x458a('0x10')](_0x458a('0xe'),auth[_0x458a('0xb')](),controller['addUsers']);router[_0x458a('0x11')](_0x458a('0x12'),auth['isAuthenticated'](),controller[_0x458a('0x13')]);router[_0x458a('0x14')](_0x458a('0x12'),auth[_0x458a('0xb')](),controller[_0x458a('0x15')]);router['delete']('/:id/users',auth[_0x458a('0xb')](),controller['removeUsers']);module[_0x458a('0x16')]=router; \ No newline at end of file +var _0xd4f4=['/:id','isAuthenticated','show','/:id/users','getUsers','post','create','addUsers','put','update','destroy','delete','removeUsers','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','get'];(function(_0x2bfa06,_0x351e03){var _0x58811b=function(_0x624504){while(--_0x624504){_0x2bfa06['push'](_0x2bfa06['shift']());}};_0x58811b(++_0x351e03);}(_0xd4f4,0x8b));var _0x4d4f=function(_0x492f77,_0x39fb48){_0x492f77=_0x492f77-0x0;var _0x3c2058=_0xd4f4[_0x492f77];return _0x3c2058;};'use strict';var multer=require(_0x4d4f('0x0'));var util=require(_0x4d4f('0x1'));var path=require(_0x4d4f('0x2'));var timeout=require(_0x4d4f('0x3'));var express=require(_0x4d4f('0x4'));var router=express[_0x4d4f('0x5')]();var auth=require(_0x4d4f('0x6'));var interaction=require(_0x4d4f('0x7'));var config=require(_0x4d4f('0x8'));var controller=require(_0x4d4f('0x9'));router[_0x4d4f('0xa')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x4d4f('0xb'),auth[_0x4d4f('0xc')](),controller[_0x4d4f('0xd')]);router[_0x4d4f('0xa')](_0x4d4f('0xe'),auth[_0x4d4f('0xc')](),controller[_0x4d4f('0xf')]);router[_0x4d4f('0x10')]('/',auth[_0x4d4f('0xc')](),controller[_0x4d4f('0x11')]);router[_0x4d4f('0x10')](_0x4d4f('0xe'),auth[_0x4d4f('0xc')](),controller[_0x4d4f('0x12')]);router[_0x4d4f('0x13')](_0x4d4f('0xb'),auth[_0x4d4f('0xc')](),controller[_0x4d4f('0x14')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x4d4f('0x15')]);router[_0x4d4f('0x16')]('/:id/users',auth[_0x4d4f('0xc')](),controller[_0x4d4f('0x17')]);module[_0x4d4f('0x18')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index e228c49..95db78d 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 _0x2a8c=['toString','name','STRING','TEXT','BLOB','long','getDataValue','preproduction','utf8','production'];(function(_0x1a2d2a,_0x1a8309){var _0x3e08ab=function(_0x5555e7){while(--_0x5555e7){_0x1a2d2a['push'](_0x1a2d2a['shift']());}};_0x3e08ab(++_0x1a8309);}(_0x2a8c,0xc9));var _0xc2a8=function(_0x29b939,_0x57aa23){_0x29b939=_0x29b939-0x0;var _0x20bf72=_0x2a8c[_0x29b939];return _0x20bf72;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xc2a8('0x0'),'allowNull':![]},'description':{'type':Sequelize[_0xc2a8('0x1')]},'notes':{'type':Sequelize[_0xc2a8('0x2')]},'preproduction':{'type':Sequelize[_0xc2a8('0x3')](_0xc2a8('0x4')),'get':function(){if(this[_0xc2a8('0x5')](_0xc2a8('0x6'))){return this[_0xc2a8('0x5')](_0xc2a8('0x6'))['toString'](_0xc2a8('0x7'));}}},'production':{'type':Sequelize[_0xc2a8('0x3')](_0xc2a8('0x4')),'get':function(){if(this[_0xc2a8('0x5')](_0xc2a8('0x8'))){return this[_0xc2a8('0x5')](_0xc2a8('0x8'))[_0xc2a8('0x9')]('utf8');}}}}; \ No newline at end of file +var _0xd339=['utf8','production','sequelize','exports','name','BLOB','long','preproduction','getDataValue','toString'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0xd339,0x19c));var _0x9d33=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xd339[_0x3bf83f];return _0x22c4a9;};'use strict';var Sequelize=require(_0x9d33('0x0'));module[_0x9d33('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x9d33('0x2'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize['TEXT']},'preproduction':{'type':Sequelize[_0x9d33('0x3')](_0x9d33('0x4')),'get':function(){if(this['getDataValue'](_0x9d33('0x5'))){return this[_0x9d33('0x6')](_0x9d33('0x5'))[_0x9d33('0x7')](_0x9d33('0x8'));}}},'production':{'type':Sequelize[_0x9d33('0x3')](_0x9d33('0x4')),'get':function(){if(this[_0x9d33('0x6')](_0x9d33('0x9'))){return this[_0x9d33('0x6')](_0x9d33('0x9'))[_0x9d33('0x7')](_0x9d33('0x8'));}}}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index e0292e7..2d3ad79 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 _0xcbdb=['Content-Range','json','apply','reject','save','update','then','SquareProjects','UserProfileResource','destroy','stack','name','send','index','map','SquareProject','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','nolimit','sort','filter','where','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','keys','length','merge','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','addUsers','ids','omit','removeUsers','isArray','emit','userSquareProject:remove','getUsers','User','order','hasOwnProperty','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','squel','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','status','offset','limit','set'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0xcbdb,0x16a));var _0xbcbd=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0xcbdb[_0x618414];return _0x21c19a;};'use strict';var pdf=require(_0xbcbd('0x0'));var emlformat=require(_0xbcbd('0x1'));var rimraf=require(_0xbcbd('0x2'));var zipdir=require(_0xbcbd('0x3'));var jsonpatch=require(_0xbcbd('0x4'));var rp=require(_0xbcbd('0x5'));var moment=require(_0xbcbd('0x6'));var BPromise=require(_0xbcbd('0x7'));var Mustache=require('mustache');var util=require(_0xbcbd('0x8'));var path=require(_0xbcbd('0x9'));var sox=require('sox');var csv=require(_0xbcbd('0xa'));var ejs=require(_0xbcbd('0xb'));var fs=require('fs');var _=require(_0xbcbd('0xc'));var squel=require(_0xbcbd('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xbcbd('0xe'));var toCsv=require(_0xbcbd('0xa'));var querystring=require(_0xbcbd('0xf'));var Papa=require('papaparse');var Redis=require(_0xbcbd('0x10'));var authService=require(_0xbcbd('0x11'));var qs=require(_0xbcbd('0x12'));var as=require(_0xbcbd('0x13'));var hardwareService=require(_0xbcbd('0x14'));var logger=require(_0xbcbd('0x15'))(_0xbcbd('0x16'));var utils=require('../../config/utils');var config=require(_0xbcbd('0x17'));var db=require(_0xbcbd('0x18'))['db'];config[_0xbcbd('0x19')]=_['defaults'](config[_0xbcbd('0x19')],{'host':_0xbcbd('0x1a'),'port':0x18eb});var socket=require(_0xbcbd('0x1b'))(new Redis(config[_0xbcbd('0x19')]));require('./squareProject.socket')[_0xbcbd('0x1c')](socket);function respondWithStatusCode(_0x2000f3,_0x55f78d){_0x55f78d=_0x55f78d||0xcc;return function(_0x4ecfb4){if(_0x4ecfb4){return _0x2000f3[_0xbcbd('0x1d')](_0x55f78d);}return _0x2000f3[_0xbcbd('0x1e')](_0x55f78d)['end']();};}function respondWithResult(_0x25eaeb,_0x611b04){_0x611b04=_0x611b04||0xc8;return function(_0x2ebf0c){if(_0x2ebf0c){return _0x25eaeb['status'](_0x611b04)['json'](_0x2ebf0c);}};}function respondWithFilteredResult(_0xb0ddd2,_0x1a9530){return function(_0x32727f){if(_0x32727f){var _0x140911=_0x32727f['count'],_0x14f700=_0x1a9530[_0xbcbd('0x1f')],_0x1111c8=_0x1a9530['offset']+_0x1a9530[_0xbcbd('0x20')],_0x458c18;if(_0x1111c8>=_0x140911){_0x1111c8=_0x140911;_0x458c18=0xc8;}else{_0x458c18=0xce;}_0xb0ddd2[_0xbcbd('0x1e')](_0x458c18);return _0xb0ddd2[_0xbcbd('0x21')](_0xbcbd('0x22'),_0x14f700+'-'+_0x1111c8+'/'+_0x140911)[_0xbcbd('0x23')](_0x32727f);}return null;};}function patchUpdates(_0x37706e){return function(_0x1a464c){try{jsonpatch[_0xbcbd('0x24')](_0x1a464c,_0x37706e,!![]);}catch(_0x3c4850){return BPromise[_0xbcbd('0x25')](_0x3c4850);}return _0x1a464c[_0xbcbd('0x26')]();};}function saveUpdates(_0x2a8b0d,_0x2dac1f){return function(_0x3fbdb7){if(_0x3fbdb7){return _0x3fbdb7[_0xbcbd('0x27')](_0x2a8b0d)['then'](function(_0x563b2d){return _0x563b2d;});}return null;};}function removeEntity(_0xa4f741,_0x16d73c){return function(_0x454b66){if(_0x454b66){return _0x454b66['destroy']()[_0xbcbd('0x28')](function(){var _0x3da2ad=_0x454b66['get']({'plain':!![]});var _0x1539cb=_0xbcbd('0x29');return db[_0xbcbd('0x2a')][_0xbcbd('0x2b')]({'where':{'type':_0x1539cb,'resourceId':_0x3da2ad['id']}})[_0xbcbd('0x28')](function(){return _0x454b66;});})[_0xbcbd('0x28')](function(){_0xa4f741[_0xbcbd('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3163e0,_0x3b4c13){return function(_0x59a7aa){if(!_0x59a7aa){_0x3163e0['sendStatus'](0x194);}return _0x59a7aa;};}function handleError(_0x145d61,_0x10e93b){_0x10e93b=_0x10e93b||0x1f4;return function(_0x40bd58){logger['error'](_0x40bd58[_0xbcbd('0x2c')]);if(_0x40bd58[_0xbcbd('0x2d')]){delete _0x40bd58[_0xbcbd('0x2d')];}_0x145d61[_0xbcbd('0x1e')](_0x10e93b)[_0xbcbd('0x2e')](_0x40bd58);};}exports[_0xbcbd('0x2f')]=function(_0x394b2e,_0x2dde82){var _0x556034={},_0x5c2664={},_0x321caa={'count':0x0,'rows':[]};var _0x45bc02=_[_0xbcbd('0x30')](db[_0xbcbd('0x31')][_0xbcbd('0x32')],function(_0xa14764){return{'name':_0xa14764[_0xbcbd('0x33')],'type':_0xa14764[_0xbcbd('0x34')][_0xbcbd('0x35')]};});_0x5c2664['model']=_[_0xbcbd('0x30')](_0x45bc02,_0xbcbd('0x2d'));_0x5c2664[_0xbcbd('0x36')]=_['keys'](_0x394b2e[_0xbcbd('0x36')]);_0x5c2664[_0xbcbd('0x37')]=_[_0xbcbd('0x38')](_0x5c2664[_0xbcbd('0x39')],_0x5c2664['query']);_0x556034[_0xbcbd('0x3a')]=_[_0xbcbd('0x38')](_0x5c2664[_0xbcbd('0x39')],qs[_0xbcbd('0x3b')](_0x394b2e[_0xbcbd('0x36')][_0xbcbd('0x3b')]));_0x556034[_0xbcbd('0x3a')]=_0x556034[_0xbcbd('0x3a')]['length']?_0x556034[_0xbcbd('0x3a')]:_0x5c2664[_0xbcbd('0x39')];if(!_0x394b2e['query']['hasOwnProperty'](_0xbcbd('0x3c'))){_0x556034[_0xbcbd('0x20')]=qs[_0xbcbd('0x20')](_0x394b2e[_0xbcbd('0x36')][_0xbcbd('0x20')]);_0x556034[_0xbcbd('0x1f')]=qs[_0xbcbd('0x1f')](_0x394b2e['query'][_0xbcbd('0x1f')]);}_0x556034['order']=qs[_0xbcbd('0x3d')](_0x394b2e[_0xbcbd('0x36')][_0xbcbd('0x3d')]);_0x556034['where']=qs[_0xbcbd('0x37')](_['pick'](_0x394b2e[_0xbcbd('0x36')],_0x5c2664[_0xbcbd('0x37')]),_0x45bc02);if(_0x394b2e[_0xbcbd('0x36')][_0xbcbd('0x3e')]){_0x556034['where']=_['merge'](_0x556034[_0xbcbd('0x3f')],{'$or':_[_0xbcbd('0x30')](_0x45bc02,function(_0x2982b2){if(_0x2982b2['type']!==_0xbcbd('0x40')){var _0x406129={};_0x406129[_0x2982b2[_0xbcbd('0x2d')]]={'$like':'%'+_0x394b2e[_0xbcbd('0x36')][_0xbcbd('0x3e')]+'%'};return _0x406129;}})});}_0x556034=_['merge']({},_0x556034,_0x394b2e[_0xbcbd('0x41')]);var _0xc73e4={'where':_0x556034[_0xbcbd('0x3f')]};return db[_0xbcbd('0x31')][_0xbcbd('0x42')](_0xc73e4)[_0xbcbd('0x28')](function(_0x92ef45){_0x321caa[_0xbcbd('0x42')]=_0x92ef45;if(_0x394b2e[_0xbcbd('0x36')][_0xbcbd('0x43')]){_0x556034[_0xbcbd('0x44')]=[{'all':!![]}];}return db[_0xbcbd('0x31')][_0xbcbd('0x45')](_0x556034);})[_0xbcbd('0x28')](function(_0x1ac338){_0x321caa[_0xbcbd('0x46')]=_0x1ac338;return _0x321caa;})[_0xbcbd('0x28')](respondWithFilteredResult(_0x2dde82,_0x556034))[_0xbcbd('0x47')](handleError(_0x2dde82,null));};exports[_0xbcbd('0x48')]=function(_0x550796,_0x2228a0){var _0x24c529={'raw':![],'where':{'id':_0x550796[_0xbcbd('0x49')]['id']}},_0x3187d6={};_0x3187d6[_0xbcbd('0x39')]=_['keys'](db[_0xbcbd('0x31')][_0xbcbd('0x32')]);_0x3187d6[_0xbcbd('0x36')]=_[_0xbcbd('0x4a')](_0x550796['query']);_0x3187d6[_0xbcbd('0x37')]=_[_0xbcbd('0x38')](_0x3187d6[_0xbcbd('0x39')],_0x3187d6['query']);_0x24c529[_0xbcbd('0x3a')]=_[_0xbcbd('0x38')](_0x3187d6['model'],qs[_0xbcbd('0x3b')](_0x550796[_0xbcbd('0x36')][_0xbcbd('0x3b')]));_0x24c529[_0xbcbd('0x3a')]=_0x24c529[_0xbcbd('0x3a')][_0xbcbd('0x4b')]?_0x24c529['attributes']:_0x3187d6['model'];if(_0x550796[_0xbcbd('0x36')][_0xbcbd('0x43')]){_0x24c529['include']=[{'all':!![]}];}_0x24c529=_[_0xbcbd('0x4c')]({},_0x24c529,_0x550796[_0xbcbd('0x41')]);return db[_0xbcbd('0x31')]['find'](_0x24c529)[_0xbcbd('0x28')](handleEntityNotFound(_0x2228a0,null))[_0xbcbd('0x28')](respondWithResult(_0x2228a0,null))[_0xbcbd('0x47')](handleError(_0x2228a0,null));};exports[_0xbcbd('0x4d')]=function(_0x1b3d88,_0x30a3b5){return db['SquareProject'][_0xbcbd('0x4d')](_0x1b3d88[_0xbcbd('0x4e')],{})[_0xbcbd('0x28')](function(_0x2184b8){var _0x524b73=_0x1b3d88['user'][_0xbcbd('0x4f')]({'plain':!![]});if(!_0x524b73)throw new Error(_0xbcbd('0x50'));if(_0x524b73[_0xbcbd('0x51')]===_0xbcbd('0x52')){var _0x5ce937=_0x2184b8[_0xbcbd('0x4f')]({'plain':!![]});var _0x29fdb8=_0xbcbd('0x29');return db[_0xbcbd('0x53')]['find']({'where':{'name':_0x29fdb8,'userProfileId':_0x524b73['userProfileId']},'raw':!![]})[_0xbcbd('0x28')](function(_0x23cc05){if(_0x23cc05&&_0x23cc05[_0xbcbd('0x54')]===0x0){return db['UserProfileResource']['create']({'name':_0x5ce937[_0xbcbd('0x2d')],'resourceId':_0x5ce937['id'],'type':_0x23cc05[_0xbcbd('0x2d')],'sectionId':_0x23cc05['id']},{})['then'](function(){return _0x2184b8;});}else{return _0x2184b8;}})[_0xbcbd('0x47')](function(_0x10d33a){logger[_0xbcbd('0x55')](_0xbcbd('0x56'),_0x10d33a);throw _0x10d33a;});}return _0x2184b8;})[_0xbcbd('0x28')](respondWithResult(_0x30a3b5,0xc9))[_0xbcbd('0x47')](handleError(_0x30a3b5,null));};exports[_0xbcbd('0x27')]=function(_0x317ffb,_0x282fb1){if(_0x317ffb[_0xbcbd('0x4e')]['id']){delete _0x317ffb[_0xbcbd('0x4e')]['id'];}return db[_0xbcbd('0x31')][_0xbcbd('0x57')]({'where':{'id':_0x317ffb[_0xbcbd('0x49')]['id']}})[_0xbcbd('0x28')](handleEntityNotFound(_0x282fb1,null))['then'](saveUpdates(_0x317ffb[_0xbcbd('0x4e')],null))['then'](respondWithResult(_0x282fb1,null))['catch'](handleError(_0x282fb1,null));};exports[_0xbcbd('0x2b')]=function(_0x4f8a10,_0x5c3e9e){return db[_0xbcbd('0x31')][_0xbcbd('0x57')]({'where':{'id':_0x4f8a10[_0xbcbd('0x49')]['id']}})[_0xbcbd('0x28')](handleEntityNotFound(_0x5c3e9e,null))[_0xbcbd('0x28')](removeEntity(_0x5c3e9e,null))['catch'](handleError(_0x5c3e9e,null));};exports[_0xbcbd('0x58')]=function(_0x2fe842,_0x1b06fd,_0x28068b){return db['SquareProject'][_0xbcbd('0x57')]({'where':{'id':_0x2fe842[_0xbcbd('0x49')]['id']}})['then'](handleEntityNotFound(_0x1b06fd,null))[_0xbcbd('0x28')](function(_0x59fc9c){if(_0x59fc9c){return _0x59fc9c[_0xbcbd('0x58')](_0x2fe842['body'][_0xbcbd('0x59')],_[_0xbcbd('0x5a')](_0x2fe842[_0xbcbd('0x4e')],[_0xbcbd('0x59'),'id'])||{});}})[_0xbcbd('0x28')](respondWithResult(_0x1b06fd,null))[_0xbcbd('0x47')](handleError(_0x1b06fd,null));};exports[_0xbcbd('0x5b')]=function(_0x2b228,_0x4e266b,_0x20518f){return db[_0xbcbd('0x31')]['find']({'where':{'id':_0x2b228['params']['id']}})[_0xbcbd('0x28')](handleEntityNotFound(_0x4e266b,null))[_0xbcbd('0x28')](function(_0x59a965){if(_0x59a965){return _0x59a965['removeUsers'](_0x2b228[_0xbcbd('0x36')]['ids'])['then'](function(){if(_[_0xbcbd('0x5c')](_0x2b228[_0xbcbd('0x36')][_0xbcbd('0x59')])){for(var _0x3e285e=0x0;_0x3e285e<_0x2b228[_0xbcbd('0x36')][_0xbcbd('0x59')][_0xbcbd('0x4b')];_0x3e285e+=0x1){socket[_0xbcbd('0x5d')](_0xbcbd('0x5e'),{'UserId':Number(_0x2b228[_0xbcbd('0x36')]['ids'][_0x3e285e]),'SquareProjectId':Number(_0x2b228[_0xbcbd('0x49')]['id'])});}}else{socket[_0xbcbd('0x5d')](_0xbcbd('0x5e'),{'UserId':Number(_0x2b228['query'][_0xbcbd('0x59')]),'SquareProjectId':Number(_0x2b228[_0xbcbd('0x49')]['id'])});}});}})['then'](respondWithStatusCode(_0x4e266b,null))[_0xbcbd('0x47')](handleError(_0x4e266b,null));};exports[_0xbcbd('0x5f')]=function(_0x285f65,_0x405055,_0x1edb9c){var _0x592776={};var _0x4545fd={};var _0x20299a;var _0x42eef0;return db[_0xbcbd('0x31')]['findOne']({'where':{'id':_0x285f65[_0xbcbd('0x49')]['id']}})[_0xbcbd('0x28')](handleEntityNotFound(_0x405055,null))[_0xbcbd('0x28')](function(_0x8bbe8f){if(_0x8bbe8f){_0x20299a=_0x8bbe8f;_0x4545fd[_0xbcbd('0x39')]=_[_0xbcbd('0x4a')](db[_0xbcbd('0x60')]['rawAttributes']);_0x4545fd[_0xbcbd('0x36')]=_[_0xbcbd('0x4a')](_0x285f65[_0xbcbd('0x36')]);_0x4545fd['filters']=_[_0xbcbd('0x38')](_0x4545fd[_0xbcbd('0x39')],_0x4545fd[_0xbcbd('0x36')]);_0x592776['attributes']=_['intersection'](_0x4545fd['model'],qs['fields'](_0x285f65[_0xbcbd('0x36')]['fields']));_0x592776['attributes']=_0x592776[_0xbcbd('0x3a')]['length']?_0x592776[_0xbcbd('0x3a')]:_0x4545fd[_0xbcbd('0x39')];_0x592776[_0xbcbd('0x61')]=qs[_0xbcbd('0x3d')](_0x285f65[_0xbcbd('0x36')][_0xbcbd('0x3d')]);_0x592776[_0xbcbd('0x3f')]=qs[_0xbcbd('0x37')](_['pick'](_0x285f65[_0xbcbd('0x36')],_0x4545fd[_0xbcbd('0x37')]));if(_0x285f65[_0xbcbd('0x36')][_0xbcbd('0x3e')]){_0x592776[_0xbcbd('0x3f')]=_[_0xbcbd('0x4c')](_0x592776[_0xbcbd('0x3f')],{'$or':_[_0xbcbd('0x30')](_0x592776[_0xbcbd('0x3a')],function(_0xce48a5){var _0x44d990={};_0x44d990[_0xce48a5]={'$like':'%'+_0x285f65[_0xbcbd('0x36')][_0xbcbd('0x3e')]+'%'};return _0x44d990;})});}_0x592776=_[_0xbcbd('0x4c')]({},_0x592776,_0x285f65[_0xbcbd('0x41')]);return _0x20299a['getUsers'](_0x592776);}})[_0xbcbd('0x28')](function(_0x14327b){if(_0x14327b){_0x42eef0=_0x14327b[_0xbcbd('0x4b')];if(!_0x285f65[_0xbcbd('0x36')][_0xbcbd('0x62')](_0xbcbd('0x3c'))){_0x592776['limit']=qs[_0xbcbd('0x20')](_0x285f65[_0xbcbd('0x36')][_0xbcbd('0x20')]);_0x592776['offset']=qs[_0xbcbd('0x1f')](_0x285f65['query'][_0xbcbd('0x1f')]);}return _0x20299a[_0xbcbd('0x5f')](_0x592776);}})['then'](function(_0x2b95ef){if(_0x2b95ef){return _0x2b95ef?{'count':_0x42eef0,'rows':_0x2b95ef}:null;}})[_0xbcbd('0x28')](respondWithResult(_0x405055,null))[_0xbcbd('0x47')](handleError(_0x405055,null));}; \ No newline at end of file +var _0xceec=['../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','update','then','destroy','SquareProjects','stack','name','send','index','map','SquareProject','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','show','params','rawAttributes','include','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addUsers','ids','omit','removeUsers','isArray','emit','userSquareProject:remove','getUsers','findOne','User','order','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','to-csv','ejs','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment'];(function(_0x307527,_0x59c898){var _0x1ad800=function(_0x21a9bb){while(--_0x21a9bb){_0x307527['push'](_0x307527['shift']());}};_0x1ad800(++_0x59c898);}(_0xceec,0x1be));var _0xccee=function(_0x363149,_0x39aa00){_0x363149=_0x363149-0x0;var _0x201134=_0xceec[_0x363149];return _0x201134;};'use strict';var pdf=require(_0xccee('0x0'));var emlformat=require(_0xccee('0x1'));var rimraf=require(_0xccee('0x2'));var zipdir=require(_0xccee('0x3'));var jsonpatch=require(_0xccee('0x4'));var rp=require(_0xccee('0x5'));var moment=require('moment');var BPromise=require(_0xccee('0x6'));var Mustache=require(_0xccee('0x7'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xccee('0x8'));var ejs=require(_0xccee('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xccee('0xa'));var toCsv=require(_0xccee('0x8'));var querystring=require(_0xccee('0xb'));var Papa=require(_0xccee('0xc'));var Redis=require(_0xccee('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xccee('0xe'));var hardwareService=require(_0xccee('0xf'));var logger=require('../../config/logger')(_0xccee('0x10'));var utils=require(_0xccee('0x11'));var config=require(_0xccee('0x12'));var db=require(_0xccee('0x13'))['db'];config[_0xccee('0x14')]=_['defaults'](config[_0xccee('0x14')],{'host':_0xccee('0x15'),'port':0x18eb});var socket=require(_0xccee('0x16'))(new Redis(config[_0xccee('0x14')]));require('./squareProject.socket')[_0xccee('0x17')](socket);function respondWithStatusCode(_0x3d1f91,_0x44de17){_0x44de17=_0x44de17||0xcc;return function(_0xfd0ea3){if(_0xfd0ea3){return _0x3d1f91[_0xccee('0x18')](_0x44de17);}return _0x3d1f91[_0xccee('0x19')](_0x44de17)[_0xccee('0x1a')]();};}function respondWithResult(_0x855e6d,_0x906452){_0x906452=_0x906452||0xc8;return function(_0x33a6ce){if(_0x33a6ce){return _0x855e6d[_0xccee('0x19')](_0x906452)[_0xccee('0x1b')](_0x33a6ce);}};}function respondWithFilteredResult(_0x2b4c11,_0x412014){return function(_0x295995){if(_0x295995){var _0x156dbe=_0x295995[_0xccee('0x1c')],_0x396c3d=_0x412014[_0xccee('0x1d')],_0x418f2b=_0x412014[_0xccee('0x1d')]+_0x412014['limit'],_0xea7e51;if(_0x418f2b>=_0x156dbe){_0x418f2b=_0x156dbe;_0xea7e51=0xc8;}else{_0xea7e51=0xce;}_0x2b4c11['status'](_0xea7e51);return _0x2b4c11[_0xccee('0x1e')](_0xccee('0x1f'),_0x396c3d+'-'+_0x418f2b+'/'+_0x156dbe)[_0xccee('0x1b')](_0x295995);}return null;};}function patchUpdates(_0x5d6923){return function(_0x8b394f){try{jsonpatch[_0xccee('0x20')](_0x8b394f,_0x5d6923,!![]);}catch(_0x1af621){return BPromise[_0xccee('0x21')](_0x1af621);}return _0x8b394f['save']();};}function saveUpdates(_0x2001f1,_0x9199f5){return function(_0x6feba){if(_0x6feba){return _0x6feba[_0xccee('0x22')](_0x2001f1)[_0xccee('0x23')](function(_0x26b24a){return _0x26b24a;});}return null;};}function removeEntity(_0xdd9a3b,_0x49a459){return function(_0x1295a5){if(_0x1295a5){return _0x1295a5[_0xccee('0x24')]()[_0xccee('0x23')](function(){var _0x12cd02=_0x1295a5['get']({'plain':!![]});var _0x491798=_0xccee('0x25');return db['UserProfileResource'][_0xccee('0x24')]({'where':{'type':_0x491798,'resourceId':_0x12cd02['id']}})[_0xccee('0x23')](function(){return _0x1295a5;});})[_0xccee('0x23')](function(){_0xdd9a3b[_0xccee('0x19')](0xcc)[_0xccee('0x1a')]();});}};}function handleEntityNotFound(_0x414743,_0x339220){return function(_0x38f084){if(!_0x38f084){_0x414743[_0xccee('0x18')](0x194);}return _0x38f084;};}function handleError(_0x126d53,_0x15893e){_0x15893e=_0x15893e||0x1f4;return function(_0x2d8203){logger['error'](_0x2d8203[_0xccee('0x26')]);if(_0x2d8203[_0xccee('0x27')]){delete _0x2d8203[_0xccee('0x27')];}_0x126d53[_0xccee('0x19')](_0x15893e)[_0xccee('0x28')](_0x2d8203);};}exports[_0xccee('0x29')]=function(_0x47dbce,_0x36ace1){var _0x1c3cdc={},_0x4fb058={},_0x5147e5={'count':0x0,'rows':[]};var _0x8d258d=_[_0xccee('0x2a')](db[_0xccee('0x2b')]['rawAttributes'],function(_0x529340){return{'name':_0x529340['fieldName'],'type':_0x529340[_0xccee('0x2c')][_0xccee('0x2d')]};});_0x4fb058['model']=_[_0xccee('0x2a')](_0x8d258d,_0xccee('0x27'));_0x4fb058[_0xccee('0x2e')]=_[_0xccee('0x2f')](_0x47dbce[_0xccee('0x2e')]);_0x4fb058[_0xccee('0x30')]=_[_0xccee('0x31')](_0x4fb058[_0xccee('0x32')],_0x4fb058[_0xccee('0x2e')]);_0x1c3cdc['attributes']=_['intersection'](_0x4fb058[_0xccee('0x32')],qs['fields'](_0x47dbce['query'][_0xccee('0x33')]));_0x1c3cdc[_0xccee('0x34')]=_0x1c3cdc[_0xccee('0x34')][_0xccee('0x35')]?_0x1c3cdc['attributes']:_0x4fb058['model'];if(!_0x47dbce[_0xccee('0x2e')][_0xccee('0x36')](_0xccee('0x37'))){_0x1c3cdc[_0xccee('0x38')]=qs[_0xccee('0x38')](_0x47dbce[_0xccee('0x2e')][_0xccee('0x38')]);_0x1c3cdc[_0xccee('0x1d')]=qs[_0xccee('0x1d')](_0x47dbce[_0xccee('0x2e')][_0xccee('0x1d')]);}_0x1c3cdc['order']=qs[_0xccee('0x39')](_0x47dbce[_0xccee('0x2e')][_0xccee('0x39')]);_0x1c3cdc[_0xccee('0x3a')]=qs[_0xccee('0x30')](_[_0xccee('0x3b')](_0x47dbce[_0xccee('0x2e')],_0x4fb058[_0xccee('0x30')]),_0x8d258d);if(_0x47dbce[_0xccee('0x2e')][_0xccee('0x3c')]){_0x1c3cdc[_0xccee('0x3a')]=_[_0xccee('0x3d')](_0x1c3cdc[_0xccee('0x3a')],{'$or':_['map'](_0x8d258d,function(_0x7abbf6){if(_0x7abbf6[_0xccee('0x2c')]!==_0xccee('0x3e')){var _0x3ebde2={};_0x3ebde2[_0x7abbf6['name']]={'$like':'%'+_0x47dbce[_0xccee('0x2e')][_0xccee('0x3c')]+'%'};return _0x3ebde2;}})});}_0x1c3cdc=_['merge']({},_0x1c3cdc,_0x47dbce[_0xccee('0x3f')]);var _0x1e6238={'where':_0x1c3cdc[_0xccee('0x3a')]};return db['SquareProject'][_0xccee('0x1c')](_0x1e6238)[_0xccee('0x23')](function(_0x483df7){_0x5147e5['count']=_0x483df7;if(_0x47dbce[_0xccee('0x2e')][_0xccee('0x40')]){_0x1c3cdc['include']=[{'all':!![]}];}return db[_0xccee('0x2b')]['findAll'](_0x1c3cdc);})[_0xccee('0x23')](function(_0x5b4832){_0x5147e5[_0xccee('0x41')]=_0x5b4832;return _0x5147e5;})[_0xccee('0x23')](respondWithFilteredResult(_0x36ace1,_0x1c3cdc))[_0xccee('0x42')](handleError(_0x36ace1,null));};exports[_0xccee('0x43')]=function(_0x24aa97,_0x2654cf){var _0x3f798e={'raw':![],'where':{'id':_0x24aa97[_0xccee('0x44')]['id']}},_0x29d7a9={};_0x29d7a9[_0xccee('0x32')]=_[_0xccee('0x2f')](db[_0xccee('0x2b')][_0xccee('0x45')]);_0x29d7a9['query']=_[_0xccee('0x2f')](_0x24aa97['query']);_0x29d7a9[_0xccee('0x30')]=_[_0xccee('0x31')](_0x29d7a9[_0xccee('0x32')],_0x29d7a9['query']);_0x3f798e[_0xccee('0x34')]=_[_0xccee('0x31')](_0x29d7a9[_0xccee('0x32')],qs['fields'](_0x24aa97[_0xccee('0x2e')][_0xccee('0x33')]));_0x3f798e[_0xccee('0x34')]=_0x3f798e[_0xccee('0x34')][_0xccee('0x35')]?_0x3f798e['attributes']:_0x29d7a9['model'];if(_0x24aa97[_0xccee('0x2e')][_0xccee('0x40')]){_0x3f798e[_0xccee('0x46')]=[{'all':!![]}];}_0x3f798e=_[_0xccee('0x3d')]({},_0x3f798e,_0x24aa97[_0xccee('0x3f')]);return db['SquareProject'][_0xccee('0x47')](_0x3f798e)['then'](handleEntityNotFound(_0x2654cf,null))[_0xccee('0x23')](respondWithResult(_0x2654cf,null))[_0xccee('0x42')](handleError(_0x2654cf,null));};exports[_0xccee('0x48')]=function(_0x2a7878,_0x344d85){return db[_0xccee('0x2b')]['create'](_0x2a7878[_0xccee('0x49')],{})[_0xccee('0x23')](function(_0xa9587d){var _0x149f0c=_0x2a7878[_0xccee('0x4a')][_0xccee('0x4b')]({'plain':!![]});if(!_0x149f0c)throw new Error(_0xccee('0x4c'));if(_0x149f0c[_0xccee('0x4d')]===_0xccee('0x4a')){var _0x29af40=_0xa9587d[_0xccee('0x4b')]({'plain':!![]});var _0x2bdb5d=_0xccee('0x25');return db['UserProfileSection']['find']({'where':{'name':_0x2bdb5d,'userProfileId':_0x149f0c[_0xccee('0x4e')]},'raw':!![]})[_0xccee('0x23')](function(_0x17bffa){if(_0x17bffa&&_0x17bffa['autoAssociation']===0x0){return db[_0xccee('0x4f')][_0xccee('0x48')]({'name':_0x29af40['name'],'resourceId':_0x29af40['id'],'type':_0x17bffa[_0xccee('0x27')],'sectionId':_0x17bffa['id']},{})[_0xccee('0x23')](function(){return _0xa9587d;});}else{return _0xa9587d;}})[_0xccee('0x42')](function(_0xcee34f){logger[_0xccee('0x50')](_0xccee('0x51'),_0xcee34f);throw _0xcee34f;});}return _0xa9587d;})['then'](respondWithResult(_0x344d85,0xc9))[_0xccee('0x42')](handleError(_0x344d85,null));};exports[_0xccee('0x22')]=function(_0xae9e0b,_0x20787b){if(_0xae9e0b['body']['id']){delete _0xae9e0b[_0xccee('0x49')]['id'];}return db['SquareProject']['find']({'where':{'id':_0xae9e0b[_0xccee('0x44')]['id']}})[_0xccee('0x23')](handleEntityNotFound(_0x20787b,null))['then'](saveUpdates(_0xae9e0b[_0xccee('0x49')],null))[_0xccee('0x23')](respondWithResult(_0x20787b,null))[_0xccee('0x42')](handleError(_0x20787b,null));};exports['destroy']=function(_0x38fd11,_0x282016){return db[_0xccee('0x2b')]['find']({'where':{'id':_0x38fd11[_0xccee('0x44')]['id']}})['then'](handleEntityNotFound(_0x282016,null))[_0xccee('0x23')](removeEntity(_0x282016,null))[_0xccee('0x42')](handleError(_0x282016,null));};exports[_0xccee('0x52')]=function(_0x1887ea,_0x4236e8,_0x3d185c){return db[_0xccee('0x2b')][_0xccee('0x47')]({'where':{'id':_0x1887ea[_0xccee('0x44')]['id']}})[_0xccee('0x23')](handleEntityNotFound(_0x4236e8,null))[_0xccee('0x23')](function(_0x29cbec){if(_0x29cbec){return _0x29cbec[_0xccee('0x52')](_0x1887ea['body'][_0xccee('0x53')],_[_0xccee('0x54')](_0x1887ea[_0xccee('0x49')],[_0xccee('0x53'),'id'])||{});}})['then'](respondWithResult(_0x4236e8,null))[_0xccee('0x42')](handleError(_0x4236e8,null));};exports[_0xccee('0x55')]=function(_0x5e80dd,_0x24af4c,_0x13914e){return db['SquareProject'][_0xccee('0x47')]({'where':{'id':_0x5e80dd[_0xccee('0x44')]['id']}})['then'](handleEntityNotFound(_0x24af4c,null))[_0xccee('0x23')](function(_0x54d66b){if(_0x54d66b){return _0x54d66b[_0xccee('0x55')](_0x5e80dd[_0xccee('0x2e')][_0xccee('0x53')])[_0xccee('0x23')](function(){if(_[_0xccee('0x56')](_0x5e80dd['query']['ids'])){for(var _0x27c504=0x0;_0x27c504<_0x5e80dd[_0xccee('0x2e')][_0xccee('0x53')]['length'];_0x27c504+=0x1){socket['emit']('userSquareProject:remove',{'UserId':Number(_0x5e80dd[_0xccee('0x2e')][_0xccee('0x53')][_0x27c504]),'SquareProjectId':Number(_0x5e80dd[_0xccee('0x44')]['id'])});}}else{socket[_0xccee('0x57')](_0xccee('0x58'),{'UserId':Number(_0x5e80dd[_0xccee('0x2e')]['ids']),'SquareProjectId':Number(_0x5e80dd[_0xccee('0x44')]['id'])});}});}})[_0xccee('0x23')](respondWithStatusCode(_0x24af4c,null))['catch'](handleError(_0x24af4c,null));};exports[_0xccee('0x59')]=function(_0xd7618b,_0x18cf3c,_0x36447a){var _0x98c1c4={};var _0x476e77={};var _0xaf707f;var _0x9dbff5;return db['SquareProject'][_0xccee('0x5a')]({'where':{'id':_0xd7618b[_0xccee('0x44')]['id']}})[_0xccee('0x23')](handleEntityNotFound(_0x18cf3c,null))[_0xccee('0x23')](function(_0x1a2b1d){if(_0x1a2b1d){_0xaf707f=_0x1a2b1d;_0x476e77[_0xccee('0x32')]=_['keys'](db[_0xccee('0x5b')][_0xccee('0x45')]);_0x476e77[_0xccee('0x2e')]=_[_0xccee('0x2f')](_0xd7618b['query']);_0x476e77[_0xccee('0x30')]=_['intersection'](_0x476e77['model'],_0x476e77[_0xccee('0x2e')]);_0x98c1c4[_0xccee('0x34')]=_[_0xccee('0x31')](_0x476e77[_0xccee('0x32')],qs[_0xccee('0x33')](_0xd7618b[_0xccee('0x2e')][_0xccee('0x33')]));_0x98c1c4[_0xccee('0x34')]=_0x98c1c4['attributes']['length']?_0x98c1c4[_0xccee('0x34')]:_0x476e77[_0xccee('0x32')];_0x98c1c4[_0xccee('0x5c')]=qs[_0xccee('0x39')](_0xd7618b[_0xccee('0x2e')]['sort']);_0x98c1c4[_0xccee('0x3a')]=qs['filters'](_['pick'](_0xd7618b[_0xccee('0x2e')],_0x476e77[_0xccee('0x30')]));if(_0xd7618b[_0xccee('0x2e')][_0xccee('0x3c')]){_0x98c1c4['where']=_[_0xccee('0x3d')](_0x98c1c4['where'],{'$or':_[_0xccee('0x2a')](_0x98c1c4[_0xccee('0x34')],function(_0x6b05d3){var _0x31f8ea={};_0x31f8ea[_0x6b05d3]={'$like':'%'+_0xd7618b[_0xccee('0x2e')][_0xccee('0x3c')]+'%'};return _0x31f8ea;})});}_0x98c1c4=_[_0xccee('0x3d')]({},_0x98c1c4,_0xd7618b[_0xccee('0x3f')]);return _0xaf707f[_0xccee('0x59')](_0x98c1c4);}})['then'](function(_0x1975a3){if(_0x1975a3){_0x9dbff5=_0x1975a3[_0xccee('0x35')];if(!_0xd7618b[_0xccee('0x2e')][_0xccee('0x36')](_0xccee('0x37'))){_0x98c1c4[_0xccee('0x38')]=qs[_0xccee('0x38')](_0xd7618b[_0xccee('0x2e')][_0xccee('0x38')]);_0x98c1c4[_0xccee('0x1d')]=qs[_0xccee('0x1d')](_0xd7618b[_0xccee('0x2e')]['offset']);}return _0xaf707f['getUsers'](_0x98c1c4);}})[_0xccee('0x23')](function(_0x43424e){if(_0x43424e){return _0x43424e?{'count':_0x9dbff5,'rows':_0x43424e}:null;}})[_0xccee('0x23')](respondWithResult(_0x18cf3c,null))['catch'](handleError(_0x18cf3c,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index c6019de..d74086e 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 _0x860a=['setMaxListeners','save','update','remove','emit','exports','events','../../mysqldb','SquareProject'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x860a,0x14a));var _0xa860=function(_0xbb432,_0x44dc55){_0xbb432=_0xbb432-0x0;var _0x18be1e=_0x860a[_0xbb432];return _0x18be1e;};'use strict';var EventEmitter=require(_0xa860('0x0'));var SquareProject=require(_0xa860('0x1'))['db'][_0xa860('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xa860('0x3')](0x0);var events={'afterCreate':_0xa860('0x4'),'afterUpdate':_0xa860('0x5'),'afterDestroy':_0xa860('0x6')};function emitEvent(_0x4daba9){return function(_0x138944,_0x4c42be,_0x66b2c1){SquareProjectEvents[_0xa860('0x7')](_0x4daba9+':'+_0x138944['id'],_0x138944);SquareProjectEvents[_0xa860('0x7')](_0x4daba9,_0x138944);_0x66b2c1(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject['hook'](e,emitEvent(event));}}module[_0xa860('0x8')]=SquareProjectEvents; \ No newline at end of file +var _0x2617=['emit','hasOwnProperty','hook','exports','events','setMaxListeners','save','update','remove'];(function(_0x1477ef,_0x54a5d6){var _0x164acd=function(_0x139149){while(--_0x139149){_0x1477ef['push'](_0x1477ef['shift']());}};_0x164acd(++_0x54a5d6);}(_0x2617,0xb8));var _0x7261=function(_0x799277,_0x574d5f){_0x799277=_0x799277-0x0;var _0x56d41f=_0x2617[_0x799277];return _0x56d41f;};'use strict';var EventEmitter=require(_0x7261('0x0'));var SquareProject=require('../../mysqldb')['db']['SquareProject'];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x7261('0x1')](0x0);var events={'afterCreate':_0x7261('0x2'),'afterUpdate':_0x7261('0x3'),'afterDestroy':_0x7261('0x4')};function emitEvent(_0x5c5757){return function(_0x3639be,_0xf79a3,_0x155ea3){SquareProjectEvents[_0x7261('0x5')](_0x5c5757+':'+_0x3639be['id'],_0x3639be);SquareProjectEvents[_0x7261('0x5')](_0x5c5757,_0x3639be);_0x155ea3(null);};}for(var e in events){if(events[_0x7261('0x6')](e)){var event=events[e];SquareProject[_0x7261('0x7')](e,emitEvent(event));}}module[_0x7261('0x8')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 2db3f2f..a7a50cd 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 _0x9dd6=['../../config/environment','define','SquareProject','square_projects','lodash','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0x9dd6,0x1dd));var _0x69dd=function(_0x55bcf3,_0x3d51f2){_0x55bcf3=_0x55bcf3-0x0;var _0x239514=_0x9dd6[_0x55bcf3];return _0x239514;};'use strict';var _=require(_0x69dd('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x69dd('0x1'));var moment=require(_0x69dd('0x2'));var BPromise=require(_0x69dd('0x3'));var rp=require(_0x69dd('0x4'));var fs=require('fs');var path=require(_0x69dd('0x5'));var rimraf=require(_0x69dd('0x6'));var config=require(_0x69dd('0x7'));var attributes=require('./squareProject.attributes');module['exports']=function(_0x5b6b05,_0x37cbe1){return _0x5b6b05[_0x69dd('0x8')](_0x69dd('0x9'),attributes,{'tableName':_0x69dd('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2f75=['lodash','util','../../config/logger','api','moment','bluebird','../../config/environment','./squareProject.attributes','exports','square_projects'];(function(_0x4f6a26,_0x2bf3e8){var _0x473580=function(_0x972c88){while(--_0x972c88){_0x4f6a26['push'](_0x4f6a26['shift']());}};_0x473580(++_0x2bf3e8);}(_0x2f75,0x6e));var _0x52f7=function(_0x54e879,_0x3d40d4){_0x54e879=_0x54e879-0x0;var _0x196119=_0x2f75[_0x54e879];return _0x196119;};'use strict';var _=require(_0x52f7('0x0'));var util=require(_0x52f7('0x1'));var logger=require(_0x52f7('0x2'))(_0x52f7('0x3'));var moment=require(_0x52f7('0x4'));var BPromise=require(_0x52f7('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x52f7('0x6'));var attributes=require(_0x52f7('0x7'));module[_0x52f7('0x8')]=function(_0x50744c,_0x3d46f8){return _0x50744c['define']('SquareProject',attributes,{'tableName':_0x52f7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 46e7684..2aea31d 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 _0x5704=['catch','ShowSquareProject','SquareProject','find','options','raw','where','attributes','include','map','model','then','debug','stringify','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','localhost','socket.io-emitter','./squareProject.socket','info','request\x20sent','SquareProject,\x20%s,\x20%s,\x20%s','error','message','SquareProject,\x20%s,\x20%s'];(function(_0x4d79bc,_0x32c905){var _0x4b4760=function(_0x212302){while(--_0x212302){_0x4d79bc['push'](_0x4d79bc['shift']());}};_0x4b4760(++_0x32c905);}(_0x5704,0x9a));var _0x4570=function(_0x3cac17,_0x174a50){_0x3cac17=_0x3cac17-0x0;var _0x38e3be=_0x5704[_0x3cac17];return _0x38e3be;};'use strict';var _=require(_0x4570('0x0'));var util=require(_0x4570('0x1'));var moment=require(_0x4570('0x2'));var BPromise=require(_0x4570('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4570('0x4'));var db=require(_0x4570('0x5'))['db'];var utils=require(_0x4570('0x6'));var logger=require(_0x4570('0x7'))(_0x4570('0x8'));var config=require('../../config/environment');var jayson=require(_0x4570('0x9'));var client=jayson[_0x4570('0xa')]['http']({'port':0x232a});config[_0x4570('0xb')]=_['defaults'](config['redis'],{'host':_0x4570('0xc'),'port':0x18eb});var socket=require(_0x4570('0xd'))(new Redis(config[_0x4570('0xb')]));require(_0x4570('0xe'))['register'](socket);function respondWithRpcPromise(_0xea31b9,_0x3aa1f2,_0x3db862){return new BPromise(function(_0x5ce60d,_0x43a229){return client['request'](_0xea31b9,_0x3db862)['then'](function(_0x4604d0){logger[_0x4570('0xf')]('SquareProject,\x20%s,\x20%s',_0x3aa1f2,_0x4570('0x10'));logger['debug'](_0x4570('0x11'),_0x3aa1f2,_0x4570('0x10'),JSON['stringify'](_0x4604d0));if(_0x4604d0['error']){if(_0x4604d0[_0x4570('0x12')]['code']===0x1f4){logger[_0x4570('0x12')]('SquareProject,\x20%s,\x20%s',_0x3aa1f2,_0x4604d0['error']['message']);return _0x43a229(_0x4604d0['error'][_0x4570('0x13')]);}logger[_0x4570('0x12')](_0x4570('0x14'),_0x3aa1f2,_0x4604d0[_0x4570('0x12')][_0x4570('0x13')]);return _0x5ce60d(_0x4604d0['error'][_0x4570('0x13')]);}else{logger['info']('SquareProject,\x20%s,\x20%s',_0x3aa1f2,_0x4570('0x10'));_0x5ce60d(_0x4604d0['result']['message']);}})[_0x4570('0x15')](function(_0x14113c){logger[_0x4570('0x12')]('SquareProject,\x20%s,\x20%s',_0x3aa1f2,_0x14113c);_0x43a229(_0x14113c);});});}exports[_0x4570('0x16')]=function(_0x4c636f){var _0x1f227e=this;return new Promise(function(_0x209918,_0x38ee6a){return db[_0x4570('0x17')][_0x4570('0x18')]({'raw':_0x4c636f[_0x4570('0x19')]?_0x4c636f['options'][_0x4570('0x1a')]===undefined?!![]:![]:!![],'where':_0x4c636f[_0x4570('0x19')]?_0x4c636f['options'][_0x4570('0x1b')]||null:null,'attributes':_0x4c636f[_0x4570('0x19')]?_0x4c636f[_0x4570('0x19')][_0x4570('0x1c')]||null:null,'include':_0x4c636f[_0x4570('0x19')]?_0x4c636f[_0x4570('0x19')][_0x4570('0x1d')]?_[_0x4570('0x1e')](_0x4c636f[_0x4570('0x19')]['include'],function(_0x1f14f7){return{'model':db[_0x1f14f7[_0x4570('0x1f')]],'as':_0x1f14f7['as'],'attributes':_0x1f14f7[_0x4570('0x1c')],'include':_0x1f14f7[_0x4570('0x1d')]?_[_0x4570('0x1e')](_0x1f14f7[_0x4570('0x1d')],function(_0x4a6dc6){return{'model':db[_0x4a6dc6[_0x4570('0x1f')]],'as':_0x4a6dc6['as'],'attributes':_0x4a6dc6[_0x4570('0x1c')],'include':_0x4a6dc6[_0x4570('0x1d')]?_['map'](_0x4a6dc6[_0x4570('0x1d')],function(_0x432c99){return{'model':db[_0x432c99[_0x4570('0x1f')]],'as':_0x432c99['as'],'attributes':_0x432c99[_0x4570('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x4570('0x20')](function(_0x322d17){logger[_0x4570('0xf')](_0x4570('0x16'),_0x4c636f);logger[_0x4570('0x21')](_0x4570('0x16'),_0x4c636f,JSON[_0x4570('0x22')](_0x322d17));_0x209918(_0x322d17);})['catch'](function(_0x33eddc){logger['error'](_0x4570('0x16'),_0x33eddc[_0x4570('0x13')],_0x4c636f);_0x38ee6a(_0x1f227e[_0x4570('0x12')](0x1f4,_0x33eddc[_0x4570('0x13')]));});});}; \ No newline at end of file +var _0x1e20=['socket.io-emitter','./squareProject.socket','register','request','then','request\x20sent','SquareProject,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareProject,\x20%s,\x20%s','message','info','result','catch','ShowSquareProject','SquareProject','options','raw','where','map','model','include','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','redis'];(function(_0x270f3e,_0x3eb4a7){var _0x3c291f=function(_0xaa2891){while(--_0xaa2891){_0x270f3e['push'](_0x270f3e['shift']());}};_0x3c291f(++_0x3eb4a7);}(_0x1e20,0x128));var _0x01e2=function(_0xf5b5ff,_0x503a3f){_0xf5b5ff=_0xf5b5ff-0x0;var _0x4e032a=_0x1e20[_0xf5b5ff];return _0x4e032a;};'use strict';var _=require(_0x01e2('0x0'));var util=require(_0x01e2('0x1'));var moment=require(_0x01e2('0x2'));var BPromise=require(_0x01e2('0x3'));var rs=require(_0x01e2('0x4'));var fs=require('fs');var Redis=require(_0x01e2('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x01e2('0x6'));var logger=require(_0x01e2('0x7'))('rpc');var config=require(_0x01e2('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x01e2('0x9')]=_['defaults'](config[_0x01e2('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x01e2('0xa'))(new Redis(config['redis']));require(_0x01e2('0xb'))[_0x01e2('0xc')](socket);function respondWithRpcPromise(_0x1af73f,_0x171af9,_0x47be8f){return new BPromise(function(_0x35f098,_0x28423c){return client[_0x01e2('0xd')](_0x1af73f,_0x47be8f)[_0x01e2('0xe')](function(_0x546212){logger['info']('SquareProject,\x20%s,\x20%s',_0x171af9,_0x01e2('0xf'));logger['debug'](_0x01e2('0x10'),_0x171af9,'request\x20sent',JSON[_0x01e2('0x11')](_0x546212));if(_0x546212[_0x01e2('0x12')]){if(_0x546212[_0x01e2('0x12')][_0x01e2('0x13')]===0x1f4){logger[_0x01e2('0x12')](_0x01e2('0x14'),_0x171af9,_0x546212[_0x01e2('0x12')][_0x01e2('0x15')]);return _0x28423c(_0x546212[_0x01e2('0x12')][_0x01e2('0x15')]);}logger['error'](_0x01e2('0x14'),_0x171af9,_0x546212['error'][_0x01e2('0x15')]);return _0x35f098(_0x546212[_0x01e2('0x12')][_0x01e2('0x15')]);}else{logger[_0x01e2('0x16')](_0x01e2('0x14'),_0x171af9,_0x01e2('0xf'));_0x35f098(_0x546212[_0x01e2('0x17')][_0x01e2('0x15')]);}})[_0x01e2('0x18')](function(_0x132f88){logger[_0x01e2('0x12')]('SquareProject,\x20%s,\x20%s',_0x171af9,_0x132f88);_0x28423c(_0x132f88);});});}exports[_0x01e2('0x19')]=function(_0x2a3693){var _0x4ebaca=this;return new Promise(function(_0xb9b346,_0x54d868){return db[_0x01e2('0x1a')]['find']({'raw':_0x2a3693[_0x01e2('0x1b')]?_0x2a3693[_0x01e2('0x1b')][_0x01e2('0x1c')]===undefined?!![]:![]:!![],'where':_0x2a3693[_0x01e2('0x1b')]?_0x2a3693[_0x01e2('0x1b')][_0x01e2('0x1d')]||null:null,'attributes':_0x2a3693[_0x01e2('0x1b')]?_0x2a3693[_0x01e2('0x1b')]['attributes']||null:null,'include':_0x2a3693['options']?_0x2a3693[_0x01e2('0x1b')]['include']?_[_0x01e2('0x1e')](_0x2a3693[_0x01e2('0x1b')]['include'],function(_0x46fdc6){return{'model':db[_0x46fdc6[_0x01e2('0x1f')]],'as':_0x46fdc6['as'],'attributes':_0x46fdc6['attributes'],'include':_0x46fdc6[_0x01e2('0x20')]?_[_0x01e2('0x1e')](_0x46fdc6[_0x01e2('0x20')],function(_0x59a05f){return{'model':db[_0x59a05f['model']],'as':_0x59a05f['as'],'attributes':_0x59a05f[_0x01e2('0x21')],'include':_0x59a05f[_0x01e2('0x20')]?_[_0x01e2('0x1e')](_0x59a05f[_0x01e2('0x20')],function(_0x1fb8ad){return{'model':db[_0x1fb8ad[_0x01e2('0x1f')]],'as':_0x1fb8ad['as'],'attributes':_0x1fb8ad[_0x01e2('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x27580b){logger['info'](_0x01e2('0x19'),_0x2a3693);logger['debug'](_0x01e2('0x19'),_0x2a3693,JSON['stringify'](_0x27580b));_0xb9b346(_0x27580b);})['catch'](function(_0x464278){logger[_0x01e2('0x12')]('ShowSquareProject',_0x464278[_0x01e2('0x15')],_0x2a3693);_0x54d868(_0x4ebaca['error'](0x1f4,_0x464278[_0x01e2('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 60bdb4b..f598c4a 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 _0x0295=['emit','removeListener','register','squareProject:','./squareProject.events','update'];(function(_0x20be7f,_0x3ca238){var _0x2b7dd7=function(_0x3e581f){while(--_0x3e581f){_0x20be7f['push'](_0x20be7f['shift']());}};_0x2b7dd7(++_0x3ca238);}(_0x0295,0x1f0));var _0x5029=function(_0x2b7cec,_0x948c5d){_0x2b7cec=_0x2b7cec-0x0;var _0x5c7780=_0x0295[_0x2b7cec];return _0x5c7780;};'use strict';var SquareProjectEvents=require(_0x5029('0x0'));var events=['save','remove',_0x5029('0x1')];function createListener(_0x4f552a,_0x53c2e1){return function(_0x315589){_0x53c2e1[_0x5029('0x2')](_0x4f552a,_0x315589);};}function removeListener(_0x157a4f,_0x3d0af1){return function(){SquareProjectEvents[_0x5029('0x3')](_0x157a4f,_0x3d0af1);};}exports[_0x5029('0x4')]=function(_0x200217){for(var _0x215955=0x0,_0x5b3cd=events['length'];_0x215955<_0x5b3cd;_0x215955++){var _0x54978f=events[_0x215955];var _0x4ee867=createListener(_0x5029('0x5')+_0x54978f,_0x200217);SquareProjectEvents['on'](_0x54978f,_0x4ee867);}}; \ No newline at end of file +var _0x7a54=['remove','emit','removeListener','register','length','squareProject:','./squareProject.events','save'];(function(_0x3bee9a,_0x23e022){var _0x30ceaf=function(_0xa26406){while(--_0xa26406){_0x3bee9a['push'](_0x3bee9a['shift']());}};_0x30ceaf(++_0x23e022);}(_0x7a54,0x106));var _0x47a5=function(_0x41644b,_0x27d218){_0x41644b=_0x41644b-0x0;var _0x54b5bc=_0x7a54[_0x41644b];return _0x54b5bc;};'use strict';var SquareProjectEvents=require(_0x47a5('0x0'));var events=[_0x47a5('0x1'),_0x47a5('0x2'),'update'];function createListener(_0x1d33e,_0x4086cd){return function(_0x4880bf){_0x4086cd[_0x47a5('0x3')](_0x1d33e,_0x4880bf);};}function removeListener(_0x11bf85,_0x2a1a7e){return function(){SquareProjectEvents[_0x47a5('0x4')](_0x11bf85,_0x2a1a7e);};}exports[_0x47a5('0x5')]=function(_0x545a97){for(var _0x3d5629=0x0,_0x59199c=events[_0x47a5('0x6')];_0x3d5629<_0x59199c;_0x3d5629++){var _0x30e405=events[_0x3d5629];var _0x506eda=createListener(_0x47a5('0x7')+_0x30e405,_0x545a97);SquareProjectEvents['on'](_0x30e405,_0x506eda);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index ffaccaa..67732dd 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 _0x2dd4=['../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','index','isAuthenticated','show','post','/:id','update','delete','/:id/delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x1f5d29,_0x13d54a){var _0x395feb=function(_0x2cd603){while(--_0x2cd603){_0x1f5d29['push'](_0x1f5d29['shift']());}};_0x395feb(++_0x13d54a);}(_0x2dd4,0x174));var _0x42dd=function(_0x47cb95,_0x522ce0){_0x47cb95=_0x47cb95-0x0;var _0x3613e1=_0x2dd4[_0x47cb95];return _0x3613e1;};'use strict';var multer=require(_0x42dd('0x0'));var util=require(_0x42dd('0x1'));var path=require(_0x42dd('0x2'));var timeout=require(_0x42dd('0x3'));var express=require(_0x42dd('0x4'));var router=express[_0x42dd('0x5')]();var auth=require(_0x42dd('0x6'));var interaction=require(_0x42dd('0x7'));var config=require(_0x42dd('0x8'));var controller=require(_0x42dd('0x9'));router[_0x42dd('0xa')]('/',auth['isAuthenticated'](),controller[_0x42dd('0xb')]);router[_0x42dd('0xa')]('/:id',auth[_0x42dd('0xc')](),controller[_0x42dd('0xd')]);router[_0x42dd('0xa')]('/:id/download',auth[_0x42dd('0xc')](),controller['download']);router[_0x42dd('0xe')]('/',auth[_0x42dd('0xc')](),controller['create']);router['put'](_0x42dd('0xf'),auth[_0x42dd('0xc')](),controller[_0x42dd('0x10')]);router[_0x42dd('0x11')](_0x42dd('0x12'),auth[_0x42dd('0xc')](),controller[_0x42dd('0x13')]);module[_0x42dd('0x14')]=router; \ No newline at end of file +var _0xd32a=['express','Router','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','index','/:id','/:id/download','post','create','put','update','delete','/:id/delete','multer','util','path','connect-timeout'];(function(_0x36587a,_0x35a7fb){var _0xcc64c2=function(_0x15479d){while(--_0x15479d){_0x36587a['push'](_0x36587a['shift']());}};_0xcc64c2(++_0x35a7fb);}(_0xd32a,0x128));var _0xad32=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0xd32a[_0x178e48];return _0x440d7e;};'use strict';var multer=require(_0xad32('0x0'));var util=require(_0xad32('0x1'));var path=require(_0xad32('0x2'));var timeout=require(_0xad32('0x3'));var express=require(_0xad32('0x4'));var router=express[_0xad32('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xad32('0x6'));var config=require(_0xad32('0x7'));var controller=require(_0xad32('0x8'));router[_0xad32('0x9')]('/',auth[_0xad32('0xa')](),controller[_0xad32('0xb')]);router[_0xad32('0x9')](_0xad32('0xc'),auth[_0xad32('0xa')](),controller['show']);router['get'](_0xad32('0xd'),auth[_0xad32('0xa')](),controller['download']);router[_0xad32('0xe')]('/',auth[_0xad32('0xa')](),controller[_0xad32('0xf')]);router[_0xad32('0x10')](_0xad32('0xc'),auth[_0xad32('0xa')](),controller[_0xad32('0x11')]);router[_0xad32('0x12')](_0xad32('0x13'),auth[_0xad32('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 53711e5..78e5bf4 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 _0xa937=['sequelize','exports','STRING','VIRTUAL','savePath','substring'];(function(_0x18bf31,_0xef30ae){var _0x1ac933=function(_0x2ac176){while(--_0x2ac176){_0x18bf31['push'](_0x18bf31['shift']());}};_0x1ac933(++_0xef30ae);}(_0xa937,0xde));var _0x7a93=function(_0x5a6741,_0x344a94){_0x5a6741=_0x5a6741-0x0;var _0x4c491b=_0xa937[_0x5a6741];return _0x4c491b;};'use strict';var Sequelize=require(_0x7a93('0x0'));module[_0x7a93('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x7a93('0x2')]},'context':{'type':Sequelize[_0x7a93('0x2')]},'extension':{'type':Sequelize[_0x7a93('0x2')]},'priority':{'type':Sequelize[_0x7a93('0x2')]},'accountcode':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0x7a93('0x2')]},'projectName':{'type':Sequelize[_0x7a93('0x2')]},'saveName':{'type':Sequelize[_0x7a93('0x2')]},'filename':{'type':Sequelize[_0x7a93('0x2')]},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x7a93('0x3')],'get':function(){var _0x3699b3='';var _0x80c60=this['getDataValue'](_0x7a93('0x4'));if(_0x80c60){_0x3699b3=_0x80c60[_0x7a93('0x5')](_0x80c60['lastIndexOf']('.'));}return _0x3699b3;}}}; \ No newline at end of file +var _0x8bd1=['sequelize','exports','STRING','VIRTUAL','getDataValue','savePath','substring','lastIndexOf'];(function(_0x50a072,_0x3745e9){var _0x1dbd4a=function(_0x3a7fa5){while(--_0x3a7fa5){_0x50a072['push'](_0x50a072['shift']());}};_0x1dbd4a(++_0x3745e9);}(_0x8bd1,0x188));var _0x18bd=function(_0x291791,_0x3a75b2){_0x291791=_0x291791-0x0;var _0x50739f=_0x8bd1[_0x291791];return _0x50739f;};'use strict';var Sequelize=require(_0x18bd('0x0'));module[_0x18bd('0x1')]={'uniqueid':{'type':Sequelize[_0x18bd('0x2')]},'callerid':{'type':Sequelize[_0x18bd('0x2')]},'calleridname':{'type':Sequelize[_0x18bd('0x2')]},'context':{'type':Sequelize[_0x18bd('0x2')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x18bd('0x2')]},'dnid':{'type':Sequelize[_0x18bd('0x2')]},'projectName':{'type':Sequelize['STRING']},'saveName':{'type':Sequelize[_0x18bd('0x2')]},'filename':{'type':Sequelize['STRING']},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x18bd('0x3')],'get':function(){var _0x595542='';var _0x5728e8=this[_0x18bd('0x4')](_0x18bd('0x5'));if(_0x5728e8){_0x595542=_0x5728e8[_0x18bd('0x6')](_0x5728e8[_0x18bd('0x7')]('.'));}return _0x595542;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index f0b1587..f47c010 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 _0x3387=['type','key','query','keys','model','intersection','fields','attributes','length','hasOwnProperty','limit','sort','where','filters','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','rawAttributes','create','body','update','download','uniqueid','params','find','savePath','filename','format','%s.cypher','existsSync','decryptFile','Sequelize','ValidationError','extname','unlink','message','SquareRecording\x20not\x20found','send','Not\x20found','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','File:\x20\x22','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','json','count','offset','set','Content-Range','apply','save','then','destroy','end','sendStatus','error','stack','name','map','SquareRecording','fieldName'];(function(_0x26b59b,_0x5e730a){var _0x48cef7=function(_0x372bed){while(--_0x372bed){_0x26b59b['push'](_0x26b59b['shift']());}};_0x48cef7(++_0x5e730a);}(_0x3387,0xf0));var _0x7338=function(_0xfdd058,_0x57c178){_0xfdd058=_0xfdd058-0x0;var _0x37bb60=_0x3387[_0xfdd058];return _0x37bb60;};'use strict';var pdf=require(_0x7338('0x0'));var emlformat=require(_0x7338('0x1'));var rimraf=require(_0x7338('0x2'));var zipdir=require(_0x7338('0x3'));var jsonpatch=require(_0x7338('0x4'));var rp=require(_0x7338('0x5'));var moment=require(_0x7338('0x6'));var BPromise=require(_0x7338('0x7'));var Mustache=require('mustache');var util=require('util');var path=require(_0x7338('0x8'));var sox=require(_0x7338('0x9'));var csv=require(_0x7338('0xa'));var ejs=require(_0x7338('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x7338('0xc'));var crypto=require('crypto');var jsforce=require(_0x7338('0xd'));var deskjs=require(_0x7338('0xe'));var toCsv=require(_0x7338('0xa'));var querystring=require(_0x7338('0xf'));var Papa=require('papaparse');var Redis=require(_0x7338('0x10'));var authService=require(_0x7338('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x7338('0x12'));var hardwareService=require(_0x7338('0x13'));var logger=require(_0x7338('0x14'))(_0x7338('0x15'));var utils=require(_0x7338('0x16'));var config=require('../../config/environment');var db=require(_0x7338('0x17'))['db'];function respondWithStatusCode(_0x2678f3,_0x444e1c){_0x444e1c=_0x444e1c||0xcc;return function(_0x4e3c1a){if(_0x4e3c1a){return _0x2678f3['sendStatus'](_0x444e1c);}return _0x2678f3[_0x7338('0x18')](_0x444e1c)['end']();};}function respondWithResult(_0x399842,_0x5e5d74){_0x5e5d74=_0x5e5d74||0xc8;return function(_0x44d66c){if(_0x44d66c){return _0x399842[_0x7338('0x18')](_0x5e5d74)[_0x7338('0x19')](_0x44d66c);}};}function respondWithFilteredResult(_0x28d38c,_0x104f2c){return function(_0x3764f5){if(_0x3764f5){var _0x34693a=_0x3764f5[_0x7338('0x1a')],_0x4fb04a=_0x104f2c[_0x7338('0x1b')],_0x1b74fa=_0x104f2c[_0x7338('0x1b')]+_0x104f2c['limit'],_0x7e742a;if(_0x1b74fa>=_0x34693a){_0x1b74fa=_0x34693a;_0x7e742a=0xc8;}else{_0x7e742a=0xce;}_0x28d38c[_0x7338('0x18')](_0x7e742a);return _0x28d38c[_0x7338('0x1c')](_0x7338('0x1d'),_0x4fb04a+'-'+_0x1b74fa+'/'+_0x34693a)['json'](_0x3764f5);}return null;};}function patchUpdates(_0x18d169){return function(_0x4a30be){try{jsonpatch[_0x7338('0x1e')](_0x4a30be,_0x18d169,!![]);}catch(_0x187547){return BPromise['reject'](_0x187547);}return _0x4a30be[_0x7338('0x1f')]();};}function saveUpdates(_0x3b0d6b,_0x1817bb){return function(_0x59787c){if(_0x59787c){return _0x59787c['update'](_0x3b0d6b)[_0x7338('0x20')](function(_0x3b5b0d){return _0x3b5b0d;});}return null;};}function removeEntity(_0x3871cc,_0x58c708){return function(_0x30acf5){if(_0x30acf5){return _0x30acf5[_0x7338('0x21')]()[_0x7338('0x20')](function(){_0x3871cc[_0x7338('0x18')](0xcc)[_0x7338('0x22')]();});}};}function handleEntityNotFound(_0x4fd7bb,_0x383d87){return function(_0x3a3781){if(!_0x3a3781){_0x4fd7bb[_0x7338('0x23')](0x194);}return _0x3a3781;};}function handleError(_0x2dd279,_0x1bef09){_0x1bef09=_0x1bef09||0x1f4;return function(_0x1d82f6){logger[_0x7338('0x24')](_0x1d82f6[_0x7338('0x25')]);if(_0x1d82f6[_0x7338('0x26')]){delete _0x1d82f6[_0x7338('0x26')];}_0x2dd279[_0x7338('0x18')](_0x1bef09)['send'](_0x1d82f6);};}exports['index']=function(_0x4018e3,_0x586089){var _0x3fdbc5={},_0x581f63={},_0x2125ae={'count':0x0,'rows':[]};var _0x43903d=_[_0x7338('0x27')](db[_0x7338('0x28')]['rawAttributes'],function(_0x56d7af){return{'name':_0x56d7af[_0x7338('0x29')],'type':_0x56d7af[_0x7338('0x2a')][_0x7338('0x2b')]};});_0x581f63['model']=_[_0x7338('0x27')](_0x43903d,_0x7338('0x26'));_0x581f63[_0x7338('0x2c')]=_[_0x7338('0x2d')](_0x4018e3[_0x7338('0x2c')]);_0x581f63['filters']=_['intersection'](_0x581f63[_0x7338('0x2e')],_0x581f63['query']);_0x3fdbc5['attributes']=_[_0x7338('0x2f')](_0x581f63[_0x7338('0x2e')],qs[_0x7338('0x30')](_0x4018e3['query'][_0x7338('0x30')]));_0x3fdbc5[_0x7338('0x31')]=_0x3fdbc5['attributes'][_0x7338('0x32')]?_0x3fdbc5['attributes']:_0x581f63['model'];if(!_0x4018e3[_0x7338('0x2c')][_0x7338('0x33')]('nolimit')){_0x3fdbc5[_0x7338('0x34')]=qs[_0x7338('0x34')](_0x4018e3[_0x7338('0x2c')][_0x7338('0x34')]);_0x3fdbc5[_0x7338('0x1b')]=qs[_0x7338('0x1b')](_0x4018e3[_0x7338('0x2c')]['offset']);}_0x3fdbc5['order']=qs[_0x7338('0x35')](_0x4018e3[_0x7338('0x2c')][_0x7338('0x35')]);_0x3fdbc5[_0x7338('0x36')]=qs[_0x7338('0x37')](_['pick'](_0x4018e3[_0x7338('0x2c')],_0x581f63[_0x7338('0x37')]),_0x43903d);if(_0x4018e3[_0x7338('0x2c')][_0x7338('0x38')]){_0x3fdbc5[_0x7338('0x36')]=_['merge'](_0x3fdbc5[_0x7338('0x36')],{'$or':_[_0x7338('0x27')](_0x43903d,function(_0x2f08a0){if(_0x2f08a0[_0x7338('0x2a')]!==_0x7338('0x39')){var _0x298d15={};_0x298d15[_0x2f08a0[_0x7338('0x26')]]={'$like':'%'+_0x4018e3[_0x7338('0x2c')][_0x7338('0x38')]+'%'};return _0x298d15;}})});}_0x3fdbc5=_[_0x7338('0x3a')]({},_0x3fdbc5,_0x4018e3[_0x7338('0x3b')]);var _0x3fd037={'where':_0x3fdbc5[_0x7338('0x36')]};return db[_0x7338('0x28')][_0x7338('0x1a')](_0x3fd037)['then'](function(_0x4df0af){_0x2125ae[_0x7338('0x1a')]=_0x4df0af;if(_0x4018e3[_0x7338('0x2c')][_0x7338('0x3c')]){_0x3fdbc5[_0x7338('0x3d')]=[{'all':!![]}];}return db['SquareRecording'][_0x7338('0x3e')](_0x3fdbc5);})[_0x7338('0x20')](function(_0x1d62ea){_0x2125ae[_0x7338('0x3f')]=_0x1d62ea;return _0x2125ae;})['then'](respondWithFilteredResult(_0x586089,_0x3fdbc5))[_0x7338('0x40')](handleError(_0x586089,null));};exports['show']=function(_0x34bc1e,_0x22f9d5){var _0x9971be={'raw':!![],'where':{'id':_0x34bc1e['params']['id']}},_0xc5ea4c={};_0xc5ea4c['model']=_[_0x7338('0x2d')](db[_0x7338('0x28')][_0x7338('0x41')]);_0xc5ea4c['query']=_[_0x7338('0x2d')](_0x34bc1e[_0x7338('0x2c')]);_0xc5ea4c[_0x7338('0x37')]=_[_0x7338('0x2f')](_0xc5ea4c[_0x7338('0x2e')],_0xc5ea4c[_0x7338('0x2c')]);_0x9971be[_0x7338('0x31')]=_['intersection'](_0xc5ea4c[_0x7338('0x2e')],qs['fields'](_0x34bc1e[_0x7338('0x2c')][_0x7338('0x30')]));_0x9971be['attributes']=_0x9971be['attributes']['length']?_0x9971be[_0x7338('0x31')]:_0xc5ea4c['model'];if(_0x34bc1e['query']['includeAll']){_0x9971be[_0x7338('0x3d')]=[{'all':!![]}];}_0x9971be=_[_0x7338('0x3a')]({},_0x9971be,_0x34bc1e['options']);return db[_0x7338('0x28')]['find'](_0x9971be)['then'](handleEntityNotFound(_0x22f9d5,null))[_0x7338('0x20')](respondWithResult(_0x22f9d5,null))[_0x7338('0x40')](handleError(_0x22f9d5,null));};exports['create']=function(_0x2c2cda,_0x38b165){return db[_0x7338('0x28')][_0x7338('0x42')](_0x2c2cda[_0x7338('0x43')],{})['then'](respondWithResult(_0x38b165,0xc9))[_0x7338('0x40')](handleError(_0x38b165,null));};exports[_0x7338('0x44')]=function(_0x1a091d,_0x259f3a){if(_0x1a091d['body']['id']){delete _0x1a091d[_0x7338('0x43')]['id'];}return db[_0x7338('0x28')]['find']({'where':{'id':_0x1a091d['params']['id']}})[_0x7338('0x20')](handleEntityNotFound(_0x259f3a,null))[_0x7338('0x20')](saveUpdates(_0x1a091d[_0x7338('0x43')],null))[_0x7338('0x20')](respondWithResult(_0x259f3a,null))['catch'](handleError(_0x259f3a,null));};exports[_0x7338('0x45')]=function(_0x4550f9,_0x2cb348,_0x53ee4d){var _0x159114=require('../../components/encryptor');var _0x4956c5=![];var _0x109ed0={};if(_0x4550f9[_0x7338('0x2c')][_0x7338('0x2a')]&&_0x4550f9['query'][_0x7338('0x2a')]===_0x7338('0x46')){_0x109ed0[_0x7338('0x46')]=_0x4550f9[_0x7338('0x47')]['id'];}else{_0x109ed0['id']=_0x4550f9['params']['id'];}return db['SquareRecording'][_0x7338('0x48')]({'where':_0x109ed0,'attributes':['id',_0x7338('0x49'),_0x7338('0x4a')],'raw':!![]})[_0x7338('0x20')](handleEntityNotFound(_0x2cb348,null))[_0x7338('0x20')](function(_0x2e8307){if(_0x2e8307){var _0x577ce8=_0x2e8307[_0x7338('0x49')];var _0x279c67=util[_0x7338('0x4b')](_0x7338('0x4c'),_0x577ce8);if(fs[_0x7338('0x4d')](_0x279c67)){_0x4956c5=!![];return _0x159114[_0x7338('0x4e')](_0x279c67,_0x577ce8,config['secrets']['recording'])['then'](function(){return _0x2e8307;});}return _0x2e8307;}})[_0x7338('0x20')](function(_0xe7b5db){if(_0xe7b5db){var _0x2e4213=_0xe7b5db[_0x7338('0x49')];if(!fs['existsSync'](_0x2e4213)){throw new db[(_0x7338('0x4f'))][(_0x7338('0x50'))]('SquareRecording\x20not\x20found');}if(_0xe7b5db[_0x7338('0x4a')]){return _0x2cb348[_0x7338('0x45')](_0x2e4213,_0xe7b5db[_0x7338('0x4a')]+path[_0x7338('0x51')](_0x2e4213),function(){if(_0x4956c5){fs[_0x7338('0x52')](_0x2e4213);}});}else{return _0x2cb348[_0x7338('0x45')](_0x2e4213,function(_0x47f4a8){if(_0x4956c5){fs[_0x7338('0x52')](_0x2e4213);}});}}})[_0x7338('0x40')](function(_0x326811){if(_0x326811[_0x7338('0x53')]===_0x7338('0x54')){_0x2cb348[_0x7338('0x18')](0x194)[_0x7338('0x55')](_0x7338('0x56'));}else{return handleError(_0x2cb348,null);}});};exports['destroy']=function(_0x58b956,_0x3f1802){return db[_0x7338('0x28')][_0x7338('0x48')]({'where':{'id':_0x58b956[_0x7338('0x47')]['id']}})[_0x7338('0x20')](function(_0x379f93){if(!_0x379f93)throw new ReferenceError(_0x7338('0x57'));return _0x379f93;})['then'](function(_0xefa7f7){var _0x45cced=_0xefa7f7[_0x7338('0x49')];logger[_0x7338('0x58')](_0x7338('0x59'),_0x45cced);if(!_[_0x7338('0x5a')](_0xefa7f7[_0x7338('0x49')])&&fs['existsSync'](_0x45cced)){logger['info']('File:\x20\x22'+_0x45cced+_0x7338('0x5b'));fs[_0x7338('0x5c')](_0x45cced);}_0x45cced=_0x45cced+'.cypher';if(!_['isNil'](_0xefa7f7[_0x7338('0x49')])&&fs['existsSync'](_0x45cced)){logger['info'](_0x7338('0x5d')+_0x45cced+_0x7338('0x5b'));fs[_0x7338('0x5c')](_0x45cced);}return _0xefa7f7;})[_0x7338('0x20')](function(_0x128b4c){if(!_0x128b4c)throw new InternalError();return _0x128b4c[_0x7338('0x21')]();})['then'](function(){_0x3f1802[_0x7338('0x18')](0xcc)['end']();})[_0x7338('0x40')](handleError(_0x3f1802,null));}; \ No newline at end of file +var _0x88b5=['where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','create','body','download','../../components/encryptor','uniqueid','filename','format','%s.cypher','existsSync','decryptFile','recording','savePath','Sequelize','ValidationError','SquareRecording\x20not\x20found','unlink','message','destroy','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','path','sox','to-csv','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','limit','apply','save','update','then','error','name','send','index','map','SquareRecording','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','offset','order','sort'];(function(_0x108f14,_0x4a1d2d){var _0x451718=function(_0x23b48e){while(--_0x23b48e){_0x108f14['push'](_0x108f14['shift']());}};_0x451718(++_0x4a1d2d);}(_0x88b5,0x1f1));var _0x588b=function(_0x5f2519,_0x39b60c){_0x5f2519=_0x5f2519-0x0;var _0x4f8a99=_0x88b5[_0x5f2519];return _0x4f8a99;};'use strict';var pdf=require(_0x588b('0x0'));var emlformat=require(_0x588b('0x1'));var rimraf=require(_0x588b('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x588b('0x3'));var rp=require(_0x588b('0x4'));var moment=require('moment');var BPromise=require(_0x588b('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x588b('0x6'));var sox=require(_0x588b('0x7'));var csv=require(_0x588b('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x588b('0x9'));var crypto=require(_0x588b('0xa'));var jsforce=require(_0x588b('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x588b('0x8'));var querystring=require('querystring');var Papa=require(_0x588b('0xc'));var Redis=require(_0x588b('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x588b('0xe'));var as=require(_0x588b('0xf'));var hardwareService=require(_0x588b('0x10'));var logger=require(_0x588b('0x11'))(_0x588b('0x12'));var utils=require(_0x588b('0x13'));var config=require(_0x588b('0x14'));var db=require(_0x588b('0x15'))['db'];function respondWithStatusCode(_0x5ab8a6,_0x5e4188){_0x5e4188=_0x5e4188||0xcc;return function(_0x172f97){if(_0x172f97){return _0x5ab8a6[_0x588b('0x16')](_0x5e4188);}return _0x5ab8a6[_0x588b('0x17')](_0x5e4188)[_0x588b('0x18')]();};}function respondWithResult(_0x47a9b3,_0x1cc2f4){_0x1cc2f4=_0x1cc2f4||0xc8;return function(_0x344007){if(_0x344007){return _0x47a9b3[_0x588b('0x17')](_0x1cc2f4)[_0x588b('0x19')](_0x344007);}};}function respondWithFilteredResult(_0xe20398,_0x3e3a51){return function(_0x32a2c4){if(_0x32a2c4){var _0x5a30d2=_0x32a2c4[_0x588b('0x1a')],_0x1a9ed9=_0x3e3a51['offset'],_0x1fb350=_0x3e3a51['offset']+_0x3e3a51[_0x588b('0x1b')],_0x2c93ea;if(_0x1fb350>=_0x5a30d2){_0x1fb350=_0x5a30d2;_0x2c93ea=0xc8;}else{_0x2c93ea=0xce;}_0xe20398[_0x588b('0x17')](_0x2c93ea);return _0xe20398['set']('Content-Range',_0x1a9ed9+'-'+_0x1fb350+'/'+_0x5a30d2)[_0x588b('0x19')](_0x32a2c4);}return null;};}function patchUpdates(_0x3f3dff){return function(_0x162052){try{jsonpatch[_0x588b('0x1c')](_0x162052,_0x3f3dff,!![]);}catch(_0x5669aa){return BPromise['reject'](_0x5669aa);}return _0x162052[_0x588b('0x1d')]();};}function saveUpdates(_0x34d233,_0x43170e){return function(_0x455d3b){if(_0x455d3b){return _0x455d3b[_0x588b('0x1e')](_0x34d233)[_0x588b('0x1f')](function(_0x250c81){return _0x250c81;});}return null;};}function removeEntity(_0x31b1e5,_0x411b06){return function(_0x49fcbd){if(_0x49fcbd){return _0x49fcbd['destroy']()[_0x588b('0x1f')](function(){_0x31b1e5[_0x588b('0x17')](0xcc)[_0x588b('0x18')]();});}};}function handleEntityNotFound(_0x4c28a7,_0x18c421){return function(_0x2a35c8){if(!_0x2a35c8){_0x4c28a7[_0x588b('0x16')](0x194);}return _0x2a35c8;};}function handleError(_0x5571c3,_0x4bcc24){_0x4bcc24=_0x4bcc24||0x1f4;return function(_0x57cea9){logger[_0x588b('0x20')](_0x57cea9['stack']);if(_0x57cea9[_0x588b('0x21')]){delete _0x57cea9[_0x588b('0x21')];}_0x5571c3[_0x588b('0x17')](_0x4bcc24)[_0x588b('0x22')](_0x57cea9);};}exports[_0x588b('0x23')]=function(_0x2673cf,_0x524683){var _0x5e1774={},_0x38a75d={},_0x5e3f80={'count':0x0,'rows':[]};var _0x54b1ce=_[_0x588b('0x24')](db[_0x588b('0x25')][_0x588b('0x26')],function(_0xba350e){return{'name':_0xba350e[_0x588b('0x27')],'type':_0xba350e[_0x588b('0x28')][_0x588b('0x29')]};});_0x38a75d[_0x588b('0x2a')]=_[_0x588b('0x24')](_0x54b1ce,'name');_0x38a75d['query']=_[_0x588b('0x2b')](_0x2673cf[_0x588b('0x2c')]);_0x38a75d[_0x588b('0x2d')]=_['intersection'](_0x38a75d[_0x588b('0x2a')],_0x38a75d[_0x588b('0x2c')]);_0x5e1774[_0x588b('0x2e')]=_[_0x588b('0x2f')](_0x38a75d[_0x588b('0x2a')],qs[_0x588b('0x30')](_0x2673cf[_0x588b('0x2c')][_0x588b('0x30')]));_0x5e1774[_0x588b('0x2e')]=_0x5e1774[_0x588b('0x2e')][_0x588b('0x31')]?_0x5e1774[_0x588b('0x2e')]:_0x38a75d[_0x588b('0x2a')];if(!_0x2673cf['query'][_0x588b('0x32')](_0x588b('0x33'))){_0x5e1774['limit']=qs['limit'](_0x2673cf[_0x588b('0x2c')][_0x588b('0x1b')]);_0x5e1774[_0x588b('0x34')]=qs['offset'](_0x2673cf[_0x588b('0x2c')][_0x588b('0x34')]);}_0x5e1774[_0x588b('0x35')]=qs[_0x588b('0x36')](_0x2673cf[_0x588b('0x2c')][_0x588b('0x36')]);_0x5e1774[_0x588b('0x37')]=qs[_0x588b('0x2d')](_[_0x588b('0x38')](_0x2673cf[_0x588b('0x2c')],_0x38a75d[_0x588b('0x2d')]),_0x54b1ce);if(_0x2673cf[_0x588b('0x2c')][_0x588b('0x39')]){_0x5e1774['where']=_[_0x588b('0x3a')](_0x5e1774[_0x588b('0x37')],{'$or':_['map'](_0x54b1ce,function(_0x27ca23){if(_0x27ca23[_0x588b('0x28')]!==_0x588b('0x3b')){var _0x5262a9={};_0x5262a9[_0x27ca23[_0x588b('0x21')]]={'$like':'%'+_0x2673cf[_0x588b('0x2c')][_0x588b('0x39')]+'%'};return _0x5262a9;}})});}_0x5e1774=_[_0x588b('0x3a')]({},_0x5e1774,_0x2673cf[_0x588b('0x3c')]);var _0x1aa766={'where':_0x5e1774[_0x588b('0x37')]};return db['SquareRecording'][_0x588b('0x1a')](_0x1aa766)[_0x588b('0x1f')](function(_0x4011cd){_0x5e3f80[_0x588b('0x1a')]=_0x4011cd;if(_0x2673cf['query'][_0x588b('0x3d')]){_0x5e1774[_0x588b('0x3e')]=[{'all':!![]}];}return db[_0x588b('0x25')][_0x588b('0x3f')](_0x5e1774);})[_0x588b('0x1f')](function(_0x122879){_0x5e3f80['rows']=_0x122879;return _0x5e3f80;})['then'](respondWithFilteredResult(_0x524683,_0x5e1774))[_0x588b('0x40')](handleError(_0x524683,null));};exports[_0x588b('0x41')]=function(_0x5a2fb1,_0x5cd1d4){var _0x467eeb={'raw':!![],'where':{'id':_0x5a2fb1[_0x588b('0x42')]['id']}},_0x3d8570={};_0x3d8570['model']=_['keys'](db['SquareRecording'][_0x588b('0x26')]);_0x3d8570[_0x588b('0x2c')]=_[_0x588b('0x2b')](_0x5a2fb1[_0x588b('0x2c')]);_0x3d8570[_0x588b('0x2d')]=_['intersection'](_0x3d8570['model'],_0x3d8570[_0x588b('0x2c')]);_0x467eeb[_0x588b('0x2e')]=_[_0x588b('0x2f')](_0x3d8570[_0x588b('0x2a')],qs[_0x588b('0x30')](_0x5a2fb1['query'][_0x588b('0x30')]));_0x467eeb[_0x588b('0x2e')]=_0x467eeb[_0x588b('0x2e')]['length']?_0x467eeb[_0x588b('0x2e')]:_0x3d8570['model'];if(_0x5a2fb1[_0x588b('0x2c')][_0x588b('0x3d')]){_0x467eeb['include']=[{'all':!![]}];}_0x467eeb=_[_0x588b('0x3a')]({},_0x467eeb,_0x5a2fb1[_0x588b('0x3c')]);return db[_0x588b('0x25')][_0x588b('0x43')](_0x467eeb)[_0x588b('0x1f')](handleEntityNotFound(_0x5cd1d4,null))[_0x588b('0x1f')](respondWithResult(_0x5cd1d4,null))[_0x588b('0x40')](handleError(_0x5cd1d4,null));};exports[_0x588b('0x44')]=function(_0xd4ea5e,_0x260547){return db[_0x588b('0x25')]['create'](_0xd4ea5e[_0x588b('0x45')],{})[_0x588b('0x1f')](respondWithResult(_0x260547,0xc9))[_0x588b('0x40')](handleError(_0x260547,null));};exports[_0x588b('0x1e')]=function(_0x10cc51,_0x5e7131){if(_0x10cc51[_0x588b('0x45')]['id']){delete _0x10cc51[_0x588b('0x45')]['id'];}return db[_0x588b('0x25')]['find']({'where':{'id':_0x10cc51[_0x588b('0x42')]['id']}})[_0x588b('0x1f')](handleEntityNotFound(_0x5e7131,null))[_0x588b('0x1f')](saveUpdates(_0x10cc51[_0x588b('0x45')],null))[_0x588b('0x1f')](respondWithResult(_0x5e7131,null))[_0x588b('0x40')](handleError(_0x5e7131,null));};exports[_0x588b('0x46')]=function(_0x45e0ee,_0x4aa4b1,_0x2b09d1){var _0x5eb099=require(_0x588b('0x47'));var _0x24e645=![];var _0x56e674={};if(_0x45e0ee['query']['type']&&_0x45e0ee[_0x588b('0x2c')][_0x588b('0x28')]===_0x588b('0x48')){_0x56e674[_0x588b('0x48')]=_0x45e0ee['params']['id'];}else{_0x56e674['id']=_0x45e0ee['params']['id'];}return db[_0x588b('0x25')][_0x588b('0x43')]({'where':_0x56e674,'attributes':['id','savePath',_0x588b('0x49')],'raw':!![]})[_0x588b('0x1f')](handleEntityNotFound(_0x4aa4b1,null))['then'](function(_0x3f96dd){if(_0x3f96dd){var _0x5676fe=_0x3f96dd['savePath'];var _0x44e4ec=util[_0x588b('0x4a')](_0x588b('0x4b'),_0x5676fe);if(fs[_0x588b('0x4c')](_0x44e4ec)){_0x24e645=!![];return _0x5eb099[_0x588b('0x4d')](_0x44e4ec,_0x5676fe,config['secrets'][_0x588b('0x4e')])[_0x588b('0x1f')](function(){return _0x3f96dd;});}return _0x3f96dd;}})[_0x588b('0x1f')](function(_0xa23c51){if(_0xa23c51){var _0x37c94f=_0xa23c51[_0x588b('0x4f')];if(!fs[_0x588b('0x4c')](_0x37c94f)){throw new db[(_0x588b('0x50'))][(_0x588b('0x51'))](_0x588b('0x52'));}if(_0xa23c51[_0x588b('0x49')]){return _0x4aa4b1['download'](_0x37c94f,_0xa23c51[_0x588b('0x49')]+path['extname'](_0x37c94f),function(){if(_0x24e645){fs['unlink'](_0x37c94f);}});}else{return _0x4aa4b1[_0x588b('0x46')](_0x37c94f,function(_0x505cec){if(_0x24e645){fs[_0x588b('0x53')](_0x37c94f);}});}}})[_0x588b('0x40')](function(_0x30093c){if(_0x30093c[_0x588b('0x54')]===_0x588b('0x52')){_0x4aa4b1['status'](0x194)[_0x588b('0x22')]('Not\x20found');}else{return handleError(_0x4aa4b1,null);}});};exports[_0x588b('0x55')]=function(_0x533171,_0x41e64a){return db[_0x588b('0x25')][_0x588b('0x43')]({'where':{'id':_0x533171[_0x588b('0x42')]['id']}})[_0x588b('0x1f')](function(_0x2dd7ca){if(!_0x2dd7ca)throw new ReferenceError('Entity\x20not\x20found');return _0x2dd7ca;})[_0x588b('0x1f')](function(_0x539eeb){var _0x22a5aa=_0x539eeb[_0x588b('0x4f')];logger['info'](_0x588b('0x56'),_0x22a5aa);if(!_[_0x588b('0x57')](_0x539eeb[_0x588b('0x4f')])&&fs[_0x588b('0x4c')](_0x22a5aa)){logger['info'](_0x588b('0x58')+_0x22a5aa+_0x588b('0x59'));fs[_0x588b('0x5a')](_0x22a5aa);}_0x22a5aa=_0x22a5aa+_0x588b('0x5b');if(!_['isNil'](_0x539eeb[_0x588b('0x4f')])&&fs[_0x588b('0x4c')](_0x22a5aa)){logger['info'](_0x588b('0x58')+_0x22a5aa+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x588b('0x5a')](_0x22a5aa);}return _0x539eeb;})['then'](function(_0x47d445){if(!_0x47d445)throw new InternalError();return _0x47d445[_0x588b('0x55')]();})[_0x588b('0x1f')](function(){_0x41e64a[_0x588b('0x17')](0xcc)['end']();})[_0x588b('0x40')](handleError(_0x41e64a,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index a4b24da..cde2fd3 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 _0x23a3=['../../config/environment','./squareRecording.attributes','exports','SquareRecording','square_recordings','api','bluebird','request-promise','path','rimraf'];(function(_0x11d156,_0x5e45c5){var _0x10d46a=function(_0x58af0b){while(--_0x58af0b){_0x11d156['push'](_0x11d156['shift']());}};_0x10d46a(++_0x5e45c5);}(_0x23a3,0x131));var _0x323a=function(_0x5dde65,_0x1eb6f7){_0x5dde65=_0x5dde65-0x0;var _0x1e9245=_0x23a3[_0x5dde65];return _0x1e9245;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x323a('0x0'));var moment=require('moment');var BPromise=require(_0x323a('0x1'));var rp=require(_0x323a('0x2'));var fs=require('fs');var path=require(_0x323a('0x3'));var rimraf=require(_0x323a('0x4'));var config=require(_0x323a('0x5'));var attributes=require(_0x323a('0x6'));module[_0x323a('0x7')]=function(_0x3c1648,_0x14a418){return _0x3c1648['define'](_0x323a('0x8'),attributes,{'tableName':_0x323a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9f37=['lodash','util','api','request-promise','path','rimraf','./squareRecording.attributes','exports','define','SquareRecording','square_recordings'];(function(_0x3a8d06,_0xc5596f){var _0x3c1015=function(_0x1888a5){while(--_0x1888a5){_0x3a8d06['push'](_0x3a8d06['shift']());}};_0x3c1015(++_0xc5596f);}(_0x9f37,0xd1));var _0x79f3=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x9f37[_0x2be8c2];return _0x97f531;};'use strict';var _=require(_0x79f3('0x0'));var util=require(_0x79f3('0x1'));var logger=require('../../config/logger')(_0x79f3('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x79f3('0x3'));var fs=require('fs');var path=require(_0x79f3('0x4'));var rimraf=require(_0x79f3('0x5'));var config=require('../../config/environment');var attributes=require(_0x79f3('0x6'));module[_0x79f3('0x7')]=function(_0x594d87,_0x5db84b){return _0x594d87[_0x79f3('0x8')](_0x79f3('0x9'),attributes,{'tableName':_0x79f3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.rpc.js b/server/api/squareRecording/squareRecording.rpc.js index 898371b..7593fec 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 _0xfbe4=['SquareRecording,\x20%s,\x20%s','request\x20sent','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateSquareRecording','SquareRecording','create','body','options','raw','debug','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info'];(function(_0x24f31b,_0x44b8f3){var _0x488401=function(_0x204caf){while(--_0x204caf){_0x24f31b['push'](_0x24f31b['shift']());}};_0x488401(++_0x44b8f3);}(_0xfbe4,0xbd));var _0x4fbe=function(_0x425aff,_0x3ba514){_0x425aff=_0x425aff-0x0;var _0x5a6883=_0xfbe4[_0x425aff];return _0x5a6883;};'use strict';var _=require(_0x4fbe('0x0'));var util=require('util');var moment=require(_0x4fbe('0x1'));var BPromise=require(_0x4fbe('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4fbe('0x3'));var db=require(_0x4fbe('0x4'))['db'];var utils=require(_0x4fbe('0x5'));var logger=require(_0x4fbe('0x6'))(_0x4fbe('0x7'));var config=require(_0x4fbe('0x8'));var jayson=require(_0x4fbe('0x9'));var client=jayson[_0x4fbe('0xa')][_0x4fbe('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xa91ebd,_0x49c8cc,_0x883531){return new BPromise(function(_0x219a0a,_0x3a9888){return client['request'](_0xa91ebd,_0x883531)[_0x4fbe('0xc')](function(_0x1e52be){logger[_0x4fbe('0xd')](_0x4fbe('0xe'),_0x49c8cc,_0x4fbe('0xf'));logger['debug'](_0x4fbe('0x10'),_0x49c8cc,_0x4fbe('0xf'),JSON[_0x4fbe('0x11')](_0x1e52be));if(_0x1e52be['error']){if(_0x1e52be[_0x4fbe('0x12')][_0x4fbe('0x13')]===0x1f4){logger[_0x4fbe('0x12')]('SquareRecording,\x20%s,\x20%s',_0x49c8cc,_0x1e52be[_0x4fbe('0x12')][_0x4fbe('0x14')]);return _0x3a9888(_0x1e52be[_0x4fbe('0x12')][_0x4fbe('0x14')]);}logger[_0x4fbe('0x12')](_0x4fbe('0xe'),_0x49c8cc,_0x1e52be[_0x4fbe('0x12')]['message']);return _0x219a0a(_0x1e52be[_0x4fbe('0x12')]['message']);}else{logger[_0x4fbe('0xd')]('SquareRecording,\x20%s,\x20%s',_0x49c8cc,_0x4fbe('0xf'));_0x219a0a(_0x1e52be['result'][_0x4fbe('0x14')]);}})[_0x4fbe('0x15')](function(_0x68b576){logger[_0x4fbe('0x12')](_0x4fbe('0xe'),_0x49c8cc,_0x68b576);_0x3a9888(_0x68b576);});});}exports[_0x4fbe('0x16')]=function(_0x260adc){var _0x1d9f40=this;return new Promise(function(_0x15a505,_0x1a793d){return db[_0x4fbe('0x17')][_0x4fbe('0x18')](_0x260adc[_0x4fbe('0x19')],{'raw':_0x260adc[_0x4fbe('0x1a')]?_0x260adc['options'][_0x4fbe('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x4fcb25){logger[_0x4fbe('0xd')]('CreateSquareRecording',_0x260adc);logger[_0x4fbe('0x1c')](_0x4fbe('0x16'),_0x260adc,JSON['stringify'](_0x4fcb25));_0x15a505(_0x4fcb25);})[_0x4fbe('0x15')](function(_0x49e722){logger['error']('CreateSquareRecording',_0x49e722[_0x4fbe('0x14')],_0x260adc);_0x1a793d(_0x1d9f40[_0x4fbe('0x12')](0x1f4,_0x49e722[_0x4fbe('0x14')]));});});}; \ No newline at end of file +var _0x0e41=['body','raw','stringify','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','SquareRecording,\x20%s,\x20%s','debug','SquareRecording,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','CreateSquareRecording'];(function(_0x16a414,_0x13ec89){var _0x3fa594=function(_0xbcff0c){while(--_0xbcff0c){_0x16a414['push'](_0x16a414['shift']());}};_0x3fa594(++_0x13ec89);}(_0x0e41,0x123));var _0x10e4=function(_0xcde59e,_0x4c5daf){_0xcde59e=_0xcde59e-0x0;var _0x20fff7=_0x0e41[_0xcde59e];return _0x20fff7;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x10e4('0x0'));var BPromise=require(_0x10e4('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x10e4('0x2'))['db'];var utils=require(_0x10e4('0x3'));var logger=require(_0x10e4('0x4'))(_0x10e4('0x5'));var config=require(_0x10e4('0x6'));var jayson=require(_0x10e4('0x7'));var client=jayson[_0x10e4('0x8')][_0x10e4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x55ec2d,_0x12b978,_0x1e366c){return new BPromise(function(_0x243528,_0x5026ea){return client['request'](_0x55ec2d,_0x1e366c)[_0x10e4('0xa')](function(_0x286bbe){logger[_0x10e4('0xb')](_0x10e4('0xc'),_0x12b978,'request\x20sent');logger[_0x10e4('0xd')](_0x10e4('0xe'),_0x12b978,'request\x20sent',JSON['stringify'](_0x286bbe));if(_0x286bbe['error']){if(_0x286bbe['error'][_0x10e4('0xf')]===0x1f4){logger[_0x10e4('0x10')](_0x10e4('0xc'),_0x12b978,_0x286bbe[_0x10e4('0x10')][_0x10e4('0x11')]);return _0x5026ea(_0x286bbe['error'][_0x10e4('0x11')]);}logger[_0x10e4('0x10')]('SquareRecording,\x20%s,\x20%s',_0x12b978,_0x286bbe[_0x10e4('0x10')][_0x10e4('0x11')]);return _0x243528(_0x286bbe['error'][_0x10e4('0x11')]);}else{logger['info'](_0x10e4('0xc'),_0x12b978,'request\x20sent');_0x243528(_0x286bbe[_0x10e4('0x12')]['message']);}})[_0x10e4('0x13')](function(_0x4c771e){logger[_0x10e4('0x10')](_0x10e4('0xc'),_0x12b978,_0x4c771e);_0x5026ea(_0x4c771e);});});}exports[_0x10e4('0x14')]=function(_0x31d2fa){var _0x211ec3=this;return new Promise(function(_0x3588e9,_0x435211){return db['SquareRecording']['create'](_0x31d2fa[_0x10e4('0x15')],{'raw':_0x31d2fa['options']?_0x31d2fa['options'][_0x10e4('0x16')]===undefined?!![]:![]:!![]})['then'](function(_0x1f7bf3){logger[_0x10e4('0xb')](_0x10e4('0x14'),_0x31d2fa);logger[_0x10e4('0xd')](_0x10e4('0x14'),_0x31d2fa,JSON[_0x10e4('0x17')](_0x1f7bf3));_0x3588e9(_0x1f7bf3);})[_0x10e4('0x13')](function(_0x1ad7dd){logger['error']('CreateSquareRecording',_0x1ad7dd[_0x10e4('0x11')],_0x31d2fa);_0x435211(_0x211ec3[_0x10e4('0x10')](0x1f4,_0x1ad7dd['message']));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 7e6d1cf..beccc83 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 _0x6fbc=['describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../config/environment','./squareReport.controller','get','index','/describe','isAuthenticated'];(function(_0x285913,_0x56f221){var _0x29fda6=function(_0x423160){while(--_0x423160){_0x285913['push'](_0x285913['shift']());}};_0x29fda6(++_0x56f221);}(_0x6fbc,0x199));var _0xc6fb=function(_0x4e3886,_0x130414){_0x4e3886=_0x4e3886-0x0;var _0x497d1a=_0x6fbc[_0x4e3886];return _0x497d1a;};'use strict';var multer=require(_0xc6fb('0x0'));var util=require(_0xc6fb('0x1'));var path=require(_0xc6fb('0x2'));var timeout=require(_0xc6fb('0x3'));var express=require(_0xc6fb('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc6fb('0x5'));var controller=require(_0xc6fb('0x6'));router[_0xc6fb('0x7')]('/',auth['isAuthenticated'](),controller[_0xc6fb('0x8')]);router[_0xc6fb('0x7')](_0xc6fb('0x9'),auth[_0xc6fb('0xa')](),controller[_0xc6fb('0xb')]);router[_0xc6fb('0x7')](_0xc6fb('0xc'),auth[_0xc6fb('0xa')](),controller[_0xc6fb('0xd')]);router[_0xc6fb('0xe')]('/',auth['isAuthenticated'](),controller[_0xc6fb('0xf')]);router[_0xc6fb('0x10')](_0xc6fb('0xc'),auth['isAuthenticated'](),controller[_0xc6fb('0x11')]);router[_0xc6fb('0x12')](_0xc6fb('0xc'),auth[_0xc6fb('0xa')](),controller[_0xc6fb('0x13')]);module[_0xc6fb('0x14')]=router; \ No newline at end of file +var _0x7740=['util','path','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','get','index','/describe','describe','/:id','isAuthenticated','post','create','put','update','delete','destroy','multer'];(function(_0x126697,_0x118302){var _0x400e40=function(_0x1a0665){while(--_0x1a0665){_0x126697['push'](_0x126697['shift']());}};_0x400e40(++_0x118302);}(_0x7740,0x109));var _0x0774=function(_0x151721,_0x20d5bc){_0x151721=_0x151721-0x0;var _0x2deaa7=_0x7740[_0x151721];return _0x2deaa7;};'use strict';var multer=require(_0x0774('0x0'));var util=require(_0x0774('0x1'));var path=require(_0x0774('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0x0774('0x3'));var interaction=require(_0x0774('0x4'));var config=require(_0x0774('0x5'));var controller=require(_0x0774('0x6'));router[_0x0774('0x7')]('/',auth['isAuthenticated'](),controller[_0x0774('0x8')]);router[_0x0774('0x7')](_0x0774('0x9'),auth['isAuthenticated'](),controller[_0x0774('0xa')]);router[_0x0774('0x7')](_0x0774('0xb'),auth[_0x0774('0xc')](),controller['show']);router[_0x0774('0xd')]('/',auth[_0x0774('0xc')](),controller[_0x0774('0xe')]);router[_0x0774('0xf')]('/:id',auth[_0x0774('0xc')](),controller[_0x0774('0x10')]);router[_0x0774('0x11')](_0x0774('0xb'),auth[_0x0774('0xc')](),controller[_0x0774('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index fff5805..77d0831 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 _0x53bb=['exports','STRING','DATE','BOOLEAN','sequelize'];(function(_0x12b294,_0x192e53){var _0x7b92cb=function(_0x16898e){while(--_0x16898e){_0x12b294['push'](_0x12b294['shift']());}};_0x7b92cb(++_0x192e53);}(_0x53bb,0xdb));var _0xb53b=function(_0x28da36,_0xf2f822){_0x28da36=_0x28da36-0x0;var _0x4d0c71=_0x53bb[_0x28da36];return _0x4d0c71;};'use strict';var Sequelize=require(_0xb53b('0x0'));module[_0xb53b('0x1')]={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize[_0xb53b('0x2')]},'request':{'type':Sequelize[_0xb53b('0x2')]},'channel':{'type':Sequelize[_0xb53b('0x2')]},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xb53b('0x2')]},'uniqueid':{'type':Sequelize[_0xb53b('0x2')]},'version':{'type':Sequelize[_0xb53b('0x2')]},'callerid':{'type':Sequelize[_0xb53b('0x2')]},'calleridname':{'type':Sequelize[_0xb53b('0x2')]},'callingpres':{'type':Sequelize[_0xb53b('0x2')]},'callingani2':{'type':Sequelize[_0xb53b('0x2')]},'callington':{'type':Sequelize['STRING']},'callingtns':{'type':Sequelize[_0xb53b('0x2')]},'dnid':{'type':Sequelize[_0xb53b('0x2')]},'rdnis':{'type':Sequelize[_0xb53b('0x2')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0xb53b('0x2')]},'priority':{'type':Sequelize[_0xb53b('0x2')]},'enhanced':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'threadid':{'type':Sequelize[_0xb53b('0x2')]},'project_name':{'type':Sequelize[_0xb53b('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xb53b('0x3')]},'bot':{'type':Sequelize[_0xb53b('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0xf63b=['exports','STRING','BOOLEAN','sequelize'];(function(_0xd62e5c,_0x5f0e46){var _0x29967f=function(_0x131ef1){while(--_0x131ef1){_0xd62e5c['push'](_0xd62e5c['shift']());}};_0x29967f(++_0x5f0e46);}(_0xf63b,0x17f));var _0xbf63=function(_0x22e9cd,_0x5c5897){_0x22e9cd=_0x22e9cd-0x0;var _0x42517e=_0xf63b[_0x22e9cd];return _0x42517e;};'use strict';var Sequelize=require(_0xbf63('0x0'));module[_0xbf63('0x1')]={'network':{'type':Sequelize[_0xbf63('0x2')]},'network_script':{'type':Sequelize[_0xbf63('0x2')]},'request':{'type':Sequelize[_0xbf63('0x2')]},'channel':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xbf63('0x2')]},'type':{'type':Sequelize[_0xbf63('0x2')]},'uniqueid':{'type':Sequelize[_0xbf63('0x2')]},'version':{'type':Sequelize[_0xbf63('0x2')]},'callerid':{'type':Sequelize[_0xbf63('0x2')]},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize['STRING']},'callington':{'type':Sequelize[_0xbf63('0x2')]},'callingtns':{'type':Sequelize[_0xbf63('0x2')]},'dnid':{'type':Sequelize[_0xbf63('0x2')]},'rdnis':{'type':Sequelize[_0xbf63('0x2')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0xbf63('0x2')]},'priority':{'type':Sequelize[_0xbf63('0x2')]},'enhanced':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xbf63('0x2')]},'threadid':{'type':Sequelize[_0xbf63('0x2')]},'project_name':{'type':Sequelize[_0xbf63('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize[_0xbf63('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index 974ca42..0f675ad 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 _0x6ae4=['hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','include','findAll','rows','show','params','length','includeAll','catch','create','body','find','describe','html-pdf','eml-format','fast-json-patch','moment','mustache','util','path','sox','to-csv','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','index','map','SquareReport','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields'];(function(_0x41b2b1,_0x2ed52d){var _0xdbc971=function(_0x59ff57){while(--_0x59ff57){_0x41b2b1['push'](_0x41b2b1['shift']());}};_0xdbc971(++_0x2ed52d);}(_0x6ae4,0x17d));var _0x46ae=function(_0x4d1621,_0x4135de){_0x4d1621=_0x4d1621-0x0;var _0x340bab=_0x6ae4[_0x4d1621];return _0x340bab;};'use strict';var pdf=require(_0x46ae('0x0'));var emlformat=require(_0x46ae('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x46ae('0x2'));var rp=require('request-promise');var moment=require(_0x46ae('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x46ae('0x4'));var util=require(_0x46ae('0x5'));var path=require(_0x46ae('0x6'));var sox=require(_0x46ae('0x7'));var csv=require(_0x46ae('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x46ae('0x9'));var crypto=require(_0x46ae('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x46ae('0xb'));var toCsv=require(_0x46ae('0x8'));var querystring=require(_0x46ae('0xc'));var Papa=require(_0x46ae('0xd'));var Redis=require(_0x46ae('0xe'));var authService=require(_0x46ae('0xf'));var qs=require(_0x46ae('0x10'));var as=require(_0x46ae('0x11'));var hardwareService=require(_0x46ae('0x12'));var logger=require(_0x46ae('0x13'))('api');var utils=require(_0x46ae('0x14'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xf06ba8,_0xa6f2da){_0xa6f2da=_0xa6f2da||0xcc;return function(_0x4cdff9){if(_0x4cdff9){return _0xf06ba8[_0x46ae('0x15')](_0xa6f2da);}return _0xf06ba8[_0x46ae('0x16')](_0xa6f2da)[_0x46ae('0x17')]();};}function respondWithResult(_0x5533d3,_0x41b453){_0x41b453=_0x41b453||0xc8;return function(_0x3506c3){if(_0x3506c3){return _0x5533d3[_0x46ae('0x16')](_0x41b453)[_0x46ae('0x18')](_0x3506c3);}};}function respondWithFilteredResult(_0x31c682,_0x526ce2){return function(_0x2f1acf){if(_0x2f1acf){var _0x4240e0=_0x2f1acf[_0x46ae('0x19')],_0x11a9c7=_0x526ce2['offset'],_0x35fa22=_0x526ce2[_0x46ae('0x1a')]+_0x526ce2[_0x46ae('0x1b')],_0x20e561;if(_0x35fa22>=_0x4240e0){_0x35fa22=_0x4240e0;_0x20e561=0xc8;}else{_0x20e561=0xce;}_0x31c682['status'](_0x20e561);return _0x31c682[_0x46ae('0x1c')](_0x46ae('0x1d'),_0x11a9c7+'-'+_0x35fa22+'/'+_0x4240e0)['json'](_0x2f1acf);}return null;};}function patchUpdates(_0x10a444){return function(_0x24788e){try{jsonpatch[_0x46ae('0x1e')](_0x24788e,_0x10a444,!![]);}catch(_0x30ecb4){return BPromise[_0x46ae('0x1f')](_0x30ecb4);}return _0x24788e[_0x46ae('0x20')]();};}function saveUpdates(_0x553a9b,_0x188d85){return function(_0x1a6934){if(_0x1a6934){return _0x1a6934[_0x46ae('0x21')](_0x553a9b)[_0x46ae('0x22')](function(_0x342750){return _0x342750;});}return null;};}function removeEntity(_0x15b7c0,_0x190f45){return function(_0x53a05){if(_0x53a05){return _0x53a05[_0x46ae('0x23')]()[_0x46ae('0x22')](function(){_0x15b7c0[_0x46ae('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a6478,_0x51e284){return function(_0x3336be){if(!_0x3336be){_0x3a6478['sendStatus'](0x194);}return _0x3336be;};}function handleError(_0xe828e5,_0x5b017d){_0x5b017d=_0x5b017d||0x1f4;return function(_0x196b10){logger[_0x46ae('0x24')](_0x196b10['stack']);if(_0x196b10['name']){delete _0x196b10['name'];}_0xe828e5[_0x46ae('0x16')](_0x5b017d)['send'](_0x196b10);};}exports[_0x46ae('0x25')]=function(_0x12370b,_0x203ca2){var _0x4249ba={},_0x29a8e1={},_0x3afa12={'count':0x0,'rows':[]};var _0xe900e=_[_0x46ae('0x26')](db[_0x46ae('0x27')]['rawAttributes'],function(_0x22c3b9){return{'name':_0x22c3b9[_0x46ae('0x28')],'type':_0x22c3b9[_0x46ae('0x29')][_0x46ae('0x2a')]};});_0x29a8e1[_0x46ae('0x2b')]=_[_0x46ae('0x26')](_0xe900e,_0x46ae('0x2c'));_0x29a8e1[_0x46ae('0x2d')]=_[_0x46ae('0x2e')](_0x12370b[_0x46ae('0x2d')]);_0x29a8e1[_0x46ae('0x2f')]=_[_0x46ae('0x30')](_0x29a8e1[_0x46ae('0x2b')],_0x29a8e1[_0x46ae('0x2d')]);_0x4249ba[_0x46ae('0x31')]=_[_0x46ae('0x30')](_0x29a8e1['model'],qs[_0x46ae('0x32')](_0x12370b[_0x46ae('0x2d')][_0x46ae('0x32')]));_0x4249ba[_0x46ae('0x31')]=_0x4249ba[_0x46ae('0x31')]['length']?_0x4249ba['attributes']:_0x29a8e1[_0x46ae('0x2b')];if(!_0x12370b[_0x46ae('0x2d')][_0x46ae('0x33')]('nolimit')){_0x4249ba[_0x46ae('0x1b')]=qs[_0x46ae('0x1b')](_0x12370b['query'][_0x46ae('0x1b')]);_0x4249ba[_0x46ae('0x1a')]=qs['offset'](_0x12370b[_0x46ae('0x2d')][_0x46ae('0x1a')]);}_0x4249ba[_0x46ae('0x34')]=qs[_0x46ae('0x35')](_0x12370b['query'][_0x46ae('0x35')]);_0x4249ba[_0x46ae('0x36')]=qs['filters'](_[_0x46ae('0x37')](_0x12370b[_0x46ae('0x2d')],_0x29a8e1[_0x46ae('0x2f')]),_0xe900e);if(_0x12370b[_0x46ae('0x2d')]['filter']){_0x4249ba[_0x46ae('0x36')]=_[_0x46ae('0x38')](_0x4249ba[_0x46ae('0x36')],{'$or':_[_0x46ae('0x26')](_0xe900e,function(_0x18ab9c){if(_0x18ab9c[_0x46ae('0x29')]!==_0x46ae('0x39')){var _0x3bef0f={};_0x3bef0f[_0x18ab9c[_0x46ae('0x2c')]]={'$like':'%'+_0x12370b[_0x46ae('0x2d')][_0x46ae('0x3a')]+'%'};return _0x3bef0f;}})});}_0x4249ba=_[_0x46ae('0x38')]({},_0x4249ba,_0x12370b[_0x46ae('0x3b')]);var _0x1cc219={'where':_0x4249ba[_0x46ae('0x36')]};return db[_0x46ae('0x27')][_0x46ae('0x19')](_0x1cc219)[_0x46ae('0x22')](function(_0x548716){_0x3afa12[_0x46ae('0x19')]=_0x548716;if(_0x12370b[_0x46ae('0x2d')]['includeAll']){_0x4249ba[_0x46ae('0x3c')]=[{'all':!![]}];}return db[_0x46ae('0x27')][_0x46ae('0x3d')](_0x4249ba);})[_0x46ae('0x22')](function(_0xb747ed){_0x3afa12[_0x46ae('0x3e')]=_0xb747ed;return _0x3afa12;})[_0x46ae('0x22')](respondWithFilteredResult(_0x203ca2,_0x4249ba))['catch'](handleError(_0x203ca2,null));};exports[_0x46ae('0x3f')]=function(_0xa36e25,_0x2b5e5c){var _0x43dbc6={'raw':!![],'where':{'id':_0xa36e25[_0x46ae('0x40')]['id']}},_0x59294f={};_0x59294f['model']=_[_0x46ae('0x2e')](db[_0x46ae('0x27')]['rawAttributes']);_0x59294f[_0x46ae('0x2d')]=_['keys'](_0xa36e25['query']);_0x59294f[_0x46ae('0x2f')]=_[_0x46ae('0x30')](_0x59294f[_0x46ae('0x2b')],_0x59294f[_0x46ae('0x2d')]);_0x43dbc6['attributes']=_['intersection'](_0x59294f[_0x46ae('0x2b')],qs[_0x46ae('0x32')](_0xa36e25[_0x46ae('0x2d')][_0x46ae('0x32')]));_0x43dbc6[_0x46ae('0x31')]=_0x43dbc6[_0x46ae('0x31')][_0x46ae('0x41')]?_0x43dbc6[_0x46ae('0x31')]:_0x59294f[_0x46ae('0x2b')];if(_0xa36e25['query'][_0x46ae('0x42')]){_0x43dbc6['include']=[{'all':!![]}];}_0x43dbc6=_[_0x46ae('0x38')]({},_0x43dbc6,_0xa36e25[_0x46ae('0x3b')]);return db[_0x46ae('0x27')]['find'](_0x43dbc6)['then'](handleEntityNotFound(_0x2b5e5c,null))['then'](respondWithResult(_0x2b5e5c,null))[_0x46ae('0x43')](handleError(_0x2b5e5c,null));};exports['create']=function(_0x158321,_0x5c1f3a){return db['SquareReport'][_0x46ae('0x44')](_0x158321['body'],{})['then'](respondWithResult(_0x5c1f3a,0xc9))[_0x46ae('0x43')](handleError(_0x5c1f3a,null));};exports[_0x46ae('0x21')]=function(_0xef0b07,_0x26ac02){if(_0xef0b07[_0x46ae('0x45')]['id']){delete _0xef0b07[_0x46ae('0x45')]['id'];}return db[_0x46ae('0x27')][_0x46ae('0x46')]({'where':{'id':_0xef0b07['params']['id']}})['then'](handleEntityNotFound(_0x26ac02,null))[_0x46ae('0x22')](saveUpdates(_0xef0b07[_0x46ae('0x45')],null))[_0x46ae('0x22')](respondWithResult(_0x26ac02,null))[_0x46ae('0x43')](handleError(_0x26ac02,null));};exports[_0x46ae('0x23')]=function(_0x12a05e,_0xc5d03c){return db[_0x46ae('0x27')][_0x46ae('0x46')]({'where':{'id':_0x12a05e['params']['id']}})[_0x46ae('0x22')](handleEntityNotFound(_0xc5d03c,null))[_0x46ae('0x22')](removeEntity(_0xc5d03c,null))[_0x46ae('0x43')](handleError(_0xc5d03c,null));};exports[_0x46ae('0x47')]=function(_0x5e4a04,_0x57eaae){return db[_0x46ae('0x27')][_0x46ae('0x47')]()[_0x46ae('0x22')](respondWithResult(_0x57eaae,null))[_0x46ae('0x43')](handleError(_0x57eaae,null));}; \ No newline at end of file +var _0xb45b=['SquareReport','rawAttributes','fieldName','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','pick','filter','where','merge','type','options','includeAll','include','rows','catch','params','keys','find','create','body','describe','html-pdf','rimraf','zip-dir','request-promise','bluebird','sox','to-csv','ejs','lodash','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','Content-Range','apply','reject','update','then','error','stack','name','map'];(function(_0x42c67a,_0x38fd8f){var _0x1dafe9=function(_0x4717fe){while(--_0x4717fe){_0x42c67a['push'](_0x42c67a['shift']());}};_0x1dafe9(++_0x38fd8f);}(_0xb45b,0x168));var _0xbb45=function(_0x24a88e,_0x22a0b8){_0x24a88e=_0x24a88e-0x0;var _0x232cbb=_0xb45b[_0x24a88e];return _0x232cbb;};'use strict';var pdf=require(_0xbb45('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xbb45('0x1'));var zipdir=require(_0xbb45('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbb45('0x3'));var moment=require('moment');var BPromise=require(_0xbb45('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xbb45('0x5'));var csv=require(_0xbb45('0x6'));var ejs=require(_0xbb45('0x7'));var fs=require('fs');var _=require(_0xbb45('0x8'));var squel=require(_0xbb45('0x9'));var crypto=require(_0xbb45('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xbb45('0xb'));var toCsv=require(_0xbb45('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xbb45('0xc'));var authService=require(_0xbb45('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0xbb45('0xe'));var hardwareService=require(_0xbb45('0xf'));var logger=require(_0xbb45('0x10'))(_0xbb45('0x11'));var utils=require('../../config/utils');var config=require(_0xbb45('0x12'));var db=require(_0xbb45('0x13'))['db'];function respondWithStatusCode(_0x83e550,_0x3d9470){_0x3d9470=_0x3d9470||0xcc;return function(_0x1d79da){if(_0x1d79da){return _0x83e550[_0xbb45('0x14')](_0x3d9470);}return _0x83e550['status'](_0x3d9470)[_0xbb45('0x15')]();};}function respondWithResult(_0x45d321,_0x5110fe){_0x5110fe=_0x5110fe||0xc8;return function(_0x57f582){if(_0x57f582){return _0x45d321[_0xbb45('0x16')](_0x5110fe)[_0xbb45('0x17')](_0x57f582);}};}function respondWithFilteredResult(_0x18d546,_0x3d892f){return function(_0x4c0410){if(_0x4c0410){var _0x32b16d=_0x4c0410[_0xbb45('0x18')],_0xb107da=_0x3d892f[_0xbb45('0x19')],_0x354391=_0x3d892f[_0xbb45('0x19')]+_0x3d892f[_0xbb45('0x1a')],_0x773af5;if(_0x354391>=_0x32b16d){_0x354391=_0x32b16d;_0x773af5=0xc8;}else{_0x773af5=0xce;}_0x18d546[_0xbb45('0x16')](_0x773af5);return _0x18d546['set'](_0xbb45('0x1b'),_0xb107da+'-'+_0x354391+'/'+_0x32b16d)['json'](_0x4c0410);}return null;};}function patchUpdates(_0x2f0b8d){return function(_0x2d2897){try{jsonpatch[_0xbb45('0x1c')](_0x2d2897,_0x2f0b8d,!![]);}catch(_0x42e4d9){return BPromise[_0xbb45('0x1d')](_0x42e4d9);}return _0x2d2897['save']();};}function saveUpdates(_0x49bd07,_0x5cfba2){return function(_0x5a0c5d){if(_0x5a0c5d){return _0x5a0c5d[_0xbb45('0x1e')](_0x49bd07)[_0xbb45('0x1f')](function(_0x47a3e0){return _0x47a3e0;});}return null;};}function removeEntity(_0x4ed11c,_0x3c143d){return function(_0x42ea0e){if(_0x42ea0e){return _0x42ea0e['destroy']()[_0xbb45('0x1f')](function(){_0x4ed11c[_0xbb45('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x20d911,_0x28b189){return function(_0x48da65){if(!_0x48da65){_0x20d911[_0xbb45('0x14')](0x194);}return _0x48da65;};}function handleError(_0x1e1175,_0x3b5a67){_0x3b5a67=_0x3b5a67||0x1f4;return function(_0x41f553){logger[_0xbb45('0x20')](_0x41f553[_0xbb45('0x21')]);if(_0x41f553[_0xbb45('0x22')]){delete _0x41f553[_0xbb45('0x22')];}_0x1e1175['status'](_0x3b5a67)['send'](_0x41f553);};}exports['index']=function(_0x5c4afb,_0x22bec9){var _0xb10c36={},_0x4703bc={},_0x6f0262={'count':0x0,'rows':[]};var _0x4a4e05=_[_0xbb45('0x23')](db[_0xbb45('0x24')][_0xbb45('0x25')],function(_0x33518e){return{'name':_0x33518e[_0xbb45('0x26')],'type':_0x33518e['type'][_0xbb45('0x27')]};});_0x4703bc[_0xbb45('0x28')]=_[_0xbb45('0x23')](_0x4a4e05,_0xbb45('0x22'));_0x4703bc[_0xbb45('0x29')]=_['keys'](_0x5c4afb[_0xbb45('0x29')]);_0x4703bc['filters']=_[_0xbb45('0x2a')](_0x4703bc[_0xbb45('0x28')],_0x4703bc[_0xbb45('0x29')]);_0xb10c36[_0xbb45('0x2b')]=_[_0xbb45('0x2a')](_0x4703bc[_0xbb45('0x28')],qs[_0xbb45('0x2c')](_0x5c4afb[_0xbb45('0x29')][_0xbb45('0x2c')]));_0xb10c36[_0xbb45('0x2b')]=_0xb10c36[_0xbb45('0x2b')][_0xbb45('0x2d')]?_0xb10c36[_0xbb45('0x2b')]:_0x4703bc['model'];if(!_0x5c4afb[_0xbb45('0x29')][_0xbb45('0x2e')](_0xbb45('0x2f'))){_0xb10c36[_0xbb45('0x1a')]=qs['limit'](_0x5c4afb[_0xbb45('0x29')][_0xbb45('0x1a')]);_0xb10c36[_0xbb45('0x19')]=qs[_0xbb45('0x19')](_0x5c4afb[_0xbb45('0x29')]['offset']);}_0xb10c36['order']=qs[_0xbb45('0x30')](_0x5c4afb['query'][_0xbb45('0x30')]);_0xb10c36['where']=qs[_0xbb45('0x31')](_[_0xbb45('0x32')](_0x5c4afb[_0xbb45('0x29')],_0x4703bc[_0xbb45('0x31')]),_0x4a4e05);if(_0x5c4afb[_0xbb45('0x29')][_0xbb45('0x33')]){_0xb10c36[_0xbb45('0x34')]=_[_0xbb45('0x35')](_0xb10c36[_0xbb45('0x34')],{'$or':_['map'](_0x4a4e05,function(_0x2b64e5){if(_0x2b64e5[_0xbb45('0x36')]!=='VIRTUAL'){var _0x365386={};_0x365386[_0x2b64e5[_0xbb45('0x22')]]={'$like':'%'+_0x5c4afb[_0xbb45('0x29')][_0xbb45('0x33')]+'%'};return _0x365386;}})});}_0xb10c36=_[_0xbb45('0x35')]({},_0xb10c36,_0x5c4afb[_0xbb45('0x37')]);var _0x1576b7={'where':_0xb10c36[_0xbb45('0x34')]};return db[_0xbb45('0x24')][_0xbb45('0x18')](_0x1576b7)[_0xbb45('0x1f')](function(_0x14b743){_0x6f0262[_0xbb45('0x18')]=_0x14b743;if(_0x5c4afb[_0xbb45('0x29')][_0xbb45('0x38')]){_0xb10c36[_0xbb45('0x39')]=[{'all':!![]}];}return db[_0xbb45('0x24')]['findAll'](_0xb10c36);})[_0xbb45('0x1f')](function(_0x581727){_0x6f0262[_0xbb45('0x3a')]=_0x581727;return _0x6f0262;})[_0xbb45('0x1f')](respondWithFilteredResult(_0x22bec9,_0xb10c36))[_0xbb45('0x3b')](handleError(_0x22bec9,null));};exports['show']=function(_0x5cd1c9,_0x576cd7){var _0x50ad0d={'raw':!![],'where':{'id':_0x5cd1c9[_0xbb45('0x3c')]['id']}},_0x10dce5={};_0x10dce5['model']=_[_0xbb45('0x3d')](db[_0xbb45('0x24')][_0xbb45('0x25')]);_0x10dce5[_0xbb45('0x29')]=_[_0xbb45('0x3d')](_0x5cd1c9[_0xbb45('0x29')]);_0x10dce5[_0xbb45('0x31')]=_[_0xbb45('0x2a')](_0x10dce5[_0xbb45('0x28')],_0x10dce5[_0xbb45('0x29')]);_0x50ad0d['attributes']=_[_0xbb45('0x2a')](_0x10dce5[_0xbb45('0x28')],qs[_0xbb45('0x2c')](_0x5cd1c9['query'][_0xbb45('0x2c')]));_0x50ad0d[_0xbb45('0x2b')]=_0x50ad0d[_0xbb45('0x2b')]['length']?_0x50ad0d[_0xbb45('0x2b')]:_0x10dce5[_0xbb45('0x28')];if(_0x5cd1c9[_0xbb45('0x29')][_0xbb45('0x38')]){_0x50ad0d[_0xbb45('0x39')]=[{'all':!![]}];}_0x50ad0d=_['merge']({},_0x50ad0d,_0x5cd1c9[_0xbb45('0x37')]);return db[_0xbb45('0x24')][_0xbb45('0x3e')](_0x50ad0d)[_0xbb45('0x1f')](handleEntityNotFound(_0x576cd7,null))[_0xbb45('0x1f')](respondWithResult(_0x576cd7,null))[_0xbb45('0x3b')](handleError(_0x576cd7,null));};exports[_0xbb45('0x3f')]=function(_0x54da13,_0x2c0c5c){return db[_0xbb45('0x24')][_0xbb45('0x3f')](_0x54da13[_0xbb45('0x40')],{})[_0xbb45('0x1f')](respondWithResult(_0x2c0c5c,0xc9))[_0xbb45('0x3b')](handleError(_0x2c0c5c,null));};exports['update']=function(_0x7aea24,_0xcdd66d){if(_0x7aea24[_0xbb45('0x40')]['id']){delete _0x7aea24['body']['id'];}return db[_0xbb45('0x24')][_0xbb45('0x3e')]({'where':{'id':_0x7aea24[_0xbb45('0x3c')]['id']}})[_0xbb45('0x1f')](handleEntityNotFound(_0xcdd66d,null))[_0xbb45('0x1f')](saveUpdates(_0x7aea24[_0xbb45('0x40')],null))[_0xbb45('0x1f')](respondWithResult(_0xcdd66d,null))[_0xbb45('0x3b')](handleError(_0xcdd66d,null));};exports['destroy']=function(_0x11a451,_0x486b11){return db[_0xbb45('0x24')][_0xbb45('0x3e')]({'where':{'id':_0x11a451[_0xbb45('0x3c')]['id']}})[_0xbb45('0x1f')](handleEntityNotFound(_0x486b11,null))[_0xbb45('0x1f')](removeEntity(_0x486b11,null))[_0xbb45('0x3b')](handleError(_0x486b11,null));};exports['describe']=function(_0x416df8,_0x58e962){return db[_0xbb45('0x24')][_0xbb45('0x41')]()[_0xbb45('0x1f')](respondWithResult(_0x58e962,null))[_0xbb45('0x3b')](handleError(_0x58e962,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index cee194c..831d736 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 _0x743c=['SquareReport','report_square','uid_pname','uniqueid','leaveAt','lodash','../../config/logger','api','moment','request-promise','path','./squareReport.attributes','define'];(function(_0x449370,_0xef42ff){var _0x871e63=function(_0x46c92e){while(--_0x46c92e){_0x449370['push'](_0x449370['shift']());}};_0x871e63(++_0xef42ff);}(_0x743c,0x87));var _0xc743=function(_0x4c4d07,_0x48512b){_0x4c4d07=_0x4c4d07-0x0;var _0x278851=_0x743c[_0x4c4d07];return _0x278851;};'use strict';var _=require(_0xc743('0x0'));var util=require('util');var logger=require(_0xc743('0x1'))(_0xc743('0x2'));var moment=require(_0xc743('0x3'));var BPromise=require('bluebird');var rp=require(_0xc743('0x4'));var fs=require('fs');var path=require(_0xc743('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc743('0x6'));module['exports']=function(_0x19574a,_0x55e6aa){return _0x19574a[_0xc743('0x7')](_0xc743('0x8'),attributes,{'tableName':_0xc743('0x9'),'paranoid':![],'indexes':[{'name':_0xc743('0xa'),'fields':[_0xc743('0xb'),'project_name']},{'name':_0xc743('0xc'),'fields':['leaveAt']}],'timestamps':!![]});}; \ No newline at end of file +var _0x5316=['SquareReport','report_square','uid_pname','project_name','leaveAt','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./squareReport.attributes','exports','define'];(function(_0x58bfd5,_0x4cfae1){var _0x56dee6=function(_0x37ca72){while(--_0x37ca72){_0x58bfd5['push'](_0x58bfd5['shift']());}};_0x56dee6(++_0x4cfae1);}(_0x5316,0x126));var _0x6531=function(_0x20b1ca,_0xcaa99b){_0x20b1ca=_0x20b1ca-0x0;var _0x13a457=_0x5316[_0x20b1ca];return _0x13a457;};'use strict';var _=require(_0x6531('0x0'));var util=require(_0x6531('0x1'));var logger=require(_0x6531('0x2'))(_0x6531('0x3'));var moment=require('moment');var BPromise=require(_0x6531('0x4'));var rp=require(_0x6531('0x5'));var fs=require('fs');var path=require(_0x6531('0x6'));var rimraf=require(_0x6531('0x7'));var config=require(_0x6531('0x8'));var attributes=require(_0x6531('0x9'));module[_0x6531('0xa')]=function(_0x5ce68e,_0x12da73){return _0x5ce68e[_0x6531('0xb')](_0x6531('0xc'),attributes,{'tableName':_0x6531('0xd'),'paranoid':![],'indexes':[{'name':_0x6531('0xe'),'fields':['uniqueid',_0x6531('0xf')]},{'name':'leaveAt','fields':[_0x6531('0x10')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 8b8b7c9..be5d5fb 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 _0x2a8c=['then','info','debug','SquareReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','SquareReport,\x20%s,\x20%s','message','result','catch','CreateSquareReport','create','body','options','raw','SquareReport','update','where','attributes','limit','UpdateSquareReport','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','request'];(function(_0x38f3e7,_0x4c5fc1){var _0x229378=function(_0x29674a){while(--_0x29674a){_0x38f3e7['push'](_0x38f3e7['shift']());}};_0x229378(++_0x4c5fc1);}(_0x2a8c,0x1af));var _0xc2a8=function(_0x2270d1,_0xf4cd83){_0x2270d1=_0x2270d1-0x0;var _0x303c64=_0x2a8c[_0x2270d1];return _0x303c64;};'use strict';var _=require(_0xc2a8('0x0'));var util=require('util');var moment=require(_0xc2a8('0x1'));var BPromise=require(_0xc2a8('0x2'));var rs=require(_0xc2a8('0x3'));var fs=require('fs');var Redis=require(_0xc2a8('0x4'));var db=require(_0xc2a8('0x5'))['db'];var utils=require(_0xc2a8('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xc2a8('0x7'));var jayson=require(_0xc2a8('0x8'));var client=jayson['client'][_0xc2a8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xba9c3c,_0x4bddc9,_0x2cf9b3){return new BPromise(function(_0x51b04d,_0x4f9a97){return client[_0xc2a8('0xa')](_0xba9c3c,_0x2cf9b3)[_0xc2a8('0xb')](function(_0x701700){logger[_0xc2a8('0xc')]('SquareReport,\x20%s,\x20%s',_0x4bddc9,'request\x20sent');logger[_0xc2a8('0xd')](_0xc2a8('0xe'),_0x4bddc9,_0xc2a8('0xf'),JSON[_0xc2a8('0x10')](_0x701700));if(_0x701700[_0xc2a8('0x11')]){if(_0x701700[_0xc2a8('0x11')][_0xc2a8('0x12')]===0x1f4){logger[_0xc2a8('0x11')](_0xc2a8('0x13'),_0x4bddc9,_0x701700[_0xc2a8('0x11')][_0xc2a8('0x14')]);return _0x4f9a97(_0x701700['error'][_0xc2a8('0x14')]);}logger['error'](_0xc2a8('0x13'),_0x4bddc9,_0x701700[_0xc2a8('0x11')][_0xc2a8('0x14')]);return _0x51b04d(_0x701700[_0xc2a8('0x11')]['message']);}else{logger[_0xc2a8('0xc')](_0xc2a8('0x13'),_0x4bddc9,_0xc2a8('0xf'));_0x51b04d(_0x701700[_0xc2a8('0x15')][_0xc2a8('0x14')]);}})[_0xc2a8('0x16')](function(_0x338efc){logger[_0xc2a8('0x11')](_0xc2a8('0x13'),_0x4bddc9,_0x338efc);_0x4f9a97(_0x338efc);});});}exports[_0xc2a8('0x17')]=function(_0x3cee19){var _0x4e0b5b=this;return new Promise(function(_0x395105,_0x4d1267){return db['SquareReport'][_0xc2a8('0x18')](_0x3cee19[_0xc2a8('0x19')],{'raw':_0x3cee19[_0xc2a8('0x1a')]?_0x3cee19[_0xc2a8('0x1a')][_0xc2a8('0x1b')]===undefined?!![]:![]:!![]})[_0xc2a8('0xb')](function(_0x474d30){logger['info'](_0xc2a8('0x17'),_0x3cee19);logger[_0xc2a8('0xd')]('CreateSquareReport',_0x3cee19,JSON[_0xc2a8('0x10')](_0x474d30));_0x395105(_0x474d30);})['catch'](function(_0x5e8c24){logger[_0xc2a8('0x11')]('CreateSquareReport',_0x5e8c24[_0xc2a8('0x14')],_0x3cee19);_0x4d1267(_0x4e0b5b[_0xc2a8('0x11')](0x1f4,_0x5e8c24[_0xc2a8('0x14')]));});});};exports['UpdateSquareReport']=function(_0x33ca82){var _0x58eaea=this;return new Promise(function(_0x5f4f11,_0x44a427){return db[_0xc2a8('0x1c')][_0xc2a8('0x1d')](_0x33ca82[_0xc2a8('0x19')],{'raw':_0x33ca82[_0xc2a8('0x1a')]?_0x33ca82[_0xc2a8('0x1a')][_0xc2a8('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x33ca82[_0xc2a8('0x1a')]?_0x33ca82[_0xc2a8('0x1a')][_0xc2a8('0x1e')]||null:null,'attributes':_0x33ca82[_0xc2a8('0x1a')]?_0x33ca82['options'][_0xc2a8('0x1f')]||null:null,'limit':_0x33ca82[_0xc2a8('0x1a')]?_0x33ca82['options'][_0xc2a8('0x20')]||null:null})[_0xc2a8('0xb')](function(_0x5e0c92){logger[_0xc2a8('0xc')](_0xc2a8('0x21'),_0x33ca82);logger[_0xc2a8('0xd')]('UpdateSquareReport',_0x33ca82,JSON[_0xc2a8('0x10')](_0x5e0c92));_0x5f4f11(_0x5e0c92);})[_0xc2a8('0x16')](function(_0x5a6365){logger[_0xc2a8('0x11')](_0xc2a8('0x21'),_0x5a6365[_0xc2a8('0x14')],_0x33ca82);_0x44a427(_0x58eaea[_0xc2a8('0x11')](0x1f4,_0x5a6365['message']));});});}; \ No newline at end of file +var _0x0146=['where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','stringify','error','SquareReport,\x20%s,\x20%s','message','catch','CreateSquareReport','create','body','options','UpdateSquareReport','raw'];(function(_0x4bb631,_0x385394){var _0x27a8f6=function(_0x5d6d03){while(--_0x5d6d03){_0x4bb631['push'](_0x4bb631['shift']());}};_0x27a8f6(++_0x385394);}(_0x0146,0x1b5));var _0x6014=function(_0x2caaef,_0x3c19ed){_0x2caaef=_0x2caaef-0x0;var _0xd011f8=_0x0146[_0x2caaef];return _0xd011f8;};'use strict';var _=require(_0x6014('0x0'));var util=require(_0x6014('0x1'));var moment=require(_0x6014('0x2'));var BPromise=require(_0x6014('0x3'));var rs=require(_0x6014('0x4'));var fs=require('fs');var Redis=require(_0x6014('0x5'));var db=require(_0x6014('0x6'))['db'];var utils=require(_0x6014('0x7'));var logger=require('../../config/logger')(_0x6014('0x8'));var config=require(_0x6014('0x9'));var jayson=require(_0x6014('0xa'));var client=jayson[_0x6014('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x100205,_0x10e7db,_0xd19279){return new BPromise(function(_0x459f3e,_0xcad898){return client[_0x6014('0xc')](_0x100205,_0xd19279)[_0x6014('0xd')](function(_0x59f05f){logger[_0x6014('0xe')]('SquareReport,\x20%s,\x20%s',_0x10e7db,_0x6014('0xf'));logger[_0x6014('0x10')]('SquareReport,\x20%s,\x20%s,\x20%s',_0x10e7db,_0x6014('0xf'),JSON[_0x6014('0x11')](_0x59f05f));if(_0x59f05f[_0x6014('0x12')]){if(_0x59f05f[_0x6014('0x12')]['code']===0x1f4){logger[_0x6014('0x12')]('SquareReport,\x20%s,\x20%s',_0x10e7db,_0x59f05f[_0x6014('0x12')]['message']);return _0xcad898(_0x59f05f[_0x6014('0x12')]['message']);}logger[_0x6014('0x12')](_0x6014('0x13'),_0x10e7db,_0x59f05f[_0x6014('0x12')][_0x6014('0x14')]);return _0x459f3e(_0x59f05f[_0x6014('0x12')][_0x6014('0x14')]);}else{logger['info'](_0x6014('0x13'),_0x10e7db,'request\x20sent');_0x459f3e(_0x59f05f['result'][_0x6014('0x14')]);}})[_0x6014('0x15')](function(_0x5d97ac){logger['error'](_0x6014('0x13'),_0x10e7db,_0x5d97ac);_0xcad898(_0x5d97ac);});});}exports[_0x6014('0x16')]=function(_0x51dcb0){var _0x34be7a=this;return new Promise(function(_0x4c6670,_0x26adbb){return db['SquareReport'][_0x6014('0x17')](_0x51dcb0[_0x6014('0x18')],{'raw':_0x51dcb0[_0x6014('0x19')]?_0x51dcb0[_0x6014('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x6014('0xd')](function(_0x462e8d){logger[_0x6014('0xe')]('CreateSquareReport',_0x51dcb0);logger[_0x6014('0x10')](_0x6014('0x16'),_0x51dcb0,JSON['stringify'](_0x462e8d));_0x4c6670(_0x462e8d);})[_0x6014('0x15')](function(_0xac71dc){logger['error'](_0x6014('0x16'),_0xac71dc[_0x6014('0x14')],_0x51dcb0);_0x26adbb(_0x34be7a[_0x6014('0x12')](0x1f4,_0xac71dc['message']));});});};exports[_0x6014('0x1a')]=function(_0x487e1a){var _0x62a9cf=this;return new Promise(function(_0x4d7577,_0xdb28d){return db['SquareReport']['update'](_0x487e1a['body'],{'raw':_0x487e1a[_0x6014('0x19')]?_0x487e1a[_0x6014('0x19')][_0x6014('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x487e1a['options']?_0x487e1a['options'][_0x6014('0x1c')]||null:null,'attributes':_0x487e1a['options']?_0x487e1a['options'][_0x6014('0x1d')]||null:null,'limit':_0x487e1a[_0x6014('0x19')]?_0x487e1a['options'][_0x6014('0x1e')]||null:null})['then'](function(_0x11927c){logger['info'](_0x6014('0x1a'),_0x487e1a);logger[_0x6014('0x10')](_0x6014('0x1a'),_0x487e1a,JSON[_0x6014('0x11')](_0x11927c));_0x4d7577(_0x11927c);})[_0x6014('0x15')](function(_0x29a3aa){logger[_0x6014('0x12')](_0x6014('0x1a'),_0x29a3aa['message'],_0x487e1a);_0xdb28d(_0x62a9cf['error'](0x1f4,_0x29a3aa[_0x6014('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 77bba68..fbe08b4 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 _0x5f2f=['/describe','/:id','post','create','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index'];(function(_0x3b1e0c,_0x4bad1d){var _0x4cf9bd=function(_0x57fef7){while(--_0x57fef7){_0x3b1e0c['push'](_0x3b1e0c['shift']());}};_0x4cf9bd(++_0x4bad1d);}(_0x5f2f,0x73));var _0xf5f2=function(_0x242969,_0x19d676){_0x242969=_0x242969-0x0;var _0x2f22d2=_0x5f2f[_0x242969];return _0x2f22d2;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var auth=require(_0xf5f2('0x6'));var interaction=require(_0xf5f2('0x7'));var config=require('../../config/environment');var controller=require('./squareReportDetail.controller');router[_0xf5f2('0x8')]('/',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0xa')]);router[_0xf5f2('0x8')](_0xf5f2('0xb'),auth[_0xf5f2('0x9')](),controller['describe']);router[_0xf5f2('0x8')](_0xf5f2('0xc'),auth[_0xf5f2('0x9')](),controller['show']);router[_0xf5f2('0xd')]('/',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0xe')]);router['put'](_0xf5f2('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xf5f2('0xf')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0x10')]);module[_0xf5f2('0x11')]=router; \ No newline at end of file +var _0x7a54=['describe','/:id','create','delete','destroy','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated'];(function(_0x113009,_0x43eeb6){var _0x5375bc=function(_0x414ed1){while(--_0x414ed1){_0x113009['push'](_0x113009['shift']());}};_0x5375bc(++_0x43eeb6);}(_0x7a54,0x106));var _0x47a5=function(_0x4a59ba,_0x530e2b){_0x4a59ba=_0x4a59ba-0x0;var _0x338741=_0x7a54[_0x4a59ba];return _0x338741;};'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 diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index effb034..19e46fd 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 _0x8198=['STRING','TEXT'];(function(_0x86a99c,_0x1e51ae){var _0x88b958=function(_0x51b314){while(--_0x51b314){_0x86a99c['push'](_0x86a99c['shift']());}};_0x88b958(++_0x1e51ae);}(_0x8198,0x1f2));var _0x8819=function(_0x2d8434,_0x43d781){_0x2d8434=_0x2d8434-0x0;var _0x26b9e4=_0x8198[_0x2d8434];return _0x26b9e4;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING']},'node':{'type':Sequelize['STRING']},'application':{'type':Sequelize[_0x8819('0x0')]},'data':{'type':Sequelize[_0x8819('0x1')]},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x8819('0x0')]}}; \ No newline at end of file +var _0x331d=['STRING','exports'];(function(_0xda0001,_0x5d3e28){var _0x3c1c06=function(_0x1afeb6){while(--_0x1afeb6){_0xda0001['push'](_0xda0001['shift']());}};_0x3c1c06(++_0x5d3e28);}(_0x331d,0x83));var _0xd331=function(_0x4a3ab8,_0x2b9773){_0x4a3ab8=_0x4a3ab8-0x0;var _0x494906=_0x331d[_0x4a3ab8];return _0x494906;};'use strict';var Sequelize=require('sequelize');module[_0xd331('0x0')]={'uniqueid':{'type':Sequelize[_0xd331('0x1')]},'node':{'type':Sequelize[_0xd331('0x1')]},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize['TEXT']},'project_name':{'type':Sequelize[_0xd331('0x1')]},'callerid':{'type':Sequelize[_0xd331('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 5282a63..9f16e80 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 _0x1069=['rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','catch','params','keys','create','body','find','describe','html-pdf','eml-format','zip-dir','request-promise','bluebird','util','path','sox','ejs','lodash','squel','crypto','querystring','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','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','map','SquareDetailsReport'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x1069,0xf9));var _0x9106=function(_0x37dfa5,_0x5d1391){_0x37dfa5=_0x37dfa5-0x0;var _0x1a8f23=_0x1069[_0x37dfa5];return _0x1a8f23;};'use strict';var pdf=require(_0x9106('0x0'));var emlformat=require(_0x9106('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x9106('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9106('0x3'));var moment=require('moment');var BPromise=require(_0x9106('0x4'));var Mustache=require('mustache');var util=require(_0x9106('0x5'));var path=require(_0x9106('0x6'));var sox=require(_0x9106('0x7'));var csv=require('to-csv');var ejs=require(_0x9106('0x8'));var fs=require('fs');var _=require(_0x9106('0x9'));var squel=require(_0x9106('0xa'));var crypto=require(_0x9106('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x9106('0xc'));var Papa=require(_0x9106('0xd'));var Redis=require('ioredis');var authService=require(_0x9106('0xe'));var qs=require(_0x9106('0xf'));var as=require(_0x9106('0x10'));var hardwareService=require(_0x9106('0x11'));var logger=require(_0x9106('0x12'))(_0x9106('0x13'));var utils=require(_0x9106('0x14'));var config=require(_0x9106('0x15'));var db=require(_0x9106('0x16'))['db'];function respondWithStatusCode(_0x13f5f5,_0x2a8c95){_0x2a8c95=_0x2a8c95||0xcc;return function(_0x3dbcd6){if(_0x3dbcd6){return _0x13f5f5[_0x9106('0x17')](_0x2a8c95);}return _0x13f5f5[_0x9106('0x18')](_0x2a8c95)[_0x9106('0x19')]();};}function respondWithResult(_0x20032a,_0x2038b9){_0x2038b9=_0x2038b9||0xc8;return function(_0x40d2f9){if(_0x40d2f9){return _0x20032a['status'](_0x2038b9)[_0x9106('0x1a')](_0x40d2f9);}};}function respondWithFilteredResult(_0x4d390a,_0x350c22){return function(_0x12e8e7){if(_0x12e8e7){var _0x23e53b=_0x12e8e7[_0x9106('0x1b')],_0x59c101=_0x350c22[_0x9106('0x1c')],_0x33bd49=_0x350c22[_0x9106('0x1c')]+_0x350c22['limit'],_0x5c76ec;if(_0x33bd49>=_0x23e53b){_0x33bd49=_0x23e53b;_0x5c76ec=0xc8;}else{_0x5c76ec=0xce;}_0x4d390a[_0x9106('0x18')](_0x5c76ec);return _0x4d390a[_0x9106('0x1d')](_0x9106('0x1e'),_0x59c101+'-'+_0x33bd49+'/'+_0x23e53b)[_0x9106('0x1a')](_0x12e8e7);}return null;};}function patchUpdates(_0x54889d){return function(_0x28ab0d){try{jsonpatch['apply'](_0x28ab0d,_0x54889d,!![]);}catch(_0x5f5df3){return BPromise[_0x9106('0x1f')](_0x5f5df3);}return _0x28ab0d[_0x9106('0x20')]();};}function saveUpdates(_0x2d571a,_0x3b1c0e){return function(_0x1a3254){if(_0x1a3254){return _0x1a3254[_0x9106('0x21')](_0x2d571a)[_0x9106('0x22')](function(_0xc96a3f){return _0xc96a3f;});}return null;};}function removeEntity(_0x1cb33e,_0x319884){return function(_0x17a347){if(_0x17a347){return _0x17a347[_0x9106('0x23')]()[_0x9106('0x22')](function(){_0x1cb33e['status'](0xcc)[_0x9106('0x19')]();});}};}function handleEntityNotFound(_0x5526de,_0x3502ee){return function(_0x143ca1){if(!_0x143ca1){_0x5526de[_0x9106('0x17')](0x194);}return _0x143ca1;};}function handleError(_0x3a0646,_0x5884f3){_0x5884f3=_0x5884f3||0x1f4;return function(_0x395c2c){logger[_0x9106('0x24')](_0x395c2c[_0x9106('0x25')]);if(_0x395c2c[_0x9106('0x26')]){delete _0x395c2c[_0x9106('0x26')];}_0x3a0646[_0x9106('0x18')](_0x5884f3)[_0x9106('0x27')](_0x395c2c);};}exports[_0x9106('0x28')]=function(_0x25a48e,_0x58c166){var _0x38715e={},_0x259695={},_0x13194e={'count':0x0,'rows':[]};var _0x2e5239=_[_0x9106('0x29')](db[_0x9106('0x2a')][_0x9106('0x2b')],function(_0x1213fc){return{'name':_0x1213fc[_0x9106('0x2c')],'type':_0x1213fc[_0x9106('0x2d')][_0x9106('0x2e')]};});_0x259695[_0x9106('0x2f')]=_[_0x9106('0x29')](_0x2e5239,_0x9106('0x26'));_0x259695[_0x9106('0x30')]=_['keys'](_0x25a48e['query']);_0x259695[_0x9106('0x31')]=_[_0x9106('0x32')](_0x259695[_0x9106('0x2f')],_0x259695[_0x9106('0x30')]);_0x38715e[_0x9106('0x33')]=_[_0x9106('0x32')](_0x259695['model'],qs[_0x9106('0x34')](_0x25a48e[_0x9106('0x30')][_0x9106('0x34')]));_0x38715e['attributes']=_0x38715e['attributes'][_0x9106('0x35')]?_0x38715e[_0x9106('0x33')]:_0x259695[_0x9106('0x2f')];if(!_0x25a48e['query'][_0x9106('0x36')](_0x9106('0x37'))){_0x38715e[_0x9106('0x38')]=qs[_0x9106('0x38')](_0x25a48e[_0x9106('0x30')][_0x9106('0x38')]);_0x38715e[_0x9106('0x1c')]=qs[_0x9106('0x1c')](_0x25a48e[_0x9106('0x30')][_0x9106('0x1c')]);}_0x38715e['order']=qs[_0x9106('0x39')](_0x25a48e[_0x9106('0x30')][_0x9106('0x39')]);_0x38715e[_0x9106('0x3a')]=qs[_0x9106('0x31')](_[_0x9106('0x3b')](_0x25a48e[_0x9106('0x30')],_0x259695[_0x9106('0x31')]),_0x2e5239);if(_0x25a48e[_0x9106('0x30')][_0x9106('0x3c')]){_0x38715e[_0x9106('0x3a')]=_[_0x9106('0x3d')](_0x38715e[_0x9106('0x3a')],{'$or':_['map'](_0x2e5239,function(_0x3278fe){if(_0x3278fe[_0x9106('0x2d')]!==_0x9106('0x3e')){var _0x2f39c5={};_0x2f39c5[_0x3278fe['name']]={'$like':'%'+_0x25a48e[_0x9106('0x30')]['filter']+'%'};return _0x2f39c5;}})});}_0x38715e=_[_0x9106('0x3d')]({},_0x38715e,_0x25a48e[_0x9106('0x3f')]);var _0xaa1b4f={'where':_0x38715e['where']};return db[_0x9106('0x2a')]['count'](_0xaa1b4f)[_0x9106('0x22')](function(_0x33e7d7){_0x13194e[_0x9106('0x1b')]=_0x33e7d7;if(_0x25a48e[_0x9106('0x30')][_0x9106('0x40')]){_0x38715e[_0x9106('0x41')]=[{'all':!![]}];}return db[_0x9106('0x2a')]['findAll'](_0x38715e);})['then'](function(_0x4445ed){_0x13194e['rows']=_0x4445ed;return _0x13194e;})['then'](respondWithFilteredResult(_0x58c166,_0x38715e))[_0x9106('0x42')](handleError(_0x58c166,null));};exports['show']=function(_0x1f3cab,_0x22cd37){var _0x5b832d={'raw':!![],'where':{'id':_0x1f3cab[_0x9106('0x43')]['id']}},_0x33384c={};_0x33384c['model']=_[_0x9106('0x44')](db[_0x9106('0x2a')][_0x9106('0x2b')]);_0x33384c[_0x9106('0x30')]=_[_0x9106('0x44')](_0x1f3cab[_0x9106('0x30')]);_0x33384c['filters']=_[_0x9106('0x32')](_0x33384c[_0x9106('0x2f')],_0x33384c[_0x9106('0x30')]);_0x5b832d[_0x9106('0x33')]=_[_0x9106('0x32')](_0x33384c['model'],qs['fields'](_0x1f3cab[_0x9106('0x30')][_0x9106('0x34')]));_0x5b832d['attributes']=_0x5b832d[_0x9106('0x33')][_0x9106('0x35')]?_0x5b832d[_0x9106('0x33')]:_0x33384c[_0x9106('0x2f')];if(_0x1f3cab[_0x9106('0x30')][_0x9106('0x40')]){_0x5b832d[_0x9106('0x41')]=[{'all':!![]}];}_0x5b832d=_[_0x9106('0x3d')]({},_0x5b832d,_0x1f3cab[_0x9106('0x3f')]);return db[_0x9106('0x2a')]['find'](_0x5b832d)['then'](handleEntityNotFound(_0x22cd37,null))['then'](respondWithResult(_0x22cd37,null))[_0x9106('0x42')](handleError(_0x22cd37,null));};exports[_0x9106('0x45')]=function(_0x2096b8,_0x44c233){return db[_0x9106('0x2a')][_0x9106('0x45')](_0x2096b8[_0x9106('0x46')],{})['then'](respondWithResult(_0x44c233,0xc9))[_0x9106('0x42')](handleError(_0x44c233,null));};exports[_0x9106('0x21')]=function(_0x4dd0c2,_0x4c05df){if(_0x4dd0c2[_0x9106('0x46')]['id']){delete _0x4dd0c2['body']['id'];}return db[_0x9106('0x2a')][_0x9106('0x47')]({'where':{'id':_0x4dd0c2[_0x9106('0x43')]['id']}})[_0x9106('0x22')](handleEntityNotFound(_0x4c05df,null))[_0x9106('0x22')](saveUpdates(_0x4dd0c2['body'],null))[_0x9106('0x22')](respondWithResult(_0x4c05df,null))['catch'](handleError(_0x4c05df,null));};exports[_0x9106('0x23')]=function(_0x838522,_0x28c5c7){return db[_0x9106('0x2a')]['find']({'where':{'id':_0x838522[_0x9106('0x43')]['id']}})[_0x9106('0x22')](handleEntityNotFound(_0x28c5c7,null))[_0x9106('0x22')](removeEntity(_0x28c5c7,null))[_0x9106('0x42')](handleError(_0x28c5c7,null));};exports[_0x9106('0x48')]=function(_0x3d667e,_0x1bd518){return db[_0x9106('0x2a')][_0x9106('0x48')]()['then'](respondWithResult(_0x1bd518,null))[_0x9106('0x42')](handleError(_0x1bd518,null));}; \ No newline at end of file +var _0xe6de=['merge','VIRTUAL','includeAll','include','findAll','params','find','catch','create','body','describe','html-pdf','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','count','offset','limit','set','reject','save','update','then','destroy','error','stack','name','index','map','SquareDetailsReport','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xe6de,0xe0));var _0xee6d=function(_0x3c0ccd,_0x1e1335){_0x3c0ccd=_0x3c0ccd-0x0;var _0x23231c=_0xe6de[_0x3c0ccd];return _0x23231c;};'use strict';var pdf=require(_0xee6d('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xee6d('0x1'));var zipdir=require(_0xee6d('0x2'));var jsonpatch=require(_0xee6d('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xee6d('0x4'));var Mustache=require(_0xee6d('0x5'));var util=require(_0xee6d('0x6'));var path=require(_0xee6d('0x7'));var sox=require(_0xee6d('0x8'));var csv=require(_0xee6d('0x9'));var ejs=require(_0xee6d('0xa'));var fs=require('fs');var _=require(_0xee6d('0xb'));var squel=require(_0xee6d('0xc'));var crypto=require(_0xee6d('0xd'));var jsforce=require(_0xee6d('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xee6d('0x9'));var querystring=require(_0xee6d('0xf'));var Papa=require(_0xee6d('0x10'));var Redis=require(_0xee6d('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xee6d('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xee6d('0x13'));var logger=require(_0xee6d('0x14'))(_0xee6d('0x15'));var utils=require(_0xee6d('0x16'));var config=require('../../config/environment');var db=require(_0xee6d('0x17'))['db'];function respondWithStatusCode(_0x19a244,_0x7548de){_0x7548de=_0x7548de||0xcc;return function(_0x2ac3ef){if(_0x2ac3ef){return _0x19a244[_0xee6d('0x18')](_0x7548de);}return _0x19a244[_0xee6d('0x19')](_0x7548de)[_0xee6d('0x1a')]();};}function respondWithResult(_0x4e2394,_0x4589a3){_0x4589a3=_0x4589a3||0xc8;return function(_0x325238){if(_0x325238){return _0x4e2394[_0xee6d('0x19')](_0x4589a3)['json'](_0x325238);}};}function respondWithFilteredResult(_0x3100ef,_0xd20d7d){return function(_0xfd69f3){if(_0xfd69f3){var _0x49404c=_0xfd69f3[_0xee6d('0x1b')],_0x50fc59=_0xd20d7d['offset'],_0x5549c8=_0xd20d7d[_0xee6d('0x1c')]+_0xd20d7d[_0xee6d('0x1d')],_0x26b023;if(_0x5549c8>=_0x49404c){_0x5549c8=_0x49404c;_0x26b023=0xc8;}else{_0x26b023=0xce;}_0x3100ef['status'](_0x26b023);return _0x3100ef[_0xee6d('0x1e')]('Content-Range',_0x50fc59+'-'+_0x5549c8+'/'+_0x49404c)['json'](_0xfd69f3);}return null;};}function patchUpdates(_0x5e175b){return function(_0x3cbdf3){try{jsonpatch['apply'](_0x3cbdf3,_0x5e175b,!![]);}catch(_0x2e0680){return BPromise[_0xee6d('0x1f')](_0x2e0680);}return _0x3cbdf3[_0xee6d('0x20')]();};}function saveUpdates(_0x4d97ee,_0x39f255){return function(_0xd8b82e){if(_0xd8b82e){return _0xd8b82e[_0xee6d('0x21')](_0x4d97ee)[_0xee6d('0x22')](function(_0x2698ce){return _0x2698ce;});}return null;};}function removeEntity(_0xeae360,_0x35c4e0){return function(_0x4c837a){if(_0x4c837a){return _0x4c837a[_0xee6d('0x23')]()[_0xee6d('0x22')](function(){_0xeae360[_0xee6d('0x19')](0xcc)[_0xee6d('0x1a')]();});}};}function handleEntityNotFound(_0x36b46c,_0x1ef6ad){return function(_0x2477a4){if(!_0x2477a4){_0x36b46c[_0xee6d('0x18')](0x194);}return _0x2477a4;};}function handleError(_0x22a70e,_0x29290a){_0x29290a=_0x29290a||0x1f4;return function(_0x51f7a9){logger[_0xee6d('0x24')](_0x51f7a9[_0xee6d('0x25')]);if(_0x51f7a9[_0xee6d('0x26')]){delete _0x51f7a9[_0xee6d('0x26')];}_0x22a70e['status'](_0x29290a)['send'](_0x51f7a9);};}exports[_0xee6d('0x27')]=function(_0x3c8a7c,_0x312d19){var _0x34bf07={},_0x2ca4cc={},_0x2b6fb1={'count':0x0,'rows':[]};var _0x362cfe=_[_0xee6d('0x28')](db[_0xee6d('0x29')][_0xee6d('0x2a')],function(_0x2f07d6){return{'name':_0x2f07d6[_0xee6d('0x2b')],'type':_0x2f07d6['type'][_0xee6d('0x2c')]};});_0x2ca4cc[_0xee6d('0x2d')]=_[_0xee6d('0x28')](_0x362cfe,'name');_0x2ca4cc['query']=_[_0xee6d('0x2e')](_0x3c8a7c[_0xee6d('0x2f')]);_0x2ca4cc[_0xee6d('0x30')]=_[_0xee6d('0x31')](_0x2ca4cc[_0xee6d('0x2d')],_0x2ca4cc['query']);_0x34bf07[_0xee6d('0x32')]=_[_0xee6d('0x31')](_0x2ca4cc['model'],qs[_0xee6d('0x33')](_0x3c8a7c[_0xee6d('0x2f')]['fields']));_0x34bf07[_0xee6d('0x32')]=_0x34bf07[_0xee6d('0x32')][_0xee6d('0x34')]?_0x34bf07[_0xee6d('0x32')]:_0x2ca4cc[_0xee6d('0x2d')];if(!_0x3c8a7c[_0xee6d('0x2f')][_0xee6d('0x35')](_0xee6d('0x36'))){_0x34bf07[_0xee6d('0x1d')]=qs[_0xee6d('0x1d')](_0x3c8a7c['query']['limit']);_0x34bf07['offset']=qs[_0xee6d('0x1c')](_0x3c8a7c[_0xee6d('0x2f')][_0xee6d('0x1c')]);}_0x34bf07[_0xee6d('0x37')]=qs[_0xee6d('0x38')](_0x3c8a7c[_0xee6d('0x2f')][_0xee6d('0x38')]);_0x34bf07[_0xee6d('0x39')]=qs[_0xee6d('0x30')](_[_0xee6d('0x3a')](_0x3c8a7c[_0xee6d('0x2f')],_0x2ca4cc[_0xee6d('0x30')]),_0x362cfe);if(_0x3c8a7c[_0xee6d('0x2f')][_0xee6d('0x3b')]){_0x34bf07['where']=_[_0xee6d('0x3c')](_0x34bf07[_0xee6d('0x39')],{'$or':_[_0xee6d('0x28')](_0x362cfe,function(_0x138202){if(_0x138202['type']!==_0xee6d('0x3d')){var _0x5f35d0={};_0x5f35d0[_0x138202['name']]={'$like':'%'+_0x3c8a7c[_0xee6d('0x2f')][_0xee6d('0x3b')]+'%'};return _0x5f35d0;}})});}_0x34bf07=_['merge']({},_0x34bf07,_0x3c8a7c['options']);var _0x40d366={'where':_0x34bf07[_0xee6d('0x39')]};return db[_0xee6d('0x29')][_0xee6d('0x1b')](_0x40d366)[_0xee6d('0x22')](function(_0x59282b){_0x2b6fb1[_0xee6d('0x1b')]=_0x59282b;if(_0x3c8a7c[_0xee6d('0x2f')][_0xee6d('0x3e')]){_0x34bf07[_0xee6d('0x3f')]=[{'all':!![]}];}return db[_0xee6d('0x29')][_0xee6d('0x40')](_0x34bf07);})[_0xee6d('0x22')](function(_0x117429){_0x2b6fb1['rows']=_0x117429;return _0x2b6fb1;})[_0xee6d('0x22')](respondWithFilteredResult(_0x312d19,_0x34bf07))['catch'](handleError(_0x312d19,null));};exports['show']=function(_0x406071,_0x74b9f0){var _0x47529b={'raw':!![],'where':{'id':_0x406071[_0xee6d('0x41')]['id']}},_0x182a37={};_0x182a37[_0xee6d('0x2d')]=_[_0xee6d('0x2e')](db[_0xee6d('0x29')][_0xee6d('0x2a')]);_0x182a37[_0xee6d('0x2f')]=_['keys'](_0x406071[_0xee6d('0x2f')]);_0x182a37['filters']=_[_0xee6d('0x31')](_0x182a37[_0xee6d('0x2d')],_0x182a37['query']);_0x47529b[_0xee6d('0x32')]=_[_0xee6d('0x31')](_0x182a37['model'],qs[_0xee6d('0x33')](_0x406071[_0xee6d('0x2f')][_0xee6d('0x33')]));_0x47529b['attributes']=_0x47529b['attributes'][_0xee6d('0x34')]?_0x47529b[_0xee6d('0x32')]:_0x182a37['model'];if(_0x406071['query'][_0xee6d('0x3e')]){_0x47529b[_0xee6d('0x3f')]=[{'all':!![]}];}_0x47529b=_[_0xee6d('0x3c')]({},_0x47529b,_0x406071['options']);return db[_0xee6d('0x29')][_0xee6d('0x42')](_0x47529b)['then'](handleEntityNotFound(_0x74b9f0,null))[_0xee6d('0x22')](respondWithResult(_0x74b9f0,null))[_0xee6d('0x43')](handleError(_0x74b9f0,null));};exports[_0xee6d('0x44')]=function(_0x37b51b,_0x85d45e){return db['SquareDetailsReport']['create'](_0x37b51b[_0xee6d('0x45')],{})[_0xee6d('0x22')](respondWithResult(_0x85d45e,0xc9))[_0xee6d('0x43')](handleError(_0x85d45e,null));};exports['update']=function(_0x43235c,_0x339861){if(_0x43235c[_0xee6d('0x45')]['id']){delete _0x43235c['body']['id'];}return db[_0xee6d('0x29')][_0xee6d('0x42')]({'where':{'id':_0x43235c[_0xee6d('0x41')]['id']}})['then'](handleEntityNotFound(_0x339861,null))[_0xee6d('0x22')](saveUpdates(_0x43235c[_0xee6d('0x45')],null))['then'](respondWithResult(_0x339861,null))['catch'](handleError(_0x339861,null));};exports[_0xee6d('0x23')]=function(_0x18b37e,_0xf76fb9){return db[_0xee6d('0x29')][_0xee6d('0x42')]({'where':{'id':_0x18b37e[_0xee6d('0x41')]['id']}})[_0xee6d('0x22')](handleEntityNotFound(_0xf76fb9,null))[_0xee6d('0x22')](removeEntity(_0xf76fb9,null))['catch'](handleError(_0xf76fb9,null));};exports[_0xee6d('0x46')]=function(_0x326ec8,_0x125a4a){return db[_0xee6d('0x29')][_0xee6d('0x46')]()['then'](respondWithResult(_0x125a4a,null))['catch'](handleError(_0x125a4a,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 35cb8d7..0434636 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 _0xf5a6=['request-promise','path','../../config/environment','./squareReportDetail.attributes','exports','SquareDetailsReport','lodash','util','api','moment','bluebird'];(function(_0x4e1af4,_0x5b8cc6){var _0x42b609=function(_0x3cb930){while(--_0x3cb930){_0x4e1af4['push'](_0x4e1af4['shift']());}};_0x42b609(++_0x5b8cc6);}(_0xf5a6,0x7f));var _0x6f5a=function(_0x2eb4dd,_0x4eef7c){_0x2eb4dd=_0x2eb4dd-0x0;var _0x10e506=_0xf5a6[_0x2eb4dd];return _0x10e506;};'use strict';var _=require(_0x6f5a('0x0'));var util=require(_0x6f5a('0x1'));var logger=require('../../config/logger')(_0x6f5a('0x2'));var moment=require(_0x6f5a('0x3'));var BPromise=require(_0x6f5a('0x4'));var rp=require(_0x6f5a('0x5'));var fs=require('fs');var path=require(_0x6f5a('0x6'));var rimraf=require('rimraf');var config=require(_0x6f5a('0x7'));var attributes=require(_0x6f5a('0x8'));module[_0x6f5a('0x9')]=function(_0x556907,_0x5dab54){return _0x556907['define'](_0x6f5a('0xa'),attributes,{'tableName':'report_square_details','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0c45=['bluebird','../../config/environment','./squareReportDetail.attributes','exports','define','report_square_details','lodash','api','moment'];(function(_0x279368,_0x41c002){var _0x40b6d0=function(_0x493776){while(--_0x493776){_0x279368['push'](_0x279368['shift']());}};_0x40b6d0(++_0x41c002);}(_0x0c45,0x1ec));var _0x50c4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0c45[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x50c4('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x50c4('0x1'));var moment=require(_0x50c4('0x2'));var BPromise=require(_0x50c4('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x50c4('0x4'));var attributes=require(_0x50c4('0x5'));module[_0x50c4('0x6')]=function(_0x96eed,_0x1ca4d3){return _0x96eed[_0x50c4('0x7')]('SquareDetailsReport',attributes,{'tableName':_0x50c4('0x8'),'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 7717905..6549e28 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 _0xaaa5=['http','request','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateSquareDetailsReport','create','body','options','raw','then','debug','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0x21549c,_0x6d64d1){var _0x426cbd=function(_0x323f5b){while(--_0x323f5b){_0x21549c['push'](_0x21549c['shift']());}};_0x426cbd(++_0x6d64d1);}(_0xaaa5,0x155));var _0x5aaa=function(_0x2b8d34,_0x3f824a){_0x2b8d34=_0x2b8d34-0x0;var _0x344cd9=_0xaaa5[_0x2b8d34];return _0x344cd9;};'use strict';var _=require(_0x5aaa('0x0'));var util=require(_0x5aaa('0x1'));var moment=require('moment');var BPromise=require(_0x5aaa('0x2'));var rs=require(_0x5aaa('0x3'));var fs=require('fs');var Redis=require(_0x5aaa('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x5aaa('0x5'));var logger=require('../../config/logger')(_0x5aaa('0x6'));var config=require(_0x5aaa('0x7'));var jayson=require(_0x5aaa('0x8'));var client=jayson[_0x5aaa('0x9')][_0x5aaa('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4dd032,_0x168711,_0x92f774){return new BPromise(function(_0x1e75db,_0x1bf8ad){return client[_0x5aaa('0xb')](_0x4dd032,_0x92f774)['then'](function(_0x287420){logger[_0x5aaa('0xc')](_0x5aaa('0xd'),_0x168711,_0x5aaa('0xe'));logger['debug']('SquareDetailsReport,\x20%s,\x20%s,\x20%s',_0x168711,_0x5aaa('0xe'),JSON[_0x5aaa('0xf')](_0x287420));if(_0x287420[_0x5aaa('0x10')]){if(_0x287420['error']['code']===0x1f4){logger[_0x5aaa('0x10')]('SquareDetailsReport,\x20%s,\x20%s',_0x168711,_0x287420[_0x5aaa('0x10')]['message']);return _0x1bf8ad(_0x287420['error'][_0x5aaa('0x11')]);}logger[_0x5aaa('0x10')](_0x5aaa('0xd'),_0x168711,_0x287420[_0x5aaa('0x10')][_0x5aaa('0x11')]);return _0x1e75db(_0x287420[_0x5aaa('0x10')][_0x5aaa('0x11')]);}else{logger['info'](_0x5aaa('0xd'),_0x168711,_0x5aaa('0xe'));_0x1e75db(_0x287420[_0x5aaa('0x12')][_0x5aaa('0x11')]);}})['catch'](function(_0x50647d){logger['error']('SquareDetailsReport,\x20%s,\x20%s',_0x168711,_0x50647d);_0x1bf8ad(_0x50647d);});});}exports[_0x5aaa('0x13')]=function(_0x2506d3){var _0x58e99c=this;return new Promise(function(_0x18da25,_0x4838f7){return db['SquareDetailsReport'][_0x5aaa('0x14')](_0x2506d3[_0x5aaa('0x15')],{'raw':_0x2506d3[_0x5aaa('0x16')]?_0x2506d3[_0x5aaa('0x16')][_0x5aaa('0x17')]===undefined?!![]:![]:!![]})[_0x5aaa('0x18')](function(_0x1bb129){logger[_0x5aaa('0xc')](_0x5aaa('0x13'),_0x2506d3);logger[_0x5aaa('0x19')]('CreateSquareDetailsReport',_0x2506d3,JSON[_0x5aaa('0xf')](_0x1bb129));_0x18da25(_0x1bb129);})[_0x5aaa('0x1a')](function(_0xe9766a){logger['error'](_0x5aaa('0x13'),_0xe9766a['message'],_0x2506d3);_0x4838f7(_0x58e99c[_0x5aaa('0x10')](0x1f4,_0xe9766a[_0x5aaa('0x11')]));});});}; \ No newline at end of file +var _0xb057=['request\x20sent','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateSquareDetailsReport','SquareDetailsReport','create','options','raw','debug','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','request','then','info','SquareDetailsReport,\x20%s,\x20%s'];(function(_0x3e2725,_0x3b8aa9){var _0x97c252=function(_0x585c08){while(--_0x585c08){_0x3e2725['push'](_0x3e2725['shift']());}};_0x97c252(++_0x3b8aa9);}(_0xb057,0xee));var _0x7b05=function(_0x4891a7,_0x54d406){_0x4891a7=_0x4891a7-0x0;var _0x38c9b3=_0xb057[_0x4891a7];return _0x38c9b3;};'use strict';var _=require(_0x7b05('0x0'));var util=require(_0x7b05('0x1'));var moment=require(_0x7b05('0x2'));var BPromise=require(_0x7b05('0x3'));var rs=require(_0x7b05('0x4'));var fs=require('fs');var Redis=require(_0x7b05('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x7b05('0x6'));var logger=require(_0x7b05('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x7b05('0x8'));var client=jayson[_0x7b05('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3cece1,_0x2ee192,_0x5cb45f){return new BPromise(function(_0xaa363f,_0x24f78d){return client[_0x7b05('0xa')](_0x3cece1,_0x5cb45f)[_0x7b05('0xb')](function(_0x19d8c8){logger[_0x7b05('0xc')](_0x7b05('0xd'),_0x2ee192,_0x7b05('0xe'));logger['debug'](_0x7b05('0xf'),_0x2ee192,'request\x20sent',JSON[_0x7b05('0x10')](_0x19d8c8));if(_0x19d8c8[_0x7b05('0x11')]){if(_0x19d8c8[_0x7b05('0x11')][_0x7b05('0x12')]===0x1f4){logger[_0x7b05('0x11')](_0x7b05('0xd'),_0x2ee192,_0x19d8c8[_0x7b05('0x11')][_0x7b05('0x13')]);return _0x24f78d(_0x19d8c8['error'][_0x7b05('0x13')]);}logger['error'](_0x7b05('0xd'),_0x2ee192,_0x19d8c8[_0x7b05('0x11')][_0x7b05('0x13')]);return _0xaa363f(_0x19d8c8[_0x7b05('0x11')][_0x7b05('0x13')]);}else{logger[_0x7b05('0xc')](_0x7b05('0xd'),_0x2ee192,_0x7b05('0xe'));_0xaa363f(_0x19d8c8[_0x7b05('0x14')][_0x7b05('0x13')]);}})['catch'](function(_0x1ec16b){logger[_0x7b05('0x11')](_0x7b05('0xd'),_0x2ee192,_0x1ec16b);_0x24f78d(_0x1ec16b);});});}exports[_0x7b05('0x15')]=function(_0x4c2232){var _0x14ed48=this;return new Promise(function(_0x4447de,_0x10af59){return db[_0x7b05('0x16')][_0x7b05('0x17')](_0x4c2232['body'],{'raw':_0x4c2232['options']?_0x4c2232[_0x7b05('0x18')][_0x7b05('0x19')]===undefined?!![]:![]:!![]})[_0x7b05('0xb')](function(_0xf6eef){logger[_0x7b05('0xc')]('CreateSquareDetailsReport',_0x4c2232);logger[_0x7b05('0x1a')](_0x7b05('0x15'),_0x4c2232,JSON[_0x7b05('0x10')](_0xf6eef));_0x4447de(_0xf6eef);})[_0x7b05('0x1b')](function(_0x4d3f6a){logger[_0x7b05('0x11')]('CreateSquareDetailsReport',_0x4d3f6a[_0x7b05('0x13')],_0x4c2232);_0x10af59(_0x14ed48[_0x7b05('0x11')](0x1f4,_0x4d3f6a[_0x7b05('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 85fe67e..c6b80e9 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 _0x697e=['isAuthenticated','index','/process/:pid/kill','exports','Router','../../components/auth/service','./system.controller','get'];(function(_0x4daf52,_0x1895ea){var _0x586fc9=function(_0x3c28a8){while(--_0x3c28a8){_0x4daf52['push'](_0x4daf52['shift']());}};_0x586fc9(++_0x1895ea);}(_0x697e,0xe4));var _0xe697=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x697e[_0x321bb2];return _0x9c12ed;};'use strict';var express=require('express');var router=express[_0xe697('0x0')]();var auth=require(_0xe697('0x1'));var controller=require(_0xe697('0x2'));router[_0xe697('0x3')]('/',auth[_0xe697('0x4')](),controller[_0xe697('0x5')]);router[_0xe697('0x3')](_0xe697('0x6'),auth[_0xe697('0x4')](),controller['killProcess']);module[_0xe697('0x7')]=router; \ No newline at end of file +var _0xa5fe=['get','isAuthenticated','killProcess','exports','express','Router','../../components/auth/service','./system.controller','index'];(function(_0x5b02fc,_0x4306f){var _0x2972e0=function(_0x5e6e2c){while(--_0x5e6e2c){_0x5b02fc['push'](_0x5b02fc['shift']());}};_0x2972e0(++_0x4306f);}(_0xa5fe,0x163));var _0xea5f=function(_0x3b231a,_0x53a00d){_0x3b231a=_0x3b231a-0x0;var _0x18d67a=_0xa5fe[_0x3b231a];return _0x18d67a;};'use strict';var express=require(_0xea5f('0x0'));var router=express[_0xea5f('0x1')]();var auth=require(_0xea5f('0x2'));var controller=require(_0xea5f('0x3'));router['get']('/',auth['isAuthenticated'](),controller[_0xea5f('0x4')]);router[_0xea5f('0x5')]('/process/:pid/kill',auth[_0xea5f('0x6')](),controller[_0xea5f('0x7')]);module[_0xea5f('0x8')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index b525785..13ac198 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 _0x1f52=['components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','pid','split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','params','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','catch','systeminformation','exec','../../config/logger','api','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','send','index','getAllData','then','json','killProcess'];(function(_0x5a405c,_0x3f580e){var _0x44c5dd=function(_0x2a3f20){while(--_0x2a3f20){_0x5a405c['push'](_0x5a405c['shift']());}};_0x44c5dd(++_0x3f580e);}(_0x1f52,0x85));var _0x21f5=function(_0xdfb3c3,_0x59788d){_0xdfb3c3=_0xdfb3c3-0x0;var _0x4f9a74=_0x1f52[_0xdfb3c3];return _0x4f9a74;};'use strict';var info=require(_0x21f5('0x0'));var exec=require('child_process')[_0x21f5('0x1')];var logger=require(_0x21f5('0x2'))(_0x21f5('0x3'));var util=require('util');var BPromise=require(_0x21f5('0x4'));var _=require(_0x21f5('0x5'));function handleError(_0x4ceb02,_0x2dc16a,_0xfa2775){_0x2dc16a=_0x2dc16a||0x1f4;return function(_0x398e21){logger[_0x21f5('0x6')](_0x21f5('0x7'),_0xfa2775,_0x2dc16a,util[_0x21f5('0x8')](_0x398e21,{'showHidden':![],'depth':null}));delete _0x398e21[_0x21f5('0x9')];_0x4ceb02[_0x21f5('0xa')](_0x2dc16a)[_0x21f5('0xb')](_0x398e21);};}exports[_0x21f5('0xc')]=function(_0x416361,_0x55e5a0){return info[_0x21f5('0xd')]()[_0x21f5('0xe')](function(_0x3b5bab){return _0x55e5a0[_0x21f5('0xa')](0xc8)[_0x21f5('0xf')](_0x3b5bab);})['catch'](function(_0xea89a6){return _0x55e5a0[_0x21f5('0xa')](0x1f4)['json'](_0xea89a6);});};exports[_0x21f5('0x10')]=function(_0x1fdc04,_0x5f5cc6){var _0x2efded=[_0x21f5('0x11')];return new BPromise(function(_0xf1ea36,_0x4cac31){return exec(util[_0x21f5('0x12')](_0x21f5('0x13'),_0x1fdc04['params'][_0x21f5('0x14')]),function(_0x381850,_0x3319f2,_0x2da56e){if(_0x381850){return _0x4cac31(_0x381850);}return _0xf1ea36(_0x3319f2);});})['then'](function(_0xecb9bc){var _0x2d88c5=![];var _0x214cb0=_0xecb9bc[_0x21f5('0x15')](/\n/);for(var _0x1722c6=0x0,_0x2dcc56=_0x2efded[_0x21f5('0x16')];_0x1722c6<_0x2dcc56,_0x2d88c5===![];_0x1722c6+=0x1){if(_0xecb9bc[_0x21f5('0x17')](_0x2efded[_0x1722c6])>=0x0){_0x2d88c5=!![];}}if(!_0x2d88c5){throw new Error(util['format'](_0x21f5('0x18'),_0x1fdc04['params'][_0x21f5('0x14')]));}process[_0x21f5('0x19')](_0x1fdc04[_0x21f5('0x1a')][_0x21f5('0x14')],_0x21f5('0x1b'));return _0x5f5cc6['status'](0xc8)[_0x21f5('0xf')]({'message':util[_0x21f5('0x12')](_0x21f5('0x1c'),_0x1fdc04[_0x21f5('0x1a')][_0x21f5('0x14')])});})[_0x21f5('0x1d')](handleError(_0x5f5cc6,null,_0x21f5('0x10')));}; \ No newline at end of file +var _0x4b31=['params','pid','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','exec','../../config/logger','api','util','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','send','index','getAllData','then','status','json','catch','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','split','length','Process\x20with\x20pid\x20%s\x20not\x20found!'];(function(_0x177274,_0xaca351){var _0x230266=function(_0x40d0cf){while(--_0x40d0cf){_0x177274['push'](_0x177274['shift']());}};_0x230266(++_0xaca351);}(_0x4b31,0x1c4));var _0x14b3=function(_0x368113,_0x244119){_0x368113=_0x368113-0x0;var _0x475e26=_0x4b31[_0x368113];return _0x475e26;};'use strict';var info=require(_0x14b3('0x0'));var exec=require(_0x14b3('0x1'))[_0x14b3('0x2')];var logger=require(_0x14b3('0x3'))(_0x14b3('0x4'));var util=require(_0x14b3('0x5'));var BPromise=require('bluebird');var _=require(_0x14b3('0x6'));function handleError(_0x1df7a2,_0x3e7f9c,_0x40fd9d){_0x3e7f9c=_0x3e7f9c||0x1f4;return function(_0xb9ad05){logger[_0x14b3('0x7')](_0x14b3('0x8'),_0x40fd9d,_0x3e7f9c,util[_0x14b3('0x9')](_0xb9ad05,{'showHidden':![],'depth':null}));delete _0xb9ad05[_0x14b3('0xa')];_0x1df7a2['status'](_0x3e7f9c)[_0x14b3('0xb')](_0xb9ad05);};}exports[_0x14b3('0xc')]=function(_0x3501c4,_0x1db7f8){return info[_0x14b3('0xd')]()[_0x14b3('0xe')](function(_0x5ef8a9){return _0x1db7f8[_0x14b3('0xf')](0xc8)[_0x14b3('0x10')](_0x5ef8a9);})[_0x14b3('0x11')](function(_0x158837){return _0x1db7f8[_0x14b3('0xf')](0x1f4)['json'](_0x158837);});};exports['killProcess']=function(_0x2ae033,_0x4ea3c6){var _0x495255=[_0x14b3('0x12')];return new BPromise(function(_0x5c2925,_0x474524){return exec(util[_0x14b3('0x13')](_0x14b3('0x14'),_0x2ae033['params']['pid']),function(_0x1808e5,_0x12b9f8,_0x19a03f){if(_0x1808e5){return _0x474524(_0x1808e5);}return _0x5c2925(_0x12b9f8);});})[_0x14b3('0xe')](function(_0x21fff1){var _0x5de020=![];var _0x4be918=_0x21fff1[_0x14b3('0x15')](/\n/);for(var _0x3f7691=0x0,_0x413504=_0x495255[_0x14b3('0x16')];_0x3f7691<_0x413504,_0x5de020===![];_0x3f7691+=0x1){if(_0x21fff1['indexOf'](_0x495255[_0x3f7691])>=0x0){_0x5de020=!![];}}if(!_0x5de020){throw new Error(util['format'](_0x14b3('0x17'),_0x2ae033[_0x14b3('0x18')][_0x14b3('0x19')]));}process['kill'](_0x2ae033[_0x14b3('0x18')]['pid'],_0x14b3('0x1a'));return _0x4ea3c6[_0x14b3('0xf')](0xc8)['json']({'message':util['format'](_0x14b3('0x1b'),_0x2ae033['params'][_0x14b3('0x19')])});})[_0x14b3('0x11')](handleError(_0x4ea3c6,null,'killProcess'));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 81e3720..cd1adde 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 _0xb43b=['get','isAuthenticated','show','post','create','/:id','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./tag.controller'];(function(_0x1e399a,_0x179b5b){var _0x114766=function(_0x527fe6){while(--_0x527fe6){_0x1e399a['push'](_0x1e399a['shift']());}};_0x114766(++_0x179b5b);}(_0xb43b,0x1b2));var _0xbb43=function(_0x7d06a0,_0x443c24){_0x7d06a0=_0x7d06a0-0x0;var _0x2ee611=_0xb43b[_0x7d06a0];return _0x2ee611;};'use strict';var multer=require(_0xbb43('0x0'));var util=require(_0xbb43('0x1'));var path=require('path');var timeout=require(_0xbb43('0x2'));var express=require(_0xbb43('0x3'));var router=express[_0xbb43('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xbb43('0x5'));var config=require(_0xbb43('0x6'));var controller=require(_0xbb43('0x7'));router[_0xbb43('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xbb43('0x8')]('/:id',auth[_0xbb43('0x9')](),controller[_0xbb43('0xa')]);router[_0xbb43('0xb')]('/',auth[_0xbb43('0x9')](),controller[_0xbb43('0xc')]);router['put'](_0xbb43('0xd'),auth[_0xbb43('0x9')](),controller['update']);router[_0xbb43('0xe')](_0xbb43('0xd'),auth[_0xbb43('0x9')](),controller[_0xbb43('0xf')]);module[_0xbb43('0x10')]=router; \ No newline at end of file +var _0xb903=['util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','get','isAuthenticated','show','post','create','destroy','multer'];(function(_0x3f8b5c,_0x2b215d){var _0x2a1384=function(_0x43d9c8){while(--_0x43d9c8){_0x3f8b5c['push'](_0x3f8b5c['shift']());}};_0x2a1384(++_0x2b215d);}(_0xb903,0x185));var _0x3b90=function(_0x40b6be,_0x4dcc68){_0x40b6be=_0x40b6be-0x0;var _0x176aaa=_0xb903[_0x40b6be];return _0x176aaa;};'use strict';var multer=require(_0x3b90('0x0'));var util=require(_0x3b90('0x1'));var path=require(_0x3b90('0x2'));var timeout=require(_0x3b90('0x3'));var express=require('express');var router=express[_0x3b90('0x4')]();var auth=require(_0x3b90('0x5'));var interaction=require(_0x3b90('0x6'));var config=require(_0x3b90('0x7'));var controller=require(_0x3b90('0x8'));router[_0x3b90('0x9')]('/',auth[_0x3b90('0xa')](),controller['index']);router[_0x3b90('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x3b90('0xb')]);router[_0x3b90('0xc')]('/',auth[_0x3b90('0xa')](),controller[_0x3b90('0xd')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x3b90('0xa')](),controller[_0x3b90('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 6986dd7..98d0eac 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 _0xbdb7=['name','#0091EA','sequelize','exports','STRING'];(function(_0x16ae34,_0x1dc6d){var _0x184836=function(_0x1e48b7){while(--_0x1e48b7){_0x16ae34['push'](_0x16ae34['shift']());}};_0x184836(++_0x1dc6d);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x39e4a1,_0x4edcc5){_0x39e4a1=_0x39e4a1-0x0;var _0x55b30e=_0xbdb7[_0x39e4a1];return _0x55b30e;};'use strict';var Sequelize=require(_0x7bdb('0x0'));module[_0x7bdb('0x1')]={'name':{'type':Sequelize[_0x7bdb('0x2')],'unique':_0x7bdb('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x7bdb('0x2')],'defaultValue':_0x7bdb('0x4')},'description':{'type':Sequelize[_0x7bdb('0x2')]}}; \ No newline at end of file +var _0x878f=['STRING','name','#0091EA','exports'];(function(_0x7e23b7,_0x31f771){var _0x6b9bad=function(_0x405d8f){while(--_0x405d8f){_0x7e23b7['push'](_0x7e23b7['shift']());}};_0x6b9bad(++_0x31f771);}(_0x878f,0x173));var _0xf878=function(_0xaa958f,_0x468db4){_0xaa958f=_0xaa958f-0x0;var _0x51d718=_0x878f[_0xaa958f];return _0x51d718;};'use strict';var Sequelize=require('sequelize');module[_0xf878('0x0')]={'name':{'type':Sequelize[_0xf878('0x1')],'unique':_0xf878('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xf878('0x1')],'defaultValue':_0xf878('0x3')},'description':{'type':Sequelize[_0xf878('0x1')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 0217fb5..e1ffb22 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 _0xbff8=['error','stack','name','send','map','Tag','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','params','rawAttributes','find','catch','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','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','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','save','update','then','destroy','get','Tags','UserProfileResource'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0xbff8,0xd2));var _0x8bff=function(_0x4741f2,_0x2f3009){_0x4741f2=_0x4741f2-0x0;var _0x198250=_0xbff8[_0x4741f2];return _0x198250;};'use strict';var pdf=require(_0x8bff('0x0'));var emlformat=require(_0x8bff('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x8bff('0x2'));var jsonpatch=require(_0x8bff('0x3'));var rp=require(_0x8bff('0x4'));var moment=require(_0x8bff('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x8bff('0x6'));var util=require('util');var path=require(_0x8bff('0x7'));var sox=require(_0x8bff('0x8'));var csv=require(_0x8bff('0x9'));var ejs=require(_0x8bff('0xa'));var fs=require('fs');var _=require(_0x8bff('0xb'));var squel=require('squel');var crypto=require(_0x8bff('0xc'));var jsforce=require(_0x8bff('0xd'));var deskjs=require(_0x8bff('0xe'));var toCsv=require(_0x8bff('0x9'));var querystring=require(_0x8bff('0xf'));var Papa=require(_0x8bff('0x10'));var Redis=require(_0x8bff('0x11'));var authService=require(_0x8bff('0x12'));var qs=require(_0x8bff('0x13'));var as=require(_0x8bff('0x14'));var hardwareService=require(_0x8bff('0x15'));var logger=require(_0x8bff('0x16'))('api');var utils=require(_0x8bff('0x17'));var config=require(_0x8bff('0x18'));var db=require(_0x8bff('0x19'))['db'];function respondWithStatusCode(_0x54795e,_0x4453bc){_0x4453bc=_0x4453bc||0xcc;return function(_0x5eff4a){if(_0x5eff4a){return _0x54795e[_0x8bff('0x1a')](_0x4453bc);}return _0x54795e[_0x8bff('0x1b')](_0x4453bc)[_0x8bff('0x1c')]();};}function respondWithResult(_0x5232e5,_0x6e7e39){_0x6e7e39=_0x6e7e39||0xc8;return function(_0xa3b520){if(_0xa3b520){return _0x5232e5[_0x8bff('0x1b')](_0x6e7e39)[_0x8bff('0x1d')](_0xa3b520);}};}function respondWithFilteredResult(_0x8d4147,_0x37fc62){return function(_0x3bbad8){if(_0x3bbad8){var _0x279146=_0x3bbad8['count'],_0x5e447e=_0x37fc62['offset'],_0x35066f=_0x37fc62[_0x8bff('0x1e')]+_0x37fc62[_0x8bff('0x1f')],_0x515964;if(_0x35066f>=_0x279146){_0x35066f=_0x279146;_0x515964=0xc8;}else{_0x515964=0xce;}_0x8d4147['status'](_0x515964);return _0x8d4147[_0x8bff('0x20')](_0x8bff('0x21'),_0x5e447e+'-'+_0x35066f+'/'+_0x279146)[_0x8bff('0x1d')](_0x3bbad8);}return null;};}function patchUpdates(_0x1fe596){return function(_0x2a40f9){try{jsonpatch[_0x8bff('0x22')](_0x2a40f9,_0x1fe596,!![]);}catch(_0x476142){return BPromise['reject'](_0x476142);}return _0x2a40f9[_0x8bff('0x23')]();};}function saveUpdates(_0x5cbc17,_0x1ab607){return function(_0x4985f5){if(_0x4985f5){return _0x4985f5[_0x8bff('0x24')](_0x5cbc17)[_0x8bff('0x25')](function(_0x3c793c){return _0x3c793c;});}return null;};}function removeEntity(_0x384eb8,_0x342acb){return function(_0x5bfacb){if(_0x5bfacb){return _0x5bfacb[_0x8bff('0x26')]()[_0x8bff('0x25')](function(){var _0x317cbf=_0x5bfacb[_0x8bff('0x27')]({'plain':!![]});var _0x3eae82=_0x8bff('0x28');return db[_0x8bff('0x29')]['destroy']({'where':{'type':_0x3eae82,'resourceId':_0x317cbf['id']}})[_0x8bff('0x25')](function(){return _0x5bfacb;});})[_0x8bff('0x25')](function(){_0x384eb8[_0x8bff('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x64cec0,_0x1dc807){return function(_0x2296da){if(!_0x2296da){_0x64cec0[_0x8bff('0x1a')](0x194);}return _0x2296da;};}function handleError(_0x2b57bc,_0x781b37){_0x781b37=_0x781b37||0x1f4;return function(_0x483f21){logger[_0x8bff('0x2a')](_0x483f21[_0x8bff('0x2b')]);if(_0x483f21['name']){delete _0x483f21[_0x8bff('0x2c')];}_0x2b57bc[_0x8bff('0x1b')](_0x781b37)[_0x8bff('0x2d')](_0x483f21);};}exports['index']=function(_0x57c9ca,_0x7d95fd){var _0x247ebc={},_0x27eae8={},_0x33617c={'count':0x0,'rows':[]};var _0x435736=_[_0x8bff('0x2e')](db[_0x8bff('0x2f')]['rawAttributes'],function(_0x4830fb){return{'name':_0x4830fb[_0x8bff('0x30')],'type':_0x4830fb[_0x8bff('0x31')]['key']};});_0x27eae8[_0x8bff('0x32')]=_[_0x8bff('0x2e')](_0x435736,_0x8bff('0x2c'));_0x27eae8[_0x8bff('0x33')]=_[_0x8bff('0x34')](_0x57c9ca[_0x8bff('0x33')]);_0x27eae8[_0x8bff('0x35')]=_[_0x8bff('0x36')](_0x27eae8[_0x8bff('0x32')],_0x27eae8['query']);_0x247ebc['attributes']=_['intersection'](_0x27eae8[_0x8bff('0x32')],qs[_0x8bff('0x37')](_0x57c9ca[_0x8bff('0x33')][_0x8bff('0x37')]));_0x247ebc[_0x8bff('0x38')]=_0x247ebc[_0x8bff('0x38')][_0x8bff('0x39')]?_0x247ebc[_0x8bff('0x38')]:_0x27eae8[_0x8bff('0x32')];if(!_0x57c9ca['query'][_0x8bff('0x3a')](_0x8bff('0x3b'))){_0x247ebc[_0x8bff('0x1f')]=qs[_0x8bff('0x1f')](_0x57c9ca[_0x8bff('0x33')]['limit']);_0x247ebc[_0x8bff('0x1e')]=qs[_0x8bff('0x1e')](_0x57c9ca['query'][_0x8bff('0x1e')]);}_0x247ebc[_0x8bff('0x3c')]=qs['sort'](_0x57c9ca['query']['sort']);_0x247ebc[_0x8bff('0x3d')]=qs[_0x8bff('0x35')](_[_0x8bff('0x3e')](_0x57c9ca[_0x8bff('0x33')],_0x27eae8['filters']),_0x435736);if(_0x57c9ca[_0x8bff('0x33')][_0x8bff('0x3f')]){_0x247ebc[_0x8bff('0x3d')]=_[_0x8bff('0x40')](_0x247ebc[_0x8bff('0x3d')],{'$or':_[_0x8bff('0x2e')](_0x435736,function(_0x2cbe77){if(_0x2cbe77[_0x8bff('0x31')]!==_0x8bff('0x41')){var _0x300a88={};_0x300a88[_0x2cbe77[_0x8bff('0x2c')]]={'$like':'%'+_0x57c9ca[_0x8bff('0x33')][_0x8bff('0x3f')]+'%'};return _0x300a88;}})});}_0x247ebc=_[_0x8bff('0x40')]({},_0x247ebc,_0x57c9ca[_0x8bff('0x42')]);var _0x53c29a={'where':_0x247ebc['where']};return db[_0x8bff('0x2f')][_0x8bff('0x43')](_0x53c29a)[_0x8bff('0x25')](function(_0x1d07be){_0x33617c[_0x8bff('0x43')]=_0x1d07be;if(_0x57c9ca[_0x8bff('0x33')][_0x8bff('0x44')]){_0x247ebc[_0x8bff('0x45')]=[{'all':!![]}];}return db[_0x8bff('0x2f')][_0x8bff('0x46')](_0x247ebc);})[_0x8bff('0x25')](function(_0x2559fa){_0x33617c[_0x8bff('0x47')]=_0x2559fa;return _0x33617c;})[_0x8bff('0x25')](respondWithFilteredResult(_0x7d95fd,_0x247ebc))['catch'](handleError(_0x7d95fd,null));};exports['show']=function(_0x577fc5,_0x3c7967){var _0x89fef0={'raw':!![],'where':{'id':_0x577fc5[_0x8bff('0x48')]['id']}},_0x53607c={};_0x53607c[_0x8bff('0x32')]=_[_0x8bff('0x34')](db[_0x8bff('0x2f')][_0x8bff('0x49')]);_0x53607c[_0x8bff('0x33')]=_[_0x8bff('0x34')](_0x577fc5['query']);_0x53607c['filters']=_[_0x8bff('0x36')](_0x53607c['model'],_0x53607c[_0x8bff('0x33')]);_0x89fef0['attributes']=_[_0x8bff('0x36')](_0x53607c[_0x8bff('0x32')],qs[_0x8bff('0x37')](_0x577fc5[_0x8bff('0x33')][_0x8bff('0x37')]));_0x89fef0[_0x8bff('0x38')]=_0x89fef0[_0x8bff('0x38')][_0x8bff('0x39')]?_0x89fef0[_0x8bff('0x38')]:_0x53607c[_0x8bff('0x32')];if(_0x577fc5[_0x8bff('0x33')][_0x8bff('0x44')]){_0x89fef0['include']=[{'all':!![]}];}_0x89fef0=_['merge']({},_0x89fef0,_0x577fc5[_0x8bff('0x42')]);return db['Tag'][_0x8bff('0x4a')](_0x89fef0)['then'](handleEntityNotFound(_0x3c7967,null))[_0x8bff('0x25')](respondWithResult(_0x3c7967,null))[_0x8bff('0x4b')](handleError(_0x3c7967,null));};exports[_0x8bff('0x4c')]=function(_0x5cdb26,_0x268ff0){return db[_0x8bff('0x2f')][_0x8bff('0x4c')](_0x5cdb26['body'],{})['then'](function(_0x1938b3){var _0x554805=_0x5cdb26['user'][_0x8bff('0x27')]({'plain':!![]});if(!_0x554805)throw new Error(_0x8bff('0x4d'));if(_0x554805[_0x8bff('0x4e')]==='user'){var _0x4682d8=_0x1938b3['get']({'plain':!![]});var _0x28f49e='Tags';return db[_0x8bff('0x4f')][_0x8bff('0x4a')]({'where':{'name':_0x28f49e,'userProfileId':_0x554805[_0x8bff('0x50')]},'raw':!![]})[_0x8bff('0x25')](function(_0xda1907){if(_0xda1907&&_0xda1907[_0x8bff('0x51')]===0x0){return db['UserProfileResource'][_0x8bff('0x4c')]({'name':_0x4682d8[_0x8bff('0x2c')],'resourceId':_0x4682d8['id'],'type':_0xda1907[_0x8bff('0x2c')],'sectionId':_0xda1907['id']},{})[_0x8bff('0x25')](function(){return _0x1938b3;});}else{return _0x1938b3;}})[_0x8bff('0x4b')](function(_0x3cacc3){logger[_0x8bff('0x2a')](_0x8bff('0x52'),_0x3cacc3);throw _0x3cacc3;});}return _0x1938b3;})['then'](respondWithResult(_0x268ff0,0xc9))[_0x8bff('0x4b')](handleError(_0x268ff0,null));};exports[_0x8bff('0x24')]=function(_0x4b8f0d,_0x11213c){if(_0x4b8f0d[_0x8bff('0x53')]['id']){delete _0x4b8f0d[_0x8bff('0x53')]['id'];}return db['Tag']['find']({'where':{'id':_0x4b8f0d[_0x8bff('0x48')]['id']}})[_0x8bff('0x25')](handleEntityNotFound(_0x11213c,null))[_0x8bff('0x25')](saveUpdates(_0x4b8f0d['body'],null))['then'](respondWithResult(_0x11213c,null))[_0x8bff('0x4b')](handleError(_0x11213c,null));};exports[_0x8bff('0x26')]=function(_0x1f4940,_0x51b850){return db[_0x8bff('0x2f')][_0x8bff('0x4a')]({'where':{'id':_0x1f4940[_0x8bff('0x48')]['id']}})[_0x8bff('0x25')](handleEntityNotFound(_0x51b850,null))['then'](removeEntity(_0x51b850,null))['catch'](handleError(_0x51b850,null));}; \ No newline at end of file +var _0x47e3=['order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','params','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','to-csv','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','apply','reject','save','update','then','get','Tags','destroy','error','name','index','map','Tag','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','nolimit'];(function(_0x37a51a,_0x321b99){var _0x1b9a19=function(_0x35e975){while(--_0x35e975){_0x37a51a['push'](_0x37a51a['shift']());}};_0x1b9a19(++_0x321b99);}(_0x47e3,0x149));var _0x347e=function(_0x2b4914,_0x3154d4){_0x2b4914=_0x2b4914-0x0;var _0x3c0ab7=_0x47e3[_0x2b4914];return _0x3c0ab7;};'use strict';var pdf=require(_0x347e('0x0'));var emlformat=require(_0x347e('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x347e('0x2'));var jsonpatch=require(_0x347e('0x3'));var rp=require('request-promise');var moment=require(_0x347e('0x4'));var BPromise=require(_0x347e('0x5'));var Mustache=require(_0x347e('0x6'));var util=require(_0x347e('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x347e('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x347e('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x347e('0xa'));var toCsv=require(_0x347e('0x8'));var querystring=require(_0x347e('0xb'));var Papa=require(_0x347e('0xc'));var Redis=require(_0x347e('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x347e('0xe'));var as=require(_0x347e('0xf'));var hardwareService=require(_0x347e('0x10'));var logger=require(_0x347e('0x11'))(_0x347e('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x347e('0x13'))['db'];function respondWithStatusCode(_0x282295,_0x345bee){_0x345bee=_0x345bee||0xcc;return function(_0x11b949){if(_0x11b949){return _0x282295[_0x347e('0x14')](_0x345bee);}return _0x282295[_0x347e('0x15')](_0x345bee)[_0x347e('0x16')]();};}function respondWithResult(_0x17a513,_0xba2586){_0xba2586=_0xba2586||0xc8;return function(_0x1f54c9){if(_0x1f54c9){return _0x17a513[_0x347e('0x15')](_0xba2586)['json'](_0x1f54c9);}};}function respondWithFilteredResult(_0x15825b,_0x555b8f){return function(_0x3cca07){if(_0x3cca07){var _0x45f945=_0x3cca07[_0x347e('0x17')],_0x3f1cd0=_0x555b8f[_0x347e('0x18')],_0x474a2c=_0x555b8f[_0x347e('0x18')]+_0x555b8f[_0x347e('0x19')],_0x1b2e1a;if(_0x474a2c>=_0x45f945){_0x474a2c=_0x45f945;_0x1b2e1a=0xc8;}else{_0x1b2e1a=0xce;}_0x15825b[_0x347e('0x15')](_0x1b2e1a);return _0x15825b[_0x347e('0x1a')](_0x347e('0x1b'),_0x3f1cd0+'-'+_0x474a2c+'/'+_0x45f945)['json'](_0x3cca07);}return null;};}function patchUpdates(_0x1faea1){return function(_0x282e56){try{jsonpatch[_0x347e('0x1c')](_0x282e56,_0x1faea1,!![]);}catch(_0x368954){return BPromise[_0x347e('0x1d')](_0x368954);}return _0x282e56[_0x347e('0x1e')]();};}function saveUpdates(_0x51a707,_0x17e4a2){return function(_0x116287){if(_0x116287){return _0x116287[_0x347e('0x1f')](_0x51a707)[_0x347e('0x20')](function(_0x3e5906){return _0x3e5906;});}return null;};}function removeEntity(_0x598970,_0x3e3080){return function(_0x4775b2){if(_0x4775b2){return _0x4775b2['destroy']()[_0x347e('0x20')](function(){var _0x532d2d=_0x4775b2[_0x347e('0x21')]({'plain':!![]});var _0x500e6a=_0x347e('0x22');return db['UserProfileResource'][_0x347e('0x23')]({'where':{'type':_0x500e6a,'resourceId':_0x532d2d['id']}})['then'](function(){return _0x4775b2;});})[_0x347e('0x20')](function(){_0x598970['status'](0xcc)[_0x347e('0x16')]();});}};}function handleEntityNotFound(_0x5644bb,_0x30c8a6){return function(_0x2a78fc){if(!_0x2a78fc){_0x5644bb[_0x347e('0x14')](0x194);}return _0x2a78fc;};}function handleError(_0x205d78,_0x5cb40c){_0x5cb40c=_0x5cb40c||0x1f4;return function(_0x47567c){logger[_0x347e('0x24')](_0x47567c['stack']);if(_0x47567c[_0x347e('0x25')]){delete _0x47567c[_0x347e('0x25')];}_0x205d78[_0x347e('0x15')](_0x5cb40c)['send'](_0x47567c);};}exports[_0x347e('0x26')]=function(_0x15bb63,_0x2f574f){var _0x2b2287={},_0x42c3dc={},_0x52581a={'count':0x0,'rows':[]};var _0x2d22c8=_[_0x347e('0x27')](db[_0x347e('0x28')][_0x347e('0x29')],function(_0x45e61){return{'name':_0x45e61['fieldName'],'type':_0x45e61[_0x347e('0x2a')]['key']};});_0x42c3dc[_0x347e('0x2b')]=_[_0x347e('0x27')](_0x2d22c8,'name');_0x42c3dc[_0x347e('0x2c')]=_[_0x347e('0x2d')](_0x15bb63[_0x347e('0x2c')]);_0x42c3dc[_0x347e('0x2e')]=_[_0x347e('0x2f')](_0x42c3dc[_0x347e('0x2b')],_0x42c3dc[_0x347e('0x2c')]);_0x2b2287[_0x347e('0x30')]=_[_0x347e('0x2f')](_0x42c3dc[_0x347e('0x2b')],qs[_0x347e('0x31')](_0x15bb63[_0x347e('0x2c')][_0x347e('0x31')]));_0x2b2287[_0x347e('0x30')]=_0x2b2287[_0x347e('0x30')]['length']?_0x2b2287[_0x347e('0x30')]:_0x42c3dc[_0x347e('0x2b')];if(!_0x15bb63[_0x347e('0x2c')]['hasOwnProperty'](_0x347e('0x32'))){_0x2b2287[_0x347e('0x19')]=qs['limit'](_0x15bb63[_0x347e('0x2c')][_0x347e('0x19')]);_0x2b2287[_0x347e('0x18')]=qs[_0x347e('0x18')](_0x15bb63[_0x347e('0x2c')][_0x347e('0x18')]);}_0x2b2287[_0x347e('0x33')]=qs[_0x347e('0x34')](_0x15bb63[_0x347e('0x2c')][_0x347e('0x34')]);_0x2b2287[_0x347e('0x35')]=qs[_0x347e('0x2e')](_[_0x347e('0x36')](_0x15bb63['query'],_0x42c3dc['filters']),_0x2d22c8);if(_0x15bb63[_0x347e('0x2c')][_0x347e('0x37')]){_0x2b2287['where']=_[_0x347e('0x38')](_0x2b2287[_0x347e('0x35')],{'$or':_[_0x347e('0x27')](_0x2d22c8,function(_0x5d5adf){if(_0x5d5adf[_0x347e('0x2a')]!==_0x347e('0x39')){var _0x2f4085={};_0x2f4085[_0x5d5adf['name']]={'$like':'%'+_0x15bb63[_0x347e('0x2c')][_0x347e('0x37')]+'%'};return _0x2f4085;}})});}_0x2b2287=_[_0x347e('0x38')]({},_0x2b2287,_0x15bb63['options']);var _0x118a39={'where':_0x2b2287[_0x347e('0x35')]};return db[_0x347e('0x28')][_0x347e('0x17')](_0x118a39)['then'](function(_0xab64eb){_0x52581a['count']=_0xab64eb;if(_0x15bb63[_0x347e('0x2c')][_0x347e('0x3a')]){_0x2b2287[_0x347e('0x3b')]=[{'all':!![]}];}return db[_0x347e('0x28')][_0x347e('0x3c')](_0x2b2287);})[_0x347e('0x20')](function(_0x995552){_0x52581a[_0x347e('0x3d')]=_0x995552;return _0x52581a;})['then'](respondWithFilteredResult(_0x2f574f,_0x2b2287))[_0x347e('0x3e')](handleError(_0x2f574f,null));};exports['show']=function(_0x28ad48,_0x467f81){var _0x4e7617={'raw':!![],'where':{'id':_0x28ad48[_0x347e('0x3f')]['id']}},_0x554fe0={};_0x554fe0[_0x347e('0x2b')]=_['keys'](db[_0x347e('0x28')][_0x347e('0x29')]);_0x554fe0[_0x347e('0x2c')]=_[_0x347e('0x2d')](_0x28ad48[_0x347e('0x2c')]);_0x554fe0['filters']=_[_0x347e('0x2f')](_0x554fe0[_0x347e('0x2b')],_0x554fe0[_0x347e('0x2c')]);_0x4e7617[_0x347e('0x30')]=_[_0x347e('0x2f')](_0x554fe0[_0x347e('0x2b')],qs[_0x347e('0x31')](_0x28ad48[_0x347e('0x2c')][_0x347e('0x31')]));_0x4e7617[_0x347e('0x30')]=_0x4e7617[_0x347e('0x30')]['length']?_0x4e7617['attributes']:_0x554fe0[_0x347e('0x2b')];if(_0x28ad48[_0x347e('0x2c')][_0x347e('0x3a')]){_0x4e7617[_0x347e('0x3b')]=[{'all':!![]}];}_0x4e7617=_['merge']({},_0x4e7617,_0x28ad48[_0x347e('0x40')]);return db[_0x347e('0x28')]['find'](_0x4e7617)[_0x347e('0x20')](handleEntityNotFound(_0x467f81,null))[_0x347e('0x20')](respondWithResult(_0x467f81,null))[_0x347e('0x3e')](handleError(_0x467f81,null));};exports[_0x347e('0x41')]=function(_0x12f6c7,_0x270d9f){return db['Tag']['create'](_0x12f6c7[_0x347e('0x42')],{})[_0x347e('0x20')](function(_0x408e9f){var _0x57a1fb=_0x12f6c7[_0x347e('0x43')][_0x347e('0x21')]({'plain':!![]});if(!_0x57a1fb)throw new Error(_0x347e('0x44'));if(_0x57a1fb[_0x347e('0x45')]===_0x347e('0x43')){var _0x551b76=_0x408e9f[_0x347e('0x21')]({'plain':!![]});var _0x1cc717='Tags';return db[_0x347e('0x46')]['find']({'where':{'name':_0x1cc717,'userProfileId':_0x57a1fb[_0x347e('0x47')]},'raw':!![]})[_0x347e('0x20')](function(_0x628f9c){if(_0x628f9c&&_0x628f9c[_0x347e('0x48')]===0x0){return db[_0x347e('0x49')][_0x347e('0x41')]({'name':_0x551b76[_0x347e('0x25')],'resourceId':_0x551b76['id'],'type':_0x628f9c[_0x347e('0x25')],'sectionId':_0x628f9c['id']},{})[_0x347e('0x20')](function(){return _0x408e9f;});}else{return _0x408e9f;}})[_0x347e('0x3e')](function(_0x4ffa76){logger[_0x347e('0x24')](_0x347e('0x4a'),_0x4ffa76);throw _0x4ffa76;});}return _0x408e9f;})[_0x347e('0x20')](respondWithResult(_0x270d9f,0xc9))['catch'](handleError(_0x270d9f,null));};exports[_0x347e('0x1f')]=function(_0x2feaab,_0x439560){if(_0x2feaab[_0x347e('0x42')]['id']){delete _0x2feaab[_0x347e('0x42')]['id'];}return db[_0x347e('0x28')][_0x347e('0x4b')]({'where':{'id':_0x2feaab[_0x347e('0x3f')]['id']}})['then'](handleEntityNotFound(_0x439560,null))['then'](saveUpdates(_0x2feaab[_0x347e('0x42')],null))[_0x347e('0x20')](respondWithResult(_0x439560,null))[_0x347e('0x3e')](handleError(_0x439560,null));};exports[_0x347e('0x23')]=function(_0x179439,_0x19c0da){return db['Tag'][_0x347e('0x4b')]({'where':{'id':_0x179439[_0x347e('0x3f')]['id']}})[_0x347e('0x20')](handleEntityNotFound(_0x19c0da,null))[_0x347e('0x20')](removeEntity(_0x19c0da,null))[_0x347e('0x3e')](handleError(_0x19c0da,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 27769ec..76d2a88 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 _0x7268=['Tag','tools_tags','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','define'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7268,0x146));var _0x8726=function(_0x13b0c6,_0xd4256d){_0x13b0c6=_0x13b0c6-0x0;var _0x9991e=_0x7268[_0x13b0c6];return _0x9991e;};'use strict';var _=require(_0x8726('0x0'));var util=require('util');var logger=require(_0x8726('0x1'))(_0x8726('0x2'));var moment=require(_0x8726('0x3'));var BPromise=require(_0x8726('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8726('0x5'));var rimraf=require(_0x8726('0x6'));var config=require(_0x8726('0x7'));var attributes=require('./tag.attributes');module[_0x8726('0x8')]=function(_0x4afc14,_0x3df09a){return _0x4afc14[_0x8726('0x9')](_0x8726('0xa'),attributes,{'tableName':_0x8726('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x88c7=['api','moment','path','rimraf','./tag.attributes','exports','define','lodash'];(function(_0x208505,_0x241a77){var _0x1a985f=function(_0x4a5110){while(--_0x4a5110){_0x208505['push'](_0x208505['shift']());}};_0x1a985f(++_0x241a77);}(_0x88c7,0x6f));var _0x788c=function(_0x24bd84,_0x373306){_0x24bd84=_0x24bd84-0x0;var _0x4f7c80=_0x88c7[_0x24bd84];return _0x4f7c80;};'use strict';var _=require(_0x788c('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x788c('0x1'));var moment=require(_0x788c('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x788c('0x3'));var rimraf=require(_0x788c('0x4'));var config=require('../../config/environment');var attributes=require(_0x788c('0x5'));module[_0x788c('0x6')]=function(_0x4e6f8b,_0xbde9d1){return _0x4e6f8b[_0x788c('0x7')]('Tag',attributes,{'tableName':'tools_tags','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/tag/tag.rpc.js b/server/api/tag/tag.rpc.js index 3bb5afa..0ec1f3e 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 _0x579c=['message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Tag,\x20%s,\x20%s','debug','Tag,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0xd38a4c,_0x10205d){var _0x38c708=function(_0x2bf027){while(--_0x2bf027){_0xd38a4c['push'](_0xd38a4c['shift']());}};_0x38c708(++_0x10205d);}(_0x579c,0xda));var _0xc579=function(_0x469eb9,_0x6c3137){_0x469eb9=_0x469eb9-0x0;var _0x435681=_0x579c[_0x469eb9];return _0x435681;};'use strict';var _=require(_0xc579('0x0'));var util=require(_0xc579('0x1'));var moment=require(_0xc579('0x2'));var BPromise=require(_0xc579('0x3'));var rs=require(_0xc579('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc579('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc579('0x6'))(_0xc579('0x7'));var config=require(_0xc579('0x8'));var jayson=require(_0xc579('0x9'));var client=jayson[_0xc579('0xa')][_0xc579('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2e451b,_0x585167,_0x1c6d9c){return new BPromise(function(_0x293c4a,_0x2ce949){return client[_0xc579('0xc')](_0x2e451b,_0x1c6d9c)[_0xc579('0xd')](function(_0x44b151){logger[_0xc579('0xe')](_0xc579('0xf'),_0x585167,'request\x20sent');logger[_0xc579('0x10')](_0xc579('0x11'),_0x585167,_0xc579('0x12'),JSON[_0xc579('0x13')](_0x44b151));if(_0x44b151[_0xc579('0x14')]){if(_0x44b151[_0xc579('0x14')][_0xc579('0x15')]===0x1f4){logger[_0xc579('0x14')](_0xc579('0xf'),_0x585167,_0x44b151[_0xc579('0x14')][_0xc579('0x16')]);return _0x2ce949(_0x44b151['error'][_0xc579('0x16')]);}logger['error'](_0xc579('0xf'),_0x585167,_0x44b151['error'][_0xc579('0x16')]);return _0x293c4a(_0x44b151['error'][_0xc579('0x16')]);}else{logger['info'](_0xc579('0xf'),_0x585167,_0xc579('0x12'));_0x293c4a(_0x44b151['result']['message']);}})[_0xc579('0x17')](function(_0x2abc55){logger[_0xc579('0x14')](_0xc579('0xf'),_0x585167,_0x2abc55);_0x2ce949(_0x2abc55);});});} \ No newline at end of file +var _0x9bde=['code','message','Tag,\x20%s,\x20%s','result','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','debug','Tag,\x20%s,\x20%s,\x20%s','request\x20sent','error'];(function(_0x27d214,_0x34adbd){var _0x203780=function(_0x1856bd){while(--_0x1856bd){_0x27d214['push'](_0x27d214['shift']());}};_0x203780(++_0x34adbd);}(_0x9bde,0xe1));var _0xe9bd=function(_0x2a8329,_0x31c505){_0x2a8329=_0x2a8329-0x0;var _0x55378=_0x9bde[_0x2a8329];return _0x55378;};'use strict';var _=require('lodash');var util=require(_0xe9bd('0x0'));var moment=require('moment');var BPromise=require(_0xe9bd('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe9bd('0x2'));var db=require(_0xe9bd('0x3'))['db'];var utils=require(_0xe9bd('0x4'));var logger=require(_0xe9bd('0x5'))(_0xe9bd('0x6'));var config=require(_0xe9bd('0x7'));var jayson=require(_0xe9bd('0x8'));var client=jayson['client'][_0xe9bd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5f18fe,_0x22a438,_0xa66ae2){return new BPromise(function(_0x2d5c75,_0x3ef9e3){return client[_0xe9bd('0xa')](_0x5f18fe,_0xa66ae2)[_0xe9bd('0xb')](function(_0x439abc){logger[_0xe9bd('0xc')]('Tag,\x20%s,\x20%s',_0x22a438,'request\x20sent');logger[_0xe9bd('0xd')](_0xe9bd('0xe'),_0x22a438,_0xe9bd('0xf'),JSON['stringify'](_0x439abc));if(_0x439abc[_0xe9bd('0x10')]){if(_0x439abc[_0xe9bd('0x10')][_0xe9bd('0x11')]===0x1f4){logger[_0xe9bd('0x10')]('Tag,\x20%s,\x20%s',_0x22a438,_0x439abc[_0xe9bd('0x10')]['message']);return _0x3ef9e3(_0x439abc[_0xe9bd('0x10')][_0xe9bd('0x12')]);}logger[_0xe9bd('0x10')]('Tag,\x20%s,\x20%s',_0x22a438,_0x439abc['error'][_0xe9bd('0x12')]);return _0x2d5c75(_0x439abc[_0xe9bd('0x10')][_0xe9bd('0x12')]);}else{logger[_0xe9bd('0xc')](_0xe9bd('0x13'),_0x22a438,_0xe9bd('0xf'));_0x2d5c75(_0x439abc[_0xe9bd('0x14')]['message']);}})[_0xe9bd('0x15')](function(_0x464a1b){logger[_0xe9bd('0x10')]('Tag,\x20%s,\x20%s',_0x22a438,_0x464a1b);_0x3ef9e3(_0x464a1b);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 4f17dc6..8396b3e 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 _0x7128=['isAuthenticated','show','/:id/queues','getQueues','/:id/users','getAgents','create','post','addAgents','/:id','update','delete','destroy','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get'];(function(_0x261ae4,_0x5be223){var _0x4d1c52=function(_0x2dda5b){while(--_0x2dda5b){_0x261ae4['push'](_0x261ae4['shift']());}};_0x4d1c52(++_0x5be223);}(_0x7128,0xaf));var _0x8712=function(_0x2fee96,_0x2f735d){_0x2fee96=_0x2fee96-0x0;var _0x2e6ad1=_0x7128[_0x2fee96];return _0x2e6ad1;};'use strict';var multer=require(_0x8712('0x0'));var util=require('util');var path=require(_0x8712('0x1'));var timeout=require(_0x8712('0x2'));var express=require('express');var router=express[_0x8712('0x3')]();var auth=require(_0x8712('0x4'));var interaction=require(_0x8712('0x5'));var config=require(_0x8712('0x6'));var controller=require(_0x8712('0x7'));router[_0x8712('0x8')]('/',auth[_0x8712('0x9')](),controller['index']);router['get']('/:id',auth[_0x8712('0x9')](),controller[_0x8712('0xa')]);router['get'](_0x8712('0xb'),auth['isAuthenticated'](),controller[_0x8712('0xc')]);router['get'](_0x8712('0xd'),auth['isAuthenticated'](),controller[_0x8712('0xe')]);router['post']('/',auth[_0x8712('0x9')](),controller[_0x8712('0xf')]);router[_0x8712('0x10')](_0x8712('0xb'),auth[_0x8712('0x9')](),controller['addQueues']);router[_0x8712('0x10')](_0x8712('0xd'),auth[_0x8712('0x9')](),controller[_0x8712('0x11')]);router['put'](_0x8712('0x12'),auth[_0x8712('0x9')](),controller[_0x8712('0x13')]);router[_0x8712('0x14')](_0x8712('0x12'),auth['isAuthenticated'](),controller[_0x8712('0x15')]);router['delete'](_0x8712('0xb'),auth['isAuthenticated'](),controller['removeQueues']);router[_0x8712('0x14')](_0x8712('0xd'),auth['isAuthenticated'](),controller['removeAgents']);module[_0x8712('0x16')]=router; \ No newline at end of file +var _0xfa6c=['multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./team.controller','get','isAuthenticated','/:id','show','/:id/queues','getQueues','/:id/users','post','create','addQueues','addAgents','put','update','delete','destroy','exports'];(function(_0x169582,_0x5664b2){var _0x3613c6=function(_0x224998){while(--_0x224998){_0x169582['push'](_0x169582['shift']());}};_0x3613c6(++_0x5664b2);}(_0xfa6c,0x180));var _0xcfa6=function(_0x502938,_0x4d37b2){_0x502938=_0x502938-0x0;var _0x57c98b=_0xfa6c[_0x502938];return _0x57c98b;};'use strict';var multer=require(_0xcfa6('0x0'));var util=require(_0xcfa6('0x1'));var path=require(_0xcfa6('0x2'));var timeout=require(_0xcfa6('0x3'));var express=require(_0xcfa6('0x4'));var router=express['Router']();var auth=require(_0xcfa6('0x5'));var interaction=require(_0xcfa6('0x6'));var config=require('../../config/environment');var controller=require(_0xcfa6('0x7'));router[_0xcfa6('0x8')]('/',auth[_0xcfa6('0x9')](),controller['index']);router[_0xcfa6('0x8')](_0xcfa6('0xa'),auth[_0xcfa6('0x9')](),controller[_0xcfa6('0xb')]);router[_0xcfa6('0x8')](_0xcfa6('0xc'),auth[_0xcfa6('0x9')](),controller[_0xcfa6('0xd')]);router[_0xcfa6('0x8')](_0xcfa6('0xe'),auth[_0xcfa6('0x9')](),controller['getAgents']);router[_0xcfa6('0xf')]('/',auth[_0xcfa6('0x9')](),controller[_0xcfa6('0x10')]);router[_0xcfa6('0xf')](_0xcfa6('0xc'),auth[_0xcfa6('0x9')](),controller[_0xcfa6('0x11')]);router[_0xcfa6('0xf')](_0xcfa6('0xe'),auth[_0xcfa6('0x9')](),controller[_0xcfa6('0x12')]);router[_0xcfa6('0x13')]('/:id',auth[_0xcfa6('0x9')](),controller[_0xcfa6('0x14')]);router[_0xcfa6('0x15')](_0xcfa6('0xa'),auth[_0xcfa6('0x9')](),controller[_0xcfa6('0x16')]);router['delete']('/:id/queues',auth[_0xcfa6('0x9')](),controller['removeQueues']);router[_0xcfa6('0x15')](_0xcfa6('0xe'),auth[_0xcfa6('0x9')](),controller['removeAgents']);module[_0xcfa6('0x17')]=router; \ No newline at end of file diff --git a/server/api/team/team.attributes.js b/server/api/team/team.attributes.js index 65becc7..85ce825 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 _0x6c85=['STRING','name','exports'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0x6c85,0xec));var _0x56c8=function(_0x4a2c13,_0x2a9b69){_0x4a2c13=_0x4a2c13-0x0;var _0x4c6ea2=_0x6c85[_0x4a2c13];return _0x4c6ea2;};'use strict';var Sequelize=require('sequelize');module[_0x56c8('0x0')]={'name':{'type':Sequelize[_0x56c8('0x1')],'allowNull':![],'unique':_0x56c8('0x2')},'description':{'type':Sequelize[_0x56c8('0x1')]}}; \ No newline at end of file +var _0x5916=['exports','STRING','name','sequelize'];(function(_0x1fc548,_0x5be695){var _0x105151=function(_0x1d94b7){while(--_0x1d94b7){_0x1fc548['push'](_0x1fc548['shift']());}};_0x105151(++_0x5be695);}(_0x5916,0x163));var _0x6591=function(_0x448053,_0x14372d){_0x448053=_0x448053-0x0;var _0x34623b=_0x5916[_0x448053];return _0x34623b;};'use strict';var Sequelize=require(_0x6591('0x0'));module[_0x6591('0x1')]={'name':{'type':Sequelize[_0x6591('0x2')],'allowNull':![],'unique':_0x6591('0x3')},'description':{'type':Sequelize[_0x6591('0x2')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 24fad2d..8ce4292 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 _0xe71c=['error','stack','name','send','index','map','Team','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','length','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','getQueues','findOne','isValidChannel','channel','ValidationError','capitalize','Queue','rawAttributes','options','toLowerCase','addQueues','Unknown\x20channel','ids','Sequelize','remove','Queues','addAgents','Voice','Mail','Sms','Fax','Openchannel','Whatsapp','each','User','online','voicePause','interface','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','emit','userTeam:save','removeAgents','voice','chat','mail','sms','fax','openchannel','whatsapp','isArray','userTeam:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','redis','defaults','localhost','./team.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','get','Teams','UserProfileResource'];(function(_0x3d5395,_0x253bf0){var _0x2cdb6e=function(_0x1bf739){while(--_0x1bf739){_0x3d5395['push'](_0x3d5395['shift']());}};_0x2cdb6e(++_0x253bf0);}(_0xe71c,0x1e1));var _0xce71=function(_0x3cea78,_0x4a6751){_0x3cea78=_0x3cea78-0x0;var _0x33b66b=_0xe71c[_0x3cea78];return _0x33b66b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xce71('0x0'));var rimraf=require(_0xce71('0x1'));var zipdir=require(_0xce71('0x2'));var jsonpatch=require(_0xce71('0x3'));var rp=require(_0xce71('0x4'));var moment=require('moment');var BPromise=require(_0xce71('0x5'));var Mustache=require(_0xce71('0x6'));var util=require(_0xce71('0x7'));var path=require(_0xce71('0x8'));var sox=require(_0xce71('0x9'));var csv=require(_0xce71('0xa'));var ejs=require(_0xce71('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xce71('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xce71('0xa'));var querystring=require(_0xce71('0xd'));var Papa=require('papaparse');var Redis=require(_0xce71('0xe'));var authService=require(_0xce71('0xf'));var qs=require(_0xce71('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xce71('0x11'));var logger=require(_0xce71('0x12'))('api');var utils=require(_0xce71('0x13'));var config=require(_0xce71('0x14'));var db=require('../../mysqldb')['db'];config[_0xce71('0x15')]=_[_0xce71('0x16')](config[_0xce71('0x15')],{'host':_0xce71('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xce71('0x18'))[_0xce71('0x19')](socket);function respondWithStatusCode(_0x67dbd9,_0x6a191){_0x6a191=_0x6a191||0xcc;return function(_0x289789){if(_0x289789){return _0x67dbd9[_0xce71('0x1a')](_0x6a191);}return _0x67dbd9[_0xce71('0x1b')](_0x6a191)[_0xce71('0x1c')]();};}function respondWithResult(_0x5a2961,_0x41b512){_0x41b512=_0x41b512||0xc8;return function(_0xb3810e){if(_0xb3810e){return _0x5a2961[_0xce71('0x1b')](_0x41b512)[_0xce71('0x1d')](_0xb3810e);}};}function respondWithFilteredResult(_0x1e9c6d,_0x181f63){return function(_0x138e41){if(_0x138e41){var _0x576ca2=_0x138e41[_0xce71('0x1e')],_0x40e014=_0x181f63[_0xce71('0x1f')],_0x260922=_0x181f63['offset']+_0x181f63[_0xce71('0x20')],_0x50e88a;if(_0x260922>=_0x576ca2){_0x260922=_0x576ca2;_0x50e88a=0xc8;}else{_0x50e88a=0xce;}_0x1e9c6d['status'](_0x50e88a);return _0x1e9c6d[_0xce71('0x21')](_0xce71('0x22'),_0x40e014+'-'+_0x260922+'/'+_0x576ca2)[_0xce71('0x1d')](_0x138e41);}return null;};}function patchUpdates(_0x12cb7b){return function(_0x5cd97b){try{jsonpatch[_0xce71('0x23')](_0x5cd97b,_0x12cb7b,!![]);}catch(_0x363b80){return BPromise['reject'](_0x363b80);}return _0x5cd97b[_0xce71('0x24')]();};}function saveUpdates(_0x4e8bde,_0x565b4b){return function(_0x2a1bf0){if(_0x2a1bf0){return _0x2a1bf0[_0xce71('0x25')](_0x4e8bde)[_0xce71('0x26')](function(_0x3c8484){return _0x3c8484;});}return null;};}function removeEntity(_0x382ff6,_0x46757c){return function(_0x4b4156){if(_0x4b4156){return _0x4b4156[_0xce71('0x27')]()[_0xce71('0x26')](function(){var _0x401086=_0x4b4156[_0xce71('0x28')]({'plain':!![]});var _0x224d97=_0xce71('0x29');return db[_0xce71('0x2a')][_0xce71('0x27')]({'where':{'type':_0x224d97,'resourceId':_0x401086['id']}})[_0xce71('0x26')](function(){return _0x4b4156;});})['then'](function(){_0x382ff6[_0xce71('0x1b')](0xcc)[_0xce71('0x1c')]();});}};}function handleEntityNotFound(_0x2fd35f,_0x28175f){return function(_0x45255d){if(!_0x45255d){_0x2fd35f['sendStatus'](0x194);}return _0x45255d;};}function handleError(_0x30ce33,_0x2218a4){_0x2218a4=_0x2218a4||0x1f4;return function(_0x289514){logger[_0xce71('0x2b')](_0x289514[_0xce71('0x2c')]);if(_0x289514['name']){delete _0x289514[_0xce71('0x2d')];}_0x30ce33[_0xce71('0x1b')](_0x2218a4)[_0xce71('0x2e')](_0x289514);};}exports[_0xce71('0x2f')]=function(_0x459d17,_0x6aa7c6){var _0x3b9461={},_0x43cb4e={},_0x18afe9={'count':0x0,'rows':[]};var _0x3ff5e2=_[_0xce71('0x30')](db[_0xce71('0x31')]['rawAttributes'],function(_0x5b7c56){return{'name':_0x5b7c56['fieldName'],'type':_0x5b7c56[_0xce71('0x32')][_0xce71('0x33')]};});_0x43cb4e[_0xce71('0x34')]=_['map'](_0x3ff5e2,_0xce71('0x2d'));_0x43cb4e[_0xce71('0x35')]=_[_0xce71('0x36')](_0x459d17[_0xce71('0x35')]);_0x43cb4e[_0xce71('0x37')]=_[_0xce71('0x38')](_0x43cb4e[_0xce71('0x34')],_0x43cb4e['query']);_0x3b9461[_0xce71('0x39')]=_[_0xce71('0x38')](_0x43cb4e[_0xce71('0x34')],qs[_0xce71('0x3a')](_0x459d17['query'][_0xce71('0x3a')]));_0x3b9461[_0xce71('0x39')]=_0x3b9461[_0xce71('0x39')]['length']?_0x3b9461[_0xce71('0x39')]:_0x43cb4e[_0xce71('0x34')];if(!_0x459d17['query'][_0xce71('0x3b')](_0xce71('0x3c'))){_0x3b9461['limit']=qs[_0xce71('0x20')](_0x459d17[_0xce71('0x35')][_0xce71('0x20')]);_0x3b9461[_0xce71('0x1f')]=qs[_0xce71('0x1f')](_0x459d17['query'][_0xce71('0x1f')]);}_0x3b9461[_0xce71('0x3d')]=qs['sort'](_0x459d17[_0xce71('0x35')][_0xce71('0x3e')]);_0x3b9461[_0xce71('0x3f')]=qs['filters'](_[_0xce71('0x40')](_0x459d17[_0xce71('0x35')],_0x43cb4e['filters']),_0x3ff5e2);if(_0x459d17[_0xce71('0x35')][_0xce71('0x41')]){_0x3b9461['where']=_[_0xce71('0x42')](_0x3b9461['where'],{'$or':_[_0xce71('0x30')](_0x3ff5e2,function(_0x36ed42){if(_0x36ed42[_0xce71('0x32')]!==_0xce71('0x43')){var _0x10c585={};_0x10c585[_0x36ed42[_0xce71('0x2d')]]={'$like':'%'+_0x459d17['query'][_0xce71('0x41')]+'%'};return _0x10c585;}})});}_0x3b9461=_[_0xce71('0x42')]({},_0x3b9461,_0x459d17['options']);var _0x3e0746={'where':_0x3b9461[_0xce71('0x3f')]};return db[_0xce71('0x31')][_0xce71('0x1e')](_0x3e0746)[_0xce71('0x26')](function(_0x5e4b32){_0x18afe9[_0xce71('0x1e')]=_0x5e4b32;if(_0x459d17[_0xce71('0x35')][_0xce71('0x44')]){_0x3b9461[_0xce71('0x45')]=[{'all':!![]}];}return db[_0xce71('0x31')][_0xce71('0x46')](_0x3b9461);})[_0xce71('0x26')](function(_0x179f83){_0x18afe9[_0xce71('0x47')]=_0x179f83;return _0x18afe9;})[_0xce71('0x26')](respondWithFilteredResult(_0x6aa7c6,_0x3b9461))[_0xce71('0x48')](handleError(_0x6aa7c6,null));};exports[_0xce71('0x49')]=function(_0x31d5f9,_0xf228e){var _0x55ac90={'raw':![],'where':{'id':_0x31d5f9[_0xce71('0x4a')]['id']}},_0x3a0723={};_0x3a0723[_0xce71('0x34')]=_[_0xce71('0x36')](db[_0xce71('0x31')]['rawAttributes']);_0x3a0723[_0xce71('0x35')]=_[_0xce71('0x36')](_0x31d5f9[_0xce71('0x35')]);_0x3a0723[_0xce71('0x37')]=_[_0xce71('0x38')](_0x3a0723[_0xce71('0x34')],_0x3a0723[_0xce71('0x35')]);_0x55ac90[_0xce71('0x39')]=_[_0xce71('0x38')](_0x3a0723[_0xce71('0x34')],qs['fields'](_0x31d5f9[_0xce71('0x35')][_0xce71('0x3a')]));_0x55ac90['attributes']=_0x55ac90['attributes'][_0xce71('0x4b')]?_0x55ac90[_0xce71('0x39')]:_0x3a0723['model'];if(_0x31d5f9['query'][_0xce71('0x44')]){_0x55ac90['include']=[{'all':!![]}];}_0x55ac90=_[_0xce71('0x42')]({},_0x55ac90,_0x31d5f9['options']);return db[_0xce71('0x31')]['find'](_0x55ac90)[_0xce71('0x26')](handleEntityNotFound(_0xf228e,null))[_0xce71('0x26')](respondWithResult(_0xf228e,null))['catch'](handleError(_0xf228e,null));};exports[_0xce71('0x4c')]=function(_0xcce1d7,_0x227eea){return db['Team'][_0xce71('0x4c')](_0xcce1d7[_0xce71('0x4d')],{})[_0xce71('0x26')](function(_0x2c2717){var _0x3c6750=_0xcce1d7[_0xce71('0x4e')][_0xce71('0x28')]({'plain':!![]});if(!_0x3c6750)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3c6750[_0xce71('0x4f')]==='user'){var _0x472ff2=_0x2c2717[_0xce71('0x28')]({'plain':!![]});var _0x24da44=_0xce71('0x29');return db[_0xce71('0x50')]['find']({'where':{'name':_0x24da44,'userProfileId':_0x3c6750[_0xce71('0x51')]},'raw':!![]})[_0xce71('0x26')](function(_0x2a7876){if(_0x2a7876&&_0x2a7876[_0xce71('0x52')]===0x0){return db[_0xce71('0x2a')][_0xce71('0x4c')]({'name':_0x472ff2[_0xce71('0x2d')],'resourceId':_0x472ff2['id'],'type':_0x2a7876[_0xce71('0x2d')],'sectionId':_0x2a7876['id']},{})[_0xce71('0x26')](function(){return _0x2c2717;});}else{return _0x2c2717;}})[_0xce71('0x48')](function(_0x4deb71){logger[_0xce71('0x2b')](_0xce71('0x53'),_0x4deb71);throw _0x4deb71;});}return _0x2c2717;})[_0xce71('0x26')](respondWithResult(_0x227eea,0xc9))[_0xce71('0x48')](handleError(_0x227eea,null));};exports[_0xce71('0x25')]=function(_0x10e04c,_0x415e05){if(_0x10e04c[_0xce71('0x4d')]['id']){delete _0x10e04c[_0xce71('0x4d')]['id'];}return db[_0xce71('0x31')][_0xce71('0x54')]({'where':{'id':_0x10e04c[_0xce71('0x4a')]['id']}})['then'](handleEntityNotFound(_0x415e05,null))[_0xce71('0x26')](saveUpdates(_0x10e04c[_0xce71('0x4d')],null))[_0xce71('0x26')](respondWithResult(_0x415e05,null))['catch'](handleError(_0x415e05,null));};exports[_0xce71('0x27')]=function(_0x18b40e,_0xcc9e88){return db[_0xce71('0x31')]['find']({'where':{'id':_0x18b40e[_0xce71('0x4a')]['id']}})[_0xce71('0x26')](handleEntityNotFound(_0xcc9e88,null))[_0xce71('0x26')](removeEntity(_0xcc9e88,null))['catch'](handleError(_0xcc9e88,null));};exports[_0xce71('0x55')]=function(_0x557acf,_0x42b7bf,_0x36e877){return db['Team'][_0xce71('0x56')]({'where':{'id':_0x557acf[_0xce71('0x4a')]['id']}})['then'](handleEntityNotFound(_0x42b7bf,null))['then'](function(_0x8902ec){if(!_0x557acf[_0xce71('0x35')]['channel']||!utils[_0xce71('0x57')](_0x557acf['query'][_0xce71('0x58')])){throw new db['Sequelize'][(_0xce71('0x59'))]('Unknown\x20channel');}var _0x2b7077={};var _0x5708d2={};_0x5708d2[_0xce71('0x34')]=_[_0xce71('0x36')](db[_[_0xce71('0x5a')](_0x557acf[_0xce71('0x35')][_0xce71('0x58')]['toLowerCase']())+_0xce71('0x5b')][_0xce71('0x5c')]);_0x5708d2['query']=_[_0xce71('0x36')](_0x557acf[_0xce71('0x35')]);_0x5708d2[_0xce71('0x37')]=_[_0xce71('0x38')](_0x5708d2['model'],_0x5708d2[_0xce71('0x35')]);_0x2b7077[_0xce71('0x39')]=_[_0xce71('0x38')](_0x5708d2[_0xce71('0x34')],qs[_0xce71('0x3a')](_0x557acf[_0xce71('0x35')]['fields']));_0x2b7077[_0xce71('0x39')]=_0x2b7077['attributes'][_0xce71('0x4b')]?_0x2b7077[_0xce71('0x39')]:_0x5708d2[_0xce71('0x34')];_0x2b7077['limit']=qs[_0xce71('0x20')](_0x557acf[_0xce71('0x35')][_0xce71('0x20')]);_0x2b7077['offset']=qs[_0xce71('0x1f')](_0x557acf[_0xce71('0x35')][_0xce71('0x1f')]);_0x2b7077[_0xce71('0x3d')]=qs[_0xce71('0x3e')](_0x557acf[_0xce71('0x35')]['sort']);_0x2b7077['where']=qs['filters'](_[_0xce71('0x40')](_0x557acf[_0xce71('0x35')],_0x5708d2[_0xce71('0x37')]));_0x2b7077=_['merge']({},_0x2b7077,_0x557acf[_0xce71('0x5d')]);return _0x8902ec[_0xce71('0x28')+_['capitalize'](_0x557acf['query'][_0xce71('0x58')][_0xce71('0x5e')]())+'Queues'](_0x2b7077);})[_0xce71('0x26')](respondWithResult(_0x42b7bf,null))[_0xce71('0x48')](handleError(_0x42b7bf,null));};exports[_0xce71('0x5f')]=function(_0x2c56ce,_0x5f5bf9,_0xa0d118){return db[_0xce71('0x31')][_0xce71('0x56')]({'where':{'id':_0x2c56ce[_0xce71('0x4a')]['id']}})[_0xce71('0x26')](function(_0x43817b){if(_0x43817b){if(!_0x2c56ce[_0xce71('0x4d')]['channel']||!utils['isValidChannel'](_0x2c56ce[_0xce71('0x4d')][_0xce71('0x58')])){throw new db['Sequelize'][(_0xce71('0x59'))](_0xce71('0x60'));}return _0x43817b['add'+_['capitalize'](_0x2c56ce['body'][_0xce71('0x58')]['toLowerCase']())+'Queues'](_0x2c56ce[_0xce71('0x4d')][_0xce71('0x61')]);}return null;})['then'](handleEntityNotFound(_0x5f5bf9,null))[_0xce71('0x26')](respondWithStatusCode(_0x5f5bf9,null))['catch'](handleError(_0x5f5bf9,null));};exports['removeQueues']=function(_0x24df82,_0x429e21,_0x189ae1){return db[_0xce71('0x31')][_0xce71('0x56')]({'where':{'id':_0x24df82['params']['id']}})[_0xce71('0x26')](function(_0x5310e4){if(_0x5310e4){if(!_0x24df82[_0xce71('0x35')][_0xce71('0x58')]||!utils['isValidChannel'](_0x24df82[_0xce71('0x35')][_0xce71('0x58')])){throw new db[(_0xce71('0x62'))]['ValidationError'](_0xce71('0x60'));}return _0x5310e4[_0xce71('0x63')+_['capitalize'](_0x24df82[_0xce71('0x35')]['channel']['toLowerCase']())+_0xce71('0x64')](_0x24df82[_0xce71('0x35')][_0xce71('0x61')]);}return null;})[_0xce71('0x26')](handleEntityNotFound(_0x429e21,null))[_0xce71('0x26')](respondWithStatusCode(_0x429e21,null))[_0xce71('0x48')](handleError(_0x429e21,null));};exports[_0xce71('0x65')]=function(_0x1af1e3,_0xdc5639,_0x194b6d){return db[_0xce71('0x31')][_0xce71('0x54')]({'where':{'id':_0x1af1e3[_0xce71('0x4a')]['id']}})[_0xce71('0x26')](handleEntityNotFound(_0xdc5639,null))[_0xce71('0x26')](function(_0x566907){if(_0x566907){var _0x607b5c=[_0xce71('0x66'),'Chat',_0xce71('0x67'),_0xce71('0x68'),_0xce71('0x69'),_0xce71('0x6a'),_0xce71('0x6b')];return BPromise['each'](_0x607b5c,function(_0x49470e){return _0x566907['get'+_0x49470e+_0xce71('0x64')]({'attributes':['id',_0xce71('0x2d')]})[_0xce71('0x26')](function(_0x1e0f6b){return BPromise[_0xce71('0x6c')](_0x1e0f6b,function(_0x11a1a8){return _0x11a1a8['addAgents'](_0x1af1e3[_0xce71('0x4d')][_0xce71('0x61')])[_0xce71('0x26')](function(){if(_0x49470e===_0xce71('0x66')){return db[_0xce71('0x6d')][_0xce71('0x46')]({'where':{'id':_0x1af1e3['body'][_0xce71('0x61')]},'attributes':['id',_0xce71('0x2d'),_0xce71('0x6e'),_0xce71('0x6f'),_0xce71('0x70')],'raw':!![]})[_0xce71('0x26')](function(_0x26be13){return BPromise[_0xce71('0x6c')](_[_0xce71('0x41')](_0x26be13,{'online':0x1}),function(_0x4cee22){return db[_0xce71('0x71')][_0xce71('0x72')]({'membername':_0x4cee22[_0xce71('0x2d')],'UserId':_0x4cee22['id'],'queue_name':_0x11a1a8['name'],'VoiceQueueId':_0x11a1a8['id'],'interface':_[_0xce71('0x73')](_0x4cee22[_0xce71('0x70')])?util[_0xce71('0x74')](_0xce71('0x75'),_0x4cee22[_0xce71('0x2d')]):_0x4cee22[_0xce71('0x70')],'paused':_0x4cee22[_0xce71('0x6f')]||![],'penalty':0x0});});});}});});})[_0xce71('0x26')](function(){return _0x566907;});})['then'](function(){return _0x566907;});}})[_0xce71('0x26')](function(_0x55f384){if(_0x55f384){return _0x55f384['addAgents'](_0x1af1e3['body'][_0xce71('0x61')],_['omit'](_0x1af1e3[_0xce71('0x4d')],[_0xce71('0x61'),'id'])||{})['spread'](function(_0x2ea8ce){for(var _0x3f544c=0x0;_0x3f544c<_0x1af1e3[_0xce71('0x4d')][_0xce71('0x61')][_0xce71('0x4b')];_0x3f544c+=0x1){socket[_0xce71('0x76')](_0xce71('0x77'),{'UserId':_0x1af1e3['body'][_0xce71('0x61')][_0x3f544c],'TeamId':_0x1af1e3['params']['id']});}return _0x2ea8ce;});}})[_0xce71('0x26')](respondWithResult(_0xdc5639,null))[_0xce71('0x48')](handleError(_0xdc5639,null));};exports[_0xce71('0x78')]=function(_0x476c35,_0x58e3fa,_0x40e61b){return db['Team'][_0xce71('0x54')]({'where':{'id':_0x476c35[_0xce71('0x4a')]['id']}})[_0xce71('0x26')](handleEntityNotFound(_0x58e3fa,null))[_0xce71('0x26')](function(_0x349ef6){if(_0x349ef6){return BPromise['each']([_0xce71('0x79'),_0xce71('0x7a'),_0xce71('0x7b'),_0xce71('0x7c'),_0xce71('0x7d'),_0xce71('0x7e'),_0xce71('0x7f')],function(_0x46e8d1){return _0x349ef6[_0xce71('0x28')+_[_0xce71('0x5a')](_0x46e8d1)+_0xce71('0x64')]({'attributes':['id',_0xce71('0x2d')]})[_0xce71('0x26')](function(_0x54890a){return BPromise[_0xce71('0x6c')](_0x54890a,function(_0x2d3c1a){return _0x2d3c1a[_0xce71('0x78')](_0x476c35[_0xce71('0x35')][_0xce71('0x61')])[_0xce71('0x26')](function(){if(_0x46e8d1===_0xce71('0x79')){return db[_0xce71('0x71')]['destroy']({'where':{'VoiceQueueId':_0x2d3c1a['id'],'UserId':_0x476c35[_0xce71('0x35')][_0xce71('0x61')]}});}});});})[_0xce71('0x26')](function(){return _0x349ef6;});})[_0xce71('0x26')](function(){return _0x349ef6;});}})[_0xce71('0x26')](function(_0x48f5a4){if(_0x48f5a4){return _0x48f5a4[_0xce71('0x78')](_0x476c35[_0xce71('0x35')][_0xce71('0x61')])['then'](function(){if(_[_0xce71('0x80')](_0x476c35[_0xce71('0x35')]['ids'])){for(var _0x5f19b3=0x0;_0x5f19b3<_0x476c35[_0xce71('0x35')][_0xce71('0x61')][_0xce71('0x4b')];_0x5f19b3+=0x1){socket[_0xce71('0x76')](_0xce71('0x81'),{'UserId':Number(_0x476c35[_0xce71('0x35')][_0xce71('0x61')][_0x5f19b3]),'TeamId':Number(_0x476c35[_0xce71('0x4a')]['id'])});}}else{socket[_0xce71('0x76')]('userTeam:remove',{'UserId':Number(_0x476c35[_0xce71('0x35')][_0xce71('0x61')]),'TeamId':Number(_0x476c35[_0xce71('0x4a')]['id'])});}});}})[_0xce71('0x26')](respondWithStatusCode(_0x58e3fa,null))[_0xce71('0x48')](handleError(_0x58e3fa,null));};exports['getAgents']=function(_0x3fd828,_0x4aed1a,_0x1cc1c9){var _0x19e3b1={};var _0x1e248a={};var _0x1f2002;var _0x1dd8de;return db[_0xce71('0x31')][_0xce71('0x56')]({'where':{'id':_0x3fd828[_0xce71('0x4a')]['id']}})[_0xce71('0x26')](handleEntityNotFound(_0x4aed1a,null))[_0xce71('0x26')](function(_0x57069c){if(_0x57069c){_0x1f2002=_0x57069c;_0x1e248a[_0xce71('0x34')]=_['keys'](db[_0xce71('0x6d')][_0xce71('0x5c')]);_0x1e248a[_0xce71('0x35')]=_[_0xce71('0x36')](_0x3fd828['query']);_0x1e248a[_0xce71('0x37')]=_['intersection'](_0x1e248a[_0xce71('0x34')],_0x1e248a[_0xce71('0x35')]);_0x19e3b1[_0xce71('0x39')]=_['intersection'](_0x1e248a[_0xce71('0x34')],qs[_0xce71('0x3a')](_0x3fd828[_0xce71('0x35')]['fields']));_0x19e3b1['attributes']=_0x19e3b1['attributes'][_0xce71('0x4b')]?_0x19e3b1[_0xce71('0x39')]:_0x1e248a[_0xce71('0x34')];_0x19e3b1[_0xce71('0x3d')]=qs[_0xce71('0x3e')](_0x3fd828[_0xce71('0x35')][_0xce71('0x3e')]);_0x19e3b1[_0xce71('0x3f')]=qs[_0xce71('0x37')](_[_0xce71('0x40')](_0x3fd828[_0xce71('0x35')],_0x1e248a[_0xce71('0x37')]));if(_0x3fd828[_0xce71('0x35')][_0xce71('0x41')]){_0x19e3b1[_0xce71('0x3f')]=_[_0xce71('0x42')](_0x19e3b1[_0xce71('0x3f')],{'$or':_['map'](_0x19e3b1[_0xce71('0x39')],function(_0x43843e){var _0x736df0={};_0x736df0[_0x43843e]={'$like':'%'+_0x3fd828['query'][_0xce71('0x41')]+'%'};return _0x736df0;})});}_0x19e3b1=_[_0xce71('0x42')]({},_0x19e3b1,_0x3fd828[_0xce71('0x5d')]);return _0x1f2002[_0xce71('0x82')](_0x19e3b1);}})['then'](function(_0x59f0d5){if(_0x59f0d5){_0x1dd8de=_0x59f0d5[_0xce71('0x4b')];if(!_0x3fd828[_0xce71('0x35')][_0xce71('0x3b')](_0xce71('0x3c'))){_0x19e3b1[_0xce71('0x20')]=qs[_0xce71('0x20')](_0x3fd828['query'][_0xce71('0x20')]);_0x19e3b1[_0xce71('0x1f')]=qs[_0xce71('0x1f')](_0x3fd828[_0xce71('0x35')][_0xce71('0x1f')]);}return _0x1f2002[_0xce71('0x82')](_0x19e3b1);}})[_0xce71('0x26')](function(_0x4611c4){if(_0x4611c4){return _0x4611c4?{'count':_0x1dd8de,'rows':_0x4611c4}:null;}})['then'](respondWithResult(_0x4aed1a,null))[_0xce71('0x48')](handleError(_0x4aed1a,null));}; \ No newline at end of file +var _0xb2b6=['reject','update','then','destroy','stack','name','Team','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','order','sort','where','filter','merge','includeAll','findAll','catch','show','params','length','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Teams','UserProfileSection','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getQueues','findOne','channel','isValidChannel','Sequelize','ValidationError','Unknown\x20channel','capitalize','toLowerCase','pick','Queues','addQueues','ids','removeQueues','addAgents','Voice','Chat','Mail','Sms','Fax','Openchannel','Whatsapp','each','User','voicePause','UserVoiceQueueRt','upsert','interface','format','SIP/%s','spread','emit','userTeam:save','voice','chat','mail','sms','fax','whatsapp','removeAgents','userTeam:remove','getAgents','hasOwnProperty','nolimit','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','redis','./team.socket','register','sendStatus','status','end','json','count','offset','limit','apply'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0xb2b6,0x1bb));var _0x6b2b=function(_0x14d772,_0x4326b9){_0x14d772=_0x14d772-0x0;var _0x11c2fa=_0xb2b6[_0x14d772];return _0x11c2fa;};'use strict';var pdf=require(_0x6b2b('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x6b2b('0x1'));var zipdir=require(_0x6b2b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6b2b('0x3'));var moment=require(_0x6b2b('0x4'));var BPromise=require(_0x6b2b('0x5'));var Mustache=require(_0x6b2b('0x6'));var util=require(_0x6b2b('0x7'));var path=require(_0x6b2b('0x8'));var sox=require(_0x6b2b('0x9'));var csv=require('to-csv');var ejs=require(_0x6b2b('0xa'));var fs=require('fs');var _=require(_0x6b2b('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x6b2b('0xc'));var toCsv=require('to-csv');var querystring=require(_0x6b2b('0xd'));var Papa=require('papaparse');var Redis=require(_0x6b2b('0xe'));var authService=require(_0x6b2b('0xf'));var qs=require(_0x6b2b('0x10'));var as=require(_0x6b2b('0x11'));var hardwareService=require(_0x6b2b('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x6b2b('0x13'));var config=require(_0x6b2b('0x14'));var db=require(_0x6b2b('0x15'))['db'];config[_0x6b2b('0x16')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x6b2b('0x17'))[_0x6b2b('0x18')](socket);function respondWithStatusCode(_0x5d5ad3,_0x59cbee){_0x59cbee=_0x59cbee||0xcc;return function(_0x47447b){if(_0x47447b){return _0x5d5ad3[_0x6b2b('0x19')](_0x59cbee);}return _0x5d5ad3[_0x6b2b('0x1a')](_0x59cbee)[_0x6b2b('0x1b')]();};}function respondWithResult(_0x5b9818,_0x3b9043){_0x3b9043=_0x3b9043||0xc8;return function(_0x2887f7){if(_0x2887f7){return _0x5b9818[_0x6b2b('0x1a')](_0x3b9043)[_0x6b2b('0x1c')](_0x2887f7);}};}function respondWithFilteredResult(_0x198385,_0xbdccc4){return function(_0x2a2da9){if(_0x2a2da9){var _0x31a946=_0x2a2da9[_0x6b2b('0x1d')],_0x3b580e=_0xbdccc4[_0x6b2b('0x1e')],_0x113b80=_0xbdccc4[_0x6b2b('0x1e')]+_0xbdccc4[_0x6b2b('0x1f')],_0x4b19cf;if(_0x113b80>=_0x31a946){_0x113b80=_0x31a946;_0x4b19cf=0xc8;}else{_0x4b19cf=0xce;}_0x198385['status'](_0x4b19cf);return _0x198385['set']('Content-Range',_0x3b580e+'-'+_0x113b80+'/'+_0x31a946)[_0x6b2b('0x1c')](_0x2a2da9);}return null;};}function patchUpdates(_0x388456){return function(_0x44f706){try{jsonpatch[_0x6b2b('0x20')](_0x44f706,_0x388456,!![]);}catch(_0x13c1e5){return BPromise[_0x6b2b('0x21')](_0x13c1e5);}return _0x44f706['save']();};}function saveUpdates(_0xed9fa3,_0x12b016){return function(_0x3b8fcd){if(_0x3b8fcd){return _0x3b8fcd[_0x6b2b('0x22')](_0xed9fa3)[_0x6b2b('0x23')](function(_0x516cf4){return _0x516cf4;});}return null;};}function removeEntity(_0x314ac4,_0x28f7ba){return function(_0x492742){if(_0x492742){return _0x492742[_0x6b2b('0x24')]()[_0x6b2b('0x23')](function(){var _0x2c2415=_0x492742['get']({'plain':!![]});var _0x2cdbe4='Teams';return db['UserProfileResource']['destroy']({'where':{'type':_0x2cdbe4,'resourceId':_0x2c2415['id']}})['then'](function(){return _0x492742;});})[_0x6b2b('0x23')](function(){_0x314ac4[_0x6b2b('0x1a')](0xcc)[_0x6b2b('0x1b')]();});}};}function handleEntityNotFound(_0x3d9d33,_0x408ec2){return function(_0x50be50){if(!_0x50be50){_0x3d9d33[_0x6b2b('0x19')](0x194);}return _0x50be50;};}function handleError(_0x2cabf2,_0x1bbd4f){_0x1bbd4f=_0x1bbd4f||0x1f4;return function(_0x3470e8){logger['error'](_0x3470e8[_0x6b2b('0x25')]);if(_0x3470e8[_0x6b2b('0x26')]){delete _0x3470e8[_0x6b2b('0x26')];}_0x2cabf2[_0x6b2b('0x1a')](_0x1bbd4f)['send'](_0x3470e8);};}exports['index']=function(_0x590d23,_0x2938cd){var _0x4a2485={},_0x3ea74f={},_0x5cb879={'count':0x0,'rows':[]};var _0x53f29a=_['map'](db[_0x6b2b('0x27')][_0x6b2b('0x28')],function(_0xb91a6d){return{'name':_0xb91a6d[_0x6b2b('0x29')],'type':_0xb91a6d[_0x6b2b('0x2a')][_0x6b2b('0x2b')]};});_0x3ea74f[_0x6b2b('0x2c')]=_[_0x6b2b('0x2d')](_0x53f29a,_0x6b2b('0x26'));_0x3ea74f[_0x6b2b('0x2e')]=_[_0x6b2b('0x2f')](_0x590d23[_0x6b2b('0x2e')]);_0x3ea74f[_0x6b2b('0x30')]=_[_0x6b2b('0x31')](_0x3ea74f[_0x6b2b('0x2c')],_0x3ea74f[_0x6b2b('0x2e')]);_0x4a2485[_0x6b2b('0x32')]=_[_0x6b2b('0x31')](_0x3ea74f[_0x6b2b('0x2c')],qs[_0x6b2b('0x33')](_0x590d23[_0x6b2b('0x2e')][_0x6b2b('0x33')]));_0x4a2485[_0x6b2b('0x32')]=_0x4a2485['attributes']['length']?_0x4a2485['attributes']:_0x3ea74f[_0x6b2b('0x2c')];if(!_0x590d23['query']['hasOwnProperty']('nolimit')){_0x4a2485['limit']=qs[_0x6b2b('0x1f')](_0x590d23[_0x6b2b('0x2e')]['limit']);_0x4a2485[_0x6b2b('0x1e')]=qs['offset'](_0x590d23[_0x6b2b('0x2e')][_0x6b2b('0x1e')]);}_0x4a2485[_0x6b2b('0x34')]=qs[_0x6b2b('0x35')](_0x590d23[_0x6b2b('0x2e')]['sort']);_0x4a2485[_0x6b2b('0x36')]=qs[_0x6b2b('0x30')](_['pick'](_0x590d23[_0x6b2b('0x2e')],_0x3ea74f['filters']),_0x53f29a);if(_0x590d23[_0x6b2b('0x2e')][_0x6b2b('0x37')]){_0x4a2485[_0x6b2b('0x36')]=_[_0x6b2b('0x38')](_0x4a2485[_0x6b2b('0x36')],{'$or':_['map'](_0x53f29a,function(_0x165478){if(_0x165478[_0x6b2b('0x2a')]!=='VIRTUAL'){var _0x4c88c4={};_0x4c88c4[_0x165478[_0x6b2b('0x26')]]={'$like':'%'+_0x590d23[_0x6b2b('0x2e')][_0x6b2b('0x37')]+'%'};return _0x4c88c4;}})});}_0x4a2485=_[_0x6b2b('0x38')]({},_0x4a2485,_0x590d23['options']);var _0x206b72={'where':_0x4a2485[_0x6b2b('0x36')]};return db['Team']['count'](_0x206b72)[_0x6b2b('0x23')](function(_0x30c5f2){_0x5cb879[_0x6b2b('0x1d')]=_0x30c5f2;if(_0x590d23[_0x6b2b('0x2e')][_0x6b2b('0x39')]){_0x4a2485['include']=[{'all':!![]}];}return db[_0x6b2b('0x27')][_0x6b2b('0x3a')](_0x4a2485);})['then'](function(_0x195beb){_0x5cb879['rows']=_0x195beb;return _0x5cb879;})[_0x6b2b('0x23')](respondWithFilteredResult(_0x2938cd,_0x4a2485))[_0x6b2b('0x3b')](handleError(_0x2938cd,null));};exports[_0x6b2b('0x3c')]=function(_0x3d9e36,_0x487525){var _0x5b93c1={'raw':![],'where':{'id':_0x3d9e36[_0x6b2b('0x3d')]['id']}},_0x319945={};_0x319945[_0x6b2b('0x2c')]=_['keys'](db[_0x6b2b('0x27')][_0x6b2b('0x28')]);_0x319945['query']=_[_0x6b2b('0x2f')](_0x3d9e36[_0x6b2b('0x2e')]);_0x319945[_0x6b2b('0x30')]=_[_0x6b2b('0x31')](_0x319945[_0x6b2b('0x2c')],_0x319945[_0x6b2b('0x2e')]);_0x5b93c1[_0x6b2b('0x32')]=_[_0x6b2b('0x31')](_0x319945[_0x6b2b('0x2c')],qs[_0x6b2b('0x33')](_0x3d9e36[_0x6b2b('0x2e')][_0x6b2b('0x33')]));_0x5b93c1[_0x6b2b('0x32')]=_0x5b93c1['attributes'][_0x6b2b('0x3e')]?_0x5b93c1['attributes']:_0x319945['model'];if(_0x3d9e36[_0x6b2b('0x2e')]['includeAll']){_0x5b93c1['include']=[{'all':!![]}];}_0x5b93c1=_['merge']({},_0x5b93c1,_0x3d9e36[_0x6b2b('0x3f')]);return db[_0x6b2b('0x27')][_0x6b2b('0x40')](_0x5b93c1)['then'](handleEntityNotFound(_0x487525,null))['then'](respondWithResult(_0x487525,null))['catch'](handleError(_0x487525,null));};exports[_0x6b2b('0x41')]=function(_0x51daef,_0x1e9a04){return db[_0x6b2b('0x27')][_0x6b2b('0x41')](_0x51daef[_0x6b2b('0x42')],{})[_0x6b2b('0x23')](function(_0x1f55d9){var _0x28a604=_0x51daef[_0x6b2b('0x43')][_0x6b2b('0x44')]({'plain':!![]});if(!_0x28a604)throw new Error(_0x6b2b('0x45'));if(_0x28a604[_0x6b2b('0x46')]===_0x6b2b('0x43')){var _0x1fe823=_0x1f55d9[_0x6b2b('0x44')]({'plain':!![]});var _0x3a220e=_0x6b2b('0x47');return db[_0x6b2b('0x48')][_0x6b2b('0x40')]({'where':{'name':_0x3a220e,'userProfileId':_0x28a604['userProfileId']},'raw':!![]})[_0x6b2b('0x23')](function(_0x2ba930){if(_0x2ba930&&_0x2ba930['autoAssociation']===0x0){return db[_0x6b2b('0x49')][_0x6b2b('0x41')]({'name':_0x1fe823['name'],'resourceId':_0x1fe823['id'],'type':_0x2ba930[_0x6b2b('0x26')],'sectionId':_0x2ba930['id']},{})[_0x6b2b('0x23')](function(){return _0x1f55d9;});}else{return _0x1f55d9;}})[_0x6b2b('0x3b')](function(_0x23ea3d){logger['error'](_0x6b2b('0x4a'),_0x23ea3d);throw _0x23ea3d;});}return _0x1f55d9;})[_0x6b2b('0x23')](respondWithResult(_0x1e9a04,0xc9))[_0x6b2b('0x3b')](handleError(_0x1e9a04,null));};exports[_0x6b2b('0x22')]=function(_0x583df7,_0x5c2f69){if(_0x583df7['body']['id']){delete _0x583df7[_0x6b2b('0x42')]['id'];}return db[_0x6b2b('0x27')][_0x6b2b('0x40')]({'where':{'id':_0x583df7[_0x6b2b('0x3d')]['id']}})[_0x6b2b('0x23')](handleEntityNotFound(_0x5c2f69,null))[_0x6b2b('0x23')](saveUpdates(_0x583df7[_0x6b2b('0x42')],null))['then'](respondWithResult(_0x5c2f69,null))[_0x6b2b('0x3b')](handleError(_0x5c2f69,null));};exports[_0x6b2b('0x24')]=function(_0x42f1d8,_0x4b5a1c){return db[_0x6b2b('0x27')][_0x6b2b('0x40')]({'where':{'id':_0x42f1d8[_0x6b2b('0x3d')]['id']}})['then'](handleEntityNotFound(_0x4b5a1c,null))[_0x6b2b('0x23')](removeEntity(_0x4b5a1c,null))[_0x6b2b('0x3b')](handleError(_0x4b5a1c,null));};exports[_0x6b2b('0x4b')]=function(_0x218a42,_0x2c5745,_0x33656f){return db['Team'][_0x6b2b('0x4c')]({'where':{'id':_0x218a42['params']['id']}})[_0x6b2b('0x23')](handleEntityNotFound(_0x2c5745,null))[_0x6b2b('0x23')](function(_0x32813f){if(!_0x218a42[_0x6b2b('0x2e')][_0x6b2b('0x4d')]||!utils[_0x6b2b('0x4e')](_0x218a42['query']['channel'])){throw new db[(_0x6b2b('0x4f'))][(_0x6b2b('0x50'))](_0x6b2b('0x51'));}var _0x3b20ac={};var _0x518fde={};_0x518fde[_0x6b2b('0x2c')]=_['keys'](db[_[_0x6b2b('0x52')](_0x218a42[_0x6b2b('0x2e')][_0x6b2b('0x4d')][_0x6b2b('0x53')]())+'Queue']['rawAttributes']);_0x518fde[_0x6b2b('0x2e')]=_[_0x6b2b('0x2f')](_0x218a42['query']);_0x518fde['filters']=_[_0x6b2b('0x31')](_0x518fde['model'],_0x518fde[_0x6b2b('0x2e')]);_0x3b20ac[_0x6b2b('0x32')]=_['intersection'](_0x518fde[_0x6b2b('0x2c')],qs[_0x6b2b('0x33')](_0x218a42[_0x6b2b('0x2e')]['fields']));_0x3b20ac[_0x6b2b('0x32')]=_0x3b20ac[_0x6b2b('0x32')][_0x6b2b('0x3e')]?_0x3b20ac[_0x6b2b('0x32')]:_0x518fde[_0x6b2b('0x2c')];_0x3b20ac[_0x6b2b('0x1f')]=qs[_0x6b2b('0x1f')](_0x218a42[_0x6b2b('0x2e')]['limit']);_0x3b20ac[_0x6b2b('0x1e')]=qs[_0x6b2b('0x1e')](_0x218a42[_0x6b2b('0x2e')]['offset']);_0x3b20ac['order']=qs['sort'](_0x218a42[_0x6b2b('0x2e')]['sort']);_0x3b20ac[_0x6b2b('0x36')]=qs[_0x6b2b('0x30')](_[_0x6b2b('0x54')](_0x218a42[_0x6b2b('0x2e')],_0x518fde[_0x6b2b('0x30')]));_0x3b20ac=_[_0x6b2b('0x38')]({},_0x3b20ac,_0x218a42['options']);return _0x32813f['get'+_[_0x6b2b('0x52')](_0x218a42[_0x6b2b('0x2e')]['channel'][_0x6b2b('0x53')]())+_0x6b2b('0x55')](_0x3b20ac);})[_0x6b2b('0x23')](respondWithResult(_0x2c5745,null))['catch'](handleError(_0x2c5745,null));};exports[_0x6b2b('0x56')]=function(_0x5d043c,_0x426f52,_0x3fff15){return db['Team'][_0x6b2b('0x4c')]({'where':{'id':_0x5d043c[_0x6b2b('0x3d')]['id']}})['then'](function(_0x5e83c7){if(_0x5e83c7){if(!_0x5d043c[_0x6b2b('0x42')][_0x6b2b('0x4d')]||!utils[_0x6b2b('0x4e')](_0x5d043c['body'][_0x6b2b('0x4d')])){throw new db[(_0x6b2b('0x4f'))][(_0x6b2b('0x50'))](_0x6b2b('0x51'));}return _0x5e83c7['add'+_[_0x6b2b('0x52')](_0x5d043c['body']['channel']['toLowerCase']())+_0x6b2b('0x55')](_0x5d043c[_0x6b2b('0x42')][_0x6b2b('0x57')]);}return null;})['then'](handleEntityNotFound(_0x426f52,null))[_0x6b2b('0x23')](respondWithStatusCode(_0x426f52,null))[_0x6b2b('0x3b')](handleError(_0x426f52,null));};exports[_0x6b2b('0x58')]=function(_0x338fa9,_0xb4dee9,_0x2900f3){return db[_0x6b2b('0x27')][_0x6b2b('0x4c')]({'where':{'id':_0x338fa9[_0x6b2b('0x3d')]['id']}})[_0x6b2b('0x23')](function(_0x1e96e0){if(_0x1e96e0){if(!_0x338fa9[_0x6b2b('0x2e')]['channel']||!utils['isValidChannel'](_0x338fa9['query']['channel'])){throw new db[(_0x6b2b('0x4f'))][(_0x6b2b('0x50'))](_0x6b2b('0x51'));}return _0x1e96e0['remove'+_[_0x6b2b('0x52')](_0x338fa9[_0x6b2b('0x2e')][_0x6b2b('0x4d')][_0x6b2b('0x53')]())+_0x6b2b('0x55')](_0x338fa9[_0x6b2b('0x2e')][_0x6b2b('0x57')]);}return null;})['then'](handleEntityNotFound(_0xb4dee9,null))['then'](respondWithStatusCode(_0xb4dee9,null))[_0x6b2b('0x3b')](handleError(_0xb4dee9,null));};exports[_0x6b2b('0x59')]=function(_0x43304b,_0x423112,_0x2a3d92){return db['Team'][_0x6b2b('0x40')]({'where':{'id':_0x43304b[_0x6b2b('0x3d')]['id']}})['then'](handleEntityNotFound(_0x423112,null))['then'](function(_0x49b313){if(_0x49b313){var _0x1c3c9c=[_0x6b2b('0x5a'),_0x6b2b('0x5b'),_0x6b2b('0x5c'),_0x6b2b('0x5d'),_0x6b2b('0x5e'),_0x6b2b('0x5f'),_0x6b2b('0x60')];return BPromise[_0x6b2b('0x61')](_0x1c3c9c,function(_0x33d275){return _0x49b313[_0x6b2b('0x44')+_0x33d275+'Queues']({'attributes':['id',_0x6b2b('0x26')]})['then'](function(_0x29d3dd){return BPromise[_0x6b2b('0x61')](_0x29d3dd,function(_0x38237c){return _0x38237c[_0x6b2b('0x59')](_0x43304b[_0x6b2b('0x42')]['ids'])[_0x6b2b('0x23')](function(){if(_0x33d275===_0x6b2b('0x5a')){return db[_0x6b2b('0x62')]['findAll']({'where':{'id':_0x43304b[_0x6b2b('0x42')]['ids']},'attributes':['id',_0x6b2b('0x26'),'online',_0x6b2b('0x63'),'interface'],'raw':!![]})[_0x6b2b('0x23')](function(_0x5c6108){return BPromise[_0x6b2b('0x61')](_[_0x6b2b('0x37')](_0x5c6108,{'online':0x1}),function(_0x2b3cb7){return db[_0x6b2b('0x64')][_0x6b2b('0x65')]({'membername':_0x2b3cb7[_0x6b2b('0x26')],'UserId':_0x2b3cb7['id'],'queue_name':_0x38237c[_0x6b2b('0x26')],'VoiceQueueId':_0x38237c['id'],'interface':_['isNil'](_0x2b3cb7[_0x6b2b('0x66')])?util[_0x6b2b('0x67')](_0x6b2b('0x68'),_0x2b3cb7['name']):_0x2b3cb7[_0x6b2b('0x66')],'paused':_0x2b3cb7[_0x6b2b('0x63')]||![],'penalty':0x0});});});}});});})[_0x6b2b('0x23')](function(){return _0x49b313;});})[_0x6b2b('0x23')](function(){return _0x49b313;});}})['then'](function(_0x422c2f){if(_0x422c2f){return _0x422c2f['addAgents'](_0x43304b[_0x6b2b('0x42')][_0x6b2b('0x57')],_['omit'](_0x43304b[_0x6b2b('0x42')],[_0x6b2b('0x57'),'id'])||{})[_0x6b2b('0x69')](function(_0x207ca5){for(var _0x2dd3cf=0x0;_0x2dd3cf<_0x43304b['body']['ids'][_0x6b2b('0x3e')];_0x2dd3cf+=0x1){socket[_0x6b2b('0x6a')](_0x6b2b('0x6b'),{'UserId':_0x43304b[_0x6b2b('0x42')]['ids'][_0x2dd3cf],'TeamId':_0x43304b[_0x6b2b('0x3d')]['id']});}return _0x207ca5;});}})[_0x6b2b('0x23')](respondWithResult(_0x423112,null))[_0x6b2b('0x3b')](handleError(_0x423112,null));};exports['removeAgents']=function(_0x1e4ccb,_0x238e9a,_0x4bb5df){return db[_0x6b2b('0x27')][_0x6b2b('0x40')]({'where':{'id':_0x1e4ccb['params']['id']}})[_0x6b2b('0x23')](handleEntityNotFound(_0x238e9a,null))[_0x6b2b('0x23')](function(_0x310848){if(_0x310848){return BPromise['each']([_0x6b2b('0x6c'),_0x6b2b('0x6d'),_0x6b2b('0x6e'),_0x6b2b('0x6f'),_0x6b2b('0x70'),'openchannel',_0x6b2b('0x71')],function(_0x525b8f){return _0x310848[_0x6b2b('0x44')+_[_0x6b2b('0x52')](_0x525b8f)+'Queues']({'attributes':['id',_0x6b2b('0x26')]})[_0x6b2b('0x23')](function(_0x556192){return BPromise[_0x6b2b('0x61')](_0x556192,function(_0x4c6efd){return _0x4c6efd[_0x6b2b('0x72')](_0x1e4ccb['query'][_0x6b2b('0x57')])['then'](function(){if(_0x525b8f===_0x6b2b('0x6c')){return db[_0x6b2b('0x64')]['destroy']({'where':{'VoiceQueueId':_0x4c6efd['id'],'UserId':_0x1e4ccb[_0x6b2b('0x2e')][_0x6b2b('0x57')]}});}});});})[_0x6b2b('0x23')](function(){return _0x310848;});})[_0x6b2b('0x23')](function(){return _0x310848;});}})[_0x6b2b('0x23')](function(_0x463761){if(_0x463761){return _0x463761[_0x6b2b('0x72')](_0x1e4ccb[_0x6b2b('0x2e')][_0x6b2b('0x57')])[_0x6b2b('0x23')](function(){if(_['isArray'](_0x1e4ccb[_0x6b2b('0x2e')]['ids'])){for(var _0x5c8cf4=0x0;_0x5c8cf4<_0x1e4ccb[_0x6b2b('0x2e')][_0x6b2b('0x57')][_0x6b2b('0x3e')];_0x5c8cf4+=0x1){socket['emit'](_0x6b2b('0x73'),{'UserId':Number(_0x1e4ccb[_0x6b2b('0x2e')][_0x6b2b('0x57')][_0x5c8cf4]),'TeamId':Number(_0x1e4ccb[_0x6b2b('0x3d')]['id'])});}}else{socket['emit']('userTeam:remove',{'UserId':Number(_0x1e4ccb[_0x6b2b('0x2e')][_0x6b2b('0x57')]),'TeamId':Number(_0x1e4ccb['params']['id'])});}});}})[_0x6b2b('0x23')](respondWithStatusCode(_0x238e9a,null))[_0x6b2b('0x3b')](handleError(_0x238e9a,null));};exports[_0x6b2b('0x74')]=function(_0x51b584,_0x3140ff,_0x3d9ec4){var _0x4bbf4e={};var _0x1be894={};var _0x535471;var _0x52bfcc;return db[_0x6b2b('0x27')][_0x6b2b('0x4c')]({'where':{'id':_0x51b584[_0x6b2b('0x3d')]['id']}})['then'](handleEntityNotFound(_0x3140ff,null))[_0x6b2b('0x23')](function(_0x53fe63){if(_0x53fe63){_0x535471=_0x53fe63;_0x1be894['model']=_[_0x6b2b('0x2f')](db[_0x6b2b('0x62')][_0x6b2b('0x28')]);_0x1be894[_0x6b2b('0x2e')]=_['keys'](_0x51b584[_0x6b2b('0x2e')]);_0x1be894[_0x6b2b('0x30')]=_['intersection'](_0x1be894[_0x6b2b('0x2c')],_0x1be894[_0x6b2b('0x2e')]);_0x4bbf4e[_0x6b2b('0x32')]=_[_0x6b2b('0x31')](_0x1be894[_0x6b2b('0x2c')],qs[_0x6b2b('0x33')](_0x51b584[_0x6b2b('0x2e')][_0x6b2b('0x33')]));_0x4bbf4e[_0x6b2b('0x32')]=_0x4bbf4e[_0x6b2b('0x32')][_0x6b2b('0x3e')]?_0x4bbf4e[_0x6b2b('0x32')]:_0x1be894[_0x6b2b('0x2c')];_0x4bbf4e[_0x6b2b('0x34')]=qs[_0x6b2b('0x35')](_0x51b584[_0x6b2b('0x2e')][_0x6b2b('0x35')]);_0x4bbf4e[_0x6b2b('0x36')]=qs['filters'](_[_0x6b2b('0x54')](_0x51b584[_0x6b2b('0x2e')],_0x1be894[_0x6b2b('0x30')]));if(_0x51b584[_0x6b2b('0x2e')]['filter']){_0x4bbf4e[_0x6b2b('0x36')]=_['merge'](_0x4bbf4e[_0x6b2b('0x36')],{'$or':_[_0x6b2b('0x2d')](_0x4bbf4e[_0x6b2b('0x32')],function(_0x4b52bb){var _0x37d829={};_0x37d829[_0x4b52bb]={'$like':'%'+_0x51b584['query'][_0x6b2b('0x37')]+'%'};return _0x37d829;})});}_0x4bbf4e=_[_0x6b2b('0x38')]({},_0x4bbf4e,_0x51b584[_0x6b2b('0x3f')]);return _0x535471[_0x6b2b('0x74')](_0x4bbf4e);}})[_0x6b2b('0x23')](function(_0x2407fe){if(_0x2407fe){_0x52bfcc=_0x2407fe[_0x6b2b('0x3e')];if(!_0x51b584['query'][_0x6b2b('0x75')](_0x6b2b('0x76'))){_0x4bbf4e[_0x6b2b('0x1f')]=qs[_0x6b2b('0x1f')](_0x51b584[_0x6b2b('0x2e')][_0x6b2b('0x1f')]);_0x4bbf4e[_0x6b2b('0x1e')]=qs[_0x6b2b('0x1e')](_0x51b584[_0x6b2b('0x2e')][_0x6b2b('0x1e')]);}return _0x535471['getAgents'](_0x4bbf4e);}})['then'](function(_0x203055){if(_0x203055){return _0x203055?{'count':_0x52bfcc,'rows':_0x203055}:null;}})['then'](respondWithResult(_0x3140ff,null))[_0x6b2b('0x3b')](handleError(_0x3140ff,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index d2faf32..6f2425f 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 _0x80ed=['exports','../../mysqldb','Team','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x5d8e44,_0x390492){var _0x5b7c5c=function(_0x5e6a62){while(--_0x5e6a62){_0x5d8e44['push'](_0x5d8e44['shift']());}};_0x5b7c5c(++_0x390492);}(_0x80ed,0x189));var _0xd80e=function(_0x250add,_0x1d53aa){_0x250add=_0x250add-0x0;var _0x42df80=_0x80ed[_0x250add];return _0x42df80;};'use strict';var EventEmitter=require('events');var Team=require(_0xd80e('0x0'))['db'][_0xd80e('0x1')];var TeamEvents=new EventEmitter();TeamEvents[_0xd80e('0x2')](0x0);var events={'afterCreate':_0xd80e('0x3'),'afterUpdate':_0xd80e('0x4'),'afterDestroy':'remove'};function emitEvent(_0x417ba6){return function(_0x186378,_0x4586c3,_0x3fb926){TeamEvents['emit'](_0x417ba6+':'+_0x186378['id'],_0x186378);TeamEvents[_0xd80e('0x5')](_0x417ba6,_0x186378);_0x3fb926(null);};}for(var e in events){if(events[_0xd80e('0x6')](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module[_0xd80e('0x7')]=TeamEvents; \ No newline at end of file +var _0x2450=['events','../../mysqldb','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports'];(function(_0x1ef5df,_0x403130){var _0x297393=function(_0x304a74){while(--_0x304a74){_0x1ef5df['push'](_0x1ef5df['shift']());}};_0x297393(++_0x403130);}(_0x2450,0x1e6));var _0x0245=function(_0x36385b,_0x429635){_0x36385b=_0x36385b-0x0;var _0x409886=_0x2450[_0x36385b];return _0x409886;};'use strict';var EventEmitter=require(_0x0245('0x0'));var Team=require(_0x0245('0x1'))['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents[_0x0245('0x2')](0x0);var events={'afterCreate':_0x0245('0x3'),'afterUpdate':'update','afterDestroy':_0x0245('0x4')};function emitEvent(_0xa06268){return function(_0x417cd2,_0x401f05,_0x32eb89){TeamEvents[_0x0245('0x5')](_0xa06268+':'+_0x417cd2['id'],_0x417cd2);TeamEvents['emit'](_0xa06268,_0x417cd2);_0x32eb89(null);};}for(var e in events){if(events[_0x0245('0x6')](e)){var event=events[e];Team[_0x0245('0x7')](e,emitEvent(event));}}module[_0x0245('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 43d42ff..8c301e8 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 _0x15d3=['request-promise','path','rimraf','exports','define','Team','util','api','moment','bluebird'];(function(_0x13766c,_0x448358){var _0x4e1472=function(_0x15e6f5){while(--_0x15e6f5){_0x13766c['push'](_0x13766c['shift']());}};_0x4e1472(++_0x448358);}(_0x15d3,0x9c));var _0x315d=function(_0x1c629f,_0x4c7d1e){_0x1c629f=_0x1c629f-0x0;var _0x2c0186=_0x15d3[_0x1c629f];return _0x2c0186;};'use strict';var _=require('lodash');var util=require(_0x315d('0x0'));var logger=require('../../config/logger')(_0x315d('0x1'));var moment=require(_0x315d('0x2'));var BPromise=require(_0x315d('0x3'));var rp=require(_0x315d('0x4'));var fs=require('fs');var path=require(_0x315d('0x5'));var rimraf=require(_0x315d('0x6'));var config=require('../../config/environment');var attributes=require('./team.attributes');module[_0x315d('0x7')]=function(_0x567df1,_0x1c77cf){return _0x567df1[_0x315d('0x8')](_0x315d('0x9'),attributes,{'tableName':'teams','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdc27=['teams','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./team.attributes','exports','Team'];(function(_0x3f9ec3,_0x3dfd37){var _0xe85b13=function(_0x10e8ed){while(--_0x10e8ed){_0x3f9ec3['push'](_0x3f9ec3['shift']());}};_0xe85b13(++_0x3dfd37);}(_0xdc27,0x199));var _0x7dc2=function(_0x113503,_0x28dd19){_0x113503=_0x113503-0x0;var _0x5366da=_0xdc27[_0x113503];return _0x5366da;};'use strict';var _=require('lodash');var util=require(_0x7dc2('0x0'));var logger=require(_0x7dc2('0x1'))(_0x7dc2('0x2'));var moment=require(_0x7dc2('0x3'));var BPromise=require('bluebird');var rp=require(_0x7dc2('0x4'));var fs=require('fs');var path=require(_0x7dc2('0x5'));var rimraf=require(_0x7dc2('0x6'));var config=require(_0x7dc2('0x7'));var attributes=require(_0x7dc2('0x8'));module[_0x7dc2('0x9')]=function(_0x299ff6,_0x1b7a7d){return _0x299ff6['define'](_0x7dc2('0xa'),attributes,{'tableName':_0x7dc2('0xb'),'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 29a1f19..7476294 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 _0xc621=['Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','request','then'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc621,0x1d1));var _0x1c62=function(_0x34f746,_0x1e283e){_0x34f746=_0x34f746-0x0;var _0xa9a65e=_0xc621[_0x34f746];return _0xa9a65e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1c62('0x0'));var BPromise=require(_0x1c62('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1c62('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x1c62('0x3'));var logger=require(_0x1c62('0x4'))(_0x1c62('0x5'));var config=require('../../config/environment');var jayson=require(_0x1c62('0x6'));var client=jayson[_0x1c62('0x7')][_0x1c62('0x8')]({'port':0x232a});config[_0x1c62('0x9')]=_['defaults'](config['redis'],{'host':_0x1c62('0xa'),'port':0x18eb});var socket=require(_0x1c62('0xb'))(new Redis(config['redis']));require('./team.socket')[_0x1c62('0xc')](socket);function respondWithRpcPromise(_0x15992f,_0x428f21,_0x45bd3a){return new BPromise(function(_0x370b6e,_0x4fe2d2){return client[_0x1c62('0xd')](_0x15992f,_0x45bd3a)[_0x1c62('0xe')](function(_0x11bbca){logger['info'](_0x1c62('0xf'),_0x428f21,_0x1c62('0x10'));logger[_0x1c62('0x11')](_0x1c62('0x12'),_0x428f21,'request\x20sent',JSON[_0x1c62('0x13')](_0x11bbca));if(_0x11bbca['error']){if(_0x11bbca[_0x1c62('0x14')]['code']===0x1f4){logger[_0x1c62('0x14')](_0x1c62('0xf'),_0x428f21,_0x11bbca[_0x1c62('0x14')][_0x1c62('0x15')]);return _0x4fe2d2(_0x11bbca[_0x1c62('0x14')][_0x1c62('0x15')]);}logger[_0x1c62('0x14')]('Team,\x20%s,\x20%s',_0x428f21,_0x11bbca['error'][_0x1c62('0x15')]);return _0x370b6e(_0x11bbca[_0x1c62('0x14')][_0x1c62('0x15')]);}else{logger[_0x1c62('0x16')](_0x1c62('0xf'),_0x428f21,_0x1c62('0x10'));_0x370b6e(_0x11bbca[_0x1c62('0x17')][_0x1c62('0x15')]);}})['catch'](function(_0x511464){logger[_0x1c62('0x14')](_0x1c62('0xf'),_0x428f21,_0x511464);_0x4fe2d2(_0x511464);});});} \ No newline at end of file +var _0x28d9=['Team,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./team.socket','register','request','then','info','Team,\x20%s,\x20%s'];(function(_0x2f84b8,_0x11931d){var _0x3729c0=function(_0x3324f0){while(--_0x3324f0){_0x2f84b8['push'](_0x2f84b8['shift']());}};_0x3729c0(++_0x11931d);}(_0x28d9,0x16f));var _0x928d=function(_0x454c94,_0x177e3d){_0x454c94=_0x454c94-0x0;var _0x259cd9=_0x28d9[_0x454c94];return _0x259cd9;};'use strict';var _=require(_0x928d('0x0'));var util=require(_0x928d('0x1'));var moment=require(_0x928d('0x2'));var BPromise=require(_0x928d('0x3'));var rs=require(_0x928d('0x4'));var fs=require('fs');var Redis=require(_0x928d('0x5'));var db=require(_0x928d('0x6'))['db'];var utils=require(_0x928d('0x7'));var logger=require(_0x928d('0x8'))(_0x928d('0x9'));var config=require(_0x928d('0xa'));var jayson=require(_0x928d('0xb'));var client=jayson[_0x928d('0xc')][_0x928d('0xd')]({'port':0x232a});config[_0x928d('0xe')]=_['defaults'](config['redis'],{'host':_0x928d('0xf'),'port':0x18eb});var socket=require(_0x928d('0x10'))(new Redis(config[_0x928d('0xe')]));require(_0x928d('0x11'))[_0x928d('0x12')](socket);function respondWithRpcPromise(_0x4e09e4,_0xe5d847,_0x3b53f4){return new BPromise(function(_0x205c7b,_0x34fba0){return client[_0x928d('0x13')](_0x4e09e4,_0x3b53f4)[_0x928d('0x14')](function(_0x2b3236){logger[_0x928d('0x15')](_0x928d('0x16'),_0xe5d847,'request\x20sent');logger['debug'](_0x928d('0x17'),_0xe5d847,'request\x20sent',JSON[_0x928d('0x18')](_0x2b3236));if(_0x2b3236[_0x928d('0x19')]){if(_0x2b3236[_0x928d('0x19')][_0x928d('0x1a')]===0x1f4){logger[_0x928d('0x19')](_0x928d('0x16'),_0xe5d847,_0x2b3236[_0x928d('0x19')][_0x928d('0x1b')]);return _0x34fba0(_0x2b3236['error'][_0x928d('0x1b')]);}logger[_0x928d('0x19')](_0x928d('0x16'),_0xe5d847,_0x2b3236[_0x928d('0x19')][_0x928d('0x1b')]);return _0x205c7b(_0x2b3236['error'][_0x928d('0x1b')]);}else{logger[_0x928d('0x15')]('Team,\x20%s,\x20%s',_0xe5d847,_0x928d('0x1c'));_0x205c7b(_0x2b3236[_0x928d('0x1d')][_0x928d('0x1b')]);}})['catch'](function(_0x4f5188){logger[_0x928d('0x19')](_0x928d('0x16'),_0xe5d847,_0x4f5188);_0x34fba0(_0x4f5188);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 3644802..e0a0c58 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 _0x6209=['remove','update','removeListener','length','team:','./team.events','save'];(function(_0x5568ed,_0x61f3be){var _0x406c98=function(_0x3cc9a7){while(--_0x3cc9a7){_0x5568ed['push'](_0x5568ed['shift']());}};_0x406c98(++_0x61f3be);}(_0x6209,0x1e8));var _0x9620=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0x6209[_0xa1e3e3];return _0xc980e9;};'use strict';var TeamEvents=require(_0x9620('0x0'));var events=[_0x9620('0x1'),_0x9620('0x2'),_0x9620('0x3')];function createListener(_0x21f61a,_0xd5842f){return function(_0x27ec47){_0xd5842f['emit'](_0x21f61a,_0x27ec47);};}function removeListener(_0x2869e2,_0x17dc92){return function(){TeamEvents[_0x9620('0x4')](_0x2869e2,_0x17dc92);};}exports['register']=function(_0x30c6e7){for(var _0x26302a=0x0,_0x2bdb4e=events[_0x9620('0x5')];_0x26302a<_0x2bdb4e;_0x26302a++){var _0x488d59=events[_0x26302a];var _0x4e9082=createListener(_0x9620('0x6')+_0x488d59,_0x30c6e7);TeamEvents['on'](_0x488d59,_0x4e9082);}}; \ No newline at end of file +var _0xe714=['register','team:','./team.events','remove','update','emit','removeListener'];(function(_0x1fb6be,_0x4675c1){var _0x5a8298=function(_0x2a78b0){while(--_0x2a78b0){_0x1fb6be['push'](_0x1fb6be['shift']());}};_0x5a8298(++_0x4675c1);}(_0xe714,0xe2));var _0x4e71=function(_0x38b7a2,_0x2979bb){_0x38b7a2=_0x38b7a2-0x0;var _0x209ff5=_0xe714[_0x38b7a2];return _0x209ff5;};'use strict';var TeamEvents=require(_0x4e71('0x0'));var events=['save',_0x4e71('0x1'),_0x4e71('0x2')];function createListener(_0xe0504f,_0x28abe0){return function(_0x5c5974){_0x28abe0[_0x4e71('0x3')](_0xe0504f,_0x5c5974);};}function removeListener(_0x59a685,_0xad5224){return function(){TeamEvents[_0x4e71('0x4')](_0x59a685,_0xad5224);};}exports[_0x4e71('0x5')]=function(_0x204a19){for(var _0xfe1559=0x0,_0x1f1d35=events['length'];_0xfe1559<_0x1f1d35;_0xfe1559++){var _0x3b0a3a=events[_0xfe1559];var _0x32b6d0=createListener(_0x4e71('0x6')+_0x3b0a3a,_0x204a19);TeamEvents['on'](_0x3b0a3a,_0x32b6d0);}}; \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index f5b17ee..68cf468 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 _0x4a08=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller','isAuthenticated','index','get','/:id','show','create','put','update','delete','destroy','multer','util'];(function(_0x498917,_0xba064b){var _0x85e0f3=function(_0x33d293){while(--_0x33d293){_0x498917['push'](_0x498917['shift']());}};_0x85e0f3(++_0xba064b);}(_0x4a08,0x1a0));var _0x84a0=function(_0x3da353,_0x39dd0a){_0x3da353=_0x3da353-0x0;var _0x24dc09=_0x4a08[_0x3da353];return _0x24dc09;};'use strict';var multer=require(_0x84a0('0x0'));var util=require(_0x84a0('0x1'));var path=require('path');var timeout=require(_0x84a0('0x2'));var express=require(_0x84a0('0x3'));var router=express[_0x84a0('0x4')]();var auth=require(_0x84a0('0x5'));var interaction=require(_0x84a0('0x6'));var config=require(_0x84a0('0x7'));var controller=require(_0x84a0('0x8'));router['get']('/',auth[_0x84a0('0x9')](),controller[_0x84a0('0xa')]);router[_0x84a0('0xb')](_0x84a0('0xc'),auth['isAuthenticated'](),controller[_0x84a0('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x84a0('0xe')]);router[_0x84a0('0xf')](_0x84a0('0xc'),auth[_0x84a0('0x9')](),controller[_0x84a0('0x10')]);router[_0x84a0('0x11')](_0x84a0('0xc'),auth['isAuthenticated'](),controller[_0x84a0('0x12')]);module['exports']=router; \ No newline at end of file +var _0xbeea=['path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','multer','util'];(function(_0x34b95a,_0x132258){var _0x4cef42=function(_0x79af2c){while(--_0x79af2c){_0x34b95a['push'](_0x34b95a['shift']());}};_0x4cef42(++_0x132258);}(_0xbeea,0x13e));var _0xabee=function(_0x4ab2c7,_0x2dcf76){_0x4ab2c7=_0x4ab2c7-0x0;var _0x1815f2=_0xbeea[_0x4ab2c7];return _0x1815f2;};'use strict';var multer=require(_0xabee('0x0'));var util=require(_0xabee('0x1'));var path=require(_0xabee('0x2'));var timeout=require(_0xabee('0x3'));var express=require('express');var router=express[_0xabee('0x4')]();var auth=require(_0xabee('0x5'));var interaction=require(_0xabee('0x6'));var config=require(_0xabee('0x7'));var controller=require(_0xabee('0x8'));router[_0xabee('0x9')]('/',auth[_0xabee('0xa')](),controller['index']);router[_0xabee('0x9')](_0xabee('0xb'),auth[_0xabee('0xa')](),controller[_0xabee('0xc')]);router[_0xabee('0xd')]('/',auth[_0xabee('0xa')](),controller[_0xabee('0xe')]);router[_0xabee('0xf')](_0xabee('0xb'),auth[_0xabee('0xa')](),controller[_0xabee('0x10')]);router[_0xabee('0x11')](_0xabee('0xb'),auth[_0xabee('0xa')](),controller[_0xabee('0x12')]);module[_0xabee('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 6f33d41..d70b0aa 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 _0xdeb7=['STRING','TEXT'];(function(_0x316df6,_0x23c30a){var _0x36e79c=function(_0x461ebe){while(--_0x461ebe){_0x316df6['push'](_0x316df6['shift']());}};_0x36e79c(++_0x23c30a);}(_0xdeb7,0x82));var _0x7deb=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xdeb7[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x7deb('0x0')]},'description':{'type':Sequelize[_0x7deb('0x0')]},'html':{'type':Sequelize[_0x7deb('0x1')]}}; \ No newline at end of file +var _0x1757=['TEXT','exports','STRING'];(function(_0x32f7d7,_0x54231b){var _0x133d09=function(_0x41a7ab){while(--_0x41a7ab){_0x32f7d7['push'](_0x32f7d7['shift']());}};_0x133d09(++_0x54231b);}(_0x1757,0x7f));var _0x7175=function(_0x25b4be,_0x4d7cbe){_0x25b4be=_0x25b4be-0x0;var _0x45dd6f=_0x1757[_0x25b4be];return _0x45dd6f;};'use strict';var Sequelize=require('sequelize');module[_0x7175('0x0')]={'name':{'type':Sequelize[_0x7175('0x1')]},'description':{'type':Sequelize['STRING']},'html':{'type':Sequelize[_0x7175('0x2')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 8a29da8..3641793 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 _0xd9ff=['intersection','attributes','model','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','Template','then','findAll','rows','catch','show','params','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','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','../../mysqldb','sendStatus','status','end','count','offset','limit','set','json','apply','reject','destroy','get','error','stack','name','send','index','rawAttributes','type','map','query','keys','filters'];(function(_0x3eff47,_0x2796a1){var _0x8c1be2=function(_0x43d039){while(--_0x43d039){_0x3eff47['push'](_0x3eff47['shift']());}};_0x8c1be2(++_0x2796a1);}(_0xd9ff,0x1d0));var _0xfd9f=function(_0x3cea8d,_0x163bf2){_0x3cea8d=_0x3cea8d-0x0;var _0x4e757e=_0xd9ff[_0x3cea8d];return _0x4e757e;};'use strict';var pdf=require(_0xfd9f('0x0'));var emlformat=require(_0xfd9f('0x1'));var rimraf=require(_0xfd9f('0x2'));var zipdir=require(_0xfd9f('0x3'));var jsonpatch=require(_0xfd9f('0x4'));var rp=require(_0xfd9f('0x5'));var moment=require(_0xfd9f('0x6'));var BPromise=require(_0xfd9f('0x7'));var Mustache=require(_0xfd9f('0x8'));var util=require(_0xfd9f('0x9'));var path=require(_0xfd9f('0xa'));var sox=require('sox');var csv=require(_0xfd9f('0xb'));var ejs=require(_0xfd9f('0xc'));var fs=require('fs');var _=require(_0xfd9f('0xd'));var squel=require(_0xfd9f('0xe'));var crypto=require('crypto');var jsforce=require(_0xfd9f('0xf'));var deskjs=require(_0xfd9f('0x10'));var toCsv=require('to-csv');var querystring=require(_0xfd9f('0x11'));var Papa=require(_0xfd9f('0x12'));var Redis=require(_0xfd9f('0x13'));var authService=require(_0xfd9f('0x14'));var qs=require(_0xfd9f('0x15'));var as=require(_0xfd9f('0x16'));var hardwareService=require(_0xfd9f('0x17'));var logger=require(_0xfd9f('0x18'))(_0xfd9f('0x19'));var utils=require(_0xfd9f('0x1a'));var config=require(_0xfd9f('0x1b'));var db=require(_0xfd9f('0x1c'))['db'];function respondWithStatusCode(_0x9c1ca6,_0x2cd910){_0x2cd910=_0x2cd910||0xcc;return function(_0x34f993){if(_0x34f993){return _0x9c1ca6[_0xfd9f('0x1d')](_0x2cd910);}return _0x9c1ca6[_0xfd9f('0x1e')](_0x2cd910)[_0xfd9f('0x1f')]();};}function respondWithResult(_0x31e276,_0x527953){_0x527953=_0x527953||0xc8;return function(_0x15747b){if(_0x15747b){return _0x31e276[_0xfd9f('0x1e')](_0x527953)['json'](_0x15747b);}};}function respondWithFilteredResult(_0x592773,_0x49c068){return function(_0x105046){if(_0x105046){var _0x532698=_0x105046[_0xfd9f('0x20')],_0x20ed19=_0x49c068[_0xfd9f('0x21')],_0x4628d6=_0x49c068['offset']+_0x49c068[_0xfd9f('0x22')],_0x15be17;if(_0x4628d6>=_0x532698){_0x4628d6=_0x532698;_0x15be17=0xc8;}else{_0x15be17=0xce;}_0x592773['status'](_0x15be17);return _0x592773[_0xfd9f('0x23')]('Content-Range',_0x20ed19+'-'+_0x4628d6+'/'+_0x532698)[_0xfd9f('0x24')](_0x105046);}return null;};}function patchUpdates(_0x518855){return function(_0x23fdcc){try{jsonpatch[_0xfd9f('0x25')](_0x23fdcc,_0x518855,!![]);}catch(_0x1f79ff){return BPromise[_0xfd9f('0x26')](_0x1f79ff);}return _0x23fdcc['save']();};}function saveUpdates(_0x401544,_0x51026b){return function(_0x30def3){if(_0x30def3){return _0x30def3['update'](_0x401544)['then'](function(_0x37eaaa){return _0x37eaaa;});}return null;};}function removeEntity(_0xa03598,_0x3f55f1){return function(_0x503612){if(_0x503612){return _0x503612[_0xfd9f('0x27')]()['then'](function(){var _0x2000bb=_0x503612[_0xfd9f('0x28')]({'plain':!![]});var _0x497f7c='Templates';return db['UserProfileResource']['destroy']({'where':{'type':_0x497f7c,'resourceId':_0x2000bb['id']}})['then'](function(){return _0x503612;});})['then'](function(){_0xa03598['status'](0xcc)[_0xfd9f('0x1f')]();});}};}function handleEntityNotFound(_0xfbd7d9,_0x1efdf1){return function(_0x2e1f7c){if(!_0x2e1f7c){_0xfbd7d9[_0xfd9f('0x1d')](0x194);}return _0x2e1f7c;};}function handleError(_0x1b7c9e,_0x4a3a8a){_0x4a3a8a=_0x4a3a8a||0x1f4;return function(_0xb9b8a8){logger[_0xfd9f('0x29')](_0xb9b8a8[_0xfd9f('0x2a')]);if(_0xb9b8a8[_0xfd9f('0x2b')]){delete _0xb9b8a8[_0xfd9f('0x2b')];}_0x1b7c9e[_0xfd9f('0x1e')](_0x4a3a8a)[_0xfd9f('0x2c')](_0xb9b8a8);};}exports[_0xfd9f('0x2d')]=function(_0x4cbd6d,_0x2e356d){var _0x3def48={},_0x146573={},_0x46d540={'count':0x0,'rows':[]};var _0x50e640=_['map'](db['Template'][_0xfd9f('0x2e')],function(_0x252cb3){return{'name':_0x252cb3['fieldName'],'type':_0x252cb3[_0xfd9f('0x2f')]['key']};});_0x146573['model']=_[_0xfd9f('0x30')](_0x50e640,_0xfd9f('0x2b'));_0x146573[_0xfd9f('0x31')]=_[_0xfd9f('0x32')](_0x4cbd6d[_0xfd9f('0x31')]);_0x146573[_0xfd9f('0x33')]=_[_0xfd9f('0x34')](_0x146573['model'],_0x146573[_0xfd9f('0x31')]);_0x3def48[_0xfd9f('0x35')]=_['intersection'](_0x146573[_0xfd9f('0x36')],qs['fields'](_0x4cbd6d['query'][_0xfd9f('0x37')]));_0x3def48[_0xfd9f('0x35')]=_0x3def48['attributes'][_0xfd9f('0x38')]?_0x3def48[_0xfd9f('0x35')]:_0x146573[_0xfd9f('0x36')];if(!_0x4cbd6d[_0xfd9f('0x31')]['hasOwnProperty'](_0xfd9f('0x39'))){_0x3def48['limit']=qs[_0xfd9f('0x22')](_0x4cbd6d[_0xfd9f('0x31')][_0xfd9f('0x22')]);_0x3def48[_0xfd9f('0x21')]=qs[_0xfd9f('0x21')](_0x4cbd6d[_0xfd9f('0x31')][_0xfd9f('0x21')]);}_0x3def48[_0xfd9f('0x3a')]=qs[_0xfd9f('0x3b')](_0x4cbd6d[_0xfd9f('0x31')][_0xfd9f('0x3b')]);_0x3def48[_0xfd9f('0x3c')]=qs[_0xfd9f('0x33')](_[_0xfd9f('0x3d')](_0x4cbd6d[_0xfd9f('0x31')],_0x146573[_0xfd9f('0x33')]),_0x50e640);if(_0x4cbd6d[_0xfd9f('0x31')]['filter']){_0x3def48['where']=_[_0xfd9f('0x3e')](_0x3def48[_0xfd9f('0x3c')],{'$or':_['map'](_0x50e640,function(_0xeae35){if(_0xeae35[_0xfd9f('0x2f')]!==_0xfd9f('0x3f')){var _0x22a22b={};_0x22a22b[_0xeae35[_0xfd9f('0x2b')]]={'$like':'%'+_0x4cbd6d[_0xfd9f('0x31')][_0xfd9f('0x40')]+'%'};return _0x22a22b;}})});}_0x3def48=_[_0xfd9f('0x3e')]({},_0x3def48,_0x4cbd6d[_0xfd9f('0x41')]);var _0x27c11c={'where':_0x3def48[_0xfd9f('0x3c')]};return db[_0xfd9f('0x42')][_0xfd9f('0x20')](_0x27c11c)[_0xfd9f('0x43')](function(_0x5a3837){_0x46d540[_0xfd9f('0x20')]=_0x5a3837;if(_0x4cbd6d[_0xfd9f('0x31')]['includeAll']){_0x3def48['include']=[{'all':!![]}];}return db[_0xfd9f('0x42')][_0xfd9f('0x44')](_0x3def48);})[_0xfd9f('0x43')](function(_0x2b346d){_0x46d540[_0xfd9f('0x45')]=_0x2b346d;return _0x46d540;})[_0xfd9f('0x43')](respondWithFilteredResult(_0x2e356d,_0x3def48))[_0xfd9f('0x46')](handleError(_0x2e356d,null));};exports[_0xfd9f('0x47')]=function(_0x9ba30c,_0x1cde27){var _0x522aee={'raw':!![],'where':{'id':_0x9ba30c[_0xfd9f('0x48')]['id']}},_0x54d525={};_0x54d525[_0xfd9f('0x36')]=_['keys'](db[_0xfd9f('0x42')][_0xfd9f('0x2e')]);_0x54d525[_0xfd9f('0x31')]=_[_0xfd9f('0x32')](_0x9ba30c[_0xfd9f('0x31')]);_0x54d525[_0xfd9f('0x33')]=_['intersection'](_0x54d525['model'],_0x54d525[_0xfd9f('0x31')]);_0x522aee['attributes']=_[_0xfd9f('0x34')](_0x54d525[_0xfd9f('0x36')],qs[_0xfd9f('0x37')](_0x9ba30c[_0xfd9f('0x31')][_0xfd9f('0x37')]));_0x522aee[_0xfd9f('0x35')]=_0x522aee[_0xfd9f('0x35')][_0xfd9f('0x38')]?_0x522aee[_0xfd9f('0x35')]:_0x54d525[_0xfd9f('0x36')];if(_0x9ba30c[_0xfd9f('0x31')][_0xfd9f('0x49')]){_0x522aee['include']=[{'all':!![]}];}_0x522aee=_[_0xfd9f('0x3e')]({},_0x522aee,_0x9ba30c[_0xfd9f('0x41')]);return db['Template'][_0xfd9f('0x4a')](_0x522aee)[_0xfd9f('0x43')](handleEntityNotFound(_0x1cde27,null))[_0xfd9f('0x43')](respondWithResult(_0x1cde27,null))[_0xfd9f('0x46')](handleError(_0x1cde27,null));};exports[_0xfd9f('0x4b')]=function(_0x1bd006,_0x49db15){return db[_0xfd9f('0x42')][_0xfd9f('0x4b')](_0x1bd006['body'],{})[_0xfd9f('0x43')](function(_0x18b74b){var _0x59d7eb=_0x1bd006[_0xfd9f('0x4c')]['get']({'plain':!![]});if(!_0x59d7eb)throw new Error(_0xfd9f('0x4d'));if(_0x59d7eb[_0xfd9f('0x4e')]===_0xfd9f('0x4c')){var _0x9289ae=_0x18b74b[_0xfd9f('0x28')]({'plain':!![]});var _0x35b877='Templates';return db[_0xfd9f('0x4f')]['find']({'where':{'name':_0x35b877,'userProfileId':_0x59d7eb[_0xfd9f('0x50')]},'raw':!![]})['then'](function(_0x429444){if(_0x429444&&_0x429444[_0xfd9f('0x51')]===0x0){return db[_0xfd9f('0x52')][_0xfd9f('0x4b')]({'name':_0x9289ae[_0xfd9f('0x2b')],'resourceId':_0x9289ae['id'],'type':_0x429444[_0xfd9f('0x2b')],'sectionId':_0x429444['id']},{})[_0xfd9f('0x43')](function(){return _0x18b74b;});}else{return _0x18b74b;}})[_0xfd9f('0x46')](function(_0x423173){logger[_0xfd9f('0x29')](_0xfd9f('0x53'),_0x423173);throw _0x423173;});}return _0x18b74b;})['then'](respondWithResult(_0x49db15,0xc9))['catch'](handleError(_0x49db15,null));};exports[_0xfd9f('0x54')]=function(_0x147e7a,_0x4bb035){if(_0x147e7a['body']['id']){delete _0x147e7a[_0xfd9f('0x55')]['id'];}return db['Template'][_0xfd9f('0x4a')]({'where':{'id':_0x147e7a[_0xfd9f('0x48')]['id']}})[_0xfd9f('0x43')](handleEntityNotFound(_0x4bb035,null))['then'](saveUpdates(_0x147e7a[_0xfd9f('0x55')],null))[_0xfd9f('0x43')](respondWithResult(_0x4bb035,null))[_0xfd9f('0x46')](handleError(_0x4bb035,null));};exports[_0xfd9f('0x27')]=function(_0x1a37a0,_0x1b7f31){return db[_0xfd9f('0x42')][_0xfd9f('0x4a')]({'where':{'id':_0x1a37a0[_0xfd9f('0x48')]['id']}})[_0xfd9f('0x43')](handleEntityNotFound(_0x1b7f31,null))[_0xfd9f('0x43')](removeEntity(_0x1b7f31,null))[_0xfd9f('0x46')](handleError(_0x1b7f31,null));}; \ No newline at end of file +var _0x3f47=['eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','then','destroy','get','Templates','UserProfileResource','error','name','send','index','Template','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','show','keys','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','html-pdf'];(function(_0x5e3d0b,_0x949b05){var _0x2db54e=function(_0xa39cf6){while(--_0xa39cf6){_0x5e3d0b['push'](_0x5e3d0b['shift']());}};_0x2db54e(++_0x949b05);}(_0x3f47,0x147));var _0x73f4=function(_0x3d4347,_0x47f3d9){_0x3d4347=_0x3d4347-0x0;var _0x14e255=_0x3f47[_0x3d4347];return _0x14e255;};'use strict';var pdf=require(_0x73f4('0x0'));var emlformat=require(_0x73f4('0x1'));var rimraf=require(_0x73f4('0x2'));var zipdir=require(_0x73f4('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x73f4('0x4'));var moment=require(_0x73f4('0x5'));var BPromise=require(_0x73f4('0x6'));var Mustache=require(_0x73f4('0x7'));var util=require('util');var path=require(_0x73f4('0x8'));var sox=require(_0x73f4('0x9'));var csv=require(_0x73f4('0xa'));var ejs=require(_0x73f4('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x73f4('0xc'));var crypto=require('crypto');var jsforce=require(_0x73f4('0xd'));var deskjs=require(_0x73f4('0xe'));var toCsv=require('to-csv');var querystring=require(_0x73f4('0xf'));var Papa=require(_0x73f4('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x73f4('0x11'));var as=require(_0x73f4('0x12'));var hardwareService=require(_0x73f4('0x13'));var logger=require('../../config/logger')(_0x73f4('0x14'));var utils=require(_0x73f4('0x15'));var config=require('../../config/environment');var db=require(_0x73f4('0x16'))['db'];function respondWithStatusCode(_0x262694,_0x135943){_0x135943=_0x135943||0xcc;return function(_0x1cda14){if(_0x1cda14){return _0x262694[_0x73f4('0x17')](_0x135943);}return _0x262694[_0x73f4('0x18')](_0x135943)[_0x73f4('0x19')]();};}function respondWithResult(_0x79b41d,_0x58e744){_0x58e744=_0x58e744||0xc8;return function(_0x17415a){if(_0x17415a){return _0x79b41d['status'](_0x58e744)[_0x73f4('0x1a')](_0x17415a);}};}function respondWithFilteredResult(_0x49d1dd,_0x362f19){return function(_0x5e459a){if(_0x5e459a){var _0x5cbea4=_0x5e459a[_0x73f4('0x1b')],_0x2d3b9a=_0x362f19[_0x73f4('0x1c')],_0x196f1b=_0x362f19[_0x73f4('0x1c')]+_0x362f19['limit'],_0x58649d;if(_0x196f1b>=_0x5cbea4){_0x196f1b=_0x5cbea4;_0x58649d=0xc8;}else{_0x58649d=0xce;}_0x49d1dd[_0x73f4('0x18')](_0x58649d);return _0x49d1dd[_0x73f4('0x1d')](_0x73f4('0x1e'),_0x2d3b9a+'-'+_0x196f1b+'/'+_0x5cbea4)[_0x73f4('0x1a')](_0x5e459a);}return null;};}function patchUpdates(_0x3f5a38){return function(_0x4214dd){try{jsonpatch[_0x73f4('0x1f')](_0x4214dd,_0x3f5a38,!![]);}catch(_0x32b829){return BPromise[_0x73f4('0x20')](_0x32b829);}return _0x4214dd[_0x73f4('0x21')]();};}function saveUpdates(_0x2954cf,_0x13e5e2){return function(_0x380d5f){if(_0x380d5f){return _0x380d5f['update'](_0x2954cf)[_0x73f4('0x22')](function(_0x182d3a){return _0x182d3a;});}return null;};}function removeEntity(_0x13376f,_0xe40496){return function(_0x46b689){if(_0x46b689){return _0x46b689[_0x73f4('0x23')]()[_0x73f4('0x22')](function(){var _0x506e54=_0x46b689[_0x73f4('0x24')]({'plain':!![]});var _0x4a7181=_0x73f4('0x25');return db[_0x73f4('0x26')][_0x73f4('0x23')]({'where':{'type':_0x4a7181,'resourceId':_0x506e54['id']}})[_0x73f4('0x22')](function(){return _0x46b689;});})[_0x73f4('0x22')](function(){_0x13376f[_0x73f4('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x44946e,_0x1cd5f9){return function(_0x4a8ac7){if(!_0x4a8ac7){_0x44946e[_0x73f4('0x17')](0x194);}return _0x4a8ac7;};}function handleError(_0x312f75,_0x17e1d3){_0x17e1d3=_0x17e1d3||0x1f4;return function(_0x131ff9){logger[_0x73f4('0x27')](_0x131ff9['stack']);if(_0x131ff9[_0x73f4('0x28')]){delete _0x131ff9[_0x73f4('0x28')];}_0x312f75['status'](_0x17e1d3)[_0x73f4('0x29')](_0x131ff9);};}exports[_0x73f4('0x2a')]=function(_0x453f5c,_0x14626a){var _0x10e130={},_0x5c883c={},_0xbea656={'count':0x0,'rows':[]};var _0x5a3243=_['map'](db[_0x73f4('0x2b')][_0x73f4('0x2c')],function(_0x384c95){return{'name':_0x384c95[_0x73f4('0x2d')],'type':_0x384c95[_0x73f4('0x2e')][_0x73f4('0x2f')]};});_0x5c883c[_0x73f4('0x30')]=_['map'](_0x5a3243,_0x73f4('0x28'));_0x5c883c[_0x73f4('0x31')]=_['keys'](_0x453f5c[_0x73f4('0x31')]);_0x5c883c[_0x73f4('0x32')]=_[_0x73f4('0x33')](_0x5c883c[_0x73f4('0x30')],_0x5c883c['query']);_0x10e130[_0x73f4('0x34')]=_[_0x73f4('0x33')](_0x5c883c[_0x73f4('0x30')],qs[_0x73f4('0x35')](_0x453f5c[_0x73f4('0x31')]['fields']));_0x10e130[_0x73f4('0x34')]=_0x10e130['attributes'][_0x73f4('0x36')]?_0x10e130[_0x73f4('0x34')]:_0x5c883c['model'];if(!_0x453f5c[_0x73f4('0x31')][_0x73f4('0x37')](_0x73f4('0x38'))){_0x10e130[_0x73f4('0x39')]=qs[_0x73f4('0x39')](_0x453f5c[_0x73f4('0x31')]['limit']);_0x10e130[_0x73f4('0x1c')]=qs[_0x73f4('0x1c')](_0x453f5c[_0x73f4('0x31')]['offset']);}_0x10e130[_0x73f4('0x3a')]=qs[_0x73f4('0x3b')](_0x453f5c[_0x73f4('0x31')]['sort']);_0x10e130['where']=qs[_0x73f4('0x32')](_[_0x73f4('0x3c')](_0x453f5c[_0x73f4('0x31')],_0x5c883c[_0x73f4('0x32')]),_0x5a3243);if(_0x453f5c[_0x73f4('0x31')][_0x73f4('0x3d')]){_0x10e130[_0x73f4('0x3e')]=_[_0x73f4('0x3f')](_0x10e130[_0x73f4('0x3e')],{'$or':_[_0x73f4('0x40')](_0x5a3243,function(_0x540923){if(_0x540923['type']!==_0x73f4('0x41')){var _0x4e71c5={};_0x4e71c5[_0x540923[_0x73f4('0x28')]]={'$like':'%'+_0x453f5c['query'][_0x73f4('0x3d')]+'%'};return _0x4e71c5;}})});}_0x10e130=_[_0x73f4('0x3f')]({},_0x10e130,_0x453f5c[_0x73f4('0x42')]);var _0x5a3e49={'where':_0x10e130['where']};return db['Template'][_0x73f4('0x1b')](_0x5a3e49)[_0x73f4('0x22')](function(_0x571460){_0xbea656[_0x73f4('0x1b')]=_0x571460;if(_0x453f5c[_0x73f4('0x31')][_0x73f4('0x43')]){_0x10e130[_0x73f4('0x44')]=[{'all':!![]}];}return db[_0x73f4('0x2b')][_0x73f4('0x45')](_0x10e130);})[_0x73f4('0x22')](function(_0x4e4f86){_0xbea656[_0x73f4('0x46')]=_0x4e4f86;return _0xbea656;})[_0x73f4('0x22')](respondWithFilteredResult(_0x14626a,_0x10e130))['catch'](handleError(_0x14626a,null));};exports[_0x73f4('0x47')]=function(_0x5e4b73,_0x28a09f){var _0x3289ef={'raw':!![],'where':{'id':_0x5e4b73['params']['id']}},_0x575a63={};_0x575a63[_0x73f4('0x30')]=_[_0x73f4('0x48')](db[_0x73f4('0x2b')][_0x73f4('0x2c')]);_0x575a63[_0x73f4('0x31')]=_['keys'](_0x5e4b73[_0x73f4('0x31')]);_0x575a63[_0x73f4('0x32')]=_[_0x73f4('0x33')](_0x575a63['model'],_0x575a63[_0x73f4('0x31')]);_0x3289ef[_0x73f4('0x34')]=_['intersection'](_0x575a63[_0x73f4('0x30')],qs[_0x73f4('0x35')](_0x5e4b73[_0x73f4('0x31')]['fields']));_0x3289ef[_0x73f4('0x34')]=_0x3289ef[_0x73f4('0x34')][_0x73f4('0x36')]?_0x3289ef[_0x73f4('0x34')]:_0x575a63[_0x73f4('0x30')];if(_0x5e4b73['query'][_0x73f4('0x43')]){_0x3289ef[_0x73f4('0x44')]=[{'all':!![]}];}_0x3289ef=_[_0x73f4('0x3f')]({},_0x3289ef,_0x5e4b73[_0x73f4('0x42')]);return db['Template'][_0x73f4('0x49')](_0x3289ef)[_0x73f4('0x22')](handleEntityNotFound(_0x28a09f,null))[_0x73f4('0x22')](respondWithResult(_0x28a09f,null))['catch'](handleError(_0x28a09f,null));};exports[_0x73f4('0x4a')]=function(_0x4e6de3,_0x163e0a){return db['Template'][_0x73f4('0x4a')](_0x4e6de3['body'],{})[_0x73f4('0x22')](function(_0x3ef2b5){var _0x4cd009=_0x4e6de3[_0x73f4('0x4b')][_0x73f4('0x24')]({'plain':!![]});if(!_0x4cd009)throw new Error(_0x73f4('0x4c'));if(_0x4cd009[_0x73f4('0x4d')]==='user'){var _0x2db014=_0x3ef2b5[_0x73f4('0x24')]({'plain':!![]});var _0x587dba=_0x73f4('0x25');return db['UserProfileSection'][_0x73f4('0x49')]({'where':{'name':_0x587dba,'userProfileId':_0x4cd009['userProfileId']},'raw':!![]})[_0x73f4('0x22')](function(_0x26e0e5){if(_0x26e0e5&&_0x26e0e5['autoAssociation']===0x0){return db[_0x73f4('0x26')]['create']({'name':_0x2db014[_0x73f4('0x28')],'resourceId':_0x2db014['id'],'type':_0x26e0e5[_0x73f4('0x28')],'sectionId':_0x26e0e5['id']},{})[_0x73f4('0x22')](function(){return _0x3ef2b5;});}else{return _0x3ef2b5;}})[_0x73f4('0x4e')](function(_0x77ef64){logger[_0x73f4('0x27')](_0x73f4('0x4f'),_0x77ef64);throw _0x77ef64;});}return _0x3ef2b5;})[_0x73f4('0x22')](respondWithResult(_0x163e0a,0xc9))[_0x73f4('0x4e')](handleError(_0x163e0a,null));};exports['update']=function(_0xead6d,_0x3e8ac1){if(_0xead6d[_0x73f4('0x50')]['id']){delete _0xead6d['body']['id'];}return db[_0x73f4('0x2b')][_0x73f4('0x49')]({'where':{'id':_0xead6d[_0x73f4('0x51')]['id']}})[_0x73f4('0x22')](handleEntityNotFound(_0x3e8ac1,null))[_0x73f4('0x22')](saveUpdates(_0xead6d['body'],null))[_0x73f4('0x22')](respondWithResult(_0x3e8ac1,null))['catch'](handleError(_0x3e8ac1,null));};exports[_0x73f4('0x23')]=function(_0x8795b9,_0x782128){return db[_0x73f4('0x2b')]['find']({'where':{'id':_0x8795b9[_0x73f4('0x51')]['id']}})[_0x73f4('0x22')](handleEntityNotFound(_0x782128,null))[_0x73f4('0x22')](removeEntity(_0x782128,null))[_0x73f4('0x4e')](handleError(_0x782128,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 05e9572..684438a 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 _0xd80f=['define','Template','tools_templates','lodash','util','../../config/logger','moment','request-promise','rimraf','./template.attributes','exports'];(function(_0x1dfd20,_0x32f529){var _0x41270e=function(_0x5d3326){while(--_0x5d3326){_0x1dfd20['push'](_0x1dfd20['shift']());}};_0x41270e(++_0x32f529);}(_0xd80f,0x100));var _0xfd80=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd80f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xfd80('0x0'));var util=require(_0xfd80('0x1'));var logger=require(_0xfd80('0x2'))('api');var moment=require(_0xfd80('0x3'));var BPromise=require('bluebird');var rp=require(_0xfd80('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfd80('0x5'));var config=require('../../config/environment');var attributes=require(_0xfd80('0x6'));module[_0xfd80('0x7')]=function(_0x3c809c,_0x2135c1){return _0x3c809c[_0xfd80('0x8')](_0xfd80('0x9'),attributes,{'tableName':_0xfd80('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdc39=['tools_templates','lodash','util','../../config/logger','api','bluebird','request-promise','./template.attributes','exports','define','Template'];(function(_0x42bdad,_0x12836c){var _0x122626=function(_0x2eb29c){while(--_0x2eb29c){_0x42bdad['push'](_0x42bdad['shift']());}};_0x122626(++_0x12836c);}(_0xdc39,0x90));var _0x9dc3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdc39[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x9dc3('0x0'));var util=require(_0x9dc3('0x1'));var logger=require(_0x9dc3('0x2'))(_0x9dc3('0x3'));var moment=require('moment');var BPromise=require(_0x9dc3('0x4'));var rp=require(_0x9dc3('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x9dc3('0x6'));module[_0x9dc3('0x7')]=function(_0x34f036,_0x361da0){return _0x34f036[_0x9dc3('0x8')](_0x9dc3('0x9'),attributes,{'tableName':_0x9dc3('0xa'),'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 0967a36..9f32d24 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 _0x44ec=['options','raw','where','attributes','limit','include','map','model','GetTemplate','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','Template'];(function(_0x1d4970,_0x787bab){var _0x10877e=function(_0x243ed4){while(--_0x243ed4){_0x1d4970['push'](_0x1d4970['shift']());}};_0x10877e(++_0x787bab);}(_0x44ec,0x99));var _0xc44e=function(_0x10f17c,_0x25a5f8){_0x10f17c=_0x10f17c-0x0;var _0x53702b=_0x44ec[_0x10f17c];return _0x53702b;};'use strict';var _=require(_0xc44e('0x0'));var util=require(_0xc44e('0x1'));var moment=require(_0xc44e('0x2'));var BPromise=require(_0xc44e('0x3'));var rs=require(_0xc44e('0x4'));var fs=require('fs');var Redis=require(_0xc44e('0x5'));var db=require(_0xc44e('0x6'))['db'];var utils=require(_0xc44e('0x7'));var logger=require('../../config/logger')(_0xc44e('0x8'));var config=require(_0xc44e('0x9'));var jayson=require(_0xc44e('0xa'));var client=jayson[_0xc44e('0xb')][_0xc44e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x46db92,_0x1ea906,_0x94e598){return new BPromise(function(_0x46a892,_0x582d62){return client[_0xc44e('0xd')](_0x46db92,_0x94e598)[_0xc44e('0xe')](function(_0x221805){logger[_0xc44e('0xf')](_0xc44e('0x10'),_0x1ea906,_0xc44e('0x11'));logger[_0xc44e('0x12')](_0xc44e('0x13'),_0x1ea906,_0xc44e('0x11'),JSON[_0xc44e('0x14')](_0x221805));if(_0x221805[_0xc44e('0x15')]){if(_0x221805['error'][_0xc44e('0x16')]===0x1f4){logger[_0xc44e('0x15')]('Template,\x20%s,\x20%s',_0x1ea906,_0x221805[_0xc44e('0x15')]['message']);return _0x582d62(_0x221805['error'][_0xc44e('0x17')]);}logger[_0xc44e('0x15')](_0xc44e('0x10'),_0x1ea906,_0x221805[_0xc44e('0x15')][_0xc44e('0x17')]);return _0x46a892(_0x221805[_0xc44e('0x15')]['message']);}else{logger['info'](_0xc44e('0x10'),_0x1ea906,'request\x20sent');_0x46a892(_0x221805[_0xc44e('0x18')][_0xc44e('0x17')]);}})[_0xc44e('0x19')](function(_0x4c08b1){logger[_0xc44e('0x15')]('Template,\x20%s,\x20%s',_0x1ea906,_0x4c08b1);_0x582d62(_0x4c08b1);});});}exports['GetTemplate']=function(_0x217be1){var _0x142aa9=this;return new Promise(function(_0x50e113,_0x43d299){return db[_0xc44e('0x1a')]['findAll']({'raw':_0x217be1[_0xc44e('0x1b')]?_0x217be1[_0xc44e('0x1b')][_0xc44e('0x1c')]===undefined?!![]:![]:!![],'where':_0x217be1[_0xc44e('0x1b')]?_0x217be1[_0xc44e('0x1b')][_0xc44e('0x1d')]||null:null,'attributes':_0x217be1[_0xc44e('0x1b')]?_0x217be1[_0xc44e('0x1b')][_0xc44e('0x1e')]||null:null,'limit':_0x217be1[_0xc44e('0x1b')]?_0x217be1[_0xc44e('0x1b')][_0xc44e('0x1f')]||null:null,'include':_0x217be1['options']?_0x217be1[_0xc44e('0x1b')][_0xc44e('0x20')]?_[_0xc44e('0x21')](_0x217be1[_0xc44e('0x1b')][_0xc44e('0x20')],function(_0x574f5a){return{'model':db[_0x574f5a[_0xc44e('0x22')]],'as':_0x574f5a['as'],'attributes':_0x574f5a['attributes'],'include':_0x574f5a[_0xc44e('0x20')]?_[_0xc44e('0x21')](_0x574f5a[_0xc44e('0x20')],function(_0x156aff){return{'model':db[_0x156aff[_0xc44e('0x22')]],'as':_0x156aff['as'],'attributes':_0x156aff[_0xc44e('0x1e')],'include':_0x156aff[_0xc44e('0x20')]?_[_0xc44e('0x21')](_0x156aff[_0xc44e('0x20')],function(_0x12e010){return{'model':db[_0x12e010['model']],'as':_0x12e010['as'],'attributes':_0x12e010[_0xc44e('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xc44e('0xe')](function(_0x1e2045){logger['info'](_0xc44e('0x23'),_0x217be1);logger[_0xc44e('0x12')](_0xc44e('0x23'),_0x217be1,JSON[_0xc44e('0x14')](_0x1e2045));_0x50e113(_0x1e2045);})[_0xc44e('0x19')](function(_0xe1c9a7){logger[_0xc44e('0x15')](_0xc44e('0x23'),_0xe1c9a7[_0xc44e('0x17')],_0x217be1);_0x43d299(_0x142aa9[_0xc44e('0x15')](0x1f4,_0xe1c9a7[_0xc44e('0x17')]));});});}; \ No newline at end of file +var _0xf02c=['findAll','options','raw','where','attributes','limit','map','include','model','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','Template,\x20%s,\x20%s','message','result','catch','GetTemplate','Template'];(function(_0x350d3d,_0xefef5e){var _0x3b8db8=function(_0x28d83e){while(--_0x28d83e){_0x350d3d['push'](_0x350d3d['shift']());}};_0x3b8db8(++_0xefef5e);}(_0xf02c,0x1f3));var _0xcf02=function(_0x14d48e,_0x134bbe){_0x14d48e=_0x14d48e-0x0;var _0x4bd0d8=_0xf02c[_0x14d48e];return _0x4bd0d8;};'use strict';var _=require(_0xcf02('0x0'));var util=require(_0xcf02('0x1'));var moment=require(_0xcf02('0x2'));var BPromise=require(_0xcf02('0x3'));var rs=require(_0xcf02('0x4'));var fs=require('fs');var Redis=require(_0xcf02('0x5'));var db=require(_0xcf02('0x6'))['db'];var utils=require(_0xcf02('0x7'));var logger=require('../../config/logger')(_0xcf02('0x8'));var config=require(_0xcf02('0x9'));var jayson=require(_0xcf02('0xa'));var client=jayson[_0xcf02('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ccb2f,_0x59c390,_0x1214b4){return new BPromise(function(_0x2412b3,_0x928e51){return client[_0xcf02('0xc')](_0x4ccb2f,_0x1214b4)[_0xcf02('0xd')](function(_0x19cf2f){logger[_0xcf02('0xe')]('Template,\x20%s,\x20%s',_0x59c390,_0xcf02('0xf'));logger[_0xcf02('0x10')](_0xcf02('0x11'),_0x59c390,_0xcf02('0xf'),JSON[_0xcf02('0x12')](_0x19cf2f));if(_0x19cf2f[_0xcf02('0x13')]){if(_0x19cf2f['error']['code']===0x1f4){logger['error'](_0xcf02('0x14'),_0x59c390,_0x19cf2f[_0xcf02('0x13')][_0xcf02('0x15')]);return _0x928e51(_0x19cf2f[_0xcf02('0x13')][_0xcf02('0x15')]);}logger['error'](_0xcf02('0x14'),_0x59c390,_0x19cf2f[_0xcf02('0x13')]['message']);return _0x2412b3(_0x19cf2f['error'][_0xcf02('0x15')]);}else{logger[_0xcf02('0xe')](_0xcf02('0x14'),_0x59c390,_0xcf02('0xf'));_0x2412b3(_0x19cf2f[_0xcf02('0x16')]['message']);}})[_0xcf02('0x17')](function(_0x17a9a8){logger[_0xcf02('0x13')]('Template,\x20%s,\x20%s',_0x59c390,_0x17a9a8);_0x928e51(_0x17a9a8);});});}exports[_0xcf02('0x18')]=function(_0xc86115){var _0x13f3f7=this;return new Promise(function(_0x43d245,_0x1a5878){return db[_0xcf02('0x19')][_0xcf02('0x1a')]({'raw':_0xc86115[_0xcf02('0x1b')]?_0xc86115[_0xcf02('0x1b')][_0xcf02('0x1c')]===undefined?!![]:![]:!![],'where':_0xc86115['options']?_0xc86115['options'][_0xcf02('0x1d')]||null:null,'attributes':_0xc86115[_0xcf02('0x1b')]?_0xc86115[_0xcf02('0x1b')][_0xcf02('0x1e')]||null:null,'limit':_0xc86115['options']?_0xc86115[_0xcf02('0x1b')][_0xcf02('0x1f')]||null:null,'include':_0xc86115[_0xcf02('0x1b')]?_0xc86115[_0xcf02('0x1b')]['include']?_[_0xcf02('0x20')](_0xc86115[_0xcf02('0x1b')][_0xcf02('0x21')],function(_0x5d39f6){return{'model':db[_0x5d39f6[_0xcf02('0x22')]],'as':_0x5d39f6['as'],'attributes':_0x5d39f6[_0xcf02('0x1e')],'include':_0x5d39f6[_0xcf02('0x21')]?_[_0xcf02('0x20')](_0x5d39f6[_0xcf02('0x21')],function(_0x3fd855){return{'model':db[_0x3fd855['model']],'as':_0x3fd855['as'],'attributes':_0x3fd855['attributes'],'include':_0x3fd855[_0xcf02('0x21')]?_[_0xcf02('0x20')](_0x3fd855[_0xcf02('0x21')],function(_0xa75c86){return{'model':db[_0xa75c86['model']],'as':_0xa75c86['as'],'attributes':_0xa75c86[_0xcf02('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x57d825){logger['info'](_0xcf02('0x18'),_0xc86115);logger[_0xcf02('0x10')](_0xcf02('0x18'),_0xc86115,JSON[_0xcf02('0x12')](_0x57d825));_0x43d245(_0x57d825);})[_0xcf02('0x17')](function(_0x59ca55){logger[_0xcf02('0x13')]('GetTemplate',_0x59ca55[_0xcf02('0x15')],_0xc86115);_0x1a5878(_0x13f3f7[_0xcf02('0x13')](0x1f4,_0x59ca55[_0xcf02('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index fe6a8a4..3973430 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 _0x1cd6=['getAllConditions','/:id/actions','post','create','addAllCondition','/:id/any_conditions','put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','get','isAuthenticated','index','/:id','/:id/all_conditions'];(function(_0x36982b,_0x2923c9){var _0x4fcf7b=function(_0xf24a46){while(--_0xf24a46){_0x36982b['push'](_0x36982b['shift']());}};_0x4fcf7b(++_0x2923c9);}(_0x1cd6,0x88));var _0x61cd=function(_0x2d6022,_0x343d21){_0x2d6022=_0x2d6022-0x0;var _0x223f6e=_0x1cd6[_0x2d6022];return _0x223f6e;};'use strict';var multer=require(_0x61cd('0x0'));var util=require(_0x61cd('0x1'));var path=require(_0x61cd('0x2'));var timeout=require('connect-timeout');var express=require(_0x61cd('0x3'));var router=express[_0x61cd('0x4')]();var auth=require(_0x61cd('0x5'));var interaction=require(_0x61cd('0x6'));var config=require(_0x61cd('0x7'));var controller=require(_0x61cd('0x8'));router[_0x61cd('0x9')]('/',auth[_0x61cd('0xa')](),controller[_0x61cd('0xb')]);router['get'](_0x61cd('0xc'),auth[_0x61cd('0xa')](),controller['show']);router[_0x61cd('0x9')](_0x61cd('0xd'),auth['isAuthenticated'](),controller[_0x61cd('0xe')]);router[_0x61cd('0x9')]('/:id/any_conditions',auth[_0x61cd('0xa')](),controller['getAnyConditions']);router[_0x61cd('0x9')](_0x61cd('0xf'),auth['isAuthenticated'](),controller['getActions']);router[_0x61cd('0x10')]('/',auth[_0x61cd('0xa')](),controller[_0x61cd('0x11')]);router[_0x61cd('0x10')](_0x61cd('0xd'),auth['isAuthenticated'](),controller[_0x61cd('0x12')]);router[_0x61cd('0x10')](_0x61cd('0x13'),auth[_0x61cd('0xa')](),controller['addAnyCondition']);router[_0x61cd('0x10')](_0x61cd('0xf'),auth[_0x61cd('0xa')](),controller['addAction']);router[_0x61cd('0x14')](_0x61cd('0xc'),auth[_0x61cd('0xa')](),controller[_0x61cd('0x15')]);router[_0x61cd('0x16')]('/:id',auth[_0x61cd('0xa')](),controller[_0x61cd('0x17')]);module[_0x61cd('0x18')]=router; \ No newline at end of file +var _0xcd67=['./trigger.controller','get','/:id','isAuthenticated','/:id/all_conditions','getAllConditions','/:id/any_conditions','getAnyConditions','/:id/actions','getActions','post','addAllCondition','addAnyCondition','addAction','put','update','destroy','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x1cb10d,_0x144eaa){var _0x555284=function(_0x5cace6){while(--_0x5cace6){_0x1cb10d['push'](_0x1cb10d['shift']());}};_0x555284(++_0x144eaa);}(_0xcd67,0x1a9));var _0x7cd6=function(_0x4a2f2b,_0x44931b){_0x4a2f2b=_0x4a2f2b-0x0;var _0x19db05=_0xcd67[_0x4a2f2b];return _0x19db05;};'use strict';var multer=require(_0x7cd6('0x0'));var util=require('util');var path=require(_0x7cd6('0x1'));var timeout=require(_0x7cd6('0x2'));var express=require(_0x7cd6('0x3'));var router=express['Router']();var auth=require(_0x7cd6('0x4'));var interaction=require(_0x7cd6('0x5'));var config=require(_0x7cd6('0x6'));var controller=require(_0x7cd6('0x7'));router[_0x7cd6('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x7cd6('0x8')](_0x7cd6('0x9'),auth[_0x7cd6('0xa')](),controller['show']);router[_0x7cd6('0x8')](_0x7cd6('0xb'),auth[_0x7cd6('0xa')](),controller[_0x7cd6('0xc')]);router[_0x7cd6('0x8')](_0x7cd6('0xd'),auth[_0x7cd6('0xa')](),controller[_0x7cd6('0xe')]);router[_0x7cd6('0x8')](_0x7cd6('0xf'),auth[_0x7cd6('0xa')](),controller[_0x7cd6('0x10')]);router[_0x7cd6('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0x7cd6('0x11')](_0x7cd6('0xb'),auth[_0x7cd6('0xa')](),controller[_0x7cd6('0x12')]);router[_0x7cd6('0x11')](_0x7cd6('0xd'),auth[_0x7cd6('0xa')](),controller[_0x7cd6('0x13')]);router[_0x7cd6('0x11')]('/:id/actions',auth['isAuthenticated'](),controller[_0x7cd6('0x14')]);router[_0x7cd6('0x15')](_0x7cd6('0x9'),auth[_0x7cd6('0xa')](),controller[_0x7cd6('0x16')]);router['delete'](_0x7cd6('0x9'),auth[_0x7cd6('0xa')](),controller[_0x7cd6('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 679546c..2e0eee2 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 _0xa5a5=['STRING','sequelize','exports'];(function(_0x2d0e10,_0x2d8d4c){var _0x2a7d57=function(_0x4814f8){while(--_0x4814f8){_0x2d0e10['push'](_0x2d0e10['shift']());}};_0x2a7d57(++_0x2d8d4c);}(_0xa5a5,0x15d));var _0x5a5a=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xa5a5[_0x4b369d];return _0x571a98;};'use strict';var Sequelize=require(_0x5a5a('0x0'));module[_0x5a5a('0x1')]={'name':{'type':Sequelize[_0x5a5a('0x2')]},'channel':{'type':Sequelize[_0x5a5a('0x2')]},'description':{'type':Sequelize[_0x5a5a('0x2')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x1a44=['sequelize','exports','STRING'];(function(_0x54fba3,_0x3f0ba0){var _0x1e040b=function(_0x2394fd){while(--_0x2394fd){_0x54fba3['push'](_0x54fba3['shift']());}};_0x1e040b(++_0x3f0ba0);}(_0x1a44,0x1f2));var _0x41a4=function(_0x309611,_0x2a96c4){_0x309611=_0x309611-0x0;var _0x5b61ef=_0x1a44[_0x309611];return _0x5b61ef;};'use strict';var Sequelize=require(_0x41a4('0x0'));module[_0x41a4('0x1')]={'name':{'type':Sequelize[_0x41a4('0x2')]},'channel':{'type':Sequelize[_0x41a4('0x2')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index 90477b0..79c883e 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 _0xcd05=['Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','TriggerAllId','Condition','TriggerAnyId','getAllConditions','findOne','getAnyConditions','TriggerId','Action','getActions','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','ejs','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','end','status','json','count','offset','Content-Range','apply','reject','save','then','destroy','get','Triggers','sendStatus','error','stack','name','send','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','Trigger','includeAll','include','findAll','rows','catch','params','find','create','user'];(function(_0x5cc8b9,_0x20e3c3){var _0x58892e=function(_0x87457a){while(--_0x87457a){_0x5cc8b9['push'](_0x5cc8b9['shift']());}};_0x58892e(++_0x20e3c3);}(_0xcd05,0x1e3));var _0x5cd0=function(_0x4704dc,_0x575a5f){_0x4704dc=_0x4704dc-0x0;var _0x254d81=_0xcd05[_0x4704dc];return _0x254d81;};'use strict';var pdf=require(_0x5cd0('0x0'));var emlformat=require(_0x5cd0('0x1'));var rimraf=require(_0x5cd0('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5cd0('0x3'));var rp=require(_0x5cd0('0x4'));var moment=require('moment');var BPromise=require(_0x5cd0('0x5'));var Mustache=require(_0x5cd0('0x6'));var util=require(_0x5cd0('0x7'));var path=require(_0x5cd0('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x5cd0('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x5cd0('0xa'));var jsforce=require(_0x5cd0('0xb'));var deskjs=require(_0x5cd0('0xc'));var toCsv=require(_0x5cd0('0xd'));var querystring=require(_0x5cd0('0xe'));var Papa=require(_0x5cd0('0xf'));var Redis=require(_0x5cd0('0x10'));var authService=require(_0x5cd0('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x5cd0('0x12'));var hardwareService=require(_0x5cd0('0x13'));var logger=require(_0x5cd0('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x5cd0('0x15'));var db=require(_0x5cd0('0x16'))['db'];function respondWithStatusCode(_0x2f65a7,_0x3bf5ce){_0x3bf5ce=_0x3bf5ce||0xcc;return function(_0x58b8cb){if(_0x58b8cb){return _0x2f65a7['sendStatus'](_0x3bf5ce);}return _0x2f65a7['status'](_0x3bf5ce)[_0x5cd0('0x17')]();};}function respondWithResult(_0x5d316c,_0x2cc8f6){_0x2cc8f6=_0x2cc8f6||0xc8;return function(_0x50bfa2){if(_0x50bfa2){return _0x5d316c[_0x5cd0('0x18')](_0x2cc8f6)[_0x5cd0('0x19')](_0x50bfa2);}};}function respondWithFilteredResult(_0x1373a1,_0x51db23){return function(_0xcbd137){if(_0xcbd137){var _0x3c9aee=_0xcbd137[_0x5cd0('0x1a')],_0x39f328=_0x51db23[_0x5cd0('0x1b')],_0x409a6b=_0x51db23[_0x5cd0('0x1b')]+_0x51db23['limit'],_0x29d271;if(_0x409a6b>=_0x3c9aee){_0x409a6b=_0x3c9aee;_0x29d271=0xc8;}else{_0x29d271=0xce;}_0x1373a1[_0x5cd0('0x18')](_0x29d271);return _0x1373a1['set'](_0x5cd0('0x1c'),_0x39f328+'-'+_0x409a6b+'/'+_0x3c9aee)[_0x5cd0('0x19')](_0xcbd137);}return null;};}function patchUpdates(_0x2b794c){return function(_0x545902){try{jsonpatch[_0x5cd0('0x1d')](_0x545902,_0x2b794c,!![]);}catch(_0x10f31e){return BPromise[_0x5cd0('0x1e')](_0x10f31e);}return _0x545902[_0x5cd0('0x1f')]();};}function saveUpdates(_0x4ab63e,_0x1b120b){return function(_0x3f4c88){if(_0x3f4c88){return _0x3f4c88['update'](_0x4ab63e)[_0x5cd0('0x20')](function(_0x492b52){return _0x492b52;});}return null;};}function removeEntity(_0x569060,_0x5988cb){return function(_0x5391f9){if(_0x5391f9){return _0x5391f9[_0x5cd0('0x21')]()[_0x5cd0('0x20')](function(){var _0x16c947=_0x5391f9[_0x5cd0('0x22')]({'plain':!![]});var _0x2f435f=_0x5cd0('0x23');return db['UserProfileResource'][_0x5cd0('0x21')]({'where':{'type':_0x2f435f,'resourceId':_0x16c947['id']}})[_0x5cd0('0x20')](function(){return _0x5391f9;});})[_0x5cd0('0x20')](function(){_0x569060['status'](0xcc)[_0x5cd0('0x17')]();});}};}function handleEntityNotFound(_0x4589b7,_0x1c970f){return function(_0x2843db){if(!_0x2843db){_0x4589b7[_0x5cd0('0x24')](0x194);}return _0x2843db;};}function handleError(_0x5da9c1,_0x134c5f){_0x134c5f=_0x134c5f||0x1f4;return function(_0x2914af){logger[_0x5cd0('0x25')](_0x2914af[_0x5cd0('0x26')]);if(_0x2914af['name']){delete _0x2914af[_0x5cd0('0x27')];}_0x5da9c1[_0x5cd0('0x18')](_0x134c5f)[_0x5cd0('0x28')](_0x2914af);};}exports['index']=function(_0x2def5a,_0x26f0bc){var _0x5a222c={},_0x5ef188={},_0xd4bcf={'count':0x0,'rows':[]};var _0x3cdf03=_['map'](db['Trigger'][_0x5cd0('0x29')],function(_0x4a1b59){return{'name':_0x4a1b59[_0x5cd0('0x2a')],'type':_0x4a1b59[_0x5cd0('0x2b')][_0x5cd0('0x2c')]};});_0x5ef188['model']=_[_0x5cd0('0x2d')](_0x3cdf03,_0x5cd0('0x27'));_0x5ef188[_0x5cd0('0x2e')]=_[_0x5cd0('0x2f')](_0x2def5a['query']);_0x5ef188[_0x5cd0('0x30')]=_[_0x5cd0('0x31')](_0x5ef188[_0x5cd0('0x32')],_0x5ef188[_0x5cd0('0x2e')]);_0x5a222c[_0x5cd0('0x33')]=_[_0x5cd0('0x31')](_0x5ef188[_0x5cd0('0x32')],qs[_0x5cd0('0x34')](_0x2def5a[_0x5cd0('0x2e')][_0x5cd0('0x34')]));_0x5a222c[_0x5cd0('0x33')]=_0x5a222c['attributes'][_0x5cd0('0x35')]?_0x5a222c[_0x5cd0('0x33')]:_0x5ef188[_0x5cd0('0x32')];if(!_0x2def5a[_0x5cd0('0x2e')][_0x5cd0('0x36')](_0x5cd0('0x37'))){_0x5a222c[_0x5cd0('0x38')]=qs[_0x5cd0('0x38')](_0x2def5a[_0x5cd0('0x2e')]['limit']);_0x5a222c[_0x5cd0('0x1b')]=qs['offset'](_0x2def5a[_0x5cd0('0x2e')][_0x5cd0('0x1b')]);}_0x5a222c[_0x5cd0('0x39')]=qs[_0x5cd0('0x3a')](_0x2def5a[_0x5cd0('0x2e')][_0x5cd0('0x3a')]);_0x5a222c[_0x5cd0('0x3b')]=qs[_0x5cd0('0x30')](_[_0x5cd0('0x3c')](_0x2def5a[_0x5cd0('0x2e')],_0x5ef188[_0x5cd0('0x30')]),_0x3cdf03);if(_0x2def5a['query'][_0x5cd0('0x3d')]){_0x5a222c[_0x5cd0('0x3b')]=_[_0x5cd0('0x3e')](_0x5a222c[_0x5cd0('0x3b')],{'$or':_[_0x5cd0('0x2d')](_0x3cdf03,function(_0x38bcb8){if(_0x38bcb8[_0x5cd0('0x2b')]!==_0x5cd0('0x3f')){var _0x56baaa={};_0x56baaa[_0x38bcb8['name']]={'$like':'%'+_0x2def5a[_0x5cd0('0x2e')][_0x5cd0('0x3d')]+'%'};return _0x56baaa;}})});}_0x5a222c=_['merge']({},_0x5a222c,_0x2def5a[_0x5cd0('0x40')]);var _0x3a1302={'where':_0x5a222c['where']};return db[_0x5cd0('0x41')][_0x5cd0('0x1a')](_0x3a1302)['then'](function(_0x578d45){_0xd4bcf[_0x5cd0('0x1a')]=_0x578d45;if(_0x2def5a[_0x5cd0('0x2e')][_0x5cd0('0x42')]){_0x5a222c[_0x5cd0('0x43')]=[{'all':!![]}];}return db[_0x5cd0('0x41')][_0x5cd0('0x44')](_0x5a222c);})[_0x5cd0('0x20')](function(_0x583a6e){_0xd4bcf[_0x5cd0('0x45')]=_0x583a6e;return _0xd4bcf;})[_0x5cd0('0x20')](respondWithFilteredResult(_0x26f0bc,_0x5a222c))[_0x5cd0('0x46')](handleError(_0x26f0bc,null));};exports['show']=function(_0xfc605f,_0x18acea){var _0x2a4bd4={'raw':![],'where':{'id':_0xfc605f[_0x5cd0('0x47')]['id']}},_0xe5f582={};_0xe5f582[_0x5cd0('0x32')]=_[_0x5cd0('0x2f')](db[_0x5cd0('0x41')][_0x5cd0('0x29')]);_0xe5f582[_0x5cd0('0x2e')]=_[_0x5cd0('0x2f')](_0xfc605f['query']);_0xe5f582['filters']=_['intersection'](_0xe5f582[_0x5cd0('0x32')],_0xe5f582['query']);_0x2a4bd4[_0x5cd0('0x33')]=_['intersection'](_0xe5f582[_0x5cd0('0x32')],qs[_0x5cd0('0x34')](_0xfc605f[_0x5cd0('0x2e')][_0x5cd0('0x34')]));_0x2a4bd4[_0x5cd0('0x33')]=_0x2a4bd4[_0x5cd0('0x33')][_0x5cd0('0x35')]?_0x2a4bd4[_0x5cd0('0x33')]:_0xe5f582[_0x5cd0('0x32')];if(_0xfc605f[_0x5cd0('0x2e')][_0x5cd0('0x42')]){_0x2a4bd4[_0x5cd0('0x43')]=[{'all':!![]}];}_0x2a4bd4=_[_0x5cd0('0x3e')]({},_0x2a4bd4,_0xfc605f[_0x5cd0('0x40')]);return db[_0x5cd0('0x41')][_0x5cd0('0x48')](_0x2a4bd4)[_0x5cd0('0x20')](handleEntityNotFound(_0x18acea,null))[_0x5cd0('0x20')](respondWithResult(_0x18acea,null))[_0x5cd0('0x46')](handleError(_0x18acea,null));};exports[_0x5cd0('0x49')]=function(_0x569ba3,_0x5a3ef8){return db['Trigger'][_0x5cd0('0x49')](_0x569ba3['body'],{})[_0x5cd0('0x20')](function(_0x1a1478){var _0x2fa7c8=_0x569ba3[_0x5cd0('0x4a')][_0x5cd0('0x22')]({'plain':!![]});if(!_0x2fa7c8)throw new Error(_0x5cd0('0x4b'));if(_0x2fa7c8[_0x5cd0('0x4c')]===_0x5cd0('0x4a')){var _0xe9bcd3=_0x1a1478[_0x5cd0('0x22')]({'plain':!![]});var _0xa839a9=_0x5cd0('0x23');return db[_0x5cd0('0x4d')][_0x5cd0('0x48')]({'where':{'name':_0xa839a9,'userProfileId':_0x2fa7c8[_0x5cd0('0x4e')]},'raw':!![]})['then'](function(_0x580d08){if(_0x580d08&&_0x580d08[_0x5cd0('0x4f')]===0x0){return db[_0x5cd0('0x50')][_0x5cd0('0x49')]({'name':_0xe9bcd3[_0x5cd0('0x27')],'resourceId':_0xe9bcd3['id'],'type':_0x580d08[_0x5cd0('0x27')],'sectionId':_0x580d08['id']},{})['then'](function(){return _0x1a1478;});}else{return _0x1a1478;}})[_0x5cd0('0x46')](function(_0x3259ff){logger[_0x5cd0('0x25')](_0x5cd0('0x51'),_0x3259ff);throw _0x3259ff;});}return _0x1a1478;})[_0x5cd0('0x20')](respondWithResult(_0x5a3ef8,0xc9))['catch'](handleError(_0x5a3ef8,null));};exports[_0x5cd0('0x52')]=function(_0x42af80,_0x3abddd){if(_0x42af80[_0x5cd0('0x53')]['id']){delete _0x42af80[_0x5cd0('0x53')]['id'];}return db[_0x5cd0('0x41')][_0x5cd0('0x48')]({'where':{'id':_0x42af80[_0x5cd0('0x47')]['id']}})[_0x5cd0('0x20')](handleEntityNotFound(_0x3abddd,null))['then'](saveUpdates(_0x42af80['body'],null))['then'](respondWithResult(_0x3abddd,null))[_0x5cd0('0x46')](handleError(_0x3abddd,null));};exports[_0x5cd0('0x21')]=function(_0x3fa260,_0xa8af9c){return db[_0x5cd0('0x41')]['find']({'where':{'id':_0x3fa260['params']['id']}})['then'](handleEntityNotFound(_0xa8af9c,null))[_0x5cd0('0x20')](removeEntity(_0xa8af9c,null))['catch'](handleError(_0xa8af9c,null));};exports['addAllCondition']=function(_0x39a23c,_0x44ac1a,_0xc3cf8a){if(_0x39a23c[_0x5cd0('0x53')]['id']){delete _0x39a23c[_0x5cd0('0x53')]['id'];}return db[_0x5cd0('0x41')][_0x5cd0('0x48')]({'where':{'id':_0x39a23c[_0x5cd0('0x47')]['id']}})[_0x5cd0('0x20')](handleEntityNotFound(_0x44ac1a,null))[_0x5cd0('0x20')](function(_0x1cf5a5){if(_0x1cf5a5){_0x39a23c[_0x5cd0('0x53')][_0x5cd0('0x54')]=_0x1cf5a5['id'];return db[_0x5cd0('0x55')][_0x5cd0('0x49')](_0x39a23c[_0x5cd0('0x53')]);}})[_0x5cd0('0x20')](respondWithResult(_0x44ac1a,null))['catch'](handleError(_0x44ac1a,null));};exports['addAnyCondition']=function(_0x52b669,_0x314498,_0x288f39){if(_0x52b669[_0x5cd0('0x53')]['id']){delete _0x52b669[_0x5cd0('0x53')]['id'];}return db[_0x5cd0('0x41')][_0x5cd0('0x48')]({'where':{'id':_0x52b669['params']['id']}})[_0x5cd0('0x20')](handleEntityNotFound(_0x314498,null))[_0x5cd0('0x20')](function(_0x408c18){if(_0x408c18){_0x52b669[_0x5cd0('0x53')][_0x5cd0('0x56')]=_0x408c18['id'];return db[_0x5cd0('0x55')][_0x5cd0('0x49')](_0x52b669['body']);}})[_0x5cd0('0x20')](respondWithResult(_0x314498,null))[_0x5cd0('0x46')](handleError(_0x314498,null));};exports[_0x5cd0('0x57')]=function(_0x4823fd,_0xcef18f,_0x2b59c1){var _0x2be45e={};var _0x452ddc={};var _0x2bb944;var _0x1521f0;return db[_0x5cd0('0x41')][_0x5cd0('0x58')]({'where':{'id':_0x4823fd[_0x5cd0('0x47')]['id']}})[_0x5cd0('0x20')](handleEntityNotFound(_0xcef18f,null))[_0x5cd0('0x20')](function(_0x18d6fd){if(_0x18d6fd){_0x2bb944=_0x18d6fd;_0x452ddc['model']=_[_0x5cd0('0x2f')](db[_0x5cd0('0x55')]['rawAttributes']);_0x452ddc['query']=_[_0x5cd0('0x2f')](_0x4823fd['query']);_0x452ddc[_0x5cd0('0x30')]=_[_0x5cd0('0x31')](_0x452ddc[_0x5cd0('0x32')],_0x452ddc[_0x5cd0('0x2e')]);_0x2be45e[_0x5cd0('0x33')]=_[_0x5cd0('0x31')](_0x452ddc[_0x5cd0('0x32')],qs[_0x5cd0('0x34')](_0x4823fd[_0x5cd0('0x2e')][_0x5cd0('0x34')]));_0x2be45e[_0x5cd0('0x33')]=_0x2be45e[_0x5cd0('0x33')][_0x5cd0('0x35')]?_0x2be45e[_0x5cd0('0x33')]:_0x452ddc[_0x5cd0('0x32')];_0x2be45e[_0x5cd0('0x39')]=qs[_0x5cd0('0x3a')](_0x4823fd['query'][_0x5cd0('0x3a')]);_0x2be45e[_0x5cd0('0x3b')]=qs[_0x5cd0('0x30')](_[_0x5cd0('0x3c')](_0x4823fd[_0x5cd0('0x2e')],_0x452ddc[_0x5cd0('0x30')]));if(_0x4823fd[_0x5cd0('0x2e')][_0x5cd0('0x3d')]){_0x2be45e[_0x5cd0('0x3b')]=_['merge'](_0x2be45e['where'],{'$or':_[_0x5cd0('0x2d')](_0x2be45e[_0x5cd0('0x33')],function(_0x292636){var _0x268574={};_0x268574[_0x292636]={'$like':'%'+_0x4823fd[_0x5cd0('0x2e')][_0x5cd0('0x3d')]+'%'};return _0x268574;})});}_0x2be45e=_['merge']({},_0x2be45e,_0x4823fd['options']);return _0x2bb944['getAllConditions'](_0x2be45e);}})[_0x5cd0('0x20')](function(_0x4a0fa5){if(_0x4a0fa5){_0x1521f0=_0x4a0fa5[_0x5cd0('0x35')];if(!_0x4823fd[_0x5cd0('0x2e')][_0x5cd0('0x36')](_0x5cd0('0x37'))){_0x2be45e['limit']=qs[_0x5cd0('0x38')](_0x4823fd['query'][_0x5cd0('0x38')]);_0x2be45e[_0x5cd0('0x1b')]=qs['offset'](_0x4823fd[_0x5cd0('0x2e')][_0x5cd0('0x1b')]);}return _0x2bb944[_0x5cd0('0x57')](_0x2be45e);}})[_0x5cd0('0x20')](function(_0x58bccf){if(_0x58bccf){return _0x58bccf?{'count':_0x1521f0,'rows':_0x58bccf}:null;}})[_0x5cd0('0x20')](respondWithResult(_0xcef18f,null))[_0x5cd0('0x46')](handleError(_0xcef18f,null));};exports[_0x5cd0('0x59')]=function(_0x15cce6,_0x1ed97d,_0x582ec7){var _0x42bd13={};var _0x5d686c={};var _0x796444;var _0x111912;return db[_0x5cd0('0x41')][_0x5cd0('0x58')]({'where':{'id':_0x15cce6[_0x5cd0('0x47')]['id']}})['then'](handleEntityNotFound(_0x1ed97d,null))[_0x5cd0('0x20')](function(_0xdad924){if(_0xdad924){_0x796444=_0xdad924;_0x5d686c['model']=_['keys'](db['Condition'][_0x5cd0('0x29')]);_0x5d686c[_0x5cd0('0x2e')]=_[_0x5cd0('0x2f')](_0x15cce6[_0x5cd0('0x2e')]);_0x5d686c['filters']=_[_0x5cd0('0x31')](_0x5d686c[_0x5cd0('0x32')],_0x5d686c['query']);_0x42bd13[_0x5cd0('0x33')]=_[_0x5cd0('0x31')](_0x5d686c[_0x5cd0('0x32')],qs[_0x5cd0('0x34')](_0x15cce6[_0x5cd0('0x2e')][_0x5cd0('0x34')]));_0x42bd13['attributes']=_0x42bd13[_0x5cd0('0x33')][_0x5cd0('0x35')]?_0x42bd13[_0x5cd0('0x33')]:_0x5d686c[_0x5cd0('0x32')];_0x42bd13[_0x5cd0('0x39')]=qs[_0x5cd0('0x3a')](_0x15cce6[_0x5cd0('0x2e')][_0x5cd0('0x3a')]);_0x42bd13['where']=qs[_0x5cd0('0x30')](_[_0x5cd0('0x3c')](_0x15cce6[_0x5cd0('0x2e')],_0x5d686c[_0x5cd0('0x30')]));if(_0x15cce6[_0x5cd0('0x2e')]['filter']){_0x42bd13[_0x5cd0('0x3b')]=_[_0x5cd0('0x3e')](_0x42bd13[_0x5cd0('0x3b')],{'$or':_[_0x5cd0('0x2d')](_0x42bd13['attributes'],function(_0xd6f887){var _0x1b4362={};_0x1b4362[_0xd6f887]={'$like':'%'+_0x15cce6[_0x5cd0('0x2e')][_0x5cd0('0x3d')]+'%'};return _0x1b4362;})});}_0x42bd13=_['merge']({},_0x42bd13,_0x15cce6[_0x5cd0('0x40')]);return _0x796444[_0x5cd0('0x59')](_0x42bd13);}})[_0x5cd0('0x20')](function(_0x9aa29){if(_0x9aa29){_0x111912=_0x9aa29['length'];if(!_0x15cce6['query'][_0x5cd0('0x36')](_0x5cd0('0x37'))){_0x42bd13[_0x5cd0('0x38')]=qs[_0x5cd0('0x38')](_0x15cce6[_0x5cd0('0x2e')][_0x5cd0('0x38')]);_0x42bd13[_0x5cd0('0x1b')]=qs['offset'](_0x15cce6[_0x5cd0('0x2e')][_0x5cd0('0x1b')]);}return _0x796444[_0x5cd0('0x59')](_0x42bd13);}})['then'](function(_0x4ce282){if(_0x4ce282){return _0x4ce282?{'count':_0x111912,'rows':_0x4ce282}:null;}})[_0x5cd0('0x20')](respondWithResult(_0x1ed97d,null))[_0x5cd0('0x46')](handleError(_0x1ed97d,null));};exports['addAction']=function(_0x4146a1,_0x19601d,_0x37b8c5){if(_0x4146a1[_0x5cd0('0x53')]['id']){delete _0x4146a1[_0x5cd0('0x53')]['id'];}return db['Trigger'][_0x5cd0('0x48')]({'where':{'id':_0x4146a1['params']['id']}})[_0x5cd0('0x20')](handleEntityNotFound(_0x19601d,null))['then'](function(_0x5cabbf){if(_0x5cabbf){_0x4146a1[_0x5cd0('0x53')][_0x5cd0('0x5a')]=_0x5cabbf['id'];return db['Action'][_0x5cd0('0x49')](_0x4146a1[_0x5cd0('0x53')]);}})[_0x5cd0('0x20')](respondWithResult(_0x19601d,null))[_0x5cd0('0x46')](handleError(_0x19601d,null));};exports['getActions']=function(_0x61a9cd,_0x29d6fa,_0x4a3dc6){var _0x5b5c41={};var _0x22e7c8={};var _0x1e4947;var _0x21fb48;return db[_0x5cd0('0x41')][_0x5cd0('0x58')]({'where':{'id':_0x61a9cd['params']['id']}})[_0x5cd0('0x20')](handleEntityNotFound(_0x29d6fa,null))[_0x5cd0('0x20')](function(_0x311054){if(_0x311054){_0x1e4947=_0x311054;_0x22e7c8['model']=_[_0x5cd0('0x2f')](db[_0x5cd0('0x5b')][_0x5cd0('0x29')]);_0x22e7c8[_0x5cd0('0x2e')]=_['keys'](_0x61a9cd[_0x5cd0('0x2e')]);_0x22e7c8[_0x5cd0('0x30')]=_[_0x5cd0('0x31')](_0x22e7c8['model'],_0x22e7c8[_0x5cd0('0x2e')]);_0x5b5c41[_0x5cd0('0x33')]=_[_0x5cd0('0x31')](_0x22e7c8[_0x5cd0('0x32')],qs[_0x5cd0('0x34')](_0x61a9cd[_0x5cd0('0x2e')][_0x5cd0('0x34')]));_0x5b5c41[_0x5cd0('0x33')]=_0x5b5c41[_0x5cd0('0x33')][_0x5cd0('0x35')]?_0x5b5c41[_0x5cd0('0x33')]:_0x22e7c8[_0x5cd0('0x32')];_0x5b5c41['order']=qs[_0x5cd0('0x3a')](_0x61a9cd[_0x5cd0('0x2e')]['sort']);_0x5b5c41['where']=qs[_0x5cd0('0x30')](_['pick'](_0x61a9cd[_0x5cd0('0x2e')],_0x22e7c8[_0x5cd0('0x30')]));if(_0x61a9cd[_0x5cd0('0x2e')][_0x5cd0('0x3d')]){_0x5b5c41[_0x5cd0('0x3b')]=_[_0x5cd0('0x3e')](_0x5b5c41['where'],{'$or':_['map'](_0x5b5c41[_0x5cd0('0x33')],function(_0x2d569b){var _0x281238={};_0x281238[_0x2d569b]={'$like':'%'+_0x61a9cd['query']['filter']+'%'};return _0x281238;})});}_0x5b5c41=_[_0x5cd0('0x3e')]({},_0x5b5c41,_0x61a9cd[_0x5cd0('0x40')]);return _0x1e4947[_0x5cd0('0x5c')](_0x5b5c41);}})[_0x5cd0('0x20')](function(_0x7d45f0){if(_0x7d45f0){_0x21fb48=_0x7d45f0[_0x5cd0('0x35')];if(!_0x61a9cd[_0x5cd0('0x2e')][_0x5cd0('0x36')](_0x5cd0('0x37'))){_0x5b5c41[_0x5cd0('0x38')]=qs['limit'](_0x61a9cd[_0x5cd0('0x2e')][_0x5cd0('0x38')]);_0x5b5c41['offset']=qs['offset'](_0x61a9cd['query'][_0x5cd0('0x1b')]);}return _0x1e4947['getActions'](_0x5b5c41);}})[_0x5cd0('0x20')](function(_0x4ed874){if(_0x4ed874){return _0x4ed874?{'count':_0x21fb48,'rows':_0x4ed874}:null;}})[_0x5cd0('0x20')](respondWithResult(_0x29d6fa,null))[_0x5cd0('0x46')](handleError(_0x29d6fa,null));}; \ No newline at end of file +var _0x9464=['fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','pick','filter','where','merge','VIRTUAL','options','count','includeAll','include','rows','catch','show','params','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Triggers','UserProfileSection','find','userProfileId','autoAssociation','body','addAllCondition','TriggerAllId','Condition','TriggerAnyId','getAllConditions','findOne','getAnyConditions','order','Action','getActions','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','sendStatus','status','end','offset','limit','Content-Range','json','apply','reject','save','update','destroy','then','get','UserProfileResource','error','name','send','index','map','Trigger','rawAttributes'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0x9464,0x89));var _0x4946=function(_0x13b7fd,_0x4eaf7f){_0x13b7fd=_0x13b7fd-0x0;var _0x32a74a=_0x9464[_0x13b7fd];return _0x32a74a;};'use strict';var pdf=require(_0x4946('0x0'));var emlformat=require(_0x4946('0x1'));var rimraf=require(_0x4946('0x2'));var zipdir=require(_0x4946('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4946('0x4'));var moment=require('moment');var BPromise=require(_0x4946('0x5'));var Mustache=require(_0x4946('0x6'));var util=require(_0x4946('0x7'));var path=require(_0x4946('0x8'));var sox=require(_0x4946('0x9'));var csv=require(_0x4946('0xa'));var ejs=require(_0x4946('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x4946('0xc'));var crypto=require(_0x4946('0xd'));var jsforce=require(_0x4946('0xe'));var deskjs=require(_0x4946('0xf'));var toCsv=require(_0x4946('0xa'));var querystring=require(_0x4946('0x10'));var Papa=require(_0x4946('0x11'));var Redis=require(_0x4946('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x4946('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4946('0x14'));var logger=require('../../config/logger')(_0x4946('0x15'));var utils=require('../../config/utils');var config=require(_0x4946('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x360d70,_0x1abffd){_0x1abffd=_0x1abffd||0xcc;return function(_0x5095d8){if(_0x5095d8){return _0x360d70[_0x4946('0x17')](_0x1abffd);}return _0x360d70[_0x4946('0x18')](_0x1abffd)[_0x4946('0x19')]();};}function respondWithResult(_0x5db933,_0x4d44d1){_0x4d44d1=_0x4d44d1||0xc8;return function(_0x59bdb4){if(_0x59bdb4){return _0x5db933[_0x4946('0x18')](_0x4d44d1)['json'](_0x59bdb4);}};}function respondWithFilteredResult(_0x1ecd19,_0x469c51){return function(_0x4942df){if(_0x4942df){var _0x1a7145=_0x4942df['count'],_0x2b8db8=_0x469c51[_0x4946('0x1a')],_0x74e0b1=_0x469c51[_0x4946('0x1a')]+_0x469c51[_0x4946('0x1b')],_0xcb3b08;if(_0x74e0b1>=_0x1a7145){_0x74e0b1=_0x1a7145;_0xcb3b08=0xc8;}else{_0xcb3b08=0xce;}_0x1ecd19['status'](_0xcb3b08);return _0x1ecd19['set'](_0x4946('0x1c'),_0x2b8db8+'-'+_0x74e0b1+'/'+_0x1a7145)[_0x4946('0x1d')](_0x4942df);}return null;};}function patchUpdates(_0x418fc7){return function(_0x1b3661){try{jsonpatch[_0x4946('0x1e')](_0x1b3661,_0x418fc7,!![]);}catch(_0x506a89){return BPromise[_0x4946('0x1f')](_0x506a89);}return _0x1b3661[_0x4946('0x20')]();};}function saveUpdates(_0x2af327,_0x40f3a0){return function(_0x336ae5){if(_0x336ae5){return _0x336ae5[_0x4946('0x21')](_0x2af327)['then'](function(_0x10a63a){return _0x10a63a;});}return null;};}function removeEntity(_0xa04647,_0x7b049){return function(_0x5736a6){if(_0x5736a6){return _0x5736a6[_0x4946('0x22')]()[_0x4946('0x23')](function(){var _0x765c05=_0x5736a6[_0x4946('0x24')]({'plain':!![]});var _0x27eafa='Triggers';return db[_0x4946('0x25')]['destroy']({'where':{'type':_0x27eafa,'resourceId':_0x765c05['id']}})[_0x4946('0x23')](function(){return _0x5736a6;});})[_0x4946('0x23')](function(){_0xa04647[_0x4946('0x18')](0xcc)[_0x4946('0x19')]();});}};}function handleEntityNotFound(_0x21865a,_0x3dede7){return function(_0x70ca26){if(!_0x70ca26){_0x21865a[_0x4946('0x17')](0x194);}return _0x70ca26;};}function handleError(_0x3e52df,_0x3cb4e8){_0x3cb4e8=_0x3cb4e8||0x1f4;return function(_0xf8d88a){logger[_0x4946('0x26')](_0xf8d88a['stack']);if(_0xf8d88a[_0x4946('0x27')]){delete _0xf8d88a[_0x4946('0x27')];}_0x3e52df[_0x4946('0x18')](_0x3cb4e8)[_0x4946('0x28')](_0xf8d88a);};}exports[_0x4946('0x29')]=function(_0x1786e6,_0xdf4169){var _0x507f60={},_0xfb0833={},_0x3c0d04={'count':0x0,'rows':[]};var _0xbf72ff=_[_0x4946('0x2a')](db[_0x4946('0x2b')][_0x4946('0x2c')],function(_0x645c38){return{'name':_0x645c38[_0x4946('0x2d')],'type':_0x645c38[_0x4946('0x2e')]['key']};});_0xfb0833[_0x4946('0x2f')]=_[_0x4946('0x2a')](_0xbf72ff,_0x4946('0x27'));_0xfb0833[_0x4946('0x30')]=_[_0x4946('0x31')](_0x1786e6[_0x4946('0x30')]);_0xfb0833['filters']=_[_0x4946('0x32')](_0xfb0833[_0x4946('0x2f')],_0xfb0833[_0x4946('0x30')]);_0x507f60[_0x4946('0x33')]=_[_0x4946('0x32')](_0xfb0833[_0x4946('0x2f')],qs[_0x4946('0x34')](_0x1786e6[_0x4946('0x30')]['fields']));_0x507f60[_0x4946('0x33')]=_0x507f60[_0x4946('0x33')][_0x4946('0x35')]?_0x507f60[_0x4946('0x33')]:_0xfb0833[_0x4946('0x2f')];if(!_0x1786e6[_0x4946('0x30')][_0x4946('0x36')](_0x4946('0x37'))){_0x507f60['limit']=qs[_0x4946('0x1b')](_0x1786e6['query'][_0x4946('0x1b')]);_0x507f60[_0x4946('0x1a')]=qs[_0x4946('0x1a')](_0x1786e6[_0x4946('0x30')]['offset']);}_0x507f60['order']=qs[_0x4946('0x38')](_0x1786e6['query'][_0x4946('0x38')]);_0x507f60['where']=qs[_0x4946('0x39')](_[_0x4946('0x3a')](_0x1786e6[_0x4946('0x30')],_0xfb0833[_0x4946('0x39')]),_0xbf72ff);if(_0x1786e6[_0x4946('0x30')][_0x4946('0x3b')]){_0x507f60[_0x4946('0x3c')]=_[_0x4946('0x3d')](_0x507f60['where'],{'$or':_[_0x4946('0x2a')](_0xbf72ff,function(_0x3075f1){if(_0x3075f1[_0x4946('0x2e')]!==_0x4946('0x3e')){var _0x53562b={};_0x53562b[_0x3075f1[_0x4946('0x27')]]={'$like':'%'+_0x1786e6[_0x4946('0x30')][_0x4946('0x3b')]+'%'};return _0x53562b;}})});}_0x507f60=_['merge']({},_0x507f60,_0x1786e6[_0x4946('0x3f')]);var _0x189e8c={'where':_0x507f60[_0x4946('0x3c')]};return db[_0x4946('0x2b')][_0x4946('0x40')](_0x189e8c)[_0x4946('0x23')](function(_0x14f615){_0x3c0d04['count']=_0x14f615;if(_0x1786e6[_0x4946('0x30')][_0x4946('0x41')]){_0x507f60[_0x4946('0x42')]=[{'all':!![]}];}return db['Trigger']['findAll'](_0x507f60);})[_0x4946('0x23')](function(_0x5d5178){_0x3c0d04[_0x4946('0x43')]=_0x5d5178;return _0x3c0d04;})['then'](respondWithFilteredResult(_0xdf4169,_0x507f60))[_0x4946('0x44')](handleError(_0xdf4169,null));};exports[_0x4946('0x45')]=function(_0x53cbfd,_0x5775d3){var _0x3cb192={'raw':![],'where':{'id':_0x53cbfd[_0x4946('0x46')]['id']}},_0x1132cc={};_0x1132cc[_0x4946('0x2f')]=_[_0x4946('0x31')](db[_0x4946('0x2b')]['rawAttributes']);_0x1132cc[_0x4946('0x30')]=_[_0x4946('0x31')](_0x53cbfd[_0x4946('0x30')]);_0x1132cc[_0x4946('0x39')]=_[_0x4946('0x32')](_0x1132cc[_0x4946('0x2f')],_0x1132cc[_0x4946('0x30')]);_0x3cb192[_0x4946('0x33')]=_[_0x4946('0x32')](_0x1132cc[_0x4946('0x2f')],qs[_0x4946('0x34')](_0x53cbfd['query'][_0x4946('0x34')]));_0x3cb192['attributes']=_0x3cb192[_0x4946('0x33')]['length']?_0x3cb192[_0x4946('0x33')]:_0x1132cc[_0x4946('0x2f')];if(_0x53cbfd['query'][_0x4946('0x41')]){_0x3cb192[_0x4946('0x42')]=[{'all':!![]}];}_0x3cb192=_[_0x4946('0x3d')]({},_0x3cb192,_0x53cbfd[_0x4946('0x3f')]);return db[_0x4946('0x2b')]['find'](_0x3cb192)[_0x4946('0x23')](handleEntityNotFound(_0x5775d3,null))[_0x4946('0x23')](respondWithResult(_0x5775d3,null))['catch'](handleError(_0x5775d3,null));};exports[_0x4946('0x47')]=function(_0x32a2e9,_0x3e97dd){return db['Trigger'][_0x4946('0x47')](_0x32a2e9['body'],{})['then'](function(_0x3fcd83){var _0x405334=_0x32a2e9[_0x4946('0x48')][_0x4946('0x24')]({'plain':!![]});if(!_0x405334)throw new Error(_0x4946('0x49'));if(_0x405334[_0x4946('0x4a')]===_0x4946('0x48')){var _0x356cf3=_0x3fcd83[_0x4946('0x24')]({'plain':!![]});var _0x5203cc=_0x4946('0x4b');return db[_0x4946('0x4c')][_0x4946('0x4d')]({'where':{'name':_0x5203cc,'userProfileId':_0x405334[_0x4946('0x4e')]},'raw':!![]})[_0x4946('0x23')](function(_0x456d35){if(_0x456d35&&_0x456d35[_0x4946('0x4f')]===0x0){return db[_0x4946('0x25')][_0x4946('0x47')]({'name':_0x356cf3['name'],'resourceId':_0x356cf3['id'],'type':_0x456d35[_0x4946('0x27')],'sectionId':_0x456d35['id']},{})[_0x4946('0x23')](function(){return _0x3fcd83;});}else{return _0x3fcd83;}})[_0x4946('0x44')](function(_0x42a602){logger[_0x4946('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x42a602);throw _0x42a602;});}return _0x3fcd83;})[_0x4946('0x23')](respondWithResult(_0x3e97dd,0xc9))['catch'](handleError(_0x3e97dd,null));};exports[_0x4946('0x21')]=function(_0x2f8341,_0x14fb72){if(_0x2f8341[_0x4946('0x50')]['id']){delete _0x2f8341['body']['id'];}return db['Trigger']['find']({'where':{'id':_0x2f8341['params']['id']}})[_0x4946('0x23')](handleEntityNotFound(_0x14fb72,null))['then'](saveUpdates(_0x2f8341['body'],null))[_0x4946('0x23')](respondWithResult(_0x14fb72,null))['catch'](handleError(_0x14fb72,null));};exports[_0x4946('0x22')]=function(_0x141c10,_0x438bac){return db[_0x4946('0x2b')][_0x4946('0x4d')]({'where':{'id':_0x141c10['params']['id']}})['then'](handleEntityNotFound(_0x438bac,null))['then'](removeEntity(_0x438bac,null))[_0x4946('0x44')](handleError(_0x438bac,null));};exports[_0x4946('0x51')]=function(_0x55c05b,_0xb201d4,_0x278022){if(_0x55c05b[_0x4946('0x50')]['id']){delete _0x55c05b[_0x4946('0x50')]['id'];}return db[_0x4946('0x2b')][_0x4946('0x4d')]({'where':{'id':_0x55c05b[_0x4946('0x46')]['id']}})[_0x4946('0x23')](handleEntityNotFound(_0xb201d4,null))['then'](function(_0x25d24e){if(_0x25d24e){_0x55c05b[_0x4946('0x50')][_0x4946('0x52')]=_0x25d24e['id'];return db[_0x4946('0x53')][_0x4946('0x47')](_0x55c05b[_0x4946('0x50')]);}})[_0x4946('0x23')](respondWithResult(_0xb201d4,null))[_0x4946('0x44')](handleError(_0xb201d4,null));};exports['addAnyCondition']=function(_0x1d9ce4,_0x32d764,_0x481fe6){if(_0x1d9ce4[_0x4946('0x50')]['id']){delete _0x1d9ce4[_0x4946('0x50')]['id'];}return db[_0x4946('0x2b')]['find']({'where':{'id':_0x1d9ce4[_0x4946('0x46')]['id']}})[_0x4946('0x23')](handleEntityNotFound(_0x32d764,null))[_0x4946('0x23')](function(_0x18fb07){if(_0x18fb07){_0x1d9ce4[_0x4946('0x50')][_0x4946('0x54')]=_0x18fb07['id'];return db[_0x4946('0x53')]['create'](_0x1d9ce4['body']);}})[_0x4946('0x23')](respondWithResult(_0x32d764,null))[_0x4946('0x44')](handleError(_0x32d764,null));};exports[_0x4946('0x55')]=function(_0x259709,_0x421287,_0x307fe9){var _0x15e3e9={};var _0x244ea1={};var _0x440619;var _0x541d44;return db[_0x4946('0x2b')][_0x4946('0x56')]({'where':{'id':_0x259709[_0x4946('0x46')]['id']}})['then'](handleEntityNotFound(_0x421287,null))['then'](function(_0xbe1807){if(_0xbe1807){_0x440619=_0xbe1807;_0x244ea1[_0x4946('0x2f')]=_[_0x4946('0x31')](db[_0x4946('0x53')]['rawAttributes']);_0x244ea1[_0x4946('0x30')]=_[_0x4946('0x31')](_0x259709[_0x4946('0x30')]);_0x244ea1[_0x4946('0x39')]=_[_0x4946('0x32')](_0x244ea1[_0x4946('0x2f')],_0x244ea1[_0x4946('0x30')]);_0x15e3e9[_0x4946('0x33')]=_[_0x4946('0x32')](_0x244ea1['model'],qs[_0x4946('0x34')](_0x259709[_0x4946('0x30')]['fields']));_0x15e3e9[_0x4946('0x33')]=_0x15e3e9[_0x4946('0x33')][_0x4946('0x35')]?_0x15e3e9[_0x4946('0x33')]:_0x244ea1[_0x4946('0x2f')];_0x15e3e9['order']=qs[_0x4946('0x38')](_0x259709[_0x4946('0x30')]['sort']);_0x15e3e9[_0x4946('0x3c')]=qs[_0x4946('0x39')](_['pick'](_0x259709[_0x4946('0x30')],_0x244ea1[_0x4946('0x39')]));if(_0x259709[_0x4946('0x30')][_0x4946('0x3b')]){_0x15e3e9[_0x4946('0x3c')]=_[_0x4946('0x3d')](_0x15e3e9[_0x4946('0x3c')],{'$or':_[_0x4946('0x2a')](_0x15e3e9[_0x4946('0x33')],function(_0x3a0143){var _0x70decd={};_0x70decd[_0x3a0143]={'$like':'%'+_0x259709[_0x4946('0x30')][_0x4946('0x3b')]+'%'};return _0x70decd;})});}_0x15e3e9=_[_0x4946('0x3d')]({},_0x15e3e9,_0x259709[_0x4946('0x3f')]);return _0x440619[_0x4946('0x55')](_0x15e3e9);}})[_0x4946('0x23')](function(_0x56712a){if(_0x56712a){_0x541d44=_0x56712a[_0x4946('0x35')];if(!_0x259709['query'][_0x4946('0x36')](_0x4946('0x37'))){_0x15e3e9['limit']=qs[_0x4946('0x1b')](_0x259709[_0x4946('0x30')][_0x4946('0x1b')]);_0x15e3e9['offset']=qs[_0x4946('0x1a')](_0x259709[_0x4946('0x30')][_0x4946('0x1a')]);}return _0x440619[_0x4946('0x55')](_0x15e3e9);}})[_0x4946('0x23')](function(_0xaf1ec){if(_0xaf1ec){return _0xaf1ec?{'count':_0x541d44,'rows':_0xaf1ec}:null;}})['then'](respondWithResult(_0x421287,null))[_0x4946('0x44')](handleError(_0x421287,null));};exports[_0x4946('0x57')]=function(_0x16262f,_0xc3f990,_0x10b9f4){var _0x279db2={};var _0x1c0f87={};var _0x26b080;var _0x5c3855;return db[_0x4946('0x2b')]['findOne']({'where':{'id':_0x16262f[_0x4946('0x46')]['id']}})[_0x4946('0x23')](handleEntityNotFound(_0xc3f990,null))[_0x4946('0x23')](function(_0x3c592e){if(_0x3c592e){_0x26b080=_0x3c592e;_0x1c0f87[_0x4946('0x2f')]=_[_0x4946('0x31')](db[_0x4946('0x53')][_0x4946('0x2c')]);_0x1c0f87[_0x4946('0x30')]=_[_0x4946('0x31')](_0x16262f['query']);_0x1c0f87[_0x4946('0x39')]=_[_0x4946('0x32')](_0x1c0f87[_0x4946('0x2f')],_0x1c0f87[_0x4946('0x30')]);_0x279db2[_0x4946('0x33')]=_[_0x4946('0x32')](_0x1c0f87[_0x4946('0x2f')],qs[_0x4946('0x34')](_0x16262f[_0x4946('0x30')][_0x4946('0x34')]));_0x279db2[_0x4946('0x33')]=_0x279db2[_0x4946('0x33')]['length']?_0x279db2['attributes']:_0x1c0f87[_0x4946('0x2f')];_0x279db2[_0x4946('0x58')]=qs['sort'](_0x16262f[_0x4946('0x30')][_0x4946('0x38')]);_0x279db2['where']=qs[_0x4946('0x39')](_['pick'](_0x16262f['query'],_0x1c0f87[_0x4946('0x39')]));if(_0x16262f[_0x4946('0x30')][_0x4946('0x3b')]){_0x279db2[_0x4946('0x3c')]=_[_0x4946('0x3d')](_0x279db2[_0x4946('0x3c')],{'$or':_[_0x4946('0x2a')](_0x279db2[_0x4946('0x33')],function(_0xd2868e){var _0x342bf4={};_0x342bf4[_0xd2868e]={'$like':'%'+_0x16262f[_0x4946('0x30')]['filter']+'%'};return _0x342bf4;})});}_0x279db2=_[_0x4946('0x3d')]({},_0x279db2,_0x16262f['options']);return _0x26b080[_0x4946('0x57')](_0x279db2);}})[_0x4946('0x23')](function(_0x5adf03){if(_0x5adf03){_0x5c3855=_0x5adf03['length'];if(!_0x16262f[_0x4946('0x30')]['hasOwnProperty'](_0x4946('0x37'))){_0x279db2[_0x4946('0x1b')]=qs[_0x4946('0x1b')](_0x16262f['query'][_0x4946('0x1b')]);_0x279db2[_0x4946('0x1a')]=qs['offset'](_0x16262f[_0x4946('0x30')]['offset']);}return _0x26b080[_0x4946('0x57')](_0x279db2);}})[_0x4946('0x23')](function(_0x4f3c89){if(_0x4f3c89){return _0x4f3c89?{'count':_0x5c3855,'rows':_0x4f3c89}:null;}})[_0x4946('0x23')](respondWithResult(_0xc3f990,null))[_0x4946('0x44')](handleError(_0xc3f990,null));};exports['addAction']=function(_0x30cb1c,_0x2e5edb,_0x50c8b7){if(_0x30cb1c[_0x4946('0x50')]['id']){delete _0x30cb1c[_0x4946('0x50')]['id'];}return db[_0x4946('0x2b')][_0x4946('0x4d')]({'where':{'id':_0x30cb1c[_0x4946('0x46')]['id']}})[_0x4946('0x23')](handleEntityNotFound(_0x2e5edb,null))[_0x4946('0x23')](function(_0x5d4925){if(_0x5d4925){_0x30cb1c[_0x4946('0x50')]['TriggerId']=_0x5d4925['id'];return db[_0x4946('0x59')]['create'](_0x30cb1c['body']);}})[_0x4946('0x23')](respondWithResult(_0x2e5edb,null))[_0x4946('0x44')](handleError(_0x2e5edb,null));};exports[_0x4946('0x5a')]=function(_0x404884,_0x516711,_0x2e012a){var _0x36e599={};var _0x3824dc={};var _0x544001;var _0xf23fa3;return db[_0x4946('0x2b')][_0x4946('0x56')]({'where':{'id':_0x404884[_0x4946('0x46')]['id']}})[_0x4946('0x23')](handleEntityNotFound(_0x516711,null))[_0x4946('0x23')](function(_0x2d087c){if(_0x2d087c){_0x544001=_0x2d087c;_0x3824dc[_0x4946('0x2f')]=_['keys'](db[_0x4946('0x59')][_0x4946('0x2c')]);_0x3824dc['query']=_['keys'](_0x404884[_0x4946('0x30')]);_0x3824dc['filters']=_[_0x4946('0x32')](_0x3824dc[_0x4946('0x2f')],_0x3824dc[_0x4946('0x30')]);_0x36e599[_0x4946('0x33')]=_['intersection'](_0x3824dc[_0x4946('0x2f')],qs[_0x4946('0x34')](_0x404884[_0x4946('0x30')][_0x4946('0x34')]));_0x36e599[_0x4946('0x33')]=_0x36e599[_0x4946('0x33')]['length']?_0x36e599[_0x4946('0x33')]:_0x3824dc[_0x4946('0x2f')];_0x36e599[_0x4946('0x58')]=qs[_0x4946('0x38')](_0x404884[_0x4946('0x30')][_0x4946('0x38')]);_0x36e599[_0x4946('0x3c')]=qs[_0x4946('0x39')](_[_0x4946('0x3a')](_0x404884['query'],_0x3824dc[_0x4946('0x39')]));if(_0x404884[_0x4946('0x30')][_0x4946('0x3b')]){_0x36e599[_0x4946('0x3c')]=_[_0x4946('0x3d')](_0x36e599['where'],{'$or':_['map'](_0x36e599['attributes'],function(_0x48ed50){var _0x1aa7ad={};_0x1aa7ad[_0x48ed50]={'$like':'%'+_0x404884['query'][_0x4946('0x3b')]+'%'};return _0x1aa7ad;})});}_0x36e599=_[_0x4946('0x3d')]({},_0x36e599,_0x404884[_0x4946('0x3f')]);return _0x544001['getActions'](_0x36e599);}})[_0x4946('0x23')](function(_0x57fc19){if(_0x57fc19){_0xf23fa3=_0x57fc19['length'];if(!_0x404884[_0x4946('0x30')][_0x4946('0x36')](_0x4946('0x37'))){_0x36e599[_0x4946('0x1b')]=qs[_0x4946('0x1b')](_0x404884['query'][_0x4946('0x1b')]);_0x36e599[_0x4946('0x1a')]=qs[_0x4946('0x1a')](_0x404884[_0x4946('0x30')][_0x4946('0x1a')]);}return _0x544001['getActions'](_0x36e599);}})[_0x4946('0x23')](function(_0x19a0c2){if(_0x19a0c2){return _0x19a0c2?{'count':_0xf23fa3,'rows':_0x19a0c2}:null;}})[_0x4946('0x23')](respondWithResult(_0x516711,null))[_0x4946('0x44')](handleError(_0x516711,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index eb5775f..f6778c0 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 _0xdf9e=['../../config/environment','./trigger.attributes','exports','define','Trigger','tools_triggers','api','request-promise','path'];(function(_0x3c95b3,_0x11fa43){var _0xce52c=function(_0x5c626c){while(--_0x5c626c){_0x3c95b3['push'](_0x3c95b3['shift']());}};_0xce52c(++_0x11fa43);}(_0xdf9e,0x177));var _0xedf9=function(_0x2b70bb,_0x49e53a){_0x2b70bb=_0x2b70bb-0x0;var _0x2a4eaa=_0xdf9e[_0x2b70bb];return _0x2a4eaa;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xedf9('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xedf9('0x1'));var fs=require('fs');var path=require(_0xedf9('0x2'));var rimraf=require('rimraf');var config=require(_0xedf9('0x3'));var attributes=require(_0xedf9('0x4'));module[_0xedf9('0x5')]=function(_0x5b4158,_0x30f807){return _0x5b4158[_0xedf9('0x6')](_0xedf9('0x7'),attributes,{'tableName':_0xedf9('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6dce=['path','rimraf','./trigger.attributes','define','Trigger','tools_triggers','util','../../config/logger','api','bluebird'];(function(_0x35c993,_0x5e8fe1){var _0x3824dd=function(_0x568725){while(--_0x568725){_0x35c993['push'](_0x35c993['shift']());}};_0x3824dd(++_0x5e8fe1);}(_0x6dce,0x1e6));var _0xe6dc=function(_0xd2e237,_0x15d882){_0xd2e237=_0xd2e237-0x0;var _0x39cdc6=_0x6dce[_0xd2e237];return _0x39cdc6;};'use strict';var _=require('lodash');var util=require(_0xe6dc('0x0'));var logger=require(_0xe6dc('0x1'))(_0xe6dc('0x2'));var moment=require('moment');var BPromise=require(_0xe6dc('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe6dc('0x4'));var rimraf=require(_0xe6dc('0x5'));var config=require('../../config/environment');var attributes=require(_0xe6dc('0x6'));module['exports']=function(_0x2fb5b3,_0x4fbc55){return _0x2fb5b3[_0xe6dc('0x7')](_0xe6dc('0x8'),attributes,{'tableName':_0xe6dc('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trigger/trigger.rpc.js b/server/api/trigger/trigger.rpc.js index 9bb12f1..9c2534a 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 _0x087b=['find','where','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','Trigger,\x20%s,\x20%s','message','result','findAll','options','raw','attributes','limit','map','include','model','GetTrigger','catch','ShowTrigger'];(function(_0x1bbb03,_0x18c084){var _0x1ae659=function(_0x388937){while(--_0x388937){_0x1bbb03['push'](_0x1bbb03['shift']());}};_0x1ae659(++_0x18c084);}(_0x087b,0x11a));var _0xb087=function(_0x9fd887,_0x47f76c){_0x9fd887=_0x9fd887-0x0;var _0x1a54ab=_0x087b[_0x9fd887];return _0x1a54ab;};'use strict';var _=require(_0xb087('0x0'));var util=require(_0xb087('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb087('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb087('0x3'))['db'];var utils=require(_0xb087('0x4'));var logger=require(_0xb087('0x5'))(_0xb087('0x6'));var config=require(_0xb087('0x7'));var jayson=require(_0xb087('0x8'));var client=jayson[_0xb087('0x9')][_0xb087('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xecf080,_0x36ac30,_0x3cebbf){return new BPromise(function(_0x6d83fb,_0x1dbe9f){return client[_0xb087('0xb')](_0xecf080,_0x3cebbf)[_0xb087('0xc')](function(_0x23cdd7){logger[_0xb087('0xd')]('Trigger,\x20%s,\x20%s',_0x36ac30,_0xb087('0xe'));logger[_0xb087('0xf')](_0xb087('0x10'),_0x36ac30,_0xb087('0xe'),JSON[_0xb087('0x11')](_0x23cdd7));if(_0x23cdd7[_0xb087('0x12')]){if(_0x23cdd7[_0xb087('0x12')]['code']===0x1f4){logger[_0xb087('0x12')](_0xb087('0x13'),_0x36ac30,_0x23cdd7[_0xb087('0x12')]['message']);return _0x1dbe9f(_0x23cdd7[_0xb087('0x12')][_0xb087('0x14')]);}logger[_0xb087('0x12')](_0xb087('0x13'),_0x36ac30,_0x23cdd7[_0xb087('0x12')][_0xb087('0x14')]);return _0x6d83fb(_0x23cdd7[_0xb087('0x12')][_0xb087('0x14')]);}else{logger[_0xb087('0xd')](_0xb087('0x13'),_0x36ac30,'request\x20sent');_0x6d83fb(_0x23cdd7[_0xb087('0x15')][_0xb087('0x14')]);}})['catch'](function(_0xcc4426){logger[_0xb087('0x12')](_0xb087('0x13'),_0x36ac30,_0xcc4426);_0x1dbe9f(_0xcc4426);});});}exports['GetTrigger']=function(_0x330005){var _0x3c680f=this;return new Promise(function(_0x17200d,_0x45d074){return db['Trigger'][_0xb087('0x16')]({'raw':_0x330005[_0xb087('0x17')]?_0x330005[_0xb087('0x17')][_0xb087('0x18')]===undefined?!![]:![]:!![],'where':_0x330005['options']?_0x330005['options']['where']||null:null,'attributes':_0x330005['options']?_0x330005[_0xb087('0x17')][_0xb087('0x19')]||null:null,'limit':_0x330005[_0xb087('0x17')]?_0x330005[_0xb087('0x17')][_0xb087('0x1a')]||null:null,'include':_0x330005[_0xb087('0x17')]?_0x330005[_0xb087('0x17')]['include']?_[_0xb087('0x1b')](_0x330005[_0xb087('0x17')][_0xb087('0x1c')],function(_0x1cfb3e){return{'model':db[_0x1cfb3e[_0xb087('0x1d')]],'as':_0x1cfb3e['as'],'attributes':_0x1cfb3e['attributes'],'include':_0x1cfb3e[_0xb087('0x1c')]?_[_0xb087('0x1b')](_0x1cfb3e['include'],function(_0x5a2dc6){return{'model':db[_0x5a2dc6['model']],'as':_0x5a2dc6['as'],'attributes':_0x5a2dc6['attributes'],'include':_0x5a2dc6['include']?_[_0xb087('0x1b')](_0x5a2dc6[_0xb087('0x1c')],function(_0x1d124f){return{'model':db[_0x1d124f[_0xb087('0x1d')]],'as':_0x1d124f['as'],'attributes':_0x1d124f[_0xb087('0x19')]};}):[]};}):[]};}):[]:[]})[_0xb087('0xc')](function(_0xf3f41f){logger[_0xb087('0xd')](_0xb087('0x1e'),_0x330005);logger[_0xb087('0xf')](_0xb087('0x1e'),_0x330005,JSON[_0xb087('0x11')](_0xf3f41f));_0x17200d(_0xf3f41f);})[_0xb087('0x1f')](function(_0x263259){logger['error'](_0xb087('0x1e'),_0x263259[_0xb087('0x14')],_0x330005);_0x45d074(_0x3c680f[_0xb087('0x12')](0x1f4,_0x263259[_0xb087('0x14')]));});});};exports[_0xb087('0x20')]=function(_0xa6d90c){var _0x2e1c57=this;return new Promise(function(_0x13fb2f,_0x53a535){return db['Trigger'][_0xb087('0x21')]({'raw':_0xa6d90c[_0xb087('0x17')]?_0xa6d90c['options'][_0xb087('0x18')]===undefined?!![]:![]:!![],'where':_0xa6d90c[_0xb087('0x17')]?_0xa6d90c[_0xb087('0x17')][_0xb087('0x22')]||null:null,'attributes':_0xa6d90c[_0xb087('0x17')]?_0xa6d90c[_0xb087('0x17')][_0xb087('0x19')]||null:null,'include':_0xa6d90c[_0xb087('0x17')]?_0xa6d90c[_0xb087('0x17')][_0xb087('0x1c')]?_[_0xb087('0x1b')](_0xa6d90c[_0xb087('0x17')]['include'],function(_0x3bec03){return{'model':db[_0x3bec03['model']],'as':_0x3bec03['as'],'attributes':_0x3bec03[_0xb087('0x19')],'include':_0x3bec03[_0xb087('0x1c')]?_[_0xb087('0x1b')](_0x3bec03[_0xb087('0x1c')],function(_0x13cb5d){return{'model':db[_0x13cb5d[_0xb087('0x1d')]],'as':_0x13cb5d['as'],'attributes':_0x13cb5d[_0xb087('0x19')],'include':_0x13cb5d[_0xb087('0x1c')]?_[_0xb087('0x1b')](_0x13cb5d['include'],function(_0x5814c2){return{'model':db[_0x5814c2[_0xb087('0x1d')]],'as':_0x5814c2['as'],'attributes':_0x5814c2[_0xb087('0x19')]};}):[]};}):[]};}):[]:[]})[_0xb087('0xc')](function(_0x2d2902){logger[_0xb087('0xd')]('ShowTrigger',_0xa6d90c);logger[_0xb087('0xf')](_0xb087('0x20'),_0xa6d90c,JSON['stringify'](_0x2d2902));_0x13fb2f(_0x2d2902);})['catch'](function(_0x1726c2){logger[_0xb087('0x12')](_0xb087('0x20'),_0x1726c2['message'],_0xa6d90c);_0x53a535(_0x2e1c57[_0xb087('0x12')](0x1f4,_0x1726c2[_0xb087('0x14')]));});});}; \ No newline at end of file +var _0x8f59=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','Trigger,\x20%s,\x20%s','request\x20sent','Trigger,\x20%s,\x20%s,\x20%s','error','message','result','GetTrigger','Trigger','findAll','options','raw','where','attributes','limit','map','include','model','then','debug','catch','ShowTrigger','stringify','lodash','util','moment'];(function(_0x29f80e,_0x9027ff){var _0x5c7eaa=function(_0x48ec7c){while(--_0x48ec7c){_0x29f80e['push'](_0x29f80e['shift']());}};_0x5c7eaa(++_0x9027ff);}(_0x8f59,0x11d));var _0x98f5=function(_0x1ddcd0,_0x35557d){_0x1ddcd0=_0x1ddcd0-0x0;var _0x23f108=_0x8f59[_0x1ddcd0];return _0x23f108;};'use strict';var _=require(_0x98f5('0x0'));var util=require(_0x98f5('0x1'));var moment=require(_0x98f5('0x2'));var BPromise=require(_0x98f5('0x3'));var rs=require(_0x98f5('0x4'));var fs=require('fs');var Redis=require(_0x98f5('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x98f5('0x6'));var logger=require(_0x98f5('0x7'))(_0x98f5('0x8'));var config=require(_0x98f5('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x98f5('0xa')][_0x98f5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2e2acf,_0x5869ee,_0x5e91b3){return new BPromise(function(_0x109417,_0x1cd8a8){return client[_0x98f5('0xc')](_0x2e2acf,_0x5e91b3)['then'](function(_0x456329){logger[_0x98f5('0xd')](_0x98f5('0xe'),_0x5869ee,_0x98f5('0xf'));logger['debug'](_0x98f5('0x10'),_0x5869ee,'request\x20sent',JSON['stringify'](_0x456329));if(_0x456329[_0x98f5('0x11')]){if(_0x456329[_0x98f5('0x11')]['code']===0x1f4){logger[_0x98f5('0x11')](_0x98f5('0xe'),_0x5869ee,_0x456329[_0x98f5('0x11')][_0x98f5('0x12')]);return _0x1cd8a8(_0x456329[_0x98f5('0x11')][_0x98f5('0x12')]);}logger['error'](_0x98f5('0xe'),_0x5869ee,_0x456329[_0x98f5('0x11')]['message']);return _0x109417(_0x456329[_0x98f5('0x11')][_0x98f5('0x12')]);}else{logger[_0x98f5('0xd')]('Trigger,\x20%s,\x20%s',_0x5869ee,_0x98f5('0xf'));_0x109417(_0x456329[_0x98f5('0x13')][_0x98f5('0x12')]);}})['catch'](function(_0x440cfa){logger[_0x98f5('0x11')]('Trigger,\x20%s,\x20%s',_0x5869ee,_0x440cfa);_0x1cd8a8(_0x440cfa);});});}exports[_0x98f5('0x14')]=function(_0x51a567){var _0x10c57c=this;return new Promise(function(_0x9e42dd,_0x2291d5){return db[_0x98f5('0x15')][_0x98f5('0x16')]({'raw':_0x51a567[_0x98f5('0x17')]?_0x51a567['options'][_0x98f5('0x18')]===undefined?!![]:![]:!![],'where':_0x51a567['options']?_0x51a567[_0x98f5('0x17')][_0x98f5('0x19')]||null:null,'attributes':_0x51a567['options']?_0x51a567[_0x98f5('0x17')][_0x98f5('0x1a')]||null:null,'limit':_0x51a567[_0x98f5('0x17')]?_0x51a567[_0x98f5('0x17')][_0x98f5('0x1b')]||null:null,'include':_0x51a567[_0x98f5('0x17')]?_0x51a567[_0x98f5('0x17')]['include']?_[_0x98f5('0x1c')](_0x51a567['options'][_0x98f5('0x1d')],function(_0x495889){return{'model':db[_0x495889[_0x98f5('0x1e')]],'as':_0x495889['as'],'attributes':_0x495889[_0x98f5('0x1a')],'include':_0x495889[_0x98f5('0x1d')]?_[_0x98f5('0x1c')](_0x495889[_0x98f5('0x1d')],function(_0x18052d){return{'model':db[_0x18052d[_0x98f5('0x1e')]],'as':_0x18052d['as'],'attributes':_0x18052d['attributes'],'include':_0x18052d[_0x98f5('0x1d')]?_[_0x98f5('0x1c')](_0x18052d['include'],function(_0x1a1c55){return{'model':db[_0x1a1c55[_0x98f5('0x1e')]],'as':_0x1a1c55['as'],'attributes':_0x1a1c55[_0x98f5('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x98f5('0x1f')](function(_0x230d1b){logger[_0x98f5('0xd')](_0x98f5('0x14'),_0x51a567);logger[_0x98f5('0x20')]('GetTrigger',_0x51a567,JSON['stringify'](_0x230d1b));_0x9e42dd(_0x230d1b);})[_0x98f5('0x21')](function(_0x71661e){logger[_0x98f5('0x11')](_0x98f5('0x14'),_0x71661e[_0x98f5('0x12')],_0x51a567);_0x2291d5(_0x10c57c[_0x98f5('0x11')](0x1f4,_0x71661e['message']));});});};exports[_0x98f5('0x22')]=function(_0x6d7418){var _0x7a922b=this;return new Promise(function(_0xd20823,_0x1e7138){return db[_0x98f5('0x15')]['find']({'raw':_0x6d7418[_0x98f5('0x17')]?_0x6d7418[_0x98f5('0x17')][_0x98f5('0x18')]===undefined?!![]:![]:!![],'where':_0x6d7418[_0x98f5('0x17')]?_0x6d7418['options'][_0x98f5('0x19')]||null:null,'attributes':_0x6d7418[_0x98f5('0x17')]?_0x6d7418[_0x98f5('0x17')][_0x98f5('0x1a')]||null:null,'include':_0x6d7418[_0x98f5('0x17')]?_0x6d7418[_0x98f5('0x17')][_0x98f5('0x1d')]?_[_0x98f5('0x1c')](_0x6d7418[_0x98f5('0x17')][_0x98f5('0x1d')],function(_0x12d874){return{'model':db[_0x12d874[_0x98f5('0x1e')]],'as':_0x12d874['as'],'attributes':_0x12d874[_0x98f5('0x1a')],'include':_0x12d874[_0x98f5('0x1d')]?_[_0x98f5('0x1c')](_0x12d874[_0x98f5('0x1d')],function(_0x2227f1){return{'model':db[_0x2227f1[_0x98f5('0x1e')]],'as':_0x2227f1['as'],'attributes':_0x2227f1[_0x98f5('0x1a')],'include':_0x2227f1[_0x98f5('0x1d')]?_['map'](_0x2227f1[_0x98f5('0x1d')],function(_0x4aba7a){return{'model':db[_0x4aba7a['model']],'as':_0x4aba7a['as'],'attributes':_0x4aba7a[_0x98f5('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x98f5('0x1f')](function(_0x65c03b){logger[_0x98f5('0xd')]('ShowTrigger',_0x6d7418);logger[_0x98f5('0x20')](_0x98f5('0x22'),_0x6d7418,JSON[_0x98f5('0x23')](_0x65c03b));_0xd20823(_0x65c03b);})['catch'](function(_0x17bfe2){logger[_0x98f5('0x11')]('ShowTrigger',_0x17bfe2[_0x98f5('0x12')],_0x6d7418);_0x1e7138(_0x7a922b[_0x98f5('0x11')](0x1f4,_0x17bfe2[_0x98f5('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 41fb8fc..aeb5581 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 _0x5636=['put','destroy','exports','multer','util','Router','../../components/auth/service','../../components/interaction/service','./trunk.controller','get','isAuthenticated','index','/:id','show','post','/:id/clone','clone'];(function(_0x511d5c,_0x4d44a0){var _0x128d3b=function(_0x271de6){while(--_0x271de6){_0x511d5c['push'](_0x511d5c['shift']());}};_0x128d3b(++_0x4d44a0);}(_0x5636,0x102));var _0x6563=function(_0x527483,_0x282761){_0x527483=_0x527483-0x0;var _0x1d3c7b=_0x5636[_0x527483];return _0x1d3c7b;};'use strict';var multer=require(_0x6563('0x0'));var util=require(_0x6563('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6563('0x2')]();var auth=require(_0x6563('0x3'));var interaction=require(_0x6563('0x4'));var config=require('../../config/environment');var controller=require(_0x6563('0x5'));router[_0x6563('0x6')]('/',auth[_0x6563('0x7')](),controller[_0x6563('0x8')]);router[_0x6563('0x6')](_0x6563('0x9'),auth[_0x6563('0x7')](),controller[_0x6563('0xa')]);router[_0x6563('0xb')](_0x6563('0xc'),auth[_0x6563('0x7')](),controller[_0x6563('0xd')]);router[_0x6563('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x6563('0xe')](_0x6563('0x9'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x6563('0x9'),auth[_0x6563('0x7')](),controller[_0x6563('0xf')]);module[_0x6563('0x10')]=router; \ No newline at end of file +var _0x207c=['get','/:id','isAuthenticated','post','/:id/clone','create','put','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./trunk.controller'];(function(_0x253591,_0x568657){var _0xe06793=function(_0x15ee0b){while(--_0x15ee0b){_0x253591['push'](_0x253591['shift']());}};_0xe06793(++_0x568657);}(_0x207c,0x1e8));var _0xc207=function(_0x513441,_0x20bfba){_0x513441=_0x513441-0x0;var _0x5a49c8=_0x207c[_0x513441];return _0x5a49c8;};'use strict';var multer=require('multer');var util=require(_0xc207('0x0'));var path=require(_0xc207('0x1'));var timeout=require(_0xc207('0x2'));var express=require(_0xc207('0x3'));var router=express[_0xc207('0x4')]();var auth=require(_0xc207('0x5'));var interaction=require(_0xc207('0x6'));var config=require('../../config/environment');var controller=require(_0xc207('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xc207('0x8')](_0xc207('0x9'),auth[_0xc207('0xa')](),controller['show']);router[_0xc207('0xb')](_0xc207('0xc'),auth[_0xc207('0xa')](),controller['clone']);router[_0xc207('0xb')]('/',auth[_0xc207('0xa')](),controller[_0xc207('0xd')]);router[_0xc207('0xe')](_0xc207('0x9'),auth[_0xc207('0xa')](),controller['update']);router['delete']('/:id',auth[_0xc207('0xa')](),controller['destroy']);module[_0xc207('0xf')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 1fa3ee8..2cad38e 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 _0x1e10=['yes','force_rport,comedia','nat','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','always','accept','refuse','originate','uac','uas','pai','fingerprint','active','passive','actpass','dynamic','update,nonat','sequelize','exports','STRING','friend','user','peer','from-voip-provider','ENUM','ALLOWED_PASSED_SCREEN','ALLOWED','PROHIB_FAILED_SCREEN','udp','setDataValue','transport','join','getDataValue','split','rfc2833','info','shortinfo','inband','auto','nonat','update'];(function(_0x43dfb7,_0x1f5b0a){var _0x4f6af6=function(_0x2d6aec){while(--_0x2d6aec){_0x43dfb7['push'](_0x43dfb7['shift']());}};_0x4f6af6(++_0x1f5b0a);}(_0x1e10,0x10e));var _0x01e1=function(_0x31e4fc,_0x3372f7){_0x31e4fc=_0x31e4fc-0x0;var _0x3ed572=_0x1e10[_0x31e4fc];return _0x3ed572;};'use strict';var Sequelize=require(_0x01e1('0x0'));module[_0x01e1('0x1')]={'name':{'type':Sequelize[_0x01e1('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x01e1('0x3'),_0x01e1('0x4'),_0x01e1('0x5')),'allowNull':![],'defaultValue':_0x01e1('0x3')},'context':{'type':Sequelize[_0x01e1('0x2')],'allowNull':![],'defaultValue':_0x01e1('0x6')},'callingpres':{'type':Sequelize[_0x01e1('0x7')]('ALLOWED_NOT_SCREENED',_0x01e1('0x8'),'ALLOWED_FAILED_SCREEN',_0x01e1('0x9'),'PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN',_0x01e1('0xa'),'PROHIB')},'deny':{'type':Sequelize[_0x01e1('0x2')]},'permit':{'type':Sequelize[_0x01e1('0x2')]},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize[_0x01e1('0x2')]},'remotesecret':{'type':Sequelize[_0x01e1('0x2')]},'transport':{'type':Sequelize[_0x01e1('0x2')],'defaultValue':_0x01e1('0xb'),'set':function(_0x1bc1b8){this[_0x01e1('0xc')](_0x01e1('0xd'),_0x1bc1b8?_0x1bc1b8[_0x01e1('0xe')](','):null);},'get':function(){return this[_0x01e1('0xf')](_0x01e1('0xd'))?this[_0x01e1('0xf')](_0x01e1('0xd'))[_0x01e1('0x10')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0x01e1('0x7')](_0x01e1('0x11'),_0x01e1('0x12'),_0x01e1('0x13'),_0x01e1('0x14'),_0x01e1('0x15')),'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0x01e1('0x7')]('yes','no',_0x01e1('0x16'),_0x01e1('0x17'),'outgoing'),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x01e1('0x7')](_0x01e1('0x18'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING']},'directmediadeny':{'type':Sequelize[_0x01e1('0x2')]},'nat':{'type':Sequelize['STRING'],'defaultValue':_0x01e1('0x19'),'set':function(_0x584a88){this['setDataValue'](_0x01e1('0x1a'),_0x584a88?_0x584a88[_0x01e1('0xe')](','):null);},'get':function(){return this[_0x01e1('0xf')](_0x01e1('0x1a'))?this[_0x01e1('0xf')](_0x01e1('0x1a'))[_0x01e1('0x10')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x01e1('0x2')]},'namedcallgroup':{'type':Sequelize[_0x01e1('0x2')]},'pickupgroup':{'type':Sequelize[_0x01e1('0x2')]},'namedpickupgroup':{'type':Sequelize[_0x01e1('0x2')]},'language':{'type':Sequelize[_0x01e1('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x01e1('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize['STRING'],'defaultValue':_0x01e1('0x1b')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x01e1('0x1c'),'set':function(_0x1eed60){this[_0x01e1('0xc')](_0x01e1('0x1d'),_0x1eed60?_0x1eed60['join'](';'):_0x01e1('0x1c'));},'get':function(){return this[_0x01e1('0xf')]('allow')?this[_0x01e1('0xf')](_0x01e1('0x1d'))[_0x01e1('0x10')](';'):null;},'comment':_0x01e1('0x1e')},'autoframing':{'type':Sequelize[_0x01e1('0x7')]('yes','no')},'insecure':{'type':Sequelize[_0x01e1('0x2')],'defaultValue':_0x01e1('0x1f'),'set':function(_0x4c28ba){this['setDataValue'](_0x01e1('0x20'),_0x4c28ba?_0x4c28ba['join'](','):null);},'get':function(){return this[_0x01e1('0xf')](_0x01e1('0x20'))?this[_0x01e1('0xf')]('insecure')['split'](','):null;},'comment':_0x01e1('0x21')},'trustrpid':{'type':Sequelize[_0x01e1('0x7')](_0x01e1('0x18'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x01e1('0x7')](_0x01e1('0x18'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x01e1('0x7')](_0x01e1('0x18'),'no',_0x01e1('0x22'))},'promiscredir':{'type':Sequelize[_0x01e1('0x7')]('yes','no')},'useclientcode':{'type':Sequelize['ENUM'](_0x01e1('0x18'),'no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize[_0x01e1('0x2')]},'callerid':{'type':Sequelize['STRING'],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0x01e1('0x2')]},'callcounter':{'type':Sequelize[_0x01e1('0x7')]('yes','no'),'defaultValue':_0x01e1('0x18')},'busylevel':{'type':Sequelize[_0x01e1('0x23')](0xb)},'allowoverlap':{'type':Sequelize['ENUM'](_0x01e1('0x18'),'no')},'allowsubscribe':{'type':Sequelize['ENUM'](_0x01e1('0x18'),'no')},'allowtransfer':{'type':Sequelize[_0x01e1('0x7')](_0x01e1('0x18'),'no')},'ignoresdpversion':{'type':Sequelize[_0x01e1('0x7')](_0x01e1('0x18'),'no')},'subscribecontext':{'type':Sequelize['STRING']},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize[_0x01e1('0x7')](_0x01e1('0x18'),'no',_0x01e1('0x24')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x01e1('0x23')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x01e1('0x7')](_0x01e1('0x18'),'no')},'mailbox':{'type':Sequelize[_0x01e1('0x2')]},'session_timers':{'type':Sequelize[_0x01e1('0x7')](_0x01e1('0x25'),_0x01e1('0x26'),_0x01e1('0x27'))},'session_expires':{'type':Sequelize[_0x01e1('0x23')](0xb)},'session_minse':{'type':Sequelize[_0x01e1('0x23')](0xb)},'session_refresher':{'type':Sequelize['ENUM'](_0x01e1('0x28'),_0x01e1('0x29')),'defaultValue':_0x01e1('0x29')},'t38pt_usertpsource':{'type':Sequelize[_0x01e1('0x2')]},'regexten':{'type':Sequelize[_0x01e1('0x2')]},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x01e1('0x23')](0x5)},'qualify':{'type':Sequelize[_0x01e1('0x7')](_0x01e1('0x18'),'no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x01e1('0x23')](0xb)},'defaultip':{'type':Sequelize[_0x01e1('0x2')]},'defaultuser':{'type':Sequelize[_0x01e1('0x2')]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize[_0x01e1('0x23')](0xb)},'sendrpid':{'type':Sequelize['ENUM']('yes','no',_0x01e1('0x2a')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x01e1('0x2')]},'callbackextension':{'type':Sequelize[_0x01e1('0x2')]},'timert1':{'type':Sequelize[_0x01e1('0x23')](0xb)},'timerb':{'type':Sequelize['INTEGER'](0xb)},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb)},'contactpermit':{'type':Sequelize[_0x01e1('0x2')]},'contactdeny':{'type':Sequelize[_0x01e1('0x2')]},'contactacl':{'type':Sequelize[_0x01e1('0x2')]},'unsolicited_mailbox':{'type':Sequelize[_0x01e1('0x2')]},'use_q850_reason':{'type':Sequelize[_0x01e1('0x2')]},'maxforwards':{'type':Sequelize[_0x01e1('0x23')](0xb)},'encryption':{'type':Sequelize[_0x01e1('0x7')]('yes','no'),'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x01e1('0x18'),'no')},'force_avp':{'type':Sequelize[_0x01e1('0x7')](_0x01e1('0x18'),'no')},'icesupport':{'type':Sequelize[_0x01e1('0x7')](_0x01e1('0x18'),'no')},'dtlsenable':{'type':Sequelize[_0x01e1('0x7')](_0x01e1('0x18'),'no')},'dtlsverify':{'type':Sequelize['ENUM'](_0x01e1('0x18'),'no',_0x01e1('0x2b'),'certificate')},'dtlsrekey':{'type':Sequelize[_0x01e1('0x23')](0xb)},'dtlscertfile':{'type':Sequelize['STRING']},'dtlsprivatekey':{'type':Sequelize[_0x01e1('0x2')]},'dtlscipher':{'type':Sequelize[_0x01e1('0x2')]},'dtlscafile':{'type':Sequelize[_0x01e1('0x2')]},'dtlscapath':{'type':Sequelize[_0x01e1('0x2')]},'dtlssetup':{'type':Sequelize[_0x01e1('0x7')](_0x01e1('0x2c'),_0x01e1('0x2d'),_0x01e1('0x2e')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x01e1('0x2')]},'usereqphone':{'type':Sequelize['ENUM'](_0x01e1('0x18'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING']},'recordofffeature':{'type':Sequelize[_0x01e1('0x2')]},'call_limit':{'type':Sequelize[_0x01e1('0x23')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x01e1('0x7')]('yes','no')},'subscribemwi':{'type':Sequelize[_0x01e1('0x7')]('yes','no')},'vmexten':{'type':Sequelize['STRING']},'mohinterpret':{'type':Sequelize[_0x01e1('0x2')]},'mohsuggest':{'type':Sequelize[_0x01e1('0x2')]},'parkinglot':{'type':Sequelize[_0x01e1('0x2')]},'description':{'type':Sequelize[_0x01e1('0x2')]},'host':{'type':Sequelize['STRING'],'defaultValue':_0x01e1('0x2f')},'canreinvite':{'type':Sequelize[_0x01e1('0x7')]('yes','no','nonat',_0x01e1('0x17'),_0x01e1('0x30')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x01e1('0x2')]},'otherFields':{'type':Sequelize[_0x01e1('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize['STRING'],'defaultValue':'no'}}; \ No newline at end of file +var _0xa31b=['friend','user','peer','from-voip-provider','ENUM','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','setDataValue','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','auto','yes','nonat','update','outgoing','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','INTEGER','always','accept','refuse','uac','uas','pai','passive','dynamic','update,nonat','BOOLEAN','exports','STRING','name'];(function(_0x59cfb5,_0x107e1f){var _0x32857e=function(_0x442169){while(--_0x442169){_0x59cfb5['push'](_0x59cfb5['shift']());}};_0x32857e(++_0x107e1f);}(_0xa31b,0x19d));var _0xba31=function(_0x1547a3,_0x21807d){_0x1547a3=_0x1547a3-0x0;var _0x3bbb6f=_0xa31b[_0x1547a3];return _0x3bbb6f;};'use strict';var Sequelize=require('sequelize');module[_0xba31('0x0')]={'name':{'type':Sequelize[_0xba31('0x1')],'allowNull':![],'unique':_0xba31('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0xba31('0x3'),_0xba31('0x4'),_0xba31('0x5')),'allowNull':![],'defaultValue':_0xba31('0x3')},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xba31('0x6')},'callingpres':{'type':Sequelize[_0xba31('0x7')](_0xba31('0x8'),_0xba31('0x9'),_0xba31('0xa'),_0xba31('0xb'),_0xba31('0xc'),_0xba31('0xd'),_0xba31('0xe'),_0xba31('0xf'))},'deny':{'type':Sequelize['STRING']},'permit':{'type':Sequelize[_0xba31('0x1')]},'secret':{'type':Sequelize[_0xba31('0x1')]},'md5secret':{'type':Sequelize[_0xba31('0x1')]},'remotesecret':{'type':Sequelize['STRING']},'transport':{'type':Sequelize['STRING'],'defaultValue':'udp','set':function(_0x4b9916){this[_0xba31('0x10')](_0xba31('0x11'),_0x4b9916?_0x4b9916[_0xba31('0x12')](','):null);},'get':function(){return this['getDataValue'](_0xba31('0x11'))?this[_0xba31('0x13')]('transport')[_0xba31('0x14')](','):null;},'comment':_0xba31('0x15')},'dtmfmode':{'type':Sequelize[_0xba31('0x7')](_0xba31('0x16'),_0xba31('0x17'),_0xba31('0x18'),'inband',_0xba31('0x19')),'defaultValue':_0xba31('0x16')},'directmedia':{'type':Sequelize[_0xba31('0x7')](_0xba31('0x1a'),'no',_0xba31('0x1b'),_0xba31('0x1c'),_0xba31('0x1d')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xba31('0x7')](_0xba31('0x1a'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xba31('0x1')]},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize[_0xba31('0x1')],'defaultValue':'force_rport,comedia','set':function(_0x7c56dd){this[_0xba31('0x10')](_0xba31('0x1e'),_0x7c56dd?_0x7c56dd['join'](','):null);},'get':function(){return this['getDataValue'](_0xba31('0x1e'))?this['getDataValue'](_0xba31('0x1e'))[_0xba31('0x14')](','):null;},'comment':_0xba31('0x1f')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0xba31('0x1')]},'pickupgroup':{'type':Sequelize[_0xba31('0x1')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xba31('0x1')],'allowNull':!![]},'disallow':{'type':Sequelize[_0xba31('0x1')],'defaultValue':_0xba31('0x20')},'allow':{'type':Sequelize[_0xba31('0x1')],'allowNull':![],'defaultValue':_0xba31('0x21'),'set':function(_0x7165b5){this[_0xba31('0x10')](_0xba31('0x22'),_0x7165b5?_0x7165b5[_0xba31('0x12')](';'):_0xba31('0x21'));},'get':function(){return this[_0xba31('0x13')](_0xba31('0x22'))?this[_0xba31('0x13')]('allow')[_0xba31('0x14')](';'):null;},'comment':_0xba31('0x23')},'autoframing':{'type':Sequelize['ENUM'](_0xba31('0x1a'),'no')},'insecure':{'type':Sequelize[_0xba31('0x1')],'defaultValue':_0xba31('0x24'),'set':function(_0x2ed53){this['setDataValue'](_0xba31('0x25'),_0x2ed53?_0x2ed53[_0xba31('0x12')](','):null);},'get':function(){return this[_0xba31('0x13')]('insecure')?this[_0xba31('0x13')](_0xba31('0x25'))[_0xba31('0x14')](','):null;},'comment':_0xba31('0x26')},'trustrpid':{'type':Sequelize['ENUM'](_0xba31('0x1a'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xba31('0x7')](_0xba31('0x1a'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xba31('0x7')](_0xba31('0x1a'),'no',_0xba31('0x27'))},'promiscredir':{'type':Sequelize[_0xba31('0x7')](_0xba31('0x1a'),'no')},'useclientcode':{'type':Sequelize['ENUM'](_0xba31('0x1a'),'no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize[_0xba31('0x1')]},'callerid':{'type':Sequelize[_0xba31('0x1')],'defaultValue':_0xba31('0x28')},'amaflags':{'type':Sequelize[_0xba31('0x1')]},'callcounter':{'type':Sequelize[_0xba31('0x7')]('yes','no'),'defaultValue':_0xba31('0x1a')},'busylevel':{'type':Sequelize[_0xba31('0x29')](0xb)},'allowoverlap':{'type':Sequelize[_0xba31('0x7')](_0xba31('0x1a'),'no')},'allowsubscribe':{'type':Sequelize[_0xba31('0x7')](_0xba31('0x1a'),'no')},'allowtransfer':{'type':Sequelize[_0xba31('0x7')](_0xba31('0x1a'),'no')},'ignoresdpversion':{'type':Sequelize[_0xba31('0x7')](_0xba31('0x1a'),'no')},'subscribecontext':{'type':Sequelize['STRING']},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize[_0xba31('0x7')](_0xba31('0x1a'),'no',_0xba31('0x2a')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xba31('0x29')](0xb)},'rfc2833compensate':{'type':Sequelize[_0xba31('0x7')](_0xba31('0x1a'),'no')},'mailbox':{'type':Sequelize[_0xba31('0x1')]},'session_timers':{'type':Sequelize['ENUM'](_0xba31('0x2b'),_0xba31('0x2c'),'originate')},'session_expires':{'type':Sequelize[_0xba31('0x29')](0xb)},'session_minse':{'type':Sequelize[_0xba31('0x29')](0xb)},'session_refresher':{'type':Sequelize[_0xba31('0x7')](_0xba31('0x2d'),_0xba31('0x2e')),'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0xba31('0x1')]},'regexten':{'type':Sequelize[_0xba31('0x1')]},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize[_0xba31('0x1')]},'port':{'type':Sequelize[_0xba31('0x29')](0x5)},'qualify':{'type':Sequelize[_0xba31('0x7')](_0xba31('0x1a'),'no'),'defaultValue':_0xba31('0x1a')},'keepalive':{'type':Sequelize[_0xba31('0x29')](0xb)},'defaultip':{'type':Sequelize['STRING']},'defaultuser':{'type':Sequelize[_0xba31('0x1')]},'rtptimeout':{'type':Sequelize[_0xba31('0x29')](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize[_0xba31('0x29')](0xb)},'sendrpid':{'type':Sequelize['ENUM']('yes','no',_0xba31('0x2f')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xba31('0x1')]},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize[_0xba31('0x29')](0xb)},'timerb':{'type':Sequelize['INTEGER'](0xb)},'qualifyfreq':{'type':Sequelize[_0xba31('0x29')](0xb)},'contactpermit':{'type':Sequelize[_0xba31('0x1')]},'contactdeny':{'type':Sequelize[_0xba31('0x1')]},'contactacl':{'type':Sequelize[_0xba31('0x1')]},'unsolicited_mailbox':{'type':Sequelize[_0xba31('0x1')]},'use_q850_reason':{'type':Sequelize[_0xba31('0x1')]},'maxforwards':{'type':Sequelize[_0xba31('0x29')](0xb)},'encryption':{'type':Sequelize['ENUM'](_0xba31('0x1a'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xba31('0x7')](_0xba31('0x1a'),'no')},'force_avp':{'type':Sequelize['ENUM']('yes','no')},'icesupport':{'type':Sequelize[_0xba31('0x7')]('yes','no')},'dtlsenable':{'type':Sequelize['ENUM'](_0xba31('0x1a'),'no')},'dtlsverify':{'type':Sequelize['ENUM'](_0xba31('0x1a'),'no','fingerprint','certificate')},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb)},'dtlscertfile':{'type':Sequelize[_0xba31('0x1')]},'dtlsprivatekey':{'type':Sequelize['STRING']},'dtlscipher':{'type':Sequelize[_0xba31('0x1')]},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize[_0xba31('0x1')]},'dtlssetup':{'type':Sequelize[_0xba31('0x7')]('active',_0xba31('0x30'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize[_0xba31('0x7')](_0xba31('0x1a'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xba31('0x1')]},'recordofffeature':{'type':Sequelize[_0xba31('0x1')]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xba31('0x7')](_0xba31('0x1a'),'no')},'subscribemwi':{'type':Sequelize[_0xba31('0x7')](_0xba31('0x1a'),'no')},'vmexten':{'type':Sequelize[_0xba31('0x1')]},'mohinterpret':{'type':Sequelize[_0xba31('0x1')]},'mohsuggest':{'type':Sequelize[_0xba31('0x1')]},'parkinglot':{'type':Sequelize[_0xba31('0x1')]},'description':{'type':Sequelize[_0xba31('0x1')]},'host':{'type':Sequelize[_0xba31('0x1')],'defaultValue':_0xba31('0x31')},'canreinvite':{'type':Sequelize['ENUM']('yes','no','nonat',_0xba31('0x1c'),_0xba31('0x32')),'defaultValue':'no'},'registry':{'type':Sequelize[_0xba31('0x1')]},'otherFields':{'type':Sequelize[_0xba31('0x1')]},'active':{'type':Sequelize[_0xba31('0x33')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xba31('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 8915a4f..4610703 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 _0x20df=['join','root','readFileSync','utf8','render','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','chan_sip.so','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','server/files/templates/trunk.ejs','server/files/templates/registry.ejs','writeFileSync','Reload','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','Trunk,\x20%s,\x20%s','result','catch','sendStatus','status','json','count','limit','Content-Range','apply','update','destroy','get','Trunks','UserProfileResource','end','stack','name','send','map','fieldName','model','query','filters','attributes','intersection','length','nolimit','offset','order','sort','where','filter','merge','type','VIRTUAL','options','Trunk','includeAll','show','params','rawAttributes','keys','include','find','clone','updatedAt','body','createdAt','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','findAll'];(function(_0x37c22c,_0x28a70d){var _0x119d79=function(_0x243a13){while(--_0x243a13){_0x37c22c['push'](_0x37c22c['shift']());}};_0x119d79(++_0x28a70d);}(_0x20df,0x7c));var _0xf20d=function(_0x1e9e56,_0x34a74a){_0x1e9e56=_0x1e9e56-0x0;var _0x5d5e2e=_0x20df[_0x1e9e56];return _0x5d5e2e;};'use strict';var pdf=require(_0xf20d('0x0'));var emlformat=require(_0xf20d('0x1'));var rimraf=require(_0xf20d('0x2'));var zipdir=require(_0xf20d('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf20d('0x4'));var moment=require(_0xf20d('0x5'));var BPromise=require(_0xf20d('0x6'));var Mustache=require(_0xf20d('0x7'));var util=require(_0xf20d('0x8'));var path=require('path');var sox=require(_0xf20d('0x9'));var csv=require('to-csv');var ejs=require(_0xf20d('0xa'));var fs=require('fs');var _=require(_0xf20d('0xb'));var squel=require('squel');var crypto=require(_0xf20d('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xf20d('0xd'));var toCsv=require('to-csv');var querystring=require(_0xf20d('0xe'));var Papa=require(_0xf20d('0xf'));var Redis=require(_0xf20d('0x10'));var authService=require(_0xf20d('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xf20d('0x12'));var hardwareService=require(_0xf20d('0x13'));var logger=require(_0xf20d('0x14'))(_0xf20d('0x15'));var utils=require(_0xf20d('0x16'));var config=require(_0xf20d('0x17'));var db=require(_0xf20d('0x18'))['db'];var jayson=require(_0xf20d('0x19'));var client=jayson['client'][_0xf20d('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x5126e0,_0x15f05d,_0x1364b8){if(_0x1364b8){var _0x554005=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x554005[_0xf20d('0x1b')](_0x15f05d)){return _0x5126e0;}else{throw new db[(_0xf20d('0x1c'))][(_0xf20d('0x1d'))](_0xf20d('0x1e'));}}else{return _0x5126e0;}}function respondWithRpcPromise(_0x12b4e0,_0x5c2ff0,_0x5d4244,_0x3a4563){return new BPromise(function(_0xcd434c,_0x2b2d00){var _0x1ce0c8=_0x3a4563||client;return _0x1ce0c8['request'](_0x12b4e0,_0x5d4244)[_0xf20d('0x1f')](function(_0x4d3bfc){logger[_0xf20d('0x20')]('Trunk,\x20%s,\x20%s',_0x5c2ff0,'request\x20sent');logger[_0xf20d('0x21')](_0xf20d('0x22'),_0x5c2ff0,_0xf20d('0x23'),JSON[_0xf20d('0x24')](_0x4d3bfc));if(_0x4d3bfc[_0xf20d('0x25')]){if(_0x4d3bfc[_0xf20d('0x25')]['code']===0x1f4){logger[_0xf20d('0x25')]('Trunk,\x20%s,\x20%s',_0x5c2ff0,_0x4d3bfc[_0xf20d('0x25')]['message']);return _0x2b2d00(_0x4d3bfc[_0xf20d('0x25')][_0xf20d('0x26')]);}logger['error']('Trunk,\x20%s,\x20%s',_0x5c2ff0,_0x4d3bfc[_0xf20d('0x25')][_0xf20d('0x26')]);return _0xcd434c(_0x4d3bfc[_0xf20d('0x25')]['message']);}else{logger['info'](_0xf20d('0x27'),_0x5c2ff0,_0xf20d('0x23'));_0xcd434c(_0x4d3bfc[_0xf20d('0x28')][_0xf20d('0x26')]);}})[_0xf20d('0x29')](function(_0x24b1e5){logger['error'](_0xf20d('0x27'),_0x5c2ff0,_0x24b1e5);_0x2b2d00(_0x24b1e5);});});}function respondWithStatusCode(_0x486104,_0x505645){_0x505645=_0x505645||0xcc;return function(_0x3e97bd){if(_0x3e97bd){return _0x486104[_0xf20d('0x2a')](_0x505645);}return _0x486104[_0xf20d('0x2b')](_0x505645)['end']();};}function respondWithResult(_0x5c6e7a,_0x5d8169){_0x5d8169=_0x5d8169||0xc8;return function(_0x41378f){if(_0x41378f){return _0x5c6e7a[_0xf20d('0x2b')](_0x5d8169)[_0xf20d('0x2c')](_0x41378f);}};}function respondWithFilteredResult(_0x49ecbc,_0x191c70){return function(_0x993a3b){if(_0x993a3b){var _0x1dfda0=_0x993a3b[_0xf20d('0x2d')],_0x8372b2=_0x191c70['offset'],_0x19e60b=_0x191c70['offset']+_0x191c70[_0xf20d('0x2e')],_0x36e7a5;if(_0x19e60b>=_0x1dfda0){_0x19e60b=_0x1dfda0;_0x36e7a5=0xc8;}else{_0x36e7a5=0xce;}_0x49ecbc[_0xf20d('0x2b')](_0x36e7a5);return _0x49ecbc['set'](_0xf20d('0x2f'),_0x8372b2+'-'+_0x19e60b+'/'+_0x1dfda0)[_0xf20d('0x2c')](_0x993a3b);}return null;};}function patchUpdates(_0x422944){return function(_0x1f99b0){try{jsonpatch[_0xf20d('0x30')](_0x1f99b0,_0x422944,!![]);}catch(_0x4baea7){return BPromise['reject'](_0x4baea7);}return _0x1f99b0['save']();};}function saveUpdates(_0xd5fea2,_0x5ca778){return function(_0x37662f){if(_0x37662f){return _0x37662f[_0xf20d('0x31')](_0xd5fea2)[_0xf20d('0x1f')](function(_0x883f6f){return _0x883f6f;});}return null;};}function removeEntity(_0x51b9be,_0x3cb18c){return function(_0x3ba88c){if(_0x3ba88c){return _0x3ba88c[_0xf20d('0x32')]()[_0xf20d('0x1f')](function(){var _0x37c1e5=_0x3ba88c[_0xf20d('0x33')]({'plain':!![]});var _0x22f1c9=_0xf20d('0x34');return db[_0xf20d('0x35')]['destroy']({'where':{'type':_0x22f1c9,'resourceId':_0x37c1e5['id']}})[_0xf20d('0x1f')](function(){return _0x3ba88c;});})[_0xf20d('0x1f')](function(){_0x51b9be[_0xf20d('0x2b')](0xcc)[_0xf20d('0x36')]();});}};}function handleEntityNotFound(_0x58387f,_0xcb73d){return function(_0x2474dd){if(!_0x2474dd){_0x58387f[_0xf20d('0x2a')](0x194);}return _0x2474dd;};}function handleError(_0x172fa7,_0x27d0ae){_0x27d0ae=_0x27d0ae||0x1f4;return function(_0x30b47f){logger[_0xf20d('0x25')](_0x30b47f[_0xf20d('0x37')]);if(_0x30b47f[_0xf20d('0x38')]){delete _0x30b47f[_0xf20d('0x38')];}_0x172fa7['status'](_0x27d0ae)[_0xf20d('0x39')](_0x30b47f);};}exports['index']=function(_0x32ff78,_0x29517d){var _0x350c82={},_0x219193={},_0x3ef514={'count':0x0,'rows':[]};var _0xe50ef1=_[_0xf20d('0x3a')](db['Trunk']['rawAttributes'],function(_0x1c9b69){return{'name':_0x1c9b69[_0xf20d('0x3b')],'type':_0x1c9b69['type']['key']};});_0x219193[_0xf20d('0x3c')]=_[_0xf20d('0x3a')](_0xe50ef1,'name');_0x219193[_0xf20d('0x3d')]=_['keys'](_0x32ff78[_0xf20d('0x3d')]);_0x219193[_0xf20d('0x3e')]=_['intersection'](_0x219193[_0xf20d('0x3c')],_0x219193[_0xf20d('0x3d')]);_0x350c82[_0xf20d('0x3f')]=_[_0xf20d('0x40')](_0x219193[_0xf20d('0x3c')],qs['fields'](_0x32ff78[_0xf20d('0x3d')]['fields']));_0x350c82['attributes']=_0x350c82[_0xf20d('0x3f')][_0xf20d('0x41')]?_0x350c82[_0xf20d('0x3f')]:_0x219193[_0xf20d('0x3c')];if(!_0x32ff78[_0xf20d('0x3d')]['hasOwnProperty'](_0xf20d('0x42'))){_0x350c82['limit']=qs['limit'](_0x32ff78[_0xf20d('0x3d')][_0xf20d('0x2e')]);_0x350c82[_0xf20d('0x43')]=qs[_0xf20d('0x43')](_0x32ff78[_0xf20d('0x3d')][_0xf20d('0x43')]);}_0x350c82[_0xf20d('0x44')]=qs[_0xf20d('0x45')](_0x32ff78[_0xf20d('0x3d')][_0xf20d('0x45')]);_0x350c82[_0xf20d('0x46')]=qs[_0xf20d('0x3e')](_['pick'](_0x32ff78['query'],_0x219193[_0xf20d('0x3e')]),_0xe50ef1);if(_0x32ff78['query'][_0xf20d('0x47')]){_0x350c82[_0xf20d('0x46')]=_[_0xf20d('0x48')](_0x350c82[_0xf20d('0x46')],{'$or':_[_0xf20d('0x3a')](_0xe50ef1,function(_0x576e2c){if(_0x576e2c[_0xf20d('0x49')]!==_0xf20d('0x4a')){var _0x48b247={};_0x48b247[_0x576e2c[_0xf20d('0x38')]]={'$like':'%'+_0x32ff78[_0xf20d('0x3d')]['filter']+'%'};return _0x48b247;}})});}_0x350c82=_[_0xf20d('0x48')]({},_0x350c82,_0x32ff78[_0xf20d('0x4b')]);var _0x2ea30e={'where':_0x350c82[_0xf20d('0x46')]};return db[_0xf20d('0x4c')][_0xf20d('0x2d')](_0x2ea30e)[_0xf20d('0x1f')](function(_0x132b07){_0x3ef514[_0xf20d('0x2d')]=_0x132b07;if(_0x32ff78[_0xf20d('0x3d')][_0xf20d('0x4d')]){_0x350c82['include']=[{'all':!![]}];}return db[_0xf20d('0x4c')]['findAll'](_0x350c82);})['then'](function(_0xdbbcb7){_0x3ef514['rows']=_0xdbbcb7;return _0x3ef514;})[_0xf20d('0x1f')](respondWithFilteredResult(_0x29517d,_0x350c82))['catch'](handleError(_0x29517d,null));};exports[_0xf20d('0x4e')]=function(_0x2689d3,_0x5d6c41){var _0x1ba672={'raw':![],'where':{'id':_0x2689d3[_0xf20d('0x4f')]['id']}},_0x195a11={};_0x195a11['model']=_['keys'](db[_0xf20d('0x4c')][_0xf20d('0x50')]);_0x195a11[_0xf20d('0x3d')]=_[_0xf20d('0x51')](_0x2689d3[_0xf20d('0x3d')]);_0x195a11['filters']=_[_0xf20d('0x40')](_0x195a11[_0xf20d('0x3c')],_0x195a11['query']);_0x1ba672['attributes']=_[_0xf20d('0x40')](_0x195a11['model'],qs['fields'](_0x2689d3[_0xf20d('0x3d')]['fields']));_0x1ba672['attributes']=_0x1ba672[_0xf20d('0x3f')][_0xf20d('0x41')]?_0x1ba672[_0xf20d('0x3f')]:_0x195a11[_0xf20d('0x3c')];if(_0x2689d3[_0xf20d('0x3d')][_0xf20d('0x4d')]){_0x1ba672[_0xf20d('0x52')]=[{'all':!![]}];}_0x1ba672=_[_0xf20d('0x48')]({},_0x1ba672,_0x2689d3[_0xf20d('0x4b')]);return db['Trunk'][_0xf20d('0x53')](_0x1ba672)[_0xf20d('0x1f')](handleEntityNotFound(_0x5d6c41,null))[_0xf20d('0x1f')](respondWithResult(_0x5d6c41,null))['catch'](handleError(_0x5d6c41,null));};exports[_0xf20d('0x54')]=function(_0x46eea5,_0x51e0b3){var _0x243308={'where':{'id':_0x46eea5['params']['id']}},_0x2ad598={};_0x2ad598['model']=_[_0xf20d('0x51')](db[_0xf20d('0x4c')][_0xf20d('0x50')]);_0x243308[_0xf20d('0x3f')]=_[_0xf20d('0x40')](_0x2ad598[_0xf20d('0x3c')],qs['fields'](_0x46eea5[_0xf20d('0x3d')]['fields']));_0x243308['attributes']=_0x243308[_0xf20d('0x3f')][_0xf20d('0x41')]?_0x243308[_0xf20d('0x3f')]:_0x2ad598[_0xf20d('0x3c')];if(_0x46eea5[_0xf20d('0x3d')]['includeAll']){_0x243308[_0xf20d('0x52')]=[{'all':!![]}];}_0x243308=_[_0xf20d('0x48')]({},_0x243308,_0x46eea5[_0xf20d('0x4b')]);return db[_0xf20d('0x4c')][_0xf20d('0x53')](_0x243308)[_0xf20d('0x1f')](handleEntityNotFound(_0x51e0b3,null))[_0xf20d('0x1f')](function(_0x29cbd8){if(_0x29cbd8){var _0x28a621=_0x29cbd8[_0xf20d('0x33')]({'plain':!![]});_0x28a621=qs['omit'](_0x28a621,['id','createdAt',_0xf20d('0x55')]);_0x46eea5['body']=_['omit'](_0x46eea5[_0xf20d('0x56')],['id',_0xf20d('0x57'),'updatedAt']);return db[_0xf20d('0x4c')][_0xf20d('0x58')](_['merge'](_0x28a621,_0x46eea5[_0xf20d('0x56')]),{'include':_0x46eea5[_0xf20d('0x3d')][_0xf20d('0x4d')]?[{'all':!![]}]:undefined})['then'](function(_0x2f37aa){var _0x41f033=_0x46eea5[_0xf20d('0x59')][_0xf20d('0x33')]({'plain':!![]});if(!_0x41f033)throw new Error(_0xf20d('0x5a'));if(_0x41f033[_0xf20d('0x5b')]===_0xf20d('0x59')){var _0x2edff9=_0x2f37aa[_0xf20d('0x33')]({'plain':!![]});var _0x31dbc0=_0xf20d('0x34');return db[_0xf20d('0x5c')][_0xf20d('0x53')]({'where':{'name':_0x31dbc0,'userProfileId':_0x41f033[_0xf20d('0x5d')]},'raw':!![]})[_0xf20d('0x1f')](function(_0x235a51){if(_0x235a51&&_0x235a51[_0xf20d('0x5e')]===0x0){return db['UserProfileResource'][_0xf20d('0x58')]({'name':_0x2edff9[_0xf20d('0x38')],'resourceId':_0x2edff9['id'],'type':_0x235a51[_0xf20d('0x38')],'sectionId':_0x235a51['id']},{})['then'](function(){return _0x2f37aa;});}else{return _0x2f37aa;}})[_0xf20d('0x29')](function(_0xcecf6e){logger[_0xf20d('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xcecf6e);throw _0xcecf6e;});}return _0x2f37aa;});}})[_0xf20d('0x1f')](respondWithResult(_0x51e0b3,0xc9))[_0xf20d('0x29')](handleError(_0x51e0b3,null));};exports[_0xf20d('0x58')]=function(_0x4f398f,_0x1497dc,_0x43e81f){var _0x3c049e;return db['Trunk']['create'](_0x4f398f['body'],{'raw':!![]})[_0xf20d('0x1f')](function(_0x5af9f8){_0x3c049e=_0x5af9f8;return db[_0xf20d('0x4c')][_0xf20d('0x5f')]({'raw':!![]});})[_0xf20d('0x1f')](function(_0x3fa7e9){var _0x2d14c4=fs['readFileSync'](path[_0xf20d('0x60')](config[_0xf20d('0x61')],'server/files/templates/trunk.ejs'),'utf8');var _0x55f92f=fs[_0xf20d('0x62')](path[_0xf20d('0x60')](config[_0xf20d('0x61')],'server/files/templates/registry.ejs'),_0xf20d('0x63'));var _0x42e4f0=ejs[_0xf20d('0x64')](_0x2d14c4,{'trunks':_0x3fa7e9||[]});fs['writeFileSync'](_0xf20d('0x65'),_0x42e4f0);if(_0x3c049e[_0xf20d('0x66')]){var _0x4f203f=ejs[_0xf20d('0x64')](_0x55f92f,{'trunks':_0x3fa7e9||[]});fs['writeFileSync'](_0xf20d('0x67'),_0x4f203f);}})[_0xf20d('0x1f')](function(){return respondWithRpcPromise('Reload',_0xf20d('0x58'),{'module':_0xf20d('0x68')});})[_0xf20d('0x1f')](function(){var _0x3fa4bf=_0x4f398f['user'][_0xf20d('0x33')]({'plain':!![]});if(!_0x3fa4bf)throw new Error(_0xf20d('0x5a'));if(_0x3fa4bf['role']===_0xf20d('0x59')){var _0x5e9315=_0x3c049e[_0xf20d('0x33')]({'plain':!![]});return db[_0xf20d('0x5c')]['find']({'where':{'name':_0xf20d('0x34'),'userProfileId':_0x3fa4bf[_0xf20d('0x5d')]},'raw':!![]})[_0xf20d('0x1f')](function(_0x30d817){if(_0x30d817&&_0x30d817[_0xf20d('0x5e')]===0x0){return db[_0xf20d('0x35')][_0xf20d('0x58')]({'name':_0x5e9315[_0xf20d('0x38')],'resourceId':_0x5e9315['id'],'type':_0x30d817[_0xf20d('0x38')],'sectionId':_0x30d817['id']},{})[_0xf20d('0x1f')](function(){return _0x3c049e;});}else{return _0x3c049e;}})['catch'](function(_0x848d3b){logger[_0xf20d('0x25')](_0xf20d('0x69'),_0x848d3b);throw _0x848d3b;});}return _0x3c049e;})['then'](respondWithResult(_0x1497dc,0xc9))[_0xf20d('0x29')](handleError(_0x1497dc,null));};exports[_0xf20d('0x31')]=function(_0x2c988f,_0x210f07,_0x53958b){var _0x35c87a;return db[_0xf20d('0x4c')][_0xf20d('0x53')]({'where':{'id':_0x2c988f['params']['id']}})[_0xf20d('0x1f')](handleEntityNotFound(_0x210f07,null))[_0xf20d('0x1f')](saveUpdates(_0x2c988f[_0xf20d('0x56')],null))[_0xf20d('0x1f')](function(_0x1cab94){if(_0x1cab94){_0x35c87a=_0x1cab94;return db[_0xf20d('0x4c')][_0xf20d('0x5f')]({'raw':!![]});}})[_0xf20d('0x1f')](function(_0x53880f){if(_0x53880f){var _0x34b361=fs['readFileSync'](path[_0xf20d('0x60')](config[_0xf20d('0x61')],_0xf20d('0x6a')),_0xf20d('0x63'));var _0x27f3ad=fs[_0xf20d('0x62')](path[_0xf20d('0x60')](config['root'],_0xf20d('0x6b')),_0xf20d('0x63'));var _0x1483de=ejs[_0xf20d('0x64')](_0x34b361,{'trunks':_0x53880f||[]});fs['writeFileSync'](_0xf20d('0x65'),_0x1483de);var _0x3d3b96=ejs[_0xf20d('0x64')](_0x27f3ad,{'trunks':_0x53880f||[]});fs['writeFileSync'](_0xf20d('0x67'),_0x3d3b96);return respondWithRpcPromise('Reload',_0xf20d('0x31'),{'module':_0xf20d('0x68')});}return null;})[_0xf20d('0x1f')](function(_0x54d661){if(_0x54d661){return _0x35c87a;}})[_0xf20d('0x1f')](respondWithResult(_0x210f07,null))['catch'](handleError(_0x210f07,null));};exports[_0xf20d('0x32')]=function(_0x5430be,_0x2b78ba,_0x400889){var _0x585fa6;return db[_0xf20d('0x4c')][_0xf20d('0x53')]({'where':{'id':_0x5430be['params']['id']}})[_0xf20d('0x1f')](handleEntityNotFound(_0x2b78ba,null))[_0xf20d('0x1f')](removeEntity(_0x2b78ba,null))[_0xf20d('0x1f')](function(){return db['Trunk'][_0xf20d('0x5f')]({'raw':!![]});})[_0xf20d('0x1f')](function(_0x41d87b){var _0x409953=fs[_0xf20d('0x62')](path[_0xf20d('0x60')](config[_0xf20d('0x61')],_0xf20d('0x6a')),'utf8');var _0xe2ae7a=fs[_0xf20d('0x62')](path[_0xf20d('0x60')](config['root'],_0xf20d('0x6b')),_0xf20d('0x63'));var _0x20d078=ejs[_0xf20d('0x64')](_0x409953,{'trunks':_0x41d87b});var _0x400375=ejs[_0xf20d('0x64')](_0xe2ae7a,{'trunks':_0x41d87b});fs[_0xf20d('0x6c')]('/etc/asterisk/sip_xcally_trunks.conf',_0x20d078);fs[_0xf20d('0x6c')]('/etc/asterisk/sip_xcally_registers.conf',_0x400375);return respondWithRpcPromise(_0xf20d('0x6d'),_0xf20d('0x32'),{'module':_0xf20d('0x68')});})[_0xf20d('0x29')](handleError(_0x2b78ba,null));}; \ No newline at end of file +var _0x68a5=['updatedAt','body','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','root','server/files/templates/trunk.ejs','utf8','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','chan_sip.so','userProfileId','autoAssociation','update','Reload','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','error','code','Trunk,\x20%s,\x20%s','message','result','catch','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','destroy','get','Trunks','UserProfileResource','name','send','index','map','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','Trunk','includeAll','include','findAll','rows','show','params','rawAttributes','length','options','clone','find','omit'];(function(_0x346737,_0x3e6081){var _0x1ade2e=function(_0x15e50e){while(--_0x15e50e){_0x346737['push'](_0x346737['shift']());}};_0x1ade2e(++_0x3e6081);}(_0x68a5,0xfc));var _0x568a=function(_0x1f48fe,_0x4ad731){_0x1f48fe=_0x1f48fe-0x0;var _0xae69a5=_0x68a5[_0x1f48fe];return _0xae69a5;};'use strict';var pdf=require(_0x568a('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x568a('0x1'));var zipdir=require(_0x568a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x568a('0x3'));var moment=require(_0x568a('0x4'));var BPromise=require(_0x568a('0x5'));var Mustache=require(_0x568a('0x6'));var util=require('util');var path=require(_0x568a('0x7'));var sox=require('sox');var csv=require(_0x568a('0x8'));var ejs=require(_0x568a('0x9'));var fs=require('fs');var _=require(_0x568a('0xa'));var squel=require(_0x568a('0xb'));var crypto=require('crypto');var jsforce=require(_0x568a('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x568a('0x8'));var querystring=require(_0x568a('0xd'));var Papa=require(_0x568a('0xe'));var Redis=require(_0x568a('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x568a('0x10'));var hardwareService=require(_0x568a('0x11'));var logger=require('../../config/logger')(_0x568a('0x12'));var utils=require('../../config/utils');var config=require(_0x568a('0x13'));var db=require(_0x568a('0x14'))['db'];var jayson=require(_0x568a('0x15'));var client=jayson[_0x568a('0x16')][_0x568a('0x17')]({'port':0x232a});function checkPasswordPattern(_0x26901e,_0x23e286,_0x3a325a){if(_0x3a325a){var _0x441119=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x441119[_0x568a('0x18')](_0x23e286)){return _0x26901e;}else{throw new db[(_0x568a('0x19'))][(_0x568a('0x1a'))](_0x568a('0x1b'));}}else{return _0x26901e;}}function respondWithRpcPromise(_0x2c7b3c,_0x110ac2,_0x1f9cc4,_0x375bac){return new BPromise(function(_0x4e6f9a,_0x323bf3){var _0x573b17=_0x375bac||client;return _0x573b17[_0x568a('0x1c')](_0x2c7b3c,_0x1f9cc4)[_0x568a('0x1d')](function(_0x497ee0){logger[_0x568a('0x1e')]('Trunk,\x20%s,\x20%s',_0x110ac2,_0x568a('0x1f'));logger[_0x568a('0x20')](_0x568a('0x21'),_0x110ac2,_0x568a('0x1f'),JSON['stringify'](_0x497ee0));if(_0x497ee0[_0x568a('0x22')]){if(_0x497ee0['error'][_0x568a('0x23')]===0x1f4){logger[_0x568a('0x22')](_0x568a('0x24'),_0x110ac2,_0x497ee0[_0x568a('0x22')][_0x568a('0x25')]);return _0x323bf3(_0x497ee0[_0x568a('0x22')][_0x568a('0x25')]);}logger[_0x568a('0x22')]('Trunk,\x20%s,\x20%s',_0x110ac2,_0x497ee0[_0x568a('0x22')][_0x568a('0x25')]);return _0x4e6f9a(_0x497ee0['error'][_0x568a('0x25')]);}else{logger[_0x568a('0x1e')](_0x568a('0x24'),_0x110ac2,'request\x20sent');_0x4e6f9a(_0x497ee0[_0x568a('0x26')][_0x568a('0x25')]);}})[_0x568a('0x27')](function(_0x1df7ab){logger[_0x568a('0x22')](_0x568a('0x24'),_0x110ac2,_0x1df7ab);_0x323bf3(_0x1df7ab);});});}function respondWithStatusCode(_0x1dcda2,_0x38e03a){_0x38e03a=_0x38e03a||0xcc;return function(_0x2df7d6){if(_0x2df7d6){return _0x1dcda2['sendStatus'](_0x38e03a);}return _0x1dcda2[_0x568a('0x28')](_0x38e03a)[_0x568a('0x29')]();};}function respondWithResult(_0x3e7b42,_0x22b097){_0x22b097=_0x22b097||0xc8;return function(_0x45f7e8){if(_0x45f7e8){return _0x3e7b42[_0x568a('0x28')](_0x22b097)['json'](_0x45f7e8);}};}function respondWithFilteredResult(_0x473ba8,_0x3d14ab){return function(_0x1575d6){if(_0x1575d6){var _0x23d444=_0x1575d6[_0x568a('0x2a')],_0x20498b=_0x3d14ab[_0x568a('0x2b')],_0x5911f4=_0x3d14ab[_0x568a('0x2b')]+_0x3d14ab[_0x568a('0x2c')],_0x460b31;if(_0x5911f4>=_0x23d444){_0x5911f4=_0x23d444;_0x460b31=0xc8;}else{_0x460b31=0xce;}_0x473ba8[_0x568a('0x28')](_0x460b31);return _0x473ba8[_0x568a('0x2d')](_0x568a('0x2e'),_0x20498b+'-'+_0x5911f4+'/'+_0x23d444)[_0x568a('0x2f')](_0x1575d6);}return null;};}function patchUpdates(_0x464d34){return function(_0x4fa7b5){try{jsonpatch[_0x568a('0x30')](_0x4fa7b5,_0x464d34,!![]);}catch(_0x1f1bed){return BPromise[_0x568a('0x31')](_0x1f1bed);}return _0x4fa7b5[_0x568a('0x32')]();};}function saveUpdates(_0x435840,_0xb91e39){return function(_0x56d499){if(_0x56d499){return _0x56d499['update'](_0x435840)['then'](function(_0x12391c){return _0x12391c;});}return null;};}function removeEntity(_0x153792,_0x143dcd){return function(_0xd55530){if(_0xd55530){return _0xd55530[_0x568a('0x33')]()['then'](function(){var _0x54ebd4=_0xd55530[_0x568a('0x34')]({'plain':!![]});var _0x370dc5=_0x568a('0x35');return db[_0x568a('0x36')][_0x568a('0x33')]({'where':{'type':_0x370dc5,'resourceId':_0x54ebd4['id']}})['then'](function(){return _0xd55530;});})[_0x568a('0x1d')](function(){_0x153792['status'](0xcc)[_0x568a('0x29')]();});}};}function handleEntityNotFound(_0x40ed0,_0x4d16ee){return function(_0xff4d14){if(!_0xff4d14){_0x40ed0['sendStatus'](0x194);}return _0xff4d14;};}function handleError(_0x5d7e8a,_0x3fbd33){_0x3fbd33=_0x3fbd33||0x1f4;return function(_0x3dabf9){logger['error'](_0x3dabf9['stack']);if(_0x3dabf9[_0x568a('0x37')]){delete _0x3dabf9[_0x568a('0x37')];}_0x5d7e8a[_0x568a('0x28')](_0x3fbd33)[_0x568a('0x38')](_0x3dabf9);};}exports[_0x568a('0x39')]=function(_0x458f84,_0x247215){var _0x57902d={},_0x52df42={},_0x2d7a88={'count':0x0,'rows':[]};var _0x176196=_[_0x568a('0x3a')](db['Trunk']['rawAttributes'],function(_0x3ba130){return{'name':_0x3ba130[_0x568a('0x3b')],'type':_0x3ba130['type'][_0x568a('0x3c')]};});_0x52df42[_0x568a('0x3d')]=_['map'](_0x176196,_0x568a('0x37'));_0x52df42[_0x568a('0x3e')]=_[_0x568a('0x3f')](_0x458f84[_0x568a('0x3e')]);_0x52df42[_0x568a('0x40')]=_[_0x568a('0x41')](_0x52df42['model'],_0x52df42['query']);_0x57902d[_0x568a('0x42')]=_[_0x568a('0x41')](_0x52df42[_0x568a('0x3d')],qs[_0x568a('0x43')](_0x458f84[_0x568a('0x3e')][_0x568a('0x43')]));_0x57902d[_0x568a('0x42')]=_0x57902d[_0x568a('0x42')]['length']?_0x57902d[_0x568a('0x42')]:_0x52df42[_0x568a('0x3d')];if(!_0x458f84[_0x568a('0x3e')][_0x568a('0x44')](_0x568a('0x45'))){_0x57902d['limit']=qs[_0x568a('0x2c')](_0x458f84['query'][_0x568a('0x2c')]);_0x57902d[_0x568a('0x2b')]=qs[_0x568a('0x2b')](_0x458f84[_0x568a('0x3e')][_0x568a('0x2b')]);}_0x57902d[_0x568a('0x46')]=qs[_0x568a('0x47')](_0x458f84['query'][_0x568a('0x47')]);_0x57902d[_0x568a('0x48')]=qs[_0x568a('0x40')](_['pick'](_0x458f84[_0x568a('0x3e')],_0x52df42['filters']),_0x176196);if(_0x458f84['query'][_0x568a('0x49')]){_0x57902d['where']=_[_0x568a('0x4a')](_0x57902d[_0x568a('0x48')],{'$or':_['map'](_0x176196,function(_0x2bd33c){if(_0x2bd33c[_0x568a('0x4b')]!==_0x568a('0x4c')){var _0x243f8b={};_0x243f8b[_0x2bd33c[_0x568a('0x37')]]={'$like':'%'+_0x458f84['query'][_0x568a('0x49')]+'%'};return _0x243f8b;}})});}_0x57902d=_[_0x568a('0x4a')]({},_0x57902d,_0x458f84['options']);var _0x3aecd6={'where':_0x57902d[_0x568a('0x48')]};return db[_0x568a('0x4d')][_0x568a('0x2a')](_0x3aecd6)[_0x568a('0x1d')](function(_0x3e224b){_0x2d7a88[_0x568a('0x2a')]=_0x3e224b;if(_0x458f84['query'][_0x568a('0x4e')]){_0x57902d[_0x568a('0x4f')]=[{'all':!![]}];}return db['Trunk'][_0x568a('0x50')](_0x57902d);})[_0x568a('0x1d')](function(_0x487439){_0x2d7a88[_0x568a('0x51')]=_0x487439;return _0x2d7a88;})['then'](respondWithFilteredResult(_0x247215,_0x57902d))[_0x568a('0x27')](handleError(_0x247215,null));};exports[_0x568a('0x52')]=function(_0x2e3dc7,_0x2fc1ac){var _0x3d408e={'raw':![],'where':{'id':_0x2e3dc7[_0x568a('0x53')]['id']}},_0x4a2f95={};_0x4a2f95[_0x568a('0x3d')]=_['keys'](db[_0x568a('0x4d')][_0x568a('0x54')]);_0x4a2f95[_0x568a('0x3e')]=_[_0x568a('0x3f')](_0x2e3dc7['query']);_0x4a2f95[_0x568a('0x40')]=_[_0x568a('0x41')](_0x4a2f95[_0x568a('0x3d')],_0x4a2f95[_0x568a('0x3e')]);_0x3d408e[_0x568a('0x42')]=_[_0x568a('0x41')](_0x4a2f95[_0x568a('0x3d')],qs[_0x568a('0x43')](_0x2e3dc7['query'][_0x568a('0x43')]));_0x3d408e[_0x568a('0x42')]=_0x3d408e[_0x568a('0x42')][_0x568a('0x55')]?_0x3d408e[_0x568a('0x42')]:_0x4a2f95['model'];if(_0x2e3dc7[_0x568a('0x3e')][_0x568a('0x4e')]){_0x3d408e[_0x568a('0x4f')]=[{'all':!![]}];}_0x3d408e=_[_0x568a('0x4a')]({},_0x3d408e,_0x2e3dc7[_0x568a('0x56')]);return db[_0x568a('0x4d')]['find'](_0x3d408e)[_0x568a('0x1d')](handleEntityNotFound(_0x2fc1ac,null))[_0x568a('0x1d')](respondWithResult(_0x2fc1ac,null))[_0x568a('0x27')](handleError(_0x2fc1ac,null));};exports[_0x568a('0x57')]=function(_0x3a1342,_0x15212b){var _0x336e41={'where':{'id':_0x3a1342[_0x568a('0x53')]['id']}},_0x44a0ee={};_0x44a0ee[_0x568a('0x3d')]=_[_0x568a('0x3f')](db[_0x568a('0x4d')][_0x568a('0x54')]);_0x336e41[_0x568a('0x42')]=_[_0x568a('0x41')](_0x44a0ee[_0x568a('0x3d')],qs[_0x568a('0x43')](_0x3a1342['query'][_0x568a('0x43')]));_0x336e41['attributes']=_0x336e41[_0x568a('0x42')]['length']?_0x336e41['attributes']:_0x44a0ee[_0x568a('0x3d')];if(_0x3a1342['query']['includeAll']){_0x336e41[_0x568a('0x4f')]=[{'all':!![]}];}_0x336e41=_['merge']({},_0x336e41,_0x3a1342[_0x568a('0x56')]);return db[_0x568a('0x4d')][_0x568a('0x58')](_0x336e41)[_0x568a('0x1d')](handleEntityNotFound(_0x15212b,null))['then'](function(_0x7e57c6){if(_0x7e57c6){var _0x21647f=_0x7e57c6[_0x568a('0x34')]({'plain':!![]});_0x21647f=qs[_0x568a('0x59')](_0x21647f,['id','createdAt',_0x568a('0x5a')]);_0x3a1342[_0x568a('0x5b')]=_[_0x568a('0x59')](_0x3a1342['body'],['id','createdAt',_0x568a('0x5a')]);return db[_0x568a('0x4d')][_0x568a('0x5c')](_['merge'](_0x21647f,_0x3a1342['body']),{'include':_0x3a1342[_0x568a('0x3e')]['includeAll']?[{'all':!![]}]:undefined})[_0x568a('0x1d')](function(_0x318bc0){var _0x4fada5=_0x3a1342[_0x568a('0x5d')][_0x568a('0x34')]({'plain':!![]});if(!_0x4fada5)throw new Error(_0x568a('0x5e'));if(_0x4fada5[_0x568a('0x5f')]===_0x568a('0x5d')){var _0x19c517=_0x318bc0[_0x568a('0x34')]({'plain':!![]});var _0x2b5f37=_0x568a('0x35');return db[_0x568a('0x60')][_0x568a('0x58')]({'where':{'name':_0x2b5f37,'userProfileId':_0x4fada5['userProfileId']},'raw':!![]})[_0x568a('0x1d')](function(_0x5e3195){if(_0x5e3195&&_0x5e3195['autoAssociation']===0x0){return db[_0x568a('0x36')][_0x568a('0x5c')]({'name':_0x19c517['name'],'resourceId':_0x19c517['id'],'type':_0x5e3195['name'],'sectionId':_0x5e3195['id']},{})[_0x568a('0x1d')](function(){return _0x318bc0;});}else{return _0x318bc0;}})['catch'](function(_0x5550d4){logger[_0x568a('0x22')](_0x568a('0x61'),_0x5550d4);throw _0x5550d4;});}return _0x318bc0;});}})[_0x568a('0x1d')](respondWithResult(_0x15212b,0xc9))[_0x568a('0x27')](handleError(_0x15212b,null));};exports[_0x568a('0x5c')]=function(_0x4cd948,_0x2e9673,_0x5c73cc){var _0x1f0754;return db['Trunk'][_0x568a('0x5c')](_0x4cd948[_0x568a('0x5b')],{'raw':!![]})['then'](function(_0x433d54){_0x1f0754=_0x433d54;return db[_0x568a('0x4d')][_0x568a('0x50')]({'raw':!![]});})[_0x568a('0x1d')](function(_0x5d0c80){var _0x17c09c=fs[_0x568a('0x62')](path[_0x568a('0x63')](config[_0x568a('0x64')],_0x568a('0x65')),_0x568a('0x66'));var _0x5d732c=fs['readFileSync'](path['join'](config[_0x568a('0x64')],_0x568a('0x67')),_0x568a('0x66'));var _0x36ca99=ejs[_0x568a('0x68')](_0x17c09c,{'trunks':_0x5d0c80||[]});fs[_0x568a('0x69')](_0x568a('0x6a'),_0x36ca99);if(_0x1f0754[_0x568a('0x6b')]){var _0x2b42e3=ejs[_0x568a('0x68')](_0x5d732c,{'trunks':_0x5d0c80||[]});fs[_0x568a('0x69')](_0x568a('0x6c'),_0x2b42e3);}})[_0x568a('0x1d')](function(){return respondWithRpcPromise('Reload',_0x568a('0x5c'),{'module':_0x568a('0x6d')});})['then'](function(){var _0x536b8c=_0x4cd948[_0x568a('0x5d')][_0x568a('0x34')]({'plain':!![]});if(!_0x536b8c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x536b8c[_0x568a('0x5f')]===_0x568a('0x5d')){var _0x557e0a=_0x1f0754['get']({'plain':!![]});return db[_0x568a('0x60')][_0x568a('0x58')]({'where':{'name':_0x568a('0x35'),'userProfileId':_0x536b8c[_0x568a('0x6e')]},'raw':!![]})[_0x568a('0x1d')](function(_0x8e4beb){if(_0x8e4beb&&_0x8e4beb[_0x568a('0x6f')]===0x0){return db[_0x568a('0x36')][_0x568a('0x5c')]({'name':_0x557e0a[_0x568a('0x37')],'resourceId':_0x557e0a['id'],'type':_0x8e4beb[_0x568a('0x37')],'sectionId':_0x8e4beb['id']},{})[_0x568a('0x1d')](function(){return _0x1f0754;});}else{return _0x1f0754;}})[_0x568a('0x27')](function(_0xca80a3){logger[_0x568a('0x22')](_0x568a('0x61'),_0xca80a3);throw _0xca80a3;});}return _0x1f0754;})[_0x568a('0x1d')](respondWithResult(_0x2e9673,0xc9))[_0x568a('0x27')](handleError(_0x2e9673,null));};exports[_0x568a('0x70')]=function(_0x2e0d52,_0x913351,_0x3a28ac){var _0x381033;return db[_0x568a('0x4d')][_0x568a('0x58')]({'where':{'id':_0x2e0d52['params']['id']}})['then'](handleEntityNotFound(_0x913351,null))[_0x568a('0x1d')](saveUpdates(_0x2e0d52['body'],null))[_0x568a('0x1d')](function(_0x19fa2b){if(_0x19fa2b){_0x381033=_0x19fa2b;return db[_0x568a('0x4d')]['findAll']({'raw':!![]});}})[_0x568a('0x1d')](function(_0x5a529a){if(_0x5a529a){var _0x12ba68=fs[_0x568a('0x62')](path[_0x568a('0x63')](config[_0x568a('0x64')],_0x568a('0x65')),_0x568a('0x66'));var _0x59e3c9=fs[_0x568a('0x62')](path[_0x568a('0x63')](config[_0x568a('0x64')],'server/files/templates/registry.ejs'),_0x568a('0x66'));var _0x24fee4=ejs[_0x568a('0x68')](_0x12ba68,{'trunks':_0x5a529a||[]});fs['writeFileSync'](_0x568a('0x6a'),_0x24fee4);var _0xa334de=ejs['render'](_0x59e3c9,{'trunks':_0x5a529a||[]});fs[_0x568a('0x69')](_0x568a('0x6c'),_0xa334de);return respondWithRpcPromise(_0x568a('0x71'),_0x568a('0x70'),{'module':_0x568a('0x6d')});}return null;})[_0x568a('0x1d')](function(_0x4f86e8){if(_0x4f86e8){return _0x381033;}})[_0x568a('0x1d')](respondWithResult(_0x913351,null))[_0x568a('0x27')](handleError(_0x913351,null));};exports[_0x568a('0x33')]=function(_0x184f59,_0x358865,_0x950be){var _0x40aa08;return db[_0x568a('0x4d')]['find']({'where':{'id':_0x184f59[_0x568a('0x53')]['id']}})[_0x568a('0x1d')](handleEntityNotFound(_0x358865,null))[_0x568a('0x1d')](removeEntity(_0x358865,null))[_0x568a('0x1d')](function(){return db['Trunk'][_0x568a('0x50')]({'raw':!![]});})[_0x568a('0x1d')](function(_0x4bffa5){var _0x2ab6f2=fs[_0x568a('0x62')](path['join'](config['root'],_0x568a('0x65')),_0x568a('0x66'));var _0x3feac9=fs[_0x568a('0x62')](path['join'](config[_0x568a('0x64')],_0x568a('0x67')),_0x568a('0x66'));var _0x182f8b=ejs['render'](_0x2ab6f2,{'trunks':_0x4bffa5});var _0x3f230e=ejs[_0x568a('0x68')](_0x3feac9,{'trunks':_0x4bffa5});fs[_0x568a('0x69')](_0x568a('0x6a'),_0x182f8b);fs['writeFileSync'](_0x568a('0x6c'),_0x3f230e);return respondWithRpcPromise('Reload',_0x568a('0x33'),{'module':_0x568a('0x6d')});})[_0x568a('0x27')](handleError(_0x358865,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 296733f..7b8c28a 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 _0xcd5c=['./trunk.attributes','exports','define','Trunk','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0xb7c348,_0x39ab13){var _0x1cf9a0=function(_0x10fe57){while(--_0x10fe57){_0xb7c348['push'](_0xb7c348['shift']());}};_0x1cf9a0(++_0x39ab13);}(_0xcd5c,0x86));var _0xccd5=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xcd5c[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0xccd5('0x0'));var util=require(_0xccd5('0x1'));var logger=require(_0xccd5('0x2'))(_0xccd5('0x3'));var moment=require(_0xccd5('0x4'));var BPromise=require('bluebird');var rp=require(_0xccd5('0x5'));var fs=require('fs');var path=require(_0xccd5('0x6'));var rimraf=require(_0xccd5('0x7'));var config=require(_0xccd5('0x8'));var attributes=require(_0xccd5('0x9'));module[_0xccd5('0xa')]=function(_0x3a1aa8,_0x11d5c2){return _0x3a1aa8[_0xccd5('0xb')](_0xccd5('0xc'),attributes,{'tableName':'tools_trunks','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8852=['rimraf','./trunk.attributes','exports','define','Trunk','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x4fbe52,_0x30f3f8){var _0x363cca=function(_0x821e67){while(--_0x821e67){_0x4fbe52['push'](_0x4fbe52['shift']());}};_0x363cca(++_0x30f3f8);}(_0x8852,0xb9));var _0x2885=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x8852[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require(_0x2885('0x0'));var util=require(_0x2885('0x1'));var logger=require(_0x2885('0x2'))(_0x2885('0x3'));var moment=require(_0x2885('0x4'));var BPromise=require(_0x2885('0x5'));var rp=require(_0x2885('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2885('0x7'));var config=require('../../config/environment');var attributes=require(_0x2885('0x8'));module[_0x2885('0x9')]=function(_0x558deb,_0x17ecb8){return _0x558deb[_0x2885('0xa')](_0x2885('0xb'),attributes,{'tableName':'tools_trunks','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trunk/trunk.rpc.js b/server/api/trunk/trunk.rpc.js index a946bdd..c0b2783 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 _0x2032=['error','code','message','info','result','catch','GetTrunk','Trunk','options','raw','where','map','model','attributes','include','stringify','ShowTrunk','find','then','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','Trunk,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x1c9fc5,_0x3ca335){var _0x4eea03=function(_0x191625){while(--_0x191625){_0x1c9fc5['push'](_0x1c9fc5['shift']());}};_0x4eea03(++_0x3ca335);}(_0x2032,0xd9));var _0x2203=function(_0x5b4d9f,_0x4f15a8){_0x5b4d9f=_0x5b4d9f-0x0;var _0x274091=_0x2032[_0x5b4d9f];return _0x274091;};'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')]('Trunk,\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')]('Trunk,\x20%s,\x20%s',_0x2676aa,_0x10f055['error']['message']);return _0x2999ed(_0x10f055['error']['message']);}logger[_0x2203('0xe')]('Trunk,\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);});});}exports[_0x2203('0x14')]=function(_0x4893ff){var _0x3f9ef6=this;return new Promise(function(_0x8906e1,_0x4aeb9f){return db[_0x2203('0x15')]['findAll']({'raw':_0x4893ff[_0x2203('0x16')]?_0x4893ff[_0x2203('0x16')][_0x2203('0x17')]===undefined?!![]:![]:!![],'where':_0x4893ff[_0x2203('0x16')]?_0x4893ff[_0x2203('0x16')][_0x2203('0x18')]||null:null,'attributes':_0x4893ff['options']?_0x4893ff[_0x2203('0x16')]['attributes']||null:null,'limit':_0x4893ff['options']?_0x4893ff[_0x2203('0x16')]['limit']||null:null,'include':_0x4893ff[_0x2203('0x16')]?_0x4893ff[_0x2203('0x16')]['include']?_[_0x2203('0x19')](_0x4893ff['options']['include'],function(_0x226374){return{'model':db[_0x226374[_0x2203('0x1a')]],'as':_0x226374['as'],'attributes':_0x226374[_0x2203('0x1b')],'include':_0x226374[_0x2203('0x1c')]?_[_0x2203('0x19')](_0x226374[_0x2203('0x1c')],function(_0x49c12){return{'model':db[_0x49c12[_0x2203('0x1a')]],'as':_0x49c12['as'],'attributes':_0x49c12['attributes'],'include':_0x49c12[_0x2203('0x1c')]?_[_0x2203('0x19')](_0x49c12[_0x2203('0x1c')],function(_0x5f11bf){return{'model':db[_0x5f11bf[_0x2203('0x1a')]],'as':_0x5f11bf['as'],'attributes':_0x5f11bf[_0x2203('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xd6e109){logger[_0x2203('0x11')](_0x2203('0x14'),_0x4893ff);logger[_0x2203('0xd')](_0x2203('0x14'),_0x4893ff,JSON[_0x2203('0x1d')](_0xd6e109));_0x8906e1(_0xd6e109);})[_0x2203('0x13')](function(_0x5a95c1){logger[_0x2203('0xe')](_0x2203('0x14'),_0x5a95c1[_0x2203('0x10')],_0x4893ff);_0x4aeb9f(_0x3f9ef6[_0x2203('0xe')](0x1f4,_0x5a95c1['message']));});});};exports[_0x2203('0x1e')]=function(_0x21ff0d){var _0x287c95=this;return new Promise(function(_0xf59954,_0x520602){return db[_0x2203('0x15')][_0x2203('0x1f')]({'raw':_0x21ff0d['options']?_0x21ff0d['options'][_0x2203('0x17')]===undefined?!![]:![]:!![],'where':_0x21ff0d['options']?_0x21ff0d['options'][_0x2203('0x18')]||null:null,'attributes':_0x21ff0d[_0x2203('0x16')]?_0x21ff0d[_0x2203('0x16')][_0x2203('0x1b')]||null:null,'include':_0x21ff0d[_0x2203('0x16')]?_0x21ff0d['options'][_0x2203('0x1c')]?_[_0x2203('0x19')](_0x21ff0d['options'][_0x2203('0x1c')],function(_0x20fbe1){return{'model':db[_0x20fbe1[_0x2203('0x1a')]],'as':_0x20fbe1['as'],'attributes':_0x20fbe1[_0x2203('0x1b')],'include':_0x20fbe1[_0x2203('0x1c')]?_[_0x2203('0x19')](_0x20fbe1[_0x2203('0x1c')],function(_0x44228e){return{'model':db[_0x44228e[_0x2203('0x1a')]],'as':_0x44228e['as'],'attributes':_0x44228e['attributes'],'include':_0x44228e[_0x2203('0x1c')]?_[_0x2203('0x19')](_0x44228e['include'],function(_0x54b90b){return{'model':db[_0x54b90b[_0x2203('0x1a')]],'as':_0x54b90b['as'],'attributes':_0x54b90b['attributes']};}):[]};}):[]};}):[]:[]})[_0x2203('0x20')](function(_0x3b1eeb){logger[_0x2203('0x11')]('ShowTrunk',_0x21ff0d);logger['debug'](_0x2203('0x1e'),_0x21ff0d,JSON['stringify'](_0x3b1eeb));_0xf59954(_0x3b1eeb);})[_0x2203('0x13')](function(_0x5cfe5e){logger[_0x2203('0xe')]('ShowTrunk',_0x5cfe5e[_0x2203('0x10')],_0x21ff0d);_0x520602(_0x287c95[_0x2203('0xe')](0x1f4,_0x5cfe5e[_0x2203('0x10')]));});});}; \ No newline at end of file +var _0x5eb8=['where','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','error','message','catch','Trunk','findAll','options','raw','limit','include','model','attributes','map','then','GetTrunk','stringify','ShowTrunk'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0x5eb8,0xb0));var _0x85eb=function(_0x1d7791,_0x2a291f){_0x1d7791=_0x1d7791-0x0;var _0x2293f8=_0x5eb8[_0x1d7791];return _0x2293f8;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x85eb('0x0'));var BPromise=require(_0x85eb('0x1'));var rs=require(_0x85eb('0x2'));var fs=require('fs');var Redis=require(_0x85eb('0x3'));var db=require(_0x85eb('0x4'))['db'];var utils=require(_0x85eb('0x5'));var logger=require(_0x85eb('0x6'))(_0x85eb('0x7'));var config=require(_0x85eb('0x8'));var jayson=require(_0x85eb('0x9'));var client=jayson[_0x85eb('0xa')][_0x85eb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4a8814,_0x16d7b9,_0x3af658){return new BPromise(function(_0x448345,_0x5cd4ec){return client[_0x85eb('0xc')](_0x4a8814,_0x3af658)['then'](function(_0x1f0036){logger[_0x85eb('0xd')](_0x85eb('0xe'),_0x16d7b9,_0x85eb('0xf'));logger[_0x85eb('0x10')](_0x85eb('0x11'),_0x16d7b9,_0x85eb('0xf'),JSON['stringify'](_0x1f0036));if(_0x1f0036[_0x85eb('0x12')]){if(_0x1f0036[_0x85eb('0x12')]['code']===0x1f4){logger[_0x85eb('0x12')](_0x85eb('0xe'),_0x16d7b9,_0x1f0036[_0x85eb('0x12')][_0x85eb('0x13')]);return _0x5cd4ec(_0x1f0036['error']['message']);}logger[_0x85eb('0x12')]('Trunk,\x20%s,\x20%s',_0x16d7b9,_0x1f0036[_0x85eb('0x12')][_0x85eb('0x13')]);return _0x448345(_0x1f0036[_0x85eb('0x12')][_0x85eb('0x13')]);}else{logger[_0x85eb('0xd')]('Trunk,\x20%s,\x20%s',_0x16d7b9,_0x85eb('0xf'));_0x448345(_0x1f0036['result'][_0x85eb('0x13')]);}})[_0x85eb('0x14')](function(_0x3e23e8){logger[_0x85eb('0x12')]('Trunk,\x20%s,\x20%s',_0x16d7b9,_0x3e23e8);_0x5cd4ec(_0x3e23e8);});});}exports['GetTrunk']=function(_0x50d2a8){var _0xe198ca=this;return new Promise(function(_0x39ca96,_0x10cf2f){return db[_0x85eb('0x15')][_0x85eb('0x16')]({'raw':_0x50d2a8[_0x85eb('0x17')]?_0x50d2a8['options'][_0x85eb('0x18')]===undefined?!![]:![]:!![],'where':_0x50d2a8[_0x85eb('0x17')]?_0x50d2a8[_0x85eb('0x17')]['where']||null:null,'attributes':_0x50d2a8['options']?_0x50d2a8['options']['attributes']||null:null,'limit':_0x50d2a8[_0x85eb('0x17')]?_0x50d2a8[_0x85eb('0x17')][_0x85eb('0x19')]||null:null,'include':_0x50d2a8[_0x85eb('0x17')]?_0x50d2a8[_0x85eb('0x17')][_0x85eb('0x1a')]?_['map'](_0x50d2a8['options']['include'],function(_0x298e84){return{'model':db[_0x298e84[_0x85eb('0x1b')]],'as':_0x298e84['as'],'attributes':_0x298e84[_0x85eb('0x1c')],'include':_0x298e84[_0x85eb('0x1a')]?_[_0x85eb('0x1d')](_0x298e84[_0x85eb('0x1a')],function(_0x5dfc96){return{'model':db[_0x5dfc96[_0x85eb('0x1b')]],'as':_0x5dfc96['as'],'attributes':_0x5dfc96[_0x85eb('0x1c')],'include':_0x5dfc96[_0x85eb('0x1a')]?_[_0x85eb('0x1d')](_0x5dfc96[_0x85eb('0x1a')],function(_0x57a03c){return{'model':db[_0x57a03c[_0x85eb('0x1b')]],'as':_0x57a03c['as'],'attributes':_0x57a03c[_0x85eb('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x85eb('0x1e')](function(_0x3e7eb9){logger[_0x85eb('0xd')](_0x85eb('0x1f'),_0x50d2a8);logger['debug']('GetTrunk',_0x50d2a8,JSON[_0x85eb('0x20')](_0x3e7eb9));_0x39ca96(_0x3e7eb9);})['catch'](function(_0xa9b14f){logger['error'](_0x85eb('0x1f'),_0xa9b14f[_0x85eb('0x13')],_0x50d2a8);_0x10cf2f(_0xe198ca[_0x85eb('0x12')](0x1f4,_0xa9b14f[_0x85eb('0x13')]));});});};exports[_0x85eb('0x21')]=function(_0xf4ac13){var _0x41ed76=this;return new Promise(function(_0x5decd5,_0x237f19){return db[_0x85eb('0x15')]['find']({'raw':_0xf4ac13[_0x85eb('0x17')]?_0xf4ac13['options']['raw']===undefined?!![]:![]:!![],'where':_0xf4ac13[_0x85eb('0x17')]?_0xf4ac13[_0x85eb('0x17')][_0x85eb('0x22')]||null:null,'attributes':_0xf4ac13[_0x85eb('0x17')]?_0xf4ac13[_0x85eb('0x17')][_0x85eb('0x1c')]||null:null,'include':_0xf4ac13[_0x85eb('0x17')]?_0xf4ac13[_0x85eb('0x17')][_0x85eb('0x1a')]?_[_0x85eb('0x1d')](_0xf4ac13['options'][_0x85eb('0x1a')],function(_0x3a5b87){return{'model':db[_0x3a5b87['model']],'as':_0x3a5b87['as'],'attributes':_0x3a5b87['attributes'],'include':_0x3a5b87[_0x85eb('0x1a')]?_[_0x85eb('0x1d')](_0x3a5b87[_0x85eb('0x1a')],function(_0x12cb4c){return{'model':db[_0x12cb4c[_0x85eb('0x1b')]],'as':_0x12cb4c['as'],'attributes':_0x12cb4c[_0x85eb('0x1c')],'include':_0x12cb4c[_0x85eb('0x1a')]?_[_0x85eb('0x1d')](_0x12cb4c[_0x85eb('0x1a')],function(_0x373e5f){return{'model':db[_0x373e5f[_0x85eb('0x1b')]],'as':_0x373e5f['as'],'attributes':_0x373e5f[_0x85eb('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x85eb('0x1e')](function(_0x33605a){logger['info'](_0x85eb('0x21'),_0xf4ac13);logger[_0x85eb('0x10')]('ShowTrunk',_0xf4ac13,JSON['stringify'](_0x33605a));_0x5decd5(_0x33605a);})[_0x85eb('0x14')](function(_0xe22d16){logger['error'](_0x85eb('0x21'),_0xe22d16['message'],_0xf4ac13);_0x237f19(_0x41ed76[_0x85eb('0x12')](0x1f4,_0xe22d16['message']));});});}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 7922c3f..4654438 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 _0x1092=['diskStorage','join','root','server/files/images/','format','now','single','file','/:id/login','/:id/logout','/:id/pause','pause','/:id/unpause','addTeams','/:id/chat_interactions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','addMailAccounts','addOpenchannelAccounts','addChatWebsites','/:id/api_key','put','update','/:id/password','delete','removeQueues','removeTeams','destroy','removeChatInteractions','removeSmsInteractions','/:id/openchannel_interactions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeChatWebsites','removeSquareProjects','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','/describe','isAuthenticated','whoami','/:id','show','/:id/avatar','getAvatar','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','/:id/sms/interactions','/:id/fax/interactions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','/:id/lists','getLists','getAgents','/:id/prefixes','getVoicePrefixes','getFaxAccounts','/:id/mail_accounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/square_projects','getSquareProjects','/:id/scheduled_calls','getApiKey','/create_many','bulkCreate','post','addContacts','create','addQueues'];(function(_0x3949b4,_0x40ebeb){var _0x1b2036=function(_0xb8f97){while(--_0xb8f97){_0x3949b4['push'](_0x3949b4['shift']());}};_0x1b2036(++_0x40ebeb);}(_0x1092,0x1d6));var _0x2109=function(_0x3170eb,_0x22dddd){_0x3170eb=_0x3170eb-0x0;var _0x58948e=_0x1092[_0x3170eb];return _0x58948e;};'use strict';var multer=require('multer');var util=require(_0x2109('0x0'));var path=require(_0x2109('0x1'));var timeout=require(_0x2109('0x2'));var express=require(_0x2109('0x3'));var router=express[_0x2109('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x2109('0x5'));var config=require(_0x2109('0x6'));var controller=require('./user.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x2109('0x7')](_0x2109('0x8'),auth[_0x2109('0x9')](),controller['describe']);router[_0x2109('0x7')]('/whoami',auth[_0x2109('0x9')](),controller[_0x2109('0xa')]);router[_0x2109('0x7')](_0x2109('0xb'),auth[_0x2109('0x9')](),controller[_0x2109('0xc')]);router['get'](_0x2109('0xd'),controller[_0x2109('0xe')]);router[_0x2109('0x7')](_0x2109('0xf'),auth[_0x2109('0x9')](),controller[_0x2109('0x10')]);router[_0x2109('0x7')](_0x2109('0x11'),auth[_0x2109('0x9')](),controller[_0x2109('0x12')]);router[_0x2109('0x7')](_0x2109('0x13'),auth[_0x2109('0x9')](),controller[_0x2109('0x14')]);router[_0x2109('0x7')](_0x2109('0x15'),auth[_0x2109('0x9')](),controller['getGroups']);router[_0x2109('0x7')](_0x2109('0x16'),auth[_0x2109('0x9')](),controller[_0x2109('0x17')]);router[_0x2109('0x7')](_0x2109('0x18'),auth[_0x2109('0x9')](),controller[_0x2109('0x19')]);router['get']('/:id/chat/interactions',auth[_0x2109('0x9')](),controller[_0x2109('0x1a')]);router[_0x2109('0x7')](_0x2109('0x1b'),auth[_0x2109('0x9')](),controller[_0x2109('0x1c')]);router[_0x2109('0x7')](_0x2109('0x1d'),auth[_0x2109('0x9')](),controller['getMailInteractions']);router[_0x2109('0x7')](_0x2109('0x1e'),auth[_0x2109('0x9')](),controller['getSmsInteractions']);router[_0x2109('0x7')](_0x2109('0x1f'),auth[_0x2109('0x9')](),controller['getFaxInteractions']);router[_0x2109('0x7')](_0x2109('0x20'),auth['isAuthenticated'](),controller[_0x2109('0x21')]);router[_0x2109('0x7')](_0x2109('0x22'),auth[_0x2109('0x9')](),controller['getTeams']);router['get'](_0x2109('0x23'),auth[_0x2109('0x9')](),controller[_0x2109('0x24')]);router[_0x2109('0x7')]('/:id/agents',auth[_0x2109('0x9')](),controller[_0x2109('0x25')]);router[_0x2109('0x7')](_0x2109('0x26'),auth[_0x2109('0x9')](),controller[_0x2109('0x27')]);router[_0x2109('0x7')]('/:id/fax_accounts',auth['isAuthenticated'](),controller[_0x2109('0x28')]);router[_0x2109('0x7')](_0x2109('0x29'),auth['isAuthenticated'](),controller['getMailAccounts']);router[_0x2109('0x7')](_0x2109('0x2a'),auth[_0x2109('0x9')](),controller[_0x2109('0x2b')]);router[_0x2109('0x7')](_0x2109('0x2c'),auth[_0x2109('0x9')](),controller[_0x2109('0x2d')]);router[_0x2109('0x7')](_0x2109('0x2e'),auth['isAuthenticated'](),controller[_0x2109('0x2f')]);router[_0x2109('0x7')](_0x2109('0x30'),auth['isAuthenticated'](),controller[_0x2109('0x31')]);router[_0x2109('0x7')](_0x2109('0x32'),auth[_0x2109('0x9')](),controller[_0x2109('0x33')]);router[_0x2109('0x7')](_0x2109('0x34'),auth[_0x2109('0x9')](),controller['getScheduledCalls']);router[_0x2109('0x7')]('/:id/api_key',auth['isAuthenticated'](),controller[_0x2109('0x35')]);router['post'](_0x2109('0x36'),auth[_0x2109('0x9')](),controller[_0x2109('0x37')]);router[_0x2109('0x38')](_0x2109('0xf'),auth['isAuthenticated'](),controller[_0x2109('0x39')]);router[_0x2109('0x38')]('/',auth['isAuthenticated'](),controller[_0x2109('0x3a')]);router[_0x2109('0x38')](_0x2109('0x11'),auth[_0x2109('0x9')](),controller[_0x2109('0x3b')]);var upload=multer({'storage':multer[_0x2109('0x3c')]({'destination':function(_0x5c55c1,_0x2b6dee,_0x35b063){_0x35b063(null,path[_0x2109('0x3d')](config[_0x2109('0x3e')],_0x2109('0x3f')));},'filename':function(_0x386618,_0x4af2ec,_0x5cc04f){_0x5cc04f(null,util[_0x2109('0x40')]('%s-%s',Date[_0x2109('0x41')](),_0x4af2ec['originalname']));}})});router[_0x2109('0x38')](_0x2109('0xd'),upload[_0x2109('0x42')](_0x2109('0x43')),controller['addAvatar']);router[_0x2109('0x38')](_0x2109('0x44'),auth[_0x2109('0x9')](),controller['login']);router['post'](_0x2109('0x45'),auth[_0x2109('0x9')](),controller['logout']);router['post'](_0x2109('0x46'),auth[_0x2109('0x9')](),controller[_0x2109('0x47')]);router['post'](_0x2109('0x48'),auth[_0x2109('0x9')](),controller['unpause']);router['post'](_0x2109('0x22'),auth['isAuthenticated'](),controller[_0x2109('0x49')]);router[_0x2109('0x38')](_0x2109('0x4a'),auth['isAuthenticated'](),controller['addChatInteractions']);router[_0x2109('0x38')](_0x2109('0x4b'),auth['isAuthenticated'](),controller[_0x2109('0x4c')]);router['post'](_0x2109('0x4d'),auth[_0x2109('0x9')](),controller[_0x2109('0x4e')]);router[_0x2109('0x38')](_0x2109('0x4f'),auth[_0x2109('0x9')](),controller[_0x2109('0x50')]);router['post']('/:id/openchannel_interactions',auth[_0x2109('0x9')](),controller[_0x2109('0x51')]);router[_0x2109('0x38')](_0x2109('0x52'),auth[_0x2109('0x9')](),controller[_0x2109('0x53')]);router[_0x2109('0x38')]('/:id/fax_accounts',auth[_0x2109('0x9')](),controller[_0x2109('0x54')]);router['post'](_0x2109('0x29'),auth[_0x2109('0x9')](),controller[_0x2109('0x55')]);router['post'](_0x2109('0x2a'),auth[_0x2109('0x9')](),controller[_0x2109('0x56')]);router[_0x2109('0x38')](_0x2109('0x2c'),auth['isAuthenticated'](),controller['addSmsAccounts']);router[_0x2109('0x38')]('/:id/chat_websites',auth[_0x2109('0x9')](),controller[_0x2109('0x57')]);router[_0x2109('0x38')](_0x2109('0x30'),auth['isAuthenticated'](),controller['addWhatsappAccounts']);router[_0x2109('0x38')](_0x2109('0x32'),auth[_0x2109('0x9')](),controller['addSquareProjects']);router[_0x2109('0x38')](_0x2109('0x58'),auth[_0x2109('0x9')](),controller['createApiKey']);router[_0x2109('0x59')](_0x2109('0xb'),auth['isAuthenticated'](),controller[_0x2109('0x5a')]);router[_0x2109('0x59')](_0x2109('0x5b'),auth[_0x2109('0x9')](),controller['changePassword']);router[_0x2109('0x5c')](_0x2109('0x11'),auth[_0x2109('0x9')](),controller[_0x2109('0x5d')]);router[_0x2109('0x5c')](_0x2109('0x22'),auth['isAuthenticated'](),controller[_0x2109('0x5e')]);router[_0x2109('0x5c')](_0x2109('0xb'),auth[_0x2109('0x9')](),controller[_0x2109('0x5f')]);router[_0x2109('0x5c')](_0x2109('0x4a'),auth['isAuthenticated'](),controller[_0x2109('0x60')]);router[_0x2109('0x5c')](_0x2109('0x4b'),auth[_0x2109('0x9')](),controller['removeMailInteractions']);router[_0x2109('0x5c')]('/:id/fax_interactions',auth[_0x2109('0x9')](),controller['removeFaxInteractions']);router[_0x2109('0x5c')]('/:id/sms_interactions',auth['isAuthenticated'](),controller[_0x2109('0x61')]);router[_0x2109('0x5c')](_0x2109('0x62'),auth[_0x2109('0x9')](),controller['removeOpenchannelInteractions']);router[_0x2109('0x5c')]('/:id/whatsapp_interactions',auth[_0x2109('0x9')](),controller[_0x2109('0x63')]);router[_0x2109('0x5c')]('/:id/fax_accounts',auth[_0x2109('0x9')](),controller[_0x2109('0x64')]);router[_0x2109('0x5c')](_0x2109('0x29'),auth[_0x2109('0x9')](),controller[_0x2109('0x65')]);router[_0x2109('0x5c')]('/:id/openchannel_accounts',auth[_0x2109('0x9')](),controller[_0x2109('0x66')]);router[_0x2109('0x5c')](_0x2109('0x2c'),auth[_0x2109('0x9')](),controller['removeSmsAccounts']);router[_0x2109('0x5c')]('/:id/chat_websites',auth[_0x2109('0x9')](),controller[_0x2109('0x67')]);router[_0x2109('0x5c')](_0x2109('0x30'),auth['isAuthenticated'](),controller['removeWhatsappAccounts']);router['delete']('/:id/square_projects',auth[_0x2109('0x9')](),controller[_0x2109('0x68')]);router[_0x2109('0x5c')](_0x2109('0x58'),auth[_0x2109('0x9')](),controller['removeApiKey']);module[_0x2109('0x69')]=router; \ No newline at end of file +var _0xe5ee=['/:id/square_projects','getSquareProjects','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','post','/create_many','bulkCreate','addContacts','addQueues','diskStorage','root','server/files/images/','%s-%s','originalname','single','file','addAvatar','/:id/login','/:id/logout','logout','/:id/pause','pause','unpause','/:id/teams','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','/:id/mail_accounts','addMailAccounts','addOpenchannelAccounts','addSmsAccounts','/:id/chat_websites','addWhatsappAccounts','addSquareProjects','createApiKey','put','update','/:id/password','changePassword','delete','removeQueues','removeTeams','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeSquareProjects','removeApiKey','multer','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','get','isAuthenticated','/describe','describe','/whoami','whoami','/:id','show','/:id/avatar','getAvatar','/:id/contacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','getTeams','/:id/lists','/:id/agents','/:id/prefixes','/:id/fax_accounts','getFaxAccounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getChatWebsites','getWhatsappAccounts'];(function(_0x1b98d2,_0x233692){var _0x3a9e2b=function(_0x5a4ef5){while(--_0x5a4ef5){_0x1b98d2['push'](_0x1b98d2['shift']());}};_0x3a9e2b(++_0x233692);}(_0xe5ee,0x12a));var _0xee5e=function(_0x4fafaa,_0x3eab38){_0x4fafaa=_0x4fafaa-0x0;var _0x5b75ea=_0xe5ee[_0x4fafaa];return _0x5b75ea;};'use strict';var multer=require(_0xee5e('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xee5e('0x1'));var express=require(_0xee5e('0x2'));var router=express['Router']();var auth=require(_0xee5e('0x3'));var interaction=require(_0xee5e('0x4'));var config=require(_0xee5e('0x5'));var controller=require(_0xee5e('0x6'));router[_0xee5e('0x7')]('/',auth[_0xee5e('0x8')](),controller['index']);router[_0xee5e('0x7')](_0xee5e('0x9'),auth[_0xee5e('0x8')](),controller[_0xee5e('0xa')]);router[_0xee5e('0x7')](_0xee5e('0xb'),auth[_0xee5e('0x8')](),controller[_0xee5e('0xc')]);router['get'](_0xee5e('0xd'),auth[_0xee5e('0x8')](),controller[_0xee5e('0xe')]);router['get'](_0xee5e('0xf'),controller[_0xee5e('0x10')]);router[_0xee5e('0x7')](_0xee5e('0x11'),auth['isAuthenticated'](),controller['getContacts']);router[_0xee5e('0x7')](_0xee5e('0x12'),auth['isAuthenticated'](),controller[_0xee5e('0x13')]);router[_0xee5e('0x7')](_0xee5e('0x14'),auth[_0xee5e('0x8')](),controller[_0xee5e('0x15')]);router[_0xee5e('0x7')](_0xee5e('0x16'),auth[_0xee5e('0x8')](),controller[_0xee5e('0x17')]);router['get'](_0xee5e('0x18'),auth[_0xee5e('0x8')](),controller[_0xee5e('0x19')]);router[_0xee5e('0x7')](_0xee5e('0x1a'),auth[_0xee5e('0x8')](),controller[_0xee5e('0x1b')]);router[_0xee5e('0x7')]('/:id/chat/interactions',auth[_0xee5e('0x8')](),controller[_0xee5e('0x1c')]);router['get'](_0xee5e('0x1d'),auth[_0xee5e('0x8')](),controller[_0xee5e('0x1e')]);router[_0xee5e('0x7')](_0xee5e('0x1f'),auth[_0xee5e('0x8')](),controller[_0xee5e('0x20')]);router[_0xee5e('0x7')](_0xee5e('0x21'),auth[_0xee5e('0x8')](),controller['getSmsInteractions']);router['get'](_0xee5e('0x22'),auth['isAuthenticated'](),controller[_0xee5e('0x23')]);router[_0xee5e('0x7')](_0xee5e('0x24'),auth[_0xee5e('0x8')](),controller[_0xee5e('0x25')]);router[_0xee5e('0x7')]('/:id/teams',auth[_0xee5e('0x8')](),controller[_0xee5e('0x26')]);router['get'](_0xee5e('0x27'),auth[_0xee5e('0x8')](),controller['getLists']);router[_0xee5e('0x7')](_0xee5e('0x28'),auth[_0xee5e('0x8')](),controller['getAgents']);router[_0xee5e('0x7')](_0xee5e('0x29'),auth['isAuthenticated'](),controller['getVoicePrefixes']);router[_0xee5e('0x7')](_0xee5e('0x2a'),auth[_0xee5e('0x8')](),controller[_0xee5e('0x2b')]);router[_0xee5e('0x7')]('/:id/mail_accounts',auth[_0xee5e('0x8')](),controller[_0xee5e('0x2c')]);router[_0xee5e('0x7')](_0xee5e('0x2d'),auth[_0xee5e('0x8')](),controller[_0xee5e('0x2e')]);router[_0xee5e('0x7')](_0xee5e('0x2f'),auth[_0xee5e('0x8')](),controller['getSmsAccounts']);router[_0xee5e('0x7')]('/:id/chat_websites',auth[_0xee5e('0x8')](),controller[_0xee5e('0x30')]);router[_0xee5e('0x7')]('/:id/whatsapp_accounts',auth[_0xee5e('0x8')](),controller[_0xee5e('0x31')]);router[_0xee5e('0x7')](_0xee5e('0x32'),auth[_0xee5e('0x8')](),controller[_0xee5e('0x33')]);router[_0xee5e('0x7')](_0xee5e('0x34'),auth[_0xee5e('0x8')](),controller[_0xee5e('0x35')]);router[_0xee5e('0x7')](_0xee5e('0x36'),auth[_0xee5e('0x8')](),controller['getApiKey']);router[_0xee5e('0x37')](_0xee5e('0x38'),auth[_0xee5e('0x8')](),controller[_0xee5e('0x39')]);router[_0xee5e('0x37')](_0xee5e('0x11'),auth[_0xee5e('0x8')](),controller[_0xee5e('0x3a')]);router[_0xee5e('0x37')]('/',auth[_0xee5e('0x8')](),controller['create']);router['post'](_0xee5e('0x12'),auth[_0xee5e('0x8')](),controller[_0xee5e('0x3b')]);var upload=multer({'storage':multer[_0xee5e('0x3c')]({'destination':function(_0x4a6944,_0x3842bc,_0x5c3193){_0x5c3193(null,path['join'](config[_0xee5e('0x3d')],_0xee5e('0x3e')));},'filename':function(_0x9bf1d2,_0x30be1b,_0x43b1fc){_0x43b1fc(null,util['format'](_0xee5e('0x3f'),Date['now'](),_0x30be1b[_0xee5e('0x40')]));}})});router[_0xee5e('0x37')](_0xee5e('0xf'),upload[_0xee5e('0x41')](_0xee5e('0x42')),controller[_0xee5e('0x43')]);router[_0xee5e('0x37')](_0xee5e('0x44'),auth[_0xee5e('0x8')](),controller['login']);router[_0xee5e('0x37')](_0xee5e('0x45'),auth[_0xee5e('0x8')](),controller[_0xee5e('0x46')]);router[_0xee5e('0x37')](_0xee5e('0x47'),auth['isAuthenticated'](),controller[_0xee5e('0x48')]);router['post']('/:id/unpause',auth[_0xee5e('0x8')](),controller[_0xee5e('0x49')]);router[_0xee5e('0x37')](_0xee5e('0x4a'),auth[_0xee5e('0x8')](),controller[_0xee5e('0x4b')]);router['post'](_0xee5e('0x4c'),auth[_0xee5e('0x8')](),controller[_0xee5e('0x4d')]);router[_0xee5e('0x37')](_0xee5e('0x4e'),auth[_0xee5e('0x8')](),controller[_0xee5e('0x4f')]);router[_0xee5e('0x37')](_0xee5e('0x50'),auth[_0xee5e('0x8')](),controller[_0xee5e('0x51')]);router[_0xee5e('0x37')](_0xee5e('0x52'),auth[_0xee5e('0x8')](),controller[_0xee5e('0x53')]);router['post'](_0xee5e('0x54'),auth['isAuthenticated'](),controller['addOpenchannelInteractions']);router[_0xee5e('0x37')](_0xee5e('0x55'),auth[_0xee5e('0x8')](),controller[_0xee5e('0x56')]);router[_0xee5e('0x37')](_0xee5e('0x2a'),auth[_0xee5e('0x8')](),controller[_0xee5e('0x57')]);router[_0xee5e('0x37')](_0xee5e('0x58'),auth[_0xee5e('0x8')](),controller[_0xee5e('0x59')]);router[_0xee5e('0x37')](_0xee5e('0x2d'),auth[_0xee5e('0x8')](),controller[_0xee5e('0x5a')]);router[_0xee5e('0x37')](_0xee5e('0x2f'),auth[_0xee5e('0x8')](),controller[_0xee5e('0x5b')]);router['post'](_0xee5e('0x5c'),auth[_0xee5e('0x8')](),controller['addChatWebsites']);router['post']('/:id/whatsapp_accounts',auth[_0xee5e('0x8')](),controller[_0xee5e('0x5d')]);router['post'](_0xee5e('0x32'),auth[_0xee5e('0x8')](),controller[_0xee5e('0x5e')]);router['post'](_0xee5e('0x36'),auth[_0xee5e('0x8')](),controller[_0xee5e('0x5f')]);router[_0xee5e('0x60')](_0xee5e('0xd'),auth[_0xee5e('0x8')](),controller[_0xee5e('0x61')]);router[_0xee5e('0x60')](_0xee5e('0x62'),auth['isAuthenticated'](),controller[_0xee5e('0x63')]);router[_0xee5e('0x64')]('/:id/queues',auth['isAuthenticated'](),controller[_0xee5e('0x65')]);router['delete'](_0xee5e('0x4a'),auth[_0xee5e('0x8')](),controller[_0xee5e('0x66')]);router[_0xee5e('0x64')](_0xee5e('0xd'),auth['isAuthenticated'](),controller['destroy']);router[_0xee5e('0x64')]('/:id/chat_interactions',auth[_0xee5e('0x8')](),controller['removeChatInteractions']);router[_0xee5e('0x64')](_0xee5e('0x4e'),auth[_0xee5e('0x8')](),controller[_0xee5e('0x67')]);router[_0xee5e('0x64')]('/:id/fax_interactions',auth[_0xee5e('0x8')](),controller[_0xee5e('0x68')]);router[_0xee5e('0x64')](_0xee5e('0x52'),auth['isAuthenticated'](),controller[_0xee5e('0x69')]);router[_0xee5e('0x64')](_0xee5e('0x54'),auth[_0xee5e('0x8')](),controller[_0xee5e('0x6a')]);router[_0xee5e('0x64')](_0xee5e('0x55'),auth[_0xee5e('0x8')](),controller[_0xee5e('0x6b')]);router[_0xee5e('0x64')](_0xee5e('0x2a'),auth['isAuthenticated'](),controller[_0xee5e('0x6c')]);router['delete'](_0xee5e('0x58'),auth[_0xee5e('0x8')](),controller[_0xee5e('0x6d')]);router['delete'](_0xee5e('0x2d'),auth[_0xee5e('0x8')](),controller[_0xee5e('0x6e')]);router['delete'](_0xee5e('0x2f'),auth[_0xee5e('0x8')](),controller[_0xee5e('0x6f')]);router[_0xee5e('0x64')](_0xee5e('0x5c'),auth[_0xee5e('0x8')](),controller[_0xee5e('0x70')]);router[_0xee5e('0x64')]('/:id/whatsapp_accounts',auth[_0xee5e('0x8')](),controller[_0xee5e('0x71')]);router[_0xee5e('0x64')](_0xee5e('0x32'),auth[_0xee5e('0x8')](),controller[_0xee5e('0x72')]);router['delete'](_0xee5e('0x36'),auth[_0xee5e('0x8')](),controller[_0xee5e('0x73')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 8e349de..7b3b521 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 _0x35de=['actpass','showWebBar','get','isArray','wss','avpf','force_avp','icesupport','dtlsenable','dtlsprivatekey','rtcp_mux','encryption','dtlscertfile','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blocked','blockedAt','sequelize','moment','util','exports','STRING','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','fullname','format','\x22%s\x22\x20<%s>','getDataValue','internal','email','ENUM','admin','user','local','INTEGER','callerid','BOOLEAN','DATE','DEFAULT\x20PAUSE','friend','peer','ALLOWED_PASSED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','join','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','shortinfo','auto','yes','nonat','update','outgoing','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','\x22\x22\x20<>','accept','originate','uas','fingerprint','certificate','active'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x35de,0x161));var _0xe35d=function(_0x5a2285,_0x3212d1){_0x5a2285=_0x5a2285-0x0;var _0x48f6ed=_0x35de[_0x5a2285];return _0x48f6ed;};'use strict';var Sequelize=require(_0xe35d('0x0'));var moment=require(_0xe35d('0x1'));var util=require(_0xe35d('0x2'));var _=require('lodash');module[_0xe35d('0x3')]={'name':{'type':Sequelize[_0xe35d('0x4')],'allowNull':![],'unique':_0xe35d('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x4900b2){this[_0xe35d('0x6')](_0xe35d('0x5'),_0x4900b2);this[_0xe35d('0x6')](_0xe35d('0x7'),_0x4900b2);},'comment':_0xe35d('0x8')},'fullname':{'type':Sequelize[_0xe35d('0x4')],'allowNull':![],'set':function(_0x2777e3){this[_0xe35d('0x6')](_0xe35d('0x9'),_0x2777e3);this[_0xe35d('0x6')]('callerid',util[_0xe35d('0xa')](_0xe35d('0xb'),_0x2777e3,this[_0xe35d('0xc')](_0xe35d('0xd'))));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xe35d('0xe'),'validate':{'isEmail':!![]},'set':function(_0x264500){if(_0x264500){this[_0xe35d('0x6')](_0xe35d('0xe'),_0x264500['toLowerCase']());}}},'role':{'type':Sequelize[_0xe35d('0xf')](_0xe35d('0x10'),_0xe35d('0x11'),'agent','telephone'),'allowNull':![]},'password':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0xe35d('0x4')],'defaultValue':_0xe35d('0x12')},'internal':{'type':Sequelize[_0xe35d('0x13')](0xb),'allowNull':![],'unique':'internal','set':function(_0x2885a8){this[_0xe35d('0x6')](_0xe35d('0xd'),_0x2885a8);this[_0xe35d('0x6')]('accountcode',_0x2885a8);this[_0xe35d('0x6')](_0xe35d('0x14'),util[_0xe35d('0xa')](_0xe35d('0xb'),this['getDataValue']('fullname'),_0x2885a8));}},'salt':{'type':Sequelize[_0xe35d('0x4')]},'phone':{'type':Sequelize[_0xe35d('0x4')]},'mobile':{'type':Sequelize[_0xe35d('0x4')]},'address':{'type':Sequelize[_0xe35d('0x4')]},'zipcode':{'type':Sequelize[_0xe35d('0x4')]},'userpic':{'type':Sequelize[_0xe35d('0x4')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0xe35d('0x4')]},'online':{'type':Sequelize[_0xe35d('0x15')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0xe35d('0x16')]},'voicePause':{'type':Sequelize[_0xe35d('0x15')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0xe35d('0x15')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0xe35d('0x15')],'defaultValue':![]},'faxPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsPause':{'type':Sequelize[_0xe35d('0x15')],'defaultValue':![]},'whatsappPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0xe35d('0x15')],'defaultValue':![]},'pauseType':{'type':Sequelize['STRING'],'defaultValue':_0xe35d('0x17')},'lastPauseAt':{'type':Sequelize[_0xe35d('0x16')]},'chatCapacity':{'type':Sequelize[_0xe35d('0x13')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0xe35d('0x13')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0xe35d('0x13')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0xe35d('0x13')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0xe35d('0x13')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0xe35d('0x13')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0xe35d('0x15')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0xe35d('0x13')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0xe35d('0x13')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0xe35d('0x15')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0xe35d('0x13')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0xe35d('0x15')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0xe35d('0x15')],'defaultValue':![]},'chanspy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0xe35d('0x4')],'allowNull':!![]},'host':{'type':Sequelize[_0xe35d('0x4')],'allowNull':!![],'defaultValue':'dynamic'},'ipaddr':{'type':Sequelize[_0xe35d('0x4')],'allowNull':!![]},'port':{'type':Sequelize[_0xe35d('0x13')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0xe35d('0x13')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0xe35d('0x4')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0xe35d('0x4')],'allowNull':!![]},'lastms':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0xe35d('0xf')](_0xe35d('0x18'),_0xe35d('0x11'),_0xe35d('0x19')),'allowNull':!![],'defaultValue':_0xe35d('0x18')},'context':{'type':Sequelize[_0xe35d('0x4')],'allowNull':!![],'defaultValue':'from-sip'},'callingpres':{'type':Sequelize[_0xe35d('0xf')]('ALLOWED_NOT_SCREENED',_0xe35d('0x1a'),'ALLOWED_FAILED_SCREEN','ALLOWED',_0xe35d('0x1b'),_0xe35d('0x1c'),_0xe35d('0x1d'),_0xe35d('0x1e')),'allowNull':!![]},'deny':{'type':Sequelize[_0xe35d('0x4')],'allowNull':!![]},'permit':{'type':Sequelize[_0xe35d('0x4')],'allowNull':!![]},'secret':{'type':Sequelize[_0xe35d('0x4')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0xe35d('0x4')],'allowNull':!![]},'remotesecret':{'type':Sequelize['STRING'],'allowNull':!![]},'transport':{'type':Sequelize[_0xe35d('0x4')],'allowNull':!![],'defaultValue':_0xe35d('0x1f'),'set':function(_0x2c02f5){this['setDataValue']('transport',_0x2c02f5?_0x2c02f5[_0xe35d('0x20')](','):null);},'get':function(){return this[_0xe35d('0xc')](_0xe35d('0x21'))?this[_0xe35d('0xc')](_0xe35d('0x21'))[_0xe35d('0x22')](','):null;},'comment':_0xe35d('0x23')},'dtmfmode':{'type':Sequelize[_0xe35d('0xf')]('rfc2833','info',_0xe35d('0x24'),'inband',_0xe35d('0x25')),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0xe35d('0xf')](_0xe35d('0x26'),'no',_0xe35d('0x27'),_0xe35d('0x28'),_0xe35d('0x29')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0xe35d('0x26'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xe35d('0x4')],'allowNull':!![]},'directmediadeny':{'type':Sequelize['STRING'],'allowNull':!![]},'nat':{'type':Sequelize[_0xe35d('0x4')],'allowNull':!![],'defaultValue':'force_rport,comedia','set':function(_0x239fc7){this[_0xe35d('0x6')](_0xe35d('0x2a'),_0x239fc7?_0x239fc7[_0xe35d('0x20')](','):null);},'get':function(){return this[_0xe35d('0xc')](_0xe35d('0x2a'))?this[_0xe35d('0xc')]('nat')[_0xe35d('0x22')](','):null;},'comment':_0xe35d('0x2b')},'callgroup':{'type':Sequelize[_0xe35d('0x4')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0xe35d('0x4')]},'namedpickupgroup':{'type':Sequelize[_0xe35d('0x4')]},'language':{'type':Sequelize[_0xe35d('0x4')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xe35d('0x4')]},'disallow':{'type':Sequelize[_0xe35d('0x4')],'allowNull':![],'defaultValue':_0xe35d('0x2c')},'allow':{'type':Sequelize[_0xe35d('0x4')],'allowNull':![],'defaultValue':_0xe35d('0x2d'),'set':function(_0x383adc){this['setDataValue']('allow',_0x383adc?_0x383adc[_0xe35d('0x20')](';'):_0xe35d('0x2d'));},'get':function(){return this['getDataValue'](_0xe35d('0x2e'))?this[_0xe35d('0xc')](_0xe35d('0x2e'))[_0xe35d('0x22')](';'):null;},'comment':_0xe35d('0x2f')},'autoframing':{'type':Sequelize[_0xe35d('0xf')](_0xe35d('0x26'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0xe35d('0x4')],'allowNull':!![],'set':function(_0x8a928){this[_0xe35d('0x6')](_0xe35d('0x30'),_0x8a928?_0x8a928['join'](','):null);},'get':function(){return this[_0xe35d('0xc')](_0xe35d('0x30'))?this[_0xe35d('0xc')](_0xe35d('0x30'))[_0xe35d('0x22')](','):null;},'comment':_0xe35d('0x31')},'trustrpid':{'type':Sequelize[_0xe35d('0xf')](_0xe35d('0x26'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xe35d('0xf')]('yes','no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0xe35d('0xf')](_0xe35d('0x26'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0xe35d('0xf')](_0xe35d('0x26'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0xe35d('0x13')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0xe35d('0x4')],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xe35d('0x32')},'amaflags':{'type':Sequelize[_0xe35d('0x4')],'allowNull':!![]},'callcounter':{'type':Sequelize['ENUM'](_0xe35d('0x26'),'no'),'allowNull':!![],'defaultValue':_0xe35d('0x26')},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize['ENUM'](_0xe35d('0x26'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0xe35d('0xf')](_0xe35d('0x26'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0xe35d('0xf')](_0xe35d('0x26'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0xe35d('0xf')](_0xe35d('0x26'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0xe35d('0x4')],'allowNull':!![]},'template':{'type':Sequelize[_0xe35d('0x4')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0xe35d('0xf')](_0xe35d('0x26'),'no','always'),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM'](_0xe35d('0x26'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0xe35d('0x4')],'allowNull':!![]},'session_timers':{'type':Sequelize['ENUM'](_0xe35d('0x33'),'refuse',_0xe35d('0x34')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0xe35d('0x13')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0xe35d('0x13')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0xe35d('0xf')]('uac',_0xe35d('0x35')),'allowNull':!![],'defaultValue':_0xe35d('0x35')},'t38pt_usertpsource':{'type':Sequelize[_0xe35d('0x4')],'allowNull':!![]},'regexten':{'type':Sequelize[_0xe35d('0x4')],'allowNull':!![]},'fromdomain':{'type':Sequelize['STRING'],'allowNull':!![]},'fromuser':{'type':Sequelize[_0xe35d('0x4')],'allowNull':!![]},'qualify':{'type':Sequelize[_0xe35d('0xf')](_0xe35d('0x26'),'no'),'allowNull':!![],'defaultValue':_0xe35d('0x26')},'keepalive':{'type':Sequelize[_0xe35d('0x13')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultuser':{'type':Sequelize['STRING'],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0xe35d('0x13')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0xe35d('0x13')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM'](_0xe35d('0x26'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xe35d('0x4')],'allowNull':!![]},'callbackextension':{'type':Sequelize['STRING'],'allowNull':!![]},'timert1':{'type':Sequelize[_0xe35d('0x13')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0xe35d('0x13')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0xe35d('0x13')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0xe35d('0x4')],'allowNull':!![]},'contactdeny':{'type':Sequelize['STRING'],'allowNull':!![]},'contactacl':{'type':Sequelize[_0xe35d('0x4')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0xe35d('0x4')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0xe35d('0x13')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0xe35d('0xf')](_0xe35d('0x26'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0xe35d('0xf')](_0xe35d('0x26'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0xe35d('0xf')](_0xe35d('0x26'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM'](_0xe35d('0x26'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0xe35d('0xf')](_0xe35d('0x26'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0xe35d('0xf')](_0xe35d('0x26'),'no',_0xe35d('0x36'),_0xe35d('0x37')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0xe35d('0x13')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0xe35d('0x4')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0xe35d('0x4')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0xe35d('0x4')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0xe35d('0x4')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0xe35d('0x4')],'allowNull':!![]},'dtlssetup':{'type':Sequelize['ENUM'](_0xe35d('0x38'),'passive',_0xe35d('0x39')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xe35d('0x4')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0xe35d('0xf')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING'],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM'](_0xe35d('0x26'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0xe35d('0xf')](_0xe35d('0x26'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0xe35d('0x4')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0xe35d('0x4')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0xe35d('0x4')],'allowNull':!![]},'parkinglot':{'type':Sequelize['STRING'],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM']('yes','no','nonat','update','update,nonat'),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0xe35d('0x15')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0xe35d('0x4')]},'resetPasswordExpires':{'type':Sequelize[_0xe35d('0x16')]},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x1760d0){this[_0xe35d('0x6')](_0xe35d('0x3a'),_0x1760d0);var _0x1c942e=this[_0xe35d('0x3b')]({'plain':!![]});switch(_0x1760d0){case 0x0:case 0x1:var _0x3aa3ad=_0x1c942e[_0xe35d('0x21')]?_[_0xe35d('0x3c')](_0x1c942e[_0xe35d('0x21')])?_0x1c942e['transport'][_0xe35d('0x20')]():_0x1c942e[_0xe35d('0x21')]:_0xe35d('0x1f');if(_0x3aa3ad===_0xe35d('0x3d')){_0x3aa3ad=_0xe35d('0x1f');}this[_0xe35d('0x6')](_0xe35d('0x21'),_0x3aa3ad);this['setDataValue']('encryption','no');this['setDataValue'](_0xe35d('0x3e'),null);this[_0xe35d('0x6')](_0xe35d('0x3f'),null);this[_0xe35d('0x6')](_0xe35d('0x40'),null);this[_0xe35d('0x6')](_0xe35d('0x41'),null);this[_0xe35d('0x6')]('dtlsverify',null);this[_0xe35d('0x6')]('dtlssetup',null);this[_0xe35d('0x6')]('dtlscertfile',null);this[_0xe35d('0x6')](_0xe35d('0x42'),null);this[_0xe35d('0x6')](_0xe35d('0x43'),'no');break;case 0x2:this[_0xe35d('0x6')]('transport','wss');this[_0xe35d('0x6')](_0xe35d('0x44'),_0xe35d('0x26'));this[_0xe35d('0x6')](_0xe35d('0x3e'),'yes');this[_0xe35d('0x6')](_0xe35d('0x3f'),'yes');this[_0xe35d('0x6')](_0xe35d('0x40'),_0xe35d('0x26'));this[_0xe35d('0x6')](_0xe35d('0x41'),_0xe35d('0x26'));this[_0xe35d('0x6')]('dtlsverify','no');this[_0xe35d('0x6')]('dtlssetup',_0xe35d('0x39'));this[_0xe35d('0x6')](_0xe35d('0x45'),_0x1c942e[_0xe35d('0x45')]||_0xe35d('0x46'));this[_0xe35d('0x6')]('dtlsprivatekey',_0x1c942e[_0xe35d('0x42')]||_0xe35d('0x47'));this[_0xe35d('0x6')](_0xe35d('0x43'),_0xe35d('0x26'));break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x1b7fb5){this['setDataValue'](_0xe35d('0x48'),_0x1b7fb5?_0x1b7fb5[_0xe35d('0x20')](','):[]);},'get':function(){return this[_0xe35d('0xc')](_0xe35d('0x48'))?_[_0xe35d('0x49')](this[_0xe35d('0xc')](_0xe35d('0x48'))[_0xe35d('0x22')](','),function(_0x26cb0f){return parseInt(_0x26cb0f,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0xe35d('0x4')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0xe35d('0x4')]},'phoneBarBusyNumber':{'type':Sequelize[_0xe35d('0x4')]},'phoneBarUnconditional':{'type':Sequelize[_0xe35d('0x15')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0xe35d('0x15')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0xe35d('0x15')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0xe35d('0x15')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0xe35d('0x15')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0xe35d('0x15')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0xe35d('0x13')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize['STRING'],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0xe35d('0xf')]('yes','no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0xe35d('0x15')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0xe35d('0x4')]},'passwordResetAt':{'type':Sequelize['DATE'],'defaultValue':null},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0xe35d('0x4a')],'get':function(){return this[_0xe35d('0xc')](_0xe35d('0x4b'))?this[_0xe35d('0xc')](_0xe35d('0x4b')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0xe35d('0x15')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0xe35d('0x15')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0xe35d('0x15')],'defaultValue':![]},'interface':{'type':Sequelize[_0xe35d('0x4')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0xe35d('0x15')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0xe35d('0x4')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0xe35d('0x4')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0xe35d('0x15')],'defaultValue':![],'set':function(_0x546eea){if(typeof _0x546eea===_0xe35d('0x4c')){var _0x8b0e37=_0x546eea==='1'?!![]:_0x546eea==='0'?![]:_0x546eea===_0xe35d('0x4d')?!![]:_0x546eea===_0xe35d('0x4e')?![]:![];this[_0xe35d('0x6')](_0xe35d('0x4f'),_0x8b0e37);}else{this['setDataValue'](_0xe35d('0x4f'),_0x546eea);}}},'blocked':{'type':Sequelize[_0xe35d('0x15')],'defaultValue':![],'set':function(_0x5e1ba8){this[_0xe35d('0x6')](_0xe35d('0x50'),_0x5e1ba8);if(_0x5e1ba8===!![]){this['setDataValue'](_0xe35d('0x51'),moment());this[_0xe35d('0x6')]('loginAttempts',0x0);}else{this['setDataValue'](_0xe35d('0x51'),null);}}},'blockedAt':{'type':Sequelize[_0xe35d('0x16')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0xe35d('0x13')],'defaultValue':0x0},'disabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xaf01=['rtcp_mux','force_avp','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','true','false','screenrecording','blockedAt','loginAttempts','moment','util','lodash','STRING','name','setDataValue','defaultuser','callerid','format','\x22%s\x22\x20<%s>','internal','email','toLowerCase','user','agent','telephone','local','INTEGER','accountcode','getDataValue','DATE','BOOLEAN','dynamic','ENUM','friend','from-sip','ALLOWED_PASSED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB','udp','transport','split','rfc2833','info','inband','auto','yes','nonat','update','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','allow','join','ulaw;alaw;gsm','insecure','never','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas','fingerprint','certificate','passive','actpass','update,nonat','showWebBar','get','wss','encryption','avpf','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey'];(function(_0x367361,_0x311488){var _0x195d2d=function(_0x2b20a4){while(--_0x2b20a4){_0x367361['push'](_0x367361['shift']());}};_0x195d2d(++_0x311488);}(_0xaf01,0x161));var _0x1af0=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0xaf01[_0x36ed48];return _0x51c63a;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x1af0('0x0'));var util=require(_0x1af0('0x1'));var _=require(_0x1af0('0x2'));module['exports']={'name':{'type':Sequelize[_0x1af0('0x3')],'allowNull':![],'unique':_0x1af0('0x4'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x4ae3ed){this[_0x1af0('0x5')](_0x1af0('0x4'),_0x4ae3ed);this[_0x1af0('0x5')](_0x1af0('0x6'),_0x4ae3ed);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize[_0x1af0('0x3')],'allowNull':![],'set':function(_0x24faff){this[_0x1af0('0x5')]('fullname',_0x24faff);this['setDataValue'](_0x1af0('0x7'),util[_0x1af0('0x8')](_0x1af0('0x9'),_0x24faff,this['getDataValue'](_0x1af0('0xa'))));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x1af0('0x3')],'allowNull':![],'unique':_0x1af0('0xb'),'validate':{'isEmail':!![]},'set':function(_0x44a47f){if(_0x44a47f){this[_0x1af0('0x5')]('email',_0x44a47f[_0x1af0('0xc')]());}}},'role':{'type':Sequelize['ENUM']('admin',_0x1af0('0xd'),_0x1af0('0xe'),_0x1af0('0xf')),'allowNull':![]},'password':{'type':Sequelize[_0x1af0('0x3')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':_0x1af0('0x10')},'internal':{'type':Sequelize[_0x1af0('0x11')](0xb),'allowNull':![],'unique':_0x1af0('0xa'),'set':function(_0xf303b8){this[_0x1af0('0x5')](_0x1af0('0xa'),_0xf303b8);this[_0x1af0('0x5')](_0x1af0('0x12'),_0xf303b8);this['setDataValue'](_0x1af0('0x7'),util[_0x1af0('0x8')](_0x1af0('0x9'),this[_0x1af0('0x13')]('fullname'),_0xf303b8));}},'salt':{'type':Sequelize[_0x1af0('0x3')]},'phone':{'type':Sequelize[_0x1af0('0x3')]},'mobile':{'type':Sequelize[_0x1af0('0x3')]},'address':{'type':Sequelize[_0x1af0('0x3')]},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize[_0x1af0('0x3')]},'city':{'type':Sequelize[_0x1af0('0x3')]},'country':{'type':Sequelize['STRING']},'online':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x1af0('0x14')]},'voicePause':{'type':Sequelize[_0x1af0('0x15')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x1af0('0x15')],'defaultValue':![]},'mailPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x1af0('0x15')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x1af0('0x15')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x1af0('0x15')],'defaultValue':![]},'pauseType':{'type':Sequelize['STRING'],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize['DATE']},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x1af0('0x11')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x1af0('0x11')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x1af0('0x11')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x1af0('0x15')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x1af0('0x11')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x1af0('0x11')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x1af0('0x11')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x1af0('0x15')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x1af0('0x15')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x1af0('0x15')],'defaultValue':![]},'description':{'type':Sequelize[_0x1af0('0x3')],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x1af0('0x16')},'ipaddr':{'type':Sequelize['STRING'],'allowNull':!![]},'port':{'type':Sequelize[_0x1af0('0x11')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x1af0('0x11')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x1af0('0x3')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0x1af0('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x1af0('0x11')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x1af0('0x17')]('friend',_0x1af0('0xd'),'peer'),'allowNull':!![],'defaultValue':_0x1af0('0x18')},'context':{'type':Sequelize[_0x1af0('0x3')],'allowNull':!![],'defaultValue':_0x1af0('0x19')},'callingpres':{'type':Sequelize['ENUM']('ALLOWED_NOT_SCREENED',_0x1af0('0x1a'),'ALLOWED_FAILED_SCREEN','ALLOWED',_0x1af0('0x1b'),_0x1af0('0x1c'),'PROHIB_FAILED_SCREEN',_0x1af0('0x1d')),'allowNull':!![]},'deny':{'type':Sequelize[_0x1af0('0x3')],'allowNull':!![]},'permit':{'type':Sequelize[_0x1af0('0x3')],'allowNull':!![]},'secret':{'type':Sequelize[_0x1af0('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x1af0('0x3')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x1af0('0x3')],'allowNull':!![]},'transport':{'type':Sequelize[_0x1af0('0x3')],'allowNull':!![],'defaultValue':_0x1af0('0x1e'),'set':function(_0x2da153){this[_0x1af0('0x5')]('transport',_0x2da153?_0x2da153['join'](','):null);},'get':function(){return this[_0x1af0('0x13')](_0x1af0('0x1f'))?this[_0x1af0('0x13')]('transport')[_0x1af0('0x20')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize['ENUM'](_0x1af0('0x21'),_0x1af0('0x22'),'shortinfo',_0x1af0('0x23'),_0x1af0('0x24')),'allowNull':!![],'defaultValue':_0x1af0('0x21')},'directmedia':{'type':Sequelize[_0x1af0('0x17')](_0x1af0('0x25'),'no',_0x1af0('0x26'),_0x1af0('0x27'),_0x1af0('0x28')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x1af0('0x17')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x1af0('0x3')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x1af0('0x3')],'allowNull':!![]},'nat':{'type':Sequelize[_0x1af0('0x3')],'allowNull':!![],'defaultValue':_0x1af0('0x29'),'set':function(_0x29a182){this[_0x1af0('0x5')]('nat',_0x29a182?_0x29a182['join'](','):null);},'get':function(){return this[_0x1af0('0x13')](_0x1af0('0x2a'))?this[_0x1af0('0x13')](_0x1af0('0x2a'))['split'](','):null;},'comment':_0x1af0('0x2b')},'callgroup':{'type':Sequelize[_0x1af0('0x3')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0x1af0('0x3')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x1af0('0x3')]},'disallow':{'type':Sequelize[_0x1af0('0x3')],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x489541){this[_0x1af0('0x5')](_0x1af0('0x2c'),_0x489541?_0x489541[_0x1af0('0x2d')](';'):_0x1af0('0x2e'));},'get':function(){return this[_0x1af0('0x13')](_0x1af0('0x2c'))?this[_0x1af0('0x13')](_0x1af0('0x2c'))['split'](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize[_0x1af0('0x17')]('yes','no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x1af0('0x3')],'allowNull':!![],'set':function(_0x18bb00){this[_0x1af0('0x5')](_0x1af0('0x2f'),_0x18bb00?_0x18bb00[_0x1af0('0x2d')](','):null);},'get':function(){return this[_0x1af0('0x13')](_0x1af0('0x2f'))?this['getDataValue'](_0x1af0('0x2f'))[_0x1af0('0x20')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x1af0('0x17')](_0x1af0('0x25'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x1af0('0x17')](_0x1af0('0x25'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0x1af0('0x25'),'no',_0x1af0('0x30')),'allowNull':!![]},'promiscredir':{'type':Sequelize['ENUM'](_0x1af0('0x25'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize['ENUM'](_0x1af0('0x25'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x1af0('0x11')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize['STRING'],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x1af0('0x31')},'amaflags':{'type':Sequelize[_0x1af0('0x3')],'allowNull':!![]},'callcounter':{'type':Sequelize['ENUM'](_0x1af0('0x25'),'no'),'allowNull':!![],'defaultValue':_0x1af0('0x25')},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize['ENUM'](_0x1af0('0x25'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x1af0('0x17')](_0x1af0('0x25'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x1af0('0x17')](_0x1af0('0x25'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x1af0('0x17')](_0x1af0('0x25'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize['STRING'],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x1af0('0x17')]('yes','no',_0x1af0('0x32')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x1af0('0x11')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x1af0('0x17')]('yes','no'),'allowNull':!![]},'mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x1af0('0x17')](_0x1af0('0x33'),_0x1af0('0x34'),_0x1af0('0x35')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x1af0('0x11')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x1af0('0x11')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x1af0('0x17')](_0x1af0('0x36'),_0x1af0('0x37')),'allowNull':!![],'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0x1af0('0x3')],'allowNull':!![]},'regexten':{'type':Sequelize['STRING'],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x1af0('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x1af0('0x3')],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM'](_0x1af0('0x25'),'no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x1af0('0x3')],'allowNull':!![]},'defaultuser':{'type':Sequelize['STRING'],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x1af0('0x11')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x1af0('0x11')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x1af0('0x11')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x1af0('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize['STRING'],'allowNull':!![]},'timert1':{'type':Sequelize[_0x1af0('0x11')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x1af0('0x3')],'allowNull':!![]},'contactdeny':{'type':Sequelize['STRING'],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x1af0('0x3')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x1af0('0x3')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x1af0('0x11')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x1af0('0x17')](_0x1af0('0x25'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x1af0('0x17')](_0x1af0('0x25'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x1af0('0x17')](_0x1af0('0x25'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x1af0('0x17')](_0x1af0('0x25'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x1af0('0x17')](_0x1af0('0x25'),'no',_0x1af0('0x38'),_0x1af0('0x39')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x1af0('0x11')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x1af0('0x3')],'allowNull':!![]},'dtlscipher':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x1af0('0x3')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x1af0('0x3')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x1af0('0x17')]('active',_0x1af0('0x3a'),_0x1af0('0x3b')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x1af0('0x3')],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x1af0('0x3')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x1af0('0x3')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x1af0('0x11')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x1af0('0x17')](_0x1af0('0x25'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize['ENUM'](_0x1af0('0x25'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x1af0('0x3')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x1af0('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x1af0('0x3')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x1af0('0x3')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x1af0('0x17')](_0x1af0('0x25'),'no',_0x1af0('0x26'),_0x1af0('0x27'),_0x1af0('0x3c')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x1af0('0x15')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x1af0('0x3')]},'resetPasswordExpires':{'type':Sequelize[_0x1af0('0x14')]},'showWebBar':{'type':Sequelize[_0x1af0('0x11')],'defaultValue':0x0,'set':function(_0x493672){this[_0x1af0('0x5')](_0x1af0('0x3d'),_0x493672);var _0x45eab8=this[_0x1af0('0x3e')]({'plain':!![]});switch(_0x493672){case 0x0:case 0x1:var _0x5db345=_0x45eab8['transport']?_['isArray'](_0x45eab8['transport'])?_0x45eab8[_0x1af0('0x1f')][_0x1af0('0x2d')]():_0x45eab8[_0x1af0('0x1f')]:_0x1af0('0x1e');if(_0x5db345===_0x1af0('0x3f')){_0x5db345='udp';}this[_0x1af0('0x5')](_0x1af0('0x1f'),_0x5db345);this[_0x1af0('0x5')](_0x1af0('0x40'),'no');this['setDataValue'](_0x1af0('0x41'),null);this[_0x1af0('0x5')]('force_avp',null);this[_0x1af0('0x5')](_0x1af0('0x42'),null);this[_0x1af0('0x5')](_0x1af0('0x43'),null);this[_0x1af0('0x5')](_0x1af0('0x44'),null);this['setDataValue'](_0x1af0('0x45'),null);this[_0x1af0('0x5')](_0x1af0('0x46'),null);this[_0x1af0('0x5')](_0x1af0('0x47'),null);this[_0x1af0('0x5')](_0x1af0('0x48'),'no');break;case 0x2:this[_0x1af0('0x5')](_0x1af0('0x1f'),'wss');this[_0x1af0('0x5')](_0x1af0('0x40'),_0x1af0('0x25'));this[_0x1af0('0x5')](_0x1af0('0x41'),_0x1af0('0x25'));this[_0x1af0('0x5')](_0x1af0('0x49'),_0x1af0('0x25'));this[_0x1af0('0x5')](_0x1af0('0x42'),_0x1af0('0x25'));this[_0x1af0('0x5')](_0x1af0('0x43'),_0x1af0('0x25'));this['setDataValue'](_0x1af0('0x44'),'no');this[_0x1af0('0x5')](_0x1af0('0x45'),_0x1af0('0x3b'));this[_0x1af0('0x5')](_0x1af0('0x46'),_0x45eab8[_0x1af0('0x46')]||_0x1af0('0x4a'));this[_0x1af0('0x5')]('dtlsprivatekey',_0x45eab8[_0x1af0('0x47')]||_0x1af0('0x4b'));this[_0x1af0('0x5')](_0x1af0('0x48'),_0x1af0('0x25'));break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x544b2a){this[_0x1af0('0x5')](_0x1af0('0x4c'),_0x544b2a?_0x544b2a[_0x1af0('0x2d')](','):[]);},'get':function(){return this[_0x1af0('0x13')](_0x1af0('0x4c'))?_[_0x1af0('0x4d')](this[_0x1af0('0x13')](_0x1af0('0x4c'))['split'](','),function(_0x1032c3){return parseInt(_0x1032c3,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize['STRING']},'phoneBarNoReplyNumber':{'type':Sequelize[_0x1af0('0x3')]},'phoneBarBusyNumber':{'type':Sequelize[_0x1af0('0x3')]},'phoneBarUnconditional':{'type':Sequelize[_0x1af0('0x15')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x1af0('0x15')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x1af0('0x15')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x1af0('0x11')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x1af0('0x3')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x1af0('0x11')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x1af0('0x17')](_0x1af0('0x25'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x1af0('0x15')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x1af0('0x3')]},'passwordResetAt':{'type':Sequelize[_0x1af0('0x14')],'defaultValue':null},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x1af0('0x15')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x1af0('0x4e')],'get':function(){return this[_0x1af0('0x13')](_0x1af0('0x4f'))?this[_0x1af0('0x13')](_0x1af0('0x4f')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x1af0('0x15')],'defaultValue':![]},'interface':{'type':Sequelize[_0x1af0('0x3')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x1af0('0x15')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize['STRING'],'allowNull':!![]},'apiKeyIat':{'type':Sequelize['STRING'],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x1af0('0x15')],'defaultValue':![],'set':function(_0x1471d2){if(typeof _0x1471d2==='string'){var _0x164746=_0x1471d2==='1'?!![]:_0x1471d2==='0'?![]:_0x1471d2===_0x1af0('0x50')?!![]:_0x1471d2===_0x1af0('0x51')?![]:![];this[_0x1af0('0x5')](_0x1af0('0x52'),_0x164746);}else{this[_0x1af0('0x5')]('screenrecording',_0x1471d2);}}},'blocked':{'type':Sequelize[_0x1af0('0x15')],'defaultValue':![],'set':function(_0x2fd0a8){this[_0x1af0('0x5')]('blocked',_0x2fd0a8);if(_0x2fd0a8===!![]){this[_0x1af0('0x5')](_0x1af0('0x53'),moment());this[_0x1af0('0x5')](_0x1af0('0x54'),0x0);}else{this[_0x1af0('0x5')](_0x1af0('0x53'),null);}}},'blockedAt':{'type':Sequelize[_0x1af0('0x14')],'defaultValue':null},'loginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 8f3864a..fb4cb78 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 _0x25e7=['getWhatsappQueues','getFaxQueues','Fax','getOpenchannelQueues','Openchannel','transaction','addAgent','getDataValue','removeTeams','getMailQueues','Whatsapp','flatten','removeAgent','getLists','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','user_has_chat_interactions:save','removeChatInteractions','isArray','addMailInteractions','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','getVoicePrefixes','VoicePrefix','getFaxAccounts','FaxAccount','addFaxAccounts','removeFaxAccounts','getMailAccounts','MailAccount','addMailAccounts','removeMailAccounts','OpenchannelAccount','getOpenchannelAccounts','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','getChatWebsites','ChatWebsite','addChatWebsites','removeChatWebsites','WhatsappAccount','getWhatsappAccounts','addWhatsappAccounts','removeWhatsappAccounts','getSquareProjects','SquareProject','addSquareProjects','removeSquareProjects','getScheduledCalls','CmHopper','$and','$gte','$lte','$ne','$in','$notIn','$like','$notLike','$iLike','$notILike','$overlap','$contains','$contained','$any','firstName','lastName','phone','Contact','dialActive','getApiKey','retrieveApiKey','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','iat','removeApiKey','apiKeyNonce','API\x20key\x20not\x20available','whoami','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','defaults','redis','socket.io-emitter','./user.socket','jayson/promise','client','http','test','Sequelize','ValidationError','request','then','info','User,\x20%s,\x20%s','request\x20sent','User,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','end','json','count','offset','limit','status','set','Content-Range','apply','save','update','get','user','agent','Telephones','telephone','map','value','role','find','UserProfileResource','destroy','sendStatus','stack','name','send','index','User','fieldName','password','query','filters','intersection','model','attributes','fields','length','sort','where','pick','filter','merge','type','sequelize','lower','col','options','includeAll','findAll','show','params','differenceBy','keys','salt','include','bulkCreate','body','describe','addContacts','ids','omit','agent\x20role','getLicense','telephones','isNil','License\x20limit\x20reached','format','create','internal','findById','securePassword','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','QueryTypes','SELECT','from','voicemail','mailbox','VoiceMail','fullname','email','permissions','101','102','110','104','105','108','109','100','111','114','Unable\x20to\x20retrieve\x20the\x20current\x20user','Agents','UserProfileSection','userProfileId','autoAssociation','changePassword','findOne','oldPassword','newPassword','Invalid\x20body\x20format.\x20Use\x20oldPassord\x20and\x20newPassword','Wrong\x20credentials','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','admin','Invalid\x20body\x20format.\x20Use\x20newPassword','Unauthorized','addQueues','online','loginInPause','interface','isValidChannel','Unknown\x20channel','add','capitalize','toLowerCase','Queues','penalty','spread','QueueId','emit','Queue:save','voice','VoiceQueue','push','SIP/%s','UserVoiceQueueRt','removeQueues','remove','channel','Queue:remove','userpic','file','filename','join','server/files/images/logos/default_profile.png','existsSync','root','download','CmContact','rawAttributes','order','getContacts','hasOwnProperty','CmList','List','Tag','Tags','color','tag','Queue','Unknown\x20role','nolimit','getVoiceQueuesRt','getGroups','ChatGroup','getRecordings','VoiceRecording','rows','getScreenRecordings','ScreenRecording','UserId','ChatInteraction','getChatInteractions','getOpenchannelInteractions','OpenchannelInteraction','getMailInteractions','MailInteraction','getSmsInteractions','SmsInteraction','getFaxInteractions','getWhatsappInteractions','WhatsappInteraction','login','mobile','LOCAL/%s@from-sip/n','intrf','user:%s','user:forcelogout','x-forwarded-for','connection','socket','remoteAddress','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','UserVoiceQueue.penalty','each','upsert','MemberReport','forEach','YYYY-MM-DD\x20HH:mm:ss','all','getChannels','LOGIN','device','PAUSE','concat','LOGININPAUSE','isMiddleware','resolve','pause','QueuePause','updateAttributes','DEFAULT\x20PAUSE','unpause','voicePause','mailPause','chatPause','faxPause','openchannelPause','smsPause','whatsapppause','pauseType','lastPauseAt','manual','mail','sms','openchannel','%s%s','Pause','getTeams','Team','addTeams','Voice','getChatQueues','setDataValue','Mail','getSmsQueues','Sms'];(function(_0x4147ff,_0x154530){var _0x1e71e6=function(_0x21f992){while(--_0x21f992){_0x4147ff['push'](_0x4147ff['shift']());}};_0x1e71e6(++_0x154530);}(_0x25e7,0x1d6));var _0x725e=function(_0x38fb8b,_0x70dd0a){_0x38fb8b=_0x38fb8b-0x0;var _0x1ec681=_0x25e7[_0x38fb8b];return _0x1ec681;};'use strict';var pdf=require(_0x725e('0x0'));var emlformat=require(_0x725e('0x1'));var rimraf=require(_0x725e('0x2'));var zipdir=require(_0x725e('0x3'));var jsonpatch=require(_0x725e('0x4'));var rp=require(_0x725e('0x5'));var moment=require(_0x725e('0x6'));var BPromise=require(_0x725e('0x7'));var Mustache=require(_0x725e('0x8'));var util=require(_0x725e('0x9'));var path=require('path');var sox=require('sox');var csv=require(_0x725e('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x725e('0xb'));var crypto=require(_0x725e('0xc'));var jsforce=require(_0x725e('0xd'));var deskjs=require(_0x725e('0xe'));var toCsv=require(_0x725e('0xa'));var querystring=require(_0x725e('0xf'));var Papa=require(_0x725e('0x10'));var Redis=require(_0x725e('0x11'));var authService=require(_0x725e('0x12'));var qs=require(_0x725e('0x13'));var as=require(_0x725e('0x14'));var hardwareService=require(_0x725e('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x725e('0x16'));var config=require(_0x725e('0x17'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x725e('0x18')](config[_0x725e('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x725e('0x1a'))(new Redis(config[_0x725e('0x19')]));require(_0x725e('0x1b'))['register'](socket);var jayson=require(_0x725e('0x1c'));var client=jayson[_0x725e('0x1d')][_0x725e('0x1e')]({'port':0x232a});function checkPasswordPattern(_0x2e78d2,_0x24c3c1,_0x13fbfe){if(_0x13fbfe){var _0x523422=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x523422[_0x725e('0x1f')](_0x24c3c1)){return _0x2e78d2;}else{throw new db[(_0x725e('0x20'))][(_0x725e('0x21'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x2e78d2;}}function respondWithRpcPromise(_0x1a94c1,_0x125fef,_0x2dda5c,_0x397e33){return new BPromise(function(_0x268438,_0x2811e7){var _0x528e7d=_0x397e33||client;return _0x528e7d[_0x725e('0x22')](_0x1a94c1,_0x2dda5c)[_0x725e('0x23')](function(_0x1b8879){logger[_0x725e('0x24')](_0x725e('0x25'),_0x125fef,_0x725e('0x26'));logger['debug'](_0x725e('0x27'),_0x125fef,_0x725e('0x26'),JSON[_0x725e('0x28')](_0x1b8879));if(_0x1b8879[_0x725e('0x29')]){if(_0x1b8879[_0x725e('0x29')][_0x725e('0x2a')]===0x1f4){logger[_0x725e('0x29')](_0x725e('0x25'),_0x125fef,_0x1b8879[_0x725e('0x29')]['message']);return _0x2811e7(_0x1b8879[_0x725e('0x29')][_0x725e('0x2b')]);}logger[_0x725e('0x29')](_0x725e('0x25'),_0x125fef,_0x1b8879['error'][_0x725e('0x2b')]);return _0x268438(_0x1b8879['error']['message']);}else{logger['info'](_0x725e('0x25'),_0x125fef,_0x725e('0x26'));_0x268438(_0x1b8879[_0x725e('0x2c')]['message']);}})[_0x725e('0x2d')](function(_0x8a138f){logger['error'](_0x725e('0x25'),_0x125fef,_0x8a138f);_0x2811e7(_0x8a138f);});});}function respondWithStatusCode(_0x339a58,_0x4b0d0c){_0x4b0d0c=_0x4b0d0c||0xcc;return function(_0x378ace){if(_0x378ace){return _0x339a58['sendStatus'](_0x4b0d0c);}return _0x339a58['status'](_0x4b0d0c)[_0x725e('0x2e')]();};}function respondWithResult(_0x5b8dec,_0x3b42bd){_0x3b42bd=_0x3b42bd||0xc8;return function(_0x4cc4ad){if(_0x4cc4ad){return _0x5b8dec['status'](_0x3b42bd)[_0x725e('0x2f')](_0x4cc4ad);}};}function respondWithFilteredResult(_0x31a8ff,_0x33fe34){return function(_0x545237){if(_0x545237){var _0x2e0534=_0x545237[_0x725e('0x30')],_0x5b03d9=_0x33fe34[_0x725e('0x31')],_0x85d29c=_0x33fe34[_0x725e('0x31')]+_0x33fe34[_0x725e('0x32')],_0x1ce9c8;if(_0x85d29c>=_0x2e0534){_0x85d29c=_0x2e0534;_0x1ce9c8=0xc8;}else{_0x1ce9c8=0xce;}_0x31a8ff[_0x725e('0x33')](_0x1ce9c8);return _0x31a8ff[_0x725e('0x34')](_0x725e('0x35'),_0x5b03d9+'-'+_0x85d29c+'/'+_0x2e0534)[_0x725e('0x2f')](_0x545237);}return null;};}function patchUpdates(_0x9179a4){return function(_0x5493d0){try{jsonpatch[_0x725e('0x36')](_0x5493d0,_0x9179a4,!![]);}catch(_0x175571){return BPromise['reject'](_0x175571);}return _0x5493d0[_0x725e('0x37')]();};}function saveUpdates(_0x4f2571,_0x351ce4){return function(_0x48ed43){if(_0x48ed43){return _0x48ed43[_0x725e('0x38')](_0x4f2571)[_0x725e('0x23')](function(_0x1f2898){return _0x1f2898;});}return null;};}function removeEntity(_0x398735,_0x40ce76){return function(_0x1eb190){if(_0x1eb190){return _0x1eb190['destroy']()['then'](function(){var _0x35e5e7=_0x1eb190[_0x725e('0x39')]({'plain':!![]});var _0x224942=[{'name':'Users','value':_0x725e('0x3a'),'ignore':!![]},{'name':'Agents','value':_0x725e('0x3b'),'ignore':![]},{'name':_0x725e('0x3c'),'value':_0x725e('0x3d'),'ignore':![]}];var _0x1ef636=_(_0x224942)['filter']('ignore')[_0x725e('0x3e')](_0x725e('0x3f'))[_0x725e('0x3f')]();if(_['includes'](_0x1ef636,_0x35e5e7[_0x725e('0x40')])){return;}var _0xec3b9d=_[_0x725e('0x41')](_0x224942,['value',_0x35e5e7[_0x725e('0x40')]])['name'];return db[_0x725e('0x42')][_0x725e('0x43')]({'where':{'type':_0xec3b9d,'resourceId':_0x35e5e7['id']}})[_0x725e('0x23')](function(){return _0x1eb190;});})[_0x725e('0x23')](function(){_0x398735[_0x725e('0x33')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4bc884,_0x1be4f4){return function(_0x253caa){if(!_0x253caa){_0x4bc884[_0x725e('0x44')](0x194);}return _0x253caa;};}function handleError(_0x5dd1d1,_0x23d29b){_0x23d29b=_0x23d29b||0x1f4;return function(_0x5be83e){logger[_0x725e('0x29')](_0x5be83e[_0x725e('0x45')]);if(_0x5be83e[_0x725e('0x46')]){delete _0x5be83e[_0x725e('0x46')];}_0x5dd1d1['status'](_0x23d29b)[_0x725e('0x47')](_0x5be83e);};}exports[_0x725e('0x48')]=function(_0x1ae4e2,_0x4366bc){var _0x1ec4fe={},_0x19ed0a={},_0x3e5460={'count':0x0,'rows':[]};var _0x49848f=_[_0x725e('0x3e')](db[_0x725e('0x49')]['rawAttributes'],function(_0x2200ad){return{'name':_0x2200ad[_0x725e('0x4a')],'type':_0x2200ad['type']['key']};});_0x19ed0a['model']=_['differenceBy'](_[_0x725e('0x3e')](_0x49848f,_0x725e('0x46')),[_0x725e('0x4b'),'salt']);_0x19ed0a[_0x725e('0x4c')]=_['keys'](_0x1ae4e2['query']);_0x19ed0a[_0x725e('0x4d')]=_[_0x725e('0x4e')](_0x19ed0a[_0x725e('0x4f')],_0x19ed0a[_0x725e('0x4c')]);_0x1ec4fe[_0x725e('0x50')]=_[_0x725e('0x4e')](_0x19ed0a['model'],qs[_0x725e('0x51')](_0x1ae4e2['query'][_0x725e('0x51')]));_0x1ec4fe[_0x725e('0x50')]=_0x1ec4fe['attributes'][_0x725e('0x52')]?_0x1ec4fe['attributes']:_0x19ed0a[_0x725e('0x4f')];if(!_0x1ae4e2[_0x725e('0x4c')]['hasOwnProperty']('nolimit')){_0x1ec4fe[_0x725e('0x32')]=qs['limit'](_0x1ae4e2[_0x725e('0x4c')]['limit']);_0x1ec4fe['offset']=qs['offset'](_0x1ae4e2[_0x725e('0x4c')][_0x725e('0x31')]);}_0x1ec4fe['order']=qs[_0x725e('0x53')](_0x1ae4e2[_0x725e('0x4c')]['sort']);_0x1ec4fe[_0x725e('0x54')]=qs[_0x725e('0x4d')](_[_0x725e('0x55')](_0x1ae4e2[_0x725e('0x4c')],_0x19ed0a[_0x725e('0x4d')]),_0x49848f);if(_0x1ae4e2[_0x725e('0x4c')][_0x725e('0x56')]){_0x1ec4fe[_0x725e('0x54')]=_[_0x725e('0x57')](_0x1ec4fe[_0x725e('0x54')],{'$or':_[_0x725e('0x3e')](_0x49848f,function(_0x14753a){if(_0x14753a[_0x725e('0x58')]!=='VIRTUAL'){return db[_0x725e('0x59')]['where'](db[_0x725e('0x59')]['fn'](_0x725e('0x5a'),db[_0x725e('0x59')][_0x725e('0x5b')](_0x14753a[_0x725e('0x46')])),{'$like':db[_0x725e('0x59')]['fn'](_0x725e('0x5a'),'%'+_0x1ae4e2[_0x725e('0x4c')][_0x725e('0x56')]+'%')});}})});}_0x1ec4fe=_[_0x725e('0x57')]({},_0x1ec4fe,_0x1ae4e2[_0x725e('0x5c')]);var _0x248252={'where':_0x1ec4fe[_0x725e('0x54')]};return db[_0x725e('0x49')][_0x725e('0x30')](_0x248252)[_0x725e('0x23')](function(_0x420689){_0x3e5460[_0x725e('0x30')]=_0x420689;if(_0x1ae4e2['query'][_0x725e('0x5d')]){_0x1ec4fe['include']=[{'all':!![]}];}return db[_0x725e('0x49')][_0x725e('0x5e')](_0x1ec4fe);})['then'](function(_0x118bf9){_0x3e5460['rows']=_0x118bf9;return _0x3e5460;})[_0x725e('0x23')](respondWithFilteredResult(_0x4366bc,_0x1ec4fe))[_0x725e('0x2d')](handleError(_0x4366bc,null));};exports[_0x725e('0x5f')]=function(_0x53d504,_0x9bc8b5){var _0x1b347e={'raw':![],'where':{'id':_0x53d504[_0x725e('0x60')]['id']}},_0x1cbfb8={};_0x1cbfb8[_0x725e('0x4f')]=_[_0x725e('0x61')](_[_0x725e('0x62')](db[_0x725e('0x49')]['rawAttributes']),[_0x725e('0x4b'),_0x725e('0x63')]);_0x1cbfb8['query']=_['keys'](_0x53d504[_0x725e('0x4c')]);_0x1cbfb8[_0x725e('0x4d')]=_['intersection'](_0x1cbfb8['model'],_0x1cbfb8[_0x725e('0x4c')]);_0x1b347e[_0x725e('0x50')]=_[_0x725e('0x4e')](_0x1cbfb8[_0x725e('0x4f')],qs[_0x725e('0x51')](_0x53d504[_0x725e('0x4c')]['fields']));_0x1b347e[_0x725e('0x50')]=_0x1b347e[_0x725e('0x50')]['length']?_0x1b347e[_0x725e('0x50')]:_0x1cbfb8[_0x725e('0x4f')];if(_0x53d504[_0x725e('0x4c')][_0x725e('0x5d')]){_0x1b347e[_0x725e('0x64')]=[{'all':!![]}];}_0x1b347e=_['merge']({},_0x1b347e,_0x53d504[_0x725e('0x5c')]);return db[_0x725e('0x49')][_0x725e('0x41')](_0x1b347e)[_0x725e('0x23')](handleEntityNotFound(_0x9bc8b5,null))[_0x725e('0x23')](respondWithResult(_0x9bc8b5,null))[_0x725e('0x2d')](handleError(_0x9bc8b5,null));};exports['bulkCreate']=function(_0x342ba9,_0x5f46f0){return db['User'][_0x725e('0x65')](_0x342ba9['body'],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x5f46f0,0xc9))[_0x725e('0x2d')](handleError(_0x5f46f0,null));};exports[_0x725e('0x38')]=function(_0x46f14d,_0xd78f3){if(_0x46f14d[_0x725e('0x66')]['id']){delete _0x46f14d[_0x725e('0x66')]['id'];}delete _0x46f14d[_0x725e('0x66')]['role'];return db[_0x725e('0x49')][_0x725e('0x41')]({'where':{'id':_0x46f14d[_0x725e('0x60')]['id']}})['then'](handleEntityNotFound(_0xd78f3,null))['then'](saveUpdates(_0x46f14d[_0x725e('0x66')],null))[_0x725e('0x23')](respondWithResult(_0xd78f3,null))[_0x725e('0x2d')](handleError(_0xd78f3,null));};exports[_0x725e('0x67')]=function(_0x106493,_0x10c7ba){return db[_0x725e('0x49')]['describe']()[_0x725e('0x23')](respondWithResult(_0x10c7ba,null))['catch'](handleError(_0x10c7ba,null));};exports[_0x725e('0x68')]=function(_0x4c8af0,_0x3b756b,_0x22d7d9){return db[_0x725e('0x49')]['find']({'where':{'id':_0x4c8af0[_0x725e('0x60')]['id']}})[_0x725e('0x23')](handleEntityNotFound(_0x3b756b,null))[_0x725e('0x23')](function(_0x388510){if(_0x388510){return _0x388510[_0x725e('0x68')](_0x4c8af0[_0x725e('0x66')][_0x725e('0x69')],_[_0x725e('0x6a')](_0x4c8af0[_0x725e('0x66')],['ids','id'])||{});}})[_0x725e('0x23')](respondWithResult(_0x3b756b,null))[_0x725e('0x2d')](handleError(_0x3b756b,null));};var getLicense=function(_0x58c7f7){return new BPromise(function(_0x12cc3e,_0x1a12c1){var _0x1d2e49=0x0;_0x58c7f7[_0x725e('0x66')][_0x725e('0x40')]===_0x725e('0x3b')&&_0x12cc3e(_0x725e('0x6b'));return db['User']['count']({'where':{'$or':[{'role':_0x58c7f7['body'][_0x725e('0x40')]===_0x725e('0x3d')?_0x725e('0x3d'):['admin',_0x725e('0x3a')]}]}})[_0x725e('0x23')](function(_0x59338f){_0x1d2e49=_0x59338f;return require('../../config/license/util')[_0x725e('0x6c')]();})['then'](function(_0xb665b0){var _0x21d6da=_0x58c7f7['body'][_0x725e('0x40')]===_0x725e('0x3d')?_0x725e('0x6d'):'users';if(!_[_0x725e('0x6e')](_0xb665b0[_0x21d6da])&&_0x1d2e49>=_0xb665b0[_0x21d6da]){return _0x1a12c1({'message':_0x725e('0x6f')});}return _0x12cc3e(util[_0x725e('0x70')]('count\x20%s:\x20%s',_0x21d6da,_0x1d2e49));})[_0x725e('0x2d')](function(_0xd36461){return _0x1a12c1(_0xd36461);});});};exports[_0x725e('0x71')]=function(_0x75897c,_0x1551bd){return getLicense(_0x75897c)['then'](function(_0x5b84ae){if(!_0x75897c[_0x725e('0x66')][_0x725e('0x72')]){var _0x3ff259;return db['Setting'][_0x725e('0x73')](0x1)[_0x725e('0x23')](function(_0x4d0809){return checkPasswordPattern(_0x4d0809,_0x75897c[_0x725e('0x66')][_0x725e('0x4b')],_0x4d0809[_0x725e('0x74')]);})[_0x725e('0x23')](function(_0x42af7e){_0x3ff259=_0x42af7e['min_internal'];return db[_0x725e('0x49')]['max'](_0x725e('0x72'));})[_0x725e('0x23')](function(_0x347483){if(_[_0x725e('0x6e')](_0x347483)){if(_0x3ff259){_0x75897c[_0x725e('0x66')][_0x725e('0x72')]=_0x3ff259;}else{_0x75897c[_0x725e('0x66')][_0x725e('0x72')]=0x1;}}else{if(_[_0x725e('0x6e')](_0x3ff259)||_0x3ff259==_0x347483){_0x75897c['body'][_0x725e('0x72')]=_0x347483+0x1;}else if(_0x3ff259>_0x347483){_0x75897c[_0x725e('0x66')][_0x725e('0x72')]=_0x3ff259;}else{return db[_0x725e('0x59')]['query'](_0x725e('0x75'),{'type':db[_0x725e('0x59')][_0x725e('0x76')][_0x725e('0x77')]})['then'](function(_0x3072d8){if(_0x3072d8&&_0x3072d8['length']){for(var _0x277249=0x0,_0x4e80b8=_0x3072d8['length'];_0x277249<_0x4e80b8&&_[_0x725e('0x6e')](_0x75897c['body'][_0x725e('0x72')]);_0x277249++){if(_0x3ff259<=_0x3072d8[_0x277249]['from']){_0x75897c[_0x725e('0x66')][_0x725e('0x72')]=_0x3072d8[_0x277249][_0x725e('0x78')];}else if(_0x3ff259>_0x3072d8[_0x277249]['from']&&_0x3ff259<=_0x3072d8[_0x277249]['to']){_0x75897c[_0x725e('0x66')][_0x725e('0x72')]=_0x3ff259;}}}if(_['isNil'](_0x75897c[_0x725e('0x66')]['internal'])){_0x75897c[_0x725e('0x66')][_0x725e('0x72')]=_0x347483+0x1;}});}}});}})['then'](function(){if(_0x75897c[_0x725e('0x66')][_0x725e('0x79')]){_0x75897c[_0x725e('0x66')][_0x725e('0x7a')]=_0x75897c[_0x725e('0x66')][_0x725e('0x72')];_0x75897c[_0x725e('0x66')][_0x725e('0x7b')]={'mailbox':_0x75897c[_0x725e('0x66')][_0x725e('0x72')],'password':_0x75897c[_0x725e('0x66')][_0x725e('0x4b')],'fullname':_0x75897c[_0x725e('0x66')][_0x725e('0x7c')],'email':_0x75897c[_0x725e('0x66')][_0x725e('0x7d')]};}if(_0x75897c[_0x725e('0x66')]&&_0x75897c['body'][_0x725e('0x40')]===_0x725e('0x3b')){if(!_0x75897c[_0x725e('0x66')][_0x725e('0x7e')]){_0x75897c[_0x725e('0x66')][_0x725e('0x7e')]=[_0x725e('0x7f'),_0x725e('0x80'),'103','113',_0x725e('0x81'),_0x725e('0x82'),_0x725e('0x83'),'106','107',_0x725e('0x84'),_0x725e('0x85'),_0x725e('0x86'),_0x725e('0x87'),_0x725e('0x88')];}}return db[_0x725e('0x49')]['create'](_0x75897c[_0x725e('0x66')],{'include':[{'model':db[_0x725e('0x7b')],'as':_0x725e('0x7b')}]});})['then'](function(_0xce526e){if(_0x75897c[_0x725e('0x66')]['role']===_0x725e('0x3a'))return _0xce526e;var _0x2a055d=_0x75897c[_0x725e('0x3a')][_0x725e('0x39')]({'plain':!![]});if(!_0x2a055d)throw new Error(_0x725e('0x89'));if(_0x2a055d[_0x725e('0x40')]==='user'){var _0x581774=_0xce526e[_0x725e('0x39')]({'plain':!![]});var _0x21d697=[{'name':_0x725e('0x8a'),'value':_0x725e('0x3b')},{'name':_0x725e('0x3c'),'value':'telephone'}];var _0x345d9b=_[_0x725e('0x41')](_0x21d697,[_0x725e('0x3f'),_0x581774['role']])['name'];return db[_0x725e('0x8b')][_0x725e('0x41')]({'where':{'name':_0x345d9b,'userProfileId':_0x2a055d[_0x725e('0x8c')]},'raw':!![]})['then'](function(_0x214f6b){if(_0x214f6b&&_0x214f6b[_0x725e('0x8d')]===0x0){return db[_0x725e('0x42')][_0x725e('0x71')]({'name':_0x581774[_0x725e('0x46')],'resourceId':_0x581774['id'],'type':_0x214f6b[_0x725e('0x46')],'sectionId':_0x214f6b['id']},{})[_0x725e('0x23')](function(){return _0xce526e;});}else{return _0xce526e;}})[_0x725e('0x2d')](function(_0x54fbe6){logger[_0x725e('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x54fbe6);throw _0x54fbe6;});}return _0xce526e;})[_0x725e('0x23')](respondWithResult(_0x1551bd,0xc9))['catch'](handleError(_0x1551bd,null));};exports[_0x725e('0x8e')]=function(_0x2e02a3,_0x1b6528,_0x4fc3ef){var _0x50bb3e=![];if(_0x2e02a3[_0x725e('0x66')]['id']){delete _0x2e02a3[_0x725e('0x66')]['id'];}return db['Setting'][_0x725e('0x8f')]({'attributes':['id',_0x725e('0x74')]})[_0x725e('0x23')](function(_0x1fe8bd){_0x50bb3e=_0x1fe8bd[_0x725e('0x74')];return db[_0x725e('0x49')][_0x725e('0x41')]({'where':{'id':_0x2e02a3[_0x725e('0x60')]['id']}});})['then'](function(_0x1f07f3){if(_0x1f07f3){if(_0x1f07f3['id']==_0x2e02a3[_0x725e('0x3a')]['id']){if(!_0x2e02a3[_0x725e('0x66')][_0x725e('0x90')]||!_0x2e02a3[_0x725e('0x66')][_0x725e('0x91')]){throw new db[(_0x725e('0x20'))]['ValidationError'](_0x725e('0x92'));}if(!_0x1f07f3['authenticate'](_0x2e02a3[_0x725e('0x66')][_0x725e('0x90')])){throw new db[(_0x725e('0x20'))][(_0x725e('0x21'))](_0x725e('0x93'));}if(_0x2e02a3[_0x725e('0x66')]['oldPassword']==_0x2e02a3['body'][_0x725e('0x91')]){throw new db[(_0x725e('0x20'))][(_0x725e('0x21'))](_0x725e('0x94'));}return _0x1f07f3;}else if(_0x2e02a3[_0x725e('0x3a')][_0x725e('0x40')]==_0x725e('0x95')){if(!_0x2e02a3[_0x725e('0x66')][_0x725e('0x91')]){throw new db[(_0x725e('0x20'))][(_0x725e('0x21'))](_0x725e('0x96'));}return _0x1f07f3;}else if(_0x2e02a3[_0x725e('0x3a')]['role']==_0x725e('0x3a')){if(!_0x2e02a3['body'][_0x725e('0x91')]){throw new db[(_0x725e('0x20'))]['ValidationError'](_0x725e('0x96'));}if(_0x1f07f3['role']!=_0x725e('0x3b')){throw new db[(_0x725e('0x20'))]['ValidationError']('Unauthorized');}return _0x1f07f3;}else{throw new db[(_0x725e('0x20'))]['ValidationError'](_0x725e('0x97'));}}return null;})['then'](handleEntityNotFound(_0x1b6528,null))[_0x725e('0x23')](function(_0x2f5c12){return checkPasswordPattern(_0x2f5c12,_0x2e02a3['body'][_0x725e('0x91')],_0x50bb3e);})[_0x725e('0x23')](saveUpdates({'password':_0x2e02a3[_0x725e('0x66')][_0x725e('0x91')],'passwordResetAt':_0x2e02a3[_0x725e('0x3a')]['id']==_0x2e02a3[_0x725e('0x60')]['id']?moment():null},null))[_0x725e('0x23')](respondWithResult(_0x1b6528,null))['catch'](handleError(_0x1b6528,null));};exports[_0x725e('0x98')]=function(_0x56d7d0,_0x1dffdd,_0x125a60){var _0x58773a=_0x56d7d0['body']['channel'];return db[_0x725e('0x49')]['find']({'where':{'id':_0x56d7d0['params']['id']},'attributes':['id',_0x725e('0x46'),_0x725e('0x40'),_0x725e('0x99'),_0x725e('0x9a'),'voicePause',_0x725e('0x9b')]})[_0x725e('0x23')](handleEntityNotFound(_0x1dffdd,null))[_0x725e('0x23')](function(_0x4cb90b){if(_0x4cb90b){if(!utils[_0x725e('0x9c')](_0x58773a)){throw new db['Sequelize'][(_0x725e('0x21'))](_0x725e('0x9d'));}return _0x4cb90b[_0x725e('0x9e')+_[_0x725e('0x9f')](_0x58773a[_0x725e('0xa0')]())+_0x725e('0xa1')](_0x56d7d0[_0x725e('0x66')]['ids'],{'penalty':_0x56d7d0['body'][_0x725e('0xa2')]||0x0})[_0x725e('0xa3')](function(_0xe17e71){for(var _0x40bb92=0x0;_0x40bb92<_0x56d7d0['body'][_0x725e('0x69')][_0x725e('0x52')];_0x40bb92+=0x1){var _0x44c2f2={'UserId':_0x56d7d0[_0x725e('0x60')]['id']};_0x44c2f2[_[_0x725e('0x9f')](_0x58773a[_0x725e('0xa0')]())+_0x725e('0xa4')]=_0x56d7d0[_0x725e('0x66')][_0x725e('0x69')][_0x40bb92];socket[_0x725e('0xa5')]('user'+_[_0x725e('0x9f')](_0x58773a[_0x725e('0xa0')]())+_0x725e('0xa6'),_0x44c2f2);}return _0xe17e71;})[_0x725e('0x23')](function(){if(_0x58773a===_0x725e('0xa7')){return db[_0x725e('0xa8')]['findAll']({'where':{'id':_0x56d7d0[_0x725e('0x66')][_0x725e('0x69')]||[]},'raw':!![],'attributes':['id',_0x725e('0x46')]});}})['then'](function(_0x5a8e61){var _0x12107b=_0x4cb90b[_0x725e('0x39')]({'plain':!![]});var _0x240fde=[];if(_0x58773a===_0x725e('0xa7')&&_0x12107b[_0x725e('0x40')]===_0x725e('0x3b')&&_0x12107b[_0x725e('0x99')]){for(var _0x46b8f8=0x0;_0x46b8f8<_0x5a8e61[_0x725e('0x52')];_0x46b8f8+=0x1){_0x240fde[_0x725e('0xa9')]({'membername':_0x12107b[_0x725e('0x46')],'UserId':_0x12107b['id'],'queue_name':_0x5a8e61[_0x46b8f8]['name'],'VoiceQueueId':_0x5a8e61[_0x46b8f8]['id'],'interface':_[_0x725e('0x6e')](_0x12107b[_0x725e('0x9b')])?util[_0x725e('0x70')](_0x725e('0xaa'),_0x12107b[_0x725e('0x46')]):_0x12107b['interface'],'paused':_0x12107b['voicePause']||![],'penalty':_0x56d7d0['body'][_0x725e('0xa2')]||0x0});}return BPromise['each'](_0x240fde,function(_0x5ea21c){return db[_0x725e('0xab')]['upsert'](_0x5ea21c);});}return _0x4cb90b;});}})[_0x725e('0x23')](respondWithStatusCode(_0x1dffdd,null))[_0x725e('0x2d')](handleError(_0x1dffdd,null));};exports[_0x725e('0xac')]=function(_0x4cd25e,_0x3ade77,_0x35aa4a){var _0x497934;return db[_0x725e('0x49')][_0x725e('0x41')]({'where':{'id':_0x4cd25e[_0x725e('0x60')]['id']},'attributes':['id',_0x725e('0x46'),_0x725e('0x40')]})['then'](handleEntityNotFound(_0x3ade77,null))['then'](function(_0x4152a2){if(_0x4152a2){_0x497934=_0x4152a2;if(!_0x4cd25e[_0x725e('0x4c')]['channel']||!utils[_0x725e('0x9c')](_0x4cd25e['query']['channel'])){throw new db[(_0x725e('0x20'))]['ValidationError'](_0x725e('0x9d'));}return _0x4152a2[_0x725e('0xad')+_[_0x725e('0x9f')](_0x4cd25e['query']['channel'][_0x725e('0xa0')]())+_0x725e('0xa1')](_0x4cd25e[_0x725e('0x4c')][_0x725e('0x69')]);}})[_0x725e('0x23')](function(_0x135262){for(var _0x4ca119=0x0;_0x4ca119<_0x4cd25e[_0x725e('0x4c')][_0x725e('0x69')][_0x725e('0x52')];_0x4ca119+=0x1){var _0x51ba9d={'UserId':_0x4cd25e[_0x725e('0x60')]['id']};_0x51ba9d[_[_0x725e('0x9f')](_0x4cd25e[_0x725e('0x4c')][_0x725e('0xae')]['toLowerCase']())+_0x725e('0xa4')]=_0x4cd25e[_0x725e('0x4c')][_0x725e('0x69')][_0x4ca119];socket[_0x725e('0xa5')]('user'+_[_0x725e('0x9f')](_0x4cd25e['query'][_0x725e('0xae')]['toLowerCase']())+_0x725e('0xaf'),_0x51ba9d);}return _0x135262;})[_0x725e('0x23')](function(){if(_0x4cd25e[_0x725e('0x4c')][_0x725e('0xae')]===_0x725e('0xa7')){return db[_0x725e('0xab')][_0x725e('0x43')]({'where':{'UserId':_0x4cd25e[_0x725e('0x60')]['id'],'VoiceQueueId':_0x4cd25e[_0x725e('0x4c')]['ids']},'individualHooks':!![]})[_0x725e('0x23')](function(){return _0x497934;});}return _0x497934;})['then'](respondWithStatusCode(_0x3ade77,null))[_0x725e('0x2d')](handleError(_0x3ade77,null));};exports['addAvatar']=function(_0x31cea2,_0x7172b1,_0x55af4e){_0x31cea2[_0x725e('0x66')][_0x725e('0xb0')]=_0x31cea2[_0x725e('0xb1')][_0x725e('0xb2')];return db[_0x725e('0x49')][_0x725e('0x41')]({'where':{'id':_0x31cea2[_0x725e('0x60')]['id']}})['then'](handleEntityNotFound(_0x7172b1,null))[_0x725e('0x23')](saveUpdates(_0x31cea2[_0x725e('0x66')],null))[_0x725e('0x23')](respondWithResult(_0x7172b1,null))[_0x725e('0x2d')](handleError(_0x7172b1,null));};exports['getAvatar']=function(_0x37bc92,_0x5c2f29,_0x5813bb){var _0xbdf6b=path[_0x725e('0xb3')](config['root'],_0x725e('0xb4'));return db[_0x725e('0x49')][_0x725e('0x41')]({'where':{'id':_0x37bc92[_0x725e('0x60')]['id']},'attributes':['id',_0x725e('0xb0')],'raw':!![]})[_0x725e('0x23')](handleEntityNotFound(_0x5c2f29,null))[_0x725e('0x23')](function(_0x2ab9d8){if(_0x2ab9d8){if(_[_0x725e('0x6e')](_0x2ab9d8[_0x725e('0xb0')])){return _0x5c2f29['download'](_0xbdf6b);}else{if(!fs[_0x725e('0xb5')](path['join'](config[_0x725e('0xb6')],'server/files/images/',_0x2ab9d8['userpic']))){return _0x5c2f29['download'](_0xbdf6b);}return _0x5c2f29[_0x725e('0xb7')](path[_0x725e('0xb3')](config['root'],'server/files/images/',_0x2ab9d8[_0x725e('0xb0')]));}}})[_0x725e('0x2d')](handleError(_0x5c2f29,null));};exports['getContacts']=function(_0x457f26,_0x13ab71,_0x5999c3){var _0x16d62f={};var _0x5bb431={};var _0x27b9a9;var _0x49a96e;return db[_0x725e('0x49')][_0x725e('0x8f')]({'where':{'id':_0x457f26[_0x725e('0x60')]['id']}})[_0x725e('0x23')](handleEntityNotFound(_0x13ab71,null))[_0x725e('0x23')](function(_0x497051){if(_0x497051){_0x27b9a9=_0x497051;_0x5bb431['model']=_[_0x725e('0x62')](db[_0x725e('0xb8')][_0x725e('0xb9')]);_0x5bb431['query']=_[_0x725e('0x62')](_0x457f26[_0x725e('0x4c')]);_0x5bb431['filters']=_[_0x725e('0x4e')](_0x5bb431[_0x725e('0x4f')],_0x5bb431[_0x725e('0x4c')]);_0x16d62f[_0x725e('0x50')]=_[_0x725e('0x4e')](_0x5bb431[_0x725e('0x4f')],qs[_0x725e('0x51')](_0x457f26[_0x725e('0x4c')][_0x725e('0x51')]));_0x16d62f[_0x725e('0x50')]=_0x16d62f[_0x725e('0x50')]['length']?_0x16d62f[_0x725e('0x50')]:_0x5bb431['model'];_0x16d62f[_0x725e('0xba')]=qs[_0x725e('0x53')](_0x457f26[_0x725e('0x4c')][_0x725e('0x53')]);_0x16d62f['where']=qs[_0x725e('0x4d')](_[_0x725e('0x55')](_0x457f26[_0x725e('0x4c')],_0x5bb431[_0x725e('0x4d')]));if(_0x457f26[_0x725e('0x4c')][_0x725e('0x56')]){_0x16d62f[_0x725e('0x54')]=_[_0x725e('0x57')](_0x16d62f[_0x725e('0x54')],{'$or':_[_0x725e('0x3e')](_0x16d62f[_0x725e('0x50')],function(_0x5babed){var _0x1176ad={};_0x1176ad[_0x5babed]={'$like':'%'+_0x457f26[_0x725e('0x4c')][_0x725e('0x56')]+'%'};return _0x1176ad;})});}_0x16d62f=_[_0x725e('0x57')]({},_0x16d62f,_0x457f26[_0x725e('0x5c')]);return _0x27b9a9[_0x725e('0xbb')](_0x16d62f);}})[_0x725e('0x23')](function(_0x3f6825){if(_0x3f6825){_0x49a96e=_0x3f6825[_0x725e('0x52')];if(_0x457f26[_0x725e('0x4c')][_0x725e('0xbc')]('includeAll')){_0x16d62f[_0x725e('0x64')]=[{'model':db[_0x725e('0xbd')],'as':_0x725e('0xbe'),'required':![]},{'model':db[_0x725e('0xbf')],'as':_0x725e('0xc0'),'attributes':['id',_0x725e('0x46'),_0x725e('0xc1')],'where':_0x457f26[_0x725e('0x4c')]['tag']?{'id':_0x457f26[_0x725e('0x4c')][_0x725e('0xc2')]}:undefined,'required':_0x457f26[_0x725e('0x4c')][_0x725e('0xc2')]?!![]:![]}];}if(!_0x457f26[_0x725e('0x4c')][_0x725e('0xbc')]('nolimit')){_0x16d62f[_0x725e('0x32')]=qs[_0x725e('0x32')](_0x457f26[_0x725e('0x4c')]['limit']);_0x16d62f[_0x725e('0x31')]=qs[_0x725e('0x31')](_0x457f26[_0x725e('0x4c')][_0x725e('0x31')]);}return _0x27b9a9[_0x725e('0xbb')](_0x16d62f);}})[_0x725e('0x23')](function(_0x2ed2be){if(_0x2ed2be){return _0x2ed2be?{'count':_0x49a96e,'rows':_0x2ed2be}:null;}})[_0x725e('0x23')](respondWithResult(_0x13ab71,null))[_0x725e('0x2d')](handleError(_0x13ab71,null));};exports['getQueues']=function(_0x11ec39,_0x153365,_0x4aab72){var _0x18a33e;var _0x960ffb;var _0x2f5725={};var _0x2b3d07;return db[_0x725e('0x49')]['findOne']({'where':{'id':_0x11ec39[_0x725e('0x60')]['id']},'attributes':['id',_0x725e('0x46'),_0x725e('0x40')]})[_0x725e('0x23')](handleEntityNotFound(_0x153365,null))[_0x725e('0x23')](function(_0x52787e){if(!utils[_0x725e('0x9c')](_0x11ec39[_0x725e('0x4c')][_0x725e('0xae')])){throw new db[(_0x725e('0x20'))]['ValidationError'](_0x725e('0x9d'));}_0x18a33e=_0x52787e;var _0x32f462={};_0x32f462[_0x725e('0x4f')]=_[_0x725e('0x62')](db[_[_0x725e('0x9f')](_0x11ec39['query'][_0x725e('0xae')])+_0x725e('0xc3')]['rawAttributes']);_0x32f462['query']=_[_0x725e('0x62')](_0x11ec39[_0x725e('0x4c')]);_0x32f462['filters']=_[_0x725e('0x4e')](_0x32f462[_0x725e('0x4f')],_0x32f462['query']);_0x2f5725[_0x725e('0x50')]=_[_0x725e('0x4e')](_0x32f462[_0x725e('0x4f')],qs[_0x725e('0x51')](_0x11ec39[_0x725e('0x4c')][_0x725e('0x51')]));_0x2f5725[_0x725e('0x50')]=_0x2f5725[_0x725e('0x50')][_0x725e('0x52')]?_0x2f5725['attributes']:_0x32f462['model'];_0x2f5725[_0x725e('0xba')]=qs[_0x725e('0x53')](_0x11ec39['query']['sort']);_0x2f5725['where']=qs[_0x725e('0x4d')](_[_0x725e('0x55')](_0x11ec39['query'],_0x32f462[_0x725e('0x4d')]));if(_0x11ec39[_0x725e('0x4c')][_0x725e('0x56')]){_0x2f5725[_0x725e('0x54')]=_['merge'](_0x2f5725[_0x725e('0x54')],{'$or':_['map'](_0x2f5725[_0x725e('0x50')],function(_0x2fefbf){var _0x39cb0e={};_0x39cb0e[_0x2fefbf]={'$like':'%'+_0x11ec39[_0x725e('0x4c')][_0x725e('0x56')]+'%'};return _0x39cb0e;})});}_0x2f5725=_['merge']({},_0x2f5725,_0x11ec39[_0x725e('0x5c')]);switch(_0x18a33e[_0x725e('0x40')]){case'admin':return db[_['capitalize'](_0x11ec39[_0x725e('0x4c')][_0x725e('0xae')])+_0x725e('0xc3')][_0x725e('0x5e')](_0x2f5725);case _0x725e('0x3a'):case _0x725e('0x3b'):return _0x18a33e[_0x725e('0x39')+_[_0x725e('0x9f')](_0x11ec39[_0x725e('0x4c')][_0x725e('0xae')])+_0x725e('0xa1')](_0x2f5725);default:throw new db[(_0x725e('0x20'))][(_0x725e('0x21'))](_0x725e('0xc4'));}})['then'](function(_0x47524d){_0x2b3d07=_0x47524d[_0x725e('0x52')];if(!_0x11ec39['query'][_0x725e('0xbc')](_0x725e('0xc5'))){_0x2f5725['limit']=qs[_0x725e('0x32')](_0x11ec39[_0x725e('0x4c')][_0x725e('0x32')]);_0x2f5725[_0x725e('0x31')]=qs[_0x725e('0x31')](_0x11ec39[_0x725e('0x4c')]['offset']);}switch(_0x18a33e['role']){case _0x725e('0x95'):return db[_['capitalize'](_0x11ec39[_0x725e('0x4c')][_0x725e('0xae')])+'Queue'][_0x725e('0x5e')](_0x2f5725);case _0x725e('0x3a'):case'agent':return _0x18a33e['get'+_[_0x725e('0x9f')](_0x11ec39[_0x725e('0x4c')]['channel'])+_0x725e('0xa1')](_0x2f5725);}})[_0x725e('0x23')](function(_0x3f2e93){return{'count':_0x2b3d07,'rows':_0x3f2e93};})[_0x725e('0x23')](respondWithResult(_0x153365,null))[_0x725e('0x2d')](handleError(_0x153365,null));};exports['getVoiceQueuesRt']=function(_0x4a9c0b,_0x45f6b6,_0x730483){var _0x34424c={};var _0x47f01a={};var _0x14c741;var _0x3a8a7a;return db[_0x725e('0x49')][_0x725e('0x8f')]({'where':{'id':_0x4a9c0b[_0x725e('0x60')]['id']}})['then'](handleEntityNotFound(_0x45f6b6,null))[_0x725e('0x23')](function(_0x8e1867){if(_0x8e1867){_0x14c741=_0x8e1867;_0x47f01a[_0x725e('0x4f')]=_[_0x725e('0x62')](db['UserVoiceQueueRt'][_0x725e('0xb9')]);_0x47f01a[_0x725e('0x4c')]=_[_0x725e('0x62')](_0x4a9c0b[_0x725e('0x4c')]);_0x47f01a[_0x725e('0x4d')]=_[_0x725e('0x4e')](_0x47f01a[_0x725e('0x4f')],_0x47f01a['query']);_0x34424c[_0x725e('0x50')]=_[_0x725e('0x4e')](_0x47f01a['model'],qs[_0x725e('0x51')](_0x4a9c0b[_0x725e('0x4c')]['fields']));_0x34424c['attributes']=_0x34424c[_0x725e('0x50')]['length']?_0x34424c['attributes']:_0x47f01a[_0x725e('0x4f')];_0x34424c[_0x725e('0xba')]=qs[_0x725e('0x53')](_0x4a9c0b[_0x725e('0x4c')][_0x725e('0x53')]);_0x34424c['where']=qs[_0x725e('0x4d')](_[_0x725e('0x55')](_0x4a9c0b[_0x725e('0x4c')],_0x47f01a['filters']));if(_0x4a9c0b[_0x725e('0x4c')][_0x725e('0x56')]){_0x34424c['where']=_[_0x725e('0x57')](_0x34424c[_0x725e('0x54')],{'$or':_[_0x725e('0x3e')](_0x34424c['attributes'],function(_0x21f62b){var _0x2f23fd={};_0x2f23fd[_0x21f62b]={'$like':'%'+_0x4a9c0b[_0x725e('0x4c')]['filter']+'%'};return _0x2f23fd;})});}_0x34424c=_['merge']({},_0x34424c,_0x4a9c0b[_0x725e('0x5c')]);return _0x14c741[_0x725e('0xc6')](_0x34424c);}})['then'](function(_0x4b30f4){if(_0x4b30f4){_0x3a8a7a=_0x4b30f4[_0x725e('0x52')];if(!_0x4a9c0b['query'][_0x725e('0xbc')](_0x725e('0xc5'))){_0x34424c[_0x725e('0x32')]=qs[_0x725e('0x32')](_0x4a9c0b[_0x725e('0x4c')][_0x725e('0x32')]);_0x34424c[_0x725e('0x31')]=qs[_0x725e('0x31')](_0x4a9c0b[_0x725e('0x4c')][_0x725e('0x31')]);}return _0x14c741[_0x725e('0xc6')](_0x34424c);}})[_0x725e('0x23')](function(_0x2b5433){if(_0x2b5433){return _0x2b5433?{'count':_0x3a8a7a,'rows':_0x2b5433}:null;}})[_0x725e('0x23')](respondWithResult(_0x45f6b6,null))[_0x725e('0x2d')](handleError(_0x45f6b6,null));};exports[_0x725e('0xc7')]=function(_0x5a901e,_0x352764,_0x2ba1be){var _0x556412={};var _0x3df380={};var _0x2052e5;var _0x392be6;return db[_0x725e('0x49')][_0x725e('0x8f')]({'where':{'id':_0x5a901e['params']['id']}})[_0x725e('0x23')](handleEntityNotFound(_0x352764,null))[_0x725e('0x23')](function(_0x1a9292){if(_0x1a9292){_0x2052e5=_0x1a9292;_0x3df380[_0x725e('0x4f')]=_[_0x725e('0x62')](db[_0x725e('0xc8')][_0x725e('0xb9')]);_0x3df380[_0x725e('0x4c')]=_['keys'](_0x5a901e[_0x725e('0x4c')]);_0x3df380[_0x725e('0x4d')]=_[_0x725e('0x4e')](_0x3df380[_0x725e('0x4f')],_0x3df380[_0x725e('0x4c')]);_0x556412[_0x725e('0x50')]=_['intersection'](_0x3df380['model'],qs[_0x725e('0x51')](_0x5a901e[_0x725e('0x4c')]['fields']));_0x556412[_0x725e('0x50')]=_0x556412[_0x725e('0x50')][_0x725e('0x52')]?_0x556412[_0x725e('0x50')]:_0x3df380[_0x725e('0x4f')];_0x556412[_0x725e('0xba')]=qs[_0x725e('0x53')](_0x5a901e[_0x725e('0x4c')]['sort']);_0x556412[_0x725e('0x54')]=qs[_0x725e('0x4d')](_['pick'](_0x5a901e[_0x725e('0x4c')],_0x3df380[_0x725e('0x4d')]));if(_0x5a901e['query'][_0x725e('0x56')]){_0x556412['where']=_[_0x725e('0x57')](_0x556412[_0x725e('0x54')],{'$or':_['map'](_0x556412[_0x725e('0x50')],function(_0x2ea102){var _0x3d31f2={};_0x3d31f2[_0x2ea102]={'$like':'%'+_0x5a901e[_0x725e('0x4c')][_0x725e('0x56')]+'%'};return _0x3d31f2;})});}_0x556412=_[_0x725e('0x57')]({},_0x556412,_0x5a901e[_0x725e('0x5c')]);return _0x2052e5[_0x725e('0xc7')](_0x556412);}})[_0x725e('0x23')](function(_0x174bc0){if(_0x174bc0){_0x392be6=_0x174bc0['length'];if(!_0x5a901e[_0x725e('0x4c')][_0x725e('0xbc')](_0x725e('0xc5'))){_0x556412[_0x725e('0x32')]=qs[_0x725e('0x32')](_0x5a901e[_0x725e('0x4c')]['limit']);_0x556412[_0x725e('0x31')]=qs[_0x725e('0x31')](_0x5a901e[_0x725e('0x4c')]['offset']);}return _0x2052e5[_0x725e('0xc7')](_0x556412);}})[_0x725e('0x23')](function(_0xe53713){if(_0xe53713){return _0xe53713?{'count':_0x392be6,'rows':_0xe53713}:null;}})['then'](respondWithResult(_0x352764,null))[_0x725e('0x2d')](handleError(_0x352764,null));};exports[_0x725e('0xc9')]=function(_0xea845c,_0x1620f0,_0x2c7a63){var _0x429688={'raw':!![],'where':{}};var _0xd5a7df={};var _0x358b39={'count':0x0,'rows':[]};return db[_0x725e('0x49')][_0x725e('0x8f')]({'where':{'id':_0xea845c[_0x725e('0x60')]['id']}})['then'](handleEntityNotFound(_0x1620f0,null))[_0x725e('0x23')](function(_0x5be85f){if(_0x5be85f){_0xd5a7df['model']=_[_0x725e('0x62')](db[_0x725e('0xca')]['rawAttributes']);_0xd5a7df[_0x725e('0x4c')]=_['keys'](_0xea845c[_0x725e('0x4c')]);_0xd5a7df[_0x725e('0x4d')]=_[_0x725e('0x4e')](_0xd5a7df[_0x725e('0x4f')],_0xd5a7df[_0x725e('0x4c')]);_0x429688[_0x725e('0x50')]=_[_0x725e('0x4e')](_0xd5a7df['model'],qs[_0x725e('0x51')](_0xea845c[_0x725e('0x4c')]['fields']));_0x429688[_0x725e('0x50')]=_0x429688[_0x725e('0x50')][_0x725e('0x52')]?_0x429688[_0x725e('0x50')]:_0xd5a7df[_0x725e('0x4f')];if(!_0xea845c[_0x725e('0x4c')]['hasOwnProperty']('nolimit')){_0x429688['limit']=qs[_0x725e('0x32')](_0xea845c['query']['limit']);_0x429688[_0x725e('0x31')]=qs['offset'](_0xea845c[_0x725e('0x4c')][_0x725e('0x31')]);}_0x429688[_0x725e('0xba')]=qs[_0x725e('0x53')](_0xea845c[_0x725e('0x4c')][_0x725e('0x53')]);_0x429688[_0x725e('0x54')]=qs[_0x725e('0x4d')](_[_0x725e('0x55')](_0xea845c[_0x725e('0x4c')],_0xd5a7df[_0x725e('0x4d')]));_0x429688[_0x725e('0x54')]['UserId']=_0x5be85f['id'];if(_0xea845c[_0x725e('0x4c')][_0x725e('0x56')]){_0x429688[_0x725e('0x54')]=_[_0x725e('0x57')](_0x429688[_0x725e('0x54')],{'$or':_[_0x725e('0x3e')](_0x429688[_0x725e('0x50')],function(_0x27655b){var _0x228530={};_0x228530[_0x27655b]={'$like':'%'+_0xea845c[_0x725e('0x4c')][_0x725e('0x56')]+'%'};return _0x228530;})});}_0x429688=_[_0x725e('0x57')]({},_0x429688,_0xea845c[_0x725e('0x5c')]);return db[_0x725e('0xca')][_0x725e('0x30')]({'where':_0x429688[_0x725e('0x54')]})[_0x725e('0x23')](function(_0x28f389){_0x358b39['count']=_0x28f389;if(_0xea845c[_0x725e('0x4c')][_0x725e('0x5d')]){_0x429688[_0x725e('0x64')]=[{'all':!![]}];}return db['VoiceRecording'][_0x725e('0x5e')](_0x429688);})[_0x725e('0x23')](function(_0x568378){_0x358b39[_0x725e('0xcb')]=_0x568378;return _0x358b39;});}})[_0x725e('0x23')](respondWithFilteredResult(_0x1620f0,_0x429688))[_0x725e('0x2d')](handleError(_0x1620f0,null));};exports[_0x725e('0xcc')]=function(_0x4d05ee,_0x52a4b8,_0x1b0813){var _0x3dc5e4={'raw':!![],'where':{}};var _0x72308c={};var _0x269f30={'count':0x0,'rows':[]};return db['User'][_0x725e('0x8f')]({'where':{'id':_0x4d05ee[_0x725e('0x60')]['id']}})[_0x725e('0x23')](handleEntityNotFound(_0x52a4b8,null))[_0x725e('0x23')](function(_0x2a1e1e){if(_0x2a1e1e){_0x72308c['model']=_['keys'](db[_0x725e('0xcd')]['rawAttributes']);_0x72308c[_0x725e('0x4c')]=_[_0x725e('0x62')](_0x4d05ee[_0x725e('0x4c')]);_0x72308c['filters']=_[_0x725e('0x4e')](_0x72308c[_0x725e('0x4f')],_0x72308c[_0x725e('0x4c')]);_0x3dc5e4['attributes']=_[_0x725e('0x4e')](_0x72308c[_0x725e('0x4f')],qs['fields'](_0x4d05ee['query'][_0x725e('0x51')]));_0x3dc5e4[_0x725e('0x50')]=_0x3dc5e4[_0x725e('0x50')][_0x725e('0x52')]?_0x3dc5e4[_0x725e('0x50')]:_0x72308c[_0x725e('0x4f')];if(!_0x4d05ee[_0x725e('0x4c')][_0x725e('0xbc')](_0x725e('0xc5'))){_0x3dc5e4['limit']=qs['limit'](_0x4d05ee['query']['limit']);_0x3dc5e4[_0x725e('0x31')]=qs[_0x725e('0x31')](_0x4d05ee[_0x725e('0x4c')]['offset']);}_0x3dc5e4[_0x725e('0xba')]=qs[_0x725e('0x53')](_0x4d05ee['query'][_0x725e('0x53')]);_0x3dc5e4[_0x725e('0x54')]=qs[_0x725e('0x4d')](_[_0x725e('0x55')](_0x4d05ee['query'],_0x72308c[_0x725e('0x4d')]));_0x3dc5e4[_0x725e('0x54')][_0x725e('0xce')]=_0x2a1e1e['id'];if(_0x4d05ee[_0x725e('0x4c')][_0x725e('0x56')]){_0x3dc5e4[_0x725e('0x54')]=_[_0x725e('0x57')](_0x3dc5e4[_0x725e('0x54')],{'$or':_[_0x725e('0x3e')](_0x3dc5e4[_0x725e('0x50')],function(_0x38af1d){var _0x371efe={};_0x371efe[_0x38af1d]={'$like':'%'+_0x4d05ee[_0x725e('0x4c')][_0x725e('0x56')]+'%'};return _0x371efe;})});}_0x3dc5e4=_[_0x725e('0x57')]({},_0x3dc5e4,_0x4d05ee[_0x725e('0x5c')]);return db['ScreenRecording'][_0x725e('0x30')]({'where':_0x3dc5e4[_0x725e('0x54')]})[_0x725e('0x23')](function(_0x1d8cc4){_0x269f30['count']=_0x1d8cc4;if(_0x4d05ee['query'][_0x725e('0x5d')]){_0x3dc5e4[_0x725e('0x64')]=[{'all':!![]}];}return db[_0x725e('0xcd')][_0x725e('0x5e')](_0x3dc5e4);})[_0x725e('0x23')](function(_0x59e2c3){_0x269f30[_0x725e('0xcb')]=_0x59e2c3;return _0x269f30;});}})[_0x725e('0x23')](respondWithFilteredResult(_0x52a4b8,_0x3dc5e4))[_0x725e('0x2d')](handleError(_0x52a4b8,null));};exports['getChatInteractions']=function(_0x5b1136,_0x4b7e08,_0x48f841){var _0x360cf1={};var _0x1e37bc={};var _0x22a5da;var _0xe94536;return db[_0x725e('0x49')]['findOne']({'where':{'id':_0x5b1136[_0x725e('0x60')]['id']}})[_0x725e('0x23')](handleEntityNotFound(_0x4b7e08,null))['then'](function(_0x4bad97){if(_0x4bad97){_0x22a5da=_0x4bad97;_0x1e37bc[_0x725e('0x4f')]=_[_0x725e('0x62')](db[_0x725e('0xcf')]['rawAttributes']);_0x1e37bc[_0x725e('0x4c')]=_[_0x725e('0x62')](_0x5b1136[_0x725e('0x4c')]);_0x1e37bc[_0x725e('0x4d')]=_[_0x725e('0x4e')](_0x1e37bc[_0x725e('0x4f')],_0x1e37bc[_0x725e('0x4c')]);_0x360cf1[_0x725e('0x50')]=_[_0x725e('0x4e')](_0x1e37bc[_0x725e('0x4f')],qs['fields'](_0x5b1136[_0x725e('0x4c')]['fields']));_0x360cf1[_0x725e('0x50')]=_0x360cf1[_0x725e('0x50')][_0x725e('0x52')]?_0x360cf1[_0x725e('0x50')]:_0x1e37bc[_0x725e('0x4f')];_0x360cf1[_0x725e('0xba')]=qs['sort'](_0x5b1136[_0x725e('0x4c')]['sort']);_0x360cf1[_0x725e('0x54')]=qs[_0x725e('0x4d')](_[_0x725e('0x55')](_0x5b1136[_0x725e('0x4c')],_0x1e37bc[_0x725e('0x4d')]));if(_0x5b1136[_0x725e('0x4c')][_0x725e('0x56')]){_0x360cf1[_0x725e('0x54')]=_[_0x725e('0x57')](_0x360cf1[_0x725e('0x54')],{'$or':_['map'](_0x360cf1['attributes'],function(_0x62132f){var _0x1ef81c={};_0x1ef81c[_0x62132f]={'$like':'%'+_0x5b1136[_0x725e('0x4c')][_0x725e('0x56')]+'%'};return _0x1ef81c;})});}_0x360cf1=_['merge']({},_0x360cf1,_0x5b1136[_0x725e('0x5c')]);return _0x22a5da[_0x725e('0xd0')](_0x360cf1);}})[_0x725e('0x23')](function(_0x30f0ec){if(_0x30f0ec){_0xe94536=_0x30f0ec[_0x725e('0x52')];if(!_0x5b1136[_0x725e('0x4c')][_0x725e('0xbc')](_0x725e('0xc5'))){_0x360cf1[_0x725e('0x32')]=qs[_0x725e('0x32')](_0x5b1136[_0x725e('0x4c')]['limit']);_0x360cf1[_0x725e('0x31')]=qs['offset'](_0x5b1136['query'][_0x725e('0x31')]);}return _0x22a5da[_0x725e('0xd0')](_0x360cf1);}})[_0x725e('0x23')](function(_0xdac7d7){if(_0xdac7d7){return _0xdac7d7?{'count':_0xe94536,'rows':_0xdac7d7}:null;}})[_0x725e('0x23')](respondWithResult(_0x4b7e08,null))[_0x725e('0x2d')](handleError(_0x4b7e08,null));};exports[_0x725e('0xd1')]=function(_0x103c1a,_0x12565d,_0x3f21ed){var _0x3b4d29={};var _0x1c126c={};var _0x3478a3;var _0x3ead78;return db['User']['findOne']({'where':{'id':_0x103c1a[_0x725e('0x60')]['id']}})[_0x725e('0x23')](handleEntityNotFound(_0x12565d,null))[_0x725e('0x23')](function(_0x2e9850){if(_0x2e9850){_0x3478a3=_0x2e9850;_0x1c126c['model']=_['keys'](db[_0x725e('0xd2')]['rawAttributes']);_0x1c126c[_0x725e('0x4c')]=_[_0x725e('0x62')](_0x103c1a['query']);_0x1c126c['filters']=_['intersection'](_0x1c126c[_0x725e('0x4f')],_0x1c126c['query']);_0x3b4d29[_0x725e('0x50')]=_[_0x725e('0x4e')](_0x1c126c['model'],qs[_0x725e('0x51')](_0x103c1a[_0x725e('0x4c')][_0x725e('0x51')]));_0x3b4d29[_0x725e('0x50')]=_0x3b4d29[_0x725e('0x50')][_0x725e('0x52')]?_0x3b4d29[_0x725e('0x50')]:_0x1c126c[_0x725e('0x4f')];_0x3b4d29['order']=qs[_0x725e('0x53')](_0x103c1a[_0x725e('0x4c')][_0x725e('0x53')]);_0x3b4d29['where']=qs[_0x725e('0x4d')](_[_0x725e('0x55')](_0x103c1a[_0x725e('0x4c')],_0x1c126c['filters']));if(_0x103c1a[_0x725e('0x4c')][_0x725e('0x56')]){_0x3b4d29[_0x725e('0x54')]=_[_0x725e('0x57')](_0x3b4d29['where'],{'$or':_['map'](_0x3b4d29['attributes'],function(_0xcf6dea){var _0x360b06={};_0x360b06[_0xcf6dea]={'$like':'%'+_0x103c1a[_0x725e('0x4c')][_0x725e('0x56')]+'%'};return _0x360b06;})});}_0x3b4d29=_[_0x725e('0x57')]({},_0x3b4d29,_0x103c1a[_0x725e('0x5c')]);return _0x3478a3[_0x725e('0xd1')](_0x3b4d29);}})[_0x725e('0x23')](function(_0x50aafb){if(_0x50aafb){_0x3ead78=_0x50aafb[_0x725e('0x52')];if(!_0x103c1a[_0x725e('0x4c')][_0x725e('0xbc')]('nolimit')){_0x3b4d29[_0x725e('0x32')]=qs[_0x725e('0x32')](_0x103c1a[_0x725e('0x4c')][_0x725e('0x32')]);_0x3b4d29[_0x725e('0x31')]=qs[_0x725e('0x31')](_0x103c1a[_0x725e('0x4c')][_0x725e('0x31')]);}return _0x3478a3[_0x725e('0xd1')](_0x3b4d29);}})[_0x725e('0x23')](function(_0xbe01c5){if(_0xbe01c5){return _0xbe01c5?{'count':_0x3ead78,'rows':_0xbe01c5}:null;}})[_0x725e('0x23')](respondWithResult(_0x12565d,null))[_0x725e('0x2d')](handleError(_0x12565d,null));};exports[_0x725e('0xd3')]=function(_0x3bfad1,_0x4fa792,_0x858bc5){var _0x231c2a={'raw':!![],'where':{}};var _0xa77417={};var _0x3715a5={'count':0x0,'rows':[]};return db['User'][_0x725e('0x8f')]({'where':{'id':_0x3bfad1[_0x725e('0x60')]['id']}})[_0x725e('0x23')](handleEntityNotFound(_0x4fa792,null))[_0x725e('0x23')](function(_0x23c67){if(_0x23c67){_0xa77417['model']=_[_0x725e('0x62')](db[_0x725e('0xd4')][_0x725e('0xb9')]);_0xa77417[_0x725e('0x4c')]=_[_0x725e('0x62')](_0x3bfad1[_0x725e('0x4c')]);_0xa77417[_0x725e('0x4d')]=_[_0x725e('0x4e')](_0xa77417[_0x725e('0x4f')],_0xa77417[_0x725e('0x4c')]);_0x231c2a[_0x725e('0x50')]=_['intersection'](_0xa77417[_0x725e('0x4f')],qs[_0x725e('0x51')](_0x3bfad1[_0x725e('0x4c')][_0x725e('0x51')]));_0x231c2a[_0x725e('0x50')]=_0x231c2a[_0x725e('0x50')][_0x725e('0x52')]?_0x231c2a[_0x725e('0x50')]:_0xa77417[_0x725e('0x4f')];if(!_0x3bfad1[_0x725e('0x4c')][_0x725e('0xbc')](_0x725e('0xc5'))){_0x231c2a['limit']=qs['limit'](_0x3bfad1[_0x725e('0x4c')][_0x725e('0x32')]);_0x231c2a[_0x725e('0x31')]=qs[_0x725e('0x31')](_0x3bfad1[_0x725e('0x4c')][_0x725e('0x31')]);}_0x231c2a[_0x725e('0xba')]=qs[_0x725e('0x53')](_0x3bfad1[_0x725e('0x4c')][_0x725e('0x53')]);_0x231c2a[_0x725e('0x54')]=qs[_0x725e('0x4d')](_['pick'](_0x3bfad1[_0x725e('0x4c')],_0xa77417[_0x725e('0x4d')]));_0x231c2a['where'][_0x725e('0xce')]=_0x23c67['id'];if(_0x3bfad1['query'][_0x725e('0x56')]){_0x231c2a['where']=_['merge'](_0x231c2a[_0x725e('0x54')],{'$or':_[_0x725e('0x3e')](_0x231c2a['attributes'],function(_0x4cf82d){var _0x19b733={};_0x19b733[_0x4cf82d]={'$like':'%'+_0x3bfad1['query'][_0x725e('0x56')]+'%'};return _0x19b733;})});}_0x231c2a=_[_0x725e('0x57')]({},_0x231c2a,_0x3bfad1['options']);return db[_0x725e('0xd4')]['count']({'where':_0x231c2a[_0x725e('0x54')]})[_0x725e('0x23')](function(_0x4e4471){_0x3715a5[_0x725e('0x30')]=_0x4e4471;if(_0x3bfad1['query'][_0x725e('0x5d')]){_0x231c2a[_0x725e('0x64')]=[{'all':!![]}];}return db[_0x725e('0xd4')][_0x725e('0x5e')](_0x231c2a);})[_0x725e('0x23')](function(_0xa4925d){_0x3715a5[_0x725e('0xcb')]=_0xa4925d;return _0x3715a5;});}})[_0x725e('0x23')](respondWithFilteredResult(_0x4fa792,_0x231c2a))[_0x725e('0x2d')](handleError(_0x4fa792,null));};exports[_0x725e('0xd5')]=function(_0x7659ab,_0x390988,_0x549792){var _0x27a671={};var _0x149d27={};var _0xe3119b;var _0x5c50a9;return db[_0x725e('0x49')][_0x725e('0x8f')]({'where':{'id':_0x7659ab['params']['id']}})[_0x725e('0x23')](handleEntityNotFound(_0x390988,null))[_0x725e('0x23')](function(_0x3a87a2){if(_0x3a87a2){_0xe3119b=_0x3a87a2;_0x149d27[_0x725e('0x4f')]=_[_0x725e('0x62')](db[_0x725e('0xd6')]['rawAttributes']);_0x149d27[_0x725e('0x4c')]=_[_0x725e('0x62')](_0x7659ab[_0x725e('0x4c')]);_0x149d27[_0x725e('0x4d')]=_[_0x725e('0x4e')](_0x149d27[_0x725e('0x4f')],_0x149d27[_0x725e('0x4c')]);_0x27a671[_0x725e('0x50')]=_[_0x725e('0x4e')](_0x149d27[_0x725e('0x4f')],qs[_0x725e('0x51')](_0x7659ab[_0x725e('0x4c')][_0x725e('0x51')]));_0x27a671[_0x725e('0x50')]=_0x27a671[_0x725e('0x50')][_0x725e('0x52')]?_0x27a671[_0x725e('0x50')]:_0x149d27[_0x725e('0x4f')];_0x27a671[_0x725e('0xba')]=qs[_0x725e('0x53')](_0x7659ab[_0x725e('0x4c')][_0x725e('0x53')]);_0x27a671[_0x725e('0x54')]=qs[_0x725e('0x4d')](_['pick'](_0x7659ab['query'],_0x149d27[_0x725e('0x4d')]));if(_0x7659ab[_0x725e('0x4c')]['filter']){_0x27a671[_0x725e('0x54')]=_[_0x725e('0x57')](_0x27a671['where'],{'$or':_[_0x725e('0x3e')](_0x27a671['attributes'],function(_0x9b1bb4){var _0x2a6063={};_0x2a6063[_0x9b1bb4]={'$like':'%'+_0x7659ab[_0x725e('0x4c')]['filter']+'%'};return _0x2a6063;})});}_0x27a671=_[_0x725e('0x57')]({},_0x27a671,_0x7659ab[_0x725e('0x5c')]);return _0xe3119b[_0x725e('0xd5')](_0x27a671);}})[_0x725e('0x23')](function(_0x5899e7){if(_0x5899e7){_0x5c50a9=_0x5899e7[_0x725e('0x52')];if(!_0x7659ab[_0x725e('0x4c')][_0x725e('0xbc')]('nolimit')){_0x27a671[_0x725e('0x32')]=qs['limit'](_0x7659ab[_0x725e('0x4c')]['limit']);_0x27a671['offset']=qs[_0x725e('0x31')](_0x7659ab['query']['offset']);}return _0xe3119b[_0x725e('0xd5')](_0x27a671);}})[_0x725e('0x23')](function(_0x5c6a56){if(_0x5c6a56){return _0x5c6a56?{'count':_0x5c50a9,'rows':_0x5c6a56}:null;}})['then'](respondWithResult(_0x390988,null))[_0x725e('0x2d')](handleError(_0x390988,null));};exports[_0x725e('0xd7')]=function(_0xfbdb02,_0x19239a,_0x52e882){var _0x2536fe={};var _0x39ef44={};var _0x1732f5;var _0xfe97fe;return db[_0x725e('0x49')][_0x725e('0x8f')]({'where':{'id':_0xfbdb02[_0x725e('0x60')]['id']}})[_0x725e('0x23')](handleEntityNotFound(_0x19239a,null))['then'](function(_0x5e6497){if(_0x5e6497){_0x1732f5=_0x5e6497;_0x39ef44[_0x725e('0x4f')]=_['keys'](db['FaxInteraction']['rawAttributes']);_0x39ef44[_0x725e('0x4c')]=_['keys'](_0xfbdb02[_0x725e('0x4c')]);_0x39ef44[_0x725e('0x4d')]=_[_0x725e('0x4e')](_0x39ef44[_0x725e('0x4f')],_0x39ef44[_0x725e('0x4c')]);_0x2536fe[_0x725e('0x50')]=_[_0x725e('0x4e')](_0x39ef44[_0x725e('0x4f')],qs[_0x725e('0x51')](_0xfbdb02['query']['fields']));_0x2536fe[_0x725e('0x50')]=_0x2536fe['attributes'][_0x725e('0x52')]?_0x2536fe[_0x725e('0x50')]:_0x39ef44[_0x725e('0x4f')];_0x2536fe[_0x725e('0xba')]=qs['sort'](_0xfbdb02[_0x725e('0x4c')][_0x725e('0x53')]);_0x2536fe[_0x725e('0x54')]=qs[_0x725e('0x4d')](_[_0x725e('0x55')](_0xfbdb02[_0x725e('0x4c')],_0x39ef44[_0x725e('0x4d')]));if(_0xfbdb02['query'][_0x725e('0x56')]){_0x2536fe[_0x725e('0x54')]=_[_0x725e('0x57')](_0x2536fe['where'],{'$or':_[_0x725e('0x3e')](_0x2536fe['attributes'],function(_0x81acdf){var _0x34155d={};_0x34155d[_0x81acdf]={'$like':'%'+_0xfbdb02[_0x725e('0x4c')][_0x725e('0x56')]+'%'};return _0x34155d;})});}_0x2536fe=_[_0x725e('0x57')]({},_0x2536fe,_0xfbdb02[_0x725e('0x5c')]);return _0x1732f5[_0x725e('0xd7')](_0x2536fe);}})[_0x725e('0x23')](function(_0x330d8b){if(_0x330d8b){_0xfe97fe=_0x330d8b['length'];if(!_0xfbdb02[_0x725e('0x4c')]['hasOwnProperty'](_0x725e('0xc5'))){_0x2536fe[_0x725e('0x32')]=qs[_0x725e('0x32')](_0xfbdb02[_0x725e('0x4c')]['limit']);_0x2536fe[_0x725e('0x31')]=qs[_0x725e('0x31')](_0xfbdb02[_0x725e('0x4c')][_0x725e('0x31')]);}return _0x1732f5[_0x725e('0xd7')](_0x2536fe);}})[_0x725e('0x23')](function(_0x4c79a7){if(_0x4c79a7){return _0x4c79a7?{'count':_0xfe97fe,'rows':_0x4c79a7}:null;}})['then'](respondWithResult(_0x19239a,null))[_0x725e('0x2d')](handleError(_0x19239a,null));};exports[_0x725e('0xd8')]=function(_0x8552a0,_0xe8e4bf,_0xaa6421){var _0x5a49d1={};var _0x7c1400={};var _0x5a7dcc;var _0x310278;return db['User'][_0x725e('0x8f')]({'where':{'id':_0x8552a0['params']['id']}})[_0x725e('0x23')](handleEntityNotFound(_0xe8e4bf,null))[_0x725e('0x23')](function(_0x30be99){if(_0x30be99){_0x5a7dcc=_0x30be99;_0x7c1400[_0x725e('0x4f')]=_[_0x725e('0x62')](db[_0x725e('0xd9')][_0x725e('0xb9')]);_0x7c1400[_0x725e('0x4c')]=_[_0x725e('0x62')](_0x8552a0[_0x725e('0x4c')]);_0x7c1400['filters']=_[_0x725e('0x4e')](_0x7c1400[_0x725e('0x4f')],_0x7c1400['query']);_0x5a49d1['attributes']=_[_0x725e('0x4e')](_0x7c1400['model'],qs[_0x725e('0x51')](_0x8552a0[_0x725e('0x4c')]['fields']));_0x5a49d1[_0x725e('0x50')]=_0x5a49d1[_0x725e('0x50')][_0x725e('0x52')]?_0x5a49d1['attributes']:_0x7c1400['model'];_0x5a49d1[_0x725e('0xba')]=qs[_0x725e('0x53')](_0x8552a0[_0x725e('0x4c')][_0x725e('0x53')]);_0x5a49d1['where']=qs[_0x725e('0x4d')](_[_0x725e('0x55')](_0x8552a0[_0x725e('0x4c')],_0x7c1400[_0x725e('0x4d')]));if(_0x8552a0[_0x725e('0x4c')][_0x725e('0x56')]){_0x5a49d1[_0x725e('0x54')]=_['merge'](_0x5a49d1[_0x725e('0x54')],{'$or':_[_0x725e('0x3e')](_0x5a49d1[_0x725e('0x50')],function(_0x574b55){var _0x373cd3={};_0x373cd3[_0x574b55]={'$like':'%'+_0x8552a0[_0x725e('0x4c')]['filter']+'%'};return _0x373cd3;})});}_0x5a49d1=_[_0x725e('0x57')]({},_0x5a49d1,_0x8552a0['options']);return _0x5a7dcc[_0x725e('0xd8')](_0x5a49d1);}})[_0x725e('0x23')](function(_0x5e78a7){if(_0x5e78a7){_0x310278=_0x5e78a7[_0x725e('0x52')];if(!_0x8552a0['query'][_0x725e('0xbc')]('nolimit')){_0x5a49d1[_0x725e('0x32')]=qs[_0x725e('0x32')](_0x8552a0[_0x725e('0x4c')][_0x725e('0x32')]);_0x5a49d1[_0x725e('0x31')]=qs['offset'](_0x8552a0['query'][_0x725e('0x31')]);}return _0x5a7dcc[_0x725e('0xd8')](_0x5a49d1);}})[_0x725e('0x23')](function(_0x24ffb5){if(_0x24ffb5){return _0x24ffb5?{'count':_0x310278,'rows':_0x24ffb5}:null;}})[_0x725e('0x23')](respondWithResult(_0xe8e4bf,null))[_0x725e('0x2d')](handleError(_0xe8e4bf,null));};exports[_0x725e('0xda')]=function(_0x360a9f,_0x1c506e,_0xa13af2){var _0x171817;var _0x3f724b;var _0x8e55b2;var _0x46ef6f=!_['isNil'](_0x360a9f[_0x725e('0x60')]['id'])?_0x360a9f[_0x725e('0x60')]['id']:!_[_0x725e('0x6e')](_0x360a9f['user']['id'])?_0x360a9f[_0x725e('0x3a')]['id']:null;return db['User']['find']({'where':{'id':_0x46ef6f,'role':{'$or':['admin',_0x725e('0x3a'),_0x725e('0x3b')]}},'attributes':['id','name','phone',_0x725e('0xdb'),_0x725e('0x40'),_0x725e('0x72'),'loginInPause']})[_0x725e('0x23')](function(_0xbbb5cd){if(_0xbbb5cd){if(_0xbbb5cd['role']===_0x725e('0x3b')){_0x171817=_0xbbb5cd;if(_0x360a9f[_0x725e('0x66')][_0x725e('0x9b')]){_0x8e55b2=util[_0x725e('0x70')](_0x725e('0xdc'),_0x171817[_0x360a9f['body'][_0x725e('0x9b')]]);}else if(_0x360a9f[_0x725e('0x66')][_0x725e('0xdd')]){_0x8e55b2=util[_0x725e('0x70')](_0x725e('0xaa'),_0x360a9f['body'][_0x725e('0xdd')]);}else{_0x8e55b2=util[_0x725e('0x70')](_0x725e('0xaa'),_0x171817[_0x725e('0x46')]);}socket['to'](util[_0x725e('0x70')](_0x725e('0xde'),_0x171817['name']))['emit'](_0x725e('0xdf'),{'ip':_0x360a9f['headers'][_0x725e('0xe0')]||_0x360a9f[_0x725e('0xe1')]['remoteAddress']||_0x360a9f[_0x725e('0xe2')][_0x725e('0xe3')]||_0x360a9f[_0x725e('0xe1')][_0x725e('0xe2')][_0x725e('0xe3')]});return db[_0x725e('0xab')][_0x725e('0x43')]({'where':{'membername':_0x171817[_0x725e('0x46')]},'individualHooks':!![]});}}else{throw new db['Sequelize'][(_0x725e('0x21'))](_0x725e('0xe4'));}})[_0x725e('0x23')](function(){if(_0x171817){return _0x171817[_0x725e('0xe5')]({'raw':!![]});}})[_0x725e('0x23')](function(_0xebb054){if(_0x171817){var _0x221e95=[];if(_0xebb054){_0x3f724b=_0xebb054;if(_0x3f724b[_0x725e('0x52')]){for(var _0x1c1a18=0x0;_0x1c1a18<_0x3f724b['length'];_0x1c1a18++){_0x221e95[_0x725e('0xa9')]({'membername':_0x171817[_0x725e('0x46')],'UserId':_0x171817['id'],'queue_name':_0x3f724b[_0x1c1a18][_0x725e('0x46')],'VoiceQueueId':_0x3f724b[_0x1c1a18]['id'],'interface':_0x8e55b2,'paused':_0x171817[_0x725e('0x9a')]||![],'penalty':_0x3f724b[_0x1c1a18][_0x725e('0xe6')]||0x0});}return BPromise[_0x725e('0xe7')](_0x221e95,function(_0x3c965c){return db[_0x725e('0xab')][_0x725e('0xe8')](_0x3c965c);});}}}})[_0x725e('0x23')](function(){if(_0x171817){return db[_0x725e('0xe9')][_0x725e('0x5e')]({'where':{'membername':_0x171817['name'],'exitAt':null}});}})[_0x725e('0x23')](function(_0xa84766){if(_0x171817){var _0x575766=[];_0xa84766[_0x725e('0xea')](function(_0x32d477){_0x575766['push'](_0x32d477[_0x725e('0x38')]({'exitAt':moment()[_0x725e('0x70')](_0x725e('0xeb'))}));});return BPromise[_0x725e('0xec')](_0x575766);}})[_0x725e('0x23')](function(){if(_0x171817){var _0x834ed8=[];var _0x37cd5f=[];var _0xe33cf1=utils[_0x725e('0xed')]();var _0x1c935e={'membername':_0x171817['name'],'interface':_0x8e55b2,'enterAt':moment()[_0x725e('0x70')](_0x725e('0xeb')),'role':_0x171817[_0x725e('0x40')],'internal':_0x171817[_0x725e('0x72')]};_0xe33cf1[_0x725e('0xea')](function(_0x3bd6e5){_0x834ed8[_0x725e('0xa9')](_[_0x725e('0x57')]({'channel':_0x3bd6e5,'type':_0x725e('0xee'),'data1':_0x360a9f['body'][_0x725e('0xef')],'data2':_0x8e55b2},_0x1c935e));if(_0x171817['loginInPause']){_0x37cd5f['push'](_[_0x725e('0x57')]({'channel':_0x3bd6e5,'type':_0x725e('0xf0'),'data1':'LOGININPAUSE'},_0x1c935e));}});return db[_0x725e('0xe9')][_0x725e('0x65')](_0x834ed8[_0x725e('0xf1')](_0x37cd5f),{'individualHooks':!![]});}})[_0x725e('0x23')](function(){if(_0x171817){return _0x171817[_0x725e('0x38')]({'online':!![],'lastLoginAt':moment()['format'](_0x725e('0xeb')),'voicePause':_0x171817[_0x725e('0x9a')]||![],'mailPause':_0x171817[_0x725e('0x9a')]||![],'chatPause':_0x171817['loginInPause']||![],'faxPause':_0x171817['loginInPause']||![],'smsPause':_0x171817[_0x725e('0x9a')]||![],'openchannelPause':_0x171817[_0x725e('0x9a')]||![],'whatsappPause':_0x171817[_0x725e('0x9a')]||![],'pauseType':_0x171817['loginInPause']?_0x725e('0xf2'):null,'interface':_0x8e55b2,'lastPauseAt':moment()[_0x725e('0x70')]('YYYY-MM-DD\x20HH:mm:ss')});}})[_0x725e('0x23')](function(_0x406839){if(_0x360a9f[_0x725e('0xf3')]){return _0xa13af2();}else{return BPromise[_0x725e('0xf4')](_0x406839)[_0x725e('0x23')](respondWithResult(_0x1c506e,null));}})[_0x725e('0x2d')](handleError(_0x1c506e,null));};exports['logout']=function(_0x16db38,_0x19bf53,_0x228143){var _0x1f93f8;return db[_0x725e('0x49')]['find']({'where':{'id':_0x16db38[_0x725e('0x60')]['id'],'role':_0x725e('0x3b')},'attributes':['id','name',_0x725e('0x40')]})[_0x725e('0x23')](handleEntityNotFound(_0x19bf53,null))[_0x725e('0x23')](function(_0xdf433){if(_0xdf433){_0x1f93f8=_0xdf433;return db[_0x725e('0xab')]['destroy']({'where':{'membername':_0x1f93f8[_0x725e('0x46')]},'individualHooks':!![]});}})[_0x725e('0x23')](function(){return db[_0x725e('0xe9')][_0x725e('0x5e')]({'where':{'membername':_0x1f93f8[_0x725e('0x46')],'exitAt':null}});})[_0x725e('0x23')](function(_0x34e9d8){var _0x18f997=[];_0x34e9d8['forEach'](function(_0x1c6e0f){_0x18f997['push'](_0x1c6e0f[_0x725e('0x38')]({'exitAt':moment()[_0x725e('0x70')](_0x725e('0xeb'))}));});return BPromise[_0x725e('0xec')](_0x18f997);})[_0x725e('0x23')](function(){return _0x1f93f8[_0x725e('0x38')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x725e('0x23')](respondWithResult(_0x19bf53,null))['catch'](handleError(_0x19bf53,null));};exports[_0x725e('0xf5')]=function(_0x5480fb,_0x47b704,_0x44b05a){var _0x59d28d;return db[_0x725e('0xab')][_0x725e('0x38')]({'paused':0x1},{'where':{'UserId':_0x5480fb[_0x725e('0x60')]['id']},'individualHooks':!![]})[_0x725e('0x23')](function(){return db[_0x725e('0x49')][_0x725e('0x41')]({'where':{'id':_0x5480fb[_0x725e('0x60')]['id'],'role':'agent'},'attributes':['id','name',_0x725e('0x40'),_0x725e('0x72'),_0x725e('0x9b')]});})[_0x725e('0x23')](handleEntityNotFound(_0x47b704,null))['then'](function(_0x54d323){if(_0x54d323){_0x59d28d=_0x54d323;return respondWithRpcPromise(_0x725e('0xf6'),_0x725e('0xf5'),{'id':_0x59d28d['id'],'name':_0x59d28d[_0x725e('0x46')],'pause':!![]});}})[_0x725e('0x23')](function(){if(_0x59d28d){return db[_0x725e('0xe9')][_0x725e('0x5e')]({'where':{'membername':_0x59d28d['name'],'type':'PAUSE','exitAt':null}});}})[_0x725e('0x23')](function(_0x5a7ecd){if(_0x5a7ecd[_0x725e('0x52')]){var _0x42c0b3=moment()[_0x725e('0x70')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x146964=0x0,_0x3fc546=_0x5a7ecd[_0x725e('0x52')];_0x146964<_0x3fc546;_0x146964++){_0x5a7ecd[_0x146964][_0x725e('0xf7')]({'exitAt':_0x42c0b3});}}})[_0x725e('0x23')](function(){var _0x1c3554=[];var _0x15a306=utils['getChannels']();_0x15a306[_0x725e('0xea')](function(_0x23f9f8){_0x1c3554[_0x725e('0xa9')]({'channel':_0x23f9f8,'membername':_0x59d28d[_0x725e('0x46')],'interface':_[_0x725e('0x6e')](_0x59d28d['interface'])?util['format'](_0x725e('0xaa'),_0x59d28d[_0x725e('0x46')]):_0x59d28d[_0x725e('0x9b')],'type':'PAUSE','enterAt':moment()[_0x725e('0x70')]('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x5480fb[_0x725e('0x66')][_0x725e('0x58')]||_0x725e('0xf8'),'role':_0x59d28d['role'],'internal':_0x59d28d[_0x725e('0x72')]});});return db[_0x725e('0xe9')]['bulkCreate'](_0x1c3554,{'individualHooks':!![]});})[_0x725e('0x23')](function(){return _0x59d28d['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x5480fb['body'][_0x725e('0x58')]||'DEFAULT\x20PAUSE','lastPauseAt':moment()[_0x725e('0x70')]('YYYY-MM-DD\x20HH:mm:ss')});})['then'](respondWithResult(_0x47b704,null))[_0x725e('0x2d')](handleError(_0x47b704,null));};exports[_0x725e('0xf9')]=function(_0x1cf1b2,_0x4a1c7d,_0xc83740){var _0x16280c;return db[_0x725e('0x49')][_0x725e('0x41')]({'where':{'id':_0x1cf1b2['params']['id']},'attributes':['id',_0x725e('0x46'),_0x725e('0x40'),_0x725e('0xfa'),_0x725e('0xfb'),_0x725e('0xfc'),_0x725e('0xfd'),_0x725e('0xfe'),_0x725e('0xff'),_0x725e('0x100'),_0x725e('0x101'),_0x725e('0x102')]})[_0x725e('0x23')](handleEntityNotFound(_0x4a1c7d,null))['then'](function(_0x5a589e){if(_0x5a589e){_0x16280c=_0x5a589e;if(_0x1cf1b2['body'][_0x725e('0xae')]&&!utils[_0x725e('0x9c')](_0x1cf1b2[_0x725e('0x66')][_0x725e('0xae')])){throw new db['Sequelize'][(_0x725e('0x21'))](_0x725e('0x9d'));}switch(_0x1cf1b2[_0x725e('0x66')][_0x725e('0xae')]){case _0x725e('0xa7'):return respondWithRpcPromise(_0x725e('0xf6'),'unpause',{'id':_0x16280c['id'],'name':_0x16280c[_0x725e('0x46')],'pause':![]})[_0x725e('0x23')](function(){return db[_0x725e('0xab')][_0x725e('0x38')]({'paused':0x0},{'where':{'UserId':_0x16280c['id']},'individualHooks':!![]});})[_0x725e('0x23')](function(){return db[_0x725e('0xe9')][_0x725e('0x41')]({'where':{'channel':_0x1cf1b2[_0x725e('0x66')][_0x725e('0xae')],'membername':_0x16280c['name'],'type':_0x725e('0xf0'),'exitAt':null}});})[_0x725e('0x23')](function(_0x33e8cc){if(_0x33e8cc){return _0x33e8cc[_0x725e('0x38')]({'exitAt':moment()[_0x725e('0x70')](_0x725e('0xeb')),'data2':_0x725e('0x103')},{'individualHooks':!![]});}return null;})[_0x725e('0x23')](function(){return _0x16280c['update']({'voicePause':![]});});case _0x725e('0x104'):case'chat':case'fax':case _0x725e('0x105'):case'whatsapp':case _0x725e('0x106'):return db[_0x725e('0xe9')][_0x725e('0x41')]({'where':{'channel':_0x1cf1b2['body'][_0x725e('0xae')],'membername':_0x16280c['name'],'type':'PAUSE','exitAt':null}})[_0x725e('0x23')](function(_0x9ec2f3){if(_0x9ec2f3){return _0x9ec2f3[_0x725e('0x38')]({'exitAt':moment()[_0x725e('0x70')](_0x725e('0xeb')),'data2':_0x725e('0x103')},{'individualHooks':!![]});}return null;})[_0x725e('0x23')](function(){var _0x12f9d7={};_[_0x725e('0x34')](_0x12f9d7,util['format'](_0x725e('0x107'),_0x1cf1b2[_0x725e('0x66')][_0x725e('0xae')],_0x725e('0x108')),![]);return _0x16280c['update'](_0x12f9d7);});default:return respondWithRpcPromise(_0x725e('0xf6'),_0x725e('0xf9'),{'id':_0x16280c['id'],'name':_0x16280c[_0x725e('0x46')],'pause':![]})[_0x725e('0x23')](function(){return db[_0x725e('0xab')][_0x725e('0x38')]({'paused':0x0},{'where':{'UserId':_0x16280c['id']}});})[_0x725e('0x23')](function(){return db['MemberReport'][_0x725e('0x5e')]({'where':{'membername':_0x16280c[_0x725e('0x46')],'type':_0x725e('0xf0'),'exitAt':null}});})[_0x725e('0x23')](function(_0x68f046){var _0x2b2803=[];_0x68f046[_0x725e('0xea')](function(_0x444989){_0x2b2803[_0x725e('0xa9')](_0x444989[_0x725e('0x38')]({'exitAt':moment()[_0x725e('0x70')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0x725e('0x103')}));});return BPromise[_0x725e('0xec')](_0x2b2803);})[_0x725e('0x23')](function(){return _0x16280c[_0x725e('0x38')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})[_0x725e('0x23')](respondWithResult(_0x4a1c7d,null))['catch'](handleError(_0x4a1c7d,null));};exports[_0x725e('0x109')]=function(_0x33c36f,_0x47bdb6,_0x23feec){var _0x56d8f7={};var _0x24e45d={};var _0xe4cdb;var _0x331693;return db[_0x725e('0x49')][_0x725e('0x8f')]({'where':{'id':_0x33c36f[_0x725e('0x60')]['id']}})[_0x725e('0x23')](handleEntityNotFound(_0x47bdb6,null))[_0x725e('0x23')](function(_0x291ab9){if(_0x291ab9){_0xe4cdb=_0x291ab9;_0x24e45d[_0x725e('0x4f')]=_[_0x725e('0x62')](db[_0x725e('0x10a')][_0x725e('0xb9')]);_0x24e45d['query']=_[_0x725e('0x62')](_0x33c36f[_0x725e('0x4c')]);_0x24e45d[_0x725e('0x4d')]=_[_0x725e('0x4e')](_0x24e45d[_0x725e('0x4f')],_0x24e45d[_0x725e('0x4c')]);_0x56d8f7[_0x725e('0x50')]=_[_0x725e('0x4e')](_0x24e45d[_0x725e('0x4f')],qs['fields'](_0x33c36f[_0x725e('0x4c')][_0x725e('0x51')]));_0x56d8f7['attributes']=_0x56d8f7[_0x725e('0x50')]['length']?_0x56d8f7[_0x725e('0x50')]:_0x24e45d[_0x725e('0x4f')];_0x56d8f7['order']=qs[_0x725e('0x53')](_0x33c36f[_0x725e('0x4c')][_0x725e('0x53')]);_0x56d8f7[_0x725e('0x54')]=qs[_0x725e('0x4d')](_['pick'](_0x33c36f[_0x725e('0x4c')],_0x24e45d['filters']));if(_0x33c36f['query'][_0x725e('0x56')]){_0x56d8f7['where']=_['merge'](_0x56d8f7[_0x725e('0x54')],{'$or':_[_0x725e('0x3e')](_0x56d8f7[_0x725e('0x50')],function(_0x2eac92){var _0x38ed77={};_0x38ed77[_0x2eac92]={'$like':'%'+_0x33c36f[_0x725e('0x4c')]['filter']+'%'};return _0x38ed77;})});}_0x56d8f7=_[_0x725e('0x57')]({},_0x56d8f7,_0x33c36f['options']);return _0xe4cdb[_0x725e('0x109')](_0x56d8f7);}})[_0x725e('0x23')](function(_0x537a30){if(_0x537a30){_0x331693=_0x537a30[_0x725e('0x52')];if(!_0x33c36f[_0x725e('0x4c')][_0x725e('0xbc')](_0x725e('0xc5'))){_0x56d8f7[_0x725e('0x32')]=qs[_0x725e('0x32')](_0x33c36f['query']['limit']);_0x56d8f7[_0x725e('0x31')]=qs[_0x725e('0x31')](_0x33c36f[_0x725e('0x4c')][_0x725e('0x31')]);}return _0xe4cdb[_0x725e('0x109')](_0x56d8f7);}})[_0x725e('0x23')](function(_0x160fc4){if(_0x160fc4){return _0x160fc4?{'count':_0x331693,'rows':_0x160fc4}:null;}})[_0x725e('0x23')](respondWithResult(_0x47bdb6,null))['catch'](handleError(_0x47bdb6,null));};exports[_0x725e('0x10b')]=function(_0x3743a3,_0x322541){return db[_0x725e('0x49')]['find']({'where':{'id':_0x3743a3[_0x725e('0x60')]['id']}})[_0x725e('0x23')](handleEntityNotFound(_0x322541,null))['then'](function(_0x18e4df){if(_0x18e4df){var _0xd4b721=_0x18e4df[_0x725e('0x39')]({'plain':!![]});return _0x18e4df[_0x725e('0x10b')](_0x3743a3[_0x725e('0x66')][_0x725e('0x69')],_['omit'](_0x3743a3[_0x725e('0x66')],[_0x725e('0x69'),'id'])||{})[_0x725e('0x23')](function(){for(var _0x4425b6=0x0;_0x4425b6<_0x3743a3[_0x725e('0x66')][_0x725e('0x69')][_0x725e('0x52')];_0x4425b6++){var _0xea6f6a=[];db[_0x725e('0x10a')][_0x725e('0x8f')]({'where':{'id':_0x3743a3['body'][_0x725e('0x69')][_0x4425b6]}})[_0x725e('0x23')](function(_0x1712e3){_0xea6f6a['push'](_0x1712e3[_0x725e('0xe5')]()[_0x725e('0x23')](function(_0x166551){for(var _0x5584cc=0x0;_0x5584cc<_0x166551[_0x725e('0x52')];_0x5584cc++){_0x166551[_0x5584cc]['setDataValue'](_0x725e('0xae'),_0x725e('0x10c'));}return _0x166551;}));_0xea6f6a[_0x725e('0xa9')](_0x1712e3[_0x725e('0x10d')]()[_0x725e('0x23')](function(_0x56c47e){for(var _0x23b0c8=0x0;_0x23b0c8<_0x56c47e[_0x725e('0x52')];_0x23b0c8++){_0x56c47e[_0x23b0c8][_0x725e('0x10e')](_0x725e('0xae'),'Chat');}return _0x56c47e;}));_0xea6f6a[_0x725e('0xa9')](_0x1712e3['getMailQueues']()[_0x725e('0x23')](function(_0x1ffc92){for(var _0x14918a=0x0;_0x14918a<_0x1ffc92[_0x725e('0x52')];_0x14918a++){_0x1ffc92[_0x14918a][_0x725e('0x10e')](_0x725e('0xae'),_0x725e('0x10f'));}return _0x1ffc92;}));_0xea6f6a[_0x725e('0xa9')](_0x1712e3[_0x725e('0x110')]()[_0x725e('0x23')](function(_0x4f8bf0){for(var _0x2aa5fa=0x0;_0x2aa5fa<_0x4f8bf0[_0x725e('0x52')];_0x2aa5fa++){_0x4f8bf0[_0x2aa5fa][_0x725e('0x10e')](_0x725e('0xae'),_0x725e('0x111'));}return _0x4f8bf0;}));_0xea6f6a[_0x725e('0xa9')](_0x1712e3[_0x725e('0x112')]()['then'](function(_0x1bd897){for(var _0x4fd86b=0x0;_0x4fd86b<_0x1bd897['length'];_0x4fd86b++){_0x1bd897[_0x4fd86b]['setDataValue'](_0x725e('0xae'),'Whatsapp');}return _0x1bd897;}));_0xea6f6a[_0x725e('0xa9')](_0x1712e3[_0x725e('0x113')]()['then'](function(_0x2d88f3){for(var _0x5568a6=0x0;_0x5568a6<_0x2d88f3[_0x725e('0x52')];_0x5568a6++){_0x2d88f3[_0x5568a6][_0x725e('0x10e')](_0x725e('0xae'),_0x725e('0x114'));}return _0x2d88f3;}));_0xea6f6a[_0x725e('0xa9')](_0x1712e3[_0x725e('0x115')]()['then'](function(_0x13fd15){for(var _0x15419d=0x0;_0x15419d<_0x13fd15[_0x725e('0x52')];_0x15419d++){_0x13fd15[_0x15419d][_0x725e('0x10e')](_0x725e('0xae'),_0x725e('0x116'));}return _0x13fd15;}));return BPromise[_0x725e('0xec')](_0xea6f6a);})[_0x725e('0x23')](function(_0x29bbf7){var _0x5ceebf=_['flatten'](_0x29bbf7);_0xea6f6a=[];return db[_0x725e('0x59')][_0x725e('0x117')](function(_0xb63b5a){for(var _0x2541f1=0x0;_0x2541f1<_0x5ceebf[_0x725e('0x52')];_0x2541f1++){_0xea6f6a['push'](_0x5ceebf[_0x2541f1][_0x725e('0x118')](_0xd4b721['id']),{'transaction':_0xb63b5a});}return BPromise[_0x725e('0xec')](_0xea6f6a)['then'](function(){if(_0xd4b721[_0x725e('0x99')]){return BPromise[_0x725e('0xe7')](_[_0x725e('0x56')](_0x5ceebf,function(_0x4b3367){return _0x4b3367['getDataValue'](_0x725e('0xae'))===_0x725e('0x10c');}),function(_0x567846){return db['UserVoiceQueueRt'][_0x725e('0xe8')]({'membername':_0xd4b721[_0x725e('0x46')],'UserId':_0xd4b721['id'],'queue_name':_0x567846[_0x725e('0x46')],'VoiceQueueId':_0x567846['id'],'interface':_[_0x725e('0x6e')](_0xd4b721[_0x725e('0x9b')])?util[_0x725e('0x70')](_0x725e('0xaa'),_0xd4b721[_0x725e('0x46')]):_0xd4b721[_0x725e('0x9b')],'paused':_0xd4b721[_0x725e('0xfa')]||![],'penalty':_0xd4b721[_0x725e('0xa2')]},{'transaction':_0xb63b5a});});}else{return;}})[_0x725e('0x23')](function(){for(var _0x1809d5=0x0;_0x1809d5<_0x5ceebf[_0x725e('0x52')];_0x1809d5++){var _0x17f305=_0x5ceebf[_0x1809d5][_0x725e('0x119')](_0x725e('0xae'));var _0x4c3547=_0x17f305+_0x725e('0xa4');socket[_0x725e('0xa5')](_0x725e('0x3a')+_0x17f305+_0x725e('0xa6'),{'UserId':_0xd4b721['id'],['queueField']:_0x5ceebf[_0x1809d5]['id']});}});});});}});}})['then'](respondWithStatusCode(_0x322541,null))['catch'](handleError(_0x322541,null));};exports[_0x725e('0x11a')]=function(_0x2c28b4,_0x425b79){return db[_0x725e('0x49')][_0x725e('0x8f')]({'where':{'id':_0x2c28b4[_0x725e('0x60')]['id']}})[_0x725e('0x23')](handleEntityNotFound(_0x425b79,null))[_0x725e('0x23')](function(_0x45bed3){if(_0x45bed3){var _0x904f=_0x45bed3['get']({'plain':!![]});var _0x5d451=_0x2c28b4[_0x725e('0x4c')][_0x725e('0x69')];return _0x45bed3[_0x725e('0x11a')](_0x5d451)[_0x725e('0x23')](function(){for(var _0x37aa60=0x0;_0x37aa60<_0x5d451[_0x725e('0x52')];_0x37aa60++){var _0x368d1a=[];db[_0x725e('0x10a')][_0x725e('0x8f')]({'where':{'id':_0x5d451[_0x37aa60]}})[_0x725e('0x23')](function(_0x3fa010){_0x368d1a[_0x725e('0xa9')](_0x3fa010[_0x725e('0xe5')]()[_0x725e('0x23')](function(_0x2c19f0){for(var _0x3fe802=0x0;_0x3fe802<_0x2c19f0[_0x725e('0x52')];_0x3fe802++){_0x2c19f0[_0x3fe802][_0x725e('0x10e')](_0x725e('0xae'),_0x725e('0x10c'));}return _0x2c19f0;}));_0x368d1a[_0x725e('0xa9')](_0x3fa010[_0x725e('0x10d')]()['then'](function(_0x1a93e1){for(var _0x2e588e=0x0;_0x2e588e<_0x1a93e1[_0x725e('0x52')];_0x2e588e++){_0x1a93e1[_0x2e588e][_0x725e('0x10e')]('channel','Chat');}return _0x1a93e1;}));_0x368d1a[_0x725e('0xa9')](_0x3fa010[_0x725e('0x11b')]()[_0x725e('0x23')](function(_0x31d7e2){for(var _0x302a0f=0x0;_0x302a0f<_0x31d7e2[_0x725e('0x52')];_0x302a0f++){_0x31d7e2[_0x302a0f]['setDataValue']('channel','Mail');}return _0x31d7e2;}));_0x368d1a[_0x725e('0xa9')](_0x3fa010[_0x725e('0x110')]()[_0x725e('0x23')](function(_0x327d5f){for(var _0x5ea314=0x0;_0x5ea314<_0x327d5f['length'];_0x5ea314++){_0x327d5f[_0x5ea314]['setDataValue'](_0x725e('0xae'),'Sms');}return _0x327d5f;}));_0x368d1a[_0x725e('0xa9')](_0x3fa010[_0x725e('0x112')]()['then'](function(_0x2d8a90){for(var _0x1a5c83=0x0;_0x1a5c83<_0x2d8a90['length'];_0x1a5c83++){_0x2d8a90[_0x1a5c83]['setDataValue'](_0x725e('0xae'),_0x725e('0x11c'));}return _0x2d8a90;}));_0x368d1a[_0x725e('0xa9')](_0x3fa010[_0x725e('0x113')]()[_0x725e('0x23')](function(_0x4e1bd0){for(var _0xeba618=0x0;_0xeba618<_0x4e1bd0[_0x725e('0x52')];_0xeba618++){_0x4e1bd0[_0xeba618][_0x725e('0x10e')]('channel',_0x725e('0x114'));}return _0x4e1bd0;}));_0x368d1a[_0x725e('0xa9')](_0x3fa010[_0x725e('0x115')]()['then'](function(_0x6a2b6c){for(var _0x29b753=0x0;_0x29b753<_0x6a2b6c[_0x725e('0x52')];_0x29b753++){_0x6a2b6c[_0x29b753][_0x725e('0x10e')](_0x725e('0xae'),'Openchannel');}return _0x6a2b6c;}));return BPromise[_0x725e('0xec')](_0x368d1a);})[_0x725e('0x23')](function(_0x4790f6){var _0x5e3cd3=_[_0x725e('0x11d')](_0x4790f6);_0x368d1a=[];return db[_0x725e('0x59')]['transaction'](function(_0x42b18f){for(var _0x2fc188=0x0;_0x2fc188<_0x5e3cd3[_0x725e('0x52')];_0x2fc188++){_0x368d1a[_0x725e('0xa9')](_0x5e3cd3[_0x2fc188][_0x725e('0x11e')](_0x904f['id']),{'transaction':_0x42b18f});}return BPromise[_0x725e('0xec')](_0x368d1a)[_0x725e('0x23')](function(){if(_0x904f[_0x725e('0x99')]){return BPromise[_0x725e('0xe7')](_[_0x725e('0x56')](_0x5e3cd3,function(_0x40cd39){return _0x40cd39[_0x725e('0x119')](_0x725e('0xae'))===_0x725e('0x10c');}),function(_0x9a40bc){return db[_0x725e('0xab')][_0x725e('0x43')]({'where':{'VoiceQueueId':_0x9a40bc['id'],'UserId':_0x904f['id']},'transaction':_0x42b18f});});}else{return;}})['then'](function(){for(var _0x57596e=0x0;_0x57596e<_0x5e3cd3[_0x725e('0x52')];_0x57596e++){var _0xf86227=_0x5e3cd3[_0x57596e][_0x725e('0x119')]('channel');var _0x265081=_0xf86227+_0x725e('0xa4');socket[_0x725e('0xa5')](_0x725e('0x3a')+_0xf86227+_0x725e('0xaf'),{'UserId':_0x904f['id'],['queueField']:_0x5e3cd3[_0x57596e]['id']});}});});});}});}})[_0x725e('0x23')](respondWithStatusCode(_0x425b79,null))[_0x725e('0x2d')](handleError(_0x425b79,null));};exports[_0x725e('0x11f')]=function(_0x19572c,_0x216a56,_0x570fdc){var _0x5fb2dd={};var _0x4414dd={};var _0x26ab76;var _0x3017ca;return db['User'][_0x725e('0x8f')]({'where':{'id':_0x19572c[_0x725e('0x60')]['id']}})['then'](handleEntityNotFound(_0x216a56,null))[_0x725e('0x23')](function(_0x5f465e){if(_0x5f465e){_0x26ab76=_0x5f465e;_0x4414dd[_0x725e('0x4f')]=_[_0x725e('0x62')](db[_0x725e('0xbd')][_0x725e('0xb9')]);_0x4414dd[_0x725e('0x4c')]=_[_0x725e('0x62')](_0x19572c['query']);_0x4414dd['filters']=_[_0x725e('0x4e')](_0x4414dd[_0x725e('0x4f')],_0x4414dd[_0x725e('0x4c')]);_0x5fb2dd['attributes']=_[_0x725e('0x4e')](_0x4414dd['model'],qs[_0x725e('0x51')](_0x19572c['query'][_0x725e('0x51')]));_0x5fb2dd[_0x725e('0x50')]=_0x5fb2dd['attributes'][_0x725e('0x52')]?_0x5fb2dd['attributes']:_0x4414dd[_0x725e('0x4f')];_0x5fb2dd['order']=qs[_0x725e('0x53')](_0x19572c[_0x725e('0x4c')]['sort']);_0x5fb2dd[_0x725e('0x54')]=qs[_0x725e('0x4d')](_[_0x725e('0x55')](_0x19572c[_0x725e('0x4c')],_0x4414dd[_0x725e('0x4d')]));if(_0x19572c[_0x725e('0x4c')][_0x725e('0x56')]){_0x5fb2dd[_0x725e('0x54')]=_[_0x725e('0x57')](_0x5fb2dd[_0x725e('0x54')],{'$or':_[_0x725e('0x3e')](_0x5fb2dd[_0x725e('0x50')],function(_0x3d71f2){var _0x3e1908={};_0x3e1908[_0x3d71f2]={'$like':'%'+_0x19572c[_0x725e('0x4c')][_0x725e('0x56')]+'%'};return _0x3e1908;})});}_0x5fb2dd=_[_0x725e('0x57')]({},_0x5fb2dd,_0x19572c[_0x725e('0x5c')]);return _0x26ab76['getLists'](_0x5fb2dd);}})[_0x725e('0x23')](function(_0x4be9fb){if(_0x4be9fb){_0x3017ca=_0x4be9fb['length'];if(!_0x19572c[_0x725e('0x4c')][_0x725e('0xbc')](_0x725e('0xc5'))){_0x5fb2dd[_0x725e('0x32')]=qs[_0x725e('0x32')](_0x19572c[_0x725e('0x4c')]['limit']);_0x5fb2dd[_0x725e('0x31')]=qs[_0x725e('0x31')](_0x19572c[_0x725e('0x4c')][_0x725e('0x31')]);}return _0x26ab76[_0x725e('0x11f')](_0x5fb2dd);}})[_0x725e('0x23')](function(_0x4e37fd){if(_0x4e37fd){return _0x4e37fd?{'count':_0x3017ca,'rows':_0x4e37fd}:null;}})[_0x725e('0x23')](respondWithResult(_0x216a56,null))['catch'](handleError(_0x216a56,null));};exports['getAgents']=function(_0x3b59a4,_0x448596,_0x476151){var _0x4bd6d9={};var _0x14509c={};var _0x35bf4f;var _0x321b29;return db[_0x725e('0x49')][_0x725e('0x8f')]({'where':{'id':_0x3b59a4[_0x725e('0x60')]['id']}})['then'](handleEntityNotFound(_0x448596,null))['then'](function(_0x3c954f){if(_0x3c954f){_0x35bf4f=_0x3c954f;_0x14509c[_0x725e('0x4f')]=_[_0x725e('0x62')](db['User'][_0x725e('0xb9')]);_0x14509c[_0x725e('0x4c')]=_[_0x725e('0x62')](_0x3b59a4[_0x725e('0x4c')]);_0x14509c[_0x725e('0x4d')]=_[_0x725e('0x4e')](_0x14509c[_0x725e('0x4f')],_0x14509c[_0x725e('0x4c')]);_0x4bd6d9[_0x725e('0x50')]=_[_0x725e('0x4e')](_0x14509c['model'],qs[_0x725e('0x51')](_0x3b59a4[_0x725e('0x4c')][_0x725e('0x51')]));_0x4bd6d9[_0x725e('0x50')]=_0x4bd6d9[_0x725e('0x50')][_0x725e('0x52')]?_0x4bd6d9['attributes']:_0x14509c[_0x725e('0x4f')];_0x4bd6d9[_0x725e('0xba')]=qs[_0x725e('0x53')](_0x3b59a4[_0x725e('0x4c')][_0x725e('0x53')]);_0x4bd6d9['where']=qs[_0x725e('0x4d')](_['pick'](_0x3b59a4['query'],_0x14509c[_0x725e('0x4d')]));if(_0x3b59a4[_0x725e('0x4c')][_0x725e('0x56')]){_0x4bd6d9[_0x725e('0x54')]=_[_0x725e('0x57')](_0x4bd6d9[_0x725e('0x54')],{'$or':_[_0x725e('0x3e')](_0x4bd6d9[_0x725e('0x50')],function(_0x4f19b2){var _0x227cf4={};_0x227cf4[_0x4f19b2]={'$like':'%'+_0x3b59a4['query']['filter']+'%'};return _0x227cf4;})});}_0x4bd6d9[_0x725e('0x4f')]=db['User'];_0x4bd6d9['as']=_0x725e('0x8a');_0x4bd6d9=_[_0x725e('0x57')]({},_0x4bd6d9,_0x3b59a4[_0x725e('0x5c')]);return _0x35bf4f['getVoiceQueues']({'include':[_0x4bd6d9]});}})[_0x725e('0x23')](function(_0x1eb27d){if(_0x1eb27d){var _0x5afa1b={},_0xa4a2e1=[],_0x1d596e=0x0;for(var _0x2cf84e=0x0;_0x2cf84e<_0x1eb27d[_0x725e('0x52')];_0x2cf84e+=0x1){for(var _0xf817d3=0x0,_0x555523;_0xf817d3<_0x1eb27d[_0x2cf84e]['Agents'][_0x725e('0x52')];_0xf817d3+=0x1){_0x555523=_0x1eb27d[_0x2cf84e][_0x725e('0x8a')][_0xf817d3]['get']({'plain':!![]});_0x5afa1b[_0x555523['id']]=_0x555523;}}_0x5afa1b=_['values'](_0x5afa1b);for(var _0x14de96=qs[_0x725e('0x31')](_0x3b59a4['query'][_0x725e('0x31')]);_0x14de96<_0x5afa1b[_0x725e('0x52')]&&_0xa4a2e1['length']=_0x1cc09b){_0x3dd7ba=_0x1cc09b;_0x58dbbf=0xc8;}else{_0x58dbbf=0xce;}_0x7c0e4a[_0xc56a('0x2d')](_0x58dbbf);return _0x7c0e4a[_0xc56a('0x33')](_0xc56a('0x34'),_0x53dd28+'-'+_0x3dd7ba+'/'+_0x1cc09b)[_0xc56a('0x2f')](_0x4a1463);}return null;};}function patchUpdates(_0x3791c5){return function(_0x124842){try{jsonpatch[_0xc56a('0x35')](_0x124842,_0x3791c5,!![]);}catch(_0x5a7563){return BPromise[_0xc56a('0x36')](_0x5a7563);}return _0x124842['save']();};}function saveUpdates(_0x388c43,_0x51c088){return function(_0x31fe5c){if(_0x31fe5c){return _0x31fe5c[_0xc56a('0x37')](_0x388c43)[_0xc56a('0x23')](function(_0x424809){return _0x424809;});}return null;};}function removeEntity(_0x24ddc0,_0x36ccf9){return function(_0x217dc3){if(_0x217dc3){return _0x217dc3[_0xc56a('0x38')]()[_0xc56a('0x23')](function(){var _0x3325a4=_0x217dc3[_0xc56a('0x39')]({'plain':!![]});var _0x3619ee=[{'name':_0xc56a('0x3a'),'value':_0xc56a('0x3b'),'ignore':!![]},{'name':_0xc56a('0x3c'),'value':'agent','ignore':![]},{'name':'Telephones','value':_0xc56a('0x3d'),'ignore':![]}];var _0x3656e9=_(_0x3619ee)['filter'](_0xc56a('0x3e'))[_0xc56a('0x3f')](_0xc56a('0x40'))[_0xc56a('0x40')]();if(_[_0xc56a('0x41')](_0x3656e9,_0x3325a4[_0xc56a('0x42')])){return;}var _0x2a0e04=_[_0xc56a('0x43')](_0x3619ee,[_0xc56a('0x40'),_0x3325a4[_0xc56a('0x42')]])[_0xc56a('0x44')];return db[_0xc56a('0x45')]['destroy']({'where':{'type':_0x2a0e04,'resourceId':_0x3325a4['id']}})[_0xc56a('0x23')](function(){return _0x217dc3;});})[_0xc56a('0x23')](function(){_0x24ddc0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3f8da7,_0x3856d9){return function(_0x396614){if(!_0x396614){_0x3f8da7['sendStatus'](0x194);}return _0x396614;};}function handleError(_0x295b79,_0x5bccb2){_0x5bccb2=_0x5bccb2||0x1f4;return function(_0x489a75){logger[_0xc56a('0x28')](_0x489a75[_0xc56a('0x46')]);if(_0x489a75[_0xc56a('0x44')]){delete _0x489a75[_0xc56a('0x44')];}_0x295b79['status'](_0x5bccb2)[_0xc56a('0x47')](_0x489a75);};}exports[_0xc56a('0x48')]=function(_0x562a0f,_0x139692){var _0x5bec06={},_0x5ba347={},_0x505655={'count':0x0,'rows':[]};var _0x5e9908=_['map'](db[_0xc56a('0x49')]['rawAttributes'],function(_0x47ddbd){return{'name':_0x47ddbd[_0xc56a('0x4a')],'type':_0x47ddbd[_0xc56a('0x4b')][_0xc56a('0x4c')]};});_0x5ba347[_0xc56a('0x4d')]=_[_0xc56a('0x4e')](_[_0xc56a('0x3f')](_0x5e9908,_0xc56a('0x44')),[_0xc56a('0x4f'),_0xc56a('0x50')]);_0x5ba347[_0xc56a('0x51')]=_[_0xc56a('0x52')](_0x562a0f[_0xc56a('0x51')]);_0x5ba347[_0xc56a('0x53')]=_[_0xc56a('0x54')](_0x5ba347[_0xc56a('0x4d')],_0x5ba347[_0xc56a('0x51')]);_0x5bec06['attributes']=_[_0xc56a('0x54')](_0x5ba347['model'],qs['fields'](_0x562a0f['query'][_0xc56a('0x55')]));_0x5bec06[_0xc56a('0x56')]=_0x5bec06[_0xc56a('0x56')]['length']?_0x5bec06[_0xc56a('0x56')]:_0x5ba347[_0xc56a('0x4d')];if(!_0x562a0f[_0xc56a('0x51')][_0xc56a('0x57')](_0xc56a('0x58'))){_0x5bec06['limit']=qs[_0xc56a('0x32')](_0x562a0f['query'][_0xc56a('0x32')]);_0x5bec06['offset']=qs[_0xc56a('0x31')](_0x562a0f[_0xc56a('0x51')]['offset']);}_0x5bec06[_0xc56a('0x59')]=qs[_0xc56a('0x5a')](_0x562a0f[_0xc56a('0x51')][_0xc56a('0x5a')]);_0x5bec06[_0xc56a('0x5b')]=qs[_0xc56a('0x53')](_[_0xc56a('0x5c')](_0x562a0f[_0xc56a('0x51')],_0x5ba347[_0xc56a('0x53')]),_0x5e9908);if(_0x562a0f[_0xc56a('0x51')][_0xc56a('0x5d')]){_0x5bec06[_0xc56a('0x5b')]=_[_0xc56a('0x5e')](_0x5bec06[_0xc56a('0x5b')],{'$or':_[_0xc56a('0x3f')](_0x5e9908,function(_0x25315f){if(_0x25315f[_0xc56a('0x4b')]!==_0xc56a('0x5f')){return db[_0xc56a('0x60')][_0xc56a('0x5b')](db[_0xc56a('0x60')]['fn']('lower',db[_0xc56a('0x60')][_0xc56a('0x61')](_0x25315f[_0xc56a('0x44')])),{'$like':db[_0xc56a('0x60')]['fn']('lower','%'+_0x562a0f[_0xc56a('0x51')][_0xc56a('0x5d')]+'%')});}})});}_0x5bec06=_[_0xc56a('0x5e')]({},_0x5bec06,_0x562a0f[_0xc56a('0x62')]);var _0x43031b={'where':_0x5bec06[_0xc56a('0x5b')]};return db['User'][_0xc56a('0x30')](_0x43031b)[_0xc56a('0x23')](function(_0x48716b){_0x505655[_0xc56a('0x30')]=_0x48716b;if(_0x562a0f[_0xc56a('0x51')]['includeAll']){_0x5bec06[_0xc56a('0x63')]=[{'all':!![]}];}return db['User'][_0xc56a('0x64')](_0x5bec06);})[_0xc56a('0x23')](function(_0x32bde8){_0x505655[_0xc56a('0x65')]=_0x32bde8;return _0x505655;})['then'](respondWithFilteredResult(_0x139692,_0x5bec06))[_0xc56a('0x66')](handleError(_0x139692,null));};exports[_0xc56a('0x67')]=function(_0x5b4274,_0x278936){var _0x28eade={'raw':![],'where':{'id':_0x5b4274[_0xc56a('0x68')]['id']}},_0x37d0ba={};_0x37d0ba['model']=_[_0xc56a('0x4e')](_[_0xc56a('0x52')](db[_0xc56a('0x49')][_0xc56a('0x69')]),[_0xc56a('0x4f'),_0xc56a('0x50')]);_0x37d0ba[_0xc56a('0x51')]=_['keys'](_0x5b4274[_0xc56a('0x51')]);_0x37d0ba[_0xc56a('0x53')]=_[_0xc56a('0x54')](_0x37d0ba['model'],_0x37d0ba[_0xc56a('0x51')]);_0x28eade[_0xc56a('0x56')]=_[_0xc56a('0x54')](_0x37d0ba[_0xc56a('0x4d')],qs[_0xc56a('0x55')](_0x5b4274[_0xc56a('0x51')][_0xc56a('0x55')]));_0x28eade[_0xc56a('0x56')]=_0x28eade[_0xc56a('0x56')]['length']?_0x28eade[_0xc56a('0x56')]:_0x37d0ba[_0xc56a('0x4d')];if(_0x5b4274[_0xc56a('0x51')]['includeAll']){_0x28eade[_0xc56a('0x63')]=[{'all':!![]}];}_0x28eade=_['merge']({},_0x28eade,_0x5b4274[_0xc56a('0x62')]);return db[_0xc56a('0x49')][_0xc56a('0x43')](_0x28eade)['then'](handleEntityNotFound(_0x278936,null))['then'](respondWithResult(_0x278936,null))['catch'](handleError(_0x278936,null));};exports['bulkCreate']=function(_0x2ef38f,_0x3d8821){return db['User'][_0xc56a('0x6a')](_0x2ef38f[_0xc56a('0x6b')],{'raw':![],'individualHooks':!![]})[_0xc56a('0x23')](respondWithResult(_0x3d8821,0xc9))[_0xc56a('0x66')](handleError(_0x3d8821,null));};exports[_0xc56a('0x37')]=function(_0x3cb2b2,_0x55b581){if(_0x3cb2b2['body']['id']){delete _0x3cb2b2[_0xc56a('0x6b')]['id'];}delete _0x3cb2b2[_0xc56a('0x6b')][_0xc56a('0x42')];return db[_0xc56a('0x49')][_0xc56a('0x43')]({'where':{'id':_0x3cb2b2['params']['id']}})[_0xc56a('0x23')](handleEntityNotFound(_0x55b581,null))[_0xc56a('0x23')](saveUpdates(_0x3cb2b2['body'],null))[_0xc56a('0x23')](respondWithResult(_0x55b581,null))[_0xc56a('0x66')](handleError(_0x55b581,null));};exports[_0xc56a('0x6c')]=function(_0xaa9b77,_0xb4bb21){return db['User'][_0xc56a('0x6c')]()[_0xc56a('0x23')](respondWithResult(_0xb4bb21,null))[_0xc56a('0x66')](handleError(_0xb4bb21,null));};exports[_0xc56a('0x6d')]=function(_0x6ae64e,_0xae6d4,_0x3f01a0){return db['User'][_0xc56a('0x43')]({'where':{'id':_0x6ae64e['params']['id']}})[_0xc56a('0x23')](handleEntityNotFound(_0xae6d4,null))[_0xc56a('0x23')](function(_0x21e3f7){if(_0x21e3f7){return _0x21e3f7['addContacts'](_0x6ae64e[_0xc56a('0x6b')][_0xc56a('0x6e')],_[_0xc56a('0x6f')](_0x6ae64e[_0xc56a('0x6b')],[_0xc56a('0x6e'),'id'])||{});}})['then'](respondWithResult(_0xae6d4,null))[_0xc56a('0x66')](handleError(_0xae6d4,null));};var getLicense=function(_0x2dff0c){return new BPromise(function(_0x287161,_0x5d2232){var _0x29975b=0x0;_0x2dff0c[_0xc56a('0x6b')]['role']===_0xc56a('0x70')&&_0x287161(_0xc56a('0x71'));return db[_0xc56a('0x49')]['count']({'where':{'$or':[{'role':_0x2dff0c[_0xc56a('0x6b')][_0xc56a('0x42')]===_0xc56a('0x3d')?_0xc56a('0x3d'):['admin',_0xc56a('0x3b')]}]}})['then'](function(_0x40f832){_0x29975b=_0x40f832;return require(_0xc56a('0x72'))[_0xc56a('0x73')]();})[_0xc56a('0x23')](function(_0x3ec25b){var _0xf85c43=_0x2dff0c[_0xc56a('0x6b')]['role']===_0xc56a('0x3d')?_0xc56a('0x74'):'users';if(!_[_0xc56a('0x75')](_0x3ec25b[_0xf85c43])&&_0x29975b>=_0x3ec25b[_0xf85c43]){return _0x5d2232({'message':_0xc56a('0x76')});}return _0x287161(util[_0xc56a('0x77')]('count\x20%s:\x20%s',_0xf85c43,_0x29975b));})[_0xc56a('0x66')](function(_0x51fddd){return _0x5d2232(_0x51fddd);});});};exports['create']=function(_0x301ab8,_0x5816af){return getLicense(_0x301ab8)['then'](function(_0x575dd1){if(!_0x301ab8[_0xc56a('0x6b')]['internal']){var _0x52e7e3;return db['Setting']['findById'](0x1)[_0xc56a('0x23')](function(_0x1b7c4d){return checkPasswordPattern(_0x1b7c4d,_0x301ab8[_0xc56a('0x6b')]['password'],_0x1b7c4d[_0xc56a('0x78')]);})[_0xc56a('0x23')](function(_0x1fabc9){_0x52e7e3=_0x1fabc9[_0xc56a('0x79')];return db[_0xc56a('0x49')]['max']('internal');})[_0xc56a('0x23')](function(_0x196a34){if(_['isNil'](_0x196a34)){if(_0x52e7e3){_0x301ab8[_0xc56a('0x6b')][_0xc56a('0x7a')]=_0x52e7e3;}else{_0x301ab8[_0xc56a('0x6b')][_0xc56a('0x7a')]=0x1;}}else{if(_['isNil'](_0x52e7e3)||_0x52e7e3==_0x196a34){_0x301ab8['body'][_0xc56a('0x7a')]=_0x196a34+0x1;}else if(_0x52e7e3>_0x196a34){_0x301ab8[_0xc56a('0x6b')][_0xc56a('0x7a')]=_0x52e7e3;}else{return db[_0xc56a('0x60')][_0xc56a('0x51')](_0xc56a('0x7b'),{'type':db['sequelize']['QueryTypes'][_0xc56a('0x7c')]})[_0xc56a('0x23')](function(_0x51dd6a){if(_0x51dd6a&&_0x51dd6a[_0xc56a('0x7d')]){for(var _0x585991=0x0,_0x30b837=_0x51dd6a[_0xc56a('0x7d')];_0x585991<_0x30b837&&_[_0xc56a('0x75')](_0x301ab8[_0xc56a('0x6b')][_0xc56a('0x7a')]);_0x585991++){if(_0x52e7e3<=_0x51dd6a[_0x585991]['from']){_0x301ab8[_0xc56a('0x6b')][_0xc56a('0x7a')]=_0x51dd6a[_0x585991][_0xc56a('0x7e')];}else if(_0x52e7e3>_0x51dd6a[_0x585991][_0xc56a('0x7e')]&&_0x52e7e3<=_0x51dd6a[_0x585991]['to']){_0x301ab8[_0xc56a('0x6b')][_0xc56a('0x7a')]=_0x52e7e3;}}}if(_['isNil'](_0x301ab8['body']['internal'])){_0x301ab8[_0xc56a('0x6b')][_0xc56a('0x7a')]=_0x196a34+0x1;}});}}});}})[_0xc56a('0x23')](function(){if(_0x301ab8[_0xc56a('0x6b')][_0xc56a('0x7f')]){_0x301ab8[_0xc56a('0x6b')][_0xc56a('0x80')]=_0x301ab8[_0xc56a('0x6b')][_0xc56a('0x7a')];_0x301ab8[_0xc56a('0x6b')]['VoiceMail']={'mailbox':_0x301ab8[_0xc56a('0x6b')][_0xc56a('0x7a')],'password':_0x301ab8[_0xc56a('0x6b')][_0xc56a('0x4f')],'fullname':_0x301ab8[_0xc56a('0x6b')][_0xc56a('0x81')],'email':_0x301ab8[_0xc56a('0x6b')][_0xc56a('0x82')]};}if(_0x301ab8['body']&&_0x301ab8[_0xc56a('0x6b')][_0xc56a('0x42')]===_0xc56a('0x70')){if(!_0x301ab8[_0xc56a('0x6b')][_0xc56a('0x83')]){_0x301ab8['body']['permissions']=[_0xc56a('0x84'),_0xc56a('0x85'),_0xc56a('0x86'),_0xc56a('0x87'),_0xc56a('0x88'),_0xc56a('0x89'),'105','106',_0xc56a('0x8a'),_0xc56a('0x8b'),_0xc56a('0x8c'),'100','111',_0xc56a('0x8d')];}}return db['User'][_0xc56a('0x8e')](_0x301ab8['body'],{'include':[{'model':db['VoiceMail'],'as':_0xc56a('0x8f')}]});})[_0xc56a('0x23')](function(_0x127dac){if(_0x301ab8[_0xc56a('0x6b')]['role']===_0xc56a('0x3b'))return _0x127dac;var _0xc6f4c7=_0x301ab8[_0xc56a('0x3b')][_0xc56a('0x39')]({'plain':!![]});if(!_0xc6f4c7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xc6f4c7['role']==='user'){var _0x57f60f=_0x127dac[_0xc56a('0x39')]({'plain':!![]});var _0x5f5659=[{'name':'Agents','value':_0xc56a('0x70')},{'name':_0xc56a('0x90'),'value':'telephone'}];var _0x3939c4=_[_0xc56a('0x43')](_0x5f5659,[_0xc56a('0x40'),_0x57f60f[_0xc56a('0x42')]])[_0xc56a('0x44')];return db[_0xc56a('0x91')][_0xc56a('0x43')]({'where':{'name':_0x3939c4,'userProfileId':_0xc6f4c7['userProfileId']},'raw':!![]})[_0xc56a('0x23')](function(_0x5de0b1){if(_0x5de0b1&&_0x5de0b1[_0xc56a('0x92')]===0x0){return db[_0xc56a('0x45')]['create']({'name':_0x57f60f['name'],'resourceId':_0x57f60f['id'],'type':_0x5de0b1[_0xc56a('0x44')],'sectionId':_0x5de0b1['id']},{})[_0xc56a('0x23')](function(){return _0x127dac;});}else{return _0x127dac;}})[_0xc56a('0x66')](function(_0x4b408c){logger[_0xc56a('0x28')](_0xc56a('0x93'),_0x4b408c);throw _0x4b408c;});}return _0x127dac;})[_0xc56a('0x23')](respondWithResult(_0x5816af,0xc9))[_0xc56a('0x66')](handleError(_0x5816af,null));};exports[_0xc56a('0x94')]=function(_0xebdc98,_0x27c14c,_0x151adf){var _0x4e3d7e=![];if(_0xebdc98[_0xc56a('0x6b')]['id']){delete _0xebdc98[_0xc56a('0x6b')]['id'];}return db[_0xc56a('0x95')][_0xc56a('0x96')]({'attributes':['id',_0xc56a('0x78')]})[_0xc56a('0x23')](function(_0x48cd93){_0x4e3d7e=_0x48cd93[_0xc56a('0x78')];return db[_0xc56a('0x49')][_0xc56a('0x43')]({'where':{'id':_0xebdc98['params']['id']}});})[_0xc56a('0x23')](function(_0x5aaddd){if(_0x5aaddd){if(_0x5aaddd['id']==_0xebdc98[_0xc56a('0x3b')]['id']){if(!_0xebdc98[_0xc56a('0x6b')][_0xc56a('0x97')]||!_0xebdc98[_0xc56a('0x6b')][_0xc56a('0x98')]){throw new db[(_0xc56a('0x1f'))][(_0xc56a('0x20'))](_0xc56a('0x99'));}if(!_0x5aaddd['authenticate'](_0xebdc98[_0xc56a('0x6b')][_0xc56a('0x97')])){throw new db['Sequelize'][(_0xc56a('0x20'))](_0xc56a('0x9a'));}if(_0xebdc98[_0xc56a('0x6b')][_0xc56a('0x97')]==_0xebdc98['body'][_0xc56a('0x98')]){throw new db[(_0xc56a('0x1f'))][(_0xc56a('0x20'))]('New\x20password\x20must\x20be\x20different\x20from\x20old\x20password');}return _0x5aaddd;}else if(_0xebdc98[_0xc56a('0x3b')][_0xc56a('0x42')]==_0xc56a('0x9b')){if(!_0xebdc98[_0xc56a('0x6b')][_0xc56a('0x98')]){throw new db[(_0xc56a('0x1f'))][(_0xc56a('0x20'))](_0xc56a('0x9c'));}return _0x5aaddd;}else if(_0xebdc98['user'][_0xc56a('0x42')]==_0xc56a('0x3b')){if(!_0xebdc98[_0xc56a('0x6b')][_0xc56a('0x98')]){throw new db[(_0xc56a('0x1f'))][(_0xc56a('0x20'))](_0xc56a('0x9c'));}if(_0x5aaddd['role']!=_0xc56a('0x70')){throw new db[(_0xc56a('0x1f'))][(_0xc56a('0x20'))](_0xc56a('0x9d'));}return _0x5aaddd;}else{throw new db['Sequelize'][(_0xc56a('0x20'))]('Unauthorized');}}return null;})[_0xc56a('0x23')](handleEntityNotFound(_0x27c14c,null))[_0xc56a('0x23')](function(_0x997469){return checkPasswordPattern(_0x997469,_0xebdc98[_0xc56a('0x6b')][_0xc56a('0x98')],_0x4e3d7e);})[_0xc56a('0x23')](saveUpdates({'password':_0xebdc98[_0xc56a('0x6b')][_0xc56a('0x98')],'passwordResetAt':_0xebdc98['user']['id']==_0xebdc98[_0xc56a('0x68')]['id']?moment():null},null))[_0xc56a('0x23')](respondWithResult(_0x27c14c,null))['catch'](handleError(_0x27c14c,null));};exports[_0xc56a('0x9e')]=function(_0x208ec4,_0x5ce5e3,_0x3df964){var _0x5a31d1=_0x208ec4['body'][_0xc56a('0x9f')];return db[_0xc56a('0x49')][_0xc56a('0x43')]({'where':{'id':_0x208ec4[_0xc56a('0x68')]['id']},'attributes':['id',_0xc56a('0x44'),_0xc56a('0x42'),_0xc56a('0xa0'),'loginInPause',_0xc56a('0xa1'),_0xc56a('0xa2')]})[_0xc56a('0x23')](handleEntityNotFound(_0x5ce5e3,null))[_0xc56a('0x23')](function(_0x3f44ab){if(_0x3f44ab){if(!utils[_0xc56a('0xa3')](_0x5a31d1)){throw new db['Sequelize']['ValidationError'](_0xc56a('0xa4'));}return _0x3f44ab['add'+_['capitalize'](_0x5a31d1[_0xc56a('0xa5')]())+_0xc56a('0xa6')](_0x208ec4[_0xc56a('0x6b')][_0xc56a('0x6e')],{'penalty':_0x208ec4[_0xc56a('0x6b')][_0xc56a('0xa7')]||0x0})['spread'](function(_0x31d6d0){for(var _0x4861d1=0x0;_0x4861d1<_0x208ec4['body'][_0xc56a('0x6e')][_0xc56a('0x7d')];_0x4861d1+=0x1){var _0x36aa45={'UserId':_0x208ec4['params']['id']};_0x36aa45[_[_0xc56a('0xa8')](_0x5a31d1[_0xc56a('0xa5')]())+'QueueId']=_0x208ec4[_0xc56a('0x6b')][_0xc56a('0x6e')][_0x4861d1];socket[_0xc56a('0xa9')](_0xc56a('0x3b')+_[_0xc56a('0xa8')](_0x5a31d1['toLowerCase']())+_0xc56a('0xaa'),_0x36aa45);}return _0x31d6d0;})['then'](function(){if(_0x5a31d1==='voice'){return db['VoiceQueue'][_0xc56a('0x64')]({'where':{'id':_0x208ec4[_0xc56a('0x6b')][_0xc56a('0x6e')]||[]},'raw':!![],'attributes':['id','name']});}})['then'](function(_0x6b5131){var _0x48f712=_0x3f44ab[_0xc56a('0x39')]({'plain':!![]});var _0x1d4f4d=[];if(_0x5a31d1===_0xc56a('0xab')&&_0x48f712['role']===_0xc56a('0x70')&&_0x48f712[_0xc56a('0xa0')]){for(var _0x1dfc1e=0x0;_0x1dfc1e<_0x6b5131[_0xc56a('0x7d')];_0x1dfc1e+=0x1){_0x1d4f4d['push']({'membername':_0x48f712['name'],'UserId':_0x48f712['id'],'queue_name':_0x6b5131[_0x1dfc1e]['name'],'VoiceQueueId':_0x6b5131[_0x1dfc1e]['id'],'interface':_[_0xc56a('0x75')](_0x48f712[_0xc56a('0xa2')])?util['format'](_0xc56a('0xac'),_0x48f712[_0xc56a('0x44')]):_0x48f712[_0xc56a('0xa2')],'paused':_0x48f712[_0xc56a('0xa1')]||![],'penalty':_0x208ec4['body'][_0xc56a('0xa7')]||0x0});}return BPromise[_0xc56a('0xad')](_0x1d4f4d,function(_0x231f1f){return db[_0xc56a('0xae')][_0xc56a('0xaf')](_0x231f1f);});}return _0x3f44ab;});}})[_0xc56a('0x23')](respondWithStatusCode(_0x5ce5e3,null))[_0xc56a('0x66')](handleError(_0x5ce5e3,null));};exports[_0xc56a('0xb0')]=function(_0x34b066,_0x4af37d,_0x47f77f){var _0xea1aa5;return db[_0xc56a('0x49')][_0xc56a('0x43')]({'where':{'id':_0x34b066[_0xc56a('0x68')]['id']},'attributes':['id',_0xc56a('0x44'),_0xc56a('0x42')]})['then'](handleEntityNotFound(_0x4af37d,null))[_0xc56a('0x23')](function(_0xe13ae3){if(_0xe13ae3){_0xea1aa5=_0xe13ae3;if(!_0x34b066[_0xc56a('0x51')][_0xc56a('0x9f')]||!utils[_0xc56a('0xa3')](_0x34b066['query'][_0xc56a('0x9f')])){throw new db[(_0xc56a('0x1f'))]['ValidationError'](_0xc56a('0xa4'));}return _0xe13ae3[_0xc56a('0xb1')+_[_0xc56a('0xa8')](_0x34b066['query'][_0xc56a('0x9f')][_0xc56a('0xa5')]())+'Queues'](_0x34b066[_0xc56a('0x51')][_0xc56a('0x6e')]);}})[_0xc56a('0x23')](function(_0x56868f){for(var _0x534f33=0x0;_0x534f33<_0x34b066[_0xc56a('0x51')][_0xc56a('0x6e')]['length'];_0x534f33+=0x1){var _0x26f169={'UserId':_0x34b066['params']['id']};_0x26f169[_[_0xc56a('0xa8')](_0x34b066[_0xc56a('0x51')]['channel'][_0xc56a('0xa5')]())+_0xc56a('0xb2')]=_0x34b066[_0xc56a('0x51')]['ids'][_0x534f33];socket[_0xc56a('0xa9')]('user'+_[_0xc56a('0xa8')](_0x34b066['query'][_0xc56a('0x9f')]['toLowerCase']())+'Queue:remove',_0x26f169);}return _0x56868f;})['then'](function(){if(_0x34b066['query'][_0xc56a('0x9f')]===_0xc56a('0xab')){return db['UserVoiceQueueRt'][_0xc56a('0x38')]({'where':{'UserId':_0x34b066[_0xc56a('0x68')]['id'],'VoiceQueueId':_0x34b066[_0xc56a('0x51')][_0xc56a('0x6e')]},'individualHooks':!![]})[_0xc56a('0x23')](function(){return _0xea1aa5;});}return _0xea1aa5;})[_0xc56a('0x23')](respondWithStatusCode(_0x4af37d,null))[_0xc56a('0x66')](handleError(_0x4af37d,null));};exports[_0xc56a('0xb3')]=function(_0xf21c5d,_0x5dc7a2,_0x402a58){_0xf21c5d[_0xc56a('0x6b')]['userpic']=_0xf21c5d[_0xc56a('0xb4')][_0xc56a('0xb5')];return db[_0xc56a('0x49')][_0xc56a('0x43')]({'where':{'id':_0xf21c5d[_0xc56a('0x68')]['id']}})[_0xc56a('0x23')](handleEntityNotFound(_0x5dc7a2,null))[_0xc56a('0x23')](saveUpdates(_0xf21c5d[_0xc56a('0x6b')],null))['then'](respondWithResult(_0x5dc7a2,null))['catch'](handleError(_0x5dc7a2,null));};exports[_0xc56a('0xb6')]=function(_0x41ff4f,_0x677d2b,_0x497705){var _0x59b04e=path[_0xc56a('0xb7')](config[_0xc56a('0xb8')],_0xc56a('0xb9'));return db[_0xc56a('0x49')][_0xc56a('0x43')]({'where':{'id':_0x41ff4f[_0xc56a('0x68')]['id']},'attributes':['id',_0xc56a('0xba')],'raw':!![]})[_0xc56a('0x23')](handleEntityNotFound(_0x677d2b,null))[_0xc56a('0x23')](function(_0x25c00d){if(_0x25c00d){if(_[_0xc56a('0x75')](_0x25c00d['userpic'])){return _0x677d2b[_0xc56a('0xbb')](_0x59b04e);}else{if(!fs[_0xc56a('0xbc')](path[_0xc56a('0xb7')](config[_0xc56a('0xb8')],_0xc56a('0xbd'),_0x25c00d[_0xc56a('0xba')]))){return _0x677d2b['download'](_0x59b04e);}return _0x677d2b['download'](path[_0xc56a('0xb7')](config[_0xc56a('0xb8')],_0xc56a('0xbd'),_0x25c00d[_0xc56a('0xba')]));}}})[_0xc56a('0x66')](handleError(_0x677d2b,null));};exports[_0xc56a('0xbe')]=function(_0x2d08ed,_0x1779f,_0x544282){var _0x137507={};var _0x12e35f={};var _0x7abb07;var _0x35418c;return db['User'][_0xc56a('0x96')]({'where':{'id':_0x2d08ed['params']['id']}})[_0xc56a('0x23')](handleEntityNotFound(_0x1779f,null))[_0xc56a('0x23')](function(_0x35dd63){if(_0x35dd63){_0x7abb07=_0x35dd63;_0x12e35f['model']=_[_0xc56a('0x52')](db['CmContact'][_0xc56a('0x69')]);_0x12e35f['query']=_[_0xc56a('0x52')](_0x2d08ed['query']);_0x12e35f[_0xc56a('0x53')]=_['intersection'](_0x12e35f['model'],_0x12e35f[_0xc56a('0x51')]);_0x137507[_0xc56a('0x56')]=_[_0xc56a('0x54')](_0x12e35f['model'],qs[_0xc56a('0x55')](_0x2d08ed[_0xc56a('0x51')]['fields']));_0x137507['attributes']=_0x137507[_0xc56a('0x56')]['length']?_0x137507['attributes']:_0x12e35f[_0xc56a('0x4d')];_0x137507['order']=qs[_0xc56a('0x5a')](_0x2d08ed[_0xc56a('0x51')][_0xc56a('0x5a')]);_0x137507[_0xc56a('0x5b')]=qs[_0xc56a('0x53')](_[_0xc56a('0x5c')](_0x2d08ed[_0xc56a('0x51')],_0x12e35f[_0xc56a('0x53')]));if(_0x2d08ed['query'][_0xc56a('0x5d')]){_0x137507[_0xc56a('0x5b')]=_['merge'](_0x137507[_0xc56a('0x5b')],{'$or':_[_0xc56a('0x3f')](_0x137507[_0xc56a('0x56')],function(_0x4236dd){var _0x144aa7={};_0x144aa7[_0x4236dd]={'$like':'%'+_0x2d08ed[_0xc56a('0x51')][_0xc56a('0x5d')]+'%'};return _0x144aa7;})});}_0x137507=_['merge']({},_0x137507,_0x2d08ed[_0xc56a('0x62')]);return _0x7abb07[_0xc56a('0xbe')](_0x137507);}})[_0xc56a('0x23')](function(_0x3d631c){if(_0x3d631c){_0x35418c=_0x3d631c[_0xc56a('0x7d')];if(_0x2d08ed[_0xc56a('0x51')][_0xc56a('0x57')](_0xc56a('0xbf'))){_0x137507['include']=[{'model':db[_0xc56a('0xc0')],'as':_0xc56a('0xc1'),'required':![]},{'model':db[_0xc56a('0xc2')],'as':'Tags','attributes':['id',_0xc56a('0x44'),_0xc56a('0xc3')],'where':_0x2d08ed[_0xc56a('0x51')]['tag']?{'id':_0x2d08ed[_0xc56a('0x51')][_0xc56a('0xc4')]}:undefined,'required':_0x2d08ed[_0xc56a('0x51')][_0xc56a('0xc4')]?!![]:![]}];}if(!_0x2d08ed[_0xc56a('0x51')][_0xc56a('0x57')]('nolimit')){_0x137507[_0xc56a('0x32')]=qs[_0xc56a('0x32')](_0x2d08ed[_0xc56a('0x51')][_0xc56a('0x32')]);_0x137507[_0xc56a('0x31')]=qs['offset'](_0x2d08ed[_0xc56a('0x51')][_0xc56a('0x31')]);}return _0x7abb07['getContacts'](_0x137507);}})[_0xc56a('0x23')](function(_0xd400cb){if(_0xd400cb){return _0xd400cb?{'count':_0x35418c,'rows':_0xd400cb}:null;}})[_0xc56a('0x23')](respondWithResult(_0x1779f,null))[_0xc56a('0x66')](handleError(_0x1779f,null));};exports[_0xc56a('0xc5')]=function(_0x3bc05e,_0x5740b1,_0x23b81f){var _0xf798e0;var _0x1ab3ca;var _0x55e77f={};var _0x2913d8;return db[_0xc56a('0x49')][_0xc56a('0x96')]({'where':{'id':_0x3bc05e[_0xc56a('0x68')]['id']},'attributes':['id',_0xc56a('0x44'),_0xc56a('0x42')]})[_0xc56a('0x23')](handleEntityNotFound(_0x5740b1,null))[_0xc56a('0x23')](function(_0x36824d){if(!utils[_0xc56a('0xa3')](_0x3bc05e[_0xc56a('0x51')]['channel'])){throw new db[(_0xc56a('0x1f'))][(_0xc56a('0x20'))](_0xc56a('0xa4'));}_0xf798e0=_0x36824d;var _0x18152f={};_0x18152f[_0xc56a('0x4d')]=_[_0xc56a('0x52')](db[_['capitalize'](_0x3bc05e[_0xc56a('0x51')][_0xc56a('0x9f')])+_0xc56a('0xc6')]['rawAttributes']);_0x18152f['query']=_['keys'](_0x3bc05e[_0xc56a('0x51')]);_0x18152f[_0xc56a('0x53')]=_['intersection'](_0x18152f[_0xc56a('0x4d')],_0x18152f[_0xc56a('0x51')]);_0x55e77f[_0xc56a('0x56')]=_[_0xc56a('0x54')](_0x18152f[_0xc56a('0x4d')],qs[_0xc56a('0x55')](_0x3bc05e[_0xc56a('0x51')][_0xc56a('0x55')]));_0x55e77f['attributes']=_0x55e77f[_0xc56a('0x56')][_0xc56a('0x7d')]?_0x55e77f[_0xc56a('0x56')]:_0x18152f[_0xc56a('0x4d')];_0x55e77f[_0xc56a('0x59')]=qs['sort'](_0x3bc05e[_0xc56a('0x51')]['sort']);_0x55e77f[_0xc56a('0x5b')]=qs[_0xc56a('0x53')](_[_0xc56a('0x5c')](_0x3bc05e[_0xc56a('0x51')],_0x18152f[_0xc56a('0x53')]));if(_0x3bc05e[_0xc56a('0x51')]['filter']){_0x55e77f['where']=_[_0xc56a('0x5e')](_0x55e77f[_0xc56a('0x5b')],{'$or':_[_0xc56a('0x3f')](_0x55e77f['attributes'],function(_0x94661b){var _0x1c3f28={};_0x1c3f28[_0x94661b]={'$like':'%'+_0x3bc05e[_0xc56a('0x51')][_0xc56a('0x5d')]+'%'};return _0x1c3f28;})});}_0x55e77f=_[_0xc56a('0x5e')]({},_0x55e77f,_0x3bc05e[_0xc56a('0x62')]);switch(_0xf798e0[_0xc56a('0x42')]){case _0xc56a('0x9b'):return db[_[_0xc56a('0xa8')](_0x3bc05e[_0xc56a('0x51')][_0xc56a('0x9f')])+_0xc56a('0xc6')][_0xc56a('0x64')](_0x55e77f);case'user':case _0xc56a('0x70'):return _0xf798e0[_0xc56a('0x39')+_['capitalize'](_0x3bc05e[_0xc56a('0x51')][_0xc56a('0x9f')])+_0xc56a('0xa6')](_0x55e77f);default:throw new db[(_0xc56a('0x1f'))]['ValidationError']('Unknown\x20role');}})[_0xc56a('0x23')](function(_0xa3ef6f){_0x2913d8=_0xa3ef6f[_0xc56a('0x7d')];if(!_0x3bc05e[_0xc56a('0x51')]['hasOwnProperty'](_0xc56a('0x58'))){_0x55e77f['limit']=qs['limit'](_0x3bc05e[_0xc56a('0x51')][_0xc56a('0x32')]);_0x55e77f[_0xc56a('0x31')]=qs[_0xc56a('0x31')](_0x3bc05e[_0xc56a('0x51')]['offset']);}switch(_0xf798e0[_0xc56a('0x42')]){case'admin':return db[_[_0xc56a('0xa8')](_0x3bc05e['query']['channel'])+_0xc56a('0xc6')]['findAll'](_0x55e77f);case _0xc56a('0x3b'):case'agent':return _0xf798e0[_0xc56a('0x39')+_[_0xc56a('0xa8')](_0x3bc05e[_0xc56a('0x51')][_0xc56a('0x9f')])+_0xc56a('0xa6')](_0x55e77f);}})['then'](function(_0x391322){return{'count':_0x2913d8,'rows':_0x391322};})[_0xc56a('0x23')](respondWithResult(_0x5740b1,null))['catch'](handleError(_0x5740b1,null));};exports[_0xc56a('0xc7')]=function(_0x1f40a0,_0x4db6c8,_0x3bd2c5){var _0xcc83b3={};var _0x225ff6={};var _0x238e80;var _0xf88ee6;return db[_0xc56a('0x49')][_0xc56a('0x96')]({'where':{'id':_0x1f40a0['params']['id']}})[_0xc56a('0x23')](handleEntityNotFound(_0x4db6c8,null))[_0xc56a('0x23')](function(_0x264dda){if(_0x264dda){_0x238e80=_0x264dda;_0x225ff6[_0xc56a('0x4d')]=_['keys'](db[_0xc56a('0xae')][_0xc56a('0x69')]);_0x225ff6[_0xc56a('0x51')]=_[_0xc56a('0x52')](_0x1f40a0[_0xc56a('0x51')]);_0x225ff6[_0xc56a('0x53')]=_[_0xc56a('0x54')](_0x225ff6[_0xc56a('0x4d')],_0x225ff6[_0xc56a('0x51')]);_0xcc83b3[_0xc56a('0x56')]=_[_0xc56a('0x54')](_0x225ff6[_0xc56a('0x4d')],qs['fields'](_0x1f40a0[_0xc56a('0x51')][_0xc56a('0x55')]));_0xcc83b3[_0xc56a('0x56')]=_0xcc83b3[_0xc56a('0x56')][_0xc56a('0x7d')]?_0xcc83b3['attributes']:_0x225ff6[_0xc56a('0x4d')];_0xcc83b3[_0xc56a('0x59')]=qs[_0xc56a('0x5a')](_0x1f40a0[_0xc56a('0x51')][_0xc56a('0x5a')]);_0xcc83b3['where']=qs[_0xc56a('0x53')](_[_0xc56a('0x5c')](_0x1f40a0[_0xc56a('0x51')],_0x225ff6['filters']));if(_0x1f40a0['query'][_0xc56a('0x5d')]){_0xcc83b3[_0xc56a('0x5b')]=_[_0xc56a('0x5e')](_0xcc83b3[_0xc56a('0x5b')],{'$or':_[_0xc56a('0x3f')](_0xcc83b3[_0xc56a('0x56')],function(_0x201c35){var _0x440435={};_0x440435[_0x201c35]={'$like':'%'+_0x1f40a0[_0xc56a('0x51')][_0xc56a('0x5d')]+'%'};return _0x440435;})});}_0xcc83b3=_[_0xc56a('0x5e')]({},_0xcc83b3,_0x1f40a0[_0xc56a('0x62')]);return _0x238e80['getVoiceQueuesRt'](_0xcc83b3);}})['then'](function(_0x4a8b07){if(_0x4a8b07){_0xf88ee6=_0x4a8b07[_0xc56a('0x7d')];if(!_0x1f40a0[_0xc56a('0x51')][_0xc56a('0x57')](_0xc56a('0x58'))){_0xcc83b3[_0xc56a('0x32')]=qs[_0xc56a('0x32')](_0x1f40a0[_0xc56a('0x51')][_0xc56a('0x32')]);_0xcc83b3[_0xc56a('0x31')]=qs[_0xc56a('0x31')](_0x1f40a0[_0xc56a('0x51')][_0xc56a('0x31')]);}return _0x238e80[_0xc56a('0xc7')](_0xcc83b3);}})[_0xc56a('0x23')](function(_0x449417){if(_0x449417){return _0x449417?{'count':_0xf88ee6,'rows':_0x449417}:null;}})[_0xc56a('0x23')](respondWithResult(_0x4db6c8,null))[_0xc56a('0x66')](handleError(_0x4db6c8,null));};exports[_0xc56a('0xc8')]=function(_0x6eb0de,_0x1daa1b,_0x506aa0){var _0xb913ab={};var _0xa63b81={};var _0x3f5589;var _0x4f0cd4;return db[_0xc56a('0x49')][_0xc56a('0x96')]({'where':{'id':_0x6eb0de[_0xc56a('0x68')]['id']}})[_0xc56a('0x23')](handleEntityNotFound(_0x1daa1b,null))[_0xc56a('0x23')](function(_0xe6e678){if(_0xe6e678){_0x3f5589=_0xe6e678;_0xa63b81['model']=_[_0xc56a('0x52')](db[_0xc56a('0xc9')][_0xc56a('0x69')]);_0xa63b81[_0xc56a('0x51')]=_[_0xc56a('0x52')](_0x6eb0de['query']);_0xa63b81['filters']=_[_0xc56a('0x54')](_0xa63b81[_0xc56a('0x4d')],_0xa63b81[_0xc56a('0x51')]);_0xb913ab[_0xc56a('0x56')]=_['intersection'](_0xa63b81[_0xc56a('0x4d')],qs[_0xc56a('0x55')](_0x6eb0de['query'][_0xc56a('0x55')]));_0xb913ab[_0xc56a('0x56')]=_0xb913ab['attributes']['length']?_0xb913ab[_0xc56a('0x56')]:_0xa63b81['model'];_0xb913ab['order']=qs[_0xc56a('0x5a')](_0x6eb0de[_0xc56a('0x51')][_0xc56a('0x5a')]);_0xb913ab[_0xc56a('0x5b')]=qs['filters'](_[_0xc56a('0x5c')](_0x6eb0de[_0xc56a('0x51')],_0xa63b81[_0xc56a('0x53')]));if(_0x6eb0de['query']['filter']){_0xb913ab[_0xc56a('0x5b')]=_[_0xc56a('0x5e')](_0xb913ab[_0xc56a('0x5b')],{'$or':_[_0xc56a('0x3f')](_0xb913ab[_0xc56a('0x56')],function(_0x2feb87){var _0x1d1fff={};_0x1d1fff[_0x2feb87]={'$like':'%'+_0x6eb0de[_0xc56a('0x51')][_0xc56a('0x5d')]+'%'};return _0x1d1fff;})});}_0xb913ab=_[_0xc56a('0x5e')]({},_0xb913ab,_0x6eb0de[_0xc56a('0x62')]);return _0x3f5589[_0xc56a('0xc8')](_0xb913ab);}})[_0xc56a('0x23')](function(_0x213d3c){if(_0x213d3c){_0x4f0cd4=_0x213d3c[_0xc56a('0x7d')];if(!_0x6eb0de['query'][_0xc56a('0x57')](_0xc56a('0x58'))){_0xb913ab['limit']=qs[_0xc56a('0x32')](_0x6eb0de[_0xc56a('0x51')]['limit']);_0xb913ab[_0xc56a('0x31')]=qs['offset'](_0x6eb0de[_0xc56a('0x51')][_0xc56a('0x31')]);}return _0x3f5589['getGroups'](_0xb913ab);}})['then'](function(_0x32e1cb){if(_0x32e1cb){return _0x32e1cb?{'count':_0x4f0cd4,'rows':_0x32e1cb}:null;}})[_0xc56a('0x23')](respondWithResult(_0x1daa1b,null))[_0xc56a('0x66')](handleError(_0x1daa1b,null));};exports['getRecordings']=function(_0x1c5a50,_0x53cffe,_0x4b077f){var _0x54fd38={'raw':!![],'where':{}};var _0x1e7772={};var _0x1b5a3b={'count':0x0,'rows':[]};return db[_0xc56a('0x49')][_0xc56a('0x96')]({'where':{'id':_0x1c5a50[_0xc56a('0x68')]['id']}})[_0xc56a('0x23')](handleEntityNotFound(_0x53cffe,null))[_0xc56a('0x23')](function(_0x3f82af){if(_0x3f82af){_0x1e7772[_0xc56a('0x4d')]=_[_0xc56a('0x52')](db[_0xc56a('0xca')]['rawAttributes']);_0x1e7772[_0xc56a('0x51')]=_[_0xc56a('0x52')](_0x1c5a50[_0xc56a('0x51')]);_0x1e7772[_0xc56a('0x53')]=_[_0xc56a('0x54')](_0x1e7772[_0xc56a('0x4d')],_0x1e7772[_0xc56a('0x51')]);_0x54fd38[_0xc56a('0x56')]=_[_0xc56a('0x54')](_0x1e7772[_0xc56a('0x4d')],qs['fields'](_0x1c5a50['query'][_0xc56a('0x55')]));_0x54fd38[_0xc56a('0x56')]=_0x54fd38[_0xc56a('0x56')][_0xc56a('0x7d')]?_0x54fd38[_0xc56a('0x56')]:_0x1e7772[_0xc56a('0x4d')];if(!_0x1c5a50['query'][_0xc56a('0x57')](_0xc56a('0x58'))){_0x54fd38[_0xc56a('0x32')]=qs[_0xc56a('0x32')](_0x1c5a50[_0xc56a('0x51')]['limit']);_0x54fd38[_0xc56a('0x31')]=qs[_0xc56a('0x31')](_0x1c5a50[_0xc56a('0x51')][_0xc56a('0x31')]);}_0x54fd38[_0xc56a('0x59')]=qs['sort'](_0x1c5a50['query'][_0xc56a('0x5a')]);_0x54fd38['where']=qs[_0xc56a('0x53')](_[_0xc56a('0x5c')](_0x1c5a50[_0xc56a('0x51')],_0x1e7772[_0xc56a('0x53')]));_0x54fd38[_0xc56a('0x5b')][_0xc56a('0xcb')]=_0x3f82af['id'];if(_0x1c5a50[_0xc56a('0x51')][_0xc56a('0x5d')]){_0x54fd38[_0xc56a('0x5b')]=_[_0xc56a('0x5e')](_0x54fd38['where'],{'$or':_[_0xc56a('0x3f')](_0x54fd38[_0xc56a('0x56')],function(_0x3e2a18){var _0x268e8e={};_0x268e8e[_0x3e2a18]={'$like':'%'+_0x1c5a50['query'][_0xc56a('0x5d')]+'%'};return _0x268e8e;})});}_0x54fd38=_[_0xc56a('0x5e')]({},_0x54fd38,_0x1c5a50[_0xc56a('0x62')]);return db[_0xc56a('0xca')][_0xc56a('0x30')]({'where':_0x54fd38[_0xc56a('0x5b')]})[_0xc56a('0x23')](function(_0x47daf9){_0x1b5a3b['count']=_0x47daf9;if(_0x1c5a50[_0xc56a('0x51')][_0xc56a('0xbf')]){_0x54fd38[_0xc56a('0x63')]=[{'all':!![]}];}return db[_0xc56a('0xca')][_0xc56a('0x64')](_0x54fd38);})[_0xc56a('0x23')](function(_0x36de5d){_0x1b5a3b[_0xc56a('0x65')]=_0x36de5d;return _0x1b5a3b;});}})[_0xc56a('0x23')](respondWithFilteredResult(_0x53cffe,_0x54fd38))['catch'](handleError(_0x53cffe,null));};exports[_0xc56a('0xcc')]=function(_0x50e489,_0x4f54aa,_0x3a4ef1){var _0x29f8b7={'raw':!![],'where':{}};var _0xa9cf6c={};var _0x30f77f={'count':0x0,'rows':[]};return db[_0xc56a('0x49')]['findOne']({'where':{'id':_0x50e489[_0xc56a('0x68')]['id']}})[_0xc56a('0x23')](handleEntityNotFound(_0x4f54aa,null))[_0xc56a('0x23')](function(_0x342c8d){if(_0x342c8d){_0xa9cf6c[_0xc56a('0x4d')]=_[_0xc56a('0x52')](db[_0xc56a('0xcd')]['rawAttributes']);_0xa9cf6c[_0xc56a('0x51')]=_[_0xc56a('0x52')](_0x50e489['query']);_0xa9cf6c[_0xc56a('0x53')]=_[_0xc56a('0x54')](_0xa9cf6c[_0xc56a('0x4d')],_0xa9cf6c[_0xc56a('0x51')]);_0x29f8b7[_0xc56a('0x56')]=_[_0xc56a('0x54')](_0xa9cf6c[_0xc56a('0x4d')],qs['fields'](_0x50e489[_0xc56a('0x51')][_0xc56a('0x55')]));_0x29f8b7['attributes']=_0x29f8b7[_0xc56a('0x56')][_0xc56a('0x7d')]?_0x29f8b7['attributes']:_0xa9cf6c[_0xc56a('0x4d')];if(!_0x50e489[_0xc56a('0x51')][_0xc56a('0x57')]('nolimit')){_0x29f8b7['limit']=qs[_0xc56a('0x32')](_0x50e489[_0xc56a('0x51')][_0xc56a('0x32')]);_0x29f8b7['offset']=qs[_0xc56a('0x31')](_0x50e489[_0xc56a('0x51')]['offset']);}_0x29f8b7[_0xc56a('0x59')]=qs[_0xc56a('0x5a')](_0x50e489[_0xc56a('0x51')][_0xc56a('0x5a')]);_0x29f8b7[_0xc56a('0x5b')]=qs[_0xc56a('0x53')](_[_0xc56a('0x5c')](_0x50e489['query'],_0xa9cf6c[_0xc56a('0x53')]));_0x29f8b7[_0xc56a('0x5b')]['UserId']=_0x342c8d['id'];if(_0x50e489['query']['filter']){_0x29f8b7[_0xc56a('0x5b')]=_[_0xc56a('0x5e')](_0x29f8b7['where'],{'$or':_[_0xc56a('0x3f')](_0x29f8b7[_0xc56a('0x56')],function(_0xedf6e7){var _0x37c47c={};_0x37c47c[_0xedf6e7]={'$like':'%'+_0x50e489[_0xc56a('0x51')][_0xc56a('0x5d')]+'%'};return _0x37c47c;})});}_0x29f8b7=_[_0xc56a('0x5e')]({},_0x29f8b7,_0x50e489[_0xc56a('0x62')]);return db[_0xc56a('0xcd')]['count']({'where':_0x29f8b7[_0xc56a('0x5b')]})[_0xc56a('0x23')](function(_0x55ace8){_0x30f77f[_0xc56a('0x30')]=_0x55ace8;if(_0x50e489[_0xc56a('0x51')][_0xc56a('0xbf')]){_0x29f8b7[_0xc56a('0x63')]=[{'all':!![]}];}return db[_0xc56a('0xcd')]['findAll'](_0x29f8b7);})[_0xc56a('0x23')](function(_0x2d4b7a){_0x30f77f[_0xc56a('0x65')]=_0x2d4b7a;return _0x30f77f;});}})[_0xc56a('0x23')](respondWithFilteredResult(_0x4f54aa,_0x29f8b7))[_0xc56a('0x66')](handleError(_0x4f54aa,null));};exports[_0xc56a('0xce')]=function(_0x4cbb45,_0x397e41,_0x4d0fbd){var _0x5abf56={};var _0x35ba70={};var _0xa50ef1;var _0xc46e76;return db[_0xc56a('0x49')]['findOne']({'where':{'id':_0x4cbb45['params']['id']}})[_0xc56a('0x23')](handleEntityNotFound(_0x397e41,null))[_0xc56a('0x23')](function(_0x499300){if(_0x499300){_0xa50ef1=_0x499300;_0x35ba70[_0xc56a('0x4d')]=_[_0xc56a('0x52')](db[_0xc56a('0xcf')][_0xc56a('0x69')]);_0x35ba70['query']=_['keys'](_0x4cbb45['query']);_0x35ba70['filters']=_[_0xc56a('0x54')](_0x35ba70['model'],_0x35ba70[_0xc56a('0x51')]);_0x5abf56[_0xc56a('0x56')]=_[_0xc56a('0x54')](_0x35ba70['model'],qs['fields'](_0x4cbb45[_0xc56a('0x51')][_0xc56a('0x55')]));_0x5abf56[_0xc56a('0x56')]=_0x5abf56['attributes'][_0xc56a('0x7d')]?_0x5abf56[_0xc56a('0x56')]:_0x35ba70[_0xc56a('0x4d')];_0x5abf56[_0xc56a('0x59')]=qs[_0xc56a('0x5a')](_0x4cbb45[_0xc56a('0x51')][_0xc56a('0x5a')]);_0x5abf56['where']=qs['filters'](_[_0xc56a('0x5c')](_0x4cbb45[_0xc56a('0x51')],_0x35ba70[_0xc56a('0x53')]));if(_0x4cbb45['query']['filter']){_0x5abf56[_0xc56a('0x5b')]=_[_0xc56a('0x5e')](_0x5abf56['where'],{'$or':_[_0xc56a('0x3f')](_0x5abf56[_0xc56a('0x56')],function(_0x988526){var _0x2e99fe={};_0x2e99fe[_0x988526]={'$like':'%'+_0x4cbb45['query'][_0xc56a('0x5d')]+'%'};return _0x2e99fe;})});}_0x5abf56=_[_0xc56a('0x5e')]({},_0x5abf56,_0x4cbb45[_0xc56a('0x62')]);return _0xa50ef1[_0xc56a('0xce')](_0x5abf56);}})[_0xc56a('0x23')](function(_0x441b09){if(_0x441b09){_0xc46e76=_0x441b09[_0xc56a('0x7d')];if(!_0x4cbb45[_0xc56a('0x51')]['hasOwnProperty'](_0xc56a('0x58'))){_0x5abf56[_0xc56a('0x32')]=qs[_0xc56a('0x32')](_0x4cbb45[_0xc56a('0x51')][_0xc56a('0x32')]);_0x5abf56[_0xc56a('0x31')]=qs[_0xc56a('0x31')](_0x4cbb45[_0xc56a('0x51')][_0xc56a('0x31')]);}return _0xa50ef1[_0xc56a('0xce')](_0x5abf56);}})[_0xc56a('0x23')](function(_0x523255){if(_0x523255){return _0x523255?{'count':_0xc46e76,'rows':_0x523255}:null;}})[_0xc56a('0x23')](respondWithResult(_0x397e41,null))[_0xc56a('0x66')](handleError(_0x397e41,null));};exports[_0xc56a('0xd0')]=function(_0x129b49,_0x19f2d4,_0x5b01d9){var _0x6c1a7b={};var _0x1dff0b={};var _0x1be12f;var _0x208e13;return db[_0xc56a('0x49')][_0xc56a('0x96')]({'where':{'id':_0x129b49['params']['id']}})[_0xc56a('0x23')](handleEntityNotFound(_0x19f2d4,null))[_0xc56a('0x23')](function(_0x278282){if(_0x278282){_0x1be12f=_0x278282;_0x1dff0b[_0xc56a('0x4d')]=_[_0xc56a('0x52')](db[_0xc56a('0xd1')][_0xc56a('0x69')]);_0x1dff0b[_0xc56a('0x51')]=_[_0xc56a('0x52')](_0x129b49[_0xc56a('0x51')]);_0x1dff0b[_0xc56a('0x53')]=_['intersection'](_0x1dff0b[_0xc56a('0x4d')],_0x1dff0b[_0xc56a('0x51')]);_0x6c1a7b[_0xc56a('0x56')]=_['intersection'](_0x1dff0b[_0xc56a('0x4d')],qs['fields'](_0x129b49[_0xc56a('0x51')][_0xc56a('0x55')]));_0x6c1a7b[_0xc56a('0x56')]=_0x6c1a7b['attributes'][_0xc56a('0x7d')]?_0x6c1a7b[_0xc56a('0x56')]:_0x1dff0b[_0xc56a('0x4d')];_0x6c1a7b[_0xc56a('0x59')]=qs[_0xc56a('0x5a')](_0x129b49[_0xc56a('0x51')]['sort']);_0x6c1a7b['where']=qs[_0xc56a('0x53')](_['pick'](_0x129b49[_0xc56a('0x51')],_0x1dff0b[_0xc56a('0x53')]));if(_0x129b49['query']['filter']){_0x6c1a7b[_0xc56a('0x5b')]=_['merge'](_0x6c1a7b[_0xc56a('0x5b')],{'$or':_['map'](_0x6c1a7b[_0xc56a('0x56')],function(_0x2e9977){var _0x5be578={};_0x5be578[_0x2e9977]={'$like':'%'+_0x129b49[_0xc56a('0x51')]['filter']+'%'};return _0x5be578;})});}_0x6c1a7b=_[_0xc56a('0x5e')]({},_0x6c1a7b,_0x129b49[_0xc56a('0x62')]);return _0x1be12f[_0xc56a('0xd0')](_0x6c1a7b);}})[_0xc56a('0x23')](function(_0x50519f){if(_0x50519f){_0x208e13=_0x50519f[_0xc56a('0x7d')];if(!_0x129b49[_0xc56a('0x51')][_0xc56a('0x57')]('nolimit')){_0x6c1a7b['limit']=qs[_0xc56a('0x32')](_0x129b49[_0xc56a('0x51')][_0xc56a('0x32')]);_0x6c1a7b[_0xc56a('0x31')]=qs[_0xc56a('0x31')](_0x129b49[_0xc56a('0x51')][_0xc56a('0x31')]);}return _0x1be12f[_0xc56a('0xd0')](_0x6c1a7b);}})[_0xc56a('0x23')](function(_0x3df8f8){if(_0x3df8f8){return _0x3df8f8?{'count':_0x208e13,'rows':_0x3df8f8}:null;}})[_0xc56a('0x23')](respondWithResult(_0x19f2d4,null))[_0xc56a('0x66')](handleError(_0x19f2d4,null));};exports[_0xc56a('0xd2')]=function(_0x5ac679,_0x4d0567,_0x1d5049){var _0x4e7905={'raw':!![],'where':{}};var _0x5ab7d0={};var _0x3bf05f={'count':0x0,'rows':[]};return db['User'][_0xc56a('0x96')]({'where':{'id':_0x5ac679['params']['id']}})[_0xc56a('0x23')](handleEntityNotFound(_0x4d0567,null))[_0xc56a('0x23')](function(_0x334c9b){if(_0x334c9b){_0x5ab7d0[_0xc56a('0x4d')]=_[_0xc56a('0x52')](db['MailInteraction'][_0xc56a('0x69')]);_0x5ab7d0[_0xc56a('0x51')]=_[_0xc56a('0x52')](_0x5ac679['query']);_0x5ab7d0[_0xc56a('0x53')]=_[_0xc56a('0x54')](_0x5ab7d0[_0xc56a('0x4d')],_0x5ab7d0[_0xc56a('0x51')]);_0x4e7905[_0xc56a('0x56')]=_['intersection'](_0x5ab7d0['model'],qs[_0xc56a('0x55')](_0x5ac679['query']['fields']));_0x4e7905[_0xc56a('0x56')]=_0x4e7905['attributes'][_0xc56a('0x7d')]?_0x4e7905[_0xc56a('0x56')]:_0x5ab7d0['model'];if(!_0x5ac679['query'][_0xc56a('0x57')](_0xc56a('0x58'))){_0x4e7905[_0xc56a('0x32')]=qs[_0xc56a('0x32')](_0x5ac679[_0xc56a('0x51')][_0xc56a('0x32')]);_0x4e7905[_0xc56a('0x31')]=qs[_0xc56a('0x31')](_0x5ac679[_0xc56a('0x51')][_0xc56a('0x31')]);}_0x4e7905['order']=qs[_0xc56a('0x5a')](_0x5ac679[_0xc56a('0x51')][_0xc56a('0x5a')]);_0x4e7905[_0xc56a('0x5b')]=qs['filters'](_[_0xc56a('0x5c')](_0x5ac679['query'],_0x5ab7d0[_0xc56a('0x53')]));_0x4e7905[_0xc56a('0x5b')][_0xc56a('0xcb')]=_0x334c9b['id'];if(_0x5ac679[_0xc56a('0x51')][_0xc56a('0x5d')]){_0x4e7905[_0xc56a('0x5b')]=_[_0xc56a('0x5e')](_0x4e7905[_0xc56a('0x5b')],{'$or':_['map'](_0x4e7905[_0xc56a('0x56')],function(_0x96cf4b){var _0x54037={};_0x54037[_0x96cf4b]={'$like':'%'+_0x5ac679[_0xc56a('0x51')][_0xc56a('0x5d')]+'%'};return _0x54037;})});}_0x4e7905=_[_0xc56a('0x5e')]({},_0x4e7905,_0x5ac679[_0xc56a('0x62')]);return db[_0xc56a('0xd3')][_0xc56a('0x30')]({'where':_0x4e7905['where']})[_0xc56a('0x23')](function(_0x355f03){_0x3bf05f[_0xc56a('0x30')]=_0x355f03;if(_0x5ac679['query'][_0xc56a('0xbf')]){_0x4e7905['include']=[{'all':!![]}];}return db['MailInteraction'][_0xc56a('0x64')](_0x4e7905);})[_0xc56a('0x23')](function(_0x4e2fec){_0x3bf05f['rows']=_0x4e2fec;return _0x3bf05f;});}})[_0xc56a('0x23')](respondWithFilteredResult(_0x4d0567,_0x4e7905))[_0xc56a('0x66')](handleError(_0x4d0567,null));};exports['getSmsInteractions']=function(_0x146efb,_0x1423f3,_0x5e64b0){var _0x5563de={};var _0x49cedf={};var _0x4585da;var _0x2e73dc;return db[_0xc56a('0x49')][_0xc56a('0x96')]({'where':{'id':_0x146efb['params']['id']}})['then'](handleEntityNotFound(_0x1423f3,null))['then'](function(_0x2412df){if(_0x2412df){_0x4585da=_0x2412df;_0x49cedf[_0xc56a('0x4d')]=_['keys'](db[_0xc56a('0xd4')][_0xc56a('0x69')]);_0x49cedf[_0xc56a('0x51')]=_[_0xc56a('0x52')](_0x146efb['query']);_0x49cedf[_0xc56a('0x53')]=_[_0xc56a('0x54')](_0x49cedf['model'],_0x49cedf['query']);_0x5563de[_0xc56a('0x56')]=_[_0xc56a('0x54')](_0x49cedf[_0xc56a('0x4d')],qs[_0xc56a('0x55')](_0x146efb[_0xc56a('0x51')][_0xc56a('0x55')]));_0x5563de['attributes']=_0x5563de['attributes'][_0xc56a('0x7d')]?_0x5563de[_0xc56a('0x56')]:_0x49cedf[_0xc56a('0x4d')];_0x5563de[_0xc56a('0x59')]=qs[_0xc56a('0x5a')](_0x146efb[_0xc56a('0x51')][_0xc56a('0x5a')]);_0x5563de[_0xc56a('0x5b')]=qs[_0xc56a('0x53')](_[_0xc56a('0x5c')](_0x146efb[_0xc56a('0x51')],_0x49cedf[_0xc56a('0x53')]));if(_0x146efb[_0xc56a('0x51')][_0xc56a('0x5d')]){_0x5563de[_0xc56a('0x5b')]=_[_0xc56a('0x5e')](_0x5563de['where'],{'$or':_[_0xc56a('0x3f')](_0x5563de[_0xc56a('0x56')],function(_0x57a6b1){var _0x275edd={};_0x275edd[_0x57a6b1]={'$like':'%'+_0x146efb['query']['filter']+'%'};return _0x275edd;})});}_0x5563de=_[_0xc56a('0x5e')]({},_0x5563de,_0x146efb[_0xc56a('0x62')]);return _0x4585da['getSmsInteractions'](_0x5563de);}})[_0xc56a('0x23')](function(_0x13b261){if(_0x13b261){_0x2e73dc=_0x13b261[_0xc56a('0x7d')];if(!_0x146efb[_0xc56a('0x51')]['hasOwnProperty'](_0xc56a('0x58'))){_0x5563de[_0xc56a('0x32')]=qs[_0xc56a('0x32')](_0x146efb[_0xc56a('0x51')][_0xc56a('0x32')]);_0x5563de[_0xc56a('0x31')]=qs[_0xc56a('0x31')](_0x146efb[_0xc56a('0x51')]['offset']);}return _0x4585da['getSmsInteractions'](_0x5563de);}})[_0xc56a('0x23')](function(_0x3f3590){if(_0x3f3590){return _0x3f3590?{'count':_0x2e73dc,'rows':_0x3f3590}:null;}})[_0xc56a('0x23')](respondWithResult(_0x1423f3,null))[_0xc56a('0x66')](handleError(_0x1423f3,null));};exports[_0xc56a('0xd5')]=function(_0x52cb84,_0x55c327,_0x5d928c){var _0xd3997e={};var _0x156539={};var _0x1b30ba;var _0x32f14b;return db[_0xc56a('0x49')][_0xc56a('0x96')]({'where':{'id':_0x52cb84[_0xc56a('0x68')]['id']}})[_0xc56a('0x23')](handleEntityNotFound(_0x55c327,null))[_0xc56a('0x23')](function(_0x7e3707){if(_0x7e3707){_0x1b30ba=_0x7e3707;_0x156539['model']=_[_0xc56a('0x52')](db[_0xc56a('0xd6')]['rawAttributes']);_0x156539[_0xc56a('0x51')]=_[_0xc56a('0x52')](_0x52cb84[_0xc56a('0x51')]);_0x156539['filters']=_[_0xc56a('0x54')](_0x156539[_0xc56a('0x4d')],_0x156539['query']);_0xd3997e[_0xc56a('0x56')]=_['intersection'](_0x156539[_0xc56a('0x4d')],qs[_0xc56a('0x55')](_0x52cb84['query'][_0xc56a('0x55')]));_0xd3997e['attributes']=_0xd3997e[_0xc56a('0x56')][_0xc56a('0x7d')]?_0xd3997e[_0xc56a('0x56')]:_0x156539[_0xc56a('0x4d')];_0xd3997e[_0xc56a('0x59')]=qs[_0xc56a('0x5a')](_0x52cb84[_0xc56a('0x51')][_0xc56a('0x5a')]);_0xd3997e[_0xc56a('0x5b')]=qs[_0xc56a('0x53')](_[_0xc56a('0x5c')](_0x52cb84[_0xc56a('0x51')],_0x156539['filters']));if(_0x52cb84['query'][_0xc56a('0x5d')]){_0xd3997e[_0xc56a('0x5b')]=_[_0xc56a('0x5e')](_0xd3997e[_0xc56a('0x5b')],{'$or':_[_0xc56a('0x3f')](_0xd3997e[_0xc56a('0x56')],function(_0x367e7c){var _0x5b7715={};_0x5b7715[_0x367e7c]={'$like':'%'+_0x52cb84[_0xc56a('0x51')]['filter']+'%'};return _0x5b7715;})});}_0xd3997e=_[_0xc56a('0x5e')]({},_0xd3997e,_0x52cb84['options']);return _0x1b30ba[_0xc56a('0xd5')](_0xd3997e);}})[_0xc56a('0x23')](function(_0x5951eb){if(_0x5951eb){_0x32f14b=_0x5951eb['length'];if(!_0x52cb84[_0xc56a('0x51')][_0xc56a('0x57')]('nolimit')){_0xd3997e[_0xc56a('0x32')]=qs['limit'](_0x52cb84[_0xc56a('0x51')][_0xc56a('0x32')]);_0xd3997e[_0xc56a('0x31')]=qs[_0xc56a('0x31')](_0x52cb84[_0xc56a('0x51')][_0xc56a('0x31')]);}return _0x1b30ba[_0xc56a('0xd5')](_0xd3997e);}})[_0xc56a('0x23')](function(_0x3f5594){if(_0x3f5594){return _0x3f5594?{'count':_0x32f14b,'rows':_0x3f5594}:null;}})[_0xc56a('0x23')](respondWithResult(_0x55c327,null))[_0xc56a('0x66')](handleError(_0x55c327,null));};exports['getWhatsappInteractions']=function(_0x53468f,_0x14672a,_0x484462){var _0x12a44d={};var _0x4625d3={};var _0x48a759;var _0x102350;return db['User'][_0xc56a('0x96')]({'where':{'id':_0x53468f['params']['id']}})['then'](handleEntityNotFound(_0x14672a,null))[_0xc56a('0x23')](function(_0x4da31e){if(_0x4da31e){_0x48a759=_0x4da31e;_0x4625d3[_0xc56a('0x4d')]=_[_0xc56a('0x52')](db[_0xc56a('0xd7')][_0xc56a('0x69')]);_0x4625d3[_0xc56a('0x51')]=_[_0xc56a('0x52')](_0x53468f[_0xc56a('0x51')]);_0x4625d3[_0xc56a('0x53')]=_[_0xc56a('0x54')](_0x4625d3[_0xc56a('0x4d')],_0x4625d3['query']);_0x12a44d['attributes']=_[_0xc56a('0x54')](_0x4625d3[_0xc56a('0x4d')],qs['fields'](_0x53468f[_0xc56a('0x51')][_0xc56a('0x55')]));_0x12a44d[_0xc56a('0x56')]=_0x12a44d[_0xc56a('0x56')][_0xc56a('0x7d')]?_0x12a44d['attributes']:_0x4625d3[_0xc56a('0x4d')];_0x12a44d[_0xc56a('0x59')]=qs[_0xc56a('0x5a')](_0x53468f[_0xc56a('0x51')][_0xc56a('0x5a')]);_0x12a44d[_0xc56a('0x5b')]=qs[_0xc56a('0x53')](_['pick'](_0x53468f[_0xc56a('0x51')],_0x4625d3['filters']));if(_0x53468f[_0xc56a('0x51')]['filter']){_0x12a44d['where']=_['merge'](_0x12a44d[_0xc56a('0x5b')],{'$or':_[_0xc56a('0x3f')](_0x12a44d[_0xc56a('0x56')],function(_0x1803b0){var _0x3a63bb={};_0x3a63bb[_0x1803b0]={'$like':'%'+_0x53468f['query']['filter']+'%'};return _0x3a63bb;})});}_0x12a44d=_[_0xc56a('0x5e')]({},_0x12a44d,_0x53468f[_0xc56a('0x62')]);return _0x48a759['getWhatsappInteractions'](_0x12a44d);}})[_0xc56a('0x23')](function(_0x117069){if(_0x117069){_0x102350=_0x117069[_0xc56a('0x7d')];if(!_0x53468f['query'][_0xc56a('0x57')](_0xc56a('0x58'))){_0x12a44d[_0xc56a('0x32')]=qs[_0xc56a('0x32')](_0x53468f[_0xc56a('0x51')][_0xc56a('0x32')]);_0x12a44d[_0xc56a('0x31')]=qs[_0xc56a('0x31')](_0x53468f[_0xc56a('0x51')][_0xc56a('0x31')]);}return _0x48a759['getWhatsappInteractions'](_0x12a44d);}})[_0xc56a('0x23')](function(_0x46660c){if(_0x46660c){return _0x46660c?{'count':_0x102350,'rows':_0x46660c}:null;}})[_0xc56a('0x23')](respondWithResult(_0x14672a,null))[_0xc56a('0x66')](handleError(_0x14672a,null));};exports[_0xc56a('0xd8')]=function(_0x5d7bb3,_0x6f71f4,_0x54ccd6){var _0x470a37;var _0x58362b;var _0x5a0571;var _0x2ce268=!_[_0xc56a('0x75')](_0x5d7bb3['params']['id'])?_0x5d7bb3[_0xc56a('0x68')]['id']:!_[_0xc56a('0x75')](_0x5d7bb3['user']['id'])?_0x5d7bb3[_0xc56a('0x3b')]['id']:null;return db[_0xc56a('0x49')][_0xc56a('0x43')]({'where':{'id':_0x2ce268,'role':{'$or':[_0xc56a('0x9b'),_0xc56a('0x3b'),_0xc56a('0x70')]}},'attributes':['id',_0xc56a('0x44'),_0xc56a('0xd9'),'mobile',_0xc56a('0x42'),'internal',_0xc56a('0xda')]})[_0xc56a('0x23')](function(_0x3459e8){if(_0x3459e8){if(_0x3459e8[_0xc56a('0x42')]===_0xc56a('0x70')){_0x470a37=_0x3459e8;if(_0x5d7bb3['body'][_0xc56a('0xa2')]){_0x5a0571=util[_0xc56a('0x77')]('LOCAL/%s@from-sip/n',_0x470a37[_0x5d7bb3[_0xc56a('0x6b')][_0xc56a('0xa2')]]);}else if(_0x5d7bb3[_0xc56a('0x6b')][_0xc56a('0xdb')]){_0x5a0571=util[_0xc56a('0x77')](_0xc56a('0xac'),_0x5d7bb3[_0xc56a('0x6b')]['intrf']);}else{_0x5a0571=util[_0xc56a('0x77')](_0xc56a('0xac'),_0x470a37['name']);}socket['to'](util[_0xc56a('0x77')](_0xc56a('0xdc'),_0x470a37[_0xc56a('0x44')]))['emit']('user:forcelogout',{'ip':_0x5d7bb3[_0xc56a('0xdd')][_0xc56a('0xde')]||_0x5d7bb3[_0xc56a('0xdf')][_0xc56a('0xe0')]||_0x5d7bb3[_0xc56a('0xe1')][_0xc56a('0xe0')]||_0x5d7bb3[_0xc56a('0xdf')][_0xc56a('0xe1')][_0xc56a('0xe0')]});return db[_0xc56a('0xae')][_0xc56a('0x38')]({'where':{'membername':_0x470a37[_0xc56a('0x44')]},'individualHooks':!![]});}}else{throw new db['Sequelize']['ValidationError']('User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method');}})[_0xc56a('0x23')](function(){if(_0x470a37){return _0x470a37[_0xc56a('0xe2')]({'raw':!![]});}})[_0xc56a('0x23')](function(_0x304bb7){if(_0x470a37){var _0x35e828=[];if(_0x304bb7){_0x58362b=_0x304bb7;if(_0x58362b[_0xc56a('0x7d')]){for(var _0x20764b=0x0;_0x20764b<_0x58362b[_0xc56a('0x7d')];_0x20764b++){_0x35e828['push']({'membername':_0x470a37[_0xc56a('0x44')],'UserId':_0x470a37['id'],'queue_name':_0x58362b[_0x20764b]['name'],'VoiceQueueId':_0x58362b[_0x20764b]['id'],'interface':_0x5a0571,'paused':_0x470a37[_0xc56a('0xda')]||![],'penalty':_0x58362b[_0x20764b][_0xc56a('0xe3')]||0x0});}return BPromise[_0xc56a('0xad')](_0x35e828,function(_0x39e2ca){return db[_0xc56a('0xae')][_0xc56a('0xaf')](_0x39e2ca);});}}}})[_0xc56a('0x23')](function(){if(_0x470a37){return db[_0xc56a('0xe4')][_0xc56a('0x64')]({'where':{'membername':_0x470a37[_0xc56a('0x44')],'exitAt':null}});}})['then'](function(_0x4aebd0){if(_0x470a37){var _0x10adb1=[];_0x4aebd0[_0xc56a('0xe5')](function(_0x2cff6d){_0x10adb1[_0xc56a('0xe6')](_0x2cff6d[_0xc56a('0x37')]({'exitAt':moment()[_0xc56a('0x77')](_0xc56a('0xe7'))}));});return BPromise[_0xc56a('0xe8')](_0x10adb1);}})[_0xc56a('0x23')](function(){if(_0x470a37){var _0x2f2b9e=[];var _0xf0c325=[];var _0xabf991=utils['getChannels']();var _0x9449f3={'membername':_0x470a37['name'],'interface':_0x5a0571,'enterAt':moment()[_0xc56a('0x77')](_0xc56a('0xe7')),'role':_0x470a37[_0xc56a('0x42')],'internal':_0x470a37[_0xc56a('0x7a')]};_0xabf991[_0xc56a('0xe5')](function(_0x4d1d95){_0x2f2b9e[_0xc56a('0xe6')](_['merge']({'channel':_0x4d1d95,'type':_0xc56a('0xe9'),'data1':_0x5d7bb3[_0xc56a('0x6b')]['device'],'data2':_0x5a0571},_0x9449f3));if(_0x470a37[_0xc56a('0xda')]){_0xf0c325[_0xc56a('0xe6')](_[_0xc56a('0x5e')]({'channel':_0x4d1d95,'type':_0xc56a('0xea'),'data1':_0xc56a('0xeb')},_0x9449f3));}});return db[_0xc56a('0xe4')][_0xc56a('0x6a')](_0x2f2b9e[_0xc56a('0xec')](_0xf0c325),{'individualHooks':!![]});}})['then'](function(){if(_0x470a37){return _0x470a37['update']({'online':!![],'lastLoginAt':moment()['format'](_0xc56a('0xe7')),'voicePause':_0x470a37[_0xc56a('0xda')]||![],'mailPause':_0x470a37[_0xc56a('0xda')]||![],'chatPause':_0x470a37['loginInPause']||![],'faxPause':_0x470a37[_0xc56a('0xda')]||![],'smsPause':_0x470a37['loginInPause']||![],'openchannelPause':_0x470a37[_0xc56a('0xda')]||![],'whatsappPause':_0x470a37[_0xc56a('0xda')]||![],'pauseType':_0x470a37['loginInPause']?_0xc56a('0xeb'):null,'interface':_0x5a0571,'lastPauseAt':moment()[_0xc56a('0x77')](_0xc56a('0xe7'))});}})['then'](function(_0x3e430c){if(_0x5d7bb3[_0xc56a('0xed')]){return _0x54ccd6();}else{return BPromise[_0xc56a('0xee')](_0x3e430c)['then'](respondWithResult(_0x6f71f4,null));}})[_0xc56a('0x66')](handleError(_0x6f71f4,null));};exports['logout']=function(_0x1de5dc,_0x516ad7,_0x42fdbc){var _0x30ab9b;return db[_0xc56a('0x49')][_0xc56a('0x43')]({'where':{'id':_0x1de5dc[_0xc56a('0x68')]['id'],'role':'agent'},'attributes':['id',_0xc56a('0x44'),_0xc56a('0x42')]})[_0xc56a('0x23')](handleEntityNotFound(_0x516ad7,null))[_0xc56a('0x23')](function(_0x1abf28){if(_0x1abf28){_0x30ab9b=_0x1abf28;return db['UserVoiceQueueRt']['destroy']({'where':{'membername':_0x30ab9b[_0xc56a('0x44')]},'individualHooks':!![]});}})[_0xc56a('0x23')](function(){return db[_0xc56a('0xe4')]['findAll']({'where':{'membername':_0x30ab9b['name'],'exitAt':null}});})[_0xc56a('0x23')](function(_0x1e6b85){var _0x5beddf=[];_0x1e6b85[_0xc56a('0xe5')](function(_0x458448){_0x5beddf[_0xc56a('0xe6')](_0x458448['update']({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0xc56a('0xe8')](_0x5beddf);})['then'](function(){return _0x30ab9b[_0xc56a('0x37')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})['then'](respondWithResult(_0x516ad7,null))[_0xc56a('0x66')](handleError(_0x516ad7,null));};exports[_0xc56a('0xef')]=function(_0x392090,_0xd0e7eb,_0xd7c23){var _0x3ec555;return db[_0xc56a('0xae')][_0xc56a('0x37')]({'paused':0x1},{'where':{'UserId':_0x392090[_0xc56a('0x68')]['id']},'individualHooks':!![]})['then'](function(){return db['User'][_0xc56a('0x43')]({'where':{'id':_0x392090[_0xc56a('0x68')]['id'],'role':_0xc56a('0x70')},'attributes':['id',_0xc56a('0x44'),_0xc56a('0x42'),_0xc56a('0x7a'),_0xc56a('0xa2')]});})[_0xc56a('0x23')](handleEntityNotFound(_0xd0e7eb,null))['then'](function(_0x172aca){if(_0x172aca){_0x3ec555=_0x172aca;return respondWithRpcPromise(_0xc56a('0xf0'),_0xc56a('0xef'),{'id':_0x3ec555['id'],'name':_0x3ec555[_0xc56a('0x44')],'pause':!![]});}})[_0xc56a('0x23')](function(){if(_0x3ec555){return db['MemberReport'][_0xc56a('0x64')]({'where':{'membername':_0x3ec555[_0xc56a('0x44')],'type':'PAUSE','exitAt':null}});}})[_0xc56a('0x23')](function(_0x1992db){if(_0x1992db[_0xc56a('0x7d')]){var _0x1fc856=moment()[_0xc56a('0x77')](_0xc56a('0xe7'));for(var _0x5a8f33=0x0,_0x442974=_0x1992db[_0xc56a('0x7d')];_0x5a8f33<_0x442974;_0x5a8f33++){_0x1992db[_0x5a8f33][_0xc56a('0xf1')]({'exitAt':_0x1fc856});}}})[_0xc56a('0x23')](function(){var _0x537917=[];var _0x4ea8c4=utils[_0xc56a('0xf2')]();_0x4ea8c4[_0xc56a('0xe5')](function(_0x2d5964){_0x537917['push']({'channel':_0x2d5964,'membername':_0x3ec555['name'],'interface':_[_0xc56a('0x75')](_0x3ec555[_0xc56a('0xa2')])?util['format']('SIP/%s',_0x3ec555[_0xc56a('0x44')]):_0x3ec555['interface'],'type':_0xc56a('0xea'),'enterAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x392090[_0xc56a('0x6b')][_0xc56a('0x4b')]||_0xc56a('0xf3'),'role':_0x3ec555[_0xc56a('0x42')],'internal':_0x3ec555[_0xc56a('0x7a')]});});return db[_0xc56a('0xe4')]['bulkCreate'](_0x537917,{'individualHooks':!![]});})['then'](function(){return _0x3ec555[_0xc56a('0x37')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x392090[_0xc56a('0x6b')][_0xc56a('0x4b')]||_0xc56a('0xf3'),'lastPauseAt':moment()[_0xc56a('0x77')](_0xc56a('0xe7'))});})['then'](respondWithResult(_0xd0e7eb,null))[_0xc56a('0x66')](handleError(_0xd0e7eb,null));};exports[_0xc56a('0xf4')]=function(_0x3de99a,_0x24097c,_0x5ca01e){var _0x55ac69;return db[_0xc56a('0x49')][_0xc56a('0x43')]({'where':{'id':_0x3de99a[_0xc56a('0x68')]['id']},'attributes':['id',_0xc56a('0x44'),_0xc56a('0x42'),_0xc56a('0xa1'),_0xc56a('0xf5'),'chatPause',_0xc56a('0xf6'),_0xc56a('0xf7'),_0xc56a('0xf8'),'whatsapppause',_0xc56a('0xf9'),'lastPauseAt']})['then'](handleEntityNotFound(_0x24097c,null))['then'](function(_0x1bfea8){if(_0x1bfea8){_0x55ac69=_0x1bfea8;if(_0x3de99a[_0xc56a('0x6b')]['channel']&&!utils[_0xc56a('0xa3')](_0x3de99a[_0xc56a('0x6b')][_0xc56a('0x9f')])){throw new db['Sequelize'][(_0xc56a('0x20'))]('Unknown\x20channel');}switch(_0x3de99a['body'][_0xc56a('0x9f')]){case _0xc56a('0xab'):return respondWithRpcPromise(_0xc56a('0xf0'),'unpause',{'id':_0x55ac69['id'],'name':_0x55ac69['name'],'pause':![]})[_0xc56a('0x23')](function(){return db[_0xc56a('0xae')][_0xc56a('0x37')]({'paused':0x0},{'where':{'UserId':_0x55ac69['id']},'individualHooks':!![]});})[_0xc56a('0x23')](function(){return db[_0xc56a('0xe4')][_0xc56a('0x43')]({'where':{'channel':_0x3de99a[_0xc56a('0x6b')][_0xc56a('0x9f')],'membername':_0x55ac69[_0xc56a('0x44')],'type':_0xc56a('0xea'),'exitAt':null}});})['then'](function(_0x8dd5a1){if(_0x8dd5a1){return _0x8dd5a1[_0xc56a('0x37')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0xc56a('0xfa')},{'individualHooks':!![]});}return null;})[_0xc56a('0x23')](function(){return _0x55ac69['update']({'voicePause':![]});});case _0xc56a('0xfb'):case _0xc56a('0xfc'):case _0xc56a('0xfd'):case'sms':case _0xc56a('0xfe'):case'openchannel':return db[_0xc56a('0xe4')][_0xc56a('0x43')]({'where':{'channel':_0x3de99a[_0xc56a('0x6b')][_0xc56a('0x9f')],'membername':_0x55ac69[_0xc56a('0x44')],'type':_0xc56a('0xea'),'exitAt':null}})[_0xc56a('0x23')](function(_0x58334e){if(_0x58334e){return _0x58334e[_0xc56a('0x37')]({'exitAt':moment()['format'](_0xc56a('0xe7')),'data2':'manual'},{'individualHooks':!![]});}return null;})[_0xc56a('0x23')](function(){var _0x5ea522={};_[_0xc56a('0x33')](_0x5ea522,util[_0xc56a('0x77')](_0xc56a('0xff'),_0x3de99a[_0xc56a('0x6b')][_0xc56a('0x9f')],_0xc56a('0x100')),![]);return _0x55ac69[_0xc56a('0x37')](_0x5ea522);});default:return respondWithRpcPromise(_0xc56a('0xf0'),_0xc56a('0xf4'),{'id':_0x55ac69['id'],'name':_0x55ac69[_0xc56a('0x44')],'pause':![]})[_0xc56a('0x23')](function(){return db[_0xc56a('0xae')][_0xc56a('0x37')]({'paused':0x0},{'where':{'UserId':_0x55ac69['id']}});})[_0xc56a('0x23')](function(){return db[_0xc56a('0xe4')][_0xc56a('0x64')]({'where':{'membername':_0x55ac69[_0xc56a('0x44')],'type':_0xc56a('0xea'),'exitAt':null}});})[_0xc56a('0x23')](function(_0x1b4e18){var _0x49377e=[];_0x1b4e18[_0xc56a('0xe5')](function(_0x4e09f){_0x49377e[_0xc56a('0xe6')](_0x4e09f[_0xc56a('0x37')]({'exitAt':moment()['format'](_0xc56a('0xe7')),'data2':_0xc56a('0xfa')}));});return BPromise['all'](_0x49377e);})['then'](function(){return _0x55ac69[_0xc56a('0x37')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})[_0xc56a('0x23')](respondWithResult(_0x24097c,null))[_0xc56a('0x66')](handleError(_0x24097c,null));};exports[_0xc56a('0x101')]=function(_0x1f2f1e,_0x3755a1,_0x3bacb0){var _0xbee2d7={};var _0x64dccb={};var _0x3a912d;var _0xeb976b;return db[_0xc56a('0x49')]['findOne']({'where':{'id':_0x1f2f1e[_0xc56a('0x68')]['id']}})['then'](handleEntityNotFound(_0x3755a1,null))[_0xc56a('0x23')](function(_0x13f466){if(_0x13f466){_0x3a912d=_0x13f466;_0x64dccb[_0xc56a('0x4d')]=_[_0xc56a('0x52')](db[_0xc56a('0x102')][_0xc56a('0x69')]);_0x64dccb[_0xc56a('0x51')]=_[_0xc56a('0x52')](_0x1f2f1e[_0xc56a('0x51')]);_0x64dccb[_0xc56a('0x53')]=_[_0xc56a('0x54')](_0x64dccb[_0xc56a('0x4d')],_0x64dccb['query']);_0xbee2d7[_0xc56a('0x56')]=_[_0xc56a('0x54')](_0x64dccb['model'],qs[_0xc56a('0x55')](_0x1f2f1e[_0xc56a('0x51')][_0xc56a('0x55')]));_0xbee2d7[_0xc56a('0x56')]=_0xbee2d7['attributes'][_0xc56a('0x7d')]?_0xbee2d7[_0xc56a('0x56')]:_0x64dccb[_0xc56a('0x4d')];_0xbee2d7[_0xc56a('0x59')]=qs[_0xc56a('0x5a')](_0x1f2f1e['query'][_0xc56a('0x5a')]);_0xbee2d7[_0xc56a('0x5b')]=qs[_0xc56a('0x53')](_[_0xc56a('0x5c')](_0x1f2f1e[_0xc56a('0x51')],_0x64dccb[_0xc56a('0x53')]));if(_0x1f2f1e['query'][_0xc56a('0x5d')]){_0xbee2d7[_0xc56a('0x5b')]=_[_0xc56a('0x5e')](_0xbee2d7[_0xc56a('0x5b')],{'$or':_[_0xc56a('0x3f')](_0xbee2d7[_0xc56a('0x56')],function(_0x26d7b0){var _0xe24272={};_0xe24272[_0x26d7b0]={'$like':'%'+_0x1f2f1e[_0xc56a('0x51')][_0xc56a('0x5d')]+'%'};return _0xe24272;})});}_0xbee2d7=_[_0xc56a('0x5e')]({},_0xbee2d7,_0x1f2f1e[_0xc56a('0x62')]);return _0x3a912d[_0xc56a('0x101')](_0xbee2d7);}})[_0xc56a('0x23')](function(_0x3ae6d3){if(_0x3ae6d3){_0xeb976b=_0x3ae6d3[_0xc56a('0x7d')];if(!_0x1f2f1e[_0xc56a('0x51')][_0xc56a('0x57')](_0xc56a('0x58'))){_0xbee2d7[_0xc56a('0x32')]=qs[_0xc56a('0x32')](_0x1f2f1e[_0xc56a('0x51')]['limit']);_0xbee2d7['offset']=qs['offset'](_0x1f2f1e[_0xc56a('0x51')][_0xc56a('0x31')]);}return _0x3a912d[_0xc56a('0x101')](_0xbee2d7);}})[_0xc56a('0x23')](function(_0x539c70){if(_0x539c70){return _0x539c70?{'count':_0xeb976b,'rows':_0x539c70}:null;}})[_0xc56a('0x23')](respondWithResult(_0x3755a1,null))[_0xc56a('0x66')](handleError(_0x3755a1,null));};exports[_0xc56a('0x103')]=function(_0x1d4a9f,_0x287960){return db[_0xc56a('0x49')]['find']({'where':{'id':_0x1d4a9f['params']['id']}})[_0xc56a('0x23')](handleEntityNotFound(_0x287960,null))[_0xc56a('0x23')](function(_0x5b7db3){if(_0x5b7db3){var _0x2bebfb=_0x5b7db3[_0xc56a('0x39')]({'plain':!![]});return _0x5b7db3[_0xc56a('0x103')](_0x1d4a9f[_0xc56a('0x6b')][_0xc56a('0x6e')],_[_0xc56a('0x6f')](_0x1d4a9f[_0xc56a('0x6b')],[_0xc56a('0x6e'),'id'])||{})['then'](function(){for(var _0x364208=0x0;_0x364208<_0x1d4a9f[_0xc56a('0x6b')][_0xc56a('0x6e')][_0xc56a('0x7d')];_0x364208++){var _0x2beabf=[];db[_0xc56a('0x102')][_0xc56a('0x96')]({'where':{'id':_0x1d4a9f[_0xc56a('0x6b')][_0xc56a('0x6e')][_0x364208]}})['then'](function(_0x4564e9){_0x2beabf[_0xc56a('0xe6')](_0x4564e9[_0xc56a('0xe2')]()[_0xc56a('0x23')](function(_0x2c95f2){for(var _0x4cc91c=0x0;_0x4cc91c<_0x2c95f2['length'];_0x4cc91c++){_0x2c95f2[_0x4cc91c][_0xc56a('0x104')](_0xc56a('0x9f'),_0xc56a('0x105'));}return _0x2c95f2;}));_0x2beabf[_0xc56a('0xe6')](_0x4564e9['getChatQueues']()[_0xc56a('0x23')](function(_0x17c93d){for(var _0x5700a1=0x0;_0x5700a1<_0x17c93d[_0xc56a('0x7d')];_0x5700a1++){_0x17c93d[_0x5700a1][_0xc56a('0x104')](_0xc56a('0x9f'),_0xc56a('0x106'));}return _0x17c93d;}));_0x2beabf[_0xc56a('0xe6')](_0x4564e9[_0xc56a('0x107')]()[_0xc56a('0x23')](function(_0x59fd83){for(var _0x4b4934=0x0;_0x4b4934<_0x59fd83[_0xc56a('0x7d')];_0x4b4934++){_0x59fd83[_0x4b4934][_0xc56a('0x104')](_0xc56a('0x9f'),_0xc56a('0x108'));}return _0x59fd83;}));_0x2beabf['push'](_0x4564e9[_0xc56a('0x109')]()['then'](function(_0x159f27){for(var _0x1917e8=0x0;_0x1917e8<_0x159f27[_0xc56a('0x7d')];_0x1917e8++){_0x159f27[_0x1917e8][_0xc56a('0x104')](_0xc56a('0x9f'),'Sms');}return _0x159f27;}));_0x2beabf[_0xc56a('0xe6')](_0x4564e9[_0xc56a('0x10a')]()['then'](function(_0x12ff00){for(var _0x4012d0=0x0;_0x4012d0<_0x12ff00[_0xc56a('0x7d')];_0x4012d0++){_0x12ff00[_0x4012d0][_0xc56a('0x104')](_0xc56a('0x9f'),_0xc56a('0x10b'));}return _0x12ff00;}));_0x2beabf['push'](_0x4564e9[_0xc56a('0x10c')]()['then'](function(_0x1c9868){for(var _0xf143dd=0x0;_0xf143dd<_0x1c9868[_0xc56a('0x7d')];_0xf143dd++){_0x1c9868[_0xf143dd][_0xc56a('0x104')](_0xc56a('0x9f'),'Fax');}return _0x1c9868;}));_0x2beabf[_0xc56a('0xe6')](_0x4564e9[_0xc56a('0x10d')]()[_0xc56a('0x23')](function(_0x3fd7e6){for(var _0x49e696=0x0;_0x49e696<_0x3fd7e6['length'];_0x49e696++){_0x3fd7e6[_0x49e696][_0xc56a('0x104')]('channel',_0xc56a('0x10e'));}return _0x3fd7e6;}));return BPromise[_0xc56a('0xe8')](_0x2beabf);})[_0xc56a('0x23')](function(_0x4eece9){var _0x14a7db=_[_0xc56a('0x10f')](_0x4eece9);_0x2beabf=[];return db['sequelize'][_0xc56a('0x110')](function(_0x1e4a00){for(var _0x5d7522=0x0;_0x5d7522<_0x14a7db[_0xc56a('0x7d')];_0x5d7522++){_0x2beabf[_0xc56a('0xe6')](_0x14a7db[_0x5d7522][_0xc56a('0x111')](_0x2bebfb['id']),{'transaction':_0x1e4a00});}return BPromise[_0xc56a('0xe8')](_0x2beabf)[_0xc56a('0x23')](function(){if(_0x2bebfb['online']){return BPromise['each'](_['filter'](_0x14a7db,function(_0x30c994){return _0x30c994[_0xc56a('0x112')](_0xc56a('0x9f'))===_0xc56a('0x105');}),function(_0x3eb217){return db['UserVoiceQueueRt'][_0xc56a('0xaf')]({'membername':_0x2bebfb[_0xc56a('0x44')],'UserId':_0x2bebfb['id'],'queue_name':_0x3eb217[_0xc56a('0x44')],'VoiceQueueId':_0x3eb217['id'],'interface':_[_0xc56a('0x75')](_0x2bebfb['interface'])?util[_0xc56a('0x77')](_0xc56a('0xac'),_0x2bebfb[_0xc56a('0x44')]):_0x2bebfb[_0xc56a('0xa2')],'paused':_0x2bebfb[_0xc56a('0xa1')]||![],'penalty':_0x2bebfb[_0xc56a('0xa7')]},{'transaction':_0x1e4a00});});}else{return;}})['then'](function(){for(var _0x3c9994=0x0;_0x3c9994<_0x14a7db[_0xc56a('0x7d')];_0x3c9994++){var _0x23d43f=_0x14a7db[_0x3c9994][_0xc56a('0x112')](_0xc56a('0x9f'));var _0x52b9c8=_0x23d43f+_0xc56a('0xb2');socket['emit'](_0xc56a('0x3b')+_0x23d43f+'Queue:save',{'UserId':_0x2bebfb['id'],['queueField']:_0x14a7db[_0x3c9994]['id']});}});});});}});}})['then'](respondWithStatusCode(_0x287960,null))[_0xc56a('0x66')](handleError(_0x287960,null));};exports['removeTeams']=function(_0x6beecf,_0x12801f){return db[_0xc56a('0x49')][_0xc56a('0x96')]({'where':{'id':_0x6beecf[_0xc56a('0x68')]['id']}})[_0xc56a('0x23')](handleEntityNotFound(_0x12801f,null))[_0xc56a('0x23')](function(_0x4921ab){if(_0x4921ab){var _0x1458ef=_0x4921ab['get']({'plain':!![]});var _0x10952e=_0x6beecf[_0xc56a('0x51')]['ids'];return _0x4921ab['removeTeams'](_0x10952e)[_0xc56a('0x23')](function(){for(var _0x707e31=0x0;_0x707e31<_0x10952e[_0xc56a('0x7d')];_0x707e31++){var _0x3d68a0=[];db[_0xc56a('0x102')][_0xc56a('0x96')]({'where':{'id':_0x10952e[_0x707e31]}})[_0xc56a('0x23')](function(_0x5509e5){_0x3d68a0[_0xc56a('0xe6')](_0x5509e5[_0xc56a('0xe2')]()[_0xc56a('0x23')](function(_0x1edd04){for(var _0x28e43a=0x0;_0x28e43a<_0x1edd04[_0xc56a('0x7d')];_0x28e43a++){_0x1edd04[_0x28e43a]['setDataValue'](_0xc56a('0x9f'),_0xc56a('0x105'));}return _0x1edd04;}));_0x3d68a0[_0xc56a('0xe6')](_0x5509e5[_0xc56a('0x113')]()[_0xc56a('0x23')](function(_0x46cd35){for(var _0xedb96=0x0;_0xedb96<_0x46cd35[_0xc56a('0x7d')];_0xedb96++){_0x46cd35[_0xedb96]['setDataValue']('channel','Chat');}return _0x46cd35;}));_0x3d68a0[_0xc56a('0xe6')](_0x5509e5[_0xc56a('0x107')]()[_0xc56a('0x23')](function(_0x4c95ea){for(var _0x3aa834=0x0;_0x3aa834<_0x4c95ea['length'];_0x3aa834++){_0x4c95ea[_0x3aa834][_0xc56a('0x104')](_0xc56a('0x9f'),_0xc56a('0x108'));}return _0x4c95ea;}));_0x3d68a0['push'](_0x5509e5[_0xc56a('0x109')]()[_0xc56a('0x23')](function(_0x17dec7){for(var _0x197607=0x0;_0x197607<_0x17dec7[_0xc56a('0x7d')];_0x197607++){_0x17dec7[_0x197607][_0xc56a('0x104')](_0xc56a('0x9f'),'Sms');}return _0x17dec7;}));_0x3d68a0['push'](_0x5509e5[_0xc56a('0x10a')]()[_0xc56a('0x23')](function(_0x114183){for(var _0x1b3fc5=0x0;_0x1b3fc5<_0x114183[_0xc56a('0x7d')];_0x1b3fc5++){_0x114183[_0x1b3fc5]['setDataValue']('channel',_0xc56a('0x10b'));}return _0x114183;}));_0x3d68a0[_0xc56a('0xe6')](_0x5509e5[_0xc56a('0x10c')]()[_0xc56a('0x23')](function(_0x211e93){for(var _0x510033=0x0;_0x510033<_0x211e93[_0xc56a('0x7d')];_0x510033++){_0x211e93[_0x510033]['setDataValue'](_0xc56a('0x9f'),_0xc56a('0x114'));}return _0x211e93;}));_0x3d68a0[_0xc56a('0xe6')](_0x5509e5[_0xc56a('0x10d')]()['then'](function(_0x49c945){for(var _0x40f30a=0x0;_0x40f30a<_0x49c945[_0xc56a('0x7d')];_0x40f30a++){_0x49c945[_0x40f30a][_0xc56a('0x104')](_0xc56a('0x9f'),_0xc56a('0x10e'));}return _0x49c945;}));return BPromise[_0xc56a('0xe8')](_0x3d68a0);})[_0xc56a('0x23')](function(_0x4532b0){var _0x37b273=_[_0xc56a('0x10f')](_0x4532b0);_0x3d68a0=[];return db[_0xc56a('0x60')][_0xc56a('0x110')](function(_0x41961c){for(var _0x26ce0e=0x0;_0x26ce0e<_0x37b273[_0xc56a('0x7d')];_0x26ce0e++){_0x3d68a0[_0xc56a('0xe6')](_0x37b273[_0x26ce0e][_0xc56a('0x115')](_0x1458ef['id']),{'transaction':_0x41961c});}return BPromise['all'](_0x3d68a0)[_0xc56a('0x23')](function(){if(_0x1458ef[_0xc56a('0xa0')]){return BPromise[_0xc56a('0xad')](_[_0xc56a('0x5d')](_0x37b273,function(_0x40e9d7){return _0x40e9d7[_0xc56a('0x112')]('channel')==='Voice';}),function(_0x18cc24){return db['UserVoiceQueueRt'][_0xc56a('0x38')]({'where':{'VoiceQueueId':_0x18cc24['id'],'UserId':_0x1458ef['id']},'transaction':_0x41961c});});}else{return;}})[_0xc56a('0x23')](function(){for(var _0x158d79=0x0;_0x158d79<_0x37b273[_0xc56a('0x7d')];_0x158d79++){var _0x402f84=_0x37b273[_0x158d79][_0xc56a('0x112')](_0xc56a('0x9f'));var _0x45beb5=_0x402f84+'QueueId';socket[_0xc56a('0xa9')](_0xc56a('0x3b')+_0x402f84+_0xc56a('0x116'),{'UserId':_0x1458ef['id'],['queueField']:_0x37b273[_0x158d79]['id']});}});});});}});}})[_0xc56a('0x23')](respondWithStatusCode(_0x12801f,null))[_0xc56a('0x66')](handleError(_0x12801f,null));};exports[_0xc56a('0x117')]=function(_0x14f0a8,_0x51837d,_0x3f344a){var _0x4e613d={};var _0x1e7ee4={};var _0x4242e5;var _0x281dc8;return db[_0xc56a('0x49')][_0xc56a('0x96')]({'where':{'id':_0x14f0a8[_0xc56a('0x68')]['id']}})[_0xc56a('0x23')](handleEntityNotFound(_0x51837d,null))['then'](function(_0x5620c1){if(_0x5620c1){_0x4242e5=_0x5620c1;_0x1e7ee4[_0xc56a('0x4d')]=_['keys'](db[_0xc56a('0xc0')][_0xc56a('0x69')]);_0x1e7ee4[_0xc56a('0x51')]=_[_0xc56a('0x52')](_0x14f0a8[_0xc56a('0x51')]);_0x1e7ee4[_0xc56a('0x53')]=_[_0xc56a('0x54')](_0x1e7ee4[_0xc56a('0x4d')],_0x1e7ee4[_0xc56a('0x51')]);_0x4e613d['attributes']=_[_0xc56a('0x54')](_0x1e7ee4[_0xc56a('0x4d')],qs['fields'](_0x14f0a8[_0xc56a('0x51')][_0xc56a('0x55')]));_0x4e613d['attributes']=_0x4e613d['attributes'][_0xc56a('0x7d')]?_0x4e613d[_0xc56a('0x56')]:_0x1e7ee4[_0xc56a('0x4d')];_0x4e613d[_0xc56a('0x59')]=qs[_0xc56a('0x5a')](_0x14f0a8[_0xc56a('0x51')]['sort']);_0x4e613d['where']=qs['filters'](_['pick'](_0x14f0a8[_0xc56a('0x51')],_0x1e7ee4[_0xc56a('0x53')]));if(_0x14f0a8['query']['filter']){_0x4e613d[_0xc56a('0x5b')]=_['merge'](_0x4e613d[_0xc56a('0x5b')],{'$or':_[_0xc56a('0x3f')](_0x4e613d[_0xc56a('0x56')],function(_0x90829f){var _0x370a3b={};_0x370a3b[_0x90829f]={'$like':'%'+_0x14f0a8['query'][_0xc56a('0x5d')]+'%'};return _0x370a3b;})});}_0x4e613d=_['merge']({},_0x4e613d,_0x14f0a8[_0xc56a('0x62')]);return _0x4242e5[_0xc56a('0x117')](_0x4e613d);}})['then'](function(_0x23cb06){if(_0x23cb06){_0x281dc8=_0x23cb06[_0xc56a('0x7d')];if(!_0x14f0a8['query'][_0xc56a('0x57')](_0xc56a('0x58'))){_0x4e613d[_0xc56a('0x32')]=qs[_0xc56a('0x32')](_0x14f0a8[_0xc56a('0x51')]['limit']);_0x4e613d[_0xc56a('0x31')]=qs[_0xc56a('0x31')](_0x14f0a8[_0xc56a('0x51')][_0xc56a('0x31')]);}return _0x4242e5[_0xc56a('0x117')](_0x4e613d);}})[_0xc56a('0x23')](function(_0x395c52){if(_0x395c52){return _0x395c52?{'count':_0x281dc8,'rows':_0x395c52}:null;}})[_0xc56a('0x23')](respondWithResult(_0x51837d,null))[_0xc56a('0x66')](handleError(_0x51837d,null));};exports[_0xc56a('0x118')]=function(_0x182c80,_0x45ba96,_0x55d8c4){var _0x4988b5={};var _0x4fefc9={};var _0x778de0;var _0x35158a;return db[_0xc56a('0x49')][_0xc56a('0x96')]({'where':{'id':_0x182c80['params']['id']}})[_0xc56a('0x23')](handleEntityNotFound(_0x45ba96,null))[_0xc56a('0x23')](function(_0x423b53){if(_0x423b53){_0x778de0=_0x423b53;_0x4fefc9[_0xc56a('0x4d')]=_[_0xc56a('0x52')](db['User'][_0xc56a('0x69')]);_0x4fefc9[_0xc56a('0x51')]=_['keys'](_0x182c80['query']);_0x4fefc9[_0xc56a('0x53')]=_[_0xc56a('0x54')](_0x4fefc9[_0xc56a('0x4d')],_0x4fefc9[_0xc56a('0x51')]);_0x4988b5['attributes']=_['intersection'](_0x4fefc9[_0xc56a('0x4d')],qs[_0xc56a('0x55')](_0x182c80['query'][_0xc56a('0x55')]));_0x4988b5[_0xc56a('0x56')]=_0x4988b5[_0xc56a('0x56')][_0xc56a('0x7d')]?_0x4988b5[_0xc56a('0x56')]:_0x4fefc9[_0xc56a('0x4d')];_0x4988b5[_0xc56a('0x59')]=qs[_0xc56a('0x5a')](_0x182c80[_0xc56a('0x51')]['sort']);_0x4988b5[_0xc56a('0x5b')]=qs[_0xc56a('0x53')](_[_0xc56a('0x5c')](_0x182c80[_0xc56a('0x51')],_0x4fefc9[_0xc56a('0x53')]));if(_0x182c80[_0xc56a('0x51')][_0xc56a('0x5d')]){_0x4988b5[_0xc56a('0x5b')]=_[_0xc56a('0x5e')](_0x4988b5[_0xc56a('0x5b')],{'$or':_['map'](_0x4988b5['attributes'],function(_0x256f62){var _0x538b8d={};_0x538b8d[_0x256f62]={'$like':'%'+_0x182c80['query']['filter']+'%'};return _0x538b8d;})});}_0x4988b5[_0xc56a('0x4d')]=db[_0xc56a('0x49')];_0x4988b5['as']='Agents';_0x4988b5=_[_0xc56a('0x5e')]({},_0x4988b5,_0x182c80[_0xc56a('0x62')]);return _0x778de0[_0xc56a('0xe2')]({'include':[_0x4988b5]});}})['then'](function(_0x1332d0){if(_0x1332d0){var _0x300ddd={},_0x6fb2bc=[],_0x2be3b0=0x0;for(var _0x23ab87=0x0;_0x23ab87<_0x1332d0[_0xc56a('0x7d')];_0x23ab87+=0x1){for(var _0x33a214=0x0,_0x5101cb;_0x33a214<_0x1332d0[_0x23ab87]['Agents']['length'];_0x33a214+=0x1){_0x5101cb=_0x1332d0[_0x23ab87][_0xc56a('0x3c')][_0x33a214]['get']({'plain':!![]});_0x300ddd[_0x5101cb['id']]=_0x5101cb;}}_0x300ddd=_[_0xc56a('0x119')](_0x300ddd);for(var _0x12764a=qs[_0xc56a('0x31')](_0x182c80[_0xc56a('0x51')][_0xc56a('0x31')]);_0x12764a<_0x300ddd[_0xc56a('0x7d')]&&_0x6fb2bc[_0xc56a('0x7d')]=_0xbc57be[_0xd381('0x54')]){throw new Error(_0xd381('0x55'));}})[_0xd381('0xf')](function(){if(_0x3217d4){return db['UserVoiceQueueRt'][_0xd381('0x4a')]({'where':{'membername':_0x3217d4['name']},'individualHooks':!![]});}})[_0xd381('0xf')](function(){if(_0x3217d4){return _0x3217d4[_0xd381('0x56')]({'raw':!![]});}})[_0xd381('0xf')](function(_0x5f02bb){if(_0x3217d4){if(_0x5f02bb){var _0x474a6f=[];_0xe4c79a=_0x5f02bb;if(_0xe4c79a[_0xd381('0x30')]){for(var _0x46e11b=0x0;_0x46e11b<_0xe4c79a['length'];_0x46e11b++){_0x474a6f[_0xd381('0x34')](db[_0xd381('0x2c')]['upsert']({'membername':_0x3217d4[_0xd381('0x28')],'UserId':_0x3217d4['id'],'queue_name':_0xe4c79a[_0x46e11b][_0xd381('0x28')],'VoiceQueueId':_0xe4c79a[_0x46e11b]['id'],'interface':_0x14d04d,'paused':_0x3217d4['loginInPause']||![],'penalty':_0xe4c79a[_0x46e11b]['UserVoiceQueue.penalty']||0x0}));}return BPromise[_0xd381('0x4c')](_0x474a6f);}}}})[_0xd381('0xf')](function(){if(_0x3217d4){return db[_0xd381('0x2e')]['findAll']({'where':{'membername':_0x3217d4[_0xd381('0x28')],'exitAt':null}});}})['then'](function(_0x45b266){if(_0x3217d4){if(_0x45b266&&_0x45b266[_0xd381('0x30')]){var _0x2554d0=[];_0x45b266[_0xd381('0x33')](function(_0x1a31ff){_0x2554d0[_0xd381('0x34')](_0x1a31ff[_0xd381('0x2d')]({'exitAt':moment()[_0xd381('0x36')](_0xd381('0x37'))}));});return BPromise[_0xd381('0x4c')](_0x2554d0);}}})[_0xd381('0xf')](function(_0x304a2b){if(_0x3217d4){var _0x4e2c5e=[];var _0x52a7ad=[];var _0x6248ca=utils['getChannels']();var _0x4f3ba4={'membername':_0x3217d4[_0xd381('0x28')],'interface':_0x14d04d,'enterAt':moment()[_0xd381('0x36')](_0xd381('0x37')),'role':_0x3217d4[_0xd381('0x29')],'internal':_0x3217d4[_0xd381('0x2a')]};_0x6248ca[_0xd381('0x33')](function(_0xc314e3){_0x4e2c5e[_0xd381('0x34')](_[_0xd381('0x57')]({'channel':_0xc314e3,'type':'LOGIN','data1':_0xd381('0x58'),'data2':_0x14d04d},_0x4f3ba4));if(_0x3217d4['loginInPause']){_0x52a7ad[_0xd381('0x34')](_[_0xd381('0x57')]({'channel':_0xc314e3,'type':_0xd381('0x2f'),'data1':_0xd381('0x59')},_0x4f3ba4));}});return db[_0xd381('0x2e')]['bulkCreate'](_0x4e2c5e['concat'](_0x52a7ad),{'individualHooks':!![]});}})['then'](function(){if(_0x3217d4){return _0x3217d4['update']({'online':!![],'lastLoginAt':moment()[_0xd381('0x36')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x3217d4[_0xd381('0x50')]||![],'mailPause':_0x3217d4[_0xd381('0x50')]||![],'chatPause':_0x3217d4[_0xd381('0x50')]||![],'faxPause':_0x3217d4['loginInPause']||![],'smsPause':_0x3217d4[_0xd381('0x50')]||![],'openchannelPause':_0x3217d4['loginInPause']||![],'pauseType':_0x3217d4['loginInPause']?_0xd381('0x59'):null,'lastPauseAt':moment()[_0xd381('0x36')](_0xd381('0x37')),'interface':_0x14d04d});}})[_0xd381('0xf')](function(_0x54f2fb){_0x263348(_0x54f2fb);})['catch'](function(_0x21e8a8){_0xc87d(_0x5dec74[_0xd381('0x15')](0x1f4,_0x21e8a8[_0xd381('0x17')]));});});}; \ No newline at end of file +var _0x2a36=['forEach','push','isNil','SIP/%s','PAUSE','body','DEFAULT\x20PAUSE','bulkCreate','UnpauseUser','findOne','channel','isValidChannel','Unknown\x20channel','voice','mail','chat','fax','sms','openchannel','system','%s%s','Pause','destroy','all','mobile','phone','loginInPause','count','agent','../../config/license/util','agents','Maximum\x20login\x20has\x20been\x20reached','getVoiceQueues','upsert','UserVoiceQueue.penalty','merge','LOGIN','callysquare','LOGININPAUSE','concat','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter','register','request','then','info','User,\x20%s,\x20%s','User,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetUser','User','findAll','raw','options','where','include','map','model','attributes','ShowUser','find','debug','PauseUser','name','role','internal','interface','UserVoiceQueueRt','update','MemberReport','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2a36,0x1a0));var _0x62a3=function(_0x596593,_0x344b42){_0x596593=_0x596593-0x0;var _0xcc9aa6=_0x2a36[_0x596593];return _0xcc9aa6;};'use strict';var _=require(_0x62a3('0x0'));var util=require(_0x62a3('0x1'));var moment=require(_0x62a3('0x2'));var BPromise=require(_0x62a3('0x3'));var rs=require(_0x62a3('0x4'));var fs=require('fs');var Redis=require(_0x62a3('0x5'));var db=require(_0x62a3('0x6'))['db'];var utils=require(_0x62a3('0x7'));var logger=require(_0x62a3('0x8'))(_0x62a3('0x9'));var config=require('../../config/environment');var jayson=require(_0x62a3('0xa'));var client=jayson[_0x62a3('0xb')][_0x62a3('0xc')]({'port':0x232a});config[_0x62a3('0xd')]=_[_0x62a3('0xe')](config[_0x62a3('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x62a3('0xf'))(new Redis(config[_0x62a3('0xd')]));require('./user.socket')[_0x62a3('0x10')](socket);function respondWithRpcPromise(_0x246056,_0xad2b2c,_0x2262b1){return new BPromise(function(_0x61293e,_0x2bbdb7){return client[_0x62a3('0x11')](_0x246056,_0x2262b1)[_0x62a3('0x12')](function(_0x370be7){logger[_0x62a3('0x13')](_0x62a3('0x14'),_0xad2b2c,'request\x20sent');logger['debug'](_0x62a3('0x15'),_0xad2b2c,_0x62a3('0x16'),JSON[_0x62a3('0x17')](_0x370be7));if(_0x370be7[_0x62a3('0x18')]){if(_0x370be7[_0x62a3('0x18')][_0x62a3('0x19')]===0x1f4){logger[_0x62a3('0x18')](_0x62a3('0x14'),_0xad2b2c,_0x370be7['error']['message']);return _0x2bbdb7(_0x370be7[_0x62a3('0x18')][_0x62a3('0x1a')]);}logger[_0x62a3('0x18')]('User,\x20%s,\x20%s',_0xad2b2c,_0x370be7[_0x62a3('0x18')]['message']);return _0x61293e(_0x370be7[_0x62a3('0x18')]['message']);}else{logger[_0x62a3('0x13')](_0x62a3('0x14'),_0xad2b2c,_0x62a3('0x16'));_0x61293e(_0x370be7[_0x62a3('0x1b')][_0x62a3('0x1a')]);}})[_0x62a3('0x1c')](function(_0x2c415f){logger[_0x62a3('0x18')](_0x62a3('0x14'),_0xad2b2c,_0x2c415f);_0x2bbdb7(_0x2c415f);});});}exports[_0x62a3('0x1d')]=function(_0x129da7){var _0x41d1aa=this;return new Promise(function(_0x55a49e,_0x464cee){return db[_0x62a3('0x1e')][_0x62a3('0x1f')]({'raw':_0x129da7['options']?_0x129da7['options'][_0x62a3('0x20')]===undefined?!![]:![]:!![],'where':_0x129da7[_0x62a3('0x21')]?_0x129da7[_0x62a3('0x21')][_0x62a3('0x22')]||null:null,'attributes':_0x129da7[_0x62a3('0x21')]?_0x129da7[_0x62a3('0x21')]['attributes']||null:null,'limit':_0x129da7['options']?_0x129da7[_0x62a3('0x21')]['limit']||null:null,'include':_0x129da7['options']?_0x129da7['options'][_0x62a3('0x23')]?_[_0x62a3('0x24')](_0x129da7[_0x62a3('0x21')]['include'],function(_0x41f89f){return{'model':db[_0x41f89f[_0x62a3('0x25')]],'as':_0x41f89f['as'],'attributes':_0x41f89f[_0x62a3('0x26')],'include':_0x41f89f[_0x62a3('0x23')]?_[_0x62a3('0x24')](_0x41f89f[_0x62a3('0x23')],function(_0x27df15){return{'model':db[_0x27df15['model']],'as':_0x27df15['as'],'attributes':_0x27df15['attributes'],'include':_0x27df15['include']?_[_0x62a3('0x24')](_0x27df15[_0x62a3('0x23')],function(_0x29e500){return{'model':db[_0x29e500['model']],'as':_0x29e500['as'],'attributes':_0x29e500[_0x62a3('0x26')]};}):[]};}):[]};}):[]:[]})[_0x62a3('0x12')](function(_0x331054){logger[_0x62a3('0x13')]('GetUser',_0x129da7);logger['debug'](_0x62a3('0x1d'),_0x129da7,JSON[_0x62a3('0x17')](_0x331054));_0x55a49e(_0x331054);})[_0x62a3('0x1c')](function(_0x1ad04b){logger[_0x62a3('0x18')](_0x62a3('0x1d'),_0x1ad04b['message'],_0x129da7);_0x464cee(_0x41d1aa[_0x62a3('0x18')](0x1f4,_0x1ad04b[_0x62a3('0x1a')]));});});};exports[_0x62a3('0x27')]=function(_0x9dd51e){var _0x17cac=this;return new Promise(function(_0x4a525a,_0x52d884){return db[_0x62a3('0x1e')][_0x62a3('0x28')]({'raw':_0x9dd51e[_0x62a3('0x21')]?_0x9dd51e[_0x62a3('0x21')][_0x62a3('0x20')]===undefined?!![]:![]:!![],'where':_0x9dd51e[_0x62a3('0x21')]?_0x9dd51e[_0x62a3('0x21')][_0x62a3('0x22')]||null:null,'attributes':_0x9dd51e['options']?_0x9dd51e[_0x62a3('0x21')]['attributes']||null:null,'include':_0x9dd51e[_0x62a3('0x21')]?_0x9dd51e[_0x62a3('0x21')][_0x62a3('0x23')]?_[_0x62a3('0x24')](_0x9dd51e[_0x62a3('0x21')]['include'],function(_0x38ab1e){return{'model':db[_0x38ab1e['model']],'as':_0x38ab1e['as'],'attributes':_0x38ab1e[_0x62a3('0x26')],'include':_0x38ab1e[_0x62a3('0x23')]?_['map'](_0x38ab1e[_0x62a3('0x23')],function(_0x2f5b40){return{'model':db[_0x2f5b40['model']],'as':_0x2f5b40['as'],'attributes':_0x2f5b40[_0x62a3('0x26')],'include':_0x2f5b40['include']?_['map'](_0x2f5b40[_0x62a3('0x23')],function(_0x132b21){return{'model':db[_0x132b21[_0x62a3('0x25')]],'as':_0x132b21['as'],'attributes':_0x132b21[_0x62a3('0x26')]};}):[]};}):[]};}):[]:[]})[_0x62a3('0x12')](function(_0x2162b4){logger[_0x62a3('0x13')]('ShowUser',_0x9dd51e);logger[_0x62a3('0x29')]('ShowUser',_0x9dd51e,JSON[_0x62a3('0x17')](_0x2162b4));_0x4a525a(_0x2162b4);})[_0x62a3('0x1c')](function(_0x399c7a){logger[_0x62a3('0x18')](_0x62a3('0x27'),_0x399c7a[_0x62a3('0x1a')],_0x9dd51e);_0x52d884(_0x17cac[_0x62a3('0x18')](0x1f4,_0x399c7a[_0x62a3('0x1a')]));});});};exports[_0x62a3('0x2a')]=function(_0x5d08b3){var _0x1ed2e0=this;return new Promise(function(_0x1a9f57,_0x1e4b08){var _0x50f3e7;return db[_0x62a3('0x1e')]['find']({'where':_0x5d08b3[_0x62a3('0x21')][_0x62a3('0x22')]||{},'attributes':['id',_0x62a3('0x2b'),_0x62a3('0x2c'),_0x62a3('0x2d'),_0x62a3('0x2e')]})[_0x62a3('0x12')](function(_0x54972a){if(_0x54972a){_0x50f3e7=_0x54972a;return db[_0x62a3('0x2f')][_0x62a3('0x30')]({'paused':0x1},{'where':{'UserId':_0x50f3e7['id']},'individualHooks':!![]});}})['then'](function(){if(_0x50f3e7){return db[_0x62a3('0x31')][_0x62a3('0x1f')]({'where':{'membername':_0x50f3e7['name'],'type':'PAUSE','exitAt':null}});}})[_0x62a3('0x12')](function(_0x33e1f0){if(_0x50f3e7){if(_0x33e1f0&&_0x33e1f0[_0x62a3('0x32')]){var _0x4c8a0d=moment()[_0x62a3('0x33')](_0x62a3('0x34'));for(var _0x4cd57f=0x0,_0x377b7e=_0x33e1f0[_0x62a3('0x32')];_0x4cd57f<_0x377b7e;_0x4cd57f++){_0x33e1f0[_0x4cd57f][_0x62a3('0x35')]({'exitAt':_0x4c8a0d});}}}})['then'](function(){if(_0x50f3e7){var _0x314682=[];var _0x1bc63c=utils['getChannels']();_0x1bc63c[_0x62a3('0x36')](function(_0xa86964){_0x314682[_0x62a3('0x37')]({'channel':_0xa86964,'membername':_0x50f3e7[_0x62a3('0x2b')],'interface':_[_0x62a3('0x38')](_0x50f3e7[_0x62a3('0x2e')])?util['format'](_0x62a3('0x39'),_0x50f3e7['name']):_0x50f3e7['interface'],'type':_0x62a3('0x3a'),'enterAt':moment()['format'](_0x62a3('0x34')),'data1':_0x5d08b3[_0x62a3('0x3b')]['type']||_0x62a3('0x3c'),'role':_0x50f3e7[_0x62a3('0x2c')],'internal':_0x50f3e7[_0x62a3('0x2d')],'uniqueid':_0x5d08b3['body']['uniqueid']||null});});return db[_0x62a3('0x31')][_0x62a3('0x3d')](_0x314682,{'individualHooks':!![]});}})[_0x62a3('0x12')](function(){if(_0x50f3e7){return _0x50f3e7[_0x62a3('0x30')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'pauseType':_0x5d08b3[_0x62a3('0x3b')]['type']||_0x62a3('0x3c'),'lastPauseAt':moment()[_0x62a3('0x33')]('YYYY-MM-DD\x20HH:mm:ss')});}})['then'](function(_0x7830d1){_0x1a9f57(_0x7830d1);})[_0x62a3('0x1c')](function(_0x233cb3){_0x1e4b08(_0x1ed2e0['error'](0x1f4,_0x233cb3[_0x62a3('0x1a')]));});});};exports[_0x62a3('0x3e')]=function(_0x1389c6){var _0x467aa0=this;return new Promise(function(_0x392c30,_0x21a213){var _0x3452f1;return db[_0x62a3('0x1e')][_0x62a3('0x3f')]({'where':_0x1389c6['options'][_0x62a3('0x22')]||{},'attributes':['id',_0x62a3('0x2b')]})[_0x62a3('0x12')](function(_0x4a8e0e){if(_0x4a8e0e){_0x3452f1=_0x4a8e0e;if(_0x1389c6[_0x62a3('0x3b')][_0x62a3('0x40')]&&!utils[_0x62a3('0x41')](_0x1389c6['body'][_0x62a3('0x40')])){throw new Error(_0x62a3('0x42'));}switch(_0x1389c6[_0x62a3('0x3b')][_0x62a3('0x40')]){case _0x62a3('0x43'):return db[_0x62a3('0x2f')][_0x62a3('0x30')]({'paused':0x0},{'where':{'UserId':_0x3452f1['id']}})[_0x62a3('0x12')](function(){return db[_0x62a3('0x31')][_0x62a3('0x28')]({'where':{'channel':_0x1389c6['body'][_0x62a3('0x40')],'membername':_0x3452f1['name'],'type':_0x62a3('0x3a'),'exitAt':null}});})[_0x62a3('0x12')](function(_0x1462e3){if(_0x1462e3){return _0x1462e3[_0x62a3('0x30')]({'exitAt':moment()[_0x62a3('0x33')](_0x62a3('0x34')),'data2':'system'},{'individualHooks':!![]});}return null;})[_0x62a3('0x12')](function(){return _0x3452f1[_0x62a3('0x30')]({'voicePause':![]});});case _0x62a3('0x44'):case _0x62a3('0x45'):case _0x62a3('0x46'):case _0x62a3('0x47'):case _0x62a3('0x48'):return db['MemberReport'][_0x62a3('0x28')]({'where':{'channel':_0x1389c6[_0x62a3('0x3b')][_0x62a3('0x40')],'membername':_0x3452f1[_0x62a3('0x2b')],'type':_0x62a3('0x3a'),'exitAt':null}})[_0x62a3('0x12')](function(_0x2ad0d8){return _0x2ad0d8[_0x62a3('0x30')]({'exitAt':moment()['format'](_0x62a3('0x34')),'data2':_0x62a3('0x49')},{'individualHooks':!![]});})[_0x62a3('0x12')](function(){var _0x494d2b={};_['set'](_0x494d2b,util[_0x62a3('0x33')](_0x62a3('0x4a'),_0x1389c6[_0x62a3('0x3b')][_0x62a3('0x40')],_0x62a3('0x4b')),![]);return _0x3452f1[_0x62a3('0x30')](_0x494d2b);});default:return db[_0x62a3('0x2f')][_0x62a3('0x30')]({'paused':0x0},{'where':{'UserId':_0x3452f1['id']}})[_0x62a3('0x12')](function(){return db['MemberReport'][_0x62a3('0x1f')]({'where':{'membername':_0x3452f1['name'],'type':_0x62a3('0x3a'),'exitAt':null}});})['then'](function(_0xc478e1){var _0x3ed3bf=[];_0xc478e1[_0x62a3('0x36')](function(_0x24ecff){_0x3ed3bf['push'](_0x24ecff[_0x62a3('0x30')]({'exitAt':moment()[_0x62a3('0x33')](_0x62a3('0x34')),'data2':_0x62a3('0x49')}));});return BPromise['all'](_0x3ed3bf);})['then'](function(){return _0x3452f1[_0x62a3('0x30')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});});}}})[_0x62a3('0x12')](function(_0x27c17f){_0x392c30(_0x27c17f);})[_0x62a3('0x1c')](function(_0x1d2d40){_0x21a213(_0x467aa0[_0x62a3('0x18')](0x1f4,_0x1d2d40[_0x62a3('0x1a')]));});});};exports['LogoutUser']=function(_0x3061c3){var _0x572766=this;return new Promise(function(_0x45d79e,_0x5ac217){var _0x10479c;return db[_0x62a3('0x1e')][_0x62a3('0x3f')]({'where':_0x3061c3[_0x62a3('0x21')][_0x62a3('0x22')]||{},'attributes':['id',_0x62a3('0x2b')]})[_0x62a3('0x12')](function(_0x3f64d7){if(_0x3f64d7){_0x10479c=_0x3f64d7;return db[_0x62a3('0x2f')][_0x62a3('0x4c')]({'where':{'membername':_0x10479c['name']},'individualHooks':!![]});}})[_0x62a3('0x12')](function(){if(_0x10479c){return db[_0x62a3('0x31')][_0x62a3('0x1f')]({'where':{'membername':_0x10479c[_0x62a3('0x2b')],'exitAt':null}});}})[_0x62a3('0x12')](function(_0x17c96d){if(_0x10479c){if(_0x17c96d&&_0x17c96d['length']){var _0x370530=[];_0x17c96d['forEach'](function(_0x58a92a){_0x370530['push'](_0x58a92a[_0x62a3('0x30')]({'exitAt':moment()[_0x62a3('0x33')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x62a3('0x4d')](_0x370530);}}})[_0x62a3('0x12')](function(){if(_0x10479c){return _0x10479c[_0x62a3('0x30')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0x62a3('0x12')](function(_0x3d5f2e){_0x45d79e(_0x3d5f2e);})['catch'](function(_0x2a73c7){_0x5ac217(_0x572766['error'](0x1f4,_0x2a73c7['message']));});});};exports['LoginUser']=function(_0x83bb9e){var _0x36f3a6=this;return new Promise(function(_0xb7125c,_0x535871){var _0x515e52;var _0x38c595;var _0x18849f;var _0x11499f;return db[_0x62a3('0x1e')][_0x62a3('0x3f')]({'where':_0x83bb9e[_0x62a3('0x21')][_0x62a3('0x22')]||{},'attributes':['id',_0x62a3('0x2b'),_0x62a3('0x2c'),_0x62a3('0x4e'),_0x62a3('0x4f'),_0x62a3('0x2d'),_0x62a3('0x50'),_0x62a3('0x2e')]})[_0x62a3('0x12')](function(_0x2f0fe1){if(_0x2f0fe1){_0x515e52=_0x2f0fe1;_0x11499f=_0x83bb9e[_0x62a3('0x3b')]['interface']?_0x83bb9e['body']['interface']:util[_0x62a3('0x33')](_0x62a3('0x39'),_0x515e52[_0x62a3('0x2b')]);return db[_0x62a3('0x1e')][_0x62a3('0x51')]({'where':{'role':_0x62a3('0x52'),'online':!![],'id':{'$ne':_0x515e52['id']}}});}})[_0x62a3('0x12')](function(_0x4d0dba){if(_0x4d0dba){_0x18849f=_0x4d0dba;return require(_0x62a3('0x53'))['getLicense']();}})['then'](function(_0x50cfe4){if(_0x50cfe4&&_0x50cfe4['agents']&&_0x18849f>=_0x50cfe4[_0x62a3('0x54')]){throw new Error(_0x62a3('0x55'));}})[_0x62a3('0x12')](function(){if(_0x515e52){return db['UserVoiceQueueRt'][_0x62a3('0x4c')]({'where':{'membername':_0x515e52[_0x62a3('0x2b')]},'individualHooks':!![]});}})[_0x62a3('0x12')](function(){if(_0x515e52){return _0x515e52[_0x62a3('0x56')]({'raw':!![]});}})[_0x62a3('0x12')](function(_0x678c85){if(_0x515e52){if(_0x678c85){var _0x2c2cbe=[];_0x38c595=_0x678c85;if(_0x38c595[_0x62a3('0x32')]){for(var _0x1db795=0x0;_0x1db795<_0x38c595[_0x62a3('0x32')];_0x1db795++){_0x2c2cbe[_0x62a3('0x37')](db['UserVoiceQueueRt'][_0x62a3('0x57')]({'membername':_0x515e52['name'],'UserId':_0x515e52['id'],'queue_name':_0x38c595[_0x1db795][_0x62a3('0x2b')],'VoiceQueueId':_0x38c595[_0x1db795]['id'],'interface':_0x11499f,'paused':_0x515e52[_0x62a3('0x50')]||![],'penalty':_0x38c595[_0x1db795][_0x62a3('0x58')]||0x0}));}return BPromise[_0x62a3('0x4d')](_0x2c2cbe);}}}})[_0x62a3('0x12')](function(){if(_0x515e52){return db['MemberReport'][_0x62a3('0x1f')]({'where':{'membername':_0x515e52[_0x62a3('0x2b')],'exitAt':null}});}})[_0x62a3('0x12')](function(_0x226988){if(_0x515e52){if(_0x226988&&_0x226988[_0x62a3('0x32')]){var _0x45ee37=[];_0x226988[_0x62a3('0x36')](function(_0xb3741b){_0x45ee37[_0x62a3('0x37')](_0xb3741b['update']({'exitAt':moment()['format'](_0x62a3('0x34'))}));});return BPromise[_0x62a3('0x4d')](_0x45ee37);}}})['then'](function(_0x2f33a6){if(_0x515e52){var _0x325a0c=[];var _0x1002bb=[];var _0x3fdfa9=utils['getChannels']();var _0x156892={'membername':_0x515e52[_0x62a3('0x2b')],'interface':_0x11499f,'enterAt':moment()['format'](_0x62a3('0x34')),'role':_0x515e52[_0x62a3('0x2c')],'internal':_0x515e52['internal']};_0x3fdfa9[_0x62a3('0x36')](function(_0x571b6d){_0x325a0c[_0x62a3('0x37')](_[_0x62a3('0x59')]({'channel':_0x571b6d,'type':_0x62a3('0x5a'),'data1':_0x62a3('0x5b'),'data2':_0x11499f},_0x156892));if(_0x515e52[_0x62a3('0x50')]){_0x1002bb[_0x62a3('0x37')](_[_0x62a3('0x59')]({'channel':_0x571b6d,'type':'PAUSE','data1':_0x62a3('0x5c')},_0x156892));}});return db[_0x62a3('0x31')][_0x62a3('0x3d')](_0x325a0c[_0x62a3('0x5d')](_0x1002bb),{'individualHooks':!![]});}})['then'](function(){if(_0x515e52){return _0x515e52[_0x62a3('0x30')]({'online':!![],'lastLoginAt':moment()[_0x62a3('0x33')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x515e52['loginInPause']||![],'mailPause':_0x515e52['loginInPause']||![],'chatPause':_0x515e52[_0x62a3('0x50')]||![],'faxPause':_0x515e52['loginInPause']||![],'smsPause':_0x515e52[_0x62a3('0x50')]||![],'openchannelPause':_0x515e52[_0x62a3('0x50')]||![],'pauseType':_0x515e52[_0x62a3('0x50')]?_0x62a3('0x5c'):null,'lastPauseAt':moment()[_0x62a3('0x33')](_0x62a3('0x34')),'interface':_0x11499f});}})['then'](function(_0x5c9ecf){_0xb7125c(_0x5c9ecf);})[_0x62a3('0x1c')](function(_0x35114b){_0x535871(_0x36f3a6[_0x62a3('0x18')](0x1f4,_0x35114b[_0x62a3('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 17cd1aa..bf73d04 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 _0xed2f=['register','user:','./user.events','save','update'];(function(_0x53a2cb,_0x4e0b37){var _0xa7627e=function(_0x102bfe){while(--_0x102bfe){_0x53a2cb['push'](_0x53a2cb['shift']());}};_0xa7627e(++_0x4e0b37);}(_0xed2f,0x142));var _0xfed2=function(_0x44f893,_0x5a50ac){_0x44f893=_0x44f893-0x0;var _0x5e8460=_0xed2f[_0x44f893];return _0x5e8460;};'use strict';var UserEvents=require(_0xfed2('0x0'));var events=[_0xfed2('0x1'),'remove',_0xfed2('0x2')];function createListener(_0x22e5b1,_0x27949f){return function(_0x4432ff){_0x27949f['emit'](_0x22e5b1,_0x4432ff);};}function removeListener(_0x5ea170,_0x31122a){return function(){UserEvents['removeListener'](_0x5ea170,_0x31122a);};}exports[_0xfed2('0x3')]=function(_0x535a39){for(var _0x336e25=0x0,_0x10c6a0=events['length'];_0x336e25<_0x10c6a0;_0x336e25++){var _0x4e765b=events[_0x336e25];var _0x1131b1=createListener(_0xfed2('0x4')+_0x4e765b,_0x535a39);UserEvents['on'](_0x4e765b,_0x1131b1);}}; \ No newline at end of file +var _0x9746=['user:','./user.events','save','remove','update','emit','register'];(function(_0x4fc9e6,_0xc51915){var _0x551d28=function(_0x1a603b){while(--_0x1a603b){_0x4fc9e6['push'](_0x4fc9e6['shift']());}};_0x551d28(++_0xc51915);}(_0x9746,0x1cf));var _0x6974=function(_0x1992f1,_0x5c61f0){_0x1992f1=_0x1992f1-0x0;var _0x413dfe=_0x9746[_0x1992f1];return _0x413dfe;};'use strict';var UserEvents=require(_0x6974('0x0'));var events=[_0x6974('0x1'),_0x6974('0x2'),_0x6974('0x3')];function createListener(_0x310c60,_0x1019ad){return function(_0x1fa5c6){_0x1019ad[_0x6974('0x4')](_0x310c60,_0x1fa5c6);};}function removeListener(_0x4c9970,_0x19010b){return function(){UserEvents['removeListener'](_0x4c9970,_0x19010b);};}exports[_0x6974('0x5')]=function(_0x3fab16){for(var _0xe358ee=0x0,_0x567e22=events['length'];_0xe358ee<_0x567e22;_0xe358ee++){var _0x1cbcc2=events[_0xe358ee];var _0x5ef8f0=createListener(_0x6974('0x6')+_0x1cbcc2,_0x3fab16);UserEvents['on'](_0x1cbcc2,_0x5ef8f0);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 818f347..8eb3ef3 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 _0x499e=['../../components/auth/service','../../components/interaction/service','../../config/environment','exports','connect-timeout','express'];(function(_0x227542,_0x4e3554){var _0x16e8d9=function(_0x505523){while(--_0x505523){_0x227542['push'](_0x227542['shift']());}};_0x16e8d9(++_0x4e3554);}(_0x499e,0xa6));var _0xe499=function(_0x266a10,_0x327612){_0x266a10=_0x266a10-0x0;var _0x121341=_0x499e[_0x266a10];return _0x121341;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xe499('0x0'));var express=require(_0xe499('0x1'));var router=express['Router']();var auth=require(_0xe499('0x2'));var interaction=require(_0xe499('0x3'));var config=require(_0xe499('0x4'));module[_0xe499('0x5')]=router; \ No newline at end of file +var _0x7a3a=['../../components/interaction/service','../../config/environment','util','path','connect-timeout','express','../../components/auth/service'];(function(_0x23276e,_0x5c3144){var _0x40c600=function(_0x6f0b68){while(--_0x6f0b68){_0x23276e['push'](_0x23276e['shift']());}};_0x40c600(++_0x5c3144);}(_0x7a3a,0x1c2));var _0xa7a3=function(_0x57c6e6,_0xab9391){_0x57c6e6=_0x57c6e6-0x0;var _0x303727=_0x7a3a[_0x57c6e6];return _0x303727;};'use strict';var multer=require('multer');var util=require(_0xa7a3('0x0'));var path=require(_0xa7a3('0x1'));var timeout=require(_0xa7a3('0x2'));var express=require(_0xa7a3('0x3'));var router=express['Router']();var auth=require(_0xa7a3('0x4'));var interaction=require(_0xa7a3('0x5'));var config=require(_0xa7a3('0x6'));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 c5f17c5..6384ba1 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 _0xa9e0=['sequelize','exports','INTEGER'];(function(_0x22d986,_0x513513){var _0x40ec36=function(_0xedd449){while(--_0xedd449){_0x22d986['push'](_0x22d986['shift']());}};_0x40ec36(++_0x513513);}(_0xa9e0,0x123));var _0x0a9e=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xa9e0[_0x297fd3];return _0x2af381;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'penalty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe706=['INTEGER','sequelize','exports'];(function(_0x36f896,_0x1df73a){var _0x4322c3=function(_0x30de37){while(--_0x30de37){_0x36f896['push'](_0x36f896['shift']());}};_0x4322c3(++_0x1df73a);}(_0xe706,0xa3));var _0x6e70=function(_0x1f1f3b,_0x227aa9){_0x1f1f3b=_0x1f1f3b-0x0;var _0x2e63aa=_0xe706[_0x1f1f3b];return _0x2e63aa;};'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/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index ebb4558..a59f229 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 _0xdf93=['bluebird','path','rimraf','../../config/environment','./userChatQueue.attributes','exports','define','lodash','util','../../config/logger','moment'];(function(_0x21c69e,_0x48e283){var _0x102abc=function(_0x1af410){while(--_0x1af410){_0x21c69e['push'](_0x21c69e['shift']());}};_0x102abc(++_0x48e283);}(_0xdf93,0x13b));var _0x3df9=function(_0x55f41f,_0x108f13){_0x55f41f=_0x55f41f-0x0;var _0x2ccb67=_0xdf93[_0x55f41f];return _0x2ccb67;};'use strict';var _=require(_0x3df9('0x0'));var util=require(_0x3df9('0x1'));var logger=require(_0x3df9('0x2'))('api');var moment=require(_0x3df9('0x3'));var BPromise=require(_0x3df9('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3df9('0x5'));var rimraf=require(_0x3df9('0x6'));var config=require(_0x3df9('0x7'));var attributes=require(_0x3df9('0x8'));module[_0x3df9('0x9')]=function(_0x286688,_0x58632e){return _0x286688[_0x3df9('0xa')]('UserChatQueue',attributes,{'tableName':'user_has_chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6d4b=['./userChatQueue.attributes','exports','define','UserChatQueue','lodash','util','../../config/logger','moment','bluebird','rimraf','../../config/environment'];(function(_0x1de43c,_0xaa29de){var _0x296d3e=function(_0x50b76f){while(--_0x50b76f){_0x1de43c['push'](_0x1de43c['shift']());}};_0x296d3e(++_0xaa29de);}(_0x6d4b,0xbf));var _0xb6d4=function(_0x5d95e0,_0x41a477){_0x5d95e0=_0x5d95e0-0x0;var _0xed6c62=_0x6d4b[_0x5d95e0];return _0xed6c62;};'use strict';var _=require(_0xb6d4('0x0'));var util=require(_0xb6d4('0x1'));var logger=require(_0xb6d4('0x2'))('api');var moment=require(_0xb6d4('0x3'));var BPromise=require(_0xb6d4('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xb6d4('0x5'));var config=require(_0xb6d4('0x6'));var attributes=require(_0xb6d4('0x7'));module[_0xb6d4('0x8')]=function(_0x1e9c41,_0x2d2725){return _0x1e9c41[_0xb6d4('0x9')](_0xb6d4('0xa'),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 478041b..6d57b88 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 _0x310e=['../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','info','UserChatQueue,\x20%s,\x20%s','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','randomstring','ioredis'];(function(_0x1cf4ea,_0x41cf33){var _0x339bc3=function(_0x399bef){while(--_0x399bef){_0x1cf4ea['push'](_0x1cf4ea['shift']());}};_0x339bc3(++_0x41cf33);}(_0x310e,0x1c9));var _0xe310=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x310e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xe310('0x0'));var util=require(_0xe310('0x1'));var moment=require(_0xe310('0x2'));var BPromise=require('bluebird');var rs=require(_0xe310('0x3'));var fs=require('fs');var Redis=require(_0xe310('0x4'));var db=require(_0xe310('0x5'))['db'];var utils=require(_0xe310('0x6'));var logger=require(_0xe310('0x7'))(_0xe310('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe310('0x9')][_0xe310('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x599672,_0x12c6b0,_0x438b99){return new BPromise(function(_0x300c1d,_0x4ea456){return client[_0xe310('0xb')](_0x599672,_0x438b99)['then'](function(_0x56fd6a){logger[_0xe310('0xc')](_0xe310('0xd'),_0x12c6b0,'request\x20sent');logger[_0xe310('0xe')](_0xe310('0xf'),_0x12c6b0,_0xe310('0x10'),JSON[_0xe310('0x11')](_0x56fd6a));if(_0x56fd6a['error']){if(_0x56fd6a[_0xe310('0x12')]['code']===0x1f4){logger[_0xe310('0x12')](_0xe310('0xd'),_0x12c6b0,_0x56fd6a['error'][_0xe310('0x13')]);return _0x4ea456(_0x56fd6a[_0xe310('0x12')]['message']);}logger[_0xe310('0x12')](_0xe310('0xd'),_0x12c6b0,_0x56fd6a[_0xe310('0x12')][_0xe310('0x13')]);return _0x300c1d(_0x56fd6a['error'][_0xe310('0x13')]);}else{logger['info'](_0xe310('0xd'),_0x12c6b0,'request\x20sent');_0x300c1d(_0x56fd6a[_0xe310('0x14')]['message']);}})[_0xe310('0x15')](function(_0x25a6a4){logger['error'](_0xe310('0xd'),_0x12c6b0,_0x25a6a4);_0x4ea456(_0x25a6a4);});});} \ No newline at end of file +var _0x0e26=['code','message','catch','lodash','util','moment','../../mysqldb','../../config/logger','rpc','jayson/promise','client','request','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x0e26,0x81));var _0x60e2=function(_0x18fc35,_0x1eb27c){_0x18fc35=_0x18fc35-0x0;var _0x1b73a5=_0x0e26[_0x18fc35];return _0x1b73a5;};'use strict';var _=require(_0x60e2('0x0'));var util=require(_0x60e2('0x1'));var moment=require(_0x60e2('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x60e2('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x60e2('0x4'))(_0x60e2('0x5'));var config=require('../../config/environment');var jayson=require(_0x60e2('0x6'));var client=jayson[_0x60e2('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0xbc8d9b,_0x57d65a,_0x52aa11){return new BPromise(function(_0x2152a0,_0x125f81){return client[_0x60e2('0x8')](_0xbc8d9b,_0x52aa11)['then'](function(_0x1d6f74){logger[_0x60e2('0x9')](_0x60e2('0xa'),_0x57d65a,_0x60e2('0xb'));logger[_0x60e2('0xc')]('UserChatQueue,\x20%s,\x20%s,\x20%s',_0x57d65a,_0x60e2('0xb'),JSON[_0x60e2('0xd')](_0x1d6f74));if(_0x1d6f74['error']){if(_0x1d6f74[_0x60e2('0xe')][_0x60e2('0xf')]===0x1f4){logger[_0x60e2('0xe')](_0x60e2('0xa'),_0x57d65a,_0x1d6f74['error'][_0x60e2('0x10')]);return _0x125f81(_0x1d6f74[_0x60e2('0xe')][_0x60e2('0x10')]);}logger[_0x60e2('0xe')](_0x60e2('0xa'),_0x57d65a,_0x1d6f74['error'][_0x60e2('0x10')]);return _0x2152a0(_0x1d6f74['error'][_0x60e2('0x10')]);}else{logger[_0x60e2('0x9')](_0x60e2('0xa'),_0x57d65a,'request\x20sent');_0x2152a0(_0x1d6f74['result'][_0x60e2('0x10')]);}})[_0x60e2('0x11')](function(_0x515b0e){logger[_0x60e2('0xe')](_0x60e2('0xa'),_0x57d65a,_0x515b0e);_0x125f81(_0x515b0e);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 9280648..cce6356 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 _0x7052=['Router','../../components/auth/service','../../components/interaction/service','exports','multer','path','connect-timeout','express'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7052,0x114));var _0x2705=function(_0x4d79bc,_0x32c905){_0x4d79bc=_0x4d79bc-0x0;var _0x4b4760=_0x7052[_0x4d79bc];return _0x4b4760;};'use strict';var multer=require(_0x2705('0x0'));var util=require('util');var path=require(_0x2705('0x1'));var timeout=require(_0x2705('0x2'));var express=require(_0x2705('0x3'));var router=express[_0x2705('0x4')]();var auth=require(_0x2705('0x5'));var interaction=require(_0x2705('0x6'));var config=require('../../config/environment');module[_0x2705('0x7')]=router; \ No newline at end of file +var _0xba49=['../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','util','connect-timeout','express'];(function(_0x4ba870,_0x5427b4){var _0x569490=function(_0x109c70){while(--_0x109c70){_0x4ba870['push'](_0x4ba870['shift']());}};_0x569490(++_0x5427b4);}(_0xba49,0x1b4));var _0x9ba4=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xba49[_0x40a045];return _0x1a687c;};'use strict';var multer=require(_0x9ba4('0x0'));var util=require(_0x9ba4('0x1'));var path=require('path');var timeout=require(_0x9ba4('0x2'));var express=require(_0x9ba4('0x3'));var router=express['Router']();var auth=require(_0x9ba4('0x4'));var interaction=require(_0x9ba4('0x5'));var config=require(_0x9ba4('0x6'));module[_0x9ba4('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 242eedc..762edef 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 _0xb688=['exports','INTEGER','STRING'];(function(_0x5c002b,_0x3ca3a9){var _0x1ce73b=function(_0x22275d){while(--_0x22275d){_0x5c002b['push'](_0x5c002b['shift']());}};_0x1ce73b(++_0x3ca3a9);}(_0xb688,0xcf));var _0x8b68=function(_0xfbfc58,_0x12735c){_0xfbfc58=_0xfbfc58-0x0;var _0xdb6cab=_0xb688[_0xfbfc58];return _0xdb6cab;};'use strict';var Sequelize=require('sequelize');module[_0x8b68('0x0')]={'penalty':{'type':Sequelize[_0x8b68('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x8b68('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x8b68('0x2')]}}; \ No newline at end of file +var _0xa571=['exports','INTEGER','sequelize'];(function(_0x304372,_0x5a46f4){var _0x156c19=function(_0x4d8051){while(--_0x4d8051){_0x304372['push'](_0x304372['shift']());}};_0x156c19(++_0x5a46f4);}(_0xa571,0x107));var _0x1a57=function(_0x239f4f,_0x595f18){_0x239f4f=_0x239f4f-0x0;var _0x365600=_0xa571[_0x239f4f];return _0x365600;};'use strict';var Sequelize=require(_0x1a57('0x0'));module[_0x1a57('0x1')]={'penalty':{'type':Sequelize[_0x1a57('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x1a57('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 55948b9..eb35e04 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 _0x8882=['../../config/logger','api','bluebird','path','rimraf','../../config/environment','./userFaxQueue.attributes','define','UserFaxQueue','lodash','util'];(function(_0xad2194,_0x51bd71){var _0x510d4e=function(_0x1fc6f4){while(--_0x1fc6f4){_0xad2194['push'](_0xad2194['shift']());}};_0x510d4e(++_0x51bd71);}(_0x8882,0x169));var _0x2888=function(_0x4965ee,_0x5c09b6){_0x4965ee=_0x4965ee-0x0;var _0xae26a3=_0x8882[_0x4965ee];return _0xae26a3;};'use strict';var _=require(_0x2888('0x0'));var util=require(_0x2888('0x1'));var logger=require(_0x2888('0x2'))(_0x2888('0x3'));var moment=require('moment');var BPromise=require(_0x2888('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2888('0x5'));var rimraf=require(_0x2888('0x6'));var config=require(_0x2888('0x7'));var attributes=require(_0x2888('0x8'));module['exports']=function(_0x3207d9,_0x163dea){return _0x3207d9[_0x2888('0x9')](_0x2888('0xa'),attributes,{'tableName':'user_has_fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5f68=['exports','lodash','util','api','bluebird','path','rimraf','../../config/environment'];(function(_0x20275f,_0x4528c5){var _0x5a5457=function(_0x2bd2cc){while(--_0x2bd2cc){_0x20275f['push'](_0x20275f['shift']());}};_0x5a5457(++_0x4528c5);}(_0x5f68,0x189));var _0x85f6=function(_0x741fe2,_0x30fcae){_0x741fe2=_0x741fe2-0x0;var _0x98b71b=_0x5f68[_0x741fe2];return _0x98b71b;};'use strict';var _=require(_0x85f6('0x0'));var util=require(_0x85f6('0x1'));var logger=require('../../config/logger')(_0x85f6('0x2'));var moment=require('moment');var BPromise=require(_0x85f6('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x85f6('0x4'));var rimraf=require(_0x85f6('0x5'));var config=require(_0x85f6('0x6'));var attributes=require('./userFaxQueue.attributes');module[_0x85f6('0x7')]=function(_0xc65ee6,_0x36ea3e){return _0xc65ee6['define']('UserFaxQueue',attributes,{'tableName':'user_has_fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.rpc.js b/server/api/userFaxQueue/userFaxQueue.rpc.js index 6f80268..33a9986 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 _0xfffd=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0xfffd,0xea));var _0xdfff=function(_0xab4a04,_0x216291){_0xab4a04=_0xab4a04-0x0;var _0x27ae03=_0xfffd[_0xab4a04];return _0x27ae03;};'use strict';var _=require(_0xdfff('0x0'));var util=require(_0xdfff('0x1'));var moment=require(_0xdfff('0x2'));var BPromise=require(_0xdfff('0x3'));var rs=require(_0xdfff('0x4'));var fs=require('fs');var Redis=require(_0xdfff('0x5'));var db=require(_0xdfff('0x6'))['db'];var utils=require(_0xdfff('0x7'));var logger=require(_0xdfff('0x8'))(_0xdfff('0x9'));var config=require(_0xdfff('0xa'));var jayson=require(_0xdfff('0xb'));var client=jayson[_0xdfff('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x31b56c,_0x520a3b,_0x5af9e4){return new BPromise(function(_0x272509,_0x49e4f0){return client['request'](_0x31b56c,_0x5af9e4)[_0xdfff('0xd')](function(_0x35120e){logger[_0xdfff('0xe')](_0xdfff('0xf'),_0x520a3b,_0xdfff('0x10'));logger[_0xdfff('0x11')](_0xdfff('0x12'),_0x520a3b,_0xdfff('0x10'),JSON['stringify'](_0x35120e));if(_0x35120e[_0xdfff('0x13')]){if(_0x35120e[_0xdfff('0x13')][_0xdfff('0x14')]===0x1f4){logger[_0xdfff('0x13')](_0xdfff('0xf'),_0x520a3b,_0x35120e['error'][_0xdfff('0x15')]);return _0x49e4f0(_0x35120e[_0xdfff('0x13')][_0xdfff('0x15')]);}logger[_0xdfff('0x13')](_0xdfff('0xf'),_0x520a3b,_0x35120e[_0xdfff('0x13')][_0xdfff('0x15')]);return _0x272509(_0x35120e[_0xdfff('0x13')][_0xdfff('0x15')]);}else{logger[_0xdfff('0xe')]('UserFaxQueue,\x20%s,\x20%s',_0x520a3b,_0xdfff('0x10'));_0x272509(_0x35120e[_0xdfff('0x16')][_0xdfff('0x15')]);}})[_0xdfff('0x17')](function(_0x4f91b6){logger[_0xdfff('0x13')](_0xdfff('0xf'),_0x520a3b,_0x4f91b6);_0x49e4f0(_0x4f91b6);});});} \ No newline at end of file +var _0x8cde=['then','request\x20sent','stringify','code','message','error','UserFaxQueue,\x20%s,\x20%s','info','result','catch','lodash','bluebird','../../config/utils','../../config/logger','jayson/promise','client','request'];(function(_0x47f762,_0x106ece){var _0x4d2585=function(_0x4de06b){while(--_0x4de06b){_0x47f762['push'](_0x47f762['shift']());}};_0x4d2585(++_0x106ece);}(_0x8cde,0x1d5));var _0xe8cd=function(_0x55d58f,_0x2bea83){_0x55d58f=_0x55d58f-0x0;var _0x1ad6e6=_0x8cde[_0x55d58f];return _0x1ad6e6;};'use strict';var _=require(_0xe8cd('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xe8cd('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe8cd('0x2'));var logger=require(_0xe8cd('0x3'))('rpc');var config=require('../../config/environment');var jayson=require(_0xe8cd('0x4'));var client=jayson[_0xe8cd('0x5')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3a4cb8,_0x4cdd6c,_0x4d49bd){return new BPromise(function(_0x444d83,_0x365a90){return client[_0xe8cd('0x6')](_0x3a4cb8,_0x4d49bd)[_0xe8cd('0x7')](function(_0x4bec8f){logger['info']('UserFaxQueue,\x20%s,\x20%s',_0x4cdd6c,'request\x20sent');logger['debug']('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x4cdd6c,_0xe8cd('0x8'),JSON[_0xe8cd('0x9')](_0x4bec8f));if(_0x4bec8f['error']){if(_0x4bec8f['error'][_0xe8cd('0xa')]===0x1f4){logger['error']('UserFaxQueue,\x20%s,\x20%s',_0x4cdd6c,_0x4bec8f['error'][_0xe8cd('0xb')]);return _0x365a90(_0x4bec8f['error'][_0xe8cd('0xb')]);}logger[_0xe8cd('0xc')](_0xe8cd('0xd'),_0x4cdd6c,_0x4bec8f[_0xe8cd('0xc')]['message']);return _0x444d83(_0x4bec8f[_0xe8cd('0xc')][_0xe8cd('0xb')]);}else{logger[_0xe8cd('0xe')](_0xe8cd('0xd'),_0x4cdd6c,_0xe8cd('0x8'));_0x444d83(_0x4bec8f[_0xe8cd('0xf')][_0xe8cd('0xb')]);}})[_0xe8cd('0x10')](function(_0x563437){logger[_0xe8cd('0xc')](_0xe8cd('0xd'),_0x4cdd6c,_0x563437);_0x365a90(_0x563437);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 17bd5c4..565953c 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 _0x5f7e=['../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router'];(function(_0x237340,_0x39b15d){var _0x5542c8=function(_0xb6a05f){while(--_0xb6a05f){_0x237340['push'](_0x237340['shift']());}};_0x5542c8(++_0x39b15d);}(_0x5f7e,0xd3));var _0xe5f7=function(_0x368bba,_0x1f625b){_0x368bba=_0x368bba-0x0;var _0x409f8f=_0x5f7e[_0x368bba];return _0x409f8f;};'use strict';var multer=require(_0xe5f7('0x0'));var util=require(_0xe5f7('0x1'));var path=require(_0xe5f7('0x2'));var timeout=require('connect-timeout');var express=require(_0xe5f7('0x3'));var router=express[_0xe5f7('0x4')]();var auth=require(_0xe5f7('0x5'));var interaction=require(_0xe5f7('0x6'));var config=require(_0xe5f7('0x7'));module[_0xe5f7('0x8')]=router; \ No newline at end of file +var _0xaa10=['express','Router','../../components/auth/service','../../config/environment','multer','util','path','connect-timeout'];(function(_0x266618,_0x18f637){var _0x54dbf5=function(_0x1f7985){while(--_0x1f7985){_0x266618['push'](_0x266618['shift']());}};_0x54dbf5(++_0x18f637);}(_0xaa10,0xdc));var _0x0aa1=function(_0x4ed3ae,_0x25094b){_0x4ed3ae=_0x4ed3ae-0x0;var _0x1baf39=_0xaa10[_0x4ed3ae];return _0x1baf39;};'use strict';var multer=require(_0x0aa1('0x0'));var util=require(_0x0aa1('0x1'));var path=require(_0x0aa1('0x2'));var timeout=require(_0x0aa1('0x3'));var express=require(_0x0aa1('0x4'));var router=express[_0x0aa1('0x5')]();var auth=require(_0x0aa1('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x0aa1('0x7'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 9d6d899..df2ab23 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 _0xd8b0=['exports','sequelize'];(function(_0x197043,_0x3ebf47){var _0x233e33=function(_0x17bd0f){while(--_0x17bd0f){_0x197043['push'](_0x197043['shift']());}};_0x233e33(++_0x3ebf47);}(_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(_0x1f5966,_0xa5acad){var _0x33895a=function(_0x9547c9){while(--_0x9547c9){_0x1f5966['push'](_0x1f5966['shift']());}};_0x33895a(++_0xa5acad);}(_0xe706,0xa3));var _0x6e70=function(_0x452bed,_0x128e55){_0x452bed=_0x452bed-0x0;var _0x4bb2cf=_0xe706[_0x452bed];return _0x4bb2cf;};'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/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index 2ed2b9f..917ef17 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 _0x2032=['user_has_mail_queues','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./userMailQueue.attributes','exports','define','UserMailQueue'];(function(_0x317510,_0x26fe66){var _0x51320=function(_0x2dfb7c){while(--_0x2dfb7c){_0x317510['push'](_0x317510['shift']());}};_0x51320(++_0x26fe66);}(_0x2032,0xd9));var _0x2203=function(_0x20c175,_0x275efc){_0x20c175=_0x20c175-0x0;var _0x3c971e=_0x2032[_0x20c175];return _0x3c971e;};'use strict';var _=require('lodash');var util=require(_0x2203('0x0'));var logger=require(_0x2203('0x1'))(_0x2203('0x2'));var moment=require('moment');var BPromise=require(_0x2203('0x3'));var rp=require(_0x2203('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2203('0x5'));var config=require(_0x2203('0x6'));var attributes=require(_0x2203('0x7'));module[_0x2203('0x8')]=function(_0x3f7ba1,_0x13367a){return _0x3f7ba1[_0x2203('0x9')](_0x2203('0xa'),attributes,{'tableName':_0x2203('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb10b=['api','moment','request-promise','path','rimraf','../../config/environment','./userMailQueue.attributes','exports','define','user_has_mail_queues','lodash','../../config/logger'];(function(_0x181dfe,_0xf84557){var _0x40c38f=function(_0x3aa818){while(--_0x3aa818){_0x181dfe['push'](_0x181dfe['shift']());}};_0x40c38f(++_0xf84557);}(_0xb10b,0x12a));var _0xbb10=function(_0x3a814f,_0x553e5b){_0x3a814f=_0x3a814f-0x0;var _0x150de1=_0xb10b[_0x3a814f];return _0x150de1;};'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')]('UserMailQueue',attributes,{'tableName':_0xbb10('0xb'),'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 2096a94..73d4e2f 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 _0xba18=['request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserMailQueue,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','info'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xba18,0x1ea));var _0x8ba1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xba18[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x8ba1('0x0'));var util=require(_0x8ba1('0x1'));var moment=require(_0x8ba1('0x2'));var BPromise=require(_0x8ba1('0x3'));var rs=require(_0x8ba1('0x4'));var fs=require('fs');var Redis=require(_0x8ba1('0x5'));var db=require(_0x8ba1('0x6'))['db'];var utils=require(_0x8ba1('0x7'));var logger=require('../../config/logger')(_0x8ba1('0x8'));var config=require(_0x8ba1('0x9'));var jayson=require(_0x8ba1('0xa'));var client=jayson[_0x8ba1('0xb')][_0x8ba1('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2ffa15,_0x51a988,_0x3a87eb){return new BPromise(function(_0x3d1fe7,_0x4dc6c4){return client['request'](_0x2ffa15,_0x3a87eb)['then'](function(_0x4609ce){logger[_0x8ba1('0xd')]('UserMailQueue,\x20%s,\x20%s',_0x51a988,_0x8ba1('0xe'));logger[_0x8ba1('0xf')](_0x8ba1('0x10'),_0x51a988,_0x8ba1('0xe'),JSON[_0x8ba1('0x11')](_0x4609ce));if(_0x4609ce['error']){if(_0x4609ce[_0x8ba1('0x12')][_0x8ba1('0x13')]===0x1f4){logger[_0x8ba1('0x12')](_0x8ba1('0x14'),_0x51a988,_0x4609ce[_0x8ba1('0x12')][_0x8ba1('0x15')]);return _0x4dc6c4(_0x4609ce['error'][_0x8ba1('0x15')]);}logger[_0x8ba1('0x12')](_0x8ba1('0x14'),_0x51a988,_0x4609ce[_0x8ba1('0x12')]['message']);return _0x3d1fe7(_0x4609ce['error']['message']);}else{logger[_0x8ba1('0xd')](_0x8ba1('0x14'),_0x51a988,_0x8ba1('0xe'));_0x3d1fe7(_0x4609ce[_0x8ba1('0x16')][_0x8ba1('0x15')]);}})[_0x8ba1('0x17')](function(_0x107846){logger[_0x8ba1('0x12')](_0x8ba1('0x14'),_0x51a988,_0x107846);_0x4dc6c4(_0x107846);});});} \ No newline at end of file +var _0x6c7b=['UserMailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','UserMailQueue,\x20%s,\x20%s'];(function(_0x5eedb0,_0x11c82d){var _0x41c5ba=function(_0x3733e9){while(--_0x3733e9){_0x5eedb0['push'](_0x5eedb0['shift']());}};_0x41c5ba(++_0x11c82d);}(_0x6c7b,0x10b));var _0xb6c7=function(_0x542fb2,_0x5ebf97){_0x542fb2=_0x542fb2-0x0;var _0x258bab=_0x6c7b[_0x542fb2];return _0x258bab;};'use strict';var _=require(_0xb6c7('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb6c7('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb6c7('0x2'))['db'];var utils=require(_0xb6c7('0x3'));var logger=require(_0xb6c7('0x4'))('rpc');var config=require(_0xb6c7('0x5'));var jayson=require(_0xb6c7('0x6'));var client=jayson[_0xb6c7('0x7')][_0xb6c7('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xb889c3,_0x5dd47a,_0x12e97e){return new BPromise(function(_0x41a5a5,_0xe2ce08){return client[_0xb6c7('0x9')](_0xb889c3,_0x12e97e)[_0xb6c7('0xa')](function(_0x34dbbd){logger[_0xb6c7('0xb')](_0xb6c7('0xc'),_0x5dd47a,'request\x20sent');logger['debug'](_0xb6c7('0xd'),_0x5dd47a,_0xb6c7('0xe'),JSON[_0xb6c7('0xf')](_0x34dbbd));if(_0x34dbbd[_0xb6c7('0x10')]){if(_0x34dbbd[_0xb6c7('0x10')][_0xb6c7('0x11')]===0x1f4){logger[_0xb6c7('0x10')]('UserMailQueue,\x20%s,\x20%s',_0x5dd47a,_0x34dbbd[_0xb6c7('0x10')][_0xb6c7('0x12')]);return _0xe2ce08(_0x34dbbd[_0xb6c7('0x10')][_0xb6c7('0x12')]);}logger[_0xb6c7('0x10')](_0xb6c7('0xc'),_0x5dd47a,_0x34dbbd[_0xb6c7('0x10')]['message']);return _0x41a5a5(_0x34dbbd[_0xb6c7('0x10')]['message']);}else{logger['info']('UserMailQueue,\x20%s,\x20%s',_0x5dd47a,_0xb6c7('0xe'));_0x41a5a5(_0x34dbbd['result'][_0xb6c7('0x12')]);}})[_0xb6c7('0x13')](function(_0x23971b){logger[_0xb6c7('0x10')](_0xb6c7('0xc'),_0x5dd47a,_0x23971b);_0xe2ce08(_0x23971b);});});} \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 4eaec30..33bdf1e 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 _0x778e=['connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','util'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x778e,0x124));var _0xe778=function(_0x16a564,_0x154257){_0x16a564=_0x16a564-0x0;var _0x45403f=_0x778e[_0x16a564];return _0x45403f;};'use strict';var multer=require(_0xe778('0x0'));var util=require(_0xe778('0x1'));var path=require('path');var timeout=require(_0xe778('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0xe778('0x3'));var interaction=require(_0xe778('0x4'));var config=require(_0xe778('0x5'));module[_0xe778('0x6')]=router; \ No newline at end of file +var _0xbd02=['../../components/auth/service','../../components/interaction/service','util','path','connect-timeout','Router'];(function(_0xeb7891,_0x4771f7){var _0x11cc19=function(_0x768961){while(--_0x768961){_0xeb7891['push'](_0xeb7891['shift']());}};_0x11cc19(++_0x4771f7);}(_0xbd02,0xaa));var _0x2bd0=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0xbd02[_0x68c979];return _0x4f0001;};'use strict';var multer=require('multer');var util=require(_0x2bd0('0x0'));var path=require(_0x2bd0('0x1'));var timeout=require(_0x2bd0('0x2'));var express=require('express');var router=express[_0x2bd0('0x3')]();var auth=require(_0x2bd0('0x4'));var interaction=require(_0x2bd0('0x5'));var config=require('../../config/environment');module['exports']=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index 9eb6fa6..ab31152 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 _0xd8b0=['exports','sequelize'];(function(_0x109c40,_0x3463fa){var _0x3d5aed=function(_0x236b3f){while(--_0x236b3f){_0x109c40['push'](_0x109c40['shift']());}};_0x3d5aed(++_0x3463fa);}(_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 _0xa9e0=['sequelize','exports','INTEGER'];(function(_0x2d3f40,_0x141864){var _0x4cdaa8=function(_0x500831){while(--_0x500831){_0x2d3f40['push'](_0x2d3f40['shift']());}};_0x4cdaa8(++_0x141864);}(_0xa9e0,0x123));var _0x0a9e=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xa9e0[_0x373dee];return _0x46798f;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'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 ec62015..14d5064 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 _0x5224=['define','UserOpenchannelQueue','user_has_openchannel_queues','lodash','../../config/logger','api','moment','path','rimraf','../../config/environment','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x5224,0x163));var _0x4522=function(_0x43371b,_0x1cb4cf){_0x43371b=_0x43371b-0x0;var _0x19cd26=_0x5224[_0x43371b];return _0x19cd26;};'use strict';var _=require(_0x4522('0x0'));var util=require('util');var logger=require(_0x4522('0x1'))(_0x4522('0x2'));var moment=require(_0x4522('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4522('0x4'));var rimraf=require(_0x4522('0x5'));var config=require(_0x4522('0x6'));var attributes=require('./userOpenchannelQueue.attributes');module[_0x4522('0x7')]=function(_0x545c18,_0x1bab3a){return _0x545c18[_0x4522('0x8')](_0x4522('0x9'),attributes,{'tableName':_0x4522('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x44eb=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue','user_has_openchannel_queues','lodash','util'];(function(_0x55a89e,_0x1a05ab){var _0x3aa2bd=function(_0x4b9d09){while(--_0x4b9d09){_0x55a89e['push'](_0x55a89e['shift']());}};_0x3aa2bd(++_0x1a05ab);}(_0x44eb,0x166));var _0xb44e=function(_0x2c1114,_0x2a5c50){_0x2c1114=_0x2c1114-0x0;var _0x2b877c=_0x44eb[_0x2c1114];return _0x2b877c;};'use strict';var _=require(_0xb44e('0x0'));var util=require(_0xb44e('0x1'));var logger=require(_0xb44e('0x2'))(_0xb44e('0x3'));var moment=require(_0xb44e('0x4'));var BPromise=require(_0xb44e('0x5'));var rp=require(_0xb44e('0x6'));var fs=require('fs');var path=require(_0xb44e('0x7'));var rimraf=require(_0xb44e('0x8'));var config=require(_0xb44e('0x9'));var attributes=require(_0xb44e('0xa'));module[_0xb44e('0xb')]=function(_0x21a219,_0x10a4bf){return _0x21a219[_0xb44e('0xc')](_0xb44e('0xd'),attributes,{'tableName':_0xb44e('0xe'),'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 0a7ab2b..4e5b859 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 _0x637c=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util'];(function(_0x307d86,_0x9264f2){var _0x361745=function(_0x1b64e1){while(--_0x1b64e1){_0x307d86['push'](_0x307d86['shift']());}};_0x361745(++_0x9264f2);}(_0x637c,0x102));var _0xc637=function(_0x45da68,_0x132430){_0x45da68=_0x45da68-0x0;var _0x500b97=_0x637c[_0x45da68];return _0x500b97;};'use strict';var _=require(_0xc637('0x0'));var util=require(_0xc637('0x1'));var moment=require(_0xc637('0x2'));var BPromise=require(_0xc637('0x3'));var rs=require(_0xc637('0x4'));var fs=require('fs');var Redis=require(_0xc637('0x5'));var db=require(_0xc637('0x6'))['db'];var utils=require(_0xc637('0x7'));var logger=require(_0xc637('0x8'))(_0xc637('0x9'));var config=require(_0xc637('0xa'));var jayson=require(_0xc637('0xb'));var client=jayson[_0xc637('0xc')][_0xc637('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x4cc4c0,_0x23c285,_0x538910){return new BPromise(function(_0x36522d,_0x3c8580){return client[_0xc637('0xe')](_0x4cc4c0,_0x538910)[_0xc637('0xf')](function(_0x4d36ac){logger['info'](_0xc637('0x10'),_0x23c285,_0xc637('0x11'));logger[_0xc637('0x12')](_0xc637('0x13'),_0x23c285,_0xc637('0x11'),JSON[_0xc637('0x14')](_0x4d36ac));if(_0x4d36ac[_0xc637('0x15')]){if(_0x4d36ac[_0xc637('0x15')][_0xc637('0x16')]===0x1f4){logger['error'](_0xc637('0x10'),_0x23c285,_0x4d36ac[_0xc637('0x15')]['message']);return _0x3c8580(_0x4d36ac[_0xc637('0x15')][_0xc637('0x17')]);}logger[_0xc637('0x15')](_0xc637('0x10'),_0x23c285,_0x4d36ac[_0xc637('0x15')][_0xc637('0x17')]);return _0x36522d(_0x4d36ac[_0xc637('0x15')][_0xc637('0x17')]);}else{logger[_0xc637('0x18')](_0xc637('0x10'),_0x23c285,_0xc637('0x11'));_0x36522d(_0x4d36ac['result']['message']);}})[_0xc637('0x19')](function(_0x4fc4bb){logger[_0xc637('0x15')](_0xc637('0x10'),_0x23c285,_0x4fc4bb);_0x3c8580(_0x4fc4bb);});});} \ No newline at end of file +var _0x6a55=['rpc','jayson/promise','http','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0xe618ee,_0x1ec24b){var _0x2bc4e5=function(_0x4ddf40){while(--_0x4ddf40){_0xe618ee['push'](_0xe618ee['shift']());}};_0x2bc4e5(++_0x1ec24b);}(_0x6a55,0x100));var _0x56a5=function(_0x17fea7,_0x102927){_0x17fea7=_0x17fea7-0x0;var _0x3150c3=_0x6a55[_0x17fea7];return _0x3150c3;};'use strict';var _=require(_0x56a5('0x0'));var util=require(_0x56a5('0x1'));var moment=require('moment');var BPromise=require(_0x56a5('0x2'));var rs=require(_0x56a5('0x3'));var fs=require('fs');var Redis=require(_0x56a5('0x4'));var db=require(_0x56a5('0x5'))['db'];var utils=require(_0x56a5('0x6'));var logger=require(_0x56a5('0x7'))(_0x56a5('0x8'));var config=require('../../config/environment');var jayson=require(_0x56a5('0x9'));var client=jayson['client'][_0x56a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x28eb60,_0x4d14aa,_0x520e01){return new BPromise(function(_0x4047c8,_0x12f2c8){return client[_0x56a5('0xb')](_0x28eb60,_0x520e01)[_0x56a5('0xc')](function(_0x2ab6f2){logger[_0x56a5('0xd')](_0x56a5('0xe'),_0x4d14aa,'request\x20sent');logger[_0x56a5('0xf')](_0x56a5('0x10'),_0x4d14aa,_0x56a5('0x11'),JSON[_0x56a5('0x12')](_0x2ab6f2));if(_0x2ab6f2['error']){if(_0x2ab6f2[_0x56a5('0x13')][_0x56a5('0x14')]===0x1f4){logger[_0x56a5('0x13')](_0x56a5('0xe'),_0x4d14aa,_0x2ab6f2[_0x56a5('0x13')][_0x56a5('0x15')]);return _0x12f2c8(_0x2ab6f2[_0x56a5('0x13')]['message']);}logger[_0x56a5('0x13')](_0x56a5('0xe'),_0x4d14aa,_0x2ab6f2[_0x56a5('0x13')][_0x56a5('0x15')]);return _0x4047c8(_0x2ab6f2[_0x56a5('0x13')]['message']);}else{logger[_0x56a5('0xd')](_0x56a5('0xe'),_0x4d14aa,_0x56a5('0x11'));_0x4047c8(_0x2ab6f2[_0x56a5('0x16')]['message']);}})[_0x56a5('0x17')](function(_0x227beb){logger[_0x56a5('0x13')](_0x56a5('0xe'),_0x4d14aa,_0x227beb);_0x12f2c8(_0x227beb);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 32a578a..9bdaf30 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 _0x1b28=['addSections','addResources','put','/:id','destroy','removeSections','delete','removeResources','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','isAuthenticated','index','get','/describe','describe','/:id/sections','getSections','/:id/resources','getResources','create','post','/:id/clone','clone'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x1b28,0x1c9));var _0x81b2=function(_0x4647e4,_0x465868){_0x4647e4=_0x4647e4-0x0;var _0x222985=_0x1b28[_0x4647e4];return _0x222985;};'use strict';var multer=require(_0x81b2('0x0'));var util=require(_0x81b2('0x1'));var path=require(_0x81b2('0x2'));var timeout=require(_0x81b2('0x3'));var express=require(_0x81b2('0x4'));var router=express[_0x81b2('0x5')]();var auth=require(_0x81b2('0x6'));var interaction=require(_0x81b2('0x7'));var config=require(_0x81b2('0x8'));var controller=require(_0x81b2('0x9'));router['get']('/',auth[_0x81b2('0xa')](),controller[_0x81b2('0xb')]);router[_0x81b2('0xc')](_0x81b2('0xd'),auth[_0x81b2('0xa')](),controller[_0x81b2('0xe')]);router[_0x81b2('0xc')]('/:id',auth[_0x81b2('0xa')](),controller['show']);router[_0x81b2('0xc')](_0x81b2('0xf'),auth[_0x81b2('0xa')](),controller[_0x81b2('0x10')]);router[_0x81b2('0xc')](_0x81b2('0x11'),auth['isAuthenticated'](),controller[_0x81b2('0x12')]);router['post']('/',auth[_0x81b2('0xa')](),controller[_0x81b2('0x13')]);router[_0x81b2('0x14')](_0x81b2('0x15'),auth[_0x81b2('0xa')](),controller[_0x81b2('0x16')]);router[_0x81b2('0x14')](_0x81b2('0xf'),auth[_0x81b2('0xa')](),controller[_0x81b2('0x17')]);router[_0x81b2('0x14')](_0x81b2('0x11'),auth[_0x81b2('0xa')](),controller[_0x81b2('0x18')]);router[_0x81b2('0x19')](_0x81b2('0x1a'),auth[_0x81b2('0xa')](),controller['update']);router['delete'](_0x81b2('0x1a'),auth[_0x81b2('0xa')](),controller[_0x81b2('0x1b')]);router['delete']('/:id/sections',auth['isAuthenticated'](),controller[_0x81b2('0x1c')]);router[_0x81b2('0x1d')]('/:id/resources',auth[_0x81b2('0xa')](),controller[_0x81b2('0x1e')]);module[_0x81b2('0x1f')]=router; \ No newline at end of file +var _0xdc1d=['../../components/interaction/service','./userProfile.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/sections','getSections','/:id/resources','getResources','post','create','/:id/clone','clone','addSections','addResources','update','delete','destroy','removeResources','exports','path','connect-timeout','express','Router'];(function(_0x1877ae,_0xce0272){var _0x440d68=function(_0x84b357){while(--_0x84b357){_0x1877ae['push'](_0x1877ae['shift']());}};_0x440d68(++_0xce0272);}(_0xdc1d,0x88));var _0xddc1=function(_0x1b169c,_0x91fcf7){_0x1b169c=_0x1b169c-0x0;var _0x6f21cf=_0xdc1d[_0x1b169c];return _0x6f21cf;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xddc1('0x0'));var timeout=require(_0xddc1('0x1'));var express=require(_0xddc1('0x2'));var router=express[_0xddc1('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xddc1('0x4'));var config=require('../../config/environment');var controller=require(_0xddc1('0x5'));router['get']('/',auth[_0xddc1('0x6')](),controller[_0xddc1('0x7')]);router[_0xddc1('0x8')](_0xddc1('0x9'),auth[_0xddc1('0x6')](),controller[_0xddc1('0xa')]);router[_0xddc1('0x8')](_0xddc1('0xb'),auth[_0xddc1('0x6')](),controller[_0xddc1('0xc')]);router[_0xddc1('0x8')](_0xddc1('0xd'),auth[_0xddc1('0x6')](),controller[_0xddc1('0xe')]);router['get'](_0xddc1('0xf'),auth['isAuthenticated'](),controller[_0xddc1('0x10')]);router[_0xddc1('0x11')]('/',auth[_0xddc1('0x6')](),controller[_0xddc1('0x12')]);router[_0xddc1('0x11')](_0xddc1('0x13'),auth[_0xddc1('0x6')](),controller[_0xddc1('0x14')]);router[_0xddc1('0x11')]('/:id/sections',auth['isAuthenticated'](),controller[_0xddc1('0x15')]);router['post'](_0xddc1('0xf'),auth[_0xddc1('0x6')](),controller[_0xddc1('0x16')]);router['put']('/:id',auth[_0xddc1('0x6')](),controller[_0xddc1('0x17')]);router[_0xddc1('0x18')]('/:id',auth[_0xddc1('0x6')](),controller[_0xddc1('0x19')]);router[_0xddc1('0x18')](_0xddc1('0xd'),auth[_0xddc1('0x6')](),controller['removeSections']);router[_0xddc1('0x18')](_0xddc1('0xf'),auth['isAuthenticated'](),controller[_0xddc1('0x1a')]);module[_0xddc1('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 3681388..7e9901c 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 _0x7e05=['sequelize','exports','name','setDataValue','getDataValue','crudPermissions','STRING'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x7e05,0x69));var _0x57e0=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x7e05[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require(_0x57e0('0x0'));module[_0x57e0('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x57e0('0x2')},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x387826){this[_0x57e0('0x3')]('crudPermissions',_0x387826?_0x387826['join'](''):[]);},'get':function(){return this[_0x57e0('0x4')](_0x57e0('0x5'))?this[_0x57e0('0x4')](_0x57e0('0x5'))['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x57e0('0x6')],'allowNull':!![]}}; \ No newline at end of file +var _0xc060=['name','setDataValue','crudPermissions','getDataValue','sequelize','STRING'];(function(_0x15ea09,_0x2f30ab){var _0x3e9c78=function(_0x15f8ba){while(--_0x15f8ba){_0x15ea09['push'](_0x15ea09['shift']());}};_0x3e9c78(++_0x2f30ab);}(_0xc060,0xca));var _0x0c06=function(_0x1854ed,_0x1f4327){_0x1854ed=_0x1854ed-0x0;var _0x1f1bb0=_0xc060[_0x1854ed];return _0x1f1bb0;};'use strict';var Sequelize=require(_0x0c06('0x0'));module['exports']={'name':{'type':Sequelize[_0x0c06('0x1')],'allowNull':![],'unique':_0x0c06('0x2')},'crudPermissions':{'type':Sequelize[_0x0c06('0x1')],'set':function(_0x356c0c){this[_0x0c06('0x3')](_0x0c06('0x4'),_0x356c0c?_0x356c0c['join'](''):[]);},'get':function(){return this['getDataValue'](_0x0c06('0x4'))?this[_0x0c06('0x5')](_0x0c06('0x4'))['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x0c06('0x1')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index 33bb00a..8a4bdb3 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 _0x4901=['name','index','map','UserProfile','fieldName','key','query','keys','filters','model','attributes','intersection','fields','length','nolimit','pick','where','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','rawAttributes','find','create','body','clone','get','omit','createdAt','updatedAt','crudPermissions','sequelize','transaction','UserProfileSection','each','autoAssociation','UserProfileResource','sectionId','userProfileId','Resources','params','describe','addSections','push','removeSections','getSections','includes','enabled','subsections','findOne','Dashboard','forEach','resourceId','Plugin','addResources','bulkCreate','ids','getResources','section','undefined','ValidationError','Unknown\x20section','mergeResources','childModel','Sequelize','isEmpty','all','ignore','union','hasOwnProperty','order','sort','field','AnalyticExtractedReport','foreignKey','associatedResources','reportType','reportId','custom','CustomReports','rows','CmContact','Tag','Tags','tag','ThroughTags','color','value','toLowerCase','squareprojects','SquareProject','SquareOdbc','SquareRecording','parentSections','SquareProjects','projectName','projects','JscriptyProject','contacts','lists','CmList','companies','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatQueue','chatwebsites','faxqueues','faxaccounts','FaxAccount','inboundroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','VoiceMail','voicerecordings','VoiceRecording','membername','User','role','agent','Telephones','telephone','VoiceQueues','VoiceQueue','QueueCampaigns','queue','musiconholds','chanspies','voiceprefixes','VoicePrefix','Campaign','mailqueues','MailQueue','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','smsqueues','SmsQueue','SmsAccount','whatsappaccounts','teams','voicequeues','queuecampaigns','users','agents','telephones','Users','admin','user','Agents','zendeskaccounts','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','deskaccounts','ZohoAccount','vtigeraccounts','CannedAnswer','dispositions','Disposition','customdashboards','intervals','Interval','pauses','Pause','scheduler','sounds','tags','templates','triggers','Trigger','trunks','Variable','plugins','Reports','WhatsappAccount','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','lodash','squel','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','socket.io-emitter','register','sendStatus','status','end','json','count','offset','limit','set','reject','save','update','destroy','then','error','stack'];(function(_0x2527d3,_0x5098b0){var _0x20f842=function(_0x1ca5da){while(--_0x1ca5da){_0x2527d3['push'](_0x2527d3['shift']());}};_0x20f842(++_0x5098b0);}(_0x4901,0xbe));var _0x1490=function(_0x1fae42,_0x12ef9c){_0x1fae42=_0x1fae42-0x0;var _0x44e867=_0x4901[_0x1fae42];return _0x44e867;};'use strict';var pdf=require(_0x1490('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x1490('0x1'));var zipdir=require(_0x1490('0x2'));var jsonpatch=require(_0x1490('0x3'));var rp=require(_0x1490('0x4'));var moment=require(_0x1490('0x5'));var BPromise=require(_0x1490('0x6'));var Mustache=require('mustache');var util=require(_0x1490('0x7'));var path=require(_0x1490('0x8'));var sox=require(_0x1490('0x9'));var csv=require('to-csv');var ejs=require(_0x1490('0xa'));var fs=require('fs');var _=require(_0x1490('0xb'));var squel=require(_0x1490('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x1490('0xd'));var querystring=require(_0x1490('0xe'));var Papa=require(_0x1490('0xf'));var Redis=require(_0x1490('0x10'));var authService=require(_0x1490('0x11'));var qs=require(_0x1490('0x12'));var as=require(_0x1490('0x13'));var hardwareService=require(_0x1490('0x14'));var logger=require(_0x1490('0x15'))(_0x1490('0x16'));var utils=require(_0x1490('0x17'));var config=require(_0x1490('0x18'));var db=require('../../mysqldb')['db'];config[_0x1490('0x19')]=_[_0x1490('0x1a')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x1490('0x1b'))(new Redis(config['redis']));require('./userProfile.socket')[_0x1490('0x1c')](socket);function respondWithStatusCode(_0x397b31,_0x295c6e){_0x295c6e=_0x295c6e||0xcc;return function(_0x3a0b7b){if(_0x3a0b7b){return _0x397b31[_0x1490('0x1d')](_0x295c6e);}return _0x397b31[_0x1490('0x1e')](_0x295c6e)[_0x1490('0x1f')]();};}function respondWithResult(_0x1e2e72,_0x193d6e){_0x193d6e=_0x193d6e||0xc8;return function(_0x5f181b){if(_0x5f181b){return _0x1e2e72[_0x1490('0x1e')](_0x193d6e)[_0x1490('0x20')](_0x5f181b);}};}function respondWithFilteredResult(_0x4b25fa,_0x43537e){return function(_0x590c10){if(_0x590c10){var _0x340894=_0x590c10[_0x1490('0x21')],_0x32ab11=_0x43537e[_0x1490('0x22')],_0x994b1b=_0x43537e[_0x1490('0x22')]+_0x43537e[_0x1490('0x23')],_0x3da997;if(_0x994b1b>=_0x340894){_0x994b1b=_0x340894;_0x3da997=0xc8;}else{_0x3da997=0xce;}_0x4b25fa[_0x1490('0x1e')](_0x3da997);return _0x4b25fa[_0x1490('0x24')]('Content-Range',_0x32ab11+'-'+_0x994b1b+'/'+_0x340894)[_0x1490('0x20')](_0x590c10);}return null;};}function patchUpdates(_0x44befd){return function(_0x4309ab){try{jsonpatch['apply'](_0x4309ab,_0x44befd,!![]);}catch(_0x1d1310){return BPromise[_0x1490('0x25')](_0x1d1310);}return _0x4309ab[_0x1490('0x26')]();};}function saveUpdates(_0x24b4ab,_0x935ec2){return function(_0x1b7ea0){if(_0x1b7ea0){return _0x1b7ea0[_0x1490('0x27')](_0x24b4ab)['then'](function(_0x3daf1b){return _0x3daf1b;});}return null;};}function removeEntity(_0x30fe3d,_0x2f411e){return function(_0x422dd6){if(_0x422dd6){return _0x422dd6[_0x1490('0x28')]()[_0x1490('0x29')](function(){_0x30fe3d[_0x1490('0x1e')](0xcc)[_0x1490('0x1f')]();});}};}function handleEntityNotFound(_0x99d8ae,_0x80034){return function(_0x4bce90){if(!_0x4bce90){_0x99d8ae['sendStatus'](0x194);}return _0x4bce90;};}function handleError(_0x14fa3e,_0xda908f){_0xda908f=_0xda908f||0x1f4;return function(_0x2a0a2e){logger[_0x1490('0x2a')](_0x2a0a2e[_0x1490('0x2b')]);if(_0x2a0a2e['name']){delete _0x2a0a2e[_0x1490('0x2c')];}_0x14fa3e[_0x1490('0x1e')](_0xda908f)['send'](_0x2a0a2e);};}exports[_0x1490('0x2d')]=function(_0x1beaae,_0x626d1b){var _0x4026a7={},_0x39cb86={},_0x4f8a5f={'count':0x0,'rows':[]};var _0x4586a0=_[_0x1490('0x2e')](db[_0x1490('0x2f')]['rawAttributes'],function(_0x1bdccb){return{'name':_0x1bdccb[_0x1490('0x30')],'type':_0x1bdccb['type'][_0x1490('0x31')]};});_0x39cb86['model']=_[_0x1490('0x2e')](_0x4586a0,_0x1490('0x2c'));_0x39cb86[_0x1490('0x32')]=_[_0x1490('0x33')](_0x1beaae[_0x1490('0x32')]);_0x39cb86[_0x1490('0x34')]=_['intersection'](_0x39cb86[_0x1490('0x35')],_0x39cb86[_0x1490('0x32')]);_0x4026a7[_0x1490('0x36')]=_[_0x1490('0x37')](_0x39cb86['model'],qs[_0x1490('0x38')](_0x1beaae[_0x1490('0x32')][_0x1490('0x38')]));_0x4026a7[_0x1490('0x36')]=_0x4026a7[_0x1490('0x36')][_0x1490('0x39')]?_0x4026a7[_0x1490('0x36')]:_0x39cb86['model'];if(!_0x1beaae[_0x1490('0x32')]['hasOwnProperty'](_0x1490('0x3a'))){_0x4026a7['limit']=qs[_0x1490('0x23')](_0x1beaae[_0x1490('0x32')][_0x1490('0x23')]);_0x4026a7[_0x1490('0x22')]=qs[_0x1490('0x22')](_0x1beaae[_0x1490('0x32')]['offset']);}_0x4026a7['order']=qs['sort'](_0x1beaae[_0x1490('0x32')]['sort']);_0x4026a7['where']=qs[_0x1490('0x34')](_[_0x1490('0x3b')](_0x1beaae[_0x1490('0x32')],_0x39cb86[_0x1490('0x34')]),_0x4586a0);if(_0x1beaae[_0x1490('0x32')]['filter']){_0x4026a7[_0x1490('0x3c')]=_[_0x1490('0x3d')](_0x4026a7[_0x1490('0x3c')],{'$or':_[_0x1490('0x2e')](_0x4586a0,function(_0x2168ac){if(_0x2168ac[_0x1490('0x3e')]!==_0x1490('0x3f')){var _0x17d6cc={};_0x17d6cc[_0x2168ac[_0x1490('0x2c')]]={'$like':'%'+_0x1beaae[_0x1490('0x32')][_0x1490('0x40')]+'%'};return _0x17d6cc;}})});}_0x4026a7=_[_0x1490('0x3d')]({},_0x4026a7,_0x1beaae[_0x1490('0x41')]);var _0x3859fd={'where':_0x4026a7[_0x1490('0x3c')]};return db[_0x1490('0x2f')][_0x1490('0x21')](_0x3859fd)['then'](function(_0x5f5674){_0x4f8a5f[_0x1490('0x21')]=_0x5f5674;if(_0x1beaae[_0x1490('0x32')][_0x1490('0x42')]){_0x4026a7[_0x1490('0x43')]=[{'all':!![]}];}return db[_0x1490('0x2f')][_0x1490('0x44')](_0x4026a7);})[_0x1490('0x29')](function(_0x3f0327){_0x4f8a5f['rows']=_0x3f0327;return _0x4f8a5f;})['then'](respondWithFilteredResult(_0x626d1b,_0x4026a7))[_0x1490('0x45')](handleError(_0x626d1b,null));};exports[_0x1490('0x46')]=function(_0x95258c,_0x55e99c){var _0xe7e34d={'raw':![],'where':{'id':_0x95258c['params']['id']}},_0xb51dbc={};_0xb51dbc[_0x1490('0x35')]=_[_0x1490('0x33')](db[_0x1490('0x2f')][_0x1490('0x47')]);_0xb51dbc[_0x1490('0x32')]=_[_0x1490('0x33')](_0x95258c['query']);_0xb51dbc[_0x1490('0x34')]=_[_0x1490('0x37')](_0xb51dbc[_0x1490('0x35')],_0xb51dbc['query']);_0xe7e34d[_0x1490('0x36')]=_[_0x1490('0x37')](_0xb51dbc[_0x1490('0x35')],qs[_0x1490('0x38')](_0x95258c[_0x1490('0x32')][_0x1490('0x38')]));_0xe7e34d[_0x1490('0x36')]=_0xe7e34d['attributes'][_0x1490('0x39')]?_0xe7e34d['attributes']:_0xb51dbc[_0x1490('0x35')];if(_0x95258c['query']['includeAll']){_0xe7e34d[_0x1490('0x43')]=[{'all':!![]}];}_0xe7e34d=_[_0x1490('0x3d')]({},_0xe7e34d,_0x95258c[_0x1490('0x41')]);return db[_0x1490('0x2f')][_0x1490('0x48')](_0xe7e34d)[_0x1490('0x29')](handleEntityNotFound(_0x55e99c,null))[_0x1490('0x29')](respondWithResult(_0x55e99c,null))[_0x1490('0x45')](handleError(_0x55e99c,null));};exports['create']=function(_0x2c92fb,_0x46dfeb){return db[_0x1490('0x2f')][_0x1490('0x49')](_0x2c92fb[_0x1490('0x4a')],{})[_0x1490('0x29')](respondWithResult(_0x46dfeb,0xc9))[_0x1490('0x45')](handleError(_0x46dfeb,null));};exports[_0x1490('0x4b')]=function(_0x1ed693,_0x85e6a6){var _0x167c0c={'where':{'id':_0x1ed693['params']['id']}},_0x189d1d={};_0x189d1d[_0x1490('0x35')]=_[_0x1490('0x33')](db['UserProfile']['rawAttributes']);_0x167c0c['attributes']=_[_0x1490('0x37')](_0x189d1d[_0x1490('0x35')],qs[_0x1490('0x38')](_0x1ed693['query'][_0x1490('0x38')]));_0x167c0c[_0x1490('0x36')]=_0x167c0c[_0x1490('0x36')][_0x1490('0x39')]?_0x167c0c['attributes']:_0x189d1d[_0x1490('0x35')];if(_0x1ed693[_0x1490('0x32')][_0x1490('0x42')]){_0x167c0c[_0x1490('0x43')]=[{'all':!![]}];}_0x167c0c=_[_0x1490('0x3d')]({},_0x167c0c,_0x1ed693[_0x1490('0x41')]);return db[_0x1490('0x2f')][_0x1490('0x48')](_0x167c0c)['then'](handleEntityNotFound(_0x85e6a6,null))['then'](function(_0x438c1b){if(_0x438c1b){var _0x465144=_0x438c1b[_0x1490('0x4c')]({'plain':!![]});_0x465144=qs[_0x1490('0x4d')](_0x465144,['id',_0x1490('0x4e'),_0x1490('0x4f'),_0x1490('0x50')]);_0x1ed693[_0x1490('0x4a')]=_[_0x1490('0x4d')](_0x1ed693['body'],['id',_0x1490('0x4e'),_0x1490('0x4f')]);return db[_0x1490('0x51')][_0x1490('0x52')](function(_0x4531d7){return db[_0x1490('0x2f')]['create'](_[_0x1490('0x3d')](_0x465144,_0x1ed693[_0x1490('0x4a')]),{'include':_0x1ed693[_0x1490('0x32')][_0x1490('0x42')]?[{'all':!![]}]:undefined,'transaction':_0x4531d7})[_0x1490('0x29')](function(_0x1b392c){var _0x2944d2=_0x1b392c[_0x1490('0x4c')]({'plain':!![]});return db[_0x1490('0x53')][_0x1490('0x44')]({'where':{'userProfileId':_0x1ed693['params']['id']},'raw':!![]})[_0x1490('0x29')](function(_0x49dff0){if(_0x49dff0){return BPromise[_0x1490('0x54')](_0x49dff0,function(_0x3ec230){return new BPromise(function(_0x2fa143,_0x5485f9){if(_0x3ec230[_0x1490('0x55')]===null||_0x3ec230['autoAssociation']===0x1)_0x2fa143(null);return db[_0x1490('0x56')][_0x1490('0x44')]({'where':{'sectionId':_0x3ec230['id']},'raw':!![]})[_0x1490('0x29')](function(_0x103f5b){var _0x39eab0=_[_0x1490('0x2e')](_0x103f5b,function(_0x18aeb1){return qs['omit'](_0x18aeb1,['id',_0x1490('0x4e'),_0x1490('0x4f'),_0x1490('0x57')]);});_0x2fa143(_0x39eab0);})['catch'](function(_0x12c7f2){_0x5485f9(_0x12c7f2);});})['then'](function(_0x5a6a8c){var _0x360831=qs[_0x1490('0x4d')](_0x3ec230,['id','createdAt',_0x1490('0x4f')]);_0x360831[_0x1490('0x58')]=_0x2944d2['id'];if(_0x5a6a8c)_0x360831[_0x1490('0x59')]=_0x5a6a8c;return _0x360831;})['then'](function(_0x5bc119){return db[_0x1490('0x53')][_0x1490('0x49')](_0x5bc119,{'include':[{'model':db[_0x1490('0x56')],'as':_0x1490('0x59')}],'raw':!![],'transaction':_0x4531d7});});})[_0x1490('0x29')](function(){return _0x2944d2;});}});});});}})[_0x1490('0x29')](respondWithResult(_0x85e6a6,0xc9))[_0x1490('0x45')](handleError(_0x85e6a6,null));};exports[_0x1490('0x27')]=function(_0x49a5ca,_0x2aa995){if(_0x49a5ca['body']['id']){delete _0x49a5ca[_0x1490('0x4a')]['id'];}return db[_0x1490('0x2f')]['find']({'where':{'id':_0x49a5ca[_0x1490('0x5a')]['id']}})[_0x1490('0x29')](handleEntityNotFound(_0x2aa995,null))[_0x1490('0x29')](saveUpdates(_0x49a5ca['body'],null))[_0x1490('0x29')](respondWithResult(_0x2aa995,null))[_0x1490('0x45')](handleError(_0x2aa995,null));};exports[_0x1490('0x28')]=function(_0x39ec2b,_0x1b8a62){return db['UserProfile']['find']({'where':{'id':_0x39ec2b[_0x1490('0x5a')]['id']}})[_0x1490('0x29')](handleEntityNotFound(_0x1b8a62,null))['then'](removeEntity(_0x1b8a62,null))['catch'](handleError(_0x1b8a62,null));};exports[_0x1490('0x5b')]=function(_0x245b9d,_0x55b067){return db[_0x1490('0x2f')][_0x1490('0x5b')]()[_0x1490('0x29')](respondWithResult(_0x55b067,null))[_0x1490('0x45')](handleError(_0x55b067,null));};exports[_0x1490('0x5c')]=function(_0x1e3da8,_0x5f4b0d){var _0x2ae2e8=_0x1e3da8[_0x1490('0x4a')];return db[_0x1490('0x2f')]['find']({'where':{'id':_0x1e3da8[_0x1490('0x5a')]['id']}})[_0x1490('0x29')](handleEntityNotFound(_0x5f4b0d,null))[_0x1490('0x29')](function(_0xc94b49){if(_0xc94b49){return db[_0x1490('0x51')][_0x1490('0x52')](function(_0x291dea){return db[_0x1490('0x53')][_0x1490('0x28')]({'where':{'userProfileId':_0x1e3da8[_0x1490('0x5a')]['id'],'sectionId':_[_0x1490('0x2e')](_0x2ae2e8,function(_0x3ee40c){return _0x3ee40c[_0x1490('0x57')];})},'transaction':_0x291dea})[_0x1490('0x29')](function(){var _0x851168=_[_0x1490('0x2e')](_0x2ae2e8,function(_0x3c54d1){_0x3c54d1['userProfileId']=_0x1e3da8[_0x1490('0x5a')]['id'];return _0x3c54d1;});var _0x2eb525=[];return BPromise[_0x1490('0x54')](_0x851168,function(_0x378967){return db[_0x1490('0x53')][_0x1490('0x49')](_0x378967,{'include':[{'model':db[_0x1490('0x56')],'as':_0x1490('0x59')}],'raw':!![],'transaction':_0x291dea})[_0x1490('0x29')](function(_0x5b4b87){_0x2eb525[_0x1490('0x5d')](_0x5b4b87['get']({'plain':!![]}));});})[_0x1490('0x29')](function(){return _0x2eb525;});});});}})[_0x1490('0x29')](function(_0x404bd9){return _0x404bd9;})['then'](respondWithResult(_0x5f4b0d,null))[_0x1490('0x45')](handleError(_0x5f4b0d,null));};exports[_0x1490('0x5e')]=function(_0x4a6d56,_0x3c1a36){var _0x1d9ae6;return db[_0x1490('0x2f')]['find']({'where':{'id':_0x4a6d56[_0x1490('0x5a')]['id']},'attributes':['id',_0x1490('0x2c')]})[_0x1490('0x29')](handleEntityNotFound(_0x3c1a36,null))[_0x1490('0x29')](function(_0xee172b){if(_0xee172b){_0x1d9ae6=_0xee172b;return db[_0x1490('0x53')][_0x1490('0x28')]({'where':{'userProfileId':_0x4a6d56[_0x1490('0x5a')]['id'],'sectionId':_0x4a6d56[_0x1490('0x32')]['ids']}});}})[_0x1490('0x29')](function(){return _0x1d9ae6;})[_0x1490('0x29')](respondWithStatusCode(_0x3c1a36,null))['catch'](handleError(_0x3c1a36,null));};exports[_0x1490('0x5f')]=function(_0x11298f,_0x2f8a44){var _0x172b5e=[];var _0x6fff=[];return db[_0x1490('0x53')]['findAll']({'where':{'userProfileId':_0x11298f[_0x1490('0x5a')]['id']},'raw':!![]})[_0x1490('0x29')](function(_0x455729){_0x172b5e=_[_0x1490('0x40')](_0x455729,function(_0x4fd6db){return _0x4fd6db['enabled']===0x1||_[_0x1490('0x60')]([0x3eb,0x709],_0x4fd6db[_0x1490('0x57')]);});if(!_['isEmpty'](_0x172b5e)){return _[_0x1490('0x2e')](_0x172b5e,function(_0x44c62c){return _0x44c62c[_0x1490('0x57')];});}else{return;}})[_0x1490('0x29')](function(_0xa6a010){if(_0xa6a010)_0x6fff=_0xa6a010;if(_[_0x1490('0x60')](_0x6fff,0x64)){var _0x17b1e3=_[_0x1490('0x48')](_0x172b5e,{'sectionId':0x64});return hasDefaultDashboard(_0x17b1e3)[_0x1490('0x29')](function(_0x3a43da){return _['map'](_0x172b5e,function(_0x1f5b80){if(_0x1f5b80[_0x1490('0x57')]===0x64){_0x1f5b80['subsections']=_0x3a43da;}return _0x1f5b80;});});}else{return;}})[_0x1490('0x29')](function(_0x3cdd75){if(_0x3cdd75)_0x172b5e=_0x3cdd75;if(_[_0x1490('0x60')](_0x6fff,0x3eb)){var _0xf9cea5=_[_0x1490('0x48')](_0x172b5e,{'sectionId':0x3eb});return getCustomDashboards(_0xf9cea5)['then'](function(_0xc0af3b){return _['map'](_0x172b5e,function(_0x384f15){if(_0xf9cea5[_0x1490('0x61')]){if(_0x384f15[_0x1490('0x57')]===0x3eb){_0x384f15[_0x1490('0x62')]=_0xc0af3b;}}else{if(_0x384f15[_0x1490('0x57')]===0x64){_0x384f15[_0x1490('0x62')]=_0xc0af3b;}}return _0x384f15;});});}else{return;}})[_0x1490('0x29')](function(_0x2c094e){if(_0x2c094e)_0x172b5e=_0x2c094e;if(_[_0x1490('0x60')](_0x6fff,0x709)){var _0x28dfd0=_[_0x1490('0x48')](_0x172b5e,{'sectionId':0x709});return getPlugins(_0x28dfd0)['then'](function(_0x3ad70e){if(_0x28dfd0[_0x1490('0x61')]){return _[_0x1490('0x2e')](_0x172b5e,function(_0x2ae1bc){if(_0x2ae1bc[_0x1490('0x57')]===0x709){_0x2ae1bc[_0x1490('0x62')]=_0x3ad70e;}return _0x2ae1bc;});}else{var _0x5c412a={'sectionId':0x76c,'enabled':0x1,'subsections':_0x3ad70e};var _0x488cb2=_[_0x1490('0x2e')](_0x172b5e);_0x488cb2[_0x1490('0x5d')](_0x5c412a);return _0x488cb2;}});}else{return;}})[_0x1490('0x29')](function(_0x302b2c){if(_0x302b2c)_0x172b5e=_0x302b2c;return _[_0x1490('0x40')](_0x172b5e,['enabled',0x1]);})[_0x1490('0x29')](respondWithResult(_0x2f8a44,null))[_0x1490('0x45')](handleError(_0x2f8a44,null));};function hasDefaultDashboard(_0x194034){var _0xbb945a=[0x65];return new BPromise(function(_0x3a7776,_0x3208ac){try{if(_0x194034['autoAssociation']){_0x3a7776(_0xbb945a);}else{return db['UserProfileResource'][_0x1490('0x63')]({'where':{'sectionId':_0x194034['id']},'raw':!![]})[_0x1490('0x29')](function(_0xc41a02){_0xc41a02?_0x3a7776(_0xbb945a):_0x3a7776();});}}catch(_0x57c135){_0x3208ac(_0x57c135);}});}function getCustomDashboards(_0x2b3f8b){var _0x3ebd62=[];return new BPromise(function(_0x278d6a,_0x3bc604){try{if(_0x2b3f8b[_0x1490('0x55')]){return db[_0x1490('0x64')]['findAll']({'raw':!![]})[_0x1490('0x29')](function(_0x4b785a){_0x4b785a['forEach'](function(_0x2389f3){_0x3ebd62[_0x1490('0x5d')](_0x2389f3['id']+0x1869f);});_0x278d6a(_0x3ebd62);});}else{return db['UserProfileResource'][_0x1490('0x44')]({'where':{'sectionId':_0x2b3f8b['id']},'raw':!![]})[_0x1490('0x29')](function(_0x529505){_0x529505[_0x1490('0x65')](function(_0xaf1062){_0x3ebd62[_0x1490('0x5d')](_0xaf1062[_0x1490('0x66')]+0x1869f);});_0x278d6a(_0x3ebd62);});}}catch(_0x3d5fbb){_0x3bc604(_0x3d5fbb);}});}function getPlugins(_0x46271d){var _0x312b43=[];return new BPromise(function(_0x53f960,_0x1ed3e2){try{if(_0x46271d['autoAssociation']){return db[_0x1490('0x67')][_0x1490('0x44')]({'raw':!![]})[_0x1490('0x29')](function(_0x4f1f80){_0x4f1f80['forEach'](function(_0x299ea8){_0x312b43[_0x1490('0x5d')](_0x299ea8['id']+0x15b38);});_0x53f960(_0x312b43);});}else{return db[_0x1490('0x56')][_0x1490('0x44')]({'where':{'sectionId':_0x46271d['id']},'raw':!![]})[_0x1490('0x29')](function(_0x5a2f08){_0x5a2f08[_0x1490('0x65')](function(_0x47b3e6){_0x312b43[_0x1490('0x5d')](_0x47b3e6['resourceId']+0x15b38);});_0x53f960(_0x312b43);});}}catch(_0x346921){_0x1ed3e2(_0x346921);}});}exports[_0x1490('0x68')]=function(_0x74cf98,_0x353968){return db['UserProfile'][_0x1490('0x48')]({'where':{'id':_0x74cf98[_0x1490('0x5a')]['id']}})[_0x1490('0x29')](handleEntityNotFound(_0x353968,null))['then'](function(_0xbe4acb){if(_0xbe4acb){return db[_0x1490('0x51')][_0x1490('0x52')](function(_0x147c39){return db[_0x1490('0x53')][_0x1490('0x44')]({'where':{'userProfileId':_0x74cf98[_0x1490('0x5a')]['id']},'attributes':['id'],'raw':!![]})[_0x1490('0x29')](function(_0x40d91b){if(_0x40d91b){return db['UserProfileSection'][_0x1490('0x28')]({'where':{'userProfileId':_0x74cf98[_0x1490('0x5a')]['id'],'id':_[_0x1490('0x2e')](_0x40d91b,function(_0x152d48){return _0x152d48['id'];})},'transaction':_0x147c39});}})[_0x1490('0x29')](function(_0x3534df){var _0xc36dd9=_[_0x1490('0x2e')](_0x74cf98[_0x1490('0x4a')],function(_0x23bcb5){_0x23bcb5[_0x1490('0x58')]=_0x74cf98[_0x1490('0x5a')]['id'];return _0x23bcb5;});return db['UserProfileSection'][_0x1490('0x69')](_0xc36dd9,{'raw':!![],'transaction':_0x147c39});})[_0x1490('0x29')](function(_0x258c3b){var _0x2d4977=_[_0x1490('0x40')](_[_0x1490('0x2e')](_0x258c3b,function(_0x464b28){return _0x464b28['get']({'plain':!![]});}),{'includeAll':![]});if(_0x2d4977){return db[_0x1490('0x53')][_0x1490('0x44')]({'where':{'userProfileId':_0x74cf98['params']['id'],'sectionId':_[_0x1490('0x2e')](_0x2d4977,function(_0x2aeca5){return _0x2aeca5[_0x1490('0x57')];})},'attributes':['id',_0x1490('0x57')],'raw':!![]})[_0x1490('0x29')](function(_0xedf018){var _0x3ed548=_['map'](_0x74cf98['body'],function(_0x2d1c32){_0x2d1c32[_0x1490('0x58')]=_0x74cf98['params']['id'];return _0x2d1c32;});return db['UserProfileResource'][_0x1490('0x69')](_0x3ed548,{'raw':!![],'transaction':_0x147c39});});}})[_0x1490('0x45')](handleError(_0x353968,null));});}})['then'](function(_0x95240a){var _0x555002=_[_0x1490('0x2e')](_0x95240a,function(_0x54bb59){return _0x54bb59[_0x1490('0x4c')]({'plain':!![]});});})[_0x1490('0x29')](respondWithResult(_0x353968,null))[_0x1490('0x45')](handleError(_0x353968,null));};exports['removeResources']=function(_0x2f290a,_0x440e8c,_0x431806){return db['UserProfile']['find']({'where':{'id':_0x2f290a[_0x1490('0x5a')]['id']}})['then'](handleEntityNotFound(_0x440e8c,null))['then'](function(_0x48fa19){if(_0x48fa19){return _0x48fa19['removeResources'](_0x2f290a[_0x1490('0x32')][_0x1490('0x6a')]);}})[_0x1490('0x29')](respondWithStatusCode(_0x440e8c,null))['catch'](handleError(_0x440e8c,null));};exports[_0x1490('0x6b')]=function(_0x39e67d,_0xe735a8){var _0x1da31e={'raw':![],'where':{}};var _0x3c64bf={};var _0x3d366f={'count':0x0,'rows':[]};var _0x434161=_0x39e67d['query'][_0x1490('0x6c')];if(typeof _0x434161===_0x1490('0x6d')){throw new db['Sequelize'][(_0x1490('0x6e'))](_0x1490('0x6f'));}var _0x1f7147=_0x39e67d['query'][_0x1490('0x70')]||![];var _0x34b778=getQueryModels(_0x434161,_0x1f7147);if(typeof _0x34b778[_0x1490('0x71')]==='undefined'){throw new db[(_0x1490('0x72'))]['ValidationError']('Invalid\x20section\x20\x27'+_0x434161+'\x27');}var _0x528423=[];if(!_[_0x1490('0x73')](_0x34b778['parentSections'])){_0x528423=_0x34b778['parentSections'];}else{_0x528423=[{'name':_0x434161}];}return db[_0x1490('0x2f')][_0x1490('0x63')]({'where':{'id':_0x39e67d[_0x1490('0x5a')]['id']}})['then'](handleEntityNotFound(_0xe735a8,null))[_0x1490('0x29')](function(_0x4ddfc2){if(_0x4ddfc2){var _0x23e19e=[];for(var _0x4fabba=0x0;_0x4fabba<_0x528423[_0x1490('0x39')];_0x4fabba++){_0x23e19e[_0x1490('0x5d')](db[_0x1490('0x53')][_0x1490('0x63')]({'where':{'userProfileId':_0x4ddfc2['id'],'name':_0x528423[_0x4fabba][_0x1490('0x2c')]},'raw':!![]}));}return BPromise[_0x1490('0x74')](_0x23e19e);}})['then'](function(_0x49154f){var _0x145f86=_[_0x1490('0x40')](_0x49154f,function(_0x5afb4b){return _0x5afb4b?_0x5afb4b:undefined;});var _0x61e5e=_['filter'](_0x528423,[_0x1490('0x75'),!![]]);var _0x2c6851=_[_0x1490('0x73')](_0x145f86)&&_[_0x1490('0x73')](_0x61e5e)?null:_[_0x1490('0x76')](_0x61e5e,_0x145f86);if(_0x2c6851){var _0x148ad6=[];for(var _0xb9e7f8=0x0;_0xb9e7f8<_0x2c6851[_0x1490('0x39')];_0xb9e7f8++){var _0x113bac=_[_0x1490('0x48')](_0x528423,function(_0x115906){return _0x2c6851[_0xb9e7f8]?_0x115906['name']===_0x2c6851[_0xb9e7f8][_0x1490('0x2c')]:null;});if(_0x113bac){if(_0x2c6851[_0xb9e7f8][_0x1490('0x75')]){_0x148ad6['push'](getAllResources(_0x34b778[_0x1490('0x71')],_0x2c6851[_0xb9e7f8]));}else{if(!_0x2c6851[_0xb9e7f8]['autoAssociation']){_0x148ad6[_0x1490('0x5d')](getAllowedResources(_0x113bac,_0x2c6851[_0xb9e7f8],_0x34b778[_0x1490('0x71')]));}else{if(_0x113bac['model']){_0x148ad6[_0x1490('0x5d')](getAllFilteredResources(_0x113bac,_0x2c6851[_0xb9e7f8]));}}}}}return BPromise[_0x1490('0x74')](_0x148ad6);}else{return null;}})[_0x1490('0x29')](function(_0x3ce308){var _0x47bb3a=_0x3ce308;var _0x158bd2=null;if(_0x47bb3a){_0x158bd2=_0x47bb3a[_0x1490('0x39')]===0x1?_0x47bb3a[0x0]:null;}if(_0x158bd2||_0x47bb3a){var _0xf75f9e=db[_0x34b778[_0x1490('0x71')]][_0x1490('0x47')];_0x3c64bf[_0x1490('0x35')]=_[_0x1490('0x33')](_0xf75f9e);_0x3c64bf[_0x1490('0x32')]=_[_0x1490('0x33')](_0x39e67d[_0x1490('0x32')]);_0x3c64bf['filters']=_[_0x1490('0x37')](_0x3c64bf['model'],_0x3c64bf['query']);_0x1da31e[_0x1490('0x36')]=_[_0x1490('0x37')](_0x3c64bf[_0x1490('0x35')],qs[_0x1490('0x38')](_0x39e67d[_0x1490('0x32')]['fields']));_0x1da31e['attributes']=_0x1da31e['attributes'][_0x1490('0x39')]?_0x1da31e[_0x1490('0x36')]:_0x3c64bf[_0x1490('0x35')];if(!_0x39e67d[_0x1490('0x32')][_0x1490('0x77')](_0x1490('0x3a'))){_0x1da31e[_0x1490('0x23')]=qs['limit'](_0x39e67d['query'][_0x1490('0x23')]);_0x1da31e[_0x1490('0x22')]=qs[_0x1490('0x22')](_0x39e67d[_0x1490('0x32')][_0x1490('0x22')]);}_0x1da31e[_0x1490('0x78')]=qs[_0x1490('0x79')](_0x39e67d[_0x1490('0x32')][_0x1490('0x79')]);_0x1da31e['where']=qs[_0x1490('0x34')](_[_0x1490('0x3b')](_0x39e67d['query'],_0x3c64bf[_0x1490('0x34')]));if(_0x39e67d[_0x1490('0x32')][_0x1490('0x40')]){_0x1da31e[_0x1490('0x3c')]=_[_0x1490('0x3d')](_0x1da31e[_0x1490('0x3c')],{'$or':_[_0x1490('0x2e')](_0xf75f9e,function(_0x547c40){if(_0x547c40[_0x1490('0x3e')][_0x1490('0x31')]!==_0x1490('0x3f')){var _0xb5d9b0={};_0xb5d9b0[_0x547c40[_0x1490('0x7a')]]={'$like':'%'+_0x39e67d[_0x1490('0x32')][_0x1490('0x40')]+'%'};return _0xb5d9b0;}})});}var _0x1aeae7=[];if(_0x158bd2){var _0xa610e4=_[_0x1490('0x48')](_0x528423,['name',_0x158bd2[_0x1490('0x2c')]]);if(_0xa610e4[_0x1490('0x7a')]){var _0x16cb06={};if(_0x34b778[_0x1490('0x71')]===_0x1490('0x7b')){_0x16cb06[_0xa610e4[_0x1490('0x7c')]]=_[_0x1490('0x2e')](_0x158bd2['associatedResources'],'id');}else{_0x16cb06[_0xa610e4[_0x1490('0x7c')]]=_0x158bd2['associatedResources'];}_0x1aeae7['push'](_0x16cb06);}else{_0x1da31e['where']['id']=_0x158bd2[_0x1490('0x7d')];}}else{for(var _0x1d8dae=0x0;_0x1d8dae<_0x47bb3a[_0x1490('0x39')];_0x1d8dae++){var _0xa610e4=_['find'](_0x528423,[_0x1490('0x2c'),_0x47bb3a[_0x1d8dae]['name']]);if(_0xa610e4[_0x1490('0x7a')]){var _0x16cb06={};_0x16cb06[_0xa610e4[_0x1490('0x7c')]]=_0x47bb3a[_0x1d8dae]['associatedResources'];_0x1aeae7[_0x1490('0x5d')](_0x16cb06);}else{if(!_0x1da31e['where']['id'])_0x1da31e[_0x1490('0x3c')]['id']=[];_0x47bb3a[_0x1d8dae][_0x1490('0x7d')]['forEach'](function(_0x5b6b1c){_0x1da31e[_0x1490('0x3c')]['id'][_0x1490('0x5d')](_0x5b6b1c);});}}}if(!_[_0x1490('0x73')](_0x1aeae7)){_0x1da31e[_0x1490('0x3c')]=_[_0x1490('0x3d')](_0x1da31e[_0x1490('0x3c')],{'$and':{'$or':_0x1aeae7}});}_0x1da31e=_['merge']({},_0x1da31e,_0x39e67d[_0x1490('0x41')]);if(_0x158bd2&&!_0x158bd2[_0x1490('0x55')]&&_0x34b778[_0x1490('0x71')]==='AnalyticExtractedReport'){if(_0x39e67d[_0x1490('0x32')][_0x1490('0x42')]){_0x1da31e[_0x1490('0x43')]=[{'all':!![]}];}return db[_0x34b778[_0x1490('0x71')]]['findAll'](_0x1da31e)['then'](function(_0x2a5221){var _0x494858=[];_0x2a5221['forEach'](function(_0x24076d){var _0x38fefc;switch(_0x24076d[_0x1490('0x7e')]){case'default':_0x38fefc=_[_0x1490('0x48')](_0x158bd2[_0x1490('0x7d')],function(_0x310ee3){return _0x310ee3['id']===_0x24076d[_0x1490('0x7f')]&&_0x310ee3[_0x1490('0x3e')]==='DefaultReports';});break;case _0x1490('0x80'):_0x38fefc=_['find'](_0x158bd2[_0x1490('0x7d')],function(_0x259f7d){return _0x259f7d['id']===_0x24076d[_0x1490('0x7f')]&&_0x259f7d[_0x1490('0x3e')]===_0x1490('0x81');});break;}if(_0x38fefc)_0x494858[_0x1490('0x5d')](_0x24076d);});_0x3d366f[_0x1490('0x21')]=_0x494858[_0x1490('0x39')];_0x3d366f[_0x1490('0x82')]=_0x494858;return _0x3d366f;});}else{return db[_0x34b778['childModel']][_0x1490('0x21')]({'where':_0x1da31e[_0x1490('0x3c')]})[_0x1490('0x29')](function(_0x53edf3){_0x3d366f[_0x1490('0x21')]=_0x53edf3;if(_0x39e67d['query'][_0x1490('0x42')]){if(_0x34b778['childModel']===_0x1490('0x83')){_0x1da31e[_0x1490('0x43')]=[{'model':db[_0x1490('0x84')],'as':_0x1490('0x85'),'attributes':['id',_0x1490('0x2c'),'color'],'required':_0x39e67d[_0x1490('0x32')][_0x1490('0x86')]?!![]:![]},{'model':db['Tag'],'as':_0x1490('0x87'),'attributes':['id',_0x1490('0x2c'),_0x1490('0x88')],'through':_0x39e67d[_0x1490('0x32')]['tag']?{'attributes':[],'where':{'TagId':_0x39e67d['query'][_0x1490('0x86')]||undefined}}:{},'required':_0x39e67d['query'][_0x1490('0x86')]?!![]:![]}];}else{_0x1da31e[_0x1490('0x43')]=[{'all':!![]}];}}return db[_0x34b778[_0x1490('0x71')]]['findAll'](_0x1da31e);})[_0x1490('0x29')](function(_0x2d5325){_0x3d366f[_0x1490('0x82')]=_0x2d5325;return _0x3d366f;});}}else{return _0x3d366f;}})['then'](respondWithFilteredResult(_0xe735a8,_0x1da31e))['catch'](handleError(_0xe735a8,null));};function getAllResources(_0x1d0a30,_0x370c88){return new BPromise(function(_0x2c3dc8,_0x37dda7){if(_0x370c88){var _0x39aece=_0x370c88[_0x1490('0x40')]?{[_0x370c88[_0x1490('0x40')][_0x1490('0x7a')]]:_0x370c88[_0x1490('0x40')][_0x1490('0x89')]}:undefined;return db[_0x1d0a30]['findAll']({'where':_0x39aece,'raw':!![]})[_0x1490('0x29')](function(_0x2e122e){_0x370c88[_0x1490('0x7d')]=_[_0x1490('0x2e')](_0x2e122e,'id');_0x2c3dc8(_0x370c88);})[_0x1490('0x45')](function(_0x240da0){_0x37dda7(_0x240da0);});}else{_0x2c3dc8(null);}});}function getAllFilteredResources(_0x1ac7d0,_0x2fcd9f){return new BPromise(function(_0x31272b,_0xa27990){var _0x22da70=_0x1ac7d0[_0x1490('0x40')]?{[_0x1ac7d0[_0x1490('0x40')]['field']]:_0x1ac7d0[_0x1490('0x40')]['value']}:undefined;return db[_0x1ac7d0[_0x1490('0x35')]][_0x1490('0x44')]({'where':_0x22da70,'raw':!![]})[_0x1490('0x29')](function(_0x5962b7){_0x2fcd9f['associatedResources']=_[_0x1490('0x2e')](_0x5962b7,function(_0x4969b3){return _0x4969b3[_0x1490('0x2c')];});_0x31272b(_0x2fcd9f);})[_0x1490('0x45')](function(_0x7cf1f4){_0xa27990(_0x7cf1f4);});});}function getAllowedResources(_0x472908,_0x3600c5,_0x328e3b){return new BPromise(function(_0x2b0fdd,_0x49edce){if(_0x3600c5){return db[_0x1490('0x56')][_0x1490('0x44')]({'where':{'sectionId':_0x3600c5['id']},'raw':!![]})[_0x1490('0x29')](function(_0x2db136){if(_0x472908[_0x1490('0x7a')]&&_0x472908[_0x1490('0x7a')]!=='id'){_0x3600c5[_0x1490('0x7d')]=_[_0x1490('0x2e')](_0x2db136,function(_0x13a69b){return _0x13a69b[_0x472908[_0x1490('0x7a')]];});}else{if(_0x328e3b===_0x1490('0x7b')){_0x3600c5['associatedResources']=_['map'](_0x2db136,function(_0x55d7e5){return{'id':_0x55d7e5[_0x1490('0x66')],'type':_0x55d7e5[_0x1490('0x3e')]};});}else{_0x3600c5[_0x1490('0x7d')]=_[_0x1490('0x2e')](_0x2db136,function(_0x22054d){return _0x22054d[_0x1490('0x66')];});}}_0x2b0fdd(_0x3600c5);})[_0x1490('0x45')](function(_0x4e0838){_0x49edce(_0x4e0838);});}else{_0x2b0fdd(null);}});}function getQueryModels(_0x23daf7,_0x4e6d44){var _0x4b994f=_0x23daf7[_0x1490('0x8a')]();var _0x4b836b={'childModel':undefined,'parentSections':[]};switch(_0x4b994f){case _0x1490('0x8b'):_0x4b836b[_0x1490('0x71')]=_0x1490('0x8c');break;case'odbc':_0x4b836b[_0x1490('0x71')]=_0x1490('0x8d');break;case'squarerecordings':_0x4b836b['childModel']=_0x1490('0x8e');_0x4b836b[_0x1490('0x8f')]=[{'name':_0x1490('0x90'),'field':_0x1490('0x2c'),'foreignKey':_0x1490('0x91')}];break;case _0x1490('0x92'):_0x4b836b['childModel']=_0x1490('0x93');break;case _0x1490('0x94'):_0x4b836b[_0x1490('0x71')]=_0x1490('0x83');_0x4b836b[_0x1490('0x8f')]=[{'name':'Lists','field':'id','foreignKey':'ListId'}];break;case _0x1490('0x95'):_0x4b836b[_0x1490('0x71')]=_0x1490('0x96');break;case _0x1490('0x97'):_0x4b836b['childModel']=_0x1490('0x98');break;case _0x1490('0x99'):_0x4b836b[_0x1490('0x71')]=_0x1490('0x9a');break;case _0x1490('0x9b'):_0x4b836b[_0x1490('0x71')]=_0x1490('0x9c');break;case _0x1490('0x9d'):_0x4b836b[_0x1490('0x71')]='ChatWebsite';break;case _0x1490('0x9e'):_0x4b836b[_0x1490('0x71')]='FaxQueue';break;case _0x1490('0x9f'):_0x4b836b[_0x1490('0x71')]=_0x1490('0xa0');break;case _0x1490('0xa1'):case'internalroutes':case _0x1490('0xa2'):_0x4b836b[_0x1490('0x71')]=_0x1490('0xa3');break;case _0x1490('0xa4'):_0x4b836b['childModel']=_0x1490('0xa5');break;case'voicemails':_0x4b836b[_0x1490('0x71')]=_0x1490('0xa6');break;case _0x1490('0xa7'):_0x4b836b[_0x1490('0x71')]=_0x1490('0xa8');_0x4b836b[_0x1490('0x8f')]=[{'name':'Agents','field':_0x1490('0x2c'),'foreignKey':_0x1490('0xa9'),'model':_0x1490('0xaa'),'filter':{'field':_0x1490('0xab'),'value':[_0x1490('0xac')]}},{'name':_0x1490('0xad'),'field':'name','foreignKey':'membername','model':'User','filter':{'field':_0x1490('0xab'),'value':[_0x1490('0xae')]}},{'name':_0x1490('0xaf'),'field':'name','foreignKey':'queue','model':_0x1490('0xb0'),'filter':{'field':'type','value':['inbound']}},{'name':_0x1490('0xb1'),'field':'name','foreignKey':_0x1490('0xb2'),'model':_0x1490('0xb0'),'filter':{'field':_0x1490('0x3e'),'value':['outbound']}}];break;case _0x1490('0xb3'):_0x4b836b[_0x1490('0x71')]='VoiceMusicOnHold';break;case _0x1490('0xb4'):_0x4b836b['childModel']='VoiceChanSpy';break;case _0x1490('0xb5'):_0x4b836b[_0x1490('0x71')]=_0x1490('0xb6');break;case'ivrcampaigns':_0x4b836b['childModel']=_0x1490('0xb7');break;case _0x1490('0xb8'):_0x4b836b[_0x1490('0x71')]=_0x1490('0xb9');break;case _0x1490('0xba'):_0x4b836b[_0x1490('0x71')]=_0x1490('0xbb');break;case _0x1490('0xbc'):_0x4b836b[_0x1490('0x71')]=_0x1490('0xbd');break;case _0x1490('0xbe'):_0x4b836b['childModel']=_0x1490('0xbf');break;case _0x1490('0xc0'):_0x4b836b[_0x1490('0x71')]='OpenchannelAccount';break;case _0x1490('0xc1'):_0x4b836b[_0x1490('0x71')]=_0x1490('0xc2');break;case'smsaccounts':_0x4b836b[_0x1490('0x71')]=_0x1490('0xc3');break;case'whatsappqueues':_0x4b836b[_0x1490('0x71')]='WhatsappQueue';break;case _0x1490('0xc4'):_0x4b836b['childModel']='WhatsappAccount';break;case _0x1490('0xc5'):_0x4b836b[_0x1490('0x71')]='Team';break;case _0x1490('0xc6'):case _0x1490('0xc7'):_0x4b836b[_0x1490('0x71')]=_0x1490('0xb0');if(_0x4e6d44){_0x4b836b[_0x1490('0x8f')]=[{'name':_0x1490('0xaf')},{'name':'QueueCampaigns'}];}break;case _0x1490('0xc8'):case _0x1490('0xc9'):case _0x1490('0xca'):_0x4b836b[_0x1490('0x71')]=_0x1490('0xaa');if(_0x4e6d44){_0x4b836b['parentSections']=[{'name':_0x1490('0xcb'),'filter':{'field':_0x1490('0xab'),'value':[_0x1490('0xcc'),_0x1490('0xcd')]},'ignore':!![]},{'name':_0x1490('0xce')},{'name':_0x1490('0xad')}];}break;case _0x1490('0xcf'):_0x4b836b['childModel']='ZendeskAccount';break;case _0x1490('0xd0'):_0x4b836b[_0x1490('0x71')]=_0x1490('0xd1');break;case _0x1490('0xd2'):_0x4b836b[_0x1490('0x71')]=_0x1490('0xd3');break;case'sugarcrmaccounts':_0x4b836b[_0x1490('0x71')]='SugarcrmAccount';break;case _0x1490('0xd4'):_0x4b836b[_0x1490('0x71')]='DeskAccount';break;case'zohoaccounts':_0x4b836b['childModel']=_0x1490('0xd5');break;case _0x1490('0xd6'):_0x4b836b['childModel']=_0x1490('0xaa');break;case'cannedanswers':_0x4b836b[_0x1490('0x71')]=_0x1490('0xd7');break;case _0x1490('0xd8'):_0x4b836b[_0x1490('0x71')]=_0x1490('0xd9');break;case _0x1490('0xda'):_0x4b836b['childModel']=_0x1490('0x64');break;case _0x1490('0xdb'):_0x4b836b[_0x1490('0x71')]=_0x1490('0xdc');break;case _0x1490('0xdd'):_0x4b836b[_0x1490('0x71')]=_0x1490('0xde');break;case _0x1490('0xdf'):_0x4b836b['childModel']='Schedule';break;case _0x1490('0xe0'):_0x4b836b[_0x1490('0x71')]='Sound';break;case _0x1490('0xe1'):_0x4b836b[_0x1490('0x71')]=_0x1490('0x84');break;case _0x1490('0xe2'):_0x4b836b[_0x1490('0x71')]='Template';break;case _0x1490('0xe3'):_0x4b836b[_0x1490('0x71')]=_0x1490('0xe4');break;case _0x1490('0xe5'):_0x4b836b[_0x1490('0x71')]='Trunk';break;case'variables':_0x4b836b[_0x1490('0x71')]=_0x1490('0xe6');break;case _0x1490('0xe7'):_0x4b836b[_0x1490('0x71')]=_0x1490('0x67');break;case'extractedreports':_0x4b836b[_0x1490('0x71')]=_0x1490('0x7b');_0x4b836b['parentSections']=[{'name':_0x1490('0xe8'),'field':'id','foreignKey':_0x1490('0x7f')}];break;case'metrics':_0x4b836b['childModel']='AnalyticMetric';break;case _0x1490('0xc4'):_0x4b836b['childModel']=_0x1490('0xe9');break;default:return _0x4b836b;}return _0x4b836b;} \ No newline at end of file +var _0xcf77=['reportId','DefaultReports','custom','CustomReports','rows','CmContact','color','tag','Tag','ThroughTags','value','resourceId','toLowerCase','squareprojects','SquareProject','odbc','SquareOdbc','squarerecordings','SquareProjects','projectName','projects','contacts','Lists','lists','CmList','companies','CmCompany','globalcustomfields','ChatQueue','chatwebsites','ChatWebsite','faxqueues','FaxQueue','inboundroutes','outboundroutes','contexts','VoiceContext','voicemails','VoiceMail','voicerecordings','VoiceRecording','Agents','membername','User','agent','Telephones','role','telephone','VoiceQueues','queue','inbound','QueueCampaigns','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','VoicePrefix','ivrcampaigns','Campaign','MailQueue','mailaccounts','MailAccount','mailsubstatuses','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','whatsappqueues','WhatsappQueue','teams','Team','voicequeues','queuecampaigns','users','agents','telephones','Users','admin','user','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','Disposition','Dashboard','intervals','Interval','pauses','scheduler','Schedule','sounds','tags','triggers','trunks','variables','extractedreports','Reports','metrics','AnalyticMetric','whatsappaccounts','eml-format','rimraf','zip-dir','request-promise','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/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./userProfile.socket','register','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','send','index','UserProfile','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','nolimit','limit','sort','where','merge','filter','options','includeAll','findAll','show','rawAttributes','length','include','find','create','body','catch','clone','params','get','omit','updatedAt','crudPermissions','createdAt','sequelize','transaction','UserProfileSection','each','UserProfileResource','sectionId','Resources','describe','addSections','userProfileId','push','removeSections','ids','enabled','includes','isEmpty','subsections','autoAssociation','findOne','forEach','Plugin','addResources','bulkCreate','removeResources','getResources','section','Sequelize','ValidationError','Unknown\x20section','childModel','undefined','parentSections','ignore','union','all','order','pick','VIRTUAL','field','AnalyticExtractedReport','foreignKey','associatedResources','reportType','default'];(function(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0xcf77,0x71));var _0x7cf7=function(_0x3f994f,_0x3e0a6c){_0x3f994f=_0x3f994f-0x0;var _0x5755f8=_0xcf77[_0x3f994f];return _0x5755f8;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x7cf7('0x0'));var rimraf=require(_0x7cf7('0x1'));var zipdir=require(_0x7cf7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7cf7('0x3'));var moment=require('moment');var BPromise=require(_0x7cf7('0x4'));var Mustache=require('mustache');var util=require(_0x7cf7('0x5'));var path=require(_0x7cf7('0x6'));var sox=require(_0x7cf7('0x7'));var csv=require(_0x7cf7('0x8'));var ejs=require(_0x7cf7('0x9'));var fs=require('fs');var _=require(_0x7cf7('0xa'));var squel=require(_0x7cf7('0xb'));var crypto=require(_0x7cf7('0xc'));var jsforce=require(_0x7cf7('0xd'));var deskjs=require(_0x7cf7('0xe'));var toCsv=require(_0x7cf7('0x8'));var querystring=require(_0x7cf7('0xf'));var Papa=require(_0x7cf7('0x10'));var Redis=require(_0x7cf7('0x11'));var authService=require(_0x7cf7('0x12'));var qs=require(_0x7cf7('0x13'));var as=require(_0x7cf7('0x14'));var hardwareService=require(_0x7cf7('0x15'));var logger=require(_0x7cf7('0x16'))(_0x7cf7('0x17'));var utils=require(_0x7cf7('0x18'));var config=require(_0x7cf7('0x19'));var db=require(_0x7cf7('0x1a'))['db'];config['redis']=_[_0x7cf7('0x1b')](config[_0x7cf7('0x1c')],{'host':_0x7cf7('0x1d'),'port':0x18eb});var socket=require(_0x7cf7('0x1e'))(new Redis(config[_0x7cf7('0x1c')]));require(_0x7cf7('0x1f'))[_0x7cf7('0x20')](socket);function respondWithStatusCode(_0x363aaf,_0x5b084b){_0x5b084b=_0x5b084b||0xcc;return function(_0x132626){if(_0x132626){return _0x363aaf[_0x7cf7('0x21')](_0x5b084b);}return _0x363aaf[_0x7cf7('0x22')](_0x5b084b)['end']();};}function respondWithResult(_0x3476a2,_0x56aeb4){_0x56aeb4=_0x56aeb4||0xc8;return function(_0x33cc22){if(_0x33cc22){return _0x3476a2['status'](_0x56aeb4)[_0x7cf7('0x23')](_0x33cc22);}};}function respondWithFilteredResult(_0x10ae66,_0x516b9a){return function(_0x128816){if(_0x128816){var _0x34d79f=_0x128816[_0x7cf7('0x24')],_0x56d8b9=_0x516b9a[_0x7cf7('0x25')],_0x578dbe=_0x516b9a[_0x7cf7('0x25')]+_0x516b9a['limit'],_0x13a040;if(_0x578dbe>=_0x34d79f){_0x578dbe=_0x34d79f;_0x13a040=0xc8;}else{_0x13a040=0xce;}_0x10ae66[_0x7cf7('0x22')](_0x13a040);return _0x10ae66[_0x7cf7('0x26')](_0x7cf7('0x27'),_0x56d8b9+'-'+_0x578dbe+'/'+_0x34d79f)['json'](_0x128816);}return null;};}function patchUpdates(_0x258dfa){return function(_0x2c3d9d){try{jsonpatch[_0x7cf7('0x28')](_0x2c3d9d,_0x258dfa,!![]);}catch(_0x33b72d){return BPromise[_0x7cf7('0x29')](_0x33b72d);}return _0x2c3d9d[_0x7cf7('0x2a')]();};}function saveUpdates(_0x5dd5f2,_0x225ac6){return function(_0x5a6d62){if(_0x5a6d62){return _0x5a6d62[_0x7cf7('0x2b')](_0x5dd5f2)[_0x7cf7('0x2c')](function(_0x52b10f){return _0x52b10f;});}return null;};}function removeEntity(_0x470995,_0x5d2cb6){return function(_0x4350a4){if(_0x4350a4){return _0x4350a4[_0x7cf7('0x2d')]()[_0x7cf7('0x2c')](function(){_0x470995[_0x7cf7('0x22')](0xcc)[_0x7cf7('0x2e')]();});}};}function handleEntityNotFound(_0x25476f,_0x33fb86){return function(_0x3792d2){if(!_0x3792d2){_0x25476f['sendStatus'](0x194);}return _0x3792d2;};}function handleError(_0x400b0b,_0x2fa9b8){_0x2fa9b8=_0x2fa9b8||0x1f4;return function(_0x2a67f2){logger['error'](_0x2a67f2[_0x7cf7('0x2f')]);if(_0x2a67f2[_0x7cf7('0x30')]){delete _0x2a67f2[_0x7cf7('0x30')];}_0x400b0b[_0x7cf7('0x22')](_0x2fa9b8)[_0x7cf7('0x31')](_0x2a67f2);};}exports[_0x7cf7('0x32')]=function(_0x5c640e,_0x344565){var _0x385c45={},_0x378006={},_0x1417bd={'count':0x0,'rows':[]};var _0x4b22f3=_['map'](db[_0x7cf7('0x33')]['rawAttributes'],function(_0x545e82){return{'name':_0x545e82[_0x7cf7('0x34')],'type':_0x545e82[_0x7cf7('0x35')][_0x7cf7('0x36')]};});_0x378006[_0x7cf7('0x37')]=_[_0x7cf7('0x38')](_0x4b22f3,'name');_0x378006[_0x7cf7('0x39')]=_[_0x7cf7('0x3a')](_0x5c640e[_0x7cf7('0x39')]);_0x378006[_0x7cf7('0x3b')]=_[_0x7cf7('0x3c')](_0x378006[_0x7cf7('0x37')],_0x378006[_0x7cf7('0x39')]);_0x385c45[_0x7cf7('0x3d')]=_[_0x7cf7('0x3c')](_0x378006['model'],qs[_0x7cf7('0x3e')](_0x5c640e[_0x7cf7('0x39')][_0x7cf7('0x3e')]));_0x385c45[_0x7cf7('0x3d')]=_0x385c45[_0x7cf7('0x3d')]['length']?_0x385c45[_0x7cf7('0x3d')]:_0x378006[_0x7cf7('0x37')];if(!_0x5c640e[_0x7cf7('0x39')]['hasOwnProperty'](_0x7cf7('0x3f'))){_0x385c45[_0x7cf7('0x40')]=qs[_0x7cf7('0x40')](_0x5c640e[_0x7cf7('0x39')]['limit']);_0x385c45['offset']=qs[_0x7cf7('0x25')](_0x5c640e[_0x7cf7('0x39')][_0x7cf7('0x25')]);}_0x385c45['order']=qs[_0x7cf7('0x41')](_0x5c640e[_0x7cf7('0x39')]['sort']);_0x385c45[_0x7cf7('0x42')]=qs[_0x7cf7('0x3b')](_['pick'](_0x5c640e[_0x7cf7('0x39')],_0x378006[_0x7cf7('0x3b')]),_0x4b22f3);if(_0x5c640e[_0x7cf7('0x39')]['filter']){_0x385c45['where']=_[_0x7cf7('0x43')](_0x385c45['where'],{'$or':_[_0x7cf7('0x38')](_0x4b22f3,function(_0x15641d){if(_0x15641d[_0x7cf7('0x35')]!=='VIRTUAL'){var _0x240e10={};_0x240e10[_0x15641d[_0x7cf7('0x30')]]={'$like':'%'+_0x5c640e['query'][_0x7cf7('0x44')]+'%'};return _0x240e10;}})});}_0x385c45=_[_0x7cf7('0x43')]({},_0x385c45,_0x5c640e[_0x7cf7('0x45')]);var _0x16c3f5={'where':_0x385c45[_0x7cf7('0x42')]};return db['UserProfile'][_0x7cf7('0x24')](_0x16c3f5)['then'](function(_0x27eec8){_0x1417bd[_0x7cf7('0x24')]=_0x27eec8;if(_0x5c640e[_0x7cf7('0x39')][_0x7cf7('0x46')]){_0x385c45['include']=[{'all':!![]}];}return db[_0x7cf7('0x33')][_0x7cf7('0x47')](_0x385c45);})[_0x7cf7('0x2c')](function(_0x4abe16){_0x1417bd['rows']=_0x4abe16;return _0x1417bd;})[_0x7cf7('0x2c')](respondWithFilteredResult(_0x344565,_0x385c45))['catch'](handleError(_0x344565,null));};exports[_0x7cf7('0x48')]=function(_0x3714f0,_0x16cbf9){var _0x193977={'raw':![],'where':{'id':_0x3714f0['params']['id']}},_0x3b9b1e={};_0x3b9b1e[_0x7cf7('0x37')]=_['keys'](db[_0x7cf7('0x33')][_0x7cf7('0x49')]);_0x3b9b1e[_0x7cf7('0x39')]=_[_0x7cf7('0x3a')](_0x3714f0['query']);_0x3b9b1e[_0x7cf7('0x3b')]=_[_0x7cf7('0x3c')](_0x3b9b1e[_0x7cf7('0x37')],_0x3b9b1e[_0x7cf7('0x39')]);_0x193977['attributes']=_[_0x7cf7('0x3c')](_0x3b9b1e[_0x7cf7('0x37')],qs[_0x7cf7('0x3e')](_0x3714f0[_0x7cf7('0x39')][_0x7cf7('0x3e')]));_0x193977[_0x7cf7('0x3d')]=_0x193977[_0x7cf7('0x3d')][_0x7cf7('0x4a')]?_0x193977['attributes']:_0x3b9b1e[_0x7cf7('0x37')];if(_0x3714f0[_0x7cf7('0x39')]['includeAll']){_0x193977[_0x7cf7('0x4b')]=[{'all':!![]}];}_0x193977=_[_0x7cf7('0x43')]({},_0x193977,_0x3714f0[_0x7cf7('0x45')]);return db[_0x7cf7('0x33')][_0x7cf7('0x4c')](_0x193977)['then'](handleEntityNotFound(_0x16cbf9,null))[_0x7cf7('0x2c')](respondWithResult(_0x16cbf9,null))['catch'](handleError(_0x16cbf9,null));};exports[_0x7cf7('0x4d')]=function(_0x1ec899,_0x56ee75){return db[_0x7cf7('0x33')][_0x7cf7('0x4d')](_0x1ec899[_0x7cf7('0x4e')],{})[_0x7cf7('0x2c')](respondWithResult(_0x56ee75,0xc9))[_0x7cf7('0x4f')](handleError(_0x56ee75,null));};exports[_0x7cf7('0x50')]=function(_0x36a226,_0x32b994){var _0x3b0c12={'where':{'id':_0x36a226[_0x7cf7('0x51')]['id']}},_0x377d7b={};_0x377d7b[_0x7cf7('0x37')]=_[_0x7cf7('0x3a')](db[_0x7cf7('0x33')][_0x7cf7('0x49')]);_0x3b0c12[_0x7cf7('0x3d')]=_[_0x7cf7('0x3c')](_0x377d7b[_0x7cf7('0x37')],qs['fields'](_0x36a226[_0x7cf7('0x39')][_0x7cf7('0x3e')]));_0x3b0c12[_0x7cf7('0x3d')]=_0x3b0c12[_0x7cf7('0x3d')][_0x7cf7('0x4a')]?_0x3b0c12[_0x7cf7('0x3d')]:_0x377d7b[_0x7cf7('0x37')];if(_0x36a226[_0x7cf7('0x39')]['includeAll']){_0x3b0c12['include']=[{'all':!![]}];}_0x3b0c12=_[_0x7cf7('0x43')]({},_0x3b0c12,_0x36a226[_0x7cf7('0x45')]);return db[_0x7cf7('0x33')]['find'](_0x3b0c12)[_0x7cf7('0x2c')](handleEntityNotFound(_0x32b994,null))[_0x7cf7('0x2c')](function(_0x3dbc2f){if(_0x3dbc2f){var _0x56b50b=_0x3dbc2f[_0x7cf7('0x52')]({'plain':!![]});_0x56b50b=qs[_0x7cf7('0x53')](_0x56b50b,['id','createdAt',_0x7cf7('0x54'),_0x7cf7('0x55')]);_0x36a226[_0x7cf7('0x4e')]=_['omit'](_0x36a226[_0x7cf7('0x4e')],['id',_0x7cf7('0x56'),_0x7cf7('0x54')]);return db[_0x7cf7('0x57')][_0x7cf7('0x58')](function(_0x4c4c73){return db[_0x7cf7('0x33')][_0x7cf7('0x4d')](_[_0x7cf7('0x43')](_0x56b50b,_0x36a226[_0x7cf7('0x4e')]),{'include':_0x36a226[_0x7cf7('0x39')]['includeAll']?[{'all':!![]}]:undefined,'transaction':_0x4c4c73})[_0x7cf7('0x2c')](function(_0x2a63e2){var _0x2369df=_0x2a63e2[_0x7cf7('0x52')]({'plain':!![]});return db[_0x7cf7('0x59')][_0x7cf7('0x47')]({'where':{'userProfileId':_0x36a226[_0x7cf7('0x51')]['id']},'raw':!![]})[_0x7cf7('0x2c')](function(_0xf50e0b){if(_0xf50e0b){return BPromise[_0x7cf7('0x5a')](_0xf50e0b,function(_0xe7c08a){return new BPromise(function(_0x5a0f93,_0x3d7ea4){if(_0xe7c08a['autoAssociation']===null||_0xe7c08a['autoAssociation']===0x1)_0x5a0f93(null);return db[_0x7cf7('0x5b')][_0x7cf7('0x47')]({'where':{'sectionId':_0xe7c08a['id']},'raw':!![]})[_0x7cf7('0x2c')](function(_0x54a452){var _0x2ce64b=_['map'](_0x54a452,function(_0x37738a){return qs[_0x7cf7('0x53')](_0x37738a,['id',_0x7cf7('0x56'),_0x7cf7('0x54'),_0x7cf7('0x5c')]);});_0x5a0f93(_0x2ce64b);})[_0x7cf7('0x4f')](function(_0xc13697){_0x3d7ea4(_0xc13697);});})['then'](function(_0x2c6d9f){var _0x195bf1=qs[_0x7cf7('0x53')](_0xe7c08a,['id',_0x7cf7('0x56'),_0x7cf7('0x54')]);_0x195bf1['userProfileId']=_0x2369df['id'];if(_0x2c6d9f)_0x195bf1['Resources']=_0x2c6d9f;return _0x195bf1;})[_0x7cf7('0x2c')](function(_0x3e02f0){return db[_0x7cf7('0x59')]['create'](_0x3e02f0,{'include':[{'model':db[_0x7cf7('0x5b')],'as':_0x7cf7('0x5d')}],'raw':!![],'transaction':_0x4c4c73});});})[_0x7cf7('0x2c')](function(){return _0x2369df;});}});});});}})[_0x7cf7('0x2c')](respondWithResult(_0x32b994,0xc9))[_0x7cf7('0x4f')](handleError(_0x32b994,null));};exports['update']=function(_0x362110,_0x149bbe){if(_0x362110[_0x7cf7('0x4e')]['id']){delete _0x362110[_0x7cf7('0x4e')]['id'];}return db['UserProfile']['find']({'where':{'id':_0x362110[_0x7cf7('0x51')]['id']}})['then'](handleEntityNotFound(_0x149bbe,null))[_0x7cf7('0x2c')](saveUpdates(_0x362110[_0x7cf7('0x4e')],null))[_0x7cf7('0x2c')](respondWithResult(_0x149bbe,null))[_0x7cf7('0x4f')](handleError(_0x149bbe,null));};exports[_0x7cf7('0x2d')]=function(_0x16c677,_0x54204f){return db[_0x7cf7('0x33')][_0x7cf7('0x4c')]({'where':{'id':_0x16c677[_0x7cf7('0x51')]['id']}})[_0x7cf7('0x2c')](handleEntityNotFound(_0x54204f,null))[_0x7cf7('0x2c')](removeEntity(_0x54204f,null))[_0x7cf7('0x4f')](handleError(_0x54204f,null));};exports[_0x7cf7('0x5e')]=function(_0x46d233,_0x38120a){return db[_0x7cf7('0x33')]['describe']()['then'](respondWithResult(_0x38120a,null))['catch'](handleError(_0x38120a,null));};exports[_0x7cf7('0x5f')]=function(_0x2ced65,_0x1caa85){var _0x41a6f6=_0x2ced65[_0x7cf7('0x4e')];return db[_0x7cf7('0x33')][_0x7cf7('0x4c')]({'where':{'id':_0x2ced65['params']['id']}})[_0x7cf7('0x2c')](handleEntityNotFound(_0x1caa85,null))['then'](function(_0x31d1d2){if(_0x31d1d2){return db['sequelize'][_0x7cf7('0x58')](function(_0x4b90b7){return db[_0x7cf7('0x59')][_0x7cf7('0x2d')]({'where':{'userProfileId':_0x2ced65[_0x7cf7('0x51')]['id'],'sectionId':_[_0x7cf7('0x38')](_0x41a6f6,function(_0x1ea9b6){return _0x1ea9b6[_0x7cf7('0x5c')];})},'transaction':_0x4b90b7})[_0x7cf7('0x2c')](function(){var _0x549808=_[_0x7cf7('0x38')](_0x41a6f6,function(_0x595fd3){_0x595fd3[_0x7cf7('0x60')]=_0x2ced65['params']['id'];return _0x595fd3;});var _0x8e69b=[];return BPromise[_0x7cf7('0x5a')](_0x549808,function(_0x3fb5eb){return db[_0x7cf7('0x59')][_0x7cf7('0x4d')](_0x3fb5eb,{'include':[{'model':db['UserProfileResource'],'as':_0x7cf7('0x5d')}],'raw':!![],'transaction':_0x4b90b7})['then'](function(_0x2c0b18){_0x8e69b[_0x7cf7('0x61')](_0x2c0b18[_0x7cf7('0x52')]({'plain':!![]}));});})[_0x7cf7('0x2c')](function(){return _0x8e69b;});});});}})[_0x7cf7('0x2c')](function(_0x16934c){return _0x16934c;})['then'](respondWithResult(_0x1caa85,null))[_0x7cf7('0x4f')](handleError(_0x1caa85,null));};exports[_0x7cf7('0x62')]=function(_0x409b18,_0x136c35){var _0x1de681;return db[_0x7cf7('0x33')][_0x7cf7('0x4c')]({'where':{'id':_0x409b18['params']['id']},'attributes':['id',_0x7cf7('0x30')]})['then'](handleEntityNotFound(_0x136c35,null))[_0x7cf7('0x2c')](function(_0x42d6b4){if(_0x42d6b4){_0x1de681=_0x42d6b4;return db[_0x7cf7('0x59')][_0x7cf7('0x2d')]({'where':{'userProfileId':_0x409b18[_0x7cf7('0x51')]['id'],'sectionId':_0x409b18[_0x7cf7('0x39')][_0x7cf7('0x63')]}});}})[_0x7cf7('0x2c')](function(){return _0x1de681;})[_0x7cf7('0x2c')](respondWithStatusCode(_0x136c35,null))[_0x7cf7('0x4f')](handleError(_0x136c35,null));};exports['getSections']=function(_0x2eccae,_0x32e9ee){var _0x333878=[];var _0x48711e=[];return db[_0x7cf7('0x59')][_0x7cf7('0x47')]({'where':{'userProfileId':_0x2eccae[_0x7cf7('0x51')]['id']},'raw':!![]})[_0x7cf7('0x2c')](function(_0x266800){_0x333878=_[_0x7cf7('0x44')](_0x266800,function(_0x8de06e){return _0x8de06e[_0x7cf7('0x64')]===0x1||_[_0x7cf7('0x65')]([0x3eb,0x709],_0x8de06e[_0x7cf7('0x5c')]);});if(!_[_0x7cf7('0x66')](_0x333878)){return _[_0x7cf7('0x38')](_0x333878,function(_0x1a8b95){return _0x1a8b95[_0x7cf7('0x5c')];});}else{return;}})[_0x7cf7('0x2c')](function(_0x25a7dd){if(_0x25a7dd)_0x48711e=_0x25a7dd;if(_['includes'](_0x48711e,0x64)){var _0x2df791=_[_0x7cf7('0x4c')](_0x333878,{'sectionId':0x64});return hasDefaultDashboard(_0x2df791)['then'](function(_0x7e687a){return _[_0x7cf7('0x38')](_0x333878,function(_0x16f409){if(_0x16f409[_0x7cf7('0x5c')]===0x64){_0x16f409[_0x7cf7('0x67')]=_0x7e687a;}return _0x16f409;});});}else{return;}})[_0x7cf7('0x2c')](function(_0x11e1c1){if(_0x11e1c1)_0x333878=_0x11e1c1;if(_[_0x7cf7('0x65')](_0x48711e,0x3eb)){var _0x555b89=_[_0x7cf7('0x4c')](_0x333878,{'sectionId':0x3eb});return getCustomDashboards(_0x555b89)[_0x7cf7('0x2c')](function(_0x4dcea8){return _['map'](_0x333878,function(_0x2d04b4){if(_0x555b89[_0x7cf7('0x64')]){if(_0x2d04b4[_0x7cf7('0x5c')]===0x3eb){_0x2d04b4['subsections']=_0x4dcea8;}}else{if(_0x2d04b4[_0x7cf7('0x5c')]===0x64){_0x2d04b4['subsections']=_0x4dcea8;}}return _0x2d04b4;});});}else{return;}})[_0x7cf7('0x2c')](function(_0x596ce0){if(_0x596ce0)_0x333878=_0x596ce0;if(_[_0x7cf7('0x65')](_0x48711e,0x709)){var _0x4576d8=_[_0x7cf7('0x4c')](_0x333878,{'sectionId':0x709});return getPlugins(_0x4576d8)['then'](function(_0x1e20c1){if(_0x4576d8[_0x7cf7('0x64')]){return _[_0x7cf7('0x38')](_0x333878,function(_0x19d59f){if(_0x19d59f[_0x7cf7('0x5c')]===0x709){_0x19d59f[_0x7cf7('0x67')]=_0x1e20c1;}return _0x19d59f;});}else{var _0x1364f6={'sectionId':0x76c,'enabled':0x1,'subsections':_0x1e20c1};var _0x554fa2=_[_0x7cf7('0x38')](_0x333878);_0x554fa2[_0x7cf7('0x61')](_0x1364f6);return _0x554fa2;}});}else{return;}})[_0x7cf7('0x2c')](function(_0x21cca9){if(_0x21cca9)_0x333878=_0x21cca9;return _[_0x7cf7('0x44')](_0x333878,[_0x7cf7('0x64'),0x1]);})[_0x7cf7('0x2c')](respondWithResult(_0x32e9ee,null))[_0x7cf7('0x4f')](handleError(_0x32e9ee,null));};function hasDefaultDashboard(_0x49e9b4){var _0x18863e=[0x65];return new BPromise(function(_0x2ba54a,_0x3417a2){try{if(_0x49e9b4[_0x7cf7('0x68')]){_0x2ba54a(_0x18863e);}else{return db[_0x7cf7('0x5b')][_0x7cf7('0x69')]({'where':{'sectionId':_0x49e9b4['id']},'raw':!![]})[_0x7cf7('0x2c')](function(_0x32b61d){_0x32b61d?_0x2ba54a(_0x18863e):_0x2ba54a();});}}catch(_0x54bddc){_0x3417a2(_0x54bddc);}});}function getCustomDashboards(_0x3e85be){var _0x2bd745=[];return new BPromise(function(_0x6f5045,_0x43c875){try{if(_0x3e85be[_0x7cf7('0x68')]){return db['Dashboard'][_0x7cf7('0x47')]({'raw':!![]})[_0x7cf7('0x2c')](function(_0x25bfb1){_0x25bfb1['forEach'](function(_0x2cb3f7){_0x2bd745[_0x7cf7('0x61')](_0x2cb3f7['id']+0x1869f);});_0x6f5045(_0x2bd745);});}else{return db[_0x7cf7('0x5b')][_0x7cf7('0x47')]({'where':{'sectionId':_0x3e85be['id']},'raw':!![]})[_0x7cf7('0x2c')](function(_0x1c1626){_0x1c1626[_0x7cf7('0x6a')](function(_0x58f18f){_0x2bd745[_0x7cf7('0x61')](_0x58f18f['resourceId']+0x1869f);});_0x6f5045(_0x2bd745);});}}catch(_0x452615){_0x43c875(_0x452615);}});}function getPlugins(_0x3caa2d){var _0x1352c5=[];return new BPromise(function(_0x4cdca0,_0x4051d3){try{if(_0x3caa2d[_0x7cf7('0x68')]){return db[_0x7cf7('0x6b')][_0x7cf7('0x47')]({'raw':!![]})[_0x7cf7('0x2c')](function(_0x55d8c6){_0x55d8c6['forEach'](function(_0x7b40c2){_0x1352c5[_0x7cf7('0x61')](_0x7b40c2['id']+0x15b38);});_0x4cdca0(_0x1352c5);});}else{return db[_0x7cf7('0x5b')]['findAll']({'where':{'sectionId':_0x3caa2d['id']},'raw':!![]})[_0x7cf7('0x2c')](function(_0x1f9584){_0x1f9584[_0x7cf7('0x6a')](function(_0x178844){_0x1352c5[_0x7cf7('0x61')](_0x178844['resourceId']+0x15b38);});_0x4cdca0(_0x1352c5);});}}catch(_0x453207){_0x4051d3(_0x453207);}});}exports[_0x7cf7('0x6c')]=function(_0x445713,_0xf844bc){return db[_0x7cf7('0x33')][_0x7cf7('0x4c')]({'where':{'id':_0x445713[_0x7cf7('0x51')]['id']}})[_0x7cf7('0x2c')](handleEntityNotFound(_0xf844bc,null))['then'](function(_0x2d2ecc){if(_0x2d2ecc){return db['sequelize'][_0x7cf7('0x58')](function(_0x14a352){return db[_0x7cf7('0x59')][_0x7cf7('0x47')]({'where':{'userProfileId':_0x445713[_0x7cf7('0x51')]['id']},'attributes':['id'],'raw':!![]})[_0x7cf7('0x2c')](function(_0x19acec){if(_0x19acec){return db[_0x7cf7('0x59')][_0x7cf7('0x2d')]({'where':{'userProfileId':_0x445713[_0x7cf7('0x51')]['id'],'id':_[_0x7cf7('0x38')](_0x19acec,function(_0xaf204f){return _0xaf204f['id'];})},'transaction':_0x14a352});}})[_0x7cf7('0x2c')](function(_0x220c20){var _0x204a40=_[_0x7cf7('0x38')](_0x445713[_0x7cf7('0x4e')],function(_0xaf0bce){_0xaf0bce[_0x7cf7('0x60')]=_0x445713[_0x7cf7('0x51')]['id'];return _0xaf0bce;});return db[_0x7cf7('0x59')][_0x7cf7('0x6d')](_0x204a40,{'raw':!![],'transaction':_0x14a352});})['then'](function(_0x1e66da){var _0x34363e=_[_0x7cf7('0x44')](_[_0x7cf7('0x38')](_0x1e66da,function(_0x45065f){return _0x45065f[_0x7cf7('0x52')]({'plain':!![]});}),{'includeAll':![]});if(_0x34363e){return db[_0x7cf7('0x59')]['findAll']({'where':{'userProfileId':_0x445713[_0x7cf7('0x51')]['id'],'sectionId':_[_0x7cf7('0x38')](_0x34363e,function(_0x5ebb52){return _0x5ebb52[_0x7cf7('0x5c')];})},'attributes':['id',_0x7cf7('0x5c')],'raw':!![]})[_0x7cf7('0x2c')](function(_0xb53517){var _0x5eb32c=_[_0x7cf7('0x38')](_0x445713[_0x7cf7('0x4e')],function(_0x3e5018){_0x3e5018['userProfileId']=_0x445713['params']['id'];return _0x3e5018;});return db[_0x7cf7('0x5b')][_0x7cf7('0x6d')](_0x5eb32c,{'raw':!![],'transaction':_0x14a352});});}})[_0x7cf7('0x4f')](handleError(_0xf844bc,null));});}})[_0x7cf7('0x2c')](function(_0x4eb947){var _0x25ca8=_[_0x7cf7('0x38')](_0x4eb947,function(_0x1dbf13){return _0x1dbf13[_0x7cf7('0x52')]({'plain':!![]});});})[_0x7cf7('0x2c')](respondWithResult(_0xf844bc,null))[_0x7cf7('0x4f')](handleError(_0xf844bc,null));};exports['removeResources']=function(_0x1f4e27,_0x29e3ba,_0x2fb53c){return db['UserProfile'][_0x7cf7('0x4c')]({'where':{'id':_0x1f4e27[_0x7cf7('0x51')]['id']}})[_0x7cf7('0x2c')](handleEntityNotFound(_0x29e3ba,null))[_0x7cf7('0x2c')](function(_0x56ae34){if(_0x56ae34){return _0x56ae34[_0x7cf7('0x6e')](_0x1f4e27[_0x7cf7('0x39')][_0x7cf7('0x63')]);}})[_0x7cf7('0x2c')](respondWithStatusCode(_0x29e3ba,null))[_0x7cf7('0x4f')](handleError(_0x29e3ba,null));};exports[_0x7cf7('0x6f')]=function(_0xed6f0d,_0x470078){var _0x1c2b8a={'raw':![],'where':{}};var _0x8dd880={};var _0x425d51={'count':0x0,'rows':[]};var _0x1d00ab=_0xed6f0d[_0x7cf7('0x39')][_0x7cf7('0x70')];if(typeof _0x1d00ab==='undefined'){throw new db[(_0x7cf7('0x71'))][(_0x7cf7('0x72'))](_0x7cf7('0x73'));}var _0x412fb0=_0xed6f0d['query']['mergeResources']||![];var _0x50908a=getQueryModels(_0x1d00ab,_0x412fb0);if(typeof _0x50908a[_0x7cf7('0x74')]===_0x7cf7('0x75')){throw new db['Sequelize'][(_0x7cf7('0x72'))]('Invalid\x20section\x20\x27'+_0x1d00ab+'\x27');}var _0x4380a1=[];if(!_[_0x7cf7('0x66')](_0x50908a[_0x7cf7('0x76')])){_0x4380a1=_0x50908a[_0x7cf7('0x76')];}else{_0x4380a1=[{'name':_0x1d00ab}];}return db[_0x7cf7('0x33')][_0x7cf7('0x69')]({'where':{'id':_0xed6f0d[_0x7cf7('0x51')]['id']}})[_0x7cf7('0x2c')](handleEntityNotFound(_0x470078,null))[_0x7cf7('0x2c')](function(_0x4b0f2c){if(_0x4b0f2c){var _0x120675=[];for(var _0x205280=0x0;_0x205280<_0x4380a1[_0x7cf7('0x4a')];_0x205280++){_0x120675[_0x7cf7('0x61')](db[_0x7cf7('0x59')][_0x7cf7('0x69')]({'where':{'userProfileId':_0x4b0f2c['id'],'name':_0x4380a1[_0x205280][_0x7cf7('0x30')]},'raw':!![]}));}return BPromise['all'](_0x120675);}})[_0x7cf7('0x2c')](function(_0x1a0620){var _0x5cb7c2=_[_0x7cf7('0x44')](_0x1a0620,function(_0x563078){return _0x563078?_0x563078:undefined;});var _0x9e6f35=_[_0x7cf7('0x44')](_0x4380a1,[_0x7cf7('0x77'),!![]]);var _0x32b3c1=_[_0x7cf7('0x66')](_0x5cb7c2)&&_[_0x7cf7('0x66')](_0x9e6f35)?null:_[_0x7cf7('0x78')](_0x9e6f35,_0x5cb7c2);if(_0x32b3c1){var _0x40f22a=[];for(var _0x505d18=0x0;_0x505d18<_0x32b3c1['length'];_0x505d18++){var _0xc3ed77=_[_0x7cf7('0x4c')](_0x4380a1,function(_0x395091){return _0x32b3c1[_0x505d18]?_0x395091[_0x7cf7('0x30')]===_0x32b3c1[_0x505d18]['name']:null;});if(_0xc3ed77){if(_0x32b3c1[_0x505d18][_0x7cf7('0x77')]){_0x40f22a['push'](getAllResources(_0x50908a[_0x7cf7('0x74')],_0x32b3c1[_0x505d18]));}else{if(!_0x32b3c1[_0x505d18][_0x7cf7('0x68')]){_0x40f22a[_0x7cf7('0x61')](getAllowedResources(_0xc3ed77,_0x32b3c1[_0x505d18],_0x50908a['childModel']));}else{if(_0xc3ed77[_0x7cf7('0x37')]){_0x40f22a[_0x7cf7('0x61')](getAllFilteredResources(_0xc3ed77,_0x32b3c1[_0x505d18]));}}}}}return BPromise[_0x7cf7('0x79')](_0x40f22a);}else{return null;}})[_0x7cf7('0x2c')](function(_0x4ae6f8){var _0x5a64c8=_0x4ae6f8;var _0x4b402e=null;if(_0x5a64c8){_0x4b402e=_0x5a64c8[_0x7cf7('0x4a')]===0x1?_0x5a64c8[0x0]:null;}if(_0x4b402e||_0x5a64c8){var _0x510a03=db[_0x50908a[_0x7cf7('0x74')]]['rawAttributes'];_0x8dd880[_0x7cf7('0x37')]=_['keys'](_0x510a03);_0x8dd880[_0x7cf7('0x39')]=_['keys'](_0xed6f0d[_0x7cf7('0x39')]);_0x8dd880['filters']=_[_0x7cf7('0x3c')](_0x8dd880[_0x7cf7('0x37')],_0x8dd880['query']);_0x1c2b8a[_0x7cf7('0x3d')]=_[_0x7cf7('0x3c')](_0x8dd880[_0x7cf7('0x37')],qs['fields'](_0xed6f0d[_0x7cf7('0x39')][_0x7cf7('0x3e')]));_0x1c2b8a['attributes']=_0x1c2b8a['attributes']['length']?_0x1c2b8a[_0x7cf7('0x3d')]:_0x8dd880[_0x7cf7('0x37')];if(!_0xed6f0d['query']['hasOwnProperty'](_0x7cf7('0x3f'))){_0x1c2b8a['limit']=qs[_0x7cf7('0x40')](_0xed6f0d[_0x7cf7('0x39')][_0x7cf7('0x40')]);_0x1c2b8a['offset']=qs[_0x7cf7('0x25')](_0xed6f0d[_0x7cf7('0x39')][_0x7cf7('0x25')]);}_0x1c2b8a[_0x7cf7('0x7a')]=qs[_0x7cf7('0x41')](_0xed6f0d['query']['sort']);_0x1c2b8a[_0x7cf7('0x42')]=qs['filters'](_[_0x7cf7('0x7b')](_0xed6f0d[_0x7cf7('0x39')],_0x8dd880[_0x7cf7('0x3b')]));if(_0xed6f0d['query'][_0x7cf7('0x44')]){_0x1c2b8a[_0x7cf7('0x42')]=_[_0x7cf7('0x43')](_0x1c2b8a[_0x7cf7('0x42')],{'$or':_['map'](_0x510a03,function(_0x37ee8d){if(_0x37ee8d[_0x7cf7('0x35')]['key']!==_0x7cf7('0x7c')){var _0x14541f={};_0x14541f[_0x37ee8d[_0x7cf7('0x7d')]]={'$like':'%'+_0xed6f0d[_0x7cf7('0x39')][_0x7cf7('0x44')]+'%'};return _0x14541f;}})});}var _0x21ecaf=[];if(_0x4b402e){var _0x177363=_[_0x7cf7('0x4c')](_0x4380a1,[_0x7cf7('0x30'),_0x4b402e[_0x7cf7('0x30')]]);if(_0x177363[_0x7cf7('0x7d')]){var _0x5f14fb={};if(_0x50908a['childModel']===_0x7cf7('0x7e')){_0x5f14fb[_0x177363[_0x7cf7('0x7f')]]=_[_0x7cf7('0x38')](_0x4b402e['associatedResources'],'id');}else{_0x5f14fb[_0x177363[_0x7cf7('0x7f')]]=_0x4b402e[_0x7cf7('0x80')];}_0x21ecaf[_0x7cf7('0x61')](_0x5f14fb);}else{_0x1c2b8a[_0x7cf7('0x42')]['id']=_0x4b402e[_0x7cf7('0x80')];}}else{for(var _0x72f3dd=0x0;_0x72f3dd<_0x5a64c8[_0x7cf7('0x4a')];_0x72f3dd++){var _0x177363=_[_0x7cf7('0x4c')](_0x4380a1,['name',_0x5a64c8[_0x72f3dd][_0x7cf7('0x30')]]);if(_0x177363[_0x7cf7('0x7d')]){var _0x5f14fb={};_0x5f14fb[_0x177363[_0x7cf7('0x7f')]]=_0x5a64c8[_0x72f3dd][_0x7cf7('0x80')];_0x21ecaf[_0x7cf7('0x61')](_0x5f14fb);}else{if(!_0x1c2b8a[_0x7cf7('0x42')]['id'])_0x1c2b8a[_0x7cf7('0x42')]['id']=[];_0x5a64c8[_0x72f3dd]['associatedResources']['forEach'](function(_0x4c0233){_0x1c2b8a['where']['id'][_0x7cf7('0x61')](_0x4c0233);});}}}if(!_['isEmpty'](_0x21ecaf)){_0x1c2b8a[_0x7cf7('0x42')]=_[_0x7cf7('0x43')](_0x1c2b8a[_0x7cf7('0x42')],{'$and':{'$or':_0x21ecaf}});}_0x1c2b8a=_[_0x7cf7('0x43')]({},_0x1c2b8a,_0xed6f0d[_0x7cf7('0x45')]);if(_0x4b402e&&!_0x4b402e[_0x7cf7('0x68')]&&_0x50908a['childModel']===_0x7cf7('0x7e')){if(_0xed6f0d['query'][_0x7cf7('0x46')]){_0x1c2b8a[_0x7cf7('0x4b')]=[{'all':!![]}];}return db[_0x50908a[_0x7cf7('0x74')]][_0x7cf7('0x47')](_0x1c2b8a)[_0x7cf7('0x2c')](function(_0x107d7d){var _0x1a58d7=[];_0x107d7d[_0x7cf7('0x6a')](function(_0x460467){var _0x575af5;switch(_0x460467[_0x7cf7('0x81')]){case _0x7cf7('0x82'):_0x575af5=_['find'](_0x4b402e[_0x7cf7('0x80')],function(_0x41341d){return _0x41341d['id']===_0x460467[_0x7cf7('0x83')]&&_0x41341d[_0x7cf7('0x35')]===_0x7cf7('0x84');});break;case _0x7cf7('0x85'):_0x575af5=_[_0x7cf7('0x4c')](_0x4b402e[_0x7cf7('0x80')],function(_0x3a65f0){return _0x3a65f0['id']===_0x460467[_0x7cf7('0x83')]&&_0x3a65f0[_0x7cf7('0x35')]===_0x7cf7('0x86');});break;}if(_0x575af5)_0x1a58d7[_0x7cf7('0x61')](_0x460467);});_0x425d51[_0x7cf7('0x24')]=_0x1a58d7['length'];_0x425d51[_0x7cf7('0x87')]=_0x1a58d7;return _0x425d51;});}else{return db[_0x50908a[_0x7cf7('0x74')]][_0x7cf7('0x24')]({'where':_0x1c2b8a[_0x7cf7('0x42')]})[_0x7cf7('0x2c')](function(_0x1ac71e){_0x425d51[_0x7cf7('0x24')]=_0x1ac71e;if(_0xed6f0d[_0x7cf7('0x39')]['includeAll']){if(_0x50908a[_0x7cf7('0x74')]===_0x7cf7('0x88')){_0x1c2b8a['include']=[{'model':db['Tag'],'as':'Tags','attributes':['id',_0x7cf7('0x30'),_0x7cf7('0x89')],'required':_0xed6f0d[_0x7cf7('0x39')][_0x7cf7('0x8a')]?!![]:![]},{'model':db[_0x7cf7('0x8b')],'as':_0x7cf7('0x8c'),'attributes':['id','name',_0x7cf7('0x89')],'through':_0xed6f0d['query']['tag']?{'attributes':[],'where':{'TagId':_0xed6f0d[_0x7cf7('0x39')]['tag']||undefined}}:{},'required':_0xed6f0d[_0x7cf7('0x39')]['tag']?!![]:![]}];}else{_0x1c2b8a['include']=[{'all':!![]}];}}return db[_0x50908a[_0x7cf7('0x74')]][_0x7cf7('0x47')](_0x1c2b8a);})['then'](function(_0x158d6b){_0x425d51[_0x7cf7('0x87')]=_0x158d6b;return _0x425d51;});}}else{return _0x425d51;}})['then'](respondWithFilteredResult(_0x470078,_0x1c2b8a))[_0x7cf7('0x4f')](handleError(_0x470078,null));};function getAllResources(_0x2f85c5,_0x7c000e){return new BPromise(function(_0x42640a,_0x1309f9){if(_0x7c000e){var _0x4c91b8=_0x7c000e[_0x7cf7('0x44')]?{[_0x7c000e['filter']['field']]:_0x7c000e[_0x7cf7('0x44')][_0x7cf7('0x8d')]}:undefined;return db[_0x2f85c5][_0x7cf7('0x47')]({'where':_0x4c91b8,'raw':!![]})['then'](function(_0x4a5073){_0x7c000e[_0x7cf7('0x80')]=_[_0x7cf7('0x38')](_0x4a5073,'id');_0x42640a(_0x7c000e);})['catch'](function(_0x19529c){_0x1309f9(_0x19529c);});}else{_0x42640a(null);}});}function getAllFilteredResources(_0x3c9527,_0x2828a0){return new BPromise(function(_0x225616,_0x3870f9){var _0x253fed=_0x3c9527[_0x7cf7('0x44')]?{[_0x3c9527[_0x7cf7('0x44')][_0x7cf7('0x7d')]]:_0x3c9527[_0x7cf7('0x44')][_0x7cf7('0x8d')]}:undefined;return db[_0x3c9527['model']][_0x7cf7('0x47')]({'where':_0x253fed,'raw':!![]})['then'](function(_0xbe610e){_0x2828a0['associatedResources']=_[_0x7cf7('0x38')](_0xbe610e,function(_0xa33855){return _0xa33855['name'];});_0x225616(_0x2828a0);})[_0x7cf7('0x4f')](function(_0x2b6db4){_0x3870f9(_0x2b6db4);});});}function getAllowedResources(_0x3a9c7e,_0x21f3ec,_0x4348dd){return new BPromise(function(_0xf510e5,_0x30ae9b){if(_0x21f3ec){return db[_0x7cf7('0x5b')][_0x7cf7('0x47')]({'where':{'sectionId':_0x21f3ec['id']},'raw':!![]})[_0x7cf7('0x2c')](function(_0xf1a985){if(_0x3a9c7e['field']&&_0x3a9c7e[_0x7cf7('0x7d')]!=='id'){_0x21f3ec[_0x7cf7('0x80')]=_[_0x7cf7('0x38')](_0xf1a985,function(_0x2dd3d3){return _0x2dd3d3[_0x3a9c7e[_0x7cf7('0x7d')]];});}else{if(_0x4348dd===_0x7cf7('0x7e')){_0x21f3ec[_0x7cf7('0x80')]=_[_0x7cf7('0x38')](_0xf1a985,function(_0x583527){return{'id':_0x583527[_0x7cf7('0x8e')],'type':_0x583527[_0x7cf7('0x35')]};});}else{_0x21f3ec[_0x7cf7('0x80')]=_['map'](_0xf1a985,function(_0x2d454e){return _0x2d454e[_0x7cf7('0x8e')];});}}_0xf510e5(_0x21f3ec);})[_0x7cf7('0x4f')](function(_0x394297){_0x30ae9b(_0x394297);});}else{_0xf510e5(null);}});}function getQueryModels(_0x2ee8ad,_0x306426){var _0x2652aa=_0x2ee8ad[_0x7cf7('0x8f')]();var _0x53a47c={'childModel':undefined,'parentSections':[]};switch(_0x2652aa){case _0x7cf7('0x90'):_0x53a47c[_0x7cf7('0x74')]=_0x7cf7('0x91');break;case _0x7cf7('0x92'):_0x53a47c[_0x7cf7('0x74')]=_0x7cf7('0x93');break;case _0x7cf7('0x94'):_0x53a47c['childModel']='SquareRecording';_0x53a47c[_0x7cf7('0x76')]=[{'name':_0x7cf7('0x95'),'field':'name','foreignKey':_0x7cf7('0x96')}];break;case _0x7cf7('0x97'):_0x53a47c[_0x7cf7('0x74')]='JscriptyProject';break;case _0x7cf7('0x98'):_0x53a47c[_0x7cf7('0x74')]=_0x7cf7('0x88');_0x53a47c[_0x7cf7('0x76')]=[{'name':_0x7cf7('0x99'),'field':'id','foreignKey':'ListId'}];break;case _0x7cf7('0x9a'):_0x53a47c[_0x7cf7('0x74')]=_0x7cf7('0x9b');break;case _0x7cf7('0x9c'):_0x53a47c[_0x7cf7('0x74')]=_0x7cf7('0x9d');break;case _0x7cf7('0x9e'):_0x53a47c[_0x7cf7('0x74')]='CmCustomField';break;case'chatqueues':_0x53a47c[_0x7cf7('0x74')]=_0x7cf7('0x9f');break;case _0x7cf7('0xa0'):_0x53a47c[_0x7cf7('0x74')]=_0x7cf7('0xa1');break;case _0x7cf7('0xa2'):_0x53a47c[_0x7cf7('0x74')]=_0x7cf7('0xa3');break;case'faxaccounts':_0x53a47c['childModel']='FaxAccount';break;case _0x7cf7('0xa4'):case'internalroutes':case _0x7cf7('0xa5'):_0x53a47c['childModel']='VoiceExtension';break;case _0x7cf7('0xa6'):_0x53a47c[_0x7cf7('0x74')]=_0x7cf7('0xa7');break;case _0x7cf7('0xa8'):_0x53a47c[_0x7cf7('0x74')]=_0x7cf7('0xa9');break;case _0x7cf7('0xaa'):_0x53a47c['childModel']=_0x7cf7('0xab');_0x53a47c['parentSections']=[{'name':_0x7cf7('0xac'),'field':_0x7cf7('0x30'),'foreignKey':_0x7cf7('0xad'),'model':_0x7cf7('0xae'),'filter':{'field':'role','value':[_0x7cf7('0xaf')]}},{'name':_0x7cf7('0xb0'),'field':'name','foreignKey':_0x7cf7('0xad'),'model':_0x7cf7('0xae'),'filter':{'field':_0x7cf7('0xb1'),'value':[_0x7cf7('0xb2')]}},{'name':_0x7cf7('0xb3'),'field':_0x7cf7('0x30'),'foreignKey':_0x7cf7('0xb4'),'model':'VoiceQueue','filter':{'field':_0x7cf7('0x35'),'value':[_0x7cf7('0xb5')]}},{'name':_0x7cf7('0xb6'),'field':_0x7cf7('0x30'),'foreignKey':'queue','model':'VoiceQueue','filter':{'field':_0x7cf7('0x35'),'value':[_0x7cf7('0xb7')]}}];break;case _0x7cf7('0xb8'):_0x53a47c[_0x7cf7('0x74')]=_0x7cf7('0xb9');break;case _0x7cf7('0xba'):_0x53a47c[_0x7cf7('0x74')]=_0x7cf7('0xbb');break;case'voiceprefixes':_0x53a47c[_0x7cf7('0x74')]=_0x7cf7('0xbc');break;case _0x7cf7('0xbd'):_0x53a47c[_0x7cf7('0x74')]=_0x7cf7('0xbe');break;case'mailqueues':_0x53a47c[_0x7cf7('0x74')]=_0x7cf7('0xbf');break;case _0x7cf7('0xc0'):_0x53a47c[_0x7cf7('0x74')]=_0x7cf7('0xc1');break;case _0x7cf7('0xc2'):_0x53a47c[_0x7cf7('0x74')]='MailSubstatus';break;case'openchannelqueues':_0x53a47c[_0x7cf7('0x74')]=_0x7cf7('0xc3');break;case _0x7cf7('0xc4'):_0x53a47c['childModel']=_0x7cf7('0xc5');break;case _0x7cf7('0xc6'):_0x53a47c['childModel']=_0x7cf7('0xc7');break;case _0x7cf7('0xc8'):_0x53a47c[_0x7cf7('0x74')]='SmsAccount';break;case _0x7cf7('0xc9'):_0x53a47c[_0x7cf7('0x74')]=_0x7cf7('0xca');break;case'whatsappaccounts':_0x53a47c[_0x7cf7('0x74')]='WhatsappAccount';break;case _0x7cf7('0xcb'):_0x53a47c['childModel']=_0x7cf7('0xcc');break;case _0x7cf7('0xcd'):case _0x7cf7('0xce'):_0x53a47c[_0x7cf7('0x74')]='VoiceQueue';if(_0x306426){_0x53a47c[_0x7cf7('0x76')]=[{'name':_0x7cf7('0xb3')},{'name':'QueueCampaigns'}];}break;case _0x7cf7('0xcf'):case _0x7cf7('0xd0'):case _0x7cf7('0xd1'):_0x53a47c[_0x7cf7('0x74')]=_0x7cf7('0xae');if(_0x306426){_0x53a47c[_0x7cf7('0x76')]=[{'name':_0x7cf7('0xd2'),'filter':{'field':'role','value':[_0x7cf7('0xd3'),_0x7cf7('0xd4')]},'ignore':!![]},{'name':'Agents'},{'name':_0x7cf7('0xb0')}];}break;case _0x7cf7('0xd5'):_0x53a47c['childModel']=_0x7cf7('0xd6');break;case _0x7cf7('0xd7'):_0x53a47c[_0x7cf7('0x74')]=_0x7cf7('0xd8');break;case _0x7cf7('0xd9'):_0x53a47c[_0x7cf7('0x74')]=_0x7cf7('0xda');break;case _0x7cf7('0xdb'):_0x53a47c[_0x7cf7('0x74')]=_0x7cf7('0xdc');break;case _0x7cf7('0xdd'):_0x53a47c[_0x7cf7('0x74')]=_0x7cf7('0xde');break;case'zohoaccounts':_0x53a47c[_0x7cf7('0x74')]=_0x7cf7('0xdf');break;case _0x7cf7('0xe0'):_0x53a47c[_0x7cf7('0x74')]=_0x7cf7('0xae');break;case _0x7cf7('0xe1'):_0x53a47c[_0x7cf7('0x74')]=_0x7cf7('0xe2');break;case'dispositions':_0x53a47c['childModel']=_0x7cf7('0xe3');break;case'customdashboards':_0x53a47c[_0x7cf7('0x74')]=_0x7cf7('0xe4');break;case _0x7cf7('0xe5'):_0x53a47c[_0x7cf7('0x74')]=_0x7cf7('0xe6');break;case _0x7cf7('0xe7'):_0x53a47c[_0x7cf7('0x74')]='Pause';break;case _0x7cf7('0xe8'):_0x53a47c[_0x7cf7('0x74')]=_0x7cf7('0xe9');break;case _0x7cf7('0xea'):_0x53a47c[_0x7cf7('0x74')]='Sound';break;case _0x7cf7('0xeb'):_0x53a47c[_0x7cf7('0x74')]=_0x7cf7('0x8b');break;case'templates':_0x53a47c['childModel']='Template';break;case _0x7cf7('0xec'):_0x53a47c['childModel']='Trigger';break;case _0x7cf7('0xed'):_0x53a47c[_0x7cf7('0x74')]='Trunk';break;case _0x7cf7('0xee'):_0x53a47c[_0x7cf7('0x74')]='Variable';break;case'plugins':_0x53a47c['childModel']=_0x7cf7('0x6b');break;case _0x7cf7('0xef'):_0x53a47c['childModel']=_0x7cf7('0x7e');_0x53a47c['parentSections']=[{'name':_0x7cf7('0xf0'),'field':'id','foreignKey':_0x7cf7('0x83')}];break;case _0x7cf7('0xf1'):_0x53a47c[_0x7cf7('0x74')]=_0x7cf7('0xf2');break;case _0x7cf7('0xf3'):_0x53a47c[_0x7cf7('0x74')]='WhatsappAccount';break;default:return _0x53a47c;}return _0x53a47c;} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index a29a57c..cce087b 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 _0xc2dd=['exports','events','../../mysqldb','UserProfile','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x187279,_0x26d152){var _0x3da59d=function(_0x41c808){while(--_0x41c808){_0x187279['push'](_0x187279['shift']());}};_0x3da59d(++_0x26d152);}(_0xc2dd,0x187));var _0xdc2d=function(_0x4cd5e2,_0x59ecdb){_0x4cd5e2=_0x4cd5e2-0x0;var _0x17be05=_0xc2dd[_0x4cd5e2];return _0x17be05;};'use strict';var EventEmitter=require(_0xdc2d('0x0'));var UserProfile=require(_0xdc2d('0x1'))['db'][_0xdc2d('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xdc2d('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xdc2d('0x4'),'afterDestroy':_0xdc2d('0x5')};function emitEvent(_0x46b7eb){return function(_0x4057f8,_0x274d49,_0x2d053c){UserProfileEvents[_0xdc2d('0x6')](_0x46b7eb+':'+_0x4057f8['id'],_0x4057f8);UserProfileEvents[_0xdc2d('0x6')](_0x46b7eb,_0x4057f8);_0x2d053c(null);};}for(var e in events){if(events[_0xdc2d('0x7')](e)){var event=events[e];UserProfile[_0xdc2d('0x8')](e,emitEvent(event));}}module[_0xdc2d('0x9')]=UserProfileEvents; \ No newline at end of file +var _0xa093=['hook','exports','events','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x12863b,_0x133b89){var _0x437041=function(_0x343835){while(--_0x343835){_0x12863b['push'](_0x12863b['shift']());}};_0x437041(++_0x133b89);}(_0xa093,0x92));var _0x3a09=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa093[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x3a09('0x0'));var UserProfile=require('../../mysqldb')['db']['UserProfile'];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x3a09('0x1')](0x0);var events={'afterCreate':_0x3a09('0x2'),'afterUpdate':_0x3a09('0x3'),'afterDestroy':_0x3a09('0x4')};function emitEvent(_0x2bee0d){return function(_0x13a73d,_0x17e695,_0x14b479){UserProfileEvents['emit'](_0x2bee0d+':'+_0x13a73d['id'],_0x13a73d);UserProfileEvents[_0x3a09('0x5')](_0x2bee0d,_0x13a73d);_0x14b479(null);};}for(var e in events){if(events[_0x3a09('0x6')](e)){var event=events[e];UserProfile[_0x3a09('0x7')](e,emitEvent(event));}}module[_0x3a09('0x8')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 891a7ea..b16441a 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 _0x0a11=['user_profiles','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./userProfile.attributes','exports','define','UserProfile'];(function(_0xc69d34,_0x3b3e8f){var _0x272df=function(_0x5a488f){while(--_0x5a488f){_0xc69d34['push'](_0xc69d34['shift']());}};_0x272df(++_0x3b3e8f);}(_0x0a11,0xc5));var _0x10a1=function(_0x2e1906,_0xa281e9){_0x2e1906=_0x2e1906-0x0;var _0x3ea10e=_0x0a11[_0x2e1906];return _0x3ea10e;};'use strict';var _=require(_0x10a1('0x0'));var util=require(_0x10a1('0x1'));var logger=require(_0x10a1('0x2'))(_0x10a1('0x3'));var moment=require(_0x10a1('0x4'));var BPromise=require(_0x10a1('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x10a1('0x6'));var rimraf=require(_0x10a1('0x7'));var config=require(_0x10a1('0x8'));var attributes=require(_0x10a1('0x9'));module[_0x10a1('0xa')]=function(_0x30a15c,_0x407bf2){return _0x30a15c[_0x10a1('0xb')](_0x10a1('0xc'),attributes,{'tableName':_0x10a1('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x14a4=['user_profiles','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','exports','define','UserProfile'];(function(_0x22ccc0,_0x914457){var _0xe2af6a=function(_0x55aa01){while(--_0x55aa01){_0x22ccc0['push'](_0x22ccc0['shift']());}};_0xe2af6a(++_0x914457);}(_0x14a4,0xb5));var _0x414a=function(_0x336fa3,_0x347367){_0x336fa3=_0x336fa3-0x0;var _0xc8074=_0x14a4[_0x336fa3];return _0xc8074;};'use strict';var _=require(_0x414a('0x0'));var util=require(_0x414a('0x1'));var logger=require(_0x414a('0x2'))('api');var moment=require(_0x414a('0x3'));var BPromise=require(_0x414a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x414a('0x5'));var rimraf=require(_0x414a('0x6'));var config=require(_0x414a('0x7'));var attributes=require('./userProfile.attributes');module[_0x414a('0x8')]=function(_0x3f2355,_0x3fe687){return _0x3f2355[_0x414a('0x9')](_0x414a('0xa'),attributes,{'tableName':_0x414a('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 e55f322..256e85d 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 _0x5fab=['request','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','UserProfile,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','./userProfile.socket','register'];(function(_0x478970,_0x5df032){var _0x1759f1=function(_0x58579d){while(--_0x58579d){_0x478970['push'](_0x478970['shift']());}};_0x1759f1(++_0x5df032);}(_0x5fab,0x177));var _0xb5fa=function(_0x4497cd,_0x4a2208){_0x4497cd=_0x4497cd-0x0;var _0x3c6c43=_0x5fab[_0x4497cd];return _0x3c6c43;};'use strict';var _=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var moment=require('moment');var BPromise=require(_0xb5fa('0x2'));var rs=require(_0xb5fa('0x3'));var fs=require('fs');var Redis=require(_0xb5fa('0x4'));var db=require(_0xb5fa('0x5'))['db'];var utils=require(_0xb5fa('0x6'));var logger=require(_0xb5fa('0x7'))(_0xb5fa('0x8'));var config=require(_0xb5fa('0x9'));var jayson=require(_0xb5fa('0xa'));var client=jayson[_0xb5fa('0xb')]['http']({'port':0x232a});config['redis']=_[_0xb5fa('0xc')](config[_0xb5fa('0xd')],{'host':_0xb5fa('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb5fa('0xd')]));require(_0xb5fa('0xf'))[_0xb5fa('0x10')](socket);function respondWithRpcPromise(_0x54c7eb,_0x5b5ea8,_0x3a8e1b){return new BPromise(function(_0x23d124,_0xe46b26){return client[_0xb5fa('0x11')](_0x54c7eb,_0x3a8e1b)[_0xb5fa('0x12')](function(_0xadef41){logger[_0xb5fa('0x13')](_0xb5fa('0x14'),_0x5b5ea8,_0xb5fa('0x15'));logger['debug'](_0xb5fa('0x16'),_0x5b5ea8,_0xb5fa('0x15'),JSON['stringify'](_0xadef41));if(_0xadef41[_0xb5fa('0x17')]){if(_0xadef41['error'][_0xb5fa('0x18')]===0x1f4){logger[_0xb5fa('0x17')](_0xb5fa('0x14'),_0x5b5ea8,_0xadef41[_0xb5fa('0x17')][_0xb5fa('0x19')]);return _0xe46b26(_0xadef41['error']['message']);}logger[_0xb5fa('0x17')](_0xb5fa('0x14'),_0x5b5ea8,_0xadef41[_0xb5fa('0x17')][_0xb5fa('0x19')]);return _0x23d124(_0xadef41['error']['message']);}else{logger[_0xb5fa('0x13')](_0xb5fa('0x14'),_0x5b5ea8,_0xb5fa('0x15'));_0x23d124(_0xadef41[_0xb5fa('0x1a')][_0xb5fa('0x19')]);}})[_0xb5fa('0x1b')](function(_0x3b0f69){logger[_0xb5fa('0x17')](_0xb5fa('0x14'),_0x5b5ea8,_0x3b0f69);_0xe46b26(_0x3b0f69);});});} \ No newline at end of file +var _0x2675=['http','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0xe50a4f,_0x1a35b1){var _0x443a3c=function(_0x50d31c){while(--_0x50d31c){_0xe50a4f['push'](_0xe50a4f['shift']());}};_0x443a3c(++_0x1a35b1);}(_0x2675,0x75));var _0x5267=function(_0x14b128,_0x1ebcee){_0x14b128=_0x14b128-0x0;var _0x1ca618=_0x2675[_0x14b128];return _0x1ca618;};'use strict';var _=require(_0x5267('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5267('0x1'));var fs=require('fs');var Redis=require(_0x5267('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x5267('0x3'));var logger=require(_0x5267('0x4'))('rpc');var config=require(_0x5267('0x5'));var jayson=require(_0x5267('0x6'));var client=jayson[_0x5267('0x7')][_0x5267('0x8')]({'port':0x232a});config[_0x5267('0x9')]=_[_0x5267('0xa')](config['redis'],{'host':_0x5267('0xb'),'port':0x18eb});var socket=require(_0x5267('0xc'))(new Redis(config['redis']));require(_0x5267('0xd'))['register'](socket);function respondWithRpcPromise(_0x3ff4e9,_0x207d47,_0x26e22b){return new BPromise(function(_0x534c2b,_0x3e6964){return client['request'](_0x3ff4e9,_0x26e22b)[_0x5267('0xe')](function(_0x5bbf00){logger[_0x5267('0xf')](_0x5267('0x10'),_0x207d47,_0x5267('0x11'));logger[_0x5267('0x12')](_0x5267('0x13'),_0x207d47,_0x5267('0x11'),JSON[_0x5267('0x14')](_0x5bbf00));if(_0x5bbf00[_0x5267('0x15')]){if(_0x5bbf00[_0x5267('0x15')][_0x5267('0x16')]===0x1f4){logger[_0x5267('0x15')](_0x5267('0x10'),_0x207d47,_0x5bbf00[_0x5267('0x15')]['message']);return _0x3e6964(_0x5bbf00['error'][_0x5267('0x17')]);}logger[_0x5267('0x15')](_0x5267('0x10'),_0x207d47,_0x5bbf00[_0x5267('0x15')][_0x5267('0x17')]);return _0x534c2b(_0x5bbf00[_0x5267('0x15')][_0x5267('0x17')]);}else{logger[_0x5267('0xf')](_0x5267('0x10'),_0x207d47,_0x5267('0x11'));_0x534c2b(_0x5bbf00[_0x5267('0x18')][_0x5267('0x17')]);}})['catch'](function(_0x18f32e){logger[_0x5267('0x15')]('UserProfile,\x20%s,\x20%s',_0x207d47,_0x18f32e);_0x3e6964(_0x18f32e);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 4d93a16..46bb449 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 _0xd7a2=['remove','update','emit','removeListener','register','length','userProfile:','./userProfile.events','save'];(function(_0x5d6295,_0x5acc82){var _0x58849a=function(_0x2628d5){while(--_0x2628d5){_0x5d6295['push'](_0x5d6295['shift']());}};_0x58849a(++_0x5acc82);}(_0xd7a2,0xfa));var _0x2d7a=function(_0x4392fd,_0x50daad){_0x4392fd=_0x4392fd-0x0;var _0x13c9c7=_0xd7a2[_0x4392fd];return _0x13c9c7;};'use strict';var UserProfileEvents=require(_0x2d7a('0x0'));var events=[_0x2d7a('0x1'),_0x2d7a('0x2'),_0x2d7a('0x3')];function createListener(_0x10bc80,_0x383e34){return function(_0xed1fec){_0x383e34[_0x2d7a('0x4')](_0x10bc80,_0xed1fec);};}function removeListener(_0x433af9,_0x2f1a6c){return function(){UserProfileEvents[_0x2d7a('0x5')](_0x433af9,_0x2f1a6c);};}exports[_0x2d7a('0x6')]=function(_0x5cacfb){for(var _0x3e2882=0x0,_0xe86946=events[_0x2d7a('0x7')];_0x3e2882<_0xe86946;_0x3e2882++){var _0x5de4f2=events[_0x3e2882];var _0x13f695=createListener(_0x2d7a('0x8')+_0x5de4f2,_0x5cacfb);UserProfileEvents['on'](_0x5de4f2,_0x13f695);}}; \ No newline at end of file +var _0x93e8=['./userProfile.events','remove','register'];(function(_0x3694bc,_0x489b5e){var _0x4c3276=function(_0xe1ab10){while(--_0xe1ab10){_0x3694bc['push'](_0x3694bc['shift']());}};_0x4c3276(++_0x489b5e);}(_0x93e8,0x7b));var _0x893e=function(_0x13b8f3,_0x442821){_0x13b8f3=_0x13b8f3-0x0;var _0x1a6d06=_0x93e8[_0x13b8f3];return _0x1a6d06;};'use strict';var UserProfileEvents=require(_0x893e('0x0'));var events=['save',_0x893e('0x1'),'update'];function createListener(_0x2f9f8c,_0x4b77e9){return function(_0x32ad34){_0x4b77e9['emit'](_0x2f9f8c,_0x32ad34);};}function removeListener(_0xd578e9,_0x1f8060){return function(){UserProfileEvents['removeListener'](_0xd578e9,_0x1f8060);};}exports[_0x893e('0x2')]=function(_0x50c2b0){for(var _0x3fdf06=0x0,_0x5ace34=events['length'];_0x3fdf06<_0x5ace34;_0x3fdf06++){var _0x2d705f=events[_0x3fdf06];var _0x358cf9=createListener('userProfile:'+_0x2d705f,_0x50c2b0);UserProfileEvents['on'](_0x2d705f,_0x358cf9);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index ab0c1ef..d39859a 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 _0x1c2e=['../../config/environment','./userProfileResource.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','util','Router','../../components/interaction/service'];(function(_0x17928f,_0x4ad33f){var _0x500b63=function(_0x127644){while(--_0x127644){_0x17928f['push'](_0x17928f['shift']());}};_0x500b63(++_0x4ad33f);}(_0x1c2e,0xb8));var _0xe1c2=function(_0x162415,_0x2ce52a){_0x162415=_0x162415-0x0;var _0x44a072=_0x1c2e[_0x162415];return _0x44a072;};'use strict';var multer=require('multer');var util=require(_0xe1c2('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xe1c2('0x1')]();var auth=require('../../components/auth/service');var interaction=require(_0xe1c2('0x2'));var config=require(_0xe1c2('0x3'));var controller=require(_0xe1c2('0x4'));router[_0xe1c2('0x5')]('/',auth[_0xe1c2('0x6')](),controller[_0xe1c2('0x7')]);router['get'](_0xe1c2('0x8'),auth[_0xe1c2('0x6')](),controller[_0xe1c2('0x9')]);router['get'](_0xe1c2('0xa'),auth['isAuthenticated'](),controller[_0xe1c2('0xb')]);router[_0xe1c2('0xc')]('/',auth[_0xe1c2('0x6')](),controller[_0xe1c2('0xd')]);router[_0xe1c2('0xe')]('/:id',auth[_0xe1c2('0x6')](),controller[_0xe1c2('0xf')]);router[_0xe1c2('0x10')]('/:id',auth[_0xe1c2('0x6')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x077f=['multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','put','update','delete','destroy'];(function(_0x1b491b,_0x28a3a9){var _0x3c9c8c=function(_0x3e3c0c){while(--_0x3e3c0c){_0x1b491b['push'](_0x1b491b['shift']());}};_0x3c9c8c(++_0x28a3a9);}(_0x077f,0x64));var _0xf077=function(_0x34f8a7,_0x27320b){_0x34f8a7=_0x34f8a7-0x0;var _0xed48ec=_0x077f[_0x34f8a7];return _0xed48ec;};'use strict';var multer=require(_0xf077('0x0'));var util=require(_0xf077('0x1'));var path=require('path');var timeout=require(_0xf077('0x2'));var express=require(_0xf077('0x3'));var router=express[_0xf077('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xf077('0x5'));var config=require(_0xf077('0x6'));var controller=require(_0xf077('0x7'));router[_0xf077('0x8')]('/',auth[_0xf077('0x9')](),controller[_0xf077('0xa')]);router[_0xf077('0x8')](_0xf077('0xb'),auth[_0xf077('0x9')](),controller['describe']);router['get'](_0xf077('0xc'),auth[_0xf077('0x9')](),controller[_0xf077('0xd')]);router[_0xf077('0xe')]('/',auth[_0xf077('0x9')](),controller[_0xf077('0xf')]);router[_0xf077('0x10')](_0xf077('0xc'),auth[_0xf077('0x9')](),controller[_0xf077('0x11')]);router[_0xf077('0x12')]('/:id',auth[_0xf077('0x9')](),controller[_0xf077('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index aba0ba0..768684e 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 _0x48e6=['exports','STRING','INTEGER','sequelize'];(function(_0x42bdad,_0x12836c){var _0x122626=function(_0x2eb29c){while(--_0x2eb29c){_0x42bdad['push'](_0x42bdad['shift']());}};_0x122626(++_0x12836c);}(_0x48e6,0x163));var _0x648e=function(_0x46b54b,_0x122e15){_0x46b54b=_0x46b54b-0x0;var _0x2802f8=_0x48e6[_0x46b54b];return _0x2802f8;};'use strict';var Sequelize=require(_0x648e('0x0'));module[_0x648e('0x1')]={'name':{'type':Sequelize[_0x648e('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x648e('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x648e('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xbed2=['STRING','INTEGER','sequelize','exports'];(function(_0x59f0dc,_0x1e2497){var _0x5b5445=function(_0x57ca91){while(--_0x57ca91){_0x59f0dc['push'](_0x59f0dc['shift']());}};_0x5b5445(++_0x1e2497);}(_0xbed2,0x10e));var _0x2bed=function(_0x236209,_0x51b840){_0x236209=_0x236209-0x0;var _0x2afd5b=_0xbed2[_0x236209];return _0x2afd5b;};'use strict';var Sequelize=require(_0x2bed('0x0'));module[_0x2bed('0x1')]={'name':{'type':Sequelize[_0x2bed('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x2bed('0x3')],'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 933b307..bff01a5 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 _0xeec6=['options','count','includeAll','include','catch','show','params','rawAttributes','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/environment','sendStatus','status','json','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','UserProfileResource','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','merge','filter'];(function(_0x1fb66b,_0x27aa31){var _0x15320f=function(_0x506c96){while(--_0x506c96){_0x1fb66b['push'](_0x1fb66b['shift']());}};_0x15320f(++_0x27aa31);}(_0xeec6,0x1c2));var _0x6eec=function(_0x2b8077,_0x453634){_0x2b8077=_0x2b8077-0x0;var _0x308091=_0xeec6[_0x2b8077];return _0x308091;};'use strict';var pdf=require(_0x6eec('0x0'));var emlformat=require(_0x6eec('0x1'));var rimraf=require(_0x6eec('0x2'));var zipdir=require(_0x6eec('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6eec('0x4'));var moment=require(_0x6eec('0x5'));var BPromise=require(_0x6eec('0x6'));var Mustache=require(_0x6eec('0x7'));var util=require(_0x6eec('0x8'));var path=require(_0x6eec('0x9'));var sox=require('sox');var csv=require(_0x6eec('0xa'));var ejs=require(_0x6eec('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x6eec('0xc'));var crypto=require(_0x6eec('0xd'));var jsforce=require(_0x6eec('0xe'));var deskjs=require(_0x6eec('0xf'));var toCsv=require('to-csv');var querystring=require(_0x6eec('0x10'));var Papa=require(_0x6eec('0x11'));var Redis=require(_0x6eec('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6eec('0x13'));var logger=require(_0x6eec('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x6eec('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3091d0,_0x3387c2){_0x3387c2=_0x3387c2||0xcc;return function(_0x162db1){if(_0x162db1){return _0x3091d0[_0x6eec('0x16')](_0x3387c2);}return _0x3091d0[_0x6eec('0x17')](_0x3387c2)['end']();};}function respondWithResult(_0x25e2a5,_0x3b2972){_0x3b2972=_0x3b2972||0xc8;return function(_0x462dbb){if(_0x462dbb){return _0x25e2a5[_0x6eec('0x17')](_0x3b2972)[_0x6eec('0x18')](_0x462dbb);}};}function respondWithFilteredResult(_0x2b35d6,_0x345852){return function(_0x393271){if(_0x393271){var _0x34a7fc=_0x393271['count'],_0x2ac797=_0x345852[_0x6eec('0x19')],_0x5e2a9b=_0x345852[_0x6eec('0x19')]+_0x345852['limit'],_0x3c0c1b;if(_0x5e2a9b>=_0x34a7fc){_0x5e2a9b=_0x34a7fc;_0x3c0c1b=0xc8;}else{_0x3c0c1b=0xce;}_0x2b35d6[_0x6eec('0x17')](_0x3c0c1b);return _0x2b35d6[_0x6eec('0x1a')](_0x6eec('0x1b'),_0x2ac797+'-'+_0x5e2a9b+'/'+_0x34a7fc)['json'](_0x393271);}return null;};}function patchUpdates(_0x87f3be){return function(_0x1ed94c){try{jsonpatch[_0x6eec('0x1c')](_0x1ed94c,_0x87f3be,!![]);}catch(_0x3320a3){return BPromise[_0x6eec('0x1d')](_0x3320a3);}return _0x1ed94c[_0x6eec('0x1e')]();};}function saveUpdates(_0x536429,_0x328693){return function(_0x2f843e){if(_0x2f843e){return _0x2f843e[_0x6eec('0x1f')](_0x536429)[_0x6eec('0x20')](function(_0x1a8f73){return _0x1a8f73;});}return null;};}function removeEntity(_0xcd546f,_0x52f941){return function(_0x6e40b3){if(_0x6e40b3){return _0x6e40b3[_0x6eec('0x21')]()[_0x6eec('0x20')](function(){_0xcd546f[_0x6eec('0x17')](0xcc)[_0x6eec('0x22')]();});}};}function handleEntityNotFound(_0x13863c,_0x573249){return function(_0x384586){if(!_0x384586){_0x13863c[_0x6eec('0x16')](0x194);}return _0x384586;};}function handleError(_0xd664f5,_0x33d580){_0x33d580=_0x33d580||0x1f4;return function(_0x1d2be9){logger[_0x6eec('0x23')](_0x1d2be9[_0x6eec('0x24')]);if(_0x1d2be9[_0x6eec('0x25')]){delete _0x1d2be9[_0x6eec('0x25')];}_0xd664f5['status'](_0x33d580)[_0x6eec('0x26')](_0x1d2be9);};}exports[_0x6eec('0x27')]=function(_0x30eb98,_0x275fd0){var _0x4f507e={},_0x23432d={},_0x3b9b9f={'count':0x0,'rows':[]};var _0x518ba5=_['map'](db[_0x6eec('0x28')]['rawAttributes'],function(_0x20a130){return{'name':_0x20a130[_0x6eec('0x29')],'type':_0x20a130[_0x6eec('0x2a')][_0x6eec('0x2b')]};});_0x23432d[_0x6eec('0x2c')]=_[_0x6eec('0x2d')](_0x518ba5,_0x6eec('0x25'));_0x23432d[_0x6eec('0x2e')]=_[_0x6eec('0x2f')](_0x30eb98[_0x6eec('0x2e')]);_0x23432d['filters']=_[_0x6eec('0x30')](_0x23432d['model'],_0x23432d[_0x6eec('0x2e')]);_0x4f507e[_0x6eec('0x31')]=_[_0x6eec('0x30')](_0x23432d['model'],qs['fields'](_0x30eb98['query'][_0x6eec('0x32')]));_0x4f507e[_0x6eec('0x31')]=_0x4f507e[_0x6eec('0x31')][_0x6eec('0x33')]?_0x4f507e[_0x6eec('0x31')]:_0x23432d[_0x6eec('0x2c')];if(!_0x30eb98[_0x6eec('0x2e')][_0x6eec('0x34')](_0x6eec('0x35'))){_0x4f507e[_0x6eec('0x36')]=qs[_0x6eec('0x36')](_0x30eb98[_0x6eec('0x2e')]['limit']);_0x4f507e[_0x6eec('0x19')]=qs[_0x6eec('0x19')](_0x30eb98[_0x6eec('0x2e')]['offset']);}_0x4f507e[_0x6eec('0x37')]=qs[_0x6eec('0x38')](_0x30eb98[_0x6eec('0x2e')][_0x6eec('0x38')]);_0x4f507e[_0x6eec('0x39')]=qs[_0x6eec('0x3a')](_['pick'](_0x30eb98[_0x6eec('0x2e')],_0x23432d[_0x6eec('0x3a')]),_0x518ba5);if(_0x30eb98[_0x6eec('0x2e')]['filter']){_0x4f507e['where']=_[_0x6eec('0x3b')](_0x4f507e[_0x6eec('0x39')],{'$or':_[_0x6eec('0x2d')](_0x518ba5,function(_0x3f79d1){if(_0x3f79d1[_0x6eec('0x2a')]!=='VIRTUAL'){var _0x223dfa={};_0x223dfa[_0x3f79d1[_0x6eec('0x25')]]={'$like':'%'+_0x30eb98[_0x6eec('0x2e')][_0x6eec('0x3c')]+'%'};return _0x223dfa;}})});}_0x4f507e=_[_0x6eec('0x3b')]({},_0x4f507e,_0x30eb98[_0x6eec('0x3d')]);var _0x36cfe1={'where':_0x4f507e[_0x6eec('0x39')]};return db['UserProfileResource'][_0x6eec('0x3e')](_0x36cfe1)[_0x6eec('0x20')](function(_0x4d30c9){_0x3b9b9f['count']=_0x4d30c9;if(_0x30eb98[_0x6eec('0x2e')][_0x6eec('0x3f')]){_0x4f507e[_0x6eec('0x40')]=[{'all':!![]}];}return db[_0x6eec('0x28')]['findAll'](_0x4f507e);})['then'](function(_0x35fd91){_0x3b9b9f['rows']=_0x35fd91;return _0x3b9b9f;})['then'](respondWithFilteredResult(_0x275fd0,_0x4f507e))[_0x6eec('0x41')](handleError(_0x275fd0,null));};exports[_0x6eec('0x42')]=function(_0x125bd4,_0x34049a){var _0x25d3f3={'raw':![],'where':{'id':_0x125bd4[_0x6eec('0x43')]['id']}},_0x58dfe7={};_0x58dfe7[_0x6eec('0x2c')]=_['keys'](db[_0x6eec('0x28')][_0x6eec('0x44')]);_0x58dfe7['query']=_[_0x6eec('0x2f')](_0x125bd4[_0x6eec('0x2e')]);_0x58dfe7['filters']=_[_0x6eec('0x30')](_0x58dfe7[_0x6eec('0x2c')],_0x58dfe7[_0x6eec('0x2e')]);_0x25d3f3[_0x6eec('0x31')]=_['intersection'](_0x58dfe7[_0x6eec('0x2c')],qs[_0x6eec('0x32')](_0x125bd4[_0x6eec('0x2e')][_0x6eec('0x32')]));_0x25d3f3[_0x6eec('0x31')]=_0x25d3f3['attributes']['length']?_0x25d3f3[_0x6eec('0x31')]:_0x58dfe7[_0x6eec('0x2c')];if(_0x125bd4[_0x6eec('0x2e')][_0x6eec('0x3f')]){_0x25d3f3[_0x6eec('0x40')]=[{'all':!![]}];}_0x25d3f3=_['merge']({},_0x25d3f3,_0x125bd4[_0x6eec('0x3d')]);return db['UserProfileResource'][_0x6eec('0x45')](_0x25d3f3)[_0x6eec('0x20')](handleEntityNotFound(_0x34049a,null))[_0x6eec('0x20')](respondWithResult(_0x34049a,null))['catch'](handleError(_0x34049a,null));};exports[_0x6eec('0x46')]=function(_0x35a4a5,_0x14ee5e){return db[_0x6eec('0x28')][_0x6eec('0x46')](_0x35a4a5['body'],{})[_0x6eec('0x20')](respondWithResult(_0x14ee5e,0xc9))['catch'](handleError(_0x14ee5e,null));};exports['update']=function(_0x2529ad,_0x535d96){if(_0x2529ad[_0x6eec('0x47')]['id']){delete _0x2529ad[_0x6eec('0x47')]['id'];}return db[_0x6eec('0x28')]['find']({'where':{'id':_0x2529ad['params']['id']}})[_0x6eec('0x20')](handleEntityNotFound(_0x535d96,null))[_0x6eec('0x20')](saveUpdates(_0x2529ad[_0x6eec('0x47')],null))[_0x6eec('0x20')](respondWithResult(_0x535d96,null))[_0x6eec('0x41')](handleError(_0x535d96,null));};exports[_0x6eec('0x21')]=function(_0x185711,_0x442bca){return db[_0x6eec('0x28')][_0x6eec('0x45')]({'where':{'id':_0x185711['params']['id']}})['then'](handleEntityNotFound(_0x442bca,null))[_0x6eec('0x20')](removeEntity(_0x442bca,null))[_0x6eec('0x41')](handleError(_0x442bca,null));};exports[_0x6eec('0x48')]=function(_0x577fb6,_0x2c8400){return db[_0x6eec('0x28')][_0x6eec('0x48')]()[_0x6eec('0x20')](respondWithResult(_0x2c8400,null))[_0x6eec('0x41')](handleError(_0x2c8400,null));}; \ No newline at end of file +var _0x8958=['include','findAll','catch','length','options','find','create','body','params','destroy','describe','eml-format','moment','mustache','util','path','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','../../config/utils','../../config/environment','../../mysqldb','status','end','count','offset','limit','set','Content-Range','json','apply','update','then','error','name','map','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','UserProfileResource','includeAll'];(function(_0x4ef921,_0x31cc9d){var _0x4766e1=function(_0x49bc2c){while(--_0x49bc2c){_0x4ef921['push'](_0x4ef921['shift']());}};_0x4766e1(++_0x31cc9d);}(_0x8958,0x93));var _0x8895=function(_0x363dfe,_0x2f066c){_0x363dfe=_0x363dfe-0x0;var _0x2217e9=_0x8958[_0x363dfe];return _0x2217e9;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8895('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x8895('0x1'));var BPromise=require('bluebird');var Mustache=require(_0x8895('0x2'));var util=require(_0x8895('0x3'));var path=require(_0x8895('0x4'));var sox=require('sox');var csv=require(_0x8895('0x5'));var ejs=require(_0x8895('0x6'));var fs=require('fs');var _=require(_0x8895('0x7'));var squel=require(_0x8895('0x8'));var crypto=require(_0x8895('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x8895('0xa'));var toCsv=require(_0x8895('0x5'));var querystring=require(_0x8895('0xb'));var Papa=require(_0x8895('0xc'));var Redis=require(_0x8895('0xd'));var authService=require(_0x8895('0xe'));var qs=require(_0x8895('0xf'));var as=require(_0x8895('0x10'));var hardwareService=require(_0x8895('0x11'));var logger=require(_0x8895('0x12'))('api');var utils=require(_0x8895('0x13'));var config=require(_0x8895('0x14'));var db=require(_0x8895('0x15'))['db'];function respondWithStatusCode(_0x301bec,_0x446e1a){_0x446e1a=_0x446e1a||0xcc;return function(_0xaf93bc){if(_0xaf93bc){return _0x301bec['sendStatus'](_0x446e1a);}return _0x301bec[_0x8895('0x16')](_0x446e1a)[_0x8895('0x17')]();};}function respondWithResult(_0x56c18e,_0x57d40a){_0x57d40a=_0x57d40a||0xc8;return function(_0x47b9fe){if(_0x47b9fe){return _0x56c18e[_0x8895('0x16')](_0x57d40a)['json'](_0x47b9fe);}};}function respondWithFilteredResult(_0x4156f5,_0x337101){return function(_0x195789){if(_0x195789){var _0x3d7b59=_0x195789[_0x8895('0x18')],_0x2c9d40=_0x337101[_0x8895('0x19')],_0x5b4c2e=_0x337101[_0x8895('0x19')]+_0x337101[_0x8895('0x1a')],_0x4128e2;if(_0x5b4c2e>=_0x3d7b59){_0x5b4c2e=_0x3d7b59;_0x4128e2=0xc8;}else{_0x4128e2=0xce;}_0x4156f5[_0x8895('0x16')](_0x4128e2);return _0x4156f5[_0x8895('0x1b')](_0x8895('0x1c'),_0x2c9d40+'-'+_0x5b4c2e+'/'+_0x3d7b59)[_0x8895('0x1d')](_0x195789);}return null;};}function patchUpdates(_0x2da618){return function(_0x24fef0){try{jsonpatch[_0x8895('0x1e')](_0x24fef0,_0x2da618,!![]);}catch(_0x2df795){return BPromise['reject'](_0x2df795);}return _0x24fef0['save']();};}function saveUpdates(_0x4fcbc3,_0x3daf43){return function(_0x456282){if(_0x456282){return _0x456282[_0x8895('0x1f')](_0x4fcbc3)[_0x8895('0x20')](function(_0x3f7d5a){return _0x3f7d5a;});}return null;};}function removeEntity(_0x35bda5,_0x461346){return function(_0xc1ce17){if(_0xc1ce17){return _0xc1ce17['destroy']()[_0x8895('0x20')](function(){_0x35bda5[_0x8895('0x16')](0xcc)[_0x8895('0x17')]();});}};}function handleEntityNotFound(_0x1f71f3,_0x29223d){return function(_0x4d092d){if(!_0x4d092d){_0x1f71f3['sendStatus'](0x194);}return _0x4d092d;};}function handleError(_0x278c81,_0x398382){_0x398382=_0x398382||0x1f4;return function(_0x38f7ad){logger[_0x8895('0x21')](_0x38f7ad['stack']);if(_0x38f7ad[_0x8895('0x22')]){delete _0x38f7ad[_0x8895('0x22')];}_0x278c81[_0x8895('0x16')](_0x398382)['send'](_0x38f7ad);};}exports['index']=function(_0x78b57,_0x555e60){var _0x3d51b0={},_0x3e3b48={},_0x10b48f={'count':0x0,'rows':[]};var _0xf5fb66=_[_0x8895('0x23')](db['UserProfileResource']['rawAttributes'],function(_0x6e449d){return{'name':_0x6e449d[_0x8895('0x24')],'type':_0x6e449d[_0x8895('0x25')][_0x8895('0x26')]};});_0x3e3b48[_0x8895('0x27')]=_['map'](_0xf5fb66,'name');_0x3e3b48[_0x8895('0x28')]=_[_0x8895('0x29')](_0x78b57[_0x8895('0x28')]);_0x3e3b48[_0x8895('0x2a')]=_[_0x8895('0x2b')](_0x3e3b48['model'],_0x3e3b48[_0x8895('0x28')]);_0x3d51b0['attributes']=_[_0x8895('0x2b')](_0x3e3b48['model'],qs[_0x8895('0x2c')](_0x78b57[_0x8895('0x28')][_0x8895('0x2c')]));_0x3d51b0[_0x8895('0x2d')]=_0x3d51b0[_0x8895('0x2d')]['length']?_0x3d51b0[_0x8895('0x2d')]:_0x3e3b48[_0x8895('0x27')];if(!_0x78b57[_0x8895('0x28')][_0x8895('0x2e')](_0x8895('0x2f'))){_0x3d51b0['limit']=qs[_0x8895('0x1a')](_0x78b57['query'][_0x8895('0x1a')]);_0x3d51b0['offset']=qs[_0x8895('0x19')](_0x78b57[_0x8895('0x28')][_0x8895('0x19')]);}_0x3d51b0[_0x8895('0x30')]=qs[_0x8895('0x31')](_0x78b57['query'][_0x8895('0x31')]);_0x3d51b0['where']=qs[_0x8895('0x2a')](_[_0x8895('0x32')](_0x78b57[_0x8895('0x28')],_0x3e3b48[_0x8895('0x2a')]),_0xf5fb66);if(_0x78b57[_0x8895('0x28')][_0x8895('0x33')]){_0x3d51b0['where']=_[_0x8895('0x34')](_0x3d51b0[_0x8895('0x35')],{'$or':_['map'](_0xf5fb66,function(_0x2557fc){if(_0x2557fc['type']!==_0x8895('0x36')){var _0x332a79={};_0x332a79[_0x2557fc['name']]={'$like':'%'+_0x78b57[_0x8895('0x28')][_0x8895('0x33')]+'%'};return _0x332a79;}})});}_0x3d51b0=_['merge']({},_0x3d51b0,_0x78b57['options']);var _0x202130={'where':_0x3d51b0[_0x8895('0x35')]};return db[_0x8895('0x37')][_0x8895('0x18')](_0x202130)[_0x8895('0x20')](function(_0x4917d1){_0x10b48f[_0x8895('0x18')]=_0x4917d1;if(_0x78b57[_0x8895('0x28')][_0x8895('0x38')]){_0x3d51b0[_0x8895('0x39')]=[{'all':!![]}];}return db[_0x8895('0x37')][_0x8895('0x3a')](_0x3d51b0);})['then'](function(_0x174be1){_0x10b48f['rows']=_0x174be1;return _0x10b48f;})[_0x8895('0x20')](respondWithFilteredResult(_0x555e60,_0x3d51b0))[_0x8895('0x3b')](handleError(_0x555e60,null));};exports['show']=function(_0x1ca234,_0x4e8fbc){var _0x1e6395={'raw':![],'where':{'id':_0x1ca234['params']['id']}},_0x5e6413={};_0x5e6413['model']=_['keys'](db['UserProfileResource']['rawAttributes']);_0x5e6413[_0x8895('0x28')]=_[_0x8895('0x29')](_0x1ca234['query']);_0x5e6413['filters']=_[_0x8895('0x2b')](_0x5e6413[_0x8895('0x27')],_0x5e6413['query']);_0x1e6395[_0x8895('0x2d')]=_[_0x8895('0x2b')](_0x5e6413[_0x8895('0x27')],qs[_0x8895('0x2c')](_0x1ca234[_0x8895('0x28')]['fields']));_0x1e6395['attributes']=_0x1e6395['attributes'][_0x8895('0x3c')]?_0x1e6395['attributes']:_0x5e6413[_0x8895('0x27')];if(_0x1ca234[_0x8895('0x28')][_0x8895('0x38')]){_0x1e6395[_0x8895('0x39')]=[{'all':!![]}];}_0x1e6395=_['merge']({},_0x1e6395,_0x1ca234[_0x8895('0x3d')]);return db[_0x8895('0x37')][_0x8895('0x3e')](_0x1e6395)[_0x8895('0x20')](handleEntityNotFound(_0x4e8fbc,null))[_0x8895('0x20')](respondWithResult(_0x4e8fbc,null))[_0x8895('0x3b')](handleError(_0x4e8fbc,null));};exports[_0x8895('0x3f')]=function(_0x34e91e,_0x55fb78){return db[_0x8895('0x37')][_0x8895('0x3f')](_0x34e91e['body'],{})[_0x8895('0x20')](respondWithResult(_0x55fb78,0xc9))['catch'](handleError(_0x55fb78,null));};exports['update']=function(_0x13546d,_0x337a9f){if(_0x13546d[_0x8895('0x40')]['id']){delete _0x13546d['body']['id'];}return db[_0x8895('0x37')]['find']({'where':{'id':_0x13546d[_0x8895('0x41')]['id']}})[_0x8895('0x20')](handleEntityNotFound(_0x337a9f,null))[_0x8895('0x20')](saveUpdates(_0x13546d[_0x8895('0x40')],null))[_0x8895('0x20')](respondWithResult(_0x337a9f,null))[_0x8895('0x3b')](handleError(_0x337a9f,null));};exports[_0x8895('0x42')]=function(_0x4dde7c,_0x47c4b9){return db[_0x8895('0x37')][_0x8895('0x3e')]({'where':{'id':_0x4dde7c['params']['id']}})[_0x8895('0x20')](handleEntityNotFound(_0x47c4b9,null))['then'](removeEntity(_0x47c4b9,null))['catch'](handleError(_0x47c4b9,null));};exports[_0x8895('0x43')]=function(_0x4d52ac,_0x130203){return db[_0x8895('0x37')][_0x8895('0x43')]()[_0x8895('0x20')](respondWithResult(_0x130203,null))[_0x8895('0x3b')](handleError(_0x130203,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 65b359d..0e79b19 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 _0xb242=['./userProfileResource.attributes','exports','define','UserProfileResource','user_profile_has_resources','sectionId','lodash','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xb242,0x124));var _0x2b24=function(_0x1269c6,_0x1c8942){_0x1269c6=_0x1269c6-0x0;var _0x4868c7=_0xb242[_0x1269c6];return _0x4868c7;};'use strict';var _=require(_0x2b24('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x2b24('0x1'));var moment=require(_0x2b24('0x2'));var BPromise=require('bluebird');var rp=require(_0x2b24('0x3'));var fs=require('fs');var path=require(_0x2b24('0x4'));var rimraf=require(_0x2b24('0x5'));var config=require(_0x2b24('0x6'));var attributes=require(_0x2b24('0x7'));module[_0x2b24('0x8')]=function(_0x1f52ce,_0x12bbf6){return _0x1f52ce[_0x2b24('0x9')](_0x2b24('0xa'),attributes,{'tableName':_0x2b24('0xb'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':['resourceId',_0x2b24('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc072=['api','moment','bluebird','request-promise','path','../../config/environment','./userProfileResource.attributes','exports','define','UserProfileResource','user_profile_has_resources','resourceId','lodash','util','../../config/logger'];(function(_0x2aceda,_0x1da084){var _0x6906ca=function(_0x4d2060){while(--_0x4d2060){_0x2aceda['push'](_0x2aceda['shift']());}};_0x6906ca(++_0x1da084);}(_0xc072,0x1bf));var _0x2c07=function(_0x13287c,_0x2ea3e1){_0x13287c=_0x13287c-0x0;var _0x2fd934=_0xc072[_0x13287c];return _0x2fd934;};'use strict';var _=require(_0x2c07('0x0'));var util=require(_0x2c07('0x1'));var logger=require(_0x2c07('0x2'))(_0x2c07('0x3'));var moment=require(_0x2c07('0x4'));var BPromise=require(_0x2c07('0x5'));var rp=require(_0x2c07('0x6'));var fs=require('fs');var path=require(_0x2c07('0x7'));var rimraf=require('rimraf');var config=require(_0x2c07('0x8'));var attributes=require(_0x2c07('0x9'));module[_0x2c07('0xa')]=function(_0x2e6092,_0x5d8560){return _0x2e6092[_0x2c07('0xb')](_0x2c07('0xc'),attributes,{'tableName':_0x2c07('0xd'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0x2c07('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 14069f1..f76f756 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 _0xbc3f=['info','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','request\x20sent','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','UserProfileResource,\x20%s,\x20%s','message'];(function(_0x56cad9,_0x283604){var _0x50ce8e=function(_0x56cc8c){while(--_0x56cc8c){_0x56cad9['push'](_0x56cad9['shift']());}};_0x50ce8e(++_0x283604);}(_0xbc3f,0x17d));var _0xfbc3=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xbc3f[_0x139a3c];return _0x2b375b;};'use strict';var _=require(_0xfbc3('0x0'));var util=require('util');var moment=require(_0xfbc3('0x1'));var BPromise=require('bluebird');var rs=require(_0xfbc3('0x2'));var fs=require('fs');var Redis=require(_0xfbc3('0x3'));var db=require(_0xfbc3('0x4'))['db'];var utils=require(_0xfbc3('0x5'));var logger=require('../../config/logger')(_0xfbc3('0x6'));var config=require('../../config/environment');var jayson=require(_0xfbc3('0x7'));var client=jayson[_0xfbc3('0x8')][_0xfbc3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x57a5c0,_0x400753,_0x6377ce){return new BPromise(function(_0x5ee44a,_0x4e78f5){return client[_0xfbc3('0xa')](_0x57a5c0,_0x6377ce)['then'](function(_0x60cc6c){logger['info']('UserProfileResource,\x20%s,\x20%s',_0x400753,_0xfbc3('0xb'));logger['debug'](_0xfbc3('0xc'),_0x400753,'request\x20sent',JSON[_0xfbc3('0xd')](_0x60cc6c));if(_0x60cc6c['error']){if(_0x60cc6c[_0xfbc3('0xe')][_0xfbc3('0xf')]===0x1f4){logger[_0xfbc3('0xe')](_0xfbc3('0x10'),_0x400753,_0x60cc6c[_0xfbc3('0xe')][_0xfbc3('0x11')]);return _0x4e78f5(_0x60cc6c[_0xfbc3('0xe')]['message']);}logger[_0xfbc3('0xe')](_0xfbc3('0x10'),_0x400753,_0x60cc6c[_0xfbc3('0xe')][_0xfbc3('0x11')]);return _0x5ee44a(_0x60cc6c['error'][_0xfbc3('0x11')]);}else{logger[_0xfbc3('0x12')](_0xfbc3('0x10'),_0x400753,_0xfbc3('0xb'));_0x5ee44a(_0x60cc6c[_0xfbc3('0x13')][_0xfbc3('0x11')]);}})[_0xfbc3('0x14')](function(_0x3dbb6a){logger['error']('UserProfileResource,\x20%s,\x20%s',_0x400753,_0x3dbb6a);_0x4e78f5(_0x3dbb6a);});});} \ No newline at end of file +var _0xd005=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis'];(function(_0x40822a,_0x582b60){var _0x357420=function(_0x6cee0b){while(--_0x6cee0b){_0x40822a['push'](_0x40822a['shift']());}};_0x357420(++_0x582b60);}(_0xd005,0x10f));var _0x5d00=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xd005[_0x4b369d];return _0x571a98;};'use strict';var _=require('lodash');var util=require(_0x5d00('0x0'));var moment=require(_0x5d00('0x1'));var BPromise=require(_0x5d00('0x2'));var rs=require(_0x5d00('0x3'));var fs=require('fs');var Redis=require(_0x5d00('0x4'));var db=require(_0x5d00('0x5'))['db'];var utils=require(_0x5d00('0x6'));var logger=require('../../config/logger')(_0x5d00('0x7'));var config=require('../../config/environment');var jayson=require(_0x5d00('0x8'));var client=jayson[_0x5d00('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3824f7,_0xae90f3,_0x377393){return new BPromise(function(_0x297c0a,_0xe71a32){return client[_0x5d00('0xa')](_0x3824f7,_0x377393)[_0x5d00('0xb')](function(_0x102fc7){logger[_0x5d00('0xc')](_0x5d00('0xd'),_0xae90f3,_0x5d00('0xe'));logger[_0x5d00('0xf')](_0x5d00('0x10'),_0xae90f3,_0x5d00('0xe'),JSON[_0x5d00('0x11')](_0x102fc7));if(_0x102fc7['error']){if(_0x102fc7[_0x5d00('0x12')][_0x5d00('0x13')]===0x1f4){logger[_0x5d00('0x12')]('UserProfileResource,\x20%s,\x20%s',_0xae90f3,_0x102fc7['error']['message']);return _0xe71a32(_0x102fc7['error'][_0x5d00('0x14')]);}logger[_0x5d00('0x12')]('UserProfileResource,\x20%s,\x20%s',_0xae90f3,_0x102fc7[_0x5d00('0x12')][_0x5d00('0x14')]);return _0x297c0a(_0x102fc7[_0x5d00('0x12')]['message']);}else{logger['info'](_0x5d00('0xd'),_0xae90f3,_0x5d00('0xe'));_0x297c0a(_0x102fc7[_0x5d00('0x15')]['message']);}})[_0x5d00('0x16')](function(_0x28fc8c){logger[_0x5d00('0x12')](_0x5d00('0xd'),_0xae90f3,_0x28fc8c);_0xe71a32(_0x28fc8c);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 17f6753..66cb057 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 _0x18fe=['isAuthenticated','/describe','describe','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x2dfb34,_0x87239d){var _0x9029de=function(_0x35f096){while(--_0x35f096){_0x2dfb34['push'](_0x2dfb34['shift']());}};_0x9029de(++_0x87239d);}(_0x18fe,0x13a));var _0xe18f=function(_0x36e374,_0x32ac0c){_0x36e374=_0x36e374-0x0;var _0x1ee011=_0x18fe[_0x36e374];return _0x1ee011;};'use strict';var multer=require(_0xe18f('0x0'));var util=require(_0xe18f('0x1'));var path=require(_0xe18f('0x2'));var timeout=require(_0xe18f('0x3'));var express=require(_0xe18f('0x4'));var router=express[_0xe18f('0x5')]();var auth=require(_0xe18f('0x6'));var interaction=require(_0xe18f('0x7'));var config=require(_0xe18f('0x8'));var controller=require('./userProfileSection.controller');router[_0xe18f('0x9')]('/',auth[_0xe18f('0xa')](),controller['index']);router[_0xe18f('0x9')](_0xe18f('0xb'),auth[_0xe18f('0xa')](),controller[_0xe18f('0xc')]);router[_0xe18f('0x9')]('/:id',auth[_0xe18f('0xa')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xe18f('0xd')](_0xe18f('0xe'),auth[_0xe18f('0xa')](),controller[_0xe18f('0xf')]);router['delete'](_0xe18f('0xe'),auth[_0xe18f('0xa')](),controller[_0xe18f('0x10')]);module[_0xe18f('0x11')]=router; \ No newline at end of file +var _0xb54e=['post','put','update','delete','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x1bf1b8,_0x47a871){var _0x2265d3=function(_0x417045){while(--_0x417045){_0x1bf1b8['push'](_0x1bf1b8['shift']());}};_0x2265d3(++_0x47a871);}(_0xb54e,0x1e0));var _0xeb54=function(_0x37ad7f,_0x307347){_0x37ad7f=_0x37ad7f-0x0;var _0x54d85a=_0xb54e[_0x37ad7f];return _0x54d85a;};'use strict';var multer=require('multer');var util=require(_0xeb54('0x0'));var path=require('path');var timeout=require(_0xeb54('0x1'));var express=require(_0xeb54('0x2'));var router=express[_0xeb54('0x3')]();var auth=require(_0xeb54('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xeb54('0x5'));var controller=require('./userProfileSection.controller');router[_0xeb54('0x6')]('/',auth[_0xeb54('0x7')](),controller[_0xeb54('0x8')]);router[_0xeb54('0x6')](_0xeb54('0x9'),auth[_0xeb54('0x7')](),controller[_0xeb54('0xa')]);router[_0xeb54('0x6')](_0xeb54('0xb'),auth[_0xeb54('0x7')](),controller[_0xeb54('0xc')]);router[_0xeb54('0xd')]('/',auth[_0xeb54('0x7')](),controller['create']);router[_0xeb54('0xe')]('/:id',auth[_0xeb54('0x7')](),controller[_0xeb54('0xf')]);router[_0xeb54('0x10')](_0xeb54('0xb'),auth[_0xeb54('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index e7fea33..b080da9 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 _0x6f2d=['getDataValue','split','sequelize','STRING','BOOLEAN','setDataValue','crudPermissions','join'];(function(_0x29a59a,_0x5934a2){var _0x44293e=function(_0x176dd6){while(--_0x176dd6){_0x29a59a['push'](_0x29a59a['shift']());}};_0x44293e(++_0x5934a2);}(_0x6f2d,0x182));var _0xd6f2=function(_0x21edef,_0x5bddcc){_0x21edef=_0x21edef-0x0;var _0x44ee34=_0x6f2d[_0x21edef];return _0x44ee34;};'use strict';var Sequelize=require(_0xd6f2('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'category':{'type':Sequelize[_0xd6f2('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize['INTEGER'],'allowNull':![]},'enabled':{'type':Sequelize[_0xd6f2('0x2')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xd6f2('0x2')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xd6f2('0x1')],'set':function(_0x13ab05){this[_0xd6f2('0x3')](_0xd6f2('0x4'),_0x13ab05?_0x13ab05[_0xd6f2('0x5')](''):[]);},'get':function(){return this[_0xd6f2('0x6')](_0xd6f2('0x4'))?this[_0xd6f2('0x6')](_0xd6f2('0x4'))[_0xd6f2('0x7')](''):[];}}}; \ No newline at end of file +var _0xc14d=['getDataValue','split','STRING','INTEGER','BOOLEAN','setDataValue','crudPermissions','join'];(function(_0x71b765,_0x3053f8){var _0x34cb24=function(_0x2dd237){while(--_0x2dd237){_0x71b765['push'](_0x71b765['shift']());}};_0x34cb24(++_0x3053f8);}(_0xc14d,0x1ea));var _0xdc14=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xc14d[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xdc14('0x0')],'allowNull':![]},'category':{'type':Sequelize[_0xdc14('0x0')],'allowNull':![]},'sectionId':{'type':Sequelize[_0xdc14('0x1')],'allowNull':![]},'enabled':{'type':Sequelize[_0xdc14('0x2')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xdc14('0x2')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xdc14('0x0')],'set':function(_0x6c0ed3){this[_0xdc14('0x3')](_0xdc14('0x4'),_0x6c0ed3?_0x6c0ed3[_0xdc14('0x5')](''):[]);},'get':function(){return this[_0xdc14('0x6')]('crudPermissions')?this[_0xdc14('0x6')]('crudPermissions')[_0xdc14('0x7')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 7ee5af2..7f775d4 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 _0xcb06=['params','rawAttributes','find','create','body','update','describe','zip-dir','request-promise','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','Content-Range','apply','then','destroy','end','stack','name','send','index','map','UserProfileSection','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','show'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xcb06,0x127));var _0x6cb0=function(_0x3071ab,_0x574a59){_0x3071ab=_0x3071ab-0x0;var _0x2f458c=_0xcb06[_0x3071ab];return _0x2f458c;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x6cb0('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6cb0('0x1'));var moment=require('moment');var BPromise=require(_0x6cb0('0x2'));var Mustache=require('mustache');var util=require(_0x6cb0('0x3'));var path=require('path');var sox=require(_0x6cb0('0x4'));var csv=require(_0x6cb0('0x5'));var ejs=require(_0x6cb0('0x6'));var fs=require('fs');var _=require(_0x6cb0('0x7'));var squel=require(_0x6cb0('0x8'));var crypto=require(_0x6cb0('0x9'));var jsforce=require(_0x6cb0('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x6cb0('0x5'));var querystring=require(_0x6cb0('0xb'));var Papa=require(_0x6cb0('0xc'));var Redis=require(_0x6cb0('0xd'));var authService=require(_0x6cb0('0xe'));var qs=require(_0x6cb0('0xf'));var as=require(_0x6cb0('0x10'));var hardwareService=require(_0x6cb0('0x11'));var logger=require(_0x6cb0('0x12'))(_0x6cb0('0x13'));var utils=require(_0x6cb0('0x14'));var config=require(_0x6cb0('0x15'));var db=require(_0x6cb0('0x16'))['db'];function respondWithStatusCode(_0x5633b8,_0x5161c5){_0x5161c5=_0x5161c5||0xcc;return function(_0x141a9f){if(_0x141a9f){return _0x5633b8[_0x6cb0('0x17')](_0x5161c5);}return _0x5633b8[_0x6cb0('0x18')](_0x5161c5)['end']();};}function respondWithResult(_0x37409f,_0x3b2b85){_0x3b2b85=_0x3b2b85||0xc8;return function(_0x362fd4){if(_0x362fd4){return _0x37409f[_0x6cb0('0x18')](_0x3b2b85)[_0x6cb0('0x19')](_0x362fd4);}};}function respondWithFilteredResult(_0x270215,_0x47fa55){return function(_0x7609a){if(_0x7609a){var _0x2b633e=_0x7609a[_0x6cb0('0x1a')],_0xb6b531=_0x47fa55[_0x6cb0('0x1b')],_0x51d0db=_0x47fa55[_0x6cb0('0x1b')]+_0x47fa55[_0x6cb0('0x1c')],_0x1a4e69;if(_0x51d0db>=_0x2b633e){_0x51d0db=_0x2b633e;_0x1a4e69=0xc8;}else{_0x1a4e69=0xce;}_0x270215[_0x6cb0('0x18')](_0x1a4e69);return _0x270215['set'](_0x6cb0('0x1d'),_0xb6b531+'-'+_0x51d0db+'/'+_0x2b633e)[_0x6cb0('0x19')](_0x7609a);}return null;};}function patchUpdates(_0x456243){return function(_0x40d40a){try{jsonpatch[_0x6cb0('0x1e')](_0x40d40a,_0x456243,!![]);}catch(_0x38c61a){return BPromise['reject'](_0x38c61a);}return _0x40d40a['save']();};}function saveUpdates(_0x366e71,_0x2ca4c8){return function(_0x52d250){if(_0x52d250){return _0x52d250['update'](_0x366e71)[_0x6cb0('0x1f')](function(_0x3874cb){return _0x3874cb;});}return null;};}function removeEntity(_0x2eee4d,_0x590c69){return function(_0xe1ffd1){if(_0xe1ffd1){return _0xe1ffd1[_0x6cb0('0x20')]()[_0x6cb0('0x1f')](function(){_0x2eee4d['status'](0xcc)[_0x6cb0('0x21')]();});}};}function handleEntityNotFound(_0x3182c0,_0x412eea){return function(_0x3402b3){if(!_0x3402b3){_0x3182c0['sendStatus'](0x194);}return _0x3402b3;};}function handleError(_0x246cab,_0x99aebc){_0x99aebc=_0x99aebc||0x1f4;return function(_0x4302e0){logger['error'](_0x4302e0[_0x6cb0('0x22')]);if(_0x4302e0[_0x6cb0('0x23')]){delete _0x4302e0[_0x6cb0('0x23')];}_0x246cab[_0x6cb0('0x18')](_0x99aebc)[_0x6cb0('0x24')](_0x4302e0);};}exports[_0x6cb0('0x25')]=function(_0x4953d5,_0x3ca195){var _0x3c97f9={},_0x58aa93={},_0x1b5648={'count':0x0,'rows':[]};var _0x5be66e=_[_0x6cb0('0x26')](db[_0x6cb0('0x27')]['rawAttributes'],function(_0x838416){return{'name':_0x838416['fieldName'],'type':_0x838416[_0x6cb0('0x28')][_0x6cb0('0x29')]};});_0x58aa93[_0x6cb0('0x2a')]=_[_0x6cb0('0x26')](_0x5be66e,_0x6cb0('0x23'));_0x58aa93[_0x6cb0('0x2b')]=_[_0x6cb0('0x2c')](_0x4953d5['query']);_0x58aa93[_0x6cb0('0x2d')]=_['intersection'](_0x58aa93['model'],_0x58aa93[_0x6cb0('0x2b')]);_0x3c97f9['attributes']=_[_0x6cb0('0x2e')](_0x58aa93[_0x6cb0('0x2a')],qs[_0x6cb0('0x2f')](_0x4953d5['query'][_0x6cb0('0x2f')]));_0x3c97f9['attributes']=_0x3c97f9[_0x6cb0('0x30')][_0x6cb0('0x31')]?_0x3c97f9['attributes']:_0x58aa93['model'];if(!_0x4953d5[_0x6cb0('0x2b')][_0x6cb0('0x32')](_0x6cb0('0x33'))){_0x3c97f9['limit']=qs['limit'](_0x4953d5[_0x6cb0('0x2b')][_0x6cb0('0x1c')]);_0x3c97f9[_0x6cb0('0x1b')]=qs[_0x6cb0('0x1b')](_0x4953d5['query'][_0x6cb0('0x1b')]);}_0x3c97f9[_0x6cb0('0x34')]=qs['sort'](_0x4953d5[_0x6cb0('0x2b')][_0x6cb0('0x35')]);_0x3c97f9[_0x6cb0('0x36')]=qs[_0x6cb0('0x2d')](_[_0x6cb0('0x37')](_0x4953d5[_0x6cb0('0x2b')],_0x58aa93[_0x6cb0('0x2d')]),_0x5be66e);if(_0x4953d5[_0x6cb0('0x2b')][_0x6cb0('0x38')]){_0x3c97f9[_0x6cb0('0x36')]=_['merge'](_0x3c97f9['where'],{'$or':_[_0x6cb0('0x26')](_0x5be66e,function(_0x447d3b){if(_0x447d3b[_0x6cb0('0x28')]!==_0x6cb0('0x39')){var _0x43347c={};_0x43347c[_0x447d3b['name']]={'$like':'%'+_0x4953d5[_0x6cb0('0x2b')][_0x6cb0('0x38')]+'%'};return _0x43347c;}})});}_0x3c97f9=_[_0x6cb0('0x3a')]({},_0x3c97f9,_0x4953d5[_0x6cb0('0x3b')]);var _0x1de44c={'where':_0x3c97f9[_0x6cb0('0x36')]};return db[_0x6cb0('0x27')][_0x6cb0('0x1a')](_0x1de44c)['then'](function(_0x71a9aa){_0x1b5648[_0x6cb0('0x1a')]=_0x71a9aa;if(_0x4953d5[_0x6cb0('0x2b')][_0x6cb0('0x3c')]){_0x3c97f9[_0x6cb0('0x3d')]=[{'all':!![]}];}return db[_0x6cb0('0x27')][_0x6cb0('0x3e')](_0x3c97f9);})[_0x6cb0('0x1f')](function(_0x2596c1){_0x1b5648['rows']=_0x2596c1;return _0x1b5648;})[_0x6cb0('0x1f')](respondWithFilteredResult(_0x3ca195,_0x3c97f9))[_0x6cb0('0x3f')](handleError(_0x3ca195,null));};exports[_0x6cb0('0x40')]=function(_0x56eb13,_0x1de967){var _0x5cb198={'raw':![],'where':{'id':_0x56eb13[_0x6cb0('0x41')]['id']}},_0x4ec8dd={};_0x4ec8dd[_0x6cb0('0x2a')]=_[_0x6cb0('0x2c')](db[_0x6cb0('0x27')][_0x6cb0('0x42')]);_0x4ec8dd[_0x6cb0('0x2b')]=_['keys'](_0x56eb13[_0x6cb0('0x2b')]);_0x4ec8dd['filters']=_[_0x6cb0('0x2e')](_0x4ec8dd['model'],_0x4ec8dd[_0x6cb0('0x2b')]);_0x5cb198['attributes']=_[_0x6cb0('0x2e')](_0x4ec8dd[_0x6cb0('0x2a')],qs[_0x6cb0('0x2f')](_0x56eb13[_0x6cb0('0x2b')][_0x6cb0('0x2f')]));_0x5cb198[_0x6cb0('0x30')]=_0x5cb198['attributes'][_0x6cb0('0x31')]?_0x5cb198[_0x6cb0('0x30')]:_0x4ec8dd['model'];if(_0x56eb13['query'][_0x6cb0('0x3c')]){_0x5cb198[_0x6cb0('0x3d')]=[{'all':!![]}];}_0x5cb198=_[_0x6cb0('0x3a')]({},_0x5cb198,_0x56eb13['options']);return db[_0x6cb0('0x27')][_0x6cb0('0x43')](_0x5cb198)[_0x6cb0('0x1f')](handleEntityNotFound(_0x1de967,null))[_0x6cb0('0x1f')](respondWithResult(_0x1de967,null))[_0x6cb0('0x3f')](handleError(_0x1de967,null));};exports[_0x6cb0('0x44')]=function(_0x304bf3,_0x5d61e3){return db[_0x6cb0('0x27')][_0x6cb0('0x44')](_0x304bf3[_0x6cb0('0x45')],{})[_0x6cb0('0x1f')](respondWithResult(_0x5d61e3,0xc9))[_0x6cb0('0x3f')](handleError(_0x5d61e3,null));};exports[_0x6cb0('0x46')]=function(_0x495011,_0x8012e2){if(_0x495011[_0x6cb0('0x45')]['id']){delete _0x495011[_0x6cb0('0x45')]['id'];}return db['UserProfileSection'][_0x6cb0('0x43')]({'where':{'id':_0x495011[_0x6cb0('0x41')]['id']}})[_0x6cb0('0x1f')](handleEntityNotFound(_0x8012e2,null))['then'](saveUpdates(_0x495011[_0x6cb0('0x45')],null))[_0x6cb0('0x1f')](respondWithResult(_0x8012e2,null))[_0x6cb0('0x3f')](handleError(_0x8012e2,null));};exports[_0x6cb0('0x20')]=function(_0x8f2228,_0x4c1bcf){return db[_0x6cb0('0x27')][_0x6cb0('0x43')]({'where':{'id':_0x8f2228[_0x6cb0('0x41')]['id']}})[_0x6cb0('0x1f')](handleEntityNotFound(_0x4c1bcf,null))[_0x6cb0('0x1f')](removeEntity(_0x4c1bcf,null))[_0x6cb0('0x3f')](handleError(_0x4c1bcf,null));};exports[_0x6cb0('0x47')]=function(_0x331b53,_0x4d4c0f){return db[_0x6cb0('0x27')][_0x6cb0('0x47')]()[_0x6cb0('0x1f')](respondWithResult(_0x4d4c0f,null))[_0x6cb0('0x3f')](handleError(_0x4d4c0f,null));}; \ No newline at end of file +var _0xa81a=['path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','end','offset','set','json','apply','reject','update','destroy','sendStatus','stack','name','send','index','UserProfileSection','fieldName','type','key','model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','merge','filter','options','count','includeAll','include','then','rows','params','find','catch','create','body','describe','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache'];(function(_0x3dd458,_0x65649){var _0x1dc3e7=function(_0x1df93b){while(--_0x1df93b){_0x3dd458['push'](_0x3dd458['shift']());}};_0x1dc3e7(++_0x65649);}(_0xa81a,0x1f1));var _0xaa81=function(_0x555fef,_0x538c8e){_0x555fef=_0x555fef-0x0;var _0x352754=_0xa81a[_0x555fef];return _0x352754;};'use strict';var pdf=require(_0xaa81('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xaa81('0x1'));var zipdir=require(_0xaa81('0x2'));var jsonpatch=require(_0xaa81('0x3'));var rp=require('request-promise');var moment=require(_0xaa81('0x4'));var BPromise=require(_0xaa81('0x5'));var Mustache=require(_0xaa81('0x6'));var util=require('util');var path=require(_0xaa81('0x7'));var sox=require(_0xaa81('0x8'));var csv=require('to-csv');var ejs=require(_0xaa81('0x9'));var fs=require('fs');var _=require(_0xaa81('0xa'));var squel=require(_0xaa81('0xb'));var crypto=require(_0xaa81('0xc'));var jsforce=require(_0xaa81('0xd'));var deskjs=require(_0xaa81('0xe'));var toCsv=require(_0xaa81('0xf'));var querystring=require('querystring');var Papa=require(_0xaa81('0x10'));var Redis=require('ioredis');var authService=require(_0xaa81('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xaa81('0x12'));var hardwareService=require(_0xaa81('0x13'));var logger=require(_0xaa81('0x14'))(_0xaa81('0x15'));var utils=require('../../config/utils');var config=require(_0xaa81('0x16'));var db=require(_0xaa81('0x17'))['db'];function respondWithStatusCode(_0x23fb80,_0xf31650){_0xf31650=_0xf31650||0xcc;return function(_0x277242){if(_0x277242){return _0x23fb80['sendStatus'](_0xf31650);}return _0x23fb80[_0xaa81('0x18')](_0xf31650)[_0xaa81('0x19')]();};}function respondWithResult(_0x2f70f3,_0x4f1efa){_0x4f1efa=_0x4f1efa||0xc8;return function(_0x3d4a2e){if(_0x3d4a2e){return _0x2f70f3[_0xaa81('0x18')](_0x4f1efa)['json'](_0x3d4a2e);}};}function respondWithFilteredResult(_0x3da654,_0x619a86){return function(_0x9d35c){if(_0x9d35c){var _0x4a08c2=_0x9d35c['count'],_0x548847=_0x619a86['offset'],_0x1ec6dd=_0x619a86[_0xaa81('0x1a')]+_0x619a86['limit'],_0x3a1429;if(_0x1ec6dd>=_0x4a08c2){_0x1ec6dd=_0x4a08c2;_0x3a1429=0xc8;}else{_0x3a1429=0xce;}_0x3da654[_0xaa81('0x18')](_0x3a1429);return _0x3da654[_0xaa81('0x1b')]('Content-Range',_0x548847+'-'+_0x1ec6dd+'/'+_0x4a08c2)[_0xaa81('0x1c')](_0x9d35c);}return null;};}function patchUpdates(_0x554c7e){return function(_0x29d7f4){try{jsonpatch[_0xaa81('0x1d')](_0x29d7f4,_0x554c7e,!![]);}catch(_0x13b29b){return BPromise[_0xaa81('0x1e')](_0x13b29b);}return _0x29d7f4['save']();};}function saveUpdates(_0x203953,_0x3dbb83){return function(_0x60291){if(_0x60291){return _0x60291[_0xaa81('0x1f')](_0x203953)['then'](function(_0x332bea){return _0x332bea;});}return null;};}function removeEntity(_0x329ef9,_0x4f31d1){return function(_0x15279d){if(_0x15279d){return _0x15279d[_0xaa81('0x20')]()['then'](function(){_0x329ef9[_0xaa81('0x18')](0xcc)[_0xaa81('0x19')]();});}};}function handleEntityNotFound(_0x441aea,_0x151f94){return function(_0x36340e){if(!_0x36340e){_0x441aea[_0xaa81('0x21')](0x194);}return _0x36340e;};}function handleError(_0xe7d4ce,_0x375b40){_0x375b40=_0x375b40||0x1f4;return function(_0x59a29b){logger['error'](_0x59a29b[_0xaa81('0x22')]);if(_0x59a29b['name']){delete _0x59a29b[_0xaa81('0x23')];}_0xe7d4ce['status'](_0x375b40)[_0xaa81('0x24')](_0x59a29b);};}exports[_0xaa81('0x25')]=function(_0xfb9386,_0x47e1f9){var _0x33be35={},_0x2cb6d8={},_0x5987d4={'count':0x0,'rows':[]};var _0x5a37b0=_['map'](db[_0xaa81('0x26')]['rawAttributes'],function(_0x1e5056){return{'name':_0x1e5056[_0xaa81('0x27')],'type':_0x1e5056[_0xaa81('0x28')][_0xaa81('0x29')]};});_0x2cb6d8[_0xaa81('0x2a')]=_[_0xaa81('0x2b')](_0x5a37b0,_0xaa81('0x23'));_0x2cb6d8[_0xaa81('0x2c')]=_[_0xaa81('0x2d')](_0xfb9386[_0xaa81('0x2c')]);_0x2cb6d8['filters']=_['intersection'](_0x2cb6d8[_0xaa81('0x2a')],_0x2cb6d8[_0xaa81('0x2c')]);_0x33be35['attributes']=_[_0xaa81('0x2e')](_0x2cb6d8['model'],qs['fields'](_0xfb9386[_0xaa81('0x2c')][_0xaa81('0x2f')]));_0x33be35[_0xaa81('0x30')]=_0x33be35[_0xaa81('0x30')][_0xaa81('0x31')]?_0x33be35[_0xaa81('0x30')]:_0x2cb6d8[_0xaa81('0x2a')];if(!_0xfb9386[_0xaa81('0x2c')][_0xaa81('0x32')](_0xaa81('0x33'))){_0x33be35[_0xaa81('0x34')]=qs['limit'](_0xfb9386['query']['limit']);_0x33be35[_0xaa81('0x1a')]=qs[_0xaa81('0x1a')](_0xfb9386[_0xaa81('0x2c')][_0xaa81('0x1a')]);}_0x33be35[_0xaa81('0x35')]=qs[_0xaa81('0x36')](_0xfb9386[_0xaa81('0x2c')][_0xaa81('0x36')]);_0x33be35[_0xaa81('0x37')]=qs[_0xaa81('0x38')](_[_0xaa81('0x39')](_0xfb9386['query'],_0x2cb6d8['filters']),_0x5a37b0);if(_0xfb9386['query']['filter']){_0x33be35[_0xaa81('0x37')]=_[_0xaa81('0x3a')](_0x33be35[_0xaa81('0x37')],{'$or':_['map'](_0x5a37b0,function(_0x2dfee1){if(_0x2dfee1[_0xaa81('0x28')]!=='VIRTUAL'){var _0x2b2ac0={};_0x2b2ac0[_0x2dfee1['name']]={'$like':'%'+_0xfb9386[_0xaa81('0x2c')][_0xaa81('0x3b')]+'%'};return _0x2b2ac0;}})});}_0x33be35=_[_0xaa81('0x3a')]({},_0x33be35,_0xfb9386[_0xaa81('0x3c')]);var _0x48a876={'where':_0x33be35[_0xaa81('0x37')]};return db[_0xaa81('0x26')]['count'](_0x48a876)['then'](function(_0x3470fa){_0x5987d4[_0xaa81('0x3d')]=_0x3470fa;if(_0xfb9386[_0xaa81('0x2c')][_0xaa81('0x3e')]){_0x33be35[_0xaa81('0x3f')]=[{'all':!![]}];}return db[_0xaa81('0x26')]['findAll'](_0x33be35);})[_0xaa81('0x40')](function(_0x417a41){_0x5987d4[_0xaa81('0x41')]=_0x417a41;return _0x5987d4;})[_0xaa81('0x40')](respondWithFilteredResult(_0x47e1f9,_0x33be35))['catch'](handleError(_0x47e1f9,null));};exports['show']=function(_0x5f4d27,_0x4b5e86){var _0x347ec6={'raw':![],'where':{'id':_0x5f4d27[_0xaa81('0x42')]['id']}},_0x4fa9a8={};_0x4fa9a8['model']=_[_0xaa81('0x2d')](db[_0xaa81('0x26')]['rawAttributes']);_0x4fa9a8['query']=_[_0xaa81('0x2d')](_0x5f4d27[_0xaa81('0x2c')]);_0x4fa9a8[_0xaa81('0x38')]=_[_0xaa81('0x2e')](_0x4fa9a8[_0xaa81('0x2a')],_0x4fa9a8[_0xaa81('0x2c')]);_0x347ec6[_0xaa81('0x30')]=_['intersection'](_0x4fa9a8[_0xaa81('0x2a')],qs[_0xaa81('0x2f')](_0x5f4d27[_0xaa81('0x2c')][_0xaa81('0x2f')]));_0x347ec6[_0xaa81('0x30')]=_0x347ec6[_0xaa81('0x30')][_0xaa81('0x31')]?_0x347ec6[_0xaa81('0x30')]:_0x4fa9a8[_0xaa81('0x2a')];if(_0x5f4d27[_0xaa81('0x2c')][_0xaa81('0x3e')]){_0x347ec6['include']=[{'all':!![]}];}_0x347ec6=_[_0xaa81('0x3a')]({},_0x347ec6,_0x5f4d27[_0xaa81('0x3c')]);return db[_0xaa81('0x26')][_0xaa81('0x43')](_0x347ec6)['then'](handleEntityNotFound(_0x4b5e86,null))[_0xaa81('0x40')](respondWithResult(_0x4b5e86,null))[_0xaa81('0x44')](handleError(_0x4b5e86,null));};exports[_0xaa81('0x45')]=function(_0xe8ff6c,_0x580c7a){return db[_0xaa81('0x26')][_0xaa81('0x45')](_0xe8ff6c[_0xaa81('0x46')],{})['then'](respondWithResult(_0x580c7a,0xc9))[_0xaa81('0x44')](handleError(_0x580c7a,null));};exports[_0xaa81('0x1f')]=function(_0x4b4cb8,_0x3a8247){if(_0x4b4cb8[_0xaa81('0x46')]['id']){delete _0x4b4cb8[_0xaa81('0x46')]['id'];}return db[_0xaa81('0x26')][_0xaa81('0x43')]({'where':{'id':_0x4b4cb8[_0xaa81('0x42')]['id']}})['then'](handleEntityNotFound(_0x3a8247,null))[_0xaa81('0x40')](saveUpdates(_0x4b4cb8[_0xaa81('0x46')],null))['then'](respondWithResult(_0x3a8247,null))[_0xaa81('0x44')](handleError(_0x3a8247,null));};exports['destroy']=function(_0x54f92e,_0x472277){return db['UserProfileSection'][_0xaa81('0x43')]({'where':{'id':_0x54f92e[_0xaa81('0x42')]['id']}})['then'](handleEntityNotFound(_0x472277,null))[_0xaa81('0x40')](removeEntity(_0x472277,null))[_0xaa81('0x44')](handleError(_0x472277,null));};exports[_0xaa81('0x47')]=function(_0x296a9c,_0xbd6498){return db[_0xaa81('0x26')]['describe']()[_0xaa81('0x40')](respondWithResult(_0xbd6498,null))[_0xaa81('0x44')](handleError(_0xbd6498,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index dffa07c..a3630e6 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 _0x4ee4=['compositeIndex','sectionId','userProfileId','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./userProfileSection.attributes','exports','define','UserProfileSection','user_profile_has_sections'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4ee4,0x179));var _0x44ee=function(_0x903228,_0x42c429){_0x903228=_0x903228-0x0;var _0xcec81d=_0x4ee4[_0x903228];return _0xcec81d;};'use strict';var _=require(_0x44ee('0x0'));var util=require(_0x44ee('0x1'));var logger=require(_0x44ee('0x2'))(_0x44ee('0x3'));var moment=require('moment');var BPromise=require(_0x44ee('0x4'));var rp=require(_0x44ee('0x5'));var fs=require('fs');var path=require(_0x44ee('0x6'));var rimraf=require(_0x44ee('0x7'));var config=require(_0x44ee('0x8'));var attributes=require(_0x44ee('0x9'));module[_0x44ee('0xa')]=function(_0x355e5a,_0x3de2fa){return _0x355e5a[_0x44ee('0xb')](_0x44ee('0xc'),attributes,{'tableName':_0x44ee('0xd'),'paranoid':![],'indexes':[{'name':_0x44ee('0xe'),'fields':[_0x44ee('0xf'),_0x44ee('0x10')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa069=['userProfileId','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./userProfileSection.attributes','exports','define','UserProfileSection','compositeIndex','sectionId'];(function(_0x11eaec,_0x3de84a){var _0x496ff9=function(_0x189edb){while(--_0x189edb){_0x11eaec['push'](_0x11eaec['shift']());}};_0x496ff9(++_0x3de84a);}(_0xa069,0xa6));var _0x9a06=function(_0x6740d9,_0x4634b5){_0x6740d9=_0x6740d9-0x0;var _0x1943ac=_0xa069[_0x6740d9];return _0x1943ac;};'use strict';var _=require('lodash');var util=require(_0x9a06('0x0'));var logger=require(_0x9a06('0x1'))(_0x9a06('0x2'));var moment=require(_0x9a06('0x3'));var BPromise=require(_0x9a06('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9a06('0x5'));var rimraf=require(_0x9a06('0x6'));var config=require(_0x9a06('0x7'));var attributes=require(_0x9a06('0x8'));module[_0x9a06('0x9')]=function(_0x4a2405,_0x4560d6){return _0x4a2405[_0x9a06('0xa')](_0x9a06('0xb'),attributes,{'tableName':'user_profile_has_sections','paranoid':![],'indexes':[{'name':_0x9a06('0xc'),'fields':[_0x9a06('0xd'),_0x9a06('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index 63b8425..5028255 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 _0xe884=['UserProfileSection,\x20%s,\x20%s','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','error','code','message','result'];(function(_0x42c118,_0x197006){var _0x112ebd=function(_0x337411){while(--_0x337411){_0x42c118['push'](_0x42c118['shift']());}};_0x112ebd(++_0x197006);}(_0xe884,0xb1));var _0x4e88=function(_0x38daf2,_0x391fa1){_0x38daf2=_0x38daf2-0x0;var _0x7f0cc3=_0xe884[_0x38daf2];return _0x7f0cc3;};'use strict';var _=require(_0x4e88('0x0'));var util=require(_0x4e88('0x1'));var moment=require(_0x4e88('0x2'));var BPromise=require(_0x4e88('0x3'));var rs=require(_0x4e88('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4e88('0x5'))['db'];var utils=require(_0x4e88('0x6'));var logger=require('../../config/logger')(_0x4e88('0x7'));var config=require(_0x4e88('0x8'));var jayson=require(_0x4e88('0x9'));var client=jayson[_0x4e88('0xa')][_0x4e88('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x7f9332,_0x36e45a,_0x268ee2){return new BPromise(function(_0xa5f563,_0x1962cd){return client[_0x4e88('0xc')](_0x7f9332,_0x268ee2)[_0x4e88('0xd')](function(_0x414b08){logger[_0x4e88('0xe')]('UserProfileSection,\x20%s,\x20%s',_0x36e45a,_0x4e88('0xf'));logger[_0x4e88('0x10')]('UserProfileSection,\x20%s,\x20%s,\x20%s',_0x36e45a,_0x4e88('0xf'),JSON['stringify'](_0x414b08));if(_0x414b08[_0x4e88('0x11')]){if(_0x414b08[_0x4e88('0x11')][_0x4e88('0x12')]===0x1f4){logger[_0x4e88('0x11')]('UserProfileSection,\x20%s,\x20%s',_0x36e45a,_0x414b08['error'][_0x4e88('0x13')]);return _0x1962cd(_0x414b08[_0x4e88('0x11')][_0x4e88('0x13')]);}logger[_0x4e88('0x11')]('UserProfileSection,\x20%s,\x20%s',_0x36e45a,_0x414b08['error']['message']);return _0xa5f563(_0x414b08[_0x4e88('0x11')]['message']);}else{logger[_0x4e88('0xe')]('UserProfileSection,\x20%s,\x20%s',_0x36e45a,_0x4e88('0xf'));_0xa5f563(_0x414b08[_0x4e88('0x14')][_0x4e88('0x13')]);}})['catch'](function(_0x5bea13){logger['error'](_0x4e88('0x15'),_0x36e45a,_0x5bea13);_0x1962cd(_0x5bea13);});});} \ No newline at end of file +var _0x5992=['stringify','error','code','message','UserProfileSection,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','request\x20sent','debug'];(function(_0x2b1b7e,_0x5cbe6d){var _0x57cb09=function(_0x1de78a){while(--_0x1de78a){_0x2b1b7e['push'](_0x2b1b7e['shift']());}};_0x57cb09(++_0x5cbe6d);}(_0x5992,0x177));var _0x2599=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0x5992[_0x55f8b4];return _0x2475f9;};'use strict';var _=require(_0x2599('0x0'));var util=require(_0x2599('0x1'));var moment=require('moment');var BPromise=require(_0x2599('0x2'));var rs=require(_0x2599('0x3'));var fs=require('fs');var Redis=require(_0x2599('0x4'));var db=require(_0x2599('0x5'))['db'];var utils=require(_0x2599('0x6'));var logger=require(_0x2599('0x7'))('rpc');var config=require(_0x2599('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x2599('0x9')][_0x2599('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1b5258,_0x4a2e0d,_0x1d25ef){return new BPromise(function(_0x3700ee,_0x6d2e9){return client[_0x2599('0xb')](_0x1b5258,_0x1d25ef)[_0x2599('0xc')](function(_0x2fa2c1){logger[_0x2599('0xd')]('UserProfileSection,\x20%s,\x20%s',_0x4a2e0d,_0x2599('0xe'));logger[_0x2599('0xf')]('UserProfileSection,\x20%s,\x20%s,\x20%s',_0x4a2e0d,'request\x20sent',JSON[_0x2599('0x10')](_0x2fa2c1));if(_0x2fa2c1[_0x2599('0x11')]){if(_0x2fa2c1[_0x2599('0x11')][_0x2599('0x12')]===0x1f4){logger[_0x2599('0x11')]('UserProfileSection,\x20%s,\x20%s',_0x4a2e0d,_0x2fa2c1['error'][_0x2599('0x13')]);return _0x6d2e9(_0x2fa2c1[_0x2599('0x11')][_0x2599('0x13')]);}logger[_0x2599('0x11')](_0x2599('0x14'),_0x4a2e0d,_0x2fa2c1[_0x2599('0x11')][_0x2599('0x13')]);return _0x3700ee(_0x2fa2c1['error'][_0x2599('0x13')]);}else{logger[_0x2599('0xd')]('UserProfileSection,\x20%s,\x20%s',_0x4a2e0d,'request\x20sent');_0x3700ee(_0x2fa2c1[_0x2599('0x15')][_0x2599('0x13')]);}})[_0x2599('0x16')](function(_0x2e41b2){logger[_0x2599('0x11')](_0x2599('0x14'),_0x4a2e0d,_0x2e41b2);_0x6d2e9(_0x2e41b2);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 2f9ec16..a7fc445 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 _0x9a1a=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','path','connect-timeout'];(function(_0x7e61c5,_0x3514aa){var _0x3106ea=function(_0x3d58ef){while(--_0x3d58ef){_0x7e61c5['push'](_0x7e61c5['shift']());}};_0x3106ea(++_0x3514aa);}(_0x9a1a,0x12f));var _0xa9a1=function(_0x37b713,_0x248677){_0x37b713=_0x37b713-0x0;var _0xae950c=_0x9a1a[_0x37b713];return _0xae950c;};'use strict';var multer=require(_0xa9a1('0x0'));var util=require('util');var path=require(_0xa9a1('0x1'));var timeout=require(_0xa9a1('0x2'));var express=require(_0xa9a1('0x3'));var router=express[_0xa9a1('0x4')]();var auth=require(_0xa9a1('0x5'));var interaction=require(_0xa9a1('0x6'));var config=require(_0xa9a1('0x7'));module[_0xa9a1('0x8')]=router; \ No newline at end of file +var _0xe680=['../../components/auth/service','../../components/interaction/service','../../config/environment','exports','util','path','connect-timeout'];(function(_0x50a651,_0x276aaf){var _0x429c51=function(_0x41e3e9){while(--_0x41e3e9){_0x50a651['push'](_0x50a651['shift']());}};_0x429c51(++_0x276aaf);}(_0xe680,0xcf));var _0x0e68=function(_0x42a721,_0x2098e5){_0x42a721=_0x42a721-0x0;var _0x300148=_0xe680[_0x42a721];return _0x300148;};'use strict';var multer=require('multer');var util=require(_0x0e68('0x0'));var path=require(_0x0e68('0x1'));var timeout=require(_0x0e68('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x0e68('0x3'));var interaction=require(_0x0e68('0x4'));var config=require(_0x0e68('0x5'));module[_0x0e68('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 8d67bfd..0fd3111 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(_0x4d2938,_0x332d65){var _0x5e7d9b=function(_0x135e24){while(--_0x135e24){_0x4d2938['push'](_0x4d2938['shift']());}};_0x5e7d9b(++_0x332d65);}(_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 _0xbaf0=['exports','INTEGER'];(function(_0x337651,_0x2af690){var _0x20893c=function(_0x545dcd){while(--_0x545dcd){_0x337651['push'](_0x337651['shift']());}};_0x20893c(++_0x2af690);}(_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 diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index c6580b7..86b6f95 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 _0xce64=['user_has_sms_queues','lodash','util','../../config/logger','moment','rimraf','../../config/environment','./userSmsQueue.attributes','exports','UserSmsQueue'];(function(_0x567c09,_0x7f9a1d){var _0x4723f8=function(_0x562192){while(--_0x562192){_0x567c09['push'](_0x567c09['shift']());}};_0x4723f8(++_0x7f9a1d);}(_0xce64,0x105));var _0x4ce6=function(_0x3bb04c,_0x4af802){_0x3bb04c=_0x3bb04c-0x0;var _0x479c32=_0xce64[_0x3bb04c];return _0x479c32;};'use strict';var _=require(_0x4ce6('0x0'));var util=require(_0x4ce6('0x1'));var logger=require(_0x4ce6('0x2'))('api');var moment=require(_0x4ce6('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4ce6('0x4'));var config=require(_0x4ce6('0x5'));var attributes=require(_0x4ce6('0x6'));module[_0x4ce6('0x7')]=function(_0x4a6b3f,_0x4e8b30){return _0x4a6b3f['define'](_0x4ce6('0x8'),attributes,{'tableName':_0x4ce6('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x64e4=['api','moment','request-promise','path','./userSmsQueue.attributes','define','UserSmsQueue','lodash','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x64e4,0xcd));var _0x464e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x64e4[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x464e('0x0'));var util=require('util');var logger=require(_0x464e('0x1'))(_0x464e('0x2'));var moment=require(_0x464e('0x3'));var BPromise=require('bluebird');var rp=require(_0x464e('0x4'));var fs=require('fs');var path=require(_0x464e('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x464e('0x6'));module['exports']=function(_0x5f5cbb,_0x5ed9e4){return _0x5f5cbb[_0x464e('0x7')](_0x464e('0x8'),attributes,{'tableName':'user_has_sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.rpc.js b/server/api/userSmsQueue/userSmsQueue.rpc.js index 3269a09..b8187e8 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 _0x146d=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','UserSmsQueue,\x20%s,\x20%s','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment'];(function(_0x1be6eb,_0x16e497){var _0x3788a4=function(_0x30f2cc){while(--_0x30f2cc){_0x1be6eb['push'](_0x1be6eb['shift']());}};_0x3788a4(++_0x16e497);}(_0x146d,0x9e));var _0xd146=function(_0x4db387,_0x5896d7){_0x4db387=_0x4db387-0x0;var _0x3672bb=_0x146d[_0x4db387];return _0x3672bb;};'use strict';var _=require(_0xd146('0x0'));var util=require(_0xd146('0x1'));var moment=require(_0xd146('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd146('0x3'));var db=require(_0xd146('0x4'))['db'];var utils=require(_0xd146('0x5'));var logger=require(_0xd146('0x6'))(_0xd146('0x7'));var config=require('../../config/environment');var jayson=require(_0xd146('0x8'));var client=jayson['client'][_0xd146('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x320062,_0x314d01,_0x5cbb70){return new BPromise(function(_0x507472,_0x272867){return client[_0xd146('0xa')](_0x320062,_0x5cbb70)[_0xd146('0xb')](function(_0x588d5c){logger[_0xd146('0xc')](_0xd146('0xd'),_0x314d01,'request\x20sent');logger[_0xd146('0xe')](_0xd146('0xf'),_0x314d01,_0xd146('0x10'),JSON[_0xd146('0x11')](_0x588d5c));if(_0x588d5c[_0xd146('0x12')]){if(_0x588d5c[_0xd146('0x12')][_0xd146('0x13')]===0x1f4){logger[_0xd146('0x12')](_0xd146('0xd'),_0x314d01,_0x588d5c[_0xd146('0x12')]['message']);return _0x272867(_0x588d5c[_0xd146('0x12')]['message']);}logger[_0xd146('0x12')]('UserSmsQueue,\x20%s,\x20%s',_0x314d01,_0x588d5c[_0xd146('0x12')][_0xd146('0x14')]);return _0x507472(_0x588d5c[_0xd146('0x12')][_0xd146('0x14')]);}else{logger[_0xd146('0xc')](_0xd146('0xd'),_0x314d01,_0xd146('0x10'));_0x507472(_0x588d5c[_0xd146('0x15')][_0xd146('0x14')]);}})[_0xd146('0x16')](function(_0x57cfe8){logger[_0xd146('0x12')](_0xd146('0xd'),_0x314d01,_0x57cfe8);_0x272867(_0x57cfe8);});});} \ No newline at end of file +var _0xe7ce=['client','http','request','then','info','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','UserSmsQueue,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise'];(function(_0x19bd24,_0x132b52){var _0xa61f18=function(_0x570b13){while(--_0x570b13){_0x19bd24['push'](_0x19bd24['shift']());}};_0xa61f18(++_0x132b52);}(_0xe7ce,0x1c2));var _0xee7c=function(_0x38df0b,_0x5413ca){_0x38df0b=_0x38df0b-0x0;var _0x75b96c=_0xe7ce[_0x38df0b];return _0x75b96c;};'use strict';var _=require(_0xee7c('0x0'));var util=require(_0xee7c('0x1'));var moment=require(_0xee7c('0x2'));var BPromise=require(_0xee7c('0x3'));var rs=require(_0xee7c('0x4'));var fs=require('fs');var Redis=require(_0xee7c('0x5'));var db=require(_0xee7c('0x6'))['db'];var utils=require(_0xee7c('0x7'));var logger=require('../../config/logger')(_0xee7c('0x8'));var config=require('../../config/environment');var jayson=require(_0xee7c('0x9'));var client=jayson[_0xee7c('0xa')][_0xee7c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x107a8d,_0x4d7f78,_0x4b9ef4){return new BPromise(function(_0x4b3c05,_0x45ab77){return client[_0xee7c('0xc')](_0x107a8d,_0x4b9ef4)[_0xee7c('0xd')](function(_0x20b445){logger[_0xee7c('0xe')]('UserSmsQueue,\x20%s,\x20%s',_0x4d7f78,_0xee7c('0xf'));logger[_0xee7c('0x10')](_0xee7c('0x11'),_0x4d7f78,_0xee7c('0xf'),JSON[_0xee7c('0x12')](_0x20b445));if(_0x20b445[_0xee7c('0x13')]){if(_0x20b445['error']['code']===0x1f4){logger[_0xee7c('0x13')](_0xee7c('0x14'),_0x4d7f78,_0x20b445['error']['message']);return _0x45ab77(_0x20b445[_0xee7c('0x13')]['message']);}logger[_0xee7c('0x13')](_0xee7c('0x14'),_0x4d7f78,_0x20b445[_0xee7c('0x13')]['message']);return _0x4b3c05(_0x20b445[_0xee7c('0x13')][_0xee7c('0x15')]);}else{logger[_0xee7c('0xe')]('UserSmsQueue,\x20%s,\x20%s',_0x4d7f78,_0xee7c('0xf'));_0x4b3c05(_0x20b445[_0xee7c('0x16')][_0xee7c('0x15')]);}})['catch'](function(_0x347fbe){logger[_0xee7c('0x13')](_0xee7c('0x14'),_0x4d7f78,_0x347fbe);_0x45ab77(_0x347fbe);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueue/index.js b/server/api/userVoiceQueue/index.js index 4198ec9..f9780e7 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 _0x8a01=['path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x11946c,_0x12152c){var _0x383935=function(_0x61fce2){while(--_0x61fce2){_0x11946c['push'](_0x11946c['shift']());}};_0x383935(++_0x12152c);}(_0x8a01,0x96));var _0x18a0=function(_0x57f7a2,_0xfbbc4){_0x57f7a2=_0x57f7a2-0x0;var _0x5147c1=_0x8a01[_0x57f7a2];return _0x5147c1;};'use strict';var multer=require(_0x18a0('0x0'));var util=require(_0x18a0('0x1'));var path=require(_0x18a0('0x2'));var timeout=require('connect-timeout');var express=require(_0x18a0('0x3'));var router=express[_0x18a0('0x4')]();var auth=require(_0x18a0('0x5'));var interaction=require(_0x18a0('0x6'));var config=require(_0x18a0('0x7'));module['exports']=router; \ No newline at end of file +var _0x5c20=['express','Router','../../components/interaction/service','exports','multer','path','connect-timeout'];(function(_0x21de11,_0x300f6a){var _0x141016=function(_0x41297e){while(--_0x41297e){_0x21de11['push'](_0x21de11['shift']());}};_0x141016(++_0x300f6a);}(_0x5c20,0x10e));var _0x05c2=function(_0x51aebe,_0x2c154a){_0x51aebe=_0x51aebe-0x0;var _0x31b43d=_0x5c20[_0x51aebe];return _0x31b43d;};'use strict';var multer=require(_0x05c2('0x0'));var util=require('util');var path=require(_0x05c2('0x1'));var timeout=require(_0x05c2('0x2'));var express=require(_0x05c2('0x3'));var router=express[_0x05c2('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x05c2('0x5'));var config=require('../../config/environment');module[_0x05c2('0x6')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 18294b5..8919dc0 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 _0xe706=['INTEGER','sequelize','exports'];(function(_0x432a72,_0x49d546){var _0x49f594=function(_0x250dcd){while(--_0x250dcd){_0x432a72['push'](_0x432a72['shift']());}};_0x49f594(++_0x49d546);}(_0xe706,0xa3));var _0x6e70=function(_0x2c1923,_0x5446e9){_0x2c1923=_0x2c1923-0x0;var _0x73c9b4=_0xe706[_0x2c1923];return _0x73c9b4;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'penalty':{'type':Sequelize[_0x6e70('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb10b=['sequelize','INTEGER'];(function(_0x1624f2,_0x3c5353){var _0x21c964=function(_0x130e20){while(--_0x130e20){_0x1624f2['push'](_0x1624f2['shift']());}};_0x21c964(++_0x3c5353);}(_0xb10b,0x12a));var _0xbb10=function(_0xfcf737,_0x132075){_0xfcf737=_0xfcf737-0x0;var _0x5eccbe=_0xb10b[_0xfcf737];return _0x5eccbe;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xbb10('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index 453b8a7..8bcfc92 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 _0xa41a=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./userVoiceQueue.attributes','user_has_voice_queues','lodash','util','api'];(function(_0x3afdd4,_0x205683){var _0xabcc01=function(_0x25207c){while(--_0x25207c){_0x3afdd4['push'](_0x3afdd4['shift']());}};_0xabcc01(++_0x205683);}(_0xa41a,0x6b));var _0xaa41=function(_0x3e3c14,_0x4c2390){_0x3e3c14=_0x3e3c14-0x0;var _0x455591=_0xa41a[_0x3e3c14];return _0x455591;};'use strict';var _=require(_0xaa41('0x0'));var util=require(_0xaa41('0x1'));var logger=require('../../config/logger')(_0xaa41('0x2'));var moment=require(_0xaa41('0x3'));var BPromise=require(_0xaa41('0x4'));var rp=require(_0xaa41('0x5'));var fs=require('fs');var path=require(_0xaa41('0x6'));var rimraf=require(_0xaa41('0x7'));var config=require(_0xaa41('0x8'));var attributes=require(_0xaa41('0x9'));module['exports']=function(_0x2122a0,_0x1ec9d4){return _0x2122a0['define']('UserVoiceQueue',attributes,{'tableName':_0xaa41('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x99e9=['util','../../config/logger','api','moment','request-promise','path','rimraf','./userVoiceQueue.attributes','define','UserVoiceQueue'];(function(_0x427674,_0x53527d){var _0x31e8fc=function(_0x1ef1c1){while(--_0x1ef1c1){_0x427674['push'](_0x427674['shift']());}};_0x31e8fc(++_0x53527d);}(_0x99e9,0xb4));var _0x999e=function(_0x3d73ba,_0x356e23){_0x3d73ba=_0x3d73ba-0x0;var _0x47e406=_0x99e9[_0x3d73ba];return _0x47e406;};'use strict';var _=require('lodash');var util=require(_0x999e('0x0'));var logger=require(_0x999e('0x1'))(_0x999e('0x2'));var moment=require(_0x999e('0x3'));var BPromise=require('bluebird');var rp=require(_0x999e('0x4'));var fs=require('fs');var path=require(_0x999e('0x5'));var rimraf=require(_0x999e('0x6'));var config=require('../../config/environment');var attributes=require(_0x999e('0x7'));module['exports']=function(_0x25421f,_0x1bda0a){return _0x25421f[_0x999e('0x8')](_0x999e('0x9'),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 477a504..b232fda 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 _0x9900=['../../config/utils','../../config/environment','jayson/promise','client','request','info','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','UserVoiceQueue,\x20%s,\x20%s','result','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x3450e4,_0x13258c){var _0xde7eec=function(_0x73d98b){while(--_0x73d98b){_0x3450e4['push'](_0x3450e4['shift']());}};_0xde7eec(++_0x13258c);}(_0x9900,0xa6));var _0x0990=function(_0x1aaffe,_0x42a4a6){_0x1aaffe=_0x1aaffe-0x0;var _0xf0c796=_0x9900[_0x1aaffe];return _0xf0c796;};'use strict';var _=require('lodash');var util=require(_0x0990('0x0'));var moment=require(_0x0990('0x1'));var BPromise=require(_0x0990('0x2'));var rs=require(_0x0990('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0990('0x4'))['db'];var utils=require(_0x0990('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x0990('0x6'));var jayson=require(_0x0990('0x7'));var client=jayson[_0x0990('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x25dad7,_0x1bfa4d,_0x17bee9){return new BPromise(function(_0x446e50,_0x4537c5){return client[_0x0990('0x9')](_0x25dad7,_0x17bee9)['then'](function(_0x5b3b1b){logger[_0x0990('0xa')]('UserVoiceQueue,\x20%s,\x20%s',_0x1bfa4d,_0x0990('0xb'));logger[_0x0990('0xc')](_0x0990('0xd'),_0x1bfa4d,'request\x20sent',JSON[_0x0990('0xe')](_0x5b3b1b));if(_0x5b3b1b['error']){if(_0x5b3b1b[_0x0990('0xf')]['code']===0x1f4){logger[_0x0990('0xf')]('UserVoiceQueue,\x20%s,\x20%s',_0x1bfa4d,_0x5b3b1b['error']['message']);return _0x4537c5(_0x5b3b1b[_0x0990('0xf')][_0x0990('0x10')]);}logger[_0x0990('0xf')](_0x0990('0x11'),_0x1bfa4d,_0x5b3b1b[_0x0990('0xf')][_0x0990('0x10')]);return _0x446e50(_0x5b3b1b[_0x0990('0xf')][_0x0990('0x10')]);}else{logger[_0x0990('0xa')]('UserVoiceQueue,\x20%s,\x20%s',_0x1bfa4d,'request\x20sent');_0x446e50(_0x5b3b1b[_0x0990('0x12')][_0x0990('0x10')]);}})['catch'](function(_0x81175a){logger[_0x0990('0xf')](_0x0990('0x11'),_0x1bfa4d,_0x81175a);_0x4537c5(_0x81175a);});});} \ No newline at end of file +var _0x614e=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x1c5287,_0x2dd964){var _0x1a1312=function(_0x185a2e){while(--_0x185a2e){_0x1c5287['push'](_0x1c5287['shift']());}};_0x1a1312(++_0x2dd964);}(_0x614e,0x1c7));var _0xe614=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x614e[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0xe614('0x0'));var util=require(_0xe614('0x1'));var moment=require(_0xe614('0x2'));var BPromise=require(_0xe614('0x3'));var rs=require(_0xe614('0x4'));var fs=require('fs');var Redis=require(_0xe614('0x5'));var db=require(_0xe614('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xe614('0x7'))(_0xe614('0x8'));var config=require(_0xe614('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xe614('0xa')][_0xe614('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2c48f3,_0x8b5949,_0x33ac65){return new BPromise(function(_0x11b735,_0x1424ca){return client[_0xe614('0xc')](_0x2c48f3,_0x33ac65)[_0xe614('0xd')](function(_0xc96550){logger[_0xe614('0xe')](_0xe614('0xf'),_0x8b5949,_0xe614('0x10'));logger['debug'](_0xe614('0x11'),_0x8b5949,_0xe614('0x10'),JSON[_0xe614('0x12')](_0xc96550));if(_0xc96550[_0xe614('0x13')]){if(_0xc96550[_0xe614('0x13')][_0xe614('0x14')]===0x1f4){logger[_0xe614('0x13')](_0xe614('0xf'),_0x8b5949,_0xc96550['error']['message']);return _0x1424ca(_0xc96550[_0xe614('0x13')]['message']);}logger[_0xe614('0x13')]('UserVoiceQueue,\x20%s,\x20%s',_0x8b5949,_0xc96550[_0xe614('0x13')][_0xe614('0x15')]);return _0x11b735(_0xc96550[_0xe614('0x13')]['message']);}else{logger[_0xe614('0xe')]('UserVoiceQueue,\x20%s,\x20%s',_0x8b5949,_0xe614('0x10'));_0x11b735(_0xc96550[_0xe614('0x16')][_0xe614('0x15')]);}})[_0xe614('0x17')](function(_0x1a2bdb){logger[_0xe614('0x13')]('UserVoiceQueue,\x20%s,\x20%s',_0x8b5949,_0x1a2bdb);_0x1424ca(_0x1a2bdb);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 41ca0f8..46fdb38 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 _0x7e56=['connect-timeout','express','../../components/auth/service','../../components/interaction/service','exports','multer','util'];(function(_0x2f436b,_0x439bd6){var _0x30258c=function(_0x5ae91c){while(--_0x5ae91c){_0x2f436b['push'](_0x2f436b['shift']());}};_0x30258c(++_0x439bd6);}(_0x7e56,0x116));var _0x67e5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7e56[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x67e5('0x0'));var util=require(_0x67e5('0x1'));var path=require('path');var timeout=require(_0x67e5('0x2'));var express=require(_0x67e5('0x3'));var router=express['Router']();var auth=require(_0x67e5('0x4'));var interaction=require(_0x67e5('0x5'));var config=require('../../config/environment');module[_0x67e5('0x6')]=router; \ No newline at end of file +var _0xb059=['express','../../components/auth/service','exports','multer','util','path','connect-timeout'];(function(_0x23e29a,_0x33dd04){var _0x436b04=function(_0x243854){while(--_0x243854){_0x23e29a['push'](_0x23e29a['shift']());}};_0x436b04(++_0x33dd04);}(_0xb059,0xc7));var _0x9b05=function(_0x38ee46,_0xdc7b54){_0x38ee46=_0x38ee46-0x0;var _0x1c3527=_0xb059[_0x38ee46];return _0x1c3527;};'use strict';var multer=require(_0x9b05('0x0'));var util=require(_0x9b05('0x1'));var path=require(_0x9b05('0x2'));var timeout=require(_0x9b05('0x3'));var express=require(_0x9b05('0x4'));var router=express['Router']();var auth=require(_0x9b05('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x9b05('0x6')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 67f315e..91156e7 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 _0xa667=['INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface','exports'];(function(_0x31af98,_0x519ce1){var _0x157020=function(_0x3504fa){while(--_0x3504fa){_0x31af98['push'](_0x31af98['shift']());}};_0x157020(++_0x519ce1);}(_0xa667,0xe0));var _0x7a66=function(_0x1e577d,_0x3413d0){_0x1e577d=_0x1e577d-0x0;var _0x30adbe=_0xa667[_0x1e577d];return _0x30adbe;};'use strict';var Sequelize=require('sequelize');module[_0x7a66('0x0')]={'uniqueid':{'type':Sequelize[_0x7a66('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':'Required\x20by\x20Asterisk'},'membername':{'type':Sequelize['STRING'],'allowNull':![],'comment':_0x7a66('0x2')},'UserId':{'type':Sequelize[_0x7a66('0x1')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x7a66('0x3')],'allowNull':![],'unique':_0x7a66('0x4'),'comment':'Required\x20by\x20Asterisk'},'VoiceQueueId':{'type':Sequelize['INTEGER'],'allowNull':![]},'interface':{'type':Sequelize[_0x7a66('0x3')],'allowNull':![],'unique':_0x7a66('0x4'),'comment':_0x7a66('0x2')},'penalty':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0x7a66('0x2')},'paused':{'type':Sequelize[_0x7a66('0x1')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'}}; \ No newline at end of file +var _0x8a1b=['STRING','queue_interface','sequelize','INTEGER','Required\x20by\x20Asterisk'];(function(_0x188f0c,_0x59554f){var _0x4d9ffc=function(_0x9e1aee){while(--_0x9e1aee){_0x188f0c['push'](_0x188f0c['shift']());}};_0x4d9ffc(++_0x59554f);}(_0x8a1b,0x183));var _0xb8a1=function(_0x4de087,_0x380593){_0x4de087=_0x4de087-0x0;var _0x4da13f=_0x8a1b[_0x4de087];return _0x4da13f;};'use strict';var Sequelize=require(_0xb8a1('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xb8a1('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':_0xb8a1('0x2')},'membername':{'type':Sequelize[_0xb8a1('0x3')],'allowNull':![],'comment':_0xb8a1('0x2')},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize[_0xb8a1('0x3')],'allowNull':![],'unique':'queue_interface','comment':_0xb8a1('0x2')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'allowNull':![]},'interface':{'type':Sequelize[_0xb8a1('0x3')],'allowNull':![],'unique':_0xb8a1('0x4'),'comment':_0xb8a1('0x2')},'penalty':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'},'paused':{'type':Sequelize[_0xb8a1('0x1')](0xb),'defaultValue':0x0,'comment':_0xb8a1('0x2')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 8f1a46c..9e18a6a 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 _0x3bb5=['save','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','UserVoiceQueueRt','setMaxListeners'];(function(_0x1cc52a,_0xc352df){var _0x296a25=function(_0x17e4a2){while(--_0x17e4a2){_0x1cc52a['push'](_0x1cc52a['shift']());}};_0x296a25(++_0xc352df);}(_0x3bb5,0x1dc));var _0x53bb=function(_0x456fb1,_0x859a1d){_0x456fb1=_0x456fb1-0x0;var _0x4083d6=_0x3bb5[_0x456fb1];return _0x4083d6;};'use strict';var EventEmitter=require(_0x53bb('0x0'));var UserVoiceQueueRt=require(_0x53bb('0x1'))['db'][_0x53bb('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x53bb('0x3')](0x0);var events={'afterCreate':_0x53bb('0x4'),'afterUpdate':_0x53bb('0x5'),'afterDestroy':'remove'};function emitEvent(_0x60e957){return function(_0x4ed312,_0x30e48c,_0x1c0e90){UserVoiceQueueRtEvents[_0x53bb('0x6')](_0x60e957+':'+_0x4ed312['id'],_0x4ed312);UserVoiceQueueRtEvents[_0x53bb('0x6')](_0x60e957,_0x4ed312);_0x1c0e90(null);};}for(var e in events){if(events[_0x53bb('0x7')](e)){var event=events[e];UserVoiceQueueRt[_0x53bb('0x8')](e,emitEvent(event));}}module[_0x53bb('0x9')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x1aac=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','UserVoiceQueueRt','save','update','remove'];(function(_0x17bca6,_0x3383f1){var _0x58e899=function(_0x26b2d6){while(--_0x26b2d6){_0x17bca6['push'](_0x17bca6['shift']());}};_0x58e899(++_0x3383f1);}(_0x1aac,0xb8));var _0xc1aa=function(_0x58c209,_0x19bd82){_0x58c209=_0x58c209-0x0;var _0x32779d=_0x1aac[_0x58c209];return _0x32779d;};'use strict';var EventEmitter=require(_0xc1aa('0x0'));var UserVoiceQueueRt=require(_0xc1aa('0x1'))['db'][_0xc1aa('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xc1aa('0x3'),'afterUpdate':_0xc1aa('0x4'),'afterDestroy':_0xc1aa('0x5')};function emitEvent(_0x14fbe4){return function(_0x5a9989,_0x288514,_0x3da266){UserVoiceQueueRtEvents['emit'](_0x14fbe4+':'+_0x5a9989['id'],_0x5a9989);UserVoiceQueueRtEvents[_0xc1aa('0x6')](_0x14fbe4,_0x5a9989);_0x3da266(null);};}for(var e in events){if(events[_0xc1aa('0x7')](e)){var event=events[e];UserVoiceQueueRt[_0xc1aa('0x8')](e,emitEvent(event));}}module[_0xc1aa('0x9')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index ffe4a7e..8d54736 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 _0xbc21=['path','rimraf','../../config/environment','./userVoiceQueueRt.attributes','exports','define','UserVoiceQueueRt','../../config/logger','api','request-promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbc21,0x1b5));var _0x1bc2=function(_0x1c3609,_0x1e023d){_0x1c3609=_0x1c3609-0x0;var _0x2a26b8=_0xbc21[_0x1c3609];return _0x2a26b8;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1bc2('0x0'))(_0x1bc2('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1bc2('0x2'));var fs=require('fs');var path=require(_0x1bc2('0x3'));var rimraf=require(_0x1bc2('0x4'));var config=require(_0x1bc2('0x5'));var attributes=require(_0x1bc2('0x6'));module[_0x1bc2('0x7')]=function(_0x2738ec,_0x198754){return _0x2738ec[_0x1bc2('0x8')](_0x1bc2('0x9'),attributes,{'tableName':'user_has_voice_queues_rt','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0c49=['../../config/logger','api','moment','path','../../config/environment','./userVoiceQueueRt.attributes','define','UserVoiceQueueRt','util'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0x0c49,0x1a6));var _0x90c4=function(_0x2bfa5d,_0x388804){_0x2bfa5d=_0x2bfa5d-0x0;var _0x5ec9e5=_0x0c49[_0x2bfa5d];return _0x5ec9e5;};'use strict';var _=require('lodash');var util=require(_0x90c4('0x0'));var logger=require(_0x90c4('0x1'))(_0x90c4('0x2'));var moment=require(_0x90c4('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x90c4('0x4'));var rimraf=require('rimraf');var config=require(_0x90c4('0x5'));var attributes=require(_0x90c4('0x6'));module['exports']=function(_0x4a63fe,_0x164800){return _0x4a63fe[_0x90c4('0x7')](_0x90c4('0x8'),attributes,{'tableName':'user_has_voice_queues_rt','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js index b33448f..9f4288b 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 _0xdf2b=['debug','catch','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','register','request','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','GetVoiceQueueRtPauses','UserVoiceQueueRt','options','where','sequelize','`paused`\x20=\x201,\x201,\x20null','then'];(function(_0x6173fc,_0x32aadf){var _0x965fbe=function(_0x50d5b3){while(--_0x50d5b3){_0x6173fc['push'](_0x6173fc['shift']());}};_0x965fbe(++_0x32aadf);}(_0xdf2b,0x162));var _0xbdf2=function(_0x2813e5,_0x45a66b){_0x2813e5=_0x2813e5-0x0;var _0xb04455=_0xdf2b[_0x2813e5];return _0xb04455;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xbdf2('0x0'));var rs=require(_0xbdf2('0x1'));var fs=require('fs');var Redis=require(_0xbdf2('0x2'));var db=require(_0xbdf2('0x3'))['db'];var utils=require(_0xbdf2('0x4'));var logger=require('../../config/logger')(_0xbdf2('0x5'));var config=require(_0xbdf2('0x6'));var jayson=require(_0xbdf2('0x7'));var client=jayson[_0xbdf2('0x8')]['http']({'port':0x232a});config[_0xbdf2('0x9')]=_[_0xbdf2('0xa')](config[_0xbdf2('0x9')],{'host':_0xbdf2('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbdf2('0x9')]));require('./userVoiceQueueRt.socket')[_0xbdf2('0xc')](socket);function respondWithRpcPromise(_0xb6e75d,_0x38b6ec,_0x551a68){return new BPromise(function(_0x37cea3,_0x5ad942){return client[_0xbdf2('0xd')](_0xb6e75d,_0x551a68)['then'](function(_0x133e70){logger['info'](_0xbdf2('0xe'),_0x38b6ec,_0xbdf2('0xf'));logger['debug'](_0xbdf2('0x10'),_0x38b6ec,_0xbdf2('0xf'),JSON[_0xbdf2('0x11')](_0x133e70));if(_0x133e70[_0xbdf2('0x12')]){if(_0x133e70[_0xbdf2('0x12')][_0xbdf2('0x13')]===0x1f4){logger[_0xbdf2('0x12')](_0xbdf2('0xe'),_0x38b6ec,_0x133e70[_0xbdf2('0x12')]['message']);return _0x5ad942(_0x133e70[_0xbdf2('0x12')][_0xbdf2('0x14')]);}logger['error'](_0xbdf2('0xe'),_0x38b6ec,_0x133e70['error'][_0xbdf2('0x14')]);return _0x37cea3(_0x133e70['error'][_0xbdf2('0x14')]);}else{logger[_0xbdf2('0x15')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x38b6ec,_0xbdf2('0xf'));_0x37cea3(_0x133e70[_0xbdf2('0x16')][_0xbdf2('0x14')]);}})['catch'](function(_0x5c04b4){logger[_0xbdf2('0x12')](_0xbdf2('0xe'),_0x38b6ec,_0x5c04b4);_0x5ad942(_0x5c04b4);});});}exports[_0xbdf2('0x17')]=function(_0x48c940){var _0xa184ad=this;return new Promise(function(_0x4d4d7a,_0x11ef91){return db[_0xbdf2('0x18')]['findAll']({'raw':_0x48c940['options']?_0x48c940[_0xbdf2('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x48c940[_0xbdf2('0x19')]?_0x48c940[_0xbdf2('0x19')][_0xbdf2('0x1a')]||null:null,'attributes':[[db[_0xbdf2('0x1b')]['fn']('COUNT',db[_0xbdf2('0x1b')]['fn']('IF',db[_0xbdf2('0x1b')]['literal'](_0xbdf2('0x1c')))),'outboundQueuePauses']]})[_0xbdf2('0x1d')](function(_0xf9a3cb){logger['info'](_0xbdf2('0x17'),_0x48c940);logger[_0xbdf2('0x1e')]('GetVoiceQueueRtPauses',_0x48c940,JSON[_0xbdf2('0x11')](_0xf9a3cb));_0x4d4d7a(_0xf9a3cb);})[_0xbdf2('0x1f')](function(_0x546681){logger[_0xbdf2('0x12')]('GetVoiceQueueRtPauses',_0x546681[_0xbdf2('0x14')],_0x48c940);_0x11ef91(_0xa184ad[_0xbdf2('0x12')](0x1f4,_0x546681[_0xbdf2('0x14')]));});});}; \ No newline at end of file +var _0x2096=['../../mysqldb','../../config/utils','../../config/logger','redis','defaults','localhost','./userVoiceQueueRt.socket','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','options','where','sequelize','outboundQueuePauses','GetVoiceQueueRtPauses','util','bluebird','randomstring'];(function(_0x1f3ac3,_0x5345a7){var _0x18e5ad=function(_0xa0422d){while(--_0xa0422d){_0x1f3ac3['push'](_0x1f3ac3['shift']());}};_0x18e5ad(++_0x5345a7);}(_0x2096,0x169));var _0x6209=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0x2096[_0x51020b];return _0x371e47;};'use strict';var _=require('lodash');var util=require(_0x6209('0x0'));var moment=require('moment');var BPromise=require(_0x6209('0x1'));var rs=require(_0x6209('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6209('0x3'))['db'];var utils=require(_0x6209('0x4'));var logger=require(_0x6209('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x6209('0x6')]=_[_0x6209('0x7')](config[_0x6209('0x6')],{'host':_0x6209('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6209('0x6')]));require(_0x6209('0x9'))['register'](socket);function respondWithRpcPromise(_0x388841,_0x13eae7,_0x12fcf0){return new BPromise(function(_0xfc1cc7,_0x319c45){return client[_0x6209('0xa')](_0x388841,_0x12fcf0)[_0x6209('0xb')](function(_0x4762df){logger[_0x6209('0xc')](_0x6209('0xd'),_0x13eae7,_0x6209('0xe'));logger[_0x6209('0xf')](_0x6209('0x10'),_0x13eae7,_0x6209('0xe'),JSON[_0x6209('0x11')](_0x4762df));if(_0x4762df['error']){if(_0x4762df[_0x6209('0x12')][_0x6209('0x13')]===0x1f4){logger['error'](_0x6209('0xd'),_0x13eae7,_0x4762df['error']['message']);return _0x319c45(_0x4762df['error'][_0x6209('0x14')]);}logger[_0x6209('0x12')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x13eae7,_0x4762df['error'][_0x6209('0x14')]);return _0xfc1cc7(_0x4762df['error'][_0x6209('0x14')]);}else{logger[_0x6209('0xc')](_0x6209('0xd'),_0x13eae7,_0x6209('0xe'));_0xfc1cc7(_0x4762df[_0x6209('0x15')][_0x6209('0x14')]);}})[_0x6209('0x16')](function(_0x5c73c2){logger['error'](_0x6209('0xd'),_0x13eae7,_0x5c73c2);_0x319c45(_0x5c73c2);});});}exports['GetVoiceQueueRtPauses']=function(_0x5b890){var _0xd1931b=this;return new Promise(function(_0x393c65,_0x2470eb){return db['UserVoiceQueueRt']['findAll']({'raw':_0x5b890[_0x6209('0x17')]?_0x5b890[_0x6209('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x5b890[_0x6209('0x17')]?_0x5b890[_0x6209('0x17')][_0x6209('0x18')]||null:null,'attributes':[[db[_0x6209('0x19')]['fn']('COUNT',db[_0x6209('0x19')]['fn']('IF',db[_0x6209('0x19')]['literal']('`paused`\x20=\x201,\x201,\x20null'))),_0x6209('0x1a')]]})[_0x6209('0xb')](function(_0x5c2ee4){logger['info'](_0x6209('0x1b'),_0x5b890);logger[_0x6209('0xf')](_0x6209('0x1b'),_0x5b890,JSON[_0x6209('0x11')](_0x5c2ee4));_0x393c65(_0x5c2ee4);})['catch'](function(_0x260652){logger[_0x6209('0x12')](_0x6209('0x1b'),_0x260652[_0x6209('0x14')],_0x5b890);_0x2470eb(_0xd1931b[_0x6209('0x12')](0x1f4,_0x260652[_0x6209('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 7925f1d..6571c78 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 _0x78c0=['removeListener','register','./userVoiceQueueRt.events','save','remove','emit'];(function(_0x164e3a,_0x15e57c){var _0x2fff45=function(_0x5954d6){while(--_0x5954d6){_0x164e3a['push'](_0x164e3a['shift']());}};_0x2fff45(++_0x15e57c);}(_0x78c0,0x6e));var _0x078c=function(_0x3d140e,_0x19e6c6){_0x3d140e=_0x3d140e-0x0;var _0x25d39c=_0x78c0[_0x3d140e];return _0x25d39c;};'use strict';var UserVoiceQueueRtEvents=require(_0x078c('0x0'));var events=[_0x078c('0x1'),_0x078c('0x2'),'update'];function createListener(_0x556677,_0x3778f1){return function(_0x51bd7e){_0x3778f1[_0x078c('0x3')](_0x556677,_0x51bd7e);};}function removeListener(_0x1d29e2,_0x883978){return function(){UserVoiceQueueRtEvents[_0x078c('0x4')](_0x1d29e2,_0x883978);};}exports[_0x078c('0x5')]=function(_0x378936){for(var _0x9204b3=0x0,_0x4e04e8=events['length'];_0x9204b3<_0x4e04e8;_0x9204b3++){var _0x4e38d7=events[_0x9204b3];var _0x4a6849=createListener('userVoiceQueueRt:'+_0x4e38d7,_0x378936);UserVoiceQueueRtEvents['on'](_0x4e38d7,_0x4a6849);}}; \ No newline at end of file +var _0xd172=['save','remove','update','removeListener','register','userVoiceQueueRt:'];(function(_0x535397,_0x1a72e2){var _0x32878f=function(_0x4e9550){while(--_0x4e9550){_0x535397['push'](_0x535397['shift']());}};_0x32878f(++_0x1a72e2);}(_0xd172,0x180));var _0x2d17=function(_0x51bd9e,_0x34e752){_0x51bd9e=_0x51bd9e-0x0;var _0x7547c7=_0xd172[_0x51bd9e];return _0x7547c7;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=[_0x2d17('0x0'),_0x2d17('0x1'),_0x2d17('0x2')];function createListener(_0x3bbcd4,_0x1b41f0){return function(_0x877b4a){_0x1b41f0['emit'](_0x3bbcd4,_0x877b4a);};}function removeListener(_0x30383d,_0x260ae3){return function(){UserVoiceQueueRtEvents[_0x2d17('0x3')](_0x30383d,_0x260ae3);};}exports[_0x2d17('0x4')]=function(_0x2d1a09){for(var _0x57a33a=0x0,_0x521540=events['length'];_0x57a33a<_0x521540;_0x57a33a++){var _0x4b0a70=events[_0x57a33a];var _0x5cd77c=createListener(_0x2d17('0x5')+_0x4b0a70,_0x2d1a09);UserVoiceQueueRtEvents['on'](_0x4b0a70,_0x5cd77c);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 247c4e4..a7c2ddb 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 _0x9a3a=['../../components/interaction/service','path','connect-timeout','express','../../components/auth/service'];(function(_0x36498b,_0x1653a4){var _0x2aa7e4=function(_0xa0cb4f){while(--_0xa0cb4f){_0x36498b['push'](_0x36498b['shift']());}};_0x2aa7e4(++_0x1653a4);}(_0x9a3a,0xfb));var _0xa9a3=function(_0x505116,_0x5d0b8c){_0x505116=_0x505116-0x0;var _0x789aa1=_0x9a3a[_0x505116];return _0x789aa1;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xa9a3('0x0'));var timeout=require(_0xa9a3('0x1'));var express=require(_0xa9a3('0x2'));var router=express['Router']();var auth=require(_0xa9a3('0x3'));var interaction=require(_0xa9a3('0x4'));var config=require('../../config/environment');module['exports']=router; \ No newline at end of file +var _0x6ddc=['../../components/interaction/service','../../config/environment','exports','multer','path','connect-timeout','express','Router'];(function(_0x14477e,_0x44d4da){var _0x5d4a05=function(_0x5e0fa3){while(--_0x5e0fa3){_0x14477e['push'](_0x14477e['shift']());}};_0x5d4a05(++_0x44d4da);}(_0x6ddc,0x133));var _0xc6dd=function(_0x73e6d5,_0x4ba205){_0x73e6d5=_0x73e6d5-0x0;var _0x4c251c=_0x6ddc[_0x73e6d5];return _0x4c251c;};'use strict';var multer=require(_0xc6dd('0x0'));var util=require('util');var path=require(_0xc6dd('0x1'));var timeout=require(_0xc6dd('0x2'));var express=require(_0xc6dd('0x3'));var router=express[_0xc6dd('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xc6dd('0x5'));var config=require(_0xc6dd('0x6'));module[_0xc6dd('0x7')]=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index fc01a16..65cd960 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(_0x3feb8a,_0x47c784){var _0x4523ca=function(_0x4fba86){while(--_0x4fba86){_0x3feb8a['push'](_0x3feb8a['shift']());}};_0x4523ca(++_0x47c784);}(_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 +var _0xe706=['INTEGER','sequelize','exports'];(function(_0x4a0fa3,_0x55db22){var _0x5760d5=function(_0x5f3550){while(--_0x5f3550){_0x4a0fa3['push'](_0x4a0fa3['shift']());}};_0x5760d5(++_0x55db22);}(_0xe706,0xa3));var _0x6e70=function(_0x382c73,_0x199cab){_0x382c73=_0x382c73-0x0;var _0x1dd0bf=_0xe706[_0x382c73];return _0x1dd0bf;};'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 ac323c0..9293f76 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 _0xaebd=['moment','bluebird','request-promise','rimraf','../../config/environment','./userWhatsappQueue.attributes','exports','define','UserWhatsappQueue','lodash','../../config/logger','api'];(function(_0x448231,_0x2dd454){var _0x42fb5e=function(_0x12097d){while(--_0x12097d){_0x448231['push'](_0x448231['shift']());}};_0x42fb5e(++_0x2dd454);}(_0xaebd,0x1e9));var _0xdaeb=function(_0x1e565a,_0x17dce7){_0x1e565a=_0x1e565a-0x0;var _0x356df5=_0xaebd[_0x1e565a];return _0x356df5;};'use strict';var _=require(_0xdaeb('0x0'));var util=require('util');var logger=require(_0xdaeb('0x1'))(_0xdaeb('0x2'));var moment=require(_0xdaeb('0x3'));var BPromise=require(_0xdaeb('0x4'));var rp=require(_0xdaeb('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdaeb('0x6'));var config=require(_0xdaeb('0x7'));var attributes=require(_0xdaeb('0x8'));module[_0xdaeb('0x9')]=function(_0xee94f9,_0x4b7255){return _0xee94f9[_0xdaeb('0xa')](_0xdaeb('0xb'),attributes,{'tableName':'user_has_whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb9be=['path','rimraf','exports','UserWhatsappQueue','user_has_whatsapp_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1605ff,_0x2692d9){var _0x505071=function(_0x28d035){while(--_0x28d035){_0x1605ff['push'](_0x1605ff['shift']());}};_0x505071(++_0x2692d9);}(_0xb9be,0xc5));var _0xeb9b=function(_0x5a3cf0,_0x160a68){_0x5a3cf0=_0x5a3cf0-0x0;var _0x5a64ee=_0xb9be[_0x5a3cf0];return _0x5a64ee;};'use strict';var _=require(_0xeb9b('0x0'));var util=require(_0xeb9b('0x1'));var logger=require(_0xeb9b('0x2'))(_0xeb9b('0x3'));var moment=require(_0xeb9b('0x4'));var BPromise=require(_0xeb9b('0x5'));var rp=require(_0xeb9b('0x6'));var fs=require('fs');var path=require(_0xeb9b('0x7'));var rimraf=require(_0xeb9b('0x8'));var config=require('../../config/environment');var attributes=require('./userWhatsappQueue.attributes');module[_0xeb9b('0x9')]=function(_0x181810,_0x2529cb){return _0x181810['define'](_0xeb9b('0xa'),attributes,{'tableName':_0xeb9b('0xb'),'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 af199fd..41134f5 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(_0x13db9d,_0x2143d9){var _0x24602a=function(_0x102b82){while(--_0x102b82){_0x13db9d['push'](_0x13db9d['shift']());}};_0x24602a(++_0x2143d9);}(_0xa9e0,0x123));var _0x0a9e=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0xa9e0[_0xc6be3a];return _0x56a310;};'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(_0x201e3c,_0x2a8c8b){var _0x44775a=function(_0x434895){while(--_0x434895){_0x201e3c['push'](_0x201e3c['shift']());}};_0x44775a(++_0x2a8c8b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xa9e0[_0x2cfb58];return _0xd99951;};'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 6aad2a9..fb29a44 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 _0xe861=['post','create','destroy','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','get','index','/:id','isAuthenticated'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe861,0x1f3));var _0x1e86=function(_0x5388e1,_0x5b3473){_0x5388e1=_0x5388e1-0x0;var _0x4dd02c=_0xe861[_0x5388e1];return _0x4dd02c;};'use strict';var multer=require(_0x1e86('0x0'));var util=require(_0x1e86('0x1'));var path=require('path');var timeout=require(_0x1e86('0x2'));var express=require(_0x1e86('0x3'));var router=express[_0x1e86('0x4')]();var auth=require(_0x1e86('0x5'));var interaction=require(_0x1e86('0x6'));var config=require(_0x1e86('0x7'));var controller=require(_0x1e86('0x8'));router[_0x1e86('0x9')]('/',auth['isAuthenticated'](),controller[_0x1e86('0xa')]);router['get'](_0x1e86('0xb'),auth[_0x1e86('0xc')](),controller['show']);router[_0x1e86('0xd')]('/',auth['isAuthenticated'](),controller[_0x1e86('0xe')]);router['put']('/:id',auth[_0x1e86('0xc')](),controller['update']);router['delete'](_0x1e86('0xb'),auth[_0x1e86('0xc')](),controller[_0x1e86('0xf')]);module['exports']=router; \ No newline at end of file +var _0x0f07=['show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id'];(function(_0x59a45b,_0x495f42){var _0x4451a7=function(_0x3b7fdb){while(--_0x3b7fdb){_0x59a45b['push'](_0x59a45b['shift']());}};_0x4451a7(++_0x495f42);}(_0x0f07,0x1d4));var _0x70f0=function(_0x2ecb82,_0x4d6e38){_0x2ecb82=_0x2ecb82-0x0;var _0x1977bc=_0x0f07[_0x2ecb82];return _0x1977bc;};'use strict';var multer=require(_0x70f0('0x0'));var util=require(_0x70f0('0x1'));var path=require(_0x70f0('0x2'));var timeout=require(_0x70f0('0x3'));var express=require(_0x70f0('0x4'));var router=express[_0x70f0('0x5')]();var auth=require(_0x70f0('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x70f0('0x7'));var controller=require('./variable.controller');router[_0x70f0('0x8')]('/',auth[_0x70f0('0x9')](),controller[_0x70f0('0xa')]);router[_0x70f0('0x8')](_0x70f0('0xb'),auth[_0x70f0('0x9')](),controller[_0x70f0('0xc')]);router[_0x70f0('0xd')]('/',auth['isAuthenticated'](),controller[_0x70f0('0xe')]);router[_0x70f0('0xf')]('/:id',auth[_0x70f0('0x9')](),controller[_0x70f0('0x10')]);router[_0x70f0('0x11')](_0x70f0('0xb'),auth[_0x70f0('0x9')](),controller[_0x70f0('0x12')]);module[_0x70f0('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 2de05ce..ee0c13c 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 _0xf600=['name','sequelize','exports','STRING'];(function(_0x4e5254,_0x40ee71){var _0x41c2c6=function(_0x4ed1ae){while(--_0x4ed1ae){_0x4e5254['push'](_0x4e5254['shift']());}};_0x41c2c6(++_0x40ee71);}(_0xf600,0xbd));var _0x0f60=function(_0x289e06,_0x5257e5){_0x289e06=_0x289e06-0x0;var _0x186418=_0xf600[_0x289e06];return _0x186418;};'use strict';var Sequelize=require(_0x0f60('0x0'));module[_0x0f60('0x1')]={'name':{'type':Sequelize[_0x0f60('0x2')],'unique':_0x0f60('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x0f60('0x2')]}}; \ No newline at end of file +var _0x900d=['STRING','exports','name'];(function(_0x4f0c2b,_0x2c9d14){var _0x526436=function(_0x2e13b6){while(--_0x2e13b6){_0x4f0c2b['push'](_0x4f0c2b['shift']());}};_0x526436(++_0x2c9d14);}(_0x900d,0xa0));var _0xd900=function(_0x3bd42d,_0x475a9a){_0x3bd42d=_0x3bd42d-0x0;var _0x49ab40=_0x900d[_0x3bd42d];return _0x49ab40;};'use strict';var Sequelize=require('sequelize');module[_0xd900('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0xd900('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xd900('0x2')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index c58bb18..032f54e 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 _0x51f4=['save','update','get','UserProfileResource','destroy','sendStatus','name','send','index','map','Variable','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','merge','type','options','then','includeAll','findAll','rows','catch','show','params','include','find','create','body','role','user','Variables','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','end','json','count','offset','Content-Range','apply','reject'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x51f4,0x17f));var _0x451f=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x51f4[_0x2641f9];return _0x585741;};'use strict';var pdf=require(_0x451f('0x0'));var emlformat=require(_0x451f('0x1'));var rimraf=require(_0x451f('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x451f('0x3'));var rp=require('request-promise');var moment=require(_0x451f('0x4'));var BPromise=require(_0x451f('0x5'));var Mustache=require(_0x451f('0x6'));var util=require(_0x451f('0x7'));var path=require('path');var sox=require(_0x451f('0x8'));var csv=require(_0x451f('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x451f('0xa'));var squel=require(_0x451f('0xb'));var crypto=require(_0x451f('0xc'));var jsforce=require(_0x451f('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x451f('0x9'));var querystring=require(_0x451f('0xe'));var Papa=require(_0x451f('0xf'));var Redis=require(_0x451f('0x10'));var authService=require(_0x451f('0x11'));var qs=require(_0x451f('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x451f('0x13'));var logger=require(_0x451f('0x14'))(_0x451f('0x15'));var utils=require('../../config/utils');var config=require(_0x451f('0x16'));var db=require(_0x451f('0x17'))['db'];function respondWithStatusCode(_0xb89635,_0x3f6e4e){_0x3f6e4e=_0x3f6e4e||0xcc;return function(_0x4988ce){if(_0x4988ce){return _0xb89635['sendStatus'](_0x3f6e4e);}return _0xb89635[_0x451f('0x18')](_0x3f6e4e)[_0x451f('0x19')]();};}function respondWithResult(_0x8a3a80,_0x12238c){_0x12238c=_0x12238c||0xc8;return function(_0xa586f9){if(_0xa586f9){return _0x8a3a80[_0x451f('0x18')](_0x12238c)[_0x451f('0x1a')](_0xa586f9);}};}function respondWithFilteredResult(_0x411851,_0x218579){return function(_0x481a82){if(_0x481a82){var _0x41cb0d=_0x481a82[_0x451f('0x1b')],_0x2547b5=_0x218579[_0x451f('0x1c')],_0x516d20=_0x218579['offset']+_0x218579['limit'],_0xacccf3;if(_0x516d20>=_0x41cb0d){_0x516d20=_0x41cb0d;_0xacccf3=0xc8;}else{_0xacccf3=0xce;}_0x411851[_0x451f('0x18')](_0xacccf3);return _0x411851['set'](_0x451f('0x1d'),_0x2547b5+'-'+_0x516d20+'/'+_0x41cb0d)['json'](_0x481a82);}return null;};}function patchUpdates(_0x9e34c){return function(_0x58d52e){try{jsonpatch[_0x451f('0x1e')](_0x58d52e,_0x9e34c,!![]);}catch(_0xa3b3d4){return BPromise[_0x451f('0x1f')](_0xa3b3d4);}return _0x58d52e[_0x451f('0x20')]();};}function saveUpdates(_0x34de23,_0x43712a){return function(_0x5a6d27){if(_0x5a6d27){return _0x5a6d27[_0x451f('0x21')](_0x34de23)['then'](function(_0x231a9b){return _0x231a9b;});}return null;};}function removeEntity(_0x3481f3,_0x18cee6){return function(_0x2d9f74){if(_0x2d9f74){return _0x2d9f74['destroy']()['then'](function(){var _0xcfa309=_0x2d9f74[_0x451f('0x22')]({'plain':!![]});var _0x57caee='Variables';return db[_0x451f('0x23')][_0x451f('0x24')]({'where':{'type':_0x57caee,'resourceId':_0xcfa309['id']}})['then'](function(){return _0x2d9f74;});})['then'](function(){_0x3481f3[_0x451f('0x18')](0xcc)[_0x451f('0x19')]();});}};}function handleEntityNotFound(_0x284758,_0x4b2a99){return function(_0x1204a7){if(!_0x1204a7){_0x284758[_0x451f('0x25')](0x194);}return _0x1204a7;};}function handleError(_0xf63975,_0x4dcbe1){_0x4dcbe1=_0x4dcbe1||0x1f4;return function(_0x411b05){logger['error'](_0x411b05['stack']);if(_0x411b05['name']){delete _0x411b05[_0x451f('0x26')];}_0xf63975['status'](_0x4dcbe1)[_0x451f('0x27')](_0x411b05);};}exports[_0x451f('0x28')]=function(_0x459d87,_0x533f64){var _0x12c5cc={},_0x1d53d0={},_0xec834f={'count':0x0,'rows':[]};var _0x3e2d1c=_[_0x451f('0x29')](db[_0x451f('0x2a')][_0x451f('0x2b')],function(_0x1a16b4){return{'name':_0x1a16b4[_0x451f('0x2c')],'type':_0x1a16b4['type'][_0x451f('0x2d')]};});_0x1d53d0[_0x451f('0x2e')]=_['map'](_0x3e2d1c,'name');_0x1d53d0[_0x451f('0x2f')]=_[_0x451f('0x30')](_0x459d87[_0x451f('0x2f')]);_0x1d53d0['filters']=_[_0x451f('0x31')](_0x1d53d0['model'],_0x1d53d0['query']);_0x12c5cc[_0x451f('0x32')]=_[_0x451f('0x31')](_0x1d53d0[_0x451f('0x2e')],qs[_0x451f('0x33')](_0x459d87[_0x451f('0x2f')][_0x451f('0x33')]));_0x12c5cc['attributes']=_0x12c5cc['attributes'][_0x451f('0x34')]?_0x12c5cc[_0x451f('0x32')]:_0x1d53d0[_0x451f('0x2e')];if(!_0x459d87['query'][_0x451f('0x35')](_0x451f('0x36'))){_0x12c5cc[_0x451f('0x37')]=qs['limit'](_0x459d87['query'][_0x451f('0x37')]);_0x12c5cc[_0x451f('0x1c')]=qs[_0x451f('0x1c')](_0x459d87[_0x451f('0x2f')][_0x451f('0x1c')]);}_0x12c5cc[_0x451f('0x38')]=qs[_0x451f('0x39')](_0x459d87[_0x451f('0x2f')][_0x451f('0x39')]);_0x12c5cc[_0x451f('0x3a')]=qs[_0x451f('0x3b')](_[_0x451f('0x3c')](_0x459d87[_0x451f('0x2f')],_0x1d53d0[_0x451f('0x3b')]),_0x3e2d1c);if(_0x459d87[_0x451f('0x2f')][_0x451f('0x3d')]){_0x12c5cc[_0x451f('0x3a')]=_[_0x451f('0x3e')](_0x12c5cc['where'],{'$or':_[_0x451f('0x29')](_0x3e2d1c,function(_0x352f1a){if(_0x352f1a[_0x451f('0x3f')]!=='VIRTUAL'){var _0x1ff2bc={};_0x1ff2bc[_0x352f1a[_0x451f('0x26')]]={'$like':'%'+_0x459d87['query']['filter']+'%'};return _0x1ff2bc;}})});}_0x12c5cc=_[_0x451f('0x3e')]({},_0x12c5cc,_0x459d87[_0x451f('0x40')]);var _0x2e98d5={'where':_0x12c5cc[_0x451f('0x3a')]};return db[_0x451f('0x2a')]['count'](_0x2e98d5)[_0x451f('0x41')](function(_0x379954){_0xec834f[_0x451f('0x1b')]=_0x379954;if(_0x459d87['query'][_0x451f('0x42')]){_0x12c5cc['include']=[{'all':!![]}];}return db[_0x451f('0x2a')][_0x451f('0x43')](_0x12c5cc);})['then'](function(_0x3cc193){_0xec834f[_0x451f('0x44')]=_0x3cc193;return _0xec834f;})[_0x451f('0x41')](respondWithFilteredResult(_0x533f64,_0x12c5cc))[_0x451f('0x45')](handleError(_0x533f64,null));};exports[_0x451f('0x46')]=function(_0x753764,_0x13cb24){var _0x5a1483={'raw':!![],'where':{'id':_0x753764[_0x451f('0x47')]['id']}},_0x2c9cc2={};_0x2c9cc2[_0x451f('0x2e')]=_[_0x451f('0x30')](db[_0x451f('0x2a')][_0x451f('0x2b')]);_0x2c9cc2[_0x451f('0x2f')]=_['keys'](_0x753764[_0x451f('0x2f')]);_0x2c9cc2['filters']=_[_0x451f('0x31')](_0x2c9cc2[_0x451f('0x2e')],_0x2c9cc2[_0x451f('0x2f')]);_0x5a1483[_0x451f('0x32')]=_[_0x451f('0x31')](_0x2c9cc2[_0x451f('0x2e')],qs[_0x451f('0x33')](_0x753764[_0x451f('0x2f')]['fields']));_0x5a1483[_0x451f('0x32')]=_0x5a1483[_0x451f('0x32')]['length']?_0x5a1483[_0x451f('0x32')]:_0x2c9cc2['model'];if(_0x753764[_0x451f('0x2f')]['includeAll']){_0x5a1483[_0x451f('0x48')]=[{'all':!![]}];}_0x5a1483=_['merge']({},_0x5a1483,_0x753764[_0x451f('0x40')]);return db[_0x451f('0x2a')][_0x451f('0x49')](_0x5a1483)[_0x451f('0x41')](handleEntityNotFound(_0x13cb24,null))[_0x451f('0x41')](respondWithResult(_0x13cb24,null))[_0x451f('0x45')](handleError(_0x13cb24,null));};exports[_0x451f('0x4a')]=function(_0x1f606e,_0x34824e){return db[_0x451f('0x2a')][_0x451f('0x4a')](_0x1f606e[_0x451f('0x4b')],{})[_0x451f('0x41')](function(_0xd73321){var _0x5d436d=_0x1f606e['user'][_0x451f('0x22')]({'plain':!![]});if(!_0x5d436d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5d436d[_0x451f('0x4c')]===_0x451f('0x4d')){var _0x61b498=_0xd73321[_0x451f('0x22')]({'plain':!![]});var _0x1908a0=_0x451f('0x4e');return db['UserProfileSection'][_0x451f('0x49')]({'where':{'name':_0x1908a0,'userProfileId':_0x5d436d[_0x451f('0x4f')]},'raw':!![]})[_0x451f('0x41')](function(_0x262935){if(_0x262935&&_0x262935[_0x451f('0x50')]===0x0){return db[_0x451f('0x23')][_0x451f('0x4a')]({'name':_0x61b498[_0x451f('0x26')],'resourceId':_0x61b498['id'],'type':_0x262935[_0x451f('0x26')],'sectionId':_0x262935['id']},{})[_0x451f('0x41')](function(){return _0xd73321;});}else{return _0xd73321;}})['catch'](function(_0x28237d){logger[_0x451f('0x51')](_0x451f('0x52'),_0x28237d);throw _0x28237d;});}return _0xd73321;})['then'](respondWithResult(_0x34824e,0xc9))[_0x451f('0x45')](handleError(_0x34824e,null));};exports['update']=function(_0x52ff05,_0x6c33df){if(_0x52ff05['body']['id']){delete _0x52ff05['body']['id'];}return db[_0x451f('0x2a')][_0x451f('0x49')]({'where':{'id':_0x52ff05['params']['id']}})[_0x451f('0x41')](handleEntityNotFound(_0x6c33df,null))[_0x451f('0x41')](saveUpdates(_0x52ff05[_0x451f('0x4b')],null))['then'](respondWithResult(_0x6c33df,null))[_0x451f('0x45')](handleError(_0x6c33df,null));};exports[_0x451f('0x24')]=function(_0x5769e1,_0x540093){return db[_0x451f('0x2a')]['find']({'where':{'id':_0x5769e1[_0x451f('0x47')]['id']}})[_0x451f('0x41')](handleEntityNotFound(_0x540093,null))[_0x451f('0x41')](removeEntity(_0x540093,null))[_0x451f('0x45')](handleError(_0x540093,null));}; \ No newline at end of file +var _0x2904=['fieldName','type','key','model','query','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','Variable','findAll','rows','show','keys','include','find','catch','create','body','user','role','get','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','params','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','sox','to-csv','squel','crypto','jsforce','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','Variables','UserProfileResource','end','name','send','index','map','rawAttributes'];(function(_0x39bd3f,_0x45b058){var _0x5ce625=function(_0x127975){while(--_0x127975){_0x39bd3f['push'](_0x39bd3f['shift']());}};_0x5ce625(++_0x45b058);}(_0x2904,0x106));var _0x4290=function(_0xb61ee,_0x52a3f5){_0xb61ee=_0xb61ee-0x0;var _0x5a976d=_0x2904[_0xb61ee];return _0x5a976d;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x4290('0x0'));var rimraf=require(_0x4290('0x1'));var zipdir=require(_0x4290('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4290('0x3'));var moment=require(_0x4290('0x4'));var BPromise=require(_0x4290('0x5'));var Mustache=require(_0x4290('0x6'));var util=require('util');var path=require('path');var sox=require(_0x4290('0x7'));var csv=require(_0x4290('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x4290('0x9'));var crypto=require(_0x4290('0xa'));var jsforce=require(_0x4290('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x4290('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x4290('0xc'));var qs=require(_0x4290('0xd'));var as=require(_0x4290('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4290('0xf'))('api');var utils=require('../../config/utils');var config=require(_0x4290('0x10'));var db=require(_0x4290('0x11'))['db'];function respondWithStatusCode(_0x49584b,_0x399b8b){_0x399b8b=_0x399b8b||0xcc;return function(_0x53972d){if(_0x53972d){return _0x49584b[_0x4290('0x12')](_0x399b8b);}return _0x49584b['status'](_0x399b8b)['end']();};}function respondWithResult(_0x16cdc5,_0x27018d){_0x27018d=_0x27018d||0xc8;return function(_0x21a24a){if(_0x21a24a){return _0x16cdc5[_0x4290('0x13')](_0x27018d)[_0x4290('0x14')](_0x21a24a);}};}function respondWithFilteredResult(_0x1be920,_0x446124){return function(_0x3b60d9){if(_0x3b60d9){var _0x1857d0=_0x3b60d9[_0x4290('0x15')],_0x7b7006=_0x446124['offset'],_0x27ac30=_0x446124[_0x4290('0x16')]+_0x446124[_0x4290('0x17')],_0x3a6889;if(_0x27ac30>=_0x1857d0){_0x27ac30=_0x1857d0;_0x3a6889=0xc8;}else{_0x3a6889=0xce;}_0x1be920[_0x4290('0x13')](_0x3a6889);return _0x1be920[_0x4290('0x18')](_0x4290('0x19'),_0x7b7006+'-'+_0x27ac30+'/'+_0x1857d0)[_0x4290('0x14')](_0x3b60d9);}return null;};}function patchUpdates(_0x6243e9){return function(_0x105dac){try{jsonpatch[_0x4290('0x1a')](_0x105dac,_0x6243e9,!![]);}catch(_0x16db10){return BPromise['reject'](_0x16db10);}return _0x105dac[_0x4290('0x1b')]();};}function saveUpdates(_0x21cfb5,_0x15e8d7){return function(_0x1422df){if(_0x1422df){return _0x1422df[_0x4290('0x1c')](_0x21cfb5)[_0x4290('0x1d')](function(_0x3d6f99){return _0x3d6f99;});}return null;};}function removeEntity(_0x37957e,_0x25d461){return function(_0x152aa2){if(_0x152aa2){return _0x152aa2['destroy']()['then'](function(){var _0xc59dfa=_0x152aa2['get']({'plain':!![]});var _0x42c827=_0x4290('0x1e');return db[_0x4290('0x1f')]['destroy']({'where':{'type':_0x42c827,'resourceId':_0xc59dfa['id']}})[_0x4290('0x1d')](function(){return _0x152aa2;});})[_0x4290('0x1d')](function(){_0x37957e['status'](0xcc)[_0x4290('0x20')]();});}};}function handleEntityNotFound(_0x24d5a0,_0x5651f9){return function(_0x5ee855){if(!_0x5ee855){_0x24d5a0[_0x4290('0x12')](0x194);}return _0x5ee855;};}function handleError(_0x12326c,_0x180142){_0x180142=_0x180142||0x1f4;return function(_0x51b817){logger['error'](_0x51b817['stack']);if(_0x51b817[_0x4290('0x21')]){delete _0x51b817['name'];}_0x12326c['status'](_0x180142)[_0x4290('0x22')](_0x51b817);};}exports[_0x4290('0x23')]=function(_0x45bc80,_0x366c26){var _0x48d824={},_0x597fb5={},_0x2a8a9e={'count':0x0,'rows':[]};var _0x4fe16d=_[_0x4290('0x24')](db['Variable'][_0x4290('0x25')],function(_0x27757b){return{'name':_0x27757b[_0x4290('0x26')],'type':_0x27757b[_0x4290('0x27')][_0x4290('0x28')]};});_0x597fb5[_0x4290('0x29')]=_[_0x4290('0x24')](_0x4fe16d,_0x4290('0x21'));_0x597fb5[_0x4290('0x2a')]=_['keys'](_0x45bc80[_0x4290('0x2a')]);_0x597fb5['filters']=_[_0x4290('0x2b')](_0x597fb5[_0x4290('0x29')],_0x597fb5[_0x4290('0x2a')]);_0x48d824[_0x4290('0x2c')]=_[_0x4290('0x2b')](_0x597fb5[_0x4290('0x29')],qs['fields'](_0x45bc80[_0x4290('0x2a')][_0x4290('0x2d')]));_0x48d824[_0x4290('0x2c')]=_0x48d824[_0x4290('0x2c')][_0x4290('0x2e')]?_0x48d824[_0x4290('0x2c')]:_0x597fb5['model'];if(!_0x45bc80[_0x4290('0x2a')]['hasOwnProperty'](_0x4290('0x2f'))){_0x48d824[_0x4290('0x17')]=qs['limit'](_0x45bc80['query']['limit']);_0x48d824['offset']=qs[_0x4290('0x16')](_0x45bc80[_0x4290('0x2a')][_0x4290('0x16')]);}_0x48d824[_0x4290('0x30')]=qs[_0x4290('0x31')](_0x45bc80[_0x4290('0x2a')][_0x4290('0x31')]);_0x48d824[_0x4290('0x32')]=qs[_0x4290('0x33')](_[_0x4290('0x34')](_0x45bc80['query'],_0x597fb5['filters']),_0x4fe16d);if(_0x45bc80['query'][_0x4290('0x35')]){_0x48d824[_0x4290('0x32')]=_['merge'](_0x48d824[_0x4290('0x32')],{'$or':_[_0x4290('0x24')](_0x4fe16d,function(_0x2d5dad){if(_0x2d5dad[_0x4290('0x27')]!=='VIRTUAL'){var _0x19301a={};_0x19301a[_0x2d5dad[_0x4290('0x21')]]={'$like':'%'+_0x45bc80[_0x4290('0x2a')][_0x4290('0x35')]+'%'};return _0x19301a;}})});}_0x48d824=_[_0x4290('0x36')]({},_0x48d824,_0x45bc80[_0x4290('0x37')]);var _0x183f08={'where':_0x48d824[_0x4290('0x32')]};return db['Variable']['count'](_0x183f08)[_0x4290('0x1d')](function(_0x3aa3f0){_0x2a8a9e[_0x4290('0x15')]=_0x3aa3f0;if(_0x45bc80[_0x4290('0x2a')][_0x4290('0x38')]){_0x48d824['include']=[{'all':!![]}];}return db[_0x4290('0x39')][_0x4290('0x3a')](_0x48d824);})[_0x4290('0x1d')](function(_0xc9e83f){_0x2a8a9e[_0x4290('0x3b')]=_0xc9e83f;return _0x2a8a9e;})[_0x4290('0x1d')](respondWithFilteredResult(_0x366c26,_0x48d824))['catch'](handleError(_0x366c26,null));};exports[_0x4290('0x3c')]=function(_0x2bfe22,_0x363729){var _0x1b28bc={'raw':!![],'where':{'id':_0x2bfe22['params']['id']}},_0x1008ee={};_0x1008ee[_0x4290('0x29')]=_['keys'](db[_0x4290('0x39')]['rawAttributes']);_0x1008ee[_0x4290('0x2a')]=_[_0x4290('0x3d')](_0x2bfe22[_0x4290('0x2a')]);_0x1008ee[_0x4290('0x33')]=_[_0x4290('0x2b')](_0x1008ee[_0x4290('0x29')],_0x1008ee[_0x4290('0x2a')]);_0x1b28bc['attributes']=_[_0x4290('0x2b')](_0x1008ee[_0x4290('0x29')],qs[_0x4290('0x2d')](_0x2bfe22[_0x4290('0x2a')][_0x4290('0x2d')]));_0x1b28bc[_0x4290('0x2c')]=_0x1b28bc[_0x4290('0x2c')][_0x4290('0x2e')]?_0x1b28bc['attributes']:_0x1008ee[_0x4290('0x29')];if(_0x2bfe22[_0x4290('0x2a')]['includeAll']){_0x1b28bc[_0x4290('0x3e')]=[{'all':!![]}];}_0x1b28bc=_[_0x4290('0x36')]({},_0x1b28bc,_0x2bfe22[_0x4290('0x37')]);return db[_0x4290('0x39')][_0x4290('0x3f')](_0x1b28bc)[_0x4290('0x1d')](handleEntityNotFound(_0x363729,null))[_0x4290('0x1d')](respondWithResult(_0x363729,null))[_0x4290('0x40')](handleError(_0x363729,null));};exports[_0x4290('0x41')]=function(_0x29ec80,_0xd36a9e){return db[_0x4290('0x39')]['create'](_0x29ec80[_0x4290('0x42')],{})[_0x4290('0x1d')](function(_0x5673df){var _0x5d5ace=_0x29ec80[_0x4290('0x43')]['get']({'plain':!![]});if(!_0x5d5ace)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5d5ace[_0x4290('0x44')]===_0x4290('0x43')){var _0x17f049=_0x5673df[_0x4290('0x45')]({'plain':!![]});var _0xdacb80=_0x4290('0x1e');return db['UserProfileSection'][_0x4290('0x3f')]({'where':{'name':_0xdacb80,'userProfileId':_0x5d5ace[_0x4290('0x46')]},'raw':!![]})[_0x4290('0x1d')](function(_0x2798a8){if(_0x2798a8&&_0x2798a8[_0x4290('0x47')]===0x0){return db['UserProfileResource'][_0x4290('0x41')]({'name':_0x17f049[_0x4290('0x21')],'resourceId':_0x17f049['id'],'type':_0x2798a8[_0x4290('0x21')],'sectionId':_0x2798a8['id']},{})['then'](function(){return _0x5673df;});}else{return _0x5673df;}})[_0x4290('0x40')](function(_0x105fb5){logger['error'](_0x4290('0x48'),_0x105fb5);throw _0x105fb5;});}return _0x5673df;})['then'](respondWithResult(_0xd36a9e,0xc9))['catch'](handleError(_0xd36a9e,null));};exports[_0x4290('0x1c')]=function(_0x272342,_0x507836){if(_0x272342[_0x4290('0x42')]['id']){delete _0x272342['body']['id'];}return db[_0x4290('0x39')]['find']({'where':{'id':_0x272342['params']['id']}})[_0x4290('0x1d')](handleEntityNotFound(_0x507836,null))['then'](saveUpdates(_0x272342[_0x4290('0x42')],null))[_0x4290('0x1d')](respondWithResult(_0x507836,null))['catch'](handleError(_0x507836,null));};exports[_0x4290('0x49')]=function(_0x46fccb,_0x49461c){return db[_0x4290('0x39')][_0x4290('0x3f')]({'where':{'id':_0x46fccb[_0x4290('0x4a')]['id']}})[_0x4290('0x1d')](handleEntityNotFound(_0x49461c,null))[_0x4290('0x1d')](removeEntity(_0x49461c,null))['catch'](handleError(_0x49461c,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 22146cc..ff7dc0e 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 _0x3a79=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./variable.attributes','define','Variable','tools_variables','util','../../config/logger'];(function(_0x38f8eb,_0x1eeea3){var _0x273f7f=function(_0x52fd97){while(--_0x52fd97){_0x38f8eb['push'](_0x38f8eb['shift']());}};_0x273f7f(++_0x1eeea3);}(_0x3a79,0xca));var _0x93a7=function(_0x44ef02,_0x29d833){_0x44ef02=_0x44ef02-0x0;var _0x19d21c=_0x3a79[_0x44ef02];return _0x19d21c;};'use strict';var _=require('lodash');var util=require(_0x93a7('0x0'));var logger=require(_0x93a7('0x1'))('api');var moment=require(_0x93a7('0x2'));var BPromise=require(_0x93a7('0x3'));var rp=require(_0x93a7('0x4'));var fs=require('fs');var path=require(_0x93a7('0x5'));var rimraf=require(_0x93a7('0x6'));var config=require(_0x93a7('0x7'));var attributes=require(_0x93a7('0x8'));module['exports']=function(_0x2976b2,_0x4efb20){return _0x2976b2[_0x93a7('0x9')](_0x93a7('0xa'),attributes,{'tableName':_0x93a7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xee4f=['bluebird','path','../../config/environment','Variable','tools_variables','lodash','api','moment'];(function(_0x12fcbd,_0x884804){var _0x28ec2a=function(_0xa5ff99){while(--_0xa5ff99){_0x12fcbd['push'](_0x12fcbd['shift']());}};_0x28ec2a(++_0x884804);}(_0xee4f,0xad));var _0xfee4=function(_0x5a4518,_0x10d6f9){_0x5a4518=_0x5a4518-0x0;var _0x14453d=_0xee4f[_0x5a4518];return _0x14453d;};'use strict';var _=require(_0xfee4('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xfee4('0x1'));var moment=require(_0xfee4('0x2'));var BPromise=require(_0xfee4('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfee4('0x4'));var rimraf=require('rimraf');var config=require(_0xfee4('0x5'));var attributes=require('./variable.attributes');module['exports']=function(_0x1c39b1,_0x498647){return _0x1c39b1['define'](_0xfee4('0x6'),attributes,{'tableName':_0xfee4('0x7'),'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 cbedd77..f640a5e 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 _0x1950=['ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','Variable,\x20%s,\x20%s','request\x20sent','Variable,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','ShowVariable','Variable','find','options','raw','where','attributes','include','map','model','then','debug','lodash','util','moment','bluebird','randomstring'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x1950,0x1b5));var _0x0195=function(_0x4b4a71,_0x2dd9e3){_0x4b4a71=_0x4b4a71-0x0;var _0x1435f2=_0x1950[_0x4b4a71];return _0x1435f2;};'use strict';var _=require(_0x0195('0x0'));var util=require(_0x0195('0x1'));var moment=require(_0x0195('0x2'));var BPromise=require(_0x0195('0x3'));var rs=require(_0x0195('0x4'));var fs=require('fs');var Redis=require(_0x0195('0x5'));var db=require(_0x0195('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x0195('0x7'))(_0x0195('0x8'));var config=require('../../config/environment');var jayson=require(_0x0195('0x9'));var client=jayson[_0x0195('0xa')][_0x0195('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x12e5f2,_0x33ef1a,_0x2e0496){return new BPromise(function(_0xc161aa,_0x2b4cfa){return client[_0x0195('0xc')](_0x12e5f2,_0x2e0496)['then'](function(_0x23b06b){logger['info'](_0x0195('0xd'),_0x33ef1a,_0x0195('0xe'));logger['debug'](_0x0195('0xf'),_0x33ef1a,_0x0195('0xe'),JSON[_0x0195('0x10')](_0x23b06b));if(_0x23b06b['error']){if(_0x23b06b[_0x0195('0x11')]['code']===0x1f4){logger['error']('Variable,\x20%s,\x20%s',_0x33ef1a,_0x23b06b['error']['message']);return _0x2b4cfa(_0x23b06b[_0x0195('0x11')]['message']);}logger[_0x0195('0x11')](_0x0195('0xd'),_0x33ef1a,_0x23b06b[_0x0195('0x11')][_0x0195('0x12')]);return _0xc161aa(_0x23b06b[_0x0195('0x11')][_0x0195('0x12')]);}else{logger[_0x0195('0x13')](_0x0195('0xd'),_0x33ef1a,_0x0195('0xe'));_0xc161aa(_0x23b06b[_0x0195('0x14')][_0x0195('0x12')]);}})[_0x0195('0x15')](function(_0x4f5ddf){logger[_0x0195('0x11')](_0x0195('0xd'),_0x33ef1a,_0x4f5ddf);_0x2b4cfa(_0x4f5ddf);});});}exports[_0x0195('0x16')]=function(_0xb0369b){var _0x1dd32f=this;return new Promise(function(_0x29d5c6,_0x594949){return db[_0x0195('0x17')][_0x0195('0x18')]({'raw':_0xb0369b[_0x0195('0x19')]?_0xb0369b[_0x0195('0x19')][_0x0195('0x1a')]===undefined?!![]:![]:!![],'where':_0xb0369b[_0x0195('0x19')]?_0xb0369b['options'][_0x0195('0x1b')]||null:null,'attributes':_0xb0369b[_0x0195('0x19')]?_0xb0369b[_0x0195('0x19')][_0x0195('0x1c')]||null:null,'include':_0xb0369b[_0x0195('0x19')]?_0xb0369b['options'][_0x0195('0x1d')]?_[_0x0195('0x1e')](_0xb0369b[_0x0195('0x19')][_0x0195('0x1d')],function(_0x3c2da8){return{'model':db[_0x3c2da8[_0x0195('0x1f')]],'as':_0x3c2da8['as'],'attributes':_0x3c2da8[_0x0195('0x1c')],'include':_0x3c2da8[_0x0195('0x1d')]?_[_0x0195('0x1e')](_0x3c2da8[_0x0195('0x1d')],function(_0x5ee592){return{'model':db[_0x5ee592[_0x0195('0x1f')]],'as':_0x5ee592['as'],'attributes':_0x5ee592[_0x0195('0x1c')],'include':_0x5ee592['include']?_['map'](_0x5ee592[_0x0195('0x1d')],function(_0x106611){return{'model':db[_0x106611[_0x0195('0x1f')]],'as':_0x106611['as'],'attributes':_0x106611[_0x0195('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x0195('0x20')](function(_0x541867){logger[_0x0195('0x13')](_0x0195('0x16'),_0xb0369b);logger[_0x0195('0x21')]('ShowVariable',_0xb0369b,JSON[_0x0195('0x10')](_0x541867));_0x29d5c6(_0x541867);})[_0x0195('0x15')](function(_0x30ab5d){logger[_0x0195('0x11')]('ShowVariable',_0x30ab5d[_0x0195('0x12')],_0xb0369b);_0x594949(_0x1dd32f[_0x0195('0x11')](0x1f4,_0x30ab5d[_0x0195('0x12')]));});});}; \ No newline at end of file +var _0x6663=['attributes','include','model','map','lodash','util','moment','bluebird','randomstring','rpc','client','request','then','info','Variable,\x20%s,\x20%s','debug','Variable,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','ShowVariable','find','options','raw','where'];(function(_0x5a3cf0,_0x160a68){var _0x5a64ee=function(_0x34cd1d){while(--_0x34cd1d){_0x5a3cf0['push'](_0x5a3cf0['shift']());}};_0x5a64ee(++_0x160a68);}(_0x6663,0x1a8));var _0x3666=function(_0x29d623,_0x1a5c9c){_0x29d623=_0x29d623-0x0;var _0x242e59=_0x6663[_0x29d623];return _0x242e59;};'use strict';var _=require(_0x3666('0x0'));var util=require(_0x3666('0x1'));var moment=require(_0x3666('0x2'));var BPromise=require(_0x3666('0x3'));var rs=require(_0x3666('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3666('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3666('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x592e5a,_0x1325a9,_0x1f3104){return new BPromise(function(_0x327528,_0x24c86a){return client[_0x3666('0x7')](_0x592e5a,_0x1f3104)[_0x3666('0x8')](function(_0x380e58){logger[_0x3666('0x9')](_0x3666('0xa'),_0x1325a9,'request\x20sent');logger[_0x3666('0xb')](_0x3666('0xc'),_0x1325a9,_0x3666('0xd'),JSON[_0x3666('0xe')](_0x380e58));if(_0x380e58['error']){if(_0x380e58[_0x3666('0xf')][_0x3666('0x10')]===0x1f4){logger[_0x3666('0xf')](_0x3666('0xa'),_0x1325a9,_0x380e58['error'][_0x3666('0x11')]);return _0x24c86a(_0x380e58[_0x3666('0xf')]['message']);}logger['error'](_0x3666('0xa'),_0x1325a9,_0x380e58[_0x3666('0xf')]['message']);return _0x327528(_0x380e58[_0x3666('0xf')][_0x3666('0x11')]);}else{logger['info'](_0x3666('0xa'),_0x1325a9,'request\x20sent');_0x327528(_0x380e58[_0x3666('0x12')][_0x3666('0x11')]);}})['catch'](function(_0x394f9a){logger['error'](_0x3666('0xa'),_0x1325a9,_0x394f9a);_0x24c86a(_0x394f9a);});});}exports[_0x3666('0x13')]=function(_0x15959f){var _0x357b62=this;return new Promise(function(_0x5428d9,_0x17f88e){return db['Variable'][_0x3666('0x14')]({'raw':_0x15959f[_0x3666('0x15')]?_0x15959f[_0x3666('0x15')][_0x3666('0x16')]===undefined?!![]:![]:!![],'where':_0x15959f[_0x3666('0x15')]?_0x15959f[_0x3666('0x15')][_0x3666('0x17')]||null:null,'attributes':_0x15959f[_0x3666('0x15')]?_0x15959f[_0x3666('0x15')][_0x3666('0x18')]||null:null,'include':_0x15959f[_0x3666('0x15')]?_0x15959f[_0x3666('0x15')][_0x3666('0x19')]?_['map'](_0x15959f[_0x3666('0x15')][_0x3666('0x19')],function(_0x43798a){return{'model':db[_0x43798a[_0x3666('0x1a')]],'as':_0x43798a['as'],'attributes':_0x43798a[_0x3666('0x18')],'include':_0x43798a[_0x3666('0x19')]?_[_0x3666('0x1b')](_0x43798a['include'],function(_0xfd1470){return{'model':db[_0xfd1470[_0x3666('0x1a')]],'as':_0xfd1470['as'],'attributes':_0xfd1470[_0x3666('0x18')],'include':_0xfd1470[_0x3666('0x19')]?_['map'](_0xfd1470[_0x3666('0x19')],function(_0x2f0c8b){return{'model':db[_0x2f0c8b['model']],'as':_0x2f0c8b['as'],'attributes':_0x2f0c8b[_0x3666('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3f9dac){logger[_0x3666('0x9')](_0x3666('0x13'),_0x15959f);logger['debug'](_0x3666('0x13'),_0x15959f,JSON[_0x3666('0xe')](_0x3f9dac));_0x5428d9(_0x3f9dac);})['catch'](function(_0x4f8fed){logger[_0x3666('0xf')]('ShowVariable',_0x4f8fed[_0x3666('0x11')],_0x15959f);_0x17f88e(_0x357b62[_0x3666('0xf')](0x1f4,_0x4f8fed[_0x3666('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 3d3b47e..bb8cb5f 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 _0x05ce=['fetch','get','/reset','pull','/restart','restart','/migrations','migrations','exports','Router','../../components/auth/service','isAuthenticated','canUpdate'];(function(_0x772a04,_0x29fbe5){var _0x4fd280=function(_0x3b0ff6){while(--_0x3b0ff6){_0x772a04['push'](_0x772a04['shift']());}};_0x4fd280(++_0x29fbe5);}(_0x05ce,0xcc));var _0xe05c=function(_0x55d92a,_0x9f9f89){_0x55d92a=_0x55d92a-0x0;var _0x401546=_0x05ce[_0x55d92a];return _0x401546;};'use strict';var express=require('express');var router=express[_0xe05c('0x0')]();var auth=require(_0xe05c('0x1'));var controller=require('./version.controller');router['get']('/',controller['index']);router['get']('/fetch',auth[_0xe05c('0x2')](),auth[_0xe05c('0x3')](),controller[_0xe05c('0x4')]);router[_0xe05c('0x5')](_0xe05c('0x6'),auth['isAuthenticated'](),auth[_0xe05c('0x3')](),controller['reset']);router[_0xe05c('0x5')]('/pull',auth[_0xe05c('0x2')](),auth['canUpdate'](),controller[_0xe05c('0x7')]);router[_0xe05c('0x5')](_0xe05c('0x8'),auth['isAuthenticated'](),controller[_0xe05c('0x9')]);router[_0xe05c('0x5')](_0xe05c('0xa'),controller[_0xe05c('0xb')]);module[_0xe05c('0xc')]=router; \ No newline at end of file +var _0x32d3=['index','/fetch','isAuthenticated','canUpdate','fetch','reset','/pull','pull','restart','/migrations','migrations','express','Router','./version.controller','get'];(function(_0x75f869,_0x3690d6){var _0x10af8b=function(_0x22d3ff){while(--_0x22d3ff){_0x75f869['push'](_0x75f869['shift']());}};_0x10af8b(++_0x3690d6);}(_0x32d3,0xbf));var _0x332d=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x32d3[_0x1facfa];return _0x9ec701;};'use strict';var express=require(_0x332d('0x0'));var router=express[_0x332d('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x332d('0x2'));router[_0x332d('0x3')]('/',controller[_0x332d('0x4')]);router[_0x332d('0x3')](_0x332d('0x5'),auth[_0x332d('0x6')](),auth[_0x332d('0x7')](),controller[_0x332d('0x8')]);router[_0x332d('0x3')]('/reset',auth[_0x332d('0x6')](),auth['canUpdate'](),controller[_0x332d('0x9')]);router[_0x332d('0x3')](_0x332d('0xa'),auth[_0x332d('0x6')](),auth[_0x332d('0x7')](),controller[_0x332d('0xb')]);router['get']('/restart',auth[_0x332d('0x6')](),controller[_0x332d('0xc')]);router[_0x332d('0x3')](_0x332d('0xd'),controller[_0x332d('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index e911b72..8bdd85e 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 _0xab00=['update','simple-git','root','index','query','latest','status','json','fetch','origin','master','error','git\x20fetch','reset','--hard','FETCH_HEAD','info','git\x20reset\x20--hard','pull','restart','motion2','pm2\x20restart\x20motion\x20%s','catch','migrations','readdirSync','join','server','length','replace','.js','exports','push','sort','sequelize','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','map','then','last','UniqueConstraintError','umzug','path','lodash','version','compare-versions','child_process','../../mysqldb','../../config/pm2','../../config/logger'];(function(_0x5b7cfa,_0x132e22){var _0x49243f=function(_0x37c2c2){while(--_0x37c2c2){_0x5b7cfa['push'](_0x5b7cfa['shift']());}};_0x49243f(++_0x132e22);}(_0xab00,0x1b9));var _0x0ab0=function(_0x316f1f,_0x107370){_0x316f1f=_0x316f1f-0x0;var _0x4240f4=_0xab00[_0x316f1f];return _0x4240f4;};'use strict';var Umzug=require(_0x0ab0('0x0'));var path=require(_0x0ab0('0x1'));var fs=require('fs');var _=require(_0x0ab0('0x2'));var pkginfo=require('pkginfo')(module,_0x0ab0('0x3'));var compareVersions=require(_0x0ab0('0x4'));var exec=require(_0x0ab0('0x5'))['exec'];var db=require(_0x0ab0('0x6'))['db'];var config=require('../../config/environment');var pm2=require(_0x0ab0('0x7'));var logger=require(_0x0ab0('0x8'))(_0x0ab0('0x9'));var git=require(_0x0ab0('0xa'))(config[_0x0ab0('0xb')]);exports[_0x0ab0('0xc')]=function(_0x59fb03,_0x3e934d){var _0x2cbb53={'current':module['exports'][_0x0ab0('0x3')],'phonebar':0x2};if(_0x59fb03['query']&&_0x59fb03[_0x0ab0('0xd')][_0x0ab0('0xe')]){return git['fetch']()['tags'](function(_0x5a1887,_0x5a69bd){_0x2cbb53[_0x0ab0('0xe')]=(_0x5a1887?module['exports'][_0x0ab0('0x3')]:_0x5a69bd[_0x0ab0('0xe')])||'2.0.0';return _0x3e934d[_0x0ab0('0xf')](0xc8)[_0x0ab0('0x10')](_0x2cbb53);});}else{return _0x3e934d[_0x0ab0('0xf')](0xc8)[_0x0ab0('0x10')](_0x2cbb53);}};exports[_0x0ab0('0x11')]=function(_0x3f1558,_0x906db9){return git[_0x0ab0('0x11')]([_0x0ab0('0x12'),_0x0ab0('0x13')],function(_0x28f26d){if(_0x28f26d){logger[_0x0ab0('0x14')](_0x28f26d);return _0x906db9['status'](0x1f4)['json'](_0x28f26d);}logger['info'](_0x0ab0('0x15'));return _0x906db9[_0x0ab0('0xf')](0xc8)[_0x0ab0('0x10')]({'output':'git\x20fetch\x20origin\x20master'});});};exports[_0x0ab0('0x16')]=function(_0x4a453f,_0x5b3bef){return git['reset']([_0x0ab0('0x17'),_0x0ab0('0x18')],function(_0x2d876b){if(_0x2d876b){logger[_0x0ab0('0x14')](_0x2d876b);return _0x5b3bef[_0x0ab0('0xf')](0x1f4)[_0x0ab0('0x10')](_0x2d876b);}logger[_0x0ab0('0x19')]('git\x20reset\x20--hard\x20FETCH_HEAD');return _0x5b3bef['status'](0xc8)[_0x0ab0('0x10')]({'output':_0x0ab0('0x1a')});});};exports[_0x0ab0('0x1b')]=function(_0x5c3382,_0x19b33e){exec('npm\x20install\x20--production',function(_0x2691c7,_0x2ccb3e,_0x20cd95){logger[_0x0ab0('0x19')](_0x2ccb3e);logger[_0x0ab0('0x19')](_0x20cd95);if(_0x2691c7){logger[_0x0ab0('0x14')](_0x2691c7);return _0x19b33e[_0x0ab0('0xf')](0x1f4)['json'](_0x2691c7);}return _0x19b33e[_0x0ab0('0xf')](0xc8)[_0x0ab0('0x10')]({'output':_0x2ccb3e});});};exports[_0x0ab0('0x1c')]=function(_0x5e3ebb,_0x206906){return pm2[_0x0ab0('0x1c')](_0x0ab0('0x1d'))['then'](function(_0x1f5d10){logger[_0x0ab0('0x19')](_0x0ab0('0x1e'),_0x1f5d10);return _0x206906[_0x0ab0('0xf')](0xc8)[_0x0ab0('0x10')]({'output':'Your\x20system\x20has\x20been\x20restart\x20successfully'});})[_0x0ab0('0x1f')](function(_0x4d330f){logger[_0x0ab0('0x14')](_0x4d330f);return _0x206906[_0x0ab0('0xf')](0x1f4)[_0x0ab0('0x10')](_0x4d330f);});};exports[_0x0ab0('0x20')]=function(_0x5ae993,_0x4764fc){var _0x5e7e2b=fs[_0x0ab0('0x21')](path[_0x0ab0('0x22')](config[_0x0ab0('0xb')],_0x0ab0('0x23'),_0x0ab0('0x20')));var _0xa9cb4f=[];for(var _0x3306c6=0x0;_0x3306c6<_0x5e7e2b[_0x0ab0('0x24')];_0x3306c6++){var _0x3c6822=_0x5e7e2b[_0x3306c6][_0x0ab0('0x25')](_0x0ab0('0x26'),'');if(compareVersions(module[_0x0ab0('0x27')]['version'],_0x3c6822)===-0x1){_0xa9cb4f[_0x0ab0('0x28')](_0x3c6822);}}if(_0xa9cb4f[_0x0ab0('0x24')]){var _0x989e82=_0xa9cb4f[_0x0ab0('0x29')](compareVersions);var _0xd9eac0=new Umzug({'storage':_0x0ab0('0x2a'),'storageOptions':{'model':db['Migration'],'modelName':'Migration','columnName':_0x0ab0('0x3')},'migrations':{'params':[db[_0x0ab0('0x2a')][_0x0ab0('0x2b')](),db[_0x0ab0('0x2a')][_0x0ab0('0x2c')],function(){throw new Error(_0x0ab0('0x2d'));}],'path':path[_0x0ab0('0x22')](config['root'],_0x0ab0('0x23'),_0x0ab0('0x20')),'pattern':/\.js$/}});_0xd9eac0['up']({'migrations':_[_0x0ab0('0x2e')](_0x989e82,function(_0x33f161){return _0x33f161+'.js';})})[_0x0ab0('0x2f')](function(){return _0x4764fc['status'](0xc8)[_0x0ab0('0x10')]({'output':'Database\x20migrated\x20successfully\x20from\x20version\x20'+module['exports'][_0x0ab0('0x3')]+'\x20to\x20'+_[_0x0ab0('0x30')](_0x989e82),'migrations':_[_0x0ab0('0x22')](_0x989e82)});})[_0x0ab0('0x1f')](function(_0xb7b26b){if(_0xb7b26b instanceof db[_0x0ab0('0x2a')][_0x0ab0('0x31')]){return _0x4764fc[_0x0ab0('0xf')](0xc8)['json']({'output':'Database\x20already\x20up-to-date'});}else{return _0x4764fc['status'](0x1f4)[_0x0ab0('0x10')](_0xb7b26b);}});}else{return _0x4764fc[_0x0ab0('0xf')](0xc8)[_0x0ab0('0x10')]({'output':'Database\x20already\x20up-to-date'});}}; \ No newline at end of file +var _0xd052=['motion2','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','join','length','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.','server','map','.js','then','\x20to\x20','Database\x20already\x20up-to-date','lodash','version','exec','../../config/environment','../../config/pm2','update','simple-git','root','index','exports','query','latest','status','json','fetch','error','reset','--hard','info','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart'];(function(_0x1e7b16,_0x4607a1){var _0x37fadc=function(_0x1fc9ce){while(--_0x1fc9ce){_0x1e7b16['push'](_0x1e7b16['shift']());}};_0x37fadc(++_0x4607a1);}(_0xd052,0x69));var _0x2d05=function(_0x4a7529,_0xba0830){_0x4a7529=_0x4a7529-0x0;var _0x254252=_0xd052[_0x4a7529];return _0x254252;};'use strict';var Umzug=require('umzug');var path=require('path');var fs=require('fs');var _=require(_0x2d05('0x0'));var pkginfo=require('pkginfo')(module,_0x2d05('0x1'));var compareVersions=require('compare-versions');var exec=require('child_process')[_0x2d05('0x2')];var db=require('../../mysqldb')['db'];var config=require(_0x2d05('0x3'));var pm2=require(_0x2d05('0x4'));var logger=require('../../config/logger')(_0x2d05('0x5'));var git=require(_0x2d05('0x6'))(config[_0x2d05('0x7')]);exports[_0x2d05('0x8')]=function(_0x2fd6ab,_0x39fa70){var _0x2a8a1c={'current':module[_0x2d05('0x9')][_0x2d05('0x1')],'phonebar':0x2};if(_0x2fd6ab[_0x2d05('0xa')]&&_0x2fd6ab[_0x2d05('0xa')]['latest']){return git['fetch']()['tags'](function(_0x5dac3d,_0x2d86fd){_0x2a8a1c[_0x2d05('0xb')]=(_0x5dac3d?module[_0x2d05('0x9')]['version']:_0x2d86fd[_0x2d05('0xb')])||'2.0.0';return _0x39fa70[_0x2d05('0xc')](0xc8)[_0x2d05('0xd')](_0x2a8a1c);});}else{return _0x39fa70[_0x2d05('0xc')](0xc8)['json'](_0x2a8a1c);}};exports[_0x2d05('0xe')]=function(_0x3a7f69,_0x1e096a){return git['fetch'](['origin','master'],function(_0x10ab35){if(_0x10ab35){logger[_0x2d05('0xf')](_0x10ab35);return _0x1e096a['status'](0x1f4)[_0x2d05('0xd')](_0x10ab35);}logger['info']('git\x20fetch');return _0x1e096a[_0x2d05('0xc')](0xc8)[_0x2d05('0xd')]({'output':'git\x20fetch\x20origin\x20master'});});};exports[_0x2d05('0x10')]=function(_0x3f9b30,_0xf73a87){return git[_0x2d05('0x10')]([_0x2d05('0x11'),'FETCH_HEAD'],function(_0x2564c7){if(_0x2564c7){logger[_0x2d05('0xf')](_0x2564c7);return _0xf73a87[_0x2d05('0xc')](0x1f4)['json'](_0x2564c7);}logger[_0x2d05('0x12')](_0x2d05('0x13'));return _0xf73a87[_0x2d05('0xc')](0xc8)[_0x2d05('0xd')]({'output':_0x2d05('0x14')});});};exports[_0x2d05('0x15')]=function(_0x3bc562,_0x22c818){exec(_0x2d05('0x16'),function(_0x138912,_0x4a9e7c,_0x244358){logger[_0x2d05('0x12')](_0x4a9e7c);logger[_0x2d05('0x12')](_0x244358);if(_0x138912){logger[_0x2d05('0xf')](_0x138912);return _0x22c818[_0x2d05('0xc')](0x1f4)[_0x2d05('0xd')](_0x138912);}return _0x22c818[_0x2d05('0xc')](0xc8)[_0x2d05('0xd')]({'output':_0x4a9e7c});});};exports[_0x2d05('0x17')]=function(_0x59864f,_0x46b618){return pm2[_0x2d05('0x17')](_0x2d05('0x18'))['then'](function(_0x5bfcac){logger['info'](_0x2d05('0x19'),_0x5bfcac);return _0x46b618[_0x2d05('0xc')](0xc8)[_0x2d05('0xd')]({'output':_0x2d05('0x1a')});})[_0x2d05('0x1b')](function(_0x51a90e){logger[_0x2d05('0xf')](_0x51a90e);return _0x46b618['status'](0x1f4)[_0x2d05('0xd')](_0x51a90e);});};exports[_0x2d05('0x1c')]=function(_0x2a30be,_0xc9bd97){var _0x12869d=fs[_0x2d05('0x1d')](path[_0x2d05('0x1e')](config[_0x2d05('0x7')],'server',_0x2d05('0x1c')));var _0x434104=[];for(var _0x247443=0x0;_0x247443<_0x12869d[_0x2d05('0x1f')];_0x247443++){var _0x4fb746=_0x12869d[_0x247443]['replace']('.js','');if(compareVersions(module['exports'][_0x2d05('0x1')],_0x4fb746)===-0x1){_0x434104['push'](_0x4fb746);}}if(_0x434104[_0x2d05('0x1f')]){var _0x224058=_0x434104['sort'](compareVersions);var _0x4eeb9e=new Umzug({'storage':_0x2d05('0x20'),'storageOptions':{'model':db[_0x2d05('0x21')],'modelName':'Migration','columnName':_0x2d05('0x1')},'migrations':{'params':[db[_0x2d05('0x20')][_0x2d05('0x22')](),db[_0x2d05('0x20')][_0x2d05('0x23')],function(){throw new Error(_0x2d05('0x24'));}],'path':path[_0x2d05('0x1e')](config[_0x2d05('0x7')],_0x2d05('0x25'),_0x2d05('0x1c')),'pattern':/\.js$/}});_0x4eeb9e['up']({'migrations':_[_0x2d05('0x26')](_0x224058,function(_0x27a025){return _0x27a025+_0x2d05('0x27');})})[_0x2d05('0x28')](function(){return _0xc9bd97[_0x2d05('0xc')](0xc8)['json']({'output':'Database\x20migrated\x20successfully\x20from\x20version\x20'+module[_0x2d05('0x9')][_0x2d05('0x1')]+_0x2d05('0x29')+_['last'](_0x224058),'migrations':_['join'](_0x224058)});})[_0x2d05('0x1b')](function(_0x395ee9){if(_0x395ee9 instanceof db[_0x2d05('0x20')]['UniqueConstraintError']){return _0xc9bd97[_0x2d05('0xc')](0xc8)[_0x2d05('0xd')]({'output':_0x2d05('0x2a')});}else{return _0xc9bd97['status'](0x1f4)['json'](_0x395ee9);}});}else{return _0xc9bd97['status'](0xc8)['json']({'output':_0x2d05('0x2a')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 4745f43..5e0c73c 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 _0x989c=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','/describe','describe','/:id','show','create','put','update','delete','destroy','exports','util','path','connect-timeout'];(function(_0x5c0d48,_0x50e024){var _0x367686=function(_0x134396){while(--_0x134396){_0x5c0d48['push'](_0x5c0d48['shift']());}};_0x367686(++_0x50e024);}(_0x989c,0x1e0));var _0xc989=function(_0x26c34b,_0x41e950){_0x26c34b=_0x26c34b-0x0;var _0x267153=_0x989c[_0x26c34b];return _0x267153;};'use strict';var multer=require('multer');var util=require(_0xc989('0x0'));var path=require(_0xc989('0x1'));var timeout=require(_0xc989('0x2'));var express=require(_0xc989('0x3'));var router=express[_0xc989('0x4')]();var auth=require(_0xc989('0x5'));var interaction=require(_0xc989('0x6'));var config=require(_0xc989('0x7'));var controller=require(_0xc989('0x8'));router[_0xc989('0x9')]('/',auth[_0xc989('0xa')](),controller['index']);router[_0xc989('0x9')](_0xc989('0xb'),auth[_0xc989('0xa')](),controller[_0xc989('0xc')]);router['get'](_0xc989('0xd'),auth[_0xc989('0xa')](),controller[_0xc989('0xe')]);router['post']('/',auth[_0xc989('0xa')](),controller[_0xc989('0xf')]);router[_0xc989('0x10')](_0xc989('0xd'),auth[_0xc989('0xa')](),controller[_0xc989('0x11')]);router[_0xc989('0x12')](_0xc989('0xd'),auth[_0xc989('0xa')](),controller[_0xc989('0x13')]);module[_0xc989('0x14')]=router; \ No newline at end of file +var _0xece2=['delete','multer','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','describe','/:id','create','put'];(function(_0x4c3ece,_0x57053e){var _0x409c1d=function(_0x411a3b){while(--_0x411a3b){_0x4c3ece['push'](_0x4c3ece['shift']());}};_0x409c1d(++_0x57053e);}(_0xece2,0x15f));var _0x2ece=function(_0x44bf21,_0x57dd89){_0x44bf21=_0x44bf21-0x0;var _0x4f2a6=_0xece2[_0x44bf21];return _0x4f2a6;};'use strict';var multer=require(_0x2ece('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x2ece('0x1'));var express=require(_0x2ece('0x2'));var router=express[_0x2ece('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x2ece('0x4'));var config=require(_0x2ece('0x5'));var controller=require(_0x2ece('0x6'));router[_0x2ece('0x7')]('/',auth[_0x2ece('0x8')](),controller['index']);router[_0x2ece('0x7')]('/describe',auth['isAuthenticated'](),controller[_0x2ece('0x9')]);router[_0x2ece('0x7')](_0x2ece('0xa'),auth[_0x2ece('0x8')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x2ece('0xb')]);router[_0x2ece('0xc')]('/:id',auth[_0x2ece('0x8')](),controller['update']);router[_0x2ece('0xd')](_0x2ece('0xa'),auth['isAuthenticated'](),controller['destroy']);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 30267a3..512fffe 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 _0xb138=['FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE','BOOLEAN','INTEGER'];(function(_0x305f92,_0x14744d){var _0x570ff0=function(_0xff705b){while(--_0xff705b){_0x305f92['push'](_0x305f92['shift']());}};_0x570ff0(++_0x14744d);}(_0xb138,0x1dd));var _0x8b13=function(_0x28c043,_0x2df5fc){_0x28c043=_0x28c043-0x0;var _0x50aff0=_0xb138[_0x28c043];return _0x50aff0;};'use strict';var Sequelize=require(_0x8b13('0x0'));module[_0x8b13('0x1')]={'type':{'type':Sequelize[_0x8b13('0x2')]},'uniqueid':{'type':Sequelize[_0x8b13('0x2')]},'calleridnum':{'type':Sequelize[_0x8b13('0x2')]},'calleridname':{'type':Sequelize[_0x8b13('0x2')]},'queue':{'type':Sequelize[_0x8b13('0x2')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x8b13('0x2')]},'agentcalledAt':{'type':Sequelize[_0x8b13('0x3')]},'agentconnectAt':{'type':Sequelize[_0x8b13('0x3')]},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize[_0x8b13('0x3')]},'agentdumpAt':{'type':Sequelize[_0x8b13('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x8b13('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x8b13('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x8b13('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0x8b13('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x8b13('0x5')]},'reason':{'type':Sequelize['STRING']},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x8b13('0x2')]},'channelstate':{'type':Sequelize[_0x8b13('0x5')]},'channelstatedesc':{'type':Sequelize[_0x8b13('0x2')]},'connectedlinenum':{'type':Sequelize[_0x8b13('0x2')]},'connectedlinename':{'type':Sequelize[_0x8b13('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x8b13('0x2')]},'context':{'type':Sequelize[_0x8b13('0x2')]},'exten':{'type':Sequelize[_0x8b13('0x2')]},'priority':{'type':Sequelize[_0x8b13('0x2')]},'destchannel':{'type':Sequelize[_0x8b13('0x2')]},'destchannelstate':{'type':Sequelize[_0x8b13('0x5')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0x8b13('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x8b13('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x8b13('0x2')]},'destexten':{'type':Sequelize[_0x8b13('0x2')]},'destpriority':{'type':Sequelize[_0x8b13('0x2')]},'destuniqueid':{'type':Sequelize[_0x8b13('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x8b13('0x2')]},'answeredelsewheremembername':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0x8b13('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x8b13('0x2')],'comment':_0x8b13('0x6')},'transferexten':{'type':Sequelize[_0x8b13('0x2')]},'transferuniqueid':{'type':Sequelize[_0x8b13('0x2')]},'agententerreason':{'type':Sequelize[_0x8b13('0x5')],'defaultValue':0x0}}; \ No newline at end of file +var _0x8ef6=['INTEGER','BOOLEAN','sequelize','exports','STRING','DATE'];(function(_0x4429e0,_0xee6f1f){var _0x51a5b3=function(_0x16eb11){while(--_0x16eb11){_0x4429e0['push'](_0x4429e0['shift']());}};_0x51a5b3(++_0xee6f1f);}(_0x8ef6,0xf2));var _0x68ef=function(_0x2558c3,_0x37d3df){_0x2558c3=_0x2558c3-0x0;var _0x3f1b68=_0x8ef6[_0x2558c3];return _0x3f1b68;};'use strict';var Sequelize=require(_0x68ef('0x0'));module[_0x68ef('0x1')]={'type':{'type':Sequelize[_0x68ef('0x2')]},'uniqueid':{'type':Sequelize[_0x68ef('0x2')]},'calleridnum':{'type':Sequelize[_0x68ef('0x2')]},'calleridname':{'type':Sequelize[_0x68ef('0x2')]},'queue':{'type':Sequelize[_0x68ef('0x2')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x68ef('0x2')]},'agentcalledAt':{'type':Sequelize[_0x68ef('0x3')]},'agentconnectAt':{'type':Sequelize[_0x68ef('0x3')]},'agentcompleteAt':{'type':Sequelize[_0x68ef('0x3')]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdumpAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0x68ef('0x4')]},'agentcomplete':{'type':Sequelize[_0x68ef('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x68ef('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize[_0x68ef('0x4')]},'agentacw':{'type':Sequelize[_0x68ef('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x68ef('0x4')]},'reason':{'type':Sequelize[_0x68ef('0x2')]},'lastevent':{'type':Sequelize[_0x68ef('0x2')]},'channel':{'type':Sequelize[_0x68ef('0x2')]},'channelstate':{'type':Sequelize[_0x68ef('0x4')]},'channelstatedesc':{'type':Sequelize[_0x68ef('0x2')]},'connectedlinenum':{'type':Sequelize[_0x68ef('0x2')]},'connectedlinename':{'type':Sequelize[_0x68ef('0x2')]},'language':{'type':Sequelize[_0x68ef('0x2')]},'accountcode':{'type':Sequelize[_0x68ef('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x68ef('0x2')]},'priority':{'type':Sequelize[_0x68ef('0x2')]},'destchannel':{'type':Sequelize[_0x68ef('0x2')]},'destchannelstate':{'type':Sequelize[_0x68ef('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0x68ef('0x2')]},'destcalleridnum':{'type':Sequelize[_0x68ef('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x68ef('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x68ef('0x2')]},'destlanguage':{'type':Sequelize[_0x68ef('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x68ef('0x2')]},'destexten':{'type':Sequelize[_0x68ef('0x2')]},'destpriority':{'type':Sequelize[_0x68ef('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x68ef('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0x68ef('0x2')]},'transfer':{'type':Sequelize[_0x68ef('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x68ef('0x2')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x68ef('0x2')]},'transferuniqueid':{'type':Sequelize['STRING']},'agententerreason':{'type':Sequelize['INTEGER'],'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 23313f7..06b964d 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 _0x15ad=['apply','save','update','destroy','then','error','stack','name','send','VoiceAgentReport','rawAttributes','fieldName','type','map','keys','query','filters','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','options','includeAll','rows','catch','params','include','create','body','find','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range'];(function(_0x133fc0,_0x1edda8){var _0x4ce619=function(_0x308be5){while(--_0x308be5){_0x133fc0['push'](_0x133fc0['shift']());}};_0x4ce619(++_0x1edda8);}(_0x15ad,0x6a));var _0xd15a=function(_0x2f699e,_0x2e0991){_0x2f699e=_0x2f699e-0x0;var _0x271482=_0x15ad[_0x2f699e];return _0x271482;};'use strict';var pdf=require(_0xd15a('0x0'));var emlformat=require(_0xd15a('0x1'));var rimraf=require(_0xd15a('0x2'));var zipdir=require(_0xd15a('0x3'));var jsonpatch=require(_0xd15a('0x4'));var rp=require(_0xd15a('0x5'));var moment=require(_0xd15a('0x6'));var BPromise=require(_0xd15a('0x7'));var Mustache=require(_0xd15a('0x8'));var util=require('util');var path=require(_0xd15a('0x9'));var sox=require('sox');var csv=require(_0xd15a('0xa'));var ejs=require(_0xd15a('0xb'));var fs=require('fs');var _=require(_0xd15a('0xc'));var squel=require('squel');var crypto=require(_0xd15a('0xd'));var jsforce=require(_0xd15a('0xe'));var deskjs=require(_0xd15a('0xf'));var toCsv=require(_0xd15a('0xa'));var querystring=require('querystring');var Papa=require(_0xd15a('0x10'));var Redis=require(_0xd15a('0x11'));var authService=require(_0xd15a('0x12'));var qs=require(_0xd15a('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd15a('0x14'));var utils=require(_0xd15a('0x15'));var config=require(_0xd15a('0x16'));var db=require(_0xd15a('0x17'))['db'];function respondWithStatusCode(_0x926560,_0x11368e){_0x11368e=_0x11368e||0xcc;return function(_0x11e46f){if(_0x11e46f){return _0x926560[_0xd15a('0x18')](_0x11368e);}return _0x926560[_0xd15a('0x19')](_0x11368e)[_0xd15a('0x1a')]();};}function respondWithResult(_0x163857,_0x27b5f7){_0x27b5f7=_0x27b5f7||0xc8;return function(_0x60217f){if(_0x60217f){return _0x163857[_0xd15a('0x19')](_0x27b5f7)[_0xd15a('0x1b')](_0x60217f);}};}function respondWithFilteredResult(_0xc13308,_0x83cc11){return function(_0xff8692){if(_0xff8692){var _0x5b7631=_0xff8692[_0xd15a('0x1c')],_0x1179b5=_0x83cc11['offset'],_0x5ef0e7=_0x83cc11[_0xd15a('0x1d')]+_0x83cc11[_0xd15a('0x1e')],_0x5f3740;if(_0x5ef0e7>=_0x5b7631){_0x5ef0e7=_0x5b7631;_0x5f3740=0xc8;}else{_0x5f3740=0xce;}_0xc13308['status'](_0x5f3740);return _0xc13308['set'](_0xd15a('0x1f'),_0x1179b5+'-'+_0x5ef0e7+'/'+_0x5b7631)[_0xd15a('0x1b')](_0xff8692);}return null;};}function patchUpdates(_0x350854){return function(_0x20aa96){try{jsonpatch[_0xd15a('0x20')](_0x20aa96,_0x350854,!![]);}catch(_0x4563ef){return BPromise['reject'](_0x4563ef);}return _0x20aa96[_0xd15a('0x21')]();};}function saveUpdates(_0x5e17d3,_0x232913){return function(_0x2df73e){if(_0x2df73e){return _0x2df73e[_0xd15a('0x22')](_0x5e17d3)['then'](function(_0x13fff7){return _0x13fff7;});}return null;};}function removeEntity(_0x25043d,_0x12bc02){return function(_0x479e86){if(_0x479e86){return _0x479e86[_0xd15a('0x23')]()[_0xd15a('0x24')](function(){_0x25043d[_0xd15a('0x19')](0xcc)[_0xd15a('0x1a')]();});}};}function handleEntityNotFound(_0x4ddf0b,_0x4e8307){return function(_0x362dc8){if(!_0x362dc8){_0x4ddf0b[_0xd15a('0x18')](0x194);}return _0x362dc8;};}function handleError(_0x1fa2e7,_0x206ad0){_0x206ad0=_0x206ad0||0x1f4;return function(_0x387ab5){logger[_0xd15a('0x25')](_0x387ab5[_0xd15a('0x26')]);if(_0x387ab5['name']){delete _0x387ab5[_0xd15a('0x27')];}_0x1fa2e7[_0xd15a('0x19')](_0x206ad0)[_0xd15a('0x28')](_0x387ab5);};}exports['index']=function(_0x588d5f,_0x37cc30){var _0x33bda1={},_0x1ddbb0={},_0x43c544={'count':0x0,'rows':[]};var _0x76022e=_['map'](db[_0xd15a('0x29')][_0xd15a('0x2a')],function(_0x5a19fd){return{'name':_0x5a19fd[_0xd15a('0x2b')],'type':_0x5a19fd[_0xd15a('0x2c')]['key']};});_0x1ddbb0['model']=_[_0xd15a('0x2d')](_0x76022e,_0xd15a('0x27'));_0x1ddbb0['query']=_[_0xd15a('0x2e')](_0x588d5f[_0xd15a('0x2f')]);_0x1ddbb0[_0xd15a('0x30')]=_['intersection'](_0x1ddbb0[_0xd15a('0x31')],_0x1ddbb0['query']);_0x33bda1[_0xd15a('0x32')]=_['intersection'](_0x1ddbb0[_0xd15a('0x31')],qs[_0xd15a('0x33')](_0x588d5f[_0xd15a('0x2f')][_0xd15a('0x33')]));_0x33bda1[_0xd15a('0x32')]=_0x33bda1[_0xd15a('0x32')][_0xd15a('0x34')]?_0x33bda1[_0xd15a('0x32')]:_0x1ddbb0['model'];if(!_0x588d5f[_0xd15a('0x2f')][_0xd15a('0x35')](_0xd15a('0x36'))){_0x33bda1[_0xd15a('0x1e')]=qs[_0xd15a('0x1e')](_0x588d5f[_0xd15a('0x2f')][_0xd15a('0x1e')]);_0x33bda1[_0xd15a('0x1d')]=qs[_0xd15a('0x1d')](_0x588d5f[_0xd15a('0x2f')]['offset']);}_0x33bda1['order']=qs['sort'](_0x588d5f[_0xd15a('0x2f')][_0xd15a('0x37')]);_0x33bda1[_0xd15a('0x38')]=qs[_0xd15a('0x30')](_['pick'](_0x588d5f[_0xd15a('0x2f')],_0x1ddbb0['filters']),_0x76022e);if(_0x588d5f[_0xd15a('0x2f')][_0xd15a('0x39')]){_0x33bda1[_0xd15a('0x38')]=_['merge'](_0x33bda1[_0xd15a('0x38')],{'$or':_['map'](_0x76022e,function(_0x55d211){if(_0x55d211[_0xd15a('0x2c')]!=='VIRTUAL'){var _0x293b54={};_0x293b54[_0x55d211[_0xd15a('0x27')]]={'$like':'%'+_0x588d5f[_0xd15a('0x2f')][_0xd15a('0x39')]+'%'};return _0x293b54;}})});}_0x33bda1=_[_0xd15a('0x3a')]({},_0x33bda1,_0x588d5f[_0xd15a('0x3b')]);var _0x57a92c={'where':_0x33bda1['where']};return db[_0xd15a('0x29')][_0xd15a('0x1c')](_0x57a92c)['then'](function(_0x1b21d1){_0x43c544[_0xd15a('0x1c')]=_0x1b21d1;if(_0x588d5f[_0xd15a('0x2f')][_0xd15a('0x3c')]){_0x33bda1['include']=[{'all':!![]}];}return db['VoiceAgentReport']['findAll'](_0x33bda1);})['then'](function(_0x2e2419){_0x43c544[_0xd15a('0x3d')]=_0x2e2419;return _0x43c544;})[_0xd15a('0x24')](respondWithFilteredResult(_0x37cc30,_0x33bda1))[_0xd15a('0x3e')](handleError(_0x37cc30,null));};exports['show']=function(_0x5c38e4,_0x479468){var _0x484166={'raw':![],'where':{'id':_0x5c38e4[_0xd15a('0x3f')]['id']}},_0x243adc={};_0x243adc['model']=_[_0xd15a('0x2e')](db['VoiceAgentReport'][_0xd15a('0x2a')]);_0x243adc[_0xd15a('0x2f')]=_[_0xd15a('0x2e')](_0x5c38e4[_0xd15a('0x2f')]);_0x243adc['filters']=_['intersection'](_0x243adc[_0xd15a('0x31')],_0x243adc[_0xd15a('0x2f')]);_0x484166['attributes']=_['intersection'](_0x243adc['model'],qs[_0xd15a('0x33')](_0x5c38e4[_0xd15a('0x2f')][_0xd15a('0x33')]));_0x484166['attributes']=_0x484166['attributes']['length']?_0x484166[_0xd15a('0x32')]:_0x243adc['model'];if(_0x5c38e4['query']['includeAll']){_0x484166[_0xd15a('0x40')]=[{'all':!![]}];}_0x484166=_[_0xd15a('0x3a')]({},_0x484166,_0x5c38e4[_0xd15a('0x3b')]);return db[_0xd15a('0x29')]['find'](_0x484166)[_0xd15a('0x24')](handleEntityNotFound(_0x479468,null))[_0xd15a('0x24')](respondWithResult(_0x479468,null))[_0xd15a('0x3e')](handleError(_0x479468,null));};exports[_0xd15a('0x41')]=function(_0x5b2ac9,_0x19748a){return db[_0xd15a('0x29')][_0xd15a('0x41')](_0x5b2ac9[_0xd15a('0x42')],{})[_0xd15a('0x24')](respondWithResult(_0x19748a,0xc9))[_0xd15a('0x3e')](handleError(_0x19748a,null));};exports[_0xd15a('0x22')]=function(_0x8b4a98,_0x53bca8){if(_0x8b4a98[_0xd15a('0x42')]['id']){delete _0x8b4a98[_0xd15a('0x42')]['id'];}return db[_0xd15a('0x29')][_0xd15a('0x43')]({'where':{'id':_0x8b4a98[_0xd15a('0x3f')]['id']}})[_0xd15a('0x24')](handleEntityNotFound(_0x53bca8,null))[_0xd15a('0x24')](saveUpdates(_0x8b4a98[_0xd15a('0x42')],null))['then'](respondWithResult(_0x53bca8,null))[_0xd15a('0x3e')](handleError(_0x53bca8,null));};exports[_0xd15a('0x23')]=function(_0x781817,_0x21ef07){return db[_0xd15a('0x29')][_0xd15a('0x43')]({'where':{'id':_0x781817[_0xd15a('0x3f')]['id']}})[_0xd15a('0x24')](handleEntityNotFound(_0x21ef07,null))['then'](removeEntity(_0x21ef07,null))[_0xd15a('0x3e')](handleError(_0x21ef07,null));};exports[_0xd15a('0x44')]=function(_0x56e9ec,_0x38375a){return db[_0xd15a('0x29')][_0xd15a('0x44')]()[_0xd15a('0x24')](respondWithResult(_0x38375a,null))['catch'](handleError(_0x38375a,null));}; \ No newline at end of file +var _0x7a0f=['sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','end','status','json','count','offset','set','Content-Range','reject','save','update','then','destroy','sendStatus','error','name','send','map','VoiceAgentReport','fieldName','type','model','query','filters','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','pick','filter','merge','VIRTUAL','options','where','include','findAll','rows','show','keys','intersection','includeAll','find','catch','create','body','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path'];(function(_0x2b44ed,_0x17012c){var _0x247bac=function(_0xef1627){while(--_0xef1627){_0x2b44ed['push'](_0x2b44ed['shift']());}};_0x247bac(++_0x17012c);}(_0x7a0f,0x1b2));var _0xf7a0=function(_0x565c29,_0x5aa28d){_0x565c29=_0x565c29-0x0;var _0x4df924=_0x7a0f[_0x565c29];return _0x4df924;};'use strict';var pdf=require(_0xf7a0('0x0'));var emlformat=require(_0xf7a0('0x1'));var rimraf=require(_0xf7a0('0x2'));var zipdir=require(_0xf7a0('0x3'));var jsonpatch=require(_0xf7a0('0x4'));var rp=require(_0xf7a0('0x5'));var moment=require(_0xf7a0('0x6'));var BPromise=require(_0xf7a0('0x7'));var Mustache=require('mustache');var util=require(_0xf7a0('0x8'));var path=require(_0xf7a0('0x9'));var sox=require(_0xf7a0('0xa'));var csv=require(_0xf7a0('0xb'));var ejs=require(_0xf7a0('0xc'));var fs=require('fs');var _=require(_0xf7a0('0xd'));var squel=require(_0xf7a0('0xe'));var crypto=require(_0xf7a0('0xf'));var jsforce=require(_0xf7a0('0x10'));var deskjs=require(_0xf7a0('0x11'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xf7a0('0x12'));var qs=require(_0xf7a0('0x13'));var as=require(_0xf7a0('0x14'));var hardwareService=require(_0xf7a0('0x15'));var logger=require(_0xf7a0('0x16'))(_0xf7a0('0x17'));var utils=require('../../config/utils');var config=require(_0xf7a0('0x18'));var db=require(_0xf7a0('0x19'))['db'];function respondWithStatusCode(_0x3e4c82,_0x276178){_0x276178=_0x276178||0xcc;return function(_0x5d3478){if(_0x5d3478){return _0x3e4c82['sendStatus'](_0x276178);}return _0x3e4c82['status'](_0x276178)[_0xf7a0('0x1a')]();};}function respondWithResult(_0x3f85b7,_0x13c26f){_0x13c26f=_0x13c26f||0xc8;return function(_0x1f6f15){if(_0x1f6f15){return _0x3f85b7[_0xf7a0('0x1b')](_0x13c26f)[_0xf7a0('0x1c')](_0x1f6f15);}};}function respondWithFilteredResult(_0xda14f1,_0x5d0ee){return function(_0x7ed6b4){if(_0x7ed6b4){var _0x321e62=_0x7ed6b4[_0xf7a0('0x1d')],_0x30fb4e=_0x5d0ee[_0xf7a0('0x1e')],_0x5dda9d=_0x5d0ee['offset']+_0x5d0ee['limit'],_0xa36271;if(_0x5dda9d>=_0x321e62){_0x5dda9d=_0x321e62;_0xa36271=0xc8;}else{_0xa36271=0xce;}_0xda14f1[_0xf7a0('0x1b')](_0xa36271);return _0xda14f1[_0xf7a0('0x1f')](_0xf7a0('0x20'),_0x30fb4e+'-'+_0x5dda9d+'/'+_0x321e62)['json'](_0x7ed6b4);}return null;};}function patchUpdates(_0x5f303e){return function(_0x55bd27){try{jsonpatch['apply'](_0x55bd27,_0x5f303e,!![]);}catch(_0x237808){return BPromise[_0xf7a0('0x21')](_0x237808);}return _0x55bd27[_0xf7a0('0x22')]();};}function saveUpdates(_0x1be1db,_0x1cb8a0){return function(_0x33295e){if(_0x33295e){return _0x33295e[_0xf7a0('0x23')](_0x1be1db)[_0xf7a0('0x24')](function(_0x5b6b11){return _0x5b6b11;});}return null;};}function removeEntity(_0x3596e7,_0x4cd105){return function(_0x3107a7){if(_0x3107a7){return _0x3107a7[_0xf7a0('0x25')]()['then'](function(){_0x3596e7[_0xf7a0('0x1b')](0xcc)[_0xf7a0('0x1a')]();});}};}function handleEntityNotFound(_0x7c23ef,_0x54a5a7){return function(_0xd9e449){if(!_0xd9e449){_0x7c23ef[_0xf7a0('0x26')](0x194);}return _0xd9e449;};}function handleError(_0x3bee2c,_0xc73ff7){_0xc73ff7=_0xc73ff7||0x1f4;return function(_0x5adcdd){logger[_0xf7a0('0x27')](_0x5adcdd['stack']);if(_0x5adcdd[_0xf7a0('0x28')]){delete _0x5adcdd[_0xf7a0('0x28')];}_0x3bee2c[_0xf7a0('0x1b')](_0xc73ff7)[_0xf7a0('0x29')](_0x5adcdd);};}exports['index']=function(_0x41c7fa,_0x47dac4){var _0x4941ea={},_0x291c73={},_0x18147d={'count':0x0,'rows':[]};var _0x5be726=_[_0xf7a0('0x2a')](db[_0xf7a0('0x2b')]['rawAttributes'],function(_0x236eed){return{'name':_0x236eed[_0xf7a0('0x2c')],'type':_0x236eed[_0xf7a0('0x2d')]['key']};});_0x291c73[_0xf7a0('0x2e')]=_[_0xf7a0('0x2a')](_0x5be726,'name');_0x291c73[_0xf7a0('0x2f')]=_['keys'](_0x41c7fa[_0xf7a0('0x2f')]);_0x291c73[_0xf7a0('0x30')]=_['intersection'](_0x291c73[_0xf7a0('0x2e')],_0x291c73[_0xf7a0('0x2f')]);_0x4941ea['attributes']=_['intersection'](_0x291c73['model'],qs[_0xf7a0('0x31')](_0x41c7fa['query']['fields']));_0x4941ea[_0xf7a0('0x32')]=_0x4941ea[_0xf7a0('0x32')][_0xf7a0('0x33')]?_0x4941ea[_0xf7a0('0x32')]:_0x291c73[_0xf7a0('0x2e')];if(!_0x41c7fa[_0xf7a0('0x2f')][_0xf7a0('0x34')](_0xf7a0('0x35'))){_0x4941ea[_0xf7a0('0x36')]=qs['limit'](_0x41c7fa[_0xf7a0('0x2f')][_0xf7a0('0x36')]);_0x4941ea[_0xf7a0('0x1e')]=qs[_0xf7a0('0x1e')](_0x41c7fa[_0xf7a0('0x2f')][_0xf7a0('0x1e')]);}_0x4941ea['order']=qs[_0xf7a0('0x37')](_0x41c7fa[_0xf7a0('0x2f')][_0xf7a0('0x37')]);_0x4941ea['where']=qs[_0xf7a0('0x30')](_[_0xf7a0('0x38')](_0x41c7fa[_0xf7a0('0x2f')],_0x291c73[_0xf7a0('0x30')]),_0x5be726);if(_0x41c7fa['query'][_0xf7a0('0x39')]){_0x4941ea['where']=_[_0xf7a0('0x3a')](_0x4941ea['where'],{'$or':_[_0xf7a0('0x2a')](_0x5be726,function(_0x595759){if(_0x595759[_0xf7a0('0x2d')]!==_0xf7a0('0x3b')){var _0xb6aa={};_0xb6aa[_0x595759[_0xf7a0('0x28')]]={'$like':'%'+_0x41c7fa[_0xf7a0('0x2f')][_0xf7a0('0x39')]+'%'};return _0xb6aa;}})});}_0x4941ea=_[_0xf7a0('0x3a')]({},_0x4941ea,_0x41c7fa[_0xf7a0('0x3c')]);var _0x3f6f3c={'where':_0x4941ea[_0xf7a0('0x3d')]};return db[_0xf7a0('0x2b')]['count'](_0x3f6f3c)['then'](function(_0x294eac){_0x18147d[_0xf7a0('0x1d')]=_0x294eac;if(_0x41c7fa[_0xf7a0('0x2f')]['includeAll']){_0x4941ea[_0xf7a0('0x3e')]=[{'all':!![]}];}return db[_0xf7a0('0x2b')][_0xf7a0('0x3f')](_0x4941ea);})[_0xf7a0('0x24')](function(_0x289f69){_0x18147d[_0xf7a0('0x40')]=_0x289f69;return _0x18147d;})['then'](respondWithFilteredResult(_0x47dac4,_0x4941ea))['catch'](handleError(_0x47dac4,null));};exports[_0xf7a0('0x41')]=function(_0x145bcf,_0x2f1dfe){var _0x28e537={'raw':![],'where':{'id':_0x145bcf['params']['id']}},_0x19d103={};_0x19d103[_0xf7a0('0x2e')]=_[_0xf7a0('0x42')](db[_0xf7a0('0x2b')]['rawAttributes']);_0x19d103[_0xf7a0('0x2f')]=_[_0xf7a0('0x42')](_0x145bcf[_0xf7a0('0x2f')]);_0x19d103[_0xf7a0('0x30')]=_['intersection'](_0x19d103[_0xf7a0('0x2e')],_0x19d103[_0xf7a0('0x2f')]);_0x28e537[_0xf7a0('0x32')]=_[_0xf7a0('0x43')](_0x19d103[_0xf7a0('0x2e')],qs['fields'](_0x145bcf[_0xf7a0('0x2f')][_0xf7a0('0x31')]));_0x28e537[_0xf7a0('0x32')]=_0x28e537[_0xf7a0('0x32')][_0xf7a0('0x33')]?_0x28e537['attributes']:_0x19d103[_0xf7a0('0x2e')];if(_0x145bcf[_0xf7a0('0x2f')][_0xf7a0('0x44')]){_0x28e537[_0xf7a0('0x3e')]=[{'all':!![]}];}_0x28e537=_[_0xf7a0('0x3a')]({},_0x28e537,_0x145bcf[_0xf7a0('0x3c')]);return db['VoiceAgentReport'][_0xf7a0('0x45')](_0x28e537)[_0xf7a0('0x24')](handleEntityNotFound(_0x2f1dfe,null))[_0xf7a0('0x24')](respondWithResult(_0x2f1dfe,null))[_0xf7a0('0x46')](handleError(_0x2f1dfe,null));};exports['create']=function(_0x1e5ada,_0x292de2){return db[_0xf7a0('0x2b')][_0xf7a0('0x47')](_0x1e5ada[_0xf7a0('0x48')],{})['then'](respondWithResult(_0x292de2,0xc9))['catch'](handleError(_0x292de2,null));};exports[_0xf7a0('0x23')]=function(_0x86dc97,_0x25f17d){if(_0x86dc97[_0xf7a0('0x48')]['id']){delete _0x86dc97[_0xf7a0('0x48')]['id'];}return db[_0xf7a0('0x2b')][_0xf7a0('0x45')]({'where':{'id':_0x86dc97['params']['id']}})[_0xf7a0('0x24')](handleEntityNotFound(_0x25f17d,null))['then'](saveUpdates(_0x86dc97[_0xf7a0('0x48')],null))['then'](respondWithResult(_0x25f17d,null))[_0xf7a0('0x46')](handleError(_0x25f17d,null));};exports[_0xf7a0('0x25')]=function(_0x2bcb01,_0x225ef1){return db[_0xf7a0('0x2b')]['find']({'where':{'id':_0x2bcb01[_0xf7a0('0x49')]['id']}})[_0xf7a0('0x24')](handleEntityNotFound(_0x225ef1,null))[_0xf7a0('0x24')](removeEntity(_0x225ef1,null))[_0xf7a0('0x46')](handleError(_0x225ef1,null));};exports['describe']=function(_0x26878a,_0x2235e1){return db[_0xf7a0('0x2b')]['describe']()[_0xf7a0('0x24')](respondWithResult(_0x2235e1,null))['catch'](handleError(_0x2235e1,null));}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.model.js b/server/api/voiceAgentReport/voiceAgentReport.model.js index 7e049d4..2ef31bb 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 _0x8ca9=['uniqueid','destuniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','exports','define','VoiceAgentReport','report_agent'];(function(_0x1559c8,_0x20a312){var _0x2646fe=function(_0x4d6f77){while(--_0x4d6f77){_0x1559c8['push'](_0x1559c8['shift']());}};_0x2646fe(++_0x20a312);}(_0x8ca9,0x9c));var _0x98ca=function(_0x1aa65d,_0xf9591d){_0x1aa65d=_0x1aa65d-0x0;var _0x3f6502=_0x8ca9[_0x1aa65d];return _0x3f6502;};'use strict';var _=require(_0x98ca('0x0'));var util=require(_0x98ca('0x1'));var logger=require(_0x98ca('0x2'))(_0x98ca('0x3'));var moment=require(_0x98ca('0x4'));var BPromise=require(_0x98ca('0x5'));var rp=require(_0x98ca('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x98ca('0x7'));var attributes=require('./voiceAgentReport.attributes');module[_0x98ca('0x8')]=function(_0x48415d,_0x219619){return _0x48415d[_0x98ca('0x9')](_0x98ca('0xa'),attributes,{'tableName':_0x98ca('0xb'),'paranoid':![],'indexes':[{'fields':[_0x98ca('0xc'),_0x98ca('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8623=['define','VoiceAgentReport','report_agent','uniqueid','destuniqueid','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x305766,_0x4ed775){var _0x1d6353=function(_0x414f3c){while(--_0x414f3c){_0x305766['push'](_0x305766['shift']());}};_0x1d6353(++_0x4ed775);}(_0x8623,0x1f3));var _0x3862=function(_0x59fce2,_0x562468){_0x59fce2=_0x59fce2-0x0;var _0x3783ba=_0x8623[_0x59fce2];return _0x3783ba;};'use strict';var _=require('lodash');var util=require(_0x3862('0x0'));var logger=require(_0x3862('0x1'))('api');var moment=require('moment');var BPromise=require(_0x3862('0x2'));var rp=require(_0x3862('0x3'));var fs=require('fs');var path=require(_0x3862('0x4'));var rimraf=require(_0x3862('0x5'));var config=require(_0x3862('0x6'));var attributes=require('./voiceAgentReport.attributes');module[_0x3862('0x7')]=function(_0x337ab3,_0x1964ff){return _0x337ab3[_0x3862('0x8')](_0x3862('0x9'),attributes,{'tableName':_0x3862('0xa'),'paranoid':![],'indexes':[{'fields':[_0x3862('0xb'),_0x3862('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index 0374e7a..4a522d1 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 _0xbf85=['request\x20sent','stringify','error','code','message','catch','CreateVoiceAgentReport','VoiceAgentReport','body','options','raw','UpdateVoiceAgentReport','where','attributes','limit','debug','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','VoiceAgentReport,\x20%s,\x20%s'];(function(_0x1c8bd3,_0x453096){var _0x30228d=function(_0x23d5d3){while(--_0x23d5d3){_0x1c8bd3['push'](_0x1c8bd3['shift']());}};_0x30228d(++_0x453096);}(_0xbf85,0xd0));var _0x5bf8=function(_0xedc747,_0x38cf97){_0xedc747=_0xedc747-0x0;var _0x530406=_0xbf85[_0xedc747];return _0x530406;};'use strict';var _=require(_0x5bf8('0x0'));var util=require(_0x5bf8('0x1'));var moment=require(_0x5bf8('0x2'));var BPromise=require(_0x5bf8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5bf8('0x4'));var db=require(_0x5bf8('0x5'))['db'];var utils=require(_0x5bf8('0x6'));var logger=require(_0x5bf8('0x7'))(_0x5bf8('0x8'));var config=require(_0x5bf8('0x9'));var jayson=require(_0x5bf8('0xa'));var client=jayson[_0x5bf8('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0xaa2e46,_0x3efb2b,_0x34fa7b){return new BPromise(function(_0x57bfc0,_0x3a19a9){return client[_0x5bf8('0xc')](_0xaa2e46,_0x34fa7b)[_0x5bf8('0xd')](function(_0x3b27f1){logger[_0x5bf8('0xe')](_0x5bf8('0xf'),_0x3efb2b,_0x5bf8('0x10'));logger['debug']('VoiceAgentReport,\x20%s,\x20%s,\x20%s',_0x3efb2b,_0x5bf8('0x10'),JSON[_0x5bf8('0x11')](_0x3b27f1));if(_0x3b27f1[_0x5bf8('0x12')]){if(_0x3b27f1[_0x5bf8('0x12')][_0x5bf8('0x13')]===0x1f4){logger[_0x5bf8('0x12')](_0x5bf8('0xf'),_0x3efb2b,_0x3b27f1[_0x5bf8('0x12')][_0x5bf8('0x14')]);return _0x3a19a9(_0x3b27f1[_0x5bf8('0x12')][_0x5bf8('0x14')]);}logger[_0x5bf8('0x12')](_0x5bf8('0xf'),_0x3efb2b,_0x3b27f1[_0x5bf8('0x12')]['message']);return _0x57bfc0(_0x3b27f1[_0x5bf8('0x12')][_0x5bf8('0x14')]);}else{logger[_0x5bf8('0xe')](_0x5bf8('0xf'),_0x3efb2b,_0x5bf8('0x10'));_0x57bfc0(_0x3b27f1['result']['message']);}})[_0x5bf8('0x15')](function(_0xb22732){logger[_0x5bf8('0x12')](_0x5bf8('0xf'),_0x3efb2b,_0xb22732);_0x3a19a9(_0xb22732);});});}exports[_0x5bf8('0x16')]=function(_0x3c6ef0){var _0x4bd7d3=this;return new Promise(function(_0x236589,_0x278b17){return db[_0x5bf8('0x17')]['create'](_0x3c6ef0[_0x5bf8('0x18')],{'raw':_0x3c6ef0[_0x5bf8('0x19')]?_0x3c6ef0[_0x5bf8('0x19')][_0x5bf8('0x1a')]===undefined?!![]:![]:!![]})[_0x5bf8('0xd')](function(_0x416778){logger[_0x5bf8('0xe')](_0x5bf8('0x16'),_0x3c6ef0);logger['debug']('CreateVoiceAgentReport',_0x3c6ef0,JSON[_0x5bf8('0x11')](_0x416778));_0x236589(_0x416778);})[_0x5bf8('0x15')](function(_0xb5af53){logger[_0x5bf8('0x12')](_0x5bf8('0x16'),_0xb5af53['message'],_0x3c6ef0);_0x278b17(_0x4bd7d3['error'](0x1f4,_0xb5af53[_0x5bf8('0x14')]));});});};exports[_0x5bf8('0x1b')]=function(_0x582f6e){var _0xb082e3=this;return new Promise(function(_0x117383,_0xb639b5){return db['VoiceAgentReport']['update'](_0x582f6e[_0x5bf8('0x18')],{'raw':_0x582f6e[_0x5bf8('0x19')]?_0x582f6e[_0x5bf8('0x19')][_0x5bf8('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x582f6e['options']?_0x582f6e['options'][_0x5bf8('0x1c')]||null:null,'attributes':_0x582f6e['options']?_0x582f6e[_0x5bf8('0x19')][_0x5bf8('0x1d')]||null:null,'limit':_0x582f6e[_0x5bf8('0x19')]?_0x582f6e[_0x5bf8('0x19')][_0x5bf8('0x1e')]||null:null})['then'](function(_0x10f205){logger[_0x5bf8('0xe')](_0x5bf8('0x1b'),_0x582f6e);logger[_0x5bf8('0x1f')]('UpdateVoiceAgentReport',_0x582f6e,JSON['stringify'](_0x10f205));_0x117383(_0x10f205);})['catch'](function(_0x86f676){logger[_0x5bf8('0x12')](_0x5bf8('0x1b'),_0x86f676['message'],_0x582f6e);_0xb639b5(_0xb082e3['error'](0x1f4,_0x86f676[_0x5bf8('0x14')]));});});}; \ No newline at end of file +var _0x6c14=['where','limit','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','VoiceAgentReport','create','options','raw','CreateVoiceAgentReport','UpdateVoiceAgentReport','body'];(function(_0x431d47,_0x297de3){var _0x4c5f4f=function(_0x20f655){while(--_0x20f655){_0x431d47['push'](_0x431d47['shift']());}};_0x4c5f4f(++_0x297de3);}(_0x6c14,0x1af));var _0x46c1=function(_0x455489,_0x4ee9b7){_0x455489=_0x455489-0x0;var _0x8f1e83=_0x6c14[_0x455489];return _0x8f1e83;};'use strict';var _=require('lodash');var util=require(_0x46c1('0x0'));var moment=require(_0x46c1('0x1'));var BPromise=require('bluebird');var rs=require(_0x46c1('0x2'));var fs=require('fs');var Redis=require(_0x46c1('0x3'));var db=require(_0x46c1('0x4'))['db'];var utils=require(_0x46c1('0x5'));var logger=require(_0x46c1('0x6'))(_0x46c1('0x7'));var config=require(_0x46c1('0x8'));var jayson=require(_0x46c1('0x9'));var client=jayson['client'][_0x46c1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1c273f,_0x1de1a9,_0x2eaccd){return new BPromise(function(_0x16444b,_0x5f2611){return client[_0x46c1('0xb')](_0x1c273f,_0x2eaccd)[_0x46c1('0xc')](function(_0x193bc9){logger[_0x46c1('0xd')](_0x46c1('0xe'),_0x1de1a9,_0x46c1('0xf'));logger[_0x46c1('0x10')](_0x46c1('0x11'),_0x1de1a9,_0x46c1('0xf'),JSON[_0x46c1('0x12')](_0x193bc9));if(_0x193bc9[_0x46c1('0x13')]){if(_0x193bc9[_0x46c1('0x13')][_0x46c1('0x14')]===0x1f4){logger[_0x46c1('0x13')](_0x46c1('0xe'),_0x1de1a9,_0x193bc9['error'][_0x46c1('0x15')]);return _0x5f2611(_0x193bc9[_0x46c1('0x13')]['message']);}logger[_0x46c1('0x13')](_0x46c1('0xe'),_0x1de1a9,_0x193bc9[_0x46c1('0x13')][_0x46c1('0x15')]);return _0x16444b(_0x193bc9[_0x46c1('0x13')]['message']);}else{logger[_0x46c1('0xd')](_0x46c1('0xe'),_0x1de1a9,_0x46c1('0xf'));_0x16444b(_0x193bc9[_0x46c1('0x16')][_0x46c1('0x15')]);}})[_0x46c1('0x17')](function(_0x289757){logger[_0x46c1('0x13')](_0x46c1('0xe'),_0x1de1a9,_0x289757);_0x5f2611(_0x289757);});});}exports['CreateVoiceAgentReport']=function(_0x34fc03){var _0x381915=this;return new Promise(function(_0xe062dc,_0x146027){return db[_0x46c1('0x18')][_0x46c1('0x19')](_0x34fc03['body'],{'raw':_0x34fc03[_0x46c1('0x1a')]?_0x34fc03[_0x46c1('0x1a')][_0x46c1('0x1b')]===undefined?!![]:![]:!![]})[_0x46c1('0xc')](function(_0x3a48bd){logger[_0x46c1('0xd')]('CreateVoiceAgentReport',_0x34fc03);logger['debug'](_0x46c1('0x1c'),_0x34fc03,JSON[_0x46c1('0x12')](_0x3a48bd));_0xe062dc(_0x3a48bd);})[_0x46c1('0x17')](function(_0x47b709){logger[_0x46c1('0x13')](_0x46c1('0x1c'),_0x47b709[_0x46c1('0x15')],_0x34fc03);_0x146027(_0x381915[_0x46c1('0x13')](0x1f4,_0x47b709[_0x46c1('0x15')]));});});};exports[_0x46c1('0x1d')]=function(_0x293a6c){var _0x38a67a=this;return new Promise(function(_0x374b60,_0x14e7ec){return db[_0x46c1('0x18')]['update'](_0x293a6c[_0x46c1('0x1e')],{'raw':_0x293a6c[_0x46c1('0x1a')]?_0x293a6c['options'][_0x46c1('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x293a6c[_0x46c1('0x1a')]?_0x293a6c[_0x46c1('0x1a')][_0x46c1('0x1f')]||null:null,'attributes':_0x293a6c[_0x46c1('0x1a')]?_0x293a6c['options']['attributes']||null:null,'limit':_0x293a6c[_0x46c1('0x1a')]?_0x293a6c[_0x46c1('0x1a')][_0x46c1('0x20')]||null:null})['then'](function(_0x3aed4f){logger[_0x46c1('0xd')](_0x46c1('0x1d'),_0x293a6c);logger['debug']('UpdateVoiceAgentReport',_0x293a6c,JSON[_0x46c1('0x12')](_0x3aed4f));_0x374b60(_0x3aed4f);})['catch'](function(_0x582c9c){logger[_0x46c1('0x13')](_0x46c1('0x1d'),_0x582c9c[_0x46c1('0x15')],_0x293a6c);_0x14e7ec(_0x38a67a[_0x46c1('0x13')](0x1f4,_0x582c9c[_0x46c1('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index f31b063..64bb84b 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 _0x3291=['show','create','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','index','/describe','isAuthenticated','describe','/:id'];(function(_0x2398d6,_0x2e04a9){var _0x32b942=function(_0x3669fc){while(--_0x3669fc){_0x2398d6['push'](_0x2398d6['shift']());}};_0x32b942(++_0x2e04a9);}(_0x3291,0xba));var _0x1329=function(_0x329769,_0x5c1035){_0x329769=_0x329769-0x0;var _0xbbc3aa=_0x3291[_0x329769];return _0xbbc3aa;};'use strict';var multer=require('multer');var util=require(_0x1329('0x0'));var path=require(_0x1329('0x1'));var timeout=require(_0x1329('0x2'));var express=require(_0x1329('0x3'));var router=express[_0x1329('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x1329('0x5'));var config=require(_0x1329('0x6'));var controller=require(_0x1329('0x7'));router[_0x1329('0x8')]('/',auth['isAuthenticated'](),controller[_0x1329('0x9')]);router[_0x1329('0x8')](_0x1329('0xa'),auth[_0x1329('0xb')](),controller[_0x1329('0xc')]);router[_0x1329('0x8')](_0x1329('0xd'),auth[_0x1329('0xb')](),controller[_0x1329('0xe')]);router['post']('/',auth[_0x1329('0xb')](),controller[_0x1329('0xf')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x1329('0x10')]);router[_0x1329('0x11')]('/:id',auth[_0x1329('0xb')](),controller[_0x1329('0x12')]);module[_0x1329('0x13')]=router; \ No newline at end of file +var _0x1744=['delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','isAuthenticated','index','/describe','describe','show','create','put','update'];(function(_0x500a3d,_0x4a7940){var _0x260b7c=function(_0x561ebd){while(--_0x561ebd){_0x500a3d['push'](_0x500a3d['shift']());}};_0x260b7c(++_0x4a7940);}(_0x1744,0x18b));var _0x4174=function(_0x4dccf2,_0x5cfcd7){_0x4dccf2=_0x4dccf2-0x0;var _0x12640e=_0x1744[_0x4dccf2];return _0x12640e;};'use strict';var multer=require(_0x4174('0x0'));var util=require(_0x4174('0x1'));var path=require(_0x4174('0x2'));var timeout=require(_0x4174('0x3'));var express=require(_0x4174('0x4'));var router=express[_0x4174('0x5')]();var auth=require(_0x4174('0x6'));var interaction=require(_0x4174('0x7'));var config=require(_0x4174('0x8'));var controller=require(_0x4174('0x9'));router[_0x4174('0xa')]('/',auth[_0x4174('0xb')](),controller[_0x4174('0xc')]);router[_0x4174('0xa')](_0x4174('0xd'),auth[_0x4174('0xb')](),controller[_0x4174('0xe')]);router[_0x4174('0xa')]('/:id',auth[_0x4174('0xb')](),controller[_0x4174('0xf')]);router['post']('/',auth[_0x4174('0xb')](),controller[_0x4174('0x10')]);router[_0x4174('0x11')]('/:id',auth[_0x4174('0xb')](),controller[_0x4174('0x12')]);router[_0x4174('0x13')](_0x4174('0x14'),auth[_0x4174('0xb')](),controller[_0x4174('0x15')]);module[_0x4174('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index b1f267f..a1e10ec 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 _0x9957=['ENUM','internal','outbound','inbound-fax','outbound-fax','DATE','INTEGER','sequelize','exports','STRING'];(function(_0x54ca9d,_0x358a79){var _0x58fb8d=function(_0x463f5c){while(--_0x463f5c){_0x54ca9d['push'](_0x54ca9d['shift']());}};_0x58fb8d(++_0x358a79);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')]},'type':{'type':Sequelize[_0x7995('0x3')]('inbound',_0x7995('0x4'),_0x7995('0x5'),_0x7995('0x6'),_0x7995('0x7'),'dialer')},'tag':{'type':Sequelize[_0x7995('0x2')]},'accountcode':{'type':Sequelize[_0x7995('0x2')]},'source':{'type':Sequelize[_0x7995('0x2')]},'destination':{'type':Sequelize[_0x7995('0x2')]},'destinationcontext':{'type':Sequelize[_0x7995('0x2')]},'callerid':{'type':Sequelize[_0x7995('0x2')]},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize[_0x7995('0x2')]},'lastapplication':{'type':Sequelize[_0x7995('0x2')]},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize[_0x7995('0x8')]},'systemanswertime':{'type':Sequelize[_0x7995('0x8')]},'answertime':{'type':Sequelize[_0x7995('0x8')]},'endtime':{'type':Sequelize[_0x7995('0x8')]},'duration':{'type':Sequelize[_0x7995('0x9')]},'billableseconds':{'type':Sequelize[_0x7995('0x9')]},'mohtime':{'type':Sequelize[_0x7995('0x9')],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x7995('0x2')]},'userfield':{'type':Sequelize[_0x7995('0x2')]},'userDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x7995('0x2')]},'prefix':{'type':Sequelize[_0x7995('0x2')]},'routeid':{'type':Sequelize[_0x7995('0x9')]},'sipcallid':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file +var _0xa9e0=['dialer','DATE','INTEGER','sequelize','exports','STRING','internal','inbound-fax','outbound-fax'];(function(_0x310215,_0x541b20){var _0x1e9d59=function(_0xa3b3f9){while(--_0xa3b3f9){_0x310215['push'](_0x310215['shift']());}};_0x1e9d59(++_0x541b20);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xa9e0[_0x37bd26];return _0xe83dc4;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'uniqueid':{'type':Sequelize[_0x0a9e('0x2')]},'type':{'type':Sequelize['ENUM']('inbound',_0x0a9e('0x3'),'outbound',_0x0a9e('0x4'),_0x0a9e('0x5'),_0x0a9e('0x6'))},'tag':{'type':Sequelize[_0x0a9e('0x2')]},'accountcode':{'type':Sequelize[_0x0a9e('0x2')]},'source':{'type':Sequelize['STRING']},'destination':{'type':Sequelize[_0x0a9e('0x2')]},'destinationcontext':{'type':Sequelize[_0x0a9e('0x2')]},'callerid':{'type':Sequelize[_0x0a9e('0x2')]},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize['STRING']},'lastapplication':{'type':Sequelize[_0x0a9e('0x2')]},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize['DATE']},'systemanswertime':{'type':Sequelize[_0x0a9e('0x7')]},'answertime':{'type':Sequelize[_0x0a9e('0x7')]},'endtime':{'type':Sequelize[_0x0a9e('0x7')]},'duration':{'type':Sequelize[_0x0a9e('0x8')]},'billableseconds':{'type':Sequelize[_0x0a9e('0x8')]},'mohtime':{'type':Sequelize[_0x0a9e('0x8')],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x0a9e('0x2')]},'prefix':{'type':Sequelize[_0x0a9e('0x2')]},'routeid':{'type':Sequelize[_0x0a9e('0x8')]},'sipcallid':{'type':Sequelize[_0x0a9e('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 55c5a83..cbe9626 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 _0x33d3=['update','then','destroy','end','name','send','index','map','VoiceCallReport','rawAttributes','fieldName','model','keys','filters','intersection','attributes','fields','query','length','order','sort','filter','where','merge','includeAll','include','fullname','alias','User','findAll','catch','show','params','options','find','create','body','describe','uniqueid','user','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save'];(function(_0x170f4c,_0x4a4c80){var _0x52eedd=function(_0x473905){while(--_0x473905){_0x170f4c['push'](_0x170f4c['shift']());}};_0x52eedd(++_0x4a4c80);}(_0x33d3,0x1e4));var _0x333d=function(_0xcfe8cc,_0xb83aeb){_0xcfe8cc=_0xcfe8cc-0x0;var _0x55ac53=_0x33d3[_0xcfe8cc];return _0x55ac53;};'use strict';var pdf=require(_0x333d('0x0'));var emlformat=require(_0x333d('0x1'));var rimraf=require(_0x333d('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x333d('0x3'));var rp=require('request-promise');var moment=require(_0x333d('0x4'));var BPromise=require(_0x333d('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x333d('0x6'));var sox=require(_0x333d('0x7'));var csv=require(_0x333d('0x8'));var ejs=require(_0x333d('0x9'));var fs=require('fs');var _=require(_0x333d('0xa'));var squel=require('squel');var crypto=require(_0x333d('0xb'));var jsforce=require(_0x333d('0xc'));var deskjs=require(_0x333d('0xd'));var toCsv=require(_0x333d('0x8'));var querystring=require(_0x333d('0xe'));var Papa=require('papaparse');var Redis=require(_0x333d('0xf'));var authService=require(_0x333d('0x10'));var qs=require(_0x333d('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x333d('0x12'));var logger=require(_0x333d('0x13'))('api');var utils=require(_0x333d('0x14'));var config=require(_0x333d('0x15'));var db=require(_0x333d('0x16'))['db'];function respondWithStatusCode(_0x2c018a,_0x6bf16c){_0x6bf16c=_0x6bf16c||0xcc;return function(_0x3a56f3){if(_0x3a56f3){return _0x2c018a[_0x333d('0x17')](_0x6bf16c);}return _0x2c018a[_0x333d('0x18')](_0x6bf16c)['end']();};}function respondWithResult(_0x1ccf9e,_0x4d4306){_0x4d4306=_0x4d4306||0xc8;return function(_0x1b4dc7){if(_0x1b4dc7){return _0x1ccf9e[_0x333d('0x18')](_0x4d4306)[_0x333d('0x19')](_0x1b4dc7);}};}function respondWithFilteredResult(_0x515ee6,_0x10ab7e){return function(_0x1600d3){if(_0x1600d3){var _0x49a028=_0x1600d3[_0x333d('0x1a')],_0xafdfa2=_0x10ab7e[_0x333d('0x1b')],_0x2fe14e=_0x10ab7e[_0x333d('0x1b')]+_0x10ab7e[_0x333d('0x1c')],_0x46958f;if(_0x2fe14e>=_0x49a028){_0x2fe14e=_0x49a028;_0x46958f=0xc8;}else{_0x46958f=0xce;}_0x515ee6[_0x333d('0x18')](_0x46958f);return _0x515ee6[_0x333d('0x1d')](_0x333d('0x1e'),_0xafdfa2+'-'+_0x2fe14e+'/'+_0x49a028)[_0x333d('0x19')](_0x1600d3);}return null;};}function patchUpdates(_0x13cff9){return function(_0x357e23){try{jsonpatch[_0x333d('0x1f')](_0x357e23,_0x13cff9,!![]);}catch(_0x553dfe){return BPromise[_0x333d('0x20')](_0x553dfe);}return _0x357e23[_0x333d('0x21')]();};}function saveUpdates(_0x98d15f,_0xa6b0c6){return function(_0x28566a){if(_0x28566a){return _0x28566a[_0x333d('0x22')](_0x98d15f)[_0x333d('0x23')](function(_0x46b372){return _0x46b372;});}return null;};}function removeEntity(_0x551c14,_0x360d16){return function(_0x15b96a){if(_0x15b96a){return _0x15b96a[_0x333d('0x24')]()[_0x333d('0x23')](function(){_0x551c14['status'](0xcc)[_0x333d('0x25')]();});}};}function handleEntityNotFound(_0x236201,_0x1b739d){return function(_0x2a174f){if(!_0x2a174f){_0x236201[_0x333d('0x17')](0x194);}return _0x2a174f;};}function handleError(_0x10c3f3,_0x31c6ca){_0x31c6ca=_0x31c6ca||0x1f4;return function(_0x5b38e5){logger['error'](_0x5b38e5['stack']);if(_0x5b38e5['name']){delete _0x5b38e5[_0x333d('0x26')];}_0x10c3f3[_0x333d('0x18')](_0x31c6ca)[_0x333d('0x27')](_0x5b38e5);};}exports[_0x333d('0x28')]=function(_0x12f020,_0x4c8e60){var _0x1de6e0={},_0x568f90={},_0x461296={'count':0x0,'rows':[]};var _0x49314e=_[_0x333d('0x29')](db[_0x333d('0x2a')][_0x333d('0x2b')],function(_0x59bbcb){return{'name':_0x59bbcb[_0x333d('0x2c')],'type':_0x59bbcb['type']['key']};});_0x568f90[_0x333d('0x2d')]=_['map'](_0x49314e,_0x333d('0x26'));_0x568f90['query']=_[_0x333d('0x2e')](_0x12f020['query']);_0x568f90[_0x333d('0x2f')]=_[_0x333d('0x30')](_0x568f90['model'],_0x568f90['query']);_0x1de6e0[_0x333d('0x31')]=_['intersection'](_0x568f90[_0x333d('0x2d')],qs[_0x333d('0x32')](_0x12f020[_0x333d('0x33')]['fields']));_0x1de6e0[_0x333d('0x31')]=_0x1de6e0[_0x333d('0x31')][_0x333d('0x34')]?_0x1de6e0[_0x333d('0x31')]:_0x568f90[_0x333d('0x2d')];if(!_0x12f020['query']['hasOwnProperty']('nolimit')){_0x1de6e0[_0x333d('0x1c')]=qs[_0x333d('0x1c')](_0x12f020['query']['limit']);_0x1de6e0['offset']=qs[_0x333d('0x1b')](_0x12f020['query']['offset']);}_0x1de6e0[_0x333d('0x35')]=qs[_0x333d('0x36')](_0x12f020[_0x333d('0x33')][_0x333d('0x36')]);_0x1de6e0['where']=qs[_0x333d('0x2f')](_['pick'](_0x12f020[_0x333d('0x33')],_0x568f90[_0x333d('0x2f')]),_0x49314e);if(_0x12f020['query'][_0x333d('0x37')]){_0x1de6e0[_0x333d('0x38')]=_[_0x333d('0x39')](_0x1de6e0[_0x333d('0x38')],{'$or':_[_0x333d('0x29')](_0x49314e,function(_0x1f24fd){if(_0x1f24fd['type']!=='VIRTUAL'){var _0xde6894={};_0xde6894[_0x1f24fd[_0x333d('0x26')]]={'$like':'%'+_0x12f020['query'][_0x333d('0x37')]+'%'};return _0xde6894;}})});}_0x1de6e0=_[_0x333d('0x39')]({},_0x1de6e0,_0x12f020['options']);var _0x5b10a7={'where':_0x1de6e0[_0x333d('0x38')]};return db[_0x333d('0x2a')][_0x333d('0x1a')](_0x5b10a7)[_0x333d('0x23')](function(_0x330def){_0x461296[_0x333d('0x1a')]=_0x330def;if(_0x12f020[_0x333d('0x33')][_0x333d('0x3a')]){_0x1de6e0[_0x333d('0x3b')]=[{'attributes':['id',_0x333d('0x26'),_0x333d('0x3c'),_0x333d('0x3d')],'model':db[_0x333d('0x3e')],'as':'User'}];}return db['VoiceCallReport'][_0x333d('0x3f')](_0x1de6e0);})[_0x333d('0x23')](function(_0x2cada1){_0x461296['rows']=_0x2cada1;return _0x461296;})['then'](respondWithFilteredResult(_0x4c8e60,_0x1de6e0))[_0x333d('0x40')](handleError(_0x4c8e60,null));};exports[_0x333d('0x41')]=function(_0x2076f3,_0x2e8145){var _0x44a36d={'raw':!![],'where':{'id':_0x2076f3[_0x333d('0x42')]['id']}},_0x487110={};_0x487110[_0x333d('0x2d')]=_[_0x333d('0x2e')](db[_0x333d('0x2a')][_0x333d('0x2b')]);_0x487110[_0x333d('0x33')]=_[_0x333d('0x2e')](_0x2076f3['query']);_0x487110[_0x333d('0x2f')]=_[_0x333d('0x30')](_0x487110['model'],_0x487110[_0x333d('0x33')]);_0x44a36d[_0x333d('0x31')]=_[_0x333d('0x30')](_0x487110[_0x333d('0x2d')],qs[_0x333d('0x32')](_0x2076f3['query']['fields']));_0x44a36d[_0x333d('0x31')]=_0x44a36d[_0x333d('0x31')][_0x333d('0x34')]?_0x44a36d[_0x333d('0x31')]:_0x487110['model'];if(_0x2076f3[_0x333d('0x33')][_0x333d('0x3a')]){_0x44a36d[_0x333d('0x3b')]=[{'all':!![]}];}_0x44a36d=_[_0x333d('0x39')]({},_0x44a36d,_0x2076f3[_0x333d('0x43')]);return db[_0x333d('0x2a')][_0x333d('0x44')](_0x44a36d)[_0x333d('0x23')](handleEntityNotFound(_0x2e8145,null))['then'](respondWithResult(_0x2e8145,null))[_0x333d('0x40')](handleError(_0x2e8145,null));};exports[_0x333d('0x45')]=function(_0x47daec,_0x2aa346){return db['VoiceCallReport'][_0x333d('0x45')](_0x47daec[_0x333d('0x46')],{})[_0x333d('0x23')](respondWithResult(_0x2aa346,0xc9))['catch'](handleError(_0x2aa346,null));};exports[_0x333d('0x24')]=function(_0x3c41d4,_0x3e0813){return db[_0x333d('0x2a')][_0x333d('0x44')]({'where':{'id':_0x3c41d4[_0x333d('0x42')]['id']}})[_0x333d('0x23')](handleEntityNotFound(_0x3e0813,null))[_0x333d('0x23')](removeEntity(_0x3e0813,null))[_0x333d('0x40')](handleError(_0x3e0813,null));};exports['describe']=function(_0x1d5b22,_0x35ff24){return db[_0x333d('0x2a')][_0x333d('0x47')]()['then'](respondWithResult(_0x35ff24,null))[_0x333d('0x40')](handleError(_0x35ff24,null));};exports[_0x333d('0x22')]=function(_0x8b15da,_0x3405e7){if(_0x8b15da[_0x333d('0x46')][_0x333d('0x48')]){delete _0x8b15da[_0x333d('0x46')][_0x333d('0x48')];}return db['VoiceCallReport'][_0x333d('0x44')]({'where':{'uniqueid':_0x8b15da['params']['id'],'UserId':{'$or':[null,_0x8b15da[_0x333d('0x49')]['id']]}}})[_0x333d('0x23')](handleEntityNotFound(_0x3405e7,null))[_0x333d('0x23')](saveUpdates(_0x8b15da['body'],null))[_0x333d('0x23')](respondWithResult(_0x3405e7,null))[_0x333d('0x40')](handleError(_0x3405e7,null));}; \ No newline at end of file +var _0xf151=['crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../mysqldb','status','json','offset','limit','set','apply','reject','save','update','then','destroy','end','sendStatus','error','stack','name','send','index','map','VoiceCallReport','fieldName','key','model','query','keys','intersection','fields','attributes','length','nolimit','order','sort','where','filters','pick','merge','type','VIRTUAL','options','count','includeAll','include','fullname','alias','User','rows','catch','show','params','rawAttributes','create','describe','body','uniqueid','find','user','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash'];(function(_0x5d660e,_0x36dce6){var _0x128843=function(_0x2935ae){while(--_0x2935ae){_0x5d660e['push'](_0x5d660e['shift']());}};_0x128843(++_0x36dce6);}(_0xf151,0x17e));var _0x1f15=function(_0x26db2b,_0x3b4d1f){_0x26db2b=_0x26db2b-0x0;var _0x2ab468=_0xf151[_0x26db2b];return _0x2ab468;};'use strict';var pdf=require(_0x1f15('0x0'));var emlformat=require(_0x1f15('0x1'));var rimraf=require(_0x1f15('0x2'));var zipdir=require(_0x1f15('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1f15('0x4'));var moment=require(_0x1f15('0x5'));var BPromise=require(_0x1f15('0x6'));var Mustache=require('mustache');var util=require(_0x1f15('0x7'));var path=require(_0x1f15('0x8'));var sox=require(_0x1f15('0x9'));var csv=require(_0x1f15('0xa'));var ejs=require(_0x1f15('0xb'));var fs=require('fs');var _=require(_0x1f15('0xc'));var squel=require('squel');var crypto=require(_0x1f15('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x1f15('0xe'));var toCsv=require(_0x1f15('0xa'));var querystring=require(_0x1f15('0xf'));var Papa=require('papaparse');var Redis=require(_0x1f15('0x10'));var authService=require(_0x1f15('0x11'));var qs=require(_0x1f15('0x12'));var as=require(_0x1f15('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1f15('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x1f15('0x15'));var db=require(_0x1f15('0x16'))['db'];function respondWithStatusCode(_0x3e3b71,_0x13ed05){_0x13ed05=_0x13ed05||0xcc;return function(_0x25bc34){if(_0x25bc34){return _0x3e3b71['sendStatus'](_0x13ed05);}return _0x3e3b71[_0x1f15('0x17')](_0x13ed05)['end']();};}function respondWithResult(_0x2393d4,_0x4f9e00){_0x4f9e00=_0x4f9e00||0xc8;return function(_0x3fd056){if(_0x3fd056){return _0x2393d4['status'](_0x4f9e00)[_0x1f15('0x18')](_0x3fd056);}};}function respondWithFilteredResult(_0x40b6c9,_0x1bc1f0){return function(_0x47ec9b){if(_0x47ec9b){var _0x3bba22=_0x47ec9b['count'],_0x3ead1e=_0x1bc1f0[_0x1f15('0x19')],_0x516f06=_0x1bc1f0[_0x1f15('0x19')]+_0x1bc1f0[_0x1f15('0x1a')],_0x174709;if(_0x516f06>=_0x3bba22){_0x516f06=_0x3bba22;_0x174709=0xc8;}else{_0x174709=0xce;}_0x40b6c9[_0x1f15('0x17')](_0x174709);return _0x40b6c9[_0x1f15('0x1b')]('Content-Range',_0x3ead1e+'-'+_0x516f06+'/'+_0x3bba22)['json'](_0x47ec9b);}return null;};}function patchUpdates(_0x1b7cd0){return function(_0x51903b){try{jsonpatch[_0x1f15('0x1c')](_0x51903b,_0x1b7cd0,!![]);}catch(_0x1005a6){return BPromise[_0x1f15('0x1d')](_0x1005a6);}return _0x51903b[_0x1f15('0x1e')]();};}function saveUpdates(_0x397a84,_0x54edd7){return function(_0x14686e){if(_0x14686e){return _0x14686e[_0x1f15('0x1f')](_0x397a84)[_0x1f15('0x20')](function(_0x4e0051){return _0x4e0051;});}return null;};}function removeEntity(_0x291f11,_0x32def0){return function(_0x900b15){if(_0x900b15){return _0x900b15[_0x1f15('0x21')]()['then'](function(){_0x291f11['status'](0xcc)[_0x1f15('0x22')]();});}};}function handleEntityNotFound(_0x27b336,_0x5eaed0){return function(_0x55bc99){if(!_0x55bc99){_0x27b336[_0x1f15('0x23')](0x194);}return _0x55bc99;};}function handleError(_0x2a582d,_0x285ae7){_0x285ae7=_0x285ae7||0x1f4;return function(_0x8b65a8){logger[_0x1f15('0x24')](_0x8b65a8[_0x1f15('0x25')]);if(_0x8b65a8['name']){delete _0x8b65a8[_0x1f15('0x26')];}_0x2a582d[_0x1f15('0x17')](_0x285ae7)[_0x1f15('0x27')](_0x8b65a8);};}exports[_0x1f15('0x28')]=function(_0x18cac6,_0x4e91aa){var _0x297119={},_0x126795={},_0x2e1677={'count':0x0,'rows':[]};var _0x5d9f77=_[_0x1f15('0x29')](db[_0x1f15('0x2a')]['rawAttributes'],function(_0x27fe32){return{'name':_0x27fe32[_0x1f15('0x2b')],'type':_0x27fe32['type'][_0x1f15('0x2c')]};});_0x126795[_0x1f15('0x2d')]=_[_0x1f15('0x29')](_0x5d9f77,_0x1f15('0x26'));_0x126795[_0x1f15('0x2e')]=_[_0x1f15('0x2f')](_0x18cac6[_0x1f15('0x2e')]);_0x126795['filters']=_[_0x1f15('0x30')](_0x126795['model'],_0x126795[_0x1f15('0x2e')]);_0x297119['attributes']=_['intersection'](_0x126795[_0x1f15('0x2d')],qs[_0x1f15('0x31')](_0x18cac6[_0x1f15('0x2e')][_0x1f15('0x31')]));_0x297119[_0x1f15('0x32')]=_0x297119[_0x1f15('0x32')][_0x1f15('0x33')]?_0x297119['attributes']:_0x126795['model'];if(!_0x18cac6[_0x1f15('0x2e')]['hasOwnProperty'](_0x1f15('0x34'))){_0x297119[_0x1f15('0x1a')]=qs[_0x1f15('0x1a')](_0x18cac6[_0x1f15('0x2e')][_0x1f15('0x1a')]);_0x297119[_0x1f15('0x19')]=qs[_0x1f15('0x19')](_0x18cac6[_0x1f15('0x2e')][_0x1f15('0x19')]);}_0x297119[_0x1f15('0x35')]=qs[_0x1f15('0x36')](_0x18cac6[_0x1f15('0x2e')]['sort']);_0x297119[_0x1f15('0x37')]=qs[_0x1f15('0x38')](_[_0x1f15('0x39')](_0x18cac6[_0x1f15('0x2e')],_0x126795[_0x1f15('0x38')]),_0x5d9f77);if(_0x18cac6[_0x1f15('0x2e')]['filter']){_0x297119[_0x1f15('0x37')]=_[_0x1f15('0x3a')](_0x297119[_0x1f15('0x37')],{'$or':_[_0x1f15('0x29')](_0x5d9f77,function(_0x135ca8){if(_0x135ca8[_0x1f15('0x3b')]!==_0x1f15('0x3c')){var _0xcb684={};_0xcb684[_0x135ca8[_0x1f15('0x26')]]={'$like':'%'+_0x18cac6[_0x1f15('0x2e')]['filter']+'%'};return _0xcb684;}})});}_0x297119=_[_0x1f15('0x3a')]({},_0x297119,_0x18cac6[_0x1f15('0x3d')]);var _0x12b045={'where':_0x297119[_0x1f15('0x37')]};return db[_0x1f15('0x2a')]['count'](_0x12b045)[_0x1f15('0x20')](function(_0x5ceff9){_0x2e1677[_0x1f15('0x3e')]=_0x5ceff9;if(_0x18cac6['query'][_0x1f15('0x3f')]){_0x297119[_0x1f15('0x40')]=[{'attributes':['id',_0x1f15('0x26'),_0x1f15('0x41'),_0x1f15('0x42')],'model':db[_0x1f15('0x43')],'as':_0x1f15('0x43')}];}return db[_0x1f15('0x2a')]['findAll'](_0x297119);})[_0x1f15('0x20')](function(_0x2d8c69){_0x2e1677[_0x1f15('0x44')]=_0x2d8c69;return _0x2e1677;})[_0x1f15('0x20')](respondWithFilteredResult(_0x4e91aa,_0x297119))[_0x1f15('0x45')](handleError(_0x4e91aa,null));};exports[_0x1f15('0x46')]=function(_0x420e19,_0x5a4da6){var _0x522fab={'raw':!![],'where':{'id':_0x420e19[_0x1f15('0x47')]['id']}},_0x30800b={};_0x30800b[_0x1f15('0x2d')]=_[_0x1f15('0x2f')](db[_0x1f15('0x2a')][_0x1f15('0x48')]);_0x30800b[_0x1f15('0x2e')]=_[_0x1f15('0x2f')](_0x420e19['query']);_0x30800b[_0x1f15('0x38')]=_[_0x1f15('0x30')](_0x30800b[_0x1f15('0x2d')],_0x30800b[_0x1f15('0x2e')]);_0x522fab['attributes']=_[_0x1f15('0x30')](_0x30800b[_0x1f15('0x2d')],qs[_0x1f15('0x31')](_0x420e19['query'][_0x1f15('0x31')]));_0x522fab[_0x1f15('0x32')]=_0x522fab[_0x1f15('0x32')][_0x1f15('0x33')]?_0x522fab['attributes']:_0x30800b['model'];if(_0x420e19[_0x1f15('0x2e')][_0x1f15('0x3f')]){_0x522fab['include']=[{'all':!![]}];}_0x522fab=_[_0x1f15('0x3a')]({},_0x522fab,_0x420e19['options']);return db[_0x1f15('0x2a')]['find'](_0x522fab)['then'](handleEntityNotFound(_0x5a4da6,null))['then'](respondWithResult(_0x5a4da6,null))[_0x1f15('0x45')](handleError(_0x5a4da6,null));};exports[_0x1f15('0x49')]=function(_0x536a8f,_0x4af7e2){return db[_0x1f15('0x2a')]['create'](_0x536a8f['body'],{})[_0x1f15('0x20')](respondWithResult(_0x4af7e2,0xc9))[_0x1f15('0x45')](handleError(_0x4af7e2,null));};exports['destroy']=function(_0x465ece,_0x32ce05){return db[_0x1f15('0x2a')]['find']({'where':{'id':_0x465ece['params']['id']}})[_0x1f15('0x20')](handleEntityNotFound(_0x32ce05,null))[_0x1f15('0x20')](removeEntity(_0x32ce05,null))[_0x1f15('0x45')](handleError(_0x32ce05,null));};exports[_0x1f15('0x4a')]=function(_0x3211f7,_0x3be2c1){return db[_0x1f15('0x2a')][_0x1f15('0x4a')]()[_0x1f15('0x20')](respondWithResult(_0x3be2c1,null))['catch'](handleError(_0x3be2c1,null));};exports[_0x1f15('0x1f')]=function(_0x37e34c,_0x414ff6){if(_0x37e34c[_0x1f15('0x4b')][_0x1f15('0x4c')]){delete _0x37e34c[_0x1f15('0x4b')][_0x1f15('0x4c')];}return db['VoiceCallReport'][_0x1f15('0x4d')]({'where':{'uniqueid':_0x37e34c[_0x1f15('0x47')]['id'],'UserId':{'$or':[null,_0x37e34c[_0x1f15('0x4e')]['id']]}}})['then'](handleEntityNotFound(_0x414ff6,null))[_0x1f15('0x20')](saveUpdates(_0x37e34c['body'],null))['then'](respondWithResult(_0x414ff6,null))[_0x1f15('0x45')](handleError(_0x414ff6,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index c66f491..6bfa317 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 _0x8475=['api','moment','bluebird','rimraf','./voiceCallReport.attributes','exports','report_call','uniqueid','util'];(function(_0x5a7860,_0x1c6534){var _0x1ed7e8=function(_0x19b076){while(--_0x19b076){_0x5a7860['push'](_0x5a7860['shift']());}};_0x1ed7e8(++_0x1c6534);}(_0x8475,0xf2));var _0x5847=function(_0x22f148,_0xcc55e0){_0x22f148=_0x22f148-0x0;var _0x5f33c2=_0x8475[_0x22f148];return _0x5f33c2;};'use strict';var _=require('lodash');var util=require(_0x5847('0x0'));var logger=require('../../config/logger')(_0x5847('0x1'));var moment=require(_0x5847('0x2'));var BPromise=require(_0x5847('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5847('0x4'));var config=require('../../config/environment');var attributes=require(_0x5847('0x5'));module[_0x5847('0x6')]=function(_0x5b15c8,_0x3a3233){return _0x5b15c8['define']('VoiceCallReport',attributes,{'tableName':_0x5847('0x7'),'paranoid':![],'indexes':[{'fields':[_0x5847('0x8')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf63b=['bluebird','request-promise','path','rimraf','./voiceCallReport.attributes','exports','define','VoiceCallReport','report_call','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0xdd9a5f,_0x3ced93){var _0x3464b7=function(_0x35b534){while(--_0x35b534){_0xdd9a5f['push'](_0xdd9a5f['shift']());}};_0x3464b7(++_0x3ced93);}(_0xf63b,0xcd));var _0xbf63=function(_0x339567,_0x399536){_0x339567=_0x339567-0x0;var _0x2b3335=_0xf63b[_0x339567];return _0x2b3335;};'use strict';var _=require(_0xbf63('0x0'));var util=require(_0xbf63('0x1'));var logger=require(_0xbf63('0x2'))(_0xbf63('0x3'));var moment=require(_0xbf63('0x4'));var BPromise=require(_0xbf63('0x5'));var rp=require(_0xbf63('0x6'));var fs=require('fs');var path=require(_0xbf63('0x7'));var rimraf=require(_0xbf63('0x8'));var config=require('../../config/environment');var attributes=require(_0xbf63('0x9'));module[_0xbf63('0xa')]=function(_0xdc0b24,_0x405735){return _0xdc0b24[_0xbf63('0xb')](_0xbf63('0xc'),attributes,{'tableName':_0xbf63('0xd'),'paranoid':![],'indexes':[{'fields':[_0xbf63('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index f8c9623..40ba6d5 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 _0x87a4=['include','map','model','create','CreateVoiceCallReport','debug','update','body','limit','UpdateVoiceCallReport','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','where','attributes'];(function(_0xea8947,_0x1b573d){var _0x2455e9=function(_0x18771e){while(--_0x18771e){_0xea8947['push'](_0xea8947['shift']());}};_0x2455e9(++_0x1b573d);}(_0x87a4,0x14a));var _0x487a=function(_0x4ed74d,_0x228c5f){_0x4ed74d=_0x4ed74d-0x0;var _0x127cea=_0x87a4[_0x4ed74d];return _0x127cea;};'use strict';var _=require(_0x487a('0x0'));var util=require(_0x487a('0x1'));var moment=require('moment');var BPromise=require(_0x487a('0x2'));var rs=require(_0x487a('0x3'));var fs=require('fs');var Redis=require(_0x487a('0x4'));var db=require(_0x487a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x487a('0x6'))(_0x487a('0x7'));var config=require(_0x487a('0x8'));var jayson=require(_0x487a('0x9'));var client=jayson[_0x487a('0xa')][_0x487a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xc558b,_0x5d1916,_0x420403){return new BPromise(function(_0x2dbf7e,_0x2c089e){return client[_0x487a('0xc')](_0xc558b,_0x420403)[_0x487a('0xd')](function(_0x7612b1){logger[_0x487a('0xe')](_0x487a('0xf'),_0x5d1916,_0x487a('0x10'));logger['debug'](_0x487a('0x11'),_0x5d1916,_0x487a('0x10'),JSON[_0x487a('0x12')](_0x7612b1));if(_0x7612b1[_0x487a('0x13')]){if(_0x7612b1[_0x487a('0x13')][_0x487a('0x14')]===0x1f4){logger['error'](_0x487a('0xf'),_0x5d1916,_0x7612b1['error'][_0x487a('0x15')]);return _0x2c089e(_0x7612b1['error'][_0x487a('0x15')]);}logger[_0x487a('0x13')](_0x487a('0xf'),_0x5d1916,_0x7612b1['error'][_0x487a('0x15')]);return _0x2dbf7e(_0x7612b1[_0x487a('0x13')]['message']);}else{logger[_0x487a('0xe')](_0x487a('0xf'),_0x5d1916,_0x487a('0x10'));_0x2dbf7e(_0x7612b1['result']['message']);}})[_0x487a('0x16')](function(_0x3f8852){logger['error'](_0x487a('0xf'),_0x5d1916,_0x3f8852);_0x2c089e(_0x3f8852);});});}exports[_0x487a('0x17')]=function(_0x24295f){var _0x217052=this;return new Promise(function(_0xb4cc,_0x16e860){return db[_0x487a('0x18')][_0x487a('0x19')]({'raw':_0x24295f[_0x487a('0x1a')]?_0x24295f['options'][_0x487a('0x1b')]===undefined?!![]:![]:!![],'where':_0x24295f[_0x487a('0x1a')]?_0x24295f[_0x487a('0x1a')][_0x487a('0x1c')]||null:null,'attributes':_0x24295f[_0x487a('0x1a')]?_0x24295f[_0x487a('0x1a')][_0x487a('0x1d')]||null:null,'limit':_0x24295f[_0x487a('0x1a')]?_0x24295f['options']['limit']||null:null,'include':_0x24295f[_0x487a('0x1a')]?_0x24295f[_0x487a('0x1a')][_0x487a('0x1e')]?_[_0x487a('0x1f')](_0x24295f[_0x487a('0x1a')]['include'],function(_0x15932e){return{'model':db[_0x15932e[_0x487a('0x20')]],'as':_0x15932e['as'],'attributes':_0x15932e[_0x487a('0x1d')],'include':_0x15932e[_0x487a('0x1e')]?_['map'](_0x15932e[_0x487a('0x1e')],function(_0x146d99){return{'model':db[_0x146d99[_0x487a('0x20')]],'as':_0x146d99['as'],'attributes':_0x146d99[_0x487a('0x1d')],'include':_0x146d99[_0x487a('0x1e')]?_[_0x487a('0x1f')](_0x146d99[_0x487a('0x1e')],function(_0x52280e){return{'model':db[_0x52280e[_0x487a('0x20')]],'as':_0x52280e['as'],'attributes':_0x52280e['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x37fcff){logger[_0x487a('0xe')]('GetVoiceCallReport',_0x24295f);logger['debug'](_0x487a('0x17'),_0x24295f,JSON[_0x487a('0x12')](_0x37fcff));_0xb4cc(_0x37fcff);})['catch'](function(_0x8b97c7){logger[_0x487a('0x13')]('GetVoiceCallReport',_0x8b97c7[_0x487a('0x15')],_0x24295f);_0x16e860(_0x217052[_0x487a('0x13')](0x1f4,_0x8b97c7[_0x487a('0x15')]));});});};exports['CreateVoiceCallReport']=function(_0x144ed3){var _0x5a5d60=this;return new Promise(function(_0x42857d,_0x2ec12a){return db[_0x487a('0x18')][_0x487a('0x21')](_0x144ed3['body'],{'raw':_0x144ed3[_0x487a('0x1a')]?_0x144ed3[_0x487a('0x1a')][_0x487a('0x1b')]===undefined?!![]:![]:!![]})[_0x487a('0xd')](function(_0x4b1887){logger[_0x487a('0xe')](_0x487a('0x22'),_0x144ed3);logger[_0x487a('0x23')](_0x487a('0x22'),_0x144ed3,JSON[_0x487a('0x12')](_0x4b1887));_0x42857d(_0x4b1887);})[_0x487a('0x16')](function(_0x363102){logger['error'](_0x487a('0x22'),_0x363102['message'],_0x144ed3);_0x2ec12a(_0x5a5d60[_0x487a('0x13')](0x1f4,_0x363102[_0x487a('0x15')]));});});};exports['UpdateVoiceCallReport']=function(_0x6f4a61){var _0x164a20=this;return new Promise(function(_0x19f094,_0x5704fb){return db['VoiceCallReport'][_0x487a('0x24')](_0x6f4a61[_0x487a('0x25')],{'raw':_0x6f4a61[_0x487a('0x1a')]?_0x6f4a61[_0x487a('0x1a')][_0x487a('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x6f4a61[_0x487a('0x1a')]?_0x6f4a61['options'][_0x487a('0x1c')]||null:null,'attributes':_0x6f4a61['options']?_0x6f4a61[_0x487a('0x1a')]['attributes']||null:null,'limit':_0x6f4a61['options']?_0x6f4a61[_0x487a('0x1a')][_0x487a('0x26')]||null:null})['then'](function(_0x1328bc){logger['info'](_0x487a('0x27'),_0x6f4a61);logger['debug'](_0x487a('0x27'),_0x6f4a61,JSON['stringify'](_0x1328bc));_0x19f094(_0x1328bc);})[_0x487a('0x16')](function(_0x27d8cc){logger[_0x487a('0x13')](_0x487a('0x27'),_0x27d8cc[_0x487a('0x15')],_0x6f4a61);_0x5704fb(_0x164a20['error'](0x1f4,_0x27d8cc['message']));});});}; \ No newline at end of file +var _0x1cd4=['findAll','raw','options','where','attributes','limit','include','map','model','CreateVoiceCallReport','VoiceCallReport','create','body','update','catch','UpdateVoiceCallReport','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceCallReport,\x20%s,\x20%s','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','GetVoiceCallReport'];(function(_0x2a98e3,_0x488997){var _0x370a71=function(_0x3b71cb){while(--_0x3b71cb){_0x2a98e3['push'](_0x2a98e3['shift']());}};_0x370a71(++_0x488997);}(_0x1cd4,0x136));var _0x41cd=function(_0x4956d4,_0x345e38){_0x4956d4=_0x4956d4-0x0;var _0x5ba119=_0x1cd4[_0x4956d4];return _0x5ba119;};'use strict';var _=require(_0x41cd('0x0'));var util=require(_0x41cd('0x1'));var moment=require(_0x41cd('0x2'));var BPromise=require(_0x41cd('0x3'));var rs=require(_0x41cd('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x41cd('0x5'))['db'];var utils=require(_0x41cd('0x6'));var logger=require(_0x41cd('0x7'))(_0x41cd('0x8'));var config=require(_0x41cd('0x9'));var jayson=require(_0x41cd('0xa'));var client=jayson[_0x41cd('0xb')][_0x41cd('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4d06fd,_0x298826,_0x4b6d1f){return new BPromise(function(_0x260a5f,_0xdaef98){return client[_0x41cd('0xd')](_0x4d06fd,_0x4b6d1f)[_0x41cd('0xe')](function(_0x595fed){logger[_0x41cd('0xf')](_0x41cd('0x10'),_0x298826,'request\x20sent');logger[_0x41cd('0x11')](_0x41cd('0x12'),_0x298826,_0x41cd('0x13'),JSON[_0x41cd('0x14')](_0x595fed));if(_0x595fed[_0x41cd('0x15')]){if(_0x595fed['error'][_0x41cd('0x16')]===0x1f4){logger[_0x41cd('0x15')](_0x41cd('0x10'),_0x298826,_0x595fed[_0x41cd('0x15')][_0x41cd('0x17')]);return _0xdaef98(_0x595fed[_0x41cd('0x15')]['message']);}logger[_0x41cd('0x15')](_0x41cd('0x10'),_0x298826,_0x595fed[_0x41cd('0x15')][_0x41cd('0x17')]);return _0x260a5f(_0x595fed[_0x41cd('0x15')][_0x41cd('0x17')]);}else{logger[_0x41cd('0xf')](_0x41cd('0x10'),_0x298826,_0x41cd('0x13'));_0x260a5f(_0x595fed[_0x41cd('0x18')][_0x41cd('0x17')]);}})['catch'](function(_0x89609){logger[_0x41cd('0x15')]('VoiceCallReport,\x20%s,\x20%s',_0x298826,_0x89609);_0xdaef98(_0x89609);});});}exports[_0x41cd('0x19')]=function(_0x2e09f5){var _0x159d65=this;return new Promise(function(_0x2de0c5,_0x1907c6){return db['VoiceCallReport'][_0x41cd('0x1a')]({'raw':_0x2e09f5['options']?_0x2e09f5['options'][_0x41cd('0x1b')]===undefined?!![]:![]:!![],'where':_0x2e09f5[_0x41cd('0x1c')]?_0x2e09f5[_0x41cd('0x1c')][_0x41cd('0x1d')]||null:null,'attributes':_0x2e09f5['options']?_0x2e09f5['options'][_0x41cd('0x1e')]||null:null,'limit':_0x2e09f5[_0x41cd('0x1c')]?_0x2e09f5[_0x41cd('0x1c')][_0x41cd('0x1f')]||null:null,'include':_0x2e09f5[_0x41cd('0x1c')]?_0x2e09f5[_0x41cd('0x1c')][_0x41cd('0x20')]?_[_0x41cd('0x21')](_0x2e09f5[_0x41cd('0x1c')][_0x41cd('0x20')],function(_0x4a0237){return{'model':db[_0x4a0237[_0x41cd('0x22')]],'as':_0x4a0237['as'],'attributes':_0x4a0237[_0x41cd('0x1e')],'include':_0x4a0237[_0x41cd('0x20')]?_[_0x41cd('0x21')](_0x4a0237[_0x41cd('0x20')],function(_0x2e130a){return{'model':db[_0x2e130a[_0x41cd('0x22')]],'as':_0x2e130a['as'],'attributes':_0x2e130a[_0x41cd('0x1e')],'include':_0x2e130a[_0x41cd('0x20')]?_[_0x41cd('0x21')](_0x2e130a['include'],function(_0x4f4ad4){return{'model':db[_0x4f4ad4[_0x41cd('0x22')]],'as':_0x4f4ad4['as'],'attributes':_0x4f4ad4[_0x41cd('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x28d648){logger[_0x41cd('0xf')](_0x41cd('0x19'),_0x2e09f5);logger['debug'](_0x41cd('0x19'),_0x2e09f5,JSON[_0x41cd('0x14')](_0x28d648));_0x2de0c5(_0x28d648);})['catch'](function(_0x5437ea){logger[_0x41cd('0x15')](_0x41cd('0x19'),_0x5437ea['message'],_0x2e09f5);_0x1907c6(_0x159d65['error'](0x1f4,_0x5437ea['message']));});});};exports[_0x41cd('0x23')]=function(_0x193dda){var _0x15faf4=this;return new Promise(function(_0x6f18ab,_0x9b4b3){return db[_0x41cd('0x24')][_0x41cd('0x25')](_0x193dda[_0x41cd('0x26')],{'raw':_0x193dda[_0x41cd('0x1c')]?_0x193dda[_0x41cd('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0x41cd('0xe')](function(_0x443ff2){logger[_0x41cd('0xf')](_0x41cd('0x23'),_0x193dda);logger['debug'](_0x41cd('0x23'),_0x193dda,JSON[_0x41cd('0x14')](_0x443ff2));_0x6f18ab(_0x443ff2);})['catch'](function(_0x4182ce){logger[_0x41cd('0x15')]('CreateVoiceCallReport',_0x4182ce[_0x41cd('0x17')],_0x193dda);_0x9b4b3(_0x15faf4[_0x41cd('0x15')](0x1f4,_0x4182ce[_0x41cd('0x17')]));});});};exports['UpdateVoiceCallReport']=function(_0x236ec0){var _0x442ea8=this;return new Promise(function(_0x509be4,_0x1bad49){return db[_0x41cd('0x24')][_0x41cd('0x27')](_0x236ec0['body'],{'raw':_0x236ec0[_0x41cd('0x1c')]?_0x236ec0[_0x41cd('0x1c')][_0x41cd('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x236ec0['options']?_0x236ec0[_0x41cd('0x1c')][_0x41cd('0x1d')]||null:null,'attributes':_0x236ec0['options']?_0x236ec0[_0x41cd('0x1c')]['attributes']||null:null,'limit':_0x236ec0[_0x41cd('0x1c')]?_0x236ec0['options']['limit']||null:null})[_0x41cd('0xe')](function(_0x432a3c){logger[_0x41cd('0xf')]('UpdateVoiceCallReport',_0x236ec0);logger['debug']('UpdateVoiceCallReport',_0x236ec0,JSON[_0x41cd('0x14')](_0x432a3c));_0x509be4(_0x432a3c);})[_0x41cd('0x28')](function(_0x41de34){logger[_0x41cd('0x15')](_0x41cd('0x29'),_0x41de34[_0x41cd('0x17')],_0x236ec0);_0x1bad49(_0x442ea8[_0x41cd('0x15')](0x1f4,_0x41de34[_0x41cd('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 1337b33..3d6fc6e 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 _0x1290=['create','put','delete','exports','multer','util','connect-timeout','Router','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get','isAuthenticated','index','/:id','show','post'];(function(_0x1269c6,_0x1c8942){var _0x4868c7=function(_0x1661bc){while(--_0x1661bc){_0x1269c6['push'](_0x1269c6['shift']());}};_0x4868c7(++_0x1c8942);}(_0x1290,0x136));var _0x0129=function(_0x54eeb8,_0x1d903c){_0x54eeb8=_0x54eeb8-0x0;var _0x43476e=_0x1290[_0x54eeb8];return _0x43476e;};'use strict';var multer=require(_0x0129('0x0'));var util=require(_0x0129('0x1'));var path=require('path');var timeout=require(_0x0129('0x2'));var express=require('express');var router=express[_0x0129('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0129('0x4'));var config=require(_0x0129('0x5'));var controller=require(_0x0129('0x6'));router[_0x0129('0x7')]('/',auth[_0x0129('0x8')](),controller[_0x0129('0x9')]);router[_0x0129('0x7')](_0x0129('0xa'),auth[_0x0129('0x8')](),controller[_0x0129('0xb')]);router[_0x0129('0xc')]('/',auth['isAuthenticated'](),controller[_0x0129('0xd')]);router[_0x0129('0xe')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x0129('0xf')](_0x0129('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x0129('0x10')]=router; \ No newline at end of file +var _0x78c6=['connect-timeout','express','../../components/auth/service','../../config/environment','./voiceChanSpy.controller','get','index','/:id','isAuthenticated','show','create','put','update','destroy','exports'];(function(_0x2001cf,_0x1e8943){var _0x3a2182=function(_0x49eca1){while(--_0x49eca1){_0x2001cf['push'](_0x2001cf['shift']());}};_0x3a2182(++_0x1e8943);}(_0x78c6,0x168));var _0x678c=function(_0x38f96d,_0x3c78a5){_0x38f96d=_0x38f96d-0x0;var _0x53e15b=_0x78c6[_0x38f96d];return _0x53e15b;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x678c('0x0'));var express=require(_0x678c('0x1'));var router=express['Router']();var auth=require(_0x678c('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0x678c('0x3'));var controller=require(_0x678c('0x4'));router[_0x678c('0x5')]('/',auth['isAuthenticated'](),controller[_0x678c('0x6')]);router[_0x678c('0x5')](_0x678c('0x7'),auth[_0x678c('0x8')](),controller[_0x678c('0x9')]);router['post']('/',auth[_0x678c('0x8')](),controller[_0x678c('0xa')]);router[_0x678c('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x678c('0xc')]);router['delete'](_0x678c('0x7'),auth[_0x678c('0x8')](),controller[_0x678c('0xd')]);module[_0x678c('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 426955d..b344e75 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 _0x4801=['split','sequelize','exports','STRING','setDataValue','join','getDataValue'];(function(_0x58dc25,_0x49b9d5){var _0x21b0a7=function(_0x38a186){while(--_0x38a186){_0x58dc25['push'](_0x58dc25['shift']());}};_0x21b0a7(++_0x49b9d5);}(_0x4801,0xbe));var _0x1480=function(_0x5b4972,_0x464200){_0x5b4972=_0x5b4972-0x0;var _0x6df520=_0x4801[_0x5b4972];return _0x6df520;};'use strict';var Sequelize=require(_0x1480('0x0'));module[_0x1480('0x1')]={'name':{'type':Sequelize[_0x1480('0x2')]},'prefix':{'type':Sequelize[_0x1480('0x2')],'unique':'name','allowNull':![]},'options':{'type':Sequelize[_0x1480('0x2')],'set':function(_0x2b8fe5){this[_0x1480('0x3')]('options',_0x2b8fe5?_0x2b8fe5[_0x1480('0x4')](''):[]);},'get':function(){return this[_0x1480('0x5')]('options')?this[_0x1480('0x5')]('options')[_0x1480('0x6')](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x1480('0x2')]},'description':{'type':Sequelize[_0x1480('0x2')]}}; \ No newline at end of file +var _0x6883=['name','STRING','setDataValue','options','join','getDataValue','split','BOOLEAN','sequelize'];(function(_0x2463a1,_0x26e9d4){var _0x4f2114=function(_0x3ace31){while(--_0x3ace31){_0x2463a1['push'](_0x2463a1['shift']());}};_0x4f2114(++_0x26e9d4);}(_0x6883,0x104));var _0x3688=function(_0x3f485f,_0x271f11){_0x3f485f=_0x3f485f-0x0;var _0x1c8a49=_0x6883[_0x3f485f];return _0x1c8a49;};'use strict';var Sequelize=require(_0x3688('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize['STRING'],'unique':_0x3688('0x1'),'allowNull':![]},'options':{'type':Sequelize[_0x3688('0x2')],'set':function(_0x57ee10){this[_0x3688('0x3')](_0x3688('0x4'),_0x57ee10?_0x57ee10[_0x3688('0x5')](''):[]);},'get':function(){return this[_0x3688('0x6')]('options')?this['getDataValue'](_0x3688('0x4'))[_0x3688('0x7')](''):[];}},'auth':{'type':Sequelize[_0x3688('0x8')],'defaultValue':![]},'password':{'type':Sequelize[_0x3688('0x2')]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x3688('0x2')]},'description':{'type':Sequelize[_0x3688('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index a75eb27..67a8b70 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 _0xd79b=['path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','sendStatus','end','status','offset','limit','Content-Range','json','apply','reject','save','update','then','destroy','ChanSpies','UserProfileResource','error','stack','name','send','map','VoiceChanSpy','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','merge','options','count','includeAll','include','findAll','catch','show','params','create','body','user','get','role','UserProfileSection','userProfileId','autoAssociation','find','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util'];(function(_0x31f73a,_0x2ea7bf){var _0x3674c2=function(_0x1d978c){while(--_0x1d978c){_0x31f73a['push'](_0x31f73a['shift']());}};_0x3674c2(++_0x2ea7bf);}(_0xd79b,0x1cc));var _0xbd79=function(_0x1f0534,_0x51895d){_0x1f0534=_0x1f0534-0x0;var _0x1186db=_0xd79b[_0x1f0534];return _0x1186db;};'use strict';var pdf=require(_0xbd79('0x0'));var emlformat=require(_0xbd79('0x1'));var rimraf=require(_0xbd79('0x2'));var zipdir=require(_0xbd79('0x3'));var jsonpatch=require(_0xbd79('0x4'));var rp=require('request-promise');var moment=require(_0xbd79('0x5'));var BPromise=require(_0xbd79('0x6'));var Mustache=require('mustache');var util=require(_0xbd79('0x7'));var path=require(_0xbd79('0x8'));var sox=require(_0xbd79('0x9'));var csv=require('to-csv');var ejs=require(_0xbd79('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xbd79('0xb'));var crypto=require(_0xbd79('0xc'));var jsforce=require(_0xbd79('0xd'));var deskjs=require(_0xbd79('0xe'));var toCsv=require(_0xbd79('0xf'));var querystring=require(_0xbd79('0x10'));var Papa=require(_0xbd79('0x11'));var Redis=require(_0xbd79('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xbd79('0x13'));var hardwareService=require(_0xbd79('0x14'));var logger=require('../../config/logger')(_0xbd79('0x15'));var utils=require(_0xbd79('0x16'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1e4e23,_0x455ce7){_0x455ce7=_0x455ce7||0xcc;return function(_0x2c6200){if(_0x2c6200){return _0x1e4e23[_0xbd79('0x17')](_0x455ce7);}return _0x1e4e23['status'](_0x455ce7)[_0xbd79('0x18')]();};}function respondWithResult(_0x3d2982,_0x16294f){_0x16294f=_0x16294f||0xc8;return function(_0x98dee6){if(_0x98dee6){return _0x3d2982[_0xbd79('0x19')](_0x16294f)['json'](_0x98dee6);}};}function respondWithFilteredResult(_0xa4336d,_0x56fad8){return function(_0x2836bf){if(_0x2836bf){var _0x11a457=_0x2836bf['count'],_0x315422=_0x56fad8[_0xbd79('0x1a')],_0x410a96=_0x56fad8[_0xbd79('0x1a')]+_0x56fad8[_0xbd79('0x1b')],_0x3575ec;if(_0x410a96>=_0x11a457){_0x410a96=_0x11a457;_0x3575ec=0xc8;}else{_0x3575ec=0xce;}_0xa4336d['status'](_0x3575ec);return _0xa4336d['set'](_0xbd79('0x1c'),_0x315422+'-'+_0x410a96+'/'+_0x11a457)[_0xbd79('0x1d')](_0x2836bf);}return null;};}function patchUpdates(_0xa6f487){return function(_0x18bb8c){try{jsonpatch[_0xbd79('0x1e')](_0x18bb8c,_0xa6f487,!![]);}catch(_0x338d4b){return BPromise[_0xbd79('0x1f')](_0x338d4b);}return _0x18bb8c[_0xbd79('0x20')]();};}function saveUpdates(_0x25f328,_0x5ac6c8){return function(_0xd1b664){if(_0xd1b664){return _0xd1b664[_0xbd79('0x21')](_0x25f328)[_0xbd79('0x22')](function(_0x2e7581){return _0x2e7581;});}return null;};}function removeEntity(_0x491348,_0x11bb69){return function(_0x1a7e1f){if(_0x1a7e1f){return _0x1a7e1f[_0xbd79('0x23')]()[_0xbd79('0x22')](function(){var _0x4ca086=_0x1a7e1f['get']({'plain':!![]});var _0x11efcb=_0xbd79('0x24');return db[_0xbd79('0x25')]['destroy']({'where':{'type':_0x11efcb,'resourceId':_0x4ca086['id']}})[_0xbd79('0x22')](function(){return _0x1a7e1f;});})['then'](function(){_0x491348[_0xbd79('0x19')](0xcc)[_0xbd79('0x18')]();});}};}function handleEntityNotFound(_0x5ac401,_0x1b5020){return function(_0x18671f){if(!_0x18671f){_0x5ac401[_0xbd79('0x17')](0x194);}return _0x18671f;};}function handleError(_0x295185,_0x93c27a){_0x93c27a=_0x93c27a||0x1f4;return function(_0x3612f0){logger[_0xbd79('0x26')](_0x3612f0[_0xbd79('0x27')]);if(_0x3612f0[_0xbd79('0x28')]){delete _0x3612f0[_0xbd79('0x28')];}_0x295185['status'](_0x93c27a)[_0xbd79('0x29')](_0x3612f0);};}exports['index']=function(_0x246ca4,_0x39f3f0){var _0x28a297={},_0x472d1b={},_0x361659={'count':0x0,'rows':[]};var _0x1189a6=_[_0xbd79('0x2a')](db[_0xbd79('0x2b')][_0xbd79('0x2c')],function(_0x32ecc8){return{'name':_0x32ecc8[_0xbd79('0x2d')],'type':_0x32ecc8[_0xbd79('0x2e')]['key']};});_0x472d1b[_0xbd79('0x2f')]=_[_0xbd79('0x2a')](_0x1189a6,_0xbd79('0x28'));_0x472d1b[_0xbd79('0x30')]=_[_0xbd79('0x31')](_0x246ca4[_0xbd79('0x30')]);_0x472d1b['filters']=_[_0xbd79('0x32')](_0x472d1b[_0xbd79('0x2f')],_0x472d1b[_0xbd79('0x30')]);_0x28a297[_0xbd79('0x33')]=_['intersection'](_0x472d1b[_0xbd79('0x2f')],qs['fields'](_0x246ca4['query'][_0xbd79('0x34')]));_0x28a297[_0xbd79('0x33')]=_0x28a297[_0xbd79('0x33')][_0xbd79('0x35')]?_0x28a297['attributes']:_0x472d1b['model'];if(!_0x246ca4['query'][_0xbd79('0x36')]('nolimit')){_0x28a297[_0xbd79('0x1b')]=qs[_0xbd79('0x1b')](_0x246ca4[_0xbd79('0x30')][_0xbd79('0x1b')]);_0x28a297[_0xbd79('0x1a')]=qs['offset'](_0x246ca4[_0xbd79('0x30')]['offset']);}_0x28a297[_0xbd79('0x37')]=qs[_0xbd79('0x38')](_0x246ca4[_0xbd79('0x30')][_0xbd79('0x38')]);_0x28a297[_0xbd79('0x39')]=qs[_0xbd79('0x3a')](_[_0xbd79('0x3b')](_0x246ca4[_0xbd79('0x30')],_0x472d1b[_0xbd79('0x3a')]),_0x1189a6);if(_0x246ca4[_0xbd79('0x30')]['filter']){_0x28a297[_0xbd79('0x39')]=_['merge'](_0x28a297[_0xbd79('0x39')],{'$or':_[_0xbd79('0x2a')](_0x1189a6,function(_0x54074c){if(_0x54074c['type']!=='VIRTUAL'){var _0x6989c4={};_0x6989c4[_0x54074c[_0xbd79('0x28')]]={'$like':'%'+_0x246ca4[_0xbd79('0x30')]['filter']+'%'};return _0x6989c4;}})});}_0x28a297=_[_0xbd79('0x3c')]({},_0x28a297,_0x246ca4[_0xbd79('0x3d')]);var _0x212d6f={'where':_0x28a297['where']};return db[_0xbd79('0x2b')][_0xbd79('0x3e')](_0x212d6f)['then'](function(_0x1b27a8){_0x361659[_0xbd79('0x3e')]=_0x1b27a8;if(_0x246ca4[_0xbd79('0x30')][_0xbd79('0x3f')]){_0x28a297[_0xbd79('0x40')]=[{'all':!![]}];}return db['VoiceChanSpy'][_0xbd79('0x41')](_0x28a297);})[_0xbd79('0x22')](function(_0x464579){_0x361659['rows']=_0x464579;return _0x361659;})[_0xbd79('0x22')](respondWithFilteredResult(_0x39f3f0,_0x28a297))[_0xbd79('0x42')](handleError(_0x39f3f0,null));};exports[_0xbd79('0x43')]=function(_0x480740,_0x343804){var _0x173d49={'raw':![],'where':{'id':_0x480740[_0xbd79('0x44')]['id']}},_0x550532={};_0x550532[_0xbd79('0x2f')]=_[_0xbd79('0x31')](db['VoiceChanSpy'][_0xbd79('0x2c')]);_0x550532[_0xbd79('0x30')]=_['keys'](_0x480740['query']);_0x550532[_0xbd79('0x3a')]=_[_0xbd79('0x32')](_0x550532[_0xbd79('0x2f')],_0x550532[_0xbd79('0x30')]);_0x173d49[_0xbd79('0x33')]=_[_0xbd79('0x32')](_0x550532[_0xbd79('0x2f')],qs['fields'](_0x480740[_0xbd79('0x30')]['fields']));_0x173d49[_0xbd79('0x33')]=_0x173d49['attributes'][_0xbd79('0x35')]?_0x173d49[_0xbd79('0x33')]:_0x550532[_0xbd79('0x2f')];if(_0x480740[_0xbd79('0x30')][_0xbd79('0x3f')]){_0x173d49[_0xbd79('0x40')]=[{'all':!![]}];}_0x173d49=_[_0xbd79('0x3c')]({},_0x173d49,_0x480740[_0xbd79('0x3d')]);return db[_0xbd79('0x2b')]['find'](_0x173d49)['then'](handleEntityNotFound(_0x343804,null))[_0xbd79('0x22')](respondWithResult(_0x343804,null))[_0xbd79('0x42')](handleError(_0x343804,null));};exports[_0xbd79('0x45')]=function(_0x4420ee,_0x4dfba5){return db[_0xbd79('0x2b')][_0xbd79('0x45')](_0x4420ee[_0xbd79('0x46')],{})[_0xbd79('0x22')](function(_0x18595f){var _0x433215=_0x4420ee[_0xbd79('0x47')][_0xbd79('0x48')]({'plain':!![]});if(!_0x433215)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x433215[_0xbd79('0x49')]===_0xbd79('0x47')){var _0x3b50a=_0x18595f[_0xbd79('0x48')]({'plain':!![]});var _0x3390e2=_0xbd79('0x24');return db[_0xbd79('0x4a')]['find']({'where':{'name':_0x3390e2,'userProfileId':_0x433215[_0xbd79('0x4b')]},'raw':!![]})[_0xbd79('0x22')](function(_0x1921e3){if(_0x1921e3&&_0x1921e3[_0xbd79('0x4c')]===0x0){return db['UserProfileResource']['create']({'name':_0x3b50a[_0xbd79('0x28')],'resourceId':_0x3b50a['id'],'type':_0x1921e3['name'],'sectionId':_0x1921e3['id']},{})[_0xbd79('0x22')](function(){return _0x18595f;});}else{return _0x18595f;}})[_0xbd79('0x42')](function(_0x1412ad){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1412ad);throw _0x1412ad;});}return _0x18595f;})[_0xbd79('0x22')](respondWithResult(_0x4dfba5,0xc9))[_0xbd79('0x42')](handleError(_0x4dfba5,null));};exports[_0xbd79('0x21')]=function(_0x922884,_0x35787b){if(_0x922884[_0xbd79('0x46')]['id']){delete _0x922884[_0xbd79('0x46')]['id'];}return db['VoiceChanSpy'][_0xbd79('0x4d')]({'where':{'id':_0x922884['params']['id']}})[_0xbd79('0x22')](handleEntityNotFound(_0x35787b,null))[_0xbd79('0x22')](saveUpdates(_0x922884[_0xbd79('0x46')],null))[_0xbd79('0x22')](respondWithResult(_0x35787b,null))[_0xbd79('0x42')](handleError(_0x35787b,null));};exports[_0xbd79('0x23')]=function(_0x4aac08,_0x43164b){return db[_0xbd79('0x2b')][_0xbd79('0x4d')]({'where':{'id':_0x4aac08[_0xbd79('0x44')]['id']}})[_0xbd79('0x22')](handleEntityNotFound(_0x43164b,null))[_0xbd79('0x22')](removeEntity(_0x43164b,null))[_0xbd79('0x42')](handleError(_0x43164b,null));}; \ No newline at end of file +var _0x607c=['filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','fields','length','find','create','body','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','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/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','destroy','then','get','ChanSpies','UserProfileResource','stack','name','send','index','map','VoiceChanSpy','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','sort','pick'];(function(_0x4e1992,_0x3a39d4){var _0x28c0f2=function(_0x380cec){while(--_0x380cec){_0x4e1992['push'](_0x4e1992['shift']());}};_0x28c0f2(++_0x3a39d4);}(_0x607c,0x1b3));var _0xc607=function(_0x5840d9,_0x57c3a4){_0x5840d9=_0x5840d9-0x0;var _0x212e36=_0x607c[_0x5840d9];return _0x212e36;};'use strict';var pdf=require(_0xc607('0x0'));var emlformat=require(_0xc607('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xc607('0x2'));var jsonpatch=require(_0xc607('0x3'));var rp=require(_0xc607('0x4'));var moment=require(_0xc607('0x5'));var BPromise=require(_0xc607('0x6'));var Mustache=require(_0xc607('0x7'));var util=require('util');var path=require(_0xc607('0x8'));var sox=require(_0xc607('0x9'));var csv=require(_0xc607('0xa'));var ejs=require(_0xc607('0xb'));var fs=require('fs');var _=require(_0xc607('0xc'));var squel=require(_0xc607('0xd'));var crypto=require(_0xc607('0xe'));var jsforce=require(_0xc607('0xf'));var deskjs=require(_0xc607('0x10'));var toCsv=require(_0xc607('0xa'));var querystring=require(_0xc607('0x11'));var Papa=require(_0xc607('0x12'));var Redis=require(_0xc607('0x13'));var authService=require(_0xc607('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xc607('0x15'));var hardwareService=require(_0xc607('0x16'));var logger=require('../../config/logger')(_0xc607('0x17'));var utils=require(_0xc607('0x18'));var config=require(_0xc607('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x57328d,_0x13164d){_0x13164d=_0x13164d||0xcc;return function(_0x56f1ac){if(_0x56f1ac){return _0x57328d[_0xc607('0x1a')](_0x13164d);}return _0x57328d[_0xc607('0x1b')](_0x13164d)[_0xc607('0x1c')]();};}function respondWithResult(_0x4f9931,_0xa5bebf){_0xa5bebf=_0xa5bebf||0xc8;return function(_0x17cae8){if(_0x17cae8){return _0x4f9931['status'](_0xa5bebf)[_0xc607('0x1d')](_0x17cae8);}};}function respondWithFilteredResult(_0x2e8b19,_0x14a9aa){return function(_0x576feb){if(_0x576feb){var _0x4fc0b0=_0x576feb[_0xc607('0x1e')],_0x322db0=_0x14a9aa[_0xc607('0x1f')],_0x3d2e40=_0x14a9aa['offset']+_0x14a9aa[_0xc607('0x20')],_0x20ff8e;if(_0x3d2e40>=_0x4fc0b0){_0x3d2e40=_0x4fc0b0;_0x20ff8e=0xc8;}else{_0x20ff8e=0xce;}_0x2e8b19['status'](_0x20ff8e);return _0x2e8b19[_0xc607('0x21')]('Content-Range',_0x322db0+'-'+_0x3d2e40+'/'+_0x4fc0b0)[_0xc607('0x1d')](_0x576feb);}return null;};}function patchUpdates(_0x1546d2){return function(_0xc5ba84){try{jsonpatch[_0xc607('0x22')](_0xc5ba84,_0x1546d2,!![]);}catch(_0xee6efd){return BPromise[_0xc607('0x23')](_0xee6efd);}return _0xc5ba84[_0xc607('0x24')]();};}function saveUpdates(_0x265422,_0x50dcb4){return function(_0x127ea7){if(_0x127ea7){return _0x127ea7[_0xc607('0x25')](_0x265422)['then'](function(_0x46a568){return _0x46a568;});}return null;};}function removeEntity(_0x5ad6df,_0x344779){return function(_0x4f9c16){if(_0x4f9c16){return _0x4f9c16[_0xc607('0x26')]()[_0xc607('0x27')](function(){var _0x633210=_0x4f9c16[_0xc607('0x28')]({'plain':!![]});var _0x18557e=_0xc607('0x29');return db[_0xc607('0x2a')][_0xc607('0x26')]({'where':{'type':_0x18557e,'resourceId':_0x633210['id']}})['then'](function(){return _0x4f9c16;});})['then'](function(){_0x5ad6df[_0xc607('0x1b')](0xcc)[_0xc607('0x1c')]();});}};}function handleEntityNotFound(_0x1c8c94,_0x484c9d){return function(_0x50ded7){if(!_0x50ded7){_0x1c8c94[_0xc607('0x1a')](0x194);}return _0x50ded7;};}function handleError(_0x5067b2,_0x29cb98){_0x29cb98=_0x29cb98||0x1f4;return function(_0x2378d7){logger['error'](_0x2378d7[_0xc607('0x2b')]);if(_0x2378d7[_0xc607('0x2c')]){delete _0x2378d7[_0xc607('0x2c')];}_0x5067b2[_0xc607('0x1b')](_0x29cb98)[_0xc607('0x2d')](_0x2378d7);};}exports[_0xc607('0x2e')]=function(_0x234146,_0x179896){var _0x18c530={},_0x3274f4={},_0x27eafc={'count':0x0,'rows':[]};var _0xef833=_[_0xc607('0x2f')](db[_0xc607('0x30')][_0xc607('0x31')],function(_0x2f4b7f){return{'name':_0x2f4b7f[_0xc607('0x32')],'type':_0x2f4b7f[_0xc607('0x33')][_0xc607('0x34')]};});_0x3274f4[_0xc607('0x35')]=_[_0xc607('0x2f')](_0xef833,_0xc607('0x2c'));_0x3274f4[_0xc607('0x36')]=_[_0xc607('0x37')](_0x234146[_0xc607('0x36')]);_0x3274f4[_0xc607('0x38')]=_[_0xc607('0x39')](_0x3274f4[_0xc607('0x35')],_0x3274f4['query']);_0x18c530['attributes']=_[_0xc607('0x39')](_0x3274f4['model'],qs['fields'](_0x234146['query']['fields']));_0x18c530[_0xc607('0x3a')]=_0x18c530[_0xc607('0x3a')]['length']?_0x18c530[_0xc607('0x3a')]:_0x3274f4[_0xc607('0x35')];if(!_0x234146[_0xc607('0x36')][_0xc607('0x3b')](_0xc607('0x3c'))){_0x18c530[_0xc607('0x20')]=qs[_0xc607('0x20')](_0x234146['query']['limit']);_0x18c530[_0xc607('0x1f')]=qs[_0xc607('0x1f')](_0x234146['query'][_0xc607('0x1f')]);}_0x18c530['order']=qs[_0xc607('0x3d')](_0x234146['query'][_0xc607('0x3d')]);_0x18c530['where']=qs[_0xc607('0x38')](_[_0xc607('0x3e')](_0x234146[_0xc607('0x36')],_0x3274f4[_0xc607('0x38')]),_0xef833);if(_0x234146[_0xc607('0x36')][_0xc607('0x3f')]){_0x18c530['where']=_[_0xc607('0x40')](_0x18c530['where'],{'$or':_[_0xc607('0x2f')](_0xef833,function(_0x19d835){if(_0x19d835[_0xc607('0x33')]!==_0xc607('0x41')){var _0x4b1786={};_0x4b1786[_0x19d835[_0xc607('0x2c')]]={'$like':'%'+_0x234146['query']['filter']+'%'};return _0x4b1786;}})});}_0x18c530=_[_0xc607('0x40')]({},_0x18c530,_0x234146[_0xc607('0x42')]);var _0xf992f5={'where':_0x18c530['where']};return db[_0xc607('0x30')][_0xc607('0x1e')](_0xf992f5)[_0xc607('0x27')](function(_0x38a1ed){_0x27eafc[_0xc607('0x1e')]=_0x38a1ed;if(_0x234146[_0xc607('0x36')][_0xc607('0x43')]){_0x18c530['include']=[{'all':!![]}];}return db[_0xc607('0x30')][_0xc607('0x44')](_0x18c530);})['then'](function(_0xf23a8d){_0x27eafc[_0xc607('0x45')]=_0xf23a8d;return _0x27eafc;})[_0xc607('0x27')](respondWithFilteredResult(_0x179896,_0x18c530))[_0xc607('0x46')](handleError(_0x179896,null));};exports[_0xc607('0x47')]=function(_0x5299fd,_0x2e3d90){var _0x6814d7={'raw':![],'where':{'id':_0x5299fd[_0xc607('0x48')]['id']}},_0x482721={};_0x482721[_0xc607('0x35')]=_[_0xc607('0x37')](db[_0xc607('0x30')]['rawAttributes']);_0x482721[_0xc607('0x36')]=_[_0xc607('0x37')](_0x5299fd[_0xc607('0x36')]);_0x482721['filters']=_['intersection'](_0x482721[_0xc607('0x35')],_0x482721[_0xc607('0x36')]);_0x6814d7[_0xc607('0x3a')]=_['intersection'](_0x482721[_0xc607('0x35')],qs[_0xc607('0x49')](_0x5299fd[_0xc607('0x36')][_0xc607('0x49')]));_0x6814d7['attributes']=_0x6814d7['attributes'][_0xc607('0x4a')]?_0x6814d7['attributes']:_0x482721['model'];if(_0x5299fd[_0xc607('0x36')]['includeAll']){_0x6814d7['include']=[{'all':!![]}];}_0x6814d7=_['merge']({},_0x6814d7,_0x5299fd[_0xc607('0x42')]);return db[_0xc607('0x30')][_0xc607('0x4b')](_0x6814d7)['then'](handleEntityNotFound(_0x2e3d90,null))[_0xc607('0x27')](respondWithResult(_0x2e3d90,null))[_0xc607('0x46')](handleError(_0x2e3d90,null));};exports['create']=function(_0x32f0b4,_0xf1682f){return db[_0xc607('0x30')][_0xc607('0x4c')](_0x32f0b4[_0xc607('0x4d')],{})[_0xc607('0x27')](function(_0x9eedd3){var _0x5e7b41=_0x32f0b4[_0xc607('0x4e')][_0xc607('0x28')]({'plain':!![]});if(!_0x5e7b41)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5e7b41['role']===_0xc607('0x4e')){var _0x1c43df=_0x9eedd3[_0xc607('0x28')]({'plain':!![]});var _0x23fc02=_0xc607('0x29');return db[_0xc607('0x4f')][_0xc607('0x4b')]({'where':{'name':_0x23fc02,'userProfileId':_0x5e7b41[_0xc607('0x50')]},'raw':!![]})[_0xc607('0x27')](function(_0x1a7b18){if(_0x1a7b18&&_0x1a7b18[_0xc607('0x51')]===0x0){return db[_0xc607('0x2a')][_0xc607('0x4c')]({'name':_0x1c43df['name'],'resourceId':_0x1c43df['id'],'type':_0x1a7b18[_0xc607('0x2c')],'sectionId':_0x1a7b18['id']},{})[_0xc607('0x27')](function(){return _0x9eedd3;});}else{return _0x9eedd3;}})[_0xc607('0x46')](function(_0x22698f){logger['error'](_0xc607('0x52'),_0x22698f);throw _0x22698f;});}return _0x9eedd3;})[_0xc607('0x27')](respondWithResult(_0xf1682f,0xc9))['catch'](handleError(_0xf1682f,null));};exports['update']=function(_0x1aa160,_0x4f75c7){if(_0x1aa160['body']['id']){delete _0x1aa160[_0xc607('0x4d')]['id'];}return db[_0xc607('0x30')][_0xc607('0x4b')]({'where':{'id':_0x1aa160[_0xc607('0x48')]['id']}})[_0xc607('0x27')](handleEntityNotFound(_0x4f75c7,null))[_0xc607('0x27')](saveUpdates(_0x1aa160[_0xc607('0x4d')],null))[_0xc607('0x27')](respondWithResult(_0x4f75c7,null))[_0xc607('0x46')](handleError(_0x4f75c7,null));};exports[_0xc607('0x26')]=function(_0x573258,_0x502cc7){return db[_0xc607('0x30')][_0xc607('0x4b')]({'where':{'id':_0x573258[_0xc607('0x48')]['id']}})[_0xc607('0x27')](handleEntityNotFound(_0x502cc7,null))[_0xc607('0x27')](removeEntity(_0x502cc7,null))[_0xc607('0x46')](handleError(_0x502cc7,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index b117458..413f80b 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 _0x81dc=['%s%s','system','push','merge','Set','CDR(type)=%s','chanspy','record','MixMonitor','format','${UNIQUEID}.%s,a','recordingFormat','Authenticate','ChanSpy','options','join','length','internal','name','then','catch','exports','VoiceChanSpy','VoiceExtension','destroy','util','bluebird','./voiceChanSpy.attributes','from-sip'];(function(_0x4dce10,_0x51d9c7){var _0x277d58=function(_0x4b3503){while(--_0x4b3503){_0x4dce10['push'](_0x4dce10['shift']());}};_0x277d58(++_0x51d9c7);}(_0x81dc,0x1e9));var _0xc81d=function(_0x29771f,_0x1189ae){_0x29771f=_0x29771f-0x0;var _0x279baf=_0x81dc[_0x29771f];return _0x279baf;};'use strict';var _=require('lodash');var util=require(_0xc81d('0x0'));var BPromise=require(_0xc81d('0x1'));var attributes=require(_0xc81d('0x2'));var getUserApplications=function(_0x21eeaa,_0x42b9a8,_0x50c099){var _0x574c44=0x1;var _0x2a4396=[];var _0x28fb3d={'context':_0x42b9a8['context']||_0xc81d('0x3'),'exten':util['format'](_0xc81d('0x4'),_0x21eeaa['prefix'],_0x50c099),'type':_0xc81d('0x5'),'isApp':![],'ChanSpyId':_0x21eeaa['id'],'UserId':_0x42b9a8['id']};_0x2a4396[_0xc81d('0x6')](_[_0xc81d('0x7')]({'app':_0xc81d('0x8'),'appdata':util['format'](_0xc81d('0x9'),_0xc81d('0xa')),'priority':_0x574c44++},_0x28fb3d));if(_0x21eeaa[_0xc81d('0xb')]){_0x2a4396[_0xc81d('0x6')](_[_0xc81d('0x7')]({'app':_0xc81d('0xc'),'appdata':util[_0xc81d('0xd')](_0xc81d('0xe'),_0x21eeaa[_0xc81d('0xf')]),'priority':_0x574c44++},_0x28fb3d));}if(_0x21eeaa['auth']){_0x2a4396[_0xc81d('0x6')](_[_0xc81d('0x7')]({'app':_0xc81d('0x10'),'appdata':_0x21eeaa['password'],'priority':_0x574c44++},_0x28fb3d));}_0x2a4396[_0xc81d('0x6')](_['merge']({'app':_0xc81d('0x11'),'appdata':util['format']('SIP/%s,%s',_0x42b9a8['name'],_0x21eeaa['options']?_0x21eeaa[_0xc81d('0x12')][_0xc81d('0x13')](''):''),'priority':_0x574c44++},_0x28fb3d));if(_0x21eeaa[_0xc81d('0xb')]){_0x2a4396[_0xc81d('0x6')](_[_0xc81d('0x7')]({'app':'StopMixMonitor','priority':_0x574c44++},_0x28fb3d));}return _0x2a4396;};var getChanSpyApplications=function(_0x329b86,_0x5e052a){var _0x472704=[];for(var _0x4f2f26=0x0,_0x2f8eea=0x1;_0x4f2f26<_0x5e052a[_0xc81d('0x14')];_0x4f2f26++,_0x2f8eea=0x1){_0x472704=_0x472704['concat'](getUserApplications(_0x329b86,_0x5e052a[_0x4f2f26],_0x5e052a[_0x4f2f26]['internal']));if(_0x5e052a[_0x4f2f26][_0xc81d('0x15')]!=_0x5e052a[_0x4f2f26][_0xc81d('0x16')]){_0x472704=_0x472704['concat'](getUserApplications(_0x329b86,_0x5e052a[_0x4f2f26],_0x5e052a[_0x4f2f26]['name']));}}return _0x472704;};var getChanSpyPromise=function(_0x4594c6,_0x12bee8){return new BPromise(function(_0x3986b6,_0x4a2311){return _0x4594c6['User']['findAll']({'attributes':['id',_0xc81d('0x16'),_0xc81d('0x15')],'where':{'role':'agent','chanspy':!![]},'raw':!![]})[_0xc81d('0x17')](function(_0x1c9b05){if(_0x1c9b05){return _0x3986b6(getChanSpyApplications(_0x12bee8,_0x1c9b05));}return _0x3986b6([]);})[_0xc81d('0x18')](function(_0x462610){_0x4a2311(_0x462610);});});};module[_0xc81d('0x19')]=function(_0x5abc2e,_0x76d918){var _0x44e5f3=_0x5abc2e['models'];return _0x5abc2e['define'](_0xc81d('0x1a'),attributes,{'tableName':'voice_chanspy','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x1680a1,_0x159e54,_0x499f12){return getChanSpyPromise(_0x44e5f3,_0x1680a1)[_0xc81d('0x17')](function(_0x2b10d7){if(_0x2b10d7&&_0x2b10d7[_0xc81d('0x14')]){return _0x44e5f3[_0xc81d('0x1b')]['bulkCreate'](_0x2b10d7);}})['then'](function(){_0x499f12();})[_0xc81d('0x18')](function(_0x3dbd77){_0x499f12(_0x3dbd77);});},'afterUpdate':function(_0x3ea8e3,_0xd7f406,_0x18ab23){return _0x44e5f3[_0xc81d('0x1b')][_0xc81d('0x1c')]({'where':{'ChanSpyId':_0x3ea8e3['id']}})['then'](function(){return getChanSpyPromise(_0x44e5f3,_0x3ea8e3);})[_0xc81d('0x17')](function(_0x55719a){if(_0x55719a&&_0x55719a[_0xc81d('0x14')]){return _0x44e5f3[_0xc81d('0x1b')]['bulkCreate'](_0x55719a);}})['then'](function(){_0x18ab23();})['catch'](function(_0x153253){_0x18ab23(_0x153253);});},'afterDestroy':function(_0x2fc203,_0x5f4cc2,_0x1dba9c){return _0x44e5f3[_0xc81d('0x1b')][_0xc81d('0x1c')]({'where':{'ChanSpyId':_0x2fc203['id']}})['then'](function(){_0x1dba9c();})[_0xc81d('0x18')](function(_0x2b8a3f){_0x1dba9c(_0x2b8a3f);});}}});}; \ No newline at end of file +var _0x0194=['record','push','${UNIQUEID}.%s,a','recordingFormat','Authenticate','password','ChanSpy','options','join','StopMixMonitor','length','concat','internal','name','User','findAll','agent','then','catch','exports','define','VoiceChanSpy','VoiceExtension','bulkCreate','destroy','bluebird','./voiceChanSpy.attributes','context','format','%s%s','prefix','system','merge','Set','CDR(type)=%s','chanspy'];(function(_0x102e37,_0x14a181){var _0x35a07c=function(_0x16577f){while(--_0x16577f){_0x102e37['push'](_0x102e37['shift']());}};_0x35a07c(++_0x14a181);}(_0x0194,0xf1));var _0x4019=function(_0x20dd4e,_0x201286){_0x20dd4e=_0x20dd4e-0x0;var _0x3ff49b=_0x0194[_0x20dd4e];return _0x3ff49b;};'use strict';var _=require('lodash');var util=require('util');var BPromise=require(_0x4019('0x0'));var attributes=require(_0x4019('0x1'));var getUserApplications=function(_0x3c1686,_0x5333a5,_0x4422b2){var _0x265f28=0x1;var _0x41860d=[];var _0x344527={'context':_0x5333a5[_0x4019('0x2')]||'from-sip','exten':util[_0x4019('0x3')](_0x4019('0x4'),_0x3c1686[_0x4019('0x5')],_0x4422b2),'type':_0x4019('0x6'),'isApp':![],'ChanSpyId':_0x3c1686['id'],'UserId':_0x5333a5['id']};_0x41860d['push'](_[_0x4019('0x7')]({'app':_0x4019('0x8'),'appdata':util[_0x4019('0x3')](_0x4019('0x9'),_0x4019('0xa')),'priority':_0x265f28++},_0x344527));if(_0x3c1686[_0x4019('0xb')]){_0x41860d[_0x4019('0xc')](_['merge']({'app':'MixMonitor','appdata':util[_0x4019('0x3')](_0x4019('0xd'),_0x3c1686[_0x4019('0xe')]),'priority':_0x265f28++},_0x344527));}if(_0x3c1686['auth']){_0x41860d['push'](_[_0x4019('0x7')]({'app':_0x4019('0xf'),'appdata':_0x3c1686[_0x4019('0x10')],'priority':_0x265f28++},_0x344527));}_0x41860d['push'](_[_0x4019('0x7')]({'app':_0x4019('0x11'),'appdata':util['format']('SIP/%s,%s',_0x5333a5['name'],_0x3c1686[_0x4019('0x12')]?_0x3c1686[_0x4019('0x12')][_0x4019('0x13')](''):''),'priority':_0x265f28++},_0x344527));if(_0x3c1686['record']){_0x41860d[_0x4019('0xc')](_['merge']({'app':_0x4019('0x14'),'priority':_0x265f28++},_0x344527));}return _0x41860d;};var getChanSpyApplications=function(_0x5be165,_0x5bdc33){var _0x52c73a=[];for(var _0x5f0371=0x0,_0xa738f4=0x1;_0x5f0371<_0x5bdc33[_0x4019('0x15')];_0x5f0371++,_0xa738f4=0x1){_0x52c73a=_0x52c73a[_0x4019('0x16')](getUserApplications(_0x5be165,_0x5bdc33[_0x5f0371],_0x5bdc33[_0x5f0371]['internal']));if(_0x5bdc33[_0x5f0371][_0x4019('0x17')]!=_0x5bdc33[_0x5f0371]['name']){_0x52c73a=_0x52c73a[_0x4019('0x16')](getUserApplications(_0x5be165,_0x5bdc33[_0x5f0371],_0x5bdc33[_0x5f0371][_0x4019('0x18')]));}}return _0x52c73a;};var getChanSpyPromise=function(_0x35e403,_0x3ff7c2){return new BPromise(function(_0x44e951,_0x7ccc8f){return _0x35e403[_0x4019('0x19')][_0x4019('0x1a')]({'attributes':['id',_0x4019('0x18'),_0x4019('0x17')],'where':{'role':_0x4019('0x1b'),'chanspy':!![]},'raw':!![]})[_0x4019('0x1c')](function(_0x40bdb2){if(_0x40bdb2){return _0x44e951(getChanSpyApplications(_0x3ff7c2,_0x40bdb2));}return _0x44e951([]);})[_0x4019('0x1d')](function(_0x161d4e){_0x7ccc8f(_0x161d4e);});});};module[_0x4019('0x1e')]=function(_0x2d1ed1,_0x4cf51b){var _0x43ba22=_0x2d1ed1['models'];return _0x2d1ed1[_0x4019('0x1f')](_0x4019('0x20'),attributes,{'tableName':'voice_chanspy','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x4b696f,_0x2083b2,_0x5f32c0){return getChanSpyPromise(_0x43ba22,_0x4b696f)['then'](function(_0x5708a7){if(_0x5708a7&&_0x5708a7[_0x4019('0x15')]){return _0x43ba22[_0x4019('0x21')][_0x4019('0x22')](_0x5708a7);}})[_0x4019('0x1c')](function(){_0x5f32c0();})[_0x4019('0x1d')](function(_0x3bb89f){_0x5f32c0(_0x3bb89f);});},'afterUpdate':function(_0x53c62b,_0x3d6fda,_0x43f684){return _0x43ba22[_0x4019('0x21')][_0x4019('0x23')]({'where':{'ChanSpyId':_0x53c62b['id']}})[_0x4019('0x1c')](function(){return getChanSpyPromise(_0x43ba22,_0x53c62b);})[_0x4019('0x1c')](function(_0x5211cb){if(_0x5211cb&&_0x5211cb[_0x4019('0x15')]){return _0x43ba22[_0x4019('0x21')][_0x4019('0x22')](_0x5211cb);}})[_0x4019('0x1c')](function(){_0x43f684();})[_0x4019('0x1d')](function(_0x5b5d23){_0x43f684(_0x5b5d23);});},'afterDestroy':function(_0x3e50e9,_0x75525b,_0x45d21c){return _0x43ba22['VoiceExtension'][_0x4019('0x23')]({'where':{'ChanSpyId':_0x3e50e9['id']}})['then'](function(){_0x45d21c();})['catch'](function(_0x50a721){_0x45d21c(_0x50a721);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 5a2222a..2992737 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 _0x6e36=['request','then','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','VoiceChanSpy,\x20%s,\x20%s,\x20%s','error','message','result','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0xf7f60a,_0x15f736){var _0x2567ad=function(_0x396850){while(--_0x396850){_0xf7f60a['push'](_0xf7f60a['shift']());}};_0x2567ad(++_0x15f736);}(_0x6e36,0x95));var _0x66e3=function(_0x2580f3,_0x57d2ca){_0x2580f3=_0x2580f3-0x0;var _0x3ccf92=_0x6e36[_0x2580f3];return _0x3ccf92;};'use strict';var _=require('lodash');var util=require(_0x66e3('0x0'));var moment=require(_0x66e3('0x1'));var BPromise=require(_0x66e3('0x2'));var rs=require(_0x66e3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x66e3('0x4'))['db'];var utils=require(_0x66e3('0x5'));var logger=require(_0x66e3('0x6'))('rpc');var config=require(_0x66e3('0x7'));var jayson=require(_0x66e3('0x8'));var client=jayson[_0x66e3('0x9')][_0x66e3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x223be8,_0x30f641,_0x446bce){return new BPromise(function(_0x5eb4ea,_0x1296c7){return client[_0x66e3('0xb')](_0x223be8,_0x446bce)[_0x66e3('0xc')](function(_0x405993){logger[_0x66e3('0xd')](_0x66e3('0xe'),_0x30f641,_0x66e3('0xf'));logger['debug'](_0x66e3('0x10'),_0x30f641,_0x66e3('0xf'),JSON['stringify'](_0x405993));if(_0x405993[_0x66e3('0x11')]){if(_0x405993['error']['code']===0x1f4){logger[_0x66e3('0x11')](_0x66e3('0xe'),_0x30f641,_0x405993[_0x66e3('0x11')][_0x66e3('0x12')]);return _0x1296c7(_0x405993[_0x66e3('0x11')][_0x66e3('0x12')]);}logger[_0x66e3('0x11')](_0x66e3('0xe'),_0x30f641,_0x405993[_0x66e3('0x11')][_0x66e3('0x12')]);return _0x5eb4ea(_0x405993[_0x66e3('0x11')][_0x66e3('0x12')]);}else{logger['info']('VoiceChanSpy,\x20%s,\x20%s',_0x30f641,'request\x20sent');_0x5eb4ea(_0x405993[_0x66e3('0x13')][_0x66e3('0x12')]);}})['catch'](function(_0x2cb19c){logger[_0x66e3('0x11')](_0x66e3('0xe'),_0x30f641,_0x2cb19c);_0x1296c7(_0x2cb19c);});});} \ No newline at end of file +var _0x25b5=['bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util'];(function(_0x997ede,_0x5a0814){var _0x1f3288=function(_0x5ddd2a){while(--_0x5ddd2a){_0x997ede['push'](_0x997ede['shift']());}};_0x1f3288(++_0x5a0814);}(_0x25b5,0x196));var _0x525b=function(_0x545e54,_0x5bc73a){_0x545e54=_0x545e54-0x0;var _0x269883=_0x25b5[_0x545e54];return _0x269883;};'use strict';var _=require(_0x525b('0x0'));var util=require(_0x525b('0x1'));var moment=require('moment');var BPromise=require(_0x525b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x525b('0x3'));var db=require(_0x525b('0x4'))['db'];var utils=require(_0x525b('0x5'));var logger=require('../../config/logger')(_0x525b('0x6'));var config=require(_0x525b('0x7'));var jayson=require(_0x525b('0x8'));var client=jayson[_0x525b('0x9')][_0x525b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x55ab76,_0x17c0cb,_0x58c8f1){return new BPromise(function(_0x2e0942,_0x498882){return client[_0x525b('0xb')](_0x55ab76,_0x58c8f1)[_0x525b('0xc')](function(_0xe33f38){logger[_0x525b('0xd')](_0x525b('0xe'),_0x17c0cb,_0x525b('0xf'));logger[_0x525b('0x10')](_0x525b('0x11'),_0x17c0cb,_0x525b('0xf'),JSON[_0x525b('0x12')](_0xe33f38));if(_0xe33f38[_0x525b('0x13')]){if(_0xe33f38[_0x525b('0x13')][_0x525b('0x14')]===0x1f4){logger['error'](_0x525b('0xe'),_0x17c0cb,_0xe33f38[_0x525b('0x13')][_0x525b('0x15')]);return _0x498882(_0xe33f38[_0x525b('0x13')][_0x525b('0x15')]);}logger[_0x525b('0x13')]('VoiceChanSpy,\x20%s,\x20%s',_0x17c0cb,_0xe33f38[_0x525b('0x13')][_0x525b('0x15')]);return _0x2e0942(_0xe33f38[_0x525b('0x13')]['message']);}else{logger['info'](_0x525b('0xe'),_0x17c0cb,_0x525b('0xf'));_0x2e0942(_0xe33f38[_0x525b('0x16')][_0x525b('0x15')]);}})[_0x525b('0x17')](function(_0x13fcc1){logger[_0x525b('0x13')](_0x525b('0xe'),_0x17c0cb,_0x13fcc1);_0x498882(_0x13fcc1);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index e6fcbe1..93456a2 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 _0x7466=['../../components/auth/service','../../config/environment','./voiceContext.controller','get','index','show','post','isAuthenticated','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x29920c,_0x57fb6f){var _0x49bd86=function(_0x36262e){while(--_0x36262e){_0x29920c['push'](_0x29920c['shift']());}};_0x49bd86(++_0x57fb6f);}(_0x7466,0xa6));var _0x6746=function(_0xd6cb8d,_0x50238b){_0xd6cb8d=_0xd6cb8d-0x0;var _0x24c790=_0x7466[_0xd6cb8d];return _0x24c790;};'use strict';var multer=require(_0x6746('0x0'));var util=require(_0x6746('0x1'));var path=require(_0x6746('0x2'));var timeout=require(_0x6746('0x3'));var express=require(_0x6746('0x4'));var router=express['Router']();var auth=require(_0x6746('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x6746('0x6'));var controller=require(_0x6746('0x7'));router[_0x6746('0x8')]('/',auth['isAuthenticated'](),controller[_0x6746('0x9')]);router[_0x6746('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x6746('0xa')]);router[_0x6746('0xb')]('/',auth[_0x6746('0xc')](),controller[_0x6746('0xd')]);router[_0x6746('0xe')]('/:id',auth[_0x6746('0xc')](),controller[_0x6746('0xf')]);router[_0x6746('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x6746('0x11')]);module[_0x6746('0x12')]=router; \ No newline at end of file +var _0x0dcb=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceContext.controller','get','index','isAuthenticated','post','create','put','/:id','update','destroy','exports','multer'];(function(_0x12aaee,_0x5bf50c){var _0x37c350=function(_0x182775){while(--_0x182775){_0x12aaee['push'](_0x12aaee['shift']());}};_0x37c350(++_0x5bf50c);}(_0x0dcb,0x1a3));var _0xb0dc=function(_0x1a63fb,_0x597fe7){_0x1a63fb=_0x1a63fb-0x0;var _0x5f1c6b=_0x0dcb[_0x1a63fb];return _0x5f1c6b;};'use strict';var multer=require(_0xb0dc('0x0'));var util=require(_0xb0dc('0x1'));var path=require(_0xb0dc('0x2'));var timeout=require(_0xb0dc('0x3'));var express=require(_0xb0dc('0x4'));var router=express[_0xb0dc('0x5')]();var auth=require(_0xb0dc('0x6'));var interaction=require(_0xb0dc('0x7'));var config=require(_0xb0dc('0x8'));var controller=require(_0xb0dc('0x9'));router[_0xb0dc('0xa')]('/',auth['isAuthenticated'](),controller[_0xb0dc('0xb')]);router[_0xb0dc('0xa')]('/:id',auth[_0xb0dc('0xc')](),controller['show']);router[_0xb0dc('0xd')]('/',auth[_0xb0dc('0xc')](),controller[_0xb0dc('0xe')]);router[_0xb0dc('0xf')](_0xb0dc('0x10'),auth['isAuthenticated'](),controller[_0xb0dc('0x11')]);router['delete'](_0xb0dc('0x10'),auth[_0xb0dc('0xc')](),controller[_0xb0dc('0x12')]);module[_0xb0dc('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 70311f5..7679dd0 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 _0x3e74=['name','sequelize','STRING'];(function(_0x4af8a5,_0x235b51){var _0x2f73a0=function(_0x62bae6){while(--_0x62bae6){_0x4af8a5['push'](_0x4af8a5['shift']());}};_0x2f73a0(++_0x235b51);}(_0x3e74,0x175));var _0x43e7=function(_0x21dcd3,_0x178329){_0x21dcd3=_0x21dcd3-0x0;var _0x341561=_0x3e74[_0x21dcd3];return _0x341561;};'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 +var _0x9c44=['BOOLEAN','STRING','name'];(function(_0x24d910,_0x6c4d3c){var _0x242bb3=function(_0xc1e7c3){while(--_0xc1e7c3){_0x24d910['push'](_0x24d910['shift']());}};_0x242bb3(++_0x6c4d3c);}(_0x9c44,0x178));var _0x49c4=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x9c44[_0x13e741];return _0x3f8bb3;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x49c4('0x0')],'unique':_0x49c4('0x1')},'description':{'type':Sequelize[_0x49c4('0x0')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x49c4('0x2')],'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 75a190b..95658a1 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 _0x7217=['ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','http','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~!@#$%^&-_=+[{]}.','request','VoiceContext,\x20%s,\x20%s','debug','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','sendStatus','status','end','count','offset','limit','Content-Range','json','apply','save','update','destroy','then','get','Contexts','UserProfileResource','stack','name','send','map','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','VoiceContext','includeAll','include','findAll','show','params','length','options','find','create','body','join','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','role','user','UserProfileSection','userProfileId','autoAssociation','readFileSync','root','server/files/templates/context.ejs','utf8','chan_sip.so','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x44a64f,_0x38475c){var _0x52024b=function(_0x2cd055){while(--_0x2cd055){_0x44a64f['push'](_0x44a64f['shift']());}};_0x52024b(++_0x38475c);}(_0x7217,0x19e));var _0x7721=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0x7217[_0x387777];return _0x3f84c0;};'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 db=require(_0x7721('0x1a'))['db'];var jayson=require(_0x7721('0x1b'));var client=jayson['client'][_0x7721('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x199930,_0x57ff6d,_0x109900){if(_0x109900){var _0x30da54=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x30da54[_0x7721('0x1d')](_0x57ff6d)){return _0x199930;}else{throw new db[(_0x7721('0x1e'))]['ValidationError'](_0x7721('0x1f'));}}else{return _0x199930;}}function respondWithRpcPromise(_0x25b1c0,_0x534f1b,_0x4e199a,_0x4b183e){return new BPromise(function(_0x5ed54,_0x25a628){var _0x3cc909=_0x4b183e||client;return _0x3cc909[_0x7721('0x20')](_0x25b1c0,_0x4e199a)['then'](function(_0x20f669){logger['info'](_0x7721('0x21'),_0x534f1b,'request\x20sent');logger[_0x7721('0x22')](_0x7721('0x23'),_0x534f1b,_0x7721('0x24'),JSON[_0x7721('0x25')](_0x20f669));if(_0x20f669[_0x7721('0x26')]){if(_0x20f669[_0x7721('0x26')][_0x7721('0x27')]===0x1f4){logger[_0x7721('0x26')](_0x7721('0x21'),_0x534f1b,_0x20f669[_0x7721('0x26')]['message']);return _0x25a628(_0x20f669[_0x7721('0x26')][_0x7721('0x28')]);}logger[_0x7721('0x26')](_0x7721('0x21'),_0x534f1b,_0x20f669['error'][_0x7721('0x28')]);return _0x5ed54(_0x20f669['error'][_0x7721('0x28')]);}else{logger[_0x7721('0x29')](_0x7721('0x21'),_0x534f1b,_0x7721('0x24'));_0x5ed54(_0x20f669[_0x7721('0x2a')][_0x7721('0x28')]);}})[_0x7721('0x2b')](function(_0x5b4d74){logger[_0x7721('0x26')](_0x7721('0x21'),_0x534f1b,_0x5b4d74);_0x25a628(_0x5b4d74);});});}function respondWithStatusCode(_0x125564,_0x1f67c7){_0x1f67c7=_0x1f67c7||0xcc;return function(_0x40d550){if(_0x40d550){return _0x125564[_0x7721('0x2c')](_0x1f67c7);}return _0x125564[_0x7721('0x2d')](_0x1f67c7)[_0x7721('0x2e')]();};}function respondWithResult(_0x40f367,_0x52316e){_0x52316e=_0x52316e||0xc8;return function(_0x258ddf){if(_0x258ddf){return _0x40f367['status'](_0x52316e)['json'](_0x258ddf);}};}function respondWithFilteredResult(_0x315202,_0x343c19){return function(_0x53c904){if(_0x53c904){var _0x158d98=_0x53c904[_0x7721('0x2f')],_0x1ea4d=_0x343c19['offset'],_0x37b9f0=_0x343c19[_0x7721('0x30')]+_0x343c19[_0x7721('0x31')],_0xd7d703;if(_0x37b9f0>=_0x158d98){_0x37b9f0=_0x158d98;_0xd7d703=0xc8;}else{_0xd7d703=0xce;}_0x315202['status'](_0xd7d703);return _0x315202['set'](_0x7721('0x32'),_0x1ea4d+'-'+_0x37b9f0+'/'+_0x158d98)[_0x7721('0x33')](_0x53c904);}return null;};}function patchUpdates(_0x48f329){return function(_0x46f772){try{jsonpatch[_0x7721('0x34')](_0x46f772,_0x48f329,!![]);}catch(_0x382821){return BPromise['reject'](_0x382821);}return _0x46f772[_0x7721('0x35')]();};}function saveUpdates(_0x1ff31b,_0x1492d4){return function(_0x3f15e2){if(_0x3f15e2){return _0x3f15e2[_0x7721('0x36')](_0x1ff31b)['then'](function(_0x195ffb){return _0x195ffb;});}return null;};}function removeEntity(_0x3e4e56,_0xb2386d){return function(_0x5c5b33){if(_0x5c5b33){return _0x5c5b33[_0x7721('0x37')]()[_0x7721('0x38')](function(){var _0x498654=_0x5c5b33[_0x7721('0x39')]({'plain':!![]});var _0x5ce026=_0x7721('0x3a');return db[_0x7721('0x3b')][_0x7721('0x37')]({'where':{'type':_0x5ce026,'resourceId':_0x498654['id']}})[_0x7721('0x38')](function(){return _0x5c5b33;});})[_0x7721('0x38')](function(){_0x3e4e56[_0x7721('0x2d')](0xcc)[_0x7721('0x2e')]();});}};}function handleEntityNotFound(_0x15545a,_0x25bdd9){return function(_0x3a2eb7){if(!_0x3a2eb7){_0x15545a[_0x7721('0x2c')](0x194);}return _0x3a2eb7;};}function handleError(_0x5c806d,_0xd1df68){_0xd1df68=_0xd1df68||0x1f4;return function(_0x5e6663){logger[_0x7721('0x26')](_0x5e6663[_0x7721('0x3c')]);if(_0x5e6663[_0x7721('0x3d')]){delete _0x5e6663[_0x7721('0x3d')];}_0x5c806d[_0x7721('0x2d')](_0xd1df68)[_0x7721('0x3e')](_0x5e6663);};}exports['index']=function(_0x557c34,_0x4cadef){var _0x539560={},_0x18001c={},_0x1b3f8d={'count':0x0,'rows':[]};var _0x1acc72=_[_0x7721('0x3f')](db['VoiceContext'][_0x7721('0x40')],function(_0x4cf659){return{'name':_0x4cf659[_0x7721('0x41')],'type':_0x4cf659[_0x7721('0x42')]['key']};});_0x18001c[_0x7721('0x43')]=_[_0x7721('0x3f')](_0x1acc72,'name');_0x18001c['query']=_[_0x7721('0x44')](_0x557c34[_0x7721('0x45')]);_0x18001c[_0x7721('0x46')]=_[_0x7721('0x47')](_0x18001c['model'],_0x18001c[_0x7721('0x45')]);_0x539560[_0x7721('0x48')]=_[_0x7721('0x47')](_0x18001c[_0x7721('0x43')],qs[_0x7721('0x49')](_0x557c34['query'][_0x7721('0x49')]));_0x539560['attributes']=_0x539560[_0x7721('0x48')]['length']?_0x539560[_0x7721('0x48')]:_0x18001c[_0x7721('0x43')];if(!_0x557c34[_0x7721('0x45')]['hasOwnProperty'](_0x7721('0x4a'))){_0x539560[_0x7721('0x31')]=qs[_0x7721('0x31')](_0x557c34['query'][_0x7721('0x31')]);_0x539560[_0x7721('0x30')]=qs[_0x7721('0x30')](_0x557c34[_0x7721('0x45')][_0x7721('0x30')]);}_0x539560[_0x7721('0x4b')]=qs[_0x7721('0x4c')](_0x557c34['query']['sort']);_0x539560[_0x7721('0x4d')]=qs[_0x7721('0x46')](_[_0x7721('0x4e')](_0x557c34[_0x7721('0x45')],_0x18001c[_0x7721('0x46')]),_0x1acc72);if(_0x557c34[_0x7721('0x45')][_0x7721('0x4f')]){_0x539560[_0x7721('0x4d')]=_[_0x7721('0x50')](_0x539560[_0x7721('0x4d')],{'$or':_['map'](_0x1acc72,function(_0x578867){if(_0x578867[_0x7721('0x42')]!==_0x7721('0x51')){var _0x151f69={};_0x151f69[_0x578867[_0x7721('0x3d')]]={'$like':'%'+_0x557c34['query'][_0x7721('0x4f')]+'%'};return _0x151f69;}})});}_0x539560=_[_0x7721('0x50')]({},_0x539560,_0x557c34['options']);var _0x330fac={'where':_0x539560['where']};return db[_0x7721('0x52')]['count'](_0x330fac)[_0x7721('0x38')](function(_0x196be4){_0x1b3f8d[_0x7721('0x2f')]=_0x196be4;if(_0x557c34['query'][_0x7721('0x53')]){_0x539560[_0x7721('0x54')]=[{'all':!![]}];}return db['VoiceContext'][_0x7721('0x55')](_0x539560);})[_0x7721('0x38')](function(_0xf88e8c){_0x1b3f8d['rows']=_0xf88e8c;return _0x1b3f8d;})[_0x7721('0x38')](respondWithFilteredResult(_0x4cadef,_0x539560))['catch'](handleError(_0x4cadef,null));};exports[_0x7721('0x56')]=function(_0x310549,_0x4738ef){var _0x443503={'raw':![],'where':{'id':_0x310549[_0x7721('0x57')]['id']}},_0x1c95d8={};_0x1c95d8[_0x7721('0x43')]=_[_0x7721('0x44')](db[_0x7721('0x52')][_0x7721('0x40')]);_0x1c95d8[_0x7721('0x45')]=_[_0x7721('0x44')](_0x310549[_0x7721('0x45')]);_0x1c95d8[_0x7721('0x46')]=_[_0x7721('0x47')](_0x1c95d8['model'],_0x1c95d8[_0x7721('0x45')]);_0x443503[_0x7721('0x48')]=_[_0x7721('0x47')](_0x1c95d8[_0x7721('0x43')],qs[_0x7721('0x49')](_0x310549[_0x7721('0x45')][_0x7721('0x49')]));_0x443503['attributes']=_0x443503[_0x7721('0x48')][_0x7721('0x58')]?_0x443503[_0x7721('0x48')]:_0x1c95d8[_0x7721('0x43')];if(_0x310549[_0x7721('0x45')][_0x7721('0x53')]){_0x443503[_0x7721('0x54')]=[{'all':!![]}];}_0x443503=_[_0x7721('0x50')]({},_0x443503,_0x310549[_0x7721('0x59')]);return db[_0x7721('0x52')][_0x7721('0x5a')](_0x443503)['then'](handleEntityNotFound(_0x4738ef,null))[_0x7721('0x38')](respondWithResult(_0x4738ef,null))[_0x7721('0x2b')](handleError(_0x4738ef,null));};exports[_0x7721('0x5b')]=function(_0x2ee3c0,_0x15ed3b,_0x3e7918){var _0x41644f;return db[_0x7721('0x52')][_0x7721('0x5b')](_0x2ee3c0[_0x7721('0x5c')],{'raw':!![]})[_0x7721('0x38')](function(_0x2e5c28){_0x41644f=_0x2e5c28;return db[_0x7721('0x52')][_0x7721('0x55')]({'raw':!![]});})[_0x7721('0x38')](function(_0x577f47){var _0x50e9e9=fs['readFileSync'](path[_0x7721('0x5d')](config['root'],'server/files/templates/context.ejs'),'utf8');var _0x5d7036=ejs[_0x7721('0x5e')](_0x50e9e9,{'contexts':_0x577f47||[]});fs[_0x7721('0x5f')](_0x7721('0x60'),_0x5d7036);})['then'](function(){return respondWithRpcPromise(_0x7721('0x61'),'create',{'module':'chan_sip.so'});})['then'](function(){var _0x24d1dc=_0x2ee3c0['user']['get']({'plain':!![]});if(!_0x24d1dc)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x24d1dc[_0x7721('0x62')]===_0x7721('0x63')){var _0x1ff090=_0x41644f['get']({'plain':!![]});return db[_0x7721('0x64')][_0x7721('0x5a')]({'where':{'name':_0x7721('0x3a'),'userProfileId':_0x24d1dc[_0x7721('0x65')]},'raw':!![]})[_0x7721('0x38')](function(_0x16e80b){if(_0x16e80b&&_0x16e80b[_0x7721('0x66')]===0x0){return db[_0x7721('0x3b')][_0x7721('0x5b')]({'name':_0x1ff090[_0x7721('0x3d')],'resourceId':_0x1ff090['id'],'type':_0x16e80b[_0x7721('0x3d')],'sectionId':_0x16e80b['id']},{})[_0x7721('0x38')](function(){return _0x41644f;});}else{return _0x41644f;}})[_0x7721('0x2b')](function(_0x211d27){logger[_0x7721('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x211d27);throw _0x211d27;});}return _0x41644f;})[_0x7721('0x38')](respondWithResult(_0x15ed3b,0xc9))[_0x7721('0x2b')](handleError(_0x15ed3b,null));};exports[_0x7721('0x36')]=function(_0xb6db23,_0x542e30,_0x103009){var _0x104f05;return db['VoiceContext'][_0x7721('0x5a')]({'where':{'id':_0xb6db23['params']['id']}})[_0x7721('0x38')](handleEntityNotFound(_0x542e30,null))[_0x7721('0x38')](saveUpdates(_0xb6db23[_0x7721('0x5c')],null))[_0x7721('0x38')](function(_0x3d2b7d){if(_0x3d2b7d){_0x104f05=_0x3d2b7d;return db[_0x7721('0x52')][_0x7721('0x55')]({'raw':!![]});}})[_0x7721('0x38')](function(_0x4727b0){var _0x57759a=fs[_0x7721('0x67')](path[_0x7721('0x5d')](config[_0x7721('0x68')],_0x7721('0x69')),_0x7721('0x6a'));var _0x3ed425=ejs[_0x7721('0x5e')](_0x57759a,{'contexts':_0x4727b0||[]});fs['writeFileSync'](_0x7721('0x60'),_0x3ed425);})[_0x7721('0x38')](function(){return respondWithRpcPromise('Reload',_0x7721('0x36'),{'module':'chan_sip.so'});})[_0x7721('0x38')](function(){return _0x104f05;})[_0x7721('0x38')](respondWithResult(_0x542e30,null))[_0x7721('0x2b')](handleError(_0x542e30,null));};exports[_0x7721('0x37')]=function(_0x1e2436,_0x2bab14,_0x258c57){var _0x5dca04;return db[_0x7721('0x52')][_0x7721('0x5a')]({'where':{'id':_0x1e2436[_0x7721('0x57')]['id']}})['then'](handleEntityNotFound(_0x2bab14,null))['then'](removeEntity(_0x2bab14,null))['then'](function(){return db['VoiceContext']['findAll']({'raw':!![]});})[_0x7721('0x38')](function(_0x2645dd){var _0x580473=fs[_0x7721('0x67')](path[_0x7721('0x5d')](config[_0x7721('0x68')],_0x7721('0x69')),'utf8');var _0x275b25=ejs[_0x7721('0x5e')](_0x580473,{'contexts':_0x2645dd});fs[_0x7721('0x5f')](_0x7721('0x60'),_0x275b25);return respondWithRpcPromise(_0x7721('0x61'),'destroy',{'module':_0x7721('0x6b')});})[_0x7721('0x2b')](handleError(_0x2bab14,null));}; \ No newline at end of file +var _0x9957=['attributes','fields','hasOwnProperty','limit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','length','find','create','body','readFileSync','join','root','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','Contexts','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','server/files/templates/context.ejs','utf8','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','../../mysqldb','jayson/promise','client','http','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','catch','sendStatus','status','end','json','count','offset','set','Content-Range','apply','save','update','get','UserProfileResource','stack','name','index','map','VoiceContext','rawAttributes','type','key','model','query','keys','filters','intersection'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'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 db=require(_0x7995('0x19'))['db'];var jayson=require(_0x7995('0x1a'));var client=jayson[_0x7995('0x1b')][_0x7995('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x281576,_0x23999f,_0x2bbe7a){if(_0x2bbe7a){var _0x4cc004=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4cc004['test'](_0x23999f)){return _0x281576;}else{throw new db[(_0x7995('0x1d'))][(_0x7995('0x1e'))](_0x7995('0x1f'));}}else{return _0x281576;}}function respondWithRpcPromise(_0x321ae8,_0x3f1d3e,_0x1a5310,_0x2202ce){return new BPromise(function(_0x41cbf0,_0x5377e5){var _0x2eeacc=_0x2202ce||client;return _0x2eeacc['request'](_0x321ae8,_0x1a5310)[_0x7995('0x20')](function(_0x37f297){logger[_0x7995('0x21')](_0x7995('0x22'),_0x3f1d3e,_0x7995('0x23'));logger[_0x7995('0x24')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x3f1d3e,'request\x20sent',JSON[_0x7995('0x25')](_0x37f297));if(_0x37f297['error']){if(_0x37f297['error'][_0x7995('0x26')]===0x1f4){logger[_0x7995('0x27')]('VoiceContext,\x20%s,\x20%s',_0x3f1d3e,_0x37f297[_0x7995('0x27')]['message']);return _0x5377e5(_0x37f297['error'][_0x7995('0x28')]);}logger[_0x7995('0x27')](_0x7995('0x22'),_0x3f1d3e,_0x37f297[_0x7995('0x27')][_0x7995('0x28')]);return _0x41cbf0(_0x37f297[_0x7995('0x27')]['message']);}else{logger[_0x7995('0x21')](_0x7995('0x22'),_0x3f1d3e,_0x7995('0x23'));_0x41cbf0(_0x37f297[_0x7995('0x29')][_0x7995('0x28')]);}})[_0x7995('0x2a')](function(_0x475351){logger[_0x7995('0x27')]('VoiceContext,\x20%s,\x20%s',_0x3f1d3e,_0x475351);_0x5377e5(_0x475351);});});}function respondWithStatusCode(_0x39df42,_0x34e70c){_0x34e70c=_0x34e70c||0xcc;return function(_0x401dc3){if(_0x401dc3){return _0x39df42[_0x7995('0x2b')](_0x34e70c);}return _0x39df42[_0x7995('0x2c')](_0x34e70c)[_0x7995('0x2d')]();};}function respondWithResult(_0x56691a,_0x47625f){_0x47625f=_0x47625f||0xc8;return function(_0x5911c3){if(_0x5911c3){return _0x56691a[_0x7995('0x2c')](_0x47625f)[_0x7995('0x2e')](_0x5911c3);}};}function respondWithFilteredResult(_0xf16cc2,_0x132a42){return function(_0x11c1eb){if(_0x11c1eb){var _0x4b6f99=_0x11c1eb[_0x7995('0x2f')],_0x9b2a15=_0x132a42[_0x7995('0x30')],_0x514445=_0x132a42['offset']+_0x132a42['limit'],_0x456a28;if(_0x514445>=_0x4b6f99){_0x514445=_0x4b6f99;_0x456a28=0xc8;}else{_0x456a28=0xce;}_0xf16cc2['status'](_0x456a28);return _0xf16cc2[_0x7995('0x31')](_0x7995('0x32'),_0x9b2a15+'-'+_0x514445+'/'+_0x4b6f99)[_0x7995('0x2e')](_0x11c1eb);}return null;};}function patchUpdates(_0x2b874d){return function(_0x2e3493){try{jsonpatch[_0x7995('0x33')](_0x2e3493,_0x2b874d,!![]);}catch(_0x538841){return BPromise['reject'](_0x538841);}return _0x2e3493[_0x7995('0x34')]();};}function saveUpdates(_0x5524af,_0x553671){return function(_0x3eb566){if(_0x3eb566){return _0x3eb566[_0x7995('0x35')](_0x5524af)[_0x7995('0x20')](function(_0x1f7d27){return _0x1f7d27;});}return null;};}function removeEntity(_0x510841,_0x44309d){return function(_0x33e24e){if(_0x33e24e){return _0x33e24e['destroy']()['then'](function(){var _0x577412=_0x33e24e[_0x7995('0x36')]({'plain':!![]});var _0x3acfc3='Contexts';return db[_0x7995('0x37')]['destroy']({'where':{'type':_0x3acfc3,'resourceId':_0x577412['id']}})[_0x7995('0x20')](function(){return _0x33e24e;});})[_0x7995('0x20')](function(){_0x510841[_0x7995('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x52d76d,_0x36d057){return function(_0x5e67fe){if(!_0x5e67fe){_0x52d76d['sendStatus'](0x194);}return _0x5e67fe;};}function handleError(_0x3e99cd,_0xe328b1){_0xe328b1=_0xe328b1||0x1f4;return function(_0x5212ff){logger[_0x7995('0x27')](_0x5212ff[_0x7995('0x38')]);if(_0x5212ff[_0x7995('0x39')]){delete _0x5212ff[_0x7995('0x39')];}_0x3e99cd[_0x7995('0x2c')](_0xe328b1)['send'](_0x5212ff);};}exports[_0x7995('0x3a')]=function(_0x242713,_0xf612e6){var _0x1d60b8={},_0x4b1541={},_0x2be2c0={'count':0x0,'rows':[]};var _0x235df7=_[_0x7995('0x3b')](db[_0x7995('0x3c')][_0x7995('0x3d')],function(_0x1035dc){return{'name':_0x1035dc['fieldName'],'type':_0x1035dc[_0x7995('0x3e')][_0x7995('0x3f')]};});_0x4b1541[_0x7995('0x40')]=_[_0x7995('0x3b')](_0x235df7,_0x7995('0x39'));_0x4b1541[_0x7995('0x41')]=_[_0x7995('0x42')](_0x242713[_0x7995('0x41')]);_0x4b1541[_0x7995('0x43')]=_[_0x7995('0x44')](_0x4b1541[_0x7995('0x40')],_0x4b1541[_0x7995('0x41')]);_0x1d60b8[_0x7995('0x45')]=_['intersection'](_0x4b1541['model'],qs[_0x7995('0x46')](_0x242713[_0x7995('0x41')]['fields']));_0x1d60b8['attributes']=_0x1d60b8[_0x7995('0x45')]['length']?_0x1d60b8['attributes']:_0x4b1541[_0x7995('0x40')];if(!_0x242713[_0x7995('0x41')][_0x7995('0x47')]('nolimit')){_0x1d60b8[_0x7995('0x48')]=qs['limit'](_0x242713[_0x7995('0x41')]['limit']);_0x1d60b8['offset']=qs[_0x7995('0x30')](_0x242713[_0x7995('0x41')][_0x7995('0x30')]);}_0x1d60b8[_0x7995('0x49')]=qs['sort'](_0x242713[_0x7995('0x41')][_0x7995('0x4a')]);_0x1d60b8[_0x7995('0x4b')]=qs[_0x7995('0x43')](_['pick'](_0x242713['query'],_0x4b1541[_0x7995('0x43')]),_0x235df7);if(_0x242713['query'][_0x7995('0x4c')]){_0x1d60b8['where']=_[_0x7995('0x4d')](_0x1d60b8['where'],{'$or':_[_0x7995('0x3b')](_0x235df7,function(_0x1b0373){if(_0x1b0373['type']!==_0x7995('0x4e')){var _0x336ff2={};_0x336ff2[_0x1b0373[_0x7995('0x39')]]={'$like':'%'+_0x242713[_0x7995('0x41')]['filter']+'%'};return _0x336ff2;}})});}_0x1d60b8=_[_0x7995('0x4d')]({},_0x1d60b8,_0x242713[_0x7995('0x4f')]);var _0x237270={'where':_0x1d60b8['where']};return db[_0x7995('0x3c')][_0x7995('0x2f')](_0x237270)[_0x7995('0x20')](function(_0x3d8ae3){_0x2be2c0[_0x7995('0x2f')]=_0x3d8ae3;if(_0x242713['query'][_0x7995('0x50')]){_0x1d60b8[_0x7995('0x51')]=[{'all':!![]}];}return db['VoiceContext'][_0x7995('0x52')](_0x1d60b8);})['then'](function(_0x1d87f9){_0x2be2c0[_0x7995('0x53')]=_0x1d87f9;return _0x2be2c0;})[_0x7995('0x20')](respondWithFilteredResult(_0xf612e6,_0x1d60b8))[_0x7995('0x2a')](handleError(_0xf612e6,null));};exports[_0x7995('0x54')]=function(_0x14b537,_0x1579b9){var _0x4d46bc={'raw':![],'where':{'id':_0x14b537[_0x7995('0x55')]['id']}},_0x427dcf={};_0x427dcf[_0x7995('0x40')]=_['keys'](db[_0x7995('0x3c')][_0x7995('0x3d')]);_0x427dcf[_0x7995('0x41')]=_['keys'](_0x14b537['query']);_0x427dcf['filters']=_[_0x7995('0x44')](_0x427dcf[_0x7995('0x40')],_0x427dcf['query']);_0x4d46bc[_0x7995('0x45')]=_[_0x7995('0x44')](_0x427dcf[_0x7995('0x40')],qs[_0x7995('0x46')](_0x14b537[_0x7995('0x41')]['fields']));_0x4d46bc[_0x7995('0x45')]=_0x4d46bc['attributes'][_0x7995('0x56')]?_0x4d46bc[_0x7995('0x45')]:_0x427dcf[_0x7995('0x40')];if(_0x14b537['query']['includeAll']){_0x4d46bc['include']=[{'all':!![]}];}_0x4d46bc=_['merge']({},_0x4d46bc,_0x14b537[_0x7995('0x4f')]);return db[_0x7995('0x3c')][_0x7995('0x57')](_0x4d46bc)[_0x7995('0x20')](handleEntityNotFound(_0x1579b9,null))[_0x7995('0x20')](respondWithResult(_0x1579b9,null))[_0x7995('0x2a')](handleError(_0x1579b9,null));};exports[_0x7995('0x58')]=function(_0xda6ce8,_0x328671,_0x17ecd3){var _0xa7af8c;return db[_0x7995('0x3c')][_0x7995('0x58')](_0xda6ce8[_0x7995('0x59')],{'raw':!![]})[_0x7995('0x20')](function(_0x416133){_0xa7af8c=_0x416133;return db[_0x7995('0x3c')][_0x7995('0x52')]({'raw':!![]});})[_0x7995('0x20')](function(_0x50b7c2){var _0x56a374=fs[_0x7995('0x5a')](path[_0x7995('0x5b')](config[_0x7995('0x5c')],'server/files/templates/context.ejs'),'utf8');var _0x402fa0=ejs[_0x7995('0x5d')](_0x56a374,{'contexts':_0x50b7c2||[]});fs[_0x7995('0x5e')](_0x7995('0x5f'),_0x402fa0);})['then'](function(){return respondWithRpcPromise(_0x7995('0x60'),_0x7995('0x58'),{'module':_0x7995('0x61')});})[_0x7995('0x20')](function(){var _0x502d43=_0xda6ce8['user'][_0x7995('0x36')]({'plain':!![]});if(!_0x502d43)throw new Error(_0x7995('0x62'));if(_0x502d43[_0x7995('0x63')]===_0x7995('0x64')){var _0x37072=_0xa7af8c[_0x7995('0x36')]({'plain':!![]});return db[_0x7995('0x65')][_0x7995('0x57')]({'where':{'name':_0x7995('0x66'),'userProfileId':_0x502d43['userProfileId']},'raw':!![]})[_0x7995('0x20')](function(_0x3ec5a8){if(_0x3ec5a8&&_0x3ec5a8[_0x7995('0x67')]===0x0){return db[_0x7995('0x37')]['create']({'name':_0x37072['name'],'resourceId':_0x37072['id'],'type':_0x3ec5a8[_0x7995('0x39')],'sectionId':_0x3ec5a8['id']},{})[_0x7995('0x20')](function(){return _0xa7af8c;});}else{return _0xa7af8c;}})['catch'](function(_0x971a23){logger[_0x7995('0x27')](_0x7995('0x68'),_0x971a23);throw _0x971a23;});}return _0xa7af8c;})[_0x7995('0x20')](respondWithResult(_0x328671,0xc9))[_0x7995('0x2a')](handleError(_0x328671,null));};exports['update']=function(_0x457d09,_0x564fca,_0x3e0a46){var _0xe31dcb;return db[_0x7995('0x3c')][_0x7995('0x57')]({'where':{'id':_0x457d09[_0x7995('0x55')]['id']}})[_0x7995('0x20')](handleEntityNotFound(_0x564fca,null))[_0x7995('0x20')](saveUpdates(_0x457d09[_0x7995('0x59')],null))[_0x7995('0x20')](function(_0x3f2bde){if(_0x3f2bde){_0xe31dcb=_0x3f2bde;return db[_0x7995('0x3c')][_0x7995('0x52')]({'raw':!![]});}})['then'](function(_0x45351d){var _0x23bbc1=fs[_0x7995('0x5a')](path[_0x7995('0x5b')](config[_0x7995('0x5c')],'server/files/templates/context.ejs'),'utf8');var _0x268fde=ejs[_0x7995('0x5d')](_0x23bbc1,{'contexts':_0x45351d||[]});fs[_0x7995('0x5e')](_0x7995('0x5f'),_0x268fde);})['then'](function(){return respondWithRpcPromise(_0x7995('0x60'),'update',{'module':'chan_sip.so'});})[_0x7995('0x20')](function(){return _0xe31dcb;})[_0x7995('0x20')](respondWithResult(_0x564fca,null))[_0x7995('0x2a')](handleError(_0x564fca,null));};exports[_0x7995('0x69')]=function(_0x290eae,_0x25d9a4,_0x32a52f){var _0x13dc73;return db[_0x7995('0x3c')][_0x7995('0x57')]({'where':{'id':_0x290eae['params']['id']}})[_0x7995('0x20')](handleEntityNotFound(_0x25d9a4,null))[_0x7995('0x20')](removeEntity(_0x25d9a4,null))[_0x7995('0x20')](function(){return db['VoiceContext'][_0x7995('0x52')]({'raw':!![]});})[_0x7995('0x20')](function(_0x705f0){var _0x3a7d9d=fs[_0x7995('0x5a')](path[_0x7995('0x5b')](config[_0x7995('0x5c')],_0x7995('0x6a')),_0x7995('0x6b'));var _0x1fdff6=ejs[_0x7995('0x5d')](_0x3a7d9d,{'contexts':_0x705f0});fs['writeFileSync']('/etc/asterisk/extensions_xcally_contexts.conf',_0x1fdff6);return respondWithRpcPromise(_0x7995('0x60'),_0x7995('0x69'),{'module':_0x7995('0x61')});})[_0x7995('0x2a')](handleError(_0x25d9a4,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index ad7a3cc..f0aa72c 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 _0x46fc=['exports','define','VoiceContext','voice_contexts','lodash','../../config/logger','moment','request-promise','path','rimraf','./voiceContext.attributes'];(function(_0x386525,_0xefae6){var _0x14d015=function(_0x4a45c1){while(--_0x4a45c1){_0x386525['push'](_0x386525['shift']());}};_0x14d015(++_0xefae6);}(_0x46fc,0x17a));var _0xc46f=function(_0x175c5e,_0x5a411b){_0x175c5e=_0x175c5e-0x0;var _0x18d528=_0x46fc[_0x175c5e];return _0x18d528;};'use strict';var _=require(_0xc46f('0x0'));var util=require('util');var logger=require(_0xc46f('0x1'))('api');var moment=require(_0xc46f('0x2'));var BPromise=require('bluebird');var rp=require(_0xc46f('0x3'));var fs=require('fs');var path=require(_0xc46f('0x4'));var rimraf=require(_0xc46f('0x5'));var config=require('../../config/environment');var attributes=require(_0xc46f('0x6'));module[_0xc46f('0x7')]=function(_0x544018,_0x4330c0){return _0x544018[_0xc46f('0x8')](_0xc46f('0x9'),attributes,{'tableName':_0xc46f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4aec=['../../config/environment','./voiceContext.attributes','exports','define','VoiceContext','voice_contexts','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4aec,0x7b));var _0xc4ae=function(_0x31ead5,_0x8ade48){_0x31ead5=_0x31ead5-0x0;var _0x24adb3=_0x4aec[_0x31ead5];return _0x24adb3;};'use strict';var _=require('lodash');var util=require(_0xc4ae('0x0'));var logger=require('../../config/logger')(_0xc4ae('0x1'));var moment=require(_0xc4ae('0x2'));var BPromise=require(_0xc4ae('0x3'));var rp=require(_0xc4ae('0x4'));var fs=require('fs');var path=require(_0xc4ae('0x5'));var rimraf=require(_0xc4ae('0x6'));var config=require(_0xc4ae('0x7'));var attributes=require(_0xc4ae('0x8'));module[_0xc4ae('0x9')]=function(_0x1317ab,_0x51b4b8){return _0x1317ab[_0xc4ae('0xa')](_0xc4ae('0xb'),attributes,{'tableName':_0xc4ae('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.rpc.js b/server/api/voiceContext/voiceContext.rpc.js index 62ee1ea..bd0b83b 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 _0xda54=['request','info','VoiceContext,\x20%s,\x20%s','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','client'];(function(_0x55ed1b,_0x3fdb52){var _0x59891d=function(_0x412595){while(--_0x412595){_0x55ed1b['push'](_0x55ed1b['shift']());}};_0x59891d(++_0x3fdb52);}(_0xda54,0xa3));var _0x4da5=function(_0x447ef1,_0x374cd2){_0x447ef1=_0x447ef1-0x0;var _0x3d72ec=_0xda54[_0x447ef1];return _0x3d72ec;};'use strict';var _=require(_0x4da5('0x0'));var util=require(_0x4da5('0x1'));var moment=require(_0x4da5('0x2'));var BPromise=require(_0x4da5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4da5('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4da5('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4da5('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x411ab8,_0x41df0e,_0x57d34c){return new BPromise(function(_0x3246de,_0x15d7d4){return client[_0x4da5('0x7')](_0x411ab8,_0x57d34c)['then'](function(_0x58603f){logger[_0x4da5('0x8')](_0x4da5('0x9'),_0x41df0e,'request\x20sent');logger['debug'](_0x4da5('0xa'),_0x41df0e,_0x4da5('0xb'),JSON['stringify'](_0x58603f));if(_0x58603f[_0x4da5('0xc')]){if(_0x58603f[_0x4da5('0xc')][_0x4da5('0xd')]===0x1f4){logger[_0x4da5('0xc')](_0x4da5('0x9'),_0x41df0e,_0x58603f[_0x4da5('0xc')][_0x4da5('0xe')]);return _0x15d7d4(_0x58603f[_0x4da5('0xc')][_0x4da5('0xe')]);}logger['error'](_0x4da5('0x9'),_0x41df0e,_0x58603f[_0x4da5('0xc')][_0x4da5('0xe')]);return _0x3246de(_0x58603f[_0x4da5('0xc')]['message']);}else{logger[_0x4da5('0x8')]('VoiceContext,\x20%s,\x20%s',_0x41df0e,_0x4da5('0xb'));_0x3246de(_0x58603f[_0x4da5('0xf')][_0x4da5('0xe')]);}})[_0x4da5('0x10')](function(_0x1c1776){logger[_0x4da5('0xc')](_0x4da5('0x9'),_0x41df0e,_0x1c1776);_0x15d7d4(_0x1c1776);});});} \ No newline at end of file +var _0x8e17=['jayson/promise','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x9aada2,_0xd2d349){var _0x196dff=function(_0x5ad061){while(--_0x5ad061){_0x9aada2['push'](_0x9aada2['shift']());}};_0x196dff(++_0xd2d349);}(_0x8e17,0x183));var _0x78e1=function(_0x4a21cb,_0x1b0e50){_0x4a21cb=_0x4a21cb-0x0;var _0x584789=_0x8e17[_0x4a21cb];return _0x584789;};'use strict';var _=require(_0x78e1('0x0'));var util=require(_0x78e1('0x1'));var moment=require(_0x78e1('0x2'));var BPromise=require(_0x78e1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x78e1('0x4'))['db'];var utils=require(_0x78e1('0x5'));var logger=require(_0x78e1('0x6'))(_0x78e1('0x7'));var config=require(_0x78e1('0x8'));var jayson=require(_0x78e1('0x9'));var client=jayson[_0x78e1('0xa')][_0x78e1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x204386,_0x8aab82,_0x2b3714){return new BPromise(function(_0x35202c,_0x1278a4){return client[_0x78e1('0xc')](_0x204386,_0x2b3714)[_0x78e1('0xd')](function(_0x298ccf){logger[_0x78e1('0xe')](_0x78e1('0xf'),_0x8aab82,_0x78e1('0x10'));logger[_0x78e1('0x11')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x8aab82,_0x78e1('0x10'),JSON[_0x78e1('0x12')](_0x298ccf));if(_0x298ccf[_0x78e1('0x13')]){if(_0x298ccf[_0x78e1('0x13')]['code']===0x1f4){logger[_0x78e1('0x13')]('VoiceContext,\x20%s,\x20%s',_0x8aab82,_0x298ccf['error']['message']);return _0x1278a4(_0x298ccf[_0x78e1('0x13')][_0x78e1('0x14')]);}logger[_0x78e1('0x13')]('VoiceContext,\x20%s,\x20%s',_0x8aab82,_0x298ccf[_0x78e1('0x13')][_0x78e1('0x14')]);return _0x35202c(_0x298ccf['error'][_0x78e1('0x14')]);}else{logger[_0x78e1('0xe')]('VoiceContext,\x20%s,\x20%s',_0x8aab82,'request\x20sent');_0x35202c(_0x298ccf['result'][_0x78e1('0x14')]);}})[_0x78e1('0x15')](function(_0x307b3a){logger[_0x78e1('0x13')](_0x78e1('0xf'),_0x8aab82,_0x307b3a);_0x1278a4(_0x307b3a);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 6026794..99a8bb2 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 _0xbd01=['exports','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','post','put','/:id','update','delete','destroy'];(function(_0xdfee19,_0x21b6d4){var _0xbd2c99=function(_0x59438d){while(--_0x59438d){_0xdfee19['push'](_0xdfee19['shift']());}};_0xbd2c99(++_0x21b6d4);}(_0xbd01,0x133));var _0x1bd0=function(_0x4862e3,_0x11c162){_0x4862e3=_0x4862e3-0x0;var _0x16592e=_0xbd01[_0x4862e3];return _0x16592e;};'use strict';var multer=require('multer');var util=require(_0x1bd0('0x0'));var path=require(_0x1bd0('0x1'));var timeout=require(_0x1bd0('0x2'));var express=require('express');var router=express[_0x1bd0('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x1bd0('0x4'));var config=require(_0x1bd0('0x5'));var controller=require('./voiceDialReport.controller');router[_0x1bd0('0x6')]('/',auth[_0x1bd0('0x7')](),controller[_0x1bd0('0x8')]);router[_0x1bd0('0x6')](_0x1bd0('0x9'),auth[_0x1bd0('0x7')](),controller['describe']);router['get']('/:id',auth[_0x1bd0('0x7')](),controller['show']);router[_0x1bd0('0xa')]('/',auth['isAuthenticated'](),controller['create']);router[_0x1bd0('0xb')](_0x1bd0('0xc'),auth[_0x1bd0('0x7')](),controller[_0x1bd0('0xd')]);router[_0x1bd0('0xe')](_0x1bd0('0xc'),auth[_0x1bd0('0x7')](),controller[_0x1bd0('0xf')]);module[_0x1bd0('0x10')]=router; \ No newline at end of file +var _0x7dc9=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','isAuthenticated','get','/describe','describe','/:id','show','create','put','update','delete','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7dc9,0x1c8));var _0x97dc=function(_0x3a6268,_0xb7396d){_0x3a6268=_0x3a6268-0x0;var _0x49d66b=_0x7dc9[_0x3a6268];return _0x49d66b;};'use strict';var multer=require(_0x97dc('0x0'));var util=require(_0x97dc('0x1'));var path=require(_0x97dc('0x2'));var timeout=require(_0x97dc('0x3'));var express=require(_0x97dc('0x4'));var router=express[_0x97dc('0x5')]();var auth=require(_0x97dc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x97dc('0x7'));var controller=require('./voiceDialReport.controller');router['get']('/',auth[_0x97dc('0x8')](),controller['index']);router[_0x97dc('0x9')](_0x97dc('0xa'),auth[_0x97dc('0x8')](),controller[_0x97dc('0xb')]);router['get'](_0x97dc('0xc'),auth[_0x97dc('0x8')](),controller[_0x97dc('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x97dc('0xe')]);router[_0x97dc('0xf')](_0x97dc('0xc'),auth[_0x97dc('0x8')](),controller[_0x97dc('0x10')]);router[_0x97dc('0x11')](_0x97dc('0xc'),auth[_0x97dc('0x8')](),controller['destroy']);module[_0x97dc('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 9788efd..395aeab 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 _0x2c82=['DATE','called,connect,complete','STRING','INTEGER'];(function(_0x4ce140,_0x36e087){var _0x1f7209=function(_0x3c9aec){while(--_0x3c9aec){_0x4ce140['push'](_0x4ce140['shift']());}};_0x1f7209(++_0x36e087);}(_0x2c82,0x16a));var _0x22c8=function(_0x4a2b3c,_0xc69f59){_0x4a2b3c=_0x4a2b3c-0x0;var _0x4b081b=_0x2c82[_0x4a2b3c];return _0x4b081b;};'use strict';var Sequelize=require('sequelize');module['exports']={'privilege':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x22c8('0x0')]},'channelstate':{'type':Sequelize[_0x22c8('0x1')]},'channelstatedesc':{'type':Sequelize[_0x22c8('0x0')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x22c8('0x0')]},'connectedlinenum':{'type':Sequelize[_0x22c8('0x0')]},'connectedlinename':{'type':Sequelize[_0x22c8('0x0')]},'language':{'type':Sequelize[_0x22c8('0x0')]},'accountcode':{'type':Sequelize[_0x22c8('0x0')]},'context':{'type':Sequelize[_0x22c8('0x0')]},'exten':{'type':Sequelize[_0x22c8('0x0')]},'priority':{'type':Sequelize[_0x22c8('0x1')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0x22c8('0x0')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x22c8('0x1')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0x22c8('0x0')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x22c8('0x0')]},'destlanguage':{'type':Sequelize[_0x22c8('0x0')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x22c8('0x0')]},'destexten':{'type':Sequelize[_0x22c8('0x0')]},'destpriority':{'type':Sequelize[_0x22c8('0x1')]},'destuniqueid':{'type':Sequelize[_0x22c8('0x0')]},'destlinkedid':{'type':Sequelize[_0x22c8('0x0')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize[_0x22c8('0x0')]},'starttime':{'type':Sequelize[_0x22c8('0x2')]},'answertime':{'type':Sequelize[_0x22c8('0x2')]},'endtime':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0x22c8('0x0')],'comment':_0x22c8('0x3')},'routeId':{'type':Sequelize[_0x22c8('0x1')]},'duration':{'type':Sequelize[_0x22c8('0x1')]},'holdtime':{'type':Sequelize[_0x22c8('0x1')]},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x3385=['STRING','INTEGER','DATE','called,connect,complete'];(function(_0x3070dc,_0x40cf11){var _0x431489=function(_0x49bc2a){while(--_0x49bc2a){_0x3070dc['push'](_0x3070dc['shift']());}};_0x431489(++_0x40cf11);}(_0x3385,0x178));var _0x5338=function(_0x1e03e4,_0x362f76){_0x1e03e4=_0x1e03e4-0x0;var _0x4a887e=_0x3385[_0x1e03e4];return _0x4a887e;};'use strict';var Sequelize=require('sequelize');module['exports']={'privilege':{'type':Sequelize[_0x5338('0x0')]},'channel':{'type':Sequelize[_0x5338('0x0')]},'channelstate':{'type':Sequelize[_0x5338('0x1')]},'channelstatedesc':{'type':Sequelize[_0x5338('0x0')]},'calleridnum':{'type':Sequelize[_0x5338('0x0')]},'calleridname':{'type':Sequelize[_0x5338('0x0')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x5338('0x0')]},'priority':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0x5338('0x0')]},'linkedid':{'type':Sequelize[_0x5338('0x0')]},'destchannel':{'type':Sequelize[_0x5338('0x0')]},'destchannelstate':{'type':Sequelize[_0x5338('0x1')]},'destchannelstatedesc':{'type':Sequelize[_0x5338('0x0')]},'destcalleridnum':{'type':Sequelize[_0x5338('0x0')]},'destcalleridname':{'type':Sequelize[_0x5338('0x0')]},'destconnectedlinenum':{'type':Sequelize[_0x5338('0x0')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x5338('0x0')]},'destcontext':{'type':Sequelize[_0x5338('0x0')]},'destexten':{'type':Sequelize[_0x5338('0x0')]},'destpriority':{'type':Sequelize['INTEGER']},'destuniqueid':{'type':Sequelize[_0x5338('0x0')]},'destlinkedid':{'type':Sequelize[_0x5338('0x0')]},'dialstring':{'type':Sequelize[_0x5338('0x0')]},'dialstatus':{'type':Sequelize[_0x5338('0x0')]},'starttime':{'type':Sequelize[_0x5338('0x2')]},'answertime':{'type':Sequelize[_0x5338('0x2')]},'endtime':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0x5338('0x0')],'comment':_0x5338('0x3')},'routeId':{'type':Sequelize['INTEGER']},'duration':{'type':Sequelize[_0x5338('0x1')]},'holdtime':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index e5e9669..a498301 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 _0x7aa0=['jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','sendStatus','end','count','offset','limit','status','Content-Range','json','apply','reject','save','update','then','destroy','name','send','index','rawAttributes','key','model','map','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','VoiceDialReport','include','findAll','rows','catch','show','params','intersection','includeAll','create','body','find','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto'];(function(_0x19dbf6,_0x51ea26){var _0x49f053=function(_0x9eff2){while(--_0x9eff2){_0x19dbf6['push'](_0x19dbf6['shift']());}};_0x49f053(++_0x51ea26);}(_0x7aa0,0x1b9));var _0x07aa=function(_0x2bcc41,_0x5829ae){_0x2bcc41=_0x2bcc41-0x0;var _0x36bd2d=_0x7aa0[_0x2bcc41];return _0x36bd2d;};'use strict';var pdf=require(_0x07aa('0x0'));var emlformat=require(_0x07aa('0x1'));var rimraf=require(_0x07aa('0x2'));var zipdir=require(_0x07aa('0x3'));var jsonpatch=require(_0x07aa('0x4'));var rp=require('request-promise');var moment=require(_0x07aa('0x5'));var BPromise=require(_0x07aa('0x6'));var Mustache=require(_0x07aa('0x7'));var util=require(_0x07aa('0x8'));var path=require(_0x07aa('0x9'));var sox=require(_0x07aa('0xa'));var csv=require('to-csv');var ejs=require(_0x07aa('0xb'));var fs=require('fs');var _=require(_0x07aa('0xc'));var squel=require(_0x07aa('0xd'));var crypto=require(_0x07aa('0xe'));var jsforce=require(_0x07aa('0xf'));var deskjs=require(_0x07aa('0x10'));var toCsv=require(_0x07aa('0x11'));var querystring=require(_0x07aa('0x12'));var Papa=require('papaparse');var Redis=require(_0x07aa('0x13'));var authService=require(_0x07aa('0x14'));var qs=require(_0x07aa('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x07aa('0x16'));var logger=require(_0x07aa('0x17'))('api');var utils=require('../../config/utils');var config=require(_0x07aa('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1b3aa7,_0x1009d5){_0x1009d5=_0x1009d5||0xcc;return function(_0x535faa){if(_0x535faa){return _0x1b3aa7[_0x07aa('0x19')](_0x1009d5);}return _0x1b3aa7['status'](_0x1009d5)[_0x07aa('0x1a')]();};}function respondWithResult(_0x2cb68a,_0x54047d){_0x54047d=_0x54047d||0xc8;return function(_0x99f53c){if(_0x99f53c){return _0x2cb68a['status'](_0x54047d)['json'](_0x99f53c);}};}function respondWithFilteredResult(_0x260060,_0x36cac4){return function(_0x1034ec){if(_0x1034ec){var _0x18e93e=_0x1034ec[_0x07aa('0x1b')],_0x2c1e3b=_0x36cac4[_0x07aa('0x1c')],_0x5a13d4=_0x36cac4[_0x07aa('0x1c')]+_0x36cac4[_0x07aa('0x1d')],_0x388efc;if(_0x5a13d4>=_0x18e93e){_0x5a13d4=_0x18e93e;_0x388efc=0xc8;}else{_0x388efc=0xce;}_0x260060[_0x07aa('0x1e')](_0x388efc);return _0x260060['set'](_0x07aa('0x1f'),_0x2c1e3b+'-'+_0x5a13d4+'/'+_0x18e93e)[_0x07aa('0x20')](_0x1034ec);}return null;};}function patchUpdates(_0x2c5dde){return function(_0x15a257){try{jsonpatch[_0x07aa('0x21')](_0x15a257,_0x2c5dde,!![]);}catch(_0x363e06){return BPromise[_0x07aa('0x22')](_0x363e06);}return _0x15a257[_0x07aa('0x23')]();};}function saveUpdates(_0x3cdc98,_0x1514c5){return function(_0x3b67c9){if(_0x3b67c9){return _0x3b67c9[_0x07aa('0x24')](_0x3cdc98)[_0x07aa('0x25')](function(_0x513471){return _0x513471;});}return null;};}function removeEntity(_0x53e1c7,_0x3b4a66){return function(_0x403b64){if(_0x403b64){return _0x403b64[_0x07aa('0x26')]()[_0x07aa('0x25')](function(){_0x53e1c7[_0x07aa('0x1e')](0xcc)[_0x07aa('0x1a')]();});}};}function handleEntityNotFound(_0x6453e7,_0x5ed7fd){return function(_0x38578f){if(!_0x38578f){_0x6453e7[_0x07aa('0x19')](0x194);}return _0x38578f;};}function handleError(_0x2ec222,_0x1b7600){_0x1b7600=_0x1b7600||0x1f4;return function(_0x540d5c){logger['error'](_0x540d5c['stack']);if(_0x540d5c['name']){delete _0x540d5c[_0x07aa('0x27')];}_0x2ec222[_0x07aa('0x1e')](_0x1b7600)[_0x07aa('0x28')](_0x540d5c);};}exports[_0x07aa('0x29')]=function(_0x223ac9,_0x54c756){var _0x22d511={},_0x1f1db2={},_0x191978={'count':0x0,'rows':[]};var _0x2c71ff=_['map'](db['VoiceDialReport'][_0x07aa('0x2a')],function(_0x2a254d){return{'name':_0x2a254d['fieldName'],'type':_0x2a254d['type'][_0x07aa('0x2b')]};});_0x1f1db2[_0x07aa('0x2c')]=_[_0x07aa('0x2d')](_0x2c71ff,_0x07aa('0x27'));_0x1f1db2[_0x07aa('0x2e')]=_[_0x07aa('0x2f')](_0x223ac9[_0x07aa('0x2e')]);_0x1f1db2[_0x07aa('0x30')]=_['intersection'](_0x1f1db2['model'],_0x1f1db2[_0x07aa('0x2e')]);_0x22d511[_0x07aa('0x31')]=_['intersection'](_0x1f1db2[_0x07aa('0x2c')],qs[_0x07aa('0x32')](_0x223ac9[_0x07aa('0x2e')][_0x07aa('0x32')]));_0x22d511[_0x07aa('0x31')]=_0x22d511['attributes'][_0x07aa('0x33')]?_0x22d511[_0x07aa('0x31')]:_0x1f1db2[_0x07aa('0x2c')];if(!_0x223ac9[_0x07aa('0x2e')][_0x07aa('0x34')](_0x07aa('0x35'))){_0x22d511[_0x07aa('0x1d')]=qs[_0x07aa('0x1d')](_0x223ac9[_0x07aa('0x2e')][_0x07aa('0x1d')]);_0x22d511[_0x07aa('0x1c')]=qs[_0x07aa('0x1c')](_0x223ac9[_0x07aa('0x2e')]['offset']);}_0x22d511[_0x07aa('0x36')]=qs[_0x07aa('0x37')](_0x223ac9[_0x07aa('0x2e')]['sort']);_0x22d511[_0x07aa('0x38')]=qs[_0x07aa('0x30')](_[_0x07aa('0x39')](_0x223ac9[_0x07aa('0x2e')],_0x1f1db2[_0x07aa('0x30')]),_0x2c71ff);if(_0x223ac9[_0x07aa('0x2e')][_0x07aa('0x3a')]){_0x22d511[_0x07aa('0x38')]=_[_0x07aa('0x3b')](_0x22d511['where'],{'$or':_[_0x07aa('0x2d')](_0x2c71ff,function(_0x1c481d){if(_0x1c481d[_0x07aa('0x3c')]!==_0x07aa('0x3d')){var _0x5c64c6={};_0x5c64c6[_0x1c481d[_0x07aa('0x27')]]={'$like':'%'+_0x223ac9['query'][_0x07aa('0x3a')]+'%'};return _0x5c64c6;}})});}_0x22d511=_['merge']({},_0x22d511,_0x223ac9[_0x07aa('0x3e')]);var _0x347361={'where':_0x22d511[_0x07aa('0x38')]};return db[_0x07aa('0x3f')]['count'](_0x347361)[_0x07aa('0x25')](function(_0x5b48e3){_0x191978[_0x07aa('0x1b')]=_0x5b48e3;if(_0x223ac9[_0x07aa('0x2e')]['includeAll']){_0x22d511[_0x07aa('0x40')]=[{'all':!![]}];}return db[_0x07aa('0x3f')][_0x07aa('0x41')](_0x22d511);})[_0x07aa('0x25')](function(_0x4007b1){_0x191978[_0x07aa('0x42')]=_0x4007b1;return _0x191978;})[_0x07aa('0x25')](respondWithFilteredResult(_0x54c756,_0x22d511))[_0x07aa('0x43')](handleError(_0x54c756,null));};exports[_0x07aa('0x44')]=function(_0x173064,_0x4f9471){var _0x5e60a3={'raw':!![],'where':{'id':_0x173064[_0x07aa('0x45')]['id']}},_0x11cbbc={};_0x11cbbc[_0x07aa('0x2c')]=_[_0x07aa('0x2f')](db['VoiceDialReport'][_0x07aa('0x2a')]);_0x11cbbc[_0x07aa('0x2e')]=_[_0x07aa('0x2f')](_0x173064[_0x07aa('0x2e')]);_0x11cbbc[_0x07aa('0x30')]=_[_0x07aa('0x46')](_0x11cbbc[_0x07aa('0x2c')],_0x11cbbc['query']);_0x5e60a3[_0x07aa('0x31')]=_[_0x07aa('0x46')](_0x11cbbc[_0x07aa('0x2c')],qs[_0x07aa('0x32')](_0x173064['query'][_0x07aa('0x32')]));_0x5e60a3[_0x07aa('0x31')]=_0x5e60a3[_0x07aa('0x31')][_0x07aa('0x33')]?_0x5e60a3['attributes']:_0x11cbbc['model'];if(_0x173064[_0x07aa('0x2e')][_0x07aa('0x47')]){_0x5e60a3[_0x07aa('0x40')]=[{'all':!![]}];}_0x5e60a3=_['merge']({},_0x5e60a3,_0x173064[_0x07aa('0x3e')]);return db[_0x07aa('0x3f')]['find'](_0x5e60a3)[_0x07aa('0x25')](handleEntityNotFound(_0x4f9471,null))['then'](respondWithResult(_0x4f9471,null))[_0x07aa('0x43')](handleError(_0x4f9471,null));};exports[_0x07aa('0x48')]=function(_0x354ceb,_0x2ea8e7){return db['VoiceDialReport']['create'](_0x354ceb[_0x07aa('0x49')],{})[_0x07aa('0x25')](respondWithResult(_0x2ea8e7,0xc9))[_0x07aa('0x43')](handleError(_0x2ea8e7,null));};exports[_0x07aa('0x24')]=function(_0xb46e87,_0x5eaf7c){if(_0xb46e87[_0x07aa('0x49')]['id']){delete _0xb46e87[_0x07aa('0x49')]['id'];}return db[_0x07aa('0x3f')]['find']({'where':{'id':_0xb46e87['params']['id']}})[_0x07aa('0x25')](handleEntityNotFound(_0x5eaf7c,null))['then'](saveUpdates(_0xb46e87[_0x07aa('0x49')],null))[_0x07aa('0x25')](respondWithResult(_0x5eaf7c,null))['catch'](handleError(_0x5eaf7c,null));};exports[_0x07aa('0x26')]=function(_0x4d2816,_0x4012e4){return db[_0x07aa('0x3f')][_0x07aa('0x4a')]({'where':{'id':_0x4d2816[_0x07aa('0x45')]['id']}})[_0x07aa('0x25')](handleEntityNotFound(_0x4012e4,null))['then'](removeEntity(_0x4012e4,null))['catch'](handleError(_0x4012e4,null));};exports[_0x07aa('0x4b')]=function(_0x33fc90,_0x46f602){return db[_0x07aa('0x3f')]['describe']()[_0x07aa('0x25')](respondWithResult(_0x46f602,null))['catch'](handleError(_0x46f602,null));}; \ No newline at end of file +var _0xc5e6=['papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','count','offset','limit','json','apply','reject','update','then','end','error','name','send','index','map','rawAttributes','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','VoiceDialReport','includeAll','include','findAll','rows','catch','show','params','options','create','body','destroy','find','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring'];(function(_0x585ee5,_0x1c9dba){var _0x470808=function(_0x35c90d){while(--_0x35c90d){_0x585ee5['push'](_0x585ee5['shift']());}};_0x470808(++_0x1c9dba);}(_0xc5e6,0x83));var _0x6c5e=function(_0x506172,_0xbc3a3){_0x506172=_0x506172-0x0;var _0x2723c0=_0xc5e6[_0x506172];return _0x2723c0;};'use strict';var pdf=require(_0x6c5e('0x0'));var emlformat=require(_0x6c5e('0x1'));var rimraf=require(_0x6c5e('0x2'));var zipdir=require(_0x6c5e('0x3'));var jsonpatch=require(_0x6c5e('0x4'));var rp=require(_0x6c5e('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x6c5e('0x6'));var util=require(_0x6c5e('0x7'));var path=require(_0x6c5e('0x8'));var sox=require(_0x6c5e('0x9'));var csv=require('to-csv');var ejs=require(_0x6c5e('0xa'));var fs=require('fs');var _=require(_0x6c5e('0xb'));var squel=require(_0x6c5e('0xc'));var crypto=require(_0x6c5e('0xd'));var jsforce=require(_0x6c5e('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x6c5e('0xf'));var querystring=require(_0x6c5e('0x10'));var Papa=require(_0x6c5e('0x11'));var Redis=require(_0x6c5e('0x12'));var authService=require(_0x6c5e('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x6c5e('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6c5e('0x15'))(_0x6c5e('0x16'));var utils=require('../../config/utils');var config=require(_0x6c5e('0x17'));var db=require(_0x6c5e('0x18'))['db'];function respondWithStatusCode(_0x586888,_0x68d41c){_0x68d41c=_0x68d41c||0xcc;return function(_0x4273da){if(_0x4273da){return _0x586888[_0x6c5e('0x19')](_0x68d41c);}return _0x586888[_0x6c5e('0x1a')](_0x68d41c)['end']();};}function respondWithResult(_0x264e34,_0x5137b9){_0x5137b9=_0x5137b9||0xc8;return function(_0xe5c4ff){if(_0xe5c4ff){return _0x264e34[_0x6c5e('0x1a')](_0x5137b9)['json'](_0xe5c4ff);}};}function respondWithFilteredResult(_0xda36d0,_0x37e996){return function(_0xfd9bb5){if(_0xfd9bb5){var _0x378d6d=_0xfd9bb5[_0x6c5e('0x1b')],_0x2aa023=_0x37e996[_0x6c5e('0x1c')],_0x507e06=_0x37e996['offset']+_0x37e996[_0x6c5e('0x1d')],_0x49f65a;if(_0x507e06>=_0x378d6d){_0x507e06=_0x378d6d;_0x49f65a=0xc8;}else{_0x49f65a=0xce;}_0xda36d0['status'](_0x49f65a);return _0xda36d0['set']('Content-Range',_0x2aa023+'-'+_0x507e06+'/'+_0x378d6d)[_0x6c5e('0x1e')](_0xfd9bb5);}return null;};}function patchUpdates(_0x3e8f1f){return function(_0x413c14){try{jsonpatch[_0x6c5e('0x1f')](_0x413c14,_0x3e8f1f,!![]);}catch(_0x17e955){return BPromise[_0x6c5e('0x20')](_0x17e955);}return _0x413c14['save']();};}function saveUpdates(_0x558f6a,_0x1f3456){return function(_0x489a46){if(_0x489a46){return _0x489a46[_0x6c5e('0x21')](_0x558f6a)[_0x6c5e('0x22')](function(_0x59223c){return _0x59223c;});}return null;};}function removeEntity(_0x3df6d7,_0x5f3505){return function(_0x5dc975){if(_0x5dc975){return _0x5dc975['destroy']()[_0x6c5e('0x22')](function(){_0x3df6d7['status'](0xcc)[_0x6c5e('0x23')]();});}};}function handleEntityNotFound(_0x4d2e90,_0x50587c){return function(_0x7503b1){if(!_0x7503b1){_0x4d2e90[_0x6c5e('0x19')](0x194);}return _0x7503b1;};}function handleError(_0x545e15,_0x16a045){_0x16a045=_0x16a045||0x1f4;return function(_0x4e1580){logger[_0x6c5e('0x24')](_0x4e1580['stack']);if(_0x4e1580['name']){delete _0x4e1580[_0x6c5e('0x25')];}_0x545e15[_0x6c5e('0x1a')](_0x16a045)[_0x6c5e('0x26')](_0x4e1580);};}exports[_0x6c5e('0x27')]=function(_0x5e226c,_0x3d0d9a){var _0x315cb1={},_0x34ad63={},_0x4ad6b3={'count':0x0,'rows':[]};var _0x23ffc4=_[_0x6c5e('0x28')](db['VoiceDialReport'][_0x6c5e('0x29')],function(_0x1a0bb2){return{'name':_0x1a0bb2['fieldName'],'type':_0x1a0bb2[_0x6c5e('0x2a')]['key']};});_0x34ad63[_0x6c5e('0x2b')]=_[_0x6c5e('0x28')](_0x23ffc4,_0x6c5e('0x25'));_0x34ad63[_0x6c5e('0x2c')]=_[_0x6c5e('0x2d')](_0x5e226c['query']);_0x34ad63[_0x6c5e('0x2e')]=_[_0x6c5e('0x2f')](_0x34ad63['model'],_0x34ad63[_0x6c5e('0x2c')]);_0x315cb1['attributes']=_[_0x6c5e('0x2f')](_0x34ad63[_0x6c5e('0x2b')],qs[_0x6c5e('0x30')](_0x5e226c[_0x6c5e('0x2c')][_0x6c5e('0x30')]));_0x315cb1[_0x6c5e('0x31')]=_0x315cb1[_0x6c5e('0x31')][_0x6c5e('0x32')]?_0x315cb1[_0x6c5e('0x31')]:_0x34ad63[_0x6c5e('0x2b')];if(!_0x5e226c[_0x6c5e('0x2c')][_0x6c5e('0x33')](_0x6c5e('0x34'))){_0x315cb1[_0x6c5e('0x1d')]=qs['limit'](_0x5e226c['query'][_0x6c5e('0x1d')]);_0x315cb1['offset']=qs[_0x6c5e('0x1c')](_0x5e226c['query']['offset']);}_0x315cb1[_0x6c5e('0x35')]=qs['sort'](_0x5e226c[_0x6c5e('0x2c')][_0x6c5e('0x36')]);_0x315cb1[_0x6c5e('0x37')]=qs[_0x6c5e('0x2e')](_[_0x6c5e('0x38')](_0x5e226c[_0x6c5e('0x2c')],_0x34ad63[_0x6c5e('0x2e')]),_0x23ffc4);if(_0x5e226c[_0x6c5e('0x2c')]['filter']){_0x315cb1['where']=_[_0x6c5e('0x39')](_0x315cb1['where'],{'$or':_[_0x6c5e('0x28')](_0x23ffc4,function(_0x1ef0d9){if(_0x1ef0d9[_0x6c5e('0x2a')]!==_0x6c5e('0x3a')){var _0x516c5f={};_0x516c5f[_0x1ef0d9[_0x6c5e('0x25')]]={'$like':'%'+_0x5e226c['query'][_0x6c5e('0x3b')]+'%'};return _0x516c5f;}})});}_0x315cb1=_[_0x6c5e('0x39')]({},_0x315cb1,_0x5e226c['options']);var _0x169d2a={'where':_0x315cb1[_0x6c5e('0x37')]};return db[_0x6c5e('0x3c')][_0x6c5e('0x1b')](_0x169d2a)[_0x6c5e('0x22')](function(_0x39e738){_0x4ad6b3['count']=_0x39e738;if(_0x5e226c[_0x6c5e('0x2c')][_0x6c5e('0x3d')]){_0x315cb1[_0x6c5e('0x3e')]=[{'all':!![]}];}return db[_0x6c5e('0x3c')][_0x6c5e('0x3f')](_0x315cb1);})[_0x6c5e('0x22')](function(_0x559ced){_0x4ad6b3[_0x6c5e('0x40')]=_0x559ced;return _0x4ad6b3;})[_0x6c5e('0x22')](respondWithFilteredResult(_0x3d0d9a,_0x315cb1))[_0x6c5e('0x41')](handleError(_0x3d0d9a,null));};exports[_0x6c5e('0x42')]=function(_0x586dc3,_0x2f2baa){var _0x292cee={'raw':!![],'where':{'id':_0x586dc3[_0x6c5e('0x43')]['id']}},_0x2e4deb={};_0x2e4deb[_0x6c5e('0x2b')]=_[_0x6c5e('0x2d')](db['VoiceDialReport'][_0x6c5e('0x29')]);_0x2e4deb['query']=_['keys'](_0x586dc3['query']);_0x2e4deb['filters']=_[_0x6c5e('0x2f')](_0x2e4deb[_0x6c5e('0x2b')],_0x2e4deb[_0x6c5e('0x2c')]);_0x292cee[_0x6c5e('0x31')]=_['intersection'](_0x2e4deb[_0x6c5e('0x2b')],qs[_0x6c5e('0x30')](_0x586dc3[_0x6c5e('0x2c')][_0x6c5e('0x30')]));_0x292cee[_0x6c5e('0x31')]=_0x292cee[_0x6c5e('0x31')][_0x6c5e('0x32')]?_0x292cee[_0x6c5e('0x31')]:_0x2e4deb[_0x6c5e('0x2b')];if(_0x586dc3['query'][_0x6c5e('0x3d')]){_0x292cee[_0x6c5e('0x3e')]=[{'all':!![]}];}_0x292cee=_[_0x6c5e('0x39')]({},_0x292cee,_0x586dc3[_0x6c5e('0x44')]);return db[_0x6c5e('0x3c')]['find'](_0x292cee)[_0x6c5e('0x22')](handleEntityNotFound(_0x2f2baa,null))[_0x6c5e('0x22')](respondWithResult(_0x2f2baa,null))[_0x6c5e('0x41')](handleError(_0x2f2baa,null));};exports[_0x6c5e('0x45')]=function(_0x4f780b,_0x4cf45c){return db[_0x6c5e('0x3c')][_0x6c5e('0x45')](_0x4f780b[_0x6c5e('0x46')],{})['then'](respondWithResult(_0x4cf45c,0xc9))['catch'](handleError(_0x4cf45c,null));};exports[_0x6c5e('0x21')]=function(_0x9f4725,_0x5adf5b){if(_0x9f4725[_0x6c5e('0x46')]['id']){delete _0x9f4725[_0x6c5e('0x46')]['id'];}return db[_0x6c5e('0x3c')]['find']({'where':{'id':_0x9f4725['params']['id']}})[_0x6c5e('0x22')](handleEntityNotFound(_0x5adf5b,null))['then'](saveUpdates(_0x9f4725['body'],null))[_0x6c5e('0x22')](respondWithResult(_0x5adf5b,null))['catch'](handleError(_0x5adf5b,null));};exports[_0x6c5e('0x47')]=function(_0x50e942,_0x5c7b27){return db[_0x6c5e('0x3c')][_0x6c5e('0x48')]({'where':{'id':_0x50e942[_0x6c5e('0x43')]['id']}})[_0x6c5e('0x22')](handleEntityNotFound(_0x5c7b27,null))[_0x6c5e('0x22')](removeEntity(_0x5c7b27,null))[_0x6c5e('0x41')](handleError(_0x5c7b27,null));};exports[_0x6c5e('0x49')]=function(_0x4935d9,_0x356e6a){return db[_0x6c5e('0x3c')][_0x6c5e('0x49')]()[_0x6c5e('0x22')](respondWithResult(_0x356e6a,null))[_0x6c5e('0x41')](handleError(_0x356e6a,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 391c167..addb48d 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 _0x7a0f=['exports','define','VoiceDialReport','report_dial','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceDialReport.attributes'];(function(_0x368c08,_0x13d50e){var _0x4994d8=function(_0x2015ca){while(--_0x2015ca){_0x368c08['push'](_0x368c08['shift']());}};_0x4994d8(++_0x13d50e);}(_0x7a0f,0x7d));var _0xf7a0=function(_0x32c5c7,_0xc6881f){_0x32c5c7=_0x32c5c7-0x0;var _0x4648be=_0x7a0f[_0x32c5c7];return _0x4648be;};'use strict';var _=require(_0xf7a0('0x0'));var util=require(_0xf7a0('0x1'));var logger=require(_0xf7a0('0x2'))(_0xf7a0('0x3'));var moment=require(_0xf7a0('0x4'));var BPromise=require(_0xf7a0('0x5'));var rp=require(_0xf7a0('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf7a0('0x7'));var config=require(_0xf7a0('0x8'));var attributes=require(_0xf7a0('0x9'));module[_0xf7a0('0xa')]=function(_0x28eca1,_0x177a8d){return _0x28eca1[_0xf7a0('0xb')](_0xf7a0('0xc'),attributes,{'tableName':_0xf7a0('0xd'),'paranoid':![],'indexes':[{'fields':[_0xf7a0('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc1f4=['exports','define','report_dial','uniqueid','lodash','util','api','bluebird','rimraf','../../config/environment','./voiceDialReport.attributes'];(function(_0x407d8a,_0x4a6d59){var _0x295854=function(_0x311901){while(--_0x311901){_0x407d8a['push'](_0x407d8a['shift']());}};_0x295854(++_0x4a6d59);}(_0xc1f4,0x7d));var _0x4c1f=function(_0x22ed4b,_0x20609c){_0x22ed4b=_0x22ed4b-0x0;var _0x4e9cf6=_0xc1f4[_0x22ed4b];return _0x4e9cf6;};'use strict';var _=require(_0x4c1f('0x0'));var util=require(_0x4c1f('0x1'));var logger=require('../../config/logger')(_0x4c1f('0x2'));var moment=require('moment');var BPromise=require(_0x4c1f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4c1f('0x4'));var config=require(_0x4c1f('0x5'));var attributes=require(_0x4c1f('0x6'));module[_0x4c1f('0x7')]=function(_0x1ce159,_0x34bd61){return _0x1ce159[_0x4c1f('0x8')]('VoiceDialReport',attributes,{'tableName':_0x4c1f('0x9'),'paranoid':![],'indexes':[{'fields':[_0x4c1f('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 0ed2eee..d3b4b3b 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 _0x3cd1=['create','options','raw','catch','VoiceDialReport','update','body','attributes','limit','UpdateVoiceDialReport','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','then','info','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','VoiceDialReport,\x20%s,\x20%s','message','result','CreateVoiceDialReport'];(function(_0x49f9dd,_0x2d863a){var _0x47a33f=function(_0x486179){while(--_0x486179){_0x49f9dd['push'](_0x49f9dd['shift']());}};_0x47a33f(++_0x2d863a);}(_0x3cd1,0x112));var _0x13cd=function(_0x5a70a2,_0xf1e7f9){_0x5a70a2=_0x5a70a2-0x0;var _0x1c88fd=_0x3cd1[_0x5a70a2];return _0x1c88fd;};'use strict';var _=require('lodash');var util=require(_0x13cd('0x0'));var moment=require(_0x13cd('0x1'));var BPromise=require(_0x13cd('0x2'));var rs=require(_0x13cd('0x3'));var fs=require('fs');var Redis=require(_0x13cd('0x4'));var db=require(_0x13cd('0x5'))['db'];var utils=require(_0x13cd('0x6'));var logger=require(_0x13cd('0x7'))('rpc');var config=require(_0x13cd('0x8'));var jayson=require(_0x13cd('0x9'));var client=jayson[_0x13cd('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x55cac0,_0x461fe5,_0x427fb0){return new BPromise(function(_0x258008,_0x64751a){return client['request'](_0x55cac0,_0x427fb0)[_0x13cd('0xb')](function(_0x334e06){logger[_0x13cd('0xc')]('VoiceDialReport,\x20%s,\x20%s',_0x461fe5,'request\x20sent');logger[_0x13cd('0xd')](_0x13cd('0xe'),_0x461fe5,_0x13cd('0xf'),JSON[_0x13cd('0x10')](_0x334e06));if(_0x334e06[_0x13cd('0x11')]){if(_0x334e06[_0x13cd('0x11')][_0x13cd('0x12')]===0x1f4){logger['error'](_0x13cd('0x13'),_0x461fe5,_0x334e06[_0x13cd('0x11')]['message']);return _0x64751a(_0x334e06[_0x13cd('0x11')][_0x13cd('0x14')]);}logger[_0x13cd('0x11')](_0x13cd('0x13'),_0x461fe5,_0x334e06[_0x13cd('0x11')][_0x13cd('0x14')]);return _0x258008(_0x334e06[_0x13cd('0x11')][_0x13cd('0x14')]);}else{logger['info'](_0x13cd('0x13'),_0x461fe5,'request\x20sent');_0x258008(_0x334e06[_0x13cd('0x15')][_0x13cd('0x14')]);}})['catch'](function(_0x1bd779){logger[_0x13cd('0x11')](_0x13cd('0x13'),_0x461fe5,_0x1bd779);_0x64751a(_0x1bd779);});});}exports[_0x13cd('0x16')]=function(_0x1442eb){var _0x50557f=this;return new Promise(function(_0x45b9de,_0x446a31){return db['VoiceDialReport'][_0x13cd('0x17')](_0x1442eb['body'],{'raw':_0x1442eb[_0x13cd('0x18')]?_0x1442eb[_0x13cd('0x18')][_0x13cd('0x19')]===undefined?!![]:![]:!![]})[_0x13cd('0xb')](function(_0x5d12b8){logger[_0x13cd('0xc')]('CreateVoiceDialReport',_0x1442eb);logger[_0x13cd('0xd')](_0x13cd('0x16'),_0x1442eb,JSON[_0x13cd('0x10')](_0x5d12b8));_0x45b9de(_0x5d12b8);})[_0x13cd('0x1a')](function(_0x439ba1){logger[_0x13cd('0x11')]('CreateVoiceDialReport',_0x439ba1['message'],_0x1442eb);_0x446a31(_0x50557f[_0x13cd('0x11')](0x1f4,_0x439ba1['message']));});});};exports['UpdateVoiceDialReport']=function(_0xc0503f){var _0x299b9a=this;return new Promise(function(_0x1b84c8,_0x4882ae){return db[_0x13cd('0x1b')][_0x13cd('0x1c')](_0xc0503f[_0x13cd('0x1d')],{'raw':_0xc0503f[_0x13cd('0x18')]?_0xc0503f[_0x13cd('0x18')][_0x13cd('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xc0503f[_0x13cd('0x18')]?_0xc0503f[_0x13cd('0x18')]['where']||null:null,'attributes':_0xc0503f[_0x13cd('0x18')]?_0xc0503f['options'][_0x13cd('0x1e')]||null:null,'limit':_0xc0503f[_0x13cd('0x18')]?_0xc0503f['options'][_0x13cd('0x1f')]||null:null})[_0x13cd('0xb')](function(_0x256628){logger[_0x13cd('0xc')](_0x13cd('0x20'),_0xc0503f);logger[_0x13cd('0xd')](_0x13cd('0x20'),_0xc0503f,JSON['stringify'](_0x256628));_0x1b84c8(_0x256628);})[_0x13cd('0x1a')](function(_0x4a674b){logger['error'](_0x13cd('0x20'),_0x4a674b['message'],_0xc0503f);_0x4882ae(_0x299b9a['error'](0x1f4,_0x4a674b[_0x13cd('0x14')]));});});}; \ No newline at end of file +var _0x502a=['client','http','request','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateVoiceDialReport','VoiceDialReport','create','body','options','debug','UpdateVoiceDialReport','raw','where','attributes','lodash','util','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x3fbb0a,_0x30a2d5){var _0x56ebd4=function(_0x2c737e){while(--_0x2c737e){_0x3fbb0a['push'](_0x3fbb0a['shift']());}};_0x56ebd4(++_0x30a2d5);}(_0x502a,0xd8));var _0xa502=function(_0x46f46b,_0x31c2aa){_0x46f46b=_0x46f46b-0x0;var _0x572702=_0x502a[_0x46f46b];return _0x572702;};'use strict';var _=require(_0xa502('0x0'));var util=require(_0xa502('0x1'));var moment=require('moment');var BPromise=require(_0xa502('0x2'));var rs=require(_0xa502('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xa502('0x4'));var logger=require('../../config/logger')(_0xa502('0x5'));var config=require(_0xa502('0x6'));var jayson=require(_0xa502('0x7'));var client=jayson[_0xa502('0x8')][_0xa502('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x489407,_0x329022,_0x29fb03){return new BPromise(function(_0x4d30f2,_0x4e4e5d){return client[_0xa502('0xa')](_0x489407,_0x29fb03)[_0xa502('0xb')](function(_0x5251fa){logger[_0xa502('0xc')](_0xa502('0xd'),_0x329022,_0xa502('0xe'));logger['debug'](_0xa502('0xf'),_0x329022,_0xa502('0xe'),JSON[_0xa502('0x10')](_0x5251fa));if(_0x5251fa['error']){if(_0x5251fa[_0xa502('0x11')][_0xa502('0x12')]===0x1f4){logger['error'](_0xa502('0xd'),_0x329022,_0x5251fa[_0xa502('0x11')]['message']);return _0x4e4e5d(_0x5251fa[_0xa502('0x11')][_0xa502('0x13')]);}logger[_0xa502('0x11')]('VoiceDialReport,\x20%s,\x20%s',_0x329022,_0x5251fa[_0xa502('0x11')][_0xa502('0x13')]);return _0x4d30f2(_0x5251fa[_0xa502('0x11')]['message']);}else{logger[_0xa502('0xc')](_0xa502('0xd'),_0x329022,_0xa502('0xe'));_0x4d30f2(_0x5251fa[_0xa502('0x14')][_0xa502('0x13')]);}})[_0xa502('0x15')](function(_0x3107a0){logger[_0xa502('0x11')](_0xa502('0xd'),_0x329022,_0x3107a0);_0x4e4e5d(_0x3107a0);});});}exports[_0xa502('0x16')]=function(_0x1445ec){var _0x315455=this;return new Promise(function(_0x1d2f3d,_0x166453){return db[_0xa502('0x17')][_0xa502('0x18')](_0x1445ec[_0xa502('0x19')],{'raw':_0x1445ec[_0xa502('0x1a')]?_0x1445ec['options']['raw']===undefined?!![]:![]:!![]})[_0xa502('0xb')](function(_0x331d55){logger[_0xa502('0xc')](_0xa502('0x16'),_0x1445ec);logger[_0xa502('0x1b')](_0xa502('0x16'),_0x1445ec,JSON[_0xa502('0x10')](_0x331d55));_0x1d2f3d(_0x331d55);})[_0xa502('0x15')](function(_0x287f03){logger[_0xa502('0x11')](_0xa502('0x16'),_0x287f03[_0xa502('0x13')],_0x1445ec);_0x166453(_0x315455['error'](0x1f4,_0x287f03[_0xa502('0x13')]));});});};exports[_0xa502('0x1c')]=function(_0x28bc20){var _0x1fd61d=this;return new Promise(function(_0x570f23,_0x10f7e8){return db[_0xa502('0x17')]['update'](_0x28bc20['body'],{'raw':_0x28bc20[_0xa502('0x1a')]?_0x28bc20['options'][_0xa502('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x28bc20[_0xa502('0x1a')]?_0x28bc20['options'][_0xa502('0x1e')]||null:null,'attributes':_0x28bc20[_0xa502('0x1a')]?_0x28bc20['options'][_0xa502('0x1f')]||null:null,'limit':_0x28bc20[_0xa502('0x1a')]?_0x28bc20[_0xa502('0x1a')]['limit']||null:null})['then'](function(_0x4d8a9e){logger[_0xa502('0xc')](_0xa502('0x1c'),_0x28bc20);logger['debug']('UpdateVoiceDialReport',_0x28bc20,JSON[_0xa502('0x10')](_0x4d8a9e));_0x570f23(_0x4d8a9e);})[_0xa502('0x15')](function(_0x4fccea){logger[_0xa502('0x11')](_0xa502('0x1c'),_0x4fccea['message'],_0x28bc20);_0x10f7e8(_0x1fd61d[_0xa502('0x11')](0x1f4,_0x4fccea[_0xa502('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 5e9fee4..0f5334f 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 _0x0c7a=['put','update','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','create','post','/:id/applications','addApplications'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x0c7a,0xb8));var _0xa0c7=function(_0xe51c17,_0x3dc6da){_0xe51c17=_0xe51c17-0x0;var _0x3453e3=_0x0c7a[_0xe51c17];return _0x3453e3;};'use strict';var multer=require(_0xa0c7('0x0'));var util=require('util');var path=require(_0xa0c7('0x1'));var timeout=require(_0xa0c7('0x2'));var express=require(_0xa0c7('0x3'));var router=express[_0xa0c7('0x4')]();var auth=require(_0xa0c7('0x5'));var interaction=require(_0xa0c7('0x6'));var config=require(_0xa0c7('0x7'));var controller=require('./voiceExtension.controller');router[_0xa0c7('0x8')]('/',auth[_0xa0c7('0x9')](),controller['index']);router['get'](_0xa0c7('0xa'),auth['isAuthenticated'](),controller[_0xa0c7('0xb')]);router['post']('/',auth[_0xa0c7('0x9')](),controller[_0xa0c7('0xc')]);router[_0xa0c7('0xd')](_0xa0c7('0xe'),auth['isAuthenticated'](),controller[_0xa0c7('0xf')]);router[_0xa0c7('0x10')]('/:id',auth[_0xa0c7('0x9')](),controller[_0xa0c7('0x11')]);router['delete'](_0xa0c7('0xa'),auth[_0xa0c7('0x9')](),controller[_0xa0c7('0x12')]);module[_0xa0c7('0x13')]=router; \ No newline at end of file +var _0xd8cc=['post','/:id/applications','addApplications','update','delete','destroy','exports','multer','util','path','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','create'];(function(_0x491fbc,_0x1a708a){var _0x2559d7=function(_0x16a53c){while(--_0x16a53c){_0x491fbc['push'](_0x491fbc['shift']());}};_0x2559d7(++_0x1a708a);}(_0xd8cc,0x111));var _0xcd8c=function(_0x35885a,_0x42fed7){_0x35885a=_0x35885a-0x0;var _0xe86249=_0xd8cc[_0x35885a];return _0xe86249;};'use strict';var multer=require(_0xcd8c('0x0'));var util=require(_0xcd8c('0x1'));var path=require(_0xcd8c('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xcd8c('0x3')]();var auth=require(_0xcd8c('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xcd8c('0x5'));var controller=require('./voiceExtension.controller');router[_0xcd8c('0x6')]('/',auth[_0xcd8c('0x7')](),controller[_0xcd8c('0x8')]);router[_0xcd8c('0x6')](_0xcd8c('0x9'),auth[_0xcd8c('0x7')](),controller[_0xcd8c('0xa')]);router['post']('/',auth['isAuthenticated'](),controller[_0xcd8c('0xb')]);router[_0xcd8c('0xc')](_0xcd8c('0xd'),auth['isAuthenticated'](),controller[_0xcd8c('0xe')]);router['put'](_0xcd8c('0x9'),auth[_0xcd8c('0x7')](),controller[_0xcd8c('0xf')]);router[_0xcd8c('0x10')](_0xcd8c('0x9'),auth[_0xcd8c('0x7')](),controller[_0xcd8c('0x11')]);module[_0xcd8c('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index fdab2a1..c05c9db 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(_0x581564,_0x4b3dbc){var _0x2b9bba=function(_0x560ee4){while(--_0x560ee4){_0x581564['push'](_0x581564['shift']());}};_0x2b9bba(++_0x4b3dbc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xa9e0[_0x139a3c];return _0x2b375b;};'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(_0x7a954a,_0xabba11){var _0x4b38b3=function(_0x1c71b2){while(--_0x1c71b2){_0x7a954a['push'](_0x7a954a['shift']());}};_0x4b38b3(++_0xabba11);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xa9e0[_0x2f3848];return _0x102668;};'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 1ede0ce..99fbe02 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 _0x687b=['html-pdf','eml-format','rimraf','zip-dir','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/environment','../../mysqldb','redis','defaults','socket.io-emitter','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','InboundRoutes','inbound','OutboundRoutes','outbound','InternalRoutes','internal','ignore','map','value','includes','type','find','name','UserProfileResource','error','stack','index','rawAttributes','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','VoiceExtension','includeAll','include','findAll','rows','show','params','catch','create','body','startsWith','exten','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','context','description','cutdigits','addApplications','findOne','sequelize','transaction','VoiceExtensionId','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)'];(function(_0x53beed,_0x425446){var _0x13a363=function(_0x11143f){while(--_0x11143f){_0x53beed['push'](_0x53beed['shift']());}};_0x13a363(++_0x425446);}(_0x687b,0x14a));var _0xb687=function(_0x54e335,_0x6b782d){_0x54e335=_0x54e335-0x0;var _0x5be44a=_0x687b[_0x54e335];return _0x5be44a;};'use strict';var pdf=require(_0xb687('0x0'));var emlformat=require(_0xb687('0x1'));var rimraf=require(_0xb687('0x2'));var zipdir=require(_0xb687('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xb687('0x4'));var BPromise=require(_0xb687('0x5'));var Mustache=require(_0xb687('0x6'));var util=require(_0xb687('0x7'));var path=require(_0xb687('0x8'));var sox=require(_0xb687('0x9'));var csv=require(_0xb687('0xa'));var ejs=require(_0xb687('0xb'));var fs=require('fs');var _=require(_0xb687('0xc'));var squel=require(_0xb687('0xd'));var crypto=require('crypto');var jsforce=require(_0xb687('0xe'));var deskjs=require(_0xb687('0xf'));var toCsv=require('to-csv');var querystring=require(_0xb687('0x10'));var Papa=require(_0xb687('0x11'));var Redis=require(_0xb687('0x12'));var authService=require(_0xb687('0x13'));var qs=require(_0xb687('0x14'));var as=require(_0xb687('0x15'));var hardwareService=require(_0xb687('0x16'));var logger=require(_0xb687('0x17'))(_0xb687('0x18'));var utils=require('../../config/utils');var config=require(_0xb687('0x19'));var db=require(_0xb687('0x1a'))['db'];config[_0xb687('0x1b')]=_[_0xb687('0x1c')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xb687('0x1d'))(new Redis(config[_0xb687('0x1b')]));require('./voiceExtension.socket')[_0xb687('0x1e')](socket);function respondWithStatusCode(_0x2f1ac0,_0x1f1f35){_0x1f1f35=_0x1f1f35||0xcc;return function(_0x30d502){if(_0x30d502){return _0x2f1ac0[_0xb687('0x1f')](_0x1f1f35);}return _0x2f1ac0[_0xb687('0x20')](_0x1f1f35)[_0xb687('0x21')]();};}function respondWithResult(_0x141375,_0x263085){_0x263085=_0x263085||0xc8;return function(_0x2c7a18){if(_0x2c7a18){return _0x141375[_0xb687('0x20')](_0x263085)[_0xb687('0x22')](_0x2c7a18);}};}function respondWithFilteredResult(_0x4f0fdb,_0x214b06){return function(_0x328301){if(_0x328301){var _0x30d370=_0x328301[_0xb687('0x23')],_0x5eb9b9=_0x214b06[_0xb687('0x24')],_0x48958d=_0x214b06['offset']+_0x214b06[_0xb687('0x25')],_0x12eff1;if(_0x48958d>=_0x30d370){_0x48958d=_0x30d370;_0x12eff1=0xc8;}else{_0x12eff1=0xce;}_0x4f0fdb['status'](_0x12eff1);return _0x4f0fdb[_0xb687('0x26')](_0xb687('0x27'),_0x5eb9b9+'-'+_0x48958d+'/'+_0x30d370)[_0xb687('0x22')](_0x328301);}return null;};}function patchUpdates(_0x44bd0b){return function(_0x49d5a1){try{jsonpatch[_0xb687('0x28')](_0x49d5a1,_0x44bd0b,!![]);}catch(_0x58e83c){return BPromise[_0xb687('0x29')](_0x58e83c);}return _0x49d5a1[_0xb687('0x2a')]();};}function saveUpdates(_0x274241,_0x546fde){return function(_0x1dc06b){if(_0x1dc06b){return _0x1dc06b[_0xb687('0x2b')](_0x274241)[_0xb687('0x2c')](function(_0x16cdcb){return _0x16cdcb;});}return null;};}function removeEntity(_0xbf6c58,_0x38866c){return function(_0xf48ba4){if(_0xf48ba4){return _0xf48ba4[_0xb687('0x2d')]()['then'](function(){var _0xf45db0=_0xf48ba4[_0xb687('0x2e')]({'plain':!![]});var _0x1c1585=[{'name':_0xb687('0x2f'),'value':_0xb687('0x30'),'ignore':![]},{'name':_0xb687('0x31'),'value':_0xb687('0x32'),'ignore':![]},{'name':_0xb687('0x33'),'value':_0xb687('0x34'),'ignore':![]}];var _0x2e6185=_(_0x1c1585)['filter'](_0xb687('0x35'))[_0xb687('0x36')](_0xb687('0x37'))[_0xb687('0x37')]();if(_[_0xb687('0x38')](_0x2e6185,_0xf45db0[_0xb687('0x39')])){return;}var _0x4e9a06=_[_0xb687('0x3a')](_0x1c1585,['value',_0xf45db0[_0xb687('0x39')]])[_0xb687('0x3b')];return db[_0xb687('0x3c')][_0xb687('0x2d')]({'where':{'type':_0x4e9a06,'resourceId':_0xf45db0['id']}})[_0xb687('0x2c')](function(){return _0xf48ba4;});})[_0xb687('0x2c')](function(){_0xbf6c58[_0xb687('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3da2be,_0xe3428f){return function(_0x3c08ab){if(!_0x3c08ab){_0x3da2be[_0xb687('0x1f')](0x194);}return _0x3c08ab;};}function handleError(_0xa18fec,_0x263834){_0x263834=_0x263834||0x1f4;return function(_0x44be88){logger[_0xb687('0x3d')](_0x44be88[_0xb687('0x3e')]);if(_0x44be88[_0xb687('0x3b')]){delete _0x44be88[_0xb687('0x3b')];}_0xa18fec['status'](_0x263834)['send'](_0x44be88);};}exports[_0xb687('0x3f')]=function(_0xe4456,_0x24c418){var _0x32abc4={},_0x4fc44a={},_0x4f0b28={'count':0x0,'rows':[]};var _0x1ccc25=_[_0xb687('0x36')](db['VoiceExtension'][_0xb687('0x40')],function(_0x449074){return{'name':_0x449074['fieldName'],'type':_0x449074[_0xb687('0x39')]['key']};});_0x4fc44a[_0xb687('0x41')]=_[_0xb687('0x36')](_0x1ccc25,_0xb687('0x3b'));_0x4fc44a[_0xb687('0x42')]=_[_0xb687('0x43')](_0xe4456[_0xb687('0x42')]);_0x4fc44a['filters']=_[_0xb687('0x44')](_0x4fc44a[_0xb687('0x41')],_0x4fc44a[_0xb687('0x42')]);_0x32abc4[_0xb687('0x45')]=_['intersection'](_0x4fc44a[_0xb687('0x41')],qs[_0xb687('0x46')](_0xe4456[_0xb687('0x42')][_0xb687('0x46')]));_0x32abc4[_0xb687('0x45')]=_0x32abc4['attributes'][_0xb687('0x47')]?_0x32abc4[_0xb687('0x45')]:_0x4fc44a[_0xb687('0x41')];if(!_0xe4456[_0xb687('0x42')][_0xb687('0x48')](_0xb687('0x49'))){_0x32abc4['limit']=qs['limit'](_0xe4456[_0xb687('0x42')]['limit']);_0x32abc4[_0xb687('0x24')]=qs[_0xb687('0x24')](_0xe4456['query'][_0xb687('0x24')]);}_0x32abc4[_0xb687('0x4a')]=qs['sort'](_0xe4456[_0xb687('0x42')][_0xb687('0x4b')]);_0x32abc4[_0xb687('0x4c')]=qs['filters'](_[_0xb687('0x4d')](_0xe4456[_0xb687('0x42')],_0x4fc44a[_0xb687('0x4e')]),_0x1ccc25);if(_0xe4456[_0xb687('0x42')][_0xb687('0x4f')]){_0x32abc4[_0xb687('0x4c')]=_[_0xb687('0x50')](_0x32abc4['where'],{'$or':_[_0xb687('0x36')](_0x1ccc25,function(_0x4cf6ad){if(_0x4cf6ad['type']!==_0xb687('0x51')){var _0x430364={};_0x430364[_0x4cf6ad['name']]={'$like':'%'+_0xe4456[_0xb687('0x42')]['filter']+'%'};return _0x430364;}})});}_0x32abc4=_[_0xb687('0x50')]({},_0x32abc4,_0xe4456[_0xb687('0x52')]);var _0x5c89a3={'where':_0x32abc4[_0xb687('0x4c')]};return db[_0xb687('0x53')]['count'](_0x5c89a3)[_0xb687('0x2c')](function(_0x8e259e){_0x4f0b28[_0xb687('0x23')]=_0x8e259e;if(_0xe4456[_0xb687('0x42')][_0xb687('0x54')]){_0x32abc4[_0xb687('0x55')]=[{'all':!![]}];}return db[_0xb687('0x53')][_0xb687('0x56')](_0x32abc4);})[_0xb687('0x2c')](function(_0x41a3e5){_0x4f0b28[_0xb687('0x57')]=_0x41a3e5;return _0x4f0b28;})[_0xb687('0x2c')](respondWithFilteredResult(_0x24c418,_0x32abc4))['catch'](handleError(_0x24c418,null));};exports[_0xb687('0x58')]=function(_0x524853,_0x3da453){var _0x1edb1a={'raw':![],'where':{'id':_0x524853[_0xb687('0x59')]['id']}},_0x3761d6={};_0x3761d6[_0xb687('0x41')]=_[_0xb687('0x43')](db['VoiceExtension']['rawAttributes']);_0x3761d6[_0xb687('0x42')]=_[_0xb687('0x43')](_0x524853[_0xb687('0x42')]);_0x3761d6[_0xb687('0x4e')]=_['intersection'](_0x3761d6[_0xb687('0x41')],_0x3761d6[_0xb687('0x42')]);_0x1edb1a[_0xb687('0x45')]=_[_0xb687('0x44')](_0x3761d6['model'],qs[_0xb687('0x46')](_0x524853[_0xb687('0x42')][_0xb687('0x46')]));_0x1edb1a[_0xb687('0x45')]=_0x1edb1a['attributes']['length']?_0x1edb1a[_0xb687('0x45')]:_0x3761d6[_0xb687('0x41')];if(_0x524853[_0xb687('0x42')]['includeAll']){_0x1edb1a['include']=[{'all':!![]}];}_0x1edb1a=_[_0xb687('0x50')]({},_0x1edb1a,_0x524853[_0xb687('0x52')]);return db[_0xb687('0x53')][_0xb687('0x3a')](_0x1edb1a)[_0xb687('0x2c')](handleEntityNotFound(_0x3da453,null))[_0xb687('0x2c')](respondWithResult(_0x3da453,null))[_0xb687('0x5a')](handleError(_0x3da453,null));};exports[_0xb687('0x2d')]=function(_0x543083,_0xe39007){return db[_0xb687('0x53')][_0xb687('0x3a')]({'where':{'id':_0x543083['params']['id']}})['then'](handleEntityNotFound(_0xe39007,null))['then'](removeEntity(_0xe39007,null))['catch'](handleError(_0xe39007,null));};exports[_0xb687('0x5b')]=function(_0x17b991,_0x1bea6f){if(_0x17b991[_0xb687('0x5c')][_0xb687('0x39')]===_0xb687('0x32')&&!_[_0xb687('0x5d')](_0x17b991[_0xb687('0x5c')][_0xb687('0x5e')],'_')){_0x17b991[_0xb687('0x5c')][_0xb687('0x5e')]='_'[_0xb687('0x5f')](_0x17b991[_0xb687('0x5c')][_0xb687('0x5e')]);}return db[_0xb687('0x53')][_0xb687('0x5b')](_0x17b991[_0xb687('0x5c')],{'raw':![]})['then'](function(_0x58670a){var _0x1ebbca=_0x17b991[_0xb687('0x60')][_0xb687('0x2e')]({'plain':!![]});if(!_0x1ebbca)throw new Error(_0xb687('0x61'));if(_0x1ebbca['role']===_0xb687('0x60')){var _0x37feb8=_0x58670a['get']({'plain':!![]});var _0x115d14=[{'name':'InboundRoutes','value':_0xb687('0x30')},{'name':_0xb687('0x31'),'value':'outbound'},{'name':'InternalRoutes','value':_0xb687('0x34')}];var _0x4ab9c5=_['find'](_0x115d14,[_0xb687('0x37'),_0x37feb8[_0xb687('0x39')]])[_0xb687('0x3b')];return db['UserProfileSection'][_0xb687('0x3a')]({'where':{'name':_0x4ab9c5,'userProfileId':_0x1ebbca['userProfileId']},'raw':!![]})[_0xb687('0x2c')](function(_0x1a31f6){if(_0x1a31f6&&_0x1a31f6[_0xb687('0x62')]===0x0){return db[_0xb687('0x3c')][_0xb687('0x5b')]({'name':_0x37feb8['name'],'resourceId':_0x37feb8['id'],'type':_0x1a31f6['name'],'sectionId':_0x1a31f6['id']},{})[_0xb687('0x2c')](function(){return _0x58670a;});}else{return _0x58670a;}})['catch'](function(_0x5362ea){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5362ea);throw _0x5362ea;});}return _0x58670a;})[_0xb687('0x2c')](respondWithResult(_0x1bea6f,0xc9))[_0xb687('0x5a')](handleError(_0x1bea6f,null));};exports[_0xb687('0x2b')]=function(_0x4bc18f,_0x3afcf3){if(_0x4bc18f[_0xb687('0x5c')]['id']){delete _0x4bc18f[_0xb687('0x5c')]['id'];}return db[_0xb687('0x53')][_0xb687('0x3a')]({'where':{'id':_0x4bc18f[_0xb687('0x59')]['id']}})[_0xb687('0x2c')](handleEntityNotFound(_0x3afcf3,null))['then'](function(_0x56c4f6){if(_0x56c4f6){return db[_0xb687('0x53')]['update'](_[_0xb687('0x4d')](_0x4bc18f[_0xb687('0x5c')],[_0xb687('0x5e'),_0xb687('0x63'),_0xb687('0x64'),'recordingFormat',_0xb687('0x65'),'mandatoryDisposition']),{'where':{'context':_0x56c4f6[_0xb687('0x63')],'exten':_0x56c4f6[_0xb687('0x5e')]},'individualHooks':!![]})[_0xb687('0x2c')](function(_0x24f42b){return _0x24f42b;});}return null;})[_0xb687('0x2c')](respondWithStatusCode(_0x3afcf3,null))[_0xb687('0x5a')](handleError(_0x3afcf3,null));};exports[_0xb687('0x66')]=function(_0x5deb7a,_0x28a6aa,_0x31ed20){return db[_0xb687('0x53')][_0xb687('0x67')]({'where':{'id':_0x5deb7a[_0xb687('0x59')]['id']}})['then'](handleEntityNotFound(_0x28a6aa,null))[_0xb687('0x2c')](function(_0x2f892){if(_0x2f892){return db[_0xb687('0x68')][_0xb687('0x69')](function(_0x2f88c2){return db[_0xb687('0x53')][_0xb687('0x2d')]({'where':{'VoiceExtensionId':_0x5deb7a[_0xb687('0x59')]['id']},'transaction':_0x2f88c2})[_0xb687('0x2c')](function(_0x249d39){var _0x1c167c=_['map'](_0x5deb7a[_0xb687('0x5c')],function(_0x2b6a95){_0x2b6a95[_0xb687('0x6a')]=_0x5deb7a[_0xb687('0x59')]['id'];return _0x2b6a95;});return db['VoiceExtension'][_0xb687('0x6b')](_0x1c167c,{'transaction':_0x2f88c2});});})[_0xb687('0x2c')](function(){return db['VoiceExtension'][_0xb687('0x6c')]({'where':{'isApp':!![],'VoiceExtensionId':_0x5deb7a[_0xb687('0x59')]['id']},'order':_0xb687('0x6d')});});}})['then'](respondWithResult(_0x28a6aa,null))[_0xb687('0x5a')](handleError(_0x28a6aa,null));}; \ No newline at end of file +var _0x6d38=['eml-format','rimraf','zip-dir','moment','mustache','util','path','to-csv','ejs','lodash','squel','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','sendStatus','status','end','json','count','offset','apply','reject','then','destroy','get','InboundRoutes','outbound','InternalRoutes','ignore','map','value','includes','type','find','name','UserProfileResource','stack','send','index','VoiceExtension','rawAttributes','key','query','keys','filters','intersection','model','fields','attributes','nolimit','limit','order','sort','pick','where','VIRTUAL','filter','merge','includeAll','include','findAll','catch','params','length','create','startsWith','body','exten','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','inbound','OutboundRoutes','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','recordingFormat','cutdigits','mandatoryDisposition','context','addApplications','findOne','sequelize','transaction','VoiceExtensionId','bulkCreate','cast(priority\x20as\x20unsigned)'];(function(_0x4080dd,_0x5b595d){var _0x4ecf85=function(_0x5d281a){while(--_0x5d281a){_0x4080dd['push'](_0x4080dd['shift']());}};_0x4ecf85(++_0x5b595d);}(_0x6d38,0x1ef));var _0x86d3=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x6d38[_0x21a9d9];return _0x46adce;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x86d3('0x0'));var rimraf=require(_0x86d3('0x1'));var zipdir=require(_0x86d3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x86d3('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x86d3('0x4'));var util=require(_0x86d3('0x5'));var path=require(_0x86d3('0x6'));var sox=require('sox');var csv=require(_0x86d3('0x7'));var ejs=require(_0x86d3('0x8'));var fs=require('fs');var _=require(_0x86d3('0x9'));var squel=require(_0x86d3('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x86d3('0xb'));var toCsv=require(_0x86d3('0x7'));var querystring=require(_0x86d3('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x86d3('0xd'));var qs=require(_0x86d3('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x86d3('0xf'))(_0x86d3('0x10'));var utils=require('../../config/utils');var config=require(_0x86d3('0x11'));var db=require('../../mysqldb')['db'];config[_0x86d3('0x12')]=_[_0x86d3('0x13')](config[_0x86d3('0x12')],{'host':_0x86d3('0x14'),'port':0x18eb});var socket=require(_0x86d3('0x15'))(new Redis(config[_0x86d3('0x12')]));require(_0x86d3('0x16'))[_0x86d3('0x17')](socket);function respondWithStatusCode(_0x5ce2ff,_0x1c1ba8){_0x1c1ba8=_0x1c1ba8||0xcc;return function(_0x1f35cf){if(_0x1f35cf){return _0x5ce2ff[_0x86d3('0x18')](_0x1c1ba8);}return _0x5ce2ff[_0x86d3('0x19')](_0x1c1ba8)[_0x86d3('0x1a')]();};}function respondWithResult(_0x34fb3b,_0x1ff008){_0x1ff008=_0x1ff008||0xc8;return function(_0x44436d){if(_0x44436d){return _0x34fb3b['status'](_0x1ff008)[_0x86d3('0x1b')](_0x44436d);}};}function respondWithFilteredResult(_0x281da0,_0x431b3f){return function(_0xa26ea2){if(_0xa26ea2){var _0x46feec=_0xa26ea2[_0x86d3('0x1c')],_0x120ef3=_0x431b3f['offset'],_0x33e459=_0x431b3f[_0x86d3('0x1d')]+_0x431b3f['limit'],_0x32dee7;if(_0x33e459>=_0x46feec){_0x33e459=_0x46feec;_0x32dee7=0xc8;}else{_0x32dee7=0xce;}_0x281da0[_0x86d3('0x19')](_0x32dee7);return _0x281da0['set']('Content-Range',_0x120ef3+'-'+_0x33e459+'/'+_0x46feec)[_0x86d3('0x1b')](_0xa26ea2);}return null;};}function patchUpdates(_0x1edb6d){return function(_0x988066){try{jsonpatch[_0x86d3('0x1e')](_0x988066,_0x1edb6d,!![]);}catch(_0x5654ab){return BPromise[_0x86d3('0x1f')](_0x5654ab);}return _0x988066['save']();};}function saveUpdates(_0x36e0fa,_0x3fdf67){return function(_0x1ce849){if(_0x1ce849){return _0x1ce849['update'](_0x36e0fa)[_0x86d3('0x20')](function(_0x72b3d4){return _0x72b3d4;});}return null;};}function removeEntity(_0x1fa4ac,_0x4bf5b8){return function(_0x58ba51){if(_0x58ba51){return _0x58ba51[_0x86d3('0x21')]()['then'](function(){var _0x3c93d3=_0x58ba51[_0x86d3('0x22')]({'plain':!![]});var _0x3dfecd=[{'name':_0x86d3('0x23'),'value':'inbound','ignore':![]},{'name':'OutboundRoutes','value':_0x86d3('0x24'),'ignore':![]},{'name':_0x86d3('0x25'),'value':'internal','ignore':![]}];var _0x14e325=_(_0x3dfecd)['filter'](_0x86d3('0x26'))[_0x86d3('0x27')](_0x86d3('0x28'))[_0x86d3('0x28')]();if(_[_0x86d3('0x29')](_0x14e325,_0x3c93d3[_0x86d3('0x2a')])){return;}var _0x1f203e=_[_0x86d3('0x2b')](_0x3dfecd,[_0x86d3('0x28'),_0x3c93d3[_0x86d3('0x2a')]])[_0x86d3('0x2c')];return db[_0x86d3('0x2d')][_0x86d3('0x21')]({'where':{'type':_0x1f203e,'resourceId':_0x3c93d3['id']}})[_0x86d3('0x20')](function(){return _0x58ba51;});})['then'](function(){_0x1fa4ac[_0x86d3('0x19')](0xcc)[_0x86d3('0x1a')]();});}};}function handleEntityNotFound(_0x2bda35,_0x31cefe){return function(_0x7709f0){if(!_0x7709f0){_0x2bda35[_0x86d3('0x18')](0x194);}return _0x7709f0;};}function handleError(_0x4a5ff0,_0xba2f49){_0xba2f49=_0xba2f49||0x1f4;return function(_0x5c71df){logger['error'](_0x5c71df[_0x86d3('0x2e')]);if(_0x5c71df[_0x86d3('0x2c')]){delete _0x5c71df[_0x86d3('0x2c')];}_0x4a5ff0['status'](_0xba2f49)[_0x86d3('0x2f')](_0x5c71df);};}exports[_0x86d3('0x30')]=function(_0x5b8fdd,_0x5505b6){var _0x375264={},_0x414f34={},_0x476eb3={'count':0x0,'rows':[]};var _0x1196b6=_[_0x86d3('0x27')](db[_0x86d3('0x31')][_0x86d3('0x32')],function(_0x541309){return{'name':_0x541309['fieldName'],'type':_0x541309['type'][_0x86d3('0x33')]};});_0x414f34['model']=_[_0x86d3('0x27')](_0x1196b6,'name');_0x414f34[_0x86d3('0x34')]=_[_0x86d3('0x35')](_0x5b8fdd[_0x86d3('0x34')]);_0x414f34[_0x86d3('0x36')]=_[_0x86d3('0x37')](_0x414f34[_0x86d3('0x38')],_0x414f34[_0x86d3('0x34')]);_0x375264['attributes']=_[_0x86d3('0x37')](_0x414f34[_0x86d3('0x38')],qs['fields'](_0x5b8fdd[_0x86d3('0x34')][_0x86d3('0x39')]));_0x375264[_0x86d3('0x3a')]=_0x375264[_0x86d3('0x3a')]['length']?_0x375264[_0x86d3('0x3a')]:_0x414f34[_0x86d3('0x38')];if(!_0x5b8fdd[_0x86d3('0x34')]['hasOwnProperty'](_0x86d3('0x3b'))){_0x375264[_0x86d3('0x3c')]=qs[_0x86d3('0x3c')](_0x5b8fdd[_0x86d3('0x34')][_0x86d3('0x3c')]);_0x375264[_0x86d3('0x1d')]=qs[_0x86d3('0x1d')](_0x5b8fdd[_0x86d3('0x34')]['offset']);}_0x375264[_0x86d3('0x3d')]=qs[_0x86d3('0x3e')](_0x5b8fdd[_0x86d3('0x34')][_0x86d3('0x3e')]);_0x375264['where']=qs[_0x86d3('0x36')](_[_0x86d3('0x3f')](_0x5b8fdd[_0x86d3('0x34')],_0x414f34[_0x86d3('0x36')]),_0x1196b6);if(_0x5b8fdd['query']['filter']){_0x375264[_0x86d3('0x40')]=_['merge'](_0x375264['where'],{'$or':_[_0x86d3('0x27')](_0x1196b6,function(_0x1385fc){if(_0x1385fc[_0x86d3('0x2a')]!==_0x86d3('0x41')){var _0x23ef72={};_0x23ef72[_0x1385fc['name']]={'$like':'%'+_0x5b8fdd[_0x86d3('0x34')][_0x86d3('0x42')]+'%'};return _0x23ef72;}})});}_0x375264=_[_0x86d3('0x43')]({},_0x375264,_0x5b8fdd['options']);var _0x39d6cd={'where':_0x375264[_0x86d3('0x40')]};return db['VoiceExtension'][_0x86d3('0x1c')](_0x39d6cd)[_0x86d3('0x20')](function(_0x5d9c61){_0x476eb3['count']=_0x5d9c61;if(_0x5b8fdd['query'][_0x86d3('0x44')]){_0x375264[_0x86d3('0x45')]=[{'all':!![]}];}return db[_0x86d3('0x31')][_0x86d3('0x46')](_0x375264);})[_0x86d3('0x20')](function(_0x447bf2){_0x476eb3['rows']=_0x447bf2;return _0x476eb3;})[_0x86d3('0x20')](respondWithFilteredResult(_0x5505b6,_0x375264))[_0x86d3('0x47')](handleError(_0x5505b6,null));};exports['show']=function(_0x2f0bf6,_0x432133){var _0xb2c80e={'raw':![],'where':{'id':_0x2f0bf6[_0x86d3('0x48')]['id']}},_0xf3619={};_0xf3619[_0x86d3('0x38')]=_['keys'](db[_0x86d3('0x31')][_0x86d3('0x32')]);_0xf3619['query']=_[_0x86d3('0x35')](_0x2f0bf6[_0x86d3('0x34')]);_0xf3619[_0x86d3('0x36')]=_[_0x86d3('0x37')](_0xf3619[_0x86d3('0x38')],_0xf3619['query']);_0xb2c80e[_0x86d3('0x3a')]=_[_0x86d3('0x37')](_0xf3619[_0x86d3('0x38')],qs[_0x86d3('0x39')](_0x2f0bf6[_0x86d3('0x34')][_0x86d3('0x39')]));_0xb2c80e[_0x86d3('0x3a')]=_0xb2c80e[_0x86d3('0x3a')][_0x86d3('0x49')]?_0xb2c80e[_0x86d3('0x3a')]:_0xf3619[_0x86d3('0x38')];if(_0x2f0bf6[_0x86d3('0x34')]['includeAll']){_0xb2c80e[_0x86d3('0x45')]=[{'all':!![]}];}_0xb2c80e=_[_0x86d3('0x43')]({},_0xb2c80e,_0x2f0bf6['options']);return db[_0x86d3('0x31')][_0x86d3('0x2b')](_0xb2c80e)[_0x86d3('0x20')](handleEntityNotFound(_0x432133,null))[_0x86d3('0x20')](respondWithResult(_0x432133,null))[_0x86d3('0x47')](handleError(_0x432133,null));};exports[_0x86d3('0x21')]=function(_0x5f20d9,_0x4cd179){return db['VoiceExtension']['find']({'where':{'id':_0x5f20d9[_0x86d3('0x48')]['id']}})[_0x86d3('0x20')](handleEntityNotFound(_0x4cd179,null))[_0x86d3('0x20')](removeEntity(_0x4cd179,null))[_0x86d3('0x47')](handleError(_0x4cd179,null));};exports[_0x86d3('0x4a')]=function(_0xbfe9eb,_0x24d59e){if(_0xbfe9eb['body'][_0x86d3('0x2a')]===_0x86d3('0x24')&&!_[_0x86d3('0x4b')](_0xbfe9eb[_0x86d3('0x4c')][_0x86d3('0x4d')],'_')){_0xbfe9eb[_0x86d3('0x4c')][_0x86d3('0x4d')]='_'['concat'](_0xbfe9eb[_0x86d3('0x4c')]['exten']);}return db[_0x86d3('0x31')][_0x86d3('0x4a')](_0xbfe9eb[_0x86d3('0x4c')],{'raw':![]})[_0x86d3('0x20')](function(_0x357e1d){var _0x55e345=_0xbfe9eb[_0x86d3('0x4e')][_0x86d3('0x22')]({'plain':!![]});if(!_0x55e345)throw new Error(_0x86d3('0x4f'));if(_0x55e345['role']==='user'){var _0x5f5d52=_0x357e1d[_0x86d3('0x22')]({'plain':!![]});var _0x54ea9c=[{'name':_0x86d3('0x23'),'value':_0x86d3('0x50')},{'name':_0x86d3('0x51'),'value':_0x86d3('0x24')},{'name':'InternalRoutes','value':'internal'}];var _0x551806=_[_0x86d3('0x2b')](_0x54ea9c,[_0x86d3('0x28'),_0x5f5d52['type']])[_0x86d3('0x2c')];return db[_0x86d3('0x52')][_0x86d3('0x2b')]({'where':{'name':_0x551806,'userProfileId':_0x55e345[_0x86d3('0x53')]},'raw':!![]})[_0x86d3('0x20')](function(_0x5123fd){if(_0x5123fd&&_0x5123fd[_0x86d3('0x54')]===0x0){return db[_0x86d3('0x2d')][_0x86d3('0x4a')]({'name':_0x5f5d52[_0x86d3('0x2c')],'resourceId':_0x5f5d52['id'],'type':_0x5123fd['name'],'sectionId':_0x5123fd['id']},{})[_0x86d3('0x20')](function(){return _0x357e1d;});}else{return _0x357e1d;}})[_0x86d3('0x47')](function(_0x58a96a){logger[_0x86d3('0x55')](_0x86d3('0x56'),_0x58a96a);throw _0x58a96a;});}return _0x357e1d;})[_0x86d3('0x20')](respondWithResult(_0x24d59e,0xc9))[_0x86d3('0x47')](handleError(_0x24d59e,null));};exports[_0x86d3('0x57')]=function(_0x4029a4,_0x37c5b5){if(_0x4029a4['body']['id']){delete _0x4029a4['body']['id'];}return db[_0x86d3('0x31')]['find']({'where':{'id':_0x4029a4['params']['id']}})['then'](handleEntityNotFound(_0x37c5b5,null))[_0x86d3('0x20')](function(_0x53ad5b){if(_0x53ad5b){return db[_0x86d3('0x31')]['update'](_[_0x86d3('0x3f')](_0x4029a4[_0x86d3('0x4c')],[_0x86d3('0x4d'),'context','description',_0x86d3('0x58'),_0x86d3('0x59'),_0x86d3('0x5a')]),{'where':{'context':_0x53ad5b[_0x86d3('0x5b')],'exten':_0x53ad5b[_0x86d3('0x4d')]},'individualHooks':!![]})[_0x86d3('0x20')](function(_0x24daf3){return _0x24daf3;});}return null;})[_0x86d3('0x20')](respondWithStatusCode(_0x37c5b5,null))[_0x86d3('0x47')](handleError(_0x37c5b5,null));};exports[_0x86d3('0x5c')]=function(_0x1e3479,_0x265beb,_0xfaf168){return db[_0x86d3('0x31')][_0x86d3('0x5d')]({'where':{'id':_0x1e3479[_0x86d3('0x48')]['id']}})[_0x86d3('0x20')](handleEntityNotFound(_0x265beb,null))[_0x86d3('0x20')](function(_0x5b99f9){if(_0x5b99f9){return db[_0x86d3('0x5e')][_0x86d3('0x5f')](function(_0x42a09b){return db['VoiceExtension'][_0x86d3('0x21')]({'where':{'VoiceExtensionId':_0x1e3479[_0x86d3('0x48')]['id']},'transaction':_0x42a09b})[_0x86d3('0x20')](function(_0x90ca60){var _0x48f9d4=_[_0x86d3('0x27')](_0x1e3479['body'],function(_0x1e11bd){_0x1e11bd[_0x86d3('0x60')]=_0x1e3479[_0x86d3('0x48')]['id'];return _0x1e11bd;});return db[_0x86d3('0x31')][_0x86d3('0x61')](_0x48f9d4,{'transaction':_0x42a09b});});})['then'](function(){return db[_0x86d3('0x31')]['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0x1e3479[_0x86d3('0x48')]['id']},'order':_0x86d3('0x62')});});}})['then'](respondWithResult(_0x265beb,null))[_0x86d3('0x47')](handleError(_0x265beb,null));}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index dd413a8..2acb01c 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 _0xc94e=['save','update','remove','emit','hasOwnProperty','hook','exports','events','VoiceExtension'];(function(_0x5443ac,_0x2cb686){var _0x2e4780=function(_0x54addf){while(--_0x54addf){_0x5443ac['push'](_0x5443ac['shift']());}};_0x2e4780(++_0x2cb686);}(_0xc94e,0x11e));var _0xec94=function(_0x35fab3,_0x5287ba){_0x35fab3=_0x35fab3-0x0;var _0x251ff2=_0xc94e[_0x35fab3];return _0x251ff2;};'use strict';var EventEmitter=require(_0xec94('0x0'));var VoiceExtension=require('../../mysqldb')['db'][_0xec94('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xec94('0x2'),'afterUpdate':_0xec94('0x3'),'afterDestroy':_0xec94('0x4')};function emitEvent(_0x2e0256){return function(_0x461a43,_0x48bf08,_0x3817bd){VoiceExtensionEvents[_0xec94('0x5')](_0x2e0256+':'+_0x461a43['id'],_0x461a43);VoiceExtensionEvents['emit'](_0x2e0256,_0x461a43);_0x3817bd(null);};}for(var e in events){if(events[_0xec94('0x6')](e)){var event=events[e];VoiceExtension[_0xec94('0x7')](e,emitEvent(event));}}module[_0xec94('0x8')]=VoiceExtensionEvents; \ No newline at end of file +var _0xe783=['../../mysqldb','VoiceExtension','update','remove','emit','hook','exports','events'];(function(_0x190e33,_0x5c0ecb){var _0x5a9b8f=function(_0x5c8c08){while(--_0x5c8c08){_0x190e33['push'](_0x190e33['shift']());}};_0x5a9b8f(++_0x5c0ecb);}(_0xe783,0xe7));var _0x3e78=function(_0xafa219,_0x585143){_0xafa219=_0xafa219-0x0;var _0x4ece1c=_0xe783[_0xafa219];return _0x4ece1c;};'use strict';var EventEmitter=require(_0x3e78('0x0'));var VoiceExtension=require(_0x3e78('0x1'))['db'][_0x3e78('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x3e78('0x3'),'afterDestroy':_0x3e78('0x4')};function emitEvent(_0x283315){return function(_0xdaf7ff,_0x2c0372,_0x2d1e04){VoiceExtensionEvents[_0x3e78('0x5')](_0x283315+':'+_0xdaf7ff['id'],_0xdaf7ff);VoiceExtensionEvents['emit'](_0x283315,_0xdaf7ff);_0x2d1e04(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension[_0x3e78('0x6')](e,emitEvent(event));}}module[_0x3e78('0x7')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index f64752c..0d0e37e 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 _0x0918=['rimraf','../../config/environment','./voiceExtension.attributes','exports','define','VoiceExtension','voice_extensions','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x27711b,_0x4fe0ba){var _0x54d6bd=function(_0x494fc9){while(--_0x494fc9){_0x27711b['push'](_0x27711b['shift']());}};_0x54d6bd(++_0x4fe0ba);}(_0x0918,0x11f));var _0x8091=function(_0x1a90a4,_0x407549){_0x1a90a4=_0x1a90a4-0x0;var _0x5803c2=_0x0918[_0x1a90a4];return _0x5803c2;};'use strict';var _=require(_0x8091('0x0'));var util=require(_0x8091('0x1'));var logger=require(_0x8091('0x2'))(_0x8091('0x3'));var moment=require(_0x8091('0x4'));var BPromise=require('bluebird');var rp=require(_0x8091('0x5'));var fs=require('fs');var path=require(_0x8091('0x6'));var rimraf=require(_0x8091('0x7'));var config=require(_0x8091('0x8'));var attributes=require(_0x8091('0x9'));module[_0x8091('0xa')]=function(_0x16597e,_0x32d87a){return _0x16597e[_0x8091('0xb')](_0x8091('0xc'),attributes,{'tableName':_0x8091('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbc37=['lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','./voiceExtension.attributes','exports','VoiceExtension','voice_extensions'];(function(_0x810025,_0x34bb04){var _0x4dbc81=function(_0x2c3907){while(--_0x2c3907){_0x810025['push'](_0x810025['shift']());}};_0x4dbc81(++_0x34bb04);}(_0xbc37,0xcc));var _0x7bc3=function(_0x2317af,_0x1332d3){_0x2317af=_0x2317af-0x0;var _0x3cb58d=_0xbc37[_0x2317af];return _0x3cb58d;};'use strict';var _=require(_0x7bc3('0x0'));var util=require(_0x7bc3('0x1'));var logger=require(_0x7bc3('0x2'))(_0x7bc3('0x3'));var moment=require(_0x7bc3('0x4'));var BPromise=require('bluebird');var rp=require(_0x7bc3('0x5'));var fs=require('fs');var path=require(_0x7bc3('0x6'));var rimraf=require(_0x7bc3('0x7'));var config=require('../../config/environment');var attributes=require(_0x7bc3('0x8'));module[_0x7bc3('0x9')]=function(_0x19f595,_0x3437d3){return _0x19f595['define'](_0x7bc3('0xa'),attributes,{'tableName':_0x7bc3('0xb'),'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 9a694b3..d497519 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 _0x9fd4=['map','include','model','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','request','then','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','GetVoiceExtension','VoiceExtension','findAll','options','attributes'];(function(_0x109669,_0x1b4895){var _0x4dd5a7=function(_0x1dc91b){while(--_0x1dc91b){_0x109669['push'](_0x109669['shift']());}};_0x4dd5a7(++_0x1b4895);}(_0x9fd4,0xf1));var _0x49fd=function(_0x149b5a,_0x4bd327){_0x149b5a=_0x149b5a-0x0;var _0x3658bf=_0x9fd4[_0x149b5a];return _0x3658bf;};'use strict';var _=require(_0x49fd('0x0'));var util=require(_0x49fd('0x1'));var moment=require('moment');var BPromise=require(_0x49fd('0x2'));var rs=require(_0x49fd('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x49fd('0x4'))['db'];var utils=require(_0x49fd('0x5'));var logger=require(_0x49fd('0x6'))('rpc');var config=require(_0x49fd('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x49fd('0x8')]=_[_0x49fd('0x9')](config['redis'],{'host':_0x49fd('0xa'),'port':0x18eb});var socket=require(_0x49fd('0xb'))(new Redis(config[_0x49fd('0x8')]));require(_0x49fd('0xc'))[_0x49fd('0xd')](socket);function respondWithRpcPromise(_0x18258a,_0x2d21e6,_0x26c7b3){return new BPromise(function(_0x3895bd,_0x2225b8){return client[_0x49fd('0xe')](_0x18258a,_0x26c7b3)[_0x49fd('0xf')](function(_0x5e7584){logger['info'](_0x49fd('0x10'),_0x2d21e6,_0x49fd('0x11'));logger[_0x49fd('0x12')](_0x49fd('0x13'),_0x2d21e6,'request\x20sent',JSON[_0x49fd('0x14')](_0x5e7584));if(_0x5e7584[_0x49fd('0x15')]){if(_0x5e7584[_0x49fd('0x15')][_0x49fd('0x16')]===0x1f4){logger[_0x49fd('0x15')](_0x49fd('0x10'),_0x2d21e6,_0x5e7584[_0x49fd('0x15')]['message']);return _0x2225b8(_0x5e7584['error']['message']);}logger[_0x49fd('0x15')]('VoiceExtension,\x20%s,\x20%s',_0x2d21e6,_0x5e7584[_0x49fd('0x15')][_0x49fd('0x17')]);return _0x3895bd(_0x5e7584[_0x49fd('0x15')][_0x49fd('0x17')]);}else{logger[_0x49fd('0x18')]('VoiceExtension,\x20%s,\x20%s',_0x2d21e6,_0x49fd('0x11'));_0x3895bd(_0x5e7584['result']['message']);}})[_0x49fd('0x19')](function(_0x56b9d4){logger[_0x49fd('0x15')](_0x49fd('0x10'),_0x2d21e6,_0x56b9d4);_0x2225b8(_0x56b9d4);});});}exports[_0x49fd('0x1a')]=function(_0x396a4e){var _0x14a16f=this;return new Promise(function(_0x464fc8,_0x9437d6){return db[_0x49fd('0x1b')][_0x49fd('0x1c')]({'raw':_0x396a4e['options']?_0x396a4e[_0x49fd('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x396a4e[_0x49fd('0x1d')]?_0x396a4e[_0x49fd('0x1d')]['where']||null:null,'attributes':_0x396a4e['options']?_0x396a4e[_0x49fd('0x1d')][_0x49fd('0x1e')]||null:null,'limit':_0x396a4e[_0x49fd('0x1d')]?_0x396a4e[_0x49fd('0x1d')]['limit']||null:null,'include':_0x396a4e[_0x49fd('0x1d')]?_0x396a4e[_0x49fd('0x1d')]['include']?_[_0x49fd('0x1f')](_0x396a4e['options'][_0x49fd('0x20')],function(_0x2107df){return{'model':db[_0x2107df[_0x49fd('0x21')]],'as':_0x2107df['as'],'attributes':_0x2107df[_0x49fd('0x1e')],'include':_0x2107df[_0x49fd('0x20')]?_[_0x49fd('0x1f')](_0x2107df['include'],function(_0x92b0bb){return{'model':db[_0x92b0bb[_0x49fd('0x21')]],'as':_0x92b0bb['as'],'attributes':_0x92b0bb[_0x49fd('0x1e')],'include':_0x92b0bb[_0x49fd('0x20')]?_[_0x49fd('0x1f')](_0x92b0bb[_0x49fd('0x20')],function(_0x5e8bff){return{'model':db[_0x5e8bff[_0x49fd('0x21')]],'as':_0x5e8bff['as'],'attributes':_0x5e8bff[_0x49fd('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x49fd('0xf')](function(_0x366dc6){logger[_0x49fd('0x18')](_0x49fd('0x1a'),_0x396a4e);logger[_0x49fd('0x12')]('GetVoiceExtension',_0x396a4e,JSON[_0x49fd('0x14')](_0x366dc6));_0x464fc8(_0x366dc6);})[_0x49fd('0x19')](function(_0x47efd4){logger[_0x49fd('0x15')]('GetVoiceExtension',_0x47efd4[_0x49fd('0x17')],_0x396a4e);_0x9437d6(_0x14a16f[_0x49fd('0x15')](0x1f4,_0x47efd4[_0x49fd('0x17')]));});});}; \ No newline at end of file +var _0x21f7=['../../config/logger','rpc','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','then','info','request\x20sent','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','VoiceExtension,\x20%s,\x20%s','message','result','catch','GetVoiceExtension','VoiceExtension','findAll','options','raw','limit','include','map','model','attributes','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x12b8ec,_0x1655be){var _0x21af77=function(_0xe59f){while(--_0xe59f){_0x12b8ec['push'](_0x12b8ec['shift']());}};_0x21af77(++_0x1655be);}(_0x21f7,0x185));var _0x721f=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x21f7[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x721f('0x0'));var util=require(_0x721f('0x1'));var moment=require(_0x721f('0x2'));var BPromise=require(_0x721f('0x3'));var rs=require(_0x721f('0x4'));var fs=require('fs');var Redis=require(_0x721f('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x721f('0x6'));var logger=require(_0x721f('0x7'))(_0x721f('0x8'));var config=require(_0x721f('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x721f('0xa')]['http']({'port':0x232a});config[_0x721f('0xb')]=_[_0x721f('0xc')](config[_0x721f('0xb')],{'host':_0x721f('0xd'),'port':0x18eb});var socket=require(_0x721f('0xe'))(new Redis(config['redis']));require('./voiceExtension.socket')['register'](socket);function respondWithRpcPromise(_0x32250c,_0x28921c,_0x5a8619){return new BPromise(function(_0x5b7bb0,_0x3c7485){return client['request'](_0x32250c,_0x5a8619)[_0x721f('0xf')](function(_0x22714b){logger[_0x721f('0x10')]('VoiceExtension,\x20%s,\x20%s',_0x28921c,_0x721f('0x11'));logger['debug'](_0x721f('0x12'),_0x28921c,_0x721f('0x11'),JSON[_0x721f('0x13')](_0x22714b));if(_0x22714b[_0x721f('0x14')]){if(_0x22714b[_0x721f('0x14')]['code']===0x1f4){logger[_0x721f('0x14')](_0x721f('0x15'),_0x28921c,_0x22714b[_0x721f('0x14')]['message']);return _0x3c7485(_0x22714b['error'][_0x721f('0x16')]);}logger['error'](_0x721f('0x15'),_0x28921c,_0x22714b['error']['message']);return _0x5b7bb0(_0x22714b[_0x721f('0x14')][_0x721f('0x16')]);}else{logger['info'](_0x721f('0x15'),_0x28921c,_0x721f('0x11'));_0x5b7bb0(_0x22714b[_0x721f('0x17')][_0x721f('0x16')]);}})[_0x721f('0x18')](function(_0xcdaa43){logger[_0x721f('0x14')](_0x721f('0x15'),_0x28921c,_0xcdaa43);_0x3c7485(_0xcdaa43);});});}exports[_0x721f('0x19')]=function(_0x464796){var _0x93f3d5=this;return new Promise(function(_0x48520a,_0x238993){return db[_0x721f('0x1a')][_0x721f('0x1b')]({'raw':_0x464796[_0x721f('0x1c')]?_0x464796['options'][_0x721f('0x1d')]===undefined?!![]:![]:!![],'where':_0x464796[_0x721f('0x1c')]?_0x464796[_0x721f('0x1c')]['where']||null:null,'attributes':_0x464796[_0x721f('0x1c')]?_0x464796[_0x721f('0x1c')]['attributes']||null:null,'limit':_0x464796[_0x721f('0x1c')]?_0x464796[_0x721f('0x1c')][_0x721f('0x1e')]||null:null,'include':_0x464796[_0x721f('0x1c')]?_0x464796[_0x721f('0x1c')][_0x721f('0x1f')]?_[_0x721f('0x20')](_0x464796['options'][_0x721f('0x1f')],function(_0x41c549){return{'model':db[_0x41c549[_0x721f('0x21')]],'as':_0x41c549['as'],'attributes':_0x41c549[_0x721f('0x22')],'include':_0x41c549['include']?_[_0x721f('0x20')](_0x41c549[_0x721f('0x1f')],function(_0xc0ec4){return{'model':db[_0xc0ec4[_0x721f('0x21')]],'as':_0xc0ec4['as'],'attributes':_0xc0ec4[_0x721f('0x22')],'include':_0xc0ec4[_0x721f('0x1f')]?_[_0x721f('0x20')](_0xc0ec4[_0x721f('0x1f')],function(_0x2dfa34){return{'model':db[_0x2dfa34[_0x721f('0x21')]],'as':_0x2dfa34['as'],'attributes':_0x2dfa34[_0x721f('0x22')]};}):[]};}):[]};}):[]:[]})[_0x721f('0xf')](function(_0x247762){logger[_0x721f('0x10')](_0x721f('0x19'),_0x464796);logger[_0x721f('0x23')](_0x721f('0x19'),_0x464796,JSON[_0x721f('0x13')](_0x247762));_0x48520a(_0x247762);})[_0x721f('0x18')](function(_0x174077){logger[_0x721f('0x14')]('GetVoiceExtension',_0x174077[_0x721f('0x16')],_0x464796);_0x238993(_0x93f3d5[_0x721f('0x14')](0x1f4,_0x174077['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 8ee63c7..35a6e58 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 _0x25d9=['register','length','save','remove','removeListener'];(function(_0x616290,_0x280b7f){var _0x453879=function(_0x27bda7){while(--_0x27bda7){_0x616290['push'](_0x616290['shift']());}};_0x453879(++_0x280b7f);}(_0x25d9,0xd4));var _0x925d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x25d9[_0x321bb2];return _0x9c12ed;};'use strict';var VoiceExtensionEvents=require('./voiceExtension.events');var events=[_0x925d('0x0'),_0x925d('0x1'),'update'];function createListener(_0x56ed71,_0x1bd321){return function(_0x2befcc){_0x1bd321['emit'](_0x56ed71,_0x2befcc);};}function removeListener(_0x2b53e2,_0x55bef7){return function(){VoiceExtensionEvents[_0x925d('0x2')](_0x2b53e2,_0x55bef7);};}exports[_0x925d('0x3')]=function(_0x44ddc2){for(var _0x52b1ec=0x0,_0x1480e6=events[_0x925d('0x4')];_0x52b1ec<_0x1480e6;_0x52b1ec++){var _0x141cc1=events[_0x52b1ec];var _0x526aba=createListener('voiceExtension:'+_0x141cc1,_0x44ddc2);VoiceExtensionEvents['on'](_0x141cc1,_0x526aba);}}; \ No newline at end of file +var _0x2394=['length','./voiceExtension.events','save','remove','update','emit','removeListener','register'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x2394,0xe1));var _0x4239=function(_0xfe4b4,_0x38ec45){_0xfe4b4=_0xfe4b4-0x0;var _0x9ca3be=_0x2394[_0xfe4b4];return _0x9ca3be;};'use strict';var VoiceExtensionEvents=require(_0x4239('0x0'));var events=[_0x4239('0x1'),_0x4239('0x2'),_0x4239('0x3')];function createListener(_0x27664e,_0xc3d39e){return function(_0x5f5446){_0xc3d39e[_0x4239('0x4')](_0x27664e,_0x5f5446);};}function removeListener(_0x25cc03,_0x599338){return function(){VoiceExtensionEvents[_0x4239('0x5')](_0x25cc03,_0x599338);};}exports[_0x4239('0x6')]=function(_0x3e2197){for(var _0x5c1701=0x0,_0xcece2=events[_0x4239('0x7')];_0x5c1701<_0xcece2;_0x5c1701++){var _0x395f08=events[_0x5c1701];var _0x570d5c=createListener('voiceExtension:'+_0x395f08,_0x3e2197);VoiceExtensionEvents['on'](_0x395f08,_0x570d5c);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 5614fbb..def2ae3 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 _0x9f92=['get','isAuthenticated','/:id','show','/:id/messages','getMessages','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x4baefc,_0x388dca){var _0x193979=function(_0x3bfe0e){while(--_0x3bfe0e){_0x4baefc['push'](_0x4baefc['shift']());}};_0x193979(++_0x388dca);}(_0x9f92,0x125));var _0x29f9=function(_0x211448,_0x333996){_0x211448=_0x211448-0x0;var _0x162266=_0x9f92[_0x211448];return _0x162266;};'use strict';var multer=require(_0x29f9('0x0'));var util=require('util');var path=require(_0x29f9('0x1'));var timeout=require(_0x29f9('0x2'));var express=require(_0x29f9('0x3'));var router=express['Router']();var auth=require(_0x29f9('0x4'));var interaction=require(_0x29f9('0x5'));var config=require(_0x29f9('0x6'));var controller=require('./voiceMail.controller');router[_0x29f9('0x7')]('/',auth[_0x29f9('0x8')](),controller['index']);router[_0x29f9('0x7')](_0x29f9('0x9'),auth[_0x29f9('0x8')](),controller[_0x29f9('0xa')]);router[_0x29f9('0x7')](_0x29f9('0xb'),auth[_0x29f9('0x8')](),controller[_0x29f9('0xc')]);router[_0x29f9('0xd')]('/',auth[_0x29f9('0x8')](),controller[_0x29f9('0xe')]);router[_0x29f9('0xf')](_0x29f9('0x9'),auth['isAuthenticated'](),controller[_0x29f9('0x10')]);router[_0x29f9('0x11')](_0x29f9('0x9'),auth[_0x29f9('0x8')](),controller[_0x29f9('0x12')]);module[_0x29f9('0x13')]=router; \ No newline at end of file +var _0xe253=['getMessages','post','create','/:id','delete','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','index','show','/:id/messages'];(function(_0x2a5e15,_0x402334){var _0x375200=function(_0x20300a){while(--_0x20300a){_0x2a5e15['push'](_0x2a5e15['shift']());}};_0x375200(++_0x402334);}(_0xe253,0x16d));var _0x3e25=function(_0x1bab1c,_0x198a95){_0x1bab1c=_0x1bab1c-0x0;var _0xb97b17=_0xe253[_0x1bab1c];return _0xb97b17;};'use strict';var multer=require(_0x3e25('0x0'));var util=require(_0x3e25('0x1'));var path=require(_0x3e25('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x3e25('0x3')]();var auth=require(_0x3e25('0x4'));var interaction=require(_0x3e25('0x5'));var config=require(_0x3e25('0x6'));var controller=require(_0x3e25('0x7'));router[_0x3e25('0x8')]('/',auth[_0x3e25('0x9')](),controller[_0x3e25('0xa')]);router[_0x3e25('0x8')]('/:id',auth[_0x3e25('0x9')](),controller[_0x3e25('0xb')]);router[_0x3e25('0x8')](_0x3e25('0xc'),auth[_0x3e25('0x9')](),controller[_0x3e25('0xd')]);router[_0x3e25('0xe')]('/',auth[_0x3e25('0x9')](),controller[_0x3e25('0xf')]);router['put'](_0x3e25('0x10'),auth[_0x3e25('0x9')](),controller['update']);router[_0x3e25('0x11')](_0x3e25('0x10'),auth[_0x3e25('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 54bccf4..02d4771 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 _0xb7e7=['sequelize','STRING','from-voicemail','email','string','trim','central','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','fullname','\x20-\x20','mailbox'];(function(_0x4838c6,_0x25793c){var _0x39f083=function(_0xe0c56a){while(--_0xe0c56a){_0x4838c6['push'](_0x4838c6['shift']());}};_0x39f083(++_0x25793c);}(_0xb7e7,0x121));var _0x7b7e=function(_0x1b7368,_0x3286ed){_0x1b7368=_0x1b7368-0x0;var _0x25d54c=_0xb7e7[_0x1b7368];return _0x25d54c;};'use strict';var Sequelize=require(_0x7b7e('0x0'));module['exports']={'customer_id':{'type':Sequelize[_0x7b7e('0x1')]},'context':{'type':Sequelize['STRING'],'defaultValue':_0x7b7e('0x2'),'unique':'contest_mailbox'},'mailbox':{'type':Sequelize[_0x7b7e('0x1')],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize[_0x7b7e('0x1')]},'fullname':{'type':Sequelize[_0x7b7e('0x1')]},'email':{'type':Sequelize[_0x7b7e('0x1')],'validate':{'isEmail':!![]},'set':function(_0x52047f){this['setDataValue'](_0x7b7e('0x3'),typeof _0x52047f===_0x7b7e('0x4')&&_0x52047f[_0x7b7e('0x5')]()?_0x52047f['trim']():null);}},'pager':{'type':Sequelize[_0x7b7e('0x1')]},'tz':{'type':Sequelize[_0x7b7e('0x1')],'defaultValue':_0x7b7e('0x6')},'attach':{'type':Sequelize[_0x7b7e('0x7')](_0x7b7e('0x8'),'no'),'defaultValue':_0x7b7e('0x8'),'allowNull':![]},'saycid':{'type':Sequelize[_0x7b7e('0x7')]('yes','no'),'defaultValue':_0x7b7e('0x8'),'allowNull':![]},'dialout':{'type':Sequelize[_0x7b7e('0x1')]},'callback':{'type':Sequelize[_0x7b7e('0x1')]},'review':{'type':Sequelize[_0x7b7e('0x7')](_0x7b7e('0x8'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x7b7e('0x7')](_0x7b7e('0x8'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x7b7e('0x7')](_0x7b7e('0x8'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize['ENUM'](_0x7b7e('0x8'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x7b7e('0x9'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize['ENUM'](_0x7b7e('0x8'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x7b7e('0x7')](_0x7b7e('0x8'),'no'),'defaultValue':_0x7b7e('0x8'),'allowNull':![]},'forcename':{'type':Sequelize[_0x7b7e('0x7')](_0x7b7e('0x8'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x7b7e('0x7')](_0x7b7e('0x8'),'no'),'defaultValue':_0x7b7e('0x8'),'allowNull':![]},'stamp':{'type':_0x7b7e('0xa')},'emailsubject':{'type':Sequelize[_0x7b7e('0x1')]},'emailbody':{'type':Sequelize[_0x7b7e('0x1')]},'maxsecs':{'type':Sequelize[_0x7b7e('0xb')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x7b7e('0xb')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x7b7e('0xc')],'get':function(){return this[_0x7b7e('0xd')](_0x7b7e('0xe'))+_0x7b7e('0xf')+this[_0x7b7e('0xd')](_0x7b7e('0x10'));}}}; \ No newline at end of file +var _0x8f4c=['fullname','\x20-\x20','mailbox','sequelize','exports','STRING','from-voicemail','contest_mailbox','trim','central','ENUM','yes','TINYINT(4)','INTEGER','VIRTUAL','getDataValue'];(function(_0x247090,_0x15a925){var _0x3b824b=function(_0x55d70a){while(--_0x55d70a){_0x247090['push'](_0x247090['shift']());}};_0x3b824b(++_0x15a925);}(_0x8f4c,0x113));var _0xc8f4=function(_0x140290,_0x496d13){_0x140290=_0x140290-0x0;var _0x4e205f=_0x8f4c[_0x140290];return _0x4e205f;};'use strict';var Sequelize=require(_0xc8f4('0x0'));module[_0xc8f4('0x1')]={'customer_id':{'type':Sequelize[_0xc8f4('0x2')]},'context':{'type':Sequelize[_0xc8f4('0x2')],'defaultValue':_0xc8f4('0x3'),'unique':_0xc8f4('0x4')},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'','allowNull':![],'unique':_0xc8f4('0x4')},'password':{'type':Sequelize[_0xc8f4('0x2')]},'fullname':{'type':Sequelize[_0xc8f4('0x2')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]},'set':function(_0x32cd80){this['setDataValue']('email',typeof _0x32cd80==='string'&&_0x32cd80[_0xc8f4('0x5')]()?_0x32cd80['trim']():null);}},'pager':{'type':Sequelize[_0xc8f4('0x2')]},'tz':{'type':Sequelize[_0xc8f4('0x2')],'defaultValue':_0xc8f4('0x6')},'attach':{'type':Sequelize[_0xc8f4('0x7')](_0xc8f4('0x8'),'no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize[_0xc8f4('0x7')](_0xc8f4('0x8'),'no'),'defaultValue':_0xc8f4('0x8'),'allowNull':![]},'dialout':{'type':Sequelize[_0xc8f4('0x2')]},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize[_0xc8f4('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0xc8f4('0x7')](_0xc8f4('0x8'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xc8f4('0x7')](_0xc8f4('0x8'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xc8f4('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xc8f4('0x9'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0xc8f4('0x7')](_0xc8f4('0x8'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xc8f4('0x7')](_0xc8f4('0x8'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xc8f4('0x7')]('yes','no'),'defaultValue':_0xc8f4('0x8'),'allowNull':![]},'forcename':{'type':Sequelize[_0xc8f4('0x7')](_0xc8f4('0x8'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xc8f4('0x7')](_0xc8f4('0x8'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize['ENUM'](_0xc8f4('0x8'),'no'),'defaultValue':'yes','allowNull':![]},'stamp':{'type':'TIMESTAMP'},'emailsubject':{'type':Sequelize[_0xc8f4('0x2')]},'emailbody':{'type':Sequelize[_0xc8f4('0x2')]},'maxsecs':{'type':Sequelize[_0xc8f4('0xa')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0xc8f4('0xa')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0xc8f4('0xb')],'get':function(){return this[_0xc8f4('0xc')](_0xc8f4('0xd'))+_0xc8f4('0xe')+this[_0xc8f4('0xc')](_0xc8f4('0xf'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index d8458eb..cea29e4 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 _0x87d6=['user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Voicemails','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','findOne','VoiceMailMessage','filter','findAndCountAll','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','status','end','json','count','offset','limit','set','apply','update','then','destroy','UserProfileResource','error','stack','name','map','VoiceMail','rawAttributes','fieldName','type','query','keys','filters','model','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','options','includeAll','rows','show','params','fields','include','catch','create'];(function(_0x592979,_0x47b605){var _0x4f9950=function(_0xe9751c){while(--_0xe9751c){_0x592979['push'](_0x592979['shift']());}};_0x4f9950(++_0x47b605);}(_0x87d6,0x1d1));var _0x687d=function(_0x3d2e4b,_0x1f6653){_0x3d2e4b=_0x3d2e4b-0x0;var _0x509e78=_0x87d6[_0x3d2e4b];return _0x509e78;};'use strict';var pdf=require(_0x687d('0x0'));var emlformat=require(_0x687d('0x1'));var rimraf=require(_0x687d('0x2'));var zipdir=require(_0x687d('0x3'));var jsonpatch=require(_0x687d('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x687d('0x5'));var sox=require(_0x687d('0x6'));var csv=require(_0x687d('0x7'));var ejs=require(_0x687d('0x8'));var fs=require('fs');var _=require(_0x687d('0x9'));var squel=require('squel');var crypto=require(_0x687d('0xa'));var jsforce=require(_0x687d('0xb'));var deskjs=require(_0x687d('0xc'));var toCsv=require(_0x687d('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x687d('0xd'));var as=require(_0x687d('0xe'));var hardwareService=require(_0x687d('0xf'));var logger=require('../../config/logger')('api');var utils=require(_0x687d('0x10'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1345a7,_0xd6d36a){_0xd6d36a=_0xd6d36a||0xcc;return function(_0x56832b){if(_0x56832b){return _0x1345a7['sendStatus'](_0xd6d36a);}return _0x1345a7[_0x687d('0x11')](_0xd6d36a)[_0x687d('0x12')]();};}function respondWithResult(_0x3c9945,_0x2bc363){_0x2bc363=_0x2bc363||0xc8;return function(_0xd6677d){if(_0xd6677d){return _0x3c9945[_0x687d('0x11')](_0x2bc363)[_0x687d('0x13')](_0xd6677d);}};}function respondWithFilteredResult(_0x2cb4fa,_0x3f395f){return function(_0x4c4bf){if(_0x4c4bf){var _0x2f5ded=_0x4c4bf[_0x687d('0x14')],_0x3666b9=_0x3f395f[_0x687d('0x15')],_0x82fc07=_0x3f395f['offset']+_0x3f395f[_0x687d('0x16')],_0x10db5a;if(_0x82fc07>=_0x2f5ded){_0x82fc07=_0x2f5ded;_0x10db5a=0xc8;}else{_0x10db5a=0xce;}_0x2cb4fa[_0x687d('0x11')](_0x10db5a);return _0x2cb4fa[_0x687d('0x17')]('Content-Range',_0x3666b9+'-'+_0x82fc07+'/'+_0x2f5ded)[_0x687d('0x13')](_0x4c4bf);}return null;};}function patchUpdates(_0x13494e){return function(_0x523b3a){try{jsonpatch[_0x687d('0x18')](_0x523b3a,_0x13494e,!![]);}catch(_0x150435){return BPromise['reject'](_0x150435);}return _0x523b3a['save']();};}function saveUpdates(_0x28a2d7,_0x48dd04){return function(_0x127976){if(_0x127976){return _0x127976[_0x687d('0x19')](_0x28a2d7)[_0x687d('0x1a')](function(_0x5528df){return _0x5528df;});}return null;};}function removeEntity(_0x249028,_0xe39871){return function(_0xef3461){if(_0xef3461){return _0xef3461[_0x687d('0x1b')]()[_0x687d('0x1a')](function(){var _0x4f30cf=_0xef3461['get']({'plain':!![]});var _0x43787c='Voicemails';return db[_0x687d('0x1c')][_0x687d('0x1b')]({'where':{'type':_0x43787c,'resourceId':_0x4f30cf['id']}})['then'](function(){return _0xef3461;});})[_0x687d('0x1a')](function(){_0x249028['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x344328,_0x9d26d6){return function(_0x42c4af){if(!_0x42c4af){_0x344328['sendStatus'](0x194);}return _0x42c4af;};}function handleError(_0x465063,_0x4346c9){_0x4346c9=_0x4346c9||0x1f4;return function(_0x41e8de){logger[_0x687d('0x1d')](_0x41e8de[_0x687d('0x1e')]);if(_0x41e8de['name']){delete _0x41e8de[_0x687d('0x1f')];}_0x465063[_0x687d('0x11')](_0x4346c9)['send'](_0x41e8de);};}exports['index']=function(_0x994ed9,_0x3fae85){var _0x675715={},_0x2d9332={},_0x3fc109={'count':0x0,'rows':[]};var _0x2e0b06=_[_0x687d('0x20')](db[_0x687d('0x21')][_0x687d('0x22')],function(_0x58e5bf){return{'name':_0x58e5bf[_0x687d('0x23')],'type':_0x58e5bf[_0x687d('0x24')]['key']};});_0x2d9332['model']=_['map'](_0x2e0b06,_0x687d('0x1f'));_0x2d9332[_0x687d('0x25')]=_[_0x687d('0x26')](_0x994ed9[_0x687d('0x25')]);_0x2d9332[_0x687d('0x27')]=_['intersection'](_0x2d9332[_0x687d('0x28')],_0x2d9332['query']);_0x675715[_0x687d('0x29')]=_[_0x687d('0x2a')](_0x2d9332['model'],qs['fields'](_0x994ed9[_0x687d('0x25')]['fields']));_0x675715[_0x687d('0x29')]=_0x675715[_0x687d('0x29')][_0x687d('0x2b')]?_0x675715[_0x687d('0x29')]:_0x2d9332['model'];if(!_0x994ed9[_0x687d('0x25')][_0x687d('0x2c')](_0x687d('0x2d'))){_0x675715['limit']=qs[_0x687d('0x16')](_0x994ed9[_0x687d('0x25')]['limit']);_0x675715[_0x687d('0x15')]=qs[_0x687d('0x15')](_0x994ed9[_0x687d('0x25')][_0x687d('0x15')]);}_0x675715[_0x687d('0x2e')]=qs[_0x687d('0x2f')](_0x994ed9[_0x687d('0x25')][_0x687d('0x2f')]);_0x675715['where']=qs[_0x687d('0x27')](_['pick'](_0x994ed9[_0x687d('0x25')],_0x2d9332[_0x687d('0x27')]),_0x2e0b06);if(_0x994ed9[_0x687d('0x25')]['filter']){_0x675715[_0x687d('0x30')]=_[_0x687d('0x31')](_0x675715['where'],{'$or':_[_0x687d('0x20')](_0x2e0b06,function(_0x5983d7){if(_0x5983d7[_0x687d('0x24')]!==_0x687d('0x32')){var _0x15fec8={};_0x15fec8[_0x5983d7[_0x687d('0x1f')]]={'$like':'%'+_0x994ed9[_0x687d('0x25')]['filter']+'%'};return _0x15fec8;}})});}_0x675715=_[_0x687d('0x31')]({},_0x675715,_0x994ed9[_0x687d('0x33')]);var _0x5f4d55={'where':_0x675715[_0x687d('0x30')]};return db[_0x687d('0x21')][_0x687d('0x14')](_0x5f4d55)[_0x687d('0x1a')](function(_0xf0eef0){_0x3fc109[_0x687d('0x14')]=_0xf0eef0;if(_0x994ed9['query'][_0x687d('0x34')]){_0x675715['include']=[{'all':!![]}];}return db['VoiceMail']['findAll'](_0x675715);})[_0x687d('0x1a')](function(_0x245f9a){_0x3fc109[_0x687d('0x35')]=_0x245f9a;return _0x3fc109;})['then'](respondWithFilteredResult(_0x3fae85,_0x675715))['catch'](handleError(_0x3fae85,null));};exports[_0x687d('0x36')]=function(_0x4afe3f,_0x5c5946){var _0x245134={'raw':!![],'where':{'id':_0x4afe3f[_0x687d('0x37')]['id']}},_0x5489b7={};_0x5489b7[_0x687d('0x28')]=_['keys'](db[_0x687d('0x21')][_0x687d('0x22')]);_0x5489b7[_0x687d('0x25')]=_['keys'](_0x4afe3f['query']);_0x5489b7[_0x687d('0x27')]=_[_0x687d('0x2a')](_0x5489b7[_0x687d('0x28')],_0x5489b7[_0x687d('0x25')]);_0x245134['attributes']=_['intersection'](_0x5489b7[_0x687d('0x28')],qs['fields'](_0x4afe3f[_0x687d('0x25')][_0x687d('0x38')]));_0x245134[_0x687d('0x29')]=_0x245134[_0x687d('0x29')]['length']?_0x245134[_0x687d('0x29')]:_0x5489b7[_0x687d('0x28')];if(_0x4afe3f[_0x687d('0x25')][_0x687d('0x34')]){_0x245134[_0x687d('0x39')]=[{'all':!![]}];}_0x245134=_[_0x687d('0x31')]({},_0x245134,_0x4afe3f[_0x687d('0x33')]);return db['VoiceMail']['find'](_0x245134)['then'](handleEntityNotFound(_0x5c5946,null))['then'](respondWithResult(_0x5c5946,null))[_0x687d('0x3a')](handleError(_0x5c5946,null));};exports[_0x687d('0x3b')]=function(_0x287a10,_0x45e89d){return db[_0x687d('0x21')][_0x687d('0x3b')](_0x287a10['body'],{})[_0x687d('0x1a')](function(_0x31b0da){var _0x387780=_0x287a10[_0x687d('0x3c')][_0x687d('0x3d')]({'plain':!![]});if(!_0x387780)throw new Error(_0x687d('0x3e'));if(_0x387780[_0x687d('0x3f')]==='user'){var _0x36a7ce=_0x31b0da['get']({'plain':!![]});var _0x327a75=_0x687d('0x40');return db[_0x687d('0x41')][_0x687d('0x42')]({'where':{'name':_0x327a75,'userProfileId':_0x387780[_0x687d('0x43')]},'raw':!![]})[_0x687d('0x1a')](function(_0x1a7172){if(_0x1a7172&&_0x1a7172[_0x687d('0x44')]===0x0){return db[_0x687d('0x1c')]['create']({'name':_0x36a7ce[_0x687d('0x1f')],'resourceId':_0x36a7ce['id'],'type':_0x1a7172[_0x687d('0x1f')],'sectionId':_0x1a7172['id']},{})['then'](function(){return _0x31b0da;});}else{return _0x31b0da;}})[_0x687d('0x3a')](function(_0x54e15a){logger['error'](_0x687d('0x45'),_0x54e15a);throw _0x54e15a;});}return _0x31b0da;})[_0x687d('0x1a')](respondWithResult(_0x45e89d,0xc9))[_0x687d('0x3a')](handleError(_0x45e89d,null));};exports[_0x687d('0x19')]=function(_0x5b71d7,_0x74b9b7){if(_0x5b71d7[_0x687d('0x46')]['id']){delete _0x5b71d7['body']['id'];}return db[_0x687d('0x21')][_0x687d('0x42')]({'where':{'id':_0x5b71d7[_0x687d('0x37')]['id']}})[_0x687d('0x1a')](handleEntityNotFound(_0x74b9b7,null))['then'](saveUpdates(_0x5b71d7[_0x687d('0x46')],null))[_0x687d('0x1a')](respondWithResult(_0x74b9b7,null))['catch'](handleError(_0x74b9b7,null));};exports[_0x687d('0x1b')]=function(_0x26fe72,_0x58f067){return db[_0x687d('0x21')]['find']({'where':{'id':_0x26fe72[_0x687d('0x37')]['id']}})[_0x687d('0x1a')](handleEntityNotFound(_0x58f067,null))[_0x687d('0x1a')](removeEntity(_0x58f067,null))[_0x687d('0x3a')](handleError(_0x58f067,null));};exports['getMessages']=function(_0x4a64da,_0x5df8b0,_0x33c270){return db[_0x687d('0x21')][_0x687d('0x47')]({'where':{'id':_0x4a64da[_0x687d('0x37')]['id']}})[_0x687d('0x1a')](handleEntityNotFound(_0x5df8b0,null))[_0x687d('0x1a')](function(_0x1b6a46){var _0xd4b68e;var _0x27e565={},_0x42e3f5={};_0x42e3f5[_0x687d('0x28')]=_[_0x687d('0x26')](db[_0x687d('0x48')]['rawAttributes']);_0x42e3f5[_0x687d('0x25')]=_[_0x687d('0x26')](_0x4a64da[_0x687d('0x25')]);_0x42e3f5[_0x687d('0x27')]=_[_0x687d('0x2a')](_0x42e3f5[_0x687d('0x28')],_0x42e3f5[_0x687d('0x25')]);_0x27e565[_0x687d('0x29')]=_['intersection'](_0x42e3f5['model'],qs[_0x687d('0x38')](_0x4a64da[_0x687d('0x25')]['fields']));_0x27e565[_0x687d('0x29')]=_0x27e565['attributes'][_0x687d('0x2b')]?_0x27e565[_0x687d('0x29')]:_0x42e3f5['model'];if(!_0x4a64da[_0x687d('0x25')][_0x687d('0x2c')](_0x687d('0x2d'))){_0x27e565[_0x687d('0x16')]=qs[_0x687d('0x16')](_0x4a64da[_0x687d('0x25')][_0x687d('0x16')]);_0x27e565['offset']=qs[_0x687d('0x15')](_0x4a64da['query'][_0x687d('0x15')]);}_0x27e565['order']=qs[_0x687d('0x2f')](_0x4a64da['query'][_0x687d('0x2f')]);_0x27e565['where']=qs['filters'](_['pick'](_0x4a64da['query'],_0x42e3f5[_0x687d('0x27')]));if(_0x4a64da[_0x687d('0x25')][_0x687d('0x49')]){_0x27e565[_0x687d('0x30')]=_[_0x687d('0x31')](_0x27e565['where'],{'$or':_[_0x687d('0x20')](_0x27e565[_0x687d('0x29')],function(_0x4c6180){var _0x49b140={};_0x49b140[_0x4c6180]={'$like':'%'+_0x4a64da[_0x687d('0x25')][_0x687d('0x49')]+'%'};return _0x49b140;})});}_0x27e565[_0x687d('0x30')]=_[_0x687d('0x31')](_0x27e565[_0x687d('0x30')],{'mailboxuser':_0x1b6a46['mailbox']});_0x27e565=_[_0x687d('0x31')]({},_0x27e565,_0x4a64da[_0x687d('0x33')]);return db['VoiceMailMessage'][_0x687d('0x4a')](_0x27e565)['then'](respondWithFilteredResult(_0x5df8b0,_0x27e565));})[_0x687d('0x3a')](handleError(_0x5df8b0,null));}; \ No newline at end of file +var _0x436e=['name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','limit','order','where','pick','filter','merge','options','VoiceMail','includeAll','include','findAll','catch','show','params','intersection','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getMessages','findOne','VoiceMailMessage','nolimit','sort','mailbox','findAndCountAll','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','sendStatus','status','end','json','count','offset','Content-Range','apply','reject','update','then','Voicemails','UserProfileResource','destroy','error','stack'];(function(_0xeaacf4,_0x337542){var _0x2ecf94=function(_0x2ae369){while(--_0x2ae369){_0xeaacf4['push'](_0xeaacf4['shift']());}};_0x2ecf94(++_0x337542);}(_0x436e,0x194));var _0xe436=function(_0x112c4c,_0x460cab){_0x112c4c=_0x112c4c-0x0;var _0x43b3cd=_0x436e[_0x112c4c];return _0x43b3cd;};'use strict';var pdf=require(_0xe436('0x0'));var emlformat=require(_0xe436('0x1'));var rimraf=require(_0xe436('0x2'));var zipdir=require(_0xe436('0x3'));var jsonpatch=require(_0xe436('0x4'));var rp=require(_0xe436('0x5'));var moment=require(_0xe436('0x6'));var BPromise=require(_0xe436('0x7'));var Mustache=require('mustache');var util=require(_0xe436('0x8'));var path=require(_0xe436('0x9'));var sox=require(_0xe436('0xa'));var csv=require(_0xe436('0xb'));var ejs=require(_0xe436('0xc'));var fs=require('fs');var _=require(_0xe436('0xd'));var squel=require(_0xe436('0xe'));var crypto=require(_0xe436('0xf'));var jsforce=require(_0xe436('0x10'));var deskjs=require(_0xe436('0x11'));var toCsv=require(_0xe436('0xb'));var querystring=require(_0xe436('0x12'));var Papa=require(_0xe436('0x13'));var Redis=require('ioredis');var authService=require(_0xe436('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xe436('0x15'));var hardwareService=require(_0xe436('0x16'));var logger=require(_0xe436('0x17'))(_0xe436('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xc6fcf5,_0x5957b7){_0x5957b7=_0x5957b7||0xcc;return function(_0x53112b){if(_0x53112b){return _0xc6fcf5[_0xe436('0x19')](_0x5957b7);}return _0xc6fcf5[_0xe436('0x1a')](_0x5957b7)[_0xe436('0x1b')]();};}function respondWithResult(_0x5e6c71,_0x5e18f7){_0x5e18f7=_0x5e18f7||0xc8;return function(_0x173107){if(_0x173107){return _0x5e6c71[_0xe436('0x1a')](_0x5e18f7)[_0xe436('0x1c')](_0x173107);}};}function respondWithFilteredResult(_0x656ce8,_0x48c226){return function(_0x329732){if(_0x329732){var _0x47cfaf=_0x329732[_0xe436('0x1d')],_0x567671=_0x48c226[_0xe436('0x1e')],_0x59a502=_0x48c226['offset']+_0x48c226['limit'],_0x23f7cd;if(_0x59a502>=_0x47cfaf){_0x59a502=_0x47cfaf;_0x23f7cd=0xc8;}else{_0x23f7cd=0xce;}_0x656ce8[_0xe436('0x1a')](_0x23f7cd);return _0x656ce8['set'](_0xe436('0x1f'),_0x567671+'-'+_0x59a502+'/'+_0x47cfaf)[_0xe436('0x1c')](_0x329732);}return null;};}function patchUpdates(_0x269960){return function(_0x237b94){try{jsonpatch[_0xe436('0x20')](_0x237b94,_0x269960,!![]);}catch(_0x4e9ebe){return BPromise[_0xe436('0x21')](_0x4e9ebe);}return _0x237b94['save']();};}function saveUpdates(_0x63f456,_0x2dcc90){return function(_0x9c2216){if(_0x9c2216){return _0x9c2216[_0xe436('0x22')](_0x63f456)[_0xe436('0x23')](function(_0x4f4872){return _0x4f4872;});}return null;};}function removeEntity(_0x46d3be,_0x569deb){return function(_0x1851c8){if(_0x1851c8){return _0x1851c8['destroy']()['then'](function(){var _0x557697=_0x1851c8['get']({'plain':!![]});var _0x133408=_0xe436('0x24');return db[_0xe436('0x25')][_0xe436('0x26')]({'where':{'type':_0x133408,'resourceId':_0x557697['id']}})[_0xe436('0x23')](function(){return _0x1851c8;});})[_0xe436('0x23')](function(){_0x46d3be[_0xe436('0x1a')](0xcc)[_0xe436('0x1b')]();});}};}function handleEntityNotFound(_0x28ec11,_0x23e1ad){return function(_0x55e8aa){if(!_0x55e8aa){_0x28ec11[_0xe436('0x19')](0x194);}return _0x55e8aa;};}function handleError(_0x27c67b,_0x168fc8){_0x168fc8=_0x168fc8||0x1f4;return function(_0x38ba5f){logger[_0xe436('0x27')](_0x38ba5f[_0xe436('0x28')]);if(_0x38ba5f[_0xe436('0x29')]){delete _0x38ba5f[_0xe436('0x29')];}_0x27c67b[_0xe436('0x1a')](_0x168fc8)[_0xe436('0x2a')](_0x38ba5f);};}exports[_0xe436('0x2b')]=function(_0x5e2e6d,_0x40e3be){var _0x44ecdc={},_0x5d3df7={},_0x3783e5={'count':0x0,'rows':[]};var _0x206c18=_[_0xe436('0x2c')](db['VoiceMail'][_0xe436('0x2d')],function(_0x1f0dfc){return{'name':_0x1f0dfc[_0xe436('0x2e')],'type':_0x1f0dfc[_0xe436('0x2f')][_0xe436('0x30')]};});_0x5d3df7[_0xe436('0x31')]=_[_0xe436('0x2c')](_0x206c18,'name');_0x5d3df7[_0xe436('0x32')]=_[_0xe436('0x33')](_0x5e2e6d[_0xe436('0x32')]);_0x5d3df7[_0xe436('0x34')]=_['intersection'](_0x5d3df7[_0xe436('0x31')],_0x5d3df7[_0xe436('0x32')]);_0x44ecdc[_0xe436('0x35')]=_['intersection'](_0x5d3df7[_0xe436('0x31')],qs[_0xe436('0x36')](_0x5e2e6d[_0xe436('0x32')][_0xe436('0x36')]));_0x44ecdc[_0xe436('0x35')]=_0x44ecdc['attributes'][_0xe436('0x37')]?_0x44ecdc[_0xe436('0x35')]:_0x5d3df7[_0xe436('0x31')];if(!_0x5e2e6d[_0xe436('0x32')]['hasOwnProperty']('nolimit')){_0x44ecdc[_0xe436('0x38')]=qs[_0xe436('0x38')](_0x5e2e6d[_0xe436('0x32')][_0xe436('0x38')]);_0x44ecdc[_0xe436('0x1e')]=qs[_0xe436('0x1e')](_0x5e2e6d[_0xe436('0x32')][_0xe436('0x1e')]);}_0x44ecdc[_0xe436('0x39')]=qs['sort'](_0x5e2e6d[_0xe436('0x32')]['sort']);_0x44ecdc[_0xe436('0x3a')]=qs[_0xe436('0x34')](_[_0xe436('0x3b')](_0x5e2e6d['query'],_0x5d3df7[_0xe436('0x34')]),_0x206c18);if(_0x5e2e6d[_0xe436('0x32')][_0xe436('0x3c')]){_0x44ecdc['where']=_[_0xe436('0x3d')](_0x44ecdc['where'],{'$or':_[_0xe436('0x2c')](_0x206c18,function(_0x3fd5d6){if(_0x3fd5d6['type']!=='VIRTUAL'){var _0x4c3adc={};_0x4c3adc[_0x3fd5d6[_0xe436('0x29')]]={'$like':'%'+_0x5e2e6d['query'][_0xe436('0x3c')]+'%'};return _0x4c3adc;}})});}_0x44ecdc=_[_0xe436('0x3d')]({},_0x44ecdc,_0x5e2e6d[_0xe436('0x3e')]);var _0x354e9c={'where':_0x44ecdc['where']};return db[_0xe436('0x3f')][_0xe436('0x1d')](_0x354e9c)['then'](function(_0x52e4b5){_0x3783e5[_0xe436('0x1d')]=_0x52e4b5;if(_0x5e2e6d[_0xe436('0x32')][_0xe436('0x40')]){_0x44ecdc[_0xe436('0x41')]=[{'all':!![]}];}return db['VoiceMail'][_0xe436('0x42')](_0x44ecdc);})[_0xe436('0x23')](function(_0x50acbf){_0x3783e5['rows']=_0x50acbf;return _0x3783e5;})[_0xe436('0x23')](respondWithFilteredResult(_0x40e3be,_0x44ecdc))[_0xe436('0x43')](handleError(_0x40e3be,null));};exports[_0xe436('0x44')]=function(_0x403d96,_0x28f608){var _0x35fa6d={'raw':!![],'where':{'id':_0x403d96[_0xe436('0x45')]['id']}},_0x219d59={};_0x219d59[_0xe436('0x31')]=_['keys'](db[_0xe436('0x3f')]['rawAttributes']);_0x219d59[_0xe436('0x32')]=_['keys'](_0x403d96[_0xe436('0x32')]);_0x219d59[_0xe436('0x34')]=_[_0xe436('0x46')](_0x219d59[_0xe436('0x31')],_0x219d59[_0xe436('0x32')]);_0x35fa6d[_0xe436('0x35')]=_[_0xe436('0x46')](_0x219d59[_0xe436('0x31')],qs[_0xe436('0x36')](_0x403d96[_0xe436('0x32')][_0xe436('0x36')]));_0x35fa6d[_0xe436('0x35')]=_0x35fa6d[_0xe436('0x35')][_0xe436('0x37')]?_0x35fa6d[_0xe436('0x35')]:_0x219d59['model'];if(_0x403d96[_0xe436('0x32')][_0xe436('0x40')]){_0x35fa6d[_0xe436('0x41')]=[{'all':!![]}];}_0x35fa6d=_['merge']({},_0x35fa6d,_0x403d96[_0xe436('0x3e')]);return db['VoiceMail'][_0xe436('0x47')](_0x35fa6d)[_0xe436('0x23')](handleEntityNotFound(_0x28f608,null))[_0xe436('0x23')](respondWithResult(_0x28f608,null))[_0xe436('0x43')](handleError(_0x28f608,null));};exports[_0xe436('0x48')]=function(_0x390955,_0x226eec){return db[_0xe436('0x3f')]['create'](_0x390955[_0xe436('0x49')],{})['then'](function(_0x4f3cf5){var _0x33c43a=_0x390955['user'][_0xe436('0x4a')]({'plain':!![]});if(!_0x33c43a)throw new Error(_0xe436('0x4b'));if(_0x33c43a[_0xe436('0x4c')]===_0xe436('0x4d')){var _0x262840=_0x4f3cf5[_0xe436('0x4a')]({'plain':!![]});var _0x4dfd94=_0xe436('0x24');return db[_0xe436('0x4e')]['find']({'where':{'name':_0x4dfd94,'userProfileId':_0x33c43a[_0xe436('0x4f')]},'raw':!![]})['then'](function(_0x4d08a7){if(_0x4d08a7&&_0x4d08a7[_0xe436('0x50')]===0x0){return db[_0xe436('0x25')][_0xe436('0x48')]({'name':_0x262840[_0xe436('0x29')],'resourceId':_0x262840['id'],'type':_0x4d08a7['name'],'sectionId':_0x4d08a7['id']},{})[_0xe436('0x23')](function(){return _0x4f3cf5;});}else{return _0x4f3cf5;}})[_0xe436('0x43')](function(_0x191a42){logger['error'](_0xe436('0x51'),_0x191a42);throw _0x191a42;});}return _0x4f3cf5;})['then'](respondWithResult(_0x226eec,0xc9))[_0xe436('0x43')](handleError(_0x226eec,null));};exports[_0xe436('0x22')]=function(_0x419166,_0x322e6d){if(_0x419166[_0xe436('0x49')]['id']){delete _0x419166[_0xe436('0x49')]['id'];}return db[_0xe436('0x3f')][_0xe436('0x47')]({'where':{'id':_0x419166[_0xe436('0x45')]['id']}})[_0xe436('0x23')](handleEntityNotFound(_0x322e6d,null))['then'](saveUpdates(_0x419166[_0xe436('0x49')],null))[_0xe436('0x23')](respondWithResult(_0x322e6d,null))[_0xe436('0x43')](handleError(_0x322e6d,null));};exports[_0xe436('0x26')]=function(_0x3b1971,_0x5e401b){return db[_0xe436('0x3f')]['find']({'where':{'id':_0x3b1971[_0xe436('0x45')]['id']}})[_0xe436('0x23')](handleEntityNotFound(_0x5e401b,null))[_0xe436('0x23')](removeEntity(_0x5e401b,null))[_0xe436('0x43')](handleError(_0x5e401b,null));};exports[_0xe436('0x52')]=function(_0xb027c8,_0x2cfb38,_0x2c5026){return db[_0xe436('0x3f')][_0xe436('0x53')]({'where':{'id':_0xb027c8[_0xe436('0x45')]['id']}})[_0xe436('0x23')](handleEntityNotFound(_0x2cfb38,null))[_0xe436('0x23')](function(_0x470ed2){var _0x4287c4;var _0x132cca={},_0x212c3c={};_0x212c3c['model']=_[_0xe436('0x33')](db[_0xe436('0x54')][_0xe436('0x2d')]);_0x212c3c[_0xe436('0x32')]=_[_0xe436('0x33')](_0xb027c8[_0xe436('0x32')]);_0x212c3c['filters']=_['intersection'](_0x212c3c[_0xe436('0x31')],_0x212c3c[_0xe436('0x32')]);_0x132cca[_0xe436('0x35')]=_[_0xe436('0x46')](_0x212c3c['model'],qs[_0xe436('0x36')](_0xb027c8['query'][_0xe436('0x36')]));_0x132cca[_0xe436('0x35')]=_0x132cca[_0xe436('0x35')][_0xe436('0x37')]?_0x132cca[_0xe436('0x35')]:_0x212c3c['model'];if(!_0xb027c8[_0xe436('0x32')]['hasOwnProperty'](_0xe436('0x55'))){_0x132cca[_0xe436('0x38')]=qs[_0xe436('0x38')](_0xb027c8[_0xe436('0x32')]['limit']);_0x132cca[_0xe436('0x1e')]=qs[_0xe436('0x1e')](_0xb027c8[_0xe436('0x32')][_0xe436('0x1e')]);}_0x132cca[_0xe436('0x39')]=qs[_0xe436('0x56')](_0xb027c8[_0xe436('0x32')]['sort']);_0x132cca[_0xe436('0x3a')]=qs[_0xe436('0x34')](_[_0xe436('0x3b')](_0xb027c8[_0xe436('0x32')],_0x212c3c[_0xe436('0x34')]));if(_0xb027c8[_0xe436('0x32')][_0xe436('0x3c')]){_0x132cca['where']=_[_0xe436('0x3d')](_0x132cca[_0xe436('0x3a')],{'$or':_['map'](_0x132cca[_0xe436('0x35')],function(_0x685673){var _0x81e9ee={};_0x81e9ee[_0x685673]={'$like':'%'+_0xb027c8[_0xe436('0x32')][_0xe436('0x3c')]+'%'};return _0x81e9ee;})});}_0x132cca[_0xe436('0x3a')]=_[_0xe436('0x3d')](_0x132cca[_0xe436('0x3a')],{'mailboxuser':_0x470ed2[_0xe436('0x57')]});_0x132cca=_[_0xe436('0x3d')]({},_0x132cca,_0xb027c8['options']);return db['VoiceMailMessage'][_0xe436('0x58')](_0x132cca)[_0xe436('0x23')](respondWithFilteredResult(_0x2cfb38,_0x132cca));})[_0xe436('0x43')](handleError(_0x2cfb38,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 173515b..97334e7 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 _0x66eb=['exports','voice_voicemail','mailbox_context','mailbox','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMail.attributes'];(function(_0x7f42c1,_0x592f5a){var _0x40dcc6=function(_0x2cb984){while(--_0x2cb984){_0x7f42c1['push'](_0x7f42c1['shift']());}};_0x40dcc6(++_0x592f5a);}(_0x66eb,0x1d2));var _0xb66e=function(_0xbc2974,_0xec3342){_0xbc2974=_0xbc2974-0x0;var _0x3a5b4f=_0x66eb[_0xbc2974];return _0x3a5b4f;};'use strict';var _=require(_0xb66e('0x0'));var util=require(_0xb66e('0x1'));var logger=require(_0xb66e('0x2'))('api');var moment=require(_0xb66e('0x3'));var BPromise=require(_0xb66e('0x4'));var rp=require(_0xb66e('0x5'));var fs=require('fs');var path=require(_0xb66e('0x6'));var rimraf=require(_0xb66e('0x7'));var config=require(_0xb66e('0x8'));var attributes=require(_0xb66e('0x9'));module[_0xb66e('0xa')]=function(_0x4b7f81,_0x2648f2){return _0x4b7f81['define']('VoiceMail',attributes,{'tableName':_0xb66e('0xb'),'paranoid':![],'indexes':[{'name':_0xb66e('0xc'),'fields':[_0xb66e('0xd'),'context']}],'timestamps':!![]});}; \ No newline at end of file +var _0xda74=['context','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','define','VoiceMail','voice_voicemail','mailbox_context','mailbox'];(function(_0x26d2c4,_0x50d8d1){var _0x3cf0f7=function(_0x14dbec){while(--_0x14dbec){_0x26d2c4['push'](_0x26d2c4['shift']());}};_0x3cf0f7(++_0x50d8d1);}(_0xda74,0xf1));var _0x4da7=function(_0x279f01,_0x3c289c){_0x279f01=_0x279f01-0x0;var _0x48a931=_0xda74[_0x279f01];return _0x48a931;};'use strict';var _=require(_0x4da7('0x0'));var util=require(_0x4da7('0x1'));var logger=require(_0x4da7('0x2'))(_0x4da7('0x3'));var moment=require(_0x4da7('0x4'));var BPromise=require(_0x4da7('0x5'));var rp=require(_0x4da7('0x6'));var fs=require('fs');var path=require(_0x4da7('0x7'));var rimraf=require('rimraf');var config=require(_0x4da7('0x8'));var attributes=require('./voiceMail.attributes');module[_0x4da7('0x9')]=function(_0xef2fd,_0x5c115f){return _0xef2fd[_0x4da7('0xa')](_0x4da7('0xb'),attributes,{'tableName':_0x4da7('0xc'),'paranoid':![],'indexes':[{'name':_0x4da7('0xd'),'fields':[_0x4da7('0xe'),_0x4da7('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 4dc9a57..3ff7499 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 _0xbd19=['jayson/promise','client','http','request','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x12807b,_0x7c0dfb){var _0x5a676e=function(_0x2cb9d9){while(--_0x2cb9d9){_0x12807b['push'](_0x12807b['shift']());}};_0x5a676e(++_0x7c0dfb);}(_0xbd19,0x1d6));var _0x9bd1=function(_0x101e7b,_0x4ef05b){_0x101e7b=_0x101e7b-0x0;var _0x4995c0=_0xbd19[_0x101e7b];return _0x4995c0;};'use strict';var _=require(_0x9bd1('0x0'));var util=require(_0x9bd1('0x1'));var moment=require(_0x9bd1('0x2'));var BPromise=require(_0x9bd1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9bd1('0x4'));var db=require(_0x9bd1('0x5'))['db'];var utils=require(_0x9bd1('0x6'));var logger=require(_0x9bd1('0x7'))(_0x9bd1('0x8'));var config=require(_0x9bd1('0x9'));var jayson=require(_0x9bd1('0xa'));var client=jayson[_0x9bd1('0xb')][_0x9bd1('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x405654,_0x187b8e,_0x27e8f3){return new BPromise(function(_0x55e2e8,_0x8e12ae){return client[_0x9bd1('0xd')](_0x405654,_0x27e8f3)[_0x9bd1('0xe')](function(_0x30b02c){logger[_0x9bd1('0xf')](_0x9bd1('0x10'),_0x187b8e,_0x9bd1('0x11'));logger[_0x9bd1('0x12')]('VoiceMail,\x20%s,\x20%s,\x20%s',_0x187b8e,_0x9bd1('0x11'),JSON['stringify'](_0x30b02c));if(_0x30b02c[_0x9bd1('0x13')]){if(_0x30b02c[_0x9bd1('0x13')][_0x9bd1('0x14')]===0x1f4){logger[_0x9bd1('0x13')]('VoiceMail,\x20%s,\x20%s',_0x187b8e,_0x30b02c[_0x9bd1('0x13')]['message']);return _0x8e12ae(_0x30b02c[_0x9bd1('0x13')][_0x9bd1('0x15')]);}logger[_0x9bd1('0x13')](_0x9bd1('0x10'),_0x187b8e,_0x30b02c['error'][_0x9bd1('0x15')]);return _0x55e2e8(_0x30b02c[_0x9bd1('0x13')]['message']);}else{logger[_0x9bd1('0xf')]('VoiceMail,\x20%s,\x20%s',_0x187b8e,_0x9bd1('0x11'));_0x55e2e8(_0x30b02c[_0x9bd1('0x16')]['message']);}})[_0x9bd1('0x17')](function(_0x15eec1){logger[_0x9bd1('0x13')]('VoiceMail,\x20%s,\x20%s',_0x187b8e,_0x15eec1);_0x8e12ae(_0x15eec1);});});} \ No newline at end of file +var _0x1fc5=['../../config/logger','../../config/environment','jayson/promise','client','http','request','info','VoiceMail,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','VoiceMail,\x20%s,\x20%s','util','moment','randomstring','../../mysqldb','../../config/utils'];(function(_0x25658e,_0x5a0713){var _0x1942ae=function(_0x54266a){while(--_0x54266a){_0x25658e['push'](_0x25658e['shift']());}};_0x1942ae(++_0x5a0713);}(_0x1fc5,0xf7));var _0x51fc=function(_0x5eb9e8,_0x1b5076){_0x5eb9e8=_0x5eb9e8-0x0;var _0x3d7896=_0x1fc5[_0x5eb9e8];return _0x3d7896;};'use strict';var _=require('lodash');var util=require(_0x51fc('0x0'));var moment=require(_0x51fc('0x1'));var BPromise=require('bluebird');var rs=require(_0x51fc('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x51fc('0x3'))['db'];var utils=require(_0x51fc('0x4'));var logger=require(_0x51fc('0x5'))('rpc');var config=require(_0x51fc('0x6'));var jayson=require(_0x51fc('0x7'));var client=jayson[_0x51fc('0x8')][_0x51fc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x36e262,_0x261b76,_0x3a38bb){return new BPromise(function(_0x2277e0,_0x1894c7){return client[_0x51fc('0xa')](_0x36e262,_0x3a38bb)['then'](function(_0x32462b){logger[_0x51fc('0xb')]('VoiceMail,\x20%s,\x20%s',_0x261b76,'request\x20sent');logger['debug'](_0x51fc('0xc'),_0x261b76,_0x51fc('0xd'),JSON[_0x51fc('0xe')](_0x32462b));if(_0x32462b[_0x51fc('0xf')]){if(_0x32462b[_0x51fc('0xf')]['code']===0x1f4){logger[_0x51fc('0xf')]('VoiceMail,\x20%s,\x20%s',_0x261b76,_0x32462b[_0x51fc('0xf')][_0x51fc('0x10')]);return _0x1894c7(_0x32462b[_0x51fc('0xf')]['message']);}logger[_0x51fc('0xf')](_0x51fc('0x11'),_0x261b76,_0x32462b[_0x51fc('0xf')][_0x51fc('0x10')]);return _0x2277e0(_0x32462b[_0x51fc('0xf')][_0x51fc('0x10')]);}else{logger[_0x51fc('0xb')](_0x51fc('0x11'),_0x261b76,_0x51fc('0xd'));_0x2277e0(_0x32462b['result'][_0x51fc('0x10')]);}})['catch'](function(_0x5ec2be){logger[_0x51fc('0xf')](_0x51fc('0x11'),_0x261b76,_0x5ec2be);_0x1894c7(_0x5ec2be);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 0cfd425..577ac7f 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 _0x46ed=['multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/download','download','create','update','delete','exports'];(function(_0x4f3956,_0xb882fa){var _0x97c11f=function(_0x3f6a84){while(--_0x3f6a84){_0x4f3956['push'](_0x4f3956['shift']());}};_0x97c11f(++_0xb882fa);}(_0x46ed,0x168));var _0xd46e=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x46ed[_0x59ee6f];return _0x4c0979;};'use strict';var multer=require(_0xd46e('0x0'));var util=require(_0xd46e('0x1'));var path=require('path');var timeout=require(_0xd46e('0x2'));var express=require(_0xd46e('0x3'));var router=express[_0xd46e('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xd46e('0x5'));var config=require(_0xd46e('0x6'));var controller=require('./voiceMailMessage.controller');router[_0xd46e('0x7')]('/',auth[_0xd46e('0x8')](),controller[_0xd46e('0x9')]);router[_0xd46e('0x7')](_0xd46e('0xa'),auth[_0xd46e('0x8')](),controller[_0xd46e('0xb')]);router[_0xd46e('0x7')](_0xd46e('0xc'),auth[_0xd46e('0x8')](),controller[_0xd46e('0xd')]);router['post']('/',auth[_0xd46e('0x8')](),controller[_0xd46e('0xe')]);router['put'](_0xd46e('0xa'),auth[_0xd46e('0x8')](),controller[_0xd46e('0xf')]);router[_0xd46e('0x10')](_0xd46e('0xa'),auth[_0xd46e('0x8')](),controller['destroy']);module[_0xd46e('0x11')]=router; \ No newline at end of file +var _0x7a54=['show','/:id/download','create','/:id','delete','destroy','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','isAuthenticated'];(function(_0x266ebd,_0x1be8e8){var _0x58b23f=function(_0x2e00ee){while(--_0x2e00ee){_0x266ebd['push'](_0x266ebd['shift']());}};_0x58b23f(++_0x1be8e8);}(_0x7a54,0x106));var _0x47a5=function(_0xc126c7,_0xd5cafb){_0xc126c7=_0xc126c7-0x0;var _0x2a11b8=_0x7a54[_0xc126c7];return _0x2a11b8;};'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')]('/:id',auth[_0x47a5('0x9')](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth['isAuthenticated'](),controller['download']);router['post']('/',auth[_0x47a5('0x9')](),controller[_0x47a5('0xc')]);router['put'](_0x47a5('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x47a5('0xe')](_0x47a5('0xd'),auth[_0x47a5('0x9')](),controller[_0x47a5('0xf')]);module[_0x47a5('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 9612c28..b56f93a 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 _0x436b=['sequelize','exports','VIRTUAL','getDataValue','INTEGER','STRING','TIMESTAMP'];(function(_0x3263f5,_0xf655e3){var _0x588a98=function(_0x28123f){while(--_0x28123f){_0x3263f5['push'](_0x3263f5['shift']());}};_0x588a98(++_0xf655e3);}(_0x436b,0x142));var _0xb436=function(_0x4cd585,_0x449d33){_0x4cd585=_0x4cd585-0x0;var _0x29cd43=_0x436b[_0x4cd585];return _0x29cd43;};'use strict';var Sequelize=require(_0xb436('0x0'));module[_0xb436('0x1')]={'name':{'type':Sequelize[_0xb436('0x2')],'get':function(_0x4b90cd){return this[_0xb436('0x3')]('id');}},'msgnum':{'type':Sequelize[_0xb436('0x4')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xb436('0x5')],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xb436('0x5')],'defaultValue':''},'callerid':{'type':Sequelize[_0xb436('0x5')],'defaultValue':''},'origtime':{'type':Sequelize[_0xb436('0x5')],'defaultValue':''},'duration':{'type':Sequelize[_0xb436('0x5')],'defaultValue':''},'mailboxuser':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize['BLOB']('long'),'defaultValue':null},'flag':{'type':Sequelize[_0xb436('0x5')],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':_0xb436('0x6'),'allowNull':![]}}; \ No newline at end of file +var _0x47db=['INTEGER','STRING','BLOB','VIRTUAL','getDataValue'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x47db,0xf3));var _0xb47d=function(_0x2dac10,_0x2eb3be){_0x2dac10=_0x2dac10-0x0;var _0x3a1141=_0x47db[_0x2dac10];return _0x3a1141;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xb47d('0x0')],'get':function(_0xeaca14){return this[_0xb47d('0x1')]('id');}},'msgnum':{'type':Sequelize[_0xb47d('0x2')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xb47d('0x3')],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xb47d('0x3')],'defaultValue':''},'callerid':{'type':Sequelize[_0xb47d('0x3')],'defaultValue':''},'origtime':{'type':Sequelize['STRING'],'defaultValue':''},'duration':{'type':Sequelize[_0xb47d('0x3')],'defaultValue':''},'mailboxuser':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize[_0xb47d('0x4')]('long'),'defaultValue':null},'flag':{'type':Sequelize[_0xb47d('0x3')],'defaultValue':''},'msg_id':{'type':Sequelize[_0xb47d('0x3')],'defaultValue':''},'stamp':{'type':'TIMESTAMP','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 140bd34..29eccde 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 _0xb688=['query','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','show','params','options','find','catch','create','download','recording','msg_id','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','attachment;\x20filename=\x22','.wav\x22','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','apply','save','update','then','destroy','error','stack','send','index','VoiceMailMessage','rawAttributes','type','key','model','differenceBy','map','name','keys','filters','intersection'];(function(_0x6d8534,_0xf69e4c){var _0x19527d=function(_0x45dc9){while(--_0x45dc9){_0x6d8534['push'](_0x6d8534['shift']());}};_0x19527d(++_0xf69e4c);}(_0xb688,0xcf));var _0x8b68=function(_0x5d051e,_0x2feb67){_0x5d051e=_0x5d051e-0x0;var _0x3ce954=_0xb688[_0x5d051e];return _0x3ce954;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8b68('0x0'));var rimraf=require(_0x8b68('0x1'));var zipdir=require(_0x8b68('0x2'));var jsonpatch=require(_0x8b68('0x3'));var rp=require(_0x8b68('0x4'));var moment=require(_0x8b68('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x8b68('0x6'));var util=require(_0x8b68('0x7'));var path=require(_0x8b68('0x8'));var sox=require(_0x8b68('0x9'));var csv=require('to-csv');var ejs=require(_0x8b68('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x8b68('0xb'));var crypto=require(_0x8b68('0xc'));var jsforce=require(_0x8b68('0xd'));var deskjs=require(_0x8b68('0xe'));var toCsv=require(_0x8b68('0xf'));var querystring=require(_0x8b68('0x10'));var Papa=require(_0x8b68('0x11'));var Redis=require(_0x8b68('0x12'));var authService=require(_0x8b68('0x13'));var qs=require(_0x8b68('0x14'));var as=require(_0x8b68('0x15'));var hardwareService=require(_0x8b68('0x16'));var logger=require(_0x8b68('0x17'))('api');var utils=require(_0x8b68('0x18'));var config=require(_0x8b68('0x19'));var db=require(_0x8b68('0x1a'))['db'];function respondWithStatusCode(_0x2d8472,_0x1965cf){_0x1965cf=_0x1965cf||0xcc;return function(_0x2f3af4){if(_0x2f3af4){return _0x2d8472[_0x8b68('0x1b')](_0x1965cf);}return _0x2d8472[_0x8b68('0x1c')](_0x1965cf)[_0x8b68('0x1d')]();};}function respondWithResult(_0x5b4364,_0xb2df35){_0xb2df35=_0xb2df35||0xc8;return function(_0x509033){if(_0x509033){return _0x5b4364['status'](_0xb2df35)[_0x8b68('0x1e')](_0x509033);}};}function respondWithFilteredResult(_0x1554d6,_0x27d717){return function(_0x5d3468){if(_0x5d3468){var _0x5c8d0e=_0x5d3468[_0x8b68('0x1f')],_0x23bd52=_0x27d717[_0x8b68('0x20')],_0x5c1e44=_0x27d717[_0x8b68('0x20')]+_0x27d717['limit'],_0x136f1b;if(_0x5c1e44>=_0x5c8d0e){_0x5c1e44=_0x5c8d0e;_0x136f1b=0xc8;}else{_0x136f1b=0xce;}_0x1554d6[_0x8b68('0x1c')](_0x136f1b);return _0x1554d6[_0x8b68('0x21')]('Content-Range',_0x23bd52+'-'+_0x5c1e44+'/'+_0x5c8d0e)[_0x8b68('0x1e')](_0x5d3468);}return null;};}function patchUpdates(_0x3c7e5a){return function(_0x3cf3bd){try{jsonpatch[_0x8b68('0x22')](_0x3cf3bd,_0x3c7e5a,!![]);}catch(_0x38b7a7){return BPromise['reject'](_0x38b7a7);}return _0x3cf3bd[_0x8b68('0x23')]();};}function saveUpdates(_0x4b4b0f,_0x59e9b1){return function(_0x1a9788){if(_0x1a9788){return _0x1a9788[_0x8b68('0x24')](_0x4b4b0f)[_0x8b68('0x25')](function(_0x5603d4){return _0x5603d4;});}return null;};}function removeEntity(_0x571adf,_0x23edc1){return function(_0x59cb26){if(_0x59cb26){return _0x59cb26[_0x8b68('0x26')]()[_0x8b68('0x25')](function(){_0x571adf[_0x8b68('0x1c')](0xcc)[_0x8b68('0x1d')]();});}};}function handleEntityNotFound(_0x32ddc5,_0x173524){return function(_0x59bb8a){if(!_0x59bb8a){_0x32ddc5[_0x8b68('0x1b')](0x194);}return _0x59bb8a;};}function handleError(_0x46e827,_0x4ca77d){_0x4ca77d=_0x4ca77d||0x1f4;return function(_0x1c5808){logger[_0x8b68('0x27')](_0x1c5808[_0x8b68('0x28')]);if(_0x1c5808['name']){delete _0x1c5808['name'];}_0x46e827['status'](_0x4ca77d)[_0x8b68('0x29')](_0x1c5808);};}exports[_0x8b68('0x2a')]=function(_0x2ba2a3,_0x583476){var _0x3311c7={},_0x53aaa2={},_0x4cf89d={'count':0x0,'rows':[]};var _0x3865ea=_['map'](db[_0x8b68('0x2b')][_0x8b68('0x2c')],function(_0x48e2c8){return{'name':_0x48e2c8['fieldName'],'type':_0x48e2c8[_0x8b68('0x2d')][_0x8b68('0x2e')]};});_0x53aaa2[_0x8b68('0x2f')]=_[_0x8b68('0x30')](_[_0x8b68('0x31')](_0x3865ea,_0x8b68('0x32')),[_0x8b68('0x32')]);_0x53aaa2['query']=_[_0x8b68('0x33')](_0x2ba2a3['query']);_0x53aaa2[_0x8b68('0x34')]=_[_0x8b68('0x35')](_0x53aaa2['model'],_0x53aaa2[_0x8b68('0x36')]);_0x3311c7[_0x8b68('0x37')]=_[_0x8b68('0x35')](_0x53aaa2['model'],qs['fields'](_0x2ba2a3[_0x8b68('0x36')][_0x8b68('0x38')]));_0x3311c7[_0x8b68('0x37')]=_0x3311c7[_0x8b68('0x37')][_0x8b68('0x39')]?_0x3311c7[_0x8b68('0x37')]:_0x53aaa2[_0x8b68('0x2f')];if(!_0x2ba2a3[_0x8b68('0x36')][_0x8b68('0x3a')](_0x8b68('0x3b'))){_0x3311c7[_0x8b68('0x3c')]=qs[_0x8b68('0x3c')](_0x2ba2a3[_0x8b68('0x36')][_0x8b68('0x3c')]);_0x3311c7[_0x8b68('0x20')]=qs[_0x8b68('0x20')](_0x2ba2a3[_0x8b68('0x36')][_0x8b68('0x20')]);}_0x3311c7[_0x8b68('0x3d')]=qs[_0x8b68('0x3e')](_0x2ba2a3[_0x8b68('0x36')][_0x8b68('0x3e')]);_0x3311c7['where']=qs['filters'](_[_0x8b68('0x3f')](_0x2ba2a3[_0x8b68('0x36')],_0x53aaa2[_0x8b68('0x34')]),_0x3865ea);if(_0x2ba2a3[_0x8b68('0x36')][_0x8b68('0x40')]){_0x3311c7[_0x8b68('0x41')]=_[_0x8b68('0x42')](_0x3311c7[_0x8b68('0x41')],{'$or':_['map'](_0x3865ea,function(_0x14cda1){if(_0x14cda1[_0x8b68('0x2d')]!==_0x8b68('0x43')){var _0x13cf49={};_0x13cf49[_0x14cda1[_0x8b68('0x32')]]={'$like':'%'+_0x2ba2a3[_0x8b68('0x36')][_0x8b68('0x40')]+'%'};return _0x13cf49;}})});}_0x3311c7=_[_0x8b68('0x42')]({},_0x3311c7,_0x2ba2a3['options']);var _0x3f874c={'where':_0x3311c7[_0x8b68('0x41')]};return db[_0x8b68('0x2b')][_0x8b68('0x1f')](_0x3f874c)[_0x8b68('0x25')](function(_0x3b3394){_0x4cf89d[_0x8b68('0x1f')]=_0x3b3394;if(_0x2ba2a3['query'][_0x8b68('0x44')]){_0x3311c7[_0x8b68('0x45')]=[{'all':!![]}];}return db['VoiceMailMessage'][_0x8b68('0x46')](_0x3311c7);})[_0x8b68('0x25')](function(_0x50b2f1){_0x4cf89d['rows']=_0x50b2f1;return _0x4cf89d;})['then'](respondWithFilteredResult(_0x583476,_0x3311c7))['catch'](handleError(_0x583476,null));};exports[_0x8b68('0x47')]=function(_0x23d24a,_0x515815){var _0x1998dc={'raw':!![],'where':{'id':_0x23d24a[_0x8b68('0x48')]['id']}},_0x5960fc={};_0x5960fc[_0x8b68('0x2f')]=_['keys'](db[_0x8b68('0x2b')]['rawAttributes']);_0x5960fc['query']=_['keys'](_0x23d24a[_0x8b68('0x36')]);_0x5960fc[_0x8b68('0x34')]=_[_0x8b68('0x35')](_0x5960fc[_0x8b68('0x2f')],_0x5960fc['query']);_0x1998dc[_0x8b68('0x37')]=_['intersection'](_0x5960fc[_0x8b68('0x2f')],qs[_0x8b68('0x38')](_0x23d24a['query'][_0x8b68('0x38')]));_0x1998dc[_0x8b68('0x37')]=_0x1998dc[_0x8b68('0x37')][_0x8b68('0x39')]?_0x1998dc['attributes']:_0x5960fc[_0x8b68('0x2f')];if(_0x23d24a[_0x8b68('0x36')][_0x8b68('0x44')]){_0x1998dc[_0x8b68('0x45')]=[{'all':!![]}];}_0x1998dc=_[_0x8b68('0x42')]({},_0x1998dc,_0x23d24a[_0x8b68('0x49')]);return db[_0x8b68('0x2b')][_0x8b68('0x4a')](_0x1998dc)[_0x8b68('0x25')](handleEntityNotFound(_0x515815,null))[_0x8b68('0x25')](respondWithResult(_0x515815,null))[_0x8b68('0x4b')](handleError(_0x515815,null));};exports[_0x8b68('0x4c')]=function(_0x1af430,_0x108c8d){return db[_0x8b68('0x2b')][_0x8b68('0x4c')](_0x1af430['body'],{})[_0x8b68('0x25')](respondWithResult(_0x108c8d,0xc9))[_0x8b68('0x4b')](handleError(_0x108c8d,null));};exports['update']=function(_0xeab810,_0x4cd28a){if(_0xeab810['body']['id']){delete _0xeab810['body']['id'];}return db[_0x8b68('0x2b')][_0x8b68('0x4a')]({'where':{'id':_0xeab810[_0x8b68('0x48')]['id']}})[_0x8b68('0x25')](handleEntityNotFound(_0x4cd28a,null))['then'](saveUpdates(_0xeab810['body'],null))[_0x8b68('0x25')](respondWithResult(_0x4cd28a,null))[_0x8b68('0x4b')](handleError(_0x4cd28a,null));};exports[_0x8b68('0x26')]=function(_0x5d08c4,_0x3f6e21){return db[_0x8b68('0x2b')]['find']({'where':{'id':_0x5d08c4[_0x8b68('0x48')]['id']}})[_0x8b68('0x25')](handleEntityNotFound(_0x3f6e21,null))['then'](removeEntity(_0x3f6e21,null))[_0x8b68('0x4b')](handleError(_0x3f6e21,null));};exports[_0x8b68('0x4d')]=function(_0x51bf1b,_0x3f7f89,_0x735e17){return db['VoiceMailMessage']['find']({'where':{'id':_0x51bf1b['params']['id']},'attributes':['id',_0x8b68('0x4e'),_0x8b68('0x4f')]})[_0x8b68('0x25')](handleEntityNotFound(_0x3f7f89,null))[_0x8b68('0x25')](function(_0x55aad3){if(_0x55aad3){if(!_0x55aad3['recording']){throw new db[(_0x8b68('0x50'))][(_0x8b68('0x51'))](_0x8b68('0x52'));}var _0x5c0ece={'Content-Type':_0x8b68('0x53'),'Content-Disposition':_0x8b68('0x54')};if(_0x55aad3[_0x8b68('0x4f')]){_0x5c0ece['Content-Disposition']=_0x8b68('0x55')+_0x55aad3['msg_id']+_0x8b68('0x56');}_0x3f7f89[_0x8b68('0x21')](_0x5c0ece);return _0x3f7f89['send'](new Buffer(_0x55aad3[_0x8b68('0x4e')]));}})[_0x8b68('0x4b')](handleError(_0x3f7f89,null));}; \ No newline at end of file +var _0x5eb1=['send','index','map','VoiceMailMessage','type','model','differenceBy','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','VIRTUAL','filter','options','then','includeAll','include','findAll','rows','catch','params','keys','merge','create','body','find','recording','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','msg_id','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','end','json','count','offset','Content-Range','apply','reject','save','update','destroy','error','name'];(function(_0x513772,_0x4bdcc8){var _0x4fea03=function(_0x88d6a6){while(--_0x88d6a6){_0x513772['push'](_0x513772['shift']());}};_0x4fea03(++_0x4bdcc8);}(_0x5eb1,0x7c));var _0x15eb=function(_0x2526e3,_0x5f22f8){_0x2526e3=_0x2526e3-0x0;var _0xcf6f48=_0x5eb1[_0x2526e3];return _0xcf6f48;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x15eb('0x0'));var rimraf=require(_0x15eb('0x1'));var zipdir=require(_0x15eb('0x2'));var jsonpatch=require(_0x15eb('0x3'));var rp=require(_0x15eb('0x4'));var moment=require(_0x15eb('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x15eb('0x6'));var util=require(_0x15eb('0x7'));var path=require(_0x15eb('0x8'));var sox=require(_0x15eb('0x9'));var csv=require('to-csv');var ejs=require(_0x15eb('0xa'));var fs=require('fs');var _=require(_0x15eb('0xb'));var squel=require('squel');var crypto=require(_0x15eb('0xc'));var jsforce=require(_0x15eb('0xd'));var deskjs=require(_0x15eb('0xe'));var toCsv=require(_0x15eb('0xf'));var querystring=require(_0x15eb('0x10'));var Papa=require(_0x15eb('0x11'));var Redis=require(_0x15eb('0x12'));var authService=require(_0x15eb('0x13'));var qs=require(_0x15eb('0x14'));var as=require(_0x15eb('0x15'));var hardwareService=require(_0x15eb('0x16'));var logger=require(_0x15eb('0x17'))(_0x15eb('0x18'));var utils=require('../../config/utils');var config=require(_0x15eb('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5e678a,_0x498a0c){_0x498a0c=_0x498a0c||0xcc;return function(_0xda1ddf){if(_0xda1ddf){return _0x5e678a[_0x15eb('0x1a')](_0x498a0c);}return _0x5e678a[_0x15eb('0x1b')](_0x498a0c)[_0x15eb('0x1c')]();};}function respondWithResult(_0x4fabd6,_0x1d5326){_0x1d5326=_0x1d5326||0xc8;return function(_0x3b921c){if(_0x3b921c){return _0x4fabd6[_0x15eb('0x1b')](_0x1d5326)[_0x15eb('0x1d')](_0x3b921c);}};}function respondWithFilteredResult(_0x52ade3,_0x48aed7){return function(_0x544e7c){if(_0x544e7c){var _0x500d58=_0x544e7c[_0x15eb('0x1e')],_0x1188e0=_0x48aed7['offset'],_0x52223c=_0x48aed7[_0x15eb('0x1f')]+_0x48aed7['limit'],_0x53efa1;if(_0x52223c>=_0x500d58){_0x52223c=_0x500d58;_0x53efa1=0xc8;}else{_0x53efa1=0xce;}_0x52ade3[_0x15eb('0x1b')](_0x53efa1);return _0x52ade3['set'](_0x15eb('0x20'),_0x1188e0+'-'+_0x52223c+'/'+_0x500d58)[_0x15eb('0x1d')](_0x544e7c);}return null;};}function patchUpdates(_0x5cc4b1){return function(_0xa1def8){try{jsonpatch[_0x15eb('0x21')](_0xa1def8,_0x5cc4b1,!![]);}catch(_0x4b9a96){return BPromise[_0x15eb('0x22')](_0x4b9a96);}return _0xa1def8[_0x15eb('0x23')]();};}function saveUpdates(_0x205cd5,_0x149332){return function(_0xb66333){if(_0xb66333){return _0xb66333[_0x15eb('0x24')](_0x205cd5)['then'](function(_0x222cf1){return _0x222cf1;});}return null;};}function removeEntity(_0x4e4d75,_0x2603fe){return function(_0x49915b){if(_0x49915b){return _0x49915b[_0x15eb('0x25')]()['then'](function(){_0x4e4d75[_0x15eb('0x1b')](0xcc)[_0x15eb('0x1c')]();});}};}function handleEntityNotFound(_0xa0cefc,_0x9b0a52){return function(_0x14d66e){if(!_0x14d66e){_0xa0cefc[_0x15eb('0x1a')](0x194);}return _0x14d66e;};}function handleError(_0x43b58d,_0x44207c){_0x44207c=_0x44207c||0x1f4;return function(_0x1fa175){logger[_0x15eb('0x26')](_0x1fa175['stack']);if(_0x1fa175[_0x15eb('0x27')]){delete _0x1fa175[_0x15eb('0x27')];}_0x43b58d[_0x15eb('0x1b')](_0x44207c)[_0x15eb('0x28')](_0x1fa175);};}exports[_0x15eb('0x29')]=function(_0x24f18d,_0x155fa2){var _0x512007={},_0x4da36d={},_0x1706ed={'count':0x0,'rows':[]};var _0x1def52=_[_0x15eb('0x2a')](db[_0x15eb('0x2b')]['rawAttributes'],function(_0x222764){return{'name':_0x222764['fieldName'],'type':_0x222764[_0x15eb('0x2c')]['key']};});_0x4da36d[_0x15eb('0x2d')]=_[_0x15eb('0x2e')](_[_0x15eb('0x2a')](_0x1def52,_0x15eb('0x27')),[_0x15eb('0x27')]);_0x4da36d[_0x15eb('0x2f')]=_['keys'](_0x24f18d[_0x15eb('0x2f')]);_0x4da36d[_0x15eb('0x30')]=_[_0x15eb('0x31')](_0x4da36d['model'],_0x4da36d['query']);_0x512007[_0x15eb('0x32')]=_[_0x15eb('0x31')](_0x4da36d['model'],qs['fields'](_0x24f18d['query'][_0x15eb('0x33')]));_0x512007['attributes']=_0x512007[_0x15eb('0x32')][_0x15eb('0x34')]?_0x512007['attributes']:_0x4da36d[_0x15eb('0x2d')];if(!_0x24f18d[_0x15eb('0x2f')][_0x15eb('0x35')](_0x15eb('0x36'))){_0x512007[_0x15eb('0x37')]=qs[_0x15eb('0x37')](_0x24f18d['query'][_0x15eb('0x37')]);_0x512007[_0x15eb('0x1f')]=qs[_0x15eb('0x1f')](_0x24f18d[_0x15eb('0x2f')][_0x15eb('0x1f')]);}_0x512007['order']=qs[_0x15eb('0x38')](_0x24f18d[_0x15eb('0x2f')]['sort']);_0x512007[_0x15eb('0x39')]=qs[_0x15eb('0x30')](_['pick'](_0x24f18d[_0x15eb('0x2f')],_0x4da36d['filters']),_0x1def52);if(_0x24f18d[_0x15eb('0x2f')]['filter']){_0x512007[_0x15eb('0x39')]=_['merge'](_0x512007[_0x15eb('0x39')],{'$or':_[_0x15eb('0x2a')](_0x1def52,function(_0x5d120f){if(_0x5d120f['type']!==_0x15eb('0x3a')){var _0x2b9962={};_0x2b9962[_0x5d120f[_0x15eb('0x27')]]={'$like':'%'+_0x24f18d['query'][_0x15eb('0x3b')]+'%'};return _0x2b9962;}})});}_0x512007=_['merge']({},_0x512007,_0x24f18d[_0x15eb('0x3c')]);var _0x5ba382={'where':_0x512007[_0x15eb('0x39')]};return db[_0x15eb('0x2b')][_0x15eb('0x1e')](_0x5ba382)[_0x15eb('0x3d')](function(_0x724448){_0x1706ed[_0x15eb('0x1e')]=_0x724448;if(_0x24f18d[_0x15eb('0x2f')][_0x15eb('0x3e')]){_0x512007[_0x15eb('0x3f')]=[{'all':!![]}];}return db[_0x15eb('0x2b')][_0x15eb('0x40')](_0x512007);})['then'](function(_0x430ee3){_0x1706ed[_0x15eb('0x41')]=_0x430ee3;return _0x1706ed;})[_0x15eb('0x3d')](respondWithFilteredResult(_0x155fa2,_0x512007))[_0x15eb('0x42')](handleError(_0x155fa2,null));};exports['show']=function(_0x1618e5,_0x63b7e8){var _0x414a5e={'raw':!![],'where':{'id':_0x1618e5[_0x15eb('0x43')]['id']}},_0x180370={};_0x180370['model']=_[_0x15eb('0x44')](db[_0x15eb('0x2b')]['rawAttributes']);_0x180370['query']=_[_0x15eb('0x44')](_0x1618e5[_0x15eb('0x2f')]);_0x180370[_0x15eb('0x30')]=_['intersection'](_0x180370[_0x15eb('0x2d')],_0x180370[_0x15eb('0x2f')]);_0x414a5e['attributes']=_[_0x15eb('0x31')](_0x180370[_0x15eb('0x2d')],qs[_0x15eb('0x33')](_0x1618e5[_0x15eb('0x2f')][_0x15eb('0x33')]));_0x414a5e[_0x15eb('0x32')]=_0x414a5e['attributes'][_0x15eb('0x34')]?_0x414a5e[_0x15eb('0x32')]:_0x180370['model'];if(_0x1618e5[_0x15eb('0x2f')][_0x15eb('0x3e')]){_0x414a5e[_0x15eb('0x3f')]=[{'all':!![]}];}_0x414a5e=_[_0x15eb('0x45')]({},_0x414a5e,_0x1618e5[_0x15eb('0x3c')]);return db[_0x15eb('0x2b')]['find'](_0x414a5e)[_0x15eb('0x3d')](handleEntityNotFound(_0x63b7e8,null))['then'](respondWithResult(_0x63b7e8,null))[_0x15eb('0x42')](handleError(_0x63b7e8,null));};exports['create']=function(_0x58765f,_0x770b5a){return db[_0x15eb('0x2b')][_0x15eb('0x46')](_0x58765f['body'],{})['then'](respondWithResult(_0x770b5a,0xc9))[_0x15eb('0x42')](handleError(_0x770b5a,null));};exports['update']=function(_0x100c2f,_0x59955e){if(_0x100c2f[_0x15eb('0x47')]['id']){delete _0x100c2f[_0x15eb('0x47')]['id'];}return db[_0x15eb('0x2b')][_0x15eb('0x48')]({'where':{'id':_0x100c2f['params']['id']}})[_0x15eb('0x3d')](handleEntityNotFound(_0x59955e,null))[_0x15eb('0x3d')](saveUpdates(_0x100c2f['body'],null))[_0x15eb('0x3d')](respondWithResult(_0x59955e,null))[_0x15eb('0x42')](handleError(_0x59955e,null));};exports[_0x15eb('0x25')]=function(_0x26fb24,_0x7d1e7e){return db[_0x15eb('0x2b')][_0x15eb('0x48')]({'where':{'id':_0x26fb24[_0x15eb('0x43')]['id']}})[_0x15eb('0x3d')](handleEntityNotFound(_0x7d1e7e,null))[_0x15eb('0x3d')](removeEntity(_0x7d1e7e,null))[_0x15eb('0x42')](handleError(_0x7d1e7e,null));};exports['download']=function(_0x4474fc,_0x2aa467,_0x4d2fd4){return db[_0x15eb('0x2b')][_0x15eb('0x48')]({'where':{'id':_0x4474fc[_0x15eb('0x43')]['id']},'attributes':['id',_0x15eb('0x49'),'msg_id']})['then'](handleEntityNotFound(_0x2aa467,null))[_0x15eb('0x3d')](function(_0x2028d7){if(_0x2028d7){if(!_0x2028d7[_0x15eb('0x49')]){throw new db['Sequelize'][(_0x15eb('0x4a'))](_0x15eb('0x4b'));}var _0x541da4={'Content-Type':_0x15eb('0x4c'),'Content-Disposition':_0x15eb('0x4d')};if(_0x2028d7[_0x15eb('0x4e')]){_0x541da4[_0x15eb('0x4f')]=_0x15eb('0x50')+_0x2028d7[_0x15eb('0x4e')]+_0x15eb('0x51');}_0x2aa467['set'](_0x541da4);return _0x2aa467[_0x15eb('0x28')](new Buffer(_0x2028d7[_0x15eb('0x49')]));}})['catch'](handleError(_0x2aa467,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 8929022..d62aa16 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 _0x47ff=['bluebird','request-promise','rimraf','../../config/environment','./voiceMailMessage.attributes','exports','voice_voicemail_messages','dir','api','moment'];(function(_0x3aaf97,_0x4fa2e8){var _0xeba75e=function(_0xf7f986){while(--_0xf7f986){_0x3aaf97['push'](_0x3aaf97['shift']());}};_0xeba75e(++_0x4fa2e8);}(_0x47ff,0xbc));var _0xf47f=function(_0x2534a0,_0xda89db){_0x2534a0=_0x2534a0-0x0;var _0x3209c0=_0x47ff[_0x2534a0];return _0x3209c0;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xf47f('0x0'));var moment=require(_0xf47f('0x1'));var BPromise=require(_0xf47f('0x2'));var rp=require(_0xf47f('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf47f('0x4'));var config=require(_0xf47f('0x5'));var attributes=require(_0xf47f('0x6'));module[_0xf47f('0x7')]=function(_0x16c779,_0x35e494){return _0x16c779['define']('VoiceMailMessage',attributes,{'tableName':_0xf47f('0x8'),'paranoid':![],'indexes':[{'name':_0xf47f('0x9'),'fields':[_0xf47f('0x9')]}],'timestamps':![]});}; \ No newline at end of file +var _0xc025=['api','moment','bluebird','request-promise','./voiceMailMessage.attributes','exports','define','VoiceMailMessage','voice_voicemail_messages','dir','lodash','util','../../config/logger'];(function(_0x497a31,_0x21ecdf){var _0x2426ee=function(_0x1d837e){while(--_0x1d837e){_0x497a31['push'](_0x497a31['shift']());}};_0x2426ee(++_0x21ecdf);}(_0xc025,0x190));var _0x5c02=function(_0x5dbc52,_0x57805d){_0x5dbc52=_0x5dbc52-0x0;var _0x3618a9=_0xc025[_0x5dbc52];return _0x3618a9;};'use strict';var _=require(_0x5c02('0x0'));var util=require(_0x5c02('0x1'));var logger=require(_0x5c02('0x2'))(_0x5c02('0x3'));var moment=require(_0x5c02('0x4'));var BPromise=require(_0x5c02('0x5'));var rp=require(_0x5c02('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x5c02('0x7'));module[_0x5c02('0x8')]=function(_0x58afa4,_0x4ded4f){return _0x58afa4[_0x5c02('0x9')](_0x5c02('0xa'),attributes,{'tableName':_0x5c02('0xb'),'paranoid':![],'indexes':[{'name':'dir','fields':[_0x5c02('0xc')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index 01d3e68..9d7872f 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 _0x1967=['then','info','VoiceMailMessage,\x20%s,\x20%s','VoiceMailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request'];(function(_0x2a55f8,_0x540ac4){var _0x245efd=function(_0x4dbc19){while(--_0x4dbc19){_0x2a55f8['push'](_0x2a55f8['shift']());}};_0x245efd(++_0x540ac4);}(_0x1967,0x173));var _0x7196=function(_0x1e1e20,_0xbf0b29){_0x1e1e20=_0x1e1e20-0x0;var _0x363d2a=_0x1967[_0x1e1e20];return _0x363d2a;};'use strict';var _=require('lodash');var util=require(_0x7196('0x0'));var moment=require(_0x7196('0x1'));var BPromise=require(_0x7196('0x2'));var rs=require(_0x7196('0x3'));var fs=require('fs');var Redis=require(_0x7196('0x4'));var db=require(_0x7196('0x5'))['db'];var utils=require(_0x7196('0x6'));var logger=require(_0x7196('0x7'))(_0x7196('0x8'));var config=require(_0x7196('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7196('0xa')][_0x7196('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x194746,_0x40e0af,_0x266a6e){return new BPromise(function(_0xad78a,_0x510c72){return client[_0x7196('0xc')](_0x194746,_0x266a6e)[_0x7196('0xd')](function(_0x3f846e){logger[_0x7196('0xe')](_0x7196('0xf'),_0x40e0af,'request\x20sent');logger['debug'](_0x7196('0x10'),_0x40e0af,_0x7196('0x11'),JSON[_0x7196('0x12')](_0x3f846e));if(_0x3f846e[_0x7196('0x13')]){if(_0x3f846e[_0x7196('0x13')][_0x7196('0x14')]===0x1f4){logger[_0x7196('0x13')](_0x7196('0xf'),_0x40e0af,_0x3f846e[_0x7196('0x13')][_0x7196('0x15')]);return _0x510c72(_0x3f846e[_0x7196('0x13')]['message']);}logger[_0x7196('0x13')](_0x7196('0xf'),_0x40e0af,_0x3f846e[_0x7196('0x13')][_0x7196('0x15')]);return _0xad78a(_0x3f846e['error'][_0x7196('0x15')]);}else{logger['info'](_0x7196('0xf'),_0x40e0af,_0x7196('0x11'));_0xad78a(_0x3f846e[_0x7196('0x16')][_0x7196('0x15')]);}})[_0x7196('0x17')](function(_0x2e3e0e){logger[_0x7196('0x13')](_0x7196('0xf'),_0x40e0af,_0x2e3e0e);_0x510c72(_0x2e3e0e);});});} \ No newline at end of file +var _0x7a54=['info','VoiceMailMessage,\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(_0x3fa6d1,_0x4ea89e){_0x3fa6d1=_0x3fa6d1-0x0;var _0x2776e1=_0x7a54[_0x3fa6d1];return _0x2776e1;};'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')]('VoiceMailMessage,\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/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index ae524ca..8b7d6c2 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 _0xaa24=['../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','index','/:id','show','/:id/sounds','getSounds','create','post','addSound','put','update','delete','/:id/sounds/:id2','removeSound','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xaa24,0xca));var _0x4aa2=function(_0x53c462,_0x439da6){_0x53c462=_0x53c462-0x0;var _0x355562=_0xaa24[_0x53c462];return _0x355562;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4aa2('0x0'));var timeout=require(_0x4aa2('0x1'));var express=require(_0x4aa2('0x2'));var router=express[_0x4aa2('0x3')]();var auth=require(_0x4aa2('0x4'));var interaction=require(_0x4aa2('0x5'));var config=require(_0x4aa2('0x6'));var controller=require(_0x4aa2('0x7'));router[_0x4aa2('0x8')]('/',auth[_0x4aa2('0x9')](),controller[_0x4aa2('0xa')]);router[_0x4aa2('0x8')](_0x4aa2('0xb'),auth['isAuthenticated'](),controller[_0x4aa2('0xc')]);router['get'](_0x4aa2('0xd'),auth[_0x4aa2('0x9')](),controller[_0x4aa2('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x4aa2('0xf')]);router[_0x4aa2('0x10')]('/:id/sounds',auth[_0x4aa2('0x9')](),controller[_0x4aa2('0x11')]);router[_0x4aa2('0x12')](_0x4aa2('0xb'),auth[_0x4aa2('0x9')](),controller[_0x4aa2('0x13')]);router['delete'](_0x4aa2('0xb'),auth[_0x4aa2('0x9')](),controller['destroy']);router[_0x4aa2('0x14')](_0x4aa2('0x15'),auth[_0x4aa2('0x9')](),controller[_0x4aa2('0x16')]);module['exports']=router; \ No newline at end of file +var _0xfbf6=['./voiceMusicOnHold.controller','get','isAuthenticated','index','/:id','/:id/sounds','getSounds','post','addSound','put','update','delete','destroy','/:id/sounds/:id2','removeSound','multer','util','connect-timeout','express','Router','../../components/auth/service'];(function(_0x3e9c1c,_0x15488f){var _0xacd30d=function(_0x40f531){while(--_0x40f531){_0x3e9c1c['push'](_0x3e9c1c['shift']());}};_0xacd30d(++_0x15488f);}(_0xfbf6,0x10b));var _0x6fbf=function(_0x5e1b91,_0x236f17){_0x5e1b91=_0x5e1b91-0x0;var _0x59b52f=_0xfbf6[_0x5e1b91];return _0x59b52f;};'use strict';var multer=require(_0x6fbf('0x0'));var util=require(_0x6fbf('0x1'));var path=require('path');var timeout=require(_0x6fbf('0x2'));var express=require(_0x6fbf('0x3'));var router=express[_0x6fbf('0x4')]();var auth=require(_0x6fbf('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x6fbf('0x6'));router[_0x6fbf('0x7')]('/',auth[_0x6fbf('0x8')](),controller[_0x6fbf('0x9')]);router['get'](_0x6fbf('0xa'),auth[_0x6fbf('0x8')](),controller['show']);router[_0x6fbf('0x7')](_0x6fbf('0xb'),auth['isAuthenticated'](),controller[_0x6fbf('0xc')]);router[_0x6fbf('0xd')]('/',auth[_0x6fbf('0x8')](),controller['create']);router[_0x6fbf('0xd')](_0x6fbf('0xb'),auth['isAuthenticated'](),controller[_0x6fbf('0xe')]);router[_0x6fbf('0xf')](_0x6fbf('0xa'),auth[_0x6fbf('0x8')](),controller[_0x6fbf('0x10')]);router[_0x6fbf('0x11')](_0x6fbf('0xa'),auth[_0x6fbf('0x8')](),controller[_0x6fbf('0x12')]);router[_0x6fbf('0x11')](_0x6fbf('0x13'),auth[_0x6fbf('0x8')](),controller[_0x6fbf('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index b00f762..25c8993 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 _0x46aa=['mp3nb','quietmp3nb','quietmp3','mp3','STRING','alpha','TIMESTAMP','BOOLEAN','exports','name','ENUM','custom','files'];(function(_0x34ef53,_0x5beb3f){var _0x3f588a=function(_0x126eca){while(--_0x126eca){_0x34ef53['push'](_0x34ef53['shift']());}};_0x3f588a(++_0x5beb3f);}(_0x46aa,0xcb));var _0xa46a=function(_0x87b0ff,_0x314389){_0x87b0ff=_0x87b0ff-0x0;var _0x3bc0b2=_0x46aa[_0x87b0ff];return _0x3bc0b2;};'use strict';var Sequelize=require('sequelize');module[_0xa46a('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xa46a('0x1')},'mode':{'type':Sequelize[_0xa46a('0x2')](_0xa46a('0x3'),_0xa46a('0x4'),_0xa46a('0x5'),_0xa46a('0x6'),_0xa46a('0x7'),_0xa46a('0x8')),'allowNull':!![],'defaultValue':_0xa46a('0x4')},'directory':{'type':Sequelize[_0xa46a('0x9')],'allowNull':!![]},'application':{'type':Sequelize[_0xa46a('0x9')],'allowNull':!![]},'digit':{'type':Sequelize[_0xa46a('0x9')],'allowNull':!![]},'sort':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xa46a('0xa')},'format':{'type':Sequelize[_0xa46a('0x9')],'allowNull':!![]},'stamp':{'type':_0xa46a('0xb')},'defaultEntry':{'type':Sequelize[_0xa46a('0xc')],'defaultValue':0x0}}; \ No newline at end of file +var _0x44fa=['files','mp3nb','quietmp3','alpha','TIMESTAMP','sequelize','exports','STRING','name','ENUM','custom'];(function(_0x3c823f,_0x3e6861){var _0x76eeb5=function(_0x5e3920){while(--_0x5e3920){_0x3c823f['push'](_0x3c823f['shift']());}};_0x76eeb5(++_0x3e6861);}(_0x44fa,0x68));var _0xa44f=function(_0x27e2c4,_0x47799a){_0x27e2c4=_0x27e2c4-0x0;var _0x40b3eb=_0x44fa[_0x27e2c4];return _0x40b3eb;};'use strict';var Sequelize=require(_0xa44f('0x0'));module[_0xa44f('0x1')]={'name':{'type':Sequelize[_0xa44f('0x2')],'allowNull':![],'unique':_0xa44f('0x3')},'mode':{'type':Sequelize[_0xa44f('0x4')](_0xa44f('0x5'),_0xa44f('0x6'),_0xa44f('0x7'),'quietmp3nb',_0xa44f('0x8'),'mp3'),'allowNull':!![],'defaultValue':'files'},'directory':{'type':Sequelize[_0xa44f('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0xa44f('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0xa44f('0x2')],'allowNull':!![]},'sort':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xa44f('0x9')},'format':{'type':Sequelize[_0xa44f('0x2')],'allowNull':!![]},'stamp':{'type':_0xa44f('0xa')},'defaultEntry':{'type':Sequelize['BOOLEAN'],'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 a8e6413..962e9d1 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 _0xd8b0=['map','rawAttributes','fieldName','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','VoiceMusicOnHold','count','includeAll','include','findAll','rows','catch','params','keys','find','body','create','transaction','mode','directory','join','root','server/files/moh','files','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','error','sequelize','forEach','unlinkSync','rmdirSync','Sequelize','addSound','Sound','findOne','converted_format','createdAt','server/files/sounds/converted','format','%s.%s','extname','save_name','symlinkSync','ValidationError','removeSound','id2','message','getSounds','options','html-pdf','eml-format','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','get','MusicOnHolds','UserProfileResource','destroy','name','send'];(function(_0x1a86fb,_0x5db923){var _0xdf2088=function(_0x2629d9){while(--_0x2629d9){_0x1a86fb['push'](_0x1a86fb['shift']());}};_0xdf2088(++_0x5db923);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var pdf=require(_0x0d8b('0x0'));var emlformat=require(_0x0d8b('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0d8b('0x2'));var moment=require(_0x0d8b('0x3'));var BPromise=require(_0x0d8b('0x4'));var Mustache=require(_0x0d8b('0x5'));var util=require(_0x0d8b('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x0d8b('0x7'));var ejs=require(_0x0d8b('0x8'));var fs=require('fs');var _=require(_0x0d8b('0x9'));var squel=require('squel');var crypto=require(_0x0d8b('0xa'));var jsforce=require(_0x0d8b('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x0d8b('0x7'));var querystring=require(_0x0d8b('0xc'));var Papa=require(_0x0d8b('0xd'));var Redis=require(_0x0d8b('0xe'));var authService=require(_0x0d8b('0xf'));var qs=require(_0x0d8b('0x10'));var as=require(_0x0d8b('0x11'));var hardwareService=require(_0x0d8b('0x12'));var logger=require('../../config/logger')(_0x0d8b('0x13'));var utils=require('../../config/utils');var config=require(_0x0d8b('0x14'));var db=require(_0x0d8b('0x15'))['db'];function respondWithStatusCode(_0x340cc4,_0x92cdd8){_0x92cdd8=_0x92cdd8||0xcc;return function(_0x35a07b){if(_0x35a07b){return _0x340cc4[_0x0d8b('0x16')](_0x92cdd8);}return _0x340cc4[_0x0d8b('0x17')](_0x92cdd8)[_0x0d8b('0x18')]();};}function respondWithResult(_0x1d4bbc,_0x2ce75e){_0x2ce75e=_0x2ce75e||0xc8;return function(_0x5ad086){if(_0x5ad086){return _0x1d4bbc[_0x0d8b('0x17')](_0x2ce75e)[_0x0d8b('0x19')](_0x5ad086);}};}function respondWithFilteredResult(_0x2d4e1c,_0x4f6f21){return function(_0x23eb7b){if(_0x23eb7b){var _0xa86349=_0x23eb7b['count'],_0x17f7df=_0x4f6f21[_0x0d8b('0x1a')],_0xe2e167=_0x4f6f21[_0x0d8b('0x1a')]+_0x4f6f21[_0x0d8b('0x1b')],_0x2cb03c;if(_0xe2e167>=_0xa86349){_0xe2e167=_0xa86349;_0x2cb03c=0xc8;}else{_0x2cb03c=0xce;}_0x2d4e1c[_0x0d8b('0x17')](_0x2cb03c);return _0x2d4e1c[_0x0d8b('0x1c')](_0x0d8b('0x1d'),_0x17f7df+'-'+_0xe2e167+'/'+_0xa86349)[_0x0d8b('0x19')](_0x23eb7b);}return null;};}function patchUpdates(_0xa3612a){return function(_0x4a15bf){try{jsonpatch[_0x0d8b('0x1e')](_0x4a15bf,_0xa3612a,!![]);}catch(_0x23d58f){return BPromise[_0x0d8b('0x1f')](_0x23d58f);}return _0x4a15bf[_0x0d8b('0x20')]();};}function saveUpdates(_0x24e8ed,_0x5b709c){return function(_0x393beb){if(_0x393beb){return _0x393beb[_0x0d8b('0x21')](_0x24e8ed)['then'](function(_0x4f0a1a){return _0x4f0a1a;});}return null;};}function removeEntity(_0x33fb87,_0x54a9a7){return function(_0x56c729){if(_0x56c729){return _0x56c729['destroy']()[_0x0d8b('0x22')](function(){var _0x2b924f=_0x56c729[_0x0d8b('0x23')]({'plain':!![]});var _0x38efc8=_0x0d8b('0x24');return db[_0x0d8b('0x25')][_0x0d8b('0x26')]({'where':{'type':_0x38efc8,'resourceId':_0x2b924f['id']}})[_0x0d8b('0x22')](function(){return _0x56c729;});})[_0x0d8b('0x22')](function(){_0x33fb87['status'](0xcc)[_0x0d8b('0x18')]();});}};}function handleEntityNotFound(_0x4463ee,_0x5363e3){return function(_0xe1ef20){if(!_0xe1ef20){_0x4463ee['sendStatus'](0x194);}return _0xe1ef20;};}function handleError(_0x3dd149,_0x234bdd){_0x234bdd=_0x234bdd||0x1f4;return function(_0xa2af02){logger['error'](_0xa2af02['stack']);if(_0xa2af02[_0x0d8b('0x27')]){delete _0xa2af02[_0x0d8b('0x27')];}_0x3dd149['status'](_0x234bdd)[_0x0d8b('0x28')](_0xa2af02);};}exports['index']=function(_0x1b2b59,_0x4b59e5){var _0x97050a={},_0x48f24f={},_0x2ab00d={'count':0x0,'rows':[]};var _0x546bf6=_[_0x0d8b('0x29')](db['VoiceMusicOnHold'][_0x0d8b('0x2a')],function(_0x106e4c){return{'name':_0x106e4c[_0x0d8b('0x2b')],'type':_0x106e4c['type']['key']};});_0x48f24f['model']=_[_0x0d8b('0x29')](_0x546bf6,'name');_0x48f24f[_0x0d8b('0x2c')]=_['keys'](_0x1b2b59['query']);_0x48f24f[_0x0d8b('0x2d')]=_[_0x0d8b('0x2e')](_0x48f24f[_0x0d8b('0x2f')],_0x48f24f[_0x0d8b('0x2c')]);_0x97050a[_0x0d8b('0x30')]=_[_0x0d8b('0x2e')](_0x48f24f[_0x0d8b('0x2f')],qs[_0x0d8b('0x31')](_0x1b2b59['query'][_0x0d8b('0x31')]));_0x97050a[_0x0d8b('0x30')]=_0x97050a['attributes'][_0x0d8b('0x32')]?_0x97050a[_0x0d8b('0x30')]:_0x48f24f[_0x0d8b('0x2f')];if(!_0x1b2b59['query'][_0x0d8b('0x33')](_0x0d8b('0x34'))){_0x97050a[_0x0d8b('0x1b')]=qs[_0x0d8b('0x1b')](_0x1b2b59[_0x0d8b('0x2c')]['limit']);_0x97050a[_0x0d8b('0x1a')]=qs[_0x0d8b('0x1a')](_0x1b2b59['query'][_0x0d8b('0x1a')]);}_0x97050a[_0x0d8b('0x35')]=qs[_0x0d8b('0x36')](_0x1b2b59[_0x0d8b('0x2c')][_0x0d8b('0x36')]);_0x97050a['where']=qs['filters'](_[_0x0d8b('0x37')](_0x1b2b59['query'],_0x48f24f['filters']),_0x546bf6);if(_0x1b2b59[_0x0d8b('0x2c')][_0x0d8b('0x38')]){_0x97050a[_0x0d8b('0x39')]=_[_0x0d8b('0x3a')](_0x97050a[_0x0d8b('0x39')],{'$or':_[_0x0d8b('0x29')](_0x546bf6,function(_0x579324){if(_0x579324[_0x0d8b('0x3b')]!==_0x0d8b('0x3c')){var _0x28fd82={};_0x28fd82[_0x579324[_0x0d8b('0x27')]]={'$like':'%'+_0x1b2b59[_0x0d8b('0x2c')][_0x0d8b('0x38')]+'%'};return _0x28fd82;}})});}_0x97050a=_[_0x0d8b('0x3a')]({},_0x97050a,_0x1b2b59['options']);var _0x1d06b6={'where':_0x97050a[_0x0d8b('0x39')]};return db[_0x0d8b('0x3d')][_0x0d8b('0x3e')](_0x1d06b6)['then'](function(_0xe0bf42){_0x2ab00d['count']=_0xe0bf42;if(_0x1b2b59[_0x0d8b('0x2c')][_0x0d8b('0x3f')]){_0x97050a[_0x0d8b('0x40')]=[{'all':!![]}];}return db[_0x0d8b('0x3d')][_0x0d8b('0x41')](_0x97050a);})[_0x0d8b('0x22')](function(_0x1ff17d){_0x2ab00d[_0x0d8b('0x42')]=_0x1ff17d;return _0x2ab00d;})[_0x0d8b('0x22')](respondWithFilteredResult(_0x4b59e5,_0x97050a))[_0x0d8b('0x43')](handleError(_0x4b59e5,null));};exports['show']=function(_0x571acf,_0x576050){var _0x4d0811={'raw':![],'where':{'id':_0x571acf[_0x0d8b('0x44')]['id']}},_0x524d79={};_0x524d79[_0x0d8b('0x2f')]=_[_0x0d8b('0x45')](db['VoiceMusicOnHold']['rawAttributes']);_0x524d79[_0x0d8b('0x2c')]=_[_0x0d8b('0x45')](_0x571acf[_0x0d8b('0x2c')]);_0x524d79['filters']=_[_0x0d8b('0x2e')](_0x524d79[_0x0d8b('0x2f')],_0x524d79['query']);_0x4d0811['attributes']=_[_0x0d8b('0x2e')](_0x524d79['model'],qs[_0x0d8b('0x31')](_0x571acf['query']['fields']));_0x4d0811[_0x0d8b('0x30')]=_0x4d0811[_0x0d8b('0x30')]['length']?_0x4d0811['attributes']:_0x524d79['model'];if(_0x571acf['query'][_0x0d8b('0x3f')]){_0x4d0811[_0x0d8b('0x40')]=[{'all':!![]}];}_0x4d0811=_[_0x0d8b('0x3a')]({},_0x4d0811,_0x571acf['options']);return db[_0x0d8b('0x3d')][_0x0d8b('0x46')](_0x4d0811)[_0x0d8b('0x22')](handleEntityNotFound(_0x576050,null))[_0x0d8b('0x22')](respondWithResult(_0x576050,null))[_0x0d8b('0x43')](handleError(_0x576050,null));};exports[_0x0d8b('0x21')]=function(_0x11d22b,_0x1d5067){if(_0x11d22b[_0x0d8b('0x47')]['id']){delete _0x11d22b[_0x0d8b('0x47')]['id'];}return db[_0x0d8b('0x3d')][_0x0d8b('0x46')]({'where':{'id':_0x11d22b[_0x0d8b('0x44')]['id']}})[_0x0d8b('0x22')](handleEntityNotFound(_0x1d5067,null))[_0x0d8b('0x22')](saveUpdates(_0x11d22b[_0x0d8b('0x47')],null))[_0x0d8b('0x22')](respondWithResult(_0x1d5067,null))[_0x0d8b('0x43')](handleError(_0x1d5067,null));};exports[_0x0d8b('0x48')]=function(_0x574b90,_0x371fa0,_0x4d8850){return db['sequelize'][_0x0d8b('0x49')](function(_0x113fb7){if(_0x574b90[_0x0d8b('0x47')][_0x0d8b('0x4a')]==='files'){_0x574b90[_0x0d8b('0x47')][_0x0d8b('0x4b')]=path[_0x0d8b('0x4c')](config[_0x0d8b('0x4d')],_0x0d8b('0x4e'),_0x574b90['body']['name']);}return db['VoiceMusicOnHold']['create'](_0x574b90[_0x0d8b('0x47')],{'transaction':_0x113fb7})[_0x0d8b('0x22')](function(_0x5e3bb4){if(_0x574b90['body'][_0x0d8b('0x4a')]===_0x0d8b('0x4f')){fs['mkdirSync'](_0x5e3bb4['directory'],parseInt(_0x0d8b('0x50'),0x8));}var _0xeeefd4=_0x574b90[_0x0d8b('0x51')][_0x0d8b('0x23')]({'plain':!![]});if(!_0xeeefd4)throw new Error(_0x0d8b('0x52'));if(_0xeeefd4['role']===_0x0d8b('0x51')){var _0x2afe34=_0x5e3bb4['get']({'plain':!![]});return db['UserProfileSection'][_0x0d8b('0x46')]({'where':{'name':_0x0d8b('0x24'),'userProfileId':_0xeeefd4['userProfileId']},'raw':!![]})['then'](function(_0xb8be3b){if(_0xb8be3b&&_0xb8be3b[_0x0d8b('0x53')]===0x0){return db[_0x0d8b('0x25')][_0x0d8b('0x48')]({'name':_0x2afe34['name'],'resourceId':_0x2afe34['id'],'type':_0xb8be3b[_0x0d8b('0x27')],'sectionId':_0xb8be3b['id']},{})['then'](function(){return _0x5e3bb4;});}else{return _0x5e3bb4;}})['catch'](function(_0x38c24e){logger[_0x0d8b('0x54')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x38c24e);});}return _0x5e3bb4;});})['then'](respondWithResult(_0x371fa0,0xc9))[_0x0d8b('0x43')](handleError(_0x371fa0,null));};exports[_0x0d8b('0x26')]=function(_0xccc2a9,_0x2c1eb0,_0x3afc3a){var _0xb66e76;return db[_0x0d8b('0x3d')][_0x0d8b('0x46')]({'where':{'id':_0xccc2a9['params']['id']}})[_0x0d8b('0x22')](function(_0x37dc9f){if(_0x37dc9f){return db[_0x0d8b('0x55')][_0x0d8b('0x49')](function(_0x3fb9ea){return _0x37dc9f[_0x0d8b('0x26')]({'transaction':_0x3fb9ea,'raw':!![]})[_0x0d8b('0x22')](function(_0x1c78b6){if(_0x1c78b6[_0x0d8b('0x4b')]){fs['readdirSync'](_0x1c78b6[_0x0d8b('0x4b')])[_0x0d8b('0x56')](function(_0x180b7b){fs[_0x0d8b('0x57')](path[_0x0d8b('0x4c')](_0x1c78b6['directory'],_0x180b7b));});fs[_0x0d8b('0x58')](_0x1c78b6[_0x0d8b('0x4b')]);}return _0x1c78b6;});})[_0x0d8b('0x43')](function(_0x17a87f){throw new db[(_0x0d8b('0x59'))]['ValidationError'](_0x17a87f['message']);});}})[_0x0d8b('0x22')](handleEntityNotFound(_0x2c1eb0,null))[_0x0d8b('0x22')](removeEntity(_0x2c1eb0,null))[_0x0d8b('0x43')](handleError(_0x2c1eb0,null));};exports[_0x0d8b('0x5a')]=function(_0x5a70bd,_0x199122,_0x12aef7){return db[_0x0d8b('0x55')]['transaction'](function(_0x2f19f4){var _0x532a85;return db[_0x0d8b('0x3d')][_0x0d8b('0x46')]({'where':{'id':_0x5a70bd[_0x0d8b('0x44')]['id']}})[_0x0d8b('0x22')](function(_0x2b6eb6){if(_0x2b6eb6){_0x532a85=_0x2b6eb6;return _0x2b6eb6[_0x0d8b('0x5a')](_0x5a70bd['body']['id'],{'transaction':_0x2f19f4});}})[_0x0d8b('0x22')](function(_0x4c074d){if(_0x4c074d){return db[_0x0d8b('0x5b')][_0x0d8b('0x5c')]({'where':{'id':_0x5a70bd[_0x0d8b('0x47')]['id']},'attributes':['id',_0x0d8b('0x27'),'save_name',_0x0d8b('0x5d'),_0x0d8b('0x5e')],'raw':!![]});}})[_0x0d8b('0x22')](function(_0x2332fc){if(_0x2332fc){var _0x2ccdae=path[_0x0d8b('0x4c')](config[_0x0d8b('0x4d')],_0x0d8b('0x5f'),util[_0x0d8b('0x60')](_0x0d8b('0x61'),path['basename'](_0x2332fc['save_name'],path[_0x0d8b('0x62')](_0x2332fc[_0x0d8b('0x63')])),_0x2332fc['converted_format']));var _0xb1aa96=path['join'](config['root'],_0x0d8b('0x4e'),_0x532a85[_0x0d8b('0x27')],util['format']('%s.%s',_0x2332fc[_0x0d8b('0x27')],_0x2332fc[_0x0d8b('0x5d')]));fs[_0x0d8b('0x64')](_0x2ccdae,_0xb1aa96);return _0x2332fc;}})[_0x0d8b('0x43')](function(_0x2ab72b){throw new db[(_0x0d8b('0x59'))][(_0x0d8b('0x65'))](_0x2ab72b['message']);});})[_0x0d8b('0x22')](handleEntityNotFound(_0x199122,null))['then'](respondWithResult(_0x199122,0xc9))[_0x0d8b('0x43')](handleError(_0x199122,null));};exports[_0x0d8b('0x66')]=function(_0x2bb690,_0x14a34b,_0x49f610){return db[_0x0d8b('0x55')]['transaction'](function(_0x3a356b){var _0x2c6c5f;return db[_0x0d8b('0x3d')][_0x0d8b('0x5c')]({'where':{'id':_0x2bb690[_0x0d8b('0x44')]['id']}})[_0x0d8b('0x22')](handleEntityNotFound(_0x14a34b,null))[_0x0d8b('0x22')](function(_0x91aa89){if(_0x91aa89){_0x2c6c5f=_0x91aa89;return _0x91aa89[_0x0d8b('0x66')](_0x2bb690[_0x0d8b('0x44')]['id2']);}})[_0x0d8b('0x22')](function(_0x54c28b){if(_0x54c28b){return db[_0x0d8b('0x5b')][_0x0d8b('0x5c')]({'where':{'id':_0x2bb690['params'][_0x0d8b('0x67')]},'attributes':['id','name',_0x0d8b('0x63'),_0x0d8b('0x5d'),_0x0d8b('0x5e')],'raw':!![]});}})[_0x0d8b('0x22')](function(_0x2242cd){if(_0x2242cd){fs[_0x0d8b('0x57')](path[_0x0d8b('0x4c')](_0x2c6c5f[_0x0d8b('0x4b')],util['format'](_0x0d8b('0x61'),_0x2242cd[_0x0d8b('0x27')],_0x2242cd['converted_format'])));return _0x2242cd;}})[_0x0d8b('0x43')](function(_0x105df9){throw new db[(_0x0d8b('0x59'))][(_0x0d8b('0x65'))](_0x105df9[_0x0d8b('0x68')]);});})[_0x0d8b('0x22')](handleEntityNotFound(_0x14a34b,null))[_0x0d8b('0x22')](respondWithStatusCode(_0x14a34b,0xcc))[_0x0d8b('0x43')](handleError(_0x14a34b,null));};exports[_0x0d8b('0x69')]=function(_0x5007c0,_0xe35028,_0x16df83){var _0x50c0ff={};var _0x1ece98={};var _0x93fc55;var _0x3acffa;return db['VoiceMusicOnHold']['findOne']({'where':{'id':_0x5007c0[_0x0d8b('0x44')]['id']}})[_0x0d8b('0x22')](handleEntityNotFound(_0xe35028,null))[_0x0d8b('0x22')](function(_0x5b76af){if(_0x5b76af){_0x93fc55=_0x5b76af;_0x1ece98['model']=_[_0x0d8b('0x45')](db[_0x0d8b('0x5b')][_0x0d8b('0x2a')]);_0x1ece98[_0x0d8b('0x2c')]=_[_0x0d8b('0x45')](_0x5007c0[_0x0d8b('0x2c')]);_0x1ece98[_0x0d8b('0x2d')]=_[_0x0d8b('0x2e')](_0x1ece98[_0x0d8b('0x2f')],_0x1ece98[_0x0d8b('0x2c')]);_0x50c0ff[_0x0d8b('0x30')]=_[_0x0d8b('0x2e')](_0x1ece98[_0x0d8b('0x2f')],qs['fields'](_0x5007c0[_0x0d8b('0x2c')][_0x0d8b('0x31')]));_0x50c0ff['attributes']=_0x50c0ff['attributes'][_0x0d8b('0x32')]?_0x50c0ff[_0x0d8b('0x30')]:_0x1ece98[_0x0d8b('0x2f')];_0x50c0ff[_0x0d8b('0x35')]=qs[_0x0d8b('0x36')](_0x5007c0[_0x0d8b('0x2c')]['sort']);_0x50c0ff['where']=qs['filters'](_[_0x0d8b('0x37')](_0x5007c0[_0x0d8b('0x2c')],_0x1ece98[_0x0d8b('0x2d')]));if(_0x5007c0[_0x0d8b('0x2c')][_0x0d8b('0x38')]){_0x50c0ff[_0x0d8b('0x39')]=_['merge'](_0x50c0ff[_0x0d8b('0x39')],{'$or':_[_0x0d8b('0x29')](_0x50c0ff['attributes'],function(_0x30a69d){var _0x57e3c2={};_0x57e3c2[_0x30a69d]={'$like':'%'+_0x5007c0[_0x0d8b('0x2c')][_0x0d8b('0x38')]+'%'};return _0x57e3c2;})});}_0x50c0ff=_[_0x0d8b('0x3a')]({},_0x50c0ff,_0x5007c0[_0x0d8b('0x6a')]);return _0x93fc55[_0x0d8b('0x69')](_0x50c0ff);}})[_0x0d8b('0x22')](function(_0x424f9d){if(_0x424f9d){_0x3acffa=_0x424f9d[_0x0d8b('0x32')];if(!_0x5007c0[_0x0d8b('0x2c')][_0x0d8b('0x33')](_0x0d8b('0x34'))){_0x50c0ff[_0x0d8b('0x1b')]=qs['limit'](_0x5007c0['query'][_0x0d8b('0x1b')]);_0x50c0ff[_0x0d8b('0x1a')]=qs[_0x0d8b('0x1a')](_0x5007c0[_0x0d8b('0x2c')][_0x0d8b('0x1a')]);}return _0x93fc55[_0x0d8b('0x69')](_0x50c0ff);}})[_0x0d8b('0x22')](function(_0x54674f){if(_0x54674f){return _0x54674f?{'count':_0x3acffa,'rows':_0x54674f}:null;}})[_0x0d8b('0x22')](respondWithResult(_0xe35028,null))['catch'](handleError(_0xe35028,null));}; \ No newline at end of file +var _0x5f2f=['getSounds','nolimit','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','get','MusicOnHolds','UserProfileResource','then','end','error','stack','name','send','map','VoiceMusicOnHold','rawAttributes','fieldName','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','params','find','body','catch','transaction','mode','directory','server/files/moh','create','files','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','sequelize','readdirSync','forEach','unlinkSync','join','rmdirSync','message','addSound','findOne','save_name','converted_format','createdAt','root','server/files/sounds/converted','format','%s.%s','basename','extname','symlinkSync','Sequelize','ValidationError','removeSound','id2','Sound'];(function(_0x48a427,_0x24f4a6){var _0x197910=function(_0x3970c2){while(--_0x3970c2){_0x48a427['push'](_0x48a427['shift']());}};_0x197910(++_0x24f4a6);}(_0x5f2f,0x73));var _0xf5f2=function(_0x4382c0,_0x3d53fa){_0x4382c0=_0x4382c0-0x0;var _0x58d14f=_0x5f2f[_0x4382c0];return _0x58d14f;};'use strict';var pdf=require(_0xf5f2('0x0'));var emlformat=require(_0xf5f2('0x1'));var rimraf=require(_0xf5f2('0x2'));var zipdir=require(_0xf5f2('0x3'));var jsonpatch=require(_0xf5f2('0x4'));var rp=require(_0xf5f2('0x5'));var moment=require(_0xf5f2('0x6'));var BPromise=require(_0xf5f2('0x7'));var Mustache=require('mustache');var util=require('util');var path=require(_0xf5f2('0x8'));var sox=require(_0xf5f2('0x9'));var csv=require(_0xf5f2('0xa'));var ejs=require(_0xf5f2('0xb'));var fs=require('fs');var _=require(_0xf5f2('0xc'));var squel=require(_0xf5f2('0xd'));var crypto=require('crypto');var jsforce=require(_0xf5f2('0xe'));var deskjs=require(_0xf5f2('0xf'));var toCsv=require(_0xf5f2('0xa'));var querystring=require('querystring');var Papa=require(_0xf5f2('0x10'));var Redis=require(_0xf5f2('0x11'));var authService=require(_0xf5f2('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf5f2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf5f2('0x14'));var utils=require(_0xf5f2('0x15'));var config=require('../../config/environment');var db=require(_0xf5f2('0x16'))['db'];function respondWithStatusCode(_0x14b51f,_0x331482){_0x331482=_0x331482||0xcc;return function(_0x3f2997){if(_0x3f2997){return _0x14b51f[_0xf5f2('0x17')](_0x331482);}return _0x14b51f[_0xf5f2('0x18')](_0x331482)['end']();};}function respondWithResult(_0x5850f4,_0xea612c){_0xea612c=_0xea612c||0xc8;return function(_0x269909){if(_0x269909){return _0x5850f4[_0xf5f2('0x18')](_0xea612c)[_0xf5f2('0x19')](_0x269909);}};}function respondWithFilteredResult(_0x4d97fc,_0xafe430){return function(_0x286197){if(_0x286197){var _0x17d656=_0x286197[_0xf5f2('0x1a')],_0x1b6dd2=_0xafe430[_0xf5f2('0x1b')],_0x23e23a=_0xafe430[_0xf5f2('0x1b')]+_0xafe430[_0xf5f2('0x1c')],_0x3a9dbb;if(_0x23e23a>=_0x17d656){_0x23e23a=_0x17d656;_0x3a9dbb=0xc8;}else{_0x3a9dbb=0xce;}_0x4d97fc[_0xf5f2('0x18')](_0x3a9dbb);return _0x4d97fc[_0xf5f2('0x1d')](_0xf5f2('0x1e'),_0x1b6dd2+'-'+_0x23e23a+'/'+_0x17d656)[_0xf5f2('0x19')](_0x286197);}return null;};}function patchUpdates(_0x3cf5ea){return function(_0x626999){try{jsonpatch[_0xf5f2('0x1f')](_0x626999,_0x3cf5ea,!![]);}catch(_0x56acc5){return BPromise[_0xf5f2('0x20')](_0x56acc5);}return _0x626999[_0xf5f2('0x21')]();};}function saveUpdates(_0x49dac2,_0x47acfc){return function(_0x2d2805){if(_0x2d2805){return _0x2d2805[_0xf5f2('0x22')](_0x49dac2)['then'](function(_0x45b74f){return _0x45b74f;});}return null;};}function removeEntity(_0x170042,_0x39e44a){return function(_0x39c024){if(_0x39c024){return _0x39c024[_0xf5f2('0x23')]()['then'](function(){var _0x21cd91=_0x39c024[_0xf5f2('0x24')]({'plain':!![]});var _0x4e8bda=_0xf5f2('0x25');return db[_0xf5f2('0x26')]['destroy']({'where':{'type':_0x4e8bda,'resourceId':_0x21cd91['id']}})['then'](function(){return _0x39c024;});})[_0xf5f2('0x27')](function(){_0x170042[_0xf5f2('0x18')](0xcc)[_0xf5f2('0x28')]();});}};}function handleEntityNotFound(_0x1a5bb3,_0xf6c58d){return function(_0x788a8d){if(!_0x788a8d){_0x1a5bb3[_0xf5f2('0x17')](0x194);}return _0x788a8d;};}function handleError(_0x281ec8,_0x294414){_0x294414=_0x294414||0x1f4;return function(_0x4ab014){logger[_0xf5f2('0x29')](_0x4ab014[_0xf5f2('0x2a')]);if(_0x4ab014[_0xf5f2('0x2b')]){delete _0x4ab014[_0xf5f2('0x2b')];}_0x281ec8[_0xf5f2('0x18')](_0x294414)[_0xf5f2('0x2c')](_0x4ab014);};}exports['index']=function(_0x53cb96,_0x22c826){var _0x14c829={},_0x11c771={},_0x5027ab={'count':0x0,'rows':[]};var _0x5a2c7e=_[_0xf5f2('0x2d')](db[_0xf5f2('0x2e')][_0xf5f2('0x2f')],function(_0x153924){return{'name':_0x153924[_0xf5f2('0x30')],'type':_0x153924['type']['key']};});_0x11c771[_0xf5f2('0x31')]=_['map'](_0x5a2c7e,_0xf5f2('0x2b'));_0x11c771['query']=_[_0xf5f2('0x32')](_0x53cb96[_0xf5f2('0x33')]);_0x11c771[_0xf5f2('0x34')]=_[_0xf5f2('0x35')](_0x11c771[_0xf5f2('0x31')],_0x11c771[_0xf5f2('0x33')]);_0x14c829[_0xf5f2('0x36')]=_[_0xf5f2('0x35')](_0x11c771['model'],qs[_0xf5f2('0x37')](_0x53cb96[_0xf5f2('0x33')][_0xf5f2('0x37')]));_0x14c829[_0xf5f2('0x36')]=_0x14c829[_0xf5f2('0x36')][_0xf5f2('0x38')]?_0x14c829[_0xf5f2('0x36')]:_0x11c771['model'];if(!_0x53cb96[_0xf5f2('0x33')][_0xf5f2('0x39')]('nolimit')){_0x14c829[_0xf5f2('0x1c')]=qs['limit'](_0x53cb96[_0xf5f2('0x33')][_0xf5f2('0x1c')]);_0x14c829[_0xf5f2('0x1b')]=qs[_0xf5f2('0x1b')](_0x53cb96['query']['offset']);}_0x14c829[_0xf5f2('0x3a')]=qs[_0xf5f2('0x3b')](_0x53cb96[_0xf5f2('0x33')]['sort']);_0x14c829[_0xf5f2('0x3c')]=qs['filters'](_[_0xf5f2('0x3d')](_0x53cb96['query'],_0x11c771[_0xf5f2('0x34')]),_0x5a2c7e);if(_0x53cb96[_0xf5f2('0x33')]['filter']){_0x14c829[_0xf5f2('0x3c')]=_[_0xf5f2('0x3e')](_0x14c829[_0xf5f2('0x3c')],{'$or':_[_0xf5f2('0x2d')](_0x5a2c7e,function(_0x542cd6){if(_0x542cd6['type']!==_0xf5f2('0x3f')){var _0x140a11={};_0x140a11[_0x542cd6[_0xf5f2('0x2b')]]={'$like':'%'+_0x53cb96[_0xf5f2('0x33')][_0xf5f2('0x40')]+'%'};return _0x140a11;}})});}_0x14c829=_[_0xf5f2('0x3e')]({},_0x14c829,_0x53cb96[_0xf5f2('0x41')]);var _0x4c0ac7={'where':_0x14c829[_0xf5f2('0x3c')]};return db[_0xf5f2('0x2e')]['count'](_0x4c0ac7)[_0xf5f2('0x27')](function(_0x3f3895){_0x5027ab[_0xf5f2('0x1a')]=_0x3f3895;if(_0x53cb96[_0xf5f2('0x33')][_0xf5f2('0x42')]){_0x14c829[_0xf5f2('0x43')]=[{'all':!![]}];}return db[_0xf5f2('0x2e')][_0xf5f2('0x44')](_0x14c829);})['then'](function(_0x31c3c){_0x5027ab[_0xf5f2('0x45')]=_0x31c3c;return _0x5027ab;})[_0xf5f2('0x27')](respondWithFilteredResult(_0x22c826,_0x14c829))['catch'](handleError(_0x22c826,null));};exports['show']=function(_0x59eb00,_0x76d21b){var _0x2ad13c={'raw':![],'where':{'id':_0x59eb00[_0xf5f2('0x46')]['id']}},_0x4c8d8e={};_0x4c8d8e[_0xf5f2('0x31')]=_[_0xf5f2('0x32')](db[_0xf5f2('0x2e')][_0xf5f2('0x2f')]);_0x4c8d8e[_0xf5f2('0x33')]=_[_0xf5f2('0x32')](_0x59eb00[_0xf5f2('0x33')]);_0x4c8d8e[_0xf5f2('0x34')]=_[_0xf5f2('0x35')](_0x4c8d8e[_0xf5f2('0x31')],_0x4c8d8e[_0xf5f2('0x33')]);_0x2ad13c[_0xf5f2('0x36')]=_[_0xf5f2('0x35')](_0x4c8d8e['model'],qs[_0xf5f2('0x37')](_0x59eb00['query'][_0xf5f2('0x37')]));_0x2ad13c[_0xf5f2('0x36')]=_0x2ad13c[_0xf5f2('0x36')][_0xf5f2('0x38')]?_0x2ad13c[_0xf5f2('0x36')]:_0x4c8d8e[_0xf5f2('0x31')];if(_0x59eb00['query'][_0xf5f2('0x42')]){_0x2ad13c[_0xf5f2('0x43')]=[{'all':!![]}];}_0x2ad13c=_[_0xf5f2('0x3e')]({},_0x2ad13c,_0x59eb00[_0xf5f2('0x41')]);return db[_0xf5f2('0x2e')][_0xf5f2('0x47')](_0x2ad13c)[_0xf5f2('0x27')](handleEntityNotFound(_0x76d21b,null))[_0xf5f2('0x27')](respondWithResult(_0x76d21b,null))['catch'](handleError(_0x76d21b,null));};exports[_0xf5f2('0x22')]=function(_0x33ec29,_0x45db9a){if(_0x33ec29['body']['id']){delete _0x33ec29[_0xf5f2('0x48')]['id'];}return db[_0xf5f2('0x2e')][_0xf5f2('0x47')]({'where':{'id':_0x33ec29['params']['id']}})['then'](handleEntityNotFound(_0x45db9a,null))[_0xf5f2('0x27')](saveUpdates(_0x33ec29[_0xf5f2('0x48')],null))['then'](respondWithResult(_0x45db9a,null))[_0xf5f2('0x49')](handleError(_0x45db9a,null));};exports['create']=function(_0x740321,_0x497eb8,_0x2cbd9d){return db['sequelize'][_0xf5f2('0x4a')](function(_0xb8ea3a){if(_0x740321[_0xf5f2('0x48')][_0xf5f2('0x4b')]==='files'){_0x740321[_0xf5f2('0x48')][_0xf5f2('0x4c')]=path['join'](config['root'],_0xf5f2('0x4d'),_0x740321[_0xf5f2('0x48')]['name']);}return db[_0xf5f2('0x2e')][_0xf5f2('0x4e')](_0x740321[_0xf5f2('0x48')],{'transaction':_0xb8ea3a})[_0xf5f2('0x27')](function(_0x5d0db0){if(_0x740321['body'][_0xf5f2('0x4b')]===_0xf5f2('0x4f')){fs['mkdirSync'](_0x5d0db0[_0xf5f2('0x4c')],parseInt(_0xf5f2('0x50'),0x8));}var _0x255125=_0x740321[_0xf5f2('0x51')][_0xf5f2('0x24')]({'plain':!![]});if(!_0x255125)throw new Error(_0xf5f2('0x52'));if(_0x255125[_0xf5f2('0x53')]==='user'){var _0x59e8ef=_0x5d0db0[_0xf5f2('0x24')]({'plain':!![]});return db[_0xf5f2('0x54')][_0xf5f2('0x47')]({'where':{'name':_0xf5f2('0x25'),'userProfileId':_0x255125[_0xf5f2('0x55')]},'raw':!![]})['then'](function(_0xdb1106){if(_0xdb1106&&_0xdb1106[_0xf5f2('0x56')]===0x0){return db[_0xf5f2('0x26')]['create']({'name':_0x59e8ef[_0xf5f2('0x2b')],'resourceId':_0x59e8ef['id'],'type':_0xdb1106['name'],'sectionId':_0xdb1106['id']},{})[_0xf5f2('0x27')](function(){return _0x5d0db0;});}else{return _0x5d0db0;}})[_0xf5f2('0x49')](function(_0x28cce5){logger[_0xf5f2('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x28cce5);});}return _0x5d0db0;});})['then'](respondWithResult(_0x497eb8,0xc9))[_0xf5f2('0x49')](handleError(_0x497eb8,null));};exports['destroy']=function(_0xa39c65,_0x1f1916,_0x572ec1){var _0x3f0579;return db[_0xf5f2('0x2e')][_0xf5f2('0x47')]({'where':{'id':_0xa39c65['params']['id']}})[_0xf5f2('0x27')](function(_0xcf7a50){if(_0xcf7a50){return db[_0xf5f2('0x57')][_0xf5f2('0x4a')](function(_0x51fa7e){return _0xcf7a50[_0xf5f2('0x23')]({'transaction':_0x51fa7e,'raw':!![]})['then'](function(_0x2cbe1e){if(_0x2cbe1e[_0xf5f2('0x4c')]){fs[_0xf5f2('0x58')](_0x2cbe1e[_0xf5f2('0x4c')])[_0xf5f2('0x59')](function(_0x5583c2){fs[_0xf5f2('0x5a')](path[_0xf5f2('0x5b')](_0x2cbe1e[_0xf5f2('0x4c')],_0x5583c2));});fs[_0xf5f2('0x5c')](_0x2cbe1e[_0xf5f2('0x4c')]);}return _0x2cbe1e;});})['catch'](function(_0x31e16b){throw new db['Sequelize']['ValidationError'](_0x31e16b[_0xf5f2('0x5d')]);});}})['then'](handleEntityNotFound(_0x1f1916,null))[_0xf5f2('0x27')](removeEntity(_0x1f1916,null))[_0xf5f2('0x49')](handleError(_0x1f1916,null));};exports[_0xf5f2('0x5e')]=function(_0x123b93,_0x5767fc,_0x15d0c2){return db[_0xf5f2('0x57')][_0xf5f2('0x4a')](function(_0x18c41f){var _0x15b680;return db[_0xf5f2('0x2e')][_0xf5f2('0x47')]({'where':{'id':_0x123b93['params']['id']}})[_0xf5f2('0x27')](function(_0x2d171d){if(_0x2d171d){_0x15b680=_0x2d171d;return _0x2d171d[_0xf5f2('0x5e')](_0x123b93[_0xf5f2('0x48')]['id'],{'transaction':_0x18c41f});}})['then'](function(_0x1de396){if(_0x1de396){return db['Sound'][_0xf5f2('0x5f')]({'where':{'id':_0x123b93[_0xf5f2('0x48')]['id']},'attributes':['id','name',_0xf5f2('0x60'),_0xf5f2('0x61'),_0xf5f2('0x62')],'raw':!![]});}})[_0xf5f2('0x27')](function(_0x146462){if(_0x146462){var _0x4bd113=path[_0xf5f2('0x5b')](config[_0xf5f2('0x63')],_0xf5f2('0x64'),util[_0xf5f2('0x65')](_0xf5f2('0x66'),path[_0xf5f2('0x67')](_0x146462['save_name'],path[_0xf5f2('0x68')](_0x146462[_0xf5f2('0x60')])),_0x146462['converted_format']));var _0x3f677e=path[_0xf5f2('0x5b')](config[_0xf5f2('0x63')],'server/files/moh',_0x15b680['name'],util['format'](_0xf5f2('0x66'),_0x146462[_0xf5f2('0x2b')],_0x146462[_0xf5f2('0x61')]));fs[_0xf5f2('0x69')](_0x4bd113,_0x3f677e);return _0x146462;}})[_0xf5f2('0x49')](function(_0x4d878e){throw new db[(_0xf5f2('0x6a'))][(_0xf5f2('0x6b'))](_0x4d878e[_0xf5f2('0x5d')]);});})[_0xf5f2('0x27')](handleEntityNotFound(_0x5767fc,null))[_0xf5f2('0x27')](respondWithResult(_0x5767fc,0xc9))[_0xf5f2('0x49')](handleError(_0x5767fc,null));};exports[_0xf5f2('0x6c')]=function(_0x3cce11,_0x155f45,_0x1f35ef){return db[_0xf5f2('0x57')]['transaction'](function(_0x5e4e07){var _0x5a143f;return db[_0xf5f2('0x2e')][_0xf5f2('0x5f')]({'where':{'id':_0x3cce11[_0xf5f2('0x46')]['id']}})[_0xf5f2('0x27')](handleEntityNotFound(_0x155f45,null))[_0xf5f2('0x27')](function(_0x5c6959){if(_0x5c6959){_0x5a143f=_0x5c6959;return _0x5c6959[_0xf5f2('0x6c')](_0x3cce11[_0xf5f2('0x46')][_0xf5f2('0x6d')]);}})[_0xf5f2('0x27')](function(_0x44d119){if(_0x44d119){return db['Sound'][_0xf5f2('0x5f')]({'where':{'id':_0x3cce11[_0xf5f2('0x46')]['id2']},'attributes':['id',_0xf5f2('0x2b'),_0xf5f2('0x60'),_0xf5f2('0x61'),_0xf5f2('0x62')],'raw':!![]});}})['then'](function(_0x40b36e){if(_0x40b36e){fs[_0xf5f2('0x5a')](path[_0xf5f2('0x5b')](_0x5a143f[_0xf5f2('0x4c')],util[_0xf5f2('0x65')]('%s.%s',_0x40b36e['name'],_0x40b36e[_0xf5f2('0x61')])));return _0x40b36e;}})[_0xf5f2('0x49')](function(_0x17eb69){throw new db[(_0xf5f2('0x6a'))]['ValidationError'](_0x17eb69['message']);});})[_0xf5f2('0x27')](handleEntityNotFound(_0x155f45,null))['then'](respondWithStatusCode(_0x155f45,0xcc))['catch'](handleError(_0x155f45,null));};exports['getSounds']=function(_0x57cb18,_0xad4554,_0x543434){var _0x18eb83={};var _0x168092={};var _0x3de508;var _0x9f941e;return db[_0xf5f2('0x2e')][_0xf5f2('0x5f')]({'where':{'id':_0x57cb18[_0xf5f2('0x46')]['id']}})[_0xf5f2('0x27')](handleEntityNotFound(_0xad4554,null))[_0xf5f2('0x27')](function(_0x2afeac){if(_0x2afeac){_0x3de508=_0x2afeac;_0x168092[_0xf5f2('0x31')]=_[_0xf5f2('0x32')](db[_0xf5f2('0x6e')][_0xf5f2('0x2f')]);_0x168092[_0xf5f2('0x33')]=_[_0xf5f2('0x32')](_0x57cb18['query']);_0x168092[_0xf5f2('0x34')]=_[_0xf5f2('0x35')](_0x168092[_0xf5f2('0x31')],_0x168092[_0xf5f2('0x33')]);_0x18eb83[_0xf5f2('0x36')]=_[_0xf5f2('0x35')](_0x168092[_0xf5f2('0x31')],qs[_0xf5f2('0x37')](_0x57cb18['query'][_0xf5f2('0x37')]));_0x18eb83['attributes']=_0x18eb83['attributes']['length']?_0x18eb83['attributes']:_0x168092['model'];_0x18eb83['order']=qs[_0xf5f2('0x3b')](_0x57cb18[_0xf5f2('0x33')][_0xf5f2('0x3b')]);_0x18eb83[_0xf5f2('0x3c')]=qs[_0xf5f2('0x34')](_[_0xf5f2('0x3d')](_0x57cb18['query'],_0x168092['filters']));if(_0x57cb18[_0xf5f2('0x33')]['filter']){_0x18eb83[_0xf5f2('0x3c')]=_[_0xf5f2('0x3e')](_0x18eb83['where'],{'$or':_['map'](_0x18eb83[_0xf5f2('0x36')],function(_0x274aa3){var _0x5a23c7={};_0x5a23c7[_0x274aa3]={'$like':'%'+_0x57cb18[_0xf5f2('0x33')][_0xf5f2('0x40')]+'%'};return _0x5a23c7;})});}_0x18eb83=_['merge']({},_0x18eb83,_0x57cb18[_0xf5f2('0x41')]);return _0x3de508[_0xf5f2('0x6f')](_0x18eb83);}})[_0xf5f2('0x27')](function(_0x4c1678){if(_0x4c1678){_0x9f941e=_0x4c1678[_0xf5f2('0x38')];if(!_0x57cb18[_0xf5f2('0x33')][_0xf5f2('0x39')](_0xf5f2('0x70'))){_0x18eb83[_0xf5f2('0x1c')]=qs[_0xf5f2('0x1c')](_0x57cb18[_0xf5f2('0x33')][_0xf5f2('0x1c')]);_0x18eb83[_0xf5f2('0x1b')]=qs[_0xf5f2('0x1b')](_0x57cb18[_0xf5f2('0x33')][_0xf5f2('0x1b')]);}return _0x3de508[_0xf5f2('0x6f')](_0x18eb83);}})[_0xf5f2('0x27')](function(_0xe900ea){if(_0xe900ea){return _0xe900ea?{'count':_0x9f941e,'rows':_0xe900ea}:null;}})[_0xf5f2('0x27')](respondWithResult(_0xad4554,null))[_0xf5f2('0x49')](handleError(_0xad4554,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 1673953..e6e3bc1 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 _0x45b2=['request-promise','./voiceMusicOnHold.attributes','define','VoiceMusicOnHold','voice_musiconhold','lodash','util','../../config/logger','api','moment'];(function(_0x5946e3,_0x47da7f){var _0x5962b1=function(_0x45d73b){while(--_0x45d73b){_0x5946e3['push'](_0x5946e3['shift']());}};_0x5962b1(++_0x47da7f);}(_0x45b2,0xcd));var _0x245b=function(_0x2549c8,_0x406f29){_0x2549c8=_0x2549c8-0x0;var _0x4fcefa=_0x45b2[_0x2549c8];return _0x4fcefa;};'use strict';var _=require(_0x245b('0x0'));var util=require(_0x245b('0x1'));var logger=require(_0x245b('0x2'))(_0x245b('0x3'));var moment=require(_0x245b('0x4'));var BPromise=require('bluebird');var rp=require(_0x245b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x245b('0x6'));module['exports']=function(_0x13b5b1,_0x31e14c){return _0x13b5b1[_0x245b('0x7')](_0x245b('0x8'),attributes,{'tableName':_0x245b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7042=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold','voice_musiconhold','lodash','util','../../config/logger','api'];(function(_0x3b06e3,_0x4e74b9){var _0xd34cfa=function(_0x524721){while(--_0x524721){_0x3b06e3['push'](_0x3b06e3['shift']());}};_0xd34cfa(++_0x4e74b9);}(_0x7042,0xdd));var _0x2704=function(_0xcb393b,_0x145602){_0xcb393b=_0xcb393b-0x0;var _0x20bbda=_0x7042[_0xcb393b];return _0x20bbda;};'use strict';var _=require(_0x2704('0x0'));var util=require(_0x2704('0x1'));var logger=require(_0x2704('0x2'))(_0x2704('0x3'));var moment=require(_0x2704('0x4'));var BPromise=require(_0x2704('0x5'));var rp=require(_0x2704('0x6'));var fs=require('fs');var path=require(_0x2704('0x7'));var rimraf=require(_0x2704('0x8'));var config=require(_0x2704('0x9'));var attributes=require(_0x2704('0xa'));module[_0x2704('0xb')]=function(_0x2713a9,_0x26c951){return _0x2713a9[_0x2704('0xc')](_0x2704('0xd'),attributes,{'tableName':_0x2704('0xe'),'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 d7b3ad3..1c566a4 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 _0x94c3=['request','then','info','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VoiceMusicOnHold,\x20%s,\x20%s','result','lodash','util','moment','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http'];(function(_0xca226c,_0x2a1e1e){var _0x56f52a=function(_0x3d3bb3){while(--_0x3d3bb3){_0xca226c['push'](_0xca226c['shift']());}};_0x56f52a(++_0x2a1e1e);}(_0x94c3,0xbc));var _0x394c=function(_0x5880ac,_0x512f8d){_0x5880ac=_0x5880ac-0x0;var _0x134010=_0x94c3[_0x5880ac];return _0x134010;};'use strict';var _=require(_0x394c('0x0'));var util=require(_0x394c('0x1'));var moment=require(_0x394c('0x2'));var BPromise=require('bluebird');var rs=require(_0x394c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x394c('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x394c('0x5'));var config=require(_0x394c('0x6'));var jayson=require(_0x394c('0x7'));var client=jayson[_0x394c('0x8')][_0x394c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x25b7f5,_0x46aaaa,_0x3fb656){return new BPromise(function(_0x23d7a1,_0x4d3d0a){return client[_0x394c('0xa')](_0x25b7f5,_0x3fb656)[_0x394c('0xb')](function(_0x8d858d){logger[_0x394c('0xc')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x46aaaa,_0x394c('0xd'));logger[_0x394c('0xe')](_0x394c('0xf'),_0x46aaaa,_0x394c('0xd'),JSON[_0x394c('0x10')](_0x8d858d));if(_0x8d858d[_0x394c('0x11')]){if(_0x8d858d[_0x394c('0x11')][_0x394c('0x12')]===0x1f4){logger[_0x394c('0x11')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x46aaaa,_0x8d858d[_0x394c('0x11')][_0x394c('0x13')]);return _0x4d3d0a(_0x8d858d[_0x394c('0x11')]['message']);}logger[_0x394c('0x11')](_0x394c('0x14'),_0x46aaaa,_0x8d858d[_0x394c('0x11')][_0x394c('0x13')]);return _0x23d7a1(_0x8d858d[_0x394c('0x11')]['message']);}else{logger[_0x394c('0xc')](_0x394c('0x14'),_0x46aaaa,'request\x20sent');_0x23d7a1(_0x8d858d[_0x394c('0x15')][_0x394c('0x13')]);}})['catch'](function(_0x41d85a){logger[_0x394c('0x11')](_0x394c('0x14'),_0x46aaaa,_0x41d85a);_0x4d3d0a(_0x41d85a);});});} \ No newline at end of file +var _0x7966=['request','info','VoiceMusicOnHold,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x34a32e,_0x26f089){var _0x24ca9b=function(_0x47c1c5){while(--_0x47c1c5){_0x34a32e['push'](_0x34a32e['shift']());}};_0x24ca9b(++_0x26f089);}(_0x7966,0x10d));var _0x6796=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x7966[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0x6796('0x0'));var util=require('util');var moment=require(_0x6796('0x1'));var BPromise=require(_0x6796('0x2'));var rs=require(_0x6796('0x3'));var fs=require('fs');var Redis=require(_0x6796('0x4'));var db=require(_0x6796('0x5'))['db'];var utils=require(_0x6796('0x6'));var logger=require(_0x6796('0x7'))('rpc');var config=require(_0x6796('0x8'));var jayson=require(_0x6796('0x9'));var client=jayson[_0x6796('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5b1ee8,_0x53d5b5,_0x270d6a){return new BPromise(function(_0x1af034,_0x1523c7){return client[_0x6796('0xb')](_0x5b1ee8,_0x270d6a)['then'](function(_0x2d2ba9){logger[_0x6796('0xc')](_0x6796('0xd'),_0x53d5b5,'request\x20sent');logger[_0x6796('0xe')]('VoiceMusicOnHold,\x20%s,\x20%s,\x20%s',_0x53d5b5,_0x6796('0xf'),JSON[_0x6796('0x10')](_0x2d2ba9));if(_0x2d2ba9['error']){if(_0x2d2ba9[_0x6796('0x11')]['code']===0x1f4){logger[_0x6796('0x11')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x53d5b5,_0x2d2ba9[_0x6796('0x11')][_0x6796('0x12')]);return _0x1523c7(_0x2d2ba9[_0x6796('0x11')][_0x6796('0x12')]);}logger[_0x6796('0x11')](_0x6796('0xd'),_0x53d5b5,_0x2d2ba9[_0x6796('0x11')][_0x6796('0x12')]);return _0x1af034(_0x2d2ba9[_0x6796('0x11')][_0x6796('0x12')]);}else{logger[_0x6796('0xc')](_0x6796('0xd'),_0x53d5b5,_0x6796('0xf'));_0x1af034(_0x2d2ba9['result']['message']);}})[_0x6796('0x13')](function(_0x3bb132){logger[_0x6796('0x11')](_0x6796('0xd'),_0x53d5b5,_0x3bb132);_0x1523c7(_0x3bb132);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 3f47e4b..729b0fd 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 _0xf5d4=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','/describe','describe','get','/:id','show','/:id/users','getAgents','post','create','addAgents','put','delete','destroy','exports','multer'];(function(_0x118da4,_0x2e192e){var _0x40dfbb=function(_0x43b165){while(--_0x43b165){_0x118da4['push'](_0x118da4['shift']());}};_0x40dfbb(++_0x2e192e);}(_0xf5d4,0x18f));var _0x4f5d=function(_0x2c83c4,_0x7c9638){_0x2c83c4=_0x2c83c4-0x0;var _0x531a31=_0xf5d4[_0x2c83c4];return _0x531a31;};'use strict';var multer=require(_0x4f5d('0x0'));var util=require(_0x4f5d('0x1'));var path=require(_0x4f5d('0x2'));var timeout=require(_0x4f5d('0x3'));var express=require(_0x4f5d('0x4'));var router=express[_0x4f5d('0x5')]();var auth=require(_0x4f5d('0x6'));var interaction=require(_0x4f5d('0x7'));var config=require(_0x4f5d('0x8'));var controller=require('./voicePrefix.controller');router['get']('/',auth[_0x4f5d('0x9')](),controller[_0x4f5d('0xa')]);router['get'](_0x4f5d('0xb'),auth[_0x4f5d('0x9')](),controller[_0x4f5d('0xc')]);router[_0x4f5d('0xd')](_0x4f5d('0xe'),auth[_0x4f5d('0x9')](),controller[_0x4f5d('0xf')]);router[_0x4f5d('0xd')](_0x4f5d('0x10'),auth[_0x4f5d('0x9')](),controller[_0x4f5d('0x11')]);router[_0x4f5d('0x12')]('/',auth[_0x4f5d('0x9')](),controller[_0x4f5d('0x13')]);router[_0x4f5d('0x12')](_0x4f5d('0x10'),auth[_0x4f5d('0x9')](),controller[_0x4f5d('0x14')]);router[_0x4f5d('0x15')](_0x4f5d('0xe'),auth[_0x4f5d('0x9')](),controller['update']);router[_0x4f5d('0x16')](_0x4f5d('0xe'),auth['isAuthenticated'](),controller[_0x4f5d('0x17')]);router[_0x4f5d('0x16')]('/:id/users',auth[_0x4f5d('0x9')](),controller['removeAgents']);module[_0x4f5d('0x18')]=router; \ No newline at end of file +var _0x8ff2=['connect-timeout','express','Router','../../components/auth/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/users','getAgents','post','create','update','delete','destroy','exports','multer','util','path'];(function(_0x8b81b9,_0x26b388){var _0x21774e=function(_0x2080ae){while(--_0x2080ae){_0x8b81b9['push'](_0x8b81b9['shift']());}};_0x21774e(++_0x26b388);}(_0x8ff2,0x1c9));var _0x28ff=function(_0x31b705,_0x5a8724){_0x31b705=_0x31b705-0x0;var _0x2cc069=_0x8ff2[_0x31b705];return _0x2cc069;};'use strict';var multer=require(_0x28ff('0x0'));var util=require(_0x28ff('0x1'));var path=require(_0x28ff('0x2'));var timeout=require(_0x28ff('0x3'));var express=require(_0x28ff('0x4'));var router=express[_0x28ff('0x5')]();var auth=require(_0x28ff('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x28ff('0x7'));var controller=require(_0x28ff('0x8'));router[_0x28ff('0x9')]('/',auth[_0x28ff('0xa')](),controller[_0x28ff('0xb')]);router[_0x28ff('0x9')](_0x28ff('0xc'),auth[_0x28ff('0xa')](),controller['describe']);router['get'](_0x28ff('0xd'),auth[_0x28ff('0xa')](),controller[_0x28ff('0xe')]);router['get'](_0x28ff('0xf'),auth[_0x28ff('0xa')](),controller[_0x28ff('0x10')]);router[_0x28ff('0x11')]('/',auth[_0x28ff('0xa')](),controller[_0x28ff('0x12')]);router[_0x28ff('0x11')](_0x28ff('0xf'),auth[_0x28ff('0xa')](),controller['addAgents']);router['put']('/:id',auth[_0x28ff('0xa')](),controller[_0x28ff('0x13')]);router[_0x28ff('0x14')](_0x28ff('0xd'),auth[_0x28ff('0xa')](),controller[_0x28ff('0x15')]);router[_0x28ff('0x14')]('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);module[_0x28ff('0x16')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index 76851e4..02005b5 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 _0x5b14=['sequelize','exports','STRING','name','VIRTUAL','system-','INTEGER'];(function(_0x9902b5,_0x5243d0){var _0x283fa9=function(_0x305c7c){while(--_0x305c7c){_0x9902b5['push'](_0x9902b5['shift']());}};_0x283fa9(++_0x5243d0);}(_0x5b14,0xfc));var _0x45b1=function(_0x35d8af,_0x14fd75){_0x35d8af=_0x35d8af-0x0;var _0x1d08b0=_0x5b14[_0x35d8af];return _0x1d08b0;};'use strict';var Sequelize=require(_0x45b1('0x0'));module[_0x45b1('0x1')]={'name':{'type':Sequelize[_0x45b1('0x2')],'allowNull':![],'unique':_0x45b1('0x3')},'prefix':{'type':Sequelize[_0x45b1('0x4')],'get':function(_0x28237f){return _0x45b1('0x5')+this['getDataValue']('name')+'-';}},'description':{'type':Sequelize[_0x45b1('0x2')]},'callerIdAll':{'type':Sequelize[_0x45b1('0x2')]},'VoiceExtensionId':{'type':Sequelize[_0x45b1('0x6')]}}; \ No newline at end of file +var _0x8616=['name','system-','INTEGER','exports','STRING'];(function(_0x16fb90,_0x38f9cc){var _0x2538dc=function(_0xd9771e){while(--_0xd9771e){_0x16fb90['push'](_0x16fb90['shift']());}};_0x2538dc(++_0x38f9cc);}(_0x8616,0xc1));var _0x6861=function(_0x4bb66f,_0x3cd682){_0x4bb66f=_0x4bb66f-0x0;var _0xf2772f=_0x8616[_0x4bb66f];return _0xf2772f;};'use strict';var Sequelize=require('sequelize');module[_0x6861('0x0')]={'name':{'type':Sequelize[_0x6861('0x1')],'allowNull':![],'unique':_0x6861('0x2')},'prefix':{'type':Sequelize['VIRTUAL'],'get':function(_0x3aa490){return _0x6861('0x3')+this['getDataValue']('name')+'-';}},'description':{'type':Sequelize[_0x6861('0x1')]},'callerIdAll':{'type':Sequelize['STRING']},'VoiceExtensionId':{'type':Sequelize[_0x6861('0x4')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 9ad6153..81eed90 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 _0x2796=['sox','to-csv','ejs','lodash','squel','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','status','json','count','offset','limit','set','reject','save','destroy','then','get','VoicePrefixes','UserProfileResource','end','sendStatus','error','stack','name','send','index','map','rawAttributes','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','type','VIRTUAL','VoicePrefix','includeAll','include','findAll','rows','catch','params','intersection','find','describe','create','sequelize','body','VoiceExtensionId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','context','from-sip','system','description','Voice\x20Prefix\x20Extension','priority','prefix','NoOp','Voice\x20Prefix','VoiceExtension','bulkCreate','push','Set','CDR(prefix)=','callerIdAll','No\x20callerid\x20available','goto','${EXTEN:','charAt','update','system-','transaction','findById','addAgents','ids','omit','spread','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','getAgents','findOne','filter','nolimit','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache'];(function(_0x8b010b,_0x1176a5){var _0x3caac6=function(_0x14927a){while(--_0x14927a){_0x8b010b['push'](_0x8b010b['shift']());}};_0x3caac6(++_0x1176a5);}(_0x2796,0x71));var _0x6279=function(_0x4e32e8,_0x3f489f){_0x4e32e8=_0x4e32e8-0x0;var _0x3941f5=_0x2796[_0x4e32e8];return _0x3941f5;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x6279('0x0'));var rimraf=require(_0x6279('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6279('0x2'));var rp=require('request-promise');var moment=require(_0x6279('0x3'));var BPromise=require(_0x6279('0x4'));var Mustache=require(_0x6279('0x5'));var util=require('util');var path=require('path');var sox=require(_0x6279('0x6'));var csv=require(_0x6279('0x7'));var ejs=require(_0x6279('0x8'));var fs=require('fs');var _=require(_0x6279('0x9'));var squel=require(_0x6279('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x6279('0x7'));var querystring=require(_0x6279('0xb'));var Papa=require(_0x6279('0xc'));var Redis=require(_0x6279('0xd'));var authService=require(_0x6279('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6279('0xf'));var logger=require(_0x6279('0x10'))(_0x6279('0x11'));var utils=require(_0x6279('0x12'));var config=require(_0x6279('0x13'));var db=require('../../mysqldb')['db'];config[_0x6279('0x14')]=_[_0x6279('0x15')](config[_0x6279('0x14')],{'host':_0x6279('0x16'),'port':0x18eb});var socket=require(_0x6279('0x17'))(new Redis(config['redis']));require('./voicePrefix.socket')[_0x6279('0x18')](socket);function respondWithStatusCode(_0x59d920,_0x5a97bf){_0x5a97bf=_0x5a97bf||0xcc;return function(_0x57cc65){if(_0x57cc65){return _0x59d920['sendStatus'](_0x5a97bf);}return _0x59d920['status'](_0x5a97bf)['end']();};}function respondWithResult(_0x2f0797,_0x47699e){_0x47699e=_0x47699e||0xc8;return function(_0x39a07d){if(_0x39a07d){return _0x2f0797[_0x6279('0x19')](_0x47699e)[_0x6279('0x1a')](_0x39a07d);}};}function respondWithFilteredResult(_0x5d0b58,_0x436e31){return function(_0x5062de){if(_0x5062de){var _0x2c00d9=_0x5062de[_0x6279('0x1b')],_0x16716d=_0x436e31[_0x6279('0x1c')],_0x1e71e5=_0x436e31['offset']+_0x436e31[_0x6279('0x1d')],_0x148689;if(_0x1e71e5>=_0x2c00d9){_0x1e71e5=_0x2c00d9;_0x148689=0xc8;}else{_0x148689=0xce;}_0x5d0b58[_0x6279('0x19')](_0x148689);return _0x5d0b58[_0x6279('0x1e')]('Content-Range',_0x16716d+'-'+_0x1e71e5+'/'+_0x2c00d9)[_0x6279('0x1a')](_0x5062de);}return null;};}function patchUpdates(_0x27152c){return function(_0x1d6cd8){try{jsonpatch['apply'](_0x1d6cd8,_0x27152c,!![]);}catch(_0x11d7b0){return BPromise[_0x6279('0x1f')](_0x11d7b0);}return _0x1d6cd8[_0x6279('0x20')]();};}function saveUpdates(_0x488a8f,_0x457aec){return function(_0x467c6a){if(_0x467c6a){return _0x467c6a['update'](_0x488a8f)['then'](function(_0x52d34a){return _0x52d34a;});}return null;};}function removeEntity(_0x13fcf6,_0x538f45){return function(_0x163586){if(_0x163586){return _0x163586[_0x6279('0x21')]()[_0x6279('0x22')](function(){var _0x4330a7=_0x163586[_0x6279('0x23')]({'plain':!![]});var _0x28f5cb=_0x6279('0x24');return db[_0x6279('0x25')][_0x6279('0x21')]({'where':{'type':_0x28f5cb,'resourceId':_0x4330a7['id']}})[_0x6279('0x22')](function(){return _0x163586;});})[_0x6279('0x22')](function(){_0x13fcf6['status'](0xcc)[_0x6279('0x26')]();});}};}function handleEntityNotFound(_0x1b914d,_0x18729f){return function(_0x3bd236){if(!_0x3bd236){_0x1b914d[_0x6279('0x27')](0x194);}return _0x3bd236;};}function handleError(_0x37ab98,_0x340e48){_0x340e48=_0x340e48||0x1f4;return function(_0xb33448){logger[_0x6279('0x28')](_0xb33448[_0x6279('0x29')]);if(_0xb33448[_0x6279('0x2a')]){delete _0xb33448[_0x6279('0x2a')];}_0x37ab98[_0x6279('0x19')](_0x340e48)[_0x6279('0x2b')](_0xb33448);};}exports[_0x6279('0x2c')]=function(_0x238171,_0x5d179c){var _0x513eaf={},_0x5d978b={},_0x4f73e0={'count':0x0,'rows':[]};var _0x3ceb1c=_[_0x6279('0x2d')](db['VoicePrefix'][_0x6279('0x2e')],function(_0x5e7816){return{'name':_0x5e7816['fieldName'],'type':_0x5e7816['type'][_0x6279('0x2f')]};});_0x5d978b[_0x6279('0x30')]=_[_0x6279('0x2d')](_0x3ceb1c,'name');_0x5d978b[_0x6279('0x31')]=_[_0x6279('0x32')](_0x238171[_0x6279('0x31')]);_0x5d978b[_0x6279('0x33')]=_['intersection'](_0x5d978b[_0x6279('0x30')],_0x5d978b[_0x6279('0x31')]);_0x513eaf[_0x6279('0x34')]=_['intersection'](_0x5d978b[_0x6279('0x30')],qs[_0x6279('0x35')](_0x238171[_0x6279('0x31')][_0x6279('0x35')]));_0x513eaf[_0x6279('0x34')]=_0x513eaf[_0x6279('0x34')][_0x6279('0x36')]?_0x513eaf[_0x6279('0x34')]:_0x5d978b['model'];if(!_0x238171[_0x6279('0x31')][_0x6279('0x37')]('nolimit')){_0x513eaf[_0x6279('0x1d')]=qs[_0x6279('0x1d')](_0x238171[_0x6279('0x31')][_0x6279('0x1d')]);_0x513eaf[_0x6279('0x1c')]=qs['offset'](_0x238171['query'][_0x6279('0x1c')]);}_0x513eaf[_0x6279('0x38')]=qs['sort'](_0x238171[_0x6279('0x31')][_0x6279('0x39')]);_0x513eaf[_0x6279('0x3a')]=qs[_0x6279('0x33')](_[_0x6279('0x3b')](_0x238171[_0x6279('0x31')],_0x5d978b[_0x6279('0x33')]),_0x3ceb1c);if(_0x238171[_0x6279('0x31')]['filter']){_0x513eaf[_0x6279('0x3a')]=_[_0x6279('0x3c')](_0x513eaf[_0x6279('0x3a')],{'$or':_[_0x6279('0x2d')](_0x3ceb1c,function(_0x396359){if(_0x396359[_0x6279('0x3d')]!==_0x6279('0x3e')){var _0x2cdc3b={};_0x2cdc3b[_0x396359[_0x6279('0x2a')]]={'$like':'%'+_0x238171['query']['filter']+'%'};return _0x2cdc3b;}})});}_0x513eaf=_[_0x6279('0x3c')]({},_0x513eaf,_0x238171['options']);var _0x10db9a={'where':_0x513eaf[_0x6279('0x3a')]};return db[_0x6279('0x3f')]['count'](_0x10db9a)[_0x6279('0x22')](function(_0x5d2ffe){_0x4f73e0[_0x6279('0x1b')]=_0x5d2ffe;if(_0x238171[_0x6279('0x31')][_0x6279('0x40')]){_0x513eaf[_0x6279('0x41')]=[{'all':!![]}];}return db['VoicePrefix'][_0x6279('0x42')](_0x513eaf);})[_0x6279('0x22')](function(_0x299100){_0x4f73e0[_0x6279('0x43')]=_0x299100;return _0x4f73e0;})[_0x6279('0x22')](respondWithFilteredResult(_0x5d179c,_0x513eaf))[_0x6279('0x44')](handleError(_0x5d179c,null));};exports['show']=function(_0xbfa85d,_0x3f4741){var _0x5ccb8a={'raw':![],'where':{'id':_0xbfa85d[_0x6279('0x45')]['id']}},_0x431fba={};_0x431fba[_0x6279('0x30')]=_['keys'](db[_0x6279('0x3f')]['rawAttributes']);_0x431fba[_0x6279('0x31')]=_[_0x6279('0x32')](_0xbfa85d[_0x6279('0x31')]);_0x431fba[_0x6279('0x33')]=_[_0x6279('0x46')](_0x431fba[_0x6279('0x30')],_0x431fba[_0x6279('0x31')]);_0x5ccb8a[_0x6279('0x34')]=_['intersection'](_0x431fba['model'],qs['fields'](_0xbfa85d[_0x6279('0x31')][_0x6279('0x35')]));_0x5ccb8a[_0x6279('0x34')]=_0x5ccb8a[_0x6279('0x34')][_0x6279('0x36')]?_0x5ccb8a[_0x6279('0x34')]:_0x431fba[_0x6279('0x30')];if(_0xbfa85d['query']['includeAll']){_0x5ccb8a[_0x6279('0x41')]=[{'all':!![]}];}_0x5ccb8a=_['merge']({},_0x5ccb8a,_0xbfa85d['options']);return db[_0x6279('0x3f')][_0x6279('0x47')](_0x5ccb8a)[_0x6279('0x22')](handleEntityNotFound(_0x3f4741,null))[_0x6279('0x22')](respondWithResult(_0x3f4741,null))[_0x6279('0x44')](handleError(_0x3f4741,null));};exports['destroy']=function(_0x1f7c1f,_0x20474f){return db[_0x6279('0x3f')]['find']({'where':{'id':_0x1f7c1f[_0x6279('0x45')]['id']}})[_0x6279('0x22')](handleEntityNotFound(_0x20474f,null))[_0x6279('0x22')](removeEntity(_0x20474f,null))[_0x6279('0x44')](handleError(_0x20474f,null));};exports[_0x6279('0x48')]=function(_0x729877,_0x744213){return db[_0x6279('0x3f')][_0x6279('0x48')]()[_0x6279('0x22')](respondWithResult(_0x744213,null))['catch'](handleError(_0x744213,null));};exports[_0x6279('0x49')]=function(_0x29cb98,_0x50eb9d){var _0x58b0ee;return db[_0x6279('0x4a')]['transaction'](function(_0x5de44c){return db['VoicePrefix'][_0x6279('0x49')](_0x29cb98[_0x6279('0x4b')],{'transaction':_0x5de44c})[_0x6279('0x22')](function(_0x4c456e){_0x58b0ee=_0x4c456e[_0x6279('0x23')]({'plain':!![]});return db['VoiceExtension']['find']({'where':{'id':_0x58b0ee[_0x6279('0x4c')]},'raw':!![]})[_0x6279('0x22')](function(_0x1875a5){return createVoicePrefixExtensions(_0x58b0ee,_0x1875a5,_0x5de44c);});});})['then'](function(){var _0x4b55e8=_0x29cb98['user'][_0x6279('0x23')]({'plain':!![]});if(!_0x4b55e8)throw new Error(_0x6279('0x4d'));if(_0x4b55e8[_0x6279('0x4e')]===_0x6279('0x4f')){var _0x52ce3e=_0x58b0ee;return db[_0x6279('0x50')][_0x6279('0x47')]({'where':{'name':_0x6279('0x24'),'userProfileId':_0x4b55e8[_0x6279('0x51')]},'raw':!![]})[_0x6279('0x22')](function(_0x2ee53c){if(_0x2ee53c&&_0x2ee53c[_0x6279('0x52')]===0x0){return db['UserProfileResource']['create']({'name':_0x52ce3e['name'],'resourceId':_0x52ce3e['id'],'type':_0x2ee53c[_0x6279('0x2a')],'sectionId':_0x2ee53c['id']},{})[_0x6279('0x22')](function(){return _0x58b0ee;});}else{return _0x58b0ee;}})[_0x6279('0x44')](function(_0x40472b){logger[_0x6279('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x40472b);throw _0x40472b;});}return _0x58b0ee;})[_0x6279('0x22')](respondWithResult(_0x50eb9d,null))['catch'](handleError(_0x50eb9d,null));};function Extension(_0x414a33,_0x3d95e0,_0x361328,_0x50df6d){this[_0x6279('0x53')]=_0x6279('0x54');this['exten']=_0x414a33;this['app']=_0x361328;this[_0x6279('0x3d')]=_0x6279('0x55');this[_0x6279('0x56')]=_0x6279('0x57');this[_0x6279('0x58')]=_0x3d95e0;this['appdata']=_0x50df6d;}function createVoicePrefixExtensions(_0x634b60,_0xe858ea,_0x4ca7b8){return new BPromise(function(_0x488bf4,_0x3d4fad){var _0x3ca6b1=new Extension(formatPrefixName(_0x634b60[_0x6279('0x59')]),0x1,_0x6279('0x5a'),_0x6279('0x5b'));_0x3ca6b1['VoicePrefixId']=_0x634b60['id'];return db['VoiceExtension'][_0x6279('0x49')](_0x3ca6b1,{'transaction':_0x4ca7b8})[_0x6279('0x22')](function(_0x18edb6){var _0x39f4a9=_0x18edb6[_0x6279('0x23')]({'plain':!![]});var _0x5af469=_[_0x6279('0x2d')](addVoicePrefixExtensions(_0x634b60,_0xe858ea),function(_0x56e889){_0x56e889[_0x6279('0x4c')]=_0x39f4a9['id'];_0x56e889['VoicePrefixId']=_0x634b60['id'];return _0x56e889;});return db[_0x6279('0x5c')][_0x6279('0x5d')](_0x5af469,{'transaction':_0x4ca7b8})[_0x6279('0x22')](function(_0x51c57c){if(!_0x51c57c){return _0x3d4fad('Extensions\x20creation\x20failed');}else{return _0x488bf4(_0x51c57c);}})[_0x6279('0x44')](function(_0x1d0f39){return _0x3d4fad(_0x1d0f39);});});;});};function addVoicePrefixExtensions(_0x32e22f,_0x40ae8f){var _0x2da2e9=[];var _0x1b731b=formatPrefixName(_0x32e22f['prefix']);_0x2da2e9[_0x6279('0x5e')](new Extension(_0x1b731b,0x2,_0x6279('0x5f'),_0x6279('0x60')+_0x32e22f[_0x6279('0x2a')]));if(_0x32e22f['callerIdAll']){_0x2da2e9['push'](new Extension(_0x1b731b,0x3,_0x6279('0x5f'),'PREFIX-CALLERIDALL='+_0x32e22f[_0x6279('0x61')]));}else{_0x2da2e9[_0x6279('0x5e')](new Extension(_0x1b731b,0x3,_0x6279('0x5a'),_0x6279('0x62')));}_0x2da2e9[_0x6279('0x5e')](new Extension(_0x1b731b,0x4,_0x6279('0x63'),_0x40ae8f[_0x6279('0x53')]+','+_0x6279('0x64')+(0x8+_0x32e22f[_0x6279('0x2a')][_0x6279('0x36')])+'}'+','+0x1));return _0x2da2e9;}function formatPrefixName(_0x23acbc){var _0x32bb87='_';for(var _0x43ac87=0x0;_0x43ac87<_0x23acbc[_0x6279('0x36')];_0x43ac87++){if(_0x23acbc[_0x6279('0x65')](_0x43ac87)=='-'){_0x32bb87+=_0x23acbc[_0x6279('0x65')](_0x43ac87);}else{_0x32bb87+='['+_0x23acbc[_0x6279('0x65')](_0x43ac87)+']';}}_0x32bb87+='.';return _0x32bb87;}exports[_0x6279('0x66')]=function(_0x42ddcf,_0x2da4f7,_0x41c047){var _0x20bf4d=_0x42ddcf['body'];_0x20bf4d[_0x6279('0x59')]=_0x6279('0x67')+_0x20bf4d[_0x6279('0x2a')]+'-';return db[_0x6279('0x4a')][_0x6279('0x68')](function(_0x210a71){return db[_0x6279('0x3f')]['update'](_0x20bf4d,{'where':{'id':_0x20bf4d['id']},'transaction':_0x210a71})[_0x6279('0x22')](function(){return db[_0x6279('0x5c')][_0x6279('0x21')]({'where':{'VoicePrefixId':_0x20bf4d['id']},'transaction':_0x210a71})['then'](function(){return db[_0x6279('0x5c')][_0x6279('0x47')]({'where':{'id':_0x20bf4d['VoiceExtensionId']},'raw':!![]})[_0x6279('0x22')](function(_0x45ff0f){return createVoicePrefixExtensions(_0x20bf4d,_0x45ff0f,_0x210a71);});});});})[_0x6279('0x22')](function(){return db[_0x6279('0x3f')][_0x6279('0x69')](_0x20bf4d['id']);})['then'](respondWithResult(_0x2da4f7,null))[_0x6279('0x44')](handleError(_0x2da4f7,null));};exports[_0x6279('0x6a')]=function(_0x50f279,_0x318d93,_0x32a678){return db[_0x6279('0x3f')]['find']({'where':{'id':_0x50f279[_0x6279('0x45')]['id']}})[_0x6279('0x22')](handleEntityNotFound(_0x318d93,null))[_0x6279('0x22')](function(_0x46af06){if(_0x46af06){return _0x46af06[_0x6279('0x6a')](_0x50f279[_0x6279('0x4b')][_0x6279('0x6b')],_[_0x6279('0x6c')](_0x50f279[_0x6279('0x4b')],['ids','id'])||{})[_0x6279('0x6d')](function(_0x33688c){for(var _0x207b30=0x0;_0x207b30<_0x50f279[_0x6279('0x4b')][_0x6279('0x6b')]['length'];_0x207b30+=0x1){socket[_0x6279('0x6e')](_0x6279('0x6f'),{'UserId':_0x50f279[_0x6279('0x4b')][_0x6279('0x6b')][_0x207b30],'VoicePrefixId':_0x50f279[_0x6279('0x45')]['id']});}return _0x33688c;});}})[_0x6279('0x22')](respondWithResult(_0x318d93,null))[_0x6279('0x44')](handleError(_0x318d93,null));};exports[_0x6279('0x70')]=function(_0x3b4d78,_0x4f7e96,_0x1ab4bd){return db['VoicePrefix'][_0x6279('0x47')]({'where':{'id':_0x3b4d78[_0x6279('0x45')]['id']}})[_0x6279('0x22')](handleEntityNotFound(_0x4f7e96,null))[_0x6279('0x22')](function(_0x498157){if(_0x498157){return _0x498157[_0x6279('0x70')](_0x3b4d78[_0x6279('0x31')][_0x6279('0x6b')])[_0x6279('0x22')](function(){if(_[_0x6279('0x71')](_0x3b4d78[_0x6279('0x31')]['ids'])){for(var _0x4147d1=0x0;_0x4147d1<_0x3b4d78['query'][_0x6279('0x6b')]['length'];_0x4147d1+=0x1){socket['emit'](_0x6279('0x72'),{'UserId':Number(_0x3b4d78[_0x6279('0x31')][_0x6279('0x6b')][_0x4147d1]),'VoicePrefixId':Number(_0x3b4d78[_0x6279('0x45')]['id'])});}}else{socket['emit'](_0x6279('0x72'),{'UserId':Number(_0x3b4d78[_0x6279('0x31')][_0x6279('0x6b')]),'VoicePrefixId':Number(_0x3b4d78[_0x6279('0x45')]['id'])});}});}})[_0x6279('0x22')](respondWithStatusCode(_0x4f7e96,null))['catch'](handleError(_0x4f7e96,null));};exports[_0x6279('0x73')]=function(_0x29621b,_0x272266,_0x3bc0d0){var _0x35a2d5={};var _0x54101d={};var _0x5b4be5;var _0x4e0513;return db[_0x6279('0x3f')][_0x6279('0x74')]({'where':{'id':_0x29621b[_0x6279('0x45')]['id']}})[_0x6279('0x22')](handleEntityNotFound(_0x272266,null))[_0x6279('0x22')](function(_0x39f2f7){if(_0x39f2f7){_0x5b4be5=_0x39f2f7;_0x54101d[_0x6279('0x30')]=_[_0x6279('0x32')](db['User']['rawAttributes']);_0x54101d[_0x6279('0x31')]=_[_0x6279('0x32')](_0x29621b['query']);_0x54101d['filters']=_[_0x6279('0x46')](_0x54101d['model'],_0x54101d[_0x6279('0x31')]);_0x35a2d5['attributes']=_[_0x6279('0x46')](_0x54101d[_0x6279('0x30')],qs[_0x6279('0x35')](_0x29621b[_0x6279('0x31')]['fields']));_0x35a2d5[_0x6279('0x34')]=_0x35a2d5['attributes'][_0x6279('0x36')]?_0x35a2d5[_0x6279('0x34')]:_0x54101d[_0x6279('0x30')];_0x35a2d5[_0x6279('0x38')]=qs[_0x6279('0x39')](_0x29621b[_0x6279('0x31')][_0x6279('0x39')]);_0x35a2d5[_0x6279('0x3a')]=qs[_0x6279('0x33')](_[_0x6279('0x3b')](_0x29621b[_0x6279('0x31')],_0x54101d[_0x6279('0x33')]));if(_0x29621b[_0x6279('0x31')][_0x6279('0x75')]){_0x35a2d5[_0x6279('0x3a')]=_[_0x6279('0x3c')](_0x35a2d5[_0x6279('0x3a')],{'$or':_[_0x6279('0x2d')](_0x35a2d5[_0x6279('0x34')],function(_0x560a8d){var _0x52cf5c={};_0x52cf5c[_0x560a8d]={'$like':'%'+_0x29621b[_0x6279('0x31')][_0x6279('0x75')]+'%'};return _0x52cf5c;})});}_0x35a2d5=_['merge']({},_0x35a2d5,_0x29621b['options']);return _0x5b4be5[_0x6279('0x73')](_0x35a2d5);}})[_0x6279('0x22')](function(_0x51c57b){if(_0x51c57b){_0x4e0513=_0x51c57b[_0x6279('0x36')];if(!_0x29621b[_0x6279('0x31')][_0x6279('0x37')](_0x6279('0x76'))){_0x35a2d5[_0x6279('0x1d')]=qs['limit'](_0x29621b['query'][_0x6279('0x1d')]);_0x35a2d5['offset']=qs[_0x6279('0x1c')](_0x29621b[_0x6279('0x31')][_0x6279('0x1c')]);}return _0x5b4be5[_0x6279('0x73')](_0x35a2d5);}})[_0x6279('0x22')](function(_0x57c573){if(_0x57c573){return _0x57c573?{'count':_0x4e0513,'rows':_0x57c573}:null;}})['then'](respondWithResult(_0x272266,null))[_0x6279('0x44')](handleError(_0x272266,null));}; \ No newline at end of file +var _0x621f=['context','${EXTEN:','charAt','system-','sequelize','findById','addAgents','ids','omit','spread','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','getAgents','findOne','User','options','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','sox','to-csv','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','VoicePrefixes','UserProfileResource','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','params','keys','VoicePrefix','length','find','describe','create','body','get','VoiceExtension','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','from-sip','app','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','Voice\x20Prefix','VoicePrefixId','Extensions\x20creation\x20failed','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','No\x20callerid\x20available','push'];(function(_0x2fb0ee,_0x56f2d6){var _0xf593d=function(_0x584b12){while(--_0x584b12){_0x2fb0ee['push'](_0x2fb0ee['shift']());}};_0xf593d(++_0x56f2d6);}(_0x621f,0x10b));var _0xf621=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x621f[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xf621('0x0'));var emlformat=require(_0xf621('0x1'));var rimraf=require(_0xf621('0x2'));var zipdir=require(_0xf621('0x3'));var jsonpatch=require(_0xf621('0x4'));var rp=require('request-promise');var moment=require(_0xf621('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xf621('0x6'));var util=require(_0xf621('0x7'));var path=require('path');var sox=require(_0xf621('0x8'));var csv=require(_0xf621('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xf621('0xa'));var jsforce=require(_0xf621('0xb'));var deskjs=require(_0xf621('0xc'));var toCsv=require(_0xf621('0x9'));var querystring=require(_0xf621('0xd'));var Papa=require(_0xf621('0xe'));var Redis=require(_0xf621('0xf'));var authService=require(_0xf621('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf621('0x11'));var logger=require(_0xf621('0x12'))(_0xf621('0x13'));var utils=require(_0xf621('0x14'));var config=require(_0xf621('0x15'));var db=require(_0xf621('0x16'))['db'];config[_0xf621('0x17')]=_[_0xf621('0x18')](config['redis'],{'host':_0xf621('0x19'),'port':0x18eb});var socket=require(_0xf621('0x1a'))(new Redis(config[_0xf621('0x17')]));require(_0xf621('0x1b'))[_0xf621('0x1c')](socket);function respondWithStatusCode(_0x3482a9,_0x59e32f){_0x59e32f=_0x59e32f||0xcc;return function(_0x494daf){if(_0x494daf){return _0x3482a9[_0xf621('0x1d')](_0x59e32f);}return _0x3482a9[_0xf621('0x1e')](_0x59e32f)[_0xf621('0x1f')]();};}function respondWithResult(_0x1905ff,_0x317825){_0x317825=_0x317825||0xc8;return function(_0x2664cd){if(_0x2664cd){return _0x1905ff[_0xf621('0x1e')](_0x317825)[_0xf621('0x20')](_0x2664cd);}};}function respondWithFilteredResult(_0x351635,_0x235c4c){return function(_0x388476){if(_0x388476){var _0x521467=_0x388476[_0xf621('0x21')],_0x17be9c=_0x235c4c[_0xf621('0x22')],_0x4358b8=_0x235c4c[_0xf621('0x22')]+_0x235c4c[_0xf621('0x23')],_0x3a7263;if(_0x4358b8>=_0x521467){_0x4358b8=_0x521467;_0x3a7263=0xc8;}else{_0x3a7263=0xce;}_0x351635['status'](_0x3a7263);return _0x351635[_0xf621('0x24')](_0xf621('0x25'),_0x17be9c+'-'+_0x4358b8+'/'+_0x521467)[_0xf621('0x20')](_0x388476);}return null;};}function patchUpdates(_0x54888d){return function(_0x2a5fff){try{jsonpatch[_0xf621('0x26')](_0x2a5fff,_0x54888d,!![]);}catch(_0x1ecaea){return BPromise[_0xf621('0x27')](_0x1ecaea);}return _0x2a5fff[_0xf621('0x28')]();};}function saveUpdates(_0x49b732,_0x35a031){return function(_0x515118){if(_0x515118){return _0x515118[_0xf621('0x29')](_0x49b732)['then'](function(_0x2da288){return _0x2da288;});}return null;};}function removeEntity(_0x456b03,_0xab2e7f){return function(_0x40f25a){if(_0x40f25a){return _0x40f25a[_0xf621('0x2a')]()[_0xf621('0x2b')](function(){var _0x274cb8=_0x40f25a['get']({'plain':!![]});var _0x41805c=_0xf621('0x2c');return db[_0xf621('0x2d')][_0xf621('0x2a')]({'where':{'type':_0x41805c,'resourceId':_0x274cb8['id']}})[_0xf621('0x2b')](function(){return _0x40f25a;});})['then'](function(){_0x456b03[_0xf621('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x494a48,_0x392727){return function(_0x26bc4a){if(!_0x26bc4a){_0x494a48[_0xf621('0x1d')](0x194);}return _0x26bc4a;};}function handleError(_0x4bed67,_0x244816){_0x244816=_0x244816||0x1f4;return function(_0x7817c7){logger['error'](_0x7817c7[_0xf621('0x2e')]);if(_0x7817c7['name']){delete _0x7817c7[_0xf621('0x2f')];}_0x4bed67['status'](_0x244816)[_0xf621('0x30')](_0x7817c7);};}exports['index']=function(_0x2c7d5e,_0x14e23a){var _0x3ab7f1={},_0x2da807={},_0x4a0e47={'count':0x0,'rows':[]};var _0x52fefe=_[_0xf621('0x31')](db['VoicePrefix'][_0xf621('0x32')],function(_0x40c2f4){return{'name':_0x40c2f4[_0xf621('0x33')],'type':_0x40c2f4[_0xf621('0x34')][_0xf621('0x35')]};});_0x2da807[_0xf621('0x36')]=_[_0xf621('0x31')](_0x52fefe,'name');_0x2da807['query']=_['keys'](_0x2c7d5e[_0xf621('0x37')]);_0x2da807[_0xf621('0x38')]=_[_0xf621('0x39')](_0x2da807[_0xf621('0x36')],_0x2da807[_0xf621('0x37')]);_0x3ab7f1[_0xf621('0x3a')]=_[_0xf621('0x39')](_0x2da807[_0xf621('0x36')],qs[_0xf621('0x3b')](_0x2c7d5e['query']['fields']));_0x3ab7f1['attributes']=_0x3ab7f1['attributes']['length']?_0x3ab7f1['attributes']:_0x2da807[_0xf621('0x36')];if(!_0x2c7d5e[_0xf621('0x37')]['hasOwnProperty']('nolimit')){_0x3ab7f1[_0xf621('0x23')]=qs['limit'](_0x2c7d5e[_0xf621('0x37')][_0xf621('0x23')]);_0x3ab7f1[_0xf621('0x22')]=qs['offset'](_0x2c7d5e[_0xf621('0x37')][_0xf621('0x22')]);}_0x3ab7f1[_0xf621('0x3c')]=qs[_0xf621('0x3d')](_0x2c7d5e['query']['sort']);_0x3ab7f1[_0xf621('0x3e')]=qs[_0xf621('0x38')](_[_0xf621('0x3f')](_0x2c7d5e[_0xf621('0x37')],_0x2da807[_0xf621('0x38')]),_0x52fefe);if(_0x2c7d5e['query'][_0xf621('0x40')]){_0x3ab7f1['where']=_['merge'](_0x3ab7f1[_0xf621('0x3e')],{'$or':_[_0xf621('0x31')](_0x52fefe,function(_0xdb5f9d){if(_0xdb5f9d[_0xf621('0x34')]!==_0xf621('0x41')){var _0x3d4ec5={};_0x3d4ec5[_0xdb5f9d[_0xf621('0x2f')]]={'$like':'%'+_0x2c7d5e[_0xf621('0x37')][_0xf621('0x40')]+'%'};return _0x3d4ec5;}})});}_0x3ab7f1=_[_0xf621('0x42')]({},_0x3ab7f1,_0x2c7d5e['options']);var _0x23bc15={'where':_0x3ab7f1[_0xf621('0x3e')]};return db['VoicePrefix'][_0xf621('0x21')](_0x23bc15)['then'](function(_0x26ed03){_0x4a0e47['count']=_0x26ed03;if(_0x2c7d5e[_0xf621('0x37')][_0xf621('0x43')]){_0x3ab7f1[_0xf621('0x44')]=[{'all':!![]}];}return db['VoicePrefix'][_0xf621('0x45')](_0x3ab7f1);})['then'](function(_0x5dba7c){_0x4a0e47[_0xf621('0x46')]=_0x5dba7c;return _0x4a0e47;})[_0xf621('0x2b')](respondWithFilteredResult(_0x14e23a,_0x3ab7f1))[_0xf621('0x47')](handleError(_0x14e23a,null));};exports['show']=function(_0x5c4f49,_0x243571){var _0xeb9aa5={'raw':![],'where':{'id':_0x5c4f49[_0xf621('0x48')]['id']}},_0x75a346={};_0x75a346[_0xf621('0x36')]=_[_0xf621('0x49')](db[_0xf621('0x4a')][_0xf621('0x32')]);_0x75a346[_0xf621('0x37')]=_[_0xf621('0x49')](_0x5c4f49[_0xf621('0x37')]);_0x75a346[_0xf621('0x38')]=_[_0xf621('0x39')](_0x75a346[_0xf621('0x36')],_0x75a346[_0xf621('0x37')]);_0xeb9aa5[_0xf621('0x3a')]=_[_0xf621('0x39')](_0x75a346[_0xf621('0x36')],qs[_0xf621('0x3b')](_0x5c4f49[_0xf621('0x37')][_0xf621('0x3b')]));_0xeb9aa5[_0xf621('0x3a')]=_0xeb9aa5[_0xf621('0x3a')][_0xf621('0x4b')]?_0xeb9aa5[_0xf621('0x3a')]:_0x75a346[_0xf621('0x36')];if(_0x5c4f49[_0xf621('0x37')]['includeAll']){_0xeb9aa5[_0xf621('0x44')]=[{'all':!![]}];}_0xeb9aa5=_[_0xf621('0x42')]({},_0xeb9aa5,_0x5c4f49['options']);return db['VoicePrefix'][_0xf621('0x4c')](_0xeb9aa5)[_0xf621('0x2b')](handleEntityNotFound(_0x243571,null))[_0xf621('0x2b')](respondWithResult(_0x243571,null))[_0xf621('0x47')](handleError(_0x243571,null));};exports[_0xf621('0x2a')]=function(_0x270254,_0x982a16){return db[_0xf621('0x4a')][_0xf621('0x4c')]({'where':{'id':_0x270254[_0xf621('0x48')]['id']}})[_0xf621('0x2b')](handleEntityNotFound(_0x982a16,null))[_0xf621('0x2b')](removeEntity(_0x982a16,null))[_0xf621('0x47')](handleError(_0x982a16,null));};exports[_0xf621('0x4d')]=function(_0x403da1,_0x312cbd){return db[_0xf621('0x4a')][_0xf621('0x4d')]()[_0xf621('0x2b')](respondWithResult(_0x312cbd,null))['catch'](handleError(_0x312cbd,null));};exports[_0xf621('0x4e')]=function(_0x55e016,_0x39906a){var _0xccfeb6;return db['sequelize']['transaction'](function(_0x3de802){return db[_0xf621('0x4a')][_0xf621('0x4e')](_0x55e016[_0xf621('0x4f')],{'transaction':_0x3de802})[_0xf621('0x2b')](function(_0x706f58){_0xccfeb6=_0x706f58[_0xf621('0x50')]({'plain':!![]});return db[_0xf621('0x51')][_0xf621('0x4c')]({'where':{'id':_0xccfeb6[_0xf621('0x52')]},'raw':!![]})['then'](function(_0x37a63e){return createVoicePrefixExtensions(_0xccfeb6,_0x37a63e,_0x3de802);});});})['then'](function(){var _0x21a6bd=_0x55e016[_0xf621('0x53')][_0xf621('0x50')]({'plain':!![]});if(!_0x21a6bd)throw new Error(_0xf621('0x54'));if(_0x21a6bd[_0xf621('0x55')]===_0xf621('0x53')){var _0x488f21=_0xccfeb6;return db[_0xf621('0x56')][_0xf621('0x4c')]({'where':{'name':_0xf621('0x2c'),'userProfileId':_0x21a6bd['userProfileId']},'raw':!![]})[_0xf621('0x2b')](function(_0x2f682c){if(_0x2f682c&&_0x2f682c['autoAssociation']===0x0){return db['UserProfileResource'][_0xf621('0x4e')]({'name':_0x488f21[_0xf621('0x2f')],'resourceId':_0x488f21['id'],'type':_0x2f682c[_0xf621('0x2f')],'sectionId':_0x2f682c['id']},{})[_0xf621('0x2b')](function(){return _0xccfeb6;});}else{return _0xccfeb6;}})[_0xf621('0x47')](function(_0x3f466c){logger[_0xf621('0x57')](_0xf621('0x58'),_0x3f466c);throw _0x3f466c;});}return _0xccfeb6;})[_0xf621('0x2b')](respondWithResult(_0x39906a,null))[_0xf621('0x47')](handleError(_0x39906a,null));};function Extension(_0x89d21e,_0x5c9745,_0x3a4ca8,_0x5783c7){this['context']=_0xf621('0x59');this['exten']=_0x89d21e;this[_0xf621('0x5a')]=_0x3a4ca8;this[_0xf621('0x34')]='system';this[_0xf621('0x5b')]=_0xf621('0x5c');this[_0xf621('0x5d')]=_0x5c9745;this[_0xf621('0x5e')]=_0x5783c7;}function createVoicePrefixExtensions(_0x50e5ae,_0x4a95d4,_0x33afbb){return new BPromise(function(_0x398626,_0xb87611){var _0x5d353e=new Extension(formatPrefixName(_0x50e5ae[_0xf621('0x5f')]),0x1,'NoOp',_0xf621('0x60'));_0x5d353e['VoicePrefixId']=_0x50e5ae['id'];return db[_0xf621('0x51')][_0xf621('0x4e')](_0x5d353e,{'transaction':_0x33afbb})[_0xf621('0x2b')](function(_0x3a2ce2){var _0xc74f8f=_0x3a2ce2[_0xf621('0x50')]({'plain':!![]});var _0x5af0a3=_['map'](addVoicePrefixExtensions(_0x50e5ae,_0x4a95d4),function(_0x408ff7){_0x408ff7[_0xf621('0x52')]=_0xc74f8f['id'];_0x408ff7[_0xf621('0x61')]=_0x50e5ae['id'];return _0x408ff7;});return db[_0xf621('0x51')]['bulkCreate'](_0x5af0a3,{'transaction':_0x33afbb})[_0xf621('0x2b')](function(_0x3bca72){if(!_0x3bca72){return _0xb87611(_0xf621('0x62'));}else{return _0x398626(_0x3bca72);}})[_0xf621('0x47')](function(_0x412dd6){return _0xb87611(_0x412dd6);});});;});};function addVoicePrefixExtensions(_0x51a996,_0x26540a){var _0x458d3b=[];var _0x4cea84=formatPrefixName(_0x51a996[_0xf621('0x5f')]);_0x458d3b['push'](new Extension(_0x4cea84,0x2,_0xf621('0x63'),_0xf621('0x64')+_0x51a996['name']));if(_0x51a996[_0xf621('0x65')]){_0x458d3b['push'](new Extension(_0x4cea84,0x3,_0xf621('0x63'),_0xf621('0x66')+_0x51a996[_0xf621('0x65')]));}else{_0x458d3b['push'](new Extension(_0x4cea84,0x3,'NoOp',_0xf621('0x67')));}_0x458d3b[_0xf621('0x68')](new Extension(_0x4cea84,0x4,'goto',_0x26540a[_0xf621('0x69')]+','+_0xf621('0x6a')+(0x8+_0x51a996['name'][_0xf621('0x4b')])+'}'+','+0x1));return _0x458d3b;}function formatPrefixName(_0x342406){var _0x4abbe5='_';for(var _0x482523=0x0;_0x482523<_0x342406[_0xf621('0x4b')];_0x482523++){if(_0x342406[_0xf621('0x6b')](_0x482523)=='-'){_0x4abbe5+=_0x342406[_0xf621('0x6b')](_0x482523);}else{_0x4abbe5+='['+_0x342406[_0xf621('0x6b')](_0x482523)+']';}}_0x4abbe5+='.';return _0x4abbe5;}exports[_0xf621('0x29')]=function(_0x19730f,_0x7c8275,_0x341802){var _0x25818b=_0x19730f[_0xf621('0x4f')];_0x25818b[_0xf621('0x5f')]=_0xf621('0x6c')+_0x25818b[_0xf621('0x2f')]+'-';return db[_0xf621('0x6d')]['transaction'](function(_0x4c7b98){return db['VoicePrefix'][_0xf621('0x29')](_0x25818b,{'where':{'id':_0x25818b['id']},'transaction':_0x4c7b98})[_0xf621('0x2b')](function(){return db[_0xf621('0x51')][_0xf621('0x2a')]({'where':{'VoicePrefixId':_0x25818b['id']},'transaction':_0x4c7b98})[_0xf621('0x2b')](function(){return db['VoiceExtension'][_0xf621('0x4c')]({'where':{'id':_0x25818b[_0xf621('0x52')]},'raw':!![]})[_0xf621('0x2b')](function(_0x1f230f){return createVoicePrefixExtensions(_0x25818b,_0x1f230f,_0x4c7b98);});});});})[_0xf621('0x2b')](function(){return db[_0xf621('0x4a')][_0xf621('0x6e')](_0x25818b['id']);})['then'](respondWithResult(_0x7c8275,null))[_0xf621('0x47')](handleError(_0x7c8275,null));};exports['addAgents']=function(_0x651bd7,_0x36edcb,_0x2821e0){return db['VoicePrefix'][_0xf621('0x4c')]({'where':{'id':_0x651bd7[_0xf621('0x48')]['id']}})[_0xf621('0x2b')](handleEntityNotFound(_0x36edcb,null))['then'](function(_0x59a506){if(_0x59a506){return _0x59a506[_0xf621('0x6f')](_0x651bd7[_0xf621('0x4f')][_0xf621('0x70')],_[_0xf621('0x71')](_0x651bd7[_0xf621('0x4f')],[_0xf621('0x70'),'id'])||{})[_0xf621('0x72')](function(_0x992293){for(var _0x5059a3=0x0;_0x5059a3<_0x651bd7[_0xf621('0x4f')][_0xf621('0x70')][_0xf621('0x4b')];_0x5059a3+=0x1){socket[_0xf621('0x73')](_0xf621('0x74'),{'UserId':_0x651bd7[_0xf621('0x4f')][_0xf621('0x70')][_0x5059a3],'VoicePrefixId':_0x651bd7[_0xf621('0x48')]['id']});}return _0x992293;});}})['then'](respondWithResult(_0x36edcb,null))[_0xf621('0x47')](handleError(_0x36edcb,null));};exports[_0xf621('0x75')]=function(_0x4a0f32,_0x1e4e48,_0x64dc59){return db['VoicePrefix'][_0xf621('0x4c')]({'where':{'id':_0x4a0f32[_0xf621('0x48')]['id']}})[_0xf621('0x2b')](handleEntityNotFound(_0x1e4e48,null))[_0xf621('0x2b')](function(_0x187282){if(_0x187282){return _0x187282[_0xf621('0x75')](_0x4a0f32[_0xf621('0x37')]['ids'])[_0xf621('0x2b')](function(){if(_[_0xf621('0x76')](_0x4a0f32[_0xf621('0x37')][_0xf621('0x70')])){for(var _0x267e3c=0x0;_0x267e3c<_0x4a0f32[_0xf621('0x37')][_0xf621('0x70')]['length'];_0x267e3c+=0x1){socket[_0xf621('0x73')](_0xf621('0x77'),{'UserId':Number(_0x4a0f32[_0xf621('0x37')][_0xf621('0x70')][_0x267e3c]),'VoicePrefixId':Number(_0x4a0f32[_0xf621('0x48')]['id'])});}}else{socket[_0xf621('0x73')]('userVoicePrefix:remove',{'UserId':Number(_0x4a0f32[_0xf621('0x37')]['ids']),'VoicePrefixId':Number(_0x4a0f32[_0xf621('0x48')]['id'])});}});}})[_0xf621('0x2b')](respondWithStatusCode(_0x1e4e48,null))[_0xf621('0x47')](handleError(_0x1e4e48,null));};exports[_0xf621('0x78')]=function(_0x2a16ac,_0x460a69,_0x22809a){var _0x1cba82={};var _0x11957a={};var _0x77f893;var _0x5e02c2;return db[_0xf621('0x4a')][_0xf621('0x79')]({'where':{'id':_0x2a16ac[_0xf621('0x48')]['id']}})['then'](handleEntityNotFound(_0x460a69,null))[_0xf621('0x2b')](function(_0x19f8cd){if(_0x19f8cd){_0x77f893=_0x19f8cd;_0x11957a[_0xf621('0x36')]=_[_0xf621('0x49')](db[_0xf621('0x7a')][_0xf621('0x32')]);_0x11957a[_0xf621('0x37')]=_['keys'](_0x2a16ac[_0xf621('0x37')]);_0x11957a[_0xf621('0x38')]=_[_0xf621('0x39')](_0x11957a[_0xf621('0x36')],_0x11957a['query']);_0x1cba82['attributes']=_[_0xf621('0x39')](_0x11957a[_0xf621('0x36')],qs[_0xf621('0x3b')](_0x2a16ac['query'][_0xf621('0x3b')]));_0x1cba82['attributes']=_0x1cba82[_0xf621('0x3a')][_0xf621('0x4b')]?_0x1cba82[_0xf621('0x3a')]:_0x11957a['model'];_0x1cba82['order']=qs[_0xf621('0x3d')](_0x2a16ac[_0xf621('0x37')][_0xf621('0x3d')]);_0x1cba82['where']=qs[_0xf621('0x38')](_[_0xf621('0x3f')](_0x2a16ac['query'],_0x11957a[_0xf621('0x38')]));if(_0x2a16ac[_0xf621('0x37')][_0xf621('0x40')]){_0x1cba82['where']=_['merge'](_0x1cba82[_0xf621('0x3e')],{'$or':_[_0xf621('0x31')](_0x1cba82['attributes'],function(_0x204251){var _0x85ce1={};_0x85ce1[_0x204251]={'$like':'%'+_0x2a16ac[_0xf621('0x37')]['filter']+'%'};return _0x85ce1;})});}_0x1cba82=_[_0xf621('0x42')]({},_0x1cba82,_0x2a16ac[_0xf621('0x7b')]);return _0x77f893[_0xf621('0x78')](_0x1cba82);}})[_0xf621('0x2b')](function(_0x435156){if(_0x435156){_0x5e02c2=_0x435156[_0xf621('0x4b')];if(!_0x2a16ac[_0xf621('0x37')]['hasOwnProperty']('nolimit')){_0x1cba82[_0xf621('0x23')]=qs[_0xf621('0x23')](_0x2a16ac['query']['limit']);_0x1cba82[_0xf621('0x22')]=qs[_0xf621('0x22')](_0x2a16ac['query'][_0xf621('0x22')]);}return _0x77f893[_0xf621('0x78')](_0x1cba82);}})[_0xf621('0x2b')](function(_0x53b391){if(_0x53b391){return _0x53b391?{'count':_0x5e02c2,'rows':_0x53b391}:null;}})[_0xf621('0x2b')](respondWithResult(_0x460a69,null))[_0xf621('0x47')](handleError(_0x460a69,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index ab6e710..2a0bed3 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 _0x70e0=['emit','events','../../mysqldb','VoicePrefix','update','remove'];(function(_0x500729,_0x32ed4a){var _0x2d2ab4=function(_0x2ff344){while(--_0x2ff344){_0x500729['push'](_0x500729['shift']());}};_0x2d2ab4(++_0x32ed4a);}(_0x70e0,0x17b));var _0x070e=function(_0x54111a,_0x54e5fc){_0x54111a=_0x54111a-0x0;var _0x459795=_0x70e0[_0x54111a];return _0x459795;};'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 +var _0x70e0=['emit','events','../../mysqldb','VoicePrefix','update','remove'];(function(_0x2e859e,_0x3eccc2){var _0x12fa65=function(_0x14c6aa){while(--_0x14c6aa){_0x2e859e['push'](_0x2e859e['shift']());}};_0x12fa65(++_0x3eccc2);}(_0x70e0,0x17b));var _0x070e=function(_0x1db5b6,_0x3e0c17){_0x1db5b6=_0x1db5b6-0x0;var _0x104a7=_0x70e0[_0x1db5b6];return _0x104a7;};'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 ff8e86d..01875e4 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 _0x16f0=['VoicePrefix','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','exports','define'];(function(_0x1c4769,_0x200259){var _0x2883f7=function(_0x5a41be){while(--_0x5a41be){_0x1c4769['push'](_0x1c4769['shift']());}};_0x2883f7(++_0x200259);}(_0x16f0,0x140));var _0x016f=function(_0x456623,_0x1dda69){_0x456623=_0x456623-0x0;var _0x572cfd=_0x16f0[_0x456623];return _0x572cfd;};'use strict';var _=require(_0x016f('0x0'));var util=require(_0x016f('0x1'));var logger=require(_0x016f('0x2'))(_0x016f('0x3'));var moment=require(_0x016f('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x016f('0x5'));var rimraf=require(_0x016f('0x6'));var config=require(_0x016f('0x7'));var attributes=require('./voicePrefix.attributes');module[_0x016f('0x8')]=function(_0x340660,_0x2cab74){return _0x340660[_0x016f('0x9')](_0x016f('0xa'),attributes,{'tableName':'voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0cd7=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voicePrefix.attributes','exports','voice_prefixes','lodash'];(function(_0x9eee6a,_0x2b9b74){var _0x467be5=function(_0x5748fa){while(--_0x5748fa){_0x9eee6a['push'](_0x9eee6a['shift']());}};_0x467be5(++_0x2b9b74);}(_0x0cd7,0xfb));var _0x70cd=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x0cd7[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x70cd('0x0'));var util=require('util');var logger=require(_0x70cd('0x1'))(_0x70cd('0x2'));var moment=require(_0x70cd('0x3'));var BPromise=require(_0x70cd('0x4'));var rp=require(_0x70cd('0x5'));var fs=require('fs');var path=require(_0x70cd('0x6'));var rimraf=require(_0x70cd('0x7'));var config=require(_0x70cd('0x8'));var attributes=require(_0x70cd('0x9'));module[_0x70cd('0xa')]=function(_0x243fc5,_0x20365c){return _0x243fc5['define']('VoicePrefix',attributes,{'tableName':_0x70cd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.rpc.js b/server/api/voicePrefix/voicePrefix.rpc.js index ccc8f95..a71b529 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 _0x0c6c=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','redis','defaults','localhost','register','request','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0c6c,0x1e2));var _0xc0c6=function(_0x15b298,_0x5bd763){_0x15b298=_0x15b298-0x0;var _0x301ee4=_0x0c6c[_0x15b298];return _0x301ee4;};'use strict';var _=require(_0xc0c6('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc0c6('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc0c6('0x2'));var db=require(_0xc0c6('0x3'))['db'];var utils=require(_0xc0c6('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xc0c6('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xc0c6('0x6')][_0xc0c6('0x7')]({'port':0x232a});config[_0xc0c6('0x8')]=_[_0xc0c6('0x9')](config[_0xc0c6('0x8')],{'host':_0xc0c6('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./voicePrefix.socket')[_0xc0c6('0xb')](socket);function respondWithRpcPromise(_0x324aea,_0x38eeac,_0x2266ae){return new BPromise(function(_0x52e7d7,_0x5547cd){return client[_0xc0c6('0xc')](_0x324aea,_0x2266ae)['then'](function(_0x3617b7){logger[_0xc0c6('0xd')](_0xc0c6('0xe'),_0x38eeac,_0xc0c6('0xf'));logger[_0xc0c6('0x10')](_0xc0c6('0x11'),_0x38eeac,_0xc0c6('0xf'),JSON['stringify'](_0x3617b7));if(_0x3617b7[_0xc0c6('0x12')]){if(_0x3617b7[_0xc0c6('0x12')][_0xc0c6('0x13')]===0x1f4){logger[_0xc0c6('0x12')](_0xc0c6('0xe'),_0x38eeac,_0x3617b7[_0xc0c6('0x12')][_0xc0c6('0x14')]);return _0x5547cd(_0x3617b7[_0xc0c6('0x12')][_0xc0c6('0x14')]);}logger['error'](_0xc0c6('0xe'),_0x38eeac,_0x3617b7['error'][_0xc0c6('0x14')]);return _0x52e7d7(_0x3617b7[_0xc0c6('0x12')][_0xc0c6('0x14')]);}else{logger[_0xc0c6('0xd')](_0xc0c6('0xe'),_0x38eeac,'request\x20sent');_0x52e7d7(_0x3617b7[_0xc0c6('0x15')][_0xc0c6('0x14')]);}})[_0xc0c6('0x16')](function(_0x570973){logger[_0xc0c6('0x12')](_0xc0c6('0xe'),_0x38eeac,_0x570973);_0x5547cd(_0x570973);});});} \ No newline at end of file +var _0xf6ff=['./voicePrefix.socket','then','VoicePrefix,\x20%s,\x20%s','stringify','code','error','message','info','request\x20sent','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','http','redis','defaults','socket.io-emitter'];(function(_0x86f6fc,_0x15bf8a){var _0x3580dc=function(_0x44f332){while(--_0x44f332){_0x86f6fc['push'](_0x86f6fc['shift']());}};_0x3580dc(++_0x15bf8a);}(_0xf6ff,0x11b));var _0xff6f=function(_0x3f3c24,_0x3d1dd6){_0x3f3c24=_0x3f3c24-0x0;var _0x3c7cf7=_0xf6ff[_0x3f3c24];return _0x3c7cf7;};'use strict';var _=require(_0xff6f('0x0'));var util=require(_0xff6f('0x1'));var moment=require('moment');var BPromise=require(_0xff6f('0x2'));var rs=require(_0xff6f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xff6f('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xff6f('0x5'))('rpc');var config=require(_0xff6f('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0xff6f('0x7')]({'port':0x232a});config[_0xff6f('0x8')]=_[_0xff6f('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xff6f('0xa'))(new Redis(config[_0xff6f('0x8')]));require(_0xff6f('0xb'))['register'](socket);function respondWithRpcPromise(_0x43294e,_0x2acb45,_0x4b6c9d){return new BPromise(function(_0x2a5e85,_0x32e636){return client['request'](_0x43294e,_0x4b6c9d)[_0xff6f('0xc')](function(_0x399ceb){logger['info'](_0xff6f('0xd'),_0x2acb45,'request\x20sent');logger['debug']('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x2acb45,'request\x20sent',JSON[_0xff6f('0xe')](_0x399ceb));if(_0x399ceb['error']){if(_0x399ceb['error'][_0xff6f('0xf')]===0x1f4){logger['error']('VoicePrefix,\x20%s,\x20%s',_0x2acb45,_0x399ceb[_0xff6f('0x10')][_0xff6f('0x11')]);return _0x32e636(_0x399ceb[_0xff6f('0x10')][_0xff6f('0x11')]);}logger[_0xff6f('0x10')]('VoicePrefix,\x20%s,\x20%s',_0x2acb45,_0x399ceb['error'][_0xff6f('0x11')]);return _0x2a5e85(_0x399ceb[_0xff6f('0x10')][_0xff6f('0x11')]);}else{logger[_0xff6f('0x12')](_0xff6f('0xd'),_0x2acb45,_0xff6f('0x13'));_0x2a5e85(_0x399ceb['result'][_0xff6f('0x11')]);}})[_0xff6f('0x14')](function(_0x194c22){logger[_0xff6f('0x10')](_0xff6f('0xd'),_0x2acb45,_0x194c22);_0x32e636(_0x194c22);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 707ece6..af9f16b 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 _0x1d1b=['emit','register','./voicePrefix.events','save','remove','update'];(function(_0x3d9d2b,_0x386063){var _0x8838cb=function(_0xb97187){while(--_0xb97187){_0x3d9d2b['push'](_0x3d9d2b['shift']());}};_0x8838cb(++_0x386063);}(_0x1d1b,0x74));var _0xb1d1=function(_0x1c59ca,_0x30a4b3){_0x1c59ca=_0x1c59ca-0x0;var _0x46d95f=_0x1d1b[_0x1c59ca];return _0x46d95f;};'use strict';var VoicePrefixEvents=require(_0xb1d1('0x0'));var events=[_0xb1d1('0x1'),_0xb1d1('0x2'),_0xb1d1('0x3')];function createListener(_0x5d2b26,_0x259a48){return function(_0x4d6bdd){_0x259a48[_0xb1d1('0x4')](_0x5d2b26,_0x4d6bdd);};}function removeListener(_0x51cf9c,_0x296ff5){return function(){VoicePrefixEvents['removeListener'](_0x51cf9c,_0x296ff5);};}exports[_0xb1d1('0x5')]=function(_0x53a031){for(var _0x340fd3=0x0,_0x230281=events['length'];_0x340fd3<_0x230281;_0x340fd3++){var _0x419689=events[_0x340fd3];var _0x2eec28=createListener('voicePrefix:'+_0x419689,_0x53a031);VoicePrefixEvents['on'](_0x419689,_0x2eec28);}}; \ No newline at end of file +var _0x894f=['update','emit','removeListener','register','length','voicePrefix:','save'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x894f,0x13a));var _0xf894=function(_0x53a11f,_0x2e82d4){_0x53a11f=_0x53a11f-0x0;var _0x2d3369=_0x894f[_0x53a11f];return _0x2d3369;};'use strict';var VoicePrefixEvents=require('./voicePrefix.events');var events=[_0xf894('0x0'),'remove',_0xf894('0x1')];function createListener(_0x35900e,_0x5bc31f){return function(_0x36da9e){_0x5bc31f[_0xf894('0x2')](_0x35900e,_0x36da9e);};}function removeListener(_0x398f82,_0x3f1f60){return function(){VoicePrefixEvents[_0xf894('0x3')](_0x398f82,_0x3f1f60);};}exports[_0xf894('0x4')]=function(_0x577e5b){for(var _0x532189=0x0,_0x30197d=events[_0xf894('0x5')];_0x532189<_0x30197d;_0x532189++){var _0x50c71c=events[_0x532189];var _0x1f6dac=createListener(_0xf894('0x6')+_0x50c71c,_0x577e5b);VoicePrefixEvents['on'](_0x50c71c,_0x1f6dac);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 4febccb..c8366f4 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 _0x6889=['delete','removeTeams','removeLists','removeBlackLists','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','/:id','isAuthenticated','show','/:id/hoppers','getHoppers','getHopperHistories','/:id/hopper_finals','/:id/hopper_black','/:id/teams','getTeams','/:id/members','getMembers','/:id/lists','getLists','/:id/blacklists','getBlackLists','create','post','clone','addTeams','/:id/users','addAgents','addBlackLists','put','update'];(function(_0x68c979,_0x431cff){var _0x4f0001=function(_0xa7595d){while(--_0xa7595d){_0x68c979['push'](_0x68c979['shift']());}};_0x4f0001(++_0x431cff);}(_0x6889,0xa0));var _0x9688=function(_0x1af05b,_0x5134b5){_0x1af05b=_0x1af05b-0x0;var _0x5be7cc=_0x6889[_0x1af05b];return _0x5be7cc;};'use strict';var multer=require(_0x9688('0x0'));var util=require(_0x9688('0x1'));var path=require(_0x9688('0x2'));var timeout=require(_0x9688('0x3'));var express=require('express');var router=express[_0x9688('0x4')]();var auth=require(_0x9688('0x5'));var interaction=require(_0x9688('0x6'));var config=require(_0x9688('0x7'));var controller=require(_0x9688('0x8'));router[_0x9688('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x9688('0x9')](_0x9688('0xa'),auth[_0x9688('0xb')](),controller[_0x9688('0xc')]);router['get'](_0x9688('0xd'),auth[_0x9688('0xb')](),controller[_0x9688('0xe')]);router[_0x9688('0x9')]('/:id/hopper_histories',auth['isAuthenticated'](),controller[_0x9688('0xf')]);router[_0x9688('0x9')](_0x9688('0x10'),auth[_0x9688('0xb')](),controller['getHopperFinals']);router['get'](_0x9688('0x11'),auth[_0x9688('0xb')](),controller['getHopperBlacks']);router[_0x9688('0x9')](_0x9688('0x12'),auth['isAuthenticated'](),controller[_0x9688('0x13')]);router[_0x9688('0x9')]('/:id/users',auth['isAuthenticated'](),controller['getAgents']);router['get'](_0x9688('0x14'),auth['isAuthenticated'](),controller[_0x9688('0x15')]);router[_0x9688('0x9')](_0x9688('0x16'),auth['isAuthenticated'](),controller[_0x9688('0x17')]);router['get'](_0x9688('0x18'),auth[_0x9688('0xb')](),controller[_0x9688('0x19')]);router['post']('/',auth[_0x9688('0xb')](),controller[_0x9688('0x1a')]);router[_0x9688('0x1b')]('/:id/clone',auth[_0x9688('0xb')](),controller[_0x9688('0x1c')]);router[_0x9688('0x1b')](_0x9688('0x12'),auth[_0x9688('0xb')](),controller[_0x9688('0x1d')]);router[_0x9688('0x1b')](_0x9688('0x1e'),auth[_0x9688('0xb')](),controller[_0x9688('0x1f')]);router[_0x9688('0x1b')](_0x9688('0x16'),auth[_0x9688('0xb')](),controller['addLists']);router[_0x9688('0x1b')](_0x9688('0x18'),auth[_0x9688('0xb')](),controller[_0x9688('0x20')]);router[_0x9688('0x21')]('/:id',auth[_0x9688('0xb')](),controller[_0x9688('0x22')]);router[_0x9688('0x23')](_0x9688('0xa'),auth[_0x9688('0xb')](),controller['destroy']);router[_0x9688('0x23')](_0x9688('0x12'),auth[_0x9688('0xb')](),controller[_0x9688('0x24')]);router[_0x9688('0x23')](_0x9688('0x1e'),auth['isAuthenticated'](),controller['removeAgents']);router[_0x9688('0x23')](_0x9688('0x16'),auth[_0x9688('0xb')](),controller[_0x9688('0x25')]);router[_0x9688('0x23')](_0x9688('0x18'),auth[_0x9688('0xb')](),controller[_0x9688('0x26')]);module['exports']=router; \ No newline at end of file +var _0xab09=['addAgents','addBlackLists','delete','destroy','removeTeams','removeAgents','removeBlackLists','multer','path','connect-timeout','express','../../components/auth/service','../../config/environment','./voiceQueue.controller','get','isAuthenticated','index','/:id','show','/:id/hoppers','getHoppers','getHopperHistories','/:id/hopper_finals','getHopperFinals','getHopperBlacks','getTeams','/:id/users','getAgents','getMembers','/:id/lists','getLists','/:id/blacklists','getBlackLists','create','post','/:id/clone','clone','/:id/teams'];(function(_0x1c8b61,_0x3c9532){var _0x43511f=function(_0x32339a){while(--_0x32339a){_0x1c8b61['push'](_0x1c8b61['shift']());}};_0x43511f(++_0x3c9532);}(_0xab09,0x1cf));var _0x9ab0=function(_0x4b33ff,_0x34193c){_0x4b33ff=_0x4b33ff-0x0;var _0x24c2f7=_0xab09[_0x4b33ff];return _0x24c2f7;};'use strict';var multer=require(_0x9ab0('0x0'));var util=require('util');var path=require(_0x9ab0('0x1'));var timeout=require(_0x9ab0('0x2'));var express=require(_0x9ab0('0x3'));var router=express['Router']();var auth=require(_0x9ab0('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x9ab0('0x5'));var controller=require(_0x9ab0('0x6'));router[_0x9ab0('0x7')]('/',auth[_0x9ab0('0x8')](),controller[_0x9ab0('0x9')]);router['get'](_0x9ab0('0xa'),auth[_0x9ab0('0x8')](),controller[_0x9ab0('0xb')]);router[_0x9ab0('0x7')](_0x9ab0('0xc'),auth[_0x9ab0('0x8')](),controller[_0x9ab0('0xd')]);router['get']('/:id/hopper_histories',auth[_0x9ab0('0x8')](),controller[_0x9ab0('0xe')]);router[_0x9ab0('0x7')](_0x9ab0('0xf'),auth['isAuthenticated'](),controller[_0x9ab0('0x10')]);router[_0x9ab0('0x7')]('/:id/hopper_black',auth['isAuthenticated'](),controller[_0x9ab0('0x11')]);router[_0x9ab0('0x7')]('/:id/teams',auth[_0x9ab0('0x8')](),controller[_0x9ab0('0x12')]);router[_0x9ab0('0x7')](_0x9ab0('0x13'),auth[_0x9ab0('0x8')](),controller[_0x9ab0('0x14')]);router['get']('/:id/members',auth[_0x9ab0('0x8')](),controller[_0x9ab0('0x15')]);router['get'](_0x9ab0('0x16'),auth[_0x9ab0('0x8')](),controller[_0x9ab0('0x17')]);router['get'](_0x9ab0('0x18'),auth['isAuthenticated'](),controller[_0x9ab0('0x19')]);router['post']('/',auth[_0x9ab0('0x8')](),controller[_0x9ab0('0x1a')]);router[_0x9ab0('0x1b')](_0x9ab0('0x1c'),auth[_0x9ab0('0x8')](),controller[_0x9ab0('0x1d')]);router['post'](_0x9ab0('0x1e'),auth['isAuthenticated'](),controller['addTeams']);router[_0x9ab0('0x1b')]('/:id/users',auth[_0x9ab0('0x8')](),controller[_0x9ab0('0x1f')]);router[_0x9ab0('0x1b')](_0x9ab0('0x16'),auth[_0x9ab0('0x8')](),controller['addLists']);router['post'](_0x9ab0('0x18'),auth[_0x9ab0('0x8')](),controller[_0x9ab0('0x20')]);router['put']('/:id',auth[_0x9ab0('0x8')](),controller['update']);router[_0x9ab0('0x21')](_0x9ab0('0xa'),auth[_0x9ab0('0x8')](),controller[_0x9ab0('0x22')]);router['delete'](_0x9ab0('0x1e'),auth[_0x9ab0('0x8')](),controller[_0x9ab0('0x23')]);router['delete']('/:id/users',auth[_0x9ab0('0x8')](),controller[_0x9ab0('0x24')]);router[_0x9ab0('0x21')](_0x9ab0('0x16'),auth[_0x9ab0('0x8')](),controller['removeLists']);router['delete'](_0x9ab0('0x18'),auth[_0x9ab0('0x8')](),controller[_0x9ab0('0x25')]);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 df485be..dd288ad 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(_0x1cd7f1,_0x44236f){var _0x5adfde=function(_0x409537){while(--_0x409537){_0x1cd7f1['push'](_0x1cd7f1['shift']());}};_0x5adfde(++_0x44236f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xa9e0[_0x4bfac3];return _0x15f0f2;};'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(_0x3c81b5,_0x3f5ed7){var _0x5888c4=function(_0x4e65b0){while(--_0x4e65b0){_0x3c81b5['push'](_0x3c81b5['shift']());}};_0x5888c4(++_0x3f5ed7);}(_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 diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index db935ac..7b50076 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 _0x952a=['CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','addTeams','User','Agents','voicePause','forEach','penalty','sequelize','transaction','UserVoiceQueue','findOrCreate','each','upsert','isNil','interface','format','SIP/%s','emit','userVoiceQueue:save','removeTeams','Team','ids','select','field','tq.TeamId','from','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','push','QueryTypes','SELECT','every','TeamId','includes','all','compact','isEmpty','removeAgents','UserVoiceQueueRt','userVoiceQueue:remove','addAgents','isArray','getAgents','getMembers','getLists','CmList','addLists','spread','dialCheckDuplicateType','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','NOW()','CmListId','toString','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','VoiceQueueId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen','cm_contacts','insert','deletedAt\x20IS\x20NULL','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./voiceQueue.socket','register','sendStatus','status','json','count','offset','Content-Range','reject','save','update','then','destroy','get','VoiceQueues','QueueCampaigns','outbound','filter','ignore','value','type','find','name','UserProfileResource','end','error','stack','map','VoiceQueue','rawAttributes','fieldName','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','filters','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','inbound','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','omit','body','createdAt','updatedAt','getHoppers','findOne','CmHopper','VoiceQueueId','getHopperHistories','CmHopperHistory','nolimit','getHopperFinals'];(function(_0x8e8578,_0xd2a6b5){var _0x279605=function(_0x4b0347){while(--_0x4b0347){_0x8e8578['push'](_0x8e8578['shift']());}};_0x279605(++_0xd2a6b5);}(_0x952a,0x107));var _0xa952=function(_0xe834ca,_0xc7f251){_0xe834ca=_0xe834ca-0x0;var _0x5a3d76=_0x952a[_0xe834ca];return _0x5a3d76;};'use strict';var pdf=require(_0xa952('0x0'));var emlformat=require(_0xa952('0x1'));var rimraf=require(_0xa952('0x2'));var zipdir=require(_0xa952('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa952('0x4'));var moment=require('moment');var BPromise=require(_0xa952('0x5'));var Mustache=require(_0xa952('0x6'));var util=require(_0xa952('0x7'));var path=require(_0xa952('0x8'));var sox=require(_0xa952('0x9'));var csv=require(_0xa952('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xa952('0xb'));var squel=require(_0xa952('0xc'));var crypto=require(_0xa952('0xd'));var jsforce=require(_0xa952('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xa952('0xa'));var querystring=require(_0xa952('0xf'));var Papa=require(_0xa952('0x10'));var Redis=require('ioredis');var authService=require(_0xa952('0x11'));var qs=require(_0xa952('0x12'));var as=require(_0xa952('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa952('0x14'))(_0xa952('0x15'));var utils=require('../../config/utils');var config=require(_0xa952('0x16'));var db=require(_0xa952('0x17'))['db'];config[_0xa952('0x18')]=_['defaults'](config[_0xa952('0x18')],{'host':_0xa952('0x19'),'port':0x18eb});var socket=require(_0xa952('0x1a'))(new Redis(config['redis']));require(_0xa952('0x1b'))[_0xa952('0x1c')](socket);function respondWithStatusCode(_0x275f1e,_0x5dc5da){_0x5dc5da=_0x5dc5da||0xcc;return function(_0x569a92){if(_0x569a92){return _0x275f1e[_0xa952('0x1d')](_0x5dc5da);}return _0x275f1e['status'](_0x5dc5da)['end']();};}function respondWithResult(_0x231489,_0x4414ef){_0x4414ef=_0x4414ef||0xc8;return function(_0x2b7746){if(_0x2b7746){return _0x231489[_0xa952('0x1e')](_0x4414ef)[_0xa952('0x1f')](_0x2b7746);}};}function respondWithFilteredResult(_0xee10c5,_0x4098cf){return function(_0x34667f){if(_0x34667f){var _0x3166cb=_0x34667f[_0xa952('0x20')],_0x1e32d8=_0x4098cf[_0xa952('0x21')],_0x367d92=_0x4098cf[_0xa952('0x21')]+_0x4098cf['limit'],_0xd086e0;if(_0x367d92>=_0x3166cb){_0x367d92=_0x3166cb;_0xd086e0=0xc8;}else{_0xd086e0=0xce;}_0xee10c5[_0xa952('0x1e')](_0xd086e0);return _0xee10c5['set'](_0xa952('0x22'),_0x1e32d8+'-'+_0x367d92+'/'+_0x3166cb)['json'](_0x34667f);}return null;};}function patchUpdates(_0x480a2a){return function(_0xdac3c7){try{jsonpatch['apply'](_0xdac3c7,_0x480a2a,!![]);}catch(_0x125140){return BPromise[_0xa952('0x23')](_0x125140);}return _0xdac3c7[_0xa952('0x24')]();};}function saveUpdates(_0x318d0f,_0x74455b){return function(_0xc282a){if(_0xc282a){return _0xc282a[_0xa952('0x25')](_0x318d0f)[_0xa952('0x26')](function(_0x4f1325){return _0x4f1325;});}return null;};}function removeEntity(_0x575760,_0x35cfc4){return function(_0x348548){if(_0x348548){return _0x348548[_0xa952('0x27')]()[_0xa952('0x26')](function(){var _0x265e38=_0x348548[_0xa952('0x28')]({'plain':!![]});var _0x40fc6c=[{'name':_0xa952('0x29'),'value':'inbound','ignore':![]},{'name':_0xa952('0x2a'),'value':_0xa952('0x2b'),'ignore':![]}];var _0x18cfb1=_(_0x40fc6c)[_0xa952('0x2c')](_0xa952('0x2d'))['map'](_0xa952('0x2e'))[_0xa952('0x2e')]();if(_['includes'](_0x18cfb1,_0x265e38[_0xa952('0x2f')])){return;}var _0x5a6b92=_[_0xa952('0x30')](_0x40fc6c,[_0xa952('0x2e'),_0x265e38[_0xa952('0x2f')]])[_0xa952('0x31')];return db[_0xa952('0x32')][_0xa952('0x27')]({'where':{'type':_0x5a6b92,'resourceId':_0x265e38['id']}})[_0xa952('0x26')](function(){return _0x348548;});})['then'](function(){_0x575760['status'](0xcc)[_0xa952('0x33')]();});}};}function handleEntityNotFound(_0x4ba64e,_0xbf4128){return function(_0x2cabd1){if(!_0x2cabd1){_0x4ba64e[_0xa952('0x1d')](0x194);}return _0x2cabd1;};}function handleError(_0x4d4ee3,_0x2ed7a2){_0x2ed7a2=_0x2ed7a2||0x1f4;return function(_0xeb2462){logger[_0xa952('0x34')](_0xeb2462[_0xa952('0x35')]);if(_0xeb2462['name']){delete _0xeb2462[_0xa952('0x31')];}_0x4d4ee3[_0xa952('0x1e')](_0x2ed7a2)['send'](_0xeb2462);};}exports['index']=function(_0x362a5c,_0x1505b2){var _0x36f2cb={},_0x4779d9={},_0x877019={'count':0x0,'rows':[]};var _0xbadfb1=_[_0xa952('0x36')](db[_0xa952('0x37')][_0xa952('0x38')],function(_0x22ffcb){return{'name':_0x22ffcb[_0xa952('0x39')],'type':_0x22ffcb['type'][_0xa952('0x3a')]};});_0x4779d9[_0xa952('0x3b')]=_[_0xa952('0x36')](_0xbadfb1,'name');_0x4779d9['query']=_[_0xa952('0x3c')](_0x362a5c[_0xa952('0x3d')]);_0x4779d9['filters']=_[_0xa952('0x3e')](_0x4779d9[_0xa952('0x3b')],_0x4779d9[_0xa952('0x3d')]);_0x36f2cb[_0xa952('0x3f')]=_[_0xa952('0x3e')](_0x4779d9[_0xa952('0x3b')],qs[_0xa952('0x40')](_0x362a5c[_0xa952('0x3d')]['fields']));_0x36f2cb[_0xa952('0x3f')]=_0x36f2cb[_0xa952('0x3f')][_0xa952('0x41')]?_0x36f2cb[_0xa952('0x3f')]:_0x4779d9[_0xa952('0x3b')];if(!_0x362a5c[_0xa952('0x3d')][_0xa952('0x42')]('nolimit')){_0x36f2cb[_0xa952('0x43')]=qs[_0xa952('0x43')](_0x362a5c[_0xa952('0x3d')][_0xa952('0x43')]);_0x36f2cb[_0xa952('0x21')]=qs[_0xa952('0x21')](_0x362a5c['query']['offset']);}_0x36f2cb[_0xa952('0x44')]=qs['sort'](_0x362a5c[_0xa952('0x3d')][_0xa952('0x45')]);_0x36f2cb[_0xa952('0x46')]=qs[_0xa952('0x47')](_[_0xa952('0x48')](_0x362a5c[_0xa952('0x3d')],_0x4779d9[_0xa952('0x47')]),_0xbadfb1);if(_0x362a5c[_0xa952('0x3d')][_0xa952('0x2c')]){_0x36f2cb['where']=_[_0xa952('0x49')](_0x36f2cb['where'],{'$or':_['map'](_0xbadfb1,function(_0x541837){if(_0x541837[_0xa952('0x2f')]!==_0xa952('0x4a')){var _0x2a2c4b={};_0x2a2c4b[_0x541837[_0xa952('0x31')]]={'$like':'%'+_0x362a5c[_0xa952('0x3d')][_0xa952('0x2c')]+'%'};return _0x2a2c4b;}})});}_0x36f2cb=_['merge']({},_0x36f2cb,_0x362a5c[_0xa952('0x4b')]);var _0x2451cb={'where':_0x36f2cb['where']};return db[_0xa952('0x37')][_0xa952('0x20')](_0x2451cb)['then'](function(_0x425f59){_0x877019[_0xa952('0x20')]=_0x425f59;if(_0x362a5c['query'][_0xa952('0x4c')]){_0x36f2cb[_0xa952('0x4d')]=[{'all':!![]}];}return db[_0xa952('0x37')][_0xa952('0x4e')](_0x36f2cb);})[_0xa952('0x26')](function(_0x506c90){_0x877019[_0xa952('0x4f')]=_0x506c90;return _0x877019;})[_0xa952('0x26')](respondWithFilteredResult(_0x1505b2,_0x36f2cb))['catch'](handleError(_0x1505b2,null));};exports['show']=function(_0x43b1e0,_0x12ab12){var _0x4d49b9={'raw':![],'where':{'id':_0x43b1e0['params']['id']}},_0x52eb57={};_0x52eb57['model']=_[_0xa952('0x3c')](db[_0xa952('0x37')]['rawAttributes']);_0x52eb57[_0xa952('0x3d')]=_[_0xa952('0x3c')](_0x43b1e0['query']);_0x52eb57[_0xa952('0x47')]=_[_0xa952('0x3e')](_0x52eb57[_0xa952('0x3b')],_0x52eb57[_0xa952('0x3d')]);_0x4d49b9[_0xa952('0x3f')]=_[_0xa952('0x3e')](_0x52eb57['model'],qs[_0xa952('0x40')](_0x43b1e0[_0xa952('0x3d')][_0xa952('0x40')]));_0x4d49b9['attributes']=_0x4d49b9[_0xa952('0x3f')]['length']?_0x4d49b9[_0xa952('0x3f')]:_0x52eb57[_0xa952('0x3b')];if(_0x43b1e0[_0xa952('0x3d')][_0xa952('0x4c')]){_0x4d49b9[_0xa952('0x4d')]=[{'all':!![]}];}_0x4d49b9=_[_0xa952('0x49')]({},_0x4d49b9,_0x43b1e0[_0xa952('0x4b')]);return db[_0xa952('0x37')][_0xa952('0x30')](_0x4d49b9)[_0xa952('0x26')](handleEntityNotFound(_0x12ab12,null))[_0xa952('0x26')](respondWithResult(_0x12ab12,null))[_0xa952('0x50')](handleError(_0x12ab12,null));};exports[_0xa952('0x51')]=function(_0x3a1cb2,_0x2371f2){return db[_0xa952('0x37')][_0xa952('0x51')](_0x3a1cb2['body'],{})[_0xa952('0x26')](function(_0xac9127){var _0x53d2a3=_0x3a1cb2['user'][_0xa952('0x28')]({'plain':!![]});if(!_0x53d2a3)throw new Error(_0xa952('0x52'));if(_0x53d2a3[_0xa952('0x53')]===_0xa952('0x54')){var _0x40cf34=_0xac9127[_0xa952('0x28')]({'plain':!![]});var _0x4065af=[{'name':_0xa952('0x29'),'value':_0xa952('0x55')},{'name':_0xa952('0x2a'),'value':_0xa952('0x2b')}];var _0xc8c502=_['find'](_0x4065af,[_0xa952('0x2e'),_0x40cf34['type']])[_0xa952('0x31')];return db[_0xa952('0x56')]['find']({'where':{'name':_0xc8c502,'userProfileId':_0x53d2a3[_0xa952('0x57')]},'raw':!![]})[_0xa952('0x26')](function(_0x1ed124){if(_0x1ed124&&_0x1ed124[_0xa952('0x58')]===0x0){return db['UserProfileResource'][_0xa952('0x51')]({'name':_0x40cf34[_0xa952('0x31')],'resourceId':_0x40cf34['id'],'type':_0x1ed124[_0xa952('0x31')],'sectionId':_0x1ed124['id']},{})['then'](function(){return _0xac9127;});}else{return _0xac9127;}})[_0xa952('0x50')](function(_0x4515e9){logger[_0xa952('0x34')](_0xa952('0x59'),_0x4515e9);throw _0x4515e9;});}return _0xac9127;})[_0xa952('0x26')](respondWithResult(_0x2371f2,0xc9))[_0xa952('0x50')](handleError(_0x2371f2,null));};exports['clone']=function(_0xd03d70,_0x5bf1a2){var _0x260f9c={'where':{'id':_0xd03d70[_0xa952('0x5a')]['id']}},_0x1df0a3={};_0x1df0a3[_0xa952('0x3b')]=_[_0xa952('0x3c')](db[_0xa952('0x37')][_0xa952('0x38')]);_0x260f9c['attributes']=_[_0xa952('0x3e')](_0x1df0a3[_0xa952('0x3b')],qs['fields'](_0xd03d70[_0xa952('0x3d')][_0xa952('0x40')]));_0x260f9c[_0xa952('0x3f')]=_0x260f9c[_0xa952('0x3f')][_0xa952('0x41')]?_0x260f9c[_0xa952('0x3f')]:_0x1df0a3[_0xa952('0x3b')];if(_0xd03d70[_0xa952('0x3d')][_0xa952('0x4c')]){_0x260f9c[_0xa952('0x4d')]=[{'all':!![]}];}_0x260f9c=_[_0xa952('0x49')]({},_0x260f9c,_0xd03d70['options']);return db[_0xa952('0x37')][_0xa952('0x30')](_0x260f9c)['then'](handleEntityNotFound(_0x5bf1a2,null))[_0xa952('0x26')](function(_0x1503bb){if(_0x1503bb){var _0x3537f9=_0x1503bb[_0xa952('0x28')]({'plain':!![]});_0x3537f9=qs[_0xa952('0x5b')](_0x3537f9,['id','createdAt','updatedAt']);_0xd03d70[_0xa952('0x5c')]=_[_0xa952('0x5b')](_0xd03d70[_0xa952('0x5c')],['id',_0xa952('0x5d'),_0xa952('0x5e')]);return db[_0xa952('0x37')][_0xa952('0x51')](_[_0xa952('0x49')](_0x3537f9,_0xd03d70[_0xa952('0x5c')]),{'include':_0xd03d70[_0xa952('0x3d')][_0xa952('0x4c')]?[{'all':!![]}]:undefined})['then'](function(_0x4a913f){var _0x1a1801=_0xd03d70[_0xa952('0x54')][_0xa952('0x28')]({'plain':!![]});if(!_0x1a1801)throw new Error(_0xa952('0x52'));if(_0x1a1801['role']===_0xa952('0x54')){var _0x2bd77b=_0x4a913f[_0xa952('0x28')]({'plain':!![]});var _0x4ee731=[{'name':_0xa952('0x29'),'value':'inbound'},{'name':_0xa952('0x2a'),'value':_0xa952('0x2b')}];var _0x4f2be1=_[_0xa952('0x30')](_0x4ee731,[_0xa952('0x2e'),_0x2bd77b[_0xa952('0x2f')]])[_0xa952('0x31')];return db['UserProfileSection'][_0xa952('0x30')]({'where':{'name':_0x4f2be1,'userProfileId':_0x1a1801['userProfileId']},'raw':!![]})[_0xa952('0x26')](function(_0x3f8e5e){if(_0x3f8e5e&&_0x3f8e5e[_0xa952('0x58')]===0x0){return db['UserProfileResource'][_0xa952('0x51')]({'name':_0x2bd77b[_0xa952('0x31')],'resourceId':_0x2bd77b['id'],'type':_0x3f8e5e[_0xa952('0x31')],'sectionId':_0x3f8e5e['id']},{})['then'](function(){return _0x4a913f;});}else{return _0x4a913f;}})[_0xa952('0x50')](function(_0x4d5bb2){logger[_0xa952('0x34')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4d5bb2);throw _0x4d5bb2;});}return _0x4a913f;});}})[_0xa952('0x26')](respondWithResult(_0x5bf1a2,0xc9))[_0xa952('0x50')](handleError(_0x5bf1a2,null));};exports[_0xa952('0x25')]=function(_0x1b5eb3,_0x5562d3){if(_0x1b5eb3[_0xa952('0x5c')]['id']){delete _0x1b5eb3['body']['id'];}return db[_0xa952('0x37')][_0xa952('0x30')]({'where':{'id':_0x1b5eb3[_0xa952('0x5a')]['id']}})[_0xa952('0x26')](handleEntityNotFound(_0x5562d3,null))[_0xa952('0x26')](saveUpdates(_0x1b5eb3[_0xa952('0x5c')],null))[_0xa952('0x26')](respondWithResult(_0x5562d3,null))['catch'](handleError(_0x5562d3,null));};exports[_0xa952('0x27')]=function(_0xd35938,_0x306645){return db[_0xa952('0x37')][_0xa952('0x30')]({'where':{'id':_0xd35938[_0xa952('0x5a')]['id']}})['then'](handleEntityNotFound(_0x306645,null))[_0xa952('0x26')](removeEntity(_0x306645,null))[_0xa952('0x50')](handleError(_0x306645,null));};exports[_0xa952('0x5f')]=function(_0x4c5762,_0x258f1c,_0x1e12a8){var _0x2ee96c={'raw':![],'where':{}};var _0x26f891={};var _0x18b8b2={'count':0x0,'rows':[]};return db[_0xa952('0x37')][_0xa952('0x60')]({'where':{'id':_0x4c5762[_0xa952('0x5a')]['id']}})[_0xa952('0x26')](handleEntityNotFound(_0x258f1c,null))[_0xa952('0x26')](function(_0x147640){if(_0x147640){_0x26f891[_0xa952('0x3b')]=_[_0xa952('0x3c')](db[_0xa952('0x61')][_0xa952('0x38')]);_0x26f891[_0xa952('0x3d')]=_[_0xa952('0x3c')](_0x4c5762[_0xa952('0x3d')]);_0x26f891[_0xa952('0x47')]=_[_0xa952('0x3e')](_0x26f891[_0xa952('0x3b')],_0x26f891['query']);_0x2ee96c['attributes']=_[_0xa952('0x3e')](_0x26f891['model'],qs[_0xa952('0x40')](_0x4c5762[_0xa952('0x3d')][_0xa952('0x40')]));_0x2ee96c[_0xa952('0x3f')]=_0x2ee96c[_0xa952('0x3f')][_0xa952('0x41')]?_0x2ee96c[_0xa952('0x3f')]:_0x26f891[_0xa952('0x3b')];if(!_0x4c5762[_0xa952('0x3d')]['hasOwnProperty']('nolimit')){_0x2ee96c[_0xa952('0x43')]=qs[_0xa952('0x43')](_0x4c5762[_0xa952('0x3d')]['limit']);_0x2ee96c['offset']=qs['offset'](_0x4c5762[_0xa952('0x3d')][_0xa952('0x21')]);}_0x2ee96c[_0xa952('0x44')]=qs[_0xa952('0x45')](_0x4c5762[_0xa952('0x3d')][_0xa952('0x45')]);_0x2ee96c[_0xa952('0x46')]=qs[_0xa952('0x47')](_[_0xa952('0x48')](_0x4c5762[_0xa952('0x3d')],_0x26f891[_0xa952('0x47')]));_0x2ee96c[_0xa952('0x46')][_0xa952('0x62')]=_0x147640['id'];if(_0x4c5762['query'][_0xa952('0x2c')]){_0x2ee96c[_0xa952('0x46')]=_[_0xa952('0x49')](_0x2ee96c[_0xa952('0x46')],{'$or':_[_0xa952('0x36')](_0x2ee96c[_0xa952('0x3f')],function(_0x511389){var _0x198982={};_0x198982[_0x511389]={'$like':'%'+_0x4c5762[_0xa952('0x3d')]['filter']+'%'};return _0x198982;})});}_0x2ee96c=_[_0xa952('0x49')]({},_0x2ee96c,_0x4c5762[_0xa952('0x4b')]);return db[_0xa952('0x61')][_0xa952('0x20')]({'where':_0x2ee96c[_0xa952('0x46')]})['then'](function(_0x8f4f32){_0x18b8b2[_0xa952('0x20')]=_0x8f4f32;if(_0x4c5762[_0xa952('0x3d')][_0xa952('0x4c')]){_0x2ee96c[_0xa952('0x4d')]=[{'all':!![]}];}return db[_0xa952('0x61')][_0xa952('0x4e')](_0x2ee96c);})[_0xa952('0x26')](function(_0x2434df){_0x18b8b2[_0xa952('0x4f')]=_0x2434df;return _0x18b8b2;});}})['then'](respondWithFilteredResult(_0x258f1c,_0x2ee96c))['catch'](handleError(_0x258f1c,null));};exports[_0xa952('0x63')]=function(_0x34e351,_0x337e5c,_0x11d75c){var _0x372195={'raw':!![],'where':{}};var _0x1a5538={};var _0x1e838c={'count':0x0,'rows':[]};return db[_0xa952('0x37')][_0xa952('0x60')]({'where':{'id':_0x34e351[_0xa952('0x5a')]['id']}})[_0xa952('0x26')](handleEntityNotFound(_0x337e5c,null))['then'](function(_0x1f5f60){if(_0x1f5f60){_0x1a5538[_0xa952('0x3b')]=_[_0xa952('0x3c')](db[_0xa952('0x64')][_0xa952('0x38')]);_0x1a5538['query']=_['keys'](_0x34e351[_0xa952('0x3d')]);_0x1a5538[_0xa952('0x47')]=_[_0xa952('0x3e')](_0x1a5538[_0xa952('0x3b')],_0x1a5538['query']);_0x372195[_0xa952('0x3f')]=_['intersection'](_0x1a5538['model'],qs[_0xa952('0x40')](_0x34e351['query'][_0xa952('0x40')]));_0x372195[_0xa952('0x3f')]=_0x372195[_0xa952('0x3f')][_0xa952('0x41')]?_0x372195[_0xa952('0x3f')]:_0x1a5538[_0xa952('0x3b')];if(!_0x34e351[_0xa952('0x3d')][_0xa952('0x42')](_0xa952('0x65'))){_0x372195[_0xa952('0x43')]=qs[_0xa952('0x43')](_0x34e351[_0xa952('0x3d')][_0xa952('0x43')]);_0x372195[_0xa952('0x21')]=qs[_0xa952('0x21')](_0x34e351[_0xa952('0x3d')][_0xa952('0x21')]);}_0x372195[_0xa952('0x44')]=qs['sort'](_0x34e351[_0xa952('0x3d')][_0xa952('0x45')]);_0x372195[_0xa952('0x46')]=qs[_0xa952('0x47')](_['pick'](_0x34e351[_0xa952('0x3d')],_0x1a5538[_0xa952('0x47')]));_0x372195[_0xa952('0x46')]['VoiceQueueId']=_0x1f5f60['id'];if(_0x34e351[_0xa952('0x3d')][_0xa952('0x2c')]){_0x372195['where']=_['merge'](_0x372195['where'],{'$or':_[_0xa952('0x36')](_0x372195[_0xa952('0x3f')],function(_0x497bc4){var _0x170f4d={};_0x170f4d[_0x497bc4]={'$like':'%'+_0x34e351[_0xa952('0x3d')][_0xa952('0x2c')]+'%'};return _0x170f4d;})});}_0x372195=_[_0xa952('0x49')]({},_0x372195,_0x34e351[_0xa952('0x4b')]);return db[_0xa952('0x64')]['count']({'where':_0x372195['where']})['then'](function(_0x5a868d){_0x1e838c[_0xa952('0x20')]=_0x5a868d;if(_0x34e351[_0xa952('0x3d')][_0xa952('0x4c')]){_0x372195[_0xa952('0x4d')]=[{'all':!![]}];}return db[_0xa952('0x64')][_0xa952('0x4e')](_0x372195);})[_0xa952('0x26')](function(_0x1c9ab3){_0x1e838c['rows']=_0x1c9ab3;return _0x1e838c;});}})[_0xa952('0x26')](respondWithFilteredResult(_0x337e5c,_0x372195))[_0xa952('0x50')](handleError(_0x337e5c,null));};exports[_0xa952('0x66')]=function(_0x16a198,_0x583bb8,_0x1f0166){var _0x4affcb={'raw':!![],'where':{}};var _0x28993c={};var _0x2195db={'count':0x0,'rows':[]};return db[_0xa952('0x37')][_0xa952('0x60')]({'where':{'id':_0x16a198['params']['id']}})[_0xa952('0x26')](handleEntityNotFound(_0x583bb8,null))[_0xa952('0x26')](function(_0x15412a){if(_0x15412a){_0x28993c[_0xa952('0x3b')]=_[_0xa952('0x3c')](db[_0xa952('0x67')][_0xa952('0x38')]);_0x28993c[_0xa952('0x3d')]=_[_0xa952('0x3c')](_0x16a198[_0xa952('0x3d')]);_0x28993c['filters']=_['intersection'](_0x28993c[_0xa952('0x3b')],_0x28993c[_0xa952('0x3d')]);_0x4affcb['attributes']=_[_0xa952('0x3e')](_0x28993c[_0xa952('0x3b')],qs['fields'](_0x16a198[_0xa952('0x3d')][_0xa952('0x40')]));_0x4affcb[_0xa952('0x3f')]=_0x4affcb[_0xa952('0x3f')][_0xa952('0x41')]?_0x4affcb[_0xa952('0x3f')]:_0x28993c[_0xa952('0x3b')];if(!_0x16a198[_0xa952('0x3d')]['hasOwnProperty'](_0xa952('0x65'))){_0x4affcb[_0xa952('0x43')]=qs['limit'](_0x16a198[_0xa952('0x3d')][_0xa952('0x43')]);_0x4affcb[_0xa952('0x21')]=qs['offset'](_0x16a198[_0xa952('0x3d')][_0xa952('0x21')]);}_0x4affcb['order']=qs[_0xa952('0x45')](_0x16a198[_0xa952('0x3d')][_0xa952('0x45')]);_0x4affcb['where']=qs['filters'](_[_0xa952('0x48')](_0x16a198[_0xa952('0x3d')],_0x28993c[_0xa952('0x47')]));_0x4affcb[_0xa952('0x46')][_0xa952('0x62')]=_0x15412a['id'];if(_0x16a198[_0xa952('0x3d')][_0xa952('0x2c')]){_0x4affcb[_0xa952('0x46')]=_[_0xa952('0x49')](_0x4affcb[_0xa952('0x46')],{'$or':_['map'](_0x4affcb['attributes'],function(_0x3a5481){var _0x2970f3={};_0x2970f3[_0x3a5481]={'$like':'%'+_0x16a198[_0xa952('0x3d')][_0xa952('0x2c')]+'%'};return _0x2970f3;})});}_0x4affcb=_[_0xa952('0x49')]({},_0x4affcb,_0x16a198[_0xa952('0x4b')]);return db['CmHopperFinal'][_0xa952('0x20')]({'where':_0x4affcb[_0xa952('0x46')]})[_0xa952('0x26')](function(_0x1effc6){_0x2195db['count']=_0x1effc6;if(_0x16a198[_0xa952('0x3d')][_0xa952('0x4c')]){_0x4affcb[_0xa952('0x4d')]=[{'all':!![]}];}return db[_0xa952('0x67')][_0xa952('0x4e')](_0x4affcb);})[_0xa952('0x26')](function(_0x3b52ec){_0x2195db[_0xa952('0x4f')]=_0x3b52ec;return _0x2195db;});}})[_0xa952('0x26')](respondWithFilteredResult(_0x583bb8,_0x4affcb))[_0xa952('0x50')](handleError(_0x583bb8,null));};exports[_0xa952('0x68')]=function(_0x3f2fd8,_0xf94a78,_0x5d855f){var _0x5018e3={'raw':!![],'where':{}};var _0xb76052={};var _0x1af2f1={'count':0x0,'rows':[]};return db[_0xa952('0x37')][_0xa952('0x60')]({'where':{'id':_0x3f2fd8[_0xa952('0x5a')]['id']}})[_0xa952('0x26')](handleEntityNotFound(_0xf94a78,null))['then'](function(_0x5894a7){if(_0x5894a7){_0xb76052[_0xa952('0x3b')]=_['keys'](db[_0xa952('0x69')][_0xa952('0x38')]);_0xb76052[_0xa952('0x3d')]=_[_0xa952('0x3c')](_0x3f2fd8['query']);_0xb76052[_0xa952('0x47')]=_[_0xa952('0x3e')](_0xb76052['model'],_0xb76052['query']);_0x5018e3[_0xa952('0x3f')]=_['intersection'](_0xb76052[_0xa952('0x3b')],qs[_0xa952('0x40')](_0x3f2fd8[_0xa952('0x3d')][_0xa952('0x40')]));_0x5018e3[_0xa952('0x3f')]=_0x5018e3[_0xa952('0x3f')][_0xa952('0x41')]?_0x5018e3[_0xa952('0x3f')]:_0xb76052[_0xa952('0x3b')];if(!_0x3f2fd8['query'][_0xa952('0x42')]('nolimit')){_0x5018e3[_0xa952('0x43')]=qs['limit'](_0x3f2fd8[_0xa952('0x3d')][_0xa952('0x43')]);_0x5018e3[_0xa952('0x21')]=qs[_0xa952('0x21')](_0x3f2fd8['query'][_0xa952('0x21')]);}_0x5018e3[_0xa952('0x44')]=qs[_0xa952('0x45')](_0x3f2fd8[_0xa952('0x3d')][_0xa952('0x45')]);_0x5018e3[_0xa952('0x46')]=qs[_0xa952('0x47')](_[_0xa952('0x48')](_0x3f2fd8[_0xa952('0x3d')],_0xb76052[_0xa952('0x47')]));_0x5018e3[_0xa952('0x46')][_0xa952('0x62')]=_0x5894a7['id'];if(_0x3f2fd8[_0xa952('0x3d')]['filter']){_0x5018e3[_0xa952('0x46')]=_[_0xa952('0x49')](_0x5018e3[_0xa952('0x46')],{'$or':_[_0xa952('0x36')](_0x5018e3[_0xa952('0x3f')],function(_0x47d938){var _0x2c58fa={};_0x2c58fa[_0x47d938]={'$like':'%'+_0x3f2fd8['query']['filter']+'%'};return _0x2c58fa;})});}_0x5018e3=_['merge']({},_0x5018e3,_0x3f2fd8[_0xa952('0x4b')]);return db[_0xa952('0x69')][_0xa952('0x20')]({'where':_0x5018e3[_0xa952('0x46')]})[_0xa952('0x26')](function(_0x4ee6bd){_0x1af2f1[_0xa952('0x20')]=_0x4ee6bd;if(_0x3f2fd8['query']['includeAll']){_0x5018e3[_0xa952('0x4d')]=[{'all':!![]}];}return db[_0xa952('0x69')][_0xa952('0x4e')](_0x5018e3);})[_0xa952('0x26')](function(_0x4017a4){_0x1af2f1[_0xa952('0x4f')]=_0x4017a4;return _0x1af2f1;});}})[_0xa952('0x26')](respondWithFilteredResult(_0xf94a78,_0x5018e3))['catch'](handleError(_0xf94a78,null));};exports[_0xa952('0x6a')]=function(_0x1ab88a,_0x34bfce,_0x704347){var _0x41edf7={};var _0x98fa85={};var _0x2a39ad;var _0x41e8a3;return db[_0xa952('0x37')][_0xa952('0x60')]({'where':{'id':_0x1ab88a[_0xa952('0x5a')]['id']}})[_0xa952('0x26')](handleEntityNotFound(_0x34bfce,null))[_0xa952('0x26')](function(_0x26ef02){if(_0x26ef02){_0x2a39ad=_0x26ef02;_0x98fa85['model']=_[_0xa952('0x3c')](db['Team'][_0xa952('0x38')]);_0x98fa85[_0xa952('0x3d')]=_[_0xa952('0x3c')](_0x1ab88a[_0xa952('0x3d')]);_0x98fa85[_0xa952('0x47')]=_[_0xa952('0x3e')](_0x98fa85['model'],_0x98fa85[_0xa952('0x3d')]);_0x41edf7['attributes']=_['intersection'](_0x98fa85[_0xa952('0x3b')],qs[_0xa952('0x40')](_0x1ab88a[_0xa952('0x3d')][_0xa952('0x40')]));_0x41edf7[_0xa952('0x3f')]=_0x41edf7[_0xa952('0x3f')]['length']?_0x41edf7[_0xa952('0x3f')]:_0x98fa85[_0xa952('0x3b')];_0x41edf7[_0xa952('0x44')]=qs[_0xa952('0x45')](_0x1ab88a[_0xa952('0x3d')]['sort']);_0x41edf7[_0xa952('0x46')]=qs['filters'](_[_0xa952('0x48')](_0x1ab88a[_0xa952('0x3d')],_0x98fa85[_0xa952('0x47')]));if(_0x1ab88a['query'][_0xa952('0x2c')]){_0x41edf7[_0xa952('0x46')]=_[_0xa952('0x49')](_0x41edf7[_0xa952('0x46')],{'$or':_[_0xa952('0x36')](_0x41edf7[_0xa952('0x3f')],function(_0x31cfbb){var _0x59f8dc={};_0x59f8dc[_0x31cfbb]={'$like':'%'+_0x1ab88a[_0xa952('0x3d')][_0xa952('0x2c')]+'%'};return _0x59f8dc;})});}_0x41edf7=_[_0xa952('0x49')]({},_0x41edf7,_0x1ab88a[_0xa952('0x4b')]);return _0x2a39ad[_0xa952('0x6a')](_0x41edf7);}})[_0xa952('0x26')](function(_0xd28af7){if(_0xd28af7){_0x41e8a3=_0xd28af7['length'];if(!_0x1ab88a[_0xa952('0x3d')]['hasOwnProperty'](_0xa952('0x65'))){_0x41edf7[_0xa952('0x43')]=qs['limit'](_0x1ab88a['query']['limit']);_0x41edf7[_0xa952('0x21')]=qs[_0xa952('0x21')](_0x1ab88a[_0xa952('0x3d')][_0xa952('0x21')]);}return _0x2a39ad[_0xa952('0x6a')](_0x41edf7);}})[_0xa952('0x26')](function(_0x8c6a6b){if(_0x8c6a6b){return _0x8c6a6b?{'count':_0x41e8a3,'rows':_0x8c6a6b}:null;}})['then'](respondWithResult(_0x34bfce,null))[_0xa952('0x50')](handleError(_0x34bfce,null));};exports[_0xa952('0x6b')]=function(_0x5113e1,_0x56a6e3,_0x6072c2){var _0x3fbb50=_0x5113e1['body']['teams'];var _0x217197=_[_0xa952('0x36')](_0x3fbb50,'id');return db['Team']['findAll']({'where':{'id':_0x217197},'attributes':['id'],'include':[{'model':db[_0xa952('0x6c')],'as':_0xa952('0x6d'),'attributes':['id',_0xa952('0x31'),'online',_0xa952('0x6e'),'interface'],'raw':!![]}]})[_0xa952('0x26')](function(_0xcef4e9){if(_0xcef4e9){var _0x386df4=_['flatMap'](_0xcef4e9,function(_0x3d1a70){var _0x42dd5e=_0x3d1a70['get']({'plain':!![]});_0x42dd5e['Agents'][_0xa952('0x6f')](function(_0x4c027e){_0x4c027e[_0xa952('0x70')]=_['find'](_0x3fbb50,{'id':_0x42dd5e['id']})['penalty'];});return _0x42dd5e[_0xa952('0x6d')];});return db[_0xa952('0x37')]['find']({'where':{'id':_0x5113e1['params']['id']}})['then'](function(_0x524b0a){return db[_0xa952('0x71')][_0xa952('0x72')](function(_0x4182b7){return _0x524b0a['addTeams'](_0x217197,{'transaction':_0x4182b7})['then'](function(){return BPromise['each'](_0x386df4,function(_0xf8813e){return db[_0xa952('0x73')][_0xa952('0x74')]({'where':{'UserId':_0xf8813e['id'],'VoiceQueueId':_0x5113e1[_0xa952('0x5a')]['id']},'defaults':{'penalty':_0xf8813e[_0xa952('0x70')]},'transaction':_0x4182b7});});})[_0xa952('0x26')](function(){return BPromise[_0xa952('0x75')](_['filter'](_0x386df4,{'online':!![]}),function(_0x2c3e4e){return db['UserVoiceQueueRt'][_0xa952('0x76')]({'membername':_0x2c3e4e[_0xa952('0x31')],'UserId':_0x2c3e4e['id'],'queue_name':_0x524b0a[_0xa952('0x31')],'VoiceQueueId':_0x524b0a['id'],'interface':_[_0xa952('0x77')](_0x2c3e4e[_0xa952('0x78')])?util[_0xa952('0x79')](_0xa952('0x7a'),_0x2c3e4e[_0xa952('0x31')]):_0x2c3e4e[_0xa952('0x78')],'paused':_0x2c3e4e[_0xa952('0x6e')]||![],'penalty':_0x2c3e4e[_0xa952('0x70')]},{'transaction':_0x4182b7});});})[_0xa952('0x26')](function(){_0x386df4['forEach'](function(_0x504344){socket[_0xa952('0x7b')](_0xa952('0x7c'),{'UserId':_0x504344['id'],'VoiceQueueId':_0x524b0a['id']});});});});});}})[_0xa952('0x26')](respondWithStatusCode(_0x56a6e3,null))['catch'](handleError(_0x56a6e3,null));};exports[_0xa952('0x7d')]=function(_0x32b2dd,_0x8d641f,_0x1d7eb7){return db[_0xa952('0x7e')][_0xa952('0x4e')]({'where':{'id':_0x32b2dd['query'][_0xa952('0x7f')]},'attributes':['id'],'include':[{'model':db[_0xa952('0x6c')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xa952('0x26')](handleEntityNotFound(_0x8d641f,null))[_0xa952('0x26')](function(_0x214845){var _0x1c88fb=_[_0xa952('0x36')](_0x214845,'id');var _0x516610=[];var _0x2a5c61=[];var _0x3cca6b=squel[_0xa952('0x80')]();_0x3cca6b[_0xa952('0x81')](_0xa952('0x82'))[_0xa952('0x83')](_0xa952('0x84'),'tq')[_0xa952('0x85')](_0xa952('0x86'),'ut',_0xa952('0x87'))[_0xa952('0x46')]('VoiceQueueId\x20=\x20?',_0x32b2dd[_0xa952('0x5a')]['id']);for(var _0x5f1daa=0x0;_0x5f1daa<_0x214845[_0xa952('0x41')];_0x5f1daa+=0x1){let _0x51988f=_0x214845[_0x5f1daa];for(var _0x34e900=0x0;_0x34e900<_0x51988f['Agents'][_0xa952('0x41')];_0x34e900+=0x1){let _0x635333=_0x51988f['Agents'][_0x34e900];var _0x3f0c66=_0x3cca6b['clone']();_0x3f0c66[_0xa952('0x46')]('ut.UserId\x20=\x20?',_0x635333['id']);_0x2a5c61[_0xa952('0x88')](db[_0xa952('0x71')]['query'](_0x3f0c66['toString'](),{'type':db['sequelize'][_0xa952('0x89')][_0xa952('0x8a')]})[_0xa952('0x26')](function(_0x229f13){if(_0x229f13[_0xa952('0x41')]===0x1){return _0x635333['id'];}else{var _0x310f02=_[_0xa952('0x8b')](_[_0xa952('0x36')](_0x229f13,_0xa952('0x8c')),function(_0x4a3d31){return _[_0xa952('0x8d')](_0x1c88fb,_0x4a3d31);});if(_0x310f02){return _0x635333['id'];}}}));}}return BPromise[_0xa952('0x8e')](_0x2a5c61)['then'](function(_0x50849b){_0x516610=_(_0x516610)['union'](_0x50849b)[_0xa952('0x8f')]()[_0xa952('0x2e')]();return db['VoiceQueue']['find']({'where':{'id':_0x32b2dd['params']['id']}})[_0xa952('0x26')](function(_0x52e339){return db[_0xa952('0x71')][_0xa952('0x72')](function(_0x5d8128){return _0x52e339[_0xa952('0x7d')](_0x32b2dd[_0xa952('0x3d')][_0xa952('0x7f')],{'transaction':_0x5d8128})[_0xa952('0x26')](function(){if(!_[_0xa952('0x90')](_0x516610)){return _0x52e339[_0xa952('0x91')](_0x516610,{'transaction':_0x5d8128})[_0xa952('0x26')](function(){return db[_0xa952('0x92')][_0xa952('0x27')]({'where':{'VoiceQueueId':_0x32b2dd[_0xa952('0x5a')]['id'],'UserId':_0x516610},'transaction':_0x5d8128});});}})['then'](function(){_0x516610[_0xa952('0x6f')](function(_0x1118e4){socket['emit'](_0xa952('0x93'),{'UserId':_0x1118e4,'VoiceQueueId':_0x52e339['id']});});});});});});})[_0xa952('0x26')](respondWithStatusCode(_0x8d641f,null))[_0xa952('0x50')](handleError(_0x8d641f,null));};exports[_0xa952('0x94')]=function(_0x36c698,_0x1bcaa2,_0x2cfdc4){var _0x39d5b3,_0x55f318;return db[_0xa952('0x37')][_0xa952('0x30')]({'where':{'id':_0x36c698['params']['id']}})[_0xa952('0x26')](handleEntityNotFound(_0x1bcaa2,null))[_0xa952('0x26')](function(_0x312574){if(_0x312574){_0x55f318=_0x312574;return _0x312574['addAgents'](_0x36c698[_0xa952('0x5c')][_0xa952('0x7f')],_[_0xa952('0x5b')](_0x36c698['body'],[_0xa952('0x7f'),'id'])||{})['spread'](function(_0x32f5fc){for(var _0x23a20c=0x0;_0x23a20c<_0x36c698[_0xa952('0x5c')][_0xa952('0x7f')][_0xa952('0x41')];_0x23a20c+=0x1){socket['emit'](_0xa952('0x7c'),{'UserId':_0x36c698[_0xa952('0x5c')][_0xa952('0x7f')][_0x23a20c],'VoiceQueueId':_0x36c698[_0xa952('0x5a')]['id']});}return _0x32f5fc;});}})[_0xa952('0x26')](function(_0x5044d4){_0x39d5b3=_0x5044d4||[];if(_0x55f318){return db['User'][_0xa952('0x4e')]({'where':{'id':_0x36c698[_0xa952('0x5c')][_0xa952('0x7f')]},'attributes':['id','name','online',_0xa952('0x6e'),_0xa952('0x78')],'raw':!![]});}})[_0xa952('0x26')](function(_0x134ac0){if(!_[_0xa952('0x90')](_0x134ac0)){var _0x25a7cc=[];for(var _0x3b66e1=0x0;_0x3b66e1<_0x134ac0[_0xa952('0x41')];_0x3b66e1++){if(_0x134ac0[_0x3b66e1]['online']){_0x25a7cc[_0xa952('0x88')](db[_0xa952('0x92')][_0xa952('0x76')]({'membername':_0x134ac0[_0x3b66e1][_0xa952('0x31')],'UserId':_0x134ac0[_0x3b66e1]['id'],'queue_name':_0x55f318[_0xa952('0x31')],'VoiceQueueId':_0x55f318['id'],'interface':_[_0xa952('0x77')](_0x134ac0[_0x3b66e1][_0xa952('0x78')])?util['format'](_0xa952('0x7a'),_0x134ac0[_0x3b66e1][_0xa952('0x31')]):_0x134ac0[_0x3b66e1][_0xa952('0x78')],'paused':_0x134ac0[_0x3b66e1][_0xa952('0x6e')]||![],'penalty':_0x36c698[_0xa952('0x5c')][_0xa952('0x70')]||0x0}));}}return BPromise[_0xa952('0x8e')](_0x25a7cc);}})[_0xa952('0x26')](function(){return _0x39d5b3;})[_0xa952('0x26')](respondWithResult(_0x1bcaa2,null))['catch'](handleError(_0x1bcaa2,null));};exports[_0xa952('0x91')]=function(_0x3b92f5,_0x28f7f8,_0x4dca70){return db[_0xa952('0x37')][_0xa952('0x30')]({'where':{'id':_0x3b92f5[_0xa952('0x5a')]['id']}})[_0xa952('0x26')](handleEntityNotFound(_0x28f7f8,null))[_0xa952('0x26')](function(_0x4d2faf){if(_0x4d2faf){return _0x4d2faf[_0xa952('0x91')](_0x3b92f5['query']['ids'])[_0xa952('0x26')](function(){if(_[_0xa952('0x95')](_0x3b92f5[_0xa952('0x3d')][_0xa952('0x7f')])){for(var _0x1bdfef=0x0;_0x1bdfef<_0x3b92f5[_0xa952('0x3d')][_0xa952('0x7f')][_0xa952('0x41')];_0x1bdfef+=0x1){socket[_0xa952('0x7b')](_0xa952('0x93'),{'UserId':Number(_0x3b92f5['query'][_0xa952('0x7f')][_0x1bdfef]),'VoiceQueueId':Number(_0x3b92f5['params']['id'])});}}else{socket['emit'](_0xa952('0x93'),{'UserId':Number(_0x3b92f5[_0xa952('0x3d')]['ids']),'VoiceQueueId':Number(_0x3b92f5[_0xa952('0x5a')]['id'])});}});}})[_0xa952('0x26')](function(_0x178bc4){return db[_0xa952('0x92')][_0xa952('0x27')]({'where':{'VoiceQueueId':_0x3b92f5[_0xa952('0x5a')]['id'],'UserId':_0x3b92f5[_0xa952('0x3d')][_0xa952('0x7f')]}})[_0xa952('0x26')](function(){return _0x178bc4;});})['then'](respondWithStatusCode(_0x28f7f8,null))[_0xa952('0x50')](handleError(_0x28f7f8,null));};exports[_0xa952('0x96')]=function(_0x74e84c,_0x5ae532,_0x55c467){var _0x2e79e7={};var _0x2ea4ed={};var _0x32951e;var _0x5c48f1;return db[_0xa952('0x37')][_0xa952('0x60')]({'where':{'id':_0x74e84c[_0xa952('0x5a')]['id']}})[_0xa952('0x26')](handleEntityNotFound(_0x5ae532,null))['then'](function(_0x3bf464){if(_0x3bf464){_0x32951e=_0x3bf464;_0x2ea4ed[_0xa952('0x3b')]=_['keys'](db[_0xa952('0x6c')]['rawAttributes']);_0x2ea4ed[_0xa952('0x3d')]=_[_0xa952('0x3c')](_0x74e84c[_0xa952('0x3d')]);_0x2ea4ed['filters']=_['intersection'](_0x2ea4ed['model'],_0x2ea4ed['query']);_0x2e79e7['attributes']=_[_0xa952('0x3e')](_0x2ea4ed[_0xa952('0x3b')],qs[_0xa952('0x40')](_0x74e84c[_0xa952('0x3d')][_0xa952('0x40')]));_0x2e79e7[_0xa952('0x3f')]=_0x2e79e7[_0xa952('0x3f')][_0xa952('0x41')]?_0x2e79e7[_0xa952('0x3f')]:_0x2ea4ed[_0xa952('0x3b')];_0x2e79e7['order']=qs[_0xa952('0x45')](_0x74e84c[_0xa952('0x3d')]['sort']);_0x2e79e7[_0xa952('0x46')]=qs[_0xa952('0x47')](_[_0xa952('0x48')](_0x74e84c[_0xa952('0x3d')],_0x2ea4ed[_0xa952('0x47')]));if(_0x74e84c[_0xa952('0x3d')][_0xa952('0x2c')]){_0x2e79e7['where']=_['merge'](_0x2e79e7[_0xa952('0x46')],{'$or':_['map'](_0x2e79e7[_0xa952('0x3f')],function(_0x6e0153){var _0x3e10da={};_0x3e10da[_0x6e0153]={'$like':'%'+_0x74e84c[_0xa952('0x3d')][_0xa952('0x2c')]+'%'};return _0x3e10da;})});}_0x2e79e7=_['merge']({},_0x2e79e7,_0x74e84c[_0xa952('0x4b')]);return _0x32951e[_0xa952('0x96')](_0x2e79e7);}})[_0xa952('0x26')](function(_0x57e1c0){if(_0x57e1c0){_0x5c48f1=_0x57e1c0[_0xa952('0x41')];if(!_0x74e84c[_0xa952('0x3d')]['hasOwnProperty'](_0xa952('0x65'))){_0x2e79e7[_0xa952('0x43')]=qs[_0xa952('0x43')](_0x74e84c['query'][_0xa952('0x43')]);_0x2e79e7[_0xa952('0x21')]=qs[_0xa952('0x21')](_0x74e84c[_0xa952('0x3d')][_0xa952('0x21')]);}return _0x32951e[_0xa952('0x96')](_0x2e79e7);}})['then'](function(_0x51e574){if(_0x51e574){return _0x51e574?{'count':_0x5c48f1,'rows':_0x51e574}:null;}})['then'](respondWithResult(_0x5ae532,null))[_0xa952('0x50')](handleError(_0x5ae532,null));};exports[_0xa952('0x97')]=function(_0x4e82ad,_0xd7c096,_0xd8b58f){var _0x506623={};var _0x161c43={};var _0x20e39b;var _0xbf51d7;return db[_0xa952('0x37')]['findOne']({'where':{'id':_0x4e82ad['params']['id']}})['then'](handleEntityNotFound(_0xd7c096,null))[_0xa952('0x26')](function(_0x54cda2){if(_0x54cda2){_0x20e39b=_0x54cda2;_0x161c43['model']=_[_0xa952('0x3c')](db[_0xa952('0x92')][_0xa952('0x38')]);_0x161c43[_0xa952('0x3d')]=_['keys'](_0x4e82ad[_0xa952('0x3d')]);_0x161c43[_0xa952('0x47')]=_[_0xa952('0x3e')](_0x161c43[_0xa952('0x3b')],_0x161c43[_0xa952('0x3d')]);_0x506623['attributes']=_[_0xa952('0x3e')](_0x161c43[_0xa952('0x3b')],qs['fields'](_0x4e82ad[_0xa952('0x3d')][_0xa952('0x40')]));_0x506623[_0xa952('0x3f')]=_0x506623[_0xa952('0x3f')]['length']?_0x506623[_0xa952('0x3f')]:_0x161c43['model'];_0x506623[_0xa952('0x44')]=qs['sort'](_0x4e82ad[_0xa952('0x3d')][_0xa952('0x45')]);_0x506623[_0xa952('0x46')]=qs[_0xa952('0x47')](_[_0xa952('0x48')](_0x4e82ad[_0xa952('0x3d')],_0x161c43[_0xa952('0x47')]));if(_0x4e82ad[_0xa952('0x3d')][_0xa952('0x2c')]){_0x506623[_0xa952('0x46')]=_[_0xa952('0x49')](_0x506623[_0xa952('0x46')],{'$or':_['map'](_0x506623[_0xa952('0x3f')],function(_0x42417f){var _0x327667={};_0x327667[_0x42417f]={'$like':'%'+_0x4e82ad[_0xa952('0x3d')][_0xa952('0x2c')]+'%'};return _0x327667;})});}_0x506623=_[_0xa952('0x49')]({},_0x506623,_0x4e82ad['options']);return _0x20e39b['getMembers'](_0x506623);}})[_0xa952('0x26')](function(_0x4f10f4){if(_0x4f10f4){_0xbf51d7=_0x4f10f4[_0xa952('0x41')];if(!_0x4e82ad[_0xa952('0x3d')][_0xa952('0x42')]('nolimit')){_0x506623[_0xa952('0x43')]=qs[_0xa952('0x43')](_0x4e82ad[_0xa952('0x3d')][_0xa952('0x43')]);_0x506623['offset']=qs[_0xa952('0x21')](_0x4e82ad[_0xa952('0x3d')][_0xa952('0x21')]);}return _0x20e39b['getMembers'](_0x506623);}})[_0xa952('0x26')](function(_0x586c0e){return _0x586c0e?{'count':_0xbf51d7,'rows':_0x586c0e}:null;})[_0xa952('0x26')](respondWithResult(_0xd7c096,null))[_0xa952('0x50')](handleError(_0xd7c096,null));};exports[_0xa952('0x98')]=function(_0x149d33,_0x1de222,_0x46a6fc){var _0x45b7ff={};var _0x3a61dd={};var _0x35fa59;var _0x5df4cc;return db[_0xa952('0x37')]['findOne']({'where':{'id':_0x149d33[_0xa952('0x5a')]['id']}})[_0xa952('0x26')](handleEntityNotFound(_0x1de222,null))[_0xa952('0x26')](function(_0x4f2840){if(_0x4f2840){_0x35fa59=_0x4f2840;_0x3a61dd[_0xa952('0x3b')]=_[_0xa952('0x3c')](db[_0xa952('0x99')][_0xa952('0x38')]);_0x3a61dd[_0xa952('0x3d')]=_['keys'](_0x149d33[_0xa952('0x3d')]);_0x3a61dd['filters']=_[_0xa952('0x3e')](_0x3a61dd[_0xa952('0x3b')],_0x3a61dd[_0xa952('0x3d')]);_0x45b7ff[_0xa952('0x3f')]=_[_0xa952('0x3e')](_0x3a61dd[_0xa952('0x3b')],qs[_0xa952('0x40')](_0x149d33[_0xa952('0x3d')][_0xa952('0x40')]));_0x45b7ff['attributes']=_0x45b7ff[_0xa952('0x3f')][_0xa952('0x41')]?_0x45b7ff[_0xa952('0x3f')]:_0x3a61dd[_0xa952('0x3b')];_0x45b7ff['order']=qs[_0xa952('0x45')](_0x149d33[_0xa952('0x3d')][_0xa952('0x45')]);_0x45b7ff[_0xa952('0x46')]=qs[_0xa952('0x47')](_['pick'](_0x149d33[_0xa952('0x3d')],_0x3a61dd[_0xa952('0x47')]));if(_0x149d33[_0xa952('0x3d')][_0xa952('0x2c')]){_0x45b7ff['where']=_[_0xa952('0x49')](_0x45b7ff['where'],{'$or':_[_0xa952('0x36')](_0x45b7ff[_0xa952('0x3f')],function(_0xe20124){var _0x1ef9b8={};_0x1ef9b8[_0xe20124]={'$like':'%'+_0x149d33[_0xa952('0x3d')][_0xa952('0x2c')]+'%'};return _0x1ef9b8;})});}_0x45b7ff=_[_0xa952('0x49')]({},_0x45b7ff,_0x149d33[_0xa952('0x4b')]);return _0x35fa59[_0xa952('0x98')](_0x45b7ff);}})[_0xa952('0x26')](function(_0x3eda4d){if(_0x3eda4d){_0x5df4cc=_0x3eda4d['length'];if(!_0x149d33[_0xa952('0x3d')][_0xa952('0x42')](_0xa952('0x65'))){_0x45b7ff['limit']=qs[_0xa952('0x43')](_0x149d33[_0xa952('0x3d')][_0xa952('0x43')]);_0x45b7ff['offset']=qs[_0xa952('0x21')](_0x149d33[_0xa952('0x3d')]['offset']);}return _0x35fa59[_0xa952('0x98')](_0x45b7ff);}})[_0xa952('0x26')](function(_0x278268){if(_0x278268){return _0x278268?{'count':_0x5df4cc,'rows':_0x278268}:null;}})[_0xa952('0x26')](respondWithResult(_0x1de222,null))[_0xa952('0x50')](handleError(_0x1de222,null));};exports[_0xa952('0x9a')]=function(_0x48753a,_0x54f78f,_0x598eda){var _0x49957c,_0x50470c;return db[_0xa952('0x37')][_0xa952('0x30')]({'where':{'id':_0x48753a[_0xa952('0x5a')]['id']}})['then'](handleEntityNotFound(_0x54f78f,null))[_0xa952('0x26')](function(_0x177ef6){if(_0x177ef6){_0x50470c=_0x177ef6;return _0x177ef6[_0xa952('0x9a')](_0x48753a[_0xa952('0x5c')][_0xa952('0x7f')],_[_0xa952('0x5b')](_0x48753a[_0xa952('0x5c')],[_0xa952('0x7f'),'id'])||{});}return null;})[_0xa952('0x9b')](function(_0x5e6be1){var _0x12eb7f;_0x49957c=_0x5e6be1||[];var _0x478b0a=[];if(_0x5e6be1){for(var _0x1f1aaf=0x0;_0x1f1aaf<_0x5e6be1[_0xa952('0x41')];_0x1f1aaf+=0x1){var _0x2ad0cc=_0x5e6be1[_0x1f1aaf]['get']({'plain':!![]});_0x50470c['dialCheckDuplicateType']=_0x48753a[_0xa952('0x5c')]['dialCheckDuplicateType']?_0x48753a['body']['dialCheckDuplicateType']:_0x50470c[_0xa952('0x9c')];switch(_0x50470c[_0xa952('0x9c')]){case'always':_0x12eb7f=squel['insert']()[_0xa952('0x9d')](_0xa952('0x9e'))[_0xa952('0x9f')]([_0xa952('0xa0'),_0xa952('0xa1'),_0xa952('0xa2'),_0xa952('0xa3'),_0xa952('0x62'),'createdAt',_0xa952('0x5e')],squel[_0xa952('0x80')]()[_0xa952('0x81')](_0xa952('0xa0'),_0xa952('0xa0'))[_0xa952('0x81')](_0xa952('0xa4'),_0xa952('0xa1'))[_0xa952('0x81')]('id','ContactId')['field'](_0x2ad0cc[_0xa952('0xa5')]['toString'](),'ListId')['field'](_0x48753a[_0xa952('0x5a')]['id'][_0xa952('0xa6')](),'VoiceQueueId')[_0xa952('0x81')](_0xa952('0xa4'),_0xa952('0x5d'))[_0xa952('0x81')](_0xa952('0xa4'),'updatedAt')[_0xa952('0x83')]('cm_contacts')[_0xa952('0x46')]('deletedAt\x20IS\x20NULL')[_0xa952('0x46')](_0xa952('0xa7'),_0x2ad0cc[_0xa952('0xa5')][_0xa952('0xa6')]())[_0xa952('0x46')](_0xa952('0xa8'))[_0xa952('0x46')](_0xa952('0xa9'),squel[_0xa952('0x80')]()['field'](_0xa952('0xaa'))[_0xa952('0x83')](_0xa952('0xab'))[_0xa952('0x46')](_0xa952('0xac'),_0x48753a[_0xa952('0x5a')]['id'][_0xa952('0xa6')]()))[_0xa952('0x46')]('phone\x20NOT\x20IN\x20(?)',squel[_0xa952('0x80')]()['field'](_0xa952('0xad'))[_0xa952('0x83')]('cm_hopper')[_0xa952('0x46')](_0xa952('0xac'),_0x48753a['params']['id'][_0xa952('0xa6')]())))[_0xa952('0xa6')]();break;case _0xa952('0xae'):_0x12eb7f=squel['insert']()[_0xa952('0x9d')](_0xa952('0x9e'))[_0xa952('0x9f')]([_0xa952('0xa0'),_0xa952('0xa1'),_0xa952('0xa2'),_0xa952('0xa3'),_0xa952('0x62'),'createdAt',_0xa952('0x5e')],squel[_0xa952('0x80')]()[_0xa952('0x81')](_0xa952('0xa0'),'phone')['field']('NOW()',_0xa952('0xa1'))['field']('id','ContactId')['field'](_0x2ad0cc['CmListId'][_0xa952('0xa6')](),_0xa952('0xa3'))[_0xa952('0x81')](_0x48753a[_0xa952('0x5a')]['id'][_0xa952('0xa6')](),_0xa952('0x62'))[_0xa952('0x81')](_0xa952('0xa4'),_0xa952('0x5d'))[_0xa952('0x81')](_0xa952('0xa4'),_0xa952('0x5e'))[_0xa952('0x83')](_0xa952('0xaf'))[_0xa952('0x46')]('deletedAt\x20IS\x20NULL')['where'](_0xa952('0xa7'),_0x2ad0cc[_0xa952('0xa5')][_0xa952('0xa6')]())[_0xa952('0x46')](_0xa952('0xa8'))[_0xa952('0x46')](_0xa952('0xa9'),squel[_0xa952('0x80')]()[_0xa952('0x81')](_0xa952('0xad'))[_0xa952('0x83')](_0xa952('0x9e'))[_0xa952('0x46')](_0xa952('0xac'),_0x48753a['params']['id'][_0xa952('0xa6')]())))[_0xa952('0xa6')]();break;default:_0x12eb7f=squel[_0xa952('0xb0')]()[_0xa952('0x9d')](_0xa952('0x9e'))[_0xa952('0x9f')]([_0xa952('0xa0'),_0xa952('0xa1'),_0xa952('0xa2'),_0xa952('0xa3'),_0xa952('0x62'),'createdAt','updatedAt'],squel['select']()[_0xa952('0x81')](_0xa952('0xa0'),_0xa952('0xa0'))[_0xa952('0x81')](_0xa952('0xa4'),_0xa952('0xa1'))[_0xa952('0x81')]('id',_0xa952('0xa2'))[_0xa952('0x81')](_0x2ad0cc[_0xa952('0xa5')][_0xa952('0xa6')](),'ListId')[_0xa952('0x81')](_0x48753a[_0xa952('0x5a')]['id']['toString'](),'VoiceQueueId')[_0xa952('0x81')](_0xa952('0xa4'),_0xa952('0x5d'))[_0xa952('0x81')]('NOW()',_0xa952('0x5e'))['from'](_0xa952('0xaf'))[_0xa952('0x46')](_0xa952('0xb1'))[_0xa952('0x46')]('ListId\x20=\x20?',_0x2ad0cc[_0xa952('0xa5')][_0xa952('0xa6')]())['where'](_0xa952('0xa8')))[_0xa952('0xa6')]();}_0x478b0a[_0xa952('0x88')](db[_0xa952('0x71')][_0xa952('0x3d')](_0x12eb7f));}return BPromise[_0xa952('0x8e')](_0x478b0a);}})['then'](function(){return _0x49957c;})[_0xa952('0x26')](respondWithResult(_0x54f78f,null))[_0xa952('0x50')](handleError(_0x54f78f,null));};exports[_0xa952('0xb2')]=function(_0x2013db,_0x5725aa,_0x4fdd59){return db[_0xa952('0x37')]['find']({'where':{'id':_0x2013db['params']['id']}})[_0xa952('0x26')](handleEntityNotFound(_0x5725aa,null))[_0xa952('0x26')](function(_0x5afe8d){if(_0x5afe8d){return _0x5afe8d[_0xa952('0xb2')](_0x2013db['query']['ids']);}})[_0xa952('0x26')](function(_0x182a90){if(_0x182a90){return db[_0xa952('0x61')][_0xa952('0x27')]({'where':{'ListId':_0x2013db[_0xa952('0x3d')][_0xa952('0x7f')],'VoiceQueueId':_0x2013db[_0xa952('0x5a')]['id']}})[_0xa952('0x26')](function(){return _0x182a90;});}})[_0xa952('0x26')](respondWithStatusCode(_0x5725aa,null))['catch'](handleError(_0x5725aa,null));};exports[_0xa952('0xb3')]=function(_0x593b8f,_0x1cee33,_0x2a263a){var _0x25bf9c={};var _0x30820b={};var _0x3421e9;var _0x2038b3;return db['VoiceQueue'][_0xa952('0x60')]({'where':{'id':_0x593b8f[_0xa952('0x5a')]['id']}})[_0xa952('0x26')](handleEntityNotFound(_0x1cee33,null))['then'](function(_0x41d7d2){if(_0x41d7d2){_0x3421e9=_0x41d7d2;_0x30820b[_0xa952('0x3b')]=_[_0xa952('0x3c')](db['CmList']['rawAttributes']);_0x30820b[_0xa952('0x3d')]=_[_0xa952('0x3c')](_0x593b8f[_0xa952('0x3d')]);_0x30820b[_0xa952('0x47')]=_[_0xa952('0x3e')](_0x30820b[_0xa952('0x3b')],_0x30820b['query']);_0x25bf9c['attributes']=_[_0xa952('0x3e')](_0x30820b[_0xa952('0x3b')],qs[_0xa952('0x40')](_0x593b8f[_0xa952('0x3d')][_0xa952('0x40')]));_0x25bf9c[_0xa952('0x3f')]=_0x25bf9c[_0xa952('0x3f')]['length']?_0x25bf9c['attributes']:_0x30820b[_0xa952('0x3b')];_0x25bf9c['order']=qs[_0xa952('0x45')](_0x593b8f[_0xa952('0x3d')][_0xa952('0x45')]);_0x25bf9c[_0xa952('0x46')]=qs[_0xa952('0x47')](_[_0xa952('0x48')](_0x593b8f[_0xa952('0x3d')],_0x30820b['filters']));if(_0x593b8f[_0xa952('0x3d')]['filter']){_0x25bf9c[_0xa952('0x46')]=_[_0xa952('0x49')](_0x25bf9c[_0xa952('0x46')],{'$or':_[_0xa952('0x36')](_0x25bf9c[_0xa952('0x3f')],function(_0x56131b){var _0x533804={};_0x533804[_0x56131b]={'$like':'%'+_0x593b8f[_0xa952('0x3d')][_0xa952('0x2c')]+'%'};return _0x533804;})});}_0x25bf9c=_['merge']({},_0x25bf9c,_0x593b8f['options']);return _0x3421e9['getBlackLists'](_0x25bf9c);}})[_0xa952('0x26')](function(_0x296447){if(_0x296447){_0x2038b3=_0x296447[_0xa952('0x41')];if(!_0x593b8f['query'][_0xa952('0x42')](_0xa952('0x65'))){_0x25bf9c[_0xa952('0x43')]=qs[_0xa952('0x43')](_0x593b8f[_0xa952('0x3d')][_0xa952('0x43')]);_0x25bf9c[_0xa952('0x21')]=qs['offset'](_0x593b8f[_0xa952('0x3d')]['offset']);}return _0x3421e9[_0xa952('0xb3')](_0x25bf9c);}})[_0xa952('0x26')](function(_0x3ab336){if(_0x3ab336){return _0x3ab336?{'count':_0x2038b3,'rows':_0x3ab336}:null;}})[_0xa952('0x26')](respondWithResult(_0x1cee33,null))[_0xa952('0x50')](handleError(_0x1cee33,null));};exports[_0xa952('0xb4')]=function(_0x28423d,_0x540b29,_0x57e1b8){var _0x2083a1,_0x402e8a;return db[_0xa952('0x37')][_0xa952('0x30')]({'where':{'id':_0x28423d[_0xa952('0x5a')]['id']}})[_0xa952('0x26')](handleEntityNotFound(_0x540b29,null))['then'](function(_0x226afa){if(_0x226afa){_0x402e8a=_0x226afa;return _0x226afa['addBlackLists'](_0x28423d['body'][_0xa952('0x7f')],_[_0xa952('0x5b')](_0x28423d[_0xa952('0x5c')],[_0xa952('0x7f'),'id'])||{});}return null;})['spread'](function(_0x17f8b1){var _0x2fb4a1;_0x2083a1=_0x17f8b1||[];var _0x244d62=[];if(_0x17f8b1){for(var _0x396cbe=0x0;_0x396cbe<_0x17f8b1['length'];_0x396cbe+=0x1){var _0x44da69=_0x17f8b1[_0x396cbe][_0xa952('0x28')]({'plain':!![]});_0x2fb4a1=squel[_0xa952('0xb0')]()[_0xa952('0x9d')](_0xa952('0xb5'))[_0xa952('0x9f')]([_0xa952('0xa0'),'ContactId',_0xa952('0xa3'),_0xa952('0x62'),_0xa952('0x5d'),'updatedAt'],squel[_0xa952('0x80')]()[_0xa952('0x81')](_0xa952('0xa0'),_0xa952('0xa0'))['field']('id',_0xa952('0xa2'))[_0xa952('0x81')](_0x44da69[_0xa952('0xa5')][_0xa952('0xa6')](),_0xa952('0xa3'))[_0xa952('0x81')](_0x28423d[_0xa952('0x5a')]['id'][_0xa952('0xa6')](),_0xa952('0x62'))[_0xa952('0x81')](_0xa952('0xa4'),_0xa952('0x5d'))[_0xa952('0x81')](_0xa952('0xa4'),_0xa952('0x5e'))[_0xa952('0x83')](_0xa952('0xaf'))[_0xa952('0x46')]('deletedAt\x20IS\x20NULL')[_0xa952('0x46')](_0xa952('0xa7'),_0x44da69[_0xa952('0xa5')][_0xa952('0xa6')]())[_0xa952('0x46')]('phone\x20IS\x20NOT\x20NULL'))[_0xa952('0xa6')]();_0x244d62['push'](db[_0xa952('0x71')][_0xa952('0x3d')](_0x2fb4a1));}return BPromise[_0xa952('0x8e')](_0x244d62);}})[_0xa952('0x26')](function(){return _0x2083a1;})[_0xa952('0x26')](respondWithResult(_0x540b29,null))[_0xa952('0x50')](handleError(_0x540b29,null));};exports[_0xa952('0xb6')]=function(_0x41be0c,_0x54bcc8,_0x262152){return db[_0xa952('0x37')]['find']({'where':{'id':_0x41be0c['params']['id']}})['then'](handleEntityNotFound(_0x54bcc8,null))['then'](function(_0x32a940){if(_0x32a940){return _0x32a940['removeBlackLists'](_0x41be0c['query'][_0xa952('0x7f')]);}})[_0xa952('0x26')](function(_0x2857d8){if(_0x2857d8){return db[_0xa952('0x69')][_0xa952('0x27')]({'where':{'ListId':_0x41be0c[_0xa952('0x3d')][_0xa952('0x7f')],'VoiceQueueId':_0x41be0c['params']['id']}})[_0xa952('0x26')](function(){return _0x2857d8;});}})['then'](respondWithStatusCode(_0x54bcc8,null))[_0xa952('0x50')](handleError(_0x54bcc8,null));}; \ No newline at end of file +var _0x1b3a=['catch','show','VoiceQueue','include','create','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','updatedAt','body','omit','createdAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','getHoppers','findOne','CmHopper','pick','CmHopperHistory','getHopperFinals','CmHopperFinal','VoiceQueueId','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','User','Agents','voicePause','interface','flatMap','penalty','sequelize','each','findOrCreate','UserVoiceQueueRt','upsert','isNil','SIP/%s','forEach','removeTeams','ids','field','tq.TeamId','from','VoiceQueueId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','all','union','isEmpty','addAgents','spread','emit','online','format','removeAgents','isArray','userVoiceQueue:remove','getAgents','getMembers','getLists','addLists','dialCheckDuplicateType','always','insert','into','phone','scheduledAt','ContactId','select','NOW()','CmListId','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','cm_hopper','onlyIfOpen','fromQuery','ListId','phone\x20IS\x20NOT\x20NULL','getBlackLists','CmList','addBlackLists','cm_hopper_black','push','removeBlackLists','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./voiceQueue.socket','register','status','json','count','offset','limit','Content-Range','apply','reject','save','destroy','then','get','VoiceQueues','inbound','QueueCampaigns','outbound','ignore','map','value','includes','type','find','name','UserProfileResource','sendStatus','error','stack','send','index','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','findAll','rows'];(function(_0x1a9b87,_0x4b9987){var _0x3e5a50=function(_0x488ffa){while(--_0x488ffa){_0x1a9b87['push'](_0x1a9b87['shift']());}};_0x3e5a50(++_0x4b9987);}(_0x1b3a,0x119));var _0xa1b3=function(_0x4f6115,_0x25a208){_0x4f6115=_0x4f6115-0x0;var _0x4ab0dd=_0x1b3a[_0x4f6115];return _0x4ab0dd;};'use strict';var pdf=require(_0xa1b3('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xa1b3('0x1'));var zipdir=require(_0xa1b3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa1b3('0x3'));var moment=require(_0xa1b3('0x4'));var BPromise=require(_0xa1b3('0x5'));var Mustache=require(_0xa1b3('0x6'));var util=require(_0xa1b3('0x7'));var path=require(_0xa1b3('0x8'));var sox=require(_0xa1b3('0x9'));var csv=require(_0xa1b3('0xa'));var ejs=require(_0xa1b3('0xb'));var fs=require('fs');var _=require(_0xa1b3('0xc'));var squel=require(_0xa1b3('0xd'));var crypto=require(_0xa1b3('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xa1b3('0xf'));var toCsv=require(_0xa1b3('0xa'));var querystring=require(_0xa1b3('0x10'));var Papa=require(_0xa1b3('0x11'));var Redis=require(_0xa1b3('0x12'));var authService=require(_0xa1b3('0x13'));var qs=require(_0xa1b3('0x14'));var as=require(_0xa1b3('0x15'));var hardwareService=require(_0xa1b3('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0xa1b3('0x17'));var config=require('../../config/environment');var db=require(_0xa1b3('0x18'))['db'];config['redis']=_[_0xa1b3('0x19')](config[_0xa1b3('0x1a')],{'host':_0xa1b3('0x1b'),'port':0x18eb});var socket=require(_0xa1b3('0x1c'))(new Redis(config[_0xa1b3('0x1a')]));require(_0xa1b3('0x1d'))[_0xa1b3('0x1e')](socket);function respondWithStatusCode(_0x44a6b8,_0x46a214){_0x46a214=_0x46a214||0xcc;return function(_0x44dffc){if(_0x44dffc){return _0x44a6b8['sendStatus'](_0x46a214);}return _0x44a6b8['status'](_0x46a214)['end']();};}function respondWithResult(_0x5d6619,_0x16d4b6){_0x16d4b6=_0x16d4b6||0xc8;return function(_0x3aa2dd){if(_0x3aa2dd){return _0x5d6619[_0xa1b3('0x1f')](_0x16d4b6)[_0xa1b3('0x20')](_0x3aa2dd);}};}function respondWithFilteredResult(_0x3c74cf,_0x4fe198){return function(_0x1643cc){if(_0x1643cc){var _0x5931e7=_0x1643cc[_0xa1b3('0x21')],_0x47e250=_0x4fe198[_0xa1b3('0x22')],_0x5f3a3a=_0x4fe198[_0xa1b3('0x22')]+_0x4fe198[_0xa1b3('0x23')],_0x43e9c8;if(_0x5f3a3a>=_0x5931e7){_0x5f3a3a=_0x5931e7;_0x43e9c8=0xc8;}else{_0x43e9c8=0xce;}_0x3c74cf[_0xa1b3('0x1f')](_0x43e9c8);return _0x3c74cf['set'](_0xa1b3('0x24'),_0x47e250+'-'+_0x5f3a3a+'/'+_0x5931e7)['json'](_0x1643cc);}return null;};}function patchUpdates(_0x9cef3c){return function(_0x4ab56c){try{jsonpatch[_0xa1b3('0x25')](_0x4ab56c,_0x9cef3c,!![]);}catch(_0x1ea7a1){return BPromise[_0xa1b3('0x26')](_0x1ea7a1);}return _0x4ab56c[_0xa1b3('0x27')]();};}function saveUpdates(_0x5a54d2,_0x1a7edd){return function(_0x265be9){if(_0x265be9){return _0x265be9['update'](_0x5a54d2)['then'](function(_0x2ff148){return _0x2ff148;});}return null;};}function removeEntity(_0x3659f7,_0x10eb15){return function(_0x256666){if(_0x256666){return _0x256666[_0xa1b3('0x28')]()[_0xa1b3('0x29')](function(){var _0x275e44=_0x256666[_0xa1b3('0x2a')]({'plain':!![]});var _0x244cd8=[{'name':_0xa1b3('0x2b'),'value':_0xa1b3('0x2c'),'ignore':![]},{'name':_0xa1b3('0x2d'),'value':_0xa1b3('0x2e'),'ignore':![]}];var _0x23b3ae=_(_0x244cd8)['filter'](_0xa1b3('0x2f'))[_0xa1b3('0x30')](_0xa1b3('0x31'))[_0xa1b3('0x31')]();if(_[_0xa1b3('0x32')](_0x23b3ae,_0x275e44[_0xa1b3('0x33')])){return;}var _0x322fef=_[_0xa1b3('0x34')](_0x244cd8,[_0xa1b3('0x31'),_0x275e44[_0xa1b3('0x33')]])[_0xa1b3('0x35')];return db[_0xa1b3('0x36')]['destroy']({'where':{'type':_0x322fef,'resourceId':_0x275e44['id']}})[_0xa1b3('0x29')](function(){return _0x256666;});})[_0xa1b3('0x29')](function(){_0x3659f7[_0xa1b3('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59a30a,_0x394d39){return function(_0x380c0b){if(!_0x380c0b){_0x59a30a[_0xa1b3('0x37')](0x194);}return _0x380c0b;};}function handleError(_0x36fd2c,_0xca7484){_0xca7484=_0xca7484||0x1f4;return function(_0x576946){logger[_0xa1b3('0x38')](_0x576946[_0xa1b3('0x39')]);if(_0x576946['name']){delete _0x576946[_0xa1b3('0x35')];}_0x36fd2c[_0xa1b3('0x1f')](_0xca7484)[_0xa1b3('0x3a')](_0x576946);};}exports[_0xa1b3('0x3b')]=function(_0xf38cfe,_0x28900f){var _0x22ebc9={},_0x13407b={},_0x43f9b6={'count':0x0,'rows':[]};var _0x349c5d=_[_0xa1b3('0x30')](db['VoiceQueue'][_0xa1b3('0x3c')],function(_0x147e1e){return{'name':_0x147e1e[_0xa1b3('0x3d')],'type':_0x147e1e[_0xa1b3('0x33')][_0xa1b3('0x3e')]};});_0x13407b[_0xa1b3('0x3f')]=_[_0xa1b3('0x30')](_0x349c5d,_0xa1b3('0x35'));_0x13407b[_0xa1b3('0x40')]=_[_0xa1b3('0x41')](_0xf38cfe['query']);_0x13407b['filters']=_[_0xa1b3('0x42')](_0x13407b['model'],_0x13407b['query']);_0x22ebc9['attributes']=_[_0xa1b3('0x42')](_0x13407b['model'],qs[_0xa1b3('0x43')](_0xf38cfe['query'][_0xa1b3('0x43')]));_0x22ebc9[_0xa1b3('0x44')]=_0x22ebc9[_0xa1b3('0x44')][_0xa1b3('0x45')]?_0x22ebc9[_0xa1b3('0x44')]:_0x13407b[_0xa1b3('0x3f')];if(!_0xf38cfe[_0xa1b3('0x40')][_0xa1b3('0x46')](_0xa1b3('0x47'))){_0x22ebc9[_0xa1b3('0x23')]=qs[_0xa1b3('0x23')](_0xf38cfe[_0xa1b3('0x40')]['limit']);_0x22ebc9[_0xa1b3('0x22')]=qs['offset'](_0xf38cfe[_0xa1b3('0x40')]['offset']);}_0x22ebc9[_0xa1b3('0x48')]=qs[_0xa1b3('0x49')](_0xf38cfe['query']['sort']);_0x22ebc9[_0xa1b3('0x4a')]=qs['filters'](_['pick'](_0xf38cfe[_0xa1b3('0x40')],_0x13407b[_0xa1b3('0x4b')]),_0x349c5d);if(_0xf38cfe[_0xa1b3('0x40')][_0xa1b3('0x4c')]){_0x22ebc9[_0xa1b3('0x4a')]=_[_0xa1b3('0x4d')](_0x22ebc9['where'],{'$or':_[_0xa1b3('0x30')](_0x349c5d,function(_0x38fe14){if(_0x38fe14['type']!==_0xa1b3('0x4e')){var _0x3c983f={};_0x3c983f[_0x38fe14[_0xa1b3('0x35')]]={'$like':'%'+_0xf38cfe[_0xa1b3('0x40')][_0xa1b3('0x4c')]+'%'};return _0x3c983f;}})});}_0x22ebc9=_[_0xa1b3('0x4d')]({},_0x22ebc9,_0xf38cfe[_0xa1b3('0x4f')]);var _0x305d94={'where':_0x22ebc9[_0xa1b3('0x4a')]};return db['VoiceQueue'][_0xa1b3('0x21')](_0x305d94)[_0xa1b3('0x29')](function(_0x3859ba){_0x43f9b6[_0xa1b3('0x21')]=_0x3859ba;if(_0xf38cfe[_0xa1b3('0x40')][_0xa1b3('0x50')]){_0x22ebc9['include']=[{'all':!![]}];}return db['VoiceQueue'][_0xa1b3('0x51')](_0x22ebc9);})[_0xa1b3('0x29')](function(_0x4f78b2){_0x43f9b6[_0xa1b3('0x52')]=_0x4f78b2;return _0x43f9b6;})[_0xa1b3('0x29')](respondWithFilteredResult(_0x28900f,_0x22ebc9))[_0xa1b3('0x53')](handleError(_0x28900f,null));};exports[_0xa1b3('0x54')]=function(_0x54a6c9,_0x240dd1){var _0x4a12c6={'raw':![],'where':{'id':_0x54a6c9['params']['id']}},_0x5c3dc5={};_0x5c3dc5[_0xa1b3('0x3f')]=_[_0xa1b3('0x41')](db[_0xa1b3('0x55')]['rawAttributes']);_0x5c3dc5[_0xa1b3('0x40')]=_[_0xa1b3('0x41')](_0x54a6c9[_0xa1b3('0x40')]);_0x5c3dc5['filters']=_['intersection'](_0x5c3dc5[_0xa1b3('0x3f')],_0x5c3dc5[_0xa1b3('0x40')]);_0x4a12c6[_0xa1b3('0x44')]=_[_0xa1b3('0x42')](_0x5c3dc5[_0xa1b3('0x3f')],qs[_0xa1b3('0x43')](_0x54a6c9['query']['fields']));_0x4a12c6[_0xa1b3('0x44')]=_0x4a12c6[_0xa1b3('0x44')][_0xa1b3('0x45')]?_0x4a12c6[_0xa1b3('0x44')]:_0x5c3dc5[_0xa1b3('0x3f')];if(_0x54a6c9[_0xa1b3('0x40')]['includeAll']){_0x4a12c6[_0xa1b3('0x56')]=[{'all':!![]}];}_0x4a12c6=_['merge']({},_0x4a12c6,_0x54a6c9['options']);return db['VoiceQueue'][_0xa1b3('0x34')](_0x4a12c6)[_0xa1b3('0x29')](handleEntityNotFound(_0x240dd1,null))[_0xa1b3('0x29')](respondWithResult(_0x240dd1,null))[_0xa1b3('0x53')](handleError(_0x240dd1,null));};exports[_0xa1b3('0x57')]=function(_0x58f6cc,_0x2d4a94){return db[_0xa1b3('0x55')]['create'](_0x58f6cc['body'],{})[_0xa1b3('0x29')](function(_0x5bdf14){var _0x159644=_0x58f6cc[_0xa1b3('0x58')]['get']({'plain':!![]});if(!_0x159644)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x159644['role']===_0xa1b3('0x58')){var _0x534d49=_0x5bdf14['get']({'plain':!![]});var _0x2038df=[{'name':_0xa1b3('0x2b'),'value':_0xa1b3('0x2c')},{'name':_0xa1b3('0x2d'),'value':_0xa1b3('0x2e')}];var _0x219828=_[_0xa1b3('0x34')](_0x2038df,[_0xa1b3('0x31'),_0x534d49[_0xa1b3('0x33')]])[_0xa1b3('0x35')];return db[_0xa1b3('0x59')][_0xa1b3('0x34')]({'where':{'name':_0x219828,'userProfileId':_0x159644[_0xa1b3('0x5a')]},'raw':!![]})[_0xa1b3('0x29')](function(_0x10db15){if(_0x10db15&&_0x10db15[_0xa1b3('0x5b')]===0x0){return db['UserProfileResource'][_0xa1b3('0x57')]({'name':_0x534d49[_0xa1b3('0x35')],'resourceId':_0x534d49['id'],'type':_0x10db15[_0xa1b3('0x35')],'sectionId':_0x10db15['id']},{})[_0xa1b3('0x29')](function(){return _0x5bdf14;});}else{return _0x5bdf14;}})[_0xa1b3('0x53')](function(_0x5c4bd6){logger[_0xa1b3('0x38')](_0xa1b3('0x5c'),_0x5c4bd6);throw _0x5c4bd6;});}return _0x5bdf14;})[_0xa1b3('0x29')](respondWithResult(_0x2d4a94,0xc9))[_0xa1b3('0x53')](handleError(_0x2d4a94,null));};exports[_0xa1b3('0x5d')]=function(_0x52f0cd,_0x224c71){var _0x20a8f8={'where':{'id':_0x52f0cd[_0xa1b3('0x5e')]['id']}},_0x54517b={};_0x54517b['model']=_[_0xa1b3('0x41')](db[_0xa1b3('0x55')][_0xa1b3('0x3c')]);_0x20a8f8['attributes']=_['intersection'](_0x54517b[_0xa1b3('0x3f')],qs['fields'](_0x52f0cd[_0xa1b3('0x40')]['fields']));_0x20a8f8[_0xa1b3('0x44')]=_0x20a8f8[_0xa1b3('0x44')]['length']?_0x20a8f8[_0xa1b3('0x44')]:_0x54517b[_0xa1b3('0x3f')];if(_0x52f0cd['query'][_0xa1b3('0x50')]){_0x20a8f8[_0xa1b3('0x56')]=[{'all':!![]}];}_0x20a8f8=_[_0xa1b3('0x4d')]({},_0x20a8f8,_0x52f0cd[_0xa1b3('0x4f')]);return db['VoiceQueue'][_0xa1b3('0x34')](_0x20a8f8)[_0xa1b3('0x29')](handleEntityNotFound(_0x224c71,null))[_0xa1b3('0x29')](function(_0x596d25){if(_0x596d25){var _0xae5f84=_0x596d25[_0xa1b3('0x2a')]({'plain':!![]});_0xae5f84=qs['omit'](_0xae5f84,['id','createdAt',_0xa1b3('0x5f')]);_0x52f0cd[_0xa1b3('0x60')]=_[_0xa1b3('0x61')](_0x52f0cd[_0xa1b3('0x60')],['id',_0xa1b3('0x62'),_0xa1b3('0x5f')]);return db[_0xa1b3('0x55')]['create'](_[_0xa1b3('0x4d')](_0xae5f84,_0x52f0cd[_0xa1b3('0x60')]),{'include':_0x52f0cd['query'][_0xa1b3('0x50')]?[{'all':!![]}]:undefined})[_0xa1b3('0x29')](function(_0x4b956d){var _0x37f789=_0x52f0cd[_0xa1b3('0x58')][_0xa1b3('0x2a')]({'plain':!![]});if(!_0x37f789)throw new Error(_0xa1b3('0x63'));if(_0x37f789[_0xa1b3('0x64')]==='user'){var _0x4e5ca6=_0x4b956d[_0xa1b3('0x2a')]({'plain':!![]});var _0x366c4e=[{'name':'VoiceQueues','value':_0xa1b3('0x2c')},{'name':_0xa1b3('0x2d'),'value':_0xa1b3('0x2e')}];var _0x4456a0=_[_0xa1b3('0x34')](_0x366c4e,[_0xa1b3('0x31'),_0x4e5ca6[_0xa1b3('0x33')]])[_0xa1b3('0x35')];return db[_0xa1b3('0x59')]['find']({'where':{'name':_0x4456a0,'userProfileId':_0x37f789[_0xa1b3('0x5a')]},'raw':!![]})[_0xa1b3('0x29')](function(_0x10be57){if(_0x10be57&&_0x10be57[_0xa1b3('0x5b')]===0x0){return db['UserProfileResource'][_0xa1b3('0x57')]({'name':_0x4e5ca6['name'],'resourceId':_0x4e5ca6['id'],'type':_0x10be57[_0xa1b3('0x35')],'sectionId':_0x10be57['id']},{})['then'](function(){return _0x4b956d;});}else{return _0x4b956d;}})[_0xa1b3('0x53')](function(_0x535bdd){logger[_0xa1b3('0x38')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x535bdd);throw _0x535bdd;});}return _0x4b956d;});}})[_0xa1b3('0x29')](respondWithResult(_0x224c71,0xc9))[_0xa1b3('0x53')](handleError(_0x224c71,null));};exports['update']=function(_0x23d088,_0x5cee07){if(_0x23d088['body']['id']){delete _0x23d088[_0xa1b3('0x60')]['id'];}return db['VoiceQueue'][_0xa1b3('0x34')]({'where':{'id':_0x23d088['params']['id']}})[_0xa1b3('0x29')](handleEntityNotFound(_0x5cee07,null))[_0xa1b3('0x29')](saveUpdates(_0x23d088[_0xa1b3('0x60')],null))[_0xa1b3('0x29')](respondWithResult(_0x5cee07,null))['catch'](handleError(_0x5cee07,null));};exports[_0xa1b3('0x28')]=function(_0x36319e,_0x41e254){return db[_0xa1b3('0x55')]['find']({'where':{'id':_0x36319e[_0xa1b3('0x5e')]['id']}})['then'](handleEntityNotFound(_0x41e254,null))[_0xa1b3('0x29')](removeEntity(_0x41e254,null))[_0xa1b3('0x53')](handleError(_0x41e254,null));};exports[_0xa1b3('0x65')]=function(_0xf88525,_0x35afad,_0x29a2b5){var _0x173751={'raw':![],'where':{}};var _0x1ca05f={};var _0x4f9d87={'count':0x0,'rows':[]};return db[_0xa1b3('0x55')][_0xa1b3('0x66')]({'where':{'id':_0xf88525[_0xa1b3('0x5e')]['id']}})[_0xa1b3('0x29')](handleEntityNotFound(_0x35afad,null))[_0xa1b3('0x29')](function(_0x3f5cca){if(_0x3f5cca){_0x1ca05f[_0xa1b3('0x3f')]=_[_0xa1b3('0x41')](db[_0xa1b3('0x67')][_0xa1b3('0x3c')]);_0x1ca05f['query']=_['keys'](_0xf88525[_0xa1b3('0x40')]);_0x1ca05f[_0xa1b3('0x4b')]=_['intersection'](_0x1ca05f[_0xa1b3('0x3f')],_0x1ca05f[_0xa1b3('0x40')]);_0x173751[_0xa1b3('0x44')]=_[_0xa1b3('0x42')](_0x1ca05f['model'],qs['fields'](_0xf88525['query'][_0xa1b3('0x43')]));_0x173751['attributes']=_0x173751[_0xa1b3('0x44')]['length']?_0x173751['attributes']:_0x1ca05f[_0xa1b3('0x3f')];if(!_0xf88525['query'][_0xa1b3('0x46')](_0xa1b3('0x47'))){_0x173751[_0xa1b3('0x23')]=qs[_0xa1b3('0x23')](_0xf88525[_0xa1b3('0x40')][_0xa1b3('0x23')]);_0x173751[_0xa1b3('0x22')]=qs[_0xa1b3('0x22')](_0xf88525[_0xa1b3('0x40')][_0xa1b3('0x22')]);}_0x173751[_0xa1b3('0x48')]=qs[_0xa1b3('0x49')](_0xf88525[_0xa1b3('0x40')][_0xa1b3('0x49')]);_0x173751[_0xa1b3('0x4a')]=qs[_0xa1b3('0x4b')](_[_0xa1b3('0x68')](_0xf88525[_0xa1b3('0x40')],_0x1ca05f[_0xa1b3('0x4b')]));_0x173751[_0xa1b3('0x4a')]['VoiceQueueId']=_0x3f5cca['id'];if(_0xf88525[_0xa1b3('0x40')][_0xa1b3('0x4c')]){_0x173751[_0xa1b3('0x4a')]=_[_0xa1b3('0x4d')](_0x173751['where'],{'$or':_[_0xa1b3('0x30')](_0x173751[_0xa1b3('0x44')],function(_0x322f91){var _0x3c08bd={};_0x3c08bd[_0x322f91]={'$like':'%'+_0xf88525[_0xa1b3('0x40')][_0xa1b3('0x4c')]+'%'};return _0x3c08bd;})});}_0x173751=_[_0xa1b3('0x4d')]({},_0x173751,_0xf88525[_0xa1b3('0x4f')]);return db['CmHopper'][_0xa1b3('0x21')]({'where':_0x173751[_0xa1b3('0x4a')]})[_0xa1b3('0x29')](function(_0x5be565){_0x4f9d87['count']=_0x5be565;if(_0xf88525[_0xa1b3('0x40')][_0xa1b3('0x50')]){_0x173751[_0xa1b3('0x56')]=[{'all':!![]}];}return db['CmHopper'][_0xa1b3('0x51')](_0x173751);})[_0xa1b3('0x29')](function(_0x16325f){_0x4f9d87[_0xa1b3('0x52')]=_0x16325f;return _0x4f9d87;});}})['then'](respondWithFilteredResult(_0x35afad,_0x173751))[_0xa1b3('0x53')](handleError(_0x35afad,null));};exports['getHopperHistories']=function(_0x220e13,_0x1cd57e,_0x39bcbd){var _0x524c71={'raw':!![],'where':{}};var _0xc7558={};var _0x101933={'count':0x0,'rows':[]};return db[_0xa1b3('0x55')][_0xa1b3('0x66')]({'where':{'id':_0x220e13['params']['id']}})[_0xa1b3('0x29')](handleEntityNotFound(_0x1cd57e,null))[_0xa1b3('0x29')](function(_0x31a1b8){if(_0x31a1b8){_0xc7558[_0xa1b3('0x3f')]=_['keys'](db[_0xa1b3('0x69')]['rawAttributes']);_0xc7558[_0xa1b3('0x40')]=_[_0xa1b3('0x41')](_0x220e13[_0xa1b3('0x40')]);_0xc7558['filters']=_[_0xa1b3('0x42')](_0xc7558['model'],_0xc7558['query']);_0x524c71[_0xa1b3('0x44')]=_[_0xa1b3('0x42')](_0xc7558[_0xa1b3('0x3f')],qs[_0xa1b3('0x43')](_0x220e13[_0xa1b3('0x40')][_0xa1b3('0x43')]));_0x524c71[_0xa1b3('0x44')]=_0x524c71[_0xa1b3('0x44')]['length']?_0x524c71['attributes']:_0xc7558[_0xa1b3('0x3f')];if(!_0x220e13[_0xa1b3('0x40')][_0xa1b3('0x46')](_0xa1b3('0x47'))){_0x524c71[_0xa1b3('0x23')]=qs[_0xa1b3('0x23')](_0x220e13['query']['limit']);_0x524c71[_0xa1b3('0x22')]=qs[_0xa1b3('0x22')](_0x220e13['query'][_0xa1b3('0x22')]);}_0x524c71[_0xa1b3('0x48')]=qs['sort'](_0x220e13[_0xa1b3('0x40')][_0xa1b3('0x49')]);_0x524c71[_0xa1b3('0x4a')]=qs[_0xa1b3('0x4b')](_[_0xa1b3('0x68')](_0x220e13['query'],_0xc7558[_0xa1b3('0x4b')]));_0x524c71[_0xa1b3('0x4a')]['VoiceQueueId']=_0x31a1b8['id'];if(_0x220e13['query'][_0xa1b3('0x4c')]){_0x524c71[_0xa1b3('0x4a')]=_[_0xa1b3('0x4d')](_0x524c71[_0xa1b3('0x4a')],{'$or':_[_0xa1b3('0x30')](_0x524c71[_0xa1b3('0x44')],function(_0x58f3f6){var _0x27aab4={};_0x27aab4[_0x58f3f6]={'$like':'%'+_0x220e13[_0xa1b3('0x40')][_0xa1b3('0x4c')]+'%'};return _0x27aab4;})});}_0x524c71=_['merge']({},_0x524c71,_0x220e13['options']);return db['CmHopperHistory'][_0xa1b3('0x21')]({'where':_0x524c71[_0xa1b3('0x4a')]})[_0xa1b3('0x29')](function(_0x4f400d){_0x101933[_0xa1b3('0x21')]=_0x4f400d;if(_0x220e13[_0xa1b3('0x40')][_0xa1b3('0x50')]){_0x524c71[_0xa1b3('0x56')]=[{'all':!![]}];}return db[_0xa1b3('0x69')][_0xa1b3('0x51')](_0x524c71);})['then'](function(_0x4fa8ae){_0x101933[_0xa1b3('0x52')]=_0x4fa8ae;return _0x101933;});}})[_0xa1b3('0x29')](respondWithFilteredResult(_0x1cd57e,_0x524c71))[_0xa1b3('0x53')](handleError(_0x1cd57e,null));};exports[_0xa1b3('0x6a')]=function(_0x4d0bb7,_0x1938ee,_0x242fc6){var _0x153b88={'raw':!![],'where':{}};var _0x122262={};var _0x164193={'count':0x0,'rows':[]};return db[_0xa1b3('0x55')][_0xa1b3('0x66')]({'where':{'id':_0x4d0bb7[_0xa1b3('0x5e')]['id']}})[_0xa1b3('0x29')](handleEntityNotFound(_0x1938ee,null))[_0xa1b3('0x29')](function(_0x11ad9b){if(_0x11ad9b){_0x122262['model']=_[_0xa1b3('0x41')](db[_0xa1b3('0x6b')][_0xa1b3('0x3c')]);_0x122262['query']=_[_0xa1b3('0x41')](_0x4d0bb7['query']);_0x122262[_0xa1b3('0x4b')]=_[_0xa1b3('0x42')](_0x122262[_0xa1b3('0x3f')],_0x122262['query']);_0x153b88[_0xa1b3('0x44')]=_[_0xa1b3('0x42')](_0x122262['model'],qs[_0xa1b3('0x43')](_0x4d0bb7[_0xa1b3('0x40')][_0xa1b3('0x43')]));_0x153b88[_0xa1b3('0x44')]=_0x153b88[_0xa1b3('0x44')]['length']?_0x153b88[_0xa1b3('0x44')]:_0x122262[_0xa1b3('0x3f')];if(!_0x4d0bb7[_0xa1b3('0x40')][_0xa1b3('0x46')](_0xa1b3('0x47'))){_0x153b88['limit']=qs[_0xa1b3('0x23')](_0x4d0bb7[_0xa1b3('0x40')][_0xa1b3('0x23')]);_0x153b88[_0xa1b3('0x22')]=qs[_0xa1b3('0x22')](_0x4d0bb7[_0xa1b3('0x40')][_0xa1b3('0x22')]);}_0x153b88['order']=qs[_0xa1b3('0x49')](_0x4d0bb7[_0xa1b3('0x40')][_0xa1b3('0x49')]);_0x153b88[_0xa1b3('0x4a')]=qs[_0xa1b3('0x4b')](_['pick'](_0x4d0bb7[_0xa1b3('0x40')],_0x122262[_0xa1b3('0x4b')]));_0x153b88[_0xa1b3('0x4a')][_0xa1b3('0x6c')]=_0x11ad9b['id'];if(_0x4d0bb7[_0xa1b3('0x40')][_0xa1b3('0x4c')]){_0x153b88[_0xa1b3('0x4a')]=_['merge'](_0x153b88['where'],{'$or':_['map'](_0x153b88[_0xa1b3('0x44')],function(_0x3b2864){var _0x3926af={};_0x3926af[_0x3b2864]={'$like':'%'+_0x4d0bb7[_0xa1b3('0x40')]['filter']+'%'};return _0x3926af;})});}_0x153b88=_[_0xa1b3('0x4d')]({},_0x153b88,_0x4d0bb7[_0xa1b3('0x4f')]);return db[_0xa1b3('0x6b')][_0xa1b3('0x21')]({'where':_0x153b88[_0xa1b3('0x4a')]})[_0xa1b3('0x29')](function(_0x1a40ba){_0x164193[_0xa1b3('0x21')]=_0x1a40ba;if(_0x4d0bb7[_0xa1b3('0x40')][_0xa1b3('0x50')]){_0x153b88[_0xa1b3('0x56')]=[{'all':!![]}];}return db['CmHopperFinal'][_0xa1b3('0x51')](_0x153b88);})[_0xa1b3('0x29')](function(_0x3afa1f){_0x164193['rows']=_0x3afa1f;return _0x164193;});}})[_0xa1b3('0x29')](respondWithFilteredResult(_0x1938ee,_0x153b88))[_0xa1b3('0x53')](handleError(_0x1938ee,null));};exports[_0xa1b3('0x6d')]=function(_0x148b79,_0x52523c,_0x56d89a){var _0x32d1f8={'raw':!![],'where':{}};var _0x223c27={};var _0x191b3e={'count':0x0,'rows':[]};return db[_0xa1b3('0x55')][_0xa1b3('0x66')]({'where':{'id':_0x148b79['params']['id']}})[_0xa1b3('0x29')](handleEntityNotFound(_0x52523c,null))[_0xa1b3('0x29')](function(_0x30b83d){if(_0x30b83d){_0x223c27[_0xa1b3('0x3f')]=_['keys'](db[_0xa1b3('0x6e')][_0xa1b3('0x3c')]);_0x223c27['query']=_[_0xa1b3('0x41')](_0x148b79[_0xa1b3('0x40')]);_0x223c27[_0xa1b3('0x4b')]=_[_0xa1b3('0x42')](_0x223c27[_0xa1b3('0x3f')],_0x223c27['query']);_0x32d1f8[_0xa1b3('0x44')]=_['intersection'](_0x223c27[_0xa1b3('0x3f')],qs[_0xa1b3('0x43')](_0x148b79[_0xa1b3('0x40')][_0xa1b3('0x43')]));_0x32d1f8[_0xa1b3('0x44')]=_0x32d1f8['attributes'][_0xa1b3('0x45')]?_0x32d1f8[_0xa1b3('0x44')]:_0x223c27[_0xa1b3('0x3f')];if(!_0x148b79[_0xa1b3('0x40')]['hasOwnProperty'](_0xa1b3('0x47'))){_0x32d1f8['limit']=qs['limit'](_0x148b79[_0xa1b3('0x40')][_0xa1b3('0x23')]);_0x32d1f8[_0xa1b3('0x22')]=qs['offset'](_0x148b79[_0xa1b3('0x40')][_0xa1b3('0x22')]);}_0x32d1f8['order']=qs[_0xa1b3('0x49')](_0x148b79['query'][_0xa1b3('0x49')]);_0x32d1f8['where']=qs[_0xa1b3('0x4b')](_[_0xa1b3('0x68')](_0x148b79[_0xa1b3('0x40')],_0x223c27[_0xa1b3('0x4b')]));_0x32d1f8[_0xa1b3('0x4a')][_0xa1b3('0x6c')]=_0x30b83d['id'];if(_0x148b79[_0xa1b3('0x40')]['filter']){_0x32d1f8[_0xa1b3('0x4a')]=_['merge'](_0x32d1f8[_0xa1b3('0x4a')],{'$or':_[_0xa1b3('0x30')](_0x32d1f8[_0xa1b3('0x44')],function(_0x118b2c){var _0x5c89b7={};_0x5c89b7[_0x118b2c]={'$like':'%'+_0x148b79[_0xa1b3('0x40')][_0xa1b3('0x4c')]+'%'};return _0x5c89b7;})});}_0x32d1f8=_[_0xa1b3('0x4d')]({},_0x32d1f8,_0x148b79[_0xa1b3('0x4f')]);return db[_0xa1b3('0x6e')][_0xa1b3('0x21')]({'where':_0x32d1f8[_0xa1b3('0x4a')]})[_0xa1b3('0x29')](function(_0xb2c74c){_0x191b3e['count']=_0xb2c74c;if(_0x148b79[_0xa1b3('0x40')][_0xa1b3('0x50')]){_0x32d1f8[_0xa1b3('0x56')]=[{'all':!![]}];}return db['CmHopperBlack']['findAll'](_0x32d1f8);})[_0xa1b3('0x29')](function(_0x33de2c){_0x191b3e[_0xa1b3('0x52')]=_0x33de2c;return _0x191b3e;});}})['then'](respondWithFilteredResult(_0x52523c,_0x32d1f8))['catch'](handleError(_0x52523c,null));};exports[_0xa1b3('0x6f')]=function(_0x1a1199,_0x242b72,_0x4e1f7e){var _0x386ba6={};var _0x18b5c1={};var _0x34cb87;var _0x1f421d;return db['VoiceQueue'][_0xa1b3('0x66')]({'where':{'id':_0x1a1199['params']['id']}})[_0xa1b3('0x29')](handleEntityNotFound(_0x242b72,null))[_0xa1b3('0x29')](function(_0xacc834){if(_0xacc834){_0x34cb87=_0xacc834;_0x18b5c1[_0xa1b3('0x3f')]=_[_0xa1b3('0x41')](db[_0xa1b3('0x70')][_0xa1b3('0x3c')]);_0x18b5c1[_0xa1b3('0x40')]=_[_0xa1b3('0x41')](_0x1a1199[_0xa1b3('0x40')]);_0x18b5c1[_0xa1b3('0x4b')]=_[_0xa1b3('0x42')](_0x18b5c1[_0xa1b3('0x3f')],_0x18b5c1['query']);_0x386ba6[_0xa1b3('0x44')]=_[_0xa1b3('0x42')](_0x18b5c1[_0xa1b3('0x3f')],qs[_0xa1b3('0x43')](_0x1a1199[_0xa1b3('0x40')][_0xa1b3('0x43')]));_0x386ba6[_0xa1b3('0x44')]=_0x386ba6[_0xa1b3('0x44')][_0xa1b3('0x45')]?_0x386ba6[_0xa1b3('0x44')]:_0x18b5c1[_0xa1b3('0x3f')];_0x386ba6[_0xa1b3('0x48')]=qs['sort'](_0x1a1199[_0xa1b3('0x40')][_0xa1b3('0x49')]);_0x386ba6[_0xa1b3('0x4a')]=qs[_0xa1b3('0x4b')](_[_0xa1b3('0x68')](_0x1a1199[_0xa1b3('0x40')],_0x18b5c1['filters']));if(_0x1a1199['query'][_0xa1b3('0x4c')]){_0x386ba6[_0xa1b3('0x4a')]=_[_0xa1b3('0x4d')](_0x386ba6['where'],{'$or':_[_0xa1b3('0x30')](_0x386ba6[_0xa1b3('0x44')],function(_0x329821){var _0x20c4c1={};_0x20c4c1[_0x329821]={'$like':'%'+_0x1a1199[_0xa1b3('0x40')]['filter']+'%'};return _0x20c4c1;})});}_0x386ba6=_[_0xa1b3('0x4d')]({},_0x386ba6,_0x1a1199['options']);return _0x34cb87[_0xa1b3('0x6f')](_0x386ba6);}})[_0xa1b3('0x29')](function(_0x22a8ec){if(_0x22a8ec){_0x1f421d=_0x22a8ec['length'];if(!_0x1a1199[_0xa1b3('0x40')][_0xa1b3('0x46')](_0xa1b3('0x47'))){_0x386ba6[_0xa1b3('0x23')]=qs[_0xa1b3('0x23')](_0x1a1199[_0xa1b3('0x40')][_0xa1b3('0x23')]);_0x386ba6[_0xa1b3('0x22')]=qs[_0xa1b3('0x22')](_0x1a1199[_0xa1b3('0x40')]['offset']);}return _0x34cb87['getTeams'](_0x386ba6);}})[_0xa1b3('0x29')](function(_0x4c3c23){if(_0x4c3c23){return _0x4c3c23?{'count':_0x1f421d,'rows':_0x4c3c23}:null;}})[_0xa1b3('0x29')](respondWithResult(_0x242b72,null))[_0xa1b3('0x53')](handleError(_0x242b72,null));};exports[_0xa1b3('0x71')]=function(_0x5e4015,_0x15cd75,_0x5d8fde){var _0x47de62=_0x5e4015['body']['teams'];var _0x214cf5=_[_0xa1b3('0x30')](_0x47de62,'id');return db[_0xa1b3('0x70')][_0xa1b3('0x51')]({'where':{'id':_0x214cf5},'attributes':['id'],'include':[{'model':db[_0xa1b3('0x72')],'as':_0xa1b3('0x73'),'attributes':['id','name','online',_0xa1b3('0x74'),_0xa1b3('0x75')],'raw':!![]}]})['then'](function(_0x3c539a){if(_0x3c539a){var _0x3b74cf=_[_0xa1b3('0x76')](_0x3c539a,function(_0x4f7772){var _0x3e8477=_0x4f7772[_0xa1b3('0x2a')]({'plain':!![]});_0x3e8477['Agents']['forEach'](function(_0x1467a9){_0x1467a9['penalty']=_[_0xa1b3('0x34')](_0x47de62,{'id':_0x3e8477['id']})[_0xa1b3('0x77')];});return _0x3e8477[_0xa1b3('0x73')];});return db[_0xa1b3('0x55')]['find']({'where':{'id':_0x5e4015[_0xa1b3('0x5e')]['id']}})[_0xa1b3('0x29')](function(_0x1845cd){return db[_0xa1b3('0x78')]['transaction'](function(_0x528693){return _0x1845cd[_0xa1b3('0x71')](_0x214cf5,{'transaction':_0x528693})[_0xa1b3('0x29')](function(){return BPromise[_0xa1b3('0x79')](_0x3b74cf,function(_0x4843f4){return db['UserVoiceQueue'][_0xa1b3('0x7a')]({'where':{'UserId':_0x4843f4['id'],'VoiceQueueId':_0x5e4015[_0xa1b3('0x5e')]['id']},'defaults':{'penalty':_0x4843f4[_0xa1b3('0x77')]},'transaction':_0x528693});});})['then'](function(){return BPromise[_0xa1b3('0x79')](_[_0xa1b3('0x4c')](_0x3b74cf,{'online':!![]}),function(_0x2d477a){return db[_0xa1b3('0x7b')][_0xa1b3('0x7c')]({'membername':_0x2d477a[_0xa1b3('0x35')],'UserId':_0x2d477a['id'],'queue_name':_0x1845cd[_0xa1b3('0x35')],'VoiceQueueId':_0x1845cd['id'],'interface':_[_0xa1b3('0x7d')](_0x2d477a['interface'])?util['format'](_0xa1b3('0x7e'),_0x2d477a[_0xa1b3('0x35')]):_0x2d477a[_0xa1b3('0x75')],'paused':_0x2d477a[_0xa1b3('0x74')]||![],'penalty':_0x2d477a[_0xa1b3('0x77')]},{'transaction':_0x528693});});})[_0xa1b3('0x29')](function(){_0x3b74cf[_0xa1b3('0x7f')](function(_0x223e0a){socket['emit']('userVoiceQueue:save',{'UserId':_0x223e0a['id'],'VoiceQueueId':_0x1845cd['id']});});});});});}})[_0xa1b3('0x29')](respondWithStatusCode(_0x15cd75,null))[_0xa1b3('0x53')](handleError(_0x15cd75,null));};exports[_0xa1b3('0x80')]=function(_0x48d686,_0x5389d9,_0x2f5078){return db[_0xa1b3('0x70')][_0xa1b3('0x51')]({'where':{'id':_0x48d686['query'][_0xa1b3('0x81')]},'attributes':['id'],'include':[{'model':db[_0xa1b3('0x72')],'as':_0xa1b3('0x73'),'attributes':['id'],'raw':!![]}]})[_0xa1b3('0x29')](handleEntityNotFound(_0x5389d9,null))[_0xa1b3('0x29')](function(_0x3f49bf){var _0x10ea30=_[_0xa1b3('0x30')](_0x3f49bf,'id');var _0x51e3ba=[];var _0x38d56f=[];var _0x188b1b=squel['select']();_0x188b1b[_0xa1b3('0x82')](_0xa1b3('0x83'))[_0xa1b3('0x84')]('team_has_voice_queues','tq')['join']('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0xa1b3('0x85'),_0x48d686[_0xa1b3('0x5e')]['id']);for(var _0x52b355=0x0;_0x52b355<_0x3f49bf[_0xa1b3('0x45')];_0x52b355+=0x1){let _0x13a6b8=_0x3f49bf[_0x52b355];for(var _0x599d9b=0x0;_0x599d9b<_0x13a6b8[_0xa1b3('0x73')]['length'];_0x599d9b+=0x1){let _0x3d2b4e=_0x13a6b8[_0xa1b3('0x73')][_0x599d9b];var _0x3b0fa8=_0x188b1b[_0xa1b3('0x5d')]();_0x3b0fa8[_0xa1b3('0x4a')]('ut.UserId\x20=\x20?',_0x3d2b4e['id']);_0x38d56f['push'](db[_0xa1b3('0x78')][_0xa1b3('0x40')](_0x3b0fa8[_0xa1b3('0x86')](),{'type':db['sequelize'][_0xa1b3('0x87')][_0xa1b3('0x88')]})[_0xa1b3('0x29')](function(_0x563ba9){if(_0x563ba9[_0xa1b3('0x45')]===0x1){return _0x3d2b4e['id'];}else{var _0x7ab822=_[_0xa1b3('0x89')](_['map'](_0x563ba9,_0xa1b3('0x8a')),function(_0x2c139a){return _[_0xa1b3('0x32')](_0x10ea30,_0x2c139a);});if(_0x7ab822){return _0x3d2b4e['id'];}}}));}}return BPromise[_0xa1b3('0x8b')](_0x38d56f)['then'](function(_0x50e0c9){_0x51e3ba=_(_0x51e3ba)[_0xa1b3('0x8c')](_0x50e0c9)['compact']()['value']();return db[_0xa1b3('0x55')]['find']({'where':{'id':_0x48d686['params']['id']}})['then'](function(_0x5a9cac){return db[_0xa1b3('0x78')]['transaction'](function(_0xdc7d66){return _0x5a9cac['removeTeams'](_0x48d686['query'][_0xa1b3('0x81')],{'transaction':_0xdc7d66})['then'](function(){if(!_[_0xa1b3('0x8d')](_0x51e3ba)){return _0x5a9cac['removeAgents'](_0x51e3ba,{'transaction':_0xdc7d66})['then'](function(){return db[_0xa1b3('0x7b')][_0xa1b3('0x28')]({'where':{'VoiceQueueId':_0x48d686[_0xa1b3('0x5e')]['id'],'UserId':_0x51e3ba},'transaction':_0xdc7d66});});}})[_0xa1b3('0x29')](function(){_0x51e3ba[_0xa1b3('0x7f')](function(_0x169219){socket['emit']('userVoiceQueue:remove',{'UserId':_0x169219,'VoiceQueueId':_0x5a9cac['id']});});});});});});})[_0xa1b3('0x29')](respondWithStatusCode(_0x5389d9,null))[_0xa1b3('0x53')](handleError(_0x5389d9,null));};exports['addAgents']=function(_0x1337a6,_0x119978,_0x52042c){var _0x26a0c9,_0x5dd8a6;return db[_0xa1b3('0x55')][_0xa1b3('0x34')]({'where':{'id':_0x1337a6[_0xa1b3('0x5e')]['id']}})[_0xa1b3('0x29')](handleEntityNotFound(_0x119978,null))[_0xa1b3('0x29')](function(_0x246458){if(_0x246458){_0x5dd8a6=_0x246458;return _0x246458[_0xa1b3('0x8e')](_0x1337a6['body']['ids'],_[_0xa1b3('0x61')](_0x1337a6[_0xa1b3('0x60')],['ids','id'])||{})[_0xa1b3('0x8f')](function(_0x1beb61){for(var _0x5d0c26=0x0;_0x5d0c26<_0x1337a6[_0xa1b3('0x60')]['ids'][_0xa1b3('0x45')];_0x5d0c26+=0x1){socket[_0xa1b3('0x90')]('userVoiceQueue:save',{'UserId':_0x1337a6[_0xa1b3('0x60')][_0xa1b3('0x81')][_0x5d0c26],'VoiceQueueId':_0x1337a6[_0xa1b3('0x5e')]['id']});}return _0x1beb61;});}})[_0xa1b3('0x29')](function(_0x3232aa){_0x26a0c9=_0x3232aa||[];if(_0x5dd8a6){return db[_0xa1b3('0x72')][_0xa1b3('0x51')]({'where':{'id':_0x1337a6[_0xa1b3('0x60')][_0xa1b3('0x81')]},'attributes':['id','name',_0xa1b3('0x91'),_0xa1b3('0x74'),'interface'],'raw':!![]});}})[_0xa1b3('0x29')](function(_0x47654c){if(!_[_0xa1b3('0x8d')](_0x47654c)){var _0x35d356=[];for(var _0x51bf10=0x0;_0x51bf10<_0x47654c['length'];_0x51bf10++){if(_0x47654c[_0x51bf10][_0xa1b3('0x91')]){_0x35d356['push'](db[_0xa1b3('0x7b')]['upsert']({'membername':_0x47654c[_0x51bf10][_0xa1b3('0x35')],'UserId':_0x47654c[_0x51bf10]['id'],'queue_name':_0x5dd8a6[_0xa1b3('0x35')],'VoiceQueueId':_0x5dd8a6['id'],'interface':_['isNil'](_0x47654c[_0x51bf10][_0xa1b3('0x75')])?util[_0xa1b3('0x92')](_0xa1b3('0x7e'),_0x47654c[_0x51bf10][_0xa1b3('0x35')]):_0x47654c[_0x51bf10][_0xa1b3('0x75')],'paused':_0x47654c[_0x51bf10]['voicePause']||![],'penalty':_0x1337a6['body'][_0xa1b3('0x77')]||0x0}));}}return BPromise[_0xa1b3('0x8b')](_0x35d356);}})['then'](function(){return _0x26a0c9;})[_0xa1b3('0x29')](respondWithResult(_0x119978,null))[_0xa1b3('0x53')](handleError(_0x119978,null));};exports[_0xa1b3('0x93')]=function(_0x2a0a5e,_0x823b06,_0x342988){return db[_0xa1b3('0x55')]['find']({'where':{'id':_0x2a0a5e['params']['id']}})[_0xa1b3('0x29')](handleEntityNotFound(_0x823b06,null))['then'](function(_0x290d14){if(_0x290d14){return _0x290d14[_0xa1b3('0x93')](_0x2a0a5e[_0xa1b3('0x40')]['ids'])[_0xa1b3('0x29')](function(){if(_[_0xa1b3('0x94')](_0x2a0a5e[_0xa1b3('0x40')][_0xa1b3('0x81')])){for(var _0xf60499=0x0;_0xf60499<_0x2a0a5e[_0xa1b3('0x40')][_0xa1b3('0x81')][_0xa1b3('0x45')];_0xf60499+=0x1){socket['emit']('userVoiceQueue:remove',{'UserId':Number(_0x2a0a5e['query'][_0xa1b3('0x81')][_0xf60499]),'VoiceQueueId':Number(_0x2a0a5e['params']['id'])});}}else{socket[_0xa1b3('0x90')](_0xa1b3('0x95'),{'UserId':Number(_0x2a0a5e[_0xa1b3('0x40')][_0xa1b3('0x81')]),'VoiceQueueId':Number(_0x2a0a5e[_0xa1b3('0x5e')]['id'])});}});}})[_0xa1b3('0x29')](function(_0x52a618){return db[_0xa1b3('0x7b')]['destroy']({'where':{'VoiceQueueId':_0x2a0a5e['params']['id'],'UserId':_0x2a0a5e['query'][_0xa1b3('0x81')]}})[_0xa1b3('0x29')](function(){return _0x52a618;});})[_0xa1b3('0x29')](respondWithStatusCode(_0x823b06,null))[_0xa1b3('0x53')](handleError(_0x823b06,null));};exports[_0xa1b3('0x96')]=function(_0x1c8a55,_0x3eecaa,_0x1ad5eb){var _0x5a5483={};var _0x5e6450={};var _0x62ee24;var _0x21e202;return db['VoiceQueue'][_0xa1b3('0x66')]({'where':{'id':_0x1c8a55[_0xa1b3('0x5e')]['id']}})[_0xa1b3('0x29')](handleEntityNotFound(_0x3eecaa,null))['then'](function(_0x590eba){if(_0x590eba){_0x62ee24=_0x590eba;_0x5e6450[_0xa1b3('0x3f')]=_[_0xa1b3('0x41')](db[_0xa1b3('0x72')][_0xa1b3('0x3c')]);_0x5e6450['query']=_[_0xa1b3('0x41')](_0x1c8a55[_0xa1b3('0x40')]);_0x5e6450[_0xa1b3('0x4b')]=_[_0xa1b3('0x42')](_0x5e6450[_0xa1b3('0x3f')],_0x5e6450['query']);_0x5a5483[_0xa1b3('0x44')]=_[_0xa1b3('0x42')](_0x5e6450[_0xa1b3('0x3f')],qs[_0xa1b3('0x43')](_0x1c8a55[_0xa1b3('0x40')]['fields']));_0x5a5483['attributes']=_0x5a5483['attributes'][_0xa1b3('0x45')]?_0x5a5483[_0xa1b3('0x44')]:_0x5e6450[_0xa1b3('0x3f')];_0x5a5483[_0xa1b3('0x48')]=qs['sort'](_0x1c8a55['query']['sort']);_0x5a5483[_0xa1b3('0x4a')]=qs[_0xa1b3('0x4b')](_[_0xa1b3('0x68')](_0x1c8a55[_0xa1b3('0x40')],_0x5e6450['filters']));if(_0x1c8a55['query'][_0xa1b3('0x4c')]){_0x5a5483[_0xa1b3('0x4a')]=_[_0xa1b3('0x4d')](_0x5a5483[_0xa1b3('0x4a')],{'$or':_[_0xa1b3('0x30')](_0x5a5483[_0xa1b3('0x44')],function(_0x318920){var _0x121238={};_0x121238[_0x318920]={'$like':'%'+_0x1c8a55[_0xa1b3('0x40')]['filter']+'%'};return _0x121238;})});}_0x5a5483=_[_0xa1b3('0x4d')]({},_0x5a5483,_0x1c8a55['options']);return _0x62ee24['getAgents'](_0x5a5483);}})[_0xa1b3('0x29')](function(_0x22405c){if(_0x22405c){_0x21e202=_0x22405c[_0xa1b3('0x45')];if(!_0x1c8a55[_0xa1b3('0x40')][_0xa1b3('0x46')]('nolimit')){_0x5a5483[_0xa1b3('0x23')]=qs[_0xa1b3('0x23')](_0x1c8a55[_0xa1b3('0x40')][_0xa1b3('0x23')]);_0x5a5483[_0xa1b3('0x22')]=qs[_0xa1b3('0x22')](_0x1c8a55[_0xa1b3('0x40')][_0xa1b3('0x22')]);}return _0x62ee24[_0xa1b3('0x96')](_0x5a5483);}})[_0xa1b3('0x29')](function(_0x2b8230){if(_0x2b8230){return _0x2b8230?{'count':_0x21e202,'rows':_0x2b8230}:null;}})[_0xa1b3('0x29')](respondWithResult(_0x3eecaa,null))[_0xa1b3('0x53')](handleError(_0x3eecaa,null));};exports['getMembers']=function(_0x55c99f,_0x20b402,_0x70e3af){var _0x55b10e={};var _0x572a67={};var _0x292ef8;var _0x197a13;return db[_0xa1b3('0x55')][_0xa1b3('0x66')]({'where':{'id':_0x55c99f[_0xa1b3('0x5e')]['id']}})[_0xa1b3('0x29')](handleEntityNotFound(_0x20b402,null))[_0xa1b3('0x29')](function(_0x1f67fb){if(_0x1f67fb){_0x292ef8=_0x1f67fb;_0x572a67[_0xa1b3('0x3f')]=_[_0xa1b3('0x41')](db[_0xa1b3('0x7b')][_0xa1b3('0x3c')]);_0x572a67['query']=_[_0xa1b3('0x41')](_0x55c99f[_0xa1b3('0x40')]);_0x572a67['filters']=_[_0xa1b3('0x42')](_0x572a67[_0xa1b3('0x3f')],_0x572a67[_0xa1b3('0x40')]);_0x55b10e[_0xa1b3('0x44')]=_[_0xa1b3('0x42')](_0x572a67[_0xa1b3('0x3f')],qs[_0xa1b3('0x43')](_0x55c99f[_0xa1b3('0x40')][_0xa1b3('0x43')]));_0x55b10e['attributes']=_0x55b10e[_0xa1b3('0x44')][_0xa1b3('0x45')]?_0x55b10e['attributes']:_0x572a67[_0xa1b3('0x3f')];_0x55b10e[_0xa1b3('0x48')]=qs[_0xa1b3('0x49')](_0x55c99f[_0xa1b3('0x40')][_0xa1b3('0x49')]);_0x55b10e['where']=qs[_0xa1b3('0x4b')](_[_0xa1b3('0x68')](_0x55c99f[_0xa1b3('0x40')],_0x572a67[_0xa1b3('0x4b')]));if(_0x55c99f[_0xa1b3('0x40')]['filter']){_0x55b10e[_0xa1b3('0x4a')]=_[_0xa1b3('0x4d')](_0x55b10e['where'],{'$or':_['map'](_0x55b10e[_0xa1b3('0x44')],function(_0x223974){var _0x1f72ee={};_0x1f72ee[_0x223974]={'$like':'%'+_0x55c99f['query'][_0xa1b3('0x4c')]+'%'};return _0x1f72ee;})});}_0x55b10e=_['merge']({},_0x55b10e,_0x55c99f[_0xa1b3('0x4f')]);return _0x292ef8['getMembers'](_0x55b10e);}})['then'](function(_0x35e106){if(_0x35e106){_0x197a13=_0x35e106[_0xa1b3('0x45')];if(!_0x55c99f[_0xa1b3('0x40')]['hasOwnProperty'](_0xa1b3('0x47'))){_0x55b10e[_0xa1b3('0x23')]=qs[_0xa1b3('0x23')](_0x55c99f[_0xa1b3('0x40')]['limit']);_0x55b10e[_0xa1b3('0x22')]=qs['offset'](_0x55c99f[_0xa1b3('0x40')][_0xa1b3('0x22')]);}return _0x292ef8[_0xa1b3('0x97')](_0x55b10e);}})[_0xa1b3('0x29')](function(_0x464787){return _0x464787?{'count':_0x197a13,'rows':_0x464787}:null;})[_0xa1b3('0x29')](respondWithResult(_0x20b402,null))[_0xa1b3('0x53')](handleError(_0x20b402,null));};exports[_0xa1b3('0x98')]=function(_0x5d6ac9,_0x101098,_0x3f48c6){var _0xe8b61c={};var _0x398ea6={};var _0x329443;var _0x4b106e;return db[_0xa1b3('0x55')][_0xa1b3('0x66')]({'where':{'id':_0x5d6ac9[_0xa1b3('0x5e')]['id']}})[_0xa1b3('0x29')](handleEntityNotFound(_0x101098,null))[_0xa1b3('0x29')](function(_0x210878){if(_0x210878){_0x329443=_0x210878;_0x398ea6[_0xa1b3('0x3f')]=_[_0xa1b3('0x41')](db['CmList'][_0xa1b3('0x3c')]);_0x398ea6[_0xa1b3('0x40')]=_[_0xa1b3('0x41')](_0x5d6ac9[_0xa1b3('0x40')]);_0x398ea6[_0xa1b3('0x4b')]=_[_0xa1b3('0x42')](_0x398ea6[_0xa1b3('0x3f')],_0x398ea6['query']);_0xe8b61c[_0xa1b3('0x44')]=_[_0xa1b3('0x42')](_0x398ea6[_0xa1b3('0x3f')],qs[_0xa1b3('0x43')](_0x5d6ac9['query'][_0xa1b3('0x43')]));_0xe8b61c['attributes']=_0xe8b61c['attributes'][_0xa1b3('0x45')]?_0xe8b61c[_0xa1b3('0x44')]:_0x398ea6[_0xa1b3('0x3f')];_0xe8b61c['order']=qs[_0xa1b3('0x49')](_0x5d6ac9[_0xa1b3('0x40')][_0xa1b3('0x49')]);_0xe8b61c[_0xa1b3('0x4a')]=qs['filters'](_[_0xa1b3('0x68')](_0x5d6ac9['query'],_0x398ea6[_0xa1b3('0x4b')]));if(_0x5d6ac9['query']['filter']){_0xe8b61c['where']=_[_0xa1b3('0x4d')](_0xe8b61c['where'],{'$or':_[_0xa1b3('0x30')](_0xe8b61c[_0xa1b3('0x44')],function(_0x42437e){var _0x4cb4c1={};_0x4cb4c1[_0x42437e]={'$like':'%'+_0x5d6ac9['query'][_0xa1b3('0x4c')]+'%'};return _0x4cb4c1;})});}_0xe8b61c=_['merge']({},_0xe8b61c,_0x5d6ac9[_0xa1b3('0x4f')]);return _0x329443[_0xa1b3('0x98')](_0xe8b61c);}})[_0xa1b3('0x29')](function(_0x589b9b){if(_0x589b9b){_0x4b106e=_0x589b9b[_0xa1b3('0x45')];if(!_0x5d6ac9[_0xa1b3('0x40')][_0xa1b3('0x46')]('nolimit')){_0xe8b61c['limit']=qs[_0xa1b3('0x23')](_0x5d6ac9[_0xa1b3('0x40')][_0xa1b3('0x23')]);_0xe8b61c['offset']=qs[_0xa1b3('0x22')](_0x5d6ac9['query'][_0xa1b3('0x22')]);}return _0x329443['getLists'](_0xe8b61c);}})[_0xa1b3('0x29')](function(_0xd17997){if(_0xd17997){return _0xd17997?{'count':_0x4b106e,'rows':_0xd17997}:null;}})[_0xa1b3('0x29')](respondWithResult(_0x101098,null))[_0xa1b3('0x53')](handleError(_0x101098,null));};exports[_0xa1b3('0x99')]=function(_0x3ce7b7,_0x54daaa,_0x30fd99){var _0x3859d8,_0x39f6a5;return db[_0xa1b3('0x55')][_0xa1b3('0x34')]({'where':{'id':_0x3ce7b7[_0xa1b3('0x5e')]['id']}})[_0xa1b3('0x29')](handleEntityNotFound(_0x54daaa,null))[_0xa1b3('0x29')](function(_0xb3639c){if(_0xb3639c){_0x39f6a5=_0xb3639c;return _0xb3639c[_0xa1b3('0x99')](_0x3ce7b7[_0xa1b3('0x60')]['ids'],_[_0xa1b3('0x61')](_0x3ce7b7[_0xa1b3('0x60')],[_0xa1b3('0x81'),'id'])||{});}return null;})[_0xa1b3('0x8f')](function(_0xb3aade){var _0xed1300;_0x3859d8=_0xb3aade||[];var _0x39c518=[];if(_0xb3aade){for(var _0xc505d4=0x0;_0xc505d4<_0xb3aade[_0xa1b3('0x45')];_0xc505d4+=0x1){var _0x4c7b76=_0xb3aade[_0xc505d4][_0xa1b3('0x2a')]({'plain':!![]});_0x39f6a5[_0xa1b3('0x9a')]=_0x3ce7b7[_0xa1b3('0x60')][_0xa1b3('0x9a')]?_0x3ce7b7[_0xa1b3('0x60')][_0xa1b3('0x9a')]:_0x39f6a5['dialCheckDuplicateType'];switch(_0x39f6a5[_0xa1b3('0x9a')]){case _0xa1b3('0x9b'):_0xed1300=squel[_0xa1b3('0x9c')]()[_0xa1b3('0x9d')]('cm_hopper')['fromQuery']([_0xa1b3('0x9e'),_0xa1b3('0x9f'),_0xa1b3('0xa0'),'ListId',_0xa1b3('0x6c'),'createdAt',_0xa1b3('0x5f')],squel[_0xa1b3('0xa1')]()[_0xa1b3('0x82')]('phone',_0xa1b3('0x9e'))[_0xa1b3('0x82')](_0xa1b3('0xa2'),_0xa1b3('0x9f'))[_0xa1b3('0x82')]('id',_0xa1b3('0xa0'))[_0xa1b3('0x82')](_0x4c7b76[_0xa1b3('0xa3')][_0xa1b3('0x86')](),'ListId')[_0xa1b3('0x82')](_0x3ce7b7[_0xa1b3('0x5e')]['id'][_0xa1b3('0x86')](),_0xa1b3('0x6c'))[_0xa1b3('0x82')](_0xa1b3('0xa2'),'createdAt')[_0xa1b3('0x82')]('NOW()',_0xa1b3('0x5f'))[_0xa1b3('0x84')](_0xa1b3('0xa4'))[_0xa1b3('0x4a')](_0xa1b3('0xa5'))[_0xa1b3('0x4a')](_0xa1b3('0xa6'),_0x4c7b76['CmListId'][_0xa1b3('0x86')]())[_0xa1b3('0x4a')]('phone\x20IS\x20NOT\x20NULL')[_0xa1b3('0x4a')](_0xa1b3('0xa7'),squel[_0xa1b3('0xa1')]()[_0xa1b3('0x82')](_0xa1b3('0xa8'))[_0xa1b3('0x84')](_0xa1b3('0xa9'))[_0xa1b3('0x4a')]('VoiceQueueId\x20=\x20?',_0x3ce7b7['params']['id'][_0xa1b3('0x86')]()))['where'](_0xa1b3('0xa7'),squel[_0xa1b3('0xa1')]()[_0xa1b3('0x82')](_0xa1b3('0xaa'))[_0xa1b3('0x84')](_0xa1b3('0xab'))[_0xa1b3('0x4a')](_0xa1b3('0x85'),_0x3ce7b7[_0xa1b3('0x5e')]['id'][_0xa1b3('0x86')]())))[_0xa1b3('0x86')]();break;case _0xa1b3('0xac'):_0xed1300=squel[_0xa1b3('0x9c')]()[_0xa1b3('0x9d')](_0xa1b3('0xab'))[_0xa1b3('0xad')]([_0xa1b3('0x9e'),_0xa1b3('0x9f'),_0xa1b3('0xa0'),'ListId',_0xa1b3('0x6c'),_0xa1b3('0x62'),_0xa1b3('0x5f')],squel[_0xa1b3('0xa1')]()[_0xa1b3('0x82')](_0xa1b3('0x9e'),_0xa1b3('0x9e'))[_0xa1b3('0x82')](_0xa1b3('0xa2'),_0xa1b3('0x9f'))[_0xa1b3('0x82')]('id',_0xa1b3('0xa0'))['field'](_0x4c7b76['CmListId'][_0xa1b3('0x86')](),_0xa1b3('0xae'))['field'](_0x3ce7b7['params']['id'][_0xa1b3('0x86')](),_0xa1b3('0x6c'))[_0xa1b3('0x82')](_0xa1b3('0xa2'),'createdAt')[_0xa1b3('0x82')](_0xa1b3('0xa2'),_0xa1b3('0x5f'))[_0xa1b3('0x84')](_0xa1b3('0xa4'))[_0xa1b3('0x4a')](_0xa1b3('0xa5'))[_0xa1b3('0x4a')](_0xa1b3('0xa6'),_0x4c7b76[_0xa1b3('0xa3')][_0xa1b3('0x86')]())[_0xa1b3('0x4a')](_0xa1b3('0xaf'))[_0xa1b3('0x4a')](_0xa1b3('0xa7'),squel[_0xa1b3('0xa1')]()[_0xa1b3('0x82')]('COALESCE(phone,\x27\x27)')[_0xa1b3('0x84')]('cm_hopper')['where'](_0xa1b3('0x85'),_0x3ce7b7[_0xa1b3('0x5e')]['id'][_0xa1b3('0x86')]())))[_0xa1b3('0x86')]();break;default:_0xed1300=squel['insert']()[_0xa1b3('0x9d')]('cm_hopper')[_0xa1b3('0xad')](['phone',_0xa1b3('0x9f'),_0xa1b3('0xa0'),_0xa1b3('0xae'),_0xa1b3('0x6c'),'createdAt','updatedAt'],squel[_0xa1b3('0xa1')]()[_0xa1b3('0x82')](_0xa1b3('0x9e'),_0xa1b3('0x9e'))[_0xa1b3('0x82')](_0xa1b3('0xa2'),'scheduledAt')[_0xa1b3('0x82')]('id',_0xa1b3('0xa0'))[_0xa1b3('0x82')](_0x4c7b76[_0xa1b3('0xa3')][_0xa1b3('0x86')](),_0xa1b3('0xae'))[_0xa1b3('0x82')](_0x3ce7b7[_0xa1b3('0x5e')]['id']['toString'](),_0xa1b3('0x6c'))['field']('NOW()',_0xa1b3('0x62'))[_0xa1b3('0x82')]('NOW()',_0xa1b3('0x5f'))[_0xa1b3('0x84')](_0xa1b3('0xa4'))[_0xa1b3('0x4a')](_0xa1b3('0xa5'))[_0xa1b3('0x4a')](_0xa1b3('0xa6'),_0x4c7b76[_0xa1b3('0xa3')][_0xa1b3('0x86')]())['where']('phone\x20IS\x20NOT\x20NULL'))[_0xa1b3('0x86')]();}_0x39c518['push'](db[_0xa1b3('0x78')][_0xa1b3('0x40')](_0xed1300));}return BPromise[_0xa1b3('0x8b')](_0x39c518);}})[_0xa1b3('0x29')](function(){return _0x3859d8;})[_0xa1b3('0x29')](respondWithResult(_0x54daaa,null))[_0xa1b3('0x53')](handleError(_0x54daaa,null));};exports['removeLists']=function(_0x2c21f3,_0x188217,_0x36af0b){return db[_0xa1b3('0x55')][_0xa1b3('0x34')]({'where':{'id':_0x2c21f3['params']['id']}})['then'](handleEntityNotFound(_0x188217,null))[_0xa1b3('0x29')](function(_0x5e6c1c){if(_0x5e6c1c){return _0x5e6c1c['removeLists'](_0x2c21f3[_0xa1b3('0x40')][_0xa1b3('0x81')]);}})[_0xa1b3('0x29')](function(_0x43f848){if(_0x43f848){return db[_0xa1b3('0x67')][_0xa1b3('0x28')]({'where':{'ListId':_0x2c21f3[_0xa1b3('0x40')][_0xa1b3('0x81')],'VoiceQueueId':_0x2c21f3[_0xa1b3('0x5e')]['id']}})[_0xa1b3('0x29')](function(){return _0x43f848;});}})['then'](respondWithStatusCode(_0x188217,null))[_0xa1b3('0x53')](handleError(_0x188217,null));};exports[_0xa1b3('0xb0')]=function(_0x154f6d,_0x240e84,_0x4d9e6b){var _0x58a079={};var _0x341029={};var _0xb19cae;var _0x2d027f;return db['VoiceQueue'][_0xa1b3('0x66')]({'where':{'id':_0x154f6d['params']['id']}})[_0xa1b3('0x29')](handleEntityNotFound(_0x240e84,null))[_0xa1b3('0x29')](function(_0x45d5bd){if(_0x45d5bd){_0xb19cae=_0x45d5bd;_0x341029[_0xa1b3('0x3f')]=_['keys'](db[_0xa1b3('0xb1')][_0xa1b3('0x3c')]);_0x341029[_0xa1b3('0x40')]=_[_0xa1b3('0x41')](_0x154f6d[_0xa1b3('0x40')]);_0x341029['filters']=_['intersection'](_0x341029['model'],_0x341029[_0xa1b3('0x40')]);_0x58a079[_0xa1b3('0x44')]=_['intersection'](_0x341029['model'],qs['fields'](_0x154f6d['query'][_0xa1b3('0x43')]));_0x58a079[_0xa1b3('0x44')]=_0x58a079['attributes']['length']?_0x58a079[_0xa1b3('0x44')]:_0x341029[_0xa1b3('0x3f')];_0x58a079[_0xa1b3('0x48')]=qs['sort'](_0x154f6d[_0xa1b3('0x40')][_0xa1b3('0x49')]);_0x58a079[_0xa1b3('0x4a')]=qs[_0xa1b3('0x4b')](_[_0xa1b3('0x68')](_0x154f6d[_0xa1b3('0x40')],_0x341029[_0xa1b3('0x4b')]));if(_0x154f6d[_0xa1b3('0x40')][_0xa1b3('0x4c')]){_0x58a079[_0xa1b3('0x4a')]=_[_0xa1b3('0x4d')](_0x58a079[_0xa1b3('0x4a')],{'$or':_[_0xa1b3('0x30')](_0x58a079[_0xa1b3('0x44')],function(_0xf15bd6){var _0x55ebd2={};_0x55ebd2[_0xf15bd6]={'$like':'%'+_0x154f6d[_0xa1b3('0x40')][_0xa1b3('0x4c')]+'%'};return _0x55ebd2;})});}_0x58a079=_[_0xa1b3('0x4d')]({},_0x58a079,_0x154f6d[_0xa1b3('0x4f')]);return _0xb19cae[_0xa1b3('0xb0')](_0x58a079);}})[_0xa1b3('0x29')](function(_0x3be8c1){if(_0x3be8c1){_0x2d027f=_0x3be8c1[_0xa1b3('0x45')];if(!_0x154f6d[_0xa1b3('0x40')][_0xa1b3('0x46')](_0xa1b3('0x47'))){_0x58a079[_0xa1b3('0x23')]=qs['limit'](_0x154f6d[_0xa1b3('0x40')][_0xa1b3('0x23')]);_0x58a079[_0xa1b3('0x22')]=qs[_0xa1b3('0x22')](_0x154f6d[_0xa1b3('0x40')]['offset']);}return _0xb19cae[_0xa1b3('0xb0')](_0x58a079);}})[_0xa1b3('0x29')](function(_0x3f590){if(_0x3f590){return _0x3f590?{'count':_0x2d027f,'rows':_0x3f590}:null;}})[_0xa1b3('0x29')](respondWithResult(_0x240e84,null))[_0xa1b3('0x53')](handleError(_0x240e84,null));};exports[_0xa1b3('0xb2')]=function(_0x2bffee,_0x7636a1,_0x3975ae){var _0x51777c,_0x570b08;return db['VoiceQueue']['find']({'where':{'id':_0x2bffee[_0xa1b3('0x5e')]['id']}})[_0xa1b3('0x29')](handleEntityNotFound(_0x7636a1,null))[_0xa1b3('0x29')](function(_0x95c28d){if(_0x95c28d){_0x570b08=_0x95c28d;return _0x95c28d['addBlackLists'](_0x2bffee[_0xa1b3('0x60')][_0xa1b3('0x81')],_[_0xa1b3('0x61')](_0x2bffee[_0xa1b3('0x60')],[_0xa1b3('0x81'),'id'])||{});}return null;})[_0xa1b3('0x8f')](function(_0x15e711){var _0x11fccd;_0x51777c=_0x15e711||[];var _0x264a0c=[];if(_0x15e711){for(var _0x237ea6=0x0;_0x237ea6<_0x15e711[_0xa1b3('0x45')];_0x237ea6+=0x1){var _0x265e86=_0x15e711[_0x237ea6][_0xa1b3('0x2a')]({'plain':!![]});_0x11fccd=squel['insert']()[_0xa1b3('0x9d')](_0xa1b3('0xb3'))[_0xa1b3('0xad')]([_0xa1b3('0x9e'),'ContactId','ListId',_0xa1b3('0x6c'),_0xa1b3('0x62'),_0xa1b3('0x5f')],squel[_0xa1b3('0xa1')]()[_0xa1b3('0x82')]('phone',_0xa1b3('0x9e'))[_0xa1b3('0x82')]('id',_0xa1b3('0xa0'))['field'](_0x265e86[_0xa1b3('0xa3')][_0xa1b3('0x86')](),_0xa1b3('0xae'))[_0xa1b3('0x82')](_0x2bffee['params']['id'][_0xa1b3('0x86')](),_0xa1b3('0x6c'))['field'](_0xa1b3('0xa2'),'createdAt')[_0xa1b3('0x82')](_0xa1b3('0xa2'),_0xa1b3('0x5f'))[_0xa1b3('0x84')](_0xa1b3('0xa4'))['where'](_0xa1b3('0xa5'))['where'](_0xa1b3('0xa6'),_0x265e86[_0xa1b3('0xa3')]['toString']())[_0xa1b3('0x4a')](_0xa1b3('0xaf')))[_0xa1b3('0x86')]();_0x264a0c[_0xa1b3('0xb4')](db['sequelize'][_0xa1b3('0x40')](_0x11fccd));}return BPromise[_0xa1b3('0x8b')](_0x264a0c);}})['then'](function(){return _0x51777c;})['then'](respondWithResult(_0x7636a1,null))[_0xa1b3('0x53')](handleError(_0x7636a1,null));};exports[_0xa1b3('0xb5')]=function(_0x464607,_0x18b382,_0x496539){return db[_0xa1b3('0x55')]['find']({'where':{'id':_0x464607['params']['id']}})[_0xa1b3('0x29')](handleEntityNotFound(_0x18b382,null))['then'](function(_0x49c829){if(_0x49c829){return _0x49c829['removeBlackLists'](_0x464607[_0xa1b3('0x40')][_0xa1b3('0x81')]);}})[_0xa1b3('0x29')](function(_0x19a9a1){if(_0x19a9a1){return db[_0xa1b3('0x6e')][_0xa1b3('0x28')]({'where':{'ListId':_0x464607[_0xa1b3('0x40')][_0xa1b3('0x81')],'VoiceQueueId':_0x464607[_0xa1b3('0x5e')]['id']}})[_0xa1b3('0x29')](function(){return _0x19a9a1;});}})[_0xa1b3('0x29')](respondWithStatusCode(_0x18b382,null))[_0xa1b3('0x53')](handleError(_0x18b382,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 2288b2f..117cbc1 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 _0x2613=['emit','hasOwnProperty','events','../../mysqldb','VoiceQueue','setMaxListeners','save','update','remove'];(function(_0x1876c7,_0x379202){var _0x2b9572=function(_0x9bf2ff){while(--_0x9bf2ff){_0x1876c7['push'](_0x1876c7['shift']());}};_0x2b9572(++_0x379202);}(_0x2613,0x1bb));var _0x3261=function(_0x3ce8b2,_0x141823){_0x3ce8b2=_0x3ce8b2-0x0;var _0x41de55=_0x2613[_0x3ce8b2];return _0x41de55;};'use strict';var EventEmitter=require(_0x3261('0x0'));var VoiceQueue=require(_0x3261('0x1'))['db'][_0x3261('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x3261('0x3')](0x0);var events={'afterCreate':_0x3261('0x4'),'afterUpdate':_0x3261('0x5'),'afterDestroy':_0x3261('0x6')};function emitEvent(_0x556663){return function(_0x339296,_0x146bb7,_0x2237a9){VoiceQueueEvents[_0x3261('0x7')](_0x556663+':'+_0x339296['id'],_0x339296);VoiceQueueEvents['emit'](_0x556663,_0x339296);_0x2237a9(null);};}for(var e in events){if(events[_0x3261('0x8')](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module['exports']=VoiceQueueEvents; \ No newline at end of file +var _0xdc97=['../../mysqldb','VoiceQueue','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events'];(function(_0x252aaa,_0x4229db){var _0x30fcd5=function(_0x26d28e){while(--_0x26d28e){_0x252aaa['push'](_0x252aaa['shift']());}};_0x30fcd5(++_0x4229db);}(_0xdc97,0xbd));var _0x7dc9=function(_0x40e6b2,_0x2f7d67){_0x40e6b2=_0x40e6b2-0x0;var _0x5d1f90=_0xdc97[_0x40e6b2];return _0x5d1f90;};'use strict';var EventEmitter=require(_0x7dc9('0x0'));var VoiceQueue=require(_0x7dc9('0x1'))['db'][_0x7dc9('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x7dc9('0x3')](0x0);var events={'afterCreate':_0x7dc9('0x4'),'afterUpdate':_0x7dc9('0x5'),'afterDestroy':'remove'};function emitEvent(_0x223064){return function(_0x421b29,_0x3188a5,_0x3f024f){VoiceQueueEvents[_0x7dc9('0x6')](_0x223064+':'+_0x421b29['id'],_0x421b29);VoiceQueueEvents[_0x7dc9('0x6')](_0x223064,_0x421b29);_0x3f024f(null);};}for(var e in events){if(events[_0x7dc9('0x7')](e)){var event=events[e];VoiceQueue[_0x7dc9('0x8')](e,emitEvent(event));}}module[_0x7dc9('0x9')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index 82453d2..225aad1 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 _0xb3e8=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','VoiceQueue','voice_queues'];(function(_0xba9491,_0xe8766d){var _0x3796ba=function(_0x3b3a40){while(--_0x3b3a40){_0xba9491['push'](_0xba9491['shift']());}};_0x3796ba(++_0xe8766d);}(_0xb3e8,0x16c));var _0x8b3e=function(_0x5c4e16,_0x113035){_0x5c4e16=_0x5c4e16-0x0;var _0x36044a=_0xb3e8[_0x5c4e16];return _0x36044a;};'use strict';var _=require(_0x8b3e('0x0'));var util=require(_0x8b3e('0x1'));var logger=require(_0x8b3e('0x2'))(_0x8b3e('0x3'));var moment=require(_0x8b3e('0x4'));var BPromise=require(_0x8b3e('0x5'));var rp=require(_0x8b3e('0x6'));var fs=require('fs');var path=require(_0x8b3e('0x7'));var rimraf=require(_0x8b3e('0x8'));var config=require(_0x8b3e('0x9'));var attributes=require('./voiceQueue.attributes');module[_0x8b3e('0xa')]=function(_0x302893,_0x403a41){return _0x302893[_0x8b3e('0xb')](_0x8b3e('0xc'),attributes,{'tableName':_0x8b3e('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfb29=['./voiceQueue.attributes','define','VoiceQueue','voice_queues','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x39c734,_0x2f3e06){var _0xb2a2f9=function(_0x502f3f){while(--_0x502f3f){_0x39c734['push'](_0x39c734['shift']());}};_0xb2a2f9(++_0x2f3e06);}(_0xfb29,0xd0));var _0x9fb2=function(_0x3a29c8,_0x5d4d59){_0x3a29c8=_0x3a29c8-0x0;var _0x19da4f=_0xfb29[_0x3a29c8];return _0x19da4f;};'use strict';var _=require(_0x9fb2('0x0'));var util=require(_0x9fb2('0x1'));var logger=require(_0x9fb2('0x2'))('api');var moment=require(_0x9fb2('0x3'));var BPromise=require(_0x9fb2('0x4'));var rp=require(_0x9fb2('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9fb2('0x6'));var config=require(_0x9fb2('0x7'));var attributes=require(_0x9fb2('0x8'));module['exports']=function(_0x2df2ea,_0x5dcfd1){return _0x2df2ea[_0x9fb2('0x9')](_0x9fb2('0xa'),attributes,{'tableName':_0x9fb2('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 787796e..13be6c7 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 _0xfe09=['VoiceQueue','find','where','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','then','info','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','VoiceQueue,\x20%s,\x20%s','catch','GetVoiceQueue','options','raw','attributes','map','include','model','ShowVoiceQueue'];(function(_0xb1b08c,_0x1961a6){var _0x608518=function(_0x405997){while(--_0x405997){_0xb1b08c['push'](_0xb1b08c['shift']());}};_0x608518(++_0x1961a6);}(_0xfe09,0x175));var _0x9fe0=function(_0x3f35e5,_0xab3b92){_0x3f35e5=_0x3f35e5-0x0;var _0x23d6e1=_0xfe09[_0x3f35e5];return _0x23d6e1;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9fe0('0x0'));var BPromise=require(_0x9fe0('0x1'));var rs=require(_0x9fe0('0x2'));var fs=require('fs');var Redis=require(_0x9fe0('0x3'));var db=require(_0x9fe0('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x9fe0('0x5'));var config=require(_0x9fe0('0x6'));var jayson=require(_0x9fe0('0x7'));var client=jayson[_0x9fe0('0x8')][_0x9fe0('0x9')]({'port':0x232a});config[_0x9fe0('0xa')]=_[_0x9fe0('0xb')](config[_0x9fe0('0xa')],{'host':_0x9fe0('0xc'),'port':0x18eb});var socket=require(_0x9fe0('0xd'))(new Redis(config[_0x9fe0('0xa')]));require(_0x9fe0('0xe'))['register'](socket);function respondWithRpcPromise(_0x1de787,_0x144622,_0x310a58){return new BPromise(function(_0x5c9edb,_0x2d9b92){return client['request'](_0x1de787,_0x310a58)[_0x9fe0('0xf')](function(_0x4acf95){logger[_0x9fe0('0x10')]('VoiceQueue,\x20%s,\x20%s',_0x144622,'request\x20sent');logger[_0x9fe0('0x11')](_0x9fe0('0x12'),_0x144622,_0x9fe0('0x13'),JSON[_0x9fe0('0x14')](_0x4acf95));if(_0x4acf95[_0x9fe0('0x15')]){if(_0x4acf95[_0x9fe0('0x15')][_0x9fe0('0x16')]===0x1f4){logger['error']('VoiceQueue,\x20%s,\x20%s',_0x144622,_0x4acf95[_0x9fe0('0x15')][_0x9fe0('0x17')]);return _0x2d9b92(_0x4acf95[_0x9fe0('0x15')][_0x9fe0('0x17')]);}logger[_0x9fe0('0x15')](_0x9fe0('0x18'),_0x144622,_0x4acf95['error']['message']);return _0x5c9edb(_0x4acf95[_0x9fe0('0x15')]['message']);}else{logger[_0x9fe0('0x10')](_0x9fe0('0x18'),_0x144622,_0x9fe0('0x13'));_0x5c9edb(_0x4acf95['result'][_0x9fe0('0x17')]);}})[_0x9fe0('0x19')](function(_0xc6449e){logger['error'](_0x9fe0('0x18'),_0x144622,_0xc6449e);_0x2d9b92(_0xc6449e);});});}exports[_0x9fe0('0x1a')]=function(_0x391569){var _0x1aec7d=this;return new Promise(function(_0x440303,_0x4b2473){return db['VoiceQueue']['findAll']({'raw':_0x391569[_0x9fe0('0x1b')]?_0x391569[_0x9fe0('0x1b')][_0x9fe0('0x1c')]===undefined?!![]:![]:!![],'where':_0x391569[_0x9fe0('0x1b')]?_0x391569[_0x9fe0('0x1b')]['where']||null:null,'attributes':_0x391569['options']?_0x391569[_0x9fe0('0x1b')][_0x9fe0('0x1d')]||null:null,'limit':_0x391569['options']?_0x391569['options']['limit']||null:null,'include':_0x391569['options']?_0x391569['options']['include']?_[_0x9fe0('0x1e')](_0x391569['options'][_0x9fe0('0x1f')],function(_0x1c0e66){return{'model':db[_0x1c0e66['model']],'as':_0x1c0e66['as'],'attributes':_0x1c0e66[_0x9fe0('0x1d')],'include':_0x1c0e66['include']?_['map'](_0x1c0e66[_0x9fe0('0x1f')],function(_0xa816a4){return{'model':db[_0xa816a4[_0x9fe0('0x20')]],'as':_0xa816a4['as'],'attributes':_0xa816a4[_0x9fe0('0x1d')],'include':_0xa816a4['include']?_[_0x9fe0('0x1e')](_0xa816a4[_0x9fe0('0x1f')],function(_0x1e8d22){return{'model':db[_0x1e8d22['model']],'as':_0x1e8d22['as'],'attributes':_0x1e8d22[_0x9fe0('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x41bab7){logger[_0x9fe0('0x10')](_0x9fe0('0x1a'),_0x391569);logger[_0x9fe0('0x11')](_0x9fe0('0x1a'),_0x391569,JSON[_0x9fe0('0x14')](_0x41bab7));_0x440303(_0x41bab7);})[_0x9fe0('0x19')](function(_0x2e3fcf){logger[_0x9fe0('0x15')](_0x9fe0('0x1a'),_0x2e3fcf[_0x9fe0('0x17')],_0x391569);_0x4b2473(_0x1aec7d['error'](0x1f4,_0x2e3fcf[_0x9fe0('0x17')]));});});};exports[_0x9fe0('0x21')]=function(_0x352057){var _0x2e36f9=this;return new Promise(function(_0x26df9c,_0x224b82){return db[_0x9fe0('0x22')][_0x9fe0('0x23')]({'raw':_0x352057['options']?_0x352057[_0x9fe0('0x1b')][_0x9fe0('0x1c')]===undefined?!![]:![]:!![],'where':_0x352057['options']?_0x352057[_0x9fe0('0x1b')][_0x9fe0('0x24')]||null:null,'attributes':_0x352057[_0x9fe0('0x1b')]?_0x352057[_0x9fe0('0x1b')]['attributes']||null:null,'include':_0x352057['options']?_0x352057[_0x9fe0('0x1b')][_0x9fe0('0x1f')]?_[_0x9fe0('0x1e')](_0x352057['options']['include'],function(_0x48b080){return{'model':db[_0x48b080[_0x9fe0('0x20')]],'as':_0x48b080['as'],'attributes':_0x48b080[_0x9fe0('0x1d')],'include':_0x48b080['include']?_[_0x9fe0('0x1e')](_0x48b080[_0x9fe0('0x1f')],function(_0xcb2339){return{'model':db[_0xcb2339[_0x9fe0('0x20')]],'as':_0xcb2339['as'],'attributes':_0xcb2339['attributes'],'include':_0xcb2339['include']?_[_0x9fe0('0x1e')](_0xcb2339[_0x9fe0('0x1f')],function(_0x349b5b){return{'model':db[_0x349b5b[_0x9fe0('0x20')]],'as':_0x349b5b['as'],'attributes':_0x349b5b[_0x9fe0('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x9fe0('0xf')](function(_0x17e30e){logger[_0x9fe0('0x10')]('ShowVoiceQueue',_0x352057);logger[_0x9fe0('0x11')](_0x9fe0('0x21'),_0x352057,JSON['stringify'](_0x17e30e));_0x26df9c(_0x17e30e);})[_0x9fe0('0x19')](function(_0x3c3698){logger[_0x9fe0('0x15')](_0x9fe0('0x21'),_0x3c3698[_0x9fe0('0x17')],_0x352057);_0x224b82(_0x2e36f9[_0x9fe0('0x15')](0x1f4,_0x3c3698['message']));});});}; \ No newline at end of file +var _0x0dfd=['code','message','info','catch','VoiceQueue','findAll','options','raw','where','attributes','limit','include','map','model','GetVoiceQueue','find','ShowVoiceQueue','util','moment','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter','./voiceQueue.socket','register','request','then','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x1d372f,_0x3c25c5){var _0x1fdd5a=function(_0x1d3768){while(--_0x1d3768){_0x1d372f['push'](_0x1d372f['shift']());}};_0x1fdd5a(++_0x3c25c5);}(_0x0dfd,0x1b3));var _0xd0df=function(_0x59f55b,_0x546f52){_0x59f55b=_0x59f55b-0x0;var _0x196284=_0x0dfd[_0x59f55b];return _0x196284;};'use strict';var _=require('lodash');var util=require(_0xd0df('0x0'));var moment=require(_0xd0df('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd0df('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xd0df('0x3'))(_0xd0df('0x4'));var config=require('../../config/environment');var jayson=require(_0xd0df('0x5'));var client=jayson[_0xd0df('0x6')][_0xd0df('0x7')]({'port':0x232a});config[_0xd0df('0x8')]=_[_0xd0df('0x9')](config[_0xd0df('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0xd0df('0xa'))(new Redis(config[_0xd0df('0x8')]));require(_0xd0df('0xb'))[_0xd0df('0xc')](socket);function respondWithRpcPromise(_0x26fe75,_0x2fbf42,_0x4df3f6){return new BPromise(function(_0x29daf2,_0x2f1078){return client[_0xd0df('0xd')](_0x26fe75,_0x4df3f6)[_0xd0df('0xe')](function(_0x1e1575){logger['info'](_0xd0df('0xf'),_0x2fbf42,_0xd0df('0x10'));logger[_0xd0df('0x11')](_0xd0df('0x12'),_0x2fbf42,_0xd0df('0x10'),JSON[_0xd0df('0x13')](_0x1e1575));if(_0x1e1575['error']){if(_0x1e1575[_0xd0df('0x14')][_0xd0df('0x15')]===0x1f4){logger[_0xd0df('0x14')](_0xd0df('0xf'),_0x2fbf42,_0x1e1575[_0xd0df('0x14')][_0xd0df('0x16')]);return _0x2f1078(_0x1e1575[_0xd0df('0x14')][_0xd0df('0x16')]);}logger[_0xd0df('0x14')](_0xd0df('0xf'),_0x2fbf42,_0x1e1575[_0xd0df('0x14')][_0xd0df('0x16')]);return _0x29daf2(_0x1e1575[_0xd0df('0x14')][_0xd0df('0x16')]);}else{logger[_0xd0df('0x17')](_0xd0df('0xf'),_0x2fbf42,'request\x20sent');_0x29daf2(_0x1e1575['result'][_0xd0df('0x16')]);}})[_0xd0df('0x18')](function(_0x5bb9a6){logger[_0xd0df('0x14')](_0xd0df('0xf'),_0x2fbf42,_0x5bb9a6);_0x2f1078(_0x5bb9a6);});});}exports['GetVoiceQueue']=function(_0x12190e){var _0x5b14f1=this;return new Promise(function(_0x3f901e,_0x4966bf){return db[_0xd0df('0x19')][_0xd0df('0x1a')]({'raw':_0x12190e['options']?_0x12190e[_0xd0df('0x1b')][_0xd0df('0x1c')]===undefined?!![]:![]:!![],'where':_0x12190e[_0xd0df('0x1b')]?_0x12190e[_0xd0df('0x1b')][_0xd0df('0x1d')]||null:null,'attributes':_0x12190e['options']?_0x12190e['options'][_0xd0df('0x1e')]||null:null,'limit':_0x12190e[_0xd0df('0x1b')]?_0x12190e[_0xd0df('0x1b')][_0xd0df('0x1f')]||null:null,'include':_0x12190e[_0xd0df('0x1b')]?_0x12190e[_0xd0df('0x1b')][_0xd0df('0x20')]?_[_0xd0df('0x21')](_0x12190e[_0xd0df('0x1b')]['include'],function(_0x3df2bc){return{'model':db[_0x3df2bc[_0xd0df('0x22')]],'as':_0x3df2bc['as'],'attributes':_0x3df2bc['attributes'],'include':_0x3df2bc[_0xd0df('0x20')]?_[_0xd0df('0x21')](_0x3df2bc['include'],function(_0x78ece3){return{'model':db[_0x78ece3['model']],'as':_0x78ece3['as'],'attributes':_0x78ece3[_0xd0df('0x1e')],'include':_0x78ece3[_0xd0df('0x20')]?_[_0xd0df('0x21')](_0x78ece3[_0xd0df('0x20')],function(_0x4aec4f){return{'model':db[_0x4aec4f['model']],'as':_0x4aec4f['as'],'attributes':_0x4aec4f[_0xd0df('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xd0df('0xe')](function(_0x39015c){logger['info'](_0xd0df('0x23'),_0x12190e);logger[_0xd0df('0x11')](_0xd0df('0x23'),_0x12190e,JSON['stringify'](_0x39015c));_0x3f901e(_0x39015c);})[_0xd0df('0x18')](function(_0x5d411d){logger[_0xd0df('0x14')](_0xd0df('0x23'),_0x5d411d[_0xd0df('0x16')],_0x12190e);_0x4966bf(_0x5b14f1['error'](0x1f4,_0x5d411d[_0xd0df('0x16')]));});});};exports['ShowVoiceQueue']=function(_0x4a9a78){var _0x269515=this;return new Promise(function(_0x5afc6b,_0x210efc){return db['VoiceQueue'][_0xd0df('0x24')]({'raw':_0x4a9a78[_0xd0df('0x1b')]?_0x4a9a78[_0xd0df('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x4a9a78[_0xd0df('0x1b')]?_0x4a9a78['options'][_0xd0df('0x1d')]||null:null,'attributes':_0x4a9a78['options']?_0x4a9a78[_0xd0df('0x1b')][_0xd0df('0x1e')]||null:null,'include':_0x4a9a78[_0xd0df('0x1b')]?_0x4a9a78[_0xd0df('0x1b')][_0xd0df('0x20')]?_[_0xd0df('0x21')](_0x4a9a78[_0xd0df('0x1b')][_0xd0df('0x20')],function(_0x3a8762){return{'model':db[_0x3a8762['model']],'as':_0x3a8762['as'],'attributes':_0x3a8762[_0xd0df('0x1e')],'include':_0x3a8762['include']?_['map'](_0x3a8762['include'],function(_0xd80952){return{'model':db[_0xd80952['model']],'as':_0xd80952['as'],'attributes':_0xd80952['attributes'],'include':_0xd80952['include']?_[_0xd0df('0x21')](_0xd80952[_0xd0df('0x20')],function(_0x276125){return{'model':db[_0x276125[_0xd0df('0x22')]],'as':_0x276125['as'],'attributes':_0x276125[_0xd0df('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xd0df('0xe')](function(_0x35d8c9){logger[_0xd0df('0x17')](_0xd0df('0x25'),_0x4a9a78);logger[_0xd0df('0x11')](_0xd0df('0x25'),_0x4a9a78,JSON['stringify'](_0x35d8c9));_0x5afc6b(_0x35d8c9);})[_0xd0df('0x18')](function(_0x4c0919){logger[_0xd0df('0x14')](_0xd0df('0x25'),_0x4c0919[_0xd0df('0x16')],_0x4a9a78);_0x210efc(_0x269515[_0xd0df('0x14')](0x1f4,_0x4c0919[_0xd0df('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 15b06d5..98bfbed 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 _0x38e8=['./voiceQueue.events','remove','update','removeListener','register','voiceQueue:'];(function(_0x251ecb,_0x1d4ac4){var _0x1c0983=function(_0x442e23){while(--_0x442e23){_0x251ecb['push'](_0x251ecb['shift']());}};_0x1c0983(++_0x1d4ac4);}(_0x38e8,0x11a));var _0x838e=function(_0x4e8815,_0x586a3a){_0x4e8815=_0x4e8815-0x0;var _0x116e63=_0x38e8[_0x4e8815];return _0x116e63;};'use strict';var VoiceQueueEvents=require(_0x838e('0x0'));var events=['save',_0x838e('0x1'),_0x838e('0x2')];function createListener(_0x1ce10e,_0x166afd){return function(_0x111746){_0x166afd['emit'](_0x1ce10e,_0x111746);};}function removeListener(_0x4861d4,_0x3c0a39){return function(){VoiceQueueEvents[_0x838e('0x3')](_0x4861d4,_0x3c0a39);};}exports[_0x838e('0x4')]=function(_0x3b9c5c){for(var _0x4c93e1=0x0,_0x3d5045=events['length'];_0x4c93e1<_0x3d5045;_0x4c93e1++){var _0x164d2a=events[_0x4c93e1];var _0x25d2f2=createListener(_0x838e('0x5')+_0x164d2a,_0x3b9c5c);VoiceQueueEvents['on'](_0x164d2a,_0x25d2f2);}}; \ No newline at end of file +var _0xae87=['length','voiceQueue:','emit','removeListener','register'];(function(_0x28c5ad,_0x5794e1){var _0x181853=function(_0x17e2ab){while(--_0x17e2ab){_0x28c5ad['push'](_0x28c5ad['shift']());}};_0x181853(++_0x5794e1);}(_0xae87,0x1ce));var _0x7ae8=function(_0x385eb1,_0x497a94){_0x385eb1=_0x385eb1-0x0;var _0x5d40eb=_0xae87[_0x385eb1];return _0x5d40eb;};'use strict';var VoiceQueueEvents=require('./voiceQueue.events');var events=['save','remove','update'];function createListener(_0x39a1f3,_0x27b5e6){return function(_0x4a4e99){_0x27b5e6[_0x7ae8('0x0')](_0x39a1f3,_0x4a4e99);};}function removeListener(_0x4a22a5,_0x4ca11e){return function(){VoiceQueueEvents[_0x7ae8('0x1')](_0x4a22a5,_0x4ca11e);};}exports[_0x7ae8('0x2')]=function(_0x141978){for(var _0x3b6a2d=0x0,_0x57d2f2=events[_0x7ae8('0x3')];_0x3b6a2d<_0x57d2f2;_0x3b6a2d++){var _0x2e195a=events[_0x3b6a2d];var _0x26d4bb=createListener(_0x7ae8('0x4')+_0x2e195a,_0x141978);VoiceQueueEvents['on'](_0x2e195a,_0x26d4bb);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index ff4d9c6..c695412 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 _0x236d=['../../config/environment','isAuthenticated','index','get','/describe','/index','getVoiceQueuesReport','show','post','create','put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0xf74e6,_0x5ea367){var _0x4a6bda=function(_0x23f310){while(--_0x23f310){_0xf74e6['push'](_0xf74e6['shift']());}};_0x4a6bda(++_0x5ea367);}(_0x236d,0x7e));var _0xd236=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x236d[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xd236('0x0'));var util=require(_0xd236('0x1'));var path=require('path');var timeout=require(_0xd236('0x2'));var express=require('express');var router=express[_0xd236('0x3')]();var auth=require(_0xd236('0x4'));var interaction=require(_0xd236('0x5'));var config=require(_0xd236('0x6'));var controller=require('./voiceQueueReport.controller');router['get']('/',auth[_0xd236('0x7')](),controller[_0xd236('0x8')]);router[_0xd236('0x9')](_0xd236('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0xd236('0x9')](_0xd236('0xb'),auth['isAuthenticated'](),controller[_0xd236('0xc')]);router[_0xd236('0x9')]('/:id',auth[_0xd236('0x7')](),controller[_0xd236('0xd')]);router[_0xd236('0xe')]('/',auth['isAuthenticated'](),controller[_0xd236('0xf')]);router[_0xd236('0x10')](_0xd236('0x11'),auth['isAuthenticated'](),controller[_0xd236('0x12')]);router[_0xd236('0x13')](_0xd236('0x11'),auth[_0xd236('0x7')](),controller[_0xd236('0x14')]);module[_0xd236('0x15')]=router; \ No newline at end of file +var _0xb4b6=['../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','isAuthenticated','get','/describe','describe','getVoiceQueuesReport','/:id','show','post','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x4306d6,_0x29607b){var _0x5de70b=function(_0x409def){while(--_0x409def){_0x4306d6['push'](_0x4306d6['shift']());}};_0x5de70b(++_0x29607b);}(_0xb4b6,0x7e));var _0x6b4b=function(_0x4ee2d6,_0x512c1b){_0x4ee2d6=_0x4ee2d6-0x0;var _0x6d2f10=_0xb4b6[_0x4ee2d6];return _0x6d2f10;};'use strict';var multer=require('multer');var util=require(_0x6b4b('0x0'));var path=require(_0x6b4b('0x1'));var timeout=require(_0x6b4b('0x2'));var express=require(_0x6b4b('0x3'));var router=express[_0x6b4b('0x4')]();var auth=require(_0x6b4b('0x5'));var interaction=require(_0x6b4b('0x6'));var config=require(_0x6b4b('0x7'));var controller=require(_0x6b4b('0x8'));router['get']('/',auth[_0x6b4b('0x9')](),controller['index']);router[_0x6b4b('0xa')](_0x6b4b('0xb'),auth[_0x6b4b('0x9')](),controller[_0x6b4b('0xc')]);router[_0x6b4b('0xa')]('/index',auth[_0x6b4b('0x9')](),controller[_0x6b4b('0xd')]);router[_0x6b4b('0xa')](_0x6b4b('0xe'),auth[_0x6b4b('0x9')](),controller[_0x6b4b('0xf')]);router[_0x6b4b('0x10')]('/',auth[_0x6b4b('0x9')](),controller['create']);router[_0x6b4b('0x11')]('/:id',auth[_0x6b4b('0x9')](),controller[_0x6b4b('0x12')]);router[_0x6b4b('0x13')](_0x6b4b('0xe'),auth[_0x6b4b('0x9')](),controller[_0x6b4b('0x14')]);module[_0x6b4b('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index 1360cfc..e9b354a 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 _0xa1ab=['FORWARD,\x20BLIND,\x20ATTENDED','moment','exports','STRING','DATE','getDataValue','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','queuecallerleaveAt','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'];(function(_0x162d89,_0x4904e7){var _0x4af420=function(_0x564dfb){while(--_0x564dfb){_0x162d89['push'](_0x162d89['shift']());}};_0x4af420(++_0x4904e7);}(_0xa1ab,0x1a1));var _0xba1a=function(_0x88929e,_0x9097e3){_0x88929e=_0x88929e-0x0;var _0x514d08=_0xa1ab[_0x88929e];return _0x514d08;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xba1a('0x0'));module[_0xba1a('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xba1a('0x2')]},'calleridname':{'type':Sequelize[_0xba1a('0x2')]},'queue':{'type':Sequelize[_0xba1a('0x2')]},'queuecallerjoinAt':{'type':Sequelize[_0xba1a('0x3')]},'queuecallerleaveAt':{'type':Sequelize[_0xba1a('0x3')],'set':function(_0xa2e23a){var _0x5ee8c5=moment(_0xa2e23a);var _0x20b66c=moment(this[_0xba1a('0x4')](_0xba1a('0x5')))[_0xba1a('0x6')](_0xba1a('0x7'));var _0x1a2cd3=_0x5ee8c5[_0xba1a('0x8')](_0x20b66c,_0xba1a('0x9'));this[_0xba1a('0xa')](_0xba1a('0xb'),_0xa2e23a);this[_0xba1a('0xa')]('holdtime',_0x1a2cd3||null);}},'position':{'type':Sequelize[_0xba1a('0xc')]},'count':{'type':Sequelize[_0xba1a('0xc')]},'queuecallerabandon':{'type':Sequelize[_0xba1a('0xd')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0xba1a('0x3')]},'queuecallercomplete':{'type':Sequelize[_0xba1a('0xd')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize[_0xba1a('0xd')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0xba1a('0x3')]},'queuecallerexitreason':{'type':Sequelize[_0xba1a('0x2')],'comment':_0xba1a('0xe')},'originalposition':{'type':Sequelize[_0xba1a('0xc')]},'channel':{'type':Sequelize[_0xba1a('0x2')]},'connectedlinenum':{'type':Sequelize[_0xba1a('0x2')]},'connectedlinename':{'type':Sequelize[_0xba1a('0x2')]},'accountcode':{'type':Sequelize[_0xba1a('0x2')]},'context':{'type':Sequelize[_0xba1a('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xba1a('0x2')]},'holdtime':{'type':Sequelize[_0xba1a('0xc')]},'mohtime':{'type':Sequelize[_0xba1a('0xc')],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xba1a('0x2')],'comment':_0xba1a('0xf')},'transferexten':{'type':Sequelize[_0xba1a('0x2')]},'transferuniqueid':{'type':Sequelize[_0xba1a('0x2')]},'disposition':{'type':Sequelize[_0xba1a('0x2')]},'queuecallerenterreason':{'type':Sequelize[_0xba1a('0xc')],'defaultValue':0x0}}; \ No newline at end of file +var _0x7d14=['queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','sequelize','moment','STRING','DATE','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue'];(function(_0x588a98,_0x8d0cdf){var _0x121fd7=function(_0x2a27f7){while(--_0x2a27f7){_0x588a98['push'](_0x588a98['shift']());}};_0x121fd7(++_0x8d0cdf);}(_0x7d14,0x6d));var _0x47d1=function(_0x46c7c1,_0x414087){_0x46c7c1=_0x46c7c1-0x0;var _0x2c11de=_0x7d14[_0x46c7c1];return _0x2c11de;};'use strict';var Sequelize=require(_0x47d1('0x0'));var moment=require(_0x47d1('0x1'));module['exports']={'type':{'type':Sequelize[_0x47d1('0x2')]},'uniqueid':{'type':Sequelize[_0x47d1('0x2')]},'calleridnum':{'type':Sequelize[_0x47d1('0x2')]},'calleridname':{'type':Sequelize[_0x47d1('0x2')]},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize[_0x47d1('0x3')]},'queuecallerleaveAt':{'type':Sequelize[_0x47d1('0x3')],'set':function(_0x8f3654){var _0x244bbf=moment(_0x8f3654);var _0x1b2f47=moment(this['getDataValue']('queuecallerjoinAt'))['format'](_0x47d1('0x4'));var _0x57d410=_0x244bbf[_0x47d1('0x5')](_0x1b2f47,_0x47d1('0x6'));this[_0x47d1('0x7')](_0x47d1('0x8'),_0x8f3654);this[_0x47d1('0x7')](_0x47d1('0x9'),_0x57d410||null);}},'position':{'type':Sequelize[_0x47d1('0xa')]},'count':{'type':Sequelize[_0x47d1('0xa')]},'queuecallerabandon':{'type':Sequelize[_0x47d1('0xb')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x47d1('0x3')]},'queuecallercomplete':{'type':Sequelize[_0x47d1('0xb')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x47d1('0x3')]},'queuecallerexit':{'type':Sequelize[_0x47d1('0xb')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize['DATE']},'queuecallerexitreason':{'type':Sequelize[_0x47d1('0x2')],'comment':_0x47d1('0xc')},'originalposition':{'type':Sequelize[_0x47d1('0xa')]},'channel':{'type':Sequelize[_0x47d1('0x2')]},'connectedlinenum':{'type':Sequelize[_0x47d1('0x2')]},'connectedlinename':{'type':Sequelize[_0x47d1('0x2')]},'accountcode':{'type':Sequelize[_0x47d1('0x2')]},'context':{'type':Sequelize[_0x47d1('0x2')]},'exten':{'type':Sequelize[_0x47d1('0x2')]},'priority':{'type':Sequelize[_0x47d1('0x2')]},'holdtime':{'type':Sequelize[_0x47d1('0xa')]},'mohtime':{'type':Sequelize[_0x47d1('0xa')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x47d1('0xb')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x47d1('0x2')]},'transfer':{'type':Sequelize[_0x47d1('0xb')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x47d1('0x2')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0x47d1('0x2')]},'disposition':{'type':Sequelize[_0x47d1('0x2')]},'queuecallerenterreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index 9e4f284..f3c30c3 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 _0x7a54=['hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','VoiceQueueReport','includeAll','include','findAll','rows','catch','show','keys','options','find','create','body','params','describe','getVoiceQueuesReport','intersection','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./voiceQueueReport.socket','register','sendStatus','end','status','count','offset','limit','set','json','apply','reject','update','destroy','then','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','filters','attributes','fields','length'];(function(_0x20ef64,_0x4a8fe9){var _0x3707d8=function(_0x5b9a88){while(--_0x5b9a88){_0x20ef64['push'](_0x20ef64['shift']());}};_0x3707d8(++_0x4a8fe9);}(_0x7a54,0x106));var _0x47a5=function(_0x26179a,_0x29620b){_0x26179a=_0x26179a-0x0;var _0x3624d3=_0x7a54[_0x26179a];return _0x3624d3;};'use strict';var pdf=require(_0x47a5('0x0'));var emlformat=require(_0x47a5('0x1'));var rimraf=require(_0x47a5('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x47a5('0x3'));var rp=require(_0x47a5('0x4'));var moment=require('moment');var BPromise=require(_0x47a5('0x5'));var Mustache=require(_0x47a5('0x6'));var util=require(_0x47a5('0x7'));var path=require(_0x47a5('0x8'));var sox=require(_0x47a5('0x9'));var csv=require('to-csv');var ejs=require(_0x47a5('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var db=require(_0x47a5('0x14'))['db'];config[_0x47a5('0x15')]=_[_0x47a5('0x16')](config[_0x47a5('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0x47a5('0x17'))(new Redis(config[_0x47a5('0x15')]));require(_0x47a5('0x18'))[_0x47a5('0x19')](socket);function respondWithStatusCode(_0x139f25,_0x620ee9){_0x620ee9=_0x620ee9||0xcc;return function(_0x3c6c46){if(_0x3c6c46){return _0x139f25[_0x47a5('0x1a')](_0x620ee9);}return _0x139f25['status'](_0x620ee9)[_0x47a5('0x1b')]();};}function respondWithResult(_0x11faf5,_0x3b001e){_0x3b001e=_0x3b001e||0xc8;return function(_0x2a2cbb){if(_0x2a2cbb){return _0x11faf5[_0x47a5('0x1c')](_0x3b001e)['json'](_0x2a2cbb);}};}function respondWithFilteredResult(_0x549de3,_0x138bc0){return function(_0x4b966e){if(_0x4b966e){var _0x5247fd=_0x4b966e[_0x47a5('0x1d')],_0x423a81=_0x138bc0[_0x47a5('0x1e')],_0xaf70a6=_0x138bc0[_0x47a5('0x1e')]+_0x138bc0[_0x47a5('0x1f')],_0x2ce454;if(_0xaf70a6>=_0x5247fd){_0xaf70a6=_0x5247fd;_0x2ce454=0xc8;}else{_0x2ce454=0xce;}_0x549de3[_0x47a5('0x1c')](_0x2ce454);return _0x549de3[_0x47a5('0x20')]('Content-Range',_0x423a81+'-'+_0xaf70a6+'/'+_0x5247fd)[_0x47a5('0x21')](_0x4b966e);}return null;};}function patchUpdates(_0xf160ba){return function(_0x47cf3c){try{jsonpatch[_0x47a5('0x22')](_0x47cf3c,_0xf160ba,!![]);}catch(_0x1f03f7){return BPromise[_0x47a5('0x23')](_0x1f03f7);}return _0x47cf3c['save']();};}function saveUpdates(_0xb8ae6c,_0x2f142b){return function(_0x23db32){if(_0x23db32){return _0x23db32[_0x47a5('0x24')](_0xb8ae6c)['then'](function(_0xe2dea9){return _0xe2dea9;});}return null;};}function removeEntity(_0x385687,_0x513981){return function(_0x28747d){if(_0x28747d){return _0x28747d[_0x47a5('0x25')]()[_0x47a5('0x26')](function(){_0x385687[_0x47a5('0x1c')](0xcc)[_0x47a5('0x1b')]();});}};}function handleEntityNotFound(_0x50bf17,_0x53078a){return function(_0x136745){if(!_0x136745){_0x50bf17['sendStatus'](0x194);}return _0x136745;};}function handleError(_0x1ea9c8,_0x5b6c4e){_0x5b6c4e=_0x5b6c4e||0x1f4;return function(_0x23cb77){logger[_0x47a5('0x27')](_0x23cb77[_0x47a5('0x28')]);if(_0x23cb77[_0x47a5('0x29')]){delete _0x23cb77[_0x47a5('0x29')];}_0x1ea9c8[_0x47a5('0x1c')](_0x5b6c4e)[_0x47a5('0x2a')](_0x23cb77);};}exports[_0x47a5('0x2b')]=function(_0x16631f,_0x361bfa){var _0x1127f8={},_0x11a4fa={},_0x3ad507={'count':0x0,'rows':[]};var _0x528582=_[_0x47a5('0x2c')](db['VoiceQueueReport'][_0x47a5('0x2d')],function(_0x9ac908){return{'name':_0x9ac908[_0x47a5('0x2e')],'type':_0x9ac908['type'][_0x47a5('0x2f')]};});_0x11a4fa[_0x47a5('0x30')]=_[_0x47a5('0x2c')](_0x528582,_0x47a5('0x29'));_0x11a4fa['query']=_['keys'](_0x16631f[_0x47a5('0x31')]);_0x11a4fa[_0x47a5('0x32')]=_['intersection'](_0x11a4fa['model'],_0x11a4fa[_0x47a5('0x31')]);_0x1127f8[_0x47a5('0x33')]=_['intersection'](_0x11a4fa[_0x47a5('0x30')],qs['fields'](_0x16631f[_0x47a5('0x31')][_0x47a5('0x34')]));_0x1127f8['attributes']=_0x1127f8['attributes'][_0x47a5('0x35')]?_0x1127f8['attributes']:_0x11a4fa[_0x47a5('0x30')];if(!_0x16631f[_0x47a5('0x31')][_0x47a5('0x36')]('nolimit')){_0x1127f8[_0x47a5('0x1f')]=qs['limit'](_0x16631f['query'][_0x47a5('0x1f')]);_0x1127f8['offset']=qs[_0x47a5('0x1e')](_0x16631f['query'][_0x47a5('0x1e')]);}_0x1127f8[_0x47a5('0x37')]=qs[_0x47a5('0x38')](_0x16631f[_0x47a5('0x31')][_0x47a5('0x38')]);_0x1127f8[_0x47a5('0x39')]=qs[_0x47a5('0x32')](_[_0x47a5('0x3a')](_0x16631f[_0x47a5('0x31')],_0x11a4fa['filters']),_0x528582);if(_0x16631f[_0x47a5('0x31')][_0x47a5('0x3b')]){_0x1127f8['where']=_[_0x47a5('0x3c')](_0x1127f8[_0x47a5('0x39')],{'$or':_[_0x47a5('0x2c')](_0x528582,function(_0x49c4b5){if(_0x49c4b5[_0x47a5('0x3d')]!==_0x47a5('0x3e')){var _0x596097={};_0x596097[_0x49c4b5[_0x47a5('0x29')]]={'$like':'%'+_0x16631f[_0x47a5('0x31')]['filter']+'%'};return _0x596097;}})});}_0x1127f8=_['merge']({},_0x1127f8,_0x16631f['options']);var _0x12d9f2={'where':_0x1127f8['where']};return db[_0x47a5('0x3f')][_0x47a5('0x1d')](_0x12d9f2)[_0x47a5('0x26')](function(_0x111f0d){_0x3ad507[_0x47a5('0x1d')]=_0x111f0d;if(_0x16631f[_0x47a5('0x31')][_0x47a5('0x40')]){_0x1127f8[_0x47a5('0x41')]=[{'all':!![]}];}return db[_0x47a5('0x3f')][_0x47a5('0x42')](_0x1127f8);})[_0x47a5('0x26')](function(_0x1658e8){_0x3ad507[_0x47a5('0x43')]=_0x1658e8;return _0x3ad507;})['then'](respondWithFilteredResult(_0x361bfa,_0x1127f8))[_0x47a5('0x44')](handleError(_0x361bfa,null));};exports[_0x47a5('0x45')]=function(_0x331474,_0x23bd8d){var _0x586f4f={'raw':![],'where':{'id':_0x331474['params']['id']}},_0x7de536={};_0x7de536['model']=_['keys'](db['VoiceQueueReport'][_0x47a5('0x2d')]);_0x7de536['query']=_[_0x47a5('0x46')](_0x331474[_0x47a5('0x31')]);_0x7de536[_0x47a5('0x32')]=_['intersection'](_0x7de536[_0x47a5('0x30')],_0x7de536[_0x47a5('0x31')]);_0x586f4f['attributes']=_['intersection'](_0x7de536[_0x47a5('0x30')],qs['fields'](_0x331474[_0x47a5('0x31')][_0x47a5('0x34')]));_0x586f4f[_0x47a5('0x33')]=_0x586f4f[_0x47a5('0x33')][_0x47a5('0x35')]?_0x586f4f[_0x47a5('0x33')]:_0x7de536[_0x47a5('0x30')];if(_0x331474[_0x47a5('0x31')][_0x47a5('0x40')]){_0x586f4f[_0x47a5('0x41')]=[{'all':!![]}];}_0x586f4f=_[_0x47a5('0x3c')]({},_0x586f4f,_0x331474[_0x47a5('0x47')]);return db[_0x47a5('0x3f')][_0x47a5('0x48')](_0x586f4f)[_0x47a5('0x26')](handleEntityNotFound(_0x23bd8d,null))[_0x47a5('0x26')](respondWithResult(_0x23bd8d,null))['catch'](handleError(_0x23bd8d,null));};exports[_0x47a5('0x49')]=function(_0x23bb04,_0x49eab1){return db['VoiceQueueReport'][_0x47a5('0x49')](_0x23bb04['body'],{})[_0x47a5('0x26')](respondWithResult(_0x49eab1,0xc9))[_0x47a5('0x44')](handleError(_0x49eab1,null));};exports['update']=function(_0x4f62d3,_0x3d85cc){if(_0x4f62d3['body']['id']){delete _0x4f62d3[_0x47a5('0x4a')]['id'];}return db[_0x47a5('0x3f')][_0x47a5('0x48')]({'where':{'id':_0x4f62d3[_0x47a5('0x4b')]['id']}})[_0x47a5('0x26')](handleEntityNotFound(_0x3d85cc,null))[_0x47a5('0x26')](saveUpdates(_0x4f62d3[_0x47a5('0x4a')],null))['then'](respondWithResult(_0x3d85cc,null))['catch'](handleError(_0x3d85cc,null));};exports[_0x47a5('0x25')]=function(_0x411230,_0x1163e3){return db[_0x47a5('0x3f')][_0x47a5('0x48')]({'where':{'id':_0x411230[_0x47a5('0x4b')]['id']}})[_0x47a5('0x26')](handleEntityNotFound(_0x1163e3,null))['then'](removeEntity(_0x1163e3,null))[_0x47a5('0x44')](handleError(_0x1163e3,null));};exports[_0x47a5('0x4c')]=function(_0x5f6a,_0x5c3c75){return db[_0x47a5('0x3f')]['describe']()[_0x47a5('0x26')](respondWithResult(_0x5c3c75,null))[_0x47a5('0x44')](handleError(_0x5c3c75,null));};exports[_0x47a5('0x4d')]=function(_0xf03bd5,_0x588551){var _0x3adf14={},_0x1e6de3={},_0x2f66e9={'count':0x0,'rows':[]};_0x1e6de3[_0x47a5('0x30')]=_[_0x47a5('0x46')](db[_0x47a5('0x3f')][_0x47a5('0x2d')]);_0x1e6de3['query']=_[_0x47a5('0x46')](_0xf03bd5[_0x47a5('0x31')]);_0x1e6de3[_0x47a5('0x32')]=_[_0x47a5('0x4e')](_0x1e6de3[_0x47a5('0x30')],_0x1e6de3[_0x47a5('0x31')]);_0x3adf14['attributes']=_[_0x47a5('0x4e')](_0x1e6de3[_0x47a5('0x30')],qs[_0x47a5('0x34')](_0xf03bd5['query'][_0x47a5('0x34')]));_0x3adf14[_0x47a5('0x33')]=_0x3adf14[_0x47a5('0x33')]['length']?_0x3adf14['attributes']:_0x1e6de3[_0x47a5('0x30')];if(!_0xf03bd5[_0x47a5('0x31')]['hasOwnProperty']('nolimit')){_0x3adf14[_0x47a5('0x1f')]=qs['limit'](_0xf03bd5[_0x47a5('0x31')]['limit']);_0x3adf14['offset']=qs[_0x47a5('0x1e')](_0xf03bd5[_0x47a5('0x31')]['offset']);}_0x3adf14[_0x47a5('0x37')]=qs[_0x47a5('0x38')](_0xf03bd5['query']['sort']);_0x3adf14[_0x47a5('0x39')]=qs[_0x47a5('0x32')](_[_0x47a5('0x3a')](_0xf03bd5[_0x47a5('0x31')],_0x1e6de3['filters']));if(_0xf03bd5[_0x47a5('0x31')][_0x47a5('0x3b')]){_0x3adf14[_0x47a5('0x39')]=_['merge'](_0x3adf14[_0x47a5('0x39')],{'$or':_['map'](_0x3adf14[_0x47a5('0x33')],function(_0x470da6){var _0x943a15={};_0x943a15[_0x470da6]={'$like':'%'+_0xf03bd5[_0x47a5('0x31')][_0x47a5('0x3b')]+'%'};return _0x943a15;})});}_0x3adf14=_['merge']({},_0x3adf14,_0xf03bd5[_0x47a5('0x47')]);var _0x5d1550={'where':_0x3adf14['where']};return db['VoiceQueueReport']['count'](_0x5d1550)[_0x47a5('0x26')](function(_0x6cd4ea){_0x2f66e9[_0x47a5('0x1d')]=_0x6cd4ea;if(_0xf03bd5['query']['includeAll']){_0x3adf14[_0x47a5('0x41')]=[{'all':!![]}];}return db[_0x47a5('0x3f')][_0x47a5('0x42')](_0x3adf14);})[_0x47a5('0x26')](function(_0xc45e25){_0x2f66e9['rows']=_0xc45e25;return _0x2f66e9;})[_0x47a5('0x26')](respondWithFilteredResult(_0x588551,_0x3adf14,'getVoiceQueuesReport'))[_0x47a5('0x44')](handleError(_0x588551,null,_0x47a5('0x4d')));}; \ No newline at end of file +var _0x7a54=['hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','VoiceQueueReport','includeAll','include','findAll','rows','catch','show','keys','options','find','create','body','params','describe','getVoiceQueuesReport','intersection','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./voiceQueueReport.socket','register','sendStatus','end','status','count','offset','limit','set','json','apply','reject','update','destroy','then','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','filters','attributes','fields','length'];(function(_0x176329,_0x568c84){var _0x31997c=function(_0x3d64df){while(--_0x3d64df){_0x176329['push'](_0x176329['shift']());}};_0x31997c(++_0x568c84);}(_0x7a54,0x106));var _0x47a5=function(_0x2cebef,_0x26f70d){_0x2cebef=_0x2cebef-0x0;var _0x4c8896=_0x7a54[_0x2cebef];return _0x4c8896;};'use strict';var pdf=require(_0x47a5('0x0'));var emlformat=require(_0x47a5('0x1'));var rimraf=require(_0x47a5('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x47a5('0x3'));var rp=require(_0x47a5('0x4'));var moment=require('moment');var BPromise=require(_0x47a5('0x5'));var Mustache=require(_0x47a5('0x6'));var util=require(_0x47a5('0x7'));var path=require(_0x47a5('0x8'));var sox=require(_0x47a5('0x9'));var csv=require('to-csv');var ejs=require(_0x47a5('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var db=require(_0x47a5('0x14'))['db'];config[_0x47a5('0x15')]=_[_0x47a5('0x16')](config[_0x47a5('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0x47a5('0x17'))(new Redis(config[_0x47a5('0x15')]));require(_0x47a5('0x18'))[_0x47a5('0x19')](socket);function respondWithStatusCode(_0x139f25,_0x620ee9){_0x620ee9=_0x620ee9||0xcc;return function(_0x3c6c46){if(_0x3c6c46){return _0x139f25[_0x47a5('0x1a')](_0x620ee9);}return _0x139f25['status'](_0x620ee9)[_0x47a5('0x1b')]();};}function respondWithResult(_0x11faf5,_0x3b001e){_0x3b001e=_0x3b001e||0xc8;return function(_0x2a2cbb){if(_0x2a2cbb){return _0x11faf5[_0x47a5('0x1c')](_0x3b001e)['json'](_0x2a2cbb);}};}function respondWithFilteredResult(_0x549de3,_0x138bc0){return function(_0x4b966e){if(_0x4b966e){var _0x5247fd=_0x4b966e[_0x47a5('0x1d')],_0x423a81=_0x138bc0[_0x47a5('0x1e')],_0xaf70a6=_0x138bc0[_0x47a5('0x1e')]+_0x138bc0[_0x47a5('0x1f')],_0x2ce454;if(_0xaf70a6>=_0x5247fd){_0xaf70a6=_0x5247fd;_0x2ce454=0xc8;}else{_0x2ce454=0xce;}_0x549de3[_0x47a5('0x1c')](_0x2ce454);return _0x549de3[_0x47a5('0x20')]('Content-Range',_0x423a81+'-'+_0xaf70a6+'/'+_0x5247fd)[_0x47a5('0x21')](_0x4b966e);}return null;};}function patchUpdates(_0xf160ba){return function(_0x47cf3c){try{jsonpatch[_0x47a5('0x22')](_0x47cf3c,_0xf160ba,!![]);}catch(_0x1f03f7){return BPromise[_0x47a5('0x23')](_0x1f03f7);}return _0x47cf3c['save']();};}function saveUpdates(_0xb8ae6c,_0x2f142b){return function(_0x23db32){if(_0x23db32){return _0x23db32[_0x47a5('0x24')](_0xb8ae6c)['then'](function(_0xe2dea9){return _0xe2dea9;});}return null;};}function removeEntity(_0x385687,_0x513981){return function(_0x28747d){if(_0x28747d){return _0x28747d[_0x47a5('0x25')]()[_0x47a5('0x26')](function(){_0x385687[_0x47a5('0x1c')](0xcc)[_0x47a5('0x1b')]();});}};}function handleEntityNotFound(_0x50bf17,_0x53078a){return function(_0x136745){if(!_0x136745){_0x50bf17['sendStatus'](0x194);}return _0x136745;};}function handleError(_0x1ea9c8,_0x5b6c4e){_0x5b6c4e=_0x5b6c4e||0x1f4;return function(_0x23cb77){logger[_0x47a5('0x27')](_0x23cb77[_0x47a5('0x28')]);if(_0x23cb77[_0x47a5('0x29')]){delete _0x23cb77[_0x47a5('0x29')];}_0x1ea9c8[_0x47a5('0x1c')](_0x5b6c4e)[_0x47a5('0x2a')](_0x23cb77);};}exports[_0x47a5('0x2b')]=function(_0x16631f,_0x361bfa){var _0x1127f8={},_0x11a4fa={},_0x3ad507={'count':0x0,'rows':[]};var _0x528582=_[_0x47a5('0x2c')](db['VoiceQueueReport'][_0x47a5('0x2d')],function(_0x9ac908){return{'name':_0x9ac908[_0x47a5('0x2e')],'type':_0x9ac908['type'][_0x47a5('0x2f')]};});_0x11a4fa[_0x47a5('0x30')]=_[_0x47a5('0x2c')](_0x528582,_0x47a5('0x29'));_0x11a4fa['query']=_['keys'](_0x16631f[_0x47a5('0x31')]);_0x11a4fa[_0x47a5('0x32')]=_['intersection'](_0x11a4fa['model'],_0x11a4fa[_0x47a5('0x31')]);_0x1127f8[_0x47a5('0x33')]=_['intersection'](_0x11a4fa[_0x47a5('0x30')],qs['fields'](_0x16631f[_0x47a5('0x31')][_0x47a5('0x34')]));_0x1127f8['attributes']=_0x1127f8['attributes'][_0x47a5('0x35')]?_0x1127f8['attributes']:_0x11a4fa[_0x47a5('0x30')];if(!_0x16631f[_0x47a5('0x31')][_0x47a5('0x36')]('nolimit')){_0x1127f8[_0x47a5('0x1f')]=qs['limit'](_0x16631f['query'][_0x47a5('0x1f')]);_0x1127f8['offset']=qs[_0x47a5('0x1e')](_0x16631f['query'][_0x47a5('0x1e')]);}_0x1127f8[_0x47a5('0x37')]=qs[_0x47a5('0x38')](_0x16631f[_0x47a5('0x31')][_0x47a5('0x38')]);_0x1127f8[_0x47a5('0x39')]=qs[_0x47a5('0x32')](_[_0x47a5('0x3a')](_0x16631f[_0x47a5('0x31')],_0x11a4fa['filters']),_0x528582);if(_0x16631f[_0x47a5('0x31')][_0x47a5('0x3b')]){_0x1127f8['where']=_[_0x47a5('0x3c')](_0x1127f8[_0x47a5('0x39')],{'$or':_[_0x47a5('0x2c')](_0x528582,function(_0x49c4b5){if(_0x49c4b5[_0x47a5('0x3d')]!==_0x47a5('0x3e')){var _0x596097={};_0x596097[_0x49c4b5[_0x47a5('0x29')]]={'$like':'%'+_0x16631f[_0x47a5('0x31')]['filter']+'%'};return _0x596097;}})});}_0x1127f8=_['merge']({},_0x1127f8,_0x16631f['options']);var _0x12d9f2={'where':_0x1127f8['where']};return db[_0x47a5('0x3f')][_0x47a5('0x1d')](_0x12d9f2)[_0x47a5('0x26')](function(_0x111f0d){_0x3ad507[_0x47a5('0x1d')]=_0x111f0d;if(_0x16631f[_0x47a5('0x31')][_0x47a5('0x40')]){_0x1127f8[_0x47a5('0x41')]=[{'all':!![]}];}return db[_0x47a5('0x3f')][_0x47a5('0x42')](_0x1127f8);})[_0x47a5('0x26')](function(_0x1658e8){_0x3ad507[_0x47a5('0x43')]=_0x1658e8;return _0x3ad507;})['then'](respondWithFilteredResult(_0x361bfa,_0x1127f8))[_0x47a5('0x44')](handleError(_0x361bfa,null));};exports[_0x47a5('0x45')]=function(_0x331474,_0x23bd8d){var _0x586f4f={'raw':![],'where':{'id':_0x331474['params']['id']}},_0x7de536={};_0x7de536['model']=_['keys'](db['VoiceQueueReport'][_0x47a5('0x2d')]);_0x7de536['query']=_[_0x47a5('0x46')](_0x331474[_0x47a5('0x31')]);_0x7de536[_0x47a5('0x32')]=_['intersection'](_0x7de536[_0x47a5('0x30')],_0x7de536[_0x47a5('0x31')]);_0x586f4f['attributes']=_['intersection'](_0x7de536[_0x47a5('0x30')],qs['fields'](_0x331474[_0x47a5('0x31')][_0x47a5('0x34')]));_0x586f4f[_0x47a5('0x33')]=_0x586f4f[_0x47a5('0x33')][_0x47a5('0x35')]?_0x586f4f[_0x47a5('0x33')]:_0x7de536[_0x47a5('0x30')];if(_0x331474[_0x47a5('0x31')][_0x47a5('0x40')]){_0x586f4f[_0x47a5('0x41')]=[{'all':!![]}];}_0x586f4f=_[_0x47a5('0x3c')]({},_0x586f4f,_0x331474[_0x47a5('0x47')]);return db[_0x47a5('0x3f')][_0x47a5('0x48')](_0x586f4f)[_0x47a5('0x26')](handleEntityNotFound(_0x23bd8d,null))[_0x47a5('0x26')](respondWithResult(_0x23bd8d,null))['catch'](handleError(_0x23bd8d,null));};exports[_0x47a5('0x49')]=function(_0x23bb04,_0x49eab1){return db['VoiceQueueReport'][_0x47a5('0x49')](_0x23bb04['body'],{})[_0x47a5('0x26')](respondWithResult(_0x49eab1,0xc9))[_0x47a5('0x44')](handleError(_0x49eab1,null));};exports['update']=function(_0x4f62d3,_0x3d85cc){if(_0x4f62d3['body']['id']){delete _0x4f62d3[_0x47a5('0x4a')]['id'];}return db[_0x47a5('0x3f')][_0x47a5('0x48')]({'where':{'id':_0x4f62d3[_0x47a5('0x4b')]['id']}})[_0x47a5('0x26')](handleEntityNotFound(_0x3d85cc,null))[_0x47a5('0x26')](saveUpdates(_0x4f62d3[_0x47a5('0x4a')],null))['then'](respondWithResult(_0x3d85cc,null))['catch'](handleError(_0x3d85cc,null));};exports[_0x47a5('0x25')]=function(_0x411230,_0x1163e3){return db[_0x47a5('0x3f')][_0x47a5('0x48')]({'where':{'id':_0x411230[_0x47a5('0x4b')]['id']}})[_0x47a5('0x26')](handleEntityNotFound(_0x1163e3,null))['then'](removeEntity(_0x1163e3,null))[_0x47a5('0x44')](handleError(_0x1163e3,null));};exports[_0x47a5('0x4c')]=function(_0x5f6a,_0x5c3c75){return db[_0x47a5('0x3f')]['describe']()[_0x47a5('0x26')](respondWithResult(_0x5c3c75,null))[_0x47a5('0x44')](handleError(_0x5c3c75,null));};exports[_0x47a5('0x4d')]=function(_0xf03bd5,_0x588551){var _0x3adf14={},_0x1e6de3={},_0x2f66e9={'count':0x0,'rows':[]};_0x1e6de3[_0x47a5('0x30')]=_[_0x47a5('0x46')](db[_0x47a5('0x3f')][_0x47a5('0x2d')]);_0x1e6de3['query']=_[_0x47a5('0x46')](_0xf03bd5[_0x47a5('0x31')]);_0x1e6de3[_0x47a5('0x32')]=_[_0x47a5('0x4e')](_0x1e6de3[_0x47a5('0x30')],_0x1e6de3[_0x47a5('0x31')]);_0x3adf14['attributes']=_[_0x47a5('0x4e')](_0x1e6de3[_0x47a5('0x30')],qs[_0x47a5('0x34')](_0xf03bd5['query'][_0x47a5('0x34')]));_0x3adf14[_0x47a5('0x33')]=_0x3adf14[_0x47a5('0x33')]['length']?_0x3adf14['attributes']:_0x1e6de3[_0x47a5('0x30')];if(!_0xf03bd5[_0x47a5('0x31')]['hasOwnProperty']('nolimit')){_0x3adf14[_0x47a5('0x1f')]=qs['limit'](_0xf03bd5[_0x47a5('0x31')]['limit']);_0x3adf14['offset']=qs[_0x47a5('0x1e')](_0xf03bd5[_0x47a5('0x31')]['offset']);}_0x3adf14[_0x47a5('0x37')]=qs[_0x47a5('0x38')](_0xf03bd5['query']['sort']);_0x3adf14[_0x47a5('0x39')]=qs[_0x47a5('0x32')](_[_0x47a5('0x3a')](_0xf03bd5[_0x47a5('0x31')],_0x1e6de3['filters']));if(_0xf03bd5[_0x47a5('0x31')][_0x47a5('0x3b')]){_0x3adf14[_0x47a5('0x39')]=_['merge'](_0x3adf14[_0x47a5('0x39')],{'$or':_['map'](_0x3adf14[_0x47a5('0x33')],function(_0x470da6){var _0x943a15={};_0x943a15[_0x470da6]={'$like':'%'+_0xf03bd5[_0x47a5('0x31')][_0x47a5('0x3b')]+'%'};return _0x943a15;})});}_0x3adf14=_['merge']({},_0x3adf14,_0xf03bd5[_0x47a5('0x47')]);var _0x5d1550={'where':_0x3adf14['where']};return db['VoiceQueueReport']['count'](_0x5d1550)[_0x47a5('0x26')](function(_0x6cd4ea){_0x2f66e9[_0x47a5('0x1d')]=_0x6cd4ea;if(_0xf03bd5['query']['includeAll']){_0x3adf14[_0x47a5('0x41')]=[{'all':!![]}];}return db[_0x47a5('0x3f')][_0x47a5('0x42')](_0x3adf14);})[_0x47a5('0x26')](function(_0xc45e25){_0x2f66e9['rows']=_0xc45e25;return _0x2f66e9;})[_0x47a5('0x26')](respondWithFilteredResult(_0x588551,_0x3adf14,'getVoiceQueuesReport'))[_0x47a5('0x44')](handleError(_0x588551,null,_0x47a5('0x4d')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index ae7a4d4..9b342b5 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 _0xe054=['events','../../mysqldb','VoiceQueueReport','setMaxListeners','remove','emit','hasOwnProperty','hook','exports'];(function(_0x104171,_0x5a9705){var _0x3e8928=function(_0x16f59a){while(--_0x16f59a){_0x104171['push'](_0x104171['shift']());}};_0x3e8928(++_0x5a9705);}(_0xe054,0x99));var _0x4e05=function(_0x49be9d,_0x53fcd4){_0x49be9d=_0x49be9d-0x0;var _0x313bca=_0xe054[_0x49be9d];return _0x313bca;};'use strict';var EventEmitter=require(_0x4e05('0x0'));var VoiceQueueReport=require(_0x4e05('0x1'))['db'][_0x4e05('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x4e05('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x4e05('0x4')};function emitEvent(_0x256562){return function(_0x22d3de,_0x59a86c,_0xc1e32f){VoiceQueueReportEvents[_0x4e05('0x5')](_0x256562+':'+_0x22d3de['id'],_0x22d3de);VoiceQueueReportEvents[_0x4e05('0x5')](_0x256562,_0x22d3de);_0xc1e32f(null);};}for(var e in events){if(events[_0x4e05('0x6')](e)){var event=events[e];VoiceQueueReport[_0x4e05('0x7')](e,emitEvent(event));}}module[_0x4e05('0x8')]=VoiceQueueReportEvents; \ No newline at end of file +var _0x052c=['events','../../mysqldb','VoiceQueueReport','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports'];(function(_0x5a4012,_0x1b1487){var _0x3fb44b=function(_0x2ce954){while(--_0x2ce954){_0x5a4012['push'](_0x5a4012['shift']());}};_0x3fb44b(++_0x1b1487);}(_0x052c,0xe6));var _0xc052=function(_0x575650,_0x5ed464){_0x575650=_0x575650-0x0;var _0xddb5c3=_0x052c[_0x575650];return _0xddb5c3;};'use strict';var EventEmitter=require(_0xc052('0x0'));var VoiceQueueReport=require(_0xc052('0x1'))['db'][_0xc052('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0xc052('0x3')](0x0);var events={'afterCreate':_0xc052('0x4'),'afterUpdate':_0xc052('0x5'),'afterDestroy':'remove'};function emitEvent(_0x4b5aa3){return function(_0x2e39c4,_0x2026b2,_0x51394f){VoiceQueueReportEvents[_0xc052('0x6')](_0x4b5aa3+':'+_0x2e39c4['id'],_0x2e39c4);VoiceQueueReportEvents[_0xc052('0x6')](_0x4b5aa3,_0x2e39c4);_0x51394f(null);};}for(var e in events){if(events[_0xc052('0x7')](e)){var event=events[e];VoiceQueueReport[_0xc052('0x8')](e,emitEvent(event));}}module[_0xc052('0x9')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index c5b04e2..400168a 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(_0x23e4cf,_0x12704d){var _0x2bd35a=function(_0xaa827a){while(--_0xaa827a){_0x23e4cf['push'](_0x23e4cf['shift']());}};_0x2bd35a(++_0x12704d);}(_0xb10b,0x12a));var _0xbb10=function(_0x4bdf64,_0x3022b2){_0x4bdf64=_0x4bdf64-0x0;var _0x9a1a19=_0xb10b[_0x4bdf64];return _0x9a1a19;};'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 _0xdb28=['bluebird','request-promise','path','rimraf','../../config/environment','exports','VoiceQueueReport','report_queue','uniqueid','calleridnum','lodash','util','../../config/logger','api'];(function(_0x54e4ec,_0x183144){var _0x44ef91=function(_0x34fe75){while(--_0x34fe75){_0x54e4ec['push'](_0x54e4ec['shift']());}};_0x44ef91(++_0x183144);}(_0xdb28,0x106));var _0x8db2=function(_0x3b5a22,_0x4de3a0){_0x3b5a22=_0x3b5a22-0x0;var _0x1e3ce2=_0xdb28[_0x3b5a22];return _0x1e3ce2;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var logger=require(_0x8db2('0x2'))(_0x8db2('0x3'));var moment=require('moment');var BPromise=require(_0x8db2('0x4'));var rp=require(_0x8db2('0x5'));var fs=require('fs');var path=require(_0x8db2('0x6'));var rimraf=require(_0x8db2('0x7'));var config=require(_0x8db2('0x8'));var attributes=require('./voiceQueueReport.attributes');module[_0x8db2('0x9')]=function(_0x1d2dd3,_0x5f42ee){return _0x1d2dd3['define'](_0x8db2('0xa'),attributes,{'tableName':_0x8db2('0xb'),'paranoid':![],'indexes':[{'fields':[_0x8db2('0xc')]},{'fields':[_0x8db2('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 ffd3056..2404b2d 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 _0x1d89=['rpc','http','defaults','localhost','socket.io-emitter','redis','register','request','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','where','limit','include','model','attributes','map','debug','CreateVoiceQueueReport','create','body','update','UpdateVoiceQueueReport','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x30a2d6,_0x43201d){var _0x10bff2=function(_0x1eee56){while(--_0x1eee56){_0x30a2d6['push'](_0x30a2d6['shift']());}};_0x10bff2(++_0x43201d);}(_0x1d89,0x1e6));var _0x91d8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1d89[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x91d8('0x0'));var util=require('util');var moment=require(_0x91d8('0x1'));var BPromise=require('bluebird');var rs=require(_0x91d8('0x2'));var fs=require('fs');var Redis=require(_0x91d8('0x3'));var db=require(_0x91d8('0x4'))['db'];var utils=require(_0x91d8('0x5'));var logger=require('../../config/logger')(_0x91d8('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x91d8('0x7')]({'port':0x232a});config['redis']=_[_0x91d8('0x8')](config['redis'],{'host':_0x91d8('0x9'),'port':0x18eb});var socket=require(_0x91d8('0xa'))(new Redis(config[_0x91d8('0xb')]));require('./voiceQueueReport.socket')[_0x91d8('0xc')](socket);function respondWithRpcPromise(_0x2854a6,_0x34b714,_0x5a2540){return new BPromise(function(_0x41785f,_0xc4d211){return client[_0x91d8('0xd')](_0x2854a6,_0x5a2540)[_0x91d8('0xe')](function(_0x3168fa){logger[_0x91d8('0xf')](_0x91d8('0x10'),_0x34b714,_0x91d8('0x11'));logger['debug'](_0x91d8('0x12'),_0x34b714,_0x91d8('0x11'),JSON[_0x91d8('0x13')](_0x3168fa));if(_0x3168fa[_0x91d8('0x14')]){if(_0x3168fa[_0x91d8('0x14')][_0x91d8('0x15')]===0x1f4){logger[_0x91d8('0x14')]('VoiceQueueReport,\x20%s,\x20%s',_0x34b714,_0x3168fa['error'][_0x91d8('0x16')]);return _0xc4d211(_0x3168fa[_0x91d8('0x14')][_0x91d8('0x16')]);}logger['error'](_0x91d8('0x10'),_0x34b714,_0x3168fa[_0x91d8('0x14')]['message']);return _0x41785f(_0x3168fa['error'][_0x91d8('0x16')]);}else{logger[_0x91d8('0xf')](_0x91d8('0x10'),_0x34b714,_0x91d8('0x11'));_0x41785f(_0x3168fa['result'][_0x91d8('0x16')]);}})[_0x91d8('0x17')](function(_0x4db1cb){logger[_0x91d8('0x14')](_0x91d8('0x10'),_0x34b714,_0x4db1cb);_0xc4d211(_0x4db1cb);});});}exports[_0x91d8('0x18')]=function(_0x1d6d5e){var _0xa38809=this;return new Promise(function(_0x10898a,_0x23a9f6){return db[_0x91d8('0x19')][_0x91d8('0x1a')]({'raw':_0x1d6d5e[_0x91d8('0x1b')]?_0x1d6d5e[_0x91d8('0x1b')][_0x91d8('0x1c')]===undefined?!![]:![]:!![],'where':_0x1d6d5e['options']?_0x1d6d5e[_0x91d8('0x1b')][_0x91d8('0x1d')]||null:null,'attributes':_0x1d6d5e[_0x91d8('0x1b')]?_0x1d6d5e[_0x91d8('0x1b')]['attributes']||null:null,'limit':_0x1d6d5e['options']?_0x1d6d5e[_0x91d8('0x1b')][_0x91d8('0x1e')]||null:null,'include':_0x1d6d5e[_0x91d8('0x1b')]?_0x1d6d5e['options'][_0x91d8('0x1f')]?_['map'](_0x1d6d5e[_0x91d8('0x1b')][_0x91d8('0x1f')],function(_0x56f9eb){return{'model':db[_0x56f9eb[_0x91d8('0x20')]],'as':_0x56f9eb['as'],'attributes':_0x56f9eb[_0x91d8('0x21')],'include':_0x56f9eb[_0x91d8('0x1f')]?_[_0x91d8('0x22')](_0x56f9eb[_0x91d8('0x1f')],function(_0x5aa9f2){return{'model':db[_0x5aa9f2[_0x91d8('0x20')]],'as':_0x5aa9f2['as'],'attributes':_0x5aa9f2[_0x91d8('0x21')],'include':_0x5aa9f2['include']?_[_0x91d8('0x22')](_0x5aa9f2[_0x91d8('0x1f')],function(_0x205c4f){return{'model':db[_0x205c4f[_0x91d8('0x20')]],'as':_0x205c4f['as'],'attributes':_0x205c4f[_0x91d8('0x21')]};}):[]};}):[]};}):[]:[]})[_0x91d8('0xe')](function(_0x15a217){logger[_0x91d8('0xf')](_0x91d8('0x18'),_0x1d6d5e);logger[_0x91d8('0x23')]('GetVoiceQueueReport',_0x1d6d5e,JSON[_0x91d8('0x13')](_0x15a217));_0x10898a(_0x15a217);})['catch'](function(_0x317e06){logger[_0x91d8('0x14')]('GetVoiceQueueReport',_0x317e06[_0x91d8('0x16')],_0x1d6d5e);_0x23a9f6(_0xa38809['error'](0x1f4,_0x317e06['message']));});});};exports[_0x91d8('0x24')]=function(_0x3a3cf8){var _0x54f176=this;return new Promise(function(_0x55b7fe,_0x1364f3){return db[_0x91d8('0x19')][_0x91d8('0x25')](_0x3a3cf8[_0x91d8('0x26')],{'raw':_0x3a3cf8[_0x91d8('0x1b')]?_0x3a3cf8[_0x91d8('0x1b')][_0x91d8('0x1c')]===undefined?!![]:![]:!![]})[_0x91d8('0xe')](function(_0x2fbb91){logger[_0x91d8('0xf')]('CreateVoiceQueueReport',_0x3a3cf8);logger[_0x91d8('0x23')](_0x91d8('0x24'),_0x3a3cf8,JSON['stringify'](_0x2fbb91));_0x55b7fe(_0x2fbb91);})[_0x91d8('0x17')](function(_0x20f8f3){logger[_0x91d8('0x14')]('CreateVoiceQueueReport',_0x20f8f3['message'],_0x3a3cf8);_0x1364f3(_0x54f176[_0x91d8('0x14')](0x1f4,_0x20f8f3['message']));});});};exports['UpdateVoiceQueueReport']=function(_0x506a3f){var _0x1f3176=this;return new Promise(function(_0x29a874,_0x44bff8){return db[_0x91d8('0x19')][_0x91d8('0x27')](_0x506a3f[_0x91d8('0x26')],{'raw':_0x506a3f['options']?_0x506a3f[_0x91d8('0x1b')][_0x91d8('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x506a3f[_0x91d8('0x1b')]?_0x506a3f[_0x91d8('0x1b')][_0x91d8('0x1d')]||null:null,'attributes':_0x506a3f['options']?_0x506a3f[_0x91d8('0x1b')][_0x91d8('0x21')]||null:null,'limit':_0x506a3f[_0x91d8('0x1b')]?_0x506a3f[_0x91d8('0x1b')][_0x91d8('0x1e')]||null:null})[_0x91d8('0xe')](function(_0x473109){logger[_0x91d8('0xf')](_0x91d8('0x28'),_0x506a3f);logger[_0x91d8('0x23')](_0x91d8('0x28'),_0x506a3f,JSON[_0x91d8('0x13')](_0x473109));_0x29a874(_0x473109);})[_0x91d8('0x17')](function(_0xdcf35f){logger[_0x91d8('0x14')](_0x91d8('0x28'),_0xdcf35f['message'],_0x506a3f);_0x44bff8(_0x1f3176['error'](0x1f4,_0xdcf35f['message']));});});}; \ No newline at end of file +var _0xa3dd=['stringify','error','code','message','result','catch','GetVoiceQueueReport','options','include','model','attributes','map','then','VoiceQueueReport','body','raw','CreateVoiceQueueReport','UpdateVoiceQueueReport','update','where','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','request','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s'];(function(_0x46df09,_0x1b1fe7){var _0x22e875=function(_0x3145cc){while(--_0x3145cc){_0x46df09['push'](_0x46df09['shift']());}};_0x22e875(++_0x1b1fe7);}(_0xa3dd,0xb8));var _0xda3d=function(_0x4295fd,_0x1f2573){_0x4295fd=_0x4295fd-0x0;var _0x96f34e=_0xa3dd[_0x4295fd];return _0x96f34e;};'use strict';var _=require(_0xda3d('0x0'));var util=require('util');var moment=require(_0xda3d('0x1'));var BPromise=require(_0xda3d('0x2'));var rs=require(_0xda3d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xda3d('0x4'))['db'];var utils=require(_0xda3d('0x5'));var logger=require(_0xda3d('0x6'))('rpc');var config=require(_0xda3d('0x7'));var jayson=require(_0xda3d('0x8'));var client=jayson['client'][_0xda3d('0x9')]({'port':0x232a});config[_0xda3d('0xa')]=_[_0xda3d('0xb')](config['redis'],{'host':_0xda3d('0xc'),'port':0x18eb});var socket=require(_0xda3d('0xd'))(new Redis(config['redis']));require(_0xda3d('0xe'))['register'](socket);function respondWithRpcPromise(_0x563f46,_0x1f1843,_0xb7ede5){return new BPromise(function(_0x4f5f78,_0x1499f0){return client[_0xda3d('0xf')](_0x563f46,_0xb7ede5)['then'](function(_0x2d5dfa){logger[_0xda3d('0x10')](_0xda3d('0x11'),_0x1f1843,_0xda3d('0x12'));logger[_0xda3d('0x13')](_0xda3d('0x14'),_0x1f1843,_0xda3d('0x12'),JSON[_0xda3d('0x15')](_0x2d5dfa));if(_0x2d5dfa[_0xda3d('0x16')]){if(_0x2d5dfa['error'][_0xda3d('0x17')]===0x1f4){logger[_0xda3d('0x16')]('VoiceQueueReport,\x20%s,\x20%s',_0x1f1843,_0x2d5dfa[_0xda3d('0x16')]['message']);return _0x1499f0(_0x2d5dfa[_0xda3d('0x16')][_0xda3d('0x18')]);}logger[_0xda3d('0x16')](_0xda3d('0x11'),_0x1f1843,_0x2d5dfa[_0xda3d('0x16')][_0xda3d('0x18')]);return _0x4f5f78(_0x2d5dfa['error']['message']);}else{logger[_0xda3d('0x10')]('VoiceQueueReport,\x20%s,\x20%s',_0x1f1843,'request\x20sent');_0x4f5f78(_0x2d5dfa[_0xda3d('0x19')][_0xda3d('0x18')]);}})[_0xda3d('0x1a')](function(_0xcd7e2b){logger[_0xda3d('0x16')]('VoiceQueueReport,\x20%s,\x20%s',_0x1f1843,_0xcd7e2b);_0x1499f0(_0xcd7e2b);});});}exports[_0xda3d('0x1b')]=function(_0x28c5ff){var _0x2d7e96=this;return new Promise(function(_0x199d5b,_0x4bf05b){return db['VoiceQueueReport']['findAll']({'raw':_0x28c5ff[_0xda3d('0x1c')]?_0x28c5ff['options']['raw']===undefined?!![]:![]:!![],'where':_0x28c5ff[_0xda3d('0x1c')]?_0x28c5ff[_0xda3d('0x1c')]['where']||null:null,'attributes':_0x28c5ff[_0xda3d('0x1c')]?_0x28c5ff['options']['attributes']||null:null,'limit':_0x28c5ff[_0xda3d('0x1c')]?_0x28c5ff[_0xda3d('0x1c')]['limit']||null:null,'include':_0x28c5ff[_0xda3d('0x1c')]?_0x28c5ff[_0xda3d('0x1c')][_0xda3d('0x1d')]?_['map'](_0x28c5ff[_0xda3d('0x1c')]['include'],function(_0x57178c){return{'model':db[_0x57178c[_0xda3d('0x1e')]],'as':_0x57178c['as'],'attributes':_0x57178c[_0xda3d('0x1f')],'include':_0x57178c[_0xda3d('0x1d')]?_[_0xda3d('0x20')](_0x57178c[_0xda3d('0x1d')],function(_0x16f4e7){return{'model':db[_0x16f4e7['model']],'as':_0x16f4e7['as'],'attributes':_0x16f4e7[_0xda3d('0x1f')],'include':_0x16f4e7[_0xda3d('0x1d')]?_[_0xda3d('0x20')](_0x16f4e7[_0xda3d('0x1d')],function(_0xbb4a99){return{'model':db[_0xbb4a99[_0xda3d('0x1e')]],'as':_0xbb4a99['as'],'attributes':_0xbb4a99[_0xda3d('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xda3d('0x21')](function(_0x29b311){logger[_0xda3d('0x10')]('GetVoiceQueueReport',_0x28c5ff);logger['debug'](_0xda3d('0x1b'),_0x28c5ff,JSON[_0xda3d('0x15')](_0x29b311));_0x199d5b(_0x29b311);})[_0xda3d('0x1a')](function(_0x31f326){logger[_0xda3d('0x16')]('GetVoiceQueueReport',_0x31f326[_0xda3d('0x18')],_0x28c5ff);_0x4bf05b(_0x2d7e96[_0xda3d('0x16')](0x1f4,_0x31f326[_0xda3d('0x18')]));});});};exports['CreateVoiceQueueReport']=function(_0x537810){var _0x52c713=this;return new Promise(function(_0x51c4f0,_0x2db5ee){return db[_0xda3d('0x22')]['create'](_0x537810[_0xda3d('0x23')],{'raw':_0x537810[_0xda3d('0x1c')]?_0x537810[_0xda3d('0x1c')][_0xda3d('0x24')]===undefined?!![]:![]:!![]})['then'](function(_0x3126ca){logger[_0xda3d('0x10')]('CreateVoiceQueueReport',_0x537810);logger[_0xda3d('0x13')](_0xda3d('0x25'),_0x537810,JSON[_0xda3d('0x15')](_0x3126ca));_0x51c4f0(_0x3126ca);})['catch'](function(_0x33bfe8){logger[_0xda3d('0x16')]('CreateVoiceQueueReport',_0x33bfe8[_0xda3d('0x18')],_0x537810);_0x2db5ee(_0x52c713[_0xda3d('0x16')](0x1f4,_0x33bfe8[_0xda3d('0x18')]));});});};exports[_0xda3d('0x26')]=function(_0x258d1c){var _0x12aa6c=this;return new Promise(function(_0x19e76d,_0x530e81){return db['VoiceQueueReport'][_0xda3d('0x27')](_0x258d1c[_0xda3d('0x23')],{'raw':_0x258d1c[_0xda3d('0x1c')]?_0x258d1c[_0xda3d('0x1c')][_0xda3d('0x24')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x258d1c[_0xda3d('0x1c')]?_0x258d1c[_0xda3d('0x1c')][_0xda3d('0x28')]||null:null,'attributes':_0x258d1c[_0xda3d('0x1c')]?_0x258d1c[_0xda3d('0x1c')]['attributes']||null:null,'limit':_0x258d1c['options']?_0x258d1c[_0xda3d('0x1c')]['limit']||null:null})['then'](function(_0x1cf008){logger[_0xda3d('0x10')](_0xda3d('0x26'),_0x258d1c);logger[_0xda3d('0x13')](_0xda3d('0x26'),_0x258d1c,JSON[_0xda3d('0x15')](_0x1cf008));_0x19e76d(_0x1cf008);})[_0xda3d('0x1a')](function(_0x4bddbf){logger[_0xda3d('0x16')](_0xda3d('0x26'),_0x4bddbf[_0xda3d('0x18')],_0x258d1c);_0x530e81(_0x12aa6c[_0xda3d('0x16')](0x1f4,_0x4bddbf[_0xda3d('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index dbf20f8..30b0036 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 _0x2a21=['removeListener','register','remove','update','emit'];(function(_0xaf29da,_0x117f5a){var _0x295c51=function(_0x3feaf4){while(--_0x3feaf4){_0xaf29da['push'](_0xaf29da['shift']());}};_0x295c51(++_0x117f5a);}(_0x2a21,0x110));var _0x12a2=function(_0x135e0c,_0x1921e9){_0x135e0c=_0x135e0c-0x0;var _0x39a380=_0x2a21[_0x135e0c];return _0x39a380;};'use strict';var VoiceQueueReportEvents=require('./voiceQueueReport.events');var events=['save',_0x12a2('0x0'),_0x12a2('0x1')];function createListener(_0x53e7a5,_0x2411ae){return function(_0x17ca23){_0x2411ae[_0x12a2('0x2')](_0x53e7a5,_0x17ca23);};}function removeListener(_0x8eabeb,_0x2967a1){return function(){VoiceQueueReportEvents[_0x12a2('0x3')](_0x8eabeb,_0x2967a1);};}exports[_0x12a2('0x4')]=function(_0x32d9b9){for(var _0x4a525d=0x0,_0x84001f=events['length'];_0x4a525d<_0x84001f;_0x4a525d++){var _0x5426d3=events[_0x4a525d];var _0x39be29=createListener('voiceQueueReport:'+_0x5426d3,_0x32d9b9);VoiceQueueReportEvents['on'](_0x5426d3,_0x39be29);}}; \ No newline at end of file +var _0xad26=['remove','update','emit','removeListener','register','length','./voiceQueueReport.events','save'];(function(_0x200545,_0x3d7983){var _0x488c21=function(_0x18597d){while(--_0x18597d){_0x200545['push'](_0x200545['shift']());}};_0x488c21(++_0x3d7983);}(_0xad26,0x13e));var _0x6ad2=function(_0x59c301,_0x359c50){_0x59c301=_0x59c301-0x0;var _0x3866b9=_0xad26[_0x59c301];return _0x3866b9;};'use strict';var VoiceQueueReportEvents=require(_0x6ad2('0x0'));var events=[_0x6ad2('0x1'),_0x6ad2('0x2'),_0x6ad2('0x3')];function createListener(_0x2c640a,_0x730cf2){return function(_0x593a4c){_0x730cf2[_0x6ad2('0x4')](_0x2c640a,_0x593a4c);};}function removeListener(_0x142db4,_0x56f7c3){return function(){VoiceQueueReportEvents[_0x6ad2('0x5')](_0x142db4,_0x56f7c3);};}exports[_0x6ad2('0x6')]=function(_0x1bb467){for(var _0x893c1=0x0,_0x1b0cbf=events[_0x6ad2('0x7')];_0x893c1<_0x1b0cbf;_0x893c1++){var _0x3347be=events[_0x893c1];var _0x172359=createListener('voiceQueueReport:'+_0x3347be,_0x1bb467);VoiceQueueReportEvents['on'](_0x3347be,_0x172359);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 7ee78e4..e94ae37 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 _0xde11=['Router','../../components/auth/service','./voiceQueuesLog.controller','get','index','isAuthenticated','show','post','create','put','update','destroy','exports','util','path','connect-timeout','express'];(function(_0x5425ea,_0x465e78){var _0x492be5=function(_0x236c20){while(--_0x236c20){_0x5425ea['push'](_0x5425ea['shift']());}};_0x492be5(++_0x465e78);}(_0xde11,0x73));var _0x1de1=function(_0xb3f6f8,_0x64420e){_0xb3f6f8=_0xb3f6f8-0x0;var _0x3d49ec=_0xde11[_0xb3f6f8];return _0x3d49ec;};'use strict';var multer=require('multer');var util=require(_0x1de1('0x0'));var path=require(_0x1de1('0x1'));var timeout=require(_0x1de1('0x2'));var express=require(_0x1de1('0x3'));var router=express[_0x1de1('0x4')]();var auth=require(_0x1de1('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x1de1('0x6'));router[_0x1de1('0x7')]('/',auth['isAuthenticated'](),controller[_0x1de1('0x8')]);router[_0x1de1('0x7')]('/:id',auth[_0x1de1('0x9')](),controller[_0x1de1('0xa')]);router[_0x1de1('0xb')]('/',auth[_0x1de1('0x9')](),controller[_0x1de1('0xc')]);router[_0x1de1('0xd')]('/:id',auth[_0x1de1('0x9')](),controller[_0x1de1('0xe')]);router['delete']('/:id',auth[_0x1de1('0x9')](),controller[_0x1de1('0xf')]);module[_0x1de1('0x10')]=router; \ No newline at end of file +var _0x1b4e=['isAuthenticated','index','/:id','show','create','put','destroy','exports','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0xa9a245,_0x2a0387){var _0x2d0eaa=function(_0x2bba86){while(--_0x2bba86){_0xa9a245['push'](_0xa9a245['shift']());}};_0x2d0eaa(++_0x2a0387);}(_0x1b4e,0x158));var _0xe1b4=function(_0x5419da,_0x9d2a83){_0x5419da=_0x5419da-0x0;var _0x4980da=_0x1b4e[_0x5419da];return _0x4980da;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe1b4('0x0'));var timeout=require('connect-timeout');var express=require(_0xe1b4('0x1'));var router=express[_0xe1b4('0x2')]();var auth=require(_0xe1b4('0x3'));var interaction=require(_0xe1b4('0x4'));var config=require(_0xe1b4('0x5'));var controller=require('./voiceQueuesLog.controller');router['get']('/',auth[_0xe1b4('0x6')](),controller[_0xe1b4('0x7')]);router['get'](_0xe1b4('0x8'),auth[_0xe1b4('0x6')](),controller[_0xe1b4('0x9')]);router['post']('/',auth[_0xe1b4('0x6')](),controller[_0xe1b4('0xa')]);router[_0xe1b4('0xb')]('/:id',auth[_0xe1b4('0x6')](),controller['update']);router['delete'](_0xe1b4('0x8'),auth[_0xe1b4('0x6')](),controller[_0xe1b4('0xc')]);module[_0xe1b4('0xd')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index 5857d06..de2796c 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 _0x1fb9=['moment','STRING','DATE','YYYY-MM-DD\x20HH:mm:ss','sequelize'];(function(_0x15411f,_0x42bef8){var _0x555650=function(_0x215e4f){while(--_0x215e4f){_0x15411f['push'](_0x15411f['shift']());}};_0x555650(++_0x42bef8);}(_0x1fb9,0xe0));var _0x91fb=function(_0x345ac6,_0x43a5de){_0x345ac6=_0x345ac6-0x0;var _0x4c6fe6=_0x1fb9[_0x345ac6];return _0x4c6fe6;};'use strict';var Sequelize=require(_0x91fb('0x0'));var moment=require(_0x91fb('0x1'));module['exports']={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize[_0x91fb('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x91fb('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x91fb('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x91fb('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x91fb('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x91fb('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x91fb('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x91fb('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x91fb('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x91fb('0x3')],'allowNull':![],'defaultValue':moment()['format'](_0x91fb('0x4'))}}; \ No newline at end of file +var _0x4773=['DATE','format','YYYY-MM-DD\x20HH:mm:ss','moment','STRING'];(function(_0x4e3966,_0x342221){var _0x2d98f9=function(_0x4b2653){while(--_0x4b2653){_0x4e3966['push'](_0x4e3966['shift']());}};_0x2d98f9(++_0x342221);}(_0x4773,0x1d4));var _0x3477=function(_0x4258ac,_0x2fb357){_0x4258ac=_0x4258ac-0x0;var _0x30a743=_0x4773[_0x4258ac];return _0x30a743;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x3477('0x0'));module['exports']={'time':{'type':Sequelize[_0x3477('0x1')]},'callid':{'type':Sequelize[_0x3477('0x1')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x3477('0x1')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x3477('0x1')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x3477('0x1')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x3477('0x1')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x3477('0x1')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x3477('0x1')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x3477('0x2')],'allowNull':![],'defaultValue':moment()[_0x3477('0x3')](_0x3477('0x4'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index d4045a3..22707f7 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 _0xb10b=['where','merge','VoiceQueuesLog','include','rows','catch','show','params','includeAll','options','find','create','body','update','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','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','then','destroy','name','send','map','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter'];(function(_0x319087,_0x19c692){var _0x4e39ac=function(_0x2cd450){while(--_0x2cd450){_0x319087['push'](_0x319087['shift']());}};_0x4e39ac(++_0x19c692);}(_0xb10b,0x12a));var _0xbb10=function(_0x406b98,_0x3dea6d){_0x406b98=_0x406b98-0x0;var _0x10545f=_0xb10b[_0x406b98];return _0x10545f;};'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 db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x44fb19,_0x916a32){_0x916a32=_0x916a32||0xcc;return function(_0x285009){if(_0x285009){return _0x44fb19[_0xbb10('0x18')](_0x916a32);}return _0x44fb19[_0xbb10('0x19')](_0x916a32)[_0xbb10('0x1a')]();};}function respondWithResult(_0x58a612,_0x26e021){_0x26e021=_0x26e021||0xc8;return function(_0x42d7e4){if(_0x42d7e4){return _0x58a612[_0xbb10('0x19')](_0x26e021)[_0xbb10('0x1b')](_0x42d7e4);}};}function respondWithFilteredResult(_0x3df17b,_0x2f2ebf){return function(_0x24a57b){if(_0x24a57b){var _0x36b5e8=_0x24a57b[_0xbb10('0x1c')],_0x3e26f4=_0x2f2ebf[_0xbb10('0x1d')],_0x2b184e=_0x2f2ebf[_0xbb10('0x1d')]+_0x2f2ebf[_0xbb10('0x1e')],_0x4a2bfc;if(_0x2b184e>=_0x36b5e8){_0x2b184e=_0x36b5e8;_0x4a2bfc=0xc8;}else{_0x4a2bfc=0xce;}_0x3df17b[_0xbb10('0x19')](_0x4a2bfc);return _0x3df17b[_0xbb10('0x1f')](_0xbb10('0x20'),_0x3e26f4+'-'+_0x2b184e+'/'+_0x36b5e8)[_0xbb10('0x1b')](_0x24a57b);}return null;};}function patchUpdates(_0xbf2906){return function(_0xe1c665){try{jsonpatch['apply'](_0xe1c665,_0xbf2906,!![]);}catch(_0x5ff0cf){return BPromise[_0xbb10('0x21')](_0x5ff0cf);}return _0xe1c665[_0xbb10('0x22')]();};}function saveUpdates(_0x109908,_0xdf237d){return function(_0x44e563){if(_0x44e563){return _0x44e563['update'](_0x109908)[_0xbb10('0x23')](function(_0x12ef77){return _0x12ef77;});}return null;};}function removeEntity(_0x50aea1,_0x4c4b0d){return function(_0x8e2b97){if(_0x8e2b97){return _0x8e2b97[_0xbb10('0x24')]()[_0xbb10('0x23')](function(){_0x50aea1[_0xbb10('0x19')](0xcc)[_0xbb10('0x1a')]();});}};}function handleEntityNotFound(_0x1824b7,_0x407cb4){return function(_0x436104){if(!_0x436104){_0x1824b7[_0xbb10('0x18')](0x194);}return _0x436104;};}function handleError(_0x395404,_0x3ba6cd){_0x3ba6cd=_0x3ba6cd||0x1f4;return function(_0x26ad93){logger['error'](_0x26ad93['stack']);if(_0x26ad93['name']){delete _0x26ad93[_0xbb10('0x25')];}_0x395404[_0xbb10('0x19')](_0x3ba6cd)[_0xbb10('0x26')](_0x26ad93);};}exports['index']=function(_0x2fdde9,_0x24d586){var _0x6ed43b={},_0x1d5e95={},_0x1acce9={'count':0x0,'rows':[]};var _0x20d946=_[_0xbb10('0x27')](db['VoiceQueuesLog'][_0xbb10('0x28')],function(_0x21ac54){return{'name':_0x21ac54[_0xbb10('0x29')],'type':_0x21ac54[_0xbb10('0x2a')][_0xbb10('0x2b')]};});_0x1d5e95[_0xbb10('0x2c')]=_['map'](_0x20d946,_0xbb10('0x25'));_0x1d5e95['query']=_[_0xbb10('0x2d')](_0x2fdde9['query']);_0x1d5e95[_0xbb10('0x2e')]=_[_0xbb10('0x2f')](_0x1d5e95[_0xbb10('0x2c')],_0x1d5e95['query']);_0x6ed43b['attributes']=_[_0xbb10('0x2f')](_0x1d5e95[_0xbb10('0x2c')],qs['fields'](_0x2fdde9[_0xbb10('0x30')][_0xbb10('0x31')]));_0x6ed43b[_0xbb10('0x32')]=_0x6ed43b[_0xbb10('0x32')][_0xbb10('0x33')]?_0x6ed43b[_0xbb10('0x32')]:_0x1d5e95[_0xbb10('0x2c')];if(!_0x2fdde9['query'][_0xbb10('0x34')](_0xbb10('0x35'))){_0x6ed43b[_0xbb10('0x1e')]=qs[_0xbb10('0x1e')](_0x2fdde9[_0xbb10('0x30')][_0xbb10('0x1e')]);_0x6ed43b[_0xbb10('0x1d')]=qs[_0xbb10('0x1d')](_0x2fdde9[_0xbb10('0x30')]['offset']);}_0x6ed43b[_0xbb10('0x36')]=qs[_0xbb10('0x37')](_0x2fdde9[_0xbb10('0x30')][_0xbb10('0x37')]);_0x6ed43b['where']=qs[_0xbb10('0x2e')](_['pick'](_0x2fdde9['query'],_0x1d5e95[_0xbb10('0x2e')]),_0x20d946);if(_0x2fdde9[_0xbb10('0x30')][_0xbb10('0x38')]){_0x6ed43b[_0xbb10('0x39')]=_[_0xbb10('0x3a')](_0x6ed43b[_0xbb10('0x39')],{'$or':_['map'](_0x20d946,function(_0x1e5bbd){if(_0x1e5bbd[_0xbb10('0x2a')]!=='VIRTUAL'){var _0x5e3fbd={};_0x5e3fbd[_0x1e5bbd['name']]={'$like':'%'+_0x2fdde9[_0xbb10('0x30')][_0xbb10('0x38')]+'%'};return _0x5e3fbd;}})});}_0x6ed43b=_[_0xbb10('0x3a')]({},_0x6ed43b,_0x2fdde9['options']);var _0x3c0cd7={'where':_0x6ed43b[_0xbb10('0x39')]};return db[_0xbb10('0x3b')]['count'](_0x3c0cd7)[_0xbb10('0x23')](function(_0x12238a){_0x1acce9[_0xbb10('0x1c')]=_0x12238a;if(_0x2fdde9[_0xbb10('0x30')]['includeAll']){_0x6ed43b[_0xbb10('0x3c')]=[{'all':!![]}];}return db[_0xbb10('0x3b')]['findAll'](_0x6ed43b);})[_0xbb10('0x23')](function(_0x2e3214){_0x1acce9[_0xbb10('0x3d')]=_0x2e3214;return _0x1acce9;})[_0xbb10('0x23')](respondWithFilteredResult(_0x24d586,_0x6ed43b))[_0xbb10('0x3e')](handleError(_0x24d586,null));};exports[_0xbb10('0x3f')]=function(_0x5f3d67,_0x1e8f79){var _0x1c7fae={'raw':!![],'where':{'id':_0x5f3d67[_0xbb10('0x40')]['id']}},_0x3e7b4c={};_0x3e7b4c['model']=_[_0xbb10('0x2d')](db[_0xbb10('0x3b')][_0xbb10('0x28')]);_0x3e7b4c[_0xbb10('0x30')]=_['keys'](_0x5f3d67[_0xbb10('0x30')]);_0x3e7b4c[_0xbb10('0x2e')]=_['intersection'](_0x3e7b4c['model'],_0x3e7b4c[_0xbb10('0x30')]);_0x1c7fae['attributes']=_[_0xbb10('0x2f')](_0x3e7b4c[_0xbb10('0x2c')],qs['fields'](_0x5f3d67[_0xbb10('0x30')][_0xbb10('0x31')]));_0x1c7fae[_0xbb10('0x32')]=_0x1c7fae['attributes'][_0xbb10('0x33')]?_0x1c7fae[_0xbb10('0x32')]:_0x3e7b4c[_0xbb10('0x2c')];if(_0x5f3d67[_0xbb10('0x30')][_0xbb10('0x41')]){_0x1c7fae[_0xbb10('0x3c')]=[{'all':!![]}];}_0x1c7fae=_[_0xbb10('0x3a')]({},_0x1c7fae,_0x5f3d67[_0xbb10('0x42')]);return db[_0xbb10('0x3b')][_0xbb10('0x43')](_0x1c7fae)[_0xbb10('0x23')](handleEntityNotFound(_0x1e8f79,null))[_0xbb10('0x23')](respondWithResult(_0x1e8f79,null))['catch'](handleError(_0x1e8f79,null));};exports[_0xbb10('0x44')]=function(_0x41bbf8,_0x4a1248){return db[_0xbb10('0x3b')][_0xbb10('0x44')](_0x41bbf8[_0xbb10('0x45')],{})[_0xbb10('0x23')](respondWithResult(_0x4a1248,0xc9))[_0xbb10('0x3e')](handleError(_0x4a1248,null));};exports[_0xbb10('0x46')]=function(_0x3e06b0,_0x5be85e){if(_0x3e06b0['body']['id']){delete _0x3e06b0[_0xbb10('0x45')]['id'];}return db[_0xbb10('0x3b')][_0xbb10('0x43')]({'where':{'id':_0x3e06b0['params']['id']}})['then'](handleEntityNotFound(_0x5be85e,null))[_0xbb10('0x23')](saveUpdates(_0x3e06b0[_0xbb10('0x45')],null))[_0xbb10('0x23')](respondWithResult(_0x5be85e,null))[_0xbb10('0x3e')](handleError(_0x5be85e,null));};exports[_0xbb10('0x24')]=function(_0x22b315,_0x2f2552){return db[_0xbb10('0x3b')][_0xbb10('0x43')]({'where':{'id':_0x22b315[_0xbb10('0x40')]['id']}})['then'](handleEntityNotFound(_0x2f2552,null))['then'](removeEntity(_0x2f2552,null))[_0xbb10('0x3e')](handleError(_0x2f2552,null));}; \ No newline at end of file +var _0xa9e0=['sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','catch','params','includeAll','create','body','find','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','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','index','map','VoiceQueuesLog','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit'];(function(_0x1deab1,_0x3ca2f0){var _0x30822d=function(_0x54b01b){while(--_0x54b01b){_0x1deab1['push'](_0x1deab1['shift']());}};_0x30822d(++_0x3ca2f0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xa9e0[_0x6c993a];return _0x27f547;};'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 db=require(_0x0a9e('0x13'))['db'];function respondWithStatusCode(_0x36471c,_0xd5b662){_0xd5b662=_0xd5b662||0xcc;return function(_0x26d672){if(_0x26d672){return _0x36471c[_0x0a9e('0x14')](_0xd5b662);}return _0x36471c[_0x0a9e('0x15')](_0xd5b662)['end']();};}function respondWithResult(_0x4283ce,_0x239b12){_0x239b12=_0x239b12||0xc8;return function(_0x2b4227){if(_0x2b4227){return _0x4283ce[_0x0a9e('0x15')](_0x239b12)[_0x0a9e('0x16')](_0x2b4227);}};}function respondWithFilteredResult(_0x4d5611,_0x52a03d){return function(_0x22dccb){if(_0x22dccb){var _0x5d0880=_0x22dccb[_0x0a9e('0x17')],_0x1985b6=_0x52a03d['offset'],_0x519dfd=_0x52a03d[_0x0a9e('0x18')]+_0x52a03d['limit'],_0x16033c;if(_0x519dfd>=_0x5d0880){_0x519dfd=_0x5d0880;_0x16033c=0xc8;}else{_0x16033c=0xce;}_0x4d5611[_0x0a9e('0x15')](_0x16033c);return _0x4d5611[_0x0a9e('0x19')](_0x0a9e('0x1a'),_0x1985b6+'-'+_0x519dfd+'/'+_0x5d0880)[_0x0a9e('0x16')](_0x22dccb);}return null;};}function patchUpdates(_0x31b1ca){return function(_0x2eb11f){try{jsonpatch[_0x0a9e('0x1b')](_0x2eb11f,_0x31b1ca,!![]);}catch(_0x20559e){return BPromise[_0x0a9e('0x1c')](_0x20559e);}return _0x2eb11f[_0x0a9e('0x1d')]();};}function saveUpdates(_0x1c696a,_0x105080){return function(_0x4bb1e3){if(_0x4bb1e3){return _0x4bb1e3[_0x0a9e('0x1e')](_0x1c696a)[_0x0a9e('0x1f')](function(_0x53682f){return _0x53682f;});}return null;};}function removeEntity(_0x20f109,_0x5a09ef){return function(_0x588269){if(_0x588269){return _0x588269[_0x0a9e('0x20')]()[_0x0a9e('0x1f')](function(){_0x20f109[_0x0a9e('0x15')](0xcc)[_0x0a9e('0x21')]();});}};}function handleEntityNotFound(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(!_0x2fb0e4){_0x4abc77[_0x0a9e('0x14')](0x194);}return _0x2fb0e4;};}function handleError(_0x4d00e6,_0x370d86){_0x370d86=_0x370d86||0x1f4;return function(_0x42ac8f){logger[_0x0a9e('0x22')](_0x42ac8f['stack']);if(_0x42ac8f['name']){delete _0x42ac8f[_0x0a9e('0x23')];}_0x4d00e6[_0x0a9e('0x15')](_0x370d86)[_0x0a9e('0x24')](_0x42ac8f);};}exports[_0x0a9e('0x25')]=function(_0x526cf3,_0x384319){var _0x479bc4={},_0x45a1e7={},_0x5bfb33={'count':0x0,'rows':[]};var _0x1dc186=_[_0x0a9e('0x26')](db[_0x0a9e('0x27')][_0x0a9e('0x28')],function(_0x140511){return{'name':_0x140511[_0x0a9e('0x29')],'type':_0x140511[_0x0a9e('0x2a')][_0x0a9e('0x2b')]};});_0x45a1e7['model']=_[_0x0a9e('0x26')](_0x1dc186,_0x0a9e('0x23'));_0x45a1e7[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x526cf3['query']);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],_0x45a1e7[_0x0a9e('0x2c')]);_0x479bc4[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],qs[_0x0a9e('0x32')](_0x526cf3[_0x0a9e('0x2c')]['fields']));_0x479bc4[_0x0a9e('0x31')]=_0x479bc4['attributes'][_0x0a9e('0x33')]?_0x479bc4[_0x0a9e('0x31')]:_0x45a1e7[_0x0a9e('0x30')];if(!_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x34')]('nolimit')){_0x479bc4[_0x0a9e('0x35')]=qs[_0x0a9e('0x35')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x35')]);_0x479bc4[_0x0a9e('0x18')]=qs[_0x0a9e('0x18')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x18')]);}_0x479bc4['order']=qs[_0x0a9e('0x36')](_0x526cf3['query'][_0x0a9e('0x36')]);_0x479bc4[_0x0a9e('0x37')]=qs[_0x0a9e('0x2e')](_[_0x0a9e('0x38')](_0x526cf3['query'],_0x45a1e7[_0x0a9e('0x2e')]),_0x1dc186);if(_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x39')]){_0x479bc4[_0x0a9e('0x37')]=_['merge'](_0x479bc4['where'],{'$or':_[_0x0a9e('0x26')](_0x1dc186,function(_0x5640eb){if(_0x5640eb[_0x0a9e('0x2a')]!==_0x0a9e('0x3a')){var _0x381c37={};_0x381c37[_0x5640eb[_0x0a9e('0x23')]]={'$like':'%'+_0x526cf3['query'][_0x0a9e('0x39')]+'%'};return _0x381c37;}})});}_0x479bc4=_[_0x0a9e('0x3b')]({},_0x479bc4,_0x526cf3[_0x0a9e('0x3c')]);var _0x533942={'where':_0x479bc4[_0x0a9e('0x37')]};return db[_0x0a9e('0x27')][_0x0a9e('0x17')](_0x533942)['then'](function(_0x546ef8){_0x5bfb33[_0x0a9e('0x17')]=_0x546ef8;if(_0x526cf3[_0x0a9e('0x2c')]['includeAll']){_0x479bc4[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x27')][_0x0a9e('0x3e')](_0x479bc4);})[_0x0a9e('0x1f')](function(_0x4b38d9){_0x5bfb33['rows']=_0x4b38d9;return _0x5bfb33;})[_0x0a9e('0x1f')](respondWithFilteredResult(_0x384319,_0x479bc4))[_0x0a9e('0x3f')](handleError(_0x384319,null));};exports['show']=function(_0x183991,_0x1dec2e){var _0x1459bb={'raw':!![],'where':{'id':_0x183991[_0x0a9e('0x40')]['id']}},_0x5b4f5e={};_0x5b4f5e[_0x0a9e('0x30')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x27')][_0x0a9e('0x28')]);_0x5b4f5e[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x183991[_0x0a9e('0x2c')]);_0x5b4f5e[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],_0x5b4f5e[_0x0a9e('0x2c')]);_0x1459bb[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],qs['fields'](_0x183991['query'][_0x0a9e('0x32')]));_0x1459bb[_0x0a9e('0x31')]=_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x33')]?_0x1459bb[_0x0a9e('0x31')]:_0x5b4f5e[_0x0a9e('0x30')];if(_0x183991[_0x0a9e('0x2c')][_0x0a9e('0x41')]){_0x1459bb[_0x0a9e('0x3d')]=[{'all':!![]}];}_0x1459bb=_[_0x0a9e('0x3b')]({},_0x1459bb,_0x183991[_0x0a9e('0x3c')]);return db[_0x0a9e('0x27')]['find'](_0x1459bb)[_0x0a9e('0x1f')](handleEntityNotFound(_0x1dec2e,null))[_0x0a9e('0x1f')](respondWithResult(_0x1dec2e,null))[_0x0a9e('0x3f')](handleError(_0x1dec2e,null));};exports[_0x0a9e('0x42')]=function(_0x2e8caf,_0xbe9d19){return db[_0x0a9e('0x27')][_0x0a9e('0x42')](_0x2e8caf['body'],{})[_0x0a9e('0x1f')](respondWithResult(_0xbe9d19,0xc9))['catch'](handleError(_0xbe9d19,null));};exports[_0x0a9e('0x1e')]=function(_0x476688,_0x8d6dd1){if(_0x476688['body']['id']){delete _0x476688[_0x0a9e('0x43')]['id'];}return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x476688[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x8d6dd1,null))[_0x0a9e('0x1f')](saveUpdates(_0x476688[_0x0a9e('0x43')],null))['then'](respondWithResult(_0x8d6dd1,null))[_0x0a9e('0x3f')](handleError(_0x8d6dd1,null));};exports[_0x0a9e('0x20')]=function(_0x1b5e80,_0x16f976){return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x1b5e80[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x16f976,null))[_0x0a9e('0x1f')](removeEntity(_0x16f976,null))['catch'](handleError(_0x16f976,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 0efed6d..37596d2 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 _0x85ae=['../../config/logger','api','request-promise','path','rimraf','../../config/environment','VoiceQueuesLog','voice_queues_log','dtm','lodash','util'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x85ae,0xcf));var _0xe85a=function(_0x26ddc0,_0x4dcb97){_0x26ddc0=_0x26ddc0-0x0;var _0x409167=_0x85ae[_0x26ddc0];return _0x409167;};'use strict';var _=require(_0xe85a('0x0'));var util=require(_0xe85a('0x1'));var logger=require(_0xe85a('0x2'))(_0xe85a('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xe85a('0x4'));var fs=require('fs');var path=require(_0xe85a('0x5'));var rimraf=require(_0xe85a('0x6'));var config=require(_0xe85a('0x7'));var attributes=require('./voiceQueuesLog.attributes');module['exports']=function(_0x1de948,_0x192cbb){return _0x1de948['define'](_0xe85a('0x8'),attributes,{'tableName':_0xe85a('0x9'),'paranoid':![],'indexes':[{'name':'event_dtm','fields':['event',_0xe85a('0xa')]}],'timestamps':![]});}; \ No newline at end of file +var _0x7602=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueuesLog.attributes','exports','define','event'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0x7602,0x15e));var _0x2760=function(_0x26f702,_0x3919bf){_0x26f702=_0x26f702-0x0;var _0x11417d=_0x7602[_0x26f702];return _0x11417d;};'use strict';var _=require(_0x2760('0x0'));var util=require(_0x2760('0x1'));var logger=require(_0x2760('0x2'))(_0x2760('0x3'));var moment=require(_0x2760('0x4'));var BPromise=require(_0x2760('0x5'));var rp=require(_0x2760('0x6'));var fs=require('fs');var path=require(_0x2760('0x7'));var rimraf=require(_0x2760('0x8'));var config=require(_0x2760('0x9'));var attributes=require(_0x2760('0xa'));module[_0x2760('0xb')]=function(_0x1a3220,_0x22cf63){return _0x1a3220[_0x2760('0xc')]('VoiceQueuesLog',attributes,{'tableName':'voice_queues_log','paranoid':![],'indexes':[{'name':'event_dtm','fields':[_0x2760('0xd'),'dtm']}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 88ebddb..72711de 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 _0xe2cf=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util'];(function(_0x54befe,_0x280a2d){var _0x4396f2=function(_0x4639b6){while(--_0x4639b6){_0x54befe['push'](_0x54befe['shift']());}};_0x4396f2(++_0x280a2d);}(_0xe2cf,0x1a1));var _0xfe2c=function(_0x26c643,_0x2c784a){_0x26c643=_0x26c643-0x0;var _0xb49398=_0xe2cf[_0x26c643];return _0xb49398;};'use strict';var _=require('lodash');var util=require(_0xfe2c('0x0'));var moment=require('moment');var BPromise=require(_0xfe2c('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfe2c('0x2'));var db=require(_0xfe2c('0x3'))['db'];var utils=require(_0xfe2c('0x4'));var logger=require(_0xfe2c('0x5'))('rpc');var config=require(_0xfe2c('0x6'));var jayson=require(_0xfe2c('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4e0b97,_0x417bc4,_0x5e5b46){return new BPromise(function(_0x485a24,_0x30aafe){return client[_0xfe2c('0x8')](_0x4e0b97,_0x5e5b46)[_0xfe2c('0x9')](function(_0x562414){logger['info'](_0xfe2c('0xa'),_0x417bc4,_0xfe2c('0xb'));logger['debug'](_0xfe2c('0xc'),_0x417bc4,_0xfe2c('0xb'),JSON[_0xfe2c('0xd')](_0x562414));if(_0x562414[_0xfe2c('0xe')]){if(_0x562414[_0xfe2c('0xe')][_0xfe2c('0xf')]===0x1f4){logger[_0xfe2c('0xe')]('VoiceQueuesLog,\x20%s,\x20%s',_0x417bc4,_0x562414['error']['message']);return _0x30aafe(_0x562414['error'][_0xfe2c('0x10')]);}logger['error']('VoiceQueuesLog,\x20%s,\x20%s',_0x417bc4,_0x562414[_0xfe2c('0xe')][_0xfe2c('0x10')]);return _0x485a24(_0x562414[_0xfe2c('0xe')][_0xfe2c('0x10')]);}else{logger['info']('VoiceQueuesLog,\x20%s,\x20%s',_0x417bc4,_0xfe2c('0xb'));_0x485a24(_0x562414[_0xfe2c('0x11')][_0xfe2c('0x10')]);}})[_0xfe2c('0x12')](function(_0x565f40){logger[_0xfe2c('0xe')](_0xfe2c('0xa'),_0x417bc4,_0x565f40);_0x30aafe(_0x565f40);});});} \ No newline at end of file +var _0xe5b5=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','VoiceQueuesLog,\x20%s,\x20%s','message','result','catch','lodash'];(function(_0x1e3671,_0x9ae4fc){var _0x48d5f5=function(_0xfab713){while(--_0xfab713){_0x1e3671['push'](_0x1e3671['shift']());}};_0x48d5f5(++_0x9ae4fc);}(_0xe5b5,0x12b));var _0x5e5b=function(_0x134192,_0x36adc5){_0x134192=_0x134192-0x0;var _0x3cd080=_0xe5b5[_0x134192];return _0x3cd080;};'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')]('VoiceQueuesLog,\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')]('VoiceQueuesLog,\x20%s,\x20%s',_0x29db2c,'request\x20sent');_0xcbd478(_0x3a37db[_0x5e5b('0x17')][_0x5e5b('0x16')]);}})[_0x5e5b('0x18')](function(_0x5c7148){logger[_0x5e5b('0x14')]('VoiceQueuesLog,\x20%s,\x20%s',_0x29db2c,_0x5c7148);_0x258414(_0x5c7148);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index f68d550..b026008 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 _0xa9e0=['isAuthenticated','/describe','/:id','/:id/download','download','/:id/downloads','downloadTranscribe','post','create','/:id/transcribe','runTranscribe','put','update','delete','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./voiceRecording.controller','get'];(function(_0x5f0c50,_0x3c3101){var _0x5112a0=function(_0x1d5f99){while(--_0x1d5f99){_0x5f0c50['push'](_0x5f0c50['shift']());}};_0x5112a0(++_0x3c3101);}(_0xa9e0,0x123));var _0x0a9e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa9e0[_0x14add3];return _0x4a174f;};'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'),controller['downloads']);router['get']('/:id/transcribe',auth['isAuthenticated'](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0xf')](_0x0a9e('0x11'),auth['isAuthenticated'](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')](_0x0a9e('0xa'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x14')]);router[_0x0a9e('0x15')]('/:id',auth[_0x0a9e('0x8')](),controller['destroy']);module[_0x0a9e('0x16')]=router; \ No newline at end of file +var _0xa9e0=['isAuthenticated','/describe','/:id','/:id/download','download','/:id/downloads','downloadTranscribe','post','create','/:id/transcribe','runTranscribe','put','update','delete','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./voiceRecording.controller','get'];(function(_0x28c02d,_0x32daa3){var _0x4a81f5=function(_0x4a19e3){while(--_0x4a19e3){_0x28c02d['push'](_0x28c02d['shift']());}};_0x4a81f5(++_0x32daa3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xa9e0[_0x2f3848];return _0x102668;};'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'),controller['downloads']);router['get']('/:id/transcribe',auth['isAuthenticated'](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0xf')](_0x0a9e('0x11'),auth['isAuthenticated'](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')](_0x0a9e('0xa'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x14')]);router[_0x0a9e('0x15')]('/:id',auth[_0x0a9e('0x8')](),controller['destroy']);module[_0x0a9e('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index eba4acd..3a93d94 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 _0xc6ec=['DATE','createdAt','format','MM-DD-YYYY\x20HH:mm','sequelize','moment','path','VIRTUAL','getDataValue','value','extname','STRING','setDataValue','channel','membername','split','INTEGER','TEXT','NEW','FLOAT','BOOLEAN'];(function(_0x4f6c3d,_0x28427f){var _0x84606=function(_0x5b3cf7){while(--_0x5b3cf7){_0x4f6c3d['push'](_0x4f6c3d['shift']());}};_0x84606(++_0x28427f);}(_0xc6ec,0x1a8));var _0xcc6e=function(_0x189305,_0x46c43f){_0x189305=_0x189305-0x0;var _0xea3406=_0xc6ec[_0x189305];return _0xea3406;};'use strict';var Sequelize=require(_0xcc6e('0x0'));var moment=require(_0xcc6e('0x1'));var path=require(_0xcc6e('0x2'));module['exports']={'format':{'type':Sequelize[_0xcc6e('0x3')],'get':function(){return this[_0xcc6e('0x4')](_0xcc6e('0x5'))?path[_0xcc6e('0x6')](this['getDataValue'](_0xcc6e('0x5'))):undefined;}},'uniqueid':{'type':Sequelize[_0xcc6e('0x7')]},'channel':{'type':Sequelize[_0xcc6e('0x7')],'set':function(_0x551e5e){if(_0x551e5e){this[_0xcc6e('0x8')](_0xcc6e('0x9'),_0x551e5e);this['setDataValue'](_0xcc6e('0xa'),_0x551e5e[_0xcc6e('0xb')](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0xcc6e('0x7')]},'calleridnum':{'type':Sequelize[_0xcc6e('0x7')]},'calleridname':{'type':Sequelize[_0xcc6e('0x7')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xcc6e('0x7')]},'accountcode':{'type':Sequelize[_0xcc6e('0x7')]},'context':{'type':Sequelize[_0xcc6e('0x7')]},'exten':{'type':Sequelize[_0xcc6e('0x7')]},'value':{'type':Sequelize[_0xcc6e('0x7')]},'type':{'type':Sequelize[_0xcc6e('0x7')]},'rating':{'type':Sequelize[_0xcc6e('0xc')],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize[_0xcc6e('0x7')]},'userDisposition':{'type':Sequelize[_0xcc6e('0x7')]},'location':{'type':Sequelize[_0xcc6e('0xd')]},'transcribeName':{'type':Sequelize[_0xcc6e('0x7')]},'transcribeStatus':{'type':Sequelize[_0xcc6e('0x7')],'defaultValue':_0xcc6e('0xe')},'fileUri':{'type':Sequelize['TEXT']},'fileText':{'type':Sequelize[_0xcc6e('0xd')]},'failureReason':{'type':Sequelize['TEXT']},'sentiment':{'type':Sequelize[_0xcc6e('0x7')]},'sPositive':{'type':Sequelize[_0xcc6e('0xf')]},'sNegative':{'type':Sequelize['FLOAT']},'sNeutral':{'type':Sequelize[_0xcc6e('0xf')]},'sMixed':{'type':Sequelize[_0xcc6e('0xf')]},'tempSentiment':{'type':Sequelize[_0xcc6e('0x10')],'defaultValue':![]},'createdAt':{'type':Sequelize[_0xcc6e('0x11')],'get':function(){return moment(this[_0xcc6e('0x4')](_0xcc6e('0x12')))[_0xcc6e('0x13')](_0xcc6e('0x14'))['toString']();}},'updatedAt':{'type':Sequelize[_0xcc6e('0x11')],'get':function(){return moment(this[_0xcc6e('0x4')]('updatedAt'))[_0xcc6e('0x13')](_0xcc6e('0x14'))['toString']();}}}; \ No newline at end of file +var _0x10be=['split','INTEGER','TEXT','NEW','FLOAT','BOOLEAN','DATE','format','MM-DD-YYYY\x20HH:mm','toString','updatedAt','moment','path','getDataValue','value','extname','STRING','setDataValue','membername'];(function(_0x10d0f0,_0x1eba3d){var _0x93e308=function(_0x388548){while(--_0x388548){_0x10d0f0['push'](_0x10d0f0['shift']());}};_0x93e308(++_0x1eba3d);}(_0x10be,0x1e6));var _0xe10b=function(_0x2461a5,_0x3f8438){_0x2461a5=_0x2461a5-0x0;var _0x30e28b=_0x10be[_0x2461a5];return _0x30e28b;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xe10b('0x0'));var path=require(_0xe10b('0x1'));module['exports']={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xe10b('0x2')](_0xe10b('0x3'))?path[_0xe10b('0x4')](this[_0xe10b('0x2')](_0xe10b('0x3'))):undefined;}},'uniqueid':{'type':Sequelize[_0xe10b('0x5')]},'channel':{'type':Sequelize[_0xe10b('0x5')],'set':function(_0xd0fa1a){if(_0xd0fa1a){this[_0xe10b('0x6')]('channel',_0xd0fa1a);this[_0xe10b('0x6')](_0xe10b('0x7'),_0xd0fa1a[_0xe10b('0x8')](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0xe10b('0x5')]},'calleridnum':{'type':Sequelize[_0xe10b('0x5')]},'calleridname':{'type':Sequelize[_0xe10b('0x5')]},'connectedlinenum':{'type':Sequelize[_0xe10b('0x5')]},'connectedlinename':{'type':Sequelize[_0xe10b('0x5')]},'accountcode':{'type':Sequelize[_0xe10b('0x5')]},'context':{'type':Sequelize[_0xe10b('0x5')]},'exten':{'type':Sequelize[_0xe10b('0x5')]},'value':{'type':Sequelize[_0xe10b('0x5')]},'type':{'type':Sequelize[_0xe10b('0x5')]},'rating':{'type':Sequelize[_0xe10b('0x9')],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize[_0xe10b('0x5')]},'location':{'type':Sequelize[_0xe10b('0xa')]},'transcribeName':{'type':Sequelize[_0xe10b('0x5')]},'transcribeStatus':{'type':Sequelize[_0xe10b('0x5')],'defaultValue':_0xe10b('0xb')},'fileUri':{'type':Sequelize[_0xe10b('0xa')]},'fileText':{'type':Sequelize[_0xe10b('0xa')]},'failureReason':{'type':Sequelize[_0xe10b('0xa')]},'sentiment':{'type':Sequelize['STRING']},'sPositive':{'type':Sequelize[_0xe10b('0xc')]},'sNegative':{'type':Sequelize[_0xe10b('0xc')]},'sNeutral':{'type':Sequelize[_0xe10b('0xc')]},'sMixed':{'type':Sequelize[_0xe10b('0xc')]},'tempSentiment':{'type':Sequelize[_0xe10b('0xd')],'defaultValue':![]},'createdAt':{'type':Sequelize[_0xe10b('0xe')],'get':function(){return moment(this[_0xe10b('0x2')]('createdAt'))[_0xe10b('0xf')](_0xe10b('0x10'))[_0xe10b('0x11')]();}},'updatedAt':{'type':Sequelize[_0xe10b('0xe')],'get':function(){return moment(this[_0xe10b('0x2')](_0xe10b('0x12')))[_0xe10b('0xf')](_0xe10b('0x10'))[_0xe10b('0x11')]();}}}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.controller.js b/server/api/voiceRecording/voiceRecording.controller.js index a55761d..dec505f 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 _0x66ab=['json','count','offset','limit','set','Content-Range','save','then','destroy','error','name','send','index','map','VoiceRecording','rawAttributes','fieldName','type','key','differenceBy','query','filters','intersection','attributes','model','fields','hasOwnProperty','order','sort','where','pick','filter','merge','includeAll','include','findAll','rows','params','keys','length','options','find','catch','create','body','update','describe','download','../../components/encryptor','uniqueid','value','format','existsSync','secrets','recording','Sequelize','VoiceRecording\x20not\x20found','filename','extname','unlink','downloads','sequelize','MD5','col','token','$and','push','%s.cypher','decryptFile','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','listBuckets','createBucket','upload','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','ValidationError','Setting','transcribe','transcribeAccountId','transcribeRegion','language','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','writeFile','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','eml-format','zip-dir','moment','mustache','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x66ab,0x111));var _0xb66a=function(_0x2fcb38,_0x2a02e0){_0x2fcb38=_0x2fcb38-0x0;var _0x409ab1=_0x66ab[_0x2fcb38];return _0x409ab1;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb66a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb66a('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xb66a('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xb66a('0x3'));var util=require(_0xb66a('0x4'));var path=require(_0xb66a('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xb66a('0x6'));var fs=require('fs');var _=require(_0xb66a('0x7'));var squel=require(_0xb66a('0x8'));var crypto=require(_0xb66a('0x9'));var jsforce=require(_0xb66a('0xa'));var deskjs=require(_0xb66a('0xb'));var toCsv=require(_0xb66a('0xc'));var querystring=require(_0xb66a('0xd'));var Papa=require(_0xb66a('0xe'));var AWS=require('aws-sdk');var uuidv4=require(_0xb66a('0xf'));var Redis=require(_0xb66a('0x10'));var authService=require(_0xb66a('0x11'));var qs=require(_0xb66a('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xb66a('0x13'))(_0xb66a('0x14'));var utils=require(_0xb66a('0x15'));var config=require(_0xb66a('0x16'));var db=require(_0xb66a('0x17'))['db'];function respondWithStatusCode(_0x5d80e3,_0x4bd42a){_0x4bd42a=_0x4bd42a||0xcc;return function(_0x1ea718){if(_0x1ea718){return _0x5d80e3[_0xb66a('0x18')](_0x4bd42a);}return _0x5d80e3[_0xb66a('0x19')](_0x4bd42a)[_0xb66a('0x1a')]();};}function respondWithResult(_0x26937c,_0x3be7d5){_0x3be7d5=_0x3be7d5||0xc8;return function(_0x389cbd){if(_0x389cbd){return _0x26937c[_0xb66a('0x19')](_0x3be7d5)[_0xb66a('0x1b')](_0x389cbd);}};}function respondWithFilteredResult(_0x28cf65,_0x3d97df){return function(_0x301dc9){if(_0x301dc9){var _0x431346=_0x301dc9[_0xb66a('0x1c')],_0x1297f3=_0x3d97df[_0xb66a('0x1d')],_0x5caa70=_0x3d97df[_0xb66a('0x1d')]+_0x3d97df[_0xb66a('0x1e')],_0x3ca1d1;if(_0x5caa70>=_0x431346){_0x5caa70=_0x431346;_0x3ca1d1=0xc8;}else{_0x3ca1d1=0xce;}_0x28cf65[_0xb66a('0x19')](_0x3ca1d1);return _0x28cf65[_0xb66a('0x1f')](_0xb66a('0x20'),_0x1297f3+'-'+_0x5caa70+'/'+_0x431346)['json'](_0x301dc9);}return null;};}function patchUpdates(_0x27b557){return function(_0x47dfa4){try{jsonpatch['apply'](_0x47dfa4,_0x27b557,!![]);}catch(_0x18705c){return BPromise['reject'](_0x18705c);}return _0x47dfa4[_0xb66a('0x21')]();};}function saveUpdates(_0x413677,_0x3abf8d){return function(_0x1188e6){if(_0x1188e6){return _0x1188e6['update'](_0x413677)[_0xb66a('0x22')](function(_0x57d3db){return _0x57d3db;});}return null;};}function removeEntity(_0x45a3e7,_0x42052d){return function(_0x1ba7de){if(_0x1ba7de){return _0x1ba7de[_0xb66a('0x23')]()['then'](function(){_0x45a3e7[_0xb66a('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x225a71,_0x3f675b){return function(_0x5688bd){if(!_0x5688bd){_0x225a71[_0xb66a('0x18')](0x194);}return _0x5688bd;};}function handleError(_0xd283cc,_0x9d678b){_0x9d678b=_0x9d678b||0x1f4;return function(_0x39692a){logger[_0xb66a('0x24')](_0x39692a['stack']);if(_0x39692a['name']){delete _0x39692a[_0xb66a('0x25')];}_0xd283cc[_0xb66a('0x19')](_0x9d678b)[_0xb66a('0x26')](_0x39692a);};}exports[_0xb66a('0x27')]=function(_0x756336,_0x4643b9){var _0x3a8d7f={},_0x5b9d60={},_0x24df88={'count':0x0,'rows':[]};var _0x4fa1e2=_[_0xb66a('0x28')](db[_0xb66a('0x29')][_0xb66a('0x2a')],function(_0xcd9c62){return{'name':_0xcd9c62[_0xb66a('0x2b')],'type':_0xcd9c62[_0xb66a('0x2c')][_0xb66a('0x2d')]};});_0x5b9d60['model']=_[_0xb66a('0x2e')](_[_0xb66a('0x28')](_0x4fa1e2,_0xb66a('0x25')),['format']);_0x5b9d60[_0xb66a('0x2f')]=_['keys'](_0x756336[_0xb66a('0x2f')]);_0x5b9d60[_0xb66a('0x30')]=_[_0xb66a('0x31')](_0x5b9d60['model'],_0x5b9d60['query']);_0x3a8d7f[_0xb66a('0x32')]=_[_0xb66a('0x31')](_0x5b9d60[_0xb66a('0x33')],qs[_0xb66a('0x34')](_0x756336[_0xb66a('0x2f')]['fields']));_0x3a8d7f[_0xb66a('0x32')]=_0x3a8d7f[_0xb66a('0x32')]['length']?_0x3a8d7f[_0xb66a('0x32')]:_0x5b9d60[_0xb66a('0x33')];if(!_0x756336[_0xb66a('0x2f')][_0xb66a('0x35')]('nolimit')){_0x3a8d7f[_0xb66a('0x1e')]=qs[_0xb66a('0x1e')](_0x756336[_0xb66a('0x2f')]['limit']);_0x3a8d7f[_0xb66a('0x1d')]=qs[_0xb66a('0x1d')](_0x756336[_0xb66a('0x2f')][_0xb66a('0x1d')]);}_0x3a8d7f[_0xb66a('0x36')]=qs[_0xb66a('0x37')](_0x756336[_0xb66a('0x2f')]['sort']);_0x3a8d7f[_0xb66a('0x38')]=qs[_0xb66a('0x30')](_[_0xb66a('0x39')](_0x756336[_0xb66a('0x2f')],_0x5b9d60[_0xb66a('0x30')]),_0x4fa1e2);if(_0x756336[_0xb66a('0x2f')][_0xb66a('0x3a')]){_0x3a8d7f[_0xb66a('0x38')]=_['merge'](_0x3a8d7f[_0xb66a('0x38')],{'$or':_[_0xb66a('0x28')](_0x4fa1e2,function(_0x272cc3){if(_0x272cc3[_0xb66a('0x2c')]!=='VIRTUAL'){var _0x41d760={};_0x41d760[_0x272cc3[_0xb66a('0x25')]]={'$like':'%'+_0x756336[_0xb66a('0x2f')]['filter']+'%'};return _0x41d760;}})});}_0x3a8d7f=_[_0xb66a('0x3b')]({},_0x3a8d7f,_0x756336['options']);var _0x5c3dd5={'where':_0x3a8d7f[_0xb66a('0x38')]};return db[_0xb66a('0x29')]['count'](_0x5c3dd5)['then'](function(_0x5553e2){_0x24df88['count']=_0x5553e2;if(_0x756336[_0xb66a('0x2f')][_0xb66a('0x3c')]){_0x3a8d7f[_0xb66a('0x3d')]=[{'all':!![]}];}return db[_0xb66a('0x29')][_0xb66a('0x3e')](_0x3a8d7f);})[_0xb66a('0x22')](function(_0x1efdba){_0x24df88[_0xb66a('0x3f')]=_0x1efdba;return _0x24df88;})[_0xb66a('0x22')](respondWithFilteredResult(_0x4643b9,_0x3a8d7f))['catch'](handleError(_0x4643b9,null));};exports['show']=function(_0x8d773,_0x1b047c){var _0x3d16d2={'raw':![],'where':{'id':_0x8d773[_0xb66a('0x40')]['id']}},_0x23652f={};_0x23652f[_0xb66a('0x33')]=_['keys'](db[_0xb66a('0x29')]['rawAttributes']);_0x23652f[_0xb66a('0x2f')]=_[_0xb66a('0x41')](_0x8d773[_0xb66a('0x2f')]);_0x23652f['filters']=_['intersection'](_0x23652f['model'],_0x23652f[_0xb66a('0x2f')]);_0x3d16d2[_0xb66a('0x32')]=_[_0xb66a('0x31')](_0x23652f[_0xb66a('0x33')],qs[_0xb66a('0x34')](_0x8d773['query'][_0xb66a('0x34')]));_0x3d16d2['attributes']=_0x3d16d2[_0xb66a('0x32')][_0xb66a('0x42')]?_0x3d16d2[_0xb66a('0x32')]:_0x23652f['model'];if(_0x8d773[_0xb66a('0x2f')][_0xb66a('0x3c')]){_0x3d16d2[_0xb66a('0x3d')]=[{'all':!![]}];}_0x3d16d2=_[_0xb66a('0x3b')]({},_0x3d16d2,_0x8d773[_0xb66a('0x43')]);return db[_0xb66a('0x29')][_0xb66a('0x44')](_0x3d16d2)[_0xb66a('0x22')](handleEntityNotFound(_0x1b047c,null))['then'](respondWithResult(_0x1b047c,null))[_0xb66a('0x45')](handleError(_0x1b047c,null));};exports[_0xb66a('0x46')]=function(_0x533e4e,_0x1c3c0b){return db[_0xb66a('0x29')][_0xb66a('0x46')](_0x533e4e[_0xb66a('0x47')],{})[_0xb66a('0x22')](respondWithResult(_0x1c3c0b,0xc9))['catch'](handleError(_0x1c3c0b,null));};exports[_0xb66a('0x48')]=function(_0x16a3fc,_0x405b2f){if(_0x16a3fc[_0xb66a('0x47')]['id']){delete _0x16a3fc[_0xb66a('0x47')]['id'];}return db['VoiceRecording'][_0xb66a('0x44')]({'where':{'id':_0x16a3fc[_0xb66a('0x40')]['id']}})[_0xb66a('0x22')](handleEntityNotFound(_0x405b2f,null))[_0xb66a('0x22')](saveUpdates(_0x16a3fc[_0xb66a('0x47')],null))[_0xb66a('0x22')](respondWithResult(_0x405b2f,null))[_0xb66a('0x45')](handleError(_0x405b2f,null));};exports[_0xb66a('0x49')]=function(_0x10e223,_0x4969af){return db[_0xb66a('0x29')][_0xb66a('0x49')]()['then'](respondWithResult(_0x4969af,null))[_0xb66a('0x45')](handleError(_0x4969af,null));};exports[_0xb66a('0x4a')]=function(_0x27e616,_0x4972bb,_0x2d7b77){var _0x40668a=require(_0xb66a('0x4b'));var _0x1c3273=![];var _0x12a292={};if(_0x27e616[_0xb66a('0x2f')]['type']&&_0x27e616[_0xb66a('0x2f')][_0xb66a('0x2c')]==='uniqueid'){_0x12a292[_0xb66a('0x4c')]=_0x27e616['params']['id'];}else{_0x12a292['id']=_0x27e616['params']['id'];}return db[_0xb66a('0x29')][_0xb66a('0x44')]({'where':_0x12a292,'attributes':['id',_0xb66a('0x4d')],'raw':!![]})[_0xb66a('0x22')](handleEntityNotFound(_0x4972bb,null))[_0xb66a('0x22')](function(_0x5577c1){if(_0x5577c1){var _0x4bebcc=_0x5577c1['value'];var _0x32bf34=util[_0xb66a('0x4e')]('%s.cypher',_0x4bebcc);if(fs[_0xb66a('0x4f')](_0x32bf34)){_0x1c3273=!![];return _0x40668a['decryptFile'](_0x32bf34,_0x4bebcc,config[_0xb66a('0x50')][_0xb66a('0x51')])[_0xb66a('0x22')](function(){return _0x5577c1;});}return _0x5577c1;}})['then'](function(_0xa20baa){if(_0xa20baa){var _0x50a5df=_0xa20baa[_0xb66a('0x4d')];if(!fs['existsSync'](_0x50a5df)){throw new db[(_0xb66a('0x52'))]['ValidationError'](_0xb66a('0x53'));}if(_0xa20baa['filename']){return _0x4972bb[_0xb66a('0x4a')](_0x50a5df,_0xa20baa[_0xb66a('0x54')]+path[_0xb66a('0x55')](_0x50a5df),function(){if(_0x1c3273){fs[_0xb66a('0x56')](_0x50a5df);}});}else{return _0x4972bb[_0xb66a('0x4a')](_0x50a5df,function(_0x339ab0){if(_0x1c3273){fs[_0xb66a('0x56')](_0x50a5df);}});}}})[_0xb66a('0x45')](function(_0x6bec37){if(_0x6bec37['message']==='VoiceRecording\x20not\x20found'){_0x4972bb[_0xb66a('0x19')](0x194)[_0xb66a('0x26')]('Not\x20found');}else{return handleError(_0x4972bb,null);}});};exports[_0xb66a('0x57')]=function(_0x428aa3,_0x2537e5,_0x53c00a){var _0x17e824=require(_0xb66a('0x4b'));var _0x16c8b2=![];var _0x3ff483={'$and':[db[_0xb66a('0x58')]['where'](db[_0xb66a('0x58')]['fn'](_0xb66a('0x59'),db[_0xb66a('0x58')][_0xb66a('0x5a')](_0xb66a('0x4c'))),_0x428aa3[_0xb66a('0x2f')][_0xb66a('0x5b')])]};if(_0x428aa3[_0xb66a('0x2f')][_0xb66a('0x2c')]&&_0x428aa3[_0xb66a('0x2f')][_0xb66a('0x2c')]===_0xb66a('0x4c')){_0x3ff483[_0xb66a('0x5c')][_0xb66a('0x5d')]({'uniqueid':_0x428aa3[_0xb66a('0x40')]['id']});}else{_0x3ff483['$and']['push']({'id':_0x428aa3[_0xb66a('0x40')]['id']});}return db['VoiceRecording'][_0xb66a('0x44')]({'where':_0x3ff483,'attributes':['id',_0xb66a('0x4d')],'raw':!![]})[_0xb66a('0x22')](handleEntityNotFound(_0x2537e5,null))['then'](function(_0x513e15){if(_0x513e15){var _0x26eb72=util[_0xb66a('0x4e')](_0xb66a('0x5e'),_0x513e15[_0xb66a('0x4d')]);if(fs[_0xb66a('0x4f')](_0x26eb72)){_0x16c8b2=!![];return _0x17e824[_0xb66a('0x5f')](_0x26eb72,_0x513e15['value'],config['secrets'][_0xb66a('0x51')])[_0xb66a('0x22')](function(){return _0x513e15;});}return _0x513e15;}})[_0xb66a('0x22')](function(_0x2a0195){if(_0x2a0195){if(!fs[_0xb66a('0x4f')](_0x2a0195[_0xb66a('0x4d')])){throw new db[(_0xb66a('0x52'))]['ValidationError'](_0xb66a('0x53'));}if(_0x2a0195[_0xb66a('0x54')]){return _0x2537e5[_0xb66a('0x4a')](_0x2a0195[_0xb66a('0x4d')],_0x2a0195[_0xb66a('0x54')]+path[_0xb66a('0x55')](_0x2a0195[_0xb66a('0x4d')]),function(){if(_0x16c8b2){fs[_0xb66a('0x56')](_0x2a0195['value']);}});}else{return _0x2537e5[_0xb66a('0x4a')](_0x2a0195[_0xb66a('0x4d')],function(_0x2a621a){if(_0x16c8b2){fs[_0xb66a('0x56')](_0x2a0195[_0xb66a('0x4d')]);}});}}})[_0xb66a('0x45')](handleError(_0x2537e5,null));};exports[_0xb66a('0x23')]=function(_0x2de16e,_0x12e94f){return db[_0xb66a('0x29')][_0xb66a('0x44')]({'where':{'id':_0x2de16e[_0xb66a('0x40')]['id']}})['then'](function(_0x1a7560){if(!_0x1a7560)throw new ReferenceError(_0xb66a('0x60'));return _0x1a7560;})[_0xb66a('0x22')](function(_0x4d3d40){var _0x2612fa=_0x4d3d40['value'];logger[_0xb66a('0x61')](_0xb66a('0x62'),_0x2612fa);if(!_[_0xb66a('0x63')](_0x4d3d40[_0xb66a('0x4d')])&&fs['existsSync'](_0x2612fa)){logger[_0xb66a('0x61')](_0xb66a('0x64')+_0x2612fa+_0xb66a('0x65'));fs[_0xb66a('0x66')](_0x2612fa);}_0x2612fa=_0x2612fa+'.cypher';if(!_[_0xb66a('0x63')](_0x4d3d40[_0xb66a('0x4d')])&&fs['existsSync'](_0x2612fa)){logger[_0xb66a('0x61')](_0xb66a('0x64')+_0x2612fa+_0xb66a('0x65'));fs[_0xb66a('0x66')](_0x2612fa);}return _0x4d3d40;})[_0xb66a('0x22')](function(_0x5d9316){if(!_0x5d9316)throw new InternalError();return _0x5d9316[_0xb66a('0x23')]();})[_0xb66a('0x22')](function(){_0x12e94f[_0xb66a('0x19')](0xcc)[_0xb66a('0x1a')]();})[_0xb66a('0x45')](handleError(_0x12e94f,null));};function getBucketslist(_0x16fff6,_0x199ec2,_0x3396e8){return new Promise(function(_0x68f16,_0x27c3d3){var _0xb71d14=new AWS['S3']({'accessKeyId':_0x199ec2,'secretAccessKey':_0x16fff6,'region':_0x3396e8});_0xb71d14[_0xb66a('0x67')]({},function(_0x2a036b,_0x2f2bfd){if(_0x2a036b){return _0x27c3d3(_0x2a036b);}else{return _0x68f16(_0x2f2bfd);}});});}function createBucket(_0x296202,_0x2d683a,_0x44251a,_0x4094fb){return new Promise(function(_0x44f7ad,_0x2ef012){var _0x219e4f=new AWS['S3']({'accessKeyId':_0x2d683a,'secretAccessKey':_0x296202,'region':_0x44251a});_0x219e4f[_0xb66a('0x68')]({'Bucket':_0x4094fb},function(_0x1d5345,_0x3aa1bd){if(_0x1d5345){return _0x2ef012(_0x1d5345);}else{return _0x44f7ad(_0x3aa1bd);}});});}function uploadFile(_0x2c721d,_0x4e818e,_0x4b1e70,_0x597bce,_0x26d9f9,_0x308c94){return new Promise(function(_0x2f15ca,_0x9676cd){var _0x3f8ca5=new AWS['S3']({'accessKeyId':_0x4e818e,'secretAccessKey':_0x2c721d,'region':_0x4b1e70});_0x3f8ca5[_0xb66a('0x69')]({'Bucket':_0x597bce,'Key':_0x26d9f9,'Body':_0x308c94},function(_0x65570d,_0xc00367){if(_0x65570d){return _0x9676cd(_0x65570d);}else{return _0x2f15ca(_0xc00367);}});});}function startTranscribe(_0x2522c0,_0x3a7bcf,_0x4de143,_0x124d45,_0x489f0f,_0x40a228){return new Promise(function(_0x3e015a,_0x1cadb0){var _0x5677c2=new AWS['TranscribeService']({'accessKeyId':_0x3a7bcf,'secretAccessKey':_0x2522c0,'region':_0x4de143});_0x5677c2['startTranscriptionJob']({'TranscriptionJobName':_0x124d45,'LanguageCode':_0x489f0f,'Media':{'MediaFileUri':_0x40a228}},function(_0x167bdf,_0x36221a){if(_0x167bdf){return _0x1cadb0(_0x167bdf);}else{return _0x3e015a(_0x36221a);}});});}function transcribe(_0x35b126,_0x42a9b9,_0x16e5bc,_0x3e1a9a,_0x2822d5,_0x4f2628,_0xf53f97){return new Promise(function(_0x2eaf2a,_0x299feb){var _0x1aa855={};logger['info'](util[_0xb66a('0x4e')](_0xb66a('0x6a'),_0x35b126,_0x2822d5));return uploadFile(_0x42a9b9,_0x16e5bc,_0x3e1a9a,_0x2822d5,path['basename'](_0x4f2628),fs[_0xb66a('0x6b')](_0x4f2628))[_0xb66a('0x22')](function(_0x4d0181){logger[_0xb66a('0x61')](util[_0xb66a('0x4e')](_0xb66a('0x6c'),_0x35b126,_0x2822d5,_0x4d0181[_0xb66a('0x6d')]));_0x1aa855[_0xb66a('0x6e')]=_0x4d0181['Bucket'];_0x1aa855[_0xb66a('0x6f')]=_0x4d0181['Location'];logger[_0xb66a('0x61')](util[_0xb66a('0x4e')](_0xb66a('0x70'),_0x35b126));return startTranscribe(_0x42a9b9,_0x16e5bc,_0x3e1a9a,uuidv4(),_0xf53f97,_0x4d0181[_0xb66a('0x6d')]);})[_0xb66a('0x22')](function(_0x486e4f){logger[_0xb66a('0x61')](util[_0xb66a('0x4e')]('[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created',_0x35b126,_0x486e4f[_0xb66a('0x71')][_0xb66a('0x72')]));_0x1aa855[_0xb66a('0x73')]=_0x486e4f[_0xb66a('0x71')][_0xb66a('0x72')];_0x1aa855[_0xb66a('0x74')]=_0x486e4f[_0xb66a('0x71')][_0xb66a('0x75')];return _0x2eaf2a(_0x1aa855);})[_0xb66a('0x45')](function(_0x210b9d){return _0x299feb(_0x210b9d);});});}exports[_0xb66a('0x76')]=function(_0x4fe9ff,_0x22d0b3,_0xd64447){var _0x30480c;var _0x2db981;var _0x502d70;var _0x106a3c=require(_0xb66a('0x4b'));return db[_0xb66a('0x29')][_0xb66a('0x77')]({'where':{'id':_0x4fe9ff[_0xb66a('0x40')]['id']}})['then'](function(_0x1b8ba9){if(_0x1b8ba9){var _0x253ea0=util['format'](_0xb66a('0x5e'),_0x1b8ba9[_0xb66a('0x4d')]);if(fs['existsSync'](_0x253ea0)){cypher=!![];return _0x106a3c[_0xb66a('0x5f')](_0x253ea0,_0x1b8ba9[_0xb66a('0x4d')],config[_0xb66a('0x50')][_0xb66a('0x51')])['then'](function(){return _0x1b8ba9;});}return _0x1b8ba9;}})['then'](function(_0x19b2ad){if(!_0x19b2ad){throw new db[(_0xb66a('0x52'))][(_0xb66a('0x78'))]('Voice\x20Recording\x20not\x20found');}_0x2db981=_0x19b2ad;return db[_0xb66a('0x79')]['findOne']({'where':{'id':0x1}});})[_0xb66a('0x22')](handleEntityNotFound(_0x22d0b3,null))[_0xb66a('0x22')](function(_0x14bec6){if(_0x14bec6){_0x30480c=_0x14bec6;if(!_0x30480c[_0xb66a('0x7a')]||!_0x30480c[_0xb66a('0x7b')]||!_0x30480c[_0xb66a('0x7c')]||!_0x30480c[_0xb66a('0x7d')]||!_0x30480c[_0xb66a('0x6e')]){throw new db[(_0xb66a('0x52'))][(_0xb66a('0x78'))](_0xb66a('0x7e'));}if(_0x4fe9ff['body'][_0xb66a('0x7f')]&&(!_0x30480c[_0xb66a('0x80')]||!_0x30480c[_0xb66a('0x81')]||!_0x30480c[_0xb66a('0x82')]||!_0x30480c[_0xb66a('0x7d')]||!_0x30480c[_0xb66a('0x6e')])){throw new db[(_0xb66a('0x52'))][(_0xb66a('0x78'))](_0xb66a('0x83'));}return db[_0xb66a('0x84')][_0xb66a('0x77')]({'where':{'id':_0x30480c[_0xb66a('0x7b')]}});}})['then'](function(_0x3b3f85){if(!_0x3b3f85){throw new db[(_0xb66a('0x52'))][(_0xb66a('0x78'))](_0xb66a('0x85'));}if(!_0x3b3f85[_0xb66a('0x86')]||!_0x3b3f85[_0xb66a('0x87')]){throw new db[(_0xb66a('0x52'))][(_0xb66a('0x78'))](_0xb66a('0x88'));}_0x502d70=_0x3b3f85;return getBucketslist(_0x502d70['data1'],_0x502d70['data2'],_0x30480c[_0xb66a('0x7c')]);})[_0xb66a('0x22')](function(_0x169aca){if(_0x169aca&&_0x169aca['Buckets']){var _0x540042=_[_0xb66a('0x44')](_0x169aca[_0xb66a('0x89')],function(_0xa7ffb){return _0xa7ffb[_0xb66a('0x8a')]===_0x30480c['bucket'];});if(!_0x540042){logger[_0xb66a('0x61')](util[_0xb66a('0x4e')](_0xb66a('0x8b'),_0x4fe9ff['params']['id'],_0x30480c[_0xb66a('0x6e')]));return createBucket(_0x502d70[_0xb66a('0x86')],_0x502d70[_0xb66a('0x87')],_0x30480c[_0xb66a('0x7c')],_0x30480c[_0xb66a('0x6e')]);}logger[_0xb66a('0x61')](util[_0xb66a('0x4e')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available',_0x4fe9ff['params']['id'],_0x30480c[_0xb66a('0x6e')]));return;}})[_0xb66a('0x22')](function(_0x4c1a74){if(_0x2db981[_0xb66a('0x74')]==='NEW'){return transcribe(_0x4fe9ff[_0xb66a('0x40')]['id'],_0x502d70[_0xb66a('0x86')],_0x502d70[_0xb66a('0x87')],_0x30480c['transcribeRegion'],_0x30480c[_0xb66a('0x6e')],_0x2db981[_0xb66a('0x4d')],_0x30480c[_0xb66a('0x7d')]);}else{logger[_0xb66a('0x61')](util[_0xb66a('0x4e')](_0xb66a('0x8c'),_0x4fe9ff['params']['id']));return{'transcribeStatus':_0xb66a('0x8d')};}})[_0xb66a('0x22')](function(_0x52ad98){if(_0x52ad98){_0x52ad98[_0xb66a('0x8e')]=_0x4fe9ff['body']['runSentiment'];return _0x2db981['updateAttributes'](_0x52ad98);}})[_0xb66a('0x22')](respondWithResult(_0x22d0b3,null))[_0xb66a('0x45')](handleError(_0x22d0b3,null));};function writeFile(_0x15a8c2,_0x35af1e){return new Promise(function(_0x2c0a30,_0x297d80){fs[_0xb66a('0x8f')](_0x35af1e,_0x15a8c2,function(_0x4e01ae,_0x3df214){if(_0x4e01ae){return _0x297d80(_0x4e01ae);}else{return _0x2c0a30(_0x3df214);}});});}exports[_0xb66a('0x90')]=function(_0x42c049,_0x4f7080,_0x18b54d){return db[_0xb66a('0x29')][_0xb66a('0x77')]({'where':{'id':_0x42c049[_0xb66a('0x40')]['id']}})['then'](handleEntityNotFound(_0x4f7080))['then'](function(_0x34ea9e){if(_0x34ea9e&&_0x34ea9e[_0xb66a('0x91')]){var _0x590aea=_0x34ea9e[_0xb66a('0x91')];var _0x201482=config[_0xb66a('0x92')]+_0xb66a('0x93')+_0x34ea9e['id']+_0xb66a('0x94');if(fs['existsSync'](_0x201482)){return _0x201482;}return writeFile(_0x590aea,_0x201482)[_0xb66a('0x22')](function(){return _0x201482;});}else{throw new db[(_0xb66a('0x52'))][(_0xb66a('0x78'))](_0xb66a('0x95'));}})[_0xb66a('0x22')](function(_0x1977a7){return _0x4f7080[_0xb66a('0x4a')](_0x1977a7);})[_0xb66a('0x45')](handleError(_0x4f7080));}; \ No newline at end of file +var _0xa6fa=['NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','uuid/v4','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','update','then','name','send','map','VoiceRecording','rawAttributes','fieldName','type','differenceBy','format','query','intersection','model','attributes','fields','length','nolimit','sort','where','filters','pick','merge','options','include','findAll','rows','show','params','keys','includeAll','catch','create','body','find','describe','download','uniqueid','value','existsSync','decryptFile','secrets','recording','Sequelize','filename','extname','unlink','message','Not\x20found','../../components/encryptor','sequelize','MD5','col','token','$and','push','%s.cypher','ValidationError','destroy','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','listBuckets','createBucket','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeRegion','bucket','runSentiment','sentiment','sentimentAccountId','language','Sentiment\x20Analysis\x20not\x20configured','Cloud\x20Provider\x20not\x20available','data2','Cloud\x20Provider\x20not\x20configured','data1','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available'];(function(_0x4984b0,_0x1174ed){var _0x10cc1=function(_0xaa5405){while(--_0xaa5405){_0x4984b0['push'](_0x4984b0['shift']());}};_0x10cc1(++_0x1174ed);}(_0xa6fa,0x134));var _0xaa6f=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xa6fa[_0x17d9e3];return _0x14192d;};'use strict';var pdf=require(_0xaa6f('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xaa6f('0x1'));var jsonpatch=require(_0xaa6f('0x2'));var rp=require(_0xaa6f('0x3'));var moment=require(_0xaa6f('0x4'));var BPromise=require(_0xaa6f('0x5'));var Mustache=require('mustache');var util=require(_0xaa6f('0x6'));var path=require(_0xaa6f('0x7'));var sox=require(_0xaa6f('0x8'));var csv=require(_0xaa6f('0x9'));var ejs=require(_0xaa6f('0xa'));var fs=require('fs');var _=require(_0xaa6f('0xb'));var squel=require(_0xaa6f('0xc'));var crypto=require('crypto');var jsforce=require(_0xaa6f('0xd'));var deskjs=require(_0xaa6f('0xe'));var toCsv=require('to-csv');var querystring=require(_0xaa6f('0xf'));var Papa=require(_0xaa6f('0x10'));var AWS=require('aws-sdk');var uuidv4=require(_0xaa6f('0x11'));var Redis=require('ioredis');var authService=require(_0xaa6f('0x12'));var qs=require(_0xaa6f('0x13'));var as=require(_0xaa6f('0x14'));var hardwareService=require(_0xaa6f('0x15'));var logger=require(_0xaa6f('0x16'))(_0xaa6f('0x17'));var utils=require('../../config/utils');var config=require(_0xaa6f('0x18'));var db=require(_0xaa6f('0x19'))['db'];function respondWithStatusCode(_0x4b2754,_0x385295){_0x385295=_0x385295||0xcc;return function(_0x2fe868){if(_0x2fe868){return _0x4b2754[_0xaa6f('0x1a')](_0x385295);}return _0x4b2754[_0xaa6f('0x1b')](_0x385295)[_0xaa6f('0x1c')]();};}function respondWithResult(_0x4c8e6a,_0xb02987){_0xb02987=_0xb02987||0xc8;return function(_0x20b79d){if(_0x20b79d){return _0x4c8e6a[_0xaa6f('0x1b')](_0xb02987)[_0xaa6f('0x1d')](_0x20b79d);}};}function respondWithFilteredResult(_0x2eb65b,_0x4529e7){return function(_0x5c3cdf){if(_0x5c3cdf){var _0x221ed8=_0x5c3cdf[_0xaa6f('0x1e')],_0x24f332=_0x4529e7[_0xaa6f('0x1f')],_0x2d20e5=_0x4529e7[_0xaa6f('0x1f')]+_0x4529e7[_0xaa6f('0x20')],_0x3c30d8;if(_0x2d20e5>=_0x221ed8){_0x2d20e5=_0x221ed8;_0x3c30d8=0xc8;}else{_0x3c30d8=0xce;}_0x2eb65b[_0xaa6f('0x1b')](_0x3c30d8);return _0x2eb65b['set'](_0xaa6f('0x21'),_0x24f332+'-'+_0x2d20e5+'/'+_0x221ed8)['json'](_0x5c3cdf);}return null;};}function patchUpdates(_0x4b44c1){return function(_0x2f4e2d){try{jsonpatch[_0xaa6f('0x22')](_0x2f4e2d,_0x4b44c1,!![]);}catch(_0x5ae1a5){return BPromise[_0xaa6f('0x23')](_0x5ae1a5);}return _0x2f4e2d['save']();};}function saveUpdates(_0x57f191,_0x2b5468){return function(_0x37e71d){if(_0x37e71d){return _0x37e71d[_0xaa6f('0x24')](_0x57f191)[_0xaa6f('0x25')](function(_0x492ad8){return _0x492ad8;});}return null;};}function removeEntity(_0x1f0b26,_0x1ad1fe){return function(_0x5aac18){if(_0x5aac18){return _0x5aac18['destroy']()[_0xaa6f('0x25')](function(){_0x1f0b26[_0xaa6f('0x1b')](0xcc)[_0xaa6f('0x1c')]();});}};}function handleEntityNotFound(_0x2e981f,_0x64588a){return function(_0x2b9f0c){if(!_0x2b9f0c){_0x2e981f[_0xaa6f('0x1a')](0x194);}return _0x2b9f0c;};}function handleError(_0x5424fe,_0x36f743){_0x36f743=_0x36f743||0x1f4;return function(_0x4048af){logger['error'](_0x4048af['stack']);if(_0x4048af[_0xaa6f('0x26')]){delete _0x4048af[_0xaa6f('0x26')];}_0x5424fe[_0xaa6f('0x1b')](_0x36f743)[_0xaa6f('0x27')](_0x4048af);};}exports['index']=function(_0x1a086e,_0x3e1256){var _0x57be7b={},_0xb17d7c={},_0x2cac50={'count':0x0,'rows':[]};var _0x4de7b7=_[_0xaa6f('0x28')](db[_0xaa6f('0x29')][_0xaa6f('0x2a')],function(_0x2bf97a){return{'name':_0x2bf97a[_0xaa6f('0x2b')],'type':_0x2bf97a[_0xaa6f('0x2c')]['key']};});_0xb17d7c['model']=_[_0xaa6f('0x2d')](_[_0xaa6f('0x28')](_0x4de7b7,_0xaa6f('0x26')),[_0xaa6f('0x2e')]);_0xb17d7c[_0xaa6f('0x2f')]=_['keys'](_0x1a086e[_0xaa6f('0x2f')]);_0xb17d7c['filters']=_[_0xaa6f('0x30')](_0xb17d7c[_0xaa6f('0x31')],_0xb17d7c[_0xaa6f('0x2f')]);_0x57be7b[_0xaa6f('0x32')]=_[_0xaa6f('0x30')](_0xb17d7c[_0xaa6f('0x31')],qs[_0xaa6f('0x33')](_0x1a086e[_0xaa6f('0x2f')]['fields']));_0x57be7b[_0xaa6f('0x32')]=_0x57be7b[_0xaa6f('0x32')][_0xaa6f('0x34')]?_0x57be7b[_0xaa6f('0x32')]:_0xb17d7c['model'];if(!_0x1a086e[_0xaa6f('0x2f')]['hasOwnProperty'](_0xaa6f('0x35'))){_0x57be7b[_0xaa6f('0x20')]=qs[_0xaa6f('0x20')](_0x1a086e['query'][_0xaa6f('0x20')]);_0x57be7b[_0xaa6f('0x1f')]=qs[_0xaa6f('0x1f')](_0x1a086e[_0xaa6f('0x2f')][_0xaa6f('0x1f')]);}_0x57be7b['order']=qs[_0xaa6f('0x36')](_0x1a086e[_0xaa6f('0x2f')][_0xaa6f('0x36')]);_0x57be7b[_0xaa6f('0x37')]=qs[_0xaa6f('0x38')](_[_0xaa6f('0x39')](_0x1a086e['query'],_0xb17d7c[_0xaa6f('0x38')]),_0x4de7b7);if(_0x1a086e[_0xaa6f('0x2f')]['filter']){_0x57be7b[_0xaa6f('0x37')]=_[_0xaa6f('0x3a')](_0x57be7b[_0xaa6f('0x37')],{'$or':_[_0xaa6f('0x28')](_0x4de7b7,function(_0x3b7a1e){if(_0x3b7a1e['type']!=='VIRTUAL'){var _0x1cf25d={};_0x1cf25d[_0x3b7a1e[_0xaa6f('0x26')]]={'$like':'%'+_0x1a086e['query']['filter']+'%'};return _0x1cf25d;}})});}_0x57be7b=_['merge']({},_0x57be7b,_0x1a086e[_0xaa6f('0x3b')]);var _0x15c3a0={'where':_0x57be7b['where']};return db[_0xaa6f('0x29')]['count'](_0x15c3a0)[_0xaa6f('0x25')](function(_0x431d65){_0x2cac50[_0xaa6f('0x1e')]=_0x431d65;if(_0x1a086e[_0xaa6f('0x2f')]['includeAll']){_0x57be7b[_0xaa6f('0x3c')]=[{'all':!![]}];}return db[_0xaa6f('0x29')][_0xaa6f('0x3d')](_0x57be7b);})[_0xaa6f('0x25')](function(_0x4bd2b1){_0x2cac50[_0xaa6f('0x3e')]=_0x4bd2b1;return _0x2cac50;})[_0xaa6f('0x25')](respondWithFilteredResult(_0x3e1256,_0x57be7b))['catch'](handleError(_0x3e1256,null));};exports[_0xaa6f('0x3f')]=function(_0x32a623,_0x359fb6){var _0x5e7cf6={'raw':![],'where':{'id':_0x32a623[_0xaa6f('0x40')]['id']}},_0x3377b1={};_0x3377b1['model']=_[_0xaa6f('0x41')](db[_0xaa6f('0x29')]['rawAttributes']);_0x3377b1[_0xaa6f('0x2f')]=_[_0xaa6f('0x41')](_0x32a623[_0xaa6f('0x2f')]);_0x3377b1[_0xaa6f('0x38')]=_[_0xaa6f('0x30')](_0x3377b1['model'],_0x3377b1[_0xaa6f('0x2f')]);_0x5e7cf6[_0xaa6f('0x32')]=_[_0xaa6f('0x30')](_0x3377b1[_0xaa6f('0x31')],qs[_0xaa6f('0x33')](_0x32a623[_0xaa6f('0x2f')]['fields']));_0x5e7cf6[_0xaa6f('0x32')]=_0x5e7cf6['attributes'][_0xaa6f('0x34')]?_0x5e7cf6[_0xaa6f('0x32')]:_0x3377b1[_0xaa6f('0x31')];if(_0x32a623[_0xaa6f('0x2f')][_0xaa6f('0x42')]){_0x5e7cf6[_0xaa6f('0x3c')]=[{'all':!![]}];}_0x5e7cf6=_[_0xaa6f('0x3a')]({},_0x5e7cf6,_0x32a623['options']);return db[_0xaa6f('0x29')]['find'](_0x5e7cf6)['then'](handleEntityNotFound(_0x359fb6,null))[_0xaa6f('0x25')](respondWithResult(_0x359fb6,null))[_0xaa6f('0x43')](handleError(_0x359fb6,null));};exports[_0xaa6f('0x44')]=function(_0x345eea,_0x1e4c25){return db[_0xaa6f('0x29')][_0xaa6f('0x44')](_0x345eea[_0xaa6f('0x45')],{})[_0xaa6f('0x25')](respondWithResult(_0x1e4c25,0xc9))['catch'](handleError(_0x1e4c25,null));};exports[_0xaa6f('0x24')]=function(_0x223eff,_0x4faf2c){if(_0x223eff[_0xaa6f('0x45')]['id']){delete _0x223eff[_0xaa6f('0x45')]['id'];}return db['VoiceRecording'][_0xaa6f('0x46')]({'where':{'id':_0x223eff[_0xaa6f('0x40')]['id']}})[_0xaa6f('0x25')](handleEntityNotFound(_0x4faf2c,null))[_0xaa6f('0x25')](saveUpdates(_0x223eff['body'],null))[_0xaa6f('0x25')](respondWithResult(_0x4faf2c,null))[_0xaa6f('0x43')](handleError(_0x4faf2c,null));};exports[_0xaa6f('0x47')]=function(_0xe78da4,_0x1741dd){return db['VoiceRecording']['describe']()[_0xaa6f('0x25')](respondWithResult(_0x1741dd,null))[_0xaa6f('0x43')](handleError(_0x1741dd,null));};exports[_0xaa6f('0x48')]=function(_0x26ce9e,_0x3e9314,_0xfac307){var _0x291f69=require('../../components/encryptor');var _0x33342a=![];var _0x4bf2e9={};if(_0x26ce9e[_0xaa6f('0x2f')]['type']&&_0x26ce9e[_0xaa6f('0x2f')][_0xaa6f('0x2c')]==='uniqueid'){_0x4bf2e9[_0xaa6f('0x49')]=_0x26ce9e['params']['id'];}else{_0x4bf2e9['id']=_0x26ce9e['params']['id'];}return db['VoiceRecording'][_0xaa6f('0x46')]({'where':_0x4bf2e9,'attributes':['id','value'],'raw':!![]})[_0xaa6f('0x25')](handleEntityNotFound(_0x3e9314,null))[_0xaa6f('0x25')](function(_0x4db7f7){if(_0x4db7f7){var _0x2346e2=_0x4db7f7[_0xaa6f('0x4a')];var _0x5eb1f4=util[_0xaa6f('0x2e')]('%s.cypher',_0x2346e2);if(fs[_0xaa6f('0x4b')](_0x5eb1f4)){_0x33342a=!![];return _0x291f69[_0xaa6f('0x4c')](_0x5eb1f4,_0x2346e2,config[_0xaa6f('0x4d')][_0xaa6f('0x4e')])[_0xaa6f('0x25')](function(){return _0x4db7f7;});}return _0x4db7f7;}})[_0xaa6f('0x25')](function(_0x145bc4){if(_0x145bc4){var _0x5eb1ad=_0x145bc4[_0xaa6f('0x4a')];if(!fs[_0xaa6f('0x4b')](_0x5eb1ad)){throw new db[(_0xaa6f('0x4f'))]['ValidationError']('VoiceRecording\x20not\x20found');}if(_0x145bc4[_0xaa6f('0x50')]){return _0x3e9314[_0xaa6f('0x48')](_0x5eb1ad,_0x145bc4[_0xaa6f('0x50')]+path[_0xaa6f('0x51')](_0x5eb1ad),function(){if(_0x33342a){fs[_0xaa6f('0x52')](_0x5eb1ad);}});}else{return _0x3e9314[_0xaa6f('0x48')](_0x5eb1ad,function(_0x58eef9){if(_0x33342a){fs[_0xaa6f('0x52')](_0x5eb1ad);}});}}})[_0xaa6f('0x43')](function(_0x2e97d3){if(_0x2e97d3[_0xaa6f('0x53')]==='VoiceRecording\x20not\x20found'){_0x3e9314[_0xaa6f('0x1b')](0x194)[_0xaa6f('0x27')](_0xaa6f('0x54'));}else{return handleError(_0x3e9314,null);}});};exports['downloads']=function(_0x506ea5,_0x4146f1,_0x320b44){var _0x7de9a7=require(_0xaa6f('0x55'));var _0x5d7110=![];var _0x415bcd={'$and':[db[_0xaa6f('0x56')]['where'](db[_0xaa6f('0x56')]['fn'](_0xaa6f('0x57'),db[_0xaa6f('0x56')][_0xaa6f('0x58')](_0xaa6f('0x49'))),_0x506ea5[_0xaa6f('0x2f')][_0xaa6f('0x59')])]};if(_0x506ea5[_0xaa6f('0x2f')][_0xaa6f('0x2c')]&&_0x506ea5[_0xaa6f('0x2f')][_0xaa6f('0x2c')]===_0xaa6f('0x49')){_0x415bcd[_0xaa6f('0x5a')][_0xaa6f('0x5b')]({'uniqueid':_0x506ea5[_0xaa6f('0x40')]['id']});}else{_0x415bcd['$and']['push']({'id':_0x506ea5[_0xaa6f('0x40')]['id']});}return db[_0xaa6f('0x29')][_0xaa6f('0x46')]({'where':_0x415bcd,'attributes':['id',_0xaa6f('0x4a')],'raw':!![]})['then'](handleEntityNotFound(_0x4146f1,null))[_0xaa6f('0x25')](function(_0x9971ae){if(_0x9971ae){var _0x5a2b2d=util[_0xaa6f('0x2e')](_0xaa6f('0x5c'),_0x9971ae[_0xaa6f('0x4a')]);if(fs['existsSync'](_0x5a2b2d)){_0x5d7110=!![];return _0x7de9a7[_0xaa6f('0x4c')](_0x5a2b2d,_0x9971ae[_0xaa6f('0x4a')],config['secrets'][_0xaa6f('0x4e')])['then'](function(){return _0x9971ae;});}return _0x9971ae;}})[_0xaa6f('0x25')](function(_0x595cbf){if(_0x595cbf){if(!fs['existsSync'](_0x595cbf[_0xaa6f('0x4a')])){throw new db[(_0xaa6f('0x4f'))][(_0xaa6f('0x5d'))]('VoiceRecording\x20not\x20found');}if(_0x595cbf['filename']){return _0x4146f1['download'](_0x595cbf[_0xaa6f('0x4a')],_0x595cbf[_0xaa6f('0x50')]+path[_0xaa6f('0x51')](_0x595cbf['value']),function(){if(_0x5d7110){fs[_0xaa6f('0x52')](_0x595cbf['value']);}});}else{return _0x4146f1[_0xaa6f('0x48')](_0x595cbf['value'],function(_0x15a553){if(_0x5d7110){fs[_0xaa6f('0x52')](_0x595cbf[_0xaa6f('0x4a')]);}});}}})[_0xaa6f('0x43')](handleError(_0x4146f1,null));};exports[_0xaa6f('0x5e')]=function(_0x764932,_0x252368){return db[_0xaa6f('0x29')]['find']({'where':{'id':_0x764932[_0xaa6f('0x40')]['id']}})[_0xaa6f('0x25')](function(_0x44ff2f){if(!_0x44ff2f)throw new ReferenceError(_0xaa6f('0x5f'));return _0x44ff2f;})['then'](function(_0x34fef0){var _0x4ba862=_0x34fef0[_0xaa6f('0x4a')];logger[_0xaa6f('0x60')](_0xaa6f('0x61'),_0x4ba862);if(!_[_0xaa6f('0x62')](_0x34fef0[_0xaa6f('0x4a')])&&fs[_0xaa6f('0x4b')](_0x4ba862)){logger[_0xaa6f('0x60')](_0xaa6f('0x63')+_0x4ba862+_0xaa6f('0x64'));fs['unlinkSync'](_0x4ba862);}_0x4ba862=_0x4ba862+'.cypher';if(!_['isNil'](_0x34fef0[_0xaa6f('0x4a')])&&fs['existsSync'](_0x4ba862)){logger[_0xaa6f('0x60')](_0xaa6f('0x63')+_0x4ba862+_0xaa6f('0x64'));fs['unlinkSync'](_0x4ba862);}return _0x34fef0;})[_0xaa6f('0x25')](function(_0x20d13d){if(!_0x20d13d)throw new InternalError();return _0x20d13d['destroy']();})['then'](function(){_0x252368[_0xaa6f('0x1b')](0xcc)[_0xaa6f('0x1c')]();})[_0xaa6f('0x43')](handleError(_0x252368,null));};function getBucketslist(_0x899fe,_0x4ca7e3,_0x35c713){return new Promise(function(_0x23b87d,_0x31eed5){var _0x4f3b13=new AWS['S3']({'accessKeyId':_0x4ca7e3,'secretAccessKey':_0x899fe,'region':_0x35c713});_0x4f3b13[_0xaa6f('0x65')]({},function(_0x180fbd,_0x2d7744){if(_0x180fbd){return _0x31eed5(_0x180fbd);}else{return _0x23b87d(_0x2d7744);}});});}function createBucket(_0x3da514,_0x4ee11c,_0x2f189b,_0x1efd46){return new Promise(function(_0x28d50b,_0x5282e9){var _0x2d4953=new AWS['S3']({'accessKeyId':_0x4ee11c,'secretAccessKey':_0x3da514,'region':_0x2f189b});_0x2d4953[_0xaa6f('0x66')]({'Bucket':_0x1efd46},function(_0xdac513,_0x549d09){if(_0xdac513){return _0x5282e9(_0xdac513);}else{return _0x28d50b(_0x549d09);}});});}function uploadFile(_0x191001,_0x8e3387,_0x36be51,_0x4ebc52,_0x29fd05,_0xecb541){return new Promise(function(_0xf613b,_0x58810f){var _0x32b2da=new AWS['S3']({'accessKeyId':_0x8e3387,'secretAccessKey':_0x191001,'region':_0x36be51});_0x32b2da[_0xaa6f('0x67')]({'Bucket':_0x4ebc52,'Key':_0x29fd05,'Body':_0xecb541},function(_0x3ffac4,_0x435255){if(_0x3ffac4){return _0x58810f(_0x3ffac4);}else{return _0xf613b(_0x435255);}});});}function startTranscribe(_0x48ebdd,_0x107c82,_0x14edc7,_0x66cfb4,_0x2c5b76,_0x50f014){return new Promise(function(_0x17faee,_0x5050e5){var _0x76b31d=new AWS[(_0xaa6f('0x68'))]({'accessKeyId':_0x107c82,'secretAccessKey':_0x48ebdd,'region':_0x14edc7});_0x76b31d[_0xaa6f('0x69')]({'TranscriptionJobName':_0x66cfb4,'LanguageCode':_0x2c5b76,'Media':{'MediaFileUri':_0x50f014}},function(_0x356923,_0x4d8ee2){if(_0x356923){return _0x5050e5(_0x356923);}else{return _0x17faee(_0x4d8ee2);}});});}function transcribe(_0x337329,_0x595a7a,_0x40c0cd,_0x554c15,_0x4fa7b7,_0x30b874,_0x4a93de){return new Promise(function(_0x26a99a,_0x2d9fae){var _0x40d0eb={};logger[_0xaa6f('0x60')](util[_0xaa6f('0x2e')](_0xaa6f('0x6a'),_0x337329,_0x4fa7b7));return uploadFile(_0x595a7a,_0x40c0cd,_0x554c15,_0x4fa7b7,path['basename'](_0x30b874),fs[_0xaa6f('0x6b')](_0x30b874))['then'](function(_0x1b9a1e){logger[_0xaa6f('0x60')](util[_0xaa6f('0x2e')](_0xaa6f('0x6c'),_0x337329,_0x4fa7b7,_0x1b9a1e[_0xaa6f('0x6d')]));_0x40d0eb['bucket']=_0x1b9a1e[_0xaa6f('0x6e')];_0x40d0eb[_0xaa6f('0x6f')]=_0x1b9a1e[_0xaa6f('0x6d')];logger[_0xaa6f('0x60')](util[_0xaa6f('0x2e')](_0xaa6f('0x70'),_0x337329));return startTranscribe(_0x595a7a,_0x40c0cd,_0x554c15,uuidv4(),_0x4a93de,_0x1b9a1e[_0xaa6f('0x6d')]);})[_0xaa6f('0x25')](function(_0x58898e){logger[_0xaa6f('0x60')](util[_0xaa6f('0x2e')](_0xaa6f('0x71'),_0x337329,_0x58898e[_0xaa6f('0x72')][_0xaa6f('0x73')]));_0x40d0eb[_0xaa6f('0x74')]=_0x58898e[_0xaa6f('0x72')][_0xaa6f('0x73')];_0x40d0eb[_0xaa6f('0x75')]=_0x58898e[_0xaa6f('0x72')][_0xaa6f('0x76')];return _0x26a99a(_0x40d0eb);})['catch'](function(_0x410fa6){return _0x2d9fae(_0x410fa6);});});}exports[_0xaa6f('0x77')]=function(_0xcfcf41,_0x195409,_0x1a8dcc){var _0x280864;var _0x4fa285;var _0x44a7cd;var _0x5882df=require(_0xaa6f('0x55'));return db['VoiceRecording'][_0xaa6f('0x78')]({'where':{'id':_0xcfcf41[_0xaa6f('0x40')]['id']}})[_0xaa6f('0x25')](function(_0x17f783){if(_0x17f783){var _0x779e2f=util[_0xaa6f('0x2e')](_0xaa6f('0x5c'),_0x17f783[_0xaa6f('0x4a')]);if(fs['existsSync'](_0x779e2f)){cypher=!![];return _0x5882df[_0xaa6f('0x4c')](_0x779e2f,_0x17f783['value'],config['secrets'][_0xaa6f('0x4e')])[_0xaa6f('0x25')](function(){return _0x17f783;});}return _0x17f783;}})['then'](function(_0x1c3fdf){if(!_0x1c3fdf){throw new db[(_0xaa6f('0x4f'))]['ValidationError'](_0xaa6f('0x79'));}_0x4fa285=_0x1c3fdf;return db[_0xaa6f('0x7a')]['findOne']({'where':{'id':0x1}});})[_0xaa6f('0x25')](handleEntityNotFound(_0x195409,null))['then'](function(_0x3bd3b2){if(_0x3bd3b2){_0x280864=_0x3bd3b2;if(!_0x280864[_0xaa6f('0x7b')]||!_0x280864['transcribeAccountId']||!_0x280864[_0xaa6f('0x7c')]||!_0x280864['language']||!_0x280864[_0xaa6f('0x7d')]){throw new db[(_0xaa6f('0x4f'))][(_0xaa6f('0x5d'))]('Transcribe\x20not\x20configured');}if(_0xcfcf41[_0xaa6f('0x45')][_0xaa6f('0x7e')]&&(!_0x280864[_0xaa6f('0x7f')]||!_0x280864[_0xaa6f('0x80')]||!_0x280864['sentimentRegion']||!_0x280864[_0xaa6f('0x81')]||!_0x280864['bucket'])){throw new db[(_0xaa6f('0x4f'))][(_0xaa6f('0x5d'))](_0xaa6f('0x82'));}return db['CloudProvider'][_0xaa6f('0x78')]({'where':{'id':_0x280864['transcribeAccountId']}});}})[_0xaa6f('0x25')](function(_0x342eab){if(!_0x342eab){throw new db['Sequelize']['ValidationError'](_0xaa6f('0x83'));}if(!_0x342eab['data1']||!_0x342eab[_0xaa6f('0x84')]){throw new db[(_0xaa6f('0x4f'))][(_0xaa6f('0x5d'))](_0xaa6f('0x85'));}_0x44a7cd=_0x342eab;return getBucketslist(_0x44a7cd[_0xaa6f('0x86')],_0x44a7cd['data2'],_0x280864[_0xaa6f('0x7c')]);})['then'](function(_0x52949d){if(_0x52949d&&_0x52949d[_0xaa6f('0x87')]){var _0x2391d6=_[_0xaa6f('0x46')](_0x52949d['Buckets'],function(_0x405f37){return _0x405f37[_0xaa6f('0x88')]===_0x280864[_0xaa6f('0x7d')];});if(!_0x2391d6){logger['info'](util[_0xaa6f('0x2e')](_0xaa6f('0x89'),_0xcfcf41[_0xaa6f('0x40')]['id'],_0x280864[_0xaa6f('0x7d')]));return createBucket(_0x44a7cd[_0xaa6f('0x86')],_0x44a7cd[_0xaa6f('0x84')],_0x280864[_0xaa6f('0x7c')],_0x280864['bucket']);}logger[_0xaa6f('0x60')](util[_0xaa6f('0x2e')](_0xaa6f('0x8a'),_0xcfcf41[_0xaa6f('0x40')]['id'],_0x280864[_0xaa6f('0x7d')]));return;}})[_0xaa6f('0x25')](function(_0x453594){if(_0x4fa285['transcribeStatus']===_0xaa6f('0x8b')){return transcribe(_0xcfcf41[_0xaa6f('0x40')]['id'],_0x44a7cd[_0xaa6f('0x86')],_0x44a7cd[_0xaa6f('0x84')],_0x280864[_0xaa6f('0x7c')],_0x280864[_0xaa6f('0x7d')],_0x4fa285[_0xaa6f('0x4a')],_0x280864[_0xaa6f('0x81')]);}else{logger[_0xaa6f('0x60')](util[_0xaa6f('0x2e')](_0xaa6f('0x8c'),_0xcfcf41[_0xaa6f('0x40')]['id']));return{'transcribeStatus':_0xaa6f('0x8d')};}})[_0xaa6f('0x25')](function(_0x513e60){if(_0x513e60){_0x513e60[_0xaa6f('0x8e')]=_0xcfcf41[_0xaa6f('0x45')][_0xaa6f('0x7e')];return _0x4fa285[_0xaa6f('0x8f')](_0x513e60);}})[_0xaa6f('0x25')](respondWithResult(_0x195409,null))[_0xaa6f('0x43')](handleError(_0x195409,null));};function writeFile(_0x376adb,_0x3674b3){return new Promise(function(_0x472f9d,_0x296d4){fs[_0xaa6f('0x90')](_0x3674b3,_0x376adb,function(_0x427ae0,_0x114bf1){if(_0x427ae0){return _0x296d4(_0x427ae0);}else{return _0x472f9d(_0x114bf1);}});});}exports[_0xaa6f('0x91')]=function(_0x27b2ff,_0x25246e,_0x49f497){return db[_0xaa6f('0x29')][_0xaa6f('0x78')]({'where':{'id':_0x27b2ff[_0xaa6f('0x40')]['id']}})['then'](handleEntityNotFound(_0x25246e))[_0xaa6f('0x25')](function(_0x459f87){if(_0x459f87&&_0x459f87[_0xaa6f('0x92')]){var _0x4d066b=_0x459f87[_0xaa6f('0x92')];var _0x43856d=config[_0xaa6f('0x93')]+_0xaa6f('0x94')+_0x459f87['id']+'.txt';if(fs['existsSync'](_0x43856d)){return _0x43856d;}return writeFile(_0x4d066b,_0x43856d)['then'](function(){return _0x43856d;});}else{throw new db[(_0xaa6f('0x4f'))][(_0xaa6f('0x5d'))]('Transcript\x20not\x20available');}})[_0xaa6f('0x25')](function(_0x14295b){return _0x25246e['download'](_0x14295b);})[_0xaa6f('0x43')](handleError(_0x25246e));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index a9d62ec..ac51b3e 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 _0x1ca1=['../../config/environment','./voiceRecording.attributes','exports','define','voice_recordings','uniqueid','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x13fabf,_0x554b3a){var _0x35e697=function(_0x1d160){while(--_0x1d160){_0x13fabf['push'](_0x13fabf['shift']());}};_0x35e697(++_0x554b3a);}(_0x1ca1,0x14b));var _0x11ca=function(_0x386f13,_0x33d758){_0x386f13=_0x386f13-0x0;var _0x3008ee=_0x1ca1[_0x386f13];return _0x3008ee;};'use strict';var _=require('lodash');var util=require(_0x11ca('0x0'));var logger=require(_0x11ca('0x1'))(_0x11ca('0x2'));var moment=require(_0x11ca('0x3'));var BPromise=require(_0x11ca('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x11ca('0x5'));var rimraf=require(_0x11ca('0x6'));var config=require(_0x11ca('0x7'));var attributes=require(_0x11ca('0x8'));module[_0x11ca('0x9')]=function(_0x3c5660,_0x300661){return _0x3c5660[_0x11ca('0xa')]('VoiceRecording',attributes,{'tableName':_0x11ca('0xb'),'paranoid':![],'indexes':[{'name':_0x11ca('0xc'),'fields':[_0x11ca('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xce40=['../../config/environment','./voiceRecording.attributes','define','VoiceRecording','lodash','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x5f3f8,_0xde33f8){var _0x5c57bc=function(_0x477681){while(--_0x477681){_0x5f3f8['push'](_0x5f3f8['shift']());}};_0x5c57bc(++_0xde33f8);}(_0xce40,0x1d8));var _0x0ce4=function(_0x4bd06e,_0x593701){_0x4bd06e=_0x4bd06e-0x0;var _0x85ebb=_0xce40[_0x4bd06e];return _0x85ebb;};'use strict';var _=require(_0x0ce4('0x0'));var util=require(_0x0ce4('0x1'));var logger=require('../../config/logger')(_0x0ce4('0x2'));var moment=require(_0x0ce4('0x3'));var BPromise=require(_0x0ce4('0x4'));var rp=require(_0x0ce4('0x5'));var fs=require('fs');var path=require(_0x0ce4('0x6'));var rimraf=require(_0x0ce4('0x7'));var config=require(_0x0ce4('0x8'));var attributes=require(_0x0ce4('0x9'));module['exports']=function(_0x168279,_0x2e58fe){return _0x168279[_0x0ce4('0xa')](_0x0ce4('0xb'),attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index 450f8d1..1a58076 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(_0x43b5a7,_0xf5e3d6){var _0x5461fe=function(_0x5d9d5a){while(--_0x5d9d5a){_0x43b5a7['push'](_0x43b5a7['shift']());}};_0x5461fe(++_0xf5e3d6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0xa9e0[_0x18a79d];return _0x4f8848;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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(_0x3ca012,_0x4cff79){var _0x1a8b78=function(_0x320cfd){while(--_0x320cfd){_0x3ca012['push'](_0x3ca012['shift']());}};_0x1a8b78(++_0x4cff79);}(_0xa9e0,0x123));var _0x0a9e=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0xa9e0[_0x387777];return _0x3f84c0;};'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 a0f4188..492b20e 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 _0xb4c7=['create','put','isAuthenticated','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','index','/:id','show','post'];(function(_0x30cd67,_0x20f84e){var _0x3bb0a4=function(_0x680771){while(--_0x680771){_0x30cd67['push'](_0x30cd67['shift']());}};_0x3bb0a4(++_0x20f84e);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x5cb6bd,_0x542d5d){_0x5cb6bd=_0x5cb6bd-0x0;var _0x3d4281=_0xb4c7[_0x5cb6bd];return _0x3d4281;};'use strict';var multer=require(_0x7b4c('0x0'));var util=require(_0x7b4c('0x1'));var path=require(_0x7b4c('0x2'));var timeout=require(_0x7b4c('0x3'));var express=require(_0x7b4c('0x4'));var router=express['Router']();var auth=require(_0x7b4c('0x5'));var interaction=require(_0x7b4c('0x6'));var config=require(_0x7b4c('0x7'));var controller=require(_0x7b4c('0x8'));router[_0x7b4c('0x9')]('/',auth['isAuthenticated'](),controller[_0x7b4c('0xa')]);router[_0x7b4c('0x9')](_0x7b4c('0xb'),auth['isAuthenticated'](),controller[_0x7b4c('0xc')]);router[_0x7b4c('0xd')]('/',auth['isAuthenticated'](),controller[_0x7b4c('0xe')]);router[_0x7b4c('0xf')](_0x7b4c('0xb'),auth[_0x7b4c('0x10')](),controller[_0x7b4c('0x11')]);router[_0x7b4c('0x12')](_0x7b4c('0xb'),auth[_0x7b4c('0x10')](),controller[_0x7b4c('0x13')]);module[_0x7b4c('0x14')]=router; \ No newline at end of file +var _0x524e=['/:id','post','create','put','update','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated'];(function(_0x37b4eb,_0xa4b873){var _0x402332=function(_0x220e1a){while(--_0x220e1a){_0x37b4eb['push'](_0x37b4eb['shift']());}};_0x402332(++_0xa4b873);}(_0x524e,0x15e));var _0xe524=function(_0x17fd94,_0x5520ea){_0x17fd94=_0x17fd94-0x0;var _0x5b0a75=_0x524e[_0x17fd94];return _0x5b0a75;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe524('0x0'));var timeout=require(_0xe524('0x1'));var express=require(_0xe524('0x2'));var router=express[_0xe524('0x3')]();var auth=require(_0xe524('0x4'));var interaction=require(_0xe524('0x5'));var config=require(_0xe524('0x6'));var controller=require(_0xe524('0x7'));router[_0xe524('0x8')]('/',auth[_0xe524('0x9')](),controller['index']);router[_0xe524('0x8')](_0xe524('0xa'),auth[_0xe524('0x9')](),controller['show']);router[_0xe524('0xb')]('/',auth[_0xe524('0x9')](),controller[_0xe524('0xc')]);router[_0xe524('0xd')](_0xe524('0xa'),auth[_0xe524('0x9')](),controller[_0xe524('0xe')]);router[_0xe524('0xf')](_0xe524('0xa'),auth[_0xe524('0x9')](),controller[_0xe524('0x10')]);module[_0xe524('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index cb6b839..38a39b8 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 _0x320e=['STRING','Yes','moment','ENUM','blind'];(function(_0x3cad22,_0x3f8ef){var _0xb8250f=function(_0x47c80c){while(--_0x47c80c){_0x3cad22['push'](_0x3cad22['shift']());}};_0xb8250f(++_0x3f8ef);}(_0x320e,0xc5));var _0xe320=function(_0x151334,_0x1e11ac){_0x151334=_0x151334-0x0;var _0x3d03da=_0x320e[_0x151334];return _0x3d03da;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xe320('0x0'));module['exports']={'type':{'type':Sequelize[_0xe320('0x1')](_0xe320('0x2'),'attended')},'result':{'type':Sequelize[_0xe320('0x3')]},'transfererchannel':{'type':Sequelize[_0xe320('0x3')]},'transferercalleridnum':{'type':Sequelize[_0xe320('0x3')]},'transferercalleridname':{'type':Sequelize[_0xe320('0x3')]},'transfererconnectedlinenum':{'type':Sequelize['STRING']},'transfererconnectedlinename':{'type':Sequelize['STRING']},'transfereraccountcode':{'type':Sequelize['STRING']},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize[_0xe320('0x3')]},'transfererlinkedid':{'type':Sequelize[_0xe320('0x3')]},'transfereechannel':{'type':Sequelize['STRING']},'transfereecalleridnum':{'type':Sequelize[_0xe320('0x3')]},'transfereecalleridname':{'type':Sequelize[_0xe320('0x3')]},'transfereeconnectedlinenum':{'type':Sequelize[_0xe320('0x3')]},'transfereeconnectedlinename':{'type':Sequelize[_0xe320('0x3')]},'transfereeaccountcode':{'type':Sequelize[_0xe320('0x3')]},'transfereecontext':{'type':Sequelize[_0xe320('0x3')]},'transfereeexten':{'type':Sequelize[_0xe320('0x3')]},'transfereelinkedid':{'type':Sequelize[_0xe320('0x3')]},'isexternal':{'type':Sequelize[_0xe320('0x1')](_0xe320('0x4'),'No')},'context':{'type':Sequelize[_0xe320('0x3')]},'extension':{'type':Sequelize[_0xe320('0x3')]}}; \ No newline at end of file +var _0x37c4=['Yes','sequelize','moment','exports','blind','STRING','ENUM'];(function(_0x43fd31,_0x46a676){var _0x4d8212=function(_0xafc86b){while(--_0xafc86b){_0x43fd31['push'](_0x43fd31['shift']());}};_0x4d8212(++_0x46a676);}(_0x37c4,0xb7));var _0x437c=function(_0x2adeec,_0x3b002c){_0x2adeec=_0x2adeec-0x0;var _0x58b3d8=_0x37c4[_0x2adeec];return _0x58b3d8;};'use strict';var Sequelize=require(_0x437c('0x0'));var moment=require(_0x437c('0x1'));module[_0x437c('0x2')]={'type':{'type':Sequelize['ENUM'](_0x437c('0x3'),'attended')},'result':{'type':Sequelize[_0x437c('0x4')]},'transfererchannel':{'type':Sequelize[_0x437c('0x4')]},'transferercalleridnum':{'type':Sequelize['STRING']},'transferercalleridname':{'type':Sequelize[_0x437c('0x4')]},'transfererconnectedlinenum':{'type':Sequelize['STRING']},'transfererconnectedlinename':{'type':Sequelize[_0x437c('0x4')]},'transfereraccountcode':{'type':Sequelize[_0x437c('0x4')]},'transferercontext':{'type':Sequelize[_0x437c('0x4')]},'transfererexten':{'type':Sequelize[_0x437c('0x4')]},'transfererlinkedid':{'type':Sequelize[_0x437c('0x4')]},'transfereechannel':{'type':Sequelize[_0x437c('0x4')]},'transfereecalleridnum':{'type':Sequelize[_0x437c('0x4')]},'transfereecalleridname':{'type':Sequelize[_0x437c('0x4')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x437c('0x4')]},'transfereeconnectedlinename':{'type':Sequelize[_0x437c('0x4')]},'transfereeaccountcode':{'type':Sequelize[_0x437c('0x4')]},'transfereecontext':{'type':Sequelize[_0x437c('0x4')]},'transfereeexten':{'type':Sequelize[_0x437c('0x4')]},'transfereelinkedid':{'type':Sequelize[_0x437c('0x4')]},'isexternal':{'type':Sequelize[_0x437c('0x5')](_0x437c('0x6'),'No')},'context':{'type':Sequelize[_0x437c('0x4')]},'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 0855bc1..b85d3ff 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 _0x1d29=['end','json','count','offset','limit','set','Content-Range','reject','save','update','then','error','name','index','map','VoiceTransferReport','fieldName','type','model','query','attributes','intersection','fields','hasOwnProperty','nolimit','order','filters','pick','filter','merge','where','includeAll','include','findAll','rows','params','rawAttributes','keys','length','options','find','catch','create','body','destroy','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status'];(function(_0x29b1d1,_0x5f1982){var _0x1868bd=function(_0x2ac50b){while(--_0x2ac50b){_0x29b1d1['push'](_0x29b1d1['shift']());}};_0x1868bd(++_0x5f1982);}(_0x1d29,0x10b));var _0x91d2=function(_0xf1ceb4,_0x3443e6){_0xf1ceb4=_0xf1ceb4-0x0;var _0x42ed45=_0x1d29[_0xf1ceb4];return _0x42ed45;};'use strict';var pdf=require(_0x91d2('0x0'));var emlformat=require(_0x91d2('0x1'));var rimraf=require(_0x91d2('0x2'));var zipdir=require(_0x91d2('0x3'));var jsonpatch=require(_0x91d2('0x4'));var rp=require(_0x91d2('0x5'));var moment=require(_0x91d2('0x6'));var BPromise=require(_0x91d2('0x7'));var Mustache=require(_0x91d2('0x8'));var util=require(_0x91d2('0x9'));var path=require(_0x91d2('0xa'));var sox=require('sox');var csv=require(_0x91d2('0xb'));var ejs=require(_0x91d2('0xc'));var fs=require('fs');var _=require(_0x91d2('0xd'));var squel=require(_0x91d2('0xe'));var crypto=require(_0x91d2('0xf'));var jsforce=require(_0x91d2('0x10'));var deskjs=require(_0x91d2('0x11'));var toCsv=require(_0x91d2('0xb'));var querystring=require(_0x91d2('0x12'));var Papa=require(_0x91d2('0x13'));var Redis=require(_0x91d2('0x14'));var authService=require('../../components/auth/service');var qs=require(_0x91d2('0x15'));var as=require(_0x91d2('0x16'));var hardwareService=require(_0x91d2('0x17'));var logger=require('../../config/logger')(_0x91d2('0x18'));var utils=require(_0x91d2('0x19'));var config=require('../../config/environment');var db=require(_0x91d2('0x1a'))['db'];function respondWithStatusCode(_0x5a5b01,_0x3ae9b9){_0x3ae9b9=_0x3ae9b9||0xcc;return function(_0x36173f){if(_0x36173f){return _0x5a5b01[_0x91d2('0x1b')](_0x3ae9b9);}return _0x5a5b01[_0x91d2('0x1c')](_0x3ae9b9)[_0x91d2('0x1d')]();};}function respondWithResult(_0x4e0561,_0x3f18eb){_0x3f18eb=_0x3f18eb||0xc8;return function(_0x75dded){if(_0x75dded){return _0x4e0561['status'](_0x3f18eb)[_0x91d2('0x1e')](_0x75dded);}};}function respondWithFilteredResult(_0x34efce,_0x1acf88){return function(_0x1152e1){if(_0x1152e1){var _0x35265b=_0x1152e1[_0x91d2('0x1f')],_0x2e1d95=_0x1acf88[_0x91d2('0x20')],_0x5ea4c0=_0x1acf88[_0x91d2('0x20')]+_0x1acf88[_0x91d2('0x21')],_0x24a62b;if(_0x5ea4c0>=_0x35265b){_0x5ea4c0=_0x35265b;_0x24a62b=0xc8;}else{_0x24a62b=0xce;}_0x34efce[_0x91d2('0x1c')](_0x24a62b);return _0x34efce[_0x91d2('0x22')](_0x91d2('0x23'),_0x2e1d95+'-'+_0x5ea4c0+'/'+_0x35265b)[_0x91d2('0x1e')](_0x1152e1);}return null;};}function patchUpdates(_0x40c30e){return function(_0x983109){try{jsonpatch['apply'](_0x983109,_0x40c30e,!![]);}catch(_0x1c29eb){return BPromise[_0x91d2('0x24')](_0x1c29eb);}return _0x983109[_0x91d2('0x25')]();};}function saveUpdates(_0xc1bbbb,_0x203743){return function(_0x333d54){if(_0x333d54){return _0x333d54[_0x91d2('0x26')](_0xc1bbbb)[_0x91d2('0x27')](function(_0x515889){return _0x515889;});}return null;};}function removeEntity(_0x440fbe,_0x2b9dfc){return function(_0x502d69){if(_0x502d69){return _0x502d69['destroy']()[_0x91d2('0x27')](function(){_0x440fbe[_0x91d2('0x1c')](0xcc)[_0x91d2('0x1d')]();});}};}function handleEntityNotFound(_0x1249dc,_0x48a785){return function(_0x9d8ae9){if(!_0x9d8ae9){_0x1249dc[_0x91d2('0x1b')](0x194);}return _0x9d8ae9;};}function handleError(_0x1f8e41,_0x3db434){_0x3db434=_0x3db434||0x1f4;return function(_0x3ac482){logger[_0x91d2('0x28')](_0x3ac482['stack']);if(_0x3ac482[_0x91d2('0x29')]){delete _0x3ac482[_0x91d2('0x29')];}_0x1f8e41['status'](_0x3db434)['send'](_0x3ac482);};}exports[_0x91d2('0x2a')]=function(_0x36e63a,_0x5a44ea){var _0x2dcdfb={},_0x2fe6bd={},_0x56cfc3={'count':0x0,'rows':[]};var _0x5749ae=_[_0x91d2('0x2b')](db[_0x91d2('0x2c')]['rawAttributes'],function(_0x1c7e96){return{'name':_0x1c7e96[_0x91d2('0x2d')],'type':_0x1c7e96[_0x91d2('0x2e')]['key']};});_0x2fe6bd[_0x91d2('0x2f')]=_['map'](_0x5749ae,_0x91d2('0x29'));_0x2fe6bd['query']=_['keys'](_0x36e63a[_0x91d2('0x30')]);_0x2fe6bd['filters']=_['intersection'](_0x2fe6bd[_0x91d2('0x2f')],_0x2fe6bd[_0x91d2('0x30')]);_0x2dcdfb[_0x91d2('0x31')]=_[_0x91d2('0x32')](_0x2fe6bd[_0x91d2('0x2f')],qs[_0x91d2('0x33')](_0x36e63a['query'][_0x91d2('0x33')]));_0x2dcdfb['attributes']=_0x2dcdfb[_0x91d2('0x31')]['length']?_0x2dcdfb[_0x91d2('0x31')]:_0x2fe6bd[_0x91d2('0x2f')];if(!_0x36e63a['query'][_0x91d2('0x34')](_0x91d2('0x35'))){_0x2dcdfb[_0x91d2('0x21')]=qs['limit'](_0x36e63a[_0x91d2('0x30')][_0x91d2('0x21')]);_0x2dcdfb[_0x91d2('0x20')]=qs['offset'](_0x36e63a[_0x91d2('0x30')][_0x91d2('0x20')]);}_0x2dcdfb[_0x91d2('0x36')]=qs['sort'](_0x36e63a['query']['sort']);_0x2dcdfb['where']=qs[_0x91d2('0x37')](_[_0x91d2('0x38')](_0x36e63a[_0x91d2('0x30')],_0x2fe6bd[_0x91d2('0x37')]),_0x5749ae);if(_0x36e63a[_0x91d2('0x30')][_0x91d2('0x39')]){_0x2dcdfb['where']=_[_0x91d2('0x3a')](_0x2dcdfb['where'],{'$or':_[_0x91d2('0x2b')](_0x5749ae,function(_0x22b0ef){if(_0x22b0ef[_0x91d2('0x2e')]!=='VIRTUAL'){var _0x36c98f={};_0x36c98f[_0x22b0ef[_0x91d2('0x29')]]={'$like':'%'+_0x36e63a[_0x91d2('0x30')]['filter']+'%'};return _0x36c98f;}})});}_0x2dcdfb=_[_0x91d2('0x3a')]({},_0x2dcdfb,_0x36e63a['options']);var _0x40fefb={'where':_0x2dcdfb[_0x91d2('0x3b')]};return db['VoiceTransferReport'][_0x91d2('0x1f')](_0x40fefb)[_0x91d2('0x27')](function(_0x1b0d6d){_0x56cfc3[_0x91d2('0x1f')]=_0x1b0d6d;if(_0x36e63a[_0x91d2('0x30')][_0x91d2('0x3c')]){_0x2dcdfb[_0x91d2('0x3d')]=[{'all':!![]}];}return db[_0x91d2('0x2c')][_0x91d2('0x3e')](_0x2dcdfb);})[_0x91d2('0x27')](function(_0x1a6a16){_0x56cfc3[_0x91d2('0x3f')]=_0x1a6a16;return _0x56cfc3;})[_0x91d2('0x27')](respondWithFilteredResult(_0x5a44ea,_0x2dcdfb))['catch'](handleError(_0x5a44ea,null));};exports['show']=function(_0xf2b7,_0x40896a){var _0x3ff651={'raw':!![],'where':{'id':_0xf2b7[_0x91d2('0x40')]['id']}},_0x1e28c4={};_0x1e28c4['model']=_['keys'](db['VoiceTransferReport'][_0x91d2('0x41')]);_0x1e28c4[_0x91d2('0x30')]=_[_0x91d2('0x42')](_0xf2b7[_0x91d2('0x30')]);_0x1e28c4['filters']=_[_0x91d2('0x32')](_0x1e28c4[_0x91d2('0x2f')],_0x1e28c4[_0x91d2('0x30')]);_0x3ff651[_0x91d2('0x31')]=_[_0x91d2('0x32')](_0x1e28c4['model'],qs[_0x91d2('0x33')](_0xf2b7[_0x91d2('0x30')][_0x91d2('0x33')]));_0x3ff651['attributes']=_0x3ff651[_0x91d2('0x31')][_0x91d2('0x43')]?_0x3ff651['attributes']:_0x1e28c4[_0x91d2('0x2f')];if(_0xf2b7['query']['includeAll']){_0x3ff651[_0x91d2('0x3d')]=[{'all':!![]}];}_0x3ff651=_[_0x91d2('0x3a')]({},_0x3ff651,_0xf2b7[_0x91d2('0x44')]);return db['VoiceTransferReport'][_0x91d2('0x45')](_0x3ff651)['then'](handleEntityNotFound(_0x40896a,null))[_0x91d2('0x27')](respondWithResult(_0x40896a,null))[_0x91d2('0x46')](handleError(_0x40896a,null));};exports[_0x91d2('0x47')]=function(_0x2ac35f,_0x3b96ab){return db[_0x91d2('0x2c')][_0x91d2('0x47')](_0x2ac35f[_0x91d2('0x48')],{})[_0x91d2('0x27')](respondWithResult(_0x3b96ab,0xc9))[_0x91d2('0x46')](handleError(_0x3b96ab,null));};exports[_0x91d2('0x26')]=function(_0x47ca1c,_0x4505b2){if(_0x47ca1c[_0x91d2('0x48')]['id']){delete _0x47ca1c['body']['id'];}return db[_0x91d2('0x2c')][_0x91d2('0x45')]({'where':{'id':_0x47ca1c[_0x91d2('0x40')]['id']}})[_0x91d2('0x27')](handleEntityNotFound(_0x4505b2,null))[_0x91d2('0x27')](saveUpdates(_0x47ca1c[_0x91d2('0x48')],null))[_0x91d2('0x27')](respondWithResult(_0x4505b2,null))[_0x91d2('0x46')](handleError(_0x4505b2,null));};exports[_0x91d2('0x49')]=function(_0x2381a1,_0xec5c0a){return db[_0x91d2('0x2c')][_0x91d2('0x45')]({'where':{'id':_0x2381a1[_0x91d2('0x40')]['id']}})[_0x91d2('0x27')](handleEntityNotFound(_0xec5c0a,null))[_0x91d2('0x27')](removeEntity(_0xec5c0a,null))[_0x91d2('0x46')](handleError(_0xec5c0a,null));}; \ No newline at end of file +var _0xd45e=['error','stack','name','send','index','VoiceTransferReport','rawAttributes','type','query','filters','model','intersection','fields','length','attributes','hasOwnProperty','nolimit','sort','pick','filter','where','merge','map','VIRTUAL','count','includeAll','findAll','rows','catch','show','keys','include','find','create','body','params','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','ejs','lodash','crypto','jsforce','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','sendStatus','status','json','offset','limit','set','reject','save','update','destroy','then','end'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd45e,0xa8));var _0xed45=function(_0x960f23,_0x2afd9f){_0x960f23=_0x960f23-0x0;var _0x34162a=_0xd45e[_0x960f23];return _0x34162a;};'use strict';var pdf=require(_0xed45('0x0'));var emlformat=require(_0xed45('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xed45('0x2'));var jsonpatch=require(_0xed45('0x3'));var rp=require(_0xed45('0x4'));var moment=require('moment');var BPromise=require(_0xed45('0x5'));var Mustache=require(_0xed45('0x6'));var util=require(_0xed45('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xed45('0x8'));var ejs=require(_0xed45('0x9'));var fs=require('fs');var _=require(_0xed45('0xa'));var squel=require('squel');var crypto=require(_0xed45('0xb'));var jsforce=require(_0xed45('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xed45('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xed45('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xed45('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xed45('0xf'));var utils=require(_0xed45('0x10'));var config=require(_0xed45('0x11'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5e6fcd,_0x36fa73){_0x36fa73=_0x36fa73||0xcc;return function(_0xc00327){if(_0xc00327){return _0x5e6fcd[_0xed45('0x12')](_0x36fa73);}return _0x5e6fcd[_0xed45('0x13')](_0x36fa73)['end']();};}function respondWithResult(_0x56d241,_0x1a516e){_0x1a516e=_0x1a516e||0xc8;return function(_0x4c5abc){if(_0x4c5abc){return _0x56d241[_0xed45('0x13')](_0x1a516e)[_0xed45('0x14')](_0x4c5abc);}};}function respondWithFilteredResult(_0x5a8cd2,_0x41500e){return function(_0x1908e6){if(_0x1908e6){var _0x4108b2=_0x1908e6['count'],_0x37016d=_0x41500e[_0xed45('0x15')],_0x17e314=_0x41500e[_0xed45('0x15')]+_0x41500e[_0xed45('0x16')],_0x23232b;if(_0x17e314>=_0x4108b2){_0x17e314=_0x4108b2;_0x23232b=0xc8;}else{_0x23232b=0xce;}_0x5a8cd2[_0xed45('0x13')](_0x23232b);return _0x5a8cd2[_0xed45('0x17')]('Content-Range',_0x37016d+'-'+_0x17e314+'/'+_0x4108b2)[_0xed45('0x14')](_0x1908e6);}return null;};}function patchUpdates(_0x437e45){return function(_0x3b9dc3){try{jsonpatch['apply'](_0x3b9dc3,_0x437e45,!![]);}catch(_0x2a1c12){return BPromise[_0xed45('0x18')](_0x2a1c12);}return _0x3b9dc3[_0xed45('0x19')]();};}function saveUpdates(_0x5f31e8,_0x48d009){return function(_0x5586e4){if(_0x5586e4){return _0x5586e4[_0xed45('0x1a')](_0x5f31e8)['then'](function(_0x4b7a6a){return _0x4b7a6a;});}return null;};}function removeEntity(_0x5781af,_0x9aaa64){return function(_0x3de92b){if(_0x3de92b){return _0x3de92b[_0xed45('0x1b')]()[_0xed45('0x1c')](function(){_0x5781af[_0xed45('0x13')](0xcc)[_0xed45('0x1d')]();});}};}function handleEntityNotFound(_0x11550e,_0x5182ea){return function(_0x1be592){if(!_0x1be592){_0x11550e[_0xed45('0x12')](0x194);}return _0x1be592;};}function handleError(_0x37de68,_0x32f4b9){_0x32f4b9=_0x32f4b9||0x1f4;return function(_0x53a3fe){logger[_0xed45('0x1e')](_0x53a3fe[_0xed45('0x1f')]);if(_0x53a3fe[_0xed45('0x20')]){delete _0x53a3fe['name'];}_0x37de68[_0xed45('0x13')](_0x32f4b9)[_0xed45('0x21')](_0x53a3fe);};}exports[_0xed45('0x22')]=function(_0x2c66be,_0x209aea){var _0x1ff2c5={},_0x35276d={},_0xc21774={'count':0x0,'rows':[]};var _0x1fd002=_['map'](db[_0xed45('0x23')][_0xed45('0x24')],function(_0x4286e6){return{'name':_0x4286e6['fieldName'],'type':_0x4286e6[_0xed45('0x25')]['key']};});_0x35276d['model']=_['map'](_0x1fd002,_0xed45('0x20'));_0x35276d[_0xed45('0x26')]=_['keys'](_0x2c66be[_0xed45('0x26')]);_0x35276d[_0xed45('0x27')]=_['intersection'](_0x35276d[_0xed45('0x28')],_0x35276d['query']);_0x1ff2c5['attributes']=_[_0xed45('0x29')](_0x35276d[_0xed45('0x28')],qs['fields'](_0x2c66be['query'][_0xed45('0x2a')]));_0x1ff2c5['attributes']=_0x1ff2c5['attributes'][_0xed45('0x2b')]?_0x1ff2c5[_0xed45('0x2c')]:_0x35276d[_0xed45('0x28')];if(!_0x2c66be[_0xed45('0x26')][_0xed45('0x2d')](_0xed45('0x2e'))){_0x1ff2c5[_0xed45('0x16')]=qs[_0xed45('0x16')](_0x2c66be[_0xed45('0x26')][_0xed45('0x16')]);_0x1ff2c5[_0xed45('0x15')]=qs[_0xed45('0x15')](_0x2c66be[_0xed45('0x26')]['offset']);}_0x1ff2c5['order']=qs[_0xed45('0x2f')](_0x2c66be[_0xed45('0x26')][_0xed45('0x2f')]);_0x1ff2c5['where']=qs[_0xed45('0x27')](_[_0xed45('0x30')](_0x2c66be['query'],_0x35276d[_0xed45('0x27')]),_0x1fd002);if(_0x2c66be['query'][_0xed45('0x31')]){_0x1ff2c5[_0xed45('0x32')]=_[_0xed45('0x33')](_0x1ff2c5[_0xed45('0x32')],{'$or':_[_0xed45('0x34')](_0x1fd002,function(_0x183aed){if(_0x183aed[_0xed45('0x25')]!==_0xed45('0x35')){var _0x1dcafb={};_0x1dcafb[_0x183aed[_0xed45('0x20')]]={'$like':'%'+_0x2c66be[_0xed45('0x26')][_0xed45('0x31')]+'%'};return _0x1dcafb;}})});}_0x1ff2c5=_[_0xed45('0x33')]({},_0x1ff2c5,_0x2c66be['options']);var _0x915f7e={'where':_0x1ff2c5[_0xed45('0x32')]};return db[_0xed45('0x23')][_0xed45('0x36')](_0x915f7e)[_0xed45('0x1c')](function(_0x42c4e9){_0xc21774['count']=_0x42c4e9;if(_0x2c66be['query'][_0xed45('0x37')]){_0x1ff2c5['include']=[{'all':!![]}];}return db[_0xed45('0x23')][_0xed45('0x38')](_0x1ff2c5);})['then'](function(_0x3c5f10){_0xc21774[_0xed45('0x39')]=_0x3c5f10;return _0xc21774;})[_0xed45('0x1c')](respondWithFilteredResult(_0x209aea,_0x1ff2c5))[_0xed45('0x3a')](handleError(_0x209aea,null));};exports[_0xed45('0x3b')]=function(_0x2d4349,_0x21a3b2){var _0x45a4de={'raw':!![],'where':{'id':_0x2d4349['params']['id']}},_0x4417b3={};_0x4417b3['model']=_[_0xed45('0x3c')](db[_0xed45('0x23')]['rawAttributes']);_0x4417b3[_0xed45('0x26')]=_[_0xed45('0x3c')](_0x2d4349[_0xed45('0x26')]);_0x4417b3[_0xed45('0x27')]=_[_0xed45('0x29')](_0x4417b3[_0xed45('0x28')],_0x4417b3[_0xed45('0x26')]);_0x45a4de[_0xed45('0x2c')]=_[_0xed45('0x29')](_0x4417b3[_0xed45('0x28')],qs['fields'](_0x2d4349[_0xed45('0x26')][_0xed45('0x2a')]));_0x45a4de[_0xed45('0x2c')]=_0x45a4de[_0xed45('0x2c')][_0xed45('0x2b')]?_0x45a4de[_0xed45('0x2c')]:_0x4417b3['model'];if(_0x2d4349[_0xed45('0x26')][_0xed45('0x37')]){_0x45a4de[_0xed45('0x3d')]=[{'all':!![]}];}_0x45a4de=_['merge']({},_0x45a4de,_0x2d4349['options']);return db[_0xed45('0x23')][_0xed45('0x3e')](_0x45a4de)[_0xed45('0x1c')](handleEntityNotFound(_0x21a3b2,null))[_0xed45('0x1c')](respondWithResult(_0x21a3b2,null))[_0xed45('0x3a')](handleError(_0x21a3b2,null));};exports[_0xed45('0x3f')]=function(_0x98fd40,_0x4ca291){return db['VoiceTransferReport'][_0xed45('0x3f')](_0x98fd40[_0xed45('0x40')],{})[_0xed45('0x1c')](respondWithResult(_0x4ca291,0xc9))['catch'](handleError(_0x4ca291,null));};exports[_0xed45('0x1a')]=function(_0x586180,_0x1d712d){if(_0x586180[_0xed45('0x40')]['id']){delete _0x586180[_0xed45('0x40')]['id'];}return db[_0xed45('0x23')]['find']({'where':{'id':_0x586180[_0xed45('0x41')]['id']}})[_0xed45('0x1c')](handleEntityNotFound(_0x1d712d,null))[_0xed45('0x1c')](saveUpdates(_0x586180[_0xed45('0x40')],null))['then'](respondWithResult(_0x1d712d,null))[_0xed45('0x3a')](handleError(_0x1d712d,null));};exports[_0xed45('0x1b')]=function(_0x2cd95a,_0x1472c1){return db[_0xed45('0x23')][_0xed45('0x3e')]({'where':{'id':_0x2cd95a[_0xed45('0x41')]['id']}})[_0xed45('0x1c')](handleEntityNotFound(_0x1472c1,null))['then'](removeEntity(_0x1472c1,null))[_0xed45('0x3a')](handleError(_0x1472c1,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index a700871..22e9b19 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 _0xb62e=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceTransferReport.attributes','define','report_call_transfer','lodash','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb62e,0x1de));var _0xeb62=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb62e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xeb62('0x0'));var util=require(_0xeb62('0x1'));var logger=require(_0xeb62('0x2'))(_0xeb62('0x3'));var moment=require('moment');var BPromise=require(_0xeb62('0x4'));var rp=require(_0xeb62('0x5'));var fs=require('fs');var path=require(_0xeb62('0x6'));var rimraf=require(_0xeb62('0x7'));var config=require(_0xeb62('0x8'));var attributes=require(_0xeb62('0x9'));module['exports']=function(_0x3ec879,_0x455e1a){return _0x3ec879[_0xeb62('0xa')]('VoiceTransferReport',attributes,{'tableName':_0xeb62('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb248=['report_call_transfer','util','moment','bluebird','path','rimraf','../../config/environment','./voiceTransferReport.attributes','exports','define','VoiceTransferReport'];(function(_0x20a599,_0x4e5a44){var _0x5dac8f=function(_0x29e04b){while(--_0x29e04b){_0x20a599['push'](_0x20a599['shift']());}};_0x5dac8f(++_0x4e5a44);}(_0xb248,0x1b9));var _0x8b24=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0xb248[_0x1694f5];return _0x5b4321;};'use strict';var _=require('lodash');var util=require(_0x8b24('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x8b24('0x1'));var BPromise=require(_0x8b24('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8b24('0x3'));var rimraf=require(_0x8b24('0x4'));var config=require(_0x8b24('0x5'));var attributes=require(_0x8b24('0x6'));module[_0x8b24('0x7')]=function(_0x260fec,_0x5cce67){return _0x260fec[_0x8b24('0x8')](_0x8b24('0x9'),attributes,{'tableName':_0x8b24('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 618d6b7..c994e7c 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 _0xa0ef=['util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateVoiceTransferReport','VoiceTransferReport','create','body','options','raw','lodash'];(function(_0x368b80,_0x48a178){var _0x418d2a=function(_0x38be7c){while(--_0x38be7c){_0x368b80['push'](_0x368b80['shift']());}};_0x418d2a(++_0x48a178);}(_0xa0ef,0x1a3));var _0xfa0e=function(_0x1f175e,_0x25487c){_0x1f175e=_0x1f175e-0x0;var _0x4ab74c=_0xa0ef[_0x1f175e];return _0x4ab74c;};'use strict';var _=require(_0xfa0e('0x0'));var util=require(_0xfa0e('0x1'));var moment=require('moment');var BPromise=require(_0xfa0e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfa0e('0x3'));var db=require(_0xfa0e('0x4'))['db'];var utils=require(_0xfa0e('0x5'));var logger=require(_0xfa0e('0x6'))(_0xfa0e('0x7'));var config=require(_0xfa0e('0x8'));var jayson=require(_0xfa0e('0x9'));var client=jayson[_0xfa0e('0xa')][_0xfa0e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xc72fc6,_0x2e5ae2,_0x1a04e4){return new BPromise(function(_0x4732f1,_0x5c78a3){return client[_0xfa0e('0xc')](_0xc72fc6,_0x1a04e4)[_0xfa0e('0xd')](function(_0x48ccab){logger[_0xfa0e('0xe')](_0xfa0e('0xf'),_0x2e5ae2,_0xfa0e('0x10'));logger[_0xfa0e('0x11')](_0xfa0e('0x12'),_0x2e5ae2,_0xfa0e('0x10'),JSON[_0xfa0e('0x13')](_0x48ccab));if(_0x48ccab['error']){if(_0x48ccab['error']['code']===0x1f4){logger[_0xfa0e('0x14')](_0xfa0e('0xf'),_0x2e5ae2,_0x48ccab[_0xfa0e('0x14')][_0xfa0e('0x15')]);return _0x5c78a3(_0x48ccab['error']['message']);}logger[_0xfa0e('0x14')](_0xfa0e('0xf'),_0x2e5ae2,_0x48ccab[_0xfa0e('0x14')][_0xfa0e('0x15')]);return _0x4732f1(_0x48ccab[_0xfa0e('0x14')]['message']);}else{logger[_0xfa0e('0xe')](_0xfa0e('0xf'),_0x2e5ae2,_0xfa0e('0x10'));_0x4732f1(_0x48ccab[_0xfa0e('0x16')][_0xfa0e('0x15')]);}})[_0xfa0e('0x17')](function(_0x1fe853){logger['error'](_0xfa0e('0xf'),_0x2e5ae2,_0x1fe853);_0x5c78a3(_0x1fe853);});});}exports[_0xfa0e('0x18')]=function(_0x2af0d9){var _0x3dde9b=this;return new Promise(function(_0x243736,_0x235e98){return db[_0xfa0e('0x19')][_0xfa0e('0x1a')](_0x2af0d9[_0xfa0e('0x1b')],{'raw':_0x2af0d9[_0xfa0e('0x1c')]?_0x2af0d9[_0xfa0e('0x1c')][_0xfa0e('0x1d')]===undefined?!![]:![]:!![]})[_0xfa0e('0xd')](function(_0x2e73b6){logger[_0xfa0e('0xe')](_0xfa0e('0x18'),_0x2af0d9);logger[_0xfa0e('0x11')](_0xfa0e('0x18'),_0x2af0d9,JSON[_0xfa0e('0x13')](_0x2e73b6));_0x243736(_0x2e73b6);})[_0xfa0e('0x17')](function(_0x36b24a){logger[_0xfa0e('0x14')]('CreateVoiceTransferReport',_0x36b24a[_0xfa0e('0x15')],_0x2af0d9);_0x235e98(_0x3dde9b['error'](0x1f4,_0x36b24a[_0xfa0e('0x15')]));});});}; \ No newline at end of file +var _0xfc3a=['then','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','VoiceTransferReport,\x20%s,\x20%s,\x20%s','code','error','message','VoiceTransferReport','create','body','options','raw','CreateVoiceTransferReport','debug','stringify','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request'];(function(_0x5436a1,_0x43ce08){var _0x46c586=function(_0x622b2b){while(--_0x622b2b){_0x5436a1['push'](_0x5436a1['shift']());}};_0x46c586(++_0x43ce08);}(_0xfc3a,0x13d));var _0xafc3=function(_0x2f5927,_0x230a85){_0x2f5927=_0x2f5927-0x0;var _0x9ea7fb=_0xfc3a[_0x2f5927];return _0x9ea7fb;};'use strict';var _=require(_0xafc3('0x0'));var util=require(_0xafc3('0x1'));var moment=require(_0xafc3('0x2'));var BPromise=require(_0xafc3('0x3'));var rs=require(_0xafc3('0x4'));var fs=require('fs');var Redis=require(_0xafc3('0x5'));var db=require(_0xafc3('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xafc3('0x7'))(_0xafc3('0x8'));var config=require(_0xafc3('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xafc3('0xa')][_0xafc3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xc04118,_0x4d7299,_0x9e72ae){return new BPromise(function(_0x4efc23,_0x496493){return client[_0xafc3('0xc')](_0xc04118,_0x9e72ae)[_0xafc3('0xd')](function(_0x10ca85){logger[_0xafc3('0xe')](_0xafc3('0xf'),_0x4d7299,_0xafc3('0x10'));logger['debug'](_0xafc3('0x11'),_0x4d7299,_0xafc3('0x10'),JSON['stringify'](_0x10ca85));if(_0x10ca85['error']){if(_0x10ca85['error'][_0xafc3('0x12')]===0x1f4){logger[_0xafc3('0x13')](_0xafc3('0xf'),_0x4d7299,_0x10ca85[_0xafc3('0x13')][_0xafc3('0x14')]);return _0x496493(_0x10ca85[_0xafc3('0x13')][_0xafc3('0x14')]);}logger[_0xafc3('0x13')](_0xafc3('0xf'),_0x4d7299,_0x10ca85['error'][_0xafc3('0x14')]);return _0x4efc23(_0x10ca85[_0xafc3('0x13')][_0xafc3('0x14')]);}else{logger[_0xafc3('0xe')](_0xafc3('0xf'),_0x4d7299,_0xafc3('0x10'));_0x4efc23(_0x10ca85['result'][_0xafc3('0x14')]);}})['catch'](function(_0x4317a3){logger[_0xafc3('0x13')]('VoiceTransferReport,\x20%s,\x20%s',_0x4d7299,_0x4317a3);_0x496493(_0x4317a3);});});}exports['CreateVoiceTransferReport']=function(_0x1151af){var _0x46e51f=this;return new Promise(function(_0x321d7b,_0x56aa7c){return db[_0xafc3('0x15')][_0xafc3('0x16')](_0x1151af[_0xafc3('0x17')],{'raw':_0x1151af[_0xafc3('0x18')]?_0x1151af[_0xafc3('0x18')][_0xafc3('0x19')]===undefined?!![]:![]:!![]})[_0xafc3('0xd')](function(_0x31f5de){logger[_0xafc3('0xe')](_0xafc3('0x1a'),_0x1151af);logger[_0xafc3('0x1b')](_0xafc3('0x1a'),_0x1151af,JSON[_0xafc3('0x1c')](_0x31f5de));_0x321d7b(_0x31f5de);})[_0xafc3('0x1d')](function(_0x1c9532){logger[_0xafc3('0x13')](_0xafc3('0x1a'),_0x1c9532[_0xafc3('0x14')],_0x1151af);_0x56aa7c(_0x46e51f['error'](0x1f4,_0x1c9532[_0xafc3('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 602e7c0..be9793a 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 _0x340c=['exports','express','Router','../../components/auth/service','./webbar.controller','/originate','isAuthenticated','canUpdate','originate','/hangup','hangup','post','answer','hold','/unhold','unhold','calls','/transfer','transfer'];(function(_0x5ddc36,_0x20384a){var _0x5b670f=function(_0x22bc8c){while(--_0x22bc8c){_0x5ddc36['push'](_0x5ddc36['shift']());}};_0x5b670f(++_0x20384a);}(_0x340c,0xe5));var _0xc340=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x340c[_0x3dd15e];return _0x231fd0;};'use strict';var express=require(_0xc340('0x0'));var router=express[_0xc340('0x1')]();var auth=require(_0xc340('0x2'));var controller=require(_0xc340('0x3'));router['post'](_0xc340('0x4'),auth[_0xc340('0x5')](),auth[_0xc340('0x6')](),controller[_0xc340('0x7')]);router['post'](_0xc340('0x8'),auth[_0xc340('0x5')](),auth[_0xc340('0x6')](),controller[_0xc340('0x9')]);router[_0xc340('0xa')]('/answer',auth['isAuthenticated'](),auth['canUpdate'](),controller[_0xc340('0xb')]);router[_0xc340('0xa')]('/hold',auth[_0xc340('0x5')](),auth[_0xc340('0x6')](),controller[_0xc340('0xc')]);router[_0xc340('0xa')](_0xc340('0xd'),auth['isAuthenticated'](),auth[_0xc340('0x6')](),controller[_0xc340('0xe')]);router[_0xc340('0xa')]('/calls',auth[_0xc340('0x5')](),auth[_0xc340('0x6')](),controller[_0xc340('0xf')]);router[_0xc340('0xa')](_0xc340('0x10'),auth['isAuthenticated'](),auth[_0xc340('0x6')](),controller[_0xc340('0x11')]);module[_0xc340('0x12')]=router; \ No newline at end of file +var _0x12fd=['answer','/hold','/transfer','transfer','express','Router','../../components/auth/service','./webbar.controller','post','isAuthenticated','canUpdate','originate','/hangup','hangup','/answer'];(function(_0x30e3c2,_0x44d7e5){var _0x1c8447=function(_0x8f0c56){while(--_0x8f0c56){_0x30e3c2['push'](_0x30e3c2['shift']());}};_0x1c8447(++_0x44d7e5);}(_0x12fd,0x199));var _0xd12f=function(_0x185971,_0xa896c2){_0x185971=_0x185971-0x0;var _0x2a60a2=_0x12fd[_0x185971];return _0x2a60a2;};'use strict';var express=require(_0xd12f('0x0'));var router=express[_0xd12f('0x1')]();var auth=require(_0xd12f('0x2'));var controller=require(_0xd12f('0x3'));router[_0xd12f('0x4')]('/originate',auth[_0xd12f('0x5')](),auth[_0xd12f('0x6')](),controller[_0xd12f('0x7')]);router[_0xd12f('0x4')](_0xd12f('0x8'),auth[_0xd12f('0x5')](),auth['canUpdate'](),controller[_0xd12f('0x9')]);router['post'](_0xd12f('0xa'),auth[_0xd12f('0x5')](),auth[_0xd12f('0x6')](),controller[_0xd12f('0xb')]);router['post'](_0xd12f('0xc'),auth['isAuthenticated'](),auth[_0xd12f('0x6')](),controller['hold']);router['post']('/unhold',auth[_0xd12f('0x5')](),auth[_0xd12f('0x6')](),controller['unhold']);router['post']('/calls',auth['isAuthenticated'](),auth[_0xd12f('0x6')](),controller['calls']);router[_0xd12f('0x4')](_0xd12f('0xd'),auth['isAuthenticated'](),auth[_0xd12f('0x6')](),controller[_0xd12f('0xe')]);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 eb3c41d..8d2e0af 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 _0x2208=['info','stringify','emit','handleError:','error','name','send','status','NotFound','request','then','code','message','catch','User','agent','VoiceChannels','filter','rows','UserId','length','\x20not\x20found!','originate','originate\x20fired:','body','json','callNumber','callerId','callbackUrl','format','webbar:originate','originate\x20executed!','hangup\x20fired:','userId','sessionId','entityFound:','user:%s','webbar:hangup','answer','answer\x20fired:','webbar:answer','answer\x20executed!','hold','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','all','conference','conference\x20fired:','transfer','transfer\x20fired:','transferNumber','transfer\x20executed!','lodash','../../config/environment','bluebird','jayson/promise','client','http','../../config/logger','webbarapi','redis','localhost','socket.io-emitter','validate','number','string','callNumber\x20is\x20required','userId\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required'];(function(_0x3c44cf,_0x3cabf7){var _0x33e408=function(_0x21833a){while(--_0x21833a){_0x3c44cf['push'](_0x3c44cf['shift']());}};_0x33e408(++_0x3cabf7);}(_0x2208,0x11e));var _0x8220=function(_0x55b44c,_0x4a070a){_0x55b44c=_0x55b44c-0x0;var _0x768ac6=_0x2208[_0x55b44c];return _0x768ac6;};'use strict';var path=require('path');var fs=require('fs');var _=require(_0x8220('0x0'));var db=require('../../mysqldb')['db'];var config=require(_0x8220('0x1'));var util=require('util');var BPromise=require(_0x8220('0x2'));var jayson=require(_0x8220('0x3'));var amiClient=jayson[_0x8220('0x4')][_0x8220('0x5')]({'port':0x232a});var logger=require(_0x8220('0x6'))(_0x8220('0x7'));var Redis=require('ioredis');config[_0x8220('0x8')]=_['defaults'](config[_0x8220('0x8')],{'host':_0x8220('0x9'),'port':0x18eb});var io=require(_0x8220('0xa'))(new Redis(config[_0x8220('0x8')]));var Schema=require(_0x8220('0xb'));var originateValidation=new Schema({'userId':{'type':_0x8220('0xc'),'required':[!![],'userId\x20is\x20required']},'callNumber':{'type':_0x8220('0xd'),'required':[!![],_0x8220('0xe')]},'callerId':{'type':'string'},'callbackUrl':{'type':_0x8220('0xd')}});var hangupValidation=new Schema({'userId':{'type':_0x8220('0xc'),'required':[!![],_0x8220('0xf')]},'sessionId':{'type':_0x8220('0xd'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x8220('0xc'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':![]}});var transferValidation=new Schema({'userId':{'type':_0x8220('0xc'),'required':[!![],_0x8220('0xf')]},'sessionId':{'type':_0x8220('0xd'),'required':[!![],_0x8220('0x10')]},'transferNumber':{'type':_0x8220('0xd'),'required':[!![],_0x8220('0x11')]}});var holdValidation=new Schema({'userId':{'type':_0x8220('0xc'),'required':[!![],_0x8220('0xf')]},'sessionId':{'type':_0x8220('0xd'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x8220('0xc'),'required':[!![],_0x8220('0xf')]},'sessionId':{'type':_0x8220('0xd'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x8220('0xc'),'required':[!![],'userId\x20is\x20required']}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],_0x8220('0xf')]}});function emit(_0x1fb3d1,_0x1d04ab,_0xc10f2){logger[_0x8220('0x12')](_0x1fb3d1,_0x1d04ab,JSON[_0x8220('0x13')](_0xc10f2));io['to'](_0x1fb3d1)[_0x8220('0x14')](_0x1d04ab,_0xc10f2);}function handleError(_0x14e141){return function(_0x3fe87d){console['log'](_0x8220('0x15'),_0x3fe87d,_0x3fe87d instanceof RangeError);logger[_0x8220('0x16')](_0x3fe87d['stack']);if(_0x3fe87d instanceof RangeError){if(_0x3fe87d[_0x8220('0x17')]){delete _0x3fe87d['name'];}_0x14e141['status'](0x194)[_0x8220('0x18')](_0x3fe87d);}else{if(_0x3fe87d['name']){delete _0x3fe87d[_0x8220('0x17')];}_0x14e141[_0x8220('0x19')](0x1f4)[_0x8220('0x18')](_0x3fe87d);}};}function checkError(){return function(_0x334f3b){if(!_0x334f3b){throw new RangeError(_0x8220('0x1a'));}return _0x334f3b;};}function respondWithRpcPromise(_0x4c916e,_0x517fcf){return new BPromise(function(_0x8efe59,_0x21dd97){var _0x15988d=amiClient;return _0x15988d[_0x8220('0x1b')](_0x4c916e,_0x517fcf)[_0x8220('0x1c')](function(_0x2c4183){if(_0x2c4183[_0x8220('0x16')]){if(_0x2c4183['error'][_0x8220('0x1d')]===0x1f4){return _0x21dd97(_0x2c4183['error'][_0x8220('0x1e')]);}return _0x8efe59(_0x2c4183[_0x8220('0x16')][_0x8220('0x1e')]);}else{_0x8efe59(_0x2c4183['result']);}})[_0x8220('0x1f')](function(_0x3902c8){_0x21dd97(_0x3902c8);});});}function getAgent(_0x3feef6){return db[_0x8220('0x20')]['findOne']({'where':{'id':_0x3feef6,'role':_0x8220('0x21')}})[_0x8220('0x1c')](checkError());}function getAgentCheckSession(_0x21933d,_0x55d7fc){return new BPromise(function(_0x2c354b,_0x162ee9){var _0x218b23=respondWithRpcPromise(_0x8220('0x22'));var _0x154e8c=getAgent(_0x21933d);Promise['all']([_0x218b23,_0x154e8c])[_0x8220('0x1c')](function(_0xd56a27){var _0x150c4a=_0xd56a27[0x0];var _0x17c245=_0xd56a27[0x1];var _0x292fe6=_[_0x8220('0x23')](_0x150c4a[_0x8220('0x24')],function(_0x74a7a0){return _0x74a7a0[_0x8220('0x25')]==_0x17c245['id']&&_0x74a7a0['sessionId']==_0x55d7fc;});if(_0x292fe6[_0x8220('0x26')]==0x1){_0x2c354b(_0x17c245);}else{_0x162ee9(new RangeError('sessionId\x20'+_0x55d7fc+_0x8220('0x27')));}});});}exports[_0x8220('0x28')]=function(_0x527974,_0x4370fa){logger[_0x8220('0x12')](_0x8220('0x29'),_0x527974[_0x8220('0x2a')]);var _0x31ef16=originateValidation[_0x8220('0xb')](_0x527974[_0x8220('0x2a')]);if(_0x31ef16[_0x8220('0x26')]>0x0){return _0x4370fa['status'](0x190)[_0x8220('0x2b')](_0x31ef16);}var _0x3433e3=_0x527974['body']['userId'];var _0x45859c=_0x527974[_0x8220('0x2a')][_0x8220('0x2c')];var _0x4a596b=_0x527974['body'][_0x8220('0x2d')];var _0x292837=_0x527974[_0x8220('0x2a')][_0x8220('0x2e')];return getAgent(_0x3433e3)['then'](function(_0x19fb65){logger[_0x8220('0x12')]('entityFound:',_0x19fb65[_0x8220('0x17')]);emit(util[_0x8220('0x2f')]('user:%s',_0x19fb65[_0x8220('0x17')]),_0x8220('0x30'),{'callNumber':_0x45859c,'callerId':_0x4a596b,'callbackUrl':_0x292837});return _0x4370fa[_0x8220('0x19')](0xc8)[_0x8220('0x2b')]({'error':![],'message':_0x8220('0x31')});})[_0x8220('0x1f')](handleError(_0x4370fa));};exports['hangup']=function(_0x58ed8b,_0x4522bc){logger[_0x8220('0x12')](_0x8220('0x32'),_0x58ed8b[_0x8220('0x2a')]);var _0x2612c9=hangupValidation[_0x8220('0xb')](_0x58ed8b[_0x8220('0x2a')]);if(_0x2612c9['length']>0x0){return _0x4522bc[_0x8220('0x19')](0x190)[_0x8220('0x2b')](_0x2612c9);}var _0x3013b6=_0x58ed8b['body'][_0x8220('0x33')];var _0x438a52=_0x58ed8b[_0x8220('0x2a')][_0x8220('0x34')];return getAgent(_0x3013b6)[_0x8220('0x1c')](function(_0x4af8d5){logger[_0x8220('0x12')](_0x8220('0x35'),_0x4af8d5[_0x8220('0x17')]);emit(util[_0x8220('0x2f')](_0x8220('0x36'),_0x4af8d5[_0x8220('0x17')]),_0x8220('0x37'),{'sessionId':_0x438a52});return _0x4522bc[_0x8220('0x19')](0xc8)[_0x8220('0x2b')]({'error':![],'message':'hangup\x20executed!'});})[_0x8220('0x1f')](handleError(_0x4522bc));};exports[_0x8220('0x38')]=function(_0x65d87,_0x290026){logger[_0x8220('0x12')](_0x8220('0x39'),_0x65d87[_0x8220('0x2a')]);var _0x571bc0=answerValidation[_0x8220('0xb')](_0x65d87[_0x8220('0x2a')]);if(_0x571bc0[_0x8220('0x26')]>0x0){return _0x290026['status'](0x190)[_0x8220('0x2b')](_0x571bc0);}var _0x3459d8=_0x65d87['body']['userId'];var _0x214149=_0x65d87[_0x8220('0x2a')][_0x8220('0x34')];return getAgent(_0x3459d8)[_0x8220('0x1c')](function(_0x39fe71){logger[_0x8220('0x12')]('entityFound:',_0x39fe71[_0x8220('0x17')]);emit(util['format'](_0x8220('0x36'),_0x39fe71[_0x8220('0x17')]),_0x8220('0x3a'),{'sessionId':_0x214149});return _0x290026[_0x8220('0x19')](0xc8)[_0x8220('0x2b')]({'error':![],'message':_0x8220('0x3b')});})[_0x8220('0x1f')](handleError(_0x290026));};exports[_0x8220('0x3c')]=function(_0x1981ca,_0x203df3){logger[_0x8220('0x12')]('hold\x20fired:',_0x1981ca[_0x8220('0x2a')]);var _0x23e7cf=holdValidation['validate'](_0x1981ca['body']);if(_0x23e7cf[_0x8220('0x26')]>0x0){return _0x203df3[_0x8220('0x19')](0x190)[_0x8220('0x2b')](_0x23e7cf);}var _0x22c706=_0x1981ca[_0x8220('0x2a')]['userId'];var _0x1efe63=_0x1981ca['body']['sessionId'];return getAgent(_0x22c706)[_0x8220('0x1c')](function(_0x3ff0cb){logger[_0x8220('0x12')]('entityFound:',_0x3ff0cb[_0x8220('0x17')]);emit(util[_0x8220('0x2f')](_0x8220('0x36'),_0x3ff0cb[_0x8220('0x17')]),_0x8220('0x3d'),{'sessionId':_0x1efe63});return _0x203df3[_0x8220('0x19')](0xc8)[_0x8220('0x2b')]({'error':![],'message':_0x8220('0x3e')});})[_0x8220('0x1f')](handleError(_0x203df3));};exports[_0x8220('0x3f')]=function(_0x43f4d2,_0x2536aa){logger[_0x8220('0x12')](_0x8220('0x40'),_0x43f4d2[_0x8220('0x2a')]);var _0x766641=unholdValidation[_0x8220('0xb')](_0x43f4d2[_0x8220('0x2a')]);if(_0x766641[_0x8220('0x26')]>0x0){return _0x2536aa[_0x8220('0x19')](0x190)[_0x8220('0x2b')](_0x766641);}var _0x7fdc1a=_0x43f4d2[_0x8220('0x2a')][_0x8220('0x33')];var _0x4011a2=_0x43f4d2[_0x8220('0x2a')]['sessionId'];return getAgent(_0x7fdc1a)[_0x8220('0x1c')](function(_0x46d1a0){logger[_0x8220('0x12')](_0x8220('0x35'),_0x46d1a0['name']);emit(util['format'](_0x8220('0x36'),_0x46d1a0[_0x8220('0x17')]),_0x8220('0x41'),{'sessionId':_0x4011a2});return _0x2536aa[_0x8220('0x19')](0xc8)[_0x8220('0x2b')]({'error':![],'message':_0x8220('0x42')});})[_0x8220('0x1f')](handleError(_0x2536aa));};exports[_0x8220('0x43')]=function(_0x2207ed,_0xd6d6a){logger[_0x8220('0x12')](_0x8220('0x44'),_0xd6d6a[_0x8220('0x2a')]);var _0x3de204=callsValidation[_0x8220('0xb')](_0x2207ed[_0x8220('0x2a')]);if(_0x3de204[_0x8220('0x26')]>0x0){return _0xd6d6a[_0x8220('0x19')](0x190)[_0x8220('0x2b')](_0x3de204);}var _0x5f48b6=_0x2207ed[_0x8220('0x2a')][_0x8220('0x33')];var _0x2c1616=respondWithRpcPromise('VoiceChannels');var _0x363420=getAgent(_0x5f48b6);return Promise[_0x8220('0x45')]([_0x2c1616,_0x363420])[_0x8220('0x1c')](function(_0x1a91b6){var _0x37f985=_0x1a91b6[0x0];var _0x408648=_0x1a91b6[0x1];var _0x5c2610=_[_0x8220('0x23')](_0x37f985['rows'],function(_0x4be47b){return _0x4be47b[_0x8220('0x25')]==_0x408648['id'];});return _0xd6d6a[_0x8220('0x19')](0xc8)[_0x8220('0x2b')]({'count':_0x5c2610[_0x8220('0x26')],'rows':_0x5c2610});})[_0x8220('0x1f')](handleError(_0xd6d6a));};exports[_0x8220('0x46')]=function(_0x276065,_0x4f62ab){logger['info'](_0x8220('0x47'),_0x276065[_0x8220('0x2a')]);var _0xb6fee9=conferenceValidation[_0x8220('0xb')](_0x276065[_0x8220('0x2a')]);if(_0xb6fee9['length']>0x0){return _0x4f62ab[_0x8220('0x19')](0x190)[_0x8220('0x2b')](_0xb6fee9);}var _0x60d3fe=_0x276065[_0x8220('0x2a')][_0x8220('0x33')];return getAgent(_0x60d3fe)['then'](function(_0xb05eb4){logger[_0x8220('0x12')](_0x8220('0x35'),_0xb05eb4[_0x8220('0x17')]);emit(util['format'](_0x8220('0x36'),_0xb05eb4['name']),'webbar:conference');return _0x4f62ab[_0x8220('0x19')](0xc8)[_0x8220('0x2b')]({'error':![],'message':'conference\x20executed!'});})[_0x8220('0x1f')](handleError(_0x4f62ab));};exports[_0x8220('0x48')]=function(_0x5d229c,_0x525c28){logger['info'](_0x8220('0x49'),_0x5d229c[_0x8220('0x2a')]);var _0x47ef88=transferValidation[_0x8220('0xb')](_0x5d229c[_0x8220('0x2a')]);if(_0x47ef88[_0x8220('0x26')]>0x0){return _0x525c28['status'](0x190)['json'](_0x47ef88);}var _0x24fdf3=_0x5d229c[_0x8220('0x2a')]['userId'];var _0x56f24a=_0x5d229c[_0x8220('0x2a')]['sessionId'];var _0x4b5fe9=_0x5d229c[_0x8220('0x2a')][_0x8220('0x4a')];return getAgent(_0x24fdf3)[_0x8220('0x1c')](function(_0x51f17c){logger['info'](_0x8220('0x35'),_0x51f17c['name']);emit(util[_0x8220('0x2f')](_0x8220('0x36'),_0x51f17c['name']),'webbar:transfer',{'sessionId':_0x56f24a,'transferNumber':_0x4b5fe9});return _0x525c28[_0x8220('0x19')](0xc8)[_0x8220('0x2b')]({'error':![],'message':_0x8220('0x4b')});})[_0x8220('0x1f')](handleError(_0x525c28));}; \ No newline at end of file +var _0x6e16=['UserId','length','sessionId\x20','originate','body','userId','callNumber','callerId','entityFound:','format','user:%s','webbar:originate','json','originate\x20executed!','hangup','hangup\x20fired:','sessionId','webbar:hangup','hangup\x20executed!','answer','webbar:answer','answer\x20executed!','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','calls','calls\x20fired:','conference\x20fired:','webbar:conference','transfer\x20fired:','transferNumber','transfer\x20executed!','../../mysqldb','util','jayson/promise','client','../../config/logger','ioredis','redis','defaults','localhost','socket.io-emitter','validate','number','userId\x20is\x20required','string','callNumber\x20is\x20required','transferNumber\x20is\x20required','info','stringify','emit','handleError:','stack','name','status','send','NotFound','request','then','error','code','result','catch','User','agent','VoiceChannels','all','filter','rows'];(function(_0x4cf37f,_0x397b39){var _0x4eeca6=function(_0x5b0723){while(--_0x5b0723){_0x4cf37f['push'](_0x4cf37f['shift']());}};_0x4eeca6(++_0x397b39);}(_0x6e16,0x1d3));var _0x66e1=function(_0xe35dd5,_0x4d1c0a){_0xe35dd5=_0xe35dd5-0x0;var _0x4208b0=_0x6e16[_0xe35dd5];return _0x4208b0;};'use strict';var path=require('path');var fs=require('fs');var _=require('lodash');var db=require(_0x66e1('0x0'))['db'];var config=require('../../config/environment');var util=require(_0x66e1('0x1'));var BPromise=require('bluebird');var jayson=require(_0x66e1('0x2'));var amiClient=jayson[_0x66e1('0x3')]['http']({'port':0x232a});var logger=require(_0x66e1('0x4'))('webbarapi');var Redis=require(_0x66e1('0x5'));config[_0x66e1('0x6')]=_[_0x66e1('0x7')](config['redis'],{'host':_0x66e1('0x8'),'port':0x18eb});var io=require(_0x66e1('0x9'))(new Redis(config[_0x66e1('0x6')]));var Schema=require(_0x66e1('0xa'));var originateValidation=new Schema({'userId':{'type':_0x66e1('0xb'),'required':[!![],_0x66e1('0xc')]},'callNumber':{'type':_0x66e1('0xd'),'required':[!![],_0x66e1('0xe')]},'callerId':{'type':_0x66e1('0xd')},'callbackUrl':{'type':_0x66e1('0xd')}});var hangupValidation=new Schema({'userId':{'type':_0x66e1('0xb'),'required':[!![],_0x66e1('0xc')]},'sessionId':{'type':_0x66e1('0xd'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x66e1('0xb'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':![]}});var transferValidation=new Schema({'userId':{'type':_0x66e1('0xb'),'required':[!![],_0x66e1('0xc')]},'sessionId':{'type':_0x66e1('0xd'),'required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':'string','required':[!![],_0x66e1('0xf')]}});var holdValidation=new Schema({'userId':{'type':'number','required':[!![],_0x66e1('0xc')]},'sessionId':{'type':_0x66e1('0xd'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':'number','required':[!![],_0x66e1('0xc')]},'sessionId':{'type':_0x66e1('0xd'),'required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],_0x66e1('0xc')]}});var conferenceValidation=new Schema({'userId':{'type':_0x66e1('0xb'),'required':[!![],_0x66e1('0xc')]}});function emit(_0x3a68b3,_0x48e005,_0x41c780){logger[_0x66e1('0x10')](_0x3a68b3,_0x48e005,JSON[_0x66e1('0x11')](_0x41c780));io['to'](_0x3a68b3)[_0x66e1('0x12')](_0x48e005,_0x41c780);}function handleError(_0x833178){return function(_0x4f3276){console['log'](_0x66e1('0x13'),_0x4f3276,_0x4f3276 instanceof RangeError);logger['error'](_0x4f3276[_0x66e1('0x14')]);if(_0x4f3276 instanceof RangeError){if(_0x4f3276[_0x66e1('0x15')]){delete _0x4f3276[_0x66e1('0x15')];}_0x833178[_0x66e1('0x16')](0x194)[_0x66e1('0x17')](_0x4f3276);}else{if(_0x4f3276['name']){delete _0x4f3276[_0x66e1('0x15')];}_0x833178[_0x66e1('0x16')](0x1f4)[_0x66e1('0x17')](_0x4f3276);}};}function checkError(){return function(_0x27d08e){if(!_0x27d08e){throw new RangeError(_0x66e1('0x18'));}return _0x27d08e;};}function respondWithRpcPromise(_0x460649,_0x307085){return new BPromise(function(_0x38cf5b,_0x11232c){var _0x350b81=amiClient;return _0x350b81[_0x66e1('0x19')](_0x460649,_0x307085)[_0x66e1('0x1a')](function(_0x43686e){if(_0x43686e[_0x66e1('0x1b')]){if(_0x43686e[_0x66e1('0x1b')][_0x66e1('0x1c')]===0x1f4){return _0x11232c(_0x43686e[_0x66e1('0x1b')]['message']);}return _0x38cf5b(_0x43686e[_0x66e1('0x1b')]['message']);}else{_0x38cf5b(_0x43686e[_0x66e1('0x1d')]);}})[_0x66e1('0x1e')](function(_0x181a7b){_0x11232c(_0x181a7b);});});}function getAgent(_0x1d1b09){return db[_0x66e1('0x1f')]['findOne']({'where':{'id':_0x1d1b09,'role':_0x66e1('0x20')}})[_0x66e1('0x1a')](checkError());}function getAgentCheckSession(_0x2c4d08,_0x57fd03){return new BPromise(function(_0x4036c5,_0x4f090b){var _0x5e1e87=respondWithRpcPromise(_0x66e1('0x21'));var _0x3fcc99=getAgent(_0x2c4d08);Promise[_0x66e1('0x22')]([_0x5e1e87,_0x3fcc99])[_0x66e1('0x1a')](function(_0x218902){var _0xb6a4bf=_0x218902[0x0];var _0x411f53=_0x218902[0x1];var _0x10a962=_[_0x66e1('0x23')](_0xb6a4bf[_0x66e1('0x24')],function(_0x87bf90){return _0x87bf90[_0x66e1('0x25')]==_0x411f53['id']&&_0x87bf90['sessionId']==_0x57fd03;});if(_0x10a962[_0x66e1('0x26')]==0x1){_0x4036c5(_0x411f53);}else{_0x4f090b(new RangeError(_0x66e1('0x27')+_0x57fd03+'\x20not\x20found!'));}});});}exports[_0x66e1('0x28')]=function(_0xa12f84,_0xe4df21){logger[_0x66e1('0x10')]('originate\x20fired:',_0xa12f84[_0x66e1('0x29')]);var _0x3bcd9f=originateValidation[_0x66e1('0xa')](_0xa12f84['body']);if(_0x3bcd9f[_0x66e1('0x26')]>0x0){return _0xe4df21['status'](0x190)['json'](_0x3bcd9f);}var _0x489b8d=_0xa12f84[_0x66e1('0x29')][_0x66e1('0x2a')];var _0x56fa99=_0xa12f84[_0x66e1('0x29')][_0x66e1('0x2b')];var _0x4dae24=_0xa12f84['body'][_0x66e1('0x2c')];var _0x2edd0e=_0xa12f84[_0x66e1('0x29')]['callbackUrl'];return getAgent(_0x489b8d)[_0x66e1('0x1a')](function(_0x2633e2){logger[_0x66e1('0x10')](_0x66e1('0x2d'),_0x2633e2['name']);emit(util[_0x66e1('0x2e')](_0x66e1('0x2f'),_0x2633e2[_0x66e1('0x15')]),_0x66e1('0x30'),{'callNumber':_0x56fa99,'callerId':_0x4dae24,'callbackUrl':_0x2edd0e});return _0xe4df21[_0x66e1('0x16')](0xc8)[_0x66e1('0x31')]({'error':![],'message':_0x66e1('0x32')});})[_0x66e1('0x1e')](handleError(_0xe4df21));};exports[_0x66e1('0x33')]=function(_0xe6b400,_0x3353bc){logger[_0x66e1('0x10')](_0x66e1('0x34'),_0xe6b400[_0x66e1('0x29')]);var _0x3fe9ed=hangupValidation[_0x66e1('0xa')](_0xe6b400[_0x66e1('0x29')]);if(_0x3fe9ed['length']>0x0){return _0x3353bc[_0x66e1('0x16')](0x190)[_0x66e1('0x31')](_0x3fe9ed);}var _0x8bf2a1=_0xe6b400['body'][_0x66e1('0x2a')];var _0x16885b=_0xe6b400[_0x66e1('0x29')][_0x66e1('0x35')];return getAgent(_0x8bf2a1)[_0x66e1('0x1a')](function(_0x1bd058){logger[_0x66e1('0x10')](_0x66e1('0x2d'),_0x1bd058['name']);emit(util[_0x66e1('0x2e')](_0x66e1('0x2f'),_0x1bd058[_0x66e1('0x15')]),_0x66e1('0x36'),{'sessionId':_0x16885b});return _0x3353bc[_0x66e1('0x16')](0xc8)[_0x66e1('0x31')]({'error':![],'message':_0x66e1('0x37')});})[_0x66e1('0x1e')](handleError(_0x3353bc));};exports[_0x66e1('0x38')]=function(_0x86c930,_0xc8e5d4){logger[_0x66e1('0x10')]('answer\x20fired:',_0x86c930[_0x66e1('0x29')]);var _0x180230=answerValidation['validate'](_0x86c930[_0x66e1('0x29')]);if(_0x180230[_0x66e1('0x26')]>0x0){return _0xc8e5d4[_0x66e1('0x16')](0x190)[_0x66e1('0x31')](_0x180230);}var _0x986bca=_0x86c930[_0x66e1('0x29')][_0x66e1('0x2a')];var _0x46511c=_0x86c930['body'][_0x66e1('0x35')];return getAgent(_0x986bca)['then'](function(_0x1908f8){logger['info']('entityFound:',_0x1908f8[_0x66e1('0x15')]);emit(util[_0x66e1('0x2e')](_0x66e1('0x2f'),_0x1908f8['name']),_0x66e1('0x39'),{'sessionId':_0x46511c});return _0xc8e5d4[_0x66e1('0x16')](0xc8)[_0x66e1('0x31')]({'error':![],'message':_0x66e1('0x3a')});})['catch'](handleError(_0xc8e5d4));};exports['hold']=function(_0x4f9ae,_0x2a75f8){logger[_0x66e1('0x10')](_0x66e1('0x3b'),_0x4f9ae[_0x66e1('0x29')]);var _0x55f430=holdValidation[_0x66e1('0xa')](_0x4f9ae['body']);if(_0x55f430[_0x66e1('0x26')]>0x0){return _0x2a75f8['status'](0x190)[_0x66e1('0x31')](_0x55f430);}var _0x4ce4ad=_0x4f9ae[_0x66e1('0x29')][_0x66e1('0x2a')];var _0x24c981=_0x4f9ae[_0x66e1('0x29')][_0x66e1('0x35')];return getAgent(_0x4ce4ad)[_0x66e1('0x1a')](function(_0x529fe2){logger[_0x66e1('0x10')]('entityFound:',_0x529fe2[_0x66e1('0x15')]);emit(util[_0x66e1('0x2e')]('user:%s',_0x529fe2[_0x66e1('0x15')]),_0x66e1('0x3c'),{'sessionId':_0x24c981});return _0x2a75f8[_0x66e1('0x16')](0xc8)[_0x66e1('0x31')]({'error':![],'message':_0x66e1('0x3d')});})['catch'](handleError(_0x2a75f8));};exports[_0x66e1('0x3e')]=function(_0x2db8f3,_0x1717bd){logger[_0x66e1('0x10')](_0x66e1('0x3f'),_0x2db8f3[_0x66e1('0x29')]);var _0x25e796=unholdValidation[_0x66e1('0xa')](_0x2db8f3['body']);if(_0x25e796[_0x66e1('0x26')]>0x0){return _0x1717bd[_0x66e1('0x16')](0x190)[_0x66e1('0x31')](_0x25e796);}var _0x5be391=_0x2db8f3[_0x66e1('0x29')][_0x66e1('0x2a')];var _0x599607=_0x2db8f3['body'][_0x66e1('0x35')];return getAgent(_0x5be391)[_0x66e1('0x1a')](function(_0x50602d){logger['info'](_0x66e1('0x2d'),_0x50602d[_0x66e1('0x15')]);emit(util[_0x66e1('0x2e')](_0x66e1('0x2f'),_0x50602d[_0x66e1('0x15')]),_0x66e1('0x40'),{'sessionId':_0x599607});return _0x1717bd[_0x66e1('0x16')](0xc8)[_0x66e1('0x31')]({'error':![],'message':'unhold\x20executed!'});})[_0x66e1('0x1e')](handleError(_0x1717bd));};exports[_0x66e1('0x41')]=function(_0x326849,_0x34c444){logger['info'](_0x66e1('0x42'),_0x34c444[_0x66e1('0x29')]);var _0x169d5a=callsValidation[_0x66e1('0xa')](_0x326849[_0x66e1('0x29')]);if(_0x169d5a[_0x66e1('0x26')]>0x0){return _0x34c444[_0x66e1('0x16')](0x190)[_0x66e1('0x31')](_0x169d5a);}var _0x3d201b=_0x326849[_0x66e1('0x29')][_0x66e1('0x2a')];var _0x23dae6=respondWithRpcPromise('VoiceChannels');var _0x468a61=getAgent(_0x3d201b);return Promise[_0x66e1('0x22')]([_0x23dae6,_0x468a61])[_0x66e1('0x1a')](function(_0x57a246){var _0x466e3d=_0x57a246[0x0];var _0x5b6a4a=_0x57a246[0x1];var _0x41f682=_['filter'](_0x466e3d['rows'],function(_0x5c5728){return _0x5c5728[_0x66e1('0x25')]==_0x5b6a4a['id'];});return _0x34c444[_0x66e1('0x16')](0xc8)[_0x66e1('0x31')]({'count':_0x41f682['length'],'rows':_0x41f682});})[_0x66e1('0x1e')](handleError(_0x34c444));};exports['conference']=function(_0x2a463f,_0x396934){logger[_0x66e1('0x10')](_0x66e1('0x43'),_0x2a463f['body']);var _0x4eb7d2=conferenceValidation[_0x66e1('0xa')](_0x2a463f[_0x66e1('0x29')]);if(_0x4eb7d2[_0x66e1('0x26')]>0x0){return _0x396934['status'](0x190)[_0x66e1('0x31')](_0x4eb7d2);}var _0x46e48a=_0x2a463f[_0x66e1('0x29')][_0x66e1('0x2a')];return getAgent(_0x46e48a)[_0x66e1('0x1a')](function(_0x261b48){logger[_0x66e1('0x10')]('entityFound:',_0x261b48['name']);emit(util[_0x66e1('0x2e')](_0x66e1('0x2f'),_0x261b48['name']),_0x66e1('0x44'));return _0x396934[_0x66e1('0x16')](0xc8)[_0x66e1('0x31')]({'error':![],'message':'conference\x20executed!'});})[_0x66e1('0x1e')](handleError(_0x396934));};exports['transfer']=function(_0x314ebc,_0x2d1e96){logger[_0x66e1('0x10')](_0x66e1('0x45'),_0x314ebc['body']);var _0x17dc39=transferValidation[_0x66e1('0xa')](_0x314ebc[_0x66e1('0x29')]);if(_0x17dc39[_0x66e1('0x26')]>0x0){return _0x2d1e96['status'](0x190)['json'](_0x17dc39);}var _0x38b770=_0x314ebc[_0x66e1('0x29')][_0x66e1('0x2a')];var _0x584c25=_0x314ebc[_0x66e1('0x29')][_0x66e1('0x35')];var _0x121b5b=_0x314ebc[_0x66e1('0x29')][_0x66e1('0x46')];return getAgent(_0x38b770)[_0x66e1('0x1a')](function(_0x5c101f){logger['info'](_0x66e1('0x2d'),_0x5c101f['name']);emit(util[_0x66e1('0x2e')](_0x66e1('0x2f'),_0x5c101f['name']),'webbar:transfer',{'sessionId':_0x584c25,'transferNumber':_0x121b5b});return _0x2d1e96[_0x66e1('0x16')](0xc8)[_0x66e1('0x31')]({'error':![],'message':_0x66e1('0x47')});})[_0x66e1('0x1e')](handleError(_0x2d1e96));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 746380c..84c7186 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 _0x2e51=['removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','/describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/users','getAgents','getApplications','post','addDisposition','addAnswer','/:id/applications','/:id/notify','/:id/send','send','update','delete','destroy'];(function(_0x570434,_0x5d9ffb){var _0x1ca0f5=function(_0x3850e0){while(--_0x3850e0){_0x570434['push'](_0x570434['shift']());}};_0x1ca0f5(++_0x5d9ffb);}(_0x2e51,0x19c));var _0x12e5=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x2e51[_0x40a045];return _0x1a687c;};'use strict';var multer=require(_0x12e5('0x0'));var util=require(_0x12e5('0x1'));var path=require(_0x12e5('0x2'));var timeout=require(_0x12e5('0x3'));var express=require('express');var router=express[_0x12e5('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x12e5('0x5'));var config=require(_0x12e5('0x6'));var controller=require(_0x12e5('0x7'));router[_0x12e5('0x8')]('/',auth[_0x12e5('0x9')](),controller['index']);router[_0x12e5('0x8')](_0x12e5('0xa'),auth[_0x12e5('0x9')](),controller['describe']);router[_0x12e5('0x8')](_0x12e5('0xb'),auth['isAuthenticated'](),controller[_0x12e5('0xc')]);router['get'](_0x12e5('0xd'),auth['isAuthenticated'](),controller[_0x12e5('0xe')]);router[_0x12e5('0x8')](_0x12e5('0xf'),auth['isAuthenticated'](),controller[_0x12e5('0x10')]);router['get'](_0x12e5('0x11'),auth[_0x12e5('0x9')](),controller[_0x12e5('0x12')]);router[_0x12e5('0x8')]('/:id/applications',auth[_0x12e5('0x9')](),controller[_0x12e5('0x13')]);router[_0x12e5('0x14')]('/',auth['isAuthenticated'](),controller['create']);router[_0x12e5('0x14')]('/:id/dispositions',auth[_0x12e5('0x9')](),controller[_0x12e5('0x15')]);router[_0x12e5('0x14')](_0x12e5('0xf'),auth[_0x12e5('0x9')](),controller[_0x12e5('0x16')]);router['post'](_0x12e5('0x11'),auth[_0x12e5('0x9')](),controller['addAgents']);router[_0x12e5('0x14')](_0x12e5('0x17'),auth[_0x12e5('0x9')](),controller['addApplications']);router[_0x12e5('0x14')](_0x12e5('0x18'),controller['notify']);router['post'](_0x12e5('0x19'),auth[_0x12e5('0x9')](),controller[_0x12e5('0x1a')]);router['put'](_0x12e5('0xb'),auth[_0x12e5('0x9')](),controller[_0x12e5('0x1b')]);router[_0x12e5('0x1c')](_0x12e5('0xb'),auth[_0x12e5('0x9')](),controller[_0x12e5('0x1d')]);router['delete'](_0x12e5('0xd'),auth['isAuthenticated'](),controller[_0x12e5('0x1e')]);router[_0x12e5('0x1c')]('/:id/canned_answers',auth[_0x12e5('0x9')](),controller[_0x12e5('0x1f')]);router['delete'](_0x12e5('0x11'),auth['isAuthenticated'](),controller[_0x12e5('0x20')]);module[_0x12e5('0x21')]=router; \ No newline at end of file +var _0x81ce=['post','create','addDisposition','addAgents','/:id/notify','notify','/:id/send','send','put','/:id','update','delete','destroy','removeDispositions','/:id/canned_answers','removeAnswers','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','./whatsappAccount.controller','get','isAuthenticated','/describe','describe','show','/:id/dispositions','getDispositions','getAnswers','/:id/users','getAgents','/:id/applications','getApplications'];(function(_0x3161b3,_0xd28f58){var _0x1a416a=function(_0x335bec){while(--_0x335bec){_0x3161b3['push'](_0x3161b3['shift']());}};_0x1a416a(++_0xd28f58);}(_0x81ce,0xca));var _0xe81c=function(_0x50edfa,_0x1b6c8e){_0x50edfa=_0x50edfa-0x0;var _0x1c45bc=_0x81ce[_0x50edfa];return _0x1c45bc;};'use strict';var multer=require(_0xe81c('0x0'));var util=require(_0xe81c('0x1'));var path=require(_0xe81c('0x2'));var timeout=require(_0xe81c('0x3'));var express=require(_0xe81c('0x4'));var router=express[_0xe81c('0x5')]();var auth=require(_0xe81c('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xe81c('0x7'));router[_0xe81c('0x8')]('/',auth[_0xe81c('0x9')](),controller['index']);router[_0xe81c('0x8')](_0xe81c('0xa'),auth[_0xe81c('0x9')](),controller[_0xe81c('0xb')]);router[_0xe81c('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xe81c('0xc')]);router[_0xe81c('0x8')](_0xe81c('0xd'),auth[_0xe81c('0x9')](),controller[_0xe81c('0xe')]);router[_0xe81c('0x8')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0xe81c('0xf')]);router['get'](_0xe81c('0x10'),auth[_0xe81c('0x9')](),controller[_0xe81c('0x11')]);router[_0xe81c('0x8')](_0xe81c('0x12'),auth[_0xe81c('0x9')](),controller[_0xe81c('0x13')]);router[_0xe81c('0x14')]('/',auth[_0xe81c('0x9')](),controller[_0xe81c('0x15')]);router[_0xe81c('0x14')](_0xe81c('0xd'),auth[_0xe81c('0x9')](),controller[_0xe81c('0x16')]);router[_0xe81c('0x14')]('/:id/canned_answers',auth['isAuthenticated'](),controller['addAnswer']);router['post'](_0xe81c('0x10'),auth['isAuthenticated'](),controller[_0xe81c('0x17')]);router[_0xe81c('0x14')]('/:id/applications',auth[_0xe81c('0x9')](),controller['addApplications']);router[_0xe81c('0x14')](_0xe81c('0x18'),controller[_0xe81c('0x19')]);router[_0xe81c('0x14')](_0xe81c('0x1a'),auth['isAuthenticated'](),controller[_0xe81c('0x1b')]);router[_0xe81c('0x1c')](_0xe81c('0x1d'),auth[_0xe81c('0x9')](),controller[_0xe81c('0x1e')]);router[_0xe81c('0x1f')]('/:id',auth[_0xe81c('0x9')](),controller[_0xe81c('0x20')]);router[_0xe81c('0x1f')](_0xe81c('0xd'),auth[_0xe81c('0x9')](),controller[_0xe81c('0x21')]);router[_0xe81c('0x1f')](_0xe81c('0x22'),auth[_0xe81c('0x9')](),controller[_0xe81c('0x23')]);router[_0xe81c('0x1f')](_0xe81c('0x10'),auth[_0xe81c('0x9')](),controller['removeAgents']);module[_0xe81c('0x24')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index edeb996..ac92880 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 _0x70c2=['STRING','name','twilio','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','sequelize','randomstring'];(function(_0x366a1d,_0xf510f5){var _0x260669=function(_0x377b2d){while(--_0x377b2d){_0x366a1d['push'](_0x366a1d['shift']());}};_0x260669(++_0xf510f5);}(_0x70c2,0x106));var _0x270c=function(_0x33187c,_0x766ee9){_0x33187c=_0x33187c-0x0;var _0x29dda5=_0x70c2[_0x33187c];return _0x29dda5;};'use strict';var Sequelize=require(_0x270c('0x0'));var rs=require(_0x270c('0x1'));module['exports']={'name':{'type':Sequelize[_0x270c('0x2')],'unique':_0x270c('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x270c('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x270c('0x2')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0x270c('0x2')]},'type':{'type':Sequelize['ENUM'](_0x270c('0x4'))},'accountSid':{'type':Sequelize[_0x270c('0x2')]},'authToken':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x270c('0x5')],'defaultValue':function(){return _0x270c('0x6');}},'notificationSound':{'type':Sequelize[_0x270c('0x7')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x270c('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x270c('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x270c('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x270c('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x270c('0x8')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x270c('0x9'),'set':function(_0x3827a6){if(!_0x3827a6){this['setDataValue'](_0x270c('0xa'),null);}this[_0x270c('0xb')]('mandatoryDisposition',_0x3827a6);}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x5ba3=['Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','randomstring','exports','STRING','name','generate','ENUM','twilio','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'];(function(_0x439af6,_0x479095){var _0x259601=function(_0x375ea9){while(--_0x375ea9){_0x439af6['push'](_0x439af6['shift']());}};_0x259601(++_0x479095);}(_0x5ba3,0x15c));var _0x35ba=function(_0x2d0e34,_0x5e30b8){_0x2d0e34=_0x2d0e34-0x0;var _0x32638b=_0x5ba3[_0x2d0e34];return _0x32638b;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x35ba('0x0'));module[_0x35ba('0x1')]={'name':{'type':Sequelize[_0x35ba('0x2')],'unique':_0x35ba('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x35ba('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x35ba('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0x35ba('0x2')],'defaultValue':function(){return rs[_0x35ba('0x4')]();}},'phone':{'type':Sequelize[_0x35ba('0x2')]},'type':{'type':Sequelize[_0x35ba('0x5')](_0x35ba('0x6'))},'accountSid':{'type':Sequelize[_0x35ba('0x2')]},'authToken':{'type':Sequelize[_0x35ba('0x2')]},'notificationTemplate':{'type':Sequelize[_0x35ba('0x7')],'defaultValue':function(){return _0x35ba('0x8');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x35ba('0x9')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x35ba('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x35ba('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x35ba('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x35ba('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x35ba('0xa')],'comment':_0x35ba('0xb')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x35ba('0xc'),'set':function(_0x534e30){if(!_0x534e30){this['setDataValue']('mandatoryDispositionPauseId',null);}this[_0x35ba('0xd')](_0x35ba('0xe'),_0x534e30);}},'description':{'type':Sequelize[_0x35ba('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index b08696b..7c823cd 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 _0xa74f=['ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','WhatsappAccount,\x20%s,\x20%s','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','sendStatus','status','offset','limit','Content-Range','json','apply','reject','update','then','destroy','WhatsappAccounts','end','name','send','index','Pause','map','WhatsappAccount','rawAttributes','fieldName','type','key','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','VIRTUAL','merge','options','count','findAll','rows','show','params','includeAll','include','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','mandatoryDispositionPause','describe','addDisposition','WhatsappAccountId','getDispositions','findOne','Disposition','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','addAgents','omit','emit','removeAgents','userWhatsappAccount:remove','getAgents','addApplications','sequelize','transaction','WhatsappApplication','bulkCreate','findAndCountAll','priority','getApplications','whatsapp','account','orderBy','Applications','asc','CmContact','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','twilio','from','From','whatsapp:','Body','MessageSid','isNil','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','CmList','Contacts','WhatsappInteraction','interaction','created','autoclose','applications','push','unmanaged','*,*,*,*','WhatsappMessage','AttachmentId','UserId','User','agent','waitForTheAssignedAgent','Start','receiveMessage','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','entity\x20found','stringify','set','Content-Type','text/xml','\x0a','to\x20is\x20mandatory','List','DESC','user','out','Messages','spread','dataValues','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','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','client','http','test','Sequelize'];(function(_0x18bcbc,_0x317121){var _0x5356dc=function(_0x2b9a26){while(--_0x2b9a26){_0x18bcbc['push'](_0x18bcbc['shift']());}};_0x5356dc(++_0x317121);}(_0xa74f,0x9a));var _0xfa74=function(_0x3e25c1,_0x1d15f9){_0x3e25c1=_0x3e25c1-0x0;var _0x52e7f2=_0xa74f[_0x3e25c1];return _0x52e7f2;};'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 db=require(_0xfa74('0x15'))['db'];config['redis']=_[_0xfa74('0x16')](config[_0xfa74('0x17')],{'host':_0xfa74('0x18'),'port':0x18eb});var socket=require(_0xfa74('0x19'))(new Redis(config['redis']));require(_0xfa74('0x1a'))[_0xfa74('0x1b')](socket);var jayson=require(_0xfa74('0x1c'));var client=jayson[_0xfa74('0x1d')][_0xfa74('0x1e')]({'port':0x232c});function checkPasswordPattern(_0x47c8fb,_0x199d20,_0x13d911){if(_0x13d911){var _0x947da6=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x947da6[_0xfa74('0x1f')](_0x199d20)){return _0x47c8fb;}else{throw new db[(_0xfa74('0x20'))][(_0xfa74('0x21'))](_0xfa74('0x22'));}}else{return _0x47c8fb;}}function respondWithRpcPromise(_0x48c119,_0x58a67a,_0xe0e33d,_0x51dda1){return new BPromise(function(_0x4928b6,_0x31d3c1){var _0x25a36b=_0x51dda1||client;return _0x25a36b[_0xfa74('0x23')](_0x48c119,_0xe0e33d)['then'](function(_0x3bede6){logger[_0xfa74('0x24')](_0xfa74('0x25'),_0x58a67a,'request\x20sent');logger[_0xfa74('0x26')](_0xfa74('0x27'),_0x58a67a,_0xfa74('0x28'),JSON['stringify'](_0x3bede6));if(_0x3bede6['error']){if(_0x3bede6[_0xfa74('0x29')][_0xfa74('0x2a')]===0x1f4){logger[_0xfa74('0x29')](_0xfa74('0x25'),_0x58a67a,_0x3bede6[_0xfa74('0x29')]['message']);return _0x31d3c1(_0x3bede6['error'][_0xfa74('0x2b')]);}logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x58a67a,_0x3bede6['error'][_0xfa74('0x2b')]);return _0x4928b6(_0x3bede6[_0xfa74('0x29')][_0xfa74('0x2b')]);}else{logger['info']('WhatsappAccount,\x20%s,\x20%s',_0x58a67a,_0xfa74('0x28'));_0x4928b6(_0x3bede6[_0xfa74('0x2c')]['message']);}})[_0xfa74('0x2d')](function(_0x5d3b26){logger[_0xfa74('0x29')](_0xfa74('0x25'),_0x58a67a,_0x5d3b26);_0x31d3c1(_0x5d3b26);});});}function respondWithStatusCode(_0x55d8e4,_0x298388){_0x298388=_0x298388||0xcc;return function(_0x1130de){if(_0x1130de){return _0x55d8e4[_0xfa74('0x2e')](_0x298388);}return _0x55d8e4[_0xfa74('0x2f')](_0x298388)['end']();};}function respondWithResult(_0xd9c55d,_0x2f7cd7){_0x2f7cd7=_0x2f7cd7||0xc8;return function(_0x204e01){if(_0x204e01){return _0xd9c55d['status'](_0x2f7cd7)['json'](_0x204e01);}};}function respondWithFilteredResult(_0x1322a4,_0x8b706e){return function(_0x5df5cd){if(_0x5df5cd){var _0x4b38fc=_0x5df5cd['count'],_0x343466=_0x8b706e[_0xfa74('0x30')],_0x564060=_0x8b706e[_0xfa74('0x30')]+_0x8b706e[_0xfa74('0x31')],_0x2238d4;if(_0x564060>=_0x4b38fc){_0x564060=_0x4b38fc;_0x2238d4=0xc8;}else{_0x2238d4=0xce;}_0x1322a4[_0xfa74('0x2f')](_0x2238d4);return _0x1322a4['set'](_0xfa74('0x32'),_0x343466+'-'+_0x564060+'/'+_0x4b38fc)[_0xfa74('0x33')](_0x5df5cd);}return null;};}function patchUpdates(_0x317180){return function(_0x16f9dc){try{jsonpatch[_0xfa74('0x34')](_0x16f9dc,_0x317180,!![]);}catch(_0xb878c7){return BPromise[_0xfa74('0x35')](_0xb878c7);}return _0x16f9dc['save']();};}function saveUpdates(_0x20fc18,_0x5a9f43){return function(_0x74665c){if(_0x74665c){return _0x74665c[_0xfa74('0x36')](_0x20fc18)[_0xfa74('0x37')](function(_0x1b5ff0){return _0x1b5ff0;});}return null;};}function removeEntity(_0x562289,_0x5055d3){return function(_0x390ed4){if(_0x390ed4){return _0x390ed4[_0xfa74('0x38')]()[_0xfa74('0x37')](function(){var _0x25863f=_0x390ed4['get']({'plain':!![]});var _0x441eaa=_0xfa74('0x39');return db['UserProfileResource']['destroy']({'where':{'type':_0x441eaa,'resourceId':_0x25863f['id']}})['then'](function(){return _0x390ed4;});})['then'](function(){_0x562289['status'](0xcc)[_0xfa74('0x3a')]();});}};}function handleEntityNotFound(_0x1c3b44,_0x3dcda3){return function(_0x235607){if(!_0x235607){_0x1c3b44[_0xfa74('0x2e')](0x194);}return _0x235607;};}function handleError(_0x304f6e,_0x19094d){_0x19094d=_0x19094d||0x1f4;return function(_0x13475a){logger[_0xfa74('0x29')](_0x13475a['stack']);if(_0x13475a[_0xfa74('0x3b')]){delete _0x13475a[_0xfa74('0x3b')];}_0x304f6e[_0xfa74('0x2f')](_0x19094d)[_0xfa74('0x3c')](_0x13475a);};}exports[_0xfa74('0x3d')]=function(_0x186126,_0x5e58dd){var _0x4307be={'include':[{'model':db[_0xfa74('0x3e')],'as':'mandatoryDispositionPause'}]},_0x1f0806={},_0x12f22c={'count':0x0,'rows':[]};var _0x207566=_[_0xfa74('0x3f')](db[_0xfa74('0x40')][_0xfa74('0x41')],function(_0x565b5d){return{'name':_0x565b5d[_0xfa74('0x42')],'type':_0x565b5d[_0xfa74('0x43')][_0xfa74('0x44')]};});_0x1f0806['model']=_['map'](_0x207566,_0xfa74('0x3b'));_0x1f0806[_0xfa74('0x45')]=_[_0xfa74('0x46')](_0x186126[_0xfa74('0x45')]);_0x1f0806['filters']=_[_0xfa74('0x47')](_0x1f0806[_0xfa74('0x48')],_0x1f0806['query']);_0x4307be['attributes']=_['intersection'](_0x1f0806['model'],qs[_0xfa74('0x49')](_0x186126[_0xfa74('0x45')][_0xfa74('0x49')]));_0x4307be[_0xfa74('0x4a')]=_0x4307be[_0xfa74('0x4a')][_0xfa74('0x4b')]?_0x4307be[_0xfa74('0x4a')]:_0x1f0806['model'];if(!_0x186126[_0xfa74('0x45')][_0xfa74('0x4c')](_0xfa74('0x4d'))){_0x4307be[_0xfa74('0x31')]=qs[_0xfa74('0x31')](_0x186126['query'][_0xfa74('0x31')]);_0x4307be[_0xfa74('0x30')]=qs[_0xfa74('0x30')](_0x186126[_0xfa74('0x45')][_0xfa74('0x30')]);}_0x4307be[_0xfa74('0x4e')]=qs[_0xfa74('0x4f')](_0x186126[_0xfa74('0x45')][_0xfa74('0x4f')]);_0x4307be[_0xfa74('0x50')]=qs['filters'](_[_0xfa74('0x51')](_0x186126['query'],_0x1f0806[_0xfa74('0x52')]),_0x207566);if(_0x186126[_0xfa74('0x45')][_0xfa74('0x53')]){_0x4307be[_0xfa74('0x50')]=_['merge'](_0x4307be[_0xfa74('0x50')],{'$or':_[_0xfa74('0x3f')](_0x207566,function(_0x480287){if(_0x480287[_0xfa74('0x43')]!==_0xfa74('0x54')){var _0x5cbb70={};_0x5cbb70[_0x480287[_0xfa74('0x3b')]]={'$like':'%'+_0x186126[_0xfa74('0x45')][_0xfa74('0x53')]+'%'};return _0x5cbb70;}})});}_0x4307be=_[_0xfa74('0x55')]({},_0x4307be,_0x186126[_0xfa74('0x56')]);var _0x5e116b={'where':_0x4307be['where']};return db[_0xfa74('0x40')][_0xfa74('0x57')](_0x5e116b)['then'](function(_0x32e440){_0x12f22c[_0xfa74('0x57')]=_0x32e440;if(_0x186126[_0xfa74('0x45')]['includeAll']){_0x4307be['include']=[{'all':!![]}];}return db[_0xfa74('0x40')][_0xfa74('0x58')](_0x4307be);})[_0xfa74('0x37')](function(_0x186700){_0x12f22c[_0xfa74('0x59')]=_0x186700;return _0x12f22c;})[_0xfa74('0x37')](respondWithFilteredResult(_0x5e58dd,_0x4307be))[_0xfa74('0x2d')](handleError(_0x5e58dd,null));};exports[_0xfa74('0x5a')]=function(_0x58b985,_0x214994){var _0x361c17={'raw':![],'where':{'id':_0x58b985[_0xfa74('0x5b')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x26bb7e={};_0x26bb7e[_0xfa74('0x48')]=_['keys'](db[_0xfa74('0x40')][_0xfa74('0x41')]);_0x26bb7e[_0xfa74('0x45')]=_[_0xfa74('0x46')](_0x58b985[_0xfa74('0x45')]);_0x26bb7e[_0xfa74('0x52')]=_[_0xfa74('0x47')](_0x26bb7e['model'],_0x26bb7e[_0xfa74('0x45')]);_0x361c17['attributes']=_[_0xfa74('0x47')](_0x26bb7e['model'],qs['fields'](_0x58b985[_0xfa74('0x45')][_0xfa74('0x49')]));_0x361c17['attributes']=_0x361c17['attributes'][_0xfa74('0x4b')]?_0x361c17[_0xfa74('0x4a')]:_0x26bb7e[_0xfa74('0x48')];if(_0x58b985[_0xfa74('0x45')][_0xfa74('0x5c')]){_0x361c17[_0xfa74('0x5d')]=[{'all':!![]}];}_0x361c17=_[_0xfa74('0x55')]({},_0x361c17,_0x58b985[_0xfa74('0x56')]);return db[_0xfa74('0x40')][_0xfa74('0x5e')](_0x361c17)['then'](handleEntityNotFound(_0x214994,null))[_0xfa74('0x37')](respondWithResult(_0x214994,null))[_0xfa74('0x2d')](handleError(_0x214994,null));};exports['create']=function(_0x550974,_0x3d88dc){return db[_0xfa74('0x40')][_0xfa74('0x5f')](_0x550974[_0xfa74('0x60')],{})[_0xfa74('0x37')](function(_0x5475f1){var _0x36cfc6=_0x550974['user'][_0xfa74('0x61')]({'plain':!![]});if(!_0x36cfc6)throw new Error(_0xfa74('0x62'));if(_0x36cfc6[_0xfa74('0x63')]==='user'){var _0x5943b5=_0x5475f1[_0xfa74('0x61')]({'plain':!![]});var _0x48f895=_0xfa74('0x39');return db[_0xfa74('0x64')]['find']({'where':{'name':_0x48f895,'userProfileId':_0x36cfc6[_0xfa74('0x65')]},'raw':!![]})[_0xfa74('0x37')](function(_0x5a2494){if(_0x5a2494&&_0x5a2494[_0xfa74('0x66')]===0x0){return db[_0xfa74('0x67')][_0xfa74('0x5f')]({'name':_0x5943b5[_0xfa74('0x3b')],'resourceId':_0x5943b5['id'],'type':_0x5a2494['name'],'sectionId':_0x5a2494['id']},{})[_0xfa74('0x37')](function(){return _0x5475f1;});}else{return _0x5475f1;}})['catch'](function(_0x2c610a){logger[_0xfa74('0x29')](_0xfa74('0x68'),_0x2c610a);throw _0x2c610a;});}return _0x5475f1;})[_0xfa74('0x37')](respondWithResult(_0x3d88dc,0xc9))[_0xfa74('0x2d')](handleError(_0x3d88dc,null));};exports[_0xfa74('0x36')]=function(_0x1f355a,_0xc344eb){if(_0x1f355a[_0xfa74('0x60')]['id']){delete _0x1f355a[_0xfa74('0x60')]['id'];}return db[_0xfa74('0x40')][_0xfa74('0x5e')]({'where':{'id':_0x1f355a[_0xfa74('0x5b')]['id']},'include':[{'model':db[_0xfa74('0x3e')],'as':_0xfa74('0x69')}]})['then'](handleEntityNotFound(_0xc344eb,null))[_0xfa74('0x37')](saveUpdates(_0x1f355a[_0xfa74('0x60')],null))['then'](respondWithResult(_0xc344eb,null))['catch'](handleError(_0xc344eb,null));};exports[_0xfa74('0x38')]=function(_0x516e98,_0x126f09){return db[_0xfa74('0x40')][_0xfa74('0x5e')]({'where':{'id':_0x516e98['params']['id']}})[_0xfa74('0x37')](handleEntityNotFound(_0x126f09,null))['then'](removeEntity(_0x126f09,null))['catch'](handleError(_0x126f09,null));};exports[_0xfa74('0x6a')]=function(_0x1fccac,_0x1e3450){return db[_0xfa74('0x40')][_0xfa74('0x6a')]()[_0xfa74('0x37')](respondWithResult(_0x1e3450,null))[_0xfa74('0x2d')](handleError(_0x1e3450,null));};exports[_0xfa74('0x6b')]=function(_0x3dff70,_0xa16e7b,_0x2588bb){if(_0x3dff70['body']['id']){delete _0x3dff70[_0xfa74('0x60')]['id'];}return db['WhatsappAccount'][_0xfa74('0x5e')]({'where':{'id':_0x3dff70[_0xfa74('0x5b')]['id']}})[_0xfa74('0x37')](handleEntityNotFound(_0xa16e7b,null))['then'](function(_0x773f98){if(_0x773f98){_0x3dff70[_0xfa74('0x60')][_0xfa74('0x6c')]=_0x773f98['id'];return db['Disposition'][_0xfa74('0x5f')](_0x3dff70[_0xfa74('0x60')]);}})[_0xfa74('0x37')](respondWithResult(_0xa16e7b,null))[_0xfa74('0x2d')](handleError(_0xa16e7b,null));};exports[_0xfa74('0x6d')]=function(_0x5bd0e5,_0x31d315,_0xeaff0c){var _0xba054d={'raw':![],'where':{}};var _0x2f9aab={};var _0x30c871={'count':0x0,'rows':[]};return db[_0xfa74('0x40')][_0xfa74('0x6e')]({'where':{'id':_0x5bd0e5[_0xfa74('0x5b')]['id']}})[_0xfa74('0x37')](handleEntityNotFound(_0x31d315,null))[_0xfa74('0x37')](function(_0x1dccaa){if(_0x1dccaa){_0x2f9aab[_0xfa74('0x48')]=_['keys'](db[_0xfa74('0x6f')][_0xfa74('0x41')]);_0x2f9aab[_0xfa74('0x45')]=_[_0xfa74('0x46')](_0x5bd0e5[_0xfa74('0x45')]);_0x2f9aab[_0xfa74('0x52')]=_[_0xfa74('0x47')](_0x2f9aab[_0xfa74('0x48')],_0x2f9aab['query']);_0xba054d[_0xfa74('0x4a')]=_[_0xfa74('0x47')](_0x2f9aab[_0xfa74('0x48')],qs[_0xfa74('0x49')](_0x5bd0e5['query'][_0xfa74('0x49')]));_0xba054d[_0xfa74('0x4a')]=_0xba054d[_0xfa74('0x4a')][_0xfa74('0x4b')]?_0xba054d['attributes']:_0x2f9aab[_0xfa74('0x48')];if(!_0x5bd0e5['query']['hasOwnProperty'](_0xfa74('0x4d'))){_0xba054d['limit']=qs[_0xfa74('0x31')](_0x5bd0e5[_0xfa74('0x45')]['limit']);_0xba054d['offset']=qs[_0xfa74('0x30')](_0x5bd0e5[_0xfa74('0x45')][_0xfa74('0x30')]);}_0xba054d[_0xfa74('0x4e')]=qs['sort'](_0x5bd0e5['query']['sort']);_0xba054d[_0xfa74('0x50')]=qs[_0xfa74('0x52')](_[_0xfa74('0x51')](_0x5bd0e5[_0xfa74('0x45')],_0x2f9aab[_0xfa74('0x52')]));_0xba054d['where'][_0xfa74('0x6c')]=_0x1dccaa['id'];if(_0x5bd0e5[_0xfa74('0x45')][_0xfa74('0x53')]){_0xba054d[_0xfa74('0x50')]=_[_0xfa74('0x55')](_0xba054d[_0xfa74('0x50')],{'$or':_[_0xfa74('0x3f')](_0xba054d[_0xfa74('0x4a')],function(_0x8d123c){var _0x557e28={};_0x557e28[_0x8d123c]={'$like':'%'+_0x5bd0e5['query']['filter']+'%'};return _0x557e28;})});}_0xba054d=_[_0xfa74('0x55')]({},_0xba054d,_0x5bd0e5[_0xfa74('0x56')]);return db[_0xfa74('0x6f')][_0xfa74('0x57')]({'where':_0xba054d[_0xfa74('0x50')]})['then'](function(_0x3e4323){_0x30c871[_0xfa74('0x57')]=_0x3e4323;if(_0x5bd0e5['query'][_0xfa74('0x5c')]){_0xba054d['include']=[{'all':!![]}];}return db[_0xfa74('0x6f')][_0xfa74('0x58')](_0xba054d);})[_0xfa74('0x37')](function(_0x431573){_0x30c871[_0xfa74('0x59')]=_0x431573;return _0x30c871;});}})[_0xfa74('0x37')](respondWithFilteredResult(_0x31d315,_0xba054d))[_0xfa74('0x2d')](handleError(_0x31d315,null));};exports[_0xfa74('0x70')]=function(_0x5ca15d,_0x4f795b,_0x56c49c){return db[_0xfa74('0x40')][_0xfa74('0x5e')]({'where':{'id':_0x5ca15d['params']['id']}})[_0xfa74('0x37')](handleEntityNotFound(_0x4f795b,null))[_0xfa74('0x37')](function(_0x1f271b){if(_0x1f271b){return _0x1f271b[_0xfa74('0x70')](_0x5ca15d['query'][_0xfa74('0x71')]);}})['then'](respondWithStatusCode(_0x4f795b,null))['catch'](handleError(_0x4f795b,null));};exports[_0xfa74('0x72')]=function(_0x3fb1a4,_0x3d72cd,_0x4af5df){if(_0x3fb1a4[_0xfa74('0x60')]['id']){delete _0x3fb1a4[_0xfa74('0x60')]['id'];}return db['WhatsappAccount'][_0xfa74('0x5e')]({'where':{'id':_0x3fb1a4['params']['id']}})['then'](handleEntityNotFound(_0x3d72cd,null))['then'](function(_0x9d30ae){if(_0x9d30ae){_0x3fb1a4[_0xfa74('0x60')][_0xfa74('0x6c')]=_0x9d30ae['id'];return db[_0xfa74('0x73')][_0xfa74('0x5f')](_0x3fb1a4['body']);}})['then'](respondWithResult(_0x3d72cd,null))[_0xfa74('0x2d')](handleError(_0x3d72cd,null));};exports['getAnswers']=function(_0x90dfe7,_0x2d9311,_0x4075d3){var _0x3a9c87={'raw':![],'where':{}};var _0x2720a7={};var _0x4189a2={'count':0x0,'rows':[]};return db[_0xfa74('0x40')][_0xfa74('0x6e')]({'where':{'id':_0x90dfe7[_0xfa74('0x5b')]['id']}})['then'](handleEntityNotFound(_0x2d9311,null))[_0xfa74('0x37')](function(_0x1593d1){if(_0x1593d1){_0x2720a7[_0xfa74('0x48')]=_[_0xfa74('0x46')](db[_0xfa74('0x73')][_0xfa74('0x41')]);_0x2720a7[_0xfa74('0x45')]=_[_0xfa74('0x46')](_0x90dfe7[_0xfa74('0x45')]);_0x2720a7[_0xfa74('0x52')]=_[_0xfa74('0x47')](_0x2720a7['model'],_0x2720a7['query']);_0x3a9c87[_0xfa74('0x4a')]=_[_0xfa74('0x47')](_0x2720a7[_0xfa74('0x48')],qs['fields'](_0x90dfe7['query'][_0xfa74('0x49')]));_0x3a9c87[_0xfa74('0x4a')]=_0x3a9c87[_0xfa74('0x4a')][_0xfa74('0x4b')]?_0x3a9c87[_0xfa74('0x4a')]:_0x2720a7[_0xfa74('0x48')];if(!_0x90dfe7[_0xfa74('0x45')]['hasOwnProperty'](_0xfa74('0x4d'))){_0x3a9c87['limit']=qs['limit'](_0x90dfe7[_0xfa74('0x45')][_0xfa74('0x31')]);_0x3a9c87[_0xfa74('0x30')]=qs['offset'](_0x90dfe7[_0xfa74('0x45')]['offset']);}_0x3a9c87['order']=qs[_0xfa74('0x4f')](_0x90dfe7[_0xfa74('0x45')][_0xfa74('0x4f')]);_0x3a9c87[_0xfa74('0x50')]=qs[_0xfa74('0x52')](_[_0xfa74('0x51')](_0x90dfe7['query'],_0x2720a7[_0xfa74('0x52')]));_0x3a9c87[_0xfa74('0x50')]['WhatsappAccountId']=_0x1593d1['id'];if(_0x90dfe7[_0xfa74('0x45')][_0xfa74('0x53')]){_0x3a9c87[_0xfa74('0x50')]=_['merge'](_0x3a9c87[_0xfa74('0x50')],{'$or':_[_0xfa74('0x3f')](_0x3a9c87['attributes'],function(_0x26882e){var _0x348b6f={};_0x348b6f[_0x26882e]={'$like':'%'+_0x90dfe7[_0xfa74('0x45')]['filter']+'%'};return _0x348b6f;})});}_0x3a9c87=_[_0xfa74('0x55')]({},_0x3a9c87,_0x90dfe7['options']);return db['CannedAnswer'][_0xfa74('0x57')]({'where':_0x3a9c87['where']})[_0xfa74('0x37')](function(_0x40fa4c){_0x4189a2[_0xfa74('0x57')]=_0x40fa4c;if(_0x90dfe7[_0xfa74('0x45')][_0xfa74('0x5c')]){_0x3a9c87[_0xfa74('0x5d')]=[{'all':!![]}];}return db[_0xfa74('0x73')][_0xfa74('0x58')](_0x3a9c87);})[_0xfa74('0x37')](function(_0x2e9e2a){_0x4189a2['rows']=_0x2e9e2a;return _0x4189a2;});}})['then'](respondWithFilteredResult(_0x2d9311,_0x3a9c87))['catch'](handleError(_0x2d9311,null));};exports['removeAnswers']=function(_0x154f7f,_0x43834b,_0x5b1aa9){return db[_0xfa74('0x40')]['find']({'where':{'id':_0x154f7f[_0xfa74('0x5b')]['id']}})[_0xfa74('0x37')](handleEntityNotFound(_0x43834b,null))[_0xfa74('0x37')](function(_0x1de7ca){if(_0x1de7ca){return _0x1de7ca[_0xfa74('0x74')](_0x154f7f[_0xfa74('0x45')][_0xfa74('0x71')]);}})[_0xfa74('0x37')](respondWithStatusCode(_0x43834b,null))[_0xfa74('0x2d')](handleError(_0x43834b,null));};exports[_0xfa74('0x75')]=function(_0x119587,_0x566004,_0x2d0559){return db['WhatsappAccount'][_0xfa74('0x5e')]({'where':{'id':_0x119587['params']['id']}})[_0xfa74('0x37')](handleEntityNotFound(_0x566004,null))[_0xfa74('0x37')](function(_0xbf723e){if(_0xbf723e){return _0xbf723e['addAgents'](_0x119587[_0xfa74('0x60')][_0xfa74('0x71')],_[_0xfa74('0x76')](_0x119587[_0xfa74('0x60')],[_0xfa74('0x71'),'id'])||{})['spread'](function(_0x17e39e){for(var _0x3d806e=0x0;_0x3d806e<_0x119587[_0xfa74('0x60')]['ids'][_0xfa74('0x4b')];_0x3d806e+=0x1){socket[_0xfa74('0x77')]('userWhatsappAccount:save',{'UserId':_0x119587[_0xfa74('0x60')][_0xfa74('0x71')][_0x3d806e],'WhatsappAccountId':_0x119587[_0xfa74('0x5b')]['id']});}return _0x17e39e;});}})[_0xfa74('0x37')](respondWithResult(_0x566004,null))[_0xfa74('0x2d')](handleError(_0x566004,null));};exports[_0xfa74('0x78')]=function(_0x4ab8d8,_0x143c31,_0x2cf55d){return db[_0xfa74('0x40')][_0xfa74('0x5e')]({'where':{'id':_0x4ab8d8[_0xfa74('0x5b')]['id']}})[_0xfa74('0x37')](handleEntityNotFound(_0x143c31,null))[_0xfa74('0x37')](function(_0x29da93){if(_0x29da93){return _0x29da93['removeAgents'](_0x4ab8d8[_0xfa74('0x45')]['ids'])[_0xfa74('0x37')](function(){if(_['isArray'](_0x4ab8d8[_0xfa74('0x45')][_0xfa74('0x71')])){for(var _0x85539a=0x0;_0x85539a<_0x4ab8d8['query'][_0xfa74('0x71')]['length'];_0x85539a+=0x1){socket[_0xfa74('0x77')](_0xfa74('0x79'),{'UserId':Number(_0x4ab8d8[_0xfa74('0x45')][_0xfa74('0x71')][_0x85539a]),'WhatsappAccountId':Number(_0x4ab8d8['params']['id'])});}}else{socket[_0xfa74('0x77')](_0xfa74('0x79'),{'UserId':Number(_0x4ab8d8[_0xfa74('0x45')][_0xfa74('0x71')]),'WhatsappAccountId':Number(_0x4ab8d8[_0xfa74('0x5b')]['id'])});}});}})[_0xfa74('0x37')](respondWithStatusCode(_0x143c31,null))[_0xfa74('0x2d')](handleError(_0x143c31,null));};exports[_0xfa74('0x7a')]=function(_0x2418ce,_0x1dddb3,_0x346832){var _0x4c2930={};var _0x3069ce={};var _0x3908f9;var _0x416019;return db['WhatsappAccount'][_0xfa74('0x6e')]({'where':{'id':_0x2418ce[_0xfa74('0x5b')]['id']}})['then'](handleEntityNotFound(_0x1dddb3,null))[_0xfa74('0x37')](function(_0x4799e2){if(_0x4799e2){_0x3908f9=_0x4799e2;_0x3069ce[_0xfa74('0x48')]=_['keys'](db['User'][_0xfa74('0x41')]);_0x3069ce[_0xfa74('0x45')]=_[_0xfa74('0x46')](_0x2418ce['query']);_0x3069ce[_0xfa74('0x52')]=_['intersection'](_0x3069ce[_0xfa74('0x48')],_0x3069ce[_0xfa74('0x45')]);_0x4c2930[_0xfa74('0x4a')]=_[_0xfa74('0x47')](_0x3069ce[_0xfa74('0x48')],qs['fields'](_0x2418ce[_0xfa74('0x45')][_0xfa74('0x49')]));_0x4c2930[_0xfa74('0x4a')]=_0x4c2930[_0xfa74('0x4a')]['length']?_0x4c2930[_0xfa74('0x4a')]:_0x3069ce[_0xfa74('0x48')];_0x4c2930['order']=qs[_0xfa74('0x4f')](_0x2418ce[_0xfa74('0x45')][_0xfa74('0x4f')]);_0x4c2930[_0xfa74('0x50')]=qs[_0xfa74('0x52')](_[_0xfa74('0x51')](_0x2418ce[_0xfa74('0x45')],_0x3069ce[_0xfa74('0x52')]));if(_0x2418ce[_0xfa74('0x45')][_0xfa74('0x53')]){_0x4c2930[_0xfa74('0x50')]=_[_0xfa74('0x55')](_0x4c2930[_0xfa74('0x50')],{'$or':_[_0xfa74('0x3f')](_0x4c2930['attributes'],function(_0x397fdb){var _0x2466f7={};_0x2466f7[_0x397fdb]={'$like':'%'+_0x2418ce[_0xfa74('0x45')]['filter']+'%'};return _0x2466f7;})});}_0x4c2930=_[_0xfa74('0x55')]({},_0x4c2930,_0x2418ce['options']);return _0x3908f9[_0xfa74('0x7a')](_0x4c2930);}})[_0xfa74('0x37')](function(_0x3c2f4e){if(_0x3c2f4e){_0x416019=_0x3c2f4e[_0xfa74('0x4b')];if(!_0x2418ce[_0xfa74('0x45')]['hasOwnProperty']('nolimit')){_0x4c2930[_0xfa74('0x31')]=qs[_0xfa74('0x31')](_0x2418ce[_0xfa74('0x45')][_0xfa74('0x31')]);_0x4c2930[_0xfa74('0x30')]=qs[_0xfa74('0x30')](_0x2418ce[_0xfa74('0x45')][_0xfa74('0x30')]);}return _0x3908f9[_0xfa74('0x7a')](_0x4c2930);}})['then'](function(_0x5907ac){if(_0x5907ac){return _0x5907ac?{'count':_0x416019,'rows':_0x5907ac}:null;}})[_0xfa74('0x37')](respondWithResult(_0x1dddb3,null))[_0xfa74('0x2d')](handleError(_0x1dddb3,null));};exports[_0xfa74('0x7b')]=function(_0x43525d,_0x4505b2,_0x357202){return db['WhatsappAccount'][_0xfa74('0x6e')]({'where':{'id':_0x43525d[_0xfa74('0x5b')]['id']}})['then'](handleEntityNotFound(_0x4505b2,null))[_0xfa74('0x37')](function(_0x41a9bf){if(_0x41a9bf){return db[_0xfa74('0x7c')][_0xfa74('0x7d')](function(_0x55a8e0){return db[_0xfa74('0x7e')][_0xfa74('0x38')]({'where':{'WhatsappAccountId':_0x43525d[_0xfa74('0x5b')]['id']},'transaction':_0x55a8e0})['then'](function(_0x375850){var _0x3c3195=_[_0xfa74('0x3f')](_0x43525d['body'],function(_0x222605){_0x222605['WhatsappAccountId']=_0x43525d[_0xfa74('0x5b')]['id'];return _0x222605;});return db['WhatsappApplication'][_0xfa74('0x7f')](_0x3c3195,{'transaction':_0x55a8e0});});})[_0xfa74('0x37')](function(){return db[_0xfa74('0x7e')][_0xfa74('0x80')]({'where':{'WhatsappAccountId':_0x43525d[_0xfa74('0x5b')]['id']},'order':_0xfa74('0x81')});});}})[_0xfa74('0x37')](respondWithResult(_0x4505b2,null))[_0xfa74('0x2d')](handleError(_0x4505b2,null));};exports[_0xfa74('0x82')]=function(_0x6710e2,_0x4f11d5,_0x2a4341){var _0x39a711={};var _0x3a1041={};var _0x2dcdaf;var _0x462130;return db['WhatsappAccount'][_0xfa74('0x6e')]({'where':{'id':_0x6710e2[_0xfa74('0x5b')]['id']}})['then'](handleEntityNotFound(_0x4f11d5,null))[_0xfa74('0x37')](function(_0x33f55b){if(_0x33f55b){_0x2dcdaf=_0x33f55b;_0x3a1041['model']=_[_0xfa74('0x46')](db[_0xfa74('0x7e')]['rawAttributes']);_0x3a1041['query']=_[_0xfa74('0x46')](_0x6710e2[_0xfa74('0x45')]);_0x3a1041[_0xfa74('0x52')]=_['intersection'](_0x3a1041[_0xfa74('0x48')],_0x3a1041[_0xfa74('0x45')]);_0x39a711[_0xfa74('0x4a')]=_['intersection'](_0x3a1041[_0xfa74('0x48')],qs[_0xfa74('0x49')](_0x6710e2[_0xfa74('0x45')][_0xfa74('0x49')]));_0x39a711[_0xfa74('0x4a')]=_0x39a711['attributes'][_0xfa74('0x4b')]?_0x39a711[_0xfa74('0x4a')]:_0x3a1041[_0xfa74('0x48')];_0x39a711['order']=qs[_0xfa74('0x4f')](_0x6710e2[_0xfa74('0x45')][_0xfa74('0x4f')]);_0x39a711[_0xfa74('0x50')]=qs[_0xfa74('0x52')](_[_0xfa74('0x51')](_0x6710e2['query'],_0x3a1041[_0xfa74('0x52')]));if(_0x6710e2[_0xfa74('0x45')][_0xfa74('0x53')]){_0x39a711['where']=_[_0xfa74('0x55')](_0x39a711[_0xfa74('0x50')],{'$or':_[_0xfa74('0x3f')](_0x39a711['attributes'],function(_0x4ed29e){var _0x546a80={};_0x546a80[_0x4ed29e]={'$like':'%'+_0x6710e2[_0xfa74('0x45')]['filter']+'%'};return _0x546a80;})});}_0x39a711=_[_0xfa74('0x55')]({},_0x39a711,_0x6710e2[_0xfa74('0x56')]);return _0x2dcdaf['getApplications'](_0x39a711);}})[_0xfa74('0x37')](function(_0x4fcce4){if(_0x4fcce4){_0x462130=_0x4fcce4[_0xfa74('0x4b')];if(!_0x6710e2[_0xfa74('0x45')][_0xfa74('0x4c')](_0xfa74('0x4d'))){_0x39a711['limit']=qs[_0xfa74('0x31')](_0x6710e2[_0xfa74('0x45')]['limit']);_0x39a711[_0xfa74('0x30')]=qs['offset'](_0x6710e2[_0xfa74('0x45')][_0xfa74('0x30')]);}return _0x2dcdaf['getApplications'](_0x39a711);}})[_0xfa74('0x37')](function(_0x2272b1){if(_0x2272b1){return _0x2272b1?{'count':_0x462130,'rows':_0x2272b1}:null;}})[_0xfa74('0x37')](respondWithResult(_0x4f11d5,null))[_0xfa74('0x2d')](handleError(_0x4f11d5,null));};exports['notify']=function(_0xf5ee6f,_0x403528,_0x5e5a3c){var _0x1299ec={'channel':_0xfa74('0x83')};var _0x35d648=[];var _0x465f3d=[];var _0x50b739={};return db['WhatsappAccount'][_0xfa74('0x5e')]({'where':{'id':_0xf5ee6f['params']['id']},'include':[{'model':db[_0xfa74('0x7e')],'as':'Applications'}]})[_0xfa74('0x37')](handleEntityNotFound(_0x403528,null))[_0xfa74('0x37')](function(_0x3aed3d){_0x1299ec[_0xfa74('0x84')]=_0x3aed3d;_0x1299ec['applications']=_[_0xfa74('0x85')](_0x3aed3d[_0xfa74('0x86')],[_0xfa74('0x81')],[_0xfa74('0x87')]);if(_0x1299ec[_0xfa74('0x84')][_0xfa74('0x86')]){delete _0x1299ec[_0xfa74('0x84')]['Applications'];}return db[_0xfa74('0x88')][_0xfa74('0x6a')]();})[_0xfa74('0x37')](function(_0x216193){if(!_0x216193){throw new db[(_0xfa74('0x20'))][(_0xfa74('0x21'))](_0xfa74('0x89'));}_0x35d648=_[_0xfa74('0x8a')](_[_0xfa74('0x46')](_0x216193),[_0xfa74('0x8b'),_0xfa74('0x8c')]);_0x465f3d=_[_0xfa74('0x8a')](_[_0xfa74('0x46')](_0x216193),['createdAt',_0xfa74('0x8c'),'CompanyId',_0xfa74('0x8d')]);_0x1299ec[_0xfa74('0x60')]={'mapKey':'mobile'};if(_0x1299ec[_0xfa74('0x84')][_0xfa74('0x43')]&&_0x1299ec[_0xfa74('0x84')]['type']===_0xfa74('0x8e')){_0x1299ec[_0xfa74('0x60')][_0xfa74('0x8f')]=_0xf5ee6f[_0xfa74('0x60')][_0xfa74('0x90')]['replace'](_0xfa74('0x91'),'');_0x1299ec['body']['body']=_0xf5ee6f[_0xfa74('0x60')][_0xfa74('0x92')];_0x1299ec[_0xfa74('0x60')]['messageId']=_0xf5ee6f['body'][_0xfa74('0x93')];}if(_0x1299ec[_0xfa74('0x60')]['id']){delete _0x1299ec[_0xfa74('0x60')]['id'];}if(_[_0xfa74('0x94')](_0x1299ec[_0xfa74('0x60')]['from'])){throw new db[(_0xfa74('0x20'))][(_0xfa74('0x21'))]('from\x20is\x20mandatory');}if(_[_0xfa74('0x94')](_0x1299ec[_0xfa74('0x60')]['body'])||_0x1299ec[_0xfa74('0x60')]['body']===''){throw new db[(_0xfa74('0x20'))][(_0xfa74('0x21'))](_0xfa74('0x95'));}if(_[_0xfa74('0x94')](_0x1299ec[_0xfa74('0x60')]['mapKey'])){throw new db[(_0xfa74('0x20'))][(_0xfa74('0x21'))](_0xfa74('0x96')+_0x465f3d);}if(!_[_0xfa74('0x97')](_0x465f3d,_0x1299ec['body']['mapKey'])){throw new db[(_0xfa74('0x20'))]['ValidationError'](_0xfa74('0x98')+_0x465f3d);}_0x50b739[_0x1299ec[_0xfa74('0x60')][_0xfa74('0x99')]]=_0x1299ec[_0xfa74('0x60')]['from'];return db[_0xfa74('0x9a')]['find']({'where':{'id':_0x1299ec[_0xfa74('0x84')][_0xfa74('0x8d')]},'include':[{'model':db[_0xfa74('0x88')],'as':_0xfa74('0x9b'),'where':_0x50b739,'limit':0x1,'order':[[_0xfa74('0x8c'),'DESC']]}]});})[_0xfa74('0x37')](handleEntityNotFound(_0x403528,null))['then'](function(_0x16a6e6){if(_0x16a6e6){_0x1299ec['list']=_[_0xfa74('0x76')](_0x16a6e6,['Contacts']);if(_0x16a6e6[_0xfa74('0x9b')]['length']){return _0x16a6e6[_0xfa74('0x9b')][0x0];}var _0x4a68ca=_[_0xfa74('0x16')](_0x1299ec[_0xfa74('0x60')],{'firstName':_0x1299ec[_0xfa74('0x60')]['from'],'ListId':_0x16a6e6['id']});_0x4a68ca[_0x1299ec['body'][_0xfa74('0x99')]]=_0x1299ec[_0xfa74('0x60')][_0xfa74('0x8f')];return db[_0xfa74('0x88')]['create'](_0x4a68ca,{'fields':_0x35d648,'raw':!![]});}})[_0xfa74('0x37')](handleEntityNotFound(_0x403528,null))[_0xfa74('0x37')](function(_0x351ddb){if(_0x351ddb){_0x1299ec['contact']=_0x351ddb;var _0x87020e={'ContactId':_0x351ddb['id'],'phone':_0x1299ec[_0xfa74('0x60')][_0xfa74('0x8f')],'WhatsappAccountId':_0xf5ee6f[_0xfa74('0x5b')]['id']};var _0x5e7eb7={'ContactId':_0x351ddb['id'],'WhatsappAccountId':_0xf5ee6f[_0xfa74('0x5b')]['id'],'closed':![]};return db[_0xfa74('0x9c')][_0xfa74('0x5e')]({'where':_0x5e7eb7})[_0xfa74('0x37')](function(_0x5ef7ae){if(_0x5ef7ae){return[_0x5ef7ae,![]];}return db['WhatsappInteraction'][_0xfa74('0x5f')](_0x87020e)['then'](function(_0x5affdc){return[_0x5affdc,!![]];});});}})['spread'](function(_0x5b2df5,_0x43b948){_0x1299ec[_0xfa74('0x9d')]=_0x5b2df5[_0xfa74('0x61')]({'plain':!![]});_0x1299ec[_0xfa74('0x9d')][_0xfa74('0x9e')]=![];if(_0x43b948){if(_0x1299ec[_0xfa74('0x84')][_0xfa74('0x9f')]){_0x1299ec[_0xfa74('0xa0')][_0xfa74('0xa1')]({'id':0x0,'priority':_0x1299ec[_0xfa74('0xa0')][_0xfa74('0x4b')]+0x1,'app':'close','appdata':_0xfa74('0xa2'),'interval':_0xfa74('0xa3')});}_0x1299ec[_0xfa74('0x9d')]['created']=!![];}return db[_0xfa74('0xa4')][_0xfa74('0x5f')]({'phone':_0x1299ec[_0xfa74('0x60')][_0xfa74('0x8f')],'messageId':_0x1299ec[_0xfa74('0x60')]['messageId'],'body':_0x1299ec['body'][_0xfa74('0x60')],'WhatsappAccountId':_0xf5ee6f[_0xfa74('0x5b')]['id'],'WhatsappInteractionId':_0x5b2df5['id'],'direction':'in','ContactId':_0x5b2df5['ContactId'],'AttachmentId':_0x1299ec[_0xfa74('0x60')][_0xfa74('0xa5')]});})[_0xfa74('0x37')](function(_0x7fd6f){_0x1299ec[_0xfa74('0x2b')]=_0x7fd6f;if(_0x1299ec['interaction'][_0xfa74('0xa6')]){return db[_0xfa74('0xa7')][_0xfa74('0x5e')]({'attributes':['id',_0xfa74('0x3b')],'where':{'id':_0x1299ec[_0xfa74('0x9d')]['UserId']}})['then'](function(_0x1d2220){if(_0x1d2220){_0x1299ec[_0xfa74('0xa0')]['unshift']({'id':0x0,'priority':0x0,'app':_0xfa74('0xa8'),'appdata':_0x1d2220[_0xfa74('0x3b')]+','+(_0x1299ec[_0xfa74('0x84')][_0xfa74('0xa9')]||0xa),'interval':_0xfa74('0xa3')});}return respondWithRpcPromise(_0xfa74('0xaa'),'startRouting',_0x1299ec);});}return respondWithRpcPromise(_0xfa74('0xaa'),'startRouting',_0x1299ec);})[_0xfa74('0x37')](function(_0x504fbf){if(_0x504fbf){var _0x49198a=0xc8;var _0x3bfda8=_0xfa74('0xab');logger[_0xfa74('0x24')](_0xfa74('0x27'),_0x3bfda8,_0x49198a,'entity\x20found');logger[_0xfa74('0x26')](_0xfa74('0xac'),_0x3bfda8,_0x49198a,_0xfa74('0xad'),JSON[_0xfa74('0xae')](_0x504fbf));if(_0x1299ec[_0xfa74('0x84')][_0xfa74('0x43')]===_0xfa74('0x8e')){return _0x403528[_0xfa74('0x2f')](_0x49198a)[_0xfa74('0xaf')](_0xfa74('0xb0'),_0xfa74('0xb1'))[_0xfa74('0x3c')](_0xfa74('0xb2'));}else{return _0x403528['status'](_0x49198a)[_0xfa74('0x33')](_0x504fbf);}}})[_0xfa74('0x2d')](handleError(_0x403528,null));};exports['send']=function(_0x15ada9,_0x2389d3,_0x339079){var _0xa760ba,_0x267144,_0x211153;if(_[_0xfa74('0x94')](_0x15ada9[_0xfa74('0x60')][_0xfa74('0x60')])||_0x15ada9[_0xfa74('0x60')]['body']===''){throw new db[(_0xfa74('0x20'))][(_0xfa74('0x21'))](_0xfa74('0x95'));}if(_[_0xfa74('0x94')](_0x15ada9[_0xfa74('0x60')]['to'])){throw new db[(_0xfa74('0x20'))][(_0xfa74('0x21'))](_0xfa74('0xb3'));}_0xa760ba=_0x15ada9[_0xfa74('0x60')]['to'];return db[_0xfa74('0x40')][_0xfa74('0x5e')]({'where':{'id':_0x15ada9[_0xfa74('0x5b')]['id']},'include':[{'model':db[_0xfa74('0x9a')],'as':_0xfa74('0xb4'),'include':[{'model':db[_0xfa74('0x88')],'as':'Contacts','where':{'mobile':_0xa760ba},'limit':0x1,'order':[[_0xfa74('0x8c'),_0xfa74('0xb5')]]}]}]})['then'](handleEntityNotFound(_0x2389d3,null))[_0xfa74('0x37')](function(_0x124930){if(_0x124930&&_0x124930[_0xfa74('0xb4')]){_0x267144=_0x124930[_0xfa74('0x61')]({'plain':!![]});if(_0x267144[_0xfa74('0xb4')]&&_0x267144[_0xfa74('0xb4')][_0xfa74('0x9b')][_0xfa74('0x4b')]){return _0x267144[_0xfa74('0xb4')][_0xfa74('0x9b')][0x0];}return db[_0xfa74('0x88')]['create'](_[_0xfa74('0x16')](_0x15ada9[_0xfa74('0x60')],{'firstName':_0xa760ba,'mobile':_0xa760ba,'phone':_0xa760ba,'ListId':_0x267144[_0xfa74('0x8d')]}));}})[_0xfa74('0x37')](handleEntityNotFound(_0x2389d3,null))[_0xfa74('0x37')](function(_0x392a41){if(_0x392a41){_0x211153=_0x392a41;return db[_0xfa74('0x9c')][_0xfa74('0x5e')]({'where':{'ContactId':_0x211153['id'],'closed':![],'WhatsappAccountId':_0x267144['id']}})[_0xfa74('0x37')](function(_0x44c13a){if(_0x44c13a){return[_0x44c13a,![]];}return db[_0xfa74('0x9c')][_0xfa74('0x5f')]({'UserId':_0x15ada9[_0xfa74('0xb6')]['id'],'ContactId':_0x211153['id'],'WhatsappAccountId':_0x267144['id'],'phone':_0xa760ba,'firstMsgDirection':_0xfa74('0xb7'),'Messages':[_[_0xfa74('0x55')](_0x15ada9[_0xfa74('0x60')],{'read':![],'body':_0x15ada9[_0xfa74('0x60')][_0xfa74('0x60')],'phone':_0xa760ba,'WhatsappAccountId':_0x267144['id'],'UserId':_0x15ada9[_0xfa74('0xb6')]['id'],'ContactId':_0x211153['id']})]},{'include':[{'model':db['WhatsappMessage'],'as':_0xfa74('0xb8')}]})[_0xfa74('0x37')](function(_0x15b038){return[_0x15b038,!![]];});});}})[_0xfa74('0xb9')](function(_0x4e5ec6,_0x270c2d){if(_0x270c2d){return _0x4e5ec6;}return db[_0xfa74('0xa4')]['create'](_[_0xfa74('0x55')](_0x15ada9[_0xfa74('0x60')],{'read':![],'body':_0x15ada9['body'][_0xfa74('0x60')],'phone':_0xa760ba,'WhatsappAccountId':_0x267144['id'],'WhatsappInteractionId':_0x4e5ec6['id'],'UserId':_0x15ada9[_0xfa74('0xb6')]['id'],'ContactId':_0x211153['id']}))[_0xfa74('0x37')](function(_0xd31a80){_0x4e5ec6['dataValues']['Messages']=[];_0x4e5ec6[_0xfa74('0xba')][_0xfa74('0xb8')]['push'](_0xd31a80[_0xfa74('0xba')]);return _0x4e5ec6;});})[_0xfa74('0x37')](respondWithResult(_0x2389d3,null))[_0xfa74('0x2d')](handleError(_0x2389d3,null));}; \ No newline at end of file +var _0x2f68=['ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','request\x20sent','debug','stringify','error','message','WhatsappAccount,\x20%s,\x20%s','catch','sendStatus','status','json','count','offset','limit','set','apply','reject','save','update','destroy','get','WhatsappAccounts','UserProfileResource','end','stack','name','send','Pause','map','WhatsappAccount','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','show','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','params','Disposition','getDispositions','findOne','keys','WhatsappAccountId','include','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addAgents','omit','spread','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','sequelize','transaction','WhatsappApplication','bulkCreate','findAndCountAll','priority','getApplications','notify','whatsapp','account','applications','orderBy','asc','Applications','CmContact','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','mobile','From','Body','messageId','MessageSid','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','from','CmList','ListId','Contacts','DESC','list','contact','WhatsappInteraction','interaction','autoclose','push','close','unmanaged','*,*,*,*','WhatsappMessage','ContactId','AttachmentId','User','UserId','unshift','agent','Start','startRouting','receiveMessage','WhatsappAccount,\x20%s,\x20%s,\x20%s','entity\x20found','twilio','text/xml','to\x20is\x20mandatory','List','dataValues','Messages','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','sox','to-csv','squel','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','client','http','test','Sequelize'];(function(_0x335a1b,_0x5b2952){var _0x18f763=function(_0x5c550a){while(--_0x5c550a){_0x335a1b['push'](_0x335a1b['shift']());}};_0x18f763(++_0x5b2952);}(_0x2f68,0x9a));var _0x82f6=function(_0x5b7cd7,_0x4d8f19){_0x5b7cd7=_0x5b7cd7-0x0;var _0x28a6bc=_0x2f68[_0x5b7cd7];return _0x28a6bc;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x82f6('0x0'));var rimraf=require(_0x82f6('0x1'));var zipdir=require(_0x82f6('0x2'));var jsonpatch=require(_0x82f6('0x3'));var rp=require('request-promise');var moment=require(_0x82f6('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x82f6('0x5'));var util=require(_0x82f6('0x6'));var path=require('path');var sox=require(_0x82f6('0x7'));var csv=require(_0x82f6('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x82f6('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x82f6('0xa'));var toCsv=require(_0x82f6('0x8'));var querystring=require(_0x82f6('0xb'));var Papa=require('papaparse');var Redis=require(_0x82f6('0xc'));var authService=require(_0x82f6('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x82f6('0xe'));var hardwareService=require(_0x82f6('0xf'));var logger=require(_0x82f6('0x10'))(_0x82f6('0x11'));var utils=require(_0x82f6('0x12'));var config=require(_0x82f6('0x13'));var db=require('../../mysqldb')['db'];config[_0x82f6('0x14')]=_[_0x82f6('0x15')](config['redis'],{'host':_0x82f6('0x16'),'port':0x18eb});var socket=require(_0x82f6('0x17'))(new Redis(config[_0x82f6('0x14')]));require(_0x82f6('0x18'))[_0x82f6('0x19')](socket);var jayson=require(_0x82f6('0x1a'));var client=jayson[_0x82f6('0x1b')][_0x82f6('0x1c')]({'port':0x232c});function checkPasswordPattern(_0x1e7cbc,_0x55b58e,_0x389949){if(_0x389949){var _0x5d0827=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5d0827[_0x82f6('0x1d')](_0x55b58e)){return _0x1e7cbc;}else{throw new db[(_0x82f6('0x1e'))][(_0x82f6('0x1f'))](_0x82f6('0x20'));}}else{return _0x1e7cbc;}}function respondWithRpcPromise(_0x18e8dd,_0x2326ae,_0x326378,_0xcbc95f){return new BPromise(function(_0x4072f0,_0x2bfd57){var _0x1c79f9=_0xcbc95f||client;return _0x1c79f9[_0x82f6('0x21')](_0x18e8dd,_0x326378)[_0x82f6('0x22')](function(_0x4fe226){logger[_0x82f6('0x23')]('WhatsappAccount,\x20%s,\x20%s',_0x2326ae,_0x82f6('0x24'));logger[_0x82f6('0x25')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x2326ae,_0x82f6('0x24'),JSON[_0x82f6('0x26')](_0x4fe226));if(_0x4fe226[_0x82f6('0x27')]){if(_0x4fe226[_0x82f6('0x27')]['code']===0x1f4){logger[_0x82f6('0x27')]('WhatsappAccount,\x20%s,\x20%s',_0x2326ae,_0x4fe226[_0x82f6('0x27')][_0x82f6('0x28')]);return _0x2bfd57(_0x4fe226['error']['message']);}logger[_0x82f6('0x27')](_0x82f6('0x29'),_0x2326ae,_0x4fe226['error']['message']);return _0x4072f0(_0x4fe226[_0x82f6('0x27')][_0x82f6('0x28')]);}else{logger['info'](_0x82f6('0x29'),_0x2326ae,_0x82f6('0x24'));_0x4072f0(_0x4fe226['result']['message']);}})[_0x82f6('0x2a')](function(_0x5187d0){logger[_0x82f6('0x27')](_0x82f6('0x29'),_0x2326ae,_0x5187d0);_0x2bfd57(_0x5187d0);});});}function respondWithStatusCode(_0x54ce11,_0x3795ef){_0x3795ef=_0x3795ef||0xcc;return function(_0x15c9b7){if(_0x15c9b7){return _0x54ce11[_0x82f6('0x2b')](_0x3795ef);}return _0x54ce11[_0x82f6('0x2c')](_0x3795ef)['end']();};}function respondWithResult(_0x40a071,_0x1fb461){_0x1fb461=_0x1fb461||0xc8;return function(_0x14a309){if(_0x14a309){return _0x40a071[_0x82f6('0x2c')](_0x1fb461)[_0x82f6('0x2d')](_0x14a309);}};}function respondWithFilteredResult(_0x328707,_0x27e473){return function(_0x475d91){if(_0x475d91){var _0x1e1aa4=_0x475d91[_0x82f6('0x2e')],_0x402449=_0x27e473[_0x82f6('0x2f')],_0x3c9419=_0x27e473['offset']+_0x27e473[_0x82f6('0x30')],_0x20d1c5;if(_0x3c9419>=_0x1e1aa4){_0x3c9419=_0x1e1aa4;_0x20d1c5=0xc8;}else{_0x20d1c5=0xce;}_0x328707[_0x82f6('0x2c')](_0x20d1c5);return _0x328707[_0x82f6('0x31')]('Content-Range',_0x402449+'-'+_0x3c9419+'/'+_0x1e1aa4)[_0x82f6('0x2d')](_0x475d91);}return null;};}function patchUpdates(_0x3807c0){return function(_0x831131){try{jsonpatch[_0x82f6('0x32')](_0x831131,_0x3807c0,!![]);}catch(_0x41cd65){return BPromise[_0x82f6('0x33')](_0x41cd65);}return _0x831131[_0x82f6('0x34')]();};}function saveUpdates(_0x299c36,_0x4756ee){return function(_0x2958fe){if(_0x2958fe){return _0x2958fe[_0x82f6('0x35')](_0x299c36)[_0x82f6('0x22')](function(_0x1e028a){return _0x1e028a;});}return null;};}function removeEntity(_0x2dbce0,_0x4c45a4){return function(_0x13a409){if(_0x13a409){return _0x13a409[_0x82f6('0x36')]()[_0x82f6('0x22')](function(){var _0x276451=_0x13a409[_0x82f6('0x37')]({'plain':!![]});var _0x4390a9=_0x82f6('0x38');return db[_0x82f6('0x39')][_0x82f6('0x36')]({'where':{'type':_0x4390a9,'resourceId':_0x276451['id']}})[_0x82f6('0x22')](function(){return _0x13a409;});})[_0x82f6('0x22')](function(){_0x2dbce0[_0x82f6('0x2c')](0xcc)[_0x82f6('0x3a')]();});}};}function handleEntityNotFound(_0x34665a,_0x50f4f1){return function(_0x1e98a2){if(!_0x1e98a2){_0x34665a['sendStatus'](0x194);}return _0x1e98a2;};}function handleError(_0x4dd445,_0x321fdc){_0x321fdc=_0x321fdc||0x1f4;return function(_0x18c81e){logger['error'](_0x18c81e[_0x82f6('0x3b')]);if(_0x18c81e[_0x82f6('0x3c')]){delete _0x18c81e[_0x82f6('0x3c')];}_0x4dd445['status'](_0x321fdc)[_0x82f6('0x3d')](_0x18c81e);};}exports['index']=function(_0x2be8cf,_0x5f48cf){var _0x452463={'include':[{'model':db[_0x82f6('0x3e')],'as':'mandatoryDispositionPause'}]},_0x47ef9e={},_0x3db3a4={'count':0x0,'rows':[]};var _0xfce1dd=_[_0x82f6('0x3f')](db[_0x82f6('0x40')][_0x82f6('0x41')],function(_0x51af8f){return{'name':_0x51af8f[_0x82f6('0x42')],'type':_0x51af8f[_0x82f6('0x43')][_0x82f6('0x44')]};});_0x47ef9e[_0x82f6('0x45')]=_['map'](_0xfce1dd,_0x82f6('0x3c'));_0x47ef9e[_0x82f6('0x46')]=_['keys'](_0x2be8cf[_0x82f6('0x46')]);_0x47ef9e[_0x82f6('0x47')]=_[_0x82f6('0x48')](_0x47ef9e[_0x82f6('0x45')],_0x47ef9e[_0x82f6('0x46')]);_0x452463['attributes']=_[_0x82f6('0x48')](_0x47ef9e['model'],qs[_0x82f6('0x49')](_0x2be8cf[_0x82f6('0x46')][_0x82f6('0x49')]));_0x452463[_0x82f6('0x4a')]=_0x452463[_0x82f6('0x4a')][_0x82f6('0x4b')]?_0x452463[_0x82f6('0x4a')]:_0x47ef9e['model'];if(!_0x2be8cf[_0x82f6('0x46')][_0x82f6('0x4c')](_0x82f6('0x4d'))){_0x452463[_0x82f6('0x30')]=qs['limit'](_0x2be8cf[_0x82f6('0x46')]['limit']);_0x452463[_0x82f6('0x2f')]=qs[_0x82f6('0x2f')](_0x2be8cf[_0x82f6('0x46')][_0x82f6('0x2f')]);}_0x452463[_0x82f6('0x4e')]=qs[_0x82f6('0x4f')](_0x2be8cf['query'][_0x82f6('0x4f')]);_0x452463[_0x82f6('0x50')]=qs[_0x82f6('0x47')](_[_0x82f6('0x51')](_0x2be8cf[_0x82f6('0x46')],_0x47ef9e[_0x82f6('0x47')]),_0xfce1dd);if(_0x2be8cf[_0x82f6('0x46')][_0x82f6('0x52')]){_0x452463['where']=_[_0x82f6('0x53')](_0x452463[_0x82f6('0x50')],{'$or':_['map'](_0xfce1dd,function(_0xfedf51){if(_0xfedf51['type']!==_0x82f6('0x54')){var _0x5e3321={};_0x5e3321[_0xfedf51[_0x82f6('0x3c')]]={'$like':'%'+_0x2be8cf[_0x82f6('0x46')][_0x82f6('0x52')]+'%'};return _0x5e3321;}})});}_0x452463=_[_0x82f6('0x53')]({},_0x452463,_0x2be8cf[_0x82f6('0x55')]);var _0x2fdcc6={'where':_0x452463['where']};return db[_0x82f6('0x40')][_0x82f6('0x2e')](_0x2fdcc6)['then'](function(_0x5f3d1d){_0x3db3a4[_0x82f6('0x2e')]=_0x5f3d1d;if(_0x2be8cf[_0x82f6('0x46')][_0x82f6('0x56')]){_0x452463['include']=[{'all':!![]}];}return db[_0x82f6('0x40')][_0x82f6('0x57')](_0x452463);})[_0x82f6('0x22')](function(_0x12d165){_0x3db3a4['rows']=_0x12d165;return _0x3db3a4;})['then'](respondWithFilteredResult(_0x5f48cf,_0x452463))[_0x82f6('0x2a')](handleError(_0x5f48cf,null));};exports[_0x82f6('0x58')]=function(_0x12430b,_0x5231bb){var _0x44b420={'raw':![],'where':{'id':_0x12430b['params']['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x26194c={};_0x26194c[_0x82f6('0x45')]=_['keys'](db[_0x82f6('0x40')]['rawAttributes']);_0x26194c[_0x82f6('0x46')]=_['keys'](_0x12430b[_0x82f6('0x46')]);_0x26194c['filters']=_[_0x82f6('0x48')](_0x26194c[_0x82f6('0x45')],_0x26194c[_0x82f6('0x46')]);_0x44b420[_0x82f6('0x4a')]=_[_0x82f6('0x48')](_0x26194c[_0x82f6('0x45')],qs['fields'](_0x12430b[_0x82f6('0x46')][_0x82f6('0x49')]));_0x44b420[_0x82f6('0x4a')]=_0x44b420['attributes']['length']?_0x44b420[_0x82f6('0x4a')]:_0x26194c[_0x82f6('0x45')];if(_0x12430b[_0x82f6('0x46')][_0x82f6('0x56')]){_0x44b420['include']=[{'all':!![]}];}_0x44b420=_[_0x82f6('0x53')]({},_0x44b420,_0x12430b[_0x82f6('0x55')]);return db[_0x82f6('0x40')]['find'](_0x44b420)['then'](handleEntityNotFound(_0x5231bb,null))['then'](respondWithResult(_0x5231bb,null))[_0x82f6('0x2a')](handleError(_0x5231bb,null));};exports[_0x82f6('0x59')]=function(_0x221cfc,_0x59176d){return db[_0x82f6('0x40')][_0x82f6('0x59')](_0x221cfc[_0x82f6('0x5a')],{})[_0x82f6('0x22')](function(_0x51791c){var _0x255da2=_0x221cfc[_0x82f6('0x5b')][_0x82f6('0x37')]({'plain':!![]});if(!_0x255da2)throw new Error(_0x82f6('0x5c'));if(_0x255da2['role']==='user'){var _0x264032=_0x51791c[_0x82f6('0x37')]({'plain':!![]});var _0x539e44=_0x82f6('0x38');return db[_0x82f6('0x5d')][_0x82f6('0x5e')]({'where':{'name':_0x539e44,'userProfileId':_0x255da2['userProfileId']},'raw':!![]})[_0x82f6('0x22')](function(_0x195088){if(_0x195088&&_0x195088[_0x82f6('0x5f')]===0x0){return db[_0x82f6('0x39')][_0x82f6('0x59')]({'name':_0x264032[_0x82f6('0x3c')],'resourceId':_0x264032['id'],'type':_0x195088['name'],'sectionId':_0x195088['id']},{})[_0x82f6('0x22')](function(){return _0x51791c;});}else{return _0x51791c;}})[_0x82f6('0x2a')](function(_0x92b7a3){logger[_0x82f6('0x27')](_0x82f6('0x60'),_0x92b7a3);throw _0x92b7a3;});}return _0x51791c;})['then'](respondWithResult(_0x59176d,0xc9))[_0x82f6('0x2a')](handleError(_0x59176d,null));};exports[_0x82f6('0x35')]=function(_0x182ad8,_0x2ba70b){if(_0x182ad8[_0x82f6('0x5a')]['id']){delete _0x182ad8[_0x82f6('0x5a')]['id'];}return db[_0x82f6('0x40')][_0x82f6('0x5e')]({'where':{'id':_0x182ad8['params']['id']},'include':[{'model':db[_0x82f6('0x3e')],'as':'mandatoryDispositionPause'}]})[_0x82f6('0x22')](handleEntityNotFound(_0x2ba70b,null))[_0x82f6('0x22')](saveUpdates(_0x182ad8['body'],null))[_0x82f6('0x22')](respondWithResult(_0x2ba70b,null))[_0x82f6('0x2a')](handleError(_0x2ba70b,null));};exports[_0x82f6('0x36')]=function(_0x5705f2,_0x5c96e8){return db[_0x82f6('0x40')][_0x82f6('0x5e')]({'where':{'id':_0x5705f2['params']['id']}})['then'](handleEntityNotFound(_0x5c96e8,null))[_0x82f6('0x22')](removeEntity(_0x5c96e8,null))[_0x82f6('0x2a')](handleError(_0x5c96e8,null));};exports[_0x82f6('0x61')]=function(_0x3b3712,_0x4589e1){return db[_0x82f6('0x40')][_0x82f6('0x61')]()[_0x82f6('0x22')](respondWithResult(_0x4589e1,null))[_0x82f6('0x2a')](handleError(_0x4589e1,null));};exports[_0x82f6('0x62')]=function(_0x385902,_0x41354f,_0x53d931){if(_0x385902[_0x82f6('0x5a')]['id']){delete _0x385902[_0x82f6('0x5a')]['id'];}return db[_0x82f6('0x40')][_0x82f6('0x5e')]({'where':{'id':_0x385902[_0x82f6('0x63')]['id']}})['then'](handleEntityNotFound(_0x41354f,null))[_0x82f6('0x22')](function(_0x46d5af){if(_0x46d5af){_0x385902[_0x82f6('0x5a')]['WhatsappAccountId']=_0x46d5af['id'];return db[_0x82f6('0x64')][_0x82f6('0x59')](_0x385902[_0x82f6('0x5a')]);}})[_0x82f6('0x22')](respondWithResult(_0x41354f,null))[_0x82f6('0x2a')](handleError(_0x41354f,null));};exports[_0x82f6('0x65')]=function(_0x2c6e37,_0x579a2c,_0x44eb97){var _0x5d3d27={'raw':![],'where':{}};var _0x28f36a={};var _0x97b95b={'count':0x0,'rows':[]};return db[_0x82f6('0x40')][_0x82f6('0x66')]({'where':{'id':_0x2c6e37[_0x82f6('0x63')]['id']}})[_0x82f6('0x22')](handleEntityNotFound(_0x579a2c,null))[_0x82f6('0x22')](function(_0x316647){if(_0x316647){_0x28f36a[_0x82f6('0x45')]=_['keys'](db[_0x82f6('0x64')][_0x82f6('0x41')]);_0x28f36a[_0x82f6('0x46')]=_[_0x82f6('0x67')](_0x2c6e37[_0x82f6('0x46')]);_0x28f36a[_0x82f6('0x47')]=_['intersection'](_0x28f36a[_0x82f6('0x45')],_0x28f36a[_0x82f6('0x46')]);_0x5d3d27['attributes']=_['intersection'](_0x28f36a[_0x82f6('0x45')],qs[_0x82f6('0x49')](_0x2c6e37[_0x82f6('0x46')][_0x82f6('0x49')]));_0x5d3d27[_0x82f6('0x4a')]=_0x5d3d27[_0x82f6('0x4a')]['length']?_0x5d3d27[_0x82f6('0x4a')]:_0x28f36a['model'];if(!_0x2c6e37[_0x82f6('0x46')]['hasOwnProperty'](_0x82f6('0x4d'))){_0x5d3d27['limit']=qs[_0x82f6('0x30')](_0x2c6e37[_0x82f6('0x46')][_0x82f6('0x30')]);_0x5d3d27['offset']=qs[_0x82f6('0x2f')](_0x2c6e37['query'][_0x82f6('0x2f')]);}_0x5d3d27[_0x82f6('0x4e')]=qs[_0x82f6('0x4f')](_0x2c6e37['query'][_0x82f6('0x4f')]);_0x5d3d27[_0x82f6('0x50')]=qs[_0x82f6('0x47')](_['pick'](_0x2c6e37['query'],_0x28f36a[_0x82f6('0x47')]));_0x5d3d27[_0x82f6('0x50')][_0x82f6('0x68')]=_0x316647['id'];if(_0x2c6e37[_0x82f6('0x46')][_0x82f6('0x52')]){_0x5d3d27[_0x82f6('0x50')]=_[_0x82f6('0x53')](_0x5d3d27[_0x82f6('0x50')],{'$or':_['map'](_0x5d3d27[_0x82f6('0x4a')],function(_0x34de40){var _0x5c8045={};_0x5c8045[_0x34de40]={'$like':'%'+_0x2c6e37[_0x82f6('0x46')][_0x82f6('0x52')]+'%'};return _0x5c8045;})});}_0x5d3d27=_[_0x82f6('0x53')]({},_0x5d3d27,_0x2c6e37['options']);return db[_0x82f6('0x64')][_0x82f6('0x2e')]({'where':_0x5d3d27[_0x82f6('0x50')]})[_0x82f6('0x22')](function(_0x50ab5c){_0x97b95b[_0x82f6('0x2e')]=_0x50ab5c;if(_0x2c6e37[_0x82f6('0x46')][_0x82f6('0x56')]){_0x5d3d27[_0x82f6('0x69')]=[{'all':!![]}];}return db[_0x82f6('0x64')][_0x82f6('0x57')](_0x5d3d27);})['then'](function(_0x4271f1){_0x97b95b[_0x82f6('0x6a')]=_0x4271f1;return _0x97b95b;});}})[_0x82f6('0x22')](respondWithFilteredResult(_0x579a2c,_0x5d3d27))[_0x82f6('0x2a')](handleError(_0x579a2c,null));};exports[_0x82f6('0x6b')]=function(_0x5ce8d3,_0x23c248,_0x516947){return db[_0x82f6('0x40')][_0x82f6('0x5e')]({'where':{'id':_0x5ce8d3[_0x82f6('0x63')]['id']}})[_0x82f6('0x22')](handleEntityNotFound(_0x23c248,null))[_0x82f6('0x22')](function(_0x42eee3){if(_0x42eee3){return _0x42eee3[_0x82f6('0x6b')](_0x5ce8d3['query'][_0x82f6('0x6c')]);}})[_0x82f6('0x22')](respondWithStatusCode(_0x23c248,null))['catch'](handleError(_0x23c248,null));};exports[_0x82f6('0x6d')]=function(_0x220490,_0xadf40b,_0x5c65c7){if(_0x220490[_0x82f6('0x5a')]['id']){delete _0x220490['body']['id'];}return db[_0x82f6('0x40')][_0x82f6('0x5e')]({'where':{'id':_0x220490['params']['id']}})[_0x82f6('0x22')](handleEntityNotFound(_0xadf40b,null))[_0x82f6('0x22')](function(_0x43d544){if(_0x43d544){_0x220490[_0x82f6('0x5a')]['WhatsappAccountId']=_0x43d544['id'];return db[_0x82f6('0x6e')]['create'](_0x220490['body']);}})[_0x82f6('0x22')](respondWithResult(_0xadf40b,null))[_0x82f6('0x2a')](handleError(_0xadf40b,null));};exports[_0x82f6('0x6f')]=function(_0x464c72,_0xa9a519,_0x5e556b){var _0x4a28e7={'raw':![],'where':{}};var _0x470b2c={};var _0x577165={'count':0x0,'rows':[]};return db[_0x82f6('0x40')][_0x82f6('0x66')]({'where':{'id':_0x464c72[_0x82f6('0x63')]['id']}})['then'](handleEntityNotFound(_0xa9a519,null))[_0x82f6('0x22')](function(_0x2aa3de){if(_0x2aa3de){_0x470b2c[_0x82f6('0x45')]=_[_0x82f6('0x67')](db['CannedAnswer'][_0x82f6('0x41')]);_0x470b2c[_0x82f6('0x46')]=_[_0x82f6('0x67')](_0x464c72[_0x82f6('0x46')]);_0x470b2c['filters']=_['intersection'](_0x470b2c[_0x82f6('0x45')],_0x470b2c[_0x82f6('0x46')]);_0x4a28e7[_0x82f6('0x4a')]=_[_0x82f6('0x48')](_0x470b2c[_0x82f6('0x45')],qs[_0x82f6('0x49')](_0x464c72[_0x82f6('0x46')][_0x82f6('0x49')]));_0x4a28e7[_0x82f6('0x4a')]=_0x4a28e7[_0x82f6('0x4a')]['length']?_0x4a28e7['attributes']:_0x470b2c[_0x82f6('0x45')];if(!_0x464c72[_0x82f6('0x46')][_0x82f6('0x4c')](_0x82f6('0x4d'))){_0x4a28e7[_0x82f6('0x30')]=qs['limit'](_0x464c72[_0x82f6('0x46')][_0x82f6('0x30')]);_0x4a28e7[_0x82f6('0x2f')]=qs[_0x82f6('0x2f')](_0x464c72[_0x82f6('0x46')]['offset']);}_0x4a28e7['order']=qs[_0x82f6('0x4f')](_0x464c72['query'][_0x82f6('0x4f')]);_0x4a28e7[_0x82f6('0x50')]=qs[_0x82f6('0x47')](_[_0x82f6('0x51')](_0x464c72[_0x82f6('0x46')],_0x470b2c['filters']));_0x4a28e7[_0x82f6('0x50')][_0x82f6('0x68')]=_0x2aa3de['id'];if(_0x464c72[_0x82f6('0x46')]['filter']){_0x4a28e7[_0x82f6('0x50')]=_[_0x82f6('0x53')](_0x4a28e7['where'],{'$or':_[_0x82f6('0x3f')](_0x4a28e7[_0x82f6('0x4a')],function(_0x1fa7aa){var _0x2c77ba={};_0x2c77ba[_0x1fa7aa]={'$like':'%'+_0x464c72['query'][_0x82f6('0x52')]+'%'};return _0x2c77ba;})});}_0x4a28e7=_[_0x82f6('0x53')]({},_0x4a28e7,_0x464c72['options']);return db[_0x82f6('0x6e')][_0x82f6('0x2e')]({'where':_0x4a28e7[_0x82f6('0x50')]})[_0x82f6('0x22')](function(_0x5f27a6){_0x577165[_0x82f6('0x2e')]=_0x5f27a6;if(_0x464c72[_0x82f6('0x46')][_0x82f6('0x56')]){_0x4a28e7['include']=[{'all':!![]}];}return db[_0x82f6('0x6e')]['findAll'](_0x4a28e7);})[_0x82f6('0x22')](function(_0x596438){_0x577165['rows']=_0x596438;return _0x577165;});}})[_0x82f6('0x22')](respondWithFilteredResult(_0xa9a519,_0x4a28e7))['catch'](handleError(_0xa9a519,null));};exports[_0x82f6('0x70')]=function(_0x2da07f,_0xcc5871,_0xc5d539){return db['WhatsappAccount'][_0x82f6('0x5e')]({'where':{'id':_0x2da07f[_0x82f6('0x63')]['id']}})[_0x82f6('0x22')](handleEntityNotFound(_0xcc5871,null))[_0x82f6('0x22')](function(_0x147dd6){if(_0x147dd6){return _0x147dd6[_0x82f6('0x70')](_0x2da07f['query']['ids']);}})[_0x82f6('0x22')](respondWithStatusCode(_0xcc5871,null))[_0x82f6('0x2a')](handleError(_0xcc5871,null));};exports[_0x82f6('0x71')]=function(_0x579fa5,_0x3e2dac,_0x2169b4){return db[_0x82f6('0x40')][_0x82f6('0x5e')]({'where':{'id':_0x579fa5[_0x82f6('0x63')]['id']}})[_0x82f6('0x22')](handleEntityNotFound(_0x3e2dac,null))[_0x82f6('0x22')](function(_0x508797){if(_0x508797){return _0x508797[_0x82f6('0x71')](_0x579fa5[_0x82f6('0x5a')][_0x82f6('0x6c')],_[_0x82f6('0x72')](_0x579fa5[_0x82f6('0x5a')],['ids','id'])||{})[_0x82f6('0x73')](function(_0x321bb6){for(var _0x31fd2d=0x0;_0x31fd2d<_0x579fa5[_0x82f6('0x5a')][_0x82f6('0x6c')]['length'];_0x31fd2d+=0x1){socket[_0x82f6('0x74')](_0x82f6('0x75'),{'UserId':_0x579fa5[_0x82f6('0x5a')][_0x82f6('0x6c')][_0x31fd2d],'WhatsappAccountId':_0x579fa5[_0x82f6('0x63')]['id']});}return _0x321bb6;});}})['then'](respondWithResult(_0x3e2dac,null))[_0x82f6('0x2a')](handleError(_0x3e2dac,null));};exports[_0x82f6('0x76')]=function(_0x5dc08b,_0x131b95,_0x29edb4){return db[_0x82f6('0x40')]['find']({'where':{'id':_0x5dc08b[_0x82f6('0x63')]['id']}})[_0x82f6('0x22')](handleEntityNotFound(_0x131b95,null))[_0x82f6('0x22')](function(_0x35b636){if(_0x35b636){return _0x35b636[_0x82f6('0x76')](_0x5dc08b[_0x82f6('0x46')][_0x82f6('0x6c')])[_0x82f6('0x22')](function(){if(_[_0x82f6('0x77')](_0x5dc08b[_0x82f6('0x46')][_0x82f6('0x6c')])){for(var _0x4af422=0x0;_0x4af422<_0x5dc08b[_0x82f6('0x46')]['ids']['length'];_0x4af422+=0x1){socket[_0x82f6('0x74')](_0x82f6('0x78'),{'UserId':Number(_0x5dc08b[_0x82f6('0x46')][_0x82f6('0x6c')][_0x4af422]),'WhatsappAccountId':Number(_0x5dc08b[_0x82f6('0x63')]['id'])});}}else{socket[_0x82f6('0x74')](_0x82f6('0x78'),{'UserId':Number(_0x5dc08b[_0x82f6('0x46')][_0x82f6('0x6c')]),'WhatsappAccountId':Number(_0x5dc08b['params']['id'])});}});}})['then'](respondWithStatusCode(_0x131b95,null))[_0x82f6('0x2a')](handleError(_0x131b95,null));};exports[_0x82f6('0x79')]=function(_0x3afba4,_0x30a748,_0x5b587e){var _0x44588e={};var _0x286953={};var _0x1aa92c;var _0x448002;return db[_0x82f6('0x40')][_0x82f6('0x66')]({'where':{'id':_0x3afba4[_0x82f6('0x63')]['id']}})[_0x82f6('0x22')](handleEntityNotFound(_0x30a748,null))['then'](function(_0x2f8ce2){if(_0x2f8ce2){_0x1aa92c=_0x2f8ce2;_0x286953[_0x82f6('0x45')]=_['keys'](db['User'][_0x82f6('0x41')]);_0x286953[_0x82f6('0x46')]=_[_0x82f6('0x67')](_0x3afba4[_0x82f6('0x46')]);_0x286953[_0x82f6('0x47')]=_['intersection'](_0x286953[_0x82f6('0x45')],_0x286953[_0x82f6('0x46')]);_0x44588e['attributes']=_[_0x82f6('0x48')](_0x286953['model'],qs['fields'](_0x3afba4[_0x82f6('0x46')][_0x82f6('0x49')]));_0x44588e['attributes']=_0x44588e[_0x82f6('0x4a')][_0x82f6('0x4b')]?_0x44588e[_0x82f6('0x4a')]:_0x286953[_0x82f6('0x45')];_0x44588e[_0x82f6('0x4e')]=qs[_0x82f6('0x4f')](_0x3afba4[_0x82f6('0x46')]['sort']);_0x44588e[_0x82f6('0x50')]=qs['filters'](_[_0x82f6('0x51')](_0x3afba4[_0x82f6('0x46')],_0x286953[_0x82f6('0x47')]));if(_0x3afba4[_0x82f6('0x46')][_0x82f6('0x52')]){_0x44588e[_0x82f6('0x50')]=_['merge'](_0x44588e[_0x82f6('0x50')],{'$or':_['map'](_0x44588e[_0x82f6('0x4a')],function(_0x165772){var _0x27c132={};_0x27c132[_0x165772]={'$like':'%'+_0x3afba4[_0x82f6('0x46')][_0x82f6('0x52')]+'%'};return _0x27c132;})});}_0x44588e=_['merge']({},_0x44588e,_0x3afba4[_0x82f6('0x55')]);return _0x1aa92c[_0x82f6('0x79')](_0x44588e);}})['then'](function(_0x54bc7d){if(_0x54bc7d){_0x448002=_0x54bc7d['length'];if(!_0x3afba4['query'][_0x82f6('0x4c')]('nolimit')){_0x44588e['limit']=qs[_0x82f6('0x30')](_0x3afba4[_0x82f6('0x46')][_0x82f6('0x30')]);_0x44588e[_0x82f6('0x2f')]=qs['offset'](_0x3afba4[_0x82f6('0x46')][_0x82f6('0x2f')]);}return _0x1aa92c[_0x82f6('0x79')](_0x44588e);}})[_0x82f6('0x22')](function(_0x2ce917){if(_0x2ce917){return _0x2ce917?{'count':_0x448002,'rows':_0x2ce917}:null;}})['then'](respondWithResult(_0x30a748,null))[_0x82f6('0x2a')](handleError(_0x30a748,null));};exports['addApplications']=function(_0x3b1aae,_0x21984f,_0x1e7ebf){return db['WhatsappAccount'][_0x82f6('0x66')]({'where':{'id':_0x3b1aae[_0x82f6('0x63')]['id']}})[_0x82f6('0x22')](handleEntityNotFound(_0x21984f,null))['then'](function(_0xd2dcf9){if(_0xd2dcf9){return db[_0x82f6('0x7a')][_0x82f6('0x7b')](function(_0xf9670){return db[_0x82f6('0x7c')][_0x82f6('0x36')]({'where':{'WhatsappAccountId':_0x3b1aae['params']['id']},'transaction':_0xf9670})[_0x82f6('0x22')](function(_0x5689da){var _0x388bd5=_[_0x82f6('0x3f')](_0x3b1aae[_0x82f6('0x5a')],function(_0xf8270e){_0xf8270e['WhatsappAccountId']=_0x3b1aae[_0x82f6('0x63')]['id'];return _0xf8270e;});return db[_0x82f6('0x7c')][_0x82f6('0x7d')](_0x388bd5,{'transaction':_0xf9670});});})[_0x82f6('0x22')](function(){return db[_0x82f6('0x7c')][_0x82f6('0x7e')]({'where':{'WhatsappAccountId':_0x3b1aae[_0x82f6('0x63')]['id']},'order':_0x82f6('0x7f')});});}})['then'](respondWithResult(_0x21984f,null))[_0x82f6('0x2a')](handleError(_0x21984f,null));};exports['getApplications']=function(_0x533e82,_0x4a5a03,_0x11f05f){var _0x288294={};var _0x247e7e={};var _0x5457bf;var _0x65a57e;return db['WhatsappAccount'][_0x82f6('0x66')]({'where':{'id':_0x533e82[_0x82f6('0x63')]['id']}})[_0x82f6('0x22')](handleEntityNotFound(_0x4a5a03,null))[_0x82f6('0x22')](function(_0x72c409){if(_0x72c409){_0x5457bf=_0x72c409;_0x247e7e['model']=_[_0x82f6('0x67')](db[_0x82f6('0x7c')]['rawAttributes']);_0x247e7e[_0x82f6('0x46')]=_[_0x82f6('0x67')](_0x533e82[_0x82f6('0x46')]);_0x247e7e[_0x82f6('0x47')]=_[_0x82f6('0x48')](_0x247e7e[_0x82f6('0x45')],_0x247e7e[_0x82f6('0x46')]);_0x288294[_0x82f6('0x4a')]=_[_0x82f6('0x48')](_0x247e7e[_0x82f6('0x45')],qs[_0x82f6('0x49')](_0x533e82['query'][_0x82f6('0x49')]));_0x288294['attributes']=_0x288294[_0x82f6('0x4a')][_0x82f6('0x4b')]?_0x288294[_0x82f6('0x4a')]:_0x247e7e[_0x82f6('0x45')];_0x288294['order']=qs[_0x82f6('0x4f')](_0x533e82[_0x82f6('0x46')]['sort']);_0x288294[_0x82f6('0x50')]=qs[_0x82f6('0x47')](_[_0x82f6('0x51')](_0x533e82[_0x82f6('0x46')],_0x247e7e[_0x82f6('0x47')]));if(_0x533e82['query'][_0x82f6('0x52')]){_0x288294[_0x82f6('0x50')]=_[_0x82f6('0x53')](_0x288294[_0x82f6('0x50')],{'$or':_[_0x82f6('0x3f')](_0x288294[_0x82f6('0x4a')],function(_0x444820){var _0x372f95={};_0x372f95[_0x444820]={'$like':'%'+_0x533e82[_0x82f6('0x46')][_0x82f6('0x52')]+'%'};return _0x372f95;})});}_0x288294=_[_0x82f6('0x53')]({},_0x288294,_0x533e82[_0x82f6('0x55')]);return _0x5457bf[_0x82f6('0x80')](_0x288294);}})['then'](function(_0x3bf59b){if(_0x3bf59b){_0x65a57e=_0x3bf59b[_0x82f6('0x4b')];if(!_0x533e82[_0x82f6('0x46')][_0x82f6('0x4c')]('nolimit')){_0x288294[_0x82f6('0x30')]=qs[_0x82f6('0x30')](_0x533e82[_0x82f6('0x46')]['limit']);_0x288294[_0x82f6('0x2f')]=qs[_0x82f6('0x2f')](_0x533e82[_0x82f6('0x46')][_0x82f6('0x2f')]);}return _0x5457bf[_0x82f6('0x80')](_0x288294);}})[_0x82f6('0x22')](function(_0x5ef55d){if(_0x5ef55d){return _0x5ef55d?{'count':_0x65a57e,'rows':_0x5ef55d}:null;}})[_0x82f6('0x22')](respondWithResult(_0x4a5a03,null))[_0x82f6('0x2a')](handleError(_0x4a5a03,null));};exports[_0x82f6('0x81')]=function(_0x50029a,_0x31e15a,_0x45adcb){var _0x387b61={'channel':_0x82f6('0x82')};var _0x505b55=[];var _0xfb35a4=[];var _0x5c458e={};return db[_0x82f6('0x40')]['find']({'where':{'id':_0x50029a[_0x82f6('0x63')]['id']},'include':[{'model':db[_0x82f6('0x7c')],'as':'Applications'}]})[_0x82f6('0x22')](handleEntityNotFound(_0x31e15a,null))['then'](function(_0x41ac0e){_0x387b61[_0x82f6('0x83')]=_0x41ac0e;_0x387b61[_0x82f6('0x84')]=_[_0x82f6('0x85')](_0x41ac0e['Applications'],[_0x82f6('0x7f')],[_0x82f6('0x86')]);if(_0x387b61[_0x82f6('0x83')][_0x82f6('0x87')]){delete _0x387b61[_0x82f6('0x83')][_0x82f6('0x87')];}return db[_0x82f6('0x88')][_0x82f6('0x61')]();})['then'](function(_0x577392){if(!_0x577392){throw new db[(_0x82f6('0x1e'))][(_0x82f6('0x1f'))](_0x82f6('0x89'));}_0x505b55=_[_0x82f6('0x8a')](_[_0x82f6('0x67')](_0x577392),['createdAt','updatedAt']);_0xfb35a4=_[_0x82f6('0x8a')](_[_0x82f6('0x67')](_0x577392),[_0x82f6('0x8b'),_0x82f6('0x8c'),_0x82f6('0x8d'),'ListId']);_0x387b61[_0x82f6('0x5a')]={'mapKey':_0x82f6('0x8e')};if(_0x387b61['account'][_0x82f6('0x43')]&&_0x387b61[_0x82f6('0x83')][_0x82f6('0x43')]==='twilio'){_0x387b61[_0x82f6('0x5a')]['from']=_0x50029a['body'][_0x82f6('0x8f')]['replace']('whatsapp:','');_0x387b61['body'][_0x82f6('0x5a')]=_0x50029a[_0x82f6('0x5a')][_0x82f6('0x90')];_0x387b61['body'][_0x82f6('0x91')]=_0x50029a['body'][_0x82f6('0x92')];}if(_0x387b61[_0x82f6('0x5a')]['id']){delete _0x387b61[_0x82f6('0x5a')]['id'];}if(_['isNil'](_0x387b61['body']['from'])){throw new db[(_0x82f6('0x1e'))]['ValidationError'](_0x82f6('0x93'));}if(_[_0x82f6('0x94')](_0x387b61[_0x82f6('0x5a')][_0x82f6('0x5a')])||_0x387b61['body']['body']===''){throw new db[(_0x82f6('0x1e'))][(_0x82f6('0x1f'))](_0x82f6('0x95'));}if(_[_0x82f6('0x94')](_0x387b61['body'][_0x82f6('0x96')])){throw new db[(_0x82f6('0x1e'))][(_0x82f6('0x1f'))](_0x82f6('0x97')+_0xfb35a4);}if(!_[_0x82f6('0x98')](_0xfb35a4,_0x387b61[_0x82f6('0x5a')][_0x82f6('0x96')])){throw new db[(_0x82f6('0x1e'))][(_0x82f6('0x1f'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0xfb35a4);}_0x5c458e[_0x387b61['body'][_0x82f6('0x96')]]=_0x387b61[_0x82f6('0x5a')][_0x82f6('0x99')];return db[_0x82f6('0x9a')]['find']({'where':{'id':_0x387b61['account'][_0x82f6('0x9b')]},'include':[{'model':db[_0x82f6('0x88')],'as':_0x82f6('0x9c'),'where':_0x5c458e,'limit':0x1,'order':[[_0x82f6('0x8c'),_0x82f6('0x9d')]]}]});})[_0x82f6('0x22')](handleEntityNotFound(_0x31e15a,null))[_0x82f6('0x22')](function(_0x4f7f82){if(_0x4f7f82){_0x387b61[_0x82f6('0x9e')]=_[_0x82f6('0x72')](_0x4f7f82,[_0x82f6('0x9c')]);if(_0x4f7f82[_0x82f6('0x9c')][_0x82f6('0x4b')]){return _0x4f7f82[_0x82f6('0x9c')][0x0];}var _0x5bb86a=_[_0x82f6('0x15')](_0x387b61[_0x82f6('0x5a')],{'firstName':_0x387b61['body']['from'],'ListId':_0x4f7f82['id']});_0x5bb86a[_0x387b61[_0x82f6('0x5a')][_0x82f6('0x96')]]=_0x387b61['body'][_0x82f6('0x99')];return db['CmContact'][_0x82f6('0x59')](_0x5bb86a,{'fields':_0x505b55,'raw':!![]});}})[_0x82f6('0x22')](handleEntityNotFound(_0x31e15a,null))['then'](function(_0x2b5e5c){if(_0x2b5e5c){_0x387b61[_0x82f6('0x9f')]=_0x2b5e5c;var _0x5eddae={'ContactId':_0x2b5e5c['id'],'phone':_0x387b61[_0x82f6('0x5a')][_0x82f6('0x99')],'WhatsappAccountId':_0x50029a['params']['id']};var _0x23f4b5={'ContactId':_0x2b5e5c['id'],'WhatsappAccountId':_0x50029a[_0x82f6('0x63')]['id'],'closed':![]};return db[_0x82f6('0xa0')][_0x82f6('0x5e')]({'where':_0x23f4b5})['then'](function(_0x4c3015){if(_0x4c3015){return[_0x4c3015,![]];}return db['WhatsappInteraction']['create'](_0x5eddae)[_0x82f6('0x22')](function(_0x20e612){return[_0x20e612,!![]];});});}})['spread'](function(_0x5bba07,_0x55ce59){_0x387b61['interaction']=_0x5bba07[_0x82f6('0x37')]({'plain':!![]});_0x387b61[_0x82f6('0xa1')]['created']=![];if(_0x55ce59){if(_0x387b61[_0x82f6('0x83')][_0x82f6('0xa2')]){_0x387b61[_0x82f6('0x84')][_0x82f6('0xa3')]({'id':0x0,'priority':_0x387b61[_0x82f6('0x84')][_0x82f6('0x4b')]+0x1,'app':_0x82f6('0xa4'),'appdata':_0x82f6('0xa5'),'interval':_0x82f6('0xa6')});}_0x387b61[_0x82f6('0xa1')]['created']=!![];}return db[_0x82f6('0xa7')]['create']({'phone':_0x387b61[_0x82f6('0x5a')][_0x82f6('0x99')],'messageId':_0x387b61[_0x82f6('0x5a')][_0x82f6('0x91')],'body':_0x387b61[_0x82f6('0x5a')][_0x82f6('0x5a')],'WhatsappAccountId':_0x50029a[_0x82f6('0x63')]['id'],'WhatsappInteractionId':_0x5bba07['id'],'direction':'in','ContactId':_0x5bba07[_0x82f6('0xa8')],'AttachmentId':_0x387b61['body'][_0x82f6('0xa9')]});})['then'](function(_0x298f8c){_0x387b61[_0x82f6('0x28')]=_0x298f8c;if(_0x387b61['interaction']['UserId']){return db[_0x82f6('0xaa')][_0x82f6('0x5e')]({'attributes':['id',_0x82f6('0x3c')],'where':{'id':_0x387b61[_0x82f6('0xa1')][_0x82f6('0xab')]}})[_0x82f6('0x22')](function(_0x4bbb92){if(_0x4bbb92){_0x387b61['applications'][_0x82f6('0xac')]({'id':0x0,'priority':0x0,'app':_0x82f6('0xad'),'appdata':_0x4bbb92[_0x82f6('0x3c')]+','+(_0x387b61[_0x82f6('0x83')]['waitForTheAssignedAgent']||0xa),'interval':_0x82f6('0xa6')});}return respondWithRpcPromise(_0x82f6('0xae'),_0x82f6('0xaf'),_0x387b61);});}return respondWithRpcPromise(_0x82f6('0xae'),'startRouting',_0x387b61);})['then'](function(_0x286301){if(_0x286301){var _0x518d50=0xc8;var _0x3b6765=_0x82f6('0xb0');logger[_0x82f6('0x23')](_0x82f6('0xb1'),_0x3b6765,_0x518d50,_0x82f6('0xb2'));logger['debug']('WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x3b6765,_0x518d50,'entity\x20found',JSON[_0x82f6('0x26')](_0x286301));if(_0x387b61[_0x82f6('0x83')][_0x82f6('0x43')]===_0x82f6('0xb3')){return _0x31e15a[_0x82f6('0x2c')](_0x518d50)[_0x82f6('0x31')]('Content-Type',_0x82f6('0xb4'))['send']('\x0a');}else{return _0x31e15a['status'](_0x518d50)[_0x82f6('0x2d')](_0x286301);}}})[_0x82f6('0x2a')](handleError(_0x31e15a,null));};exports[_0x82f6('0x3d')]=function(_0x3cfa9a,_0x5bfe66,_0x3591a5){var _0x50c438,_0x2e859b,_0x20496d;if(_[_0x82f6('0x94')](_0x3cfa9a['body'][_0x82f6('0x5a')])||_0x3cfa9a['body'][_0x82f6('0x5a')]===''){throw new db[(_0x82f6('0x1e'))][(_0x82f6('0x1f'))](_0x82f6('0x95'));}if(_[_0x82f6('0x94')](_0x3cfa9a[_0x82f6('0x5a')]['to'])){throw new db[(_0x82f6('0x1e'))][(_0x82f6('0x1f'))](_0x82f6('0xb5'));}_0x50c438=_0x3cfa9a['body']['to'];return db[_0x82f6('0x40')]['find']({'where':{'id':_0x3cfa9a['params']['id']},'include':[{'model':db[_0x82f6('0x9a')],'as':_0x82f6('0xb6'),'include':[{'model':db[_0x82f6('0x88')],'as':_0x82f6('0x9c'),'where':{'mobile':_0x50c438},'limit':0x1,'order':[[_0x82f6('0x8c'),'DESC']]}]}]})[_0x82f6('0x22')](handleEntityNotFound(_0x5bfe66,null))[_0x82f6('0x22')](function(_0xfe9fe1){if(_0xfe9fe1&&_0xfe9fe1['List']){_0x2e859b=_0xfe9fe1[_0x82f6('0x37')]({'plain':!![]});if(_0x2e859b[_0x82f6('0xb6')]&&_0x2e859b[_0x82f6('0xb6')][_0x82f6('0x9c')][_0x82f6('0x4b')]){return _0x2e859b[_0x82f6('0xb6')][_0x82f6('0x9c')][0x0];}return db['CmContact'][_0x82f6('0x59')](_[_0x82f6('0x15')](_0x3cfa9a[_0x82f6('0x5a')],{'firstName':_0x50c438,'mobile':_0x50c438,'phone':_0x50c438,'ListId':_0x2e859b[_0x82f6('0x9b')]}));}})[_0x82f6('0x22')](handleEntityNotFound(_0x5bfe66,null))[_0x82f6('0x22')](function(_0x4dd1ed){if(_0x4dd1ed){_0x20496d=_0x4dd1ed;return db[_0x82f6('0xa0')]['find']({'where':{'ContactId':_0x20496d['id'],'closed':![],'WhatsappAccountId':_0x2e859b['id']}})[_0x82f6('0x22')](function(_0x211ed3){if(_0x211ed3){return[_0x211ed3,![]];}return db[_0x82f6('0xa0')][_0x82f6('0x59')]({'UserId':_0x3cfa9a[_0x82f6('0x5b')]['id'],'ContactId':_0x20496d['id'],'WhatsappAccountId':_0x2e859b['id'],'phone':_0x50c438,'firstMsgDirection':'out','Messages':[_['merge'](_0x3cfa9a['body'],{'read':![],'body':_0x3cfa9a['body'][_0x82f6('0x5a')],'phone':_0x50c438,'WhatsappAccountId':_0x2e859b['id'],'UserId':_0x3cfa9a[_0x82f6('0x5b')]['id'],'ContactId':_0x20496d['id']})]},{'include':[{'model':db[_0x82f6('0xa7')],'as':'Messages'}]})[_0x82f6('0x22')](function(_0x39009c){return[_0x39009c,!![]];});});}})['spread'](function(_0x2a1341,_0x194028){if(_0x194028){return _0x2a1341;}return db[_0x82f6('0xa7')][_0x82f6('0x59')](_[_0x82f6('0x53')](_0x3cfa9a[_0x82f6('0x5a')],{'read':![],'body':_0x3cfa9a[_0x82f6('0x5a')][_0x82f6('0x5a')],'phone':_0x50c438,'WhatsappAccountId':_0x2e859b['id'],'WhatsappInteractionId':_0x2a1341['id'],'UserId':_0x3cfa9a[_0x82f6('0x5b')]['id'],'ContactId':_0x20496d['id']}))[_0x82f6('0x22')](function(_0x52a79b){_0x2a1341[_0x82f6('0xb7')][_0x82f6('0xb8')]=[];_0x2a1341[_0x82f6('0xb7')]['Messages'][_0x82f6('0xa3')](_0x52a79b[_0x82f6('0xb7')]);return _0x2a1341;});})[_0x82f6('0x22')](respondWithResult(_0x5bfe66,null))[_0x82f6('0x2a')](handleError(_0x5bfe66,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 615f4fa..8d7d31c 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 _0x27a0=['hook','exports','../../mysqldb','WhatsappAccount','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x45a98f,_0x46004e){var _0x3eb94d=function(_0x1346d5){while(--_0x1346d5){_0x45a98f['push'](_0x45a98f['shift']());}};_0x3eb94d(++_0x46004e);}(_0x27a0,0xbf));var _0x027a=function(_0xefdb06,_0xd7b8b1){_0xefdb06=_0xefdb06-0x0;var _0x4b65f5=_0x27a0[_0xefdb06];return _0x4b65f5;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require(_0x027a('0x0'))['db'][_0x027a('0x1')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x027a('0x2')](0x0);var events={'afterCreate':_0x027a('0x3'),'afterUpdate':_0x027a('0x4'),'afterDestroy':'remove'};function emitEvent(_0x58a58b){return function(_0x4e8d6b,_0x47cd65,_0x30a54d){WhatsappAccountEvents[_0x027a('0x5')](_0x58a58b+':'+_0x4e8d6b['id'],_0x4e8d6b);WhatsappAccountEvents[_0x027a('0x5')](_0x58a58b,_0x4e8d6b);_0x30a54d(null);};}for(var e in events){if(events[_0x027a('0x6')](e)){var event=events[e];WhatsappAccount[_0x027a('0x7')](e,emitEvent(event));}}module[_0x027a('0x8')]=WhatsappAccountEvents; \ No newline at end of file +var _0x7c09=['WhatsappAccount','save','update','remove','hook','exports','../../mysqldb'];(function(_0x51b8af,_0x6cf6fe){var _0x31e2ff=function(_0x1b3566){while(--_0x1b3566){_0x51b8af['push'](_0x51b8af['shift']());}};_0x31e2ff(++_0x6cf6fe);}(_0x7c09,0x102));var _0x97c0=function(_0x387a8d,_0x35226a){_0x387a8d=_0x387a8d-0x0;var _0x2638ff=_0x7c09[_0x387a8d];return _0x2638ff;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require(_0x97c0('0x0'))['db'][_0x97c0('0x1')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x97c0('0x2'),'afterUpdate':_0x97c0('0x3'),'afterDestroy':_0x97c0('0x4')};function emitEvent(_0x214897){return function(_0x12eb6d,_0x99bf54,_0x15c67b){WhatsappAccountEvents['emit'](_0x214897+':'+_0x12eb6d['id'],_0x12eb6d);WhatsappAccountEvents['emit'](_0x214897,_0x12eb6d);_0x15c67b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappAccount[_0x97c0('0x5')](e,emitEvent(event));}}module[_0x97c0('0x6')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index 31c0e51..5add798 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 _0x2976=['../../config/environment','exports','define','WhatsappAccount','whatsapp_accounts','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf'];(function(_0x15d691,_0x3406a3){var _0x3927a1=function(_0x8d4cfb){while(--_0x8d4cfb){_0x15d691['push'](_0x15d691['shift']());}};_0x3927a1(++_0x3406a3);}(_0x2976,0x155));var _0x6297=function(_0x8c391f,_0x3df4b8){_0x8c391f=_0x8c391f-0x0;var _0xe29f49=_0x2976[_0x8c391f];return _0xe29f49;};'use strict';var _=require(_0x6297('0x0'));var util=require(_0x6297('0x1'));var logger=require(_0x6297('0x2'))(_0x6297('0x3'));var moment=require('moment');var BPromise=require(_0x6297('0x4'));var rp=require(_0x6297('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6297('0x6'));var config=require(_0x6297('0x7'));var attributes=require('./whatsappAccount.attributes');module[_0x6297('0x8')]=function(_0x2ca1a2,_0xa58d94){return _0x2ca1a2[_0x6297('0x9')](_0x6297('0xa'),attributes,{'tableName':_0x6297('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3f1a=['define','WhatsappAccount','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x5f0b5f,_0xf4139){var _0x579c4f=function(_0x36bcc1){while(--_0x36bcc1){_0x5f0b5f['push'](_0x5f0b5f['shift']());}};_0x579c4f(++_0xf4139);}(_0x3f1a,0x1b2));var _0xa3f1=function(_0xb1192e,_0x5ba76b){_0xb1192e=_0xb1192e-0x0;var _0x159513=_0x3f1a[_0xb1192e];return _0x159513;};'use strict';var _=require(_0xa3f1('0x0'));var util=require(_0xa3f1('0x1'));var logger=require(_0xa3f1('0x2'))('api');var moment=require(_0xa3f1('0x3'));var BPromise=require(_0xa3f1('0x4'));var rp=require(_0xa3f1('0x5'));var fs=require('fs');var path=require(_0xa3f1('0x6'));var rimraf=require(_0xa3f1('0x7'));var config=require(_0xa3f1('0x8'));var attributes=require('./whatsappAccount.attributes');module[_0xa3f1('0x9')]=function(_0x12645b,_0x21a440){return _0x12645b[_0xa3f1('0xa')](_0xa3f1('0xb'),attributes,{'tableName':'whatsapp_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.rpc.js b/server/api/whatsappAccount/whatsappAccount.rpc.js index d81c2de..4c393e5 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 _0xc1f4=['localhost','socket.io-emitter','./whatsappAccount.socket','register','then','info','WhatsappAccount,\x20%s,\x20%s','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','ShowWhatsappAccount','WhatsappAccount','find','options','raw','attributes','include','map','model','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','redis'];(function(_0x226290,_0x233393){var _0x29588f=function(_0x2f4359){while(--_0x2f4359){_0x226290['push'](_0x226290['shift']());}};_0x29588f(++_0x233393);}(_0xc1f4,0xc7));var _0x4c1f=function(_0x41075d,_0x112862){_0x41075d=_0x41075d-0x0;var _0x11f102=_0xc1f4[_0x41075d];return _0x11f102;};'use strict';var _=require(_0x4c1f('0x0'));var util=require(_0x4c1f('0x1'));var moment=require('moment');var BPromise=require(_0x4c1f('0x2'));var rs=require(_0x4c1f('0x3'));var fs=require('fs');var Redis=require(_0x4c1f('0x4'));var db=require(_0x4c1f('0x5'))['db'];var utils=require(_0x4c1f('0x6'));var logger=require(_0x4c1f('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x4c1f('0x8'));var client=jayson['client'][_0x4c1f('0x9')]({'port':0x232a});config[_0x4c1f('0xa')]=_['defaults'](config['redis'],{'host':_0x4c1f('0xb'),'port':0x18eb});var socket=require(_0x4c1f('0xc'))(new Redis(config[_0x4c1f('0xa')]));require(_0x4c1f('0xd'))[_0x4c1f('0xe')](socket);function respondWithRpcPromise(_0xfc593c,_0x56f9c0,_0x5b0963){return new BPromise(function(_0x76a8f5,_0x55e4d4){return client['request'](_0xfc593c,_0x5b0963)[_0x4c1f('0xf')](function(_0x4b39c8){logger[_0x4c1f('0x10')](_0x4c1f('0x11'),_0x56f9c0,'request\x20sent');logger[_0x4c1f('0x12')](_0x4c1f('0x13'),_0x56f9c0,_0x4c1f('0x14'),JSON[_0x4c1f('0x15')](_0x4b39c8));if(_0x4b39c8[_0x4c1f('0x16')]){if(_0x4b39c8[_0x4c1f('0x16')]['code']===0x1f4){logger[_0x4c1f('0x16')]('WhatsappAccount,\x20%s,\x20%s',_0x56f9c0,_0x4b39c8[_0x4c1f('0x16')][_0x4c1f('0x17')]);return _0x55e4d4(_0x4b39c8[_0x4c1f('0x16')][_0x4c1f('0x17')]);}logger['error'](_0x4c1f('0x11'),_0x56f9c0,_0x4b39c8[_0x4c1f('0x16')][_0x4c1f('0x17')]);return _0x76a8f5(_0x4b39c8[_0x4c1f('0x16')][_0x4c1f('0x17')]);}else{logger[_0x4c1f('0x10')](_0x4c1f('0x11'),_0x56f9c0,'request\x20sent');_0x76a8f5(_0x4b39c8[_0x4c1f('0x18')][_0x4c1f('0x17')]);}})[_0x4c1f('0x19')](function(_0x28cdc4){logger[_0x4c1f('0x16')](_0x4c1f('0x11'),_0x56f9c0,_0x28cdc4);_0x55e4d4(_0x28cdc4);});});}exports[_0x4c1f('0x1a')]=function(_0x20a87d){var _0x29ed38=this;return new Promise(function(_0x20648d,_0x1088a5){return db[_0x4c1f('0x1b')][_0x4c1f('0x1c')]({'raw':_0x20a87d['options']?_0x20a87d[_0x4c1f('0x1d')][_0x4c1f('0x1e')]===undefined?!![]:![]:!![],'where':_0x20a87d[_0x4c1f('0x1d')]?_0x20a87d[_0x4c1f('0x1d')]['where']||null:null,'attributes':_0x20a87d[_0x4c1f('0x1d')]?_0x20a87d[_0x4c1f('0x1d')][_0x4c1f('0x1f')]||null:null,'include':_0x20a87d[_0x4c1f('0x1d')]?_0x20a87d[_0x4c1f('0x1d')][_0x4c1f('0x20')]?_[_0x4c1f('0x21')](_0x20a87d['options'][_0x4c1f('0x20')],function(_0xde17a8){return{'model':db[_0xde17a8['model']],'as':_0xde17a8['as'],'attributes':_0xde17a8['attributes'],'include':_0xde17a8['include']?_[_0x4c1f('0x21')](_0xde17a8[_0x4c1f('0x20')],function(_0x42f89f){return{'model':db[_0x42f89f[_0x4c1f('0x22')]],'as':_0x42f89f['as'],'attributes':_0x42f89f['attributes'],'include':_0x42f89f[_0x4c1f('0x20')]?_[_0x4c1f('0x21')](_0x42f89f[_0x4c1f('0x20')],function(_0x19d251){return{'model':db[_0x19d251[_0x4c1f('0x22')]],'as':_0x19d251['as'],'attributes':_0x19d251['attributes']};}):[]};}):[]};}):[]:[]})[_0x4c1f('0xf')](function(_0x24e19c){logger['info'](_0x4c1f('0x1a'),_0x20a87d);logger[_0x4c1f('0x12')](_0x4c1f('0x1a'),_0x20a87d,JSON[_0x4c1f('0x15')](_0x24e19c));_0x20648d(_0x24e19c);})[_0x4c1f('0x19')](function(_0xa4ae4c){logger[_0x4c1f('0x16')](_0x4c1f('0x1a'),_0xa4ae4c[_0x4c1f('0x17')],_0x20a87d);_0x1088a5(_0x29ed38[_0x4c1f('0x16')](0x1f4,_0xa4ae4c[_0x4c1f('0x17')]));});});}; \ No newline at end of file +var _0xd752=['message','result','catch','ShowWhatsappAccount','WhatsappAccount','find','options','where','attributes','include','map','model','info','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','request','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x19201b,_0x216e48){var _0x2a13e2=function(_0x35112f){while(--_0x35112f){_0x19201b['push'](_0x19201b['shift']());}};_0x2a13e2(++_0x216e48);}(_0xd752,0x7c));var _0x2d75=function(_0x292600,_0x120a55){_0x292600=_0x292600-0x0;var _0x2ef83b=_0xd752[_0x292600];return _0x2ef83b;};'use strict';var _=require(_0x2d75('0x0'));var util=require(_0x2d75('0x1'));var moment=require(_0x2d75('0x2'));var BPromise=require(_0x2d75('0x3'));var rs=require(_0x2d75('0x4'));var fs=require('fs');var Redis=require(_0x2d75('0x5'));var db=require(_0x2d75('0x6'))['db'];var utils=require(_0x2d75('0x7'));var logger=require(_0x2d75('0x8'))(_0x2d75('0x9'));var config=require(_0x2d75('0xa'));var jayson=require(_0x2d75('0xb'));var client=jayson['client']['http']({'port':0x232a});config[_0x2d75('0xc')]=_[_0x2d75('0xd')](config[_0x2d75('0xc')],{'host':_0x2d75('0xe'),'port':0x18eb});var socket=require(_0x2d75('0xf'))(new Redis(config[_0x2d75('0xc')]));require(_0x2d75('0x10'))['register'](socket);function respondWithRpcPromise(_0x2564dc,_0x498bcc,_0x4de873){return new BPromise(function(_0x7e513b,_0x31cabc){return client[_0x2d75('0x11')](_0x2564dc,_0x4de873)['then'](function(_0xcc64da){logger['info'](_0x2d75('0x12'),_0x498bcc,_0x2d75('0x13'));logger[_0x2d75('0x14')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x498bcc,'request\x20sent',JSON[_0x2d75('0x15')](_0xcc64da));if(_0xcc64da[_0x2d75('0x16')]){if(_0xcc64da[_0x2d75('0x16')][_0x2d75('0x17')]===0x1f4){logger['error'](_0x2d75('0x12'),_0x498bcc,_0xcc64da[_0x2d75('0x16')]['message']);return _0x31cabc(_0xcc64da[_0x2d75('0x16')][_0x2d75('0x18')]);}logger['error'](_0x2d75('0x12'),_0x498bcc,_0xcc64da['error'][_0x2d75('0x18')]);return _0x7e513b(_0xcc64da['error'][_0x2d75('0x18')]);}else{logger['info'](_0x2d75('0x12'),_0x498bcc,_0x2d75('0x13'));_0x7e513b(_0xcc64da[_0x2d75('0x19')]['message']);}})[_0x2d75('0x1a')](function(_0x4b59ed){logger[_0x2d75('0x16')](_0x2d75('0x12'),_0x498bcc,_0x4b59ed);_0x31cabc(_0x4b59ed);});});}exports[_0x2d75('0x1b')]=function(_0x261219){var _0x598879=this;return new Promise(function(_0x459712,_0x40ee39){return db[_0x2d75('0x1c')][_0x2d75('0x1d')]({'raw':_0x261219[_0x2d75('0x1e')]?_0x261219[_0x2d75('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x261219['options']?_0x261219[_0x2d75('0x1e')][_0x2d75('0x1f')]||null:null,'attributes':_0x261219[_0x2d75('0x1e')]?_0x261219[_0x2d75('0x1e')][_0x2d75('0x20')]||null:null,'include':_0x261219[_0x2d75('0x1e')]?_0x261219[_0x2d75('0x1e')]['include']?_['map'](_0x261219[_0x2d75('0x1e')][_0x2d75('0x21')],function(_0x3ea9c1){return{'model':db[_0x3ea9c1['model']],'as':_0x3ea9c1['as'],'attributes':_0x3ea9c1['attributes'],'include':_0x3ea9c1[_0x2d75('0x21')]?_[_0x2d75('0x22')](_0x3ea9c1[_0x2d75('0x21')],function(_0x3776ae){return{'model':db[_0x3776ae[_0x2d75('0x23')]],'as':_0x3776ae['as'],'attributes':_0x3776ae['attributes'],'include':_0x3776ae[_0x2d75('0x21')]?_['map'](_0x3776ae[_0x2d75('0x21')],function(_0x5a825f){return{'model':db[_0x5a825f[_0x2d75('0x23')]],'as':_0x5a825f['as'],'attributes':_0x5a825f[_0x2d75('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4ca6e3){logger[_0x2d75('0x24')](_0x2d75('0x1b'),_0x261219);logger[_0x2d75('0x14')](_0x2d75('0x1b'),_0x261219,JSON[_0x2d75('0x15')](_0x4ca6e3));_0x459712(_0x4ca6e3);})[_0x2d75('0x1a')](function(_0x3d756e){logger[_0x2d75('0x16')](_0x2d75('0x1b'),_0x3d756e[_0x2d75('0x18')],_0x261219);_0x40ee39(_0x598879['error'](0x1f4,_0x3d756e[_0x2d75('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index f3dd709..7200a35 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 _0x12af=['whatsappAccount:','./whatsappAccount.events','update','emit','removeListener','register'];(function(_0x289a67,_0x1e5a3c){var _0x572b49=function(_0x22e036){while(--_0x22e036){_0x289a67['push'](_0x289a67['shift']());}};_0x572b49(++_0x1e5a3c);}(_0x12af,0x1f3));var _0xf12a=function(_0x3799cd,_0x131494){_0x3799cd=_0x3799cd-0x0;var _0x3410d3=_0x12af[_0x3799cd];return _0x3410d3;};'use strict';var WhatsappAccountEvents=require(_0xf12a('0x0'));var events=['save','remove',_0xf12a('0x1')];function createListener(_0x54e45d,_0x1a272e){return function(_0x3b4215){_0x1a272e[_0xf12a('0x2')](_0x54e45d,_0x3b4215);};}function removeListener(_0xe9b0ae,_0x56f63e){return function(){WhatsappAccountEvents[_0xf12a('0x3')](_0xe9b0ae,_0x56f63e);};}exports[_0xf12a('0x4')]=function(_0x4578c3){for(var _0x7a7119=0x0,_0x1c36ac=events['length'];_0x7a7119<_0x1c36ac;_0x7a7119++){var _0x5ca147=events[_0x7a7119];var _0x18936a=createListener(_0xf12a('0x5')+_0x5ca147,_0x4578c3);WhatsappAccountEvents['on'](_0x5ca147,_0x18936a);}}; \ No newline at end of file +var _0x72d7=['register','length','./whatsappAccount.events','save','update','emit'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x72d7,0x1f4));var _0x772d=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0x72d7[_0x3c2a69];return _0x596bc8;};'use strict';var WhatsappAccountEvents=require(_0x772d('0x0'));var events=[_0x772d('0x1'),'remove',_0x772d('0x2')];function createListener(_0x1087dc,_0x4dbaa1){return function(_0xec84da){_0x4dbaa1[_0x772d('0x3')](_0x1087dc,_0xec84da);};}function removeListener(_0xa9c05f,_0x39168d){return function(){WhatsappAccountEvents['removeListener'](_0xa9c05f,_0x39168d);};}exports[_0x772d('0x4')]=function(_0x4886e4){for(var _0x1ae887=0x0,_0x541222=events[_0x772d('0x5')];_0x1ae887<_0x541222;_0x1ae887++){var _0x204f88=events[_0x1ae887];var _0x58ece9=createListener('whatsappAccount:'+_0x204f88,_0x4886e4);WhatsappAccountEvents['on'](_0x204f88,_0x58ece9);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 0d95aa9..279ccb6 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 _0x3bbc=['post','put','/:id','delete','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','show'];(function(_0x2d99b8,_0x443f90){var _0x52c0b1=function(_0x2a04e0){while(--_0x2a04e0){_0x2d99b8['push'](_0x2d99b8['shift']());}};_0x52c0b1(++_0x443f90);}(_0x3bbc,0x19d));var _0xc3bb=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x3bbc[_0x3bf83f];return _0x22c4a9;};'use strict';var multer=require('multer');var util=require(_0xc3bb('0x0'));var path=require(_0xc3bb('0x1'));var timeout=require(_0xc3bb('0x2'));var express=require(_0xc3bb('0x3'));var router=express[_0xc3bb('0x4')]();var auth=require(_0xc3bb('0x5'));var interaction=require(_0xc3bb('0x6'));var config=require(_0xc3bb('0x7'));var controller=require('./whatsappApplication.controller');router[_0xc3bb('0x8')]('/',auth['isAuthenticated'](),controller[_0xc3bb('0x9')]);router[_0xc3bb('0x8')]('/:id',auth[_0xc3bb('0xa')](),controller[_0xc3bb('0xb')]);router[_0xc3bb('0xc')]('/',auth[_0xc3bb('0xa')](),controller['create']);router[_0xc3bb('0xd')](_0xc3bb('0xe'),auth[_0xc3bb('0xa')](),controller['update']);router[_0xc3bb('0xf')]('/:id',auth[_0xc3bb('0xa')](),controller['destroy']);module[_0xc3bb('0x10')]=router; \ No newline at end of file +var _0x88cf=['express','Router','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated','index','/:id','post','create','update','destroy','util','path'];(function(_0x533e4e,_0x4eba54){var _0x1f14bb=function(_0x33a485){while(--_0x33a485){_0x533e4e['push'](_0x533e4e['shift']());}};_0x1f14bb(++_0x4eba54);}(_0x88cf,0x1c0));var _0xf88c=function(_0x1b7413,_0xafdf0e){_0x1b7413=_0x1b7413-0x0;var _0x21c300=_0x88cf[_0x1b7413];return _0x21c300;};'use strict';var multer=require('multer');var util=require(_0xf88c('0x0'));var path=require(_0xf88c('0x1'));var timeout=require('connect-timeout');var express=require(_0xf88c('0x2'));var router=express[_0xf88c('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xf88c('0x4'));var config=require(_0xf88c('0x5'));var controller=require(_0xf88c('0x6'));router[_0xf88c('0x7')]('/',auth[_0xf88c('0x8')](),controller[_0xf88c('0x9')]);router['get'](_0xf88c('0xa'),auth['isAuthenticated'](),controller['show']);router[_0xf88c('0xb')]('/',auth[_0xf88c('0x8')](),controller[_0xf88c('0xc')]);router['put']('/:id',auth[_0xf88c('0x8')](),controller[_0xf88c('0xd')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xf88c('0xe')]);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 4c76875..76b8ed8 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 _0x1c05=['INTEGER','noop','STRING','*,*,*,*','exports'];(function(_0x4ffa03,_0x363a82){var _0x30d661=function(_0x36ba86){while(--_0x36ba86){_0x4ffa03['push'](_0x4ffa03['shift']());}};_0x30d661(++_0x363a82);}(_0x1c05,0x14e));var _0x51c0=function(_0x3f47e8,_0x1836a3){_0x3f47e8=_0x3f47e8-0x0;var _0x2f0708=_0x1c05[_0x3f47e8];return _0x2f0708;};'use strict';var Sequelize=require('sequelize');module[_0x51c0('0x0')]={'priority':{'type':Sequelize[_0x51c0('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x51c0('0x2')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x51c0('0x3')]},'interval':{'type':Sequelize[_0x51c0('0x3')],'defaultValue':_0x51c0('0x4')}}; \ No newline at end of file +var _0xb62c=['*,*,*,*','sequelize','INTEGER','STRING','noop','TEXT'];(function(_0x11495f,_0x27743e){var _0x44c272=function(_0x33b00e){while(--_0x33b00e){_0x11495f['push'](_0x11495f['shift']());}};_0x44c272(++_0x27743e);}(_0xb62c,0xa9));var _0xcb62=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb62c[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xcb62('0x0'));module['exports']={'priority':{'type':Sequelize[_0xcb62('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xcb62('0x2')],'allowNull':![],'defaultValue':_0xcb62('0x3')},'appdata':{'type':Sequelize[_0xcb62('0x4')]()},'description':{'type':Sequelize[_0xcb62('0x2')]},'interval':{'type':Sequelize[_0xcb62('0x2')],'defaultValue':_0xcb62('0x5')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index a3a7108..41fba7d 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 _0x5b70=['find','create','body','params','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','status','end','json','count','offset','set','apply','reject','save','update','then','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','VIRTUAL','merge','WhatsappApplication','includeAll','include','findAll','rows','catch','keys','options'];(function(_0x19f36c,_0x5a6432){var _0x41382e=function(_0x4942b1){while(--_0x4942b1){_0x19f36c['push'](_0x19f36c['shift']());}};_0x41382e(++_0x5a6432);}(_0x5b70,0xdf));var _0x05b7=function(_0x1ec3be,_0x5a224e){_0x1ec3be=_0x1ec3be-0x0;var _0x1df743=_0x5b70[_0x1ec3be];return _0x1df743;};'use strict';var pdf=require(_0x05b7('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x05b7('0x1'));var zipdir=require(_0x05b7('0x2'));var jsonpatch=require(_0x05b7('0x3'));var rp=require(_0x05b7('0x4'));var moment=require(_0x05b7('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x05b7('0x6'));var util=require(_0x05b7('0x7'));var path=require(_0x05b7('0x8'));var sox=require('sox');var csv=require(_0x05b7('0x9'));var ejs=require(_0x05b7('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x05b7('0xb'));var crypto=require(_0x05b7('0xc'));var jsforce=require(_0x05b7('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x05b7('0xe'));var Papa=require(_0x05b7('0xf'));var Redis=require(_0x05b7('0x10'));var authService=require(_0x05b7('0x11'));var qs=require(_0x05b7('0x12'));var as=require(_0x05b7('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x05b7('0x14'))(_0x05b7('0x15'));var utils=require(_0x05b7('0x16'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x56d237,_0x3684df){_0x3684df=_0x3684df||0xcc;return function(_0x56fd66){if(_0x56fd66){return _0x56d237['sendStatus'](_0x3684df);}return _0x56d237[_0x05b7('0x17')](_0x3684df)[_0x05b7('0x18')]();};}function respondWithResult(_0x9d149f,_0x21a666){_0x21a666=_0x21a666||0xc8;return function(_0x68d4fe){if(_0x68d4fe){return _0x9d149f[_0x05b7('0x17')](_0x21a666)[_0x05b7('0x19')](_0x68d4fe);}};}function respondWithFilteredResult(_0x52d1b8,_0x3dc027){return function(_0x7cbb4d){if(_0x7cbb4d){var _0x31ba4f=_0x7cbb4d[_0x05b7('0x1a')],_0x536f80=_0x3dc027[_0x05b7('0x1b')],_0x277671=_0x3dc027[_0x05b7('0x1b')]+_0x3dc027['limit'],_0x139e04;if(_0x277671>=_0x31ba4f){_0x277671=_0x31ba4f;_0x139e04=0xc8;}else{_0x139e04=0xce;}_0x52d1b8['status'](_0x139e04);return _0x52d1b8[_0x05b7('0x1c')]('Content-Range',_0x536f80+'-'+_0x277671+'/'+_0x31ba4f)[_0x05b7('0x19')](_0x7cbb4d);}return null;};}function patchUpdates(_0x1b61eb){return function(_0x213562){try{jsonpatch[_0x05b7('0x1d')](_0x213562,_0x1b61eb,!![]);}catch(_0x555e4d){return BPromise[_0x05b7('0x1e')](_0x555e4d);}return _0x213562[_0x05b7('0x1f')]();};}function saveUpdates(_0x3d329e,_0x2ecb60){return function(_0x233622){if(_0x233622){return _0x233622[_0x05b7('0x20')](_0x3d329e)[_0x05b7('0x21')](function(_0x521e49){return _0x521e49;});}return null;};}function removeEntity(_0x1bbba3,_0x48fca5){return function(_0x39e202){if(_0x39e202){return _0x39e202['destroy']()[_0x05b7('0x21')](function(){_0x1bbba3['status'](0xcc)[_0x05b7('0x18')]();});}};}function handleEntityNotFound(_0x1e5c81,_0x2a6884){return function(_0x2b0861){if(!_0x2b0861){_0x1e5c81[_0x05b7('0x22')](0x194);}return _0x2b0861;};}function handleError(_0x1e0be8,_0x5ea85d){_0x5ea85d=_0x5ea85d||0x1f4;return function(_0x131bbd){logger[_0x05b7('0x23')](_0x131bbd[_0x05b7('0x24')]);if(_0x131bbd['name']){delete _0x131bbd[_0x05b7('0x25')];}_0x1e0be8['status'](_0x5ea85d)[_0x05b7('0x26')](_0x131bbd);};}exports[_0x05b7('0x27')]=function(_0x59bd5d,_0x31ab82){var _0x2bab21={},_0x284b42={},_0x5c3aff={'count':0x0,'rows':[]};var _0x1b6e5b=_[_0x05b7('0x28')](db['WhatsappApplication'][_0x05b7('0x29')],function(_0x3b1a83){return{'name':_0x3b1a83[_0x05b7('0x2a')],'type':_0x3b1a83[_0x05b7('0x2b')]['key']};});_0x284b42[_0x05b7('0x2c')]=_['map'](_0x1b6e5b,_0x05b7('0x25'));_0x284b42[_0x05b7('0x2d')]=_['keys'](_0x59bd5d['query']);_0x284b42[_0x05b7('0x2e')]=_[_0x05b7('0x2f')](_0x284b42[_0x05b7('0x2c')],_0x284b42[_0x05b7('0x2d')]);_0x2bab21['attributes']=_['intersection'](_0x284b42[_0x05b7('0x2c')],qs[_0x05b7('0x30')](_0x59bd5d[_0x05b7('0x2d')][_0x05b7('0x30')]));_0x2bab21[_0x05b7('0x31')]=_0x2bab21['attributes'][_0x05b7('0x32')]?_0x2bab21[_0x05b7('0x31')]:_0x284b42['model'];if(!_0x59bd5d[_0x05b7('0x2d')][_0x05b7('0x33')](_0x05b7('0x34'))){_0x2bab21[_0x05b7('0x35')]=qs[_0x05b7('0x35')](_0x59bd5d[_0x05b7('0x2d')][_0x05b7('0x35')]);_0x2bab21[_0x05b7('0x1b')]=qs[_0x05b7('0x1b')](_0x59bd5d['query'][_0x05b7('0x1b')]);}_0x2bab21[_0x05b7('0x36')]=qs['sort'](_0x59bd5d['query'][_0x05b7('0x37')]);_0x2bab21[_0x05b7('0x38')]=qs[_0x05b7('0x2e')](_[_0x05b7('0x39')](_0x59bd5d[_0x05b7('0x2d')],_0x284b42[_0x05b7('0x2e')]),_0x1b6e5b);if(_0x59bd5d[_0x05b7('0x2d')][_0x05b7('0x3a')]){_0x2bab21[_0x05b7('0x38')]=_['merge'](_0x2bab21[_0x05b7('0x38')],{'$or':_[_0x05b7('0x28')](_0x1b6e5b,function(_0x3c01f0){if(_0x3c01f0[_0x05b7('0x2b')]!==_0x05b7('0x3b')){var _0x3ef06a={};_0x3ef06a[_0x3c01f0['name']]={'$like':'%'+_0x59bd5d[_0x05b7('0x2d')][_0x05b7('0x3a')]+'%'};return _0x3ef06a;}})});}_0x2bab21=_[_0x05b7('0x3c')]({},_0x2bab21,_0x59bd5d['options']);var _0x3df417={'where':_0x2bab21[_0x05b7('0x38')]};return db[_0x05b7('0x3d')]['count'](_0x3df417)['then'](function(_0x28535c){_0x5c3aff[_0x05b7('0x1a')]=_0x28535c;if(_0x59bd5d[_0x05b7('0x2d')][_0x05b7('0x3e')]){_0x2bab21[_0x05b7('0x3f')]=[{'all':!![]}];}return db['WhatsappApplication'][_0x05b7('0x40')](_0x2bab21);})[_0x05b7('0x21')](function(_0x2557b7){_0x5c3aff[_0x05b7('0x41')]=_0x2557b7;return _0x5c3aff;})[_0x05b7('0x21')](respondWithFilteredResult(_0x31ab82,_0x2bab21))[_0x05b7('0x42')](handleError(_0x31ab82,null));};exports['show']=function(_0x1eaf5c,_0x795004){var _0x21baf3={'raw':!![],'where':{'id':_0x1eaf5c['params']['id']}},_0x156704={};_0x156704[_0x05b7('0x2c')]=_[_0x05b7('0x43')](db[_0x05b7('0x3d')][_0x05b7('0x29')]);_0x156704[_0x05b7('0x2d')]=_[_0x05b7('0x43')](_0x1eaf5c['query']);_0x156704[_0x05b7('0x2e')]=_[_0x05b7('0x2f')](_0x156704['model'],_0x156704['query']);_0x21baf3[_0x05b7('0x31')]=_[_0x05b7('0x2f')](_0x156704[_0x05b7('0x2c')],qs[_0x05b7('0x30')](_0x1eaf5c[_0x05b7('0x2d')][_0x05b7('0x30')]));_0x21baf3[_0x05b7('0x31')]=_0x21baf3['attributes']['length']?_0x21baf3[_0x05b7('0x31')]:_0x156704[_0x05b7('0x2c')];if(_0x1eaf5c[_0x05b7('0x2d')]['includeAll']){_0x21baf3['include']=[{'all':!![]}];}_0x21baf3=_['merge']({},_0x21baf3,_0x1eaf5c[_0x05b7('0x44')]);return db[_0x05b7('0x3d')][_0x05b7('0x45')](_0x21baf3)[_0x05b7('0x21')](handleEntityNotFound(_0x795004,null))['then'](respondWithResult(_0x795004,null))['catch'](handleError(_0x795004,null));};exports[_0x05b7('0x46')]=function(_0x358044,_0xd06559){return db['WhatsappApplication'][_0x05b7('0x46')](_0x358044[_0x05b7('0x47')],{})[_0x05b7('0x21')](respondWithResult(_0xd06559,0xc9))[_0x05b7('0x42')](handleError(_0xd06559,null));};exports['update']=function(_0x547235,_0x327926){if(_0x547235['body']['id']){delete _0x547235[_0x05b7('0x47')]['id'];}return db[_0x05b7('0x3d')][_0x05b7('0x45')]({'where':{'id':_0x547235[_0x05b7('0x48')]['id']}})[_0x05b7('0x21')](handleEntityNotFound(_0x327926,null))['then'](saveUpdates(_0x547235[_0x05b7('0x47')],null))['then'](respondWithResult(_0x327926,null))['catch'](handleError(_0x327926,null));};exports['destroy']=function(_0x1abb6a,_0x36bb56){return db[_0x05b7('0x3d')][_0x05b7('0x45')]({'where':{'id':_0x1abb6a[_0x05b7('0x48')]['id']}})[_0x05b7('0x21')](handleEntityNotFound(_0x36bb56,null))[_0x05b7('0x21')](removeEntity(_0x36bb56,null))[_0x05b7('0x42')](handleError(_0x36bb56,null));}; \ No newline at end of file +var _0x02a5=['find','create','body','params','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','update','then','destroy','end','stack','name','send','index','map','WhatsappApplication','rawAttributes','fieldName','type','key','keys','filters','intersection','query','attributes','model','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','include','options'];(function(_0x4b6fb8,_0x12939e){var _0x178f80=function(_0x5af2b9){while(--_0x5af2b9){_0x4b6fb8['push'](_0x4b6fb8['shift']());}};_0x178f80(++_0x12939e);}(_0x02a5,0x129));var _0x502a=function(_0x567ea1,_0x3cb026){_0x567ea1=_0x567ea1-0x0;var _0x20964d=_0x02a5[_0x567ea1];return _0x20964d;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x502a('0x0'));var rimraf=require(_0x502a('0x1'));var zipdir=require(_0x502a('0x2'));var jsonpatch=require(_0x502a('0x3'));var rp=require(_0x502a('0x4'));var moment=require(_0x502a('0x5'));var BPromise=require(_0x502a('0x6'));var Mustache=require(_0x502a('0x7'));var util=require(_0x502a('0x8'));var path=require(_0x502a('0x9'));var sox=require('sox');var csv=require(_0x502a('0xa'));var ejs=require(_0x502a('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x502a('0xc'));var deskjs=require(_0x502a('0xd'));var toCsv=require(_0x502a('0xa'));var querystring=require('querystring');var Papa=require(_0x502a('0xe'));var Redis=require(_0x502a('0xf'));var authService=require(_0x502a('0x10'));var qs=require(_0x502a('0x11'));var as=require(_0x502a('0x12'));var hardwareService=require(_0x502a('0x13'));var logger=require(_0x502a('0x14'))(_0x502a('0x15'));var utils=require(_0x502a('0x16'));var config=require('../../config/environment');var db=require(_0x502a('0x17'))['db'];function respondWithStatusCode(_0xac3895,_0x2639ec){_0x2639ec=_0x2639ec||0xcc;return function(_0x2f9fd7){if(_0x2f9fd7){return _0xac3895[_0x502a('0x18')](_0x2639ec);}return _0xac3895['status'](_0x2639ec)['end']();};}function respondWithResult(_0x53ce01,_0x916178){_0x916178=_0x916178||0xc8;return function(_0x586329){if(_0x586329){return _0x53ce01[_0x502a('0x19')](_0x916178)[_0x502a('0x1a')](_0x586329);}};}function respondWithFilteredResult(_0x4d3d49,_0x2cb725){return function(_0x5d5df1){if(_0x5d5df1){var _0x4b6d58=_0x5d5df1[_0x502a('0x1b')],_0x11e415=_0x2cb725[_0x502a('0x1c')],_0xe240ab=_0x2cb725[_0x502a('0x1c')]+_0x2cb725[_0x502a('0x1d')],_0x3fb5a4;if(_0xe240ab>=_0x4b6d58){_0xe240ab=_0x4b6d58;_0x3fb5a4=0xc8;}else{_0x3fb5a4=0xce;}_0x4d3d49[_0x502a('0x19')](_0x3fb5a4);return _0x4d3d49[_0x502a('0x1e')](_0x502a('0x1f'),_0x11e415+'-'+_0xe240ab+'/'+_0x4b6d58)['json'](_0x5d5df1);}return null;};}function patchUpdates(_0x5619a7){return function(_0x3551b9){try{jsonpatch['apply'](_0x3551b9,_0x5619a7,!![]);}catch(_0x1d9645){return BPromise[_0x502a('0x20')](_0x1d9645);}return _0x3551b9['save']();};}function saveUpdates(_0x3694b3,_0x49bd15){return function(_0x542b0a){if(_0x542b0a){return _0x542b0a[_0x502a('0x21')](_0x3694b3)[_0x502a('0x22')](function(_0x520c5c){return _0x520c5c;});}return null;};}function removeEntity(_0x1c4e66,_0x1ff482){return function(_0x16bfd4){if(_0x16bfd4){return _0x16bfd4[_0x502a('0x23')]()[_0x502a('0x22')](function(){_0x1c4e66[_0x502a('0x19')](0xcc)[_0x502a('0x24')]();});}};}function handleEntityNotFound(_0x2955ed,_0x5434dd){return function(_0x1a554a){if(!_0x1a554a){_0x2955ed[_0x502a('0x18')](0x194);}return _0x1a554a;};}function handleError(_0x14fe4f,_0x142c24){_0x142c24=_0x142c24||0x1f4;return function(_0x26ef53){logger['error'](_0x26ef53[_0x502a('0x25')]);if(_0x26ef53[_0x502a('0x26')]){delete _0x26ef53['name'];}_0x14fe4f['status'](_0x142c24)[_0x502a('0x27')](_0x26ef53);};}exports[_0x502a('0x28')]=function(_0x281971,_0x406c87){var _0x57b0e6={},_0x29c607={},_0x4d4f6c={'count':0x0,'rows':[]};var _0x390e2c=_[_0x502a('0x29')](db[_0x502a('0x2a')][_0x502a('0x2b')],function(_0x1707cc){return{'name':_0x1707cc[_0x502a('0x2c')],'type':_0x1707cc[_0x502a('0x2d')][_0x502a('0x2e')]};});_0x29c607['model']=_['map'](_0x390e2c,'name');_0x29c607['query']=_[_0x502a('0x2f')](_0x281971['query']);_0x29c607[_0x502a('0x30')]=_[_0x502a('0x31')](_0x29c607['model'],_0x29c607[_0x502a('0x32')]);_0x57b0e6[_0x502a('0x33')]=_[_0x502a('0x31')](_0x29c607[_0x502a('0x34')],qs['fields'](_0x281971[_0x502a('0x32')][_0x502a('0x35')]));_0x57b0e6[_0x502a('0x33')]=_0x57b0e6[_0x502a('0x33')][_0x502a('0x36')]?_0x57b0e6[_0x502a('0x33')]:_0x29c607['model'];if(!_0x281971['query']['hasOwnProperty'](_0x502a('0x37'))){_0x57b0e6[_0x502a('0x1d')]=qs[_0x502a('0x1d')](_0x281971[_0x502a('0x32')][_0x502a('0x1d')]);_0x57b0e6[_0x502a('0x1c')]=qs[_0x502a('0x1c')](_0x281971['query'][_0x502a('0x1c')]);}_0x57b0e6[_0x502a('0x38')]=qs[_0x502a('0x39')](_0x281971[_0x502a('0x32')]['sort']);_0x57b0e6[_0x502a('0x3a')]=qs[_0x502a('0x30')](_[_0x502a('0x3b')](_0x281971['query'],_0x29c607[_0x502a('0x30')]),_0x390e2c);if(_0x281971[_0x502a('0x32')][_0x502a('0x3c')]){_0x57b0e6[_0x502a('0x3a')]=_[_0x502a('0x3d')](_0x57b0e6[_0x502a('0x3a')],{'$or':_['map'](_0x390e2c,function(_0x2ed6cf){if(_0x2ed6cf[_0x502a('0x2d')]!==_0x502a('0x3e')){var _0x2df53a={};_0x2df53a[_0x2ed6cf[_0x502a('0x26')]]={'$like':'%'+_0x281971[_0x502a('0x32')]['filter']+'%'};return _0x2df53a;}})});}_0x57b0e6=_['merge']({},_0x57b0e6,_0x281971['options']);var _0x357ad3={'where':_0x57b0e6[_0x502a('0x3a')]};return db[_0x502a('0x2a')]['count'](_0x357ad3)['then'](function(_0x290fc7){_0x4d4f6c[_0x502a('0x1b')]=_0x290fc7;if(_0x281971[_0x502a('0x32')][_0x502a('0x3f')]){_0x57b0e6['include']=[{'all':!![]}];}return db[_0x502a('0x2a')][_0x502a('0x40')](_0x57b0e6);})[_0x502a('0x22')](function(_0x54b41c){_0x4d4f6c[_0x502a('0x41')]=_0x54b41c;return _0x4d4f6c;})[_0x502a('0x22')](respondWithFilteredResult(_0x406c87,_0x57b0e6))['catch'](handleError(_0x406c87,null));};exports['show']=function(_0x2590d3,_0x33edac){var _0x5e9c58={'raw':!![],'where':{'id':_0x2590d3['params']['id']}},_0x3641bf={};_0x3641bf[_0x502a('0x34')]=_['keys'](db['WhatsappApplication']['rawAttributes']);_0x3641bf[_0x502a('0x32')]=_[_0x502a('0x2f')](_0x2590d3[_0x502a('0x32')]);_0x3641bf['filters']=_[_0x502a('0x31')](_0x3641bf['model'],_0x3641bf[_0x502a('0x32')]);_0x5e9c58['attributes']=_[_0x502a('0x31')](_0x3641bf[_0x502a('0x34')],qs[_0x502a('0x35')](_0x2590d3[_0x502a('0x32')][_0x502a('0x35')]));_0x5e9c58[_0x502a('0x33')]=_0x5e9c58[_0x502a('0x33')][_0x502a('0x36')]?_0x5e9c58[_0x502a('0x33')]:_0x3641bf[_0x502a('0x34')];if(_0x2590d3[_0x502a('0x32')]['includeAll']){_0x5e9c58[_0x502a('0x42')]=[{'all':!![]}];}_0x5e9c58=_[_0x502a('0x3d')]({},_0x5e9c58,_0x2590d3[_0x502a('0x43')]);return db[_0x502a('0x2a')][_0x502a('0x44')](_0x5e9c58)[_0x502a('0x22')](handleEntityNotFound(_0x33edac,null))['then'](respondWithResult(_0x33edac,null))['catch'](handleError(_0x33edac,null));};exports['create']=function(_0x29f072,_0x4edb48){return db['WhatsappApplication'][_0x502a('0x45')](_0x29f072[_0x502a('0x46')],{})[_0x502a('0x22')](respondWithResult(_0x4edb48,0xc9))['catch'](handleError(_0x4edb48,null));};exports['update']=function(_0x2d6ce8,_0x2d6aaa){if(_0x2d6ce8[_0x502a('0x46')]['id']){delete _0x2d6ce8[_0x502a('0x46')]['id'];}return db[_0x502a('0x2a')][_0x502a('0x44')]({'where':{'id':_0x2d6ce8['params']['id']}})[_0x502a('0x22')](handleEntityNotFound(_0x2d6aaa,null))[_0x502a('0x22')](saveUpdates(_0x2d6ce8[_0x502a('0x46')],null))[_0x502a('0x22')](respondWithResult(_0x2d6aaa,null))['catch'](handleError(_0x2d6aaa,null));};exports['destroy']=function(_0x39d2d1,_0x4dbda0){return db[_0x502a('0x2a')][_0x502a('0x44')]({'where':{'id':_0x39d2d1[_0x502a('0x47')]['id']}})[_0x502a('0x22')](handleEntityNotFound(_0x4dbda0,null))[_0x502a('0x22')](removeEntity(_0x4dbda0,null))[_0x502a('0x48')](handleError(_0x4dbda0,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index abdc084..5e403a8 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 _0x5687=['../../config/environment','./whatsappApplication.attributes','exports','define','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','rimraf'];(function(_0x3f03f2,_0x3cf184){var _0x486e11=function(_0x1cf6e1){while(--_0x1cf6e1){_0x3f03f2['push'](_0x3f03f2['shift']());}};_0x486e11(++_0x3cf184);}(_0x5687,0x13a));var _0x7568=function(_0x2d2b1d,_0x295b42){_0x2d2b1d=_0x2d2b1d-0x0;var _0xc0eabe=_0x5687[_0x2d2b1d];return _0xc0eabe;};'use strict';var _=require(_0x7568('0x0'));var util=require(_0x7568('0x1'));var logger=require(_0x7568('0x2'))(_0x7568('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x7568('0x4'));var config=require(_0x7568('0x5'));var attributes=require(_0x7568('0x6'));module[_0x7568('0x7')]=function(_0x118313,_0x1c5d93){return _0x118313[_0x7568('0x8')]('WhatsappApplication',attributes,{'tableName':'whatsapp_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7568('0x9'),'collate':_0x7568('0xa')});}; \ No newline at end of file +var _0xea38=['define','WhatsappApplication','whatsapp_applications','utf8mb4','lodash','../../config/logger','moment','bluebird','path','../../config/environment','./whatsappApplication.attributes','exports'];(function(_0x5614fb,_0x57e908){var _0x1bc73d=function(_0x1c4d0d){while(--_0x1c4d0d){_0x5614fb['push'](_0x5614fb['shift']());}};_0x1bc73d(++_0x57e908);}(_0xea38,0x148));var _0x8ea3=function(_0x8524c7,_0x47dc3a){_0x8524c7=_0x8524c7-0x0;var _0xbc97f7=_0xea38[_0x8524c7];return _0xbc97f7;};'use strict';var _=require(_0x8ea3('0x0'));var util=require('util');var logger=require(_0x8ea3('0x1'))('api');var moment=require(_0x8ea3('0x2'));var BPromise=require(_0x8ea3('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8ea3('0x4'));var rimraf=require('rimraf');var config=require(_0x8ea3('0x5'));var attributes=require(_0x8ea3('0x6'));module[_0x8ea3('0x7')]=function(_0x217611,_0x31c555){return _0x217611[_0x8ea3('0x8')](_0x8ea3('0x9'),attributes,{'tableName':_0x8ea3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8ea3('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index b53970b..8252b07 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 _0x6075=['code','message','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','WhatsappApplication,\x20%s,\x20%s,\x20%s','error'];(function(_0x3cb83f,_0x2bc6dd){var _0x105d68=function(_0x18bd0f){while(--_0x18bd0f){_0x3cb83f['push'](_0x3cb83f['shift']());}};_0x105d68(++_0x2bc6dd);}(_0x6075,0x191));var _0x5607=function(_0x238f20,_0x2995ec){_0x238f20=_0x238f20-0x0;var _0x14cc79=_0x6075[_0x238f20];return _0x14cc79;};'use strict';var _=require('lodash');var util=require(_0x5607('0x0'));var moment=require(_0x5607('0x1'));var BPromise=require(_0x5607('0x2'));var rs=require(_0x5607('0x3'));var fs=require('fs');var Redis=require(_0x5607('0x4'));var db=require(_0x5607('0x5'))['db'];var utils=require(_0x5607('0x6'));var logger=require(_0x5607('0x7'))(_0x5607('0x8'));var config=require('../../config/environment');var jayson=require(_0x5607('0x9'));var client=jayson[_0x5607('0xa')][_0x5607('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5ab18d,_0x53f825,_0x3dc860){return new BPromise(function(_0x25107d,_0x24d9da){return client[_0x5607('0xc')](_0x5ab18d,_0x3dc860)[_0x5607('0xd')](function(_0x4f61bf){logger[_0x5607('0xe')](_0x5607('0xf'),_0x53f825,_0x5607('0x10'));logger['debug'](_0x5607('0x11'),_0x53f825,'request\x20sent',JSON['stringify'](_0x4f61bf));if(_0x4f61bf[_0x5607('0x12')]){if(_0x4f61bf[_0x5607('0x12')][_0x5607('0x13')]===0x1f4){logger['error'](_0x5607('0xf'),_0x53f825,_0x4f61bf[_0x5607('0x12')][_0x5607('0x14')]);return _0x24d9da(_0x4f61bf[_0x5607('0x12')][_0x5607('0x14')]);}logger[_0x5607('0x12')](_0x5607('0xf'),_0x53f825,_0x4f61bf[_0x5607('0x12')][_0x5607('0x14')]);return _0x25107d(_0x4f61bf['error'][_0x5607('0x14')]);}else{logger[_0x5607('0xe')](_0x5607('0xf'),_0x53f825,'request\x20sent');_0x25107d(_0x4f61bf['result'][_0x5607('0x14')]);}})['catch'](function(_0x38ab1c){logger[_0x5607('0x12')](_0x5607('0xf'),_0x53f825,_0x38ab1c);_0x24d9da(_0x38ab1c);});});} \ No newline at end of file +var _0x254a=['http','request','info','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','WhatsappApplication,\x20%s,\x20%s','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x254a,0x138));var _0xa254=function(_0xfb65aa,_0x1651a6){_0xfb65aa=_0xfb65aa-0x0;var _0x2aee31=_0x254a[_0xfb65aa];return _0x2aee31;};'use strict';var _=require(_0xa254('0x0'));var util=require(_0xa254('0x1'));var moment=require(_0xa254('0x2'));var BPromise=require('bluebird');var rs=require(_0xa254('0x3'));var fs=require('fs');var Redis=require(_0xa254('0x4'));var db=require(_0xa254('0x5'))['db'];var utils=require(_0xa254('0x6'));var logger=require('../../config/logger')(_0xa254('0x7'));var config=require('../../config/environment');var jayson=require(_0xa254('0x8'));var client=jayson[_0xa254('0x9')][_0xa254('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x597d72,_0x5951b2,_0xaeed42){return new BPromise(function(_0x352a44,_0x50c5a3){return client[_0xa254('0xb')](_0x597d72,_0xaeed42)['then'](function(_0x19d140){logger[_0xa254('0xc')]('WhatsappApplication,\x20%s,\x20%s',_0x5951b2,'request\x20sent');logger[_0xa254('0xd')](_0xa254('0xe'),_0x5951b2,_0xa254('0xf'),JSON[_0xa254('0x10')](_0x19d140));if(_0x19d140[_0xa254('0x11')]){if(_0x19d140['error'][_0xa254('0x12')]===0x1f4){logger['error']('WhatsappApplication,\x20%s,\x20%s',_0x5951b2,_0x19d140[_0xa254('0x11')][_0xa254('0x13')]);return _0x50c5a3(_0x19d140['error'][_0xa254('0x13')]);}logger[_0xa254('0x11')](_0xa254('0x14'),_0x5951b2,_0x19d140[_0xa254('0x11')][_0xa254('0x13')]);return _0x352a44(_0x19d140['error'][_0xa254('0x13')]);}else{logger[_0xa254('0xc')](_0xa254('0x14'),_0x5951b2,_0xa254('0xf'));_0x352a44(_0x19d140[_0xa254('0x15')][_0xa254('0x13')]);}})[_0xa254('0x16')](function(_0x1f21ae){logger[_0xa254('0x11')]('WhatsappApplication,\x20%s,\x20%s',_0x5951b2,_0x1f21ae);_0x50c5a3(_0x1f21ae);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index edaf2b3..dfa8fd6 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 _0xa4e8=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','isAuthenticated','index','/describe','show','/:id/messages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','addTags','put','/:id','update','destroy','delete','exports','multer','util','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa4e8,0xfd));var _0x8a4e=function(_0xeb8e8d,_0x607771){_0xeb8e8d=_0xeb8e8d-0x0;var _0x309878=_0xa4e8[_0xeb8e8d];return _0x309878;};'use strict';var multer=require(_0x8a4e('0x0'));var util=require(_0x8a4e('0x1'));var path=require(_0x8a4e('0x2'));var timeout=require(_0x8a4e('0x3'));var express=require(_0x8a4e('0x4'));var router=express[_0x8a4e('0x5')]();var auth=require(_0x8a4e('0x6'));var interaction=require(_0x8a4e('0x7'));var config=require(_0x8a4e('0x8'));var controller=require(_0x8a4e('0x9'));router[_0x8a4e('0xa')]('/',auth[_0x8a4e('0xb')](),controller[_0x8a4e('0xc')]);router[_0x8a4e('0xa')](_0x8a4e('0xd'),auth[_0x8a4e('0xb')](),controller['describe']);router[_0x8a4e('0xa')]('/:id',auth[_0x8a4e('0xb')](),controller[_0x8a4e('0xe')]);router[_0x8a4e('0xa')](_0x8a4e('0xf'),auth[_0x8a4e('0xb')](),controller['getMessages']);router[_0x8a4e('0xa')](_0x8a4e('0x10'),auth[_0x8a4e('0xb')](),controller[_0x8a4e('0x11')]);router[_0x8a4e('0x12')]('/',auth[_0x8a4e('0xb')](),controller[_0x8a4e('0x13')]);router[_0x8a4e('0x12')]('/:id/messages',auth['isAuthenticated'](),controller[_0x8a4e('0x14')]);router[_0x8a4e('0x12')](_0x8a4e('0x15'),auth['isAuthenticated'](),interaction[_0x8a4e('0x16')](_0x8a4e('0x17'),_0x8a4e('0x18')),controller[_0x8a4e('0x19')]);router[_0x8a4e('0x1a')](_0x8a4e('0x1b'),auth['isAuthenticated'](),interaction['tracked']('whatsapp','whatsappinteraction:update'),controller[_0x8a4e('0x1c')]);router['delete']('/:id',auth[_0x8a4e('0xb')](),interaction['tracked'](_0x8a4e('0x17'),'whatsappinteraction:destroy'),controller[_0x8a4e('0x1d')]);router[_0x8a4e('0x1e')](_0x8a4e('0x15'),auth[_0x8a4e('0xb')](),controller['removeTags']);module[_0x8a4e('0x1f')]=router; \ No newline at end of file +var _0x679c=['whatsapp','whatsappinteraction:update','update','delete','whatsappinteraction:destroy','destroy','removeTags','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','whatsappinteraction:addtags','addTags'];(function(_0x34c542,_0x220b05){var _0x5b9ec2=function(_0x51dc4f){while(--_0x51dc4f){_0x34c542['push'](_0x34c542['shift']());}};_0x5b9ec2(++_0x220b05);}(_0x679c,0x128));var _0xc679=function(_0x4bfdbd,_0x486709){_0x4bfdbd=_0x4bfdbd-0x0;var _0x1625f5=_0x679c[_0x4bfdbd];return _0x1625f5;};'use strict';var multer=require(_0xc679('0x0'));var util=require('util');var path=require(_0xc679('0x1'));var timeout=require(_0xc679('0x2'));var express=require(_0xc679('0x3'));var router=express[_0xc679('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xc679('0x5'));var config=require(_0xc679('0x6'));var controller=require('./whatsappInteraction.controller');router[_0xc679('0x7')]('/',auth[_0xc679('0x8')](),controller[_0xc679('0x9')]);router['get'](_0xc679('0xa'),auth[_0xc679('0x8')](),controller['describe']);router[_0xc679('0x7')](_0xc679('0xb'),auth[_0xc679('0x8')](),controller[_0xc679('0xc')]);router[_0xc679('0x7')](_0xc679('0xd'),auth[_0xc679('0x8')](),controller[_0xc679('0xe')]);router['get'](_0xc679('0xf'),auth[_0xc679('0x8')](),controller[_0xc679('0x10')]);router[_0xc679('0x11')]('/',auth['isAuthenticated'](),controller[_0xc679('0x12')]);router[_0xc679('0x11')]('/:id/messages',auth[_0xc679('0x8')](),controller[_0xc679('0x13')]);router[_0xc679('0x11')](_0xc679('0x14'),auth[_0xc679('0x8')](),interaction[_0xc679('0x15')]('whatsapp',_0xc679('0x16')),controller[_0xc679('0x17')]);router['put'](_0xc679('0xb'),auth[_0xc679('0x8')](),interaction[_0xc679('0x15')](_0xc679('0x18'),_0xc679('0x19')),controller[_0xc679('0x1a')]);router[_0xc679('0x1b')](_0xc679('0xb'),auth[_0xc679('0x8')](),interaction['tracked']('whatsapp',_0xc679('0x1c')),controller[_0xc679('0x1d')]);router[_0xc679('0x1b')](_0xc679('0x14'),auth['isAuthenticated'](),controller[_0xc679('0x1e')]);module[_0xc679('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 5f2bb36..873afa4 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 _0x2ebd=['BOOLEAN','DATE','STRING','ENUM','out','sequelize','moment','exports'];(function(_0x5205c7,_0x4d83b1){var _0x16e253=function(_0x3b6887){while(--_0x3b6887){_0x5205c7['push'](_0x5205c7['shift']());}};_0x16e253(++_0x4d83b1);}(_0x2ebd,0x1c5));var _0xd2eb=function(_0xe1b523,_0x2bc05b){_0xe1b523=_0xe1b523-0x0;var _0x52c152=_0x2ebd[_0xe1b523];return _0x52c152;};'use strict';var Sequelize=require(_0xd2eb('0x0'));var moment=require(_0xd2eb('0x1'));module[_0xd2eb('0x2')]={'closed':{'type':Sequelize[_0xd2eb('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xd2eb('0x4')]},'disposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xd2eb('0x5')]},'read1stAt':{'type':Sequelize[_0xd2eb('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xd2eb('0x6')]('in',_0xd2eb('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xd2eb('0x4')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xd2eb('0x7')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x7e35=['ENUM','out','sequelize','moment','exports','BOOLEAN','DATE','STRING'];(function(_0x95fb74,_0x4deabb){var _0x1b30cb=function(_0x1c1666){while(--_0x1c1666){_0x95fb74['push'](_0x95fb74['shift']());}};_0x1b30cb(++_0x4deabb);}(_0x7e35,0x16a));var _0x57e3=function(_0x77962,_0x43e134){_0x77962=_0x77962-0x0;var _0x2fb21d=_0x7e35[_0x77962];return _0x2fb21d;};'use strict';var Sequelize=require(_0x57e3('0x0'));var moment=require(_0x57e3('0x1'));module[_0x57e3('0x2')]={'closed':{'type':Sequelize[_0x57e3('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x57e3('0x4')]},'disposition':{'type':Sequelize[_0x57e3('0x5')]},'note':{'type':Sequelize[_0x57e3('0x5')]},'phone':{'type':Sequelize[_0x57e3('0x5')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x57e3('0x6')]('in',_0x57e3('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x57e3('0x6')]('in',_0x57e3('0x7')),'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 f7e5e23..133e64d 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 _0x814b=['index','rawAttributes','type','key','model','query','intersection','attributes','length','nolimit','limit','order','sort','filters','select','field','color','from','tools_tags','u.id','u.fullname','ui.WhatsappInteractionId','users','u.id\x20=\x20ui.UserId','whatsapp_interactions','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','whatsapp_accounts','me.WhatsappInteractionId\x20=\x20i.id','whatsapp_interaction_has_tags','it.WhatsappInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','conditions','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','operator','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','union','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','find','UserId','body','keys','some','compact','WhatsappAccountId','where','i.WhatsappAccountId\x20IN\x20?','concat','createdAt','parse','$lte','\x20IS\x20NULL','\x20=\x20?','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','\x27\x27\x27\x27','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','Sequelize','QueryTypes','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','isEmpty','t.id\x20IN\x20?','journey','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','getWhatsappAccounts','toString','count','sequelize','fields','a.key','Account.key','Account.mandatoryDisposition','i.*','Contact.firstName','c.lastName','Contact.lastName','Contact.phone','Contact.mobile','c.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','ui.WhatsappInteractionId\x20IN\x20?','groupBy','all','rows','show','params','WhatsappInteraction','includeAll','merge','options','create','describe','addMessage','WhatsappMessage','ids','getMessages','findOne','hasOwnProperty','WhatsappInteractionId','$gte','format','YYYY-MM-DD\x20HH:mm:ss','include','findAll','addTags','setTags','spread','emit','whatsappInteractionTags:save','removeTags','download','unix','root','server','files','tmp','join','attachments','transcript-%d-%s.zip','User','fullname','Contact','firstName','lastName','Attachment','Messages','direction','secret','read','WhatsappAccount','Account','Owner','get','mkdirSync','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','%s\x20#%d','Whatsapp','YYYY-MM-DD','closedAt','disposition','existsSync','basename','out','System','renderFile','downloadInteraction.html','toFile','transcript-','.pdf','log','unlinkSync','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','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','status','end','json','offset','set','Content-Range','reject','save','update','destroy','then','error','stack','name','send','map','TagIds','split','forEach','push','catch'];(function(_0x14e23e,_0x5dafb6){var _0x1276e7=function(_0x326afe){while(--_0x326afe){_0x14e23e['push'](_0x14e23e['shift']());}};_0x1276e7(++_0x5dafb6);}(_0x814b,0x1a2));var _0xb814=function(_0x22cb5f,_0x2cdd63){_0x22cb5f=_0x22cb5f-0x0;var _0x274d36=_0x814b[_0x22cb5f];return _0x274d36;};'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 db=require(_0xb814('0x19'))['db'];config[_0xb814('0x1a')]=_[_0xb814('0x1b')](config[_0xb814('0x1a')],{'host':_0xb814('0x1c'),'port':0x18eb});var socket=require(_0xb814('0x1d'))(new Redis(config[_0xb814('0x1a')]));require(_0xb814('0x1e'))[_0xb814('0x1f')](socket);function respondWithStatusCode(_0x2ab627,_0x3f4881){_0x3f4881=_0x3f4881||0xcc;return function(_0x44fb96){if(_0x44fb96){return _0x2ab627[_0xb814('0x20')](_0x3f4881);}return _0x2ab627[_0xb814('0x21')](_0x3f4881)[_0xb814('0x22')]();};}function respondWithResult(_0x3a71d6,_0x45e0d0){_0x45e0d0=_0x45e0d0||0xc8;return function(_0x265a83){if(_0x265a83){return _0x3a71d6[_0xb814('0x21')](_0x45e0d0)[_0xb814('0x23')](_0x265a83);}};}function respondWithFilteredResult(_0x7a21ef,_0x48c9df){return function(_0x168a48){if(_0x168a48){var _0x55ba16=_0x168a48['count'],_0x270598=_0x48c9df['offset'],_0xfac75b=_0x48c9df[_0xb814('0x24')]+_0x48c9df['limit'],_0x4c3007;if(_0xfac75b>=_0x55ba16){_0xfac75b=_0x55ba16;_0x4c3007=0xc8;}else{_0x4c3007=0xce;}_0x7a21ef['status'](_0x4c3007);return _0x7a21ef[_0xb814('0x25')](_0xb814('0x26'),_0x270598+'-'+_0xfac75b+'/'+_0x55ba16)[_0xb814('0x23')](_0x168a48);}return null;};}function patchUpdates(_0x4e139e){return function(_0xf5b8aa){try{jsonpatch['apply'](_0xf5b8aa,_0x4e139e,!![]);}catch(_0x1e6393){return BPromise[_0xb814('0x27')](_0x1e6393);}return _0xf5b8aa[_0xb814('0x28')]();};}function saveUpdates(_0x470e81,_0x27352e){return function(_0x2bd039){if(_0x2bd039){return _0x2bd039[_0xb814('0x29')](_0x470e81)['then'](function(_0x2ead86){return _0x2ead86;});}return null;};}function removeEntity(_0x52b7a3,_0x3f81d0){return function(_0x457dac){if(_0x457dac){return _0x457dac[_0xb814('0x2a')]()[_0xb814('0x2b')](function(){_0x52b7a3[_0xb814('0x21')](0xcc)[_0xb814('0x22')]();});}};}function handleEntityNotFound(_0x3d836c,_0x5755ea){return function(_0x392222){if(!_0x392222){_0x3d836c[_0xb814('0x20')](0x194);}return _0x392222;};}function handleError(_0x1c2625,_0x349394){_0x349394=_0x349394||0x1f4;return function(_0x32ed56){logger[_0xb814('0x2c')](_0x32ed56[_0xb814('0x2d')]);if(_0x32ed56[_0xb814('0x2e')]){delete _0x32ed56['name'];}_0x1c2625[_0xb814('0x21')](_0x349394)[_0xb814('0x2f')](_0x32ed56);};}function getInteractionUsers(_0x52ed64,_0x9008b2){return new BPromise(function(_0x37d24d,_0x530744){try{if(_0x9008b2[_0x52ed64['id']]){_0x52ed64['Users']=_[_0xb814('0x30')](_0x9008b2[_0x52ed64['id']],function(_0x2051d0){return{'id':_0x2051d0['id'],'fullname':_0x2051d0['fullname']};});}}catch(_0x338a28){_0x530744(_0x338a28);}_0x37d24d(_0x52ed64);});}function getInteractionTags(_0x526610,_0x6efe9a){return new BPromise(function(_0x5f3e9b,_0x4cfc58){try{if(_0x526610[_0xb814('0x31')]){_0x526610['Tags']=[];_0x526610[_0xb814('0x31')][_0xb814('0x32')](',')[_0xb814('0x33')](function(_0x599f9f){_0x526610['Tags'][_0xb814('0x34')](_0x6efe9a[_0x599f9f]);});}delete _0x526610[_0xb814('0x31')];}catch(_0x523566){_0x4cfc58(_0x523566);}_0x5f3e9b(_0x526610);});}function updateWhatsappInteraction(_0x2c8943,_0xe558d5,_0x692c72){return new BPromise(function(_0x217b7e,_0x1b78de){return getInteractionUsers(_0x2c8943,_0x692c72)[_0xb814('0x2b')](function(_0x3672f3){return getInteractionTags(_0x3672f3,_0xe558d5);})['then'](function(_0x3207ec){_0x217b7e(_0x3207ec);})[_0xb814('0x35')](function(_0x30de5a){_0x1b78de(_0x30de5a);});});}exports[_0xb814('0x36')]=function(_0x14100d,_0x4ff31a){var _0x16ef82={},_0x57e6e6={},_0x43db67={'count':0x0,'rows':[]};var _0x16e21c=_[_0xb814('0x30')](db['WhatsappInteraction'][_0xb814('0x37')],function(_0xbdb3e9){return{'name':_0xbdb3e9['fieldName'],'type':_0xbdb3e9[_0xb814('0x38')][_0xb814('0x39')]};});_0x57e6e6[_0xb814('0x3a')]=_[_0xb814('0x30')](_0x16e21c,_0xb814('0x2e'));_0x57e6e6[_0xb814('0x3b')]=_['keys'](_0x14100d[_0xb814('0x3b')]);_0x57e6e6['filters']=_[_0xb814('0x3c')](_0x57e6e6['model'],_0x57e6e6[_0xb814('0x3b')]);_0x16ef82['attributes']=_[_0xb814('0x3c')](_0x57e6e6[_0xb814('0x3a')],qs['fields'](_0x14100d['query']['fields']));_0x16ef82['attributes']=_0x16ef82[_0xb814('0x3d')][_0xb814('0x3e')]?_0x16ef82[_0xb814('0x3d')]:_0x57e6e6[_0xb814('0x3a')];if(!_0x14100d['query']['hasOwnProperty'](_0xb814('0x3f'))){_0x16ef82['limit']=qs[_0xb814('0x40')](_0x14100d[_0xb814('0x3b')][_0xb814('0x40')]);_0x16ef82[_0xb814('0x24')]=qs[_0xb814('0x24')](_0x14100d[_0xb814('0x3b')][_0xb814('0x24')]);}_0x16ef82[_0xb814('0x41')]=qs[_0xb814('0x42')](_0x14100d['query']['sort']);_0x16ef82['where']=qs[_0xb814('0x43')](_['pick'](_0x14100d[_0xb814('0x3b')],_0x57e6e6['filters']),_0x16e21c);var _0x411723=[];var _0x44ff56=squel[_0xb814('0x44')]()[_0xb814('0x45')]('id')['field'](_0xb814('0x2e'))[_0xb814('0x45')](_0xb814('0x46'))[_0xb814('0x47')](_0xb814('0x48'));var _0x450a08=squel['select']()[_0xb814('0x45')](_0xb814('0x49'))[_0xb814('0x45')](_0xb814('0x4a'))[_0xb814('0x45')](_0xb814('0x4b'))[_0xb814('0x47')]('user_has_whatsapp_interactions','ui')['left_join'](_0xb814('0x4c'),'u',_0xb814('0x4d'));var _0x4c08d6=squel[_0xb814('0x44')]()[_0xb814('0x47')](_0xb814('0x4e'),'i')[_0xb814('0x4f')](_0xb814('0x50'),'c',_0xb814('0x51'))[_0xb814('0x4f')](_0xb814('0x4c'),'o','o.id\x20=\x20i.UserId')[_0xb814('0x4f')](_0xb814('0x52'),'a','a.id\x20=\x20i.WhatsappAccountId')[_0xb814('0x4f')]('whatsapp_messages','me',_0xb814('0x53'))[_0xb814('0x4f')](_0xb814('0x54'),'it',_0xb814('0x55'))[_0xb814('0x4f')](_0xb814('0x48'),'t',_0xb814('0x56'));var _0x45480e=squel[_0xb814('0x57')]();var _0x2a422a=[];var _0x5e6df7=squel['expr']();var _0x32eca6;if(_0x14100d[_0xb814('0x3b')][_0xb814('0x58')]){_0x32eca6=as[_0xb814('0x59')](_0x14100d[_0xb814('0x3b')][_0xb814('0x58')]);var _0x135208=_0x32eca6['sqlOperator'];for(var _0x26fd0b=0x0;_0x26fd0b<_0x32eca6[_0xb814('0x5a')][_0xb814('0x3e')];_0x26fd0b++){var _0x5a916d=_0x32eca6[_0xb814('0x5a')][_0x26fd0b];var _0x4e6f3c='i';var _0x252293=_['find'](_0x16e21c,[_0xb814('0x2e'),_0x5a916d[_0xb814('0x45')]]);if(!_0x252293){switch(_0x5a916d['field']){case _0xb814('0x5b'):if(_0x5a916d[_0xb814('0x5c')]==0x1){_0x4c08d6[_0xb814('0x5d')]('`'+_0x5a916d['field']+_0xb814('0x5e'));}else{_0x4c08d6['having']('`'+_0x5a916d[_0xb814('0x45')]+_0xb814('0x5f'));}break;case'Contact':if(_0x5a916d[_0xb814('0x60')]==='$substring'){if(_0x5a916d['value'][_0xb814('0x32')]('\x20')[_0xb814('0x3e')]>0x1){_0x45480e[_0x135208](_0xb814('0x61'),qs['getFullTextValue'](_0x5a916d[_0xb814('0x5c')]),null);}else{var _0x538b0f='%'+_0x5a916d[_0xb814('0x5c')]+'%';_0x45480e[_0x135208](_0xb814('0x62'),_0x538b0f,_0x538b0f,_0x538b0f);}}else{_0x252293=_['find'](_0x16e21c,[_0xb814('0x2e'),'ContactId']);_0x5a916d[_0xb814('0x45')]=_0xb814('0x63');_0x135e13=as[_0xb814('0x64')](_0x4e6f3c,_0x252293[_0xb814('0x38')],_0x5a916d);_0x45480e[_0x135208](_0x135e13[_0xb814('0x65')],_0x135e13[_0xb814('0x5c')][_0xb814('0x66')],_0x135e13[_0xb814('0x5c')]['end']);}break;case _0xb814('0x67'):var _0x5441c5=_0x5a916d['value'][_0xb814('0x32')](',')[_0xb814('0x30')](function(_0x4d13db){return Number(_0x4d13db);});_0x5441c5[_0xb814('0x33')](function(_0x58b9a6){_0x5e6df7['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x58b9a6+',%');});_0x2a422a=_[_0xb814('0x68')](_0x2a422a,_0x5441c5);break;case'User':if(_0x5a916d[_0xb814('0x60')]===_0xb814('0x69')){_0x45480e[_0x135208](_0xb814('0x6a'),'%'+_0x5a916d['value']+'%',null);}else{_0x252293=_[_0xb814('0x6b')](_0x16e21c,['name',_0xb814('0x6c')]);_0x5a916d[_0xb814('0x45')]=_0xb814('0x6c');_0x135e13=as[_0xb814('0x64')](_0x4e6f3c,_0x252293[_0xb814('0x38')],_0x5a916d);_0x45480e[_0x135208](_0x135e13[_0xb814('0x65')],_0x135e13[_0xb814('0x5c')][_0xb814('0x66')],_0x135e13[_0xb814('0x5c')]['end']);}break;case _0xb814('0x6d'):_0x135e13=as[_0xb814('0x64')]('me',null,_0x5a916d);_0x45480e[_0x135208](_0x135e13[_0xb814('0x65')],_0x135e13[_0xb814('0x5c')][_0xb814('0x66')],_0x135e13[_0xb814('0x5c')]['end']);break;}}else{var _0x135e13=as['buildExpression'](_0x4e6f3c,_0x252293[_0xb814('0x38')],_0x5a916d);_0x45480e[_0x135208](_0x135e13[_0xb814('0x65')],_0x135e13[_0xb814('0x5c')]['start'],_0x135e13[_0xb814('0x5c')]['end']);}}}else{var _0x37e9c5=_(_0x14100d['query'])[_0xb814('0x6e')]()[_0xb814('0x30')](function(_0xa03cd2){return _[_0xb814('0x6f')](_0x16e21c,[_0xb814('0x2e'),_0xa03cd2])?_0xa03cd2:undefined;})[_0xb814('0x70')]()[_0xb814('0x5c')]();if(!_['isEmpty'](_0x37e9c5)){_0x37e9c5[_0xb814('0x33')](function(_0x51ca51){if(_0x51ca51===_0xb814('0x71')){_0x4c08d6[_0xb814('0x72')](_0xb814('0x73'),[][_0xb814('0x74')](_0x14100d[_0xb814('0x3b')][_0x51ca51]));}else if(_0x51ca51===_0xb814('0x75')){var _0x514dab=JSON[_0xb814('0x76')](_0x14100d[_0xb814('0x3b')][_0x51ca51])['$gte'];var _0x3bb2b4=JSON[_0xb814('0x76')](_0x14100d[_0xb814('0x3b')][_0x51ca51])[_0xb814('0x77')];_0x4c08d6[_0xb814('0x72')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x514dab,_0x3bb2b4);}else{if(_0x14100d[_0xb814('0x3b')][_0x51ca51]==='null'){_0x4c08d6[_0xb814('0x72')]('i.'+_0x51ca51+_0xb814('0x78'));}else{_0x4c08d6[_0xb814('0x72')]('i.'+_0x51ca51+_0xb814('0x79'),_0x14100d[_0xb814('0x3b')][_0x51ca51]);}}});}if(_0x14100d[_0xb814('0x3b')]['read']){if(_0x14100d['query']['read']==0x1){_0x4c08d6[_0xb814('0x5d')]('`unreadMessages`\x20=\x200');}else{_0x4c08d6[_0xb814('0x5d')](_0xb814('0x7a'));}}if(_0x14100d[_0xb814('0x3b')]['tag']){_0x2a422a=_[_0xb814('0x7b')](_0x14100d[_0xb814('0x3b')][_0xb814('0x7c')])?_0x14100d['query'][_0xb814('0x7c')]:new Array(_0x14100d[_0xb814('0x3b')][_0xb814('0x7c')]);_0x2a422a[_0xb814('0x33')](function(_0x555be0){_0x5e6df7['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x555be0+',%');});}if(_0x14100d[_0xb814('0x3b')][_0xb814('0x7d')]){var _0x39863d=_0x14100d[_0xb814('0x3b')][_0xb814('0x7d')][_0xb814('0x7e')]('\x5c','\x5c\x5c')[_0xb814('0x7e')]('\x27\x27',_0xb814('0x7f'));if(qs[_0xb814('0x80')](_0x39863d)){_0x45480e['or'](_0xb814('0x81'),_0x39863d+'%')['or'](_0xb814('0x82'),_0x39863d+'%');}else{_0x45480e['or'](_0xb814('0x83'),qs[_0xb814('0x84')](_0x39863d))['or'](_0xb814('0x85'),_0x39863d+'%');}}}_0x4c08d6[_0xb814('0x72')](_0x45480e);_0x4c08d6['group'](_0xb814('0x86'));var _0x33cfc4={'type':db[_0xb814('0x87')][_0xb814('0x88')][_0xb814('0x89')],'raw':!![]};var _0x283b0f=_0x4c08d6['clone']();_0x283b0f[_0xb814('0x45')]('i.id');_0x283b0f[_0xb814('0x45')](_0xb814('0x8a'),_0xb814('0x5b'));if(_0x16ef82[_0xb814('0x41')]){_0x16ef82[_0xb814('0x41')]['forEach'](function(_0x4c44ee){_0x4c08d6[_0xb814('0x41')]('i.'+_0x4c44ee[0x0],_0x4c44ee[0x1]===_0xb814('0x8b')?![]:!![]);});}if(!_[_0xb814('0x8c')](_0x2a422a)){_0x4c08d6[_0xb814('0x5d')](_0x5e6df7);_0x283b0f['where'](_0xb814('0x8d'),_0x2a422a);}BPromise['resolve']()[_0xb814('0x2b')](function(){if(!_0x32eca6){if(_0x14100d[_0xb814('0x3b')]['WhatsappAccountId']||_0x14100d['query'][_0xb814('0x8e')])return;_0x283b0f['where'](_0xb814('0x8f'));_0x4c08d6[_0xb814('0x72')](_0xb814('0x8f'));return;}return _0x14100d[_0xb814('0x90')][_0xb814('0x91')]({'attributes':['id'],'raw':!![]})[_0xb814('0x2b')](function(_0x40fe4a){if(_['isEmpty'](_0x40fe4a)){_0x283b0f[_0xb814('0x72')]('i.WhatsappAccountId\x20IS\x20NULL');_0x4c08d6[_0xb814('0x72')]('i.WhatsappAccountId\x20IS\x20NULL');}else{_0x283b0f[_0xb814('0x72')](_0xb814('0x73'),_['map'](_0x40fe4a,'id'));_0x4c08d6[_0xb814('0x72')]('i.WhatsappAccountId\x20IN\x20?',_[_0xb814('0x30')](_0x40fe4a,'id'));}});})[_0xb814('0x2b')](function(){db['sequelize']['query'](_0x283b0f[_0xb814('0x92')](),_0x33cfc4)[_0xb814('0x2b')](function(_0x3309c5){_0x43db67[_0xb814('0x93')]=_0x3309c5[_0xb814('0x3e')];if(_0x43db67[_0xb814('0x93')]===0x0)return[];return db[_0xb814('0x94')][_0xb814('0x3b')](_0x44ff56[_0xb814('0x92')](),_0x33cfc4)[_0xb814('0x2b')](function(_0x53e705){_0x411723=_['keyBy'](_0x53e705,'id');_0x33cfc4=_['merge'](_0x33cfc4,{'model':db['WhatsappInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x14100d['query'][_0xb814('0x95')]){_0x16ef82[_0xb814('0x3d')][_0xb814('0x33')](function(_0x59f3ff){_0x4c08d6[_0xb814('0x45')]('i.'+_0x59f3ff);});}else{_0x4c08d6[_0xb814('0x45')](_0xb814('0x8a'),_0xb814('0x5b'));_0x4c08d6[_0xb814('0x45')](_0xb814('0x96'),_0xb814('0x97'));_0x4c08d6[_0xb814('0x45')]('a.mandatoryDisposition',_0xb814('0x98'));_0x4c08d6[_0xb814('0x45')](_0xb814('0x99'));_0x4c08d6[_0xb814('0x45')]('c.firstName',_0xb814('0x9a'));_0x4c08d6[_0xb814('0x45')](_0xb814('0x9b'),_0xb814('0x9c'));_0x4c08d6[_0xb814('0x45')]('c.email','Contact.email');_0x4c08d6[_0xb814('0x45')]('c.phone',_0xb814('0x9d'));_0x4c08d6[_0xb814('0x45')]('c.mobile',_0xb814('0x9e'));_0x4c08d6['field'](_0xb814('0x9f'),'Contact.fax');_0x4c08d6[_0xb814('0x45')](_0xb814('0xa0'),_0xb814('0xa1'));_0x4c08d6[_0xb814('0x45')](_0xb814('0xa2'),_0xb814('0xa3'));_0x4c08d6[_0xb814('0x45')]('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');}if(_0x16ef82[_0xb814('0x40')])_0x4c08d6['limit'](_0x16ef82['limit']);if(_0x16ef82[_0xb814('0x24')])_0x4c08d6[_0xb814('0x24')](_0x16ef82[_0xb814('0x24')]);return db['sequelize'][_0xb814('0x3b')](_0x4c08d6['toString'](),_0x33cfc4);})[_0xb814('0x2b')](function(_0x19d508){_0x450a08[_0xb814('0x72')](_0xb814('0xa4'),_['map'](_0x19d508,'id'));return db[_0xb814('0x94')][_0xb814('0x3b')](_0x450a08[_0xb814('0x92')](),_0x33cfc4)['then'](function(_0x1ebbf6){var _0x3fc77d=_[_0xb814('0xa5')](_0x1ebbf6,'WhatsappInteractionId');var _0x5d8626=[];_0x19d508[_0xb814('0x33')](function(_0x9dc06b){_0x5d8626[_0xb814('0x34')](updateWhatsappInteraction(_0x9dc06b,_0x411723,_0x3fc77d));});return BPromise[_0xb814('0xa6')](_0x5d8626);});});})[_0xb814('0x2b')](function(_0x37a7ab){_0x43db67[_0xb814('0xa7')]=_0x37a7ab;return _0x43db67;})[_0xb814('0x2b')](respondWithFilteredResult(_0x4ff31a,_0x16ef82));})[_0xb814('0x35')](handleError(_0x4ff31a,null));};exports[_0xb814('0xa8')]=function(_0x2569a5,_0x2a13fb){var _0x5b8d2e={'raw':![],'where':{'id':_0x2569a5[_0xb814('0xa9')]['id']}},_0x5416dc={};_0x5416dc['model']=_[_0xb814('0x6e')](db[_0xb814('0xaa')][_0xb814('0x37')]);_0x5416dc[_0xb814('0x3b')]=_[_0xb814('0x6e')](_0x2569a5[_0xb814('0x3b')]);_0x5416dc[_0xb814('0x43')]=_['intersection'](_0x5416dc['model'],_0x5416dc[_0xb814('0x3b')]);_0x5b8d2e['attributes']=_[_0xb814('0x3c')](_0x5416dc[_0xb814('0x3a')],qs[_0xb814('0x95')](_0x2569a5['query'][_0xb814('0x95')]));_0x5b8d2e[_0xb814('0x3d')]=_0x5b8d2e[_0xb814('0x3d')][_0xb814('0x3e')]?_0x5b8d2e[_0xb814('0x3d')]:_0x5416dc['model'];if(_0x2569a5[_0xb814('0x3b')][_0xb814('0xab')]){_0x5b8d2e['include']=[{'all':!![]}];}_0x5b8d2e=_[_0xb814('0xac')]({},_0x5b8d2e,_0x2569a5[_0xb814('0xad')]);return db[_0xb814('0xaa')]['find'](_0x5b8d2e)[_0xb814('0x2b')](handleEntityNotFound(_0x2a13fb,null))[_0xb814('0x2b')](respondWithResult(_0x2a13fb,null))['catch'](handleError(_0x2a13fb,null));};exports[_0xb814('0xae')]=function(_0x171f83,_0x5b5634){return db[_0xb814('0xaa')][_0xb814('0xae')](_0x171f83[_0xb814('0x6d')],{})[_0xb814('0x2b')](respondWithResult(_0x5b5634,0xc9))[_0xb814('0x35')](handleError(_0x5b5634,null));};exports[_0xb814('0x29')]=function(_0x40ae0b,_0x336a8f){if(_0x40ae0b[_0xb814('0x6d')]['id']){delete _0x40ae0b[_0xb814('0x6d')]['id'];}return db[_0xb814('0xaa')][_0xb814('0x6b')]({'where':{'id':_0x40ae0b['params']['id']}})['then'](handleEntityNotFound(_0x336a8f,null))[_0xb814('0x2b')](saveUpdates(_0x40ae0b['body'],null))['then'](respondWithResult(_0x336a8f,null))[_0xb814('0x35')](handleError(_0x336a8f,null));};exports['destroy']=function(_0x4f0427,_0x50cb34){return db[_0xb814('0xaa')][_0xb814('0x6b')]({'where':{'id':_0x4f0427[_0xb814('0xa9')]['id']}})['then'](handleEntityNotFound(_0x50cb34,null))[_0xb814('0x2b')](removeEntity(_0x50cb34,null))['catch'](handleError(_0x50cb34,null));};exports[_0xb814('0xaf')]=function(_0x2e6660,_0x49a8de){return db[_0xb814('0xaa')]['describe']()[_0xb814('0x2b')](respondWithResult(_0x49a8de,null))[_0xb814('0x35')](handleError(_0x49a8de,null));};exports[_0xb814('0xb0')]=function(_0x39ce17,_0x11efb8,_0xaf705d){return db[_0xb814('0xb1')][_0xb814('0x6b')]({'where':{'id':_0x39ce17[_0xb814('0xa9')]['id']}})[_0xb814('0x2b')](handleEntityNotFound(_0x11efb8,null))[_0xb814('0x2b')](function(_0x3e7a9a){if(_0x3e7a9a){return _0x3e7a9a[_0xb814('0xb0')](_0x39ce17[_0xb814('0x6d')][_0xb814('0xb2')],_['omit'](_0x39ce17[_0xb814('0x6d')],[_0xb814('0xb2'),'id'])||{});}})['then'](respondWithResult(_0x11efb8,null))[_0xb814('0x35')](handleError(_0x11efb8,null));};exports[_0xb814('0xb3')]=function(_0x1868d9,_0x570191,_0x56b2aa){var _0x473b30={'raw':![],'where':{}};var _0x4af71e={};var _0x2d40e6={'count':0x0,'rows':[]};return db['WhatsappInteraction'][_0xb814('0xb4')]({'where':{'id':_0x1868d9['params']['id']}})['then'](handleEntityNotFound(_0x570191,null))[_0xb814('0x2b')](function(_0x32c956){if(_0x32c956){_0x4af71e[_0xb814('0x3a')]=_[_0xb814('0x6e')](db[_0xb814('0xb1')][_0xb814('0x37')]);_0x4af71e[_0xb814('0x3b')]=_[_0xb814('0x6e')](_0x1868d9[_0xb814('0x3b')]);_0x4af71e[_0xb814('0x43')]=_[_0xb814('0x3c')](_0x4af71e['model'],_0x4af71e[_0xb814('0x3b')]);_0x473b30['attributes']=_[_0xb814('0x3c')](_0x4af71e[_0xb814('0x3a')],qs[_0xb814('0x95')](_0x1868d9['query'][_0xb814('0x95')]));_0x473b30[_0xb814('0x3d')]=_0x473b30[_0xb814('0x3d')][_0xb814('0x3e')]?_0x473b30[_0xb814('0x3d')]:_0x4af71e[_0xb814('0x3a')];if(!_0x1868d9[_0xb814('0x3b')][_0xb814('0xb5')](_0xb814('0x3f'))){_0x473b30[_0xb814('0x40')]=qs[_0xb814('0x40')](_0x1868d9[_0xb814('0x3b')][_0xb814('0x40')]);_0x473b30[_0xb814('0x24')]=qs[_0xb814('0x24')](_0x1868d9['query'][_0xb814('0x24')]);}_0x473b30[_0xb814('0x41')]=qs[_0xb814('0x42')](_0x1868d9['query']['sort']);_0x473b30[_0xb814('0x72')]=qs['filters'](_['pick'](_0x1868d9['query'],_0x4af71e['filters']));_0x473b30[_0xb814('0x72')][_0xb814('0xb6')]=_0x32c956['id'];if(_0x1868d9['query'][_0xb814('0x7d')]){_0x473b30[_0xb814('0x72')]=_[_0xb814('0xac')](_0x473b30[_0xb814('0x72')],{'$or':_[_0xb814('0x30')](_0x473b30[_0xb814('0x3d')],function(_0x20e608){var _0x7b9948={};_0x7b9948[_0x20e608]={'$like':'%'+_0x1868d9[_0xb814('0x3b')][_0xb814('0x7d')]+'%'};return _0x7b9948;})});}if(_0x1868d9[_0xb814('0x3b')]['$gte']){var _0x2a5dff=_0x1868d9['query'][_0xb814('0xb7')][_0xb814('0x32')](',');var _0x35e8f7={};_0x35e8f7[_0x2a5dff[0x0]]={'$gte':moment(_0x2a5dff[0x1])[_0xb814('0xb8')](_0xb814('0xb9'))};_0x473b30[_0xb814('0x72')]=_[_0xb814('0xac')](_0x473b30[_0xb814('0x72')],_0x35e8f7);}_0x473b30=_['merge']({},_0x473b30,_0x1868d9['options']);return db['WhatsappMessage'][_0xb814('0x93')]({'where':_0x473b30[_0xb814('0x72')]})[_0xb814('0x2b')](function(_0x3b7bee){_0x2d40e6[_0xb814('0x93')]=_0x3b7bee;if(_0x1868d9[_0xb814('0x3b')][_0xb814('0xab')]){_0x473b30[_0xb814('0xba')]=[{'all':!![]}];}return db[_0xb814('0xb1')][_0xb814('0xbb')](_0x473b30);})['then'](function(_0x5c989a){_0x2d40e6[_0xb814('0xa7')]=_0x5c989a;return _0x2d40e6;});}})[_0xb814('0x2b')](respondWithFilteredResult(_0x570191,_0x473b30))[_0xb814('0x35')](handleError(_0x570191,null));};exports[_0xb814('0xbc')]=function(_0x3f0c9c,_0x2642ab,_0x48358c){return db[_0xb814('0xaa')]['find']({'where':{'id':_0x3f0c9c[_0xb814('0xa9')]['id']}})[_0xb814('0x2b')](handleEntityNotFound(_0x2642ab,null))[_0xb814('0x2b')](function(_0x94aa05){if(_0x94aa05){return _0x94aa05[_0xb814('0xbd')](_0x3f0c9c[_0xb814('0x6d')][_0xb814('0xb2')],_['omit'](_0x3f0c9c[_0xb814('0x6d')],[_0xb814('0xb2'),'id'])||{})[_0xb814('0xbe')](function(){return db[_0xb814('0x67')]['findAll']({'attributes':['id',_0xb814('0x2e'),_0xb814('0x46')],'where':{'id':_0x3f0c9c[_0xb814('0x6d')][_0xb814('0xb2')]}});})[_0xb814('0x2b')](function(_0x4a2aa5){socket[_0xb814('0xbf')](_0xb814('0xc0'),{'id':Number(_0x3f0c9c[_0xb814('0xa9')]['id']),'tags':_0x4a2aa5||[]});return{'id':Number(_0x3f0c9c['params']['id']),'tags':_0x4a2aa5||[]};});}})[_0xb814('0x2b')](respondWithResult(_0x2642ab,null))['catch'](handleError(_0x2642ab,null));};exports[_0xb814('0xc1')]=function(_0x5b4315,_0x22f6f1,_0x3467bd){return db[_0xb814('0xaa')][_0xb814('0x6b')]({'where':{'id':_0x5b4315['params']['id']}})[_0xb814('0x2b')](handleEntityNotFound(_0x22f6f1,null))[_0xb814('0x2b')](function(_0x3fda0d){if(_0x3fda0d){return _0x3fda0d[_0xb814('0xc1')](_0x5b4315[_0xb814('0x3b')][_0xb814('0xb2')]);}})[_0xb814('0x2b')](respondWithStatusCode(_0x22f6f1,null))[_0xb814('0x35')](handleError(_0x22f6f1,null));};exports[_0xb814('0xc2')]=function(_0x152260,_0x3bc03a){var _0x368696=moment()[_0xb814('0xc3')]()[_0xb814('0x92')]();var _0x8e882a=path['join'](config[_0xb814('0xc4')],_0xb814('0xc5'),_0xb814('0xc6'),_0xb814('0xc7'));var _0x4017b6=path[_0xb814('0xc8')](config['root'],_0xb814('0xc5'),_0xb814('0xc6'),_0xb814('0xc9'));var _0x31b4f5=path['join'](_0x8e882a,_0x368696);var _0x5b5a26=util[_0xb814('0xb8')](_0xb814('0xca'),_0x152260[_0xb814('0xa9')]['id'],_0x368696);var _0x667ca1=path[_0xb814('0xc8')](_0x8e882a,_0x5b5a26);var _0x2c510a=[];_0x2c510a['push']({'model':db[_0xb814('0xcb')],'as':_0xb814('0xcb'),'attributes':['id',_0xb814('0xcc')],'raw':!![]});_0x2c510a[_0xb814('0x34')]({'model':db['CmContact'],'as':_0xb814('0xcd'),'attributes':['id',_0xb814('0xce'),_0xb814('0xcf')],'raw':!![]});if(_0x152260[_0xb814('0x3b')][_0xb814('0xc9')]){_0x2c510a['push']({'model':db[_0xb814('0xd0')],'as':_0xb814('0xd0'),'raw':!![]});}var _0x371dd7=[{'model':db[_0xb814('0xb1')],'as':_0xb814('0xd1'),'attributes':['id',_0xb814('0x6d'),_0xb814('0x75'),_0xb814('0xd2'),_0xb814('0xd3'),_0xb814('0xd4')],'include':_0x2c510a}];_0x371dd7[_0xb814('0x34')]({'model':db[_0xb814('0xd5')],'as':_0xb814('0xd6'),'attributes':['id','name']});_0x371dd7['push']({'model':db[_0xb814('0xcb')],'as':_0xb814('0xd7'),'attributes':['id',_0xb814('0xcc')]});return db['WhatsappInteraction'][_0xb814('0x6b')]({'where':{'id':_0x152260[_0xb814('0xa9')]['id']},'include':_0x371dd7})[_0xb814('0x2b')](handleEntityNotFound(_0x3bc03a,null))['then'](function(_0x10537d){if(_0x10537d){var _0xa651a=_0x10537d[_0xb814('0xd8')]({'plain':!![]});fs[_0xb814('0xd9')](_0x31b4f5);var _0x6ec0f5={'format':'A4','border':_0xb814('0xda'),'header':{'height':'40px','contents':{'first':_0xb814('0xdb')}},'footer':{'height':'30px','contents':{'default':util[_0xb814('0xb8')]('\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',util[_0xb814('0xb8')](_0xb814('0xdc'),_0xb814('0xdd'),_0xa651a['id']),moment()['format'](_0xb814('0xde'))[_0xb814('0x92')]())}}};var _0x164304={'channel':'Whatsapp','account':_0xa651a[_0xb814('0xd6')]['name'],'agent':_0xa651a[_0xb814('0xd7')]?_0xa651a[_0xb814('0xd7')][_0xb814('0xcc')]:'N.A.','createdAt':moment(_0xa651a[_0xb814('0x75')])[_0xb814('0xb8')](_0xb814('0xb9'))[_0xb814('0x92')](),'closedAt':_0xa651a['closed']?moment(_0xa651a[_0xb814('0xdf')])[_0xb814('0xb8')](_0xb814('0xb9'))[_0xb814('0x92')]():'','disposition':_0xa651a[_0xb814('0xe0')],'messages':_(_0xa651a[_0xb814('0xd1')])[_0xb814('0x7d')]({'secret':![]})[_0xb814('0x30')](function(_0x9a33d0){if(_0x9a33d0['Attachment']){var _0x2fe47b=path[_0xb814('0xc8')](_0x4017b6,_0x9a33d0[_0xb814('0xd0')]['basename']);if(fs[_0xb814('0xe1')](_0x2fe47b)){fs['createReadStream'](_0x2fe47b)['pipe'](fs['createWriteStream'](path[_0xb814('0xc8')](_0x31b4f5,_0x9a33d0['Attachment'][_0xb814('0xe2')])));}}return{'date':moment(_0x9a33d0[_0xb814('0x75')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0xb814('0x92')](),'sender':_0x9a33d0['direction']===_0xb814('0xe3')?_0x9a33d0['User']?_0x9a33d0[_0xb814('0xcb')][_0xb814('0xcc')]:_0xb814('0xe4'):_0x9a33d0['Contact']['firstName']+(_0x9a33d0['Contact'][_0xb814('0xcf')]?'\x20'+_0x9a33d0['Contact']['lastName']:''),'body':_0x9a33d0[_0xb814('0xd0')]?_0x9a33d0['Attachment']['basename']:_0x9a33d0['body'],'direction':_0x9a33d0[_0xb814('0xd2')]===_0xb814('0xe3')?'A':'C','secret':_0x9a33d0[_0xb814('0xd3')],'read':_0x9a33d0['read'],'attachment':_0x9a33d0[_0xb814('0xd0')]};})[_0xb814('0x5c')]()};return ejs[_0xb814('0xe5')](path[_0xb814('0xc8')](config[_0xb814('0xc4')],_0xb814('0xc5'),'views',_0xb814('0xe6')),{'interaction':_0x164304})[_0xb814('0x2b')](function(_0x28b818){return new BPromise(function(_0x171845,_0x4f2db2){pdf[_0xb814('0xae')](_0x28b818,_0x6ec0f5)[_0xb814('0xe7')](path[_0xb814('0xc8')](_0x31b4f5,_0xb814('0xe8')+_0xa651a['id']+'-'+_0x368696+_0xb814('0xe9')),function(_0x2cb01d,_0x1f4540){if(_0x2cb01d)return _0x4f2db2(_0x2cb01d);_0x171845(_0x1f4540);});});})[_0xb814('0x2b')](function(){return new BPromise(function(_0x81ebc0,_0x2e7959){zipdir(_0x31b4f5,{'saveTo':_0x667ca1},function(_0x47f054,_0x1aa70b){if(_0x47f054)return _0x2e7959(_0x47f054);return _0x81ebc0(_0x1aa70b);});})[_0xb814('0x2b')](function(){return new BPromise(function(_0x5706ad,_0x3b8438){rimraf(_0x31b4f5,function(_0x56e231){if(_0x56e231)_0x3b8438(_0x56e231);return _0x5706ad();});});})[_0xb814('0x2b')](function(){return _0x3bc03a[_0xb814('0xc2')](_0x667ca1,_0x5b5a26,function(_0x5e2273){if(_0x5e2273){console[_0xb814('0xea')]('err',_0x5e2273);}else{fs[_0xb814('0xeb')](_0x667ca1);}});});});}else{return _0x3bc03a[_0xb814('0x20')](0xc8);}})[_0xb814('0x35')](handleError(_0x3bc03a,null));}; \ No newline at end of file +var _0xadb5=['field','from','tools_tags','u.id','ui.WhatsappInteractionId','user_has_whatsapp_interactions','left_join','whatsapp_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','whatsapp_accounts','a.id\x20=\x20i.WhatsappAccountId','whatsapp_messages','me.WhatsappInteractionId\x20=\x20i.id','it.WhatsappInteractionId\x20=\x20i.id','expr','search','parseSearch','sqlOperator','conditions','unreadMessages','having','`\x20=\x200','`\x20>\x200','Contact','operator','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?','ContactId','text','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','$substring','find','UserId','buildExpression','start','body','keys','compact','isEmpty','WhatsappAccountId','i.WhatsappAccountId\x20IN\x20?','concat','createdAt','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','where','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','t.id\x20IN\x20?','resolve','journey','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','sequelize','toString','count','keyBy','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.lastName','c.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','o.fullname','o.internal','Owner.internal','ui.WhatsappInteractionId\x20IN\x20?','groupBy','WhatsappInteractionId','all','catch','show','params','includeAll','include','merge','options','create','describe','addMessage','ids','getMessages','findOne','WhatsappMessage','hasOwnProperty','nolimit','$gte','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','omit','spread','findAll','color','emit','whatsappInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','firstName','lastName','Attachment','Messages','secret','WhatsappAccount','Account','Owner','get','mkdirSync','40px','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','N.A.','closed','disposition','basename','createReadStream','createWriteStream','direction','out','System','renderFile','views','downloadInteraction.html','toFile','log','err','unlinkSync','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','../../mysqldb','defaults','localhost','socket.io-emitter','redis','register','sendStatus','end','status','json','offset','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','Users','map','fullname','TagIds','Tags','split','forEach','push','WhatsappInteraction','rawAttributes','type','key','query','intersection','model','attributes','fields','length','limit','order','sort','filters','pick','select'];(function(_0x5a7bac,_0xe1b870){var _0x12954d=function(_0x329573){while(--_0x329573){_0x5a7bac['push'](_0x5a7bac['shift']());}};_0x12954d(++_0xe1b870);}(_0xadb5,0xad));var _0x5adb=function(_0x1e68bf,_0xa7c380){_0x1e68bf=_0x1e68bf-0x0;var _0x635342=_0xadb5[_0x1e68bf];return _0x635342;};'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 db=require(_0x5adb('0x17'))['db'];config['redis']=_[_0x5adb('0x18')](config['redis'],{'host':_0x5adb('0x19'),'port':0x18eb});var socket=require(_0x5adb('0x1a'))(new Redis(config[_0x5adb('0x1b')]));require('./whatsappInteraction.socket')[_0x5adb('0x1c')](socket);function respondWithStatusCode(_0x34af2c,_0xf82f72){_0xf82f72=_0xf82f72||0xcc;return function(_0x5263ec){if(_0x5263ec){return _0x34af2c[_0x5adb('0x1d')](_0xf82f72);}return _0x34af2c['status'](_0xf82f72)[_0x5adb('0x1e')]();};}function respondWithResult(_0x42a482,_0x30614e){_0x30614e=_0x30614e||0xc8;return function(_0x304784){if(_0x304784){return _0x42a482[_0x5adb('0x1f')](_0x30614e)[_0x5adb('0x20')](_0x304784);}};}function respondWithFilteredResult(_0xa29dc,_0x42f4c6){return function(_0xb953a6){if(_0xb953a6){var _0x529b65=_0xb953a6['count'],_0x3fff62=_0x42f4c6[_0x5adb('0x21')],_0x5de028=_0x42f4c6['offset']+_0x42f4c6['limit'],_0x1d9e86;if(_0x5de028>=_0x529b65){_0x5de028=_0x529b65;_0x1d9e86=0xc8;}else{_0x1d9e86=0xce;}_0xa29dc[_0x5adb('0x1f')](_0x1d9e86);return _0xa29dc[_0x5adb('0x22')](_0x5adb('0x23'),_0x3fff62+'-'+_0x5de028+'/'+_0x529b65)[_0x5adb('0x20')](_0xb953a6);}return null;};}function patchUpdates(_0x99bc6c){return function(_0x5af69d){try{jsonpatch[_0x5adb('0x24')](_0x5af69d,_0x99bc6c,!![]);}catch(_0x5c296e){return BPromise['reject'](_0x5c296e);}return _0x5af69d[_0x5adb('0x25')]();};}function saveUpdates(_0x379b33,_0x1a38d3){return function(_0x1a8014){if(_0x1a8014){return _0x1a8014[_0x5adb('0x26')](_0x379b33)[_0x5adb('0x27')](function(_0xfd9bb9){return _0xfd9bb9;});}return null;};}function removeEntity(_0x4ca150,_0x4b1957){return function(_0x373cc3){if(_0x373cc3){return _0x373cc3[_0x5adb('0x28')]()[_0x5adb('0x27')](function(){_0x4ca150[_0x5adb('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2fee18,_0x2e1e63){return function(_0x5aed76){if(!_0x5aed76){_0x2fee18[_0x5adb('0x1d')](0x194);}return _0x5aed76;};}function handleError(_0x1ded9f,_0x1a0acd){_0x1a0acd=_0x1a0acd||0x1f4;return function(_0x55b40a){logger[_0x5adb('0x29')](_0x55b40a[_0x5adb('0x2a')]);if(_0x55b40a[_0x5adb('0x2b')]){delete _0x55b40a[_0x5adb('0x2b')];}_0x1ded9f[_0x5adb('0x1f')](_0x1a0acd)[_0x5adb('0x2c')](_0x55b40a);};}function getInteractionUsers(_0x4a5d46,_0x49992e){return new BPromise(function(_0x5d457e,_0x39bddd){try{if(_0x49992e[_0x4a5d46['id']]){_0x4a5d46[_0x5adb('0x2d')]=_[_0x5adb('0x2e')](_0x49992e[_0x4a5d46['id']],function(_0x512bab){return{'id':_0x512bab['id'],'fullname':_0x512bab[_0x5adb('0x2f')]};});}}catch(_0x4de310){_0x39bddd(_0x4de310);}_0x5d457e(_0x4a5d46);});}function getInteractionTags(_0x11ec2a,_0x34b793){return new BPromise(function(_0x372da1,_0x3b1fed){try{if(_0x11ec2a[_0x5adb('0x30')]){_0x11ec2a[_0x5adb('0x31')]=[];_0x11ec2a[_0x5adb('0x30')][_0x5adb('0x32')](',')[_0x5adb('0x33')](function(_0x260295){_0x11ec2a['Tags'][_0x5adb('0x34')](_0x34b793[_0x260295]);});}delete _0x11ec2a['TagIds'];}catch(_0x12424d){_0x3b1fed(_0x12424d);}_0x372da1(_0x11ec2a);});}function updateWhatsappInteraction(_0x20cde6,_0x5d1441,_0x226390){return new BPromise(function(_0xe389ca,_0x461a39){return getInteractionUsers(_0x20cde6,_0x226390)['then'](function(_0x173789){return getInteractionTags(_0x173789,_0x5d1441);})[_0x5adb('0x27')](function(_0x4b5887){_0xe389ca(_0x4b5887);})['catch'](function(_0x1ed9ea){_0x461a39(_0x1ed9ea);});});}exports['index']=function(_0x663ea0,_0x222568){var _0x3c2b07={},_0x2da912={},_0x9bdece={'count':0x0,'rows':[]};var _0x5ece39=_[_0x5adb('0x2e')](db[_0x5adb('0x35')][_0x5adb('0x36')],function(_0x54851b){return{'name':_0x54851b['fieldName'],'type':_0x54851b[_0x5adb('0x37')][_0x5adb('0x38')]};});_0x2da912['model']=_[_0x5adb('0x2e')](_0x5ece39,'name');_0x2da912[_0x5adb('0x39')]=_['keys'](_0x663ea0[_0x5adb('0x39')]);_0x2da912['filters']=_[_0x5adb('0x3a')](_0x2da912[_0x5adb('0x3b')],_0x2da912['query']);_0x3c2b07[_0x5adb('0x3c')]=_['intersection'](_0x2da912[_0x5adb('0x3b')],qs[_0x5adb('0x3d')](_0x663ea0[_0x5adb('0x39')]['fields']));_0x3c2b07[_0x5adb('0x3c')]=_0x3c2b07[_0x5adb('0x3c')][_0x5adb('0x3e')]?_0x3c2b07[_0x5adb('0x3c')]:_0x2da912[_0x5adb('0x3b')];if(!_0x663ea0['query']['hasOwnProperty']('nolimit')){_0x3c2b07['limit']=qs[_0x5adb('0x3f')](_0x663ea0[_0x5adb('0x39')][_0x5adb('0x3f')]);_0x3c2b07[_0x5adb('0x21')]=qs[_0x5adb('0x21')](_0x663ea0[_0x5adb('0x39')][_0x5adb('0x21')]);}_0x3c2b07[_0x5adb('0x40')]=qs['sort'](_0x663ea0['query'][_0x5adb('0x41')]);_0x3c2b07['where']=qs[_0x5adb('0x42')](_[_0x5adb('0x43')](_0x663ea0[_0x5adb('0x39')],_0x2da912[_0x5adb('0x42')]),_0x5ece39);var _0xdfecfd=[];var _0x522ee5=squel[_0x5adb('0x44')]()[_0x5adb('0x45')]('id')['field'](_0x5adb('0x2b'))[_0x5adb('0x45')]('color')[_0x5adb('0x46')](_0x5adb('0x47'));var _0x1d6bef=squel[_0x5adb('0x44')]()[_0x5adb('0x45')](_0x5adb('0x48'))[_0x5adb('0x45')]('u.fullname')['field'](_0x5adb('0x49'))[_0x5adb('0x46')](_0x5adb('0x4a'),'ui')[_0x5adb('0x4b')]('users','u','u.id\x20=\x20ui.UserId');var _0xaa32e4=squel[_0x5adb('0x44')]()[_0x5adb('0x46')](_0x5adb('0x4c'),'i')[_0x5adb('0x4b')]('cm_contacts','c',_0x5adb('0x4d'))[_0x5adb('0x4b')]('users','o',_0x5adb('0x4e'))[_0x5adb('0x4b')](_0x5adb('0x4f'),'a',_0x5adb('0x50'))[_0x5adb('0x4b')](_0x5adb('0x51'),'me',_0x5adb('0x52'))[_0x5adb('0x4b')]('whatsapp_interaction_has_tags','it',_0x5adb('0x53'))['left_join']('tools_tags','t','t.id\x20=\x20it.TagId');var _0x3cd211=squel[_0x5adb('0x54')]();var _0x207a81=[];var _0x4ba0b5=squel[_0x5adb('0x54')]();var _0x5cbab5;if(_0x663ea0[_0x5adb('0x39')][_0x5adb('0x55')]){_0x5cbab5=as[_0x5adb('0x56')](_0x663ea0['query'][_0x5adb('0x55')]);var _0x560bac=_0x5cbab5[_0x5adb('0x57')];for(var _0x6dc067=0x0;_0x6dc067<_0x5cbab5['conditions'][_0x5adb('0x3e')];_0x6dc067++){var _0x1ab97b=_0x5cbab5[_0x5adb('0x58')][_0x6dc067];var _0x101008='i';var _0x372734=_['find'](_0x5ece39,[_0x5adb('0x2b'),_0x1ab97b[_0x5adb('0x45')]]);if(!_0x372734){switch(_0x1ab97b[_0x5adb('0x45')]){case _0x5adb('0x59'):if(_0x1ab97b['value']==0x1){_0xaa32e4[_0x5adb('0x5a')]('`'+_0x1ab97b[_0x5adb('0x45')]+_0x5adb('0x5b'));}else{_0xaa32e4['having']('`'+_0x1ab97b[_0x5adb('0x45')]+_0x5adb('0x5c'));}break;case _0x5adb('0x5d'):if(_0x1ab97b[_0x5adb('0x5e')]==='$substring'){if(_0x1ab97b[_0x5adb('0x5f')][_0x5adb('0x32')]('\x20')[_0x5adb('0x3e')]>0x1){_0x3cd211[_0x560bac](_0x5adb('0x60'),qs[_0x5adb('0x61')](_0x1ab97b['value']),null);}else{var _0x378938='%'+_0x1ab97b['value']+'%';_0x3cd211[_0x560bac](_0x5adb('0x62'),_0x378938,_0x378938,_0x378938);}}else{_0x372734=_['find'](_0x5ece39,[_0x5adb('0x2b'),_0x5adb('0x63')]);_0x1ab97b[_0x5adb('0x45')]=_0x5adb('0x63');_0x836b91=as['buildExpression'](_0x101008,_0x372734[_0x5adb('0x37')],_0x1ab97b);_0x3cd211[_0x560bac](_0x836b91[_0x5adb('0x64')],_0x836b91[_0x5adb('0x5f')]['start'],_0x836b91['value']['end']);}break;case _0x5adb('0x65'):var _0x31a1f9=_0x1ab97b[_0x5adb('0x5f')][_0x5adb('0x32')](',')[_0x5adb('0x2e')](function(_0xb06bee){return Number(_0xb06bee);});_0x31a1f9[_0x5adb('0x33')](function(_0x8d7810){_0x4ba0b5['or'](_0x5adb('0x66'),'%,'+_0x8d7810+',%');});_0x207a81=_[_0x5adb('0x67')](_0x207a81,_0x31a1f9);break;case _0x5adb('0x68'):if(_0x1ab97b[_0x5adb('0x5e')]===_0x5adb('0x69')){_0x3cd211[_0x560bac]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x1ab97b['value']+'%',null);}else{_0x372734=_[_0x5adb('0x6a')](_0x5ece39,[_0x5adb('0x2b'),_0x5adb('0x6b')]);_0x1ab97b[_0x5adb('0x45')]='UserId';_0x836b91=as[_0x5adb('0x6c')](_0x101008,_0x372734[_0x5adb('0x37')],_0x1ab97b);_0x3cd211[_0x560bac](_0x836b91['text'],_0x836b91[_0x5adb('0x5f')][_0x5adb('0x6d')],_0x836b91[_0x5adb('0x5f')]['end']);}break;case _0x5adb('0x6e'):_0x836b91=as[_0x5adb('0x6c')]('me',null,_0x1ab97b);_0x3cd211[_0x560bac](_0x836b91[_0x5adb('0x64')],_0x836b91[_0x5adb('0x5f')][_0x5adb('0x6d')],_0x836b91[_0x5adb('0x5f')]['end']);break;}}else{var _0x836b91=as[_0x5adb('0x6c')](_0x101008,_0x372734[_0x5adb('0x37')],_0x1ab97b);_0x3cd211[_0x560bac](_0x836b91['text'],_0x836b91[_0x5adb('0x5f')][_0x5adb('0x6d')],_0x836b91[_0x5adb('0x5f')]['end']);}}}else{var _0x7287ac=_(_0x663ea0['query'])[_0x5adb('0x6f')]()[_0x5adb('0x2e')](function(_0x24e1ab){return _['some'](_0x5ece39,[_0x5adb('0x2b'),_0x24e1ab])?_0x24e1ab:undefined;})[_0x5adb('0x70')]()['value']();if(!_[_0x5adb('0x71')](_0x7287ac)){_0x7287ac[_0x5adb('0x33')](function(_0x248739){if(_0x248739===_0x5adb('0x72')){_0xaa32e4['where'](_0x5adb('0x73'),[][_0x5adb('0x74')](_0x663ea0[_0x5adb('0x39')][_0x248739]));}else if(_0x248739===_0x5adb('0x75')){var _0x5b7556=JSON['parse'](_0x663ea0[_0x5adb('0x39')][_0x248739])['$gte'];var _0x4d635f=JSON['parse'](_0x663ea0[_0x5adb('0x39')][_0x248739])[_0x5adb('0x76')];_0xaa32e4['where'](_0x5adb('0x77'),_0x5b7556,_0x4d635f);}else{if(_0x663ea0[_0x5adb('0x39')][_0x248739]===_0x5adb('0x78')){_0xaa32e4[_0x5adb('0x79')]('i.'+_0x248739+_0x5adb('0x7a'));}else{_0xaa32e4[_0x5adb('0x79')]('i.'+_0x248739+_0x5adb('0x7b'),_0x663ea0[_0x5adb('0x39')][_0x248739]);}}});}if(_0x663ea0['query']['read']){if(_0x663ea0['query'][_0x5adb('0x7c')]==0x1){_0xaa32e4[_0x5adb('0x5a')](_0x5adb('0x7d'));}else{_0xaa32e4[_0x5adb('0x5a')](_0x5adb('0x7e'));}}if(_0x663ea0[_0x5adb('0x39')][_0x5adb('0x7f')]){_0x207a81=_[_0x5adb('0x80')](_0x663ea0['query']['tag'])?_0x663ea0[_0x5adb('0x39')][_0x5adb('0x7f')]:new Array(_0x663ea0[_0x5adb('0x39')][_0x5adb('0x7f')]);_0x207a81[_0x5adb('0x33')](function(_0x335de5){_0x4ba0b5['or'](_0x5adb('0x66'),'%,'+_0x335de5+',%');});}if(_0x663ea0[_0x5adb('0x39')][_0x5adb('0x81')]){var _0x3b5ecf=_0x663ea0['query'][_0x5adb('0x81')][_0x5adb('0x82')]('\x5c','\x5c\x5c')[_0x5adb('0x82')]('\x27\x27','\x27\x27\x27\x27');if(qs[_0x5adb('0x83')](_0x3b5ecf)){_0x3cd211['or'](_0x5adb('0x84'),_0x3b5ecf+'%')['or']('i.phone\x20LIKE\x20?',_0x3b5ecf+'%');}else{_0x3cd211['or'](_0x5adb('0x85'),qs['getFullTextValue'](_0x3b5ecf))['or'](_0x5adb('0x86'),_0x3b5ecf+'%');}}}_0xaa32e4[_0x5adb('0x79')](_0x3cd211);_0xaa32e4['group'](_0x5adb('0x87'));var _0x1ceb72={'type':db[_0x5adb('0x88')][_0x5adb('0x89')][_0x5adb('0x8a')],'raw':!![]};var _0x10f54a=_0xaa32e4[_0x5adb('0x8b')]();_0x10f54a[_0x5adb('0x45')]('i.id');_0x10f54a[_0x5adb('0x45')](_0x5adb('0x8c'),_0x5adb('0x59'));if(_0x3c2b07['order']){_0x3c2b07['order'][_0x5adb('0x33')](function(_0x4fd8f7){_0xaa32e4[_0x5adb('0x40')]('i.'+_0x4fd8f7[0x0],_0x4fd8f7[0x1]===_0x5adb('0x8d')?![]:!![]);});}if(!_[_0x5adb('0x71')](_0x207a81)){_0xaa32e4['having'](_0x4ba0b5);_0x10f54a[_0x5adb('0x79')](_0x5adb('0x8e'),_0x207a81);}BPromise[_0x5adb('0x8f')]()[_0x5adb('0x27')](function(){if(!_0x5cbab5){if(_0x663ea0[_0x5adb('0x39')]['WhatsappAccountId']||_0x663ea0[_0x5adb('0x39')][_0x5adb('0x90')])return;_0x10f54a[_0x5adb('0x79')](_0x5adb('0x91'));_0xaa32e4['where'](_0x5adb('0x91'));return;}return _0x663ea0[_0x5adb('0x92')][_0x5adb('0x93')]({'attributes':['id'],'raw':!![]})[_0x5adb('0x27')](function(_0x15d4f1){if(_[_0x5adb('0x71')](_0x15d4f1)){_0x10f54a[_0x5adb('0x79')]('i.WhatsappAccountId\x20IS\x20NULL');_0xaa32e4[_0x5adb('0x79')](_0x5adb('0x94'));}else{_0x10f54a['where'](_0x5adb('0x73'),_[_0x5adb('0x2e')](_0x15d4f1,'id'));_0xaa32e4['where'](_0x5adb('0x73'),_['map'](_0x15d4f1,'id'));}});})[_0x5adb('0x27')](function(){db[_0x5adb('0x95')]['query'](_0x10f54a[_0x5adb('0x96')](),_0x1ceb72)['then'](function(_0x2f6415){_0x9bdece[_0x5adb('0x97')]=_0x2f6415[_0x5adb('0x3e')];if(_0x9bdece[_0x5adb('0x97')]===0x0)return[];return db[_0x5adb('0x95')]['query'](_0x522ee5[_0x5adb('0x96')](),_0x1ceb72)[_0x5adb('0x27')](function(_0x3f33c0){_0xdfecfd=_[_0x5adb('0x98')](_0x3f33c0,'id');_0x1ceb72=_['merge'](_0x1ceb72,{'model':db['WhatsappInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x663ea0[_0x5adb('0x39')][_0x5adb('0x3d')]){_0x3c2b07[_0x5adb('0x3c')][_0x5adb('0x33')](function(_0x277668){_0xaa32e4[_0x5adb('0x45')]('i.'+_0x277668);});}else{_0xaa32e4[_0x5adb('0x45')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x5adb('0x59'));_0xaa32e4[_0x5adb('0x45')](_0x5adb('0x99'),_0x5adb('0x9a'));_0xaa32e4['field'](_0x5adb('0x9b'),_0x5adb('0x9c'));_0xaa32e4[_0x5adb('0x45')](_0x5adb('0x9d'));_0xaa32e4[_0x5adb('0x45')](_0x5adb('0x9e'),_0x5adb('0x9f'));_0xaa32e4[_0x5adb('0x45')](_0x5adb('0xa0'),'Contact.lastName');_0xaa32e4[_0x5adb('0x45')](_0x5adb('0xa1'),'Contact.email');_0xaa32e4[_0x5adb('0x45')](_0x5adb('0xa2'),_0x5adb('0xa3'));_0xaa32e4[_0x5adb('0x45')](_0x5adb('0xa4'),_0x5adb('0xa5'));_0xaa32e4[_0x5adb('0x45')](_0x5adb('0xa6'),'Contact.fax');_0xaa32e4[_0x5adb('0x45')](_0x5adb('0xa7'),'Owner.fullname');_0xaa32e4[_0x5adb('0x45')](_0x5adb('0xa8'),_0x5adb('0xa9'));_0xaa32e4['field']('GROUP_CONCAT(DISTINCT\x20t.id)',_0x5adb('0x30'));}if(_0x3c2b07[_0x5adb('0x3f')])_0xaa32e4[_0x5adb('0x3f')](_0x3c2b07['limit']);if(_0x3c2b07[_0x5adb('0x21')])_0xaa32e4[_0x5adb('0x21')](_0x3c2b07[_0x5adb('0x21')]);return db[_0x5adb('0x95')][_0x5adb('0x39')](_0xaa32e4[_0x5adb('0x96')](),_0x1ceb72);})[_0x5adb('0x27')](function(_0x463e84){_0x1d6bef[_0x5adb('0x79')](_0x5adb('0xaa'),_[_0x5adb('0x2e')](_0x463e84,'id'));return db[_0x5adb('0x95')]['query'](_0x1d6bef['toString'](),_0x1ceb72)[_0x5adb('0x27')](function(_0x44756a){var _0x5c4053=_[_0x5adb('0xab')](_0x44756a,_0x5adb('0xac'));var _0x38acde=[];_0x463e84[_0x5adb('0x33')](function(_0x13426e){_0x38acde[_0x5adb('0x34')](updateWhatsappInteraction(_0x13426e,_0xdfecfd,_0x5c4053));});return BPromise[_0x5adb('0xad')](_0x38acde);});});})[_0x5adb('0x27')](function(_0x42dddf){_0x9bdece['rows']=_0x42dddf;return _0x9bdece;})[_0x5adb('0x27')](respondWithFilteredResult(_0x222568,_0x3c2b07));})[_0x5adb('0xae')](handleError(_0x222568,null));};exports[_0x5adb('0xaf')]=function(_0x4f0261,_0x312a90){var _0x284f79={'raw':![],'where':{'id':_0x4f0261[_0x5adb('0xb0')]['id']}},_0x2b6e56={};_0x2b6e56[_0x5adb('0x3b')]=_[_0x5adb('0x6f')](db['WhatsappInteraction'][_0x5adb('0x36')]);_0x2b6e56[_0x5adb('0x39')]=_[_0x5adb('0x6f')](_0x4f0261[_0x5adb('0x39')]);_0x2b6e56[_0x5adb('0x42')]=_[_0x5adb('0x3a')](_0x2b6e56[_0x5adb('0x3b')],_0x2b6e56[_0x5adb('0x39')]);_0x284f79[_0x5adb('0x3c')]=_[_0x5adb('0x3a')](_0x2b6e56['model'],qs[_0x5adb('0x3d')](_0x4f0261['query'][_0x5adb('0x3d')]));_0x284f79[_0x5adb('0x3c')]=_0x284f79[_0x5adb('0x3c')][_0x5adb('0x3e')]?_0x284f79[_0x5adb('0x3c')]:_0x2b6e56['model'];if(_0x4f0261['query'][_0x5adb('0xb1')]){_0x284f79[_0x5adb('0xb2')]=[{'all':!![]}];}_0x284f79=_[_0x5adb('0xb3')]({},_0x284f79,_0x4f0261[_0x5adb('0xb4')]);return db[_0x5adb('0x35')][_0x5adb('0x6a')](_0x284f79)['then'](handleEntityNotFound(_0x312a90,null))['then'](respondWithResult(_0x312a90,null))[_0x5adb('0xae')](handleError(_0x312a90,null));};exports[_0x5adb('0xb5')]=function(_0x9d80fd,_0x4f5721){return db['WhatsappInteraction'][_0x5adb('0xb5')](_0x9d80fd['body'],{})[_0x5adb('0x27')](respondWithResult(_0x4f5721,0xc9))[_0x5adb('0xae')](handleError(_0x4f5721,null));};exports['update']=function(_0x498ecc,_0x43b91c){if(_0x498ecc['body']['id']){delete _0x498ecc['body']['id'];}return db[_0x5adb('0x35')][_0x5adb('0x6a')]({'where':{'id':_0x498ecc[_0x5adb('0xb0')]['id']}})[_0x5adb('0x27')](handleEntityNotFound(_0x43b91c,null))[_0x5adb('0x27')](saveUpdates(_0x498ecc[_0x5adb('0x6e')],null))[_0x5adb('0x27')](respondWithResult(_0x43b91c,null))[_0x5adb('0xae')](handleError(_0x43b91c,null));};exports[_0x5adb('0x28')]=function(_0x31b696,_0x44cf6a){return db[_0x5adb('0x35')][_0x5adb('0x6a')]({'where':{'id':_0x31b696['params']['id']}})[_0x5adb('0x27')](handleEntityNotFound(_0x44cf6a,null))['then'](removeEntity(_0x44cf6a,null))[_0x5adb('0xae')](handleError(_0x44cf6a,null));};exports[_0x5adb('0xb6')]=function(_0x280f30,_0xad6905){return db[_0x5adb('0x35')][_0x5adb('0xb6')]()[_0x5adb('0x27')](respondWithResult(_0xad6905,null))[_0x5adb('0xae')](handleError(_0xad6905,null));};exports[_0x5adb('0xb7')]=function(_0x36a8f0,_0x41fa3c,_0x18fc00){return db['WhatsappMessage'][_0x5adb('0x6a')]({'where':{'id':_0x36a8f0[_0x5adb('0xb0')]['id']}})[_0x5adb('0x27')](handleEntityNotFound(_0x41fa3c,null))[_0x5adb('0x27')](function(_0x1da6bc){if(_0x1da6bc){return _0x1da6bc[_0x5adb('0xb7')](_0x36a8f0[_0x5adb('0x6e')][_0x5adb('0xb8')],_['omit'](_0x36a8f0[_0x5adb('0x6e')],[_0x5adb('0xb8'),'id'])||{});}})[_0x5adb('0x27')](respondWithResult(_0x41fa3c,null))['catch'](handleError(_0x41fa3c,null));};exports[_0x5adb('0xb9')]=function(_0x4ae211,_0x74065,_0x50c3a3){var _0x54da7c={'raw':![],'where':{}};var _0x173ead={};var _0x3796b7={'count':0x0,'rows':[]};return db[_0x5adb('0x35')][_0x5adb('0xba')]({'where':{'id':_0x4ae211[_0x5adb('0xb0')]['id']}})[_0x5adb('0x27')](handleEntityNotFound(_0x74065,null))[_0x5adb('0x27')](function(_0xa1911a){if(_0xa1911a){_0x173ead[_0x5adb('0x3b')]=_[_0x5adb('0x6f')](db[_0x5adb('0xbb')][_0x5adb('0x36')]);_0x173ead['query']=_[_0x5adb('0x6f')](_0x4ae211['query']);_0x173ead[_0x5adb('0x42')]=_[_0x5adb('0x3a')](_0x173ead['model'],_0x173ead[_0x5adb('0x39')]);_0x54da7c[_0x5adb('0x3c')]=_['intersection'](_0x173ead['model'],qs[_0x5adb('0x3d')](_0x4ae211[_0x5adb('0x39')][_0x5adb('0x3d')]));_0x54da7c[_0x5adb('0x3c')]=_0x54da7c[_0x5adb('0x3c')][_0x5adb('0x3e')]?_0x54da7c['attributes']:_0x173ead[_0x5adb('0x3b')];if(!_0x4ae211[_0x5adb('0x39')][_0x5adb('0xbc')](_0x5adb('0xbd'))){_0x54da7c[_0x5adb('0x3f')]=qs['limit'](_0x4ae211['query'][_0x5adb('0x3f')]);_0x54da7c[_0x5adb('0x21')]=qs[_0x5adb('0x21')](_0x4ae211[_0x5adb('0x39')][_0x5adb('0x21')]);}_0x54da7c[_0x5adb('0x40')]=qs[_0x5adb('0x41')](_0x4ae211[_0x5adb('0x39')][_0x5adb('0x41')]);_0x54da7c['where']=qs[_0x5adb('0x42')](_[_0x5adb('0x43')](_0x4ae211['query'],_0x173ead['filters']));_0x54da7c['where'][_0x5adb('0xac')]=_0xa1911a['id'];if(_0x4ae211[_0x5adb('0x39')][_0x5adb('0x81')]){_0x54da7c['where']=_['merge'](_0x54da7c[_0x5adb('0x79')],{'$or':_[_0x5adb('0x2e')](_0x54da7c[_0x5adb('0x3c')],function(_0x3d2a5b){var _0x3b367f={};_0x3b367f[_0x3d2a5b]={'$like':'%'+_0x4ae211[_0x5adb('0x39')]['filter']+'%'};return _0x3b367f;})});}if(_0x4ae211['query'][_0x5adb('0xbe')]){var _0x5a9e55=_0x4ae211[_0x5adb('0x39')][_0x5adb('0xbe')]['split'](',');var _0x7151b8={};_0x7151b8[_0x5a9e55[0x0]]={'$gte':moment(_0x5a9e55[0x1])[_0x5adb('0xbf')](_0x5adb('0xc0'))};_0x54da7c[_0x5adb('0x79')]=_['merge'](_0x54da7c[_0x5adb('0x79')],_0x7151b8);}_0x54da7c=_[_0x5adb('0xb3')]({},_0x54da7c,_0x4ae211[_0x5adb('0xb4')]);return db[_0x5adb('0xbb')]['count']({'where':_0x54da7c[_0x5adb('0x79')]})['then'](function(_0x29cc2f){_0x3796b7[_0x5adb('0x97')]=_0x29cc2f;if(_0x4ae211[_0x5adb('0x39')][_0x5adb('0xb1')]){_0x54da7c[_0x5adb('0xb2')]=[{'all':!![]}];}return db[_0x5adb('0xbb')]['findAll'](_0x54da7c);})[_0x5adb('0x27')](function(_0x49e908){_0x3796b7[_0x5adb('0xc1')]=_0x49e908;return _0x3796b7;});}})[_0x5adb('0x27')](respondWithFilteredResult(_0x74065,_0x54da7c))['catch'](handleError(_0x74065,null));};exports[_0x5adb('0xc2')]=function(_0x52e44f,_0x5a517a,_0x4d50f7){return db[_0x5adb('0x35')]['find']({'where':{'id':_0x52e44f['params']['id']}})[_0x5adb('0x27')](handleEntityNotFound(_0x5a517a,null))[_0x5adb('0x27')](function(_0x325f86){if(_0x325f86){return _0x325f86[_0x5adb('0xc3')](_0x52e44f[_0x5adb('0x6e')][_0x5adb('0xb8')],_[_0x5adb('0xc4')](_0x52e44f['body'],[_0x5adb('0xb8'),'id'])||{})[_0x5adb('0xc5')](function(){return db['Tag'][_0x5adb('0xc6')]({'attributes':['id',_0x5adb('0x2b'),_0x5adb('0xc7')],'where':{'id':_0x52e44f[_0x5adb('0x6e')][_0x5adb('0xb8')]}});})[_0x5adb('0x27')](function(_0x3a88ab){socket[_0x5adb('0xc8')](_0x5adb('0xc9'),{'id':Number(_0x52e44f[_0x5adb('0xb0')]['id']),'tags':_0x3a88ab||[]});return{'id':Number(_0x52e44f[_0x5adb('0xb0')]['id']),'tags':_0x3a88ab||[]};});}})[_0x5adb('0x27')](respondWithResult(_0x5a517a,null))['catch'](handleError(_0x5a517a,null));};exports['removeTags']=function(_0x2376a6,_0x282c11,_0x35a718){return db[_0x5adb('0x35')]['find']({'where':{'id':_0x2376a6[_0x5adb('0xb0')]['id']}})[_0x5adb('0x27')](handleEntityNotFound(_0x282c11,null))[_0x5adb('0x27')](function(_0xb9ac38){if(_0xb9ac38){return _0xb9ac38[_0x5adb('0xca')](_0x2376a6['query']['ids']);}})[_0x5adb('0x27')](respondWithStatusCode(_0x282c11,null))['catch'](handleError(_0x282c11,null));};exports[_0x5adb('0xcb')]=function(_0x64fae1,_0x3ad256){var _0x2b4228=moment()[_0x5adb('0xcc')]()[_0x5adb('0x96')]();var _0x5e17ea=path[_0x5adb('0xcd')](config[_0x5adb('0xce')],_0x5adb('0xcf'),_0x5adb('0xd0'),_0x5adb('0xd1'));var _0xabc1ee=path[_0x5adb('0xcd')](config['root'],'server','files',_0x5adb('0xd2'));var _0x5ae730=path[_0x5adb('0xcd')](_0x5e17ea,_0x2b4228);var _0x5983ef=util['format'](_0x5adb('0xd3'),_0x64fae1[_0x5adb('0xb0')]['id'],_0x2b4228);var _0x5e74dc=path['join'](_0x5e17ea,_0x5983ef);var _0x3612c=[];_0x3612c[_0x5adb('0x34')]({'model':db[_0x5adb('0x68')],'as':'User','attributes':['id',_0x5adb('0x2f')],'raw':!![]});_0x3612c['push']({'model':db['CmContact'],'as':_0x5adb('0x5d'),'attributes':['id',_0x5adb('0xd4'),_0x5adb('0xd5')],'raw':!![]});if(_0x64fae1['query']['attachments']){_0x3612c[_0x5adb('0x34')]({'model':db[_0x5adb('0xd6')],'as':'Attachment','raw':!![]});}var _0x5366d4=[{'model':db[_0x5adb('0xbb')],'as':_0x5adb('0xd7'),'attributes':['id','body',_0x5adb('0x75'),'direction',_0x5adb('0xd8'),'read'],'include':_0x3612c}];_0x5366d4[_0x5adb('0x34')]({'model':db[_0x5adb('0xd9')],'as':_0x5adb('0xda'),'attributes':['id',_0x5adb('0x2b')]});_0x5366d4[_0x5adb('0x34')]({'model':db['User'],'as':_0x5adb('0xdb'),'attributes':['id',_0x5adb('0x2f')]});return db[_0x5adb('0x35')]['find']({'where':{'id':_0x64fae1[_0x5adb('0xb0')]['id']},'include':_0x5366d4})[_0x5adb('0x27')](handleEntityNotFound(_0x3ad256,null))[_0x5adb('0x27')](function(_0x45526a){if(_0x45526a){var _0x57607e=_0x45526a[_0x5adb('0xdc')]({'plain':!![]});fs[_0x5adb('0xdd')](_0x5ae730);var _0x3bbe7c={'format':'A4','border':'10px','header':{'height':_0x5adb('0xde'),'contents':{'first':'\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'}},'footer':{'height':_0x5adb('0xdf'),'contents':{'default':util[_0x5adb('0xbf')](_0x5adb('0xe0'),util[_0x5adb('0xbf')](_0x5adb('0xe1'),'Whatsapp',_0x57607e['id']),moment()['format']('YYYY-MM-DD')[_0x5adb('0x96')]())}}};var _0x4a1b54={'channel':'Whatsapp','account':_0x57607e[_0x5adb('0xda')][_0x5adb('0x2b')],'agent':_0x57607e[_0x5adb('0xdb')]?_0x57607e[_0x5adb('0xdb')][_0x5adb('0x2f')]:_0x5adb('0xe2'),'createdAt':moment(_0x57607e[_0x5adb('0x75')])[_0x5adb('0xbf')]('YYYY-MM-DD\x20HH:mm:ss')[_0x5adb('0x96')](),'closedAt':_0x57607e[_0x5adb('0xe3')]?moment(_0x57607e['closedAt'])[_0x5adb('0xbf')](_0x5adb('0xc0'))['toString']():'','disposition':_0x57607e[_0x5adb('0xe4')],'messages':_(_0x57607e['Messages'])[_0x5adb('0x81')]({'secret':![]})[_0x5adb('0x2e')](function(_0x3d782b){if(_0x3d782b[_0x5adb('0xd6')]){var _0x651279=path[_0x5adb('0xcd')](_0xabc1ee,_0x3d782b[_0x5adb('0xd6')][_0x5adb('0xe5')]);if(fs['existsSync'](_0x651279)){fs[_0x5adb('0xe6')](_0x651279)['pipe'](fs[_0x5adb('0xe7')](path['join'](_0x5ae730,_0x3d782b[_0x5adb('0xd6')]['basename'])));}}return{'date':moment(_0x3d782b[_0x5adb('0x75')])[_0x5adb('0xbf')](_0x5adb('0xc0'))[_0x5adb('0x96')](),'sender':_0x3d782b[_0x5adb('0xe8')]===_0x5adb('0xe9')?_0x3d782b[_0x5adb('0x68')]?_0x3d782b[_0x5adb('0x68')][_0x5adb('0x2f')]:_0x5adb('0xea'):_0x3d782b[_0x5adb('0x5d')][_0x5adb('0xd4')]+(_0x3d782b[_0x5adb('0x5d')]['lastName']?'\x20'+_0x3d782b[_0x5adb('0x5d')]['lastName']:''),'body':_0x3d782b[_0x5adb('0xd6')]?_0x3d782b[_0x5adb('0xd6')][_0x5adb('0xe5')]:_0x3d782b['body'],'direction':_0x3d782b['direction']==='out'?'A':'C','secret':_0x3d782b['secret'],'read':_0x3d782b[_0x5adb('0x7c')],'attachment':_0x3d782b[_0x5adb('0xd6')]};})[_0x5adb('0x5f')]()};return ejs[_0x5adb('0xeb')](path[_0x5adb('0xcd')](config[_0x5adb('0xce')],_0x5adb('0xcf'),_0x5adb('0xec'),_0x5adb('0xed')),{'interaction':_0x4a1b54})['then'](function(_0x39bf82){return new BPromise(function(_0x197b7f,_0x171fb9){pdf[_0x5adb('0xb5')](_0x39bf82,_0x3bbe7c)[_0x5adb('0xee')](path[_0x5adb('0xcd')](_0x5ae730,'transcript-'+_0x57607e['id']+'-'+_0x2b4228+'.pdf'),function(_0x4edb9e,_0x25f1f7){if(_0x4edb9e)return _0x171fb9(_0x4edb9e);_0x197b7f(_0x25f1f7);});});})[_0x5adb('0x27')](function(){return new BPromise(function(_0xb81dd2,_0x2b753d){zipdir(_0x5ae730,{'saveTo':_0x5e74dc},function(_0x27eb1e,_0x5eef55){if(_0x27eb1e)return _0x2b753d(_0x27eb1e);return _0xb81dd2(_0x5eef55);});})[_0x5adb('0x27')](function(){return new BPromise(function(_0x2cb713,_0x2034d7){rimraf(_0x5ae730,function(_0x3dd67b){if(_0x3dd67b)_0x2034d7(_0x3dd67b);return _0x2cb713();});});})[_0x5adb('0x27')](function(){return _0x3ad256[_0x5adb('0xcb')](_0x5e74dc,_0x5983ef,function(_0x38c24d){if(_0x38c24d){console[_0x5adb('0xef')](_0x5adb('0xf0'),_0x38c24d);}else{fs[_0x5adb('0xf1')](_0x5e74dc);}});});});}else{return _0x3ad256[_0x5adb('0x1d')](0xc8);}})[_0x5adb('0xae')](handleError(_0x3ad256,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 7b5502e..6a2f277 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 _0xc9c5=['unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','WhatsappMessage','setMaxListeners','update','remove','getUsers','then','setDataValue','Users','map','findAll'];(function(_0x4e0c31,_0x208e9f){var _0x3fd7df=function(_0x5ee817){while(--_0x5ee817){_0x4e0c31['push'](_0x4e0c31['shift']());}};_0x3fd7df(++_0x208e9f);}(_0xc9c5,0x193));var _0x5c9c=function(_0xd4e6b4,_0x14394e){_0xd4e6b4=_0xd4e6b4-0x0;var _0x63f282=_0xc9c5[_0xd4e6b4];return _0x63f282;};'use strict';var EventEmitter=require(_0x5c9c('0x0'));var WhatsappInteraction=require('../../mysqldb')['db']['WhatsappInteraction'];var WhatsappMessage=require('../../mysqldb')['db'][_0x5c9c('0x1')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x5c9c('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x5c9c('0x3'),'afterDestroy':_0x5c9c('0x4')};function emitEvent(_0x7fe2bb){return function(_0x132510,_0x51db61,_0x596428){_0x132510[_0x5c9c('0x5')]({'attributes':['id'],'raw':!![]})[_0x5c9c('0x6')](function(_0x575d3e){_0x132510[_0x5c9c('0x7')](_0x5c9c('0x8'),_0x575d3e[_0x5c9c('0x9')](function(_0x1d0b48){return{'id':_0x1d0b48['id']};}));return WhatsappMessage[_0x5c9c('0xa')]({'where':{'WhatsappInteractionId':_0x132510['id'],'direction':'in','read':![]},'raw':!![]});})[_0x5c9c('0x6')](function(_0x55c5c2){_0x132510[_0x5c9c('0x7')](_0x5c9c('0xb'),_0x55c5c2[_0x5c9c('0xc')]);WhatsappInteractionEvents['emit'](_0x7fe2bb+':'+_0x132510['id'],_0x132510);WhatsappInteractionEvents[_0x5c9c('0xd')](_0x7fe2bb,_0x132510);_0x596428(null);})[_0x5c9c('0xe')](_0x596428(null));};}for(var e in events){if(events[_0x5c9c('0xf')](e)){var event=events[e];WhatsappInteraction[_0x5c9c('0x10')](e,emitEvent(event));}}module[_0x5c9c('0x11')]=WhatsappInteractionEvents; \ No newline at end of file +var _0x1cbe=['WhatsappMessage','setMaxListeners','save','update','getUsers','then','setDataValue','Users','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappInteraction'];(function(_0xa650d8,_0x6d01ef){var _0x79ce97=function(_0x5ee62b){while(--_0x5ee62b){_0xa650d8['push'](_0xa650d8['shift']());}};_0x79ce97(++_0x6d01ef);}(_0x1cbe,0x166));var _0xe1cb=function(_0x2ca622,_0x174a18){_0x2ca622=_0x2ca622-0x0;var _0x1dda18=_0x1cbe[_0x2ca622];return _0x1dda18;};'use strict';var EventEmitter=require(_0xe1cb('0x0'));var WhatsappInteraction=require(_0xe1cb('0x1'))['db'][_0xe1cb('0x2')];var WhatsappMessage=require(_0xe1cb('0x1'))['db'][_0xe1cb('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xe1cb('0x4')](0x0);var events={'afterCreate':_0xe1cb('0x5'),'afterUpdate':_0xe1cb('0x6'),'afterDestroy':'remove'};function emitEvent(_0x232f9f){return function(_0x1c404e,_0x36425a,_0x50173d){_0x1c404e[_0xe1cb('0x7')]({'attributes':['id'],'raw':!![]})[_0xe1cb('0x8')](function(_0x1d3c15){_0x1c404e[_0xe1cb('0x9')](_0xe1cb('0xa'),_0x1d3c15['map'](function(_0x303389){return{'id':_0x303389['id']};}));return WhatsappMessage[_0xe1cb('0xb')]({'where':{'WhatsappInteractionId':_0x1c404e['id'],'direction':'in','read':![]},'raw':!![]});})[_0xe1cb('0x8')](function(_0x4ef1e7){_0x1c404e[_0xe1cb('0x9')](_0xe1cb('0xc'),_0x4ef1e7[_0xe1cb('0xd')]);WhatsappInteractionEvents[_0xe1cb('0xe')](_0x232f9f+':'+_0x1c404e['id'],_0x1c404e);WhatsappInteractionEvents[_0xe1cb('0xe')](_0x232f9f,_0x1c404e);_0x50173d(null);})[_0xe1cb('0xf')](_0x50173d(null));};}for(var e in events){if(events[_0xe1cb('0x10')](e)){var event=events[e];WhatsappInteraction[_0xe1cb('0x11')](e,emitEvent(event));}}module[_0xe1cb('0x12')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 59ab736..e1d14b6 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 _0xc249=['lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./whatsappInteraction.attributes','define','WhatsappInteraction','whatsapp_interactions','changed','closed','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x102d20,_0x4a0162){var _0x59c89a=function(_0x1b694d){while(--_0x1b694d){_0x102d20['push'](_0x102d20['shift']());}};_0x59c89a(++_0x4a0162);}(_0xc249,0x190));var _0x9c24=function(_0x3a060a,_0xf8626d){_0x3a060a=_0x3a060a-0x0;var _0x45a20c=_0xc249[_0x3a060a];return _0x45a20c;};'use strict';var _=require(_0x9c24('0x0'));var util=require(_0x9c24('0x1'));var logger=require(_0x9c24('0x2'))(_0x9c24('0x3'));var moment=require(_0x9c24('0x4'));var BPromise=require(_0x9c24('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x9c24('0x6'));var config=require(_0x9c24('0x7'));var attributes=require(_0x9c24('0x8'));module['exports']=function(_0x4350c3,_0x22ce67){return _0x4350c3[_0x9c24('0x9')](_0x9c24('0xa'),attributes,{'tableName':_0x9c24('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x17bc4e,_0x434936,_0x55a538){if(_0x17bc4e[_0x9c24('0xc')](_0x9c24('0xd'))){_0x17bc4e['closedAt']=moment()[_0x9c24('0xe')](_0x9c24('0xf'));}_0x55a538(null,_0x17bc4e);}}});}; \ No newline at end of file +var _0x3a42=['api','moment','path','rimraf','exports','define','whatsapp_interactions','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util'];(function(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0x3a42,0x12b));var _0x23a4=function(_0x3bdc60,_0x1097ed){_0x3bdc60=_0x3bdc60-0x0;var _0x3358a3=_0x3a42[_0x3bdc60];return _0x3358a3;};'use strict';var _=require('lodash');var util=require(_0x23a4('0x0'));var logger=require('../../config/logger')(_0x23a4('0x1'));var moment=require(_0x23a4('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x23a4('0x3'));var rimraf=require(_0x23a4('0x4'));var config=require('../../config/environment');var attributes=require('./whatsappInteraction.attributes');module[_0x23a4('0x5')]=function(_0x139d2c,_0x290feb){return _0x139d2c[_0x23a4('0x6')]('WhatsappInteraction',attributes,{'tableName':_0x23a4('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5794c2,_0x4efb93,_0x5cfc65){if(_0x5794c2[_0x23a4('0x8')]('closed')){_0x5794c2[_0x23a4('0x9')]=moment()[_0x23a4('0xa')](_0x23a4('0xb'));}_0x5cfc65(null,_0x5794c2);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 87d0601..80faf8c 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 _0xb923=['attributes','limit','stringify','catch','AddTagsToWhatsappInteraction','WhatsappInteraction','find','addTags','ids','spread','AddTags','util','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','./whatsappInteraction.socket','request','then','info','WhatsappInteraction,\x20%s,\x20%s','debug','request\x20sent','error','message','result','UpdateWhatsappInteraction','update','body','options','raw','where'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb923,0x161));var _0x3b92=function(_0x1a4f6c,_0xb28a0f){_0x1a4f6c=_0x1a4f6c-0x0;var _0x16a471=_0xb923[_0x1a4f6c];return _0x16a471;};'use strict';var _=require('lodash');var util=require(_0x3b92('0x0'));var moment=require(_0x3b92('0x1'));var BPromise=require('bluebird');var rs=require(_0x3b92('0x2'));var fs=require('fs');var Redis=require(_0x3b92('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x3b92('0x4'))(_0x3b92('0x5'));var config=require(_0x3b92('0x6'));var jayson=require(_0x3b92('0x7'));var client=jayson[_0x3b92('0x8')][_0x3b92('0x9')]({'port':0x232a});config[_0x3b92('0xa')]=_['defaults'](config[_0x3b92('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3b92('0xa')]));require(_0x3b92('0xb'))['register'](socket);function respondWithRpcPromise(_0x5b35a3,_0x53472a,_0x2bcc93){return new BPromise(function(_0xb2936a,_0x1f2112){return client[_0x3b92('0xc')](_0x5b35a3,_0x2bcc93)[_0x3b92('0xd')](function(_0x1bc37d){logger[_0x3b92('0xe')](_0x3b92('0xf'),_0x53472a,'request\x20sent');logger[_0x3b92('0x10')]('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x53472a,_0x3b92('0x11'),JSON['stringify'](_0x1bc37d));if(_0x1bc37d[_0x3b92('0x12')]){if(_0x1bc37d[_0x3b92('0x12')]['code']===0x1f4){logger['error']('WhatsappInteraction,\x20%s,\x20%s',_0x53472a,_0x1bc37d[_0x3b92('0x12')][_0x3b92('0x13')]);return _0x1f2112(_0x1bc37d['error'][_0x3b92('0x13')]);}logger['error'](_0x3b92('0xf'),_0x53472a,_0x1bc37d[_0x3b92('0x12')][_0x3b92('0x13')]);return _0xb2936a(_0x1bc37d[_0x3b92('0x12')][_0x3b92('0x13')]);}else{logger['info'](_0x3b92('0xf'),_0x53472a,_0x3b92('0x11'));_0xb2936a(_0x1bc37d[_0x3b92('0x14')]['message']);}})['catch'](function(_0x738dcb){logger[_0x3b92('0x12')](_0x3b92('0xf'),_0x53472a,_0x738dcb);_0x1f2112(_0x738dcb);});});}exports[_0x3b92('0x15')]=function(_0x5565ea){var _0x57e779=this;return new Promise(function(_0x48a7f9,_0x53e84e){return db['WhatsappInteraction'][_0x3b92('0x16')](_0x5565ea[_0x3b92('0x17')],{'raw':_0x5565ea[_0x3b92('0x18')]?_0x5565ea[_0x3b92('0x18')][_0x3b92('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5565ea[_0x3b92('0x18')]?_0x5565ea['options'][_0x3b92('0x1a')]||null:null,'attributes':_0x5565ea[_0x3b92('0x18')]?_0x5565ea[_0x3b92('0x18')][_0x3b92('0x1b')]||null:null,'limit':_0x5565ea[_0x3b92('0x18')]?_0x5565ea[_0x3b92('0x18')][_0x3b92('0x1c')]||null:null})[_0x3b92('0xd')](function(_0x33553e){logger[_0x3b92('0xe')](_0x3b92('0x15'),_0x5565ea);logger[_0x3b92('0x10')](_0x3b92('0x15'),_0x5565ea,JSON[_0x3b92('0x1d')](_0x33553e));_0x48a7f9(_0x33553e);})[_0x3b92('0x1e')](function(_0xcef421){logger[_0x3b92('0x12')]('UpdateWhatsappInteraction',_0xcef421[_0x3b92('0x13')],_0x5565ea);_0x53e84e(_0x57e779[_0x3b92('0x12')](0x1f4,_0xcef421[_0x3b92('0x13')]));});});};exports[_0x3b92('0x1f')]=function(_0x3ca6d6){return new Promise(function(_0x30e312,_0x5a9c4f){return db[_0x3b92('0x20')][_0x3b92('0x21')]({'where':_0x3ca6d6['options']?_0x3ca6d6[_0x3b92('0x18')][_0x3b92('0x1a')]||null:null})['then'](function(_0x3f91b6){if(_0x3f91b6){return _0x3f91b6[_0x3b92('0x22')](_0x3ca6d6[_0x3b92('0x17')][_0x3b92('0x23')],_['omit'](_0x3ca6d6['body'],[_0x3b92('0x23'),'id'])||{});}})[_0x3b92('0x24')](function(_0x582385){logger[_0x3b92('0xe')](_0x3b92('0x25'),_0x3ca6d6);logger[_0x3b92('0x10')](_0x3b92('0x25'),_0x3ca6d6,JSON[_0x3b92('0x1d')](_0x582385));_0x30e312(_0x582385);})[_0x3b92('0x1e')](function(_0x154b90){logger[_0x3b92('0x12')](_0x3b92('0x25'),_0x154b90[_0x3b92('0x13')],_0x3ca6d6);_0x5a9c4f(_this['error'](0x1f4,_0x154b90[_0x3b92('0x13')]));});});}; \ No newline at end of file +var _0xfd00=['UpdateWhatsappInteraction','WhatsappInteraction','options','raw','limit','debug','find','where','addTags','body','omit','ids','spread','AddTags','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','localhost','./whatsappInteraction.socket','register','request','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch'];(function(_0x173d7e,_0x3242fd){var _0x2220d6=function(_0x462828){while(--_0x462828){_0x173d7e['push'](_0x173d7e['shift']());}};_0x2220d6(++_0x3242fd);}(_0xfd00,0x126));var _0x0fd0=function(_0x51a10c,_0x221b0b){_0x51a10c=_0x51a10c-0x0;var _0x38af28=_0xfd00[_0x51a10c];return _0x38af28;};'use strict';var _=require(_0x0fd0('0x0'));var util=require(_0x0fd0('0x1'));var moment=require(_0x0fd0('0x2'));var BPromise=require(_0x0fd0('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0fd0('0x4'));var db=require(_0x0fd0('0x5'))['db'];var utils=require(_0x0fd0('0x6'));var logger=require('../../config/logger')(_0x0fd0('0x7'));var config=require('../../config/environment');var jayson=require(_0x0fd0('0x8'));var client=jayson[_0x0fd0('0x9')][_0x0fd0('0xa')]({'port':0x232a});config[_0x0fd0('0xb')]=_['defaults'](config['redis'],{'host':_0x0fd0('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0fd0('0xb')]));require(_0x0fd0('0xd'))[_0x0fd0('0xe')](socket);function respondWithRpcPromise(_0x508ce7,_0xb63e60,_0x24cc30){return new BPromise(function(_0x920246,_0x4bd3af){return client[_0x0fd0('0xf')](_0x508ce7,_0x24cc30)[_0x0fd0('0x10')](function(_0x9a31a0){logger[_0x0fd0('0x11')](_0x0fd0('0x12'),_0xb63e60,_0x0fd0('0x13'));logger['debug']('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0xb63e60,_0x0fd0('0x13'),JSON[_0x0fd0('0x14')](_0x9a31a0));if(_0x9a31a0[_0x0fd0('0x15')]){if(_0x9a31a0['error'][_0x0fd0('0x16')]===0x1f4){logger['error']('WhatsappInteraction,\x20%s,\x20%s',_0xb63e60,_0x9a31a0[_0x0fd0('0x15')][_0x0fd0('0x17')]);return _0x4bd3af(_0x9a31a0[_0x0fd0('0x15')][_0x0fd0('0x17')]);}logger[_0x0fd0('0x15')](_0x0fd0('0x12'),_0xb63e60,_0x9a31a0[_0x0fd0('0x15')][_0x0fd0('0x17')]);return _0x920246(_0x9a31a0[_0x0fd0('0x15')][_0x0fd0('0x17')]);}else{logger['info'](_0x0fd0('0x12'),_0xb63e60,_0x0fd0('0x13'));_0x920246(_0x9a31a0[_0x0fd0('0x18')][_0x0fd0('0x17')]);}})[_0x0fd0('0x19')](function(_0x3a44cc){logger[_0x0fd0('0x15')](_0x0fd0('0x12'),_0xb63e60,_0x3a44cc);_0x4bd3af(_0x3a44cc);});});}exports[_0x0fd0('0x1a')]=function(_0x24c75){var _0x1ea7f0=this;return new Promise(function(_0x5bd5e8,_0x3b0c90){return db[_0x0fd0('0x1b')]['update'](_0x24c75['body'],{'raw':_0x24c75[_0x0fd0('0x1c')]?_0x24c75[_0x0fd0('0x1c')][_0x0fd0('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x24c75['options']?_0x24c75['options']['where']||null:null,'attributes':_0x24c75[_0x0fd0('0x1c')]?_0x24c75[_0x0fd0('0x1c')]['attributes']||null:null,'limit':_0x24c75[_0x0fd0('0x1c')]?_0x24c75[_0x0fd0('0x1c')][_0x0fd0('0x1e')]||null:null})[_0x0fd0('0x10')](function(_0x290471){logger['info'](_0x0fd0('0x1a'),_0x24c75);logger[_0x0fd0('0x1f')]('UpdateWhatsappInteraction',_0x24c75,JSON[_0x0fd0('0x14')](_0x290471));_0x5bd5e8(_0x290471);})[_0x0fd0('0x19')](function(_0x16df19){logger[_0x0fd0('0x15')](_0x0fd0('0x1a'),_0x16df19['message'],_0x24c75);_0x3b0c90(_0x1ea7f0['error'](0x1f4,_0x16df19[_0x0fd0('0x17')]));});});};exports['AddTagsToWhatsappInteraction']=function(_0x326daf){return new Promise(function(_0x166fe4,_0x2ded97){return db[_0x0fd0('0x1b')][_0x0fd0('0x20')]({'where':_0x326daf[_0x0fd0('0x1c')]?_0x326daf[_0x0fd0('0x1c')][_0x0fd0('0x21')]||null:null})[_0x0fd0('0x10')](function(_0x2d7273){if(_0x2d7273){return _0x2d7273[_0x0fd0('0x22')](_0x326daf[_0x0fd0('0x23')]['ids'],_[_0x0fd0('0x24')](_0x326daf[_0x0fd0('0x23')],[_0x0fd0('0x25'),'id'])||{});}})[_0x0fd0('0x26')](function(_0x536726){logger[_0x0fd0('0x11')]('AddTags',_0x326daf);logger[_0x0fd0('0x1f')](_0x0fd0('0x27'),_0x326daf,JSON['stringify'](_0x536726));_0x166fe4(_0x536726);})[_0x0fd0('0x19')](function(_0xd05107){logger['error'](_0x0fd0('0x27'),_0xd05107['message'],_0x326daf);_0x2ded97(_this[_0x0fd0('0x15')](0x1f4,_0xd05107[_0x0fd0('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index de2b13c..ae9e017 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 _0x2b99=['update','emit','removeListener','register','length','./whatsappInteraction.events','save','remove'];(function(_0x461dac,_0x24b4d7){var _0x462fe7=function(_0xbeb3d3){while(--_0xbeb3d3){_0x461dac['push'](_0x461dac['shift']());}};_0x462fe7(++_0x24b4d7);}(_0x2b99,0xa5));var _0x92b9=function(_0x243b59,_0x3f9495){_0x243b59=_0x243b59-0x0;var _0x3e1676=_0x2b99[_0x243b59];return _0x3e1676;};'use strict';var WhatsappInteractionEvents=require(_0x92b9('0x0'));var events=[_0x92b9('0x1'),_0x92b9('0x2'),_0x92b9('0x3')];function createListener(_0x1f3cc4,_0x1f82dc){return function(_0x4ccb5f){_0x1f82dc[_0x92b9('0x4')](_0x1f3cc4,_0x4ccb5f);};}function removeListener(_0x5517af,_0x5907c3){return function(){WhatsappInteractionEvents[_0x92b9('0x5')](_0x5517af,_0x5907c3);};}exports[_0x92b9('0x6')]=function(_0x334cc1){for(var _0x135995=0x0,_0x5723e7=events[_0x92b9('0x7')];_0x135995<_0x5723e7;_0x135995++){var _0x3c3512=events[_0x135995];var _0x4cadbf=createListener('whatsappInteraction:'+_0x3c3512,_0x334cc1);WhatsappInteractionEvents['on'](_0x3c3512,_0x4cadbf);}}; \ No newline at end of file +var _0x7b4d=['whatsappInteraction:','./whatsappInteraction.events','save','remove','update','emit','removeListener','length'];(function(_0x38111a,_0x4f7e62){var _0x2e6212=function(_0x31172e){while(--_0x31172e){_0x38111a['push'](_0x38111a['shift']());}};_0x2e6212(++_0x4f7e62);}(_0x7b4d,0x149));var _0xd7b4=function(_0x4063a4,_0x19d730){_0x4063a4=_0x4063a4-0x0;var _0x17908d=_0x7b4d[_0x4063a4];return _0x17908d;};'use strict';var WhatsappInteractionEvents=require(_0xd7b4('0x0'));var events=[_0xd7b4('0x1'),_0xd7b4('0x2'),_0xd7b4('0x3')];function createListener(_0x79b6f4,_0x2541f2){return function(_0x20d2c0){_0x2541f2[_0xd7b4('0x4')](_0x79b6f4,_0x20d2c0);};}function removeListener(_0x2afae0,_0x4faaf3){return function(){WhatsappInteractionEvents[_0xd7b4('0x5')](_0x2afae0,_0x4faaf3);};}exports['register']=function(_0x28ddc7){for(var _0x2778bf=0x0,_0x26f82e=events[_0xd7b4('0x6')];_0x2778bf<_0x26f82e;_0x2778bf++){var _0x12c686=events[_0x2778bf];var _0xe62f82=createListener(_0xd7b4('0x7')+_0x12c686,_0x28ddc7);WhatsappInteractionEvents['on'](_0x12c686,_0xe62f82);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index df80e46..e08ed8a 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 _0x573e=['tracked','whatsapp','whatsappmessage:create','create','/:id/status','status','put','update','/:id/accept','accept','/:id/reject','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x573e,0x109));var _0xe573=function(_0x2d9679,_0x4ab380){_0x2d9679=_0x2d9679-0x0;var _0x49a928=_0x573e[_0x2d9679];return _0x49a928;};'use strict';var multer=require(_0xe573('0x0'));var util=require(_0xe573('0x1'));var path=require(_0xe573('0x2'));var timeout=require(_0xe573('0x3'));var express=require(_0xe573('0x4'));var router=express['Router']();var auth=require(_0xe573('0x5'));var interaction=require(_0xe573('0x6'));var config=require(_0xe573('0x7'));var controller=require(_0xe573('0x8'));router[_0xe573('0x9')]('/',auth[_0xe573('0xa')](),controller[_0xe573('0xb')]);router[_0xe573('0x9')](_0xe573('0xc'),auth[_0xe573('0xa')](),controller[_0xe573('0xd')]);router[_0xe573('0x9')](_0xe573('0xe'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth['isAuthenticated'](),interaction[_0xe573('0xf')](_0xe573('0x10'),_0xe573('0x11')),controller[_0xe573('0x12')]);router['post'](_0xe573('0x13'),controller[_0xe573('0x14')]);router[_0xe573('0x15')](_0xe573('0xe'),auth['isAuthenticated'](),controller[_0xe573('0x16')]);router[_0xe573('0x15')](_0xe573('0x17'),auth[_0xe573('0xa')](),controller[_0xe573('0x18')]);router[_0xe573('0x15')](_0xe573('0x19'),auth[_0xe573('0xa')](),controller['reject']);router['delete']('/:id',auth[_0xe573('0xa')](),controller[_0xe573('0x1a')]);module[_0xe573('0x1b')]=router; \ No newline at end of file +var _0x9ac1=['reject','delete','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','index','/describe','isAuthenticated','describe','/:id','post','tracked','whatsappmessage:create','create','/:id/status','status','put','update','accept'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x9ac1,0x120));var _0x19ac=function(_0x1bb711,_0x5a8f48){_0x1bb711=_0x1bb711-0x0;var _0x312c39=_0x9ac1[_0x1bb711];return _0x312c39;};'use strict';var multer=require(_0x19ac('0x0'));var util=require(_0x19ac('0x1'));var path=require('path');var timeout=require(_0x19ac('0x2'));var express=require(_0x19ac('0x3'));var router=express[_0x19ac('0x4')]();var auth=require(_0x19ac('0x5'));var interaction=require(_0x19ac('0x6'));var config=require(_0x19ac('0x7'));var controller=require(_0x19ac('0x8'));router[_0x19ac('0x9')]('/',auth['isAuthenticated'](),controller[_0x19ac('0xa')]);router[_0x19ac('0x9')](_0x19ac('0xb'),auth[_0x19ac('0xc')](),controller[_0x19ac('0xd')]);router[_0x19ac('0x9')](_0x19ac('0xe'),auth[_0x19ac('0xc')](),controller['show']);router[_0x19ac('0xf')]('/',auth[_0x19ac('0xc')](),interaction[_0x19ac('0x10')]('whatsapp',_0x19ac('0x11')),controller[_0x19ac('0x12')]);router[_0x19ac('0xf')](_0x19ac('0x13'),controller[_0x19ac('0x14')]);router[_0x19ac('0x15')](_0x19ac('0xe'),auth[_0x19ac('0xc')](),controller[_0x19ac('0x16')]);router[_0x19ac('0x15')]('/:id/accept',auth[_0x19ac('0xc')](),controller[_0x19ac('0x17')]);router[_0x19ac('0x15')]('/:id/reject',auth[_0x19ac('0xc')](),controller[_0x19ac('0x18')]);router[_0x19ac('0x19')](_0x19ac('0xe'),auth[_0x19ac('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index b10bb80..751bd89 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 _0x9b15=['BOOLEAN','ENUM','out','STRING','DATE','sequelize','exports','TEXT','medium'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x9b15,0x191));var _0x59b1=function(_0x3d577d,_0x52ff5e){_0x3d577d=_0x3d577d-0x0;var _0x14b396=_0x9b15[_0x3d577d];return _0x14b396;};'use strict';var Sequelize=require(_0x59b1('0x0'));module[_0x59b1('0x1')]={'body':{'type':Sequelize[_0x59b1('0x2')](_0x59b1('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x59b1('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x59b1('0x5')]('in',_0x59b1('0x6')),'defaultValue':_0x59b1('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0x59b1('0x7')](0xbe)},'phone':{'type':Sequelize[_0x59b1('0x7')]},'readAt':{'type':Sequelize[_0x59b1('0x8')]},'secret':{'type':Sequelize[_0x59b1('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x2ac4=['TEXT','medium','BOOLEAN','ENUM','out','STRING','DATE','sequelize','exports'];(function(_0x2e4a0f,_0x3a9bb6){var _0x25a3cd=function(_0x1c614f){while(--_0x1c614f){_0x2e4a0f['push'](_0x2e4a0f['shift']());}};_0x25a3cd(++_0x3a9bb6);}(_0x2ac4,0x130));var _0x42ac=function(_0x3557d0,_0x39f204){_0x3557d0=_0x3557d0-0x0;var _0x38d56c=_0x2ac4[_0x3557d0];return _0x38d56c;};'use strict';var Sequelize=require(_0x42ac('0x0'));module[_0x42ac('0x1')]={'body':{'type':Sequelize[_0x42ac('0x2')](_0x42ac('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x42ac('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x42ac('0x5')]('in',_0x42ac('0x6')),'defaultValue':_0x42ac('0x6'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0x42ac('0x7')]},'readAt':{'type':Sequelize[_0x42ac('0x8')]},'secret':{'type':Sequelize[_0x42ac('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 74a3022..7c200b8 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 _0xf3a1=['fieldName','key','map','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','type','VIRTUAL','options','WhatsappMessage','includeAll','include','findAll','rows','catch','show','params','create','body','find','destroy','describe','accept','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','get','WhatsappInteractionId','isNil','read1stAt','format','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','whatsapp','agent','WhatsappInteraction','stringify','rejectMessage','rejectmessage','WhatsappAccount','WhatsappAccountId','debug','WhatsppMessage,\x20%s,\x20%s,\x20%s','twilio','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','inspect','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','lodash','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./whatsappMessage.socket','register','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','error','WhatsappMessage,\x20%s,\x20%s','message','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','save','update','end','stack','name','index','rawAttributes'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0xf3a1,0xcd));var _0x1f3a=function(_0x11a647,_0x2368d6){_0x11a647=_0x11a647-0x0;var _0x56698b=_0xf3a1[_0x11a647];return _0x56698b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1f3a('0x0'));var rimraf=require(_0x1f3a('0x1'));var zipdir=require(_0x1f3a('0x2'));var jsonpatch=require(_0x1f3a('0x3'));var rp=require(_0x1f3a('0x4'));var moment=require(_0x1f3a('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x1f3a('0x6'));var path=require(_0x1f3a('0x7'));var sox=require(_0x1f3a('0x8'));var csv=require(_0x1f3a('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x1f3a('0xa'));var squel=require('squel');var crypto=require(_0x1f3a('0xb'));var jsforce=require(_0x1f3a('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x1f3a('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1f3a('0xd'));var authService=require(_0x1f3a('0xe'));var qs=require(_0x1f3a('0xf'));var as=require(_0x1f3a('0x10'));var hardwareService=require(_0x1f3a('0x11'));var logger=require(_0x1f3a('0x12'))(_0x1f3a('0x13'));var utils=require(_0x1f3a('0x14'));var config=require(_0x1f3a('0x15'));var db=require(_0x1f3a('0x16'))['db'];config[_0x1f3a('0x17')]=_[_0x1f3a('0x18')](config[_0x1f3a('0x17')],{'host':_0x1f3a('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1f3a('0x17')]));require(_0x1f3a('0x1a'))[_0x1f3a('0x1b')](socket);var jayson=require('jayson/promise');var client=jayson[_0x1f3a('0x1c')][_0x1f3a('0x1d')]({'port':0x232c});var client9002=jayson['client'][_0x1f3a('0x1d')]({'port':0x232a});function checkPasswordPattern(_0x395430,_0x46ce44,_0x3ef2a9){if(_0x3ef2a9){var _0x3c7024=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3c7024[_0x1f3a('0x1e')](_0x46ce44)){return _0x395430;}else{throw new db[(_0x1f3a('0x1f'))][(_0x1f3a('0x20'))](_0x1f3a('0x21'));}}else{return _0x395430;}}function respondWithRpcPromise(_0x436dfe,_0x334538,_0x6873c0,_0x49eb70){return new BPromise(function(_0x3dbd7d,_0x2548b7){var _0x1b98db=_0x49eb70||client;return _0x1b98db['request'](_0x436dfe,_0x6873c0)[_0x1f3a('0x22')](function(_0x3a8919){logger[_0x1f3a('0x23')]('WhatsappMessage,\x20%s,\x20%s',_0x334538,_0x1f3a('0x24'));logger['debug'](_0x1f3a('0x25'),_0x334538,_0x1f3a('0x24'),JSON['stringify'](_0x3a8919));if(_0x3a8919[_0x1f3a('0x26')]){if(_0x3a8919[_0x1f3a('0x26')]['code']===0x1f4){logger[_0x1f3a('0x26')](_0x1f3a('0x27'),_0x334538,_0x3a8919[_0x1f3a('0x26')][_0x1f3a('0x28')]);return _0x2548b7(_0x3a8919['error'][_0x1f3a('0x28')]);}logger[_0x1f3a('0x26')](_0x1f3a('0x27'),_0x334538,_0x3a8919['error']['message']);return _0x3dbd7d(_0x3a8919['error']['message']);}else{logger[_0x1f3a('0x23')]('WhatsappMessage,\x20%s,\x20%s',_0x334538,_0x1f3a('0x24'));_0x3dbd7d(_0x3a8919['result'][_0x1f3a('0x28')]);}})['catch'](function(_0x339d95){logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x334538,_0x339d95);_0x2548b7(_0x339d95);});});}function respondWithStatusCode(_0x304c35,_0x2b3ef3){_0x2b3ef3=_0x2b3ef3||0xcc;return function(_0x30b460){if(_0x30b460){return _0x304c35[_0x1f3a('0x29')](_0x2b3ef3);}return _0x304c35[_0x1f3a('0x2a')](_0x2b3ef3)['end']();};}function respondWithResult(_0x14b783,_0x45dd3e){_0x45dd3e=_0x45dd3e||0xc8;return function(_0x5cdf0a){if(_0x5cdf0a){return _0x14b783[_0x1f3a('0x2a')](_0x45dd3e)[_0x1f3a('0x2b')](_0x5cdf0a);}};}function respondWithFilteredResult(_0x21f75d,_0x2fcc2b){return function(_0x1991ba){if(_0x1991ba){var _0xa85625=_0x1991ba[_0x1f3a('0x2c')],_0x4090e0=_0x2fcc2b[_0x1f3a('0x2d')],_0x5c3c2e=_0x2fcc2b['offset']+_0x2fcc2b[_0x1f3a('0x2e')],_0x2a8206;if(_0x5c3c2e>=_0xa85625){_0x5c3c2e=_0xa85625;_0x2a8206=0xc8;}else{_0x2a8206=0xce;}_0x21f75d[_0x1f3a('0x2a')](_0x2a8206);return _0x21f75d[_0x1f3a('0x2f')](_0x1f3a('0x30'),_0x4090e0+'-'+_0x5c3c2e+'/'+_0xa85625)[_0x1f3a('0x2b')](_0x1991ba);}return null;};}function patchUpdates(_0x16f05a){return function(_0x51f35e){try{jsonpatch['apply'](_0x51f35e,_0x16f05a,!![]);}catch(_0x3aad38){return BPromise[_0x1f3a('0x31')](_0x3aad38);}return _0x51f35e[_0x1f3a('0x32')]();};}function saveUpdates(_0x55b7a8,_0x35f638){return function(_0x2ba0c6){if(_0x2ba0c6){return _0x2ba0c6[_0x1f3a('0x33')](_0x55b7a8)['then'](function(_0x3b075e){return _0x3b075e;});}return null;};}function removeEntity(_0x55e697,_0x19a4cf){return function(_0x343732){if(_0x343732){return _0x343732['destroy']()[_0x1f3a('0x22')](function(){_0x55e697[_0x1f3a('0x2a')](0xcc)[_0x1f3a('0x34')]();});}};}function handleEntityNotFound(_0x4fbe5d,_0x391890){return function(_0x52b8cc){if(!_0x52b8cc){_0x4fbe5d[_0x1f3a('0x29')](0x194);}return _0x52b8cc;};}function handleError(_0x26c159,_0x10df54){_0x10df54=_0x10df54||0x1f4;return function(_0x1b8623){logger[_0x1f3a('0x26')](_0x1b8623[_0x1f3a('0x35')]);if(_0x1b8623[_0x1f3a('0x36')]){delete _0x1b8623[_0x1f3a('0x36')];}_0x26c159[_0x1f3a('0x2a')](_0x10df54)['send'](_0x1b8623);};}exports[_0x1f3a('0x37')]=function(_0xd5dbf,_0x2de68f){var _0x5e589d={},_0x752030={},_0xa37e86={'count':0x0,'rows':[]};var _0xdbdc85=_['map'](db['WhatsappMessage'][_0x1f3a('0x38')],function(_0x28468f){return{'name':_0x28468f[_0x1f3a('0x39')],'type':_0x28468f['type'][_0x1f3a('0x3a')]};});_0x752030['model']=_[_0x1f3a('0x3b')](_0xdbdc85,_0x1f3a('0x36'));_0x752030[_0x1f3a('0x3c')]=_[_0x1f3a('0x3d')](_0xd5dbf[_0x1f3a('0x3c')]);_0x752030[_0x1f3a('0x3e')]=_[_0x1f3a('0x3f')](_0x752030[_0x1f3a('0x40')],_0x752030[_0x1f3a('0x3c')]);_0x5e589d['attributes']=_[_0x1f3a('0x3f')](_0x752030[_0x1f3a('0x40')],qs[_0x1f3a('0x41')](_0xd5dbf[_0x1f3a('0x3c')]['fields']));_0x5e589d[_0x1f3a('0x42')]=_0x5e589d[_0x1f3a('0x42')][_0x1f3a('0x43')]?_0x5e589d[_0x1f3a('0x42')]:_0x752030[_0x1f3a('0x40')];if(!_0xd5dbf[_0x1f3a('0x3c')][_0x1f3a('0x44')](_0x1f3a('0x45'))){_0x5e589d[_0x1f3a('0x2e')]=qs[_0x1f3a('0x2e')](_0xd5dbf[_0x1f3a('0x3c')][_0x1f3a('0x2e')]);_0x5e589d[_0x1f3a('0x2d')]=qs[_0x1f3a('0x2d')](_0xd5dbf[_0x1f3a('0x3c')][_0x1f3a('0x2d')]);}_0x5e589d['order']=qs[_0x1f3a('0x46')](_0xd5dbf[_0x1f3a('0x3c')][_0x1f3a('0x46')]);_0x5e589d['where']=qs[_0x1f3a('0x3e')](_[_0x1f3a('0x47')](_0xd5dbf['query'],_0x752030[_0x1f3a('0x3e')]),_0xdbdc85);if(_0xd5dbf[_0x1f3a('0x3c')][_0x1f3a('0x48')]){_0x5e589d[_0x1f3a('0x49')]=_[_0x1f3a('0x4a')](_0x5e589d['where'],{'$or':_[_0x1f3a('0x3b')](_0xdbdc85,function(_0x415478){if(_0x415478[_0x1f3a('0x4b')]!==_0x1f3a('0x4c')){var _0x14319b={};_0x14319b[_0x415478[_0x1f3a('0x36')]]={'$like':'%'+_0xd5dbf[_0x1f3a('0x3c')][_0x1f3a('0x48')]+'%'};return _0x14319b;}})});}_0x5e589d=_[_0x1f3a('0x4a')]({},_0x5e589d,_0xd5dbf[_0x1f3a('0x4d')]);var _0x123718={'where':_0x5e589d[_0x1f3a('0x49')]};return db[_0x1f3a('0x4e')][_0x1f3a('0x2c')](_0x123718)['then'](function(_0x1d4d2e){_0xa37e86[_0x1f3a('0x2c')]=_0x1d4d2e;if(_0xd5dbf[_0x1f3a('0x3c')][_0x1f3a('0x4f')]){_0x5e589d[_0x1f3a('0x50')]=[{'all':!![]}];}return db[_0x1f3a('0x4e')][_0x1f3a('0x51')](_0x5e589d);})[_0x1f3a('0x22')](function(_0x2a0a00){_0xa37e86[_0x1f3a('0x52')]=_0x2a0a00;return _0xa37e86;})[_0x1f3a('0x22')](respondWithFilteredResult(_0x2de68f,_0x5e589d))[_0x1f3a('0x53')](handleError(_0x2de68f,null));};exports[_0x1f3a('0x54')]=function(_0x3e7b3d,_0x51ee4a){var _0x2c14f2={'raw':!![],'where':{'id':_0x3e7b3d[_0x1f3a('0x55')]['id']}},_0x2f406e={};_0x2f406e[_0x1f3a('0x40')]=_[_0x1f3a('0x3d')](db['WhatsappMessage']['rawAttributes']);_0x2f406e[_0x1f3a('0x3c')]=_[_0x1f3a('0x3d')](_0x3e7b3d[_0x1f3a('0x3c')]);_0x2f406e[_0x1f3a('0x3e')]=_[_0x1f3a('0x3f')](_0x2f406e[_0x1f3a('0x40')],_0x2f406e['query']);_0x2c14f2['attributes']=_[_0x1f3a('0x3f')](_0x2f406e[_0x1f3a('0x40')],qs[_0x1f3a('0x41')](_0x3e7b3d['query'][_0x1f3a('0x41')]));_0x2c14f2[_0x1f3a('0x42')]=_0x2c14f2[_0x1f3a('0x42')][_0x1f3a('0x43')]?_0x2c14f2['attributes']:_0x2f406e['model'];if(_0x3e7b3d[_0x1f3a('0x3c')][_0x1f3a('0x4f')]){_0x2c14f2[_0x1f3a('0x50')]=[{'all':!![]}];}_0x2c14f2=_[_0x1f3a('0x4a')]({},_0x2c14f2,_0x3e7b3d[_0x1f3a('0x4d')]);return db[_0x1f3a('0x4e')]['find'](_0x2c14f2)[_0x1f3a('0x22')](handleEntityNotFound(_0x51ee4a,null))[_0x1f3a('0x22')](respondWithResult(_0x51ee4a,null))[_0x1f3a('0x53')](handleError(_0x51ee4a,null));};exports[_0x1f3a('0x56')]=function(_0x499826,_0x5ce20e){return db[_0x1f3a('0x4e')][_0x1f3a('0x56')](_0x499826['body'],{})[_0x1f3a('0x22')](respondWithResult(_0x5ce20e,0xc9))[_0x1f3a('0x53')](handleError(_0x5ce20e,null));};exports[_0x1f3a('0x33')]=function(_0x1e2298,_0x248a6c){if(_0x1e2298[_0x1f3a('0x57')]['id']){delete _0x1e2298['body']['id'];}return db[_0x1f3a('0x4e')][_0x1f3a('0x58')]({'where':{'id':_0x1e2298[_0x1f3a('0x55')]['id']}})[_0x1f3a('0x22')](handleEntityNotFound(_0x248a6c,null))['then'](saveUpdates(_0x1e2298[_0x1f3a('0x57')],null))[_0x1f3a('0x22')](respondWithResult(_0x248a6c,null))[_0x1f3a('0x53')](handleError(_0x248a6c,null));};exports[_0x1f3a('0x59')]=function(_0x7adb43,_0x13873d){return db['WhatsappMessage'][_0x1f3a('0x58')]({'where':{'id':_0x7adb43['params']['id']}})[_0x1f3a('0x22')](handleEntityNotFound(_0x13873d,null))['then'](removeEntity(_0x13873d,null))[_0x1f3a('0x53')](handleError(_0x13873d,null));};exports[_0x1f3a('0x5a')]=function(_0x70d51,_0x3036b6){return db[_0x1f3a('0x4e')][_0x1f3a('0x5a')]()[_0x1f3a('0x22')](respondWithResult(_0x3036b6,null))['catch'](handleError(_0x3036b6,null));};var interaction_log=require(_0x1f3a('0x12'))('whatsapp-interactions');exports[_0x1f3a('0x5b')]=function(_0x41b1ce,_0x18e758,_0x6e2881){var _0x30141f={'channel':'whatsapp'};if(_0x41b1ce['body']['id']){delete _0x41b1ce[_0x1f3a('0x57')]['id'];}_0x41b1ce[_0x1f3a('0x57')][_0x1f3a('0x5c')]=!![];_0x41b1ce[_0x1f3a('0x57')][_0x1f3a('0x5d')]=moment()['format'](_0x1f3a('0x5e'));_0x41b1ce[_0x1f3a('0x57')][_0x1f3a('0x5f')]=_0x41b1ce[_0x1f3a('0x57')][_0x1f3a('0x5f')]||_0x41b1ce[_0x1f3a('0x60')]['id'];return db[_0x1f3a('0x4e')][_0x1f3a('0x58')]({'where':{'id':_0x41b1ce['params']['id'],'UserId':null},'include':[{'model':db[_0x1f3a('0x61')],'as':'Contact'}]})[_0x1f3a('0x22')](handleEntityNotFound(_0x18e758,null))['then'](saveUpdates(_0x41b1ce['body'],null))[_0x1f3a('0x22')](function(_0x1c02d6){if(_0x1c02d6){_0x30141f[_0x1f3a('0x28')]=_0x1c02d6[_0x1f3a('0x62')]({'plain':!![]});return db['WhatsappInteraction'][_0x1f3a('0x58')]({'where':{'id':_0x1c02d6[_0x1f3a('0x63')]}});}return null;})[_0x1f3a('0x22')](handleEntityNotFound(_0x18e758,null))['then'](function(_0x927787){if(_0x927787){return _0x927787[_0x1f3a('0x33')]({'UserId':_0x41b1ce[_0x1f3a('0x57')][_0x1f3a('0x5f')],'read1stAt':_[_0x1f3a('0x64')](_0x927787[_0x1f3a('0x65')])?moment()[_0x1f3a('0x66')](_0x1f3a('0x5e')):undefined});}return null;})[_0x1f3a('0x22')](function(_0x81775d){if(_0x81775d){_0x30141f['interaction']=_0x81775d[_0x1f3a('0x62')]({'plain':!![]});interaction_log[_0x1f3a('0x23')](_0x1f3a('0x67'),_0x41b1ce['user']['id'],_0x41b1ce[_0x1f3a('0x60')][_0x1f3a('0x36')],_0x41b1ce[_0x1f3a('0x60')][_0x1f3a('0x68')],_0x30141f['interaction']['id'],_0x41b1ce[_0x1f3a('0x57')]?JSON['stringify'](_0x41b1ce[_0x1f3a('0x57')]):_0x1f3a('0x69'));return respondWithRpcPromise(_0x1f3a('0x6a'),_0x1f3a('0x6b'),_0x30141f);}return null;})[_0x1f3a('0x22')](function(_0x3d4669){if(_0x3d4669){if(_0x41b1ce[_0x1f3a('0x57')][_0x1f3a('0x6c')]){_0x30141f[_0x1f3a('0x28')][_0x1f3a('0x6d')]=util[_0x1f3a('0x66')](_0x1f3a('0x6e'),_0x41b1ce[_0x1f3a('0x60')][_0x1f3a('0x36')]);_0x30141f['message'][_0x1f3a('0x6f')]=_0x30141f[_0x1f3a('0x6f')];_0x30141f[_0x1f3a('0x28')][_0x1f3a('0x70')]=_0x1f3a('0x5b');return respondWithRpcPromise(_0x1f3a('0x71'),_0x1f3a('0x71'),{'event':_0x1f3a('0x72'),'message':_0x30141f[_0x1f3a('0x28')]},client9002)[_0x1f3a('0x22')](function(){return _0x30141f;});}return _0x30141f;}return null;})[_0x1f3a('0x22')](respondWithResult(_0x18e758,null))[_0x1f3a('0x53')](handleError(_0x18e758,null));};var interaction_log=require(_0x1f3a('0x12'))('whatsapp-interactions');exports['reject']=function(_0x491e37,_0x42dd09,_0x26affe){var _0x40f509={'agent':{},'channel':_0x1f3a('0x73')};if(_0x491e37[_0x1f3a('0x57')]['id']){delete _0x491e37['body']['id'];}_0x491e37[_0x1f3a('0x57')][_0x1f3a('0x5f')]=_0x491e37['body'][_0x1f3a('0x5f')]||_0x491e37['user']['id'];_0x40f509[_0x1f3a('0x74')]['id']=_0x491e37['body'][_0x1f3a('0x5f')];return db[_0x1f3a('0x4e')][_0x1f3a('0x58')]({'where':{'id':_0x491e37[_0x1f3a('0x55')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x42dd09,null))['then'](function(_0x123ab8){if(_0x123ab8){_0x40f509['message']=_0x123ab8[_0x1f3a('0x62')]({'plain':!![]});return db[_0x1f3a('0x75')][_0x1f3a('0x58')]({'where':{'id':_0x123ab8[_0x1f3a('0x63')]}});}return null;})['then'](handleEntityNotFound(_0x42dd09,null))[_0x1f3a('0x22')](function(_0x14bdff){if(_0x14bdff){_0x40f509['interaction']=_0x14bdff[_0x1f3a('0x62')]({'plain':!![]});interaction_log['info']('[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x491e37['user']['id'],_0x491e37[_0x1f3a('0x60')]['name'],_0x491e37[_0x1f3a('0x60')][_0x1f3a('0x68')],_0x40f509['interaction']['id'],_0x491e37[_0x1f3a('0x57')]?JSON[_0x1f3a('0x76')](_0x491e37[_0x1f3a('0x57')]):'null');return respondWithRpcPromise('RejectMessage',_0x1f3a('0x77'),_0x40f509);}return null;})[_0x1f3a('0x22')](function(_0x823d2c){if(_0x823d2c){_0x823d2c['message'][_0x1f3a('0x6d')]=util['format']('SIP/%s',_0x491e37['user'][_0x1f3a('0x36')]);_0x823d2c[_0x1f3a('0x28')][_0x1f3a('0x6f')]=_0x40f509[_0x1f3a('0x6f')];_0x823d2c['message'][_0x1f3a('0x70')]='reject';respondWithRpcPromise('EventManager','EventManager',{'event':_0x1f3a('0x78'),'message':_0x823d2c[_0x1f3a('0x28')]},client9002);return _0x40f509;}return null;})['then'](respondWithResult(_0x42dd09,null))['catch'](handleError(_0x42dd09,null));};exports['status']=function(_0x3f6a09,_0x540223,_0x33990b){if(_0x3f6a09[_0x1f3a('0x57')]['id']){delete _0x3f6a09['body']['id'];}var _0x471292;return db[_0x1f3a('0x4e')][_0x1f3a('0x58')]({'where':{'id':_0x3f6a09['params']['id']}})[_0x1f3a('0x22')](handleEntityNotFound(_0x540223,null))[_0x1f3a('0x22')](function(_0x460b1b){if(_0x460b1b){_0x471292=_0x460b1b;return db[_0x1f3a('0x79')]['find']({'where':{'id':_0x460b1b[_0x1f3a('0x7a')]}});}})[_0x1f3a('0x22')](handleEntityNotFound(_0x540223,null))[_0x1f3a('0x22')](function(_0x1074e9){if(_0x1074e9){logger[_0x1f3a('0x7b')](_0x1f3a('0x7c'),_0x1f3a('0x2a'),'received\x20delivery\x20report\x20from',_0x1074e9['type'],util['inspect'](_0x3f6a09[_0x1f3a('0x57')],{'showHidden':![],'depth':null}));switch(_0x1074e9[_0x1f3a('0x4b')]){case _0x1f3a('0x7d'):if(_0x3f6a09[_0x1f3a('0x57')][_0x1f3a('0x7e')]&&_0x3f6a09[_0x1f3a('0x57')][_0x1f3a('0x7e')]===_0x471292[_0x1f3a('0x7f')]&&_0x3f6a09[_0x1f3a('0x57')][_0x1f3a('0x80')]&&_0x3f6a09[_0x1f3a('0x57')][_0x1f3a('0x80')]===_0x1f3a('0x5c')){return _0x471292[_0x1f3a('0x33')]({'read':!![]});}else{logger['error'](_0x1f3a('0x81'),_0x1f3a('0x2a'),'twilio',util[_0x1f3a('0x82')](_0x3f6a09[_0x1f3a('0x57')],{'showHidden':![],'depth':null}));}break;}return _0x471292;}})[_0x1f3a('0x22')](respondWithResult(_0x540223,null))[_0x1f3a('0x53')](handleError(_0x540223,null));}; \ No newline at end of file +var _0xb998=['keys','filters','model','attributes','intersection','fields','length','nolimit','sort','where','merge','VIRTUAL','options','includeAll','findAll','create','body','find','params','describe','accept','whatsapp','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','get','WhatsappInteraction','WhatsappInteractionId','isNil','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','AcceptMessage','manual','interface','SIP/%s','channel','event','EventManager','whatsapp-interactions','reject','agent','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','RejectMessage','rejectmessage','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','MessageStatus','read','WhatsappAccount,\x20%s,\x20%s,\x20%s','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','path','sox','ejs','crypto','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','json','count','offset','limit','set','save','update','destroy','stack','index','WhatsappMessage','fieldName','type','key','map','name','query'];(function(_0x4bd103,_0x4592a1){var _0x47654e=function(_0x1869ef){while(--_0x1869ef){_0x4bd103['push'](_0x4bd103['shift']());}};_0x47654e(++_0x4592a1);}(_0xb998,0xba));var _0x8b99=function(_0x33ad1a,_0x179b3e){_0x33ad1a=_0x33ad1a-0x0;var _0x114e48=_0xb998[_0x33ad1a];return _0x114e48;};'use strict';var pdf=require(_0x8b99('0x0'));var emlformat=require(_0x8b99('0x1'));var rimraf=require(_0x8b99('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8b99('0x3'));var rp=require(_0x8b99('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8b99('0x5'));var util=require(_0x8b99('0x6'));var path=require(_0x8b99('0x7'));var sox=require(_0x8b99('0x8'));var csv=require('to-csv');var ejs=require(_0x8b99('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x8b99('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x8b99('0xb'));var querystring=require(_0x8b99('0xc'));var Papa=require(_0x8b99('0xd'));var Redis=require(_0x8b99('0xe'));var authService=require(_0x8b99('0xf'));var qs=require(_0x8b99('0x10'));var as=require(_0x8b99('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8b99('0x12'))('api');var utils=require(_0x8b99('0x13'));var config=require('../../config/environment');var db=require(_0x8b99('0x14'))['db'];config[_0x8b99('0x15')]=_[_0x8b99('0x16')](config[_0x8b99('0x15')],{'host':_0x8b99('0x17'),'port':0x18eb});var socket=require(_0x8b99('0x18'))(new Redis(config[_0x8b99('0x15')]));require(_0x8b99('0x19'))['register'](socket);var jayson=require(_0x8b99('0x1a'));var client=jayson[_0x8b99('0x1b')][_0x8b99('0x1c')]({'port':0x232c});var client9002=jayson[_0x8b99('0x1b')][_0x8b99('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x27edd1,_0x41d386,_0x42bc2d){if(_0x42bc2d){var _0x5e71f2=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5e71f2[_0x8b99('0x1d')](_0x41d386)){return _0x27edd1;}else{throw new db[(_0x8b99('0x1e'))][(_0x8b99('0x1f'))](_0x8b99('0x20'));}}else{return _0x27edd1;}}function respondWithRpcPromise(_0x2ec749,_0x244bb4,_0xb666e0,_0xa92d06){return new BPromise(function(_0x133828,_0x4df996){var _0x110dea=_0xa92d06||client;return _0x110dea['request'](_0x2ec749,_0xb666e0)[_0x8b99('0x21')](function(_0x110f46){logger[_0x8b99('0x22')](_0x8b99('0x23'),_0x244bb4,_0x8b99('0x24'));logger[_0x8b99('0x25')](_0x8b99('0x26'),_0x244bb4,_0x8b99('0x24'),JSON[_0x8b99('0x27')](_0x110f46));if(_0x110f46[_0x8b99('0x28')]){if(_0x110f46[_0x8b99('0x28')][_0x8b99('0x29')]===0x1f4){logger[_0x8b99('0x28')](_0x8b99('0x23'),_0x244bb4,_0x110f46[_0x8b99('0x28')]['message']);return _0x4df996(_0x110f46['error']['message']);}logger['error'](_0x8b99('0x23'),_0x244bb4,_0x110f46[_0x8b99('0x28')][_0x8b99('0x2a')]);return _0x133828(_0x110f46[_0x8b99('0x28')][_0x8b99('0x2a')]);}else{logger[_0x8b99('0x22')](_0x8b99('0x23'),_0x244bb4,_0x8b99('0x24'));_0x133828(_0x110f46[_0x8b99('0x2b')][_0x8b99('0x2a')]);}})[_0x8b99('0x2c')](function(_0x1718d9){logger[_0x8b99('0x28')](_0x8b99('0x23'),_0x244bb4,_0x1718d9);_0x4df996(_0x1718d9);});});}function respondWithStatusCode(_0x1a0684,_0x41496b){_0x41496b=_0x41496b||0xcc;return function(_0x1157b3){if(_0x1157b3){return _0x1a0684['sendStatus'](_0x41496b);}return _0x1a0684[_0x8b99('0x2d')](_0x41496b)[_0x8b99('0x2e')]();};}function respondWithResult(_0x389e59,_0x5e41de){_0x5e41de=_0x5e41de||0xc8;return function(_0x515fa4){if(_0x515fa4){return _0x389e59[_0x8b99('0x2d')](_0x5e41de)[_0x8b99('0x2f')](_0x515fa4);}};}function respondWithFilteredResult(_0x155e1e,_0x3e6ffc){return function(_0x55c27f){if(_0x55c27f){var _0x36cea8=_0x55c27f[_0x8b99('0x30')],_0xa9a121=_0x3e6ffc[_0x8b99('0x31')],_0x4353cb=_0x3e6ffc[_0x8b99('0x31')]+_0x3e6ffc[_0x8b99('0x32')],_0x5612d4;if(_0x4353cb>=_0x36cea8){_0x4353cb=_0x36cea8;_0x5612d4=0xc8;}else{_0x5612d4=0xce;}_0x155e1e['status'](_0x5612d4);return _0x155e1e[_0x8b99('0x33')]('Content-Range',_0xa9a121+'-'+_0x4353cb+'/'+_0x36cea8)['json'](_0x55c27f);}return null;};}function patchUpdates(_0x29d9a8){return function(_0x1043ad){try{jsonpatch['apply'](_0x1043ad,_0x29d9a8,!![]);}catch(_0xad4bf9){return BPromise['reject'](_0xad4bf9);}return _0x1043ad[_0x8b99('0x34')]();};}function saveUpdates(_0x5a838c,_0x59b3c2){return function(_0xabd269){if(_0xabd269){return _0xabd269[_0x8b99('0x35')](_0x5a838c)[_0x8b99('0x21')](function(_0x53a363){return _0x53a363;});}return null;};}function removeEntity(_0x41cbd4,_0x61ebe3){return function(_0x3807b4){if(_0x3807b4){return _0x3807b4[_0x8b99('0x36')]()['then'](function(){_0x41cbd4[_0x8b99('0x2d')](0xcc)[_0x8b99('0x2e')]();});}};}function handleEntityNotFound(_0xc5df86,_0x1cd38b){return function(_0x8f1ab6){if(!_0x8f1ab6){_0xc5df86['sendStatus'](0x194);}return _0x8f1ab6;};}function handleError(_0x66f79b,_0x16c513){_0x16c513=_0x16c513||0x1f4;return function(_0x3c1166){logger[_0x8b99('0x28')](_0x3c1166[_0x8b99('0x37')]);if(_0x3c1166['name']){delete _0x3c1166['name'];}_0x66f79b[_0x8b99('0x2d')](_0x16c513)['send'](_0x3c1166);};}exports[_0x8b99('0x38')]=function(_0x14510f,_0x2d0942){var _0x119049={},_0x14d8a0={},_0x3a001e={'count':0x0,'rows':[]};var _0x23cb02=_['map'](db[_0x8b99('0x39')]['rawAttributes'],function(_0x209c3d){return{'name':_0x209c3d[_0x8b99('0x3a')],'type':_0x209c3d[_0x8b99('0x3b')][_0x8b99('0x3c')]};});_0x14d8a0['model']=_[_0x8b99('0x3d')](_0x23cb02,_0x8b99('0x3e'));_0x14d8a0[_0x8b99('0x3f')]=_[_0x8b99('0x40')](_0x14510f[_0x8b99('0x3f')]);_0x14d8a0[_0x8b99('0x41')]=_['intersection'](_0x14d8a0[_0x8b99('0x42')],_0x14d8a0['query']);_0x119049[_0x8b99('0x43')]=_[_0x8b99('0x44')](_0x14d8a0[_0x8b99('0x42')],qs[_0x8b99('0x45')](_0x14510f[_0x8b99('0x3f')][_0x8b99('0x45')]));_0x119049[_0x8b99('0x43')]=_0x119049[_0x8b99('0x43')][_0x8b99('0x46')]?_0x119049[_0x8b99('0x43')]:_0x14d8a0[_0x8b99('0x42')];if(!_0x14510f['query']['hasOwnProperty'](_0x8b99('0x47'))){_0x119049[_0x8b99('0x32')]=qs[_0x8b99('0x32')](_0x14510f['query'][_0x8b99('0x32')]);_0x119049[_0x8b99('0x31')]=qs[_0x8b99('0x31')](_0x14510f['query']['offset']);}_0x119049['order']=qs[_0x8b99('0x48')](_0x14510f[_0x8b99('0x3f')]['sort']);_0x119049[_0x8b99('0x49')]=qs[_0x8b99('0x41')](_['pick'](_0x14510f['query'],_0x14d8a0['filters']),_0x23cb02);if(_0x14510f[_0x8b99('0x3f')]['filter']){_0x119049[_0x8b99('0x49')]=_[_0x8b99('0x4a')](_0x119049[_0x8b99('0x49')],{'$or':_[_0x8b99('0x3d')](_0x23cb02,function(_0x8f7f4a){if(_0x8f7f4a[_0x8b99('0x3b')]!==_0x8b99('0x4b')){var _0x3773e7={};_0x3773e7[_0x8f7f4a['name']]={'$like':'%'+_0x14510f[_0x8b99('0x3f')]['filter']+'%'};return _0x3773e7;}})});}_0x119049=_[_0x8b99('0x4a')]({},_0x119049,_0x14510f[_0x8b99('0x4c')]);var _0x387ea3={'where':_0x119049[_0x8b99('0x49')]};return db[_0x8b99('0x39')][_0x8b99('0x30')](_0x387ea3)[_0x8b99('0x21')](function(_0x518d2f){_0x3a001e[_0x8b99('0x30')]=_0x518d2f;if(_0x14510f[_0x8b99('0x3f')][_0x8b99('0x4d')]){_0x119049['include']=[{'all':!![]}];}return db[_0x8b99('0x39')][_0x8b99('0x4e')](_0x119049);})['then'](function(_0x169bd4){_0x3a001e['rows']=_0x169bd4;return _0x3a001e;})[_0x8b99('0x21')](respondWithFilteredResult(_0x2d0942,_0x119049))[_0x8b99('0x2c')](handleError(_0x2d0942,null));};exports['show']=function(_0x25e19d,_0x11eb40){var _0x5bcfd4={'raw':!![],'where':{'id':_0x25e19d['params']['id']}},_0x2deb94={};_0x2deb94[_0x8b99('0x42')]=_['keys'](db['WhatsappMessage']['rawAttributes']);_0x2deb94[_0x8b99('0x3f')]=_[_0x8b99('0x40')](_0x25e19d['query']);_0x2deb94[_0x8b99('0x41')]=_[_0x8b99('0x44')](_0x2deb94[_0x8b99('0x42')],_0x2deb94[_0x8b99('0x3f')]);_0x5bcfd4[_0x8b99('0x43')]=_[_0x8b99('0x44')](_0x2deb94['model'],qs['fields'](_0x25e19d['query'][_0x8b99('0x45')]));_0x5bcfd4[_0x8b99('0x43')]=_0x5bcfd4[_0x8b99('0x43')][_0x8b99('0x46')]?_0x5bcfd4[_0x8b99('0x43')]:_0x2deb94[_0x8b99('0x42')];if(_0x25e19d[_0x8b99('0x3f')][_0x8b99('0x4d')]){_0x5bcfd4['include']=[{'all':!![]}];}_0x5bcfd4=_['merge']({},_0x5bcfd4,_0x25e19d[_0x8b99('0x4c')]);return db[_0x8b99('0x39')]['find'](_0x5bcfd4)[_0x8b99('0x21')](handleEntityNotFound(_0x11eb40,null))['then'](respondWithResult(_0x11eb40,null))[_0x8b99('0x2c')](handleError(_0x11eb40,null));};exports['create']=function(_0x16b3ca,_0xf2aaa3){return db[_0x8b99('0x39')][_0x8b99('0x4f')](_0x16b3ca[_0x8b99('0x50')],{})[_0x8b99('0x21')](respondWithResult(_0xf2aaa3,0xc9))['catch'](handleError(_0xf2aaa3,null));};exports[_0x8b99('0x35')]=function(_0x4f105a,_0x304571){if(_0x4f105a[_0x8b99('0x50')]['id']){delete _0x4f105a[_0x8b99('0x50')]['id'];}return db[_0x8b99('0x39')][_0x8b99('0x51')]({'where':{'id':_0x4f105a[_0x8b99('0x52')]['id']}})[_0x8b99('0x21')](handleEntityNotFound(_0x304571,null))['then'](saveUpdates(_0x4f105a[_0x8b99('0x50')],null))[_0x8b99('0x21')](respondWithResult(_0x304571,null))[_0x8b99('0x2c')](handleError(_0x304571,null));};exports[_0x8b99('0x36')]=function(_0xb724e,_0x46c807){return db[_0x8b99('0x39')][_0x8b99('0x51')]({'where':{'id':_0xb724e[_0x8b99('0x52')]['id']}})[_0x8b99('0x21')](handleEntityNotFound(_0x46c807,null))[_0x8b99('0x21')](removeEntity(_0x46c807,null))['catch'](handleError(_0x46c807,null));};exports[_0x8b99('0x53')]=function(_0x311c65,_0xb4d7a3){return db[_0x8b99('0x39')][_0x8b99('0x53')]()[_0x8b99('0x21')](respondWithResult(_0xb4d7a3,null))['catch'](handleError(_0xb4d7a3,null));};var interaction_log=require(_0x8b99('0x12'))('whatsapp-interactions');exports[_0x8b99('0x54')]=function(_0x3299b1,_0x44549c,_0x357695){var _0x17b4f6={'channel':_0x8b99('0x55')};if(_0x3299b1[_0x8b99('0x50')]['id']){delete _0x3299b1['body']['id'];}_0x3299b1['body']['read']=!![];_0x3299b1[_0x8b99('0x50')][_0x8b99('0x56')]=moment()[_0x8b99('0x57')](_0x8b99('0x58'));_0x3299b1['body'][_0x8b99('0x59')]=_0x3299b1[_0x8b99('0x50')][_0x8b99('0x59')]||_0x3299b1[_0x8b99('0x5a')]['id'];return db['WhatsappMessage'][_0x8b99('0x51')]({'where':{'id':_0x3299b1[_0x8b99('0x52')]['id'],'UserId':null},'include':[{'model':db[_0x8b99('0x5b')],'as':_0x8b99('0x5c')}]})['then'](handleEntityNotFound(_0x44549c,null))[_0x8b99('0x21')](saveUpdates(_0x3299b1['body'],null))[_0x8b99('0x21')](function(_0xdf49ea){if(_0xdf49ea){_0x17b4f6[_0x8b99('0x2a')]=_0xdf49ea[_0x8b99('0x5d')]({'plain':!![]});return db[_0x8b99('0x5e')][_0x8b99('0x51')]({'where':{'id':_0xdf49ea[_0x8b99('0x5f')]}});}return null;})[_0x8b99('0x21')](handleEntityNotFound(_0x44549c,null))[_0x8b99('0x21')](function(_0x5226ab){if(_0x5226ab){return _0x5226ab[_0x8b99('0x35')]({'UserId':_0x3299b1[_0x8b99('0x50')][_0x8b99('0x59')],'read1stAt':_[_0x8b99('0x60')](_0x5226ab['read1stAt'])?moment()[_0x8b99('0x57')](_0x8b99('0x58')):undefined});}return null;})[_0x8b99('0x21')](function(_0x44c607){if(_0x44c607){_0x17b4f6[_0x8b99('0x61')]=_0x44c607[_0x8b99('0x5d')]({'plain':!![]});interaction_log[_0x8b99('0x22')](_0x8b99('0x62'),_0x3299b1[_0x8b99('0x5a')]['id'],_0x3299b1[_0x8b99('0x5a')][_0x8b99('0x3e')],_0x3299b1[_0x8b99('0x5a')]['role'],_0x17b4f6['interaction']['id'],_0x3299b1[_0x8b99('0x50')]?JSON['stringify'](_0x3299b1[_0x8b99('0x50')]):'null');return respondWithRpcPromise(_0x8b99('0x63'),'acceptMessage',_0x17b4f6);}return null;})['then'](function(_0x418b18){if(_0x418b18){if(_0x3299b1[_0x8b99('0x50')][_0x8b99('0x64')]){_0x17b4f6[_0x8b99('0x2a')][_0x8b99('0x65')]=util['format'](_0x8b99('0x66'),_0x3299b1['user']['name']);_0x17b4f6[_0x8b99('0x2a')]['channel']=_0x17b4f6[_0x8b99('0x67')];_0x17b4f6[_0x8b99('0x2a')][_0x8b99('0x68')]='accept';return respondWithRpcPromise(_0x8b99('0x69'),'EventManager',{'event':'acceptmessage','message':_0x17b4f6[_0x8b99('0x2a')]},client9002)[_0x8b99('0x21')](function(){return _0x17b4f6;});}return _0x17b4f6;}return null;})[_0x8b99('0x21')](respondWithResult(_0x44549c,null))[_0x8b99('0x2c')](handleError(_0x44549c,null));};var interaction_log=require(_0x8b99('0x12'))(_0x8b99('0x6a'));exports[_0x8b99('0x6b')]=function(_0x210c22,_0x2d3b59,_0xef6c34){var _0x47db94={'agent':{},'channel':_0x8b99('0x55')};if(_0x210c22[_0x8b99('0x50')]['id']){delete _0x210c22[_0x8b99('0x50')]['id'];}_0x210c22['body'][_0x8b99('0x59')]=_0x210c22['body'][_0x8b99('0x59')]||_0x210c22[_0x8b99('0x5a')]['id'];_0x47db94[_0x8b99('0x6c')]['id']=_0x210c22['body']['UserId'];return db[_0x8b99('0x39')][_0x8b99('0x51')]({'where':{'id':_0x210c22['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x2d3b59,null))['then'](function(_0x2d947c){if(_0x2d947c){_0x47db94['message']=_0x2d947c[_0x8b99('0x5d')]({'plain':!![]});return db[_0x8b99('0x5e')]['find']({'where':{'id':_0x2d947c['WhatsappInteractionId']}});}return null;})[_0x8b99('0x21')](handleEntityNotFound(_0x2d3b59,null))[_0x8b99('0x21')](function(_0x21124f){if(_0x21124f){_0x47db94[_0x8b99('0x61')]=_0x21124f[_0x8b99('0x5d')]({'plain':!![]});interaction_log[_0x8b99('0x22')](_0x8b99('0x6d'),_0x210c22[_0x8b99('0x5a')]['id'],_0x210c22[_0x8b99('0x5a')][_0x8b99('0x3e')],_0x210c22[_0x8b99('0x5a')][_0x8b99('0x6e')],_0x47db94['interaction']['id'],_0x210c22[_0x8b99('0x50')]?JSON[_0x8b99('0x27')](_0x210c22[_0x8b99('0x50')]):_0x8b99('0x6f'));return respondWithRpcPromise(_0x8b99('0x70'),'rejectMessage',_0x47db94);}return null;})[_0x8b99('0x21')](function(_0x5ea24d){if(_0x5ea24d){_0x5ea24d['message'][_0x8b99('0x65')]=util[_0x8b99('0x57')](_0x8b99('0x66'),_0x210c22[_0x8b99('0x5a')][_0x8b99('0x3e')]);_0x5ea24d[_0x8b99('0x2a')][_0x8b99('0x67')]=_0x47db94['channel'];_0x5ea24d['message'][_0x8b99('0x68')]=_0x8b99('0x6b');respondWithRpcPromise(_0x8b99('0x69'),_0x8b99('0x69'),{'event':_0x8b99('0x71'),'message':_0x5ea24d[_0x8b99('0x2a')]},client9002);return _0x47db94;}return null;})[_0x8b99('0x21')](respondWithResult(_0x2d3b59,null))[_0x8b99('0x2c')](handleError(_0x2d3b59,null));};exports[_0x8b99('0x2d')]=function(_0x49db8a,_0x256d3b,_0x52cc43){if(_0x49db8a[_0x8b99('0x50')]['id']){delete _0x49db8a['body']['id'];}var _0x5d74f1;return db[_0x8b99('0x39')]['find']({'where':{'id':_0x49db8a['params']['id']}})[_0x8b99('0x21')](handleEntityNotFound(_0x256d3b,null))[_0x8b99('0x21')](function(_0x5871e5){if(_0x5871e5){_0x5d74f1=_0x5871e5;return db[_0x8b99('0x72')]['find']({'where':{'id':_0x5871e5[_0x8b99('0x73')]}});}})[_0x8b99('0x21')](handleEntityNotFound(_0x256d3b,null))[_0x8b99('0x21')](function(_0x4adc46){if(_0x4adc46){logger[_0x8b99('0x25')](_0x8b99('0x74'),_0x8b99('0x2d'),_0x8b99('0x75'),_0x4adc46['type'],util[_0x8b99('0x76')](_0x49db8a[_0x8b99('0x50')],{'showHidden':![],'depth':null}));switch(_0x4adc46['type']){case _0x8b99('0x77'):if(_0x49db8a['body'][_0x8b99('0x78')]&&_0x49db8a[_0x8b99('0x50')][_0x8b99('0x78')]===_0x5d74f1[_0x8b99('0x79')]&&_0x49db8a[_0x8b99('0x50')][_0x8b99('0x7a')]&&_0x49db8a[_0x8b99('0x50')]['MessageStatus']===_0x8b99('0x7b')){return _0x5d74f1[_0x8b99('0x35')]({'read':!![]});}else{logger[_0x8b99('0x28')](_0x8b99('0x7c'),_0x8b99('0x2d'),_0x8b99('0x77'),util[_0x8b99('0x76')](_0x49db8a[_0x8b99('0x50')],{'showHidden':![],'depth':null}));}break;}return _0x5d74f1;}})[_0x8b99('0x21')](respondWithResult(_0x256d3b,null))[_0x8b99('0x2c')](handleError(_0x256d3b,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index e8f94b3..07ac73a 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(_0x54e41c,_0x363e37){var _0x29070d=function(_0x43ab32){while(--_0x43ab32){_0x54e41c['push'](_0x54e41c['shift']());}};_0x29070d(++_0x363e37);}(_0x5f2f,0x73));var _0xf5f2=function(_0x37f330,_0x30ef70){_0x37f330=_0x37f330-0x0;var _0x4fab68=_0x5f2f[_0x37f330];return _0x4fab68;};'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 _0x5f2f=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappMessage','setMaxListeners','save','update'];(function(_0x21b6d6,_0x55c506){var _0xbe9609=function(_0x27f244){while(--_0x27f244){_0x21b6d6['push'](_0x21b6d6['shift']());}};_0xbe9609(++_0x55c506);}(_0x5f2f,0x73));var _0xf5f2=function(_0x416a21,_0x56f6b4){_0x416a21=_0x416a21-0x0;var _0x447b8c=_0x5f2f[_0x416a21];return _0x447b8c;};'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 diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index 6c083b4..e8571e9 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 _0xeb35=['whatsapp:','remote','/api/whatsapp/messages/','/status?token=','token','sid','catch','WhatsappMessage,\x20%s,\x20%s,\x20%s','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./whatsappMessage.attributes','define','whatsapp_messages','messageId','FULLTEXT','models','direction','toLowerCase','out','isNil','UserId','WhatsappInteractionId','update','createdAt','error','secret','WhatsappAccount','find','WhatsappAccountId','then','type','twilio','accountSid','authToken','phone','create','body'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0xeb35,0x183));var _0x5eb3=function(_0x542162,_0x4a0759){_0x542162=_0x542162-0x0;var _0x7a75a9=_0xeb35[_0x542162];return _0x7a75a9;};'use strict';var _=require(_0x5eb3('0x0'));var util=require(_0x5eb3('0x1'));var logger=require(_0x5eb3('0x2'))(_0x5eb3('0x3'));var moment=require(_0x5eb3('0x4'));var BPromise=require('bluebird');var rp=require(_0x5eb3('0x5'));var fs=require('fs');var path=require(_0x5eb3('0x6'));var rimraf=require(_0x5eb3('0x7'));var config=require(_0x5eb3('0x8'));var attributes=require(_0x5eb3('0x9'));module['exports']=function(_0x31dee0,_0x1bd050){return _0x31dee0[_0x5eb3('0xa')]('WhatsappMessage',attributes,{'tableName':_0x5eb3('0xb'),'paranoid':![],'indexes':[{'name':_0x5eb3('0xc'),'fields':[_0x5eb3('0xc')]},{'name':'fti_whatsapp_messages','fields':['body'],'type':_0x5eb3('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x183a31,_0xcdd1ba,_0x527048){var _0x12ceff=_0x31dee0[_0x5eb3('0xe')];var _0xc6e13e=_0x183a31['get']({'plain':!![]});if(_0xc6e13e[_0x5eb3('0xf')][_0x5eb3('0x10')]()==='in'||_0xc6e13e[_0x5eb3('0xf')][_0x5eb3('0x10')]()===_0x5eb3('0x11')&&!_0xc6e13e['secret']&&!_[_0x5eb3('0x12')](_0xc6e13e[_0x5eb3('0x13')])){_0x12ceff['WhatsappInteraction']['findOne']({'where':{'id':_0xc6e13e[_0x5eb3('0x14')]}})['then'](function(_0x31d0bc){if(_0x31d0bc){_0x31d0bc[_0x5eb3('0x15')]({'lastMsgAt':_0xc6e13e[_0x5eb3('0x16')],'lastMsgDirection':_0xc6e13e['direction'][_0x5eb3('0x10')]()});}})['catch'](function(_0x4a72be){console[_0x5eb3('0x17')](_0x4a72be);});}if(_0xc6e13e[_0x5eb3('0xf')]===_0x5eb3('0x11')&&!_0xc6e13e[_0x5eb3('0x18')]){var _0x4843ec;_0x12ceff[_0x5eb3('0x19')][_0x5eb3('0x1a')]({'where':{'id':_0xc6e13e[_0x5eb3('0x1b')]},'raw':!![]})[_0x5eb3('0x1c')](function(_0x3f9d9c){_0x4843ec=_0x3f9d9c;if(_0x4843ec&&_0x4843ec[_0x5eb3('0x1d')]){switch(_0x4843ec[_0x5eb3('0x1d')]){case _0x5eb3('0x1e'):var _0x34c928=require(_0x5eb3('0x1e'));if(_0x4843ec[_0x5eb3('0x1f')]&&_0x4843ec[_0x5eb3('0x20')]&&_0x4843ec[_0x5eb3('0x21')]){var _0x34ee15=new _0x34c928(_0x4843ec[_0x5eb3('0x1f')],_0x4843ec[_0x5eb3('0x20')]);_0x34ee15['messages'][_0x5eb3('0x22')]({'body':_0xc6e13e[_0x5eb3('0x23')],'to':_0x5eb3('0x24')+_0xc6e13e[_0x5eb3('0x21')],'from':_0x5eb3('0x24')+_0x4843ec['phone'],'statusCallback':_0x4843ec[_0x5eb3('0x25')]+_0x5eb3('0x26')+_0xc6e13e['id']+_0x5eb3('0x27')+_0x4843ec[_0x5eb3('0x28')]})[_0x5eb3('0x1c')](function(_0x261c70){if(_0x261c70[_0x5eb3('0x29')]){return _0x183a31[_0x5eb3('0x15')]({'messageId':_0x261c70[_0x5eb3('0x29')]});}})[_0x5eb3('0x2a')](function(_0x342d0c){logger['error'](_0x5eb3('0x2b'),'afterCreate',_0x5eb3('0x1e'),util[_0x5eb3('0x2c')](_0x342d0c,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x5eb3('0x2b'),'afterCreate','twilio',_0x5eb3('0x2d'));}break;}}})['finally'](function(){_0x527048();});}else{_0x527048();}}},'charset':'utf8mb4','collate':_0x5eb3('0x2e')});}; \ No newline at end of file +var _0x37dd=['./whatsappMessage.attributes','exports','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','get','toLowerCase','direction','out','secret','isNil','UserId','WhatsappInteraction','findOne','then','update','createdAt','error','WhatsappAccount','WhatsappAccountId','type','twilio','accountSid','authToken','messages','create','body','whatsapp:','phone','remote','token','sid','catch','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','finally','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x2445cc,_0x53f632){var _0x5d8a74=function(_0x7a19ea){while(--_0x7a19ea){_0x2445cc['push'](_0x2445cc['shift']());}};_0x5d8a74(++_0x53f632);}(_0x37dd,0xe7));var _0xd37d=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x37dd[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0xd37d('0x0'));var util=require(_0xd37d('0x1'));var logger=require(_0xd37d('0x2'))(_0xd37d('0x3'));var moment=require(_0xd37d('0x4'));var BPromise=require(_0xd37d('0x5'));var rp=require(_0xd37d('0x6'));var fs=require('fs');var path=require(_0xd37d('0x7'));var rimraf=require(_0xd37d('0x8'));var config=require('../../config/environment');var attributes=require(_0xd37d('0x9'));module[_0xd37d('0xa')]=function(_0x32d7e4,_0x36e62f){return _0x32d7e4['define'](_0xd37d('0xb'),attributes,{'tableName':_0xd37d('0xc'),'paranoid':![],'indexes':[{'name':_0xd37d('0xd'),'fields':[_0xd37d('0xd')]},{'name':_0xd37d('0xe'),'fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x236ed4,_0xce5b58,_0xf65182){var _0x41b536=_0x32d7e4['models'];var _0x40ffa9=_0x236ed4[_0xd37d('0xf')]({'plain':!![]});if(_0x40ffa9['direction'][_0xd37d('0x10')]()==='in'||_0x40ffa9[_0xd37d('0x11')][_0xd37d('0x10')]()===_0xd37d('0x12')&&!_0x40ffa9[_0xd37d('0x13')]&&!_[_0xd37d('0x14')](_0x40ffa9[_0xd37d('0x15')])){_0x41b536[_0xd37d('0x16')][_0xd37d('0x17')]({'where':{'id':_0x40ffa9['WhatsappInteractionId']}})[_0xd37d('0x18')](function(_0x13a92f){if(_0x13a92f){_0x13a92f[_0xd37d('0x19')]({'lastMsgAt':_0x40ffa9[_0xd37d('0x1a')],'lastMsgDirection':_0x40ffa9['direction'][_0xd37d('0x10')]()});}})['catch'](function(_0x239f28){console[_0xd37d('0x1b')](_0x239f28);});}if(_0x40ffa9[_0xd37d('0x11')]===_0xd37d('0x12')&&!_0x40ffa9['secret']){var _0x18a5b9;_0x41b536[_0xd37d('0x1c')]['find']({'where':{'id':_0x40ffa9[_0xd37d('0x1d')]},'raw':!![]})[_0xd37d('0x18')](function(_0x3f3ad3){_0x18a5b9=_0x3f3ad3;if(_0x18a5b9&&_0x18a5b9[_0xd37d('0x1e')]){switch(_0x18a5b9[_0xd37d('0x1e')]){case _0xd37d('0x1f'):var _0x3167a9=require(_0xd37d('0x1f'));if(_0x18a5b9[_0xd37d('0x20')]&&_0x18a5b9[_0xd37d('0x21')]&&_0x18a5b9['phone']){var _0x34344d=new _0x3167a9(_0x18a5b9[_0xd37d('0x20')],_0x18a5b9[_0xd37d('0x21')]);_0x34344d[_0xd37d('0x22')][_0xd37d('0x23')]({'body':_0x40ffa9[_0xd37d('0x24')],'to':_0xd37d('0x25')+_0x40ffa9[_0xd37d('0x26')],'from':_0xd37d('0x25')+_0x18a5b9[_0xd37d('0x26')],'statusCallback':_0x18a5b9[_0xd37d('0x27')]+'/api/whatsapp/messages/'+_0x40ffa9['id']+'/status?token='+_0x18a5b9[_0xd37d('0x28')]})[_0xd37d('0x18')](function(_0x2e6fa2){if(_0x2e6fa2[_0xd37d('0x29')]){return _0x236ed4['update']({'messageId':_0x2e6fa2[_0xd37d('0x29')]});}})[_0xd37d('0x2a')](function(_0x51c6b6){logger[_0xd37d('0x1b')](_0xd37d('0x2b'),_0xd37d('0x2c'),_0xd37d('0x1f'),util['inspect'](_0x51c6b6,{'showHidden':![],'depth':null}));});}else{logger['error']('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0xd37d('0x2c'),_0xd37d('0x1f'),_0xd37d('0x2d'));}break;}}})[_0xd37d('0x2e')](function(){_0xf65182();});}else{_0xf65182();}}},'charset':_0xd37d('0x2f'),'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 36c0bd2..cc65ab0 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 _0x0609=['info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','WhatsappMessage','body','options','raw','CreateWhatsappMessage','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','redis','defaults','then'];(function(_0x346deb,_0x50a6af){var _0x4ba4df=function(_0x2dd7bf){while(--_0x2dd7bf){_0x346deb['push'](_0x346deb['shift']());}};_0x4ba4df(++_0x50a6af);}(_0x0609,0x17b));var _0x9060=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0x0609[_0xb0f7c3];return _0x28ea68;};'use strict';var _=require(_0x9060('0x0'));var util=require(_0x9060('0x1'));var moment=require('moment');var BPromise=require(_0x9060('0x2'));var rs=require(_0x9060('0x3'));var fs=require('fs');var Redis=require(_0x9060('0x4'));var db=require(_0x9060('0x5'))['db'];var utils=require(_0x9060('0x6'));var logger=require(_0x9060('0x7'))(_0x9060('0x8'));var config=require(_0x9060('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x9060('0xa')]=_[_0x9060('0xb')](config[_0x9060('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./whatsappMessage.socket')['register'](socket);function respondWithRpcPromise(_0x24338c,_0x144fd3,_0x26d79c){return new BPromise(function(_0x85d779,_0x45465c){return client['request'](_0x24338c,_0x26d79c)[_0x9060('0xc')](function(_0x26faf){logger[_0x9060('0xd')](_0x9060('0xe'),_0x144fd3,_0x9060('0xf'));logger[_0x9060('0x10')](_0x9060('0x11'),_0x144fd3,_0x9060('0xf'),JSON[_0x9060('0x12')](_0x26faf));if(_0x26faf[_0x9060('0x13')]){if(_0x26faf[_0x9060('0x13')][_0x9060('0x14')]===0x1f4){logger[_0x9060('0x13')](_0x9060('0xe'),_0x144fd3,_0x26faf[_0x9060('0x13')]['message']);return _0x45465c(_0x26faf[_0x9060('0x13')]['message']);}logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x144fd3,_0x26faf[_0x9060('0x13')][_0x9060('0x15')]);return _0x85d779(_0x26faf[_0x9060('0x13')][_0x9060('0x15')]);}else{logger[_0x9060('0xd')]('WhatsappMessage,\x20%s,\x20%s',_0x144fd3,_0x9060('0xf'));_0x85d779(_0x26faf['result'][_0x9060('0x15')]);}})[_0x9060('0x16')](function(_0x25c5ab){logger[_0x9060('0x13')]('WhatsappMessage,\x20%s,\x20%s',_0x144fd3,_0x25c5ab);_0x45465c(_0x25c5ab);});});}exports['CreateWhatsappMessage']=function(_0x1347ba){var _0x5964b9=this;return new Promise(function(_0x2a90ef,_0x3e2493){return db[_0x9060('0x17')]['create'](_0x1347ba[_0x9060('0x18')],{'raw':_0x1347ba[_0x9060('0x19')]?_0x1347ba['options'][_0x9060('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x12f399){logger['info'](_0x9060('0x1b'),_0x1347ba);logger[_0x9060('0x10')](_0x9060('0x1b'),_0x1347ba,JSON[_0x9060('0x12')](_0x12f399));_0x2a90ef(_0x12f399);})[_0x9060('0x16')](function(_0x30009e){logger[_0x9060('0x13')](_0x9060('0x1b'),_0x30009e['message'],_0x1347ba);_0x3e2493(_0x5964b9[_0x9060('0x13')](0x1f4,_0x30009e['message']));});});}; \ No newline at end of file +var _0x85c3=['socket.io-emitter','./whatsappMessage.socket','register','request','then','WhatsappMessage,\x20%s,\x20%s','WhatsappMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','CreateWhatsappMessage','WhatsappMessage','create','body','options','raw','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost'];(function(_0x585bb7,_0xa4d23e){var _0x5d65b4=function(_0x3faa6e){while(--_0x3faa6e){_0x585bb7['push'](_0x585bb7['shift']());}};_0x5d65b4(++_0xa4d23e);}(_0x85c3,0xaa));var _0x385c=function(_0x640e40,_0x3dd7d2){_0x640e40=_0x640e40-0x0;var _0x37f7b1=_0x85c3[_0x640e40];return _0x37f7b1;};'use strict';var _=require(_0x385c('0x0'));var util=require(_0x385c('0x1'));var moment=require(_0x385c('0x2'));var BPromise=require(_0x385c('0x3'));var rs=require(_0x385c('0x4'));var fs=require('fs');var Redis=require(_0x385c('0x5'));var db=require(_0x385c('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x385c('0x7'))(_0x385c('0x8'));var config=require(_0x385c('0x9'));var jayson=require(_0x385c('0xa'));var client=jayson[_0x385c('0xb')][_0x385c('0xc')]({'port':0x232a});config[_0x385c('0xd')]=_['defaults'](config[_0x385c('0xd')],{'host':_0x385c('0xe'),'port':0x18eb});var socket=require(_0x385c('0xf'))(new Redis(config[_0x385c('0xd')]));require(_0x385c('0x10'))[_0x385c('0x11')](socket);function respondWithRpcPromise(_0x278f69,_0x2e39e8,_0x40165a){return new BPromise(function(_0x16b5fb,_0x3d7712){return client[_0x385c('0x12')](_0x278f69,_0x40165a)[_0x385c('0x13')](function(_0xb0f20f){logger['info'](_0x385c('0x14'),_0x2e39e8,'request\x20sent');logger['debug'](_0x385c('0x15'),_0x2e39e8,_0x385c('0x16'),JSON[_0x385c('0x17')](_0xb0f20f));if(_0xb0f20f[_0x385c('0x18')]){if(_0xb0f20f['error'][_0x385c('0x19')]===0x1f4){logger[_0x385c('0x18')](_0x385c('0x14'),_0x2e39e8,_0xb0f20f['error']['message']);return _0x3d7712(_0xb0f20f['error'][_0x385c('0x1a')]);}logger[_0x385c('0x18')](_0x385c('0x14'),_0x2e39e8,_0xb0f20f[_0x385c('0x18')]['message']);return _0x16b5fb(_0xb0f20f[_0x385c('0x18')]['message']);}else{logger[_0x385c('0x1b')](_0x385c('0x14'),_0x2e39e8,_0x385c('0x16'));_0x16b5fb(_0xb0f20f[_0x385c('0x1c')][_0x385c('0x1a')]);}})[_0x385c('0x1d')](function(_0x388183){logger['error'](_0x385c('0x14'),_0x2e39e8,_0x388183);_0x3d7712(_0x388183);});});}exports[_0x385c('0x1e')]=function(_0x2d7d22){var _0x4062b4=this;return new Promise(function(_0x159458,_0x5aa836){return db[_0x385c('0x1f')][_0x385c('0x20')](_0x2d7d22[_0x385c('0x21')],{'raw':_0x2d7d22[_0x385c('0x22')]?_0x2d7d22['options'][_0x385c('0x23')]===undefined?!![]:![]:!![]})[_0x385c('0x13')](function(_0x125837){logger[_0x385c('0x1b')]('CreateWhatsappMessage',_0x2d7d22);logger[_0x385c('0x24')](_0x385c('0x1e'),_0x2d7d22,JSON[_0x385c('0x17')](_0x125837));_0x159458(_0x125837);})[_0x385c('0x1d')](function(_0x5d11c6){logger['error'](_0x385c('0x1e'),_0x5d11c6[_0x385c('0x1a')],_0x2d7d22);_0x5aa836(_0x4062b4['error'](0x1f4,_0x5d11c6[_0x385c('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 309de9e..9f3ef0d 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 _0xa5df=['remove','update','removeListener','register','./whatsappMessage.events','save'];(function(_0x2e3ef8,_0x4b8e7c){var _0x28c273=function(_0x29a40a){while(--_0x29a40a){_0x2e3ef8['push'](_0x2e3ef8['shift']());}};_0x28c273(++_0x4b8e7c);}(_0xa5df,0x190));var _0xfa5d=function(_0x5e3b9e,_0x18b3ba){_0x5e3b9e=_0x5e3b9e-0x0;var _0x4726ff=_0xa5df[_0x5e3b9e];return _0x4726ff;};'use strict';var WhatsappMessageEvents=require(_0xfa5d('0x0'));var events=[_0xfa5d('0x1'),_0xfa5d('0x2'),_0xfa5d('0x3')];function createListener(_0x27ffb3,_0x3f52ac){return function(_0x277c62){_0x3f52ac['emit'](_0x27ffb3,_0x277c62);};}function removeListener(_0x36206a,_0x470b5d){return function(){WhatsappMessageEvents[_0xfa5d('0x4')](_0x36206a,_0x470b5d);};}exports[_0xfa5d('0x5')]=function(_0x331859){for(var _0x1c2214=0x0,_0x286da5=events['length'];_0x1c2214<_0x286da5;_0x1c2214++){var _0x51bbe4=events[_0x1c2214];var _0x3663eb=createListener('whatsappMessage:'+_0x51bbe4,_0x331859);WhatsappMessageEvents['on'](_0x51bbe4,_0x3663eb);}}; \ No newline at end of file +var _0x7217=['whatsappMessage:','./whatsappMessage.events','remove','update','removeListener','register','length'];(function(_0x4552ea,_0x5c6323){var _0x45499a=function(_0x174340){while(--_0x174340){_0x4552ea['push'](_0x4552ea['shift']());}};_0x45499a(++_0x5c6323);}(_0x7217,0x19e));var _0x7721=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0x7217[_0x34bc30];return _0x5706de;};'use strict';var WhatsappMessageEvents=require(_0x7721('0x0'));var events=['save',_0x7721('0x1'),_0x7721('0x2')];function createListener(_0x1de988,_0x2a78d8){return function(_0x115ab3){_0x2a78d8['emit'](_0x1de988,_0x115ab3);};}function removeListener(_0x5bf160,_0x472a96){return function(){WhatsappMessageEvents[_0x7721('0x3')](_0x5bf160,_0x472a96);};}exports[_0x7721('0x4')]=function(_0x3fe47c){for(var _0xb239e0=0x0,_0xf7ff37=events[_0x7721('0x5')];_0xb239e0<_0xf7ff37;_0xb239e0++){var _0x21f680=events[_0xb239e0];var _0x225610=createListener(_0x7721('0x6')+_0x21f680,_0x3fe47c);WhatsappMessageEvents['on'](_0x21f680,_0x225610);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 2ae4875..a373910 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 _0xa806=['delete','destroy','removeAgents','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','post','create','addAgents','put'];(function(_0x67f95e,_0x3ca797){var _0x538f5a=function(_0xc919e9){while(--_0xc919e9){_0x67f95e['push'](_0x67f95e['shift']());}};_0x538f5a(++_0x3ca797);}(_0xa806,0x1f2));var _0x6a80=function(_0x156584,_0x211fde){_0x156584=_0x156584-0x0;var _0x3416b1=_0xa806[_0x156584];return _0x3416b1;};'use strict';var multer=require(_0x6a80('0x0'));var util=require('util');var path=require(_0x6a80('0x1'));var timeout=require(_0x6a80('0x2'));var express=require(_0x6a80('0x3'));var router=express[_0x6a80('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x6a80('0x5'));var config=require(_0x6a80('0x6'));var controller=require(_0x6a80('0x7'));router[_0x6a80('0x8')]('/',auth[_0x6a80('0x9')](),controller['index']);router[_0x6a80('0x8')](_0x6a80('0xa'),auth['isAuthenticated'](),controller[_0x6a80('0xb')]);router[_0x6a80('0x8')](_0x6a80('0xc'),auth[_0x6a80('0x9')](),controller[_0x6a80('0xd')]);router[_0x6a80('0x8')](_0x6a80('0xe'),auth['isAuthenticated'](),controller['getMembers']);router[_0x6a80('0x8')](_0x6a80('0xf'),auth[_0x6a80('0x9')](),controller[_0x6a80('0x10')]);router[_0x6a80('0x8')](_0x6a80('0x11'),auth['isAuthenticated'](),controller['getAgents']);router[_0x6a80('0x12')]('/',auth[_0x6a80('0x9')](),controller[_0x6a80('0x13')]);router[_0x6a80('0x12')](_0x6a80('0xf'),auth[_0x6a80('0x9')](),controller['addTeams']);router[_0x6a80('0x12')]('/:id/users',auth[_0x6a80('0x9')](),controller[_0x6a80('0x14')]);router[_0x6a80('0x15')]('/:id',auth[_0x6a80('0x9')](),controller['update']);router[_0x6a80('0x16')](_0x6a80('0xc'),auth['isAuthenticated'](),controller[_0x6a80('0x17')]);router[_0x6a80('0x16')](_0x6a80('0xf'),auth[_0x6a80('0x9')](),controller['removeTeams']);router[_0x6a80('0x16')](_0x6a80('0x11'),auth[_0x6a80('0x9')](),controller[_0x6a80('0x18')]);module[_0x6a80('0x19')]=router; \ No newline at end of file +var _0x2f6a=['isAuthenticated','index','/describe','describe','get','/:id','show','/:id/users','getAgents','post','create','addAgents','put','delete','destroy','removeTeams','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','./whatsappQueue.controller'];(function(_0x3cb9f7,_0x12f280){var _0x172b2b=function(_0x277a36){while(--_0x277a36){_0x3cb9f7['push'](_0x3cb9f7['shift']());}};_0x172b2b(++_0x12f280);}(_0x2f6a,0x179));var _0xa2f6=function(_0x3ba1ab,_0x4e95a9){_0x3ba1ab=_0x3ba1ab-0x0;var _0x2222bf=_0x2f6a[_0x3ba1ab];return _0x2222bf;};'use strict';var multer=require(_0xa2f6('0x0'));var util=require(_0xa2f6('0x1'));var path=require('path');var timeout=require(_0xa2f6('0x2'));var express=require(_0xa2f6('0x3'));var router=express[_0xa2f6('0x4')]();var auth=require(_0xa2f6('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa2f6('0x6'));router['get']('/',auth[_0xa2f6('0x7')](),controller[_0xa2f6('0x8')]);router['get'](_0xa2f6('0x9'),auth['isAuthenticated'](),controller[_0xa2f6('0xa')]);router[_0xa2f6('0xb')](_0xa2f6('0xc'),auth[_0xa2f6('0x7')](),controller[_0xa2f6('0xd')]);router[_0xa2f6('0xb')]('/:id/members',auth['isAuthenticated'](),controller['getMembers']);router[_0xa2f6('0xb')]('/:id/teams',auth[_0xa2f6('0x7')](),controller['getTeams']);router['get'](_0xa2f6('0xe'),auth['isAuthenticated'](),controller[_0xa2f6('0xf')]);router[_0xa2f6('0x10')]('/',auth[_0xa2f6('0x7')](),controller[_0xa2f6('0x11')]);router[_0xa2f6('0x10')]('/:id/teams',auth[_0xa2f6('0x7')](),controller['addTeams']);router[_0xa2f6('0x10')](_0xa2f6('0xe'),auth['isAuthenticated'](),controller[_0xa2f6('0x12')]);router[_0xa2f6('0x13')](_0xa2f6('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xa2f6('0x14')](_0xa2f6('0xc'),auth[_0xa2f6('0x7')](),controller[_0xa2f6('0x15')]);router[_0xa2f6('0x14')]('/:id/teams',auth[_0xa2f6('0x7')](),controller[_0xa2f6('0x16')]);router[_0xa2f6('0x14')](_0xa2f6('0xe'),auth[_0xa2f6('0x7')](),controller['removeAgents']);module[_0xa2f6('0x17')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index 7717936..78f5a3f 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 _0x64a5=['roundrobin','STRING','exports','name','INTEGER','beepall'];(function(_0x2d3df2,_0x2f9498){var _0x347bda=function(_0x55a196){while(--_0x55a196){_0x2d3df2['push'](_0x2d3df2['shift']());}};_0x347bda(++_0x2f9498);}(_0x64a5,0x80));var _0x564a=function(_0x11fc92,_0x4b1a76){_0x11fc92=_0x11fc92-0x0;var _0xc7373f=_0x64a5[_0x11fc92];return _0xc7373f;};'use strict';var Sequelize=require('sequelize');module[_0x564a('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x564a('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x564a('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory',_0x564a('0x3'),_0x564a('0x4'))},'description':{'type':Sequelize[_0x564a('0x5')]}}; \ No newline at end of file +var _0x675e=['beepall','roundrobin','STRING','exports','name','INTEGER','ENUM','rrmemory'];(function(_0x45c262,_0x2e3ce5){var _0x4f2ba6=function(_0x4912d1){while(--_0x4912d1){_0x45c262['push'](_0x45c262['shift']());}};_0x4f2ba6(++_0x2e3ce5);}(_0x675e,0x10b));var _0xe675=function(_0x57dc85,_0x3a6d51){_0x57dc85=_0x57dc85-0x0;var _0x563a2e=_0x675e[_0x57dc85];return _0x563a2e;};'use strict';var Sequelize=require('sequelize');module[_0xe675('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0xe675('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0xe675('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xe675('0x3')](_0xe675('0x4'),_0xe675('0x5'),_0xe675('0x6'))},'description':{'type':Sequelize[_0xe675('0x7')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 7fb9993..e780566 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 _0x19e7=['show','params','rawAttributes','keys','fields','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','catch','describe','getMembers','findOne','UserWhatsappQueue','limit','WhatsappQueueId','findAll','User','findAndCountAll','UserId','whatsappPause','%s/%s','SIP','createdAt','getTeams','addTeams','ids','Team','Agents','online','voicePause','interface','flatMap','transaction','each','forEach','emit','userWhatsappQueue:save','select','tq.TeamId','from','team_has_whatsapp_queues','join','user_has_teams','clone','ut.UserId\x20=\x20?','push','toString','every','TeamId','includes','all','compact','sequelize','isEmpty','removeAgents','userWhatsappQueue:remove','addAgents','omit','isArray','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','redis','./whatsappQueue.socket','register','sendStatus','end','status','count','offset','set','Content-Range','json','reject','update','destroy','then','get','WhatsappQueues','UserProfileResource','error','stack','name','send','map','WhatsappQueue','fieldName','type','model','query','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','rows'];(function(_0x116496,_0x285005){var _0x3ebb4b=function(_0x328937){while(--_0x328937){_0x116496['push'](_0x116496['shift']());}};_0x3ebb4b(++_0x285005);}(_0x19e7,0xc8));var _0x719e=function(_0x4d99c1,_0x18f8f4){_0x4d99c1=_0x4d99c1-0x0;var _0x339457=_0x19e7[_0x4d99c1];return _0x339457;};'use strict';var pdf=require(_0x719e('0x0'));var emlformat=require(_0x719e('0x1'));var rimraf=require(_0x719e('0x2'));var zipdir=require(_0x719e('0x3'));var jsonpatch=require(_0x719e('0x4'));var rp=require(_0x719e('0x5'));var moment=require(_0x719e('0x6'));var BPromise=require(_0x719e('0x7'));var Mustache=require(_0x719e('0x8'));var util=require(_0x719e('0x9'));var path=require(_0x719e('0xa'));var sox=require(_0x719e('0xb'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x719e('0xc'));var squel=require(_0x719e('0xd'));var crypto=require('crypto');var jsforce=require(_0x719e('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x719e('0xf'));var querystring=require(_0x719e('0x10'));var Papa=require(_0x719e('0x11'));var Redis=require(_0x719e('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x719e('0x13'));var as=require(_0x719e('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x719e('0x15'));var utils=require(_0x719e('0x16'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0x719e('0x17')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x719e('0x17')]));require(_0x719e('0x18'))[_0x719e('0x19')](socket);function respondWithStatusCode(_0x229531,_0x2cc32b){_0x2cc32b=_0x2cc32b||0xcc;return function(_0x57b30a){if(_0x57b30a){return _0x229531[_0x719e('0x1a')](_0x2cc32b);}return _0x229531['status'](_0x2cc32b)[_0x719e('0x1b')]();};}function respondWithResult(_0x1d2180,_0x241f11){_0x241f11=_0x241f11||0xc8;return function(_0x5908ca){if(_0x5908ca){return _0x1d2180[_0x719e('0x1c')](_0x241f11)['json'](_0x5908ca);}};}function respondWithFilteredResult(_0x4d0b4c,_0x5d3c72){return function(_0x57f802){if(_0x57f802){var _0x2b3b8b=_0x57f802[_0x719e('0x1d')],_0x49541a=_0x5d3c72[_0x719e('0x1e')],_0x15cf54=_0x5d3c72['offset']+_0x5d3c72['limit'],_0xdf71bc;if(_0x15cf54>=_0x2b3b8b){_0x15cf54=_0x2b3b8b;_0xdf71bc=0xc8;}else{_0xdf71bc=0xce;}_0x4d0b4c['status'](_0xdf71bc);return _0x4d0b4c[_0x719e('0x1f')](_0x719e('0x20'),_0x49541a+'-'+_0x15cf54+'/'+_0x2b3b8b)[_0x719e('0x21')](_0x57f802);}return null;};}function patchUpdates(_0x3e47ec){return function(_0x118cb2){try{jsonpatch['apply'](_0x118cb2,_0x3e47ec,!![]);}catch(_0x26984a){return BPromise[_0x719e('0x22')](_0x26984a);}return _0x118cb2['save']();};}function saveUpdates(_0x3b99da,_0x57721a){return function(_0x41ebe4){if(_0x41ebe4){return _0x41ebe4[_0x719e('0x23')](_0x3b99da)['then'](function(_0x43c81){return _0x43c81;});}return null;};}function removeEntity(_0x32e5a5,_0x14e175){return function(_0x24408a){if(_0x24408a){return _0x24408a[_0x719e('0x24')]()[_0x719e('0x25')](function(){var _0x4c4ae2=_0x24408a[_0x719e('0x26')]({'plain':!![]});var _0x43cd78=_0x719e('0x27');return db[_0x719e('0x28')][_0x719e('0x24')]({'where':{'type':_0x43cd78,'resourceId':_0x4c4ae2['id']}})[_0x719e('0x25')](function(){return _0x24408a;});})['then'](function(){_0x32e5a5['status'](0xcc)[_0x719e('0x1b')]();});}};}function handleEntityNotFound(_0x5ae34a,_0x58a5d8){return function(_0x58aecf){if(!_0x58aecf){_0x5ae34a[_0x719e('0x1a')](0x194);}return _0x58aecf;};}function handleError(_0x5594ce,_0x10165a){_0x10165a=_0x10165a||0x1f4;return function(_0x16f7aa){logger[_0x719e('0x29')](_0x16f7aa[_0x719e('0x2a')]);if(_0x16f7aa['name']){delete _0x16f7aa[_0x719e('0x2b')];}_0x5594ce[_0x719e('0x1c')](_0x10165a)[_0x719e('0x2c')](_0x16f7aa);};}exports['index']=function(_0x1ca18f,_0x2532f8){var _0x208f61={},_0x2d4ef1={},_0x5ddb47={'count':0x0,'rows':[]};var _0x509b74=_[_0x719e('0x2d')](db[_0x719e('0x2e')]['rawAttributes'],function(_0x449458){return{'name':_0x449458[_0x719e('0x2f')],'type':_0x449458[_0x719e('0x30')]['key']};});_0x2d4ef1[_0x719e('0x31')]=_['map'](_0x509b74,_0x719e('0x2b'));_0x2d4ef1[_0x719e('0x32')]=_['keys'](_0x1ca18f['query']);_0x2d4ef1[_0x719e('0x33')]=_[_0x719e('0x34')](_0x2d4ef1['model'],_0x2d4ef1['query']);_0x208f61['attributes']=_[_0x719e('0x34')](_0x2d4ef1[_0x719e('0x31')],qs['fields'](_0x1ca18f[_0x719e('0x32')]['fields']));_0x208f61[_0x719e('0x35')]=_0x208f61[_0x719e('0x35')]['length']?_0x208f61[_0x719e('0x35')]:_0x2d4ef1[_0x719e('0x31')];if(!_0x1ca18f[_0x719e('0x32')][_0x719e('0x36')](_0x719e('0x37'))){_0x208f61['limit']=qs['limit'](_0x1ca18f[_0x719e('0x32')]['limit']);_0x208f61[_0x719e('0x1e')]=qs[_0x719e('0x1e')](_0x1ca18f[_0x719e('0x32')]['offset']);}_0x208f61[_0x719e('0x38')]=qs[_0x719e('0x39')](_0x1ca18f[_0x719e('0x32')][_0x719e('0x39')]);_0x208f61[_0x719e('0x3a')]=qs['filters'](_[_0x719e('0x3b')](_0x1ca18f[_0x719e('0x32')],_0x2d4ef1[_0x719e('0x33')]),_0x509b74);if(_0x1ca18f['query'][_0x719e('0x3c')]){_0x208f61[_0x719e('0x3a')]=_[_0x719e('0x3d')](_0x208f61[_0x719e('0x3a')],{'$or':_[_0x719e('0x2d')](_0x509b74,function(_0x4ae496){if(_0x4ae496['type']!=='VIRTUAL'){var _0x518bbd={};_0x518bbd[_0x4ae496[_0x719e('0x2b')]]={'$like':'%'+_0x1ca18f[_0x719e('0x32')]['filter']+'%'};return _0x518bbd;}})});}_0x208f61=_[_0x719e('0x3d')]({},_0x208f61,_0x1ca18f[_0x719e('0x3e')]);var _0x17deb4={'where':_0x208f61['where']};return db[_0x719e('0x2e')][_0x719e('0x1d')](_0x17deb4)[_0x719e('0x25')](function(_0x555893){_0x5ddb47['count']=_0x555893;if(_0x1ca18f[_0x719e('0x32')][_0x719e('0x3f')]){_0x208f61[_0x719e('0x40')]=[{'all':!![]}];}return db[_0x719e('0x2e')]['findAll'](_0x208f61);})['then'](function(_0x8085ad){_0x5ddb47[_0x719e('0x41')]=_0x8085ad;return _0x5ddb47;})['then'](respondWithFilteredResult(_0x2532f8,_0x208f61))['catch'](handleError(_0x2532f8,null));};exports[_0x719e('0x42')]=function(_0x4ed61c,_0x468479){var _0x52e5b2={'raw':!![],'where':{'id':_0x4ed61c[_0x719e('0x43')]['id']}},_0x4d5c84={};_0x4d5c84[_0x719e('0x31')]=_['keys'](db[_0x719e('0x2e')][_0x719e('0x44')]);_0x4d5c84[_0x719e('0x32')]=_[_0x719e('0x45')](_0x4ed61c['query']);_0x4d5c84['filters']=_[_0x719e('0x34')](_0x4d5c84['model'],_0x4d5c84[_0x719e('0x32')]);_0x52e5b2[_0x719e('0x35')]=_[_0x719e('0x34')](_0x4d5c84[_0x719e('0x31')],qs[_0x719e('0x46')](_0x4ed61c[_0x719e('0x32')][_0x719e('0x46')]));_0x52e5b2[_0x719e('0x35')]=_0x52e5b2['attributes'][_0x719e('0x47')]?_0x52e5b2[_0x719e('0x35')]:_0x4d5c84['model'];if(_0x4ed61c[_0x719e('0x32')][_0x719e('0x3f')]){_0x52e5b2[_0x719e('0x40')]=[{'all':!![]}];}_0x52e5b2=_[_0x719e('0x3d')]({},_0x52e5b2,_0x4ed61c['options']);return db['WhatsappQueue'][_0x719e('0x48')](_0x52e5b2)[_0x719e('0x25')](handleEntityNotFound(_0x468479,null))[_0x719e('0x25')](respondWithResult(_0x468479,null))['catch'](handleError(_0x468479,null));};exports[_0x719e('0x49')]=function(_0x4af30d,_0x335af6){return db[_0x719e('0x2e')][_0x719e('0x49')](_0x4af30d[_0x719e('0x4a')],{})[_0x719e('0x25')](function(_0x3f2f6c){var _0x39cab9=_0x4af30d[_0x719e('0x4b')]['get']({'plain':!![]});if(!_0x39cab9)throw new Error(_0x719e('0x4c'));if(_0x39cab9[_0x719e('0x4d')]==='user'){var _0x6edecc=_0x3f2f6c['get']({'plain':!![]});var _0x45846c=_0x719e('0x27');return db[_0x719e('0x4e')][_0x719e('0x48')]({'where':{'name':_0x45846c,'userProfileId':_0x39cab9[_0x719e('0x4f')]},'raw':!![]})[_0x719e('0x25')](function(_0x392c0d){if(_0x392c0d&&_0x392c0d[_0x719e('0x50')]===0x0){return db[_0x719e('0x28')][_0x719e('0x49')]({'name':_0x6edecc[_0x719e('0x2b')],'resourceId':_0x6edecc['id'],'type':_0x392c0d[_0x719e('0x2b')],'sectionId':_0x392c0d['id']},{})[_0x719e('0x25')](function(){return _0x3f2f6c;});}else{return _0x3f2f6c;}})[_0x719e('0x51')](function(_0x32d954){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x32d954);throw _0x32d954;});}return _0x3f2f6c;})[_0x719e('0x25')](respondWithResult(_0x335af6,0xc9))['catch'](handleError(_0x335af6,null));};exports['update']=function(_0x33506d,_0x52f59d){if(_0x33506d[_0x719e('0x4a')]['id']){delete _0x33506d['body']['id'];}return db[_0x719e('0x2e')][_0x719e('0x48')]({'where':{'id':_0x33506d['params']['id']}})[_0x719e('0x25')](handleEntityNotFound(_0x52f59d,null))[_0x719e('0x25')](saveUpdates(_0x33506d[_0x719e('0x4a')],null))['then'](respondWithResult(_0x52f59d,null))[_0x719e('0x51')](handleError(_0x52f59d,null));};exports[_0x719e('0x24')]=function(_0x5eb4a5,_0x23143e){return db[_0x719e('0x2e')][_0x719e('0x48')]({'where':{'id':_0x5eb4a5['params']['id']}})[_0x719e('0x25')](handleEntityNotFound(_0x23143e,null))[_0x719e('0x25')](removeEntity(_0x23143e,null))[_0x719e('0x51')](handleError(_0x23143e,null));};exports[_0x719e('0x52')]=function(_0x3575ea,_0x404d85){return db['WhatsappQueue'][_0x719e('0x52')]()[_0x719e('0x25')](respondWithResult(_0x404d85,null))[_0x719e('0x51')](handleError(_0x404d85,null));};exports[_0x719e('0x53')]=function(_0xa39162,_0xdd0c16,_0x4e5c62){var _0x3ceb41={'raw':!![],'where':{}},_0x3a3987={},_0xc4ff88;return db[_0x719e('0x2e')][_0x719e('0x54')]({'where':{'id':_0xa39162[_0x719e('0x43')]['id']}})[_0x719e('0x25')](handleEntityNotFound(_0xdd0c16,null))[_0x719e('0x25')](function(_0x1e9e5d){if(_0x1e9e5d){_0xc4ff88=_0x1e9e5d[_0x719e('0x26')]({'plain':!![]});_0x3a3987[_0x719e('0x31')]=_[_0x719e('0x45')](db[_0x719e('0x55')][_0x719e('0x44')]);_0x3a3987[_0x719e('0x32')]=_[_0x719e('0x45')](_0xa39162[_0x719e('0x32')]);_0x3a3987[_0x719e('0x33')]=_[_0x719e('0x34')](_0x3a3987[_0x719e('0x31')],_0x3a3987[_0x719e('0x32')]);_0x3ceb41[_0x719e('0x35')]=_['intersection'](_0x3a3987['model'],qs[_0x719e('0x46')](_0xa39162[_0x719e('0x32')][_0x719e('0x46')]));_0x3ceb41[_0x719e('0x35')]=_0x3ceb41[_0x719e('0x35')][_0x719e('0x47')]?_0x3ceb41['attributes']:_0x3a3987[_0x719e('0x31')];if(!_0xa39162[_0x719e('0x32')][_0x719e('0x36')](_0x719e('0x37'))){_0x3ceb41[_0x719e('0x56')]=qs[_0x719e('0x56')](_0xa39162[_0x719e('0x32')][_0x719e('0x56')]);_0x3ceb41[_0x719e('0x1e')]=qs['offset'](_0xa39162[_0x719e('0x32')][_0x719e('0x1e')]);}_0x3ceb41['order']=qs[_0x719e('0x39')](_0xa39162[_0x719e('0x32')][_0x719e('0x39')]);_0x3ceb41[_0x719e('0x3a')]=qs[_0x719e('0x33')](_[_0x719e('0x3b')](_0xa39162[_0x719e('0x32')],_0x3a3987['filters']));_0x3ceb41['where'][_0x719e('0x57')]=_0x1e9e5d['id'];if(_0xa39162[_0x719e('0x32')][_0x719e('0x3c')]){_0x3ceb41[_0x719e('0x3a')]=_['merge'](_0x3ceb41[_0x719e('0x3a')],{'$or':_[_0x719e('0x2d')](_0x3ceb41[_0x719e('0x35')],function(_0x587291){var _0x3dd137={};_0x3dd137[_0x587291]={'$like':'%'+_0xa39162[_0x719e('0x32')][_0x719e('0x3c')]+'%'};return _0x3dd137;})});}_0x3ceb41=_['merge']({},_0x3ceb41,_0xa39162['options']);return db[_0x719e('0x55')][_0x719e('0x58')](_0x3ceb41);}})[_0x719e('0x25')](function(_0x3157c9){if(_0x3157c9){return db[_0x719e('0x59')][_0x719e('0x5a')]({'where':{'id':_[_0x719e('0x2d')](_0x3157c9,_0x719e('0x5b')),'role':'agent'},'attributes':['id','name',_0x719e('0x5c'),'updatedAt','createdAt']});}})[_0x719e('0x25')](function(_0x19b594){if(_0x19b594){return{'count':_0x19b594[_0x719e('0x1d')],'rows':_[_0x719e('0x2d')](_0x19b594[_0x719e('0x41')],function(_0x45eb4b){return{'membername':_0x45eb4b['name'],'UserId':_0x45eb4b['id'],'queue_name':_0xc4ff88[_0x719e('0x2b')],'WhatsappQueueId':_0xc4ff88['id'],'interface':util['format'](_0x719e('0x5d'),_0x719e('0x5e'),_0x45eb4b[_0x719e('0x2b')]),'penalty':0x0,'paused':_0x45eb4b[_0x719e('0x5c')],'createdAt':_0x45eb4b[_0x719e('0x5f')],'updatedAt':_0x45eb4b['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x719e('0x25')](respondWithFilteredResult(_0xdd0c16,_0x3ceb41))['catch'](handleError(_0xdd0c16,null));};exports[_0x719e('0x60')]=function(_0x2c392d,_0x422686,_0x2f69ed){var _0x3e9271={};var _0x50e1c4={};var _0x2b3a47;var _0x4e8424;return db['WhatsappQueue'][_0x719e('0x54')]({'where':{'id':_0x2c392d[_0x719e('0x43')]['id']}})['then'](handleEntityNotFound(_0x422686,null))[_0x719e('0x25')](function(_0x5e7c26){if(_0x5e7c26){_0x2b3a47=_0x5e7c26;_0x50e1c4[_0x719e('0x31')]=_[_0x719e('0x45')](db['Team'][_0x719e('0x44')]);_0x50e1c4['query']=_[_0x719e('0x45')](_0x2c392d[_0x719e('0x32')]);_0x50e1c4[_0x719e('0x33')]=_[_0x719e('0x34')](_0x50e1c4[_0x719e('0x31')],_0x50e1c4['query']);_0x3e9271[_0x719e('0x35')]=_['intersection'](_0x50e1c4['model'],qs['fields'](_0x2c392d[_0x719e('0x32')][_0x719e('0x46')]));_0x3e9271[_0x719e('0x35')]=_0x3e9271[_0x719e('0x35')][_0x719e('0x47')]?_0x3e9271[_0x719e('0x35')]:_0x50e1c4[_0x719e('0x31')];_0x3e9271['order']=qs[_0x719e('0x39')](_0x2c392d[_0x719e('0x32')][_0x719e('0x39')]);_0x3e9271[_0x719e('0x3a')]=qs[_0x719e('0x33')](_['pick'](_0x2c392d[_0x719e('0x32')],_0x50e1c4[_0x719e('0x33')]));if(_0x2c392d[_0x719e('0x32')][_0x719e('0x3c')]){_0x3e9271[_0x719e('0x3a')]=_['merge'](_0x3e9271[_0x719e('0x3a')],{'$or':_['map'](_0x3e9271[_0x719e('0x35')],function(_0x4c3f16){var _0x2bcfc2={};_0x2bcfc2[_0x4c3f16]={'$like':'%'+_0x2c392d[_0x719e('0x32')][_0x719e('0x3c')]+'%'};return _0x2bcfc2;})});}_0x3e9271=_[_0x719e('0x3d')]({},_0x3e9271,_0x2c392d['options']);return _0x2b3a47[_0x719e('0x60')](_0x3e9271);}})[_0x719e('0x25')](function(_0x5a8018){if(_0x5a8018){_0x4e8424=_0x5a8018['length'];if(!_0x2c392d[_0x719e('0x32')][_0x719e('0x36')](_0x719e('0x37'))){_0x3e9271[_0x719e('0x56')]=qs[_0x719e('0x56')](_0x2c392d[_0x719e('0x32')][_0x719e('0x56')]);_0x3e9271['offset']=qs[_0x719e('0x1e')](_0x2c392d[_0x719e('0x32')][_0x719e('0x1e')]);}return _0x2b3a47[_0x719e('0x60')](_0x3e9271);}})[_0x719e('0x25')](function(_0x36f065){if(_0x36f065){return _0x36f065?{'count':_0x4e8424,'rows':_0x36f065}:null;}})[_0x719e('0x25')](respondWithResult(_0x422686,null))[_0x719e('0x51')](handleError(_0x422686,null));};exports[_0x719e('0x61')]=function(_0x1ce10c,_0x3d0ea8,_0x3dad97){var _0x505539=_0x1ce10c[_0x719e('0x4a')][_0x719e('0x62')];return db[_0x719e('0x63')][_0x719e('0x58')]({'where':{'id':_0x505539},'attributes':['id'],'include':[{'model':db[_0x719e('0x59')],'as':_0x719e('0x64'),'attributes':['id',_0x719e('0x2b'),_0x719e('0x65'),_0x719e('0x66'),_0x719e('0x67')],'raw':!![]}]})[_0x719e('0x25')](function(_0x30971a){if(_0x30971a){var _0x16ee81=_[_0x719e('0x68')](_0x30971a,function(_0x150f32){var _0x37d52f=_0x150f32[_0x719e('0x26')]({'plain':!![]});return _0x37d52f[_0x719e('0x64')];});return db['WhatsappQueue'][_0x719e('0x48')]({'where':{'id':_0x1ce10c[_0x719e('0x43')]['id']}})['then'](function(_0x497321){return db['sequelize'][_0x719e('0x69')](function(_0x412c39){return _0x497321[_0x719e('0x61')](_0x505539,{'transaction':_0x412c39})[_0x719e('0x25')](function(){return BPromise[_0x719e('0x6a')](_0x16ee81,function(_0x28f508){return db['UserWhatsappQueue']['findOrCreate']({'where':{'UserId':_0x28f508['id'],'WhatsappQueueId':_0x1ce10c[_0x719e('0x43')]['id']},'transaction':_0x412c39});});})[_0x719e('0x25')](function(){_0x16ee81[_0x719e('0x6b')](function(_0x15d231){socket[_0x719e('0x6c')](_0x719e('0x6d'),{'UserId':_0x15d231['id'],'WhatsappQueueId':_0x497321['id']});});});});});}})[_0x719e('0x25')](respondWithStatusCode(_0x3d0ea8,null))[_0x719e('0x51')](handleError(_0x3d0ea8,null));};exports['removeTeams']=function(_0x3e5a3d,_0x1d2257,_0x4d759b){return db[_0x719e('0x63')][_0x719e('0x58')]({'where':{'id':_0x3e5a3d[_0x719e('0x32')][_0x719e('0x62')]},'attributes':['id'],'include':[{'model':db[_0x719e('0x59')],'as':_0x719e('0x64'),'attributes':['id'],'raw':!![]}]})[_0x719e('0x25')](handleEntityNotFound(_0x1d2257,null))[_0x719e('0x25')](function(_0x183a19){var _0x408b87=_[_0x719e('0x2d')](_0x183a19,'id');var _0x29b154=[];var _0x1ebeba=[];var _0x15ec78=squel[_0x719e('0x6e')]();_0x15ec78['field'](_0x719e('0x6f'))[_0x719e('0x70')](_0x719e('0x71'),'tq')[_0x719e('0x72')](_0x719e('0x73'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x719e('0x3a')]('WhatsappQueueId\x20=\x20?',_0x3e5a3d['params']['id']);for(var _0x3b69a1=0x0;_0x3b69a1<_0x183a19[_0x719e('0x47')];_0x3b69a1+=0x1){let _0x118a9c=_0x183a19[_0x3b69a1];for(var _0x2664a5=0x0;_0x2664a5<_0x118a9c[_0x719e('0x64')][_0x719e('0x47')];_0x2664a5+=0x1){let _0x15bfea=_0x118a9c[_0x719e('0x64')][_0x2664a5];var _0x49fac7=_0x15ec78[_0x719e('0x74')]();_0x49fac7[_0x719e('0x3a')](_0x719e('0x75'),_0x15bfea['id']);_0x1ebeba[_0x719e('0x76')](db['sequelize'][_0x719e('0x32')](_0x49fac7[_0x719e('0x77')](),{'type':db['sequelize']['QueryTypes']['SELECT']})[_0x719e('0x25')](function(_0x3d70de){if(_0x3d70de[_0x719e('0x47')]===0x1){return _0x15bfea['id'];}else{var _0x5b38a7=_[_0x719e('0x78')](_['map'](_0x3d70de,_0x719e('0x79')),function(_0x5dede8){return _[_0x719e('0x7a')](_0x408b87,_0x5dede8);});if(_0x5b38a7){return _0x15bfea['id'];}}}));}}return BPromise[_0x719e('0x7b')](_0x1ebeba)[_0x719e('0x25')](function(_0x5c79b4){_0x29b154=_(_0x29b154)['union'](_0x5c79b4)[_0x719e('0x7c')]()['value']();return db[_0x719e('0x2e')]['find']({'where':{'id':_0x3e5a3d[_0x719e('0x43')]['id']}})[_0x719e('0x25')](function(_0x3e5a18){return db[_0x719e('0x7d')][_0x719e('0x69')](function(_0x2ac6f9){return _0x3e5a18['removeTeams'](_0x3e5a3d['query'][_0x719e('0x62')],{'transaction':_0x2ac6f9})['then'](function(){if(!_[_0x719e('0x7e')](_0x29b154)){return _0x3e5a18[_0x719e('0x7f')](_0x29b154,{'transaction':_0x2ac6f9});}})[_0x719e('0x25')](function(){_0x29b154['forEach'](function(_0x15c1c5){socket[_0x719e('0x6c')](_0x719e('0x80'),{'UserId':_0x15c1c5,'WhatsappQueueId':_0x3e5a18['id']});});});});});});})[_0x719e('0x25')](respondWithStatusCode(_0x1d2257,null))[_0x719e('0x51')](handleError(_0x1d2257,null));};exports[_0x719e('0x81')]=function(_0x169880,_0x2607b0,_0x30a309){return db[_0x719e('0x2e')][_0x719e('0x48')]({'where':{'id':_0x169880['params']['id']}})[_0x719e('0x25')](handleEntityNotFound(_0x2607b0,null))['then'](function(_0x40c281){if(_0x40c281){return _0x40c281[_0x719e('0x81')](_0x169880[_0x719e('0x4a')][_0x719e('0x62')],_[_0x719e('0x82')](_0x169880[_0x719e('0x4a')],['ids','id'])||{})['spread'](function(_0x4b6903){for(var _0x385dc0=0x0;_0x385dc0<_0x169880[_0x719e('0x4a')][_0x719e('0x62')][_0x719e('0x47')];_0x385dc0+=0x1){socket[_0x719e('0x6c')](_0x719e('0x6d'),{'UserId':_0x169880[_0x719e('0x4a')]['ids'][_0x385dc0],'WhatsappQueueId':_0x169880[_0x719e('0x43')]['id']});}return _0x4b6903;});}})['then'](respondWithResult(_0x2607b0,null))[_0x719e('0x51')](handleError(_0x2607b0,null));};exports[_0x719e('0x7f')]=function(_0x29af73,_0x19be7a,_0x27a2eb){return db[_0x719e('0x2e')][_0x719e('0x48')]({'where':{'id':_0x29af73[_0x719e('0x43')]['id']}})['then'](handleEntityNotFound(_0x19be7a,null))[_0x719e('0x25')](function(_0x258132){if(_0x258132){return _0x258132['removeAgents'](_0x29af73[_0x719e('0x32')][_0x719e('0x62')])[_0x719e('0x25')](function(){if(_[_0x719e('0x83')](_0x29af73['query'][_0x719e('0x62')])){for(var _0x4c9b10=0x0;_0x4c9b10<_0x29af73[_0x719e('0x32')][_0x719e('0x62')][_0x719e('0x47')];_0x4c9b10+=0x1){socket[_0x719e('0x6c')](_0x719e('0x80'),{'UserId':Number(_0x29af73[_0x719e('0x32')][_0x719e('0x62')][_0x4c9b10]),'WhatsappQueueId':Number(_0x29af73[_0x719e('0x43')]['id'])});}}else{socket[_0x719e('0x6c')]('userWhatsappQueue:remove',{'UserId':Number(_0x29af73[_0x719e('0x32')][_0x719e('0x62')]),'WhatsappQueueId':Number(_0x29af73[_0x719e('0x43')]['id'])});}});}})[_0x719e('0x25')](respondWithStatusCode(_0x19be7a,null))['catch'](handleError(_0x19be7a,null));};exports[_0x719e('0x84')]=function(_0x19e698,_0x3c8213,_0x4df502){var _0x33b952={};var _0x2c4fd1={};var _0x709292;var _0xaa6cf9;return db[_0x719e('0x2e')][_0x719e('0x54')]({'where':{'id':_0x19e698['params']['id']}})[_0x719e('0x25')](handleEntityNotFound(_0x3c8213,null))[_0x719e('0x25')](function(_0x23bdfd){if(_0x23bdfd){_0x709292=_0x23bdfd;_0x2c4fd1[_0x719e('0x31')]=_[_0x719e('0x45')](db['User'][_0x719e('0x44')]);_0x2c4fd1[_0x719e('0x32')]=_['keys'](_0x19e698[_0x719e('0x32')]);_0x2c4fd1[_0x719e('0x33')]=_[_0x719e('0x34')](_0x2c4fd1['model'],_0x2c4fd1['query']);_0x33b952[_0x719e('0x35')]=_[_0x719e('0x34')](_0x2c4fd1['model'],qs[_0x719e('0x46')](_0x19e698['query'][_0x719e('0x46')]));_0x33b952[_0x719e('0x35')]=_0x33b952[_0x719e('0x35')][_0x719e('0x47')]?_0x33b952['attributes']:_0x2c4fd1['model'];_0x33b952['order']=qs[_0x719e('0x39')](_0x19e698[_0x719e('0x32')][_0x719e('0x39')]);_0x33b952[_0x719e('0x3a')]=qs[_0x719e('0x33')](_[_0x719e('0x3b')](_0x19e698[_0x719e('0x32')],_0x2c4fd1['filters']));if(_0x19e698[_0x719e('0x32')][_0x719e('0x3c')]){_0x33b952[_0x719e('0x3a')]=_[_0x719e('0x3d')](_0x33b952[_0x719e('0x3a')],{'$or':_[_0x719e('0x2d')](_0x33b952[_0x719e('0x35')],function(_0x42cbd3){var _0x3f2eb1={};_0x3f2eb1[_0x42cbd3]={'$like':'%'+_0x19e698['query']['filter']+'%'};return _0x3f2eb1;})});}_0x33b952=_['merge']({},_0x33b952,_0x19e698[_0x719e('0x3e')]);return _0x709292[_0x719e('0x84')](_0x33b952);}})[_0x719e('0x25')](function(_0x2b249e){if(_0x2b249e){_0xaa6cf9=_0x2b249e[_0x719e('0x47')];if(!_0x19e698[_0x719e('0x32')]['hasOwnProperty']('nolimit')){_0x33b952[_0x719e('0x56')]=qs[_0x719e('0x56')](_0x19e698['query'][_0x719e('0x56')]);_0x33b952[_0x719e('0x1e')]=qs[_0x719e('0x1e')](_0x19e698[_0x719e('0x32')][_0x719e('0x1e')]);}return _0x709292[_0x719e('0x84')](_0x33b952);}})['then'](function(_0x377182){if(_0x377182){return _0x377182?{'count':_0xaa6cf9,'rows':_0x377182}:null;}})[_0x719e('0x25')](respondWithResult(_0x3c8213,null))['catch'](handleError(_0x3c8213,null));}; \ No newline at end of file +var _0x54e3=['omit','spread','isArray','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./whatsappQueue.socket','register','sendStatus','status','end','offset','Content-Range','apply','then','destroy','get','WhatsappQueues','UserProfileResource','error','name','index','map','WhatsappQueue','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','limit','order','sort','where','pick','filter','options','count','includeAll','include','catch','show','params','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','update','describe','findOne','UserWhatsappQueue','hasOwnProperty','WhatsappQueueId','findAll','User','findAndCountAll','updatedAt','createdAt','format','%s/%s','SIP','getTeams','addTeams','ids','Team','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','forEach','emit','userWhatsappQueue:save','select','field','tq.TeamId','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','SELECT','every','TeamId','includes','all','union','value','removeTeams','isEmpty','removeAgents','userWhatsappQueue:remove','addAgents'];(function(_0x14b6ec,_0x4a04a6){var _0x12f2c9=function(_0x157a40){while(--_0x157a40){_0x14b6ec['push'](_0x14b6ec['shift']());}};_0x12f2c9(++_0x4a04a6);}(_0x54e3,0x8d));var _0x354e=function(_0x6251a3,_0x58a9f3){_0x6251a3=_0x6251a3-0x0;var _0x18fd1f=_0x54e3[_0x6251a3];return _0x18fd1f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x354e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x354e('0x1'));var jsonpatch=require(_0x354e('0x2'));var rp=require(_0x354e('0x3'));var moment=require(_0x354e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x354e('0x5'));var util=require(_0x354e('0x6'));var path=require(_0x354e('0x7'));var sox=require(_0x354e('0x8'));var csv=require(_0x354e('0x9'));var ejs=require(_0x354e('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x354e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x354e('0xc'));var toCsv=require(_0x354e('0x9'));var querystring=require(_0x354e('0xd'));var Papa=require(_0x354e('0xe'));var Redis=require(_0x354e('0xf'));var authService=require(_0x354e('0x10'));var qs=require(_0x354e('0x11'));var as=require(_0x354e('0x12'));var hardwareService=require(_0x354e('0x13'));var logger=require(_0x354e('0x14'))(_0x354e('0x15'));var utils=require(_0x354e('0x16'));var config=require(_0x354e('0x17'));var db=require(_0x354e('0x18'))['db'];config[_0x354e('0x19')]=_[_0x354e('0x1a')](config[_0x354e('0x19')],{'host':_0x354e('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x354e('0x1c'))[_0x354e('0x1d')](socket);function respondWithStatusCode(_0x30e826,_0x33c0f6){_0x33c0f6=_0x33c0f6||0xcc;return function(_0x6f143e){if(_0x6f143e){return _0x30e826[_0x354e('0x1e')](_0x33c0f6);}return _0x30e826[_0x354e('0x1f')](_0x33c0f6)[_0x354e('0x20')]();};}function respondWithResult(_0x4266d9,_0x221911){_0x221911=_0x221911||0xc8;return function(_0x3576ef){if(_0x3576ef){return _0x4266d9[_0x354e('0x1f')](_0x221911)['json'](_0x3576ef);}};}function respondWithFilteredResult(_0x4bfdc8,_0x39a0d0){return function(_0x3b886c){if(_0x3b886c){var _0x312a36=_0x3b886c['count'],_0x2a9605=_0x39a0d0[_0x354e('0x21')],_0x357342=_0x39a0d0[_0x354e('0x21')]+_0x39a0d0['limit'],_0x127098;if(_0x357342>=_0x312a36){_0x357342=_0x312a36;_0x127098=0xc8;}else{_0x127098=0xce;}_0x4bfdc8[_0x354e('0x1f')](_0x127098);return _0x4bfdc8['set'](_0x354e('0x22'),_0x2a9605+'-'+_0x357342+'/'+_0x312a36)['json'](_0x3b886c);}return null;};}function patchUpdates(_0x140967){return function(_0x380222){try{jsonpatch[_0x354e('0x23')](_0x380222,_0x140967,!![]);}catch(_0x3bf0de){return BPromise['reject'](_0x3bf0de);}return _0x380222['save']();};}function saveUpdates(_0x4e81ba,_0x4c8aa5){return function(_0x293888){if(_0x293888){return _0x293888['update'](_0x4e81ba)[_0x354e('0x24')](function(_0x29b413){return _0x29b413;});}return null;};}function removeEntity(_0x4cd497,_0x4f1c8d){return function(_0x1045a7){if(_0x1045a7){return _0x1045a7[_0x354e('0x25')]()[_0x354e('0x24')](function(){var _0x56f083=_0x1045a7[_0x354e('0x26')]({'plain':!![]});var _0x4214bf=_0x354e('0x27');return db[_0x354e('0x28')][_0x354e('0x25')]({'where':{'type':_0x4214bf,'resourceId':_0x56f083['id']}})[_0x354e('0x24')](function(){return _0x1045a7;});})[_0x354e('0x24')](function(){_0x4cd497['status'](0xcc)[_0x354e('0x20')]();});}};}function handleEntityNotFound(_0x40959d,_0x15d8ec){return function(_0x584489){if(!_0x584489){_0x40959d['sendStatus'](0x194);}return _0x584489;};}function handleError(_0x360ebe,_0xd5eb51){_0xd5eb51=_0xd5eb51||0x1f4;return function(_0x3b48b2){logger[_0x354e('0x29')](_0x3b48b2['stack']);if(_0x3b48b2[_0x354e('0x2a')]){delete _0x3b48b2[_0x354e('0x2a')];}_0x360ebe['status'](_0xd5eb51)['send'](_0x3b48b2);};}exports[_0x354e('0x2b')]=function(_0x362424,_0x4c5e96){var _0x59e638={},_0x430dec={},_0x4081aa={'count':0x0,'rows':[]};var _0x80fa2b=_[_0x354e('0x2c')](db[_0x354e('0x2d')][_0x354e('0x2e')],function(_0x3d68d6){return{'name':_0x3d68d6[_0x354e('0x2f')],'type':_0x3d68d6[_0x354e('0x30')][_0x354e('0x31')]};});_0x430dec[_0x354e('0x32')]=_[_0x354e('0x2c')](_0x80fa2b,_0x354e('0x2a'));_0x430dec[_0x354e('0x33')]=_[_0x354e('0x34')](_0x362424['query']);_0x430dec[_0x354e('0x35')]=_['intersection'](_0x430dec[_0x354e('0x32')],_0x430dec[_0x354e('0x33')]);_0x59e638[_0x354e('0x36')]=_[_0x354e('0x37')](_0x430dec['model'],qs[_0x354e('0x38')](_0x362424[_0x354e('0x33')]['fields']));_0x59e638[_0x354e('0x36')]=_0x59e638[_0x354e('0x36')][_0x354e('0x39')]?_0x59e638['attributes']:_0x430dec[_0x354e('0x32')];if(!_0x362424[_0x354e('0x33')]['hasOwnProperty'](_0x354e('0x3a'))){_0x59e638[_0x354e('0x3b')]=qs[_0x354e('0x3b')](_0x362424[_0x354e('0x33')][_0x354e('0x3b')]);_0x59e638[_0x354e('0x21')]=qs[_0x354e('0x21')](_0x362424['query'][_0x354e('0x21')]);}_0x59e638[_0x354e('0x3c')]=qs['sort'](_0x362424[_0x354e('0x33')][_0x354e('0x3d')]);_0x59e638[_0x354e('0x3e')]=qs[_0x354e('0x35')](_[_0x354e('0x3f')](_0x362424[_0x354e('0x33')],_0x430dec[_0x354e('0x35')]),_0x80fa2b);if(_0x362424[_0x354e('0x33')][_0x354e('0x40')]){_0x59e638['where']=_['merge'](_0x59e638['where'],{'$or':_[_0x354e('0x2c')](_0x80fa2b,function(_0x46feca){if(_0x46feca[_0x354e('0x30')]!=='VIRTUAL'){var _0x346ff7={};_0x346ff7[_0x46feca[_0x354e('0x2a')]]={'$like':'%'+_0x362424[_0x354e('0x33')]['filter']+'%'};return _0x346ff7;}})});}_0x59e638=_['merge']({},_0x59e638,_0x362424[_0x354e('0x41')]);var _0x45a4ef={'where':_0x59e638[_0x354e('0x3e')]};return db[_0x354e('0x2d')][_0x354e('0x42')](_0x45a4ef)[_0x354e('0x24')](function(_0x437830){_0x4081aa[_0x354e('0x42')]=_0x437830;if(_0x362424[_0x354e('0x33')][_0x354e('0x43')]){_0x59e638[_0x354e('0x44')]=[{'all':!![]}];}return db[_0x354e('0x2d')]['findAll'](_0x59e638);})[_0x354e('0x24')](function(_0x22e5be){_0x4081aa['rows']=_0x22e5be;return _0x4081aa;})[_0x354e('0x24')](respondWithFilteredResult(_0x4c5e96,_0x59e638))[_0x354e('0x45')](handleError(_0x4c5e96,null));};exports[_0x354e('0x46')]=function(_0x19315e,_0x3b16f8){var _0x300f3e={'raw':!![],'where':{'id':_0x19315e[_0x354e('0x47')]['id']}},_0x3fda47={};_0x3fda47[_0x354e('0x32')]=_[_0x354e('0x34')](db[_0x354e('0x2d')][_0x354e('0x2e')]);_0x3fda47[_0x354e('0x33')]=_[_0x354e('0x34')](_0x19315e['query']);_0x3fda47['filters']=_['intersection'](_0x3fda47[_0x354e('0x32')],_0x3fda47[_0x354e('0x33')]);_0x300f3e[_0x354e('0x36')]=_[_0x354e('0x37')](_0x3fda47[_0x354e('0x32')],qs['fields'](_0x19315e[_0x354e('0x33')][_0x354e('0x38')]));_0x300f3e['attributes']=_0x300f3e[_0x354e('0x36')]['length']?_0x300f3e[_0x354e('0x36')]:_0x3fda47[_0x354e('0x32')];if(_0x19315e[_0x354e('0x33')][_0x354e('0x43')]){_0x300f3e[_0x354e('0x44')]=[{'all':!![]}];}_0x300f3e=_[_0x354e('0x48')]({},_0x300f3e,_0x19315e[_0x354e('0x41')]);return db['WhatsappQueue'][_0x354e('0x49')](_0x300f3e)[_0x354e('0x24')](handleEntityNotFound(_0x3b16f8,null))[_0x354e('0x24')](respondWithResult(_0x3b16f8,null))[_0x354e('0x45')](handleError(_0x3b16f8,null));};exports[_0x354e('0x4a')]=function(_0x4dd0aa,_0x28fbdc){return db['WhatsappQueue'][_0x354e('0x4a')](_0x4dd0aa[_0x354e('0x4b')],{})[_0x354e('0x24')](function(_0x5c6014){var _0x48bc17=_0x4dd0aa[_0x354e('0x4c')][_0x354e('0x26')]({'plain':!![]});if(!_0x48bc17)throw new Error(_0x354e('0x4d'));if(_0x48bc17[_0x354e('0x4e')]==='user'){var _0x1dd7ad=_0x5c6014[_0x354e('0x26')]({'plain':!![]});var _0x5930a5='WhatsappQueues';return db['UserProfileSection'][_0x354e('0x49')]({'where':{'name':_0x5930a5,'userProfileId':_0x48bc17[_0x354e('0x4f')]},'raw':!![]})[_0x354e('0x24')](function(_0xb3b34){if(_0xb3b34&&_0xb3b34['autoAssociation']===0x0){return db[_0x354e('0x28')]['create']({'name':_0x1dd7ad[_0x354e('0x2a')],'resourceId':_0x1dd7ad['id'],'type':_0xb3b34[_0x354e('0x2a')],'sectionId':_0xb3b34['id']},{})[_0x354e('0x24')](function(){return _0x5c6014;});}else{return _0x5c6014;}})[_0x354e('0x45')](function(_0x570397){logger[_0x354e('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x570397);throw _0x570397;});}return _0x5c6014;})[_0x354e('0x24')](respondWithResult(_0x28fbdc,0xc9))[_0x354e('0x45')](handleError(_0x28fbdc,null));};exports[_0x354e('0x50')]=function(_0x501006,_0x162702){if(_0x501006[_0x354e('0x4b')]['id']){delete _0x501006['body']['id'];}return db[_0x354e('0x2d')][_0x354e('0x49')]({'where':{'id':_0x501006['params']['id']}})[_0x354e('0x24')](handleEntityNotFound(_0x162702,null))[_0x354e('0x24')](saveUpdates(_0x501006['body'],null))['then'](respondWithResult(_0x162702,null))['catch'](handleError(_0x162702,null));};exports[_0x354e('0x25')]=function(_0x3c46be,_0x5cc26e){return db[_0x354e('0x2d')][_0x354e('0x49')]({'where':{'id':_0x3c46be[_0x354e('0x47')]['id']}})[_0x354e('0x24')](handleEntityNotFound(_0x5cc26e,null))[_0x354e('0x24')](removeEntity(_0x5cc26e,null))[_0x354e('0x45')](handleError(_0x5cc26e,null));};exports[_0x354e('0x51')]=function(_0x591448,_0x3d8cd1){return db[_0x354e('0x2d')][_0x354e('0x51')]()['then'](respondWithResult(_0x3d8cd1,null))[_0x354e('0x45')](handleError(_0x3d8cd1,null));};exports['getMembers']=function(_0x17077c,_0x45bb80,_0x1b587c){var _0x559bf3={'raw':!![],'where':{}},_0x5db3b8={},_0x1f76e9;return db['WhatsappQueue'][_0x354e('0x52')]({'where':{'id':_0x17077c[_0x354e('0x47')]['id']}})[_0x354e('0x24')](handleEntityNotFound(_0x45bb80,null))[_0x354e('0x24')](function(_0xa117b8){if(_0xa117b8){_0x1f76e9=_0xa117b8[_0x354e('0x26')]({'plain':!![]});_0x5db3b8['model']=_[_0x354e('0x34')](db[_0x354e('0x53')]['rawAttributes']);_0x5db3b8[_0x354e('0x33')]=_['keys'](_0x17077c[_0x354e('0x33')]);_0x5db3b8['filters']=_[_0x354e('0x37')](_0x5db3b8[_0x354e('0x32')],_0x5db3b8[_0x354e('0x33')]);_0x559bf3['attributes']=_[_0x354e('0x37')](_0x5db3b8['model'],qs['fields'](_0x17077c[_0x354e('0x33')][_0x354e('0x38')]));_0x559bf3[_0x354e('0x36')]=_0x559bf3['attributes'][_0x354e('0x39')]?_0x559bf3[_0x354e('0x36')]:_0x5db3b8[_0x354e('0x32')];if(!_0x17077c[_0x354e('0x33')][_0x354e('0x54')](_0x354e('0x3a'))){_0x559bf3[_0x354e('0x3b')]=qs[_0x354e('0x3b')](_0x17077c[_0x354e('0x33')][_0x354e('0x3b')]);_0x559bf3['offset']=qs['offset'](_0x17077c['query']['offset']);}_0x559bf3[_0x354e('0x3c')]=qs[_0x354e('0x3d')](_0x17077c[_0x354e('0x33')]['sort']);_0x559bf3[_0x354e('0x3e')]=qs[_0x354e('0x35')](_['pick'](_0x17077c['query'],_0x5db3b8[_0x354e('0x35')]));_0x559bf3['where'][_0x354e('0x55')]=_0xa117b8['id'];if(_0x17077c[_0x354e('0x33')][_0x354e('0x40')]){_0x559bf3[_0x354e('0x3e')]=_['merge'](_0x559bf3[_0x354e('0x3e')],{'$or':_[_0x354e('0x2c')](_0x559bf3[_0x354e('0x36')],function(_0x217f00){var _0x22b6b7={};_0x22b6b7[_0x217f00]={'$like':'%'+_0x17077c[_0x354e('0x33')][_0x354e('0x40')]+'%'};return _0x22b6b7;})});}_0x559bf3=_[_0x354e('0x48')]({},_0x559bf3,_0x17077c[_0x354e('0x41')]);return db[_0x354e('0x53')][_0x354e('0x56')](_0x559bf3);}})[_0x354e('0x24')](function(_0x4841eb){if(_0x4841eb){return db[_0x354e('0x57')][_0x354e('0x58')]({'where':{'id':_['map'](_0x4841eb,'UserId'),'role':'agent'},'attributes':['id','name','whatsappPause',_0x354e('0x59'),_0x354e('0x5a')]});}})['then'](function(_0x2cf76e){if(_0x2cf76e){return{'count':_0x2cf76e[_0x354e('0x42')],'rows':_[_0x354e('0x2c')](_0x2cf76e['rows'],function(_0x27d854){return{'membername':_0x27d854['name'],'UserId':_0x27d854['id'],'queue_name':_0x1f76e9[_0x354e('0x2a')],'WhatsappQueueId':_0x1f76e9['id'],'interface':util[_0x354e('0x5b')](_0x354e('0x5c'),_0x354e('0x5d'),_0x27d854[_0x354e('0x2a')]),'penalty':0x0,'paused':_0x27d854['whatsappPause'],'createdAt':_0x27d854[_0x354e('0x5a')],'updatedAt':_0x27d854[_0x354e('0x59')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x354e('0x24')](respondWithFilteredResult(_0x45bb80,_0x559bf3))[_0x354e('0x45')](handleError(_0x45bb80,null));};exports[_0x354e('0x5e')]=function(_0xd2d0fb,_0x21eb05,_0xbe370b){var _0xd70f2={};var _0xc10b1e={};var _0x136253;var _0x2e13b9;return db[_0x354e('0x2d')][_0x354e('0x52')]({'where':{'id':_0xd2d0fb['params']['id']}})[_0x354e('0x24')](handleEntityNotFound(_0x21eb05,null))[_0x354e('0x24')](function(_0x1e6e07){if(_0x1e6e07){_0x136253=_0x1e6e07;_0xc10b1e[_0x354e('0x32')]=_[_0x354e('0x34')](db['Team']['rawAttributes']);_0xc10b1e['query']=_[_0x354e('0x34')](_0xd2d0fb[_0x354e('0x33')]);_0xc10b1e[_0x354e('0x35')]=_[_0x354e('0x37')](_0xc10b1e[_0x354e('0x32')],_0xc10b1e['query']);_0xd70f2[_0x354e('0x36')]=_[_0x354e('0x37')](_0xc10b1e[_0x354e('0x32')],qs[_0x354e('0x38')](_0xd2d0fb[_0x354e('0x33')][_0x354e('0x38')]));_0xd70f2[_0x354e('0x36')]=_0xd70f2[_0x354e('0x36')]['length']?_0xd70f2[_0x354e('0x36')]:_0xc10b1e['model'];_0xd70f2['order']=qs['sort'](_0xd2d0fb['query'][_0x354e('0x3d')]);_0xd70f2['where']=qs[_0x354e('0x35')](_[_0x354e('0x3f')](_0xd2d0fb['query'],_0xc10b1e['filters']));if(_0xd2d0fb[_0x354e('0x33')][_0x354e('0x40')]){_0xd70f2['where']=_[_0x354e('0x48')](_0xd70f2[_0x354e('0x3e')],{'$or':_[_0x354e('0x2c')](_0xd70f2[_0x354e('0x36')],function(_0x116eb6){var _0x3a4895={};_0x3a4895[_0x116eb6]={'$like':'%'+_0xd2d0fb['query']['filter']+'%'};return _0x3a4895;})});}_0xd70f2=_[_0x354e('0x48')]({},_0xd70f2,_0xd2d0fb[_0x354e('0x41')]);return _0x136253[_0x354e('0x5e')](_0xd70f2);}})[_0x354e('0x24')](function(_0x44e7ad){if(_0x44e7ad){_0x2e13b9=_0x44e7ad[_0x354e('0x39')];if(!_0xd2d0fb[_0x354e('0x33')][_0x354e('0x54')](_0x354e('0x3a'))){_0xd70f2['limit']=qs['limit'](_0xd2d0fb[_0x354e('0x33')][_0x354e('0x3b')]);_0xd70f2['offset']=qs['offset'](_0xd2d0fb[_0x354e('0x33')][_0x354e('0x21')]);}return _0x136253[_0x354e('0x5e')](_0xd70f2);}})[_0x354e('0x24')](function(_0x87bb95){if(_0x87bb95){return _0x87bb95?{'count':_0x2e13b9,'rows':_0x87bb95}:null;}})['then'](respondWithResult(_0x21eb05,null))[_0x354e('0x45')](handleError(_0x21eb05,null));};exports[_0x354e('0x5f')]=function(_0x46cda1,_0x341e8e,_0x5a3ce6){var _0x3f1549=_0x46cda1[_0x354e('0x4b')][_0x354e('0x60')];return db[_0x354e('0x61')][_0x354e('0x56')]({'where':{'id':_0x3f1549},'attributes':['id'],'include':[{'model':db['User'],'as':_0x354e('0x62'),'attributes':['id',_0x354e('0x2a'),_0x354e('0x63'),_0x354e('0x64'),_0x354e('0x65')],'raw':!![]}]})['then'](function(_0x473bed){if(_0x473bed){var _0x5532fd=_[_0x354e('0x66')](_0x473bed,function(_0x36b6dd){var _0x4d05c2=_0x36b6dd[_0x354e('0x26')]({'plain':!![]});return _0x4d05c2['Agents'];});return db['WhatsappQueue']['find']({'where':{'id':_0x46cda1['params']['id']}})[_0x354e('0x24')](function(_0x1a3159){return db[_0x354e('0x67')][_0x354e('0x68')](function(_0x3901f3){return _0x1a3159[_0x354e('0x5f')](_0x3f1549,{'transaction':_0x3901f3})[_0x354e('0x24')](function(){return BPromise[_0x354e('0x69')](_0x5532fd,function(_0x3bf95d){return db[_0x354e('0x53')]['findOrCreate']({'where':{'UserId':_0x3bf95d['id'],'WhatsappQueueId':_0x46cda1[_0x354e('0x47')]['id']},'transaction':_0x3901f3});});})['then'](function(){_0x5532fd[_0x354e('0x6a')](function(_0xf38c47){socket[_0x354e('0x6b')](_0x354e('0x6c'),{'UserId':_0xf38c47['id'],'WhatsappQueueId':_0x1a3159['id']});});});});});}})[_0x354e('0x24')](respondWithStatusCode(_0x341e8e,null))[_0x354e('0x45')](handleError(_0x341e8e,null));};exports['removeTeams']=function(_0x2eb4aa,_0x4dfbaa,_0x436db5){return db[_0x354e('0x61')][_0x354e('0x56')]({'where':{'id':_0x2eb4aa[_0x354e('0x33')][_0x354e('0x60')]},'attributes':['id'],'include':[{'model':db[_0x354e('0x57')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x4dfbaa,null))[_0x354e('0x24')](function(_0x37322b){var _0x12b879=_[_0x354e('0x2c')](_0x37322b,'id');var _0x480b78=[];var _0x3ef467=[];var _0x4c4294=squel[_0x354e('0x6d')]();_0x4c4294[_0x354e('0x6e')](_0x354e('0x6f'))['from'](_0x354e('0x70'),'tq')[_0x354e('0x71')](_0x354e('0x72'),'ut',_0x354e('0x73'))[_0x354e('0x3e')](_0x354e('0x74'),_0x2eb4aa[_0x354e('0x47')]['id']);for(var _0x4005e7=0x0;_0x4005e7<_0x37322b[_0x354e('0x39')];_0x4005e7+=0x1){let _0x3a5d07=_0x37322b[_0x4005e7];for(var _0x114678=0x0;_0x114678<_0x3a5d07[_0x354e('0x62')]['length'];_0x114678+=0x1){let _0x5177d0=_0x3a5d07[_0x354e('0x62')][_0x114678];var _0x3557f7=_0x4c4294[_0x354e('0x75')]();_0x3557f7['where'](_0x354e('0x76'),_0x5177d0['id']);_0x3ef467[_0x354e('0x77')](db[_0x354e('0x67')][_0x354e('0x33')](_0x3557f7[_0x354e('0x78')](),{'type':db['sequelize']['QueryTypes'][_0x354e('0x79')]})[_0x354e('0x24')](function(_0x3d7eeb){if(_0x3d7eeb[_0x354e('0x39')]===0x1){return _0x5177d0['id'];}else{var _0x8b5945=_[_0x354e('0x7a')](_[_0x354e('0x2c')](_0x3d7eeb,_0x354e('0x7b')),function(_0x4b041c){return _[_0x354e('0x7c')](_0x12b879,_0x4b041c);});if(_0x8b5945){return _0x5177d0['id'];}}}));}}return BPromise[_0x354e('0x7d')](_0x3ef467)[_0x354e('0x24')](function(_0x2cc69e){_0x480b78=_(_0x480b78)[_0x354e('0x7e')](_0x2cc69e)['compact']()[_0x354e('0x7f')]();return db[_0x354e('0x2d')][_0x354e('0x49')]({'where':{'id':_0x2eb4aa[_0x354e('0x47')]['id']}})['then'](function(_0x22855b){return db['sequelize']['transaction'](function(_0x58816d){return _0x22855b[_0x354e('0x80')](_0x2eb4aa[_0x354e('0x33')][_0x354e('0x60')],{'transaction':_0x58816d})[_0x354e('0x24')](function(){if(!_[_0x354e('0x81')](_0x480b78)){return _0x22855b[_0x354e('0x82')](_0x480b78,{'transaction':_0x58816d});}})[_0x354e('0x24')](function(){_0x480b78[_0x354e('0x6a')](function(_0x322af8){socket[_0x354e('0x6b')](_0x354e('0x83'),{'UserId':_0x322af8,'WhatsappQueueId':_0x22855b['id']});});});});});});})[_0x354e('0x24')](respondWithStatusCode(_0x4dfbaa,null))[_0x354e('0x45')](handleError(_0x4dfbaa,null));};exports[_0x354e('0x84')]=function(_0x109b69,_0x351661,_0x562adb){return db['WhatsappQueue'][_0x354e('0x49')]({'where':{'id':_0x109b69[_0x354e('0x47')]['id']}})[_0x354e('0x24')](handleEntityNotFound(_0x351661,null))['then'](function(_0x59b018){if(_0x59b018){return _0x59b018[_0x354e('0x84')](_0x109b69[_0x354e('0x4b')]['ids'],_[_0x354e('0x85')](_0x109b69['body'],[_0x354e('0x60'),'id'])||{})[_0x354e('0x86')](function(_0x334e4c){for(var _0x2ac2d8=0x0;_0x2ac2d8<_0x109b69[_0x354e('0x4b')]['ids'][_0x354e('0x39')];_0x2ac2d8+=0x1){socket['emit'](_0x354e('0x6c'),{'UserId':_0x109b69[_0x354e('0x4b')]['ids'][_0x2ac2d8],'WhatsappQueueId':_0x109b69[_0x354e('0x47')]['id']});}return _0x334e4c;});}})[_0x354e('0x24')](respondWithResult(_0x351661,null))['catch'](handleError(_0x351661,null));};exports['removeAgents']=function(_0x35b7a8,_0x2e728b,_0x5236a8){return db[_0x354e('0x2d')]['find']({'where':{'id':_0x35b7a8[_0x354e('0x47')]['id']}})[_0x354e('0x24')](handleEntityNotFound(_0x2e728b,null))[_0x354e('0x24')](function(_0x3abba3){if(_0x3abba3){return _0x3abba3[_0x354e('0x82')](_0x35b7a8[_0x354e('0x33')]['ids'])[_0x354e('0x24')](function(){if(_[_0x354e('0x87')](_0x35b7a8[_0x354e('0x33')][_0x354e('0x60')])){for(var _0x416798=0x0;_0x416798<_0x35b7a8[_0x354e('0x33')][_0x354e('0x60')][_0x354e('0x39')];_0x416798+=0x1){socket[_0x354e('0x6b')](_0x354e('0x83'),{'UserId':Number(_0x35b7a8[_0x354e('0x33')][_0x354e('0x60')][_0x416798]),'WhatsappQueueId':Number(_0x35b7a8['params']['id'])});}}else{socket[_0x354e('0x6b')](_0x354e('0x83'),{'UserId':Number(_0x35b7a8['query'][_0x354e('0x60')]),'WhatsappQueueId':Number(_0x35b7a8[_0x354e('0x47')]['id'])});}});}})[_0x354e('0x24')](respondWithStatusCode(_0x2e728b,null))[_0x354e('0x45')](handleError(_0x2e728b,null));};exports[_0x354e('0x88')]=function(_0x42398d,_0x1e11c0,_0x578b0a){var _0x4d7ad4={};var _0x180f76={};var _0x4794c2;var _0x1c89bc;return db[_0x354e('0x2d')][_0x354e('0x52')]({'where':{'id':_0x42398d[_0x354e('0x47')]['id']}})['then'](handleEntityNotFound(_0x1e11c0,null))[_0x354e('0x24')](function(_0x2823f4){if(_0x2823f4){_0x4794c2=_0x2823f4;_0x180f76[_0x354e('0x32')]=_[_0x354e('0x34')](db[_0x354e('0x57')]['rawAttributes']);_0x180f76[_0x354e('0x33')]=_[_0x354e('0x34')](_0x42398d[_0x354e('0x33')]);_0x180f76[_0x354e('0x35')]=_[_0x354e('0x37')](_0x180f76[_0x354e('0x32')],_0x180f76[_0x354e('0x33')]);_0x4d7ad4[_0x354e('0x36')]=_[_0x354e('0x37')](_0x180f76[_0x354e('0x32')],qs[_0x354e('0x38')](_0x42398d[_0x354e('0x33')][_0x354e('0x38')]));_0x4d7ad4[_0x354e('0x36')]=_0x4d7ad4[_0x354e('0x36')][_0x354e('0x39')]?_0x4d7ad4[_0x354e('0x36')]:_0x180f76[_0x354e('0x32')];_0x4d7ad4[_0x354e('0x3c')]=qs[_0x354e('0x3d')](_0x42398d[_0x354e('0x33')][_0x354e('0x3d')]);_0x4d7ad4[_0x354e('0x3e')]=qs[_0x354e('0x35')](_[_0x354e('0x3f')](_0x42398d[_0x354e('0x33')],_0x180f76[_0x354e('0x35')]));if(_0x42398d['query'][_0x354e('0x40')]){_0x4d7ad4['where']=_[_0x354e('0x48')](_0x4d7ad4[_0x354e('0x3e')],{'$or':_[_0x354e('0x2c')](_0x4d7ad4['attributes'],function(_0x29af8b){var _0x5c9679={};_0x5c9679[_0x29af8b]={'$like':'%'+_0x42398d[_0x354e('0x33')][_0x354e('0x40')]+'%'};return _0x5c9679;})});}_0x4d7ad4=_[_0x354e('0x48')]({},_0x4d7ad4,_0x42398d[_0x354e('0x41')]);return _0x4794c2[_0x354e('0x88')](_0x4d7ad4);}})[_0x354e('0x24')](function(_0x46c547){if(_0x46c547){_0x1c89bc=_0x46c547[_0x354e('0x39')];if(!_0x42398d[_0x354e('0x33')][_0x354e('0x54')]('nolimit')){_0x4d7ad4[_0x354e('0x3b')]=qs[_0x354e('0x3b')](_0x42398d[_0x354e('0x33')][_0x354e('0x3b')]);_0x4d7ad4[_0x354e('0x21')]=qs[_0x354e('0x21')](_0x42398d['query']['offset']);}return _0x4794c2[_0x354e('0x88')](_0x4d7ad4);}})[_0x354e('0x24')](function(_0x1a088d){if(_0x1a088d){return _0x1a088d?{'count':_0x1c89bc,'rows':_0x1a088d}:null;}})[_0x354e('0x24')](respondWithResult(_0x1e11c0,null))[_0x354e('0x45')](handleError(_0x1e11c0,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 9a0dcf7..16b5a28 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 _0xaad8=['events','../../mysqldb','WhatsappQueue','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0xef8817,_0x140adc){var _0x3098a2=function(_0x1ef414){while(--_0x1ef414){_0xef8817['push'](_0xef8817['shift']());}};_0x3098a2(++_0x140adc);}(_0xaad8,0x168));var _0x8aad=function(_0x233e90,_0x418241){_0x233e90=_0x233e90-0x0;var _0x519559=_0xaad8[_0x233e90];return _0x519559;};'use strict';var EventEmitter=require(_0x8aad('0x0'));var WhatsappQueue=require(_0x8aad('0x1'))['db'][_0x8aad('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x8aad('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x8aad('0x4'),'afterDestroy':_0x8aad('0x5')};function emitEvent(_0x11b1b4){return function(_0x11a216,_0x35b3af,_0x10ca6d){WhatsappQueueEvents[_0x8aad('0x6')](_0x11b1b4+':'+_0x11a216['id'],_0x11a216);WhatsappQueueEvents['emit'](_0x11b1b4,_0x11a216);_0x10ca6d(null);};}for(var e in events){if(events[_0x8aad('0x7')](e)){var event=events[e];WhatsappQueue[_0x8aad('0x8')](e,emitEvent(event));}}module['exports']=WhatsappQueueEvents; \ No newline at end of file +var _0x2e40=['WhatsappQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0xd8d361,_0x9f74d4){var _0x2ad13a=function(_0x25a76f){while(--_0x25a76f){_0xd8d361['push'](_0xd8d361['shift']());}};_0x2ad13a(++_0x9f74d4);}(_0x2e40,0x13d));var _0x02e4=function(_0x4651db,_0x74c2e7){_0x4651db=_0x4651db-0x0;var _0x57a236=_0x2e40[_0x4651db];return _0x57a236;};'use strict';var EventEmitter=require(_0x02e4('0x0'));var WhatsappQueue=require(_0x02e4('0x1'))['db'][_0x02e4('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x02e4('0x3')](0x0);var events={'afterCreate':_0x02e4('0x4'),'afterUpdate':_0x02e4('0x5'),'afterDestroy':_0x02e4('0x6')};function emitEvent(_0x4d0108){return function(_0x5e6863,_0x251a34,_0xd797ad){WhatsappQueueEvents[_0x02e4('0x7')](_0x4d0108+':'+_0x5e6863['id'],_0x5e6863);WhatsappQueueEvents['emit'](_0x4d0108,_0x5e6863);_0xd797ad(null);};}for(var e in events){if(events[_0x02e4('0x8')](e)){var event=events[e];WhatsappQueue[_0x02e4('0x9')](e,emitEvent(event));}}module[_0x02e4('0xa')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index b8f032c..9c2acd9 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 _0xd095=['request-promise','path','rimraf','./whatsappQueue.attributes','exports','define','WhatsappQueue','whatsapp_queues','lodash','util','../../config/logger','bluebird'];(function(_0x122e9b,_0x391bf4){var _0x22c247=function(_0x1b2c65){while(--_0x1b2c65){_0x122e9b['push'](_0x122e9b['shift']());}};_0x22c247(++_0x391bf4);}(_0xd095,0x1a0));var _0x5d09=function(_0x525c7b,_0x488fcc){_0x525c7b=_0x525c7b-0x0;var _0x27b33e=_0xd095[_0x525c7b];return _0x27b33e;};'use strict';var _=require(_0x5d09('0x0'));var util=require(_0x5d09('0x1'));var logger=require(_0x5d09('0x2'))('api');var moment=require('moment');var BPromise=require(_0x5d09('0x3'));var rp=require(_0x5d09('0x4'));var fs=require('fs');var path=require(_0x5d09('0x5'));var rimraf=require(_0x5d09('0x6'));var config=require('../../config/environment');var attributes=require(_0x5d09('0x7'));module[_0x5d09('0x8')]=function(_0x1adfcb,_0x41f3a8){return _0x1adfcb[_0x5d09('0x9')](_0x5d09('0xa'),attributes,{'tableName':_0x5d09('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9c54=['exports','define','WhatsappQueue','whatsapp_queues','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./whatsappQueue.attributes'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x9c54,0x90));var _0x49c5=function(_0x36c4cd,_0x5ea777){_0x36c4cd=_0x36c4cd-0x0;var _0x1d4a7b=_0x9c54[_0x36c4cd];return _0x1d4a7b;};'use strict';var _=require(_0x49c5('0x0'));var util=require(_0x49c5('0x1'));var logger=require(_0x49c5('0x2'))(_0x49c5('0x3'));var moment=require(_0x49c5('0x4'));var BPromise=require(_0x49c5('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x49c5('0x6'));var rimraf=require(_0x49c5('0x7'));var config=require(_0x49c5('0x8'));var attributes=require(_0x49c5('0x9'));module[_0x49c5('0xa')]=function(_0x3de98b,_0x53dcec){return _0x3de98b[_0x49c5('0xb')](_0x49c5('0xc'),attributes,{'tableName':_0x49c5('0xd'),'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 531e907..a4915dd 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 _0x1622=['request','then','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetWhatsappQueue','WhatsappQueue','findAll','options','raw','where','attributes','limit','map','include','model','find','ShowWhatsappQueue','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./whatsappQueue.socket','register'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1622,0x1f2));var _0x2162=function(_0x2e8fd1,_0x17377c){_0x2e8fd1=_0x2e8fd1-0x0;var _0x1d6927=_0x1622[_0x2e8fd1];return _0x1d6927;};'use strict';var _=require('lodash');var util=require(_0x2162('0x0'));var moment=require(_0x2162('0x1'));var BPromise=require(_0x2162('0x2'));var rs=require(_0x2162('0x3'));var fs=require('fs');var Redis=require(_0x2162('0x4'));var db=require(_0x2162('0x5'))['db'];var utils=require(_0x2162('0x6'));var logger=require(_0x2162('0x7'))(_0x2162('0x8'));var config=require(_0x2162('0x9'));var jayson=require(_0x2162('0xa'));var client=jayson[_0x2162('0xb')][_0x2162('0xc')]({'port':0x232a});config[_0x2162('0xd')]=_['defaults'](config['redis'],{'host':_0x2162('0xe'),'port':0x18eb});var socket=require(_0x2162('0xf'))(new Redis(config[_0x2162('0xd')]));require(_0x2162('0x10'))[_0x2162('0x11')](socket);function respondWithRpcPromise(_0x3e48cb,_0x327fcc,_0x551820){return new BPromise(function(_0xba9d2a,_0x477b0b){return client[_0x2162('0x12')](_0x3e48cb,_0x551820)[_0x2162('0x13')](function(_0x473794){logger[_0x2162('0x14')](_0x2162('0x15'),_0x327fcc,_0x2162('0x16'));logger[_0x2162('0x17')](_0x2162('0x18'),_0x327fcc,_0x2162('0x16'),JSON[_0x2162('0x19')](_0x473794));if(_0x473794[_0x2162('0x1a')]){if(_0x473794['error']['code']===0x1f4){logger['error'](_0x2162('0x15'),_0x327fcc,_0x473794[_0x2162('0x1a')][_0x2162('0x1b')]);return _0x477b0b(_0x473794[_0x2162('0x1a')][_0x2162('0x1b')]);}logger[_0x2162('0x1a')]('WhatsappQueue,\x20%s,\x20%s',_0x327fcc,_0x473794['error'][_0x2162('0x1b')]);return _0xba9d2a(_0x473794[_0x2162('0x1a')]['message']);}else{logger[_0x2162('0x14')](_0x2162('0x15'),_0x327fcc,'request\x20sent');_0xba9d2a(_0x473794[_0x2162('0x1c')][_0x2162('0x1b')]);}})[_0x2162('0x1d')](function(_0x3385ca){logger[_0x2162('0x1a')](_0x2162('0x15'),_0x327fcc,_0x3385ca);_0x477b0b(_0x3385ca);});});}exports[_0x2162('0x1e')]=function(_0x37d948){var _0x5beff3=this;return new Promise(function(_0x22d593,_0x51b926){return db[_0x2162('0x1f')][_0x2162('0x20')]({'raw':_0x37d948[_0x2162('0x21')]?_0x37d948[_0x2162('0x21')][_0x2162('0x22')]===undefined?!![]:![]:!![],'where':_0x37d948[_0x2162('0x21')]?_0x37d948[_0x2162('0x21')][_0x2162('0x23')]||null:null,'attributes':_0x37d948[_0x2162('0x21')]?_0x37d948[_0x2162('0x21')][_0x2162('0x24')]||null:null,'limit':_0x37d948[_0x2162('0x21')]?_0x37d948[_0x2162('0x21')][_0x2162('0x25')]||null:null,'include':_0x37d948[_0x2162('0x21')]?_0x37d948['options']['include']?_[_0x2162('0x26')](_0x37d948[_0x2162('0x21')][_0x2162('0x27')],function(_0x275fb2){return{'model':db[_0x275fb2[_0x2162('0x28')]],'as':_0x275fb2['as'],'attributes':_0x275fb2[_0x2162('0x24')],'include':_0x275fb2[_0x2162('0x27')]?_['map'](_0x275fb2[_0x2162('0x27')],function(_0x359cc1){return{'model':db[_0x359cc1[_0x2162('0x28')]],'as':_0x359cc1['as'],'attributes':_0x359cc1[_0x2162('0x24')],'include':_0x359cc1[_0x2162('0x27')]?_[_0x2162('0x26')](_0x359cc1['include'],function(_0x528811){return{'model':db[_0x528811[_0x2162('0x28')]],'as':_0x528811['as'],'attributes':_0x528811[_0x2162('0x24')]};}):[]};}):[]};}):[]:[]})[_0x2162('0x13')](function(_0x826e51){logger[_0x2162('0x14')](_0x2162('0x1e'),_0x37d948);logger[_0x2162('0x17')](_0x2162('0x1e'),_0x37d948,JSON[_0x2162('0x19')](_0x826e51));_0x22d593(_0x826e51);})['catch'](function(_0x25a6e6){logger['error'](_0x2162('0x1e'),_0x25a6e6[_0x2162('0x1b')],_0x37d948);_0x51b926(_0x5beff3['error'](0x1f4,_0x25a6e6[_0x2162('0x1b')]));});});};exports['ShowWhatsappQueue']=function(_0x33bb85){var _0x4fb9af=this;return new Promise(function(_0x12e8f6,_0xc535d8){return db['WhatsappQueue'][_0x2162('0x29')]({'raw':_0x33bb85['options']?_0x33bb85['options'][_0x2162('0x22')]===undefined?!![]:![]:!![],'where':_0x33bb85['options']?_0x33bb85[_0x2162('0x21')]['where']||null:null,'attributes':_0x33bb85['options']?_0x33bb85[_0x2162('0x21')]['attributes']||null:null,'include':_0x33bb85[_0x2162('0x21')]?_0x33bb85['options']['include']?_['map'](_0x33bb85[_0x2162('0x21')][_0x2162('0x27')],function(_0x3688a7){return{'model':db[_0x3688a7['model']],'as':_0x3688a7['as'],'attributes':_0x3688a7[_0x2162('0x24')],'include':_0x3688a7['include']?_[_0x2162('0x26')](_0x3688a7[_0x2162('0x27')],function(_0x3528f5){return{'model':db[_0x3528f5[_0x2162('0x28')]],'as':_0x3528f5['as'],'attributes':_0x3528f5[_0x2162('0x24')],'include':_0x3528f5[_0x2162('0x27')]?_[_0x2162('0x26')](_0x3528f5[_0x2162('0x27')],function(_0x1079de){return{'model':db[_0x1079de[_0x2162('0x28')]],'as':_0x1079de['as'],'attributes':_0x1079de['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4e5a07){logger['info'](_0x2162('0x2a'),_0x33bb85);logger[_0x2162('0x17')](_0x2162('0x2a'),_0x33bb85,JSON['stringify'](_0x4e5a07));_0x12e8f6(_0x4e5a07);})[_0x2162('0x1d')](function(_0x188161){logger[_0x2162('0x1a')](_0x2162('0x2a'),_0x188161[_0x2162('0x1b')],_0x33bb85);_0xc535d8(_0x4fb9af[_0x2162('0x1a')](0x1f4,_0x188161[_0x2162('0x1b')]));});});}; \ No newline at end of file +var _0x4768=['result','GetWhatsappQueue','WhatsappQueue','findAll','options','raw','where','attributes','limit','model','map','include','ShowWhatsappQueue','find','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','defaults','socket.io-emitter','redis','./whatsappQueue.socket','register','request','then','WhatsappQueue,\x20%s,\x20%s','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info'];(function(_0x19b3f9,_0xade753){var _0x18c3f6=function(_0x21439f){while(--_0x21439f){_0x19b3f9['push'](_0x19b3f9['shift']());}};_0x18c3f6(++_0xade753);}(_0x4768,0x89));var _0x8476=function(_0x4a9d87,_0x2cc20f){_0x4a9d87=_0x4a9d87-0x0;var _0x1ad978=_0x4768[_0x4a9d87];return _0x1ad978;};'use strict';var _=require(_0x8476('0x0'));var util=require(_0x8476('0x1'));var moment=require(_0x8476('0x2'));var BPromise=require(_0x8476('0x3'));var rs=require(_0x8476('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8476('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x8476('0x6'));var config=require(_0x8476('0x7'));var jayson=require(_0x8476('0x8'));var client=jayson[_0x8476('0x9')][_0x8476('0xa')]({'port':0x232a});config['redis']=_[_0x8476('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x8476('0xc'))(new Redis(config[_0x8476('0xd')]));require(_0x8476('0xe'))[_0x8476('0xf')](socket);function respondWithRpcPromise(_0x50f906,_0x51594f,_0x39fc7e){return new BPromise(function(_0x5d3794,_0x126f00){return client[_0x8476('0x10')](_0x50f906,_0x39fc7e)[_0x8476('0x11')](function(_0x1e56b2){logger['info'](_0x8476('0x12'),_0x51594f,'request\x20sent');logger[_0x8476('0x13')](_0x8476('0x14'),_0x51594f,_0x8476('0x15'),JSON[_0x8476('0x16')](_0x1e56b2));if(_0x1e56b2[_0x8476('0x17')]){if(_0x1e56b2[_0x8476('0x17')][_0x8476('0x18')]===0x1f4){logger[_0x8476('0x17')](_0x8476('0x12'),_0x51594f,_0x1e56b2['error']['message']);return _0x126f00(_0x1e56b2[_0x8476('0x17')][_0x8476('0x19')]);}logger[_0x8476('0x17')](_0x8476('0x12'),_0x51594f,_0x1e56b2[_0x8476('0x17')]['message']);return _0x5d3794(_0x1e56b2[_0x8476('0x17')][_0x8476('0x19')]);}else{logger[_0x8476('0x1a')](_0x8476('0x12'),_0x51594f,'request\x20sent');_0x5d3794(_0x1e56b2[_0x8476('0x1b')][_0x8476('0x19')]);}})['catch'](function(_0x183e04){logger[_0x8476('0x17')](_0x8476('0x12'),_0x51594f,_0x183e04);_0x126f00(_0x183e04);});});}exports[_0x8476('0x1c')]=function(_0x5515e0){var _0x5a35a3=this;return new Promise(function(_0x1d3209,_0x59d5b4){return db[_0x8476('0x1d')][_0x8476('0x1e')]({'raw':_0x5515e0['options']?_0x5515e0[_0x8476('0x1f')][_0x8476('0x20')]===undefined?!![]:![]:!![],'where':_0x5515e0[_0x8476('0x1f')]?_0x5515e0[_0x8476('0x1f')][_0x8476('0x21')]||null:null,'attributes':_0x5515e0['options']?_0x5515e0[_0x8476('0x1f')][_0x8476('0x22')]||null:null,'limit':_0x5515e0['options']?_0x5515e0['options'][_0x8476('0x23')]||null:null,'include':_0x5515e0[_0x8476('0x1f')]?_0x5515e0[_0x8476('0x1f')]['include']?_['map'](_0x5515e0[_0x8476('0x1f')]['include'],function(_0x7ecd88){return{'model':db[_0x7ecd88[_0x8476('0x24')]],'as':_0x7ecd88['as'],'attributes':_0x7ecd88[_0x8476('0x22')],'include':_0x7ecd88['include']?_[_0x8476('0x25')](_0x7ecd88['include'],function(_0x120904){return{'model':db[_0x120904['model']],'as':_0x120904['as'],'attributes':_0x120904[_0x8476('0x22')],'include':_0x120904[_0x8476('0x26')]?_[_0x8476('0x25')](_0x120904['include'],function(_0x180e61){return{'model':db[_0x180e61[_0x8476('0x24')]],'as':_0x180e61['as'],'attributes':_0x180e61[_0x8476('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x56e434){logger['info'](_0x8476('0x1c'),_0x5515e0);logger['debug']('GetWhatsappQueue',_0x5515e0,JSON['stringify'](_0x56e434));_0x1d3209(_0x56e434);})['catch'](function(_0x225184){logger[_0x8476('0x17')](_0x8476('0x1c'),_0x225184[_0x8476('0x19')],_0x5515e0);_0x59d5b4(_0x5a35a3[_0x8476('0x17')](0x1f4,_0x225184[_0x8476('0x19')]));});});};exports[_0x8476('0x27')]=function(_0x9e01b5){var _0x513d59=this;return new Promise(function(_0x3dcf62,_0x2f7fa0){return db[_0x8476('0x1d')][_0x8476('0x28')]({'raw':_0x9e01b5[_0x8476('0x1f')]?_0x9e01b5[_0x8476('0x1f')][_0x8476('0x20')]===undefined?!![]:![]:!![],'where':_0x9e01b5['options']?_0x9e01b5['options'][_0x8476('0x21')]||null:null,'attributes':_0x9e01b5[_0x8476('0x1f')]?_0x9e01b5['options'][_0x8476('0x22')]||null:null,'include':_0x9e01b5['options']?_0x9e01b5['options'][_0x8476('0x26')]?_[_0x8476('0x25')](_0x9e01b5['options'][_0x8476('0x26')],function(_0x478bfc){return{'model':db[_0x478bfc[_0x8476('0x24')]],'as':_0x478bfc['as'],'attributes':_0x478bfc[_0x8476('0x22')],'include':_0x478bfc['include']?_[_0x8476('0x25')](_0x478bfc[_0x8476('0x26')],function(_0x5a4955){return{'model':db[_0x5a4955[_0x8476('0x24')]],'as':_0x5a4955['as'],'attributes':_0x5a4955[_0x8476('0x22')],'include':_0x5a4955[_0x8476('0x26')]?_[_0x8476('0x25')](_0x5a4955['include'],function(_0x3b05d7){return{'model':db[_0x3b05d7['model']],'as':_0x3b05d7['as'],'attributes':_0x3b05d7[_0x8476('0x22')]};}):[]};}):[]};}):[]:[]})[_0x8476('0x11')](function(_0x366a48){logger[_0x8476('0x1a')](_0x8476('0x27'),_0x9e01b5);logger[_0x8476('0x13')](_0x8476('0x27'),_0x9e01b5,JSON[_0x8476('0x16')](_0x366a48));_0x3dcf62(_0x366a48);})['catch'](function(_0x20eec9){logger[_0x8476('0x17')](_0x8476('0x27'),_0x20eec9['message'],_0x9e01b5);_0x2f7fa0(_0x513d59[_0x8476('0x17')](0x1f4,_0x20eec9[_0x8476('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index dcf8f19..cd16bd9 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 _0x4086=['whatsappQueue:','./whatsappQueue.events','remove','emit','removeListener','register','length'];(function(_0x47fd45,_0x40dd67){var _0x363313=function(_0xb92163){while(--_0xb92163){_0x47fd45['push'](_0x47fd45['shift']());}};_0x363313(++_0x40dd67);}(_0x4086,0x6a));var _0x6408=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x4086[_0x122ef9];return _0x42fba0;};'use strict';var WhatsappQueueEvents=require(_0x6408('0x0'));var events=['save',_0x6408('0x1'),'update'];function createListener(_0x114d74,_0x4673f7){return function(_0x36efa1){_0x4673f7[_0x6408('0x2')](_0x114d74,_0x36efa1);};}function removeListener(_0x332044,_0x26b6c6){return function(){WhatsappQueueEvents[_0x6408('0x3')](_0x332044,_0x26b6c6);};}exports[_0x6408('0x4')]=function(_0x4f16f9){for(var _0x34cf07=0x0,_0xa7e9dd=events[_0x6408('0x5')];_0x34cf07<_0xa7e9dd;_0x34cf07++){var _0x5a8794=events[_0x34cf07];var _0x3069c4=createListener(_0x6408('0x6')+_0x5a8794,_0x4f16f9);WhatsappQueueEvents['on'](_0x5a8794,_0x3069c4);}}; \ No newline at end of file +var _0xb8eb=['whatsappQueue:','./whatsappQueue.events','save','remove','update','emit','removeListener','register','length'];(function(_0x5e4c01,_0x372def){var _0x46029e=function(_0x1dbbf7){while(--_0x1dbbf7){_0x5e4c01['push'](_0x5e4c01['shift']());}};_0x46029e(++_0x372def);}(_0xb8eb,0x17b));var _0xbb8e=function(_0x5a8588,_0x4bbba1){_0x5a8588=_0x5a8588-0x0;var _0x3e06a0=_0xb8eb[_0x5a8588];return _0x3e06a0;};'use strict';var WhatsappQueueEvents=require(_0xbb8e('0x0'));var events=[_0xbb8e('0x1'),_0xbb8e('0x2'),_0xbb8e('0x3')];function createListener(_0x48b88f,_0x59a79b){return function(_0x44347c){_0x59a79b[_0xbb8e('0x4')](_0x48b88f,_0x44347c);};}function removeListener(_0x46d259,_0x36898a){return function(){WhatsappQueueEvents[_0xbb8e('0x5')](_0x46d259,_0x36898a);};}exports[_0xbb8e('0x6')]=function(_0x1345b5){for(var _0x1bc496=0x0,_0x33ba5d=events[_0xbb8e('0x7')];_0x1bc496<_0x33ba5d;_0x1bc496++){var _0x56136e=events[_0x1bc496];var _0x5d851c=createListener(_0xbb8e('0x8')+_0x56136e,_0x1345b5);WhatsappQueueEvents['on'](_0x56136e,_0x5d851c);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index d6707c4..c5c06f6 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 _0x91a7=['show','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','describe','/:id'];(function(_0x536a51,_0x2bf510){var _0x4a4d9e=function(_0x20deef){while(--_0x20deef){_0x536a51['push'](_0x536a51['shift']());}};_0x4a4d9e(++_0x2bf510);}(_0x91a7,0x6c));var _0x791a=function(_0x2179e2,_0x494572){_0x2179e2=_0x2179e2-0x0;var _0x2e262f=_0x91a7[_0x2179e2];return _0x2e262f;};'use strict';var multer=require(_0x791a('0x0'));var util=require(_0x791a('0x1'));var path=require(_0x791a('0x2'));var timeout=require('connect-timeout');var express=require(_0x791a('0x3'));var router=express[_0x791a('0x4')]();var auth=require(_0x791a('0x5'));var interaction=require(_0x791a('0x6'));var config=require(_0x791a('0x7'));var controller=require('./whatsappQueueReport.controller');router[_0x791a('0x8')]('/',auth[_0x791a('0x9')](),controller['index']);router[_0x791a('0x8')]('/describe',auth[_0x791a('0x9')](),controller[_0x791a('0xa')]);router[_0x791a('0x8')](_0x791a('0xb'),auth[_0x791a('0x9')](),controller[_0x791a('0xc')]);router[_0x791a('0xd')]('/',auth['isAuthenticated'](),controller[_0x791a('0xe')]);router[_0x791a('0xf')](_0x791a('0xb'),auth['isAuthenticated'](),controller[_0x791a('0x10')]);router[_0x791a('0x11')](_0x791a('0xb'),auth[_0x791a('0x9')](),controller[_0x791a('0x12')]);module[_0x791a('0x13')]=router; \ No newline at end of file +var _0xb9f4=['get','/describe','describe','/:id','post','create','put','delete','destroy','exports','util','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','isAuthenticated','index'];(function(_0x1a1131,_0x404e25){var _0x2a73ee=function(_0x18690f){while(--_0x18690f){_0x1a1131['push'](_0x1a1131['shift']());}};_0x2a73ee(++_0x404e25);}(_0xb9f4,0xf4));var _0x4b9f=function(_0x39275d,_0x434a76){_0x39275d=_0x39275d-0x0;var _0x5803a9=_0xb9f4[_0x39275d];return _0x5803a9;};'use strict';var multer=require('multer');var util=require(_0x4b9f('0x0'));var path=require('path');var timeout=require(_0x4b9f('0x1'));var express=require('express');var router=express['Router']();var auth=require(_0x4b9f('0x2'));var interaction=require(_0x4b9f('0x3'));var config=require(_0x4b9f('0x4'));var controller=require(_0x4b9f('0x5'));router['get']('/',auth[_0x4b9f('0x6')](),controller[_0x4b9f('0x7')]);router[_0x4b9f('0x8')](_0x4b9f('0x9'),auth[_0x4b9f('0x6')](),controller[_0x4b9f('0xa')]);router[_0x4b9f('0x8')](_0x4b9f('0xb'),auth[_0x4b9f('0x6')](),controller['show']);router[_0x4b9f('0xc')]('/',auth[_0x4b9f('0x6')](),controller[_0x4b9f('0xd')]);router[_0x4b9f('0xe')](_0x4b9f('0xb'),auth[_0x4b9f('0x6')](),controller['update']);router[_0x4b9f('0xf')](_0x4b9f('0xb'),auth[_0x4b9f('0x6')](),controller[_0x4b9f('0x10')]);module[_0x4b9f('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 dd278a3..03593c1 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 _0x8ef6=['STRING','DATE','sequelize','exports'];(function(_0x2ee31e,_0x37affb){var _0x20eab2=function(_0x4febf0){while(--_0x4febf0){_0x2ee31e['push'](_0x2ee31e['shift']());}};_0x20eab2(++_0x37affb);}(_0x8ef6,0xf2));var _0x68ef=function(_0x2ef3f5,_0x505fbb){_0x2ef3f5=_0x2ef3f5-0x0;var _0x11c670=_0x8ef6[_0x2ef3f5];return _0x11c670;};'use strict';var Sequelize=require(_0x68ef('0x0'));module[_0x68ef('0x1')]={'uniqueid':{'type':Sequelize[_0x68ef('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x68ef('0x2')]},'joinAt':{'type':Sequelize[_0x68ef('0x3')]},'leaveAt':{'type':Sequelize[_0x68ef('0x3')]},'acceptAt':{'type':Sequelize[_0x68ef('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x68ef('0x2')]}}; \ No newline at end of file +var _0x3e74=['DATE','sequelize','STRING'];(function(_0x2ae2ad,_0xac5b0c){var _0x26dbd7=function(_0x5e685b){while(--_0x5e685b){_0x2ae2ad['push'](_0x2ae2ad['shift']());}};_0x26dbd7(++_0xac5b0c);}(_0x3e74,0x175));var _0x43e7=function(_0x5ef69b,_0x2f4ed8){_0x5ef69b=_0x5ef69b-0x0;var _0x196aa7=_0x3e74[_0x5ef69b];return _0x196aa7;};'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 ad3be3e..59b6555 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 _0x9e9f=['sort','filters','pick','filter','where','merge','VIRTUAL','then','count','includeAll','include','findAll','rows','catch','show','params','length','options','find','create','body','destroy','describe','html-pdf','eml-format','rimraf','request-promise','moment','mustache','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../mysqldb','status','end','json','offset','limit','set','Content-Range','apply','reject','update','sendStatus','error','stack','name','send','index','map','WhatsappQueueReport','fieldName','type','model','keys','query','attributes','intersection','fields','hasOwnProperty','nolimit','order'];(function(_0x48a552,_0x126263){var _0x277289=function(_0x2ac14b){while(--_0x2ac14b){_0x48a552['push'](_0x48a552['shift']());}};_0x277289(++_0x126263);}(_0x9e9f,0x1cd));var _0xf9e9=function(_0x3fd3a3,_0x36c863){_0x3fd3a3=_0x3fd3a3-0x0;var _0xa3e4d5=_0x9e9f[_0x3fd3a3];return _0xa3e4d5;};'use strict';var pdf=require(_0xf9e9('0x0'));var emlformat=require(_0xf9e9('0x1'));var rimraf=require(_0xf9e9('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf9e9('0x3'));var moment=require(_0xf9e9('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf9e9('0x5'));var util=require('util');var path=require('path');var sox=require(_0xf9e9('0x6'));var csv=require('to-csv');var ejs=require(_0xf9e9('0x7'));var fs=require('fs');var _=require(_0xf9e9('0x8'));var squel=require(_0xf9e9('0x9'));var crypto=require(_0xf9e9('0xa'));var jsforce=require(_0xf9e9('0xb'));var deskjs=require(_0xf9e9('0xc'));var toCsv=require(_0xf9e9('0xd'));var querystring=require(_0xf9e9('0xe'));var Papa=require(_0xf9e9('0xf'));var Redis=require('ioredis');var authService=require(_0xf9e9('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xf9e9('0x11'));var hardwareService=require(_0xf9e9('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0xf9e9('0x13'));var config=require('../../config/environment');var db=require(_0xf9e9('0x14'))['db'];function respondWithStatusCode(_0x499e94,_0x568de9){_0x568de9=_0x568de9||0xcc;return function(_0x1814bd){if(_0x1814bd){return _0x499e94['sendStatus'](_0x568de9);}return _0x499e94[_0xf9e9('0x15')](_0x568de9)[_0xf9e9('0x16')]();};}function respondWithResult(_0x336c8d,_0x4be565){_0x4be565=_0x4be565||0xc8;return function(_0x125f9a){if(_0x125f9a){return _0x336c8d['status'](_0x4be565)[_0xf9e9('0x17')](_0x125f9a);}};}function respondWithFilteredResult(_0x2d780d,_0x499c17){return function(_0x39713c){if(_0x39713c){var _0x4e9a6a=_0x39713c['count'],_0x411612=_0x499c17['offset'],_0x1f3bbe=_0x499c17[_0xf9e9('0x18')]+_0x499c17[_0xf9e9('0x19')],_0x463123;if(_0x1f3bbe>=_0x4e9a6a){_0x1f3bbe=_0x4e9a6a;_0x463123=0xc8;}else{_0x463123=0xce;}_0x2d780d['status'](_0x463123);return _0x2d780d[_0xf9e9('0x1a')](_0xf9e9('0x1b'),_0x411612+'-'+_0x1f3bbe+'/'+_0x4e9a6a)['json'](_0x39713c);}return null;};}function patchUpdates(_0x42fbe4){return function(_0x2e81c8){try{jsonpatch[_0xf9e9('0x1c')](_0x2e81c8,_0x42fbe4,!![]);}catch(_0x522c82){return BPromise[_0xf9e9('0x1d')](_0x522c82);}return _0x2e81c8['save']();};}function saveUpdates(_0xcb89eb,_0x49b204){return function(_0x164cfb){if(_0x164cfb){return _0x164cfb[_0xf9e9('0x1e')](_0xcb89eb)['then'](function(_0x3b786c){return _0x3b786c;});}return null;};}function removeEntity(_0x3aedb9,_0x59f36f){return function(_0x5ae605){if(_0x5ae605){return _0x5ae605['destroy']()['then'](function(){_0x3aedb9[_0xf9e9('0x15')](0xcc)[_0xf9e9('0x16')]();});}};}function handleEntityNotFound(_0x3c646b,_0xd7bc92){return function(_0x5d8941){if(!_0x5d8941){_0x3c646b[_0xf9e9('0x1f')](0x194);}return _0x5d8941;};}function handleError(_0x39b945,_0x5af98c){_0x5af98c=_0x5af98c||0x1f4;return function(_0x5459de){logger[_0xf9e9('0x20')](_0x5459de[_0xf9e9('0x21')]);if(_0x5459de[_0xf9e9('0x22')]){delete _0x5459de['name'];}_0x39b945[_0xf9e9('0x15')](_0x5af98c)[_0xf9e9('0x23')](_0x5459de);};}exports[_0xf9e9('0x24')]=function(_0x3b3358,_0x19a7d3){var _0x3ec76b={},_0x5e2aef={},_0x187e44={'count':0x0,'rows':[]};var _0x547443=_[_0xf9e9('0x25')](db[_0xf9e9('0x26')]['rawAttributes'],function(_0x2c3a16){return{'name':_0x2c3a16[_0xf9e9('0x27')],'type':_0x2c3a16[_0xf9e9('0x28')]['key']};});_0x5e2aef[_0xf9e9('0x29')]=_['map'](_0x547443,_0xf9e9('0x22'));_0x5e2aef['query']=_[_0xf9e9('0x2a')](_0x3b3358[_0xf9e9('0x2b')]);_0x5e2aef['filters']=_['intersection'](_0x5e2aef['model'],_0x5e2aef[_0xf9e9('0x2b')]);_0x3ec76b[_0xf9e9('0x2c')]=_[_0xf9e9('0x2d')](_0x5e2aef[_0xf9e9('0x29')],qs[_0xf9e9('0x2e')](_0x3b3358[_0xf9e9('0x2b')][_0xf9e9('0x2e')]));_0x3ec76b['attributes']=_0x3ec76b['attributes']['length']?_0x3ec76b[_0xf9e9('0x2c')]:_0x5e2aef['model'];if(!_0x3b3358['query'][_0xf9e9('0x2f')](_0xf9e9('0x30'))){_0x3ec76b['limit']=qs[_0xf9e9('0x19')](_0x3b3358[_0xf9e9('0x2b')][_0xf9e9('0x19')]);_0x3ec76b['offset']=qs[_0xf9e9('0x18')](_0x3b3358[_0xf9e9('0x2b')][_0xf9e9('0x18')]);}_0x3ec76b[_0xf9e9('0x31')]=qs[_0xf9e9('0x32')](_0x3b3358['query'][_0xf9e9('0x32')]);_0x3ec76b['where']=qs[_0xf9e9('0x33')](_[_0xf9e9('0x34')](_0x3b3358[_0xf9e9('0x2b')],_0x5e2aef[_0xf9e9('0x33')]),_0x547443);if(_0x3b3358['query'][_0xf9e9('0x35')]){_0x3ec76b[_0xf9e9('0x36')]=_[_0xf9e9('0x37')](_0x3ec76b['where'],{'$or':_[_0xf9e9('0x25')](_0x547443,function(_0x223fff){if(_0x223fff[_0xf9e9('0x28')]!==_0xf9e9('0x38')){var _0x6e49e0={};_0x6e49e0[_0x223fff[_0xf9e9('0x22')]]={'$like':'%'+_0x3b3358[_0xf9e9('0x2b')]['filter']+'%'};return _0x6e49e0;}})});}_0x3ec76b=_[_0xf9e9('0x37')]({},_0x3ec76b,_0x3b3358['options']);var _0x3bc363={'where':_0x3ec76b[_0xf9e9('0x36')]};return db[_0xf9e9('0x26')]['count'](_0x3bc363)[_0xf9e9('0x39')](function(_0x3e875e){_0x187e44[_0xf9e9('0x3a')]=_0x3e875e;if(_0x3b3358[_0xf9e9('0x2b')][_0xf9e9('0x3b')]){_0x3ec76b[_0xf9e9('0x3c')]=[{'all':!![]}];}return db[_0xf9e9('0x26')][_0xf9e9('0x3d')](_0x3ec76b);})['then'](function(_0x2bb55e){_0x187e44[_0xf9e9('0x3e')]=_0x2bb55e;return _0x187e44;})[_0xf9e9('0x39')](respondWithFilteredResult(_0x19a7d3,_0x3ec76b))[_0xf9e9('0x3f')](handleError(_0x19a7d3,null));};exports[_0xf9e9('0x40')]=function(_0x587d78,_0x1e26d8){var _0x456aa0={'raw':!![],'where':{'id':_0x587d78[_0xf9e9('0x41')]['id']}},_0x570bc3={};_0x570bc3[_0xf9e9('0x29')]=_[_0xf9e9('0x2a')](db[_0xf9e9('0x26')]['rawAttributes']);_0x570bc3[_0xf9e9('0x2b')]=_['keys'](_0x587d78[_0xf9e9('0x2b')]);_0x570bc3[_0xf9e9('0x33')]=_[_0xf9e9('0x2d')](_0x570bc3[_0xf9e9('0x29')],_0x570bc3[_0xf9e9('0x2b')]);_0x456aa0[_0xf9e9('0x2c')]=_[_0xf9e9('0x2d')](_0x570bc3[_0xf9e9('0x29')],qs[_0xf9e9('0x2e')](_0x587d78['query'][_0xf9e9('0x2e')]));_0x456aa0[_0xf9e9('0x2c')]=_0x456aa0['attributes'][_0xf9e9('0x42')]?_0x456aa0[_0xf9e9('0x2c')]:_0x570bc3[_0xf9e9('0x29')];if(_0x587d78[_0xf9e9('0x2b')]['includeAll']){_0x456aa0[_0xf9e9('0x3c')]=[{'all':!![]}];}_0x456aa0=_[_0xf9e9('0x37')]({},_0x456aa0,_0x587d78[_0xf9e9('0x43')]);return db[_0xf9e9('0x26')][_0xf9e9('0x44')](_0x456aa0)[_0xf9e9('0x39')](handleEntityNotFound(_0x1e26d8,null))[_0xf9e9('0x39')](respondWithResult(_0x1e26d8,null))[_0xf9e9('0x3f')](handleError(_0x1e26d8,null));};exports[_0xf9e9('0x45')]=function(_0x22d386,_0x5d4f6a){return db[_0xf9e9('0x26')]['create'](_0x22d386['body'],{})[_0xf9e9('0x39')](respondWithResult(_0x5d4f6a,0xc9))[_0xf9e9('0x3f')](handleError(_0x5d4f6a,null));};exports[_0xf9e9('0x1e')]=function(_0x32e388,_0x2156b9){if(_0x32e388[_0xf9e9('0x46')]['id']){delete _0x32e388[_0xf9e9('0x46')]['id'];}return db[_0xf9e9('0x26')][_0xf9e9('0x44')]({'where':{'id':_0x32e388[_0xf9e9('0x41')]['id']}})['then'](handleEntityNotFound(_0x2156b9,null))[_0xf9e9('0x39')](saveUpdates(_0x32e388['body'],null))['then'](respondWithResult(_0x2156b9,null))[_0xf9e9('0x3f')](handleError(_0x2156b9,null));};exports[_0xf9e9('0x47')]=function(_0x14aee6,_0x25264d){return db[_0xf9e9('0x26')][_0xf9e9('0x44')]({'where':{'id':_0x14aee6['params']['id']}})[_0xf9e9('0x39')](handleEntityNotFound(_0x25264d,null))[_0xf9e9('0x39')](removeEntity(_0x25264d,null))[_0xf9e9('0x3f')](handleError(_0x25264d,null));};exports[_0xf9e9('0x48')]=function(_0x49e1f2,_0x2adf9d){return db[_0xf9e9('0x26')][_0xf9e9('0x48')]()['then'](respondWithResult(_0x2adf9d,null))[_0xf9e9('0x3f')](handleError(_0x2adf9d,null));}; \ No newline at end of file +var _0x38c1=['status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','error','stack','send','index','map','WhatsappQueueReport','rawAttributes','fieldName','type','key','model','name','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','count','includeAll','include','findAll','rows','catch','params','keys','find','create','body','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','sendStatus'];(function(_0x2cdec6,_0x39d4c8){var _0xa36703=function(_0x6bb8d4){while(--_0x6bb8d4){_0x2cdec6['push'](_0x2cdec6['shift']());}};_0xa36703(++_0x39d4c8);}(_0x38c1,0x7f));var _0x138c=function(_0x2906e6,_0x5ccd59){_0x2906e6=_0x2906e6-0x0;var _0x12517a=_0x38c1[_0x2906e6];return _0x12517a;};'use strict';var pdf=require(_0x138c('0x0'));var emlformat=require(_0x138c('0x1'));var rimraf=require(_0x138c('0x2'));var zipdir=require(_0x138c('0x3'));var jsonpatch=require(_0x138c('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x138c('0x5'));var Mustache=require(_0x138c('0x6'));var util=require(_0x138c('0x7'));var path=require(_0x138c('0x8'));var sox=require(_0x138c('0x9'));var csv=require(_0x138c('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x138c('0xb'));var squel=require(_0x138c('0xc'));var crypto=require(_0x138c('0xd'));var jsforce=require(_0x138c('0xe'));var deskjs=require(_0x138c('0xf'));var toCsv=require(_0x138c('0xa'));var querystring=require(_0x138c('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x138c('0x11'));var qs=require(_0x138c('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x138c('0x13'))('api');var utils=require(_0x138c('0x14'));var config=require(_0x138c('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2d4304,_0x11f8b5){_0x11f8b5=_0x11f8b5||0xcc;return function(_0x518468){if(_0x518468){return _0x2d4304[_0x138c('0x16')](_0x11f8b5);}return _0x2d4304[_0x138c('0x17')](_0x11f8b5)[_0x138c('0x18')]();};}function respondWithResult(_0x982acb,_0x5313c6){_0x5313c6=_0x5313c6||0xc8;return function(_0xf42e9b){if(_0xf42e9b){return _0x982acb[_0x138c('0x17')](_0x5313c6)[_0x138c('0x19')](_0xf42e9b);}};}function respondWithFilteredResult(_0x5ea68e,_0x2a4ae3){return function(_0x1a3560){if(_0x1a3560){var _0x2ab6ae=_0x1a3560['count'],_0x2b2fd8=_0x2a4ae3[_0x138c('0x1a')],_0x2dd28c=_0x2a4ae3[_0x138c('0x1a')]+_0x2a4ae3[_0x138c('0x1b')],_0x466033;if(_0x2dd28c>=_0x2ab6ae){_0x2dd28c=_0x2ab6ae;_0x466033=0xc8;}else{_0x466033=0xce;}_0x5ea68e[_0x138c('0x17')](_0x466033);return _0x5ea68e[_0x138c('0x1c')](_0x138c('0x1d'),_0x2b2fd8+'-'+_0x2dd28c+'/'+_0x2ab6ae)['json'](_0x1a3560);}return null;};}function patchUpdates(_0x10e116){return function(_0x3372d2){try{jsonpatch[_0x138c('0x1e')](_0x3372d2,_0x10e116,!![]);}catch(_0x2d55a5){return BPromise[_0x138c('0x1f')](_0x2d55a5);}return _0x3372d2[_0x138c('0x20')]();};}function saveUpdates(_0x3ab516,_0x156738){return function(_0xb4b501){if(_0xb4b501){return _0xb4b501[_0x138c('0x21')](_0x3ab516)['then'](function(_0x1bf724){return _0x1bf724;});}return null;};}function removeEntity(_0x5bcd4a,_0x9225f6){return function(_0x5db8e0){if(_0x5db8e0){return _0x5db8e0['destroy']()[_0x138c('0x22')](function(){_0x5bcd4a['status'](0xcc)[_0x138c('0x18')]();});}};}function handleEntityNotFound(_0x114df4,_0x2aa302){return function(_0x14ad50){if(!_0x14ad50){_0x114df4[_0x138c('0x16')](0x194);}return _0x14ad50;};}function handleError(_0xf6f96d,_0xd6cc72){_0xd6cc72=_0xd6cc72||0x1f4;return function(_0x43ff82){logger[_0x138c('0x23')](_0x43ff82[_0x138c('0x24')]);if(_0x43ff82['name']){delete _0x43ff82['name'];}_0xf6f96d[_0x138c('0x17')](_0xd6cc72)[_0x138c('0x25')](_0x43ff82);};}exports[_0x138c('0x26')]=function(_0x22392e,_0x3185c9){var _0x6db084={},_0x5da206={},_0x14d5f2={'count':0x0,'rows':[]};var _0x3fbce2=_[_0x138c('0x27')](db[_0x138c('0x28')][_0x138c('0x29')],function(_0x50b4bf){return{'name':_0x50b4bf[_0x138c('0x2a')],'type':_0x50b4bf[_0x138c('0x2b')][_0x138c('0x2c')]};});_0x5da206[_0x138c('0x2d')]=_['map'](_0x3fbce2,_0x138c('0x2e'));_0x5da206['query']=_['keys'](_0x22392e[_0x138c('0x2f')]);_0x5da206['filters']=_[_0x138c('0x30')](_0x5da206[_0x138c('0x2d')],_0x5da206['query']);_0x6db084['attributes']=_[_0x138c('0x30')](_0x5da206[_0x138c('0x2d')],qs[_0x138c('0x31')](_0x22392e[_0x138c('0x2f')][_0x138c('0x31')]));_0x6db084[_0x138c('0x32')]=_0x6db084[_0x138c('0x32')][_0x138c('0x33')]?_0x6db084[_0x138c('0x32')]:_0x5da206[_0x138c('0x2d')];if(!_0x22392e[_0x138c('0x2f')][_0x138c('0x34')](_0x138c('0x35'))){_0x6db084[_0x138c('0x1b')]=qs['limit'](_0x22392e[_0x138c('0x2f')]['limit']);_0x6db084['offset']=qs[_0x138c('0x1a')](_0x22392e[_0x138c('0x2f')]['offset']);}_0x6db084[_0x138c('0x36')]=qs[_0x138c('0x37')](_0x22392e[_0x138c('0x2f')][_0x138c('0x37')]);_0x6db084[_0x138c('0x38')]=qs[_0x138c('0x39')](_[_0x138c('0x3a')](_0x22392e['query'],_0x5da206[_0x138c('0x39')]),_0x3fbce2);if(_0x22392e[_0x138c('0x2f')][_0x138c('0x3b')]){_0x6db084[_0x138c('0x38')]=_[_0x138c('0x3c')](_0x6db084[_0x138c('0x38')],{'$or':_[_0x138c('0x27')](_0x3fbce2,function(_0x5265a9){if(_0x5265a9[_0x138c('0x2b')]!==_0x138c('0x3d')){var _0x581791={};_0x581791[_0x5265a9['name']]={'$like':'%'+_0x22392e['query'][_0x138c('0x3b')]+'%'};return _0x581791;}})});}_0x6db084=_['merge']({},_0x6db084,_0x22392e['options']);var _0x349f24={'where':_0x6db084[_0x138c('0x38')]};return db['WhatsappQueueReport'][_0x138c('0x3e')](_0x349f24)[_0x138c('0x22')](function(_0x4f280f){_0x14d5f2[_0x138c('0x3e')]=_0x4f280f;if(_0x22392e['query'][_0x138c('0x3f')]){_0x6db084[_0x138c('0x40')]=[{'all':!![]}];}return db[_0x138c('0x28')][_0x138c('0x41')](_0x6db084);})[_0x138c('0x22')](function(_0x1d5020){_0x14d5f2[_0x138c('0x42')]=_0x1d5020;return _0x14d5f2;})['then'](respondWithFilteredResult(_0x3185c9,_0x6db084))[_0x138c('0x43')](handleError(_0x3185c9,null));};exports['show']=function(_0x491e20,_0x52077f){var _0x59f013={'raw':!![],'where':{'id':_0x491e20[_0x138c('0x44')]['id']}},_0x2bcffc={};_0x2bcffc[_0x138c('0x2d')]=_[_0x138c('0x45')](db[_0x138c('0x28')][_0x138c('0x29')]);_0x2bcffc[_0x138c('0x2f')]=_[_0x138c('0x45')](_0x491e20[_0x138c('0x2f')]);_0x2bcffc[_0x138c('0x39')]=_[_0x138c('0x30')](_0x2bcffc[_0x138c('0x2d')],_0x2bcffc['query']);_0x59f013[_0x138c('0x32')]=_[_0x138c('0x30')](_0x2bcffc[_0x138c('0x2d')],qs['fields'](_0x491e20[_0x138c('0x2f')][_0x138c('0x31')]));_0x59f013[_0x138c('0x32')]=_0x59f013[_0x138c('0x32')][_0x138c('0x33')]?_0x59f013[_0x138c('0x32')]:_0x2bcffc['model'];if(_0x491e20[_0x138c('0x2f')][_0x138c('0x3f')]){_0x59f013['include']=[{'all':!![]}];}_0x59f013=_[_0x138c('0x3c')]({},_0x59f013,_0x491e20['options']);return db[_0x138c('0x28')][_0x138c('0x46')](_0x59f013)[_0x138c('0x22')](handleEntityNotFound(_0x52077f,null))[_0x138c('0x22')](respondWithResult(_0x52077f,null))['catch'](handleError(_0x52077f,null));};exports[_0x138c('0x47')]=function(_0x3d9c23,_0x3aef1b){return db[_0x138c('0x28')][_0x138c('0x47')](_0x3d9c23[_0x138c('0x48')],{})['then'](respondWithResult(_0x3aef1b,0xc9))[_0x138c('0x43')](handleError(_0x3aef1b,null));};exports[_0x138c('0x21')]=function(_0x3425a2,_0x211151){if(_0x3425a2['body']['id']){delete _0x3425a2['body']['id'];}return db['WhatsappQueueReport'][_0x138c('0x46')]({'where':{'id':_0x3425a2[_0x138c('0x44')]['id']}})[_0x138c('0x22')](handleEntityNotFound(_0x211151,null))[_0x138c('0x22')](saveUpdates(_0x3425a2['body'],null))['then'](respondWithResult(_0x211151,null))[_0x138c('0x43')](handleError(_0x211151,null));};exports[_0x138c('0x49')]=function(_0x29765c,_0x178c8e){return db[_0x138c('0x28')][_0x138c('0x46')]({'where':{'id':_0x29765c['params']['id']}})[_0x138c('0x22')](handleEntityNotFound(_0x178c8e,null))['then'](removeEntity(_0x178c8e,null))[_0x138c('0x43')](handleError(_0x178c8e,null));};exports[_0x138c('0x4a')]=function(_0x31916b,_0x4027fb){return db[_0x138c('0x28')]['describe']()[_0x138c('0x22')](respondWithResult(_0x4027fb,null))[_0x138c('0x43')](handleError(_0x4027fb,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index bd8a437..fa615da 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 _0x114a=['bluebird','path','rimraf','../../config/environment','./whatsappQueueReport.attributes','exports','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','../../config/logger'];(function(_0x31ac15,_0x2b8d63){var _0x39101d=function(_0x4cb804){while(--_0x4cb804){_0x31ac15['push'](_0x31ac15['shift']());}};_0x39101d(++_0x2b8d63);}(_0x114a,0x1ee));var _0xa114=function(_0xa91db4,_0x464dfe){_0xa91db4=_0xa91db4-0x0;var _0x17afae=_0x114a[_0xa91db4];return _0x17afae;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xa114('0x0'))('api');var moment=require('moment');var BPromise=require(_0xa114('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa114('0x2'));var rimraf=require(_0xa114('0x3'));var config=require(_0xa114('0x4'));var attributes=require(_0xa114('0x5'));module[_0xa114('0x6')]=function(_0x583475,_0x2acb84){return _0x583475[_0xa114('0x7')](_0xa114('0x8'),attributes,{'tableName':_0xa114('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xa114('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0aa3=['api','moment','path','./whatsappQueueReport.attributes','exports','define','report_whatsapp_queue','uniqueid','util','../../config/logger'];(function(_0x167211,_0x52c558){var _0x395f67=function(_0x107c98){while(--_0x107c98){_0x167211['push'](_0x167211['shift']());}};_0x395f67(++_0x52c558);}(_0x0aa3,0x17a));var _0x30aa=function(_0x17c8f1,_0x58258d){_0x17c8f1=_0x17c8f1-0x0;var _0x3da000=_0x0aa3[_0x17c8f1];return _0x3da000;};'use strict';var _=require('lodash');var util=require(_0x30aa('0x0'));var logger=require(_0x30aa('0x1'))(_0x30aa('0x2'));var moment=require(_0x30aa('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x30aa('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x30aa('0x5'));module[_0x30aa('0x6')]=function(_0x767838,_0xa0922f){return _0x767838[_0x30aa('0x7')]('WhatsappQueueReport',attributes,{'tableName':_0x30aa('0x8'),'paranoid':![],'indexes':[{'name':_0x30aa('0x9'),'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 2ee9240..4bf8440 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 _0xcb45=['options','raw','debug','catch','UpdateWhatsappQueueReport','update','where','limit','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','error','WhatsappQueueReport,\x20%s,\x20%s','message','result','CreateWhatsappQueueReport','WhatsappQueueReport','create','body'];(function(_0x36f4e7,_0x32d905){var _0x2d269d=function(_0x1bb1b7){while(--_0x1bb1b7){_0x36f4e7['push'](_0x36f4e7['shift']());}};_0x2d269d(++_0x32d905);}(_0xcb45,0x110));var _0x5cb4=function(_0x31631a,_0x3f5972){_0x31631a=_0x31631a-0x0;var _0x55ad66=_0xcb45[_0x31631a];return _0x55ad66;};'use strict';var _=require('lodash');var util=require(_0x5cb4('0x0'));var moment=require(_0x5cb4('0x1'));var BPromise=require(_0x5cb4('0x2'));var rs=require(_0x5cb4('0x3'));var fs=require('fs');var Redis=require(_0x5cb4('0x4'));var db=require(_0x5cb4('0x5'))['db'];var utils=require(_0x5cb4('0x6'));var logger=require(_0x5cb4('0x7'))(_0x5cb4('0x8'));var config=require(_0x5cb4('0x9'));var jayson=require(_0x5cb4('0xa'));var client=jayson[_0x5cb4('0xb')][_0x5cb4('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2bb1d6,_0x15229c,_0x7319ab){return new BPromise(function(_0x4aeca6,_0x35853d){return client['request'](_0x2bb1d6,_0x7319ab)[_0x5cb4('0xd')](function(_0x418dd2){logger[_0x5cb4('0xe')]('WhatsappQueueReport,\x20%s,\x20%s',_0x15229c,_0x5cb4('0xf'));logger['debug'](_0x5cb4('0x10'),_0x15229c,_0x5cb4('0xf'),JSON['stringify'](_0x418dd2));if(_0x418dd2['error']){if(_0x418dd2['error']['code']===0x1f4){logger[_0x5cb4('0x11')](_0x5cb4('0x12'),_0x15229c,_0x418dd2['error']['message']);return _0x35853d(_0x418dd2[_0x5cb4('0x11')][_0x5cb4('0x13')]);}logger[_0x5cb4('0x11')](_0x5cb4('0x12'),_0x15229c,_0x418dd2['error'][_0x5cb4('0x13')]);return _0x4aeca6(_0x418dd2[_0x5cb4('0x11')][_0x5cb4('0x13')]);}else{logger['info']('WhatsappQueueReport,\x20%s,\x20%s',_0x15229c,'request\x20sent');_0x4aeca6(_0x418dd2[_0x5cb4('0x14')][_0x5cb4('0x13')]);}})['catch'](function(_0x5988c4){logger[_0x5cb4('0x11')]('WhatsappQueueReport,\x20%s,\x20%s',_0x15229c,_0x5988c4);_0x35853d(_0x5988c4);});});}exports[_0x5cb4('0x15')]=function(_0x4b403a){var _0x26c170=this;return new Promise(function(_0x2fd05c,_0x291206){return db[_0x5cb4('0x16')][_0x5cb4('0x17')](_0x4b403a[_0x5cb4('0x18')],{'raw':_0x4b403a[_0x5cb4('0x19')]?_0x4b403a[_0x5cb4('0x19')][_0x5cb4('0x1a')]===undefined?!![]:![]:!![]})[_0x5cb4('0xd')](function(_0x2fd8f3){logger[_0x5cb4('0xe')](_0x5cb4('0x15'),_0x4b403a);logger[_0x5cb4('0x1b')]('CreateWhatsappQueueReport',_0x4b403a,JSON['stringify'](_0x2fd8f3));_0x2fd05c(_0x2fd8f3);})[_0x5cb4('0x1c')](function(_0x1fd1b8){logger[_0x5cb4('0x11')](_0x5cb4('0x15'),_0x1fd1b8[_0x5cb4('0x13')],_0x4b403a);_0x291206(_0x26c170['error'](0x1f4,_0x1fd1b8['message']));});});};exports[_0x5cb4('0x1d')]=function(_0x49e167){var _0x53a036=this;return new Promise(function(_0x8f7cdb,_0x15bada){return db[_0x5cb4('0x16')][_0x5cb4('0x1e')](_0x49e167[_0x5cb4('0x18')],{'raw':_0x49e167[_0x5cb4('0x19')]?_0x49e167[_0x5cb4('0x19')][_0x5cb4('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x49e167[_0x5cb4('0x19')]?_0x49e167[_0x5cb4('0x19')][_0x5cb4('0x1f')]||null:null,'attributes':_0x49e167['options']?_0x49e167[_0x5cb4('0x19')]['attributes']||null:null,'limit':_0x49e167[_0x5cb4('0x19')]?_0x49e167[_0x5cb4('0x19')][_0x5cb4('0x20')]||null:null})[_0x5cb4('0xd')](function(_0x482f89){logger[_0x5cb4('0xe')]('UpdateWhatsappQueueReport',_0x49e167);logger['debug'](_0x5cb4('0x1d'),_0x49e167,JSON['stringify'](_0x482f89));_0x8f7cdb(_0x482f89);})[_0x5cb4('0x1c')](function(_0x3d8206){logger[_0x5cb4('0x11')](_0x5cb4('0x1d'),_0x3d8206['message'],_0x49e167);_0x15bada(_0x53a036[_0x5cb4('0x11')](0x1f4,_0x3d8206[_0x5cb4('0x13')]));});});}; \ No newline at end of file +var _0x370d=['request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','WhatsappQueueReport','create','body','options','raw','CreateWhatsappQueueReport','stringify','update','attributes','limit','UpdateWhatsappQueueReport','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','http','request','then','info','WhatsappQueueReport,\x20%s,\x20%s'];(function(_0x45651c,_0xb1bcae){var _0x169116=function(_0x242ef1){while(--_0x242ef1){_0x45651c['push'](_0x45651c['shift']());}};_0x169116(++_0xb1bcae);}(_0x370d,0xc6));var _0xd370=function(_0x1179e8,_0x43869b){_0x1179e8=_0x1179e8-0x0;var _0x2b54e6=_0x370d[_0x1179e8];return _0x2b54e6;};'use strict';var _=require(_0xd370('0x0'));var util=require(_0xd370('0x1'));var moment=require('moment');var BPromise=require(_0xd370('0x2'));var rs=require(_0xd370('0x3'));var fs=require('fs');var Redis=require(_0xd370('0x4'));var db=require(_0xd370('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd370('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xd370('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x10a1a8,_0x3354ac,_0x39fedb){return new BPromise(function(_0xfa9b04,_0xf3bac7){return client[_0xd370('0x8')](_0x10a1a8,_0x39fedb)[_0xd370('0x9')](function(_0x4c9b9e){logger[_0xd370('0xa')](_0xd370('0xb'),_0x3354ac,_0xd370('0xc'));logger[_0xd370('0xd')](_0xd370('0xe'),_0x3354ac,_0xd370('0xc'),JSON['stringify'](_0x4c9b9e));if(_0x4c9b9e[_0xd370('0xf')]){if(_0x4c9b9e[_0xd370('0xf')]['code']===0x1f4){logger[_0xd370('0xf')]('WhatsappQueueReport,\x20%s,\x20%s',_0x3354ac,_0x4c9b9e[_0xd370('0xf')][_0xd370('0x10')]);return _0xf3bac7(_0x4c9b9e[_0xd370('0xf')][_0xd370('0x10')]);}logger[_0xd370('0xf')](_0xd370('0xb'),_0x3354ac,_0x4c9b9e['error']['message']);return _0xfa9b04(_0x4c9b9e[_0xd370('0xf')][_0xd370('0x10')]);}else{logger[_0xd370('0xa')]('WhatsappQueueReport,\x20%s,\x20%s',_0x3354ac,'request\x20sent');_0xfa9b04(_0x4c9b9e[_0xd370('0x11')][_0xd370('0x10')]);}})[_0xd370('0x12')](function(_0x1994ff){logger[_0xd370('0xf')](_0xd370('0xb'),_0x3354ac,_0x1994ff);_0xf3bac7(_0x1994ff);});});}exports['CreateWhatsappQueueReport']=function(_0x4a86e8){var _0x370cfc=this;return new Promise(function(_0x1ddb9e,_0xbfa41b){return db[_0xd370('0x13')][_0xd370('0x14')](_0x4a86e8[_0xd370('0x15')],{'raw':_0x4a86e8[_0xd370('0x16')]?_0x4a86e8[_0xd370('0x16')][_0xd370('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x2b8cf5){logger[_0xd370('0xa')]('CreateWhatsappQueueReport',_0x4a86e8);logger['debug'](_0xd370('0x18'),_0x4a86e8,JSON[_0xd370('0x19')](_0x2b8cf5));_0x1ddb9e(_0x2b8cf5);})['catch'](function(_0x2f4cab){logger['error'](_0xd370('0x18'),_0x2f4cab[_0xd370('0x10')],_0x4a86e8);_0xbfa41b(_0x370cfc[_0xd370('0xf')](0x1f4,_0x2f4cab[_0xd370('0x10')]));});});};exports['UpdateWhatsappQueueReport']=function(_0x33065a){var _0x109866=this;return new Promise(function(_0x95584c,_0x597380){return db['WhatsappQueueReport'][_0xd370('0x1a')](_0x33065a[_0xd370('0x15')],{'raw':_0x33065a[_0xd370('0x16')]?_0x33065a['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x33065a[_0xd370('0x16')]?_0x33065a[_0xd370('0x16')]['where']||null:null,'attributes':_0x33065a[_0xd370('0x16')]?_0x33065a[_0xd370('0x16')][_0xd370('0x1b')]||null:null,'limit':_0x33065a[_0xd370('0x16')]?_0x33065a[_0xd370('0x16')][_0xd370('0x1c')]||null:null})[_0xd370('0x9')](function(_0x4eadd2){logger[_0xd370('0xa')]('UpdateWhatsappQueueReport',_0x33065a);logger[_0xd370('0xd')]('UpdateWhatsappQueueReport',_0x33065a,JSON[_0xd370('0x19')](_0x4eadd2));_0x95584c(_0x4eadd2);})['catch'](function(_0x5c9c66){logger[_0xd370('0xf')](_0xd370('0x1d'),_0x5c9c66[_0xd370('0x10')],_0x33065a);_0x597380(_0x109866[_0xd370('0xf')](0x1f4,_0x5c9c66[_0xd370('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index b16019b..2c6d9bc 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 _0x7939=['./whatsappTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','put','update','delete','util','path','connect-timeout','express','../../config/environment'];(function(_0x9cdccf,_0x27026a){var _0x5d58b3=function(_0xa108e9){while(--_0xa108e9){_0x9cdccf['push'](_0x9cdccf['shift']());}};_0x5d58b3(++_0x27026a);}(_0x7939,0x11c));var _0x9793=function(_0x20d70e,_0x27c749){_0x20d70e=_0x20d70e-0x0;var _0x1547ea=_0x7939[_0x20d70e];return _0x1547ea;};'use strict';var multer=require('multer');var util=require(_0x9793('0x0'));var path=require(_0x9793('0x1'));var timeout=require(_0x9793('0x2'));var express=require(_0x9793('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x9793('0x4'));var controller=require(_0x9793('0x5'));router[_0x9793('0x6')]('/',auth[_0x9793('0x7')](),controller[_0x9793('0x8')]);router[_0x9793('0x6')](_0x9793('0x9'),auth['isAuthenticated'](),controller[_0x9793('0xa')]);router[_0x9793('0x6')](_0x9793('0xb'),auth[_0x9793('0x7')](),controller['show']);router[_0x9793('0xc')]('/',auth['isAuthenticated'](),controller[_0x9793('0xd')]);router[_0x9793('0xe')]('/:id',auth[_0x9793('0x7')](),controller[_0x9793('0xf')]);router[_0x9793('0x10')](_0x9793('0xb'),auth[_0x9793('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x0d49=['isAuthenticated','index','/describe','describe','/:id','show','post','create','update','delete','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./whatsappTransferReport.controller','get'];(function(_0xa3e723,_0x3b23d0){var _0x4f93a6=function(_0x1f5a0a){while(--_0x1f5a0a){_0xa3e723['push'](_0xa3e723['shift']());}};_0x4f93a6(++_0x3b23d0);}(_0x0d49,0x19c));var _0x90d4=function(_0x566f50,_0x255430){_0x566f50=_0x566f50-0x0;var _0x5a937d=_0x0d49[_0x566f50];return _0x5a937d;};'use strict';var multer=require('multer');var util=require(_0x90d4('0x0'));var path=require('path');var timeout=require(_0x90d4('0x1'));var express=require(_0x90d4('0x2'));var router=express[_0x90d4('0x3')]();var auth=require(_0x90d4('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x90d4('0x5'));var controller=require(_0x90d4('0x6'));router[_0x90d4('0x7')]('/',auth[_0x90d4('0x8')](),controller[_0x90d4('0x9')]);router[_0x90d4('0x7')](_0x90d4('0xa'),auth[_0x90d4('0x8')](),controller[_0x90d4('0xb')]);router[_0x90d4('0x7')](_0x90d4('0xc'),auth['isAuthenticated'](),controller[_0x90d4('0xd')]);router[_0x90d4('0xe')]('/',auth['isAuthenticated'](),controller[_0x90d4('0xf')]);router['put'](_0x90d4('0xc'),auth[_0x90d4('0x8')](),controller[_0x90d4('0x10')]);router[_0x90d4('0x11')](_0x90d4('0xc'),auth[_0x90d4('0x8')](),controller[_0x90d4('0x12')]);module[_0x90d4('0x13')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index de7ecfe..2a16ae5 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 _0xb7e7=['queue','sequelize','STRING','account'];(function(_0xfcd784,_0x183965){var _0x1a4c12=function(_0x4bd4fc){while(--_0x4bd4fc){_0xfcd784['push'](_0xfcd784['shift']());}};_0x1a4c12(++_0x183965);}(_0xb7e7,0x121));var _0x7b7e=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xb7e7[_0x38a7ac];return _0x53061a;};'use strict';var Sequelize=require(_0x7b7e('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x7b7e('0x2'),'agent',_0x7b7e('0x3')),'allowNull':![]},'transferredAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0x5f66=['queue','DATE','exports','ENUM','account','agent'];(function(_0xbeb808,_0x881ddf){var _0x5d6909=function(_0x37d652){while(--_0x37d652){_0xbeb808['push'](_0xbeb808['shift']());}};_0x5d6909(++_0x881ddf);}(_0x5f66,0x1a0));var _0x65f6=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0x5f66[_0x36eaaa];return _0x461349;};'use strict';var Sequelize=require('sequelize');module[_0x65f6('0x0')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x65f6('0x1')](_0x65f6('0x2'),_0x65f6('0x3'),_0x65f6('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x65f6('0x5')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index b320bdf..c460219 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 _0x6d4d=['options','includeAll','include','findAll','rows','show','params','length','find','catch','body','update','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','then','stack','name','send','index','map','WhatsappTransferReport','rawAttributes','type','key','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge'];(function(_0x1a1104,_0x54a5ba){var _0x4f8717=function(_0x40c462){while(--_0x40c462){_0x1a1104['push'](_0x1a1104['shift']());}};_0x4f8717(++_0x54a5ba);}(_0x6d4d,0xec));var _0xd6d4=function(_0x7e0581,_0x17fbb6){_0x7e0581=_0x7e0581-0x0;var _0x26314b=_0x6d4d[_0x7e0581];return _0x26314b;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xd6d4('0x0'));var zipdir=require(_0xd6d4('0x1'));var jsonpatch=require(_0xd6d4('0x2'));var rp=require(_0xd6d4('0x3'));var moment=require(_0xd6d4('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd6d4('0x5'));var util=require('util');var path=require(_0xd6d4('0x6'));var sox=require(_0xd6d4('0x7'));var csv=require(_0xd6d4('0x8'));var ejs=require(_0xd6d4('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xd6d4('0xa'));var crypto=require(_0xd6d4('0xb'));var jsforce=require(_0xd6d4('0xc'));var deskjs=require(_0xd6d4('0xd'));var toCsv=require(_0xd6d4('0x8'));var querystring=require(_0xd6d4('0xe'));var Papa=require(_0xd6d4('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd6d4('0x10'));var as=require(_0xd6d4('0x11'));var hardwareService=require(_0xd6d4('0x12'));var logger=require(_0xd6d4('0x13'))('api');var utils=require(_0xd6d4('0x14'));var config=require(_0xd6d4('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x455ef6,_0x5973c3){_0x5973c3=_0x5973c3||0xcc;return function(_0xc43a7e){if(_0xc43a7e){return _0x455ef6[_0xd6d4('0x16')](_0x5973c3);}return _0x455ef6[_0xd6d4('0x17')](_0x5973c3)[_0xd6d4('0x18')]();};}function respondWithResult(_0x5d03e8,_0x180b63){_0x180b63=_0x180b63||0xc8;return function(_0x5058a5){if(_0x5058a5){return _0x5d03e8[_0xd6d4('0x17')](_0x180b63)[_0xd6d4('0x19')](_0x5058a5);}};}function respondWithFilteredResult(_0x132b04,_0x4bb9b9){return function(_0x20f35b){if(_0x20f35b){var _0x128950=_0x20f35b[_0xd6d4('0x1a')],_0x30f9de=_0x4bb9b9['offset'],_0x4310fb=_0x4bb9b9[_0xd6d4('0x1b')]+_0x4bb9b9[_0xd6d4('0x1c')],_0x34267e;if(_0x4310fb>=_0x128950){_0x4310fb=_0x128950;_0x34267e=0xc8;}else{_0x34267e=0xce;}_0x132b04[_0xd6d4('0x17')](_0x34267e);return _0x132b04[_0xd6d4('0x1d')](_0xd6d4('0x1e'),_0x30f9de+'-'+_0x4310fb+'/'+_0x128950)[_0xd6d4('0x19')](_0x20f35b);}return null;};}function patchUpdates(_0x16fe42){return function(_0x61391f){try{jsonpatch[_0xd6d4('0x1f')](_0x61391f,_0x16fe42,!![]);}catch(_0x325acd){return BPromise[_0xd6d4('0x20')](_0x325acd);}return _0x61391f[_0xd6d4('0x21')]();};}function saveUpdates(_0x111a7f,_0xb7f7f8){return function(_0x477c33){if(_0x477c33){return _0x477c33['update'](_0x111a7f)[_0xd6d4('0x22')](function(_0xc493c1){return _0xc493c1;});}return null;};}function removeEntity(_0xdbc0b5,_0x1f69c9){return function(_0x55e170){if(_0x55e170){return _0x55e170['destroy']()[_0xd6d4('0x22')](function(){_0xdbc0b5[_0xd6d4('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x452f42,_0x1d0a62){return function(_0x1c1a19){if(!_0x1c1a19){_0x452f42[_0xd6d4('0x16')](0x194);}return _0x1c1a19;};}function handleError(_0x162f56,_0x1cf22a){_0x1cf22a=_0x1cf22a||0x1f4;return function(_0x47b6f1){logger['error'](_0x47b6f1[_0xd6d4('0x23')]);if(_0x47b6f1[_0xd6d4('0x24')]){delete _0x47b6f1[_0xd6d4('0x24')];}_0x162f56[_0xd6d4('0x17')](_0x1cf22a)[_0xd6d4('0x25')](_0x47b6f1);};}exports[_0xd6d4('0x26')]=function(_0x9b5ec3,_0x25007d){var _0x112a56={},_0x2e68f7={},_0x22a910={'count':0x0,'rows':[]};var _0x437df7=_[_0xd6d4('0x27')](db[_0xd6d4('0x28')][_0xd6d4('0x29')],function(_0x3d93e4){return{'name':_0x3d93e4['fieldName'],'type':_0x3d93e4[_0xd6d4('0x2a')][_0xd6d4('0x2b')]};});_0x2e68f7[_0xd6d4('0x2c')]=_['map'](_0x437df7,_0xd6d4('0x24'));_0x2e68f7['query']=_[_0xd6d4('0x2d')](_0x9b5ec3[_0xd6d4('0x2e')]);_0x2e68f7[_0xd6d4('0x2f')]=_[_0xd6d4('0x30')](_0x2e68f7['model'],_0x2e68f7[_0xd6d4('0x2e')]);_0x112a56['attributes']=_[_0xd6d4('0x30')](_0x2e68f7[_0xd6d4('0x2c')],qs[_0xd6d4('0x31')](_0x9b5ec3[_0xd6d4('0x2e')]['fields']));_0x112a56[_0xd6d4('0x32')]=_0x112a56[_0xd6d4('0x32')]['length']?_0x112a56[_0xd6d4('0x32')]:_0x2e68f7[_0xd6d4('0x2c')];if(!_0x9b5ec3[_0xd6d4('0x2e')][_0xd6d4('0x33')](_0xd6d4('0x34'))){_0x112a56['limit']=qs[_0xd6d4('0x1c')](_0x9b5ec3['query'][_0xd6d4('0x1c')]);_0x112a56['offset']=qs[_0xd6d4('0x1b')](_0x9b5ec3['query'][_0xd6d4('0x1b')]);}_0x112a56[_0xd6d4('0x35')]=qs['sort'](_0x9b5ec3[_0xd6d4('0x2e')][_0xd6d4('0x36')]);_0x112a56[_0xd6d4('0x37')]=qs[_0xd6d4('0x2f')](_[_0xd6d4('0x38')](_0x9b5ec3['query'],_0x2e68f7[_0xd6d4('0x2f')]),_0x437df7);if(_0x9b5ec3[_0xd6d4('0x2e')][_0xd6d4('0x39')]){_0x112a56[_0xd6d4('0x37')]=_['merge'](_0x112a56[_0xd6d4('0x37')],{'$or':_[_0xd6d4('0x27')](_0x437df7,function(_0x1144f9){if(_0x1144f9[_0xd6d4('0x2a')]!==_0xd6d4('0x3a')){var _0x4549b0={};_0x4549b0[_0x1144f9[_0xd6d4('0x24')]]={'$like':'%'+_0x9b5ec3[_0xd6d4('0x2e')]['filter']+'%'};return _0x4549b0;}})});}_0x112a56=_[_0xd6d4('0x3b')]({},_0x112a56,_0x9b5ec3[_0xd6d4('0x3c')]);var _0x573b4d={'where':_0x112a56[_0xd6d4('0x37')]};return db[_0xd6d4('0x28')][_0xd6d4('0x1a')](_0x573b4d)['then'](function(_0x50bdda){_0x22a910[_0xd6d4('0x1a')]=_0x50bdda;if(_0x9b5ec3[_0xd6d4('0x2e')][_0xd6d4('0x3d')]){_0x112a56[_0xd6d4('0x3e')]=[{'all':!![]}];}return db['WhatsappTransferReport'][_0xd6d4('0x3f')](_0x112a56);})[_0xd6d4('0x22')](function(_0x17d443){_0x22a910[_0xd6d4('0x40')]=_0x17d443;return _0x22a910;})['then'](respondWithFilteredResult(_0x25007d,_0x112a56))['catch'](handleError(_0x25007d,null));};exports[_0xd6d4('0x41')]=function(_0x11faaf,_0x252e54){var _0x2fd027={'raw':!![],'where':{'id':_0x11faaf[_0xd6d4('0x42')]['id']}},_0x20e32b={};_0x20e32b[_0xd6d4('0x2c')]=_[_0xd6d4('0x2d')](db['WhatsappTransferReport'][_0xd6d4('0x29')]);_0x20e32b[_0xd6d4('0x2e')]=_[_0xd6d4('0x2d')](_0x11faaf[_0xd6d4('0x2e')]);_0x20e32b[_0xd6d4('0x2f')]=_[_0xd6d4('0x30')](_0x20e32b[_0xd6d4('0x2c')],_0x20e32b[_0xd6d4('0x2e')]);_0x2fd027[_0xd6d4('0x32')]=_['intersection'](_0x20e32b[_0xd6d4('0x2c')],qs[_0xd6d4('0x31')](_0x11faaf[_0xd6d4('0x2e')][_0xd6d4('0x31')]));_0x2fd027['attributes']=_0x2fd027[_0xd6d4('0x32')][_0xd6d4('0x43')]?_0x2fd027[_0xd6d4('0x32')]:_0x20e32b[_0xd6d4('0x2c')];if(_0x11faaf[_0xd6d4('0x2e')][_0xd6d4('0x3d')]){_0x2fd027[_0xd6d4('0x3e')]=[{'all':!![]}];}_0x2fd027=_[_0xd6d4('0x3b')]({},_0x2fd027,_0x11faaf[_0xd6d4('0x3c')]);return db[_0xd6d4('0x28')][_0xd6d4('0x44')](_0x2fd027)[_0xd6d4('0x22')](handleEntityNotFound(_0x252e54,null))[_0xd6d4('0x22')](respondWithResult(_0x252e54,null))[_0xd6d4('0x45')](handleError(_0x252e54,null));};exports['create']=function(_0x32b02a,_0x52d1c2){return db[_0xd6d4('0x28')]['create'](_0x32b02a[_0xd6d4('0x46')],{})['then'](respondWithResult(_0x52d1c2,0xc9))['catch'](handleError(_0x52d1c2,null));};exports[_0xd6d4('0x47')]=function(_0x1f2265,_0x41901d){if(_0x1f2265[_0xd6d4('0x46')]['id']){delete _0x1f2265[_0xd6d4('0x46')]['id'];}return db[_0xd6d4('0x28')]['find']({'where':{'id':_0x1f2265[_0xd6d4('0x42')]['id']}})[_0xd6d4('0x22')](handleEntityNotFound(_0x41901d,null))[_0xd6d4('0x22')](saveUpdates(_0x1f2265[_0xd6d4('0x46')],null))[_0xd6d4('0x22')](respondWithResult(_0x41901d,null))[_0xd6d4('0x45')](handleError(_0x41901d,null));};exports[_0xd6d4('0x48')]=function(_0x39cc18,_0x31919d){return db['WhatsappTransferReport']['find']({'where':{'id':_0x39cc18[_0xd6d4('0x42')]['id']}})[_0xd6d4('0x22')](handleEntityNotFound(_0x31919d,null))[_0xd6d4('0x22')](removeEntity(_0x31919d,null))[_0xd6d4('0x45')](handleError(_0x31919d,null));};exports['describe']=function(_0x4435dd,_0x2f85ec){return db[_0xd6d4('0x28')][_0xd6d4('0x49')]()[_0xd6d4('0x22')](respondWithResult(_0x2f85ec,null))[_0xd6d4('0x45')](handleError(_0x2f85ec,null));}; \ No newline at end of file +var _0xb0f2=['send','WhatsappTransferReport','rawAttributes','fieldName','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','includeAll','findAll','catch','show','params','include','options','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','limit','set','Content-Range','save','update','then','destroy','error','stack','name'];(function(_0x5d69c7,_0x5e3e3e){var _0x57b650=function(_0x5097fe){while(--_0x5097fe){_0x5d69c7['push'](_0x5d69c7['shift']());}};_0x57b650(++_0x5e3e3e);}(_0xb0f2,0x104));var _0x2b0f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb0f2[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x2b0f('0x0'));var emlformat=require(_0x2b0f('0x1'));var rimraf=require(_0x2b0f('0x2'));var zipdir=require(_0x2b0f('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x2b0f('0x4'));var BPromise=require(_0x2b0f('0x5'));var Mustache=require('mustache');var util=require(_0x2b0f('0x6'));var path=require(_0x2b0f('0x7'));var sox=require(_0x2b0f('0x8'));var csv=require(_0x2b0f('0x9'));var ejs=require(_0x2b0f('0xa'));var fs=require('fs');var _=require(_0x2b0f('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x2b0f('0xc'));var deskjs=require(_0x2b0f('0xd'));var toCsv=require(_0x2b0f('0x9'));var querystring=require(_0x2b0f('0xe'));var Papa=require(_0x2b0f('0xf'));var Redis=require(_0x2b0f('0x10'));var authService=require(_0x2b0f('0x11'));var qs=require(_0x2b0f('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2b0f('0x13'));var logger=require(_0x2b0f('0x14'))(_0x2b0f('0x15'));var utils=require(_0x2b0f('0x16'));var config=require(_0x2b0f('0x17'));var db=require(_0x2b0f('0x18'))['db'];function respondWithStatusCode(_0x46d1fc,_0xeeb318){_0xeeb318=_0xeeb318||0xcc;return function(_0x440fd7){if(_0x440fd7){return _0x46d1fc[_0x2b0f('0x19')](_0xeeb318);}return _0x46d1fc['status'](_0xeeb318)[_0x2b0f('0x1a')]();};}function respondWithResult(_0x1374d7,_0x3423ec){_0x3423ec=_0x3423ec||0xc8;return function(_0xa1a863){if(_0xa1a863){return _0x1374d7[_0x2b0f('0x1b')](_0x3423ec)[_0x2b0f('0x1c')](_0xa1a863);}};}function respondWithFilteredResult(_0x114146,_0x8ed603){return function(_0x1c8a7a){if(_0x1c8a7a){var _0x14d3c6=_0x1c8a7a['count'],_0x2d5c79=_0x8ed603[_0x2b0f('0x1d')],_0x23564c=_0x8ed603[_0x2b0f('0x1d')]+_0x8ed603[_0x2b0f('0x1e')],_0xdb222a;if(_0x23564c>=_0x14d3c6){_0x23564c=_0x14d3c6;_0xdb222a=0xc8;}else{_0xdb222a=0xce;}_0x114146[_0x2b0f('0x1b')](_0xdb222a);return _0x114146[_0x2b0f('0x1f')](_0x2b0f('0x20'),_0x2d5c79+'-'+_0x23564c+'/'+_0x14d3c6)[_0x2b0f('0x1c')](_0x1c8a7a);}return null;};}function patchUpdates(_0x587907){return function(_0x465449){try{jsonpatch['apply'](_0x465449,_0x587907,!![]);}catch(_0x2f71d9){return BPromise['reject'](_0x2f71d9);}return _0x465449[_0x2b0f('0x21')]();};}function saveUpdates(_0x37fe0b,_0xf49ddc){return function(_0x1e2691){if(_0x1e2691){return _0x1e2691[_0x2b0f('0x22')](_0x37fe0b)[_0x2b0f('0x23')](function(_0x29ff08){return _0x29ff08;});}return null;};}function removeEntity(_0x863b87,_0x2fc9da){return function(_0x38e223){if(_0x38e223){return _0x38e223[_0x2b0f('0x24')]()['then'](function(){_0x863b87['status'](0xcc)[_0x2b0f('0x1a')]();});}};}function handleEntityNotFound(_0x3fc7e4,_0x2fef81){return function(_0x5a2cab){if(!_0x5a2cab){_0x3fc7e4[_0x2b0f('0x19')](0x194);}return _0x5a2cab;};}function handleError(_0xa0a14e,_0x27074e){_0x27074e=_0x27074e||0x1f4;return function(_0x178e31){logger[_0x2b0f('0x25')](_0x178e31[_0x2b0f('0x26')]);if(_0x178e31[_0x2b0f('0x27')]){delete _0x178e31[_0x2b0f('0x27')];}_0xa0a14e['status'](_0x27074e)[_0x2b0f('0x28')](_0x178e31);};}exports['index']=function(_0x5bda77,_0x11b744){var _0x249d54={},_0x27eecb={},_0x272fc8={'count':0x0,'rows':[]};var _0x363c96=_['map'](db[_0x2b0f('0x29')][_0x2b0f('0x2a')],function(_0xab49fd){return{'name':_0xab49fd[_0x2b0f('0x2b')],'type':_0xab49fd['type'][_0x2b0f('0x2c')]};});_0x27eecb[_0x2b0f('0x2d')]=_[_0x2b0f('0x2e')](_0x363c96,_0x2b0f('0x27'));_0x27eecb['query']=_[_0x2b0f('0x2f')](_0x5bda77[_0x2b0f('0x30')]);_0x27eecb[_0x2b0f('0x31')]=_[_0x2b0f('0x32')](_0x27eecb[_0x2b0f('0x2d')],_0x27eecb['query']);_0x249d54[_0x2b0f('0x33')]=_['intersection'](_0x27eecb[_0x2b0f('0x2d')],qs['fields'](_0x5bda77['query'][_0x2b0f('0x34')]));_0x249d54[_0x2b0f('0x33')]=_0x249d54[_0x2b0f('0x33')][_0x2b0f('0x35')]?_0x249d54[_0x2b0f('0x33')]:_0x27eecb[_0x2b0f('0x2d')];if(!_0x5bda77[_0x2b0f('0x30')][_0x2b0f('0x36')](_0x2b0f('0x37'))){_0x249d54[_0x2b0f('0x1e')]=qs[_0x2b0f('0x1e')](_0x5bda77[_0x2b0f('0x30')][_0x2b0f('0x1e')]);_0x249d54[_0x2b0f('0x1d')]=qs[_0x2b0f('0x1d')](_0x5bda77[_0x2b0f('0x30')][_0x2b0f('0x1d')]);}_0x249d54[_0x2b0f('0x38')]=qs['sort'](_0x5bda77[_0x2b0f('0x30')][_0x2b0f('0x39')]);_0x249d54[_0x2b0f('0x3a')]=qs[_0x2b0f('0x31')](_[_0x2b0f('0x3b')](_0x5bda77[_0x2b0f('0x30')],_0x27eecb['filters']),_0x363c96);if(_0x5bda77[_0x2b0f('0x30')]['filter']){_0x249d54[_0x2b0f('0x3a')]=_[_0x2b0f('0x3c')](_0x249d54['where'],{'$or':_['map'](_0x363c96,function(_0xe118a7){if(_0xe118a7[_0x2b0f('0x3d')]!==_0x2b0f('0x3e')){var _0x87f908={};_0x87f908[_0xe118a7[_0x2b0f('0x27')]]={'$like':'%'+_0x5bda77[_0x2b0f('0x30')][_0x2b0f('0x3f')]+'%'};return _0x87f908;}})});}_0x249d54=_['merge']({},_0x249d54,_0x5bda77['options']);var _0x442b0c={'where':_0x249d54['where']};return db[_0x2b0f('0x29')]['count'](_0x442b0c)[_0x2b0f('0x23')](function(_0x50a141){_0x272fc8['count']=_0x50a141;if(_0x5bda77[_0x2b0f('0x30')][_0x2b0f('0x40')]){_0x249d54['include']=[{'all':!![]}];}return db[_0x2b0f('0x29')][_0x2b0f('0x41')](_0x249d54);})[_0x2b0f('0x23')](function(_0x558b83){_0x272fc8['rows']=_0x558b83;return _0x272fc8;})[_0x2b0f('0x23')](respondWithFilteredResult(_0x11b744,_0x249d54))[_0x2b0f('0x42')](handleError(_0x11b744,null));};exports[_0x2b0f('0x43')]=function(_0x124ace,_0x237317){var _0x29f5b0={'raw':!![],'where':{'id':_0x124ace[_0x2b0f('0x44')]['id']}},_0x4650a7={};_0x4650a7[_0x2b0f('0x2d')]=_['keys'](db[_0x2b0f('0x29')]['rawAttributes']);_0x4650a7[_0x2b0f('0x30')]=_[_0x2b0f('0x2f')](_0x124ace[_0x2b0f('0x30')]);_0x4650a7[_0x2b0f('0x31')]=_[_0x2b0f('0x32')](_0x4650a7[_0x2b0f('0x2d')],_0x4650a7[_0x2b0f('0x30')]);_0x29f5b0[_0x2b0f('0x33')]=_[_0x2b0f('0x32')](_0x4650a7[_0x2b0f('0x2d')],qs[_0x2b0f('0x34')](_0x124ace['query']['fields']));_0x29f5b0[_0x2b0f('0x33')]=_0x29f5b0['attributes']['length']?_0x29f5b0[_0x2b0f('0x33')]:_0x4650a7[_0x2b0f('0x2d')];if(_0x124ace[_0x2b0f('0x30')][_0x2b0f('0x40')]){_0x29f5b0[_0x2b0f('0x45')]=[{'all':!![]}];}_0x29f5b0=_[_0x2b0f('0x3c')]({},_0x29f5b0,_0x124ace[_0x2b0f('0x46')]);return db[_0x2b0f('0x29')][_0x2b0f('0x47')](_0x29f5b0)[_0x2b0f('0x23')](handleEntityNotFound(_0x237317,null))['then'](respondWithResult(_0x237317,null))['catch'](handleError(_0x237317,null));};exports[_0x2b0f('0x48')]=function(_0x4d0e3a,_0x17cd65){return db['WhatsappTransferReport']['create'](_0x4d0e3a[_0x2b0f('0x49')],{})[_0x2b0f('0x23')](respondWithResult(_0x17cd65,0xc9))['catch'](handleError(_0x17cd65,null));};exports['update']=function(_0xee6113,_0x24a174){if(_0xee6113[_0x2b0f('0x49')]['id']){delete _0xee6113[_0x2b0f('0x49')]['id'];}return db[_0x2b0f('0x29')][_0x2b0f('0x47')]({'where':{'id':_0xee6113[_0x2b0f('0x44')]['id']}})[_0x2b0f('0x23')](handleEntityNotFound(_0x24a174,null))[_0x2b0f('0x23')](saveUpdates(_0xee6113['body'],null))[_0x2b0f('0x23')](respondWithResult(_0x24a174,null))[_0x2b0f('0x42')](handleError(_0x24a174,null));};exports[_0x2b0f('0x24')]=function(_0x4525b2,_0x52089d){return db[_0x2b0f('0x29')][_0x2b0f('0x47')]({'where':{'id':_0x4525b2[_0x2b0f('0x44')]['id']}})[_0x2b0f('0x23')](handleEntityNotFound(_0x52089d,null))['then'](removeEntity(_0x52089d,null))[_0x2b0f('0x42')](handleError(_0x52089d,null));};exports[_0x2b0f('0x4a')]=function(_0x2f6d08,_0x1f006e){return db[_0x2b0f('0x29')]['describe']()[_0x2b0f('0x23')](respondWithResult(_0x1f006e,null))[_0x2b0f('0x42')](handleError(_0x1f006e,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index bbe2cfa..8e3ab71 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 _0xe542=['define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash','util','../../config/logger','request-promise','path','rimraf','exports'];(function(_0x26b308,_0x397dfc){var _0x59478d=function(_0x20b4c4){while(--_0x20b4c4){_0x26b308['push'](_0x26b308['shift']());}};_0x59478d(++_0x397dfc);}(_0xe542,0xa9));var _0x2e54=function(_0x2173b2,_0x4cb78b){_0x2173b2=_0x2173b2-0x0;var _0x2d11df=_0xe542[_0x2173b2];return _0x2d11df;};'use strict';var _=require(_0x2e54('0x0'));var util=require(_0x2e54('0x1'));var logger=require(_0x2e54('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2e54('0x3'));var fs=require('fs');var path=require(_0x2e54('0x4'));var rimraf=require(_0x2e54('0x5'));var config=require('../../config/environment');var attributes=require('./whatsappTransferReport.attributes');module[_0x2e54('0x6')]=function(_0x414fd3,_0x3128b9){return _0x414fd3[_0x2e54('0x7')](_0x2e54('0x8'),attributes,{'tableName':_0x2e54('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x2e54('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0ecb=['../../config/logger','api','moment','request-promise','rimraf','./whatsappTransferReport.attributes','exports','define','WhatsappTransferReport','uniqueid','lodash','util'];(function(_0x1b081f,_0x447e60){var _0x42a1da=function(_0x1e2c46){while(--_0x1e2c46){_0x1b081f['push'](_0x1b081f['shift']());}};_0x42a1da(++_0x447e60);}(_0x0ecb,0x6a));var _0xb0ec=function(_0x23e346,_0x2ffc96){_0x23e346=_0x23e346-0x0;var _0x58fd5a=_0x0ecb[_0x23e346];return _0x58fd5a;};'use strict';var _=require(_0xb0ec('0x0'));var util=require(_0xb0ec('0x1'));var logger=require(_0xb0ec('0x2'))(_0xb0ec('0x3'));var moment=require(_0xb0ec('0x4'));var BPromise=require('bluebird');var rp=require(_0xb0ec('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb0ec('0x6'));var config=require('../../config/environment');var attributes=require(_0xb0ec('0x7'));module[_0xb0ec('0x8')]=function(_0x1919cf,_0x485b92){return _0x1919cf[_0xb0ec('0x9')](_0xb0ec('0xa'),attributes,{'tableName':'report_whatsapp_transfer','paranoid':![],'indexes':[{'name':_0xb0ec('0xb'),'fields':[_0xb0ec('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index cb154ac..241a9ac 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(_0x477c8c,_0x240e9e){var _0x1c8c0c=function(_0x92342d){while(--_0x92342d){_0x477c8c['push'](_0x477c8c['shift']());}};_0x1c8c0c(++_0x240e9e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0xa9e0[_0x37c22c];return _0x119d79;};'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(_0x506c57,_0x425795){var _0x22e309=function(_0x3cf409){while(--_0x3cf409){_0x506c57['push'](_0x506c57['shift']());}};_0x22e309(++_0x425795);}(_0xa9e0,0x123));var _0x0a9e=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0xa9e0[_0x220dbb];return _0x2b77de;};'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 afcecbb..5b12295 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc645=['catch','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./mysqldb','./rpc','./config/environment','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule','sequelize','then','info','start','Online\x20apps:','map','filter','online','join','Offline\x20apps:','status','name','seedDB','./config/seedDB','./config/license','default'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xc645,0x126));var _0x5c64=function(_0x2235bf,_0x3a06a7){_0x2235bf=_0x2235bf-0x0;var _0x4c3a64=_0xc645[_0x2235bf];return _0x4c3a64;};'use strict';var _=require(_0x5c64('0x0'));var mysqldb=require(_0x5c64('0x1'));var rpc=require(_0x5c64('0x2'));var config=require(_0x5c64('0x3'));var logger=require(_0x5c64('0x4'))(_0x5c64('0x5'));var pm2=require(_0x5c64('0x6'));var pm2Config=require(_0x5c64('0x7'));var schedule=require(_0x5c64('0x8'));var chat=require('./config/schedule/chat');var transcribe=require('./config/schedule/transcribe');function main(){return mysqldb['db'][_0x5c64('0x9')]['sync']()[_0x5c64('0xa')](function(){return rpc['listen']();})[_0x5c64('0xa')](function(_0x4df490){logger[_0x5c64('0xb')](_0x4df490);return chat[_0x5c64('0xc')]();})[_0x5c64('0xa')](function(){return schedule[_0x5c64('0xc')]();})[_0x5c64('0xa')](function(){return transcribe['start']();})['then'](function(_0x3e8502){logger['info'](_0x3e8502);return pm2[_0x5c64('0xc')](pm2Config);})['then'](function(_0x12b0a6){logger[_0x5c64('0xb')](_0x5c64('0xd'),_[_0x5c64('0xe')](_[_0x5c64('0xf')](_0x12b0a6,{'status':_0x5c64('0x10')}),'name')[_0x5c64('0x11')]());logger['info'](_0x5c64('0x12'),_['map'](_['filter'](_0x12b0a6,function(_0x568ef5){return _0x568ef5[_0x5c64('0x13')]!==_0x5c64('0x10');}),_0x5c64('0x14'))[_0x5c64('0x11')]()||'None');config[_0x5c64('0x15')]&&require(_0x5c64('0x16'))['default']();require(_0x5c64('0x17'))[_0x5c64('0x18')]();})[_0x5c64('0x19')](function(_0x2a161c){logger[_0x5c64('0x1a')](_0x5c64('0x1b'),_0x2a161c);process[_0x5c64('0x1c')](0x1);});}main(); \ No newline at end of file +var _0x498e=['./config/license','catch','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./mysqldb','./rpc','./config/environment','./config/logger','app','./config/schedule','./config/schedule/chat','./config/schedule/transcribe','sequelize','sync','then','listen','info','start','map','online','name','filter','status','join','None','seedDB','default'];(function(_0x4d25b1,_0x7dc7ef){var _0x1a3f01=function(_0x3456cd){while(--_0x3456cd){_0x4d25b1['push'](_0x4d25b1['shift']());}};_0x1a3f01(++_0x7dc7ef);}(_0x498e,0x1f2));var _0xe498=function(_0x26d9a7,_0x26d164){_0x26d9a7=_0x26d9a7-0x0;var _0x298319=_0x498e[_0x26d9a7];return _0x298319;};'use strict';var _=require(_0xe498('0x0'));var mysqldb=require(_0xe498('0x1'));var rpc=require(_0xe498('0x2'));var config=require(_0xe498('0x3'));var logger=require(_0xe498('0x4'))(_0xe498('0x5'));var pm2=require('./config/pm2');var pm2Config=require('./config/pm2/config');var schedule=require(_0xe498('0x6'));var chat=require(_0xe498('0x7'));var transcribe=require(_0xe498('0x8'));function main(){return mysqldb['db'][_0xe498('0x9')][_0xe498('0xa')]()[_0xe498('0xb')](function(){return rpc[_0xe498('0xc')]();})['then'](function(_0x4b6a85){logger[_0xe498('0xd')](_0x4b6a85);return chat[_0xe498('0xe')]();})[_0xe498('0xb')](function(){return schedule[_0xe498('0xe')]();})['then'](function(){return transcribe['start']();})[_0xe498('0xb')](function(_0x5d072a){logger[_0xe498('0xd')](_0x5d072a);return pm2[_0xe498('0xe')](pm2Config);})[_0xe498('0xb')](function(_0x3d848b){logger['info']('Online\x20apps:',_[_0xe498('0xf')](_['filter'](_0x3d848b,{'status':_0xe498('0x10')}),_0xe498('0x11'))['join']());logger[_0xe498('0xd')]('Offline\x20apps:',_[_0xe498('0xf')](_[_0xe498('0x12')](_0x3d848b,function(_0x5cb16a){return _0x5cb16a[_0xe498('0x13')]!==_0xe498('0x10');}),_0xe498('0x11'))[_0xe498('0x14')]()||_0xe498('0x15'));config[_0xe498('0x16')]&&require('./config/seedDB')[_0xe498('0x17')]();require(_0xe498('0x18'))[_0xe498('0x17')]();})[_0xe498('0x19')](function(_0xe47c38){logger[_0xe498('0x1a')](_0xe498('0x1b'),_0xe47c38);process[_0xe498('0x1c')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 1926f26..ead8f63 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 _0xfc6a=['json','Unmanaged.','catch','headers','authorization','startsWith','User','authenticate','pass','Bearer','Unknown\x20authorization\x20format','apikey','getUuid','query','find','isEqual','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','Invalid\x20API\x20access\x20key','User\x20object\x20not\x20found.','getLicense','update','Forbidden','isMiddleware','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','redirect','/dashboards/general','retrieveApiKey','isNil','apiKeyIat','regenerateApiKey','promisify','sign','secret','payload','options','verify','randomBytes','hex','floor','now','toString','HS512','../../mysqldb','../../config/license/hardware','lodash','jsonwebtoken','express-jwt','composable-middleware','basic-auth','bluebird','secrets','session','role','name','internal','email','permissions','md5secret','voicePause','chatPause','faxPause','smsPause','openchannelPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','passwordResetAt','alias','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableSettings','phoneBarPrefixRequired','phoneBarRemoteControlPort','userProfileId','isChatInteractionAuthorized','isAuthenticated','use','user','ChatInteraction','findOne','params','closed','disposition','then','status','unmanaged'];(function(_0x29d915,_0x54a040){var _0x160f86=function(_0x237dfa){while(--_0x237dfa){_0x29d915['push'](_0x29d915['shift']());}};_0x160f86(++_0x54a040);}(_0xfc6a,0x149));var _0xafc6=function(_0xd0b415,_0x149675){_0xd0b415=_0xd0b415-0x0;var _0x2bdf2c=_0xfc6a[_0xd0b415];return _0x2bdf2c;};'use strict';var db=require(_0xafc6('0x0'))['db'];var config=require('../../config/environment');var hardwareConf=require(_0xafc6('0x1'));var _=require(_0xafc6('0x2'));var jwt=require(_0xafc6('0x3'));var expressJwt=require(_0xafc6('0x4'));var compose=require(_0xafc6('0x5'));var basicAuth=require(_0xafc6('0x6'));var crypto=require('crypto');var BPromise=require(_0xafc6('0x7'));var validateJwt=expressJwt({'secret':config[_0xafc6('0x8')][_0xafc6('0x9')]});var userAttributes=['id',_0xafc6('0xa'),'fullname',_0xafc6('0xb'),_0xafc6('0xc'),_0xafc6('0xd'),'userpic',_0xafc6('0xe'),_0xafc6('0xf'),_0xafc6('0x10'),_0xafc6('0x11'),'mailPause',_0xafc6('0x12'),_0xafc6('0x13'),_0xafc6('0x14'),_0xafc6('0x15'),_0xafc6('0x16'),_0xafc6('0x17'),_0xafc6('0x18'),_0xafc6('0x19'),'allowmessenger',_0xafc6('0x1a'),_0xafc6('0x1b'),'phoneBarAutoAnswer',_0xafc6('0x1c'),_0xafc6('0x1d'),_0xafc6('0x1e'),'phoneBarEnableDtmfTone',_0xafc6('0x1f'),'phoneBarExpires',_0xafc6('0x20'),'phoneBarRemoteControl',_0xafc6('0x21'),'hotdesk','interface',_0xafc6('0x22')];exports[_0xafc6('0x23')]=function(){return this[_0xafc6('0x24')](!![])[_0xafc6('0x25')](function(_0x48063c,_0x7138c,_0x4d60c8){if(_0x48063c[_0xafc6('0x26')]){_0x4d60c8();}else{return db[_0xafc6('0x27')][_0xafc6('0x28')]({'where':{'id':_0x48063c[_0xafc6('0x29')]['id']},'attributes':['id',_0xafc6('0x2a'),_0xafc6('0x2b')],'raw':!![]})[_0xafc6('0x2c')](function(_0x41c8fa){if(_0x41c8fa&&_0x41c8fa[_0xafc6('0x2a')]){return _0x7138c[_0xafc6('0x2d')](_0x41c8fa[_0xafc6('0x2b')]===_0xafc6('0x2e')?0x195:0x193)[_0xafc6('0x2f')]({'message':_0x41c8fa[_0xafc6('0x2b')]===_0xafc6('0x2e')?_0xafc6('0x30'):'Forbidden.'});}else{_0x4d60c8();}})[_0xafc6('0x31')](function(_0x57ac19){_0x4d60c8(_0x57ac19);});}});};exports[_0xafc6('0x24')]=function isAuthenticated(_0x3078e8){return compose()[_0xafc6('0x25')](function(_0x5ea918,_0x83fdc3,_0x2a3723){if(_0x5ea918[_0xafc6('0x32')][_0xafc6('0x33')]){if(_[_0xafc6('0x34')](_0x5ea918[_0xafc6('0x32')][_0xafc6('0x33')],'Basic')){var _0x194e62=basicAuth(_0x5ea918);db[_0xafc6('0x35')]['find']({'where':{'name':_0x194e62[_0xafc6('0xb')]}})[_0xafc6('0x2c')](function(_0x3b57fd){if(!_0x3b57fd||!_0x3b57fd[_0xafc6('0x36')](_0x194e62[_0xafc6('0x37')])){return _0x83fdc3[_0xafc6('0x2d')](0x191)['json']({'message':'Wrong\x20credentials.'});}_0x5ea918['user']={'id':_0x3b57fd['id']};_0x2a3723();})[_0xafc6('0x31')](function(_0x465f5d){_0x2a3723(_0x465f5d);});}else if(_[_0xafc6('0x34')](_0x5ea918[_0xafc6('0x32')]['authorization'],_0xafc6('0x38'))){validateJwt(_0x5ea918,_0x83fdc3,_0x2a3723);}else{if(_0x3078e8){_0x2a3723();}else{return _0x83fdc3[_0xafc6('0x2d')](0x193)[_0xafc6('0x2f')]({'message':_0xafc6('0x39')});}}}else if(_0x5ea918['query'][_0xafc6('0x3a')]){try{var _0x1e08ad={'audience':hardwareConf[_0xafc6('0x3b')](),'issuer':hardwareConf[_0xafc6('0x3b')]()};verifyJwt(_0x5ea918[_0xafc6('0x3c')][_0xafc6('0x3a')],_0x1e08ad)['then'](function(_0x553186){return db[_0xafc6('0x35')][_0xafc6('0x3d')]({'where':{'id':_0x553186['sub']}})[_0xafc6('0x2c')](function(_0x2aa5f0){if(!_0x2aa5f0||!_[_0xafc6('0x3e')](_0x2aa5f0[_0xafc6('0x3f')],_0x553186[_0xafc6('0x40')])){return _0x83fdc3[_0xafc6('0x2d')](0x191)['json']({'message':_0xafc6('0x41')});}_0x5ea918['user']={'id':_0x2aa5f0['id']};_0x2a3723();});})[_0xafc6('0x31')](function(){return _0x83fdc3[_0xafc6('0x2d')](0x191)['json']({'message':_0xafc6('0x42')});});}catch(_0x49bd12){_0x2a3723(_0x49bd12);}}else if(_0x3078e8){_0x2a3723();}else{return _0x83fdc3[_0xafc6('0x2d')](0x193)[_0xafc6('0x2f')]({'message':_0xafc6('0x39')});}})[_0xafc6('0x25')](function(_0x120773,_0xe49312,_0x37f7d9){if(_0x120773['user']){db[_0xafc6('0x35')][_0xafc6('0x3d')]({'where':{'id':_0x120773[_0xafc6('0x26')]['id']},'attributes':userAttributes})[_0xafc6('0x2c')](function(_0x490d93){if(!_0x490d93){return _0xe49312[_0xafc6('0x2d')](0x194)['json']({'message':'User\x20not\x20found.'});}_0x120773[_0xafc6('0x26')]=_0x490d93;_0x37f7d9();})[_0xafc6('0x31')](function(_0x28080a){_0x37f7d9(_0x28080a);});}else if(_0x3078e8){_0x37f7d9();}else{return _0xe49312['status'](0x194)['json']({'message':_0xafc6('0x43')});}});};exports['canUpdate']=function canUpdate(){return compose()['use'](function(_0x49c09a,_0x28c965,_0x1ee411){return require('../../config/license/util')[_0xafc6('0x44')]()[_0xafc6('0x2c')](function(_0x234fce){if(_0x234fce[_0xafc6('0x45')]){_0x1ee411();}else{return _0x28c965[_0xafc6('0x2d')](0x193)[_0xafc6('0x2f')]({'message':_0xafc6('0x46')});}})[_0xafc6('0x31')](function(_0x36ce52){_0x1ee411(_0x36ce52);});});};exports[_0xafc6('0x47')]=function(_0x52e051,_0x1612dc,_0x5c8e47){_0x52e051[_0xafc6('0x47')]=!![];return _0x5c8e47();};exports['signToken']=function signToken(_0x189a05){return signJwt(_0x189a05);};exports[_0xafc6('0x48')]=function(_0x2f74cb,_0x23931f){if(!_0x2f74cb[_0xafc6('0x26')]){return _0x23931f[_0xafc6('0x2d')](0x194)[_0xafc6('0x2f')]({'message':_0xafc6('0x49')});}var _0x279dcb={'payload':{'id':_0x2f74cb[_0xafc6('0x26')]['id'],'role':_0x2f74cb[_0xafc6('0x26')][_0xafc6('0xa')]},'options':{'expiresIn':0x15180}};return signJwt(_0x279dcb)[_0xafc6('0x2c')](function(_0x9dd071){_0x23931f[_0xafc6('0x4a')](_0xafc6('0x4b'),_0x9dd071);_0x23931f[_0xafc6('0x4c')](_0xafc6('0x4d'));})[_0xafc6('0x31')](function(_0x54fccb){return _0x23931f['status'](0x1f4)['send'](_0x54fccb);});};exports[_0xafc6('0x4e')]=function(_0x384a5b){if(_['isNil'](_0x384a5b['apiKeyNonce'])||_[_0xafc6('0x4f')](_0x384a5b[_0xafc6('0x50')])){return null;}else{return createJwt(_0x384a5b);}};exports['generateApiKey']=function(_0x2f044e){_0x2f044e['apiKeyNonce']=generateNonce();_0x2f044e['apiKeyIat']=generateIssuedAt();return createJwt(_0x2f044e);};exports[_0xafc6('0x51')]=function(_0x57a002,_0x2ce252){var _0x11b078=_0x57a002[_0xafc6('0x3c')][_0xafc6('0x3a')];if(_0x11b078){var _0x4ad207={'nonce':_0x2ce252[_0xafc6('0x3f')],'iat':_0x2ce252[_0xafc6('0x50')],'audience':hardwareConf[_0xafc6('0x3b')](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0x11b078,_0x4ad207)[_0xafc6('0x2c')](function(){return generateApiKey(_0x2ce252);});}else{throw{'message':'Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one'};}};function signJwt(_0xe50075){var _0x356cb1=BPromise[_0xafc6('0x52')](jwt[_0xafc6('0x53')],{'context':jwt});var _0x2dfd24=_0xe50075[_0xafc6('0x54')]||config[_0xafc6('0x8')][_0xafc6('0x9')];return new BPromise(function(_0x59d6b5,_0xf1e04f){_0x356cb1(_0xe50075[_0xafc6('0x55')],_0x2dfd24,_0xe50075[_0xafc6('0x56')])[_0xafc6('0x2c')](function(_0x1f056c){_0x59d6b5(_0x1f056c);})['catch'](function(_0x2a3ca0){_0xf1e04f(_0x2a3ca0);});});}function verifyJwt(_0x242a71,_0x4da30d,_0x1e5fc2){var _0x5027ce=BPromise[_0xafc6('0x52')](jwt[_0xafc6('0x57')],{'context':jwt});var _0x32eb9a=_0x1e5fc2||config[_0xafc6('0x8')][_0xafc6('0x9')];return new BPromise(function(_0x4aad27,_0xf07968){_0x5027ce(_0x242a71,_0x32eb9a,_0x4da30d)[_0xafc6('0x2c')](function(_0x283edc){_0x4aad27(_0x283edc);})['catch'](function(_0x5e2e89){_0xf07968(_0x5e2e89);});});}function generateNonce(){return crypto[_0xafc6('0x58')](0x10)['toString'](_0xafc6('0x59'));}function generateIssuedAt(){return Math[_0xafc6('0x5a')](Date[_0xafc6('0x5b')]()/0x3e8)[_0xafc6('0x5c')]();}function createJwt(_0x1a8afa){var _0x1f1cc3={'payload':{'iat':_0x1a8afa[_0xafc6('0x50')],'nonce':_0x1a8afa[_0xafc6('0x3f')]},'options':{'algorithm':_0xafc6('0x5d'),'subject':_0x1a8afa['id'][_0xafc6('0x5c')](),'issuer':hardwareConf[_0xafc6('0x3b')](),'audience':hardwareConf['getUuid']()}};return signJwt(_0x1f1cc3)[_0xafc6('0x2c')](function(_0x13117e){return{'iat':_0x1a8afa[_0xafc6('0x50')],'nonce':_0x1a8afa[_0xafc6('0x3f')],'token':_0x13117e};});} \ No newline at end of file +var _0x8210=['secret','session','payload','options','promisify','randomBytes','toString','hex','floor','HS512','../../mysqldb','../../config/license/hardware','lodash','jsonwebtoken','express-jwt','composable-middleware','basic-auth','secrets','fullname','internal','userpic','permissions','voicePause','mailPause','faxPause','smsPause','openchannelPause','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarExpires','phoneBarRemoteControl','phoneBarRemoteControlPort','interface','userProfileId','isAuthenticated','user','ChatInteraction','findOne','params','closed','disposition','then','json','Unmanaged.','catch','headers','startsWith','authorization','User','name','authenticate','status','Bearer','Unknown\x20authorization\x20format','query','apikey','getUuid','find','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','Invalid\x20API\x20access\x20key','use','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','../../config/license/util','getLicense','update','Forbidden','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','role','cookie','motion.token','/dashboards/general','send','retrieveApiKey','isNil','apiKeyNonce','generateApiKey','apiKeyIat','regenerateApiKey','sign'];(function(_0x2d4ae9,_0x2de08c){var _0x11b0a3=function(_0x3e1dc1){while(--_0x3e1dc1){_0x2d4ae9['push'](_0x2d4ae9['shift']());}};_0x11b0a3(++_0x2de08c);}(_0x8210,0x186));var _0x0821=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0x8210[_0x4d613c];return _0x301fe3;};'use strict';var db=require(_0x0821('0x0'))['db'];var config=require('../../config/environment');var hardwareConf=require(_0x0821('0x1'));var _=require(_0x0821('0x2'));var jwt=require(_0x0821('0x3'));var expressJwt=require(_0x0821('0x4'));var compose=require(_0x0821('0x5'));var basicAuth=require(_0x0821('0x6'));var crypto=require('crypto');var BPromise=require('bluebird');var validateJwt=expressJwt({'secret':config[_0x0821('0x7')]['session']});var userAttributes=['id','role',_0x0821('0x8'),'name',_0x0821('0x9'),'email',_0x0821('0xa'),_0x0821('0xb'),'md5secret',_0x0821('0xc'),'chatPause',_0x0821('0xd'),_0x0821('0xe'),_0x0821('0xf'),_0x0821('0x10'),'pauseType',_0x0821('0x11'),_0x0821('0x12'),_0x0821('0x13'),_0x0821('0x14'),_0x0821('0x15'),_0x0821('0x16'),_0x0821('0x17'),_0x0821('0x18'),_0x0821('0x19'),_0x0821('0x1a'),_0x0821('0x1b'),_0x0821('0x1c'),'phoneBarEnableSettings',_0x0821('0x1d'),'phoneBarPrefixRequired',_0x0821('0x1e'),_0x0821('0x1f'),'hotdesk',_0x0821('0x20'),_0x0821('0x21')];exports['isChatInteractionAuthorized']=function(){return this[_0x0821('0x22')](!![])['use'](function(_0x1dad6a,_0x3b579a,_0x38b28e){if(_0x1dad6a[_0x0821('0x23')]){_0x38b28e();}else{return db[_0x0821('0x24')][_0x0821('0x25')]({'where':{'id':_0x1dad6a[_0x0821('0x26')]['id']},'attributes':['id',_0x0821('0x27'),_0x0821('0x28')],'raw':!![]})[_0x0821('0x29')](function(_0x34e616){if(_0x34e616&&_0x34e616[_0x0821('0x27')]){return _0x3b579a['status'](_0x34e616[_0x0821('0x28')]==='unmanaged'?0x195:0x193)[_0x0821('0x2a')]({'message':_0x34e616['disposition']==='unmanaged'?_0x0821('0x2b'):'Forbidden.'});}else{_0x38b28e();}})[_0x0821('0x2c')](function(_0x4acdae){_0x38b28e(_0x4acdae);});}});};exports[_0x0821('0x22')]=function isAuthenticated(_0x728145){return compose()['use'](function(_0xcd8991,_0x5949f4,_0xf68c64){if(_0xcd8991[_0x0821('0x2d')]['authorization']){if(_[_0x0821('0x2e')](_0xcd8991[_0x0821('0x2d')][_0x0821('0x2f')],'Basic')){var _0xd2d7cb=basicAuth(_0xcd8991);db[_0x0821('0x30')]['find']({'where':{'name':_0xd2d7cb[_0x0821('0x31')]}})[_0x0821('0x29')](function(_0x31c8fb){if(!_0x31c8fb||!_0x31c8fb[_0x0821('0x32')](_0xd2d7cb['pass'])){return _0x5949f4[_0x0821('0x33')](0x191)[_0x0821('0x2a')]({'message':'Wrong\x20credentials.'});}_0xcd8991['user']={'id':_0x31c8fb['id']};_0xf68c64();})[_0x0821('0x2c')](function(_0x1c7ba5){_0xf68c64(_0x1c7ba5);});}else if(_[_0x0821('0x2e')](_0xcd8991['headers'][_0x0821('0x2f')],_0x0821('0x34'))){validateJwt(_0xcd8991,_0x5949f4,_0xf68c64);}else{if(_0x728145){_0xf68c64();}else{return _0x5949f4['status'](0x193)[_0x0821('0x2a')]({'message':_0x0821('0x35')});}}}else if(_0xcd8991[_0x0821('0x36')][_0x0821('0x37')]){try{var _0x10c442={'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0x0821('0x38')]()};verifyJwt(_0xcd8991[_0x0821('0x36')][_0x0821('0x37')],_0x10c442)[_0x0821('0x29')](function(_0x4c61db){return db[_0x0821('0x30')][_0x0821('0x39')]({'where':{'id':_0x4c61db['sub']}})[_0x0821('0x29')](function(_0x39a56d){if(!_0x39a56d||!_['isEqual'](_0x39a56d['apiKeyNonce'],_0x4c61db[_0x0821('0x3a')])){return _0x5949f4[_0x0821('0x33')](0x191)[_0x0821('0x2a')]({'message':_0x0821('0x3b')});}_0xcd8991['user']={'id':_0x39a56d['id']};_0xf68c64();});})[_0x0821('0x2c')](function(){return _0x5949f4['status'](0x191)[_0x0821('0x2a')]({'message':_0x0821('0x3c')});});}catch(_0x1df56f){_0xf68c64(_0x1df56f);}}else if(_0x728145){_0xf68c64();}else{return _0x5949f4[_0x0821('0x33')](0x193)[_0x0821('0x2a')]({'message':_0x0821('0x35')});}})[_0x0821('0x3d')](function(_0x26178e,_0x315466,_0x2126af){if(_0x26178e[_0x0821('0x23')]){db['User'][_0x0821('0x39')]({'where':{'id':_0x26178e[_0x0821('0x23')]['id']},'attributes':userAttributes})['then'](function(_0x32b3bc){if(!_0x32b3bc){return _0x315466['status'](0x194)['json']({'message':_0x0821('0x3e')});}_0x26178e['user']=_0x32b3bc;_0x2126af();})['catch'](function(_0x49fd7e){_0x2126af(_0x49fd7e);});}else if(_0x728145){_0x2126af();}else{return _0x315466[_0x0821('0x33')](0x194)[_0x0821('0x2a')]({'message':_0x0821('0x3f')});}});};exports[_0x0821('0x40')]=function canUpdate(){return compose()[_0x0821('0x3d')](function(_0x15b698,_0x596406,_0x107ecc){return require(_0x0821('0x41'))[_0x0821('0x42')]()[_0x0821('0x29')](function(_0x10fd82){if(_0x10fd82[_0x0821('0x43')]){_0x107ecc();}else{return _0x596406[_0x0821('0x33')](0x193)['json']({'message':_0x0821('0x44')});}})[_0x0821('0x2c')](function(_0x4a654f){_0x107ecc(_0x4a654f);});});};exports[_0x0821('0x45')]=function(_0xf41bcc,_0x50cc09,_0x138314){_0xf41bcc[_0x0821('0x45')]=!![];return _0x138314();};exports[_0x0821('0x46')]=function signToken(_0x13a540){return signJwt(_0x13a540);};exports[_0x0821('0x47')]=function(_0x401764,_0x2282ca){if(!_0x401764[_0x0821('0x23')]){return _0x2282ca['status'](0x194)['json']({'message':_0x0821('0x48')});}var _0x3de0b2={'payload':{'id':_0x401764[_0x0821('0x23')]['id'],'role':_0x401764['user'][_0x0821('0x49')]},'options':{'expiresIn':0x15180}};return signJwt(_0x3de0b2)['then'](function(_0x4f84b8){_0x2282ca[_0x0821('0x4a')](_0x0821('0x4b'),_0x4f84b8);_0x2282ca['redirect'](_0x0821('0x4c'));})[_0x0821('0x2c')](function(_0x17daa9){return _0x2282ca[_0x0821('0x33')](0x1f4)[_0x0821('0x4d')](_0x17daa9);});};exports[_0x0821('0x4e')]=function(_0x473fd8){if(_[_0x0821('0x4f')](_0x473fd8[_0x0821('0x50')])||_[_0x0821('0x4f')](_0x473fd8['apiKeyIat'])){return null;}else{return createJwt(_0x473fd8);}};exports[_0x0821('0x51')]=function(_0x12d39b){_0x12d39b[_0x0821('0x50')]=generateNonce();_0x12d39b[_0x0821('0x52')]=generateIssuedAt();return createJwt(_0x12d39b);};exports[_0x0821('0x53')]=function(_0x5096f2,_0x2883b0){var _0x1677d3=_0x5096f2['query']['apikey'];if(_0x1677d3){var _0x252822={'nonce':_0x2883b0[_0x0821('0x50')],'iat':_0x2883b0[_0x0821('0x52')],'audience':hardwareConf[_0x0821('0x38')](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0x1677d3,_0x252822)[_0x0821('0x29')](function(){return generateApiKey(_0x2883b0);});}else{throw{'message':'Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one'};}};function signJwt(_0xd5456c){var _0x48de02=BPromise['promisify'](jwt[_0x0821('0x54')],{'context':jwt});var _0x321899=_0xd5456c[_0x0821('0x55')]||config[_0x0821('0x7')][_0x0821('0x56')];return new BPromise(function(_0x3370b8,_0x622414){_0x48de02(_0xd5456c[_0x0821('0x57')],_0x321899,_0xd5456c[_0x0821('0x58')])['then'](function(_0x52b74f){_0x3370b8(_0x52b74f);})['catch'](function(_0x28a591){_0x622414(_0x28a591);});});}function verifyJwt(_0x1a73df,_0x27c6aa,_0xba49a){var _0x3914d9=BPromise[_0x0821('0x59')](jwt['verify'],{'context':jwt});var _0x38231f=_0xba49a||config[_0x0821('0x7')]['session'];return new BPromise(function(_0xd7802a,_0x3eae6c){_0x3914d9(_0x1a73df,_0x38231f,_0x27c6aa)['then'](function(_0x1c47f9){_0xd7802a(_0x1c47f9);})[_0x0821('0x2c')](function(_0x36ac59){_0x3eae6c(_0x36ac59);});});}function generateNonce(){return crypto[_0x0821('0x5a')](0x10)[_0x0821('0x5b')](_0x0821('0x5c'));}function generateIssuedAt(){return Math[_0x0821('0x5d')](Date['now']()/0x3e8)['toString']();}function createJwt(_0x49a918){var _0x214d01={'payload':{'iat':_0x49a918['apiKeyIat'],'nonce':_0x49a918[_0x0821('0x50')]},'options':{'algorithm':_0x0821('0x5e'),'subject':_0x49a918['id'][_0x0821('0x5b')](),'issuer':hardwareConf['getUuid'](),'audience':hardwareConf[_0x0821('0x38')]()}};return signJwt(_0x214d01)[_0x0821('0x29')](function(_0x2984e6){return{'iat':_0x49a918['apiKeyIat'],'nonce':_0x49a918[_0x0821('0x50')],'token':_0x2984e6};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index 5290c52..7a7da02 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 _0xe706=['unlink','crypto','bluebird','aes192','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher','algorithm','data','update','end','final','binary','write','close','createDecipher'];(function(_0x325507,_0x1968ab){var _0x1a5253=function(_0x591c8e){while(--_0x591c8e){_0x325507['push'](_0x325507['shift']());}};_0x1a5253(++_0x1968ab);}(_0xe706,0xa3));var _0x6e70=function(_0x5be527,_0x47a3f2){_0x5be527=_0x5be527-0x0;var _0x3f0f16=_0xe706[_0x5be527];return _0x3f0f16;};'use strict';var crypto=require(_0x6e70('0x0'));var fs=require('fs');var BPromise=require(_0x6e70('0x1'));var defaultOptions={'algorithm':_0x6e70('0x2')};function combineOptions(_0x5e8446){var _0x2cae77={};for(var _0x315629 in defaultOptions){if(defaultOptions[_0x6e70('0x3')](_0x315629)){_0x2cae77[_0x315629]=defaultOptions[_0x315629];}}if(_0x5e8446){for(var _0x7dfbc3 in _0x5e8446){if(_0x5e8446[_0x6e70('0x3')](_0x7dfbc3)){_0x2cae77[_0x7dfbc3]=_0x5e8446[_0x7dfbc3];}}}return _0x2cae77;}exports[_0x6e70('0x4')]=function(_0x376a8d,_0x506db9,_0x1b0389,_0x4381d1){return new BPromise(function(_0x36357b,_0x293ce7){_0x4381d1=combineOptions(_0x4381d1);var _0x45a2d4=new Buffer(_0x1b0389);var _0x188ed3=fs[_0x6e70('0x5')](_0x376a8d);var _0x449b48=fs[_0x6e70('0x6')](_0x506db9);var _0x25e61c=crypto[_0x6e70('0x7')](_0x4381d1[_0x6e70('0x8')],_0x45a2d4);_0x188ed3['on'](_0x6e70('0x9'),function(_0x3f474a){var _0x37b3e0=new Buffer(_0x25e61c[_0x6e70('0xa')](_0x3f474a),'binary');_0x449b48['write'](_0x37b3e0);});_0x188ed3['on'](_0x6e70('0xb'),function(){try{var _0x15a1a5=new Buffer(_0x25e61c[_0x6e70('0xc')](_0x6e70('0xd')),_0x6e70('0xd'));_0x449b48[_0x6e70('0xe')](_0x15a1a5);_0x449b48[_0x6e70('0xb')]();_0x449b48['on'](_0x6e70('0xf'),function(){return _0x36357b(_0x506db9);});}catch(_0x5dfbaa){fs['unlink'](_0x506db9);return _0x293ce7(_0x5dfbaa);}});});};exports['decryptFile']=function(_0x257e81,_0x5a37a6,_0x53aed0,_0x304716){return new BPromise(function(_0x22c50c,_0x5d9263){_0x304716=combineOptions(_0x304716);var _0x24f3ac=new Buffer(_0x53aed0);var _0x5c3fe7=fs[_0x6e70('0x5')](_0x257e81);var _0x161f23=fs['createWriteStream'](_0x5a37a6);var _0x49029f=crypto[_0x6e70('0x10')](_0x304716['algorithm'],_0x24f3ac);_0x5c3fe7['on'](_0x6e70('0x9'),function(_0x173afe){var _0x53acdc=new Buffer(_0x49029f['update'](_0x173afe),_0x6e70('0xd'));_0x161f23[_0x6e70('0xe')](_0x53acdc);});_0x5c3fe7['on'](_0x6e70('0xb'),function(){try{var _0x3a9978=new Buffer(_0x49029f[_0x6e70('0xc')](_0x6e70('0xd')),_0x6e70('0xd'));_0x161f23[_0x6e70('0xe')](_0x3a9978);_0x161f23[_0x6e70('0xb')]();_0x161f23['on'](_0x6e70('0xf'),function(){return _0x22c50c(_0x5a37a6);});}catch(_0x4a0cfe){fs[_0x6e70('0x11')](_0x5a37a6);return _0x5d9263(_0x4a0cfe);}});});}; \ No newline at end of file +var _0xe706=['unlink','crypto','bluebird','aes192','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher','algorithm','data','update','end','final','binary','write','close','createDecipher'];(function(_0x228ac9,_0x42f065){var _0x69fe02=function(_0x210551){while(--_0x210551){_0x228ac9['push'](_0x228ac9['shift']());}};_0x69fe02(++_0x42f065);}(_0xe706,0xa3));var _0x6e70=function(_0x1a4a0b,_0x5e8e4f){_0x1a4a0b=_0x1a4a0b-0x0;var _0x15d52a=_0xe706[_0x1a4a0b];return _0x15d52a;};'use strict';var crypto=require(_0x6e70('0x0'));var fs=require('fs');var BPromise=require(_0x6e70('0x1'));var defaultOptions={'algorithm':_0x6e70('0x2')};function combineOptions(_0x5e8446){var _0x2cae77={};for(var _0x315629 in defaultOptions){if(defaultOptions[_0x6e70('0x3')](_0x315629)){_0x2cae77[_0x315629]=defaultOptions[_0x315629];}}if(_0x5e8446){for(var _0x7dfbc3 in _0x5e8446){if(_0x5e8446[_0x6e70('0x3')](_0x7dfbc3)){_0x2cae77[_0x7dfbc3]=_0x5e8446[_0x7dfbc3];}}}return _0x2cae77;}exports[_0x6e70('0x4')]=function(_0x376a8d,_0x506db9,_0x1b0389,_0x4381d1){return new BPromise(function(_0x36357b,_0x293ce7){_0x4381d1=combineOptions(_0x4381d1);var _0x45a2d4=new Buffer(_0x1b0389);var _0x188ed3=fs[_0x6e70('0x5')](_0x376a8d);var _0x449b48=fs[_0x6e70('0x6')](_0x506db9);var _0x25e61c=crypto[_0x6e70('0x7')](_0x4381d1[_0x6e70('0x8')],_0x45a2d4);_0x188ed3['on'](_0x6e70('0x9'),function(_0x3f474a){var _0x37b3e0=new Buffer(_0x25e61c[_0x6e70('0xa')](_0x3f474a),'binary');_0x449b48['write'](_0x37b3e0);});_0x188ed3['on'](_0x6e70('0xb'),function(){try{var _0x15a1a5=new Buffer(_0x25e61c[_0x6e70('0xc')](_0x6e70('0xd')),_0x6e70('0xd'));_0x449b48[_0x6e70('0xe')](_0x15a1a5);_0x449b48[_0x6e70('0xb')]();_0x449b48['on'](_0x6e70('0xf'),function(){return _0x36357b(_0x506db9);});}catch(_0x5dfbaa){fs['unlink'](_0x506db9);return _0x293ce7(_0x5dfbaa);}});});};exports['decryptFile']=function(_0x257e81,_0x5a37a6,_0x53aed0,_0x304716){return new BPromise(function(_0x22c50c,_0x5d9263){_0x304716=combineOptions(_0x304716);var _0x24f3ac=new Buffer(_0x53aed0);var _0x5c3fe7=fs[_0x6e70('0x5')](_0x257e81);var _0x161f23=fs['createWriteStream'](_0x5a37a6);var _0x49029f=crypto[_0x6e70('0x10')](_0x304716['algorithm'],_0x24f3ac);_0x5c3fe7['on'](_0x6e70('0x9'),function(_0x173afe){var _0x53acdc=new Buffer(_0x49029f['update'](_0x173afe),_0x6e70('0xd'));_0x161f23[_0x6e70('0xe')](_0x53acdc);});_0x5c3fe7['on'](_0x6e70('0xb'),function(){try{var _0x3a9978=new Buffer(_0x49029f[_0x6e70('0xc')](_0x6e70('0xd')),_0x6e70('0xd'));_0x161f23[_0x6e70('0xe')](_0x3a9978);_0x161f23[_0x6e70('0xb')]();_0x161f23['on'](_0x6e70('0xf'),function(){return _0x22c50c(_0x5a37a6);});}catch(_0x4a0cfe){fs[_0x6e70('0x11')](_0x5a37a6);return _0x5d9263(_0x4a0cfe);}});});}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 338e4a3..f5480ff 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 _0xaa88=['join','each','csv','writeFileSync','%s.%s','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','util','path','lodash','to-csv','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','argv','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','find','split','then','splitSizeCsv','sequelize','query','num','Empty','length','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','push','SELECT','dirname','basename','existsSync','mkdirSync'];(function(_0x38ae20,_0x10e0ca){var _0x1bf5f6=function(_0x57593e){while(--_0x57593e){_0x38ae20['push'](_0x38ae20['shift']());}};_0x1bf5f6(++_0x10e0ca);}(_0xaa88,0x137));var _0x8aa8=function(_0x21f931,_0x598b2d){_0x21f931=_0x21f931-0x0;var _0x3f083c=_0xaa88[_0x21f931];return _0x3f083c;};'use strict';var util=require(_0x8aa8('0x0'));var path=require(_0x8aa8('0x1'));var _=require(_0x8aa8('0x2'));var csv=require(_0x8aa8('0x3'));var fs=require('fs');var BPromise=require('bluebird');var zipdir=require(_0x8aa8('0x4'));var rimraf=require(_0x8aa8('0x5'));var db=require(_0x8aa8('0x6'))['db'];var dbH=require(_0x8aa8('0x6'))[_0x8aa8('0x7')];var logger=require(_0x8aa8('0x8'))('analytics');var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x8aa8('0x9')][0x3];var PATH=process['argv'][0x4];function analyticExtractedReport(_0x449d2d,_0x1ed84d){var _0x27c08d={'status':_0x449d2d};var _0x40826f={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1ed84d){_0x27c08d['savename']=_0x1ed84d;}return db[_0x8aa8('0xa')][_0x8aa8('0xb')](_0x27c08d,_0x40826f);}function main(){var _0x224f25=0x1388;var _0x5c94d4;logger[_0x8aa8('0xc')](util[_0x8aa8('0xd')](_0x8aa8('0xe'),EXTRACTED_REPORT_ID,_0x8aa8('0xf')));return db['Setting'][_0x8aa8('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x8aa8('0x11'),'splitSizeCsv']})[_0x8aa8('0x12')](function(_0xa691d6){if(_0xa691d6){_0x5c94d4=_0xa691d6;_0x224f25=_0x5c94d4[_0x8aa8('0x13')]||0x1388;}})['then'](function(){return dbH[_0x8aa8('0x14')][_0x8aa8('0x15')](util[_0x8aa8('0xd')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x8aa8('0x14')]['QueryTypes']['SELECT']});})[_0x8aa8('0x12')](function(_0x200662){if(!_0x200662[0x0][_0x8aa8('0x16')]){return analyticExtractedReport(_0x8aa8('0x17'));}var _0x42a6a4=[];var _0x3778f4=0x0;var _0x1bdd39=!![];if(_0x200662&&_0x200662[_0x8aa8('0x18')]){var _0x20d303=_0x200662[0x0]['num']%(_0x3778f4+_0x224f25);if(_0x5c94d4['split']){for(;_0x1bdd39;_0x3778f4+=_0x224f25,_0x20d303=_0x200662[0x0][_0x8aa8('0x16')]%(_0x3778f4+_0x224f25)){if(_0x20d303==0x0||_0x20d303==_0x200662[0x0]['num']){_0x1bdd39=![];}_0x42a6a4['push'](dbH[_0x8aa8('0x14')]['query'](util[_0x8aa8('0xd')](_0x8aa8('0x19'),QUERY,_0x224f25,_0x3778f4),{'type':dbH[_0x8aa8('0x14')][_0x8aa8('0x1a')]['SELECT']}));}}else{_0x42a6a4[_0x8aa8('0x1b')](dbH[_0x8aa8('0x14')][_0x8aa8('0x15')](QUERY,{'type':dbH[_0x8aa8('0x14')][_0x8aa8('0x1a')][_0x8aa8('0x1c')]}));}}var _0x5d9b62=path[_0x8aa8('0x1d')](PATH);var _0x4cc455=path[_0x8aa8('0x1e')](PATH,'.csv');var _0x2c1828=_0x5c94d4['split']&&_0x42a6a4[_0x8aa8('0x18')]>0x1;var _0x40adb5=[];if(!fs[_0x8aa8('0x1f')](path['join'](_0x5d9b62,_0x4cc455))&&_0x2c1828){fs[_0x8aa8('0x20')](path[_0x8aa8('0x21')](_0x5d9b62,_0x4cc455));}return BPromise[_0x8aa8('0x22')](_0x42a6a4,function(_0x547a7b){_0x40adb5['push'](_0x547a7b);})[_0x8aa8('0x12')](function(){for(var _0x44e2d8=0x0;_0x44e2d8<_0x40adb5[_0x8aa8('0x18')];_0x44e2d8+=0x1){var _0x3a3c7a;var _0x24143e=_0x40adb5[_0x44e2d8];if(_0x2c1828){_0x3a3c7a=path['join'](_0x5d9b62,_0x4cc455,util[_0x8aa8('0xd')]('%s%d.%s',_0x4cc455,_0x44e2d8,_0x8aa8('0x23')));}else{_0x3a3c7a=path[_0x8aa8('0x21')](_0x5d9b62,util[_0x8aa8('0xd')]('%s.%s',_0x4cc455,'csv'));}fs[_0x8aa8('0x24')](_0x3a3c7a,csv(_0x24143e));}})['then'](function(){if(_0x2c1828){zipdir(path[_0x8aa8('0x21')](_0x5d9b62,_0x4cc455),{'saveTo':path[_0x8aa8('0x21')](_0x5d9b62,util[_0x8aa8('0xd')](_0x8aa8('0x25'),_0x4cc455,_0x8aa8('0x26')))},function(_0x4d5c2e,_0x267f4c){});rimraf(path[_0x8aa8('0x21')](_0x5d9b62,_0x4cc455),function(){});}})['then'](function(){logger[_0x8aa8('0xc')](util[_0x8aa8('0xd')](_0x8aa8('0x27'),EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0x8aa8('0x28'),_0x2c1828?util[_0x8aa8('0xd')](_0x8aa8('0x25'),_0x4cc455,_0x2c1828?_0x8aa8('0x26'):_0x8aa8('0x23')):null);});})[_0x8aa8('0x29')](function(_0x370401){logger[_0x8aa8('0xc')](util[_0x8aa8('0xd')](_0x8aa8('0x2a'),EXTRACTED_REPORT_ID,_0x8aa8('0xf')),util['inspect'](_0x370401,{'showHidden':![],'depth':null}));return analyticExtractedReport('Failed');});}main(); \ No newline at end of file +var _0xfd28=['%s.%s','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','zip','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','path','lodash','bluebird','rimraf','../../mysqldb','../../config/logger','analytics','argv','savename','update','format','CSV','find','splitSizeCsv','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','split','push','%s\x20limit\x20%d\x20OFFSET\x20%d','basename','length','existsSync','join','mkdirSync','each','csv','writeFileSync'];(function(_0xb24a3e,_0x4a3594){var _0x4038d7=function(_0x1ea3c3){while(--_0x1ea3c3){_0xb24a3e['push'](_0xb24a3e['shift']());}};_0x4038d7(++_0x4a3594);}(_0xfd28,0x148));var _0x8fd2=function(_0x496738,_0x3f1a9f){_0x496738=_0x496738-0x0;var _0xee1381=_0xfd28[_0x496738];return _0xee1381;};'use strict';var util=require('util');var path=require(_0x8fd2('0x0'));var _=require(_0x8fd2('0x1'));var csv=require('to-csv');var fs=require('fs');var BPromise=require(_0x8fd2('0x2'));var zipdir=require('zip-dir');var rimraf=require(_0x8fd2('0x3'));var db=require(_0x8fd2('0x4'))['db'];var dbH=require(_0x8fd2('0x4'))['dbH'];var logger=require(_0x8fd2('0x5'))(_0x8fd2('0x6'));var EXTRACTED_REPORT_ID=Number(process[_0x8fd2('0x7')][0x2]);var QUERY=process[_0x8fd2('0x7')][0x3];var PATH=process[_0x8fd2('0x7')][0x4];function analyticExtractedReport(_0x4bdc1a,_0x53d938){var _0x10fccf={'status':_0x4bdc1a};var _0x466c3d={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x53d938){_0x10fccf[_0x8fd2('0x8')]=_0x53d938;}return db['AnalyticExtractedReport'][_0x8fd2('0x9')](_0x10fccf,_0x466c3d);}function main(){var _0x49ca87=0x1388;var _0x2842f3;logger['info'](util[_0x8fd2('0xa')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x8fd2('0xb')));return db['Setting'][_0x8fd2('0xc')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x8fd2('0xd')]})[_0x8fd2('0xe')](function(_0xfd78d){if(_0xfd78d){_0x2842f3=_0xfd78d;_0x49ca87=_0x2842f3[_0x8fd2('0xd')]||0x1388;}})[_0x8fd2('0xe')](function(){return dbH[_0x8fd2('0xf')][_0x8fd2('0x10')](util[_0x8fd2('0xa')](_0x8fd2('0x11'),QUERY),{'type':dbH[_0x8fd2('0xf')][_0x8fd2('0x12')][_0x8fd2('0x13')]});})[_0x8fd2('0xe')](function(_0x40712c){if(!_0x40712c[0x0][_0x8fd2('0x14')]){return analyticExtractedReport('Empty');}var _0x20daca=[];var _0x5ef478=0x0;var _0x4f0b17=!![];if(_0x40712c&&_0x40712c['length']){var _0x3b79f3=_0x40712c[0x0][_0x8fd2('0x14')]%(_0x5ef478+_0x49ca87);if(_0x2842f3[_0x8fd2('0x15')]){for(;_0x4f0b17;_0x5ef478+=_0x49ca87,_0x3b79f3=_0x40712c[0x0][_0x8fd2('0x14')]%(_0x5ef478+_0x49ca87)){if(_0x3b79f3==0x0||_0x3b79f3==_0x40712c[0x0]['num']){_0x4f0b17=![];}_0x20daca[_0x8fd2('0x16')](dbH[_0x8fd2('0xf')][_0x8fd2('0x10')](util[_0x8fd2('0xa')](_0x8fd2('0x17'),QUERY,_0x49ca87,_0x5ef478),{'type':dbH['sequelize']['QueryTypes'][_0x8fd2('0x13')]}));}}else{_0x20daca['push'](dbH[_0x8fd2('0xf')]['query'](QUERY,{'type':dbH[_0x8fd2('0xf')][_0x8fd2('0x12')]['SELECT']}));}}var _0x122b60=path['dirname'](PATH);var _0xd3981f=path[_0x8fd2('0x18')](PATH,'.csv');var _0x1c925c=_0x2842f3[_0x8fd2('0x15')]&&_0x20daca[_0x8fd2('0x19')]>0x1;var _0x490ea5=[];if(!fs[_0x8fd2('0x1a')](path[_0x8fd2('0x1b')](_0x122b60,_0xd3981f))&&_0x1c925c){fs[_0x8fd2('0x1c')](path[_0x8fd2('0x1b')](_0x122b60,_0xd3981f));}return BPromise[_0x8fd2('0x1d')](_0x20daca,function(_0x25db4e){_0x490ea5[_0x8fd2('0x16')](_0x25db4e);})[_0x8fd2('0xe')](function(){for(var _0x1456b4=0x0;_0x1456b4<_0x490ea5[_0x8fd2('0x19')];_0x1456b4+=0x1){var _0x3392fb;var _0x1f3237=_0x490ea5[_0x1456b4];if(_0x1c925c){_0x3392fb=path[_0x8fd2('0x1b')](_0x122b60,_0xd3981f,util['format']('%s%d.%s',_0xd3981f,_0x1456b4,_0x8fd2('0x1e')));}else{_0x3392fb=path[_0x8fd2('0x1b')](_0x122b60,util[_0x8fd2('0xa')]('%s.%s',_0xd3981f,_0x8fd2('0x1e')));}fs[_0x8fd2('0x1f')](_0x3392fb,csv(_0x1f3237));}})[_0x8fd2('0xe')](function(){if(_0x1c925c){zipdir(path[_0x8fd2('0x1b')](_0x122b60,_0xd3981f),{'saveTo':path[_0x8fd2('0x1b')](_0x122b60,util[_0x8fd2('0xa')](_0x8fd2('0x20'),_0xd3981f,'zip'))},function(_0xe76676,_0x13c9b9){});rimraf(path[_0x8fd2('0x1b')](_0x122b60,_0xd3981f),function(){});}})[_0x8fd2('0xe')](function(){logger[_0x8fd2('0x21')](util[_0x8fd2('0xa')](_0x8fd2('0x22'),EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport('Completed',_0x1c925c?util['format'](_0x8fd2('0x20'),_0xd3981f,_0x1c925c?_0x8fd2('0x23'):_0x8fd2('0x1e')):null);});})[_0x8fd2('0x24')](function(_0x5a0b3b){logger['info'](util[_0x8fd2('0xa')](_0x8fd2('0x25'),EXTRACTED_REPORT_ID,_0x8fd2('0xb')),util[_0x8fd2('0x26')](_0x5a0b3b,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x8fd2('0x27'));});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 91b62fc..0a37603 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 _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(_0x4ffde9,_0x170864){var _0x1a3a7f=function(_0x1ea95d){while(--_0x1ea95d){_0x4ffde9['push'](_0x4ffde9['shift']());}};_0x1a3a7f(++_0x170864);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'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 +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(_0x5e3824,_0x471b32){var _0x47c2c4=function(_0x2f4857){while(--_0x2f4857){_0x5e3824['push'](_0x5e3824['shift']());}};_0x47c2c4(++_0x471b32);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'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 8ea5f65..44dee74 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 _0x7769=['util','path','lodash','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting','find','splitSizeXlsx','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','split','length','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.xlsx','existsSync','join','mkdirSync','each','then','%s%d.%s','xlsx','%s.%s','writeFileSync','binary','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','XLSX','Failed'];(function(_0x45adaf,_0x21c3c1){var _0x15d189=function(_0x48dc43){while(--_0x48dc43){_0x45adaf['push'](_0x45adaf['shift']());}};_0x15d189(++_0x21c3c1);}(_0x7769,0x15e));var _0x9776=function(_0x45dd13,_0x49cb73){_0x45dd13=_0x45dd13-0x0;var _0x491d0b=_0x7769[_0x45dd13];return _0x491d0b;};'use strict';var util=require(_0x9776('0x0'));var path=require(_0x9776('0x1'));var _=require(_0x9776('0x2'));var fs=require('fs');var json2xls=require(_0x9776('0x3'));var BPromise=require(_0x9776('0x4'));var zipdir=require(_0x9776('0x5'));var rimraf=require(_0x9776('0x6'));var db=require(_0x9776('0x7'))['db'];var dbH=require(_0x9776('0x7'))[_0x9776('0x8')];var logger=require(_0x9776('0x9'))(_0x9776('0xa'));var EXTRACTED_REPORT_ID=Number(process[_0x9776('0xb')][0x2]);var QUERY=process[_0x9776('0xb')][0x3];var PATH=process[_0x9776('0xb')][0x4];function analyticExtractedReport(_0x157a6f,_0x2b9018){var _0x2ab268={'status':_0x157a6f};var _0x451ba0={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2b9018){_0x2ab268['savename']=_0x2b9018;}return db[_0x9776('0xc')][_0x9776('0xd')](_0x2ab268,_0x451ba0);}function main(){var _0x16ce7f=0x1388;var _0xbfc7bf;logger[_0x9776('0xe')](util[_0x9776('0xf')](_0x9776('0x10'),EXTRACTED_REPORT_ID,'XLSX'));return db[_0x9776('0x11')][_0x9776('0x12')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split','splitSizeXlsx']})['then'](function(_0x28b2ba){if(_0x28b2ba){_0xbfc7bf=_0x28b2ba;_0x16ce7f=_0xbfc7bf[_0x9776('0x13')]||0x1388;}})['then'](function(){return dbH[_0x9776('0x14')][_0x9776('0x15')](util[_0x9776('0xf')](_0x9776('0x16'),QUERY),{'type':dbH[_0x9776('0x14')][_0x9776('0x17')][_0x9776('0x18')]});})['then'](function(_0xd3c99a){if(!_0xd3c99a[0x0][_0x9776('0x19')]){return analyticExtractedReport(_0x9776('0x1a'));}var _0x16647a=[];var _0x4d4196=0x0;var _0x103365=!![];if(_0xbfc7bf[_0x9776('0x1b')]){if(_0xd3c99a&&_0xd3c99a[_0x9776('0x1c')]){var _0x40fc66=_0xd3c99a[0x0]['num']%(_0x4d4196+_0x16ce7f);for(;_0x103365;_0x4d4196+=_0x16ce7f,_0x40fc66=_0xd3c99a[0x0][_0x9776('0x19')]%(_0x4d4196+_0x16ce7f)){if(_0x40fc66==0x0||_0x40fc66==_0xd3c99a[0x0][_0x9776('0x19')]){_0x103365=![];}_0x16647a[_0x9776('0x1d')](dbH[_0x9776('0x14')]['query'](util[_0x9776('0xf')](_0x9776('0x1e'),QUERY,_0x16ce7f,_0x4d4196),{'type':dbH[_0x9776('0x14')][_0x9776('0x17')]['SELECT']}));}}}else{_0x16647a[_0x9776('0x1d')](dbH[_0x9776('0x14')][_0x9776('0x15')](QUERY,{'type':dbH['sequelize'][_0x9776('0x17')][_0x9776('0x18')]}));}var _0x318bfc=path[_0x9776('0x1f')](PATH);var _0x2ea392=path[_0x9776('0x20')](PATH,_0x9776('0x21'));var _0x3bbc42=_0xbfc7bf['split']&&_0x16647a[_0x9776('0x1c')]>0x1;var _0x3879e4=[];if(!fs[_0x9776('0x22')](path[_0x9776('0x23')](_0x318bfc,_0x2ea392))&&_0x3bbc42){fs[_0x9776('0x24')](path[_0x9776('0x23')](_0x318bfc,_0x2ea392));}return BPromise[_0x9776('0x25')](_0x16647a,function(_0x52594a){_0x3879e4[_0x9776('0x1d')](_0x52594a);})[_0x9776('0x26')](function(){for(var _0x4004e5=0x0;_0x4004e5<_0x3879e4[_0x9776('0x1c')];_0x4004e5+=0x1){var _0x5630d1;var _0x5878d1=_0x3879e4[_0x4004e5];if(_0x3bbc42){_0x5630d1=path[_0x9776('0x23')](_0x318bfc,_0x2ea392,util[_0x9776('0xf')](_0x9776('0x27'),_0x2ea392,_0x4004e5,_0x9776('0x28')));}else{_0x5630d1=path['join'](_0x318bfc,util[_0x9776('0xf')](_0x9776('0x29'),_0x2ea392,_0x9776('0x28')));}fs[_0x9776('0x2a')](_0x5630d1,json2xls(_0x5878d1),_0x9776('0x2b'));}})[_0x9776('0x26')](function(){if(_0x3bbc42){zipdir(path['join'](_0x318bfc,_0x2ea392),{'saveTo':path[_0x9776('0x23')](_0x318bfc,util[_0x9776('0xf')](_0x9776('0x29'),_0x2ea392,_0x9776('0x2c')))},function(_0x37186c,_0x5803a3){});rimraf(path['join'](_0x318bfc,_0x2ea392),function(){});}})[_0x9776('0x26')](function(){logger[_0x9776('0xe')](util['format'](_0x9776('0x2d'),EXTRACTED_REPORT_ID,'XLSX'));return analyticExtractedReport(_0x9776('0x2e'),_0x3bbc42?util['format'](_0x9776('0x29'),_0x2ea392,_0x3bbc42?_0x9776('0x2c'):_0x9776('0x28')):null);});})[_0x9776('0x2f')](function(_0x8c611d){logger[_0x9776('0xe')](util[_0x9776('0xf')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x9776('0x30')),util['inspect'](_0x8c611d,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x9776('0x31'));});}main(); \ No newline at end of file +var _0xbd6d=['Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','util','path','lodash','json2xls','bluebird','rimraf','../../mysqldb','dbH','../../config/logger','argv','savename','AnalyticExtractedReport','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','split','splitSizeXlsx','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','length','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.xlsx','join','each','%s%d.%s','xlsx','%s.%s','writeFileSync','binary','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed'];(function(_0x546a0e,_0x4b601f){var _0x3f9ad4=function(_0x1f7cc3){while(--_0x1f7cc3){_0x546a0e['push'](_0x546a0e['shift']());}};_0x3f9ad4(++_0x4b601f);}(_0xbd6d,0xc5));var _0xdbd6=function(_0x8288e1,_0x47a093){_0x8288e1=_0x8288e1-0x0;var _0x4d2341=_0xbd6d[_0x8288e1];return _0x4d2341;};'use strict';var util=require(_0xdbd6('0x0'));var path=require(_0xdbd6('0x1'));var _=require(_0xdbd6('0x2'));var fs=require('fs');var json2xls=require(_0xdbd6('0x3'));var BPromise=require(_0xdbd6('0x4'));var zipdir=require('zip-dir');var rimraf=require(_0xdbd6('0x5'));var db=require(_0xdbd6('0x6'))['db'];var dbH=require(_0xdbd6('0x6'))[_0xdbd6('0x7')];var logger=require(_0xdbd6('0x8'))('analytics');var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0xdbd6('0x9')][0x3];var PATH=process[_0xdbd6('0x9')][0x4];function analyticExtractedReport(_0x3d119d,_0x211dac){var _0x13d6ed={'status':_0x3d119d};var _0x2c515c={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x211dac){_0x13d6ed[_0xdbd6('0xa')]=_0x211dac;}return db[_0xdbd6('0xb')]['update'](_0x13d6ed,_0x2c515c);}function main(){var _0x4995e0=0x1388;var _0xa923cf;logger[_0xdbd6('0xc')](util[_0xdbd6('0xd')](_0xdbd6('0xe'),EXTRACTED_REPORT_ID,_0xdbd6('0xf')));return db[_0xdbd6('0x10')][_0xdbd6('0x11')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xdbd6('0x12'),_0xdbd6('0x13')]})[_0xdbd6('0x14')](function(_0xe3e793){if(_0xe3e793){_0xa923cf=_0xe3e793;_0x4995e0=_0xa923cf[_0xdbd6('0x13')]||0x1388;}})[_0xdbd6('0x14')](function(){return dbH[_0xdbd6('0x15')][_0xdbd6('0x16')](util[_0xdbd6('0xd')](_0xdbd6('0x17'),QUERY),{'type':dbH[_0xdbd6('0x15')][_0xdbd6('0x18')][_0xdbd6('0x19')]});})[_0xdbd6('0x14')](function(_0x277379){if(!_0x277379[0x0][_0xdbd6('0x1a')]){return analyticExtractedReport(_0xdbd6('0x1b'));}var _0x217853=[];var _0xeac6c5=0x0;var _0x4d7ec9=!![];if(_0xa923cf['split']){if(_0x277379&&_0x277379[_0xdbd6('0x1c')]){var _0xd8a2e6=_0x277379[0x0][_0xdbd6('0x1a')]%(_0xeac6c5+_0x4995e0);for(;_0x4d7ec9;_0xeac6c5+=_0x4995e0,_0xd8a2e6=_0x277379[0x0][_0xdbd6('0x1a')]%(_0xeac6c5+_0x4995e0)){if(_0xd8a2e6==0x0||_0xd8a2e6==_0x277379[0x0][_0xdbd6('0x1a')]){_0x4d7ec9=![];}_0x217853[_0xdbd6('0x1d')](dbH[_0xdbd6('0x15')][_0xdbd6('0x16')](util[_0xdbd6('0xd')](_0xdbd6('0x1e'),QUERY,_0x4995e0,_0xeac6c5),{'type':dbH[_0xdbd6('0x15')][_0xdbd6('0x18')][_0xdbd6('0x19')]}));}}}else{_0x217853['push'](dbH['sequelize']['query'](QUERY,{'type':dbH[_0xdbd6('0x15')]['QueryTypes'][_0xdbd6('0x19')]}));}var _0x4080bf=path[_0xdbd6('0x1f')](PATH);var _0x52bd7e=path[_0xdbd6('0x20')](PATH,_0xdbd6('0x21'));var _0x380d65=_0xa923cf[_0xdbd6('0x12')]&&_0x217853[_0xdbd6('0x1c')]>0x1;var _0x2af7ee=[];if(!fs['existsSync'](path[_0xdbd6('0x22')](_0x4080bf,_0x52bd7e))&&_0x380d65){fs['mkdirSync'](path['join'](_0x4080bf,_0x52bd7e));}return BPromise[_0xdbd6('0x23')](_0x217853,function(_0x41a557){_0x2af7ee[_0xdbd6('0x1d')](_0x41a557);})[_0xdbd6('0x14')](function(){for(var _0x46a501=0x0;_0x46a501<_0x2af7ee[_0xdbd6('0x1c')];_0x46a501+=0x1){var _0x1a9098;var _0xfedbc4=_0x2af7ee[_0x46a501];if(_0x380d65){_0x1a9098=path[_0xdbd6('0x22')](_0x4080bf,_0x52bd7e,util[_0xdbd6('0xd')](_0xdbd6('0x24'),_0x52bd7e,_0x46a501,_0xdbd6('0x25')));}else{_0x1a9098=path[_0xdbd6('0x22')](_0x4080bf,util[_0xdbd6('0xd')](_0xdbd6('0x26'),_0x52bd7e,'xlsx'));}fs[_0xdbd6('0x27')](_0x1a9098,json2xls(_0xfedbc4),_0xdbd6('0x28'));}})['then'](function(){if(_0x380d65){zipdir(path['join'](_0x4080bf,_0x52bd7e),{'saveTo':path['join'](_0x4080bf,util[_0xdbd6('0xd')](_0xdbd6('0x26'),_0x52bd7e,_0xdbd6('0x29')))},function(_0xf4e856,_0x1fcc61){});rimraf(path['join'](_0x4080bf,_0x52bd7e),function(){});}})[_0xdbd6('0x14')](function(){logger[_0xdbd6('0xc')](util[_0xdbd6('0xd')](_0xdbd6('0x2a'),EXTRACTED_REPORT_ID,_0xdbd6('0xf')));return analyticExtractedReport(_0xdbd6('0x2b'),_0x380d65?util[_0xdbd6('0xd')]('%s.%s',_0x52bd7e,_0x380d65?_0xdbd6('0x29'):'xlsx'):null);});})[_0xdbd6('0x2c')](function(_0xa22fcf){logger[_0xdbd6('0xc')](util[_0xdbd6('0xd')](_0xdbd6('0x2d'),EXTRACTED_REPORT_ID,_0xdbd6('0xf')),util[_0xdbd6('0x2e')](_0xa22fcf,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0xdbd6('0x2f'));});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 79bc921..6b026e0 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 _0xb887=['extension','find','type','Set','format','context','VoiceExtensionId','push','CDR(destination)=','${EXTEN:','cutdigits','${EXTEN}','CDR(routeid)=','ExecIf','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','hasOwnProperty','recordingFormat','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','*,*,*,*','IntervalId','interval','tag','outbound','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)','app','appType','custom','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','GotoIfTime',',${EXTEN},','concat','transaction','destroy','sortBy','catch','lodash','then','intervals','VoiceExtension','findAll','models','uniq','map','exten','filter','groupBy','playback','priority','extensions'];(function(_0x570a4d,_0x3481e7){var _0x13872f=function(_0x36a679){while(--_0x36a679){_0x570a4d['push'](_0x570a4d['shift']());}};_0x13872f(++_0x3481e7);}(_0xb887,0xaf));var _0x7b88=function(_0x43c447,_0x42bb29){_0x43c447=_0x43c447-0x0;var _0x4607e6=_0xb887[_0x43c447];return _0x4607e6;};'use strict';var _=require(_0x7b88('0x0'));var util=require('util');function rewrite(_0x515594,_0x46ad8a){var _0x24cd4d=this;return _0x515594['models']['Interval']['findAll']({'raw':!![]})[_0x7b88('0x1')](function(_0x1f3a1c){_0x24cd4d[_0x7b88('0x2')]=_0x1f3a1c;return _0x515594['models'][_0x7b88('0x3')][_0x7b88('0x4')]({'where':{'IntervalId':_0x46ad8a['IntervalId']},'raw':!![]});})[_0x7b88('0x1')](function(_0x4b356f){return _0x515594[_0x7b88('0x5')][_0x7b88('0x3')][_0x7b88('0x4')]({'where':{'exten':{'$in':_[_0x7b88('0x6')](_[_0x7b88('0x7')](_0x4b356f,_0x7b88('0x8')))}},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})['then'](function(_0x4924ce){var _0x16b81a=_[_0x7b88('0x9')](_0x4924ce,{'priority':'1'});var _0x1046dc=_['filter'](_0x4924ce,{'isApp':0x1});var _0x52546d=_[_0x7b88('0xa')](_0x1046dc,_0x7b88('0x8'));var _0xb714d=['queue',_0x7b88('0xb')];var _0x34959c=[];var _0x1820ee=[];for(var _0x26440b in _0x52546d){if(_0x52546d['hasOwnProperty'](_0x26440b)){_0x24cd4d[_0x7b88('0xc')]=0x2;_0x24cd4d[_0x7b88('0xd')]=[];_0x24cd4d[_0x7b88('0xe')]=_[_0x7b88('0xf')](_0x16b81a,{'exten':_0x52546d[_0x26440b][0x0][_0x7b88('0x8')]});_0x24cd4d[_0x7b88('0xd')]['push']({'type':_0x52546d[_0x26440b][0x0][_0x7b88('0x10')],'app':_0x7b88('0x11'),'appdata':util[_0x7b88('0x12')]('CDR(type)=%s',_0x52546d[_0x26440b][0x0]['type']),'context':_0x52546d[_0x26440b][0x0][_0x7b88('0x13')],'exten':_0x52546d[_0x26440b][0x0][_0x7b88('0x8')],'priority':_0x24cd4d['priority']++,'VoiceExtensionId':_0x52546d[_0x26440b][0x0][_0x7b88('0x14')]});if(_0x52546d[_0x26440b][0x0][_0x7b88('0x10')]==='outbound'){if(_0x24cd4d[_0x7b88('0xe')]){_0x24cd4d[_0x7b88('0xd')][_0x7b88('0x15')]({'type':_0x52546d[_0x26440b][0x0][_0x7b88('0x10')],'app':_0x7b88('0x11'),'appdata':_0x7b88('0x16')+(_0x24cd4d[_0x7b88('0xe')]['cutdigits']?_0x7b88('0x17')+_0x24cd4d[_0x7b88('0xe')][_0x7b88('0x18')]+'}':_0x7b88('0x19')),'context':_0x52546d[_0x26440b][0x0]['context'],'exten':_0x52546d[_0x26440b][0x0][_0x7b88('0x8')],'priority':_0x24cd4d['priority']++,'VoiceExtensionId':_0x52546d[_0x26440b][0x0][_0x7b88('0x14')]});}_0x24cd4d['extensions'][_0x7b88('0x15')]({'type':_0x52546d[_0x26440b][0x0][_0x7b88('0x10')],'app':'Set','appdata':_0x7b88('0x1a')+_0x52546d[_0x26440b][0x0][_0x7b88('0x14')],'context':_0x52546d[_0x26440b][0x0][_0x7b88('0x13')],'exten':_0x52546d[_0x26440b][0x0][_0x7b88('0x8')],'priority':_0x24cd4d['priority']++,'VoiceExtensionId':_0x52546d[_0x26440b][0x0][_0x7b88('0x14')]});var _0x1cac74=_0x24cd4d['priority']++;_0x24cd4d[_0x7b88('0xd')]['push']({'type':_0x52546d[_0x26440b][0x0][_0x7b88('0x10')],'app':_0x7b88('0x1b'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x1cac74+0x2)+_0x7b88('0x1c')+(_0x1cac74+0x1)+')','context':_0x52546d[_0x26440b][0x0][_0x7b88('0x13')],'exten':_0x52546d[_0x26440b][0x0][_0x7b88('0x8')],'priority':_0x1cac74,'VoiceExtensionId':_0x52546d[_0x26440b][0x0]['VoiceExtensionId']});if(_0x24cd4d['extension']){_0x24cd4d[_0x7b88('0xd')]['push']({'type':_0x52546d[_0x26440b][0x0]['type'],'app':'Set','appdata':_0x24cd4d['extension'][_0x7b88('0x18')]?_0x7b88('0x1d')+_0x24cd4d[_0x7b88('0xe')][_0x7b88('0x18')]+'}':_0x7b88('0x1e'),'context':_0x52546d[_0x26440b][0x0][_0x7b88('0x13')],'exten':_0x52546d[_0x26440b][0x0][_0x7b88('0x8')],'priority':_0x24cd4d['priority']++,'VoiceExtensionId':_0x52546d[_0x26440b][0x0][_0x7b88('0x14')]});}_0x24cd4d['extensions'][_0x7b88('0x15')]({'type':_0x52546d[_0x26440b][0x0][_0x7b88('0x10')],'app':'Set','appdata':_0x7b88('0x1f')+_0x52546d[_0x26440b][0x0][_0x7b88('0x14')],'context':_0x52546d[_0x26440b][0x0][_0x7b88('0x13')],'exten':_0x52546d[_0x26440b][0x0]['exten'],'priority':_0x24cd4d[_0x7b88('0xc')]++,'VoiceExtensionId':_0x52546d[_0x26440b][0x0][_0x7b88('0x14')]});if(_0x24cd4d[_0x7b88('0xe')]&&_0x24cd4d['extension'][_0x7b88('0x20')](_0x7b88('0x21'))&&_0x24cd4d[_0x7b88('0xe')][_0x7b88('0x21')]!=='none'){_0x24cd4d['extensions'][_0x7b88('0x15')]({'type':_0x52546d[_0x26440b][0x0]['type'],'app':_0x7b88('0x11'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x52546d[_0x26440b][0x0][_0x7b88('0x13')],'exten':_0x52546d[_0x26440b][0x0]['exten'],'priority':_0x24cd4d[_0x7b88('0xc')]++,'VoiceExtensionId':_0x52546d[_0x26440b][0x0][_0x7b88('0x14')]});_0x24cd4d[_0x7b88('0xd')][_0x7b88('0x15')]({'type':_0x52546d[_0x26440b][0x0][_0x7b88('0x10')],'app':'Set','appdata':_0x7b88('0x22')+_0x24cd4d['extension'][_0x7b88('0x21')]||_0x7b88('0x23'),'context':_0x52546d[_0x26440b][0x0]['context'],'exten':_0x52546d[_0x26440b][0x0][_0x7b88('0x8')],'priority':_0x24cd4d[_0x7b88('0xc')]++,'VoiceExtensionId':_0x52546d[_0x26440b][0x0][_0x7b88('0x14')]});}}_0x24cd4d[_0x7b88('0xd')]['push']({'type':_0x52546d[_0x26440b][0x0][_0x7b88('0x10')],'app':'Set','appdata':_0x7b88('0x24'),'context':_0x52546d[_0x26440b][0x0][_0x7b88('0x13')],'exten':_0x52546d[_0x26440b][0x0][_0x7b88('0x8')],'priority':_0x24cd4d[_0x7b88('0xc')]++,'VoiceExtensionId':_0x52546d[_0x26440b][0x0][_0x7b88('0x14')]});_0x24cd4d[_0x7b88('0xd')]['push']({'type':_0x52546d[_0x26440b][0x0][_0x7b88('0x10')],'app':_0x7b88('0x11'),'appdata':_0x7b88('0x25'),'context':_0x52546d[_0x26440b][0x0][_0x7b88('0x13')],'exten':_0x52546d[_0x26440b][0x0][_0x7b88('0x8')],'priority':_0x24cd4d[_0x7b88('0xc')]++,'VoiceExtensionId':_0x52546d[_0x26440b][0x0]['VoiceExtensionId']});_0x24cd4d[_0x7b88('0xd')]['push']({'type':_0x52546d[_0x26440b][0x0][_0x7b88('0x10')],'app':_0x7b88('0x11'),'appdata':_0x7b88('0x26'),'context':_0x52546d[_0x26440b][0x0]['context'],'exten':_0x52546d[_0x26440b][0x0][_0x7b88('0x8')],'priority':_0x24cd4d[_0x7b88('0xc')]++,'VoiceExtensionId':_0x52546d[_0x26440b][0x0]['VoiceExtensionId']});for(var _0x5e83b9=0x0,_0x4f32a2=0x0;_0x5e83b9<_0x52546d[_0x26440b][_0x7b88('0x27')];_0x5e83b9+=0x1,_0x4f32a2=0x0){var _0x4b16bc=_0x52546d[_0x26440b][_0x5e83b9];if(_0x4b16bc[_0x7b88('0x10')]){_0x4b16bc['type']=_0x4b16bc['type'][_0x7b88('0x28')]();}var _0x14bed5=[];var _0x328614=[];delete _0x4b16bc['id'];delete _0x4b16bc[_0x7b88('0x29')];delete _0x4b16bc['updatedAt'];var _0x558c8f=_0x4b16bc['interval']!==_0x7b88('0x2a')?[_0x4b16bc['interval']]:_0x4b16bc[_0x7b88('0x2b')]?_[_0x7b88('0x7')](_[_0x7b88('0x9')](_0x24cd4d[_0x7b88('0x2')],{'IntervalId':_0x4b16bc[_0x7b88('0x2b')]}),_0x7b88('0x2c')):[];if(_0x4b16bc[_0x7b88('0x20')]('tag')){if(_0x4b16bc['tag']&&_0x4b16bc[_0x7b88('0x2d')]!=='--'){_0x14bed5[_0x7b88('0x15')]({'type':_0x4b16bc[_0x7b88('0x10')],'app':_0x7b88('0x11'),'appdata':'CDR(tag)='+_0x4b16bc[_0x7b88('0x2d')],'context':_0x4b16bc[_0x7b88('0x13')],'exten':_0x4b16bc[_0x7b88('0x8')],'priority':_0x558c8f[_0x7b88('0x27')]+_0x24cd4d['priority']+_0x4f32a2++,'VoiceExtensionId':_0x4b16bc[_0x7b88('0x14')]});}}if(_0x4b16bc[_0x7b88('0x10')]===_0x7b88('0x2e')&&_0x4b16bc[_0x7b88('0x20')](_0x7b88('0x2f'))){if(_0x4b16bc[_0x7b88('0x2f')]){_0x14bed5[_0x7b88('0x15')]({'type':_0x4b16bc['type'],'app':_0x7b88('0x1b'),'appdata':_0x7b88('0x30')+_0x4b16bc['callerID']+')','context':_0x4b16bc[_0x7b88('0x13')],'exten':_0x4b16bc[_0x7b88('0x8')],'priority':_0x558c8f[_0x7b88('0x27')]+_0x24cd4d['priority']+_0x4f32a2++,'VoiceExtensionId':_0x4b16bc['VoiceExtensionId']});}else{_0x14bed5[_0x7b88('0x15')]({'type':_0x4b16bc[_0x7b88('0x10')],'app':_0x7b88('0x1b'),'appdata':_0x7b88('0x31'),'context':_0x4b16bc['context'],'exten':_0x4b16bc[_0x7b88('0x8')],'priority':_0x558c8f[_0x7b88('0x27')]+_0x24cd4d[_0x7b88('0xc')]+_0x4f32a2++,'VoiceExtensionId':_0x4b16bc[_0x7b88('0x14')]});}}if(_0x4b16bc['hasOwnProperty']('answer')){if(_0xb714d['indexOf'](_0x4b16bc[_0x7b88('0x32')][_0x7b88('0x28')]())>=0x0&&_0x4b16bc[_0x7b88('0x33')]!==_0x7b88('0x34')){if(_0x4b16bc['answer']){_0x14bed5[_0x7b88('0x15')]({'type':_0x4b16bc[_0x7b88('0x10')],'app':_0x7b88('0x1b'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x4b16bc[_0x7b88('0x13')],'exten':_0x4b16bc[_0x7b88('0x8')],'priority':_0x558c8f[_0x7b88('0x27')]+_0x24cd4d[_0x7b88('0xc')]+_0x4f32a2++,'VoiceExtensionId':_0x4b16bc[_0x7b88('0x14')]});_0x14bed5[_0x7b88('0x15')]({'type':_0x4b16bc[_0x7b88('0x10')],'app':_0x7b88('0x11'),'appdata':_0x7b88('0x35'),'context':_0x4b16bc['context'],'exten':_0x4b16bc[_0x7b88('0x8')],'priority':_0x558c8f[_0x7b88('0x27')]+_0x24cd4d[_0x7b88('0xc')]+_0x4f32a2++,'VoiceExtensionId':_0x4b16bc[_0x7b88('0x14')]});}else{_0x14bed5['push']({'type':_0x4b16bc[_0x7b88('0x10')],'app':_0x7b88('0x1b'),'appdata':_0x7b88('0x36'),'context':_0x4b16bc[_0x7b88('0x13')],'exten':_0x4b16bc['exten'],'priority':_0x558c8f[_0x7b88('0x27')]+_0x24cd4d[_0x7b88('0xc')]+_0x4f32a2++,'VoiceExtensionId':_0x4b16bc['VoiceExtensionId']});_0x14bed5['push']({'type':_0x4b16bc['type'],'app':'Set','appdata':_0x7b88('0x37'),'context':_0x4b16bc[_0x7b88('0x13')],'exten':_0x4b16bc[_0x7b88('0x8')],'priority':_0x558c8f[_0x7b88('0x27')]+_0x24cd4d['priority']+_0x4f32a2++,'VoiceExtensionId':_0x4b16bc[_0x7b88('0x14')]});}}}for(var _0x490a94=0x0;_0x490a94<_0x558c8f[_0x7b88('0x27')];_0x490a94+=0x1){var _0x8fc906=_0x24cd4d[_0x7b88('0xc')]+_0x558c8f[_0x7b88('0x27')];var _0x4a9169=_0x490a94===_0x558c8f['length']-0x1?_0x24cd4d[_0x7b88('0xc')]+_0x14bed5[_0x7b88('0x27')]+_0x328614['length']+0x2:_0x24cd4d[_0x7b88('0xc')]+_0x490a94+0x1;_0x14bed5['splice'](_0x490a94,0x0,{'type':_0x4b16bc[_0x7b88('0x10')],'app':_0x7b88('0x38'),'appdata':_0x558c8f[_0x490a94]+'?'+_0x4b16bc[_0x7b88('0x13')]+_0x7b88('0x39')+_0x8fc906+':'+_0x4b16bc[_0x7b88('0x13')]+_0x7b88('0x39')+_0x4a9169,'exten':_0x4b16bc[_0x7b88('0x8')],'context':_0x4b16bc[_0x7b88('0x13')],'priority':_0x24cd4d[_0x7b88('0xc')]+_0x490a94,'VoiceExtensionId':_0x52546d[_0x26440b][0x0][_0x7b88('0x14')]});}_0x4b16bc[_0x7b88('0xc')]=_0x14bed5[_0x7b88('0x27')]?_['last'](_0x14bed5)[_0x7b88('0xc')]+0x1:_0x24cd4d['priority'];_0x24cd4d['priority']=(_0x328614[_0x7b88('0x27')]?_['last'](_0x328614)['priority']:_0x4b16bc[_0x7b88('0xc')])+0x1;_0x24cd4d[_0x7b88('0xd')]=_[_0x7b88('0x3a')](_0x24cd4d[_0x7b88('0xd')],_0x14bed5,[_0x4b16bc],_0x328614);}_0x24cd4d[_0x7b88('0xd')][_0x7b88('0x15')]({'type':_0x52546d[_0x26440b][0x0][_0x7b88('0x10')],'app':'Hangup','exten':_0x52546d[_0x26440b][0x0][_0x7b88('0x8')],'context':_0x52546d[_0x26440b][0x0]['context'],'priority':_0x24cd4d[_0x7b88('0xc')],'VoiceExtensionId':_0x52546d[_0x26440b][0x0][_0x7b88('0x14')]});_0x34959c[_0x7b88('0x15')](_0x52546d[_0x26440b][0x0][_0x7b88('0x14')]);_0x1820ee=_[_0x7b88('0x3a')](_0x1820ee,_0x24cd4d[_0x7b88('0xd')]);}}return _0x515594[_0x7b88('0x3b')](function(_0xa1de7c){return _0x515594[_0x7b88('0x5')]['VoiceExtension'][_0x7b88('0x3c')]({'where':{'VoiceExtensionId':{'$in':_0x34959c}},'transaction':_0xa1de7c})[_0x7b88('0x1')](function(_0x300b95){return _0x515594['models']['VoiceExtension']['bulkCreate'](_[_0x7b88('0x3d')](_0x1820ee,'priority'),{'transaction':_0xa1de7c});});});})[_0x7b88('0x3e')](function(_0x39d9f1){console['error'](_0x39d9f1);});}exports['rewrite']=rewrite; \ No newline at end of file +var _0x10f2=['exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','playback','hasOwnProperty','priority','extensions','extension','type','Set','format','CDR(type)=%s','context','VoiceExtensionId','push','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','CDR(routeid)=','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','createdAt','interval','*,*,*,*','tag','CDR(tag)=','outbound','callerID','ExecIf','$[${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','toLowerCase','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','Hangup','VoiceExtension','bulkCreate','error','lodash','util','models','intervals','IntervalId','then','findAll','uniq'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x10f2,0xc1));var _0x210f=function(_0x4b47b8,_0x173507){_0x4b47b8=_0x4b47b8-0x0;var _0x4cc191=_0x10f2[_0x4b47b8];return _0x4cc191;};'use strict';var _=require(_0x210f('0x0'));var util=require(_0x210f('0x1'));function rewrite(_0x3bdd6a,_0x24d098){var _0x3cda36=this;return _0x3bdd6a[_0x210f('0x2')]['Interval']['findAll']({'raw':!![]})['then'](function(_0x58b176){_0x3cda36[_0x210f('0x3')]=_0x58b176;return _0x3bdd6a['models']['VoiceExtension']['findAll']({'where':{'IntervalId':_0x24d098[_0x210f('0x4')]},'raw':!![]});})[_0x210f('0x5')](function(_0x5b3dc0){return _0x3bdd6a['models']['VoiceExtension'][_0x210f('0x6')]({'where':{'exten':{'$in':_[_0x210f('0x7')](_['map'](_0x5b3dc0,_0x210f('0x8')))}},'order':[{'raw':_0x210f('0x9')}],'raw':!![]});})[_0x210f('0x5')](function(_0x41922a){var _0xe80b2a=_[_0x210f('0xa')](_0x41922a,{'priority':'1'});var _0x26f715=_[_0x210f('0xa')](_0x41922a,{'isApp':0x1});var _0x42e29a=_[_0x210f('0xb')](_0x26f715,_0x210f('0x8'));var _0x5dd091=[_0x210f('0xc'),_0x210f('0xd')];var _0x16e657=[];var _0x1dc41e=[];for(var _0x2c85b1 in _0x42e29a){if(_0x42e29a[_0x210f('0xe')](_0x2c85b1)){_0x3cda36[_0x210f('0xf')]=0x2;_0x3cda36[_0x210f('0x10')]=[];_0x3cda36[_0x210f('0x11')]=_['find'](_0xe80b2a,{'exten':_0x42e29a[_0x2c85b1][0x0][_0x210f('0x8')]});_0x3cda36[_0x210f('0x10')]['push']({'type':_0x42e29a[_0x2c85b1][0x0][_0x210f('0x12')],'app':_0x210f('0x13'),'appdata':util[_0x210f('0x14')](_0x210f('0x15'),_0x42e29a[_0x2c85b1][0x0][_0x210f('0x12')]),'context':_0x42e29a[_0x2c85b1][0x0][_0x210f('0x16')],'exten':_0x42e29a[_0x2c85b1][0x0][_0x210f('0x8')],'priority':_0x3cda36['priority']++,'VoiceExtensionId':_0x42e29a[_0x2c85b1][0x0][_0x210f('0x17')]});if(_0x42e29a[_0x2c85b1][0x0][_0x210f('0x12')]==='outbound'){if(_0x3cda36[_0x210f('0x11')]){_0x3cda36['extensions'][_0x210f('0x18')]({'type':_0x42e29a[_0x2c85b1][0x0]['type'],'app':_0x210f('0x13'),'appdata':_0x210f('0x19')+(_0x3cda36[_0x210f('0x11')][_0x210f('0x1a')]?_0x210f('0x1b')+_0x3cda36[_0x210f('0x11')][_0x210f('0x1a')]+'}':_0x210f('0x1c')),'context':_0x42e29a[_0x2c85b1][0x0][_0x210f('0x16')],'exten':_0x42e29a[_0x2c85b1][0x0][_0x210f('0x8')],'priority':_0x3cda36[_0x210f('0xf')]++,'VoiceExtensionId':_0x42e29a[_0x2c85b1][0x0][_0x210f('0x17')]});}_0x3cda36[_0x210f('0x10')][_0x210f('0x18')]({'type':_0x42e29a[_0x2c85b1][0x0][_0x210f('0x12')],'app':_0x210f('0x13'),'appdata':_0x210f('0x1d')+_0x42e29a[_0x2c85b1][0x0][_0x210f('0x17')],'context':_0x42e29a[_0x2c85b1][0x0][_0x210f('0x16')],'exten':_0x42e29a[_0x2c85b1][0x0]['exten'],'priority':_0x3cda36[_0x210f('0xf')]++,'VoiceExtensionId':_0x42e29a[_0x2c85b1][0x0][_0x210f('0x17')]});var _0x2a678f=_0x3cda36[_0x210f('0xf')]++;_0x3cda36[_0x210f('0x10')][_0x210f('0x18')]({'type':_0x42e29a[_0x2c85b1][0x0][_0x210f('0x12')],'app':'ExecIf','appdata':_0x210f('0x1e')+(_0x2a678f+0x2)+_0x210f('0x1f')+(_0x2a678f+0x1)+')','context':_0x42e29a[_0x2c85b1][0x0][_0x210f('0x16')],'exten':_0x42e29a[_0x2c85b1][0x0]['exten'],'priority':_0x2a678f,'VoiceExtensionId':_0x42e29a[_0x2c85b1][0x0]['VoiceExtensionId']});if(_0x3cda36[_0x210f('0x11')]){_0x3cda36['extensions'][_0x210f('0x18')]({'type':_0x42e29a[_0x2c85b1][0x0][_0x210f('0x12')],'app':'Set','appdata':_0x3cda36[_0x210f('0x11')]['cutdigits']?_0x210f('0x20')+_0x3cda36['extension'][_0x210f('0x1a')]+'}':_0x210f('0x21'),'context':_0x42e29a[_0x2c85b1][0x0][_0x210f('0x16')],'exten':_0x42e29a[_0x2c85b1][0x0][_0x210f('0x8')],'priority':_0x3cda36[_0x210f('0xf')]++,'VoiceExtensionId':_0x42e29a[_0x2c85b1][0x0][_0x210f('0x17')]});}_0x3cda36[_0x210f('0x10')][_0x210f('0x18')]({'type':_0x42e29a[_0x2c85b1][0x0][_0x210f('0x12')],'app':_0x210f('0x13'),'appdata':_0x210f('0x22')+_0x42e29a[_0x2c85b1][0x0]['VoiceExtensionId'],'context':_0x42e29a[_0x2c85b1][0x0][_0x210f('0x16')],'exten':_0x42e29a[_0x2c85b1][0x0][_0x210f('0x8')],'priority':_0x3cda36['priority']++,'VoiceExtensionId':_0x42e29a[_0x2c85b1][0x0][_0x210f('0x17')]});if(_0x3cda36['extension']&&_0x3cda36[_0x210f('0x11')][_0x210f('0xe')](_0x210f('0x23'))&&_0x3cda36[_0x210f('0x11')]['recordingFormat']!=='none'){_0x3cda36[_0x210f('0x10')][_0x210f('0x18')]({'type':_0x42e29a[_0x2c85b1][0x0][_0x210f('0x12')],'app':'Set','appdata':_0x210f('0x24'),'context':_0x42e29a[_0x2c85b1][0x0][_0x210f('0x16')],'exten':_0x42e29a[_0x2c85b1][0x0][_0x210f('0x8')],'priority':_0x3cda36['priority']++,'VoiceExtensionId':_0x42e29a[_0x2c85b1][0x0][_0x210f('0x17')]});_0x3cda36['extensions']['push']({'type':_0x42e29a[_0x2c85b1][0x0][_0x210f('0x12')],'app':'Set','appdata':_0x210f('0x25')+_0x3cda36[_0x210f('0x11')][_0x210f('0x23')]||_0x210f('0x26'),'context':_0x42e29a[_0x2c85b1][0x0][_0x210f('0x16')],'exten':_0x42e29a[_0x2c85b1][0x0][_0x210f('0x8')],'priority':_0x3cda36[_0x210f('0xf')]++,'VoiceExtensionId':_0x42e29a[_0x2c85b1][0x0][_0x210f('0x17')]});}}_0x3cda36[_0x210f('0x10')]['push']({'type':_0x42e29a[_0x2c85b1][0x0]['type'],'app':_0x210f('0x13'),'appdata':_0x210f('0x27'),'context':_0x42e29a[_0x2c85b1][0x0][_0x210f('0x16')],'exten':_0x42e29a[_0x2c85b1][0x0][_0x210f('0x8')],'priority':_0x3cda36[_0x210f('0xf')]++,'VoiceExtensionId':_0x42e29a[_0x2c85b1][0x0][_0x210f('0x17')]});_0x3cda36[_0x210f('0x10')][_0x210f('0x18')]({'type':_0x42e29a[_0x2c85b1][0x0][_0x210f('0x12')],'app':'Set','appdata':_0x210f('0x28'),'context':_0x42e29a[_0x2c85b1][0x0][_0x210f('0x16')],'exten':_0x42e29a[_0x2c85b1][0x0][_0x210f('0x8')],'priority':_0x3cda36[_0x210f('0xf')]++,'VoiceExtensionId':_0x42e29a[_0x2c85b1][0x0]['VoiceExtensionId']});_0x3cda36[_0x210f('0x10')][_0x210f('0x18')]({'type':_0x42e29a[_0x2c85b1][0x0][_0x210f('0x12')],'app':'Set','appdata':_0x210f('0x29'),'context':_0x42e29a[_0x2c85b1][0x0][_0x210f('0x16')],'exten':_0x42e29a[_0x2c85b1][0x0][_0x210f('0x8')],'priority':_0x3cda36[_0x210f('0xf')]++,'VoiceExtensionId':_0x42e29a[_0x2c85b1][0x0][_0x210f('0x17')]});for(var _0x2bb2dd=0x0,_0x583280=0x0;_0x2bb2dd<_0x42e29a[_0x2c85b1][_0x210f('0x2a')];_0x2bb2dd+=0x1,_0x583280=0x0){var _0x42475c=_0x42e29a[_0x2c85b1][_0x2bb2dd];if(_0x42475c['type']){_0x42475c[_0x210f('0x12')]=_0x42475c[_0x210f('0x12')]['toLowerCase']();}var _0x3d8fb8=[];var _0x37bc6e=[];delete _0x42475c['id'];delete _0x42475c[_0x210f('0x2b')];delete _0x42475c['updatedAt'];var _0xc5dadf=_0x42475c[_0x210f('0x2c')]!==_0x210f('0x2d')?[_0x42475c['interval']]:_0x42475c[_0x210f('0x4')]?_['map'](_[_0x210f('0xa')](_0x3cda36[_0x210f('0x3')],{'IntervalId':_0x42475c[_0x210f('0x4')]}),_0x210f('0x2c')):[];if(_0x42475c[_0x210f('0xe')](_0x210f('0x2e'))){if(_0x42475c[_0x210f('0x2e')]&&_0x42475c['tag']!=='--'){_0x3d8fb8['push']({'type':_0x42475c[_0x210f('0x12')],'app':_0x210f('0x13'),'appdata':_0x210f('0x2f')+_0x42475c['tag'],'context':_0x42475c['context'],'exten':_0x42475c[_0x210f('0x8')],'priority':_0xc5dadf['length']+_0x3cda36[_0x210f('0xf')]+_0x583280++,'VoiceExtensionId':_0x42475c[_0x210f('0x17')]});}}if(_0x42475c['type']===_0x210f('0x30')&&_0x42475c[_0x210f('0xe')](_0x210f('0x31'))){if(_0x42475c['callerID']){_0x3d8fb8[_0x210f('0x18')]({'type':_0x42475c[_0x210f('0x12')],'app':_0x210f('0x32'),'appdata':_0x210f('0x33')+_0x42475c[_0x210f('0x31')]+')','context':_0x42475c[_0x210f('0x16')],'exten':_0x42475c['exten'],'priority':_0xc5dadf[_0x210f('0x2a')]+_0x3cda36['priority']+_0x583280++,'VoiceExtensionId':_0x42475c[_0x210f('0x17')]});}else{_0x3d8fb8['push']({'type':_0x42475c[_0x210f('0x12')],'app':'ExecIf','appdata':_0x210f('0x34'),'context':_0x42475c[_0x210f('0x16')],'exten':_0x42475c[_0x210f('0x8')],'priority':_0xc5dadf[_0x210f('0x2a')]+_0x3cda36[_0x210f('0xf')]+_0x583280++,'VoiceExtensionId':_0x42475c[_0x210f('0x17')]});}}if(_0x42475c[_0x210f('0xe')](_0x210f('0x35'))){if(_0x5dd091['indexOf'](_0x42475c['app'][_0x210f('0x36')]())>=0x0&&_0x42475c['appType']!=='custom'){if(_0x42475c[_0x210f('0x35')]){_0x3d8fb8[_0x210f('0x18')]({'type':_0x42475c['type'],'app':'ExecIf','appdata':_0x210f('0x37'),'context':_0x42475c['context'],'exten':_0x42475c[_0x210f('0x8')],'priority':_0xc5dadf[_0x210f('0x2a')]+_0x3cda36['priority']+_0x583280++,'VoiceExtensionId':_0x42475c[_0x210f('0x17')]});_0x3d8fb8['push']({'type':_0x42475c[_0x210f('0x12')],'app':_0x210f('0x13'),'appdata':_0x210f('0x38'),'context':_0x42475c[_0x210f('0x16')],'exten':_0x42475c[_0x210f('0x8')],'priority':_0xc5dadf[_0x210f('0x2a')]+_0x3cda36[_0x210f('0xf')]+_0x583280++,'VoiceExtensionId':_0x42475c['VoiceExtensionId']});}else{_0x3d8fb8[_0x210f('0x18')]({'type':_0x42475c['type'],'app':'ExecIf','appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x42475c[_0x210f('0x16')],'exten':_0x42475c['exten'],'priority':_0xc5dadf[_0x210f('0x2a')]+_0x3cda36[_0x210f('0xf')]+_0x583280++,'VoiceExtensionId':_0x42475c[_0x210f('0x17')]});_0x3d8fb8[_0x210f('0x18')]({'type':_0x42475c[_0x210f('0x12')],'app':_0x210f('0x13'),'appdata':_0x210f('0x39'),'context':_0x42475c[_0x210f('0x16')],'exten':_0x42475c[_0x210f('0x8')],'priority':_0xc5dadf[_0x210f('0x2a')]+_0x3cda36['priority']+_0x583280++,'VoiceExtensionId':_0x42475c[_0x210f('0x17')]});}}}for(var _0x50e703=0x0;_0x50e703<_0xc5dadf[_0x210f('0x2a')];_0x50e703+=0x1){var _0x335e54=_0x3cda36[_0x210f('0xf')]+_0xc5dadf[_0x210f('0x2a')];var _0x3ed814=_0x50e703===_0xc5dadf[_0x210f('0x2a')]-0x1?_0x3cda36['priority']+_0x3d8fb8['length']+_0x37bc6e[_0x210f('0x2a')]+0x2:_0x3cda36[_0x210f('0xf')]+_0x50e703+0x1;_0x3d8fb8[_0x210f('0x3a')](_0x50e703,0x0,{'type':_0x42475c[_0x210f('0x12')],'app':_0x210f('0x3b'),'appdata':_0xc5dadf[_0x50e703]+'?'+_0x42475c[_0x210f('0x16')]+',${EXTEN},'+_0x335e54+':'+_0x42475c[_0x210f('0x16')]+_0x210f('0x3c')+_0x3ed814,'exten':_0x42475c[_0x210f('0x8')],'context':_0x42475c[_0x210f('0x16')],'priority':_0x3cda36[_0x210f('0xf')]+_0x50e703,'VoiceExtensionId':_0x42e29a[_0x2c85b1][0x0][_0x210f('0x17')]});}_0x42475c[_0x210f('0xf')]=_0x3d8fb8[_0x210f('0x2a')]?_[_0x210f('0x3d')](_0x3d8fb8)[_0x210f('0xf')]+0x1:_0x3cda36[_0x210f('0xf')];_0x3cda36['priority']=(_0x37bc6e[_0x210f('0x2a')]?_[_0x210f('0x3d')](_0x37bc6e)[_0x210f('0xf')]:_0x42475c[_0x210f('0xf')])+0x1;_0x3cda36['extensions']=_[_0x210f('0x3e')](_0x3cda36[_0x210f('0x10')],_0x3d8fb8,[_0x42475c],_0x37bc6e);}_0x3cda36[_0x210f('0x10')][_0x210f('0x18')]({'type':_0x42e29a[_0x2c85b1][0x0][_0x210f('0x12')],'app':_0x210f('0x3f'),'exten':_0x42e29a[_0x2c85b1][0x0]['exten'],'context':_0x42e29a[_0x2c85b1][0x0][_0x210f('0x16')],'priority':_0x3cda36['priority'],'VoiceExtensionId':_0x42e29a[_0x2c85b1][0x0][_0x210f('0x17')]});_0x16e657[_0x210f('0x18')](_0x42e29a[_0x2c85b1][0x0]['VoiceExtensionId']);_0x1dc41e=_['concat'](_0x1dc41e,_0x3cda36[_0x210f('0x10')]);}}return _0x3bdd6a['transaction'](function(_0x6282d8){return _0x3bdd6a[_0x210f('0x2')][_0x210f('0x40')]['destroy']({'where':{'VoiceExtensionId':{'$in':_0x16e657}},'transaction':_0x6282d8})[_0x210f('0x5')](function(_0x1a1e17){return _0x3bdd6a['models'][_0x210f('0x40')][_0x210f('0x41')](_['sortBy'](_0x1dc41e,_0x210f('0xf')),{'transaction':_0x6282d8});});});})['catch'](function(_0x120e4b){console[_0x210f('0x42')](_0x120e4b);});}exports['rewrite']=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 5e1ecdc..5d97fd4 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 _0xe706=['toString','ListId','from','cm_contacts','deletedAt\x20IS\x20NULL','where','ListId\x20=\x20?','insert','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','calleridnum','cm_hopper_final','\x20=\x20?','cm_hopper_black','VoiceQueue','findAll','outbound','CmList','Lists','get','dialCheckDuplicateType','always','push','sequelize','VoiceQueueId','catch','onlyIfOpen','query','all','Campaign','CampaignId','BlackLists','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','contact:csv_','resume','resolve','emit','Unable\x20to\x20delete\x20temp\x20file:','info','CSV\x20import\x20process\x20stopped!','split','parse','pause','CSV\x20parsed\x20correctly!','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','papaparse','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','api','redis','defaults','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','Missing\x20socket_timestamp\x20parameter!','error','contact','index','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','join','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','CompanyId','find','duplicate','Duplicate\x20Contact','CmContact','create','keys','then','pick','Error\x20while\x20creating\x20contact:\x20','message','stringify','cmContact','checkHopper','inspect','into','cm_hopper','fromQuery','scheduledAt','ContactId','createdAt','updatedAt','select','field','NOW()'];(function(_0x4bd50f,_0x5e5c56){var _0x3564df=function(_0x395733){while(--_0x395733){_0x4bd50f['push'](_0x4bd50f['shift']());}};_0x3564df(++_0x5e5c56);}(_0xe706,0xa3));var _0x6e70=function(_0x564d53,_0x31ac8a){_0x564d53=_0x564d53-0x0;var _0x1ba891=_0xe706[_0x564d53];return _0x1ba891;};'use strict';var BPromise=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var _=require(_0x6e70('0x2'));var fs=require('fs');var squel=require('squel');var Papa=require(_0x6e70('0x3'));var Redis=require(_0x6e70('0x4'));var db=require(_0x6e70('0x5'))['db'];var config=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));config[_0x6e70('0x9')]=_[_0x6e70('0xa')](config[_0x6e70('0x9')],{'host':_0x6e70('0xb'),'port':0x18eb});var socket=require(_0x6e70('0xc'))(new Redis(config[_0x6e70('0x9')]));require(_0x6e70('0xd'))[_0x6e70('0xe')](socket);try{if(!process[_0x6e70('0xf')][0x2]||process[_0x6e70('0xf')][0x2]===_0x6e70('0x10')||process[_0x6e70('0xf')][0x2]===_0x6e70('0x11')){throw new Error(_0x6e70('0x12'));}var FILEPATH=process[_0x6e70('0xf')][0x2];if(!process[_0x6e70('0xf')][0x3]||process[_0x6e70('0xf')][0x3]===_0x6e70('0x10')||process['argv'][0x3]==='null'||!process[_0x6e70('0xf')][0x4]||process[_0x6e70('0xf')][0x4]===_0x6e70('0x10')||process[_0x6e70('0xf')][0x4]===_0x6e70('0x11')){throw new Error(_0x6e70('0x13'));}var FIELDS=_[_0x6e70('0x14')](process[_0x6e70('0xf')][0x3]['split'](','),process['argv'][0x4]['split'](','));if(!process[_0x6e70('0xf')][0x5]||process['argv'][0x5]==='undefined'||process[_0x6e70('0xf')][0x5]===_0x6e70('0x11')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process[_0x6e70('0xf')][0x5];var COMPANYID=process['argv'][0x6]&&process[_0x6e70('0xf')][0x6]!==_0x6e70('0x10')&&process['argv'][0x6]!=='null'?process[_0x6e70('0xf')][0x6]:null;var DUPLICATES=process['argv'][0x7]&&process[_0x6e70('0xf')][0x7]!==_0x6e70('0x10')&&process['argv'][0x7]!=='null'?process[_0x6e70('0xf')][0x7]:null;if(!process[_0x6e70('0xf')][0x8]||process[_0x6e70('0xf')][0x8]===_0x6e70('0x10')||process[_0x6e70('0xf')][0x8]===_0x6e70('0x11')){throw new Error(_0x6e70('0x15'));}var SOCKET_TIMESTAMP=process[_0x6e70('0xf')][0x8];}catch(_0x29326f){logger[_0x6e70('0x16')](_0x29326f);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(_0x4a0cfe,_0x228350,_0x344b65,_0x27b294){var _0x502b2d={'message':_0x228350};_0x502b2d[_0x4a0cfe]=!![];if(_0x344b65){_0x502b2d[_0x6e70('0x17')]=_0x344b65;}if(_0x27b294){_0x502b2d[_0x6e70('0x18')]=_0x27b294;}return _0x502b2d;}function isEmail(_0x3337a6){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/['test'](_0x3337a6);}function checkRow(_0x10fc91,_0x538b9c,_0x50aec2){return new BPromise(function(_0x4e97c7,_0x41e352){if(_[_0x6e70('0x19')](_0x10fc91)){return _0x41e352(handleCheckRowError('error',_0x6e70('0x1a'),null,_0x50aec2));}if(_0x10fc91[_0x6e70('0x1b')]&&_0x10fc91['errors'][_0x6e70('0x1c')]){var _0x67fb43=_[_0x6e70('0x1d')](_0x10fc91['errors'],'message')[_0x6e70('0x1e')](';');return _0x41e352(handleCheckRowError(_0x6e70('0x16'),_0x67fb43,null,_0x50aec2));}var _0x83c836={};for(var _0x114344 in FIELDS){if(FIELDS[_0x6e70('0x1f')](_0x114344)&&FIELDS[_0x114344]){_0x83c836[_0x114344]=_0x10fc91['data'][0x0][FIELDS[_0x114344]]||_0x10fc91[_0x6e70('0x20')][0x0]['\ufeff'+FIELDS[_0x114344]];}}if(!_0x83c836[_0x6e70('0x21')]){return _0x41e352(handleCheckRowError(_0x6e70('0x16'),_0x6e70('0x22'),null,_0x50aec2));}if(!_0x83c836[_0x6e70('0x23')]){return _0x41e352(handleCheckRowError(_0x6e70('0x16'),_0x6e70('0x24'),null,_0x50aec2));}if(_0x83c836[_0x6e70('0x25')]){var _0x3a0821=moment(_0x83c836[_0x6e70('0x25')],'YYYY-MM-DD');if(!_0x3a0821[_0x6e70('0x26')]()){return _0x41e352(handleCheckRowError('error',_0x6e70('0x27'),null,_0x50aec2));}}if(_0x83c836['email']){if(!isEmail(_0x83c836[_0x6e70('0x28')])){return _0x41e352(handleCheckRowError(_0x6e70('0x16'),_0x6e70('0x29'),null,_0x50aec2));}}_0x83c836['ListId']=LISTID;_0x83c836[_0x6e70('0x2a')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x6e70('0x1c')]&&_0x538b9c){var _0x5780a1={};for(var _0x13d673=0x0,_0x154925=DUPLICATES['length'];_0x13d673<_0x154925;_0x13d673+=0x1){_0x5780a1[DUPLICATES[_0x13d673]]=_0x83c836[DUPLICATES[_0x13d673]];}var _0x10d8f6=_[_0x6e70('0x2b')](_0x538b9c,_0x5780a1);if(_0x10d8f6){return _0x41e352(handleCheckRowError(_0x6e70('0x2c'),_0x6e70('0x2d'),_0x10d8f6,_0x50aec2));}}return db[_0x6e70('0x2e')][_0x6e70('0x2f')](_0x83c836,{'raw':!![],'hooks':![],'fields':_[_0x6e70('0x30')](_0x83c836)})[_0x6e70('0x31')](function(_0xf146fd){if(DUPLICATES&&DUPLICATES[_0x6e70('0x1c')]&&_0x538b9c){_0x538b9c['push'](_[_0x6e70('0x32')](_0x83c836,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0xf146fd['id'];return _0x4e97c7();})['catch'](function(_0x23cd1a){return _0x41e352(handleCheckRowError(_0x6e70('0x16'),_0x6e70('0x33')+(_0x23cd1a[_0x6e70('0x34')]||JSON[_0x6e70('0x35')](_0x23cd1a)),null,_0x50aec2));});});}function checkHopper(){function _0x989b80(){return function(_0x2440be){logger[_0x6e70('0x16')](_0x6e70('0x36'),_0x6e70('0x37'),util[_0x6e70('0x38')](_0x2440be,{'showHidden':![],'depth':null}));};}var _0x23d5e2=function(_0x5594d3,_0x501b53){var _0x5446a2=squel['insert']()[_0x6e70('0x39')](_0x6e70('0x3a'))[_0x6e70('0x3b')]([_0x6e70('0x23'),_0x6e70('0x3c'),_0x6e70('0x3d'),'ListId',_0x501b53,_0x6e70('0x3e'),_0x6e70('0x3f')],squel[_0x6e70('0x40')]()[_0x6e70('0x41')](_0x6e70('0x23'),_0x6e70('0x23'))[_0x6e70('0x41')](_0x6e70('0x42'),'scheduledAt')[_0x6e70('0x41')]('id',_0x6e70('0x3d'))[_0x6e70('0x41')](LISTID[_0x6e70('0x43')](),_0x6e70('0x44'))[_0x6e70('0x41')](_0x5594d3['id'][_0x6e70('0x43')](),_0x501b53)['field']('NOW()','createdAt')[_0x6e70('0x41')](_0x6e70('0x42'),_0x6e70('0x3f'))[_0x6e70('0x45')](_0x6e70('0x46'))['where'](_0x6e70('0x47'))[_0x6e70('0x48')](_0x6e70('0x49'),LISTID['toString']())['where']('phone\x20IS\x20NOT\x20NULL')[_0x6e70('0x48')]('phone\x20NOT\x20IN\x20(?)',squel[_0x6e70('0x40')]()[_0x6e70('0x41')](_0x6e70('0x23'))[_0x6e70('0x45')]('cm_hopper')[_0x6e70('0x48')](_0x501b53+'\x20=\x20?',_0x5594d3['id'][_0x6e70('0x43')]())))[_0x6e70('0x43')]();return _0x5446a2;};var _0x2dafb5=function(_0x3478e2,_0x5bbc3a){var _0x291de6=squel[_0x6e70('0x4a')]()[_0x6e70('0x39')](_0x6e70('0x3a'))[_0x6e70('0x3b')]([_0x6e70('0x23'),_0x6e70('0x3c'),'ContactId',_0x6e70('0x44'),_0x5bbc3a,_0x6e70('0x3e'),_0x6e70('0x3f')],squel[_0x6e70('0x40')]()[_0x6e70('0x41')](_0x6e70('0x23'),_0x6e70('0x23'))['field'](_0x6e70('0x42'),'scheduledAt')[_0x6e70('0x41')]('id',_0x6e70('0x3d'))['field'](LISTID['toString'](),_0x6e70('0x44'))[_0x6e70('0x41')](_0x3478e2['id'][_0x6e70('0x43')](),_0x5bbc3a)['field']('NOW()',_0x6e70('0x3e'))[_0x6e70('0x41')](_0x6e70('0x42'),_0x6e70('0x3f'))[_0x6e70('0x45')](_0x6e70('0x46'))['where'](_0x6e70('0x47'))[_0x6e70('0x48')](_0x6e70('0x49'),LISTID[_0x6e70('0x43')]())[_0x6e70('0x48')]('id\x20IN\x20?',squel['str'](hopperContacts))[_0x6e70('0x48')](_0x6e70('0x4b'))[_0x6e70('0x48')](_0x6e70('0x4c'),squel[_0x6e70('0x40')]()['field'](_0x6e70('0x4d'))[_0x6e70('0x45')](_0x6e70('0x4e'))[_0x6e70('0x48')](_0x5bbc3a+_0x6e70('0x4f'),_0x3478e2['id']['toString']()))[_0x6e70('0x48')](_0x6e70('0x4c'),squel[_0x6e70('0x40')]()[_0x6e70('0x41')](_0x6e70('0x23'))[_0x6e70('0x45')]('cm_hopper')[_0x6e70('0x48')](_0x5bbc3a+_0x6e70('0x4f'),_0x3478e2['id']['toString']())))[_0x6e70('0x43')]();return _0x291de6;};function _0xebe5f7(_0x54efdf,_0x3cfaa9){var _0xb3f06c=squel[_0x6e70('0x4a')]()[_0x6e70('0x39')](_0x6e70('0x3a'))['fromQuery']([_0x6e70('0x23'),_0x6e70('0x3c'),_0x6e70('0x3d'),_0x6e70('0x44'),_0x3cfaa9,_0x6e70('0x3e'),_0x6e70('0x3f')],squel[_0x6e70('0x40')]()[_0x6e70('0x41')](_0x6e70('0x23'),_0x6e70('0x23'))[_0x6e70('0x41')](_0x6e70('0x42'),_0x6e70('0x3c'))[_0x6e70('0x41')]('id',_0x6e70('0x3d'))[_0x6e70('0x41')](LISTID[_0x6e70('0x43')](),_0x6e70('0x44'))[_0x6e70('0x41')](_0x54efdf['id'][_0x6e70('0x43')](),_0x3cfaa9)['field'](_0x6e70('0x42'),_0x6e70('0x3e'))[_0x6e70('0x41')](_0x6e70('0x42'),_0x6e70('0x3f'))[_0x6e70('0x45')]('cm_contacts')[_0x6e70('0x48')](_0x6e70('0x47'))['where'](_0x6e70('0x49'),LISTID[_0x6e70('0x43')]())[_0x6e70('0x48')]('id\x20IN\x20?',squel['str'](hopperContacts))[_0x6e70('0x48')](_0x6e70('0x4b')))[_0x6e70('0x43')]();return _0xb3f06c;}function _0x41a861(_0x10d299,_0x739946){var _0x30cd88=squel['insert']()['into'](_0x6e70('0x50'))[_0x6e70('0x3b')]([_0x6e70('0x23'),_0x6e70('0x3d'),'ListId',_0x739946,'createdAt',_0x6e70('0x3f')],squel[_0x6e70('0x40')]()['field']('phone',_0x6e70('0x23'))['field']('id',_0x6e70('0x3d'))[_0x6e70('0x41')](LISTID[_0x6e70('0x43')](),_0x6e70('0x44'))[_0x6e70('0x41')](_0x10d299['id'][_0x6e70('0x43')](),_0x739946)[_0x6e70('0x41')](_0x6e70('0x42'),'createdAt')[_0x6e70('0x41')](_0x6e70('0x42'),_0x6e70('0x3f'))[_0x6e70('0x45')](_0x6e70('0x46'))['where']('deletedAt\x20IS\x20NULL')['where'](_0x6e70('0x49'),LISTID[_0x6e70('0x43')]())[_0x6e70('0x48')]('id\x20IN\x20?',squel['str'](hopperContacts))[_0x6e70('0x48')](_0x6e70('0x4b')))[_0x6e70('0x43')]();return _0x30cd88;}return db[_0x6e70('0x51')][_0x6e70('0x52')]({'where':{'type':_0x6e70('0x53')},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x6e70('0x54')],'as':_0x6e70('0x55'),'where':{'id':LISTID}}]})[_0x6e70('0x31')](function(_0x82a9a){var _0x515c0c=[];if(_0x82a9a){var _0xce964b;for(var _0x531097=0x0,_0x5b4046;_0x531097<_0x82a9a[_0x6e70('0x1c')];_0x531097+=0x1){_0x5b4046=_0x82a9a[_0x531097][_0x6e70('0x56')]({'plain':!![]});switch(_0x5b4046[_0x6e70('0x57')]){case _0x6e70('0x58'):_0x515c0c[_0x6e70('0x59')](db[_0x6e70('0x5a')]['query'](_0x2dafb5(_0x5b4046,_0x6e70('0x5b')))[_0x6e70('0x31')](function(){})[_0x6e70('0x5c')](_0x989b80()));break;case _0x6e70('0x5d'):_0x515c0c[_0x6e70('0x59')](db[_0x6e70('0x5a')][_0x6e70('0x5e')](_0x23d5e2(_0x5b4046,_0x6e70('0x5b')))[_0x6e70('0x31')](function(){})[_0x6e70('0x5c')](_0x989b80()));break;default:_0x515c0c['push'](db[_0x6e70('0x5a')][_0x6e70('0x5e')](_0xebe5f7(_0x5b4046,_0x6e70('0x5b')))['then'](function(){})['catch'](_0x989b80()));}}}return _0x515c0c;})[_0x6e70('0x5f')]()[_0x6e70('0x31')](function(){return db[_0x6e70('0x51')][_0x6e70('0x52')]({'where':{'type':_0x6e70('0x53')},'attributes':['id'],'include':[{'model':db['CmList'],'as':'BlackLists','where':{'id':LISTID}}]})[_0x6e70('0x31')](function(_0x241a21){var _0x56d4d9=[];if(_0x241a21){var _0x58666a;for(var _0x1c7c5f=0x0,_0xf7a034;_0x1c7c5f<_0x241a21[_0x6e70('0x1c')];_0x1c7c5f+=0x1){_0xf7a034=_0x241a21[_0x1c7c5f][_0x6e70('0x56')]({'plain':!![]});_0x56d4d9[_0x6e70('0x59')](db[_0x6e70('0x5a')][_0x6e70('0x5e')](_0x41a861(_0xf7a034,_0x6e70('0x5b')))[_0x6e70('0x31')](function(){})[_0x6e70('0x5c')](_0x989b80()));}}return _0x56d4d9;})[_0x6e70('0x5f')]();})[_0x6e70('0x31')](function(){return db[_0x6e70('0x60')]['findAll']({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x6e70('0x54')],'as':'Lists','where':{'id':LISTID}}]})[_0x6e70('0x31')](function(_0x4b2d40){var _0x5b5471=[];if(_0x4b2d40){for(var _0x402f6f=0x0,_0x48e04b;_0x402f6f<_0x4b2d40['length'];_0x402f6f+=0x1){_0x48e04b=_0x4b2d40[_0x402f6f][_0x6e70('0x56')]({'plain':!![]});switch(_0x48e04b[_0x6e70('0x57')]){case _0x6e70('0x58'):_0x5b5471['push'](db['sequelize']['query'](_0x2dafb5(_0x48e04b,_0x6e70('0x61')))['then'](function(){})[_0x6e70('0x5c')](_0x989b80()));break;case _0x6e70('0x5d'):_0x5b5471[_0x6e70('0x59')](db[_0x6e70('0x5a')][_0x6e70('0x5e')](_0x23d5e2(_0x48e04b,_0x6e70('0x61')))[_0x6e70('0x31')](function(){})['catch'](_0x989b80()));break;default:_0x5b5471[_0x6e70('0x59')](db[_0x6e70('0x5a')][_0x6e70('0x5e')](_0xebe5f7(_0x48e04b,'CampaignId'))[_0x6e70('0x31')](function(){})[_0x6e70('0x5c')](_0x989b80()));}}}return _0x5b5471;})[_0x6e70('0x5f')]();})[_0x6e70('0x31')](function(){return db[_0x6e70('0x60')][_0x6e70('0x52')]({'attributes':['id'],'include':[{'model':db[_0x6e70('0x54')],'as':_0x6e70('0x62'),'where':{'id':LISTID}}]})[_0x6e70('0x31')](function(_0x48f6fd){var _0x463eed=[];if(_0x48f6fd){for(var _0x39e6db=0x0,_0x53acc8;_0x39e6db<_0x48f6fd[_0x6e70('0x1c')];_0x39e6db+=0x1){_0x53acc8=_0x48f6fd[_0x39e6db][_0x6e70('0x56')]({'plain':!![]});_0x463eed['push'](db['sequelize'][_0x6e70('0x5e')](_0x41a861(_0x53acc8,'CampaignId'))[_0x6e70('0x31')](function(){})['catch'](_0x989b80()));}}return _0x463eed;})[_0x6e70('0x5f')]();})[_0x6e70('0x5c')](function(_0x106f32){logger[_0x6e70('0x16')](_0x6e70('0x63'),_0x6e70('0x64'),_0x106f32[_0x6e70('0x34')]);});}var processPromises=function(_0x5afbf5){return BPromise['all'](promises)[_0x6e70('0x31')](function(_0x4bf451){})[_0x6e70('0x5c')](function(_0xa2a4d5){logger[_0x6e70('0x16')](_0x6e70('0x65'),JSON['stringify'](_0xa2a4d5));})[_0x6e70('0x66')](function(){socket['emit'](_0x6e70('0x67')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x5afbf5){return _0x5afbf5[_0x6e70('0x68')]();}});};var endCsv=function(){return BPromise[_0x6e70('0x69')]()[_0x6e70('0x31')](function(){if(hopperContacts){return checkHopper();}})[_0x6e70('0x31')](function(){socket[_0x6e70('0x6a')](_0x6e70('0x67')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs['unlinkSync'](FILEPATH);}catch(_0x1d6acf){logger['error'](_0x6e70('0x6b'),JSON['stringify'](_0x1d6acf));}finally{process['exit'](0x0);}});};process['on']('SIGINT',function(){logger[_0x6e70('0x6c')](_0x6e70('0x6d'));endCsv();});function main(){return BPromise[_0x6e70('0x69')]()[_0x6e70('0x31')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x6e70('0x6e')](',');return db['CmContact'][_0x6e70('0x52')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x6e70('0x31')](function(_0x48c30c){var _0x3c2d33=fs['createReadStream'](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x6e70('0x6f')](_0x3c2d33,{'header':!![],'skipEmptyLines':!![],'step':function(_0x5d0585,_0x4a87e2){total+=0x1;var _0x25f60c=total;promises[_0x6e70('0x59')](checkRow(_0x5d0585,_0x48c30c,_0x25f60c)[_0x6e70('0x31')](function(){success+=0x1;})[_0x6e70('0x5c')](function(_0x3e6661){if(_0x3e6661[_0x6e70('0x16')]){errors+=0x1;delete _0x3e6661[_0x6e70('0x16')];}else if(_0x3e6661['duplicate']){duplicates+=0x1;delete _0x3e6661[_0x6e70('0x2c')];}rows['push'](_0x3e6661);}));if(total%0xc8===0x0){_0x4a87e2[_0x6e70('0x70')]();return processPromises(_0x4a87e2);}},'complete':function(){return processPromises()[_0x6e70('0x31')](function(){logger[_0x6e70('0x6c')](_0x6e70('0x71'));endCsv();});},'error':function(_0x4764d5,_0x41b7de){logger[_0x6e70('0x6c')]('CSV\x20parse\x20error',JSON[_0x6e70('0x35')](_0x4764d5));endCsv();}});})['catch'](function(_0x27bdf2){logger[_0x6e70('0x16')](_0x6e70('0x72'),JSON[_0x6e70('0x35')](_0x27bdf2));});}main(); \ No newline at end of file +var _0xb7e7=['birthDate','YYYY-MM-DD','isValid','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','find','Duplicate\x20Contact','CmContact','create','then','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','message','stringify','cmContact','checkHopper','insert','into','cm_hopper','fromQuery','scheduledAt','createdAt','updatedAt','select','field','toString','NOW()','from','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','ContactId','cm_contacts','where','str','id\x20IN\x20?','cm_hopper_black','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','Lists','get','always','query','VoiceQueueId','onlyIfOpen','sequelize','all','BlackLists','Campaign','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','emit','contact:csv_','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','SIGINT','createReadStream','parse','duplicate','pause','info','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','lodash','papaparse','../../../mysqldb','../../../config/logger','api','redis','localhost','socket.io-emitter','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','error','contact','index','test','isNil','errors','length','map','join','data','phone','phone\x20not\x20specified!'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xb7e7,0x121));var _0x7b7e=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xb7e7[_0x13d07a];return _0x5ee0ee;};'use strict';var BPromise=require(_0x7b7e('0x0'));var util=require('util');var _=require(_0x7b7e('0x1'));var fs=require('fs');var squel=require('squel');var Papa=require(_0x7b7e('0x2'));var Redis=require('ioredis');var db=require(_0x7b7e('0x3'))['db'];var config=require('../../../config/environment');var logger=require(_0x7b7e('0x4'))(_0x7b7e('0x5'));config[_0x7b7e('0x6')]=_['defaults'](config['redis'],{'host':_0x7b7e('0x7'),'port':0x18eb});var socket=require(_0x7b7e('0x8'))(new Redis(config[_0x7b7e('0x6')]));require('../../../api/cmContact/cmContact.socket')[_0x7b7e('0x9')](socket);try{if(!process[_0x7b7e('0xa')][0x2]||process[_0x7b7e('0xa')][0x2]===_0x7b7e('0xb')||process[_0x7b7e('0xa')][0x2]===_0x7b7e('0xc')){throw new Error(_0x7b7e('0xd'));}var FILEPATH=process['argv'][0x2];if(!process[_0x7b7e('0xa')][0x3]||process[_0x7b7e('0xa')][0x3]===_0x7b7e('0xb')||process[_0x7b7e('0xa')][0x3]===_0x7b7e('0xc')||!process[_0x7b7e('0xa')][0x4]||process[_0x7b7e('0xa')][0x4]===_0x7b7e('0xb')||process[_0x7b7e('0xa')][0x4]==='null'){throw new Error(_0x7b7e('0xe'));}var FIELDS=_[_0x7b7e('0xf')](process['argv'][0x3][_0x7b7e('0x10')](','),process['argv'][0x4]['split'](','));if(!process[_0x7b7e('0xa')][0x5]||process[_0x7b7e('0xa')][0x5]===_0x7b7e('0xb')||process[_0x7b7e('0xa')][0x5]===_0x7b7e('0xc')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process['argv'][0x5];var COMPANYID=process[_0x7b7e('0xa')][0x6]&&process[_0x7b7e('0xa')][0x6]!==_0x7b7e('0xb')&&process[_0x7b7e('0xa')][0x6]!==_0x7b7e('0xc')?process[_0x7b7e('0xa')][0x6]:null;var DUPLICATES=process[_0x7b7e('0xa')][0x7]&&process[_0x7b7e('0xa')][0x7]!==_0x7b7e('0xb')&&process[_0x7b7e('0xa')][0x7]!==_0x7b7e('0xc')?process[_0x7b7e('0xa')][0x7]:null;if(!process[_0x7b7e('0xa')][0x8]||process[_0x7b7e('0xa')][0x8]===_0x7b7e('0xb')||process[_0x7b7e('0xa')][0x8]===_0x7b7e('0xc')){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process[_0x7b7e('0xa')][0x8];}catch(_0x43db4f){logger[_0x7b7e('0x11')](_0x43db4f);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(_0x4c0647,_0x313122,_0xbf0cb3,_0x14243b){var _0x200156={'message':_0x313122};_0x200156[_0x4c0647]=!![];if(_0xbf0cb3){_0x200156[_0x7b7e('0x12')]=_0xbf0cb3;}if(_0x14243b){_0x200156[_0x7b7e('0x13')]=_0x14243b;}return _0x200156;}function isEmail(_0x28bf43){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))*$/[_0x7b7e('0x14')](_0x28bf43);}function checkRow(_0x53bbb3,_0x5d6215,_0x4a836a){return new BPromise(function(_0x26ee14,_0x22598e){if(_[_0x7b7e('0x15')](_0x53bbb3)){return _0x22598e(handleCheckRowError('error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0x4a836a));}if(_0x53bbb3['errors']&&_0x53bbb3[_0x7b7e('0x16')][_0x7b7e('0x17')]){var _0x16a3c7=_[_0x7b7e('0x18')](_0x53bbb3[_0x7b7e('0x16')],'message')[_0x7b7e('0x19')](';');return _0x22598e(handleCheckRowError(_0x7b7e('0x11'),_0x16a3c7,null,_0x4a836a));}var _0x4c46b8={};for(var _0x57b9da in FIELDS){if(FIELDS['hasOwnProperty'](_0x57b9da)&&FIELDS[_0x57b9da]){_0x4c46b8[_0x57b9da]=_0x53bbb3[_0x7b7e('0x1a')][0x0][FIELDS[_0x57b9da]]||_0x53bbb3[_0x7b7e('0x1a')][0x0]['\ufeff'+FIELDS[_0x57b9da]];}}if(!_0x4c46b8['firstName']){return _0x22598e(handleCheckRowError(_0x7b7e('0x11'),'firstName\x20not\x20specified!',null,_0x4a836a));}if(!_0x4c46b8[_0x7b7e('0x1b')]){return _0x22598e(handleCheckRowError(_0x7b7e('0x11'),_0x7b7e('0x1c'),null,_0x4a836a));}if(_0x4c46b8['birthDate']){var _0x3960b8=moment(_0x4c46b8[_0x7b7e('0x1d')],_0x7b7e('0x1e'));if(!_0x3960b8[_0x7b7e('0x1f')]()){return _0x22598e(handleCheckRowError(_0x7b7e('0x11'),'birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x4a836a));}}if(_0x4c46b8[_0x7b7e('0x20')]){if(!isEmail(_0x4c46b8['email'])){return _0x22598e(handleCheckRowError(_0x7b7e('0x11'),_0x7b7e('0x21'),null,_0x4a836a));}}_0x4c46b8[_0x7b7e('0x22')]=LISTID;_0x4c46b8[_0x7b7e('0x23')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x7b7e('0x17')]&&_0x5d6215){var _0x247ea0={};for(var _0x29cb58=0x0,_0x4bfe7f=DUPLICATES['length'];_0x29cb58<_0x4bfe7f;_0x29cb58+=0x1){_0x247ea0[DUPLICATES[_0x29cb58]]=_0x4c46b8[DUPLICATES[_0x29cb58]];}var _0xebcdbc=_[_0x7b7e('0x24')](_0x5d6215,_0x247ea0);if(_0xebcdbc){return _0x22598e(handleCheckRowError('duplicate',_0x7b7e('0x25'),_0xebcdbc,_0x4a836a));}}return db[_0x7b7e('0x26')][_0x7b7e('0x27')](_0x4c46b8,{'raw':!![],'hooks':![],'fields':_['keys'](_0x4c46b8)})[_0x7b7e('0x28')](function(_0x256908){if(DUPLICATES&&DUPLICATES[_0x7b7e('0x17')]&&_0x5d6215){_0x5d6215[_0x7b7e('0x29')](_[_0x7b7e('0x2a')](_0x4c46b8,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x256908['id'];return _0x26ee14();})[_0x7b7e('0x2b')](function(_0x3e8cf4){return _0x22598e(handleCheckRowError(_0x7b7e('0x11'),_0x7b7e('0x2c')+(_0x3e8cf4[_0x7b7e('0x2d')]||JSON[_0x7b7e('0x2e')](_0x3e8cf4)),null,_0x4a836a));});});}function checkHopper(){function _0x2d0620(){return function(_0x442366){logger[_0x7b7e('0x11')](_0x7b7e('0x2f'),_0x7b7e('0x30'),util['inspect'](_0x442366,{'showHidden':![],'depth':null}));};}var _0x8c80d5=function(_0x156dca,_0xb20532){var _0x242609=squel[_0x7b7e('0x31')]()[_0x7b7e('0x32')](_0x7b7e('0x33'))[_0x7b7e('0x34')]([_0x7b7e('0x1b'),_0x7b7e('0x35'),'ContactId',_0x7b7e('0x22'),_0xb20532,_0x7b7e('0x36'),_0x7b7e('0x37')],squel[_0x7b7e('0x38')]()['field'](_0x7b7e('0x1b'),_0x7b7e('0x1b'))[_0x7b7e('0x39')]('NOW()','scheduledAt')[_0x7b7e('0x39')]('id','ContactId')[_0x7b7e('0x39')](LISTID[_0x7b7e('0x3a')](),'ListId')[_0x7b7e('0x39')](_0x156dca['id'][_0x7b7e('0x3a')](),_0xb20532)[_0x7b7e('0x39')](_0x7b7e('0x3b'),_0x7b7e('0x36'))[_0x7b7e('0x39')](_0x7b7e('0x3b'),_0x7b7e('0x37'))[_0x7b7e('0x3c')]('cm_contacts')['where'](_0x7b7e('0x3d'))['where'](_0x7b7e('0x3e'),LISTID['toString']())['where'](_0x7b7e('0x3f'))['where'](_0x7b7e('0x40'),squel['select']()[_0x7b7e('0x39')](_0x7b7e('0x1b'))[_0x7b7e('0x3c')](_0x7b7e('0x33'))['where'](_0xb20532+_0x7b7e('0x41'),_0x156dca['id'][_0x7b7e('0x3a')]())))[_0x7b7e('0x3a')]();return _0x242609;};var _0x37895a=function(_0x3e4f21,_0xccdfc7){var _0x5e8572=squel['insert']()['into'](_0x7b7e('0x33'))[_0x7b7e('0x34')]([_0x7b7e('0x1b'),_0x7b7e('0x35'),_0x7b7e('0x42'),_0x7b7e('0x22'),_0xccdfc7,'createdAt',_0x7b7e('0x37')],squel[_0x7b7e('0x38')]()['field']('phone',_0x7b7e('0x1b'))[_0x7b7e('0x39')](_0x7b7e('0x3b'),_0x7b7e('0x35'))[_0x7b7e('0x39')]('id',_0x7b7e('0x42'))['field'](LISTID[_0x7b7e('0x3a')](),'ListId')[_0x7b7e('0x39')](_0x3e4f21['id'][_0x7b7e('0x3a')](),_0xccdfc7)[_0x7b7e('0x39')](_0x7b7e('0x3b'),'createdAt')[_0x7b7e('0x39')](_0x7b7e('0x3b'),_0x7b7e('0x37'))[_0x7b7e('0x3c')](_0x7b7e('0x43'))['where'](_0x7b7e('0x3d'))[_0x7b7e('0x44')](_0x7b7e('0x3e'),LISTID[_0x7b7e('0x3a')]())[_0x7b7e('0x44')]('id\x20IN\x20?',squel[_0x7b7e('0x45')](hopperContacts))[_0x7b7e('0x44')](_0x7b7e('0x3f'))[_0x7b7e('0x44')](_0x7b7e('0x40'),squel[_0x7b7e('0x38')]()[_0x7b7e('0x39')]('calleridnum')[_0x7b7e('0x3c')]('cm_hopper_final')[_0x7b7e('0x44')](_0xccdfc7+_0x7b7e('0x41'),_0x3e4f21['id']['toString']()))[_0x7b7e('0x44')](_0x7b7e('0x40'),squel[_0x7b7e('0x38')]()[_0x7b7e('0x39')](_0x7b7e('0x1b'))[_0x7b7e('0x3c')](_0x7b7e('0x33'))['where'](_0xccdfc7+_0x7b7e('0x41'),_0x3e4f21['id'][_0x7b7e('0x3a')]())))[_0x7b7e('0x3a')]();return _0x5e8572;};function _0x24481a(_0x5b9ab5,_0x527403){var _0x5bdf1d=squel[_0x7b7e('0x31')]()[_0x7b7e('0x32')](_0x7b7e('0x33'))['fromQuery'](['phone',_0x7b7e('0x35'),_0x7b7e('0x42'),'ListId',_0x527403,_0x7b7e('0x36'),_0x7b7e('0x37')],squel[_0x7b7e('0x38')]()['field'](_0x7b7e('0x1b'),_0x7b7e('0x1b'))['field'](_0x7b7e('0x3b'),_0x7b7e('0x35'))[_0x7b7e('0x39')]('id',_0x7b7e('0x42'))[_0x7b7e('0x39')](LISTID[_0x7b7e('0x3a')](),_0x7b7e('0x22'))[_0x7b7e('0x39')](_0x5b9ab5['id'][_0x7b7e('0x3a')](),_0x527403)['field'](_0x7b7e('0x3b'),_0x7b7e('0x36'))['field'](_0x7b7e('0x3b'),_0x7b7e('0x37'))[_0x7b7e('0x3c')]('cm_contacts')[_0x7b7e('0x44')]('deletedAt\x20IS\x20NULL')[_0x7b7e('0x44')](_0x7b7e('0x3e'),LISTID['toString']())[_0x7b7e('0x44')](_0x7b7e('0x46'),squel['str'](hopperContacts))[_0x7b7e('0x44')](_0x7b7e('0x3f')))[_0x7b7e('0x3a')]();return _0x5bdf1d;}function _0x3b1adb(_0x5eb32c,_0x101896){var _0x73904d=squel[_0x7b7e('0x31')]()[_0x7b7e('0x32')](_0x7b7e('0x47'))[_0x7b7e('0x34')]([_0x7b7e('0x1b'),_0x7b7e('0x42'),_0x7b7e('0x22'),_0x101896,_0x7b7e('0x36'),'updatedAt'],squel[_0x7b7e('0x38')]()['field']('phone',_0x7b7e('0x1b'))[_0x7b7e('0x39')]('id',_0x7b7e('0x42'))[_0x7b7e('0x39')](LISTID['toString'](),_0x7b7e('0x22'))[_0x7b7e('0x39')](_0x5eb32c['id'][_0x7b7e('0x3a')](),_0x101896)[_0x7b7e('0x39')](_0x7b7e('0x3b'),_0x7b7e('0x36'))['field'](_0x7b7e('0x3b'),'updatedAt')['from'](_0x7b7e('0x43'))['where'](_0x7b7e('0x3d'))['where'](_0x7b7e('0x3e'),LISTID[_0x7b7e('0x3a')]())['where'](_0x7b7e('0x46'),squel[_0x7b7e('0x45')](hopperContacts))['where'](_0x7b7e('0x3f')))[_0x7b7e('0x3a')]();return _0x73904d;}return db[_0x7b7e('0x48')][_0x7b7e('0x49')]({'where':{'type':_0x7b7e('0x4a')},'attributes':['id',_0x7b7e('0x4b')],'include':[{'model':db[_0x7b7e('0x4c')],'as':_0x7b7e('0x4d'),'where':{'id':LISTID}}]})[_0x7b7e('0x28')](function(_0x17e5ba){var _0x589b02=[];if(_0x17e5ba){var _0x59ecf9;for(var _0x34e7df=0x0,_0x46ac1f;_0x34e7df<_0x17e5ba[_0x7b7e('0x17')];_0x34e7df+=0x1){_0x46ac1f=_0x17e5ba[_0x34e7df][_0x7b7e('0x4e')]({'plain':!![]});switch(_0x46ac1f[_0x7b7e('0x4b')]){case _0x7b7e('0x4f'):_0x589b02[_0x7b7e('0x29')](db['sequelize'][_0x7b7e('0x50')](_0x37895a(_0x46ac1f,_0x7b7e('0x51')))['then'](function(){})[_0x7b7e('0x2b')](_0x2d0620()));break;case _0x7b7e('0x52'):_0x589b02[_0x7b7e('0x29')](db[_0x7b7e('0x53')][_0x7b7e('0x50')](_0x8c80d5(_0x46ac1f,_0x7b7e('0x51')))[_0x7b7e('0x28')](function(){})[_0x7b7e('0x2b')](_0x2d0620()));break;default:_0x589b02[_0x7b7e('0x29')](db[_0x7b7e('0x53')][_0x7b7e('0x50')](_0x24481a(_0x46ac1f,'VoiceQueueId'))[_0x7b7e('0x28')](function(){})[_0x7b7e('0x2b')](_0x2d0620()));}}}return _0x589b02;})[_0x7b7e('0x54')]()[_0x7b7e('0x28')](function(){return db[_0x7b7e('0x48')][_0x7b7e('0x49')]({'where':{'type':_0x7b7e('0x4a')},'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x7b7e('0x55'),'where':{'id':LISTID}}]})[_0x7b7e('0x28')](function(_0x1eb5ce){var _0x49f0a4=[];if(_0x1eb5ce){var _0x1d6aa4;for(var _0x195ae2=0x0,_0x381ee6;_0x195ae2<_0x1eb5ce[_0x7b7e('0x17')];_0x195ae2+=0x1){_0x381ee6=_0x1eb5ce[_0x195ae2][_0x7b7e('0x4e')]({'plain':!![]});_0x49f0a4['push'](db['sequelize']['query'](_0x3b1adb(_0x381ee6,_0x7b7e('0x51')))[_0x7b7e('0x28')](function(){})[_0x7b7e('0x2b')](_0x2d0620()));}}return _0x49f0a4;})['all']();})[_0x7b7e('0x28')](function(){return db[_0x7b7e('0x56')][_0x7b7e('0x49')]({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x7b7e('0x4c')],'as':_0x7b7e('0x4d'),'where':{'id':LISTID}}]})[_0x7b7e('0x28')](function(_0x34a06c){var _0x538c5f=[];if(_0x34a06c){for(var _0x315923=0x0,_0x40b4ae;_0x315923<_0x34a06c[_0x7b7e('0x17')];_0x315923+=0x1){_0x40b4ae=_0x34a06c[_0x315923][_0x7b7e('0x4e')]({'plain':!![]});switch(_0x40b4ae['dialCheckDuplicateType']){case'always':_0x538c5f[_0x7b7e('0x29')](db['sequelize'][_0x7b7e('0x50')](_0x37895a(_0x40b4ae,_0x7b7e('0x57')))[_0x7b7e('0x28')](function(){})[_0x7b7e('0x2b')](_0x2d0620()));break;case'onlyIfOpen':_0x538c5f[_0x7b7e('0x29')](db[_0x7b7e('0x53')][_0x7b7e('0x50')](_0x8c80d5(_0x40b4ae,_0x7b7e('0x57')))[_0x7b7e('0x28')](function(){})[_0x7b7e('0x2b')](_0x2d0620()));break;default:_0x538c5f[_0x7b7e('0x29')](db[_0x7b7e('0x53')][_0x7b7e('0x50')](_0x24481a(_0x40b4ae,_0x7b7e('0x57')))[_0x7b7e('0x28')](function(){})[_0x7b7e('0x2b')](_0x2d0620()));}}}return _0x538c5f;})[_0x7b7e('0x54')]();})[_0x7b7e('0x28')](function(){return db[_0x7b7e('0x56')][_0x7b7e('0x49')]({'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x7b7e('0x55'),'where':{'id':LISTID}}]})[_0x7b7e('0x28')](function(_0x1d9e08){var _0xa03d7a=[];if(_0x1d9e08){for(var _0x10c35e=0x0,_0x302462;_0x10c35e<_0x1d9e08[_0x7b7e('0x17')];_0x10c35e+=0x1){_0x302462=_0x1d9e08[_0x10c35e]['get']({'plain':!![]});_0xa03d7a[_0x7b7e('0x29')](db[_0x7b7e('0x53')][_0x7b7e('0x50')](_0x3b1adb(_0x302462,_0x7b7e('0x57')))[_0x7b7e('0x28')](function(){})['catch'](_0x2d0620()));}}return _0xa03d7a;})['all']();})[_0x7b7e('0x2b')](function(_0x110f2b){logger[_0x7b7e('0x11')](_0x7b7e('0x58'),_0x7b7e('0x59'),_0x110f2b[_0x7b7e('0x2d')]);});}var processPromises=function(_0x2c65b8){return BPromise[_0x7b7e('0x54')](promises)[_0x7b7e('0x28')](function(_0x850d0f){})['catch'](function(_0x27402a){logger[_0x7b7e('0x11')](_0x7b7e('0x5a'),JSON[_0x7b7e('0x2e')](_0x27402a));})[_0x7b7e('0x5b')](function(){socket[_0x7b7e('0x5c')](_0x7b7e('0x5d')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x2c65b8){return _0x2c65b8['resume']();}});};var endCsv=function(){return BPromise[_0x7b7e('0x5e')]()['then'](function(){if(hopperContacts){return checkHopper();}})[_0x7b7e('0x28')](function(){socket[_0x7b7e('0x5c')]('contact:csv_'+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x7b7e('0x5f')](FILEPATH);}catch(_0x38fd40){logger[_0x7b7e('0x11')](_0x7b7e('0x60'),JSON[_0x7b7e('0x2e')](_0x38fd40));}finally{process['exit'](0x0);}});};process['on'](_0x7b7e('0x61'),function(){logger['info']('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise[_0x7b7e('0x5e')]()[_0x7b7e('0x28')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x7b7e('0x10')](',');return db[_0x7b7e('0x26')]['findAll']({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x7b7e('0x28')](function(_0x5cedd4){var _0x25233a=fs[_0x7b7e('0x62')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x7b7e('0x63')](_0x25233a,{'header':!![],'skipEmptyLines':!![],'step':function(_0x1e71ab,_0x11d615){total+=0x1;var _0x3afd15=total;promises[_0x7b7e('0x29')](checkRow(_0x1e71ab,_0x5cedd4,_0x3afd15)['then'](function(){success+=0x1;})[_0x7b7e('0x2b')](function(_0x30eeee){if(_0x30eeee['error']){errors+=0x1;delete _0x30eeee[_0x7b7e('0x11')];}else if(_0x30eeee[_0x7b7e('0x64')]){duplicates+=0x1;delete _0x30eeee[_0x7b7e('0x64')];}rows[_0x7b7e('0x29')](_0x30eeee);}));if(total%0xc8===0x0){_0x11d615[_0x7b7e('0x65')]();return processPromises(_0x11d615);}},'complete':function(){return processPromises()[_0x7b7e('0x28')](function(){logger[_0x7b7e('0x66')](_0x7b7e('0x67'));endCsv();});},'error':function(_0x41e2b5,_0x97232d){logger[_0x7b7e('0x66')](_0x7b7e('0x68'),JSON[_0x7b7e('0x2e')](_0x41e2b5));endCsv();}});})[_0x7b7e('0x2b')](function(_0x12d0cb){logger[_0x7b7e('0x11')](_0x7b7e('0x69'),JSON[_0x7b7e('0x2e')](_0x12d0cb));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 60f5b8f..8bf630d 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 _0x4cfa=['send','start','binding','socket_timestamp','.csv','header','writeFileSync','parse','data','length','rows','hasOwnProperty','trim','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','includes','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','firstName','\x20not\x20specified','SystemRow','emit','contact:import:','Abort\x20parser','abort','SystemError','step','duplicates','cm_contacts_','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','isNil',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','voice_queues','VoiceQueueId','campaigns','CampaignId','each','then','affectedRows','unlink','argv','arguments\x20\x20\x20','root','existsSync','file\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','SIGINT','path','lodash','papaparse','util','moment','squel','ioredis','../../../mysqldb','../../../config/environment','redis','defaults','localhost','format','YYYY-MM-DD\x20HH:mm:ss','field','from','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.phone','cm_contacts.ListId','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','phone','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','UserId','recallme','fields','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','cm_contacts.createdAt','fromQuery','select','cm_contacts','cm_hopper_black','ListId\x20=\x20?','\x20=\x20?','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','min_id','group','info','Received\x20SIGINT','error','message','exit','errors','push','code','sequelize','query','spread','catch','main'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0x4cfa,0xb9));var _0xa4cf=function(_0x5555c6,_0x3b388f){_0x5555c6=_0x5555c6-0x0;var _0x5e8dc5=_0x4cfa[_0x5555c6];return _0x5e8dc5;};'use strict';var fs=require('fs');var path=require(_0xa4cf('0x0'));var _=require(_0xa4cf('0x1'));var Papa=require(_0xa4cf('0x2'));var util=require(_0xa4cf('0x3'));var BPromise=require('bluebird');var moment=require(_0xa4cf('0x4'));var squel=require(_0xa4cf('0x5'));var Redis=require(_0xa4cf('0x6'));var db=require(_0xa4cf('0x7'))['db'];var config=require(_0xa4cf('0x8'));var logger=require('../../../config/logger')('import');config[_0xa4cf('0x9')]=_[_0xa4cf('0xa')](config[_0xa4cf('0x9')],{'host':_0xa4cf('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa4cf('0x9')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0xa4cf('0xc')](_0xa4cf('0xd'));function isEmail(_0x398c34){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/['test'](_0x398c34);}function selectNotIn(_0x434beb,_0x459ee2,_0x569a72,_0x8118c5,_0x70a3e1){return squel['select']()[_0xa4cf('0xe')]('phone')[_0xa4cf('0xf')](_0x8118c5)[_0xa4cf('0x10')](_0x459ee2,null,_0x459ee2+_0xa4cf('0x11')+_0x8118c5+'.'+_0x569a72)[_0xa4cf('0x12')](_0x8118c5+'.'+_0x569a72+_0xa4cf('0x13')+_0x434beb+'.'+_0x569a72)[_0xa4cf('0x12')](_0x459ee2+_0xa4cf('0x14')+_0x70a3e1['join']()+')');}function insertCmHopper(_0x1cae94,_0x4fab7d,_0x20ba1a,_0xe45273,_0x557456){var _0x531a28=[_0xa4cf('0x15'),'cm_contacts.scheduledat','cm_contacts.id',_0xa4cf('0x16'),_0x4fab7d+'.'+_0xe45273,'cm_contacts.createdAt',_0xa4cf('0x17'),_0xa4cf('0x18'),_0xa4cf('0x19'),'\x22'+_0x557456+'\x22'];return squel[_0xa4cf('0x1a')]()[_0xa4cf('0x1b')](_0xa4cf('0x1c'))['fromQuery']([_0xa4cf('0x1d'),_0xa4cf('0x1e'),_0xa4cf('0x1f'),_0xa4cf('0x20'),_0xe45273,_0xa4cf('0x21'),_0xa4cf('0x22'),_0xa4cf('0x23'),_0xa4cf('0x24'),_0xa4cf('0x25')],squel['select']()[_0xa4cf('0x26')](_0x531a28)[_0xa4cf('0xf')](_0x4fab7d)[_0xa4cf('0x10')]('cm_contacts',null,_0xa4cf('0x27')+_0x4fab7d+_0xa4cf('0x28'))['join'](_0x20ba1a,null,_0x20ba1a+'.id\x20=\x20'+_0x4fab7d+'.'+_0xe45273)['where'](_0x4fab7d+_0xa4cf('0x29'),_0x1cae94)[_0xa4cf('0x12')](_0xa4cf('0x2a'),NOW)['where'](_0xa4cf('0x2b'),selectNotIn(_0x4fab7d,_0x20ba1a,_0xe45273,_0xa4cf('0x1c'),[_0xa4cf('0x2c'),_0xa4cf('0x2d')]))['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x4fab7d,_0x20ba1a,_0xe45273,_0xa4cf('0x1c'),[_0xa4cf('0x2c')])))['toString']();}function insertCmHopperBlack(_0x432a08,_0x28ed72,_0x49d611,_0xd231f5){var _0x294a23=['cm_contacts.phone','cm_contacts.id',_0xa4cf('0x16'),_0x28ed72+'.'+_0xd231f5,_0xa4cf('0x2e'),_0xa4cf('0x17')];return squel[_0xa4cf('0x1a')]()['into']('cm_hopper_black')[_0xa4cf('0x2f')](['phone',_0xa4cf('0x1f'),_0xa4cf('0x20'),_0xd231f5,_0xa4cf('0x21'),_0xa4cf('0x22')],squel[_0xa4cf('0x30')]()['fields'](_0x294a23)[_0xa4cf('0xf')](_0x28ed72)[_0xa4cf('0x10')](_0xa4cf('0x31'),null,_0xa4cf('0x27')+_0x28ed72+_0xa4cf('0x28'))['join'](_0x49d611,null,_0x49d611+_0xa4cf('0x11')+_0x28ed72+'.'+_0xd231f5)[_0xa4cf('0x12')](_0x28ed72+_0xa4cf('0x29'),_0x432a08)['where'](_0xa4cf('0x2a'),NOW)['where'](_0xa4cf('0x2b'),squel['select']()[_0xa4cf('0xe')]('phone')['from'](_0xa4cf('0x32'))[_0xa4cf('0x12')](_0xa4cf('0x33'),_0x432a08)['where'](_0xd231f5+_0xa4cf('0x34'),_0x28ed72+'.'+_0xd231f5)))['toString']();}function insertCmContact(_0x2ce9e2,_0x5234d3,_0x1919c1,_0x2008a7){var _0x36c644=_[_0xa4cf('0x35')](_[_0xa4cf('0x36')](_0x2008a7),[_0xa4cf('0x20'),_0xa4cf('0x37'),'createdAt',_0xa4cf('0x22')]);return squel[_0xa4cf('0x1a')]()[_0xa4cf('0x1b')](_0xa4cf('0x31'))[_0xa4cf('0x2f')](_0x36c644,squel['select']()[_0xa4cf('0x26')](_0x36c644)[_0xa4cf('0xf')](_0x5234d3)[_0xa4cf('0x12')]('('+_0x1919c1[_0xa4cf('0x10')](',')+_0xa4cf('0x38'),squel[_0xa4cf('0x30')]()[_0xa4cf('0x26')](_0x1919c1)[_0xa4cf('0xf')](_0xa4cf('0x31'))[_0xa4cf('0x12')](_0xa4cf('0x33'),_0x2ce9e2)[_0xa4cf('0x12')](_0xa4cf('0x39')))[_0xa4cf('0x12')](_0xa4cf('0x3a'),squel[_0xa4cf('0x30')]()[_0xa4cf('0xe')](_0xa4cf('0x3b'),_0xa4cf('0x3c'))[_0xa4cf('0xf')](_0x5234d3)[_0xa4cf('0x3d')](_0x1919c1[_0xa4cf('0x10')](','))))['toString']();}function handleStop(){logger[_0xa4cf('0x3e')](_0xa4cf('0x3f'));stopped=!![];}function handleUncaughtException(_0x296f56){logger[_0xa4cf('0x40')](_0x296f56[_0xa4cf('0x41')]);process[_0xa4cf('0x42')](0x1);}function handleError(_0x3f2002,_0x3016ea){stats[_0xa4cf('0x43')][_0xa4cf('0x44')]({'name':_0x3016ea[_0xa4cf('0x45')],'message':_0x3016ea['message'],'row':_0x3f2002});}function handleQuery(_0x16db37){logger[_0xa4cf('0x3e')](_0x16db37);return db[_0xa4cf('0x46')][_0xa4cf('0x47')](_0x16db37)[_0xa4cf('0x48')](function(_0x2851bb){results[_0xa4cf('0x44')](_0x2851bb);})[_0xa4cf('0x49')](function(_0x271ede){logger[_0xa4cf('0x40')](_0x271ede[_0xa4cf('0x41')]);});}function main(_0x3e0fbd,_0x4bb551,_0x2c44f3,_0x4433fa){logger['info'](_0xa4cf('0x4a'),_0x3e0fbd,JSON['stringify'](_0x4bb551));process[_0xa4cf('0x4b')](_0xa4cf('0x4c'));var _0x5994d3=_0x4bb551[_0xa4cf('0x4d')];var _0x293d9b=_0x4bb551[_0xa4cf('0x4e')];var _0x2f56c1=path['join'](config['root'],'server/files/tmp',_0x293d9b+_0xa4cf('0x4f'));var _0x4e0ea1=_[_0xa4cf('0x36')](_0x5994d3)[_0xa4cf('0x10')]();logger['info'](_0xa4cf('0x50'),_0x4e0ea1);fs[_0xa4cf('0x51')](_0x2f56c1,_0x4e0ea1+'\x0a');Papa[_0xa4cf('0x52')](fs['createReadStream'](_0x3e0fbd),{'header':!![],'skipEmptyLines':!![],'step':function(_0x151768,_0x4f6f11){try{for(var _0x3343fe=0x0,_0x5721b5=[];_0x3343fe<_0x151768[_0xa4cf('0x53')][_0xa4cf('0x54')];_0x3343fe++){stats[_0xa4cf('0x55')]+=0x1;if(_0x151768[_0xa4cf('0x43')][_0x3343fe]){handleError(_0x151768[_0xa4cf('0x53')][_0x3343fe],_0x151768[_0xa4cf('0x43')][_0x3343fe]);}else{var _0x5ecea0=[];for(var _0x1b6120 in _0x5994d3){if(_0x5994d3[_0xa4cf('0x56')](_0x1b6120)){if(_0x151768[_0xa4cf('0x53')][_0x3343fe][_0x5994d3[_0x1b6120]]){var _0x3bb9a4=_[_0xa4cf('0x57')](_0x151768[_0xa4cf('0x53')][_0x3343fe][_0x5994d3[_0x1b6120]]['replace'](/"/g,'\x27'));switch(_0x1b6120){case _0xa4cf('0x1e'):var _0x49129b=moment(_0x3bb9a4,_0xa4cf('0xd'),!![]);if(_0x49129b[_0xa4cf('0x58')]()){_0x5721b5['push']('\x22'+_0x3bb9a4+'\x22');}else{_0x5ecea0[_0xa4cf('0x44')](_0xa4cf('0x59'));}break;case _0xa4cf('0x23'):var _0x4ba9ac=parseInt(_0x3bb9a4);_0x3bb9a4=_[_0xa4cf('0x5a')](_0x4ba9ac)||_0x4ba9ac<0x0||_0x4ba9ac>0x4?_0x4433fa?0x3:0x2:_0x4ba9ac;_0x5721b5[_0xa4cf('0x44')]('\x22'+_0x3bb9a4+'\x22');break;case'UserId':var _0x4c828e=parseInt(_0x3bb9a4);if(_[_0xa4cf('0x5b')](_0x4c828e)&&_[_0xa4cf('0x5c')](_0x2c44f3,_0x4c828e)){_0x5721b5[_0xa4cf('0x44')]('\x22'+_0x4c828e+'\x22');}else{_0x5ecea0[_0xa4cf('0x44')]('agent\x20not\x20exists');}break;case _0xa4cf('0x5d'):if(isEmail(_0x3bb9a4)){_0x5721b5[_0xa4cf('0x44')]('\x22'+_0x3bb9a4+'\x22');}else{_0x5ecea0[_0xa4cf('0x44')](_0xa4cf('0x5e'));}break;case _0xa4cf('0x5f'):var _0x1f4705=moment(_0x3bb9a4,_0xa4cf('0x60'),!![]);if(_0x1f4705['isValid']()){_0x5721b5[_0xa4cf('0x44')]('\x22'+_0x3bb9a4+'\x22');}else{_0x5ecea0[_0xa4cf('0x44')]('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;default:_0x5721b5[_0xa4cf('0x44')]('\x22'+_0x3bb9a4+'\x22');}}else{switch(_0x1b6120){case _0xa4cf('0x61'):case _0xa4cf('0x1d'):_0x5ecea0['push'](_0x1b6120+_0xa4cf('0x62'));break;default:_0x5721b5[_0xa4cf('0x44')]('\x22\x22');}}}}if(_0x5ecea0[_0xa4cf('0x54')]){handleError(_0x151768['data'][_0x3343fe],{'code':_0xa4cf('0x63'),'message':_0x5ecea0[_0xa4cf('0x10')]()});}else{fs['appendFileSync'](_0x2f56c1,_0x5721b5[_0xa4cf('0x10')]()+'\x0a');}_0x5721b5=[];}if(!(stats[_0xa4cf('0x55')]%0xc8)){socket[_0xa4cf('0x64')](_0xa4cf('0x65')+_0x293d9b,stats);stats[_0xa4cf('0x43')]=[];}}if(stopped){logger[_0xa4cf('0x3e')](_0xa4cf('0x66'));_0x4f6f11[_0xa4cf('0x67')]();}}catch(_0x2fda65){handleError(_0x151768[_0xa4cf('0x53')][_0x3343fe],{'code':_0xa4cf('0x68'),'message':_0x2fda65[_0xa4cf('0x41')]});logger[_0xa4cf('0x40')](_0xa4cf('0x69'),_0x2fda65['message']);}},'complete':function(){try{var _0x547384=[];var _0x4232a0=_0xa4cf('0x31');if(_0x4bb551[_0xa4cf('0x6a')]&&_0x4bb551[_0xa4cf('0x6a')][_0xa4cf('0x54')]){_0x4232a0=_0xa4cf('0x6b')+_0x293d9b;_0x547384[_0xa4cf('0x44')]('CREATE\x20TABLE\x20'+_0x4232a0+'\x20LIKE\x20cm_contacts;');}var _0x59459f=util[_0xa4cf('0xc')](_0xa4cf('0x6c'),_0x2f56c1,_0x4232a0,_0x4e0ea1,_0x4bb551[_0xa4cf('0x20')],_0x4bb551[_0xa4cf('0x37')]||null,NOW,NOW);if(_[_0xa4cf('0x6d')](_0x5994d3['scheduledat'])){_0x59459f+=_0xa4cf('0x6e');}_0x547384[_0xa4cf('0x44')](_0x59459f);if(_0x4bb551[_0xa4cf('0x6a')]&&_0x4bb551['duplicates']['length']){_0x547384['push'](insertCmContact(_0x4bb551[_0xa4cf('0x20')],_0x4232a0,_0x4bb551['duplicates'],_0x5994d3));_0x547384[_0xa4cf('0x44')](_0xa4cf('0x6f')+_0x4232a0+';');}_0x547384[_0xa4cf('0x44')](insertCmHopper(_0x4bb551[_0xa4cf('0x20')],'voice_queues_has_cm_lists',_0xa4cf('0x70'),_0xa4cf('0x71'),_0x4433fa));_0x547384[_0xa4cf('0x44')](insertCmHopperBlack(_0x4bb551[_0xa4cf('0x20')],'voice_queues_has_cm_blacklists','voice_queues',_0xa4cf('0x71')));_0x547384[_0xa4cf('0x44')](insertCmHopper(_0x4bb551['ListId'],'campaigns_has_cm_lists',_0xa4cf('0x72'),_0xa4cf('0x73'),_0x4433fa));_0x547384['push'](insertCmHopperBlack(_0x4bb551[_0xa4cf('0x20')],'campaigns_has_cm_blacklists',_0xa4cf('0x72'),_0xa4cf('0x73')));BPromise[_0xa4cf('0x74')](_0x547384,handleQuery)[_0xa4cf('0x75')](function(_0x503562){stats['finish']=!![];stats[_0xa4cf('0x76')]=_0x4bb551[_0xa4cf('0x6a')]&&_0x4bb551['duplicates'][_0xa4cf('0x54')]?results[0x2]['affectedRows']:results[0x0]['affectedRows'];socket[_0xa4cf('0x64')]('contact:import:'+_0x293d9b,stats);fs[_0xa4cf('0x77')](_0x3e0fbd);fs[_0xa4cf('0x77')](_0x2f56c1);process[_0xa4cf('0x42')](0x0);})[_0xa4cf('0x49')](function(_0x325fce){logger[_0xa4cf('0x40')](_0x325fce['message']);process[_0xa4cf('0x42')](0x1);});}catch(_0x58b271){logger['error']('complete',_0x58b271[_0xa4cf('0x41')]);process['exit'](0x1);}},'error':function(_0x4c16fc,_0x32f4cb,_0x222f5e,_0x12757c){throw new Error(_0x12757c);}});}function validate(){if(process['argv']&&process[_0xa4cf('0x78')]['length']<0x4){throw new Error(_0xa4cf('0x79'));}var _0x3331bc=path[_0xa4cf('0x10')](config[_0xa4cf('0x7a')],'server/files/tmp',process[_0xa4cf('0x78')][0x2]);if(!fs[_0xa4cf('0x7b')](_0x3331bc)){throw new Error(_0xa4cf('0x7c'));}var _0x1b1408={};try{_0x1b1408=JSON['parse'](process[_0xa4cf('0x78')][0x3]);if(!_0x1b1408[_0xa4cf('0x4d')]){throw new Error('binding\x20doesn\x27t\x20exists');}if(!_0x1b1408[_0xa4cf('0x4d')][_0xa4cf('0x1d')]){throw new Error(_0xa4cf('0x7d'));}if(!_0x1b1408['binding'][_0xa4cf('0x61')]){throw new Error(_0xa4cf('0x7e'));}var _0x41a5e7=0x0;if(_0x1b1408['binding'][_0xa4cf('0x24')]){_0x41a5e7=0x1;}if(!_0x1b1408[_0xa4cf('0x20')]){throw new Error(_0xa4cf('0x7f'));}}catch(_0x47360e){throw new Error(_0xa4cf('0x80'));}var _0x2de744=[];try{_0x2de744=_['map'](JSON[_0xa4cf('0x52')](process[_0xa4cf('0x78')][0x4]),'id');}catch(_0x1683c2){logger[_0xa4cf('0x3e')]('No\x20agent\x20available');}main(_0x3331bc,_0x1b1408,_0x2de744,_0x41a5e7);}validate();process['on'](_0xa4cf('0x81'),handleStop);process['on']('uncaughtException',handleUncaughtException); \ No newline at end of file +var _0x066c=['stringify','send','start','socket_timestamp','root','server/files/tmp','.csv','header','writeFileSync','createReadStream','data','length','rows','hasOwnProperty','replace','scheduledat','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','priority','isNaN','includes','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','SystemRow','appendFileSync','emit','contact:import:','Abort\x20parser','abort','SystemError','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','isNil',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','voice_queues_has_cm_lists','voice_queues','VoiceQueueId','voice_queues_has_cm_blacklists','campaigns_has_cm_lists','campaigns','CampaignId','each','finish','affectedRows','unlink','complete','argv','arguments\x20\x20\x20','file\x20doesn\x27t\x20exists','parse','binding','binding\x20doesn\x27t\x20exists','body\x20id\x20mandatory','map','SIGINT','uncaughtException','path','lodash','util','bluebird','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','defaults','redis','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','phone','from','.id\x20=\x20','where','\x20=\x20','join','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.priority','cm_contacts.UserId','cm_hopper','fromQuery','ContactId','ListId','createdAt','updatedAt','UserId','recallme','select','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','cm_contacts.id','cm_contacts.updatedAt','insert','into','cm_hopper_black','cm_contacts.createdAt\x20=\x20?','field','ListId\x20=\x20?','\x20=\x20?','toString','concat','keys','CompanyId','fields','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','min_id','group','Received\x20SIGINT','error','exit','errors','push','code','info','sequelize','query','spread','catch','message','main'];(function(_0x2aecb2,_0x343312){var _0x3ebb80=function(_0x19fab3){while(--_0x19fab3){_0x2aecb2['push'](_0x2aecb2['shift']());}};_0x3ebb80(++_0x343312);}(_0x066c,0x15b));var _0xc066=function(_0x2c0a9d,_0x4a46c0){_0x2c0a9d=_0x2c0a9d-0x0;var _0x42c6be=_0x066c[_0x2c0a9d];return _0x42c6be;};'use strict';var fs=require('fs');var path=require(_0xc066('0x0'));var _=require(_0xc066('0x1'));var Papa=require('papaparse');var util=require(_0xc066('0x2'));var BPromise=require(_0xc066('0x3'));var moment=require('moment');var squel=require(_0xc066('0x4'));var Redis=require(_0xc066('0x5'));var db=require(_0xc066('0x6'))['db'];var config=require(_0xc066('0x7'));var logger=require(_0xc066('0x8'))('import');config['redis']=_[_0xc066('0x9')](config[_0xc066('0xa')],{'host':_0xc066('0xb'),'port':0x18eb});var socket=require(_0xc066('0xc'))(new Redis(config[_0xc066('0xa')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0xc066('0xd')](_0xc066('0xe'));function isEmail(_0x1fe0be){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))*$/[_0xc066('0xf')](_0x1fe0be);}function selectNotIn(_0x576e12,_0x2183d1,_0x12935d,_0x442847,_0x7bbc7){return squel['select']()['field'](_0xc066('0x10'))[_0xc066('0x11')](_0x442847)['join'](_0x2183d1,null,_0x2183d1+_0xc066('0x12')+_0x442847+'.'+_0x12935d)[_0xc066('0x13')](_0x442847+'.'+_0x12935d+_0xc066('0x14')+_0x576e12+'.'+_0x12935d)[_0xc066('0x13')](_0x2183d1+'.dialCheckDuplicateType\x20IN\x20('+_0x7bbc7[_0xc066('0x15')]()+')');}function insertCmHopper(_0x2f07a3,_0x5eb2b8,_0x40c791,_0x4cc7c8,_0x4b31cb){var _0x47f084=[_0xc066('0x16'),_0xc066('0x17'),'cm_contacts.id',_0xc066('0x18'),_0x5eb2b8+'.'+_0x4cc7c8,_0xc066('0x19'),'cm_contacts.updatedAt',_0xc066('0x1a'),_0xc066('0x1b'),'\x22'+_0x4b31cb+'\x22'];return squel['insert']()['into'](_0xc066('0x1c'))[_0xc066('0x1d')](['phone','scheduledat',_0xc066('0x1e'),_0xc066('0x1f'),_0x4cc7c8,_0xc066('0x20'),_0xc066('0x21'),'priority',_0xc066('0x22'),_0xc066('0x23')],squel[_0xc066('0x24')]()['fields'](_0x47f084)[_0xc066('0x11')](_0x5eb2b8)[_0xc066('0x15')](_0xc066('0x25'),null,_0xc066('0x26')+_0x5eb2b8+_0xc066('0x27'))[_0xc066('0x15')](_0x40c791,null,_0x40c791+'.id\x20=\x20'+_0x5eb2b8+'.'+_0x4cc7c8)[_0xc066('0x13')](_0x5eb2b8+_0xc066('0x28'),_0x2f07a3)[_0xc066('0x13')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0xc066('0x13')](_0xc066('0x29'),selectNotIn(_0x5eb2b8,_0x40c791,_0x4cc7c8,'cm_hopper',[_0xc066('0x2a'),_0xc066('0x2b')]))[_0xc066('0x13')](_0xc066('0x29'),selectNotIn(_0x5eb2b8,_0x40c791,_0x4cc7c8,'cm_hopper',[_0xc066('0x2a')])))['toString']();}function insertCmHopperBlack(_0x946277,_0x23e31f,_0x34a6de,_0x2c1cc8){var _0x17b4c5=[_0xc066('0x16'),_0xc066('0x2c'),'cm_contacts.ListId',_0x23e31f+'.'+_0x2c1cc8,'cm_contacts.createdAt',_0xc066('0x2d')];return squel[_0xc066('0x2e')]()[_0xc066('0x2f')](_0xc066('0x30'))[_0xc066('0x1d')]([_0xc066('0x10'),_0xc066('0x1e'),_0xc066('0x1f'),_0x2c1cc8,_0xc066('0x20'),_0xc066('0x21')],squel[_0xc066('0x24')]()['fields'](_0x17b4c5)[_0xc066('0x11')](_0x23e31f)[_0xc066('0x15')]('cm_contacts',null,_0xc066('0x26')+_0x23e31f+_0xc066('0x27'))[_0xc066('0x15')](_0x34a6de,null,_0x34a6de+'.id\x20=\x20'+_0x23e31f+'.'+_0x2c1cc8)['where'](_0x23e31f+_0xc066('0x28'),_0x946277)[_0xc066('0x13')](_0xc066('0x31'),NOW)[_0xc066('0x13')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0xc066('0x24')]()[_0xc066('0x32')](_0xc066('0x10'))['from'](_0xc066('0x30'))[_0xc066('0x13')](_0xc066('0x33'),_0x946277)[_0xc066('0x13')](_0x2c1cc8+_0xc066('0x34'),_0x23e31f+'.'+_0x2c1cc8)))[_0xc066('0x35')]();}function insertCmContact(_0x289d7f,_0x24f0bd,_0x28f5ff,_0x4ba107){var _0x119b15=_[_0xc066('0x36')](_[_0xc066('0x37')](_0x4ba107),['ListId',_0xc066('0x38'),_0xc066('0x20'),_0xc066('0x21')]);return squel[_0xc066('0x2e')]()[_0xc066('0x2f')](_0xc066('0x25'))[_0xc066('0x1d')](_0x119b15,squel['select']()[_0xc066('0x39')](_0x119b15)[_0xc066('0x11')](_0x24f0bd)['where']('('+_0x28f5ff[_0xc066('0x15')](',')+')\x20NOT\x20IN\x20?',squel[_0xc066('0x24')]()['fields'](_0x28f5ff)['from'](_0xc066('0x25'))['where']('ListId\x20=\x20?',_0x289d7f)[_0xc066('0x13')](_0xc066('0x3a')))[_0xc066('0x13')](_0xc066('0x3b'),squel[_0xc066('0x24')]()[_0xc066('0x32')](_0xc066('0x3c'),_0xc066('0x3d'))[_0xc066('0x11')](_0x24f0bd)[_0xc066('0x3e')](_0x28f5ff[_0xc066('0x15')](','))))[_0xc066('0x35')]();}function handleStop(){logger['info'](_0xc066('0x3f'));stopped=!![];}function handleUncaughtException(_0x278a5a){logger[_0xc066('0x40')](_0x278a5a['message']);process[_0xc066('0x41')](0x1);}function handleError(_0x428915,_0xade4d8){stats[_0xc066('0x42')][_0xc066('0x43')]({'name':_0xade4d8[_0xc066('0x44')],'message':_0xade4d8['message'],'row':_0x428915});}function handleQuery(_0x4b384a){logger[_0xc066('0x45')](_0x4b384a);return db[_0xc066('0x46')][_0xc066('0x47')](_0x4b384a)[_0xc066('0x48')](function(_0x3b7e2a){results[_0xc066('0x43')](_0x3b7e2a);})[_0xc066('0x49')](function(_0x114e42){logger[_0xc066('0x40')](_0x114e42[_0xc066('0x4a')]);});}function main(_0x4c96de,_0x2e4096,_0x4179f3,_0x55a8f0){logger['info'](_0xc066('0x4b'),_0x4c96de,JSON[_0xc066('0x4c')](_0x2e4096));process[_0xc066('0x4d')](_0xc066('0x4e'));var _0x36aedc=_0x2e4096['binding'];var _0x58ce78=_0x2e4096[_0xc066('0x4f')];var _0x4011ed=path[_0xc066('0x15')](config[_0xc066('0x50')],_0xc066('0x51'),_0x58ce78+_0xc066('0x52'));var _0x2b4600=_[_0xc066('0x37')](_0x36aedc)[_0xc066('0x15')]();logger['info'](_0xc066('0x53'),_0x2b4600);fs[_0xc066('0x54')](_0x4011ed,_0x2b4600+'\x0a');Papa['parse'](fs[_0xc066('0x55')](_0x4c96de),{'header':!![],'skipEmptyLines':!![],'step':function(_0x5a618f,_0x300e43){try{for(var _0x3d984e=0x0,_0x184c58=[];_0x3d984e<_0x5a618f[_0xc066('0x56')][_0xc066('0x57')];_0x3d984e++){stats[_0xc066('0x58')]+=0x1;if(_0x5a618f[_0xc066('0x42')][_0x3d984e]){handleError(_0x5a618f[_0xc066('0x56')][_0x3d984e],_0x5a618f[_0xc066('0x42')][_0x3d984e]);}else{var _0x5de3b4=[];for(var _0x1925a1 in _0x36aedc){if(_0x36aedc[_0xc066('0x59')](_0x1925a1)){if(_0x5a618f[_0xc066('0x56')][_0x3d984e][_0x36aedc[_0x1925a1]]){var _0x313351=_['trim'](_0x5a618f['data'][_0x3d984e][_0x36aedc[_0x1925a1]][_0xc066('0x5a')](/"/g,'\x27'));switch(_0x1925a1){case _0xc066('0x5b'):var _0x3fecfa=moment(_0x313351,_0xc066('0xe'),!![]);if(_0x3fecfa[_0xc066('0x5c')]()){_0x184c58['push']('\x22'+_0x313351+'\x22');}else{_0x5de3b4['push'](_0xc066('0x5d'));}break;case _0xc066('0x5e'):var _0x3fd6c0=parseInt(_0x313351);_0x313351=_[_0xc066('0x5f')](_0x3fd6c0)||_0x3fd6c0<0x0||_0x3fd6c0>0x4?_0x55a8f0?0x3:0x2:_0x3fd6c0;_0x184c58[_0xc066('0x43')]('\x22'+_0x313351+'\x22');break;case _0xc066('0x22'):var _0x50ff96=parseInt(_0x313351);if(_['isNumber'](_0x50ff96)&&_[_0xc066('0x60')](_0x4179f3,_0x50ff96)){_0x184c58[_0xc066('0x43')]('\x22'+_0x50ff96+'\x22');}else{_0x5de3b4['push']('agent\x20not\x20exists');}break;case _0xc066('0x61'):if(isEmail(_0x313351)){_0x184c58[_0xc066('0x43')]('\x22'+_0x313351+'\x22');}else{_0x5de3b4[_0xc066('0x43')](_0xc066('0x62'));}break;case _0xc066('0x63'):var _0x5b2591=moment(_0x313351,_0xc066('0x64'),!![]);if(_0x5b2591[_0xc066('0x5c')]()){_0x184c58[_0xc066('0x43')]('\x22'+_0x313351+'\x22');}else{_0x5de3b4[_0xc066('0x43')](_0xc066('0x65'));}break;default:_0x184c58[_0xc066('0x43')]('\x22'+_0x313351+'\x22');}}else{switch(_0x1925a1){case _0xc066('0x66'):case _0xc066('0x10'):_0x5de3b4[_0xc066('0x43')](_0x1925a1+'\x20not\x20specified');break;default:_0x184c58['push']('\x22\x22');}}}}if(_0x5de3b4[_0xc066('0x57')]){handleError(_0x5a618f[_0xc066('0x56')][_0x3d984e],{'code':_0xc066('0x67'),'message':_0x5de3b4[_0xc066('0x15')]()});}else{fs[_0xc066('0x68')](_0x4011ed,_0x184c58[_0xc066('0x15')]()+'\x0a');}_0x184c58=[];}if(!(stats['rows']%0xc8)){socket[_0xc066('0x69')](_0xc066('0x6a')+_0x58ce78,stats);stats[_0xc066('0x42')]=[];}}if(stopped){logger['info'](_0xc066('0x6b'));_0x300e43[_0xc066('0x6c')]();}}catch(_0x914084){handleError(_0x5a618f[_0xc066('0x56')][_0x3d984e],{'code':_0xc066('0x6d'),'message':_0x914084[_0xc066('0x4a')]});logger[_0xc066('0x40')](_0xc066('0x6e'),_0x914084[_0xc066('0x4a')]);}},'complete':function(){try{var _0x48bd5a=[];var _0x2da156='cm_contacts';if(_0x2e4096['duplicates']&&_0x2e4096[_0xc066('0x6f')][_0xc066('0x57')]){_0x2da156=_0xc066('0x70')+_0x58ce78;_0x48bd5a['push'](_0xc066('0x71')+_0x2da156+_0xc066('0x72'));}var _0x39a020=util[_0xc066('0xd')](_0xc066('0x73'),_0x4011ed,_0x2da156,_0x2b4600,_0x2e4096[_0xc066('0x1f')],_0x2e4096[_0xc066('0x38')]||null,NOW,NOW);if(_[_0xc066('0x74')](_0x36aedc[_0xc066('0x5b')])){_0x39a020+=_0xc066('0x75');}_0x48bd5a['push'](_0x39a020);if(_0x2e4096[_0xc066('0x6f')]&&_0x2e4096[_0xc066('0x6f')][_0xc066('0x57')]){_0x48bd5a[_0xc066('0x43')](insertCmContact(_0x2e4096['ListId'],_0x2da156,_0x2e4096[_0xc066('0x6f')],_0x36aedc));_0x48bd5a[_0xc066('0x43')](_0xc066('0x76')+_0x2da156+';');}_0x48bd5a[_0xc066('0x43')](insertCmHopper(_0x2e4096[_0xc066('0x1f')],_0xc066('0x77'),_0xc066('0x78'),_0xc066('0x79'),_0x55a8f0));_0x48bd5a[_0xc066('0x43')](insertCmHopperBlack(_0x2e4096[_0xc066('0x1f')],_0xc066('0x7a'),_0xc066('0x78'),_0xc066('0x79')));_0x48bd5a[_0xc066('0x43')](insertCmHopper(_0x2e4096['ListId'],_0xc066('0x7b'),_0xc066('0x7c'),_0xc066('0x7d'),_0x55a8f0));_0x48bd5a[_0xc066('0x43')](insertCmHopperBlack(_0x2e4096[_0xc066('0x1f')],'campaigns_has_cm_blacklists','campaigns','CampaignId'));BPromise[_0xc066('0x7e')](_0x48bd5a,handleQuery)['then'](function(_0xce2411){stats[_0xc066('0x7f')]=!![];stats[_0xc066('0x80')]=_0x2e4096['duplicates']&&_0x2e4096[_0xc066('0x6f')][_0xc066('0x57')]?results[0x2][_0xc066('0x80')]:results[0x0]['affectedRows'];socket['emit'](_0xc066('0x6a')+_0x58ce78,stats);fs[_0xc066('0x81')](_0x4c96de);fs[_0xc066('0x81')](_0x4011ed);process['exit'](0x0);})['catch'](function(_0x17eb5b){logger[_0xc066('0x40')](_0x17eb5b[_0xc066('0x4a')]);process[_0xc066('0x41')](0x1);});}catch(_0x5627d2){logger[_0xc066('0x40')](_0xc066('0x82'),_0x5627d2[_0xc066('0x4a')]);process['exit'](0x1);}},'error':function(_0x242546,_0x5ccc42,_0x587183,_0x43de59){throw new Error(_0x43de59);}});}function validate(){if(process[_0xc066('0x83')]&&process[_0xc066('0x83')][_0xc066('0x57')]<0x4){throw new Error(_0xc066('0x84'));}var _0x9162b3=path[_0xc066('0x15')](config['root'],_0xc066('0x51'),process[_0xc066('0x83')][0x2]);if(!fs['existsSync'](_0x9162b3)){throw new Error(_0xc066('0x85'));}var _0x86a488={};try{_0x86a488=JSON[_0xc066('0x86')](process[_0xc066('0x83')][0x3]);if(!_0x86a488[_0xc066('0x87')]){throw new Error(_0xc066('0x88'));}if(!_0x86a488[_0xc066('0x87')][_0xc066('0x10')]){throw new Error('phone\x20is\x20mandatory');}if(!_0x86a488[_0xc066('0x87')]['firstName']){throw new Error('firstName\x20is\x20mandatory');}var _0x36821a=0x0;if(_0x86a488[_0xc066('0x87')][_0xc066('0x22')]){_0x36821a=0x1;}if(!_0x86a488[_0xc066('0x1f')]){throw new Error('ListId\x20is\x20mandatory');}}catch(_0x4d9ee4){throw new Error(_0xc066('0x89'));}var _0x428e7c=[];try{_0x428e7c=_[_0xc066('0x8a')](JSON[_0xc066('0x86')](process['argv'][0x4]),'id');}catch(_0x459e65){logger['info']('No\x20agent\x20available');}main(_0x9162b3,_0x86a488,_0x428e7c,_0x36821a);}validate();process['on'](_0xc066('0x8b'),handleStop);process['on'](_0xc066('0x8c'),handleUncaughtException); \ No newline at end of file diff --git a/server/components/integrations/configuration.js b/server/components/integrations/configuration.js index c4a26f8..855b9b4 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 _0x9d9b=['Agent\x20Complete','agentcompleteAt','Hold\x20Time','holdtime','Talk\x20Time','***\x20Call\x20Info\x20***','Called\x20Number','destcalleridnum','Member\x20Name','membername','UniqueId','uniqueid','Answer\x20Time','answertime','Complete\x20Time','endtime','duration','Billable\x20Time','billableseconds','string','toLowerCase','voice','push','queue','calleridnum','outbound','Outbound\x20Call','variable','inbound','keyValue','Caller\x20Name','calleridname','Call\x20To','Queue','Date','agentcalledAt','***\x20Agent\x20Info\x20***','destcalleridname','Agent\x20Number','***\x20Time\x20Info\x20***','Agent\x20Ring','Agent\x20Connect'];(function(_0x490cd3,_0x97d5ee){var _0x3320d7=function(_0x2ad809){while(--_0x2ad809){_0x490cd3['push'](_0x490cd3['shift']());}};_0x3320d7(++_0x97d5ee);}(_0x9d9b,0x1e1));var _0xb9d9=function(_0x136d50,_0x21064c){_0x136d50=_0x136d50-0x0;var _0x238168=_0x9d9b[_0x136d50];return _0x238168;};'use strict';exports['getSubjects']=function(_0x20c6e4,_0x2c6a23){var _0x4b916e=[{'type':_0xb9d9('0x0'),'content':'[xCALLY\x20Ticket]','variableName':null}];switch(_0x20c6e4[_0xb9d9('0x1')]()){case _0xb9d9('0x2'):switch(_0x2c6a23[_0xb9d9('0x1')]()){case'inbound':_0x4b916e[_0xb9d9('0x3')]({'type':'variable','content':'','variableName':_0xb9d9('0x4')});_0x4b916e[_0xb9d9('0x3')]({'type':'variable','content':'','variableName':_0xb9d9('0x5')});break;case _0xb9d9('0x6'):_0x4b916e[_0xb9d9('0x3')]({'type':_0xb9d9('0x0'),'content':_0xb9d9('0x7'),'variableName':null});_0x4b916e[_0xb9d9('0x3')]({'type':_0xb9d9('0x8'),'content':'','variableName':'destcalleridnum'});break;}}return _0x4b916e;};exports['getDescriptions']=function(_0x5f14e7,_0x4cde40){var _0x45f507=[];switch(_0x5f14e7[_0xb9d9('0x1')]()){case _0xb9d9('0x2'):switch(_0x4cde40['toLowerCase']()){case _0xb9d9('0x9'):_0x45f507=[{'type':_0xb9d9('0x0'),'content':'***\x20Call\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0xb9d9('0xa'),'content':'','key':'Caller\x20Number','keyType':_0xb9d9('0x8'),'variableName':_0xb9d9('0x5')},{'type':_0xb9d9('0xa'),'content':'','key':_0xb9d9('0xb'),'keyType':_0xb9d9('0x8'),'variableName':_0xb9d9('0xc')},{'type':_0xb9d9('0xa'),'content':'','key':_0xb9d9('0xd'),'keyType':'variable','variableName':'destexten'},{'type':_0xb9d9('0xa'),'content':'','key':_0xb9d9('0xe'),'keyType':_0xb9d9('0x8'),'variableName':_0xb9d9('0x4')},{'type':'keyValue','content':'','key':'UniqueId','keyType':_0xb9d9('0x8'),'variableName':'uniqueid'},{'type':'keyValue','content':'','key':_0xb9d9('0xf'),'keyType':_0xb9d9('0x8'),'variableName':_0xb9d9('0x10')},{'type':'string','content':_0xb9d9('0x11'),'key':null,'keyType':null,'variableName':null},{'type':_0xb9d9('0xa'),'content':'','key':'Agent\x20Name','keyType':_0xb9d9('0x8'),'variableName':_0xb9d9('0x12')},{'type':'keyValue','content':'','key':_0xb9d9('0x13'),'keyType':_0xb9d9('0x8'),'variableName':'destcalleridnum'},{'type':_0xb9d9('0x0'),'content':_0xb9d9('0x14'),'key':null,'keyType':null,'variableName':null},{'type':_0xb9d9('0xa'),'content':'','key':_0xb9d9('0x15'),'keyType':_0xb9d9('0x8'),'variableName':_0xb9d9('0x10')},{'type':'keyValue','content':'','key':_0xb9d9('0x16'),'keyType':_0xb9d9('0x8'),'variableName':'agentconnectAt'},{'type':_0xb9d9('0xa'),'content':'','key':_0xb9d9('0x17'),'keyType':_0xb9d9('0x8'),'variableName':_0xb9d9('0x18')},{'type':'keyValue','content':'','key':_0xb9d9('0x19'),'keyType':_0xb9d9('0x8'),'variableName':_0xb9d9('0x1a')},{'type':_0xb9d9('0xa'),'content':'','key':_0xb9d9('0x1b'),'keyType':_0xb9d9('0x8'),'variableName':'talktime'}];break;case _0xb9d9('0x6'):_0x45f507=[{'type':_0xb9d9('0x0'),'content':_0xb9d9('0x1c'),'variableName':null},{'type':'keyValue','content':'','key':_0xb9d9('0x1d'),'keyType':_0xb9d9('0x8'),'keyContent':'','variableName':_0xb9d9('0x1e')},{'type':_0xb9d9('0xa'),'content':'','key':_0xb9d9('0x1f'),'keyType':_0xb9d9('0x8'),'keyContent':'','variableName':_0xb9d9('0x20')},{'type':'keyValue','content':'','key':_0xb9d9('0x21'),'keyType':_0xb9d9('0x8'),'keyContent':'','variableName':_0xb9d9('0x22')},{'type':_0xb9d9('0xa'),'content':'','key':_0xb9d9('0xf'),'keyType':_0xb9d9('0x8'),'keyContent':'','variableName':'starttime'},{'type':_0xb9d9('0x0'),'content':_0xb9d9('0x14')},{'type':_0xb9d9('0xa'),'content':'','key':_0xb9d9('0x23'),'keyType':'variable','keyContent':'','variableName':_0xb9d9('0x24')},{'type':_0xb9d9('0xa'),'content':'','key':_0xb9d9('0x25'),'keyType':_0xb9d9('0x8'),'keyContent':'','variableName':_0xb9d9('0x26')},{'type':_0xb9d9('0xa'),'content':'','key':'Duration','keyType':'variable','keyContent':'','variableName':_0xb9d9('0x27')},{'type':'keyValue','content':'','key':_0xb9d9('0x28'),'keyType':_0xb9d9('0x8'),'keyContent':'','variableName':_0xb9d9('0x29')}];break;}}return _0x45f507;}; \ No newline at end of file +var _0xb98e=['Call\x20To','destexten','Queue','UniqueId','uniqueid','Date','agentcalledAt','***\x20Agent\x20Info\x20***','Agent\x20Name','destcalleridname','Agent\x20Ring','agentconnectAt','Agent\x20Complete','agentcompleteAt','Hold\x20Time','holdtime','talktime','Called\x20Number','Member\x20Name','starttime','***\x20Time\x20Info\x20***','answertime','Complete\x20Time','endtime','Duration','duration','Billable\x20Time','billableseconds','getSubjects','string','[xCALLY\x20Ticket]','toLowerCase','inbound','push','queue','variable','outbound','Outbound\x20Call','destcalleridnum','getDescriptions','voice','***\x20Call\x20Info\x20***','keyValue','Caller\x20Number','Caller\x20Name'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb98e,0x184));var _0xeb98=function(_0x5ebc4d,_0x15e411){_0x5ebc4d=_0x5ebc4d-0x0;var _0x527216=_0xb98e[_0x5ebc4d];return _0x527216;};'use strict';exports[_0xeb98('0x0')]=function(_0x1277de,_0x5c2145){var _0x4f5422=[{'type':_0xeb98('0x1'),'content':_0xeb98('0x2'),'variableName':null}];switch(_0x1277de[_0xeb98('0x3')]()){case'voice':switch(_0x5c2145[_0xeb98('0x3')]()){case _0xeb98('0x4'):_0x4f5422[_0xeb98('0x5')]({'type':'variable','content':'','variableName':_0xeb98('0x6')});_0x4f5422['push']({'type':_0xeb98('0x7'),'content':'','variableName':'calleridnum'});break;case _0xeb98('0x8'):_0x4f5422[_0xeb98('0x5')]({'type':_0xeb98('0x1'),'content':_0xeb98('0x9'),'variableName':null});_0x4f5422[_0xeb98('0x5')]({'type':_0xeb98('0x7'),'content':'','variableName':_0xeb98('0xa')});break;}}return _0x4f5422;};exports[_0xeb98('0xb')]=function(_0x5ccd7f,_0x28483){var _0x8b537e=[];switch(_0x5ccd7f[_0xeb98('0x3')]()){case _0xeb98('0xc'):switch(_0x28483[_0xeb98('0x3')]()){case _0xeb98('0x4'):_0x8b537e=[{'type':_0xeb98('0x1'),'content':_0xeb98('0xd'),'key':null,'keyType':null,'variableName':null},{'type':_0xeb98('0xe'),'content':'','key':_0xeb98('0xf'),'keyType':_0xeb98('0x7'),'variableName':'calleridnum'},{'type':_0xeb98('0xe'),'content':'','key':_0xeb98('0x10'),'keyType':'variable','variableName':'calleridname'},{'type':_0xeb98('0xe'),'content':'','key':_0xeb98('0x11'),'keyType':_0xeb98('0x7'),'variableName':_0xeb98('0x12')},{'type':_0xeb98('0xe'),'content':'','key':_0xeb98('0x13'),'keyType':_0xeb98('0x7'),'variableName':_0xeb98('0x6')},{'type':_0xeb98('0xe'),'content':'','key':_0xeb98('0x14'),'keyType':_0xeb98('0x7'),'variableName':_0xeb98('0x15')},{'type':_0xeb98('0xe'),'content':'','key':_0xeb98('0x16'),'keyType':_0xeb98('0x7'),'variableName':_0xeb98('0x17')},{'type':_0xeb98('0x1'),'content':_0xeb98('0x18'),'key':null,'keyType':null,'variableName':null},{'type':_0xeb98('0xe'),'content':'','key':_0xeb98('0x19'),'keyType':'variable','variableName':_0xeb98('0x1a')},{'type':_0xeb98('0xe'),'content':'','key':'Agent\x20Number','keyType':'variable','variableName':_0xeb98('0xa')},{'type':_0xeb98('0x1'),'content':'***\x20Time\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0xeb98('0x1b'),'keyType':'variable','variableName':_0xeb98('0x17')},{'type':_0xeb98('0xe'),'content':'','key':'Agent\x20Connect','keyType':_0xeb98('0x7'),'variableName':_0xeb98('0x1c')},{'type':_0xeb98('0xe'),'content':'','key':_0xeb98('0x1d'),'keyType':_0xeb98('0x7'),'variableName':_0xeb98('0x1e')},{'type':_0xeb98('0xe'),'content':'','key':_0xeb98('0x1f'),'keyType':_0xeb98('0x7'),'variableName':_0xeb98('0x20')},{'type':_0xeb98('0xe'),'content':'','key':'Talk\x20Time','keyType':_0xeb98('0x7'),'variableName':_0xeb98('0x21')}];break;case _0xeb98('0x8'):_0x8b537e=[{'type':_0xeb98('0x1'),'content':_0xeb98('0xd'),'variableName':null},{'type':_0xeb98('0xe'),'content':'','key':_0xeb98('0x22'),'keyType':_0xeb98('0x7'),'keyContent':'','variableName':_0xeb98('0xa')},{'type':_0xeb98('0xe'),'content':'','key':_0xeb98('0x23'),'keyType':_0xeb98('0x7'),'keyContent':'','variableName':'membername'},{'type':_0xeb98('0xe'),'content':'','key':_0xeb98('0x14'),'keyType':_0xeb98('0x7'),'keyContent':'','variableName':_0xeb98('0x15')},{'type':'keyValue','content':'','key':_0xeb98('0x16'),'keyType':_0xeb98('0x7'),'keyContent':'','variableName':_0xeb98('0x24')},{'type':_0xeb98('0x1'),'content':_0xeb98('0x25')},{'type':_0xeb98('0xe'),'content':'','key':'Answer\x20Time','keyType':'variable','keyContent':'','variableName':_0xeb98('0x26')},{'type':_0xeb98('0xe'),'content':'','key':_0xeb98('0x27'),'keyType':_0xeb98('0x7'),'keyContent':'','variableName':_0xeb98('0x28')},{'type':_0xeb98('0xe'),'content':'','key':_0xeb98('0x29'),'keyType':_0xeb98('0x7'),'keyContent':'','variableName':_0xeb98('0x2a')},{'type':_0xeb98('0xe'),'content':'','key':_0xeb98('0x2b'),'keyType':_0xeb98('0x7'),'keyContent':'','variableName':_0xeb98('0x2c')}];break;}}return _0x8b537e;}; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index 8867832..39414a4 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 _0xc999=['unknown','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','role','update','error','tracked','clone','body','omit','html','phone','mobile','../../mysqldb','../../config/logger','openchannel-interactions','whatsapp-interactions','upperFirst','InteractionId'];(function(_0x382e89,_0x4768c0){var _0x3a1318=function(_0x79e1ce){while(--_0x79e1ce){_0x382e89['push'](_0x382e89['shift']());}};_0x3a1318(++_0x4768c0);}(_0xc999,0x176));var _0x9c99=function(_0x40d8d7,_0x30dd5e){_0x40d8d7=_0x40d8d7-0x0;var _0x3454cc=_0xc999[_0x40d8d7];return _0x3454cc;};'use strict';var _=require('lodash');var db=require(_0x9c99('0x0'))['db'];var loggers={'openchannel':require(_0x9c99('0x1'))(_0x9c99('0x2')),'mail':require('../../config/logger')('mail-interactions'),'fax':require('../../config/logger')('fax-interactions'),'sms':require(_0x9c99('0x1'))('sms-interactions'),'chat':require(_0x9c99('0x1'))('chat-interactions'),'whatsapp':require(_0x9c99('0x1'))(_0x9c99('0x3'))};function getInteractionId(_0xe80252,_0x47bfaa,_0xfa25e1){if(_0xe80252&&_0xe80252[_[_0x9c99('0x4')](_0xfa25e1)+_0x9c99('0x5')]){return _0xe80252[_[_0x9c99('0x4')](_0xfa25e1)+_0x9c99('0x5')];}else if(_0xe80252&&_0xe80252['id']){return _0xe80252['id'];}else if(_0x47bfaa&&_0x47bfaa['id']){return _0x47bfaa['id'];}else{return _0x9c99('0x6');}}function log(_0x5ce73c,_0x9406a,_0x18e677,_0x1e34b5,_0x13f33b,_0x560631){loggers[_0x13f33b[_0x9c99('0x7')]()][_0x5ce73c](_0x9c99('0x8'),_0x560631[_0x9c99('0x9')](),_0x9406a?_0x9406a['id']:null,_0x9406a?_0x9406a['name']:null,_0x9406a?_0x9406a[_0x9c99('0xa')]:null,getInteractionId(_0x18e677,_0x1e34b5,_0x13f33b),_0x18e677?JSON['stringify'](_0x18e677):'null');}function updateUser(_0x2185bb,_0x2e754b,_0x2d4c9a,_0x2bb18a,_0x50f62c){db[_[_0x9c99('0x4')](_0x2bb18a)+'Interaction']['findOne']({'where':{'id':getInteractionId(_0x2e754b,_0x2d4c9a,_0x2bb18a)}})['then'](function(_0xedd35){if(_0xedd35){return _0xedd35[_0x9c99('0xb')]({'UserId':_0x2185bb?_0x2185bb['id']:null});}})['then'](function(_0x27425b){if(_0x27425b){log('info',_0x2185bb,_0x2e754b,_0x2d4c9a,_0x2bb18a,_0x50f62c);}})['catch'](function(){log(_0x9c99('0xc'),_0x2185bb,_0x2e754b,_0x2d4c9a,_0x2bb18a,_0x50f62c);});}exports[_0x9c99('0xd')]=function(_0x5c0023,_0x34a89d){return function(_0x436e43,_0x5eaa11,_0x1a6f0e){var _0x1cc5ea=_0x436e43['user'];var _0x5da292={};var _0x5408b4=_0x436e43['query'];if(_0x5da292){_0x5da292=_[_0x9c99('0xe')](_0x436e43[_0x9c99('0xf')]);_0x5da292=_[_0x9c99('0x10')](_0x5da292,[_0x9c99('0xf'),_0x9c99('0x11'),_0x9c99('0x12'),'fax',_0x9c99('0x13')]);}updateUser(_0x1cc5ea,_0x5da292,_0x5408b4,_0x5c0023,_0x34a89d);_0x1a6f0e(null);};}; \ No newline at end of file +var _0x54a1=['openchannel-interactions','fax-interactions','sms-interactions','chat-interactions','InteractionId','upperFirst','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','null','Interaction','findOne','then','update','info','error','tracked','user','query','body','omit','html','phone','fax','lodash','../../config/logger'];(function(_0x12a2a6,_0x374ff1){var _0x1754ae=function(_0x49d787){while(--_0x49d787){_0x12a2a6['push'](_0x12a2a6['shift']());}};_0x1754ae(++_0x374ff1);}(_0x54a1,0xf1));var _0x154a=function(_0xb24a3e,_0x4a3594){_0xb24a3e=_0xb24a3e-0x0;var _0x4038d7=_0x54a1[_0xb24a3e];return _0x4038d7;};'use strict';var _=require(_0x154a('0x0'));var db=require('../../mysqldb')['db'];var loggers={'openchannel':require(_0x154a('0x1'))(_0x154a('0x2')),'mail':require('../../config/logger')('mail-interactions'),'fax':require('../../config/logger')(_0x154a('0x3')),'sms':require('../../config/logger')(_0x154a('0x4')),'chat':require('../../config/logger')(_0x154a('0x5')),'whatsapp':require(_0x154a('0x1'))('whatsapp-interactions')};function getInteractionId(_0x311183,_0x465407,_0x139865){if(_0x311183&&_0x311183[_['upperFirst'](_0x139865)+_0x154a('0x6')]){return _0x311183[_[_0x154a('0x7')](_0x139865)+'InteractionId'];}else if(_0x311183&&_0x311183['id']){return _0x311183['id'];}else if(_0x465407&&_0x465407['id']){return _0x465407['id'];}else{return'unknown';}}function log(_0x2c155b,_0x4a7783,_0x296f4a,_0x4e8720,_0x2a8a93,_0xe878ad){loggers[_0x2a8a93[_0x154a('0x8')]()][_0x2c155b](_0x154a('0x9'),_0xe878ad['toUpperCase'](),_0x4a7783?_0x4a7783['id']:null,_0x4a7783?_0x4a7783['name']:null,_0x4a7783?_0x4a7783[_0x154a('0xa')]:null,getInteractionId(_0x296f4a,_0x4e8720,_0x2a8a93),_0x296f4a?JSON[_0x154a('0xb')](_0x296f4a):_0x154a('0xc'));}function updateUser(_0x5e75ce,_0xd5127c,_0x363028,_0x152075,_0x50f8e2){db[_[_0x154a('0x7')](_0x152075)+_0x154a('0xd')][_0x154a('0xe')]({'where':{'id':getInteractionId(_0xd5127c,_0x363028,_0x152075)}})[_0x154a('0xf')](function(_0x478f11){if(_0x478f11){return _0x478f11[_0x154a('0x10')]({'UserId':_0x5e75ce?_0x5e75ce['id']:null});}})[_0x154a('0xf')](function(_0x1c567e){if(_0x1c567e){log(_0x154a('0x11'),_0x5e75ce,_0xd5127c,_0x363028,_0x152075,_0x50f8e2);}})['catch'](function(){log(_0x154a('0x12'),_0x5e75ce,_0xd5127c,_0x363028,_0x152075,_0x50f8e2);});}exports[_0x154a('0x13')]=function(_0x99de63,_0x2a9bfe){return function(_0x2c5830,_0xb19354,_0xd3ecce){var _0x251b83=_0x2c5830[_0x154a('0x14')];var _0x5967bc={};var _0x4d237b=_0x2c5830[_0x154a('0x15')];if(_0x5967bc){_0x5967bc=_['clone'](_0x2c5830[_0x154a('0x16')]);_0x5967bc=_[_0x154a('0x17')](_0x5967bc,[_0x154a('0x16'),_0x154a('0x18'),_0x154a('0x19'),_0x154a('0x1a'),'mobile']);}updateUser(_0x251b83,_0x5967bc,_0x4d237b,_0x99de63,_0x2a9bfe);_0xd3ecce(null);};}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index 3043ae5..641d3a5 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 _0x38c1=['crypto','util','../../mysqldb','../../config/environment','data1','license','split','createDecipher','aes-256-ctr','format','%s:%s:%s','update','base64','utf8','final','parse','use','License','then','count','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','admin','isUserLimit'];(function(_0x820452,_0x4eda58){var _0x2b9a98=function(_0x450784){while(--_0x450784){_0x820452['push'](_0x820452['shift']());}};_0x2b9a98(++_0x4eda58);}(_0x38c1,0x87));var _0x138c=function(_0x4fc435,_0x45eddf){_0x4fc435=_0x4fc435-0x0;var _0x3c5db1=_0x38c1[_0x4fc435];return _0x3c5db1;};'use strict';var crypto=require(_0x138c('0x0'));var util=require(_0x138c('0x1'));var compose=require('composable-middleware');var db=require(_0x138c('0x2'))['db'];var config=require(_0x138c('0x3'));function getValueFromLicense(_0x45e510,_0x436115){if(_0x45e510&&_0x436115){if(_0x436115[_0x138c('0x4')]&&_0x436115[_0x138c('0x5')]){var _0x5973eb=_0x436115['data1'];var _0x4d2104=_0x436115['license'];var _0x5e68d0=_0x5973eb[_0x138c('0x6')]('-')[0x4];var _0x1bf2c9=_0x5973eb[_0x138c('0x6')]('-')[0x0];var _0x717d00=crypto[_0x138c('0x7')](_0x138c('0x8'),util[_0x138c('0x9')](_0x138c('0xa'),_0x5e68d0,_0x5973eb,_0x1bf2c9));var _0x312a8a=_0x717d00[_0x138c('0xb')](_0x4d2104,_0x138c('0xc'),_0x138c('0xd'));_0x312a8a+=_0x717d00[_0x138c('0xe')](_0x138c('0xd'));var _0x15614a=JSON[_0x138c('0xf')](_0x312a8a);return _0x15614a['hasOwnProperty'](_0x45e510)?_0x15614a[_0x45e510]:null;}}return null;}function isLimit(_0x3cc720,_0x5bda6a,_0x5bc04c,_0x6247f5){var _0x13bb49=_0x5bda6a;return compose()[_0x138c('0x10')](function(_0xd42a02,_0x1b9733,_0x23c65a){return db[_0x138c('0x11')]['findOne']({'where':{'id':0x1},'raw':!![]})['then'](function(_0x32e21d){var _0x2ae1b3=getValueFromLicense(_0x3cc720,_0x32e21d);return _0x2ae1b3?_0x2ae1b3:_0x13bb49;})[_0x138c('0x12')](function(_0x3629c4){_0x13bb49=_0x3629c4;return _0x5bc04c[_0x138c('0x13')](_0x6247f5);})['then'](function(_0x4b49d8){if(_0x4b49d8>=_0x13bb49){return _0x1b9733[_0x138c('0x14')](0x193)[_0x138c('0x15')]({'message':util['format'](_0x138c('0x16'),_0x3cc720)});}_0x23c65a();})[_0x138c('0x17')](function(_0x2029a7){_0x23c65a(_0x2029a7);});});}function isUserLimit(){return isLimit(_0x138c('0x18'),0x1,db['User'],{'where':{'$or':[{'role':_0x138c('0x19')},{'role':'user'}]}});}exports[_0x138c('0x1a')]=isUserLimit; \ No newline at end of file +var _0x819b=['utf8','final','parse','hasOwnProperty','use','License','findOne','then','count','status','json','catch','users','User','admin','composable-middleware','../../mysqldb','data1','license','split','createDecipher','format','%s:%s:%s','update','base64'];(function(_0x904b24,_0x264ca0){var _0x3cd8d4=function(_0x3d7629){while(--_0x3d7629){_0x904b24['push'](_0x904b24['shift']());}};_0x3cd8d4(++_0x264ca0);}(_0x819b,0x109));var _0xb819=function(_0x2d3083,_0x41fd64){_0x2d3083=_0x2d3083-0x0;var _0x5700b1=_0x819b[_0x2d3083];return _0x5700b1;};'use strict';var crypto=require('crypto');var util=require('util');var compose=require(_0xb819('0x0'));var db=require(_0xb819('0x1'))['db'];var config=require('../../config/environment');function getValueFromLicense(_0xf1fe6c,_0x4e2c68){if(_0xf1fe6c&&_0x4e2c68){if(_0x4e2c68[_0xb819('0x2')]&&_0x4e2c68[_0xb819('0x3')]){var _0x2e66d3=_0x4e2c68['data1'];var _0xfa358c=_0x4e2c68[_0xb819('0x3')];var _0x248546=_0x2e66d3['split']('-')[0x4];var _0x44acb8=_0x2e66d3[_0xb819('0x4')]('-')[0x0];var _0x2c5c3c=crypto[_0xb819('0x5')]('aes-256-ctr',util[_0xb819('0x6')](_0xb819('0x7'),_0x248546,_0x2e66d3,_0x44acb8));var _0x364774=_0x2c5c3c[_0xb819('0x8')](_0xfa358c,_0xb819('0x9'),_0xb819('0xa'));_0x364774+=_0x2c5c3c[_0xb819('0xb')]('utf8');var _0x574b13=JSON[_0xb819('0xc')](_0x364774);return _0x574b13[_0xb819('0xd')](_0xf1fe6c)?_0x574b13[_0xf1fe6c]:null;}}return null;}function isLimit(_0xe91d5c,_0xfa728c,_0x3493de,_0x31d3a4){var _0x14d3e6=_0xfa728c;return compose()[_0xb819('0xe')](function(_0x575890,_0xaa9def,_0x102bc4){return db[_0xb819('0xf')][_0xb819('0x10')]({'where':{'id':0x1},'raw':!![]})[_0xb819('0x11')](function(_0x5e5fd6){var _0x5a428a=getValueFromLicense(_0xe91d5c,_0x5e5fd6);return _0x5a428a?_0x5a428a:_0x14d3e6;})['then'](function(_0x46493e){_0x14d3e6=_0x46493e;return _0x3493de[_0xb819('0x12')](_0x31d3a4);})['then'](function(_0x538c8c){if(_0x538c8c>=_0x14d3e6){return _0xaa9def[_0xb819('0x13')](0x193)[_0xb819('0x14')]({'message':util[_0xb819('0x6')]('Maximum\x20%s\x20limit\x20have\x20been\x20reached',_0xe91d5c)});}_0x102bc4();})[_0xb819('0x15')](function(_0x538a32){_0x102bc4(_0x538a32);});});}function isUserLimit(){return isLimit(_0xb819('0x16'),0x1,db[_0xb819('0x17')],{'where':{'$or':[{'role':_0xb819('0x18')},{'role':'user'}]}});}exports['isUserLimit']=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 634e09e..0a7bcf3 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 _0x50a9=['lodash','moment','parseSearch','sqlOperator','startsWith','replace','[$and]','split','slice','forEach','match','indexOf','map','conditions','push','buildExpression','DATE','operator','$eq','value','includes','$gt','$lte','add','days','format','YYYY-MM-DD','castTo','text','CAST(','field','\x20AS\x20','$ne','\x20IS\x20NULL)','$in','IN\x20?','$notIn','NOT\x20IN\x20?','<>\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','$lt','>\x20?','$gte','>=\x20?','$between','start','shift','pop','utcOffset','hours','minutes'];(function(_0x5427c8,_0x18f384){var _0x33a129=function(_0x1940e8){while(--_0x1940e8){_0x5427c8['push'](_0x5427c8['shift']());}};_0x33a129(++_0x18f384);}(_0x50a9,0xd8));var _0x950a=function(_0x18bcc8,_0x4b1f58){_0x18bcc8=_0x18bcc8-0x0;var _0x45877f=_0x50a9[_0x18bcc8];return _0x45877f;};'use strict';var _=require(_0x950a('0x0'));var moment=require(_0x950a('0x1'));exports[_0x950a('0x2')]=function(_0x5633cc){var _0x3116df={'conditions':[]};_0x3116df[_0x950a('0x3')]=_[_0x950a('0x4')](_0x5633cc,'[$or]')?'or':'and';var _0x272fa9=_0x5633cc[_0x950a('0x5')](_0x950a('0x6'),'')[_0x950a('0x5')]('[$or]','')[_0x950a('0x7')]('||');for(var _0x596577=0x0;_0x596577<_0x272fa9['length'];_0x596577++){var _0x23c175=_0x272fa9[_0x596577][_0x950a('0x7')](':=');var _0x5edaec=_0x23c175[0x0];var _0x21385a=_0x23c175[_0x950a('0x8')](0x1);_0x21385a[_0x950a('0x9')](function(_0x1ce4a6){var _0x3404f3=_0x1ce4a6[_0x950a('0x7')]('[')['shift']();var _0x380aa4=_0x1ce4a6[_0x950a('0xa')](/\[(.*?)\]/g);_0x380aa4[_0x950a('0x9')](function(_0x23ac36){var _0x3336f1=_0x23ac36[_0x950a('0x7')]('[')['filter'](function(_0x5a5e15){return _0x5a5e15[_0x950a('0xb')](']')>-0x1;})[_0x950a('0xc')](function(_0x462fc7){return _0x462fc7[_0x950a('0x7')](']')[0x0];})[0x0];_0x3116df[_0x950a('0xd')][_0x950a('0xe')]({'field':_0x5edaec,'operator':_0x3404f3,'value':_0x3336f1});});});}return _0x3116df;};exports[_0x950a('0xf')]=function(_0xce432e,_0xbab46a,_0x5a2911){var _0x4cb783={};if(_0xbab46a===_0x950a('0x10')){if(_0x5a2911[_0x950a('0x11')]===_0x950a('0x12')){_0x5a2911['operator']='$between';_0x5a2911['value']+=','+_0x5a2911[_0x950a('0x13')];}else if(_[_0x950a('0x14')]([_0x950a('0x15'),_0x950a('0x16')],_0x5a2911[_0x950a('0x11')])){_0x5a2911[_0x950a('0x13')]=moment(_0x5a2911[_0x950a('0x13')])[_0x950a('0x17')](0x1,_0x950a('0x18'))[_0x950a('0x19')](_0x950a('0x1a'));}}if(_0x5a2911[_0x950a('0x1b')]){_0xbab46a=_0x5a2911[_0x950a('0x1b')];_0x4cb783[_0x950a('0x1c')]=_0x950a('0x1d')+_0xce432e+'.'+_0x5a2911[_0x950a('0x1e')]+_0x950a('0x1f')+_0x5a2911['castTo']+')\x20'+parseOperator(_0x5a2911['operator']);}else{_0x4cb783[_0x950a('0x1c')]=_0xce432e+'.'+_0x5a2911[_0x950a('0x1e')]+'\x20'+parseOperator(_0x5a2911[_0x950a('0x11')]);}if(_[_0x950a('0x14')]([_0x950a('0x20'),'$notIn'],_0x5a2911[_0x950a('0x11')]))_0x4cb783[_0x950a('0x1c')]='('+_0x4cb783[_0x950a('0x1c')]+'\x20OR\x20'+_0xce432e+'.'+_0x5a2911[_0x950a('0x1e')]+_0x950a('0x21');_0x4cb783['value']=parseValue(_0xbab46a,_0x5a2911[_0x950a('0x11')],_0x5a2911[_0x950a('0x13')]);return _0x4cb783;};function parseOperator(_0x2ccaed){var _0x31aa77;switch(_0x2ccaed){case _0x950a('0x22'):_0x31aa77=_0x950a('0x23');break;case _0x950a('0x24'):_0x31aa77=_0x950a('0x25');break;case _0x950a('0x12'):_0x31aa77='=\x20?';break;case _0x950a('0x20'):_0x31aa77=_0x950a('0x26');break;case _0x950a('0x27'):case _0x950a('0x28'):case _0x950a('0x29'):_0x31aa77=_0x950a('0x2a');break;case _0x950a('0x2b'):_0x31aa77='<\x20?';break;case _0x950a('0x15'):_0x31aa77=_0x950a('0x2c');break;case _0x950a('0x16'):_0x31aa77='<=\x20?';break;case _0x950a('0x2d'):_0x31aa77=_0x950a('0x2e');break;case _0x950a('0x2f'):_0x31aa77='BETWEEN\x20?\x20AND\x20?';break;}return _0x31aa77;}function parseValue(_0x4883b3,_0x57ae00,_0x19405d){var _0x4fe47d={'start':undefined,'end':undefined};switch(_0x57ae00){case _0x950a('0x22'):case'$notIn':_0x4fe47d[_0x950a('0x30')]=_0x19405d[_0x950a('0x7')](',');break;case'$substring':_0x4fe47d[_0x950a('0x30')]='%'+_0x19405d+'%';break;case'$startsWith':_0x4fe47d[_0x950a('0x30')]=_0x19405d+'%';break;case _0x950a('0x29'):_0x4fe47d[_0x950a('0x30')]='%'+_0x19405d;break;case _0x950a('0x2f'):var _0x5df39b=_0x19405d['split'](',');var _0x19405d=_0x5df39b[_0x950a('0x31')]();var _0x1ab515=_0x5df39b[_0x950a('0x32')]();if(_0x4883b3===_0x950a('0x10')){_0x19405d=moment(_0x19405d)[_0x950a('0x33')](0x0,!![])['format']();_0x1ab515=moment(_0x1ab515)[_0x950a('0x33')](0x0,!![])[_0x950a('0x17')](0x17,_0x950a('0x34'))[_0x950a('0x17')](0x3b,_0x950a('0x35'))[_0x950a('0x17')](0x3b,'seconds')[_0x950a('0x19')]();}_0x4fe47d={'start':_0x19405d,'end':_0x1ab515};break;default:_0x4fe47d[_0x950a('0x30')]=_0x19405d;break;}return _0x4fe47d;} \ No newline at end of file +var _0x9c71=['$endsWith','<\x20?','>\x20?','<=\x20?','$between','BETWEEN\x20?\x20AND\x20?','start','$substring','DATE','utcOffset','add','hours','minutes','seconds','lodash','moment','parseSearch','sqlOperator','startsWith','[$or]','and','replace','[$and]','length','slice','split','shift','match','filter','indexOf','map','push','buildExpression','operator','$eq','value','includes','$gt','$lte','days','format','YYYY-MM-DD','castTo','text','CAST(','field','\x20AS\x20','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','IN\x20?','=\x20?','<>\x20?','$startsWith'];(function(_0x2125f0,_0x2f23b9){var _0x12d6eb=function(_0x7a43ea){while(--_0x7a43ea){_0x2125f0['push'](_0x2125f0['shift']());}};_0x12d6eb(++_0x2f23b9);}(_0x9c71,0x7c));var _0x19c7=function(_0x231146,_0x561e18){_0x231146=_0x231146-0x0;var _0x562350=_0x9c71[_0x231146];return _0x562350;};'use strict';var _=require(_0x19c7('0x0'));var moment=require(_0x19c7('0x1'));exports[_0x19c7('0x2')]=function(_0x573805){var _0x443981={'conditions':[]};_0x443981[_0x19c7('0x3')]=_[_0x19c7('0x4')](_0x573805,_0x19c7('0x5'))?'or':_0x19c7('0x6');var _0x184d7c=_0x573805[_0x19c7('0x7')](_0x19c7('0x8'),'')[_0x19c7('0x7')](_0x19c7('0x5'),'')['split']('||');for(var _0x5c3618=0x0;_0x5c3618<_0x184d7c[_0x19c7('0x9')];_0x5c3618++){var _0x3b6c64=_0x184d7c[_0x5c3618]['split'](':=');var _0x3b8b13=_0x3b6c64[0x0];var _0x3ba740=_0x3b6c64[_0x19c7('0xa')](0x1);_0x3ba740['forEach'](function(_0x3b8c4d){var _0x3f367f=_0x3b8c4d[_0x19c7('0xb')]('[')[_0x19c7('0xc')]();var _0x1ef41c=_0x3b8c4d[_0x19c7('0xd')](/\[(.*?)\]/g);_0x1ef41c['forEach'](function(_0x3f2e96){var _0x19a11b=_0x3f2e96[_0x19c7('0xb')]('[')[_0x19c7('0xe')](function(_0x269839){return _0x269839[_0x19c7('0xf')](']')>-0x1;})[_0x19c7('0x10')](function(_0x4b396b){return _0x4b396b['split'](']')[0x0];})[0x0];_0x443981['conditions'][_0x19c7('0x11')]({'field':_0x3b8b13,'operator':_0x3f367f,'value':_0x19a11b});});});}return _0x443981;};exports[_0x19c7('0x12')]=function(_0x34532d,_0x306334,_0x38cb40){var _0x27d31b={};if(_0x306334==='DATE'){if(_0x38cb40[_0x19c7('0x13')]===_0x19c7('0x14')){_0x38cb40[_0x19c7('0x13')]='$between';_0x38cb40[_0x19c7('0x15')]+=','+_0x38cb40[_0x19c7('0x15')];}else if(_[_0x19c7('0x16')]([_0x19c7('0x17'),_0x19c7('0x18')],_0x38cb40[_0x19c7('0x13')])){_0x38cb40[_0x19c7('0x15')]=moment(_0x38cb40[_0x19c7('0x15')])['add'](0x1,_0x19c7('0x19'))[_0x19c7('0x1a')](_0x19c7('0x1b'));}}if(_0x38cb40[_0x19c7('0x1c')]){_0x306334=_0x38cb40['castTo'];_0x27d31b[_0x19c7('0x1d')]=_0x19c7('0x1e')+_0x34532d+'.'+_0x38cb40[_0x19c7('0x1f')]+_0x19c7('0x20')+_0x38cb40[_0x19c7('0x1c')]+')\x20'+parseOperator(_0x38cb40['operator']);}else{_0x27d31b[_0x19c7('0x1d')]=_0x34532d+'.'+_0x38cb40[_0x19c7('0x1f')]+'\x20'+parseOperator(_0x38cb40[_0x19c7('0x13')]);}if(_[_0x19c7('0x16')]([_0x19c7('0x21'),_0x19c7('0x22')],_0x38cb40[_0x19c7('0x13')]))_0x27d31b[_0x19c7('0x1d')]='('+_0x27d31b[_0x19c7('0x1d')]+_0x19c7('0x23')+_0x34532d+'.'+_0x38cb40[_0x19c7('0x1f')]+_0x19c7('0x24');_0x27d31b[_0x19c7('0x15')]=parseValue(_0x306334,_0x38cb40[_0x19c7('0x13')],_0x38cb40[_0x19c7('0x15')]);return _0x27d31b;};function parseOperator(_0x5a71bf){var _0x12c051;switch(_0x5a71bf){case'$in':_0x12c051=_0x19c7('0x25');break;case _0x19c7('0x22'):_0x12c051='NOT\x20IN\x20?';break;case _0x19c7('0x14'):_0x12c051=_0x19c7('0x26');break;case _0x19c7('0x21'):_0x12c051=_0x19c7('0x27');break;case'$substring':case _0x19c7('0x28'):case _0x19c7('0x29'):_0x12c051='LIKE\x20?';break;case'$lt':_0x12c051=_0x19c7('0x2a');break;case _0x19c7('0x17'):_0x12c051=_0x19c7('0x2b');break;case _0x19c7('0x18'):_0x12c051=_0x19c7('0x2c');break;case'$gte':_0x12c051='>=\x20?';break;case _0x19c7('0x2d'):_0x12c051=_0x19c7('0x2e');break;}return _0x12c051;}function parseValue(_0x39c657,_0x11eca9,_0x4fb287){var _0x55af43={'start':undefined,'end':undefined};switch(_0x11eca9){case'$in':case'$notIn':_0x55af43[_0x19c7('0x2f')]=_0x4fb287[_0x19c7('0xb')](',');break;case _0x19c7('0x30'):_0x55af43['start']='%'+_0x4fb287+'%';break;case'$startsWith':_0x55af43['start']=_0x4fb287+'%';break;case _0x19c7('0x29'):_0x55af43[_0x19c7('0x2f')]='%'+_0x4fb287;break;case _0x19c7('0x2d'):var _0x44344c=_0x4fb287['split'](',');var _0x4fb287=_0x44344c[_0x19c7('0xc')]();var _0x31152b=_0x44344c['pop']();if(_0x39c657===_0x19c7('0x31')){_0x4fb287=moment(_0x4fb287)['utcOffset'](0x0,!![])[_0x19c7('0x1a')]();_0x31152b=moment(_0x31152b)[_0x19c7('0x32')](0x0,!![])[_0x19c7('0x33')](0x17,_0x19c7('0x34'))['add'](0x3b,_0x19c7('0x35'))[_0x19c7('0x33')](0x3b,_0x19c7('0x36'))[_0x19c7('0x1a')]();}_0x55af43={'start':_0x4fb287,'end':_0x31152b};break;default:_0x55af43['start']=_0x4fb287;break;}return _0x55af43;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 7a03341..5814ad2 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 _0x5f11=['isEmpty','forOwn','type','DATE','isPlainObject','$gte','YYYY-MM-DD','utc','format','subtract','isArray','parse','split','offset','sort','map','indexOf','priority','col','unsigned','DESC','cast','ASC','omit','isObject','isString','length','unset','hasOwnProperty','match','isEmail','getFullTextValue','forEach','push','join','lodash','sequelize','moment','filters'];(function(_0x47a8c0,_0x4d5931){var _0x551fa1=function(_0x45ac5a){while(--_0x45ac5a){_0x47a8c0['push'](_0x47a8c0['shift']());}};_0x551fa1(++_0x4d5931);}(_0x5f11,0x98));var _0x15f1=function(_0x24e872,_0xe9f733){_0x24e872=_0x24e872-0x0;var _0x422b15=_0x5f11[_0x24e872];return _0x422b15;};'use strict';var _=require(_0x15f1('0x0'));var sequelize=require(_0x15f1('0x1'));var moment=require(_0x15f1('0x2'));var LIMIT_VALUE=0xfa;exports['fields']=function(_0x2fd6d0){var _0x4292ae=null;if(_0x2fd6d0){_0x4292ae=_0x2fd6d0['split'](',');}return _0x4292ae;};exports[_0x15f1('0x3')]=function(_0x5c3c9c,_0x263e9d){var _0x3c831d={};if(!_[_0x15f1('0x4')](_0x5c3c9c)){_[_0x15f1('0x5')](_0x5c3c9c,function(_0x407626,_0x26c2df){try{if(_0x263e9d){var _0x5b98d2=_['find'](_0x263e9d,{'name':_0x26c2df})||{};if(_0x5b98d2[_0x15f1('0x6')]===_0x15f1('0x7')&&_[_0x15f1('0x8')](_0x407626)){var _0x2c2272=JSON['parse'](_0x407626);var _0x5077b6={'$gte':moment(moment(_0x2c2272[_0x15f1('0x9')])['format'](_0x15f1('0xa')))[_0x15f1('0xb')]()[_0x15f1('0xc')](),'$lte':moment(moment(_0x2c2272['$lte'])[_0x15f1('0xc')](_0x15f1('0xa')))[_0x15f1('0xb')]()[_0x15f1('0xd')](0x1,'s')[_0x15f1('0xc')]()};_0x3c831d[_0x26c2df]=_0x5077b6;}else{_0x3c831d[_0x26c2df]=_[_0x15f1('0xe')](_0x407626)?_0x407626:JSON[_0x15f1('0xf')](_0x407626);}}else{_0x3c831d[_0x26c2df]=_[_0x15f1('0xe')](_0x407626)?_0x407626:JSON[_0x15f1('0xf')](_0x407626);}}catch(_0x215c2d){_0x3c831d[_0x26c2df]=_0x407626[_0x15f1('0x10')](',');}});}return _0x3c831d;};exports['limit']=function(_0x4d5e26){_0x4d5e26=parseInt(_0x4d5e26,0xa);if(!_0x4d5e26||_0x4d5e26<0x0){_0x4d5e26=LIMIT_VALUE;}return _0x4d5e26;};exports[_0x15f1('0x11')]=function(_0x4f3fa9){_0x4f3fa9=parseInt(_0x4f3fa9,0xa);if(!_0x4f3fa9||_0x4f3fa9<0x0){_0x4f3fa9=0x0;}return _0x4f3fa9;};exports[_0x15f1('0x12')]=function(_0x311ff1){var _0x5a9883,_0x4ffef4=null;if(_0x311ff1){_0x5a9883=_0x311ff1[_0x15f1('0x10')](',');_0x4ffef4=_[_0x15f1('0x13')](_0x5a9883,function(_0x180ce9){if(_0x180ce9[_0x15f1('0x14')]('-')===0x0){return[_0x180ce9===_0x15f1('0x15')?sequelize['cast'](sequelize[_0x15f1('0x16')](_0x15f1('0x15')),_0x15f1('0x17')):_0x180ce9['substr'](0x1),_0x15f1('0x18')];}else{return[_0x180ce9===_0x15f1('0x15')?sequelize[_0x15f1('0x19')](sequelize[_0x15f1('0x16')]('priority'),_0x15f1('0x17')):_0x180ce9,_0x15f1('0x1a')];}});}return _0x4ffef4;};exports['omit']=function(_0x5c6ba2,_0x4b19ad){if(_[_0x15f1('0x4')](_0x5c6ba2)){return _0x5c6ba2;}if(_[_0x15f1('0xe')](_0x5c6ba2)){for(var _0x533029=0x0;_0x533029<_0x5c6ba2['length'];_0x533029+=0x1){_0x5c6ba2[_0x533029]=this[_0x15f1('0x1b')](_0x5c6ba2[_0x533029],_0x4b19ad);}return _0x5c6ba2;}if(!_[_0x15f1('0x1c')](_0x5c6ba2)){return _0x5c6ba2;}if(_[_0x15f1('0x1d')](_0x4b19ad)){_0x4b19ad=[_0x4b19ad];}if(!_[_0x15f1('0xe')](_0x4b19ad)){return _0x5c6ba2;}for(var _0x10d18e=0x0;_0x10d18e<_0x4b19ad[_0x15f1('0x1e')];_0x10d18e+=0x1){_[_0x15f1('0x1f')](_0x5c6ba2,_0x4b19ad[_0x10d18e]);}for(var _0x48038d in _0x5c6ba2){if(_0x5c6ba2[_0x15f1('0x20')](_0x48038d)){_0x5c6ba2[_0x48038d]=this[_0x15f1('0x1b')](_0x5c6ba2[_0x48038d],_0x4b19ad);}}return _0x5c6ba2;};exports['isNumeric']=function(_0x249b9b){return _0x249b9b[_0x15f1('0x21')](RegExp('^[0-9]*$'))?!![]:![];};exports[_0x15f1('0x22')]=function(_0x539726){return _0x539726['match'](/^\S+@\S+$/)?!![]:![];};exports[_0x15f1('0x23')]=function(_0x11db76){var _0x2c12dc=[];_0x11db76['split']('\x20')[_0x15f1('0x24')](function(_0x4cb4fe){_0x2c12dc[_0x15f1('0x25')]('+'+_0x4cb4fe['toString']()+'*');});return _0x2c12dc[_0x15f1('0x26')]('\x20');}; \ No newline at end of file +var _0xde9c=['priority','cast','col','substr','DESC','ASC','omit','length','isObject','isString','unset','hasOwnProperty','isNumeric','forEach','toString','join','lodash','sequelize','moment','split','filters','isEmpty','type','isPlainObject','parse','$gte','format','YYYY-MM-DD','utc','$lte','subtract','isArray','offset','sort','map','indexOf'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0xde9c,0xc4));var _0xcde9=function(_0x410a9d,_0x65fb61){_0x410a9d=_0x410a9d-0x0;var _0x17c631=_0xde9c[_0x410a9d];return _0x17c631;};'use strict';var _=require(_0xcde9('0x0'));var sequelize=require(_0xcde9('0x1'));var moment=require(_0xcde9('0x2'));var LIMIT_VALUE=0xfa;exports['fields']=function(_0x525c7f){var _0x503f4b=null;if(_0x525c7f){_0x503f4b=_0x525c7f[_0xcde9('0x3')](',');}return _0x503f4b;};exports[_0xcde9('0x4')]=function(_0x54127a,_0xf71a64){var _0x19b6f2={};if(!_[_0xcde9('0x5')](_0x54127a)){_['forOwn'](_0x54127a,function(_0x17baf0,_0x2258c7){try{if(_0xf71a64){var _0x204600=_['find'](_0xf71a64,{'name':_0x2258c7})||{};if(_0x204600[_0xcde9('0x6')]==='DATE'&&_[_0xcde9('0x7')](_0x17baf0)){var _0x3bbf0b=JSON[_0xcde9('0x8')](_0x17baf0);var _0x5e15e8={'$gte':moment(moment(_0x3bbf0b[_0xcde9('0x9')])[_0xcde9('0xa')](_0xcde9('0xb')))[_0xcde9('0xc')]()[_0xcde9('0xa')](),'$lte':moment(moment(_0x3bbf0b[_0xcde9('0xd')])[_0xcde9('0xa')](_0xcde9('0xb')))[_0xcde9('0xc')]()[_0xcde9('0xe')](0x1,'s')[_0xcde9('0xa')]()};_0x19b6f2[_0x2258c7]=_0x5e15e8;}else{_0x19b6f2[_0x2258c7]=_[_0xcde9('0xf')](_0x17baf0)?_0x17baf0:JSON[_0xcde9('0x8')](_0x17baf0);}}else{_0x19b6f2[_0x2258c7]=_[_0xcde9('0xf')](_0x17baf0)?_0x17baf0:JSON['parse'](_0x17baf0);}}catch(_0x5d462d){_0x19b6f2[_0x2258c7]=_0x17baf0[_0xcde9('0x3')](',');}});}return _0x19b6f2;};exports['limit']=function(_0x2794ff){_0x2794ff=parseInt(_0x2794ff,0xa);if(!_0x2794ff||_0x2794ff<0x0){_0x2794ff=LIMIT_VALUE;}return _0x2794ff;};exports[_0xcde9('0x10')]=function(_0x2795e4){_0x2795e4=parseInt(_0x2795e4,0xa);if(!_0x2795e4||_0x2795e4<0x0){_0x2795e4=0x0;}return _0x2795e4;};exports[_0xcde9('0x11')]=function(_0x462304){var _0x5b381b,_0x146fa6=null;if(_0x462304){_0x5b381b=_0x462304[_0xcde9('0x3')](',');_0x146fa6=_[_0xcde9('0x12')](_0x5b381b,function(_0x1f2d8a){if(_0x1f2d8a[_0xcde9('0x13')]('-')===0x0){return[_0x1f2d8a===_0xcde9('0x14')?sequelize[_0xcde9('0x15')](sequelize[_0xcde9('0x16')](_0xcde9('0x14')),'unsigned'):_0x1f2d8a[_0xcde9('0x17')](0x1),_0xcde9('0x18')];}else{return[_0x1f2d8a===_0xcde9('0x14')?sequelize['cast'](sequelize[_0xcde9('0x16')]('priority'),'unsigned'):_0x1f2d8a,_0xcde9('0x19')];}});}return _0x146fa6;};exports[_0xcde9('0x1a')]=function(_0x2bb012,_0x12a798){if(_[_0xcde9('0x5')](_0x2bb012)){return _0x2bb012;}if(_[_0xcde9('0xf')](_0x2bb012)){for(var _0x3d0169=0x0;_0x3d0169<_0x2bb012[_0xcde9('0x1b')];_0x3d0169+=0x1){_0x2bb012[_0x3d0169]=this[_0xcde9('0x1a')](_0x2bb012[_0x3d0169],_0x12a798);}return _0x2bb012;}if(!_[_0xcde9('0x1c')](_0x2bb012)){return _0x2bb012;}if(_[_0xcde9('0x1d')](_0x12a798)){_0x12a798=[_0x12a798];}if(!_[_0xcde9('0xf')](_0x12a798)){return _0x2bb012;}for(var _0x5235b8=0x0;_0x5235b8<_0x12a798[_0xcde9('0x1b')];_0x5235b8+=0x1){_[_0xcde9('0x1e')](_0x2bb012,_0x12a798[_0x5235b8]);}for(var _0x5ac316 in _0x2bb012){if(_0x2bb012[_0xcde9('0x1f')](_0x5ac316)){_0x2bb012[_0x5ac316]=this['omit'](_0x2bb012[_0x5ac316],_0x12a798);}}return _0x2bb012;};exports[_0xcde9('0x20')]=function(_0x2b398f){return _0x2b398f['match'](RegExp('^[0-9]*$'))?!![]:![];};exports['isEmail']=function(_0x5a49d4){return _0x5a49d4['match'](/^\S+@\S+$/)?!![]:![];};exports['getFullTextValue']=function(_0x2cd9ed){var _0x5340cb=[];_0x2cd9ed['split']('\x20')[_0xcde9('0x21')](function(_0xd0651c){_0x5340cb['push']('+'+_0xd0651c[_0xcde9('0x22')]()+'*');});return _0x5340cb[_0xcde9('0x23')]('\x20');}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index a65a071..a42ac5f 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x21f7=['use','split','static','views','/server/views','engine','html','renderFile','50mb','json','initialize','express','serve-favicon','body-parser','method-override','errorhandler','path','passport','cors','moment','./environment','../mysqldb','default','get','production','set','appPath','join','root','public','development'];(function(_0x207d2f,_0x44400f){var _0x3c3498=function(_0x57fdfb){while(--_0x57fdfb){_0x207d2f['push'](_0x207d2f['shift']());}};_0x3c3498(++_0x44400f);}(_0x21f7,0xc5));var _0x721f=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x21f7[_0x2dafbe];return _0x58a45a;};'use strict';var express=require(_0x721f('0x0'));var favicon=require(_0x721f('0x1'));var bodyParser=require(_0x721f('0x2'));var methodOverride=require(_0x721f('0x3'));var cookieParser=require('cookie-parser');var errorHandler=require(_0x721f('0x4'));var path=require(_0x721f('0x5'));var passport=require(_0x721f('0x6'));var cors=require(_0x721f('0x7'));var moment=require(_0x721f('0x8'));var config=require(_0x721f('0x9'));var db=require(_0x721f('0xa'))['db'];exports[_0x721f('0xb')]=function(_0x5d423d){var _0x1ad37c=_0x5d423d[_0x721f('0xc')]('env');if(_0x1ad37c===_0x721f('0xd')){_0x5d423d[_0x721f('0xe')](_0x721f('0xf'),path[_0x721f('0x10')](config[_0x721f('0x11')],_0x721f('0x12')));}if(_0x1ad37c===_0x721f('0x13')||_0x1ad37c==='test'){_0x5d423d['set'](_0x721f('0xf'),path[_0x721f('0x10')](config[_0x721f('0x11')],'client'));_0x5d423d[_0x721f('0x14')](errorHandler());}_0x5d423d[_0x721f('0xe')]('json\x20replacer',function(_0x57b62c,_0x39c0d6){if(this[_0x57b62c]instanceof Date){_0x39c0d6=this[_0x57b62c]['toISOString']()[_0x721f('0x15')]('.')[0x0]+'Z';}return _0x39c0d6;});_0x5d423d[_0x721f('0x14')](express[_0x721f('0x16')](_0x5d423d[_0x721f('0xc')](_0x721f('0xf'))));_0x5d423d[_0x721f('0xe')](_0x721f('0x17'),config[_0x721f('0x11')]+_0x721f('0x18'));_0x5d423d[_0x721f('0x19')](_0x721f('0x1a'),require('ejs')[_0x721f('0x1b')]);_0x5d423d[_0x721f('0xe')]('view\x20engine',_0x721f('0x1a'));_0x5d423d[_0x721f('0x14')](bodyParser['urlencoded']({'limit':_0x721f('0x1c'),'extended':!![]}));_0x5d423d[_0x721f('0x14')](bodyParser[_0x721f('0x1d')]({'limit':_0x721f('0x1c')}));_0x5d423d[_0x721f('0x14')](cors());_0x5d423d[_0x721f('0x14')](methodOverride());_0x5d423d[_0x721f('0x14')](cookieParser());_0x5d423d['use'](passport[_0x721f('0x1e')]());}; \ No newline at end of file +var _0x99e4=['development','test','join','client','use','json\x20replacer','toISOString','split','static','/server/views','engine','html','ejs','renderFile','view\x20engine','50mb','json','initialize','body-parser','path','passport','cors','moment','./environment','get','env','production','set','appPath','root','public'];(function(_0x36de6e,_0x30efad){var _0x349be0=function(_0x4559e0){while(--_0x4559e0){_0x36de6e['push'](_0x36de6e['shift']());}};_0x349be0(++_0x30efad);}(_0x99e4,0x8e));var _0x499e=function(_0x4e364e,_0x2ee796){_0x4e364e=_0x4e364e-0x0;var _0x279cf5=_0x99e4[_0x4e364e];return _0x279cf5;};'use strict';var express=require('express');var favicon=require('serve-favicon');var bodyParser=require(_0x499e('0x0'));var methodOverride=require('method-override');var cookieParser=require('cookie-parser');var errorHandler=require('errorhandler');var path=require(_0x499e('0x1'));var passport=require(_0x499e('0x2'));var cors=require(_0x499e('0x3'));var moment=require(_0x499e('0x4'));var config=require(_0x499e('0x5'));var db=require('../mysqldb')['db'];exports['default']=function(_0xb2422){var _0x7d0de6=_0xb2422[_0x499e('0x6')](_0x499e('0x7'));if(_0x7d0de6===_0x499e('0x8')){_0xb2422[_0x499e('0x9')](_0x499e('0xa'),path['join'](config[_0x499e('0xb')],_0x499e('0xc')));}if(_0x7d0de6===_0x499e('0xd')||_0x7d0de6===_0x499e('0xe')){_0xb2422['set']('appPath',path[_0x499e('0xf')](config[_0x499e('0xb')],_0x499e('0x10')));_0xb2422[_0x499e('0x11')](errorHandler());}_0xb2422['set'](_0x499e('0x12'),function(_0x37a72a,_0x472120){if(this[_0x37a72a]instanceof Date){_0x472120=this[_0x37a72a][_0x499e('0x13')]()[_0x499e('0x14')]('.')[0x0]+'Z';}return _0x472120;});_0xb2422['use'](express[_0x499e('0x15')](_0xb2422[_0x499e('0x6')](_0x499e('0xa'))));_0xb2422['set']('views',config['root']+_0x499e('0x16'));_0xb2422[_0x499e('0x17')](_0x499e('0x18'),require(_0x499e('0x19'))[_0x499e('0x1a')]);_0xb2422[_0x499e('0x9')](_0x499e('0x1b'),_0x499e('0x18'));_0xb2422[_0x499e('0x11')](bodyParser['urlencoded']({'limit':_0x499e('0x1c'),'extended':!![]}));_0xb2422[_0x499e('0x11')](bodyParser[_0x499e('0x1d')]({'limit':'50mb'}));_0xb2422[_0x499e('0x11')](cors());_0xb2422[_0x499e('0x11')](methodOverride());_0xb2422['use'](cookieParser());_0xb2422[_0x499e('0x11')](passport[_0x499e('0x1e')]());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index 310adfc..f67cbb3 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 _0x0689=['createHash','md5','update','hex','getUuid','win32','dmidecode\x20--string\x20system-uuid','replace','macAddress','ipAddress','digest','substring','crypto','child_process','execSync','networkInterfaces','orderBy','keys','length','filter','IPv4','internal','concat','head','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','map','model'];(function(_0x82129b,_0x484ae9){var _0x2ae5dc=function(_0x299e34){while(--_0x299e34){_0x82129b['push'](_0x82129b['shift']());}};_0x2ae5dc(++_0x484ae9);}(_0x0689,0x161));var _0x9068=function(_0xa83955,_0x842b87){_0xa83955=_0xa83955-0x0;var _0x39d283=_0x0689[_0xa83955];return _0x39d283;};'use strict';var _=require('lodash');var os=require('os');var crypto=require(_0x9068('0x0'));var machine=require('bimedia-machine-uuid');var exec=require(_0x9068('0x1'))[_0x9068('0x2')];function getInterfaces(){var _0x222292=[];var _0x45c9e5=os[_0x9068('0x3')]();var _0x1c35ba=_[_0x9068('0x4')](_[_0x9068('0x5')](_0x45c9e5));for(var _0x2c25ef=0x0;_0x2c25ef<_0x1c35ba[_0x9068('0x6')];_0x2c25ef++){var _0x5ce5a7=_0x45c9e5[_0x1c35ba[_0x2c25ef]][_0x9068('0x7')](function(_0x5c833f){return _0x5c833f['family']===_0x9068('0x8')&&_0x5c833f[_0x9068('0x9')]===![];});_0x222292=_0x222292[_0x9068('0xa')](_0x5ce5a7);}return _0x222292;}function getFirstInterface(){var _0x77a2db=_[_0x9068('0xb')](getInterfaces());return{'macAddress':_0x77a2db&&_0x77a2db[_0x9068('0xc')]?_0x77a2db[_0x9068('0xc')]:_0x9068('0xd'),'ipAddress':_0x77a2db&&_0x77a2db[_0x9068('0xe')]?_0x77a2db['address']:_0x9068('0xf')};}exports[_0x9068('0x10')]=getFirstInterface;function getCPUhash(){var _0x3e5f5f=_[_0x9068('0x4')](os['cpus']()[_0x9068('0x11')](function(_0x1a89d4){return _0x1a89d4[_0x9068('0x12')];}))['join'](':');return crypto[_0x9068('0x13')](_0x9068('0x14'))[_0x9068('0x15')](_0x3e5f5f)['digest'](_0x9068('0x16'));}exports[_0x9068('0x17')]=function(){switch(os['platform']()){case _0x9068('0x18'):return exec(_0x9068('0x19'),{'encoding':'utf8'})[_0x9068('0x1a')]('\x0d\x0a','');default:var _0x412dbf=getFirstInterface();var _0x74df53=getCPUhash();var _0x430000=_0x74df53+'|'+os['hostname']()+'|'+_0x412dbf[_0x9068('0x1b')]+'|'+_0x412dbf[_0x9068('0x1c')];var _0x3ab698=crypto[_0x9068('0x13')](_0x9068('0x14'))[_0x9068('0x15')](_0x430000)[_0x9068('0x1d')](_0x9068('0x16'));return _0x3ab698[_0x9068('0x1e')](0x0,0x8)+'-'+_0x3ab698['substring'](0x8,0xc)+'-'+_0x3ab698[_0x9068('0x1e')](0xc,0x10)+'-'+_0x3ab698[_0x9068('0x1e')](0x10,0x14)+'-'+_0x3ab698[_0x9068('0x1e')](0x14);}}; \ No newline at end of file +var _0x7d55=['join','createHash','md5','update','digest','hex','win32','utf8','replace','macAddress','ipAddress','substring','lodash','crypto','bimedia-machine-uuid','child_process','networkInterfaces','keys','length','filter','head','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','cpus','model'];(function(_0x6065ea,_0xfcc5ad){var _0x1626af=function(_0x1f7f76){while(--_0x1f7f76){_0x6065ea['push'](_0x6065ea['shift']());}};_0x1626af(++_0xfcc5ad);}(_0x7d55,0x1bc));var _0x57d5=function(_0x2c3373,_0x1e3f01){_0x2c3373=_0x2c3373-0x0;var _0x3c9a67=_0x7d55[_0x2c3373];return _0x3c9a67;};'use strict';var _=require(_0x57d5('0x0'));var os=require('os');var crypto=require(_0x57d5('0x1'));var machine=require(_0x57d5('0x2'));var exec=require(_0x57d5('0x3'))['execSync'];function getInterfaces(){var _0x541e22=[];var _0x3ce441=os[_0x57d5('0x4')]();var _0x2b6dc5=_['orderBy'](_[_0x57d5('0x5')](_0x3ce441));for(var _0x2d9ad2=0x0;_0x2d9ad2<_0x2b6dc5[_0x57d5('0x6')];_0x2d9ad2++){var _0x30fcfe=_0x3ce441[_0x2b6dc5[_0x2d9ad2]][_0x57d5('0x7')](function(_0x47282c){return _0x47282c['family']==='IPv4'&&_0x47282c['internal']===![];});_0x541e22=_0x541e22['concat'](_0x30fcfe);}return _0x541e22;}function getFirstInterface(){var _0x3c2602=_[_0x57d5('0x8')](getInterfaces());return{'macAddress':_0x3c2602&&_0x3c2602['mac']?_0x3c2602['mac']:_0x57d5('0x9'),'ipAddress':_0x3c2602&&_0x3c2602['address']?_0x3c2602[_0x57d5('0xa')]:_0x57d5('0xb')};}exports[_0x57d5('0xc')]=getFirstInterface;function getCPUhash(){var _0x54dc3e=_['orderBy'](os[_0x57d5('0xd')]()['map'](function(_0x1b7cc5){return _0x1b7cc5[_0x57d5('0xe')];}))[_0x57d5('0xf')](':');return crypto[_0x57d5('0x10')](_0x57d5('0x11'))[_0x57d5('0x12')](_0x54dc3e)[_0x57d5('0x13')](_0x57d5('0x14'));}exports['getUuid']=function(){switch(os['platform']()){case _0x57d5('0x15'):return exec('dmidecode\x20--string\x20system-uuid',{'encoding':_0x57d5('0x16')})[_0x57d5('0x17')]('\x0d\x0a','');default:var _0x48308c=getFirstInterface();var _0x21c403=getCPUhash();var _0x4ee093=_0x21c403+'|'+os['hostname']()+'|'+_0x48308c[_0x57d5('0x18')]+'|'+_0x48308c[_0x57d5('0x19')];var _0x5b399d=crypto['createHash'](_0x57d5('0x11'))[_0x57d5('0x12')](_0x4ee093)[_0x57d5('0x13')](_0x57d5('0x14'));return _0x5b399d[_0x57d5('0x1a')](0x0,0x8)+'-'+_0x5b399d[_0x57d5('0x1a')](0x8,0xc)+'-'+_0x5b399d['substring'](0xc,0x10)+'-'+_0x5b399d[_0x57d5('0x1a')](0x10,0x14)+'-'+_0x5b399d[_0x57d5('0x1a')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 012f479..8ba831b 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 _0x96f2=['DEMO\x20START\x20AT\x20%s','error','message','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','util','moment','request-promise','bluebird','version','../../mysqldb','../environment','../logger','license','format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','catch','secrets','session','update','base64','createDecipher','aes-256-ctr','utf8','final','||FIELD||VALUE||\x0a','User','findOne','fullname','email','then','|reason|','|uuid|','|machineUuid|','|email|','openIssue','get','active','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','data1','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','uuid','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','diff','days'];(function(_0x106f69,_0x474efa){var _0x23229b=function(_0x18967e){while(--_0x18967e){_0x106f69['push'](_0x106f69['shift']());}};_0x23229b(++_0x474efa);}(_0x96f2,0xb0));var _0x296f=function(_0xdc890b,_0x2dce60){_0xdc890b=_0xdc890b-0x0;var _0x8e4dc8=_0x96f2[_0xdc890b];return _0x8e4dc8;};'use strict';var util=require(_0x296f('0x0'));var crypto=require('crypto');var moment=require(_0x296f('0x1'));var rp=require(_0x296f('0x2'));var BPromise=require(_0x296f('0x3'));var pkginfo=require('pkginfo')(module,_0x296f('0x4'));var db=require(_0x296f('0x5'))['db'];var config=require(_0x296f('0x6'));var hardware=require('./hardware');var logger=require(_0x296f('0x7'))(_0x296f('0x8'));var jira=require('../../api/jira/jira.controller');var HOST='https://www.xcallymotion.com';var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var ADMIN;var oldToken;function httpRequest(_0x164031){return new BPromise(function(_0x1d019f,_0x2dc0ca){var _0x28f708=util[_0x296f('0x9')](_0x296f('0xa'),HOST,_0x164031,module[_0x296f('0xb')][_0x296f('0x4')]);if(oldToken){_0x28f708=util[_0x296f('0x9')](_0x296f('0xc'),HOST,_0x164031,module['exports'][_0x296f('0x4')],oldToken);}var _0x1a2a02={'uri':_0x28f708,'method':_0x296f('0xd'),'timeout':0xea60,'json':!![]};return rp(_0x1a2a02)['then'](function(_0x2e2307){_0x1d019f(_0x2e2307);})[_0x296f('0xe')](function(_0x1800af){_0x2dc0ca(_0x1800af);});});}function encryptDate(_0x28dad3){var _0x5710ac=crypto['createCipher']('aes-256-ctr',config[_0x296f('0xf')][_0x296f('0x10')]);var _0x2ae407=_0x5710ac[_0x296f('0x11')](_0x28dad3,'utf8',_0x296f('0x12'));_0x2ae407+=_0x5710ac['final']('base64');return _0x2ae407;}function decryptDate(_0x367e03){var _0x2ae0f4=crypto[_0x296f('0x13')](_0x296f('0x14'),config['secrets']['session']);var _0x3e3860=_0x2ae0f4['update'](_0x367e03,_0x296f('0x12'),_0x296f('0x15'));_0x3e3860+=_0x2ae0f4[_0x296f('0x16')]('utf8');return _0x3e3860;}function sendJiraAlert(_0xcc2b48,_0x3b7db8,_0x57f19d){var _0x33e62f=_0x296f('0x17');return db[_0x296f('0x18')][_0x296f('0x19')]({'where':{'role':'admin'},'attributes':[_0x296f('0x1a'),_0x296f('0x1b')],'raw':!![]})[_0x296f('0x1c')](function(_0x54005f){ADMIN=_0x54005f;_0x33e62f+=_0x296f('0x1d')+_0x57f19d+'|\x0a';_0x33e62f+=_0x296f('0x1e')+_0xcc2b48+'|\x0a';_0x33e62f+=_0x296f('0x1f')+_0x3b7db8+'|\x0a';_0x33e62f+='|name|'+ADMIN[_0x296f('0x1a')]+'|\x0a';_0x33e62f+=_0x296f('0x20')+ADMIN[_0x296f('0x1b')]+'|\x0a';return _0x33e62f;})['then'](function(_0x4a1912){var _0x12abfb=hardware['getFirstInterface']()['ipAddress'];return jira[_0x296f('0x21')]({'key':'MOTLICENSE','summary':'Motion\x20License\x20Alert','description':_0x4a1912,'issuetype':'Alert','oldToken':_0xcc2b48,'newToken':_0x3b7db8,'email':ADMIN[_0x296f('0x1b')],'name':ADMIN[_0x296f('0x1a')],'reason':GRAY_PERIOD_REASON,'ip':_0x12abfb});});}function manageLicense(_0x120482,_0x371db0){var _0x2b8078=_0x371db0[_0x296f('0x22')]({'plain':!![]});httpRequest(_0x120482)['then'](function(_0x52ba5c){if(oldToken){oldToken=undefined;}if(_0x52ba5c[_0x296f('0x23')]){if(!_0x2b8078['license']&&_0x2b8078[_0x296f('0x8')]!=_0x52ba5c[_0x296f('0x8')]||_0x2b8078[_0x296f('0x8')]&&_0x2b8078[_0x296f('0x24')]){logger[_0x296f('0x25')](_0x296f('0x26'));}if(_0x2b8078['license']&&!_0x2b8078[_0x296f('0x24')]&&_0x2b8078['license']!=_0x52ba5c[_0x296f('0x8')]){logger[_0x296f('0x25')](_0x296f('0x27'));}if(_0x2b8078[_0x296f('0x8')]&&!_0x2b8078[_0x296f('0x24')]&&_0x2b8078[_0x296f('0x8')]==_0x52ba5c[_0x296f('0x8')]){return _0x371db0;}return _0x371db0[_0x296f('0x11')]({'data1':_0x120482,'data2':null,'license':_0x52ba5c[_0x296f('0x8')]});}else{if(_0x52ba5c[_0x296f('0x8')]||_0x2b8078[_0x296f('0x8')]){if(!_0x2b8078[_0x296f('0x24')]){if(_0x2b8078[_0x296f('0x28')]==_0x120482){GRAY_PERIOD_REASON='Disabled';logger[_0x296f('0x25')](_0x296f('0x29'));}else{GRAY_PERIOD_REASON=_0x296f('0x2a');oldToken=_0x2b8078[_0x296f('0x28')];logger['info']('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x2b8078['data1'],_0x120482);}sendJiraAlert(_0x2b8078[_0x296f('0x28')],_0x52ba5c[_0x296f('0x2b')],GRAY_PERIOD_REASON);logger['info'](_0x296f('0x2c'),GRAY_PERIOD_REASON[_0x296f('0x2d')](),moment()['format']('YYYY-MM-DD\x20HH:mm'));return _0x371db0[_0x296f('0x11')]({'data2':encryptDate(moment()[_0x296f('0x9')]('YYYY-MM-DD\x20HH:mm'))});}else{if(moment()[_0x296f('0x2e')](decryptDate(_0x2b8078[_0x296f('0x24')]),_0x296f('0x2f'))>DAYS){logger[_0x296f('0x25')](_0x296f('0x30'),moment()[_0x296f('0x9')]('YYYY-MM-DD\x20HH:mm'));return _0x371db0['update']({'data1':_0x120482,'data2':null,'license':null});}}}else{if(_0x2b8078['data1']!=_0x120482){logger[_0x296f('0x25')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x2b8078['data1'],_0x120482);return _0x371db0[_0x296f('0x11')]({'data1':_0x120482,'data2':null,'license':null});}}}return _0x371db0;})[_0x296f('0x1c')](function(_0x2b7380){_0x371db0=_0x2b7380;})[_0x296f('0xe')](function(_0x29b943){logger[_0x296f('0x31')](_0x29b943[_0x296f('0x32')]);})['finally'](function(){setTimeout(function(){manageLicense(hardware[_0x296f('0x33')](),_0x371db0);},TIME);});}function defaultLicense(){var _0x12dad2=hardware[_0x296f('0x33')]();if(_0x12dad2){return db[_0x296f('0x34')][_0x296f('0x35')]({'where':{'id':0x1},'defaults':{'data1':_0x12dad2}})[_0x296f('0x36')](function(_0x344548,_0x17208d){logger['info'](_0x296f('0x37'),_0x12dad2);manageLicense(_0x12dad2,_0x344548);})[_0x296f('0xe')](function(_0x5214bc){logger[_0x296f('0x31')](_0x5214bc[_0x296f('0x32')]);});}}exports['default']=defaultLicense; \ No newline at end of file +var _0x0b7f=['utf8','base64','final','createDecipher','User','admin','fullname','email','|reason|','|uuid|','|machineUuid|','|name|','|email|','then','getFirstInterface','ipAddress','openIssue','MOTLICENSE','Motion\x20License\x20Alert','Alert','get','active','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','data1','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','uuid','toUpperCase','YYYY-MM-DD\x20HH:mm','days','DEMO\x20START\x20AT\x20%s','error','message','finally','getUuid','findOrCreate','default','util','crypto','request-promise','pkginfo','version','../../mysqldb','../logger','license','../../api/jira/jira.controller','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','catch','createCipher','aes-256-ctr','secrets','update'];(function(_0x14970e,_0x3dab4f){var _0x939d3c=function(_0xe26432){while(--_0xe26432){_0x14970e['push'](_0x14970e['shift']());}};_0x939d3c(++_0x3dab4f);}(_0x0b7f,0x115));var _0xf0b7=function(_0x4a0324,_0x438fa1){_0x4a0324=_0x4a0324-0x0;var _0x3cd3e0=_0x0b7f[_0x4a0324];return _0x3cd3e0;};'use strict';var util=require(_0xf0b7('0x0'));var crypto=require(_0xf0b7('0x1'));var moment=require('moment');var rp=require(_0xf0b7('0x2'));var BPromise=require('bluebird');var pkginfo=require(_0xf0b7('0x3'))(module,_0xf0b7('0x4'));var db=require(_0xf0b7('0x5'))['db'];var config=require('../environment');var hardware=require('./hardware');var logger=require(_0xf0b7('0x6'))(_0xf0b7('0x7'));var jira=require(_0xf0b7('0x8'));var HOST=_0xf0b7('0x9');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var ADMIN;var oldToken;function httpRequest(_0x2b2de8){return new BPromise(function(_0x5e449a,_0x1408ee){var _0x276f09=util[_0xf0b7('0xa')](_0xf0b7('0xb'),HOST,_0x2b2de8,module[_0xf0b7('0xc')]['version']);if(oldToken){_0x276f09=util[_0xf0b7('0xa')]('%s/api/servers/%s/check?version=%s&oldtoken=%s',HOST,_0x2b2de8,module['exports']['version'],oldToken);}var _0x10096b={'uri':_0x276f09,'method':'GET','timeout':0xea60,'json':!![]};return rp(_0x10096b)['then'](function(_0x3cfae5){_0x5e449a(_0x3cfae5);})[_0xf0b7('0xd')](function(_0x21391e){_0x1408ee(_0x21391e);});});}function encryptDate(_0x5eb22){var _0x15e3e5=crypto[_0xf0b7('0xe')](_0xf0b7('0xf'),config[_0xf0b7('0x10')]['session']);var _0x4a8173=_0x15e3e5[_0xf0b7('0x11')](_0x5eb22,_0xf0b7('0x12'),_0xf0b7('0x13'));_0x4a8173+=_0x15e3e5[_0xf0b7('0x14')](_0xf0b7('0x13'));return _0x4a8173;}function decryptDate(_0x514c24){var _0x66d6e0=crypto[_0xf0b7('0x15')](_0xf0b7('0xf'),config[_0xf0b7('0x10')]['session']);var _0x303db6=_0x66d6e0[_0xf0b7('0x11')](_0x514c24,_0xf0b7('0x13'),_0xf0b7('0x12'));_0x303db6+=_0x66d6e0['final'](_0xf0b7('0x12'));return _0x303db6;}function sendJiraAlert(_0x153d23,_0x28fd36,_0xa004f){var _0x249c4e='||FIELD||VALUE||\x0a';return db[_0xf0b7('0x16')]['findOne']({'where':{'role':_0xf0b7('0x17')},'attributes':[_0xf0b7('0x18'),_0xf0b7('0x19')],'raw':!![]})['then'](function(_0x5b28e6){ADMIN=_0x5b28e6;_0x249c4e+=_0xf0b7('0x1a')+_0xa004f+'|\x0a';_0x249c4e+=_0xf0b7('0x1b')+_0x153d23+'|\x0a';_0x249c4e+=_0xf0b7('0x1c')+_0x28fd36+'|\x0a';_0x249c4e+=_0xf0b7('0x1d')+ADMIN[_0xf0b7('0x18')]+'|\x0a';_0x249c4e+=_0xf0b7('0x1e')+ADMIN[_0xf0b7('0x19')]+'|\x0a';return _0x249c4e;})[_0xf0b7('0x1f')](function(_0x2ca248){var _0x593e6a=hardware[_0xf0b7('0x20')]()[_0xf0b7('0x21')];return jira[_0xf0b7('0x22')]({'key':_0xf0b7('0x23'),'summary':_0xf0b7('0x24'),'description':_0x2ca248,'issuetype':_0xf0b7('0x25'),'oldToken':_0x153d23,'newToken':_0x28fd36,'email':ADMIN[_0xf0b7('0x19')],'name':ADMIN[_0xf0b7('0x18')],'reason':GRAY_PERIOD_REASON,'ip':_0x593e6a});});}function manageLicense(_0x66b1dc,_0x2c273e){var _0x4c8e0d=_0x2c273e[_0xf0b7('0x26')]({'plain':!![]});httpRequest(_0x66b1dc)[_0xf0b7('0x1f')](function(_0x4f53c3){if(oldToken){oldToken=undefined;}if(_0x4f53c3[_0xf0b7('0x27')]){if(!_0x4c8e0d[_0xf0b7('0x7')]&&_0x4c8e0d[_0xf0b7('0x7')]!=_0x4f53c3['license']||_0x4c8e0d[_0xf0b7('0x7')]&&_0x4c8e0d[_0xf0b7('0x28')]){logger[_0xf0b7('0x29')]('THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED');}if(_0x4c8e0d[_0xf0b7('0x7')]&&!_0x4c8e0d[_0xf0b7('0x28')]&&_0x4c8e0d[_0xf0b7('0x7')]!=_0x4f53c3[_0xf0b7('0x7')]){logger[_0xf0b7('0x29')](_0xf0b7('0x2a'));}if(_0x4c8e0d[_0xf0b7('0x7')]&&!_0x4c8e0d[_0xf0b7('0x28')]&&_0x4c8e0d[_0xf0b7('0x7')]==_0x4f53c3[_0xf0b7('0x7')]){return _0x2c273e;}return _0x2c273e['update']({'data1':_0x66b1dc,'data2':null,'license':_0x4f53c3[_0xf0b7('0x7')]});}else{if(_0x4f53c3[_0xf0b7('0x7')]||_0x4c8e0d[_0xf0b7('0x7')]){if(!_0x4c8e0d['data2']){if(_0x4c8e0d[_0xf0b7('0x2b')]==_0x66b1dc){GRAY_PERIOD_REASON=_0xf0b7('0x2c');logger[_0xf0b7('0x29')](_0xf0b7('0x2d'));}else{GRAY_PERIOD_REASON=_0xf0b7('0x2e');oldToken=_0x4c8e0d[_0xf0b7('0x2b')];logger[_0xf0b7('0x29')](_0xf0b7('0x2f'),_0x4c8e0d[_0xf0b7('0x2b')],_0x66b1dc);}sendJiraAlert(_0x4c8e0d['data1'],_0x4f53c3[_0xf0b7('0x30')],GRAY_PERIOD_REASON);logger['info']('%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s',GRAY_PERIOD_REASON[_0xf0b7('0x31')](),moment()['format'](_0xf0b7('0x32')));return _0x2c273e[_0xf0b7('0x11')]({'data2':encryptDate(moment()[_0xf0b7('0xa')](_0xf0b7('0x32')))});}else{if(moment()['diff'](decryptDate(_0x4c8e0d[_0xf0b7('0x28')]),_0xf0b7('0x33'))>DAYS){logger[_0xf0b7('0x29')](_0xf0b7('0x34'),moment()['format'](_0xf0b7('0x32')));return _0x2c273e['update']({'data1':_0x66b1dc,'data2':null,'license':null});}}}else{if(_0x4c8e0d['data1']!=_0x66b1dc){logger['info']('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x4c8e0d['data1'],_0x66b1dc);return _0x2c273e[_0xf0b7('0x11')]({'data1':_0x66b1dc,'data2':null,'license':null});}}}return _0x2c273e;})[_0xf0b7('0x1f')](function(_0x2eea7c){_0x2c273e=_0x2eea7c;})[_0xf0b7('0xd')](function(_0x397159){logger[_0xf0b7('0x35')](_0x397159[_0xf0b7('0x36')]);})[_0xf0b7('0x37')](function(){setTimeout(function(){manageLicense(hardware[_0xf0b7('0x38')](),_0x2c273e);},TIME);});}function defaultLicense(){var _0x503599=hardware[_0xf0b7('0x38')]();if(_0x503599){return db['License'][_0xf0b7('0x39')]({'where':{'id':0x1},'defaults':{'data1':_0x503599}})['spread'](function(_0x34ba2f,_0x364b24){logger[_0xf0b7('0x29')]('SERVICE\x20LICENSE\x20STARTED\x20%s',_0x503599);manageLicense(_0x503599,_0x34ba2f);})[_0xf0b7('0xd')](function(_0x39bde6){logger[_0xf0b7('0x35')](_0x39bde6['message']);});}}exports[_0xf0b7('0x3a')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index bd47595..f9e77c5 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 _0x0851=['find','defaults','crypto','util','lodash','moment','../environment','../../mysqldb','license','isEmpty','License\x20key\x20value\x20not\x20found','data1','data2','split','createDecipher','aes-256-ctr','format','update','base64','utf8','final','parse','demo','uuid','machineUuid','secrets','session','gray','add','grayReason','changed','message','getUuid','getLicense'];(function(_0x4881db,_0x32e98f){var _0x43213b=function(_0x39cadb){while(--_0x39cadb){_0x4881db['push'](_0x4881db['shift']());}};_0x43213b(++_0x32e98f);}(_0x0851,0x8a));var _0x1085=function(_0x4b1cd7,_0x27b641){_0x4b1cd7=_0x4b1cd7-0x0;var _0x400e61=_0x0851[_0x4b1cd7];return _0x400e61;};'use strict';var crypto=require(_0x1085('0x0'));var util=require(_0x1085('0x1'));var _=require(_0x1085('0x2'));var moment=require(_0x1085('0x3'));var hardware=require('./hardware');var config=require(_0x1085('0x4'));var db=require(_0x1085('0x5'))['db'];function checkLicense(_0x2de96f,_0x3cbd88){if(_0x2de96f){try{var _0x3b40fb=_0x3cbd88||_0x2de96f[_0x1085('0x6')];if(_[_0x1085('0x7')](_0x3b40fb)){throw new Error(_0x1085('0x8'));}var _0x152eeb=_0x2de96f[_0x1085('0x9')];var _0x33dd2b=_0x2de96f[_0x1085('0xa')];var _0x546546=_0x152eeb['split']('-')[0x4];var _0x114b8b=_0x152eeb[_0x1085('0xb')]('-')[0x0];var _0x41b586=crypto[_0x1085('0xc')](_0x1085('0xd'),util[_0x1085('0xe')]('%s:%s:%s',_0x546546,_0x152eeb,_0x114b8b));var _0x1f84a9=_0x41b586[_0x1085('0xf')](_0x3b40fb,_0x1085('0x10'),_0x1085('0x11'));_0x1f84a9+=_0x41b586[_0x1085('0x12')](_0x1085('0x11'));var _0x7e46fb=JSON[_0x1085('0x13')](_0x1f84a9);_0x7e46fb[_0x1085('0x14')]=![];_0x7e46fb[_0x1085('0x15')]=_0x152eeb;_0x7e46fb[_0x1085('0x16')]=hardware['getUuid']();if(_0x33dd2b){var _0xf5fd55=crypto['createDecipher'](_0x1085('0xd'),config[_0x1085('0x17')][_0x1085('0x18')]);var _0x58e0bf=_0xf5fd55[_0x1085('0xf')](_0x33dd2b,_0x1085('0x10'),_0x1085('0x11'));_0x58e0bf+=_0xf5fd55[_0x1085('0x12')]('utf8');_0x7e46fb[_0x1085('0x19')]=_0x58e0bf;_0x7e46fb['deadline']=moment(_0x58e0bf)[_0x1085('0x1a')](0x7,'days')[_0x1085('0xe')]();_0x7e46fb[_0x1085('0x1b')]=_0x7e46fb[_0x1085('0x15')]!=_0x7e46fb['machineUuid']?_0x1085('0x1c'):'disabled';}return _0x7e46fb;}catch(_0xc4b25){return{'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':'Breaking\x20license','uuid':_0x2de96f['data1'],'machineUuid':hardware['getUuid'](),'message':_0xc4b25[_0x1085('0x1d')],'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};}}return{'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':'Demo\x20license','uuid':_0x2de96f['data1'],'machineUuid':hardware[_0x1085('0x1e')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};}exports[_0x1085('0x1f')]=function(_0x33c865){return db['License'][_0x1085('0x20')](_[_0x1085('0x21')](_0x33c865,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0x12296b){return checkLicense(_0x12296b,null);});};exports['checkLicense']=checkLicense; \ No newline at end of file +var _0xfb16=['getLicense','License','defaults','checkLicense','crypto','util','lodash','./hardware','../environment','../../mysqldb','license','isEmpty','data1','data2','split','createDecipher','aes-256-ctr','format','base64','utf8','final','parse','demo','uuid','getUuid','secrets','session','update','gray','days','grayReason','changed','disabled','2027-01-01T00:00:00.000Z','Breaking\x20license'];(function(_0x2e5eb3,_0x595224){var _0x3c090a=function(_0x59bde4){while(--_0x59bde4){_0x2e5eb3['push'](_0x2e5eb3['shift']());}};_0x3c090a(++_0x595224);}(_0xfb16,0xd6));var _0x6fb1=function(_0x26aba0,_0x3f8df6){_0x26aba0=_0x26aba0-0x0;var _0x3c8b6a=_0xfb16[_0x26aba0];return _0x3c8b6a;};'use strict';var crypto=require(_0x6fb1('0x0'));var util=require(_0x6fb1('0x1'));var _=require(_0x6fb1('0x2'));var moment=require('moment');var hardware=require(_0x6fb1('0x3'));var config=require(_0x6fb1('0x4'));var db=require(_0x6fb1('0x5'))['db'];function checkLicense(_0x4979c2,_0x1d15e1){if(_0x4979c2){try{var _0x19f443=_0x1d15e1||_0x4979c2[_0x6fb1('0x6')];if(_[_0x6fb1('0x7')](_0x19f443)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0x3eec1e=_0x4979c2[_0x6fb1('0x8')];var _0xd7fa1b=_0x4979c2[_0x6fb1('0x9')];var _0x1d9f80=_0x3eec1e[_0x6fb1('0xa')]('-')[0x4];var _0x21b22e=_0x3eec1e['split']('-')[0x0];var _0x59fdcc=crypto[_0x6fb1('0xb')](_0x6fb1('0xc'),util[_0x6fb1('0xd')]('%s:%s:%s',_0x1d9f80,_0x3eec1e,_0x21b22e));var _0x371364=_0x59fdcc['update'](_0x19f443,_0x6fb1('0xe'),_0x6fb1('0xf'));_0x371364+=_0x59fdcc[_0x6fb1('0x10')](_0x6fb1('0xf'));var _0x13403b=JSON[_0x6fb1('0x11')](_0x371364);_0x13403b[_0x6fb1('0x12')]=![];_0x13403b[_0x6fb1('0x13')]=_0x3eec1e;_0x13403b['machineUuid']=hardware[_0x6fb1('0x14')]();if(_0xd7fa1b){var _0x2aed89=crypto[_0x6fb1('0xb')]('aes-256-ctr',config[_0x6fb1('0x15')][_0x6fb1('0x16')]);var _0x30998f=_0x2aed89[_0x6fb1('0x17')](_0xd7fa1b,_0x6fb1('0xe'),'utf8');_0x30998f+=_0x2aed89['final'](_0x6fb1('0xf'));_0x13403b[_0x6fb1('0x18')]=_0x30998f;_0x13403b['deadline']=moment(_0x30998f)['add'](0x7,_0x6fb1('0x19'))['format']();_0x13403b[_0x6fb1('0x1a')]=_0x13403b[_0x6fb1('0x13')]!=_0x13403b['machineUuid']?_0x6fb1('0x1b'):_0x6fb1('0x1c');}return _0x13403b;}catch(_0x22a099){return{'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x6fb1('0x1d'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x6fb1('0x1e'),'uuid':_0x4979c2[_0x6fb1('0x8')],'machineUuid':hardware['getUuid'](),'message':_0x22a099['message'],'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};}}return{'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x6fb1('0x1d'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':'Demo\x20license','uuid':_0x4979c2[_0x6fb1('0x8')],'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};}exports[_0x6fb1('0x1f')]=function(_0x5c64a0){return db[_0x6fb1('0x20')]['find'](_[_0x6fb1('0x21')](_0x5c64a0,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0x5771c5){return checkLicense(_0x5771c5,null);});};exports[_0x6fb1('0x22')]=checkLicense; \ No newline at end of file diff --git a/server/config/local.env.js b/server/config/local.env.js index 97445e2..2e80dbe 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 _0xbaf0=['app-id','secret','http://localhost:9000','myappanuglar-secret'];(function(_0x254076,_0x5e7b8d){var _0x21a93e=function(_0x26aa78){while(--_0x26aa78){_0x254076['push'](_0x254076['shift']());}};_0x21a93e(++_0x5e7b8d);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xbaf0[_0x2b4411];return _0x8e41ef;};'use strict';module['exports']={'DOMAIN':_0x0baf('0x0'),'SESSION_SECRET':_0x0baf('0x1'),'GOOGLE_ID':_0x0baf('0x2'),'GOOGLE_SECRET':_0x0baf('0x3'),'DEBUG':''}; \ No newline at end of file +var _0xaf4a=['secret','http://localhost:9000','myappanuglar-secret','app-id'];(function(_0x1b892b,_0x2fd2f4){var _0xee5602=function(_0x3d041e){while(--_0x3d041e){_0x1b892b['push'](_0x1b892b['shift']());}};_0xee5602(++_0x2fd2f4);}(_0xaf4a,0x101));var _0xaaf4=function(_0x552219,_0x570ebe){_0x552219=_0x552219-0x0;var _0x173919=_0xaf4a[_0x552219];return _0x173919;};'use strict';module['exports']={'DOMAIN':_0xaaf4('0x0'),'SESSION_SECRET':_0xaaf4('0x1'),'GOOGLE_ID':_0xaaf4('0x2'),'GOOGLE_SECRET':_0xaaf4('0x3'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 32d208c..e846440 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x94e7=['[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','message','exports','Logger','transports','%s-%s','error','File','info','Console','env','winston','util','path','join','/var','log','xcally','format','%s-%s.log'];(function(_0x29aa42,_0x302f20){var _0x321aca=function(_0x2a2c46){while(--_0x2a2c46){_0x29aa42['push'](_0x29aa42['shift']());}};_0x321aca(++_0x302f20);}(_0x94e7,0xc6));var _0x794e=function(_0x227938,_0x5546b7){_0x227938=_0x227938-0x0;var _0x34d4bb=_0x94e7[_0x227938];return _0x34d4bb;};'use strict';var moment=require('moment');var winston=require(_0x794e('0x0'));var util=require(_0x794e('0x1'));var path=require(_0x794e('0x2'));var debugLevel='INFO';function filename(_0x28736a,_0x928401){return path[_0x794e('0x3')](_0x794e('0x4'),_0x794e('0x5'),_0x794e('0x6'),util[_0x794e('0x7')](_0x794e('0x8'),_0x28736a,_0x928401));}function formatter(_0xa6397e,_0x476204){return util[_0x794e('0x7')](_0x794e('0x9'),moment()['format'](_0x794e('0xa')),_0x476204[_0x794e('0xb')][_0x794e('0xc')](),_0xa6397e,_0x476204[_0x794e('0xd')]);}module[_0x794e('0xe')]=function(_0x1b767d){return new winston[(_0x794e('0xf'))]({'transports':[new winston[(_0x794e('0x10'))]['File']({'name':util[_0x794e('0x7')](_0x794e('0x11'),_0x1b767d,_0x794e('0x12')),'filename':filename(_0x1b767d,_0x794e('0x12')),'level':_0x794e('0x12'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x14fd0d){return formatter(_0x1b767d,_0x14fd0d);}}),new winston[(_0x794e('0x10'))][(_0x794e('0x13'))]({'name':util[_0x794e('0x7')]('%s-%s',_0x1b767d,_0x794e('0x14')),'filename':filename(_0x1b767d,_0x794e('0x14')),'level':_0x794e('0x14'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x5760a5){return formatter(_0x1b767d,_0x5760a5);}}),new winston['transports'][(_0x794e('0x15'))]({'level':process[_0x794e('0x16')]['debugLevel']||debugLevel,'json':![],'formatter':function(_0x39290b){return formatter(_0x1b767d,_0x39290b);}})]});}; \ No newline at end of file +var _0x1c91=['%s-%s','error','transports','info','debugLevel','moment','util','path','INFO','join','/var','log','%s-%s.log','format','YYYY-MM-DD\x20HH:mm:ss','level','message','exports','File'];(function(_0x474cab,_0x122115){var _0x2347b2=function(_0x3f4ad4){while(--_0x3f4ad4){_0x474cab['push'](_0x474cab['shift']());}};_0x2347b2(++_0x122115);}(_0x1c91,0x194));var _0x11c9=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0x1c91[_0x5c3c0b];return _0x52ecd2;};'use strict';var moment=require(_0x11c9('0x0'));var winston=require('winston');var util=require(_0x11c9('0x1'));var path=require(_0x11c9('0x2'));var debugLevel=_0x11c9('0x3');function filename(_0x22a6e2,_0x26d5c1){return path[_0x11c9('0x4')](_0x11c9('0x5'),_0x11c9('0x6'),'xcally',util['format'](_0x11c9('0x7'),_0x22a6e2,_0x26d5c1));}function formatter(_0x4317f4,_0x403b78){return util['format']('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()[_0x11c9('0x8')](_0x11c9('0x9')),_0x403b78[_0x11c9('0xa')]['toUpperCase'](),_0x4317f4,_0x403b78[_0x11c9('0xb')]);}module[_0x11c9('0xc')]=function(_0x252cf9){return new winston['Logger']({'transports':[new winston['transports'][(_0x11c9('0xd'))]({'name':util[_0x11c9('0x8')](_0x11c9('0xe'),_0x252cf9,_0x11c9('0xf')),'filename':filename(_0x252cf9,_0x11c9('0xf')),'level':_0x11c9('0xf'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x5c05db){return formatter(_0x252cf9,_0x5c05db);}}),new winston[(_0x11c9('0x10'))][(_0x11c9('0xd'))]({'name':util[_0x11c9('0x8')]('%s-%s',_0x252cf9,'info'),'filename':filename(_0x252cf9,'info'),'level':_0x11c9('0x11'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x4e6bbd){return formatter(_0x252cf9,_0x4e6bbd);}}),new winston[(_0x11c9('0x10'))]['Console']({'level':process['env'][_0x11c9('0x12')]||debugLevel,'json':![],'formatter':function(_0x4f55b2){return formatter(_0x252cf9,_0x4f55b2);}})]});}; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 51b2364..75b5025 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 _0x5a52=['exports','path','ami','join','../../services/ami/index.js','agi','../../services/agi/index.js','email','routing','../../services/routing/index.js','xdr','../../services/xdr/index.js'];(function(_0x57f2e1,_0x14e4e5){var _0x2d9d84=function(_0x2298d9){while(--_0x2298d9){_0x57f2e1['push'](_0x57f2e1['shift']());}};_0x2d9d84(++_0x14e4e5);}(_0x5a52,0x18d));var _0x25a5=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x5a52[_0x14add3];return _0x4a174f;};'use strict';var path=require(_0x25a5('0x0'));var os=require('os');var config={'apps':[{'name':'express','script':path['join'](__dirname,'../../services/express/index.js')},{'name':_0x25a5('0x1'),'script':path[_0x25a5('0x2')](__dirname,_0x25a5('0x3'))},{'name':_0x25a5('0x4'),'script':path[_0x25a5('0x2')](__dirname,_0x25a5('0x5'))},{'name':_0x25a5('0x6'),'script':path[_0x25a5('0x2')](__dirname,'../../services/email/index.js')},{'name':_0x25a5('0x7'),'script':path['join'](__dirname,_0x25a5('0x8'))},{'name':_0x25a5('0x9'),'script':path[_0x25a5('0x2')](__dirname,_0x25a5('0xa'))}]};module[_0x25a5('0xb')]=config; \ No newline at end of file +var _0xee44=['../../services/xdr/index.js','exports','path','express','join','../../services/agi/index.js','../../services/routing/index.js'];(function(_0x444aed,_0x97bad6){var _0x4763b9=function(_0x230b6e){while(--_0x230b6e){_0x444aed['push'](_0x444aed['shift']());}};_0x4763b9(++_0x97bad6);}(_0xee44,0xaa));var _0x4ee4=function(_0x1daeea,_0x7fc90b){_0x1daeea=_0x1daeea-0x0;var _0x19d98c=_0xee44[_0x1daeea];return _0x19d98c;};'use strict';var path=require(_0x4ee4('0x0'));var os=require('os');var config={'apps':[{'name':_0x4ee4('0x1'),'script':path['join'](__dirname,'../../services/express/index.js')},{'name':'ami','script':path[_0x4ee4('0x2')](__dirname,'../../services/ami/index.js')},{'name':'agi','script':path[_0x4ee4('0x2')](__dirname,_0x4ee4('0x3'))},{'name':'email','script':path[_0x4ee4('0x2')](__dirname,'../../services/email/index.js')},{'name':'routing','script':path[_0x4ee4('0x2')](__dirname,_0x4ee4('0x4'))},{'name':'xdr','script':path['join'](__dirname,_0x4ee4('0x5'))}]};module[_0x4ee4('0x6')]=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index e8e7a10..4a6e8d8 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 _0x4c41=['dump','saved','pm2','bluebird','./config','then','start','disconnect','stop','restart','describe','delete'];(function(_0x239f41,_0x40443d){var _0x37efe0=function(_0x2d9118){while(--_0x2d9118){_0x239f41['push'](_0x239f41['shift']());}};_0x37efe0(++_0x40443d);}(_0x4c41,0xda));var _0x14c4=function(_0x4c79b0,_0x47ba50){_0x4c79b0=_0x4c79b0-0x0;var _0x2bb939=_0x4c41[_0x4c79b0];return _0x2bb939;};'use strict';var pm2=require(_0x14c4('0x0'));var BPromise=require(_0x14c4('0x1'));var config=require(_0x14c4('0x2'));function connect(){return new BPromise(function(_0xedf55c,_0x586678){return pm2['connect'](function(_0x3a08cc){if(_0x3a08cc){return _0x586678(_0x3a08cc);}return _0xedf55c('connected');});});};exports['start']=function(_0x1a7572){return connect()[_0x14c4('0x3')](function(){return new BPromise(function(_0x42d8ce,_0x412091){return pm2[_0x14c4('0x4')](_0x1a7572,function(_0x356a5e,_0x562702){if(_0x356a5e){return _0x412091(_0x356a5e);}pm2[_0x14c4('0x5')]();return _0x42d8ce(_0x562702);});});});};exports[_0x14c4('0x6')]=function(_0x5133b1){return connect()[_0x14c4('0x3')](function(){return new BPromise(function(_0x4086cf,_0x39343c){return pm2['stop'](_0x5133b1,function(_0x2ea67a,_0x438420){if(_0x2ea67a){return _0x39343c(_0x2ea67a);}pm2['disconnect']();return _0x4086cf(_0x438420);});});});};exports[_0x14c4('0x7')]=function(_0x15ea33){return connect()[_0x14c4('0x3')](function(){return new BPromise(function(_0x1fb0a8,_0x4c8ea3){return pm2[_0x14c4('0x7')](_0x15ea33,function(_0x523ac3,_0x50d681){if(_0x523ac3){return _0x4c8ea3(_0x523ac3);}pm2[_0x14c4('0x5')]();return _0x1fb0a8(_0x50d681);});});});};exports['list']=function(){return connect()['then'](function(){return new BPromise(function(_0x2e610c,_0xba78c8){return pm2['list'](function(_0x380b5c,_0x2a212d){if(_0x380b5c){return _0xba78c8(_0x380b5c);}pm2['disconnect']();return _0x2e610c(_0x2a212d);});});});};exports[_0x14c4('0x8')]=function(_0x468fec){return connect()[_0x14c4('0x3')](function(){return new BPromise(function(_0x42a787,_0x2b81c1){return pm2[_0x14c4('0x8')](_0x468fec,function(_0x2d874a,_0x57cf0f){if(_0x2d874a){return _0x2b81c1(_0x2d874a);}pm2['disconnect']();return _0x42a787(_0x57cf0f);});});});};exports[_0x14c4('0x9')]=function(_0x314efc){return connect()[_0x14c4('0x3')](function(){return new BPromise(function(_0x48e99d,_0x177803){return pm2['delete'](_0x314efc,function(_0x16b660,_0xf266a2){if(_0x16b660){return _0x177803(_0x16b660);}pm2[_0x14c4('0x5')]();return _0x48e99d(_0xf266a2);});});});};exports[_0x14c4('0xa')]=function(){return connect()[_0x14c4('0x3')](function(){return new BPromise(function(_0x54f3b1,_0x39a419){return pm2['dump'](function(_0x323d5e){if(_0x323d5e){return _0x39a419(_0x323d5e);}return _0x54f3b1(_0x14c4('0xb'));});});});}; \ No newline at end of file +var _0xbb05=['then','start','disconnect','stop','list','describe','delete','dump','saved','pm2','bluebird','./config','connect'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbb05,0x1b6));var _0x5bb0=function(_0x284663,_0x276adc){_0x284663=_0x284663-0x0;var _0x586732=_0xbb05[_0x284663];return _0x586732;};'use strict';var pm2=require(_0x5bb0('0x0'));var BPromise=require(_0x5bb0('0x1'));var config=require(_0x5bb0('0x2'));function connect(){return new BPromise(function(_0x5ba39c,_0x32a0c0){return pm2[_0x5bb0('0x3')](function(_0x2d4fbf){if(_0x2d4fbf){return _0x32a0c0(_0x2d4fbf);}return _0x5ba39c('connected');});});};exports['start']=function(_0x277f3f){return connect()[_0x5bb0('0x4')](function(){return new BPromise(function(_0x5541c7,_0x5854e0){return pm2[_0x5bb0('0x5')](_0x277f3f,function(_0x8a1827,_0x41d2c2){if(_0x8a1827){return _0x5854e0(_0x8a1827);}pm2[_0x5bb0('0x6')]();return _0x5541c7(_0x41d2c2);});});});};exports['stop']=function(_0x5145b3){return connect()[_0x5bb0('0x4')](function(){return new BPromise(function(_0x17d3a6,_0xae520a){return pm2[_0x5bb0('0x7')](_0x5145b3,function(_0x28db68,_0x4f6812){if(_0x28db68){return _0xae520a(_0x28db68);}pm2[_0x5bb0('0x6')]();return _0x17d3a6(_0x4f6812);});});});};exports['restart']=function(_0x401249){return connect()[_0x5bb0('0x4')](function(){return new BPromise(function(_0x4b0ab3,_0x4bdf12){return pm2['restart'](_0x401249,function(_0x525c56,_0x38388a){if(_0x525c56){return _0x4bdf12(_0x525c56);}pm2[_0x5bb0('0x6')]();return _0x4b0ab3(_0x38388a);});});});};exports[_0x5bb0('0x8')]=function(){return connect()[_0x5bb0('0x4')](function(){return new BPromise(function(_0x244243,_0x2f399a){return pm2[_0x5bb0('0x8')](function(_0x387add,_0x39cd4f){if(_0x387add){return _0x2f399a(_0x387add);}pm2[_0x5bb0('0x6')]();return _0x244243(_0x39cd4f);});});});};exports[_0x5bb0('0x9')]=function(_0x228038){return connect()[_0x5bb0('0x4')](function(){return new BPromise(function(_0x1d8c93,_0x25578e){return pm2['describe'](_0x228038,function(_0x28043c,_0xedf507){if(_0x28043c){return _0x25578e(_0x28043c);}pm2[_0x5bb0('0x6')]();return _0x1d8c93(_0xedf507);});});});};exports[_0x5bb0('0xa')]=function(_0x46bf39){return connect()['then'](function(){return new BPromise(function(_0x2c50f9,_0x55048a){return pm2[_0x5bb0('0xa')](_0x46bf39,function(_0x17d9c0,_0x2028cf){if(_0x17d9c0){return _0x55048a(_0x17d9c0);}pm2['disconnect']();return _0x2c50f9(_0x2028cf);});});});};exports[_0x5bb0('0xb')]=function(){return connect()[_0x5bb0('0x4')](function(){return new BPromise(function(_0x5f5b59,_0x1e8315){return pm2[_0x5bb0('0xb')](function(_0x5966e7){if(_0x5966e7){return _0x1e8315(_0x5966e7);}return _0x5f5b59(_0x5bb0('0xc'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 22c7f29..d00a51e 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 _0x1f02=['../../config/environment','redis','localhost','socket.io-emitter','Setting','find','chatTimeout','then','ChatInteraction','findAll','lastMsgAt','minutes','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','map','length','catch','error','start','lodash','moment','ioredis','../../mysqldb'];(function(_0xbd86b3,_0x36081b){var _0x8f988=function(_0xbf5d2b){while(--_0xbf5d2b){_0xbd86b3['push'](_0xbd86b3['shift']());}};_0x8f988(++_0x36081b);}(_0x1f02,0x1d0));var _0x21f0=function(_0x337178,_0x4f6cc7){_0x337178=_0x337178-0x0;var _0x366967=_0x1f02[_0x337178];return _0x366967;};'use strict';var _=require(_0x21f0('0x0'));var moment=require(_0x21f0('0x1'));var Redis=require(_0x21f0('0x2'));var db=require(_0x21f0('0x3'))['db'];var config=require(_0x21f0('0x4'));config[_0x21f0('0x5')]=_['defaults'](config[_0x21f0('0x5')],{'host':_0x21f0('0x6'),'port':0x18eb});var io=require(_0x21f0('0x7'))(new Redis(config[_0x21f0('0x5')]));function closeInteractions(){var _0x267a48=0x0;var _0xdb794c=[];return db[_0x21f0('0x8')][_0x21f0('0x9')]({'raw':!![],'attributes':['id',_0x21f0('0xa')],'where':{'id':0x1}})[_0x21f0('0xb')](function(_0x5b7539){_0x267a48=_0x5b7539[_0x21f0('0xa')];if(_0x267a48){return db[_0x21f0('0xc')][_0x21f0('0xd')]({'raw':!![],'attributes':['id',_0x21f0('0xe')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()['subtract'](_0x5b7539[_0x21f0('0xa')],_0x21f0('0xf'))}}});}else{return[];}})[_0x21f0('0xb')](function(_0x4b9bc2){_0xdb794c=_0x4b9bc2;if(_0x267a48){return db['ChatInteraction'][_0x21f0('0x10')]({'closeReason':_0x21f0('0x11'),'disposition':_0x21f0('0x12'),'closed':!![],'closedAt':moment()[_0x21f0('0x13')](_0x21f0('0x14'))},{'where':{'id':_[_0x21f0('0x15')](_0xdb794c||[],'id')}});}})['then'](function(_0x5bd60e){for(var _0x2ec450=0x0;_0x2ec450<_0xdb794c[_0x21f0('0x16')];_0x2ec450++){io['emit']('chatInteraction:update',{'id':_0xdb794c[_0x2ec450]['id'],'closed':!![]});}})[_0x21f0('0x17')](function(_0x1817cc){console[_0x21f0('0x18')](_0x1817cc);});}exports[_0x21f0('0x19')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x6b22=['chatTimeout','ChatInteraction','findAll','lastMsgAt','subtract','minutes','then','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','length','emit','chatInteraction:update','catch','lodash','moment','../../config/environment','redis','defaults'];(function(_0x4824f8,_0x29ebf6){var _0x23bc94=function(_0x5d7f25){while(--_0x5d7f25){_0x4824f8['push'](_0x4824f8['shift']());}};_0x23bc94(++_0x29ebf6);}(_0x6b22,0x136));var _0x26b2=function(_0x483a8f,_0x31fcd6){_0x483a8f=_0x483a8f-0x0;var _0x4079bc=_0x6b22[_0x483a8f];return _0x4079bc;};'use strict';var _=require(_0x26b2('0x0'));var moment=require(_0x26b2('0x1'));var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var config=require(_0x26b2('0x2'));config[_0x26b2('0x3')]=_[_0x26b2('0x4')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function closeInteractions(){var _0xcd460a=0x0;var _0x5e0795=[];return db['Setting']['find']({'raw':!![],'attributes':['id',_0x26b2('0x5')],'where':{'id':0x1}})['then'](function(_0x5a9eaa){_0xcd460a=_0x5a9eaa[_0x26b2('0x5')];if(_0xcd460a){return db[_0x26b2('0x6')][_0x26b2('0x7')]({'raw':!![],'attributes':['id',_0x26b2('0x8')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x26b2('0x9')](_0x5a9eaa['chatTimeout'],_0x26b2('0xa'))}}});}else{return[];}})[_0x26b2('0xb')](function(_0x2adedc){_0x5e0795=_0x2adedc;if(_0xcd460a){return db[_0x26b2('0x6')][_0x26b2('0xc')]({'closeReason':_0x26b2('0xd'),'disposition':_0x26b2('0xe'),'closed':!![],'closedAt':moment()[_0x26b2('0xf')](_0x26b2('0x10'))},{'where':{'id':_['map'](_0x5e0795||[],'id')}});}})[_0x26b2('0xb')](function(_0x1a967b){for(var _0x550d95=0x0;_0x550d95<_0x5e0795[_0x26b2('0x11')];_0x550d95++){io[_0x26b2('0x12')](_0x26b2('0x13'),{'id':_0x5e0795[_0x550d95]['id'],'closed':!![]});}})[_0x26b2('0x14')](function(_0x9d6111){console['error'](_0x9d6111);});}exports['start']=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 97b4dec..cbb60eb 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 _0x52be=['add','start','add\x20cron','deleteJob','stop\x20cron','isBetween','update','update\x20cron','path','lodash','jayson/promise','bluebird','../logger','schedule','../../api/analyticDefaultReport/analyticDefaultReport.controller','http','info','Try\x20to\x20send\x20a\x20mail\x20to','MailAccount','Smtp','service','port','secure','authentication','user','name','email','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','savename','format','%s.%s','basename','zip','join','existsSync','status','Sent','message','attachments','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','empty\x20file,\x20email\x20not\x20sent','request','SendMail','then','error','error\x20mail','email\x20sent','catch','data','isNil','subtractUnit','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','exec\x20custom\x20report\x20id:%s','CustomReportId','runReport','no\x20report\x20id','Schedule','MailServerOut','map','toString','keyBy','intersection','difference','length','exists','stop','delete\x20cron','toRun','index','resolve','run\x20job','cron','active','startAt'];(function(_0x2bf3cd,_0x4dd81b){var _0x337f79=function(_0x2f8046){while(--_0x2f8046){_0x2bf3cd['push'](_0x2bf3cd['shift']());}};_0x337f79(++_0x4dd81b);}(_0x52be,0x1a2));var _0xe52b=function(_0x595604,_0x2cc998){_0x595604=_0x595604-0x0;var _0x1466f3=_0x52be[_0x595604];return _0x1466f3;};'use strict';var fs=require('fs');var util=require('util');var path=require(_0xe52b('0x0'));var _=require(_0xe52b('0x1'));var moment=require('moment');var CronJobManager=require('cron-job-manager');var jayson=require(_0xe52b('0x2'));var BPromise=require(_0xe52b('0x3'));var logger=require(_0xe52b('0x4'))(_0xe52b('0x5'));var db=require('../../mysqldb')['db'];var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require(_0xe52b('0x6'));var client=jayson['client'][_0xe52b('0x7')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x28ce7e,_0x4395ad){return function(){logger[_0xe52b('0x8')](_0xe52b('0x9'),_0x28ce7e['email']);var _0x5d9289=!![];var _0x36ca90={'tls':{'rejectUnauthorized':![]}};if(_0x28ce7e[_0xe52b('0xa')][_0xe52b('0xb')][_0xe52b('0xc')]){_0x36ca90[_0xe52b('0xc')]=_0x28ce7e[_0xe52b('0xa')][_0xe52b('0xb')][_0xe52b('0xc')];}else{_0x36ca90['host']=_0x28ce7e[_0xe52b('0xa')][_0xe52b('0xb')]['host'];_0x36ca90[_0xe52b('0xd')]=_0x28ce7e[_0xe52b('0xa')][_0xe52b('0xb')][_0xe52b('0xd')];_0x36ca90[_0xe52b('0xe')]=_0x28ce7e[_0xe52b('0xa')]['Smtp']['secure'];}if(_0x28ce7e[_0xe52b('0xa')]['Smtp'][_0xe52b('0xf')]){_0x36ca90['auth']={'user':_0x28ce7e['MailAccount'][_0xe52b('0xb')][_0xe52b('0x10')],'pass':_0x28ce7e['MailAccount'][_0xe52b('0xb')]['pass']};}var _0x2575b6={'account':_0x36ca90,'message':{'from':util['format']('\x22%s\x22\x20<%s>',_0x28ce7e[_0xe52b('0xa')][_0xe52b('0x11')],_0x28ce7e[_0xe52b('0xa')][_0xe52b('0x12')]||_0x28ce7e[_0xe52b('0xa')][_0xe52b('0xb')]['user']),'to':_0x28ce7e[_0xe52b('0x12')],'cc':_0x28ce7e['cc'],'bcc':_0x28ce7e[_0xe52b('0x13')],'subject':util['format'](_0xe52b('0x14'),_0x4395ad[_0xe52b('0x11')],_0x28ce7e[_0xe52b('0x15')],_0x28ce7e['subtractUnit'])}};var _0x1dbb21=path['join'](__dirname,'../../files/reports');var _0x56e581=_0x4395ad[_0xe52b('0x16')];var _0x276596=util[_0xe52b('0x17')](_0xe52b('0x18'),path[_0xe52b('0x19')](_0x4395ad[_0xe52b('0x16')],path['extname'](_0x4395ad[_0xe52b('0x16')])),_0xe52b('0x1a'));var _0x4e431b=path[_0xe52b('0x1b')](_0x1dbb21,_0x56e581);var _0x423279=path['join'](_0x1dbb21,_0x276596);if(fs[_0xe52b('0x1c')](_0x4e431b)){_0x4395ad[_0xe52b('0x1d')]=_0xe52b('0x1e');_0x2575b6[_0xe52b('0x1f')][_0xe52b('0x20')]=[{'filename':_0x56e581,'path':_0x4e431b}];_0x2575b6[_0xe52b('0x1f')]['text']=util[_0xe52b('0x17')](_0xe52b('0x21'),JSON[_0xe52b('0x22')](_0x4395ad,null,0x2));}else if(fs[_0xe52b('0x1c')](_0x423279)){_0x4395ad[_0xe52b('0x1d')]=_0xe52b('0x1e');_0x2575b6[_0xe52b('0x1f')][_0xe52b('0x20')]=[{'filename':_0x276596,'path':_0x423279}];}else{_0x2575b6[_0xe52b('0x1f')]['text']=_0xe52b('0x23');if(!_0x28ce7e['sendIfEmpty']){_0x5d9289=![];logger[_0xe52b('0x8')](_0xe52b('0x24'));}}if(_0x5d9289){return client[_0xe52b('0x25')](_0xe52b('0x26'),_0x2575b6)[_0xe52b('0x27')](function(_0x58eaaf){if(_0x58eaaf['error']){return logger[_0xe52b('0x28')](_0xe52b('0x29'),JSON[_0xe52b('0x22')](_0x58eaaf));}return logger[_0xe52b('0x8')](_0xe52b('0x2a'));})[_0xe52b('0x2b')](function(_0x27a968){return logger['error'](_0xe52b('0x29'),JSON[_0xe52b('0x22')](_0x27a968));});}};}function handleError(){return function(_0x3344ca){return logger[_0xe52b('0x28')](JSON[_0xe52b('0x22')](_0x3344ca));};}function handleResult(_0xfa447c){return function(_0xf0dcb6){logger[_0xe52b('0x8')](_0xe52b('0x2c'),JSON['stringify'](_0xf0dcb6));if(_0xfa447c[_0xe52b('0xa')]&&_0xfa447c[_0xe52b('0xa')]['Smtp']&&!_[_0xe52b('0x2d')](_0xfa447c[_0xe52b('0x12')])){setTimeout(handleSendEmail(_0xfa447c,_0xf0dcb6),0x3c*0x3e8);}};}function handleJob(_0x225609){return function(){try{if(_[_0xe52b('0x2d')](_0x225609[_0xe52b('0x15')])){return logger[_0xe52b('0x8')]('subtractNumber\x20null\x20or\x20undefined');}if(_[_0xe52b('0x2d')](_0x225609[_0xe52b('0x2e')])){return logger[_0xe52b('0x8')]('subtractUnit\x20null\x20or\x20undefined');}var _0x49e48d={'startDate':moment()[_0xe52b('0x2f')](_0x225609[_0xe52b('0x15')],_0x225609[_0xe52b('0x2e')])[_0xe52b('0x17')](_0xe52b('0x30')),'endDate':moment()[_0xe52b('0x17')]('YYYY-MM-DD\x20HH:mm:ss'),'type':_0xe52b('0x31'),'output':_0x225609[_0xe52b('0x32')],'name':_0x225609[_0xe52b('0x11')]};if(!_[_0xe52b('0x2d')](_0x225609[_0xe52b('0x33')])){logger[_0xe52b('0x8')]('exec\x20defaul\x20report\x20id:%s',_0x225609[_0xe52b('0x33')]);return analyticDefaultReportController['runReport']({'id':_0x225609[_0xe52b('0x33')]},_0x49e48d)[_0xe52b('0x27')](handleResult(_0x225609))[_0xe52b('0x2b')](handleError());}if(!_[_0xe52b('0x2d')](_0x225609['CustomReportId'])){logger[_0xe52b('0x8')](_0xe52b('0x34'),_0x225609[_0xe52b('0x35')]);return analyticCustomReportController[_0xe52b('0x36')]({'id':_0x225609[_0xe52b('0x35')]},_0x49e48d)[_0xe52b('0x27')](handleResult(_0x225609))[_0xe52b('0x2b')](handleError());}}catch(_0x192689){logger['error'](JSON[_0xe52b('0x22')](_0x192689));}return logger[_0xe52b('0x8')](_0xe52b('0x37'));};}function getJobs(_0x322839){var _0xca9267={};if(_0x322839){_0xca9267['id']=_0x322839;}return db[_0xe52b('0x38')]['findAll']({'where':_0xca9267,'include':[{'model':db[_0xe52b('0xa')],'attributes':['id',_0xe52b('0x11'),_0xe52b('0x12')],'include':[{'model':db[_0xe52b('0x39')],'as':_0xe52b('0xb')}]}]})[_0xe52b('0x27')](function(_0x36a0fd){var _0x5d00f6=_['keys'](manager['jobs']);var _0xdc3ea4=_[_0xe52b('0x3a')](_0x36a0fd,function(_0x33126b){return _0x33126b['id'][_0xe52b('0x3b')]();});var _0x252f09=_[_0xe52b('0x3c')](_0x36a0fd,function(_0x4a01d3){return _0x4a01d3['id']['toString']();});var _0x4739ab=_0x322839?_0xdc3ea4:_['difference'](_0xdc3ea4,_0x5d00f6);var _0x41a1fa=_[_0xe52b('0x3d')](_0xdc3ea4,_0x5d00f6);var _0x1011ca=_[_0xe52b('0x3e')](_0x5d00f6,_0xdc3ea4);var _0x2bad08;var _0x2254cc;for(_0x2bad08=0x0;_0x2bad08<_0x1011ca[_0xe52b('0x3f')]&&!_0x322839;_0x2bad08+=0x1){_0x2254cc=_0x1011ca[_0x2bad08][_0xe52b('0x3b')]();if(manager[_0xe52b('0x40')](_0x2254cc)){manager[_0xe52b('0x41')](_0x2254cc);manager['deleteJob'](_0x2254cc);logger[_0xe52b('0x8')](_0xe52b('0x42'),_0x2254cc);}}logger['info'](_0xe52b('0x43'),JSON['stringify'](_0x4739ab));for(_0x2bad08=0x0;_0x2bad08<_0x4739ab[_0xe52b('0x3f')];_0x2bad08+=0x1){_0x2254cc=_0x4739ab[_0x2bad08][_0xe52b('0x3b')]();logger[_0xe52b('0x8')](_0xe52b('0x44'),_0x2254cc);if(_0x322839){logger[_0xe52b('0x8')]('my\x20id',_0x322839);logger[_0xe52b('0x8')](JSON['stringify'](_0x252f09[_0x2254cc]));BPromise[_0xe52b('0x45')]()['then'](handleJob(_0x252f09[_0x2254cc]));logger[_0xe52b('0x8')](_0xe52b('0x46'),_0x252f09[_0x2254cc]['name'],_0x252f09[_0x2254cc][_0xe52b('0x47')]);}else if(_0x252f09[_0x2254cc][_0xe52b('0x47')]&&_0x252f09[_0x2254cc][_0xe52b('0x48')]&&moment()['isBetween'](_0x252f09[_0x2254cc][_0xe52b('0x49')],_0x252f09[_0x2254cc]['endAt'])){manager[_0xe52b('0x4a')](_0x2254cc,_0x252f09[_0x2254cc][_0xe52b('0x47')],handleJob(_0x252f09[_0x2254cc]));manager[_0xe52b('0x4b')](_0x2254cc);logger[_0xe52b('0x8')](_0xe52b('0x4c'),_0x252f09[_0x2254cc]['name'],_0x252f09[_0x2254cc][_0xe52b('0x47')]);}else if(manager['exists'](_0x2254cc)){manager[_0xe52b('0x41')](_0x2254cc);manager[_0xe52b('0x4d')](_0x2254cc);logger[_0xe52b('0x8')](_0xe52b('0x4e'),_0x252f09[_0x2254cc][_0xe52b('0x11')],_0x252f09[_0x2254cc][_0xe52b('0x47')]);}}for(_0x2bad08=0x0,_0x2254cc;_0x2bad08<_0x41a1fa[_0xe52b('0x3f')]&&!_0x322839;_0x2bad08+=0x1){_0x2254cc=_0x41a1fa[_0x2bad08][_0xe52b('0x3b')]();if(manager[_0xe52b('0x40')](_0x2254cc)){if(_0x252f09[_0x2254cc]['cron']&&_0x252f09[_0x2254cc][_0xe52b('0x48')]&&moment()[_0xe52b('0x4f')](_0x252f09[_0x2254cc][_0xe52b('0x49')],_0x252f09[_0x2254cc]['endAt'])){manager[_0xe52b('0x50')](_0x2254cc,_0x252f09[_0x2254cc][_0xe52b('0x47')],handleJob(_0x252f09[_0x2254cc]));logger[_0xe52b('0x8')](_0xe52b('0x51'),_0x252f09[_0x2254cc][_0xe52b('0x11')],_0x252f09[_0x2254cc][_0xe52b('0x47')]);}else{manager[_0xe52b('0x41')](_0x2254cc);manager['deleteJob'](_0x2254cc);logger['info']('stop\x20cron',_0x252f09[_0x2254cc][_0xe52b('0x11')],_0x252f09[_0x2254cc][_0xe52b('0x47')]);}}}})[_0xe52b('0x2b')](function(_0x416fd1){logger[_0xe52b('0x28')](JSON[_0xe52b('0x22')](_0x416fd1));});}exports['run']=function(_0x45845a){return getJobs(_0x45845a);};exports[_0xe52b('0x4b')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0xefcf=['existsSync','Sent','message','attachments','stringify','status','text','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','info','SendMail','then','error','catch','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','exec\x20defaul\x20report\x20id:%s','DefaultReportId','runReport','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','Schedule','MailServerOut','keys','toString','intersection','difference','length','deleteJob','delete\x20cron','toRun','index','my\x20id','resolve','run\x20job','cron','active','startAt','endAt','add','start','add\x20cron','exists','stop','update','run','util','path','lodash','moment','cron-job-manager','schedule','../../api/analyticCustomReport/analyticCustomReport.controller','http','email','MailAccount','Smtp','service','host','port','secure','auth','user','pass','format','\x22%s\x22\x20<%s>','bcc','name','subtractNumber','join','../../files/reports','savename','%s.%s','basename','extname','zip'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xefcf,0x88));var _0xfefc=function(_0x546aaf,_0x1ed138){_0x546aaf=_0x546aaf-0x0;var _0x1cbf6d=_0xefcf[_0x546aaf];return _0x1cbf6d;};'use strict';var fs=require('fs');var util=require(_0xfefc('0x0'));var path=require(_0xfefc('0x1'));var _=require(_0xfefc('0x2'));var moment=require(_0xfefc('0x3'));var CronJobManager=require(_0xfefc('0x4'));var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require('../logger')(_0xfefc('0x5'));var db=require('../../mysqldb')['db'];var analyticCustomReportController=require(_0xfefc('0x6'));var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson['client'][_0xfefc('0x7')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0xe578e5,_0x7728f2){return function(){logger['info']('Try\x20to\x20send\x20a\x20mail\x20to',_0xe578e5[_0xfefc('0x8')]);var _0x56ec95=!![];var _0x34de5a={'tls':{'rejectUnauthorized':![]}};if(_0xe578e5[_0xfefc('0x9')][_0xfefc('0xa')][_0xfefc('0xb')]){_0x34de5a[_0xfefc('0xb')]=_0xe578e5[_0xfefc('0x9')][_0xfefc('0xa')][_0xfefc('0xb')];}else{_0x34de5a[_0xfefc('0xc')]=_0xe578e5[_0xfefc('0x9')]['Smtp']['host'];_0x34de5a[_0xfefc('0xd')]=_0xe578e5['MailAccount'][_0xfefc('0xa')][_0xfefc('0xd')];_0x34de5a[_0xfefc('0xe')]=_0xe578e5[_0xfefc('0x9')][_0xfefc('0xa')]['secure'];}if(_0xe578e5['MailAccount'][_0xfefc('0xa')]['authentication']){_0x34de5a[_0xfefc('0xf')]={'user':_0xe578e5['MailAccount'][_0xfefc('0xa')][_0xfefc('0x10')],'pass':_0xe578e5[_0xfefc('0x9')]['Smtp'][_0xfefc('0x11')]};}var _0x382618={'account':_0x34de5a,'message':{'from':util[_0xfefc('0x12')](_0xfefc('0x13'),_0xe578e5[_0xfefc('0x9')]['name'],_0xe578e5['MailAccount'][_0xfefc('0x8')]||_0xe578e5[_0xfefc('0x9')]['Smtp'][_0xfefc('0x10')]),'to':_0xe578e5[_0xfefc('0x8')],'cc':_0xe578e5['cc'],'bcc':_0xe578e5[_0xfefc('0x14')],'subject':util['format']('Report\x20%s\x20last\x20%s\x20%s',_0x7728f2[_0xfefc('0x15')],_0xe578e5[_0xfefc('0x16')],_0xe578e5['subtractUnit'])}};var _0x25a9d7=path[_0xfefc('0x17')](__dirname,_0xfefc('0x18'));var _0x5122e7=_0x7728f2[_0xfefc('0x19')];var _0x1a1485=util['format'](_0xfefc('0x1a'),path[_0xfefc('0x1b')](_0x7728f2['savename'],path[_0xfefc('0x1c')](_0x7728f2[_0xfefc('0x19')])),_0xfefc('0x1d'));var _0x208f1f=path[_0xfefc('0x17')](_0x25a9d7,_0x5122e7);var _0x526efb=path['join'](_0x25a9d7,_0x1a1485);if(fs[_0xfefc('0x1e')](_0x208f1f)){_0x7728f2['status']=_0xfefc('0x1f');_0x382618[_0xfefc('0x20')][_0xfefc('0x21')]=[{'filename':_0x5122e7,'path':_0x208f1f}];_0x382618[_0xfefc('0x20')]['text']=util[_0xfefc('0x12')]('Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a',JSON[_0xfefc('0x22')](_0x7728f2,null,0x2));}else if(fs[_0xfefc('0x1e')](_0x526efb)){_0x7728f2[_0xfefc('0x23')]='Sent';_0x382618['message']['attachments']=[{'filename':_0x1a1485,'path':_0x526efb}];}else{_0x382618[_0xfefc('0x20')][_0xfefc('0x24')]=_0xfefc('0x25');if(!_0xe578e5[_0xfefc('0x26')]){_0x56ec95=![];logger[_0xfefc('0x27')]('empty\x20file,\x20email\x20not\x20sent');}}if(_0x56ec95){return client['request'](_0xfefc('0x28'),_0x382618)[_0xfefc('0x29')](function(_0x294187){if(_0x294187[_0xfefc('0x2a')]){return logger['error']('error\x20mail',JSON[_0xfefc('0x22')](_0x294187));}return logger['info']('email\x20sent');})[_0xfefc('0x2b')](function(_0x57b8cb){return logger[_0xfefc('0x2a')]('error\x20mail',JSON[_0xfefc('0x22')](_0x57b8cb));});}};}function handleError(){return function(_0x59d6a2){return logger[_0xfefc('0x2a')](JSON['stringify'](_0x59d6a2));};}function handleResult(_0x24f2e8){return function(_0x5e6a11){logger[_0xfefc('0x27')]('data',JSON[_0xfefc('0x22')](_0x5e6a11));if(_0x24f2e8[_0xfefc('0x9')]&&_0x24f2e8[_0xfefc('0x9')][_0xfefc('0xa')]&&!_[_0xfefc('0x2c')](_0x24f2e8[_0xfefc('0x8')])){setTimeout(handleSendEmail(_0x24f2e8,_0x5e6a11),0x3c*0x3e8);}};}function handleJob(_0x235269){return function(){try{if(_[_0xfefc('0x2c')](_0x235269[_0xfefc('0x16')])){return logger['info'](_0xfefc('0x2d'));}if(_[_0xfefc('0x2c')](_0x235269[_0xfefc('0x2e')])){return logger['info'](_0xfefc('0x2f'));}var _0x5be3c1={'startDate':moment()[_0xfefc('0x30')](_0x235269['subtractNumber'],_0x235269['subtractUnit'])[_0xfefc('0x12')]('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()[_0xfefc('0x12')](_0xfefc('0x31')),'type':_0xfefc('0x32'),'output':_0x235269[_0xfefc('0x33')],'name':_0x235269['name']};if(!_['isNil'](_0x235269['DefaultReportId'])){logger[_0xfefc('0x27')](_0xfefc('0x34'),_0x235269[_0xfefc('0x35')]);return analyticDefaultReportController[_0xfefc('0x36')]({'id':_0x235269[_0xfefc('0x35')]},_0x5be3c1)[_0xfefc('0x29')](handleResult(_0x235269))[_0xfefc('0x2b')](handleError());}if(!_['isNil'](_0x235269[_0xfefc('0x37')])){logger['info'](_0xfefc('0x38'),_0x235269[_0xfefc('0x37')]);return analyticCustomReportController[_0xfefc('0x36')]({'id':_0x235269[_0xfefc('0x37')]},_0x5be3c1)['then'](handleResult(_0x235269))[_0xfefc('0x2b')](handleError());}}catch(_0x433400){logger[_0xfefc('0x2a')](JSON['stringify'](_0x433400));}return logger[_0xfefc('0x27')](_0xfefc('0x39'));};}function getJobs(_0x48369b){var _0x3763f2={};if(_0x48369b){_0x3763f2['id']=_0x48369b;}return db[_0xfefc('0x3a')]['findAll']({'where':_0x3763f2,'include':[{'model':db['MailAccount'],'attributes':['id',_0xfefc('0x15'),_0xfefc('0x8')],'include':[{'model':db[_0xfefc('0x3b')],'as':'Smtp'}]}]})[_0xfefc('0x29')](function(_0x4ff356){var _0x838bea=_[_0xfefc('0x3c')](manager['jobs']);var _0x18d7ad=_['map'](_0x4ff356,function(_0x422bb8){return _0x422bb8['id'][_0xfefc('0x3d')]();});var _0x5b725a=_['keyBy'](_0x4ff356,function(_0x582031){return _0x582031['id']['toString']();});var _0x4c9d76=_0x48369b?_0x18d7ad:_['difference'](_0x18d7ad,_0x838bea);var _0x32c64f=_[_0xfefc('0x3e')](_0x18d7ad,_0x838bea);var _0x13cd34=_[_0xfefc('0x3f')](_0x838bea,_0x18d7ad);var _0x5e1f85;var _0x209bc7;for(_0x5e1f85=0x0;_0x5e1f85<_0x13cd34[_0xfefc('0x40')]&&!_0x48369b;_0x5e1f85+=0x1){_0x209bc7=_0x13cd34[_0x5e1f85][_0xfefc('0x3d')]();if(manager['exists'](_0x209bc7)){manager['stop'](_0x209bc7);manager[_0xfefc('0x41')](_0x209bc7);logger[_0xfefc('0x27')](_0xfefc('0x42'),_0x209bc7);}}logger[_0xfefc('0x27')](_0xfefc('0x43'),JSON['stringify'](_0x4c9d76));for(_0x5e1f85=0x0;_0x5e1f85<_0x4c9d76[_0xfefc('0x40')];_0x5e1f85+=0x1){_0x209bc7=_0x4c9d76[_0x5e1f85][_0xfefc('0x3d')]();logger[_0xfefc('0x27')](_0xfefc('0x44'),_0x209bc7);if(_0x48369b){logger[_0xfefc('0x27')](_0xfefc('0x45'),_0x48369b);logger[_0xfefc('0x27')](JSON[_0xfefc('0x22')](_0x5b725a[_0x209bc7]));BPromise[_0xfefc('0x46')]()[_0xfefc('0x29')](handleJob(_0x5b725a[_0x209bc7]));logger['info'](_0xfefc('0x47'),_0x5b725a[_0x209bc7][_0xfefc('0x15')],_0x5b725a[_0x209bc7]['cron']);}else if(_0x5b725a[_0x209bc7][_0xfefc('0x48')]&&_0x5b725a[_0x209bc7][_0xfefc('0x49')]&&moment()['isBetween'](_0x5b725a[_0x209bc7][_0xfefc('0x4a')],_0x5b725a[_0x209bc7][_0xfefc('0x4b')])){manager[_0xfefc('0x4c')](_0x209bc7,_0x5b725a[_0x209bc7][_0xfefc('0x48')],handleJob(_0x5b725a[_0x209bc7]));manager[_0xfefc('0x4d')](_0x209bc7);logger[_0xfefc('0x27')](_0xfefc('0x4e'),_0x5b725a[_0x209bc7][_0xfefc('0x15')],_0x5b725a[_0x209bc7][_0xfefc('0x48')]);}else if(manager[_0xfefc('0x4f')](_0x209bc7)){manager[_0xfefc('0x50')](_0x209bc7);manager['deleteJob'](_0x209bc7);logger[_0xfefc('0x27')]('stop\x20cron',_0x5b725a[_0x209bc7][_0xfefc('0x15')],_0x5b725a[_0x209bc7][_0xfefc('0x48')]);}}for(_0x5e1f85=0x0,_0x209bc7;_0x5e1f85<_0x32c64f[_0xfefc('0x40')]&&!_0x48369b;_0x5e1f85+=0x1){_0x209bc7=_0x32c64f[_0x5e1f85]['toString']();if(manager['exists'](_0x209bc7)){if(_0x5b725a[_0x209bc7]['cron']&&_0x5b725a[_0x209bc7][_0xfefc('0x49')]&&moment()['isBetween'](_0x5b725a[_0x209bc7]['startAt'],_0x5b725a[_0x209bc7][_0xfefc('0x4b')])){manager[_0xfefc('0x51')](_0x209bc7,_0x5b725a[_0x209bc7][_0xfefc('0x48')],handleJob(_0x5b725a[_0x209bc7]));logger['info']('update\x20cron',_0x5b725a[_0x209bc7][_0xfefc('0x15')],_0x5b725a[_0x209bc7]['cron']);}else{manager['stop'](_0x209bc7);manager[_0xfefc('0x41')](_0x209bc7);logger[_0xfefc('0x27')]('stop\x20cron',_0x5b725a[_0x209bc7][_0xfefc('0x15')],_0x5b725a[_0x209bc7][_0xfefc('0x48')]);}}}})[_0xfefc('0x2b')](function(_0x122fef){logger[_0xfefc('0x2a')](JSON['stringify'](_0x122fef));});}exports[_0xfefc('0x52')]=function(_0x4094bf){return getJobs(_0x4094bf);};exports['start']=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file diff --git a/server/config/schedule/transcribe.js b/server/config/schedule/transcribe.js index 5bd87c6..62aa6d4 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 _0x4147=['results','transcripts','fileText','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','Sentiment\x20Analysis\x20not\x20requested','sentimentAccountId','sentimentRegion','language','bucket','ValidationError','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','Positive','SentimentScore','Negative','FailureReason','Mixed','Neutral','catch','name','SequelizeValidationError','error','inspect','Setting','Settings\x20not\x20available','Transcribe\x20not\x20configured','transcribeAccountId','forEach','push','all','request-promise','util','bluebird','../../mysqldb','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','Comprehend','substring','info','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','transcribeRegion','format','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','COMPLETED','Transcript','TranscriptFileUri','then','[RECORDING:%d]\x20Transcript\x20downloaded'];(function(_0x46376b,_0x2a51cb){var _0x22e8d3=function(_0x26afbf){while(--_0x26afbf){_0x46376b['push'](_0x46376b['shift']());}};_0x22e8d3(++_0x2a51cb);}(_0x4147,0x131));var _0x7414=function(_0x2a9e93,_0x5c3054){_0x2a9e93=_0x2a9e93-0x0;var _0x1a77bc=_0x4147[_0x2a9e93];return _0x1a77bc;};var _=require('lodash');var AWS=require('aws-sdk');var rp=require(_0x7414('0x0'));var util=require(_0x7414('0x1'));var BPromise=require(_0x7414('0x2'));var db=require(_0x7414('0x3'))['db'];var logger=require(_0x7414('0x4'))(_0x7414('0x5'));function getTranscriptionJob(_0x328779,_0x10589c,_0x1f0e0a,_0x397cda){return new Promise(function(_0x3fe03b,_0x207bf4){var _0x13054b=new AWS[(_0x7414('0x6'))]({'accessKeyId':_0x10589c,'secretAccessKey':_0x328779,'region':_0x1f0e0a});_0x13054b[_0x7414('0x7')]({'TranscriptionJobName':_0x397cda},function(_0x58b01e,_0x333f98){if(_0x58b01e){return _0x207bf4(_0x58b01e);}else{return _0x3fe03b(_0x333f98);}});});}function sentiment(_0x3626d6,_0xb23714,_0x28620b,_0x444311,_0x430618){return new Promise(function(_0x24fae0,_0x4079e9){var _0x17349d=new AWS[(_0x7414('0x8'))]({'accessKeyId':_0xb23714,'secretAccessKey':_0x3626d6,'region':_0x28620b});_0x17349d['detectSentiment']({'Text':_0x444311,'LanguageCode':_0x430618[_0x7414('0x9')](0x0,0x2)},function(_0xbbb02b,_0x4c36d7){if(_0xbbb02b){return _0x4079e9(_0xbbb02b);}else{return _0x24fae0(_0x4c36d7);}});});}function checkTranscribeJob(_0x413fee,_0x2f946f,_0xa3b33c){var _0x4e608b;return new BPromise(function(_0x193210,_0x260c3b){logger[_0x7414('0xa')](util['format'](_0x7414('0xb'),_0x413fee['id'],_0x413fee[_0x7414('0xc')]));return getTranscriptionJob(_0xa3b33c[_0x7414('0xd')],_0xa3b33c[_0x7414('0xe')],_0x2f946f[_0x7414('0xf')],_0x413fee[_0x7414('0xc')])['then'](function(_0x4697){logger[_0x7414('0xa')](util[_0x7414('0x10')](_0x7414('0x11'),_0x413fee['id'],_0x413fee[_0x7414('0xc')],_0x4697[_0x7414('0x12')][_0x7414('0x13')]));if(!_0x413fee['fileText']){switch(_0x4697[_0x7414('0x12')][_0x7414('0x13')]){case _0x7414('0x14'):var _0x21f80d={'transcribeStatus':_0x4697[_0x7414('0x12')][_0x7414('0x13')],'fileUri':_0x4697[_0x7414('0x12')][_0x7414('0x15')][_0x7414('0x16')]};logger[_0x7414('0xa')](util[_0x7414('0x10')]('[RECORDING:%d]\x20Get\x20transcript',_0x413fee['id']));return rp({'uri':_0x4697[_0x7414('0x12')]['Transcript'][_0x7414('0x16')],'json':!![]})[_0x7414('0x17')](function(_0xff79a){logger[_0x7414('0xa')](util[_0x7414('0x10')](_0x7414('0x18'),_0x413fee['id']));if(_0xff79a&&_0xff79a[_0x7414('0x19')]&&_0xff79a[_0x7414('0x19')][_0x7414('0x1a')]&&_0xff79a[_0x7414('0x19')]['transcripts']['length']){_0x21f80d[_0x7414('0x1b')]='';for(var _0x3ad316=0x0;_0x3ad316<_0xff79a[_0x7414('0x19')][_0x7414('0x1a')]['length'];_0x3ad316++){_0x21f80d['fileText']+=_0xff79a['results'][_0x7414('0x1a')][_0x3ad316][_0x7414('0x1c')]+'';}}return _0x413fee[_0x7414('0x1d')](_0x21f80d);})[_0x7414('0x17')](function(){logger[_0x7414('0xa')](util[_0x7414('0x10')](_0x7414('0x1e'),_0x413fee['id']));if(!_0x413fee[_0x7414('0x1f')]){throw new db[(_0x7414('0x20'))]['ValidationError'](_0x7414('0x21'));}if(!_0x2f946f['sentiment']||!_0x2f946f[_0x7414('0x22')]||!_0x2f946f[_0x7414('0x23')]||!_0x2f946f[_0x7414('0x24')]||!_0x2f946f[_0x7414('0x25')]){throw new db[(_0x7414('0x20'))][(_0x7414('0x26'))](_0x7414('0x27'));}if(!_0x21f80d[_0x7414('0x1b')]){throw new Error(_0x7414('0x28'));}if(_0x2f946f[_0x7414('0x22')]===_0xa3b33c['id']){return _0xa3b33c;}else{return db[_0x7414('0x29')][_0x7414('0x2a')]({'where':{'id':_settings[_0x7414('0x22')]}});}})[_0x7414('0x17')](function(_0x2a24f3){if(!_0x2a24f3){throw new db[(_0x7414('0x20'))][(_0x7414('0x26'))](_0x7414('0x2b'));}if(!_0x2a24f3[_0x7414('0xd')]||!_0x2a24f3[_0x7414('0xe')]){throw new db[(_0x7414('0x20'))][(_0x7414('0x26'))](_0x7414('0x2c'));}_0x4e608b=_0x2a24f3;logger[_0x7414('0xa')](util[_0x7414('0x10')](_0x7414('0x2d'),_0x413fee['id']));return sentiment(_0x4e608b['data1'],_0x4e608b['data2'],_0x2f946f[_0x7414('0x23')],_0x21f80d[_0x7414('0x1b')],_0x2f946f[_0x7414('0x24')]);})[_0x7414('0x17')](function(_0x250fc9){logger['info'](util[_0x7414('0x10')](_0x7414('0x2e'),_0x413fee['id']));return _0x413fee['update']({'sentiment':_0x250fc9[_0x7414('0x2f')],'sPositive':_0x250fc9['SentimentScore'][_0x7414('0x30')],'sNegative':_0x250fc9[_0x7414('0x31')][_0x7414('0x32')],'sMixed':_0x250fc9['SentimentScore']['Mixed'],'sNeutral':_0x250fc9['SentimentScore']['Neutral']});})['then'](function(){logger[_0x7414('0xa')](util[_0x7414('0x10')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x413fee['id']));_0x193210();});case'FAILED':return _0x413fee['update']({'transcribeStatus':'FAILED','failureReason':_0x4697[_0x7414('0x12')][_0x7414('0x33')]})['then'](function(){logger[_0x7414('0xa')](util[_0x7414('0x10')](_0x7414('0x1e'),_0x413fee['id']));_0x193210();});default:logger[_0x7414('0xa')](util[_0x7414('0x10')]('[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed',_0x413fee['id']));break;}}else{return BPromise['resolve']()[_0x7414('0x17')](function(){if(!_0x413fee[_0x7414('0x1f')]){throw new db['Sequelize'][(_0x7414('0x26'))](_0x7414('0x21'));}if(!_0x2f946f['sentiment']||!_0x2f946f[_0x7414('0x22')]||!_0x2f946f[_0x7414('0x23')]||!_0x2f946f[_0x7414('0x24')]||!_0x2f946f[_0x7414('0x25')]){throw new db[(_0x7414('0x20'))][(_0x7414('0x26'))](_0x7414('0x27'));}if(!_0x413fee[_0x7414('0x1b')]){throw new Error(_0x7414('0x28'));}if(_0x2f946f['sentimentAccountId']===_0xa3b33c['id']){return _0xa3b33c;}else{return db[_0x7414('0x29')][_0x7414('0x2a')]({'where':{'id':_settings[_0x7414('0x22')]}});}})[_0x7414('0x17')](function(_0x5ee397){if(!_0x5ee397){throw new db[(_0x7414('0x20'))][(_0x7414('0x26'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x5ee397[_0x7414('0xd')]||!_0x5ee397[_0x7414('0xe')]){throw new db[(_0x7414('0x20'))][(_0x7414('0x26'))](_0x7414('0x2c'));}_0x4e608b=_0x5ee397;logger['info'](util['format'](_0x7414('0x2d'),_0x413fee['id']));return sentiment(_0x4e608b[_0x7414('0xd')],_0x4e608b['data2'],_0x2f946f[_0x7414('0x23')],_0x413fee[_0x7414('0x1b')],_0x2f946f[_0x7414('0x24')]);})[_0x7414('0x17')](function(_0x3193e8){logger[_0x7414('0xa')](util[_0x7414('0x10')](_0x7414('0x2e'),_0x413fee['id']));return _0x413fee[_0x7414('0x1d')]({'sentiment':_0x3193e8[_0x7414('0x2f')],'sPositive':_0x3193e8[_0x7414('0x31')][_0x7414('0x30')],'sNegative':_0x3193e8['SentimentScore'][_0x7414('0x32')],'sMixed':_0x3193e8[_0x7414('0x31')][_0x7414('0x34')],'sNeutral':_0x3193e8[_0x7414('0x31')][_0x7414('0x35')],'transcribeStatus':_0x7414('0x14')});})['then'](function(){logger[_0x7414('0xa')](util[_0x7414('0x10')](_0x7414('0x1e'),_0x413fee['id']));_0x193210();});}})[_0x7414('0x36')](function(_0x5d5c0c){if(_0x5d5c0c){if(!_0x5d5c0c[_0x7414('0x37')]||_0x5d5c0c[_0x7414('0x37')]!==_0x7414('0x38')){logger[_0x7414('0x39')](util['format']('[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis',_0x413fee['id']),util[_0x7414('0x3a')](_0x5d5c0c,{'showHidden':![],'depth':null}));}}_0x193210();});});}function checkTranscribe(){var _0x21c96b;var _0xc0aceb;var _0x1cdbba;return db['VoiceRecording']['findAll']({'where':{'transcribeStatus':'IN_PROGRESS'}})[_0x7414('0x17')](function(_0x1fc015){if(!_0x1fc015||!_0x1fc015['length']){throw new db['Sequelize'][(_0x7414('0x26'))]('No\x20transcribe\x20job\x20to\x20check');}_0x21c96b=_0x1fc015;return db[_0x7414('0x3b')][_0x7414('0x2a')]({'where':{'id':0x1}});})[_0x7414('0x17')](function(_0x50de5e){if(!_0x50de5e){throw new db[(_0x7414('0x20'))][(_0x7414('0x26'))](_0x7414('0x3c'));}_0xc0aceb=_0x50de5e;if(!_0xc0aceb[_0x7414('0x5')]||!_0xc0aceb['transcribeAccountId']||!_0xc0aceb['transcribeRegion']||!_0xc0aceb[_0x7414('0x24')]||!_0xc0aceb[_0x7414('0x25')]){throw new db['Sequelize']['ValidationError'](_0x7414('0x3d'));}return db['CloudProvider']['findOne']({'where':{'id':_0xc0aceb[_0x7414('0x3e')]}});})[_0x7414('0x17')](function(_0x1046d8){if(!_0x1046d8){throw new db[(_0x7414('0x20'))][(_0x7414('0x26'))](_0x7414('0x2b'));}if(!_0x1046d8[_0x7414('0xd')]||!_0x1046d8['data2']){throw new db[(_0x7414('0x20'))][(_0x7414('0x26'))](_0x7414('0x2c'));}_0x1cdbba=_0x1046d8;var _0x55c644=[];_0x21c96b[_0x7414('0x3f')](function(_0x25830c){_0x55c644[_0x7414('0x40')](checkTranscribeJob(_0x25830c,_0xc0aceb,_0x1cdbba));});return BPromise[_0x7414('0x41')](_0x55c644);})[_0x7414('0x36')](function(_0x26417e){if(_0x26417e){if(!_0x26417e['name']||_0x26417e[_0x7414('0x37')]!==_0x7414('0x38')){logger['error'](util[_0x7414('0x3a')](_0x26417e,{'showHidden':![],'depth':null}));}}});}exports['start']=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0xe728=['[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','fileText','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','language','bucket','CloudProvider','findOne','data1','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Negative','Mixed','FAILED','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','Transcript\x20not\x20available','Cloud\x20Provider\x20not\x20available','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','Neutral','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribe','transcribeAccountId','transcribeRegion','forEach','push','all','start','lodash','aws-sdk','request-promise','util','bluebird','../../mysqldb','getTranscriptionJob','Comprehend','substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data2','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','then'];(function(_0x54cdb6,_0x5ddf3e){var _0xeace0e=function(_0x5b0db3){while(--_0x5b0db3){_0x54cdb6['push'](_0x54cdb6['shift']());}};_0xeace0e(++_0x5ddf3e);}(_0xe728,0x1a6));var _0x8e72=function(_0x2f0866,_0x2971ee){_0x2f0866=_0x2f0866-0x0;var _0x2be54a=_0xe728[_0x2f0866];return _0x2be54a;};var _=require(_0x8e72('0x0'));var AWS=require(_0x8e72('0x1'));var rp=require(_0x8e72('0x2'));var util=require(_0x8e72('0x3'));var BPromise=require(_0x8e72('0x4'));var db=require(_0x8e72('0x5'))['db'];var logger=require('../../config/logger')('transcribe');function getTranscriptionJob(_0xf143b2,_0x5931ad,_0xb93da5,_0x5e4750){return new Promise(function(_0x37ebb6,_0x1b23c5){var _0x24bfa6=new AWS['TranscribeService']({'accessKeyId':_0x5931ad,'secretAccessKey':_0xf143b2,'region':_0xb93da5});_0x24bfa6[_0x8e72('0x6')]({'TranscriptionJobName':_0x5e4750},function(_0xf8b82b,_0x35e919){if(_0xf8b82b){return _0x1b23c5(_0xf8b82b);}else{return _0x37ebb6(_0x35e919);}});});}function sentiment(_0x2ac5a1,_0x57ef7f,_0x786920,_0x4d54ea,_0x266367){return new Promise(function(_0x5d9996,_0x3dcaad){var _0x5f2062=new AWS[(_0x8e72('0x7'))]({'accessKeyId':_0x57ef7f,'secretAccessKey':_0x2ac5a1,'region':_0x786920});_0x5f2062['detectSentiment']({'Text':_0x4d54ea,'LanguageCode':_0x266367[_0x8e72('0x8')](0x0,0x2)},function(_0x2ceb23,_0x13a79a){if(_0x2ceb23){return _0x3dcaad(_0x2ceb23);}else{return _0x5d9996(_0x13a79a);}});});}function checkTranscribeJob(_0x174148,_0xbce88c,_0x5d7bc4){var _0x491dbe;return new BPromise(function(_0x5df23a,_0x14ed61){logger[_0x8e72('0x9')](util[_0x8e72('0xa')](_0x8e72('0xb'),_0x174148['id'],_0x174148[_0x8e72('0xc')]));return getTranscriptionJob(_0x5d7bc4['data1'],_0x5d7bc4[_0x8e72('0xd')],_0xbce88c['transcribeRegion'],_0x174148[_0x8e72('0xc')])['then'](function(_0x51a11a){logger['info'](util[_0x8e72('0xa')](_0x8e72('0xe'),_0x174148['id'],_0x174148[_0x8e72('0xc')],_0x51a11a['TranscriptionJob']['TranscriptionJobStatus']));if(!_0x174148['fileText']){switch(_0x51a11a[_0x8e72('0xf')][_0x8e72('0x10')]){case _0x8e72('0x11'):var _0x4f01e0={'transcribeStatus':_0x51a11a[_0x8e72('0xf')]['TranscriptionJobStatus'],'fileUri':_0x51a11a[_0x8e72('0xf')][_0x8e72('0x12')][_0x8e72('0x13')]};logger[_0x8e72('0x9')](util['format'](_0x8e72('0x14'),_0x174148['id']));return rp({'uri':_0x51a11a[_0x8e72('0xf')][_0x8e72('0x12')]['TranscriptFileUri'],'json':!![]})[_0x8e72('0x15')](function(_0x5950cb){logger[_0x8e72('0x9')](util['format'](_0x8e72('0x16'),_0x174148['id']));if(_0x5950cb&&_0x5950cb[_0x8e72('0x17')]&&_0x5950cb[_0x8e72('0x17')][_0x8e72('0x18')]&&_0x5950cb[_0x8e72('0x17')][_0x8e72('0x18')][_0x8e72('0x19')]){_0x4f01e0[_0x8e72('0x1a')]='';for(var _0x2a63ee=0x0;_0x2a63ee<_0x5950cb[_0x8e72('0x17')]['transcripts'][_0x8e72('0x19')];_0x2a63ee++){_0x4f01e0[_0x8e72('0x1a')]+=_0x5950cb['results'][_0x8e72('0x18')][_0x2a63ee][_0x8e72('0x1b')]+'';}}return _0x174148[_0x8e72('0x1c')](_0x4f01e0);})[_0x8e72('0x15')](function(){logger[_0x8e72('0x9')](util[_0x8e72('0xa')](_0x8e72('0x1d'),_0x174148['id']));if(!_0x174148['tempSentiment']){throw new db[(_0x8e72('0x1e'))][(_0x8e72('0x1f'))](_0x8e72('0x20'));}if(!_0xbce88c[_0x8e72('0x21')]||!_0xbce88c[_0x8e72('0x22')]||!_0xbce88c[_0x8e72('0x23')]||!_0xbce88c[_0x8e72('0x24')]||!_0xbce88c[_0x8e72('0x25')]){throw new db[(_0x8e72('0x1e'))][(_0x8e72('0x1f'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x4f01e0[_0x8e72('0x1a')]){throw new Error('Transcript\x20not\x20available');}if(_0xbce88c['sentimentAccountId']===_0x5d7bc4['id']){return _0x5d7bc4;}else{return db[_0x8e72('0x26')][_0x8e72('0x27')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0x8e72('0x15')](function(_0x58b336){if(!_0x58b336){throw new db[(_0x8e72('0x1e'))][(_0x8e72('0x1f'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x58b336[_0x8e72('0x28')]||!_0x58b336[_0x8e72('0xd')]){throw new db['Sequelize'][(_0x8e72('0x1f'))](_0x8e72('0x29'));}_0x491dbe=_0x58b336;logger[_0x8e72('0x9')](util[_0x8e72('0xa')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x174148['id']));return sentiment(_0x491dbe[_0x8e72('0x28')],_0x491dbe[_0x8e72('0xd')],_0xbce88c['sentimentRegion'],_0x4f01e0[_0x8e72('0x1a')],_0xbce88c['language']);})[_0x8e72('0x15')](function(_0x11ce9e){logger[_0x8e72('0x9')](util['format'](_0x8e72('0x2a'),_0x174148['id']));return _0x174148[_0x8e72('0x1c')]({'sentiment':_0x11ce9e[_0x8e72('0x2b')],'sPositive':_0x11ce9e[_0x8e72('0x2c')][_0x8e72('0x2d')],'sNegative':_0x11ce9e[_0x8e72('0x2c')][_0x8e72('0x2e')],'sMixed':_0x11ce9e[_0x8e72('0x2c')][_0x8e72('0x2f')],'sNeutral':_0x11ce9e['SentimentScore']['Neutral']});})[_0x8e72('0x15')](function(){logger[_0x8e72('0x9')](util['format'](_0x8e72('0x1d'),_0x174148['id']));_0x5df23a();});case _0x8e72('0x30'):return _0x174148[_0x8e72('0x1c')]({'transcribeStatus':_0x8e72('0x30'),'failureReason':_0x51a11a[_0x8e72('0xf')]['FailureReason']})[_0x8e72('0x15')](function(){logger[_0x8e72('0x9')](util[_0x8e72('0xa')](_0x8e72('0x1d'),_0x174148['id']));_0x5df23a();});default:logger[_0x8e72('0x9')](util[_0x8e72('0xa')](_0x8e72('0x31'),_0x174148['id']));break;}}else{return BPromise[_0x8e72('0x32')]()['then'](function(){if(!_0x174148['tempSentiment']){throw new db['Sequelize']['ValidationError'](_0x8e72('0x20'));}if(!_0xbce88c['sentiment']||!_0xbce88c[_0x8e72('0x22')]||!_0xbce88c['sentimentRegion']||!_0xbce88c['language']||!_0xbce88c['bucket']){throw new db[(_0x8e72('0x1e'))]['ValidationError']('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x174148[_0x8e72('0x1a')]){throw new Error(_0x8e72('0x33'));}if(_0xbce88c[_0x8e72('0x22')]===_0x5d7bc4['id']){return _0x5d7bc4;}else{return db[_0x8e72('0x26')]['findOne']({'where':{'id':_settings[_0x8e72('0x22')]}});}})[_0x8e72('0x15')](function(_0x17c485){if(!_0x17c485){throw new db[(_0x8e72('0x1e'))][(_0x8e72('0x1f'))](_0x8e72('0x34'));}if(!_0x17c485['data1']||!_0x17c485['data2']){throw new db[(_0x8e72('0x1e'))][(_0x8e72('0x1f'))](_0x8e72('0x29'));}_0x491dbe=_0x17c485;logger[_0x8e72('0x9')](util[_0x8e72('0xa')](_0x8e72('0x35'),_0x174148['id']));return sentiment(_0x491dbe[_0x8e72('0x28')],_0x491dbe[_0x8e72('0xd')],_0xbce88c[_0x8e72('0x23')],_0x174148[_0x8e72('0x1a')],_0xbce88c['language']);})[_0x8e72('0x15')](function(_0x5cbe48){logger[_0x8e72('0x9')](util[_0x8e72('0xa')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x174148['id']));return _0x174148['update']({'sentiment':_0x5cbe48[_0x8e72('0x2b')],'sPositive':_0x5cbe48[_0x8e72('0x2c')][_0x8e72('0x2d')],'sNegative':_0x5cbe48[_0x8e72('0x2c')]['Negative'],'sMixed':_0x5cbe48[_0x8e72('0x2c')][_0x8e72('0x2f')],'sNeutral':_0x5cbe48[_0x8e72('0x2c')][_0x8e72('0x36')],'transcribeStatus':_0x8e72('0x11')});})['then'](function(){logger['info'](util[_0x8e72('0xa')](_0x8e72('0x1d'),_0x174148['id']));_0x5df23a();});}})[_0x8e72('0x37')](function(_0x420684){if(_0x420684){if(!_0x420684[_0x8e72('0x38')]||_0x420684[_0x8e72('0x38')]!==_0x8e72('0x39')){logger[_0x8e72('0x3a')](util[_0x8e72('0xa')](_0x8e72('0x3b'),_0x174148['id']),util[_0x8e72('0x3c')](_0x420684,{'showHidden':![],'depth':null}));}}_0x5df23a();});});}function checkTranscribe(){var _0x26fa93;var _0x3a69f4;var _0x3587a2;return db[_0x8e72('0x3d')][_0x8e72('0x3e')]({'where':{'transcribeStatus':_0x8e72('0x3f')}})['then'](function(_0x10eb3e){if(!_0x10eb3e||!_0x10eb3e['length']){throw new db[(_0x8e72('0x1e'))][(_0x8e72('0x1f'))](_0x8e72('0x40'));}_0x26fa93=_0x10eb3e;return db[_0x8e72('0x41')][_0x8e72('0x27')]({'where':{'id':0x1}});})[_0x8e72('0x15')](function(_0x5b6041){if(!_0x5b6041){throw new db['Sequelize'][(_0x8e72('0x1f'))](_0x8e72('0x42'));}_0x3a69f4=_0x5b6041;if(!_0x3a69f4[_0x8e72('0x43')]||!_0x3a69f4[_0x8e72('0x44')]||!_0x3a69f4[_0x8e72('0x45')]||!_0x3a69f4[_0x8e72('0x24')]||!_0x3a69f4[_0x8e72('0x25')]){throw new db[(_0x8e72('0x1e'))][(_0x8e72('0x1f'))]('Transcribe\x20not\x20configured');}return db[_0x8e72('0x26')][_0x8e72('0x27')]({'where':{'id':_0x3a69f4[_0x8e72('0x44')]}});})[_0x8e72('0x15')](function(_0x3b702d){if(!_0x3b702d){throw new db[(_0x8e72('0x1e'))][(_0x8e72('0x1f'))](_0x8e72('0x34'));}if(!_0x3b702d[_0x8e72('0x28')]||!_0x3b702d[_0x8e72('0xd')]){throw new db[(_0x8e72('0x1e'))][(_0x8e72('0x1f'))](_0x8e72('0x29'));}_0x3587a2=_0x3b702d;var _0x4611c9=[];_0x26fa93[_0x8e72('0x46')](function(_0x263461){_0x4611c9[_0x8e72('0x47')](checkTranscribeJob(_0x263461,_0x3a69f4,_0x3587a2));});return BPromise[_0x8e72('0x48')](_0x4611c9);})[_0x8e72('0x37')](function(_0x59c6ca){if(_0x59c6ca){if(!_0x59c6ca[_0x8e72('0x38')]||_0x59c6ca[_0x8e72('0x38')]!==_0x8e72('0x39')){logger[_0x8e72('0x3a')](util[_0x8e72('0x3c')](_0x59c6ca,{'showHidden':![],'depth':null}));}}});}exports[_0x8e72('0x49')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file diff --git a/server/config/seedContact.js b/server/config/seedContact.js index 5a7f6c6..4fc4232 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd4fa=['util','../mysqldb','push','Biondo','innocenzo.biondo','@xcally.com','now','Innocenzo','destroy','CmContact','bulkCreate','then','contacts1','CmHopper','log','finished\x20populating','contacts2','hopper2','catch'];(function(_0x2a0b89,_0x449209){var _0x101515=function(_0x2d796b){while(--_0x2d796b){_0x2a0b89['push'](_0x2a0b89['shift']());}};_0x101515(++_0x449209);}(_0xd4fa,0x130));var _0xad4f=function(_0x133937,_0x2ebfad){_0x133937=_0x133937-0x0;var _0x5e8947=_0xd4fa[_0x133937];return _0x5e8947;};'use strict';var util=require(_0xad4f('0x0'));var db=require(_0xad4f('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xad4f('0x2')]({'id':i,'firstName':'Innocenzo'+i,'lastName':_0xad4f('0x3')+i,'phone':0xf879fb460+i,'email':_0xad4f('0x4')+i+_0xad4f('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper['push']({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xad4f('0x6')](),'updatedAt':Date['now']()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':_0xad4f('0x7')+i,'lastName':_0xad4f('0x3')+i,'phone':0xf879fb460+i,'email':_0xad4f('0x4')+i+_0xad4f('0x5')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xad4f('0x2')]({'id':i,'active':![],'scheduledat':Date[_0xad4f('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xad4f('0x6')](),'updatedAt':Date[_0xad4f('0x6')]()});}db['CmContact'][_0xad4f('0x8')]({'where':{}})['then'](function(){return db[_0xad4f('0x9')][_0xad4f('0xa')](contacts);})[_0xad4f('0xb')](function(){console['log']('finished\x20populating',_0xad4f('0xc'));return db[_0xad4f('0xd')][_0xad4f('0x8')]({'where':{}});})[_0xad4f('0xb')](function(){return db[_0xad4f('0xd')][_0xad4f('0xa')](hopper);})[_0xad4f('0xb')](function(){console[_0xad4f('0xe')]('finished\x20populating','hopper1');return db[_0xad4f('0x9')]['bulkCreate'](contacts2);})[_0xad4f('0xb')](function(){console[_0xad4f('0xe')](_0xad4f('0xf'),_0xad4f('0x10'));return db[_0xad4f('0xd')][_0xad4f('0xa')](hopper2);})[_0xad4f('0xb')](function(){console[_0xad4f('0xe')](_0xad4f('0xf'),_0xad4f('0x11'));})[_0xad4f('0x12')](function(_0x18382b){console[_0xad4f('0xe')](_0x18382b);}); \ No newline at end of file +var _0x3921=['util','../mysqldb','push','Innocenzo','now','Biondo','innocenzo.biondo','@xcally.com','CmContact','destroy','then','bulkCreate','log','finished\x20populating','contacts1','CmHopper','hopper1','contacts2','hopper2'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0x3921,0xd1));var _0x1392=function(_0x1f5a36,_0x12535e){_0x1f5a36=_0x1f5a36-0x0;var _0x4f86fa=_0x3921[_0x1f5a36];return _0x4f86fa;};'use strict';var util=require(_0x1392('0x0'));var db=require(_0x1392('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x1392('0x2')]({'id':i,'firstName':_0x1392('0x3')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+'@xcally.com'});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x1392('0x2')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x1392('0x4')](),'updatedAt':Date[_0x1392('0x4')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x1392('0x2')]({'id':i,'firstName':_0x1392('0x3')+i,'lastName':_0x1392('0x5')+i,'phone':0xf879fb460+i,'email':_0x1392('0x6')+i+_0x1392('0x7')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x1392('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x1392('0x4')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0x1392('0x4')]()});}db[_0x1392('0x8')][_0x1392('0x9')]({'where':{}})[_0x1392('0xa')](function(){return db[_0x1392('0x8')][_0x1392('0xb')](contacts);})[_0x1392('0xa')](function(){console[_0x1392('0xc')](_0x1392('0xd'),_0x1392('0xe'));return db[_0x1392('0xf')][_0x1392('0x9')]({'where':{}});})[_0x1392('0xa')](function(){return db[_0x1392('0xf')][_0x1392('0xb')](hopper);})[_0x1392('0xa')](function(){console[_0x1392('0xc')]('finished\x20populating',_0x1392('0x10'));return db[_0x1392('0x8')][_0x1392('0xb')](contacts2);})[_0x1392('0xa')](function(){console['log'](_0x1392('0xd'),_0x1392('0x11'));return db[_0x1392('0xf')][_0x1392('0xb')](hopper2);})['then'](function(){console[_0x1392('0xc')](_0x1392('0xd'),_0x1392('0x12'));})['catch'](function(_0x176b2a){console[_0x1392('0xc')](_0x176b2a);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index cb230e7..094bef2 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf57c=['push','agent','%s%s','%s%s@xcally.com','password','friend','udp','ulaw','format','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','User','bulkCreate','then','log','add\x20user','catch','util'];(function(_0x170038,_0x430bfc){var _0x117982=function(_0x5278a6){while(--_0x5278a6){_0x170038['push'](_0x170038['shift']());}};_0x117982(++_0x430bfc);}(_0xf57c,0x164));var _0xcf57=function(_0x494c7d,_0x47940b){_0x494c7d=_0x494c7d-0x0;var _0x2d0195=_0xf57c[_0x494c7d];return _0x2d0195;};'use strict';var util=require(_0xcf57('0x0'));var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0xcf57('0x1')]({'name':util['format']('%s%s',_0xcf57('0x2'),i),'fullname':util['format'](_0xcf57('0x3'),'agent',i),'email':util['format'](_0xcf57('0x4'),'agent',i),'role':'agent','password':_0xcf57('0x5'),'internal':0xfa0+i,'type':_0xcf57('0x6'),'transport':[_0xcf57('0x7'),'ws','wss'],'disallow':['all'],'allow':[_0xcf57('0x8')],'defaultuser':util[_0xcf57('0x9')](_0xcf57('0x3'),'agent',i),'encryption':_0xcf57('0xa'),'avpf':_0xcf57('0xa'),'force_avp':_0xcf57('0xa'),'icesupport':_0xcf57('0xa'),'dtlsenable':_0xcf57('0xa'),'dtlsverify':'no','dtlscertfile':_0xcf57('0xb'),'dtlsprivatekey':_0xcf57('0xc'),'dtlssetup':_0xcf57('0xd'),'callerid':util[_0xcf57('0x9')](_0xcf57('0xe'),util[_0xcf57('0x9')](_0xcf57('0x3'),'agent',i),0xfa0+i)});}db[_0xcf57('0xf')][_0xcf57('0x10')](users)[_0xcf57('0x11')](function(){console[_0xcf57('0x12')](_0xcf57('0x13'));})[_0xcf57('0x14')](function(_0x5fc784){console[_0xcf57('0x12')](_0x5fc784);}); \ No newline at end of file +var _0x40d7=['udp','wss','all','ulaw','yes','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','User','bulkCreate','then','log','add\x20user','catch','../mysqldb','push','format','%s%s','agent','password','friend'];(function(_0x4fa895,_0x66b194){var _0x4b3059=function(_0x33a780){while(--_0x33a780){_0x4fa895['push'](_0x4fa895['shift']());}};_0x4b3059(++_0x66b194);}(_0x40d7,0x149));var _0x740d=function(_0x219d87,_0x1cb6f7){_0x219d87=_0x219d87-0x0;var _0x22823d=_0x40d7[_0x219d87];return _0x22823d;};'use strict';var util=require('util');var db=require(_0x740d('0x0'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x740d('0x1')]({'name':util[_0x740d('0x2')](_0x740d('0x3'),_0x740d('0x4'),i),'fullname':util[_0x740d('0x2')](_0x740d('0x3'),_0x740d('0x4'),i),'email':util[_0x740d('0x2')]('%s%s@xcally.com','agent',i),'role':_0x740d('0x4'),'password':_0x740d('0x5'),'internal':0xfa0+i,'type':_0x740d('0x6'),'transport':[_0x740d('0x7'),'ws',_0x740d('0x8')],'disallow':[_0x740d('0x9')],'allow':[_0x740d('0xa')],'defaultuser':util[_0x740d('0x2')]('%s%s',_0x740d('0x4'),i),'encryption':_0x740d('0xb'),'avpf':_0x740d('0xb'),'force_avp':_0x740d('0xb'),'icesupport':_0x740d('0xb'),'dtlsenable':_0x740d('0xb'),'dtlsverify':'no','dtlscertfile':'/etc/pki/tls/certs/motion.crt','dtlsprivatekey':_0x740d('0xc'),'dtlssetup':_0x740d('0xd'),'callerid':util[_0x740d('0x2')](_0x740d('0xe'),util[_0x740d('0x2')]('%s%s',_0x740d('0x4'),i),0xfa0+i)});}db[_0x740d('0xf')][_0x740d('0x10')](users)[_0x740d('0x11')](function(){console[_0x740d('0x12')](_0x740d('0x13'));})[_0x740d('0x14')](function(_0x2ea7cc){console[_0x740d('0x12')](_0x2ea7cc);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 901aa90..7576402 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x95ba=['%s:queue:%s','length','user:%s','handshake','find','query','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','SmsInteraction','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','admin','voice:inbound','voice:outbound','hasOwnProperty','include','push','ChatQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','user','VoiceQueues','VoiceQueue','ChatQueues','userProfileId','FaxQueues','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getWhatsappQueues','all','voice','chat','fax','mail','openchannel','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','leave','removeChatInteractions','emit','removeMailInteractions','FaxInteractions','removeFaxInteractions','user_has_fax_interactions:remove','SmsInteractions','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','removeWhatsappInteractions','join','default','connection','setMaxListeners','address','request','connectedAt','SocketIO\x20','disconnect','log','DISCONNECTED','CONNECTED','lodash','util','bluebird','../mysqldb','./environment','name','Agents','User','role','agent','telephone','ivr','UserProfileSection','findOne','then','autoAssociation','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','IvrCampaigns','resourceId','map','where','Campaign','type','format'];(function(_0x1f3699,_0x378bf2){var _0x59258f=function(_0x2364a9){while(--_0x2364a9){_0x1f3699['push'](_0x1f3699['shift']());}};_0x59258f(++_0x378bf2);}(_0x95ba,0x17c));var _0xa95b=function(_0x295b45,_0x47d8cf){_0x295b45=_0x295b45-0x0;var _0x5ed8d4=_0x95ba[_0x295b45];return _0x5ed8d4;};'use strict';var _=require(_0xa95b('0x0'));var util=require(_0xa95b('0x1'));var BPromise=require(_0xa95b('0x2'));var db=require(_0xa95b('0x3'))['db'];var config=require(_0xa95b('0x4'));var queryQueues={'attributes':['id',_0xa95b('0x5')],'include':[{'as':_0xa95b('0x6'),'model':db[_0xa95b('0x7')],'attributes':['id',_0xa95b('0x5'),_0xa95b('0x8')],'raw':!![],'where':{'role':_0xa95b('0x9')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xa95b('0x5')],'where':{'role':_0xa95b('0xa')}};var queryTrunks={'raw':!![],'attributes':['id','name']};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':_0xa95b('0x9')}};var queryCampaigns={'raw':!![],'attributes':['id',_0xa95b('0x5'),'type'],'where':{'type':_0xa95b('0xb')}};function getAssociatedResources(_0x12c616,_0x4cd6ee,_0x1e33e2){return db[_0xa95b('0xc')][_0xa95b('0xd')]({'where':{'name':_0x12c616,'userProfileId':_0x4cd6ee},'raw':!![]})[_0xa95b('0xe')](function(_0xb75882){if(_0xb75882){if(_0xb75882[_0xa95b('0xf')]){switch(_0x12c616){case'VoiceQueues':case'ChatQueues':case'FaxQueues':case _0xa95b('0x10'):case _0xa95b('0x11'):case _0xa95b('0x12'):case _0xa95b('0x13'):return db[_0x1e33e2][_0xa95b('0x14')](queryQueues);case'Telephones':return db[_0x1e33e2][_0xa95b('0x14')](queryTelephones);case'Trunks':return db[_0x1e33e2][_0xa95b('0x14')](queryTrunks);case _0xa95b('0x15'):return db[_0x1e33e2][_0xa95b('0x14')](queryCampaigns);}}else{return db['UserProfileResource'][_0xa95b('0x14')]({'attributes':[_0xa95b('0x16')],'where':{'sectionId':_0xb75882['id']},'raw':!![]})[_0xa95b('0xe')](function(_0x5e49cb){if(_0x5e49cb){var _0x44d604={'where':{'id':_[_0xa95b('0x17')](_0x5e49cb,_0xa95b('0x16'))},'raw':!![]};switch(_0x1e33e2){case _0xa95b('0x7'):_0x44d604[_0xa95b('0x18')][_0xa95b('0x8')]='telephone';break;case _0xa95b('0x19'):_0x44d604['where'][_0xa95b('0x1a')]=_0xa95b('0xb');break;}return db[_0x1e33e2][_0xa95b('0x14')](_0x44d604);}else{return[];}});}}else{return[];}})['then'](function(_0x36f1a4){return _0x36f1a4;});}function joinOrLeaveQueues(_0x517d8d,_0xd3712a,_0x241ba3,_0x4340d4){_0x517d8d[_0xd3712a](util[_0xa95b('0x1b')](_0xa95b('0x1c'),_0x241ba3,_0x4340d4[_0xa95b('0x5')]));if(_0x4340d4[_0xa95b('0x6')]){for(var _0x45ad3b=0x0;_0x45ad3b<_0x4340d4[_0xa95b('0x6')][_0xa95b('0x1d')];_0x45ad3b+=0x1){_0x517d8d[_0xd3712a](util[_0xa95b('0x1b')](_0xa95b('0x1e'),_0x4340d4[_0xa95b('0x6')][_0x45ad3b][_0xa95b('0x5')]));}}}function joinOrLeave(_0x1f3a13,_0x529910,_0x23155c){var _0x10b73e;if(_0x1f3a13[_0xa95b('0x1f')]['query']['id']){db['User'][_0xa95b('0x20')]({'attributes':['id','name',_0xa95b('0x8'),'userProfileId'],'where':{'id':_0x1f3a13[_0xa95b('0x1f')][_0xa95b('0x21')]['id']},'include':[{'model':db[_0xa95b('0x22')],'as':_0xa95b('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0xa95b('0x24')],'as':_0xa95b('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0xa95b('0x26')],'as':'FaxInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xa95b('0x27')],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xa95b('0x28')],'as':_0xa95b('0x29'),'attributes':['id'],'raw':!![]},{'model':db[_0xa95b('0x2a')],'as':_0xa95b('0x2b'),'attributes':['id'],'raw':!![]}]})[_0xa95b('0xe')](function(_0x969af6){if(_0x969af6){_0x10b73e=_0x969af6;_0x1f3a13[_0x529910](util[_0xa95b('0x1b')](_0xa95b('0x1e'),_0x969af6[_0xa95b('0x5')]));var _0x4019dd=[];switch(_0x969af6[_0xa95b('0x8')]){case _0xa95b('0x2c'):_0x1f3a13[_0x529910](_0xa95b('0x2d'));_0x1f3a13[_0x529910](_0xa95b('0x2e'));if(queryQueues[_0xa95b('0x2f')](_0xa95b('0x30'))){delete queryQueues[_0xa95b('0x30')];}_0x4019dd[_0xa95b('0x31')](db['VoiceQueue'][_0xa95b('0x14')](queryQueues));_0x4019dd['push'](db[_0xa95b('0x32')][_0xa95b('0x14')](queryQueues));_0x4019dd[_0xa95b('0x31')](db[_0xa95b('0x33')][_0xa95b('0x14')](queryQueues));_0x4019dd['push'](db[_0xa95b('0x34')][_0xa95b('0x14')](queryQueues));_0x4019dd[_0xa95b('0x31')](db[_0xa95b('0x35')][_0xa95b('0x14')](queryQueues));_0x4019dd[_0xa95b('0x31')](db[_0xa95b('0x36')][_0xa95b('0x14')](queryQueues));_0x4019dd[_0xa95b('0x31')](db[_0xa95b('0x37')][_0xa95b('0x14')](queryQueues));_0x4019dd[_0xa95b('0x31')](db['User'][_0xa95b('0x14')](queryTelephones));_0x4019dd['push'](db['Trunk'][_0xa95b('0x14')](queryTrunks));_0x4019dd[_0xa95b('0x31')](db[_0xa95b('0x19')][_0xa95b('0x14')](queryCampaigns));_0x4019dd['push'](db[_0xa95b('0x7')][_0xa95b('0x14')](queryAgents));break;case _0xa95b('0x38'):_0x1f3a13[_0x529910](_0xa95b('0x2d'));_0x1f3a13[_0x529910]('voice:outbound');_0x4019dd[_0xa95b('0x31')](getAssociatedResources(_0xa95b('0x39'),_0x969af6['userProfileId'],_0xa95b('0x3a')));_0x4019dd[_0xa95b('0x31')](getAssociatedResources(_0xa95b('0x3b'),_0x969af6[_0xa95b('0x3c')],_0xa95b('0x32')));_0x4019dd[_0xa95b('0x31')](getAssociatedResources(_0xa95b('0x3d'),_0x969af6[_0xa95b('0x3c')],_0xa95b('0x33')));_0x4019dd[_0xa95b('0x31')](getAssociatedResources(_0xa95b('0x10'),_0x969af6[_0xa95b('0x3c')],_0xa95b('0x34')));_0x4019dd[_0xa95b('0x31')](getAssociatedResources('MailQueues',_0x969af6[_0xa95b('0x3c')],_0xa95b('0x35')));_0x4019dd[_0xa95b('0x31')](getAssociatedResources('OpenchannelQueues',_0x969af6['userProfileId'],'OpenchannelQueue'));_0x4019dd[_0xa95b('0x31')](getAssociatedResources(_0xa95b('0x13'),_0x969af6[_0xa95b('0x3c')],_0xa95b('0x37')));_0x4019dd['push'](getAssociatedResources('Telephones',_0x969af6[_0xa95b('0x3c')],_0xa95b('0x7')));_0x4019dd[_0xa95b('0x31')](getAssociatedResources('Trunks',_0x969af6[_0xa95b('0x3c')],'Trunk'));_0x4019dd[_0xa95b('0x31')](getAssociatedResources('IvrCampaigns',_0x969af6[_0xa95b('0x3c')],_0xa95b('0x19')));_0x4019dd[_0xa95b('0x31')](db['User']['findAll'](queryAgents));break;case'agent':_0x1f3a13[_0x529910](_0xa95b('0x2d'));_0x1f3a13[_0x529910](_0xa95b('0x2e'));_0x4019dd[_0xa95b('0x31')](_0x969af6[_0xa95b('0x3e')]({'attributes':['id',_0xa95b('0x5')]}));_0x4019dd['push'](_0x969af6[_0xa95b('0x3f')]({'attributes':['id',_0xa95b('0x5')]}));_0x4019dd[_0xa95b('0x31')](_0x969af6[_0xa95b('0x40')]({'attributes':['id',_0xa95b('0x5')]}));_0x4019dd[_0xa95b('0x31')](_0x969af6[_0xa95b('0x41')]({'attributes':['id',_0xa95b('0x5')]}));_0x4019dd[_0xa95b('0x31')](_0x969af6[_0xa95b('0x42')]({'attributes':['id',_0xa95b('0x5')]}));_0x4019dd['push'](_0x969af6['getOpenchannelQueues']({'attributes':['id',_0xa95b('0x5')]}));_0x4019dd['push'](_0x969af6[_0xa95b('0x43')]({'attributes':['id',_0xa95b('0x5')]}));break;}return BPromise[_0xa95b('0x44')](_0x4019dd);}})['then'](function(_0x4c2221){if(_0x4c2221&&_0x4c2221[_0xa95b('0x1d')]){for(var _0x319642=0x0;_0x319642<_0x4c2221[_0xa95b('0x1d')];_0x319642+=0x1){for(var _0x27803c=0x0;_0x27803c<_0x4c2221[_0x319642][_0xa95b('0x1d')];_0x27803c+=0x1){switch(_0x319642){case 0x0:joinOrLeaveQueues(_0x1f3a13,_0x529910,_0xa95b('0x45'),_0x4c2221[_0x319642][_0x27803c]);break;case 0x1:joinOrLeaveQueues(_0x1f3a13,_0x529910,_0xa95b('0x46'),_0x4c2221[_0x319642][_0x27803c]);break;case 0x2:joinOrLeaveQueues(_0x1f3a13,_0x529910,_0xa95b('0x47'),_0x4c2221[_0x319642][_0x27803c]);break;case 0x3:joinOrLeaveQueues(_0x1f3a13,_0x529910,'sms',_0x4c2221[_0x319642][_0x27803c]);break;case 0x4:joinOrLeaveQueues(_0x1f3a13,_0x529910,_0xa95b('0x48'),_0x4c2221[_0x319642][_0x27803c]);break;case 0x5:joinOrLeaveQueues(_0x1f3a13,_0x529910,_0xa95b('0x49'),_0x4c2221[_0x319642][_0x27803c]);break;case 0x6:joinOrLeaveQueues(_0x1f3a13,_0x529910,_0xa95b('0x4a'),_0x4c2221[_0x319642][_0x27803c]);break;case 0x7:_0x1f3a13[_0x529910](util[_0xa95b('0x1b')](_0xa95b('0x4b'),_0x4c2221[_0x319642][_0x27803c][_0xa95b('0x5')]));break;case 0x8:_0x1f3a13[_0x529910](util['format'](_0xa95b('0x4c'),_0x4c2221[_0x319642][_0x27803c]['name']));break;case 0x9:_0x1f3a13[_0x529910](util['format'](_0xa95b('0x4d'),_0x4c2221[_0x319642][_0x27803c][_0xa95b('0x1a')],_0x4c2221[_0x319642][_0x27803c][_0xa95b('0x5')]));break;case 0xa:_0x1f3a13[_0x529910](util[_0xa95b('0x1b')](_0xa95b('0x1e'),_0x4c2221[_0x319642][_0x27803c][_0xa95b('0x5')]));break;}}}}})[_0xa95b('0xe')](function(){if(_0x529910===_0xa95b('0x4e')){var _0x6dd563=_[_0xa95b('0x17')](_0x10b73e['ChatInteractions'],'id');return _0x10b73e[_0xa95b('0x4f')](_0x6dd563)[_0xa95b('0xe')](function(){for(var _0x27309a=0x0;_0x27309a<_0x6dd563['length'];_0x27309a+=0x1){_0x23155c[_0xa95b('0x50')]('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x6dd563[_0x27309a]),'UserId':Number(_0x10b73e['id'])});}});}})[_0xa95b('0xe')](function(){if(_0x529910==='leave'){var _0x493888=_[_0xa95b('0x17')](_0x10b73e['MailInteractions'],'id');return _0x10b73e[_0xa95b('0x51')](_0x493888)[_0xa95b('0xe')](function(){for(var _0x489e9b=0x0;_0x489e9b<_0x493888[_0xa95b('0x1d')];_0x489e9b+=0x1){_0x23155c[_0xa95b('0x50')]('user_has_mail_interactions:remove',{'MailInteractionId':Number(_0x493888[_0x489e9b]),'UserId':Number(_0x10b73e['id'])});}});}})[_0xa95b('0xe')](function(){if(_0x529910===_0xa95b('0x4e')){var _0x429b84=_[_0xa95b('0x17')](_0x10b73e[_0xa95b('0x52')],'id');return _0x10b73e[_0xa95b('0x53')](_0x429b84)[_0xa95b('0xe')](function(){for(var _0x1f3602=0x0;_0x1f3602<_0x429b84[_0xa95b('0x1d')];_0x1f3602+=0x1){_0x23155c[_0xa95b('0x50')](_0xa95b('0x54'),{'FaxInteractionId':Number(_0x429b84[_0x1f3602]),'UserId':Number(_0x10b73e['id'])});}});}})[_0xa95b('0xe')](function(){if(_0x529910===_0xa95b('0x4e')){var _0x3ff385=_[_0xa95b('0x17')](_0x10b73e[_0xa95b('0x55')],'id');return _0x10b73e[_0xa95b('0x56')](_0x3ff385)['then'](function(){for(var _0xf05e6=0x0;_0xf05e6<_0x3ff385['length'];_0xf05e6+=0x1){_0x23155c[_0xa95b('0x50')](_0xa95b('0x57'),{'SmsInteractionId':Number(_0x3ff385[_0xf05e6]),'UserId':Number(_0x10b73e['id'])});}});}})[_0xa95b('0xe')](function(){if(_0x529910===_0xa95b('0x4e')){var _0x50f8f2=_[_0xa95b('0x17')](_0x10b73e['OpenchannelInteractions'],'id');return _0x10b73e[_0xa95b('0x58')](_0x50f8f2)[_0xa95b('0xe')](function(){for(var _0x54dc6b=0x0;_0x54dc6b<_0x50f8f2[_0xa95b('0x1d')];_0x54dc6b+=0x1){_0x23155c[_0xa95b('0x50')]('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0x50f8f2[_0x54dc6b]),'UserId':Number(_0x10b73e['id'])});}});}})[_0xa95b('0xe')](function(){if(_0x529910===_0xa95b('0x4e')){var _0x4d2b85=_[_0xa95b('0x17')](_0x10b73e[_0xa95b('0x2b')],'id');return _0x10b73e[_0xa95b('0x59')](_0x4d2b85)['then'](function(){for(var _0x45ba04=0x0;_0x45ba04<_0x4d2b85['length'];_0x45ba04+=0x1){_0x23155c[_0xa95b('0x50')]('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0x4d2b85[_0x45ba04]),'UserId':Number(_0x10b73e['id'])});}});}})['catch'](function(_0x158f41){_0x1f3a13['log'](_0x158f41);});}}function onDisconnect(_0x38fdb3,_0x3c66b0){joinOrLeave(_0x38fdb3,_0xa95b('0x4e'),_0x3c66b0);}function onConnect(_0x531854){joinOrLeave(_0x531854,_0xa95b('0x5a'));}exports[_0xa95b('0x5b')]=function(_0x2e7a92){_0x2e7a92['on'](_0xa95b('0x5c'),function(_0x510953){_0x510953[_0xa95b('0x5d')](0x0);_0x510953[_0xa95b('0x5e')]=_0x510953[_0xa95b('0x5f')][_0xa95b('0x5c')]['remoteAddress']+':'+_0x510953[_0xa95b('0x5f')][_0xa95b('0x5c')]['remotePort'];_0x510953[_0xa95b('0x60')]=new Date();_0x510953['log']=function(_0xbe1b52){console['log'](_0xa95b('0x61')+_0x510953['nsp']['name']+'['+_0x510953[_0xa95b('0x5e')]+']',_0xbe1b52);};_0x510953['on'](_0xa95b('0x62'),function(){onDisconnect(_0x510953,_0x2e7a92);_0x510953[_0xa95b('0x63')](_0xa95b('0x64'));});onConnect(_0x510953);_0x510953[_0xa95b('0x63')](_0xa95b('0x65'));});}; \ No newline at end of file +var _0x4fc5=['Trunks','IvrCampaigns','UserProfileResource','resourceId','where','telephone','Campaign','Agents','length','format','user:%s','handshake','find','query','ChatInteractions','MailInteraction','MailInteractions','SmsInteraction','SmsInteractions','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','admin','voice:outbound','include','push','SmsQueue','OpenchannelQueue','WhatsappQueue','Trunk','user','voice:inbound','userProfileId','VoiceQueue','ChatQueues','ChatQueue','FaxQueue','MailQueue','getVoiceQueues','getFaxQueues','getOpenchannelQueues','all','chat','mail','openchannel','whatsapp','telephone:%s','campaign:%s:%s','removeChatInteractions','emit','user_has_chat_interactions:remove','leave','map','removeMailInteractions','FaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','user_has_whatsapp_interactions:remove','catch','log','join','default','connection','setMaxListeners','address','remoteAddress','request','remotePort','connectedAt','SocketIO\x20','disconnect','DISCONNECTED','CONNECTED','lodash','util','User','name','role','agent','type','ivr','UserProfileSection','findOne','then','autoAssociation','VoiceQueues','FaxQueues','SmsQueues','MailQueues','WhatsappQueues','Telephones','findAll'];(function(_0x58e582,_0x41b688){var _0x27f1cd=function(_0x530c74){while(--_0x530c74){_0x58e582['push'](_0x58e582['shift']());}};_0x27f1cd(++_0x41b688);}(_0x4fc5,0x1c8));var _0x54fc=function(_0x1faa61,_0x1bd7e2){_0x1faa61=_0x1faa61-0x0;var _0x3f0e58=_0x4fc5[_0x1faa61];return _0x3f0e58;};'use strict';var _=require(_0x54fc('0x0'));var util=require(_0x54fc('0x1'));var BPromise=require('bluebird');var db=require('../mysqldb')['db'];var config=require('./environment');var queryQueues={'attributes':['id','name'],'include':[{'as':'Agents','model':db[_0x54fc('0x2')],'attributes':['id',_0x54fc('0x3'),_0x54fc('0x4')],'raw':!![],'where':{'role':_0x54fc('0x5')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x54fc('0x3')],'where':{'role':'telephone'}};var queryTrunks={'raw':!![],'attributes':['id',_0x54fc('0x3')]};var queryAgents={'raw':!![],'attributes':['id',_0x54fc('0x3')],'where':{'role':_0x54fc('0x5')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x54fc('0x3'),_0x54fc('0x6')],'where':{'type':_0x54fc('0x7')}};function getAssociatedResources(_0x1f0108,_0x2d0f07,_0x32a50a){return db[_0x54fc('0x8')][_0x54fc('0x9')]({'where':{'name':_0x1f0108,'userProfileId':_0x2d0f07},'raw':!![]})[_0x54fc('0xa')](function(_0x86cbfe){if(_0x86cbfe){if(_0x86cbfe[_0x54fc('0xb')]){switch(_0x1f0108){case _0x54fc('0xc'):case'ChatQueues':case _0x54fc('0xd'):case _0x54fc('0xe'):case _0x54fc('0xf'):case'OpenchannelQueues':case _0x54fc('0x10'):return db[_0x32a50a]['findAll'](queryQueues);case _0x54fc('0x11'):return db[_0x32a50a][_0x54fc('0x12')](queryTelephones);case _0x54fc('0x13'):return db[_0x32a50a][_0x54fc('0x12')](queryTrunks);case _0x54fc('0x14'):return db[_0x32a50a][_0x54fc('0x12')](queryCampaigns);}}else{return db[_0x54fc('0x15')]['findAll']({'attributes':[_0x54fc('0x16')],'where':{'sectionId':_0x86cbfe['id']},'raw':!![]})['then'](function(_0x37f48e){if(_0x37f48e){var _0xb27770={'where':{'id':_['map'](_0x37f48e,'resourceId')},'raw':!![]};switch(_0x32a50a){case _0x54fc('0x2'):_0xb27770[_0x54fc('0x17')][_0x54fc('0x4')]=_0x54fc('0x18');break;case _0x54fc('0x19'):_0xb27770[_0x54fc('0x17')]['type']=_0x54fc('0x7');break;}return db[_0x32a50a][_0x54fc('0x12')](_0xb27770);}else{return[];}});}}else{return[];}})[_0x54fc('0xa')](function(_0x39711f){return _0x39711f;});}function joinOrLeaveQueues(_0x194de7,_0x1fb9ed,_0x513a31,_0x523baf){_0x194de7[_0x1fb9ed](util['format']('%s:queue:%s',_0x513a31,_0x523baf[_0x54fc('0x3')]));if(_0x523baf['Agents']){for(var _0x5d7816=0x0;_0x5d7816<_0x523baf[_0x54fc('0x1a')][_0x54fc('0x1b')];_0x5d7816+=0x1){_0x194de7[_0x1fb9ed](util[_0x54fc('0x1c')](_0x54fc('0x1d'),_0x523baf[_0x54fc('0x1a')][_0x5d7816][_0x54fc('0x3')]));}}}function joinOrLeave(_0x57d3a4,_0x4e8005,_0x11058a){var _0x3d3cd2;if(_0x57d3a4[_0x54fc('0x1e')]['query']['id']){db[_0x54fc('0x2')][_0x54fc('0x1f')]({'attributes':['id',_0x54fc('0x3'),_0x54fc('0x4'),'userProfileId'],'where':{'id':_0x57d3a4[_0x54fc('0x1e')][_0x54fc('0x20')]['id']},'include':[{'model':db['ChatInteraction'],'as':_0x54fc('0x21'),'attributes':['id'],'raw':!![]},{'model':db[_0x54fc('0x22')],'as':_0x54fc('0x23'),'attributes':['id'],'raw':!![]},{'model':db['FaxInteraction'],'as':'FaxInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x54fc('0x24')],'as':_0x54fc('0x25'),'attributes':['id'],'raw':!![]},{'model':db['OpenchannelInteraction'],'as':_0x54fc('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0x54fc('0x27')],'as':_0x54fc('0x28'),'attributes':['id'],'raw':!![]}]})['then'](function(_0x38792f){if(_0x38792f){_0x3d3cd2=_0x38792f;_0x57d3a4[_0x4e8005](util[_0x54fc('0x1c')](_0x54fc('0x1d'),_0x38792f['name']));var _0x4c72d4=[];switch(_0x38792f[_0x54fc('0x4')]){case _0x54fc('0x29'):_0x57d3a4[_0x4e8005]('voice:inbound');_0x57d3a4[_0x4e8005](_0x54fc('0x2a'));if(queryQueues['hasOwnProperty'](_0x54fc('0x2b'))){delete queryQueues[_0x54fc('0x2b')];}_0x4c72d4[_0x54fc('0x2c')](db['VoiceQueue'][_0x54fc('0x12')](queryQueues));_0x4c72d4[_0x54fc('0x2c')](db['ChatQueue'][_0x54fc('0x12')](queryQueues));_0x4c72d4[_0x54fc('0x2c')](db['FaxQueue'][_0x54fc('0x12')](queryQueues));_0x4c72d4[_0x54fc('0x2c')](db[_0x54fc('0x2d')][_0x54fc('0x12')](queryQueues));_0x4c72d4[_0x54fc('0x2c')](db['MailQueue'][_0x54fc('0x12')](queryQueues));_0x4c72d4['push'](db[_0x54fc('0x2e')]['findAll'](queryQueues));_0x4c72d4[_0x54fc('0x2c')](db[_0x54fc('0x2f')][_0x54fc('0x12')](queryQueues));_0x4c72d4[_0x54fc('0x2c')](db[_0x54fc('0x2')]['findAll'](queryTelephones));_0x4c72d4[_0x54fc('0x2c')](db[_0x54fc('0x30')][_0x54fc('0x12')](queryTrunks));_0x4c72d4[_0x54fc('0x2c')](db[_0x54fc('0x19')][_0x54fc('0x12')](queryCampaigns));_0x4c72d4['push'](db[_0x54fc('0x2')][_0x54fc('0x12')](queryAgents));break;case _0x54fc('0x31'):_0x57d3a4[_0x4e8005](_0x54fc('0x32'));_0x57d3a4[_0x4e8005](_0x54fc('0x2a'));_0x4c72d4[_0x54fc('0x2c')](getAssociatedResources(_0x54fc('0xc'),_0x38792f[_0x54fc('0x33')],_0x54fc('0x34')));_0x4c72d4['push'](getAssociatedResources(_0x54fc('0x35'),_0x38792f[_0x54fc('0x33')],_0x54fc('0x36')));_0x4c72d4[_0x54fc('0x2c')](getAssociatedResources('FaxQueues',_0x38792f[_0x54fc('0x33')],_0x54fc('0x37')));_0x4c72d4[_0x54fc('0x2c')](getAssociatedResources('SmsQueues',_0x38792f[_0x54fc('0x33')],_0x54fc('0x2d')));_0x4c72d4[_0x54fc('0x2c')](getAssociatedResources(_0x54fc('0xf'),_0x38792f[_0x54fc('0x33')],_0x54fc('0x38')));_0x4c72d4[_0x54fc('0x2c')](getAssociatedResources('OpenchannelQueues',_0x38792f[_0x54fc('0x33')],_0x54fc('0x2e')));_0x4c72d4[_0x54fc('0x2c')](getAssociatedResources(_0x54fc('0x10'),_0x38792f[_0x54fc('0x33')],'WhatsappQueue'));_0x4c72d4[_0x54fc('0x2c')](getAssociatedResources(_0x54fc('0x11'),_0x38792f['userProfileId'],_0x54fc('0x2')));_0x4c72d4[_0x54fc('0x2c')](getAssociatedResources(_0x54fc('0x13'),_0x38792f[_0x54fc('0x33')],_0x54fc('0x30')));_0x4c72d4[_0x54fc('0x2c')](getAssociatedResources('IvrCampaigns',_0x38792f[_0x54fc('0x33')],_0x54fc('0x19')));_0x4c72d4[_0x54fc('0x2c')](db[_0x54fc('0x2')][_0x54fc('0x12')](queryAgents));break;case _0x54fc('0x5'):_0x57d3a4[_0x4e8005](_0x54fc('0x32'));_0x57d3a4[_0x4e8005](_0x54fc('0x2a'));_0x4c72d4[_0x54fc('0x2c')](_0x38792f[_0x54fc('0x39')]({'attributes':['id',_0x54fc('0x3')]}));_0x4c72d4[_0x54fc('0x2c')](_0x38792f['getChatQueues']({'attributes':['id','name']}));_0x4c72d4[_0x54fc('0x2c')](_0x38792f[_0x54fc('0x3a')]({'attributes':['id','name']}));_0x4c72d4[_0x54fc('0x2c')](_0x38792f['getSmsQueues']({'attributes':['id','name']}));_0x4c72d4[_0x54fc('0x2c')](_0x38792f['getMailQueues']({'attributes':['id',_0x54fc('0x3')]}));_0x4c72d4['push'](_0x38792f[_0x54fc('0x3b')]({'attributes':['id',_0x54fc('0x3')]}));_0x4c72d4[_0x54fc('0x2c')](_0x38792f['getWhatsappQueues']({'attributes':['id','name']}));break;}return BPromise[_0x54fc('0x3c')](_0x4c72d4);}})['then'](function(_0x309031){if(_0x309031&&_0x309031['length']){for(var _0x1a181b=0x0;_0x1a181b<_0x309031[_0x54fc('0x1b')];_0x1a181b+=0x1){for(var _0xa36c26=0x0;_0xa36c26<_0x309031[_0x1a181b][_0x54fc('0x1b')];_0xa36c26+=0x1){switch(_0x1a181b){case 0x0:joinOrLeaveQueues(_0x57d3a4,_0x4e8005,'voice',_0x309031[_0x1a181b][_0xa36c26]);break;case 0x1:joinOrLeaveQueues(_0x57d3a4,_0x4e8005,_0x54fc('0x3d'),_0x309031[_0x1a181b][_0xa36c26]);break;case 0x2:joinOrLeaveQueues(_0x57d3a4,_0x4e8005,'fax',_0x309031[_0x1a181b][_0xa36c26]);break;case 0x3:joinOrLeaveQueues(_0x57d3a4,_0x4e8005,'sms',_0x309031[_0x1a181b][_0xa36c26]);break;case 0x4:joinOrLeaveQueues(_0x57d3a4,_0x4e8005,_0x54fc('0x3e'),_0x309031[_0x1a181b][_0xa36c26]);break;case 0x5:joinOrLeaveQueues(_0x57d3a4,_0x4e8005,_0x54fc('0x3f'),_0x309031[_0x1a181b][_0xa36c26]);break;case 0x6:joinOrLeaveQueues(_0x57d3a4,_0x4e8005,_0x54fc('0x40'),_0x309031[_0x1a181b][_0xa36c26]);break;case 0x7:_0x57d3a4[_0x4e8005](util[_0x54fc('0x1c')](_0x54fc('0x41'),_0x309031[_0x1a181b][_0xa36c26][_0x54fc('0x3')]));break;case 0x8:_0x57d3a4[_0x4e8005](util['format']('trunk:%s',_0x309031[_0x1a181b][_0xa36c26]['name']));break;case 0x9:_0x57d3a4[_0x4e8005](util[_0x54fc('0x1c')](_0x54fc('0x42'),_0x309031[_0x1a181b][_0xa36c26][_0x54fc('0x6')],_0x309031[_0x1a181b][_0xa36c26][_0x54fc('0x3')]));break;case 0xa:_0x57d3a4[_0x4e8005](util[_0x54fc('0x1c')]('user:%s',_0x309031[_0x1a181b][_0xa36c26][_0x54fc('0x3')]));break;}}}}})[_0x54fc('0xa')](function(){if(_0x4e8005==='leave'){var _0x299a94=_['map'](_0x3d3cd2['ChatInteractions'],'id');return _0x3d3cd2[_0x54fc('0x43')](_0x299a94)['then'](function(){for(var _0x31b40a=0x0;_0x31b40a<_0x299a94[_0x54fc('0x1b')];_0x31b40a+=0x1){_0x11058a[_0x54fc('0x44')](_0x54fc('0x45'),{'ChatInteractionId':Number(_0x299a94[_0x31b40a]),'UserId':Number(_0x3d3cd2['id'])});}});}})[_0x54fc('0xa')](function(){if(_0x4e8005===_0x54fc('0x46')){var _0x5b0b3f=_[_0x54fc('0x47')](_0x3d3cd2['MailInteractions'],'id');return _0x3d3cd2[_0x54fc('0x48')](_0x5b0b3f)[_0x54fc('0xa')](function(){for(var _0xbd94a5=0x0;_0xbd94a5<_0x5b0b3f[_0x54fc('0x1b')];_0xbd94a5+=0x1){_0x11058a[_0x54fc('0x44')]('user_has_mail_interactions:remove',{'MailInteractionId':Number(_0x5b0b3f[_0xbd94a5]),'UserId':Number(_0x3d3cd2['id'])});}});}})[_0x54fc('0xa')](function(){if(_0x4e8005===_0x54fc('0x46')){var _0x59b552=_[_0x54fc('0x47')](_0x3d3cd2[_0x54fc('0x49')],'id');return _0x3d3cd2['removeFaxInteractions'](_0x59b552)[_0x54fc('0xa')](function(){for(var _0xd4bc83=0x0;_0xd4bc83<_0x59b552[_0x54fc('0x1b')];_0xd4bc83+=0x1){_0x11058a[_0x54fc('0x44')](_0x54fc('0x4a'),{'FaxInteractionId':Number(_0x59b552[_0xd4bc83]),'UserId':Number(_0x3d3cd2['id'])});}});}})['then'](function(){if(_0x4e8005===_0x54fc('0x46')){var _0x1fb9d4=_['map'](_0x3d3cd2[_0x54fc('0x25')],'id');return _0x3d3cd2[_0x54fc('0x4b')](_0x1fb9d4)[_0x54fc('0xa')](function(){for(var _0x4fd0d1=0x0;_0x4fd0d1<_0x1fb9d4[_0x54fc('0x1b')];_0x4fd0d1+=0x1){_0x11058a[_0x54fc('0x44')](_0x54fc('0x4c'),{'SmsInteractionId':Number(_0x1fb9d4[_0x4fd0d1]),'UserId':Number(_0x3d3cd2['id'])});}});}})['then'](function(){if(_0x4e8005==='leave'){var _0x2f3019=_[_0x54fc('0x47')](_0x3d3cd2[_0x54fc('0x26')],'id');return _0x3d3cd2[_0x54fc('0x4d')](_0x2f3019)[_0x54fc('0xa')](function(){for(var _0x1a1d00=0x0;_0x1a1d00<_0x2f3019['length'];_0x1a1d00+=0x1){_0x11058a[_0x54fc('0x44')](_0x54fc('0x4e'),{'OpenchannelInteractionId':Number(_0x2f3019[_0x1a1d00]),'UserId':Number(_0x3d3cd2['id'])});}});}})[_0x54fc('0xa')](function(){if(_0x4e8005===_0x54fc('0x46')){var _0x84349f=_[_0x54fc('0x47')](_0x3d3cd2[_0x54fc('0x28')],'id');return _0x3d3cd2['removeWhatsappInteractions'](_0x84349f)[_0x54fc('0xa')](function(){for(var _0x5534aa=0x0;_0x5534aa<_0x84349f[_0x54fc('0x1b')];_0x5534aa+=0x1){_0x11058a['emit'](_0x54fc('0x4f'),{'WhatsappInteractionId':Number(_0x84349f[_0x5534aa]),'UserId':Number(_0x3d3cd2['id'])});}});}})[_0x54fc('0x50')](function(_0xabace7){_0x57d3a4[_0x54fc('0x51')](_0xabace7);});}}function onDisconnect(_0x4d4786,_0x593110){joinOrLeave(_0x4d4786,'leave',_0x593110);}function onConnect(_0x37c445){joinOrLeave(_0x37c445,_0x54fc('0x52'));}exports[_0x54fc('0x53')]=function(_0x207384){_0x207384['on'](_0x54fc('0x54'),function(_0x20a6d5){_0x20a6d5[_0x54fc('0x55')](0x0);_0x20a6d5[_0x54fc('0x56')]=_0x20a6d5['request'][_0x54fc('0x54')][_0x54fc('0x57')]+':'+_0x20a6d5[_0x54fc('0x58')][_0x54fc('0x54')][_0x54fc('0x59')];_0x20a6d5[_0x54fc('0x5a')]=new Date();_0x20a6d5[_0x54fc('0x51')]=function(_0x596048){console[_0x54fc('0x51')](_0x54fc('0x5b')+_0x20a6d5['nsp'][_0x54fc('0x3')]+'['+_0x20a6d5['address']+']',_0x596048);};_0x20a6d5['on'](_0x54fc('0x5c'),function(){onDisconnect(_0x20a6d5,_0x207384);_0x20a6d5[_0x54fc('0x51')](_0x54fc('0x5d'));});onConnect(_0x20a6d5);_0x20a6d5[_0x54fc('0x51')](_0x54fc('0x5e'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 83cf4fd..77a3c87 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 _0x1162=['name','incomingmessage','outgoingmessage','get','opened','changed','closed','interface','default','hasOwnProperty','model','hook','callback','toLowerCase','util','../../mysqldb','triggers','client','http','Chat','ChatInteraction','afterCreate','newinteraction','afterUpdate','ChatMessage','newmessage','Sms','SmsInteraction','closedinteraction','SmsMessage','Whatsapp','WhatsappInteraction','WhatsappMessage','Fax','FaxMessage','Mail','MailInteraction','MailMessage','Openchannel','OpenchannelInteraction','request','EventManager','then','Trigger,\x20%s','error','catch','channel','event','direction','UserId','find','format','SIP/%s'];(function(_0x1f7201,_0x141b79){var _0x289fd2=function(_0x20ce23){while(--_0x20ce23){_0x1f7201['push'](_0x1f7201['shift']());}};_0x289fd2(++_0x141b79);}(_0x1162,0x181));var _0x2116=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x1162[_0x160c73];return _0xd9302;};'use strict';var util=require(_0x2116('0x0'));var db=require(_0x2116('0x1'))['db'];var jayson=require('jayson/promise');var logger=require('../logger')(_0x2116('0x2'));var client=jayson[_0x2116('0x3')][_0x2116('0x4')]({'port':0x232a});var triggers=[{'channel':_0x2116('0x5'),'model':_0x2116('0x6'),'event':_0x2116('0x7'),'condition':_0x2116('0x8'),'callback':afterCreate},{'channel':_0x2116('0x5'),'model':_0x2116('0x6'),'event':_0x2116('0x9'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x2116('0x5'),'model':_0x2116('0xa'),'event':_0x2116('0x7'),'condition':_0x2116('0xb'),'callback':afterCreateMessage},{'channel':_0x2116('0xc'),'model':_0x2116('0xd'),'event':_0x2116('0x7'),'condition':_0x2116('0x8'),'callback':afterCreate},{'channel':_0x2116('0xc'),'model':_0x2116('0xd'),'event':_0x2116('0x9'),'condition':_0x2116('0xe'),'callback':afterUpdate},{'channel':_0x2116('0xc'),'model':_0x2116('0xf'),'event':_0x2116('0x7'),'condition':_0x2116('0xb'),'callback':afterCreateMessage},{'channel':_0x2116('0x10'),'model':_0x2116('0x11'),'event':'afterCreate','condition':_0x2116('0x8'),'callback':afterCreate},{'channel':_0x2116('0x10'),'model':_0x2116('0x11'),'event':_0x2116('0x9'),'condition':_0x2116('0xe'),'callback':afterUpdate},{'channel':_0x2116('0x10'),'model':_0x2116('0x12'),'event':'afterCreate','condition':_0x2116('0xb'),'callback':afterCreateMessage},{'channel':_0x2116('0x13'),'model':'FaxInteraction','event':_0x2116('0x7'),'condition':_0x2116('0x8'),'callback':afterCreate},{'channel':_0x2116('0x13'),'model':'FaxInteraction','event':_0x2116('0x9'),'condition':_0x2116('0xe'),'callback':afterUpdate},{'channel':_0x2116('0x13'),'model':_0x2116('0x14'),'event':_0x2116('0x7'),'condition':_0x2116('0xb'),'callback':afterCreateMessage},{'channel':_0x2116('0x15'),'model':_0x2116('0x16'),'event':_0x2116('0x7'),'condition':_0x2116('0x8'),'callback':afterCreate},{'channel':'Mail','model':_0x2116('0x16'),'event':'afterUpdate','condition':_0x2116('0xe'),'callback':afterUpdate},{'channel':_0x2116('0x15'),'model':_0x2116('0x17'),'event':_0x2116('0x7'),'condition':_0x2116('0xb'),'callback':afterCreateMessage},{'channel':_0x2116('0x18'),'model':_0x2116('0x19'),'event':'afterCreate','condition':_0x2116('0x8'),'callback':afterCreate},{'channel':'Openchannel','model':_0x2116('0x19'),'event':_0x2116('0x9'),'condition':_0x2116('0xe'),'callback':afterUpdate},{'channel':_0x2116('0x18'),'model':'OpenchannelMessage','event':'afterCreate','condition':_0x2116('0xb'),'callback':afterCreateMessage}];function request(_0x221e97){return client[_0x2116('0x1a')](_0x2116('0x1b'),_0x221e97)[_0x2116('0x1c')](function(_0x530b8c){logger['info'](_0x2116('0x1d'),_0x2116('0x1b'),_0x530b8c);if(_0x530b8c[_0x2116('0x1e')]){if(_0x530b8c['error']['code']===0x1f4){logger[_0x2116('0x1e')](_0x2116('0x1d'),'EventManager',_0x530b8c[_0x2116('0x1e')]);}}})[_0x2116('0x1f')](function(_0x5a510f){logger['error']('Trigger,\x20%s',_0x2116('0x1b'),_0x5a510f);});}function afterCreateMessage(_0x56e6a8,_0x11de11){return function(_0x310dc5,_0x7d1dca){_0x310dc5=_0x310dc5['get']({'plain':!![]});_0x310dc5[_0x2116('0x20')]=_0x56e6a8;_0x310dc5[_0x2116('0x21')]=_0x310dc5[_0x2116('0x22')];if(_0x310dc5[_0x2116('0x23')]){return db['User'][_0x2116('0x24')]({'where':{'id':_0x310dc5['UserId']},'attributes':['id','name'],'raw':!![]})[_0x2116('0x1c')](function(_0x3de15e){_0x310dc5['interface']=util[_0x2116('0x25')](_0x2116('0x26'),_0x3de15e[_0x2116('0x27')]);_0x310dc5[_0x2116('0x20')]=_0x56e6a8;return request({'event':_0x2116('0x28'),'message':_0x310dc5});})[_0x2116('0x1f')](function(_0x9ea821){console[_0x2116('0x1e')](_0x9ea821);});}else{return request({'event':_0x2116('0x29'),'message':_0x310dc5});}};}function afterCreate(_0x3e1aca,_0x531384){return function(_0x224aa6,_0x14b7f1){_0x224aa6=_0x224aa6[_0x2116('0x2a')]({'plain':!![]});_0x224aa6[_0x2116('0x20')]=_0x3e1aca;_0x224aa6[_0x2116('0x21')]=_0x2116('0x2b');return request({'event':_0x531384,'message':_0x224aa6});};}function afterUpdate(_0x6c813a,_0x115a39){return function(_0x4c8994,_0x46229a){if(_0x4c8994[_0x2116('0x2c')](_0x2116('0x2d'))&&_0x4c8994['closed']){_0x4c8994=_0x4c8994[_0x2116('0x2a')]({'plain':!![]});_0x4c8994[_0x2116('0x20')]=_0x6c813a;_0x4c8994[_0x2116('0x21')]='closed';if(_0x4c8994[_0x2116('0x23')]){return db['User'][_0x2116('0x24')]({'where':{'id':_0x4c8994[_0x2116('0x23')]},'attributes':['id',_0x2116('0x27')],'raw':!![]})[_0x2116('0x1c')](function(_0x183256){_0x4c8994[_0x2116('0x2e')]=util[_0x2116('0x25')](_0x2116('0x26'),_0x183256[_0x2116('0x27')]);return request({'event':_0x115a39,'message':_0x4c8994});})[_0x2116('0x1f')](function(_0x5adfb3){console[_0x2116('0x1e')](_0x5adfb3);});}else{return request({'event':_0x115a39,'message':_0x4c8994});}}};}exports[_0x2116('0x2f')]=function(){for(var _0x1f29d9=0x0;_0x1f29d9=_0x44a7bf[_0x2f5d('0x10')]){throw Error(_0x2f5d('0x11'));}_0x110c9c(_0x51adec);})[_0x2f5d('0x12')](function(_0x2ecaa9){_0x649623(_0x2ecaa9);});});}; \ No newline at end of file +var _0xd638=['blockedAt','updateAttributes','getLicense','agent','count','then','agents','Maximum\x20login\x20has\x20been\x20reached','catch','lodash','../mysqldb','./license/util','mail','chat','fax','sms','whatsapp','openchannel','isValidChannel','includes','clearBlockUser'];(function(_0x36436d,_0x20292c){var _0x34615d=function(_0x5447af){while(--_0x5447af){_0x36436d['push'](_0x36436d['shift']());}};_0x34615d(++_0x20292c);}(_0xd638,0x72));var _0x8d63=function(_0x5d4510,_0x5aa2c8){_0x5d4510=_0x5d4510-0x0;var _0x3dfae0=_0xd638[_0x5d4510];return _0x3dfae0;};'use strict';var _=require(_0x8d63('0x0'));var BPromise=require('bluebird');var db=require(_0x8d63('0x1'))['db'];var util=require(_0x8d63('0x2'));var channels=['voice',_0x8d63('0x3'),_0x8d63('0x4'),_0x8d63('0x5'),_0x8d63('0x6'),_0x8d63('0x7'),_0x8d63('0x8')];exports['getChannels']=function(){return channels;};exports[_0x8d63('0x9')]=function(_0x28a217){_0x28a217=_0x28a217['toLowerCase']();return _[_0x8d63('0xa')](channels,_0x28a217);};exports[_0x8d63('0xb')]=function(_0x3a0e8e,_0x4c8024,_0xeb008c,_0x58d015){var _0x6869ae={'loginAttempts':_0x4c8024,'blocked':_0xeb008c};if(!_['isUndefined'](_0x58d015)){_0x6869ae[_0x8d63('0xc')]=_0x58d015;}return _0x3a0e8e[_0x8d63('0xd')](_0x6869ae);};exports[_0x8d63('0xe')]=function(_0x44b53e){return new BPromise(function(_0x2d664a,_0x5a940f){var _0x1a464c=0x0;if(_0x44b53e['role']!==_0x8d63('0xf')){_0x2d664a(_0x44b53e);}db['User'][_0x8d63('0x10')]({'where':{'role':_0x8d63('0xf'),'online':!![],'id':{'$ne':_0x44b53e['id']}}})['then'](function(_0xf73270){_0x1a464c=_0xf73270;return util[_0x8d63('0xe')]();})[_0x8d63('0x11')](function(_0x56e4ba){if(_0x56e4ba&&_0x56e4ba['agents']&&_0x1a464c>=_0x56e4ba[_0x8d63('0x12')]){throw Error(_0x8d63('0x13'));}_0x2d664a(_0x44b53e);})[_0x8d63('0x14')](function(_0x1c8919){_0x5a940f(_0x1c8919);});});}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 58a7ddb..53dc2f4 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd903=['status','render','json','send','exports','404'];(function(_0x1c3d9b,_0x3e6ba2){var _0x35e71f=function(_0x24174e){while(--_0x24174e){_0x1c3d9b['push'](_0x1c3d9b['shift']());}};_0x35e71f(++_0x3e6ba2);}(_0xd903,0x12a));var _0x3d90=function(_0x4d9a65,_0x4fbf12){_0x4d9a65=_0x4d9a65-0x0;var _0x2dbb01=_0xd903[_0x4d9a65];return _0x2dbb01;};'use strict';module[_0x3d90('0x0')][0x194]=function pageNotFound(_0x462ca1,_0x4dff9b){var _0x490ab3=_0x3d90('0x1');var _0x5310b0=0x194;var _0x14b616={'status':_0x5310b0};_0x4dff9b[_0x3d90('0x2')](_0x14b616['status']);_0x4dff9b[_0x3d90('0x3')](_0x490ab3,{},function(_0x4eeb37,_0x467550){if(_0x4eeb37){return _0x4dff9b[_0x3d90('0x2')](_0x14b616[_0x3d90('0x2')])[_0x3d90('0x4')](_0x14b616);}_0x4dff9b[_0x3d90('0x5')](_0x467550);});}; \ No newline at end of file +var _0xa412=['404','status','render','json','send','exports'];(function(_0x1ac7ee,_0x426ad3){var _0x28117a=function(_0x47a08b){while(--_0x47a08b){_0x1ac7ee['push'](_0x1ac7ee['shift']());}};_0x28117a(++_0x426ad3);}(_0xa412,0x191));var _0x2a41=function(_0x3874b3,_0x5ed4f7){_0x3874b3=_0x3874b3-0x0;var _0x4ff9f4=_0xa412[_0x3874b3];return _0x4ff9f4;};'use strict';module[_0x2a41('0x0')][0x194]=function pageNotFound(_0x17f97b,_0x552153){var _0x7b750b=_0x2a41('0x1');var _0x15f445=0x194;var _0x5e1743={'status':_0x15f445};_0x552153[_0x2a41('0x2')](_0x5e1743[_0x2a41('0x2')]);_0x552153[_0x2a41('0x3')](_0x7b750b,{},function(_0x20c80f,_0x5859e9){if(_0x20c80f){return _0x552153[_0x2a41('0x2')](_0x5e1743[_0x2a41('0x2')])[_0x2a41('0x4')](_0x5e1743);}_0x552153[_0x2a41('0x5')](_0x5859e9);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index aeeca7a..ce3c147 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x044a=['Action','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','../api/condition/condition.model','Interval','../api/interval/interval.model','Pause','../api/pause/pause.model','../api/cdr/cdr.model','VoiceQueuesLog','Schedule','../api/schedule/schedule.model','Template','Trigger','../api/trigger/trigger.model','Variable','Integration','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','SalesforceAccount','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','../api/intFreshsalesAccount/intFreshsalesAccount.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','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','SquareOdbc','../api/squareOdbc/squareOdbc.model','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','License','../api/license/license.model','Campaign','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','CloudProvider','../api/cloudProvider/cloudProvider.model','Recordings','VoiceQueuesRt','UserId','hasMany','VoiceExtension','Extensions','cascade','HopperFinals','HopperHistory','OpenchannelInteractions','ChatInteractions','FaxInteraction','FaxInteractions','MailInteractions','WhatsappInteractions','Notification','Notifications','SenderId','belongsTo','belongsToMany','Groups','chat_group_has_users','Contacts','CmList','Lists','cm_user_has_lists','user_has_teams','MailInteraction','user_has_mail_interactions','user_has_chat_interactions','user_has_fax_interactions','SmsInteractions','user_has_sms_interactions','VoiceQueue','VoiceQueues','FaxQueues','OpenchannelQueue','OpenchannelQueues','WhatsappQueues','VoicePrefixes','user_has_voice_prefixes','ChatWebsites','user_has_chat_websites','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccount','OpenchannelAccounts','SmsAccounts','user_has_sms_accounts','user_has_whatsapp_accounts','SquareProject','SquareProjects','user_has_square_projects','SpiedAgents','ChanSpyId','Applications','Sound','Sounds','moh_has_sounds','Members','VoiceQueueId','CmHopper','Hoppers','CmHopperHistory','HopperBlacks','JscriptySessions','Trunk','TrunkBackup','IntervalId','mandatoryDispositionPause','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Teams','team_has_voice_queues','BlackLists','VoiceRecording','Messages','mailboxuser','mailbox','QueueCalls','uniqueid','VoiceAgentReport','AgentReports','Contact','MailAccountId','hasOne','Smtp','Dispositions','Answers','Interactions','List','ListId','Agents','team_has_mail_queues','MailInteractionId','Account','ContactId','Owner','Tag','mail_interaction_has_tags','Tags','ThroughTags','Users','Attachments','Interaction','restrict','TagId','Items','FaxAccountId','Exntensions','FaxInteractionId','fax_interaction_has_tags','AttachmentId','team_has_fax_queues','Disposition','SmsAccountId','SmsMessage','sms_interaction_has_tags','SmsInteractionId','team_has_sms_queues','OpenchannelAccountId','user_has_openchannel_accounts','OpenchannelInteractionId','openchannel_interaction_has_tags','user_has_openchannel_interactions','OpenchannelQueueId','team_has_openchannel_queues','ChatWebsiteId','ProactiveActions','Agent','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','ChatInternalMessage','ChatGroupId','CompanyId','HopperHistories','Company','cm_user_has_contacts','cm_contact_has_tags','OwnerId','Condition','OneAll','AutomationAllId','Automation','OneAny','AutomationAnyId','Actions','AutomationId','Intervals','MailApplications','ChatApplications','FaxApplications','AnalyticDefaultReport','DefaultReportId','Mohs','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','TriggerId','Fields','MetricId','Configurations','AccountId','SalesforceConfiguration','Subjects','SubjectId','Descriptions','DescriptionId','FieldId','Field','VariableId','Subject','Description','ZendeskConfiguration','FreshdeskField','FreshsalesAccount','FreshsalesConfiguration','FreshsalesField','FromId','ToId','SessionId','ProjectId','ChatQueues','SmsQueues','team_has_whatsapp_queues','CampaignId','TrunkId','TrunkBackupId','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','FromAccount','FromUserId','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','ChatTransferReport','FromChatWebsiteId','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','ToAccount','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','CustomFields','Queues','userProfileId','UserProfileSection','UserProfileSections','sectionId','WhatsappAccountId','whatsapp_interaction_has_tags','WhatsappInteractionId','WhatsappTransferReport','FromWhatsappAccountId','ToWhatsappAccountId','WhatsappQueueId','path','../config/environment','sequelize','lodash','jstz','determine','defaultsDeep','motion2','xC@LL1234','127.0.0.1','mysql','utf8mb4','utf8','utf8_general_ci','sequelizeHistory','xcall','name','username','password','options','database','User','VoiceChanSpy','import','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','../api/voiceQueue/voiceQueue.model','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','VoiceMailMessage','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','UserOpenchannelQueue','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','MailSubstatus','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','DashboardItem','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','../api/faxInteraction/faxInteraction.model','FaxMessage','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','ReportAgentPreview','CmCustomField','../api/cmCustomField/cmCustomField.model'];(function(_0x2637ac,_0x377857){var _0x4a5758=function(_0x5d5043){while(--_0x5d5043){_0x2637ac['push'](_0x2637ac['shift']());}};_0x4a5758(++_0x377857);}(_0x044a,0x173));var _0xa044=function(_0x2a13a0,_0x5d252c){_0x2a13a0=_0x2a13a0-0x0;var _0x3b1778=_0x044a[_0x2a13a0];return _0x3b1778;};'use strict';var path=require(_0xa044('0x0'));var config=require(_0xa044('0x1'));var Sequelize=require(_0xa044('0x2'));var _=require(_0xa044('0x3'));var jstz=require(_0xa044('0x4'));var timezone=jstz[_0xa044('0x5')]();config[_0xa044('0x2')]=_[_0xa044('0x6')](config[_0xa044('0x2')],{'database':_0xa044('0x7'),'username':'xcall','password':_0xa044('0x8'),'options':{'host':_0xa044('0x9'),'port':0xcea,'dialect':_0xa044('0xa'),'dialectOptions':{'charset':_0xa044('0xb')},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0xa044('0xc'),'collate':_0xa044('0xd')}}});config[_0xa044('0xe')]=_[_0xa044('0x6')](config['sequelizeHistory'],{'database':_0xa044('0x7'),'username':_0xa044('0xf'),'password':_0xa044('0x8'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':_0xa044('0xa'),'dialectOptions':{'charset':_0xa044('0xb')},'logging':![],'timezone':timezone[_0xa044('0x10')](),'define':{'charset':_0xa044('0xc'),'collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xa044('0x2')]['database'],config['sequelize'][_0xa044('0x11')],config[_0xa044('0x2')][_0xa044('0x12')],config[_0xa044('0x2')][_0xa044('0x13')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xa044('0xe')][_0xa044('0x14')],config['sequelizeHistory'][_0xa044('0x11')],config['sequelizeHistory'][_0xa044('0x12')],config[_0xa044('0xe')][_0xa044('0x13')])};db[_0xa044('0x15')]=db[_0xa044('0x2')]['import']('../api/user/user.model');db[_0xa044('0x16')]=db['sequelize'][_0xa044('0x17')](_0xa044('0x18'));db[_0xa044('0x19')]=db[_0xa044('0x2')][_0xa044('0x17')]('../api/voiceContext/voiceContext.model');db['VoiceExtension']=db['sequelize'][_0xa044('0x17')](_0xa044('0x1a'));db[_0xa044('0x1b')]=db['sequelize'][_0xa044('0x17')](_0xa044('0x1c'));db['VoiceQueue']=db[_0xa044('0x2')][_0xa044('0x17')](_0xa044('0x1d'));db['VoiceRecording']=db[_0xa044('0x2')][_0xa044('0x17')](_0xa044('0x1e'));db[_0xa044('0x1f')]=db[_0xa044('0x2')][_0xa044('0x17')](_0xa044('0x20'));db[_0xa044('0x21')]=db[_0xa044('0x2')]['import']('../api/voiceMail/voiceMail.model');db[_0xa044('0x22')]=db[_0xa044('0x2')][_0xa044('0x17')]('../api/voiceMailMessage/voiceMailMessage.model');db[_0xa044('0x23')]=db[_0xa044('0x2')]['import'](_0xa044('0x24'));db[_0xa044('0x25')]=db['sequelize'][_0xa044('0x17')](_0xa044('0x26'));db['VoiceAgentReport']=db['sequelize']['import'](_0xa044('0x27'));db[_0xa044('0x28')]=db[_0xa044('0x2')]['import'](_0xa044('0x29'));db[_0xa044('0x2a')]=db['sequelize'][_0xa044('0x17')]('../api/memberReport/memberReport.model');db['Trunk']=db[_0xa044('0x2')]['import'](_0xa044('0x2b'));db[_0xa044('0x2c')]=db[_0xa044('0x2')][_0xa044('0x17')](_0xa044('0x2d'));db[_0xa044('0x2e')]=db['sequelize'][_0xa044('0x17')](_0xa044('0x2f'));db[_0xa044('0x30')]=db[_0xa044('0x2')]['import'](_0xa044('0x31'));db[_0xa044('0x32')]=db['sequelize']['import'](_0xa044('0x33'));db[_0xa044('0x34')]=db['sequelize'][_0xa044('0x17')](_0xa044('0x35'));db[_0xa044('0x36')]=db['sequelize'][_0xa044('0x17')](_0xa044('0x37'));db[_0xa044('0x38')]=db[_0xa044('0x2')][_0xa044('0x17')]('../api/userSmsQueue/userSmsQueue.model');db[_0xa044('0x39')]=db[_0xa044('0x2')][_0xa044('0x17')]('../api/userOpenchannelQueue/userOpenchannelQueue.model');db[_0xa044('0x3a')]=db[_0xa044('0x2')]['import'](_0xa044('0x3b'));db[_0xa044('0x3c')]=db[_0xa044('0x2')][_0xa044('0x17')](_0xa044('0x3d'));db[_0xa044('0x3e')]=db[_0xa044('0x2')][_0xa044('0x17')]('../api/mailServerOut/mailServerOut.model');db[_0xa044('0x3f')]=db[_0xa044('0x2')][_0xa044('0x17')](_0xa044('0x40'));db[_0xa044('0x41')]=db['sequelize'][_0xa044('0x17')]('../api/mailQueue/mailQueue.model');db[_0xa044('0x42')]=db[_0xa044('0x2')]['import']('../api/mailSubstatus/mailSubstatus.model');db['MailInteraction']=db[_0xa044('0x2')][_0xa044('0x17')](_0xa044('0x43'));db[_0xa044('0x44')]=db[_0xa044('0x2')][_0xa044('0x17')](_0xa044('0x45'));db[_0xa044('0x46')]=db[_0xa044('0x2')][_0xa044('0x17')]('../api/mailApplication/mailApplication.model');db[_0xa044('0x47')]=db[_0xa044('0x2')][_0xa044('0x17')](_0xa044('0x48'));db[_0xa044('0x49')]=db[_0xa044('0x2')][_0xa044('0x17')](_0xa044('0x4a'));db[_0xa044('0x4b')]=db[_0xa044('0x2')]['import']('../api/dashboardItem/dashboardItem.model');db[_0xa044('0x4c')]=db['sequelize'][_0xa044('0x17')](_0xa044('0x4d'));db[_0xa044('0x4e')]=db[_0xa044('0x2')][_0xa044('0x17')](_0xa044('0x4f'));db['FaxInteraction']=db[_0xa044('0x2')]['import'](_0xa044('0x50'));db[_0xa044('0x51')]=db[_0xa044('0x2')]['import']('../api/faxMessage/faxMessage.model');db[_0xa044('0x52')]=db[_0xa044('0x2')][_0xa044('0x17')](_0xa044('0x53'));db[_0xa044('0x54')]=db[_0xa044('0x2')]['import'](_0xa044('0x55'));db[_0xa044('0x56')]=db[_0xa044('0x2')][_0xa044('0x17')](_0xa044('0x57'));db[_0xa044('0x58')]=db[_0xa044('0x2')][_0xa044('0x17')](_0xa044('0x59'));db[_0xa044('0x5a')]=db[_0xa044('0x2')][_0xa044('0x17')](_0xa044('0x5b'));db['SmsMessage']=db[_0xa044('0x2')][_0xa044('0x17')](_0xa044('0x5c'));db[_0xa044('0x5d')]=db[_0xa044('0x2')][_0xa044('0x17')](_0xa044('0x5e'));db['OpenchannelAccount']=db['sequelize'][_0xa044('0x17')](_0xa044('0x5f'));db[_0xa044('0x60')]=db[_0xa044('0x2')]['import'](_0xa044('0x61'));db[_0xa044('0x62')]=db[_0xa044('0x2')][_0xa044('0x17')](_0xa044('0x63'));db[_0xa044('0x64')]=db['sequelize'][_0xa044('0x17')]('../api/openchannelMessage/openchannelMessage.model');db['OpenchannelQueue']=db[_0xa044('0x2')][_0xa044('0x17')](_0xa044('0x65'));db[_0xa044('0x66')]=db['sequelize']['import']('../api/chatWebsite/chatWebsite.model');db[_0xa044('0x67')]=db[_0xa044('0x2')]['import'](_0xa044('0x68'));db[_0xa044('0x69')]=db['sequelize']['import'](_0xa044('0x6a'));db[_0xa044('0x6b')]=db[_0xa044('0x2')][_0xa044('0x17')]('../api/chatInteraction/chatInteraction.model');db[_0xa044('0x6c')]=db[_0xa044('0x2')][_0xa044('0x17')](_0xa044('0x6d'));db[_0xa044('0x6e')]=db[_0xa044('0x2')][_0xa044('0x17')](_0xa044('0x6f'));db[_0xa044('0x70')]=db[_0xa044('0x2')][_0xa044('0x17')](_0xa044('0x71'));db[_0xa044('0x72')]=db[_0xa044('0x2')][_0xa044('0x17')]('../api/chatGroup/chatGroup.model');db[_0xa044('0x73')]=db[_0xa044('0x2')][_0xa044('0x17')](_0xa044('0x74'));db[_0xa044('0x75')]=db[_0xa044('0x2')]['import'](_0xa044('0x76'));db[_0xa044('0x77')]=db[_0xa044('0x2')][_0xa044('0x17')](_0xa044('0x78'));db['CmHopper']=db[_0xa044('0x2')]['import']('../api/cmHopper/cmHopper.model');db[_0xa044('0x79')]=db[_0xa044('0x2')]['import'](_0xa044('0x7a'));db[_0xa044('0x7b')]=db['sequelize'][_0xa044('0x17')]('../api/cmHopperFinal/cmHopperFinal.model');db['CmHopperHistory']=db[_0xa044('0x2')]['import']('../api/cmHopperHistory/cmHopperHistory.model');db[_0xa044('0x7c')]=db[_0xa044('0x2')][_0xa044('0x17')]('../api/reportAgentPreview/reportAgentPreview.model');db[_0xa044('0x7d')]=db[_0xa044('0x2')][_0xa044('0x17')](_0xa044('0x7e'));db[_0xa044('0x7f')]=db[_0xa044('0x2')][_0xa044('0x17')]('../api/action/action.model');db['Automation']=db[_0xa044('0x2')][_0xa044('0x17')](_0xa044('0x80'));db[_0xa044('0x81')]=db[_0xa044('0x2')]['import'](_0xa044('0x82'));db['Disposition']=db[_0xa044('0x2')][_0xa044('0x17')]('../api/disposition/disposition.model');db['Condition']=db[_0xa044('0x2')][_0xa044('0x17')](_0xa044('0x83'));db[_0xa044('0x84')]=db[_0xa044('0x2')][_0xa044('0x17')](_0xa044('0x85'));db[_0xa044('0x86')]=db[_0xa044('0x2')][_0xa044('0x17')](_0xa044('0x87'));db['Cdr']=db['sequelize'][_0xa044('0x17')](_0xa044('0x88'));db[_0xa044('0x89')]=db[_0xa044('0x2')]['import']('../api/voiceQueuesLog/voiceQueuesLog.model');db[_0xa044('0x8a')]=db[_0xa044('0x2')][_0xa044('0x17')](_0xa044('0x8b'));db['Sound']=db['sequelize'][_0xa044('0x17')]('../api/sound/sound.model');db['Tag']=db['sequelize'][_0xa044('0x17')]('../api/tag/tag.model');db[_0xa044('0x8c')]=db[_0xa044('0x2')]['import']('../api/template/template.model');db[_0xa044('0x8d')]=db[_0xa044('0x2')][_0xa044('0x17')](_0xa044('0x8e'));db[_0xa044('0x8f')]=db[_0xa044('0x2')]['import']('../api/variable/variable.model');db[_0xa044('0x90')]=db[_0xa044('0x2')]['import'](_0xa044('0x91'));db[_0xa044('0x92')]=db[_0xa044('0x2')][_0xa044('0x17')](_0xa044('0x93'));db[_0xa044('0x94')]=db[_0xa044('0x2')][_0xa044('0x17')](_0xa044('0x95'));db['AnalyticDefaultReport']=db[_0xa044('0x2')][_0xa044('0x17')](_0xa044('0x96'));db['AnalyticExtractedReport']=db['sequelize']['import']('../api/analyticExtractedReport/analyticExtractedReport.model');db[_0xa044('0x97')]=db['sequelize'][_0xa044('0x17')](_0xa044('0x98'));db[_0xa044('0x99')]=db[_0xa044('0x2')][_0xa044('0x17')](_0xa044('0x9a'));db[_0xa044('0x9b')]=db['sequelize'][_0xa044('0x17')]('../api/analyticTreeReport/analyticTreeReport.model');db[_0xa044('0x9c')]=db['sequelize'][_0xa044('0x17')]('../api/intSalesforceAccount/intSalesforceAccount.model');db['SalesforceConfiguration']=db[_0xa044('0x2')][_0xa044('0x17')](_0xa044('0x9d'));db[_0xa044('0x9e')]=db['sequelize'][_0xa044('0x17')](_0xa044('0x9f'));db[_0xa044('0xa0')]=db['sequelize'][_0xa044('0x17')](_0xa044('0xa1'));db[_0xa044('0xa2')]=db[_0xa044('0x2')][_0xa044('0x17')](_0xa044('0xa3'));db[_0xa044('0xa4')]=db[_0xa044('0x2')][_0xa044('0x17')](_0xa044('0xa5'));db[_0xa044('0xa6')]=db[_0xa044('0x2')][_0xa044('0x17')](_0xa044('0xa7'));db[_0xa044('0xa8')]=db['sequelize'][_0xa044('0x17')](_0xa044('0xa9'));db[_0xa044('0xaa')]=db[_0xa044('0x2')][_0xa044('0x17')](_0xa044('0xab'));db[_0xa044('0xac')]=db[_0xa044('0x2')][_0xa044('0x17')](_0xa044('0xad'));db[_0xa044('0xae')]=db[_0xa044('0x2')][_0xa044('0x17')](_0xa044('0xaf'));db[_0xa044('0xb0')]=db[_0xa044('0x2')][_0xa044('0x17')](_0xa044('0xb1'));db[_0xa044('0xb2')]=db['sequelize']['import'](_0xa044('0xb3'));db['ZendeskConfiguration']=db[_0xa044('0x2')][_0xa044('0x17')](_0xa044('0xb4'));db[_0xa044('0xb5')]=db[_0xa044('0x2')][_0xa044('0x17')](_0xa044('0xb6'));db[_0xa044('0xb7')]=db[_0xa044('0x2')][_0xa044('0x17')](_0xa044('0xb8'));db[_0xa044('0xb9')]=db[_0xa044('0x2')][_0xa044('0x17')]('../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model');db['FreshdeskField']=db[_0xa044('0x2')][_0xa044('0x17')]('../api/intFreshdeskField/intFreshdeskField.model');db[_0xa044('0xba')]=db[_0xa044('0x2')][_0xa044('0x17')](_0xa044('0xbb'));db[_0xa044('0xbc')]=db[_0xa044('0x2')]['import'](_0xa044('0xbd'));db[_0xa044('0xbe')]=db[_0xa044('0x2')][_0xa044('0x17')](_0xa044('0xbf'));db[_0xa044('0xc0')]=db[_0xa044('0x2')][_0xa044('0x17')](_0xa044('0xc1'));db[_0xa044('0xc2')]=db[_0xa044('0x2')][_0xa044('0x17')](_0xa044('0xc3'));db[_0xa044('0xc4')]=db[_0xa044('0x2')][_0xa044('0x17')]('../api/intServicenowField/intServicenowField.model');db[_0xa044('0xc5')]=db[_0xa044('0x2')][_0xa044('0x17')](_0xa044('0xc6'));db[_0xa044('0xc7')]=db[_0xa044('0x2')][_0xa044('0x17')](_0xa044('0xc8'));db[_0xa044('0xc9')]=db[_0xa044('0x2')]['import'](_0xa044('0xca'));db['FreshsalesAccount']=db['sequelize']['import'](_0xa044('0xcb'));db['FreshsalesConfiguration']=db['sequelize'][_0xa044('0x17')]('../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model');db['FreshsalesField']=db[_0xa044('0x2')][_0xa044('0x17')]('../api/intFreshsalesField/intFreshsalesField.model');db['Integration']=db[_0xa044('0x2')]['import'](_0xa044('0x91'));db['Network']=db[_0xa044('0x2')][_0xa044('0x17')]('../api/network/network.model');db[_0xa044('0xcc')]=db['sequelize'][_0xa044('0x17')](_0xa044('0xcd'));db['ChatInternalMessage']=db['sequelize'][_0xa044('0x17')](_0xa044('0xce'));db[_0xa044('0xcf')]=db[_0xa044('0x2')][_0xa044('0x17')](_0xa044('0xd0'));db[_0xa044('0xd1')]=db['sequelize'][_0xa044('0x17')](_0xa044('0xd2'));db[_0xa044('0xd3')]=db['sequelize'][_0xa044('0x17')](_0xa044('0xd4'));db[_0xa044('0xd5')]=db[_0xa044('0x2')]['import'](_0xa044('0xd6'));db[_0xa044('0xd7')]=db['sequelize'][_0xa044('0x17')](_0xa044('0xd8'));db[_0xa044('0xd9')]=db[_0xa044('0x2')][_0xa044('0x17')](_0xa044('0xda'));db[_0xa044('0xdb')]=db[_0xa044('0x2')][_0xa044('0x17')](_0xa044('0xdc'));db[_0xa044('0xdd')]=db[_0xa044('0x2')]['import'](_0xa044('0xde'));db[_0xa044('0xdf')]=db[_0xa044('0x2')]['import'](_0xa044('0xe0'));db['SquareProject']=db['sequelize'][_0xa044('0x17')]('../api/squareProject/squareProject.model');db['SquareRecording']=db[_0xa044('0x2')][_0xa044('0x17')]('../api/squareRecording/squareRecording.model');db['SquareMessage']=db[_0xa044('0x2')][_0xa044('0x17')](_0xa044('0xe1'));db[_0xa044('0xe2')]=db[_0xa044('0x2')][_0xa044('0x17')](_0xa044('0xe3'));db[_0xa044('0xe4')]=db[_0xa044('0x2')][_0xa044('0x17')](_0xa044('0xe5'));db[_0xa044('0xe6')]=db[_0xa044('0x2')][_0xa044('0x17')]('../api/campaign/campaign.model');db[_0xa044('0xe7')]=db[_0xa044('0x2')][_0xa044('0x17')](_0xa044('0xe8'));db[_0xa044('0xe9')]=db[_0xa044('0x2')][_0xa044('0x17')](_0xa044('0xea'));db[_0xa044('0xeb')]=db[_0xa044('0x2')]['import'](_0xa044('0xec'));db[_0xa044('0xed')]=db[_0xa044('0x2')][_0xa044('0x17')](_0xa044('0xee'));db['ChatTransferReport']=db[_0xa044('0x2')][_0xa044('0x17')](_0xa044('0xef'));db[_0xa044('0xf0')]=db[_0xa044('0x2')][_0xa044('0x17')](_0xa044('0xf1'));db[_0xa044('0xf2')]=db[_0xa044('0x2')][_0xa044('0x17')](_0xa044('0xf3'));db[_0xa044('0xf4')]=db['sequelize'][_0xa044('0x17')](_0xa044('0xf5'));db['CmList']=db[_0xa044('0x2')][_0xa044('0x17')](_0xa044('0xf6'));db[_0xa044('0xf7')]=db['sequelize'][_0xa044('0x17')](_0xa044('0xf8'));db[_0xa044('0xf9')]=db[_0xa044('0x2')]['import'](_0xa044('0xfa'));db['UserProfileSection']=db['sequelize'][_0xa044('0x17')](_0xa044('0xfb'));db[_0xa044('0xfc')]=db[_0xa044('0x2')][_0xa044('0x17')](_0xa044('0xfd'));db['Notification']=db[_0xa044('0x2')][_0xa044('0x17')]('../api/notification/notification.model');db[_0xa044('0xfe')]=db[_0xa044('0x2')][_0xa044('0x17')](_0xa044('0xff'));db[_0xa044('0x100')]=db[_0xa044('0x2')][_0xa044('0x17')](_0xa044('0x101'));db[_0xa044('0x102')]=db[_0xa044('0x2')][_0xa044('0x17')]('../api/whatsappInteraction/whatsappInteraction.model');db[_0xa044('0x103')]=db[_0xa044('0x2')][_0xa044('0x17')]('../api/whatsappMessage/whatsappMessage.model');db[_0xa044('0x104')]=db[_0xa044('0x2')][_0xa044('0x17')](_0xa044('0x105'));db['WhatsappTransferReport']=db[_0xa044('0x2')]['import'](_0xa044('0x106'));db[_0xa044('0x107')]=db[_0xa044('0x2')][_0xa044('0x17')]('../api/whatsappQueue/whatsappQueue.model');db[_0xa044('0x108')]=db['sequelize'][_0xa044('0x17')](_0xa044('0x109'));db[_0xa044('0x15')]['hasOne'](db[_0xa044('0x21')],{'as':_0xa044('0x21'),'onDelete':'cascade','foreignKey':'UserId'});db[_0xa044('0x15')]['hasMany'](db['VoiceRecording'],{'as':_0xa044('0x10a'),'foreignKey':'UserId'});db[_0xa044('0x15')]['hasMany'](db[_0xa044('0x2e')],{'as':_0xa044('0x10b'),'foreignKey':_0xa044('0x10c')});db[_0xa044('0x15')][_0xa044('0x10d')](db[_0xa044('0x10e')],{'as':_0xa044('0x10f'),'onDelete':_0xa044('0x110'),'hooks':!![]});db['User'][_0xa044('0x10d')](db[_0xa044('0x7b')],{'as':_0xa044('0x111'),'foreignKey':_0xa044('0x10c')});db['User'][_0xa044('0x10d')](db['CmHopperHistory'],{'as':_0xa044('0x112'),'foreignKey':_0xa044('0x10c')});db[_0xa044('0x15')]['hasMany'](db[_0xa044('0x7c')],{'as':'ReportAgentPreview','foreignKey':_0xa044('0x10c')});db[_0xa044('0x15')][_0xa044('0x10d')](db[_0xa044('0x62')],{'as':_0xa044('0x113'),'foreignKey':_0xa044('0x10c')});db['User']['hasMany'](db[_0xa044('0x6b')],{'as':_0xa044('0x114'),'foreignKey':'UserId'});db[_0xa044('0x15')][_0xa044('0x10d')](db[_0xa044('0x5a')],{'as':'SmsInteractions','foreignKey':_0xa044('0x10c')});db[_0xa044('0x15')][_0xa044('0x10d')](db[_0xa044('0x115')],{'as':_0xa044('0x116'),'foreignKey':_0xa044('0x10c')});db[_0xa044('0x15')][_0xa044('0x10d')](db['MailInteraction'],{'as':_0xa044('0x117'),'foreignKey':_0xa044('0x10c')});db[_0xa044('0x15')][_0xa044('0x10d')](db[_0xa044('0x102')],{'as':_0xa044('0x118'),'foreignKey':'UserId'});db[_0xa044('0x15')][_0xa044('0x10d')](db[_0xa044('0x119')],{'as':_0xa044('0x11a'),'foreignKey':_0xa044('0x11b')});db[_0xa044('0x15')][_0xa044('0x11c')](db[_0xa044('0xf9')],{'as':'UserProfile','foreignKey':'userProfileId'});db[_0xa044('0x15')][_0xa044('0x11d')](db['ChatGroup'],{'as':_0xa044('0x11e'),'through':_0xa044('0x11f')});db[_0xa044('0x15')]['belongsToMany'](db[_0xa044('0x77')],{'as':_0xa044('0x120'),'through':'cm_user_has_contacts'});db['User'][_0xa044('0x11d')](db[_0xa044('0x121')],{'as':_0xa044('0x122'),'through':_0xa044('0x123')});db[_0xa044('0x15')][_0xa044('0x11d')](db['Team'],{'through':_0xa044('0x124')});db[_0xa044('0x15')][_0xa044('0x11d')](db[_0xa044('0x125')],{'as':_0xa044('0x117'),'through':_0xa044('0x126')});db[_0xa044('0x15')][_0xa044('0x11d')](db[_0xa044('0x6b')],{'as':_0xa044('0x114'),'through':_0xa044('0x127')});db[_0xa044('0x15')][_0xa044('0x11d')](db[_0xa044('0x115')],{'as':_0xa044('0x116'),'through':_0xa044('0x128')});db[_0xa044('0x15')][_0xa044('0x11d')](db[_0xa044('0x5a')],{'as':_0xa044('0x129'),'through':_0xa044('0x12a')});db[_0xa044('0x15')][_0xa044('0x11d')](db[_0xa044('0x62')],{'as':_0xa044('0x113'),'through':'user_has_openchannel_interactions'});db[_0xa044('0x15')]['belongsToMany'](db[_0xa044('0x102')],{'as':_0xa044('0x118'),'through':'user_has_whatsapp_interactions'});db['User'][_0xa044('0x11d')](db[_0xa044('0x12b')],{'as':_0xa044('0x12c'),'through':'UserVoiceQueue','required':![]});db[_0xa044('0x15')]['belongsToMany'](db['MailQueue'],{'as':'MailQueues','through':'UserMailQueue','required':![]});db['User'][_0xa044('0x11d')](db[_0xa044('0x70')],{'as':'ChatQueues','through':_0xa044('0x32'),'required':![],'hooks':!![]});db[_0xa044('0x15')][_0xa044('0x11d')](db[_0xa044('0x52')],{'as':_0xa044('0x12d'),'through':_0xa044('0x36'),'required':![]});db['User']['belongsToMany'](db[_0xa044('0x5d')],{'as':'SmsQueues','through':'UserSmsQueue','required':![]});db[_0xa044('0x15')][_0xa044('0x11d')](db[_0xa044('0x12e')],{'as':_0xa044('0x12f'),'through':'UserOpenchannelQueue','required':![]});db['User'][_0xa044('0x11d')](db[_0xa044('0x107')],{'as':_0xa044('0x130'),'through':_0xa044('0x3a'),'required':![]});db[_0xa044('0x15')][_0xa044('0x11d')](db[_0xa044('0x121')],{'through':_0xa044('0x123')});db[_0xa044('0x15')]['belongsToMany'](db[_0xa044('0xf7')],{'as':_0xa044('0x131'),'through':_0xa044('0x132'),'required':![]});db[_0xa044('0x15')][_0xa044('0x11d')](db[_0xa044('0x66')],{'as':_0xa044('0x133'),'through':_0xa044('0x134')});db[_0xa044('0x15')]['belongsToMany'](db[_0xa044('0x4c')],{'as':'FaxAccounts','through':_0xa044('0x135')});db[_0xa044('0x15')]['belongsToMany'](db[_0xa044('0x3f')],{'as':_0xa044('0x136'),'through':_0xa044('0x137')});db[_0xa044('0x15')][_0xa044('0x11d')](db[_0xa044('0x138')],{'as':_0xa044('0x139'),'through':'user_has_openchannel_accounts'});db[_0xa044('0x15')][_0xa044('0x11d')](db[_0xa044('0x56')],{'as':_0xa044('0x13a'),'through':_0xa044('0x13b')});db[_0xa044('0x15')][_0xa044('0x11d')](db[_0xa044('0xfe')],{'as':'WhatsappAccounts','through':_0xa044('0x13c')});db[_0xa044('0x15')]['belongsToMany'](db[_0xa044('0x13d')],{'as':_0xa044('0x13e'),'through':_0xa044('0x13f')});db[_0xa044('0x16')][_0xa044('0x10d')](db[_0xa044('0x10e')],{'as':_0xa044('0x140'),'onDelete':'cascade','foreignKey':_0xa044('0x141')});db[_0xa044('0x19')][_0xa044('0x10d')](db[_0xa044('0x10e')],{'onDelete':_0xa044('0x110')});db[_0xa044('0x10e')][_0xa044('0x10d')](db['VoiceExtension'],{'as':_0xa044('0x142'),'onDelete':_0xa044('0x110')});db['VoiceMusicOnHold'][_0xa044('0x11d')](db[_0xa044('0x143')],{'as':_0xa044('0x144'),'through':_0xa044('0x145')});db['VoiceQueue'][_0xa044('0x10d')](db[_0xa044('0x2e')],{'as':_0xa044('0x146'),'foreignKey':_0xa044('0x147')});db['VoiceQueue'][_0xa044('0x10d')](db[_0xa044('0x148')],{'as':_0xa044('0x149'),'foreignKey':_0xa044('0x147')});db[_0xa044('0x12b')]['hasMany'](db[_0xa044('0x7b')],{'as':'HopperFinals','foreignKey':_0xa044('0x147')});db[_0xa044('0x12b')][_0xa044('0x10d')](db[_0xa044('0x14a')],{'as':'HopperHistories','foreignKey':_0xa044('0x147')});db[_0xa044('0x12b')][_0xa044('0x10d')](db[_0xa044('0x7c')],{'as':_0xa044('0x7c'),'foreignKey':_0xa044('0x147')});db[_0xa044('0x12b')]['hasMany'](db[_0xa044('0x79')],{'as':_0xa044('0x14b'),'foreignKey':_0xa044('0x147')});db['VoiceQueue'][_0xa044('0x10d')](db[_0xa044('0xd3')],{'as':_0xa044('0x14c'),'foreignKey':_0xa044('0x147')});db['VoiceQueue']['belongsTo'](db[_0xa044('0x14d')],{'as':_0xa044('0x14d'),'foreignKey':'TrunkId'});db[_0xa044('0x12b')][_0xa044('0x11c')](db[_0xa044('0x14d')],{'as':_0xa044('0x14e'),'foreignKey':'TrunkBackupId'});db[_0xa044('0x12b')][_0xa044('0x11c')](db[_0xa044('0x84')],{'as':_0xa044('0x84'),'foreignKey':_0xa044('0x14f')});db['VoiceQueue']['belongsTo'](db[_0xa044('0x86')],{'as':_0xa044('0x150'),'foreignKey':_0xa044('0x151')});db[_0xa044('0x12b')][_0xa044('0x11d')](db[_0xa044('0x121')],{'as':_0xa044('0x122'),'through':_0xa044('0x152')});db[_0xa044('0x12b')][_0xa044('0x11d')](db[_0xa044('0x15')],{'as':'Agents','through':_0xa044('0x30')});db[_0xa044('0x12b')][_0xa044('0x11d')](db[_0xa044('0xe2')],{'as':_0xa044('0x153'),'through':_0xa044('0x154')});db[_0xa044('0x12b')][_0xa044('0x11d')](db[_0xa044('0x121')],{'as':_0xa044('0x155'),'through':'voice_queues_has_cm_blacklists'});db[_0xa044('0x156')][_0xa044('0x11c')](db['User'],{'as':_0xa044('0x15'),'foreignKey':_0xa044('0x10c')});db['ScreenRecording']['belongsTo'](db[_0xa044('0x15')],{'as':_0xa044('0x15'),'foreignKey':_0xa044('0x10c')});db['VoiceMail'][_0xa044('0x10d')](db[_0xa044('0x22')],{'as':_0xa044('0x157'),'onDelete':_0xa044('0x110'),'foreignKey':_0xa044('0x158'),'sourceKey':_0xa044('0x159')});db['VoiceMailMessage'][_0xa044('0x11c')](db[_0xa044('0x21')],{'foreignKey':_0xa044('0x158'),'targetKey':'mailbox'});db[_0xa044('0x23')]['hasMany'](db[_0xa044('0x28')],{'as':_0xa044('0x15a'),'foreignKey':_0xa044('0x15b'),'constraints':![]});db[_0xa044('0x23')][_0xa044('0x10d')](db[_0xa044('0x15c')],{'as':_0xa044('0x15d'),'foreignKey':_0xa044('0x15b'),'constraints':![]});db[_0xa044('0x23')][_0xa044('0x11c')](db['User'],{'as':_0xa044('0x15'),'foreignKey':_0xa044('0x10c')});db['VoiceCallReport'][_0xa044('0x11c')](db['CmContact'],{'as':_0xa044('0x15e'),'foreignKey':'ContactId'});db[_0xa044('0x3c')][_0xa044('0x11c')](db[_0xa044('0x3f')],{'as':_0xa044('0x3f'),'foreignKey':'MailAccountId'});db[_0xa044('0x3e')][_0xa044('0x11c')](db[_0xa044('0x3f')],{'as':_0xa044('0x3f'),'foreignKey':_0xa044('0x15f')});db['MailAccount'][_0xa044('0x160')](db[_0xa044('0x3c')],{'as':'Imap','onDelete':_0xa044('0x110')});db['MailAccount']['hasOne'](db[_0xa044('0x3e')],{'as':_0xa044('0x161'),'onDelete':_0xa044('0x110')});db['MailAccount']['hasMany'](db['Disposition'],{'as':_0xa044('0x162'),'foreignKey':_0xa044('0x15f')});db[_0xa044('0x3f')][_0xa044('0x10d')](db[_0xa044('0x81')],{'as':_0xa044('0x163'),'foreignKey':_0xa044('0x15f')});db[_0xa044('0x3f')][_0xa044('0x10d')](db[_0xa044('0x44')],{'as':'Messages','foreignKey':'MailAccountId'});db[_0xa044('0x3f')][_0xa044('0x10d')](db['MailInteraction'],{'as':_0xa044('0x164')});db[_0xa044('0x3f')][_0xa044('0x10d')](db['MailApplication'],{'as':_0xa044('0x142')});db[_0xa044('0x3f')]['belongsTo'](db['CmList'],{'as':_0xa044('0x165'),'foreignKey':_0xa044('0x166')});db[_0xa044('0x3f')][_0xa044('0x11c')](db['Template'],{'as':_0xa044('0x8c'),'foreignKey':'TemplateId'});db[_0xa044('0x3f')][_0xa044('0x11c')](db[_0xa044('0x86')],{'as':_0xa044('0x150'),'foreignKey':_0xa044('0x151')});db[_0xa044('0x3f')][_0xa044('0x11d')](db[_0xa044('0x15')],{'as':_0xa044('0x167'),'through':'user_has_mail_accounts'});db[_0xa044('0x41')]['belongsToMany'](db[_0xa044('0x15')],{'as':_0xa044('0x167'),'through':_0xa044('0x34')});db[_0xa044('0x41')][_0xa044('0x11d')](db[_0xa044('0xe2')],{'through':_0xa044('0x168'),'as':_0xa044('0x153')});db[_0xa044('0x125')][_0xa044('0x10d')](db[_0xa044('0x44')],{'as':'Messages','onDelete':_0xa044('0x110'),'foreignKey':_0xa044('0x169')});db[_0xa044('0x125')][_0xa044('0x11c')](db[_0xa044('0x3f')],{'as':_0xa044('0x16a'),'foreignKey':_0xa044('0x15f')});db['MailInteraction'][_0xa044('0x11c')](db['CmContact'],{'as':_0xa044('0x15e'),'foreignKey':_0xa044('0x16b')});db['MailInteraction'][_0xa044('0x11c')](db[_0xa044('0x15')],{'as':_0xa044('0x16c'),'foreignKey':_0xa044('0x10c')});db[_0xa044('0x125')][_0xa044('0x11d')](db[_0xa044('0x16d')],{'through':_0xa044('0x16e'),'as':_0xa044('0x16f')});db[_0xa044('0x125')][_0xa044('0x11d')](db[_0xa044('0x16d')],{'through':_0xa044('0x16e'),'as':_0xa044('0x170')});db[_0xa044('0x125')][_0xa044('0x11d')](db['User'],{'as':_0xa044('0x171'),'through':_0xa044('0x126'),'foreignKey':_0xa044('0x169')});db[_0xa044('0x44')][_0xa044('0x10d')](db[_0xa044('0xe9')],{'as':_0xa044('0x172'),'onDelete':_0xa044('0x110')});db[_0xa044('0x44')][_0xa044('0x11c')](db[_0xa044('0x15')],{'as':_0xa044('0x15')});db[_0xa044('0x44')][_0xa044('0x11c')](db['CmContact'],{'onDelete':_0xa044('0x110'),'as':_0xa044('0x15e')});db[_0xa044('0x44')][_0xa044('0x11c')](db[_0xa044('0x125')],{'as':_0xa044('0x173'),'foreignKey':'MailInteractionId'});db[_0xa044('0x44')][_0xa044('0x11c')](db[_0xa044('0x3f')],{'as':'Account','foreignKey':_0xa044('0x15f')});db[_0xa044('0x46')]['belongsTo'](db['User'],{'onDelete':_0xa044('0x174')});db[_0xa044('0x46')][_0xa044('0x11c')](db[_0xa044('0x41')],{'onDelete':_0xa044('0x174')});db['MailApplication'][_0xa044('0x11c')](db[_0xa044('0x3f')],{'onDelete':_0xa044('0x174')});db[_0xa044('0x46')][_0xa044('0x11c')](db[_0xa044('0x84')],{'onDelete':_0xa044('0x174'),'foreignKey':'IntervalId'});db[_0xa044('0x46')][_0xa044('0x11c')](db[_0xa044('0x16d')],{'onDelete':'restrict','foreignKey':_0xa044('0x175')});db[_0xa044('0x47')][_0xa044('0x11c')](db[_0xa044('0x3f')],{});db['MailQueueReport']['belongsTo'](db[_0xa044('0x121')],{'as':_0xa044('0x165'),'foreignKey':_0xa044('0x166')});db[_0xa044('0x47')][_0xa044('0x11c')](db['CmContact'],{'as':_0xa044('0x15e'),'foreignKey':'ContactId'});db[_0xa044('0x47')]['belongsTo'](db[_0xa044('0x125')],{});db[_0xa044('0x47')][_0xa044('0x11c')](db[_0xa044('0x44')],{});db[_0xa044('0x47')]['belongsTo'](db['User'],{});db[_0xa044('0x47')][_0xa044('0x11c')](db[_0xa044('0x41')],{});db[_0xa044('0x49')][_0xa044('0x10d')](db[_0xa044('0x4b')],{'as':_0xa044('0x176'),'onDelete':_0xa044('0x110')});db[_0xa044('0x4c')][_0xa044('0x10d')](db['Disposition'],{'as':_0xa044('0x162'),'foreignKey':_0xa044('0x177')});db['FaxAccount']['hasMany'](db[_0xa044('0x81')],{'as':_0xa044('0x163'),'foreignKey':_0xa044('0x177')});db[_0xa044('0x4c')]['hasMany'](db[_0xa044('0x115')],{'as':'Interactions'});db[_0xa044('0x4c')][_0xa044('0x10d')](db[_0xa044('0x4e')],{'as':_0xa044('0x142')});db[_0xa044('0x4c')][_0xa044('0x10d')](db[_0xa044('0x10e')],{'as':_0xa044('0x178'),'onDelete':'cascade'});db['FaxAccount'][_0xa044('0x10d')](db['FaxMessage'],{'as':_0xa044('0x157')});db[_0xa044('0x4c')][_0xa044('0x11c')](db[_0xa044('0x14d')],{'as':_0xa044('0x14d')});db[_0xa044('0x4c')][_0xa044('0x11c')](db[_0xa044('0x121')],{'as':_0xa044('0x165'),'foreignKey':_0xa044('0x166')});db[_0xa044('0x4c')]['belongsTo'](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0xa044('0x151')});db[_0xa044('0x4c')][_0xa044('0x11d')](db[_0xa044('0x15')],{'as':_0xa044('0x167'),'through':_0xa044('0x135')});db['FaxApplication'][_0xa044('0x11c')](db[_0xa044('0x15')],{'onDelete':_0xa044('0x174')});db[_0xa044('0x4e')][_0xa044('0x11c')](db['FaxQueue'],{'onDelete':_0xa044('0x174')});db['FaxApplication']['belongsTo'](db[_0xa044('0x4c')],{'onDelete':_0xa044('0x174')});db[_0xa044('0x4e')][_0xa044('0x11c')](db['Tag'],{'onDelete':_0xa044('0x174'),'foreignKey':_0xa044('0x175')});db[_0xa044('0x115')]['hasMany'](db[_0xa044('0x51')],{'as':_0xa044('0x157'),'onDelete':_0xa044('0x110'),'foreignKey':_0xa044('0x179')});db['FaxInteraction'][_0xa044('0x11c')](db['FaxAccount'],{'as':_0xa044('0x16a'),'foreignKey':_0xa044('0x177')});db[_0xa044('0x115')][_0xa044('0x11c')](db[_0xa044('0x77')],{'as':'Contact','foreignKey':_0xa044('0x16b')});db[_0xa044('0x115')]['belongsTo'](db[_0xa044('0x15')],{'as':'Owner','foreignKey':_0xa044('0x10c')});db[_0xa044('0x115')]['belongsToMany'](db['Tag'],{'through':_0xa044('0x17a'),'as':'Tags'});db[_0xa044('0x115')]['belongsToMany'](db[_0xa044('0x16d')],{'through':'fax_interaction_has_tags','as':'ThroughTags'});db['FaxInteraction'][_0xa044('0x11d')](db['User'],{'as':_0xa044('0x171'),'through':_0xa044('0x128'),'foreignKey':_0xa044('0x179')});db[_0xa044('0x51')][_0xa044('0x11c')](db['User'],{'onDelete':_0xa044('0x110'),'as':_0xa044('0x15')});db[_0xa044('0x51')][_0xa044('0x11c')](db['FaxInteraction'],{'as':_0xa044('0x173'),'foreignKey':_0xa044('0x179')});db[_0xa044('0x51')][_0xa044('0x11c')](db['CmContact'],{'onDelete':_0xa044('0x110'),'as':_0xa044('0x15e')});db[_0xa044('0x51')]['belongsTo'](db[_0xa044('0xe9')],{'as':_0xa044('0xe9'),'foreignKey':_0xa044('0x17b')});db[_0xa044('0x51')]['belongsTo'](db[_0xa044('0x4c')],{'as':_0xa044('0x16a'),'foreignKey':_0xa044('0x177')});db[_0xa044('0x52')][_0xa044('0x11d')](db['User'],{'as':'Agents','through':'UserFaxQueue'});db[_0xa044('0x52')][_0xa044('0x11d')](db[_0xa044('0xe2')],{'through':_0xa044('0x17c'),'as':_0xa044('0x153')});db['FaxQueueReport']['belongsTo'](db[_0xa044('0x4c')],{});db[_0xa044('0x54')][_0xa044('0x11c')](db[_0xa044('0x121')],{'as':_0xa044('0x165'),'foreignKey':_0xa044('0x166')});db['FaxQueueReport']['belongsTo'](db[_0xa044('0x77')],{'as':_0xa044('0x15e'),'foreignKey':_0xa044('0x16b')});db[_0xa044('0x54')][_0xa044('0x11c')](db['FaxInteraction'],{});db[_0xa044('0x54')][_0xa044('0x11c')](db[_0xa044('0x51')],{});db[_0xa044('0x54')][_0xa044('0x11c')](db[_0xa044('0x15')],{});db[_0xa044('0x54')][_0xa044('0x11c')](db[_0xa044('0x52')],{});db[_0xa044('0x56')][_0xa044('0x10d')](db[_0xa044('0x17d')],{'as':_0xa044('0x162'),'foreignKey':_0xa044('0x17e')});db[_0xa044('0x56')][_0xa044('0x10d')](db[_0xa044('0x81')],{'as':_0xa044('0x163'),'foreignKey':_0xa044('0x17e')});db['SmsAccount'][_0xa044('0x10d')](db[_0xa044('0x17f')],{'as':_0xa044('0x157'),'foreignKey':_0xa044('0x17e')});db[_0xa044('0x56')][_0xa044('0x10d')](db[_0xa044('0x5a')],{'as':_0xa044('0x164')});db[_0xa044('0x56')][_0xa044('0x10d')](db[_0xa044('0x58')],{'as':_0xa044('0x142')});db[_0xa044('0x56')][_0xa044('0x11c')](db['CmList'],{'as':_0xa044('0x165'),'foreignKey':_0xa044('0x166')});db['SmsAccount'][_0xa044('0x11c')](db[_0xa044('0x86')],{'as':'mandatoryDispositionPause','foreignKey':_0xa044('0x151')});db['SmsAccount'][_0xa044('0x11d')](db[_0xa044('0x15')],{'as':_0xa044('0x167'),'through':_0xa044('0x13b')});db[_0xa044('0x58')][_0xa044('0x11c')](db[_0xa044('0x15')],{'onDelete':_0xa044('0x174')});db['SmsApplication'][_0xa044('0x11c')](db[_0xa044('0x5d')],{'onDelete':_0xa044('0x174')});db['SmsApplication'][_0xa044('0x11c')](db[_0xa044('0x56')],{'onDelete':_0xa044('0x174')});db[_0xa044('0x58')][_0xa044('0x11c')](db['Interval'],{'onDelete':'restrict','foreignKey':_0xa044('0x14f')});db['SmsApplication'][_0xa044('0x11c')](db[_0xa044('0x16d')],{'onDelete':_0xa044('0x174'),'foreignKey':_0xa044('0x175')});db[_0xa044('0x5a')][_0xa044('0x10d')](db[_0xa044('0x17f')],{'as':'Messages','onDelete':_0xa044('0x110'),'foreignKey':'SmsInteractionId'});db[_0xa044('0x5a')][_0xa044('0x11c')](db[_0xa044('0x56')],{'as':_0xa044('0x16a'),'foreignKey':_0xa044('0x17e')});db[_0xa044('0x5a')][_0xa044('0x11c')](db['CmContact'],{'as':_0xa044('0x15e'),'foreignKey':_0xa044('0x16b')});db[_0xa044('0x5a')][_0xa044('0x11c')](db[_0xa044('0x15')],{'as':_0xa044('0x16c'),'foreignKey':'UserId'});db[_0xa044('0x5a')]['belongsToMany'](db[_0xa044('0x16d')],{'through':_0xa044('0x180'),'as':_0xa044('0x16f')});db[_0xa044('0x5a')][_0xa044('0x11d')](db['Tag'],{'through':'sms_interaction_has_tags','as':_0xa044('0x170')});db['SmsInteraction']['belongsToMany'](db[_0xa044('0x15')],{'as':_0xa044('0x171'),'through':_0xa044('0x12a'),'foreignKey':_0xa044('0x181')});db[_0xa044('0x17f')][_0xa044('0x11c')](db[_0xa044('0x15')],{'as':_0xa044('0x15')});db[_0xa044('0x17f')][_0xa044('0x11c')](db[_0xa044('0x77')],{'onDelete':_0xa044('0x110'),'as':_0xa044('0x15e')});db['SmsMessage'][_0xa044('0x11c')](db['SmsInteraction'],{'onDelete':'cascade','as':'Interaction','foreignKey':'SmsInteractionId'});db['SmsMessage'][_0xa044('0x11c')](db[_0xa044('0x56')],{'as':_0xa044('0x16a'),'foreignKey':_0xa044('0x17e')});db[_0xa044('0x5d')][_0xa044('0x11d')](db['User'],{'as':_0xa044('0x167'),'through':'UserSmsQueue','foreignKey':'SmsQueueId'});db[_0xa044('0x5d')][_0xa044('0x11d')](db[_0xa044('0xe2')],{'through':_0xa044('0x182'),'as':_0xa044('0x153')});db['OpenchannelAccount'][_0xa044('0x10d')](db[_0xa044('0x17d')],{'as':_0xa044('0x162'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0xa044('0x10d')](db[_0xa044('0x81')],{'as':_0xa044('0x163'),'foreignKey':_0xa044('0x183')});db[_0xa044('0x138')][_0xa044('0x10d')](db[_0xa044('0x62')],{'as':_0xa044('0x164'),'foreignKey':_0xa044('0x183')});db[_0xa044('0x138')][_0xa044('0x10d')](db[_0xa044('0x64')],{'as':'Messages','foreignKey':_0xa044('0x183')});db['OpenchannelAccount'][_0xa044('0x10d')](db['OpenchannelApplication'],{'as':'Applications','foreignKey':_0xa044('0x183')});db[_0xa044('0x138')][_0xa044('0x11c')](db[_0xa044('0x121')],{'as':_0xa044('0x165'),'foreignKey':_0xa044('0x166')});db['OpenchannelAccount'][_0xa044('0x11c')](db['Pause'],{'as':_0xa044('0x150'),'foreignKey':_0xa044('0x151')});db['OpenchannelAccount'][_0xa044('0x11d')](db['User'],{'as':_0xa044('0x167'),'through':_0xa044('0x184')});db[_0xa044('0x60')][_0xa044('0x11c')](db[_0xa044('0x15')],{'onDelete':_0xa044('0x174')});db[_0xa044('0x60')][_0xa044('0x11c')](db[_0xa044('0x12e')],{'onDelete':_0xa044('0x174'),'foreignKey':'OpenchannelQueueId'});db['OpenchannelApplication']['belongsTo'](db[_0xa044('0x138')],{'onDelete':_0xa044('0x174'),'foreignKey':_0xa044('0x183')});db[_0xa044('0x60')][_0xa044('0x11c')](db['Interval'],{'onDelete':_0xa044('0x174'),'foreignKey':_0xa044('0x14f')});db[_0xa044('0x60')][_0xa044('0x11c')](db[_0xa044('0x16d')],{'onDelete':'restrict','foreignKey':_0xa044('0x175')});db[_0xa044('0x62')][_0xa044('0x10d')](db[_0xa044('0x64')],{'as':'Messages','onDelete':_0xa044('0x110'),'foreignKey':_0xa044('0x185')});db[_0xa044('0x62')][_0xa044('0x11c')](db[_0xa044('0x138')],{'as':'Account','foreignKey':_0xa044('0x183')});db[_0xa044('0x62')][_0xa044('0x11c')](db[_0xa044('0x77')],{'as':_0xa044('0x15e'),'foreignKey':_0xa044('0x16b')});db[_0xa044('0x62')][_0xa044('0x11c')](db[_0xa044('0x15')],{'as':_0xa044('0x16c'),'foreignKey':_0xa044('0x10c')});db[_0xa044('0x62')][_0xa044('0x11d')](db['Tag'],{'through':_0xa044('0x186'),'as':'Tags'});db['OpenchannelInteraction'][_0xa044('0x11d')](db[_0xa044('0x16d')],{'through':_0xa044('0x186'),'as':_0xa044('0x170')});db[_0xa044('0x62')][_0xa044('0x11d')](db[_0xa044('0x15')],{'as':'Users','through':_0xa044('0x187'),'foreignKey':'OpenchannelInteractionId'});db[_0xa044('0x64')][_0xa044('0x11c')](db[_0xa044('0x15')],{'onDelete':_0xa044('0x110'),'as':'User'});db[_0xa044('0x64')][_0xa044('0x11c')](db[_0xa044('0x77')],{'onDelete':_0xa044('0x110'),'as':'Contact'});db['OpenchannelMessage'][_0xa044('0x11c')](db[_0xa044('0x62')],{'onDelete':'cascade','as':'Interaction','foreignKey':'OpenchannelInteractionId'});db[_0xa044('0x64')][_0xa044('0x11c')](db[_0xa044('0xe9')],{'as':_0xa044('0xe9'),'foreignKey':_0xa044('0x17b')});db['OpenchannelMessage']['belongsTo'](db['OpenchannelAccount'],{'as':_0xa044('0x16a'),'foreignKey':'OpenchannelAccountId'});db[_0xa044('0x12e')]['belongsToMany'](db[_0xa044('0x15')],{'as':_0xa044('0x167'),'through':_0xa044('0x39'),'foreignKey':_0xa044('0x188')});db['OpenchannelQueue']['belongsToMany'](db['Team'],{'through':_0xa044('0x189'),'as':'Teams'});db[_0xa044('0x66')]['hasMany'](db['Disposition'],{'as':_0xa044('0x162'),'foreignKey':_0xa044('0x18a')});db[_0xa044('0x66')][_0xa044('0x10d')](db[_0xa044('0x81')],{'as':_0xa044('0x163'),'foreignKey':_0xa044('0x18a')});db[_0xa044('0x66')][_0xa044('0x10d')](db[_0xa044('0x73')],{'as':_0xa044('0x18b')});db[_0xa044('0x66')][_0xa044('0x10d')](db[_0xa044('0x6b')],{'as':'Interactions'});db['ChatWebsite'][_0xa044('0x10d')](db[_0xa044('0x69')],{'as':_0xa044('0x142')});db[_0xa044('0x66')][_0xa044('0x10d')](db[_0xa044('0x6c')],{'as':_0xa044('0x157')});db[_0xa044('0x66')]['belongsTo'](db[_0xa044('0x121')],{'as':_0xa044('0x165'),'foreignKey':'ListId'});db['ChatWebsite'][_0xa044('0x11c')](db[_0xa044('0x84')],{'as':_0xa044('0x84'),'foreignKey':_0xa044('0x14f')});db['ChatWebsite'][_0xa044('0x11c')](db[_0xa044('0x86')],{'as':_0xa044('0x150'),'foreignKey':_0xa044('0x151')});db[_0xa044('0x66')][_0xa044('0x11d')](db[_0xa044('0x15')],{'as':_0xa044('0x167'),'through':'user_has_chat_websites'});db[_0xa044('0x67')][_0xa044('0x11c')](db[_0xa044('0x138')],{});db[_0xa044('0x67')][_0xa044('0x11c')](db[_0xa044('0x121')],{'as':'List','foreignKey':'ListId'});db[_0xa044('0x67')][_0xa044('0x11c')](db[_0xa044('0x77')],{'as':'Contact','foreignKey':'ContactId'});db[_0xa044('0x67')][_0xa044('0x11c')](db[_0xa044('0x62')],{});db['OpenchannelQueueReport'][_0xa044('0x11c')](db['OpenchannelMessage'],{});db[_0xa044('0x67')][_0xa044('0x11c')](db[_0xa044('0x15')],{});db[_0xa044('0x67')][_0xa044('0x11c')](db[_0xa044('0x12e')],{});db[_0xa044('0x69')][_0xa044('0x11c')](db[_0xa044('0x15')],{'as':_0xa044('0x18c'),'foreignKey':_0xa044('0x10c'),'onDelete':_0xa044('0x174')});db[_0xa044('0x69')][_0xa044('0x11c')](db[_0xa044('0x70')],{'as':_0xa044('0x18d'),'foreignKey':_0xa044('0x18e'),'onDelete':_0xa044('0x174')});db[_0xa044('0x69')]['belongsTo'](db[_0xa044('0x66')],{'as':_0xa044('0x18f'),'foreignKey':'ChatWebsiteId','onDelete':_0xa044('0x174')});db[_0xa044('0x69')][_0xa044('0x11c')](db[_0xa044('0x16d')],{'onDelete':_0xa044('0x174'),'foreignKey':_0xa044('0x175')});db[_0xa044('0x6b')][_0xa044('0x10d')](db[_0xa044('0x6c')],{'as':'Messages','onDelete':_0xa044('0x110'),'foreignKey':_0xa044('0x190')});db[_0xa044('0x6b')]['belongsTo'](db[_0xa044('0x66')],{'as':'Account','foreignKey':_0xa044('0x18a')});db[_0xa044('0x6b')][_0xa044('0x11c')](db[_0xa044('0x77')],{'as':_0xa044('0x15e'),'foreignKey':_0xa044('0x16b')});db['ChatInteraction'][_0xa044('0x11c')](db['User'],{'as':_0xa044('0x16c'),'foreignKey':_0xa044('0x10c')});db[_0xa044('0x6b')][_0xa044('0x11d')](db[_0xa044('0x16d')],{'through':_0xa044('0x191'),'as':_0xa044('0x16f')});db['ChatInteraction'][_0xa044('0x11d')](db[_0xa044('0x16d')],{'through':'chat_interaction_has_tags','as':_0xa044('0x170')});db[_0xa044('0x6b')]['belongsToMany'](db[_0xa044('0x15')],{'as':'Users','through':'user_has_chat_interactions','foreignKey':_0xa044('0x190')});db[_0xa044('0x6c')]['belongsTo'](db[_0xa044('0x15')],{'onDelete':_0xa044('0x110'),'as':'User'});db[_0xa044('0x6c')][_0xa044('0x11c')](db['CmContact'],{'onDelete':_0xa044('0x110'),'as':_0xa044('0x15e'),'foreignKey':'ContactId'});db[_0xa044('0x6c')][_0xa044('0x11c')](db[_0xa044('0x6b')],{'onDelete':_0xa044('0x110'),'as':_0xa044('0x173'),'foreignKey':_0xa044('0x190')});db[_0xa044('0x6c')][_0xa044('0x11c')](db[_0xa044('0xe9')],{'as':_0xa044('0xe9'),'foreignKey':_0xa044('0x17b')});db['ChatMessage'][_0xa044('0x11c')](db[_0xa044('0x66')],{'as':_0xa044('0x16a'),'foreignKey':_0xa044('0x18a')});db[_0xa044('0x6e')][_0xa044('0x11c')](db[_0xa044('0x77')],{'onDelete':'cascade','as':_0xa044('0x15e'),'foreignKey':'ContactId'});db[_0xa044('0x6e')][_0xa044('0x11c')](db['ChatWebsite'],{'as':_0xa044('0x16a'),'foreignKey':'ChatWebsiteId'});db[_0xa044('0x70')][_0xa044('0x11d')](db[_0xa044('0x15')],{'as':_0xa044('0x167'),'through':_0xa044('0x32'),'hooks':!![]});db[_0xa044('0x70')][_0xa044('0x11d')](db[_0xa044('0xe2')],{'through':'team_has_chat_queues','as':_0xa044('0x153')});db[_0xa044('0x72')]['hasMany'](db[_0xa044('0x192')],{'as':_0xa044('0x157'),'foreignKey':_0xa044('0x193'),'onDelete':_0xa044('0x110')});db[_0xa044('0x72')][_0xa044('0x11d')](db[_0xa044('0x15')],{'as':_0xa044('0x146'),'through':_0xa044('0x11f')});db[_0xa044('0x73')]['belongsTo'](db['ChatWebsite'],{'as':_0xa044('0x18f'),'foreignKey':_0xa044('0x18a')});db[_0xa044('0x75')][_0xa044('0x10d')](db[_0xa044('0x77')],{'as':_0xa044('0x120'),'foreignKey':_0xa044('0x194')});db[_0xa044('0x77')][_0xa044('0x10d')](db[_0xa044('0x148')],{'as':_0xa044('0x149'),'foreignKey':'ContactId'});db[_0xa044('0x77')][_0xa044('0x10d')](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':'ContactId'});db[_0xa044('0x77')][_0xa044('0x10d')](db[_0xa044('0x14a')],{'as':_0xa044('0x195'),'foreignKey':_0xa044('0x16b')});db[_0xa044('0x77')][_0xa044('0x10d')](db['ReportAgentPreview'],{'as':_0xa044('0x7c'),'foreignKey':_0xa044('0x16b')});db[_0xa044('0x77')][_0xa044('0x10d')](db[_0xa044('0xd3')],{'as':_0xa044('0x14c'),'foreignKey':'ContactId'});db[_0xa044('0x77')]['hasMany'](db[_0xa044('0x62')],{'as':'OpenchannelInteractions','foreignKey':'ContactId','onDelete':_0xa044('0x174')});db[_0xa044('0x77')]['hasMany'](db['ChatInteraction'],{'as':_0xa044('0x114'),'foreignKey':_0xa044('0x16b'),'onDelete':'restrict'});db[_0xa044('0x77')][_0xa044('0x10d')](db[_0xa044('0x5a')],{'as':_0xa044('0x129'),'foreignKey':_0xa044('0x16b'),'onDelete':_0xa044('0x174')});db['CmContact']['hasMany'](db[_0xa044('0x115')],{'as':'FaxInteractions','foreignKey':_0xa044('0x16b'),'onDelete':_0xa044('0x174')});db[_0xa044('0x77')]['hasMany'](db[_0xa044('0x125')],{'as':_0xa044('0x117'),'foreignKey':_0xa044('0x16b'),'onDelete':'restrict'});db[_0xa044('0x77')][_0xa044('0x11c')](db[_0xa044('0x75')],{'as':_0xa044('0x196'),'foreignKey':_0xa044('0x194')});db[_0xa044('0x77')][_0xa044('0x11c')](db[_0xa044('0x121')],{'as':_0xa044('0x165'),'foreignKey':_0xa044('0x166'),'onDelete':_0xa044('0x110')});db[_0xa044('0x77')][_0xa044('0x11d')](db['User'],{'as':'Users','through':_0xa044('0x197')});db[_0xa044('0x77')]['belongsToMany'](db[_0xa044('0x16d')],{'as':'Tags','through':_0xa044('0x198')});db[_0xa044('0x77')][_0xa044('0x11d')](db[_0xa044('0x16d')],{'through':_0xa044('0x198'),'as':_0xa044('0x170')});db[_0xa044('0x148')]['belongsTo'](db[_0xa044('0x77')],{'as':_0xa044('0x15e'),'foreignKey':'ContactId','onDelete':_0xa044('0x110')});db['CmHopper'][_0xa044('0x11c')](db['CmList'],{'as':_0xa044('0x165'),'foreignKey':_0xa044('0x166'),'onDelete':_0xa044('0x110')});db[_0xa044('0x148')]['belongsTo'](db['User'],{'as':_0xa044('0x18c'),'foreignKey':_0xa044('0x10c')});db['CmHopper'][_0xa044('0x11c')](db[_0xa044('0x12b')],{'as':'Queue','foreignKey':_0xa044('0x147'),'onDelete':_0xa044('0x110')});db['CmHopper'][_0xa044('0x11c')](db['Campaign'],{'as':_0xa044('0xe6'),'foreignKey':'CampaignId','onDelete':_0xa044('0x110')});db['CmHopper']['belongsTo'](db[_0xa044('0x15')],{'as':'Owner','foreignKey':_0xa044('0x199')});db[_0xa044('0x79')][_0xa044('0x11c')](db['CmContact'],{'as':_0xa044('0x15e'),'foreignKey':_0xa044('0x16b'),'onDelete':_0xa044('0x110')});db[_0xa044('0x79')][_0xa044('0x11c')](db['CmList'],{'as':'List','foreignKey':_0xa044('0x166'),'onDelete':_0xa044('0x110')});db[_0xa044('0x79')][_0xa044('0x11c')](db[_0xa044('0x12b')],{'as':_0xa044('0x18d'),'foreignKey':_0xa044('0x147'),'onDelete':'cascade'});db['CmHopperBlack'][_0xa044('0x11c')](db[_0xa044('0xe6')],{'as':_0xa044('0xe6'),'foreignKey':'CampaignId','onDelete':'cascade'});db['Automation'][_0xa044('0x10d')](db[_0xa044('0x19a')],{'as':{'plural':'All','singular':_0xa044('0x19b')},'foreignKey':_0xa044('0x19c'),'onDelete':_0xa044('0x110'),'hooks':!![]});db[_0xa044('0x19d')][_0xa044('0x10d')](db[_0xa044('0x19a')],{'as':{'plural':'Any','singular':_0xa044('0x19e')},'foreignKey':_0xa044('0x19f'),'onDelete':'cascade','hooks':!![]});db['Automation'][_0xa044('0x10d')](db[_0xa044('0x7f')],{'as':_0xa044('0x1a0'),'foreignKey':_0xa044('0x1a1'),'onDelete':_0xa044('0x110'),'hooks':!![]});db['Interval'][_0xa044('0x10d')](db['Interval'],{'as':_0xa044('0x1a2'),'foreignKey':_0xa044('0x14f'),'onDelete':_0xa044('0x110'),'hooks':!![],'required':![]});db[_0xa044('0x84')][_0xa044('0x10d')](db[_0xa044('0x10e')],{'as':_0xa044('0x10f'),'foreignKey':_0xa044('0x14f'),'onDelete':_0xa044('0x174')});db['Interval'][_0xa044('0x10d')](db['MailApplication'],{'as':_0xa044('0x1a3'),'foreignKey':_0xa044('0x14f')});db[_0xa044('0x84')][_0xa044('0x10d')](db[_0xa044('0x69')],{'as':_0xa044('0x1a4'),'foreignKey':_0xa044('0x14f')});db[_0xa044('0x84')]['hasMany'](db['FaxApplication'],{'as':_0xa044('0x1a5'),'foreignKey':_0xa044('0x14f')});db[_0xa044('0x84')][_0xa044('0x10d')](db['SmsApplication'],{'as':'SmsApplications','foreignKey':'IntervalId'});db[_0xa044('0x8a')]['belongsTo'](db[_0xa044('0x3f')],{});db[_0xa044('0x8a')][_0xa044('0x11c')](db[_0xa044('0x1a6')],{'foreignKey':_0xa044('0x1a7')});db[_0xa044('0x8a')][_0xa044('0x11c')](db[_0xa044('0x94')],{'foreignKey':'CustomReportId'});db[_0xa044('0x143')]['belongsToMany'](db[_0xa044('0x1b')],{'as':_0xa044('0x1a8'),'through':_0xa044('0x145'),'onDelete':'restrict'});db[_0xa044('0x16d')][_0xa044('0x11d')](db['CmContact'],{'through':'cm_contact_has_tags'});db[_0xa044('0x16d')][_0xa044('0x11d')](db[_0xa044('0x6b')],{'through':_0xa044('0x191')});db[_0xa044('0x16d')]['belongsToMany'](db[_0xa044('0x125')],{'through':_0xa044('0x16e')});db[_0xa044('0x16d')][_0xa044('0x11d')](db[_0xa044('0x5a')],{'through':_0xa044('0x180')});db['Tag'][_0xa044('0x11d')](db[_0xa044('0x115')],{'through':_0xa044('0x17a')});db[_0xa044('0x16d')]['belongsToMany'](db[_0xa044('0x62')],{'through':'openchannel_interaction_has_tags'});db['Tag'][_0xa044('0x11d')](db[_0xa044('0x102')],{'through':'whatsapp_interaction_has_tags'});db[_0xa044('0x8d')][_0xa044('0x10d')](db['Condition'],{'as':{'plural':_0xa044('0x1a9'),'singular':_0xa044('0x1aa')},'foreignKey':_0xa044('0x1ab'),'onDelete':_0xa044('0x110'),'hooks':!![]});db[_0xa044('0x8d')][_0xa044('0x10d')](db[_0xa044('0x19a')],{'as':{'plural':_0xa044('0x1ac'),'singular':_0xa044('0x1ad')},'foreignKey':_0xa044('0x1ae'),'onDelete':'cascade','hooks':!![]});db[_0xa044('0x8d')]['hasMany'](db[_0xa044('0x7f')],{'as':'Actions','foreignKey':_0xa044('0x1af'),'onDelete':_0xa044('0x110'),'hooks':!![]});db[_0xa044('0x94')]['hasMany'](db[_0xa044('0x99')],{'as':'Fields','onDelete':'cascade','foreignKey':'CustomReportId','hooks':!![]});db['AnalyticDefaultReport'][_0xa044('0x10d')](db[_0xa044('0x99')],{'as':_0xa044('0x1b0'),'onDelete':_0xa044('0x110'),'foreignKey':_0xa044('0x1a7')});db[_0xa044('0x97')][_0xa044('0x10d')](db['AnalyticFieldReport'],{'as':'Fields','onDelete':_0xa044('0x110'),'foreignKey':_0xa044('0x1b1')});db['AnalyticFieldReport'][_0xa044('0x11c')](db[_0xa044('0x97')],{'foreignKey':'MetricId'});db['SalesforceAccount']['hasMany'](db['SalesforceConfiguration'],{'as':_0xa044('0x1b2'),'onDelete':'cascade','foreignKey':_0xa044('0x1b3')});db[_0xa044('0x1b4')][_0xa044('0x10d')](db['SalesforceField'],{'as':_0xa044('0x1b5'),'onDelete':'cascade','foreignKey':_0xa044('0x1b6')});db[_0xa044('0x1b4')][_0xa044('0x10d')](db[_0xa044('0x9e')],{'as':_0xa044('0x1b7'),'onDelete':'cascade','foreignKey':_0xa044('0x1b8')});db['SalesforceConfiguration'][_0xa044('0x10d')](db['SalesforceField'],{'as':_0xa044('0x1b0'),'onDelete':_0xa044('0x110'),'foreignKey':_0xa044('0x1b9')});db['SalesforceConfiguration']['belongsTo'](db['SalesforceAccount'],{'as':_0xa044('0x16a'),'foreignKey':_0xa044('0x1b3')});db[_0xa044('0x9e')][_0xa044('0x10d')](db['SalesforceField'],{'as':'Subject','foreignKey':_0xa044('0x1b6')});db[_0xa044('0x9e')][_0xa044('0x10d')](db[_0xa044('0x9e')],{'as':'Description','foreignKey':_0xa044('0x1b8')});db[_0xa044('0x9e')][_0xa044('0x10d')](db['SalesforceField'],{'as':_0xa044('0x1ba'),'foreignKey':_0xa044('0x1b9')});db['SalesforceField'][_0xa044('0x11c')](db[_0xa044('0x8f')],{'as':_0xa044('0x8f'),'foreignKey':_0xa044('0x1bb')});db[_0xa044('0xa0')][_0xa044('0x10d')](db[_0xa044('0xa2')],{'as':_0xa044('0x1b2'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0xa044('0xa2')][_0xa044('0x10d')](db[_0xa044('0xa4')],{'as':_0xa044('0x1b5'),'onDelete':_0xa044('0x110'),'foreignKey':_0xa044('0x1b6')});db[_0xa044('0xa2')][_0xa044('0x10d')](db[_0xa044('0xa4')],{'as':_0xa044('0x1b7'),'onDelete':_0xa044('0x110'),'foreignKey':_0xa044('0x1b8')});db[_0xa044('0xa2')][_0xa044('0x10d')](db[_0xa044('0xa4')],{'as':_0xa044('0x1b0'),'onDelete':'cascade','foreignKey':_0xa044('0x1b9')});db['SugarcrmConfiguration'][_0xa044('0x11c')](db['SugarcrmAccount'],{'as':_0xa044('0x16a'),'foreignKey':_0xa044('0x1b3')});db[_0xa044('0xa4')]['hasMany'](db[_0xa044('0xa4')],{'as':_0xa044('0x1bc'),'foreignKey':_0xa044('0x1b6')});db[_0xa044('0xa4')]['hasMany'](db['SugarcrmField'],{'as':_0xa044('0x1bd'),'foreignKey':_0xa044('0x1b8')});db[_0xa044('0xa4')][_0xa044('0x10d')](db[_0xa044('0xa4')],{'as':_0xa044('0x1ba'),'foreignKey':'FieldId'});db[_0xa044('0xa4')]['belongsTo'](db[_0xa044('0x8f')],{'as':_0xa044('0x8f'),'foreignKey':_0xa044('0x1bb')});db[_0xa044('0xa6')]['hasMany'](db['DeskConfiguration'],{'as':_0xa044('0x1b2'),'onDelete':'cascade','foreignKey':_0xa044('0x1b3')});db[_0xa044('0xa8')][_0xa044('0x10d')](db[_0xa044('0xaa')],{'as':_0xa044('0x1b5'),'onDelete':_0xa044('0x110'),'foreignKey':_0xa044('0x1b6')});db['DeskConfiguration'][_0xa044('0x10d')](db[_0xa044('0xaa')],{'as':_0xa044('0x1b7'),'onDelete':_0xa044('0x110'),'foreignKey':_0xa044('0x1b8')});db['DeskConfiguration'][_0xa044('0x10d')](db[_0xa044('0xaa')],{'as':'Fields','onDelete':_0xa044('0x110'),'foreignKey':_0xa044('0x1b9')});db[_0xa044('0xa8')][_0xa044('0x11c')](db['DeskAccount'],{'as':_0xa044('0x16a'),'foreignKey':_0xa044('0x1b3')});db[_0xa044('0xa8')][_0xa044('0x11d')](db[_0xa044('0x16d')],{'through':'int_desk_configuration_has_tags'});db[_0xa044('0xaa')][_0xa044('0x10d')](db[_0xa044('0xaa')],{'as':_0xa044('0x1bc'),'foreignKey':_0xa044('0x1b6')});db['DeskField'][_0xa044('0x10d')](db[_0xa044('0xaa')],{'as':_0xa044('0x1bd'),'foreignKey':_0xa044('0x1b8')});db[_0xa044('0xaa')][_0xa044('0x10d')](db['DeskField'],{'as':_0xa044('0x1ba'),'foreignKey':_0xa044('0x1b9')});db[_0xa044('0xaa')][_0xa044('0x11c')](db[_0xa044('0x8f')],{'as':'Variable','foreignKey':_0xa044('0x1bb')});db['ZohoAccount'][_0xa044('0x10d')](db['ZohoConfiguration'],{'as':'Configurations','onDelete':'cascade','foreignKey':_0xa044('0x1b3')});db['ZohoConfiguration']['hasMany'](db[_0xa044('0xb0')],{'as':_0xa044('0x1b5'),'onDelete':_0xa044('0x110'),'foreignKey':_0xa044('0x1b6')});db['ZohoConfiguration'][_0xa044('0x10d')](db[_0xa044('0xb0')],{'as':'Descriptions','onDelete':_0xa044('0x110'),'foreignKey':_0xa044('0x1b8')});db[_0xa044('0xae')]['hasMany'](db[_0xa044('0xb0')],{'as':_0xa044('0x1b0'),'onDelete':_0xa044('0x110'),'foreignKey':_0xa044('0x1b9')});db[_0xa044('0xae')][_0xa044('0x11c')](db[_0xa044('0xac')],{'as':_0xa044('0x16a'),'foreignKey':_0xa044('0x1b3')});db[_0xa044('0xb0')][_0xa044('0x10d')](db[_0xa044('0xb0')],{'as':'Subject','foreignKey':_0xa044('0x1b6')});db['ZohoField'][_0xa044('0x10d')](db[_0xa044('0xb0')],{'as':_0xa044('0x1bd'),'foreignKey':_0xa044('0x1b8')});db[_0xa044('0xb0')][_0xa044('0x10d')](db[_0xa044('0xb0')],{'as':_0xa044('0x1ba'),'foreignKey':_0xa044('0x1b9')});db['ZohoField']['belongsTo'](db[_0xa044('0x8f')],{'as':_0xa044('0x8f'),'foreignKey':_0xa044('0x1bb')});db[_0xa044('0xb2')]['hasMany'](db[_0xa044('0x1be')],{'as':_0xa044('0x1b2'),'onDelete':'cascade','foreignKey':'AccountId'});db['ZendeskConfiguration']['hasMany'](db[_0xa044('0xb5')],{'as':_0xa044('0x1b5'),'foreignKey':_0xa044('0x1b6')});db['ZendeskConfiguration'][_0xa044('0x10d')](db['ZendeskField'],{'as':_0xa044('0x1b7'),'foreignKey':_0xa044('0x1b8')});db[_0xa044('0x1be')][_0xa044('0x10d')](db['ZendeskField'],{'as':_0xa044('0x1b0'),'foreignKey':_0xa044('0x1b9')});db[_0xa044('0x1be')][_0xa044('0x11c')](db[_0xa044('0xb2')],{'as':_0xa044('0x16a'),'foreignKey':_0xa044('0x1b3')});db[_0xa044('0x1be')][_0xa044('0x11d')](db[_0xa044('0x16d')],{'through':'int_zendesk_configuration_has_tags'});db[_0xa044('0xb5')][_0xa044('0x10d')](db[_0xa044('0xb5')],{'as':_0xa044('0x1bc'),'foreignKey':_0xa044('0x1b6')});db[_0xa044('0xb5')]['hasMany'](db[_0xa044('0xb5')],{'as':_0xa044('0x1bd'),'foreignKey':_0xa044('0x1b8')});db[_0xa044('0xb5')]['hasMany'](db['ZendeskField'],{'as':_0xa044('0x1ba'),'foreignKey':_0xa044('0x1b9')});db[_0xa044('0xb5')][_0xa044('0x11c')](db[_0xa044('0x8f')],{'as':_0xa044('0x8f'),'foreignKey':_0xa044('0x1bb')});db[_0xa044('0xb7')]['hasMany'](db[_0xa044('0xb9')],{'as':_0xa044('0x1b2'),'onDelete':'cascade','foreignKey':_0xa044('0x1b3')});db[_0xa044('0xb9')][_0xa044('0x10d')](db[_0xa044('0x1bf')],{'as':_0xa044('0x1b5'),'onDelete':_0xa044('0x110'),'foreignKey':'SubjectId'});db[_0xa044('0xb9')]['hasMany'](db['FreshdeskField'],{'as':_0xa044('0x1b7'),'onDelete':_0xa044('0x110'),'foreignKey':_0xa044('0x1b8')});db[_0xa044('0xb9')][_0xa044('0x10d')](db[_0xa044('0x1bf')],{'as':'Fields','onDelete':_0xa044('0x110'),'foreignKey':_0xa044('0x1b9')});db[_0xa044('0xb9')][_0xa044('0x11c')](db[_0xa044('0xb7')],{'as':_0xa044('0x16a'),'foreignKey':'AccountId'});db['FreshdeskConfiguration'][_0xa044('0x11d')](db[_0xa044('0x16d')],{'through':'int_freshdesk_configuration_has_tags'});db[_0xa044('0x1bf')][_0xa044('0x10d')](db[_0xa044('0x1bf')],{'as':_0xa044('0x1bc'),'foreignKey':_0xa044('0x1b6')});db[_0xa044('0x1bf')][_0xa044('0x10d')](db['FreshdeskField'],{'as':_0xa044('0x1bd'),'foreignKey':_0xa044('0x1b8')});db[_0xa044('0x1bf')][_0xa044('0x10d')](db[_0xa044('0x1bf')],{'as':_0xa044('0x1ba'),'foreignKey':_0xa044('0x1b9')});db[_0xa044('0x1bf')][_0xa044('0x11c')](db['Variable'],{'as':'Variable','foreignKey':'VariableId'});db[_0xa044('0xba')][_0xa044('0x10d')](db['VtigerConfiguration'],{'as':'Configurations','onDelete':_0xa044('0x110'),'foreignKey':_0xa044('0x1b3')});db[_0xa044('0xbc')][_0xa044('0x10d')](db['VtigerField'],{'as':_0xa044('0x1b5'),'foreignKey':_0xa044('0x1b6')});db[_0xa044('0xbc')][_0xa044('0x10d')](db[_0xa044('0xbe')],{'as':'Descriptions','foreignKey':_0xa044('0x1b8')});db[_0xa044('0xbc')][_0xa044('0x10d')](db[_0xa044('0xbe')],{'as':_0xa044('0x1b0'),'foreignKey':'FieldId'});db[_0xa044('0xbc')][_0xa044('0x11c')](db[_0xa044('0xba')],{'as':_0xa044('0x16a'),'foreignKey':_0xa044('0x1b3')});db['VtigerField'][_0xa044('0x10d')](db[_0xa044('0xbe')],{'as':_0xa044('0x1bc'),'foreignKey':_0xa044('0x1b6')});db[_0xa044('0xbe')][_0xa044('0x10d')](db['VtigerField'],{'as':_0xa044('0x1bd'),'foreignKey':_0xa044('0x1b8')});db[_0xa044('0xbe')]['hasMany'](db[_0xa044('0xbe')],{'as':_0xa044('0x1ba'),'foreignKey':_0xa044('0x1b9')});db[_0xa044('0xbe')]['belongsTo'](db['Variable'],{'as':_0xa044('0x8f'),'foreignKey':_0xa044('0x1bb')});db[_0xa044('0xc0')]['hasMany'](db[_0xa044('0xc2')],{'as':_0xa044('0x1b2'),'onDelete':_0xa044('0x110'),'foreignKey':_0xa044('0x1b3')});db['ServicenowConfiguration']['hasMany'](db[_0xa044('0xc4')],{'as':'Subjects','foreignKey':'SubjectId'});db[_0xa044('0xc2')]['hasMany'](db[_0xa044('0xc4')],{'as':_0xa044('0x1b7'),'foreignKey':'DescriptionId'});db[_0xa044('0xc2')][_0xa044('0x10d')](db[_0xa044('0xc4')],{'as':'Fields','foreignKey':_0xa044('0x1b9')});db[_0xa044('0xc2')]['belongsTo'](db['ServicenowAccount'],{'as':_0xa044('0x16a'),'foreignKey':_0xa044('0x1b3')});db[_0xa044('0xc4')][_0xa044('0x10d')](db[_0xa044('0xc4')],{'as':'Subject','foreignKey':'SubjectId'});db['ServicenowField'][_0xa044('0x10d')](db[_0xa044('0xc4')],{'as':_0xa044('0x1bd'),'foreignKey':_0xa044('0x1b8')});db['ServicenowField'][_0xa044('0x10d')](db[_0xa044('0xc4')],{'as':_0xa044('0x1ba'),'foreignKey':'FieldId'});db[_0xa044('0xc4')]['belongsTo'](db['Variable'],{'as':_0xa044('0x8f'),'foreignKey':_0xa044('0x1bb')});db['Dynamics365Account'][_0xa044('0x10d')](db[_0xa044('0xc7')],{'as':_0xa044('0x1b2'),'onDelete':_0xa044('0x110'),'foreignKey':_0xa044('0x1b3')});db[_0xa044('0xc7')]['hasMany'](db[_0xa044('0xc9')],{'as':'Subjects','onDelete':_0xa044('0x110'),'foreignKey':_0xa044('0x1b6')});db[_0xa044('0xc7')][_0xa044('0x10d')](db[_0xa044('0xc9')],{'as':_0xa044('0x1b7'),'onDelete':_0xa044('0x110'),'foreignKey':_0xa044('0x1b8')});db[_0xa044('0xc7')][_0xa044('0x10d')](db['Dynamics365Field'],{'as':_0xa044('0x1b0'),'onDelete':_0xa044('0x110'),'foreignKey':_0xa044('0x1b9')});db[_0xa044('0xc7')]['belongsTo'](db[_0xa044('0xc5')],{'as':_0xa044('0x16a'),'foreignKey':'AccountId'});db[_0xa044('0xc9')]['hasMany'](db[_0xa044('0xc9')],{'as':_0xa044('0x1bc'),'foreignKey':_0xa044('0x1b6')});db['Dynamics365Field'][_0xa044('0x10d')](db[_0xa044('0xc9')],{'as':_0xa044('0x1bd'),'foreignKey':_0xa044('0x1b8')});db[_0xa044('0xc9')][_0xa044('0x10d')](db['Dynamics365Field'],{'as':_0xa044('0x1ba'),'foreignKey':_0xa044('0x1b9')});db[_0xa044('0xc9')][_0xa044('0x11c')](db[_0xa044('0x8f')],{'as':_0xa044('0x8f'),'foreignKey':_0xa044('0x1bb')});db[_0xa044('0x1c0')][_0xa044('0x10d')](db[_0xa044('0x1c1')],{'as':_0xa044('0x1b2'),'onDelete':_0xa044('0x110'),'foreignKey':_0xa044('0x1b3')});db[_0xa044('0x1c1')][_0xa044('0x10d')](db[_0xa044('0x1c2')],{'as':_0xa044('0x1b5'),'foreignKey':'SubjectId'});db['FreshsalesConfiguration'][_0xa044('0x10d')](db[_0xa044('0x1c2')],{'as':_0xa044('0x1b7'),'foreignKey':_0xa044('0x1b8')});db[_0xa044('0x1c1')][_0xa044('0x10d')](db[_0xa044('0x1c2')],{'as':_0xa044('0x1b0'),'foreignKey':_0xa044('0x1b9')});db['FreshsalesConfiguration'][_0xa044('0x11c')](db[_0xa044('0x1c0')],{'as':'Account','foreignKey':_0xa044('0x1b3')});db[_0xa044('0x1c2')][_0xa044('0x10d')](db[_0xa044('0x1c2')],{'as':_0xa044('0x1bc'),'foreignKey':_0xa044('0x1b6')});db['FreshsalesField'][_0xa044('0x10d')](db[_0xa044('0x1c2')],{'as':'Description','foreignKey':_0xa044('0x1b8')});db[_0xa044('0x1c2')][_0xa044('0x10d')](db[_0xa044('0x1c2')],{'as':_0xa044('0x1ba'),'foreignKey':_0xa044('0x1b9')});db['FreshsalesField']['belongsTo'](db[_0xa044('0x8f')],{'as':'Variable','foreignKey':_0xa044('0x1bb')});db['ChatQueueReport'][_0xa044('0x11c')](db[_0xa044('0x66')],{});db[_0xa044('0xcc')]['belongsTo'](db['CmList'],{'as':_0xa044('0x165'),'foreignKey':'ListId'});db[_0xa044('0xcc')][_0xa044('0x11c')](db[_0xa044('0x77')],{'as':_0xa044('0x15e'),'foreignKey':_0xa044('0x16b')});db[_0xa044('0xcc')]['belongsTo'](db[_0xa044('0x6b')],{});db[_0xa044('0xcc')][_0xa044('0x11c')](db[_0xa044('0x6c')],{});db[_0xa044('0xcc')]['belongsTo'](db[_0xa044('0x15')],{});db[_0xa044('0xcc')][_0xa044('0x11c')](db[_0xa044('0x70')],{});db[_0xa044('0x192')][_0xa044('0x11c')](db[_0xa044('0x15')],{'onDelete':_0xa044('0x110'),'foreignKey':_0xa044('0x1c3')});db[_0xa044('0x192')][_0xa044('0x11c')](db[_0xa044('0x15')],{'onDelete':'cascade','foreignKey':_0xa044('0x1c4')});db[_0xa044('0xd3')][_0xa044('0x10d')](db['JscriptyQuestionReport'],{'foreignKey':_0xa044('0x1c5'),'onDelete':_0xa044('0x110')});db[_0xa044('0xd3')][_0xa044('0x10d')](db['JscriptyAnswerReport'],{'foreignKey':_0xa044('0x1c5'),'onDelete':_0xa044('0x110')});db[_0xa044('0xd5')][_0xa044('0x11c')](db['SmsAccount'],{});db[_0xa044('0xd5')][_0xa044('0x11c')](db[_0xa044('0x121')],{'as':_0xa044('0x165'),'foreignKey':'ListId'});db[_0xa044('0xd5')][_0xa044('0x11c')](db[_0xa044('0x77')],{'as':_0xa044('0x15e'),'foreignKey':'ContactId'});db['SmsQueueReport'][_0xa044('0x11c')](db[_0xa044('0x5a')],{});db[_0xa044('0xd5')][_0xa044('0x11c')](db[_0xa044('0x17f')],{});db[_0xa044('0xd5')][_0xa044('0x11c')](db[_0xa044('0x15')],{});db[_0xa044('0xd5')]['belongsTo'](db[_0xa044('0x5d')],{});db[_0xa044('0xdb')]['hasMany'](db[_0xa044('0xd3')],{'foreignKey':_0xa044('0x1c6')});db[_0xa044('0xdb')][_0xa044('0x10d')](db[_0xa044('0xd1')],{'foreignKey':_0xa044('0x1c6')});db[_0xa044('0xdb')][_0xa044('0x10d')](db['JscriptyAnswerReport'],{'foreignKey':'ProjectId'});db[_0xa044('0x13d')][_0xa044('0x11d')](db[_0xa044('0x15')],{'as':'Users','through':_0xa044('0x13f')});db[_0xa044('0xe2')][_0xa044('0x11d')](db['User'],{'as':'Agents','through':_0xa044('0x124')});db[_0xa044('0xe2')][_0xa044('0x11d')](db[_0xa044('0x12b')],{'through':'team_has_voice_queues','as':'VoiceQueues'});db[_0xa044('0xe2')][_0xa044('0x11d')](db[_0xa044('0x41')],{'through':'team_has_mail_queues','as':'MailQueues'});db[_0xa044('0xe2')][_0xa044('0x11d')](db[_0xa044('0x70')],{'through':'team_has_chat_queues','as':_0xa044('0x1c7')});db['Team']['belongsToMany'](db[_0xa044('0x52')],{'through':_0xa044('0x17c'),'as':_0xa044('0x12d')});db['Team'][_0xa044('0x11d')](db[_0xa044('0x5d')],{'through':_0xa044('0x182'),'as':_0xa044('0x1c8')});db['Team']['belongsToMany'](db[_0xa044('0x12e')],{'through':_0xa044('0x189'),'as':_0xa044('0x12f')});db[_0xa044('0xe2')][_0xa044('0x11d')](db[_0xa044('0x107')],{'through':_0xa044('0x1c9'),'as':_0xa044('0x130')});db[_0xa044('0xe6')]['hasMany'](db['CmHopper'],{'as':_0xa044('0x149'),'foreignKey':_0xa044('0x1ca')});db['Campaign'][_0xa044('0x10d')](db['CmHopperFinal'],{'as':_0xa044('0x111'),'foreignKey':'CampaignId'});db['Campaign']['hasMany'](db['CmHopperHistory'],{'as':_0xa044('0x195'),'foreignKey':_0xa044('0x1ca')});db['Campaign'][_0xa044('0x10d')](db[_0xa044('0x79')],{'as':_0xa044('0x14b'),'foreignKey':_0xa044('0x1ca')});db[_0xa044('0xe6')]['belongsTo'](db[_0xa044('0x14d')],{'as':'Trunk','foreignKey':_0xa044('0x1cb')});db['Campaign']['belongsTo'](db[_0xa044('0x14d')],{'as':'TrunkBackup','foreignKey':_0xa044('0x1cc')});db[_0xa044('0xe6')][_0xa044('0x11c')](db[_0xa044('0x84')],{'as':_0xa044('0x84'),'foreignKey':'IntervalId'});db[_0xa044('0xe6')]['belongsTo'](db[_0xa044('0x13d')],{'as':_0xa044('0x13d'),'foreignKey':_0xa044('0x1cd')});db[_0xa044('0xe6')][_0xa044('0x11d')](db['CmList'],{'as':_0xa044('0x122'),'through':_0xa044('0x1ce')});db['Campaign'][_0xa044('0x11d')](db[_0xa044('0x121')],{'as':'BlackLists','through':_0xa044('0x1cf')});db['MailTransferReport'][_0xa044('0x11c')](db[_0xa044('0x44')],{});db[_0xa044('0xed')][_0xa044('0x11c')](db['MailInteraction'],{});db[_0xa044('0xed')]['belongsTo'](db[_0xa044('0x3f')],{'foreignKey':'FromMailAccountId','as':_0xa044('0x1d0')});db[_0xa044('0xed')][_0xa044('0x11c')](db['User'],{'foreignKey':_0xa044('0x1d1'),'as':_0xa044('0x1d2')});db['MailTransferReport'][_0xa044('0x11c')](db[_0xa044('0x15')],{'foreignKey':_0xa044('0x1d3'),'as':_0xa044('0x1d4')});db['MailTransferReport'][_0xa044('0x11c')](db[_0xa044('0x41')],{'foreignKey':_0xa044('0x1d5'),'as':_0xa044('0x1d6')});db['MailTransferReport'][_0xa044('0x11c')](db['MailAccount'],{'foreignKey':_0xa044('0x1d7'),'as':'ToAccount'});db[_0xa044('0x1d8')][_0xa044('0x11c')](db['ChatMessage'],{});db[_0xa044('0x1d8')][_0xa044('0x11c')](db['ChatInteraction'],{});db[_0xa044('0x1d8')][_0xa044('0x11c')](db['ChatWebsite'],{'foreignKey':_0xa044('0x1d9'),'as':_0xa044('0x1d0')});db[_0xa044('0x1d8')][_0xa044('0x11c')](db[_0xa044('0x15')],{'foreignKey':_0xa044('0x1d1'),'as':_0xa044('0x1d2')});db['ChatTransferReport']['belongsTo'](db[_0xa044('0x15')],{'foreignKey':_0xa044('0x1d3'),'as':'ToAgent'});db[_0xa044('0x1d8')][_0xa044('0x11c')](db[_0xa044('0x70')],{'foreignKey':'ToChatQueueId','as':'ToQueue'});db[_0xa044('0x1d8')][_0xa044('0x11c')](db[_0xa044('0x66')],{'foreignKey':_0xa044('0x1da'),'as':'ToAccount'});db['FaxTransferReport'][_0xa044('0x11c')](db['FaxMessage'],{});db['FaxTransferReport'][_0xa044('0x11c')](db[_0xa044('0x115')],{});db[_0xa044('0xf0')][_0xa044('0x11c')](db[_0xa044('0x4c')],{'foreignKey':_0xa044('0x1db'),'as':_0xa044('0x1d0')});db['FaxTransferReport']['belongsTo'](db['User'],{'foreignKey':'FromUserId','as':'FromAgent'});db[_0xa044('0xf0')][_0xa044('0x11c')](db[_0xa044('0x15')],{'foreignKey':_0xa044('0x1d3'),'as':_0xa044('0x1d4')});db[_0xa044('0xf0')][_0xa044('0x11c')](db[_0xa044('0x52')],{'foreignKey':_0xa044('0x1dc'),'as':_0xa044('0x1d6')});db[_0xa044('0xf0')][_0xa044('0x11c')](db[_0xa044('0x4c')],{'foreignKey':_0xa044('0x1dd'),'as':_0xa044('0x1de')});db[_0xa044('0xf2')][_0xa044('0x11c')](db[_0xa044('0x64')],{});db[_0xa044('0xf2')][_0xa044('0x11c')](db[_0xa044('0x62')],{});db[_0xa044('0xf2')][_0xa044('0x11c')](db[_0xa044('0x138')],{'foreignKey':_0xa044('0x1df'),'as':'FromAccount'});db[_0xa044('0xf2')][_0xa044('0x11c')](db['User'],{'foreignKey':'FromUserId','as':_0xa044('0x1d2')});db['OpenchannelTransferReport'][_0xa044('0x11c')](db['User'],{'foreignKey':_0xa044('0x1d3'),'as':'ToAgent'});db['OpenchannelTransferReport'][_0xa044('0x11c')](db[_0xa044('0x12e')],{'foreignKey':_0xa044('0x1e0'),'as':_0xa044('0x1d6')});db['OpenchannelTransferReport'][_0xa044('0x11c')](db[_0xa044('0x138')],{'foreignKey':_0xa044('0x1e1'),'as':_0xa044('0x1de')});db[_0xa044('0xf4')][_0xa044('0x11c')](db['SmsMessage'],{});db[_0xa044('0xf4')]['belongsTo'](db['SmsInteraction'],{});db[_0xa044('0xf4')][_0xa044('0x11c')](db['SmsAccount'],{'foreignKey':_0xa044('0x1e2'),'as':'FromAccount'});db[_0xa044('0xf4')][_0xa044('0x11c')](db['User'],{'foreignKey':_0xa044('0x1d1'),'as':_0xa044('0x1d2')});db[_0xa044('0xf4')][_0xa044('0x11c')](db[_0xa044('0x15')],{'foreignKey':_0xa044('0x1d3'),'as':'ToAgent'});db[_0xa044('0xf4')][_0xa044('0x11c')](db[_0xa044('0x5d')],{'foreignKey':_0xa044('0x1e3'),'as':'ToQueue'});db[_0xa044('0xf4')]['belongsTo'](db[_0xa044('0x56')],{'foreignKey':_0xa044('0x1e4'),'as':'ToAccount'});db[_0xa044('0x121')][_0xa044('0x10d')](db[_0xa044('0x17d')],{'as':_0xa044('0x162'),'foreignKey':'ListId'});db['CmList']['hasMany'](db[_0xa044('0x7d')],{'as':_0xa044('0x1e5'),'foreignKey':_0xa044('0x166')});db[_0xa044('0x121')][_0xa044('0x10d')](db[_0xa044('0x77')],{'as':_0xa044('0x120'),'onDelete':_0xa044('0x110'),'foreignKey':'ListId'});db[_0xa044('0x121')][_0xa044('0x10d')](db[_0xa044('0x7b')],{'as':_0xa044('0x111'),'foreignKey':_0xa044('0x166')});db[_0xa044('0x121')][_0xa044('0x10d')](db['CmHopperHistory'],{'as':'HopperHistory','foreignKey':'ListId'});db[_0xa044('0x121')][_0xa044('0x10d')](db[_0xa044('0x7c')],{'as':'ReportAgentPreview','foreignKey':'ListId'});db[_0xa044('0x121')]['belongsToMany'](db[_0xa044('0x12b')],{'as':_0xa044('0x1e6'),'through':_0xa044('0x152')});db[_0xa044('0x121')][_0xa044('0x11d')](db[_0xa044('0x15')],{'as':'Agents','through':_0xa044('0x123')});db[_0xa044('0xf7')][_0xa044('0x10d')](db[_0xa044('0x10e')],{'as':'Extensions','onDelete':'cascade'});db[_0xa044('0xf7')][_0xa044('0x11d')](db['User'],{'as':_0xa044('0x167'),'through':_0xa044('0x132')});db[_0xa044('0xf9')]['hasMany'](db[_0xa044('0x15')],{'as':_0xa044('0x171'),'foreignKey':_0xa044('0x1e7')});db[_0xa044('0xf9')][_0xa044('0x10d')](db[_0xa044('0x1e8')],{'as':_0xa044('0x1e9'),'foreignKey':_0xa044('0x1e7'),'onDelete':_0xa044('0x110')});db['UserProfileSection'][_0xa044('0x10d')](db[_0xa044('0xfc')],{'as':'Resources','foreignKey':_0xa044('0x1ea'),'onDelete':_0xa044('0x110')});db[_0xa044('0xfe')][_0xa044('0x10d')](db[_0xa044('0x17d')],{'as':_0xa044('0x162'),'foreignKey':_0xa044('0x1eb')});db[_0xa044('0xfe')]['hasMany'](db[_0xa044('0x81')],{'as':_0xa044('0x163'),'foreignKey':_0xa044('0x1eb')});db[_0xa044('0xfe')][_0xa044('0x10d')](db[_0xa044('0x103')],{'as':'Messages','foreignKey':_0xa044('0x1eb')});db[_0xa044('0xfe')]['hasMany'](db['WhatsappInteraction'],{'as':'Interactions'});db[_0xa044('0xfe')]['hasMany'](db['WhatsappApplication'],{'as':'Applications'});db[_0xa044('0xfe')][_0xa044('0x11c')](db['CmList'],{'as':_0xa044('0x165'),'foreignKey':_0xa044('0x166')});db[_0xa044('0xfe')][_0xa044('0x11c')](db['Pause'],{'as':_0xa044('0x150'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xa044('0xfe')][_0xa044('0x11d')](db[_0xa044('0x15')],{'as':_0xa044('0x167'),'through':'user_has_whatsapp_accounts'});db['WhatsappApplication'][_0xa044('0x11c')](db[_0xa044('0x15')],{'onDelete':_0xa044('0x174')});db[_0xa044('0x100')][_0xa044('0x11c')](db[_0xa044('0x107')],{'onDelete':'restrict'});db[_0xa044('0x100')][_0xa044('0x11c')](db[_0xa044('0xfe')],{'onDelete':'restrict'});db[_0xa044('0x100')][_0xa044('0x11c')](db[_0xa044('0x84')],{'onDelete':_0xa044('0x174'),'foreignKey':'IntervalId'});db['WhatsappApplication']['belongsTo'](db[_0xa044('0x16d')],{'onDelete':_0xa044('0x174'),'foreignKey':_0xa044('0x175')});db['WhatsappInteraction'][_0xa044('0x10d')](db['WhatsappMessage'],{'as':_0xa044('0x157'),'onDelete':_0xa044('0x110'),'foreignKey':'WhatsappInteractionId'});db[_0xa044('0x102')][_0xa044('0x11c')](db['WhatsappAccount'],{'as':'Account','foreignKey':_0xa044('0x1eb')});db[_0xa044('0x102')][_0xa044('0x11c')](db[_0xa044('0x77')],{'as':_0xa044('0x15e'),'foreignKey':_0xa044('0x16b')});db[_0xa044('0x102')][_0xa044('0x11c')](db[_0xa044('0x15')],{'as':_0xa044('0x16c'),'foreignKey':_0xa044('0x10c')});db[_0xa044('0x102')][_0xa044('0x11d')](db[_0xa044('0x16d')],{'through':_0xa044('0x1ec'),'as':_0xa044('0x16f')});db[_0xa044('0x102')][_0xa044('0x11d')](db[_0xa044('0x16d')],{'through':_0xa044('0x1ec'),'as':'ThroughTags'});db[_0xa044('0x102')]['belongsToMany'](db[_0xa044('0x15')],{'as':'Users','through':'user_has_whatsapp_interactions','foreignKey':_0xa044('0x1ed')});db[_0xa044('0x103')][_0xa044('0x11c')](db[_0xa044('0x15')],{'as':_0xa044('0x15')});db['WhatsappMessage']['belongsTo'](db['CmContact'],{'onDelete':'cascade','as':_0xa044('0x15e')});db['WhatsappMessage'][_0xa044('0x11c')](db[_0xa044('0x102')],{'onDelete':_0xa044('0x110'),'as':_0xa044('0x173'),'foreignKey':_0xa044('0x1ed')});db[_0xa044('0x103')]['belongsTo'](db[_0xa044('0xfe')],{'as':_0xa044('0x16a'),'foreignKey':_0xa044('0x1eb')});db[_0xa044('0x104')][_0xa044('0x11c')](db['WhatsappAccount'],{});db[_0xa044('0x104')][_0xa044('0x11c')](db[_0xa044('0x121')],{'as':'List','foreignKey':'ListId'});db[_0xa044('0x104')][_0xa044('0x11c')](db[_0xa044('0x77')],{'as':_0xa044('0x15e'),'foreignKey':_0xa044('0x16b')});db[_0xa044('0x104')][_0xa044('0x11c')](db[_0xa044('0x102')],{});db[_0xa044('0x104')][_0xa044('0x11c')](db[_0xa044('0x107')],{});db[_0xa044('0x104')]['belongsTo'](db[_0xa044('0x103')],{});db['WhatsappQueueReport']['belongsTo'](db[_0xa044('0x15')],{});db[_0xa044('0x1ee')][_0xa044('0x11c')](db[_0xa044('0x103')],{});db[_0xa044('0x1ee')][_0xa044('0x11c')](db[_0xa044('0x102')],{});db[_0xa044('0x1ee')]['belongsTo'](db[_0xa044('0xfe')],{'foreignKey':_0xa044('0x1ef'),'as':_0xa044('0x1d0')});db['WhatsappTransferReport'][_0xa044('0x11c')](db[_0xa044('0xfe')],{'foreignKey':_0xa044('0x1f0'),'as':_0xa044('0x1de')});db[_0xa044('0x1ee')][_0xa044('0x11c')](db[_0xa044('0x107')],{'foreignKey':'ToQueueId','as':_0xa044('0x1d6')});db[_0xa044('0x1ee')][_0xa044('0x11c')](db['User'],{'foreignKey':'FromUserId','as':'FromAgent'});db[_0xa044('0x1ee')][_0xa044('0x11c')](db[_0xa044('0x15')],{'foreignKey':_0xa044('0x1d3'),'as':_0xa044('0x1d4')});db['WhatsappQueue'][_0xa044('0x11d')](db[_0xa044('0x15')],{'as':_0xa044('0x167'),'through':_0xa044('0x3a'),'foreignKey':_0xa044('0x1f1')});db[_0xa044('0x107')][_0xa044('0x11d')](db[_0xa044('0xe2')],{'through':_0xa044('0x1c9'),'as':_0xa044('0x153')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file +var _0x39c7=['Items','Dispositions','FaxAccountId','Exntensions','FaxMessage','FaxInteractionId','Account','fax_interaction_has_tags','Tags','team_has_fax_queues','FaxQueueReport','SmsAccountId','SmsApplication','SmsInteractionId','sms_interaction_has_tags','OpenchannelAccountId','user_has_openchannel_accounts','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','AttachmentId','team_has_openchannel_queues','ChatWebsiteId','ChatMessage','Agent','Website','chat_interaction_has_tags','user_has_chat_interactions','ChatInteractionId','team_has_chat_queues','ChatGroupId','CompanyId','Company','cm_contact_has_tags','Queue','OwnerId','Condition','All','OneAll','AutomationAllId','Any','OneAny','Actions','AutomationId','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','Schedule','CustomReportId','Mohs','whatsapp_interaction_has_tags','AllCondition','TriggerAllId','AnyCondition','TriggerAnyId','Fields','DefaultReportId','MetricId','AnalyticMetric','SalesforceConfiguration','Configurations','AccountId','Subjects','FieldId','SalesforceAccount','Subject','SubjectId','Description','DescriptionId','Field','VariableId','Descriptions','int_desk_configuration_has_tags','ZohoConfiguration','int_zendesk_configuration_has_tags','int_freshdesk_configuration_has_tags','ServicenowField','Dynamics365Configuration','Dynamics365Field','FreshsalesAccount','FromId','ToId','JscriptyQuestionReport','SessionId','ProjectId','user_has_square_projects','user_has_teams','MailQueues','team_has_sms_queues','SmsQueues','team_has_whatsapp_queues','CampaignId','TrunkBackup','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','FromChatWebsiteId','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToFaxAccountId','OpenchannelTransferReport','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','CustomFields','Queues','user_has_voice_prefixes','UserProfileSection','Resources','sectionId','WhatsappAccountId','user_has_whatsapp_accounts','WhatsappInteractionId','FromWhatsappAccountId','ToQueueId','WhatsappQueueId','exports','../config/environment','sequelize','lodash','jstz','determine','motion2','xcall','mysql','utf8mb4','utf8_general_ci','sequelizeHistory','127.0.0.1','name','utf8','database','username','password','options','User','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','import','../api/voiceContext/voiceContext.model','../api/voiceExtension/voiceExtension.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','../api/voiceRecording/voiceRecording.model','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','../api/mailServerOut/mailServerOut.model','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','MailInteraction','../api/mailInteraction/mailInteraction.model','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','FaxApplication','../api/faxApplication/faxApplication.model','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueueReport/faxQueueReport.model','../api/smsAccount/smsAccount.model','../api/smsApplication/smsApplication.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../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','../api/condition/condition.model','Interval','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','Template','Trigger','../api/trigger/trigger.model','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','../api/intSalesforceAccount/intSalesforceAccount.model','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','FreshdeskField','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','../api/intDynamics365Configuration/intDynamics365Configuration.model','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','Network','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','SquareOdbc','../api/squareOdbc/squareOdbc.model','../api/squareProject/squareProject.model','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','../api/team/team.model','License','Campaign','../api/campaign/campaign.model','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/cmList/cmList.model','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','../api/userProfileSection/userProfileSection.model','UserProfileResource','Notification','WhatsappAccount','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','CloudProvider','../api/cloudProvider/cloudProvider.model','hasOne','cascade','UserId','hasMany','VoiceRecording','Recordings','VoiceExtension','Extensions','HopperFinals','HopperHistory','OpenchannelInteractions','ChatInteractions','SmsInteraction','FaxInteractions','MailInteractions','SenderId','belongsTo','userProfileId','belongsToMany','chat_group_has_users','Contacts','cm_user_has_contacts','cm_user_has_lists','Team','FaxInteraction','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','ChatQueues','FaxQueues','OpenchannelQueues','WhatsappQueues','CmList','VoicePrefix','VoicePrefixes','ChatWebsite','user_has_chat_websites','user_has_fax_accounts','MailAccount','MailAccounts','user_has_mail_accounts','OpenchannelAccount','OpenchannelAccounts','SmsAccount','WhatsappAccounts','SquareProject','SquareProjects','SpiedAgents','ChanSpyId','Applications','VoiceMusicOnHold','moh_has_sounds','Members','VoiceQueueId','Hoppers','HopperHistories','HopperBlacks','JscriptySessions','Trunk','TrunkId','TrunkBackupId','IntervalId','Lists','voice_queues_has_cm_lists','Agents','Teams','team_has_voice_queues','BlackLists','voice_queues_has_cm_blacklists','ScreenRecording','Messages','mailboxuser','mailbox','VoiceCallReport','uniqueid','AgentReports','Contact','ContactId','MailAccountId','MailServerOut','Answers','MailMessage','Interactions','List','TemplateId','mandatoryDispositionPause','mandatoryDispositionPauseId','team_has_mail_queues','Owner','mail_interaction_has_tags','ThroughTags','Users','user_has_mail_interactions','MailInteractionId','Attachments','Interaction','restrict','TagId','ListId'];(function(_0xfb69f1,_0x149908){var _0x444087=function(_0x4a1e40){while(--_0x4a1e40){_0xfb69f1['push'](_0xfb69f1['shift']());}};_0x444087(++_0x149908);}(_0x39c7,0x85));var _0x739c=function(_0x71e875,_0x135f75){_0x71e875=_0x71e875-0x0;var _0x50ad00=_0x39c7[_0x71e875];return _0x50ad00;};'use strict';var path=require('path');var config=require(_0x739c('0x0'));var Sequelize=require(_0x739c('0x1'));var _=require(_0x739c('0x2'));var jstz=require(_0x739c('0x3'));var timezone=jstz[_0x739c('0x4')]();config[_0x739c('0x1')]=_['defaultsDeep'](config[_0x739c('0x1')],{'database':_0x739c('0x5'),'username':_0x739c('0x6'),'password':'xC@LL1234','options':{'host':'127.0.0.1','port':0xcea,'dialect':_0x739c('0x7'),'dialectOptions':{'charset':_0x739c('0x8')},'logging':![],'timezone':timezone['name'](),'define':{'charset':'utf8','collate':_0x739c('0x9')}}});config[_0x739c('0xa')]=_['defaultsDeep'](config[_0x739c('0xa')],{'database':_0x739c('0x5'),'username':'xcall','password':'xC@LL1234','options':{'host':_0x739c('0xb'),'port':0xcea,'dialect':_0x739c('0x7'),'dialectOptions':{'charset':_0x739c('0x8')},'logging':![],'timezone':timezone[_0x739c('0xc')](),'define':{'charset':_0x739c('0xd'),'collate':_0x739c('0x9')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x739c('0x1')][_0x739c('0xe')],config[_0x739c('0x1')][_0x739c('0xf')],config[_0x739c('0x1')][_0x739c('0x10')],config['sequelize'][_0x739c('0x11')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x739c('0xa')][_0x739c('0xe')],config[_0x739c('0xa')][_0x739c('0xf')],config[_0x739c('0xa')][_0x739c('0x10')],config[_0x739c('0xa')][_0x739c('0x11')])};db[_0x739c('0x12')]=db['sequelize']['import'](_0x739c('0x13'));db[_0x739c('0x14')]=db[_0x739c('0x1')]['import'](_0x739c('0x15'));db[_0x739c('0x16')]=db[_0x739c('0x1')][_0x739c('0x17')](_0x739c('0x18'));db['VoiceExtension']=db[_0x739c('0x1')][_0x739c('0x17')](_0x739c('0x19'));db['VoiceMusicOnHold']=db[_0x739c('0x1')]['import']('../api/voiceMusicOnHold/voiceMusicOnHold.model');db[_0x739c('0x1a')]=db['sequelize'][_0x739c('0x17')](_0x739c('0x1b'));db['VoiceRecording']=db[_0x739c('0x1')]['import'](_0x739c('0x1c'));db['ScreenRecording']=db[_0x739c('0x1')][_0x739c('0x17')](_0x739c('0x1d'));db[_0x739c('0x1e')]=db[_0x739c('0x1')][_0x739c('0x17')](_0x739c('0x1f'));db[_0x739c('0x20')]=db['sequelize'][_0x739c('0x17')](_0x739c('0x21'));db['VoiceCallReport']=db[_0x739c('0x1')]['import']('../api/voiceCallReport/voiceCallReport.model');db[_0x739c('0x22')]=db[_0x739c('0x1')][_0x739c('0x17')](_0x739c('0x23'));db[_0x739c('0x24')]=db[_0x739c('0x1')][_0x739c('0x17')]('../api/voiceAgentReport/voiceAgentReport.model');db[_0x739c('0x25')]=db[_0x739c('0x1')][_0x739c('0x17')](_0x739c('0x26'));db[_0x739c('0x27')]=db[_0x739c('0x1')][_0x739c('0x17')]('../api/memberReport/memberReport.model');db['Trunk']=db['sequelize']['import'](_0x739c('0x28'));db[_0x739c('0x29')]=db[_0x739c('0x1')][_0x739c('0x17')](_0x739c('0x2a'));db[_0x739c('0x2b')]=db[_0x739c('0x1')][_0x739c('0x17')](_0x739c('0x2c'));db[_0x739c('0x2d')]=db[_0x739c('0x1')][_0x739c('0x17')](_0x739c('0x2e'));db[_0x739c('0x2f')]=db[_0x739c('0x1')][_0x739c('0x17')](_0x739c('0x30'));db[_0x739c('0x31')]=db[_0x739c('0x1')][_0x739c('0x17')](_0x739c('0x32'));db[_0x739c('0x33')]=db[_0x739c('0x1')][_0x739c('0x17')](_0x739c('0x34'));db[_0x739c('0x35')]=db[_0x739c('0x1')][_0x739c('0x17')](_0x739c('0x36'));db[_0x739c('0x37')]=db[_0x739c('0x1')][_0x739c('0x17')](_0x739c('0x38'));db[_0x739c('0x39')]=db[_0x739c('0x1')]['import'](_0x739c('0x3a'));db[_0x739c('0x3b')]=db['sequelize'][_0x739c('0x17')](_0x739c('0x3c'));db['MailServerOut']=db['sequelize'][_0x739c('0x17')](_0x739c('0x3d'));db['MailAccount']=db[_0x739c('0x1')][_0x739c('0x17')](_0x739c('0x3e'));db[_0x739c('0x3f')]=db[_0x739c('0x1')]['import'](_0x739c('0x40'));db[_0x739c('0x41')]=db['sequelize']['import']('../api/mailSubstatus/mailSubstatus.model');db[_0x739c('0x42')]=db[_0x739c('0x1')]['import'](_0x739c('0x43'));db['MailMessage']=db['sequelize'][_0x739c('0x17')](_0x739c('0x44'));db[_0x739c('0x45')]=db[_0x739c('0x1')][_0x739c('0x17')](_0x739c('0x46'));db[_0x739c('0x47')]=db[_0x739c('0x1')]['import'](_0x739c('0x48'));db[_0x739c('0x49')]=db[_0x739c('0x1')][_0x739c('0x17')]('../api/dashboard/dashboard.model');db[_0x739c('0x4a')]=db[_0x739c('0x1')]['import'](_0x739c('0x4b'));db[_0x739c('0x4c')]=db[_0x739c('0x1')][_0x739c('0x17')]('../api/faxAccount/faxAccount.model');db[_0x739c('0x4d')]=db[_0x739c('0x1')][_0x739c('0x17')](_0x739c('0x4e'));db['FaxInteraction']=db[_0x739c('0x1')]['import']('../api/faxInteraction/faxInteraction.model');db['FaxMessage']=db[_0x739c('0x1')][_0x739c('0x17')](_0x739c('0x4f'));db[_0x739c('0x50')]=db[_0x739c('0x1')][_0x739c('0x17')]('../api/faxQueue/faxQueue.model');db['FaxQueueReport']=db['sequelize'][_0x739c('0x17')](_0x739c('0x51'));db['SmsAccount']=db[_0x739c('0x1')]['import'](_0x739c('0x52'));db['SmsApplication']=db[_0x739c('0x1')][_0x739c('0x17')](_0x739c('0x53'));db['SmsInteraction']=db[_0x739c('0x1')][_0x739c('0x17')]('../api/smsInteraction/smsInteraction.model');db[_0x739c('0x54')]=db[_0x739c('0x1')][_0x739c('0x17')](_0x739c('0x55'));db[_0x739c('0x56')]=db['sequelize'][_0x739c('0x17')](_0x739c('0x57'));db['OpenchannelAccount']=db[_0x739c('0x1')][_0x739c('0x17')]('../api/openchannelAccount/openchannelAccount.model');db[_0x739c('0x58')]=db['sequelize']['import'](_0x739c('0x59'));db[_0x739c('0x5a')]=db['sequelize'][_0x739c('0x17')]('../api/openchannelInteraction/openchannelInteraction.model');db[_0x739c('0x5b')]=db[_0x739c('0x1')][_0x739c('0x17')](_0x739c('0x5c'));db[_0x739c('0x5d')]=db[_0x739c('0x1')][_0x739c('0x17')](_0x739c('0x5e'));db['ChatWebsite']=db[_0x739c('0x1')][_0x739c('0x17')](_0x739c('0x5f'));db[_0x739c('0x60')]=db[_0x739c('0x1')][_0x739c('0x17')](_0x739c('0x61'));db[_0x739c('0x62')]=db[_0x739c('0x1')][_0x739c('0x17')](_0x739c('0x63'));db[_0x739c('0x64')]=db[_0x739c('0x1')][_0x739c('0x17')](_0x739c('0x65'));db['ChatMessage']=db[_0x739c('0x1')][_0x739c('0x17')]('../api/chatMessage/chatMessage.model');db[_0x739c('0x66')]=db[_0x739c('0x1')][_0x739c('0x17')](_0x739c('0x67'));db[_0x739c('0x68')]=db[_0x739c('0x1')][_0x739c('0x17')](_0x739c('0x69'));db[_0x739c('0x6a')]=db[_0x739c('0x1')]['import'](_0x739c('0x6b'));db[_0x739c('0x6c')]=db[_0x739c('0x1')][_0x739c('0x17')](_0x739c('0x6d'));db[_0x739c('0x6e')]=db[_0x739c('0x1')][_0x739c('0x17')](_0x739c('0x6f'));db[_0x739c('0x70')]=db['sequelize']['import'](_0x739c('0x71'));db[_0x739c('0x72')]=db[_0x739c('0x1')][_0x739c('0x17')](_0x739c('0x73'));db[_0x739c('0x74')]=db[_0x739c('0x1')][_0x739c('0x17')](_0x739c('0x75'));db[_0x739c('0x76')]=db[_0x739c('0x1')][_0x739c('0x17')](_0x739c('0x77'));db[_0x739c('0x78')]=db['sequelize'][_0x739c('0x17')](_0x739c('0x79'));db[_0x739c('0x7a')]=db[_0x739c('0x1')]['import'](_0x739c('0x7b'));db[_0x739c('0x7c')]=db[_0x739c('0x1')]['import'](_0x739c('0x7d'));db[_0x739c('0x7e')]=db[_0x739c('0x1')][_0x739c('0x17')](_0x739c('0x7f'));db[_0x739c('0x80')]=db[_0x739c('0x1')][_0x739c('0x17')](_0x739c('0x81'));db[_0x739c('0x82')]=db[_0x739c('0x1')][_0x739c('0x17')](_0x739c('0x83'));db[_0x739c('0x84')]=db[_0x739c('0x1')]['import'](_0x739c('0x85'));db['Condition']=db['sequelize'][_0x739c('0x17')](_0x739c('0x86'));db[_0x739c('0x87')]=db[_0x739c('0x1')][_0x739c('0x17')](_0x739c('0x88'));db[_0x739c('0x89')]=db[_0x739c('0x1')]['import'](_0x739c('0x8a'));db[_0x739c('0x8b')]=db[_0x739c('0x1')][_0x739c('0x17')](_0x739c('0x8c'));db[_0x739c('0x8d')]=db[_0x739c('0x1')][_0x739c('0x17')](_0x739c('0x8e'));db['Schedule']=db['sequelize'][_0x739c('0x17')]('../api/schedule/schedule.model');db[_0x739c('0x8f')]=db[_0x739c('0x1')]['import'](_0x739c('0x90'));db[_0x739c('0x91')]=db[_0x739c('0x1')][_0x739c('0x17')](_0x739c('0x92'));db[_0x739c('0x93')]=db['sequelize']['import']('../api/template/template.model');db[_0x739c('0x94')]=db['sequelize'][_0x739c('0x17')](_0x739c('0x95'));db[_0x739c('0x96')]=db['sequelize'][_0x739c('0x17')](_0x739c('0x97'));db[_0x739c('0x98')]=db['sequelize']['import'](_0x739c('0x99'));db['IntegrationReport']=db[_0x739c('0x1')][_0x739c('0x17')](_0x739c('0x9a'));db[_0x739c('0x9b')]=db[_0x739c('0x1')]['import'](_0x739c('0x9c'));db[_0x739c('0x9d')]=db[_0x739c('0x1')][_0x739c('0x17')](_0x739c('0x9e'));db[_0x739c('0x9f')]=db['sequelize'][_0x739c('0x17')](_0x739c('0xa0'));db['AnalyticMetric']=db['sequelize'][_0x739c('0x17')]('../api/analyticMetric/analyticMetric.model');db[_0x739c('0xa1')]=db[_0x739c('0x1')][_0x739c('0x17')](_0x739c('0xa2'));db[_0x739c('0xa3')]=db[_0x739c('0x1')][_0x739c('0x17')](_0x739c('0xa4'));db['SalesforceAccount']=db[_0x739c('0x1')][_0x739c('0x17')](_0x739c('0xa5'));db['SalesforceConfiguration']=db[_0x739c('0x1')][_0x739c('0x17')](_0x739c('0xa6'));db[_0x739c('0xa7')]=db['sequelize'][_0x739c('0x17')](_0x739c('0xa8'));db[_0x739c('0xa9')]=db['sequelize'][_0x739c('0x17')](_0x739c('0xaa'));db[_0x739c('0xab')]=db[_0x739c('0x1')]['import'](_0x739c('0xac'));db[_0x739c('0xad')]=db['sequelize'][_0x739c('0x17')](_0x739c('0xae'));db[_0x739c('0xaf')]=db[_0x739c('0x1')][_0x739c('0x17')](_0x739c('0xb0'));db[_0x739c('0xb1')]=db[_0x739c('0x1')]['import'](_0x739c('0xb2'));db[_0x739c('0xb3')]=db[_0x739c('0x1')]['import'](_0x739c('0xb4'));db[_0x739c('0xb5')]=db[_0x739c('0x1')][_0x739c('0x17')](_0x739c('0xb6'));db['ZohoConfiguration']=db['sequelize'][_0x739c('0x17')](_0x739c('0xb7'));db[_0x739c('0xb8')]=db[_0x739c('0x1')]['import'](_0x739c('0xb9'));db[_0x739c('0xba')]=db['sequelize'][_0x739c('0x17')](_0x739c('0xbb'));db[_0x739c('0xbc')]=db[_0x739c('0x1')][_0x739c('0x17')](_0x739c('0xbd'));db[_0x739c('0xbe')]=db[_0x739c('0x1')]['import'](_0x739c('0xbf'));db[_0x739c('0xc0')]=db['sequelize'][_0x739c('0x17')](_0x739c('0xc1'));db[_0x739c('0xc2')]=db['sequelize'][_0x739c('0x17')]('../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model');db[_0x739c('0xc3')]=db['sequelize']['import']('../api/intFreshdeskField/intFreshdeskField.model');db[_0x739c('0xc4')]=db[_0x739c('0x1')]['import'](_0x739c('0xc5'));db[_0x739c('0xc6')]=db[_0x739c('0x1')][_0x739c('0x17')](_0x739c('0xc7'));db[_0x739c('0xc8')]=db[_0x739c('0x1')][_0x739c('0x17')](_0x739c('0xc9'));db[_0x739c('0xca')]=db['sequelize']['import']('../api/intServicenowAccount/intServicenowAccount.model');db[_0x739c('0xcb')]=db[_0x739c('0x1')][_0x739c('0x17')](_0x739c('0xcc'));db['ServicenowField']=db[_0x739c('0x1')][_0x739c('0x17')](_0x739c('0xcd'));db[_0x739c('0xce')]=db['sequelize'][_0x739c('0x17')](_0x739c('0xcf'));db['Dynamics365Configuration']=db[_0x739c('0x1')][_0x739c('0x17')](_0x739c('0xd0'));db['Dynamics365Field']=db['sequelize']['import'](_0x739c('0xd1'));db['FreshsalesAccount']=db[_0x739c('0x1')][_0x739c('0x17')]('../api/intFreshsalesAccount/intFreshsalesAccount.model');db[_0x739c('0xd2')]=db['sequelize'][_0x739c('0x17')](_0x739c('0xd3'));db[_0x739c('0xd4')]=db[_0x739c('0x1')][_0x739c('0x17')]('../api/intFreshsalesField/intFreshsalesField.model');db['Integration']=db[_0x739c('0x1')][_0x739c('0x17')]('../api/integration/integration.model');db[_0x739c('0xd5')]=db['sequelize'][_0x739c('0x17')](_0x739c('0xd6'));db[_0x739c('0xd7')]=db[_0x739c('0x1')]['import'](_0x739c('0xd8'));db[_0x739c('0xd9')]=db[_0x739c('0x1')]['import'](_0x739c('0xda'));db[_0x739c('0xdb')]=db[_0x739c('0x1')][_0x739c('0x17')](_0x739c('0xdc'));db['JscriptyQuestionReport']=db[_0x739c('0x1')][_0x739c('0x17')]('../api/jscriptyQuestionReport/jscriptyQuestionReport.model');db[_0x739c('0xdd')]=db['sequelize']['import'](_0x739c('0xde'));db[_0x739c('0xdf')]=db[_0x739c('0x1')][_0x739c('0x17')]('../api/smsQueueReport/smsQueueReport.model');db['SquareReport']=db[_0x739c('0x1')][_0x739c('0x17')](_0x739c('0xe0'));db[_0x739c('0xe1')]=db[_0x739c('0x1')]['import'](_0x739c('0xe2'));db[_0x739c('0xe3')]=db[_0x739c('0x1')][_0x739c('0x17')]('../api/jscriptyProject/jscriptyProject.model');db['Setting']=db[_0x739c('0x1')][_0x739c('0x17')]('../api/setting/setting.model');db[_0x739c('0xe4')]=db[_0x739c('0x1')][_0x739c('0x17')](_0x739c('0xe5'));db['SquareProject']=db[_0x739c('0x1')][_0x739c('0x17')](_0x739c('0xe6'));db['SquareRecording']=db[_0x739c('0x1')]['import'](_0x739c('0xe7'));db[_0x739c('0xe8')]=db['sequelize'][_0x739c('0x17')](_0x739c('0xe9'));db['Team']=db[_0x739c('0x1')]['import'](_0x739c('0xea'));db[_0x739c('0xeb')]=db[_0x739c('0x1')][_0x739c('0x17')]('../api/license/license.model');db[_0x739c('0xec')]=db[_0x739c('0x1')][_0x739c('0x17')](_0x739c('0xed'));db['Migration']=db[_0x739c('0x1')][_0x739c('0x17')](_0x739c('0xee'));db[_0x739c('0xef')]=db[_0x739c('0x1')][_0x739c('0x17')](_0x739c('0xf0'));db[_0x739c('0xf1')]=db[_0x739c('0x1')]['import'](_0x739c('0xf2'));db[_0x739c('0xf3')]=db[_0x739c('0x1')]['import'](_0x739c('0xf4'));db[_0x739c('0xf5')]=db[_0x739c('0x1')]['import']('../api/chatTransferReport/chatTransferReport.model');db[_0x739c('0xf6')]=db[_0x739c('0x1')][_0x739c('0x17')](_0x739c('0xf7'));db['OpenchannelTransferReport']=db[_0x739c('0x1')][_0x739c('0x17')](_0x739c('0xf8'));db[_0x739c('0xf9')]=db['sequelize']['import']('../api/smsTransferReport/smsTransferReport.model');db['CmList']=db[_0x739c('0x1')][_0x739c('0x17')](_0x739c('0xfa'));db['VoicePrefix']=db['sequelize'][_0x739c('0x17')](_0x739c('0xfb'));db[_0x739c('0xfc')]=db[_0x739c('0x1')][_0x739c('0x17')](_0x739c('0xfd'));db['UserProfileSection']=db[_0x739c('0x1')][_0x739c('0x17')](_0x739c('0xfe'));db[_0x739c('0xff')]=db[_0x739c('0x1')][_0x739c('0x17')]('../api/userProfileResource/userProfileResource.model');db[_0x739c('0x100')]=db[_0x739c('0x1')][_0x739c('0x17')]('../api/notification/notification.model');db[_0x739c('0x101')]=db[_0x739c('0x1')][_0x739c('0x17')]('../api/whatsappAccount/whatsappAccount.model');db[_0x739c('0x102')]=db[_0x739c('0x1')][_0x739c('0x17')](_0x739c('0x103'));db[_0x739c('0x104')]=db[_0x739c('0x1')][_0x739c('0x17')](_0x739c('0x105'));db[_0x739c('0x106')]=db[_0x739c('0x1')][_0x739c('0x17')](_0x739c('0x107'));db[_0x739c('0x108')]=db['sequelize']['import'](_0x739c('0x109'));db[_0x739c('0x10a')]=db['sequelize'][_0x739c('0x17')](_0x739c('0x10b'));db[_0x739c('0x10c')]=db['sequelize'][_0x739c('0x17')]('../api/whatsappQueue/whatsappQueue.model');db[_0x739c('0x10d')]=db[_0x739c('0x1')][_0x739c('0x17')](_0x739c('0x10e'));db[_0x739c('0x12')][_0x739c('0x10f')](db[_0x739c('0x1e')],{'as':'VoiceMail','onDelete':_0x739c('0x110'),'foreignKey':_0x739c('0x111')});db['User'][_0x739c('0x112')](db[_0x739c('0x113')],{'as':_0x739c('0x114'),'foreignKey':'UserId'});db[_0x739c('0x12')]['hasMany'](db['UserVoiceQueueRt'],{'as':'VoiceQueuesRt','foreignKey':_0x739c('0x111')});db['User'][_0x739c('0x112')](db[_0x739c('0x115')],{'as':_0x739c('0x116'),'onDelete':_0x739c('0x110'),'hooks':!![]});db[_0x739c('0x12')][_0x739c('0x112')](db[_0x739c('0x76')],{'as':_0x739c('0x117'),'foreignKey':_0x739c('0x111')});db[_0x739c('0x12')]['hasMany'](db['CmHopperHistory'],{'as':_0x739c('0x118'),'foreignKey':_0x739c('0x111')});db[_0x739c('0x12')]['hasMany'](db[_0x739c('0x7a')],{'as':_0x739c('0x7a'),'foreignKey':_0x739c('0x111')});db['User'][_0x739c('0x112')](db[_0x739c('0x5a')],{'as':_0x739c('0x119'),'foreignKey':'UserId'});db[_0x739c('0x12')][_0x739c('0x112')](db['ChatInteraction'],{'as':_0x739c('0x11a'),'foreignKey':_0x739c('0x111')});db[_0x739c('0x12')][_0x739c('0x112')](db[_0x739c('0x11b')],{'as':'SmsInteractions','foreignKey':_0x739c('0x111')});db[_0x739c('0x12')]['hasMany'](db['FaxInteraction'],{'as':_0x739c('0x11c'),'foreignKey':'UserId'});db[_0x739c('0x12')][_0x739c('0x112')](db[_0x739c('0x42')],{'as':_0x739c('0x11d'),'foreignKey':_0x739c('0x111')});db[_0x739c('0x12')]['hasMany'](db[_0x739c('0x104')],{'as':'WhatsappInteractions','foreignKey':_0x739c('0x111')});db[_0x739c('0x12')][_0x739c('0x112')](db[_0x739c('0x100')],{'as':'Notifications','foreignKey':_0x739c('0x11e')});db[_0x739c('0x12')][_0x739c('0x11f')](db[_0x739c('0xfc')],{'as':'UserProfile','foreignKey':_0x739c('0x120')});db[_0x739c('0x12')][_0x739c('0x121')](db[_0x739c('0x6a')],{'as':'Groups','through':_0x739c('0x122')});db[_0x739c('0x12')][_0x739c('0x121')](db[_0x739c('0x70')],{'as':_0x739c('0x123'),'through':_0x739c('0x124')});db[_0x739c('0x12')]['belongsToMany'](db['CmList'],{'as':'Lists','through':_0x739c('0x125')});db['User'][_0x739c('0x121')](db[_0x739c('0x126')],{'through':'user_has_teams'});db[_0x739c('0x12')][_0x739c('0x121')](db['MailInteraction'],{'as':'MailInteractions','through':'user_has_mail_interactions'});db['User']['belongsToMany'](db[_0x739c('0x64')],{'as':'ChatInteractions','through':'user_has_chat_interactions'});db[_0x739c('0x12')]['belongsToMany'](db[_0x739c('0x127')],{'as':_0x739c('0x11c'),'through':_0x739c('0x128')});db[_0x739c('0x12')]['belongsToMany'](db[_0x739c('0x11b')],{'as':'SmsInteractions','through':_0x739c('0x129')});db[_0x739c('0x12')][_0x739c('0x121')](db[_0x739c('0x5a')],{'as':_0x739c('0x119'),'through':_0x739c('0x12a')});db['User'][_0x739c('0x121')](db[_0x739c('0x104')],{'as':'WhatsappInteractions','through':_0x739c('0x12b')});db[_0x739c('0x12')][_0x739c('0x121')](db[_0x739c('0x1a')],{'as':_0x739c('0x12c'),'through':_0x739c('0x2d'),'required':![]});db[_0x739c('0x12')]['belongsToMany'](db['MailQueue'],{'as':'MailQueues','through':_0x739c('0x31'),'required':![]});db[_0x739c('0x12')][_0x739c('0x121')](db[_0x739c('0x68')],{'as':_0x739c('0x12d'),'through':_0x739c('0x2f'),'required':![],'hooks':!![]});db[_0x739c('0x12')][_0x739c('0x121')](db[_0x739c('0x50')],{'as':_0x739c('0x12e'),'through':_0x739c('0x33'),'required':![]});db[_0x739c('0x12')][_0x739c('0x121')](db[_0x739c('0x56')],{'as':'SmsQueues','through':_0x739c('0x35'),'required':![]});db[_0x739c('0x12')][_0x739c('0x121')](db['OpenchannelQueue'],{'as':_0x739c('0x12f'),'through':_0x739c('0x37'),'required':![]});db['User'][_0x739c('0x121')](db[_0x739c('0x10c')],{'as':_0x739c('0x130'),'through':_0x739c('0x39'),'required':![]});db[_0x739c('0x12')][_0x739c('0x121')](db[_0x739c('0x131')],{'through':_0x739c('0x125')});db[_0x739c('0x12')][_0x739c('0x121')](db[_0x739c('0x132')],{'as':_0x739c('0x133'),'through':'user_has_voice_prefixes','required':![]});db[_0x739c('0x12')]['belongsToMany'](db[_0x739c('0x134')],{'as':'ChatWebsites','through':_0x739c('0x135')});db[_0x739c('0x12')][_0x739c('0x121')](db[_0x739c('0x4c')],{'as':'FaxAccounts','through':_0x739c('0x136')});db[_0x739c('0x12')][_0x739c('0x121')](db[_0x739c('0x137')],{'as':_0x739c('0x138'),'through':_0x739c('0x139')});db[_0x739c('0x12')]['belongsToMany'](db[_0x739c('0x13a')],{'as':_0x739c('0x13b'),'through':'user_has_openchannel_accounts'});db[_0x739c('0x12')][_0x739c('0x121')](db[_0x739c('0x13c')],{'as':'SmsAccounts','through':'user_has_sms_accounts'});db['User'][_0x739c('0x121')](db[_0x739c('0x101')],{'as':_0x739c('0x13d'),'through':'user_has_whatsapp_accounts'});db[_0x739c('0x12')][_0x739c('0x121')](db[_0x739c('0x13e')],{'as':_0x739c('0x13f'),'through':'user_has_square_projects'});db[_0x739c('0x14')][_0x739c('0x112')](db['VoiceExtension'],{'as':_0x739c('0x140'),'onDelete':_0x739c('0x110'),'foreignKey':_0x739c('0x141')});db[_0x739c('0x16')][_0x739c('0x112')](db[_0x739c('0x115')],{'onDelete':_0x739c('0x110')});db[_0x739c('0x115')][_0x739c('0x112')](db[_0x739c('0x115')],{'as':_0x739c('0x142'),'onDelete':'cascade'});db[_0x739c('0x143')][_0x739c('0x121')](db[_0x739c('0x8f')],{'as':'Sounds','through':_0x739c('0x144')});db['VoiceQueue']['hasMany'](db['UserVoiceQueueRt'],{'as':_0x739c('0x145'),'foreignKey':_0x739c('0x146')});db[_0x739c('0x1a')][_0x739c('0x112')](db[_0x739c('0x72')],{'as':_0x739c('0x147'),'foreignKey':_0x739c('0x146')});db[_0x739c('0x1a')][_0x739c('0x112')](db[_0x739c('0x76')],{'as':_0x739c('0x117'),'foreignKey':_0x739c('0x146')});db[_0x739c('0x1a')][_0x739c('0x112')](db[_0x739c('0x78')],{'as':_0x739c('0x148'),'foreignKey':_0x739c('0x146')});db[_0x739c('0x1a')][_0x739c('0x112')](db['ReportAgentPreview'],{'as':_0x739c('0x7a'),'foreignKey':_0x739c('0x146')});db[_0x739c('0x1a')]['hasMany'](db[_0x739c('0x74')],{'as':_0x739c('0x149'),'foreignKey':_0x739c('0x146')});db[_0x739c('0x1a')]['hasMany'](db[_0x739c('0xdd')],{'as':_0x739c('0x14a'),'foreignKey':_0x739c('0x146')});db[_0x739c('0x1a')]['belongsTo'](db['Trunk'],{'as':_0x739c('0x14b'),'foreignKey':_0x739c('0x14c')});db['VoiceQueue'][_0x739c('0x11f')](db[_0x739c('0x14b')],{'as':'TrunkBackup','foreignKey':_0x739c('0x14d')});db[_0x739c('0x1a')][_0x739c('0x11f')](db[_0x739c('0x87')],{'as':_0x739c('0x87'),'foreignKey':_0x739c('0x14e')});db[_0x739c('0x1a')][_0x739c('0x11f')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db['VoiceQueue'][_0x739c('0x121')](db[_0x739c('0x131')],{'as':_0x739c('0x14f'),'through':_0x739c('0x150')});db[_0x739c('0x1a')][_0x739c('0x121')](db[_0x739c('0x12')],{'as':_0x739c('0x151'),'through':_0x739c('0x2d')});db[_0x739c('0x1a')][_0x739c('0x121')](db['Team'],{'as':_0x739c('0x152'),'through':_0x739c('0x153')});db[_0x739c('0x1a')]['belongsToMany'](db[_0x739c('0x131')],{'as':_0x739c('0x154'),'through':_0x739c('0x155')});db[_0x739c('0x113')][_0x739c('0x11f')](db[_0x739c('0x12')],{'as':_0x739c('0x12'),'foreignKey':'UserId'});db[_0x739c('0x156')][_0x739c('0x11f')](db[_0x739c('0x12')],{'as':_0x739c('0x12'),'foreignKey':_0x739c('0x111')});db[_0x739c('0x1e')][_0x739c('0x112')](db[_0x739c('0x20')],{'as':_0x739c('0x157'),'onDelete':_0x739c('0x110'),'foreignKey':_0x739c('0x158'),'sourceKey':'mailbox'});db[_0x739c('0x20')]['belongsTo'](db['VoiceMail'],{'foreignKey':_0x739c('0x158'),'targetKey':_0x739c('0x159')});db[_0x739c('0x15a')][_0x739c('0x112')](db[_0x739c('0x25')],{'as':'QueueCalls','foreignKey':_0x739c('0x15b'),'constraints':![]});db[_0x739c('0x15a')][_0x739c('0x112')](db[_0x739c('0x24')],{'as':_0x739c('0x15c'),'foreignKey':_0x739c('0x15b'),'constraints':![]});db[_0x739c('0x15a')][_0x739c('0x11f')](db[_0x739c('0x12')],{'as':_0x739c('0x12'),'foreignKey':_0x739c('0x111')});db[_0x739c('0x15a')][_0x739c('0x11f')](db[_0x739c('0x70')],{'as':_0x739c('0x15d'),'foreignKey':_0x739c('0x15e')});db[_0x739c('0x3b')][_0x739c('0x11f')](db[_0x739c('0x137')],{'as':_0x739c('0x137'),'foreignKey':_0x739c('0x15f')});db['MailServerOut']['belongsTo'](db[_0x739c('0x137')],{'as':_0x739c('0x137'),'foreignKey':'MailAccountId'});db[_0x739c('0x137')][_0x739c('0x10f')](db[_0x739c('0x3b')],{'as':'Imap','onDelete':_0x739c('0x110')});db['MailAccount'][_0x739c('0x10f')](db[_0x739c('0x160')],{'as':'Smtp','onDelete':_0x739c('0x110')});db[_0x739c('0x137')][_0x739c('0x112')](db[_0x739c('0x84')],{'as':'Dispositions','foreignKey':'MailAccountId'});db[_0x739c('0x137')][_0x739c('0x112')](db['CannedAnswer'],{'as':_0x739c('0x161'),'foreignKey':'MailAccountId'});db['MailAccount']['hasMany'](db[_0x739c('0x162')],{'as':_0x739c('0x157'),'foreignKey':_0x739c('0x15f')});db[_0x739c('0x137')]['hasMany'](db['MailInteraction'],{'as':_0x739c('0x163')});db[_0x739c('0x137')][_0x739c('0x112')](db[_0x739c('0x45')],{'as':_0x739c('0x142')});db[_0x739c('0x137')][_0x739c('0x11f')](db[_0x739c('0x131')],{'as':_0x739c('0x164'),'foreignKey':'ListId'});db[_0x739c('0x137')][_0x739c('0x11f')](db['Template'],{'as':_0x739c('0x93'),'foreignKey':_0x739c('0x165')});db['MailAccount'][_0x739c('0x11f')](db[_0x739c('0x89')],{'as':_0x739c('0x166'),'foreignKey':_0x739c('0x167')});db[_0x739c('0x137')]['belongsToMany'](db[_0x739c('0x12')],{'as':'Agents','through':_0x739c('0x139')});db['MailQueue'][_0x739c('0x121')](db[_0x739c('0x12')],{'as':_0x739c('0x151'),'through':_0x739c('0x31')});db['MailQueue'][_0x739c('0x121')](db[_0x739c('0x126')],{'through':_0x739c('0x168'),'as':_0x739c('0x152')});db['MailInteraction'][_0x739c('0x112')](db[_0x739c('0x162')],{'as':_0x739c('0x157'),'onDelete':'cascade','foreignKey':'MailInteractionId'});db['MailInteraction'][_0x739c('0x11f')](db['MailAccount'],{'as':'Account','foreignKey':_0x739c('0x15f')});db[_0x739c('0x42')][_0x739c('0x11f')](db['CmContact'],{'as':_0x739c('0x15d'),'foreignKey':_0x739c('0x15e')});db[_0x739c('0x42')][_0x739c('0x11f')](db['User'],{'as':_0x739c('0x169'),'foreignKey':'UserId'});db['MailInteraction'][_0x739c('0x121')](db[_0x739c('0x91')],{'through':_0x739c('0x16a'),'as':'Tags'});db[_0x739c('0x42')]['belongsToMany'](db[_0x739c('0x91')],{'through':_0x739c('0x16a'),'as':_0x739c('0x16b')});db[_0x739c('0x42')]['belongsToMany'](db[_0x739c('0x12')],{'as':_0x739c('0x16c'),'through':_0x739c('0x16d'),'foreignKey':_0x739c('0x16e')});db[_0x739c('0x162')]['hasMany'](db[_0x739c('0xef')],{'as':_0x739c('0x16f'),'onDelete':_0x739c('0x110')});db[_0x739c('0x162')][_0x739c('0x11f')](db[_0x739c('0x12')],{'as':'User'});db[_0x739c('0x162')][_0x739c('0x11f')](db[_0x739c('0x70')],{'onDelete':_0x739c('0x110'),'as':_0x739c('0x15d')});db['MailMessage'][_0x739c('0x11f')](db[_0x739c('0x42')],{'as':_0x739c('0x170'),'foreignKey':_0x739c('0x16e')});db[_0x739c('0x162')][_0x739c('0x11f')](db[_0x739c('0x137')],{'as':'Account','foreignKey':_0x739c('0x15f')});db['MailApplication'][_0x739c('0x11f')](db[_0x739c('0x12')],{'onDelete':_0x739c('0x171')});db[_0x739c('0x45')][_0x739c('0x11f')](db[_0x739c('0x3f')],{'onDelete':'restrict'});db[_0x739c('0x45')][_0x739c('0x11f')](db[_0x739c('0x137')],{'onDelete':_0x739c('0x171')});db[_0x739c('0x45')][_0x739c('0x11f')](db['Interval'],{'onDelete':_0x739c('0x171'),'foreignKey':_0x739c('0x14e')});db[_0x739c('0x45')][_0x739c('0x11f')](db[_0x739c('0x91')],{'onDelete':'restrict','foreignKey':_0x739c('0x172')});db[_0x739c('0x47')][_0x739c('0x11f')](db[_0x739c('0x137')],{});db[_0x739c('0x47')][_0x739c('0x11f')](db[_0x739c('0x131')],{'as':'List','foreignKey':_0x739c('0x173')});db[_0x739c('0x47')][_0x739c('0x11f')](db[_0x739c('0x70')],{'as':_0x739c('0x15d'),'foreignKey':_0x739c('0x15e')});db[_0x739c('0x47')][_0x739c('0x11f')](db[_0x739c('0x42')],{});db[_0x739c('0x47')][_0x739c('0x11f')](db[_0x739c('0x162')],{});db[_0x739c('0x47')]['belongsTo'](db['User'],{});db[_0x739c('0x47')]['belongsTo'](db['MailQueue'],{});db[_0x739c('0x49')]['hasMany'](db[_0x739c('0x4a')],{'as':_0x739c('0x174'),'onDelete':_0x739c('0x110')});db[_0x739c('0x4c')]['hasMany'](db['Disposition'],{'as':_0x739c('0x175'),'foreignKey':_0x739c('0x176')});db[_0x739c('0x4c')][_0x739c('0x112')](db[_0x739c('0x82')],{'as':_0x739c('0x161'),'foreignKey':_0x739c('0x176')});db[_0x739c('0x4c')][_0x739c('0x112')](db[_0x739c('0x127')],{'as':_0x739c('0x163')});db[_0x739c('0x4c')][_0x739c('0x112')](db[_0x739c('0x4d')],{'as':_0x739c('0x142')});db[_0x739c('0x4c')][_0x739c('0x112')](db[_0x739c('0x115')],{'as':_0x739c('0x177'),'onDelete':_0x739c('0x110')});db[_0x739c('0x4c')][_0x739c('0x112')](db['FaxMessage'],{'as':_0x739c('0x157')});db['FaxAccount'][_0x739c('0x11f')](db[_0x739c('0x14b')],{'as':_0x739c('0x14b')});db[_0x739c('0x4c')][_0x739c('0x11f')](db[_0x739c('0x131')],{'as':_0x739c('0x164'),'foreignKey':_0x739c('0x173')});db['FaxAccount'][_0x739c('0x11f')](db[_0x739c('0x89')],{'as':_0x739c('0x166'),'foreignKey':_0x739c('0x167')});db[_0x739c('0x4c')][_0x739c('0x121')](db[_0x739c('0x12')],{'as':_0x739c('0x151'),'through':_0x739c('0x136')});db[_0x739c('0x4d')][_0x739c('0x11f')](db[_0x739c('0x12')],{'onDelete':_0x739c('0x171')});db['FaxApplication'][_0x739c('0x11f')](db[_0x739c('0x50')],{'onDelete':_0x739c('0x171')});db['FaxApplication'][_0x739c('0x11f')](db[_0x739c('0x4c')],{'onDelete':_0x739c('0x171')});db[_0x739c('0x4d')][_0x739c('0x11f')](db[_0x739c('0x91')],{'onDelete':'restrict','foreignKey':'TagId'});db['FaxInteraction'][_0x739c('0x112')](db[_0x739c('0x178')],{'as':'Messages','onDelete':_0x739c('0x110'),'foreignKey':_0x739c('0x179')});db[_0x739c('0x127')][_0x739c('0x11f')](db[_0x739c('0x4c')],{'as':_0x739c('0x17a'),'foreignKey':_0x739c('0x176')});db['FaxInteraction'][_0x739c('0x11f')](db['CmContact'],{'as':_0x739c('0x15d'),'foreignKey':_0x739c('0x15e')});db[_0x739c('0x127')][_0x739c('0x11f')](db[_0x739c('0x12')],{'as':_0x739c('0x169'),'foreignKey':'UserId'});db[_0x739c('0x127')][_0x739c('0x121')](db[_0x739c('0x91')],{'through':_0x739c('0x17b'),'as':_0x739c('0x17c')});db[_0x739c('0x127')][_0x739c('0x121')](db[_0x739c('0x91')],{'through':_0x739c('0x17b'),'as':'ThroughTags'});db['FaxInteraction'][_0x739c('0x121')](db[_0x739c('0x12')],{'as':_0x739c('0x16c'),'through':_0x739c('0x128'),'foreignKey':_0x739c('0x179')});db[_0x739c('0x178')][_0x739c('0x11f')](db[_0x739c('0x12')],{'onDelete':'cascade','as':'User'});db[_0x739c('0x178')][_0x739c('0x11f')](db[_0x739c('0x127')],{'as':'Interaction','foreignKey':_0x739c('0x179')});db['FaxMessage'][_0x739c('0x11f')](db[_0x739c('0x70')],{'onDelete':_0x739c('0x110'),'as':'Contact'});db[_0x739c('0x178')][_0x739c('0x11f')](db[_0x739c('0xef')],{'as':'Attachment','foreignKey':'AttachmentId'});db[_0x739c('0x178')][_0x739c('0x11f')](db[_0x739c('0x4c')],{'as':_0x739c('0x17a'),'foreignKey':'FaxAccountId'});db[_0x739c('0x50')]['belongsToMany'](db[_0x739c('0x12')],{'as':'Agents','through':'UserFaxQueue'});db[_0x739c('0x50')][_0x739c('0x121')](db[_0x739c('0x126')],{'through':_0x739c('0x17d'),'as':'Teams'});db['FaxQueueReport'][_0x739c('0x11f')](db[_0x739c('0x4c')],{});db[_0x739c('0x17e')][_0x739c('0x11f')](db[_0x739c('0x131')],{'as':_0x739c('0x164'),'foreignKey':_0x739c('0x173')});db[_0x739c('0x17e')][_0x739c('0x11f')](db[_0x739c('0x70')],{'as':'Contact','foreignKey':_0x739c('0x15e')});db['FaxQueueReport'][_0x739c('0x11f')](db[_0x739c('0x127')],{});db['FaxQueueReport']['belongsTo'](db[_0x739c('0x178')],{});db['FaxQueueReport'][_0x739c('0x11f')](db[_0x739c('0x12')],{});db[_0x739c('0x17e')]['belongsTo'](db[_0x739c('0x50')],{});db[_0x739c('0x13c')]['hasMany'](db[_0x739c('0x84')],{'as':_0x739c('0x175'),'foreignKey':'SmsAccountId'});db[_0x739c('0x13c')][_0x739c('0x112')](db['CannedAnswer'],{'as':_0x739c('0x161'),'foreignKey':_0x739c('0x17f')});db[_0x739c('0x13c')][_0x739c('0x112')](db[_0x739c('0x54')],{'as':'Messages','foreignKey':_0x739c('0x17f')});db[_0x739c('0x13c')][_0x739c('0x112')](db['SmsInteraction'],{'as':'Interactions'});db[_0x739c('0x13c')][_0x739c('0x112')](db[_0x739c('0x180')],{'as':_0x739c('0x142')});db[_0x739c('0x13c')][_0x739c('0x11f')](db[_0x739c('0x131')],{'as':_0x739c('0x164'),'foreignKey':_0x739c('0x173')});db['SmsAccount'][_0x739c('0x11f')](db['Pause'],{'as':_0x739c('0x166'),'foreignKey':_0x739c('0x167')});db[_0x739c('0x13c')]['belongsToMany'](db['User'],{'as':'Agents','through':'user_has_sms_accounts'});db[_0x739c('0x180')][_0x739c('0x11f')](db[_0x739c('0x12')],{'onDelete':'restrict'});db[_0x739c('0x180')][_0x739c('0x11f')](db[_0x739c('0x56')],{'onDelete':'restrict'});db[_0x739c('0x180')][_0x739c('0x11f')](db[_0x739c('0x13c')],{'onDelete':'restrict'});db[_0x739c('0x180')][_0x739c('0x11f')](db[_0x739c('0x87')],{'onDelete':'restrict','foreignKey':_0x739c('0x14e')});db[_0x739c('0x180')][_0x739c('0x11f')](db[_0x739c('0x91')],{'onDelete':'restrict','foreignKey':_0x739c('0x172')});db[_0x739c('0x11b')][_0x739c('0x112')](db[_0x739c('0x54')],{'as':_0x739c('0x157'),'onDelete':_0x739c('0x110'),'foreignKey':_0x739c('0x181')});db['SmsInteraction'][_0x739c('0x11f')](db[_0x739c('0x13c')],{'as':_0x739c('0x17a'),'foreignKey':'SmsAccountId'});db['SmsInteraction']['belongsTo'](db[_0x739c('0x70')],{'as':'Contact','foreignKey':_0x739c('0x15e')});db[_0x739c('0x11b')][_0x739c('0x11f')](db[_0x739c('0x12')],{'as':_0x739c('0x169'),'foreignKey':_0x739c('0x111')});db['SmsInteraction']['belongsToMany'](db[_0x739c('0x91')],{'through':_0x739c('0x182'),'as':_0x739c('0x17c')});db[_0x739c('0x11b')]['belongsToMany'](db['Tag'],{'through':_0x739c('0x182'),'as':_0x739c('0x16b')});db[_0x739c('0x11b')][_0x739c('0x121')](db[_0x739c('0x12')],{'as':_0x739c('0x16c'),'through':_0x739c('0x129'),'foreignKey':_0x739c('0x181')});db[_0x739c('0x54')][_0x739c('0x11f')](db[_0x739c('0x12')],{'as':_0x739c('0x12')});db[_0x739c('0x54')][_0x739c('0x11f')](db[_0x739c('0x70')],{'onDelete':_0x739c('0x110'),'as':_0x739c('0x15d')});db[_0x739c('0x54')][_0x739c('0x11f')](db[_0x739c('0x11b')],{'onDelete':'cascade','as':_0x739c('0x170'),'foreignKey':'SmsInteractionId'});db[_0x739c('0x54')][_0x739c('0x11f')](db['SmsAccount'],{'as':_0x739c('0x17a'),'foreignKey':_0x739c('0x17f')});db[_0x739c('0x56')][_0x739c('0x121')](db['User'],{'as':_0x739c('0x151'),'through':'UserSmsQueue','foreignKey':'SmsQueueId'});db[_0x739c('0x56')][_0x739c('0x121')](db[_0x739c('0x126')],{'through':'team_has_sms_queues','as':_0x739c('0x152')});db[_0x739c('0x13a')][_0x739c('0x112')](db[_0x739c('0x84')],{'as':_0x739c('0x175'),'foreignKey':'OpenchannelAccountId'});db[_0x739c('0x13a')][_0x739c('0x112')](db['CannedAnswer'],{'as':'Answers','foreignKey':'OpenchannelAccountId'});db[_0x739c('0x13a')][_0x739c('0x112')](db['OpenchannelInteraction'],{'as':_0x739c('0x163'),'foreignKey':_0x739c('0x183')});db[_0x739c('0x13a')][_0x739c('0x112')](db[_0x739c('0x5b')],{'as':'Messages','foreignKey':'OpenchannelAccountId'});db[_0x739c('0x13a')]['hasMany'](db[_0x739c('0x58')],{'as':_0x739c('0x142'),'foreignKey':_0x739c('0x183')});db['OpenchannelAccount'][_0x739c('0x11f')](db[_0x739c('0x131')],{'as':_0x739c('0x164'),'foreignKey':_0x739c('0x173')});db[_0x739c('0x13a')][_0x739c('0x11f')](db[_0x739c('0x89')],{'as':_0x739c('0x166'),'foreignKey':_0x739c('0x167')});db[_0x739c('0x13a')][_0x739c('0x121')](db['User'],{'as':'Agents','through':_0x739c('0x184')});db['OpenchannelApplication'][_0x739c('0x11f')](db[_0x739c('0x12')],{'onDelete':_0x739c('0x171')});db[_0x739c('0x58')][_0x739c('0x11f')](db[_0x739c('0x5d')],{'onDelete':'restrict','foreignKey':_0x739c('0x185')});db['OpenchannelApplication'][_0x739c('0x11f')](db[_0x739c('0x13a')],{'onDelete':_0x739c('0x171'),'foreignKey':_0x739c('0x183')});db[_0x739c('0x58')][_0x739c('0x11f')](db[_0x739c('0x87')],{'onDelete':_0x739c('0x171'),'foreignKey':_0x739c('0x14e')});db['OpenchannelApplication'][_0x739c('0x11f')](db[_0x739c('0x91')],{'onDelete':_0x739c('0x171'),'foreignKey':_0x739c('0x172')});db[_0x739c('0x5a')][_0x739c('0x112')](db['OpenchannelMessage'],{'as':'Messages','onDelete':'cascade','foreignKey':_0x739c('0x186')});db[_0x739c('0x5a')][_0x739c('0x11f')](db['OpenchannelAccount'],{'as':_0x739c('0x17a'),'foreignKey':_0x739c('0x183')});db[_0x739c('0x5a')]['belongsTo'](db[_0x739c('0x70')],{'as':_0x739c('0x15d'),'foreignKey':_0x739c('0x15e')});db[_0x739c('0x5a')][_0x739c('0x11f')](db[_0x739c('0x12')],{'as':_0x739c('0x169'),'foreignKey':_0x739c('0x111')});db[_0x739c('0x5a')][_0x739c('0x121')](db[_0x739c('0x91')],{'through':_0x739c('0x187'),'as':'Tags'});db[_0x739c('0x5a')][_0x739c('0x121')](db[_0x739c('0x91')],{'through':_0x739c('0x187'),'as':_0x739c('0x16b')});db['OpenchannelInteraction'][_0x739c('0x121')](db['User'],{'as':_0x739c('0x16c'),'through':_0x739c('0x12a'),'foreignKey':_0x739c('0x186')});db[_0x739c('0x5b')]['belongsTo'](db[_0x739c('0x12')],{'onDelete':_0x739c('0x110'),'as':_0x739c('0x12')});db[_0x739c('0x5b')]['belongsTo'](db[_0x739c('0x70')],{'onDelete':'cascade','as':_0x739c('0x15d')});db[_0x739c('0x5b')][_0x739c('0x11f')](db[_0x739c('0x5a')],{'onDelete':_0x739c('0x110'),'as':_0x739c('0x170'),'foreignKey':_0x739c('0x186')});db[_0x739c('0x5b')][_0x739c('0x11f')](db[_0x739c('0xef')],{'as':_0x739c('0xef'),'foreignKey':_0x739c('0x188')});db['OpenchannelMessage'][_0x739c('0x11f')](db[_0x739c('0x13a')],{'as':_0x739c('0x17a'),'foreignKey':_0x739c('0x183')});db[_0x739c('0x5d')]['belongsToMany'](db[_0x739c('0x12')],{'as':_0x739c('0x151'),'through':_0x739c('0x37'),'foreignKey':'OpenchannelQueueId'});db['OpenchannelQueue']['belongsToMany'](db['Team'],{'through':_0x739c('0x189'),'as':_0x739c('0x152')});db[_0x739c('0x134')][_0x739c('0x112')](db[_0x739c('0x84')],{'as':_0x739c('0x175'),'foreignKey':'ChatWebsiteId'});db['ChatWebsite'][_0x739c('0x112')](db[_0x739c('0x82')],{'as':_0x739c('0x161'),'foreignKey':_0x739c('0x18a')});db[_0x739c('0x134')][_0x739c('0x112')](db[_0x739c('0x6c')],{'as':'ProactiveActions'});db['ChatWebsite'][_0x739c('0x112')](db['ChatInteraction'],{'as':_0x739c('0x163')});db[_0x739c('0x134')]['hasMany'](db[_0x739c('0x62')],{'as':'Applications'});db[_0x739c('0x134')]['hasMany'](db[_0x739c('0x18b')],{'as':_0x739c('0x157')});db[_0x739c('0x134')][_0x739c('0x11f')](db[_0x739c('0x131')],{'as':_0x739c('0x164'),'foreignKey':_0x739c('0x173')});db[_0x739c('0x134')][_0x739c('0x11f')](db[_0x739c('0x87')],{'as':'Interval','foreignKey':'IntervalId'});db[_0x739c('0x134')][_0x739c('0x11f')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x739c('0x167')});db[_0x739c('0x134')][_0x739c('0x121')](db[_0x739c('0x12')],{'as':_0x739c('0x151'),'through':'user_has_chat_websites'});db['OpenchannelQueueReport'][_0x739c('0x11f')](db[_0x739c('0x13a')],{});db[_0x739c('0x60')]['belongsTo'](db[_0x739c('0x131')],{'as':_0x739c('0x164'),'foreignKey':_0x739c('0x173')});db[_0x739c('0x60')][_0x739c('0x11f')](db[_0x739c('0x70')],{'as':_0x739c('0x15d'),'foreignKey':'ContactId'});db['OpenchannelQueueReport'][_0x739c('0x11f')](db[_0x739c('0x5a')],{});db['OpenchannelQueueReport'][_0x739c('0x11f')](db[_0x739c('0x5b')],{});db['OpenchannelQueueReport'][_0x739c('0x11f')](db['User'],{});db[_0x739c('0x60')][_0x739c('0x11f')](db[_0x739c('0x5d')],{});db[_0x739c('0x62')]['belongsTo'](db[_0x739c('0x12')],{'as':_0x739c('0x18c'),'foreignKey':_0x739c('0x111'),'onDelete':_0x739c('0x171')});db[_0x739c('0x62')][_0x739c('0x11f')](db[_0x739c('0x68')],{'as':'Queue','foreignKey':'ChatQueueId','onDelete':_0x739c('0x171')});db['ChatApplication'][_0x739c('0x11f')](db[_0x739c('0x134')],{'as':_0x739c('0x18d'),'foreignKey':'ChatWebsiteId','onDelete':_0x739c('0x171')});db[_0x739c('0x62')]['belongsTo'](db[_0x739c('0x91')],{'onDelete':_0x739c('0x171'),'foreignKey':_0x739c('0x172')});db[_0x739c('0x64')]['hasMany'](db[_0x739c('0x18b')],{'as':_0x739c('0x157'),'onDelete':_0x739c('0x110'),'foreignKey':'ChatInteractionId'});db[_0x739c('0x64')][_0x739c('0x11f')](db[_0x739c('0x134')],{'as':_0x739c('0x17a'),'foreignKey':_0x739c('0x18a')});db['ChatInteraction'][_0x739c('0x11f')](db[_0x739c('0x70')],{'as':_0x739c('0x15d'),'foreignKey':'ContactId'});db[_0x739c('0x64')][_0x739c('0x11f')](db['User'],{'as':_0x739c('0x169'),'foreignKey':_0x739c('0x111')});db[_0x739c('0x64')][_0x739c('0x121')](db[_0x739c('0x91')],{'through':_0x739c('0x18e'),'as':_0x739c('0x17c')});db[_0x739c('0x64')]['belongsToMany'](db[_0x739c('0x91')],{'through':_0x739c('0x18e'),'as':'ThroughTags'});db[_0x739c('0x64')][_0x739c('0x121')](db[_0x739c('0x12')],{'as':'Users','through':_0x739c('0x18f'),'foreignKey':_0x739c('0x190')});db[_0x739c('0x18b')][_0x739c('0x11f')](db[_0x739c('0x12')],{'onDelete':_0x739c('0x110'),'as':_0x739c('0x12')});db[_0x739c('0x18b')]['belongsTo'](db[_0x739c('0x70')],{'onDelete':_0x739c('0x110'),'as':'Contact','foreignKey':_0x739c('0x15e')});db[_0x739c('0x18b')][_0x739c('0x11f')](db[_0x739c('0x64')],{'onDelete':_0x739c('0x110'),'as':_0x739c('0x170'),'foreignKey':_0x739c('0x190')});db[_0x739c('0x18b')][_0x739c('0x11f')](db[_0x739c('0xef')],{'as':'Attachment','foreignKey':_0x739c('0x188')});db[_0x739c('0x18b')]['belongsTo'](db[_0x739c('0x134')],{'as':_0x739c('0x17a'),'foreignKey':_0x739c('0x18a')});db[_0x739c('0x66')]['belongsTo'](db[_0x739c('0x70')],{'onDelete':_0x739c('0x110'),'as':_0x739c('0x15d'),'foreignKey':_0x739c('0x15e')});db[_0x739c('0x66')]['belongsTo'](db['ChatWebsite'],{'as':_0x739c('0x17a'),'foreignKey':_0x739c('0x18a')});db[_0x739c('0x68')][_0x739c('0x121')](db['User'],{'as':_0x739c('0x151'),'through':_0x739c('0x2f'),'hooks':!![]});db[_0x739c('0x68')][_0x739c('0x121')](db[_0x739c('0x126')],{'through':_0x739c('0x191'),'as':_0x739c('0x152')});db['ChatGroup'][_0x739c('0x112')](db[_0x739c('0xd9')],{'as':_0x739c('0x157'),'foreignKey':_0x739c('0x192'),'onDelete':_0x739c('0x110')});db[_0x739c('0x6a')][_0x739c('0x121')](db[_0x739c('0x12')],{'as':_0x739c('0x145'),'through':_0x739c('0x122')});db['ChatProactiveAction'][_0x739c('0x11f')](db[_0x739c('0x134')],{'as':'Website','foreignKey':_0x739c('0x18a')});db['CmCompany'][_0x739c('0x112')](db[_0x739c('0x70')],{'as':_0x739c('0x123'),'foreignKey':_0x739c('0x193')});db[_0x739c('0x70')]['hasMany'](db['CmHopper'],{'as':_0x739c('0x147'),'foreignKey':'ContactId'});db['CmContact'][_0x739c('0x112')](db[_0x739c('0x76')],{'as':_0x739c('0x117'),'foreignKey':_0x739c('0x15e')});db[_0x739c('0x70')][_0x739c('0x112')](db[_0x739c('0x78')],{'as':_0x739c('0x148'),'foreignKey':_0x739c('0x15e')});db[_0x739c('0x70')]['hasMany'](db[_0x739c('0x7a')],{'as':_0x739c('0x7a'),'foreignKey':'ContactId'});db[_0x739c('0x70')]['hasMany'](db[_0x739c('0xdd')],{'as':_0x739c('0x14a'),'foreignKey':_0x739c('0x15e')});db[_0x739c('0x70')][_0x739c('0x112')](db['OpenchannelInteraction'],{'as':'OpenchannelInteractions','foreignKey':_0x739c('0x15e'),'onDelete':'restrict'});db['CmContact'][_0x739c('0x112')](db[_0x739c('0x64')],{'as':'ChatInteractions','foreignKey':_0x739c('0x15e'),'onDelete':_0x739c('0x171')});db[_0x739c('0x70')][_0x739c('0x112')](db[_0x739c('0x11b')],{'as':'SmsInteractions','foreignKey':_0x739c('0x15e'),'onDelete':_0x739c('0x171')});db[_0x739c('0x70')][_0x739c('0x112')](db[_0x739c('0x127')],{'as':_0x739c('0x11c'),'foreignKey':_0x739c('0x15e'),'onDelete':_0x739c('0x171')});db[_0x739c('0x70')][_0x739c('0x112')](db['MailInteraction'],{'as':_0x739c('0x11d'),'foreignKey':_0x739c('0x15e'),'onDelete':_0x739c('0x171')});db[_0x739c('0x70')][_0x739c('0x11f')](db[_0x739c('0x6e')],{'as':_0x739c('0x194'),'foreignKey':_0x739c('0x193')});db[_0x739c('0x70')][_0x739c('0x11f')](db['CmList'],{'as':'List','foreignKey':_0x739c('0x173'),'onDelete':_0x739c('0x110')});db[_0x739c('0x70')]['belongsToMany'](db[_0x739c('0x12')],{'as':_0x739c('0x16c'),'through':_0x739c('0x124')});db['CmContact'][_0x739c('0x121')](db[_0x739c('0x91')],{'as':'Tags','through':_0x739c('0x195')});db[_0x739c('0x70')][_0x739c('0x121')](db[_0x739c('0x91')],{'through':_0x739c('0x195'),'as':_0x739c('0x16b')});db[_0x739c('0x72')][_0x739c('0x11f')](db[_0x739c('0x70')],{'as':_0x739c('0x15d'),'foreignKey':_0x739c('0x15e'),'onDelete':_0x739c('0x110')});db[_0x739c('0x72')][_0x739c('0x11f')](db[_0x739c('0x131')],{'as':_0x739c('0x164'),'foreignKey':_0x739c('0x173'),'onDelete':_0x739c('0x110')});db[_0x739c('0x72')]['belongsTo'](db[_0x739c('0x12')],{'as':'Agent','foreignKey':_0x739c('0x111')});db[_0x739c('0x72')][_0x739c('0x11f')](db['VoiceQueue'],{'as':_0x739c('0x196'),'foreignKey':_0x739c('0x146'),'onDelete':_0x739c('0x110')});db[_0x739c('0x72')][_0x739c('0x11f')](db[_0x739c('0xec')],{'as':'Campaign','foreignKey':'CampaignId','onDelete':_0x739c('0x110')});db[_0x739c('0x72')][_0x739c('0x11f')](db[_0x739c('0x12')],{'as':'Owner','foreignKey':_0x739c('0x197')});db[_0x739c('0x74')][_0x739c('0x11f')](db[_0x739c('0x70')],{'as':'Contact','foreignKey':'ContactId','onDelete':_0x739c('0x110')});db[_0x739c('0x74')]['belongsTo'](db[_0x739c('0x131')],{'as':_0x739c('0x164'),'foreignKey':_0x739c('0x173'),'onDelete':_0x739c('0x110')});db['CmHopperBlack'][_0x739c('0x11f')](db[_0x739c('0x1a')],{'as':_0x739c('0x196'),'foreignKey':_0x739c('0x146'),'onDelete':_0x739c('0x110')});db['CmHopperBlack'][_0x739c('0x11f')](db[_0x739c('0xec')],{'as':'Campaign','foreignKey':'CampaignId','onDelete':_0x739c('0x110')});db[_0x739c('0x80')][_0x739c('0x112')](db[_0x739c('0x198')],{'as':{'plural':_0x739c('0x199'),'singular':_0x739c('0x19a')},'foreignKey':_0x739c('0x19b'),'onDelete':_0x739c('0x110'),'hooks':!![]});db['Automation'][_0x739c('0x112')](db[_0x739c('0x198')],{'as':{'plural':_0x739c('0x19c'),'singular':_0x739c('0x19d')},'foreignKey':'AutomationAnyId','onDelete':_0x739c('0x110'),'hooks':!![]});db[_0x739c('0x80')][_0x739c('0x112')](db[_0x739c('0x7e')],{'as':_0x739c('0x19e'),'foreignKey':_0x739c('0x19f'),'onDelete':_0x739c('0x110'),'hooks':!![]});db['Interval']['hasMany'](db['Interval'],{'as':_0x739c('0x1a0'),'foreignKey':_0x739c('0x14e'),'onDelete':'cascade','hooks':!![],'required':![]});db['Interval']['hasMany'](db[_0x739c('0x115')],{'as':_0x739c('0x116'),'foreignKey':_0x739c('0x14e'),'onDelete':'restrict'});db['Interval'][_0x739c('0x112')](db[_0x739c('0x45')],{'as':_0x739c('0x1a1'),'foreignKey':_0x739c('0x14e')});db[_0x739c('0x87')]['hasMany'](db[_0x739c('0x62')],{'as':_0x739c('0x1a2'),'foreignKey':'IntervalId'});db[_0x739c('0x87')][_0x739c('0x112')](db[_0x739c('0x4d')],{'as':_0x739c('0x1a3'),'foreignKey':_0x739c('0x14e')});db[_0x739c('0x87')][_0x739c('0x112')](db[_0x739c('0x180')],{'as':_0x739c('0x1a4'),'foreignKey':'IntervalId'});db[_0x739c('0x1a5')][_0x739c('0x11f')](db[_0x739c('0x137')],{});db[_0x739c('0x1a5')]['belongsTo'](db[_0x739c('0x9d')],{'foreignKey':'DefaultReportId'});db[_0x739c('0x1a5')]['belongsTo'](db[_0x739c('0x9b')],{'foreignKey':_0x739c('0x1a6')});db[_0x739c('0x8f')][_0x739c('0x121')](db[_0x739c('0x143')],{'as':_0x739c('0x1a7'),'through':_0x739c('0x144'),'onDelete':_0x739c('0x171')});db[_0x739c('0x91')][_0x739c('0x121')](db[_0x739c('0x70')],{'through':_0x739c('0x195')});db['Tag'][_0x739c('0x121')](db[_0x739c('0x64')],{'through':_0x739c('0x18e')});db[_0x739c('0x91')][_0x739c('0x121')](db[_0x739c('0x42')],{'through':_0x739c('0x16a')});db['Tag'][_0x739c('0x121')](db[_0x739c('0x11b')],{'through':_0x739c('0x182')});db[_0x739c('0x91')][_0x739c('0x121')](db['FaxInteraction'],{'through':_0x739c('0x17b')});db[_0x739c('0x91')][_0x739c('0x121')](db['OpenchannelInteraction'],{'through':_0x739c('0x187')});db['Tag'][_0x739c('0x121')](db[_0x739c('0x104')],{'through':_0x739c('0x1a8')});db[_0x739c('0x94')][_0x739c('0x112')](db['Condition'],{'as':{'plural':'AllConditions','singular':_0x739c('0x1a9')},'foreignKey':_0x739c('0x1aa'),'onDelete':_0x739c('0x110'),'hooks':!![]});db['Trigger'][_0x739c('0x112')](db[_0x739c('0x198')],{'as':{'plural':'AnyConditions','singular':_0x739c('0x1ab')},'foreignKey':_0x739c('0x1ac'),'onDelete':_0x739c('0x110'),'hooks':!![]});db[_0x739c('0x94')][_0x739c('0x112')](db[_0x739c('0x7e')],{'as':_0x739c('0x19e'),'foreignKey':'TriggerId','onDelete':_0x739c('0x110'),'hooks':!![]});db['AnalyticCustomReport'][_0x739c('0x112')](db['AnalyticFieldReport'],{'as':_0x739c('0x1ad'),'onDelete':_0x739c('0x110'),'foreignKey':'CustomReportId','hooks':!![]});db['AnalyticDefaultReport']['hasMany'](db['AnalyticFieldReport'],{'as':'Fields','onDelete':_0x739c('0x110'),'foreignKey':_0x739c('0x1ae')});db['AnalyticMetric'][_0x739c('0x112')](db[_0x739c('0xa1')],{'as':_0x739c('0x1ad'),'onDelete':'cascade','foreignKey':_0x739c('0x1af')});db[_0x739c('0xa1')]['belongsTo'](db[_0x739c('0x1b0')],{'foreignKey':'MetricId'});db['SalesforceAccount'][_0x739c('0x112')](db[_0x739c('0x1b1')],{'as':_0x739c('0x1b2'),'onDelete':_0x739c('0x110'),'foreignKey':_0x739c('0x1b3')});db['SalesforceConfiguration'][_0x739c('0x112')](db[_0x739c('0xa7')],{'as':_0x739c('0x1b4'),'onDelete':_0x739c('0x110'),'foreignKey':'SubjectId'});db[_0x739c('0x1b1')][_0x739c('0x112')](db[_0x739c('0xa7')],{'as':'Descriptions','onDelete':_0x739c('0x110'),'foreignKey':'DescriptionId'});db[_0x739c('0x1b1')][_0x739c('0x112')](db[_0x739c('0xa7')],{'as':_0x739c('0x1ad'),'onDelete':'cascade','foreignKey':_0x739c('0x1b5')});db[_0x739c('0x1b1')][_0x739c('0x11f')](db[_0x739c('0x1b6')],{'as':_0x739c('0x17a'),'foreignKey':_0x739c('0x1b3')});db[_0x739c('0xa7')]['hasMany'](db['SalesforceField'],{'as':_0x739c('0x1b7'),'foreignKey':_0x739c('0x1b8')});db[_0x739c('0xa7')][_0x739c('0x112')](db[_0x739c('0xa7')],{'as':_0x739c('0x1b9'),'foreignKey':_0x739c('0x1ba')});db[_0x739c('0xa7')][_0x739c('0x112')](db[_0x739c('0xa7')],{'as':_0x739c('0x1bb'),'foreignKey':_0x739c('0x1b5')});db[_0x739c('0xa7')][_0x739c('0x11f')](db[_0x739c('0x96')],{'as':_0x739c('0x96'),'foreignKey':_0x739c('0x1bc')});db[_0x739c('0xa9')][_0x739c('0x112')](db[_0x739c('0xab')],{'as':_0x739c('0x1b2'),'onDelete':_0x739c('0x110'),'foreignKey':'AccountId'});db[_0x739c('0xab')][_0x739c('0x112')](db['SugarcrmField'],{'as':_0x739c('0x1b4'),'onDelete':_0x739c('0x110'),'foreignKey':_0x739c('0x1b8')});db[_0x739c('0xab')][_0x739c('0x112')](db[_0x739c('0xad')],{'as':_0x739c('0x1bd'),'onDelete':_0x739c('0x110'),'foreignKey':_0x739c('0x1ba')});db[_0x739c('0xab')]['hasMany'](db[_0x739c('0xad')],{'as':_0x739c('0x1ad'),'onDelete':_0x739c('0x110'),'foreignKey':_0x739c('0x1b5')});db[_0x739c('0xab')][_0x739c('0x11f')](db['SugarcrmAccount'],{'as':_0x739c('0x17a'),'foreignKey':_0x739c('0x1b3')});db[_0x739c('0xad')]['hasMany'](db[_0x739c('0xad')],{'as':_0x739c('0x1b7'),'foreignKey':_0x739c('0x1b8')});db[_0x739c('0xad')][_0x739c('0x112')](db['SugarcrmField'],{'as':_0x739c('0x1b9'),'foreignKey':_0x739c('0x1ba')});db['SugarcrmField'][_0x739c('0x112')](db[_0x739c('0xad')],{'as':_0x739c('0x1bb'),'foreignKey':_0x739c('0x1b5')});db[_0x739c('0xad')][_0x739c('0x11f')](db[_0x739c('0x96')],{'as':_0x739c('0x96'),'foreignKey':_0x739c('0x1bc')});db[_0x739c('0xaf')][_0x739c('0x112')](db[_0x739c('0xb1')],{'as':_0x739c('0x1b2'),'onDelete':_0x739c('0x110'),'foreignKey':'AccountId'});db[_0x739c('0xb1')][_0x739c('0x112')](db[_0x739c('0xb3')],{'as':_0x739c('0x1b4'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0x739c('0xb1')][_0x739c('0x112')](db[_0x739c('0xb3')],{'as':_0x739c('0x1bd'),'onDelete':_0x739c('0x110'),'foreignKey':_0x739c('0x1ba')});db[_0x739c('0xb1')][_0x739c('0x112')](db[_0x739c('0xb3')],{'as':_0x739c('0x1ad'),'onDelete':'cascade','foreignKey':'FieldId'});db[_0x739c('0xb1')][_0x739c('0x11f')](db['DeskAccount'],{'as':'Account','foreignKey':_0x739c('0x1b3')});db['DeskConfiguration']['belongsToMany'](db[_0x739c('0x91')],{'through':_0x739c('0x1be')});db[_0x739c('0xb3')][_0x739c('0x112')](db['DeskField'],{'as':_0x739c('0x1b7'),'foreignKey':_0x739c('0x1b8')});db[_0x739c('0xb3')][_0x739c('0x112')](db[_0x739c('0xb3')],{'as':_0x739c('0x1b9'),'foreignKey':_0x739c('0x1ba')});db[_0x739c('0xb3')][_0x739c('0x112')](db[_0x739c('0xb3')],{'as':'Field','foreignKey':'FieldId'});db['DeskField'][_0x739c('0x11f')](db[_0x739c('0x96')],{'as':_0x739c('0x96'),'foreignKey':'VariableId'});db[_0x739c('0xb5')][_0x739c('0x112')](db[_0x739c('0x1bf')],{'as':_0x739c('0x1b2'),'onDelete':_0x739c('0x110'),'foreignKey':'AccountId'});db[_0x739c('0x1bf')][_0x739c('0x112')](db[_0x739c('0xb8')],{'as':_0x739c('0x1b4'),'onDelete':_0x739c('0x110'),'foreignKey':_0x739c('0x1b8')});db['ZohoConfiguration'][_0x739c('0x112')](db[_0x739c('0xb8')],{'as':_0x739c('0x1bd'),'onDelete':_0x739c('0x110'),'foreignKey':_0x739c('0x1ba')});db[_0x739c('0x1bf')][_0x739c('0x112')](db[_0x739c('0xb8')],{'as':'Fields','onDelete':_0x739c('0x110'),'foreignKey':_0x739c('0x1b5')});db[_0x739c('0x1bf')][_0x739c('0x11f')](db[_0x739c('0xb5')],{'as':'Account','foreignKey':'AccountId'});db[_0x739c('0xb8')]['hasMany'](db['ZohoField'],{'as':_0x739c('0x1b7'),'foreignKey':_0x739c('0x1b8')});db[_0x739c('0xb8')][_0x739c('0x112')](db[_0x739c('0xb8')],{'as':_0x739c('0x1b9'),'foreignKey':_0x739c('0x1ba')});db[_0x739c('0xb8')]['hasMany'](db[_0x739c('0xb8')],{'as':_0x739c('0x1bb'),'foreignKey':_0x739c('0x1b5')});db['ZohoField'][_0x739c('0x11f')](db[_0x739c('0x96')],{'as':'Variable','foreignKey':_0x739c('0x1bc')});db[_0x739c('0xba')][_0x739c('0x112')](db[_0x739c('0xbc')],{'as':_0x739c('0x1b2'),'onDelete':'cascade','foreignKey':_0x739c('0x1b3')});db['ZendeskConfiguration']['hasMany'](db[_0x739c('0xbe')],{'as':'Subjects','foreignKey':_0x739c('0x1b8')});db[_0x739c('0xbc')][_0x739c('0x112')](db[_0x739c('0xbe')],{'as':'Descriptions','foreignKey':_0x739c('0x1ba')});db[_0x739c('0xbc')][_0x739c('0x112')](db['ZendeskField'],{'as':'Fields','foreignKey':_0x739c('0x1b5')});db[_0x739c('0xbc')][_0x739c('0x11f')](db[_0x739c('0xba')],{'as':_0x739c('0x17a'),'foreignKey':_0x739c('0x1b3')});db[_0x739c('0xbc')]['belongsToMany'](db[_0x739c('0x91')],{'through':_0x739c('0x1c0')});db['ZendeskField']['hasMany'](db[_0x739c('0xbe')],{'as':'Subject','foreignKey':_0x739c('0x1b8')});db[_0x739c('0xbe')]['hasMany'](db[_0x739c('0xbe')],{'as':_0x739c('0x1b9'),'foreignKey':_0x739c('0x1ba')});db[_0x739c('0xbe')]['hasMany'](db[_0x739c('0xbe')],{'as':'Field','foreignKey':_0x739c('0x1b5')});db[_0x739c('0xbe')]['belongsTo'](db[_0x739c('0x96')],{'as':_0x739c('0x96'),'foreignKey':_0x739c('0x1bc')});db['FreshdeskAccount'][_0x739c('0x112')](db['FreshdeskConfiguration'],{'as':'Configurations','onDelete':_0x739c('0x110'),'foreignKey':'AccountId'});db[_0x739c('0xc2')][_0x739c('0x112')](db[_0x739c('0xc3')],{'as':_0x739c('0x1b4'),'onDelete':_0x739c('0x110'),'foreignKey':_0x739c('0x1b8')});db[_0x739c('0xc2')][_0x739c('0x112')](db['FreshdeskField'],{'as':_0x739c('0x1bd'),'onDelete':_0x739c('0x110'),'foreignKey':_0x739c('0x1ba')});db[_0x739c('0xc2')][_0x739c('0x112')](db[_0x739c('0xc3')],{'as':_0x739c('0x1ad'),'onDelete':_0x739c('0x110'),'foreignKey':_0x739c('0x1b5')});db['FreshdeskConfiguration']['belongsTo'](db['FreshdeskAccount'],{'as':'Account','foreignKey':'AccountId'});db[_0x739c('0xc2')]['belongsToMany'](db['Tag'],{'through':_0x739c('0x1c1')});db[_0x739c('0xc3')]['hasMany'](db[_0x739c('0xc3')],{'as':_0x739c('0x1b7'),'foreignKey':_0x739c('0x1b8')});db[_0x739c('0xc3')][_0x739c('0x112')](db['FreshdeskField'],{'as':_0x739c('0x1b9'),'foreignKey':'DescriptionId'});db[_0x739c('0xc3')][_0x739c('0x112')](db[_0x739c('0xc3')],{'as':_0x739c('0x1bb'),'foreignKey':_0x739c('0x1b5')});db[_0x739c('0xc3')][_0x739c('0x11f')](db[_0x739c('0x96')],{'as':_0x739c('0x96'),'foreignKey':_0x739c('0x1bc')});db[_0x739c('0xc4')]['hasMany'](db[_0x739c('0xc6')],{'as':_0x739c('0x1b2'),'onDelete':'cascade','foreignKey':_0x739c('0x1b3')});db['VtigerConfiguration'][_0x739c('0x112')](db[_0x739c('0xc8')],{'as':_0x739c('0x1b4'),'foreignKey':_0x739c('0x1b8')});db[_0x739c('0xc6')][_0x739c('0x112')](db['VtigerField'],{'as':_0x739c('0x1bd'),'foreignKey':_0x739c('0x1ba')});db[_0x739c('0xc6')]['hasMany'](db[_0x739c('0xc8')],{'as':'Fields','foreignKey':'FieldId'});db[_0x739c('0xc6')]['belongsTo'](db[_0x739c('0xc4')],{'as':_0x739c('0x17a'),'foreignKey':_0x739c('0x1b3')});db[_0x739c('0xc8')][_0x739c('0x112')](db[_0x739c('0xc8')],{'as':'Subject','foreignKey':_0x739c('0x1b8')});db[_0x739c('0xc8')][_0x739c('0x112')](db['VtigerField'],{'as':_0x739c('0x1b9'),'foreignKey':_0x739c('0x1ba')});db[_0x739c('0xc8')][_0x739c('0x112')](db[_0x739c('0xc8')],{'as':_0x739c('0x1bb'),'foreignKey':_0x739c('0x1b5')});db['VtigerField'][_0x739c('0x11f')](db[_0x739c('0x96')],{'as':'Variable','foreignKey':_0x739c('0x1bc')});db[_0x739c('0xca')]['hasMany'](db[_0x739c('0xcb')],{'as':_0x739c('0x1b2'),'onDelete':_0x739c('0x110'),'foreignKey':_0x739c('0x1b3')});db['ServicenowConfiguration'][_0x739c('0x112')](db['ServicenowField'],{'as':_0x739c('0x1b4'),'foreignKey':_0x739c('0x1b8')});db[_0x739c('0xcb')]['hasMany'](db[_0x739c('0x1c2')],{'as':_0x739c('0x1bd'),'foreignKey':_0x739c('0x1ba')});db[_0x739c('0xcb')][_0x739c('0x112')](db['ServicenowField'],{'as':_0x739c('0x1ad'),'foreignKey':'FieldId'});db[_0x739c('0xcb')][_0x739c('0x11f')](db['ServicenowAccount'],{'as':_0x739c('0x17a'),'foreignKey':_0x739c('0x1b3')});db[_0x739c('0x1c2')]['hasMany'](db['ServicenowField'],{'as':'Subject','foreignKey':_0x739c('0x1b8')});db[_0x739c('0x1c2')]['hasMany'](db[_0x739c('0x1c2')],{'as':_0x739c('0x1b9'),'foreignKey':_0x739c('0x1ba')});db[_0x739c('0x1c2')]['hasMany'](db[_0x739c('0x1c2')],{'as':_0x739c('0x1bb'),'foreignKey':_0x739c('0x1b5')});db[_0x739c('0x1c2')][_0x739c('0x11f')](db[_0x739c('0x96')],{'as':'Variable','foreignKey':_0x739c('0x1bc')});db['Dynamics365Account'][_0x739c('0x112')](db['Dynamics365Configuration'],{'as':_0x739c('0x1b2'),'onDelete':_0x739c('0x110'),'foreignKey':_0x739c('0x1b3')});db[_0x739c('0x1c3')][_0x739c('0x112')](db['Dynamics365Field'],{'as':_0x739c('0x1b4'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0x739c('0x1c3')]['hasMany'](db['Dynamics365Field'],{'as':_0x739c('0x1bd'),'onDelete':_0x739c('0x110'),'foreignKey':_0x739c('0x1ba')});db['Dynamics365Configuration'][_0x739c('0x112')](db[_0x739c('0x1c4')],{'as':'Fields','onDelete':_0x739c('0x110'),'foreignKey':_0x739c('0x1b5')});db[_0x739c('0x1c3')]['belongsTo'](db[_0x739c('0xce')],{'as':'Account','foreignKey':'AccountId'});db[_0x739c('0x1c4')][_0x739c('0x112')](db[_0x739c('0x1c4')],{'as':'Subject','foreignKey':_0x739c('0x1b8')});db[_0x739c('0x1c4')][_0x739c('0x112')](db[_0x739c('0x1c4')],{'as':'Description','foreignKey':_0x739c('0x1ba')});db['Dynamics365Field']['hasMany'](db['Dynamics365Field'],{'as':_0x739c('0x1bb'),'foreignKey':_0x739c('0x1b5')});db[_0x739c('0x1c4')][_0x739c('0x11f')](db[_0x739c('0x96')],{'as':_0x739c('0x96'),'foreignKey':_0x739c('0x1bc')});db[_0x739c('0x1c5')][_0x739c('0x112')](db[_0x739c('0xd2')],{'as':_0x739c('0x1b2'),'onDelete':_0x739c('0x110'),'foreignKey':'AccountId'});db['FreshsalesConfiguration'][_0x739c('0x112')](db[_0x739c('0xd4')],{'as':'Subjects','foreignKey':_0x739c('0x1b8')});db['FreshsalesConfiguration'][_0x739c('0x112')](db[_0x739c('0xd4')],{'as':_0x739c('0x1bd'),'foreignKey':'DescriptionId'});db['FreshsalesConfiguration'][_0x739c('0x112')](db['FreshsalesField'],{'as':'Fields','foreignKey':_0x739c('0x1b5')});db[_0x739c('0xd2')][_0x739c('0x11f')](db[_0x739c('0x1c5')],{'as':_0x739c('0x17a'),'foreignKey':_0x739c('0x1b3')});db[_0x739c('0xd4')]['hasMany'](db[_0x739c('0xd4')],{'as':_0x739c('0x1b7'),'foreignKey':'SubjectId'});db[_0x739c('0xd4')][_0x739c('0x112')](db['FreshsalesField'],{'as':_0x739c('0x1b9'),'foreignKey':'DescriptionId'});db[_0x739c('0xd4')][_0x739c('0x112')](db[_0x739c('0xd4')],{'as':'Field','foreignKey':_0x739c('0x1b5')});db[_0x739c('0xd4')][_0x739c('0x11f')](db[_0x739c('0x96')],{'as':'Variable','foreignKey':'VariableId'});db[_0x739c('0xd7')][_0x739c('0x11f')](db[_0x739c('0x134')],{});db[_0x739c('0xd7')]['belongsTo'](db[_0x739c('0x131')],{'as':_0x739c('0x164'),'foreignKey':_0x739c('0x173')});db[_0x739c('0xd7')][_0x739c('0x11f')](db[_0x739c('0x70')],{'as':_0x739c('0x15d'),'foreignKey':_0x739c('0x15e')});db[_0x739c('0xd7')][_0x739c('0x11f')](db[_0x739c('0x64')],{});db[_0x739c('0xd7')][_0x739c('0x11f')](db[_0x739c('0x18b')],{});db[_0x739c('0xd7')][_0x739c('0x11f')](db[_0x739c('0x12')],{});db[_0x739c('0xd7')][_0x739c('0x11f')](db[_0x739c('0x68')],{});db[_0x739c('0xd9')][_0x739c('0x11f')](db['User'],{'onDelete':_0x739c('0x110'),'foreignKey':_0x739c('0x1c6')});db[_0x739c('0xd9')][_0x739c('0x11f')](db['User'],{'onDelete':_0x739c('0x110'),'foreignKey':_0x739c('0x1c7')});db['JscriptySessionReport'][_0x739c('0x112')](db[_0x739c('0x1c8')],{'foreignKey':_0x739c('0x1c9'),'onDelete':_0x739c('0x110')});db['JscriptySessionReport'][_0x739c('0x112')](db[_0x739c('0xdb')],{'foreignKey':_0x739c('0x1c9'),'onDelete':_0x739c('0x110')});db[_0x739c('0xdf')]['belongsTo'](db[_0x739c('0x13c')],{});db[_0x739c('0xdf')][_0x739c('0x11f')](db[_0x739c('0x131')],{'as':'List','foreignKey':_0x739c('0x173')});db[_0x739c('0xdf')][_0x739c('0x11f')](db[_0x739c('0x70')],{'as':_0x739c('0x15d'),'foreignKey':_0x739c('0x15e')});db[_0x739c('0xdf')][_0x739c('0x11f')](db['SmsInteraction'],{});db[_0x739c('0xdf')]['belongsTo'](db[_0x739c('0x54')],{});db['SmsQueueReport'][_0x739c('0x11f')](db[_0x739c('0x12')],{});db['SmsQueueReport'][_0x739c('0x11f')](db[_0x739c('0x56')],{});db['JscriptyProject'][_0x739c('0x112')](db['JscriptySessionReport'],{'foreignKey':_0x739c('0x1ca')});db[_0x739c('0xe3')][_0x739c('0x112')](db[_0x739c('0x1c8')],{'foreignKey':_0x739c('0x1ca')});db[_0x739c('0xe3')]['hasMany'](db[_0x739c('0xdb')],{'foreignKey':'ProjectId'});db['SquareProject']['belongsToMany'](db[_0x739c('0x12')],{'as':_0x739c('0x16c'),'through':_0x739c('0x1cb')});db[_0x739c('0x126')][_0x739c('0x121')](db['User'],{'as':_0x739c('0x151'),'through':_0x739c('0x1cc')});db[_0x739c('0x126')][_0x739c('0x121')](db[_0x739c('0x1a')],{'through':_0x739c('0x153'),'as':_0x739c('0x12c')});db['Team']['belongsToMany'](db[_0x739c('0x3f')],{'through':'team_has_mail_queues','as':_0x739c('0x1cd')});db[_0x739c('0x126')][_0x739c('0x121')](db[_0x739c('0x68')],{'through':_0x739c('0x191'),'as':_0x739c('0x12d')});db[_0x739c('0x126')][_0x739c('0x121')](db[_0x739c('0x50')],{'through':_0x739c('0x17d'),'as':_0x739c('0x12e')});db['Team'][_0x739c('0x121')](db['SmsQueue'],{'through':_0x739c('0x1ce'),'as':_0x739c('0x1cf')});db[_0x739c('0x126')][_0x739c('0x121')](db[_0x739c('0x5d')],{'through':'team_has_openchannel_queues','as':_0x739c('0x12f')});db[_0x739c('0x126')][_0x739c('0x121')](db['WhatsappQueue'],{'through':_0x739c('0x1d0'),'as':_0x739c('0x130')});db[_0x739c('0xec')][_0x739c('0x112')](db[_0x739c('0x72')],{'as':_0x739c('0x147'),'foreignKey':_0x739c('0x1d1')});db[_0x739c('0xec')][_0x739c('0x112')](db[_0x739c('0x76')],{'as':_0x739c('0x117'),'foreignKey':_0x739c('0x1d1')});db[_0x739c('0xec')][_0x739c('0x112')](db[_0x739c('0x78')],{'as':_0x739c('0x148'),'foreignKey':'CampaignId'});db[_0x739c('0xec')]['hasMany'](db[_0x739c('0x74')],{'as':_0x739c('0x149'),'foreignKey':_0x739c('0x1d1')});db[_0x739c('0xec')]['belongsTo'](db[_0x739c('0x14b')],{'as':_0x739c('0x14b'),'foreignKey':_0x739c('0x14c')});db[_0x739c('0xec')]['belongsTo'](db[_0x739c('0x14b')],{'as':_0x739c('0x1d2'),'foreignKey':_0x739c('0x14d')});db['Campaign']['belongsTo'](db[_0x739c('0x87')],{'as':_0x739c('0x87'),'foreignKey':_0x739c('0x14e')});db[_0x739c('0xec')]['belongsTo'](db[_0x739c('0x13e')],{'as':_0x739c('0x13e'),'foreignKey':_0x739c('0x1d3')});db[_0x739c('0xec')][_0x739c('0x121')](db[_0x739c('0x131')],{'as':_0x739c('0x14f'),'through':_0x739c('0x1d4')});db[_0x739c('0xec')]['belongsToMany'](db['CmList'],{'as':_0x739c('0x154'),'through':_0x739c('0x1d5')});db[_0x739c('0xf3')][_0x739c('0x11f')](db[_0x739c('0x162')],{});db[_0x739c('0xf3')]['belongsTo'](db[_0x739c('0x42')],{});db[_0x739c('0xf3')][_0x739c('0x11f')](db[_0x739c('0x137')],{'foreignKey':_0x739c('0x1d6'),'as':_0x739c('0x1d7')});db['MailTransferReport'][_0x739c('0x11f')](db['User'],{'foreignKey':_0x739c('0x1d8'),'as':_0x739c('0x1d9')});db[_0x739c('0xf3')][_0x739c('0x11f')](db[_0x739c('0x12')],{'foreignKey':_0x739c('0x1da'),'as':_0x739c('0x1db')});db[_0x739c('0xf3')][_0x739c('0x11f')](db[_0x739c('0x3f')],{'foreignKey':_0x739c('0x1dc'),'as':_0x739c('0x1dd')});db[_0x739c('0xf3')][_0x739c('0x11f')](db[_0x739c('0x137')],{'foreignKey':_0x739c('0x1de'),'as':_0x739c('0x1df')});db[_0x739c('0xf5')][_0x739c('0x11f')](db[_0x739c('0x18b')],{});db[_0x739c('0xf5')][_0x739c('0x11f')](db[_0x739c('0x64')],{});db[_0x739c('0xf5')][_0x739c('0x11f')](db['ChatWebsite'],{'foreignKey':_0x739c('0x1e0'),'as':_0x739c('0x1d7')});db[_0x739c('0xf5')]['belongsTo'](db[_0x739c('0x12')],{'foreignKey':_0x739c('0x1d8'),'as':_0x739c('0x1d9')});db[_0x739c('0xf5')][_0x739c('0x11f')](db[_0x739c('0x12')],{'foreignKey':_0x739c('0x1da'),'as':_0x739c('0x1db')});db[_0x739c('0xf5')][_0x739c('0x11f')](db[_0x739c('0x68')],{'foreignKey':_0x739c('0x1e1'),'as':_0x739c('0x1dd')});db[_0x739c('0xf5')][_0x739c('0x11f')](db['ChatWebsite'],{'foreignKey':_0x739c('0x1e2'),'as':_0x739c('0x1df')});db[_0x739c('0xf6')][_0x739c('0x11f')](db[_0x739c('0x178')],{});db[_0x739c('0xf6')][_0x739c('0x11f')](db[_0x739c('0x127')],{});db[_0x739c('0xf6')][_0x739c('0x11f')](db[_0x739c('0x4c')],{'foreignKey':_0x739c('0x1e3'),'as':'FromAccount'});db[_0x739c('0xf6')]['belongsTo'](db[_0x739c('0x12')],{'foreignKey':_0x739c('0x1d8'),'as':_0x739c('0x1d9')});db['FaxTransferReport'][_0x739c('0x11f')](db[_0x739c('0x12')],{'foreignKey':_0x739c('0x1da'),'as':_0x739c('0x1db')});db[_0x739c('0xf6')][_0x739c('0x11f')](db[_0x739c('0x50')],{'foreignKey':'ToFaxQueueId','as':_0x739c('0x1dd')});db['FaxTransferReport'][_0x739c('0x11f')](db[_0x739c('0x4c')],{'foreignKey':_0x739c('0x1e4'),'as':_0x739c('0x1df')});db[_0x739c('0x1e5')][_0x739c('0x11f')](db[_0x739c('0x5b')],{});db[_0x739c('0x1e5')]['belongsTo'](db[_0x739c('0x5a')],{});db['OpenchannelTransferReport']['belongsTo'](db['OpenchannelAccount'],{'foreignKey':_0x739c('0x1e6'),'as':_0x739c('0x1d7')});db[_0x739c('0x1e5')]['belongsTo'](db[_0x739c('0x12')],{'foreignKey':_0x739c('0x1d8'),'as':_0x739c('0x1d9')});db[_0x739c('0x1e5')][_0x739c('0x11f')](db[_0x739c('0x12')],{'foreignKey':_0x739c('0x1da'),'as':_0x739c('0x1db')});db[_0x739c('0x1e5')][_0x739c('0x11f')](db[_0x739c('0x5d')],{'foreignKey':_0x739c('0x1e7'),'as':_0x739c('0x1dd')});db[_0x739c('0x1e5')]['belongsTo'](db[_0x739c('0x13a')],{'foreignKey':_0x739c('0x1e8'),'as':_0x739c('0x1df')});db[_0x739c('0xf9')][_0x739c('0x11f')](db[_0x739c('0x54')],{});db['SmsTransferReport'][_0x739c('0x11f')](db['SmsInteraction'],{});db[_0x739c('0xf9')]['belongsTo'](db[_0x739c('0x13c')],{'foreignKey':_0x739c('0x1e9'),'as':'FromAccount'});db[_0x739c('0xf9')][_0x739c('0x11f')](db[_0x739c('0x12')],{'foreignKey':_0x739c('0x1d8'),'as':'FromAgent'});db[_0x739c('0xf9')][_0x739c('0x11f')](db[_0x739c('0x12')],{'foreignKey':_0x739c('0x1da'),'as':_0x739c('0x1db')});db[_0x739c('0xf9')][_0x739c('0x11f')](db[_0x739c('0x56')],{'foreignKey':_0x739c('0x1ea'),'as':'ToQueue'});db['SmsTransferReport'][_0x739c('0x11f')](db[_0x739c('0x13c')],{'foreignKey':_0x739c('0x1eb'),'as':_0x739c('0x1df')});db[_0x739c('0x131')]['hasMany'](db[_0x739c('0x84')],{'as':_0x739c('0x175'),'foreignKey':_0x739c('0x173')});db['CmList'][_0x739c('0x112')](db[_0x739c('0x7c')],{'as':_0x739c('0x1ec'),'foreignKey':_0x739c('0x173')});db[_0x739c('0x131')]['hasMany'](db[_0x739c('0x70')],{'as':_0x739c('0x123'),'onDelete':'cascade','foreignKey':_0x739c('0x173')});db[_0x739c('0x131')][_0x739c('0x112')](db[_0x739c('0x76')],{'as':_0x739c('0x117'),'foreignKey':_0x739c('0x173')});db['CmList'][_0x739c('0x112')](db[_0x739c('0x78')],{'as':_0x739c('0x118'),'foreignKey':_0x739c('0x173')});db[_0x739c('0x131')][_0x739c('0x112')](db[_0x739c('0x7a')],{'as':'ReportAgentPreview','foreignKey':_0x739c('0x173')});db[_0x739c('0x131')]['belongsToMany'](db['VoiceQueue'],{'as':_0x739c('0x1ed'),'through':'voice_queues_has_cm_lists'});db[_0x739c('0x131')][_0x739c('0x121')](db[_0x739c('0x12')],{'as':_0x739c('0x151'),'through':_0x739c('0x125')});db[_0x739c('0x132')][_0x739c('0x112')](db[_0x739c('0x115')],{'as':_0x739c('0x116'),'onDelete':_0x739c('0x110')});db[_0x739c('0x132')]['belongsToMany'](db[_0x739c('0x12')],{'as':_0x739c('0x151'),'through':_0x739c('0x1ee')});db[_0x739c('0xfc')][_0x739c('0x112')](db[_0x739c('0x12')],{'as':_0x739c('0x16c'),'foreignKey':_0x739c('0x120')});db[_0x739c('0xfc')][_0x739c('0x112')](db['UserProfileSection'],{'as':'UserProfileSections','foreignKey':_0x739c('0x120'),'onDelete':'cascade'});db[_0x739c('0x1ef')][_0x739c('0x112')](db[_0x739c('0xff')],{'as':_0x739c('0x1f0'),'foreignKey':_0x739c('0x1f1'),'onDelete':_0x739c('0x110')});db[_0x739c('0x101')][_0x739c('0x112')](db[_0x739c('0x84')],{'as':_0x739c('0x175'),'foreignKey':_0x739c('0x1f2')});db['WhatsappAccount'][_0x739c('0x112')](db[_0x739c('0x82')],{'as':_0x739c('0x161'),'foreignKey':'WhatsappAccountId'});db[_0x739c('0x101')][_0x739c('0x112')](db['WhatsappMessage'],{'as':_0x739c('0x157'),'foreignKey':_0x739c('0x1f2')});db[_0x739c('0x101')]['hasMany'](db[_0x739c('0x104')],{'as':_0x739c('0x163')});db[_0x739c('0x101')][_0x739c('0x112')](db['WhatsappApplication'],{'as':_0x739c('0x142')});db['WhatsappAccount'][_0x739c('0x11f')](db['CmList'],{'as':_0x739c('0x164'),'foreignKey':_0x739c('0x173')});db[_0x739c('0x101')][_0x739c('0x11f')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x739c('0x167')});db[_0x739c('0x101')][_0x739c('0x121')](db[_0x739c('0x12')],{'as':_0x739c('0x151'),'through':_0x739c('0x1f3')});db[_0x739c('0x102')][_0x739c('0x11f')](db[_0x739c('0x12')],{'onDelete':_0x739c('0x171')});db[_0x739c('0x102')]['belongsTo'](db['WhatsappQueue'],{'onDelete':_0x739c('0x171')});db[_0x739c('0x102')][_0x739c('0x11f')](db['WhatsappAccount'],{'onDelete':_0x739c('0x171')});db[_0x739c('0x102')][_0x739c('0x11f')](db['Interval'],{'onDelete':_0x739c('0x171'),'foreignKey':_0x739c('0x14e')});db[_0x739c('0x102')][_0x739c('0x11f')](db['Tag'],{'onDelete':_0x739c('0x171'),'foreignKey':_0x739c('0x172')});db[_0x739c('0x104')][_0x739c('0x112')](db[_0x739c('0x106')],{'as':_0x739c('0x157'),'onDelete':_0x739c('0x110'),'foreignKey':_0x739c('0x1f4')});db[_0x739c('0x104')][_0x739c('0x11f')](db[_0x739c('0x101')],{'as':_0x739c('0x17a'),'foreignKey':'WhatsappAccountId'});db['WhatsappInteraction'][_0x739c('0x11f')](db[_0x739c('0x70')],{'as':'Contact','foreignKey':_0x739c('0x15e')});db[_0x739c('0x104')][_0x739c('0x11f')](db[_0x739c('0x12')],{'as':_0x739c('0x169'),'foreignKey':_0x739c('0x111')});db[_0x739c('0x104')][_0x739c('0x121')](db[_0x739c('0x91')],{'through':_0x739c('0x1a8'),'as':_0x739c('0x17c')});db[_0x739c('0x104')][_0x739c('0x121')](db['Tag'],{'through':_0x739c('0x1a8'),'as':_0x739c('0x16b')});db[_0x739c('0x104')][_0x739c('0x121')](db[_0x739c('0x12')],{'as':_0x739c('0x16c'),'through':_0x739c('0x12b'),'foreignKey':_0x739c('0x1f4')});db[_0x739c('0x106')]['belongsTo'](db[_0x739c('0x12')],{'as':_0x739c('0x12')});db[_0x739c('0x106')]['belongsTo'](db[_0x739c('0x70')],{'onDelete':_0x739c('0x110'),'as':'Contact'});db['WhatsappMessage']['belongsTo'](db[_0x739c('0x104')],{'onDelete':_0x739c('0x110'),'as':'Interaction','foreignKey':_0x739c('0x1f4')});db[_0x739c('0x106')][_0x739c('0x11f')](db[_0x739c('0x101')],{'as':_0x739c('0x17a'),'foreignKey':_0x739c('0x1f2')});db[_0x739c('0x108')][_0x739c('0x11f')](db[_0x739c('0x101')],{});db['WhatsappQueueReport'][_0x739c('0x11f')](db['CmList'],{'as':_0x739c('0x164'),'foreignKey':_0x739c('0x173')});db[_0x739c('0x108')][_0x739c('0x11f')](db[_0x739c('0x70')],{'as':_0x739c('0x15d'),'foreignKey':_0x739c('0x15e')});db['WhatsappQueueReport'][_0x739c('0x11f')](db[_0x739c('0x104')],{});db[_0x739c('0x108')][_0x739c('0x11f')](db[_0x739c('0x10c')],{});db[_0x739c('0x108')][_0x739c('0x11f')](db[_0x739c('0x106')],{});db[_0x739c('0x108')]['belongsTo'](db[_0x739c('0x12')],{});db['WhatsappTransferReport'][_0x739c('0x11f')](db[_0x739c('0x106')],{});db[_0x739c('0x10a')][_0x739c('0x11f')](db[_0x739c('0x104')],{});db['WhatsappTransferReport'][_0x739c('0x11f')](db[_0x739c('0x101')],{'foreignKey':_0x739c('0x1f5'),'as':'FromAccount'});db[_0x739c('0x10a')][_0x739c('0x11f')](db[_0x739c('0x101')],{'foreignKey':'ToWhatsappAccountId','as':_0x739c('0x1df')});db[_0x739c('0x10a')][_0x739c('0x11f')](db[_0x739c('0x10c')],{'foreignKey':_0x739c('0x1f6'),'as':_0x739c('0x1dd')});db['WhatsappTransferReport'][_0x739c('0x11f')](db[_0x739c('0x12')],{'foreignKey':_0x739c('0x1d8'),'as':_0x739c('0x1d9')});db['WhatsappTransferReport']['belongsTo'](db[_0x739c('0x12')],{'foreignKey':'ToUserId','as':_0x739c('0x1db')});db[_0x739c('0x10c')][_0x739c('0x121')](db[_0x739c('0x12')],{'as':_0x739c('0x151'),'through':_0x739c('0x39'),'foreignKey':_0x739c('0x1f7')});db[_0x739c('0x10c')]['belongsToMany'](db[_0x739c('0x126')],{'through':_0x739c('0x1d0'),'as':_0x739c('0x152')});module[_0x739c('0x1f8')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 001a7a9..cf02c04 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1a84=['/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/fields','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','./api/setting','/api/square/projects','./api/squareProject','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','./api/team','/api/license','./api/license','/api/campaigns','./api/campaign','/api/migrations','/api/attachments','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','/api/fax/reports/transfer','./api/faxTransferReport','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/notifications','./api/notification','/api/whatsapp/accounts','./api/whatsappAccount','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/jira','./api/jira','/api/rpc','/api/version','./api/version','./api/system','./api/pm2','/api/webbar','./api/webbar','/apidoc','join','root','/www','static','/demo','/snippet','snippet','/plugins','/server/files/plugins','route','get','resolve','/index.html','path','util','./errors','./config/environment','./config/logger','auth','default','use','logger','format','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','method','headers','x-forwarded-for','connection','url','statusCode','responseTime','user','name','device','body','agent_id','remoteAddress','role','other','agent_name','test','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceMusicOnHold','/api/voice/queues','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/agents/reports','./api/voiceAgentReport','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','/api/dashboards/items','./api/dashboardItem','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','/api/sms/accounts','/api/sms/applications','./api/smsApplication','./api/smsInteraction','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','/api/chat/interactions','./api/chatInteraction','./api/chatMessage','./api/chatOfflineMessage','/api/chat/queues','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','/api/actions','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','./api/condition','./api/interval','/api/pauses','./api/pause','/api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','./api/sound','/api/tags','/api/templates','./api/template','/api/triggers','./api/trigger','/api/variables','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','./api/analyticDefaultReport','/api/analytics/extracted_reports','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','/api/integrations/desk/configurations','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','./api/intZendeskAccount','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','/api/integrations/freshdesk/fields'];(function(_0xd3aebe,_0x4c0a60){var _0x279df7=function(_0x412968){while(--_0x412968){_0xd3aebe['push'](_0xd3aebe['shift']());}};_0x279df7(++_0x4c0a60);}(_0x1a84,0x69));var _0x41a8=function(_0xc1c93f,_0x1fba71){_0xc1c93f=_0xc1c93f-0x0;var _0x3f81cb=_0x1a84[_0xc1c93f];return _0x3f81cb;};'use strict';var path=require(_0x41a8('0x0'));var express=require('express');var ewinston=require('express-winston');var util=require(_0x41a8('0x1'));var errors=require(_0x41a8('0x2'));var config=require(_0x41a8('0x3'));var logger=require(_0x41a8('0x4'))('api');var authLogger=require('./config/logger')(_0x41a8('0x5'));exports[_0x41a8('0x6')]=function(_0x30deae){_0x30deae[_0x41a8('0x7')](ewinston[_0x41a8('0x8')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x239908,_0x5ac35a){return util[_0x41a8('0x9')](_0x41a8('0xa'),_0x239908[_0x41a8('0xb')],_0x239908[_0x41a8('0xc')][_0x41a8('0xd')]?_0x239908[_0x41a8('0xc')][_0x41a8('0xd')]:_0x239908[_0x41a8('0xe')]['remoteAddress']||_0x239908['ip'],_0x239908[_0x41a8('0xf')],_0x5ac35a[_0x41a8('0x10')],_0x5ac35a[_0x41a8('0x11')],_0x239908[_0x41a8('0x12')]?_0x239908[_0x41a8('0x12')]['id']:null,_0x239908['user']?_0x239908['user'][_0x41a8('0x13')]:null,_0x239908[_0x41a8('0x12')]?_0x239908[_0x41a8('0x12')]['role']:null);}}));_0x30deae[_0x41a8('0x7')](ewinston[_0x41a8('0x8')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x2fb576,_0x15d49a){var _0x49e4bc='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s';if(_0x2fb576['body']&&_0x2fb576['body'][_0x41a8('0x14')]&&_0x2fb576[_0x41a8('0x15')][_0x41a8('0x16')]){_0x49e4bc='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)';}return util[_0x41a8('0x9')](_0x49e4bc,_0x2fb576[_0x41a8('0xb')],_0x2fb576[_0x41a8('0xc')][_0x41a8('0xd')]?_0x2fb576['headers'][_0x41a8('0xd')]:_0x2fb576[_0x41a8('0xe')][_0x41a8('0x17')]||_0x2fb576['ip'],_0x2fb576[_0x41a8('0xf')],_0x15d49a['statusCode'],_0x15d49a[_0x41a8('0x11')],_0x2fb576[_0x41a8('0x12')]?_0x2fb576['user']['id']:null,_0x2fb576[_0x41a8('0x12')]?_0x2fb576['user'][_0x41a8('0x13')]:null,_0x2fb576[_0x41a8('0x12')]?_0x2fb576[_0x41a8('0x12')][_0x41a8('0x18')]:null,_0x2fb576['body']&&_0x2fb576[_0x41a8('0x15')]['device']?_0x2fb576['body'][_0x41a8('0x14')]:_0x41a8('0x19'),_0x2fb576[_0x41a8('0x15')]&&_0x2fb576[_0x41a8('0x15')][_0x41a8('0x16')]?_0x2fb576[_0x41a8('0x15')][_0x41a8('0x16')]:'',_0x2fb576[_0x41a8('0x15')]&&_0x2fb576[_0x41a8('0x15')][_0x41a8('0x1a')]?_0x2fb576[_0x41a8('0x15')]['agent_name']:'');},'ignoreRoute':function(_0x437bcd){var _0x5f33a6=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x5f33a6[_0x41a8('0x1b')](_0x437bcd['url']);}}));_0x30deae[_0x41a8('0x7')](_0x41a8('0x1c'),require(_0x41a8('0x1d')));_0x30deae[_0x41a8('0x7')](_0x41a8('0x1e'),require(_0x41a8('0x1f')));_0x30deae[_0x41a8('0x7')](_0x41a8('0x20'),require(_0x41a8('0x21')));_0x30deae[_0x41a8('0x7')](_0x41a8('0x22'),require('./api/voiceExtension'));_0x30deae[_0x41a8('0x7')]('/api/voice/mohs',require(_0x41a8('0x23')));_0x30deae[_0x41a8('0x7')](_0x41a8('0x24'),require('./api/voiceQueue'));_0x30deae['use'](_0x41a8('0x25'),require(_0x41a8('0x26')));_0x30deae[_0x41a8('0x7')](_0x41a8('0x27'),require('./api/screenRecording'));_0x30deae[_0x41a8('0x7')](_0x41a8('0x28'),require(_0x41a8('0x29')));_0x30deae[_0x41a8('0x7')](_0x41a8('0x2a'),require(_0x41a8('0x2b')));_0x30deae[_0x41a8('0x7')](_0x41a8('0x2c'),require(_0x41a8('0x2d')));_0x30deae[_0x41a8('0x7')]('/api/voice/dials/reports',require('./api/voiceDialReport'));_0x30deae[_0x41a8('0x7')](_0x41a8('0x2e'),require(_0x41a8('0x2f')));_0x30deae[_0x41a8('0x7')]('/api/voice/queues/reports',require(_0x41a8('0x30')));_0x30deae[_0x41a8('0x7')](_0x41a8('0x31'),require(_0x41a8('0x32')));_0x30deae[_0x41a8('0x7')](_0x41a8('0x33'),require(_0x41a8('0x34')));_0x30deae[_0x41a8('0x7')]('/api/voice/transfers/reports',require(_0x41a8('0x35')));_0x30deae[_0x41a8('0x7')](_0x41a8('0x36'),require(_0x41a8('0x37')));_0x30deae[_0x41a8('0x7')]('/api/mail/accounts',require('./api/mailAccount'));_0x30deae[_0x41a8('0x7')](_0x41a8('0x38'),require(_0x41a8('0x39')));_0x30deae[_0x41a8('0x7')](_0x41a8('0x3a'),require(_0x41a8('0x3b')));_0x30deae[_0x41a8('0x7')]('/api/mail/interactions',require(_0x41a8('0x3c')));_0x30deae['use'](_0x41a8('0x3d'),require(_0x41a8('0x3e')));_0x30deae[_0x41a8('0x7')](_0x41a8('0x3f'),require(_0x41a8('0x40')));_0x30deae[_0x41a8('0x7')](_0x41a8('0x41'),require(_0x41a8('0x42')));_0x30deae[_0x41a8('0x7')](_0x41a8('0x43'),require('./api/dashboard'));_0x30deae[_0x41a8('0x7')](_0x41a8('0x44'),require(_0x41a8('0x45')));_0x30deae[_0x41a8('0x7')]('/api/fax/accounts',require(_0x41a8('0x46')));_0x30deae[_0x41a8('0x7')](_0x41a8('0x47'),require(_0x41a8('0x48')));_0x30deae[_0x41a8('0x7')](_0x41a8('0x49'),require('./api/faxInteraction'));_0x30deae[_0x41a8('0x7')](_0x41a8('0x4a'),require(_0x41a8('0x4b')));_0x30deae[_0x41a8('0x7')](_0x41a8('0x4c'),require(_0x41a8('0x4d')));_0x30deae[_0x41a8('0x7')](_0x41a8('0x4e'),require('./api/faxQueueReport'));_0x30deae[_0x41a8('0x7')](_0x41a8('0x4f'),require('./api/smsAccount'));_0x30deae[_0x41a8('0x7')](_0x41a8('0x50'),require(_0x41a8('0x51')));_0x30deae[_0x41a8('0x7')]('/api/sms/interactions',require(_0x41a8('0x52')));_0x30deae[_0x41a8('0x7')]('/api/sms/messages',require('./api/smsMessage'));_0x30deae[_0x41a8('0x7')]('/api/sms/queues',require(_0x41a8('0x53')));_0x30deae[_0x41a8('0x7')](_0x41a8('0x54'),require(_0x41a8('0x55')));_0x30deae['use']('/api/openchannel/applications',require('./api/openchannelApplication'));_0x30deae['use'](_0x41a8('0x56'),require(_0x41a8('0x57')));_0x30deae['use'](_0x41a8('0x58'),require('./api/openchannelMessage'));_0x30deae[_0x41a8('0x7')](_0x41a8('0x59'),require(_0x41a8('0x5a')));_0x30deae[_0x41a8('0x7')](_0x41a8('0x5b'),require(_0x41a8('0x5c')));_0x30deae[_0x41a8('0x7')](_0x41a8('0x5d'),require(_0x41a8('0x5e')));_0x30deae['use'](_0x41a8('0x5f'),require('./api/chatApplication'));_0x30deae['use'](_0x41a8('0x60'),require(_0x41a8('0x61')));_0x30deae[_0x41a8('0x7')]('/api/chat/messages',require(_0x41a8('0x62')));_0x30deae[_0x41a8('0x7')]('/api/chat/offline_messages',require(_0x41a8('0x63')));_0x30deae['use'](_0x41a8('0x64'),require('./api/chatQueue'));_0x30deae[_0x41a8('0x7')]('/api/chat/groups',require(_0x41a8('0x65')));_0x30deae['use'](_0x41a8('0x66'),require(_0x41a8('0x67')));_0x30deae[_0x41a8('0x7')](_0x41a8('0x68'),require(_0x41a8('0x69')));_0x30deae[_0x41a8('0x7')](_0x41a8('0x6a'),require(_0x41a8('0x6b')));_0x30deae['use'](_0x41a8('0x6c'),require(_0x41a8('0x6d')));_0x30deae[_0x41a8('0x7')](_0x41a8('0x6e'),require(_0x41a8('0x6f')));_0x30deae[_0x41a8('0x7')](_0x41a8('0x70'),require('./api/cmHopperFinal'));_0x30deae[_0x41a8('0x7')](_0x41a8('0x71'),require(_0x41a8('0x72')));_0x30deae['use'](_0x41a8('0x73'),require('./api/cmCustomField'));_0x30deae[_0x41a8('0x7')](_0x41a8('0x74'),require('./api/action'));_0x30deae['use']('/api/automations',require(_0x41a8('0x75')));_0x30deae['use'](_0x41a8('0x76'),require(_0x41a8('0x77')));_0x30deae['use'](_0x41a8('0x78'),require(_0x41a8('0x79')));_0x30deae['use'](_0x41a8('0x7a'),require(_0x41a8('0x7b')));_0x30deae[_0x41a8('0x7')]('/api/intervals',require(_0x41a8('0x7c')));_0x30deae['use'](_0x41a8('0x7d'),require(_0x41a8('0x7e')));_0x30deae['use'](_0x41a8('0x7f'),require('./api/cdr'));_0x30deae[_0x41a8('0x7')](_0x41a8('0x80'),require(_0x41a8('0x81')));_0x30deae['use'](_0x41a8('0x82'),require(_0x41a8('0x83')));_0x30deae['use']('/api/sounds',require(_0x41a8('0x84')));_0x30deae['use'](_0x41a8('0x85'),require('./api/tag'));_0x30deae[_0x41a8('0x7')](_0x41a8('0x86'),require(_0x41a8('0x87')));_0x30deae[_0x41a8('0x7')](_0x41a8('0x88'),require(_0x41a8('0x89')));_0x30deae[_0x41a8('0x7')](_0x41a8('0x8a'),require(_0x41a8('0x8b')));_0x30deae['use'](_0x41a8('0x8c'),require(_0x41a8('0x8d')));_0x30deae[_0x41a8('0x7')](_0x41a8('0x8e'),require(_0x41a8('0x8f')));_0x30deae[_0x41a8('0x7')](_0x41a8('0x90'),require(_0x41a8('0x91')));_0x30deae[_0x41a8('0x7')]('/api/analytics/default_reports',require(_0x41a8('0x92')));_0x30deae[_0x41a8('0x7')](_0x41a8('0x93'),require('./api/analyticExtractedReport'));_0x30deae[_0x41a8('0x7')](_0x41a8('0x94'),require(_0x41a8('0x95')));_0x30deae['use'](_0x41a8('0x96'),require(_0x41a8('0x97')));_0x30deae[_0x41a8('0x7')](_0x41a8('0x98'),require(_0x41a8('0x99')));_0x30deae['use'](_0x41a8('0x9a'),require(_0x41a8('0x9b')));_0x30deae[_0x41a8('0x7')](_0x41a8('0x9c'),require(_0x41a8('0x9d')));_0x30deae[_0x41a8('0x7')](_0x41a8('0x9e'),require(_0x41a8('0x9f')));_0x30deae['use'](_0x41a8('0xa0'),require('./api/intSugarcrmAccount'));_0x30deae[_0x41a8('0x7')](_0x41a8('0xa1'),require(_0x41a8('0xa2')));_0x30deae[_0x41a8('0x7')](_0x41a8('0xa3'),require(_0x41a8('0xa4')));_0x30deae[_0x41a8('0x7')](_0x41a8('0xa5'),require('./api/intDeskAccount'));_0x30deae[_0x41a8('0x7')](_0x41a8('0xa6'),require('./api/intDeskConfiguration'));_0x30deae[_0x41a8('0x7')](_0x41a8('0xa7'),require(_0x41a8('0xa8')));_0x30deae['use'](_0x41a8('0xa9'),require(_0x41a8('0xaa')));_0x30deae['use'](_0x41a8('0xab'),require(_0x41a8('0xac')));_0x30deae[_0x41a8('0x7')](_0x41a8('0xad'),require(_0x41a8('0xae')));_0x30deae[_0x41a8('0x7')]('/api/integrations/zendesk/accounts',require(_0x41a8('0xaf')));_0x30deae['use']('/api/integrations/zendesk/configurations',require(_0x41a8('0xb0')));_0x30deae[_0x41a8('0x7')](_0x41a8('0xb1'),require('./api/intZendeskField'));_0x30deae['use'](_0x41a8('0xb2'),require(_0x41a8('0xb3')));_0x30deae[_0x41a8('0x7')](_0x41a8('0xb4'),require('./api/intFreshdeskConfiguration'));_0x30deae[_0x41a8('0x7')](_0x41a8('0xb5'),require('./api/intFreshdeskField'));_0x30deae[_0x41a8('0x7')](_0x41a8('0xb6'),require(_0x41a8('0xb7')));_0x30deae['use'](_0x41a8('0xb8'),require(_0x41a8('0xb9')));_0x30deae['use'](_0x41a8('0xba'),require(_0x41a8('0xbb')));_0x30deae[_0x41a8('0x7')](_0x41a8('0xbc'),require(_0x41a8('0xbd')));_0x30deae['use']('/api/integrations/servicenow/configurations',require('./api/intServicenowConfiguration'));_0x30deae[_0x41a8('0x7')](_0x41a8('0xbe'),require('./api/intServicenowField'));_0x30deae[_0x41a8('0x7')](_0x41a8('0xbf'),require(_0x41a8('0xc0')));_0x30deae[_0x41a8('0x7')](_0x41a8('0xc1'),require(_0x41a8('0xc2')));_0x30deae[_0x41a8('0x7')](_0x41a8('0xc3'),require(_0x41a8('0xc4')));_0x30deae[_0x41a8('0x7')](_0x41a8('0xc5'),require(_0x41a8('0xc6')));_0x30deae[_0x41a8('0x7')]('/api/integrations/freshsales/configurations',require('./api/intFreshsalesConfiguration'));_0x30deae[_0x41a8('0x7')](_0x41a8('0xc7'),require(_0x41a8('0xc8')));_0x30deae[_0x41a8('0x7')](_0x41a8('0xc9'),require('./api/network'));_0x30deae[_0x41a8('0x7')]('/api/chat/reports/queue',require(_0x41a8('0xca')));_0x30deae['use'](_0x41a8('0xcb'),require(_0x41a8('0xcc')));_0x30deae[_0x41a8('0x7')](_0x41a8('0xcd'),require(_0x41a8('0xce')));_0x30deae[_0x41a8('0x7')](_0x41a8('0xcf'),require('./api/jscriptyQuestionReport'));_0x30deae[_0x41a8('0x7')](_0x41a8('0xd0'),require(_0x41a8('0xd1')));_0x30deae[_0x41a8('0x7')](_0x41a8('0xd2'),require(_0x41a8('0xd3')));_0x30deae[_0x41a8('0x7')]('/api/square/reports',require(_0x41a8('0xd4')));_0x30deae[_0x41a8('0x7')](_0x41a8('0xd5'),require(_0x41a8('0xd6')));_0x30deae[_0x41a8('0x7')]('/api/jscripty/projects',require('./api/jscriptyProject'));_0x30deae[_0x41a8('0x7')]('/api/settings',require(_0x41a8('0xd7')));_0x30deae[_0x41a8('0x7')]('/api/square/odbc',require('./api/squareOdbc'));_0x30deae['use'](_0x41a8('0xd8'),require(_0x41a8('0xd9')));_0x30deae[_0x41a8('0x7')]('/api/square/recordings',require(_0x41a8('0xda')));_0x30deae[_0x41a8('0x7')](_0x41a8('0xdb'),require(_0x41a8('0xdc')));_0x30deae['use'](_0x41a8('0xdd'),require(_0x41a8('0xde')));_0x30deae[_0x41a8('0x7')](_0x41a8('0xdf'),require(_0x41a8('0xe0')));_0x30deae['use'](_0x41a8('0xe1'),require(_0x41a8('0xe2')));_0x30deae[_0x41a8('0x7')](_0x41a8('0xe3'),require('./api/migration'));_0x30deae[_0x41a8('0x7')](_0x41a8('0xe4'),require('./api/attachment'));_0x30deae[_0x41a8('0x7')](_0x41a8('0xe5'),require(_0x41a8('0xe6')));_0x30deae[_0x41a8('0x7')](_0x41a8('0xe7'),require(_0x41a8('0xe8')));_0x30deae['use'](_0x41a8('0xe9'),require('./api/chatTransferReport'));_0x30deae[_0x41a8('0x7')](_0x41a8('0xea'),require(_0x41a8('0xeb')));_0x30deae[_0x41a8('0x7')]('/api/openchannel/reports/transfer',require(_0x41a8('0xec')));_0x30deae[_0x41a8('0x7')](_0x41a8('0xed'),require(_0x41a8('0xee')));_0x30deae['use'](_0x41a8('0xef'),require(_0x41a8('0xf0')));_0x30deae['use'](_0x41a8('0xf1'),require(_0x41a8('0xf2')));_0x30deae[_0x41a8('0x7')](_0x41a8('0xf3'),require(_0x41a8('0xf4')));_0x30deae[_0x41a8('0x7')](_0x41a8('0xf5'),require(_0x41a8('0xf6')));_0x30deae[_0x41a8('0x7')](_0x41a8('0xf7'),require(_0x41a8('0xf8')));_0x30deae['use'](_0x41a8('0xf9'),require(_0x41a8('0xfa')));_0x30deae[_0x41a8('0x7')](_0x41a8('0xfb'),require(_0x41a8('0xfc')));_0x30deae['use']('/api/whatsapp/applications',require(_0x41a8('0xfd')));_0x30deae[_0x41a8('0x7')](_0x41a8('0xfe'),require('./api/whatsappInteraction'));_0x30deae['use']('/api/whatsapp/messages',require(_0x41a8('0xff')));_0x30deae[_0x41a8('0x7')](_0x41a8('0x100'),require(_0x41a8('0x101')));_0x30deae[_0x41a8('0x7')](_0x41a8('0x102'),require(_0x41a8('0x103')));_0x30deae['use'](_0x41a8('0x104'),require(_0x41a8('0x105')));_0x30deae[_0x41a8('0x7')](_0x41a8('0x106'),require(_0x41a8('0x107')));_0x30deae[_0x41a8('0x7')]('/api/auth/local',require('./api/authLocal'));_0x30deae['use']('/api/auth/google',require('./api/authGoogle'));_0x30deae[_0x41a8('0x7')](_0x41a8('0x108'),require(_0x41a8('0x109')));_0x30deae[_0x41a8('0x7')](_0x41a8('0x10a'),require('./api/rpc'));_0x30deae[_0x41a8('0x7')](_0x41a8('0x10b'),require(_0x41a8('0x10c')));_0x30deae[_0x41a8('0x7')]('/api/system',require(_0x41a8('0x10d')));_0x30deae[_0x41a8('0x7')]('/api/pm2',require(_0x41a8('0x10e')));_0x30deae[_0x41a8('0x7')](_0x41a8('0x10f'),require(_0x41a8('0x110')));_0x30deae['use'](_0x41a8('0x111'),express['static'](path[_0x41a8('0x112')](config[_0x41a8('0x113')],_0x41a8('0x111'))));_0x30deae[_0x41a8('0x7')](_0x41a8('0x114'),express[_0x41a8('0x115')](path[_0x41a8('0x112')](config[_0x41a8('0x113')],'/www')));_0x30deae[_0x41a8('0x7')]('/demo',express['static'](path[_0x41a8('0x112')](config[_0x41a8('0x113')],_0x41a8('0x116'))));_0x30deae[_0x41a8('0x7')](_0x41a8('0x117'),express['static'](path[_0x41a8('0x112')](config[_0x41a8('0x113')],_0x41a8('0x118'),'1.0.16')));_0x30deae[_0x41a8('0x7')](_0x41a8('0x119'),express['static'](path[_0x41a8('0x112')](config[_0x41a8('0x113')],_0x41a8('0x11a'))));_0x30deae[_0x41a8('0x11b')]('/:url(api|auth|components|app|bower_components|assets)/*')[_0x41a8('0x11c')](errors[0x194]);_0x30deae['route']('/*')[_0x41a8('0x11c')](function(_0x522e58,_0x7fcde4){_0x7fcde4['sendFile'](path[_0x41a8('0x11d')](_0x30deae['get']('appPath')+_0x41a8('0x11e')));});}; \ No newline at end of file +var _0xcacc=['./api/cmHopper','./api/cmHopperBlack','./api/cmHopperFinal','/api/cm/hopper_history','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','/api/automations','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','./api/pause','/api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','./api/sound','/api/tags','/api/triggers','/api/variables','./api/variable','./api/integration','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','/api/analytics/extracted_reports','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/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/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','/api/integrations/zendesk/accounts','/api/integrations/zendesk/configurations','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','./api/intFreshsalesField','/api/networks','/api/chat/reports/queue','/api/chat/internal/messages','./api/chatInternalMessage','./api/jscriptyAnswerReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','/api/square/reports','./api/squareReport','/api/square/details/reports','/api/jscripty/projects','/api/settings','./api/squareOdbc','/api/square/projects','./api/squareProject','./api/squareRecording','/api/square/messages','/api/teams','./api/team','./api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','/api/attachments','./api/attachment','./api/plugin','./api/chatTransferReport','./api/faxTransferReport','/api/openchannel/reports/transfer','/api/sms/reports/transfer','./api/smsTransferReport','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','./api/notification','/api/whatsapp/applications','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/auth/local','./api/authLocal','./api/authGoogle','/api/jira','./api/jira','./api/rpc','/api/version','./api/version','/api/system','./api/system','./api/webbar','static','join','root','/apidoc','/www','/demo','/snippet','snippet','1.0.16','/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','appPath','/index.html','path','express','express-winston','util','./config/logger','default','use','logger','format','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','method','x-forwarded-for','headers','connection','remoteAddress','responseTime','user','name','role','body','device','agent_id','url','statusCode','agent_name','test','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','./api/voiceMailMessage','/api/voice/calls/reports','/api/voice/dials/reports','./api/voiceDialReport','/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/mail/out_servers','/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/mail/reports/queue','./api/mailQueueReport','./api/dashboard','/api/dashboards/items','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','/api/openchannel/reports/queue','/api/chat/applications','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper'];(function(_0x978dbd,_0x643a9){var _0x4c8015=function(_0x5b692d){while(--_0x5b692d){_0x978dbd['push'](_0x978dbd['shift']());}};_0x4c8015(++_0x643a9);}(_0xcacc,0x1be));var _0xccac=function(_0xca1a98,_0x22df4e){_0xca1a98=_0xca1a98-0x0;var _0x33f587=_0xcacc[_0xca1a98];return _0x33f587;};'use strict';var path=require(_0xccac('0x0'));var express=require(_0xccac('0x1'));var ewinston=require(_0xccac('0x2'));var util=require(_0xccac('0x3'));var errors=require('./errors');var config=require('./config/environment');var logger=require('./config/logger')('api');var authLogger=require(_0xccac('0x4'))('auth');exports[_0xccac('0x5')]=function(_0x5c1740){_0x5c1740[_0xccac('0x6')](ewinston[_0xccac('0x7')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x583c99,_0x1f0ff2){return util[_0xccac('0x8')](_0xccac('0x9'),_0x583c99[_0xccac('0xa')],_0x583c99['headers'][_0xccac('0xb')]?_0x583c99[_0xccac('0xc')][_0xccac('0xb')]:_0x583c99[_0xccac('0xd')][_0xccac('0xe')]||_0x583c99['ip'],_0x583c99['url'],_0x1f0ff2['statusCode'],_0x1f0ff2[_0xccac('0xf')],_0x583c99[_0xccac('0x10')]?_0x583c99['user']['id']:null,_0x583c99['user']?_0x583c99[_0xccac('0x10')][_0xccac('0x11')]:null,_0x583c99[_0xccac('0x10')]?_0x583c99[_0xccac('0x10')][_0xccac('0x12')]:null);}}));_0x5c1740[_0xccac('0x6')](ewinston['logger']({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x3b59d2,_0x144877){var _0x2641ab='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s';if(_0x3b59d2[_0xccac('0x13')]&&_0x3b59d2[_0xccac('0x13')][_0xccac('0x14')]&&_0x3b59d2[_0xccac('0x13')][_0xccac('0x15')]){_0x2641ab='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)';}return util['format'](_0x2641ab,_0x3b59d2[_0xccac('0xa')],_0x3b59d2['headers'][_0xccac('0xb')]?_0x3b59d2[_0xccac('0xc')][_0xccac('0xb')]:_0x3b59d2['connection']['remoteAddress']||_0x3b59d2['ip'],_0x3b59d2[_0xccac('0x16')],_0x144877[_0xccac('0x17')],_0x144877[_0xccac('0xf')],_0x3b59d2[_0xccac('0x10')]?_0x3b59d2[_0xccac('0x10')]['id']:null,_0x3b59d2[_0xccac('0x10')]?_0x3b59d2[_0xccac('0x10')]['name']:null,_0x3b59d2[_0xccac('0x10')]?_0x3b59d2[_0xccac('0x10')][_0xccac('0x12')]:null,_0x3b59d2[_0xccac('0x13')]&&_0x3b59d2[_0xccac('0x13')]['device']?_0x3b59d2['body'][_0xccac('0x14')]:'other',_0x3b59d2[_0xccac('0x13')]&&_0x3b59d2[_0xccac('0x13')][_0xccac('0x15')]?_0x3b59d2[_0xccac('0x13')]['agent_id']:'',_0x3b59d2[_0xccac('0x13')]&&_0x3b59d2['body'][_0xccac('0x18')]?_0x3b59d2[_0xccac('0x13')][_0xccac('0x18')]:'');},'ignoreRoute':function(_0x24f3c6){var _0x5a3fe5=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x5a3fe5[_0xccac('0x19')](_0x24f3c6[_0xccac('0x16')]);}}));_0x5c1740[_0xccac('0x6')](_0xccac('0x1a'),require(_0xccac('0x1b')));_0x5c1740[_0xccac('0x6')](_0xccac('0x1c'),require(_0xccac('0x1d')));_0x5c1740[_0xccac('0x6')]('/api/voice/contexts',require(_0xccac('0x1e')));_0x5c1740[_0xccac('0x6')](_0xccac('0x1f'),require(_0xccac('0x20')));_0x5c1740[_0xccac('0x6')](_0xccac('0x21'),require(_0xccac('0x22')));_0x5c1740[_0xccac('0x6')](_0xccac('0x23'),require(_0xccac('0x24')));_0x5c1740[_0xccac('0x6')](_0xccac('0x25'),require(_0xccac('0x26')));_0x5c1740[_0xccac('0x6')](_0xccac('0x27'),require(_0xccac('0x28')));_0x5c1740[_0xccac('0x6')]('/api/voice/mails',require('./api/voiceMail'));_0x5c1740[_0xccac('0x6')]('/api/voice/mails/messages',require(_0xccac('0x29')));_0x5c1740[_0xccac('0x6')](_0xccac('0x2a'),require('./api/voiceCallReport'));_0x5c1740['use'](_0xccac('0x2b'),require(_0xccac('0x2c')));_0x5c1740[_0xccac('0x6')](_0xccac('0x2d'),require(_0xccac('0x2e')));_0x5c1740[_0xccac('0x6')](_0xccac('0x2f'),require(_0xccac('0x30')));_0x5c1740['use'](_0xccac('0x31'),require(_0xccac('0x32')));_0x5c1740['use'](_0xccac('0x33'),require(_0xccac('0x34')));_0x5c1740['use'](_0xccac('0x35'),require(_0xccac('0x36')));_0x5c1740[_0xccac('0x6')](_0xccac('0x37'),require('./api/mailServerOut'));_0x5c1740['use'](_0xccac('0x38'),require(_0xccac('0x39')));_0x5c1740[_0xccac('0x6')](_0xccac('0x3a'),require(_0xccac('0x3b')));_0x5c1740['use'](_0xccac('0x3c'),require(_0xccac('0x3d')));_0x5c1740[_0xccac('0x6')](_0xccac('0x3e'),require(_0xccac('0x3f')));_0x5c1740[_0xccac('0x6')](_0xccac('0x40'),require('./api/mailMessage'));_0x5c1740[_0xccac('0x6')](_0xccac('0x41'),require('./api/mailApplication'));_0x5c1740['use'](_0xccac('0x42'),require(_0xccac('0x43')));_0x5c1740['use']('/api/dashboards',require(_0xccac('0x44')));_0x5c1740[_0xccac('0x6')](_0xccac('0x45'),require('./api/dashboardItem'));_0x5c1740[_0xccac('0x6')]('/api/fax/accounts',require(_0xccac('0x46')));_0x5c1740['use'](_0xccac('0x47'),require(_0xccac('0x48')));_0x5c1740[_0xccac('0x6')](_0xccac('0x49'),require('./api/faxInteraction'));_0x5c1740[_0xccac('0x6')](_0xccac('0x4a'),require(_0xccac('0x4b')));_0x5c1740['use'](_0xccac('0x4c'),require(_0xccac('0x4d')));_0x5c1740[_0xccac('0x6')]('/api/fax/reports/queue',require(_0xccac('0x4e')));_0x5c1740['use'](_0xccac('0x4f'),require(_0xccac('0x50')));_0x5c1740[_0xccac('0x6')](_0xccac('0x51'),require(_0xccac('0x52')));_0x5c1740['use'](_0xccac('0x53'),require('./api/smsInteraction'));_0x5c1740[_0xccac('0x6')](_0xccac('0x54'),require(_0xccac('0x55')));_0x5c1740[_0xccac('0x6')](_0xccac('0x56'),require(_0xccac('0x57')));_0x5c1740['use'](_0xccac('0x58'),require(_0xccac('0x59')));_0x5c1740[_0xccac('0x6')](_0xccac('0x5a'),require(_0xccac('0x5b')));_0x5c1740[_0xccac('0x6')]('/api/openchannel/interactions',require(_0xccac('0x5c')));_0x5c1740[_0xccac('0x6')](_0xccac('0x5d'),require(_0xccac('0x5e')));_0x5c1740[_0xccac('0x6')](_0xccac('0x5f'),require(_0xccac('0x60')));_0x5c1740[_0xccac('0x6')](_0xccac('0x61'),require('./api/chatWebsite'));_0x5c1740[_0xccac('0x6')](_0xccac('0x62'),require('./api/openchannelQueueReport'));_0x5c1740['use'](_0xccac('0x63'),require('./api/chatApplication'));_0x5c1740[_0xccac('0x6')](_0xccac('0x64'),require(_0xccac('0x65')));_0x5c1740[_0xccac('0x6')](_0xccac('0x66'),require(_0xccac('0x67')));_0x5c1740[_0xccac('0x6')](_0xccac('0x68'),require(_0xccac('0x69')));_0x5c1740[_0xccac('0x6')](_0xccac('0x6a'),require(_0xccac('0x6b')));_0x5c1740[_0xccac('0x6')](_0xccac('0x6c'),require('./api/chatGroup'));_0x5c1740[_0xccac('0x6')](_0xccac('0x6d'),require(_0xccac('0x6e')));_0x5c1740[_0xccac('0x6')](_0xccac('0x6f'),require(_0xccac('0x70')));_0x5c1740[_0xccac('0x6')](_0xccac('0x71'),require(_0xccac('0x72')));_0x5c1740[_0xccac('0x6')](_0xccac('0x73'),require(_0xccac('0x74')));_0x5c1740[_0xccac('0x6')]('/api/cm/hopper_black',require(_0xccac('0x75')));_0x5c1740[_0xccac('0x6')]('/api/cm/hopper_final',require(_0xccac('0x76')));_0x5c1740['use'](_0xccac('0x77'),require('./api/cmHopperHistory'));_0x5c1740[_0xccac('0x6')](_0xccac('0x78'),require(_0xccac('0x79')));_0x5c1740['use'](_0xccac('0x7a'),require(_0xccac('0x7b')));_0x5c1740[_0xccac('0x6')](_0xccac('0x7c'),require('./api/automation'));_0x5c1740['use'](_0xccac('0x7d'),require(_0xccac('0x7e')));_0x5c1740[_0xccac('0x6')](_0xccac('0x7f'),require(_0xccac('0x80')));_0x5c1740[_0xccac('0x6')](_0xccac('0x81'),require('./api/condition'));_0x5c1740[_0xccac('0x6')]('/api/intervals',require('./api/interval'));_0x5c1740[_0xccac('0x6')]('/api/pauses',require(_0xccac('0x82')));_0x5c1740[_0xccac('0x6')](_0xccac('0x83'),require('./api/cdr'));_0x5c1740['use'](_0xccac('0x84'),require(_0xccac('0x85')));_0x5c1740[_0xccac('0x6')](_0xccac('0x86'),require(_0xccac('0x87')));_0x5c1740[_0xccac('0x6')]('/api/sounds',require(_0xccac('0x88')));_0x5c1740['use'](_0xccac('0x89'),require('./api/tag'));_0x5c1740[_0xccac('0x6')]('/api/templates',require('./api/template'));_0x5c1740[_0xccac('0x6')](_0xccac('0x8a'),require('./api/trigger'));_0x5c1740[_0xccac('0x6')](_0xccac('0x8b'),require(_0xccac('0x8c')));_0x5c1740[_0xccac('0x6')]('/api/integrations',require(_0xccac('0x8d')));_0x5c1740[_0xccac('0x6')]('/api/integrations/reports',require(_0xccac('0x8e')));_0x5c1740[_0xccac('0x6')](_0xccac('0x8f'),require(_0xccac('0x90')));_0x5c1740[_0xccac('0x6')](_0xccac('0x91'),require('./api/analyticDefaultReport'));_0x5c1740[_0xccac('0x6')](_0xccac('0x92'),require('./api/analyticExtractedReport'));_0x5c1740['use'](_0xccac('0x93'),require(_0xccac('0x94')));_0x5c1740[_0xccac('0x6')](_0xccac('0x95'),require(_0xccac('0x96')));_0x5c1740['use'](_0xccac('0x97'),require(_0xccac('0x98')));_0x5c1740[_0xccac('0x6')]('/api/integrations/salesforce/accounts',require(_0xccac('0x99')));_0x5c1740[_0xccac('0x6')](_0xccac('0x9a'),require(_0xccac('0x9b')));_0x5c1740[_0xccac('0x6')](_0xccac('0x9c'),require(_0xccac('0x9d')));_0x5c1740[_0xccac('0x6')](_0xccac('0x9e'),require(_0xccac('0x9f')));_0x5c1740[_0xccac('0x6')](_0xccac('0xa0'),require(_0xccac('0xa1')));_0x5c1740[_0xccac('0x6')](_0xccac('0xa2'),require(_0xccac('0xa3')));_0x5c1740['use'](_0xccac('0xa4'),require(_0xccac('0xa5')));_0x5c1740[_0xccac('0x6')](_0xccac('0xa6'),require(_0xccac('0xa7')));_0x5c1740['use'](_0xccac('0xa8'),require('./api/intDeskField'));_0x5c1740[_0xccac('0x6')](_0xccac('0xa9'),require('./api/intZohoAccount'));_0x5c1740['use'](_0xccac('0xaa'),require(_0xccac('0xab')));_0x5c1740[_0xccac('0x6')](_0xccac('0xac'),require('./api/intZohoField'));_0x5c1740[_0xccac('0x6')](_0xccac('0xad'),require('./api/intZendeskAccount'));_0x5c1740['use'](_0xccac('0xae'),require('./api/intZendeskConfiguration'));_0x5c1740[_0xccac('0x6')](_0xccac('0xaf'),require(_0xccac('0xb0')));_0x5c1740[_0xccac('0x6')](_0xccac('0xb1'),require(_0xccac('0xb2')));_0x5c1740[_0xccac('0x6')](_0xccac('0xb3'),require(_0xccac('0xb4')));_0x5c1740[_0xccac('0x6')](_0xccac('0xb5'),require(_0xccac('0xb6')));_0x5c1740[_0xccac('0x6')](_0xccac('0xb7'),require('./api/intVtigerAccount'));_0x5c1740[_0xccac('0x6')]('/api/integrations/vtiger/configurations',require(_0xccac('0xb8')));_0x5c1740[_0xccac('0x6')](_0xccac('0xb9'),require(_0xccac('0xba')));_0x5c1740[_0xccac('0x6')](_0xccac('0xbb'),require(_0xccac('0xbc')));_0x5c1740['use'](_0xccac('0xbd'),require('./api/intServicenowConfiguration'));_0x5c1740[_0xccac('0x6')](_0xccac('0xbe'),require(_0xccac('0xbf')));_0x5c1740['use'](_0xccac('0xc0'),require(_0xccac('0xc1')));_0x5c1740[_0xccac('0x6')](_0xccac('0xc2'),require(_0xccac('0xc3')));_0x5c1740[_0xccac('0x6')]('/api/integrations/dynamics365/fields',require(_0xccac('0xc4')));_0x5c1740[_0xccac('0x6')](_0xccac('0xc5'),require(_0xccac('0xc6')));_0x5c1740[_0xccac('0x6')](_0xccac('0xc7'),require(_0xccac('0xc8')));_0x5c1740[_0xccac('0x6')]('/api/integrations/freshsales/fields',require(_0xccac('0xc9')));_0x5c1740[_0xccac('0x6')](_0xccac('0xca'),require('./api/network'));_0x5c1740[_0xccac('0x6')](_0xccac('0xcb'),require('./api/chatQueueReport'));_0x5c1740[_0xccac('0x6')](_0xccac('0xcc'),require(_0xccac('0xcd')));_0x5c1740[_0xccac('0x6')]('/api/jscripty/answers/reports',require(_0xccac('0xce')));_0x5c1740[_0xccac('0x6')]('/api/jscripty/questions/reports',require('./api/jscriptyQuestionReport'));_0x5c1740[_0xccac('0x6')](_0xccac('0xcf'),require(_0xccac('0xd0')));_0x5c1740['use'](_0xccac('0xd1'),require('./api/smsQueueReport'));_0x5c1740['use'](_0xccac('0xd2'),require(_0xccac('0xd3')));_0x5c1740[_0xccac('0x6')](_0xccac('0xd4'),require('./api/squareReportDetail'));_0x5c1740[_0xccac('0x6')](_0xccac('0xd5'),require('./api/jscriptyProject'));_0x5c1740['use'](_0xccac('0xd6'),require('./api/setting'));_0x5c1740['use']('/api/square/odbc',require(_0xccac('0xd7')));_0x5c1740[_0xccac('0x6')](_0xccac('0xd8'),require(_0xccac('0xd9')));_0x5c1740[_0xccac('0x6')]('/api/square/recordings',require(_0xccac('0xda')));_0x5c1740['use'](_0xccac('0xdb'),require('./api/squareMessage'));_0x5c1740[_0xccac('0x6')](_0xccac('0xdc'),require(_0xccac('0xdd')));_0x5c1740[_0xccac('0x6')]('/api/license',require(_0xccac('0xde')));_0x5c1740[_0xccac('0x6')](_0xccac('0xdf'),require(_0xccac('0xe0')));_0x5c1740[_0xccac('0x6')](_0xccac('0xe1'),require(_0xccac('0xe2')));_0x5c1740[_0xccac('0x6')](_0xccac('0xe3'),require(_0xccac('0xe4')));_0x5c1740[_0xccac('0x6')]('/api/plugins',require(_0xccac('0xe5')));_0x5c1740[_0xccac('0x6')]('/api/mail/reports/transfer',require('./api/mailTransferReport'));_0x5c1740['use']('/api/chat/reports/transfer',require(_0xccac('0xe6')));_0x5c1740['use']('/api/fax/reports/transfer',require(_0xccac('0xe7')));_0x5c1740[_0xccac('0x6')](_0xccac('0xe8'),require('./api/openchannelTransferReport'));_0x5c1740['use'](_0xccac('0xe9'),require(_0xccac('0xea')));_0x5c1740[_0xccac('0x6')]('/api/cm/lists',require('./api/cmList'));_0x5c1740[_0xccac('0x6')](_0xccac('0xeb'),require(_0xccac('0xec')));_0x5c1740[_0xccac('0x6')](_0xccac('0xed'),require(_0xccac('0xee')));_0x5c1740[_0xccac('0x6')](_0xccac('0xef'),require(_0xccac('0xf0')));_0x5c1740['use'](_0xccac('0xf1'),require(_0xccac('0xf2')));_0x5c1740[_0xccac('0x6')]('/api/notifications',require(_0xccac('0xf3')));_0x5c1740[_0xccac('0x6')]('/api/whatsapp/accounts',require('./api/whatsappAccount'));_0x5c1740[_0xccac('0x6')](_0xccac('0xf4'),require('./api/whatsappApplication'));_0x5c1740[_0xccac('0x6')]('/api/whatsapp/interactions',require(_0xccac('0xf5')));_0x5c1740[_0xccac('0x6')](_0xccac('0xf6'),require(_0xccac('0xf7')));_0x5c1740[_0xccac('0x6')](_0xccac('0xf8'),require('./api/whatsappQueueReport'));_0x5c1740[_0xccac('0x6')](_0xccac('0xf9'),require(_0xccac('0xfa')));_0x5c1740['use'](_0xccac('0xfb'),require(_0xccac('0xfc')));_0x5c1740['use']('/api/cloudProviders',require('./api/cloudProvider'));_0x5c1740[_0xccac('0x6')](_0xccac('0xfd'),require(_0xccac('0xfe')));_0x5c1740['use']('/api/auth/google',require(_0xccac('0xff')));_0x5c1740[_0xccac('0x6')](_0xccac('0x100'),require(_0xccac('0x101')));_0x5c1740['use']('/api/rpc',require(_0xccac('0x102')));_0x5c1740['use'](_0xccac('0x103'),require(_0xccac('0x104')));_0x5c1740[_0xccac('0x6')](_0xccac('0x105'),require(_0xccac('0x106')));_0x5c1740[_0xccac('0x6')]('/api/pm2',require('./api/pm2'));_0x5c1740['use']('/api/webbar',require(_0xccac('0x107')));_0x5c1740[_0xccac('0x6')]('/apidoc',express[_0xccac('0x108')](path[_0xccac('0x109')](config[_0xccac('0x10a')],_0xccac('0x10b'))));_0x5c1740[_0xccac('0x6')]('/www',express[_0xccac('0x108')](path['join'](config['root'],_0xccac('0x10c'))));_0x5c1740['use'](_0xccac('0x10d'),express[_0xccac('0x108')](path[_0xccac('0x109')](config[_0xccac('0x10a')],'/demo')));_0x5c1740[_0xccac('0x6')](_0xccac('0x10e'),express['static'](path[_0xccac('0x109')](config[_0xccac('0x10a')],_0xccac('0x10f'),_0xccac('0x110'))));_0x5c1740[_0xccac('0x6')](_0xccac('0x111'),express[_0xccac('0x108')](path[_0xccac('0x109')](config[_0xccac('0x10a')],'/server/files/plugins')));_0x5c1740[_0xccac('0x112')](_0xccac('0x113'))['get'](errors[0x194]);_0x5c1740[_0xccac('0x112')]('/*')[_0xccac('0x114')](function(_0x4c9224,_0x2d2cc4){_0x2d2cc4[_0xccac('0x115')](path[_0xccac('0x116')](_0x5c1740[_0xccac('0x114')](_0xccac('0x117'))+_0xccac('0x118')));});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 294e314..2807cfe 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe928=['../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailMessage/mailMessage.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.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/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','rpc','port','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','lodash','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xe928,0x7a));var _0x8e92=function(_0x2bb452,_0x2dbbc0){_0x2bb452=_0x2bb452-0x0;var _0x5f50a6=_0xe928[_0x2bb452];return _0x5f50a6;};'use strict';var jayson=require('jayson/promise');var BPromise=require('bluebird');var _=require(_0x8e92('0x0'));var config=require('../config/environment');exports['listen']=function(){return new BPromise(function(_0x30f078,_0x2b0ce5){var _0x5f045f={};_0x5f045f=_[_0x8e92('0x1')](_0x5f045f,require('../api/user/user.rpc'));_0x5f045f=_[_0x8e92('0x1')](_0x5f045f,require(_0x8e92('0x2')));_0x5f045f=_[_0x8e92('0x1')](_0x5f045f,require(_0x8e92('0x3')));_0x5f045f=_[_0x8e92('0x1')](_0x5f045f,require(_0x8e92('0x4')));_0x5f045f=_[_0x8e92('0x1')](_0x5f045f,require(_0x8e92('0x5')));_0x5f045f=_[_0x8e92('0x1')](_0x5f045f,require(_0x8e92('0x6')));_0x5f045f=_['merge'](_0x5f045f,require(_0x8e92('0x7')));_0x5f045f=_['merge'](_0x5f045f,require('../api/voiceQueueReport/voiceQueueReport.rpc'));_0x5f045f=_['merge'](_0x5f045f,require(_0x8e92('0x8')));_0x5f045f=_[_0x8e92('0x1')](_0x5f045f,require(_0x8e92('0x9')));_0x5f045f=_['merge'](_0x5f045f,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0x5f045f=_[_0x8e92('0x1')](_0x5f045f,require(_0x8e92('0xa')));_0x5f045f=_[_0x8e92('0x1')](_0x5f045f,require('../api/mailServerIn/mailServerIn.rpc'));_0x5f045f=_[_0x8e92('0x1')](_0x5f045f,require(_0x8e92('0xb')));_0x5f045f=_[_0x8e92('0x1')](_0x5f045f,require(_0x8e92('0xc')));_0x5f045f=_[_0x8e92('0x1')](_0x5f045f,require('../api/mailInteraction/mailInteraction.rpc'));_0x5f045f=_[_0x8e92('0x1')](_0x5f045f,require(_0x8e92('0xd')));_0x5f045f=_['merge'](_0x5f045f,require('../api/mailApplication/mailApplication.rpc'));_0x5f045f=_[_0x8e92('0x1')](_0x5f045f,require(_0x8e92('0xe')));_0x5f045f=_[_0x8e92('0x1')](_0x5f045f,require(_0x8e92('0xf')));_0x5f045f=_[_0x8e92('0x1')](_0x5f045f,require(_0x8e92('0x10')));_0x5f045f=_[_0x8e92('0x1')](_0x5f045f,require(_0x8e92('0x11')));_0x5f045f=_[_0x8e92('0x1')](_0x5f045f,require(_0x8e92('0x12')));_0x5f045f=_[_0x8e92('0x1')](_0x5f045f,require('../api/faxQueue/faxQueue.rpc'));_0x5f045f=_['merge'](_0x5f045f,require(_0x8e92('0x13')));_0x5f045f=_['merge'](_0x5f045f,require(_0x8e92('0x14')));_0x5f045f=_[_0x8e92('0x1')](_0x5f045f,require(_0x8e92('0x15')));_0x5f045f=_['merge'](_0x5f045f,require(_0x8e92('0x16')));_0x5f045f=_[_0x8e92('0x1')](_0x5f045f,require(_0x8e92('0x17')));_0x5f045f=_[_0x8e92('0x1')](_0x5f045f,require(_0x8e92('0x18')));_0x5f045f=_['merge'](_0x5f045f,require(_0x8e92('0x19')));_0x5f045f=_[_0x8e92('0x1')](_0x5f045f,require(_0x8e92('0x1a')));_0x5f045f=_[_0x8e92('0x1')](_0x5f045f,require(_0x8e92('0x1b')));_0x5f045f=_[_0x8e92('0x1')](_0x5f045f,require(_0x8e92('0x1c')));_0x5f045f=_[_0x8e92('0x1')](_0x5f045f,require(_0x8e92('0x1d')));_0x5f045f=_[_0x8e92('0x1')](_0x5f045f,require('../api/chatMessage/chatMessage.rpc'));_0x5f045f=_[_0x8e92('0x1')](_0x5f045f,require('../api/chatQueue/chatQueue.rpc'));_0x5f045f=_[_0x8e92('0x1')](_0x5f045f,require('../api/cmContact/cmContact.rpc'));_0x5f045f=_['merge'](_0x5f045f,require('../api/cmHopper/cmHopper.rpc'));_0x5f045f=_[_0x8e92('0x1')](_0x5f045f,require('../api/cmHopperBlack/cmHopperBlack.rpc'));_0x5f045f=_[_0x8e92('0x1')](_0x5f045f,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0x5f045f=_[_0x8e92('0x1')](_0x5f045f,require('../api/cmHopperHistory/cmHopperHistory.rpc'));_0x5f045f=_[_0x8e92('0x1')](_0x5f045f,require(_0x8e92('0x1e')));_0x5f045f=_[_0x8e92('0x1')](_0x5f045f,require(_0x8e92('0x1f')));_0x5f045f=_[_0x8e92('0x1')](_0x5f045f,require(_0x8e92('0x20')));_0x5f045f=_[_0x8e92('0x1')](_0x5f045f,require('../api/sound/sound.rpc'));_0x5f045f=_[_0x8e92('0x1')](_0x5f045f,require(_0x8e92('0x21')));_0x5f045f=_['merge'](_0x5f045f,require(_0x8e92('0x22')));_0x5f045f=_[_0x8e92('0x1')](_0x5f045f,require(_0x8e92('0x23')));_0x5f045f=_['merge'](_0x5f045f,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x5f045f=_['merge'](_0x5f045f,require(_0x8e92('0x24')));_0x5f045f=_[_0x8e92('0x1')](_0x5f045f,require(_0x8e92('0x25')));_0x5f045f=_[_0x8e92('0x1')](_0x5f045f,require(_0x8e92('0x26')));_0x5f045f=_[_0x8e92('0x1')](_0x5f045f,require(_0x8e92('0x27')));_0x5f045f=_[_0x8e92('0x1')](_0x5f045f,require('../api/intFreshdeskAccount/intFreshdeskAccount.rpc'));_0x5f045f=_[_0x8e92('0x1')](_0x5f045f,require(_0x8e92('0x28')));_0x5f045f=_[_0x8e92('0x1')](_0x5f045f,require(_0x8e92('0x29')));_0x5f045f=_[_0x8e92('0x1')](_0x5f045f,require(_0x8e92('0x2a')));_0x5f045f=_['merge'](_0x5f045f,require(_0x8e92('0x2b')));_0x5f045f=_[_0x8e92('0x1')](_0x5f045f,require(_0x8e92('0x2c')));_0x5f045f=_['merge'](_0x5f045f,require(_0x8e92('0x2d')));_0x5f045f=_[_0x8e92('0x1')](_0x5f045f,require(_0x8e92('0x2e')));_0x5f045f=_[_0x8e92('0x1')](_0x5f045f,require(_0x8e92('0x2f')));_0x5f045f=_[_0x8e92('0x1')](_0x5f045f,require(_0x8e92('0x30')));_0x5f045f=_['merge'](_0x5f045f,require('../api/squareProject/squareProject.rpc'));_0x5f045f=_[_0x8e92('0x1')](_0x5f045f,require('../api/squareRecording/squareRecording.rpc'));_0x5f045f=_[_0x8e92('0x1')](_0x5f045f,require('../api/squareMessage/squareMessage.rpc'));_0x5f045f=_[_0x8e92('0x1')](_0x5f045f,require(_0x8e92('0x31')));_0x5f045f=_[_0x8e92('0x1')](_0x5f045f,require(_0x8e92('0x32')));_0x5f045f=_[_0x8e92('0x1')](_0x5f045f,require(_0x8e92('0x33')));_0x5f045f=_['merge'](_0x5f045f,require(_0x8e92('0x34')));_0x5f045f=_[_0x8e92('0x1')](_0x5f045f,require('../api/whatsappInteraction/whatsappInteraction.rpc'));_0x5f045f=_[_0x8e92('0x1')](_0x5f045f,require(_0x8e92('0x35')));_0x5f045f=_[_0x8e92('0x1')](_0x5f045f,require(_0x8e92('0x36')));_0x5f045f=_['merge'](_0x5f045f,require(_0x8e92('0x37')));var _0x247881=jayson[_0x8e92('0x38')](_0x5f045f)['http']();var _0x367649=config[_0x8e92('0x39')][_0x8e92('0x3a')]||config[_0x8e92('0x3a')]+0x1;var _0x36e3ca=config['rpc']['ip']||'localhost';_0x247881['on'](_0x8e92('0x3b'),function(_0x165cfe){return _0x2b0ce5(_0x165cfe);});_0x247881['listen'](_0x367649,_0x36e3ca,function(){console[_0x8e92('0x3c')](_0x8e92('0x3d'),_0x36e3ca,_0x367649);require(_0x8e92('0x3e'))[_0x8e92('0x3f')]();return _0x30f078(_0x8e92('0x40')+_0x36e3ca+':'+_0x367649);});});}; \ No newline at end of file +var _0x5774=['../api/intZendeskAccount/intZendeskAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','rpc','port','localhost','listen','log','RPC\x20listening\x20on\x20','bluebird','lodash','../config/environment','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/interval/interval.rpc','../api/sound/sound.rpc','../api/variable/variable.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc'];(function(_0x34a335,_0x2f50ba){var _0x695c76=function(_0x155a69){while(--_0x155a69){_0x34a335['push'](_0x34a335['shift']());}};_0x695c76(++_0x2f50ba);}(_0x5774,0x8e));var _0x4577=function(_0xd73e3f,_0x5bb05e){_0xd73e3f=_0xd73e3f-0x0;var _0x83aae6=_0x5774[_0xd73e3f];return _0x83aae6;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0x4577('0x0'));var _=require(_0x4577('0x1'));var config=require(_0x4577('0x2'));exports['listen']=function(){return new BPromise(function(_0x453192,_0x4d1a59){var _0x52d867={};_0x52d867=_[_0x4577('0x3')](_0x52d867,require(_0x4577('0x4')));_0x52d867=_[_0x4577('0x3')](_0x52d867,require(_0x4577('0x5')));_0x52d867=_[_0x4577('0x3')](_0x52d867,require(_0x4577('0x6')));_0x52d867=_['merge'](_0x52d867,require(_0x4577('0x7')));_0x52d867=_[_0x4577('0x3')](_0x52d867,require('../api/voiceCallReport/voiceCallReport.rpc'));_0x52d867=_[_0x4577('0x3')](_0x52d867,require('../api/voiceDialReport/voiceDialReport.rpc'));_0x52d867=_['merge'](_0x52d867,require(_0x4577('0x8')));_0x52d867=_[_0x4577('0x3')](_0x52d867,require(_0x4577('0x9')));_0x52d867=_['merge'](_0x52d867,require(_0x4577('0xa')));_0x52d867=_[_0x4577('0x3')](_0x52d867,require('../api/trunk/trunk.rpc'));_0x52d867=_['merge'](_0x52d867,require(_0x4577('0xb')));_0x52d867=_[_0x4577('0x3')](_0x52d867,require(_0x4577('0xc')));_0x52d867=_[_0x4577('0x3')](_0x52d867,require(_0x4577('0xd')));_0x52d867=_[_0x4577('0x3')](_0x52d867,require(_0x4577('0xe')));_0x52d867=_[_0x4577('0x3')](_0x52d867,require('../api/mailQueue/mailQueue.rpc'));_0x52d867=_['merge'](_0x52d867,require('../api/mailInteraction/mailInteraction.rpc'));_0x52d867=_['merge'](_0x52d867,require(_0x4577('0xf')));_0x52d867=_[_0x4577('0x3')](_0x52d867,require(_0x4577('0x10')));_0x52d867=_[_0x4577('0x3')](_0x52d867,require(_0x4577('0x11')));_0x52d867=_['merge'](_0x52d867,require(_0x4577('0x12')));_0x52d867=_['merge'](_0x52d867,require(_0x4577('0x13')));_0x52d867=_[_0x4577('0x3')](_0x52d867,require(_0x4577('0x14')));_0x52d867=_[_0x4577('0x3')](_0x52d867,require(_0x4577('0x15')));_0x52d867=_[_0x4577('0x3')](_0x52d867,require(_0x4577('0x16')));_0x52d867=_[_0x4577('0x3')](_0x52d867,require(_0x4577('0x17')));_0x52d867=_[_0x4577('0x3')](_0x52d867,require(_0x4577('0x18')));_0x52d867=_[_0x4577('0x3')](_0x52d867,require('../api/smsInteraction/smsInteraction.rpc'));_0x52d867=_[_0x4577('0x3')](_0x52d867,require('../api/smsMessage/smsMessage.rpc'));_0x52d867=_['merge'](_0x52d867,require(_0x4577('0x19')));_0x52d867=_['merge'](_0x52d867,require(_0x4577('0x1a')));_0x52d867=_['merge'](_0x52d867,require('../api/openchannelInteraction/openchannelInteraction.rpc'));_0x52d867=_[_0x4577('0x3')](_0x52d867,require(_0x4577('0x1b')));_0x52d867=_[_0x4577('0x3')](_0x52d867,require('../api/openchannelQueue/openchannelQueue.rpc'));_0x52d867=_[_0x4577('0x3')](_0x52d867,require('../api/openchannelQueueReport/openchannelQueueReport.rpc'));_0x52d867=_[_0x4577('0x3')](_0x52d867,require(_0x4577('0x1c')));_0x52d867=_['merge'](_0x52d867,require(_0x4577('0x1d')));_0x52d867=_[_0x4577('0x3')](_0x52d867,require(_0x4577('0x1e')));_0x52d867=_[_0x4577('0x3')](_0x52d867,require(_0x4577('0x1f')));_0x52d867=_[_0x4577('0x3')](_0x52d867,require(_0x4577('0x20')));_0x52d867=_[_0x4577('0x3')](_0x52d867,require('../api/cmHopperBlack/cmHopperBlack.rpc'));_0x52d867=_['merge'](_0x52d867,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0x52d867=_[_0x4577('0x3')](_0x52d867,require('../api/cmHopperHistory/cmHopperHistory.rpc'));_0x52d867=_[_0x4577('0x3')](_0x52d867,require('../api/reportAgentPreview/reportAgentPreview.rpc'));_0x52d867=_[_0x4577('0x3')](_0x52d867,require(_0x4577('0x21')));_0x52d867=_[_0x4577('0x3')](_0x52d867,require('../api/pause/pause.rpc'));_0x52d867=_[_0x4577('0x3')](_0x52d867,require(_0x4577('0x22')));_0x52d867=_[_0x4577('0x3')](_0x52d867,require('../api/template/template.rpc'));_0x52d867=_[_0x4577('0x3')](_0x52d867,require('../api/trigger/trigger.rpc'));_0x52d867=_['merge'](_0x52d867,require(_0x4577('0x23')));_0x52d867=_[_0x4577('0x3')](_0x52d867,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x52d867=_[_0x4577('0x3')](_0x52d867,require(_0x4577('0x24')));_0x52d867=_[_0x4577('0x3')](_0x52d867,require('../api/intDeskAccount/intDeskAccount.rpc'));_0x52d867=_[_0x4577('0x3')](_0x52d867,require(_0x4577('0x25')));_0x52d867=_[_0x4577('0x3')](_0x52d867,require(_0x4577('0x26')));_0x52d867=_['merge'](_0x52d867,require('../api/intFreshdeskAccount/intFreshdeskAccount.rpc'));_0x52d867=_['merge'](_0x52d867,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0x52d867=_[_0x4577('0x3')](_0x52d867,require(_0x4577('0x27')));_0x52d867=_['merge'](_0x52d867,require(_0x4577('0x28')));_0x52d867=_['merge'](_0x52d867,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0x52d867=_[_0x4577('0x3')](_0x52d867,require(_0x4577('0x29')));_0x52d867=_[_0x4577('0x3')](_0x52d867,require(_0x4577('0x2a')));_0x52d867=_[_0x4577('0x3')](_0x52d867,require(_0x4577('0x2b')));_0x52d867=_[_0x4577('0x3')](_0x52d867,require(_0x4577('0x2c')));_0x52d867=_[_0x4577('0x3')](_0x52d867,require('../api/squareOdbc/squareOdbc.rpc'));_0x52d867=_[_0x4577('0x3')](_0x52d867,require(_0x4577('0x2d')));_0x52d867=_[_0x4577('0x3')](_0x52d867,require(_0x4577('0x2e')));_0x52d867=_[_0x4577('0x3')](_0x52d867,require(_0x4577('0x2f')));_0x52d867=_[_0x4577('0x3')](_0x52d867,require(_0x4577('0x30')));_0x52d867=_[_0x4577('0x3')](_0x52d867,require(_0x4577('0x31')));_0x52d867=_[_0x4577('0x3')](_0x52d867,require('../api/plugin/plugin.rpc'));_0x52d867=_[_0x4577('0x3')](_0x52d867,require('../api/whatsappAccount/whatsappAccount.rpc'));_0x52d867=_[_0x4577('0x3')](_0x52d867,require(_0x4577('0x32')));_0x52d867=_[_0x4577('0x3')](_0x52d867,require('../api/whatsappMessage/whatsappMessage.rpc'));_0x52d867=_[_0x4577('0x3')](_0x52d867,require(_0x4577('0x33')));_0x52d867=_[_0x4577('0x3')](_0x52d867,require(_0x4577('0x34')));var _0xfbab58=jayson[_0x4577('0x35')](_0x52d867)['http']();var _0x1dd173=config[_0x4577('0x36')][_0x4577('0x37')]||config[_0x4577('0x37')]+0x1;var _0x1d5473=config['rpc']['ip']||_0x4577('0x38');_0xfbab58['on']('error',function(_0x53bb73){return _0x4d1a59(_0x53bb73);});_0xfbab58[_0x4577('0x39')](_0x1dd173,_0x1d5473,function(){console[_0x4577('0x3a')]('Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!',_0x1d5473,_0x1dd173);require('../config/triggers')['default']();return _0x453192(_0x4577('0x3b')+_0x1d5473+':'+_0x1dd173);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 0dae85d..20b184e 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 _0x9c44=['no\x20code','replace','result=','indexOf','substr','startsWith','length','match','error','E_AGI_SOCKET_ERROR','code','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','inherits','prototype','sendRequest','sync','ANSWER','getData','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','setContext','SET\x20CONTEXT\x20%s','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber','SET\x20VARIABLE\x20%s\x20\x22%s\x22','toString','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','setExtension','noop','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','agi','AGI','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','events','EventEmitter','./reply','./error','setEncoding','utf8','setTimeout','emit','ready','toLowerCase','hangup','substring','520\x20End\x20of\x20proper','function'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0x9c44,0x178));var _0x49c4=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0x9c44[_0x5f09c5];return _0x426ad9;};'use strict';var util=require('util');var _=require('lodash');var EventEmitter=require(_0x49c4('0x0'))[_0x49c4('0x1')];var AGIReply=require(_0x49c4('0x2'));var AGIError=require(_0x49c4('0x3'));function AGIChannel(_0x455700){var _0x2ad237=this,_0x4e0313=new AGIReply(),_0x4941f1=![],_0x41a183={};EventEmitter['call'](_0x2ad237);_0x455700[_0x49c4('0x4')](_0x49c4('0x5'));_0x455700[_0x49c4('0x6')](0x8*0x3c*0x3c*0x3e8);_0x4e0313[_0x49c4('0x4')](_0x49c4('0x5'));_0x4e0313['on']('headers',function(_0x11c586){for(var _0x42e4f8 in _0x11c586){_0x2ad237[_0x42e4f8]=_0x11c586[_0x42e4f8];}_0x2ad237[_0x49c4('0x7')](_0x49c4('0x8'));});_0x4e0313['on']('line',function(_0x5ab4a3){if(_0x5ab4a3[_0x49c4('0x9')]()==_0x49c4('0xa')){_0x2ad237['emit'](_0x49c4('0xa'));return;}if(_0x5ab4a3[_0x49c4('0xb')](0x0,0xb)=='520-Invalid'){_0x4941f1=!![];}if(_0x4941f1){_0x41a183['rx']+=_0x5ab4a3+'\x0a';if(_0x5ab4a3['search'](_0x49c4('0xc'))!=-0x1){_0x4941f1=![];}}else{_0x41a183['rx']=_0x5ab4a3;}if(_0x4941f1){return;}if(typeof _0x41a183['cb']==_0x49c4('0xd')){var _0x5487cd=_0x41a183['rx']['substring'](0x0,0x3),_0x7df3a9=null,_0x403bfb=null;_0x5487cd=parseInt(_0x5487cd);if(isNaN(_0x5487cd)){_0x41a183['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x49c4('0xe')});return;}if(_0x5487cd!=0xc8){_0x41a183['cb'](null,{'code':_0x5487cd,'result':-0x1,'extra':'KO'});return;}_0x7df3a9=_0x41a183['rx'][_0x49c4('0xb')](0x4)[_0x49c4('0xf')](_0x49c4('0x10'),'');if(_0x7df3a9[_0x49c4('0x11')]('\x20')!=-0x1){_0x7df3a9=_0x7df3a9[_0x49c4('0x12')](0x0,_0x7df3a9[_0x49c4('0x11')]('\x20'));}if(_[_0x49c4('0x13')](_0x7df3a9,'-1')){_0x7df3a9=parseInt(_0x7df3a9);}_0x403bfb=_0x41a183['rx']['split']('\x20');if(_0x403bfb[_0x49c4('0x14')]==0x3){_0x403bfb=_0x403bfb[0x2][_0x49c4('0xb')](0x1,_0x403bfb[0x2][_0x49c4('0x14')]-0x1);}else if(_0x403bfb[_0x49c4('0x14')]>0x3){var _0x2abc78=/\((.+)\)/;var _0x53e3a2=_0x41a183['rx'][_0x49c4('0x15')](_0x2abc78);if(_0x53e3a2){_0x403bfb=_0x53e3a2[0x1];}else{_0x403bfb=null;}}else{_0x403bfb=null;}_0x41a183['cb'](null,{'code':_0x5487cd,'result':_0x7df3a9,'extra':_0x403bfb});}});_0x455700['on'](_0x49c4('0x16'),function(_0x4c3253){_0x2ad237['emit'](_0x49c4('0x16'),new AGIError(_0x49c4('0x17'),_0x4c3253[_0x49c4('0x18')]));});_0x455700['on']('close',function(){_0x2ad237[_0x49c4('0x7')]('close',new AGIError(_0x49c4('0x19')));});_0x455700['on'](_0x49c4('0x1a'),function(){_0x2ad237[_0x49c4('0x7')](_0x49c4('0x1a'),new AGIError(_0x49c4('0x1b')));_0x455700[_0x49c4('0x1c')]();});_0x455700[_0x49c4('0x1d')](_0x4e0313);this[_0x49c4('0x1e')]=function(_0x2197d2,_0x578447){var _0x2197d2=_0x2197d2||'',_0x578447=typeof _0x578447==_0x49c4('0xd')?_0x578447:new Function();_0x41a183={'tx':_0x2197d2,'rx':'','cb':_0x578447};_0x455700['write'](_0x2197d2+'\x0a');},this['close']=function(){_0x455700[_0x49c4('0x1c')]();};}util[_0x49c4('0x1f')](AGIChannel,EventEmitter);AGIChannel[_0x49c4('0x20')][_0x49c4('0x21')]=function(_0x4811c4){return this['command'][_0x49c4('0x22')](this,_0x4811c4);};AGIChannel[_0x49c4('0x20')]['answer']=function(){return this[_0x49c4('0x21')](_0x49c4('0x23'));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x24')]=function(_0x531d92,_0x543ea2,_0x449960){_0x531d92=_0x531d92===undefined?'beep':_0x531d92;_0x543ea2=_0x543ea2===undefined?'5':_0x543ea2;_0x449960=_0x449960===undefined?'1':_0x449960;return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x26'),_0x531d92,_0x543ea2*0x3e8,_0x449960));};AGIChannel[_0x49c4('0x20')]['noop']=function(_0x889909){_0x889909=_0x889909||_0x49c4('0x27');return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x28'),_0x889909));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x29')]=function(_0x427b26,_0x17b50f){if(_[_0x49c4('0x2a')](_0x17b50f)){return this[_0x49c4('0x21')](util['format']('EXEC\x20%s\x20%s',_0x427b26,_0x17b50f['join'](',')));}return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x2b'),_0x427b26,_0x17b50f));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x2c')]=function(_0x574fd3){return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x2d'),_0x574fd3));};AGIChannel[_0x49c4('0x20')]['setExtension']=function(_0x57a29c){return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x2e'),_0x57a29c));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x2f')]=function(_0x4a0c7a){return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x30'),_0x4a0c7a));};AGIChannel['prototype']['hangup']=function(){return this[_0x49c4('0x21')](_0x49c4('0x31'));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x32')]=function(_0x2b45a1,_0x2cf897){var _0x1d1557=_[_0x49c4('0x33')](_0x2cf897)||_[_0x49c4('0x34')](_0x2cf897)?_0x2cf897['toString']():_0x2cf897;return this[_0x49c4('0x21')](util['format'](_0x49c4('0x35'),_0x2b45a1,_0x1d1557?_0x1d1557[_0x49c4('0x36')]()[_0x49c4('0xf')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x49c4('0x20')]['sayNumber']=function(_0x335f0c,_0x31f3ff){return this[_0x49c4('0x21')](util['format'](_0x49c4('0x37'),_0x335f0c,_0x31f3ff));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x38')]=function(_0x5e5366,_0x1ba7a0){return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x39'),_0x5e5366,_0x1ba7a0));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x3a')]=function(_0x1e506a,_0x4e0663){return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x3b'),_0x1e506a,_0x4e0663));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x3c')]=function(_0x29dd5d,_0x1be62d,_0xc9722b){_0x1be62d=_0x1be62d||this[_0x49c4('0x3d')];_0xc9722b=_0xc9722b||0x1;this[_0x49c4('0x2c')](_0x29dd5d);this[_0x49c4('0x3e')](_0x1be62d);this[_0x49c4('0x2f')](_0xc9722b);return this[_0x49c4('0x3f')](util['format'](_0x49c4('0x40'),_0x29dd5d,_0x1be62d,_0xc9722b));};AGIChannel['prototype'][_0x49c4('0x41')]=function(_0x4915bc){return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x42'),_0x4915bc));};AGIChannel[_0x49c4('0x20')]['recordFile']=function(_0x4d628a,_0x20490b,_0x1e7bdc,_0x38349b,_0x117151,_0x490823){_0x20490b=_0x20490b||_0x49c4('0x43');_0x1e7bdc=_0x1e7bdc||'';_0x38349b=_0x38349b===undefined?-0x1:_0x38349b==='-1'?-0x1:_0x38349b*0x3e8;_0x117151=_0x117151===undefined?'':'s='+_0x117151;_0x490823=_0x490823?_0x49c4('0x44'):'';return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x45'),_0x4d628a,_0x20490b,_0x1e7bdc,_0x38349b,_0x490823,_0x117151));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x46')]=function(_0x3351c1,_0x3c4a1d){_0x3c4a1d=_0x3c4a1d||'';return this['sendRequest'](util[_0x49c4('0x25')]('STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22',_0x3351c1,_0x3c4a1d));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x47')]=function(_0x301def){return this[_0x49c4('0x29')](_0x49c4('0x48'),_0x301def);};AGIChannel['prototype'][_0x49c4('0x49')]=function(_0x15b674){return this[_0x49c4('0x29')](_0x49c4('0x4a'),_0x15b674);};AGIChannel[_0x49c4('0x20')][_0x49c4('0x16')]=function(_0x9779ef,_0x4d89e0){this[_0x49c4('0x3f')](util['format'](_0x49c4('0x4b'),_0x9779ef['id'],_0x9779ef[_0x49c4('0x4c')],_0x4d89e0));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x49c4('0x4d')]=AGIChannel; \ No newline at end of file +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(_0x1d7037,_0x57dd95){var _0x4d6568=function(_0x5c64c5){while(--_0x5c64c5){_0x1d7037['push'](_0x1d7037['shift']());}};_0x4d6568(++_0x57dd95);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x40df5f,_0x8fd59f){_0x40df5f=_0x40df5f-0x0;var _0x1573f1=_0xcb91[_0x40df5f];return _0x1573f1;};'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 diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 893a8c4..738284b 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 _0xa7ec=['Socket\x20closed.','Missing\x20\x27ivr.entry\x27\x20menu.','push','format','apply','message','exports','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Socket\x20error.\x20Code:\x20%s.'];(function(_0x33032e,_0x31411a){var _0x13316b=function(_0x2fb049){while(--_0x2fb049){_0x33032e['push'](_0x33032e['shift']());}};_0x13316b(++_0x31411a);}(_0xa7ec,0x14b));var _0xca7e=function(_0xc583b3,_0x3384a6){_0xc583b3=_0xc583b3-0x0;var _0x59eb9e=_0xa7ec[_0xc583b3];return _0x59eb9e;};'use strict';var util=require(_0xca7e('0x0'));var error={'E_AGI_UNDEFINED':_0xca7e('0x1'),'E_AGI_ARGUMENT_PORT':_0xca7e('0x2'),'E_AGI_SERVER_ERROR':_0xca7e('0x3'),'E_AGI_SERVER_CLOSE':'Server\x20closed.','E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':'[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','E_AGI_SOCKET_ERROR':_0xca7e('0x4'),'E_AGI_SOCKET_CLOSE':_0xca7e('0x5'),'E_AGI_SOCKET_TIMEOUT':'Socket\x20timeout.','E_AGI_COMMAND_EMPTY':'Empty\x20command.','E_AGI_IVR_AGI_NETWORK_SCRIPT':'Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_IVR_ENTRY':_0xca7e('0x6')};function AGIError(_0x2f3afd){var _0x2f3afd=_0x2f3afd||null,_0x1c86c3=_0x1c86c3||[],_0x23d222=0x1,_0x30a3b2='';if(!error[_0x2f3afd]){_0x2f3afd='E_AGI_UNDEFINED';}_0x1c86c3[_0xca7e('0x7')](error[_0x2f3afd]);while(arguments[_0x23d222]){_0x1c86c3[_0xca7e('0x7')](arguments[_0x23d222]);_0x23d222++;}_0x30a3b2=util[_0xca7e('0x8')][_0xca7e('0x9')](util,_0x1c86c3);this[_0xca7e('0xa')]=_0x30a3b2;this['name']=_0x2f3afd;}module[_0xca7e('0xb')]=AGIError; \ No newline at end of file +var _0xbcc4=['Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','apply','message','exports','util'];(function(_0x38eb86,_0x247e47){var _0x1f2581=function(_0x4d614e){while(--_0x4d614e){_0x38eb86['push'](_0x38eb86['shift']());}};_0x1f2581(++_0x247e47);}(_0xbcc4,0x12b));var _0x4bcc=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xbcc4[_0x40ac5e];return _0x2839d6;};'use strict';var util=require(_0x4bcc('0x0'));var error={'E_AGI_UNDEFINED':'Undefined\x20error.','E_AGI_ARGUMENT_PORT':_0x4bcc('0x1'),'E_AGI_SERVER_ERROR':_0x4bcc('0x2'),'E_AGI_SERVER_CLOSE':_0x4bcc('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0x4bcc('0x4'),'E_AGI_SERVER_VOICE_DISABLED':'[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','E_AGI_SOCKET_ERROR':_0x4bcc('0x5'),'E_AGI_SOCKET_CLOSE':_0x4bcc('0x6'),'E_AGI_SOCKET_TIMEOUT':'Socket\x20timeout.','E_AGI_COMMAND_EMPTY':'Empty\x20command.','E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x4bcc('0x7'),'E_AGI_IVR_ENTRY':_0x4bcc('0x8')};function AGIError(_0x2b318){var _0x2b318=_0x2b318||null,_0x272325=_0x272325||[],_0x580b1b=0x1,_0x1a19ff='';if(!error[_0x2b318]){_0x2b318=_0x4bcc('0x9');}_0x272325[_0x4bcc('0xa')](error[_0x2b318]);while(arguments[_0x580b1b]){_0x272325[_0x4bcc('0xa')](arguments[_0x580b1b]);_0x580b1b++;}_0x1a19ff=util[_0x4bcc('0xb')][_0x4bcc('0xc')](util,_0x272325);this[_0x4bcc('0xd')]=_0x1a19ff;this['name']=_0x2b318;}module[_0x4bcc('0xe')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index 68688f3..e7284f4 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 _0xc901=['numberOfEdges','prototype','addVertex','edges','addEdge','push','size','getVertex','traverseBFS','info','no\x20vertex\x20found','stop\x20traverse','length','condition','agicommand','default','menu','target','includes','max\x20retry\x20reach','condition\x20not\x20found','exports','lodash','getsecretdigits','vertices'];(function(_0x3df903,_0xfd00c5){var _0x5ec0f5=function(_0x5532fb){while(--_0x5532fb){_0x3df903['push'](_0x3df903['shift']());}};_0x5ec0f5(++_0xfd00c5);}(_0xc901,0x142));var _0x1c90=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xc901[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0x1c90('0x0'));var logger=require('../../../config/logger')('agi');var verticesWithRetry=['menu','getdigits',_0x1c90('0x1')];var Graph=function(){this[_0x1c90('0x2')]={};this['edges']={};this[_0x1c90('0x3')]=0x0;};Graph[_0x1c90('0x4')][_0x1c90('0x5')]=function(_0x2eff92){this[_0x1c90('0x2')][_0x2eff92['id']]=_0x2eff92;this[_0x1c90('0x6')][_0x2eff92['id']]=[];};Graph[_0x1c90('0x4')][_0x1c90('0x7')]=function(_0x423cfb,_0x19196f,_0x514386){this[_0x1c90('0x6')][_0x423cfb][_0x1c90('0x8')]({'target':_0x19196f,'condition':_0x514386});this[_0x1c90('0x3')]+=0x1;};Graph[_0x1c90('0x4')][_0x1c90('0x9')]=function(){return _[_0x1c90('0x9')](this[_0x1c90('0x2')]);};Graph[_0x1c90('0x4')]['relations']=function(){return this['numberOfEdges'];};Graph[_0x1c90('0x4')][_0x1c90('0xa')]=function(_0x327610){return this['vertices'][_0x327610];};Graph['prototype'][_0x1c90('0xb')]=function(_0x3353e3,_0x5e0f69){if(!this[_0x1c90('0x2')][_0x3353e3]){return logger[_0x1c90('0xc')](_0x1c90('0xd'));}var _0x589c97=_0x5e0f69(this[_0x1c90('0x2')][_0x3353e3]);if(!_0x589c97){return logger['info'](_0x1c90('0xe'));}if(this[_0x1c90('0x6')][_0x3353e3][_0x1c90('0xf')]===0x0){return logger[_0x1c90('0xc')]('no\x20edge/s\x20available');}for(var _0x296c5d=0x0,_0x526f4e=[],_0x2d3c90=![];_0x296c5d\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','close','Project\x20%s\x20not\x20published','Project\x20%s\x20not\x20found','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','./server','connection','xml2json','syncho','util','moment','../../config/environment','../../config/logger','../../config/license/util','./mailRpc','./graph','./vertices','agi','defaults','127.0.0.1','nextTick','error','stack','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','port','name','message','[ERROR]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','callerid','dnid','arg_1','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','uniqueid','evtHangup','agicommand','retry','maxRetry','addVertex','omit','mxCell','isArray','length','source','addEdge','target','getSquareProject','then','catch','createSquareReport','hasOwnProperty','indexOf','agi_','substring','inspect','debug','variables','stringify','timeout','hangup','production','start','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','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','code','response','result','toString','agicommand\x20not\x20found','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','finally','clear','vertex'];(function(_0x41026f,_0x3d0564){var _0xb75ff8=function(_0x9d57fe){while(--_0x9d57fe){_0x41026f['push'](_0x41026f['shift']());}};_0xb75ff8(++_0x3d0564);}(_0x4944,0x6d));var _0x4494=function(_0x26f1d7,_0x380095){_0x26f1d7=_0x26f1d7-0x0;var _0x3bce5b=_0x4944[_0x26f1d7];return _0x3bce5b;};'use strict';var parser=require(_0x4494('0x0'));var _=require('lodash');var syncho=require(_0x4494('0x1'));var util=require(_0x4494('0x2'));var moment=require(_0x4494('0x3'));var config=require(_0x4494('0x4'));var logger=require(_0x4494('0x5'))('agi');var utilLicense=require(_0x4494('0x6'));var rpc=require('./rpc');var mailRpc=require(_0x4494('0x7'));var Graph=require(_0x4494('0x8'));var Vertices=require(_0x4494('0x9'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x4494('0xa')]=_[_0x4494('0xb')](config[_0x4494('0xa')],{'ip':_0x4494('0xc'),'port':0x11dd});function connectionHandler(_0x12ef8e){process[_0x4494('0xd')](function(){syncho(function(){try{setChannelVariables(_0x12ef8e);agiHandler(_0x12ef8e);}catch(_0x5b14d5){logger[_0x4494('0xe')](_0x5b14d5[_0x4494('0xf')]);}});});}function listeningHandler(){console[_0x4494('0x10')](_0x4494('0x11'),config['agi']['port']);logger[_0x4494('0x12')](util[_0x4494('0x13')](_0x4494('0x14'),config['agi']['ip'],config['agi'][_0x4494('0x15')]));}function errorHandler(_0x435e4a){if(_0x435e4a&&_0x435e4a[_0x4494('0x16')]&&_0x435e4a[_0x4494('0x17')]){logger[_0x4494('0xe')](util[_0x4494('0x13')]('[%s]\x20%s',_0x435e4a[_0x4494('0x16')],_0x435e4a[_0x4494('0x17')]));}else{logger[_0x4494('0xe')](util[_0x4494('0x13')](_0x4494('0x18'),_0x435e4a[_0x4494('0xf')]));}}function closeHandler(){logger[_0x4494('0x12')](util['format'](_0x4494('0x19'),this['arg_1'],this['calleridname'],this[_0x4494('0x1a')],this[_0x4494('0x1b')],this['uniqueid']));try{createSquareReport(this);}catch(_0x49350a){logger[_0x4494('0xe')](_0x49350a['stack']);}}function timeoutHandler(){logger[_0x4494('0x12')](util[_0x4494('0x13')]('[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x4494('0x1c')],this['calleridname'],this[_0x4494('0x1a')],this[_0x4494('0x1b')],this['uniqueid']));}function hangupHandler(){logger['info'](util[_0x4494('0x13')](_0x4494('0x1d'),this[_0x4494('0x1c')],this[_0x4494('0x1e')],this[_0x4494('0x1a')],this[_0x4494('0x1b')],this[_0x4494('0x1f')]));this[_0x4494('0x20')]=!![];}function getRoot(_0x4cd309){return parser['toJson'](_0x4cd309,{'object':!![]})['mxGraphModel']['root'];}function addVertex(_0x197da5,_0x8b6c21,_0x1b3630){_0x8b6c21[_0x4494('0x21')]=_0x1b3630;if(_0x8b6c21['hasOwnProperty'](_0x4494('0x22'))){_0x8b6c21[_0x4494('0x23')]=parseInt(_0x8b6c21['retry'],0xa);}_0x197da5[_0x4494('0x24')](_[_0x4494('0x25')](_0x8b6c21,_0x4494('0x26')));}function initGraph(_0x4abe3c,_0xfc1631){var _0x5926fc=new Graph();for(var _0x3af50b in _0x4abe3c){if(_0x4abe3c['hasOwnProperty'](_0x3af50b)){if(_[_0x4494('0x27')](_0x4abe3c[_0x3af50b])){for(var _0x2fcc43=0x0;_0x2fcc43<_0x4abe3c[_0x3af50b][_0x4494('0x28')];_0x2fcc43+=0x1){addVertex(_0x5926fc,_0x4abe3c[_0x3af50b][_0x2fcc43],_0x3af50b);}}else{addVertex(_0x5926fc,_0x4abe3c[_0x3af50b],_0x3af50b);}}}for(var _0x54f1ea=0x0;_0x54f1ea<_0xfc1631[_0x4494('0x28')];_0x54f1ea+=0x1){if(_0xfc1631[_0x54f1ea][_0x4494('0x29')]&&_0xfc1631[_0x54f1ea]['target']){_0x5926fc[_0x4494('0x2a')](_0xfc1631[_0x54f1ea][_0x4494('0x29')],_0xfc1631[_0x54f1ea][_0x4494('0x2b')],_0xfc1631[_0x54f1ea]['value']);}}return _0x5926fc;}function getSquareProject(_0x96cdbb,_0x2e94af){rpc[_0x4494('0x2c')](_0x96cdbb)[_0x4494('0x2d')](function(_0x5a8a5b){_0x2e94af(null,_0x5a8a5b);})[_0x4494('0x2e')](function(_0x32f86f){_0x2e94af(null,_0x32f86f);});}function createSquareReport(_0xcce4da,_0x4d6607){rpc[_0x4494('0x2f')](_0xcce4da)[_0x4494('0x2d')](function(_0x51c69d){if(_0x4d6607){_0x4d6607(null,_0x51c69d);}})['catch'](function(_0x209fe8){if(_0x4d6607){_0x4d6607(null,_0x209fe8);}});}function setChannelVariables(_0x1c93f0){for(var _0x1d8e2f in _0x1c93f0){if(_0x1c93f0[_0x4494('0x30')](_0x1d8e2f)){if(_0x1d8e2f[_0x4494('0x31')](_0x4494('0x32'))===0x0){_0x1c93f0[_0x1d8e2f[_0x4494('0x33')](0x4)]=_0x1c93f0[_0x1d8e2f];delete _0x1c93f0[_0x1d8e2f];}}}}function getLogFromObject(_0x4e1656){return util[_0x4494('0x34')](_0x4e1656,{'showHidden':![],'depth':null});}function agiHandler(_0x1c6ff8){var _0x2f4740,_0x1f3306,_0x381ea8,_0x3cbe98,_0x5bba31;logger[_0x4494('0x35')](_0x4494('0x36'),JSON[_0x4494('0x37')](_0x1c6ff8,null,0x2));logger[_0x4494('0x12')](util[_0x4494('0x13')]('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x1c6ff8[_0x4494('0x1c')],_0x1c6ff8[_0x4494('0x1e')],_0x1c6ff8['callerid'],_0x1c6ff8[_0x4494('0x1b')],_0x1c6ff8['uniqueid']));_0x1c6ff8['on']('error',errorHandler);_0x1c6ff8['on']('close',closeHandler);_0x1c6ff8['on'](_0x4494('0x38'),timeoutHandler);_0x1c6ff8[_0x4494('0x20')]=![];_0x1c6ff8['on'](_0x4494('0x39'),hangupHandler);var _0x546133=getSquareProject['sync'](null,_0x1c6ff8[_0x4494('0x1c')]);if(_0x546133){if(_0x546133[_0x4494('0x3a')]){_0x2f4740=getRoot(_0x546133[_0x4494('0x3a')]);if(_0x2f4740&&_0x2f4740[_0x4494('0x3b')]){logger[_0x4494('0x35')](_0x4494('0x3c'),JSON[_0x4494('0x37')](_0x2f4740,null,0x2));_0x1c6ff8[_0x4494('0x3d')]=moment()[_0x4494('0x13')](_0x4494('0x3e'));_0x1f3306=initGraph(_[_0x4494('0x25')](_0x2f4740,_0x4494('0x26')),_0x2f4740[_0x4494('0x26')]);_0x381ea8=new Vertices(_0x1c6ff8,rpc,mailRpc);logger['info'](util[_0x4494('0x13')](_0x4494('0x3f'),_0x1c6ff8[_0x4494('0x1c')],_0x1c6ff8[_0x4494('0x1e')],_0x1c6ff8[_0x4494('0x1a')],_0x1c6ff8[_0x4494('0x1b')],_0x1c6ff8[_0x4494('0x1f')]));_0x1f3306[_0x4494('0x40')](_0x2f4740[_0x4494('0x3b')]['id'],function(_0x47f55c){try{_0x47f55c=_0x381ea8['clear'](_0x47f55c);logger[_0x4494('0x35')]('vertex',JSON[_0x4494('0x37')](_0x47f55c,null,0x2));if(_0x47f55c[_0x4494('0x21')]===_0x4494('0x41')){logger[_0x4494('0x12')](_0x4494('0x42'));_0x1c6ff8['context']=_0x47f55c['context']||_0x1c6ff8[_0x4494('0x43')];_0x1c6ff8['extension']=_0x47f55c[_0x4494('0x44')];_0x1c6ff8[_0x4494('0x45')]=_0x47f55c[_0x4494('0x45')]?_0x47f55c[_0x4494('0x45')]-0x1:0x1;return null;}else if(_0x47f55c&&_0x381ea8[_0x47f55c[_0x4494('0x21')]]){_0x5bba31=_0x381ea8[_0x47f55c[_0x4494('0x21')]](_0x47f55c);logger[_0x4494('0x12')]('response',JSON[_0x4494('0x37')](_0x5bba31,null,0x2));if(_0x5bba31&&_0x5bba31[_0x4494('0x46')]===AGI_CODE_SUCCESS&&_0x5bba31['result']!==AGI_RESULT_ERROR&&!_0x1c6ff8[_0x4494('0x20')]){logger[_0x4494('0x35')](_0x4494('0x47'),getLogFromObject(_0x5bba31));return _['isUndefined'](_0x5bba31[_0x4494('0x48')])?null:_0x5bba31[_0x4494('0x48')][_0x4494('0x49')]();}else{logger[_0x4494('0xe')]('response',getLogFromObject(_0x5bba31));return null;}}else{logger['error'](_0x4494('0x4a'));return null;}}catch(_0x3b9995){logger[_0x4494('0xe')](_0x3b9995['stack']);return null;}});if(_0x2f4740['finally']){logger[_0x4494('0x12')](util[_0x4494('0x13')](_0x4494('0x4b'),_0x1c6ff8['arg_1'],_0x1c6ff8[_0x4494('0x1e')],_0x1c6ff8[_0x4494('0x1a')],_0x1c6ff8['dnid'],_0x1c6ff8[_0x4494('0x1f')]));_0x1f3306[_0x4494('0x40')](_0x2f4740[_0x4494('0x4c')]['id'],function(_0x3d6647){try{_0x3d6647=_0x381ea8[_0x4494('0x4d')](_0x3d6647);logger['debug'](_0x4494('0x4e'),JSON[_0x4494('0x37')](_0x3d6647,null,0x2));if(_0x3d6647&&_0x381ea8[_0x3d6647[_0x4494('0x21')]]){_0x5bba31=_0x381ea8[_0x3d6647[_0x4494('0x21')]](_0x3d6647);if(_0x5bba31){logger[_0x4494('0x35')](_0x4494('0x47'),getLogFromObject(_0x5bba31));return _[_0x4494('0x4f')](_0x5bba31[_0x4494('0x48')])?null:_0x5bba31[_0x4494('0x48')][_0x4494('0x49')]();}else{logger['error'](_0x4494('0x47'),getLogFromObject(_0x5bba31));return null;}}else{logger['error'](_0x4494('0x4a'));return null;}}catch(_0x3d90bc){logger[_0x4494('0xe')](_0x3d90bc[_0x4494('0xf')]);return null;}});}logger[_0x4494('0x12')](util['format'](_0x4494('0x50'),_0x1c6ff8['arg_1'],_0x1c6ff8['calleridname'],_0x1c6ff8['callerid'],_0x1c6ff8['dnid'],_0x1c6ff8['uniqueid']));logger[_0x4494('0x12')](util[_0x4494('0x13')](_0x4494('0x51'),_0x1c6ff8[_0x4494('0x43')],_0x1c6ff8[_0x4494('0x44')],parseInt(_0x1c6ff8[_0x4494('0x45')],0xa)+0x1));_0x1c6ff8[_0x4494('0x52')](_0x1c6ff8['context'],_0x1c6ff8['extension'],parseInt(_0x1c6ff8['priority'],0xa)+0x1);_0x1c6ff8[_0x4494('0x53')]();}}else{logger[_0x4494('0xe')](util['format'](_0x4494('0x54'),_0x1c6ff8[_0x4494('0x1c')]));_0x1c6ff8[_0x4494('0x52')](_0x1c6ff8[_0x4494('0x43')],_0x1c6ff8[_0x4494('0x44')],parseInt(_0x1c6ff8['priority'],0xa)+0x1);_0x1c6ff8[_0x4494('0x53')]();}}else{logger['error'](util['format'](_0x4494('0x55'),_0x1c6ff8['arg_1']));_0x1c6ff8[_0x4494('0x52')](_0x1c6ff8[_0x4494('0x43')],_0x1c6ff8['extension'],parseInt(_0x1c6ff8['priority'],0xa)+0x1);_0x1c6ff8[_0x4494('0x53')]();}}function main(){var _0x2fb2f3;return utilLicense[_0x4494('0x56')]()['then'](function(_0x2ea074){if(_0x2ea074){if(_0x2ea074[_0x4494('0x57')]){if(_0x2ea074[_0x4494('0x58')]&&_0x2ea074[_0x4494('0x58')]>0x0){logger[_0x4494('0x12')](util[_0x4494('0x13')]('[LICENSE]\x20CHANNELS:\x20%s',_0x2ea074['callysquare']));_0x2fb2f3=_0x2ea074[_0x4494('0x58')];}else{logger['info'](_0x4494('0x59'));}}else{logger[_0x4494('0x12')](_0x4494('0x5a'));_0x2fb2f3=-0x1;}}})['catch'](function(_0x4dd3af){logger[_0x4494('0xe')](_0x4494('0x5b'),_0x4dd3af[_0x4494('0xf')]);})[_0x4494('0x4c')](function(){var _0x3dc04a=require(_0x4494('0x5c'))(config[_0x4494('0xa')]['port'],config[_0x4494('0xa')]['ip'],_0x2fb2f3);_0x3dc04a['on'](_0x4494('0xe'),errorHandler);_0x3dc04a['on']('listening',listeningHandler);_0x3dc04a['on'](_0x4494('0x5d'),connectionHandler);_0x3dc04a['on'](_0x4494('0x53'),closeHandler);});}main(); \ No newline at end of file +var _0xcb81=['Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','message','[ERROR]\x20%s','stack','arg_1','callerid','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','root','agicommand','hasOwnProperty','retry','addVertex','omit','mxCell','isArray','length','source','target','addEdge','value','getSquareProject','then','createSquareReport','catch','indexOf','agi_','substring','debug','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','hangup','sync','production','joinAt','start','clear','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','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','traverseBFS','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','continueAt','Project\x20%s\x20not\x20found','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','./server','listening','connection','xml2json','lodash','util','agi','../../config/license/util','./rpc','./mailRpc','./graph','defaults','127.0.0.1','nextTick','error'];(function(_0x284bc3,_0x22dffe){var _0x41ac81=function(_0x47031f){while(--_0x47031f){_0x284bc3['push'](_0x284bc3['shift']());}};_0x41ac81(++_0x22dffe);}(_0xcb81,0x154));var _0x1cb8=function(_0x3da832,_0x2133f1){_0x3da832=_0x3da832-0x0;var _0xe602f2=_0xcb81[_0x3da832];return _0xe602f2;};'use strict';var parser=require(_0x1cb8('0x0'));var _=require(_0x1cb8('0x1'));var syncho=require('syncho');var util=require(_0x1cb8('0x2'));var moment=require('moment');var config=require('../../config/environment');var logger=require('../../config/logger')(_0x1cb8('0x3'));var utilLicense=require(_0x1cb8('0x4'));var rpc=require(_0x1cb8('0x5'));var mailRpc=require(_0x1cb8('0x6'));var Graph=require(_0x1cb8('0x7'));var Vertices=require('./vertices');var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x1cb8('0x3')]=_[_0x1cb8('0x8')](config['agi'],{'ip':_0x1cb8('0x9'),'port':0x11dd});function connectionHandler(_0x39b4ad){process[_0x1cb8('0xa')](function(){syncho(function(){try{setChannelVariables(_0x39b4ad);agiHandler(_0x39b4ad);}catch(_0x503efb){logger[_0x1cb8('0xb')](_0x503efb['stack']);}});});}function listeningHandler(){console['log'](_0x1cb8('0xc'),config[_0x1cb8('0x3')][_0x1cb8('0xd')]);logger[_0x1cb8('0xe')](util[_0x1cb8('0xf')](_0x1cb8('0x10'),config[_0x1cb8('0x3')]['ip'],config[_0x1cb8('0x3')]['port']));}function errorHandler(_0x2fb18e){if(_0x2fb18e&&_0x2fb18e[_0x1cb8('0x11')]&&_0x2fb18e[_0x1cb8('0x12')]){logger[_0x1cb8('0xb')](util[_0x1cb8('0xf')]('[%s]\x20%s',_0x2fb18e[_0x1cb8('0x11')],_0x2fb18e[_0x1cb8('0x12')]));}else{logger[_0x1cb8('0xb')](util[_0x1cb8('0xf')](_0x1cb8('0x13'),_0x2fb18e[_0x1cb8('0x14')]));}}function closeHandler(){logger[_0x1cb8('0xe')](util[_0x1cb8('0xf')]('[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x1cb8('0x15')],this['calleridname'],this[_0x1cb8('0x16')],this[_0x1cb8('0x17')],this[_0x1cb8('0x18')]));try{createSquareReport(this);}catch(_0x46abd0){logger[_0x1cb8('0xb')](_0x46abd0[_0x1cb8('0x14')]);}}function timeoutHandler(){logger[_0x1cb8('0xe')](util[_0x1cb8('0xf')](_0x1cb8('0x19'),this[_0x1cb8('0x15')],this[_0x1cb8('0x1a')],this[_0x1cb8('0x16')],this['dnid'],this[_0x1cb8('0x18')]));}function hangupHandler(){logger[_0x1cb8('0xe')](util[_0x1cb8('0xf')](_0x1cb8('0x1b'),this['arg_1'],this[_0x1cb8('0x1a')],this['callerid'],this[_0x1cb8('0x17')],this[_0x1cb8('0x18')]));this[_0x1cb8('0x1c')]=!![];}function getRoot(_0x38ff3a){return parser['toJson'](_0x38ff3a,{'object':!![]})['mxGraphModel'][_0x1cb8('0x1d')];}function addVertex(_0x4040be,_0x22dafe,_0x44a00d){_0x22dafe[_0x1cb8('0x1e')]=_0x44a00d;if(_0x22dafe[_0x1cb8('0x1f')](_0x1cb8('0x20'))){_0x22dafe['maxRetry']=parseInt(_0x22dafe[_0x1cb8('0x20')],0xa);}_0x4040be[_0x1cb8('0x21')](_[_0x1cb8('0x22')](_0x22dafe,_0x1cb8('0x23')));}function initGraph(_0x17f5f8,_0x41ab56){var _0x4ca3be=new Graph();for(var _0x1ec995 in _0x17f5f8){if(_0x17f5f8[_0x1cb8('0x1f')](_0x1ec995)){if(_[_0x1cb8('0x24')](_0x17f5f8[_0x1ec995])){for(var _0x3c1905=0x0;_0x3c1905<_0x17f5f8[_0x1ec995][_0x1cb8('0x25')];_0x3c1905+=0x1){addVertex(_0x4ca3be,_0x17f5f8[_0x1ec995][_0x3c1905],_0x1ec995);}}else{addVertex(_0x4ca3be,_0x17f5f8[_0x1ec995],_0x1ec995);}}}for(var _0x4a9b74=0x0;_0x4a9b74<_0x41ab56[_0x1cb8('0x25')];_0x4a9b74+=0x1){if(_0x41ab56[_0x4a9b74][_0x1cb8('0x26')]&&_0x41ab56[_0x4a9b74][_0x1cb8('0x27')]){_0x4ca3be[_0x1cb8('0x28')](_0x41ab56[_0x4a9b74]['source'],_0x41ab56[_0x4a9b74][_0x1cb8('0x27')],_0x41ab56[_0x4a9b74][_0x1cb8('0x29')]);}}return _0x4ca3be;}function getSquareProject(_0x3a6a67,_0x5bf630){rpc[_0x1cb8('0x2a')](_0x3a6a67)[_0x1cb8('0x2b')](function(_0x17abe1){_0x5bf630(null,_0x17abe1);})['catch'](function(_0x73be67){_0x5bf630(null,_0x73be67);});}function createSquareReport(_0x3e2af4,_0x239c62){rpc[_0x1cb8('0x2c')](_0x3e2af4)[_0x1cb8('0x2b')](function(_0x54278d){if(_0x239c62){_0x239c62(null,_0x54278d);}})[_0x1cb8('0x2d')](function(_0x1de806){if(_0x239c62){_0x239c62(null,_0x1de806);}});}function setChannelVariables(_0x21fde7){for(var _0x1413a2 in _0x21fde7){if(_0x21fde7[_0x1cb8('0x1f')](_0x1413a2)){if(_0x1413a2[_0x1cb8('0x2e')](_0x1cb8('0x2f'))===0x0){_0x21fde7[_0x1413a2[_0x1cb8('0x30')](0x4)]=_0x21fde7[_0x1413a2];delete _0x21fde7[_0x1413a2];}}}}function getLogFromObject(_0x1aaae4){return util['inspect'](_0x1aaae4,{'showHidden':![],'depth':null});}function agiHandler(_0x5cd6bd){var _0x427ddf,_0x14b801,_0x18a003,_0x5be4b7,_0x5f04e3;logger[_0x1cb8('0x31')](_0x1cb8('0x32'),JSON[_0x1cb8('0x33')](_0x5cd6bd,null,0x2));logger[_0x1cb8('0xe')](util[_0x1cb8('0xf')](_0x1cb8('0x34'),_0x5cd6bd[_0x1cb8('0x15')],_0x5cd6bd[_0x1cb8('0x1a')],_0x5cd6bd['callerid'],_0x5cd6bd[_0x1cb8('0x17')],_0x5cd6bd[_0x1cb8('0x18')]));_0x5cd6bd['on'](_0x1cb8('0xb'),errorHandler);_0x5cd6bd['on'](_0x1cb8('0x35'),closeHandler);_0x5cd6bd['on'](_0x1cb8('0x36'),timeoutHandler);_0x5cd6bd[_0x1cb8('0x1c')]=![];_0x5cd6bd['on'](_0x1cb8('0x37'),hangupHandler);var _0x2ad7f6=getSquareProject[_0x1cb8('0x38')](null,_0x5cd6bd['arg_1']);if(_0x2ad7f6){if(_0x2ad7f6[_0x1cb8('0x39')]){_0x427ddf=getRoot(_0x2ad7f6[_0x1cb8('0x39')]);if(_0x427ddf&&_0x427ddf['start']){logger[_0x1cb8('0x31')](_0x1cb8('0x1d'),JSON[_0x1cb8('0x33')](_0x427ddf,null,0x2));_0x5cd6bd[_0x1cb8('0x3a')]=moment()[_0x1cb8('0xf')]('YYYY-MM-DD\x20HH:mm:ss');_0x14b801=initGraph(_[_0x1cb8('0x22')](_0x427ddf,_0x1cb8('0x23')),_0x427ddf[_0x1cb8('0x23')]);_0x18a003=new Vertices(_0x5cd6bd,rpc,mailRpc);logger['info'](util['format']('[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x5cd6bd[_0x1cb8('0x15')],_0x5cd6bd[_0x1cb8('0x1a')],_0x5cd6bd[_0x1cb8('0x16')],_0x5cd6bd[_0x1cb8('0x17')],_0x5cd6bd['uniqueid']));_0x14b801['traverseBFS'](_0x427ddf[_0x1cb8('0x3b')]['id'],function(_0x25f0a3){try{_0x25f0a3=_0x18a003[_0x1cb8('0x3c')](_0x25f0a3);logger[_0x1cb8('0x31')](_0x1cb8('0x3d'),JSON[_0x1cb8('0x33')](_0x25f0a3,null,0x2));if(_0x25f0a3[_0x1cb8('0x1e')]===_0x1cb8('0x3e')){logger['info'](_0x1cb8('0x3f'));_0x5cd6bd[_0x1cb8('0x40')]=_0x25f0a3[_0x1cb8('0x40')]||_0x5cd6bd[_0x1cb8('0x40')];_0x5cd6bd['extension']=_0x25f0a3[_0x1cb8('0x41')];_0x5cd6bd['priority']=_0x25f0a3[_0x1cb8('0x42')]?_0x25f0a3[_0x1cb8('0x42')]-0x1:0x1;return null;}else if(_0x25f0a3&&_0x18a003[_0x25f0a3['agicommand']]){_0x5f04e3=_0x18a003[_0x25f0a3[_0x1cb8('0x1e')]](_0x25f0a3);logger[_0x1cb8('0xe')](_0x1cb8('0x43'),JSON['stringify'](_0x5f04e3,null,0x2));if(_0x5f04e3&&_0x5f04e3['code']===AGI_CODE_SUCCESS&&_0x5f04e3[_0x1cb8('0x44')]!==AGI_RESULT_ERROR&&!_0x5cd6bd['evtHangup']){logger[_0x1cb8('0x31')](_0x1cb8('0x43'),getLogFromObject(_0x5f04e3));return _[_0x1cb8('0x45')](_0x5f04e3[_0x1cb8('0x44')])?null:_0x5f04e3[_0x1cb8('0x44')][_0x1cb8('0x46')]();}else{logger[_0x1cb8('0xb')]('response',getLogFromObject(_0x5f04e3));return null;}}else{logger[_0x1cb8('0xb')](_0x1cb8('0x47'));return null;}}catch(_0x1ebce5){logger[_0x1cb8('0xb')](_0x1ebce5['stack']);return null;}});if(_0x427ddf[_0x1cb8('0x48')]){logger[_0x1cb8('0xe')](util[_0x1cb8('0xf')](_0x1cb8('0x49'),_0x5cd6bd[_0x1cb8('0x15')],_0x5cd6bd['calleridname'],_0x5cd6bd[_0x1cb8('0x16')],_0x5cd6bd[_0x1cb8('0x17')],_0x5cd6bd[_0x1cb8('0x18')]));_0x14b801[_0x1cb8('0x4a')](_0x427ddf[_0x1cb8('0x48')]['id'],function(_0x53ee69){try{_0x53ee69=_0x18a003[_0x1cb8('0x3c')](_0x53ee69);logger[_0x1cb8('0x31')]('vertex',JSON[_0x1cb8('0x33')](_0x53ee69,null,0x2));if(_0x53ee69&&_0x18a003[_0x53ee69[_0x1cb8('0x1e')]]){_0x5f04e3=_0x18a003[_0x53ee69[_0x1cb8('0x1e')]](_0x53ee69);if(_0x5f04e3){logger[_0x1cb8('0x31')](_0x1cb8('0x43'),getLogFromObject(_0x5f04e3));return _[_0x1cb8('0x45')](_0x5f04e3[_0x1cb8('0x44')])?null:_0x5f04e3[_0x1cb8('0x44')][_0x1cb8('0x46')]();}else{logger[_0x1cb8('0xb')](_0x1cb8('0x43'),getLogFromObject(_0x5f04e3));return null;}}else{logger[_0x1cb8('0xb')](_0x1cb8('0x47'));return null;}}catch(_0x2bbad1){logger['error'](_0x2bbad1[_0x1cb8('0x14')]);return null;}});}logger[_0x1cb8('0xe')](util[_0x1cb8('0xf')](_0x1cb8('0x4b'),_0x5cd6bd[_0x1cb8('0x15')],_0x5cd6bd[_0x1cb8('0x1a')],_0x5cd6bd[_0x1cb8('0x16')],_0x5cd6bd['dnid'],_0x5cd6bd[_0x1cb8('0x18')]));logger[_0x1cb8('0xe')](util[_0x1cb8('0xf')]('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0x5cd6bd['context'],_0x5cd6bd[_0x1cb8('0x41')],parseInt(_0x5cd6bd[_0x1cb8('0x42')],0xa)+0x1));_0x5cd6bd[_0x1cb8('0x4c')](_0x5cd6bd[_0x1cb8('0x40')],_0x5cd6bd[_0x1cb8('0x41')],parseInt(_0x5cd6bd['priority'],0xa)+0x1);_0x5cd6bd[_0x1cb8('0x35')]();}}else{logger[_0x1cb8('0xb')](util[_0x1cb8('0xf')]('Project\x20%s\x20not\x20published',_0x5cd6bd['arg_1']));_0x5cd6bd['continueAt'](_0x5cd6bd[_0x1cb8('0x40')],_0x5cd6bd['extension'],parseInt(_0x5cd6bd[_0x1cb8('0x42')],0xa)+0x1);_0x5cd6bd[_0x1cb8('0x35')]();}}else{logger[_0x1cb8('0xb')](util[_0x1cb8('0xf')](_0x1cb8('0x4d'),_0x5cd6bd['arg_1']));_0x5cd6bd[_0x1cb8('0x4c')](_0x5cd6bd[_0x1cb8('0x40')],_0x5cd6bd[_0x1cb8('0x41')],parseInt(_0x5cd6bd[_0x1cb8('0x42')],0xa)+0x1);_0x5cd6bd[_0x1cb8('0x35')]();}}function main(){var _0xef4da4;return utilLicense[_0x1cb8('0x4e')]()['then'](function(_0x1f0dea){if(_0x1f0dea){if(_0x1f0dea[_0x1cb8('0x4f')]){if(_0x1f0dea[_0x1cb8('0x50')]&&_0x1f0dea[_0x1cb8('0x50')]>0x0){logger[_0x1cb8('0xe')](util[_0x1cb8('0xf')](_0x1cb8('0x51'),_0x1f0dea['callysquare']));_0xef4da4=_0x1f0dea['callysquare'];}else{logger['info'](_0x1cb8('0x52'));}}else{logger['info'](_0x1cb8('0x53'));_0xef4da4=-0x1;}}})[_0x1cb8('0x2d')](function(_0x1c801e){logger[_0x1cb8('0xb')](_0x1cb8('0x54'),_0x1c801e['stack']);})['finally'](function(){var _0x5de2b2=require(_0x1cb8('0x55'))(config[_0x1cb8('0x3')]['port'],config[_0x1cb8('0x3')]['ip'],_0xef4da4);_0x5de2b2['on']('error',errorHandler);_0x5de2b2['on'](_0x1cb8('0x56'),listeningHandler);_0x5de2b2['on'](_0x1cb8('0x57'),connectionHandler);_0x5de2b2['on']('close',closeHandler);});}main(); \ No newline at end of file diff --git a/server/services/agi/mailRpc/index.js b/server/services/agi/mailRpc/index.js index 562ca0f..9fb1387 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 _0x814b=['bluebird','jayson/promise','client','http','request','then','error','result','catch','sendMailMessage','SendMail'];(function(_0x2e848a,_0x41ba86){var _0xf43e6a=function(_0x2f9fd6){while(--_0x2f9fd6){_0x2e848a['push'](_0x2e848a['shift']());}};_0xf43e6a(++_0x41ba86);}(_0x814b,0x1a2));var _0xb814=function(_0x489b87,_0xd51c93){_0x489b87=_0x489b87-0x0;var _0x1823b6=_0x814b[_0x489b87];return _0x1823b6;};'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 +var _0x9957=['result','catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request','error','message'];(function(_0x547f87,_0x25fe33){var _0xdf07ae=function(_0x29821a){while(--_0x29821a){_0x547f87['push'](_0x547f87['shift']());}};_0xdf07ae(++_0x25fe33);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'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 diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index eb29bf7..4d88a47 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 _0x7a54=['substring','length','split','indexOf','slice','trim','emit','util','stream','Transform','call','_localBuffer','inherits','prototype','_transform','toString','_inBody'];(function(_0x27acd4,_0x2cb514){var _0xa64ff3=function(_0x156784){while(--_0x156784){_0x27acd4['push'](_0x27acd4['shift']());}};_0xa64ff3(++_0x2cb514);}(_0x7a54,0x106));var _0x47a5=function(_0x5c48f5,_0x3739a3){_0x5c48f5=_0x5c48f5-0x0;var _0x53de8b=_0x7a54[_0x5c48f5];return _0x53de8b;};'use strict';var util=require(_0x47a5('0x0'));var Transform=require(_0x47a5('0x1'))[_0x47a5('0x2')];function AGIReply(_0x58157c){Transform[_0x47a5('0x3')](this,_0x58157c);this[_0x47a5('0x4')]='';this['_inBody']=![];}util[_0x47a5('0x5')](AGIReply,Transform);AGIReply[_0x47a5('0x6')][_0x47a5('0x7')]=function(_0x3717e1,_0xfdf934,_0x545a97){var _0x3d5629='\x0a',_0x59199c=['\x0a\x0a','\x0d\x0a\x0d\x0a'],_0x343372=-0x1,_0x30e405=-0x1,_0x506eda='',_0x194fb0=0x0,_0x5077f3='',_0x5d90b3='';this[_0x47a5('0x4')]+=_0x3717e1[_0x47a5('0x8')]();_0x5077f3=this['_localBuffer'];if(!this[_0x47a5('0x9')]){_0x194fb0=0x0;while(_0x59199c[_0x194fb0]){while((_0x30e405=_0x5077f3['indexOf'](_0x59199c[_0x194fb0]))!=-0x1){_0x506eda=_0x59199c[_0x194fb0];_0x5d90b3=_0x5077f3['substring'](0x0,_0x30e405);_0x5077f3=_0x5077f3[_0x47a5('0xa')](_0x30e405+_0x506eda[_0x47a5('0xb')]);var _0x2f399b=_0x5d90b3[_0x47a5('0xc')](_0x3d5629),_0x250fad=0x0,_0xd612dd={},_0xd308b8='',_0x1eae59='',_0x5beb89=-0x1;while(_0x2f399b[_0x250fad]){_0x5beb89=_0x2f399b[_0x250fad][_0x47a5('0xd')](':');if(_0x5beb89!=-0x1){_0xd308b8=_0x2f399b[_0x250fad][_0x47a5('0xe')](0x0,_0x5beb89)[_0x47a5('0xf')]();_0x1eae59=_0x2f399b[_0x250fad][_0x47a5('0xe')](_0x5beb89+0x1)[_0x47a5('0xf')]();if(_0xd308b8[_0x47a5('0xb')]>0x0){_0xd612dd[_0xd308b8]=_0x1eae59;}}else{}_0x250fad++;}this[_0x47a5('0x10')]('headers',_0xd612dd);this[_0x47a5('0x9')]=!![];}_0x194fb0++;}this[_0x47a5('0x4')]=_0x5077f3;}else{while((_0x343372=_0x5077f3[_0x47a5('0xd')](_0x3d5629))!=-0x1){_0x5d90b3=_0x5077f3[_0x47a5('0xa')](0x0,_0x343372);this[_0x47a5('0x10')]('line',_0x5d90b3);_0x5077f3=_0x5077f3['substring'](_0x343372+_0x3d5629[_0x47a5('0xb')]);}this['_localBuffer']=_0x5077f3;}_0x545a97();};module['exports']=AGIReply; \ No newline at end of file +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(_0x30cb96,_0x31b9e1){var _0xeff506=function(_0x5ad5f7){while(--_0x5ad5f7){_0x30cb96['push'](_0x30cb96['shift']());}};_0xeff506(++_0x31b9e1);}(_0x5f2f,0x73));var _0xf5f2=function(_0x2e7692,_0x1421a0){_0x2e7692=_0x2e7692-0x0;var _0x2b4ad5=_0x5f2f[_0x2e7692];return _0x2b4ad5;};'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 diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 02faaef..d6a2ea7 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 _0x098b=['util','request','then','error','message','catch','getSquareProject','production','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','getSquareProjectById','ShowSquareProject','name','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','ShowUser','getSoundById','ShowSound','save_name','Intervals','getSmsAccountById','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','arg_2','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','CreateSquareMessage','createCmContact','ShowCmHopper','phone','ListId','CreateCmContact','getPauseById','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','UnpauseUser','agentLogout','bluebird','moment'];(function(_0x257635,_0x4201bc){var _0x77bf6e=function(_0xd9f568){while(--_0xd9f568){_0x257635['push'](_0x257635['shift']());}};_0x77bf6e(++_0x4201bc);}(_0x098b,0x6c));var _0xb098=function(_0x5c3d1d,_0x340abf){_0x5c3d1d=_0x5c3d1d-0x0;var _0x30e0e6=_0x098b[_0x5c3d1d];return _0x30e0e6;};'use strict';var BPromise=require(_0xb098('0x0'));var moment=require(_0xb098('0x1'));var _=require('lodash');var util=require(_0xb098('0x2'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x2329});function request(_0x2cff34,_0x1b47d2){return new BPromise(function(_0x1ca1e7,_0x1fc014){return client[_0xb098('0x3')](_0x2cff34,_0x1b47d2)[_0xb098('0x4')](function(_0x5747a2){if(_0x5747a2[_0xb098('0x5')]){return _0x1fc014(_0x5747a2[_0xb098('0x5')][_0xb098('0x6')]);}else{return _0x1ca1e7(_0x5747a2['result']);}})[_0xb098('0x7')](function(_0x5138e4){return _0x1fc014(_0x5138e4);});});}exports[_0xb098('0x8')]=function(_0x545561){return request('ShowSquareProject',{'options':{'raw':![],'where':{'name':_0x545561},'attributes':[_0xb098('0x9')]}});};exports[_0xb098('0xa')]=function(_0x411e28){return request(_0xb098('0xb'),{'options':{'raw':![],'where':{'id':_0x411e28},'include':[{'model':_0xb098('0xc'),'as':_0xb098('0xd')}],'attributes':['id','name','email']}});};exports[_0xb098('0xe')]=function(_0xa9ca37){return request(_0xb098('0xf'),{'options':{'where':{'id':_0xa9ca37},'attributes':[_0xb098('0x10')]}});};exports[_0xb098('0x11')]=function(_0x1756a9){return request(_0xb098('0x12'),{'options':{'where':{'id':_0x1756a9},'attributes':['name']}});};exports[_0xb098('0x13')]=function(_0x3d4968){return request(_0xb098('0x14'),{'options':{'where':{'id':_0x3d4968},'attributes':[_0xb098('0x10')]}});};exports[_0xb098('0x15')]=function(_0x20a588){return request(_0xb098('0x16'),{'options':{'where':{'id':_0x20a588},'attributes':[_0xb098('0x17')]}});};exports[_0xb098('0x18')]=function(_0x4623a3){return request(_0xb098('0x19'),{'options':{'where':{'id':_0x4623a3},'attributes':['name']}});};exports['getTrunkById']=function(_0x1ea296){return request('ShowTrunk',{'options':{'where':{'id':_0x1ea296},'attributes':['name']}});};exports[_0xb098('0x1a')]=function(_0x18bbd5){return request(_0xb098('0x1b'),{'options':{'where':{'id':_0x18bbd5},'attributes':[_0xb098('0x1c')]}});};exports['getIntervalById']=function(_0x2bed25){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x2bed25},'include':[{'model':'Interval','as':_0xb098('0x1d')}]}});};exports[_0xb098('0x1e')]=function(_0x50c7cc){return request('ShowSmsAccount',{'options':{'where':{'id':_0x50c7cc},'attributes':['id','name']}});};exports[_0xb098('0x1f')]=function(_0x3024c7){return request(_0xb098('0x20'),{'body':_0x3024c7});};exports[_0xb098('0x21')]=function(_0x35b064){return request(_0xb098('0x22'),{'body':_0x35b064});};exports[_0xb098('0x23')]=function(_0x18c6d3){return request('CreateSquareReport',{'body':_['merge'](_0x18c6d3,{'project_name':_0x18c6d3['arg_1'],'prev_project_name':_0x18c6d3[_0xb098('0x24')]||'','is_subproject':_0x18c6d3[_0xb098('0x24')]?!![]:![],'leaveAt':moment()['format'](_0xb098('0x25'))})});};exports[_0xb098('0x26')]=function(_0x2fb629){return request(_0xb098('0x27'),{'body':_0x2fb629});};exports['createSquareMessage']=function(_0x33264d){return request(_0xb098('0x28'),{'body':_0x33264d});};exports[_0xb098('0x29')]=function(_0x3c9476){return request(_0xb098('0x2a'),{'options':{'raw':![],'where':{'phone':_0x3c9476[_0xb098('0x2b')],'ListId':_0x3c9476[_0xb098('0x2c')]}}})[_0xb098('0x4')](function(_0x59d4a7){if(_0x59d4a7){return _0x59d4a7;}return request(_0xb098('0x2d'),{'body':_0x3c9476});});};exports[_0xb098('0x2e')]=function(_0x58fc83){return request(_0xb098('0x2f'),{'options':{'where':{'id':_0x58fc83},'attributes':[_0xb098('0x10')]}});};exports[_0xb098('0x30')]=function(_0x335e3c,_0x5abad8){return request(_0xb098('0x31'),{'body':{'interface':_0x5abad8},'options':{'where':_0x335e3c}});};exports[_0xb098('0x32')]=function(_0x56ec4d,_0x2068fa,_0x2d111d){return request(_0xb098('0x33'),{'body':{'type':_0x2068fa,'uniqueid':_0x2d111d},'options':{'where':_0x56ec4d}});};exports[_0xb098('0x34')]=function(_0x43e185){return request(_0xb098('0x35'),{'body':{},'options':{'where':_0x43e185}});};exports[_0xb098('0x36')]=function(_0x48e81a){return request('LogoutUser',{'body':{},'options':{'where':_0x48e81a}});}; \ No newline at end of file +var _0x79bb=['createCmContact','ShowCmHopper','phone','ListId','CreateCmContact','getPauseById','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','UnpauseUser','LogoutUser','moment','lodash','util','jayson/promise','client','http','then','message','result','catch','getSquareProject','production','MailServerOut','name','email','getSquareProjectById','ShowSquareProject','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','dsn','getUserById','ShowUser','ShowTrunk','getSoundById','ShowSound','save_name','getIntervalById','Interval','Intervals','getSmsAccountById','createSmsMessage','CreateSmsMessage','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareMessage'];(function(_0x1191ab,_0x3e701e){var _0x2503a7=function(_0x1aad3a){while(--_0x1aad3a){_0x1191ab['push'](_0x1191ab['shift']());}};_0x2503a7(++_0x3e701e);}(_0x79bb,0x1dd));var _0xb79b=function(_0x4568d1,_0xfcd25a){_0x4568d1=_0x4568d1-0x0;var _0x2e9cf5=_0x79bb[_0x4568d1];return _0x2e9cf5;};'use strict';var BPromise=require('bluebird');var moment=require(_0xb79b('0x0'));var _=require(_0xb79b('0x1'));var util=require(_0xb79b('0x2'));var jayson=require(_0xb79b('0x3'));var client=jayson[_0xb79b('0x4')][_0xb79b('0x5')]({'port':0x2329});function request(_0x5bbe77,_0x1cad3c){return new BPromise(function(_0x279c05,_0x4ec2c2){return client['request'](_0x5bbe77,_0x1cad3c)[_0xb79b('0x6')](function(_0x1e91d0){if(_0x1e91d0['error']){return _0x4ec2c2(_0x1e91d0['error'][_0xb79b('0x7')]);}else{return _0x279c05(_0x1e91d0[_0xb79b('0x8')]);}})[_0xb79b('0x9')](function(_0x33ead8){return _0x4ec2c2(_0x33ead8);});});}exports[_0xb79b('0xa')]=function(_0x6f7e98){return request('ShowSquareProject',{'options':{'raw':![],'where':{'name':_0x6f7e98},'attributes':[_0xb79b('0xb')]}});};exports['getMailAccountById']=function(_0x3dcb96){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0x3dcb96},'include':[{'model':_0xb79b('0xc'),'as':'Smtp'}],'attributes':['id',_0xb79b('0xd'),_0xb79b('0xe')]}});};exports[_0xb79b('0xf')]=function(_0x26d85a){return request(_0xb79b('0x10'),{'options':{'where':{'id':_0x26d85a},'attributes':[_0xb79b('0xd')]}});};exports[_0xb79b('0x11')]=function(_0x378860){return request(_0xb79b('0x12'),{'options':{'where':{'id':_0x378860},'attributes':[_0xb79b('0xd')]}});};exports[_0xb79b('0x13')]=function(_0x5799e4){return request(_0xb79b('0x14'),{'options':{'where':{'id':_0x5799e4},'attributes':['name']}});};exports[_0xb79b('0x15')]=function(_0x419a37){return request('ShowSquareOdbc',{'options':{'where':{'id':_0x419a37},'attributes':[_0xb79b('0x16')]}});};exports[_0xb79b('0x17')]=function(_0x4c90b2){return request(_0xb79b('0x18'),{'options':{'where':{'id':_0x4c90b2},'attributes':['name']}});};exports['getTrunkById']=function(_0x22fd27){return request(_0xb79b('0x19'),{'options':{'where':{'id':_0x22fd27},'attributes':[_0xb79b('0xd')]}});};exports[_0xb79b('0x1a')]=function(_0x1fdd73){return request(_0xb79b('0x1b'),{'options':{'where':{'id':_0x1fdd73},'attributes':[_0xb79b('0x1c')]}});};exports[_0xb79b('0x1d')]=function(_0x546abc){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x546abc},'include':[{'model':_0xb79b('0x1e'),'as':_0xb79b('0x1f')}]}});};exports[_0xb79b('0x20')]=function(_0x463eb3){return request('ShowSmsAccount',{'options':{'where':{'id':_0x463eb3},'attributes':['id',_0xb79b('0xd')]}});};exports[_0xb79b('0x21')]=function(_0x306cd9){return request(_0xb79b('0x22'),{'body':_0x306cd9});};exports['createSquareDetailsReport']=function(_0x18f5af){return request(_0xb79b('0x23'),{'body':_0x18f5af});};exports[_0xb79b('0x24')]=function(_0x3daa3e){return request(_0xb79b('0x25'),{'body':_[_0xb79b('0x26')](_0x3daa3e,{'project_name':_0x3daa3e[_0xb79b('0x27')],'prev_project_name':_0x3daa3e[_0xb79b('0x28')]||'','is_subproject':_0x3daa3e[_0xb79b('0x28')]?!![]:![],'leaveAt':moment()[_0xb79b('0x29')](_0xb79b('0x2a'))})});};exports[_0xb79b('0x2b')]=function(_0x4cc7e6){return request('CreateSquareRecording',{'body':_0x4cc7e6});};exports['createSquareMessage']=function(_0x5468d6){return request(_0xb79b('0x2c'),{'body':_0x5468d6});};exports[_0xb79b('0x2d')]=function(_0x30d634){return request(_0xb79b('0x2e'),{'options':{'raw':![],'where':{'phone':_0x30d634[_0xb79b('0x2f')],'ListId':_0x30d634[_0xb79b('0x30')]}}})[_0xb79b('0x6')](function(_0x33ae02){if(_0x33ae02){return _0x33ae02;}return request(_0xb79b('0x31'),{'body':_0x30d634});});};exports[_0xb79b('0x32')]=function(_0xa649e5){return request(_0xb79b('0x33'),{'options':{'where':{'id':_0xa649e5},'attributes':['name']}});};exports[_0xb79b('0x34')]=function(_0x160513,_0x3d0238){return request(_0xb79b('0x35'),{'body':{'interface':_0x3d0238},'options':{'where':_0x160513}});};exports[_0xb79b('0x36')]=function(_0x43c58b,_0xe7e4ca,_0x7a7172){return request(_0xb79b('0x37'),{'body':{'type':_0xe7e4ca,'uniqueid':_0x7a7172},'options':{'where':_0x43c58b}});};exports['agentUnpause']=function(_0x5e2cc2){return request(_0xb79b('0x38'),{'body':{},'options':{'where':_0x5e2cc2}});};exports['agentLogout']=function(_0x350451){return request(_0xb79b('0x39'),{'body':{},'options':{'where':_0x350451}});}; \ 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 cdff155..53cb063 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 _0xf3cd=['./lex','exports','./polly'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf3cd,0xfe));var _0xdf3c=function(_0xd0cd0b,_0x490956){_0xd0cd0b=_0xd0cd0b-0x0;var _0x59cced=_0xf3cd[_0xd0cd0b];return _0x59cced;};var polly=require(_0xdf3c('0x0'));var lex=require(_0xdf3c('0x1'));module[_0xdf3c('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x7a2c=['exports','./polly'];(function(_0x737dac,_0x270a2f){var _0x333715=function(_0x5e6b82){while(--_0x5e6b82){_0x737dac['push'](_0x737dac['shift']());}};_0x333715(++_0x270a2f);}(_0x7a2c,0x17b));var _0xc7a2=function(_0x9e2471,_0x298332){_0x9e2471=_0x9e2471-0x0;var _0x576c41=_0x7a2c[_0x9e2471];return _0x576c41;};var polly=require(_0xc7a2('0x0'));var lex=require('./lex');module[_0xc7a2('0x1')]={'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 d48e65e..3659760 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 _0xbe31=['exports'];(function(_0x40c601,_0x25997e){var _0x214a0=function(_0x1c2f19){while(--_0x1c2f19){_0x40c601['push'](_0x40c601['shift']());}};_0x214a0(++_0x25997e);}(_0xbe31,0x83));var _0x1be3=function(_0x3df552,_0x4560ce){_0x3df552=_0x3df552-0x0;var _0x189ba9=_0xbe31[_0x3df552];return _0x189ba9;};'use strict';var lex=require('./lib/api');module[_0x1be3('0x0')]=function(_0x18e467,_0x3b216b,_0x474db2,_0x228047,_0x1bd12d,_0xacfa1e){return lex(_0x18e467,_0x3b216b,_0x474db2,_0x228047,_0x1bd12d,_0xacfa1e);}; \ No newline at end of file +var _0xf194=['exports','./lib/api'];(function(_0x370a0c,_0x4eeba8){var _0x455867=function(_0x6655e7){while(--_0x6655e7){_0x370a0c['push'](_0x370a0c['shift']());}};_0x455867(++_0x4eeba8);}(_0xf194,0x91));var _0x4f19=function(_0xba7b0,_0x301731){_0xba7b0=_0xba7b0-0x0;var _0x1a6a3f=_0xf194[_0xba7b0];return _0x1a6a3f;};'use strict';var lex=require(_0x4f19('0x0'));module[_0x4f19('0x1')]=function(_0x1ab42a,_0x52ade6,_0x52e2fb,_0x13475c,_0x533c58,_0x5db065){return lex(_0x1ab42a,_0x52ade6,_0x52e2fb,_0x13475c,_0x533c58,_0x5db065);}; \ 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 377ab12..f22b646 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 _0xce32=['slot_','exports','LexRuntime','slots','hasOwnProperty'];(function(_0x5e9060,_0x46d2a2){var _0x5ba7cb=function(_0xe82280){while(--_0xe82280){_0x5e9060['push'](_0x5e9060['shift']());}};_0x5ba7cb(++_0x46d2a2);}(_0xce32,0x1ac));var _0x2ce3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xce32[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require('bluebird');var AWS=require('aws-sdk');function lexResult(_0x19c18a,_0x12c4ba){return new BPromise(function(_0x2436a5,_0x4f07a6){_0x19c18a['postText'](_0x12c4ba,function(_0x139c84,_0xb1427){if(_0x139c84){_0x4f07a6(_0x139c84);}if(_0xb1427[_0x2ce3('0x0')]){for(const _0x29a4fd in _0xb1427['slots']){if(_0xb1427['slots'][_0x2ce3('0x1')](_0x29a4fd)){var _0x578595=_0xb1427[_0x2ce3('0x0')][_0x29a4fd];_0xb1427[_0x2ce3('0x2')+_0x29a4fd]=_0x578595;}}}_0x2436a5(_0xb1427);});});}module[_0x2ce3('0x3')]=function(_0x2d2041,_0x46bbd9,_0x1cf2fb,_0x2405f7,_0x5a9a96,_0x31fdf3){var _0x2efc28=new AWS[(_0x2ce3('0x4'))]({'accessKeyId':_0x46bbd9,'secretAccessKey':_0x1cf2fb,'region':_0x2405f7});var _0x5d1807={'botAlias':'$LATEST','botName':_0x31fdf3,'inputText':_0x5a9a96,'userId':_0x2d2041};return lexResult(_0x2efc28,_0x5d1807);}; \ No newline at end of file +var _0x3b4e=['postText','slots','hasOwnProperty','slot_','exports','LexRuntime','bluebird','aws-sdk'];(function(_0x2ab5d7,_0x1243d9){var _0x516388=function(_0x412cd1){while(--_0x412cd1){_0x2ab5d7['push'](_0x2ab5d7['shift']());}};_0x516388(++_0x1243d9);}(_0x3b4e,0xfe));var _0xe3b4=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x3b4e[_0x321bb2];return _0x9c12ed;};'use strict';var BPromise=require(_0xe3b4('0x0'));var AWS=require(_0xe3b4('0x1'));function lexResult(_0x3345cd,_0x500c92){return new BPromise(function(_0x17f77b,_0x3655a6){_0x3345cd[_0xe3b4('0x2')](_0x500c92,function(_0x188252,_0x148dd1){if(_0x188252){_0x3655a6(_0x188252);}if(_0x148dd1['slots']){for(const _0x24edbf in _0x148dd1['slots']){if(_0x148dd1[_0xe3b4('0x3')][_0xe3b4('0x4')](_0x24edbf)){var _0x3bfa78=_0x148dd1[_0xe3b4('0x3')][_0x24edbf];_0x148dd1[_0xe3b4('0x5')+_0x24edbf]=_0x3bfa78;}}}_0x17f77b(_0x148dd1);});});}module[_0xe3b4('0x6')]=function(_0x249636,_0x47ca06,_0x560688,_0x224123,_0x4c7193,_0x54ddd3){var _0x362f4d=new AWS[(_0xe3b4('0x7'))]({'accessKeyId':_0x47ca06,'secretAccessKey':_0x560688,'region':_0x224123});var _0x3878e5={'botAlias':'$LATEST','botName':_0x54ddd3,'inputText':_0x4c7193,'userId':_0x249636};return lexResult(_0x362f4d,_0x3878e5);}; \ 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 aa928db..0803930 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 _0xbc3f=['./lib/api','exports'];(function(_0xe116c1,_0x295f11){var _0x448360=function(_0x3fb426){while(--_0x3fb426){_0xe116c1['push'](_0xe116c1['shift']());}};_0x448360(++_0x295f11);}(_0xbc3f,0x128));var _0xfbc3=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0xbc3f[_0x102e37];return _0x35a07c;};'use strict';var polly=require(_0xfbc3('0x0'));module[_0xfbc3('0x1')]=function(_0x26276c,_0x559d18,_0x103622,_0x2fa32b,_0x120589,_0x26921a,_0x2e728e){return polly(_0x26276c,_0x559d18,_0x103622,_0x2fa32b,_0x120589,_0x26921a,_0x2e728e);}; \ No newline at end of file +var _0xda3e=['exports','./lib/api'];(function(_0x699f16,_0x4ac861){var _0x4beb8a=function(_0x18db99){while(--_0x18db99){_0x699f16['push'](_0x699f16['shift']());}};_0x4beb8a(++_0x4ac861);}(_0xda3e,0x13b));var _0xeda3=function(_0xf3d44d,_0x3f463e){_0xf3d44d=_0xf3d44d-0x0;var _0x190b40=_0xda3e[_0xf3d44d];return _0x190b40;};'use strict';var polly=require(_0xeda3('0x0'));module[_0xeda3('0x1')]=function(_0xb8bfe2,_0x2d0f9c,_0x26ec3c,_0x17c92b,_0x33ac2f,_0x33422a,_0x447586){return polly(_0xb8bfe2,_0x2d0f9c,_0x26ec3c,_0x17c92b,_0x33ac2f,_0x33422a,_0x447586);}; \ 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 28ed296..ad81cd7 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 _0x24a8=['exports','Polly','mp3','bluebird','randomstring','aws-sdk','synthesizeSpeech','AudioStream','writeFile','No\x20data\x20response\x20from\x20aws\x20Polly!'];(function(_0x2a34c9,_0x124b3a){var _0x132247=function(_0xaeec48){while(--_0xaeec48){_0x2a34c9['push'](_0x2a34c9['shift']());}};_0x132247(++_0x124b3a);}(_0x24a8,0xcb));var _0x824a=function(_0x4c0616,_0x55863f){_0x4c0616=_0x4c0616-0x0;var _0xff5906=_0x24a8[_0x4c0616];return _0xff5906;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require(_0x824a('0x0'));var rs=require(_0x824a('0x1'));var AWS=require(_0x824a('0x2'));function pollyResult(_0x1cea4a,_0x5f0f6f,_0x2a45a5){return new BPromise(function(_0x2208e7,_0x3accca){_0x1cea4a[_0x824a('0x3')](_0x5f0f6f,function(_0x3c4b4f,_0x31c758){if(_0x3c4b4f){_0x3accca(_0x3c4b4f);}else if(_0x31c758){if(_0x31c758[_0x824a('0x4')]instanceof Buffer){fs[_0x824a('0x5')](_0x2a45a5,_0x31c758[_0x824a('0x4')],function(_0xd6b64d){if(_0xd6b64d){_0x3accca(_0xd6b64d);}else{_0x2208e7();}});}else{_0x3accca(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0x3accca(new Error(_0x824a('0x6')));}});});}module[_0x824a('0x7')]=function(_0x1b25bb,_0x3e559d,_0x53ea36,_0x57125a,_0x1923eb,_0x37f8cb,_0x68586c){var _0x490e45=new AWS[(_0x824a('0x8'))]({'accessKeyId':_0x1b25bb,'secretAccessKey':_0x3e559d,'region':_0x53ea36});var _0x1b755c={'Text':_0x1923eb,'TextType':_0x37f8cb||'text','OutputFormat':_0x824a('0x9'),'VoiceId':_0x57125a};return pollyResult(_0x490e45,_0x1b755c,_0x68586c);}; \ No newline at end of file +var _0x956b=['AudioStream','writeFile','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','path','bluebird','aws-sdk','synthesizeSpeech'];(function(_0x1f9f5f,_0x509fb7){var _0x51d649=function(_0x4a5285){while(--_0x4a5285){_0x1f9f5f['push'](_0x1f9f5f['shift']());}};_0x51d649(++_0x509fb7);}(_0x956b,0x1eb));var _0xb956=function(_0x39ca98,_0x4b8384){_0x39ca98=_0x39ca98-0x0;var _0xb74b3=_0x956b[_0x39ca98];return _0xb74b3;};'use strict';var fs=require('fs');var path=require(_0xb956('0x0'));var BPromise=require(_0xb956('0x1'));var rs=require('randomstring');var AWS=require(_0xb956('0x2'));function pollyResult(_0x46a97a,_0x371cd3,_0xb5a396){return new BPromise(function(_0x2a70f3,_0x5f0115){_0x46a97a[_0xb956('0x3')](_0x371cd3,function(_0x5e459b,_0x169a75){if(_0x5e459b){_0x5f0115(_0x5e459b);}else if(_0x169a75){if(_0x169a75[_0xb956('0x4')]instanceof Buffer){fs[_0xb956('0x5')](_0xb5a396,_0x169a75[_0xb956('0x4')],function(_0x5123f2){if(_0x5123f2){_0x5f0115(_0x5123f2);}else{_0x2a70f3();}});}else{_0x5f0115(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0x5f0115(new Error(_0xb956('0x6')));}});});}module[_0xb956('0x7')]=function(_0x548830,_0xea98bb,_0x3d1db4,_0x407b97,_0x17a07e,_0x457a57,_0x2ed4d7){var _0x534f66=new AWS[(_0xb956('0x8'))]({'accessKeyId':_0x548830,'secretAccessKey':_0xea98bb,'region':_0x3d1db4});var _0x52b55a={'Text':_0x17a07e,'TextType':_0x457a57||'text','OutputFormat':'mp3','VoiceId':_0x407b97};return pollyResult(_0x534f66,_0x52b55a,_0x2ed4d7);}; \ 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 85d7ba7..7dbe3bb 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 _0x7083=['exports','./lib/api'];(function(_0x56ea6f,_0x15535a){var _0x43ac31=function(_0x1b6d99){while(--_0x1b6d99){_0x56ea6f['push'](_0x56ea6f['shift']());}};_0x43ac31(++_0x15535a);}(_0x7083,0x157));var _0x3708=function(_0x3d4b22,_0x407496){_0x3d4b22=_0x3d4b22-0x0;var _0x390557=_0x7083[_0x3d4b22];return _0x390557;};'use strict';var asr=require(_0x3708('0x0'));module[_0x3708('0x1')]=function(_0x2ef96a,_0x2f14fa,_0x5eab11,_0x35cd0f){return asr(_0x2ef96a,_0x2f14fa,_0x5eab11);}; \ No newline at end of file +var _0x2a5a=['exports'];(function(_0x481f5a,_0x174ea4){var _0x399421=function(_0x5e65ea){while(--_0x5e65ea){_0x481f5a['push'](_0x481f5a['shift']());}};_0x399421(++_0x174ea4);}(_0x2a5a,0x1ed));var _0xa2a5=function(_0x349cd7,_0x34e251){_0x349cd7=_0x349cd7-0x0;var _0x382d61=_0x2a5a[_0x349cd7];return _0x382d61;};'use strict';var asr=require('./lib/api');module[_0xa2a5('0x0')]=function(_0x368e00,_0x2a75ad,_0x276ef0,_0x43d38b){return asr(_0x368e00,_0x2a75ad,_0x276ef0);}; \ 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 8f6523c..5766d5e 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 _0x553d=['string','lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64','/v1/speech:recognize?key=','url','bluebird','https://speech.googleapis.com','filepath\x20should\x20be\x20a\x20string','length','undefined'];(function(_0x5e8258,_0x30dd15){var _0x4c1b20=function(_0x3864ea){while(--_0x3864ea){_0x5e8258['push'](_0x5e8258['shift']());}};_0x4c1b20(++_0x30dd15);}(_0x553d,0x10e));var _0xd553=function(_0x4be97b,_0x57816c){_0x4be97b=_0x4be97b-0x0;var _0xf0c5a4=_0x553d[_0x4be97b];return _0xf0c5a4;};'use strict';var url=require(_0xd553('0x0'));var BPromise=require(_0xd553('0x1'));var fs=require('fs');var host=_0xd553('0x2');module['exports']=function(_0xc76d,_0x1dc41c,_0x24966d){return new BPromise(function(_0x4dd124,_0x3427a9){var _0x17febf;if(typeof _0xc76d!=='string'||_0xc76d['length']===0x0){return _0x3427a9(_0xd553('0x3'));}if(typeof _0x1dc41c!=='string'||_0x1dc41c[_0xd553('0x4')]===0x0){return _0x3427a9('key\x20should\x20be\x20a\x20string');}if(typeof _0x24966d!==_0xd553('0x5')&&(typeof _0x24966d!==_0xd553('0x6')||_0x24966d[_0xd553('0x4')]===0x0)){return _0x3427a9(_0xd553('0x7'));}try{_0x17febf=fs[_0xd553('0x8')](_0xc76d)[_0xd553('0x9')](_0xd553('0xa'));}catch(_0x4fa170){return _0x3427a9(_0x4fa170);}return _0x4dd124({'method':'POST','uri':host+_0xd553('0xb')+_0x1dc41c,'body':{'config':{'encoding':'LINEAR16','sampleRateHertz':'8000','languageCode':_0x24966d},'audio':{'content':_0x17febf}},'json':!![]});});}; \ No newline at end of file +var _0x6ad9=['string','length','filepath\x20should\x20be\x20a\x20string','lang\x20should\x20be\x20a\x20string','toString','base64','POST','LINEAR16','bluebird','https://speech.googleapis.com','exports'];(function(_0x298064,_0x1d2bfb){var _0x2512ea=function(_0x3e5b28){while(--_0x3e5b28){_0x298064['push'](_0x298064['shift']());}};_0x2512ea(++_0x1d2bfb);}(_0x6ad9,0xb8));var _0x96ad=function(_0x395e32,_0x7f4e75){_0x395e32=_0x395e32-0x0;var _0x5f0ae4=_0x6ad9[_0x395e32];return _0x5f0ae4;};'use strict';var url=require('url');var BPromise=require(_0x96ad('0x0'));var fs=require('fs');var host=_0x96ad('0x1');module[_0x96ad('0x2')]=function(_0xc6babc,_0x20ee2b,_0xe13d99){return new BPromise(function(_0x3209c5,_0x5d71da){var _0x207688;if(typeof _0xc6babc!==_0x96ad('0x3')||_0xc6babc[_0x96ad('0x4')]===0x0){return _0x5d71da(_0x96ad('0x5'));}if(typeof _0x20ee2b!==_0x96ad('0x3')||_0x20ee2b[_0x96ad('0x4')]===0x0){return _0x5d71da('key\x20should\x20be\x20a\x20string');}if(typeof _0xe13d99!=='undefined'&&(typeof _0xe13d99!==_0x96ad('0x3')||_0xe13d99[_0x96ad('0x4')]===0x0)){return _0x5d71da(_0x96ad('0x6'));}try{_0x207688=fs['readFileSync'](_0xc6babc)[_0x96ad('0x7')](_0x96ad('0x8'));}catch(_0x19cea3){return _0x5d71da(_0x19cea3);}return _0x3209c5({'method':_0x96ad('0x9'),'uri':host+'/v1/speech:recognize?key='+_0x20ee2b,'body':{'config':{'encoding':_0x96ad('0xa'),'sampleRateHertz':'8000','languageCode':_0xe13d99},'audio':{'content':_0x207688}},'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 10cb4be..5cc318d 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 asr=require('./asr');module['exports']={'asr':asr}; \ No newline at end of file +var _0x9cab=['exports'];(function(_0x161152,_0x158677){var _0x13de06=function(_0x4f63b1){while(--_0x4f63b1){_0x161152['push'](_0x161152['shift']());}};_0x13de06(++_0x158677);}(_0x9cab,0x1e7));var _0xb9ca=function(_0x2ac4bf,_0x755d36){_0x2ac4bf=_0x2ac4bf-0x0;var _0x54754a=_0x9cab[_0x2ac4bf];return _0x54754a;};var asr=require('./asr');module[_0xb9ca('0x0')]={'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 0b4904a..e42ca42 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 _0x77ca=['googleASR\x20confidence','[%s]\x20%s:%s','name','googleDialogflow','textRequest','result','source','resolvedQuery','actionIncomplete','fulfillment','speech','score','status','code','metadata','isFallbackIntent','tildeASR','asr','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','polly','lex','stringify','ispeechTTS','format','ispeechASR','model=%s','freeform=3','nda','text','channelData','CustomAction','AudioFromTts','Data','audiofile','dirName','path','http','https','url','parse','bluebird','sox','request-promise','util','google-tts-api','apiai-promise','md5','./tilde','../../../config/logger','https://api.ispeech.org/api/rest','https:','host','WHAT_EVER','get','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusCode','statusMessage','finish','info','finish\x20download\x20file','close','unlink','pipe','protocol','data','end','transcode','wav','error\x20convert','finish\x20to\x20convert','tmp','.wav','writeFileSync','777','readFileSync','toString','base64','googleCloudTTS','https://texttospeech.googleapis.com/v1/','ssml','input','voice','MP3','POST','then','generate','.mp3','from','chmodSync','resolve','googleCloudTTS\x20path','split','googleTTS','goggleTTS\x20path','googleASR','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription'];(function(_0x3541e4,_0x4dcf9a){var _0x3ca5d9=function(_0x3eaac2){while(--_0x3eaac2){_0x3541e4['push'](_0x3541e4['shift']());}};_0x3ca5d9(++_0x4dcf9a);}(_0x77ca,0xf8));var _0xa77c=function(_0x2d9cc3,_0x13bba9){_0x2d9cc3=_0x2d9cc3-0x0;var _0x2675db=_0x77ca[_0x2d9cc3];return _0x2675db;};'use strict';var fs=require('fs');var path=require(_0xa77c('0x0'));var http=require(_0xa77c('0x1'));var https=require(_0xa77c('0x2'));var urlParse=require(_0xa77c('0x3'))[_0xa77c('0x4')];var BPromise=require(_0xa77c('0x5'));var rs=require('randomstring');var sox=require(_0xa77c('0x6'));var rp=require(_0xa77c('0x7'));var util=require(_0xa77c('0x8'));var querystring=require('querystring');var tts=require(_0xa77c('0x9'));var apiai=require(_0xa77c('0xa'));var md5=require(_0xa77c('0xb'));var google=require('./google');var aws=require('./aws');var tilde=require(_0xa77c('0xc'));var sestek=require('./sestek');var logger=require(_0xa77c('0xd'))('agi');var ISPEECH_API=_0xa77c('0xe');function downloadFile(_0x2bbd73,_0x2dfc7b){return new BPromise(function(_0x3d1231,_0xc54c95){var _0x565cc3=urlParse(_0x2bbd73);var _0x139d2a=_0x565cc3['protocol']===_0xa77c('0xf')?https:http;var _0xc62d70={'host':_0x565cc3[_0xa77c('0x10')],'path':_0x565cc3[_0xa77c('0x0')],'headers':{'user-agent':_0xa77c('0x11')}};_0x139d2a[_0xa77c('0x12')](_0xc62d70,function(_0x4d4cdc){if(_0x4d4cdc['statusCode']!==0xc8){logger[_0xa77c('0x13')](_0xa77c('0x14')+_0x2bbd73+_0xa77c('0x15')+_0x4d4cdc[_0xa77c('0x16')]+'\x20('+_0x4d4cdc[_0xa77c('0x17')]+')');_0xc54c95(new Error(_0xa77c('0x14')+_0x2bbd73+'\x20failed,\x20status\x20code\x20=\x20'+_0x4d4cdc['statusCode']+'\x20('+_0x4d4cdc[_0xa77c('0x17')]+')'));return;}var _0xc478f=fs['createWriteStream'](_0x2dfc7b);_0xc478f['on'](_0xa77c('0x18'),function(){logger[_0xa77c('0x19')](_0xa77c('0x1a'));_0xc478f[_0xa77c('0x1b')](_0x3d1231);});_0xc478f['on'](_0xa77c('0x13'),function(_0x50982a){fs[_0xa77c('0x1c')](_0x2dfc7b);logger[_0xa77c('0x13')]('download\x20error',_0x50982a);_0xc54c95(_0x50982a);});_0x4d4cdc[_0xa77c('0x1d')](_0xc478f);})['on'](_0xa77c('0x13'),function(_0x406a9d){logger[_0xa77c('0x13')](_0x406a9d);_0xc54c95(_0x406a9d);})['end']();});}function uploadFile(_0x2f67aa){return new BPromise(function(_0x260a32,_0x473629){var _0x42de9f=urlParse(_0x2f67aa);var _0x35777d=_0x42de9f[_0xa77c('0x1e')]===_0xa77c('0xf')?https:http;var _0x570528={'host':_0x42de9f[_0xa77c('0x10')],'path':_0x42de9f[_0xa77c('0x0')],'headers':{'user-agent':'WHAT_EVER'}};_0x35777d[_0xa77c('0x12')](_0x570528,function(_0x53adb3){if(_0x53adb3[_0xa77c('0x16')]!==0xc8){_0x473629(new Error('request\x20to\x20'+_0x2f67aa+_0xa77c('0x15')+_0x53adb3[_0xa77c('0x16')]+'\x20('+_0x53adb3['statusMessage']+')'));return;}var _0x5e3376='';_0x53adb3['on'](_0xa77c('0x1f'),function(_0x1f1eaf){_0x5e3376+=_0x1f1eaf;});_0x53adb3['on'](_0xa77c('0x20'),function(){_0x260a32(_0x5e3376);});})['on']('error',function(_0x200d4d){_0x473629(_0x200d4d);})['end']();});}function convertFile(_0x4df840,_0x558822){return new BPromise(function(_0x4de7f2,_0x4bfe20){var _0x56d504=sox[_0xa77c('0x21')](_0x4df840,_0x558822,{'sampleRate':0x1f40,'format':_0xa77c('0x22'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x56d504['on'](_0xa77c('0x13'),function(_0xb1cb3d){logger[_0xa77c('0x13')](_0xa77c('0x23'),_0xb1cb3d);_0x4bfe20(_0xb1cb3d);});_0x56d504['on'](_0xa77c('0x20'),function(){logger[_0xa77c('0x19')](_0xa77c('0x24'));_0x4de7f2();});_0x56d504['start']();});}function base64Decode(_0x2ac108,_0x50464d){var _0x5aa59a=path['resolve'](__dirname,_0xa77c('0x25'),rs['generate'](0x4)+_0xa77c('0x26'));fs[_0xa77c('0x27')](_0x5aa59a,_0x2ac108,'base64');return convertFile(_0x5aa59a,_0x50464d)['then'](function(){try{fs[_0xa77c('0x1c')](_0x5aa59a);fs['chmodSync'](_0x50464d,_0xa77c('0x28'));}catch(_0x179a8e){logger['error'](_0x179a8e);}return _0x50464d['split']('.')[0x0];});}function base64Encode(_0x3b2b4c){var _0x3135b7=fs[_0xa77c('0x29')](_0x3b2b4c);return new Buffer(_0x3135b7)[_0xa77c('0x2a')](_0xa77c('0x2b'));}exports[_0xa77c('0x2c')]=function(_0x166656,_0x2d2f17,_0x4989ae,_0x65e6de,_0x3eec0d,_0x122ed5){var _0x14894,_0x47d6b4;var _0x3e8783=_0xa77c('0x2d');var _0x564058='?key='+_0x166656;var _0x427658={};if(_0x2d2f17===_0xa77c('0x2e')){_0x427658[_0xa77c('0x2f')]={'ssml':_0x4989ae};}else{_0x427658[_0xa77c('0x2f')]={'text':_0x4989ae};};_0x427658[_0xa77c('0x30')]={'languageCode':_0x65e6de,'ssmlGender':_0x3eec0d};_0x427658['audioConfig']={'audioEncoding':_0xa77c('0x31'),'sampleRateHertz':0x1f40};var _0x33f52e={'url':_0x3e8783+'text:synthesize'+_0x564058,'method':_0xa77c('0x32'),'json':!![],'body':_0x427658};return rp(_0x33f52e)[_0xa77c('0x33')](function(_0x34f68a){return new BPromise(function(_0x195727,_0x158d0d){_0x14894=path['resolve'](__dirname,_0xa77c('0x25'),rs[_0xa77c('0x34')](0x4)+_0xa77c('0x35'));var _0x4b02d6=Buffer[_0xa77c('0x36')](_0x34f68a['audioContent'],_0xa77c('0x2b'));return fs['writeFile'](_0x14894,_0x4b02d6,function(_0x1b9916){_0x158d0d(_0x1b9916);},function(_0x56eb46){fs[_0xa77c('0x37')](_0x14894,'777');_0x195727(_0x56eb46);});});})[_0xa77c('0x33')](function(_0x4f7f0b){_0x47d6b4=path[_0xa77c('0x38')](__dirname,_0xa77c('0x25'),rs[_0xa77c('0x34')](0x4)+_0xa77c('0x26'));return convertFile(_0x14894,_0x47d6b4);})[_0xa77c('0x33')](function(){try{fs[_0xa77c('0x1c')](_0x14894);fs['chmodSync'](_0x47d6b4,'777');}catch(_0x2c0cc0){logger[_0xa77c('0x13')](_0x2c0cc0);}logger[_0xa77c('0x19')](_0xa77c('0x39'),_0x47d6b4[_0xa77c('0x3a')]('.')[0x0]);return _0x47d6b4[_0xa77c('0x3a')]('.')[0x0];});};exports[_0xa77c('0x3b')]=function(_0x2122e7,_0xdc1ea7){var _0x333006,_0x5d0186;return tts(_0x2122e7,_0xdc1ea7||'en',0x1)[_0xa77c('0x33')](function(_0x46d3d2){logger[_0xa77c('0x19')](_0x46d3d2);_0x333006=path[_0xa77c('0x38')](__dirname,'tmp',rs[_0xa77c('0x34')](0x4)+_0xa77c('0x35'));return downloadFile(_0x46d3d2,_0x333006);})['then'](function(){_0x5d0186=path[_0xa77c('0x38')](__dirname,_0xa77c('0x25'),rs[_0xa77c('0x34')](0x4)+_0xa77c('0x26'));return convertFile(_0x333006,_0x5d0186);})['then'](function(){try{fs[_0xa77c('0x1c')](_0x333006);fs[_0xa77c('0x37')](_0x5d0186,'777');}catch(_0x1c816d){logger[_0xa77c('0x13')](_0x1c816d);}logger[_0xa77c('0x19')](_0xa77c('0x3c'),_0x5d0186['split']('.')[0x0]);return _0x5d0186[_0xa77c('0x3a')]('.')[0x0];});};exports[_0xa77c('0x3d')]=function(_0xb4c89e,_0xc795b6,_0x5c177b){return google['asr'](_0xb4c89e,_0xc795b6,_0x5c177b)[_0xa77c('0x33')](function(_0x280db4){logger[_0xa77c('0x19')](_0x280db4[_0xa77c('0x3e')]);return rp(_0x280db4);})[_0xa77c('0x33')](function(_0x19dece){var _0x2c41b3='';var _0x1b4727=0x0;try{fs[_0xa77c('0x1c')](_0xb4c89e);}catch(_0x2003b3){logger[_0xa77c('0x13')](_0x2003b3);}if(_0x19dece&&_0x19dece['results']){_0x2c41b3=_0x19dece[_0xa77c('0x3f')][_0xa77c('0x40')](function(_0x132337){return _0x132337&&_0x132337[_0xa77c('0x41')][0x0]&&_0x132337[_0xa77c('0x41')][0x0][_0xa77c('0x42')]?_0x132337[_0xa77c('0x41')][0x0]['transcript']:'';})[_0xa77c('0x43')]('\x0a');_0x1b4727=_0x19dece[_0xa77c('0x3f')][_0xa77c('0x40')](function(_0x45728a){return _0x45728a&&_0x45728a[_0xa77c('0x41')][0x0]&&_0x45728a['alternatives'][0x0][_0xa77c('0x44')]?_0x45728a[_0xa77c('0x41')][0x0]['confidence']:0x0;})[_0xa77c('0x43')]('\x0a');}logger['info'](_0xa77c('0x45'),_0x2c41b3);logger['info'](_0xa77c('0x46'),_0x1b4727);return{'transcript':_0x2c41b3,'confidence':_0x1b4727};})['catch'](function(_0x2fbca6){logger['error'](_0xa77c('0x47'),_0x2fbca6[_0xa77c('0x16')],_0x2fbca6[_0xa77c('0x48')],_0x2fbca6['message']);});};exports[_0xa77c('0x49')]=function(_0x531347,_0x361442,_0x404a5f,_0x5103dd){var _0x469e65=apiai(_0x361442,{'language':_0x5103dd||'en'});return _0x469e65[_0xa77c('0x4a')](_0x404a5f,{'sessionId':md5(_0x531347)})['then'](function(_0x20eb45){logger[_0xa77c('0x19')](JSON['stringify'](_0x20eb45));return{'source':_0x20eb45[_0xa77c('0x4b')][_0xa77c('0x4c')],'resolvedQuery':_0x20eb45[_0xa77c('0x4b')][_0xa77c('0x4d')],'action':_0x20eb45[_0xa77c('0x4b')]['action'],'actionIncomplete':_0x20eb45[_0xa77c('0x4b')][_0xa77c('0x4e')],'speech':_0x20eb45[_0xa77c('0x4b')][_0xa77c('0x4f')][_0xa77c('0x50')],'score':_0x20eb45[_0xa77c('0x4b')][_0xa77c('0x51')],'statusCode':_0x20eb45[_0xa77c('0x52')][_0xa77c('0x53')],'endConversation':_0x20eb45['result'][_0xa77c('0x54')]['endConversation']||![],'isFallbackIntent':_0x20eb45[_0xa77c('0x4b')][_0xa77c('0x54')][_0xa77c('0x55')]};});};exports[_0xa77c('0x56')]=function(_0x1332f6,_0x41f40d,_0x1f5f71,_0x5d6bcc){return tilde[_0xa77c('0x57')](_0x1332f6,_0x41f40d,_0x1f5f71,_0x5d6bcc)[_0xa77c('0x33')](function(_0x33828c){try{fs[_0xa77c('0x1c')](_0x1332f6);}catch(_0xdeaa42){logger[_0xa77c('0x13')](_0xdeaa42);}logger[_0xa77c('0x19')](_0xa77c('0x58'),_0x33828c[_0xa77c('0x42')]);logger[_0xa77c('0x19')](_0xa77c('0x59'),_0x33828c[_0xa77c('0x44')]);return _0x33828c;});};exports['awsPolly']=function(_0x591b2f,_0x236444,_0x4a3c64,_0x564eb5,_0x517957,_0xdb8b5d){var _0x4ce3a1=path[_0xa77c('0x38')](__dirname,_0xa77c('0x25'),rs[_0xa77c('0x34')](0x4)+_0xa77c('0x35'));var _0x4e7c43;return aws[_0xa77c('0x5a')](_0x591b2f,_0x236444,_0x4a3c64,_0x564eb5,_0x517957,_0xdb8b5d,_0x4ce3a1)[_0xa77c('0x33')](function(){_0x4e7c43=path[_0xa77c('0x38')](__dirname,_0xa77c('0x25'),rs['generate'](0x4)+'.wav');return convertFile(_0x4ce3a1,_0x4e7c43);})[_0xa77c('0x33')](function(){try{fs[_0xa77c('0x1c')](_0x4ce3a1);fs[_0xa77c('0x37')](_0x4e7c43,_0xa77c('0x28'));}catch(_0x555d80){logger[_0xa77c('0x13')](_0x555d80);}return _0x4e7c43['split']('.')[0x0];});};exports['awsLex']=function(_0x2dc5a4,_0x409259,_0x1e1a82,_0x58c253,_0x5b4d5b,_0x589f68){return aws[_0xa77c('0x5b')](_0x2dc5a4,_0x409259,_0x1e1a82,_0x58c253,_0x5b4d5b,_0x589f68)[_0xa77c('0x33')](function(_0x80b6bb){logger[_0xa77c('0x19')](JSON[_0xa77c('0x5c')](_0x80b6bb));return _0x80b6bb;});};exports[_0xa77c('0x5d')]=function(_0xcea18e,_0x38a292,_0x4c16dd,_0x40ac99){var _0x140668=util[_0xa77c('0x5e')]('%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3',ISPEECH_API,_0xcea18e,encodeURIComponent(_0x38a292),_0x4c16dd,_0x40ac99);var _0x575ee4=path[_0xa77c('0x38')](__dirname,_0xa77c('0x25'),rs[_0xa77c('0x34')](0x4)+_0xa77c('0x35'));var _0x1e5fd3;return downloadFile(_0x140668,_0x575ee4)[_0xa77c('0x33')](function(){_0x1e5fd3=path[_0xa77c('0x38')](__dirname,_0xa77c('0x25'),rs[_0xa77c('0x34')](0x4)+_0xa77c('0x26'));return convertFile(_0x575ee4,_0x1e5fd3);})[_0xa77c('0x33')](function(){try{fs[_0xa77c('0x1c')](_0x575ee4);fs[_0xa77c('0x37')](_0x1e5fd3,'777');}catch(_0x397d40){logger[_0xa77c('0x13')](_0x397d40);}return _0x1e5fd3[_0xa77c('0x3a')]('.')[0x0];});};exports[_0xa77c('0x5f')]=function(_0x496f41,_0x34e42e,_0x1466a5,_0x5ca9aa){var _0x5e11c5=util[_0xa77c('0x5e')]('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x34e42e,_0x1466a5,base64Encode(_0x496f41),_0x5ca9aa?util['format'](_0xa77c('0x60'),encodeURIComponent(_0x5ca9aa)):_0xa77c('0x61'));return uploadFile(_0x5e11c5)[_0xa77c('0x33')](function(_0x1a67f4){return querystring[_0xa77c('0x4')](_0x1a67f4);});};exports['sestekNDA']=function(_0x2b689a,_0x50b048){return sestek[_0xa77c('0x62')](_0x2b689a,_0x50b048)[_0xa77c('0x33')](function(_0x5edf3e){logger[_0xa77c('0x19')](JSON['stringify'](_0x5edf3e));var _0x3e7f2e={'speech':_0x5edf3e[_0xa77c('0x63')],'action':_0x5edf3e[_0xa77c('0x64')]?_0x5edf3e[_0xa77c('0x64')][_0xa77c('0x65')]:undefined,'actiondata':_0x5edf3e['channelData']?_0x5edf3e[_0xa77c('0x64')]['CustomActionData']:undefined};if(_0x5edf3e[_0xa77c('0x64')]&&_0x5edf3e[_0xa77c('0x64')][_0xa77c('0x66')]){return base64Decode(_0x5edf3e['channelData']['AudioFromTts'][_0xa77c('0x67')],path['resolve'](__dirname,'tmp',rs[_0xa77c('0x34')](0x4)+'.wav'))[_0xa77c('0x33')](function(_0x5a4b69){_0x3e7f2e[_0xa77c('0x68')]=_0x5a4b69;return _0x3e7f2e;});}return _0x3e7f2e;});};exports[_0xa77c('0x69')]=function(){return __dirname;}; \ No newline at end of file +var _0x5101=['alternatives','transcript','join','confidence','googleASR\x20transcription','[%s]\x20%s:%s','message','googleDialogflow','stringify','source','result','resolvedQuery','actionIncomplete','fulfillment','speech','status','code','metadata','endConversation','isFallbackIntent','Tilde\x20ASR\x20confidence','awsPolly','polly','lex','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','format','model=%s','freeform=3','sestekNDA','nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','dirName','path','https','parse','bluebird','randomstring','querystring','google-tts-api','apiai-promise','./google','./sestek','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','https:','host','WHAT_EVER','get','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusCode','statusMessage','createWriteStream','close','unlink','download\x20error','pipe','end','data','transcode','wav','error\x20convert','info','start','resolve','tmp','generate','.wav','writeFileSync','base64','then','chmodSync','readFileSync','googleCloudTTS','https://texttospeech.googleapis.com/v1/','ssml','input','audioConfig','MP3','text:synthesize','POST','from','audioContent','writeFile','777','googleCloudTTS\x20path','split','.mp3','goggleTTS\x20path','googleASR','asr','uri','results','map'];(function(_0x1b90e6,_0x42ce13){var _0x43d978=function(_0x2321ab){while(--_0x2321ab){_0x1b90e6['push'](_0x1b90e6['shift']());}};_0x43d978(++_0x42ce13);}(_0x5101,0x163));var _0x1510=function(_0x21f01b,_0x52810c){_0x21f01b=_0x21f01b-0x0;var _0x439bc0=_0x5101[_0x21f01b];return _0x439bc0;};'use strict';var fs=require('fs');var path=require(_0x1510('0x0'));var http=require('http');var https=require(_0x1510('0x1'));var urlParse=require('url')[_0x1510('0x2')];var BPromise=require(_0x1510('0x3'));var rs=require(_0x1510('0x4'));var sox=require('sox');var rp=require('request-promise');var util=require('util');var querystring=require(_0x1510('0x5'));var tts=require(_0x1510('0x6'));var apiai=require(_0x1510('0x7'));var md5=require('md5');var google=require(_0x1510('0x8'));var aws=require('./aws');var tilde=require('./tilde');var sestek=require(_0x1510('0x9'));var logger=require(_0x1510('0xa'))(_0x1510('0xb'));var ISPEECH_API=_0x1510('0xc');function downloadFile(_0x3997ba,_0x23a8cb){return new BPromise(function(_0x103da5,_0x5dad9f){var _0x34e39b=urlParse(_0x3997ba);var _0x5293b7=_0x34e39b[_0x1510('0xd')]===_0x1510('0xe')?https:http;var _0x3d0d96={'host':_0x34e39b[_0x1510('0xf')],'path':_0x34e39b['path'],'headers':{'user-agent':_0x1510('0x10')}};_0x5293b7[_0x1510('0x11')](_0x3d0d96,function(_0x5f1f5d){if(_0x5f1f5d['statusCode']!==0xc8){logger[_0x1510('0x12')](_0x1510('0x13')+_0x3997ba+_0x1510('0x14')+_0x5f1f5d[_0x1510('0x15')]+'\x20('+_0x5f1f5d[_0x1510('0x16')]+')');_0x5dad9f(new Error('request\x20to\x20'+_0x3997ba+'\x20failed,\x20status\x20code\x20=\x20'+_0x5f1f5d[_0x1510('0x15')]+'\x20('+_0x5f1f5d[_0x1510('0x16')]+')'));return;}var _0x307bee=fs[_0x1510('0x17')](_0x23a8cb);_0x307bee['on']('finish',function(){logger['info']('finish\x20download\x20file');_0x307bee[_0x1510('0x18')](_0x103da5);});_0x307bee['on'](_0x1510('0x12'),function(_0x5e355e){fs[_0x1510('0x19')](_0x23a8cb);logger[_0x1510('0x12')](_0x1510('0x1a'),_0x5e355e);_0x5dad9f(_0x5e355e);});_0x5f1f5d[_0x1510('0x1b')](_0x307bee);})['on']('error',function(_0x226c83){logger[_0x1510('0x12')](_0x226c83);_0x5dad9f(_0x226c83);})[_0x1510('0x1c')]();});}function uploadFile(_0x2074a6){return new BPromise(function(_0x4b446a,_0x211e34){var _0x392bbc=urlParse(_0x2074a6);var _0x27d5c5=_0x392bbc[_0x1510('0xd')]===_0x1510('0xe')?https:http;var _0x28cbef={'host':_0x392bbc['host'],'path':_0x392bbc[_0x1510('0x0')],'headers':{'user-agent':_0x1510('0x10')}};_0x27d5c5['get'](_0x28cbef,function(_0x572687){if(_0x572687[_0x1510('0x15')]!==0xc8){_0x211e34(new Error(_0x1510('0x13')+_0x2074a6+_0x1510('0x14')+_0x572687['statusCode']+'\x20('+_0x572687[_0x1510('0x16')]+')'));return;}var _0x2baf0f='';_0x572687['on'](_0x1510('0x1d'),function(_0x480519){_0x2baf0f+=_0x480519;});_0x572687['on'](_0x1510('0x1c'),function(){_0x4b446a(_0x2baf0f);});})['on'](_0x1510('0x12'),function(_0x40e36c){_0x211e34(_0x40e36c);})[_0x1510('0x1c')]();});}function convertFile(_0x21b0e7,_0x1cd268){return new BPromise(function(_0x422b70,_0x2d3419){var _0x2c3fa9=sox[_0x1510('0x1e')](_0x21b0e7,_0x1cd268,{'sampleRate':0x1f40,'format':_0x1510('0x1f'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x2c3fa9['on'](_0x1510('0x12'),function(_0x3c58c5){logger[_0x1510('0x12')](_0x1510('0x20'),_0x3c58c5);_0x2d3419(_0x3c58c5);});_0x2c3fa9['on'](_0x1510('0x1c'),function(){logger[_0x1510('0x21')]('finish\x20to\x20convert');_0x422b70();});_0x2c3fa9[_0x1510('0x22')]();});}function base64Decode(_0x1f87ee,_0x1ec5a3){var _0x1cd33f=path[_0x1510('0x23')](__dirname,_0x1510('0x24'),rs[_0x1510('0x25')](0x4)+_0x1510('0x26'));fs[_0x1510('0x27')](_0x1cd33f,_0x1f87ee,_0x1510('0x28'));return convertFile(_0x1cd33f,_0x1ec5a3)[_0x1510('0x29')](function(){try{fs[_0x1510('0x19')](_0x1cd33f);fs[_0x1510('0x2a')](_0x1ec5a3,'777');}catch(_0x489dcd){logger['error'](_0x489dcd);}return _0x1ec5a3['split']('.')[0x0];});}function base64Encode(_0x2f0146){var _0xcd2cda=fs[_0x1510('0x2b')](_0x2f0146);return new Buffer(_0xcd2cda)['toString'](_0x1510('0x28'));}exports[_0x1510('0x2c')]=function(_0x1d1f58,_0x403ad8,_0x39c67d,_0x501a9a,_0x3f19d3,_0x1a7e7c){var _0x525d99,_0x2c8b0c;var _0x11bbc5=_0x1510('0x2d');var _0x26f223='?key='+_0x1d1f58;var _0x5207fa={};if(_0x403ad8===_0x1510('0x2e')){_0x5207fa[_0x1510('0x2f')]={'ssml':_0x39c67d};}else{_0x5207fa[_0x1510('0x2f')]={'text':_0x39c67d};};_0x5207fa['voice']={'languageCode':_0x501a9a,'ssmlGender':_0x3f19d3};_0x5207fa[_0x1510('0x30')]={'audioEncoding':_0x1510('0x31'),'sampleRateHertz':0x1f40};var _0x565f6f={'url':_0x11bbc5+_0x1510('0x32')+_0x26f223,'method':_0x1510('0x33'),'json':!![],'body':_0x5207fa};return rp(_0x565f6f)[_0x1510('0x29')](function(_0xac90ce){return new BPromise(function(_0x536788,_0xfc206b){_0x525d99=path[_0x1510('0x23')](__dirname,_0x1510('0x24'),rs['generate'](0x4)+'.mp3');var _0xa75860=Buffer[_0x1510('0x34')](_0xac90ce[_0x1510('0x35')],_0x1510('0x28'));return fs[_0x1510('0x36')](_0x525d99,_0xa75860,function(_0x312f12){_0xfc206b(_0x312f12);},function(_0x1403ce){fs[_0x1510('0x2a')](_0x525d99,_0x1510('0x37'));_0x536788(_0x1403ce);});});})['then'](function(_0x40a3bd){_0x2c8b0c=path[_0x1510('0x23')](__dirname,_0x1510('0x24'),rs[_0x1510('0x25')](0x4)+_0x1510('0x26'));return convertFile(_0x525d99,_0x2c8b0c);})['then'](function(){try{fs[_0x1510('0x19')](_0x525d99);fs['chmodSync'](_0x2c8b0c,_0x1510('0x37'));}catch(_0x3a9a5c){logger['error'](_0x3a9a5c);}logger['info'](_0x1510('0x38'),_0x2c8b0c['split']('.')[0x0]);return _0x2c8b0c[_0x1510('0x39')]('.')[0x0];});};exports['googleTTS']=function(_0xfd08f1,_0x4844eb){var _0xda8bd8,_0x20e526;return tts(_0xfd08f1,_0x4844eb||'en',0x1)[_0x1510('0x29')](function(_0x21ab5b){logger[_0x1510('0x21')](_0x21ab5b);_0xda8bd8=path['resolve'](__dirname,'tmp',rs[_0x1510('0x25')](0x4)+_0x1510('0x3a'));return downloadFile(_0x21ab5b,_0xda8bd8);})[_0x1510('0x29')](function(){_0x20e526=path[_0x1510('0x23')](__dirname,'tmp',rs[_0x1510('0x25')](0x4)+_0x1510('0x26'));return convertFile(_0xda8bd8,_0x20e526);})[_0x1510('0x29')](function(){try{fs[_0x1510('0x19')](_0xda8bd8);fs['chmodSync'](_0x20e526,_0x1510('0x37'));}catch(_0x57dc02){logger['error'](_0x57dc02);}logger[_0x1510('0x21')](_0x1510('0x3b'),_0x20e526['split']('.')[0x0]);return _0x20e526[_0x1510('0x39')]('.')[0x0];});};exports[_0x1510('0x3c')]=function(_0x12fc05,_0x37dfbb,_0x3b32a5){return google[_0x1510('0x3d')](_0x12fc05,_0x37dfbb,_0x3b32a5)[_0x1510('0x29')](function(_0x5908ab){logger[_0x1510('0x21')](_0x5908ab[_0x1510('0x3e')]);return rp(_0x5908ab);})[_0x1510('0x29')](function(_0x12da9c){var _0x1f5668='';var _0x472b47=0x0;try{fs[_0x1510('0x19')](_0x12fc05);}catch(_0x510cc1){logger[_0x1510('0x12')](_0x510cc1);}if(_0x12da9c&&_0x12da9c[_0x1510('0x3f')]){_0x1f5668=_0x12da9c[_0x1510('0x3f')][_0x1510('0x40')](function(_0x855c9d){return _0x855c9d&&_0x855c9d[_0x1510('0x41')][0x0]&&_0x855c9d[_0x1510('0x41')][0x0][_0x1510('0x42')]?_0x855c9d[_0x1510('0x41')][0x0][_0x1510('0x42')]:'';})[_0x1510('0x43')]('\x0a');_0x472b47=_0x12da9c[_0x1510('0x3f')][_0x1510('0x40')](function(_0x3b7e51){return _0x3b7e51&&_0x3b7e51[_0x1510('0x41')][0x0]&&_0x3b7e51['alternatives'][0x0][_0x1510('0x44')]?_0x3b7e51['alternatives'][0x0]['confidence']:0x0;})[_0x1510('0x43')]('\x0a');}logger['info'](_0x1510('0x45'),_0x1f5668);logger[_0x1510('0x21')]('googleASR\x20confidence',_0x472b47);return{'transcript':_0x1f5668,'confidence':_0x472b47};})['catch'](function(_0x8500e8){logger['error'](_0x1510('0x46'),_0x8500e8[_0x1510('0x15')],_0x8500e8['name'],_0x8500e8[_0x1510('0x47')]);});};exports[_0x1510('0x48')]=function(_0x1356f1,_0x2d9a04,_0xf3e430,_0x1d4ea8){var _0x4e38e6=apiai(_0x2d9a04,{'language':_0x1d4ea8||'en'});return _0x4e38e6['textRequest'](_0xf3e430,{'sessionId':md5(_0x1356f1)})[_0x1510('0x29')](function(_0x42044f){logger[_0x1510('0x21')](JSON[_0x1510('0x49')](_0x42044f));return{'source':_0x42044f['result'][_0x1510('0x4a')],'resolvedQuery':_0x42044f[_0x1510('0x4b')][_0x1510('0x4c')],'action':_0x42044f[_0x1510('0x4b')]['action'],'actionIncomplete':_0x42044f[_0x1510('0x4b')][_0x1510('0x4d')],'speech':_0x42044f[_0x1510('0x4b')][_0x1510('0x4e')][_0x1510('0x4f')],'score':_0x42044f[_0x1510('0x4b')]['score'],'statusCode':_0x42044f[_0x1510('0x50')][_0x1510('0x51')],'endConversation':_0x42044f[_0x1510('0x4b')][_0x1510('0x52')][_0x1510('0x53')]||![],'isFallbackIntent':_0x42044f[_0x1510('0x4b')]['metadata'][_0x1510('0x54')]};});};exports['tildeASR']=function(_0x497069,_0x2068e5,_0x19925b,_0x18fb87){return tilde['asr'](_0x497069,_0x2068e5,_0x19925b,_0x18fb87)['then'](function(_0x5c6030){try{fs[_0x1510('0x19')](_0x497069);}catch(_0x3a1b55){logger[_0x1510('0x12')](_0x3a1b55);}logger[_0x1510('0x21')]('Tilde\x20ASR\x20transcription',_0x5c6030[_0x1510('0x42')]);logger[_0x1510('0x21')](_0x1510('0x55'),_0x5c6030['confidence']);return _0x5c6030;});};exports[_0x1510('0x56')]=function(_0x57db28,_0x5bf6de,_0x4edb86,_0x357d98,_0x56a866,_0xa9a18c){var _0x4a37fc=path[_0x1510('0x23')](__dirname,'tmp',rs[_0x1510('0x25')](0x4)+'.mp3');var _0x354831;return aws[_0x1510('0x57')](_0x57db28,_0x5bf6de,_0x4edb86,_0x357d98,_0x56a866,_0xa9a18c,_0x4a37fc)[_0x1510('0x29')](function(){_0x354831=path[_0x1510('0x23')](__dirname,_0x1510('0x24'),rs[_0x1510('0x25')](0x4)+_0x1510('0x26'));return convertFile(_0x4a37fc,_0x354831);})['then'](function(){try{fs[_0x1510('0x19')](_0x4a37fc);fs[_0x1510('0x2a')](_0x354831,_0x1510('0x37'));}catch(_0x3acd61){logger[_0x1510('0x12')](_0x3acd61);}return _0x354831['split']('.')[0x0];});};exports['awsLex']=function(_0x116f12,_0x243233,_0x59e499,_0x325b86,_0x236af5,_0x199d08){return aws[_0x1510('0x58')](_0x116f12,_0x243233,_0x59e499,_0x325b86,_0x236af5,_0x199d08)[_0x1510('0x29')](function(_0x30a7f8){logger[_0x1510('0x21')](JSON[_0x1510('0x49')](_0x30a7f8));return _0x30a7f8;});};exports['ispeechTTS']=function(_0x168917,_0x4e5a25,_0x54dacc,_0x336a80){var _0x4e846f=util['format'](_0x1510('0x59'),ISPEECH_API,_0x168917,encodeURIComponent(_0x4e5a25),_0x54dacc,_0x336a80);var _0x4e8d7c=path[_0x1510('0x23')](__dirname,'tmp',rs[_0x1510('0x25')](0x4)+'.mp3');var _0x4b63ae;return downloadFile(_0x4e846f,_0x4e8d7c)[_0x1510('0x29')](function(){_0x4b63ae=path[_0x1510('0x23')](__dirname,_0x1510('0x24'),rs[_0x1510('0x25')](0x4)+_0x1510('0x26'));return convertFile(_0x4e8d7c,_0x4b63ae);})[_0x1510('0x29')](function(){try{fs['unlink'](_0x4e8d7c);fs[_0x1510('0x2a')](_0x4b63ae,_0x1510('0x37'));}catch(_0x390d70){logger[_0x1510('0x12')](_0x390d70);}return _0x4b63ae[_0x1510('0x39')]('.')[0x0];});};exports[_0x1510('0x5a')]=function(_0x4957d4,_0x4ff58f,_0x439d84,_0x4b4969){var _0x583a64=util['format'](_0x1510('0x5b'),ISPEECH_API,_0x4ff58f,_0x439d84,base64Encode(_0x4957d4),_0x4b4969?util[_0x1510('0x5c')](_0x1510('0x5d'),encodeURIComponent(_0x4b4969)):_0x1510('0x5e'));return uploadFile(_0x583a64)[_0x1510('0x29')](function(_0x460657){return querystring[_0x1510('0x2')](_0x460657);});};exports[_0x1510('0x5f')]=function(_0x12cbe0,_0x299c86){return sestek[_0x1510('0x60')](_0x12cbe0,_0x299c86)[_0x1510('0x29')](function(_0x275d82){logger[_0x1510('0x21')](JSON[_0x1510('0x49')](_0x275d82));var _0x1ae802={'speech':_0x275d82[_0x1510('0x61')],'action':_0x275d82[_0x1510('0x62')]?_0x275d82[_0x1510('0x62')][_0x1510('0x63')]:undefined,'actiondata':_0x275d82[_0x1510('0x62')]?_0x275d82[_0x1510('0x62')][_0x1510('0x64')]:undefined};if(_0x275d82[_0x1510('0x62')]&&_0x275d82['channelData'][_0x1510('0x65')]){return base64Decode(_0x275d82[_0x1510('0x62')]['AudioFromTts'][_0x1510('0x66')],path['resolve'](__dirname,'tmp',rs[_0x1510('0x25')](0x4)+'.wav'))[_0x1510('0x29')](function(_0x465322){_0x1ae802[_0x1510('0x67')]=_0x465322;return _0x1ae802;});}return _0x1ae802;});};exports[_0x1510('0x68')]=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 265b94a..024d0de 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 _0x38fb=['./nda','exports'];(function(_0x1f5f11,_0x1722b6){var _0x29e4ab=function(_0x4aad83){while(--_0x4aad83){_0x1f5f11['push'](_0x1f5f11['shift']());}};_0x29e4ab(++_0x1722b6);}(_0x38fb,0xec));var _0xb38f=function(_0x187718,_0x427383){_0x187718=_0x187718-0x0;var _0x29ddf4=_0x38fb[_0x187718];return _0x29ddf4;};var nda=require(_0xb38f('0x0'));module[_0xb38f('0x1')]={'nda':nda}; \ No newline at end of file +var _0xe532=['./nda','exports'];(function(_0x561a85,_0x36d66a){var _0x1520a3=function(_0x3e4b5c){while(--_0x3e4b5c){_0x561a85['push'](_0x561a85['shift']());}};_0x1520a3(++_0x36d66a);}(_0xe532,0x1a8));var _0x2e53=function(_0x264545,_0x214037){_0x264545=_0x264545-0x0;var _0x114d10=_0xe532[_0x264545];return _0x114d10;};var nda=require(_0x2e53('0x0'));module[_0x2e53('0x1')]={'nda':nda}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/nda/index.js b/server/services/agi/scripts/sestek/nda/index.js index 9c24dc4..2ee40f8 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 _0x4485=['agi','exports','POST','resolve','ndauth_url','password','username','then','ndassistant_url','ndaactivity_type','Nda','uniqueid','dnid','extension','text','Bearer\x20','access_token','project','body','channelData','ProjectName','ndagenerate_audio','audio/wav','custom_action','CustomAction','CustomActionData','info','stringify','request-promise','url','../../../../../config/logger'];(function(_0x3b8868,_0x36b345){var _0x1ecd45=function(_0x8770a2){while(--_0x8770a2){_0x3b8868['push'](_0x3b8868['shift']());}};_0x1ecd45(++_0x36b345);}(_0x4485,0x152));var _0x5448=function(_0x373ba3,_0x265ccc){_0x373ba3=_0x373ba3-0x0;var _0x151f21=_0x4485[_0x373ba3];return _0x151f21;};'use strict';var rp=require(_0x5448('0x0'));var url=require(_0x5448('0x1'));var logger=require(_0x5448('0x2'))(_0x5448('0x3'));module[_0x5448('0x4')]=function(_0x33b7b0,_0xfb80b7){var _0x247c71={'method':_0x5448('0x5'),'uri':url[_0x5448('0x6')](_0xfb80b7[_0x5448('0x7')],'/token'),'form':{'grant_type':_0x5448('0x8'),'username':_0xfb80b7[_0x5448('0x9')],'password':_0xfb80b7[_0x5448('0x8')]},'json':!![]};return rp(_0x247c71)[_0x5448('0xa')](function(_0xd0db3a){var _0x4f811c={'method':_0x5448('0x5'),'uri':url['resolve'](_0xfb80b7[_0x5448('0xb')],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0xfb80b7[_0x5448('0xc')]||'message','channelId':_0x5448('0xd'),'conversation':{'id':_0x33b7b0[_0x5448('0xe')]},'from':{'id':_0x33b7b0['callerid'],'name':_0x33b7b0['calleridname']},'recipient':{'id':_0x33b7b0[_0x5448('0xf')],'name':_0x33b7b0[_0x5448('0x10')]},'text':_0xfb80b7[_0x5448('0x11')],'channelData':{}},'headers':{'Authorization':_0x5448('0x12')+_0xd0db3a[_0x5448('0x13')]},'json':!![]};if(_0xfb80b7[_0x5448('0x14')]){_0x4f811c[_0x5448('0x15')][_0x5448('0x16')][_0x5448('0x17')]=_0xfb80b7[_0x5448('0x14')];}if(_0xfb80b7[_0x5448('0x18')]=='1'){_0x4f811c[_0x5448('0x15')]['channelData']['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x5448('0x19')};}if(_0xfb80b7[_0x5448('0x1a')]){_0x4f811c[_0x5448('0x15')][_0x5448('0x16')][_0x5448('0x1b')]=_0xfb80b7['custom_action'];if(_0xfb80b7['custom_action_data']){_0x4f811c['body']['channelData'][_0x5448('0x1c')]=_0xfb80b7['custom_action_data'];}}logger[_0x5448('0x1d')](JSON[_0x5448('0x1e')](_0x4f811c));return rp(_0x4f811c);});}; \ No newline at end of file +var _0x44d7=['exports','POST','ndauth_url','/token','username','password','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','calleridname','dnid','Bearer\x20','access_token','body','channelData','ProjectName','ndagenerate_audio','AudioOutputSettings','audio/wav','custom_action','CustomAction','custom_action_data','info','stringify','request-promise','agi'];(function(_0x21a2b2,_0x22ba1e){var _0x2060b4=function(_0x38cfcb){while(--_0x38cfcb){_0x21a2b2['push'](_0x21a2b2['shift']());}};_0x2060b4(++_0x22ba1e);}(_0x44d7,0x150));var _0x744d=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0x44d7[_0x209941];return _0x1e8729;};'use strict';var rp=require(_0x744d('0x0'));var url=require('url');var logger=require('../../../../../config/logger')(_0x744d('0x1'));module[_0x744d('0x2')]=function(_0x497d25,_0x19005a){var _0x113af5={'method':_0x744d('0x3'),'uri':url['resolve'](_0x19005a[_0x744d('0x4')],_0x744d('0x5')),'form':{'grant_type':'password','username':_0x19005a[_0x744d('0x6')],'password':_0x19005a[_0x744d('0x7')]},'json':!![]};return rp(_0x113af5)['then'](function(_0x3bcb24){var _0x2b3fb3={'method':_0x744d('0x3'),'uri':url['resolve'](_0x19005a[_0x744d('0x8')],_0x744d('0x9')),'body':{'type':_0x19005a[_0x744d('0xa')]||'message','channelId':'Nda','conversation':{'id':_0x497d25['uniqueid']},'from':{'id':_0x497d25['callerid'],'name':_0x497d25[_0x744d('0xb')]},'recipient':{'id':_0x497d25[_0x744d('0xc')],'name':_0x497d25['extension']},'text':_0x19005a['text'],'channelData':{}},'headers':{'Authorization':_0x744d('0xd')+_0x3bcb24[_0x744d('0xe')]},'json':!![]};if(_0x19005a['project']){_0x2b3fb3[_0x744d('0xf')][_0x744d('0x10')][_0x744d('0x11')]=_0x19005a['project'];}if(_0x19005a[_0x744d('0x12')]=='1'){_0x2b3fb3[_0x744d('0xf')][_0x744d('0x10')][_0x744d('0x13')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x744d('0x14')};}if(_0x19005a[_0x744d('0x15')]){_0x2b3fb3['body'][_0x744d('0x10')][_0x744d('0x16')]=_0x19005a[_0x744d('0x15')];if(_0x19005a[_0x744d('0x17')]){_0x2b3fb3[_0x744d('0xf')][_0x744d('0x10')]['CustomActionData']=_0x19005a[_0x744d('0x17')];}}logger[_0x744d('0x18')](JSON[_0x744d('0x19')](_0x2b3fb3));return rp(_0x2b3fb3);});}; \ 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 50a2e80..6237e35 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 _0x702c=['exports','./lib/api'];(function(_0x2ec13e,_0x2ea526){var _0xb48415=function(_0x5566e4){while(--_0x5566e4){_0x2ec13e['push'](_0x2ec13e['shift']());}};_0xb48415(++_0x2ea526);}(_0x702c,0x87));var _0xc702=function(_0x403002,_0x141a35){_0x403002=_0x403002-0x0;var _0x43fc5b=_0x702c[_0x403002];return _0x43fc5b;};'use strict';var asr=require(_0xc702('0x0'));module[_0xc702('0x1')]=function(_0x4624d0,_0xcbdeb1,_0x52ae12,_0x172a71){return asr(_0x4624d0,_0xcbdeb1,_0x52ae12,_0x172a71);}; \ No newline at end of file +var _0x60b2=['./lib/api','exports'];(function(_0x102ca4,_0x3f6668){var _0x3e32f2=function(_0x15fd43){while(--_0x15fd43){_0x102ca4['push'](_0x102ca4['shift']());}};_0x3e32f2(++_0x3f6668);}(_0x60b2,0x114));var _0x260b=function(_0x12156e,_0x550b21){_0x12156e=_0x12156e-0x0;var _0x55ada7=_0x60b2[_0x12156e];return _0x55ada7;};'use strict';var asr=require(_0x260b('0x0'));module[_0x260b('0x1')]=function(_0x3babaf,_0x54f564,_0x57d060,_0x386f27){return asr(_0x3babaf,_0x54f564,_0x57d060,_0x386f27);}; \ 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 7517599..7ee2016 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 _0xf687=['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','info','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','data','close','EOS','Tilde\x20ASR\x20send\x20error','terminate','parse','result','Tilde\x20ASR\x20hypoteses','likelihood','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','error','isObject','open','message','bluebird','lodash','moment','crypto','../../../../../../config/logger','agi','Tilde\x20URI'];(function(_0x3bde94,_0x134590){var _0x4e9f7b=function(_0x41e170){while(--_0x41e170){_0x3bde94['push'](_0x3bde94['shift']());}};_0x4e9f7b(++_0x134590);}(_0xf687,0x1a6));var _0x7f68=function(_0x1ca2ba,_0x19be81){_0x1ca2ba=_0x1ca2ba-0x0;var _0x30d372=_0xf687[_0x1ca2ba];return _0x30d372;};'use strict';var BPromise=require(_0x7f68('0x0'));var _=require(_0x7f68('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x7f68('0x2'));var crypto=require(_0x7f68('0x3'));var logger=require(_0x7f68('0x4'))(_0x7f68('0x5'));module['exports']=function(_0x43ae57,_0x2e59aa,_0x2aa729,_0x2bc2d3){return new BPromise(function(_0x308968,_0xfd9e9d){logger['info'](_0x7f68('0x6'),_0x2bc2d3||_0x7f68('0x7'));var _0x45b6c8=new WebSocket(_0x2bc2d3||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x4ca975='';var _0x18a866='0';var _0xf6c5e='1';var _0xf0f2fc=_0x7f68('0x8');function _0x37a89f(_0x4dbdfc){var _0x303bfd=crypto['createHash'](_0x7f68('0x9'));_0x303bfd[_0x7f68('0xa')](_0x4dbdfc);return _0x303bfd[_0x7f68('0xb')]('hex');}function _0x5bc8c2(){try{logger[_0x7f68('0xc')](_0x7f68('0xd'));var _0x4780c9=moment()[_0x7f68('0xe')]();var _0x1528e8=_0x37a89f(_0x4780c9+_0x2e59aa+_0x2aa729);_0x45b6c8[_0x7f68('0xf')](JSON[_0x7f68('0x10')]({'appID':_0x2e59aa,'timestamp':_0x4780c9,'appKey':_0x1528e8}));var _0x3c90a9=fs['createReadStream'](_0x43ae57);_0x3c90a9['on'](_0x7f68('0x11'),function(_0x41c0ba){_0x45b6c8['send'](_0x41c0ba);});_0x3c90a9['on'](_0x7f68('0x12'),function(){_0x45b6c8[_0x7f68('0xf')](_0x7f68('0x13'));});}catch(_0x48de21){logger['error'](_0x7f68('0x14'),JSON[_0x7f68('0x10')](_0x48de21));_0x45b6c8[_0x7f68('0x15')]();}}function _0x3d2b53(_0x1bf0f){try{if(_0x1bf0f){var _0x4fe2b6=JSON[_0x7f68('0x16')](_0x1bf0f);switch(_0x4fe2b6['status']){case 0x0:if(_0x4fe2b6[_0x7f68('0x17')]){if(_0x4fe2b6[_0x7f68('0x17')]['final']){logger[_0x7f68('0xc')](_0x7f68('0x18'),JSON[_0x7f68('0x10')](_0x4fe2b6[_0x7f68('0x17')]['hypotheses']));_0x4ca975=_0x4fe2b6['result']['hypotheses'][0x0]['transcript'];_0x18a866=_0x4fe2b6['result']['hypotheses'][0x0][_0x7f68('0x19')];_0xf6c5e='0';_0xf0f2fc='Success.';_0x45b6c8['terminate']();}}break;case 0x1:logger[_0x7f68('0xc')](_0x7f68('0x8'));_0xf6c5e='1';_0xf0f2fc=_0x7f68('0x8');break;case 0x2:logger[_0x7f68('0xc')](_0x7f68('0x1a'));_0xf6c5e='2';_0xf0f2fc=_0x7f68('0x1a');break;case 0x9:logger[_0x7f68('0xc')](_0x7f68('0x1b'));_0xf6c5e='9';_0xf0f2fc=_0x7f68('0x1b');break;case 0xa:logger[_0x7f68('0xc')]('Authentication\x20failed.');_0xf6c5e='10';_0xf0f2fc=_0x7f68('0x1c');break;case 0xb:logger[_0x7f68('0xc')]('All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.');_0xf6c5e='11';_0xf0f2fc='All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.';}}}catch(_0x52d42a){logger[_0x7f68('0x1d')]('Tilde\x20ASR\x20parse\x20error',JSON[_0x7f68('0x10')](_0x52d42a));_0x45b6c8['terminate']();}}function _0x20d048(){logger[_0x7f68('0xc')]('Close\x20Tilde\x20ASR\x20socket');_0x308968({'transcript':_0x4ca975,'confidence':_0x18a866,'status':_0xf6c5e,'status_message':_0xf0f2fc});}function _0x5fc92(_0x520eb1){logger[_0x7f68('0x1d')]('Error\x20Tilde\x20ASR\x20socket');if(!_['isNil'](_0x520eb1)){logger[_0x7f68('0x1d')](_[_0x7f68('0x1e')](_0x520eb1)?JSON['stringify'](_0x520eb1):_0x520eb1);}}_0x45b6c8['on'](_0x7f68('0x1f'),_0x5bc8c2);_0x45b6c8['on'](_0x7f68('0x20'),_0x3d2b53);_0x45b6c8['on'](_0x7f68('0x12'),_0x20d048);_0x45b6c8['on'](_0x7f68('0x1d'),_0x5fc92);});}; \ No newline at end of file +var _0xfee9=['Error\x20Tilde\x20ASR\x20socket','isNil','open','message','bluebird','lodash','moment','../../../../../../config/logger','agi','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','sha1','update','digest','hex','Open\x20Tilde\x20ASR\x20socket','send','stringify','createReadStream','data','close','EOS','Tilde\x20ASR\x20send\x20error','terminate','parse','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','error','Close\x20Tilde\x20ASR\x20socket'];(function(_0xf9a0cb,_0x45afdf){var _0x44b3e0=function(_0x1494d0){while(--_0x1494d0){_0xf9a0cb['push'](_0xf9a0cb['shift']());}};_0x44b3e0(++_0x45afdf);}(_0xfee9,0x154));var _0x9fee=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xfee9[_0x59ee6f];return _0x4c0979;};'use strict';var BPromise=require(_0x9fee('0x0'));var _=require(_0x9fee('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x9fee('0x2'));var crypto=require('crypto');var logger=require(_0x9fee('0x3'))(_0x9fee('0x4'));module[_0x9fee('0x5')]=function(_0x4946e3,_0x5c9f4b,_0x386c63,_0x415560){return new BPromise(function(_0xbd9742,_0x3d6063){logger[_0x9fee('0x6')](_0x9fee('0x7'),_0x415560||_0x9fee('0x8'));var _0x493640=new WebSocket(_0x415560||_0x9fee('0x8'),{'perMessageDeflate':![]});var _0x5d71e9='';var _0x11ab30='0';var _0x413668='1';var _0x1a04bb=_0x9fee('0x9');function _0x4e1aa2(_0x614d97){var _0x2a2b5f=crypto['createHash'](_0x9fee('0xa'));_0x2a2b5f[_0x9fee('0xb')](_0x614d97);return _0x2a2b5f[_0x9fee('0xc')](_0x9fee('0xd'));}function _0x5a7524(){try{logger[_0x9fee('0x6')](_0x9fee('0xe'));var _0x5a0f61=moment()['unix']();var _0x44d9e1=_0x4e1aa2(_0x5a0f61+_0x5c9f4b+_0x386c63);_0x493640[_0x9fee('0xf')](JSON[_0x9fee('0x10')]({'appID':_0x5c9f4b,'timestamp':_0x5a0f61,'appKey':_0x44d9e1}));var _0x1c0b8b=fs[_0x9fee('0x11')](_0x4946e3);_0x1c0b8b['on'](_0x9fee('0x12'),function(_0x2944b1){_0x493640[_0x9fee('0xf')](_0x2944b1);});_0x1c0b8b['on'](_0x9fee('0x13'),function(){_0x493640[_0x9fee('0xf')](_0x9fee('0x14'));});}catch(_0x5581cf){logger['error'](_0x9fee('0x15'),JSON[_0x9fee('0x10')](_0x5581cf));_0x493640[_0x9fee('0x16')]();}}function _0xc76fa2(_0x5ca8fc){try{if(_0x5ca8fc){var _0x329bab=JSON[_0x9fee('0x17')](_0x5ca8fc);switch(_0x329bab[_0x9fee('0x18')]){case 0x0:if(_0x329bab[_0x9fee('0x19')]){if(_0x329bab[_0x9fee('0x19')][_0x9fee('0x1a')]){logger[_0x9fee('0x6')](_0x9fee('0x1b'),JSON[_0x9fee('0x10')](_0x329bab[_0x9fee('0x19')][_0x9fee('0x1c')]));_0x5d71e9=_0x329bab[_0x9fee('0x19')]['hypotheses'][0x0][_0x9fee('0x1d')];_0x11ab30=_0x329bab[_0x9fee('0x19')][_0x9fee('0x1c')][0x0][_0x9fee('0x1e')];_0x413668='0';_0x1a04bb=_0x9fee('0x1f');_0x493640['terminate']();}}break;case 0x1:logger['info'](_0x9fee('0x9'));_0x413668='1';_0x1a04bb='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';break;case 0x2:logger['info'](_0x9fee('0x20'));_0x413668='2';_0x1a04bb=_0x9fee('0x20');break;case 0x9:logger[_0x9fee('0x6')](_0x9fee('0x21'));_0x413668='9';_0x1a04bb='Not\x20available.\x20Max\x20load\x20limit\x20reached.';break;case 0xa:logger[_0x9fee('0x6')](_0x9fee('0x22'));_0x413668='10';_0x1a04bb=_0x9fee('0x22');break;case 0xb:logger['info'](_0x9fee('0x23'));_0x413668='11';_0x1a04bb='All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.';}}}catch(_0x4624a9){logger[_0x9fee('0x24')]('Tilde\x20ASR\x20parse\x20error',JSON[_0x9fee('0x10')](_0x4624a9));_0x493640['terminate']();}}function _0x28acbb(){logger['info'](_0x9fee('0x25'));_0xbd9742({'transcript':_0x5d71e9,'confidence':_0x11ab30,'status':_0x413668,'status_message':_0x1a04bb});}function _0x16c1c4(_0x53298b){logger[_0x9fee('0x24')](_0x9fee('0x26'));if(!_[_0x9fee('0x27')](_0x53298b)){logger[_0x9fee('0x24')](_['isObject'](_0x53298b)?JSON[_0x9fee('0x10')](_0x53298b):_0x53298b);}}_0x493640['on'](_0x9fee('0x28'),_0x5a7524);_0x493640['on'](_0x9fee('0x29'),_0xc76fa2);_0x493640['on']('close',_0x28acbb);_0x493640['on'](_0x9fee('0x24'),_0x16c1c4);});}; \ 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 c679077..fd9f0ab 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 _0x22fb=['exports','./asr'];(function(_0x987cf2,_0xa636d8){var _0x48e791=function(_0x21851d){while(--_0x21851d){_0x987cf2['push'](_0x987cf2['shift']());}};_0x48e791(++_0xa636d8);}(_0x22fb,0x18f));var _0xb22f=function(_0x46bf28,_0x856d2c){_0x46bf28=_0x46bf28-0x0;var _0x58890a=_0x22fb[_0x46bf28];return _0x58890a;};var asr=require(_0xb22f('0x0'));module[_0xb22f('0x1')]={'asr':asr}; \ No newline at end of file +var _0xa319=['exports','./asr'];(function(_0x1c4a39,_0x35868f){var _0x3d4f0c=function(_0x1e3995){while(--_0x1e3995){_0x1c4a39['push'](_0x1c4a39['shift']());}};_0x3d4f0c(++_0x35868f);}(_0xa319,0x179));var _0x9a31=function(_0x52865d,_0x1b6627){_0x52865d=_0x52865d-0x0;var _0x22f4b5=_0xa319[_0x52865d];return _0x22f4b5;};var asr=require(_0x9a31('0x0'));module[_0x9a31('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index e8ff229..7f9ef4c 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 _0xf2fa=['listening','connection','getConnections','E_AGI_SERVER_ERROR','destroy','code','close','E_AGI_SERVER_CLOSE','inherits','exports','util','EventEmitter','./error','./channel','127.0.0.1','call','emit','error'];(function(_0x4fe521,_0x4b1827){var _0x22fe32=function(_0x580a74){while(--_0x580a74){_0x4fe521['push'](_0x4fe521['shift']());}};_0x22fe32(++_0x4b1827);}(_0xf2fa,0xd0));var _0xaf2f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf2fa[_0x20a584];return _0x4b41a8;};'use strict';var util=require(_0xaf2f('0x0'));var net=require('net');var EventEmitter=require('events')[_0xaf2f('0x1')];var AGIError=require(_0xaf2f('0x2'));var AGIChannel=require(_0xaf2f('0x3'));var AGIServer=function(_0x339a31,_0x2256a3,_0x45ae14){var _0x96c9f7=this,_0x339a31=_0x339a31||0x11dd,_0x2256a3=_0x2256a3||_0xaf2f('0x4'),_0x3709f9=null,_0x49e700=0x0;EventEmitter[_0xaf2f('0x5')](_0x96c9f7);function _0x1c3cfa(){if(!_0x339a31){_0x96c9f7[_0xaf2f('0x6')](_0xaf2f('0x7'),new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x3709f9=net['createServer']();_0x3709f9['listen'](_0x339a31,_0x2256a3);_0x3709f9['on'](_0xaf2f('0x8'),function(){_0x96c9f7[_0xaf2f('0x6')](_0xaf2f('0x8'));});_0x3709f9['on'](_0xaf2f('0x9'),function(_0xa1081f){_0x3709f9[_0xaf2f('0xa')](function(_0x33d60e,_0x26f602){if(_0x33d60e){_0x96c9f7['emit'](_0xaf2f('0x7'),new AGIError(_0xaf2f('0xb'),_0x33d60e));}else if(_0x45ae14&&_0x45ae14<0x0){_0x96c9f7[_0xaf2f('0x6')]('error',new AGIError('E_AGI_SERVER_VOICE_DISABLED'));_0xa1081f['destroy']();}else if(_0x45ae14&&_0x45ae14>0x0&&_0x45ae14<_0x26f602){_0x49e700+=0x1;_0x96c9f7[_0xaf2f('0x6')](_0xaf2f('0x7'),new AGIError('E_AGI_SERVER_MAXCONNECTION',_0x49e700));_0xa1081f[_0xaf2f('0xc')]();}else{var _0x131862=new AGIChannel(_0xa1081f);_0x131862['on']('ready',function(){_0x96c9f7[_0xaf2f('0x6')]('connection',_0x131862);});}});});_0x3709f9['on'](_0xaf2f('0x7'),function(_0x30905b){_0x96c9f7[_0xaf2f('0x6')](_0xaf2f('0x7'),new AGIError(_0xaf2f('0xb'),_0x30905b[_0xaf2f('0xd')]));});_0x3709f9['on'](_0xaf2f('0xe'),function(){_0x96c9f7[_0xaf2f('0x6')](_0xaf2f('0xe'),new AGIError(_0xaf2f('0xf')));});}process['nextTick'](function(){_0x1c3cfa();});};util[_0xaf2f('0x10')](AGIServer,EventEmitter);module[_0xaf2f('0x11')]=function(_0x4d5c24,_0x5aa1f6,_0xb64c0e){return new AGIServer(_0x4d5c24,_0x5aa1f6,_0xb64c0e);}; \ No newline at end of file +var _0x0962=['util','net','events','EventEmitter','./channel','127.0.0.1','call','emit','error','E_AGI_ARGUMENT_PORT','createServer','listen','listening','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','connection','code','close','E_AGI_SERVER_CLOSE','inherits','exports'];(function(_0x15cae3,_0x458cb9){var _0x20596f=function(_0x1ad3e6){while(--_0x1ad3e6){_0x15cae3['push'](_0x15cae3['shift']());}};_0x20596f(++_0x458cb9);}(_0x0962,0x198));var _0x2096=function(_0x16aae1,_0x3a71fa){_0x16aae1=_0x16aae1-0x0;var _0x57f838=_0x0962[_0x16aae1];return _0x57f838;};'use strict';var util=require(_0x2096('0x0'));var net=require(_0x2096('0x1'));var EventEmitter=require(_0x2096('0x2'))[_0x2096('0x3')];var AGIError=require('./error');var AGIChannel=require(_0x2096('0x4'));var AGIServer=function(_0x580e85,_0x575ef5,_0x2fe7b1){var _0x2001d9=this,_0x580e85=_0x580e85||0x11dd,_0x575ef5=_0x575ef5||_0x2096('0x5'),_0x1ce10d=null,_0x462564=0x0;EventEmitter[_0x2096('0x6')](_0x2001d9);function _0x4b5f76(){if(!_0x580e85){_0x2001d9[_0x2096('0x7')](_0x2096('0x8'),new AGIError(_0x2096('0x9')));return![];}_0x1ce10d=net[_0x2096('0xa')]();_0x1ce10d[_0x2096('0xb')](_0x580e85,_0x575ef5);_0x1ce10d['on'](_0x2096('0xc'),function(){_0x2001d9[_0x2096('0x7')](_0x2096('0xc'));});_0x1ce10d['on']('connection',function(_0x22ea80){_0x1ce10d[_0x2096('0xd')](function(_0x4ee402,_0xbd3160){if(_0x4ee402){_0x2001d9[_0x2096('0x7')](_0x2096('0x8'),new AGIError(_0x2096('0xe'),_0x4ee402));}else if(_0x2fe7b1&&_0x2fe7b1<0x0){_0x2001d9[_0x2096('0x7')]('error',new AGIError(_0x2096('0xf')));_0x22ea80[_0x2096('0x10')]();}else if(_0x2fe7b1&&_0x2fe7b1>0x0&&_0x2fe7b1<_0xbd3160){_0x462564+=0x1;_0x2001d9[_0x2096('0x7')]('error',new AGIError(_0x2096('0x11'),_0x462564));_0x22ea80[_0x2096('0x10')]();}else{var _0x420c57=new AGIChannel(_0x22ea80);_0x420c57['on']('ready',function(){_0x2001d9[_0x2096('0x7')](_0x2096('0x12'),_0x420c57);});}});});_0x1ce10d['on'](_0x2096('0x8'),function(_0x305ada){_0x2001d9['emit'](_0x2096('0x8'),new AGIError(_0x2096('0xe'),_0x305ada[_0x2096('0x13')]));});_0x1ce10d['on']('close',function(){_0x2001d9['emit'](_0x2096('0x14'),new AGIError(_0x2096('0x15')));});}process['nextTick'](function(){_0x4b5f76();});};util[_0x2096('0x16')](AGIServer,EventEmitter);module[_0x2096('0x17')]=function(_0x150f20,_0x509ddc,_0x2a9f62){return new AGIServer(_0x150f20,_0x509ddc,_0x2a9f62);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 248ae65..5cb3d6e 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 _0x1afa=['no\x20user\x20selected','no\x20user\x20found','DIAL','SIP/%s','opts','Executed\x20command\x20%s','no\x20key\x20configured','bot','createSquareMessage','DIALOGFLOW_%s','speech','out','Dialogflow\x20is\x20unreachable','sesteknda','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','unlink','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','trunk_id','no\x20trunk\x20selected','getTrunk','no\x20trunk\x20found','trunk_name','Enter\x20in\x20FINALLY\x20(%s)\x20block','finally','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','no\x20file\x20audio\x20selected','file_id','no\x20file\x20audio\x20found','getData','response','maxdigit','test','mindigit','hiddendigitsnum','first','generate','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','.wav','aws\x20Polly\x20is\x20unreachable','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','Amazon\x20Lex\x20Result\x20%s','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','beep','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','no\x20appid\x20configured','no\x20appsecret\x20configured','NOBEEP','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','extension','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','true','false','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20intervals\x20found','IFTIME\x20%s\x20%s','Enter\x20in\x20HANGUP\x20(%s)\x20block','hangup','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','streamFile','ispeech\x20TTS\x20is\x20unreachable','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','Enter\x20in\x20MATH\x20(%s)\x20block','no\x20operation\x20configured','math\x20%s','operation','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue_id','no\x20queue\x20found','XMCS-QUEUE','toLowerCase','QUEUE','macro','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','user','bcc','subject','service','host','port','secure','auth','pass','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','no\x20sms\x20account\x20configured','sms_account_id','sms_text','sendSMS\x20message','Sms\x20message\x20added\x20to\x20outgoing\x20process','variable_value','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Answer','Skipped\x20Answer','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://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','AGI','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','tts','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','no\x20variable\x20selected','replaceAll','split','join','exports','util','lodash','shelljs','odbc','randomstring','moment','../../config/logger','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getdigits','getsecretdigits','channel','rpc','mailRpc','prototype','getVariable','getVariableById','catch','getVoiceQueue','name','getSquareProjectById','getSquareOdbcById','then','dsn','getUser','getUserById','getTrunkById','getSound','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','IntervalId','interval','map','Intervals','getSoundPath','format','%s/sounds/converted/%s','getQueryOdbc','error','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','agicommand','arg_1','callerid','createSquareRecording','calleridname','context','priority','accountcode','file','createCmContact','isNil','callback_','random','lastName','phone','scheduledAt','callback','Callback\x20scheduled\x20at\x20','callback_priority','getPause','getPauseById','agentPause','agent','agentUnpause','agentLogout','internal','%s/%s@from-sip/n','agentLogin','shellCommand','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','en-US','audioEncoding','MP3','google_tts_language','restAPI','method','number','timeout','POST','PUT','toUpperCase','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','url','stringify','body','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','dialogflow_language','sestekNDA','ispeechTTS','key','ispeech_tts_language','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_secret_access_key','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_access_key_id','aws_bot_name','googleASR','tildeASR','appid','appsecret','clear','hasOwnProperty','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','isString','saveRestApiResult','isEmpty','%s.%s','length','setVariable','extra','toString','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','exec','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','label','grammar','MRCPRecog','getAndSetVariable','RECOG_CONFIDENCE()','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','agi','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','Enter\x20in\x20CALLBACK\x20(%s)\x20block','list_id','delay','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','Executed\x20command\x20MRCPSynth\x20%s','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','MRCPSynth','lumenvoxasr','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','no\x20database\x20selected','getSquareOdbc','odbc_id','no\x20odbc\x20database\x20found','no\x20query\x20configured','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','sip_id'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x1afa,0xe0));var _0xa1af=function(_0x14ca78,_0x284b65){_0x14ca78=_0x14ca78-0x0;var _0x22b766=_0x1afa[_0x14ca78];return _0x22b766;};'use strict';var fs=require('fs');var path=require('path');var util=require(_0xa1af('0x0'));var _=require(_0xa1af('0x1'));var sh=require(_0xa1af('0x2'));var odbc=require(_0xa1af('0x3'))();var rs=require(_0xa1af('0x4'));var moment=require(_0xa1af('0x5'));var Mustache=require('mustache');var rp=require('request-promise');var logger=require(_0xa1af('0x6'))('agi');var config=require('../../config/environment');var scripts=require(_0xa1af('0x7'));var FILES_PATH=_0xa1af('0x8');var recursiveMapAttributes=[_0xa1af('0x9'),_0xa1af('0xa')];var verticesWithRetry=[_0xa1af('0xb'),_0xa1af('0xc'),_0xa1af('0xd')];var AGIVertices=function(_0x252377,_0x1bead2,_0x10b2c2){this[_0xa1af('0xe')]=_0x252377;this[_0xa1af('0xf')]=_0x1bead2;this[_0xa1af('0x10')]=_0x10b2c2;};AGIVertices[_0xa1af('0x11')][_0xa1af('0x12')]=function(_0x158e3f,_0x308eaa){this[_0xa1af('0xf')][_0xa1af('0x13')](_0x158e3f)['then'](function(_0x3411cb){_0x308eaa(null,_0x3411cb?_0x3411cb['name']:![]);})[_0xa1af('0x14')](function(_0x25d457){_0x308eaa(_0x25d457);});};AGIVertices['prototype'][_0xa1af('0x15')]=function(_0x224d6e,_0x1f5563){this[_0xa1af('0xf')]['getVoiceQueueById'](_0x224d6e)['then'](function(_0x2654c8){_0x1f5563(null,_0x2654c8?_0x2654c8[_0xa1af('0x16')]:![]);})['catch'](function(_0x1bbbfc){_0x1f5563(_0x1bbbfc);});};AGIVertices[_0xa1af('0x11')]['getSquareProject']=function(_0x1018d5,_0x2b349b){this['rpc'][_0xa1af('0x17')](_0x1018d5)['then'](function(_0x340b4a){_0x2b349b(null,_0x340b4a?_0x340b4a[_0xa1af('0x16')]:![]);})[_0xa1af('0x14')](function(_0x3235bf){_0x2b349b(_0x3235bf);});};AGIVertices['prototype']['getSquareOdbc']=function(_0x5d4ba6,_0xad6a0d){this[_0xa1af('0xf')][_0xa1af('0x18')](_0x5d4ba6)[_0xa1af('0x19')](function(_0x2319f8){_0xad6a0d(null,_0x2319f8?_0x2319f8[_0xa1af('0x1a')]:![]);})[_0xa1af('0x14')](function(_0x22fac6){_0xad6a0d(_0x22fac6);});};AGIVertices[_0xa1af('0x11')][_0xa1af('0x1b')]=function(_0x421d52,_0x3f2416){this['rpc'][_0xa1af('0x1c')](_0x421d52)[_0xa1af('0x19')](function(_0xdaaf6d){_0x3f2416(null,_0xdaaf6d?_0xdaaf6d[_0xa1af('0x16')]:![]);})[_0xa1af('0x14')](function(_0x47c6ca){_0x3f2416(_0x47c6ca);});};AGIVertices[_0xa1af('0x11')]['getTrunk']=function(_0x1d732c,_0x30b991){this[_0xa1af('0xf')][_0xa1af('0x1d')](_0x1d732c)[_0xa1af('0x19')](function(_0x26a726){_0x30b991(null,_0x26a726?_0x26a726[_0xa1af('0x16')]:![]);})['catch'](function(_0x5bdc06){_0x30b991(_0x5bdc06);});};AGIVertices[_0xa1af('0x11')][_0xa1af('0x1e')]=function(_0x2353f8,_0x1407be){var _0x17a84b=this;this[_0xa1af('0xf')]['getSoundById'](_0x2353f8)['then'](function(_0x4bd8fd){_0x1407be(null,_0x4bd8fd?_0x17a84b['getSoundPath'](_0x4bd8fd[_0xa1af('0x1f')]):![]);})[_0xa1af('0x14')](function(_0x2c8d5c){_0x1407be(_0x2c8d5c);});};AGIVertices[_0xa1af('0x11')][_0xa1af('0x20')]=function(_0x2569c7,_0x902435){this[_0xa1af('0xf')][_0xa1af('0x21')](_0x2569c7)['then'](function(_0x1a91bb){_0x902435(null,_0x1a91bb?_0x1a91bb:![]);})[_0xa1af('0x14')](function(_0x37b7e3){_0x902435(_0x37b7e3);});};AGIVertices[_0xa1af('0x11')][_0xa1af('0x22')]=function(_0xa2043e,_0x1f1c08,_0x552000){this[_0xa1af('0x10')]['sendMailMessage'](_0xa2043e,_0x1f1c08)[_0xa1af('0x19')](function(){_0x552000(null);})[_0xa1af('0x14')](function(_0x3ce0d6){_0x552000(_0x3ce0d6);});};AGIVertices[_0xa1af('0x11')][_0xa1af('0x23')]=function(_0x4231a6,_0xb011c5){this[_0xa1af('0xf')][_0xa1af('0x24')](_0x4231a6)[_0xa1af('0x19')](function(_0x3bbc54){if(_0x3bbc54){if(_0x3bbc54[_0xa1af('0x25')]){_0xb011c5(null,[_0x3bbc54[_0xa1af('0x26')]]);}else{_0xb011c5(null,_[_0xa1af('0x27')](_0x3bbc54[_0xa1af('0x28')],_0xa1af('0x26')));}}else{_0xb011c5(null,![]);}})[_0xa1af('0x14')](function(_0x49152b){_0xb011c5(_0x49152b);});};AGIVertices[_0xa1af('0x11')][_0xa1af('0x29')]=function(_0x24e2fe){return util[_0xa1af('0x2a')](_0xa1af('0x2b'),FILES_PATH,_0x24e2fe);};AGIVertices[_0xa1af('0x11')][_0xa1af('0x2c')]=function(_0x2a8d2d,_0x334a72,_0x5d2c1e){odbc['open'](_0x2a8d2d,function(_0x39e8cd){if(_0x39e8cd){logger[_0xa1af('0x2d')]('Error\x20getting\x20ODBC\x20connection\x20%s',_0x39e8cd);_0x5d2c1e(_0x39e8cd);}else{logger[_0xa1af('0x2e')](_0xa1af('0x2f'));odbc[_0xa1af('0x30')](_0x334a72,function(_0x57f28a,_0x244024){if(_0x57f28a){logger[_0xa1af('0x2e')](_0xa1af('0x31'),_0x334a72);_0x5d2c1e(_0x57f28a);}else{logger[_0xa1af('0x2e')](_0xa1af('0x32'),_0x334a72);odbc[_0xa1af('0x33')](function(_0x454e5c){if(_0x454e5c){logger[_0xa1af('0x2d')](_0xa1af('0x34'),_0x454e5c);}_0x5d2c1e(null,_0x244024);});}});}});};AGIVertices['prototype'][_0xa1af('0x35')]=function(_0x8623b7,_0x4028f7){this[_0xa1af('0xf')]['getSmsAccountById'](_0x8623b7)['then'](function(_0x5be1dd){_0x4028f7(null,_0x5be1dd?_0x5be1dd:![]);})['catch'](function(_0x537a37){_0x4028f7(_0x537a37);});};AGIVertices['prototype'][_0xa1af('0x36')]=function(_0x4e58a3,_0x5e3a53){this[_0xa1af('0xf')][_0xa1af('0x36')](_0x4e58a3)[_0xa1af('0x19')](function(_0x47397f){_0x5e3a53(null,_0x47397f);})[_0xa1af('0x14')](function(_0x474619){_0x5e3a53(_0x474619);});};AGIVertices['prototype'][_0xa1af('0x37')]=function(_0x284069,_0x4bca7a,_0x155932){this[_0xa1af('0xf')][_0xa1af('0x37')]({'uniqueid':this['channel'][_0xa1af('0x38')],'node':_0x284069['label'],'application':_0x284069[_0xa1af('0x39')],'data':_0x4bca7a||null,'project_name':this[_0xa1af('0xe')][_0xa1af('0x3a')],'callerid':this[_0xa1af('0xe')][_0xa1af('0x3b')]})[_0xa1af('0x19')](function(_0x30ad1c){if(_0x155932){_0x155932(null,_0x30ad1c);}})[_0xa1af('0x14')](function(_0x34689f){if(_0x155932){_0x155932(_0x34689f);}});};AGIVertices[_0xa1af('0x11')][_0xa1af('0x3c')]=function(_0x2821dd,_0x2e4dd7,_0x5b3a91,_0x2daedc){this[_0xa1af('0xf')]['createSquareRecording']({'uniqueid':this[_0xa1af('0xe')][_0xa1af('0x38')],'callerid':this[_0xa1af('0xe')]['callerid'],'calleridname':this['channel'][_0xa1af('0x3d')],'context':this[_0xa1af('0xe')][_0xa1af('0x3e')],'extension':this['channel']['extension'],'priority':this[_0xa1af('0xe')][_0xa1af('0x3f')],'accountcode':this[_0xa1af('0xe')][_0xa1af('0x40')],'dnid':this[_0xa1af('0xe')]['dnid'],'projectName':this['channel'][_0xa1af('0x3a')],'saveName':_0x2e4dd7,'filename':_0x2821dd[_0xa1af('0x41')]||_0x2e4dd7,'savePath':_0x5b3a91})['then'](function(_0x154bf4){_0x2daedc(null,_0x154bf4);})[_0xa1af('0x14')](function(_0xd4770e){_0x2daedc(_0xd4770e);});};AGIVertices[_0xa1af('0x11')]['createSquareMessage']=function(_0x5f3e8b,_0x4fe59c,_0x11d21e){this[_0xa1af('0xf')]['createSquareMessage']({'uniqueid':this[_0xa1af('0xe')][_0xa1af('0x38')],'body':_0x5f3e8b,'direction':_0x4fe59c})[_0xa1af('0x19')](function(_0x40995d){if(_0x11d21e){_0x11d21e(null,_0x40995d);}})['catch'](function(_0x294569){if(_0x11d21e){_0x11d21e(_0x294569);}});};AGIVertices[_0xa1af('0x11')][_0xa1af('0x42')]=function(_0x36a27e,_0x360d91){this[_0xa1af('0xf')][_0xa1af('0x42')]({'firstName':_['isEmpty'](_0x36a27e[_0xa1af('0x16')])||_[_0xa1af('0x43')](_0x36a27e[_0xa1af('0x16')])?_0xa1af('0x44')+Math[_0xa1af('0x45')]():_0x36a27e[_0xa1af('0x16')],'lastName':_['isEmpty'](_0x36a27e[_0xa1af('0x46')])||_[_0xa1af('0x43')](_0x36a27e['lastName'])?null:_0x36a27e['lastName'],'phone':_0x36a27e[_0xa1af('0x47')],'ListId':_0x36a27e['list_id'],'scheduledat':_0x36a27e[_0xa1af('0x48')],'callbackUniqueid':this['channel'][_0xa1af('0x38')],'tags':_0xa1af('0x49'),'description':_0xa1af('0x4a')+_0x36a27e[_0xa1af('0x48')]['toString'](),'priority':_0x36a27e[_0xa1af('0x4b')]})[_0xa1af('0x19')](function(_0x98dd54){_0x360d91(null,_0x98dd54);})[_0xa1af('0x14')](function(_0x25267d){_0x360d91(_0x25267d);});};AGIVertices[_0xa1af('0x11')][_0xa1af('0x4c')]=function(_0x6d60f2,_0x58efdd){this[_0xa1af('0xf')][_0xa1af('0x4d')](_0x6d60f2)[_0xa1af('0x19')](function(_0x399399){_0x58efdd(null,_0x399399?_0x399399[_0xa1af('0x16')]:![]);})[_0xa1af('0x14')](function(_0x1d0dcb){_0x58efdd(_0x1d0dcb);});};AGIVertices[_0xa1af('0x11')][_0xa1af('0x4e')]=function(_0x5b9f38,_0x130b9c,_0x203b54){var _0x20792e={'role':_0xa1af('0x4f')};_0x20792e[_0x5b9f38]=this[_0xa1af('0xe')]['callerid'];this[_0xa1af('0xf')][_0xa1af('0x4e')](_0x20792e,_0x130b9c,this[_0xa1af('0xe')][_0xa1af('0x38')])[_0xa1af('0x19')](function(_0x3bc90e){_0x203b54(null,_[_0xa1af('0x43')](_0x3bc90e)?![]:!![]);})['catch'](function(_0x4ef5b7){logger['error'](_0x4ef5b7);_0x203b54(null,![]);});};AGIVertices['prototype']['agentUnpause']=function(_0x110530,_0x2cb8fa){var _0x795a9a={'role':'agent'};_0x795a9a[_0x110530]=this[_0xa1af('0xe')][_0xa1af('0x3b')];this[_0xa1af('0xf')][_0xa1af('0x50')](_0x795a9a)['then'](function(_0xd5c762){_0x2cb8fa(null,_[_0xa1af('0x43')](_0xd5c762)?![]:!![]);})[_0xa1af('0x14')](function(_0x50e202){logger[_0xa1af('0x2d')](_0x50e202);_0x2cb8fa(null,![]);});};AGIVertices['prototype'][_0xa1af('0x51')]=function(_0xe6d5a6,_0x1f083d){var _0x451689={'role':_0xa1af('0x4f')};_0x451689[_0xe6d5a6]=this[_0xa1af('0xe')][_0xa1af('0x3b')];this[_0xa1af('0xf')][_0xa1af('0x51')](_0x451689)[_0xa1af('0x19')](function(_0xed67cc){_0x1f083d(null,_[_0xa1af('0x43')](_0xed67cc)?![]:!![]);})[_0xa1af('0x14')](function(_0x2b1cc1){logger[_0xa1af('0x2d')](_0x2b1cc1);_0x1f083d(null,![]);});};AGIVertices['prototype']['agentLogin']=function(_0x51bd8b,_0x75999a){var _0x9fa34a={'role':'agent'};_0x9fa34a[_0x51bd8b]=this[_0xa1af('0xe')][_0xa1af('0x3b')];var _0x146472=_0x51bd8b!=_0xa1af('0x52')?util[_0xa1af('0x2a')](_0xa1af('0x53'),'LOCAL',this[_0xa1af('0xe')][_0xa1af('0x3b')]):undefined;this[_0xa1af('0xf')][_0xa1af('0x54')](_0x9fa34a,_0x146472)[_0xa1af('0x19')](function(_0x4b74e9){_0x75999a(null,_['isNil'](_0x4b74e9)?![]:!![]);})[_0xa1af('0x14')](function(_0x17bc29){logger[_0xa1af('0x2d')](_0x17bc29);_0x75999a(null,![]);});};AGIVertices[_0xa1af('0x11')][_0xa1af('0x55')]=function(_0x18ba18,_0x176501){sh['exec'](_[_0xa1af('0x56')](_0x18ba18),function(_0x4194f2,_0x46c610){var _0x397f20=_0x46c610[_0xa1af('0x57')](/(\r\n|\n|\r)/gm,'');_0x176501(null,_0x397f20);});};AGIVertices[_0xa1af('0x11')][_0xa1af('0x58')]=function(_0x53abe2,_0x1d0967){scripts[_0xa1af('0x58')](_0x53abe2[_0xa1af('0x59')],_0x53abe2[_0xa1af('0x5a')]||_0xa1af('0x5b'),_0x53abe2[_0xa1af('0x5b')],_0x53abe2[_0xa1af('0x5c')]||_0xa1af('0x5d'),_0x53abe2['ssmlGender']||'MALE',_0x53abe2[_0xa1af('0x5e')]||_0xa1af('0x5f'))[_0xa1af('0x19')](function(_0x4f73b5){_0x1d0967(null,_0x4f73b5);})[_0xa1af('0x14')](function(_0xe16f2d){_0x1d0967(_0xe16f2d);});};AGIVertices[_0xa1af('0x11')]['googleTTS']=function(_0x2982cf,_0x1c73d9){scripts['googleTTS'](_0x2982cf[_0xa1af('0x5b')],_0x2982cf[_0xa1af('0x60')]||'en',0x1)[_0xa1af('0x19')](function(_0x29fec7){_0x1c73d9(null,_0x29fec7);})[_0xa1af('0x14')](function(_0x1b275f){_0x1c73d9(_0x1b275f);});};AGIVertices[_0xa1af('0x11')][_0xa1af('0x61')]=function(_0x1e07f8,_0x5e080c){var _0x33b660={'uri':_0x1e07f8['url'],'method':_0x1e07f8[_0xa1af('0x62')],'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x1e07f8['timeout'])===_0xa1af('0x63')&&parseInt(_0x1e07f8['timeout'])>=0x1?parseInt(_0x1e07f8[_0xa1af('0x64')])*0x3e8:0x5*0x3e8};if(_['includes']([_0xa1af('0x65'),_0xa1af('0x66')],_0x33b660[_0xa1af('0x62')][_0xa1af('0x67')]())){try{_0x33b660['body']=_0x1e07f8[_0xa1af('0xa')]?JSON[_0xa1af('0x68')](_0x1e07f8[_0xa1af('0xa')]):{};}catch(_0x163d0f){logger[_0xa1af('0x2d')](_0xa1af('0x69'),_0x163d0f);}}try{_0x33b660[_0xa1af('0x6a')]=_0x1e07f8[_0xa1af('0x9')]?JSON[_0xa1af('0x68')](_0x1e07f8['rawHeaders']):{};}catch(_0x581eea){logger[_0xa1af('0x2d')](_0xa1af('0x6b'),_0x581eea);}if(_0x1e07f8[_0xa1af('0x6c')]){try{var _0x460f54=require(_0x1e07f8[_0xa1af('0x6c')])[_0xa1af('0x6d')](this,_0x33b660);_0x33b660[_0xa1af('0x6e')]=Mustache[_0xa1af('0x6f')](_0x1e07f8[_0xa1af('0x70')],_0x460f54,{},['$$','$$']);if(_0x33b660['headers']){_0x33b660['headers']=JSON[_0xa1af('0x68')](Mustache[_0xa1af('0x6f')](JSON[_0xa1af('0x71')](_0x33b660[_0xa1af('0x6a')]),_0x460f54,{},['$$','$$']));}if(_0x33b660[_0xa1af('0x72')]){_0x33b660['body']=JSON[_0xa1af('0x68')](Mustache[_0xa1af('0x6f')](JSON['stringify'](_0x33b660[_0xa1af('0x72')]),_0x460f54,{},['$$','$$']));}}catch(_0x5f3808){logger[_0xa1af('0x2d')]('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x5f3808);}}rp(_0x33b660)[_0xa1af('0x19')](function(_0x631b95){var _0x292a14={'statusCode':_0x631b95[_0xa1af('0x73')]||0xc8,'statusMessage':_0x631b95[_0xa1af('0x74')]||'OK','headers':_0x631b95['headers']||{},'body':_0x631b95[_0xa1af('0x72')]||{}};_0x5e080c(null,_0x292a14);})['catch'](function(_0x4eea3a){var _0x52fbbb={'statusCode':_0x4eea3a[_0xa1af('0x73')]||0x1f4,'statusMessage':_0x4eea3a[_0xa1af('0x75')]||_0xa1af('0x76'),'headers':_0x4eea3a[_0xa1af('0x77')][_0xa1af('0x6a')]||{},'body':_0x4eea3a['options']['body']||{}};_0x5e080c(null,_0x52fbbb);});};AGIVertices[_0xa1af('0x11')][_0xa1af('0x78')]=function(_0x48877c,_0x52cceb){scripts[_0xa1af('0x78')](this[_0xa1af('0xe')][_0xa1af('0x38')],_0x48877c['key'],_0x48877c[_0xa1af('0x5b')],_0x48877c[_0xa1af('0x79')]||'en')[_0xa1af('0x19')](function(_0xee10e9){_0x52cceb(null,_0xee10e9);})['catch'](function(_0x22bb46){_0x52cceb(_0x22bb46);});};AGIVertices[_0xa1af('0x11')][_0xa1af('0x7a')]=function(_0x45d97f,_0x38d9ae){scripts[_0xa1af('0x7a')](this['channel'],_0x45d97f)[_0xa1af('0x19')](function(_0x2c74c1){_0x38d9ae(null,_0x2c74c1);})['catch'](function(_0x5b38bb){_0x38d9ae(_0x5b38bb);});};AGIVertices['prototype'][_0xa1af('0x7b')]=function(_0x2de261,_0x2f81a8){scripts[_0xa1af('0x7b')](_0x2de261[_0xa1af('0x7c')],_0x2de261[_0xa1af('0x5b')],_0x2de261[_0xa1af('0x7d')]||_0xa1af('0x5d'),_0x2de261['speed'])[_0xa1af('0x19')](function(_0x392562){_0x2f81a8(null,_0x392562);})[_0xa1af('0x14')](function(_0x2a8021){_0x2f81a8(_0x2a8021);});};AGIVertices['prototype'][_0xa1af('0x7e')]=function(_0x55e628,_0x305f52,_0x26f570){scripts[_0xa1af('0x7e')](_0x305f52,_0x55e628['key'],_0x55e628[_0xa1af('0x7f')]||_0xa1af('0x5d'),this[_0xa1af('0x80')](_0x55e628['model'])?_0x55e628[_0xa1af('0x81')]:undefined)['then'](function(_0x30511f){_0x26f570(null,_0x30511f);})[_0xa1af('0x14')](function(_0x52e16c){_0x26f570(_0x52e16c);});};AGIVertices['prototype'][_0xa1af('0x82')]=function(_0x41b1fd,_0x5ddd92){scripts[_0xa1af('0x82')](_0x41b1fd['aws_access_key_id'],_0x41b1fd[_0xa1af('0x83')],_0x41b1fd[_0xa1af('0x84')],_0x41b1fd[_0xa1af('0x85')]||_0xa1af('0x86'),_0x41b1fd[_0xa1af('0x5b')],_0x41b1fd[_0xa1af('0x87')]||_0xa1af('0x5b'))[_0xa1af('0x19')](function(_0x8fb219){_0x5ddd92(null,_0x8fb219);})[_0xa1af('0x14')](function(_0x13dd29){_0x5ddd92(_0x13dd29);});};AGIVertices['prototype'][_0xa1af('0x88')]=function(_0x16bc21,_0x1c43d3){scripts[_0xa1af('0x88')](this[_0xa1af('0xe')]['uniqueid'],_0x16bc21[_0xa1af('0x89')],_0x16bc21[_0xa1af('0x83')],_0x16bc21['aws_lex_region'],_0x16bc21[_0xa1af('0x5b')],_0x16bc21[_0xa1af('0x8a')])[_0xa1af('0x19')](function(_0x36e2e5){_0x1c43d3(null,_0x36e2e5);})[_0xa1af('0x14')](function(_0x3cc92b){_0x1c43d3(_0x3cc92b);});};AGIVertices[_0xa1af('0x11')]['googleASR']=function(_0x451816,_0x4a5311,_0x25d2bc){scripts[_0xa1af('0x8b')](_0x4a5311,_0x451816['key'],_0x451816['google_asr_language']||_0xa1af('0x5d'))[_0xa1af('0x19')](function(_0x59eabf){_0x25d2bc(null,_0x59eabf);})['catch'](function(_0x1762fb){_0x25d2bc(_0x1762fb);});};AGIVertices['prototype']['tildeASR']=function(_0x4fe878,_0x4666f2,_0x253d4e){scripts[_0xa1af('0x8c')](_0x4666f2,_0x4fe878[_0xa1af('0x8d')],_0x4fe878[_0xa1af('0x8e')],_0x4fe878['uri'])[_0xa1af('0x19')](function(_0x15b6cb){_0x253d4e(null,_0x15b6cb);})['catch'](function(_0x18a530){_0x253d4e(_0x18a530);});};AGIVertices['prototype'][_0xa1af('0x8f')]=function(_0x39288f){var _0x542250=_['includes'](verticesWithRetry,_0x39288f[_0xa1af('0x39')])?_0x39288f:_['clone'](_0x39288f);for(var _0x53842f in _0x542250){if(_0x542250[_0xa1af('0x90')](_0x53842f)){if(_0x542250[_0x53842f]&&_['isString'](_0x542250[_0x53842f])){if(_['includes'](recursiveMapAttributes,_0x53842f)){_0x542250[_0x53842f]=this['replaceObjectAllVariables'](_0x542250[_0x53842f]);}else{_0x542250[_0x53842f]=this[_0xa1af('0x91')](_0x542250[_0x53842f]);}}}}return _0x542250;};AGIVertices['prototype'][_0xa1af('0x92')]=function(_0x2dd276){for(var _0x39e06c in _0x2dd276){if(_0x2dd276['hasOwnProperty'](_0x39e06c)){if(_[_0xa1af('0x93')](_0x2dd276[_0x39e06c])){this[_0xa1af('0x92')](_0x2dd276[_0x39e06c]);}else if(_[_0xa1af('0x94')](_0x2dd276[_0x39e06c])){for(var _0x224af6=0x0;_0x224af6<_0x2dd276[_0x39e06c]['length'];_0x224af6++){this[_0xa1af('0x92')](_0x2dd276[_0x39e06c][_0x224af6]);}}else if(_[_0xa1af('0x95')](_0x2dd276[_0x39e06c])){_0x2dd276[_0x39e06c]=this[_0xa1af('0x91')](_0x2dd276[_0x39e06c]);}}}};AGIVertices[_0xa1af('0x11')][_0xa1af('0x96')]=function(_0x4ccd71,_0x2e19a3){for(var _0x3d4b37 in _0x4ccd71){if(_0x4ccd71[_0xa1af('0x90')](_0x3d4b37)){if(_[_0xa1af('0x93')](_0x4ccd71[_0x3d4b37])){if(!_[_0xa1af('0x97')](_0x4ccd71[_0x3d4b37])){this['saveRestApiResult'](_0x4ccd71[_0x3d4b37],util[_0xa1af('0x2a')](_0xa1af('0x98'),_0x2e19a3,_0x3d4b37));}}else if(_[_0xa1af('0x94')](_0x4ccd71[_0x3d4b37])){for(var _0x26dc5c=0x0;_0x26dc5c<_0x4ccd71[_0x3d4b37][_0xa1af('0x99')];_0x26dc5c++){this['saveRestApiResult'](_0x4ccd71[_0x3d4b37][_0x26dc5c],util[_0xa1af('0x2a')](_0xa1af('0x98'),_0x2e19a3,_0x3d4b37+'['+_0x26dc5c+']'));}}else{if(!_[_0xa1af('0x43')](_0x4ccd71[_0x3d4b37])){this[_0xa1af('0xe')][_0xa1af('0x9a')](util[_0xa1af('0x2a')](_0xa1af('0x98'),_0x2e19a3,_0x3d4b37),_0x4ccd71[_0x3d4b37]);}}}}};AGIVertices['prototype']['replaceObjectAllVariables']=function(_0x5cda83){try{var _0x108feb=JSON[_0xa1af('0x68')](_0x5cda83);this[_0xa1af('0x92')](_0x108feb);return JSON[_0xa1af('0x71')](_0x108feb);}catch(_0xa54ce4){return this[_0xa1af('0x91')](_0x5cda83);}};AGIVertices[_0xa1af('0x11')][_0xa1af('0x91')]=function(_0x16acf9){var _0x3e254d=_0x16acf9['split']('{');for(var _0x2bfb36=0x1;_0x2bfb36<_0x3e254d[_0xa1af('0x99')];_0x2bfb36+=0x1){var _0x593b67=_0x3e254d[_0x2bfb36]['split']('}');if(_0x593b67[_0xa1af('0x99')]>0x1){_0x16acf9=_0x16acf9['replaceAll']('{'+_0x593b67[0x0]+'}',this[_0xa1af('0xe')][_0xa1af('0x12')](_0x593b67[0x0])[_0xa1af('0x9b')]||_0x593b67[0x0]);}}if(_0x3e254d[_0xa1af('0x99')]===0x1){return _0x16acf9[_0xa1af('0x9c')]();}return this[_0xa1af('0x91')](_0x16acf9);};AGIVertices['prototype']['getAndSetVariable']=function(_0x42d8c0,_0x907d38){var _0x28f954=this[_0xa1af('0xe')]['getVariable'](_0x42d8c0);if(_0x28f954[_0xa1af('0x9d')]===-0x1){return _0x28f954;}logger[_0xa1af('0x2e')](util[_0xa1af('0x2a')](_0xa1af('0x9e'),_0x907d38,_0x28f954[_0xa1af('0x9b')]));return this[_0xa1af('0xe')][_0xa1af('0x9a')](_0x907d38,_0x28f954['extra']);};AGIVertices['prototype'][_0xa1af('0x80')]=function(_0x3e4a1e){return _0x3e4a1e&&_0x3e4a1e!=='0'&&_0x3e4a1e!=='-1'&&_0x3e4a1e!=='';};AGIVertices[_0xa1af('0x11')][_0xa1af('0x9f')]=function(_0x3a28fd){this['createSquareDetailsReport'][_0xa1af('0x6d')](this,_0x3a28fd,'-');_0x3a28fd[_0xa1af('0xa0')]=_0x3a28fd[_0xa1af('0x9f')];return{'code':0xc8,'result':'-'};};AGIVertices[_0xa1af('0x11')][_0xa1af('0xa1')]=function(_0x54da60){logger[_0xa1af('0x2e')](util[_0xa1af('0x2a')](_0xa1af('0xa2'),_0x54da60['label']));if(!this[_0xa1af('0x80')](_0x54da60['text'])){return this[_0xa1af('0xe')][_0xa1af('0xa3')](_0xa1af('0xa4'));}var _0x15508f='\x22'+_0x54da60[_0xa1af('0x5b')]+'\x22';if(this[_0xa1af('0x80')](_0x54da60[_0xa1af('0x77')])){_0x15508f+=','+_0x54da60[_0xa1af('0x77')];}var _0x397e6a=this[_0xa1af('0xe')][_0xa1af('0xa5')]('MRCPSynth',_0x15508f);if(_0x397e6a[_0xa1af('0x9d')]===-0x1){return _0x397e6a;}return this[_0xa1af('0xe')][_0xa1af('0xa3')](util[_0xa1af('0x2a')]('Executed\x20command\x20MRCPSynth\x20%s',_0x15508f));};AGIVertices[_0xa1af('0x11')][_0xa1af('0xa6')]=function(_0x317a62){logger[_0xa1af('0x2e')](util[_0xa1af('0x2a')](_0xa1af('0xa7'),_0x317a62[_0xa1af('0xa8')]));if(!this[_0xa1af('0x80')](_0x317a62['grammar'])){return this['channel'][_0xa1af('0xa3')]('no\x20grammar\x20configured');}var _0x24d06c=_0x317a62[_0xa1af('0xa9')];if(this['isConfigured'](_0x317a62[_0xa1af('0x77')])){_0x24d06c+=','+_0x317a62[_0xa1af('0x77')];}var _0x4d22e0=this[_0xa1af('0xe')][_0xa1af('0xa5')](_0xa1af('0xaa'),_0x24d06c);if(_0x4d22e0['result']===-0x1){return _0x4d22e0;}var _0x2f3972=this[_0xa1af('0xab')](_0xa1af('0xac'),'MRCP_RECOG_CONFIDENCE');if(_0x2f3972[_0xa1af('0x9d')]===-0x1){return _0x2f3972;}var _0x1cd317=this[_0xa1af('0xab')](_0xa1af('0xad'),_0xa1af('0xae'));if(_0x1cd317[_0xa1af('0x9d')]===-0x1){return _0x1cd317;}var _0x367dd8=this[_0xa1af('0xab')](_0xa1af('0xaf'),_0xa1af('0xb0'));if(_0x367dd8['result']===-0x1){return _0x367dd8;}return this[_0xa1af('0xe')][_0xa1af('0xa3')](util[_0xa1af('0x2a')](_0xa1af('0xb1'),_0x24d06c));};AGIVertices[_0xa1af('0x11')][_0xa1af('0xb2')]=function(_0x276081){logger[_0xa1af('0x2e')](util['format'](_0xa1af('0xb3'),_0x276081[_0xa1af('0xa8')]));return this[_0xa1af('0xe')][_0xa1af('0xb2')]([_0x276081[_0xa1af('0xb4')],_0x276081[_0xa1af('0xb5')]]);};AGIVertices['prototype'][_0xa1af('0xb6')]=function(_0x2c44af){logger[_0xa1af('0x2e')](util[_0xa1af('0x2a')]('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x2c44af[_0xa1af('0xa8')]));if(this[_0xa1af('0x80')](_0x2c44af[_0xa1af('0x64')])){logger[_0xa1af('0x2e')](util[_0xa1af('0x2a')]('Wait\x20%s\x20seconds\x20before\x20answer',_0x2c44af[_0xa1af('0x64')]));var _0x35f789=this[_0xa1af('0xe')]['wait'](_0x2c44af['timeout']);if(_0x35f789[_0xa1af('0x9d')]===-0x1){return _0x35f789;}}return this[_0xa1af('0xe')][_0xa1af('0xb6')]();};AGIVertices[_0xa1af('0x11')][_0xa1af('0x49')]=function(_0x53cfda){logger[_0xa1af('0x2e')](util['format'](_0xa1af('0xb7'),_0x53cfda['label']));if(!this[_0xa1af('0x80')](_0x53cfda[_0xa1af('0xb8')])){return this[_0xa1af('0xe')][_0xa1af('0x2d')](_0x53cfda,'no\x20list\x20selected');}_0x53cfda[_0xa1af('0x48')]=moment();if(this[_0xa1af('0x80')](_0x53cfda[_0xa1af('0xb9')])){_0x53cfda[_0xa1af('0x48')]=moment()['add'](_0x53cfda[_0xa1af('0xb9')],'minutes');}if(!this[_0xa1af('0x80')](_0x53cfda[_0xa1af('0x4b')])){_0x53cfda[_0xa1af('0x4b')]=0x2;}this[_0xa1af('0x42')]['sync'](this,_0x53cfda);return this[_0xa1af('0xe')]['noop'](util[_0xa1af('0x2a')](_0xa1af('0xba'),_0x53cfda[_0xa1af('0x47')],_0x53cfda[_0xa1af('0xb8')],_0x53cfda[_0xa1af('0x48')]));};AGIVertices[_0xa1af('0x11')][_0xa1af('0xbb')]=function(_0xc153c5){logger['info'](util[_0xa1af('0x2a')]('Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block',_0xc153c5[_0xa1af('0xa8')]));var _0x2aad72=this['channel'][_0xa1af('0xa5')](_0xc153c5[_0xa1af('0xbc')],_0xc153c5['options']);if(_0x2aad72[_0xa1af('0x9d')]===-0x1){return _0x2aad72;}return this['channel']['noop'](util[_0xa1af('0x2a')](_0xa1af('0xbd'),_0xc153c5['application'],_0xc153c5['options']));};AGIVertices[_0xa1af('0x11')][_0xa1af('0xbe')]=function(_0x51b373){logger['info'](util[_0xa1af('0x2a')](_0xa1af('0xbf'),_0x51b373[_0xa1af('0xa8')]));if(!this[_0xa1af('0x80')](_0x51b373[_0xa1af('0x5b')])){return this['channel'][_0xa1af('0xa3')](_0xa1af('0xa4'));}var _0x22eec4='\x22'+_0x51b373[_0xa1af('0x5b')]+'\x22';if(this[_0xa1af('0x80')](_0x51b373[_0xa1af('0x77')])){_0x22eec4+=','+_0x51b373[_0xa1af('0x77')];}var _0x188132=this[_0xa1af('0xe')][_0xa1af('0xa5')]('MRCPSynth',_0x22eec4);if(_0x188132[_0xa1af('0x9d')]===-0x1){return _0x188132;}return this[_0xa1af('0xe')][_0xa1af('0xa3')](util[_0xa1af('0x2a')](_0xa1af('0xc0'),_0x22eec4));};AGIVertices[_0xa1af('0x11')]['sestektts']=function(_0x5301af){logger[_0xa1af('0x2e')](util['format'](_0xa1af('0xc1'),_0x5301af[_0xa1af('0xa8')]));if(!this[_0xa1af('0x80')](_0x5301af['text'])){return this['channel'][_0xa1af('0xa3')](_0xa1af('0xa4'));}var _0x23c153='\x22'+_0x5301af[_0xa1af('0x5b')]+'\x22';if(this[_0xa1af('0x80')](_0x5301af['options'])){_0x23c153+=','+_0x5301af[_0xa1af('0x77')];}var _0x2ee61d=this[_0xa1af('0xe')][_0xa1af('0xa5')](_0xa1af('0xc2'),_0x23c153);if(_0x2ee61d[_0xa1af('0x9d')]===-0x1){return _0x2ee61d;}return this[_0xa1af('0xe')][_0xa1af('0xa3')](util[_0xa1af('0x2a')]('Executed\x20command\x20MRCPSynth\x20%s',_0x23c153));};AGIVertices['prototype'][_0xa1af('0xc3')]=function(_0x24b61d){logger[_0xa1af('0x2e')](util[_0xa1af('0x2a')]('Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block',_0x24b61d['label']));if(!this[_0xa1af('0x80')](_0x24b61d[_0xa1af('0xa9')])){return this[_0xa1af('0xe')][_0xa1af('0xa3')]('no\x20grammar\x20configured');}var _0x2c847a=_0x24b61d['grammar'];if(this[_0xa1af('0x80')](_0x24b61d['options'])){_0x2c847a+=','+_0x24b61d[_0xa1af('0x77')];}var _0x32a332=this[_0xa1af('0xe')][_0xa1af('0xa5')](_0xa1af('0xaa'),_0x2c847a);if(_0x32a332[_0xa1af('0x9d')]===-0x1){return _0x32a332;}var _0x5f5a9b=this[_0xa1af('0xab')](_0xa1af('0xac'),'LUMENVOX_ASR_CONFIDENCE');if(_0x5f5a9b[_0xa1af('0x9d')]===-0x1){return _0x5f5a9b;}var _0x4d9cc4=this[_0xa1af('0xab')](_0xa1af('0xad'),_0xa1af('0xc4'));if(_0x4d9cc4[_0xa1af('0x9d')]===-0x1){return _0x4d9cc4;}var _0x105c88=this[_0xa1af('0xab')](_0xa1af('0xaf'),_0xa1af('0xc5'));if(_0x105c88['result']===-0x1){return _0x105c88;}return this['channel'][_0xa1af('0xa3')](util[_0xa1af('0x2a')]('Executed\x20command\x20MRCPRecog\x20%s',_0x2c847a));};AGIVertices['prototype'][_0xa1af('0xc6')]=function(_0x818efb){logger['info'](util[_0xa1af('0x2a')](_0xa1af('0xc7'),_0x818efb[_0xa1af('0xa8')]));if(!this[_0xa1af('0x80')](_0x818efb['grammar'])){return this[_0xa1af('0xe')]['noop']('no\x20grammar\x20configured');}var _0x415848=_0x818efb[_0xa1af('0xa9')];if(this[_0xa1af('0x80')](_0x818efb[_0xa1af('0x77')])){_0x415848+=','+_0x818efb[_0xa1af('0x77')];}var _0x55bd83=this['channel'][_0xa1af('0xa5')]('MRCPRecog',_0x415848);if(_0x55bd83['result']===-0x1){return _0x55bd83;}var _0x21a6be=this[_0xa1af('0xab')](_0xa1af('0xac'),_0xa1af('0xc8'));if(_0x21a6be[_0xa1af('0x9d')]===-0x1){return _0x21a6be;}var _0x42dcd5=this['getAndSetVariable'](_0xa1af('0xad'),_0xa1af('0xc9'));if(_0x42dcd5['result']===-0x1){return _0x42dcd5;}var _0x3e6319=this[_0xa1af('0xab')]('RECOG_INSTANCE()',_0xa1af('0xca'));if(_0x3e6319[_0xa1af('0x9d')]===-0x1){return _0x3e6319;}return this[_0xa1af('0xe')][_0xa1af('0xa3')](util[_0xa1af('0x2a')](_0xa1af('0xb1'),_0x415848));};AGIVertices[_0xa1af('0x11')]['database']=function(_0xff7ca0){logger[_0xa1af('0x2e')](util[_0xa1af('0x2a')]('Enter\x20in\x20DATABASE\x20(%s)\x20block',_0xff7ca0[_0xa1af('0xa8')]));if(!this['isConfigured'](_0xff7ca0['odbc_id'])){return this[_0xa1af('0xe')][_0xa1af('0x2d')](_0xff7ca0,_0xa1af('0xcb'));}var _0x5615f0=this[_0xa1af('0xcc')]['sync'](this,_0xff7ca0[_0xa1af('0xcd')]);if(!_0x5615f0){return this[_0xa1af('0xe')][_0xa1af('0x2d')](_0xff7ca0,_0xa1af('0xce'));}if(!this[_0xa1af('0x80')](_0xff7ca0[_0xa1af('0x30')])){return this[_0xa1af('0xe')][_0xa1af('0x2d')](_0xff7ca0,_0xa1af('0xcf'));}var _0x454c0a=_0xff7ca0[_0xa1af('0x30')][_0xa1af('0x57')](/(\r\n|\n|\r)/gm,'\x20');this[_0xa1af('0xe')]['noop'](util[_0xa1af('0x2a')](_0xa1af('0xd0'),_0x454c0a));var _0x5c4576=this['getQueryOdbc'][_0xa1af('0x6d')](this,_0x5615f0,_0x454c0a);this['createSquareDetailsReport']['sync'](this,_0xff7ca0,_0x454c0a);if(!this[_0xa1af('0x80')](_0xff7ca0[_0xa1af('0xd1')])){return this['channel'][_0xa1af('0xa3')](_0xa1af('0xd2'));}var _0x2f67af=this['getVariable'][_0xa1af('0x6d')](this,_0xff7ca0[_0xa1af('0xd1')]);if(!_0x2f67af){return this['channel'][_0xa1af('0x2d')](_0xff7ca0,_0xa1af('0xd3'));}var _0x47c6b0=this;_0x5c4576[_0xa1af('0xd4')](function(_0x60e80d,_0x22cfdc){Object[_0xa1af('0xd5')](_0x60e80d)[_0xa1af('0xd4')](function(_0x1c48b0){_0x47c6b0[_0xa1af('0xe')]['setVariable'](util['format'](_0xa1af('0xd6'),_0x2f67af,_0x22cfdc,_0x1c48b0),_0x60e80d[_0x1c48b0]);});});this['channel'][_0xa1af('0x9a')](util['format'](_0xa1af('0xd7'),_0x2f67af),_0x5c4576[_0xa1af('0x99')]);return this[_0xa1af('0xe')][_0xa1af('0xa3')](util[_0xa1af('0x2a')](_0xa1af('0xd8'),_0x2f67af));};AGIVertices[_0xa1af('0x11')][_0xa1af('0xd9')]=function(_0x36a111){logger[_0xa1af('0xda')](util[_0xa1af('0x2a')]('Enter\x20in\x20DIAL\x20(%s)\x20block',_0x36a111[_0xa1af('0xa8')]));if(!this[_0xa1af('0x80')](_0x36a111[_0xa1af('0xdb')])){return this['channel'][_0xa1af('0x2d')](_0x36a111,_0xa1af('0xdc'));}var _0x22e842=this[_0xa1af('0x1b')]['sync'](this,_0x36a111[_0xa1af('0xdb')]);if(!_0x22e842){return this[_0xa1af('0xe')][_0xa1af('0x2d')](_0x36a111,_0xa1af('0xdd'));}var _0x128584=this[_0xa1af('0xe')][_0xa1af('0xa5')](_0xa1af('0xde'),[util[_0xa1af('0x2a')](_0xa1af('0xdf'),_0x22e842),_0x36a111[_0xa1af('0x64')],_0x36a111[_0xa1af('0xe0')],_0x36a111[_0xa1af('0x70')]]);if(_0x128584[_0xa1af('0x9d')]===-0x1){return _0x128584;}return this[_0xa1af('0xe')][_0xa1af('0xa3')](util['format'](_0xa1af('0xe1'),_0xa1af('0xde')));};AGIVertices['prototype']['dialogflow']=function(_0x573309){logger[_0xa1af('0x2e')](util[_0xa1af('0x2a')]('Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block',_0x573309['label']));if(!this[_0xa1af('0x80')](_0x573309['key'])){return this[_0xa1af('0xe')][_0xa1af('0xa3')](_0xa1af('0xe2'));}if(!this[_0xa1af('0x80')](_0x573309[_0xa1af('0x5b')])){return this[_0xa1af('0xe')][_0xa1af('0xa3')](_0xa1af('0xa4'));}this['channel'][_0xa1af('0xe3')]=!![];this[_0xa1af('0x37')](_0x573309);this[_0xa1af('0xe4')](_0x573309['text'],'in');this['channel'][_0xa1af('0xa3')](util[_0xa1af('0x2a')]('Trying\x20Dialogflow:\x20%s',_0x573309[_0xa1af('0x5b')]));var _0x5e57a0=this[_0xa1af('0x78')]['sync'](this,_0x573309);if(_0x5e57a0){for(var _0x4ccd0a in _0x5e57a0){if(_0x5e57a0[_0xa1af('0x90')](_0x4ccd0a)){this[_0xa1af('0xe')][_0xa1af('0x9a')](util[_0xa1af('0x2a')](_0xa1af('0xe5'),_0x4ccd0a['toUpperCase']()),_0x5e57a0[_0x4ccd0a]);}}this[_0xa1af('0xe4')](_0x5e57a0[_0xa1af('0xe6')],_0xa1af('0xe7'));return this[_0xa1af('0xe')][_0xa1af('0xa3')](util[_0xa1af('0x2a')]('Dialogflow\x20Result\x20%s',_0x5e57a0[_0xa1af('0xe6')]));}return this[_0xa1af('0xe')][_0xa1af('0x2d')](_0x573309,_0xa1af('0xe8'));};AGIVertices[_0xa1af('0x11')][_0xa1af('0xe9')]=function(_0xc74324){logger[_0xa1af('0x2e')](util[_0xa1af('0x2a')]('Enter\x20in\x20SESTEKNDA\x20(%s)\x20block',_0xc74324[_0xa1af('0xa8')]));if(!this[_0xa1af('0x80')](_0xc74324[_0xa1af('0xea')])){return this[_0xa1af('0xe')][_0xa1af('0xa3')](_0xa1af('0xeb'));}if(!this[_0xa1af('0x80')](_0xc74324[_0xa1af('0xec')])){return this[_0xa1af('0xe')][_0xa1af('0xa3')](_0xa1af('0xed'));}if(!this[_0xa1af('0x80')](_0xc74324['password'])){return this[_0xa1af('0xe')][_0xa1af('0xa3')]('no\x20password\x20configured');}if(!this['isConfigured'](_0xc74324[_0xa1af('0xee')])){return this[_0xa1af('0xe')][_0xa1af('0xa3')](_0xa1af('0xa4'));}this[_0xa1af('0xe')]['bot']=!![];this['createSquareDetailsReport'](_0xc74324);this['createSquareMessage'](_0xc74324[_0xa1af('0x5b')],'in');this[_0xa1af('0xe')]['noop'](util['format'](_0xa1af('0xef'),_0xc74324['text']));var _0x1dc561=this['sestekNDA'][_0xa1af('0x6d')](this,_0xc74324);if(_0x1dc561){for(var _0xc357e2 in _0x1dc561){if(_0x1dc561[_0xa1af('0x90')](_0xc357e2)){this[_0xa1af('0xe')][_0xa1af('0x9a')](util[_0xa1af('0x2a')](_0xa1af('0xf0'),_0xc357e2[_0xa1af('0x67')]()),_0x1dc561[_0xc357e2]);}}this['createSquareMessage'](_0x1dc561['speech'],_0xa1af('0xe7'));if(_0x1dc561[_0xa1af('0xf1')]){this['channel'][_0xa1af('0xa3')](util['format']('Sestek\x20NDA\x20%s\x20file\x20created',_0x1dc561[_0xa1af('0xf1')]));var _0x5cf24d=this['channel']['streamFile'](_0x1dc561[_0xa1af('0xf1')]);try{fs[_0xa1af('0xf2')](_0x1dc561[_0xa1af('0xf1')]+'.wav');}catch(_0x895f17){logger[_0xa1af('0x2d')](_0x895f17);}return _0x5cf24d;}else{return this[_0xa1af('0xe')][_0xa1af('0xa3')](util[_0xa1af('0x2a')](_0xa1af('0xf3'),_0x1dc561[_0xa1af('0xe6')]));}}return this[_0xa1af('0xe')][_0xa1af('0x2d')](_0xc74324,_0xa1af('0xf4'));};AGIVertices[_0xa1af('0x11')][_0xa1af('0xf5')]=function(_0x50356d){logger[_0xa1af('0x2e')](util[_0xa1af('0x2a')](_0xa1af('0xf6'),_0x50356d['label']));return this[_0xa1af('0xe')]['noop'](_0xa1af('0xf5'));};AGIVertices[_0xa1af('0x11')][_0xa1af('0xf7')]=function(_0x952bec){logger['info'](util[_0xa1af('0x2a')]('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0x952bec[_0xa1af('0xa8')]));var _0x5d5678='';if(_0x952bec[_0xa1af('0xf8')]){if(!this[_0xa1af('0x80')](_0x952bec[_0xa1af('0xf8')])){return this[_0xa1af('0xe')]['error'](_0x952bec,_0xa1af('0xf9'));}else{var _0x3b73bd=parseInt(_0x952bec[_0xa1af('0xf8')],0xa);if(isNaN(_0x3b73bd)){_0x5d5678=_0x952bec[_0xa1af('0xf8')];}else{_0x5d5678=this[_0xa1af('0xfa')][_0xa1af('0x6d')](this,_0x952bec[_0xa1af('0xf8')]);if(!_0x5d5678){return this[_0xa1af('0xe')][_0xa1af('0x2d')](_0x952bec,_0xa1af('0xfb'));}}}}else if(_0x952bec['trunk_name']){_0x5d5678=_0x952bec[_0xa1af('0xfc')];}else{return this[_0xa1af('0xe')][_0xa1af('0x2d')](_0x952bec,_0xa1af('0xf9'));}var _0x468d27=this[_0xa1af('0xe')]['exec'](_0xa1af('0xde'),[util[_0xa1af('0x2a')]('SIP/%s/%s',_0x5d5678,_0x952bec[_0xa1af('0x47')]),_0x952bec[_0xa1af('0x64')],_0x952bec[_0xa1af('0xe0')],_0x952bec[_0xa1af('0x70')]]);if(_0x468d27[_0xa1af('0x9d')]===-0x1){return _0x468d27;}return this[_0xa1af('0xe')][_0xa1af('0xa3')](util[_0xa1af('0x2a')](_0xa1af('0xe1'),_0xa1af('0xde')));};AGIVertices[_0xa1af('0x11')]['finally']=function(_0x38e9c2){logger['info'](util[_0xa1af('0x2a')](_0xa1af('0xfd'),_0x38e9c2[_0xa1af('0xa8')]));return this[_0xa1af('0xe')][_0xa1af('0xa3')](_0xa1af('0xfe'));};AGIVertices['prototype']['getdigits']=function(_0x494acc){logger[_0xa1af('0x2e')](util[_0xa1af('0x2a')](_0xa1af('0xff'),_0x494acc['label']));if(_0x494acc['retry']===0x0){return this[_0xa1af('0x9f')](_0x494acc);}_0x494acc['retry']-=0x1;if(!this['isConfigured'](_0x494acc['file_id'])){return this['channel'][_0xa1af('0x2d')](_0x494acc,_0xa1af('0x100'));}var _0x565cff=this['getSound'][_0xa1af('0x6d')](this,_0x494acc[_0xa1af('0x101')]);if(!_0x565cff){return this[_0xa1af('0xe')]['error'](_0x494acc,_0xa1af('0x102'));}if(!this[_0xa1af('0x80')](_0x494acc[_0xa1af('0xd1')])){return this['channel'][_0xa1af('0x2d')](_0xa1af('0xd2'));}var _0x3a008c=this[_0xa1af('0xe')][_0xa1af('0x103')](_0x565cff,_0x494acc[_0xa1af('0x104')],_0x494acc[_0xa1af('0x105')]);var _0x55b095=_0x3a008c[_0xa1af('0x9d')]?_0x3a008c[_0xa1af('0x9d')][_0xa1af('0x9c')]():'';logger[_0xa1af('0x2e')](_0xa1af('0x106'),JSON[_0xa1af('0x71')](_0x3a008c));if(_0x3a008c[_0xa1af('0x9d')]===-0x1){this[_0xa1af('0x37')][_0xa1af('0x6d')](this,_0x494acc,_0x55b095);return _0x3a008c;}else if(_0x3a008c[_0xa1af('0x9b')]==='timeout'){_0x3a008c[_0xa1af('0x9d')]=_0x55b095[_0xa1af('0x99')]>=parseInt(_0x494acc[_0xa1af('0x107')])?'x':'i';}else{_0x3a008c[_0xa1af('0x9d')]=_0x55b095[_0xa1af('0x99')]>=parseInt(_0x494acc[_0xa1af('0x107')])&&_0x55b095[_0xa1af('0x99')]<=parseInt(_0x494acc[_0xa1af('0x105')])?'x':'i';}var _0xaac6e8=this[_0xa1af('0x12')]['sync'](this,_0x494acc[_0xa1af('0xd1')]);if(!_0xaac6e8){return this[_0xa1af('0xe')][_0xa1af('0x2d')](_0x494acc,_0xa1af('0xd3'));}this[_0xa1af('0xe')][_0xa1af('0x9a')](_0xaac6e8,_0x55b095);if(this['isConfigured'](_0x494acc[_0xa1af('0x108')])){var _0x1ebff0=parseInt(_0x494acc[_0xa1af('0x108')],0xa);var _0x42bed4=rs['generate']({'charset':'*','length':_0x1ebff0});var _0x56b7b1=_0x55b095['length'];if(_0x56b7b1>0x0){if(_0x56b7b1>_0x1ebff0){this[_0xa1af('0x37')][_0xa1af('0x6d')](this,_0x494acc,_0x494acc['hiddendigitspos']===_0xa1af('0x109')?_0x42bed4+_0x55b095['substr'](_0x1ebff0):_0x55b095['substr'](0x0,_0x56b7b1-_0x1ebff0)+_0x42bed4);}else{this[_0xa1af('0x37')][_0xa1af('0x6d')](this,_0x494acc,rs[_0xa1af('0x10a')]({'charset':'*','length':_0x56b7b1}));}}else{this['createSquareDetailsReport']['sync'](this,_0x494acc,'');}}else{this['createSquareDetailsReport'][_0xa1af('0x6d')](this,_0x494acc,_0x55b095);}return _0x3a008c;};AGIVertices[_0xa1af('0x11')][_0xa1af('0xd')]=function(_0x1cd51d){logger[_0xa1af('0x2e')](util[_0xa1af('0x2a')](_0xa1af('0x10b'),_0x1cd51d['label']));return this['getdigits'](_0x1cd51d);};AGIVertices[_0xa1af('0x11')]['goal']=function(_0xd70504){logger[_0xa1af('0x2e')](util['format'](_0xa1af('0x10c'),_0xd70504[_0xa1af('0xa8')]));this[_0xa1af('0x37')][_0xa1af('0x6d')](this,_0xd70504,_0xd70504[_0xa1af('0x10d')]);return this[_0xa1af('0xe')][_0xa1af('0xa3')](util[_0xa1af('0x2a')]('GOAL\x20%s',_0xd70504['goalname']));};AGIVertices[_0xa1af('0x11')][_0xa1af('0x10e')]=function(_0x7925ed){logger[_0xa1af('0x2e')](util[_0xa1af('0x2a')](_0xa1af('0x10f'),_0x7925ed[_0xa1af('0xa8')]));if(!this['isConfigured'](_0x7925ed['aws_access_key_id'])||!this[_0xa1af('0x80')](_0x7925ed['aws_secret_access_key'])){return this[_0xa1af('0xe')][_0xa1af('0xa3')](_0xa1af('0x110'));}if(!this[_0xa1af('0x80')](_0x7925ed[_0xa1af('0x5b')])){return this['channel']['noop'](_0xa1af('0xa4'));}this['channel'][_0xa1af('0xa3')](util[_0xa1af('0x2a')](_0xa1af('0x111'),_0x7925ed[_0xa1af('0x5b')]));var _0x2f7d1e=this[_0xa1af('0x82')][_0xa1af('0x6d')](this,_0x7925ed);if(_0x2f7d1e){this[_0xa1af('0xe')]['noop'](util[_0xa1af('0x2a')](_0xa1af('0x112'),_0x2f7d1e));var _0x5f551a=this[_0xa1af('0xe')]['streamFile'](_0x2f7d1e);try{fs['unlink'](_0x2f7d1e+_0xa1af('0x113'));}catch(_0x531519){logger[_0xa1af('0x2d')](_0x531519);}return _0x5f551a;}return this[_0xa1af('0xe')][_0xa1af('0x2d')](_0x7925ed,_0xa1af('0x114'));};AGIVertices[_0xa1af('0x11')]['awslex']=function(_0xc55e11){logger[_0xa1af('0x2e')](util[_0xa1af('0x2a')](_0xa1af('0x115'),_0xc55e11[_0xa1af('0xa8')]));if(!this[_0xa1af('0x80')](_0xc55e11[_0xa1af('0x89')])||!this['isConfigured'](_0xc55e11[_0xa1af('0x83')])){return this[_0xa1af('0xe')]['noop'](_0xa1af('0x110'));}if(!this['isConfigured'](_0xc55e11['aws_bot_name'])){return this['channel'][_0xa1af('0xa3')]('no\x20bot\x20name\x20configured');}if(!this['isConfigured'](_0xc55e11['text'])){return this['channel'][_0xa1af('0xa3')]('no\x20text\x20configured');}this['channel']['bot']=!![];this['createSquareDetailsReport'](_0xc55e11);this[_0xa1af('0xe4')](_0xc55e11[_0xa1af('0x5b')],'in');this[_0xa1af('0xe')][_0xa1af('0xa3')](util[_0xa1af('0x2a')](_0xa1af('0x116'),_0xc55e11[_0xa1af('0x5b')]));var _0x55ff73=this[_0xa1af('0x88')][_0xa1af('0x6d')](this,_0xc55e11);if(_0x55ff73){for(var _0x5d0585 in _0x55ff73){if(_0x55ff73[_0xa1af('0x90')](_0x5d0585)&&_[_0xa1af('0x95')](_0x55ff73[_0x5d0585])){this['channel'][_0xa1af('0x9a')](util[_0xa1af('0x2a')](_0xa1af('0x117'),_0x5d0585['toUpperCase']()),_0x55ff73[_0x5d0585]);}}if(_[_0xa1af('0x43')](_0x55ff73[_0xa1af('0x75')])){return this[_0xa1af('0xe')]['noop'](_0xa1af('0x118'));}else{this['createSquareMessage'](_0x55ff73[_0xa1af('0x75')],_0xa1af('0xe7'));return this[_0xa1af('0xe')][_0xa1af('0xa3')](util[_0xa1af('0x2a')](_0xa1af('0x119'),_0x55ff73[_0xa1af('0x75')]));}}return this['channel']['error'](_0xc55e11,'Amazon\x20Lex\x20is\x20unreachable');};AGIVertices[_0xa1af('0x11')][_0xa1af('0x11a')]=function(_0xc48b1f){logger[_0xa1af('0x2e')](util['format'](_0xa1af('0x11b'),_0xc48b1f[_0xa1af('0xa8')],_0xc48b1f[_0xa1af('0x64')]));if(!this[_0xa1af('0x80')](_0xc48b1f[_0xa1af('0x7c')])){return this[_0xa1af('0xe')][_0xa1af('0xa3')](_0xa1af('0xe2'));}var _0x42c312=_0xa1af('0x11c');var _0x36d61e=util[_0xa1af('0x2a')](_0xa1af('0x11d'),FILES_PATH,rs[_0xa1af('0x10a')](0x4));var _0x1a9b09=util['format'](_0xa1af('0x98'),_0x36d61e,_0x42c312);var _0x5d2aa7=!![];if(_0xc48b1f[_0xa1af('0x11e')]==='NOBEEP'){_0x5d2aa7=![];}var _0x434d26=this[_0xa1af('0xe')][_0xa1af('0x11f')](_0x36d61e,_0x42c312,_0xc48b1f[_0xa1af('0x120')],_0xc48b1f['timeout'],undefined,_0x5d2aa7);if(_0x434d26['result']!==-0x1){this[_0xa1af('0xe')][_0xa1af('0xa3')](util[_0xa1af('0x2a')](_0xa1af('0x121'),_0x1a9b09));var _0x13d6ba=this[_0xa1af('0x8b')][_0xa1af('0x6d')](this,_0xc48b1f,_0x1a9b09);if(_0x13d6ba){for(var _0xedd95e in _0x13d6ba){if(_0x13d6ba[_0xa1af('0x90')](_0xedd95e)){this[_0xa1af('0xe')][_0xa1af('0x9a')](util[_0xa1af('0x2a')](_0xa1af('0x122'),_0xedd95e[_0xa1af('0x67')]()),_0x13d6ba[_0xedd95e]);}}return this[_0xa1af('0xe')][_0xa1af('0xa3')](util[_0xa1af('0x2a')](_0xa1af('0x123'),JSON['stringify'](_0x13d6ba)));}}return _0x434d26;};AGIVertices[_0xa1af('0x11')][_0xa1af('0x124')]=function(_0x2e2be3){logger[_0xa1af('0x2e')](util[_0xa1af('0x2a')]('Enter\x20in\x20TILDEASR\x20(%s)\x20block',_0x2e2be3['label']));if(!this[_0xa1af('0x80')](_0x2e2be3[_0xa1af('0x8d')])){return this[_0xa1af('0xe')][_0xa1af('0xa3')](_0xa1af('0x125'));}if(!this[_0xa1af('0x80')](_0x2e2be3[_0xa1af('0x8e')])){return this[_0xa1af('0xe')][_0xa1af('0xa3')](_0xa1af('0x126'));}var _0x3549cc='wav';var _0x3b34ed=util[_0xa1af('0x2a')](_0xa1af('0x11d'),FILES_PATH,rs['generate'](0x4));var _0x39a08b=util['format'](_0xa1af('0x98'),_0x3b34ed,_0x3549cc);var _0x43d960=!![];if(_0x2e2be3[_0xa1af('0x11e')]===_0xa1af('0x127')){_0x43d960=![];}var _0x324350=this['channel'][_0xa1af('0x11f')](_0x3b34ed,_0x3549cc,_0x2e2be3[_0xa1af('0x120')],_0x2e2be3[_0xa1af('0x64')],undefined,_0x43d960);if(_0x324350[_0xa1af('0x9d')]!==-0x1){this['channel'][_0xa1af('0xa3')](util[_0xa1af('0x2a')](_0xa1af('0x128'),_0x39a08b));var _0x3d07f2=this[_0xa1af('0x8c')]['sync'](this,_0x2e2be3,_0x39a08b);if(_0x3d07f2){for(var _0x57af6d in _0x3d07f2){if(_0x3d07f2[_0xa1af('0x90')](_0x57af6d)){this[_0xa1af('0xe')][_0xa1af('0x9a')](util['format'](_0xa1af('0x129'),_0x57af6d[_0xa1af('0x67')]()),_0x3d07f2[_0x57af6d]);}}return this[_0xa1af('0xe')]['noop'](util['format']('TildeASR\x20Result\x20%s',JSON[_0xa1af('0x71')](_0x3d07f2)));}}return _0x324350;};AGIVertices[_0xa1af('0x11')][_0xa1af('0x12a')]=function(_0x437404){logger[_0xa1af('0x2e')](util[_0xa1af('0x2a')](_0xa1af('0x12b'),_0x437404['label']));return this['channel']['continueAt'](_0x437404[_0xa1af('0x3e')],_0x437404[_0xa1af('0x12c')],_0x437404['priority']);};AGIVertices['prototype'][_0xa1af('0x12d')]=function(_0x3332b9){logger[_0xa1af('0x2e')](util['format'](_0xa1af('0x12e'),_0x3332b9[_0xa1af('0xa8')]));if(!this['isConfigured'](_0x3332b9[_0xa1af('0x12f')])){return this[_0xa1af('0xe')][_0xa1af('0x2d')](_0x3332b9,'no\x20condition\x20configured');}try{var _0x578239=eval(_0x3332b9['condition'])?_0xa1af('0x130'):_0xa1af('0x131');this['channel'][_0xa1af('0xa3')](util[_0xa1af('0x2a')]('EVAL\x20CONDITION\x20%s\x20%s',_0x3332b9[_0xa1af('0x12f')],_0x578239));return{'code':0xc8,'result':_0x578239};}catch(_0xfa61b){return{'code':0xc8,'result':'false'};}};AGIVertices['prototype'][_0xa1af('0x132')]=function(_0x5163d9){logger[_0xa1af('0x2e')](util['format'](_0xa1af('0x133'),_0x5163d9[_0xa1af('0xa8')]));if(!this[_0xa1af('0x80')](_0x5163d9['interval_id'])){return this['channel'][_0xa1af('0x2d')](_0x5163d9,'no\x20interval\x20configured');}var _0x281a72=this[_0xa1af('0x23')][_0xa1af('0x6d')](this,_0x5163d9[_0xa1af('0x134')]);if(!_0x281a72){return this['channel']['error'](_0x5163d9,_0xa1af('0x135'));}for(var _0x1baa37=0x0;_0x1baa37<_0x281a72['length'];_0x1baa37+=0x1){var _0x45f44a=this[_0xa1af('0xe')][_0xa1af('0x12')](util[_0xa1af('0x2a')]('IFTIME(%s?true:false)',_0x281a72[_0x1baa37]));if(_0x45f44a[_0xa1af('0x9d')]===-0x1){return _0x45f44a;}logger[_0xa1af('0x2e')](util[_0xa1af('0x2a')](_0xa1af('0x136'),_0x281a72[_0x1baa37],_0x45f44a[_0xa1af('0x9b')]));if(_0x45f44a[_0xa1af('0x9b')]===_0xa1af('0x130')){logger['info'](util[_0xa1af('0x2a')](_0xa1af('0x136'),_0x281a72[_0x1baa37],'true'));this[_0xa1af('0xe')]['noop'](util['format'](_0xa1af('0x136'),_0x281a72[_0x1baa37],_0xa1af('0x130')));return{'code':0xc8,'result':'true'};}else{logger['info'](util[_0xa1af('0x2a')](_0xa1af('0x136'),_0x281a72[_0x1baa37],'false'));this[_0xa1af('0xe')]['noop'](util[_0xa1af('0x2a')](_0xa1af('0x136'),_0x281a72[_0x1baa37],_0xa1af('0x131')));}}return{'code':0xc8,'result':_0xa1af('0x131')};};AGIVertices[_0xa1af('0x11')]['hangup']=function(_0x186041){logger[_0xa1af('0x2e')](util[_0xa1af('0x2a')](_0xa1af('0x137'),_0x186041['label']));return this[_0xa1af('0xe')][_0xa1af('0x138')]();};AGIVertices[_0xa1af('0x11')]['ispeechasr']=function(_0x46a43e){logger[_0xa1af('0x2e')](util[_0xa1af('0x2a')](_0xa1af('0x139'),_0x46a43e[_0xa1af('0xa8')]));if(!this[_0xa1af('0x80')](_0x46a43e['key'])){return this['channel'][_0xa1af('0xa3')]('no\x20key\x20configured');}var _0x101fd5=_0xa1af('0x11c');var _0x10a940=util[_0xa1af('0x2a')](_0xa1af('0x11d'),FILES_PATH,rs['generate'](0x4));var _0x299bf8=util[_0xa1af('0x2a')]('%s.%s',_0x10a940,_0x101fd5);var _0x13b99c=!![];if(_0x46a43e[_0xa1af('0x11e')]===_0xa1af('0x127')){_0x13b99c=![];}var _0x336eb6=this[_0xa1af('0xe')][_0xa1af('0x11f')](_0x10a940,_0x101fd5,_0x46a43e[_0xa1af('0x120')],_0x46a43e[_0xa1af('0x64')],undefined,_0x13b99c);if(_0x336eb6[_0xa1af('0x9d')]!==-0x1){this[_0xa1af('0xe')][_0xa1af('0xa3')](util[_0xa1af('0x2a')](_0xa1af('0x13a'),_0x299bf8));var _0x54ee0a=this[_0xa1af('0x7e')][_0xa1af('0x6d')](this,_0x46a43e,_0x299bf8);if(_0x54ee0a){for(var _0x530aaf in _0x54ee0a){if(_0x54ee0a[_0xa1af('0x90')](_0x530aaf)){this[_0xa1af('0xe')][_0xa1af('0x9a')](util[_0xa1af('0x2a')](_0xa1af('0x13b'),_0x530aaf['toUpperCase']()),_0x54ee0a[_0x530aaf]);}}return this['channel'][_0xa1af('0xa3')](util['format'](_0xa1af('0x13c'),JSON[_0xa1af('0x71')](_0x54ee0a)));}}return _0x336eb6;};AGIVertices[_0xa1af('0x11')][_0xa1af('0x13d')]=function(_0x35e10f){logger[_0xa1af('0x2e')](util['format'](_0xa1af('0x13e'),_0x35e10f[_0xa1af('0xa8')]));if(!this['isConfigured'](_0x35e10f[_0xa1af('0x7c')])){return this[_0xa1af('0xe')]['noop'](_0xa1af('0xe2'));}if(!this[_0xa1af('0x80')](_0x35e10f[_0xa1af('0x5b')])){return this[_0xa1af('0xe')]['noop'](_0xa1af('0xa4'));}this[_0xa1af('0xe')]['noop'](util[_0xa1af('0x2a')](_0xa1af('0x13f'),_0x35e10f['text']));var _0x52fda7=this['ispeechTTS'][_0xa1af('0x6d')](this,_0x35e10f);if(_0x52fda7){this[_0xa1af('0xe')]['noop'](util[_0xa1af('0x2a')](_0xa1af('0x13a'),_0x52fda7));var _0x24bad7=this[_0xa1af('0xe')][_0xa1af('0x140')](_0x52fda7,_0x35e10f[_0xa1af('0x120')]);try{fs[_0xa1af('0xf2')](_0x52fda7+'.wav');}catch(_0x1ebf07){logger[_0xa1af('0x2d')](_0x1ebf07);}return _0x24bad7;}return this['channel'][_0xa1af('0x2d')](_0x35e10f,_0xa1af('0x141'));};AGIVertices['prototype']['login']=function(_0x17ffdd){logger[_0xa1af('0x2e')](util[_0xa1af('0x2a')](_0xa1af('0x142'),_0x17ffdd[_0xa1af('0xa8')]));if(!this[_0xa1af('0x80')](_0x17ffdd[_0xa1af('0x143')])){return this[_0xa1af('0xe')][_0xa1af('0x2d')](_0x17ffdd,_0xa1af('0x144'));}logger['info'](util[_0xa1af('0x2a')](_0xa1af('0x145'),this['channel'][_0xa1af('0x3b')],_0x17ffdd[_0xa1af('0x143')]));var _0xeff46d=this[_0xa1af('0x54')][_0xa1af('0x6d')](this,_0x17ffdd[_0xa1af('0x143')]);if(_0xeff46d){logger[_0xa1af('0x2e')](util[_0xa1af('0x2a')](_0xa1af('0x146'),this['channel']['callerid'],_0x17ffdd[_0xa1af('0x143')]));this[_0xa1af('0xe')][_0xa1af('0xa3')](util['format'](_0xa1af('0x146'),this[_0xa1af('0xe')][_0xa1af('0x3b')],_0x17ffdd[_0xa1af('0x143')]));return{'code':0xc8,'result':_0xa1af('0x147')};}else{logger[_0xa1af('0x2e')](util[_0xa1af('0x2a')](_0xa1af('0x148'),this[_0xa1af('0xe')]['callerid'],_0x17ffdd[_0xa1af('0x143')]));this[_0xa1af('0xe')][_0xa1af('0xa3')](util[_0xa1af('0x2a')](_0xa1af('0x148'),this[_0xa1af('0xe')][_0xa1af('0x3b')],_0x17ffdd[_0xa1af('0x143')]));return{'code':0xc8,'result':_0xa1af('0x149')};}};AGIVertices[_0xa1af('0x11')][_0xa1af('0x14a')]=function(_0x445bff){logger[_0xa1af('0x2e')](util[_0xa1af('0x2a')](_0xa1af('0x14b'),_0x445bff['label']));if(!this[_0xa1af('0x80')](_0x445bff[_0xa1af('0x143')])){return this[_0xa1af('0xe')][_0xa1af('0x2d')](_0x445bff,_0xa1af('0x144'));}logger[_0xa1af('0x2e')](util['format'](_0xa1af('0x145'),this[_0xa1af('0xe')][_0xa1af('0x3b')],_0x445bff[_0xa1af('0x143')]));var _0x5d2e7b=this[_0xa1af('0x51')][_0xa1af('0x6d')](this,_0x445bff[_0xa1af('0x143')]);if(_0x5d2e7b){logger[_0xa1af('0x2e')](util[_0xa1af('0x2a')](_0xa1af('0x146'),this[_0xa1af('0xe')]['callerid'],_0x445bff['findBy']));this[_0xa1af('0xe')][_0xa1af('0xa3')](util[_0xa1af('0x2a')](_0xa1af('0x146'),this[_0xa1af('0xe')][_0xa1af('0x3b')],_0x445bff[_0xa1af('0x143')]));return{'code':0xc8,'result':_0xa1af('0x147')};}else{logger[_0xa1af('0x2e')](util[_0xa1af('0x2a')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0xa1af('0x3b')],_0x445bff['findBy']));this[_0xa1af('0xe')]['noop'](util[_0xa1af('0x2a')](_0xa1af('0x148'),this[_0xa1af('0xe')][_0xa1af('0x3b')],_0x445bff[_0xa1af('0x143')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0xa1af('0x11')]['math']=function(_0x26ff53){logger[_0xa1af('0x2e')](util[_0xa1af('0x2a')](_0xa1af('0x14c'),_0x26ff53[_0xa1af('0xa8')]));if(!this[_0xa1af('0x80')](_0x26ff53['operation'])){return this['channel'][_0xa1af('0x2d')](_0x26ff53,_0xa1af('0x14d'));}this[_0xa1af('0xe')][_0xa1af('0xa3')](util[_0xa1af('0x2a')](_0xa1af('0x14e'),_0x26ff53[_0xa1af('0x14f')]));var _0x5b9898=eval(_0x26ff53[_0xa1af('0x14f')]);if(!this['isConfigured'](_0x26ff53[_0xa1af('0xd1')])){return this[_0xa1af('0xe')][_0xa1af('0xa3')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x3b0875=this[_0xa1af('0x12')][_0xa1af('0x6d')](this,_0x26ff53['variable_id']);if(!_0x3b0875){return this[_0xa1af('0xe')][_0xa1af('0x2d')](_0x26ff53,'no\x20variable\x20found');}if(_[_0xa1af('0x94')](_0x5b9898)){var _0xae18f2=this;_0x5b9898['forEach'](function(_0x1ed2e3,_0xe63c80){_0xae18f2[_0xa1af('0xe')][_0xa1af('0x9a')](util[_0xa1af('0x2a')]('%s[%s]',_0x3b0875,_0xe63c80),_0x1ed2e3);});return this[_0xa1af('0xe')][_0xa1af('0xa3')](util[_0xa1af('0x2a')](_0xa1af('0x150'),_0x3b0875));}else{return this[_0xa1af('0xe')][_0xa1af('0x9a')](_0x3b0875,_0x5b9898);}};AGIVertices[_0xa1af('0x11')][_0xa1af('0xb')]=function(_0x5b805e){logger['info'](util[_0xa1af('0x2a')](_0xa1af('0x151'),_0x5b805e['label']));if(_0x5b805e[_0xa1af('0xa0')]===0x0){return this[_0xa1af('0x9f')](_0x5b805e);}_0x5b805e[_0xa1af('0xa0')]-=0x1;if(!this['isConfigured'](_0x5b805e[_0xa1af('0x101')])){return this['channel'][_0xa1af('0x2d')](_0x5b805e,_0xa1af('0x100'));}var _0x479f21=this[_0xa1af('0x1e')][_0xa1af('0x6d')](this,_0x5b805e[_0xa1af('0x101')]);if(!_0x479f21){return this['channel'][_0xa1af('0x2d')](_0x5b805e,_0xa1af('0x102'));}var _0x29b13e=this['channel'][_0xa1af('0x103')](_0x479f21,_0x5b805e['response'],_0x5b805e['digit']);var _0x35ea22=_0x29b13e[_0xa1af('0x9d')];if(_0x29b13e[_0xa1af('0x9d')]===-0x1){this[_0xa1af('0x37')][_0xa1af('0x6d')](this,_0x5b805e,'-1');return _0x29b13e;}else if(_0x29b13e[_0xa1af('0x9b')]===_0xa1af('0x64')){_0x29b13e[_0xa1af('0x9d')]=_0x29b13e[_0xa1af('0x9d')][_0xa1af('0x99')]>0x0?_0x29b13e[_0xa1af('0x9d')]:'t';}else if(_['isEmpty'](_0x29b13e[_0xa1af('0x9d')])){_0x29b13e['result']='#';_0x35ea22='#';}if(!this['isConfigured'](_0x5b805e['variable_id'])){this[_0xa1af('0xe')][_0xa1af('0xa3')](_0xa1af('0xd2'));}else{var _0xdb09be=this['getVariable']['sync'](this,_0x5b805e['variable_id']);if(!_0xdb09be){return this[_0xa1af('0xe')][_0xa1af('0x2d')](_0x5b805e,'no\x20variable\x20found');}this['channel'][_0xa1af('0x9a')](_0xdb09be,_0x35ea22);}this[_0xa1af('0x37')][_0xa1af('0x6d')](this,_0x5b805e,_0x35ea22);return _0x29b13e;};AGIVertices[_0xa1af('0x11')][_0xa1af('0xa3')]=function(_0x3d6b5e){logger[_0xa1af('0x2e')](util[_0xa1af('0x2a')](_0xa1af('0x152'),_0x3d6b5e[_0xa1af('0xa8')]));return this[_0xa1af('0xe')]['noop'](_0x3d6b5e[_0xa1af('0x153')]||_0x3d6b5e['label']);};AGIVertices[_0xa1af('0x11')][_0xa1af('0x154')]=function(_0x130ac7){logger[_0xa1af('0x2e')](util[_0xa1af('0x2a')](_0xa1af('0x155'),_0x130ac7['label']));if(!this['isConfigured'](_0x130ac7[_0xa1af('0x143')])){return this['channel']['error'](_0x130ac7,'no\x20find\x20by\x20configured');}logger[_0xa1af('0x2e')](util['format'](_0xa1af('0x145'),this['channel'][_0xa1af('0x3b')],_0x130ac7['findBy']));var _0x4c545d=this[_0xa1af('0x4c')]['sync'](this,_0x130ac7[_0xa1af('0x156')]);var _0x26e9eb=this[_0xa1af('0x4e')][_0xa1af('0x6d')](this,_0x130ac7['findBy'],_0x4c545d);if(_0x26e9eb){logger[_0xa1af('0x2e')](util[_0xa1af('0x2a')](_0xa1af('0x146'),this[_0xa1af('0xe')]['callerid'],_0x130ac7[_0xa1af('0x143')]));this[_0xa1af('0xe')]['noop'](util[_0xa1af('0x2a')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xa1af('0xe')][_0xa1af('0x3b')],_0x130ac7[_0xa1af('0x143')]));return{'code':0xc8,'result':'success'};}else{logger['info'](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0xa1af('0x3b')],_0x130ac7['findBy']));this[_0xa1af('0xe')]['noop'](util[_0xa1af('0x2a')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0xa1af('0x3b')],_0x130ac7[_0xa1af('0x143')]));return{'code':0xc8,'result':_0xa1af('0x149')};}};AGIVertices[_0xa1af('0x11')][_0xa1af('0x157')]=function(_0x2bd53e){logger[_0xa1af('0x2e')](util[_0xa1af('0x2a')](_0xa1af('0x158'),_0x2bd53e[_0xa1af('0xa8')]));if(!this[_0xa1af('0x80')](_0x2bd53e[_0xa1af('0x101')])){return this['channel'][_0xa1af('0x2d')](_0x2bd53e,_0xa1af('0x100'));}var _0x5a8ffb=this[_0xa1af('0x1e')][_0xa1af('0x6d')](this,_0x2bd53e[_0xa1af('0x101')]);if(!_0x5a8ffb){return this[_0xa1af('0xe')][_0xa1af('0x2d')](_0x2bd53e,_0xa1af('0x102'));}var _0x408d93=this[_0xa1af('0xe')][_0xa1af('0xa5')](_0xa1af('0x159'),[_0x5a8ffb,_0x2bd53e['opts']]);if(_0x408d93[_0xa1af('0x9d')]===-0x1){return _0x408d93;}return this[_0xa1af('0xe')]['noop'](util[_0xa1af('0x2a')]('Executed\x20command\x20%s\x20%s',_0xa1af('0x159'),_0x5a8ffb));};AGIVertices[_0xa1af('0x11')]['queue']=function(_0x52478e){logger[_0xa1af('0x2e')](util['format']('Enter\x20in\x20QUEUE\x20(%s)\x20block',_0x52478e['label']));if(!this[_0xa1af('0x80')](_0x52478e[_0xa1af('0x15a')])){return this[_0xa1af('0xe')][_0xa1af('0x2d')](_0x52478e,'no\x20queue\x20selected');}var _0x2f9d77='';var _0x3e032b=parseInt(_0x52478e[_0xa1af('0x15a')],0xa);if(isNaN(_0x3e032b)){_0x2f9d77=_0x52478e[_0xa1af('0x15a')];}else{_0x2f9d77=this[_0xa1af('0x15')]['sync'](this,_0x52478e[_0xa1af('0x15a')]);if(!_0x2f9d77){return this[_0xa1af('0xe')]['error'](_0x52478e,_0xa1af('0x15b'));}}var _0x568482='';if(this[_0xa1af('0x80')](_0x52478e[_0xa1af('0x101')])){var _0x46e7a5=this[_0xa1af('0x1e')][_0xa1af('0x6d')](this,_0x52478e[_0xa1af('0x101')]);if(_0x46e7a5){_0x568482=_0x46e7a5;}}this['createSquareDetailsReport']['sync'](this,_0x52478e,_0x2f9d77);if(_0x52478e[_0xa1af('0xe0')]['indexOf']('x')<0x0){_0x52478e['opts']+='x';}if(_0x52478e['opts']['indexOf']('X')<0x0){_0x52478e[_0xa1af('0xe0')]+='X';}this[_0xa1af('0xe')][_0xa1af('0x9a')](_0xa1af('0x15c'),_0x2f9d77?_0x2f9d77[_0xa1af('0x15d')]():'');var _0x218c86=this[_0xa1af('0xe')]['exec'](_0xa1af('0x15e'),[_0x2f9d77,_0x52478e['opts'],_0x52478e[_0xa1af('0x70')],_0x568482,_0x52478e['timeout'],_0x52478e[_0xa1af('0xb2')],_0x52478e[_0xa1af('0x15f')],_0x52478e['gosub'],'',_0x52478e[_0xa1af('0x160')]]);if(_0x218c86['result']===-0x1){return _0x218c86;}return this['channel'][_0xa1af('0xa3')](util['format'](_0xa1af('0xbd'),_0xa1af('0x15e'),_0x2f9d77));};AGIVertices[_0xa1af('0x11')][_0xa1af('0x161')]=function(_0x4745e5){logger['info'](util[_0xa1af('0x2a')](_0xa1af('0x162'),_0x4745e5[_0xa1af('0xa8')]));var _0x97f178=_0x4745e5[_0xa1af('0x163')]||_0xa1af('0x11c');var _0x35840c=util[_0xa1af('0x2a')](_0xa1af('0x164'),this[_0xa1af('0xe')]['uniqueid'],rs[_0xa1af('0x10a')](0x5));var _0x21a224=util['format'](_0xa1af('0x165'),FILES_PATH,_0x35840c,_0x97f178);var _0x343e78=util['format'](_0xa1af('0x11d'),FILES_PATH,_0x35840c);this['createSquareRecording'][_0xa1af('0x6d')](this,_0x4745e5,_0x35840c,_0x21a224);this[_0xa1af('0xe')][_0xa1af('0x9a')](_0xa1af('0x166'),_0x35840c);logger[_0xa1af('0x2e')](_0xa1af('0x167'),_0x343e78,_0x97f178,_0x4745e5[_0xa1af('0x168')],_0x4745e5[_0xa1af('0x64')]);return this[_0xa1af('0xe')][_0xa1af('0x11f')](_0x343e78,_0x97f178,_0x4745e5[_0xa1af('0x168')],_0x4745e5[_0xa1af('0x64')],undefined,!![]);};AGIVertices[_0xa1af('0x11')]['restapi']=function(_0x34cb1a){logger['info'](util['format'](_0xa1af('0x169'),_0x34cb1a[_0xa1af('0xa8')]));if(!this['isConfigured'](_0x34cb1a[_0xa1af('0x70')])){return this[_0xa1af('0xe')][_0xa1af('0xa3')](_0xa1af('0x16a'));}var _0x26a22e=this[_0xa1af('0x61')][_0xa1af('0x6d')](this,_0x34cb1a);logger[_0xa1af('0x2e')](util['format'](_0xa1af('0x16b'),util['inspect'](_0x26a22e,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0x34cb1a['variable_id'])){return this[_0xa1af('0xe')]['noop'](_0xa1af('0x16c'));}var _0x3f55b1=this[_0xa1af('0x12')][_0xa1af('0x6d')](this,_0x34cb1a[_0xa1af('0xd1')]);if(!_0x3f55b1){return this[_0xa1af('0xe')][_0xa1af('0x2d')](_0x34cb1a,_0xa1af('0xd3'));}this[_0xa1af('0xe')][_0xa1af('0x9a')](util['format'](_0xa1af('0x16d'),_0x3f55b1),_0x26a22e[_0xa1af('0x73')]?_0x26a22e[_0xa1af('0x73')]:_0xa1af('0x16e'));this[_0xa1af('0xe')]['setVariable'](util[_0xa1af('0x2a')](_0xa1af('0x16f'),_0x3f55b1),_0x26a22e['statusMessage']?_0x26a22e[_0xa1af('0x74')]:'OK');if(_0x26a22e['body']){try{this['saveRestApiResult'](_0x26a22e[_0xa1af('0x72')],_0x3f55b1);}catch(_0x9591ae){logger[_0xa1af('0x2d')](util[_0xa1af('0x2a')](_0xa1af('0x170'),_0x3f55b1));}}return this[_0xa1af('0xe')]['noop'](util[_0xa1af('0x2a')](_0xa1af('0xd8'),_0x3f55b1));};AGIVertices['prototype']['saydigits']=function(_0x1fbd80){logger[_0xa1af('0x2e')](util['format'](_0xa1af('0x171'),_0x1fbd80['label']));return this['channel'][_0xa1af('0x172')](_0x1fbd80[_0xa1af('0x173')]['replace'](/\s+/g,''),_0x1fbd80[_0xa1af('0x168')]);};AGIVertices[_0xa1af('0x11')][_0xa1af('0x174')]=function(_0x1a8c2b){logger[_0xa1af('0x2e')](util[_0xa1af('0x2a')](_0xa1af('0x175'),_0x1a8c2b[_0xa1af('0xa8')]));return this[_0xa1af('0xe')][_0xa1af('0x176')](_0x1a8c2b['number']['replace'](/\s+/g,''),_0x1a8c2b[_0xa1af('0x168')]);};AGIVertices[_0xa1af('0x11')][_0xa1af('0x177')]=function(_0xaede52){logger[_0xa1af('0x2e')](util['format'](_0xa1af('0x178'),_0xaede52[_0xa1af('0xa8')]));return this['channel'][_0xa1af('0x179')](_0xaede52['text'],_0xaede52[_0xa1af('0x168')]);};AGIVertices[_0xa1af('0x11')][_0xa1af('0x17a')]=function(_0x5e98c1){logger[_0xa1af('0x2e')](util[_0xa1af('0x2a')](_0xa1af('0x17b'),_0x5e98c1[_0xa1af('0xa8')]));if(!this['isConfigured'](_0x5e98c1[_0xa1af('0x17c')])){return this[_0xa1af('0xe')][_0xa1af('0xa3')](_0xa1af('0x17d'));}var _0x51371b=this[_0xa1af('0x20')]['sync'](this,_0x5e98c1[_0xa1af('0x17c')]);if(!_0x51371b||!_0x51371b[_0xa1af('0x17e')]){return this['channel'][_0xa1af('0x2d')](_0x5e98c1,_0xa1af('0x17f'));}var _0x5a44a4={'from':util['format'](_0xa1af('0x180'),_0x51371b[_0xa1af('0x16')],_0x51371b[_0xa1af('0x181')]||_0x51371b[_0xa1af('0x17e')][_0xa1af('0x182')]),'to':_0x5e98c1['to']||'','cc':_0x5e98c1['cc']||'','bcc':_0x5e98c1[_0xa1af('0x183')]||'','subject':_0x5e98c1[_0xa1af('0x184')],'html':_0x5e98c1[_0xa1af('0x5b')],'text':_0x5e98c1[_0xa1af('0x5b')]};var _0x14bfc7={'tls':{'rejectUnauthorized':![]}};if(_0x51371b['Smtp'][_0xa1af('0x185')]){_0x14bfc7['service']=_0x51371b[_0xa1af('0x17e')][_0xa1af('0x185')];}else{_0x14bfc7[_0xa1af('0x186')]=_0x51371b[_0xa1af('0x17e')][_0xa1af('0x186')];_0x14bfc7[_0xa1af('0x187')]=_0x51371b['Smtp'][_0xa1af('0x187')];_0x14bfc7['secure']=_0x51371b['Smtp'][_0xa1af('0x188')];}if(_0x51371b[_0xa1af('0x17e')]['authentication']){_0x14bfc7[_0xa1af('0x189')]={'user':_0x51371b[_0xa1af('0x17e')][_0xa1af('0x182')],'pass':_0x51371b['Smtp'][_0xa1af('0x18a')]};}if(this[_0xa1af('0x80')](_0x5e98c1['template_id'])){}logger['debug']('sendMail\x20message',JSON[_0xa1af('0x71')](_0x5a44a4));this[_0xa1af('0x37')]['sync'](this,_0x5e98c1,_0x5e98c1[_0xa1af('0x17c')]);this[_0xa1af('0xe')][_0xa1af('0xa3')](util[_0xa1af('0x2a')]('Trying\x20SendMail\x20with\x20account\x20%s',_0x51371b[_0xa1af('0x16')]));this[_0xa1af('0x22')][_0xa1af('0x6d')](this,_0x14bfc7,_0x5a44a4);return this[_0xa1af('0xe')]['noop'](_0xa1af('0x18b'));};AGIVertices[_0xa1af('0x11')][_0xa1af('0x18c')]=function(_0xc5d0e7){logger[_0xa1af('0x2e')](util[_0xa1af('0x2a')]('Enter\x20in\x20SENDFAX\x20(%s)\x20block',_0xc5d0e7[_0xa1af('0xa8')]));return this[_0xa1af('0xe')][_0xa1af('0xa3')](_0xa1af('0x18d'));};AGIVertices[_0xa1af('0x11')][_0xa1af('0x18e')]=function(_0x45abe0){logger['info'](util[_0xa1af('0x2a')](_0xa1af('0x18f'),_0x45abe0[_0xa1af('0xa8')]));if(!this['isConfigured'](_0x45abe0['sms_account_id'])){return this['channel'][_0xa1af('0xa3')](_0xa1af('0x190'));}var _0xa6a506=this[_0xa1af('0x35')]['sync'](this,_0x45abe0[_0xa1af('0x191')]);if(!_0xa6a506){return this['channel'][_0xa1af('0x2d')](_0x45abe0,'no\x20sms\x20account\x20found');}var _0x10d6cb={'body':_0x45abe0[_0xa1af('0x192')],'phone':_0x45abe0['to']||'','SmsAccountId':_0xa6a506['id']};logger[_0xa1af('0xda')](_0xa1af('0x193'),JSON[_0xa1af('0x71')](_0x10d6cb));this[_0xa1af('0x37')][_0xa1af('0x6d')](this,_0x45abe0,_0x45abe0[_0xa1af('0x191')]);this[_0xa1af('0xe')][_0xa1af('0xa3')](util[_0xa1af('0x2a')]('Trying\x20SendSMS\x20with\x20account\x20%s',_0xa6a506[_0xa1af('0x16')]));this[_0xa1af('0x36')]['sync'](this,_0x10d6cb);return this[_0xa1af('0xe')]['noop'](_0xa1af('0x194'));};AGIVertices[_0xa1af('0x11')]['set']=function(_0x430c55){logger[_0xa1af('0x2e')](util['format']('Enter\x20in\x20SET\x20(%s)\x20block',_0x430c55[_0xa1af('0xa8')]));if(!this[_0xa1af('0x80')](_0x430c55[_0xa1af('0xd1')])){return this[_0xa1af('0xe')]['error'](_0x430c55,'no\x20variable\x20selected');}var _0x487751=this[_0xa1af('0x12')][_0xa1af('0x6d')](this,_0x430c55[_0xa1af('0xd1')]);if(!_0x487751){return this[_0xa1af('0xe')]['error'](_0x430c55,_0xa1af('0xd3'));}return this[_0xa1af('0xe')][_0xa1af('0x9a')](_0x487751,_0x430c55[_0xa1af('0x195')]);};AGIVertices[_0xa1af('0x11')]['start']=function(_0x73ce91){logger[_0xa1af('0x2e')](util[_0xa1af('0x2a')](_0xa1af('0x196'),_0x73ce91['label']));this[_0xa1af('0xe')][_0xa1af('0xa3')](_0xa1af('0x197'));if(_0x73ce91[_0xa1af('0xb6')]===_0xa1af('0x198')){this[_0xa1af('0xe')][_0xa1af('0xa3')](_0xa1af('0x199'));return this[_0xa1af('0xe')][_0xa1af('0xb6')]();}return this[_0xa1af('0xe')][_0xa1af('0xa3')](_0xa1af('0x19a'));};AGIVertices[_0xa1af('0x11')][_0xa1af('0x19b')]=function(_0x18152d){logger[_0xa1af('0x2e')](util[_0xa1af('0x2a')](_0xa1af('0x19c'),_0x18152d['label']));if(!this['isConfigured'](_0x18152d[_0xa1af('0x19d')])){return this['channel'][_0xa1af('0x2d')](_0x18152d,_0xa1af('0x19e'));}var _0x1638c4=this[_0xa1af('0x19f')][_0xa1af('0x6d')](this,_0x18152d[_0xa1af('0x19d')]);if(!this['isConfigured'](_0x1638c4)){return this[_0xa1af('0xe')][_0xa1af('0x2d')](_0x18152d,util['format'](_0xa1af('0x1a0'),_0x18152d[_0xa1af('0x19d')]));}if(_0x1638c4===this[_0xa1af('0xe')][_0xa1af('0x3a')]){return this['channel'][_0xa1af('0x2d')](_0x18152d,_0xa1af('0x1a1'));}this[_0xa1af('0x37')][_0xa1af('0x6d')](this,_0x18152d,_0x1638c4);var _0x2e1c78=this[_0xa1af('0xe')][_0xa1af('0xa5')]('AGI',util[_0xa1af('0x2a')](_0xa1af('0x1a2'),config[_0xa1af('0xb2')][_0xa1af('0x186')]||_0xa1af('0x1a3'),_0x1638c4,this[_0xa1af('0xe')][_0xa1af('0x3a')]));if(_0x2e1c78[_0xa1af('0x9d')]===-0x1){return _0x2e1c78;}return this['channel'][_0xa1af('0xa3')](util[_0xa1af('0x2a')](_0xa1af('0xbd'),_0xa1af('0x1a4'),_0x1638c4));};AGIVertices[_0xa1af('0x11')][_0xa1af('0x1a5')]=function(_0x240f28){logger['info'](util[_0xa1af('0x2a')](_0xa1af('0x1a6'),_0x240f28['label']));var _0x262331=this[_0xa1af('0x55')][_0xa1af('0x6d')](this,_0x240f28[_0xa1af('0xb4')]);this[_0xa1af('0x37')][_0xa1af('0x6d')](this,_0x240f28,_0x240f28[_0xa1af('0xb4')]);if(this[_0xa1af('0x80')](_0x240f28[_0xa1af('0xd1')])){var _0x3d9cfc=this[_0xa1af('0x12')]['sync'](this,_0x240f28[_0xa1af('0xd1')]);if(_0x3d9cfc){this[_0xa1af('0xe')][_0xa1af('0x9a')](_0x3d9cfc,_0x262331);return this[_0xa1af('0xe')]['noop'](util[_0xa1af('0x2a')](_0xa1af('0x1a7'),_0x240f28[_0xa1af('0xb4')],_0x3d9cfc));}}return this[_0xa1af('0xe')][_0xa1af('0xa3')](util[_0xa1af('0x2a')](_0xa1af('0x1a8'),_0x240f28['command']));};AGIVertices['prototype'][_0xa1af('0x1a9')]=function(_0x442fe2){logger[_0xa1af('0x2e')](util[_0xa1af('0x2a')](_0xa1af('0x1aa'),_0x442fe2['label']));_0x442fe2[_0xa1af('0x5b')]=_0x442fe2['text'][_0xa1af('0x57')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xa1af('0x80')](_0x442fe2['apiKey'])){return this[_0xa1af('0xe')]['noop'](_0xa1af('0x1ab'));}if(!this[_0xa1af('0x80')](_0x442fe2[_0xa1af('0x5b')])){return this[_0xa1af('0xe')][_0xa1af('0xa3')](_0xa1af('0xa4'));}this['channel'][_0xa1af('0xa3')](util[_0xa1af('0x2a')](_0xa1af('0x1ac'),_0x442fe2[_0xa1af('0x5b')]));var _0x3fd788=this[_0xa1af('0x58')][_0xa1af('0x6d')](this,_0x442fe2);if(_0x3fd788){this['channel'][_0xa1af('0xa3')](util['format'](_0xa1af('0x1ad'),_0x3fd788));var _0x5c4f67=this[_0xa1af('0xe')][_0xa1af('0x140')](_0x3fd788);try{fs['unlink'](_0x3fd788+'.wav');}catch(_0x30bf07){logger[_0xa1af('0x2d')](_0x30bf07);}return _0x5c4f67;}return this[_0xa1af('0xe')]['error'](_0x442fe2,'Google\x20Cloud\x20TTS\x20is\x20unreachable');};AGIVertices['prototype'][_0xa1af('0x1ae')]=function(_0x293df1){logger['info'](util[_0xa1af('0x2a')]('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x293df1[_0xa1af('0xa8')]));_0x293df1['text']=_0x293df1[_0xa1af('0x5b')][_0xa1af('0x57')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xa1af('0x80')](_0x293df1['text'])){return this[_0xa1af('0xe')][_0xa1af('0xa3')](_0xa1af('0xa4'));}this[_0xa1af('0xe')][_0xa1af('0xa3')](util[_0xa1af('0x2a')]('Trying\x20Google\x20TTS\x20%s',_0x293df1[_0xa1af('0x5b')]));var _0x280373=this['googleTTS']['sync'](this,_0x293df1);if(_0x280373){this[_0xa1af('0xe')][_0xa1af('0xa3')](util[_0xa1af('0x2a')](_0xa1af('0x1af'),_0x280373));var _0x4291ab=this['channel'][_0xa1af('0x140')](_0x280373);try{fs[_0xa1af('0xf2')](_0x280373+_0xa1af('0x113'));}catch(_0xa0a243){logger[_0xa1af('0x2d')](_0xa0a243);}return _0x4291ab;}return this[_0xa1af('0xe')][_0xa1af('0x2d')](_0x293df1,_0xa1af('0x1b0'));};AGIVertices[_0xa1af('0x11')]['unpause']=function(_0x1f5b5e){logger[_0xa1af('0x2e')](util[_0xa1af('0x2a')](_0xa1af('0x1b1'),_0x1f5b5e[_0xa1af('0xa8')]));if(!this[_0xa1af('0x80')](_0x1f5b5e[_0xa1af('0x143')])){return this[_0xa1af('0xe')]['error'](_0x1f5b5e,_0xa1af('0x144'));}logger[_0xa1af('0x2e')](util[_0xa1af('0x2a')](_0xa1af('0x145'),this[_0xa1af('0xe')][_0xa1af('0x3b')],_0x1f5b5e[_0xa1af('0x143')]));var _0x3df2cd=this[_0xa1af('0x50')][_0xa1af('0x6d')](this,_0x1f5b5e['findBy']);if(_0x3df2cd){logger[_0xa1af('0x2e')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0xa1af('0xe')][_0xa1af('0x3b')],_0x1f5b5e['findBy']));this[_0xa1af('0xe')][_0xa1af('0xa3')](util[_0xa1af('0x2a')](_0xa1af('0x146'),this[_0xa1af('0xe')][_0xa1af('0x3b')],_0x1f5b5e['findBy']));return{'code':0xc8,'result':_0xa1af('0x147')};}else{logger[_0xa1af('0x2e')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xa1af('0xe')]['callerid'],_0x1f5b5e['findBy']));this[_0xa1af('0xe')][_0xa1af('0xa3')](util['format'](_0xa1af('0x148'),this[_0xa1af('0xe')][_0xa1af('0x3b')],_0x1f5b5e[_0xa1af('0x143')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0xa1af('0x11')]['voicemail']=function(_0x483ab0){logger[_0xa1af('0x2e')](util[_0xa1af('0x2a')](_0xa1af('0x1b2'),_0x483ab0[_0xa1af('0xa8')]));var _0x215385=this[_0xa1af('0xe')][_0xa1af('0xa5')](_0xa1af('0x1b3'),[_0x483ab0[_0xa1af('0x1b4')],_0x483ab0[_0xa1af('0x77')]]);if(_0x215385[_0xa1af('0x9d')]===-0x1){return _0x215385;}return this['channel'][_0xa1af('0xa3')](util[_0xa1af('0x2a')](_0xa1af('0xbd'),'VOICEMAIL',_0x483ab0[_0xa1af('0x1b4')]));};AGIVertices[_0xa1af('0x11')][_0xa1af('0x1b5')]=function(_0x11ce89){logger[_0xa1af('0x2e')](util[_0xa1af('0x2a')](_0xa1af('0x1b6'),_0x11ce89['label']));if(!this[_0xa1af('0x80')](_0x11ce89[_0xa1af('0xd1')])){return this[_0xa1af('0xe')][_0xa1af('0x2d')](_0x11ce89,_0xa1af('0x1b7'));}var _0x5f0795=this[_0xa1af('0x12')][_0xa1af('0x6d')](this,_0x11ce89[_0xa1af('0xd1')]);if(!_0x5f0795){return this[_0xa1af('0xe')][_0xa1af('0x2d')](_0x11ce89,_0xa1af('0xd3'));}var _0x5e18fb=this[_0xa1af('0xe')][_0xa1af('0x12')](_0x5f0795);return{'code':0xc8,'result':_0x5e18fb[_0xa1af('0x9b')]?_0x5e18fb[_0xa1af('0x9b')]:'-'};};String[_0xa1af('0x11')][_0xa1af('0x1b8')]=function(_0x23f627,_0x3a6f13){return this[_0xa1af('0x1b9')](_0x23f627)[_0xa1af('0x1ba')](_0x3a6f13);};module[_0xa1af('0x1bb')]=AGIVertices; \ No newline at end of file +var _0x4d07=['command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','Enter\x20in\x20CALLBACK\x20(%s)\x20block','delay','add','minutes','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','Executed\x20command\x20MRCPSynth\x20%s','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20odbc\x20database\x20found','no\x20query\x20configured','replace','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','keys','forEach','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','no\x20user\x20found','DIAL','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','out','Dialogflow\x20is\x20unreachable','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','bot','SESTEK_NDA_%s','Sestek\x20NDA\x20%s\x20file\x20created','audiofile','streamFile','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20found','trunk_name','SIP/%s/%s','Executed\x20command\x20%s','Enter\x20in\x20FINALLY\x20(%s)\x20block','finally','maxRetry','file_id','no\x20file\x20audio\x20found','getData','test','mindigit','hiddendigitsnum','generate','hiddendigitspos','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','aws\x20Polly\x20%s\x20file\x20created','aws\x20Polly\x20is\x20unreachable','awslex','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','%s/recordings/%s','beep','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','appid','no\x20appsecret\x20configured','NOBEEP','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','gotoc','context','extension','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','no\x20condition\x20configured','condition','true','false','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','Enter\x20in\x20HANGUP\x20(%s)\x20block','hangup','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','wav','IspeechASR\x20Result\x20%s','ispeechtts','Trying\x20ispeech\x20TTS\x20%s','login','findBy','no\x20find\x20by\x20configured','agentLogin','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','FIND\x20AGENT\x20%s\x20BY\x20%s','math','math\x20%s','operation','%s[%s]','variable\x20%s[key]\x20set','menu','Enter\x20in\x20MENU\x20(%s)\x20block','no\x20file\x20audio\x20selected','response','Enter\x20in\x20NOOP\x20(%s)\x20block','output','Enter\x20in\x20PAUSE\x20(%s)\x20block','playback','PLAYBACK','opts','Executed\x20command\x20%s\x20%s','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','position','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','recordFile','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','restAPI','Response:','%s_STATUS_CODE','200','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','number','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','user','bcc','subject','service','host','port','secure','authentication','auth','pass','debug','sendMail\x20message','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','Enter\x20in\x20SET\x20(%s)\x20block','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','getSquareProject','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','system','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','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','no\x20variable\x20selected','join','exports','path','util','lodash','shelljs','odbc','randomstring','moment','mustache','request-promise','../../config/logger','agi','../../config/environment','./scripts','rawHeaders','rawBody','getdigits','getsecretdigits','channel','rpc','mailRpc','prototype','getVariableById','then','name','catch','getVoiceQueue','getVoiceQueueById','getSquareProjectById','getSquareOdbc','getSquareOdbcById','dsn','getUser','getTrunk','getSound','getSoundById','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','IntervalId','map','Intervals','interval','%s/sounds/converted/%s','getQueryOdbc','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','arg_1','callerid','createSquareRecording','calleridname','priority','accountcode','dnid','file','createSquareMessage','createCmContact','isEmpty','isNil','callback_','random','lastName','phone','list_id','scheduledAt','callback_priority','getPause','getPauseById','agentPause','agentUnpause','agent','agentLogout','internal','LOCAL','shellCommand','exec','trim','googleCloudTTS','google_cloud_tts_text_type','text','ssmlGender','MALE','audioEncoding','googleTTS','google_tts_language','url','method','timeout','includes','POST','PUT','toUpperCase','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','uri','render','stringify','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','sestekNDA','ispeechTTS','key','en-US','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_access_key_id','aws_secret_access_key','aws_lex_region','aws_bot_name','googleASR','appsecret','clear','agicommand','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','isArray','recursiveNodeIndex','saveRestApiResult','format','%s.%s','length','setVariable','split','replaceAll','getVariable','extra','toString','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','sync','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','MRCPSynth','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','MRCPRecog','RECOG_CONFIDENCE()','RECOG_INPUT()','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block'];(function(_0x39658b,_0xf72a7f){var _0xa37442=function(_0x2edfaf){while(--_0x2edfaf){_0x39658b['push'](_0x39658b['shift']());}};_0xa37442(++_0xf72a7f);}(_0x4d07,0x103));var _0x74d0=function(_0x342608,_0x5da0fa){_0x342608=_0x342608-0x0;var _0x410103=_0x4d07[_0x342608];return _0x410103;};'use strict';var fs=require('fs');var path=require(_0x74d0('0x0'));var util=require(_0x74d0('0x1'));var _=require(_0x74d0('0x2'));var sh=require(_0x74d0('0x3'));var odbc=require(_0x74d0('0x4'))();var rs=require(_0x74d0('0x5'));var moment=require(_0x74d0('0x6'));var Mustache=require(_0x74d0('0x7'));var rp=require(_0x74d0('0x8'));var logger=require(_0x74d0('0x9'))(_0x74d0('0xa'));var config=require(_0x74d0('0xb'));var scripts=require(_0x74d0('0xc'));var FILES_PATH='/var/opt/motion2/server/files';var recursiveMapAttributes=[_0x74d0('0xd'),_0x74d0('0xe')];var verticesWithRetry=['menu',_0x74d0('0xf'),_0x74d0('0x10')];var AGIVertices=function(_0x3eecdb,_0x4443bf,_0x45e55e){this[_0x74d0('0x11')]=_0x3eecdb;this[_0x74d0('0x12')]=_0x4443bf;this[_0x74d0('0x13')]=_0x45e55e;};AGIVertices[_0x74d0('0x14')]['getVariable']=function(_0xe8508e,_0x1b2890){this[_0x74d0('0x12')][_0x74d0('0x15')](_0xe8508e)[_0x74d0('0x16')](function(_0x1449f5){_0x1b2890(null,_0x1449f5?_0x1449f5[_0x74d0('0x17')]:![]);})[_0x74d0('0x18')](function(_0x496b87){_0x1b2890(_0x496b87);});};AGIVertices[_0x74d0('0x14')][_0x74d0('0x19')]=function(_0x3a825c,_0x513840){this[_0x74d0('0x12')][_0x74d0('0x1a')](_0x3a825c)[_0x74d0('0x16')](function(_0x4b0c65){_0x513840(null,_0x4b0c65?_0x4b0c65[_0x74d0('0x17')]:![]);})[_0x74d0('0x18')](function(_0xd9a2f){_0x513840(_0xd9a2f);});};AGIVertices[_0x74d0('0x14')]['getSquareProject']=function(_0x52b60a,_0x599af3){this['rpc'][_0x74d0('0x1b')](_0x52b60a)['then'](function(_0x69e180){_0x599af3(null,_0x69e180?_0x69e180[_0x74d0('0x17')]:![]);})[_0x74d0('0x18')](function(_0x185b25){_0x599af3(_0x185b25);});};AGIVertices[_0x74d0('0x14')][_0x74d0('0x1c')]=function(_0x214849,_0x1fae7a){this[_0x74d0('0x12')][_0x74d0('0x1d')](_0x214849)[_0x74d0('0x16')](function(_0x46d42b){_0x1fae7a(null,_0x46d42b?_0x46d42b[_0x74d0('0x1e')]:![]);})[_0x74d0('0x18')](function(_0x56a773){_0x1fae7a(_0x56a773);});};AGIVertices[_0x74d0('0x14')][_0x74d0('0x1f')]=function(_0x3569d7,_0x587123){this[_0x74d0('0x12')]['getUserById'](_0x3569d7)[_0x74d0('0x16')](function(_0x29d0e8){_0x587123(null,_0x29d0e8?_0x29d0e8['name']:![]);})['catch'](function(_0x3bffff){_0x587123(_0x3bffff);});};AGIVertices[_0x74d0('0x14')][_0x74d0('0x20')]=function(_0x54b88c,_0x2ff784){this[_0x74d0('0x12')]['getTrunkById'](_0x54b88c)['then'](function(_0x117c74){_0x2ff784(null,_0x117c74?_0x117c74['name']:![]);})[_0x74d0('0x18')](function(_0x537560){_0x2ff784(_0x537560);});};AGIVertices[_0x74d0('0x14')][_0x74d0('0x21')]=function(_0x4e1490,_0xe26238){var _0x378642=this;this[_0x74d0('0x12')][_0x74d0('0x22')](_0x4e1490)[_0x74d0('0x16')](function(_0x1d07dc){_0xe26238(null,_0x1d07dc?_0x378642[_0x74d0('0x23')](_0x1d07dc[_0x74d0('0x24')]):![]);})[_0x74d0('0x18')](function(_0x706bc5){_0xe26238(_0x706bc5);});};AGIVertices[_0x74d0('0x14')][_0x74d0('0x25')]=function(_0x2942fd,_0x16b533){this[_0x74d0('0x12')][_0x74d0('0x26')](_0x2942fd)['then'](function(_0x1d87f3){_0x16b533(null,_0x1d87f3?_0x1d87f3:![]);})[_0x74d0('0x18')](function(_0x1b96d8){_0x16b533(_0x1b96d8);});};AGIVertices[_0x74d0('0x14')]['sendMailMessage']=function(_0x4224c2,_0x2318a7,_0x532e49){this[_0x74d0('0x13')][_0x74d0('0x27')](_0x4224c2,_0x2318a7)['then'](function(){_0x532e49(null);})[_0x74d0('0x18')](function(_0x51373a){_0x532e49(_0x51373a);});};AGIVertices['prototype'][_0x74d0('0x28')]=function(_0x57215f,_0x257c81){this[_0x74d0('0x12')][_0x74d0('0x29')](_0x57215f)[_0x74d0('0x16')](function(_0xe9951c){if(_0xe9951c){if(_0xe9951c[_0x74d0('0x2a')]){_0x257c81(null,[_0xe9951c['interval']]);}else{_0x257c81(null,_[_0x74d0('0x2b')](_0xe9951c[_0x74d0('0x2c')],_0x74d0('0x2d')));}}else{_0x257c81(null,![]);}})[_0x74d0('0x18')](function(_0x53edc5){_0x257c81(_0x53edc5);});};AGIVertices[_0x74d0('0x14')]['getSoundPath']=function(_0x48f834){return util['format'](_0x74d0('0x2e'),FILES_PATH,_0x48f834);};AGIVertices[_0x74d0('0x14')][_0x74d0('0x2f')]=function(_0x58f481,_0x169d54,_0x1eec31){odbc['open'](_0x58f481,function(_0x3ebfd4){if(_0x3ebfd4){logger[_0x74d0('0x30')](_0x74d0('0x31'),_0x3ebfd4);_0x1eec31(_0x3ebfd4);}else{logger[_0x74d0('0x32')](_0x74d0('0x33'));odbc[_0x74d0('0x34')](_0x169d54,function(_0xb1521e,_0x483e22){if(_0xb1521e){logger[_0x74d0('0x32')]('Error\x20executing\x20query\x20%s',_0x169d54);_0x1eec31(_0xb1521e);}else{logger[_0x74d0('0x32')]('Query\x20executed\x20correctly\x20%s',_0x169d54);odbc['close'](function(_0x255c08){if(_0x255c08){logger['error'](_0x74d0('0x35'),_0x255c08);}_0x1eec31(null,_0x483e22);});}});}});};AGIVertices['prototype'][_0x74d0('0x36')]=function(_0x4a6c46,_0x309e85){this[_0x74d0('0x12')][_0x74d0('0x37')](_0x4a6c46)[_0x74d0('0x16')](function(_0x3b0b40){_0x309e85(null,_0x3b0b40?_0x3b0b40:![]);})[_0x74d0('0x18')](function(_0x92a631){_0x309e85(_0x92a631);});};AGIVertices[_0x74d0('0x14')][_0x74d0('0x38')]=function(_0x183a09,_0x1b13b8){this['rpc'][_0x74d0('0x38')](_0x183a09)[_0x74d0('0x16')](function(_0x3c22a3){_0x1b13b8(null,_0x3c22a3);})['catch'](function(_0x340e78){_0x1b13b8(_0x340e78);});};AGIVertices['prototype']['createSquareDetailsReport']=function(_0x4af375,_0x1ad732,_0x4f7832){this[_0x74d0('0x12')][_0x74d0('0x39')]({'uniqueid':this[_0x74d0('0x11')][_0x74d0('0x3a')],'node':_0x4af375[_0x74d0('0x3b')],'application':_0x4af375['agicommand'],'data':_0x1ad732||null,'project_name':this[_0x74d0('0x11')][_0x74d0('0x3c')],'callerid':this[_0x74d0('0x11')][_0x74d0('0x3d')]})[_0x74d0('0x16')](function(_0x3f8e3e){if(_0x4f7832){_0x4f7832(null,_0x3f8e3e);}})[_0x74d0('0x18')](function(_0x8400ca){if(_0x4f7832){_0x4f7832(_0x8400ca);}});};AGIVertices['prototype'][_0x74d0('0x3e')]=function(_0x58af8c,_0x1ad203,_0x36023d,_0x12c4b9){this['rpc'][_0x74d0('0x3e')]({'uniqueid':this[_0x74d0('0x11')]['uniqueid'],'callerid':this['channel']['callerid'],'calleridname':this[_0x74d0('0x11')][_0x74d0('0x3f')],'context':this[_0x74d0('0x11')]['context'],'extension':this['channel']['extension'],'priority':this[_0x74d0('0x11')][_0x74d0('0x40')],'accountcode':this[_0x74d0('0x11')][_0x74d0('0x41')],'dnid':this['channel'][_0x74d0('0x42')],'projectName':this['channel']['arg_1'],'saveName':_0x1ad203,'filename':_0x58af8c[_0x74d0('0x43')]||_0x1ad203,'savePath':_0x36023d})[_0x74d0('0x16')](function(_0x3b2582){_0x12c4b9(null,_0x3b2582);})[_0x74d0('0x18')](function(_0x518632){_0x12c4b9(_0x518632);});};AGIVertices[_0x74d0('0x14')][_0x74d0('0x44')]=function(_0x447b57,_0x20aac5,_0x511393){this['rpc']['createSquareMessage']({'uniqueid':this[_0x74d0('0x11')][_0x74d0('0x3a')],'body':_0x447b57,'direction':_0x20aac5})[_0x74d0('0x16')](function(_0x9c5fc0){if(_0x511393){_0x511393(null,_0x9c5fc0);}})[_0x74d0('0x18')](function(_0x2a1921){if(_0x511393){_0x511393(_0x2a1921);}});};AGIVertices[_0x74d0('0x14')][_0x74d0('0x45')]=function(_0x5be5d7,_0x2af155){this[_0x74d0('0x12')][_0x74d0('0x45')]({'firstName':_[_0x74d0('0x46')](_0x5be5d7[_0x74d0('0x17')])||_[_0x74d0('0x47')](_0x5be5d7['name'])?_0x74d0('0x48')+Math[_0x74d0('0x49')]():_0x5be5d7[_0x74d0('0x17')],'lastName':_[_0x74d0('0x46')](_0x5be5d7['lastName'])||_['isNil'](_0x5be5d7[_0x74d0('0x4a')])?null:_0x5be5d7[_0x74d0('0x4a')],'phone':_0x5be5d7[_0x74d0('0x4b')],'ListId':_0x5be5d7[_0x74d0('0x4c')],'scheduledat':_0x5be5d7[_0x74d0('0x4d')],'callbackUniqueid':this[_0x74d0('0x11')][_0x74d0('0x3a')],'tags':'callback','description':'Callback\x20scheduled\x20at\x20'+_0x5be5d7[_0x74d0('0x4d')]['toString'](),'priority':_0x5be5d7[_0x74d0('0x4e')]})[_0x74d0('0x16')](function(_0x4937b4){_0x2af155(null,_0x4937b4);})[_0x74d0('0x18')](function(_0xd3a32){_0x2af155(_0xd3a32);});};AGIVertices[_0x74d0('0x14')][_0x74d0('0x4f')]=function(_0x4846d1,_0x195ddb){this['rpc'][_0x74d0('0x50')](_0x4846d1)['then'](function(_0x1da3fa){_0x195ddb(null,_0x1da3fa?_0x1da3fa[_0x74d0('0x17')]:![]);})[_0x74d0('0x18')](function(_0x28a399){_0x195ddb(_0x28a399);});};AGIVertices['prototype'][_0x74d0('0x51')]=function(_0x437026,_0x317661,_0x5a03fe){var _0x4e3185={'role':'agent'};_0x4e3185[_0x437026]=this['channel']['callerid'];this[_0x74d0('0x12')][_0x74d0('0x51')](_0x4e3185,_0x317661,this['channel'][_0x74d0('0x3a')])[_0x74d0('0x16')](function(_0x213143){_0x5a03fe(null,_['isNil'](_0x213143)?![]:!![]);})['catch'](function(_0x4456b5){logger[_0x74d0('0x30')](_0x4456b5);_0x5a03fe(null,![]);});};AGIVertices[_0x74d0('0x14')][_0x74d0('0x52')]=function(_0x159769,_0x4e44a5){var _0x406d16={'role':_0x74d0('0x53')};_0x406d16[_0x159769]=this[_0x74d0('0x11')][_0x74d0('0x3d')];this[_0x74d0('0x12')][_0x74d0('0x52')](_0x406d16)[_0x74d0('0x16')](function(_0x7903f9){_0x4e44a5(null,_[_0x74d0('0x47')](_0x7903f9)?![]:!![]);})['catch'](function(_0x4ef01f){logger['error'](_0x4ef01f);_0x4e44a5(null,![]);});};AGIVertices[_0x74d0('0x14')][_0x74d0('0x54')]=function(_0x45fba2,_0x27630b){var _0x213be={'role':'agent'};_0x213be[_0x45fba2]=this[_0x74d0('0x11')][_0x74d0('0x3d')];this[_0x74d0('0x12')][_0x74d0('0x54')](_0x213be)[_0x74d0('0x16')](function(_0x1bf769){_0x27630b(null,_[_0x74d0('0x47')](_0x1bf769)?![]:!![]);})[_0x74d0('0x18')](function(_0x4a48d7){logger[_0x74d0('0x30')](_0x4a48d7);_0x27630b(null,![]);});};AGIVertices['prototype']['agentLogin']=function(_0x4f0a25,_0x5dd89e){var _0x2b85fd={'role':_0x74d0('0x53')};_0x2b85fd[_0x4f0a25]=this['channel']['callerid'];var _0x53047c=_0x4f0a25!=_0x74d0('0x55')?util['format']('%s/%s@from-sip/n',_0x74d0('0x56'),this['channel'][_0x74d0('0x3d')]):undefined;this[_0x74d0('0x12')]['agentLogin'](_0x2b85fd,_0x53047c)[_0x74d0('0x16')](function(_0x3053b5){_0x5dd89e(null,_[_0x74d0('0x47')](_0x3053b5)?![]:!![]);})[_0x74d0('0x18')](function(_0x16add5){logger[_0x74d0('0x30')](_0x16add5);_0x5dd89e(null,![]);});};AGIVertices[_0x74d0('0x14')][_0x74d0('0x57')]=function(_0x578f6c,_0x180652){sh[_0x74d0('0x58')](_[_0x74d0('0x59')](_0x578f6c),function(_0x5aa940,_0x77a446){var _0x16c8d7=_0x77a446['replace'](/(\r\n|\n|\r)/gm,'');_0x180652(null,_0x16c8d7);});};AGIVertices[_0x74d0('0x14')][_0x74d0('0x5a')]=function(_0x352b6d,_0x318135){scripts[_0x74d0('0x5a')](_0x352b6d['apiKey'],_0x352b6d[_0x74d0('0x5b')]||_0x74d0('0x5c'),_0x352b6d[_0x74d0('0x5c')],_0x352b6d['languageCode']||'en-US',_0x352b6d[_0x74d0('0x5d')]||_0x74d0('0x5e'),_0x352b6d[_0x74d0('0x5f')]||'MP3')['then'](function(_0x262930){_0x318135(null,_0x262930);})[_0x74d0('0x18')](function(_0x3e135f){_0x318135(_0x3e135f);});};AGIVertices[_0x74d0('0x14')]['googleTTS']=function(_0x583fd8,_0x5933b5){scripts[_0x74d0('0x60')](_0x583fd8[_0x74d0('0x5c')],_0x583fd8[_0x74d0('0x61')]||'en',0x1)[_0x74d0('0x16')](function(_0x26af7b){_0x5933b5(null,_0x26af7b);})['catch'](function(_0x22aa26){_0x5933b5(_0x22aa26);});};AGIVertices[_0x74d0('0x14')]['restAPI']=function(_0x2802a7,_0xcb83a8){var _0x435590={'uri':_0x2802a7[_0x74d0('0x62')],'method':_0x2802a7[_0x74d0('0x63')],'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x2802a7[_0x74d0('0x64')])==='number'&&parseInt(_0x2802a7[_0x74d0('0x64')])>=0x1?parseInt(_0x2802a7[_0x74d0('0x64')])*0x3e8:0x5*0x3e8};if(_[_0x74d0('0x65')]([_0x74d0('0x66'),_0x74d0('0x67')],_0x435590['method'][_0x74d0('0x68')]())){try{_0x435590[_0x74d0('0x69')]=_0x2802a7[_0x74d0('0xe')]?JSON[_0x74d0('0x6a')](_0x2802a7[_0x74d0('0xe')]):{};}catch(_0x5b0064){logger[_0x74d0('0x30')](_0x74d0('0x6b'),_0x5b0064);}}try{_0x435590[_0x74d0('0x6c')]=_0x2802a7[_0x74d0('0xd')]?JSON[_0x74d0('0x6a')](_0x2802a7[_0x74d0('0xd')]):{};}catch(_0x527c36){logger[_0x74d0('0x30')](_0x74d0('0x6d'),_0x527c36);}if(_0x2802a7[_0x74d0('0x6e')]){try{var _0x16084d=require(_0x2802a7['computedVariables'])['sync'](this,_0x435590);_0x435590[_0x74d0('0x6f')]=Mustache[_0x74d0('0x70')](_0x2802a7[_0x74d0('0x62')],_0x16084d,{},['$$','$$']);if(_0x435590[_0x74d0('0x6c')]){_0x435590[_0x74d0('0x6c')]=JSON[_0x74d0('0x6a')](Mustache[_0x74d0('0x70')](JSON['stringify'](_0x435590[_0x74d0('0x6c')]),_0x16084d,{},['$$','$$']));}if(_0x435590[_0x74d0('0x69')]){_0x435590['body']=JSON['parse'](Mustache[_0x74d0('0x70')](JSON[_0x74d0('0x71')](_0x435590[_0x74d0('0x69')]),_0x16084d,{},['$$','$$']));}}catch(_0x44c75f){logger[_0x74d0('0x30')]('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x44c75f);}}rp(_0x435590)[_0x74d0('0x16')](function(_0x3fa120){var _0x55d6a2={'statusCode':_0x3fa120[_0x74d0('0x72')]||0xc8,'statusMessage':_0x3fa120[_0x74d0('0x73')]||'OK','headers':_0x3fa120[_0x74d0('0x6c')]||{},'body':_0x3fa120[_0x74d0('0x69')]||{}};_0xcb83a8(null,_0x55d6a2);})['catch'](function(_0x358764){var _0x215eac={'statusCode':_0x358764[_0x74d0('0x72')]||0x1f4,'statusMessage':_0x358764[_0x74d0('0x74')]||_0x74d0('0x75'),'headers':_0x358764[_0x74d0('0x76')]['headers']||{},'body':_0x358764[_0x74d0('0x76')][_0x74d0('0x69')]||{}};_0xcb83a8(null,_0x215eac);});};AGIVertices['prototype'][_0x74d0('0x77')]=function(_0x10d350,_0x2e58cc){scripts['googleDialogflow'](this[_0x74d0('0x11')][_0x74d0('0x3a')],_0x10d350['key'],_0x10d350[_0x74d0('0x5c')],_0x10d350['dialogflow_language']||'en')[_0x74d0('0x16')](function(_0x47d025){_0x2e58cc(null,_0x47d025);})[_0x74d0('0x18')](function(_0x31968e){_0x2e58cc(_0x31968e);});};AGIVertices[_0x74d0('0x14')][_0x74d0('0x78')]=function(_0x40ece9,_0x3d2c02){scripts[_0x74d0('0x78')](this[_0x74d0('0x11')],_0x40ece9)[_0x74d0('0x16')](function(_0x4d7c33){_0x3d2c02(null,_0x4d7c33);})[_0x74d0('0x18')](function(_0x1a3e4d){_0x3d2c02(_0x1a3e4d);});};AGIVertices[_0x74d0('0x14')][_0x74d0('0x79')]=function(_0x54b962,_0x2e053e){scripts[_0x74d0('0x79')](_0x54b962[_0x74d0('0x7a')],_0x54b962[_0x74d0('0x5c')],_0x54b962['ispeech_tts_language']||_0x74d0('0x7b'),_0x54b962[_0x74d0('0x7c')])[_0x74d0('0x16')](function(_0x226bac){_0x2e053e(null,_0x226bac);})[_0x74d0('0x18')](function(_0x53fe09){_0x2e053e(_0x53fe09);});};AGIVertices['prototype'][_0x74d0('0x7d')]=function(_0xd91fab,_0x4eb741,_0x1a06d4){scripts[_0x74d0('0x7d')](_0x4eb741,_0xd91fab[_0x74d0('0x7a')],_0xd91fab[_0x74d0('0x7e')]||'en-US',this[_0x74d0('0x7f')](_0xd91fab[_0x74d0('0x80')])?_0xd91fab[_0x74d0('0x80')]:undefined)[_0x74d0('0x16')](function(_0x29d593){_0x1a06d4(null,_0x29d593);})['catch'](function(_0x4d2db3){_0x1a06d4(_0x4d2db3);});};AGIVertices['prototype'][_0x74d0('0x81')]=function(_0x2bc5f0,_0x4204e8){scripts[_0x74d0('0x81')](_0x2bc5f0['aws_access_key_id'],_0x2bc5f0['aws_secret_access_key'],_0x2bc5f0[_0x74d0('0x82')],_0x2bc5f0[_0x74d0('0x83')]||_0x74d0('0x84'),_0x2bc5f0[_0x74d0('0x5c')],_0x2bc5f0[_0x74d0('0x85')]||_0x74d0('0x5c'))['then'](function(_0x4e1824){_0x4204e8(null,_0x4e1824);})[_0x74d0('0x18')](function(_0x3eed2b){_0x4204e8(_0x3eed2b);});};AGIVertices[_0x74d0('0x14')][_0x74d0('0x86')]=function(_0x29a7dd,_0x41a82f){scripts[_0x74d0('0x86')](this[_0x74d0('0x11')]['uniqueid'],_0x29a7dd[_0x74d0('0x87')],_0x29a7dd[_0x74d0('0x88')],_0x29a7dd[_0x74d0('0x89')],_0x29a7dd['text'],_0x29a7dd[_0x74d0('0x8a')])[_0x74d0('0x16')](function(_0x13fdf3){_0x41a82f(null,_0x13fdf3);})['catch'](function(_0xa1f9b6){_0x41a82f(_0xa1f9b6);});};AGIVertices['prototype'][_0x74d0('0x8b')]=function(_0x467af6,_0x1b0518,_0x13e8ec){scripts[_0x74d0('0x8b')](_0x1b0518,_0x467af6[_0x74d0('0x7a')],_0x467af6['google_asr_language']||'en-US')['then'](function(_0x2a33bc){_0x13e8ec(null,_0x2a33bc);})[_0x74d0('0x18')](function(_0x5bcf2b){_0x13e8ec(_0x5bcf2b);});};AGIVertices[_0x74d0('0x14')]['tildeASR']=function(_0x54a260,_0x8f71c4,_0x54ba28){scripts['tildeASR'](_0x8f71c4,_0x54a260['appid'],_0x54a260[_0x74d0('0x8c')],_0x54a260['uri'])[_0x74d0('0x16')](function(_0x3b3763){_0x54ba28(null,_0x3b3763);})['catch'](function(_0x107df9){_0x54ba28(_0x107df9);});};AGIVertices['prototype'][_0x74d0('0x8d')]=function(_0x4c9c69){var _0x32c7a5=_[_0x74d0('0x65')](verticesWithRetry,_0x4c9c69[_0x74d0('0x8e')])?_0x4c9c69:_['clone'](_0x4c9c69);for(var _0x4a59a9 in _0x32c7a5){if(_0x32c7a5[_0x74d0('0x8f')](_0x4a59a9)){if(_0x32c7a5[_0x4a59a9]&&_[_0x74d0('0x90')](_0x32c7a5[_0x4a59a9])){if(_[_0x74d0('0x65')](recursiveMapAttributes,_0x4a59a9)){_0x32c7a5[_0x4a59a9]=this[_0x74d0('0x91')](_0x32c7a5[_0x4a59a9]);}else{_0x32c7a5[_0x4a59a9]=this[_0x74d0('0x92')](_0x32c7a5[_0x4a59a9]);}}}}return _0x32c7a5;};AGIVertices[_0x74d0('0x14')]['recursiveNodeIndex']=function(_0x3e1c67){for(var _0x105a54 in _0x3e1c67){if(_0x3e1c67['hasOwnProperty'](_0x105a54)){if(_['isPlainObject'](_0x3e1c67[_0x105a54])){this['recursiveNodeIndex'](_0x3e1c67[_0x105a54]);}else if(_[_0x74d0('0x93')](_0x3e1c67[_0x105a54])){for(var _0x1002b=0x0;_0x1002b<_0x3e1c67[_0x105a54]['length'];_0x1002b++){this[_0x74d0('0x94')](_0x3e1c67[_0x105a54][_0x1002b]);}}else if(_[_0x74d0('0x90')](_0x3e1c67[_0x105a54])){_0x3e1c67[_0x105a54]=this[_0x74d0('0x92')](_0x3e1c67[_0x105a54]);}}}};AGIVertices[_0x74d0('0x14')][_0x74d0('0x95')]=function(_0x47b83a,_0x203d02){for(var _0x5ab5b5 in _0x47b83a){if(_0x47b83a['hasOwnProperty'](_0x5ab5b5)){if(_['isPlainObject'](_0x47b83a[_0x5ab5b5])){if(!_[_0x74d0('0x46')](_0x47b83a[_0x5ab5b5])){this[_0x74d0('0x95')](_0x47b83a[_0x5ab5b5],util[_0x74d0('0x96')](_0x74d0('0x97'),_0x203d02,_0x5ab5b5));}}else if(_[_0x74d0('0x93')](_0x47b83a[_0x5ab5b5])){for(var _0x7a003e=0x0;_0x7a003e<_0x47b83a[_0x5ab5b5][_0x74d0('0x98')];_0x7a003e++){this[_0x74d0('0x95')](_0x47b83a[_0x5ab5b5][_0x7a003e],util[_0x74d0('0x96')](_0x74d0('0x97'),_0x203d02,_0x5ab5b5+'['+_0x7a003e+']'));}}else{if(!_[_0x74d0('0x47')](_0x47b83a[_0x5ab5b5])){this[_0x74d0('0x11')][_0x74d0('0x99')](util[_0x74d0('0x96')](_0x74d0('0x97'),_0x203d02,_0x5ab5b5),_0x47b83a[_0x5ab5b5]);}}}}};AGIVertices[_0x74d0('0x14')][_0x74d0('0x91')]=function(_0xe58f82){try{var _0x3b9b63=JSON['parse'](_0xe58f82);this['recursiveNodeIndex'](_0x3b9b63);return JSON[_0x74d0('0x71')](_0x3b9b63);}catch(_0x3fc5d6){return this[_0x74d0('0x92')](_0xe58f82);}};AGIVertices[_0x74d0('0x14')][_0x74d0('0x92')]=function(_0x3acea5){var _0x55be0=_0x3acea5[_0x74d0('0x9a')]('{');for(var _0x4395e9=0x1;_0x4395e9<_0x55be0['length'];_0x4395e9+=0x1){var _0x4d0e89=_0x55be0[_0x4395e9][_0x74d0('0x9a')]('}');if(_0x4d0e89[_0x74d0('0x98')]>0x1){_0x3acea5=_0x3acea5[_0x74d0('0x9b')]('{'+_0x4d0e89[0x0]+'}',this[_0x74d0('0x11')][_0x74d0('0x9c')](_0x4d0e89[0x0])[_0x74d0('0x9d')]||_0x4d0e89[0x0]);}}if(_0x55be0[_0x74d0('0x98')]===0x1){return _0x3acea5[_0x74d0('0x9e')]();}return this[_0x74d0('0x92')](_0x3acea5);};AGIVertices[_0x74d0('0x14')][_0x74d0('0x9f')]=function(_0x557b28,_0x47e5a9){var _0x3909eb=this[_0x74d0('0x11')][_0x74d0('0x9c')](_0x557b28);if(_0x3909eb[_0x74d0('0xa0')]===-0x1){return _0x3909eb;}logger[_0x74d0('0x32')](util[_0x74d0('0x96')](_0x74d0('0xa1'),_0x47e5a9,_0x3909eb[_0x74d0('0x9d')]));return this[_0x74d0('0x11')][_0x74d0('0x99')](_0x47e5a9,_0x3909eb[_0x74d0('0x9d')]);};AGIVertices[_0x74d0('0x14')][_0x74d0('0x7f')]=function(_0x45b67c){return _0x45b67c&&_0x45b67c!=='0'&&_0x45b67c!=='-1'&&_0x45b67c!=='';};AGIVertices[_0x74d0('0x14')]['maxRetry']=function(_0x173595){this['createSquareDetailsReport'][_0x74d0('0xa2')](this,_0x173595,'-');_0x173595[_0x74d0('0xa3')]=_0x173595['maxRetry'];return{'code':0xc8,'result':'-'};};AGIVertices[_0x74d0('0x14')][_0x74d0('0xa4')]=function(_0x101b3d){logger['info'](util[_0x74d0('0x96')](_0x74d0('0xa5'),_0x101b3d[_0x74d0('0x3b')]));if(!this[_0x74d0('0x7f')](_0x101b3d[_0x74d0('0x5c')])){return this[_0x74d0('0x11')][_0x74d0('0xa6')](_0x74d0('0xa7'));}var _0x172543='\x22'+_0x101b3d[_0x74d0('0x5c')]+'\x22';if(this[_0x74d0('0x7f')](_0x101b3d[_0x74d0('0x76')])){_0x172543+=','+_0x101b3d[_0x74d0('0x76')];}var _0x2f434e=this['channel'][_0x74d0('0x58')](_0x74d0('0xa8'),_0x172543);if(_0x2f434e[_0x74d0('0xa0')]===-0x1){return _0x2f434e;}return this[_0x74d0('0x11')][_0x74d0('0xa6')](util[_0x74d0('0x96')]('Executed\x20command\x20MRCPSynth\x20%s',_0x172543));};AGIVertices[_0x74d0('0x14')][_0x74d0('0xa9')]=function(_0x543d41){logger[_0x74d0('0x32')](util['format'](_0x74d0('0xaa'),_0x543d41[_0x74d0('0x3b')]));if(!this[_0x74d0('0x7f')](_0x543d41[_0x74d0('0xab')])){return this['channel'][_0x74d0('0xa6')]('no\x20grammar\x20configured');}var _0x49d10d=_0x543d41[_0x74d0('0xab')];if(this[_0x74d0('0x7f')](_0x543d41[_0x74d0('0x76')])){_0x49d10d+=','+_0x543d41[_0x74d0('0x76')];}var _0xe8e3e2=this[_0x74d0('0x11')][_0x74d0('0x58')](_0x74d0('0xac'),_0x49d10d);if(_0xe8e3e2[_0x74d0('0xa0')]===-0x1){return _0xe8e3e2;}var _0x15dc80=this[_0x74d0('0x9f')](_0x74d0('0xad'),'MRCP_RECOG_CONFIDENCE');if(_0x15dc80[_0x74d0('0xa0')]===-0x1){return _0x15dc80;}var _0x2e3df4=this[_0x74d0('0x9f')](_0x74d0('0xae'),'MRCP_RECOG_TRANSCRIPT');if(_0x2e3df4['result']===-0x1){return _0x2e3df4;}var _0x49b91e=this[_0x74d0('0x9f')](_0x74d0('0xaf'),_0x74d0('0xb0'));if(_0x49b91e[_0x74d0('0xa0')]===-0x1){return _0x49b91e;}return this[_0x74d0('0x11')][_0x74d0('0xa6')](util[_0x74d0('0x96')](_0x74d0('0xb1'),_0x49d10d));};AGIVertices[_0x74d0('0x14')][_0x74d0('0xa')]=function(_0xa7b99f){logger[_0x74d0('0x32')](util[_0x74d0('0x96')](_0x74d0('0xb2'),_0xa7b99f[_0x74d0('0x3b')]));return this[_0x74d0('0x11')][_0x74d0('0xa')]([_0xa7b99f[_0x74d0('0xb3')],_0xa7b99f[_0x74d0('0xb4')]]);};AGIVertices[_0x74d0('0x14')][_0x74d0('0xb5')]=function(_0x2e4148){logger[_0x74d0('0x32')](util['format'](_0x74d0('0xb6'),_0x2e4148[_0x74d0('0x3b')]));if(this[_0x74d0('0x7f')](_0x2e4148[_0x74d0('0x64')])){logger[_0x74d0('0x32')](util[_0x74d0('0x96')](_0x74d0('0xb7'),_0x2e4148[_0x74d0('0x64')]));var _0x4b7069=this['channel']['wait'](_0x2e4148[_0x74d0('0x64')]);if(_0x4b7069[_0x74d0('0xa0')]===-0x1){return _0x4b7069;}}return this[_0x74d0('0x11')][_0x74d0('0xb5')]();};AGIVertices[_0x74d0('0x14')]['callback']=function(_0x52d857){logger[_0x74d0('0x32')](util['format'](_0x74d0('0xb8'),_0x52d857['label']));if(!this[_0x74d0('0x7f')](_0x52d857[_0x74d0('0x4c')])){return this[_0x74d0('0x11')][_0x74d0('0x30')](_0x52d857,'no\x20list\x20selected');}_0x52d857[_0x74d0('0x4d')]=moment();if(this['isConfigured'](_0x52d857[_0x74d0('0xb9')])){_0x52d857['scheduledAt']=moment()[_0x74d0('0xba')](_0x52d857[_0x74d0('0xb9')],_0x74d0('0xbb'));}if(!this[_0x74d0('0x7f')](_0x52d857['callback_priority'])){_0x52d857['callback_priority']=0x2;}this['createCmContact'][_0x74d0('0xa2')](this,_0x52d857);return this['channel'][_0x74d0('0xa6')](util[_0x74d0('0x96')]('CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s',_0x52d857[_0x74d0('0x4b')],_0x52d857['list_id'],_0x52d857[_0x74d0('0x4d')]));};AGIVertices[_0x74d0('0x14')]['custom_app']=function(_0x1364ff){logger[_0x74d0('0x32')](util[_0x74d0('0x96')](_0x74d0('0xbc'),_0x1364ff['label']));var _0x5d2237=this[_0x74d0('0x11')]['exec'](_0x1364ff[_0x74d0('0xbd')],_0x1364ff['options']);if(_0x5d2237['result']===-0x1){return _0x5d2237;}return this['channel'][_0x74d0('0xa6')](util[_0x74d0('0x96')]('Executed\x20command\x20%s\x20%s',_0x1364ff[_0x74d0('0xbd')],_0x1364ff[_0x74d0('0x76')]));};AGIVertices[_0x74d0('0x14')]['lumenvoxtts']=function(_0x4bf1ca){logger[_0x74d0('0x32')](util[_0x74d0('0x96')](_0x74d0('0xbe'),_0x4bf1ca[_0x74d0('0x3b')]));if(!this[_0x74d0('0x7f')](_0x4bf1ca[_0x74d0('0x5c')])){return this[_0x74d0('0x11')][_0x74d0('0xa6')](_0x74d0('0xa7'));}var _0x3ce3c1='\x22'+_0x4bf1ca[_0x74d0('0x5c')]+'\x22';if(this[_0x74d0('0x7f')](_0x4bf1ca[_0x74d0('0x76')])){_0x3ce3c1+=','+_0x4bf1ca[_0x74d0('0x76')];}var _0x506c78=this['channel']['exec'](_0x74d0('0xa8'),_0x3ce3c1);if(_0x506c78[_0x74d0('0xa0')]===-0x1){return _0x506c78;}return this[_0x74d0('0x11')]['noop'](util[_0x74d0('0x96')](_0x74d0('0xbf'),_0x3ce3c1));};AGIVertices[_0x74d0('0x14')][_0x74d0('0xc0')]=function(_0x3e8d54){logger[_0x74d0('0x32')](util[_0x74d0('0x96')](_0x74d0('0xc1'),_0x3e8d54[_0x74d0('0x3b')]));if(!this[_0x74d0('0x7f')](_0x3e8d54[_0x74d0('0x5c')])){return this[_0x74d0('0x11')]['noop'](_0x74d0('0xa7'));}var _0xeb5e71='\x22'+_0x3e8d54['text']+'\x22';if(this[_0x74d0('0x7f')](_0x3e8d54['options'])){_0xeb5e71+=','+_0x3e8d54[_0x74d0('0x76')];}var _0x5b8c2d=this[_0x74d0('0x11')]['exec'](_0x74d0('0xa8'),_0xeb5e71);if(_0x5b8c2d[_0x74d0('0xa0')]===-0x1){return _0x5b8c2d;}return this[_0x74d0('0x11')][_0x74d0('0xa6')](util[_0x74d0('0x96')](_0x74d0('0xbf'),_0xeb5e71));};AGIVertices[_0x74d0('0x14')]['lumenvoxasr']=function(_0x463025){logger[_0x74d0('0x32')](util[_0x74d0('0x96')](_0x74d0('0xc2'),_0x463025[_0x74d0('0x3b')]));if(!this[_0x74d0('0x7f')](_0x463025['grammar'])){return this['channel'][_0x74d0('0xa6')]('no\x20grammar\x20configured');}var _0x930553=_0x463025[_0x74d0('0xab')];if(this['isConfigured'](_0x463025[_0x74d0('0x76')])){_0x930553+=','+_0x463025[_0x74d0('0x76')];}var _0xbabe30=this[_0x74d0('0x11')]['exec'](_0x74d0('0xac'),_0x930553);if(_0xbabe30[_0x74d0('0xa0')]===-0x1){return _0xbabe30;}var _0x87f144=this[_0x74d0('0x9f')]('RECOG_CONFIDENCE()',_0x74d0('0xc3'));if(_0x87f144['result']===-0x1){return _0x87f144;}var _0x545f0d=this[_0x74d0('0x9f')](_0x74d0('0xae'),'LUMENVOX_ASR_TRANSCRIPT');if(_0x545f0d['result']===-0x1){return _0x545f0d;}var _0xa87f51=this[_0x74d0('0x9f')](_0x74d0('0xaf'),_0x74d0('0xc4'));if(_0xa87f51[_0x74d0('0xa0')]===-0x1){return _0xa87f51;}return this[_0x74d0('0x11')]['noop'](util['format'](_0x74d0('0xb1'),_0x930553));};AGIVertices['prototype'][_0x74d0('0xc5')]=function(_0x36e80a){logger[_0x74d0('0x32')](util['format'](_0x74d0('0xc6'),_0x36e80a[_0x74d0('0x3b')]));if(!this[_0x74d0('0x7f')](_0x36e80a['grammar'])){return this['channel']['noop']('no\x20grammar\x20configured');}var _0x30ce0c=_0x36e80a['grammar'];if(this[_0x74d0('0x7f')](_0x36e80a[_0x74d0('0x76')])){_0x30ce0c+=','+_0x36e80a[_0x74d0('0x76')];}var _0x433301=this[_0x74d0('0x11')][_0x74d0('0x58')](_0x74d0('0xac'),_0x30ce0c);if(_0x433301[_0x74d0('0xa0')]===-0x1){return _0x433301;}var _0xd07159=this[_0x74d0('0x9f')]('RECOG_CONFIDENCE()',_0x74d0('0xc7'));if(_0xd07159[_0x74d0('0xa0')]===-0x1){return _0xd07159;}var _0x5a3b4d=this['getAndSetVariable'](_0x74d0('0xae'),'SESTEK_ASR_TRANSCRIPT');if(_0x5a3b4d['result']===-0x1){return _0x5a3b4d;}var _0x1f4166=this[_0x74d0('0x9f')]('RECOG_INSTANCE()','SESTEK_ASR_INSTANCE');if(_0x1f4166[_0x74d0('0xa0')]===-0x1){return _0x1f4166;}return this['channel'][_0x74d0('0xa6')](util[_0x74d0('0x96')]('Executed\x20command\x20MRCPRecog\x20%s',_0x30ce0c));};AGIVertices[_0x74d0('0x14')][_0x74d0('0xc8')]=function(_0xcb257b){logger[_0x74d0('0x32')](util[_0x74d0('0x96')](_0x74d0('0xc9'),_0xcb257b[_0x74d0('0x3b')]));if(!this[_0x74d0('0x7f')](_0xcb257b[_0x74d0('0xca')])){return this['channel'][_0x74d0('0x30')](_0xcb257b,'no\x20database\x20selected');}var _0x47c2f1=this[_0x74d0('0x1c')]['sync'](this,_0xcb257b[_0x74d0('0xca')]);if(!_0x47c2f1){return this[_0x74d0('0x11')]['error'](_0xcb257b,_0x74d0('0xcb'));}if(!this[_0x74d0('0x7f')](_0xcb257b['query'])){return this['channel'][_0x74d0('0x30')](_0xcb257b,_0x74d0('0xcc'));}var _0x2e8c5d=_0xcb257b[_0x74d0('0x34')][_0x74d0('0xcd')](/(\r\n|\n|\r)/gm,'\x20');this[_0x74d0('0x11')][_0x74d0('0xa6')](util['format'](_0x74d0('0xce'),_0x2e8c5d));var _0x87e12a=this['getQueryOdbc']['sync'](this,_0x47c2f1,_0x2e8c5d);this[_0x74d0('0x39')]['sync'](this,_0xcb257b,_0x2e8c5d);if(!this['isConfigured'](_0xcb257b[_0x74d0('0xcf')])){return this['channel'][_0x74d0('0xa6')](_0x74d0('0xd0'));}var _0xacc285=this[_0x74d0('0x9c')][_0x74d0('0xa2')](this,_0xcb257b['variable_id']);if(!_0xacc285){return this[_0x74d0('0x11')]['error'](_0xcb257b,_0x74d0('0xd1'));}var _0x27c311=this;_0x87e12a['forEach'](function(_0x442485,_0x5a06cc){Object[_0x74d0('0xd2')](_0x442485)[_0x74d0('0xd3')](function(_0x4fe889){_0x27c311[_0x74d0('0x11')]['setVariable'](util[_0x74d0('0x96')](_0x74d0('0xd4'),_0xacc285,_0x5a06cc,_0x4fe889),_0x442485[_0x4fe889]);});});this[_0x74d0('0x11')][_0x74d0('0x99')](util[_0x74d0('0x96')](_0x74d0('0xd5'),_0xacc285),_0x87e12a['length']);return this[_0x74d0('0x11')]['noop'](util[_0x74d0('0x96')](_0x74d0('0xd6'),_0xacc285));};AGIVertices[_0x74d0('0x14')][_0x74d0('0xd7')]=function(_0x1d8f2f){logger['debug'](util[_0x74d0('0x96')](_0x74d0('0xd8'),_0x1d8f2f[_0x74d0('0x3b')]));if(!this['isConfigured'](_0x1d8f2f[_0x74d0('0xd9')])){return this[_0x74d0('0x11')]['error'](_0x1d8f2f,_0x74d0('0xda'));}var _0x415be8=this[_0x74d0('0x1f')][_0x74d0('0xa2')](this,_0x1d8f2f[_0x74d0('0xd9')]);if(!_0x415be8){return this[_0x74d0('0x11')]['error'](_0x1d8f2f,_0x74d0('0xdb'));}var _0x1069ed=this[_0x74d0('0x11')]['exec'](_0x74d0('0xdc'),[util[_0x74d0('0x96')]('SIP/%s',_0x415be8),_0x1d8f2f[_0x74d0('0x64')],_0x1d8f2f['opts'],_0x1d8f2f[_0x74d0('0x62')]]);if(_0x1069ed[_0x74d0('0xa0')]===-0x1){return _0x1069ed;}return this[_0x74d0('0x11')][_0x74d0('0xa6')](util['format']('Executed\x20command\x20%s',_0x74d0('0xdc')));};AGIVertices[_0x74d0('0x14')][_0x74d0('0xdd')]=function(_0x296242){logger[_0x74d0('0x32')](util[_0x74d0('0x96')](_0x74d0('0xde'),_0x296242[_0x74d0('0x3b')]));if(!this['isConfigured'](_0x296242['key'])){return this[_0x74d0('0x11')][_0x74d0('0xa6')](_0x74d0('0xdf'));}if(!this[_0x74d0('0x7f')](_0x296242[_0x74d0('0x5c')])){return this[_0x74d0('0x11')]['noop']('no\x20text\x20configured');}this[_0x74d0('0x11')]['bot']=!![];this[_0x74d0('0x39')](_0x296242);this[_0x74d0('0x44')](_0x296242[_0x74d0('0x5c')],'in');this['channel']['noop'](util[_0x74d0('0x96')](_0x74d0('0xe0'),_0x296242['text']));var _0x22a4ef=this[_0x74d0('0x77')][_0x74d0('0xa2')](this,_0x296242);if(_0x22a4ef){for(var _0x57edfc in _0x22a4ef){if(_0x22a4ef['hasOwnProperty'](_0x57edfc)){this[_0x74d0('0x11')][_0x74d0('0x99')](util[_0x74d0('0x96')](_0x74d0('0xe1'),_0x57edfc['toUpperCase']()),_0x22a4ef[_0x57edfc]);}}this[_0x74d0('0x44')](_0x22a4ef[_0x74d0('0xe2')],_0x74d0('0xe3'));return this[_0x74d0('0x11')][_0x74d0('0xa6')](util['format']('Dialogflow\x20Result\x20%s',_0x22a4ef[_0x74d0('0xe2')]));}return this[_0x74d0('0x11')][_0x74d0('0x30')](_0x296242,_0x74d0('0xe4'));};AGIVertices[_0x74d0('0x14')]['sesteknda']=function(_0x2e0e77){logger[_0x74d0('0x32')](util['format'](_0x74d0('0xe5'),_0x2e0e77[_0x74d0('0x3b')]));if(!this[_0x74d0('0x7f')](_0x2e0e77['ndauth_url'])){return this['channel'][_0x74d0('0xa6')](_0x74d0('0xe6'));}if(!this[_0x74d0('0x7f')](_0x2e0e77[_0x74d0('0xe7')])){return this[_0x74d0('0x11')][_0x74d0('0xa6')](_0x74d0('0xe8'));}if(!this[_0x74d0('0x7f')](_0x2e0e77[_0x74d0('0xe9')])){return this[_0x74d0('0x11')][_0x74d0('0xa6')](_0x74d0('0xea'));}if(!this['isConfigured'](_0x2e0e77[_0x74d0('0xeb')])){return this[_0x74d0('0x11')]['noop']('no\x20text\x20configured');}this[_0x74d0('0x11')][_0x74d0('0xec')]=!![];this[_0x74d0('0x39')](_0x2e0e77);this[_0x74d0('0x44')](_0x2e0e77[_0x74d0('0x5c')],'in');this[_0x74d0('0x11')][_0x74d0('0xa6')](util['format']('Trying\x20SestekNDA:\x20%s',_0x2e0e77[_0x74d0('0x5c')]));var _0x12dd07=this[_0x74d0('0x78')][_0x74d0('0xa2')](this,_0x2e0e77);if(_0x12dd07){for(var _0x539961 in _0x12dd07){if(_0x12dd07['hasOwnProperty'](_0x539961)){this[_0x74d0('0x11')]['setVariable'](util[_0x74d0('0x96')](_0x74d0('0xed'),_0x539961[_0x74d0('0x68')]()),_0x12dd07[_0x539961]);}}this[_0x74d0('0x44')](_0x12dd07[_0x74d0('0xe2')],'out');if(_0x12dd07['audiofile']){this[_0x74d0('0x11')][_0x74d0('0xa6')](util[_0x74d0('0x96')](_0x74d0('0xee'),_0x12dd07[_0x74d0('0xef')]));var _0x3f574e=this[_0x74d0('0x11')][_0x74d0('0xf0')](_0x12dd07[_0x74d0('0xef')]);try{fs[_0x74d0('0xf1')](_0x12dd07[_0x74d0('0xef')]+_0x74d0('0xf2'));}catch(_0xfa5e54){logger['error'](_0xfa5e54);}return _0x3f574e;}else{return this[_0x74d0('0x11')][_0x74d0('0xa6')](util[_0x74d0('0x96')](_0x74d0('0xf3'),_0x12dd07['speech']));}}return this[_0x74d0('0x11')][_0x74d0('0x30')](_0x2e0e77,_0x74d0('0xf4'));};AGIVertices[_0x74d0('0x14')][_0x74d0('0xf5')]=function(_0x1c4d0e){logger[_0x74d0('0x32')](util[_0x74d0('0x96')](_0x74d0('0xf6'),_0x1c4d0e[_0x74d0('0x3b')]));return this['channel'][_0x74d0('0xa6')](_0x74d0('0xf5'));};AGIVertices['prototype']['ext_dial']=function(_0x4161f8){logger['info'](util['format'](_0x74d0('0xf7'),_0x4161f8[_0x74d0('0x3b')]));var _0x3fc982='';if(_0x4161f8[_0x74d0('0xf8')]){if(!this[_0x74d0('0x7f')](_0x4161f8[_0x74d0('0xf8')])){return this['channel']['error'](_0x4161f8,'no\x20trunk\x20selected');}else{var _0x588d7f=parseInt(_0x4161f8[_0x74d0('0xf8')],0xa);if(isNaN(_0x588d7f)){_0x3fc982=_0x4161f8[_0x74d0('0xf8')];}else{_0x3fc982=this[_0x74d0('0x20')]['sync'](this,_0x4161f8[_0x74d0('0xf8')]);if(!_0x3fc982){return this[_0x74d0('0x11')][_0x74d0('0x30')](_0x4161f8,_0x74d0('0xf9'));}}}}else if(_0x4161f8[_0x74d0('0xfa')]){_0x3fc982=_0x4161f8[_0x74d0('0xfa')];}else{return this[_0x74d0('0x11')][_0x74d0('0x30')](_0x4161f8,'no\x20trunk\x20selected');}var _0x1acb28=this[_0x74d0('0x11')][_0x74d0('0x58')](_0x74d0('0xdc'),[util['format'](_0x74d0('0xfb'),_0x3fc982,_0x4161f8[_0x74d0('0x4b')]),_0x4161f8[_0x74d0('0x64')],_0x4161f8['opts'],_0x4161f8['url']]);if(_0x1acb28[_0x74d0('0xa0')]===-0x1){return _0x1acb28;}return this['channel'][_0x74d0('0xa6')](util['format'](_0x74d0('0xfc'),_0x74d0('0xdc')));};AGIVertices[_0x74d0('0x14')]['finally']=function(_0x4f1c69){logger['info'](util[_0x74d0('0x96')](_0x74d0('0xfd'),_0x4f1c69[_0x74d0('0x3b')]));return this[_0x74d0('0x11')][_0x74d0('0xa6')](_0x74d0('0xfe'));};AGIVertices['prototype'][_0x74d0('0xf')]=function(_0x28490f){logger[_0x74d0('0x32')](util[_0x74d0('0x96')]('Enter\x20in\x20GETDIGITS\x20(%s)\x20block',_0x28490f[_0x74d0('0x3b')]));if(_0x28490f['retry']===0x0){return this[_0x74d0('0xff')](_0x28490f);}_0x28490f[_0x74d0('0xa3')]-=0x1;if(!this[_0x74d0('0x7f')](_0x28490f['file_id'])){return this[_0x74d0('0x11')][_0x74d0('0x30')](_0x28490f,'no\x20file\x20audio\x20selected');}var _0x33e498=this[_0x74d0('0x21')][_0x74d0('0xa2')](this,_0x28490f[_0x74d0('0x100')]);if(!_0x33e498){return this['channel'][_0x74d0('0x30')](_0x28490f,_0x74d0('0x101'));}if(!this[_0x74d0('0x7f')](_0x28490f['variable_id'])){return this[_0x74d0('0x11')]['error']('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x1b7554=this[_0x74d0('0x11')][_0x74d0('0x102')](_0x33e498,_0x28490f['response'],_0x28490f['maxdigit']);var _0x15a930=_0x1b7554['result']?_0x1b7554[_0x74d0('0xa0')][_0x74d0('0x9e')]():'';logger[_0x74d0('0x32')](_0x74d0('0x103'),JSON['stringify'](_0x1b7554));if(_0x1b7554['result']===-0x1){this[_0x74d0('0x39')]['sync'](this,_0x28490f,_0x15a930);return _0x1b7554;}else if(_0x1b7554[_0x74d0('0x9d')]==='timeout'){_0x1b7554[_0x74d0('0xa0')]=_0x15a930[_0x74d0('0x98')]>=parseInt(_0x28490f[_0x74d0('0x104')])?'x':'i';}else{_0x1b7554['result']=_0x15a930['length']>=parseInt(_0x28490f[_0x74d0('0x104')])&&_0x15a930[_0x74d0('0x98')]<=parseInt(_0x28490f['maxdigit'])?'x':'i';}var _0x8eda98=this[_0x74d0('0x9c')]['sync'](this,_0x28490f[_0x74d0('0xcf')]);if(!_0x8eda98){return this[_0x74d0('0x11')][_0x74d0('0x30')](_0x28490f,'no\x20variable\x20found');}this['channel'][_0x74d0('0x99')](_0x8eda98,_0x15a930);if(this[_0x74d0('0x7f')](_0x28490f[_0x74d0('0x105')])){var _0x1ca19c=parseInt(_0x28490f['hiddendigitsnum'],0xa);var _0xc09f8b=rs[_0x74d0('0x106')]({'charset':'*','length':_0x1ca19c});var _0x48dfa3=_0x15a930[_0x74d0('0x98')];if(_0x48dfa3>0x0){if(_0x48dfa3>_0x1ca19c){this[_0x74d0('0x39')][_0x74d0('0xa2')](this,_0x28490f,_0x28490f[_0x74d0('0x107')]==='first'?_0xc09f8b+_0x15a930['substr'](_0x1ca19c):_0x15a930[_0x74d0('0x108')](0x0,_0x48dfa3-_0x1ca19c)+_0xc09f8b);}else{this[_0x74d0('0x39')][_0x74d0('0xa2')](this,_0x28490f,rs[_0x74d0('0x106')]({'charset':'*','length':_0x48dfa3}));}}else{this[_0x74d0('0x39')][_0x74d0('0xa2')](this,_0x28490f,'');}}else{this[_0x74d0('0x39')][_0x74d0('0xa2')](this,_0x28490f,_0x15a930);}return _0x1b7554;};AGIVertices[_0x74d0('0x14')][_0x74d0('0x10')]=function(_0x63a84f){logger[_0x74d0('0x32')](util[_0x74d0('0x96')](_0x74d0('0x109'),_0x63a84f[_0x74d0('0x3b')]));return this['getdigits'](_0x63a84f);};AGIVertices[_0x74d0('0x14')][_0x74d0('0x10a')]=function(_0x1f9236){logger[_0x74d0('0x32')](util[_0x74d0('0x96')](_0x74d0('0x10b'),_0x1f9236[_0x74d0('0x3b')]));this[_0x74d0('0x39')][_0x74d0('0xa2')](this,_0x1f9236,_0x1f9236[_0x74d0('0x10c')]);return this[_0x74d0('0x11')][_0x74d0('0xa6')](util[_0x74d0('0x96')]('GOAL\x20%s',_0x1f9236[_0x74d0('0x10c')]));};AGIVertices[_0x74d0('0x14')]['awspolly']=function(_0x294d3c){logger['info'](util[_0x74d0('0x96')](_0x74d0('0x10d'),_0x294d3c[_0x74d0('0x3b')]));if(!this['isConfigured'](_0x294d3c['aws_access_key_id'])||!this['isConfigured'](_0x294d3c[_0x74d0('0x88')])){return this[_0x74d0('0x11')][_0x74d0('0xa6')](_0x74d0('0x10e'));}if(!this[_0x74d0('0x7f')](_0x294d3c[_0x74d0('0x5c')])){return this[_0x74d0('0x11')][_0x74d0('0xa6')]('no\x20text\x20configured');}this[_0x74d0('0x11')][_0x74d0('0xa6')](util[_0x74d0('0x96')]('Trying\x20aws\x20Polly\x20%s',_0x294d3c['text']));var _0xfdafb6=this[_0x74d0('0x81')][_0x74d0('0xa2')](this,_0x294d3c);if(_0xfdafb6){this['channel'][_0x74d0('0xa6')](util[_0x74d0('0x96')](_0x74d0('0x10f'),_0xfdafb6));var _0x2f464e=this['channel'][_0x74d0('0xf0')](_0xfdafb6);try{fs[_0x74d0('0xf1')](_0xfdafb6+'.wav');}catch(_0x43a22b){logger['error'](_0x43a22b);}return _0x2f464e;}return this[_0x74d0('0x11')][_0x74d0('0x30')](_0x294d3c,_0x74d0('0x110'));};AGIVertices[_0x74d0('0x14')][_0x74d0('0x111')]=function(_0x5a43d1){logger[_0x74d0('0x32')](util[_0x74d0('0x96')]('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0x5a43d1[_0x74d0('0x3b')]));if(!this[_0x74d0('0x7f')](_0x5a43d1[_0x74d0('0x87')])||!this[_0x74d0('0x7f')](_0x5a43d1['aws_secret_access_key'])){return this[_0x74d0('0x11')]['noop']('no\x20valid\x20credentials\x20configured');}if(!this[_0x74d0('0x7f')](_0x5a43d1[_0x74d0('0x8a')])){return this[_0x74d0('0x11')][_0x74d0('0xa6')]('no\x20bot\x20name\x20configured');}if(!this[_0x74d0('0x7f')](_0x5a43d1['text'])){return this['channel'][_0x74d0('0xa6')](_0x74d0('0xa7'));}this[_0x74d0('0x11')][_0x74d0('0xec')]=!![];this['createSquareDetailsReport'](_0x5a43d1);this[_0x74d0('0x44')](_0x5a43d1[_0x74d0('0x5c')],'in');this[_0x74d0('0x11')][_0x74d0('0xa6')](util[_0x74d0('0x96')](_0x74d0('0x112'),_0x5a43d1[_0x74d0('0x5c')]));var _0x3c9368=this[_0x74d0('0x86')][_0x74d0('0xa2')](this,_0x5a43d1);if(_0x3c9368){for(var _0x3eb335 in _0x3c9368){if(_0x3c9368['hasOwnProperty'](_0x3eb335)&&_[_0x74d0('0x90')](_0x3c9368[_0x3eb335])){this[_0x74d0('0x11')][_0x74d0('0x99')](util[_0x74d0('0x96')](_0x74d0('0x113'),_0x3eb335['toUpperCase']()),_0x3c9368[_0x3eb335]);}}if(_[_0x74d0('0x47')](_0x3c9368['message'])){return this[_0x74d0('0x11')][_0x74d0('0xa6')](_0x74d0('0x114'));}else{this[_0x74d0('0x44')](_0x3c9368[_0x74d0('0x74')],_0x74d0('0xe3'));return this[_0x74d0('0x11')][_0x74d0('0xa6')](util['format'](_0x74d0('0x115'),_0x3c9368[_0x74d0('0x74')]));}}return this[_0x74d0('0x11')]['error'](_0x5a43d1,_0x74d0('0x116'));};AGIVertices[_0x74d0('0x14')][_0x74d0('0x117')]=function(_0x98b83a){logger[_0x74d0('0x32')](util[_0x74d0('0x96')](_0x74d0('0x118'),_0x98b83a[_0x74d0('0x3b')],_0x98b83a['timeout']));if(!this[_0x74d0('0x7f')](_0x98b83a['key'])){return this['channel'][_0x74d0('0xa6')](_0x74d0('0xdf'));}var _0x3a9bca='wav';var _0x49eca0=util[_0x74d0('0x96')](_0x74d0('0x119'),FILES_PATH,rs[_0x74d0('0x106')](0x4));var _0x54361e=util[_0x74d0('0x96')](_0x74d0('0x97'),_0x49eca0,_0x3a9bca);var _0x27eee0=!![];if(_0x98b83a[_0x74d0('0x11a')]==='NOBEEP'){_0x27eee0=![];}var _0x10b949=this[_0x74d0('0x11')]['recordFile'](_0x49eca0,_0x3a9bca,_0x98b83a[_0x74d0('0x11b')],_0x98b83a[_0x74d0('0x64')],undefined,_0x27eee0);if(_0x10b949[_0x74d0('0xa0')]!==-0x1){this[_0x74d0('0x11')][_0x74d0('0xa6')](util['format'](_0x74d0('0x11c'),_0x54361e));var _0x3d555a=this[_0x74d0('0x8b')][_0x74d0('0xa2')](this,_0x98b83a,_0x54361e);if(_0x3d555a){for(var _0x6a3bf9 in _0x3d555a){if(_0x3d555a[_0x74d0('0x8f')](_0x6a3bf9)){this[_0x74d0('0x11')][_0x74d0('0x99')](util['format'](_0x74d0('0x11d'),_0x6a3bf9[_0x74d0('0x68')]()),_0x3d555a[_0x6a3bf9]);}}return this['channel'][_0x74d0('0xa6')](util['format'](_0x74d0('0x11e'),JSON[_0x74d0('0x71')](_0x3d555a)));}}return _0x10b949;};AGIVertices[_0x74d0('0x14')]['tildeasr']=function(_0x1c3483){logger[_0x74d0('0x32')](util[_0x74d0('0x96')]('Enter\x20in\x20TILDEASR\x20(%s)\x20block',_0x1c3483[_0x74d0('0x3b')]));if(!this[_0x74d0('0x7f')](_0x1c3483[_0x74d0('0x11f')])){return this['channel'][_0x74d0('0xa6')]('no\x20appid\x20configured');}if(!this[_0x74d0('0x7f')](_0x1c3483[_0x74d0('0x8c')])){return this[_0x74d0('0x11')][_0x74d0('0xa6')](_0x74d0('0x120'));}var _0x5881a6='wav';var _0x28a1c0=util[_0x74d0('0x96')](_0x74d0('0x119'),FILES_PATH,rs[_0x74d0('0x106')](0x4));var _0x3a15e5=util[_0x74d0('0x96')](_0x74d0('0x97'),_0x28a1c0,_0x5881a6);var _0x44f111=!![];if(_0x1c3483[_0x74d0('0x11a')]===_0x74d0('0x121')){_0x44f111=![];}var _0x40a529=this['channel']['recordFile'](_0x28a1c0,_0x5881a6,_0x1c3483[_0x74d0('0x11b')],_0x1c3483[_0x74d0('0x64')],undefined,_0x44f111);if(_0x40a529[_0x74d0('0xa0')]!==-0x1){this[_0x74d0('0x11')][_0x74d0('0xa6')](util[_0x74d0('0x96')](_0x74d0('0x122'),_0x3a15e5));var _0x32340b=this['tildeASR'][_0x74d0('0xa2')](this,_0x1c3483,_0x3a15e5);if(_0x32340b){for(var _0x1a4985 in _0x32340b){if(_0x32340b[_0x74d0('0x8f')](_0x1a4985)){this[_0x74d0('0x11')][_0x74d0('0x99')](util['format'](_0x74d0('0x123'),_0x1a4985[_0x74d0('0x68')]()),_0x32340b[_0x1a4985]);}}return this['channel'][_0x74d0('0xa6')](util['format']('TildeASR\x20Result\x20%s',JSON[_0x74d0('0x71')](_0x32340b)));}}return _0x40a529;};AGIVertices[_0x74d0('0x14')][_0x74d0('0x124')]=function(_0x244a72){logger['info'](util[_0x74d0('0x96')]('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x244a72[_0x74d0('0x3b')]));return this['channel']['continueAt'](_0x244a72[_0x74d0('0x125')],_0x244a72[_0x74d0('0x126')],_0x244a72[_0x74d0('0x40')]);};AGIVertices[_0x74d0('0x14')][_0x74d0('0x127')]=function(_0x2aa667){logger['info'](util[_0x74d0('0x96')](_0x74d0('0x128'),_0x2aa667[_0x74d0('0x3b')]));if(!this['isConfigured'](_0x2aa667['condition'])){return this[_0x74d0('0x11')][_0x74d0('0x30')](_0x2aa667,_0x74d0('0x129'));}try{var _0x1e5016=eval(_0x2aa667[_0x74d0('0x12a')])?_0x74d0('0x12b'):_0x74d0('0x12c');this[_0x74d0('0x11')][_0x74d0('0xa6')](util['format']('EVAL\x20CONDITION\x20%s\x20%s',_0x2aa667[_0x74d0('0x12a')],_0x1e5016));return{'code':0xc8,'result':_0x1e5016};}catch(_0x4ae017){return{'code':0xc8,'result':'false'};}};AGIVertices[_0x74d0('0x14')]['gotoiftime']=function(_0x3b8daf){logger['info'](util[_0x74d0('0x96')](_0x74d0('0x12d'),_0x3b8daf['label']));if(!this[_0x74d0('0x7f')](_0x3b8daf[_0x74d0('0x12e')])){return this[_0x74d0('0x11')]['error'](_0x3b8daf,_0x74d0('0x12f'));}var _0x59f791=this[_0x74d0('0x28')][_0x74d0('0xa2')](this,_0x3b8daf['interval_id']);if(!_0x59f791){return this[_0x74d0('0x11')][_0x74d0('0x30')](_0x3b8daf,'no\x20intervals\x20found');}for(var _0x1218ed=0x0;_0x1218ed<_0x59f791[_0x74d0('0x98')];_0x1218ed+=0x1){var _0x19203c=this[_0x74d0('0x11')][_0x74d0('0x9c')](util['format'](_0x74d0('0x130'),_0x59f791[_0x1218ed]));if(_0x19203c[_0x74d0('0xa0')]===-0x1){return _0x19203c;}logger[_0x74d0('0x32')](util[_0x74d0('0x96')](_0x74d0('0x131'),_0x59f791[_0x1218ed],_0x19203c[_0x74d0('0x9d')]));if(_0x19203c[_0x74d0('0x9d')]===_0x74d0('0x12b')){logger[_0x74d0('0x32')](util[_0x74d0('0x96')]('IFTIME\x20%s\x20%s',_0x59f791[_0x1218ed],'true'));this[_0x74d0('0x11')][_0x74d0('0xa6')](util[_0x74d0('0x96')](_0x74d0('0x131'),_0x59f791[_0x1218ed],_0x74d0('0x12b')));return{'code':0xc8,'result':_0x74d0('0x12b')};}else{logger['info'](util['format'](_0x74d0('0x131'),_0x59f791[_0x1218ed],_0x74d0('0x12c')));this['channel'][_0x74d0('0xa6')](util[_0x74d0('0x96')](_0x74d0('0x131'),_0x59f791[_0x1218ed],_0x74d0('0x12c')));}}return{'code':0xc8,'result':_0x74d0('0x12c')};};AGIVertices[_0x74d0('0x14')]['hangup']=function(_0x5b5f76){logger['info'](util[_0x74d0('0x96')](_0x74d0('0x132'),_0x5b5f76[_0x74d0('0x3b')]));return this[_0x74d0('0x11')][_0x74d0('0x133')]();};AGIVertices['prototype']['ispeechasr']=function(_0x1cf333){logger[_0x74d0('0x32')](util[_0x74d0('0x96')](_0x74d0('0x134'),_0x1cf333[_0x74d0('0x3b')]));if(!this[_0x74d0('0x7f')](_0x1cf333[_0x74d0('0x7a')])){return this[_0x74d0('0x11')][_0x74d0('0xa6')](_0x74d0('0xdf'));}var _0x124193=_0x74d0('0x135');var _0x595516=util[_0x74d0('0x96')](_0x74d0('0x119'),FILES_PATH,rs[_0x74d0('0x106')](0x4));var _0x543f14=util[_0x74d0('0x96')](_0x74d0('0x97'),_0x595516,_0x124193);var _0x17c904=!![];if(_0x1cf333[_0x74d0('0x11a')]==='NOBEEP'){_0x17c904=![];}var _0x45eb76=this['channel']['recordFile'](_0x595516,_0x124193,_0x1cf333[_0x74d0('0x11b')],_0x1cf333['timeout'],undefined,_0x17c904);if(_0x45eb76[_0x74d0('0xa0')]!==-0x1){this[_0x74d0('0x11')][_0x74d0('0xa6')](util[_0x74d0('0x96')]('ispeech\x20%s\x20file\x20created',_0x543f14));var _0xdc563b=this[_0x74d0('0x7d')][_0x74d0('0xa2')](this,_0x1cf333,_0x543f14);if(_0xdc563b){for(var _0x5eb283 in _0xdc563b){if(_0xdc563b[_0x74d0('0x8f')](_0x5eb283)){this[_0x74d0('0x11')][_0x74d0('0x99')](util[_0x74d0('0x96')]('ISPEECH_ASR_%s',_0x5eb283[_0x74d0('0x68')]()),_0xdc563b[_0x5eb283]);}}return this[_0x74d0('0x11')][_0x74d0('0xa6')](util[_0x74d0('0x96')](_0x74d0('0x136'),JSON['stringify'](_0xdc563b)));}}return _0x45eb76;};AGIVertices[_0x74d0('0x14')][_0x74d0('0x137')]=function(_0x5f4992){logger[_0x74d0('0x32')](util[_0x74d0('0x96')]('Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block',_0x5f4992[_0x74d0('0x3b')]));if(!this[_0x74d0('0x7f')](_0x5f4992[_0x74d0('0x7a')])){return this[_0x74d0('0x11')][_0x74d0('0xa6')]('no\x20key\x20configured');}if(!this['isConfigured'](_0x5f4992[_0x74d0('0x5c')])){return this['channel'][_0x74d0('0xa6')](_0x74d0('0xa7'));}this['channel'][_0x74d0('0xa6')](util[_0x74d0('0x96')](_0x74d0('0x138'),_0x5f4992[_0x74d0('0x5c')]));var _0x114741=this[_0x74d0('0x79')][_0x74d0('0xa2')](this,_0x5f4992);if(_0x114741){this[_0x74d0('0x11')][_0x74d0('0xa6')](util[_0x74d0('0x96')]('ispeech\x20%s\x20file\x20created',_0x114741));var _0x4f7d56=this['channel']['streamFile'](_0x114741,_0x5f4992[_0x74d0('0x11b')]);try{fs[_0x74d0('0xf1')](_0x114741+_0x74d0('0xf2'));}catch(_0x4f8d24){logger[_0x74d0('0x30')](_0x4f8d24);}return _0x4f7d56;}return this[_0x74d0('0x11')][_0x74d0('0x30')](_0x5f4992,'ispeech\x20TTS\x20is\x20unreachable');};AGIVertices[_0x74d0('0x14')][_0x74d0('0x139')]=function(_0x426cc9){logger['info'](util[_0x74d0('0x96')]('Enter\x20in\x20LOGIN\x20(%s)\x20block',_0x426cc9['label']));if(!this[_0x74d0('0x7f')](_0x426cc9[_0x74d0('0x13a')])){return this[_0x74d0('0x11')]['error'](_0x426cc9,_0x74d0('0x13b'));}logger['info'](util[_0x74d0('0x96')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x74d0('0x11')][_0x74d0('0x3d')],_0x426cc9[_0x74d0('0x13a')]));var _0x4aaa3a=this[_0x74d0('0x13c')][_0x74d0('0xa2')](this,_0x426cc9['findBy']);if(_0x4aaa3a){logger[_0x74d0('0x32')](util['format'](_0x74d0('0x13d'),this[_0x74d0('0x11')]['callerid'],_0x426cc9['findBy']));this[_0x74d0('0x11')][_0x74d0('0xa6')](util[_0x74d0('0x96')]('AGENT\x20%s\x20FOUND\x20BY',this['channel']['callerid'],_0x426cc9[_0x74d0('0x13a')]));return{'code':0xc8,'result':_0x74d0('0x13e')};}else{logger[_0x74d0('0x32')](util[_0x74d0('0x96')](_0x74d0('0x13f'),this['channel'][_0x74d0('0x3d')],_0x426cc9[_0x74d0('0x13a')]));this[_0x74d0('0x11')][_0x74d0('0xa6')](util[_0x74d0('0x96')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x74d0('0x11')][_0x74d0('0x3d')],_0x426cc9[_0x74d0('0x13a')]));return{'code':0xc8,'result':_0x74d0('0x140')};}};AGIVertices[_0x74d0('0x14')][_0x74d0('0x141')]=function(_0xce2f8b){logger['info'](util[_0x74d0('0x96')](_0x74d0('0x142'),_0xce2f8b[_0x74d0('0x3b')]));if(!this['isConfigured'](_0xce2f8b[_0x74d0('0x13a')])){return this[_0x74d0('0x11')]['error'](_0xce2f8b,'no\x20find\x20by\x20configured');}logger[_0x74d0('0x32')](util[_0x74d0('0x96')](_0x74d0('0x143'),this['channel'][_0x74d0('0x3d')],_0xce2f8b[_0x74d0('0x13a')]));var _0x3841b6=this[_0x74d0('0x54')][_0x74d0('0xa2')](this,_0xce2f8b[_0x74d0('0x13a')]);if(_0x3841b6){logger[_0x74d0('0x32')](util[_0x74d0('0x96')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x74d0('0x11')][_0x74d0('0x3d')],_0xce2f8b[_0x74d0('0x13a')]));this['channel']['noop'](util[_0x74d0('0x96')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x74d0('0x11')]['callerid'],_0xce2f8b[_0x74d0('0x13a')]));return{'code':0xc8,'result':_0x74d0('0x13e')};}else{logger[_0x74d0('0x32')](util[_0x74d0('0x96')](_0x74d0('0x13f'),this['channel']['callerid'],_0xce2f8b[_0x74d0('0x13a')]));this[_0x74d0('0x11')]['noop'](util[_0x74d0('0x96')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0x74d0('0x3d')],_0xce2f8b['findBy']));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x74d0('0x14')][_0x74d0('0x144')]=function(_0x235991){logger[_0x74d0('0x32')](util[_0x74d0('0x96')]('Enter\x20in\x20MATH\x20(%s)\x20block',_0x235991[_0x74d0('0x3b')]));if(!this[_0x74d0('0x7f')](_0x235991['operation'])){return this['channel'][_0x74d0('0x30')](_0x235991,'no\x20operation\x20configured');}this[_0x74d0('0x11')][_0x74d0('0xa6')](util[_0x74d0('0x96')](_0x74d0('0x145'),_0x235991[_0x74d0('0x146')]));var _0xcbd898=eval(_0x235991[_0x74d0('0x146')]);if(!this[_0x74d0('0x7f')](_0x235991[_0x74d0('0xcf')])){return this['channel'][_0x74d0('0xa6')](_0x74d0('0xd0'));}var _0xf351e4=this[_0x74d0('0x9c')][_0x74d0('0xa2')](this,_0x235991[_0x74d0('0xcf')]);if(!_0xf351e4){return this[_0x74d0('0x11')][_0x74d0('0x30')](_0x235991,_0x74d0('0xd1'));}if(_['isArray'](_0xcbd898)){var _0x19b0ef=this;_0xcbd898[_0x74d0('0xd3')](function(_0x34fca9,_0x10bb14){_0x19b0ef['channel'][_0x74d0('0x99')](util[_0x74d0('0x96')](_0x74d0('0x147'),_0xf351e4,_0x10bb14),_0x34fca9);});return this[_0x74d0('0x11')][_0x74d0('0xa6')](util[_0x74d0('0x96')](_0x74d0('0x148'),_0xf351e4));}else{return this[_0x74d0('0x11')][_0x74d0('0x99')](_0xf351e4,_0xcbd898);}};AGIVertices[_0x74d0('0x14')][_0x74d0('0x149')]=function(_0xbe8018){logger[_0x74d0('0x32')](util[_0x74d0('0x96')](_0x74d0('0x14a'),_0xbe8018[_0x74d0('0x3b')]));if(_0xbe8018['retry']===0x0){return this[_0x74d0('0xff')](_0xbe8018);}_0xbe8018['retry']-=0x1;if(!this[_0x74d0('0x7f')](_0xbe8018[_0x74d0('0x100')])){return this[_0x74d0('0x11')]['error'](_0xbe8018,_0x74d0('0x14b'));}var _0x500344=this['getSound'][_0x74d0('0xa2')](this,_0xbe8018[_0x74d0('0x100')]);if(!_0x500344){return this[_0x74d0('0x11')]['error'](_0xbe8018,_0x74d0('0x101'));}var _0x1f3cdc=this['channel'][_0x74d0('0x102')](_0x500344,_0xbe8018[_0x74d0('0x14c')],_0xbe8018['digit']);var _0x576d17=_0x1f3cdc[_0x74d0('0xa0')];if(_0x1f3cdc['result']===-0x1){this['createSquareDetailsReport'][_0x74d0('0xa2')](this,_0xbe8018,'-1');return _0x1f3cdc;}else if(_0x1f3cdc[_0x74d0('0x9d')]===_0x74d0('0x64')){_0x1f3cdc['result']=_0x1f3cdc[_0x74d0('0xa0')]['length']>0x0?_0x1f3cdc[_0x74d0('0xa0')]:'t';}else if(_['isEmpty'](_0x1f3cdc[_0x74d0('0xa0')])){_0x1f3cdc[_0x74d0('0xa0')]='#';_0x576d17='#';}if(!this[_0x74d0('0x7f')](_0xbe8018[_0x74d0('0xcf')])){this[_0x74d0('0x11')][_0x74d0('0xa6')]('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x4ae956=this[_0x74d0('0x9c')]['sync'](this,_0xbe8018[_0x74d0('0xcf')]);if(!_0x4ae956){return this[_0x74d0('0x11')]['error'](_0xbe8018,_0x74d0('0xd1'));}this['channel'][_0x74d0('0x99')](_0x4ae956,_0x576d17);}this['createSquareDetailsReport'][_0x74d0('0xa2')](this,_0xbe8018,_0x576d17);return _0x1f3cdc;};AGIVertices[_0x74d0('0x14')][_0x74d0('0xa6')]=function(_0x27c23f){logger[_0x74d0('0x32')](util[_0x74d0('0x96')](_0x74d0('0x14d'),_0x27c23f[_0x74d0('0x3b')]));return this[_0x74d0('0x11')][_0x74d0('0xa6')](_0x27c23f[_0x74d0('0x14e')]||_0x27c23f[_0x74d0('0x3b')]);};AGIVertices[_0x74d0('0x14')]['pause']=function(_0x40a392){logger['info'](util['format'](_0x74d0('0x14f'),_0x40a392['label']));if(!this[_0x74d0('0x7f')](_0x40a392[_0x74d0('0x13a')])){return this[_0x74d0('0x11')][_0x74d0('0x30')](_0x40a392,_0x74d0('0x13b'));}logger[_0x74d0('0x32')](util[_0x74d0('0x96')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this['channel'][_0x74d0('0x3d')],_0x40a392[_0x74d0('0x13a')]));var _0x146f6f=this[_0x74d0('0x4f')][_0x74d0('0xa2')](this,_0x40a392['pause_id']);var _0x3ea1b4=this[_0x74d0('0x51')][_0x74d0('0xa2')](this,_0x40a392[_0x74d0('0x13a')],_0x146f6f);if(_0x3ea1b4){logger['info'](util[_0x74d0('0x96')](_0x74d0('0x13d'),this['channel'][_0x74d0('0x3d')],_0x40a392[_0x74d0('0x13a')]));this[_0x74d0('0x11')][_0x74d0('0xa6')](util[_0x74d0('0x96')](_0x74d0('0x13d'),this[_0x74d0('0x11')][_0x74d0('0x3d')],_0x40a392['findBy']));return{'code':0xc8,'result':'success'};}else{logger[_0x74d0('0x32')](util[_0x74d0('0x96')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x74d0('0x11')][_0x74d0('0x3d')],_0x40a392[_0x74d0('0x13a')]));this[_0x74d0('0x11')][_0x74d0('0xa6')](util['format'](_0x74d0('0x13d'),this[_0x74d0('0x11')][_0x74d0('0x3d')],_0x40a392[_0x74d0('0x13a')]));return{'code':0xc8,'result':_0x74d0('0x140')};}};AGIVertices[_0x74d0('0x14')][_0x74d0('0x150')]=function(_0x28b87d){logger[_0x74d0('0x32')](util[_0x74d0('0x96')]('Enter\x20in\x20PLAYBACK\x20(%s)\x20block',_0x28b87d[_0x74d0('0x3b')]));if(!this[_0x74d0('0x7f')](_0x28b87d[_0x74d0('0x100')])){return this['channel'][_0x74d0('0x30')](_0x28b87d,'no\x20file\x20audio\x20selected');}var _0x17f60e=this['getSound'][_0x74d0('0xa2')](this,_0x28b87d[_0x74d0('0x100')]);if(!_0x17f60e){return this['channel']['error'](_0x28b87d,_0x74d0('0x101'));}var _0x1f9884=this[_0x74d0('0x11')][_0x74d0('0x58')](_0x74d0('0x151'),[_0x17f60e,_0x28b87d[_0x74d0('0x152')]]);if(_0x1f9884[_0x74d0('0xa0')]===-0x1){return _0x1f9884;}return this[_0x74d0('0x11')][_0x74d0('0xa6')](util[_0x74d0('0x96')](_0x74d0('0x153'),_0x74d0('0x151'),_0x17f60e));};AGIVertices[_0x74d0('0x14')][_0x74d0('0x154')]=function(_0x25d2fb){logger[_0x74d0('0x32')](util[_0x74d0('0x96')](_0x74d0('0x155'),_0x25d2fb[_0x74d0('0x3b')]));if(!this[_0x74d0('0x7f')](_0x25d2fb[_0x74d0('0x156')])){return this[_0x74d0('0x11')][_0x74d0('0x30')](_0x25d2fb,_0x74d0('0x157'));}var _0x17c955='';var _0x24f6cd=parseInt(_0x25d2fb[_0x74d0('0x156')],0xa);if(isNaN(_0x24f6cd)){_0x17c955=_0x25d2fb[_0x74d0('0x156')];}else{_0x17c955=this[_0x74d0('0x19')]['sync'](this,_0x25d2fb[_0x74d0('0x156')]);if(!_0x17c955){return this[_0x74d0('0x11')]['error'](_0x25d2fb,_0x74d0('0x158'));}}var _0x2f9040='';if(this[_0x74d0('0x7f')](_0x25d2fb[_0x74d0('0x100')])){var _0x105efa=this[_0x74d0('0x21')]['sync'](this,_0x25d2fb[_0x74d0('0x100')]);if(_0x105efa){_0x2f9040=_0x105efa;}}this[_0x74d0('0x39')][_0x74d0('0xa2')](this,_0x25d2fb,_0x17c955);if(_0x25d2fb[_0x74d0('0x152')][_0x74d0('0x159')]('x')<0x0){_0x25d2fb['opts']+='x';}if(_0x25d2fb[_0x74d0('0x152')][_0x74d0('0x159')]('X')<0x0){_0x25d2fb[_0x74d0('0x152')]+='X';}this['channel']['setVariable'](_0x74d0('0x15a'),_0x17c955?_0x17c955[_0x74d0('0x15b')]():'');var _0x5dc371=this[_0x74d0('0x11')]['exec'](_0x74d0('0x15c'),[_0x17c955,_0x25d2fb['opts'],_0x25d2fb[_0x74d0('0x62')],_0x2f9040,_0x25d2fb[_0x74d0('0x64')],_0x25d2fb[_0x74d0('0xa')],_0x25d2fb[_0x74d0('0x15d')],_0x25d2fb[_0x74d0('0x15e')],'',_0x25d2fb[_0x74d0('0x15f')]]);if(_0x5dc371[_0x74d0('0xa0')]===-0x1){return _0x5dc371;}return this[_0x74d0('0x11')][_0x74d0('0xa6')](util['format'](_0x74d0('0x153'),_0x74d0('0x15c'),_0x17c955));};AGIVertices[_0x74d0('0x14')]['record']=function(_0x5a98f0){logger[_0x74d0('0x32')](util['format'](_0x74d0('0x160'),_0x5a98f0[_0x74d0('0x3b')]));var _0x2b359d=_0x5a98f0[_0x74d0('0x161')]||_0x74d0('0x135');var _0x3471ff=util[_0x74d0('0x96')]('%s_%s',this[_0x74d0('0x11')][_0x74d0('0x3a')],rs['generate'](0x5));var _0x97f2c9=util['format']('%s/recordings/%s.%s',FILES_PATH,_0x3471ff,_0x2b359d);var _0x230ed1=util[_0x74d0('0x96')]('%s/recordings/%s',FILES_PATH,_0x3471ff);this[_0x74d0('0x3e')][_0x74d0('0xa2')](this,_0x5a98f0,_0x3471ff,_0x97f2c9);this['channel'][_0x74d0('0x99')](_0x74d0('0x162'),_0x3471ff);logger['info'](_0x74d0('0x163'),_0x230ed1,_0x2b359d,_0x5a98f0[_0x74d0('0x164')],_0x5a98f0[_0x74d0('0x64')]);return this['channel'][_0x74d0('0x165')](_0x230ed1,_0x2b359d,_0x5a98f0['escape_digits'],_0x5a98f0[_0x74d0('0x64')],undefined,!![]);};AGIVertices['prototype']['restapi']=function(_0x133ab4){logger[_0x74d0('0x32')](util[_0x74d0('0x96')](_0x74d0('0x166'),_0x133ab4['label']));if(!this[_0x74d0('0x7f')](_0x133ab4[_0x74d0('0x62')])){return this[_0x74d0('0x11')][_0x74d0('0xa6')](_0x74d0('0x167'));}var _0x3b27e4=this[_0x74d0('0x168')][_0x74d0('0xa2')](this,_0x133ab4);logger[_0x74d0('0x32')](util['format'](_0x74d0('0x169'),util['inspect'](_0x3b27e4,{'showHidden':![],'depth':null})));if(!this[_0x74d0('0x7f')](_0x133ab4['variable_id'])){return this[_0x74d0('0x11')]['noop']('no\x20variable\x20selected\x20for\x20the\x20response');}var _0xd57fdb=this[_0x74d0('0x9c')]['sync'](this,_0x133ab4['variable_id']);if(!_0xd57fdb){return this[_0x74d0('0x11')][_0x74d0('0x30')](_0x133ab4,_0x74d0('0xd1'));}this[_0x74d0('0x11')]['setVariable'](util[_0x74d0('0x96')](_0x74d0('0x16a'),_0xd57fdb),_0x3b27e4[_0x74d0('0x72')]?_0x3b27e4[_0x74d0('0x72')]:_0x74d0('0x16b'));this[_0x74d0('0x11')][_0x74d0('0x99')](util[_0x74d0('0x96')]('%s_STATUS_MESSAGE',_0xd57fdb),_0x3b27e4[_0x74d0('0x73')]?_0x3b27e4['statusMessage']:'OK');if(_0x3b27e4[_0x74d0('0x69')]){try{this[_0x74d0('0x95')](_0x3b27e4[_0x74d0('0x69')],_0xd57fdb);}catch(_0x35daf6){logger[_0x74d0('0x30')](util[_0x74d0('0x96')](_0x74d0('0x16c'),_0xd57fdb));}}return this[_0x74d0('0x11')]['noop'](util[_0x74d0('0x96')](_0x74d0('0xd6'),_0xd57fdb));};AGIVertices['prototype'][_0x74d0('0x16d')]=function(_0x349dd0){logger[_0x74d0('0x32')](util[_0x74d0('0x96')](_0x74d0('0x16e'),_0x349dd0[_0x74d0('0x3b')]));return this[_0x74d0('0x11')]['sayDigits'](_0x349dd0[_0x74d0('0x16f')]['replace'](/\s+/g,''),_0x349dd0['escape_digits']);};AGIVertices['prototype'][_0x74d0('0x170')]=function(_0x90ff74){logger[_0x74d0('0x32')](util[_0x74d0('0x96')](_0x74d0('0x171'),_0x90ff74[_0x74d0('0x3b')]));return this[_0x74d0('0x11')]['sayNumber'](_0x90ff74[_0x74d0('0x172')][_0x74d0('0xcd')](/\s+/g,''),_0x90ff74[_0x74d0('0x164')]);};AGIVertices[_0x74d0('0x14')][_0x74d0('0x173')]=function(_0x13fedc){logger['info'](util['format'](_0x74d0('0x174'),_0x13fedc[_0x74d0('0x3b')]));return this['channel'][_0x74d0('0x175')](_0x13fedc[_0x74d0('0x5c')],_0x13fedc[_0x74d0('0x164')]);};AGIVertices['prototype']['sendMail']=function(_0x2baa85){logger[_0x74d0('0x32')](util[_0x74d0('0x96')](_0x74d0('0x176'),_0x2baa85[_0x74d0('0x3b')]));if(!this['isConfigured'](_0x2baa85[_0x74d0('0x177')])){return this[_0x74d0('0x11')][_0x74d0('0xa6')]('no\x20mail\x20account\x20configured');}var _0xe68c2=this['getMailAccount'][_0x74d0('0xa2')](this,_0x2baa85[_0x74d0('0x177')]);if(!_0xe68c2||!_0xe68c2[_0x74d0('0x178')]){return this[_0x74d0('0x11')]['error'](_0x2baa85,_0x74d0('0x179'));}var _0x311249={'from':util[_0x74d0('0x96')](_0x74d0('0x17a'),_0xe68c2['name'],_0xe68c2[_0x74d0('0x17b')]||_0xe68c2[_0x74d0('0x178')][_0x74d0('0x17c')]),'to':_0x2baa85['to']||'','cc':_0x2baa85['cc']||'','bcc':_0x2baa85[_0x74d0('0x17d')]||'','subject':_0x2baa85[_0x74d0('0x17e')],'html':_0x2baa85[_0x74d0('0x5c')],'text':_0x2baa85[_0x74d0('0x5c')]};var _0x5556bb={'tls':{'rejectUnauthorized':![]}};if(_0xe68c2[_0x74d0('0x178')]['service']){_0x5556bb[_0x74d0('0x17f')]=_0xe68c2[_0x74d0('0x178')][_0x74d0('0x17f')];}else{_0x5556bb['host']=_0xe68c2[_0x74d0('0x178')][_0x74d0('0x180')];_0x5556bb['port']=_0xe68c2[_0x74d0('0x178')][_0x74d0('0x181')];_0x5556bb[_0x74d0('0x182')]=_0xe68c2[_0x74d0('0x178')]['secure'];}if(_0xe68c2[_0x74d0('0x178')][_0x74d0('0x183')]){_0x5556bb[_0x74d0('0x184')]={'user':_0xe68c2['Smtp'][_0x74d0('0x17c')],'pass':_0xe68c2[_0x74d0('0x178')][_0x74d0('0x185')]};}if(this[_0x74d0('0x7f')](_0x2baa85['template_id'])){}logger[_0x74d0('0x186')](_0x74d0('0x187'),JSON['stringify'](_0x311249));this[_0x74d0('0x39')]['sync'](this,_0x2baa85,_0x2baa85['account_id']);this[_0x74d0('0x11')][_0x74d0('0xa6')](util['format']('Trying\x20SendMail\x20with\x20account\x20%s',_0xe68c2[_0x74d0('0x17')]));this['sendMailMessage'][_0x74d0('0xa2')](this,_0x5556bb,_0x311249);return this[_0x74d0('0x11')][_0x74d0('0xa6')]('Mail\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices['prototype'][_0x74d0('0x188')]=function(_0x5c5ead){logger[_0x74d0('0x32')](util[_0x74d0('0x96')](_0x74d0('0x189'),_0x5c5ead[_0x74d0('0x3b')]));return this[_0x74d0('0x11')]['noop'](_0x74d0('0x18a'));};AGIVertices[_0x74d0('0x14')]['sendSMS']=function(_0x14d713){logger[_0x74d0('0x32')](util['format']('Enter\x20in\x20SENDSMS\x20(%s)\x20block',_0x14d713['label']));if(!this[_0x74d0('0x7f')](_0x14d713[_0x74d0('0x18b')])){return this[_0x74d0('0x11')][_0x74d0('0xa6')](_0x74d0('0x18c'));}var _0x18a596=this[_0x74d0('0x36')][_0x74d0('0xa2')](this,_0x14d713[_0x74d0('0x18b')]);if(!_0x18a596){return this['channel'][_0x74d0('0x30')](_0x14d713,_0x74d0('0x18d'));}var _0x4883ca={'body':_0x14d713['sms_text'],'phone':_0x14d713['to']||'','SmsAccountId':_0x18a596['id']};logger[_0x74d0('0x186')](_0x74d0('0x18e'),JSON[_0x74d0('0x71')](_0x4883ca));this[_0x74d0('0x39')][_0x74d0('0xa2')](this,_0x14d713,_0x14d713['sms_account_id']);this['channel'][_0x74d0('0xa6')](util[_0x74d0('0x96')](_0x74d0('0x18f'),_0x18a596['name']));this[_0x74d0('0x38')]['sync'](this,_0x4883ca);return this[_0x74d0('0x11')][_0x74d0('0xa6')](_0x74d0('0x190'));};AGIVertices[_0x74d0('0x14')]['set']=function(_0x5f2211){logger[_0x74d0('0x32')](util[_0x74d0('0x96')](_0x74d0('0x191'),_0x5f2211[_0x74d0('0x3b')]));if(!this[_0x74d0('0x7f')](_0x5f2211[_0x74d0('0xcf')])){return this['channel'][_0x74d0('0x30')](_0x5f2211,'no\x20variable\x20selected');}var _0x347d8a=this[_0x74d0('0x9c')][_0x74d0('0xa2')](this,_0x5f2211[_0x74d0('0xcf')]);if(!_0x347d8a){return this[_0x74d0('0x11')][_0x74d0('0x30')](_0x5f2211,_0x74d0('0xd1'));}return this[_0x74d0('0x11')][_0x74d0('0x99')](_0x347d8a,_0x5f2211[_0x74d0('0x192')]);};AGIVertices[_0x74d0('0x14')][_0x74d0('0x193')]=function(_0x1f499a){logger['info'](util[_0x74d0('0x96')](_0x74d0('0x194'),_0x1f499a[_0x74d0('0x3b')]));this[_0x74d0('0x11')]['noop'](_0x74d0('0x195'));if(_0x1f499a[_0x74d0('0xb5')]===_0x74d0('0x196')){this[_0x74d0('0x11')]['noop'](_0x74d0('0x197'));return this[_0x74d0('0x11')][_0x74d0('0xb5')]();}return this[_0x74d0('0x11')][_0x74d0('0xa6')](_0x74d0('0x198'));};AGIVertices[_0x74d0('0x14')][_0x74d0('0x199')]=function(_0x3afebd){logger[_0x74d0('0x32')](util[_0x74d0('0x96')](_0x74d0('0x19a'),_0x3afebd[_0x74d0('0x3b')]));if(!this[_0x74d0('0x7f')](_0x3afebd[_0x74d0('0x19b')])){return this['channel'][_0x74d0('0x30')](_0x3afebd,'no\x20subproject\x20selected');}var _0x2f9893=this[_0x74d0('0x19c')][_0x74d0('0xa2')](this,_0x3afebd['project_id']);if(!this[_0x74d0('0x7f')](_0x2f9893)){return this[_0x74d0('0x11')][_0x74d0('0x30')](_0x3afebd,util[_0x74d0('0x96')](_0x74d0('0x19d'),_0x3afebd['project_id']));}if(_0x2f9893===this[_0x74d0('0x11')][_0x74d0('0x3c')]){return this['channel'][_0x74d0('0x30')](_0x3afebd,_0x74d0('0x19e'));}this[_0x74d0('0x39')][_0x74d0('0xa2')](this,_0x3afebd,_0x2f9893);var _0x21fb91=this[_0x74d0('0x11')]['exec'](_0x74d0('0x19f'),util[_0x74d0('0x96')](_0x74d0('0x1a0'),config[_0x74d0('0xa')]['host']||_0x74d0('0x1a1'),_0x2f9893,this[_0x74d0('0x11')][_0x74d0('0x3c')]));if(_0x21fb91['result']===-0x1){return _0x21fb91;}return this[_0x74d0('0x11')][_0x74d0('0xa6')](util['format'](_0x74d0('0x153'),_0x74d0('0x19f'),_0x2f9893));};AGIVertices['prototype'][_0x74d0('0x1a2')]=function(_0x487a05){logger[_0x74d0('0x32')](util['format']('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0x487a05[_0x74d0('0x3b')]));var _0x2d5dca=this['shellCommand']['sync'](this,_0x487a05['command']);this['createSquareDetailsReport'][_0x74d0('0xa2')](this,_0x487a05,_0x487a05[_0x74d0('0xb3')]);if(this[_0x74d0('0x7f')](_0x487a05[_0x74d0('0xcf')])){var _0x200f82=this[_0x74d0('0x9c')][_0x74d0('0xa2')](this,_0x487a05[_0x74d0('0xcf')]);if(_0x200f82){this[_0x74d0('0x11')][_0x74d0('0x99')](_0x200f82,_0x2d5dca);return this[_0x74d0('0x11')][_0x74d0('0xa6')](util['format'](_0x74d0('0x1a3'),_0x487a05[_0x74d0('0xb3')],_0x200f82));}}return this['channel'][_0x74d0('0xa6')](util[_0x74d0('0x96')]('sh\x20command:\x20%s\x20result\x20no\x20stored',_0x487a05[_0x74d0('0xb3')]));};AGIVertices['prototype'][_0x74d0('0x1a4')]=function(_0x26c3e1){logger[_0x74d0('0x32')](util[_0x74d0('0x96')](_0x74d0('0x1a5'),_0x26c3e1[_0x74d0('0x3b')]));_0x26c3e1[_0x74d0('0x5c')]=_0x26c3e1[_0x74d0('0x5c')][_0x74d0('0xcd')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x74d0('0x7f')](_0x26c3e1['apiKey'])){return this['channel']['noop'](_0x74d0('0x1a6'));}if(!this[_0x74d0('0x7f')](_0x26c3e1[_0x74d0('0x5c')])){return this[_0x74d0('0x11')][_0x74d0('0xa6')](_0x74d0('0xa7'));}this[_0x74d0('0x11')][_0x74d0('0xa6')](util[_0x74d0('0x96')](_0x74d0('0x1a7'),_0x26c3e1[_0x74d0('0x5c')]));var _0x18e6a0=this[_0x74d0('0x5a')][_0x74d0('0xa2')](this,_0x26c3e1);if(_0x18e6a0){this[_0x74d0('0x11')][_0x74d0('0xa6')](util[_0x74d0('0x96')]('Google\x20Cloud\x20TTS\x20%s\x20file\x20created',_0x18e6a0));var _0x4c8f42=this[_0x74d0('0x11')]['streamFile'](_0x18e6a0);try{fs['unlink'](_0x18e6a0+'.wav');}catch(_0x34b6e4){logger[_0x74d0('0x30')](_0x34b6e4);}return _0x4c8f42;}return this[_0x74d0('0x11')][_0x74d0('0x30')](_0x26c3e1,_0x74d0('0x1a8'));};AGIVertices['prototype'][_0x74d0('0x1a9')]=function(_0x1e6d41){logger['info'](util['format']('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x1e6d41['label']));_0x1e6d41[_0x74d0('0x5c')]=_0x1e6d41['text'][_0x74d0('0xcd')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x74d0('0x7f')](_0x1e6d41[_0x74d0('0x5c')])){return this[_0x74d0('0x11')][_0x74d0('0xa6')](_0x74d0('0xa7'));}this['channel'][_0x74d0('0xa6')](util['format'](_0x74d0('0x1aa'),_0x1e6d41['text']));var _0xf1be9d=this[_0x74d0('0x60')][_0x74d0('0xa2')](this,_0x1e6d41);if(_0xf1be9d){this[_0x74d0('0x11')][_0x74d0('0xa6')](util[_0x74d0('0x96')]('Google\x20TTS\x20%s\x20file\x20created',_0xf1be9d));var _0x5dc939=this[_0x74d0('0x11')][_0x74d0('0xf0')](_0xf1be9d);try{fs[_0x74d0('0xf1')](_0xf1be9d+'.wav');}catch(_0x57079c){logger[_0x74d0('0x30')](_0x57079c);}return _0x5dc939;}return this[_0x74d0('0x11')][_0x74d0('0x30')](_0x1e6d41,_0x74d0('0x1ab'));};AGIVertices[_0x74d0('0x14')][_0x74d0('0x1ac')]=function(_0x2b042a){logger[_0x74d0('0x32')](util[_0x74d0('0x96')](_0x74d0('0x1ad'),_0x2b042a['label']));if(!this[_0x74d0('0x7f')](_0x2b042a[_0x74d0('0x13a')])){return this[_0x74d0('0x11')][_0x74d0('0x30')](_0x2b042a,_0x74d0('0x13b'));}logger['info'](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this['channel'][_0x74d0('0x3d')],_0x2b042a[_0x74d0('0x13a')]));var _0x518b08=this['agentUnpause'][_0x74d0('0xa2')](this,_0x2b042a['findBy']);if(_0x518b08){logger['info'](util[_0x74d0('0x96')](_0x74d0('0x13d'),this[_0x74d0('0x11')][_0x74d0('0x3d')],_0x2b042a['findBy']));this[_0x74d0('0x11')][_0x74d0('0xa6')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x74d0('0x11')]['callerid'],_0x2b042a['findBy']));return{'code':0xc8,'result':_0x74d0('0x13e')};}else{logger['info'](util[_0x74d0('0x96')](_0x74d0('0x13f'),this[_0x74d0('0x11')][_0x74d0('0x3d')],_0x2b042a[_0x74d0('0x13a')]));this[_0x74d0('0x11')][_0x74d0('0xa6')](util['format'](_0x74d0('0x13f'),this[_0x74d0('0x11')][_0x74d0('0x3d')],_0x2b042a['findBy']));return{'code':0xc8,'result':_0x74d0('0x140')};}};AGIVertices['prototype']['voicemail']=function(_0x4c16fa){logger[_0x74d0('0x32')](util['format'](_0x74d0('0x1ae'),_0x4c16fa['label']));var _0x4078d1=this['channel'][_0x74d0('0x58')](_0x74d0('0x1af'),[_0x4c16fa[_0x74d0('0x1b0')],_0x4c16fa['options']]);if(_0x4078d1['result']===-0x1){return _0x4078d1;}return this[_0x74d0('0x11')][_0x74d0('0xa6')](util[_0x74d0('0x96')](_0x74d0('0x153'),_0x74d0('0x1af'),_0x4c16fa['mailbox']));};AGIVertices['prototype'][_0x74d0('0x1b1')]=function(_0x1ff4f9){logger[_0x74d0('0x32')](util[_0x74d0('0x96')](_0x74d0('0x1b2'),_0x1ff4f9['label']));if(!this[_0x74d0('0x7f')](_0x1ff4f9[_0x74d0('0xcf')])){return this[_0x74d0('0x11')][_0x74d0('0x30')](_0x1ff4f9,_0x74d0('0x1b3'));}var _0x1e0786=this['getVariable'][_0x74d0('0xa2')](this,_0x1ff4f9['variable_id']);if(!_0x1e0786){return this[_0x74d0('0x11')]['error'](_0x1ff4f9,_0x74d0('0xd1'));}var _0x3eab7f=this['channel'][_0x74d0('0x9c')](_0x1e0786);return{'code':0xc8,'result':_0x3eab7f['extra']?_0x3eab7f[_0x74d0('0x9d')]:'-'};};String[_0x74d0('0x14')]['replaceAll']=function(_0x15ee9c,_0x42d63d){return this[_0x74d0('0x9a')](_0x15ee9c)[_0x74d0('0x1b4')](_0x42d63d);};module[_0x74d0('0x1b5')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 1a7703b..77e6a03 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 _0x84ab=['attended','destlinkedid','savePause','timers','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','stopAcw','lastPauseAt','format','uniqueid','updateAcw','update','[%s][UPDATE][ACWTIME:%s]','catch','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','error','finally','[ACW][START]\x20%s','message','[TIMER][STOP][AGENT:%s]','saveUnpause','[ACW][STOP]\x20%s','acw','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','[%s][HANGUP:UNIQUEID]','isUndefined','[%s][HANGUP:LINKEDID]','linkedid','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','isNil','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','transfereeuniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','stringify','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','syncAgentRingNoAnswer','all','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','util','lodash','moment','../ami','../../../config/logger','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','channels','syncAgentConnect','bind','syncHangupRequest','hangup','syncHangup','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','startAcw','interface','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','QueuePause','then','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]'];(function(_0x39b6ed,_0x1fbbb6){var _0x248244=function(_0x52caee){while(--_0x52caee){_0x39b6ed['push'](_0x39b6ed['shift']());}};_0x248244(++_0x1fbbb6);}(_0x84ab,0x12f));var _0xb84a=function(_0x1ba43c,_0x5bd2e8){_0x1ba43c=_0x1ba43c-0x0;var _0x2f60eb=_0x84ab[_0x1ba43c];return _0x2f60eb;};'use strict';var util=require(_0xb84a('0x0'));var _=require(_0xb84a('0x1'));var moment=require(_0xb84a('0x2'));var ami=require(_0xb84a('0x3'));var logger=require(_0xb84a('0x4'))('acw');var RpcUser=require(_0xb84a('0x5'));var RpcVoiceAgentReport=require(_0xb84a('0x6'));function Acw(_0x47b8e3){this[_0xb84a('0x7')]=_0x47b8e3[_0xb84a('0x7')];this[_0xb84a('0x8')]=_0x47b8e3['agents'];this['timers']=_0x47b8e3['timers'];this[_0xb84a('0x9')]={};ami['on']('agentconnect',this[_0xb84a('0xa')][_0xb84a('0xb')](this));ami['on']('hanguprequest',this[_0xb84a('0xc')]['bind'](this));ami['on'](_0xb84a('0xd'),this[_0xb84a('0xe')][_0xb84a('0xb')](this));ami['on']('agentringnoanswer',this['syncAgentRingNoAnswer']['bind'](this));ami['on'](_0xb84a('0xf'),this[_0xb84a('0x10')][_0xb84a('0xb')](this));ami['on'](_0xb84a('0x11'),this[_0xb84a('0x12')]['bind'](this));ami['on'](_0xb84a('0x13'),this[_0xb84a('0x14')][_0xb84a('0xb')](this));}function getDiff(_0x3c161c){var _0x44b26b=moment()[_0xb84a('0x15')](0x0);var _0x12ccab=moment(_0x3c161c)[_0xb84a('0x15')](0x0);return _0x44b26b[_0xb84a('0x16')](_0x12ccab,_0xb84a('0x17'));}Acw[_0xb84a('0x18')][_0xb84a('0x19')]=function(_0x5716bd){try{var _0x11dd4d=this;var _0x4a691d=this[_0xb84a('0x9')][_0x5716bd][_0xb84a('0x1a')];var _0x1c7378=this[_0xb84a('0x9')][_0x5716bd][_0xb84a('0x1b')];var _0x34d82f=this[_0xb84a('0x7')][_0x1c7378];var _0x3f7437=![];var _0x11d5a0=_0xb84a('0x1c');if(_0x34d82f[_0xb84a('0x1d')]){if(_0x34d82f[_0xb84a('0x1e')]['name']){_0x3f7437=!![];_0x11d5a0=_0x34d82f[_0xb84a('0x1e')][_0xb84a('0x1f')];}}ami['Action']({'action':_0xb84a('0x20'),'interface':_0x4a691d,'paused':!![],'reason':_0x11d5a0})[_0xb84a('0x21')](function(_0x42c788){if(_0x11dd4d[_0xb84a('0x8')][_0x4a691d]){return RpcUser['getAgent'](_0x11dd4d['agents'][_0x4a691d]['id'])[_0xb84a('0x21')](function(_0x19097d){if(_0x19097d&&!_0x19097d[_0xb84a('0x22')]){logger[_0xb84a('0x23')](_0xb84a('0x24'),_0x5716bd,_0x4a691d,_0x1c7378);var _0x3b8fb2=_0x11dd4d[_0xb84a('0x9')][_0x5716bd][_0xb84a('0x25')]&&_0x11dd4d[_0xb84a('0x9')][_0x5716bd][_0xb84a('0x26')]?_0x11dd4d[_0xb84a('0x9')][_0x5716bd][_0xb84a('0x26')]:_0x5716bd;return RpcUser[_0xb84a('0x27')](_0x11dd4d[_0xb84a('0x8')][_0x4a691d],_0x11d5a0,_0x3b8fb2)[_0xb84a('0x21')](function(_0x3258a9){if(!_0x3f7437){_0x11dd4d[_0xb84a('0x28')][_0x4a691d]={};logger[_0xb84a('0x23')](_0xb84a('0x29'),_0x5716bd,_0x11dd4d[_0xb84a('0x7')][_0x1c7378][_0xb84a('0x2a')],_0x4a691d,_0x1c7378);_0x11dd4d[_0xb84a('0x28')][_0x4a691d][_0xb84a('0x2b')]=setTimeout(_0x11dd4d[_0xb84a('0x2c')][_0xb84a('0xb')](_0x11dd4d,_0x4a691d),_0x11dd4d[_0xb84a('0x7')][_0x1c7378]['acwTimeout']*0x3e8);_0x11dd4d['timers'][_0x4a691d][_0xb84a('0x2d')]=moment()[_0xb84a('0x2e')]('YYYY-MM-DD\x20HH:mm:ss');_0x11dd4d[_0xb84a('0x28')][_0x4a691d][_0xb84a('0x2f')]=_0x5716bd;_0x11dd4d['timers'][_0x4a691d]['queue']=_0x1c7378;_0x11dd4d[_0xb84a('0x28')][_0x4a691d][_0xb84a('0x30')]=function(){var _0x49ba3d=getDiff(_0x11dd4d[_0xb84a('0x28')][_0x4a691d][_0xb84a('0x2d')]);clearTimeout(_0x11dd4d[_0xb84a('0x28')][_0x4a691d][_0xb84a('0x2b')]);_0x11dd4d[_0xb84a('0x28')][_0x4a691d][_0xb84a('0x2b')]=![];RpcVoiceAgentReport[_0xb84a('0x31')]({'acwtime':_0x49ba3d},_0x11dd4d[_0xb84a('0x28')][_0x4a691d]['uniqueid'],_0x4a691d)[_0xb84a('0x21')](function(_0x5b794f){logger['info'](_0xb84a('0x32'),_0x5716bd,_0x49ba3d,_0x5b794f);})[_0xb84a('0x33')](function(_0x47a5b6){logger['error'](_0xb84a('0x34'),_0x5716bd,_0x47a5b6);});delete _0x11dd4d[_0xb84a('0x28')][_0x4a691d];};}});}else{logger[_0xb84a('0x23')](_0xb84a('0x35'),_0x5716bd,_0x4a691d,_0x1c7378);}});}})[_0xb84a('0x33')](function(_0x1d7ef1){logger[_0xb84a('0x36')](_0xb84a('0x29'),_0x5716bd,_0x11dd4d['voiceQueues'][_0x1c7378][_0xb84a('0x2a')],_0x4a691d,_0x1c7378);})[_0xb84a('0x37')](function(){delete _0x11dd4d[_0xb84a('0x9')][_0x5716bd];});}catch(_0xf894a6){logger[_0xb84a('0x36')](_0xb84a('0x38'),_0xf894a6[_0xb84a('0x39')]);}};Acw['prototype'][_0xb84a('0x2c')]=function(_0x56d783){try{var _0x1a3115=this;if(_0x1a3115[_0xb84a('0x28')][_0x56d783]){_0x1a3115[_0xb84a('0x28')][_0x56d783]['timer']=![];var _0x4af084=_0x1a3115[_0xb84a('0x28')][_0x56d783][_0xb84a('0x2f')];var _0x4a3737=_0x1a3115[_0xb84a('0x28')][_0x56d783][_0xb84a('0x1b')];var _0x4cb5d4=_0x1a3115[_0xb84a('0x7')][_0x4a3737][_0xb84a('0x2a')];logger['info'](_0xb84a('0x3a'),_0x56d783);RpcUser[_0xb84a('0x3b')](this[_0xb84a('0x8')][_0x56d783]);RpcVoiceAgentReport[_0xb84a('0x31')]({'acwtime':_0x4cb5d4,'agentacw':!![]},_0x4af084,_0x56d783)['then'](function(_0x57a1a8){logger['info'](_0xb84a('0x32'),_0x4af084,_0x4cb5d4,_0x57a1a8);})[_0xb84a('0x33')](function(_0x43a071){logger[_0xb84a('0x36')]('[%s][UPDATE][ERRORS:%s]',_0x4af084,_0x43a071);});}else{logger[_0xb84a('0x36')]('[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer',_0x56d783);if(_0x1a3115[_0xb84a('0x28')]){logger['info']('[ACW][TIMERS]',JSON['stringify'](_0x1a3115[_0xb84a('0x28')]));}}}catch(_0x22791f){logger[_0xb84a('0x36')](_0xb84a('0x3c'),_0x22791f['message']);}};Acw[_0xb84a('0x18')][_0xb84a('0xa')]=function(_0x3908c3){try{if(this[_0xb84a('0x7')][_0x3908c3['queue']]&&(this['voiceQueues'][_0x3908c3[_0xb84a('0x1b')]][_0xb84a('0x3d')]||this['voiceQueues'][_0x3908c3[_0xb84a('0x1b')]][_0xb84a('0x1d')])){if(this[_0xb84a('0x8')][_0x3908c3[_0xb84a('0x1a')]]){this[_0xb84a('0x9')][_0x3908c3[_0xb84a('0x2f')]]={'queue':_0x3908c3[_0xb84a('0x1b')],'interface':_0x3908c3[_0xb84a('0x1a')],'destlinkedid':_0x3908c3[_0xb84a('0x26')]};}}}catch(_0xcd1e3b){logger[_0xb84a('0x36')](_0xb84a('0x3e'),_0xcd1e3b[_0xb84a('0x39')]);}};Acw[_0xb84a('0x18')][_0xb84a('0x14')]=function(_0x4ad7d0){try{if(this[_0xb84a('0x7')][_0x4ad7d0[_0xb84a('0x1b')]]&&(this[_0xb84a('0x7')][_0x4ad7d0[_0xb84a('0x1b')]][_0xb84a('0x3d')]||this[_0xb84a('0x7')][_0x4ad7d0['queue']][_0xb84a('0x1d')])){if(this['agents'][_0x4ad7d0[_0xb84a('0x1a')]]){this[_0xb84a('0x9')][_0x4ad7d0[_0xb84a('0x2f')]]={'queue':_0x4ad7d0[_0xb84a('0x1b')],'interface':_0x4ad7d0['interface']};}}}catch(_0x21ef72){logger[_0xb84a('0x36')](_0xb84a('0x3f'),_0x21ef72['message']);}};Acw['prototype'][_0xb84a('0xc')]=function(_0x10b0cc){try{if(this[_0xb84a('0x9')][_0x10b0cc['uniqueid']]&&_['isUndefined'](this['channels'][_0x10b0cc[_0xb84a('0x2f')]][_0xb84a('0x25')])){logger[_0xb84a('0x23')](_0xb84a('0x40'),_0x10b0cc[_0xb84a('0x2f')]);this['startAcw'](_0x10b0cc['uniqueid']);}else if(this['channels'][_0x10b0cc['linkedid']]&&_[_0xb84a('0x41')](this[_0xb84a('0x9')][_0x10b0cc['linkedid']][_0xb84a('0x25')])){logger[_0xb84a('0x23')](_0xb84a('0x42'),_0x10b0cc[_0xb84a('0x43')]);this[_0xb84a('0x19')](_0x10b0cc[_0xb84a('0x43')]);}}catch(_0x5a07d2){logger['error'](_0xb84a('0x44'),_0x5a07d2['message']);}};Acw[_0xb84a('0x18')]['syncHangup']=function(_0x575908){try{if(this['channels'][_0x575908[_0xb84a('0x2f')]]&&this[_0xb84a('0x9')][_0x575908[_0xb84a('0x2f')]][_0xb84a('0x25')]){logger[_0xb84a('0x23')](_0xb84a('0x45'),_0x575908[_0xb84a('0x2f')]);this[_0xb84a('0x19')](_0x575908['uniqueid']);}else if(this['channels'][_0x575908['linkedid']]&&this[_0xb84a('0x9')][_0x575908[_0xb84a('0x43')]]['attended']){logger[_0xb84a('0x23')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x575908['linkedid']);this['startAcw'](_0x575908[_0xb84a('0x43')]);}}catch(_0x172076){logger[_0xb84a('0x36')]('[ACW][syncHangup]\x20%s',_0x172076[_0xb84a('0x39')]);}};Acw[_0xb84a('0x18')][_0xb84a('0x10')]=function(_0x505994){try{if(!_[_0xb84a('0x46')](this['channels'][_0x505994['transfereeuniqueid']])){this[_0xb84a('0x19')](_0x505994['transfereeuniqueid']);if(this[_0xb84a('0x9')][_0x505994['secondtransfereruniqueid']]){this[_0xb84a('0x9')][_0x505994[_0xb84a('0x47')]][_0xb84a('0x25')]=!![];this[_0xb84a('0x9')][_0x505994['transfertargetuniqueid']]=this['channels'][_0x505994['secondtransfereruniqueid']];delete this[_0xb84a('0x9')][_0x505994[_0xb84a('0x47')]];}}else if(!_['isNil'](this['channels'][_0x505994[_0xb84a('0x48')]])){this[_0xb84a('0x19')](_0x505994[_0xb84a('0x48')]);if(this['channels'][_0x505994[_0xb84a('0x49')]]){this[_0xb84a('0x9')][_0x505994['origtransfereruniqueid']][_0xb84a('0x25')]=!![];this[_0xb84a('0x9')][_0x505994[_0xb84a('0x4a')]]=this[_0xb84a('0x9')][_0x505994[_0xb84a('0x49')]];delete this[_0xb84a('0x9')][_0x505994[_0xb84a('0x49')]];}}}catch(_0x47c27f){logger[_0xb84a('0x36')](_0xb84a('0x4b'),_0x47c27f['message']);}};Acw[_0xb84a('0x18')][_0xb84a('0x12')]=function(_0x34ac0f){try{if(this[_0xb84a('0x9')][_0x34ac0f[_0xb84a('0x4c')]]){logger[_0xb84a('0x23')](_0xb84a('0x4d'),JSON[_0xb84a('0x4e')](_0x34ac0f[_0xb84a('0x4c')]));this['startAcw'](_0x34ac0f[_0xb84a('0x4c')]);}else if(this['channels'][_0x34ac0f['transfererlinkedid']]){logger[_0xb84a('0x23')]('[%s][BLINDTRANSFER:LINKEDID]',JSON[_0xb84a('0x4e')](_0x34ac0f['transfererlinkedid']));this[_0xb84a('0x19')](_0x34ac0f[_0xb84a('0x4f')]);}}catch(_0x4c7d56){logger[_0xb84a('0x36')](_0xb84a('0x50'),_0x4c7d56[_0xb84a('0x39')]);}};Acw[_0xb84a('0x18')][_0xb84a('0x51')]=function(_0x192c9a){try{if(this[_0xb84a('0x7')][_0x192c9a['queue']]&&this[_0xb84a('0x7')][_0x192c9a['queue']]['autopause']===_0xb84a('0x52')){if(this[_0xb84a('0x8')][_0x192c9a[_0xb84a('0x1a')]]){logger[_0xb84a('0x23')]('[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]',_0x192c9a['uniqueid'],_0x192c9a[_0xb84a('0x1a')],_0x192c9a[_0xb84a('0x1b')]);return RpcUser[_0xb84a('0x27')](this[_0xb84a('0x8')][_0x192c9a['interface']],_0xb84a('0x53'),_0x192c9a['uniqueid']);}}}catch(_0x1eec1f){logger['error'](_0xb84a('0x54'),_0x1eec1f['message']);}};module['exports']=Acw; \ No newline at end of file +var _0x84ab=['attended','destlinkedid','savePause','timers','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','stopAcw','lastPauseAt','format','uniqueid','updateAcw','update','[%s][UPDATE][ACWTIME:%s]','catch','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','error','finally','[ACW][START]\x20%s','message','[TIMER][STOP][AGENT:%s]','saveUnpause','[ACW][STOP]\x20%s','acw','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','[%s][HANGUP:UNIQUEID]','isUndefined','[%s][HANGUP:LINKEDID]','linkedid','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','isNil','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','transfereeuniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','stringify','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','syncAgentRingNoAnswer','all','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','util','lodash','moment','../ami','../../../config/logger','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','channels','syncAgentConnect','bind','syncHangupRequest','hangup','syncHangup','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','startAcw','interface','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','QueuePause','then','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]'];(function(_0x330400,_0x5d76dd){var _0x5a4868=function(_0x1ff1d4){while(--_0x1ff1d4){_0x330400['push'](_0x330400['shift']());}};_0x5a4868(++_0x5d76dd);}(_0x84ab,0x12f));var _0xb84a=function(_0x15d18f,_0x126b0e){_0x15d18f=_0x15d18f-0x0;var _0xd12bf7=_0x84ab[_0x15d18f];return _0xd12bf7;};'use strict';var util=require(_0xb84a('0x0'));var _=require(_0xb84a('0x1'));var moment=require(_0xb84a('0x2'));var ami=require(_0xb84a('0x3'));var logger=require(_0xb84a('0x4'))('acw');var RpcUser=require(_0xb84a('0x5'));var RpcVoiceAgentReport=require(_0xb84a('0x6'));function Acw(_0x47b8e3){this[_0xb84a('0x7')]=_0x47b8e3[_0xb84a('0x7')];this[_0xb84a('0x8')]=_0x47b8e3['agents'];this['timers']=_0x47b8e3['timers'];this[_0xb84a('0x9')]={};ami['on']('agentconnect',this[_0xb84a('0xa')][_0xb84a('0xb')](this));ami['on']('hanguprequest',this[_0xb84a('0xc')]['bind'](this));ami['on'](_0xb84a('0xd'),this[_0xb84a('0xe')][_0xb84a('0xb')](this));ami['on']('agentringnoanswer',this['syncAgentRingNoAnswer']['bind'](this));ami['on'](_0xb84a('0xf'),this[_0xb84a('0x10')][_0xb84a('0xb')](this));ami['on'](_0xb84a('0x11'),this[_0xb84a('0x12')]['bind'](this));ami['on'](_0xb84a('0x13'),this[_0xb84a('0x14')][_0xb84a('0xb')](this));}function getDiff(_0x3c161c){var _0x44b26b=moment()[_0xb84a('0x15')](0x0);var _0x12ccab=moment(_0x3c161c)[_0xb84a('0x15')](0x0);return _0x44b26b[_0xb84a('0x16')](_0x12ccab,_0xb84a('0x17'));}Acw[_0xb84a('0x18')][_0xb84a('0x19')]=function(_0x5716bd){try{var _0x11dd4d=this;var _0x4a691d=this[_0xb84a('0x9')][_0x5716bd][_0xb84a('0x1a')];var _0x1c7378=this[_0xb84a('0x9')][_0x5716bd][_0xb84a('0x1b')];var _0x34d82f=this[_0xb84a('0x7')][_0x1c7378];var _0x3f7437=![];var _0x11d5a0=_0xb84a('0x1c');if(_0x34d82f[_0xb84a('0x1d')]){if(_0x34d82f[_0xb84a('0x1e')]['name']){_0x3f7437=!![];_0x11d5a0=_0x34d82f[_0xb84a('0x1e')][_0xb84a('0x1f')];}}ami['Action']({'action':_0xb84a('0x20'),'interface':_0x4a691d,'paused':!![],'reason':_0x11d5a0})[_0xb84a('0x21')](function(_0x42c788){if(_0x11dd4d[_0xb84a('0x8')][_0x4a691d]){return RpcUser['getAgent'](_0x11dd4d['agents'][_0x4a691d]['id'])[_0xb84a('0x21')](function(_0x19097d){if(_0x19097d&&!_0x19097d[_0xb84a('0x22')]){logger[_0xb84a('0x23')](_0xb84a('0x24'),_0x5716bd,_0x4a691d,_0x1c7378);var _0x3b8fb2=_0x11dd4d[_0xb84a('0x9')][_0x5716bd][_0xb84a('0x25')]&&_0x11dd4d[_0xb84a('0x9')][_0x5716bd][_0xb84a('0x26')]?_0x11dd4d[_0xb84a('0x9')][_0x5716bd][_0xb84a('0x26')]:_0x5716bd;return RpcUser[_0xb84a('0x27')](_0x11dd4d[_0xb84a('0x8')][_0x4a691d],_0x11d5a0,_0x3b8fb2)[_0xb84a('0x21')](function(_0x3258a9){if(!_0x3f7437){_0x11dd4d[_0xb84a('0x28')][_0x4a691d]={};logger[_0xb84a('0x23')](_0xb84a('0x29'),_0x5716bd,_0x11dd4d[_0xb84a('0x7')][_0x1c7378][_0xb84a('0x2a')],_0x4a691d,_0x1c7378);_0x11dd4d[_0xb84a('0x28')][_0x4a691d][_0xb84a('0x2b')]=setTimeout(_0x11dd4d[_0xb84a('0x2c')][_0xb84a('0xb')](_0x11dd4d,_0x4a691d),_0x11dd4d[_0xb84a('0x7')][_0x1c7378]['acwTimeout']*0x3e8);_0x11dd4d['timers'][_0x4a691d][_0xb84a('0x2d')]=moment()[_0xb84a('0x2e')]('YYYY-MM-DD\x20HH:mm:ss');_0x11dd4d[_0xb84a('0x28')][_0x4a691d][_0xb84a('0x2f')]=_0x5716bd;_0x11dd4d['timers'][_0x4a691d]['queue']=_0x1c7378;_0x11dd4d[_0xb84a('0x28')][_0x4a691d][_0xb84a('0x30')]=function(){var _0x49ba3d=getDiff(_0x11dd4d[_0xb84a('0x28')][_0x4a691d][_0xb84a('0x2d')]);clearTimeout(_0x11dd4d[_0xb84a('0x28')][_0x4a691d][_0xb84a('0x2b')]);_0x11dd4d[_0xb84a('0x28')][_0x4a691d][_0xb84a('0x2b')]=![];RpcVoiceAgentReport[_0xb84a('0x31')]({'acwtime':_0x49ba3d},_0x11dd4d[_0xb84a('0x28')][_0x4a691d]['uniqueid'],_0x4a691d)[_0xb84a('0x21')](function(_0x5b794f){logger['info'](_0xb84a('0x32'),_0x5716bd,_0x49ba3d,_0x5b794f);})[_0xb84a('0x33')](function(_0x47a5b6){logger['error'](_0xb84a('0x34'),_0x5716bd,_0x47a5b6);});delete _0x11dd4d[_0xb84a('0x28')][_0x4a691d];};}});}else{logger[_0xb84a('0x23')](_0xb84a('0x35'),_0x5716bd,_0x4a691d,_0x1c7378);}});}})[_0xb84a('0x33')](function(_0x1d7ef1){logger[_0xb84a('0x36')](_0xb84a('0x29'),_0x5716bd,_0x11dd4d['voiceQueues'][_0x1c7378][_0xb84a('0x2a')],_0x4a691d,_0x1c7378);})[_0xb84a('0x37')](function(){delete _0x11dd4d[_0xb84a('0x9')][_0x5716bd];});}catch(_0xf894a6){logger[_0xb84a('0x36')](_0xb84a('0x38'),_0xf894a6[_0xb84a('0x39')]);}};Acw['prototype'][_0xb84a('0x2c')]=function(_0x56d783){try{var _0x1a3115=this;if(_0x1a3115[_0xb84a('0x28')][_0x56d783]){_0x1a3115[_0xb84a('0x28')][_0x56d783]['timer']=![];var _0x4af084=_0x1a3115[_0xb84a('0x28')][_0x56d783][_0xb84a('0x2f')];var _0x4a3737=_0x1a3115[_0xb84a('0x28')][_0x56d783][_0xb84a('0x1b')];var _0x4cb5d4=_0x1a3115[_0xb84a('0x7')][_0x4a3737][_0xb84a('0x2a')];logger['info'](_0xb84a('0x3a'),_0x56d783);RpcUser[_0xb84a('0x3b')](this[_0xb84a('0x8')][_0x56d783]);RpcVoiceAgentReport[_0xb84a('0x31')]({'acwtime':_0x4cb5d4,'agentacw':!![]},_0x4af084,_0x56d783)['then'](function(_0x57a1a8){logger['info'](_0xb84a('0x32'),_0x4af084,_0x4cb5d4,_0x57a1a8);})[_0xb84a('0x33')](function(_0x43a071){logger[_0xb84a('0x36')]('[%s][UPDATE][ERRORS:%s]',_0x4af084,_0x43a071);});}else{logger[_0xb84a('0x36')]('[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer',_0x56d783);if(_0x1a3115[_0xb84a('0x28')]){logger['info']('[ACW][TIMERS]',JSON['stringify'](_0x1a3115[_0xb84a('0x28')]));}}}catch(_0x22791f){logger[_0xb84a('0x36')](_0xb84a('0x3c'),_0x22791f['message']);}};Acw[_0xb84a('0x18')][_0xb84a('0xa')]=function(_0x3908c3){try{if(this[_0xb84a('0x7')][_0x3908c3['queue']]&&(this['voiceQueues'][_0x3908c3[_0xb84a('0x1b')]][_0xb84a('0x3d')]||this['voiceQueues'][_0x3908c3[_0xb84a('0x1b')]][_0xb84a('0x1d')])){if(this[_0xb84a('0x8')][_0x3908c3[_0xb84a('0x1a')]]){this[_0xb84a('0x9')][_0x3908c3[_0xb84a('0x2f')]]={'queue':_0x3908c3[_0xb84a('0x1b')],'interface':_0x3908c3[_0xb84a('0x1a')],'destlinkedid':_0x3908c3[_0xb84a('0x26')]};}}}catch(_0xcd1e3b){logger[_0xb84a('0x36')](_0xb84a('0x3e'),_0xcd1e3b[_0xb84a('0x39')]);}};Acw[_0xb84a('0x18')][_0xb84a('0x14')]=function(_0x4ad7d0){try{if(this[_0xb84a('0x7')][_0x4ad7d0[_0xb84a('0x1b')]]&&(this[_0xb84a('0x7')][_0x4ad7d0[_0xb84a('0x1b')]][_0xb84a('0x3d')]||this[_0xb84a('0x7')][_0x4ad7d0['queue']][_0xb84a('0x1d')])){if(this['agents'][_0x4ad7d0[_0xb84a('0x1a')]]){this[_0xb84a('0x9')][_0x4ad7d0[_0xb84a('0x2f')]]={'queue':_0x4ad7d0[_0xb84a('0x1b')],'interface':_0x4ad7d0['interface']};}}}catch(_0x21ef72){logger[_0xb84a('0x36')](_0xb84a('0x3f'),_0x21ef72['message']);}};Acw['prototype'][_0xb84a('0xc')]=function(_0x10b0cc){try{if(this[_0xb84a('0x9')][_0x10b0cc['uniqueid']]&&_['isUndefined'](this['channels'][_0x10b0cc[_0xb84a('0x2f')]][_0xb84a('0x25')])){logger[_0xb84a('0x23')](_0xb84a('0x40'),_0x10b0cc[_0xb84a('0x2f')]);this['startAcw'](_0x10b0cc['uniqueid']);}else if(this['channels'][_0x10b0cc['linkedid']]&&_[_0xb84a('0x41')](this[_0xb84a('0x9')][_0x10b0cc['linkedid']][_0xb84a('0x25')])){logger[_0xb84a('0x23')](_0xb84a('0x42'),_0x10b0cc[_0xb84a('0x43')]);this[_0xb84a('0x19')](_0x10b0cc[_0xb84a('0x43')]);}}catch(_0x5a07d2){logger['error'](_0xb84a('0x44'),_0x5a07d2['message']);}};Acw[_0xb84a('0x18')]['syncHangup']=function(_0x575908){try{if(this['channels'][_0x575908[_0xb84a('0x2f')]]&&this[_0xb84a('0x9')][_0x575908[_0xb84a('0x2f')]][_0xb84a('0x25')]){logger[_0xb84a('0x23')](_0xb84a('0x45'),_0x575908[_0xb84a('0x2f')]);this[_0xb84a('0x19')](_0x575908['uniqueid']);}else if(this['channels'][_0x575908['linkedid']]&&this[_0xb84a('0x9')][_0x575908[_0xb84a('0x43')]]['attended']){logger[_0xb84a('0x23')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x575908['linkedid']);this['startAcw'](_0x575908[_0xb84a('0x43')]);}}catch(_0x172076){logger[_0xb84a('0x36')]('[ACW][syncHangup]\x20%s',_0x172076[_0xb84a('0x39')]);}};Acw[_0xb84a('0x18')][_0xb84a('0x10')]=function(_0x505994){try{if(!_[_0xb84a('0x46')](this['channels'][_0x505994['transfereeuniqueid']])){this[_0xb84a('0x19')](_0x505994['transfereeuniqueid']);if(this[_0xb84a('0x9')][_0x505994['secondtransfereruniqueid']]){this[_0xb84a('0x9')][_0x505994[_0xb84a('0x47')]][_0xb84a('0x25')]=!![];this[_0xb84a('0x9')][_0x505994['transfertargetuniqueid']]=this['channels'][_0x505994['secondtransfereruniqueid']];delete this[_0xb84a('0x9')][_0x505994[_0xb84a('0x47')]];}}else if(!_['isNil'](this['channels'][_0x505994[_0xb84a('0x48')]])){this[_0xb84a('0x19')](_0x505994[_0xb84a('0x48')]);if(this['channels'][_0x505994[_0xb84a('0x49')]]){this[_0xb84a('0x9')][_0x505994['origtransfereruniqueid']][_0xb84a('0x25')]=!![];this[_0xb84a('0x9')][_0x505994[_0xb84a('0x4a')]]=this[_0xb84a('0x9')][_0x505994[_0xb84a('0x49')]];delete this[_0xb84a('0x9')][_0x505994[_0xb84a('0x49')]];}}}catch(_0x47c27f){logger[_0xb84a('0x36')](_0xb84a('0x4b'),_0x47c27f['message']);}};Acw[_0xb84a('0x18')][_0xb84a('0x12')]=function(_0x34ac0f){try{if(this[_0xb84a('0x9')][_0x34ac0f[_0xb84a('0x4c')]]){logger[_0xb84a('0x23')](_0xb84a('0x4d'),JSON[_0xb84a('0x4e')](_0x34ac0f[_0xb84a('0x4c')]));this['startAcw'](_0x34ac0f[_0xb84a('0x4c')]);}else if(this['channels'][_0x34ac0f['transfererlinkedid']]){logger[_0xb84a('0x23')]('[%s][BLINDTRANSFER:LINKEDID]',JSON[_0xb84a('0x4e')](_0x34ac0f['transfererlinkedid']));this[_0xb84a('0x19')](_0x34ac0f[_0xb84a('0x4f')]);}}catch(_0x4c7d56){logger[_0xb84a('0x36')](_0xb84a('0x50'),_0x4c7d56[_0xb84a('0x39')]);}};Acw[_0xb84a('0x18')][_0xb84a('0x51')]=function(_0x192c9a){try{if(this[_0xb84a('0x7')][_0x192c9a['queue']]&&this[_0xb84a('0x7')][_0x192c9a['queue']]['autopause']===_0xb84a('0x52')){if(this[_0xb84a('0x8')][_0x192c9a[_0xb84a('0x1a')]]){logger[_0xb84a('0x23')]('[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]',_0x192c9a['uniqueid'],_0x192c9a[_0xb84a('0x1a')],_0x192c9a[_0xb84a('0x1b')]);return RpcUser[_0xb84a('0x27')](this[_0xb84a('0x8')][_0x192c9a['interface']],_0xb84a('0x53'),_0x192c9a['uniqueid']);}}}catch(_0x1eec1f){logger['error'](_0xb84a('0x54'),_0x1eec1f['message']);}};module['exports']=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 016a0cc..aa5a977 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 _0xab56=['actionSipPeerStatus','catch','log','asterisk-manager','bluebird','util','lodash','../../config/logger','ami','asterisk','username','password','Action','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','sipshowregistry','actionDeviceStateList','devicestatelist','actionQueueSummary','queuesummary','actionCoreShowChannels','info','port','once','close','connect','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then'];(function(_0x5cf4cb,_0x4b5144){var _0x37d15a=function(_0x3702f1){while(--_0x3702f1){_0x5cf4cb['push'](_0x5cf4cb['shift']());}};_0x37d15a(++_0x4b5144);}(_0xab56,0x16b));var _0x6ab5=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xab56[_0x139a3c];return _0x2b375b;};'use strict';var Manager=require(_0x6ab5('0x0'));var BPromise=require(_0x6ab5('0x1'));var moment=require('moment');var util=require(_0x6ab5('0x2'));var _=require(_0x6ab5('0x3'));var logger=require(_0x6ab5('0x4'))(_0x6ab5('0x5'));var config=require('../../config/environment');var ami=new Manager(config[_0x6ab5('0x6')]['port'],config[_0x6ab5('0x6')]['ip'],config[_0x6ab5('0x6')][_0x6ab5('0x7')],config['asterisk'][_0x6ab5('0x8')],!![]);ami['keepConnected']();ami[_0x6ab5('0x9')]=BPromise['promisify'](ami[_0x6ab5('0xa')]);function error(_0x5e8813){logger[_0x6ab5('0xb')](util[_0x6ab5('0xc')](_0x6ab5('0xd'),config[_0x6ab5('0x6')][_0x6ab5('0x7')],config[_0x6ab5('0x6')]['ip'],config[_0x6ab5('0x6')]['port'],util['inspect'](_0x5e8813,![],null)));}function close(){logger[_0x6ab5('0xb')](util[_0x6ab5('0xc')](_0x6ab5('0xe'),config[_0x6ab5('0x6')][_0x6ab5('0x7')],config['asterisk']['ip'],config[_0x6ab5('0x6')]['port']));}ami[_0x6ab5('0xf')]=function(){return function(){return ami['Action']({'action':_0x6ab5('0x10')});};};ami[_0x6ab5('0x11')]=function(){return function(){return ami[_0x6ab5('0x9')]({'action':_0x6ab5('0x12')});};};ami['actionSipPeerStatus']=function(){return function(){return ami[_0x6ab5('0x9')]({'action':'sippeerstatus'});};};ami[_0x6ab5('0x13')]=function(){return function(){return ami[_0x6ab5('0x9')]({'action':_0x6ab5('0x14')});};};ami[_0x6ab5('0x15')]=function(){return function(){return ami['Action']({'action':'coreshowchannels'});};};function connect(_0x448103){logger[_0x6ab5('0x16')](util[_0x6ab5('0xc')]('Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s',config[_0x6ab5('0x6')]['username'],config[_0x6ab5('0x6')]['ip'],config[_0x6ab5('0x6')][_0x6ab5('0x17')]));ami[_0x6ab5('0x18')](_0x6ab5('0xb'),error);ami[_0x6ab5('0x18')](_0x6ab5('0x19'),close);}ami['on'](_0x6ab5('0x1a'),connect);ami['on'](_0x6ab5('0x1b'),function(_0x363e89){logger[_0x6ab5('0x16')](util['format'](_0x6ab5('0x1c'),config['asterisk'][_0x6ab5('0x7')],config[_0x6ab5('0x6')]['ip'],config[_0x6ab5('0x6')][_0x6ab5('0x17')],util['inspect'](_0x363e89,![],null)));});ami['on'](_0x6ab5('0x1d'),function(_0x3e5bb4){logger['info'](util['format'](_0x6ab5('0x1e'),config[_0x6ab5('0x6')][_0x6ab5('0x7')],config[_0x6ab5('0x6')]['ip'],config[_0x6ab5('0x6')]['port']));return BPromise[_0x6ab5('0x1f')]()[_0x6ab5('0x20')](ami[_0x6ab5('0xf')]())[_0x6ab5('0x20')](ami[_0x6ab5('0x11')]())[_0x6ab5('0x20')](ami[_0x6ab5('0x21')]())[_0x6ab5('0x20')](ami['actionQueueSummary']())['then'](ami[_0x6ab5('0x15')]())[_0x6ab5('0x22')](function(_0x509c56){console[_0x6ab5('0x23')](_0x509c56);});});ami[_0x6ab5('0x18')](_0x6ab5('0xb'),error);ami[_0x6ab5('0x18')](_0x6ab5('0x19'),close);module['exports']=ami; \ No newline at end of file +var _0x193e=['then','catch','log','exports','asterisk-manager','bluebird','moment','util','lodash','ami','../../config/environment','asterisk','username','password','keepConnected','Action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','port','inspect','actionSipShowRegistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve'];(function(_0xe73080,_0x24c56d){var _0x12cbc4=function(_0x1377e2){while(--_0x1377e2){_0xe73080['push'](_0xe73080['shift']());}};_0x12cbc4(++_0x24c56d);}(_0x193e,0xe8));var _0xe193=function(_0x270479,_0xc9b4f1){_0x270479=_0x270479-0x0;var _0x3e69e1=_0x193e[_0x270479];return _0x3e69e1;};'use strict';var Manager=require(_0xe193('0x0'));var BPromise=require(_0xe193('0x1'));var moment=require(_0xe193('0x2'));var util=require(_0xe193('0x3'));var _=require(_0xe193('0x4'));var logger=require('../../config/logger')(_0xe193('0x5'));var config=require(_0xe193('0x6'));var ami=new Manager(config[_0xe193('0x7')]['port'],config['asterisk']['ip'],config[_0xe193('0x7')][_0xe193('0x8')],config[_0xe193('0x7')][_0xe193('0x9')],!![]);ami[_0xe193('0xa')]();ami[_0xe193('0xb')]=BPromise['promisify'](ami['action']);function error(_0x27a7e3){logger[_0xe193('0xc')](util[_0xe193('0xd')](_0xe193('0xe'),config['asterisk']['username'],config[_0xe193('0x7')]['ip'],config[_0xe193('0x7')][_0xe193('0xf')],util[_0xe193('0x10')](_0x27a7e3,![],null)));}function close(){logger[_0xe193('0xc')](util[_0xe193('0xd')]('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config[_0xe193('0x7')][_0xe193('0x8')],config[_0xe193('0x7')]['ip'],config['asterisk'][_0xe193('0xf')]));}ami[_0xe193('0x11')]=function(){return function(){return ami['Action']({'action':'sipshowregistry'});};};ami[_0xe193('0x12')]=function(){return function(){return ami[_0xe193('0xb')]({'action':_0xe193('0x13')});};};ami[_0xe193('0x14')]=function(){return function(){return ami[_0xe193('0xb')]({'action':_0xe193('0x15')});};};ami[_0xe193('0x16')]=function(){return function(){return ami[_0xe193('0xb')]({'action':_0xe193('0x17')});};};ami[_0xe193('0x18')]=function(){return function(){return ami[_0xe193('0xb')]({'action':_0xe193('0x19')});};};function connect(_0x37145d){logger[_0xe193('0x1a')](util[_0xe193('0xd')](_0xe193('0x1b'),config[_0xe193('0x7')][_0xe193('0x8')],config[_0xe193('0x7')]['ip'],config[_0xe193('0x7')]['port']));ami['once'](_0xe193('0xc'),error);ami[_0xe193('0x1c')]('close',close);}ami['on']('connect',connect);ami['on'](_0xe193('0x1d'),function(_0x51fe88){logger[_0xe193('0x1a')](util['format'](_0xe193('0x1e'),config[_0xe193('0x7')][_0xe193('0x8')],config[_0xe193('0x7')]['ip'],config[_0xe193('0x7')][_0xe193('0xf')],util['inspect'](_0x51fe88,![],null)));});ami['on'](_0xe193('0x1f'),function(_0x474253){logger[_0xe193('0x1a')](util[_0xe193('0xd')](_0xe193('0x20'),config[_0xe193('0x7')]['username'],config['asterisk']['ip'],config[_0xe193('0x7')][_0xe193('0xf')]));return BPromise[_0xe193('0x21')]()[_0xe193('0x22')](ami[_0xe193('0x11')]())[_0xe193('0x22')](ami[_0xe193('0x12')]())['then'](ami[_0xe193('0x14')]())[_0xe193('0x22')](ami['actionQueueSummary']())[_0xe193('0x22')](ami[_0xe193('0x18')]())[_0xe193('0x23')](function(_0x9d2b0f){console[_0xe193('0x24')](_0x9d2b0f);});});ami['once'](_0xe193('0xc'),error);ami['once']('close',close);module[_0xe193('0x25')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 01f3840..d564a08 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 _0xf08b=['then','debug','rpc','error','memberReport','message','catch','bluebird','../../config/logger','ami','client','Request'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xf08b,0xbb));var _0xbf08=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xf08b[_0x2c91e9];return _0x13f0ff;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xbf08('0x0'));var logger=require(_0xbf08('0x1'))(_0xbf08('0x2'));var client=jayson[_0xbf08('0x3')]['http']({'port':0x2329});client[_0xbf08('0x4')]=function(_0x29ce5a,_0x57b78a){return new BPromise(function(_0x23bb32,_0x30f660){return client['request'](_0x29ce5a,_0x57b78a)[_0xbf08('0x5')](function(_0x35ec1d){logger[_0xbf08('0x6')](_0xbf08('0x7'),'memberReport',_0x29ce5a,_0x57b78a,_0x35ec1d);if(_0x35ec1d[_0xbf08('0x8')]){logger['error'](_0xbf08('0x7'),_0xbf08('0x9'),_0x29ce5a,_0x35ec1d['error'][_0xbf08('0xa')],_0x57b78a);return _0x30f660(_0x35ec1d[_0xbf08('0x8')][_0xbf08('0xa')]);}else{return _0x23bb32(_0x35ec1d['result']);}})[_0xbf08('0xb')](function(_0x386926){logger['error']('rpc',_0xbf08('0x9'),_0x29ce5a,_0x386926,_0x57b78a);return _0x30f660(_0x386926);});});};module['exports']=client; \ No newline at end of file +var _0xe60e=['catch','exports','bluebird','../../config/logger','ami','client','Request','request','debug','memberReport','rpc','error','message','result'];(function(_0x8d695e,_0x394999){var _0x3d156e=function(_0x38cf6f){while(--_0x38cf6f){_0x8d695e['push'](_0x8d695e['shift']());}};_0x3d156e(++_0x394999);}(_0xe60e,0xf0));var _0xee60=function(_0x17d14d,_0xb83ea7){_0x17d14d=_0x17d14d-0x0;var _0x46d4e1=_0xe60e[_0x17d14d];return _0x46d4e1;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xee60('0x0'));var logger=require(_0xee60('0x1'))(_0xee60('0x2'));var client=jayson[_0xee60('0x3')]['http']({'port':0x2329});client[_0xee60('0x4')]=function(_0x212919,_0x3c313a){return new BPromise(function(_0x55a28e,_0x5c5f01){return client[_0xee60('0x5')](_0x212919,_0x3c313a)['then'](function(_0x437e7e){logger[_0xee60('0x6')]('rpc',_0xee60('0x7'),_0x212919,_0x3c313a,_0x437e7e);if(_0x437e7e['error']){logger['error'](_0xee60('0x8'),_0xee60('0x7'),_0x212919,_0x437e7e[_0xee60('0x9')][_0xee60('0xa')],_0x3c313a);return _0x5c5f01(_0x437e7e[_0xee60('0x9')][_0xee60('0xa')]);}else{return _0x55a28e(_0x437e7e[_0xee60('0xb')]);}})[_0xee60('0xc')](function(_0x139cea){logger['error'](_0xee60('0x8'),_0xee60('0x7'),_0x212919,_0x139cea,_0x3c313a);return _0x5c5f01(_0x139cea);});});};module[_0xee60('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 7ebb972..a22b0aa 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 _0x306e=['util','lodash','isNil','string','voiceQueue','uniqueid','name','Contact','phone','firstName','lastName','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','ContactFirstName','starttime','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','prototype','getCaller','format','\x22%s\x22\x20<%s>','dialCutDigit','number','substring','getQueue'];(function(_0x179e11,_0xf65436){var _0x549f04=function(_0x610545){while(--_0x610545){_0x179e11['push'](_0x179e11['shift']());}};_0x549f04(++_0xf65436);}(_0x306e,0x13b));var _0xe306=function(_0x1200d7,_0x5866a5){_0x1200d7=_0x1200d7-0x0;var _0x384b47=_0x306e[_0x1200d7];return _0x384b47;};'use strict';var util=require(_0xe306('0x0'));var _=require(_0xe306('0x1'));var moment=require('moment');function checkNameSurname(_0x42088e,_0x3c71d2,_0x19ad5e){var _0x22f3fa='';if(!_[_0xe306('0x2')](_0x3c71d2)&&_0xe306('0x3')===typeof _0x3c71d2){_0x22f3fa+=_0x3c71d2;}if(!_[_0xe306('0x2')](_0x19ad5e)&&'string'===typeof _0x19ad5e){_0x22f3fa+='\x20'+_0x19ad5e;}if(_0x22f3fa!==''){return _0x22f3fa;}return _0x42088e;}function Action(_0x2ba3a8,_0x239ba,_0x575e2f){this[_0xe306('0x4')]=_0x2ba3a8;this[_0xe306('0x5')]=_0x575e2f||undefined;this[_0xe306('0x6')]=checkNameSurname(_0x239ba[_0xe306('0x7')][_0xe306('0x8')],_0x239ba[_0xe306('0x7')][_0xe306('0x9')],_0x239ba[_0xe306('0x7')][_0xe306('0xa')]);this['number']=_0x239ba[_0xe306('0x7')][_0xe306('0x8')];this[_0xe306('0xb')]=_0x2ba3a8[_0xe306('0x6')];this[_0xe306('0xc')]=_0x239ba[_0xe306('0xc')]||![];this[_0xe306('0xd')]=_0x2ba3a8['type'];this[_0xe306('0xe')]=_0x2ba3a8['dialQueueTimeout']||0x3;this[_0xe306('0xf')]=_0x239ba[_0xe306('0xf')];this[_0xe306('0x10')]=_0x239ba[_0xe306('0x10')];this[_0xe306('0x11')]=_0x239ba[_0xe306('0x11')];this[_0xe306('0x12')]=_0x239ba[_0xe306('0x12')];this[_0xe306('0x13')]=_0x239ba[_0xe306('0x13')];this[_0xe306('0x14')]=_0x239ba[_0xe306('0x14')];this['countabandonedretry']=_0x239ba[_0xe306('0x15')];this[_0xe306('0x16')]=_0x239ba['countmachineretry'];this[_0xe306('0x17')]=_0x239ba['countagentrejectretry'];this[_0xe306('0x18')]=_0x239ba[_0xe306('0x18')];this[_0xe306('0x19')]=_0x239ba[_0xe306('0x19')];this['UserId']=_0x239ba[_0xe306('0x1a')];this[_0xe306('0x1b')]=_0x239ba[_0xe306('0x1b')];this[_0xe306('0x1c')]=_0x239ba['CampaignId'];this['idHopper']=_0x239ba['id'];this[_0xe306('0x1d')]=_0x239ba['Contact'][_0xe306('0x9')]||'';this[_0xe306('0x1e')]=moment()['format'](_0xe306('0x1f'));this['callback']=_0x239ba[_0xe306('0x20')];this[_0xe306('0x21')]=_0x239ba[_0xe306('0x21')];this[_0xe306('0x22')]=_0x239ba[_0xe306('0x22')];this[_0xe306('0x23')]=_0x239ba[_0xe306('0x23')];this[_0xe306('0x24')]='';this['originatecalleridname']='';}Action[_0xe306('0x25')][_0xe306('0x26')]=function(){return util[_0xe306('0x27')](_0xe306('0x28'),this[_0xe306('0x6')],this['voiceQueue'][_0xe306('0x29')]>0x0?this[_0xe306('0x2a')][_0xe306('0x2b')](this[_0xe306('0x4')][_0xe306('0x29')]):this[_0xe306('0x2a')]);};Action[_0xe306('0x25')][_0xe306('0x2c')]=function(){return this[_0xe306('0xb')];};module['exports']=Action; \ No newline at end of file +var _0xbdd4=['type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','starttime','YYYY-MM-DD\x20HH:mm:ss','callback','callbackat','recallme','originatecalleridnum','originatecalleridname','getCaller','format','\x22%s\x22\x20<%s>','name','voiceQueue','dialCutDigit','prototype','getQueue','exports','moment','isNil','string','Contact','firstName','lastName','number','phone','queue','active'];(function(_0x24061a,_0x1c9f4d){var _0x82054e=function(_0x2ec346){while(--_0x2ec346){_0x24061a['push'](_0x24061a['shift']());}};_0x82054e(++_0x1c9f4d);}(_0xbdd4,0x14e));var _0x4bdd=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0xbdd4[_0x37c22c];return _0x119d79;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x4bdd('0x0'));function checkNameSurname(_0x1f879b,_0x4eb082,_0x4c482d){var _0x1f2395='';if(!_[_0x4bdd('0x1')](_0x4eb082)&&'string'===typeof _0x4eb082){_0x1f2395+=_0x4eb082;}if(!_[_0x4bdd('0x1')](_0x4c482d)&&_0x4bdd('0x2')===typeof _0x4c482d){_0x1f2395+='\x20'+_0x4c482d;}if(_0x1f2395!==''){return _0x1f2395;}return _0x1f879b;}function Action(_0x237364,_0x494b9d,_0x19a31a){this['voiceQueue']=_0x237364;this['uniqueid']=_0x19a31a||undefined;this['name']=checkNameSurname(_0x494b9d[_0x4bdd('0x3')]['phone'],_0x494b9d[_0x4bdd('0x3')][_0x4bdd('0x4')],_0x494b9d['Contact'][_0x4bdd('0x5')]);this[_0x4bdd('0x6')]=_0x494b9d[_0x4bdd('0x3')][_0x4bdd('0x7')];this[_0x4bdd('0x8')]=_0x237364['name'];this[_0x4bdd('0x9')]=_0x494b9d[_0x4bdd('0x9')]||![];this[_0x4bdd('0xa')]=_0x237364[_0x4bdd('0xa')];this[_0x4bdd('0xb')]=_0x237364['dialQueueTimeout']||0x3;this[_0x4bdd('0xc')]=_0x494b9d[_0x4bdd('0xc')];this[_0x4bdd('0xd')]=_0x494b9d[_0x4bdd('0xd')];this[_0x4bdd('0xe')]=_0x494b9d[_0x4bdd('0xe')];this[_0x4bdd('0xf')]=_0x494b9d[_0x4bdd('0xf')];this[_0x4bdd('0x10')]=_0x494b9d['countnosuchnumberretry'];this['countdropretry']=_0x494b9d[_0x4bdd('0x11')];this[_0x4bdd('0x12')]=_0x494b9d[_0x4bdd('0x12')];this[_0x4bdd('0x13')]=_0x494b9d[_0x4bdd('0x13')];this[_0x4bdd('0x14')]=_0x494b9d[_0x4bdd('0x14')];this[_0x4bdd('0x15')]=_0x494b9d['ContactId'];this[_0x4bdd('0x16')]=_0x494b9d[_0x4bdd('0x16')];this[_0x4bdd('0x17')]=_0x494b9d[_0x4bdd('0x17')];this[_0x4bdd('0x18')]=_0x494b9d['VoiceQueueId'];this[_0x4bdd('0x19')]=_0x494b9d['CampaignId'];this[_0x4bdd('0x1a')]=_0x494b9d['id'];this['ContactFirstName']=_0x494b9d[_0x4bdd('0x3')][_0x4bdd('0x4')]||'';this[_0x4bdd('0x1b')]=moment()['format'](_0x4bdd('0x1c'));this[_0x4bdd('0x1d')]=_0x494b9d[_0x4bdd('0x1d')];this['callbackuniqueid']=_0x494b9d['callbackuniqueid'];this[_0x4bdd('0x1e')]=_0x494b9d[_0x4bdd('0x1e')];this[_0x4bdd('0x1f')]=_0x494b9d['recallme'];this[_0x4bdd('0x20')]='';this[_0x4bdd('0x21')]='';}Action['prototype'][_0x4bdd('0x22')]=function(){return util[_0x4bdd('0x23')](_0x4bdd('0x24'),this[_0x4bdd('0x25')],this[_0x4bdd('0x26')]['dialCutDigit']>0x0?this[_0x4bdd('0x6')]['substring'](this[_0x4bdd('0x26')][_0x4bdd('0x27')]):this[_0x4bdd('0x6')]);};Action[_0x4bdd('0x28')][_0x4bdd('0x29')]=function(){return this[_0x4bdd('0x8')];};module[_0x4bdd('0x2a')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index f792156..46505a5 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 _0xd507=['countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countmachineretry','countagentrejectretry','countdropretry','countabandonedretry','uniqueid','calleridname','name','calleridnum','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','answertime','talktime','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','diff','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry'];(function(_0x10cccd,_0x34cb5c){var _0x59c7f8=function(_0xb6ff06){while(--_0xb6ff06){_0x10cccd['push'](_0x10cccd['shift']());}};_0x59c7f8(++_0x34cb5c);}(_0xd507,0x180));var _0x7d50=function(_0x1f2470,_0x235e3f){_0x1f2470=_0x1f2470-0x0;var _0xbfd8ab=_0xd507[_0x1f2470];return _0xbfd8ab;};'use strict';var util=require(_0x7d50('0x0'));var _=require(_0x7d50('0x1'));var moment=require('moment');function getSeconds(_0x43d266,_0x5d924e){var _0x15f667=moment(_0x43d266)['milliseconds'](0x0);var _0x28bbf6=moment(_0x5d924e)['milliseconds'](0x0);return _0x15f667[_0x7d50('0x2')](_0x28bbf6,'seconds');}function AgentComplete(_0x6115e3,_0x415829){this[_0x7d50('0x3')]=0x4;this[_0x7d50('0x4')]=_0x7d50('0x5');this[_0x7d50('0x6')]=_0x6115e3[_0x7d50('0x6')];this['type']=_0x6115e3[_0x7d50('0x7')];this[_0x7d50('0x8')]=_0x6115e3['type']===_0x7d50('0x9')?_0x7d50('0xa'):_0x6115e3[_0x7d50('0x7')];this['countbusyretry']=_0x6115e3[_0x7d50('0xb')];this[_0x7d50('0xc')]=_0x6115e3[_0x7d50('0xc')];this[_0x7d50('0xd')]=_0x6115e3[_0x7d50('0xd')];this[_0x7d50('0xe')]=_0x6115e3[_0x7d50('0xb')]+_0x6115e3[_0x7d50('0xc')]+_0x6115e3[_0x7d50('0xd')]+_0x6115e3[_0x7d50('0xf')]+_0x6115e3['countdropretry']+_0x6115e3['countabandonedretry']+_0x6115e3[_0x7d50('0x10')]+_0x6115e3[_0x7d50('0x11')];this['countnosuchnumberretry']=_0x6115e3[_0x7d50('0xf')];this[_0x7d50('0x12')]=_0x6115e3['countdropretry'];this[_0x7d50('0x13')]=_0x6115e3[_0x7d50('0x13')];this[_0x7d50('0x10')]=_0x6115e3[_0x7d50('0x10')];this[_0x7d50('0x11')]=_0x6115e3[_0x7d50('0x11')];this['uniqueid']=_0x415829[_0x7d50('0x14')];this[_0x7d50('0x15')]=_0x6115e3[_0x7d50('0x16')];this[_0x7d50('0x17')]=_0x6115e3['number'];this[_0x7d50('0x18')]=_0x6115e3[_0x7d50('0x18')];this[_0x7d50('0x19')]=_0x6115e3[_0x7d50('0x19')];this['answertime']=_0x6115e3['answertime'];this[_0x7d50('0x1a')]=moment()[_0x7d50('0x1b')](_0x7d50('0x1c'));this[_0x7d50('0x1d')]=getSeconds(_0x6115e3[_0x7d50('0x19')],_0x6115e3[_0x7d50('0x18')]);this[_0x7d50('0x1e')]=getSeconds(_0x6115e3[_0x7d50('0x1f')],_0x6115e3['responsetime']);this[_0x7d50('0x20')]=getSeconds(this['endtime'],_0x6115e3[_0x7d50('0x1f')]);this[_0x7d50('0xa')]=_0x415829[_0x7d50('0xa')];this['membername']=_0x415829['membername'];this[_0x7d50('0x21')]=_0x415829['reason'];this[_0x7d50('0x22')]=_0x6115e3[_0x7d50('0x22')];this['callbackuniqueid']=_0x6115e3[_0x7d50('0x23')];this['callbackat']=_0x6115e3[_0x7d50('0x24')];this['recallme']=_0x6115e3[_0x7d50('0x25')];this[_0x7d50('0x26')]=_0x6115e3[_0x7d50('0x26')];this['ListId']=_0x6115e3[_0x7d50('0x27')];this['UserId']=_0x6115e3['UserId'];this['VoiceQueueId']=_0x6115e3['VoiceQueueId'];this[_0x7d50('0x28')]=_0x6115e3[_0x7d50('0x28')];this[_0x7d50('0x29')]=_0x6115e3['originatecalleridnum']||'';this[_0x7d50('0x2a')]=_0x6115e3[_0x7d50('0x2a')]||'';}module[_0x7d50('0x2b')]=AgentComplete; \ No newline at end of file +var _0x1bf1=['callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','milliseconds','diff','seconds','statedesc','Answer','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','number','starttime','responsetime','answertime','endtime','format','ringtime','holdtime','membername','reason','callback'];(function(_0x1ca094,_0x2adb4e){var _0x2387b9=function(_0x359f7e){while(--_0x359f7e){_0x1ca094['push'](_0x1ca094['shift']());}};_0x2387b9(++_0x2adb4e);}(_0x1bf1,0xb3));var _0x11bf=function(_0x1fa007,_0x5d3503){_0x1fa007=_0x1fa007-0x0;var _0x24a0c2=_0x1bf1[_0x1fa007];return _0x24a0c2;};'use strict';var util=require(_0x11bf('0x0'));var _=require('lodash');var moment=require('moment');function getSeconds(_0x383f93,_0x5f3068){var _0x3c273f=moment(_0x383f93)[_0x11bf('0x1')](0x0);var _0x519024=moment(_0x5f3068)[_0x11bf('0x1')](0x0);return _0x3c273f[_0x11bf('0x2')](_0x519024,_0x11bf('0x3'));}function AgentComplete(_0x558064,_0x2d9e08){this['state']=0x4;this[_0x11bf('0x4')]=_0x11bf('0x5');this['scheduledat']=_0x558064[_0x11bf('0x6')];this[_0x11bf('0x7')]=_0x558064['type'];this['campaigntype']=_0x558064[_0x11bf('0x7')]===_0x11bf('0x8')?_0x11bf('0x9'):_0x558064[_0x11bf('0x7')];this[_0x11bf('0xa')]=_0x558064[_0x11bf('0xa')];this[_0x11bf('0xb')]=_0x558064[_0x11bf('0xb')];this[_0x11bf('0xc')]=_0x558064[_0x11bf('0xc')];this[_0x11bf('0xd')]=_0x558064[_0x11bf('0xa')]+_0x558064['countcongestionretry']+_0x558064[_0x11bf('0xc')]+_0x558064[_0x11bf('0xe')]+_0x558064[_0x11bf('0xf')]+_0x558064['countabandonedretry']+_0x558064[_0x11bf('0x10')]+_0x558064[_0x11bf('0x11')];this[_0x11bf('0xe')]=_0x558064[_0x11bf('0xe')];this[_0x11bf('0xf')]=_0x558064[_0x11bf('0xf')];this['countabandonedretry']=_0x558064['countabandonedretry'];this[_0x11bf('0x10')]=_0x558064[_0x11bf('0x10')];this[_0x11bf('0x11')]=_0x558064[_0x11bf('0x11')];this[_0x11bf('0x12')]=_0x2d9e08[_0x11bf('0x12')];this[_0x11bf('0x13')]=_0x558064['name'];this['calleridnum']=_0x558064[_0x11bf('0x14')];this[_0x11bf('0x15')]=_0x558064[_0x11bf('0x15')];this['responsetime']=_0x558064[_0x11bf('0x16')];this[_0x11bf('0x17')]=_0x558064[_0x11bf('0x17')];this[_0x11bf('0x18')]=moment()[_0x11bf('0x19')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x11bf('0x1a')]=getSeconds(_0x558064[_0x11bf('0x16')],_0x558064['starttime']);this[_0x11bf('0x1b')]=getSeconds(_0x558064[_0x11bf('0x17')],_0x558064[_0x11bf('0x16')]);this['talktime']=getSeconds(this[_0x11bf('0x18')],_0x558064[_0x11bf('0x17')]);this[_0x11bf('0x9')]=_0x2d9e08[_0x11bf('0x9')];this['membername']=_0x2d9e08[_0x11bf('0x1c')];this[_0x11bf('0x1d')]=_0x2d9e08['reason'];this['callback']=_0x558064[_0x11bf('0x1e')];this[_0x11bf('0x1f')]=_0x558064[_0x11bf('0x1f')];this[_0x11bf('0x20')]=_0x558064[_0x11bf('0x20')];this['recallme']=_0x558064[_0x11bf('0x21')];this[_0x11bf('0x22')]=_0x558064[_0x11bf('0x22')];this['ListId']=_0x558064[_0x11bf('0x23')];this[_0x11bf('0x24')]=_0x558064[_0x11bf('0x24')];this[_0x11bf('0x25')]=_0x558064['VoiceQueueId'];this[_0x11bf('0x26')]=_0x558064[_0x11bf('0x26')];this[_0x11bf('0x27')]=_0x558064[_0x11bf('0x27')]||'';this[_0x11bf('0x28')]=_0x558064['originatecalleridname']||'';}module[_0x11bf('0x29')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index b17dc5f..059c3ef 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 _0x5d56=['callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','moment','milliseconds','uniqueid','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countagentrejectretry','countnosuchnumberretry','countmachineretry','queue','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime'];(function(_0x422a6e,_0x51e8c9){var _0x56a178=function(_0x2693d5){while(--_0x2693d5){_0x422a6e['push'](_0x422a6e['shift']());}};_0x56a178(++_0x51e8c9);}(_0x5d56,0x134));var _0x65d5=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x5d56[_0x126558];return _0x1f6d14;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x65d5('0x0'));function getSeconds(_0x2ed20a,_0x59d535){var _0x310a0f=moment(_0x2ed20a)[_0x65d5('0x1')](0x0);var _0x2ba334=moment(_0x59d535)[_0x65d5('0x1')](0x0);return _0x310a0f['diff'](_0x2ba334,'seconds');}function Final(_0x8a1b90){this['uniqueid']=_0x8a1b90[_0x65d5('0x2')];this[_0x65d5('0x3')]=_0x8a1b90[_0x65d5('0x3')];this['type']=_0x8a1b90[_0x65d5('0x4')];this[_0x65d5('0x5')]=_0x8a1b90['type']===_0x65d5('0x6')?'queue':_0x8a1b90[_0x65d5('0x4')];this['countbusyretry']=_0x8a1b90[_0x65d5('0x7')];this[_0x65d5('0x8')]=_0x8a1b90['countcongestionretry'];this['countnoanswerretry']=_0x8a1b90[_0x65d5('0x9')];this[_0x65d5('0xa')]=_0x8a1b90['countbusyretry']+_0x8a1b90[_0x65d5('0x8')]+_0x8a1b90[_0x65d5('0x9')]+_0x8a1b90['countnosuchnumberretry']+_0x8a1b90[_0x65d5('0xb')]+_0x8a1b90[_0x65d5('0xc')]+_0x8a1b90['countmachineretry']+_0x8a1b90[_0x65d5('0xd')];this[_0x65d5('0xe')]=_0x8a1b90[_0x65d5('0xe')];this[_0x65d5('0xb')]=_0x8a1b90[_0x65d5('0xb')];this[_0x65d5('0xc')]=_0x8a1b90['countabandonedretry'];this[_0x65d5('0xf')]=_0x8a1b90[_0x65d5('0xf')];this[_0x65d5('0xd')]=_0x8a1b90['countagentrejectretry'];this[_0x65d5('0x10')]=_0x8a1b90[_0x65d5('0x10')];this[_0x65d5('0x11')]=_0x8a1b90[_0x65d5('0x11')];this[_0x65d5('0x12')]=_0x8a1b90['calleridnum'];this[_0x65d5('0x13')]=_0x8a1b90[_0x65d5('0x13')];this[_0x65d5('0x14')]=_0x8a1b90[_0x65d5('0x14')];this[_0x65d5('0x15')]=_0x8a1b90[_0x65d5('0x14')];this[_0x65d5('0x16')]=_0x8a1b90[_0x65d5('0x16')]||0x0;this[_0x65d5('0x17')]=_0x8a1b90[_0x65d5('0x17')]||0x0;this[_0x65d5('0x18')]=_0x8a1b90[_0x65d5('0x18')]||0x0;this[_0x65d5('0x19')]=_0x8a1b90['callback'];this[_0x65d5('0x1a')]=_0x8a1b90[_0x65d5('0x1a')];this['callbackat']=_0x8a1b90[_0x65d5('0x1b')];this['recallme']=_0x8a1b90[_0x65d5('0x1c')];this[_0x65d5('0x1d')]=_0x8a1b90[_0x65d5('0x1d')];this[_0x65d5('0x1e')]=_0x8a1b90['ListId'];this[_0x65d5('0x1f')]=_0x8a1b90['UserId'];this[_0x65d5('0x20')]=_0x8a1b90['VoiceQueueId'];this[_0x65d5('0x21')]=_0x8a1b90[_0x65d5('0x21')];this[_0x65d5('0x22')]=_0x8a1b90['originatecalleridnum']||'';this[_0x65d5('0x23')]=_0x8a1b90[_0x65d5('0x23')]||'';}module[_0x65d5('0x24')]=Final; \ No newline at end of file +var _0xb258=['originatecalleridnum','originatecalleridname','util','lodash','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','calleridname','calleridnum','starttime','responsetime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId'];(function(_0x21adf3,_0x487623){var _0x1817f3=function(_0x120152){while(--_0x120152){_0x21adf3['push'](_0x21adf3['shift']());}};_0x1817f3(++_0x487623);}(_0xb258,0xe6));var _0x8b25=function(_0x5ac6d8,_0x113ac6){_0x5ac6d8=_0x5ac6d8-0x0;var _0x235603=_0xb258[_0x5ac6d8];return _0x235603;};'use strict';var util=require(_0x8b25('0x0'));var _=require(_0x8b25('0x1'));var moment=require('moment');function getSeconds(_0x3566d2,_0x45f3fd){var _0x29730c=moment(_0x3566d2)[_0x8b25('0x2')](0x0);var _0xb410cc=moment(_0x45f3fd)[_0x8b25('0x2')](0x0);return _0x29730c[_0x8b25('0x3')](_0xb410cc,_0x8b25('0x4'));}function Final(_0x25a785){this[_0x8b25('0x5')]=_0x25a785[_0x8b25('0x5')];this[_0x8b25('0x6')]=_0x25a785[_0x8b25('0x6')];this[_0x8b25('0x7')]=_0x25a785['type'];this[_0x8b25('0x8')]=_0x25a785['type']===_0x8b25('0x9')?_0x8b25('0xa'):_0x25a785['type'];this[_0x8b25('0xb')]=_0x25a785['countbusyretry'];this[_0x8b25('0xc')]=_0x25a785['countcongestionretry'];this[_0x8b25('0xd')]=_0x25a785[_0x8b25('0xd')];this[_0x8b25('0xe')]=_0x25a785[_0x8b25('0xb')]+_0x25a785[_0x8b25('0xc')]+_0x25a785[_0x8b25('0xd')]+_0x25a785[_0x8b25('0xf')]+_0x25a785[_0x8b25('0x10')]+_0x25a785['countabandonedretry']+_0x25a785[_0x8b25('0x11')]+_0x25a785[_0x8b25('0x12')];this['countnosuchnumberretry']=_0x25a785['countnosuchnumberretry'];this[_0x8b25('0x10')]=_0x25a785[_0x8b25('0x10')];this[_0x8b25('0x13')]=_0x25a785['countabandonedretry'];this[_0x8b25('0x11')]=_0x25a785['countmachineretry'];this[_0x8b25('0x12')]=_0x25a785['countagentrejectretry'];this[_0x8b25('0xa')]=_0x25a785[_0x8b25('0xa')];this[_0x8b25('0x14')]=_0x25a785[_0x8b25('0x14')];this[_0x8b25('0x15')]=_0x25a785[_0x8b25('0x15')];this[_0x8b25('0x16')]=_0x25a785[_0x8b25('0x16')];this[_0x8b25('0x17')]=_0x25a785[_0x8b25('0x17')];this['endtime']=_0x25a785[_0x8b25('0x17')];this[_0x8b25('0x18')]=_0x25a785[_0x8b25('0x18')]||0x0;this[_0x8b25('0x19')]=_0x25a785['holdtime']||0x0;this[_0x8b25('0x1a')]=_0x25a785[_0x8b25('0x1a')]||0x0;this['callback']=_0x25a785[_0x8b25('0x1b')];this[_0x8b25('0x1c')]=_0x25a785[_0x8b25('0x1c')];this[_0x8b25('0x1d')]=_0x25a785['callbackat'];this[_0x8b25('0x1e')]=_0x25a785['recallme'];this[_0x8b25('0x1f')]=_0x25a785[_0x8b25('0x1f')];this['ListId']=_0x25a785[_0x8b25('0x20')];this[_0x8b25('0x21')]=_0x25a785[_0x8b25('0x21')];this[_0x8b25('0x22')]=_0x25a785[_0x8b25('0x22')];this['CampaignId']=_0x25a785[_0x8b25('0x23')];this[_0x8b25('0x24')]=_0x25a785[_0x8b25('0x24')]||'';this[_0x8b25('0x25')]=_0x25a785['originatecalleridname']||'';}module['exports']=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index d901d77..4b3b6dc 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 _0x0830=['ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','moment','milliseconds','diff','state','statedesc','Answer','scheduledat','type','campaigntype','queue','countbusyretry','countnoanswerretry','countglobal','countcongestionretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','number','starttime','responsetime','YYYY-MM-DD\x20HH:mm:ss','holdtime','talktime','membername','IVR','reason','cause-txt','callback','callbackat','recallme'];(function(_0x1d60fd,_0xa917f5){var _0x3941b5=function(_0x95a8ef){while(--_0x95a8ef){_0x1d60fd['push'](_0x1d60fd['shift']());}};_0x3941b5(++_0xa917f5);}(_0x0830,0x7e));var _0x0083=function(_0x4c9296,_0x5d07f5){_0x4c9296=_0x4c9296-0x0;var _0x3d8557=_0x0830[_0x4c9296];return _0x3d8557;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x0083('0x0'));function getSeconds(_0x1931cc,_0x52acb0){var _0x4e57ca=moment(_0x1931cc)[_0x0083('0x1')](0x0);var _0x585f2f=moment(_0x52acb0)['milliseconds'](0x0);return _0x4e57ca[_0x0083('0x2')](_0x585f2f,'seconds');}function Hangup(_0x1cba24,_0x424422){this[_0x0083('0x3')]=0x4;this[_0x0083('0x4')]=_0x0083('0x5');this[_0x0083('0x6')]=_0x1cba24[_0x0083('0x6')];this[_0x0083('0x7')]=_0x1cba24[_0x0083('0x7')];this[_0x0083('0x8')]=_0x1cba24[_0x0083('0x7')]==='outbound'?_0x0083('0x9'):_0x1cba24[_0x0083('0x7')];this[_0x0083('0xa')]=_0x1cba24[_0x0083('0xa')];this['countcongestionretry']=_0x1cba24['countcongestionretry'];this[_0x0083('0xb')]=_0x1cba24[_0x0083('0xb')];this[_0x0083('0xc')]=_0x1cba24[_0x0083('0xa')]+_0x1cba24[_0x0083('0xd')]+_0x1cba24[_0x0083('0xb')]+_0x1cba24[_0x0083('0xe')]+_0x1cba24[_0x0083('0xf')]+_0x1cba24[_0x0083('0x10')]+_0x1cba24[_0x0083('0x11')]+_0x1cba24[_0x0083('0x12')];this['countnosuchnumberretry']=_0x1cba24[_0x0083('0xe')];this[_0x0083('0xf')]=_0x1cba24['countdropretry'];this['countabandonedretry']=_0x1cba24['countabandonedretry'];this[_0x0083('0x11')]=_0x1cba24[_0x0083('0x11')];this['countagentrejectretry']=_0x1cba24[_0x0083('0x12')];this[_0x0083('0x13')]=_0x424422[_0x0083('0x13')];this[_0x0083('0x14')]=_0x1cba24['name'];this['calleridnum']=_0x1cba24[_0x0083('0x15')];this[_0x0083('0x16')]=_0x1cba24[_0x0083('0x16')];this[_0x0083('0x17')]=_0x1cba24['responsetime'];this['endtime']=moment()['format'](_0x0083('0x18'));this['ringtime']=getSeconds(_0x1cba24[_0x0083('0x17')],_0x1cba24['starttime']);this[_0x0083('0x19')]=0x0;this[_0x0083('0x1a')]=getSeconds(this['endtime'],_0x1cba24[_0x0083('0x17')]);this[_0x0083('0x9')]=_0x1cba24[_0x0083('0x9')];this[_0x0083('0x1b')]=_0x0083('0x1c');this[_0x0083('0x1d')]=_0x424422[_0x0083('0x1e')];this['callback']=_0x1cba24[_0x0083('0x1f')];this['callbackuniqueid']=_0x1cba24['callbackuniqueid'];this['callbackat']=_0x1cba24[_0x0083('0x20')];this['recallme']=_0x1cba24[_0x0083('0x21')];this[_0x0083('0x22')]=_0x1cba24[_0x0083('0x22')];this[_0x0083('0x23')]=_0x1cba24[_0x0083('0x23')];this[_0x0083('0x24')]=_0x1cba24[_0x0083('0x24')];this[_0x0083('0x25')]=_0x1cba24[_0x0083('0x25')];this[_0x0083('0x26')]=_0x1cba24[_0x0083('0x26')];}module[_0x0083('0x27')]=Hangup; \ No newline at end of file +var _0xfa77=['callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','util','lodash','milliseconds','diff','seconds','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','talktime','queue','membername','IVR','reason','cause-txt'];(function(_0x27f114,_0xc7999e){var _0x417371=function(_0x51974f){while(--_0x51974f){_0x27f114['push'](_0x27f114['shift']());}};_0x417371(++_0xc7999e);}(_0xfa77,0x123));var _0x7fa7=function(_0x1cf557,_0x125320){_0x1cf557=_0x1cf557-0x0;var _0x357251=_0xfa77[_0x1cf557];return _0x357251;};'use strict';var util=require(_0x7fa7('0x0'));var _=require(_0x7fa7('0x1'));var moment=require('moment');function getSeconds(_0x4cc479,_0x24e110){var _0x4b98ce=moment(_0x4cc479)[_0x7fa7('0x2')](0x0);var _0x4f8734=moment(_0x24e110)[_0x7fa7('0x2')](0x0);return _0x4b98ce[_0x7fa7('0x3')](_0x4f8734,_0x7fa7('0x4'));}function Hangup(_0x1e4a1c,_0x144fa9){this[_0x7fa7('0x5')]=0x4;this[_0x7fa7('0x6')]=_0x7fa7('0x7');this['scheduledat']=_0x1e4a1c[_0x7fa7('0x8')];this['type']=_0x1e4a1c[_0x7fa7('0x9')];this[_0x7fa7('0xa')]=_0x1e4a1c[_0x7fa7('0x9')]===_0x7fa7('0xb')?'queue':_0x1e4a1c[_0x7fa7('0x9')];this[_0x7fa7('0xc')]=_0x1e4a1c[_0x7fa7('0xc')];this[_0x7fa7('0xd')]=_0x1e4a1c[_0x7fa7('0xd')];this[_0x7fa7('0xe')]=_0x1e4a1c['countnoanswerretry'];this[_0x7fa7('0xf')]=_0x1e4a1c[_0x7fa7('0xc')]+_0x1e4a1c[_0x7fa7('0xd')]+_0x1e4a1c['countnoanswerretry']+_0x1e4a1c[_0x7fa7('0x10')]+_0x1e4a1c[_0x7fa7('0x11')]+_0x1e4a1c[_0x7fa7('0x12')]+_0x1e4a1c[_0x7fa7('0x13')]+_0x1e4a1c[_0x7fa7('0x14')];this[_0x7fa7('0x10')]=_0x1e4a1c[_0x7fa7('0x10')];this[_0x7fa7('0x11')]=_0x1e4a1c[_0x7fa7('0x11')];this[_0x7fa7('0x12')]=_0x1e4a1c['countabandonedretry'];this[_0x7fa7('0x13')]=_0x1e4a1c[_0x7fa7('0x13')];this[_0x7fa7('0x14')]=_0x1e4a1c[_0x7fa7('0x14')];this[_0x7fa7('0x15')]=_0x144fa9[_0x7fa7('0x15')];this[_0x7fa7('0x16')]=_0x1e4a1c[_0x7fa7('0x17')];this[_0x7fa7('0x18')]=_0x1e4a1c[_0x7fa7('0x19')];this['starttime']=_0x1e4a1c[_0x7fa7('0x1a')];this[_0x7fa7('0x1b')]=_0x1e4a1c['responsetime'];this[_0x7fa7('0x1c')]=moment()[_0x7fa7('0x1d')](_0x7fa7('0x1e'));this[_0x7fa7('0x1f')]=getSeconds(_0x1e4a1c[_0x7fa7('0x1b')],_0x1e4a1c[_0x7fa7('0x1a')]);this['holdtime']=0x0;this[_0x7fa7('0x20')]=getSeconds(this[_0x7fa7('0x1c')],_0x1e4a1c['responsetime']);this[_0x7fa7('0x21')]=_0x1e4a1c[_0x7fa7('0x21')];this[_0x7fa7('0x22')]=_0x7fa7('0x23');this[_0x7fa7('0x24')]=_0x144fa9[_0x7fa7('0x25')];this['callback']=_0x1e4a1c[_0x7fa7('0x26')];this[_0x7fa7('0x27')]=_0x1e4a1c[_0x7fa7('0x27')];this['callbackat']=_0x1e4a1c[_0x7fa7('0x28')];this[_0x7fa7('0x29')]=_0x1e4a1c[_0x7fa7('0x29')];this[_0x7fa7('0x2a')]=_0x1e4a1c[_0x7fa7('0x2a')];this[_0x7fa7('0x2b')]=_0x1e4a1c[_0x7fa7('0x2b')];this[_0x7fa7('0x2c')]=_0x1e4a1c[_0x7fa7('0x2c')];this['VoiceQueueId']=_0x1e4a1c[_0x7fa7('0x2d')];this[_0x7fa7('0x2e')]=_0x1e4a1c[_0x7fa7('0x2e')];}module['exports']=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index 7b766f1..1d29d1e 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 _0x566c=['countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','queue','calleridname','name','calleridnum','number','starttime','responsetime','ringtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','lodash','moment','milliseconds','seconds','uniqueid','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry'];(function(_0x4db0db,_0x2df73e){var _0x2cf8f8=function(_0x34e3a4){while(--_0x34e3a4){_0x4db0db['push'](_0x4db0db['shift']());}};_0x2cf8f8(++_0x2df73e);}(_0x566c,0x1e0));var _0xc566=function(_0x11a95d,_0x25a82a){_0x11a95d=_0x11a95d-0x0;var _0xef27e=_0x566c[_0x11a95d];return _0xef27e;};'use strict';var util=require('util');var _=require(_0xc566('0x0'));var moment=require(_0xc566('0x1'));function getSeconds(_0x4d05bc,_0x3aaa22){var _0x23ae4f=moment(_0x4d05bc)[_0xc566('0x2')](0x0);var _0x19beb5=moment(_0x3aaa22)['milliseconds'](0x0);return _0x23ae4f['diff'](_0x19beb5,_0xc566('0x3'));}function History(_0xf44d96){this[_0xc566('0x4')]=_0xf44d96[_0xc566('0x4')];this[_0xc566('0x5')]=_0xf44d96[_0xc566('0x5')]||undefined;this[_0xc566('0x6')]=_0xf44d96[_0xc566('0x6')];this[_0xc566('0x7')]=_0xf44d96['type']===_0xc566('0x8')?'queue':_0xf44d96[_0xc566('0x6')];this[_0xc566('0x9')]=_0xf44d96[_0xc566('0x9')];this[_0xc566('0xa')]=_0xf44d96[_0xc566('0xa')];this[_0xc566('0xb')]=_0xf44d96[_0xc566('0xb')];this[_0xc566('0xc')]=_0xf44d96[_0xc566('0x9')]+_0xf44d96[_0xc566('0xa')]+_0xf44d96['countnoanswerretry']+_0xf44d96[_0xc566('0xd')]+_0xf44d96[_0xc566('0xe')]+_0xf44d96[_0xc566('0xf')]+_0xf44d96[_0xc566('0x10')]+_0xf44d96[_0xc566('0x11')];this[_0xc566('0xd')]=_0xf44d96[_0xc566('0xd')];this['countdropretry']=_0xf44d96[_0xc566('0xe')];this[_0xc566('0xf')]=_0xf44d96[_0xc566('0xf')];this[_0xc566('0x10')]=_0xf44d96[_0xc566('0x10')];this[_0xc566('0x11')]=_0xf44d96[_0xc566('0x11')];this[_0xc566('0x12')]=_0xf44d96[_0xc566('0x12')];this[_0xc566('0x13')]=_0xf44d96[_0xc566('0x14')];this[_0xc566('0x15')]=_0xf44d96[_0xc566('0x16')];this[_0xc566('0x17')]=_0xf44d96[_0xc566('0x17')];this[_0xc566('0x18')]=_0xf44d96[_0xc566('0x18')];this['endtime']=_0xf44d96['responsetime'];this[_0xc566('0x19')]=getSeconds(_0xf44d96[_0xc566('0x18')],_0xf44d96[_0xc566('0x17')]);this['holdtime']=0x0;this[_0xc566('0x1a')]=0x0;this['callback']=_0xf44d96[_0xc566('0x1b')];this[_0xc566('0x1c')]=_0xf44d96[_0xc566('0x1c')];this['callbackat']=_0xf44d96[_0xc566('0x1d')];this[_0xc566('0x1e')]=_0xf44d96['recallme'];this[_0xc566('0x1f')]=_0xf44d96[_0xc566('0x1f')];this['ListId']=_0xf44d96[_0xc566('0x20')];this[_0xc566('0x21')]=_0xf44d96[_0xc566('0x21')];this[_0xc566('0x22')]=_0xf44d96[_0xc566('0x22')];this[_0xc566('0x23')]=_0xf44d96[_0xc566('0x23')];this[_0xc566('0x24')]=_0xf44d96['originatecalleridnum']||'';this[_0xc566('0x25')]=_0xf44d96[_0xc566('0x25')]||'';}module['exports']=History; \ No newline at end of file +var _0x28d1=['lodash','moment','milliseconds','diff','uniqueid','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','queue','calleridname','name','number','starttime','responsetime','endtime','ringtime','holdtime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','exports','util'];(function(_0x2bd6b9,_0xba2ab){var _0x5859a9=function(_0x32476c){while(--_0x32476c){_0x2bd6b9['push'](_0x2bd6b9['shift']());}};_0x5859a9(++_0xba2ab);}(_0x28d1,0xbd));var _0x128d=function(_0x481583,_0xe832f7){_0x481583=_0x481583-0x0;var _0x515fe6=_0x28d1[_0x481583];return _0x515fe6;};'use strict';var util=require(_0x128d('0x0'));var _=require(_0x128d('0x1'));var moment=require(_0x128d('0x2'));function getSeconds(_0x35df4a,_0x13f1f1){var _0x4c9c08=moment(_0x35df4a)['milliseconds'](0x0);var _0x5934c1=moment(_0x13f1f1)[_0x128d('0x3')](0x0);return _0x4c9c08[_0x128d('0x4')](_0x5934c1,'seconds');}function History(_0x5ecc29){this[_0x128d('0x5')]=_0x5ecc29[_0x128d('0x5')];this[_0x128d('0x6')]=_0x5ecc29[_0x128d('0x6')]||undefined;this[_0x128d('0x7')]=_0x5ecc29[_0x128d('0x7')];this[_0x128d('0x8')]=_0x5ecc29[_0x128d('0x7')]===_0x128d('0x9')?'queue':_0x5ecc29['type'];this[_0x128d('0xa')]=_0x5ecc29[_0x128d('0xa')];this[_0x128d('0xb')]=_0x5ecc29['countcongestionretry'];this[_0x128d('0xc')]=_0x5ecc29[_0x128d('0xc')];this['countglobal']=_0x5ecc29[_0x128d('0xa')]+_0x5ecc29['countcongestionretry']+_0x5ecc29[_0x128d('0xc')]+_0x5ecc29['countnosuchnumberretry']+_0x5ecc29[_0x128d('0xd')]+_0x5ecc29[_0x128d('0xe')]+_0x5ecc29[_0x128d('0xf')]+_0x5ecc29[_0x128d('0x10')];this[_0x128d('0x11')]=_0x5ecc29[_0x128d('0x11')];this[_0x128d('0xd')]=_0x5ecc29[_0x128d('0xd')];this[_0x128d('0xe')]=_0x5ecc29[_0x128d('0xe')];this[_0x128d('0xf')]=_0x5ecc29[_0x128d('0xf')];this['countagentrejectretry']=_0x5ecc29[_0x128d('0x10')];this[_0x128d('0x12')]=_0x5ecc29[_0x128d('0x12')];this[_0x128d('0x13')]=_0x5ecc29[_0x128d('0x14')];this['calleridnum']=_0x5ecc29[_0x128d('0x15')];this['starttime']=_0x5ecc29[_0x128d('0x16')];this[_0x128d('0x17')]=_0x5ecc29[_0x128d('0x17')];this[_0x128d('0x18')]=_0x5ecc29[_0x128d('0x17')];this[_0x128d('0x19')]=getSeconds(_0x5ecc29[_0x128d('0x17')],_0x5ecc29[_0x128d('0x16')]);this[_0x128d('0x1a')]=0x0;this['talktime']=0x0;this[_0x128d('0x1b')]=_0x5ecc29[_0x128d('0x1b')];this[_0x128d('0x1c')]=_0x5ecc29['callbackuniqueid'];this[_0x128d('0x1d')]=_0x5ecc29['callbackat'];this['recallme']=_0x5ecc29[_0x128d('0x1e')];this[_0x128d('0x1f')]=_0x5ecc29[_0x128d('0x1f')];this[_0x128d('0x20')]=_0x5ecc29['ListId'];this['UserId']=_0x5ecc29[_0x128d('0x21')];this[_0x128d('0x22')]=_0x5ecc29[_0x128d('0x22')];this['CampaignId']=_0x5ecc29['CampaignId'];this[_0x128d('0x23')]=_0x5ecc29[_0x128d('0x23')]||'';this['originatecalleridname']=_0x5ecc29[_0x128d('0x24')]||'';}module[_0x128d('0x25')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 5950be2..bf9d4be 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 _0xc337=['Trunk','callerid','stringify','format','voice:queue:%s','ivr','campaign:ivr:%s','campaign:save','-----\x20Stats\x20Predictive\x20---','info','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsTimeout','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','---------------------------','predictiveIntervalTotalCalls','isUndefined','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','erlangCalls','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','seconds','clearing\x20variable\x20start\x20progressive','handlePredictive','clearing\x20variable\x20handle\x20predictive','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','inspect','hasOwnProperty','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contacts','AVAILABLE_CONTACTS_FINISHED','sendMessageOneNotActive','waiting','pTalking','NOT_ACTIVE','[syncQueueSummary]\x20Campaign\x20Queue:\x20','IS_DISACTIVED','is\x20disactive','is\x20not\x20active','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','statedesc','uniqueId','[uniqueid]','clearZombieChannels','[actions]','sequence','channel','catch','No\x20such\x20channel','updateOriginated','[Dialer][checkChannel]','queue','[Dialer][checkChannel][ivr]','countReScheduled','then','[countReScheduled]\x20','checkIsBlackList','[checkIsBlackList]\x20','resolve','averageHandleTime','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','[getContactDialer]\x20','getContactDialerIvr','getVoiceQueueRtPauses','moveContactManagedDialer','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','loggerHandler','emptyContact','notFound','saveInDb','ContactId','ListId','UserId','CampaignId','[emptyContact][createHistory]','[emptyContact]','isSuccess','isTrunkReachable','active','SIP/%s','status','unmonitored','uniqueid','isNil','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','value','state','membername','[syncHangupInAMD][createHistory]','MACHINE','Machine','AMD','countglobal','amd','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','reason\x2019\x20machine....','add','dialMachineRetryFrequency','minutes','YYYY-MM-DD\x20HH:mm:ss','[rescheduleContact][Machine]','HANGUP','HangupInAMD','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','countnoanswerretry','createStateFinal','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','cause-txt','Unknow','syncAgentComplete','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete]','syncAgentConnect','answertime','queueCallerAbandonCreateState','[syncAgentComplete][createHistory]','[syncQueueCallerAbandon]\x20[Drop]','syncQueueCallerAbandon','droptime','responsetime','dialQueueTimeout','Drop','dropreason','TIMEOUT','dialDropMaxRetry','dialDropRetryFrequency','VoiceQueueId','[rescheduleContact][Drop]','endtime','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','CALLEREXIT','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','starttime','[syncAgentComplete][createHistory][11]','syncNewExten','actionid','locked','stateinterface','queueBooked','push','idHopper','paused','[unlockQueueStatus][undefined]','queueStatusComplete','pick','syncQueueStatusComplete','run','[Catch][Preview][syncQueueStatusComplete]','_rr','length','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[booked][RR][finaly]','[booked][unlock]','[unlock2][syncQueueStatusComplete]','[unlock3][syncQueueStatusComplete]','syncCampaigns','checkIsTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','checkIfTimeIntervals','ifTime','Failure','\x20Intervals\x20is\x20null\x20','timezones','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','isArray','Action','iftime\x20%s,%s','interval','indexOf','true','command','content','all','some','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','Timezone:\x20','checkDialMethod','progressive','handlePower','dialPowerLevel','predictive','Queue','method\x20not\x20recognized','launchHandleIvr','handleIvr','dialTimezone','[syncQueueSummary]','[syncCampaigns]','\x5cw{0,','pow','random','match','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','phone','Contact','getCaller','\x22agi://%s/square,%s\x22','NONE','dialQueueOptions','ACTIVE','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','tags','createdAt','%s%s','XMD-','toUpper','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','SIP/%s/%s%s','trim','dialCutDigit','substring','dialOriginateTimeout','outboundOriginateFailureCallsDay','OriginateError','[originate][error]','Error','originate\x20action\x20Error','getQueue','response','callProgressDetecting','[callProgressDetecting]\x20','checkRetriveMax','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialNoSuchNumberMaxRetry','[rescheduleContact][NoSuchNumber]','dialAgentRejectMaxRetry','[rescheduleContact][AgentReject]','[callProgressDetecting]','evt\x20is\x20undefine','NoSuchNumber','reason\x200\x20no\x20such\x20number....','buildObj','noanswer','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','Abandoned','reason\x2011\x20abandoned','AgentReject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','reason','Success','[moveContactManagedDialer][0]','dialPredictiveOptimizationPercentage','round','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','floor','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','dropRate','Max\x20Drop\x20','started\x20in\x20predictive\x20at','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','agentBusyFactor','busyFactor','[getDataPredictive]','check\x20failure','getDataPredictiveOld','outboundQueuePauses','abandonmentRate','[CatchErlangB]','one\x20call\x20every:','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','dialRecallMeTimeout','Agent','voicePause','log','Contact\x20updated','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','limitCalls','dialOrderByScheduledAt','temp','ivrTotalCallsDays','Contact.phone','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','RUNNING','[actionOriginate]\x20','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','not_inuse','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','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','Ts\x20=\x20','p\x20=\x20','Amax\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','m\x20=\x20','[busyFactor]','interval\x20=\x20','Umin\x20=\x20','exports','lodash','bluebird','uuid','moment','md5','ioredis','../../../config/logger','dialer','booked','syncQueueSummary','../ami','redis','defaults','socket.io-emitter','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./action','./history','./final','./agentComplete','./queueCallerAbandon','./hangup','env','XCALLY_IP_AGI','127.0.0.1','rrmemory','roundrobin','prototype','enqueue','tail','finally','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBookedRR','bind','originateresponse','syncOriginateResponse','syncHangup','newexten','varset','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','loopCampaigns','loopClearZombieChannels','AGENTS_NOT_LOGGED','name','\x20AGENTS\x20NOT\x20LOGGED','message','\x20NOT\x20Active','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Intervals','isEmpty','Interval','[ifTime][Action]','milliseconds','diff','emit','type','outbound','strategy','available','loggedIn','sumDuration','sumHoldTime','talking','unmanaged','abandoned','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdNumber','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','originated','erlangCallToSecond','erlangBusyFactor'];(function(_0x1eeba6,_0x532215){var _0x4b8916=function(_0x5be535){while(--_0x5be535){_0x1eeba6['push'](_0x1eeba6['shift']());}};_0x4b8916(++_0x532215);}(_0xc337,0x1b0));var _0x7c33=function(_0x51d893,_0x3e43d3){_0x51d893=_0x51d893-0x0;var _0x35e509=_0xc337[_0x51d893];return _0x35e509;};'use strict';var util=require('util');var _=require(_0x7c33('0x0'));var BPromise=require(_0x7c33('0x1'));var uuid=require(_0x7c33('0x2'));var moment=require(_0x7c33('0x3'));var rr=require('rr');var md5=require(_0x7c33('0x4'));var Redis=require(_0x7c33('0x5'));var ut=require('../preview/util/util');var config=require('../../../config/environment/');var logger=require(_0x7c33('0x6'))(_0x7c33('0x7'));var loggerBooked=require(_0x7c33('0x6'))(_0x7c33('0x8'));var loggerPredictive=require(_0x7c33('0x6'))('predictive');var loggerPredictiveCalls=require(_0x7c33('0x6'))('predictiveCalls');var loggerSyncQueueSummary=require(_0x7c33('0x6'))(_0x7c33('0x9'));var ami=require(_0x7c33('0xa'));config[_0x7c33('0xb')]=_[_0x7c33('0xc')](config[_0x7c33('0xb')],{'host':'localhost','port':0x18eb});var io=require(_0x7c33('0xd'))(new Redis(config[_0x7c33('0xb')]));var cmHopper=require('../rpc/cmHopper');var cmHopperFinal=require(_0x7c33('0xe'));var cmHopperHistory=require(_0x7c33('0xf'));var cmHopperBlack=require(_0x7c33('0x10'));var voiceQueueRt=require(_0x7c33('0x11'));var Action=require(_0x7c33('0x12'));var History=require(_0x7c33('0x13'));var Final=require(_0x7c33('0x14'));var AgentComplete=require(_0x7c33('0x15'));var QueueCallerAbandon=require(_0x7c33('0x16'));var Hangup=require(_0x7c33('0x17'));var ipAgi=process[_0x7c33('0x18')][_0x7c33('0x19')]||_0x7c33('0x1a');var strategy={'rrmemory':_0x7c33('0x1b'),'roundrobin':_0x7c33('0x1c')};var Sequence=function(){};Sequence[_0x7c33('0x1d')][_0x7c33('0x1e')]=function(_0x4fccad){this['tail']=this[_0x7c33('0x1f')]?this[_0x7c33('0x1f')][_0x7c33('0x20')](_0x4fccad):_0x4fccad();};function Dialer(_0x93c582,_0x153f44){this['sequence']=new Sequence();this[_0x7c33('0x21')]=_0x153f44;this[_0x7c33('0x22')]=_0x93c582[_0x7c33('0x22')];this[_0x7c33('0x23')]=_0x93c582['campaigns'];this[_0x7c33('0x24')]=_0x93c582['agents'];this['trunks']=_0x93c582[_0x7c33('0x25')];this[_0x7c33('0x26')]=config[_0x7c33('0x26')]||0x2;this[_0x7c33('0x27')]={};this[_0x7c33('0x28')]={};this[_0x7c33('0x29')]={};this['uniqueId']={};this[_0x7c33('0x2a')]={};this[_0x7c33('0x2b')]={};this[_0x7c33('0x2c')]={};this[_0x7c33('0x2d')]={};this['queueBooked']={};this[_0x7c33('0x2e')]={};ami['on']('agentconnect',this['syncAgentConnect']['bind'](this));ami['on']('queuecallerabandon',this['syncQueueCallerAbandon'][_0x7c33('0x2f')](this));ami['on'](_0x7c33('0x30'),this[_0x7c33('0x31')][_0x7c33('0x2f')](this));ami['on']('agentcomplete',this['syncAgentComplete'][_0x7c33('0x2f')](this));ami['on']('custom:queuesummary',this['syncQueueSummary'][_0x7c33('0x2f')](this));ami['on']('hangup',this[_0x7c33('0x32')][_0x7c33('0x2f')](this));ami['on'](_0x7c33('0x33'),this['syncNewExten'][_0x7c33('0x2f')](this));ami['on'](_0x7c33('0x34'),this[_0x7c33('0x35')][_0x7c33('0x2f')](this));ami['on'](_0x7c33('0x36'),this[_0x7c33('0x37')][_0x7c33('0x2f')](this));ami['on'](_0x7c33('0x38'),this['syncQueueStatusComplete'][_0x7c33('0x2f')](this));this[_0x7c33('0x39')]();this[_0x7c33('0x3a')]();}function isNotNull(_0x129149){return _0x129149!==null&&!_['isUndefined'](_0x129149);}function checkIsLoggedIn(_0xf91789,_0x3d8a0b){return function(){if(_0x3d8a0b<=0x0){_0xf91789['message']=_0x7c33('0x3b');throw _0xf91789[_0x7c33('0x3c')]+_0x7c33('0x3d');}};}function isActive(_0x3de27e){return _0x3de27e;}function checkIsActive(_0x36ba39,_0x5c6fc8){return function(){if(!isActive(_0x5c6fc8)){_0x36ba39[_0x7c33('0x3e')]='NOT_ACTIVE';throw _0x36ba39['name']+_0x7c33('0x3f');}};}function checkInterval(_0x13eafc){return function(){if(!isNotNull(_0x13eafc['Interval'])){_0x13eafc[_0x7c33('0x3e')]=_0x7c33('0x40');throw _0x13eafc[_0x7c33('0x3c')]+_0x7c33('0x41');}if(!isNotNull(_0x13eafc['Interval'][_0x7c33('0x42')])){_0x13eafc[_0x7c33('0x3e')]=_0x7c33('0x40');throw _0x13eafc[_0x7c33('0x3c')]+_0x7c33('0x41');}if(!isNotNull(_[_0x7c33('0x43')](_0x13eafc[_0x7c33('0x44')][_0x7c33('0x42')]))){_0x13eafc[_0x7c33('0x3e')]=_0x7c33('0x40');throw _0x13eafc[_0x7c33('0x3c')]+_0x7c33('0x41');}};}function msgResponse(_0x541e50,_0x269a60,_0xf42706){return{'action':_0x541e50,'response':_0x269a60,'message':_0xf42706,'stack':_0xf42706};}function myreject(_0x837cf4){return function(_0x5f2522){return _0x837cf4(msgResponse(_0x7c33('0x45'),'Error',JSON['stringify'](_0x5f2522)));};}function getSeconds(_0x3afead,_0x56450c){var _0x29c0c8=moment(_0x3afead)[_0x7c33('0x46')](0x0);var _0x459fe8=moment(_0x56450c)[_0x7c33('0x46')](0x0);return _0x29c0c8[_0x7c33('0x47')](_0x459fe8,'seconds');}function emit(_0xbb8711,_0x57ac3b,_0x23eff9){io['to'](_0xbb8711)[_0x7c33('0x48')](_0x57ac3b,_0x23eff9);}function emitVoiceQueueSummary(_0x5ec00d){if(_0x5ec00d[_0x7c33('0x49')]===_0x7c33('0x4a')){var _0x86d0b5={'id':_0x5ec00d['id'],'name':_0x5ec00d[_0x7c33('0x3c')],'strategy':_0x5ec00d[_0x7c33('0x4b')],'answered':_0x5ec00d['answered'],'available':_0x5ec00d[_0x7c33('0x4c')],'loggedIn':_0x5ec00d[_0x7c33('0x4d')],'pTalking':_0x5ec00d['pTalking'],'sumBillable':_0x5ec00d['sumBillable'],'sumDuration':_0x5ec00d[_0x7c33('0x4e')],'sumHoldTime':_0x5ec00d[_0x7c33('0x4f')]||0x0,'talking':_0x5ec00d[_0x7c33('0x50')],'total':_0x5ec00d['total'],'type':_0x5ec00d[_0x7c33('0x49')],'unmanaged':_0x5ec00d[_0x7c33('0x51')],'abandoned':_0x5ec00d[_0x7c33('0x52')],'waiting':_0x5ec00d['waiting'],'loggedInDb':_0x5ec00d[_0x7c33('0x53')],'dialActive':_0x5ec00d[_0x7c33('0x54')],'dialMethod':_0x5ec00d[_0x7c33('0x55')],'dialOriginateCallerIdName':_0x5ec00d['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x5ec00d[_0x7c33('0x56')],'dialOriginateTimeout':_0x5ec00d['dialOriginateTimeout'],'dialPrefix':_0x5ec00d[_0x7c33('0x57')],'outboundAnswerAgiCallsDay':_0x5ec00d[_0x7c33('0x58')],'outboundAnswerCallsDay':_0x5ec00d[_0x7c33('0x59')],'outboundBlacklistCallsDay':_0x5ec00d[_0x7c33('0x5a')],'outboundBusyCallsDay':_0x5ec00d[_0x7c33('0x5b')],'outboundCongestionCallsDay':_0x5ec00d[_0x7c33('0x5c')],'outboundDropCallsDayACS':_0x5ec00d[_0x7c33('0x5d')],'outboundDropCallsDayCallersExit':_0x5ec00d[_0x7c33('0x5e')],'outboundDropCallsDayTimeout':_0x5ec00d[_0x7c33('0x5f')],'outboundNoAnswerCallsDay':_0x5ec00d[_0x7c33('0x60')],'outboundNoSuchCallsDay':_0x5ec00d[_0x7c33('0x61')],'outboundOriginateFailureCallsDay':_0x5ec00d['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x5ec00d[_0x7c33('0x62')],'outboundRejectCallsDay':_0x5ec00d[_0x7c33('0x63')],'outboundUnknownCallsDay':_0x5ec00d[_0x7c33('0x64')],'predictiveIntervalAnsweredCalls':_0x5ec00d[_0x7c33('0x65')],'predictiveIntervalAvgHoldtime':_0x5ec00d[_0x7c33('0x66')],'predictiveIntervalAvgTalktime':_0x5ec00d['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x5ec00d[_0x7c33('0x67')],'predictiveIntervalDroppedCallsTimeout':_0x5ec00d['predictiveIntervalDroppedCallsTimeout'],'predictiveIntervalErlangCalls':_0x5ec00d[_0x7c33('0x68')],'predictiveIntervalErlangCallsDroppedCalls':_0x5ec00d[_0x7c33('0x69')],'predictiveIntervalHitRate':_0x5ec00d[_0x7c33('0x6a')],'predictiveIntervalMultiplicativeFactor':_0x5ec00d[_0x7c33('0x6b')],'predictiveIntervalPauses':_0x5ec00d[_0x7c33('0x6c')],'predictiveIntervalAvailable':_0x5ec00d[_0x7c33('0x6d')],'predictiveIntervalTotalCalls':_0x5ec00d['predictiveIntervalTotalCalls'],'message':_0x5ec00d[_0x7c33('0x3e')],'originated':_0x5ec00d[_0x7c33('0x6e')],'erlangCalls':_0x5ec00d['erlangCalls'],'erlangCallToSecond':_0x5ec00d[_0x7c33('0x6f')],'erlangAbandonmentRate':_0x5ec00d['erlangAbandonmentRate'],'erlangBusyFactor':_0x5ec00d[_0x7c33('0x70')],'startPredictive':_0x5ec00d[_0x7c33('0x2b')],'startProgressive':_0x5ec00d[_0x7c33('0x2c')]};if(_0x5ec00d['Trunk']){_0x86d0b5['Trunk']={'id':_0x5ec00d[_0x7c33('0x71')]['id'],'name':_0x5ec00d[_0x7c33('0x71')][_0x7c33('0x3c')],'active':_0x5ec00d[_0x7c33('0x71')]['active'],'callerid':_0x5ec00d[_0x7c33('0x71')][_0x7c33('0x72')]};}if(_0x5ec00d['Interval']){_0x86d0b5[_0x7c33('0x44')]={'id':_0x5ec00d[_0x7c33('0x44')]['id'],'name':_0x5ec00d[_0x7c33('0x44')][_0x7c33('0x3c')]};}var _0x709a83=md5(JSON[_0x7c33('0x73')](_0x86d0b5));if(_0x5ec00d[_0x7c33('0x4')]!==_0x709a83){_0x5ec00d[_0x7c33('0x4')]=_0x709a83;emit(util[_0x7c33('0x74')](_0x7c33('0x75'),_0x86d0b5[_0x7c33('0x3c')]),'voice_queue:save',_0x86d0b5);}}}function emitCampaignSummary(_0x1d928d){if(_0x1d928d['type']===_0x7c33('0x76')){emit(util[_0x7c33('0x74')](_0x7c33('0x77'),_0x1d928d[_0x7c33('0x3c')]),_0x7c33('0x78'),_0x1d928d);}}function checkGetDataPredictive(_0x44dffc){if(isNotNull(_0x44dffc)){if(!_[_0x7c33('0x43')](_0x44dffc)){loggerPredictive['info'](_0x7c33('0x79'));loggerPredictive[_0x7c33('0x7a')](_0x7c33('0x7b'),_0x44dffc['predictiveIntervalTotalCalls']);loggerPredictive['info']('Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x44dffc[_0x7c33('0x65')]);loggerPredictive[_0x7c33('0x7a')](_0x7c33('0x7c'),_0x44dffc[_0x7c33('0x7d')]);loggerPredictive[_0x7c33('0x7a')]('Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x44dffc[_0x7c33('0x67')]);loggerPredictive[_0x7c33('0x7a')](_0x7c33('0x7e'),_0x44dffc[_0x7c33('0x66')]);loggerPredictive[_0x7c33('0x7a')](_0x7c33('0x7f'),_0x44dffc[_0x7c33('0x80')]);loggerPredictive[_0x7c33('0x7a')](_0x7c33('0x81'));if(_0x44dffc[_0x7c33('0x82')]>0x0){if(!_[_0x7c33('0x83')](_0x44dffc['predictiveIntervalAvgTalktime'])&&_0x44dffc[_0x7c33('0x80')]>0x0){return!![];}else{loggerPredictive[_0x7c33('0x7a')](_0x7c33('0x84'));}if(!_['isUndefined'](_0x44dffc[_0x7c33('0x66')])&&_0x44dffc[_0x7c33('0x66')]>0x0){return!![];}else{loggerPredictive[_0x7c33('0x7a')](_0x7c33('0x85'));}}else{loggerPredictive['info'](_0x7c33('0x86'));}}else{loggerPredictive[_0x7c33('0x7a')](_0x7c33('0x87'));}}else{loggerPredictive[_0x7c33('0x7a')](_0x7c33('0x87'));}return![];}function mergeDataErlangB(_0x55ce09){return function(_0x567bcc){loggerPredictive['info']('---------\x20ErlangB\x20---------');loggerPredictive[_0x7c33('0x7a')]('Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x567bcc[_0x7c33('0x88')]);loggerPredictive[_0x7c33('0x7a')](_0x7c33('0x89'),_0x567bcc[_0x7c33('0x6f')]);loggerPredictive[_0x7c33('0x7a')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x567bcc[_0x7c33('0x8a')]);loggerPredictive[_0x7c33('0x7a')](_0x7c33('0x8b'),_0x567bcc[_0x7c33('0x70')]);loggerPredictive[_0x7c33('0x7a')](_0x7c33('0x8c'),_0x567bcc[_0x7c33('0x8a')]);loggerPredictive[_0x7c33('0x7a')](_0x7c33('0x81'));_[_0x7c33('0x8d')](_0x55ce09,_0x567bcc);};}function getDiff(_0x2bf5e2){var _0x155200=moment()[_0x7c33('0x46')](0x0);var _0x190995=moment(_0x2bf5e2)[_0x7c33('0x46')](0x0);return _0x155200[_0x7c33('0x47')](_0x190995,_0x7c33('0x8e'));}function ifInterval(_0xe7fb4f,_0x354ed3){if(_[_0x7c33('0x83')](_0x354ed3)){return![];}if(getDiff(_0x354ed3)<_0xe7fb4f*0x3c){return!![];}else{return![];}}function freeVariablesPredictive(_0xe3df7e){if(isNotNull(_0xe3df7e)){if(!_[_0x7c33('0x83')](_0xe3df7e['startProgressive'])){_0xe3df7e['startProgressive']=undefined;loggerPredictive['info'](_0xe3df7e['name'],_0x7c33('0x8f'));}if(!_[_0x7c33('0x83')](_0xe3df7e[_0x7c33('0x2b')])){_0xe3df7e['startPredictive']=undefined;loggerPredictive[_0x7c33('0x7a')](_0xe3df7e[_0x7c33('0x3c')],'clearing\x20variable\x20start\x20predictive');}if(!_[_0x7c33('0x83')](_0xe3df7e['handlePredictive'])){clearInterval(_0xe3df7e[_0x7c33('0x90')]);_0xe3df7e['handlePredictive']=undefined;loggerPredictive[_0x7c33('0x7a')](_0xe3df7e[_0x7c33('0x3c')],_0x7c33('0x91'));}}}function erlangb(_0x4edeb5,_0x5f30b3){if(_0x5f30b3===0x0){return 0x0;}var _0x21835e=0x1;for(var _0x242f0=0x1;_0x242f0<=_0x5f30b3;_0x242f0+=0x1){_0x21835e=0x1+_0x21835e*_0x242f0/_0x4edeb5;}return 0x1/_0x21835e;}function isVoiceQueueOutbound(_0x51f5a2){return _0x51f5a2===_0x7c33('0x4a');}function isNotPreview(_0x4b92b9){return _0x4b92b9!==_0x7c33('0x21');}function isCampaignIvr(_0x1a88b6){return _0x1a88b6===_0x7c33('0x76');}function getCallerId(_0x3fb54f,_0x5eef49,_0x3a41c7){if(!_[_0x7c33('0x83')](_0x3a41c7)&&_0x7c33('0x92')===typeof _0x3a41c7&&!_[_0x7c33('0x43')](_0x3a41c7)){if(!_[_0x7c33('0x83')](_0x5eef49)&&_0x7c33('0x92')===typeof _0x5eef49&&!_[_0x7c33('0x43')](_0x5eef49)){return util[_0x7c33('0x74')]('\x22%s\x22\x20<%s>',_0x5eef49,_0x3a41c7);}return util['format'](_0x7c33('0x93'),_0x3a41c7,_0x3a41c7);}if(!_[_0x7c33('0x83')](_0x3fb54f)&&_0x7c33('0x92')===typeof _0x3fb54f&&!_[_0x7c33('0x43')](_0x3fb54f)){return _0x3fb54f;}return _0x7c33('0x94');}function loggerCatchQueueSummary(_0x396eaa,_0x81261){return function(_0x584392){freeVariablesPredictive(_0x81261);emitVoiceQueueSummary(_0x81261);emitCampaignSummary(_0x81261);loggerSyncQueueSummary[_0x7c33('0x95')](_0x396eaa,util[_0x7c33('0x96')](_0x584392,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x502015,_0x4b2910){return function(_0x167c5c){loggerPredictive['error'](_0x4b2910[_0x7c33('0x3c')],_0x502015);loggerPredictive[_0x7c33('0x95')](_0x167c5c['stack']);freeVariablesPredictive(_0x4b2910);};}function loggerCatch(_0x1e254c){return function(_0x317d6f){logger[_0x7c33('0x95')](_0x1e254c,util[_0x7c33('0x96')](_0x317d6f,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x42e076){return _0x42e076&&!_['isUndefined'](_0x42e076)&&_0x42e076['length']>0x0;}function decremetOriginate(_0x2655ac){if(!_[_0x7c33('0x83')](_0x2655ac)&&_0x2655ac!==null){if(_0x2655ac[_0x7c33('0x97')]('originated')){if(_0x2655ac[_0x7c33('0x6e')]>0x0){_0x2655ac['originated']-=0x1;}else{logger[_0x7c33('0x95')]('[decremetOriginate]\x20object\x20originated\x20is\x20negative');}}}else{logger['error'](_0x7c33('0x98'));}}function checkContactLowerLimitOriginate(_0x24219d,_0x2bc3e9,_0x56551f){if(_0x2bc3e9>_0x56551f){for(var _0x448fef=0x0;_0x448fef<_0x2bc3e9-_0x56551f;_0x448fef+=0x1){decremetOriginate(_0x24219d);}}}function loggerGetContactDialer(_0x4021d3,_0x12fde0,_0x5357c1){return function(_0x495622){checkContactLowerLimitOriginate(_0x12fde0,_0x5357c1,0x0);logger[_0x7c33('0x95')](_0x4021d3,util[_0x7c33('0x96')](_0x495622,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x4538d9){return function(_0x5f25ea){if(isNotNull(_0x5f25ea)&&isNotNull(_0x5f25ea[0x0])){if(_0x5f25ea[0x0][_0x7c33('0x99')]>0x0){_0x4538d9[_0x7c33('0x3e')]=_0x7c33('0x9a');logger[_0x7c33('0x7a')](_0x7c33('0x9b')+_0x4538d9[_0x7c33('0x3c')],_0x5f25ea[0x0]['contactsRescheduled'],_0x7c33('0x9c'));}else{_0x4538d9['message']=_0x7c33('0x9d');logger[_0x7c33('0x7a')]('[getContactDialer2][Empty]'+_0x4538d9[_0x7c33('0x3c')]);}}};}function notSendMessagesQueue(_0x357cb3){if(_0x357cb3[_0x7c33('0x9e')]){freeVariablesPredictive(_0x357cb3);if(_0x357cb3[_0x7c33('0x6e')]===0x0&&_0x357cb3[_0x7c33('0x50')]===0x0&&_0x357cb3[_0x7c33('0x9f')]===0x0&&(_0x357cb3[_0x7c33('0xa0')]||0x0)===0x0){_0x357cb3[_0x7c33('0x9e')]=![];_0x357cb3[_0x7c33('0x4c')]=0x0;_0x357cb3[_0x7c33('0x3e')]=_0x7c33('0xa1');loggerSyncQueueSummary['error'](_0x7c33('0xa2'),_0x357cb3[_0x7c33('0x3c')],'is\x20not\x20active');}else{_0x357cb3[_0x7c33('0x3e')]=_0x7c33('0xa3');loggerSyncQueueSummary[_0x7c33('0x95')]('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x357cb3[_0x7c33('0x3c')],_0x7c33('0xa4'));}emitVoiceQueueSummary(_0x357cb3);}}function notSendMessagesCampaign(_0x501cd4){if(_0x501cd4[_0x7c33('0x9e')]){if(_0x501cd4['originated']===0x0){_0x501cd4['sendMessageOneNotActive']=![];_0x501cd4[_0x7c33('0x3e')]=_0x7c33('0xa1');loggerSyncQueueSummary[_0x7c33('0x95')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x501cd4[_0x7c33('0x3c')],_0x7c33('0xa5'));}else{_0x501cd4[_0x7c33('0x3e')]=_0x7c33('0xa3');loggerSyncQueueSummary[_0x7c33('0x95')](_0x7c33('0xa6'),_0x501cd4[_0x7c33('0x3c')],_0x7c33('0xa4'));}emitCampaignSummary(_0x501cd4);}}function createObjHistory(_0xd05ba4,_0xfa2605,_0x117422,_0x572fae,_0x544ea4){_0xd05ba4[_0x7c33('0x3e')]=_0x117422;var _0x5410d4=new Action(_0xd05ba4,_0xfa2605);var _0x2bfcea=new History(_0x5410d4);_0x2bfcea['state']=_0x572fae;_0x2bfcea[_0x7c33('0xa7')]=_0x544ea4;_0x2bfcea['endtime']=_0x5410d4['starttime'];return _0x2bfcea;}Dialer[_0x7c33('0x1d')][_0x7c33('0x3a')]=function(){var _0x510cd2=this;setInterval(function(){_0x510cd2['clearZombieChannels'](_0x510cd2[_0x7c33('0xa8')],_0x7c33('0xa9'));_0x510cd2[_0x7c33('0xaa')](_0x510cd2[_0x7c33('0x28')],_0x7c33('0xab'));},0x32c8);};Dialer[_0x7c33('0x1d')]['clearZombieChannels']=function(_0x52aea4,_0x566e74){var _0x547ec3=this;for(var _0x5a2eea in _0x52aea4){if(_0x52aea4[_0x7c33('0x97')](_0x5a2eea)){this[_0x7c33('0xac')][_0x7c33('0x1e')](function(){if(!_['isNil'](_0x52aea4[_0x5a2eea])){return ami['Action']({'action':'status','channel':_0x52aea4[_0x5a2eea][_0x7c33('0xad')]})[_0x7c33('0xae')](function(_0x191b90){if(_0x191b90[_0x7c33('0x3e')]===_0x7c33('0xaf')){setTimeout(function(){if(_0x52aea4[_0x5a2eea]&&_0x52aea4[_0x5a2eea][_0x7c33('0x49')]!==_0x7c33('0x76')){_0x547ec3[_0x7c33('0xb0')](_0x547ec3[_0x7c33('0x22')][_0x52aea4[_0x5a2eea]['queue']]);logger['error'](_0x7c33('0xb1'),_0x566e74,_0x5a2eea,_0x52aea4[_0x5a2eea]['queue']);delete _0x52aea4[_0x5a2eea];}if(_0x52aea4[_0x5a2eea]&&_0x52aea4[_0x5a2eea]['type']===_0x7c33('0x76')){_0x547ec3[_0x7c33('0xb0')](_0x547ec3['campaigns'][_0x52aea4[_0x5a2eea][_0x7c33('0xb2')]]);logger[_0x7c33('0x95')](_0x7c33('0xb3'),_0x566e74,_0x5a2eea,_0x52aea4[_0x5a2eea][_0x7c33('0xb2')]);delete _0x52aea4[_0x5a2eea];}},0x2328);}});}});}}};Dialer['prototype'][_0x7c33('0xb4')]=function(_0x15c91e){return BPromise['resolve']()[_0x7c33('0xb5')](cmHopper['countReScheduled'](_0x15c91e))[_0x7c33('0xae')](loggerCatch(_0x7c33('0xb6')));};Dialer[_0x7c33('0x1d')][_0x7c33('0xb7')]=function(_0x346dae){return BPromise['resolve']()['then'](cmHopperBlack['checkIsBlackList'](_0x346dae))[_0x7c33('0xae')](loggerCatch(_0x7c33('0xb8')));};Dialer['prototype']['checkIsBlackListIvr']=function(_0x215bdf){return BPromise[_0x7c33('0xb9')]()[_0x7c33('0xb5')](cmHopperBlack['checkIsBlackListIvr'](_0x215bdf))[_0x7c33('0xae')](loggerCatch('[checkIsBlackListIvr]\x20'));};Dialer[_0x7c33('0x1d')][_0x7c33('0xba')]=function(_0x5ec94f){return BPromise[_0x7c33('0xb9')]()['then'](cmHopperHistory[_0x7c33('0xbb')](_0x5ec94f))[_0x7c33('0xae')](loggerCatch(_0x7c33('0xbc')));};Dialer[_0x7c33('0x1d')]['rescheduleContact']=function(_0x26f852){return BPromise[_0x7c33('0xb9')]()[_0x7c33('0xb5')](cmHopper[_0x7c33('0xbd')](_0x26f852))[_0x7c33('0xae')](loggerCatch(_0x7c33('0xbe')));};Dialer['prototype'][_0x7c33('0xbf')]=function(_0x4213a7,_0x2942da,_0x2b6f0b){return BPromise[_0x7c33('0xb9')]()['then'](cmHopper[_0x7c33('0xbf')](_0x4213a7,_0x2942da,_0x2b6f0b))[_0x7c33('0xae')](loggerCatch(_0x7c33('0xc0')));};Dialer['prototype'][_0x7c33('0xc1')]=function(_0x244b54,_0x58345e,_0x44adeb,_0x4c45b8){return BPromise[_0x7c33('0xb9')]()[_0x7c33('0xb5')](cmHopper[_0x7c33('0xc1')](_0x244b54,_0x58345e,_0x44adeb,_0x4c45b8))[_0x7c33('0xae')](loggerCatch(_0x7c33('0xc2')));};Dialer[_0x7c33('0x1d')][_0x7c33('0xc3')]=function(_0x2db57c,_0x27061c,_0x2ce693){return BPromise['resolve']()['then'](cmHopper[_0x7c33('0xc3')](_0x2db57c,_0x27061c,_0x2ce693))['catch'](loggerCatch(_0x7c33('0xc2')));};Dialer[_0x7c33('0x1d')][_0x7c33('0xc4')]=function(_0x4cba3c){return BPromise[_0x7c33('0xb9')]()[_0x7c33('0xb5')](voiceQueueRt[_0x7c33('0xc4')](_0x4cba3c))[_0x7c33('0xae')](loggerCatch('[getVoiceQueueRtPauses]\x20'));};Dialer['prototype'][_0x7c33('0xc5')]=function(_0x2da332){return BPromise[_0x7c33('0xb9')]()[_0x7c33('0xb5')](cmHopper[_0x7c33('0xc5')](_0x2da332))['catch'](loggerCatch('[moveContactManagedDialer]\x20'));};Dialer[_0x7c33('0x1d')][_0x7c33('0xc6')]=function(_0x1df0f6){return BPromise[_0x7c33('0xb9')]()[_0x7c33('0xb5')](cmHopperHistory[_0x7c33('0xc6')](_0x1df0f6))[_0x7c33('0xae')](loggerCatch(_0x7c33('0xc7')));};Dialer['prototype'][_0x7c33('0xb0')]=function(_0x5c1535){if(!_[_0x7c33('0x83')](_0x5c1535)&&_0x5c1535!==null){if(_0x5c1535[_0x7c33('0x97')](_0x7c33('0x6e'))){if(_0x5c1535[_0x7c33('0x6e')]>0x0){_0x5c1535['originated']-=0x1;}else{logger[_0x7c33('0x95')](_0x7c33('0xc8'));}}}else{logger[_0x7c33('0x95')]('[updateOriginated]\x20is\x20null\x20or\x20undefined');}};Dialer[_0x7c33('0x1d')][_0x7c33('0xc9')]=function(_0x32db70,_0x432400){var _0x523a92=this;return function(_0x3fd1bb){_0x523a92[_0x7c33('0xb0')](_0x432400);logger[_0x7c33('0x95')](_0x32db70,util[_0x7c33('0x96')](_0x3fd1bb,{'showHidden':![],'depth':null}));};};Dialer['prototype'][_0x7c33('0xca')]=function(_0xe35c62,_0x41a4cc,_0x1cc584){var _0x33e29a={'state':0x19,'statedesc':_0x7c33('0xcb')};this['updateOriginated'](_0x41a4cc);this[_0x7c33('0xcc')](_[_0x7c33('0x8d')](_0x33e29a,_['pick'](_0x1cc584,[_0x7c33('0xcd'),_0x7c33('0xce'),_0x7c33('0xcf'),'VoiceQueueId',_0x7c33('0xd0')])),_0x7c33('0xd1'),_0x7c33('0xd2'));logger[_0x7c33('0x95')](_0xe35c62);};Dialer[_0x7c33('0x1d')][_0x7c33('0xd3')]=function(_0x105283){return _0x105283==='Success';};Dialer[_0x7c33('0x1d')][_0x7c33('0xd4')]=function(_0x38643c){return!_[_0x7c33('0x83')](_0x38643c)&&_0x38643c&&!_['isUndefined'](_0x38643c[_0x7c33('0x3c')])&&!_[_0x7c33('0x83')](_0x38643c[_0x7c33('0xd5')])&&_0x38643c[_0x7c33('0xd5')]&&(this[_0x7c33('0x25')][util['format'](_0x7c33('0xd6'),_0x38643c[_0x7c33('0x3c')])][_0x7c33('0xd7')]==='reachable'||this[_0x7c33('0x25')][util[_0x7c33('0x74')](_0x7c33('0xd6'),_0x38643c[_0x7c33('0x3c')])][_0x7c33('0xd7')]===_0x7c33('0xd8'));};Dialer[_0x7c33('0x1d')][_0x7c33('0xcc')]=function(_0x20f53b,_0x4ea880,_0x5c94fe){this[_0x7c33('0xc6')](_0x20f53b)[_0x7c33('0xae')](loggerCatch(_0x4ea880));this[_0x7c33('0xc5')](_0x20f53b)[_0x7c33('0xae')](loggerCatch(_0x5c94fe));};Dialer[_0x7c33('0x1d')][_0x7c33('0x35')]=function(_0x328693){var _0x1aa2af=this[_0x7c33('0xa8')][_0x328693[_0x7c33('0xd9')]];var _0x6b0277;if(!_[_0x7c33('0xda')](_0x328693)&&!_[_0x7c33('0xda')](_0x328693['variable'])&&!_['isNil'](_0x328693[_0x7c33('0xdb')][_0x7c33('0xdc')])&&_0x328693[_0x7c33('0xdd')]===_0x7c33('0xde')&&_0x1aa2af){if(_0x1aa2af['type']!=='ivr'&&this[_0x7c33('0x22')][_0x1aa2af[_0x7c33('0xb2')]][_0x7c33('0xdf')]&&_0x328693[_0x7c33('0xe0')]==='HANGUP'){delete this[_0x7c33('0xa8')][_0x328693[_0x7c33('0xd9')]];this[_0x7c33('0xb0')](this[_0x7c33('0x22')][_0x1aa2af[_0x7c33('0xb2')]]);this[_0x7c33('0x22')][_0x1aa2af['queue']][_0x7c33('0x59')]+=0x1;this['voiceQueues'][_0x1aa2af[_0x7c33('0xb2')]][_0x7c33('0x58')]+=0x1;_0x6b0277=new Hangup(_0x1aa2af,_0x328693);_0x6b0277[_0x7c33('0xe1')]=0x12;_0x6b0277['statedesc']='HangupInAMD';_0x6b0277[_0x7c33('0xe2')]='AMD';this[_0x7c33('0xcc')](_0x6b0277,_0x7c33('0xe3'),'[syncHangupInAMD]');}if(_0x1aa2af['type']!=='ivr'&&this['voiceQueues'][_0x1aa2af[_0x7c33('0xb2')]]['dialAMDActive']&&_0x328693[_0x7c33('0xe0')]===_0x7c33('0xe4')){var _0x23be6f=this;return new BPromise(function(_0x4cc816,_0x5576a7){delete _0x23be6f[_0x7c33('0xa8')][_0x328693['uniqueid']];_0x23be6f[_0x7c33('0xb0')](_0x23be6f[_0x7c33('0x22')][_0x1aa2af[_0x7c33('0xb2')]]);_0x23be6f[_0x7c33('0x22')][_0x1aa2af[_0x7c33('0xb2')]]['outboundAnswerCallsDay']+=0x1;_0x23be6f['voiceQueues'][_0x1aa2af[_0x7c33('0xb2')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x4eac9c=_0x23be6f[_0x7c33('0x22')][_0x1aa2af[_0x7c33('0xb2')]];var _0x16ac6c=new Hangup(_0x1aa2af,_0x328693);_0x16ac6c[_0x7c33('0xe1')]=0x13;_0x16ac6c[_0x7c33('0xa7')]=_0x7c33('0xe5');_0x16ac6c[_0x7c33('0xe2')]=_0x7c33('0xe6');_0x16ac6c['countmachineretry']+=0x1;_0x16ac6c[_0x7c33('0xe7')]+=0x1;_0x16ac6c[_0x7c33('0xe8')]=!![];_0x23be6f['createHistory'](_0x16ac6c)[_0x7c33('0xae')](loggerCatch(_0x7c33('0xe9')));if(_0x16ac6c[_0x7c33('0xea')]+_0x16ac6c[_0x7c33('0xeb')]+_0x16ac6c['countnoanswerretry']+_0x16ac6c[_0x7c33('0xec')]+_0x16ac6c[_0x7c33('0xed')]+_0x16ac6c[_0x7c33('0xee')]+_0x16ac6c[_0x7c33('0xef')]+_0x16ac6c[_0x7c33('0xf0')]>=_0x4eac9c[_0x7c33('0xf1')]){_0x23be6f[_0x7c33('0xf2')](_0x16ac6c,_0x4cc816,_0x5576a7,_0x7c33('0xf3'));}else{if(_0x16ac6c[_0x7c33('0xef')]>=_0x4eac9c[_0x7c33('0xf4')]){_0x23be6f['createStateFinal'](_0x16ac6c,_0x4cc816,_0x5576a7,_0x7c33('0xf5'));}else{_0x23be6f['rescheduleContact']({'active':![],'countmachineretry':_0x16ac6c[_0x7c33('0xef')],'scheduledat':moment()[_0x7c33('0xf6')](_0x4eac9c[_0x7c33('0xf7')],_0x7c33('0xf8'))[_0x7c33('0x74')](_0x7c33('0xf9')),'ContactId':_0x16ac6c[_0x7c33('0xcd')],'ListId':_0x16ac6c[_0x7c33('0xce')],'VoiceQueueId':_0x16ac6c['VoiceQueueId']||undefined,'CampaignId':_0x16ac6c[_0x7c33('0xd0')]||undefined})[_0x7c33('0xae')](loggerCatch(_0x7c33('0xfa')));_0x4cc816({'reschedule':0x1});}}});}if(_0x1aa2af[_0x7c33('0x49')]===_0x7c33('0x76')&&this[_0x7c33('0x23')][_0x1aa2af[_0x7c33('0xb2')]][_0x7c33('0xdf')]&&_0x328693['value']===_0x7c33('0xfb')){delete this[_0x7c33('0xa8')][_0x328693['uniqueid']];this['updateOriginated'](this['campaigns'][_0x1aa2af[_0x7c33('0xb2')]]);_0x6b0277=new Hangup(_0x1aa2af,_0x328693);_0x6b0277[_0x7c33('0xe1')]=0x12;_0x6b0277[_0x7c33('0xa7')]=_0x7c33('0xfc');_0x6b0277[_0x7c33('0xe2')]=_0x7c33('0xe6');this[_0x7c33('0xcc')](_0x6b0277,_0x7c33('0xfd'),_0x7c33('0xfe'));}if(_0x1aa2af[_0x7c33('0x49')]===_0x7c33('0x76')&&this[_0x7c33('0x23')][_0x1aa2af['queue']][_0x7c33('0xdf')]&&_0x328693[_0x7c33('0xe0')]==='MACHINE'){var _0x23be6f=this;return new BPromise(function(_0x176e15,_0x440d8b){delete _0x23be6f[_0x7c33('0xa8')][_0x328693[_0x7c33('0xd9')]];_0x23be6f[_0x7c33('0xb0')](_0x23be6f[_0x7c33('0x23')][_0x1aa2af[_0x7c33('0xb2')]]);_0x23be6f[_0x7c33('0x23')][_0x1aa2af[_0x7c33('0xb2')]][_0x7c33('0x59')]+=0x1;_0x23be6f[_0x7c33('0x23')][_0x1aa2af['queue']]['outboundAnswerAgiCallsDay']+=0x1;var _0x4ca51f=_0x23be6f[_0x7c33('0x23')][_0x1aa2af[_0x7c33('0xb2')]];var _0x588643=new Hangup(_0x1aa2af,_0x328693);_0x588643[_0x7c33('0xe1')]=0x13;_0x588643[_0x7c33('0xa7')]=_0x7c33('0xe5');_0x588643[_0x7c33('0xe2')]=_0x7c33('0xe6');_0x588643[_0x7c33('0xef')]+=0x1;_0x588643['countglobal']+=0x1;_0x588643['amd']=!![];_0x23be6f[_0x7c33('0xc6')](_0x588643)[_0x7c33('0xae')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x588643['countbusyretry']+_0x588643[_0x7c33('0xeb')]+_0x588643[_0x7c33('0xff')]+_0x588643[_0x7c33('0xec')]+_0x588643[_0x7c33('0xed')]+_0x588643['countabandonedretry']+_0x588643[_0x7c33('0xef')]+_0x588643[_0x7c33('0xf0')]>=_0x4ca51f[_0x7c33('0xf1')]){_0x23be6f[_0x7c33('0xf2')](_0x588643,_0x176e15,_0x440d8b,_0x7c33('0xf3'));}else{if(_0x588643['countmachineretry']>=_0x4ca51f[_0x7c33('0xf4')]){_0x23be6f[_0x7c33('0x100')](_0x588643,_0x176e15,_0x440d8b,_0x7c33('0xf5'));}else{_0x23be6f[_0x7c33('0xbd')]({'active':![],'countmachineretry':_0x588643[_0x7c33('0xef')],'scheduledat':moment()[_0x7c33('0xf6')](_0x4ca51f[_0x7c33('0xf7')],_0x7c33('0xf8'))[_0x7c33('0x74')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x588643['ContactId'],'ListId':_0x588643[_0x7c33('0xce')],'VoiceQueueId':_0x588643['VoiceQueueId']||undefined,'CampaignId':_0x588643[_0x7c33('0xd0')]||undefined})[_0x7c33('0xae')](loggerCatch('[rescheduleContact][Machine]'));_0x176e15({'reschedule':0x1});}}});}}};Dialer[_0x7c33('0x1d')]['syncHangup']=function(_0x564a7c){var _0x8f817d=this['uniqueId'][_0x564a7c[_0x7c33('0xd9')]];var _0x46800d=this;var _0x37584b;if(_0x8f817d&&_0x8f817d[_0x7c33('0x49')]===_0x7c33('0x76')){delete this[_0x7c33('0xa8')][_0x564a7c[_0x7c33('0xd9')]];this['updateOriginated'](this[_0x7c33('0x23')][_0x8f817d[_0x7c33('0xb2')]]);this['campaigns'][_0x8f817d[_0x7c33('0xb2')]][_0x7c33('0x101')]+=0x1;_0x37584b=new Hangup(_0x8f817d,_0x564a7c);this[_0x7c33('0xc6')](_0x37584b)[_0x7c33('0xae')](loggerCatch(_0x7c33('0x102')));this['moveContactManagedDialer'](_0x37584b)['catch'](loggerCatch(_0x7c33('0x103')));}if(_0x8f817d&&_0x8f817d[_0x7c33('0x49')]!==_0x7c33('0x76')&&isNotNull(this[_0x7c33('0x22')][_0x8f817d[_0x7c33('0xb2')]][_0x7c33('0x104')])){delete this[_0x7c33('0xa8')][_0x564a7c[_0x7c33('0xd9')]];this[_0x7c33('0xb0')](this[_0x7c33('0x22')][_0x8f817d[_0x7c33('0xb2')]]);this[_0x7c33('0x22')][_0x8f817d['queue']]['outboundAnswerCallsDay']+=0x1;this['voiceQueues'][_0x8f817d['queue']][_0x7c33('0x58')]+=0x1;_0x37584b=new Hangup(_0x8f817d,_0x564a7c);_0x37584b[_0x7c33('0xe1')]=0x10;_0x37584b['statedesc']=_0x7c33('0x105');_0x37584b[_0x7c33('0xe2')]=_0x7c33('0x106');this[_0x7c33('0xc6')](_0x37584b)[_0x7c33('0xae')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x7c33('0xc5')](_0x37584b)[_0x7c33('0xae')](loggerCatch(_0x7c33('0x103')));}if(_0x8f817d&&_0x8f817d[_0x7c33('0x49')]!=='ivr'&&!isNotNull(this[_0x7c33('0x22')][_0x8f817d[_0x7c33('0xb2')]][_0x7c33('0x104')])){delete this[_0x7c33('0xa8')][_0x564a7c['uniqueid']];this[_0x7c33('0xb0')](this[_0x7c33('0x22')][_0x8f817d[_0x7c33('0xb2')]]);this[_0x7c33('0x22')][_0x8f817d[_0x7c33('0xb2')]]['outboundUnknownCallsDay']+=0x1;_0x37584b=new Hangup(_0x8f817d,_0x564a7c);_0x37584b['state']=0xc;_0x37584b[_0x7c33('0xa7')]=_0x564a7c[_0x7c33('0x107')];_0x37584b['membername']=_0x7c33('0x108');this[_0x7c33('0xc6')](_0x37584b)[_0x7c33('0xae')](loggerCatch(_0x7c33('0x102')));this[_0x7c33('0xc5')](_0x37584b)[_0x7c33('0xae')](loggerCatch(_0x7c33('0x103')));}};Dialer[_0x7c33('0x1d')][_0x7c33('0x109')]=function(_0x5d5dbb){var _0x31ebc6=this[_0x7c33('0xa8')][_0x5d5dbb[_0x7c33('0xd9')]];var _0x768824=this;if(this[_0x7c33('0x22')][_0x5d5dbb[_0x7c33('0xb2')]]){if(_0x31ebc6&&_0x31ebc6['type']!==_0x7c33('0x76')){delete this[_0x7c33('0xa8')][_0x5d5dbb[_0x7c33('0xd9')]];this['voiceQueues'][_0x5d5dbb['queue']][_0x7c33('0x59')]+=0x1;var _0x4234b9=new AgentComplete(_0x31ebc6,_0x5d5dbb);if(_0x5d5dbb['reason']===_0x7c33('0x10a')){_0x4234b9[_0x7c33('0x10b')]=this['voiceQueues'][_0x5d5dbb[_0x7c33('0xb2')]][_0x7c33('0x10c')]&&this[_0x7c33('0x22')][_0x5d5dbb['queue']][_0x7c33('0x10d')]?moment()[_0x7c33('0x74')](_0x7c33('0xf9')):undefined;}this['createHistory'](_0x4234b9)[_0x7c33('0xae')](loggerCatch('[syncAgentComplete][createHistory]'));this[_0x7c33('0xc5')](_0x4234b9)[_0x7c33('0xae')](loggerCatch(_0x7c33('0x10e')));}}};Dialer[_0x7c33('0x1d')][_0x7c33('0x10f')]=function(_0x4283db){if(this[_0x7c33('0x22')][_0x4283db[_0x7c33('0xb2')]]){if(this[_0x7c33('0xa8')][_0x4283db[_0x7c33('0xd9')]]&&this[_0x7c33('0xa8')][_0x4283db['uniqueid']][_0x7c33('0x49')]!==_0x7c33('0x76')){this[_0x7c33('0xb0')](this[_0x7c33('0x22')][_0x4283db[_0x7c33('0xb2')]]);this[_0x7c33('0xa8')][_0x4283db[_0x7c33('0xd9')]][_0x7c33('0x110')]=moment()[_0x7c33('0x74')](_0x7c33('0xf9'));}}};Dialer[_0x7c33('0x1d')][_0x7c33('0x111')]=function(_0x38ad63){this[_0x7c33('0xc6')](_0x38ad63)['catch'](loggerCatch(_0x7c33('0x112')));this['moveContactManagedDialer'](_0x38ad63)['catch'](loggerCatch(_0x7c33('0x113')));};Dialer[_0x7c33('0x1d')][_0x7c33('0x114')]=function(_0x1b1d24){var _0xfc43dc=this[_0x7c33('0xa8')][_0x1b1d24['uniqueid']];var _0x29d51a=this;if(this[_0x7c33('0x22')][_0x1b1d24[_0x7c33('0xb2')]]){if(_0xfc43dc&&_0xfc43dc['type']!==_0x7c33('0x76')){delete this[_0x7c33('0xa8')][_0x1b1d24[_0x7c33('0xd9')]];this[_0x7c33('0xb0')](this[_0x7c33('0x22')][_0x1b1d24[_0x7c33('0xb2')]]);_0xfc43dc[_0x7c33('0x115')]=moment()['format'](_0x7c33('0xf9'));var _0x3e1db8=new QueueCallerAbandon(_0xfc43dc,_0x1b1d24);if(getSeconds(_0xfc43dc[_0x7c33('0x115')],_0xfc43dc[_0x7c33('0x116')])>=_0xfc43dc[_0x7c33('0x117')]){this[_0x7c33('0x22')][_0x1b1d24[_0x7c33('0xb2')]][_0x7c33('0x7d')]+=0x1;this['voiceQueues'][_0x1b1d24[_0x7c33('0xb2')]][_0x7c33('0x5f')]+=0x1;this[_0x7c33('0x22')][_0x1b1d24[_0x7c33('0xb2')]]['predictiveIntervalErlangCallsDroppedCalls']+=0x1;_0x3e1db8[_0x7c33('0xe1')]=0xa;_0x3e1db8[_0x7c33('0xa7')]=_0x7c33('0x118');_0x3e1db8[_0x7c33('0x119')]=_0x7c33('0x11a');_0x3e1db8[_0x7c33('0x10b')]=this[_0x7c33('0x22')][_0x1b1d24[_0x7c33('0xb2')]]['dialQueueProject2']?moment()[_0x7c33('0x74')](_0x7c33('0xf9')):undefined;_0x3e1db8[_0x7c33('0xed')]+=0x1;_0x3e1db8['countglobal']+=0x1;if(_0x3e1db8[_0x7c33('0xed')]>=this[_0x7c33('0x22')][_0x1b1d24[_0x7c33('0xb2')]][_0x7c33('0x11b')]){this[_0x7c33('0x111')](_0x3e1db8);}else{this[_0x7c33('0xbd')]({'active':![],'countdropretry':_0x3e1db8[_0x7c33('0xed')],'scheduledat':moment()[_0x7c33('0xf6')](this[_0x7c33('0x22')][_0x1b1d24[_0x7c33('0xb2')]][_0x7c33('0x11c')],'minutes')[_0x7c33('0x74')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0xfc43dc[_0x7c33('0xcd')],'ListId':_0xfc43dc['ListId'],'VoiceQueueId':_0xfc43dc[_0x7c33('0x11d')]||undefined,'CampaignId':_0xfc43dc[_0x7c33('0xd0')]||undefined})['catch'](loggerCatch(_0x7c33('0x11e')));var _0x303e32=new History(_0x3e1db8);_0x303e32[_0x7c33('0xe1')]=0xa;_0x303e32['statedesc']=_0x7c33('0x118');_0x303e32['starttime']=moment()[_0x7c33('0x74')]('YYYY-MM-DD\x20HH:mm:ss');_0x303e32[_0x7c33('0x11f')]=_0x303e32['starttime'];_0x303e32[_0x7c33('0x120')]=_0x3e1db8['calleridname'];_0x303e32[_0x7c33('0x121')]=_0x3e1db8[_0x7c33('0x121')];this[_0x7c33('0xc6')](_0x303e32)[_0x7c33('0xae')](loggerCatch(_0x7c33('0x122')));}}else{this[_0x7c33('0x22')][_0x1b1d24['queue']]['predictiveIntervalDroppedCallsCallersExit']+=0x1;this[_0x7c33('0x22')][_0x1b1d24['queue']][_0x7c33('0x5e')]+=0x1;_0x3e1db8[_0x7c33('0xe1')]=0xb;_0x3e1db8[_0x7c33('0xa7')]='Abandoned';_0x3e1db8['dropreason']=_0x7c33('0x123');_0x3e1db8[_0x7c33('0xee')]+=0x1;_0x3e1db8[_0x7c33('0xe7')]+=0x1;if(_0x3e1db8[_0x7c33('0xee')]>=this[_0x7c33('0x22')][_0x1b1d24['queue']][_0x7c33('0x124')]){this[_0x7c33('0x111')](_0x3e1db8);}else{this[_0x7c33('0xbd')]({'active':![],'countabandonedretry':_0x3e1db8[_0x7c33('0xee')],'scheduledat':moment()['add'](this[_0x7c33('0x22')][_0x1b1d24[_0x7c33('0xb2')]][_0x7c33('0x125')],_0x7c33('0xf8'))[_0x7c33('0x74')](_0x7c33('0xf9')),'ContactId':_0xfc43dc[_0x7c33('0xcd')],'ListId':_0xfc43dc[_0x7c33('0xce')],'VoiceQueueId':_0xfc43dc[_0x7c33('0x11d')]||undefined,'CampaignId':_0xfc43dc[_0x7c33('0xd0')]||undefined})[_0x7c33('0xae')](loggerCatch(_0x7c33('0x126')));var _0x303e32=new History(_0x3e1db8);_0x303e32[_0x7c33('0xe1')]=0xb;_0x303e32[_0x7c33('0xa7')]='Abandoned';_0x303e32[_0x7c33('0x127')]=moment()['format'](_0x7c33('0xf9'));_0x303e32[_0x7c33('0x11f')]=_0x303e32['starttime'];_0x303e32['calleridname']=_0x3e1db8[_0x7c33('0x120')];_0x303e32[_0x7c33('0x121')]=_0x3e1db8['calleridnum'];this[_0x7c33('0xc6')](_0x303e32)[_0x7c33('0xae')](loggerCatch(_0x7c33('0x128')));}}}}};Dialer[_0x7c33('0x1d')][_0x7c33('0x129')]=function(_0x454948){if(this[_0x7c33('0x28')][_0x454948[_0x7c33('0xd9')]]){this[_0x7c33('0x28')][_0x454948[_0x7c33('0xd9')]][_0x7c33('0xad')]=_0x454948[_0x7c33('0xad')];}if(this[_0x7c33('0xa8')][_0x454948['uniqueid']]){this[_0x7c33('0xa8')][_0x454948['uniqueid']][_0x7c33('0xad')]=_0x454948[_0x7c33('0xad')];}};Dialer['prototype'][_0x7c33('0x37')]=function(_0x1c0307){if(strategy[this[_0x7c33('0x22')][this['actions'][_0x1c0307[_0x7c33('0x12a')]]['queue']][_0x7c33('0x4b')]]===_0x7c33('0x1c')){if(this[_0x7c33('0x28')][_0x1c0307['actionid']]&&_['isNil'](this[_0x7c33('0x28')][_0x1c0307[_0x7c33('0x12a')]][_0x7c33('0x12b')])&&_0x1c0307['status']==='1'&&_0x1c0307['paused']==='0'){if(this[_0x7c33('0x24')][_0x1c0307[_0x7c33('0x12c')]]){if(!this['agents'][_0x1c0307[_0x7c33('0x12c')]][_0x7c33('0x12b')]){this[_0x7c33('0x24')][_0x1c0307[_0x7c33('0x12c')]][_0x7c33('0x12b')]=!![];this[_0x7c33('0x28')][_0x1c0307[_0x7c33('0x12a')]][_0x7c33('0x12b')]=!![];this[_0x7c33('0x28')][_0x1c0307[_0x7c33('0x12a')]][_0x7c33('0x12c')]=_0x1c0307[_0x7c33('0x12c')];}}}}else if((strategy[this[_0x7c33('0x22')][this[_0x7c33('0x28')][_0x1c0307[_0x7c33('0x12a')]][_0x7c33('0xb2')]]['strategy']]||_0x7c33('0x1b'))==='rrmemory'){if(this['actions'][_0x1c0307[_0x7c33('0x12a')]]){if(this[_0x7c33('0x24')][_0x1c0307[_0x7c33('0x12c')]]){this[_0x7c33('0x28')][_0x1c0307['actionid']][_0x7c33('0x12c')]=_0x1c0307[_0x7c33('0x12c')];if(_[_0x7c33('0xda')](this[_0x7c33('0x12d')][this[_0x7c33('0x28')][_0x1c0307['actionid']][_0x7c33('0xb2')]])){this[_0x7c33('0x12d')][this[_0x7c33('0x28')][_0x1c0307[_0x7c33('0x12a')]]['queue']]=[];}this['queueBooked'][this[_0x7c33('0x28')][_0x1c0307[_0x7c33('0x12a')]][_0x7c33('0xb2')]][_0x7c33('0x12e')](_[_0x7c33('0x8d')](_['pick'](this[_0x7c33('0x28')][_0x1c0307[_0x7c33('0x12a')]],[_0x7c33('0x12f'),_0x7c33('0x12c')]),{'status':_0x1c0307[_0x7c33('0xd7')],'paused':_0x1c0307[_0x7c33('0x130')]}));}}}};function unlockQueueStatus(_0x1cab1f,_0x472de6){setTimeout(function(){if(_[_0x7c33('0x83')](_0x1cab1f['queueStatusComplete'])){loggerBooked[_0x7c33('0x95')](_0x7c33('0x131'),_0x472de6);}_0x1cab1f[_0x7c33('0x132')]=!![];loggerBooked[_0x7c33('0x7a')]('[booked][unlockQueueStatus]',_0x472de6,JSON['stringify'](_[_0x7c33('0x133')](_0x1cab1f,[_0x7c33('0x3c'),_0x7c33('0x132')])));},0x1f3);}Dialer['prototype'][_0x7c33('0x134')]=function(_0x56645c){var _0x1bcff4=this;var _0x3a8b7b=_0x1bcff4['voiceQueues'][_0x1bcff4[_0x7c33('0x28')][_0x56645c[_0x7c33('0x12a')]]['queue']];if(strategy[this['voiceQueues'][this['actions'][_0x56645c['actionid']]['queue']][_0x7c33('0x4b')]]==='roundrobin'){if(this['actions'][_0x56645c[_0x7c33('0x12a')]]&&this[_0x7c33('0x28')][_0x56645c[_0x7c33('0x12a')]]['stateinterface']){this['preview'][_0x7c33('0x135')](this[_0x7c33('0x28')][_0x56645c['actionid']][_0x7c33('0x12f')],this['actions'][_0x56645c[_0x7c33('0x12a')]]['stateinterface'])[_0x7c33('0xae')](function(_0x4583d9){logger[_0x7c33('0x95')](_0x7c33('0x136'),util['inspect'](_0x4583d9,{'showHidden':![],'depth':null}));})[_0x7c33('0x20')](function(){_0x1bcff4['updateOriginated'](_0x1bcff4[_0x7c33('0x22')][_0x1bcff4[_0x7c33('0x28')][_0x56645c[_0x7c33('0x12a')]][_0x7c33('0xb2')]]);_0x1bcff4['agents'][_0x1bcff4[_0x7c33('0x28')][_0x56645c['actionid']][_0x7c33('0x12c')]][_0x7c33('0x12b')]=![];delete _0x1bcff4[_0x7c33('0x28')][_0x56645c[_0x7c33('0x12a')]];unlockQueueStatus(_0x3a8b7b);});}else{this[_0x7c33('0xb0')](this[_0x7c33('0x22')][this[_0x7c33('0x28')][_0x56645c[_0x7c33('0x12a')]][_0x7c33('0xb2')]]);this[_0x7c33('0xbd')]({'active':![],'ContactId':this[_0x7c33('0x28')][_0x56645c[_0x7c33('0x12a')]][_0x7c33('0xcd')],'ListId':this[_0x7c33('0x28')][_0x56645c[_0x7c33('0x12a')]]['ListId'],'VoiceQueueId':this[_0x7c33('0x28')][_0x56645c[_0x7c33('0x12a')]][_0x7c33('0x11d')]||undefined,'CampaignId':this['actions'][_0x56645c[_0x7c33('0x12a')]][_0x7c33('0xd0')]||undefined})['catch'](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this[_0x7c33('0x28')][_0x56645c[_0x7c33('0x12a')]];unlockQueueStatus(_0x3a8b7b);}}else if((strategy[this[_0x7c33('0x22')][this[_0x7c33('0x28')][_0x56645c[_0x7c33('0x12a')]][_0x7c33('0xb2')]][_0x7c33('0x4b')]]||_0x7c33('0x1b'))===_0x7c33('0x1b')){var _0x3780a6;if(this[_0x7c33('0x28')][_0x56645c[_0x7c33('0x12a')]]&&!_['isEmpty'](this[_0x7c33('0x12d')][this[_0x7c33('0x28')][_0x56645c[_0x7c33('0x12a')]]['queue']])){if(this[_0x7c33('0x2e')][_0x1bcff4[_0x7c33('0x28')][_0x56645c[_0x7c33('0x12a')]][_0x7c33('0xb2')]]){this[_0x7c33('0x2e')][_0x1bcff4[_0x7c33('0x28')][_0x56645c[_0x7c33('0x12a')]]['queue']]=this[_0x7c33('0x2e')][this[_0x7c33('0x28')][_0x56645c[_0x7c33('0x12a')]]['queue']]?this['queueBookedRR'][this[_0x7c33('0x28')][_0x56645c[_0x7c33('0x12a')]][_0x7c33('0xb2')]]:this['queueBooked'][this[_0x7c33('0x28')][_0x56645c[_0x7c33('0x12a')]][_0x7c33('0xb2')]]?this[_0x7c33('0x12d')][this[_0x7c33('0x28')][_0x56645c[_0x7c33('0x12a')]][_0x7c33('0xb2')]][_0x7c33('0x137')]||0x0:0x0;}this[_0x7c33('0x12d')][this[_0x7c33('0x28')][_0x56645c[_0x7c33('0x12a')]][_0x7c33('0xb2')]]['_rr']=this[_0x7c33('0x2e')][this[_0x7c33('0x28')][_0x56645c[_0x7c33('0x12a')]][_0x7c33('0xb2')]];for(var _0x528822=0x0;_0x528822=0x0?!![]:![];})[_0x7c33('0xae')](myreject(_0x38e0ac)));}}else{_0x5c1ef0[_0x7c33('0x12e')](ami[_0x7c33('0x14f')]({'action':_0x7c33('0x154'),'command':util[_0x7c33('0x74')](_0x7c33('0x150'),_0x3c4ebc,!_[_0x7c33('0x83')](config[_0x7c33('0x14b')][_0x1c4d5b])?_0x1c4d5b:'')})[_0x7c33('0xb5')](function(_0x2d2475){return _0x2d2475[_0x7c33('0x155')][_0x7c33('0x152')](_0x7c33('0x153'))>=0x0?!![]:![];})[_0x7c33('0xae')](myreject(_0x38e0ac)));}BPromise[_0x7c33('0x156')](_0x5c1ef0)[_0x7c33('0xb5')](function(_0x16d4a9){var _0x578119=_[_0x7c33('0x157')](_0x16d4a9);if(_0x578119){return _0x37be5e(_0x578119);}else{_0x344a89[_0x7c33('0x3e')]=_0x5e98c6?_0x7c33('0x158'):_0x7c33('0x159');return _0x38e0ac(msgResponse(_0x7c33('0x15a'),_0x7c33('0x149'),_0x7c33('0x15b')+_0x5e98c6+'\x20'+_0x577ca8+'\x20Interval\x20is\x20overtime:\x20'+util['inspect'](_0x3c4ebc,{'showHidden':![],'depth':null})+_0x7c33('0x15c')+_0x1c4d5b));}})[_0x7c33('0xae')](function(_0x555b14){return _0x38e0ac(msgResponse(_0x7c33('0x148'),'Failure',JSON[_0x7c33('0x73')](_0x555b14)));});});};Dialer['prototype'][_0x7c33('0x15d')]=function(_0x524a62){var _0x493ccf=this;return function(){switch(_0x524a62['dialMethod']){case _0x7c33('0x15e'):freeVariablesPredictive(_0x524a62);_0x493ccf['handlePower'](_0x524a62,0x1);break;case'power':freeVariablesPredictive(_0x524a62);_0x493ccf[_0x7c33('0x15f')](_0x524a62,_0x524a62[_0x7c33('0x160')]);break;case _0x7c33('0x161'):_0x493ccf['predictive'](_0x524a62);break;case _0x7c33('0x8'):freeVariablesPredictive(_0x524a62);_0x493ccf[_0x7c33('0x15f')](_0x524a62,0x1);break;default:freeVariablesPredictive(_0x524a62);logger[_0x7c33('0x95')](_0x7c33('0x162'),_0x524a62[_0x7c33('0x3c')],_0x7c33('0x163'));}};};Dialer[_0x7c33('0x1d')][_0x7c33('0x164')]=function(_0x2ba5f1){var _0x2651f0=this;return function(){_0x2651f0[_0x7c33('0x165')](_0x2ba5f1);};};Dialer[_0x7c33('0x1d')][_0x7c33('0x9')]=function(_0x948a61){var _0x1a5ec1=this;if(isNotPreview(_0x948a61[_0x7c33('0x55')])){if(isVoiceQueueOutbound(_0x948a61['type'])&&isActive(_0x948a61[_0x7c33('0x54')])){_0x948a61[_0x7c33('0x9e')]=!![];BPromise[_0x7c33('0xb9')]()[_0x7c33('0xb5')](checkIsLoggedIn(_0x948a61,_0x948a61[_0x7c33('0x4d')]))[_0x7c33('0xb5')](checkIsActive(_0x948a61,_0x948a61[_0x7c33('0x54')]))[_0x7c33('0xb5')](checkInterval(_0x948a61))[_0x7c33('0xb5')](_0x1a5ec1[_0x7c33('0x142')](_0x948a61))[_0x7c33('0xb5')](_0x1a5ec1[_0x7c33('0x146')](_0x948a61['dialGlobalInterval'],_0x948a61[_0x7c33('0x166')],_0x948a61[_0x7c33('0x3c')],_0x948a61))[_0x7c33('0xb5')](_0x1a5ec1['checkIfTimeIntervals'](_0x948a61[_0x7c33('0x44')],_0x948a61[_0x7c33('0x166')],_0x948a61[_0x7c33('0x3c')],_0x948a61))['then'](_0x1a5ec1['checkDialMethod'](_0x948a61))[_0x7c33('0xae')](loggerCatchQueueSummary(_0x7c33('0x167'),_0x948a61));}else{notSendMessagesQueue(_0x948a61);}}else{freeVariablesPredictive(_0x948a61);}};Dialer[_0x7c33('0x1d')][_0x7c33('0x141')]=function(){var _0x1d0906=this;var _0x183b2b;for(var _0x51582a in this[_0x7c33('0x23')]){if(this[_0x7c33('0x23')]['hasOwnProperty'](_0x51582a)){_0x183b2b=this['campaigns'][_0x51582a];if(isCampaignIvr(_0x183b2b[_0x7c33('0x49')])&&isActive(_0x183b2b[_0x7c33('0xd5')])){_0x183b2b['sendMessageOneNotActive']=!![];BPromise[_0x7c33('0xb9')]()['then'](checkIsActive(_0x183b2b,_0x183b2b['active']))[_0x7c33('0xb5')](checkInterval(_0x183b2b))['then'](_0x1d0906[_0x7c33('0x142')](_0x183b2b))[_0x7c33('0xb5')](_0x1d0906[_0x7c33('0x146')](_0x183b2b['dialGlobalInterval'],_0x183b2b[_0x7c33('0x166')],_0x183b2b[_0x7c33('0x3c')],_0x183b2b))[_0x7c33('0xb5')](_0x1d0906[_0x7c33('0x147')](_0x183b2b[_0x7c33('0x44')],_0x183b2b['dialTimezone'],_0x183b2b[_0x7c33('0x3c')],_0x183b2b))[_0x7c33('0xb5')](_0x1d0906['launchHandleIvr'](_0x183b2b))[_0x7c33('0xae')](loggerCatchQueueSummary(_0x7c33('0x168'),_0x183b2b));}else{notSendMessagesCampaign(_0x183b2b);}}}};function getCallerIdRandom(_0x1930cc,_0x386535){var _0x424d01,_0x441d2f,_0x696429;if(_0x386535<=0x0){_0x386535=0x1;}_0x424d01=new RegExp(_0x7c33('0x169')+_0x386535+'}$');_0x441d2f=Math['pow'](0xa,_0x386535-0x1);_0x696429=Math[_0x7c33('0x16a')](0xa,_0x386535)-0x1;return util['format']('%s',_['replace'](_0x1930cc,_0x424d01,_[_0x7c33('0x16b')](_0x441d2f,_0x696429)));}function extractCalleridName(_0x40839a){var _0x42d85d=_0x40839a['match'](/"(.*?)"/);return _0x42d85d?_0x42d85d[0x1]:_0x40839a;}function extractCalleridNumber(_0x4596fe){var _0x4331e4=_0x4596fe[_0x7c33('0x16c')](/<(.*?)>/);return _0x4331e4?_0x4331e4[0x1]:_0x4596fe;}Dialer[_0x7c33('0x1d')][_0x7c33('0x16d')]=function(_0x4724b6,_0x327a84){var _0xddc223=this;var _0x511c33=uuid['v4']();this[_0x7c33('0x28')][_0x511c33]=new Action(_0x4724b6,_0x327a84,_0x511c33);return new BPromise(function(_0x81b94a,_0x1208c8){if(_[_0x7c33('0x83')](_0x4724b6)&&_0x7c33('0x16e')!==typeof _0x4724b6){return _0x1208c8(msgResponse(_0x7c33('0x16f'),_0x7c33('0x149'),_0x7c33('0x170')));}if(_['isUndefined'](_0x327a84['Contact'][_0x7c33('0x171')])||_0x327a84[_0x7c33('0x172')]['phone']===null){return _0x1208c8(msgResponse(_0x7c33('0x16f'),_0x7c33('0x149'),'contact\x20is\x20undefine'));}var _0x430a9a={'XMD-CALLERID':_0xddc223[_0x7c33('0x28')][_0x511c33][_0x7c33('0x173')](),'XMD-AGI':_0x4724b6['dialQueueProject']?util[_0x7c33('0x74')](_0x7c33('0x174'),ipAgi,_0x4724b6['dialQueueProject']):_0x7c33('0x175'),'XMD-AGIAFTER':_0x4724b6['dialQueueProject2']?util[_0x7c33('0x74')]('\x22agi://%s/square,%s\x22',ipAgi,_0x4724b6[_0x7c33('0x10c')]):_0x7c33('0x175'),'XMD-QUEUE':_0x4724b6[_0x7c33('0x49')]===_0x7c33('0x4a')?util[_0x7c33('0x74')]('\x22%s,%s%s,,,%s\x22',_0x4724b6[_0x7c33('0x3c')],_0x4724b6[_0x7c33('0x176')]||'',_0x4724b6[_0x7c33('0x10d')]?'c':'',_0x4724b6[_0x7c33('0x117')]||0x3):_0x7c33('0x175'),'XMD-CONTACTID':_0x327a84['ContactId'],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0xddc223['actions'][_0x511c33]['getCaller'](),'XMD-AMD':_0x4724b6[_0x7c33('0xdf')]?_0x7c33('0x177'):_0x7c33('0x175'),'XMD-DESTINATION':_0x7c33('0xde')};if(_0x4724b6[_0x7c33('0xdf')]){_0x430a9a[_0x7c33('0x178')]=_0x4724b6[_0x7c33('0x179')]||0x9c4;_0x430a9a[_0x7c33('0x17a')]=_0x4724b6[_0x7c33('0x17b')]||0x5dc;_0x430a9a[_0x7c33('0x17c')]=_0x4724b6[_0x7c33('0x17d')]||0x320;_0x430a9a[_0x7c33('0x17e')]=_0x4724b6['dialAMDTotalAnalysisTime']||0x1388;_0x430a9a[_0x7c33('0x17f')]=_0x4724b6[_0x7c33('0x180')]||0x64;_0x430a9a['XMD-AMDBETWEENWORDSSILENCE']=_0x4724b6[_0x7c33('0x181')]||0x32;_0x430a9a[_0x7c33('0x182')]=_0x4724b6['dialAMDMaximumNumberOfWords']||0x3;_0x430a9a['XMD-AMDSILENCETHRESHOLD']=_0x4724b6[_0x7c33('0x183')]||0x100;_0x430a9a[_0x7c33('0x184')]=_0x4724b6[_0x7c33('0x185')]||0x1388;}if(_0x4724b6[_0x7c33('0x49')]===_0x7c33('0x4a')){_0x430a9a[_0x7c33('0x186')]=_0x327a84['VoiceQueueId'];}else{_0x430a9a['XMD-CAMPAIGNID']=_0x327a84[_0x7c33('0xd0')];}for(var _0x5bdc1a in _0x327a84[_0x7c33('0x172')]){if(_0x327a84['Contact']['hasOwnProperty'](_0x5bdc1a)){if(isNotNull(_0x327a84['Contact'][_0x5bdc1a])&&_0x5bdc1a!=='id'&&_0x5bdc1a!==_0x7c33('0x187')&&_0x5bdc1a!==_0x7c33('0x188')&&_0x5bdc1a!=='updatedAt'){_0x430a9a[util['format'](_0x7c33('0x189'),_0x7c33('0x18a'),_[_0x7c33('0x18b')](_0x5bdc1a))]=_0x327a84[_0x7c33('0x172')][_0x5bdc1a];}}}var _0x321962=_0xddc223[_0x7c33('0xd4')](_0x4724b6[_0x7c33('0x71')])?getCallerId(_0x4724b6['Trunk']['callerid'],_0x4724b6[_0x7c33('0x18c')],_0x4724b6[_0x7c33('0x18d')]>0x0?getCallerIdRandom(_0x4724b6[_0x7c33('0x56')],_0x4724b6[_0x7c33('0x18d')]):_0x4724b6[_0x7c33('0x56')]):getCallerId(_[_0x7c33('0xda')](_0x4724b6[_0x7c33('0x143')])?_0x4724b6['Trunk'][_0x7c33('0x72')]:_0x4724b6['TrunkBackup']['callerid'],_0x4724b6[_0x7c33('0x18c')],_0x4724b6['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x4724b6[_0x7c33('0x56')],_0x4724b6[_0x7c33('0x18d')]):_0x4724b6['dialOriginateCallerIdNumber']);if(_0x321962){_0x430a9a[_0x7c33('0x18e')]=_0xddc223[_0x7c33('0x28')][_0x511c33][_0x7c33('0x18f')]=extractCalleridName(_0x321962);_0x430a9a[_0x7c33('0x190')]=_0xddc223[_0x7c33('0x28')][_0x511c33][_0x7c33('0x191')]=extractCalleridNumber(_0x321962);}return ami[_0x7c33('0x14f')]({'actionid':_0x511c33,'action':'originate','channel':_0xddc223[_0x7c33('0xd4')](_0x4724b6['Trunk'])?util[_0x7c33('0x74')](_0x7c33('0x192'),_0x4724b6[_0x7c33('0x71')][_0x7c33('0x3c')],isNotNull(_0x4724b6[_0x7c33('0x57')])?_0x4724b6[_0x7c33('0x57')][_0x7c33('0x193')]()||'':'',_0x4724b6[_0x7c33('0x194')]>0x0?_0x327a84[_0x7c33('0x172')]['phone'][_0x7c33('0x195')](_0x4724b6[_0x7c33('0x194')]):_0x327a84['Contact'][_0x7c33('0x171')]):util[_0x7c33('0x74')](_0x7c33('0x192'),_['isNil'](_0x4724b6[_0x7c33('0x143')])?_0x4724b6[_0x7c33('0x71')][_0x7c33('0x3c')]:_0x4724b6[_0x7c33('0x143')][_0x7c33('0x3c')],isNotNull(_0x4724b6[_0x7c33('0x57')])?_0x4724b6[_0x7c33('0x57')]['trim']()||'':'',_0x4724b6[_0x7c33('0x194')]>0x0?_0x327a84['Contact'][_0x7c33('0x171')][_0x7c33('0x195')](_0x4724b6[_0x7c33('0x194')]):_0x327a84[_0x7c33('0x172')][_0x7c33('0x171')]),'callerid':_0x321962,'Exten':_0x7c33('0xde'),'Context':'from-sip','Priority':'1','variable':_0x430a9a,'timeout':(_0x4724b6[_0x7c33('0x196')]||0x1e)*0x3e8,'async':!![],'channelid':_0x511c33})['then'](function(_0x282f42){return _0x81b94a(_0x282f42);})['catch'](function(_0x3c5754){_0x4724b6[_0x7c33('0x197')]+=0x1;var _0x16acc9=new History(_0xddc223[_0x7c33('0x28')][_0x511c33]);logger[_0x7c33('0x95')](util[_0x7c33('0x74')]('[originateError]:\x20%s',JSON[_0x7c33('0x73')](_0x3c5754)));_0x16acc9['state']=0xe;_0x16acc9[_0x7c33('0xa7')]=_0x7c33('0x198');_0x16acc9[_0x7c33('0x127')]=moment()['format'](_0x7c33('0xf9'));_0x16acc9['endtime']=_0x16acc9[_0x7c33('0x127')];_0xddc223['createHistory'](_0x16acc9)['catch'](loggerCatch(_0x7c33('0x199')));_0xddc223[_0x7c33('0xc5')](_0x16acc9)[_0x7c33('0xae')](loggerCatch(_0x7c33('0x199')))[_0x7c33('0x20')](function(){delete _0xddc223[_0x7c33('0x28')][_0x511c33];return _0x1208c8(msgResponse(_0x7c33('0x16f'),_0x7c33('0x19a'),_0x7c33('0x19b')));});});});};Dialer[_0x7c33('0x1d')][_0x7c33('0x31')]=function(_0x4975c8){var _0x120efd=this[_0x7c33('0x28')][_0x4975c8[_0x7c33('0x12a')]];var _0x5a36b7=this;if(_0x120efd){delete this['actions'][_0x4975c8['actionid']];_0x120efd['responsetime']=moment()[_0x7c33('0x74')](_0x7c33('0xf9'));var _0x2dcf9d=_0x120efd[_0x7c33('0x49')]===_0x7c33('0x76')?this[_0x7c33('0x23')][_0x120efd[_0x7c33('0xb2')]]:this[_0x7c33('0x22')][_0x120efd[_0x7c33('0x19c')]()];if(!this[_0x7c33('0xd3')](_0x4975c8[_0x7c33('0x19d')])){this[_0x7c33('0xb0')](_0x2dcf9d);return this[_0x7c33('0x19e')](_0x120efd,_0x2dcf9d,_0x4975c8)['then'](function(_0x452b52){})['catch'](loggerCatch(_0x7c33('0x19f')));}else{this[_0x7c33('0xa8')][_0x4975c8[_0x7c33('0xd9')]]=_0x120efd;}}};Dialer[_0x7c33('0x1d')][_0x7c33('0x1a0')]=function(_0x13e3d0,_0x39f8b6,_0x5c8b82){var _0x108a33=new History(_0x39f8b6);if(_0x108a33['countbusyretry']+_0x108a33['countcongestionretry']+_0x108a33[_0x7c33('0xff')]+_0x108a33[_0x7c33('0xec')]+_0x108a33[_0x7c33('0xed')]+_0x108a33[_0x7c33('0xee')]+_0x108a33['countmachineretry']+_0x108a33[_0x7c33('0xf0')]>=_0x5c8b82[_0x7c33('0xf1')]-0x1){return!![];}switch(_0x13e3d0){case 0x3:if(_0x108a33[_0x7c33('0xff')]>=_0x5c8b82[_0x7c33('0x1a1')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countnoanswerretry':_0x108a33[_0x7c33('0xff')]+=0x1,'scheduledat':moment()[_0x7c33('0xf6')](_0x5c8b82[_0x7c33('0x1a2')],_0x7c33('0xf8'))[_0x7c33('0x74')](_0x7c33('0xf9')),'ContactId':_0x108a33[_0x7c33('0xcd')],'ListId':_0x108a33[_0x7c33('0xce')],'VoiceQueueId':_0x108a33['VoiceQueueId']||undefined,'CampaignId':_0x108a33[_0x7c33('0xd0')]||undefined})['catch'](loggerCatch(_0x7c33('0x1a3')));}break;case 0x5:if(_0x108a33[_0x7c33('0xea')]>=_0x5c8b82[_0x7c33('0x1a4')]-0x1){return!![];}else{this[_0x7c33('0xbd')]({'active':![],'countbusyretry':_0x108a33[_0x7c33('0xea')]+=0x1,'scheduledat':moment()['add'](_0x5c8b82[_0x7c33('0x1a5')],_0x7c33('0xf8'))[_0x7c33('0x74')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x108a33[_0x7c33('0xcd')],'ListId':_0x108a33[_0x7c33('0xce')],'VoiceQueueId':_0x108a33['VoiceQueueId']||undefined,'CampaignId':_0x108a33['CampaignId']||undefined})[_0x7c33('0xae')](loggerCatch('[rescheduleContact]\x20[Busy]'));}break;case 0x8:if(_0x108a33[_0x7c33('0xeb')]>=_0x5c8b82[_0x7c33('0x1a6')]-0x1){return!![];}else{this[_0x7c33('0xbd')]({'active':![],'countcongestionretry':_0x108a33['countcongestionretry']+=0x1,'scheduledat':moment()[_0x7c33('0xf6')](_0x5c8b82[_0x7c33('0x1a7')],_0x7c33('0xf8'))[_0x7c33('0x74')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x108a33[_0x7c33('0xcd')],'ListId':_0x108a33[_0x7c33('0xce')],'VoiceQueueId':_0x108a33[_0x7c33('0x11d')]||undefined,'CampaignId':_0x108a33['CampaignId']||undefined})['catch'](loggerCatch('[rescheduleContact]\x20[Congestion]'));}break;case 0x0:if(_0x108a33['countnosuchnumberretry']>=_0x5c8b82[_0x7c33('0x1a8')]-0x1){return!![];}else{this[_0x7c33('0xbd')]({'active':![],'countnosuchnumberretry':_0x108a33['countnosuchnumberretry']+=0x1,'scheduledat':moment()[_0x7c33('0xf6')](_0x5c8b82['dialNoSuchNumberRetryFrequency'],_0x7c33('0xf8'))['format'](_0x7c33('0xf9')),'ContactId':_0x108a33[_0x7c33('0xcd')],'ListId':_0x108a33[_0x7c33('0xce')],'VoiceQueueId':_0x108a33[_0x7c33('0x11d')]||undefined,'CampaignId':_0x108a33[_0x7c33('0xd0')]||undefined})[_0x7c33('0xae')](loggerCatch(_0x7c33('0x1a9')));}break;case 0xa:if(_0x108a33[_0x7c33('0xed')]>=_0x5c8b82['dialDropMaxRetry']-0x1){return!![];}else{this[_0x7c33('0xbd')]({'active':![],'countdropretry':_0x108a33['countdropretry']+=0x1,'scheduledat':moment()[_0x7c33('0xf6')](_0x5c8b82[_0x7c33('0x11c')],_0x7c33('0xf8'))[_0x7c33('0x74')](_0x7c33('0xf9')),'ContactId':_0x108a33['ContactId'],'ListId':_0x108a33[_0x7c33('0xce')],'VoiceQueueId':_0x108a33[_0x7c33('0x11d')]||undefined,'CampaignId':_0x108a33['CampaignId']||undefined})['catch'](loggerCatch('[rescheduleContact][Drop]'));}break;case 0xb:if(_0x108a33[_0x7c33('0xee')]>=_0x5c8b82[_0x7c33('0x124')]-0x1){return!![];}else{this[_0x7c33('0xbd')]({'active':![],'countabandonedretry':_0x108a33[_0x7c33('0xee')]+=0x1,'scheduledat':moment()[_0x7c33('0xf6')](_0x5c8b82['dialAbandonedRetryFrequency'],_0x7c33('0xf8'))[_0x7c33('0x74')](_0x7c33('0xf9')),'ContactId':_0x108a33[_0x7c33('0xcd')],'ListId':_0x108a33[_0x7c33('0xce')],'VoiceQueueId':_0x108a33['VoiceQueueId']||undefined,'CampaignId':_0x108a33[_0x7c33('0xd0')]||undefined})['catch'](loggerCatch(_0x7c33('0x126')));}break;case 0x13:if(_0x108a33[_0x7c33('0xef')]>=_0x5c8b82[_0x7c33('0xf4')]-0x1){return!![];}else{this[_0x7c33('0xbd')]({'active':![],'countmachineretry':_0x108a33[_0x7c33('0xef')]+=0x1,'scheduledat':moment()[_0x7c33('0xf6')](_0x5c8b82[_0x7c33('0xf7')],_0x7c33('0xf8'))[_0x7c33('0x74')](_0x7c33('0xf9')),'ContactId':_0x108a33['ContactId'],'ListId':_0x108a33['ListId'],'VoiceQueueId':_0x108a33['VoiceQueueId']||undefined,'CampaignId':_0x108a33[_0x7c33('0xd0')]||undefined})[_0x7c33('0xae')](loggerCatch(_0x7c33('0xfa')));}break;case 0x14:if(_0x108a33[_0x7c33('0xf0')]>=_0x5c8b82[_0x7c33('0x1aa')]-0x1){return!![];}else{this[_0x7c33('0xbd')]({'active':![],'countagentrejectretry':_0x108a33[_0x7c33('0xf0')]+=0x1,'scheduledat':moment()[_0x7c33('0xf6')](_0x5c8b82['dialAgentRejectRetryFrequency'],'minutes')['format'](_0x7c33('0xf9')),'ContactId':_0x108a33[_0x7c33('0xcd')],'ListId':_0x108a33['ListId'],'VoiceQueueId':_0x108a33['VoiceQueueId']||undefined,'CampaignId':_0x108a33['CampaignId']||undefined})['catch'](loggerCatch(_0x7c33('0x1ab')));}break;default:return!![];}};Dialer[_0x7c33('0x1d')][_0x7c33('0x19e')]=function(_0x3daf5b,_0x3a1644,_0x3273c1){var _0x307dbf=this;var _0x258153=new History(_0x3daf5b);return new BPromise(function(_0x2d4a27,_0x22824f){if(_[_0x7c33('0x83')](_0x3a1644)&&_0x7c33('0x16e')!==typeof _0x3a1644){return _0x22824f(msgResponse(_0x7c33('0x1ac'),_0x7c33('0x149'),'entity\x20is\x20undefine'));}if(_[_0x7c33('0x83')](_0x3273c1)&&_0x7c33('0x16e')!==typeof _0x3273c1){return _0x22824f(msgResponse('[callProgressDetecting]','Failure',_0x7c33('0x1ad')));}switch(_0x3273c1['reason']){case'0':_0x3a1644[_0x7c33('0x61')]+=0x1;_0x258153['state']=0x0;_0x258153['statedesc']=_0x7c33('0x1ae');_0x258153['countnosuchnumberretry']+=0x1;_0x258153['countglobal']+=0x1;ami[_0x7c33('0x48')]('custom:agentnosuchnumber',ut['buildObj'](_0x3daf5b,'nosuchnumber'));_0x307dbf[_0x7c33('0xc6')](_0x258153)[_0x7c33('0xae')](loggerCatch(_0x7c33('0xe9')));if(_0x307dbf[_0x7c33('0x1a0')](0x0,_0x3daf5b,_0x3a1644)){if(_0x258153[_0x7c33('0xec')]>=_0x3a1644[_0x7c33('0x1a8')]){_0x307dbf[_0x7c33('0x100')](_0x258153,_0x2d4a27,_0x22824f,_0x7c33('0x1af'));}else{_0x307dbf[_0x7c33('0xf2')](_0x258153,_0x2d4a27,_0x22824f,_0x7c33('0x1af'));}}break;case'3':_0x3a1644['outboundNoAnswerCallsDay']+=0x1;_0x258153['state']=0x3;_0x258153['statedesc']='NoAnswer';_0x258153['countnoanswerretry']+=0x1;_0x258153[_0x7c33('0xe7')]+=0x1;ami[_0x7c33('0x48')]('custom:agentnoanswer',ut[_0x7c33('0x1b0')](_0x3daf5b,_0x7c33('0x1b1')));_0x307dbf[_0x7c33('0xc6')](_0x258153)[_0x7c33('0xae')](loggerCatch('[syncAgentComplete][createHistory][3]'));if(_0x307dbf[_0x7c33('0x1a0')](0x3,_0x3daf5b,_0x3a1644)){if(_0x258153[_0x7c33('0xff')]>=_0x3a1644[_0x7c33('0x1a1')]){_0x307dbf[_0x7c33('0x100')](_0x258153,_0x2d4a27,_0x22824f,_0x7c33('0x1b2'));}else{_0x307dbf['stateGlobal'](_0x258153,_0x2d4a27,_0x22824f,_0x7c33('0x1b2'));}}break;case'5':_0x3a1644['outboundBusyCallsDay']+=0x1;_0x258153['state']=0x5;_0x258153[_0x7c33('0xa7')]=_0x7c33('0x1b3');_0x258153['countbusyretry']+=0x1;_0x258153[_0x7c33('0xe7')]+=0x1;ami[_0x7c33('0x48')](_0x7c33('0x1b4'),ut[_0x7c33('0x1b0')](_0x3daf5b,'busy'));_0x307dbf[_0x7c33('0xc6')](_0x258153)[_0x7c33('0xae')](loggerCatch(_0x7c33('0x1b5')));if(_0x307dbf[_0x7c33('0x1a0')](0x5,_0x3daf5b,_0x3a1644)){if(_0x258153[_0x7c33('0xea')]>=_0x3a1644[_0x7c33('0x1a4')]){_0x307dbf[_0x7c33('0x100')](_0x258153,_0x2d4a27,_0x22824f,_0x7c33('0x1b6'));}else{_0x307dbf[_0x7c33('0xf2')](_0x258153,_0x2d4a27,_0x22824f,_0x7c33('0x1b6'));}}break;case'8':_0x3a1644[_0x7c33('0x5c')]+=0x1;_0x258153[_0x7c33('0xe1')]=0x8;_0x258153['statedesc']=_0x7c33('0x1b7');_0x258153[_0x7c33('0xeb')]+=0x1;_0x258153[_0x7c33('0xe7')]+=0x1;ami['emit'](_0x7c33('0x1b8'),ut[_0x7c33('0x1b0')](_0x3daf5b,_0x7c33('0x1b9')));_0x307dbf[_0x7c33('0xc6')](_0x258153)[_0x7c33('0xae')](loggerCatch(_0x7c33('0x1ba')));if(_0x307dbf[_0x7c33('0x1a0')](0x8,_0x3daf5b,_0x3a1644)){if(_0x258153[_0x7c33('0xeb')]>=_0x3a1644[_0x7c33('0x1a6')]){_0x307dbf[_0x7c33('0x100')](_0x258153,_0x2d4a27,_0x22824f,_0x7c33('0x1bb'));}else{_0x307dbf['stateGlobal'](_0x258153,_0x2d4a27,_0x22824f,'reason\x208\x20congestion');}}break;case'11':_0x3a1644[_0x7c33('0x1bc')]+=0x1;_0x258153[_0x7c33('0xe1')]=0xb;_0x258153['statedesc']=_0x7c33('0x1bd');_0x258153[_0x7c33('0xee')]+=0x1;_0x258153[_0x7c33('0xe7')]+=0x1;_0x307dbf['createHistory'](_0x258153)[_0x7c33('0xae')](loggerCatch(_0x7c33('0x128')));if(_0x307dbf[_0x7c33('0x1a0')](0xb,_0x3daf5b,_0x3a1644)){if(_0x258153[_0x7c33('0xee')]>=_0x3a1644['dialAbandonedMaxRetry']){_0x307dbf[_0x7c33('0x100')](_0x258153,_0x2d4a27,_0x22824f,'reason\x2011\x20abandoned');}else{_0x307dbf[_0x7c33('0xf2')](_0x258153,_0x2d4a27,_0x22824f,_0x7c33('0x1be'));}}break;case'20':_0x3a1644[_0x7c33('0x63')]+=0x1;_0x258153['state']=0x14;_0x258153['statedesc']=_0x7c33('0x1bf');_0x258153['countagentrejectretry']+=0x1;_0x258153['countglobal']+=0x1;ami[_0x7c33('0x48')]('custom:agentreject',ut[_0x7c33('0x1b0')](_0x3daf5b,_0x7c33('0x1c0')));_0x307dbf[_0x7c33('0xc6')](_0x258153)[_0x7c33('0xae')](loggerCatch(_0x7c33('0x1c1')));if(_0x307dbf[_0x7c33('0x1a0')](0x14,_0x3daf5b,_0x3a1644)){if(_0x258153['countagentrejectretry']>=_0x3a1644[_0x7c33('0x1aa')]){_0x307dbf[_0x7c33('0x100')](_0x258153,_0x2d4a27,_0x22824f,_0x7c33('0x1c2'));}else{_0x307dbf[_0x7c33('0xf2')](_0x258153,_0x2d4a27,_0x22824f,_0x7c33('0x1c2'));}}break;default:_0x3a1644['outboundUnknownCallsDay']+=0x1;_0x258153[_0x7c33('0xe1')]=0xc;_0x258153[_0x7c33('0xa7')]=_0x3273c1['reason'];_0x307dbf[_0x7c33('0xc6')](_0x258153)[_0x7c33('0xae')](loggerCatch('[syncAgentComplete][createHistory][?]'));if(_0x307dbf['checkRetriveMax'](_0x3273c1[_0x7c33('0x1c3')],_0x3daf5b,_0x3a1644)){if(_0x258153[_0x7c33('0xea')]+_0x258153[_0x7c33('0xeb')]+_0x258153[_0x7c33('0xff')]+_0x258153[_0x7c33('0xec')]+_0x258153[_0x7c33('0xed')]+_0x258153['countabandonedretry']+_0x258153[_0x7c33('0xef')]+_0x258153[_0x7c33('0xf0')]>=_0x3a1644[_0x7c33('0xf1')]){_0x307dbf[_0x7c33('0xf2')](_0x258153,_0x2d4a27,_0x22824f,_0x3273c1['reason']);}else{_0x307dbf[_0x7c33('0x100')](_0x258153,_0x2d4a27,_0x22824f,_0x3273c1[_0x7c33('0x1c3')]);}}}});};Dialer[_0x7c33('0x1d')][_0x7c33('0xf2')]=function(_0x36dd33,_0x48230d,_0x2b9f58,_0x14770e){var _0x32d882=new Final(_0x36dd33);_0x32d882[_0x7c33('0xe1')]=0xf;_0x32d882[_0x7c33('0xa7')]='Global';this[_0x7c33('0x100')](_0x32d882,_0x48230d,_0x2b9f58,_0x14770e);};Dialer['prototype'][_0x7c33('0x100')]=function(_0x53018d,_0x3a56ed,_0x11bfa8,_0x3581f6){this[_0x7c33('0xc5')](_0x53018d)[_0x7c33('0xb5')](function(_0x5563e9){return _0x3a56ed(msgResponse(_0x7c33('0x1ac'),_0x7c33('0x1c4'),_0x3581f6));})['catch'](function(_0x568c24){return _0x11bfa8(msgResponse(_0x7c33('0x1c5'),_0x7c33('0x149'),'contact\x20not\x20moved'));});};Dialer['prototype'][_0x7c33('0x161')]=function(_0x3ea879){var _0x51a82a=this;var _0x573689=_0x3ea879[_0x7c33('0x1c6')]/0x64;var _0x378253=_0x3ea879['outboundDropCallsDayTimeout']/(_0x3ea879[_0x7c33('0x5f')]+_0x3ea879['outboundAnswerCallsDay']);var _0x5d9ffe=Math[_0x7c33('0x1c7')](_0x3ea879['predictiveIntervalAvailable']*(_0x3ea879[_0x7c33('0x1c8')]/0x64));var _0x5698ee=Math['round'](_0x3ea879[_0x7c33('0x6d')]*(_0x3ea879[_0x7c33('0x1c9')]/0x64));var _0x3290d6=_0x3ea879[_0x7c33('0x4c')]+_0x3ea879[_0x7c33('0x50')];var _0x33f7a2=Math[_0x7c33('0x1ca')](_0x3ea879[_0x7c33('0x88')]*_0x3ea879[_0x7c33('0x8a')]*_0x3ea879[_0x7c33('0x6a')]*_0x3ea879[_0x7c33('0x6b')]);if(_[_0x7c33('0x83')](_0x3ea879[_0x7c33('0x2c')])){if(!_['isUndefined'](_0x3ea879[_0x7c33('0x2b')])){_0x3ea879['startPredictive']=undefined;loggerPredictive[_0x7c33('0x95')](_0x7c33('0x1cb'),'check\x20predictive\x20is\x20not\x20undefine');}if(!_[_0x7c33('0x83')](_0x3ea879[_0x7c33('0x90')])){loggerPredictive['error'](_0x7c33('0x1cb'),_0x7c33('0x1cc'));clearInterval(_0x3ea879['handlePredictive']);_0x3ea879[_0x7c33('0x90')]=undefined;}_0x3ea879['startProgressive']=moment()[_0x7c33('0x74')](_0x7c33('0xf9'));loggerPredictive[_0x7c33('0x7a')](_0x3ea879[_0x7c33('0x3c')],'collection\x20data\x20in\x20progressive\x20at',_0x3ea879[_0x7c33('0x2c')]);this[_0x7c33('0x15f')](_0x3ea879,0x1);}else if(ifInterval(_0x3ea879[_0x7c33('0x1cd')],_0x3ea879[_0x7c33('0x2c')])){this[_0x7c33('0x15f')](_0x3ea879,0x1);loggerPredictiveCalls[_0x7c33('0x7a')](_0x7c33('0x1ce'),_0x3ea879[_0x7c33('0x2c')],_0x3ea879[_0x7c33('0x3c')]);_0x3ea879[_0x7c33('0x88')]=0x0;_0x3ea879[_0x7c33('0x69')]=0x0;}else if(_0x573689<_0x378253&&_0x3ea879['dialPredictiveOptimization']==='dropRate'){freeVariablesPredictive(_0x3ea879);loggerPredictive['info'](_0x7c33('0x1cf'),'Dropped\x20calls\x20day',_0x378253,_0x7c33('0x2c'),_0x3ea879[_0x7c33('0x3c')]);}else if(_0x33f7a2<_0x3ea879[_0x7c33('0x69')]&&_0x3ea879['dialPredictiveOptimization']===_0x7c33('0x1d0')){freeVariablesPredictive(_0x3ea879);loggerPredictive['info']('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]',_0x7c33('0x1d1'),_0x33f7a2,'Drop\x20in\x20this\x20interval',_0x3ea879[_0x7c33('0x69')],_0x7c33('0x2c'),_0x3ea879['name']);}else if(!ifInterval(_0x3ea879[_0x7c33('0x1cd')],_0x3ea879['startProgressive'])&&_[_0x7c33('0x83')](_0x3ea879[_0x7c33('0x2b')])&&!_[_0x7c33('0x83')](_0x3ea879[_0x7c33('0x2c')])){_0x3ea879[_0x7c33('0x2b')]=moment()[_0x7c33('0x74')](_0x7c33('0xf9'));loggerPredictive[_0x7c33('0x7a')](_0x3ea879['name'],_0x7c33('0x1d2'),_0x3ea879[_0x7c33('0x2b')]);this[_0x7c33('0xba')](_0x3ea879[_0x7c33('0x1cd')])[_0x7c33('0xb5')](this[_0x7c33('0x1d3')](_0x3ea879))[_0x7c33('0xb5')](mergeDataErlangB(_0x3ea879))[_0x7c33('0xb5')](this[_0x7c33('0x1d4')](_0x3ea879))[_0x7c33('0xae')](loggerCatchPredictive(_0x7c33('0x1d5'),_0x3ea879));}else if(!ifInterval(_0x3ea879[_0x7c33('0x1cd')],_0x3ea879[_0x7c33('0x2b')])){_0x3ea879[_0x7c33('0x69')]=0x0;_0x3ea879['startPredictive']=moment()['format'](_0x7c33('0xf9'));loggerPredictive['info'](_0x3ea879[_0x7c33('0x3c')],_0x7c33('0x1d6'),_0x3ea879[_0x7c33('0x2b')]);clearInterval(_0x3ea879[_0x7c33('0x90')]);_0x3ea879['handlePredictive']=undefined;this[_0x7c33('0xba')](_0x3ea879['dialPredictiveInterval'])[_0x7c33('0xb5')](this[_0x7c33('0x1d3')](_0x3ea879))['then'](mergeDataErlangB(_0x3ea879))[_0x7c33('0xb5')](this['startMethodPredictive'](_0x3ea879))['catch'](loggerCatchPredictive('Predictive\x20for\x20every\x20interval',_0x3ea879));}else if(_0x3ea879[_0x7c33('0x6d')]&&_0x3290d6<_0x3ea879['predictiveIntervalAvailable']-_0x5698ee){freeVariablesPredictive(_0x3ea879);loggerPredictive[_0x7c33('0x7a')](_0x3ea879[_0x7c33('0x3c')],_0x7c33('0x1d7'),_0x3290d6,_0x7c33('0x1d8'),_0x3ea879['predictiveIntervalAvailable'],'-',_0x5698ee,'=',_0x3ea879['predictiveIntervalAvailable']-_0x5698ee,')');}else if(_0x3ea879[_0x7c33('0x6d')]&&_0x3290d6>_0x3ea879[_0x7c33('0x6d')]+_0x5d9ffe){freeVariablesPredictive(_0x3ea879);loggerPredictive['info'](_0x3ea879[_0x7c33('0x3c')],_0x7c33('0x1d7'),_0x3290d6,_0x7c33('0x1d9'),_0x3ea879[_0x7c33('0x6d')],'+',_0x5d9ffe,'=',_0x3ea879[_0x7c33('0x6d')]+_0x5d9ffe,')');}};Dialer[_0x7c33('0x1d')][_0x7c33('0x1d3')]=function(_0x381b2b){var _0x3d7d1e=this;return function(_0xfe4459){return new BPromise(function(_0x4da90e,_0x388554){_['merge'](_0x381b2b,_0xfe4459[0x0]);if(checkGetDataPredictive(_0xfe4459[0x0])){var _0x5262c3=_0x381b2b[_0x7c33('0x6d')]=_0x381b2b[_0x7c33('0x50')]+_0x381b2b[_0x7c33('0x4c')];var _0x4273f7=_0x381b2b[_0x7c33('0x1cd')]*0x3c;var _0xcb18bc=_0xfe4459[0x0][_0x7c33('0x80')]+_0xfe4459[0x0][_0x7c33('0x66')];var _0x47f5da=(_0xfe4459[0x0][_0x7c33('0x65')]+_0xfe4459[0x0]['predictiveIntervalDroppedCallsTimeout']+_0xfe4459[0x0][_0x7c33('0x67')])/_0xfe4459[0x0][_0x7c33('0x82')];_0x381b2b[_0x7c33('0x6a')]=_0x47f5da>0x0?_0x47f5da:0x1;switch(_0x381b2b['dialPredictiveOptimization']){case _0x7c33('0x1d0'):var _0x141b56=_0x381b2b[_0x7c33('0x1c6')]/0x64;return _0x3d7d1e['abandonmentRate'](_0x5262c3,_0x4273f7,_0xcb18bc,_0x47f5da,_0x141b56)[_0x7c33('0xb5')](function(_0x4e35e7){return _0x4da90e(_0x4e35e7);});case _0x7c33('0x1da'):var _0x423e15=_0x381b2b[_0x7c33('0x1c6')]/0x64;return _0x3d7d1e[_0x7c33('0x1db')](_0x5262c3,_0x4273f7,_0xcb18bc,_0x47f5da,_0x423e15)['then'](function(_0x2da09c){return _0x4da90e(_0x2da09c);});default:return _0x388554(msgResponse(_0x7c33('0x1dc'),_0x7c33('0x149'),'Unknown\x20Predictive'));}}else{return _0x388554(msgResponse(_0x7c33('0x1dc'),_0x7c33('0x149'),_0x7c33('0x1dd')));}});};};Dialer['prototype'][_0x7c33('0x1de')]=function(_0x22cbc7){var _0x1901d8=this;return function(_0x308bbf){return new BPromise(function(_0x3a3d99,_0x24f1bb){_[_0x7c33('0x8d')](_0x22cbc7,_0x308bbf[0x0]);if(checkGetDataPredictive(_0x308bbf[0x0])){loggerPredictive[_0x7c33('0x7a')](JSON['stringify'](_0x308bbf[0x0]));if(_0x22cbc7['dialPredictiveOptimization']===_0x7c33('0x1d0')){return _0x1901d8[_0x7c33('0xc4')](_0x22cbc7['id'])[_0x7c33('0xb5')](function(_0x10bcd2){var _0x4a1bb0=_0x22cbc7[_0x7c33('0x4d')]-_0x10bcd2[0x0][_0x7c33('0x1df')];var _0x381dac=_0x22cbc7['dialPredictiveInterval']*0x3c;var _0x47e609=_0x308bbf[0x0][_0x7c33('0x80')]+_0x308bbf[0x0][_0x7c33('0x66')];var _0x3d1a6f=(_0x308bbf[0x0][_0x7c33('0x65')]+_0x308bbf[0x0][_0x7c33('0x7d')]+_0x308bbf[0x0][_0x7c33('0x67')])/_0x308bbf[0x0][_0x7c33('0x82')];var _0x2d4104=_0x22cbc7[_0x7c33('0x1c6')]/0x64;_0x22cbc7[_0x7c33('0x6c')]=_0x10bcd2[0x0][_0x7c33('0x1df')]||0x0;_0x22cbc7[_0x7c33('0x6a')]=_0x3d1a6f>0x0?_0x3d1a6f:0x1;return _0x1901d8[_0x7c33('0x1e0')](_0x4a1bb0,_0x381dac,_0x47e609,_0x3d1a6f,_0x2d4104);})[_0x7c33('0xb5')](function(_0x186d84){return _0x3a3d99(_0x186d84);})[_0x7c33('0xae')](function(_0x18573f){return _0x24f1bb(msgResponse(_0x7c33('0x1e1'),_0x7c33('0x149'),JSON[_0x7c33('0x73')](_0x18573f)));});}if(_0x22cbc7['dialPredictiveOptimization']===_0x7c33('0x1da')){return _0x1901d8[_0x7c33('0xc4')](_0x22cbc7['id'])[_0x7c33('0xb5')](function(_0x4110d9){var _0x55f033=_0x22cbc7[_0x7c33('0x4d')]-_0x4110d9[0x0]['outboundQueuePauses'];var _0x154b3d=_0x22cbc7[_0x7c33('0x1cd')]*0x3c;var _0x123bbb=_0x308bbf[0x0][_0x7c33('0x80')]+_0x308bbf[0x0][_0x7c33('0x66')];var _0x520ab7=(_0x308bbf[0x0][_0x7c33('0x65')]+_0x308bbf[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x308bbf[0x0][_0x7c33('0x67')])/_0x308bbf[0x0][_0x7c33('0x82')];var _0x588a14=_0x22cbc7[_0x7c33('0x1c6')]/0x64;_0x22cbc7[_0x7c33('0x6c')]=_0x4110d9[0x0][_0x7c33('0x1df')]||0x0;_0x22cbc7['predictiveIntervalHitRate']=_0x520ab7>0x0?_0x520ab7:0x1;return _0x1901d8[_0x7c33('0x1db')](_0x55f033,_0x154b3d,_0x123bbb,_0x520ab7,_0x588a14);})[_0x7c33('0xb5')](function(_0x40247e){return _0x3a3d99(_0x40247e);})[_0x7c33('0xae')](function(_0x1c4041){return _0x24f1bb(msgResponse(_0x7c33('0x1e1'),_0x7c33('0x149'),JSON[_0x7c33('0x73')](_0x1c4041)));});}}else{return _0x24f1bb(msgResponse(_0x7c33('0x1dc'),_0x7c33('0x149'),_0x7c33('0x1dd')));}});};};Dialer['prototype'][_0x7c33('0x1d4')]=function(_0x73e278){var _0x3ef085=this;return function(){var _0x2736cb=0x0;var _0x1fd5e8=Math[_0x7c33('0x1ca')](_0x73e278[_0x7c33('0x6f')]*0x3e8);if(_0x1fd5e8>0x0){_0x1fd5e8=_0x1fd5e8<0x64?0x64:_0x1fd5e8;loggerPredictive[_0x7c33('0x7a')](_0x73e278['name'],_0x7c33('0x1e2'),_0x1fd5e8,_0x7c33('0x46'));_0x73e278[_0x7c33('0x90')]=setInterval(function(){_0x3ef085[_0x7c33('0x90')](_0x73e278);loggerPredictiveCalls['info'](_0x7c33('0x1e3'),_0x2736cb+=0x1);},_0x1fd5e8);}else{loggerPredictive[_0x7c33('0x7a')](_0x73e278[_0x7c33('0x3c')],_0x7c33('0x1e4'));}};};Dialer[_0x7c33('0x1d')][_0x7c33('0x1e5')]=function(_0x414fb2,_0x187261){var _0x2f8b90=this;return function(_0x338f03){if(_[_0x7c33('0x43')](_0x338f03)){if(_['isNil'](_0x187261[_0x7c33('0xcf')])||!_0x187261[_0x7c33('0x1e6')]){if(_0x414fb2[_0x7c33('0x55')]===_0x7c33('0x8')){_0x414fb2[_0x7c33('0x132')]=_[_0x7c33('0x83')](_0x414fb2[_0x7c33('0x132')])?!![]:_0x414fb2[_0x7c33('0x132')];var _0x21d0b7=uuid['v4']();_0x2f8b90[_0x7c33('0x28')][_0x21d0b7]=new Action(_0x414fb2,_0x187261,_0x21d0b7);loggerBooked['info']('[booked][checkContactBlack]',_0x21d0b7,_0x7c33('0x1e7'),JSON[_0x7c33('0x73')](_0x414fb2[_0x7c33('0x132')]),_0x7c33('0x1e8'),_0x414fb2[_0x7c33('0x3c')]);if(_0x414fb2['queueStatusComplete']){_0x414fb2[_0x7c33('0x132')]=![];_0x2f8b90[_0x7c33('0x12d')][_0x2f8b90[_0x7c33('0x28')][_0x21d0b7]['queue']]=[];ami['Action']({'actionid':_0x21d0b7,'action':_0x7c33('0x1e9'),'queue':_0x414fb2['name']})[_0x7c33('0xae')](function(_0xf3947){_0x2f8b90[_0x7c33('0xb0')](_0x414fb2);_0x2f8b90['rescheduleContact']({'active':![],'ContactId':_0x2f8b90['actions'][_0x21d0b7][_0x7c33('0xcd')],'ListId':_0x2f8b90[_0x7c33('0x28')][_0x21d0b7][_0x7c33('0xce')],'VoiceQueueId':_0x2f8b90[_0x7c33('0x28')][_0x21d0b7][_0x7c33('0x11d')]||undefined,'CampaignId':_0x2f8b90[_0x7c33('0x28')][_0x21d0b7][_0x7c33('0xd0')]||undefined})[_0x7c33('0xae')](loggerCatch(_0x7c33('0x1ea')));delete _0x2f8b90[_0x7c33('0x28')][_0x21d0b7];});}else{loggerBooked['info'](_0x7c33('0x1eb'),JSON[_0x7c33('0x73')](_0x414fb2[_0x7c33('0x132')]),_0x7c33('0x1e8'),_0x414fb2[_0x7c33('0x3c')]);_0x2f8b90[_0x7c33('0xb0')](_0x414fb2);_0x2f8b90['rescheduleContact']({'active':![],'ContactId':_0x2f8b90[_0x7c33('0x28')][_0x21d0b7][_0x7c33('0xcd')],'ListId':_0x2f8b90[_0x7c33('0x28')][_0x21d0b7]['ListId'],'VoiceQueueId':_0x2f8b90[_0x7c33('0x28')][_0x21d0b7][_0x7c33('0x11d')]||undefined,'CampaignId':_0x2f8b90[_0x7c33('0x28')][_0x21d0b7]['CampaignId']||undefined})[_0x7c33('0xae')](loggerCatch(_0x7c33('0x1ea')));delete _0x2f8b90[_0x7c33('0x28')][_0x21d0b7];}}else{return _0x2f8b90[_0x7c33('0x16d')](_0x414fb2,_0x187261);}}else{if(getDiff(_0x187261[_0x7c33('0x1ec')])<_0x414fb2[_0x7c33('0x1ed')]*0x3c){if(_0x187261[_0x7c33('0x1ee')]&&!_0x187261['Agent'][_0x7c33('0x1ef')]){_0x2f8b90[_0x7c33('0x21')][_0x7c33('0x135')](_0x187261['id'])['finally'](function(){_0x2f8b90[_0x7c33('0xb0')](_0x414fb2);});}else{_0x2f8b90[_0x7c33('0xbf')]({'active':![]},_0x187261['id'],0x1)[_0x7c33('0x20')](function(){console[_0x7c33('0x1f0')](_0x7c33('0x1f1'));_0x2f8b90[_0x7c33('0xb0')](_0x414fb2);});}}else{_0x414fb2[_0x7c33('0x62')]+=0x1;_0x2f8b90[_0x7c33('0xb0')](_0x414fb2);if(_0x414fb2[_0x7c33('0x1f2')]){_0x2f8b90['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x187261[_0x7c33('0xcd')],'ListId':_0x187261[_0x7c33('0xce')],'VoiceQueueId':_0x187261[_0x7c33('0x11d')]||undefined,'CampaignId':_0x187261['CampaignId']||undefined})[_0x7c33('0xae')](loggerCatch(_0x7c33('0x1f3')));_0x2f8b90[_0x7c33('0xc6')](createObjHistory(_0x414fb2,_0x187261,_0x7c33('0x1f4'),0x17,'RecallInQueue'))[_0x7c33('0xae')](loggerCatch(_0x7c33('0x1f5')));}else{_0x2f8b90[_0x7c33('0xcc')](createObjHistory(_0x414fb2,_0x187261,_0x7c33('0x1f6'),0x16,_0x7c33('0x1f7')),_0x7c33('0x1f8'),_0x7c33('0x1f9'));}}}}else{_0x414fb2['outboundBlacklistCallsDay']+=0x1;_0x2f8b90[_0x7c33('0xcc')](createObjHistory(_0x414fb2,_0x187261,_0x7c33('0x1fa'),0xd,_0x7c33('0x1fb')),_0x7c33('0x1fc'),_0x7c33('0x1fd'));throw _0x7c33('0x1fe');}};};Dialer[_0x7c33('0x1d')][_0x7c33('0x165')]=function(_0x48fa5f){var _0x346dfa=this;var _0x293a2c=[];var _0x2bf408=_0x48fa5f[_0x7c33('0x1ff')]-_0x48fa5f['originated']-_0x48fa5f['temp'];emitCampaignSummary(_0x48fa5f);if(_0x2bf408>0x0){if(_0x2bf408>this['maxNumberOriginate']){_0x2bf408=this[_0x7c33('0x26')];}_0x48fa5f['temp']+=_0x2bf408;this['getContactDialerIvr'](_0x48fa5f['id'],_0x2bf408,_0x48fa5f[_0x7c33('0x200')])[_0x7c33('0xb5')](function(_0x38a201){_0x48fa5f[_0x7c33('0x201')]-=_0x2bf408;_0x48fa5f[_0x7c33('0x201')]=_0x48fa5f[_0x7c33('0x201')]>0x0?_0x48fa5f[_0x7c33('0x201')]:0x0;if(!checkContactEmpty(_0x38a201)){_0x48fa5f[_0x7c33('0x3e')]=_0x7c33('0x9d');logger[_0x7c33('0x7a')]('[getContactCampaign2][Empty]'+_0x48fa5f[_0x7c33('0x3c')]);}else{_0x48fa5f[_0x7c33('0x6e')]+=_0x38a201[_0x7c33('0x138')];_0x48fa5f[_0x7c33('0x3e')]='RUNNING';for(var _0x44681c=0x0;_0x44681c<_0x38a201[_0x7c33('0x138')];_0x44681c+=0x1){_0x48fa5f[_0x7c33('0x202')]+=0x1;if(_[_0x7c33('0xda')](_0x38a201[_0x44681c])||_[_0x7c33('0xda')](_0x38a201[_0x44681c]['Contact'])||_['isNil'](_0x38a201[_0x44681c][_0x7c33('0x172')][_0x7c33('0x171')])){_0x346dfa[_0x7c33('0xca')]('[actionOriginate]\x20',_0x48fa5f,_0x38a201[_0x44681c]);}else{_0x346dfa['checkIsBlackListIvr'](_[_0x7c33('0x133')](_0x38a201[_0x44681c],['CampaignId',_0x7c33('0x203')]))[_0x7c33('0xb5')](_0x346dfa[_0x7c33('0x1e5')](_0x48fa5f,_0x38a201[_0x44681c]))[_0x7c33('0xae')](_0x346dfa[_0x7c33('0xc9')](_0x7c33('0x204'),_0x48fa5f));}}}})[_0x7c33('0xae')](loggerGetContactDialer(_0x7c33('0x205'),_0x48fa5f,_0x2bf408));}};Dialer['prototype'][_0x7c33('0x15f')]=function(_0x5605f0,_0x35d814){var _0x3f7dd6=this;var _0x4bfc4a=[];var _0x5bf8dc=_0x35d814>=0x1?_0x35d814:0x1;var _0x1146e7=[];if(_0x5605f0[_0x7c33('0x55')]===_0x7c33('0x8')){_0x5bf8dc=0x1;}var _0x29d927=Math[_0x7c33('0x1ca')](_0x5605f0[_0x7c33('0x4c')]*_0x5bf8dc)-_0x5605f0[_0x7c33('0x6e')]-_0x5605f0[_0x7c33('0x201')];emitVoiceQueueSummary(_0x5605f0);if(_0x5605f0[_0x7c33('0x206')]>0x0){var _0x50fde3=_0x5605f0[_0x7c33('0x206')]-_0x5605f0[_0x7c33('0x6e')]-_0x5605f0[_0x7c33('0x50')]-_0x5605f0['temp']-_0x5605f0[_0x7c33('0xa0')];if(_0x29d927>_0x50fde3){_0x29d927=_0x50fde3;}}if(_0x29d927>0x0){if(_0x5605f0[_0x7c33('0x55')]==='booked'){_0x29d927=0x1;}if(_0x29d927>this['maxNumberOriginate']){_0x29d927=this[_0x7c33('0x26')];}_0x5605f0[_0x7c33('0x201')]+=_0x29d927;for(var _0x28af35 in this[_0x7c33('0x24')]){if(this[_0x7c33('0x24')][_0x7c33('0x97')](_0x28af35)){if(this[_0x7c33('0x24')][_0x28af35][_0x7c33('0xe1')]==='not_inuse'&&this[_0x7c33('0x24')][_0x28af35][_0x7c33('0xd7')]==='reachable'){_0x4bfc4a[_0x7c33('0x12e')](this[_0x7c33('0x24')][_0x28af35]['id']);}}}this[_0x7c33('0xc1')](_0x5605f0['id'],_0x4bfc4a,_0x29d927,_0x5605f0[_0x7c33('0x200')])[_0x7c33('0xb5')](function(_0x438b95){_0x5605f0[_0x7c33('0x201')]-=_0x29d927;_0x5605f0['temp']=_0x5605f0[_0x7c33('0x201')]>0x0?_0x5605f0[_0x7c33('0x201')]:0x0;if(!checkContactEmpty(_0x438b95)){_0x3f7dd6[_0x7c33('0xb4')](_0x5605f0)[_0x7c33('0xb5')](sendMessageReschedule(_0x5605f0))['catch'](loggerCatch(_0x7c33('0xb6')));}else{_0x5605f0[_0x7c33('0x6e')]+=_0x438b95[_0x7c33('0x138')];_0x5605f0[_0x7c33('0x3e')]=_0x5605f0[_0x7c33('0x55')]===_0x7c33('0x8')?_0x7c33('0x177'):_0x7c33('0x207');for(var _0x2f042c=0x0;_0x2f042c<_0x438b95[_0x7c33('0x138')];_0x2f042c+=0x1){if(_[_0x7c33('0xda')](_0x438b95[_0x2f042c])||_[_0x7c33('0xda')](_0x438b95[_0x2f042c]['Contact'])||_[_0x7c33('0xda')](_0x438b95[_0x2f042c][_0x7c33('0x172')]['phone'])){_0x3f7dd6[_0x7c33('0xca')](_0x7c33('0x208'),_0x5605f0,_0x438b95[_0x2f042c]);}else{_0x3f7dd6['checkIsBlackList'](_[_0x7c33('0x133')](_0x438b95[_0x2f042c],[_0x7c33('0x11d'),_0x7c33('0x203')]))[_0x7c33('0xb5')](_0x3f7dd6[_0x7c33('0x1e5')](_0x5605f0,_0x438b95[_0x2f042c]))[_0x7c33('0xae')](_0x3f7dd6[_0x7c33('0xc9')](_0x7c33('0x208'),_0x5605f0));}}}})[_0x7c33('0xae')](loggerGetContactDialer(_0x7c33('0x209'),_0x5605f0,_0x29d927));}};Dialer[_0x7c33('0x1d')][_0x7c33('0x90')]=function(_0x387d9e){var _0x2a422f=this;if(_0x387d9e[_0x7c33('0x206')]>0x0){var _0x4a01d7=_0x387d9e['dialLimitQueue']-_0x387d9e['originated']-_0x387d9e[_0x7c33('0x50')];if(_0x4a01d7>0x0){this[_0x7c33('0x20a')](_0x387d9e);}else{loggerPredictiveCalls[_0x7c33('0x7a')](_0x7c33('0x20b'));}}else{this['tryOriginatePredictive'](_0x387d9e);}};Dialer[_0x7c33('0x1d')][_0x7c33('0x20a')]=function(_0x511dff){var _0x269104=this;var _0x7b4aab=[];_0x511dff[_0x7c33('0x6e')]+=0x1;for(var _0x355d96 in this[_0x7c33('0x24')]){if(this[_0x7c33('0x24')]['hasOwnProperty'](_0x355d96)){if(this[_0x7c33('0x24')][_0x355d96]['state']===_0x7c33('0x20c')&&this[_0x7c33('0x24')][_0x355d96][_0x7c33('0xd7')]===_0x7c33('0x20d')){_0x7b4aab[_0x7c33('0x12e')](this['agents'][_0x355d96]['id']);}}}this[_0x7c33('0xc1')](_0x511dff['id'],_0x7b4aab,0x1,_0x511dff[_0x7c33('0x200')])[_0x7c33('0xb5')](function(_0x4f1151){if(!checkContactEmpty(_0x4f1151)){checkContactLowerLimitOriginate(_0x511dff,0x1,0x0);_0x269104[_0x7c33('0xb4')](_0x511dff)[_0x7c33('0xb5')](sendMessageReschedule(_0x511dff))[_0x7c33('0xae')](loggerCatch(_0x7c33('0xb6')));}else{_0x511dff['message']=_0x7c33('0x207');if(_[_0x7c33('0xda')](_0x4f1151[0x0])||_['isNil'](_0x4f1151[0x0][_0x7c33('0x172')])||_['isNil'](_0x4f1151[0x0][_0x7c33('0x172')]['phone'])){_0x269104['emptyContact'](_0x7c33('0x208'),_0x511dff,_0x4f1151[0x0]);}else{_0x269104[_0x7c33('0xb7')](_[_0x7c33('0x133')](_0x4f1151[0x0],[_0x7c33('0x11d'),_0x7c33('0x203')]))['then'](_0x269104[_0x7c33('0x1e5')](_0x511dff,_0x4f1151[0x0]))[_0x7c33('0xae')](_0x269104['loggerHandler'](_0x7c33('0x20e'),_0x511dff));}}})[_0x7c33('0xae')](loggerGetContactDialer(_0x7c33('0x20f'),_0x511dff,0x1));emitVoiceQueueSummary(_0x511dff);};Dialer[_0x7c33('0x1d')][_0x7c33('0x1e0')]=function(_0x1e68f3,_0x5e090b,_0x194342,_0x3f986f,_0x265eb9,_0x5d3bf0){loggerPredictive[_0x7c33('0x7a')](_0x7c33('0x210'));loggerPredictive[_0x7c33('0x7a')](_0x7c33('0x211'),_0x1e68f3);loggerPredictive[_0x7c33('0x7a')](_0x7c33('0x212'),_0x5e090b);loggerPredictive[_0x7c33('0x7a')](_0x7c33('0x213'),_0x194342);loggerPredictive[_0x7c33('0x7a')](_0x7c33('0x214'),_0x3f986f);loggerPredictive[_0x7c33('0x7a')](_0x7c33('0x215'),_0x265eb9);loggerPredictive['info'](_0x7c33('0x81'));return new BPromise(function(_0xd4ffcb,_0x1db7dd){if(_0x1e68f3<=0x0||isNaN(_0x1e68f3)){return _0x1db7dd(msgResponse(_0x7c33('0x216'),'Error','m\x20=\x20'+_0x1e68f3));}if(_0x194342<=0x0||isNaN(_0x194342)){return _0x1db7dd(msgResponse(_0x7c33('0x216'),'Error',_0x7c33('0x217')+_0x194342));}if(_0x3f986f<=0x0||isNaN(_0x3f986f)){return _0x1db7dd(msgResponse(_0x7c33('0x216'),_0x7c33('0x19a'),_0x7c33('0x218')+_0x3f986f));}if(_0x5e090b<=0x0||isNaN(_0x5e090b)){return _0x1db7dd(msgResponse('[abandonmentRate]','Error','interval\x20=\x20'+_0x5e090b));}if(_0x265eb9<=0x0||isNaN(_0x265eb9)){return _0x1db7dd(msgResponse(_0x7c33('0x216'),'Error',_0x7c33('0x219')+_0x265eb9));}_0x5d3bf0=_0x5d3bf0||0x0;var _0x34c376=0x1/_0x194342;var _0x336ccd=0x0;var _0x203083=0x0;var _0x1bfdad=0x0;var _0x43f131=0x0;for(var _0x4795d4=0x0;_0x1bfdad<_0x265eb9;_0x4795d4+=0x1){_0x203083=_0x4795d4/_0x5e090b;_0x336ccd=(_0x3f986f*_0x203083+_0x5d3bf0)/_0x34c376;_0x1bfdad=erlangb(_0x336ccd,_0x1e68f3);_0x43f131=_0x336ccd/_0x1e68f3*(0x1-erlangb(_0x336ccd,_0x1e68f3));}return _0xd4ffcb({'erlangCalls':_0x4795d4,'erlangCallToSecond':_0x5e090b/_0x4795d4,'erlangAbandonmentRate':_0x1bfdad,'erlangBusyFactor':_0x43f131});});};Dialer['prototype'][_0x7c33('0x1db')]=function(_0x3acddc,_0x1c973d,_0x2a2286,_0x32e558,_0x42dce2,_0x4cf807){loggerPredictive[_0x7c33('0x7a')](_0x7c33('0x21a'));loggerPredictive[_0x7c33('0x7a')](_0x7c33('0x211'),_0x3acddc);loggerPredictive[_0x7c33('0x7a')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1c973d);loggerPredictive[_0x7c33('0x7a')]('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',_0x2a2286);loggerPredictive['info'](_0x7c33('0x214'),_0x32e558);loggerPredictive[_0x7c33('0x7a')](_0x7c33('0x21b'),_0x42dce2);loggerPredictive['info'](_0x7c33('0x81'));return new BPromise(function(_0x17f793,_0x22e6a0){if(_0x3acddc<=0x0||isNaN(_0x3acddc)){return _0x22e6a0(msgResponse('[busyFactor]',_0x7c33('0x19a'),_0x7c33('0x21c')+_0x3acddc));}if(_0x2a2286<=0x0||isNaN(_0x2a2286)){return _0x22e6a0(msgResponse('[busyFactor]',_0x7c33('0x19a'),_0x7c33('0x217')+_0x2a2286));}if(_0x32e558<=0x0||isNaN(_0x32e558)){return _0x22e6a0(msgResponse(_0x7c33('0x21d'),'Error','p\x20=\x20'+_0x32e558));}if(_0x1c973d<=0x0||isNaN(_0x1c973d)){return _0x22e6a0(msgResponse('[busyFactor]',_0x7c33('0x19a'),_0x7c33('0x21e')+_0x1c973d));}if(_0x42dce2<=0x0||isNaN(_0x42dce2)){return _0x22e6a0(msgResponse('[busyFactor]',_0x7c33('0x19a'),_0x7c33('0x21f')+_0x42dce2));}_0x4cf807=_0x4cf807||0x0;var _0x4c7a4d=0x1/_0x2a2286;var _0x4218d2=0x0;var _0x4a6f05=0x0;var _0x298c78=0x0;var _0xc988a7=0x0;for(var _0xdb4fab=0x0;_0xc988a7<_0x42dce2;_0xdb4fab+=0x1){_0x4a6f05=_0xdb4fab/_0x1c973d;_0x4218d2=(_0x32e558*_0x4a6f05+_0x4cf807)/_0x4c7a4d;_0x298c78=erlangb(_0x4218d2,_0x3acddc);_0xc988a7=_0x4218d2/_0x3acddc*(0x1-erlangb(_0x4218d2,_0x3acddc));}return _0x17f793({'erlangCalls':_0xdb4fab,'erlangCallToSecond':_0x1c973d/_0xdb4fab,'erlangAbandonmentRate':_0x298c78,'erlangBusyFactor':_0xc988a7});});};module[_0x7c33('0x220')]=Dialer; \ No newline at end of file +var _0xadaf=['trunks','maxNumberOriginate','channels','contactsId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBookedRR','agentconnect','bind','queuecallerabandon','syncQueueCallerAbandon','syncOriginateResponse','syncAgentComplete','custom:queuesummary','hangup','syncHangup','newexten','syncNewExten','varset','syncVarSet','queuemember','syncQueueMember','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','isUndefined','message','AGENTS_NOT_LOGGED','name','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','\x20NOT\x20Active','Interval','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Intervals','isEmpty','Error','stringify','milliseconds','diff','seconds','emit','outbound','strategy','answered','available','pTalking','sumBillable','sumHoldTime','talking','total','type','abandoned','loggedInDb','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','Trunk','active','callerid','format','voice_queue:save','campaign:ivr:%s','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsCallersExit','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','merge','clearing\x20variable\x20start\x20progressive','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','ivr','string','\x22%s\x22\x20<%s>','error','inspect','length','hasOwnProperty','originated','[decremetOriginate]\x20is\x20null\x20or\x20undefined','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','waiting','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','endtime','[uniqueid]','clearZombieChannels','actions','isNil','Action','channel','catch','No\x20such\x20channel','updateOriginated','[Dialer][checkChannel]','queue','campaigns','countReScheduled','resolve','[countReScheduled]\x20','checkIsBlackList','then','[checkIsBlackList]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','avgHandleTime','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','[getContactDialer]\x20','getContactDialerIvr','getVoiceQueueRtPauses','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','saveInDb','pick','ListId','UserId','VoiceQueueId','CampaignId','[emptyContact][createHistory]','[emptyContact]','isSuccess','Success','isTrunkReachable','SIP/%s','status','reachable','uniqueId','uniqueid','variable','amdstatus','exten','dialAMDActive','value','HANGUP','state','statedesc','HangupInAMD','membername','[syncHangupInAMD]','MACHINE','Machine','countmachineretry','countglobal','countbusyretry','countcongestionretry','countnosuchnumberretry','countagentrejectretry','dialGlobalMaxRetry','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','add','dialMachineRetryFrequency','minutes','YYYY-MM-DD\x20HH:mm:ss','ContactId','[rescheduleContact][Machine]','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','[syncAgentComplete][createHistory][0]','reason19\x20machine....','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','reason','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','[syncAgentComplete]','answertime','queueCallerAbandonCreateState','droptime','outboundDropCallsDayTimeout','Drop','dropreason','TIMEOUT','countdropretry','dialDropMaxRetry','dialDropRetryFrequency','[rescheduleContact][Drop]','starttime','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','Abandoned','countabandonedretry','dialAbandonedRetryFrequency','[syncAgentComplete][createHistory][11]','actionid','roundrobin','locked','paused','stateinterface','queueBooked','idHopper','queueStatusComplete','[booked][unlockQueueStatus]','run','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[booked][RR][finaly]','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','syncCampaigns','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','checkIfTimeIntervals','Failure','INTERVAL_IS_EMPTY','\x20Intervals\x20is\x20empty\x20','timezones','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','isArray','push','command','iftime\x20%s,%s','indexOf','true','content','some','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','checkDialMethod','dialMethod','progressive','predictive','handlePower','Queue','method\x20not\x20recognized','loggedIn','dialActive','checkIsTrunkReachable','dialGlobalInterval','dialTimezone','[syncQueueSummary]','launchHandleIvr','[syncCampaigns]','\x5cw{0,','pow','replace','random','match','actionOriginate','object','voiceQueue\x20is\x20undefine','Contact','phone','originate','contact\x20is\x20undefine','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialQueueTimeout','ACTIVE','xcally-motion-dialer','XMD-AMDINITIALSILENCE','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','tags','updatedAt','%s%s','XMD-','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','trim','dialCutDigit','substring','SIP/%s/%s%s','from-sip','dialOriginateTimeout','outboundOriginateFailureCallsDay','[originateError]:\x20%s','OriginateError','[originate][error]','getQueue','response','callProgressDetecting','[callProgressDetecting]\x20','checkRetriveMax','countnoanswerretry','dialNoAnswerMaxRetry','dialBusyMaxRetry','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','[rescheduleContact][NoSuchNumber]','dialAbandonedMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','evt\x20is\x20undefine','outboundNoSuchCallsDay','custom:agentnosuchnumber','buildObj','nosuchnumber','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','custom:agentnoanswer','noanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','stateGlobal','outboundBusyCallsDay','Busy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','AgentReject','custom:agentreject','agentreject','reason\x2020\x20agentreject','[moveContactManagedDialer][0]','dialPredictiveOptimizationPercentage','predictiveIntervalMaxThreshold','round','predictiveIntervalMinThreshold','floor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','dialPredictiveInterval','started\x20in\x20predictive\x20at','averageHandleTime','getDataPredictive','startMethodPredictive','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','[CatchErlangB]','agentBusyFactor','outboundQueuePauses','one\x20call\x20every:','[handlePredictive]','checkContactBlack','recallme','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','scheduledat','dialRecallMeTimeout','Agent','voicePause','log','Contact\x20updated','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','BLACKLIST','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','handleIvr','temp','AVAILABLE_CONTACTS_FINISHED','[getContactCampaign2][Empty]','ivrTotalCallsDays','[actionOriginate]\x20','Contact.phone','[actionOriginateIvr]\x20','dialLimitQueue','dialOrderByScheduledAt','[getContactDialer2]','tryOriginatePredictive','not_inuse','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','Ts\x20=\x20','interval\x20=\x20','Amax\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','m\x20=\x20','[busyFactor]','p\x20=\x20','Umin\x20=\x20','exports','util','lodash','bluebird','uuid','moment','md5','../../../config/environment/','dialer','../../../config/logger','booked','predictiveCalls','syncQueueSummary','../ami','redis','defaults','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./final','./agentComplete','./queueCallerAbandon','env','XCALLY_IP_AGI','rrmemory','prototype','enqueue','tail','finally','sequence','preview','voiceQueues','agents'];(function(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0xadaf,0x1ee));var _0xfada=function(_0x29b209,_0x317331){_0x29b209=_0x29b209-0x0;var _0x3e17e4=_0xadaf[_0x29b209];return _0x3e17e4;};'use strict';var util=require(_0xfada('0x0'));var _=require(_0xfada('0x1'));var BPromise=require(_0xfada('0x2'));var uuid=require(_0xfada('0x3'));var moment=require(_0xfada('0x4'));var rr=require('rr');var md5=require(_0xfada('0x5'));var Redis=require('ioredis');var ut=require('../preview/util/util');var config=require(_0xfada('0x6'));var logger=require('../../../config/logger')(_0xfada('0x7'));var loggerBooked=require(_0xfada('0x8'))(_0xfada('0x9'));var loggerPredictive=require(_0xfada('0x8'))('predictive');var loggerPredictiveCalls=require(_0xfada('0x8'))(_0xfada('0xa'));var loggerSyncQueueSummary=require(_0xfada('0x8'))(_0xfada('0xb'));var ami=require(_0xfada('0xc'));config[_0xfada('0xd')]=_[_0xfada('0xe')](config[_0xfada('0xd')],{'host':_0xfada('0xf'),'port':0x18eb});var io=require(_0xfada('0x10'))(new Redis(config[_0xfada('0xd')]));var cmHopper=require(_0xfada('0x11'));var cmHopperFinal=require(_0xfada('0x12'));var cmHopperHistory=require(_0xfada('0x13'));var cmHopperBlack=require(_0xfada('0x14'));var voiceQueueRt=require(_0xfada('0x15'));var Action=require('./action');var History=require('./history');var Final=require(_0xfada('0x16'));var AgentComplete=require(_0xfada('0x17'));var QueueCallerAbandon=require(_0xfada('0x18'));var Hangup=require('./hangup');var ipAgi=process[_0xfada('0x19')][_0xfada('0x1a')]||'127.0.0.1';var strategy={'rrmemory':_0xfada('0x1b'),'roundrobin':'roundrobin'};var Sequence=function(){};Sequence[_0xfada('0x1c')][_0xfada('0x1d')]=function(_0x5592f7){this['tail']=this[_0xfada('0x1e')]?this[_0xfada('0x1e')][_0xfada('0x1f')](_0x5592f7):_0x5592f7();};function Dialer(_0x5f2150,_0x1d9bab){this[_0xfada('0x20')]=new Sequence();this[_0xfada('0x21')]=_0x1d9bab;this[_0xfada('0x22')]=_0x5f2150[_0xfada('0x22')];this['campaigns']=_0x5f2150['campaigns'];this[_0xfada('0x23')]=_0x5f2150[_0xfada('0x23')];this['trunks']=_0x5f2150[_0xfada('0x24')];this[_0xfada('0x25')]=config[_0xfada('0x25')]||0x2;this[_0xfada('0x26')]={};this['actions']={};this[_0xfada('0x27')]={};this['uniqueId']={};this[_0xfada('0x28')]={};this[_0xfada('0x29')]={};this[_0xfada('0x2a')]={};this[_0xfada('0x2b')]={};this['queueBooked']={};this[_0xfada('0x2c')]={};ami['on'](_0xfada('0x2d'),this['syncAgentConnect'][_0xfada('0x2e')](this));ami['on'](_0xfada('0x2f'),this[_0xfada('0x30')][_0xfada('0x2e')](this));ami['on']('originateresponse',this[_0xfada('0x31')][_0xfada('0x2e')](this));ami['on']('agentcomplete',this[_0xfada('0x32')][_0xfada('0x2e')](this));ami['on'](_0xfada('0x33'),this[_0xfada('0xb')]['bind'](this));ami['on'](_0xfada('0x34'),this[_0xfada('0x35')][_0xfada('0x2e')](this));ami['on'](_0xfada('0x36'),this[_0xfada('0x37')][_0xfada('0x2e')](this));ami['on'](_0xfada('0x38'),this[_0xfada('0x39')][_0xfada('0x2e')](this));ami['on'](_0xfada('0x3a'),this[_0xfada('0x3b')][_0xfada('0x2e')](this));ami['on']('queuestatuscomplete',this[_0xfada('0x3c')][_0xfada('0x2e')](this));this[_0xfada('0x3d')]();this[_0xfada('0x3e')]();}function isNotNull(_0xd88aac){return _0xd88aac!==null&&!_[_0xfada('0x3f')](_0xd88aac);}function checkIsLoggedIn(_0x44c79c,_0x44e2ae){return function(){if(_0x44e2ae<=0x0){_0x44c79c[_0xfada('0x40')]=_0xfada('0x41');throw _0x44c79c[_0xfada('0x42')]+_0xfada('0x43');}};}function isActive(_0x2966fd){return _0x2966fd;}function checkIsActive(_0x1e02ff,_0x30e576){return function(){if(!isActive(_0x30e576)){_0x1e02ff[_0xfada('0x40')]=_0xfada('0x44');throw _0x1e02ff['name']+_0xfada('0x45');}};}function checkInterval(_0x48929b){return function(){if(!isNotNull(_0x48929b[_0xfada('0x46')])){_0x48929b[_0xfada('0x40')]=_0xfada('0x47');throw _0x48929b['name']+_0xfada('0x48');}if(!isNotNull(_0x48929b['Interval'][_0xfada('0x49')])){_0x48929b[_0xfada('0x40')]=_0xfada('0x47');throw _0x48929b[_0xfada('0x42')]+_0xfada('0x48');}if(!isNotNull(_[_0xfada('0x4a')](_0x48929b['Interval'][_0xfada('0x49')]))){_0x48929b[_0xfada('0x40')]='INTERVAL_IS_NULL';throw _0x48929b[_0xfada('0x42')]+'\x20INTERVAL_IS_NULL';}};}function msgResponse(_0x1a0ade,_0x4e523c,_0x181f76){return{'action':_0x1a0ade,'response':_0x4e523c,'message':_0x181f76,'stack':_0x181f76};}function myreject(_0x5061c3){return function(_0x3bb192){return _0x5061c3(msgResponse('[ifTime][Action]',_0xfada('0x4b'),JSON[_0xfada('0x4c')](_0x3bb192)));};}function getSeconds(_0xb92735,_0x2d6865){var _0x83e203=moment(_0xb92735)[_0xfada('0x4d')](0x0);var _0x37b1fd=moment(_0x2d6865)[_0xfada('0x4d')](0x0);return _0x83e203[_0xfada('0x4e')](_0x37b1fd,_0xfada('0x4f'));}function emit(_0x34f9de,_0x547be6,_0x48139e){io['to'](_0x34f9de)[_0xfada('0x50')](_0x547be6,_0x48139e);}function emitVoiceQueueSummary(_0x42f3ad){if(_0x42f3ad['type']===_0xfada('0x51')){var _0x30888d={'id':_0x42f3ad['id'],'name':_0x42f3ad[_0xfada('0x42')],'strategy':_0x42f3ad[_0xfada('0x52')],'answered':_0x42f3ad[_0xfada('0x53')],'available':_0x42f3ad[_0xfada('0x54')],'loggedIn':_0x42f3ad['loggedIn'],'pTalking':_0x42f3ad[_0xfada('0x55')],'sumBillable':_0x42f3ad[_0xfada('0x56')],'sumDuration':_0x42f3ad['sumDuration'],'sumHoldTime':_0x42f3ad[_0xfada('0x57')]||0x0,'talking':_0x42f3ad[_0xfada('0x58')],'total':_0x42f3ad[_0xfada('0x59')],'type':_0x42f3ad[_0xfada('0x5a')],'unmanaged':_0x42f3ad['unmanaged'],'abandoned':_0x42f3ad[_0xfada('0x5b')],'waiting':_0x42f3ad['waiting'],'loggedInDb':_0x42f3ad[_0xfada('0x5c')],'dialActive':_0x42f3ad['dialActive'],'dialMethod':_0x42f3ad['dialMethod'],'dialOriginateCallerIdName':_0x42f3ad[_0xfada('0x5d')],'dialOriginateCallerIdNumber':_0x42f3ad[_0xfada('0x5e')],'dialOriginateTimeout':_0x42f3ad['dialOriginateTimeout'],'dialPrefix':_0x42f3ad[_0xfada('0x5f')],'outboundAnswerAgiCallsDay':_0x42f3ad[_0xfada('0x60')],'outboundAnswerCallsDay':_0x42f3ad[_0xfada('0x61')],'outboundBlacklistCallsDay':_0x42f3ad[_0xfada('0x62')],'outboundBusyCallsDay':_0x42f3ad['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x42f3ad[_0xfada('0x63')],'outboundDropCallsDayACS':_0x42f3ad['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x42f3ad[_0xfada('0x64')],'outboundDropCallsDayTimeout':_0x42f3ad['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x42f3ad['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x42f3ad['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x42f3ad['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x42f3ad[_0xfada('0x65')],'outboundRejectCallsDay':_0x42f3ad[_0xfada('0x66')],'outboundUnknownCallsDay':_0x42f3ad[_0xfada('0x67')],'predictiveIntervalAnsweredCalls':_0x42f3ad['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x42f3ad[_0xfada('0x68')],'predictiveIntervalAvgTalktime':_0x42f3ad[_0xfada('0x69')],'predictiveIntervalDroppedCallsCallersExit':_0x42f3ad['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x42f3ad[_0xfada('0x6a')],'predictiveIntervalErlangCalls':_0x42f3ad['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x42f3ad[_0xfada('0x6b')],'predictiveIntervalHitRate':_0x42f3ad[_0xfada('0x6c')],'predictiveIntervalMultiplicativeFactor':_0x42f3ad['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x42f3ad[_0xfada('0x6d')],'predictiveIntervalAvailable':_0x42f3ad[_0xfada('0x6e')],'predictiveIntervalTotalCalls':_0x42f3ad[_0xfada('0x6f')],'message':_0x42f3ad[_0xfada('0x40')],'originated':_0x42f3ad['originated'],'erlangCalls':_0x42f3ad[_0xfada('0x70')],'erlangCallToSecond':_0x42f3ad[_0xfada('0x71')],'erlangAbandonmentRate':_0x42f3ad['erlangAbandonmentRate'],'erlangBusyFactor':_0x42f3ad['erlangBusyFactor'],'startPredictive':_0x42f3ad[_0xfada('0x29')],'startProgressive':_0x42f3ad[_0xfada('0x2a')]};if(_0x42f3ad[_0xfada('0x72')]){_0x30888d[_0xfada('0x72')]={'id':_0x42f3ad['Trunk']['id'],'name':_0x42f3ad[_0xfada('0x72')]['name'],'active':_0x42f3ad['Trunk'][_0xfada('0x73')],'callerid':_0x42f3ad['Trunk'][_0xfada('0x74')]};}if(_0x42f3ad[_0xfada('0x46')]){_0x30888d['Interval']={'id':_0x42f3ad[_0xfada('0x46')]['id'],'name':_0x42f3ad[_0xfada('0x46')]['name']};}var _0xec8b01=md5(JSON[_0xfada('0x4c')](_0x30888d));if(_0x42f3ad[_0xfada('0x5')]!==_0xec8b01){_0x42f3ad[_0xfada('0x5')]=_0xec8b01;emit(util[_0xfada('0x75')]('voice:queue:%s',_0x30888d[_0xfada('0x42')]),_0xfada('0x76'),_0x30888d);}}}function emitCampaignSummary(_0x4ce679){if(_0x4ce679['type']==='ivr'){emit(util['format'](_0xfada('0x77'),_0x4ce679[_0xfada('0x42')]),'campaign:save',_0x4ce679);}}function checkGetDataPredictive(_0x215722){if(isNotNull(_0x215722)){if(!_[_0xfada('0x4a')](_0x215722)){loggerPredictive[_0xfada('0x78')](_0xfada('0x79'));loggerPredictive[_0xfada('0x78')](_0xfada('0x7a'),_0x215722[_0xfada('0x6f')]);loggerPredictive[_0xfada('0x78')](_0xfada('0x7b'),_0x215722[_0xfada('0x7c')]);loggerPredictive['info']('Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x215722['predictiveIntervalDroppedCallsTimeout']);loggerPredictive[_0xfada('0x78')](_0xfada('0x7d'),_0x215722[_0xfada('0x7e')]);loggerPredictive[_0xfada('0x78')](_0xfada('0x7f'),_0x215722[_0xfada('0x68')]);loggerPredictive['info'](_0xfada('0x80'),_0x215722['predictiveIntervalAvgTalktime']);loggerPredictive[_0xfada('0x78')](_0xfada('0x81'));if(_0x215722[_0xfada('0x6f')]>0x0){if(!_[_0xfada('0x3f')](_0x215722[_0xfada('0x69')])&&_0x215722['predictiveIntervalAvgTalktime']>0x0){return!![];}else{loggerPredictive['info'](_0xfada('0x82'));}if(!_[_0xfada('0x3f')](_0x215722[_0xfada('0x68')])&&_0x215722['predictiveIntervalAvgHoldtime']>0x0){return!![];}else{loggerPredictive[_0xfada('0x78')](_0xfada('0x83'));}}else{loggerPredictive[_0xfada('0x78')]('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive[_0xfada('0x78')](_0xfada('0x84'));}}else{loggerPredictive['info']('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x37922b){return function(_0x52588a){loggerPredictive[_0xfada('0x78')]('---------\x20ErlangB\x20---------');loggerPredictive[_0xfada('0x78')]('Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x52588a[_0xfada('0x70')]);loggerPredictive[_0xfada('0x78')](_0xfada('0x85'),_0x52588a[_0xfada('0x71')]);loggerPredictive['info'](_0xfada('0x86'),_0x52588a[_0xfada('0x87')]);loggerPredictive['info'](_0xfada('0x88'),_0x52588a[_0xfada('0x89')]);loggerPredictive[_0xfada('0x78')](_0xfada('0x86'),_0x52588a[_0xfada('0x87')]);loggerPredictive[_0xfada('0x78')](_0xfada('0x81'));_[_0xfada('0x8a')](_0x37922b,_0x52588a);};}function getDiff(_0x355e19){var _0x16d4e3=moment()[_0xfada('0x4d')](0x0);var _0x4e7ae9=moment(_0x355e19)[_0xfada('0x4d')](0x0);return _0x16d4e3[_0xfada('0x4e')](_0x4e7ae9,_0xfada('0x4f'));}function ifInterval(_0x218bbb,_0x5e34ba){if(_['isUndefined'](_0x5e34ba)){return![];}if(getDiff(_0x5e34ba)<_0x218bbb*0x3c){return!![];}else{return![];}}function freeVariablesPredictive(_0x12a545){if(isNotNull(_0x12a545)){if(!_[_0xfada('0x3f')](_0x12a545['startProgressive'])){_0x12a545[_0xfada('0x2a')]=undefined;loggerPredictive[_0xfada('0x78')](_0x12a545[_0xfada('0x42')],_0xfada('0x8b'));}if(!_['isUndefined'](_0x12a545[_0xfada('0x29')])){_0x12a545['startPredictive']=undefined;loggerPredictive['info'](_0x12a545[_0xfada('0x42')],_0xfada('0x8c'));}if(!_[_0xfada('0x3f')](_0x12a545[_0xfada('0x8d')])){clearInterval(_0x12a545['handlePredictive']);_0x12a545['handlePredictive']=undefined;loggerPredictive['info'](_0x12a545[_0xfada('0x42')],_0xfada('0x8e'));}}}function erlangb(_0x70c886,_0x29f632){if(_0x29f632===0x0){return 0x0;}var _0x4d677d=0x1;for(var _0x344459=0x1;_0x344459<=_0x29f632;_0x344459+=0x1){_0x4d677d=0x1+_0x4d677d*_0x344459/_0x70c886;}return 0x1/_0x4d677d;}function isVoiceQueueOutbound(_0x4ba712){return _0x4ba712===_0xfada('0x51');}function isNotPreview(_0x58be8a){return _0x58be8a!==_0xfada('0x21');}function isCampaignIvr(_0x1a6b71){return _0x1a6b71===_0xfada('0x8f');}function getCallerId(_0x56e2bf,_0x30cb4e,_0x3f3feb){if(!_[_0xfada('0x3f')](_0x3f3feb)&&_0xfada('0x90')===typeof _0x3f3feb&&!_[_0xfada('0x4a')](_0x3f3feb)){if(!_[_0xfada('0x3f')](_0x30cb4e)&&_0xfada('0x90')===typeof _0x30cb4e&&!_[_0xfada('0x4a')](_0x30cb4e)){return util[_0xfada('0x75')]('\x22%s\x22\x20<%s>',_0x30cb4e,_0x3f3feb);}return util[_0xfada('0x75')](_0xfada('0x91'),_0x3f3feb,_0x3f3feb);}if(!_['isUndefined'](_0x56e2bf)&&_0xfada('0x90')===typeof _0x56e2bf&&!_['isEmpty'](_0x56e2bf)){return _0x56e2bf;}return'\x22\x22\x20<>';}function loggerCatchQueueSummary(_0xc4435f,_0x227a2c){return function(_0xdba13a){freeVariablesPredictive(_0x227a2c);emitVoiceQueueSummary(_0x227a2c);emitCampaignSummary(_0x227a2c);loggerSyncQueueSummary[_0xfada('0x92')](_0xc4435f,util[_0xfada('0x93')](_0xdba13a,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x4ddb90,_0x38776d){return function(_0xdc8765){loggerPredictive['error'](_0x38776d[_0xfada('0x42')],_0x4ddb90);loggerPredictive[_0xfada('0x92')](_0xdc8765['stack']);freeVariablesPredictive(_0x38776d);};}function loggerCatch(_0x445bdb){return function(_0x5504b9){logger[_0xfada('0x92')](_0x445bdb,util[_0xfada('0x93')](_0x5504b9,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x3d4069){return _0x3d4069&&!_[_0xfada('0x3f')](_0x3d4069)&&_0x3d4069[_0xfada('0x94')]>0x0;}function decremetOriginate(_0x5d0171){if(!_['isUndefined'](_0x5d0171)&&_0x5d0171!==null){if(_0x5d0171[_0xfada('0x95')](_0xfada('0x96'))){if(_0x5d0171[_0xfada('0x96')]>0x0){_0x5d0171[_0xfada('0x96')]-=0x1;}else{logger['error']('[decremetOriginate]\x20object\x20originated\x20is\x20negative');}}}else{logger['error'](_0xfada('0x97'));}}function checkContactLowerLimitOriginate(_0x5cc7b8,_0x401ad8,_0x136563){if(_0x401ad8>_0x136563){for(var _0x48cf50=0x0;_0x48cf50<_0x401ad8-_0x136563;_0x48cf50+=0x1){decremetOriginate(_0x5cc7b8);}}}function loggerGetContactDialer(_0x2f77b9,_0x3a1d8a,_0x5ec1ab){return function(_0x4dde14){checkContactLowerLimitOriginate(_0x3a1d8a,_0x5ec1ab,0x0);logger[_0xfada('0x92')](_0x2f77b9,util[_0xfada('0x93')](_0x4dde14,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x1334a6){return function(_0x3c0044){if(isNotNull(_0x3c0044)&&isNotNull(_0x3c0044[0x0])){if(_0x3c0044[0x0]['contactsRescheduled']>0x0){_0x1334a6[_0xfada('0x40')]=_0xfada('0x98');logger[_0xfada('0x78')](_0xfada('0x99')+_0x1334a6['name'],_0x3c0044[0x0]['contactsRescheduled'],'contacts');}else{_0x1334a6[_0xfada('0x40')]='AVAILABLE_CONTACTS_FINISHED';logger['info']('[getContactDialer2][Empty]'+_0x1334a6[_0xfada('0x42')]);}}};}function notSendMessagesQueue(_0x55795c){if(_0x55795c['sendMessageOneNotActive']){freeVariablesPredictive(_0x55795c);if(_0x55795c[_0xfada('0x96')]===0x0&&_0x55795c[_0xfada('0x58')]===0x0&&_0x55795c[_0xfada('0x9a')]===0x0&&(_0x55795c['pTalking']||0x0)===0x0){_0x55795c[_0xfada('0x9b')]=![];_0x55795c[_0xfada('0x54')]=0x0;_0x55795c['message']=_0xfada('0x44');loggerSyncQueueSummary['error'](_0xfada('0x9c'),_0x55795c[_0xfada('0x42')],_0xfada('0x9d'));}else{_0x55795c[_0xfada('0x40')]=_0xfada('0x9e');loggerSyncQueueSummary['error']('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x55795c[_0xfada('0x42')],_0xfada('0x9f'));}emitVoiceQueueSummary(_0x55795c);}}function notSendMessagesCampaign(_0x3f1276){if(_0x3f1276[_0xfada('0x9b')]){if(_0x3f1276[_0xfada('0x96')]===0x0){_0x3f1276[_0xfada('0x9b')]=![];_0x3f1276[_0xfada('0x40')]=_0xfada('0x44');loggerSyncQueueSummary['error'](_0xfada('0xa0'),_0x3f1276[_0xfada('0x42')],'is\x20not\x20active');}else{_0x3f1276[_0xfada('0x40')]='IS_DISACTIVED';loggerSyncQueueSummary['error'](_0xfada('0xa0'),_0x3f1276[_0xfada('0x42')],_0xfada('0x9f'));}emitCampaignSummary(_0x3f1276);}}function createObjHistory(_0x834a7,_0x5353e5,_0x2af8f8,_0x553e5d,_0x421244){_0x834a7[_0xfada('0x40')]=_0x2af8f8;var _0x2e53b3=new Action(_0x834a7,_0x5353e5);var _0x5f2bdd=new History(_0x2e53b3);_0x5f2bdd['state']=_0x553e5d;_0x5f2bdd['statedesc']=_0x421244;_0x5f2bdd[_0xfada('0xa1')]=_0x2e53b3['starttime'];return _0x5f2bdd;}Dialer['prototype'][_0xfada('0x3e')]=function(){var _0x56c76c=this;setInterval(function(){_0x56c76c['clearZombieChannels'](_0x56c76c['uniqueId'],_0xfada('0xa2'));_0x56c76c[_0xfada('0xa3')](_0x56c76c[_0xfada('0xa4')],'[actions]');},0x32c8);};Dialer[_0xfada('0x1c')][_0xfada('0xa3')]=function(_0x3d9fc7,_0x4cf454){var _0x14f50e=this;for(var _0x18e41a in _0x3d9fc7){if(_0x3d9fc7[_0xfada('0x95')](_0x18e41a)){this[_0xfada('0x20')][_0xfada('0x1d')](function(){if(!_[_0xfada('0xa5')](_0x3d9fc7[_0x18e41a])){return ami[_0xfada('0xa6')]({'action':'status','channel':_0x3d9fc7[_0x18e41a][_0xfada('0xa7')]})[_0xfada('0xa8')](function(_0x2a95a9){if(_0x2a95a9[_0xfada('0x40')]===_0xfada('0xa9')){setTimeout(function(){if(_0x3d9fc7[_0x18e41a]&&_0x3d9fc7[_0x18e41a][_0xfada('0x5a')]!==_0xfada('0x8f')){_0x14f50e[_0xfada('0xaa')](_0x14f50e[_0xfada('0x22')][_0x3d9fc7[_0x18e41a]['queue']]);logger[_0xfada('0x92')](_0xfada('0xab'),_0x4cf454,_0x18e41a,_0x3d9fc7[_0x18e41a][_0xfada('0xac')]);delete _0x3d9fc7[_0x18e41a];}if(_0x3d9fc7[_0x18e41a]&&_0x3d9fc7[_0x18e41a][_0xfada('0x5a')]===_0xfada('0x8f')){_0x14f50e[_0xfada('0xaa')](_0x14f50e[_0xfada('0xad')][_0x3d9fc7[_0x18e41a][_0xfada('0xac')]]);logger[_0xfada('0x92')]('[Dialer][checkChannel][ivr]',_0x4cf454,_0x18e41a,_0x3d9fc7[_0x18e41a][_0xfada('0xac')]);delete _0x3d9fc7[_0x18e41a];}},0x2328);}});}});}}};Dialer[_0xfada('0x1c')][_0xfada('0xae')]=function(_0x3d74e7){return BPromise[_0xfada('0xaf')]()['then'](cmHopper['countReScheduled'](_0x3d74e7))[_0xfada('0xa8')](loggerCatch(_0xfada('0xb0')));};Dialer[_0xfada('0x1c')][_0xfada('0xb1')]=function(_0x1acbdc){return BPromise[_0xfada('0xaf')]()[_0xfada('0xb2')](cmHopperBlack[_0xfada('0xb1')](_0x1acbdc))[_0xfada('0xa8')](loggerCatch(_0xfada('0xb3')));};Dialer[_0xfada('0x1c')][_0xfada('0xb4')]=function(_0x592004){return BPromise[_0xfada('0xaf')]()[_0xfada('0xb2')](cmHopperBlack['checkIsBlackListIvr'](_0x592004))['catch'](loggerCatch(_0xfada('0xb5')));};Dialer[_0xfada('0x1c')]['averageHandleTime']=function(_0x29f8b0){return BPromise[_0xfada('0xaf')]()[_0xfada('0xb2')](cmHopperHistory[_0xfada('0xb6')](_0x29f8b0))[_0xfada('0xa8')](loggerCatch('[averageHandleTime]\x20'));};Dialer['prototype'][_0xfada('0xb7')]=function(_0x324d47){return BPromise['resolve']()[_0xfada('0xb2')](cmHopper['rescheduleContact'](_0x324d47))['catch'](loggerCatch(_0xfada('0xb8')));};Dialer[_0xfada('0x1c')][_0xfada('0xb9')]=function(_0x43def3,_0x459b35,_0x185c34){return BPromise['resolve']()[_0xfada('0xb2')](cmHopper[_0xfada('0xb9')](_0x43def3,_0x459b35,_0x185c34))[_0xfada('0xa8')](loggerCatch(_0xfada('0xba')));};Dialer[_0xfada('0x1c')][_0xfada('0xbb')]=function(_0x4c8b8c,_0x46cd29,_0x185ce5,_0x344354){return BPromise['resolve']()['then'](cmHopper[_0xfada('0xbb')](_0x4c8b8c,_0x46cd29,_0x185ce5,_0x344354))['catch'](loggerCatch(_0xfada('0xbc')));};Dialer[_0xfada('0x1c')]['getContactDialerIvr']=function(_0x2c1910,_0x128f28,_0x10aa7d){return BPromise[_0xfada('0xaf')]()[_0xfada('0xb2')](cmHopper[_0xfada('0xbd')](_0x2c1910,_0x128f28,_0x10aa7d))[_0xfada('0xa8')](loggerCatch(_0xfada('0xbc')));};Dialer[_0xfada('0x1c')][_0xfada('0xbe')]=function(_0x37192c){return BPromise[_0xfada('0xaf')]()[_0xfada('0xb2')](voiceQueueRt[_0xfada('0xbe')](_0x37192c))[_0xfada('0xa8')](loggerCatch('[getVoiceQueueRtPauses]\x20'));};Dialer['prototype'][_0xfada('0xbf')]=function(_0x1c90e3){return BPromise[_0xfada('0xaf')]()[_0xfada('0xb2')](cmHopper[_0xfada('0xbf')](_0x1c90e3))['catch'](loggerCatch(_0xfada('0xc0')));};Dialer[_0xfada('0x1c')][_0xfada('0xc1')]=function(_0xf965ce){return BPromise['resolve']()[_0xfada('0xb2')](cmHopperHistory[_0xfada('0xc1')](_0xf965ce))[_0xfada('0xa8')](loggerCatch(_0xfada('0xc2')));};Dialer[_0xfada('0x1c')][_0xfada('0xaa')]=function(_0x2eaf59){if(!_['isUndefined'](_0x2eaf59)&&_0x2eaf59!==null){if(_0x2eaf59[_0xfada('0x95')](_0xfada('0x96'))){if(_0x2eaf59[_0xfada('0x96')]>0x0){_0x2eaf59[_0xfada('0x96')]-=0x1;}else{logger[_0xfada('0x92')](_0xfada('0xc3'));}}}else{logger[_0xfada('0x92')](_0xfada('0xc4'));}};Dialer[_0xfada('0x1c')][_0xfada('0xc5')]=function(_0x5a3137,_0x2eae4d){var _0x15fde7=this;return function(_0x2b57f9){_0x15fde7[_0xfada('0xaa')](_0x2eae4d);logger[_0xfada('0x92')](_0x5a3137,util[_0xfada('0x93')](_0x2b57f9,{'showHidden':![],'depth':null}));};};Dialer['prototype'][_0xfada('0xc6')]=function(_0x794ac,_0x47a461,_0x2303a4){var _0x217dd4={'state':0x19,'statedesc':_0xfada('0xc7')};this[_0xfada('0xaa')](_0x47a461);this[_0xfada('0xc8')](_['merge'](_0x217dd4,_[_0xfada('0xc9')](_0x2303a4,['ContactId',_0xfada('0xca'),_0xfada('0xcb'),_0xfada('0xcc'),_0xfada('0xcd')])),_0xfada('0xce'),_0xfada('0xcf'));logger[_0xfada('0x92')](_0x794ac);};Dialer[_0xfada('0x1c')][_0xfada('0xd0')]=function(_0x5d453a){return _0x5d453a===_0xfada('0xd1');};Dialer[_0xfada('0x1c')][_0xfada('0xd2')]=function(_0x30bf8c){return!_[_0xfada('0x3f')](_0x30bf8c)&&_0x30bf8c&&!_[_0xfada('0x3f')](_0x30bf8c[_0xfada('0x42')])&&!_[_0xfada('0x3f')](_0x30bf8c[_0xfada('0x73')])&&_0x30bf8c[_0xfada('0x73')]&&(this['trunks'][util[_0xfada('0x75')](_0xfada('0xd3'),_0x30bf8c['name'])][_0xfada('0xd4')]===_0xfada('0xd5')||this[_0xfada('0x24')][util[_0xfada('0x75')]('SIP/%s',_0x30bf8c[_0xfada('0x42')])][_0xfada('0xd4')]==='unmonitored');};Dialer[_0xfada('0x1c')][_0xfada('0xc8')]=function(_0x251065,_0x58c537,_0x921a6a){this[_0xfada('0xc1')](_0x251065)[_0xfada('0xa8')](loggerCatch(_0x58c537));this[_0xfada('0xbf')](_0x251065)['catch'](loggerCatch(_0x921a6a));};Dialer[_0xfada('0x1c')][_0xfada('0x39')]=function(_0xd2de7b){var _0x3bf6ae=this[_0xfada('0xd6')][_0xd2de7b[_0xfada('0xd7')]];var _0x20bf90;if(!_[_0xfada('0xa5')](_0xd2de7b)&&!_[_0xfada('0xa5')](_0xd2de7b[_0xfada('0xd8')])&&!_['isNil'](_0xd2de7b[_0xfada('0xd8')][_0xfada('0xd9')])&&_0xd2de7b[_0xfada('0xda')]==='xcally-motion-dialer'&&_0x3bf6ae){if(_0x3bf6ae[_0xfada('0x5a')]!==_0xfada('0x8f')&&this['voiceQueues'][_0x3bf6ae['queue']][_0xfada('0xdb')]&&_0xd2de7b[_0xfada('0xdc')]===_0xfada('0xdd')){delete this[_0xfada('0xd6')][_0xd2de7b[_0xfada('0xd7')]];this[_0xfada('0xaa')](this[_0xfada('0x22')][_0x3bf6ae[_0xfada('0xac')]]);this[_0xfada('0x22')][_0x3bf6ae[_0xfada('0xac')]][_0xfada('0x61')]+=0x1;this['voiceQueues'][_0x3bf6ae['queue']]['outboundAnswerAgiCallsDay']+=0x1;_0x20bf90=new Hangup(_0x3bf6ae,_0xd2de7b);_0x20bf90[_0xfada('0xde')]=0x12;_0x20bf90[_0xfada('0xdf')]=_0xfada('0xe0');_0x20bf90[_0xfada('0xe1')]='AMD';this[_0xfada('0xc8')](_0x20bf90,'[syncHangupInAMD][createHistory]',_0xfada('0xe2'));}if(_0x3bf6ae[_0xfada('0x5a')]!==_0xfada('0x8f')&&this['voiceQueues'][_0x3bf6ae['queue']][_0xfada('0xdb')]&&_0xd2de7b[_0xfada('0xdc')]===_0xfada('0xe3')){var _0x50d832=this;return new BPromise(function(_0x556fe7,_0x596bd9){delete _0x50d832[_0xfada('0xd6')][_0xd2de7b['uniqueid']];_0x50d832['updateOriginated'](_0x50d832[_0xfada('0x22')][_0x3bf6ae[_0xfada('0xac')]]);_0x50d832[_0xfada('0x22')][_0x3bf6ae['queue']][_0xfada('0x61')]+=0x1;_0x50d832[_0xfada('0x22')][_0x3bf6ae[_0xfada('0xac')]][_0xfada('0x60')]+=0x1;var _0x1835b3=_0x50d832[_0xfada('0x22')][_0x3bf6ae[_0xfada('0xac')]];var _0x90b1f9=new Hangup(_0x3bf6ae,_0xd2de7b);_0x90b1f9[_0xfada('0xde')]=0x13;_0x90b1f9['statedesc']=_0xfada('0xe4');_0x90b1f9[_0xfada('0xe1')]='AMD';_0x90b1f9[_0xfada('0xe5')]+=0x1;_0x90b1f9[_0xfada('0xe6')]+=0x1;_0x90b1f9['amd']=!![];_0x50d832[_0xfada('0xc1')](_0x90b1f9)[_0xfada('0xa8')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x90b1f9[_0xfada('0xe7')]+_0x90b1f9[_0xfada('0xe8')]+_0x90b1f9['countnoanswerretry']+_0x90b1f9[_0xfada('0xe9')]+_0x90b1f9['countdropretry']+_0x90b1f9['countabandonedretry']+_0x90b1f9['countmachineretry']+_0x90b1f9[_0xfada('0xea')]>=_0x1835b3[_0xfada('0xeb')]){_0x50d832['stateGlobal'](_0x90b1f9,_0x556fe7,_0x596bd9,'reason19\x20machine....');}else{if(_0x90b1f9['countmachineretry']>=_0x1835b3[_0xfada('0xec')]){_0x50d832[_0xfada('0xed')](_0x90b1f9,_0x556fe7,_0x596bd9,_0xfada('0xee'));}else{_0x50d832[_0xfada('0xb7')]({'active':![],'countmachineretry':_0x90b1f9['countmachineretry'],'scheduledat':moment()[_0xfada('0xef')](_0x1835b3[_0xfada('0xf0')],_0xfada('0xf1'))[_0xfada('0x75')](_0xfada('0xf2')),'ContactId':_0x90b1f9[_0xfada('0xf3')],'ListId':_0x90b1f9['ListId'],'VoiceQueueId':_0x90b1f9['VoiceQueueId']||undefined,'CampaignId':_0x90b1f9[_0xfada('0xcd')]||undefined})[_0xfada('0xa8')](loggerCatch(_0xfada('0xf4')));_0x556fe7({'reschedule':0x1});}}});}if(_0x3bf6ae[_0xfada('0x5a')]===_0xfada('0x8f')&&this[_0xfada('0xad')][_0x3bf6ae[_0xfada('0xac')]][_0xfada('0xdb')]&&_0xd2de7b['value']===_0xfada('0xdd')){delete this['uniqueId'][_0xd2de7b[_0xfada('0xd7')]];this[_0xfada('0xaa')](this[_0xfada('0xad')][_0x3bf6ae[_0xfada('0xac')]]);_0x20bf90=new Hangup(_0x3bf6ae,_0xd2de7b);_0x20bf90[_0xfada('0xde')]=0x12;_0x20bf90['statedesc']=_0xfada('0xe0');_0x20bf90[_0xfada('0xe1')]='AMD';this[_0xfada('0xc8')](_0x20bf90,_0xfada('0xf5'),_0xfada('0xf6'));}if(_0x3bf6ae[_0xfada('0x5a')]===_0xfada('0x8f')&&this[_0xfada('0xad')][_0x3bf6ae['queue']][_0xfada('0xdb')]&&_0xd2de7b['value']===_0xfada('0xe3')){var _0x50d832=this;return new BPromise(function(_0xeb9e16,_0x54c850){delete _0x50d832[_0xfada('0xd6')][_0xd2de7b[_0xfada('0xd7')]];_0x50d832[_0xfada('0xaa')](_0x50d832[_0xfada('0xad')][_0x3bf6ae[_0xfada('0xac')]]);_0x50d832[_0xfada('0xad')][_0x3bf6ae[_0xfada('0xac')]][_0xfada('0x61')]+=0x1;_0x50d832[_0xfada('0xad')][_0x3bf6ae[_0xfada('0xac')]][_0xfada('0x60')]+=0x1;var _0x4e68ea=_0x50d832['campaigns'][_0x3bf6ae[_0xfada('0xac')]];var _0x1ceb0b=new Hangup(_0x3bf6ae,_0xd2de7b);_0x1ceb0b[_0xfada('0xde')]=0x13;_0x1ceb0b['statedesc']=_0xfada('0xe4');_0x1ceb0b[_0xfada('0xe1')]='AMD';_0x1ceb0b[_0xfada('0xe5')]+=0x1;_0x1ceb0b[_0xfada('0xe6')]+=0x1;_0x1ceb0b['amd']=!![];_0x50d832[_0xfada('0xc1')](_0x1ceb0b)[_0xfada('0xa8')](loggerCatch(_0xfada('0xf7')));if(_0x1ceb0b[_0xfada('0xe7')]+_0x1ceb0b[_0xfada('0xe8')]+_0x1ceb0b['countnoanswerretry']+_0x1ceb0b[_0xfada('0xe9')]+_0x1ceb0b['countdropretry']+_0x1ceb0b['countabandonedretry']+_0x1ceb0b['countmachineretry']+_0x1ceb0b[_0xfada('0xea')]>=_0x4e68ea['dialGlobalMaxRetry']){_0x50d832['stateGlobal'](_0x1ceb0b,_0xeb9e16,_0x54c850,_0xfada('0xf8'));}else{if(_0x1ceb0b[_0xfada('0xe5')]>=_0x4e68ea['dialMachineMaxRetry']){_0x50d832['createStateFinal'](_0x1ceb0b,_0xeb9e16,_0x54c850,'reason\x2019\x20machine....');}else{_0x50d832[_0xfada('0xb7')]({'active':![],'countmachineretry':_0x1ceb0b['countmachineretry'],'scheduledat':moment()[_0xfada('0xef')](_0x4e68ea[_0xfada('0xf0')],_0xfada('0xf1'))[_0xfada('0x75')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1ceb0b[_0xfada('0xf3')],'ListId':_0x1ceb0b[_0xfada('0xca')],'VoiceQueueId':_0x1ceb0b[_0xfada('0xcc')]||undefined,'CampaignId':_0x1ceb0b[_0xfada('0xcd')]||undefined})['catch'](loggerCatch('[rescheduleContact][Machine]'));_0xeb9e16({'reschedule':0x1});}}});}}};Dialer[_0xfada('0x1c')][_0xfada('0x35')]=function(_0x48534b){var _0x323469=this[_0xfada('0xd6')][_0x48534b[_0xfada('0xd7')]];var _0x1fe5e7=this;var _0x23c7d3;if(_0x323469&&_0x323469[_0xfada('0x5a')]===_0xfada('0x8f')){delete this[_0xfada('0xd6')][_0x48534b[_0xfada('0xd7')]];this['updateOriginated'](this[_0xfada('0xad')][_0x323469[_0xfada('0xac')]]);this[_0xfada('0xad')][_0x323469[_0xfada('0xac')]][_0xfada('0xf9')]+=0x1;_0x23c7d3=new Hangup(_0x323469,_0x48534b);this[_0xfada('0xc1')](_0x23c7d3)[_0xfada('0xa8')](loggerCatch(_0xfada('0xfa')));this[_0xfada('0xbf')](_0x23c7d3)['catch'](loggerCatch(_0xfada('0xfb')));}if(_0x323469&&_0x323469[_0xfada('0x5a')]!==_0xfada('0x8f')&&isNotNull(this[_0xfada('0x22')][_0x323469['queue']][_0xfada('0xfc')])){delete this[_0xfada('0xd6')][_0x48534b[_0xfada('0xd7')]];this[_0xfada('0xaa')](this[_0xfada('0x22')][_0x323469[_0xfada('0xac')]]);this[_0xfada('0x22')][_0x323469[_0xfada('0xac')]][_0xfada('0x61')]+=0x1;this[_0xfada('0x22')][_0x323469[_0xfada('0xac')]][_0xfada('0x60')]+=0x1;_0x23c7d3=new Hangup(_0x323469,_0x48534b);_0x23c7d3['state']=0x10;_0x23c7d3['statedesc']=_0xfada('0xfd');_0x23c7d3['membername']=_0xfada('0xfe');this[_0xfada('0xc1')](_0x23c7d3)[_0xfada('0xa8')](loggerCatch(_0xfada('0xfa')));this['moveContactManagedDialer'](_0x23c7d3)[_0xfada('0xa8')](loggerCatch(_0xfada('0xfb')));}if(_0x323469&&_0x323469[_0xfada('0x5a')]!==_0xfada('0x8f')&&!isNotNull(this[_0xfada('0x22')][_0x323469[_0xfada('0xac')]][_0xfada('0xfc')])){delete this[_0xfada('0xd6')][_0x48534b[_0xfada('0xd7')]];this[_0xfada('0xaa')](this[_0xfada('0x22')][_0x323469['queue']]);this[_0xfada('0x22')][_0x323469[_0xfada('0xac')]]['outboundUnknownCallsDay']+=0x1;_0x23c7d3=new Hangup(_0x323469,_0x48534b);_0x23c7d3[_0xfada('0xde')]=0xc;_0x23c7d3['statedesc']=_0x48534b['cause-txt'];_0x23c7d3[_0xfada('0xe1')]='Unknow';this[_0xfada('0xc1')](_0x23c7d3)[_0xfada('0xa8')](loggerCatch(_0xfada('0xfa')));this[_0xfada('0xbf')](_0x23c7d3)[_0xfada('0xa8')](loggerCatch(_0xfada('0xfb')));}};Dialer[_0xfada('0x1c')][_0xfada('0x32')]=function(_0x2bea2d){var _0x5a3672=this['uniqueId'][_0x2bea2d['uniqueid']];var _0x4381e4=this;if(this[_0xfada('0x22')][_0x2bea2d[_0xfada('0xac')]]){if(_0x5a3672&&_0x5a3672[_0xfada('0x5a')]!==_0xfada('0x8f')){delete this[_0xfada('0xd6')][_0x2bea2d[_0xfada('0xd7')]];this[_0xfada('0x22')][_0x2bea2d[_0xfada('0xac')]][_0xfada('0x61')]+=0x1;var _0x282c89=new AgentComplete(_0x5a3672,_0x2bea2d);if(_0x2bea2d[_0xfada('0xff')]===_0xfada('0x100')){_0x282c89[_0xfada('0x101')]=this['voiceQueues'][_0x2bea2d[_0xfada('0xac')]][_0xfada('0x102')]&&this[_0xfada('0x22')][_0x2bea2d['queue']][_0xfada('0x103')]?moment()[_0xfada('0x75')](_0xfada('0xf2')):undefined;}this['createHistory'](_0x282c89)['catch'](loggerCatch(_0xfada('0x104')));this[_0xfada('0xbf')](_0x282c89)[_0xfada('0xa8')](loggerCatch(_0xfada('0x105')));}}};Dialer['prototype']['syncAgentConnect']=function(_0x1f3af7){if(this[_0xfada('0x22')][_0x1f3af7[_0xfada('0xac')]]){if(this[_0xfada('0xd6')][_0x1f3af7[_0xfada('0xd7')]]&&this[_0xfada('0xd6')][_0x1f3af7[_0xfada('0xd7')]][_0xfada('0x5a')]!==_0xfada('0x8f')){this[_0xfada('0xaa')](this[_0xfada('0x22')][_0x1f3af7[_0xfada('0xac')]]);this[_0xfada('0xd6')][_0x1f3af7[_0xfada('0xd7')]][_0xfada('0x106')]=moment()[_0xfada('0x75')](_0xfada('0xf2'));}}};Dialer[_0xfada('0x1c')][_0xfada('0x107')]=function(_0x497599){this[_0xfada('0xc1')](_0x497599)[_0xfada('0xa8')](loggerCatch('[syncAgentComplete][createHistory]'));this[_0xfada('0xbf')](_0x497599)[_0xfada('0xa8')](loggerCatch('[syncQueueCallerAbandon]\x20[Drop]'));};Dialer[_0xfada('0x1c')][_0xfada('0x30')]=function(_0x4efc45){var _0x462b21=this[_0xfada('0xd6')][_0x4efc45[_0xfada('0xd7')]];var _0x345c17=this;if(this[_0xfada('0x22')][_0x4efc45[_0xfada('0xac')]]){if(_0x462b21&&_0x462b21[_0xfada('0x5a')]!==_0xfada('0x8f')){delete this[_0xfada('0xd6')][_0x4efc45[_0xfada('0xd7')]];this[_0xfada('0xaa')](this[_0xfada('0x22')][_0x4efc45[_0xfada('0xac')]]);_0x462b21[_0xfada('0x108')]=moment()[_0xfada('0x75')](_0xfada('0xf2'));var _0x9d39bc=new QueueCallerAbandon(_0x462b21,_0x4efc45);if(getSeconds(_0x462b21['droptime'],_0x462b21['responsetime'])>=_0x462b21['dialQueueTimeout']){this[_0xfada('0x22')][_0x4efc45[_0xfada('0xac')]][_0xfada('0x6a')]+=0x1;this[_0xfada('0x22')][_0x4efc45[_0xfada('0xac')]][_0xfada('0x109')]+=0x1;this[_0xfada('0x22')][_0x4efc45[_0xfada('0xac')]][_0xfada('0x6b')]+=0x1;_0x9d39bc[_0xfada('0xde')]=0xa;_0x9d39bc['statedesc']=_0xfada('0x10a');_0x9d39bc[_0xfada('0x10b')]=_0xfada('0x10c');_0x9d39bc['agiafterat']=this['voiceQueues'][_0x4efc45['queue']][_0xfada('0x102')]?moment()[_0xfada('0x75')](_0xfada('0xf2')):undefined;_0x9d39bc['countdropretry']+=0x1;_0x9d39bc[_0xfada('0xe6')]+=0x1;if(_0x9d39bc[_0xfada('0x10d')]>=this['voiceQueues'][_0x4efc45[_0xfada('0xac')]][_0xfada('0x10e')]){this[_0xfada('0x107')](_0x9d39bc);}else{this[_0xfada('0xb7')]({'active':![],'countdropretry':_0x9d39bc[_0xfada('0x10d')],'scheduledat':moment()[_0xfada('0xef')](this[_0xfada('0x22')][_0x4efc45['queue']][_0xfada('0x10f')],_0xfada('0xf1'))[_0xfada('0x75')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x462b21[_0xfada('0xf3')],'ListId':_0x462b21['ListId'],'VoiceQueueId':_0x462b21[_0xfada('0xcc')]||undefined,'CampaignId':_0x462b21[_0xfada('0xcd')]||undefined})['catch'](loggerCatch(_0xfada('0x110')));var _0x1b8537=new History(_0x9d39bc);_0x1b8537[_0xfada('0xde')]=0xa;_0x1b8537[_0xfada('0xdf')]=_0xfada('0x10a');_0x1b8537[_0xfada('0x111')]=moment()[_0xfada('0x75')](_0xfada('0xf2'));_0x1b8537[_0xfada('0xa1')]=_0x1b8537['starttime'];_0x1b8537[_0xfada('0x112')]=_0x9d39bc[_0xfada('0x112')];_0x1b8537[_0xfada('0x113')]=_0x9d39bc['calleridnum'];this[_0xfada('0xc1')](_0x1b8537)[_0xfada('0xa8')](loggerCatch(_0xfada('0x114')));}}else{this[_0xfada('0x22')][_0x4efc45[_0xfada('0xac')]][_0xfada('0x7e')]+=0x1;this[_0xfada('0x22')][_0x4efc45[_0xfada('0xac')]]['outboundDropCallsDayCallersExit']+=0x1;_0x9d39bc[_0xfada('0xde')]=0xb;_0x9d39bc[_0xfada('0xdf')]=_0xfada('0x115');_0x9d39bc[_0xfada('0x10b')]='CALLEREXIT';_0x9d39bc[_0xfada('0x116')]+=0x1;_0x9d39bc[_0xfada('0xe6')]+=0x1;if(_0x9d39bc[_0xfada('0x116')]>=this[_0xfada('0x22')][_0x4efc45[_0xfada('0xac')]]['dialAbandonedMaxRetry']){this['queueCallerAbandonCreateState'](_0x9d39bc);}else{this[_0xfada('0xb7')]({'active':![],'countabandonedretry':_0x9d39bc[_0xfada('0x116')],'scheduledat':moment()['add'](this[_0xfada('0x22')][_0x4efc45[_0xfada('0xac')]][_0xfada('0x117')],'minutes')[_0xfada('0x75')](_0xfada('0xf2')),'ContactId':_0x462b21['ContactId'],'ListId':_0x462b21['ListId'],'VoiceQueueId':_0x462b21[_0xfada('0xcc')]||undefined,'CampaignId':_0x462b21[_0xfada('0xcd')]||undefined})['catch'](loggerCatch('[rescheduleContact][Abandoned]'));var _0x1b8537=new History(_0x9d39bc);_0x1b8537[_0xfada('0xde')]=0xb;_0x1b8537['statedesc']='Abandoned';_0x1b8537[_0xfada('0x111')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x1b8537[_0xfada('0xa1')]=_0x1b8537[_0xfada('0x111')];_0x1b8537['calleridname']=_0x9d39bc[_0xfada('0x112')];_0x1b8537[_0xfada('0x113')]=_0x9d39bc[_0xfada('0x113')];this[_0xfada('0xc1')](_0x1b8537)[_0xfada('0xa8')](loggerCatch(_0xfada('0x118')));}}}}};Dialer[_0xfada('0x1c')][_0xfada('0x37')]=function(_0x367e42){if(this['actions'][_0x367e42[_0xfada('0xd7')]]){this['actions'][_0x367e42['uniqueid']]['channel']=_0x367e42['channel'];}if(this['uniqueId'][_0x367e42[_0xfada('0xd7')]]){this['uniqueId'][_0x367e42[_0xfada('0xd7')]][_0xfada('0xa7')]=_0x367e42[_0xfada('0xa7')];}};Dialer[_0xfada('0x1c')][_0xfada('0x3b')]=function(_0x17794f){if(strategy[this[_0xfada('0x22')][this[_0xfada('0xa4')][_0x17794f[_0xfada('0x119')]][_0xfada('0xac')]]['strategy']]===_0xfada('0x11a')){if(this[_0xfada('0xa4')][_0x17794f[_0xfada('0x119')]]&&_[_0xfada('0xa5')](this['actions'][_0x17794f['actionid']][_0xfada('0x11b')])&&_0x17794f[_0xfada('0xd4')]==='1'&&_0x17794f[_0xfada('0x11c')]==='0'){if(this['agents'][_0x17794f[_0xfada('0x11d')]]){if(!this[_0xfada('0x23')][_0x17794f['stateinterface']][_0xfada('0x11b')]){this['agents'][_0x17794f[_0xfada('0x11d')]][_0xfada('0x11b')]=!![];this[_0xfada('0xa4')][_0x17794f[_0xfada('0x119')]][_0xfada('0x11b')]=!![];this[_0xfada('0xa4')][_0x17794f[_0xfada('0x119')]][_0xfada('0x11d')]=_0x17794f[_0xfada('0x11d')];}}}}else if((strategy[this[_0xfada('0x22')][this[_0xfada('0xa4')][_0x17794f[_0xfada('0x119')]]['queue']][_0xfada('0x52')]]||'rrmemory')===_0xfada('0x1b')){if(this['actions'][_0x17794f[_0xfada('0x119')]]){if(this[_0xfada('0x23')][_0x17794f[_0xfada('0x11d')]]){this[_0xfada('0xa4')][_0x17794f[_0xfada('0x119')]][_0xfada('0x11d')]=_0x17794f[_0xfada('0x11d')];if(_[_0xfada('0xa5')](this[_0xfada('0x11e')][this[_0xfada('0xa4')][_0x17794f['actionid']][_0xfada('0xac')]])){this[_0xfada('0x11e')][this[_0xfada('0xa4')][_0x17794f[_0xfada('0x119')]][_0xfada('0xac')]]=[];}this['queueBooked'][this['actions'][_0x17794f[_0xfada('0x119')]][_0xfada('0xac')]]['push'](_[_0xfada('0x8a')](_[_0xfada('0xc9')](this[_0xfada('0xa4')][_0x17794f[_0xfada('0x119')]],[_0xfada('0x11f'),_0xfada('0x11d')]),{'status':_0x17794f[_0xfada('0xd4')],'paused':_0x17794f[_0xfada('0x11c')]}));}}}};function unlockQueueStatus(_0x4fd34e,_0x11fa65){setTimeout(function(){if(_[_0xfada('0x3f')](_0x4fd34e[_0xfada('0x120')])){loggerBooked[_0xfada('0x92')]('[unlockQueueStatus][undefined]',_0x11fa65);}_0x4fd34e[_0xfada('0x120')]=!![];loggerBooked[_0xfada('0x78')](_0xfada('0x121'),_0x11fa65,JSON['stringify'](_['pick'](_0x4fd34e,[_0xfada('0x42'),_0xfada('0x120')])));},0x1f3);}Dialer[_0xfada('0x1c')]['syncQueueStatusComplete']=function(_0x22ae7b){var _0x3f21d7=this;var _0x3e35c8=_0x3f21d7['voiceQueues'][_0x3f21d7[_0xfada('0xa4')][_0x22ae7b[_0xfada('0x119')]][_0xfada('0xac')]];if(strategy[this[_0xfada('0x22')][this[_0xfada('0xa4')][_0x22ae7b[_0xfada('0x119')]][_0xfada('0xac')]][_0xfada('0x52')]]===_0xfada('0x11a')){if(this[_0xfada('0xa4')][_0x22ae7b[_0xfada('0x119')]]&&this[_0xfada('0xa4')][_0x22ae7b[_0xfada('0x119')]][_0xfada('0x11d')]){this[_0xfada('0x21')][_0xfada('0x122')](this[_0xfada('0xa4')][_0x22ae7b['actionid']][_0xfada('0x11f')],this[_0xfada('0xa4')][_0x22ae7b[_0xfada('0x119')]][_0xfada('0x11d')])[_0xfada('0xa8')](function(_0x327dea){logger['error'](_0xfada('0x123'),util['inspect'](_0x327dea,{'showHidden':![],'depth':null}));})[_0xfada('0x1f')](function(){_0x3f21d7['updateOriginated'](_0x3f21d7['voiceQueues'][_0x3f21d7['actions'][_0x22ae7b['actionid']][_0xfada('0xac')]]);_0x3f21d7[_0xfada('0x23')][_0x3f21d7[_0xfada('0xa4')][_0x22ae7b[_0xfada('0x119')]][_0xfada('0x11d')]][_0xfada('0x11b')]=![];delete _0x3f21d7[_0xfada('0xa4')][_0x22ae7b[_0xfada('0x119')]];unlockQueueStatus(_0x3e35c8);});}else{this['updateOriginated'](this[_0xfada('0x22')][this['actions'][_0x22ae7b[_0xfada('0x119')]]['queue']]);this[_0xfada('0xb7')]({'active':![],'ContactId':this[_0xfada('0xa4')][_0x22ae7b[_0xfada('0x119')]][_0xfada('0xf3')],'ListId':this[_0xfada('0xa4')][_0x22ae7b[_0xfada('0x119')]][_0xfada('0xca')],'VoiceQueueId':this[_0xfada('0xa4')][_0x22ae7b[_0xfada('0x119')]][_0xfada('0xcc')]||undefined,'CampaignId':this[_0xfada('0xa4')][_0x22ae7b[_0xfada('0x119')]]['CampaignId']||undefined})['catch'](loggerCatch(_0xfada('0x124')));delete this[_0xfada('0xa4')][_0x22ae7b[_0xfada('0x119')]];unlockQueueStatus(_0x3e35c8);}}else if((strategy[this['voiceQueues'][this[_0xfada('0xa4')][_0x22ae7b[_0xfada('0x119')]][_0xfada('0xac')]][_0xfada('0x52')]]||'rrmemory')===_0xfada('0x1b')){var _0x3a5e14;if(this[_0xfada('0xa4')][_0x22ae7b['actionid']]&&!_[_0xfada('0x4a')](this[_0xfada('0x11e')][this[_0xfada('0xa4')][_0x22ae7b[_0xfada('0x119')]][_0xfada('0xac')]])){if(this[_0xfada('0x2c')][_0x3f21d7[_0xfada('0xa4')][_0x22ae7b[_0xfada('0x119')]]['queue']]){this[_0xfada('0x2c')][_0x3f21d7[_0xfada('0xa4')][_0x22ae7b['actionid']][_0xfada('0xac')]]=this['queueBookedRR'][this[_0xfada('0xa4')][_0x22ae7b[_0xfada('0x119')]][_0xfada('0xac')]]?this[_0xfada('0x2c')][this[_0xfada('0xa4')][_0x22ae7b['actionid']][_0xfada('0xac')]]:this['queueBooked'][this[_0xfada('0xa4')][_0x22ae7b[_0xfada('0x119')]][_0xfada('0xac')]]?this[_0xfada('0x11e')][this['actions'][_0x22ae7b[_0xfada('0x119')]]['queue']][_0xfada('0x125')]||0x0:0x0;}this[_0xfada('0x11e')][this['actions'][_0x22ae7b['actionid']][_0xfada('0xac')]][_0xfada('0x125')]=this[_0xfada('0x2c')][this[_0xfada('0xa4')][_0x22ae7b[_0xfada('0x119')]]['queue']];for(var _0x28d5a6=0x0;_0x28d5a6=0x0?!![]:![];})[_0xfada('0xa8')](myreject(_0x1b2a04)));}}else{_0x58c9ad[_0xfada('0x13e')](ami['Action']({'action':'command','command':util['format']('iftime\x20%s,%s',_0x576002,!_['isUndefined'](config[_0xfada('0x13a')][_0xed942e])?_0xed942e:'')})[_0xfada('0xb2')](function(_0x1599d9){return _0x1599d9[_0xfada('0x143')]['indexOf'](_0xfada('0x142'))>=0x0?!![]:![];})[_0xfada('0xa8')](myreject(_0x1b2a04)));}BPromise['all'](_0x58c9ad)[_0xfada('0xb2')](function(_0x5d7e3a){var _0x3f439c=_[_0xfada('0x144')](_0x5d7e3a);if(_0x3f439c){return _0x2bd0a9(_0x3f439c);}else{_0x19ce1e[_0xfada('0x40')]=_0x3faadc?_0xfada('0x145'):_0xfada('0x146');return _0x1b2a04(msgResponse(_0xfada('0x147'),'Failure',_0xfada('0x148')+_0x3faadc+'\x20'+_0x54b3e6+'\x20Interval\x20is\x20overtime:\x20'+util[_0xfada('0x93')](_0x576002,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0xed942e));}})[_0xfada('0xa8')](function(_0x141b3b){return _0x1b2a04(msgResponse(_0xfada('0x135'),_0xfada('0x137'),JSON[_0xfada('0x4c')](_0x141b3b)));});});};Dialer[_0xfada('0x1c')][_0xfada('0x149')]=function(_0x15a600){var _0x30e7d6=this;return function(){switch(_0x15a600[_0xfada('0x14a')]){case _0xfada('0x14b'):freeVariablesPredictive(_0x15a600);_0x30e7d6['handlePower'](_0x15a600,0x1);break;case'power':freeVariablesPredictive(_0x15a600);_0x30e7d6['handlePower'](_0x15a600,_0x15a600['dialPowerLevel']);break;case _0xfada('0x14c'):_0x30e7d6[_0xfada('0x14c')](_0x15a600);break;case'booked':freeVariablesPredictive(_0x15a600);_0x30e7d6[_0xfada('0x14d')](_0x15a600,0x1);break;default:freeVariablesPredictive(_0x15a600);logger[_0xfada('0x92')](_0xfada('0x14e'),_0x15a600[_0xfada('0x42')],_0xfada('0x14f'));}};};Dialer['prototype']['launchHandleIvr']=function(_0x3a98ae){var _0x2c1b5b=this;return function(){_0x2c1b5b['handleIvr'](_0x3a98ae);};};Dialer['prototype'][_0xfada('0xb')]=function(_0x243c3b){var _0x32d75d=this;if(isNotPreview(_0x243c3b[_0xfada('0x14a')])){if(isVoiceQueueOutbound(_0x243c3b[_0xfada('0x5a')])&&isActive(_0x243c3b['dialActive'])){_0x243c3b[_0xfada('0x9b')]=!![];BPromise[_0xfada('0xaf')]()['then'](checkIsLoggedIn(_0x243c3b,_0x243c3b[_0xfada('0x150')]))[_0xfada('0xb2')](checkIsActive(_0x243c3b,_0x243c3b[_0xfada('0x151')]))[_0xfada('0xb2')](checkInterval(_0x243c3b))[_0xfada('0xb2')](_0x32d75d[_0xfada('0x152')](_0x243c3b))[_0xfada('0xb2')](_0x32d75d['checkIfTime'](_0x243c3b[_0xfada('0x153')],_0x243c3b[_0xfada('0x154')],_0x243c3b[_0xfada('0x42')],_0x243c3b))[_0xfada('0xb2')](_0x32d75d[_0xfada('0x136')](_0x243c3b[_0xfada('0x46')],_0x243c3b[_0xfada('0x154')],_0x243c3b[_0xfada('0x42')],_0x243c3b))[_0xfada('0xb2')](_0x32d75d[_0xfada('0x149')](_0x243c3b))['catch'](loggerCatchQueueSummary(_0xfada('0x155'),_0x243c3b));}else{notSendMessagesQueue(_0x243c3b);}}else{freeVariablesPredictive(_0x243c3b);}};Dialer[_0xfada('0x1c')][_0xfada('0x130')]=function(){var _0x13b9d1=this;var _0x102c2d;for(var _0xe1fe66 in this[_0xfada('0xad')]){if(this[_0xfada('0xad')]['hasOwnProperty'](_0xe1fe66)){_0x102c2d=this[_0xfada('0xad')][_0xe1fe66];if(isCampaignIvr(_0x102c2d[_0xfada('0x5a')])&&isActive(_0x102c2d[_0xfada('0x73')])){_0x102c2d[_0xfada('0x9b')]=!![];BPromise[_0xfada('0xaf')]()[_0xfada('0xb2')](checkIsActive(_0x102c2d,_0x102c2d['active']))['then'](checkInterval(_0x102c2d))['then'](_0x13b9d1[_0xfada('0x152')](_0x102c2d))['then'](_0x13b9d1[_0xfada('0x134')](_0x102c2d[_0xfada('0x153')],_0x102c2d[_0xfada('0x154')],_0x102c2d['name'],_0x102c2d))[_0xfada('0xb2')](_0x13b9d1[_0xfada('0x136')](_0x102c2d[_0xfada('0x46')],_0x102c2d[_0xfada('0x154')],_0x102c2d[_0xfada('0x42')],_0x102c2d))[_0xfada('0xb2')](_0x13b9d1[_0xfada('0x156')](_0x102c2d))[_0xfada('0xa8')](loggerCatchQueueSummary(_0xfada('0x157'),_0x102c2d));}else{notSendMessagesCampaign(_0x102c2d);}}}};function getCallerIdRandom(_0x3e830c,_0x149b9f){var _0x487be7,_0x1d75de,_0x417db6;if(_0x149b9f<=0x0){_0x149b9f=0x1;}_0x487be7=new RegExp(_0xfada('0x158')+_0x149b9f+'}$');_0x1d75de=Math[_0xfada('0x159')](0xa,_0x149b9f-0x1);_0x417db6=Math[_0xfada('0x159')](0xa,_0x149b9f)-0x1;return util['format']('%s',_[_0xfada('0x15a')](_0x3e830c,_0x487be7,_[_0xfada('0x15b')](_0x1d75de,_0x417db6)));}function extractCalleridName(_0x19ba22){var _0x16baa5=_0x19ba22[_0xfada('0x15c')](/"(.*?)"/);return _0x16baa5?_0x16baa5[0x1]:_0x19ba22;}function extractCalleridNumber(_0x14db9d){var _0x4db4ee=_0x14db9d[_0xfada('0x15c')](/<(.*?)>/);return _0x4db4ee?_0x4db4ee[0x1]:_0x14db9d;}Dialer[_0xfada('0x1c')][_0xfada('0x15d')]=function(_0x45299b,_0x54e01b){var _0x2ab5e2=this;var _0xad9f9b=uuid['v4']();this[_0xfada('0xa4')][_0xad9f9b]=new Action(_0x45299b,_0x54e01b,_0xad9f9b);return new BPromise(function(_0x50f6f8,_0x1f2440){if(_[_0xfada('0x3f')](_0x45299b)&&_0xfada('0x15e')!==typeof _0x45299b){return _0x1f2440(msgResponse('originate','Failure',_0xfada('0x15f')));}if(_[_0xfada('0x3f')](_0x54e01b[_0xfada('0x160')][_0xfada('0x161')])||_0x54e01b['Contact'][_0xfada('0x161')]===null){return _0x1f2440(msgResponse(_0xfada('0x162'),'Failure',_0xfada('0x163')));}var _0x1c73f0={'XMD-CALLERID':_0x2ab5e2[_0xfada('0xa4')][_0xad9f9b]['getCaller'](),'XMD-AGI':_0x45299b['dialQueueProject']?util['format'](_0xfada('0x164'),ipAgi,_0x45299b[_0xfada('0xfc')]):_0xfada('0x165'),'XMD-AGIAFTER':_0x45299b[_0xfada('0x102')]?util[_0xfada('0x75')](_0xfada('0x164'),ipAgi,_0x45299b[_0xfada('0x102')]):_0xfada('0x165'),'XMD-QUEUE':_0x45299b[_0xfada('0x5a')]===_0xfada('0x51')?util['format'](_0xfada('0x166'),_0x45299b[_0xfada('0x42')],_0x45299b[_0xfada('0x167')]||'',_0x45299b[_0xfada('0x103')]?'c':'',_0x45299b[_0xfada('0x168')]||0x3):_0xfada('0x165'),'XMD-CONTACTID':_0x54e01b['ContactId'],'XMD-CDRTYPE':_0xfada('0x7'),'CALLERID(all)':_0x2ab5e2['actions'][_0xad9f9b]['getCaller'](),'XMD-AMD':_0x45299b[_0xfada('0xdb')]?_0xfada('0x169'):_0xfada('0x165'),'XMD-DESTINATION':_0xfada('0x16a')};if(_0x45299b[_0xfada('0xdb')]){_0x1c73f0[_0xfada('0x16b')]=_0x45299b['dialAMDInitialSilence']||0x9c4;_0x1c73f0[_0xfada('0x16c')]=_0x45299b[_0xfada('0x16d')]||0x5dc;_0x1c73f0[_0xfada('0x16e')]=_0x45299b['dialAMDAfterGreetingSilence']||0x320;_0x1c73f0[_0xfada('0x16f')]=_0x45299b[_0xfada('0x170')]||0x1388;_0x1c73f0[_0xfada('0x171')]=_0x45299b[_0xfada('0x172')]||0x64;_0x1c73f0[_0xfada('0x173')]=_0x45299b['dialAMDBetweenWordsSilence']||0x32;_0x1c73f0['XMD-AMDMAXIMUMNUMBEROFWORDS']=_0x45299b[_0xfada('0x174')]||0x3;_0x1c73f0['XMD-AMDSILENCETHRESHOLD']=_0x45299b[_0xfada('0x175')]||0x100;_0x1c73f0[_0xfada('0x176')]=_0x45299b[_0xfada('0x177')]||0x1388;}if(_0x45299b['type']===_0xfada('0x51')){_0x1c73f0[_0xfada('0x178')]=_0x54e01b[_0xfada('0xcc')];}else{_0x1c73f0[_0xfada('0x179')]=_0x54e01b[_0xfada('0xcd')];}for(var _0x509b1b in _0x54e01b[_0xfada('0x160')]){if(_0x54e01b['Contact'][_0xfada('0x95')](_0x509b1b)){if(isNotNull(_0x54e01b[_0xfada('0x160')][_0x509b1b])&&_0x509b1b!=='id'&&_0x509b1b!==_0xfada('0x17a')&&_0x509b1b!=='createdAt'&&_0x509b1b!==_0xfada('0x17b')){_0x1c73f0[util[_0xfada('0x75')](_0xfada('0x17c'),_0xfada('0x17d'),_['toUpper'](_0x509b1b))]=_0x54e01b[_0xfada('0x160')][_0x509b1b];}}}var _0x25777b=_0x2ab5e2['isTrunkReachable'](_0x45299b[_0xfada('0x72')])?getCallerId(_0x45299b[_0xfada('0x72')][_0xfada('0x74')],_0x45299b[_0xfada('0x5d')],_0x45299b[_0xfada('0x17e')]>0x0?getCallerIdRandom(_0x45299b[_0xfada('0x5e')],_0x45299b[_0xfada('0x17e')]):_0x45299b[_0xfada('0x5e')]):getCallerId(_[_0xfada('0xa5')](_0x45299b[_0xfada('0x131')])?_0x45299b['Trunk'][_0xfada('0x74')]:_0x45299b[_0xfada('0x131')][_0xfada('0x74')],_0x45299b['dialOriginateCallerIdName'],_0x45299b['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x45299b[_0xfada('0x5e')],_0x45299b[_0xfada('0x17e')]):_0x45299b[_0xfada('0x5e')]);if(_0x25777b){_0x1c73f0[_0xfada('0x17f')]=_0x2ab5e2[_0xfada('0xa4')][_0xad9f9b][_0xfada('0x180')]=extractCalleridName(_0x25777b);_0x1c73f0[_0xfada('0x181')]=_0x2ab5e2[_0xfada('0xa4')][_0xad9f9b][_0xfada('0x182')]=extractCalleridNumber(_0x25777b);}return ami[_0xfada('0xa6')]({'actionid':_0xad9f9b,'action':_0xfada('0x162'),'channel':_0x2ab5e2[_0xfada('0xd2')](_0x45299b[_0xfada('0x72')])?util[_0xfada('0x75')]('SIP/%s/%s%s',_0x45299b[_0xfada('0x72')][_0xfada('0x42')],isNotNull(_0x45299b[_0xfada('0x5f')])?_0x45299b[_0xfada('0x5f')][_0xfada('0x183')]()||'':'',_0x45299b[_0xfada('0x184')]>0x0?_0x54e01b['Contact'][_0xfada('0x161')][_0xfada('0x185')](_0x45299b['dialCutDigit']):_0x54e01b[_0xfada('0x160')][_0xfada('0x161')]):util[_0xfada('0x75')](_0xfada('0x186'),_[_0xfada('0xa5')](_0x45299b[_0xfada('0x131')])?_0x45299b['Trunk']['name']:_0x45299b['TrunkBackup'][_0xfada('0x42')],isNotNull(_0x45299b[_0xfada('0x5f')])?_0x45299b[_0xfada('0x5f')]['trim']()||'':'',_0x45299b[_0xfada('0x184')]>0x0?_0x54e01b['Contact'][_0xfada('0x161')][_0xfada('0x185')](_0x45299b[_0xfada('0x184')]):_0x54e01b[_0xfada('0x160')][_0xfada('0x161')]),'callerid':_0x25777b,'Exten':_0xfada('0x16a'),'Context':_0xfada('0x187'),'Priority':'1','variable':_0x1c73f0,'timeout':(_0x45299b[_0xfada('0x188')]||0x1e)*0x3e8,'async':!![],'channelid':_0xad9f9b})[_0xfada('0xb2')](function(_0x15327c){return _0x50f6f8(_0x15327c);})['catch'](function(_0x3f37d9){_0x45299b[_0xfada('0x189')]+=0x1;var _0x45c681=new History(_0x2ab5e2[_0xfada('0xa4')][_0xad9f9b]);logger[_0xfada('0x92')](util[_0xfada('0x75')](_0xfada('0x18a'),JSON['stringify'](_0x3f37d9)));_0x45c681[_0xfada('0xde')]=0xe;_0x45c681[_0xfada('0xdf')]=_0xfada('0x18b');_0x45c681[_0xfada('0x111')]=moment()[_0xfada('0x75')](_0xfada('0xf2'));_0x45c681['endtime']=_0x45c681[_0xfada('0x111')];_0x2ab5e2[_0xfada('0xc1')](_0x45c681)[_0xfada('0xa8')](loggerCatch(_0xfada('0x18c')));_0x2ab5e2[_0xfada('0xbf')](_0x45c681)['catch'](loggerCatch('[originate][error]'))['finally'](function(){delete _0x2ab5e2[_0xfada('0xa4')][_0xad9f9b];return _0x1f2440(msgResponse(_0xfada('0x162'),_0xfada('0x4b'),'originate\x20action\x20Error'));});});});};Dialer[_0xfada('0x1c')][_0xfada('0x31')]=function(_0x11a282){var _0x474416=this['actions'][_0x11a282[_0xfada('0x119')]];var _0x35fe2f=this;if(_0x474416){delete this['actions'][_0x11a282[_0xfada('0x119')]];_0x474416['responsetime']=moment()[_0xfada('0x75')](_0xfada('0xf2'));var _0x38a7ef=_0x474416['type']===_0xfada('0x8f')?this[_0xfada('0xad')][_0x474416[_0xfada('0xac')]]:this[_0xfada('0x22')][_0x474416[_0xfada('0x18d')]()];if(!this[_0xfada('0xd0')](_0x11a282[_0xfada('0x18e')])){this['updateOriginated'](_0x38a7ef);return this[_0xfada('0x18f')](_0x474416,_0x38a7ef,_0x11a282)[_0xfada('0xb2')](function(_0x390092){})[_0xfada('0xa8')](loggerCatch(_0xfada('0x190')));}else{this[_0xfada('0xd6')][_0x11a282['uniqueid']]=_0x474416;}}};Dialer[_0xfada('0x1c')][_0xfada('0x191')]=function(_0x558335,_0x27adba,_0x205e9){var _0x1ecd90=new History(_0x27adba);if(_0x1ecd90['countbusyretry']+_0x1ecd90[_0xfada('0xe8')]+_0x1ecd90[_0xfada('0x192')]+_0x1ecd90[_0xfada('0xe9')]+_0x1ecd90[_0xfada('0x10d')]+_0x1ecd90[_0xfada('0x116')]+_0x1ecd90[_0xfada('0xe5')]+_0x1ecd90[_0xfada('0xea')]>=_0x205e9[_0xfada('0xeb')]-0x1){return!![];}switch(_0x558335){case 0x3:if(_0x1ecd90[_0xfada('0x192')]>=_0x205e9[_0xfada('0x193')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countnoanswerretry':_0x1ecd90[_0xfada('0x192')]+=0x1,'scheduledat':moment()[_0xfada('0xef')](_0x205e9['dialNoAnswerRetryFrequency'],_0xfada('0xf1'))[_0xfada('0x75')](_0xfada('0xf2')),'ContactId':_0x1ecd90[_0xfada('0xf3')],'ListId':_0x1ecd90[_0xfada('0xca')],'VoiceQueueId':_0x1ecd90[_0xfada('0xcc')]||undefined,'CampaignId':_0x1ecd90[_0xfada('0xcd')]||undefined})[_0xfada('0xa8')](loggerCatch('[rescheduleContact][NoAnswer]'));}break;case 0x5:if(_0x1ecd90[_0xfada('0xe7')]>=_0x205e9[_0xfada('0x194')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countbusyretry':_0x1ecd90[_0xfada('0xe7')]+=0x1,'scheduledat':moment()[_0xfada('0xef')](_0x205e9['dialBusyRetryFrequency'],'minutes')[_0xfada('0x75')](_0xfada('0xf2')),'ContactId':_0x1ecd90['ContactId'],'ListId':_0x1ecd90['ListId'],'VoiceQueueId':_0x1ecd90['VoiceQueueId']||undefined,'CampaignId':_0x1ecd90[_0xfada('0xcd')]||undefined})[_0xfada('0xa8')](loggerCatch(_0xfada('0x195')));}break;case 0x8:if(_0x1ecd90[_0xfada('0xe8')]>=_0x205e9[_0xfada('0x196')]-0x1){return!![];}else{this[_0xfada('0xb7')]({'active':![],'countcongestionretry':_0x1ecd90[_0xfada('0xe8')]+=0x1,'scheduledat':moment()['add'](_0x205e9[_0xfada('0x197')],'minutes')['format'](_0xfada('0xf2')),'ContactId':_0x1ecd90['ContactId'],'ListId':_0x1ecd90[_0xfada('0xca')],'VoiceQueueId':_0x1ecd90[_0xfada('0xcc')]||undefined,'CampaignId':_0x1ecd90['CampaignId']||undefined})['catch'](loggerCatch(_0xfada('0x198')));}break;case 0x0:if(_0x1ecd90[_0xfada('0xe9')]>=_0x205e9[_0xfada('0x199')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countnosuchnumberretry':_0x1ecd90[_0xfada('0xe9')]+=0x1,'scheduledat':moment()[_0xfada('0xef')](_0x205e9['dialNoSuchNumberRetryFrequency'],'minutes')[_0xfada('0x75')](_0xfada('0xf2')),'ContactId':_0x1ecd90[_0xfada('0xf3')],'ListId':_0x1ecd90[_0xfada('0xca')],'VoiceQueueId':_0x1ecd90['VoiceQueueId']||undefined,'CampaignId':_0x1ecd90['CampaignId']||undefined})[_0xfada('0xa8')](loggerCatch(_0xfada('0x19a')));}break;case 0xa:if(_0x1ecd90[_0xfada('0x10d')]>=_0x205e9['dialDropMaxRetry']-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countdropretry':_0x1ecd90[_0xfada('0x10d')]+=0x1,'scheduledat':moment()['add'](_0x205e9[_0xfada('0x10f')],_0xfada('0xf1'))[_0xfada('0x75')](_0xfada('0xf2')),'ContactId':_0x1ecd90[_0xfada('0xf3')],'ListId':_0x1ecd90[_0xfada('0xca')],'VoiceQueueId':_0x1ecd90[_0xfada('0xcc')]||undefined,'CampaignId':_0x1ecd90['CampaignId']||undefined})['catch'](loggerCatch(_0xfada('0x110')));}break;case 0xb:if(_0x1ecd90[_0xfada('0x116')]>=_0x205e9[_0xfada('0x19b')]-0x1){return!![];}else{this[_0xfada('0xb7')]({'active':![],'countabandonedretry':_0x1ecd90['countabandonedretry']+=0x1,'scheduledat':moment()[_0xfada('0xef')](_0x205e9[_0xfada('0x117')],_0xfada('0xf1'))[_0xfada('0x75')](_0xfada('0xf2')),'ContactId':_0x1ecd90[_0xfada('0xf3')],'ListId':_0x1ecd90[_0xfada('0xca')],'VoiceQueueId':_0x1ecd90[_0xfada('0xcc')]||undefined,'CampaignId':_0x1ecd90[_0xfada('0xcd')]||undefined})['catch'](loggerCatch('[rescheduleContact][Abandoned]'));}break;case 0x13:if(_0x1ecd90[_0xfada('0xe5')]>=_0x205e9['dialMachineMaxRetry']-0x1){return!![];}else{this[_0xfada('0xb7')]({'active':![],'countmachineretry':_0x1ecd90[_0xfada('0xe5')]+=0x1,'scheduledat':moment()[_0xfada('0xef')](_0x205e9['dialMachineRetryFrequency'],_0xfada('0xf1'))[_0xfada('0x75')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1ecd90['ContactId'],'ListId':_0x1ecd90[_0xfada('0xca')],'VoiceQueueId':_0x1ecd90[_0xfada('0xcc')]||undefined,'CampaignId':_0x1ecd90[_0xfada('0xcd')]||undefined})[_0xfada('0xa8')](loggerCatch('[rescheduleContact][Machine]'));}break;case 0x14:if(_0x1ecd90[_0xfada('0xea')]>=_0x205e9[_0xfada('0x19c')]-0x1){return!![];}else{this[_0xfada('0xb7')]({'active':![],'countagentrejectretry':_0x1ecd90['countagentrejectretry']+=0x1,'scheduledat':moment()['add'](_0x205e9[_0xfada('0x19d')],_0xfada('0xf1'))[_0xfada('0x75')](_0xfada('0xf2')),'ContactId':_0x1ecd90[_0xfada('0xf3')],'ListId':_0x1ecd90[_0xfada('0xca')],'VoiceQueueId':_0x1ecd90[_0xfada('0xcc')]||undefined,'CampaignId':_0x1ecd90[_0xfada('0xcd')]||undefined})[_0xfada('0xa8')](loggerCatch(_0xfada('0x19e')));}break;default:return!![];}};Dialer[_0xfada('0x1c')][_0xfada('0x18f')]=function(_0x3dc347,_0x4801aa,_0x325571){var _0x29e6f6=this;var _0x4e67ca=new History(_0x3dc347);return new BPromise(function(_0x5c652e,_0x5455e6){if(_[_0xfada('0x3f')](_0x4801aa)&&_0xfada('0x15e')!==typeof _0x4801aa){return _0x5455e6(msgResponse(_0xfada('0x19f'),_0xfada('0x137'),'entity\x20is\x20undefine'));}if(_['isUndefined'](_0x325571)&&_0xfada('0x15e')!==typeof _0x325571){return _0x5455e6(msgResponse(_0xfada('0x19f'),_0xfada('0x137'),_0xfada('0x1a0')));}switch(_0x325571[_0xfada('0xff')]){case'0':_0x4801aa[_0xfada('0x1a1')]+=0x1;_0x4e67ca[_0xfada('0xde')]=0x0;_0x4e67ca['statedesc']='NoSuchNumber';_0x4e67ca['countnosuchnumberretry']+=0x1;_0x4e67ca[_0xfada('0xe6')]+=0x1;ami[_0xfada('0x50')](_0xfada('0x1a2'),ut[_0xfada('0x1a3')](_0x3dc347,_0xfada('0x1a4')));_0x29e6f6[_0xfada('0xc1')](_0x4e67ca)[_0xfada('0xa8')](loggerCatch(_0xfada('0xf7')));if(_0x29e6f6['checkRetriveMax'](0x0,_0x3dc347,_0x4801aa)){if(_0x4e67ca['countnosuchnumberretry']>=_0x4801aa[_0xfada('0x199')]){_0x29e6f6['createStateFinal'](_0x4e67ca,_0x5c652e,_0x5455e6,_0xfada('0x1a5'));}else{_0x29e6f6['stateGlobal'](_0x4e67ca,_0x5c652e,_0x5455e6,_0xfada('0x1a5'));}}break;case'3':_0x4801aa[_0xfada('0x1a6')]+=0x1;_0x4e67ca[_0xfada('0xde')]=0x3;_0x4e67ca[_0xfada('0xdf')]='NoAnswer';_0x4e67ca[_0xfada('0x192')]+=0x1;_0x4e67ca[_0xfada('0xe6')]+=0x1;ami[_0xfada('0x50')](_0xfada('0x1a7'),ut[_0xfada('0x1a3')](_0x3dc347,_0xfada('0x1a8')));_0x29e6f6[_0xfada('0xc1')](_0x4e67ca)['catch'](loggerCatch(_0xfada('0x1a9')));if(_0x29e6f6[_0xfada('0x191')](0x3,_0x3dc347,_0x4801aa)){if(_0x4e67ca[_0xfada('0x192')]>=_0x4801aa[_0xfada('0x193')]){_0x29e6f6[_0xfada('0xed')](_0x4e67ca,_0x5c652e,_0x5455e6,_0xfada('0x1aa'));}else{_0x29e6f6[_0xfada('0x1ab')](_0x4e67ca,_0x5c652e,_0x5455e6,'reason\x203\x20ringing\x20no\x20answer');}}break;case'5':_0x4801aa[_0xfada('0x1ac')]+=0x1;_0x4e67ca[_0xfada('0xde')]=0x5;_0x4e67ca['statedesc']=_0xfada('0x1ad');_0x4e67ca[_0xfada('0xe7')]+=0x1;_0x4e67ca[_0xfada('0xe6')]+=0x1;ami[_0xfada('0x50')]('custom:agentbusy',ut[_0xfada('0x1a3')](_0x3dc347,_0xfada('0x1ae')));_0x29e6f6[_0xfada('0xc1')](_0x4e67ca)[_0xfada('0xa8')](loggerCatch(_0xfada('0x1af')));if(_0x29e6f6[_0xfada('0x191')](0x5,_0x3dc347,_0x4801aa)){if(_0x4e67ca[_0xfada('0xe7')]>=_0x4801aa[_0xfada('0x194')]){_0x29e6f6[_0xfada('0xed')](_0x4e67ca,_0x5c652e,_0x5455e6,_0xfada('0x1b0'));}else{_0x29e6f6[_0xfada('0x1ab')](_0x4e67ca,_0x5c652e,_0x5455e6,'reason\x205\x20busy');}}break;case'8':_0x4801aa[_0xfada('0x63')]+=0x1;_0x4e67ca[_0xfada('0xde')]=0x8;_0x4e67ca[_0xfada('0xdf')]='Congestion';_0x4e67ca[_0xfada('0xe8')]+=0x1;_0x4e67ca[_0xfada('0xe6')]+=0x1;ami[_0xfada('0x50')]('custom:agentcongestion',ut[_0xfada('0x1a3')](_0x3dc347,_0xfada('0x1b1')));_0x29e6f6[_0xfada('0xc1')](_0x4e67ca)[_0xfada('0xa8')](loggerCatch(_0xfada('0x1b2')));if(_0x29e6f6['checkRetriveMax'](0x8,_0x3dc347,_0x4801aa)){if(_0x4e67ca[_0xfada('0xe8')]>=_0x4801aa['dialCongestionMaxRetry']){_0x29e6f6[_0xfada('0xed')](_0x4e67ca,_0x5c652e,_0x5455e6,_0xfada('0x1b3'));}else{_0x29e6f6[_0xfada('0x1ab')](_0x4e67ca,_0x5c652e,_0x5455e6,_0xfada('0x1b3'));}}break;case'11':_0x4801aa[_0xfada('0x1b4')]+=0x1;_0x4e67ca[_0xfada('0xde')]=0xb;_0x4e67ca[_0xfada('0xdf')]=_0xfada('0x115');_0x4e67ca[_0xfada('0x116')]+=0x1;_0x4e67ca['countglobal']+=0x1;_0x29e6f6[_0xfada('0xc1')](_0x4e67ca)[_0xfada('0xa8')](loggerCatch('[syncAgentComplete][createHistory][11]'));if(_0x29e6f6[_0xfada('0x191')](0xb,_0x3dc347,_0x4801aa)){if(_0x4e67ca[_0xfada('0x116')]>=_0x4801aa[_0xfada('0x19b')]){_0x29e6f6[_0xfada('0xed')](_0x4e67ca,_0x5c652e,_0x5455e6,_0xfada('0x1b5'));}else{_0x29e6f6[_0xfada('0x1ab')](_0x4e67ca,_0x5c652e,_0x5455e6,_0xfada('0x1b5'));}}break;case'20':_0x4801aa['outboundRejectCallsDay']+=0x1;_0x4e67ca['state']=0x14;_0x4e67ca[_0xfada('0xdf')]=_0xfada('0x1b6');_0x4e67ca['countagentrejectretry']+=0x1;_0x4e67ca[_0xfada('0xe6')]+=0x1;ami[_0xfada('0x50')](_0xfada('0x1b7'),ut['buildObj'](_0x3dc347,_0xfada('0x1b8')));_0x29e6f6[_0xfada('0xc1')](_0x4e67ca)[_0xfada('0xa8')](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0x29e6f6[_0xfada('0x191')](0x14,_0x3dc347,_0x4801aa)){if(_0x4e67ca[_0xfada('0xea')]>=_0x4801aa['dialAgentRejectMaxRetry']){_0x29e6f6[_0xfada('0xed')](_0x4e67ca,_0x5c652e,_0x5455e6,_0xfada('0x1b9'));}else{_0x29e6f6['stateGlobal'](_0x4e67ca,_0x5c652e,_0x5455e6,_0xfada('0x1b9'));}}break;default:_0x4801aa[_0xfada('0x67')]+=0x1;_0x4e67ca[_0xfada('0xde')]=0xc;_0x4e67ca['statedesc']=_0x325571[_0xfada('0xff')];_0x29e6f6[_0xfada('0xc1')](_0x4e67ca)[_0xfada('0xa8')](loggerCatch('[syncAgentComplete][createHistory][?]'));if(_0x29e6f6[_0xfada('0x191')](_0x325571['reason'],_0x3dc347,_0x4801aa)){if(_0x4e67ca[_0xfada('0xe7')]+_0x4e67ca[_0xfada('0xe8')]+_0x4e67ca['countnoanswerretry']+_0x4e67ca[_0xfada('0xe9')]+_0x4e67ca[_0xfada('0x10d')]+_0x4e67ca[_0xfada('0x116')]+_0x4e67ca[_0xfada('0xe5')]+_0x4e67ca['countagentrejectretry']>=_0x4801aa[_0xfada('0xeb')]){_0x29e6f6[_0xfada('0x1ab')](_0x4e67ca,_0x5c652e,_0x5455e6,_0x325571['reason']);}else{_0x29e6f6['createStateFinal'](_0x4e67ca,_0x5c652e,_0x5455e6,_0x325571[_0xfada('0xff')]);}}}});};Dialer[_0xfada('0x1c')][_0xfada('0x1ab')]=function(_0x152e08,_0x253cc7,_0x446777,_0x2cb6e1){var _0x5497c9=new Final(_0x152e08);_0x5497c9[_0xfada('0xde')]=0xf;_0x5497c9['statedesc']='Global';this[_0xfada('0xed')](_0x5497c9,_0x253cc7,_0x446777,_0x2cb6e1);};Dialer[_0xfada('0x1c')][_0xfada('0xed')]=function(_0x20d137,_0x50fcbb,_0x3d711c,_0x19d66a){this[_0xfada('0xbf')](_0x20d137)['then'](function(_0x4d3768){return _0x50fcbb(msgResponse('[callProgressDetecting]',_0xfada('0xd1'),_0x19d66a));})[_0xfada('0xa8')](function(_0x4b8dbe){return _0x3d711c(msgResponse(_0xfada('0x1ba'),_0xfada('0x137'),'contact\x20not\x20moved'));});};Dialer[_0xfada('0x1c')]['predictive']=function(_0x1af043){var _0x49a446=this;var _0x3ed35b=_0x1af043[_0xfada('0x1bb')]/0x64;var _0x3d2603=_0x1af043[_0xfada('0x109')]/(_0x1af043[_0xfada('0x109')]+_0x1af043[_0xfada('0x61')]);var _0x435ee8=Math['round'](_0x1af043['predictiveIntervalAvailable']*(_0x1af043[_0xfada('0x1bc')]/0x64));var _0xe65776=Math[_0xfada('0x1bd')](_0x1af043[_0xfada('0x6e')]*(_0x1af043[_0xfada('0x1be')]/0x64));var _0x1ad19a=_0x1af043['available']+_0x1af043[_0xfada('0x58')];var _0x3da380=Math[_0xfada('0x1bf')](_0x1af043[_0xfada('0x70')]*_0x1af043['erlangAbandonmentRate']*_0x1af043[_0xfada('0x6c')]*_0x1af043['predictiveIntervalMultiplicativeFactor']);if(_[_0xfada('0x3f')](_0x1af043[_0xfada('0x2a')])){if(!_[_0xfada('0x3f')](_0x1af043[_0xfada('0x29')])){_0x1af043[_0xfada('0x29')]=undefined;loggerPredictive[_0xfada('0x92')](_0xfada('0x1c0'),_0xfada('0x1c1'));}if(!_[_0xfada('0x3f')](_0x1af043[_0xfada('0x8d')])){loggerPredictive['error'](_0xfada('0x1c0'),'check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0x1af043['handlePredictive']);_0x1af043[_0xfada('0x8d')]=undefined;}_0x1af043[_0xfada('0x2a')]=moment()[_0xfada('0x75')](_0xfada('0xf2'));loggerPredictive['info'](_0x1af043[_0xfada('0x42')],_0xfada('0x1c2'),_0x1af043[_0xfada('0x2a')]);this['handlePower'](_0x1af043,0x1);}else if(ifInterval(_0x1af043['dialPredictiveInterval'],_0x1af043['startProgressive'])){this[_0xfada('0x14d')](_0x1af043,0x1);loggerPredictiveCalls[_0xfada('0x78')](_0xfada('0x1c3'),_0x1af043['startProgressive'],_0x1af043[_0xfada('0x42')]);_0x1af043['erlangCalls']=0x0;_0x1af043[_0xfada('0x6b')]=0x0;}else if(_0x3ed35b<_0x3d2603&&_0x1af043[_0xfada('0x1c4')]===_0xfada('0x1c5')){freeVariablesPredictive(_0x1af043);loggerPredictive[_0xfada('0x78')](_0xfada('0x1c6'),_0xfada('0x1c7'),_0x3d2603,'startProgressive',_0x1af043[_0xfada('0x42')]);}else if(_0x3da380<_0x1af043['predictiveIntervalErlangCallsDroppedCalls']&&_0x1af043[_0xfada('0x1c4')]===_0xfada('0x1c5')){freeVariablesPredictive(_0x1af043);loggerPredictive['info'](_0xfada('0x1c8'),_0xfada('0x1c9'),_0x3da380,_0xfada('0x1ca'),_0x1af043[_0xfada('0x6b')],'startProgressive',_0x1af043[_0xfada('0x42')]);}else if(!ifInterval(_0x1af043[_0xfada('0x1cb')],_0x1af043['startProgressive'])&&_[_0xfada('0x3f')](_0x1af043[_0xfada('0x29')])&&!_[_0xfada('0x3f')](_0x1af043[_0xfada('0x2a')])){_0x1af043[_0xfada('0x29')]=moment()[_0xfada('0x75')](_0xfada('0xf2'));loggerPredictive[_0xfada('0x78')](_0x1af043[_0xfada('0x42')],_0xfada('0x1cc'),_0x1af043[_0xfada('0x29')]);this[_0xfada('0x1cd')](_0x1af043[_0xfada('0x1cb')])[_0xfada('0xb2')](this[_0xfada('0x1ce')](_0x1af043))[_0xfada('0xb2')](mergeDataErlangB(_0x1af043))[_0xfada('0xb2')](this[_0xfada('0x1cf')](_0x1af043))['catch'](loggerCatchPredictive('Predictive\x20after\x20first\x20interval',_0x1af043));}else if(!ifInterval(_0x1af043['dialPredictiveInterval'],_0x1af043[_0xfada('0x29')])){_0x1af043[_0xfada('0x6b')]=0x0;_0x1af043['startPredictive']=moment()[_0xfada('0x75')](_0xfada('0xf2'));loggerPredictive[_0xfada('0x78')](_0x1af043[_0xfada('0x42')],_0xfada('0x1d0'),_0x1af043[_0xfada('0x29')]);clearInterval(_0x1af043[_0xfada('0x8d')]);_0x1af043[_0xfada('0x8d')]=undefined;this[_0xfada('0x1cd')](_0x1af043[_0xfada('0x1cb')])['then'](this[_0xfada('0x1ce')](_0x1af043))[_0xfada('0xb2')](mergeDataErlangB(_0x1af043))[_0xfada('0xb2')](this['startMethodPredictive'](_0x1af043))['catch'](loggerCatchPredictive(_0xfada('0x1d1'),_0x1af043));}else if(_0x1af043['predictiveIntervalAvailable']&&_0x1ad19a<_0x1af043[_0xfada('0x6e')]-_0xe65776){freeVariablesPredictive(_0x1af043);loggerPredictive['info'](_0x1af043['name'],_0xfada('0x1d2'),_0x1ad19a,_0xfada('0x1d3'),_0x1af043[_0xfada('0x6e')],'-',_0xe65776,'=',_0x1af043[_0xfada('0x6e')]-_0xe65776,')');}else if(_0x1af043[_0xfada('0x6e')]&&_0x1ad19a>_0x1af043['predictiveIntervalAvailable']+_0x435ee8){freeVariablesPredictive(_0x1af043);loggerPredictive[_0xfada('0x78')](_0x1af043['name'],_0xfada('0x1d2'),_0x1ad19a,_0xfada('0x1d4'),_0x1af043[_0xfada('0x6e')],'+',_0x435ee8,'=',_0x1af043[_0xfada('0x6e')]+_0x435ee8,')');}};Dialer[_0xfada('0x1c')][_0xfada('0x1ce')]=function(_0x41fbfb){var _0x2229b8=this;return function(_0x5cc06f){return new BPromise(function(_0x331d79,_0x4497b5){_[_0xfada('0x8a')](_0x41fbfb,_0x5cc06f[0x0]);if(checkGetDataPredictive(_0x5cc06f[0x0])){var _0x5bf35b=_0x41fbfb[_0xfada('0x6e')]=_0x41fbfb[_0xfada('0x58')]+_0x41fbfb['available'];var _0x2e0bb2=_0x41fbfb[_0xfada('0x1cb')]*0x3c;var _0x5d6cab=_0x5cc06f[0x0][_0xfada('0x69')]+_0x5cc06f[0x0][_0xfada('0x68')];var _0x59e332=(_0x5cc06f[0x0][_0xfada('0x7c')]+_0x5cc06f[0x0][_0xfada('0x6a')]+_0x5cc06f[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x5cc06f[0x0]['predictiveIntervalTotalCalls'];_0x41fbfb[_0xfada('0x6c')]=_0x59e332>0x0?_0x59e332:0x1;switch(_0x41fbfb[_0xfada('0x1c4')]){case _0xfada('0x1c5'):var _0x4c6391=_0x41fbfb[_0xfada('0x1bb')]/0x64;return _0x2229b8[_0xfada('0x1d5')](_0x5bf35b,_0x2e0bb2,_0x5d6cab,_0x59e332,_0x4c6391)[_0xfada('0xb2')](function(_0x93ecef){return _0x331d79(_0x93ecef);});case'agentBusyFactor':var _0x4b12c1=_0x41fbfb[_0xfada('0x1bb')]/0x64;return _0x2229b8[_0xfada('0x1d6')](_0x5bf35b,_0x2e0bb2,_0x5d6cab,_0x59e332,_0x4b12c1)['then'](function(_0x258abe){return _0x331d79(_0x258abe);});default:return _0x4497b5(msgResponse(_0xfada('0x1d7'),_0xfada('0x137'),_0xfada('0x1d8')));}}else{return _0x4497b5(msgResponse(_0xfada('0x1d7'),_0xfada('0x137'),_0xfada('0x1d9')));}});};};Dialer['prototype'][_0xfada('0x1da')]=function(_0x17c956){var _0x3e809d=this;return function(_0x5e77de){return new BPromise(function(_0x2c8bf1,_0x55c0a4){_['merge'](_0x17c956,_0x5e77de[0x0]);if(checkGetDataPredictive(_0x5e77de[0x0])){loggerPredictive[_0xfada('0x78')](JSON['stringify'](_0x5e77de[0x0]));if(_0x17c956[_0xfada('0x1c4')]===_0xfada('0x1c5')){return _0x3e809d[_0xfada('0xbe')](_0x17c956['id'])[_0xfada('0xb2')](function(_0x4040a0){var _0x14b32b=_0x17c956['loggedIn']-_0x4040a0[0x0]['outboundQueuePauses'];var _0x163666=_0x17c956[_0xfada('0x1cb')]*0x3c;var _0x78ef40=_0x5e77de[0x0]['predictiveIntervalAvgTalktime']+_0x5e77de[0x0][_0xfada('0x68')];var _0xc7bcb5=(_0x5e77de[0x0][_0xfada('0x7c')]+_0x5e77de[0x0][_0xfada('0x6a')]+_0x5e77de[0x0][_0xfada('0x7e')])/_0x5e77de[0x0][_0xfada('0x6f')];var _0x423aca=_0x17c956[_0xfada('0x1bb')]/0x64;_0x17c956[_0xfada('0x6d')]=_0x4040a0[0x0]['outboundQueuePauses']||0x0;_0x17c956[_0xfada('0x6c')]=_0xc7bcb5>0x0?_0xc7bcb5:0x1;return _0x3e809d['abandonmentRate'](_0x14b32b,_0x163666,_0x78ef40,_0xc7bcb5,_0x423aca);})['then'](function(_0xe0cd2d){return _0x2c8bf1(_0xe0cd2d);})[_0xfada('0xa8')](function(_0x476fe7){return _0x55c0a4(msgResponse(_0xfada('0x1db'),_0xfada('0x137'),JSON['stringify'](_0x476fe7)));});}if(_0x17c956[_0xfada('0x1c4')]===_0xfada('0x1dc')){return _0x3e809d[_0xfada('0xbe')](_0x17c956['id'])[_0xfada('0xb2')](function(_0x376b29){var _0x202faf=_0x17c956[_0xfada('0x150')]-_0x376b29[0x0][_0xfada('0x1dd')];var _0x2188d5=_0x17c956['dialPredictiveInterval']*0x3c;var _0x2dd4fe=_0x5e77de[0x0][_0xfada('0x69')]+_0x5e77de[0x0][_0xfada('0x68')];var _0x572c78=(_0x5e77de[0x0][_0xfada('0x7c')]+_0x5e77de[0x0][_0xfada('0x6a')]+_0x5e77de[0x0][_0xfada('0x7e')])/_0x5e77de[0x0]['predictiveIntervalTotalCalls'];var _0x2aae94=_0x17c956[_0xfada('0x1bb')]/0x64;_0x17c956['predictiveIntervalPauses']=_0x376b29[0x0]['outboundQueuePauses']||0x0;_0x17c956[_0xfada('0x6c')]=_0x572c78>0x0?_0x572c78:0x1;return _0x3e809d[_0xfada('0x1d6')](_0x202faf,_0x2188d5,_0x2dd4fe,_0x572c78,_0x2aae94);})[_0xfada('0xb2')](function(_0x212309){return _0x2c8bf1(_0x212309);})[_0xfada('0xa8')](function(_0xfb4dae){return _0x55c0a4(msgResponse('[CatchErlangB]',_0xfada('0x137'),JSON[_0xfada('0x4c')](_0xfb4dae)));});}}else{return _0x55c0a4(msgResponse(_0xfada('0x1d7'),_0xfada('0x137'),_0xfada('0x1d9')));}});};};Dialer[_0xfada('0x1c')][_0xfada('0x1cf')]=function(_0x4951a1){var _0x171dfd=this;return function(){var _0x161321=0x0;var _0x4a8bd1=Math[_0xfada('0x1bf')](_0x4951a1[_0xfada('0x71')]*0x3e8);if(_0x4a8bd1>0x0){_0x4a8bd1=_0x4a8bd1<0x64?0x64:_0x4a8bd1;loggerPredictive[_0xfada('0x78')](_0x4951a1['name'],_0xfada('0x1de'),_0x4a8bd1,_0xfada('0x4d'));_0x4951a1[_0xfada('0x8d')]=setInterval(function(){_0x171dfd[_0xfada('0x8d')](_0x4951a1);loggerPredictiveCalls[_0xfada('0x78')](_0xfada('0x1df'),_0x161321+=0x1);},_0x4a8bd1);}else{loggerPredictive[_0xfada('0x78')](_0x4951a1[_0xfada('0x42')],'fail\x20to\x20scheduled\x20calls');}};};Dialer[_0xfada('0x1c')][_0xfada('0x1e0')]=function(_0x10c4d8,_0x272fdb){var _0x3aec37=this;return function(_0x17433d){if(_[_0xfada('0x4a')](_0x17433d)){if(_['isNil'](_0x272fdb[_0xfada('0xcb')])||!_0x272fdb[_0xfada('0x1e1')]){if(_0x10c4d8[_0xfada('0x14a')]===_0xfada('0x9')){_0x10c4d8[_0xfada('0x120')]=_[_0xfada('0x3f')](_0x10c4d8[_0xfada('0x120')])?!![]:_0x10c4d8[_0xfada('0x120')];var _0x4a6126=uuid['v4']();_0x3aec37[_0xfada('0xa4')][_0x4a6126]=new Action(_0x10c4d8,_0x272fdb,_0x4a6126);loggerBooked[_0xfada('0x78')]('[booked][checkContactBlack]',_0x4a6126,'queueStatusComplete:\x20',JSON[_0xfada('0x4c')](_0x10c4d8[_0xfada('0x120')]),_0xfada('0x1e2'),_0x10c4d8['name']);if(_0x10c4d8[_0xfada('0x120')]){_0x10c4d8['queueStatusComplete']=![];_0x3aec37['queueBooked'][_0x3aec37['actions'][_0x4a6126][_0xfada('0xac')]]=[];ami[_0xfada('0xa6')]({'actionid':_0x4a6126,'action':_0xfada('0x1e3'),'queue':_0x10c4d8['name']})['catch'](function(_0x70282f){_0x3aec37[_0xfada('0xaa')](_0x10c4d8);_0x3aec37[_0xfada('0xb7')]({'active':![],'ContactId':_0x3aec37[_0xfada('0xa4')][_0x4a6126][_0xfada('0xf3')],'ListId':_0x3aec37[_0xfada('0xa4')][_0x4a6126][_0xfada('0xca')],'VoiceQueueId':_0x3aec37[_0xfada('0xa4')][_0x4a6126]['VoiceQueueId']||undefined,'CampaignId':_0x3aec37[_0xfada('0xa4')][_0x4a6126]['CampaignId']||undefined})['catch'](loggerCatch(_0xfada('0x1e4')));delete _0x3aec37[_0xfada('0xa4')][_0x4a6126];});}else{loggerBooked['info']('[booked][checkContactBlack][else]',JSON[_0xfada('0x4c')](_0x10c4d8[_0xfada('0x120')]),_0xfada('0x1e2'),_0x10c4d8['name']);_0x3aec37[_0xfada('0xaa')](_0x10c4d8);_0x3aec37[_0xfada('0xb7')]({'active':![],'ContactId':_0x3aec37[_0xfada('0xa4')][_0x4a6126]['ContactId'],'ListId':_0x3aec37['actions'][_0x4a6126][_0xfada('0xca')],'VoiceQueueId':_0x3aec37[_0xfada('0xa4')][_0x4a6126][_0xfada('0xcc')]||undefined,'CampaignId':_0x3aec37[_0xfada('0xa4')][_0x4a6126][_0xfada('0xcd')]||undefined})[_0xfada('0xa8')](loggerCatch(_0xfada('0x1e4')));delete _0x3aec37[_0xfada('0xa4')][_0x4a6126];}}else{return _0x3aec37[_0xfada('0x15d')](_0x10c4d8,_0x272fdb);}}else{if(getDiff(_0x272fdb[_0xfada('0x1e5')])<_0x10c4d8[_0xfada('0x1e6')]*0x3c){if(_0x272fdb[_0xfada('0x1e7')]&&!_0x272fdb[_0xfada('0x1e7')][_0xfada('0x1e8')]){_0x3aec37['preview'][_0xfada('0x122')](_0x272fdb['id'])['finally'](function(){_0x3aec37['updateOriginated'](_0x10c4d8);});}else{_0x3aec37['unlockContact']({'active':![]},_0x272fdb['id'],0x1)['finally'](function(){console[_0xfada('0x1e9')](_0xfada('0x1ea'));_0x3aec37[_0xfada('0xaa')](_0x10c4d8);});}}else{_0x10c4d8['outboundReCallsDay']+=0x1;_0x3aec37['updateOriginated'](_0x10c4d8);if(_0x10c4d8[_0xfada('0x1eb')]){_0x3aec37[_0xfada('0xb7')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x272fdb[_0xfada('0xf3')],'ListId':_0x272fdb[_0xfada('0xca')],'VoiceQueueId':_0x272fdb[_0xfada('0xcc')]||undefined,'CampaignId':_0x272fdb[_0xfada('0xcd')]||undefined})['catch'](loggerCatch(_0xfada('0x1ec')));_0x3aec37[_0xfada('0xc1')](createObjHistory(_0x10c4d8,_0x272fdb,'RECALLINQUEUE',0x17,_0xfada('0x1ed')))[_0xfada('0xa8')](loggerCatch(_0xfada('0x1ee')));}else{_0x3aec37[_0xfada('0xc8')](createObjHistory(_0x10c4d8,_0x272fdb,_0xfada('0x1ef'),0x16,'RecallFailedTimeout'),'[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]');}}}}else{_0x10c4d8['outboundBlacklistCallsDay']+=0x1;_0x3aec37[_0xfada('0xc8')](createObjHistory(_0x10c4d8,_0x272fdb,_0xfada('0x1f0'),0xd,'Blacklist'),_0xfada('0x1f1'),_0xfada('0x1f2'));throw _0xfada('0x1f3');}};};Dialer['prototype'][_0xfada('0x1f4')]=function(_0x10c23f){var _0x1fb6e2=this;var _0x3dd5ac=[];var _0x422599=_0x10c23f['limitCalls']-_0x10c23f['originated']-_0x10c23f[_0xfada('0x1f5')];emitCampaignSummary(_0x10c23f);if(_0x422599>0x0){if(_0x422599>this['maxNumberOriginate']){_0x422599=this[_0xfada('0x25')];}_0x10c23f[_0xfada('0x1f5')]+=_0x422599;this[_0xfada('0xbd')](_0x10c23f['id'],_0x422599,_0x10c23f['dialOrderByScheduledAt'])[_0xfada('0xb2')](function(_0x5d1a33){_0x10c23f[_0xfada('0x1f5')]-=_0x422599;_0x10c23f[_0xfada('0x1f5')]=_0x10c23f[_0xfada('0x1f5')]>0x0?_0x10c23f[_0xfada('0x1f5')]:0x0;if(!checkContactEmpty(_0x5d1a33)){_0x10c23f['message']=_0xfada('0x1f6');logger[_0xfada('0x78')](_0xfada('0x1f7')+_0x10c23f['name']);}else{_0x10c23f['originated']+=_0x5d1a33[_0xfada('0x94')];_0x10c23f['message']='RUNNING';for(var _0x2525e4=0x0;_0x2525e4<_0x5d1a33['length'];_0x2525e4+=0x1){_0x10c23f[_0xfada('0x1f8')]+=0x1;if(_[_0xfada('0xa5')](_0x5d1a33[_0x2525e4])||_[_0xfada('0xa5')](_0x5d1a33[_0x2525e4][_0xfada('0x160')])||_[_0xfada('0xa5')](_0x5d1a33[_0x2525e4][_0xfada('0x160')][_0xfada('0x161')])){_0x1fb6e2[_0xfada('0xc6')](_0xfada('0x1f9'),_0x10c23f,_0x5d1a33[_0x2525e4]);}else{_0x1fb6e2['checkIsBlackListIvr'](_[_0xfada('0xc9')](_0x5d1a33[_0x2525e4],['CampaignId',_0xfada('0x1fa')]))[_0xfada('0xb2')](_0x1fb6e2[_0xfada('0x1e0')](_0x10c23f,_0x5d1a33[_0x2525e4]))[_0xfada('0xa8')](_0x1fb6e2[_0xfada('0xc5')](_0xfada('0x1fb'),_0x10c23f));}}}})[_0xfada('0xa8')](loggerGetContactDialer('[getContactCampaign2]',_0x10c23f,_0x422599));}};Dialer[_0xfada('0x1c')][_0xfada('0x14d')]=function(_0x876f97,_0x21c39c){var _0x4f27ea=this;var _0x43a5e2=[];var _0x16ecee=_0x21c39c>=0x1?_0x21c39c:0x1;var _0x16c730=[];if(_0x876f97[_0xfada('0x14a')]==='booked'){_0x16ecee=0x1;}var _0x2d17fb=Math['floor'](_0x876f97[_0xfada('0x54')]*_0x16ecee)-_0x876f97[_0xfada('0x96')]-_0x876f97[_0xfada('0x1f5')];emitVoiceQueueSummary(_0x876f97);if(_0x876f97[_0xfada('0x1fc')]>0x0){var _0x1b3922=_0x876f97[_0xfada('0x1fc')]-_0x876f97[_0xfada('0x96')]-_0x876f97[_0xfada('0x58')]-_0x876f97[_0xfada('0x1f5')]-_0x876f97['pTalking'];if(_0x2d17fb>_0x1b3922){_0x2d17fb=_0x1b3922;}}if(_0x2d17fb>0x0){if(_0x876f97[_0xfada('0x14a')]===_0xfada('0x9')){_0x2d17fb=0x1;}if(_0x2d17fb>this[_0xfada('0x25')]){_0x2d17fb=this['maxNumberOriginate'];}_0x876f97['temp']+=_0x2d17fb;for(var _0x5a69f4 in this['agents']){if(this[_0xfada('0x23')][_0xfada('0x95')](_0x5a69f4)){if(this['agents'][_0x5a69f4][_0xfada('0xde')]==='not_inuse'&&this[_0xfada('0x23')][_0x5a69f4]['status']===_0xfada('0xd5')){_0x43a5e2[_0xfada('0x13e')](this[_0xfada('0x23')][_0x5a69f4]['id']);}}}this['getContactDialer'](_0x876f97['id'],_0x43a5e2,_0x2d17fb,_0x876f97[_0xfada('0x1fd')])[_0xfada('0xb2')](function(_0x1f147b){_0x876f97[_0xfada('0x1f5')]-=_0x2d17fb;_0x876f97['temp']=_0x876f97[_0xfada('0x1f5')]>0x0?_0x876f97[_0xfada('0x1f5')]:0x0;if(!checkContactEmpty(_0x1f147b)){_0x4f27ea[_0xfada('0xae')](_0x876f97)[_0xfada('0xb2')](sendMessageReschedule(_0x876f97))[_0xfada('0xa8')](loggerCatch(_0xfada('0xb0')));}else{_0x876f97[_0xfada('0x96')]+=_0x1f147b['length'];_0x876f97[_0xfada('0x40')]=_0x876f97['dialMethod']===_0xfada('0x9')?'ACTIVE':'RUNNING';for(var _0x212a7a=0x0;_0x212a7a<_0x1f147b[_0xfada('0x94')];_0x212a7a+=0x1){if(_['isNil'](_0x1f147b[_0x212a7a])||_['isNil'](_0x1f147b[_0x212a7a]['Contact'])||_[_0xfada('0xa5')](_0x1f147b[_0x212a7a][_0xfada('0x160')][_0xfada('0x161')])){_0x4f27ea[_0xfada('0xc6')](_0xfada('0x1f9'),_0x876f97,_0x1f147b[_0x212a7a]);}else{_0x4f27ea['checkIsBlackList'](_[_0xfada('0xc9')](_0x1f147b[_0x212a7a],[_0xfada('0xcc'),'Contact.phone']))['then'](_0x4f27ea['checkContactBlack'](_0x876f97,_0x1f147b[_0x212a7a]))[_0xfada('0xa8')](_0x4f27ea[_0xfada('0xc5')]('[actionOriginate]\x20',_0x876f97));}}}})[_0xfada('0xa8')](loggerGetContactDialer(_0xfada('0x1fe'),_0x876f97,_0x2d17fb));}};Dialer[_0xfada('0x1c')][_0xfada('0x8d')]=function(_0x2cd1ea){var _0x1f76ac=this;if(_0x2cd1ea[_0xfada('0x1fc')]>0x0){var _0x217ad5=_0x2cd1ea[_0xfada('0x1fc')]-_0x2cd1ea[_0xfada('0x96')]-_0x2cd1ea[_0xfada('0x58')];if(_0x217ad5>0x0){this[_0xfada('0x1ff')](_0x2cd1ea);}else{loggerPredictiveCalls[_0xfada('0x78')]('[handlePredictive][limitChannel]');}}else{this['tryOriginatePredictive'](_0x2cd1ea);}};Dialer['prototype']['tryOriginatePredictive']=function(_0x1ce996){var _0x5f5d1c=this;var _0x1e1a21=[];_0x1ce996[_0xfada('0x96')]+=0x1;for(var _0x2ba7dc in this[_0xfada('0x23')]){if(this[_0xfada('0x23')]['hasOwnProperty'](_0x2ba7dc)){if(this[_0xfada('0x23')][_0x2ba7dc][_0xfada('0xde')]===_0xfada('0x200')&&this['agents'][_0x2ba7dc][_0xfada('0xd4')]===_0xfada('0xd5')){_0x1e1a21['push'](this[_0xfada('0x23')][_0x2ba7dc]['id']);}}}this[_0xfada('0xbb')](_0x1ce996['id'],_0x1e1a21,0x1,_0x1ce996['dialOrderByScheduledAt'])['then'](function(_0x2b5028){if(!checkContactEmpty(_0x2b5028)){checkContactLowerLimitOriginate(_0x1ce996,0x1,0x0);_0x5f5d1c[_0xfada('0xae')](_0x1ce996)[_0xfada('0xb2')](sendMessageReschedule(_0x1ce996))[_0xfada('0xa8')](loggerCatch(_0xfada('0xb0')));}else{_0x1ce996[_0xfada('0x40')]='RUNNING';if(_[_0xfada('0xa5')](_0x2b5028[0x0])||_[_0xfada('0xa5')](_0x2b5028[0x0]['Contact'])||_[_0xfada('0xa5')](_0x2b5028[0x0][_0xfada('0x160')][_0xfada('0x161')])){_0x5f5d1c[_0xfada('0xc6')](_0xfada('0x1f9'),_0x1ce996,_0x2b5028[0x0]);}else{_0x5f5d1c[_0xfada('0xb1')](_[_0xfada('0xc9')](_0x2b5028[0x0],['VoiceQueueId','Contact.phone']))['then'](_0x5f5d1c[_0xfada('0x1e0')](_0x1ce996,_0x2b5028[0x0]))[_0xfada('0xa8')](_0x5f5d1c[_0xfada('0xc5')](_0xfada('0x201'),_0x1ce996));}}})[_0xfada('0xa8')](loggerGetContactDialer(_0xfada('0x202'),_0x1ce996,0x1));emitVoiceQueueSummary(_0x1ce996);};Dialer[_0xfada('0x1c')][_0xfada('0x1d5')]=function(_0x2ceba7,_0xbe7546,_0x417a20,_0x4e08d5,_0x4ca07f,_0x2ac7c5){loggerPredictive['info'](_0xfada('0x203'));loggerPredictive[_0xfada('0x78')](_0xfada('0x204'),_0x2ceba7);loggerPredictive[_0xfada('0x78')](_0xfada('0x205'),_0xbe7546);loggerPredictive[_0xfada('0x78')](_0xfada('0x206'),_0x417a20);loggerPredictive[_0xfada('0x78')]('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',_0x4e08d5);loggerPredictive[_0xfada('0x78')](_0xfada('0x207'),_0x4ca07f);loggerPredictive[_0xfada('0x78')]('---------------------------');return new BPromise(function(_0x13c98d,_0xbd614b){if(_0x2ceba7<=0x0||isNaN(_0x2ceba7)){return _0xbd614b(msgResponse(_0xfada('0x208'),_0xfada('0x4b'),'m\x20=\x20'+_0x2ceba7));}if(_0x417a20<=0x0||isNaN(_0x417a20)){return _0xbd614b(msgResponse(_0xfada('0x208'),'Error',_0xfada('0x209')+_0x417a20));}if(_0x4e08d5<=0x0||isNaN(_0x4e08d5)){return _0xbd614b(msgResponse(_0xfada('0x208'),'Error','p\x20=\x20'+_0x4e08d5));}if(_0xbe7546<=0x0||isNaN(_0xbe7546)){return _0xbd614b(msgResponse(_0xfada('0x208'),_0xfada('0x4b'),_0xfada('0x20a')+_0xbe7546));}if(_0x4ca07f<=0x0||isNaN(_0x4ca07f)){return _0xbd614b(msgResponse(_0xfada('0x208'),_0xfada('0x4b'),_0xfada('0x20b')+_0x4ca07f));}_0x2ac7c5=_0x2ac7c5||0x0;var _0x5bd4ef=0x1/_0x417a20;var _0x281126=0x0;var _0x38e465=0x0;var _0xcdb511=0x0;var _0x1b2f39=0x0;for(var _0x52004b=0x0;_0xcdb511<_0x4ca07f;_0x52004b+=0x1){_0x38e465=_0x52004b/_0xbe7546;_0x281126=(_0x4e08d5*_0x38e465+_0x2ac7c5)/_0x5bd4ef;_0xcdb511=erlangb(_0x281126,_0x2ceba7);_0x1b2f39=_0x281126/_0x2ceba7*(0x1-erlangb(_0x281126,_0x2ceba7));}return _0x13c98d({'erlangCalls':_0x52004b,'erlangCallToSecond':_0xbe7546/_0x52004b,'erlangAbandonmentRate':_0xcdb511,'erlangBusyFactor':_0x1b2f39});});};Dialer[_0xfada('0x1c')][_0xfada('0x1d6')]=function(_0x2a9772,_0x560bb8,_0x53b3e2,_0x167e5b,_0x468b94,_0x5e8d22){loggerPredictive[_0xfada('0x78')]('----\x20Agent\x20Busy\x20Factor\x20----');loggerPredictive[_0xfada('0x78')](_0xfada('0x204'),_0x2a9772);loggerPredictive[_0xfada('0x78')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x560bb8);loggerPredictive[_0xfada('0x78')](_0xfada('0x206'),_0x53b3e2);loggerPredictive[_0xfada('0x78')]('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',_0x167e5b);loggerPredictive[_0xfada('0x78')](_0xfada('0x20c'),_0x468b94);loggerPredictive[_0xfada('0x78')]('---------------------------');return new BPromise(function(_0xc49c56,_0x3973b3){if(_0x2a9772<=0x0||isNaN(_0x2a9772)){return _0x3973b3(msgResponse('[busyFactor]',_0xfada('0x4b'),_0xfada('0x20d')+_0x2a9772));}if(_0x53b3e2<=0x0||isNaN(_0x53b3e2)){return _0x3973b3(msgResponse('[busyFactor]',_0xfada('0x4b'),_0xfada('0x209')+_0x53b3e2));}if(_0x167e5b<=0x0||isNaN(_0x167e5b)){return _0x3973b3(msgResponse(_0xfada('0x20e'),'Error',_0xfada('0x20f')+_0x167e5b));}if(_0x560bb8<=0x0||isNaN(_0x560bb8)){return _0x3973b3(msgResponse('[busyFactor]',_0xfada('0x4b'),_0xfada('0x20a')+_0x560bb8));}if(_0x468b94<=0x0||isNaN(_0x468b94)){return _0x3973b3(msgResponse(_0xfada('0x20e'),_0xfada('0x4b'),_0xfada('0x210')+_0x468b94));}_0x5e8d22=_0x5e8d22||0x0;var _0x226409=0x1/_0x53b3e2;var _0x5df8e3=0x0;var _0x16258a=0x0;var _0x3e6193=0x0;var _0x1193ad=0x0;for(var _0x8ebd38=0x0;_0x1193ad<_0x468b94;_0x8ebd38+=0x1){_0x16258a=_0x8ebd38/_0x560bb8;_0x5df8e3=(_0x167e5b*_0x16258a+_0x5e8d22)/_0x226409;_0x3e6193=erlangb(_0x5df8e3,_0x2a9772);_0x1193ad=_0x5df8e3/_0x2a9772*(0x1-erlangb(_0x5df8e3,_0x2a9772));}return _0xc49c56({'erlangCalls':_0x8ebd38,'erlangCallToSecond':_0x560bb8/_0x8ebd38,'erlangAbandonmentRate':_0x3e6193,'erlangBusyFactor':_0x1193ad});});};module[_0xfada('0x211')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index bb40f61..9eb6700 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 _0x6416=['number','starttime','responsetime','droptime','talktime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','exports','util','lodash','moment','milliseconds','diff','seconds','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','uniqueid','name','calleridnum'];(function(_0x3afb47,_0x54bee0){var _0xe566d2=function(_0x214891){while(--_0x214891){_0x3afb47['push'](_0x3afb47['shift']());}};_0xe566d2(++_0x54bee0);}(_0x6416,0x171));var _0x6641=function(_0xbd77c1,_0x50b969){_0xbd77c1=_0xbd77c1-0x0;var _0x47fa83=_0x6416[_0xbd77c1];return _0x47fa83;};'use strict';var util=require(_0x6641('0x0'));var _=require(_0x6641('0x1'));var moment=require(_0x6641('0x2'));function getSeconds(_0x147231,_0x178052){var _0x560a63=moment(_0x147231)[_0x6641('0x3')](0x0);var _0x4c9421=moment(_0x178052)[_0x6641('0x3')](0x0);return _0x560a63[_0x6641('0x4')](_0x4c9421,_0x6641('0x5'));}function QueueCallerAbandon(_0x1c8db4,_0x274b59){this[_0x6641('0x6')]=_0x1c8db4['scheduledat'];this[_0x6641('0x7')]=_0x1c8db4['type'];this['campaigntype']=_0x1c8db4[_0x6641('0x7')]===_0x6641('0x8')?_0x6641('0x9'):_0x1c8db4[_0x6641('0x7')];this[_0x6641('0xa')]=_0x1c8db4[_0x6641('0xa')];this[_0x6641('0xb')]=_0x1c8db4['countcongestionretry'];this['countnoanswerretry']=_0x1c8db4[_0x6641('0xc')];this['countglobal']=_0x1c8db4[_0x6641('0xa')]+_0x1c8db4['countcongestionretry']+_0x1c8db4['countnoanswerretry']+_0x1c8db4['countnosuchnumberretry']+_0x1c8db4[_0x6641('0xd')]+_0x1c8db4[_0x6641('0xe')]+_0x1c8db4[_0x6641('0xf')]+_0x1c8db4[_0x6641('0x10')];this[_0x6641('0x11')]=_0x1c8db4['countnosuchnumberretry'];this[_0x6641('0xd')]=_0x1c8db4[_0x6641('0xd')];this[_0x6641('0xe')]=_0x1c8db4[_0x6641('0xe')];this['countmachineretry']=_0x1c8db4[_0x6641('0xf')];this[_0x6641('0x10')]=_0x1c8db4[_0x6641('0x10')];this[_0x6641('0x12')]=_0x274b59[_0x6641('0x12')];this['calleridname']=_0x1c8db4[_0x6641('0x13')];this[_0x6641('0x14')]=_0x1c8db4[_0x6641('0x15')];this[_0x6641('0x16')]=_0x1c8db4[_0x6641('0x16')];this['responsetime']=_0x1c8db4[_0x6641('0x17')];this[_0x6641('0x18')]=_0x1c8db4[_0x6641('0x18')];this['endtime']=this['droptime'];this['ringtime']=getSeconds(_0x1c8db4[_0x6641('0x17')],_0x1c8db4[_0x6641('0x16')]);this['holdtime']=getSeconds(this[_0x6641('0x18')],_0x1c8db4['responsetime']);this[_0x6641('0x19')]=0x0;this[_0x6641('0x9')]=_0x274b59[_0x6641('0x9')];this[_0x6641('0x1a')]=_0x274b59[_0x6641('0x1b')];this[_0x6641('0x1c')]=_0x274b59[_0x6641('0x1c')];this[_0x6641('0x1d')]=_0x1c8db4[_0x6641('0x1d')];this[_0x6641('0x1e')]=_0x1c8db4[_0x6641('0x1e')];this['callbackat']=_0x1c8db4[_0x6641('0x1f')];this['recallme']=_0x1c8db4['recallme'];this[_0x6641('0x20')]=_0x1c8db4[_0x6641('0x20')];this[_0x6641('0x21')]=_0x1c8db4[_0x6641('0x21')];this[_0x6641('0x22')]=_0x1c8db4[_0x6641('0x22')];this['VoiceQueueId']=_0x1c8db4[_0x6641('0x23')];this[_0x6641('0x24')]=_0x1c8db4[_0x6641('0x24')];this['originatecalleridnum']=_0x1c8db4[_0x6641('0x25')]||'';this['originatecalleridname']=_0x1c8db4['originatecalleridname']||'';}module[_0x6641('0x26')]=QueueCallerAbandon; \ No newline at end of file +var _0x46b6=['lodash','milliseconds','diff','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','droptime','holdtime','talktime','callback','callbackuniqueid','callbackat','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util'];(function(_0xbc971c,_0x1e7e40){var _0x1cc41f=function(_0x25f496){while(--_0x25f496){_0xbc971c['push'](_0xbc971c['shift']());}};_0x1cc41f(++_0x1e7e40);}(_0x46b6,0x155));var _0x646b=function(_0x184dca,_0x114417){_0x184dca=_0x184dca-0x0;var _0x1584cb=_0x46b6[_0x184dca];return _0x1584cb;};'use strict';var util=require(_0x646b('0x0'));var _=require(_0x646b('0x1'));var moment=require('moment');function getSeconds(_0x146fe3,_0x5c0f40){var _0x5c2329=moment(_0x146fe3)['milliseconds'](0x0);var _0x51e4d6=moment(_0x5c0f40)[_0x646b('0x2')](0x0);return _0x5c2329[_0x646b('0x3')](_0x51e4d6,'seconds');}function QueueCallerAbandon(_0x2319e0,_0x262b13){this[_0x646b('0x4')]=_0x2319e0[_0x646b('0x4')];this[_0x646b('0x5')]=_0x2319e0[_0x646b('0x5')];this[_0x646b('0x6')]=_0x2319e0[_0x646b('0x5')]===_0x646b('0x7')?_0x646b('0x8'):_0x2319e0[_0x646b('0x5')];this[_0x646b('0x9')]=_0x2319e0['countbusyretry'];this[_0x646b('0xa')]=_0x2319e0[_0x646b('0xa')];this[_0x646b('0xb')]=_0x2319e0[_0x646b('0xb')];this['countglobal']=_0x2319e0[_0x646b('0x9')]+_0x2319e0[_0x646b('0xa')]+_0x2319e0[_0x646b('0xb')]+_0x2319e0[_0x646b('0xc')]+_0x2319e0[_0x646b('0xd')]+_0x2319e0[_0x646b('0xe')]+_0x2319e0[_0x646b('0xf')]+_0x2319e0['countagentrejectretry'];this[_0x646b('0xc')]=_0x2319e0[_0x646b('0xc')];this[_0x646b('0xd')]=_0x2319e0[_0x646b('0xd')];this[_0x646b('0xe')]=_0x2319e0[_0x646b('0xe')];this[_0x646b('0xf')]=_0x2319e0[_0x646b('0xf')];this[_0x646b('0x10')]=_0x2319e0[_0x646b('0x10')];this[_0x646b('0x11')]=_0x262b13[_0x646b('0x11')];this[_0x646b('0x12')]=_0x2319e0[_0x646b('0x13')];this[_0x646b('0x14')]=_0x2319e0[_0x646b('0x15')];this['starttime']=_0x2319e0[_0x646b('0x16')];this[_0x646b('0x17')]=_0x2319e0[_0x646b('0x17')];this[_0x646b('0x18')]=_0x2319e0[_0x646b('0x18')];this['endtime']=this['droptime'];this['ringtime']=getSeconds(_0x2319e0[_0x646b('0x17')],_0x2319e0[_0x646b('0x16')]);this[_0x646b('0x19')]=getSeconds(this[_0x646b('0x18')],_0x2319e0[_0x646b('0x17')]);this[_0x646b('0x1a')]=0x0;this[_0x646b('0x8')]=_0x262b13[_0x646b('0x8')];this['membername']=_0x262b13['connectedlinename'];this['reason']=_0x262b13['reason'];this[_0x646b('0x1b')]=_0x2319e0[_0x646b('0x1b')];this[_0x646b('0x1c')]=_0x2319e0['callbackuniqueid'];this['callbackat']=_0x2319e0[_0x646b('0x1d')];this['recallme']=_0x2319e0['recallme'];this['ContactId']=_0x2319e0[_0x646b('0x1e')];this[_0x646b('0x1f')]=_0x2319e0[_0x646b('0x1f')];this['UserId']=_0x2319e0[_0x646b('0x20')];this[_0x646b('0x21')]=_0x2319e0[_0x646b('0x21')];this[_0x646b('0x22')]=_0x2319e0[_0x646b('0x22')];this[_0x646b('0x23')]=_0x2319e0['originatecalleridnum']||'';this[_0x646b('0x24')]=_0x2319e0[_0x646b('0x24')]||'';}module[_0x646b('0x25')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 6a61b8d..2c1c5c8 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 _0xa404=['moment','channel','%s/%s/%s','Trunk','name','fax','localstationid','headerinfo','path','exports','util','lodash'];(function(_0x580f74,_0x4e1022){var _0x14fc97=function(_0xf4807d){while(--_0xf4807d){_0x580f74['push'](_0x580f74['shift']());}};_0x14fc97(++_0x4e1022);}(_0xa404,0x1c6));var _0x4a40=function(_0x29549e,_0x32e837){_0x29549e=_0x29549e-0x0;var _0x3df3dd=_0xa404[_0x29549e];return _0x3df3dd;};'use strict';var util=require(_0x4a40('0x0'));var _=require(_0x4a40('0x1'));var moment=require(_0x4a40('0x2'));function Action(_0x54e969,_0x189bef,_0x40d45a){this['uniqueid']=_0x54e969||undefined;this[_0x4a40('0x3')]=util['format'](_0x4a40('0x4'),_0x189bef['tech'],_0x189bef[_0x4a40('0x5')][_0x4a40('0x6')],_0x40d45a[_0x4a40('0x7')]);this[_0x4a40('0x8')]=_0x189bef['localstationid'];this[_0x4a40('0x9')]=_0x189bef[_0x4a40('0x9')];this['path']=_0x40d45a[_0x4a40('0xa')];this['AttachmentId']=_0x40d45a['AttachmentId'];}module[_0x4a40('0xb')]=Action; \ No newline at end of file +var _0xc5f2=['moment','uniqueid','format','%s/%s/%s','tech','name','localstationid','headerinfo','path','AttachmentId','exports','util','lodash'];(function(_0x40a397,_0x37afac){var _0x35fc14=function(_0x153328){while(--_0x153328){_0x40a397['push'](_0x40a397['shift']());}};_0x35fc14(++_0x37afac);}(_0xc5f2,0x129));var _0x2c5f=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xc5f2[_0x42cae2];return _0x5f256f;};'use strict';var util=require(_0x2c5f('0x0'));var _=require(_0x2c5f('0x1'));var moment=require(_0x2c5f('0x2'));function Action(_0x50fe5b,_0xf07fb5,_0x17e1e1){this[_0x2c5f('0x3')]=_0x50fe5b||undefined;this['channel']=util[_0x2c5f('0x4')](_0x2c5f('0x5'),_0xf07fb5[_0x2c5f('0x6')],_0xf07fb5['Trunk'][_0x2c5f('0x7')],_0x17e1e1['fax']);this[_0x2c5f('0x8')]=_0xf07fb5[_0x2c5f('0x8')];this[_0x2c5f('0x9')]=_0xf07fb5[_0x2c5f('0x9')];this[_0x2c5f('0xa')]=_0x17e1e1[_0x2c5f('0xa')];this[_0x2c5f('0xb')]=_0x17e1e1[_0x2c5f('0xb')];}module[_0x2c5f('0xc')]=Action; \ No newline at end of file diff --git a/server/services/ami/fax/index.js b/server/services/ami/fax/index.js index c758e38..957ab74 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 _0xfb44=['[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','faxstatus','faxstatusstring','SENDING\x20FAILED','send','[Fax][execOriginate][success]','Fax\x20failed','checkAfterSend','checkTrunk','FaxAccountId','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','%s/%s.tif','dir','XMF-PATH','Action','variablesAction','ext','isTrunkReachable','isNil','active','SIP/%s','trunks','reachable','[Fax][checkTrunk][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','util','uuid','moment','path','tiff2pdf','../../../config/logger','fax','../ami','./rpcDb','./channel','./util/util','../rpc/attachment','../rpc/faxMessage','actions','newchannel','syncNewchannel','bind','varset','syncVarSet','newstate','syncNewState','newexten','syncNewExten','receivefax','syncHangup','prototype','context','from-voip-provider','faxAccounts','hasOwnProperty','exten','localstationid','channels','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','value','channelstate','channelstatedesc','syncFaxStatus','operation','status','filename','\x20syncFaxStatus\x20','syncReceiveFax','remotestationid','pagestransferred','resolution','calleridnum','/var/opt/motion2/server/files/attachments/','message','create','parse','.pdf','application/pdf','then','notify','catch','error','\x20receiveFax\x20','stringify','syncOriginateResponse','merge','pick','response','AttachmentId','update','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][NoUpdate1]'];(function(_0x44dcf4,_0x3de9ff){var _0x4c3ed8=function(_0x40d5fa){while(--_0x40d5fa){_0x44dcf4['push'](_0x44dcf4['shift']());}};_0x4c3ed8(++_0x3de9ff);}(_0xfb44,0x97));var _0x4fb4=function(_0x1064a9,_0x381d94){_0x1064a9=_0x1064a9-0x0;var _0x48f198=_0xfb44[_0x1064a9];return _0x48f198;};'use strict';var util=require(_0x4fb4('0x0'));var _=require('lodash');var BPromise=require('bluebird');var uuid=require(_0x4fb4('0x1'));var moment=require(_0x4fb4('0x2'));var path=require(_0x4fb4('0x3'));var tiff2pdf=require(_0x4fb4('0x4'));var gs=require('./util/gs');var logger=require(_0x4fb4('0x5'))(_0x4fb4('0x6'));var ami=require(_0x4fb4('0x7'));var rpcDb=require(_0x4fb4('0x8'));var Channel=require(_0x4fb4('0x9'));var ut=require(_0x4fb4('0xa'));var Action=require('./action');var faxAccount=require('../rpc/faxAccount');var attachment=require(_0x4fb4('0xb'));var faxMessage=require(_0x4fb4('0xc'));function Fax(_0x385094){this['channels']={};this['faxAccounts']=_0x385094['faxAccounts'];this['trunks']=_0x385094['trunks'];this[_0x4fb4('0xd')]={};ami['on'](_0x4fb4('0xe'),this[_0x4fb4('0xf')][_0x4fb4('0x10')](this));ami['on'](_0x4fb4('0x11'),this[_0x4fb4('0x12')]['bind'](this));ami['on'](_0x4fb4('0x13'),this[_0x4fb4('0x14')][_0x4fb4('0x10')](this));ami['on'](_0x4fb4('0x15'),this[_0x4fb4('0x16')][_0x4fb4('0x10')](this));ami['on']('faxstatus',this['syncFaxStatus'][_0x4fb4('0x10')](this));ami['on'](_0x4fb4('0x17'),this['syncReceiveFax'][_0x4fb4('0x10')](this));ami['on']('hangup',this[_0x4fb4('0x18')][_0x4fb4('0x10')](this));ami['on']('originateresponse',this['syncOriginateResponse'][_0x4fb4('0x10')](this));}Fax[_0x4fb4('0x19')][_0x4fb4('0xf')]=function(_0xaaa78){if(_0xaaa78[_0x4fb4('0x1a')]===_0x4fb4('0x1b')){for(var _0x10f0f2 in this[_0x4fb4('0x1c')]){if(this['faxAccounts'][_0x4fb4('0x1d')](_0x10f0f2)){if(_0xaaa78[_0x4fb4('0x1e')]===this[_0x4fb4('0x1c')][_0x10f0f2][_0x4fb4('0x1f')]){this[_0x4fb4('0x20')][_0xaaa78['uniqueid']]={};this[_0x4fb4('0x20')][_0xaaa78[_0x4fb4('0x21')]][_0x4fb4('0x22')]=_0xaaa78[_0x4fb4('0x22')];this[_0x4fb4('0x20')][_0xaaa78[_0x4fb4('0x21')]]['id']=this[_0x4fb4('0x1c')][_0x10f0f2]['id'];this[_0x4fb4('0x20')][_0xaaa78[_0x4fb4('0x21')]][_0x4fb4('0x23')]=this[_0x4fb4('0x1c')][_0x10f0f2]['name'];logger[_0x4fb4('0x24')](_0xaaa78['uniqueid'],_0x4fb4('0x25'));}}}}if(this[_0x4fb4('0xd')][_0xaaa78[_0x4fb4('0x21')]]){this['channels'][_0xaaa78[_0x4fb4('0x21')]]={};this[_0x4fb4('0x20')][_0xaaa78[_0x4fb4('0x21')]]['channel']=_0xaaa78['channel'];logger[_0x4fb4('0x24')](_0xaaa78[_0x4fb4('0x21')],_0x4fb4('0x25'));}};Fax[_0x4fb4('0x19')][_0x4fb4('0x12')]=function(_0x132d86){if(this['channels'][_0x132d86[_0x4fb4('0x21')]]){for(var _0x808dd8 in _0x132d86[_0x4fb4('0x26')]){if(_0x132d86[_0x4fb4('0x26')][_0x4fb4('0x1d')](_0x808dd8)){this[_0x4fb4('0x20')][_0x132d86[_0x4fb4('0x21')]][_0x808dd8]=_0x132d86[_0x4fb4('0x27')];}}}};Fax[_0x4fb4('0x19')]['syncNewState']=function(_0x2e9bae){if(this[_0x4fb4('0x20')][_0x2e9bae[_0x4fb4('0x21')]]){this['channels'][_0x2e9bae[_0x4fb4('0x21')]]['channelstate']=_0x2e9bae[_0x4fb4('0x28')];this[_0x4fb4('0x20')][_0x2e9bae['uniqueid']][_0x4fb4('0x29')]=_0x2e9bae['channelstatedesc'];}};Fax[_0x4fb4('0x19')][_0x4fb4('0x16')]=function(_0x81e92d){if(this['channels'][_0x81e92d['uniqueid']]){for(var _0x381b91 in _0x81e92d['variable']){if(_0x81e92d['variable'][_0x4fb4('0x1d')](_0x381b91)){this[_0x4fb4('0x20')][_0x81e92d['uniqueid']][_0x381b91]=_0x81e92d[_0x4fb4('0x27')];}}}};Fax[_0x4fb4('0x19')][_0x4fb4('0x2a')]=function(_0x9080eb){if(this['channels'][_0x9080eb['uniqueid']]){this[_0x4fb4('0x20')][_0x9080eb['uniqueid']]['operation']=_0x9080eb[_0x4fb4('0x2b')];this['channels'][_0x9080eb[_0x4fb4('0x21')]][_0x4fb4('0x2c')]=_0x9080eb[_0x4fb4('0x2c')];this[_0x4fb4('0x20')][_0x9080eb[_0x4fb4('0x21')]]['localstationid']=_0x9080eb['localstationid'];this[_0x4fb4('0x20')][_0x9080eb[_0x4fb4('0x21')]]['filename']=_0x9080eb[_0x4fb4('0x2d')];logger['info'](_0x9080eb[_0x4fb4('0x21')],_0x4fb4('0x2e'));}};Fax['prototype'][_0x4fb4('0x2f')]=function(_0x3ca1b6){var _0xba4b7a=this;if(this[_0x4fb4('0x20')][_0x3ca1b6['uniqueid']]){var _0x1cfa3b=this['channels'][_0x3ca1b6[_0x4fb4('0x21')]]['id'];this[_0x4fb4('0x20')][_0x3ca1b6[_0x4fb4('0x21')]][_0x4fb4('0x30')]=_0x3ca1b6[_0x4fb4('0x30')];this['channels'][_0x3ca1b6[_0x4fb4('0x21')]]['pagestransferred']=_0x3ca1b6[_0x4fb4('0x31')];this[_0x4fb4('0x20')][_0x3ca1b6['uniqueid']][_0x4fb4('0x1f')]=_0x3ca1b6[_0x4fb4('0x1f')];this[_0x4fb4('0x20')][_0x3ca1b6[_0x4fb4('0x21')]]['resolution']=_0x3ca1b6[_0x4fb4('0x32')];this[_0x4fb4('0x20')][_0x3ca1b6[_0x4fb4('0x21')]]['transferrate']=_0x3ca1b6['transferrate'];this['channels'][_0x3ca1b6[_0x4fb4('0x21')]][_0x4fb4('0x2d')]=_0x3ca1b6[_0x4fb4('0x2d')];this[_0x4fb4('0x20')][_0x3ca1b6[_0x4fb4('0x21')]]['calleridnum']=_0x3ca1b6[_0x4fb4('0x33')];if(this[_0x4fb4('0x20')][_0x3ca1b6[_0x4fb4('0x21')]][_0x4fb4('0x31')]>0x0){tiff2pdf(_0x3ca1b6['filename'],_0x4fb4('0x34'),function(_0x5b4cf6){logger['info'](_0x3ca1b6['uniqueid'],'\x20result\x20conversion\x20file\x20',_0x5b4cf6[_0x4fb4('0x35')]);attachment[_0x4fb4('0x36')]({'name':path[_0x4fb4('0x37')](_0x3ca1b6[_0x4fb4('0x2d')])[_0x4fb4('0x23')],'basename':path[_0x4fb4('0x37')](_0x3ca1b6[_0x4fb4('0x2d')])[_0x4fb4('0x23')]+_0x4fb4('0x38'),'type':_0x4fb4('0x39')})[_0x4fb4('0x3a')](function(_0x2b0ca5){faxAccount[_0x4fb4('0x3b')](_0x1cfa3b,{'from':_0x3ca1b6[_0x4fb4('0x33')],'mapKey':_0x4fb4('0x6'),'body':path['parse'](_0x3ca1b6[_0x4fb4('0x2d')])[_0x4fb4('0x23')]+'.pdf','AttachmentId':_0x2b0ca5['id']})[_0x4fb4('0x3c')](function(_0x34fea2){logger[_0x4fb4('0x3d')](_0x3ca1b6[_0x4fb4('0x21')],'\x20notify\x20',JSON['stringify'](_0x34fea2));});})[_0x4fb4('0x3c')](function(_0x5c3fc4){logger['error'](_0x3ca1b6[_0x4fb4('0x21')],_0x4fb4('0x3e'),JSON[_0x4fb4('0x3f')](_0x5c3fc4));});});}logger[_0x4fb4('0x24')](_0x3ca1b6[_0x4fb4('0x21')],_0x4fb4('0x3e'));}};Fax[_0x4fb4('0x19')][_0x4fb4('0x40')]=function(_0x58516c){if(this[_0x4fb4('0xd')][_0x58516c[_0x4fb4('0x21')]]){_[_0x4fb4('0x41')](this[_0x4fb4('0x20')][_0x58516c[_0x4fb4('0x21')]],_[_0x4fb4('0x42')](_0x58516c,[_0x4fb4('0x43'),'reason']));}};function updateStatus(_0x5bd48){if(_0x5bd48[_0x4fb4('0x44')]){faxMessage[_0x4fb4('0x45')](_0x5bd48[_0x4fb4('0x44')],{'failMessage':_0x4fb4('0x46')})['then'](function(_0x291663){ut[_0x4fb4('0x47')]('[Fax][Message][Error][Updated]',_0x291663);})[_0x4fb4('0x3c')](function(_0x1a9e86){ut[_0x4fb4('0x47')](_0x4fb4('0x48'),_0x1a9e86);});}else{ut[_0x4fb4('0x47')](_0x4fb4('0x49'));}}Fax[_0x4fb4('0x19')][_0x4fb4('0x4a')]=function(_0x10f390,_0x51eb9c,_0x191355){var _0x36c0c2=this;var _0x2cca65={};if(_0x51eb9c){_0x2cca65={'read':_0x51eb9c};}else{_0x2cca65={'failMessage':_0x191355};}if(this[_0x4fb4('0xd')][_0x10f390][_0x4fb4('0x44')]){faxMessage[_0x4fb4('0x45')](this[_0x4fb4('0xd')][_0x10f390][_0x4fb4('0x44')],_0x2cca65)[_0x4fb4('0x3a')](function(_0x470a44){ut[_0x4fb4('0x47')](_0x4fb4('0x4b'),_0x470a44);})[_0x4fb4('0x3c')](function(_0x2eede8){ut[_0x4fb4('0x47')](_0x4fb4('0x4c'),_0x2eede8);})['finally'](function(){delete _0x36c0c2[_0x4fb4('0x20')][_0x10f390];delete _0x36c0c2[_0x4fb4('0xd')][_0x10f390];});}else{ut[_0x4fb4('0x47')](_0x4fb4('0x4d'));delete this[_0x4fb4('0x20')][_0x10f390];delete this['actions'][_0x10f390];}};Fax[_0x4fb4('0x19')][_0x4fb4('0x18')]=function(_0xb2683){var _0x2abe6e=this;if(this[_0x4fb4('0x20')][_0xb2683[_0x4fb4('0x21')]]){if(this[_0x4fb4('0xd')][_0xb2683[_0x4fb4('0x21')]]){this[_0x4fb4('0x20')][_0xb2683[_0x4fb4('0x21')]]['id']=this[_0x4fb4('0xd')][_0xb2683[_0x4fb4('0x21')]]['id'];this[_0x4fb4('0x20')][_0xb2683['uniqueid']][_0x4fb4('0x23')]=this['actions'][_0xb2683['uniqueid']][_0x4fb4('0x23')];}logger[_0x4fb4('0x24')](_0xb2683[_0x4fb4('0x21')],this[_0x4fb4('0xd')][_0xb2683['uniqueid']]?_0x4fb4('0x4e'):_0x4fb4('0x4f'),JSON['stringify'](this['channels'][_0xb2683[_0x4fb4('0x21')]]));if(this[_0x4fb4('0xd')][_0xb2683[_0x4fb4('0x21')]]){if(this[_0x4fb4('0x20')][_0xb2683[_0x4fb4('0x21')]][_0x4fb4('0x50')]>0x0&&this[_0x4fb4('0x20')][_0xb2683['uniqueid']][_0x4fb4('0x51')]==='SUCCESS'){this['updateStatus'](_0xb2683[_0x4fb4('0x21')],!![]);}else{this[_0x4fb4('0x4a')](_0xb2683[_0x4fb4('0x21')],![],this[_0x4fb4('0x20')][_0xb2683[_0x4fb4('0x21')]][_0x4fb4('0x52')]?'SENDING\x20FAILED:\x20'+this[_0x4fb4('0x20')][_0xb2683['uniqueid']][_0x4fb4('0x52')]:_0x4fb4('0x53'));}}}};Fax['prototype'][_0x4fb4('0x54')]=function(_0x5e73df){var _0x199874=this;return new BPromise(function(_0x4d3747,_0xdd2b76){_0x199874['execOriginate'](_0x5e73df,_0x199874[_0x4fb4('0x1c')][_0x5e73df['FaxAccountId']])['then'](function(_0x2fa0d1){ut[_0x4fb4('0x47')](_0x4fb4('0x55'),_0x2fa0d1);_0x4d3747(ut[_0x4fb4('0x35')]('Fax\x20received'));})[_0x4fb4('0x3c')](function(_0x361143){ut[_0x4fb4('0x47')]('[Fax][execOriginate][failure]',_0x361143);updateStatus(_0x5e73df);_0xdd2b76(ut[_0x4fb4('0x35')](_0x4fb4('0x56')));});});};Fax[_0x4fb4('0x19')][_0x4fb4('0x57')]=function(_0x2846fb){var _0x5054b8=this;return new BPromise(function(_0x4c12f2,_0x5d49c8){var _0x22020d=_0x5054b8[_0x4fb4('0x58')](_0x5054b8[_0x4fb4('0x1c')][_0x2846fb[_0x4fb4('0x59')]]['Trunk'],_0x2846fb);if(_0x22020d['isValid']){_0x4c12f2(ut[_0x4fb4('0x35')]('Trunk\x20Reachable'));}else{_0x5d49c8(ut[_0x4fb4('0x35')](_0x22020d[_0x4fb4('0x35')]));}});};function originate(_0x139744,_0x3fc5a7,_0x96a120){return new BPromise(function(_0x5a2a4c,_0x3b48d4){if(_0x96a120){var _0x4e6c88=util[_0x4fb4('0x5a')](_0x4fb4('0x5b'),path[_0x4fb4('0x37')](_0x139744[_0x4fb4('0x3')])['name'],_0x139744['path']);gs[_0x4fb4('0x5c')](_0x4e6c88)['then'](function(){_0x139744[_0x4fb4('0x3')]=util[_0x4fb4('0x5a')](_0x4fb4('0x5d'),path[_0x4fb4('0x37')](_0x139744[_0x4fb4('0x3')])[_0x4fb4('0x5e')],path[_0x4fb4('0x37')](_0x139744[_0x4fb4('0x3')])[_0x4fb4('0x23')]);_0x3fc5a7[_0x4fb4('0x5f')]=_0x139744[_0x4fb4('0x3')];ut[_0x4fb4('0x47')]('Convert\x20pdf\x20to\x20tif','');ami[_0x4fb4('0x60')](ut[_0x4fb4('0x61')](_0x139744,_0x3fc5a7))[_0x4fb4('0x3a')](function(_0x4b5482){_0x5a2a4c(_0x4b5482);})[_0x4fb4('0x3c')](function(_0xe579a7){_0x3b48d4(_0xe579a7);});})[_0x4fb4('0x3c')](function(_0x33795e){_0x3b48d4(_0x33795e);});}else{ami[_0x4fb4('0x60')](ut[_0x4fb4('0x61')](_0x139744,_0x3fc5a7))[_0x4fb4('0x3a')](function(_0x24900c){_0x5a2a4c(_0x24900c);})['catch'](function(_0x53fa36){_0x3b48d4(_0x53fa36);});}});}Fax[_0x4fb4('0x19')]['execOriginate']=function(_0x5542ca,_0x355f5a){var _0x2ad817=this;return new BPromise(function(_0x760d74,_0x516d7a){var _0x4497d0=uuid['v4']();var _0x2a1a25=ut['addVariables'](_0x5542ca,_0x355f5a);_0x2ad817[_0x4fb4('0xd')][_0x4497d0]=new Action(_0x4497d0,_0x355f5a,_0x5542ca);var _0x409294=_0x2ad817[_0x4fb4('0xd')][_0x4497d0];if(path[_0x4fb4('0x37')](_0x5542ca[_0x4fb4('0x3')])[_0x4fb4('0x62')]===_0x4fb4('0x38')){originate(_0x409294,_0x2a1a25,!![])[_0x4fb4('0x3a')](function(_0x1144d2){_0x760d74(_0x1144d2);})[_0x4fb4('0x3c')](function(_0x241a0c){_0x516d7a(_0x241a0c);});}else{originate(_0x409294,_0x2a1a25,![])[_0x4fb4('0x3a')](function(_0x318422){_0x760d74(_0x318422);})[_0x4fb4('0x3c')](function(_0x5c9ba0){_0x516d7a(_0x5c9ba0);});}});};Fax[_0x4fb4('0x19')][_0x4fb4('0x63')]=function(_0x3afc71){return!_[_0x4fb4('0x64')](_0x3afc71)&&!_[_0x4fb4('0x64')](_0x3afc71[_0x4fb4('0x23')])&&!_[_0x4fb4('0x64')](_0x3afc71['active'])&&_0x3afc71[_0x4fb4('0x65')]&&!_[_0x4fb4('0x64')](this['trunks'][util[_0x4fb4('0x5a')](_0x4fb4('0x66'),_0x3afc71['name'])])&&!_[_0x4fb4('0x64')](this['trunks'][util[_0x4fb4('0x5a')]('SIP/%s',_0x3afc71['name'])][_0x4fb4('0x2c')])&&(this[_0x4fb4('0x67')][util[_0x4fb4('0x5a')](_0x4fb4('0x66'),_0x3afc71['name'])][_0x4fb4('0x2c')]===_0x4fb4('0x68')||this['trunks'][util['format'](_0x4fb4('0x66'),_0x3afc71['name'])][_0x4fb4('0x2c')]==='unmonitored');};Fax[_0x4fb4('0x19')][_0x4fb4('0x58')]=function(_0x2b3fb0,_0x585c20){if(!this[_0x4fb4('0x63')](_0x2b3fb0)){ut[_0x4fb4('0x47')](_0x4fb4('0x69'),_[_0x4fb4('0x64')](_0x2b3fb0)?'':_0x2b3fb0[_0x4fb4('0x23')]+_0x4fb4('0x6a'));return{'isValid':![],'message':_0x4fb4('0x6b')};}if(_[_0x4fb4('0x64')](_0x585c20['fax'])){ut[_0x4fb4('0x47')](_0x4fb4('0x6c'),JSON[_0x4fb4('0x3f')](_0x585c20));return{'isValid':![],'message':_0x4fb4('0x6d')};}if(_[_0x4fb4('0x64')](_0x585c20['path'])){ut[_0x4fb4('0x47')](_0x4fb4('0x6e'),JSON['stringify'](_0x585c20));return{'isValid':![],'message':_0x4fb4('0x6f')};}return{'isValid':!![],'message':'Is\x20Valid'};};module['exports']=Fax; \ No newline at end of file +var _0xe444=['../ami','./rpcDb','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','actions','syncNewchannel','bind','syncVarSet','syncNewState','syncNewExten','faxstatus','syncFaxStatus','syncHangup','prototype','from-voip-provider','exten','localstationid','uniqueid','channel','name','\x20syncNewchannel\x20','info','variable','hasOwnProperty','value','channelstate','channelstatedesc','operation','status','filename','syncReceiveFax','remotestationid','pagestransferred','resolution','transferrate','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','then','notify','calleridnum','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','merge','pick','response','reason','update','AttachmentId','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][NoUpdate1]','finally','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkTrunk','isValid','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','%s/%s.tif','dir','Convert\x20pdf\x20to\x20tif','Action','variablesAction','execOriginate','addVariables','ext','isNil','active','SIP/%s','reachable','unmonitored','isTrunkReachable','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20path','Is\x20Valid','exports','util','lodash','bluebird','uuid','moment','path','tiff2pdf','./util/gs','fax'];(function(_0x2e0b9b,_0x3ae1f4){var _0xa7acd2=function(_0x79c5c7){while(--_0x79c5c7){_0x2e0b9b['push'](_0x2e0b9b['shift']());}};_0xa7acd2(++_0x3ae1f4);}(_0xe444,0x156));var _0x4e44=function(_0x91041f,_0x408f75){_0x91041f=_0x91041f-0x0;var _0x5e38a7=_0xe444[_0x91041f];return _0x5e38a7;};'use strict';var util=require(_0x4e44('0x0'));var _=require(_0x4e44('0x1'));var BPromise=require(_0x4e44('0x2'));var uuid=require(_0x4e44('0x3'));var moment=require(_0x4e44('0x4'));var path=require(_0x4e44('0x5'));var tiff2pdf=require(_0x4e44('0x6'));var gs=require(_0x4e44('0x7'));var logger=require('../../../config/logger')(_0x4e44('0x8'));var ami=require(_0x4e44('0x9'));var rpcDb=require(_0x4e44('0xa'));var Channel=require(_0x4e44('0xb'));var ut=require(_0x4e44('0xc'));var Action=require(_0x4e44('0xd'));var faxAccount=require(_0x4e44('0xe'));var attachment=require(_0x4e44('0xf'));var faxMessage=require(_0x4e44('0x10'));function Fax(_0x5be45e){this[_0x4e44('0x11')]={};this['faxAccounts']=_0x5be45e[_0x4e44('0x12')];this[_0x4e44('0x13')]=_0x5be45e[_0x4e44('0x13')];this[_0x4e44('0x14')]={};ami['on']('newchannel',this[_0x4e44('0x15')][_0x4e44('0x16')](this));ami['on']('varset',this[_0x4e44('0x17')][_0x4e44('0x16')](this));ami['on']('newstate',this[_0x4e44('0x18')][_0x4e44('0x16')](this));ami['on']('newexten',this[_0x4e44('0x19')][_0x4e44('0x16')](this));ami['on'](_0x4e44('0x1a'),this[_0x4e44('0x1b')][_0x4e44('0x16')](this));ami['on']('receivefax',this['syncReceiveFax'][_0x4e44('0x16')](this));ami['on']('hangup',this[_0x4e44('0x1c')][_0x4e44('0x16')](this));ami['on']('originateresponse',this['syncOriginateResponse'][_0x4e44('0x16')](this));}Fax[_0x4e44('0x1d')][_0x4e44('0x15')]=function(_0x54f4cf){if(_0x54f4cf['context']===_0x4e44('0x1e')){for(var _0x4204b5 in this[_0x4e44('0x12')]){if(this[_0x4e44('0x12')]['hasOwnProperty'](_0x4204b5)){if(_0x54f4cf[_0x4e44('0x1f')]===this[_0x4e44('0x12')][_0x4204b5][_0x4e44('0x20')]){this[_0x4e44('0x11')][_0x54f4cf[_0x4e44('0x21')]]={};this['channels'][_0x54f4cf[_0x4e44('0x21')]][_0x4e44('0x22')]=_0x54f4cf[_0x4e44('0x22')];this['channels'][_0x54f4cf['uniqueid']]['id']=this[_0x4e44('0x12')][_0x4204b5]['id'];this[_0x4e44('0x11')][_0x54f4cf[_0x4e44('0x21')]]['name']=this['faxAccounts'][_0x4204b5][_0x4e44('0x23')];logger['info'](_0x54f4cf[_0x4e44('0x21')],_0x4e44('0x24'));}}}}if(this['actions'][_0x54f4cf[_0x4e44('0x21')]]){this[_0x4e44('0x11')][_0x54f4cf['uniqueid']]={};this[_0x4e44('0x11')][_0x54f4cf[_0x4e44('0x21')]][_0x4e44('0x22')]=_0x54f4cf[_0x4e44('0x22')];logger[_0x4e44('0x25')](_0x54f4cf[_0x4e44('0x21')],_0x4e44('0x24'));}};Fax['prototype'][_0x4e44('0x17')]=function(_0x29d8c1){if(this[_0x4e44('0x11')][_0x29d8c1['uniqueid']]){for(var _0xeba745 in _0x29d8c1[_0x4e44('0x26')]){if(_0x29d8c1['variable'][_0x4e44('0x27')](_0xeba745)){this['channels'][_0x29d8c1['uniqueid']][_0xeba745]=_0x29d8c1[_0x4e44('0x28')];}}}};Fax[_0x4e44('0x1d')][_0x4e44('0x18')]=function(_0x1027a8){if(this[_0x4e44('0x11')][_0x1027a8[_0x4e44('0x21')]]){this[_0x4e44('0x11')][_0x1027a8['uniqueid']]['channelstate']=_0x1027a8[_0x4e44('0x29')];this[_0x4e44('0x11')][_0x1027a8[_0x4e44('0x21')]][_0x4e44('0x2a')]=_0x1027a8[_0x4e44('0x2a')];}};Fax[_0x4e44('0x1d')][_0x4e44('0x19')]=function(_0x440206){if(this['channels'][_0x440206['uniqueid']]){for(var _0x6097d1 in _0x440206[_0x4e44('0x26')]){if(_0x440206[_0x4e44('0x26')]['hasOwnProperty'](_0x6097d1)){this[_0x4e44('0x11')][_0x440206[_0x4e44('0x21')]][_0x6097d1]=_0x440206['value'];}}}};Fax[_0x4e44('0x1d')]['syncFaxStatus']=function(_0x209810){if(this['channels'][_0x209810[_0x4e44('0x21')]]){this[_0x4e44('0x11')][_0x209810['uniqueid']][_0x4e44('0x2b')]=_0x209810[_0x4e44('0x2b')];this[_0x4e44('0x11')][_0x209810[_0x4e44('0x21')]][_0x4e44('0x2c')]=_0x209810['status'];this['channels'][_0x209810[_0x4e44('0x21')]][_0x4e44('0x20')]=_0x209810[_0x4e44('0x20')];this['channels'][_0x209810[_0x4e44('0x21')]]['filename']=_0x209810[_0x4e44('0x2d')];logger[_0x4e44('0x25')](_0x209810[_0x4e44('0x21')],'\x20syncFaxStatus\x20');}};Fax[_0x4e44('0x1d')][_0x4e44('0x2e')]=function(_0x1ce3e1){var _0x3ad841=this;if(this['channels'][_0x1ce3e1[_0x4e44('0x21')]]){var _0x3bfde5=this[_0x4e44('0x11')][_0x1ce3e1['uniqueid']]['id'];this[_0x4e44('0x11')][_0x1ce3e1[_0x4e44('0x21')]][_0x4e44('0x2f')]=_0x1ce3e1[_0x4e44('0x2f')];this['channels'][_0x1ce3e1[_0x4e44('0x21')]][_0x4e44('0x30')]=_0x1ce3e1[_0x4e44('0x30')];this[_0x4e44('0x11')][_0x1ce3e1['uniqueid']][_0x4e44('0x20')]=_0x1ce3e1[_0x4e44('0x20')];this[_0x4e44('0x11')][_0x1ce3e1[_0x4e44('0x21')]][_0x4e44('0x31')]=_0x1ce3e1['resolution'];this[_0x4e44('0x11')][_0x1ce3e1[_0x4e44('0x21')]][_0x4e44('0x32')]=_0x1ce3e1[_0x4e44('0x32')];this[_0x4e44('0x11')][_0x1ce3e1[_0x4e44('0x21')]][_0x4e44('0x2d')]=_0x1ce3e1[_0x4e44('0x2d')];this['channels'][_0x1ce3e1[_0x4e44('0x21')]]['calleridnum']=_0x1ce3e1['calleridnum'];if(this['channels'][_0x1ce3e1[_0x4e44('0x21')]]['pagestransferred']>0x0){tiff2pdf(_0x1ce3e1[_0x4e44('0x2d')],_0x4e44('0x33'),function(_0x2f71ff){logger[_0x4e44('0x25')](_0x1ce3e1[_0x4e44('0x21')],_0x4e44('0x34'),_0x2f71ff[_0x4e44('0x35')]);attachment[_0x4e44('0x36')]({'name':path[_0x4e44('0x37')](_0x1ce3e1[_0x4e44('0x2d')])['name'],'basename':path[_0x4e44('0x37')](_0x1ce3e1[_0x4e44('0x2d')])[_0x4e44('0x23')]+_0x4e44('0x38'),'type':'application/pdf'})[_0x4e44('0x39')](function(_0x4cbc11){faxAccount[_0x4e44('0x3a')](_0x3bfde5,{'from':_0x1ce3e1[_0x4e44('0x3b')],'mapKey':_0x4e44('0x8'),'body':path[_0x4e44('0x37')](_0x1ce3e1[_0x4e44('0x2d')])[_0x4e44('0x23')]+_0x4e44('0x38'),'AttachmentId':_0x4cbc11['id']})[_0x4e44('0x3c')](function(_0x3a6ab2){logger[_0x4e44('0x3d')](_0x1ce3e1['uniqueid'],_0x4e44('0x3e'),JSON[_0x4e44('0x3f')](_0x3a6ab2));});})['catch'](function(_0x81b89f){logger[_0x4e44('0x3d')](_0x1ce3e1[_0x4e44('0x21')],_0x4e44('0x40'),JSON['stringify'](_0x81b89f));});});}logger[_0x4e44('0x25')](_0x1ce3e1[_0x4e44('0x21')],_0x4e44('0x40'));}};Fax[_0x4e44('0x1d')]['syncOriginateResponse']=function(_0x11d85d){if(this['actions'][_0x11d85d[_0x4e44('0x21')]]){_[_0x4e44('0x41')](this[_0x4e44('0x11')][_0x11d85d[_0x4e44('0x21')]],_[_0x4e44('0x42')](_0x11d85d,[_0x4e44('0x43'),_0x4e44('0x44')]));}};function updateStatus(_0x19635b){if(_0x19635b['AttachmentId']){faxMessage[_0x4e44('0x45')](_0x19635b[_0x4e44('0x46')],{'failMessage':_0x4e44('0x47')})[_0x4e44('0x39')](function(_0x52bd43){ut[_0x4e44('0x48')](_0x4e44('0x49'),_0x52bd43);})[_0x4e44('0x3c')](function(_0x859ef6){ut['logger'](_0x4e44('0x4a'),_0x859ef6);});}else{ut[_0x4e44('0x48')](_0x4e44('0x4b'));}}Fax['prototype'][_0x4e44('0x4c')]=function(_0x3b5d6d,_0x42f6d1,_0x416a94){var _0x5ab850=this;var _0xe22d39={};if(_0x42f6d1){_0xe22d39={'read':_0x42f6d1};}else{_0xe22d39={'failMessage':_0x416a94};}if(this[_0x4e44('0x14')][_0x3b5d6d][_0x4e44('0x46')]){faxMessage[_0x4e44('0x45')](this[_0x4e44('0x14')][_0x3b5d6d]['AttachmentId'],_0xe22d39)['then'](function(_0x52d3b5){ut[_0x4e44('0x48')]('[Fax][Message][Updated]',_0x52d3b5);})[_0x4e44('0x3c')](function(_0x4bece4){ut[_0x4e44('0x48')](_0x4e44('0x4d'),_0x4bece4);})[_0x4e44('0x4e')](function(){delete _0x5ab850[_0x4e44('0x11')][_0x3b5d6d];delete _0x5ab850['actions'][_0x3b5d6d];});}else{ut[_0x4e44('0x48')]('[Fax][Message][NoUpdate2]');delete this[_0x4e44('0x11')][_0x3b5d6d];delete this[_0x4e44('0x14')][_0x3b5d6d];}};Fax[_0x4e44('0x1d')][_0x4e44('0x1c')]=function(_0x12281c){var _0x14a05d=this;if(this['channels'][_0x12281c['uniqueid']]){if(this['actions'][_0x12281c['uniqueid']]){this[_0x4e44('0x11')][_0x12281c[_0x4e44('0x21')]]['id']=this[_0x4e44('0x14')][_0x12281c[_0x4e44('0x21')]]['id'];this[_0x4e44('0x11')][_0x12281c['uniqueid']][_0x4e44('0x23')]=this[_0x4e44('0x14')][_0x12281c['uniqueid']]['name'];}logger[_0x4e44('0x25')](_0x12281c[_0x4e44('0x21')],this[_0x4e44('0x14')][_0x12281c[_0x4e44('0x21')]]?_0x4e44('0x4f'):_0x4e44('0x50'),JSON[_0x4e44('0x3f')](this[_0x4e44('0x11')][_0x12281c[_0x4e44('0x21')]]));if(this[_0x4e44('0x14')][_0x12281c[_0x4e44('0x21')]]){if(this['channels'][_0x12281c['uniqueid']][_0x4e44('0x51')]>0x0&&this[_0x4e44('0x11')][_0x12281c[_0x4e44('0x21')]][_0x4e44('0x1a')]==='SUCCESS'){this[_0x4e44('0x4c')](_0x12281c[_0x4e44('0x21')],!![]);}else{this[_0x4e44('0x4c')](_0x12281c[_0x4e44('0x21')],![],this['channels'][_0x12281c[_0x4e44('0x21')]][_0x4e44('0x52')]?_0x4e44('0x53')+this[_0x4e44('0x11')][_0x12281c[_0x4e44('0x21')]]['faxstatusstring']:_0x4e44('0x54'));}}}};Fax[_0x4e44('0x1d')][_0x4e44('0x55')]=function(_0x1db396){var _0x121ccd=this;return new BPromise(function(_0x49813b,_0x10f62b){_0x121ccd['execOriginate'](_0x1db396,_0x121ccd[_0x4e44('0x12')][_0x1db396[_0x4e44('0x56')]])[_0x4e44('0x39')](function(_0xcec21){ut[_0x4e44('0x48')](_0x4e44('0x57'),_0xcec21);_0x49813b(ut[_0x4e44('0x35')](_0x4e44('0x58')));})[_0x4e44('0x3c')](function(_0x48562f){ut[_0x4e44('0x48')](_0x4e44('0x59'),_0x48562f);updateStatus(_0x1db396);_0x10f62b(ut[_0x4e44('0x35')](_0x4e44('0x5a')));});});};Fax[_0x4e44('0x1d')]['checkAfterSend']=function(_0x315fa2){var _0x508973=this;return new BPromise(function(_0x7bd447,_0x1b2a74){var _0x2cc8b0=_0x508973[_0x4e44('0x5b')](_0x508973[_0x4e44('0x12')][_0x315fa2[_0x4e44('0x56')]]['Trunk'],_0x315fa2);if(_0x2cc8b0[_0x4e44('0x5c')]){_0x7bd447(ut[_0x4e44('0x35')](_0x4e44('0x5d')));}else{_0x1b2a74(ut[_0x4e44('0x35')](_0x2cc8b0['message']));}});};function originate(_0x159dc7,_0x5b3097,_0x561e40){return new BPromise(function(_0x30d966,_0x26cb84){if(_0x561e40){var _0x536933=util[_0x4e44('0x5e')](_0x4e44('0x5f'),path[_0x4e44('0x37')](_0x159dc7[_0x4e44('0x5')])['name'],_0x159dc7[_0x4e44('0x5')]);gs[_0x4e44('0x60')](_0x536933)[_0x4e44('0x39')](function(){_0x159dc7[_0x4e44('0x5')]=util[_0x4e44('0x5e')](_0x4e44('0x61'),path[_0x4e44('0x37')](_0x159dc7['path'])[_0x4e44('0x62')],path[_0x4e44('0x37')](_0x159dc7['path'])['name']);_0x5b3097['XMF-PATH']=_0x159dc7['path'];ut['logger'](_0x4e44('0x63'),'');ami[_0x4e44('0x64')](ut[_0x4e44('0x65')](_0x159dc7,_0x5b3097))[_0x4e44('0x39')](function(_0x5accf9){_0x30d966(_0x5accf9);})[_0x4e44('0x3c')](function(_0x598241){_0x26cb84(_0x598241);});})[_0x4e44('0x3c')](function(_0x1fdc79){_0x26cb84(_0x1fdc79);});}else{ami[_0x4e44('0x64')](ut[_0x4e44('0x65')](_0x159dc7,_0x5b3097))[_0x4e44('0x39')](function(_0x39fbe5){_0x30d966(_0x39fbe5);})[_0x4e44('0x3c')](function(_0x232308){_0x26cb84(_0x232308);});}});}Fax[_0x4e44('0x1d')][_0x4e44('0x66')]=function(_0xa9a3e,_0x2e78be){var _0x588022=this;return new BPromise(function(_0x42eca1,_0x3a5788){var _0xb27ca0=uuid['v4']();var _0x52e500=ut[_0x4e44('0x67')](_0xa9a3e,_0x2e78be);_0x588022[_0x4e44('0x14')][_0xb27ca0]=new Action(_0xb27ca0,_0x2e78be,_0xa9a3e);var _0x53446b=_0x588022[_0x4e44('0x14')][_0xb27ca0];if(path[_0x4e44('0x37')](_0xa9a3e[_0x4e44('0x5')])[_0x4e44('0x68')]==='.pdf'){originate(_0x53446b,_0x52e500,!![])['then'](function(_0x781010){_0x42eca1(_0x781010);})[_0x4e44('0x3c')](function(_0x1f2d82){_0x3a5788(_0x1f2d82);});}else{originate(_0x53446b,_0x52e500,![])[_0x4e44('0x39')](function(_0x164fec){_0x42eca1(_0x164fec);})['catch'](function(_0x59081b){_0x3a5788(_0x59081b);});}});};Fax['prototype']['isTrunkReachable']=function(_0xa93e59){return!_[_0x4e44('0x69')](_0xa93e59)&&!_[_0x4e44('0x69')](_0xa93e59[_0x4e44('0x23')])&&!_[_0x4e44('0x69')](_0xa93e59[_0x4e44('0x6a')])&&_0xa93e59[_0x4e44('0x6a')]&&!_['isNil'](this[_0x4e44('0x13')][util['format']('SIP/%s',_0xa93e59['name'])])&&!_[_0x4e44('0x69')](this[_0x4e44('0x13')][util[_0x4e44('0x5e')]('SIP/%s',_0xa93e59[_0x4e44('0x23')])][_0x4e44('0x2c')])&&(this[_0x4e44('0x13')][util[_0x4e44('0x5e')](_0x4e44('0x6b'),_0xa93e59['name'])]['status']===_0x4e44('0x6c')||this[_0x4e44('0x13')][util[_0x4e44('0x5e')](_0x4e44('0x6b'),_0xa93e59[_0x4e44('0x23')])][_0x4e44('0x2c')]===_0x4e44('0x6d'));};Fax['prototype']['checkTrunk']=function(_0x3249f1,_0x32539f){if(!this[_0x4e44('0x6e')](_0x3249f1)){ut[_0x4e44('0x48')]('[Fax][checkTrunk][Trunk\x20not\x20work]',_[_0x4e44('0x69')](_0x3249f1)?'':_0x3249f1[_0x4e44('0x23')]+_0x4e44('0x6f'));return{'isValid':![],'message':_0x4e44('0x70')};}if(_[_0x4e44('0x69')](_0x32539f[_0x4e44('0x8')])){ut[_0x4e44('0x48')](_0x4e44('0x71'),JSON[_0x4e44('0x3f')](_0x32539f));return{'isValid':![],'message':'Empty\x20Fax'};}if(_[_0x4e44('0x69')](_0x32539f[_0x4e44('0x5')])){ut[_0x4e44('0x48')]('[Fax][checkTrunk][Empty\x20path]',JSON[_0x4e44('0x3f')](_0x32539f));return{'isValid':![],'message':_0x4e44('0x72')};}return{'isValid':!![],'message':_0x4e44('0x73')};};module[_0x4e44('0x74')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index ab97fd0..649f018 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 _0x4b7c=['catch','[Notify]\x20','bluebird','../../../config/logger','preview','error','inspect','notify','resolve','then'];(function(_0x3a7091,_0x590236){var _0x43d869=function(_0x3afbca){while(--_0x3afbca){_0x3a7091['push'](_0x3a7091['shift']());}};_0x43d869(++_0x590236);}(_0x4b7c,0x142));var _0xc4b7=function(_0x30f570,_0xd8f54a){_0x30f570=_0x30f570-0x0;var _0x3478ad=_0x4b7c[_0x30f570];return _0x3478ad;};'use strict';var util=require('util');var BPromise=require(_0xc4b7('0x0'));var logger=require(_0xc4b7('0x1'))(_0xc4b7('0x2'));var _=require('lodash');var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x5d51f1){return function(_0x10a942){logger[_0xc4b7('0x3')](_0x5d51f1,util[_0xc4b7('0x4')](_0x10a942,{'showHidden':![],'depth':null}));};}exports[_0xc4b7('0x5')]=function(_0x2fec69,_0x1da693){return BPromise[_0xc4b7('0x6')]()[_0xc4b7('0x7')](faxAccount[_0xc4b7('0x5')](_0x2fec69,_0x1da693))[_0xc4b7('0x8')](loggerCatch(_0xc4b7('0x9')));}; \ No newline at end of file +var _0x67f2=['bluebird','../../../config/logger','lodash','error','inspect','notify','resolve','then','catch','[Notify]\x20','util'];(function(_0x443238,_0x23afa8){var _0x3ca655=function(_0xd52a2e){while(--_0xd52a2e){_0x443238['push'](_0x443238['shift']());}};_0x3ca655(++_0x23afa8);}(_0x67f2,0x83));var _0x267f=function(_0x59edd4,_0x3bb896){_0x59edd4=_0x59edd4-0x0;var _0x458ada=_0x67f2[_0x59edd4];return _0x458ada;};'use strict';var util=require(_0x267f('0x0'));var BPromise=require(_0x267f('0x1'));var logger=require(_0x267f('0x2'))('preview');var _=require(_0x267f('0x3'));var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x58fdd7){return function(_0x19d29a){logger[_0x267f('0x4')](_0x58fdd7,util[_0x267f('0x5')](_0x19d29a,{'showHidden':![],'depth':null}));};}exports[_0x267f('0x6')]=function(_0x38a723,_0x284c2a){return BPromise[_0x267f('0x7')]()[_0x267f('0x8')](faxAccount[_0x267f('0x6')](_0x38a723,_0x284c2a))[_0x267f('0x9')](loggerCatch(_0x267f('0xa')));}; \ No newline at end of file diff --git a/server/services/ami/fax/util/gs.js b/server/services/ami/fax/util/gs.js index 78fe516..64b9a5c 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 _0x7dd6=['exec','execute','info','Exec\x20gs','\x20Error\x20:','inspect','util','../../../../config/logger','fax','bluebird','child_process'];(function(_0x1f432f,_0x20b3a0){var _0x5b5c63=function(_0xafd89e){while(--_0xafd89e){_0x1f432f['push'](_0x1f432f['shift']());}};_0x5b5c63(++_0x20b3a0);}(_0x7dd6,0x1c9));var _0x67dd=function(_0xb65e77,_0x238c3d){_0xb65e77=_0xb65e77-0x0;var _0x38134b=_0x7dd6[_0xb65e77];return _0x38134b;};'use strict';var util=require(_0x67dd('0x0'));var logger=require(_0x67dd('0x1'))(_0x67dd('0x2'));var BPromise=require(_0x67dd('0x3'));var exec=require(_0x67dd('0x4'))[_0x67dd('0x5')];exports[_0x67dd('0x6')]=function(_0x5966f8){return new BPromise(function(_0x1fe789,_0x2c9093){exec(_0x5966f8,function(_0x1d330f,_0x3d2c80,_0x360367){logger[_0x67dd('0x7')](_0x67dd('0x8'),_0x3d2c80);if(_0x1d330f){logger['info']('Exec\x20gs',_0x67dd('0x9'),util[_0x67dd('0xa')](_0x1d330f,{'showHidden':![],'depth':null}),_0x3d2c80,_0x360367);_0x2c9093(_0x1d330f);}_0x1fe789(_0x3d2c80);});});}; \ No newline at end of file +var _0x36dc=['execute','info','Exec\x20gs','\x20Error\x20:','inspect','util','../../../../config/logger','exec'];(function(_0x32df38,_0x62f87){var _0x53961c=function(_0x58a2d4){while(--_0x58a2d4){_0x32df38['push'](_0x32df38['shift']());}};_0x53961c(++_0x62f87);}(_0x36dc,0xa5));var _0xc36d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x36dc[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0xc36d('0x0'));var logger=require(_0xc36d('0x1'))('fax');var BPromise=require('bluebird');var exec=require('child_process')[_0xc36d('0x2')];exports[_0xc36d('0x3')]=function(_0x32da31){return new BPromise(function(_0x2e1b50,_0x132317){exec(_0x32da31,function(_0x3a17ab,_0x200777,_0x4f617f){logger[_0xc36d('0x4')](_0xc36d('0x5'),_0x200777);if(_0x3a17ab){logger['info'](_0xc36d('0x5'),_0xc36d('0x6'),util[_0xc36d('0x7')](_0x3a17ab,{'showHidden':![],'depth':null}),_0x200777,_0x4f617f);_0x132317(_0x3a17ab);}_0x2e1b50(_0x200777);});});}; \ 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 0273b7c..c80e815 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 _0x0713=['from-sip','\x22%s\x22\x20<%s>','moment','../../../../config/logger','fax','message','info','inspect','addVariables','ecm','headerinfo','minrate','maxrate','format','modem','gateway','faxdetect','t38timeout','localstationid','variablesAction','uniqueid','originate'];(function(_0x2edbe0,_0x340a07){var _0x18a6d0=function(_0xbc6a0){while(--_0xbc6a0){_0x2edbe0['push'](_0x2edbe0['shift']());}};_0x18a6d0(++_0x340a07);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x3071('0x0'));var logger=require(_0x3071('0x1'))(_0x3071('0x2'));exports[_0x3071('0x3')]=function(_0x864539){return{'message':_0x864539};};exports['logger']=function(_0x2c547f,_0x7b18a4){logger[_0x3071('0x4')](_0x2c547f,util[_0x3071('0x5')](_0x7b18a4,{'showHidden':![],'depth':null}));};exports[_0x3071('0x6')]=function(_0x41cf76,_0x1d3dd6){var _0x2f1e87={'XMF-ECM':_0x1d3dd6[_0x3071('0x7')],'XMF-HEADERINFO':_0x1d3dd6[_0x3071('0x8')],'XMF-MINRATE':_0x1d3dd6[_0x3071('0x9')],'XMF-MAXRATE':_0x1d3dd6[_0x3071('0xa')],'XMF-MODEM':util[_0x3071('0xb')]('\x22%s\x22',_0x1d3dd6[_0x3071('0xc')]),'XMF-GATEWAY':_0x1d3dd6[_0x3071('0xd')],'XMF-FAXDETECT':_0x1d3dd6[_0x3071('0xe')],'XMF-T38TIMEOUT':_0x1d3dd6[_0x3071('0xf')],'XMF-LOCALSTATIONID':_0x1d3dd6[_0x3071('0x10')],'XMF-PATH':_0x41cf76['path']};return _0x2f1e87;};exports[_0x3071('0x11')]=function(_0x11a7ee,_0x401b4d){return{'actionid':_0x11a7ee[_0x3071('0x12')],'action':_0x3071('0x13'),'channel':_0x11a7ee['channel'],'Exten':'xcally-motion-fax','Context':_0x3071('0x14'),'Priority':'1','callerid':util['format'](_0x3071('0x15'),_0x11a7ee[_0x3071('0x8')]?_0x11a7ee['headerinfo']:'',_0x11a7ee[_0x3071('0x10')]),'variable':_0x401b4d,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x11a7ee['uniqueid']};}; \ No newline at end of file +var _0x9aea=['maxrate','format','\x22%s\x22','modem','gateway','faxdetect','t38timeout','path','uniqueid','originate','channel','xcally-motion-fax','from-sip','localstationid','util','moment','fax','message','logger','info','inspect','headerinfo','minrate'];(function(_0x3635ce,_0x33a6f9){var _0x97ecd0=function(_0x123d98){while(--_0x123d98){_0x3635ce['push'](_0x3635ce['shift']());}};_0x97ecd0(++_0x33a6f9);}(_0x9aea,0xdd));var _0xa9ae=function(_0x53d8e5,_0x28c9f8){_0x53d8e5=_0x53d8e5-0x0;var _0x96420e=_0x9aea[_0x53d8e5];return _0x96420e;};'use strict';var util=require(_0xa9ae('0x0'));var _=require('lodash');var moment=require(_0xa9ae('0x1'));var logger=require('../../../../config/logger')(_0xa9ae('0x2'));exports[_0xa9ae('0x3')]=function(_0x563a24){return{'message':_0x563a24};};exports[_0xa9ae('0x4')]=function(_0x115593,_0x41fb71){logger[_0xa9ae('0x5')](_0x115593,util[_0xa9ae('0x6')](_0x41fb71,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x1aa3b9,_0x22734b){var _0x1e57c4={'XMF-ECM':_0x22734b['ecm'],'XMF-HEADERINFO':_0x22734b[_0xa9ae('0x7')],'XMF-MINRATE':_0x22734b[_0xa9ae('0x8')],'XMF-MAXRATE':_0x22734b[_0xa9ae('0x9')],'XMF-MODEM':util[_0xa9ae('0xa')](_0xa9ae('0xb'),_0x22734b[_0xa9ae('0xc')]),'XMF-GATEWAY':_0x22734b[_0xa9ae('0xd')],'XMF-FAXDETECT':_0x22734b[_0xa9ae('0xe')],'XMF-T38TIMEOUT':_0x22734b[_0xa9ae('0xf')],'XMF-LOCALSTATIONID':_0x22734b['localstationid'],'XMF-PATH':_0x1aa3b9[_0xa9ae('0x10')]};return _0x1e57c4;};exports['variablesAction']=function(_0x2addd2,_0x226cf7){return{'actionid':_0x2addd2[_0xa9ae('0x11')],'action':_0xa9ae('0x12'),'channel':_0x2addd2[_0xa9ae('0x13')],'Exten':_0xa9ae('0x14'),'Context':_0xa9ae('0x15'),'Priority':'1','callerid':util[_0xa9ae('0xa')]('\x22%s\x22\x20<%s>',_0x2addd2[_0xa9ae('0x7')]?_0x2addd2[_0xa9ae('0x7')]:'',_0x2addd2[_0xa9ae('0x16')]),'variable':_0x226cf7,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x2addd2[_0xa9ae('0x11')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 4ffe03c..99ce145 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 _0xbc4d=['./rpc/integrations/freshdesk','./rpc/integrations/freshsales','./rpc/integrations/servicenow','get','getAgents','initAgents','then','getTrunks','initTrunks','getVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','initDeskAccounts','getZohoAccounts','getVtigerAccounts','initVtigerAccounts','initFreshsalesAccounts','getServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','resolve','getVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','log','listen','bluebird','util','./server','./realtime','./report','./acw','./trigger','./dialer','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce'];(function(_0x349ff1,_0x37f26a){var _0x2985b0=function(_0x29c004){while(--_0x29c004){_0x349ff1['push'](_0x349ff1['shift']());}};_0x2985b0(++_0x37f26a);}(_0xbc4d,0x70));var _0xdbc4=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xbc4d[_0x17d9e3];return _0x14192d;};'use strict';var BPromise=require(_0xdbc4('0x0'));var util=require(_0xdbc4('0x1'));var moment=require('moment');var server=require(_0xdbc4('0x2'));var Realtime=require(_0xdbc4('0x3'));var Report=require(_0xdbc4('0x4'));var Acw=require(_0xdbc4('0x5'));var Trigger=require(_0xdbc4('0x6'));var Dialer=require(_0xdbc4('0x7'));var Preview=require('./preview');var Fax=require(_0xdbc4('0x8'));var user=require(_0xdbc4('0x9'));var voiceQueue=require(_0xdbc4('0xa'));var voiceQueueReport=require(_0xdbc4('0xb'));var voiceCallReport=require(_0xdbc4('0xc'));var trunk=require(_0xdbc4('0xd'));var trigger=require(_0xdbc4('0xe'));var template=require(_0xdbc4('0xf'));var cmHopperHistory=require(_0xdbc4('0x10'));var campaign=require(_0xdbc4('0x11'));var voiceExtension=require(_0xdbc4('0x12'));var faxAccount=require(_0xdbc4('0x13'));var zendesk=require(_0xdbc4('0x14'));var salesforce=require(_0xdbc4('0x15'));var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require(_0xdbc4('0x16'));var desk=require('./rpc/integrations/desk');var zoho=require('./rpc/integrations/zoho');var vtiger=require('./rpc/integrations/vtiger');var freshsales=require(_0xdbc4('0x17'));var servicenow=require(_0xdbc4('0x18'));var dynamics365=require('./rpc/integrations/dynamics365');var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0xdbc4('0x19')]('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0xdbc4('0x19')]('hour')===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise['resolve']()['then'](user[_0xdbc4('0x1a')]())['then'](realtime[_0xdbc4('0x1b')]())[_0xdbc4('0x1c')](user['getTelephones']())[_0xdbc4('0x1c')](realtime['initTelephones']())[_0xdbc4('0x1c')](trunk[_0xdbc4('0x1d')]())[_0xdbc4('0x1c')](realtime[_0xdbc4('0x1e')]())[_0xdbc4('0x1c')](voiceQueue[_0xdbc4('0x1f')]())[_0xdbc4('0x1c')](realtime['initVoiceQueues']())[_0xdbc4('0x1c')](trigger[_0xdbc4('0x20')]())[_0xdbc4('0x1c')](realtime[_0xdbc4('0x21')]())['then'](template[_0xdbc4('0x22')]())['then'](realtime[_0xdbc4('0x23')]())[_0xdbc4('0x1c')](zendesk[_0xdbc4('0x24')]())[_0xdbc4('0x1c')](realtime['initZendeskAccounts']())['then'](salesforce[_0xdbc4('0x25')]())[_0xdbc4('0x1c')](realtime[_0xdbc4('0x26')]())[_0xdbc4('0x1c')](sugarcrm[_0xdbc4('0x27')]())[_0xdbc4('0x1c')](realtime[_0xdbc4('0x28')]())[_0xdbc4('0x1c')](freshdesk[_0xdbc4('0x29')]())[_0xdbc4('0x1c')](realtime[_0xdbc4('0x2a')]())[_0xdbc4('0x1c')](desk['getDeskAccounts']())[_0xdbc4('0x1c')](realtime[_0xdbc4('0x2b')]())['then'](zoho[_0xdbc4('0x2c')]())[_0xdbc4('0x1c')](realtime['initZohoAccounts']())[_0xdbc4('0x1c')](vtiger[_0xdbc4('0x2d')]())[_0xdbc4('0x1c')](realtime[_0xdbc4('0x2e')]())[_0xdbc4('0x1c')](freshsales['getFreshsalesAccounts']())[_0xdbc4('0x1c')](realtime[_0xdbc4('0x2f')]())['then'](servicenow[_0xdbc4('0x30')]())[_0xdbc4('0x1c')](realtime['initServicenowAccounts']())[_0xdbc4('0x1c')](dynamics365[_0xdbc4('0x31')]())[_0xdbc4('0x1c')](realtime[_0xdbc4('0x32')]())[_0xdbc4('0x1c')](campaign[_0xdbc4('0x33')]())[_0xdbc4('0x1c')](realtime['initCampaigns']())['then'](voiceExtension[_0xdbc4('0x34')]())[_0xdbc4('0x1c')](realtime[_0xdbc4('0x35')]())['then'](faxAccount[_0xdbc4('0x36')]())[_0xdbc4('0x1c')](realtime[_0xdbc4('0x37')]())[_0xdbc4('0x1c')](function(){return realtime;});}function initParams(){return BPromise[_0xdbc4('0x38')]()['then'](voiceQueueReport[_0xdbc4('0x39')]())['then'](realtime['initVoiceQueueReports']())['then'](cmHopperHistory[_0xdbc4('0x3a')]())[_0xdbc4('0x1c')](realtime[_0xdbc4('0x3b')]())[_0xdbc4('0x1c')](cmHopperHistory[_0xdbc4('0x3c')]())[_0xdbc4('0x1c')](realtime[_0xdbc4('0x3d')]())[_0xdbc4('0x1c')](voiceCallReport[_0xdbc4('0x3e')]())['then'](realtime[_0xdbc4('0x3f')]())[_0xdbc4('0x1c')](function(_0x445e15){})[_0xdbc4('0x40')](function(_0x469dc8){console[_0xdbc4('0x41')](_0x469dc8);});}function main(){return server[_0xdbc4('0x42')](realtime,preview,fax)[_0xdbc4('0x1c')](function(_0x4c5ccf){return initRealtime();})['then'](function(){return initParams();})[_0xdbc4('0x1c')](function(){report['sync']();setInterval(initRealtime,0x1388);})[_0xdbc4('0x40')](function(_0xebaf02){console[_0xdbc4('0x41')](_0xebaf02);});}main(); \ No newline at end of file +var _0x6935=['./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','get','hour','then','getAgents','initAgents','initTelephones','getTrunks','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','getTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','getVtigerAccounts','initVtigerAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','resolve','getVoiceQueueReports','initVoiceQueueReports','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','initVoiceCallReports','catch','log','listen','sync','bluebird','util','moment','./server','./realtime','./report','./acw','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceCallReport','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/salesforce'];(function(_0x2dd195,_0x4c1c1b){var _0x3358c8=function(_0x4fd47b){while(--_0x4fd47b){_0x2dd195['push'](_0x2dd195['shift']());}};_0x3358c8(++_0x4c1c1b);}(_0x6935,0x114));var _0x5693=function(_0x1c9ef1,_0x5e064f){_0x1c9ef1=_0x1c9ef1-0x0;var _0x421493=_0x6935[_0x1c9ef1];return _0x421493;};'use strict';var BPromise=require(_0x5693('0x0'));var util=require(_0x5693('0x1'));var moment=require(_0x5693('0x2'));var server=require(_0x5693('0x3'));var Realtime=require(_0x5693('0x4'));var Report=require(_0x5693('0x5'));var Acw=require(_0x5693('0x6'));var Trigger=require('./trigger');var Dialer=require(_0x5693('0x7'));var Preview=require(_0x5693('0x8'));var Fax=require(_0x5693('0x9'));var user=require(_0x5693('0xa'));var voiceQueue=require(_0x5693('0xb'));var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require(_0x5693('0xc'));var trunk=require('./rpc/trunk');var trigger=require(_0x5693('0xd'));var template=require(_0x5693('0xe'));var cmHopperHistory=require(_0x5693('0xf'));var campaign=require(_0x5693('0x10'));var voiceExtension=require(_0x5693('0x11'));var faxAccount=require(_0x5693('0x12'));var zendesk=require('./rpc/integrations/zendesk');var salesforce=require(_0x5693('0x13'));var sugarcrm=require(_0x5693('0x14'));var freshdesk=require(_0x5693('0x15'));var desk=require(_0x5693('0x16'));var zoho=require(_0x5693('0x17'));var vtiger=require(_0x5693('0x18'));var freshsales=require(_0x5693('0x19'));var servicenow=require(_0x5693('0x1a'));var dynamics365=require(_0x5693('0x1b'));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()[_0x5693('0x1c')](_0x5693('0x1d'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x5693('0x1c')](_0x5693('0x1d'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise['resolve']()[_0x5693('0x1e')](user[_0x5693('0x1f')]())[_0x5693('0x1e')](realtime[_0x5693('0x20')]())[_0x5693('0x1e')](user['getTelephones']())['then'](realtime[_0x5693('0x21')]())[_0x5693('0x1e')](trunk[_0x5693('0x22')]())[_0x5693('0x1e')](realtime[_0x5693('0x23')]())['then'](voiceQueue[_0x5693('0x24')]())['then'](realtime[_0x5693('0x25')]())['then'](trigger[_0x5693('0x26')]())[_0x5693('0x1e')](realtime[_0x5693('0x27')]())[_0x5693('0x1e')](template[_0x5693('0x28')]())['then'](realtime['initTemplates']())[_0x5693('0x1e')](zendesk[_0x5693('0x29')]())['then'](realtime[_0x5693('0x2a')]())[_0x5693('0x1e')](salesforce[_0x5693('0x2b')]())[_0x5693('0x1e')](realtime[_0x5693('0x2c')]())[_0x5693('0x1e')](sugarcrm[_0x5693('0x2d')]())[_0x5693('0x1e')](realtime['initSugarcrmAccounts']())[_0x5693('0x1e')](freshdesk['getFreshdeskAccounts']())['then'](realtime[_0x5693('0x2e')]())[_0x5693('0x1e')](desk[_0x5693('0x2f')]())['then'](realtime[_0x5693('0x30')]())[_0x5693('0x1e')](zoho[_0x5693('0x31')]())[_0x5693('0x1e')](realtime['initZohoAccounts']())[_0x5693('0x1e')](vtiger[_0x5693('0x32')]())[_0x5693('0x1e')](realtime[_0x5693('0x33')]())['then'](freshsales['getFreshsalesAccounts']())[_0x5693('0x1e')](realtime[_0x5693('0x34')]())[_0x5693('0x1e')](servicenow[_0x5693('0x35')]())[_0x5693('0x1e')](realtime[_0x5693('0x36')]())[_0x5693('0x1e')](dynamics365[_0x5693('0x37')]())[_0x5693('0x1e')](realtime[_0x5693('0x38')]())[_0x5693('0x1e')](campaign[_0x5693('0x39')]())[_0x5693('0x1e')](realtime[_0x5693('0x3a')]())['then'](voiceExtension[_0x5693('0x3b')]())['then'](realtime[_0x5693('0x3c')]())['then'](faxAccount[_0x5693('0x3d')]())[_0x5693('0x1e')](realtime[_0x5693('0x3e')]())[_0x5693('0x1e')](function(){return realtime;});}function initParams(){return BPromise[_0x5693('0x3f')]()['then'](voiceQueueReport[_0x5693('0x40')]())[_0x5693('0x1e')](realtime[_0x5693('0x41')]())[_0x5693('0x1e')](cmHopperHistory['getVoiceQueueHopperHistory']())[_0x5693('0x1e')](realtime[_0x5693('0x42')]())[_0x5693('0x1e')](cmHopperHistory[_0x5693('0x43')]())[_0x5693('0x1e')](realtime[_0x5693('0x44')]())[_0x5693('0x1e')](voiceCallReport['getVoiceCallReports']())['then'](realtime[_0x5693('0x45')]())['then'](function(_0x53b6e1){})[_0x5693('0x46')](function(_0x202c62){console[_0x5693('0x47')](_0x202c62);});}function main(){return server[_0x5693('0x48')](realtime,preview,fax)[_0x5693('0x1e')](function(_0x4686b1){return initRealtime();})[_0x5693('0x1e')](function(){return initParams();})['then'](function(){report[_0x5693('0x49')]();setInterval(initRealtime,0x1388);})[_0x5693('0x46')](function(_0x58daaf){console[_0x5693('0x47')](_0x58daaf);});}main(); \ No newline at end of file diff --git a/server/services/ami/model/agent.js b/server/services/ami/model/agent.js index fa2fd4c..c76b06b 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 _0x7d2a=['inuse','statePause','toNumber','status','interface','format','user:%s','emit','user:save','exports','lodash','util','moment','md5','../../../config/environment','redis','localhost','name','email','accountcode','fullname','state','unknown','address','mobile','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','prototype','toLowerCase'];(function(_0x5e36d1,_0x471178){var _0x950b9e=function(_0x1872f3){while(--_0x1872f3){_0x5e36d1['push'](_0x5e36d1['shift']());}};_0x950b9e(++_0x471178);}(_0x7d2a,0x112));var _0xa7d2=function(_0x3c2570,_0x2c95d7){_0x3c2570=_0x3c2570-0x0;var _0x445df1=_0x7d2a[_0x3c2570];return _0x445df1;};'use strict';var _=require(_0xa7d2('0x0'));var util=require(_0xa7d2('0x1'));var moment=require(_0xa7d2('0x2'));var md5=require(_0xa7d2('0x3'));var Redis=require('ioredis');var config=require(_0xa7d2('0x4'));config[_0xa7d2('0x5')]=_['defaults'](config[_0xa7d2('0x5')],{'host':_0xa7d2('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xa7d2('0x5')]));function Agent(_0x39200e){this['id']=_0x39200e['id']||0x0;this['name']=_0x39200e[_0xa7d2('0x7')]||'';this[_0xa7d2('0x8')]=_0x39200e['email']||'';this['accountcode']=_0x39200e[_0xa7d2('0x9')]||'';this[_0xa7d2('0xa')]=_0x39200e[_0xa7d2('0xa')]||'';this[_0xa7d2('0xb')]='unknown';this['stateTime']=0x0;this['status']=_0xa7d2('0xc');this[_0xa7d2('0xd')]='';this['phone']='';this[_0xa7d2('0xe')]='';this['interface']='';this[_0xa7d2('0xf')]=_0x39200e[_0xa7d2('0xf')]||![];this[_0xa7d2('0x10')]=_0xa7d2('0xc');this[_0xa7d2('0x11')]=0x0;this[_0xa7d2('0x12')]='';this[_0xa7d2('0x13')]='';this[_0xa7d2('0x14')]=![];this['local']=![];this[_0xa7d2('0x3')]='';}Agent[_0xa7d2('0x15')]['updateStatusRealtime']=function(_0x3c9af3){var _0x3bc380;if(_0x3c9af3&&_0x3c9af3[_0xa7d2('0xb')]){_0x3bc380=_0x3c9af3[_0xa7d2('0xb')][_0xa7d2('0x16')]();switch(_0x3bc380){case'not_inuse':_0x3bc380='idle';break;case _0xa7d2('0x17'):_0x3bc380='talking';break;}}if(_0x3bc380&&this[_0xa7d2('0x10')]!==_0x3bc380||_0x3c9af3[_0xa7d2('0x18')]){this[_0xa7d2('0x11')]=_[_0xa7d2('0x19')](moment()['format']('x'));}if(_0x3bc380){this['voiceStatus']=_0x3bc380;}var _0x3ed4b8={'id':this['id'],'name':this[_0xa7d2('0x7')],'email':this[_0xa7d2('0x8')],'accountcode':this[_0xa7d2('0x9')],'fullname':this['fullname'],'state':this[_0xa7d2('0xb')],'stateTime':this['stateTime'],'status':this[_0xa7d2('0x1a')],'address':this[_0xa7d2('0xd')],'online':this['online'],'voiceStatus':this[_0xa7d2('0x10')],'voiceStatusTime':this[_0xa7d2('0x11')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this['voiceStatusQueue'],'interface':this[_0xa7d2('0x1b')],'onhold':this[_0xa7d2('0x14')]};var _0x2d44f7=md5(JSON['stringify'](_0x3ed4b8));if(this[_0xa7d2('0x3')]!==_0x2d44f7){this[_0xa7d2('0x3')]=_0x2d44f7;io['to'](util[_0xa7d2('0x1c')](_0xa7d2('0x1d'),_0x3ed4b8[_0xa7d2('0x7')]))[_0xa7d2('0x1e')](_0xa7d2('0x1f'),_0x3ed4b8);}};module[_0xa7d2('0x20')]=Agent; \ No newline at end of file +var _0x2bf1=['localhost','socket.io-emitter','name','email','accountcode','fullname','state','unknown','stateTime','status','address','phone','mobile','interface','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','local','prototype','updateStatusRealtime','toLowerCase','idle','inuse','talking','statePause','format','user:%s','exports','lodash','moment','md5','ioredis','redis'];(function(_0x11e2ea,_0x1d81d6){var _0x446348=function(_0x2dfef1){while(--_0x2dfef1){_0x11e2ea['push'](_0x11e2ea['shift']());}};_0x446348(++_0x1d81d6);}(_0x2bf1,0x1ab));var _0x12bf=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0x2bf1[_0x6cf19c];return _0xce14f3;};'use strict';var _=require(_0x12bf('0x0'));var util=require('util');var moment=require(_0x12bf('0x1'));var md5=require(_0x12bf('0x2'));var Redis=require(_0x12bf('0x3'));var config=require('../../../config/environment');config[_0x12bf('0x4')]=_['defaults'](config[_0x12bf('0x4')],{'host':_0x12bf('0x5'),'port':0x18eb});var io=require(_0x12bf('0x6'))(new Redis(config[_0x12bf('0x4')]));function Agent(_0x25ccf1){this['id']=_0x25ccf1['id']||0x0;this[_0x12bf('0x7')]=_0x25ccf1[_0x12bf('0x7')]||'';this['email']=_0x25ccf1[_0x12bf('0x8')]||'';this[_0x12bf('0x9')]=_0x25ccf1['accountcode']||'';this[_0x12bf('0xa')]=_0x25ccf1[_0x12bf('0xa')]||'';this[_0x12bf('0xb')]=_0x12bf('0xc');this[_0x12bf('0xd')]=0x0;this[_0x12bf('0xe')]=_0x12bf('0xc');this[_0x12bf('0xf')]='';this[_0x12bf('0x10')]='';this[_0x12bf('0x11')]='';this[_0x12bf('0x12')]='';this[_0x12bf('0x13')]=_0x25ccf1['online']||![];this[_0x12bf('0x14')]=_0x12bf('0xc');this[_0x12bf('0x15')]=0x0;this[_0x12bf('0x16')]='';this[_0x12bf('0x17')]='';this[_0x12bf('0x18')]=![];this[_0x12bf('0x19')]=![];this['md5']='';}Agent[_0x12bf('0x1a')][_0x12bf('0x1b')]=function(_0x3ba4da){var _0x3f5bfa;if(_0x3ba4da&&_0x3ba4da[_0x12bf('0xb')]){_0x3f5bfa=_0x3ba4da[_0x12bf('0xb')][_0x12bf('0x1c')]();switch(_0x3f5bfa){case'not_inuse':_0x3f5bfa=_0x12bf('0x1d');break;case _0x12bf('0x1e'):_0x3f5bfa=_0x12bf('0x1f');break;}}if(_0x3f5bfa&&this[_0x12bf('0x14')]!==_0x3f5bfa||_0x3ba4da[_0x12bf('0x20')]){this[_0x12bf('0x15')]=_['toNumber'](moment()[_0x12bf('0x21')]('x'));}if(_0x3f5bfa){this[_0x12bf('0x14')]=_0x3f5bfa;}var _0x33d8bf={'id':this['id'],'name':this[_0x12bf('0x7')],'email':this['email'],'accountcode':this[_0x12bf('0x9')],'fullname':this[_0x12bf('0xa')],'state':this[_0x12bf('0xb')],'stateTime':this[_0x12bf('0xd')],'status':this[_0x12bf('0xe')],'address':this[_0x12bf('0xf')],'online':this[_0x12bf('0x13')],'voiceStatus':this['voiceStatus'],'voiceStatusTime':this[_0x12bf('0x15')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this['voiceStatusQueue'],'interface':this[_0x12bf('0x12')],'onhold':this[_0x12bf('0x18')]};var _0x41d249=md5(JSON['stringify'](_0x33d8bf));if(this[_0x12bf('0x2')]!==_0x41d249){this[_0x12bf('0x2')]=_0x41d249;io['to'](util[_0x12bf('0x21')](_0x12bf('0x22'),_0x33d8bf['name']))['emit']('user:save',_0x33d8bf);}};module[_0x12bf('0x23')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 357d8fa..5702b12 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 _0x662b=['Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x662b,0x19e));var _0xb662=function(_0x157446,_0x1669b9){_0x157446=_0x157446-0x0;var _0x5da228=_0x662b[_0x157446];return _0x5da228;};'use strict';function Campaign(_0x731d94){this['id']=_0x731d94['id']||0x0;this[_0xb662('0x0')]=_0x731d94[_0xb662('0x0')]||'';this['type']=_0x731d94[_0xb662('0x1')]||'campaign';this[_0xb662('0x2')]=0x0;this[_0xb662('0x3')]=0x0;this[_0xb662('0x4')]=0x0;this[_0xb662('0x5')]=0x0;this[_0xb662('0x6')]='';this[_0xb662('0x7')]=!![];this[_0xb662('0x8')]=_0x731d94[_0xb662('0x8')];this[_0xb662('0x9')]=_0x731d94[_0xb662('0x9')];this['dialTimezone']=_0x731d94['dialTimezone']||null;this[_0xb662('0xa')]=_0x731d94['dialGlobalInterval']?_0x731d94[_0xb662('0xa')]:null;this[_0xb662('0xb')]=_0x731d94['dialOriginateCallerIdName'];this['dialOriginateCallerIdNumber']=_0x731d94[_0xb662('0xc')];this[_0xb662('0xd')]=_0x731d94[_0xb662('0xd')]||0x1e;this[_0xb662('0xe')]=_0x731d94[_0xb662('0xe')];this[_0xb662('0xf')]=_0x731d94[_0xb662('0xf')];this[_0xb662('0x10')]=_0x731d94[_0xb662('0x10')];this[_0xb662('0x11')]=_0x731d94[_0xb662('0x11')];this[_0xb662('0x12')]=_0x731d94[_0xb662('0x12')];this[_0xb662('0x13')]=_0x731d94[_0xb662('0x13')];this[_0xb662('0x14')]=_0x731d94['dialGlobalMaxRetry'];this[_0xb662('0x15')]=_0x731d94[_0xb662('0x15')]||0x3;this[_0xb662('0x16')]=_0x731d94[_0xb662('0x16')]||0x96;this[_0xb662('0x17')]=_0x731d94[_0xb662('0x17')]||0x3;this[_0xb662('0x18')]=_0x731d94[_0xb662('0x18')]||0x96;this['dialAbandonedMaxRetry']=_0x731d94[_0xb662('0x19')]||0x3;this['dialAbandonedRetryFrequency']=_0x731d94['dialAbandonedRetryFrequency']||0x96;this['dialMachineMaxRetry']=_0x731d94[_0xb662('0x1a')]||0x3;this[_0xb662('0x1b')]=_0x731d94['dialMachineRetryFrequency']||0x96;this[_0xb662('0x1c')]=_0x731d94[_0xb662('0x1c')]||0x3;this[_0xb662('0x1d')]=_0x731d94['dialAgentRejectRetryFrequency']||0x96;this[_0xb662('0x1e')]=_0x731d94[_0xb662('0x1e')]||'DESC';this[_0xb662('0x1f')]=_0x731d94[_0xb662('0x1f')]||undefined;this[_0xb662('0x20')]=_0x731d94[_0xb662('0x20')]||undefined;this[_0xb662('0x21')]=_0x731d94[_0xb662('0x21')]||undefined;this[_0xb662('0x22')]=_0x731d94[_0xb662('0x22')]?_0x731d94[_0xb662('0x22')]:undefined;this[_0xb662('0x23')]=_0x731d94['Trunk']?_0x731d94[_0xb662('0x23')]:undefined;this[_0xb662('0x24')]=_0x731d94[_0xb662('0x24')]?_0x731d94[_0xb662('0x24')]:undefined;this[_0xb662('0x25')]=_0x731d94[_0xb662('0x25')]?_0x731d94[_0xb662('0x25')]:undefined;this[_0xb662('0x26')]=_0x731d94[_0xb662('0x25')]?_0x731d94[_0xb662('0x25')][_0xb662('0x0')]:undefined;this[_0xb662('0x27')]=_0x731d94[_0xb662('0x27')]||![];this[_0xb662('0x28')]=_0x731d94[_0xb662('0x28')];this[_0xb662('0x29')]=_0x731d94[_0xb662('0x29')];this['dialAMDAfterGreetingSilence']=_0x731d94[_0xb662('0x2a')];this[_0xb662('0x2b')]=_0x731d94[_0xb662('0x2b')];this[_0xb662('0x2c')]=_0x731d94['dialAMDMinWordLength'];this[_0xb662('0x2d')]=_0x731d94['dialAMDBetweenWordsSilence'];this[_0xb662('0x2e')]=_0x731d94[_0xb662('0x2e')];this[_0xb662('0x2f')]=_0x731d94[_0xb662('0x2f')];this[_0xb662('0x30')]=_0x731d94['dialAMDMaximumWordLength'];}module[_0xb662('0x31')]=Campaign; \ No newline at end of file +var _0xadb3=['exports','name','type','campaign','temp','ivrTotalCallsDays','message','sendMessageOneNotActive','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength'];(function(_0x1c7262,_0xd4f081){var _0x3ded00=function(_0x44cff1){while(--_0x44cff1){_0x1c7262['push'](_0x1c7262['shift']());}};_0x3ded00(++_0xd4f081);}(_0xadb3,0xfb));var _0x3adb=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xadb3[_0x17d9e3];return _0x14192d;};'use strict';function Campaign(_0x2c1220){this['id']=_0x2c1220['id']||0x0;this[_0x3adb('0x0')]=_0x2c1220['name']||'';this[_0x3adb('0x1')]=_0x2c1220[_0x3adb('0x1')]||_0x3adb('0x2');this['originated']=0x0;this[_0x3adb('0x3')]=0x0;this['ivrAnswerCallsDay']=0x0;this[_0x3adb('0x4')]=0x0;this[_0x3adb('0x5')]='';this[_0x3adb('0x6')]=!![];this['active']=_0x2c1220['active'];this[_0x3adb('0x7')]=_0x2c1220['limitCalls'];this['dialTimezone']=_0x2c1220[_0x3adb('0x8')]||null;this[_0x3adb('0x9')]=_0x2c1220[_0x3adb('0x9')]?_0x2c1220['dialGlobalInterval']:null;this[_0x3adb('0xa')]=_0x2c1220[_0x3adb('0xa')];this[_0x3adb('0xb')]=_0x2c1220[_0x3adb('0xb')];this['dialOriginateTimeout']=_0x2c1220[_0x3adb('0xc')]||0x1e;this[_0x3adb('0xd')]=_0x2c1220[_0x3adb('0xd')];this[_0x3adb('0xe')]=_0x2c1220[_0x3adb('0xe')];this[_0x3adb('0xf')]=_0x2c1220[_0x3adb('0xf')];this['dialBusyRetryFrequency']=_0x2c1220[_0x3adb('0x10')];this['dialNoAnswerMaxRetry']=_0x2c1220[_0x3adb('0x11')];this[_0x3adb('0x12')]=_0x2c1220[_0x3adb('0x12')];this[_0x3adb('0x13')]=_0x2c1220[_0x3adb('0x13')];this[_0x3adb('0x14')]=_0x2c1220[_0x3adb('0x14')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x2c1220[_0x3adb('0x15')]||0x96;this['dialDropMaxRetry']=_0x2c1220[_0x3adb('0x16')]||0x3;this[_0x3adb('0x17')]=_0x2c1220[_0x3adb('0x17')]||0x96;this[_0x3adb('0x18')]=_0x2c1220['dialAbandonedMaxRetry']||0x3;this[_0x3adb('0x19')]=_0x2c1220['dialAbandonedRetryFrequency']||0x96;this[_0x3adb('0x1a')]=_0x2c1220[_0x3adb('0x1a')]||0x3;this[_0x3adb('0x1b')]=_0x2c1220[_0x3adb('0x1b')]||0x96;this[_0x3adb('0x1c')]=_0x2c1220[_0x3adb('0x1c')]||0x3;this[_0x3adb('0x1d')]=_0x2c1220[_0x3adb('0x1d')]||0x96;this[_0x3adb('0x1e')]=_0x2c1220[_0x3adb('0x1e')]||_0x3adb('0x1f');this[_0x3adb('0x20')]=_0x2c1220[_0x3adb('0x20')]||undefined;this['dialRandomLastDigitCallerIdNumber']=_0x2c1220[_0x3adb('0x21')]||undefined;this[_0x3adb('0x22')]=_0x2c1220[_0x3adb('0x22')]||undefined;this['TrunkBackup']=_0x2c1220[_0x3adb('0x23')]?_0x2c1220[_0x3adb('0x23')]:undefined;this[_0x3adb('0x24')]=_0x2c1220['Trunk']?_0x2c1220[_0x3adb('0x24')]:undefined;this[_0x3adb('0x25')]=_0x2c1220['Interval']?_0x2c1220['Interval']:undefined;this[_0x3adb('0x26')]=_0x2c1220['SquareProject']?_0x2c1220[_0x3adb('0x26')]:undefined;this[_0x3adb('0x27')]=_0x2c1220[_0x3adb('0x26')]?_0x2c1220['SquareProject']['name']:undefined;this[_0x3adb('0x28')]=_0x2c1220['dialAMDActive']||![];this['dialAMDInitialSilence']=_0x2c1220['dialAMDInitialSilence'];this['dialAMDGreeting']=_0x2c1220[_0x3adb('0x29')];this[_0x3adb('0x2a')]=_0x2c1220['dialAMDAfterGreetingSilence'];this[_0x3adb('0x2b')]=_0x2c1220[_0x3adb('0x2b')];this['dialAMDMinWordLength']=_0x2c1220[_0x3adb('0x2c')];this[_0x3adb('0x2d')]=_0x2c1220['dialAMDBetweenWordsSilence'];this['dialAMDMaximumNumberOfWords']=_0x2c1220[_0x3adb('0x2e')];this[_0x3adb('0x2f')]=_0x2c1220[_0x3adb('0x2f')];this[_0x3adb('0x30')]=_0x2c1220['dialAMDMaximumWordLength'];}module[_0x3adb('0x31')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 6f1b47d..a091765 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 _0xf108=['calleridname','context','uniqueid','linkedid','exten','answered','answertime','endtime','unmanaged','abandoned','lastapplication','lastdata','billableseconds','holdtime','type','tag','disposition','monitor','monitorFilename','queue','monitors','transfercalleridnum','transferconnectedlinenum','mohtime','exports','starttime','destinationchannel','calleridnum'];(function(_0xf51edd,_0x194dac){var _0x28800b=function(_0x1ecfd6){while(--_0x1ecfd6){_0xf51edd['push'](_0xf51edd['shift']());}};_0x28800b(++_0x194dac);}(_0xf108,0x1d9));var _0x8f10=function(_0x328578,_0x3cade2){_0x328578=_0x328578-0x0;var _0x4d3e5d=_0xf108[_0x328578];return _0x4d3e5d;};'use strict';function Channel(){this[_0x8f10('0x0')]=null;this['channel']='';this[_0x8f10('0x1')]='';this[_0x8f10('0x2')]=0x0;this[_0x8f10('0x3')]='';this['connectedlinenum']=undefined;this['connectedlinename']=undefined;this['accountcode']=0x0;this[_0x8f10('0x4')]='';this[_0x8f10('0x5')]=0x0;this[_0x8f10('0x6')]=0x0;this[_0x8f10('0x7')]=0x0;this[_0x8f10('0x8')]=![];this[_0x8f10('0x9')]=null;this[_0x8f10('0xa')]=null;this[_0x8f10('0xb')]=![];this[_0x8f10('0xc')]=![];this[_0x8f10('0xd')]='';this[_0x8f10('0xe')]='';this['duration']=0x0;this[_0x8f10('0xf')]=0x0;this[_0x8f10('0x10')]=0x0;this[_0x8f10('0x11')]=null;this[_0x8f10('0x12')]=null;this[_0x8f10('0x13')]=null;this[_0x8f10('0x14')]=![];this[_0x8f10('0x15')]=null;this[_0x8f10('0x16')]=null;this[_0x8f10('0x17')]=[];this[_0x8f10('0x18')]=undefined;this[_0x8f10('0x19')]=undefined;this[_0x8f10('0x1a')]=0x0;}module[_0x8f10('0x1b')]=Channel; \ No newline at end of file +var _0xce62=['unmanaged','lastapplication','lastdata','billableseconds','holdtime','type','disposition','queue','transfercalleridnum','mohtime','exports','starttime','channel','calleridnum','calleridname','connectedlinenum','connectedlinename','accountcode','context','linkedid','exten','answered','answertime','endtime'];(function(_0x44cf4f,_0x95307c){var _0x2f3780=function(_0x6e75ad){while(--_0x6e75ad){_0x44cf4f['push'](_0x44cf4f['shift']());}};_0x2f3780(++_0x95307c);}(_0xce62,0x83));var _0x2ce6=function(_0x2d8b58,_0xfbf509){_0x2d8b58=_0x2d8b58-0x0;var _0x3a3980=_0xce62[_0x2d8b58];return _0x3a3980;};'use strict';function Channel(){this[_0x2ce6('0x0')]=null;this[_0x2ce6('0x1')]='';this['destinationchannel']='';this[_0x2ce6('0x2')]=0x0;this[_0x2ce6('0x3')]='';this[_0x2ce6('0x4')]=undefined;this[_0x2ce6('0x5')]=undefined;this[_0x2ce6('0x6')]=0x0;this[_0x2ce6('0x7')]='';this['uniqueid']=0x0;this[_0x2ce6('0x8')]=0x0;this[_0x2ce6('0x9')]=0x0;this[_0x2ce6('0xa')]=![];this[_0x2ce6('0xb')]=null;this[_0x2ce6('0xc')]=null;this[_0x2ce6('0xd')]=![];this['abandoned']=![];this[_0x2ce6('0xe')]='';this[_0x2ce6('0xf')]='';this['duration']=0x0;this[_0x2ce6('0x10')]=0x0;this[_0x2ce6('0x11')]=0x0;this[_0x2ce6('0x12')]=null;this['tag']=null;this[_0x2ce6('0x13')]=null;this['monitor']=![];this['monitorFilename']=null;this[_0x2ce6('0x14')]=null;this['monitors']=[];this[_0x2ce6('0x15')]=undefined;this['transferconnectedlinenum']=undefined;this[_0x2ce6('0x16')]=0x0;}module[_0x2ce6('0x17')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index e0b3d68..7696ed7 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 _0x482d=['type','serverUrl','Configurations','exports','name','username','remoteUri','authType','password','consumerKey','consumerSecret','tokenSecret'];(function(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0x482d,0x16c));var _0xd482=function(_0x42163c,_0x2f19b5){_0x42163c=_0x42163c-0x0;var _0x4660bd=_0x482d[_0x42163c];return _0x4660bd;};'use strict';function DeskAccount(_0x15d935){this['id']=_0x15d935['id']||0x0;this['name']=_0x15d935[_0xd482('0x0')]||'';this[_0xd482('0x1')]=_0x15d935[_0xd482('0x1')]||'';this[_0xd482('0x2')]=_0x15d935[_0xd482('0x2')]||'';this[_0xd482('0x3')]=_0x15d935['authType']||'';this[_0xd482('0x4')]=_0x15d935[_0xd482('0x4')]||'';this[_0xd482('0x5')]=_0x15d935['consumerKey']||'';this[_0xd482('0x6')]=_0x15d935['consumerSecret']||'';this['token']=_0x15d935['token']||'';this[_0xd482('0x7')]=_0x15d935[_0xd482('0x7')]||'';this[_0xd482('0x8')]=_0x15d935['type']||'';this[_0xd482('0x9')]=_0x15d935[_0xd482('0x9')]||'';this[_0xd482('0xa')]=_0x15d935[_0xd482('0xa')]||{};}module[_0xd482('0xb')]=DeskAccount; \ No newline at end of file +var _0xed5f=['tokenSecret','type','serverUrl','Configurations','exports','name','username','remoteUri','authType','password','consumerKey','consumerSecret','token'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0xed5f,0x1e6));var _0xfed5=function(_0x182b31,_0x7f7a59){_0x182b31=_0x182b31-0x0;var _0x57788c=_0xed5f[_0x182b31];return _0x57788c;};'use strict';function DeskAccount(_0x51df8){this['id']=_0x51df8['id']||0x0;this[_0xfed5('0x0')]=_0x51df8[_0xfed5('0x0')]||'';this[_0xfed5('0x1')]=_0x51df8['username']||'';this[_0xfed5('0x2')]=_0x51df8[_0xfed5('0x2')]||'';this[_0xfed5('0x3')]=_0x51df8[_0xfed5('0x3')]||'';this['password']=_0x51df8[_0xfed5('0x4')]||'';this[_0xfed5('0x5')]=_0x51df8[_0xfed5('0x5')]||'';this['consumerSecret']=_0x51df8[_0xfed5('0x6')]||'';this[_0xfed5('0x7')]=_0x51df8['token']||'';this[_0xfed5('0x8')]=_0x51df8[_0xfed5('0x8')]||'';this[_0xfed5('0x9')]=_0x51df8[_0xfed5('0x9')]||'';this[_0xfed5('0xa')]=_0x51df8[_0xfed5('0xa')]||'';this[_0xfed5('0xb')]=_0x51df8[_0xfed5('0xb')]||{};}module[_0xfed5('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 b11aec5..cf5532a 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 _0xc991=['serverUrl','Configurations','exports','name','username','password','remoteUri','tenantId','clientId','clientSecret'];(function(_0x521eac,_0x5f267b){var _0x519363=function(_0x4c600d){while(--_0x4c600d){_0x521eac['push'](_0x521eac['shift']());}};_0x519363(++_0x5f267b);}(_0xc991,0xa3));var _0x1c99=function(_0x1baf8f,_0x200231){_0x1baf8f=_0x1baf8f-0x0;var _0x39dc42=_0xc991[_0x1baf8f];return _0x39dc42;};'use strict';function Dynamics365Account(_0x170b61){this['id']=_0x170b61['id']||0x0;this[_0x1c99('0x0')]=_0x170b61[_0x1c99('0x0')]||'';this[_0x1c99('0x1')]=_0x170b61[_0x1c99('0x1')]||'';this['password']=_0x170b61[_0x1c99('0x2')]||'';this[_0x1c99('0x3')]=_0x170b61['remoteUri']||'';this['tenantId']=_0x170b61[_0x1c99('0x4')]||'';this[_0x1c99('0x5')]=_0x170b61[_0x1c99('0x5')]||'';this['clientSecret']=_0x170b61[_0x1c99('0x6')]||{};this[_0x1c99('0x7')]=_0x170b61[_0x1c99('0x7')]||'';this[_0x1c99('0x8')]=_0x170b61[_0x1c99('0x8')]||{};}module[_0x1c99('0x9')]=Dynamics365Account; \ No newline at end of file +var _0x88f3=['serverUrl','Configurations','exports','name','username','password','remoteUri','tenantId','clientId','clientSecret'];(function(_0x3d4a6b,_0x20dbcb){var _0x55d64a=function(_0x220a50){while(--_0x220a50){_0x3d4a6b['push'](_0x3d4a6b['shift']());}};_0x55d64a(++_0x20dbcb);}(_0x88f3,0xd5));var _0x388f=function(_0x5f0a01,_0x37e321){_0x5f0a01=_0x5f0a01-0x0;var _0x574c08=_0x88f3[_0x5f0a01];return _0x574c08;};'use strict';function Dynamics365Account(_0x5d7a70){this['id']=_0x5d7a70['id']||0x0;this['name']=_0x5d7a70[_0x388f('0x0')]||'';this[_0x388f('0x1')]=_0x5d7a70['username']||'';this[_0x388f('0x2')]=_0x5d7a70[_0x388f('0x2')]||'';this[_0x388f('0x3')]=_0x5d7a70[_0x388f('0x3')]||'';this['tenantId']=_0x5d7a70[_0x388f('0x4')]||'';this['clientId']=_0x5d7a70[_0x388f('0x5')]||'';this[_0x388f('0x6')]=_0x5d7a70['clientSecret']||{};this['serverUrl']=_0x5d7a70[_0x388f('0x7')]||'';this[_0x388f('0x8')]=_0x5d7a70['Configurations']||{};}module[_0x388f('0x9')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index 3fede7a..3a30bab 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 _0x130d=['SIP','Trunk','ListId','key','exports','name','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech'];(function(_0x351dcb,_0x3d1108){var _0x246b4f=function(_0xa3984a){while(--_0xa3984a){_0x351dcb['push'](_0x351dcb['shift']());}};_0x246b4f(++_0x3d1108);}(_0x130d,0x19d));var _0xd130=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x130d[_0x3dd15e];return _0x231fd0;};'use strict';function FaxAccount(_0x57874c){this['id']=_0x57874c['id']||0x0;this[_0xd130('0x0')]=_0x57874c[_0xd130('0x0')]||'';this['description']=_0x57874c['description'];this[_0xd130('0x1')]=_0x57874c[_0xd130('0x1')];this[_0xd130('0x2')]=_0x57874c[_0xd130('0x2')];this[_0xd130('0x3')]=_0x57874c[_0xd130('0x3')];this[_0xd130('0x4')]=_0x57874c[_0xd130('0x4')]||0x960;this['maxrate']=_0x57874c[_0xd130('0x5')]||0x3840;this[_0xd130('0x6')]=_0x57874c['modem']||_0xd130('0x7');this['gateway']=_0x57874c[_0xd130('0x8')]||'no';this[_0xd130('0x9')]=_0x57874c[_0xd130('0x9')]||'no';this['t38timeout']=_0x57874c[_0xd130('0xa')]||0x1388;this['tech']=_0x57874c[_0xd130('0xb')]||_0xd130('0xc');this[_0xd130('0xd')]=_0x57874c['Trunk']?_0x57874c[_0xd130('0xd')]:undefined;this[_0xd130('0xe')]=_0x57874c[_0xd130('0xe')];this[_0xd130('0xf')]=_0x57874c[_0xd130('0xf')];}module[_0xd130('0x10')]=FaxAccount; \ No newline at end of file +var _0xc95d=['modem','v17,v27,v29','gateway','t38timeout','tech','SIP','Trunk','ListId','key','exports','name','description','localstationid','minrate','maxrate'];(function(_0x422e1c,_0x1ee46d){var _0x3adca3=function(_0x18db05){while(--_0x18db05){_0x422e1c['push'](_0x422e1c['shift']());}};_0x3adca3(++_0x1ee46d);}(_0xc95d,0xa0));var _0xdc95=function(_0x368c5a,_0x320d86){_0x368c5a=_0x368c5a-0x0;var _0x1b4d72=_0xc95d[_0x368c5a];return _0x1b4d72;};'use strict';function FaxAccount(_0x23c213){this['id']=_0x23c213['id']||0x0;this['name']=_0x23c213[_0xdc95('0x0')]||'';this['description']=_0x23c213[_0xdc95('0x1')];this['ecm']=_0x23c213['ecm'];this['headerinfo']=_0x23c213['headerinfo'];this[_0xdc95('0x2')]=_0x23c213['localstationid'];this['minrate']=_0x23c213[_0xdc95('0x3')]||0x960;this['maxrate']=_0x23c213[_0xdc95('0x4')]||0x3840;this[_0xdc95('0x5')]=_0x23c213[_0xdc95('0x5')]||_0xdc95('0x6');this[_0xdc95('0x7')]=_0x23c213['gateway']||'no';this['faxdetect']=_0x23c213['faxdetect']||'no';this[_0xdc95('0x8')]=_0x23c213['t38timeout']||0x1388;this['tech']=_0x23c213[_0xdc95('0x9')]||_0xdc95('0xa');this[_0xdc95('0xb')]=_0x23c213[_0xdc95('0xb')]?_0x23c213['Trunk']:undefined;this[_0xdc95('0xc')]=_0x23c213[_0xdc95('0xc')];this[_0xdc95('0xd')]=_0x23c213[_0xdc95('0xd')];}module[_0xdc95('0xe')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index ebacff6..b088d6d 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 _0x6a4b=['username','apiKey','token','remoteUri','Configurations','exports','name'];(function(_0x28bed8,_0x128876){var _0x36aac2=function(_0x1e76aa){while(--_0x1e76aa){_0x28bed8['push'](_0x28bed8['shift']());}};_0x36aac2(++_0x128876);}(_0x6a4b,0x133));var _0xb6a4=function(_0x565ed7,_0x398228){_0x565ed7=_0x565ed7-0x0;var _0x183ad7=_0x6a4b[_0x565ed7];return _0x183ad7;};'use strict';function FreshdeskAccount(_0x4f26e0){this['id']=_0x4f26e0['id']||0x0;this[_0xb6a4('0x0')]=_0x4f26e0[_0xb6a4('0x0')]||'';this[_0xb6a4('0x1')]=_0x4f26e0[_0xb6a4('0x1')]||'';this[_0xb6a4('0x2')]=_0x4f26e0[_0xb6a4('0x3')]||'';this[_0xb6a4('0x4')]=_0x4f26e0[_0xb6a4('0x4')]||'';this['serverUrl']=_0x4f26e0['serverUrl']||'';this[_0xb6a4('0x5')]=_0x4f26e0[_0xb6a4('0x5')]||{};}module[_0xb6a4('0x6')]=FreshdeskAccount; \ No newline at end of file +var _0xae7d=['exports','name','username','token','remoteUri','serverUrl','Configurations'];(function(_0x15efa9,_0x4e464e){var _0x562ed8=function(_0x36c4aa){while(--_0x36c4aa){_0x15efa9['push'](_0x15efa9['shift']());}};_0x562ed8(++_0x4e464e);}(_0xae7d,0x1e4));var _0xdae7=function(_0x535386,_0xbeebb6){_0x535386=_0x535386-0x0;var _0x1c074a=_0xae7d[_0x535386];return _0x1c074a;};'use strict';function FreshdeskAccount(_0x3781c5){this['id']=_0x3781c5['id']||0x0;this[_0xdae7('0x0')]=_0x3781c5[_0xdae7('0x0')]||'';this[_0xdae7('0x1')]=_0x3781c5[_0xdae7('0x1')]||'';this['apiKey']=_0x3781c5[_0xdae7('0x2')]||'';this[_0xdae7('0x3')]=_0x3781c5[_0xdae7('0x3')]||'';this[_0xdae7('0x4')]=_0x3781c5[_0xdae7('0x4')]||'';this[_0xdae7('0x5')]=_0x3781c5[_0xdae7('0x5')]||{};}module[_0xdae7('0x6')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index 7fef408..e33c016 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 _0xaa10=['username','apiKey','token','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xaa10,0x107));var _0x0aa1=function(_0x3e039b,_0x422665){_0x3e039b=_0x3e039b-0x0;var _0x3210be=_0xaa10[_0x3e039b];return _0x3210be;};'use strict';function FreshsalesAccount(_0x43bb21){this['id']=_0x43bb21['id']||0x0;this[_0x0aa1('0x0')]=_0x43bb21[_0x0aa1('0x0')]||'';this[_0x0aa1('0x1')]=_0x43bb21[_0x0aa1('0x1')]||'';this[_0x0aa1('0x2')]=_0x43bb21[_0x0aa1('0x3')]||'';this['remoteUri']=_0x43bb21[_0x0aa1('0x4')]||'';this[_0x0aa1('0x5')]=_0x43bb21[_0x0aa1('0x5')]||'';this[_0x0aa1('0x6')]=_0x43bb21['Configurations']||{};}module[_0x0aa1('0x7')]=FreshsalesAccount; \ No newline at end of file +var _0x2d90=['username','apiKey','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x301efe,_0x338d14){var _0x5d44c3=function(_0x10a315){while(--_0x10a315){_0x301efe['push'](_0x301efe['shift']());}};_0x5d44c3(++_0x338d14);}(_0x2d90,0x84));var _0x02d9=function(_0x27d9d1,_0x4dc76f){_0x27d9d1=_0x27d9d1-0x0;var _0x542fb7=_0x2d90[_0x27d9d1];return _0x542fb7;};'use strict';function FreshsalesAccount(_0x32820a){this['id']=_0x32820a['id']||0x0;this['name']=_0x32820a[_0x02d9('0x0')]||'';this['username']=_0x32820a[_0x02d9('0x1')]||'';this[_0x02d9('0x2')]=_0x32820a['token']||'';this[_0x02d9('0x3')]=_0x32820a[_0x02d9('0x3')]||'';this[_0x02d9('0x4')]=_0x32820a[_0x02d9('0x4')]||'';this[_0x02d9('0x5')]=_0x32820a['Configurations']||{};}module[_0x02d9('0x6')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index 6e360a8..fae6681 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 _0x0065=['queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition','channel','connectedlinenum','connectedlinename','accountcode','context','exten','priority','holdtime','assigned','mohtime','variables','exports','inbound','uniqueid','calleridnum','calleridname','queuecallerleaveAt','position','count'];(function(_0x3a29d2,_0x14baf5){var _0x5bfeeb=function(_0x1fd310){while(--_0x1fd310){_0x3a29d2['push'](_0x3a29d2['shift']());}};_0x5bfeeb(++_0x14baf5);}(_0x0065,0x7b));var _0x5006=function(_0x1760e9,_0xbbfd0b){_0x1760e9=_0x1760e9-0x0;var _0x3fe586=_0x0065[_0x1760e9];return _0x3fe586;};'use strict';function QueueReport(){this['type']=_0x5006('0x0');this[_0x5006('0x1')]='';this[_0x5006('0x2')]='';this[_0x5006('0x3')]='';this['queue']='';this['queuecallerjoinAt']=null;this[_0x5006('0x4')]=null;this[_0x5006('0x5')]=0x1;this[_0x5006('0x6')]=0x1;this[_0x5006('0x7')]=![];this[_0x5006('0x8')]=null;this[_0x5006('0x9')]=![];this[_0x5006('0xa')]=null;this[_0x5006('0xb')]=![];this[_0x5006('0xc')]=null;this[_0x5006('0xd')]=0x1;this[_0x5006('0xe')]='';this[_0x5006('0xf')]='';this[_0x5006('0x10')]='';this[_0x5006('0x11')]='';this[_0x5006('0x12')]='';this[_0x5006('0x13')]='';this[_0x5006('0x14')]='';this[_0x5006('0x15')]=0x0;this[_0x5006('0x16')]=![];this['lastAssignedTo']='';this[_0x5006('0x17')]=0x0;this[_0x5006('0x18')]={};}module[_0x5006('0x19')]=QueueReport; \ No newline at end of file +var _0xd2ad=['queuecallerleaveAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition','channel','connectedlinenum','connectedlinename','accountcode','context','priority','holdtime','assigned','lastAssignedTo','variables','exports','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt'];(function(_0x6c5bda,_0x50bc11){var _0x4d6279=function(_0x50ff16){while(--_0x50ff16){_0x6c5bda['push'](_0x6c5bda['shift']());}};_0x4d6279(++_0x50bc11);}(_0xd2ad,0x1b5));var _0xdd2a=function(_0x55ff3e,_0x41077f){_0x55ff3e=_0x55ff3e-0x0;var _0x2709eb=_0xd2ad[_0x55ff3e];return _0x2709eb;};'use strict';function QueueReport(){this['type']='inbound';this[_0xdd2a('0x0')]='';this[_0xdd2a('0x1')]='';this[_0xdd2a('0x2')]='';this[_0xdd2a('0x3')]='';this[_0xdd2a('0x4')]=null;this[_0xdd2a('0x5')]=null;this[_0xdd2a('0x6')]=0x1;this[_0xdd2a('0x7')]=0x1;this[_0xdd2a('0x8')]=![];this[_0xdd2a('0x9')]=null;this[_0xdd2a('0xa')]=![];this[_0xdd2a('0xb')]=null;this[_0xdd2a('0xc')]=![];this[_0xdd2a('0xd')]=null;this[_0xdd2a('0xe')]=0x1;this[_0xdd2a('0xf')]='';this[_0xdd2a('0x10')]='';this[_0xdd2a('0x11')]='';this[_0xdd2a('0x12')]='';this[_0xdd2a('0x13')]='';this['exten']='';this[_0xdd2a('0x14')]='';this[_0xdd2a('0x15')]=0x0;this[_0xdd2a('0x16')]=![];this[_0xdd2a('0x17')]='';this['mohtime']=0x0;this[_0xdd2a('0x18')]={};}module[_0xdd2a('0x19')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 7ac4026..0ba5a4c 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 _0xcd43=['securityToken','type','serverUrl','Configurations','exports','username','remoteUri','password','clientId','clientSecret'];(function(_0x1203f,_0x554bbc){var _0x365f0a=function(_0x3531d0){while(--_0x3531d0){_0x1203f['push'](_0x1203f['shift']());}};_0x365f0a(++_0x554bbc);}(_0xcd43,0x181));var _0x3cd4=function(_0xf27a6d,_0x46bff2){_0xf27a6d=_0xf27a6d-0x0;var _0x25961f=_0xcd43[_0xf27a6d];return _0x25961f;};'use strict';function SalesforceAccount(_0xa5fc10){this['id']=_0xa5fc10['id']||0x0;this['name']=_0xa5fc10['name']||'';this[_0x3cd4('0x0')]=_0xa5fc10[_0x3cd4('0x0')]||'';this[_0x3cd4('0x1')]=_0xa5fc10['remoteUri']||'';this[_0x3cd4('0x2')]=_0xa5fc10[_0x3cd4('0x2')]||'';this[_0x3cd4('0x3')]=_0xa5fc10[_0x3cd4('0x3')]||'';this[_0x3cd4('0x4')]=_0xa5fc10['clientSecret']||'';this[_0x3cd4('0x5')]=_0xa5fc10[_0x3cd4('0x5')]||'';this['type']=_0xa5fc10[_0x3cd4('0x6')]||'integrationTab';this[_0x3cd4('0x7')]=_0xa5fc10[_0x3cd4('0x7')]||'';this[_0x3cd4('0x8')]=_0xa5fc10[_0x3cd4('0x8')]||{};}module[_0x3cd4('0x9')]=SalesforceAccount; \ No newline at end of file +var _0x34d2=['integrationTab','name','username','remoteUri','password','clientId','securityToken','type'];(function(_0x417f34,_0x29de2a){var _0x4c65ed=function(_0x31c3c4){while(--_0x31c3c4){_0x417f34['push'](_0x417f34['shift']());}};_0x4c65ed(++_0x29de2a);}(_0x34d2,0x89));var _0x234d=function(_0x3a743e,_0x5c15f7){_0x3a743e=_0x3a743e-0x0;var _0x5a553f=_0x34d2[_0x3a743e];return _0x5a553f;};'use strict';function SalesforceAccount(_0x18468c){this['id']=_0x18468c['id']||0x0;this[_0x234d('0x0')]=_0x18468c[_0x234d('0x0')]||'';this[_0x234d('0x1')]=_0x18468c[_0x234d('0x1')]||'';this[_0x234d('0x2')]=_0x18468c['remoteUri']||'';this[_0x234d('0x3')]=_0x18468c[_0x234d('0x3')]||'';this[_0x234d('0x4')]=_0x18468c[_0x234d('0x4')]||'';this['clientSecret']=_0x18468c['clientSecret']||'';this[_0x234d('0x5')]=_0x18468c[_0x234d('0x5')]||'';this[_0x234d('0x6')]=_0x18468c[_0x234d('0x6')]||_0x234d('0x7');this['serverUrl']=_0x18468c['serverUrl']||'';this['Configurations']=_0x18468c['Configurations']||{};}module['exports']=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index 02bbdb3..3a544b8 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 _0x64d4=['remoteUri','serverUrl','Configurations','exports','name','password'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x64d4,0x94));var _0x464d=function(_0xca44f,_0x3a01af){_0xca44f=_0xca44f-0x0;var _0x17ee70=_0x64d4[_0xca44f];return _0x17ee70;};'use strict';function ServicenowAccount(_0x4581ed){this['id']=_0x4581ed['id']||0x0;this[_0x464d('0x0')]=_0x4581ed[_0x464d('0x0')]||'';this['username']=_0x4581ed['username']||'';this[_0x464d('0x1')]=_0x4581ed[_0x464d('0x1')]||'';this[_0x464d('0x2')]=_0x4581ed[_0x464d('0x2')]||'';this[_0x464d('0x3')]=_0x4581ed[_0x464d('0x3')]||'';this[_0x464d('0x4')]=_0x4581ed[_0x464d('0x4')]||{};}module[_0x464d('0x5')]=ServicenowAccount; \ No newline at end of file +var _0x684c=['remoteUri','serverUrl','Configurations','exports','name','username','password'];(function(_0xdeefbd,_0x9e1b3d){var _0x4ff63f=function(_0x4b51f9){while(--_0x4b51f9){_0xdeefbd['push'](_0xdeefbd['shift']());}};_0x4ff63f(++_0x9e1b3d);}(_0x684c,0x193));var _0xc684=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x684c[_0x3dd15e];return _0x231fd0;};'use strict';function ServicenowAccount(_0x506c4a){this['id']=_0x506c4a['id']||0x0;this[_0xc684('0x0')]=_0x506c4a[_0xc684('0x0')]||'';this[_0xc684('0x1')]=_0x506c4a[_0xc684('0x1')]||'';this[_0xc684('0x2')]=_0x506c4a['password']||'';this[_0xc684('0x3')]=_0x506c4a['remoteUri']||'';this['serverUrl']=_0x506c4a[_0xc684('0x4')]||'';this[_0xc684('0x5')]=_0x506c4a[_0xc684('0x5')]||{};}module[_0xc684('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 c0774c5..f271d08 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 _0xea2e=['remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x3c2652,_0xc99104){var _0x583f7c=function(_0x35ef75){while(--_0x35ef75){_0x3c2652['push'](_0x3c2652['shift']());}};_0x583f7c(++_0xc99104);}(_0xea2e,0x14e));var _0xeea2=function(_0x1bfd9c,_0x51ebd4){_0x1bfd9c=_0x1bfd9c-0x0;var _0x3f6321=_0xea2e[_0x1bfd9c];return _0x3f6321;};'use strict';function SugarcrmAccount(_0x2ba9d8){this['id']=_0x2ba9d8['id']||0x0;this[_0xeea2('0x0')]=_0x2ba9d8[_0xeea2('0x0')]||'';this[_0xeea2('0x1')]=_0x2ba9d8[_0xeea2('0x1')]||'';this['password']=_0x2ba9d8['password']||'';this['remoteUri']=_0x2ba9d8[_0xeea2('0x2')]||'';this[_0xeea2('0x3')]=_0x2ba9d8[_0xeea2('0x3')]||'';this[_0xeea2('0x4')]=_0x2ba9d8['Configurations']||{};}module[_0xeea2('0x5')]=SugarcrmAccount; \ No newline at end of file +var _0x71f2=['Configurations','exports','name','username','password','remoteUri','serverUrl'];(function(_0x3c169a,_0x6f346e){var _0x42a095=function(_0x2396fd){while(--_0x2396fd){_0x3c169a['push'](_0x3c169a['shift']());}};_0x42a095(++_0x6f346e);}(_0x71f2,0x18a));var _0x271f=function(_0x565c4e,_0x2b7462){_0x565c4e=_0x565c4e-0x0;var _0x35ad81=_0x71f2[_0x565c4e];return _0x35ad81;};'use strict';function SugarcrmAccount(_0x3ea934){this['id']=_0x3ea934['id']||0x0;this[_0x271f('0x0')]=_0x3ea934[_0x271f('0x0')]||'';this[_0x271f('0x1')]=_0x3ea934[_0x271f('0x1')]||'';this[_0x271f('0x2')]=_0x3ea934[_0x271f('0x2')]||'';this[_0x271f('0x3')]=_0x3ea934[_0x271f('0x3')]||'';this['serverUrl']=_0x3ea934[_0x271f('0x4')]||'';this[_0x271f('0x5')]=_0x3ea934[_0x271f('0x5')]||{};}module[_0x271f('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 2de3777..adeec79 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 _0xdbc7=['exports','accountcode','state','unknown','status','address'];(function(_0x2aaa12,_0x2c36df){var _0xeb48ff=function(_0x3a2640){while(--_0x3a2640){_0x2aaa12['push'](_0x2aaa12['shift']());}};_0xeb48ff(++_0x2c36df);}(_0xdbc7,0x11b));var _0x7dbc=function(_0x471448,_0x1c0e9e){_0x471448=_0x471448-0x0;var _0x38190b=_0xdbc7[_0x471448];return _0x38190b;};'use strict';function Telephone(_0x28b584){this['id']=_0x28b584['id']||0x0;this['name']=_0x28b584['name']||'';this[_0x7dbc('0x0')]=_0x28b584[_0x7dbc('0x0')]||'';this[_0x7dbc('0x1')]=_0x7dbc('0x2');this['stateTime']=0x0;this[_0x7dbc('0x3')]='unknown';this[_0x7dbc('0x4')]='';}module[_0x7dbc('0x5')]=Telephone; \ No newline at end of file +var _0xc6f8=['stateTime','status','unknown','address','name','accountcode','state'];(function(_0x171932,_0x3db85c){var _0x44bc97=function(_0x3cc614){while(--_0x3cc614){_0x171932['push'](_0x171932['shift']());}};_0x44bc97(++_0x3db85c);}(_0xc6f8,0x19a));var _0x8c6f=function(_0x251432,_0x4fcbce){_0x251432=_0x251432-0x0;var _0x48210a=_0xc6f8[_0x251432];return _0x48210a;};'use strict';function Telephone(_0x4ed3f0){this['id']=_0x4ed3f0['id']||0x0;this[_0x8c6f('0x0')]=_0x4ed3f0['name']||'';this[_0x8c6f('0x1')]=_0x4ed3f0[_0x8c6f('0x1')]||'';this[_0x8c6f('0x2')]='unknown';this[_0x8c6f('0x3')]=0x0;this[_0x8c6f('0x4')]=_0x8c6f('0x5');this[_0x8c6f('0x6')]='';}module['exports']=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index f4a927f..0b608c8 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 _0x5f7d=['exports','name','html'];(function(_0x2b8a32,_0x54f1b5){var _0x5b410a=function(_0x4e7693){while(--_0x4e7693){_0x2b8a32['push'](_0x2b8a32['shift']());}};_0x5b410a(++_0x54f1b5);}(_0x5f7d,0x6d));var _0xd5f7=function(_0x18551d,_0x163c41){_0x18551d=_0x18551d-0x0;var _0x448d72=_0x5f7d[_0x18551d];return _0x448d72;};'use strict';function template(_0x5e009d){this['id']=_0x5e009d['id']||0x0;this[_0xd5f7('0x0')]=_0x5e009d[_0xd5f7('0x0')]||'';this[_0xd5f7('0x1')]=_0x5e009d['html']||'';}module[_0xd5f7('0x2')]=template; \ No newline at end of file +var _0x5de5=['html','name'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5de5,0x133));var _0x55de=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x5de5[_0x5b644e];return _0x49c6bf;};'use strict';function template(_0x378163){this['id']=_0x378163['id']||0x0;this[_0x55de('0x0')]=_0x378163[_0x55de('0x0')]||'';this[_0x55de('0x1')]=_0x378163[_0x55de('0x1')]||'';}module['exports']=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index d8885f7..8346ab2 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 _0x34e8=['channel','voice','status','AllConditions','AnyConditions','Actions','name'];(function(_0x185860,_0x5b276e){var _0x15bf16=function(_0x21751b){while(--_0x21751b){_0x185860['push'](_0x185860['shift']());}};_0x15bf16(++_0x5b276e);}(_0x34e8,0x12c));var _0x834e=function(_0x515963,_0x57cd16){_0x515963=_0x515963-0x0;var _0x5e3268=_0x34e8[_0x515963];return _0x5e3268;};'use strict';function Trigger(_0x26715f){this['id']=_0x26715f['id']||0x0;this[_0x834e('0x0')]=_0x26715f[_0x834e('0x0')]||'';this[_0x834e('0x1')]=_0x26715f['channel']||_0x834e('0x2');this[_0x834e('0x3')]=_0x26715f[_0x834e('0x3')]||![];this[_0x834e('0x4')]=_0x26715f[_0x834e('0x4')]||[];this[_0x834e('0x5')]=_0x26715f[_0x834e('0x5')]||[];this['Actions']=_0x26715f[_0x834e('0x6')]||[];}module['exports']=Trigger; \ No newline at end of file +var _0xedd9=['name','channel','voice','status','AllConditions','AnyConditions','Actions'];(function(_0x401617,_0x58e763){var _0x3ca37e=function(_0x2937df){while(--_0x2937df){_0x401617['push'](_0x401617['shift']());}};_0x3ca37e(++_0x58e763);}(_0xedd9,0xfc));var _0x9edd=function(_0x31b72b,_0xc7a295){_0x31b72b=_0x31b72b-0x0;var _0x1a01bb=_0xedd9[_0x31b72b];return _0x1a01bb;};'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 11763e8..ecd3f05 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 _0x38ef=['address','exports','active','name','state','unknown','registry','indexOf','split','host','port','domainport','refresh','stateRegistry','registrationtime'];(function(_0x1ea987,_0x180034){var _0x132e70=function(_0x4e2f59){while(--_0x4e2f59){_0x1ea987['push'](_0x1ea987['shift']());}};_0x132e70(++_0x180034);}(_0x38ef,0x13d));var _0xf38e=function(_0x440591,_0x268022){_0x440591=_0x440591-0x0;var _0x1c72db=_0x38ef[_0x440591];return _0x1c72db;};'use strict';function Trunk(_0x9062ab){this['id']=_0x9062ab['id']||0x0;this['active']=_0x9062ab[_0xf38e('0x0')]||![];this['name']=_0x9062ab[_0xf38e('0x1')]||'';this[_0xf38e('0x2')]='unknown';this['stateTime']=0x0;this['status']=_0xf38e('0x3');this[_0xf38e('0x4')]=_0x9062ab[_0xf38e('0x4')]&&_0x9062ab[_0xf38e('0x4')][_0xf38e('0x5')](':')?_0x9062ab[_0xf38e('0x4')][_0xf38e('0x6')](':')[0x0]:'';this[_0xf38e('0x7')]='';this[_0xf38e('0x8')]='';this['domain']='';this[_0xf38e('0x9')]='';this[_0xf38e('0xa')]='';this[_0xf38e('0xb')]='unknown';this[_0xf38e('0xc')]='';this[_0xf38e('0xd')]='';}module[_0xf38e('0xe')]=Trunk; \ No newline at end of file +var _0xdd89=['stateTime','status','registry','split','host','port','domainport','refresh','stateRegistry','registrationtime','exports','active','name','unknown'];(function(_0x5ce8b9,_0x5cded8){var _0xe34be0=function(_0xe3d4e5){while(--_0xe3d4e5){_0x5ce8b9['push'](_0x5ce8b9['shift']());}};_0xe34be0(++_0x5cded8);}(_0xdd89,0xf9));var _0x9dd8=function(_0x199bc4,_0x338105){_0x199bc4=_0x199bc4-0x0;var _0x136ffb=_0xdd89[_0x199bc4];return _0x136ffb;};'use strict';function Trunk(_0x4bdc21){this['id']=_0x4bdc21['id']||0x0;this['active']=_0x4bdc21[_0x9dd8('0x0')]||![];this[_0x9dd8('0x1')]=_0x4bdc21[_0x9dd8('0x1')]||'';this['state']=_0x9dd8('0x2');this[_0x9dd8('0x3')]=0x0;this[_0x9dd8('0x4')]='unknown';this[_0x9dd8('0x5')]=_0x4bdc21[_0x9dd8('0x5')]&&_0x4bdc21[_0x9dd8('0x5')]['indexOf'](':')?_0x4bdc21[_0x9dd8('0x5')][_0x9dd8('0x6')](':')[0x0]:'';this[_0x9dd8('0x7')]='';this[_0x9dd8('0x8')]='';this['domain']='';this[_0x9dd8('0x9')]='';this[_0x9dd8('0xa')]='';this[_0x9dd8('0xb')]=_0x9dd8('0x2');this[_0x9dd8('0xc')]='';this['address']='';}module[_0x9dd8('0xd')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index 31f02df..25616b8 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 _0xe477=['recordingFormat','none','mandatoryDisposition','exports','exten'];(function(_0x1f6f84,_0x2bab55){var _0x177f40=function(_0x384ab4){while(--_0x384ab4){_0x1f6f84['push'](_0x1f6f84['shift']());}};_0x177f40(++_0x2bab55);}(_0xe477,0x1e9));var _0x7e47=function(_0x164af1,_0x3cf772){_0x164af1=_0x164af1-0x0;var _0x5d81a2=_0xe477[_0x164af1];return _0x5d81a2;};'use strict';function voiceExtension(_0x57334b){this['id']=_0x57334b['id']||0x0;this[_0x7e47('0x0')]=_0x57334b[_0x7e47('0x0')]||'';this['recordingFormat']=_0x57334b[_0x7e47('0x1')]||_0x7e47('0x2');this[_0x7e47('0x3')]=_0x57334b[_0x7e47('0x3')]||![];}module[_0x7e47('0x4')]=voiceExtension; \ No newline at end of file +var _0x8517=['recordingFormat','none','mandatoryDisposition','exten'];(function(_0x513eb2,_0x173af1){var _0x598e8e=function(_0x1f5b55){while(--_0x1f5b55){_0x513eb2['push'](_0x513eb2['shift']());}};_0x598e8e(++_0x173af1);}(_0x8517,0x15b));var _0x7851=function(_0x5425d9,_0xa4cfdd){_0x5425d9=_0x5425d9-0x0;var _0x43e9ae=_0x8517[_0x5425d9];return _0x43e9ae;};'use strict';function voiceExtension(_0xdea3e){this['id']=_0xdea3e['id']||0x0;this[_0x7851('0x0')]=_0xdea3e[_0x7851('0x0')]||'';this[_0x7851('0x1')]=_0xdea3e[_0x7851('0x1')]||_0x7851('0x2');this[_0x7851('0x3')]=_0xdea3e['mandatoryDisposition']||![];}module['exports']=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index ba0d34c..63490b5 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 _0xa3e2=['dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayTimeout','outboundAbandonedDay','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalPauses','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','erlangAbandonmentRate','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','mandatoryDisposition','mandatoryDispositionPause','unknown','not_inuse','inuse','busy','invalid','unavailable','ringing','ringinuse','onhold','wav','wav49','gsm','rrmemory','roundrobin','name','monitor_format','type','inbound','waiting','answered','sumDuration','sumBillable','unmanaged','abandoned','available','acw','acwTimeout','autopause','originated','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName'];(function(_0xcc2c66,_0x27cf7b){var _0x2197b2=function(_0xacbaeb){while(--_0xacbaeb){_0xcc2c66['push'](_0xcc2c66['shift']());}};_0x2197b2(++_0x27cf7b);}(_0xa3e2,0x11d));var _0x2a3e=function(_0x2f4f25,_0x592d31){_0x2f4f25=_0x2f4f25-0x0;var _0x6a112a=_0xa3e2[_0x2f4f25];return _0x6a112a;};'use strict';var statusDesc=[_0x2a3e('0x0'),_0x2a3e('0x1'),_0x2a3e('0x2'),_0x2a3e('0x3'),_0x2a3e('0x4'),_0x2a3e('0x5'),_0x2a3e('0x6'),_0x2a3e('0x7'),_0x2a3e('0x8')];var monitorFormat={'wav':_0x2a3e('0x9'),'wav49':_0x2a3e('0xa'),'gsm':_0x2a3e('0xb')};var strategy={'rrmemory':_0x2a3e('0xc'),'roundrobin':_0x2a3e('0xd')};function VoiceQueue(_0x442428){this['id']=_0x442428['id']||0x0;this[_0x2a3e('0xe')]=_0x442428['name']||'';this[_0x2a3e('0xf')]=_0x442428[_0x2a3e('0xf')]||'';this[_0x2a3e('0x10')]=_0x442428[_0x2a3e('0x10')]||_0x2a3e('0x11');this[_0x2a3e('0x12')]=0x0;this['talking']=0x0;this['total']=0x0;this[_0x2a3e('0x13')]=0x0;this[_0x2a3e('0x14')]=0x0;this['sumHoldTime']=0x0;this[_0x2a3e('0x15')]=0x0;this[_0x2a3e('0x16')]=0x0;this[_0x2a3e('0x17')]=0x0;this['loggedIn']=0x0;this[_0x2a3e('0x18')]=0x0;this[_0x2a3e('0x19')]=_0x442428[_0x2a3e('0x19')]||![];this[_0x2a3e('0x1a')]=_0x442428['acwTimeout']||0xa;this[_0x2a3e('0x1b')]=_0x442428['autopause']||'no';this['sendMessageOneNotActive']=!![];this['message']='';this[_0x2a3e('0x1c')]=0x0;this['temp']=0x0;this[_0x2a3e('0x1d')]=_0x442428[_0x2a3e('0x1d')]||null;this[_0x2a3e('0x1e')]=_0x442428[_0x2a3e('0x1e')]?_0x442428[_0x2a3e('0x1e')]:null;this[_0x2a3e('0x1f')]=_0x442428[_0x2a3e('0x1f')];this[_0x2a3e('0x20')]=_0x442428[_0x2a3e('0x20')]||_0x2a3e('0x21');this[_0x2a3e('0x22')]=_0x442428[_0x2a3e('0x22')]||0x0;this[_0x2a3e('0x23')]=_0x442428['dialLimitQueue']||0x0;this['dialPowerLevel']=_0x442428[_0x2a3e('0x24')]||0x1;this[_0x2a3e('0x25')]=_0x442428['dialPredictiveOptimization']||_0x2a3e('0x26');this[_0x2a3e('0x27')]=_0x442428['dialPredictiveOptimizationPercentage']||0.03;this[_0x2a3e('0x28')]=_0x442428[_0x2a3e('0x28')]||0x258;this[_0x2a3e('0x29')]=_0x442428['dialOriginateCallerIdName']||'anonymous';this['dialOriginateCallerIdNumber']=_0x442428['dialOriginateCallerIdNumber']||'anonymous';this[_0x2a3e('0x2a')]=_0x442428[_0x2a3e('0x2a')]||0x1e;this[_0x2a3e('0x2b')]=_0x442428[_0x2a3e('0x2b')]||_0x2a3e('0x2c');this[_0x2a3e('0x2d')]=_0x442428[_0x2a3e('0x2d')]||0x3;this[_0x2a3e('0x2e')]=_0x442428['dialQueueProject']||undefined;this['dialCongestionMaxRetry']=_0x442428[_0x2a3e('0x2f')]||0x3;this[_0x2a3e('0x30')]=_0x442428['dialCongestionRetryFrequency']||0x96;this[_0x2a3e('0x31')]=_0x442428[_0x2a3e('0x31')]||0x3;this['dialBusyRetryFrequency']=_0x442428[_0x2a3e('0x32')]||0x96;this[_0x2a3e('0x33')]=_0x442428[_0x2a3e('0x33')]||0x3;this[_0x2a3e('0x34')]=_0x442428['dialNoAnswerRetryFrequency']||0x96;this[_0x2a3e('0x35')]=_0x442428[_0x2a3e('0x35')]||0x3;this[_0x2a3e('0x36')]=_0x442428[_0x2a3e('0x36')]||0x96;this[_0x2a3e('0x37')]=_0x442428[_0x2a3e('0x37')]||0x3;this[_0x2a3e('0x38')]=_0x442428[_0x2a3e('0x38')]||0x96;this['dialAbandonedMaxRetry']=_0x442428[_0x2a3e('0x39')]||0x3;this[_0x2a3e('0x3a')]=_0x442428[_0x2a3e('0x3a')]||0x96;this[_0x2a3e('0x3b')]=_0x442428['dialMachineMaxRetry']||0x3;this['dialMachineRetryFrequency']=_0x442428['dialMachineRetryFrequency']||0x96;this['dialAgentRejectMaxRetry']=_0x442428[_0x2a3e('0x3c')]||0x3;this['dialAgentRejectRetryFrequency']=_0x442428[_0x2a3e('0x3d')]||0x96;this[_0x2a3e('0x3e')]=_0x442428[_0x2a3e('0x3e')]||0x4;this['Trunk']=_0x442428[_0x2a3e('0x3f')]?_0x442428[_0x2a3e('0x3f')]:undefined;this['TrunkBackup']=_0x442428['TrunkBackup']?_0x442428[_0x2a3e('0x40')]:undefined;this['dialPrefix']=_0x442428[_0x2a3e('0x41')]||undefined;this['Interval']=_0x442428['Interval']?_0x442428[_0x2a3e('0x42')]:undefined;this['dialOrderByScheduledAt']=_0x442428['dialOrderByScheduledAt']||'DESC';this[_0x2a3e('0x43')]=_0x442428['dialRandomLastDigitCallerIdNumber']||undefined;this[_0x2a3e('0x44')]=_0x442428[_0x2a3e('0x44')]||undefined;this['strategy']=strategy[_0x442428[_0x2a3e('0x45')]]||'rrmemory';this['queueStatusComplete']=!![];this[_0x2a3e('0x46')]=_0x442428[_0x2a3e('0x46')]||![];this[_0x2a3e('0x47')]=_0x442428[_0x2a3e('0x47')];this[_0x2a3e('0x48')]=_0x442428[_0x2a3e('0x48')];this[_0x2a3e('0x49')]=_0x442428[_0x2a3e('0x49')];this[_0x2a3e('0x4a')]=_0x442428[_0x2a3e('0x4a')];this['dialAMDMinWordLength']=_0x442428[_0x2a3e('0x4b')];this[_0x2a3e('0x4c')]=_0x442428['dialAMDBetweenWordsSilence'];this[_0x2a3e('0x4d')]=_0x442428[_0x2a3e('0x4d')];this[_0x2a3e('0x4e')]=_0x442428[_0x2a3e('0x4e')];this[_0x2a3e('0x4f')]=_0x442428[_0x2a3e('0x4f')];this['outboundRejectCallsDay']=0x0;this[_0x2a3e('0x50')]=0x0;this[_0x2a3e('0x51')]=_0x442428[_0x2a3e('0x51')];this[_0x2a3e('0x52')]=0x0;this[_0x2a3e('0x53')]=0x0;this[_0x2a3e('0x54')]=0x0;this[_0x2a3e('0x55')]=0x0;this[_0x2a3e('0x56')]=0x0;this['outboundNoSuchCallsDay']=0x0;this[_0x2a3e('0x57')]=0x0;this[_0x2a3e('0x58')]=0x0;this['outboundOriginateFailureCallsDay']=0x0;this['outboundDropCallsDayCallersExit']=0x0;this[_0x2a3e('0x59')]=0x0;this['outboundDropCallsDayACS']=0x0;this['outboundReCallsDay']=0x0;this[_0x2a3e('0x5a')]=0x0;this['startProgressive']=undefined;this[_0x2a3e('0x5b')]=undefined;this[_0x2a3e('0x5c')]=undefined;this[_0x2a3e('0x5d')]=1.05;this[_0x2a3e('0x5e')]=0x0;this[_0x2a3e('0x5f')]=0x0;this[_0x2a3e('0x60')]=0x0;this[_0x2a3e('0x61')]=0x0;this['predictiveIntervalAvgHoldtime']=0x0;this['predictiveIntervalAvgTalktime']=0x0;this[_0x2a3e('0x62')]=0x0;this['predictiveIntervalAvailable']=0x0;this[_0x2a3e('0x63')]=_0x442428[_0x2a3e('0x64')]||0x14;this['predictiveIntervalMinThreshold']=_0x442428[_0x2a3e('0x64')]||0xa;this[_0x2a3e('0x65')]=0x0;this['predictiveIntervalErlangCallsDroppedCalls']=0x0;this['predictiveIntervalHitRate']=0x1;this['erlangCalls']=0x0;this['erlangCallToSecond']=0x0;this[_0x2a3e('0x66')]=0x0;this['erlangBusyFactor']=0x0;this[_0x2a3e('0x67')]=_0x442428['dialRecallMeTimeout']||0x1e;this[_0x2a3e('0x68')]=_0x442428[_0x2a3e('0x68')]||![];this[_0x2a3e('0x69')]=_0x442428[_0x2a3e('0x69')]||undefined;this[_0x2a3e('0x6a')]=_0x442428['dialAgiAfterHangupClient']||![];this['dialAgiAfterHangupAgent']=_0x442428['dialAgiAfterHangupAgent']||![];this[_0x2a3e('0xf')]=monitorFormat[_0x442428['monitor_format']]?monitorFormat[_0x442428['monitor_format']]:undefined;this[_0x2a3e('0x6b')]=_0x442428['mandatoryDisposition']||![];this[_0x2a3e('0x6c')]=_0x442428[_0x2a3e('0x6c')]?_0x442428[_0x2a3e('0x6c')]:undefined;}module['exports']=VoiceQueue; \ No newline at end of file +var _0x1335=['unknown','not_inuse','busy','invalid','unavailable','ringing','ringinuse','onhold','gsm','rrmemory','name','monitor_format','type','waiting','talking','total','answered','sumDuration','sumHoldTime','sumBillable','abandoned','loggedIn','available','acw','autopause','sendMessageOneNotActive','message','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','anonymous','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialMachineMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause'];(function(_0x420048,_0x2c2393){var _0x4d4c73=function(_0x13b872){while(--_0x13b872){_0x420048['push'](_0x420048['shift']());}};_0x4d4c73(++_0x2c2393);}(_0x1335,0xf2));var _0x5133=function(_0x422706,_0x4c8281){_0x422706=_0x422706-0x0;var _0x1ea4bc=_0x1335[_0x422706];return _0x1ea4bc;};'use strict';var statusDesc=[_0x5133('0x0'),_0x5133('0x1'),'inuse',_0x5133('0x2'),_0x5133('0x3'),_0x5133('0x4'),_0x5133('0x5'),_0x5133('0x6'),_0x5133('0x7')];var monitorFormat={'wav':'wav','wav49':'wav49','gsm':_0x5133('0x8')};var strategy={'rrmemory':_0x5133('0x9'),'roundrobin':'roundrobin'};function VoiceQueue(_0x2314e0){this['id']=_0x2314e0['id']||0x0;this['name']=_0x2314e0[_0x5133('0xa')]||'';this[_0x5133('0xb')]=_0x2314e0[_0x5133('0xb')]||'';this['type']=_0x2314e0[_0x5133('0xc')]||'inbound';this[_0x5133('0xd')]=0x0;this[_0x5133('0xe')]=0x0;this[_0x5133('0xf')]=0x0;this[_0x5133('0x10')]=0x0;this[_0x5133('0x11')]=0x0;this[_0x5133('0x12')]=0x0;this[_0x5133('0x13')]=0x0;this['unmanaged']=0x0;this[_0x5133('0x14')]=0x0;this[_0x5133('0x15')]=0x0;this[_0x5133('0x16')]=0x0;this['acw']=_0x2314e0[_0x5133('0x17')]||![];this['acwTimeout']=_0x2314e0['acwTimeout']||0xa;this[_0x5133('0x18')]=_0x2314e0[_0x5133('0x18')]||'no';this[_0x5133('0x19')]=!![];this[_0x5133('0x1a')]='';this[_0x5133('0x1b')]=0x0;this[_0x5133('0x1c')]=0x0;this[_0x5133('0x1d')]=_0x2314e0['dialTimezone']||null;this[_0x5133('0x1e')]=_0x2314e0[_0x5133('0x1e')]?_0x2314e0[_0x5133('0x1e')]:null;this[_0x5133('0x1f')]=_0x2314e0[_0x5133('0x1f')];this[_0x5133('0x20')]=_0x2314e0[_0x5133('0x20')]||_0x5133('0x21');this[_0x5133('0x22')]=_0x2314e0[_0x5133('0x22')]||0x0;this[_0x5133('0x23')]=_0x2314e0['dialLimitQueue']||0x0;this[_0x5133('0x24')]=_0x2314e0['dialPowerLevel']||0x1;this['dialPredictiveOptimization']=_0x2314e0[_0x5133('0x25')]||_0x5133('0x26');this[_0x5133('0x27')]=_0x2314e0[_0x5133('0x27')]||0.03;this[_0x5133('0x28')]=_0x2314e0[_0x5133('0x28')]||0x258;this[_0x5133('0x29')]=_0x2314e0['dialOriginateCallerIdName']||'anonymous';this[_0x5133('0x2a')]=_0x2314e0['dialOriginateCallerIdNumber']||_0x5133('0x2b');this[_0x5133('0x2c')]=_0x2314e0[_0x5133('0x2c')]||0x1e;this[_0x5133('0x2d')]=_0x2314e0['dialQueueOptions']||_0x5133('0x2e');this[_0x5133('0x2f')]=_0x2314e0['dialQueueTimeout']||0x3;this[_0x5133('0x30')]=_0x2314e0[_0x5133('0x30')]||undefined;this['dialCongestionMaxRetry']=_0x2314e0['dialCongestionMaxRetry']||0x3;this['dialCongestionRetryFrequency']=_0x2314e0['dialCongestionRetryFrequency']||0x96;this[_0x5133('0x31')]=_0x2314e0[_0x5133('0x31')]||0x3;this['dialBusyRetryFrequency']=_0x2314e0[_0x5133('0x32')]||0x96;this['dialNoAnswerMaxRetry']=_0x2314e0[_0x5133('0x33')]||0x3;this[_0x5133('0x34')]=_0x2314e0[_0x5133('0x34')]||0x96;this['dialNoSuchNumberMaxRetry']=_0x2314e0[_0x5133('0x35')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x2314e0[_0x5133('0x36')]||0x96;this[_0x5133('0x37')]=_0x2314e0['dialDropMaxRetry']||0x3;this[_0x5133('0x38')]=_0x2314e0[_0x5133('0x38')]||0x96;this[_0x5133('0x39')]=_0x2314e0[_0x5133('0x39')]||0x3;this['dialAbandonedRetryFrequency']=_0x2314e0['dialAbandonedRetryFrequency']||0x96;this[_0x5133('0x3a')]=_0x2314e0[_0x5133('0x3a')]||0x3;this['dialMachineRetryFrequency']=_0x2314e0['dialMachineRetryFrequency']||0x96;this[_0x5133('0x3b')]=_0x2314e0[_0x5133('0x3b')]||0x3;this[_0x5133('0x3c')]=_0x2314e0['dialAgentRejectRetryFrequency']||0x96;this[_0x5133('0x3d')]=_0x2314e0[_0x5133('0x3d')]||0x4;this['Trunk']=_0x2314e0['Trunk']?_0x2314e0[_0x5133('0x3e')]:undefined;this['TrunkBackup']=_0x2314e0[_0x5133('0x3f')]?_0x2314e0[_0x5133('0x3f')]:undefined;this[_0x5133('0x40')]=_0x2314e0[_0x5133('0x40')]||undefined;this[_0x5133('0x41')]=_0x2314e0[_0x5133('0x41')]?_0x2314e0[_0x5133('0x41')]:undefined;this[_0x5133('0x42')]=_0x2314e0[_0x5133('0x42')]||_0x5133('0x43');this[_0x5133('0x44')]=_0x2314e0[_0x5133('0x44')]||undefined;this['dialCutDigit']=_0x2314e0[_0x5133('0x45')]||undefined;this[_0x5133('0x46')]=strategy[_0x2314e0['strategy']]||'rrmemory';this[_0x5133('0x47')]=!![];this[_0x5133('0x48')]=_0x2314e0[_0x5133('0x48')]||![];this['dialAMDInitialSilence']=_0x2314e0['dialAMDInitialSilence'];this[_0x5133('0x49')]=_0x2314e0[_0x5133('0x49')];this[_0x5133('0x4a')]=_0x2314e0[_0x5133('0x4a')];this[_0x5133('0x4b')]=_0x2314e0[_0x5133('0x4b')];this['dialAMDMinWordLength']=_0x2314e0[_0x5133('0x4c')];this[_0x5133('0x4d')]=_0x2314e0[_0x5133('0x4d')];this[_0x5133('0x4e')]=_0x2314e0[_0x5133('0x4e')];this[_0x5133('0x4f')]=_0x2314e0[_0x5133('0x4f')];this[_0x5133('0x50')]=_0x2314e0[_0x5133('0x50')];this[_0x5133('0x51')]=0x0;this[_0x5133('0x52')]=0x0;this['timeout']=_0x2314e0['timeout'];this[_0x5133('0x53')]=0x0;this[_0x5133('0x54')]=0x0;this[_0x5133('0x55')]=0x0;this[_0x5133('0x56')]=0x0;this[_0x5133('0x57')]=0x0;this[_0x5133('0x58')]=0x0;this[_0x5133('0x59')]=0x0;this[_0x5133('0x5a')]=0x0;this['outboundOriginateFailureCallsDay']=0x0;this[_0x5133('0x5b')]=0x0;this[_0x5133('0x5c')]=0x0;this[_0x5133('0x5d')]=0x0;this['outboundReCallsDay']=0x0;this[_0x5133('0x5e')]=0x0;this[_0x5133('0x5f')]=undefined;this[_0x5133('0x60')]=undefined;this[_0x5133('0x61')]=undefined;this[_0x5133('0x62')]=1.05;this[_0x5133('0x63')]=0x0;this[_0x5133('0x64')]=0x0;this[_0x5133('0x65')]=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this[_0x5133('0x66')]=0x0;this[_0x5133('0x67')]=0x0;this[_0x5133('0x68')]=0x0;this[_0x5133('0x69')]=0x0;this['predictiveIntervalMaxThreshold']=_0x2314e0[_0x5133('0x6a')]||0x14;this[_0x5133('0x6b')]=_0x2314e0['dialPredictiveIntervalMaxThreshold']||0xa;this[_0x5133('0x6c')]=0x0;this[_0x5133('0x6d')]=0x0;this[_0x5133('0x6e')]=0x1;this[_0x5133('0x6f')]=0x0;this['erlangCallToSecond']=0x0;this[_0x5133('0x70')]=0x0;this[_0x5133('0x71')]=0x0;this[_0x5133('0x72')]=_0x2314e0[_0x5133('0x72')]||0x1e;this[_0x5133('0x73')]=_0x2314e0[_0x5133('0x73')]||![];this[_0x5133('0x74')]=_0x2314e0[_0x5133('0x74')]||undefined;this[_0x5133('0x75')]=_0x2314e0[_0x5133('0x75')]||![];this[_0x5133('0x76')]=_0x2314e0[_0x5133('0x76')]||![];this[_0x5133('0xb')]=monitorFormat[_0x2314e0[_0x5133('0xb')]]?monitorFormat[_0x2314e0[_0x5133('0xb')]]:undefined;this[_0x5133('0x77')]=_0x2314e0[_0x5133('0x77')]||![];this[_0x5133('0x78')]=_0x2314e0[_0x5133('0x78')]?_0x2314e0[_0x5133('0x78')]:undefined;}module['exports']=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 5b6d05a..e5a04a6 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 _0x57c6=['name','username','accessKey','remoteUri','serverUrl','Configurations','exports'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x57c6,0x15e));var _0x657c=function(_0x23b36b,_0x150dce){_0x23b36b=_0x23b36b-0x0;var _0x29308a=_0x57c6[_0x23b36b];return _0x29308a;};'use strict';function VtigerAccount(_0x1995b1){this['id']=_0x1995b1['id']||0x0;this[_0x657c('0x0')]=_0x1995b1[_0x657c('0x0')]||'';this[_0x657c('0x1')]=_0x1995b1['username']||'';this[_0x657c('0x2')]=_0x1995b1[_0x657c('0x2')]||'';this[_0x657c('0x3')]=_0x1995b1[_0x657c('0x3')]||'';this[_0x657c('0x4')]=_0x1995b1[_0x657c('0x4')]||'';this[_0x657c('0x5')]=_0x1995b1['Configurations']||{};}module[_0x657c('0x6')]=VtigerAccount; \ No newline at end of file +var _0xb321=['name','username','accessKey','remoteUri','serverUrl','Configurations','exports'];(function(_0x56edbd,_0xfba84e){var _0x40ab2a=function(_0xf5a600){while(--_0xf5a600){_0x56edbd['push'](_0x56edbd['shift']());}};_0x40ab2a(++_0xfba84e);}(_0xb321,0xe7));var _0x1b32=function(_0x44bc00,_0x13a11e){_0x44bc00=_0x44bc00-0x0;var _0x3afe8a=_0xb321[_0x44bc00];return _0x3afe8a;};'use strict';function VtigerAccount(_0x4f9bb0){this['id']=_0x4f9bb0['id']||0x0;this[_0x1b32('0x0')]=_0x4f9bb0['name']||'';this[_0x1b32('0x1')]=_0x4f9bb0['username']||'';this['accessKey']=_0x4f9bb0[_0x1b32('0x2')]||'';this['remoteUri']=_0x4f9bb0[_0x1b32('0x3')]||'';this[_0x1b32('0x4')]=_0x4f9bb0[_0x1b32('0x4')]||'';this[_0x1b32('0x5')]=_0x4f9bb0[_0x1b32('0x5')]||{};}module[_0x1b32('0x6')]=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index 7eddfff..3ec2d0b 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(_0x5de063,_0x3c15ef){_0x5de063=_0x5de063-0x0;var _0x3e2c50=_0xdb28[_0x5de063];return _0x3e2c50;};'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(_0x4bc113,_0x582426){var _0x123d7a=function(_0xf88741){while(--_0xf88741){_0x4bc113['push'](_0x4bc113['shift']());}};_0x123d7a(++_0x582426);}(_0x2032,0xd9));var _0x2203=function(_0x251fa0,_0x3c7d34){_0x251fa0=_0x251fa0-0x0;var _0x2bec03=_0x2032[_0x251fa0];return _0x2bec03;};'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 737a371..632486c 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 _0x887b=['refreshToken','Configurations','name','description','host','zone','clientId','serverUrl','code'];(function(_0x3de00d,_0x1e567c){var _0xcc7452=function(_0x522739){while(--_0x522739){_0x3de00d['push'](_0x3de00d['shift']());}};_0xcc7452(++_0x1e567c);}(_0x887b,0x185));var _0xb887=function(_0x47ebb5,_0x5ee8da){_0x47ebb5=_0x47ebb5-0x0;var _0x191be0=_0x887b[_0x47ebb5];return _0x191be0;};'use strict';function ZohoAccount(_0x2b768c){this['id']=_0x2b768c['id']||0x0;this[_0xb887('0x0')]=_0x2b768c[_0xb887('0x0')]||'';this[_0xb887('0x1')]=_0x2b768c[_0xb887('0x1')]||'';this[_0xb887('0x2')]=_0x2b768c[_0xb887('0x2')]||'';this[_0xb887('0x3')]=_0x2b768c[_0xb887('0x3')]||'';this['clientId']=_0x2b768c[_0xb887('0x4')]||'';this['clientSecret']=_0x2b768c['clientSecret']||'';this['serverUrl']=_0x2b768c[_0xb887('0x5')]||'';this[_0xb887('0x6')]=_0x2b768c['code']||'';this['refreshToken']=_0x2b768c[_0xb887('0x7')]||'';this[_0xb887('0x8')]=_0x2b768c['Configurations']||{};}module['exports']=ZohoAccount; \ No newline at end of file +var _0x96f9=['exports','name','description','host','zone','clientId','clientSecret','serverUrl','code'];(function(_0x40272d,_0x12a337){var _0x4ceed4=function(_0x1a6aec){while(--_0x1a6aec){_0x40272d['push'](_0x40272d['shift']());}};_0x4ceed4(++_0x12a337);}(_0x96f9,0x64));var _0x996f=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x96f9[_0x4565bf];return _0x5610ba;};'use strict';function ZohoAccount(_0x5360a1){this['id']=_0x5360a1['id']||0x0;this[_0x996f('0x0')]=_0x5360a1[_0x996f('0x0')]||'';this[_0x996f('0x1')]=_0x5360a1[_0x996f('0x1')]||'';this[_0x996f('0x2')]=_0x5360a1[_0x996f('0x2')]||'';this[_0x996f('0x3')]=_0x5360a1[_0x996f('0x3')]||'';this['clientId']=_0x5360a1[_0x996f('0x4')]||'';this[_0x996f('0x5')]=_0x5360a1['clientSecret']||'';this[_0x996f('0x6')]=_0x5360a1[_0x996f('0x6')]||'';this[_0x996f('0x7')]=_0x5360a1['code']||'';this['refreshToken']=_0x5360a1['refreshToken']||'';this['Configurations']=_0x5360a1['Configurations']||{};}module[_0x996f('0x8')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index 10003cc..0458ef9 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 _0x8d26=['string','uniqueid','idContact','queue','name','type','dialAnswer','membername','Agent','channelAgent','format','SIP/%s','Contact','phone','lastName','active','calleridnum','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','getCaller','\x22%s\x22\x20<%s>','calleridname','util','lodash','moment','isNil'];(function(_0x4fc85a,_0x757d15){var _0x2b4735=function(_0x29bd17){while(--_0x29bd17){_0x4fc85a['push'](_0x4fc85a['shift']());}};_0x2b4735(++_0x757d15);}(_0x8d26,0xd3));var _0x68d2=function(_0x2c0557,_0x4314fd){_0x2c0557=_0x2c0557-0x0;var _0x2878cd=_0x8d26[_0x2c0557];return _0x2878cd;};'use strict';var util=require(_0x68d2('0x0'));var _=require(_0x68d2('0x1'));var moment=require(_0x68d2('0x2'));function checkNameSurname(_0x20653e,_0xd265fc,_0x4790c3){var _0x24eaf7='';if(!_[_0x68d2('0x3')](_0xd265fc)&&_0x68d2('0x4')===typeof _0xd265fc){_0x24eaf7+=_0xd265fc;}if(!_['isNil'](_0x4790c3)&&'string'===typeof _0x4790c3){_0x24eaf7+='\x20'+_0x4790c3;}if(_0x24eaf7!==''){return _0x24eaf7;}return _0x20653e;}function Action(_0x5f4398,_0x1bba7e,_0xb3eb3f,_0x32e187,_0x171ffc){this[_0x68d2('0x5')]=_0xb3eb3f||undefined;this[_0x68d2('0x6')]=_0x5f4398['id'];this[_0x68d2('0x7')]=_0x1bba7e[_0x68d2('0x8')];this[_0x68d2('0x9')]=_0x1bba7e[_0x68d2('0x9')];this['campaigntype']='queue';this[_0x68d2('0xa')]=![];this[_0x68d2('0xb')]=_[_0x68d2('0x3')](_0x5f4398[_0x68d2('0xc')])?undefined:_0x5f4398[_0x68d2('0xc')][_0x68d2('0x8')];this[_0x68d2('0xd')]=this[_0x68d2('0xb')]?util[_0x68d2('0xe')](_0x68d2('0xf'),this[_0x68d2('0xb')]):_0x32e187||undefined;this['calleridname']=checkNameSurname(_0x5f4398[_0x68d2('0x10')][_0x68d2('0x11')],_0x5f4398[_0x68d2('0x10')]['firstName'],_0x5f4398['Contact'][_0x68d2('0x12')]);this[_0x68d2('0x13')]=_0x5f4398[_0x68d2('0x13')]||![];this[_0x68d2('0x14')]=_0x5f4398[_0x68d2('0x10')][_0x68d2('0x11')];this['scheduledat']=_0x5f4398['scheduledat'];this[_0x68d2('0x15')]=_0x5f4398[_0x68d2('0x15')]||0x0;this['countcongestionretry']=_0x5f4398[_0x68d2('0x16')]||0x0;this[_0x68d2('0x17')]=_0x5f4398[_0x68d2('0x17')]||0x0;this[_0x68d2('0x18')]=(_0x5f4398[_0x68d2('0x15')]||0x0)+(_0x5f4398[_0x68d2('0x16')]||0x0)+(_0x5f4398['countnoanswerretry']||0x0)+(_0x5f4398[_0x68d2('0x19')]||0x0)+(_0x5f4398[_0x68d2('0x1a')]||0x0)+(_0x5f4398[_0x68d2('0x1b')]||0x0)+(_0x5f4398[_0x68d2('0x1c')]||0x0)+(_0x5f4398[_0x68d2('0x1d')]||0x0);this[_0x68d2('0x19')]=_0x5f4398[_0x68d2('0x19')]||0x0;this[_0x68d2('0x1a')]=_0x5f4398['countdropretry']||0x0;this[_0x68d2('0x1b')]=_0x5f4398[_0x68d2('0x1b')]||0x0;this['countmachineretry']=_0x5f4398[_0x68d2('0x1c')]||0x0;this[_0x68d2('0x1d')]=_0x5f4398[_0x68d2('0x1d')]||0x0;this[_0x68d2('0x1e')]=_0x5f4398[_0x68d2('0x1e')];this[_0x68d2('0x1f')]=_0x5f4398[_0x68d2('0x1f')];this['callbackat']=_0x5f4398[_0x68d2('0x20')];this[_0x68d2('0x21')]=_0x5f4398[_0x68d2('0x21')];this[_0x68d2('0x22')]=_0x5f4398[_0x68d2('0x22')];this[_0x68d2('0x23')]=_0x5f4398[_0x68d2('0x23')];this[_0x68d2('0x24')]=_['isNil'](_0x5f4398[_0x68d2('0xc')])?_0x5f4398[_0x68d2('0x24')]:_0x5f4398[_0x68d2('0xc')]['id'];this[_0x68d2('0x25')]=_0x5f4398[_0x68d2('0x25')];this[_0x68d2('0x26')]='';this[_0x68d2('0x27')]='';}Action['prototype'][_0x68d2('0x28')]=function(){return util['format'](_0x68d2('0x29'),this[_0x68d2('0x2a')],this['number']);};module['exports']=Action; \ No newline at end of file +var _0xa2e5=['countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','format','\x22%s\x22\x20<%s>','util','isNil','string','uniqueid','idContact','queue','name','dialAnswer','membername','Agent','channelAgent','SIP/%s','Contact','firstName','lastName','calleridnum','phone','scheduledat','countbusyretry','countcongestionretry'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xa2e5,0xfd));var _0x5a2e=function(_0x4701a6,_0x1e8bda){_0x4701a6=_0x4701a6-0x0;var _0x2e223d=_0xa2e5[_0x4701a6];return _0x2e223d;};'use strict';var util=require(_0x5a2e('0x0'));var _=require('lodash');var moment=require('moment');function checkNameSurname(_0x377258,_0x212820,_0x4769cb){var _0x29b8dd='';if(!_[_0x5a2e('0x1')](_0x212820)&&_0x5a2e('0x2')===typeof _0x212820){_0x29b8dd+=_0x212820;}if(!_[_0x5a2e('0x1')](_0x4769cb)&&_0x5a2e('0x2')===typeof _0x4769cb){_0x29b8dd+='\x20'+_0x4769cb;}if(_0x29b8dd!==''){return _0x29b8dd;}return _0x377258;}function Action(_0xf48dd3,_0x1bf9ec,_0x3e4e9b,_0x134e33,_0x5539f3){this[_0x5a2e('0x3')]=_0x3e4e9b||undefined;this[_0x5a2e('0x4')]=_0xf48dd3['id'];this[_0x5a2e('0x5')]=_0x1bf9ec[_0x5a2e('0x6')];this['type']=_0x1bf9ec['type'];this['campaigntype']=_0x5a2e('0x5');this[_0x5a2e('0x7')]=![];this[_0x5a2e('0x8')]=_[_0x5a2e('0x1')](_0xf48dd3[_0x5a2e('0x9')])?undefined:_0xf48dd3[_0x5a2e('0x9')][_0x5a2e('0x6')];this[_0x5a2e('0xa')]=this['membername']?util['format'](_0x5a2e('0xb'),this[_0x5a2e('0x8')]):_0x134e33||undefined;this['calleridname']=checkNameSurname(_0xf48dd3['Contact']['phone'],_0xf48dd3[_0x5a2e('0xc')][_0x5a2e('0xd')],_0xf48dd3['Contact'][_0x5a2e('0xe')]);this['active']=_0xf48dd3['active']||![];this[_0x5a2e('0xf')]=_0xf48dd3[_0x5a2e('0xc')][_0x5a2e('0x10')];this[_0x5a2e('0x11')]=_0xf48dd3[_0x5a2e('0x11')];this[_0x5a2e('0x12')]=_0xf48dd3['countbusyretry']||0x0;this[_0x5a2e('0x13')]=_0xf48dd3[_0x5a2e('0x13')]||0x0;this['countnoanswerretry']=_0xf48dd3[_0x5a2e('0x14')]||0x0;this['countglobal']=(_0xf48dd3[_0x5a2e('0x12')]||0x0)+(_0xf48dd3[_0x5a2e('0x13')]||0x0)+(_0xf48dd3[_0x5a2e('0x14')]||0x0)+(_0xf48dd3[_0x5a2e('0x15')]||0x0)+(_0xf48dd3['countdropretry']||0x0)+(_0xf48dd3[_0x5a2e('0x16')]||0x0)+(_0xf48dd3[_0x5a2e('0x17')]||0x0)+(_0xf48dd3[_0x5a2e('0x18')]||0x0);this[_0x5a2e('0x15')]=_0xf48dd3[_0x5a2e('0x15')]||0x0;this[_0x5a2e('0x19')]=_0xf48dd3[_0x5a2e('0x19')]||0x0;this[_0x5a2e('0x16')]=_0xf48dd3[_0x5a2e('0x16')]||0x0;this[_0x5a2e('0x17')]=_0xf48dd3[_0x5a2e('0x17')]||0x0;this[_0x5a2e('0x18')]=_0xf48dd3[_0x5a2e('0x18')]||0x0;this[_0x5a2e('0x1a')]=_0xf48dd3[_0x5a2e('0x1a')];this['callbackuniqueid']=_0xf48dd3[_0x5a2e('0x1b')];this[_0x5a2e('0x1c')]=_0xf48dd3[_0x5a2e('0x1c')];this[_0x5a2e('0x1d')]=_0xf48dd3[_0x5a2e('0x1d')];this[_0x5a2e('0x1e')]=_0xf48dd3['ContactId'];this[_0x5a2e('0x1f')]=_0xf48dd3[_0x5a2e('0x1f')];this[_0x5a2e('0x20')]=_[_0x5a2e('0x1')](_0xf48dd3[_0x5a2e('0x9')])?_0xf48dd3[_0x5a2e('0x20')]:_0xf48dd3[_0x5a2e('0x9')]['id'];this[_0x5a2e('0x21')]=_0xf48dd3['VoiceQueueId'];this[_0x5a2e('0x22')]='';this[_0x5a2e('0x23')]='';}Action[_0x5a2e('0x24')]['getCaller']=function(){return util[_0x5a2e('0x25')](_0x5a2e('0x26'),this['calleridname'],this['number']);};module['exports']=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 2f18664..bbbcbb6 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 _0xf458=['TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','emit','custom:agentnosuchnumber','buildObj','nosuchnumber','createCustomerHistory','dialGlobalMaxRetry','cloneAction','Global','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','rescheduleContact','scheduledAt','dialNoSuchNumberRetryFrequency','unlockAgent','activeContact','linkedid','ANSWER','responsetime','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','custom:agentconnect','connect','acw','custom:agentConnectPreview','buildAcw','complete','outboundAnswerCallsDay','decrementTalkink','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','talktime','[syncHangup][talking][decrement]','BUSY','countbusyretry','custom:agentbusy','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyRetryFrequency','NoAnswer','noanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','countnoanswerretry','dialNoAnswerMaxRetry','CONGESTION','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','countcongestionretry','CANCEL','countagentrejectretry','custom:agentreject','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','ABANDONED','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','dialAbandonedRetryFrequency','outboundUnknownCallsDay','dialstatus','[callProgressDetectingCustomer][logUnknownGlobal]','callProgressDetectingAgent','isUndefined','object','reason','logAgent','[callProgressDetectingAgent][logNoSuch]','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','Busy','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','checkInBlack','Contact','isNil','phone','VoiceQueueId','Contact\x20is\x20undefined','Queue','lookAgent','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','[Preview][execCall][failure]','Call\x20failed','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','SIP/%s','reachable','unmonitored','execRun','pick','unlock','unlockContact','getContactPreview','recallme','isValid','checkIsBlackList','Contact.phone','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','validateContact','[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','dialPrefix','dialCutDigit','SIP/%s/%s%s','trim','dialRandomLastDigitCallerIdNumber','getCallerId','getCallerIdRandom','extractCalleridName','originatecalleridnum','addVariables','merge','toLowerVariables','OriginateError','actionid','logLookAgent','clone','isFailure','response','idContact','rejected','[syncHangup][talking]','callProgressDetectingCustomer','cause','statedesc','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','[syncHangup][talking][cause]','destlinkedid','destuniqueid','addVariable','variables','syncVarSet','filterKey','keys','variable','value','error','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','bluebird','moment','md5','ioredis','../../../config/environment','preview','../../../config/logger','actionPreview','./rpcDb','./action','./util/util','redis','localhost','prototype','enqueue','tail','sequence','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','hangup','syncHangup','bind','hanguprequest','syncHangupRequest','dialend','syncDialEnd','syncNewExten','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','campaignsPreview','name','strategy','answered','available','loggedIn','pTalking','sumBillable','sumHoldTime','total','type','unmanaged','abandoned','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','outboundAnswerAgiCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundReCallsDay','outboundRejectCallsDay','outboundAbandonedCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','message','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','stringify','voice:queue:%s','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','format','voice_queue_channel:remove','sendMessageOneNotActive','paused','NOT_ACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','IS_DISACTIVED','\x20is\x20disactive','loopCampaigns','syncCampaigns','booked','clearZombieChannels','outbound','setMessage','recallMe','clearZombieChannel','[clearZombieChannels][talking]','originated:\x20','queue','pTalking:\x20','contactId','ListId','Action','status','channel','catch','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','dialAnswer','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','[action]','size','getContactRecallMe','agentReadyId','then','length','getDiff','scheduledat','dialRecallMeTimeout','Agent','voicePause','run','logger2','[RecallMe]','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','[HistoryDialRecallInQueue][historyCatch]','logCustomer','RecallFailedTimeout','[HistoryRecallClose]','[getContactRecallMe]','IsNotLoggedIn','AGENTS_NOT_LOGGED','isActive','isTrunkReachable'];(function(_0x46dccd,_0x1d7f8c){var _0x1b2da6=function(_0x57a1f1){while(--_0x57a1f1){_0x46dccd['push'](_0x46dccd['shift']());}};_0x1b2da6(++_0x1d7f8c);}(_0xf458,0xb5));var _0x8f45=function(_0x29fff2,_0x5a0b5b){_0x29fff2=_0x29fff2-0x0;var _0x597d9d=_0xf458[_0x29fff2];return _0x597d9d;};'use strict';var util=require(_0x8f45('0x0'));var _=require(_0x8f45('0x1'));var BPromise=require(_0x8f45('0x2'));var uuid=require('uuid');var moment=require(_0x8f45('0x3'));var md5=require(_0x8f45('0x4'));var Redis=require(_0x8f45('0x5'));var config=require(_0x8f45('0x6'));var logger=require('../../../config/logger')(_0x8f45('0x7'));var loggerAction=require(_0x8f45('0x8'))(_0x8f45('0x9'));var ami=require('../ami');var rpcDb=require(_0x8f45('0xa'));var Action=require(_0x8f45('0xb'));var ut=require(_0x8f45('0xc'));config['redis']=_['defaults'](config[_0x8f45('0xd')],{'host':_0x8f45('0xe'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x8f45('0xd')]));var Sequence=function(){};Sequence[_0x8f45('0xf')][_0x8f45('0x10')]=function(_0x3fb275){this[_0x8f45('0x11')]=this[_0x8f45('0x11')]?this[_0x8f45('0x11')]['finally'](_0x3fb275):_0x3fb275();};function Preview(_0x442d84){this[_0x8f45('0x12')]=new Sequence();this['campaignsPreview']=_0x442d84[_0x8f45('0x13')];this[_0x8f45('0x14')]=_0x442d84[_0x8f45('0x14')];this[_0x8f45('0x15')]={};this[_0x8f45('0x16')]=_0x442d84[_0x8f45('0x16')];this[_0x8f45('0x17')]=0x0;ami['on'](_0x8f45('0x18'),this[_0x8f45('0x19')]['bind'](this));ami['on'](_0x8f45('0x1a'),this[_0x8f45('0x1b')][_0x8f45('0x1c')](this));ami['on'](_0x8f45('0x1d'),this[_0x8f45('0x1e')][_0x8f45('0x1c')](this));ami['on'](_0x8f45('0x1f'),this[_0x8f45('0x20')][_0x8f45('0x1c')](this));ami['on']('newexten',this[_0x8f45('0x21')][_0x8f45('0x1c')](this));ami['on']('varset',this['syncVarSet'][_0x8f45('0x1c')](this));ami['on'](_0x8f45('0x22'),this[_0x8f45('0x23')][_0x8f45('0x1c')](this));ami['on']('blindtransfer',this[_0x8f45('0x24')]['bind'](this));this['loopCampaigns'](this[_0x8f45('0x25')]);}function emit(_0x33e947,_0xecbae6,_0xe6e554){io['to'](_0x33e947)['emit'](_0xecbae6,_0xe6e554);}function emitCampaignPreview(_0x57bcd2){if(_0x57bcd2['type']==='outbound'){var _0x35a320={'id':_0x57bcd2['id'],'name':_0x57bcd2[_0x8f45('0x26')],'strategy':_0x57bcd2[_0x8f45('0x27')],'answered':_0x57bcd2[_0x8f45('0x28')],'available':_0x57bcd2[_0x8f45('0x29')],'loggedIn':_0x57bcd2[_0x8f45('0x2a')],'pTalking':_0x57bcd2[_0x8f45('0x2b')],'sumBillable':_0x57bcd2[_0x8f45('0x2c')],'sumDuration':_0x57bcd2['sumDuration'],'sumHoldTime':_0x57bcd2[_0x8f45('0x2d')]||0x0,'talking':_0x57bcd2['talking'],'total':_0x57bcd2[_0x8f45('0x2e')],'type':_0x57bcd2[_0x8f45('0x2f')],'unmanaged':_0x57bcd2[_0x8f45('0x30')],'abandoned':_0x57bcd2[_0x8f45('0x31')],'waiting':_0x57bcd2['waiting'],'loggedInDb':_0x57bcd2['loggedInDb'],'dialActive':_0x57bcd2[_0x8f45('0x32')],'dialMethod':_0x57bcd2[_0x8f45('0x33')],'dialOriginateCallerIdName':_0x57bcd2[_0x8f45('0x34')],'dialOriginateCallerIdNumber':_0x57bcd2[_0x8f45('0x35')],'dialOriginateTimeout':_0x57bcd2['dialOriginateTimeout'],'dialPrefix':_0x57bcd2['dialPrefix'],'outboundAnswerAgiCallsDay':_0x57bcd2[_0x8f45('0x36')],'outboundAnswerCallsDay':_0x57bcd2['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x57bcd2[_0x8f45('0x37')],'outboundBusyCallsDay':_0x57bcd2[_0x8f45('0x38')],'outboundCongestionCallsDay':_0x57bcd2[_0x8f45('0x39')],'outboundDropCallsDayACS':_0x57bcd2[_0x8f45('0x3a')],'outboundDropCallsDayCallersExit':_0x57bcd2[_0x8f45('0x3b')],'outboundDropCallsDayTimeout':_0x57bcd2[_0x8f45('0x3c')],'outboundNoAnswerCallsDay':_0x57bcd2['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x57bcd2['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x57bcd2['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x57bcd2[_0x8f45('0x3d')],'outboundRejectCallsDay':_0x57bcd2[_0x8f45('0x3e')],'outboundUnknownCallsDay':_0x57bcd2['outboundUnknownCallsDay'],'outboundAbandonedCallsDay':_0x57bcd2[_0x8f45('0x3f')],'predictiveIntervalAnsweredCalls':_0x57bcd2['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x57bcd2[_0x8f45('0x40')],'predictiveIntervalAvgTalktime':_0x57bcd2['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x57bcd2[_0x8f45('0x41')],'predictiveIntervalDroppedCallsTimeout':_0x57bcd2['predictiveIntervalDroppedCallsTimeout'],'predictiveIntervalErlangCalls':_0x57bcd2[_0x8f45('0x42')],'predictiveIntervalErlangCallsDroppedCalls':_0x57bcd2[_0x8f45('0x43')],'predictiveIntervalHitRate':_0x57bcd2['predictiveIntervalHitRate'],'predictiveIntervalMultiplicativeFactor':_0x57bcd2[_0x8f45('0x44')],'predictiveIntervalPauses':_0x57bcd2[_0x8f45('0x45')],'predictiveIntervalAvailable':_0x57bcd2[_0x8f45('0x46')],'predictiveIntervalTotalCalls':_0x57bcd2[_0x8f45('0x47')],'message':_0x57bcd2[_0x8f45('0x48')],'originated':_0x57bcd2[_0x8f45('0x49')],'erlangCalls':_0x57bcd2[_0x8f45('0x4a')],'erlangCallToSecond':_0x57bcd2[_0x8f45('0x4b')],'erlangAbandonmentRate':_0x57bcd2[_0x8f45('0x4c')],'erlangBusyFactor':_0x57bcd2[_0x8f45('0x4d')],'startPredictive':_0x57bcd2[_0x8f45('0x4e')],'startProgressive':_0x57bcd2[_0x8f45('0x4f')]};if(_0x57bcd2['Trunk']){_0x35a320[_0x8f45('0x50')]={'id':_0x57bcd2[_0x8f45('0x50')]['id'],'name':_0x57bcd2[_0x8f45('0x50')][_0x8f45('0x26')],'active':_0x57bcd2[_0x8f45('0x50')][_0x8f45('0x51')],'callerid':_0x57bcd2['Trunk'][_0x8f45('0x52')]};}if(_0x57bcd2['Interval']){_0x35a320['Interval']={'id':_0x57bcd2[_0x8f45('0x53')]['id'],'name':_0x57bcd2[_0x8f45('0x53')]['name']};}var _0x468f72=md5(JSON[_0x8f45('0x54')](_0x35a320));if(_0x57bcd2[_0x8f45('0x4')]!==_0x468f72){_0x57bcd2['md5']=_0x468f72;emit(util['format'](_0x8f45('0x55'),_0x35a320[_0x8f45('0x26')]),_0x8f45('0x56'),_0x35a320);}}}function emitVoiceQueueChannelRemove(_0x219d08){logger[_0x8f45('0x57')](_0x8f45('0x58'),JSON[_0x8f45('0x54')](_0x219d08));emit(util[_0x8f45('0x59')](_0x8f45('0x55'),_0x219d08['name']),_0x8f45('0x5a'),_0x219d08);}function notSendMessagesQueue(_0x470b97){if(_0x470b97['sendMessageOneNotActive']){if(_0x470b97[_0x8f45('0x49')]===0x0&&_0x470b97[_0x8f45('0x2b')]===0x0){_0x470b97[_0x8f45('0x5b')]=![];_0x470b97[_0x8f45('0x29')]=0x0;_0x470b97[_0x8f45('0x5c')]=0x0;_0x470b97[_0x8f45('0x48')]=_0x8f45('0x5d');ut[_0x8f45('0x5e')](_0x8f45('0x5f'),_0x470b97[_0x8f45('0x26')]+'\x20is\x20not\x20active');}else{_0x470b97[_0x8f45('0x48')]=_0x8f45('0x60');ut[_0x8f45('0x5e')](_0x8f45('0x5f'),_0x470b97[_0x8f45('0x26')]+_0x8f45('0x61'));}emitCampaignPreview(_0x470b97);}}Preview[_0x8f45('0xf')][_0x8f45('0x62')]=function(){var _0x4064b4=this;setInterval(function(){_0x4064b4[_0x8f45('0x63')]();},0x7cf);};Preview[_0x8f45('0xf')]['syncCampaigns']=function(){var _0x23ecc6=this[_0x8f45('0x25')];this[_0x8f45('0x17')]+=0x1;for(var _0x1f2ac2 in _0x23ecc6){if(_0x23ecc6['hasOwnProperty'](_0x1f2ac2)&&(_0x23ecc6[_0x1f2ac2][_0x8f45('0x33')]==='preview'||_0x23ecc6[_0x1f2ac2][_0x8f45('0x33')]===_0x8f45('0x64'))&&_0x23ecc6[_0x1f2ac2][_0x8f45('0x2f')]==='outbound'){if(this[_0x8f45('0x17')]>0x7){this[_0x8f45('0x17')]=0x0;this[_0x8f45('0x65')]();}}if(_0x23ecc6['hasOwnProperty'](_0x1f2ac2)&&_0x23ecc6[_0x1f2ac2][_0x8f45('0x33')]==='preview'&&_0x23ecc6[_0x1f2ac2]['type']===_0x8f45('0x66')){if(_0x23ecc6[_0x1f2ac2][_0x8f45('0x32')]){this[_0x8f45('0x67')](_0x23ecc6[_0x1f2ac2]);this[_0x8f45('0x68')](_0x23ecc6[_0x1f2ac2]);}else{notSendMessagesQueue(_0x23ecc6[_0x1f2ac2]);}}}};Preview['prototype'][_0x8f45('0x69')]=function(_0x2bdbd9){var _0x8180c5=this;this[_0x8f45('0x12')][_0x8f45('0x10')](function(){if(!_['isNil'](_0x8180c5[_0x8f45('0x15')][_0x2bdbd9])){loggerAction[_0x8f45('0x57')](_0x8f45('0x6a'),_0x2bdbd9,'Queue',_0x8180c5[_0x8f45('0x15')][_0x2bdbd9]['queue'],_0x8f45('0x6b'),JSON['stringify'](_0x8180c5[_0x8f45('0x25')][_0x8180c5[_0x8f45('0x15')][_0x2bdbd9][_0x8f45('0x6c')]]['originated']),_0x8f45('0x6d'),JSON[_0x8f45('0x54')](_0x8180c5['campaignsPreview'][_0x8180c5[_0x8f45('0x15')][_0x2bdbd9][_0x8f45('0x6c')]][_0x8f45('0x2b')]),JSON[_0x8f45('0x54')](_0x8180c5[_0x8f45('0x15')][_0x2bdbd9]['dialAnswer']),JSON[_0x8f45('0x54')](_['pick'](_0x8180c5[_0x8f45('0x15')][_0x2bdbd9],[_0x8f45('0x6e'),'UserId','VoiceQueueId',_0x8f45('0x6f')])));return ami[_0x8f45('0x70')]({'action':_0x8f45('0x71'),'channel':_0x8180c5[_0x8f45('0x15')][_0x2bdbd9][_0x8f45('0x72')]})[_0x8f45('0x73')](function(_0x496cb3){if(_0x496cb3[_0x8f45('0x48')]===_0x8f45('0x74')){setTimeout(function(){if(_0x8180c5['actions'][_0x2bdbd9]){ut[_0x8f45('0x75')](_0x8180c5['campaignsPreview'][_0x8180c5[_0x8f45('0x15')][_0x2bdbd9][_0x8f45('0x6c')]],_0x8f45('0x76'));if(_0x8180c5[_0x8f45('0x15')][_0x2bdbd9][_0x8f45('0x77')]===!![]){ut['decrementTalkink'](_0x8180c5[_0x8f45('0x25')][_0x8180c5[_0x8f45('0x15')][_0x2bdbd9][_0x8f45('0x6c')]],_0x8f45('0x76'));ut[_0x8f45('0x78')](_0x8f45('0x79')+_0x2bdbd9,_0x8180c5[_0x8f45('0x15')][_0x2bdbd9][_0x8f45('0x6c')]);}ut['loggerError'](_0x8f45('0x7a')+_0x2bdbd9,_0x8180c5[_0x8f45('0x15')][_0x2bdbd9][_0x8f45('0x6c')]);delete _0x8180c5['actions'][_0x2bdbd9];}},0x2328);}});}});};Preview[_0x8f45('0xf')][_0x8f45('0x65')]=function(){var _0x5e7013=this;loggerAction[_0x8f45('0x57')](_0x8f45('0x7b'),_[_0x8f45('0x7c')](this[_0x8f45('0x15')]));for(var _0x4ee55d in this[_0x8f45('0x15')]){if(_0x5e7013['actions']['hasOwnProperty'](_0x4ee55d)){_0x5e7013[_0x8f45('0x69')](_0x4ee55d);}}};Preview[_0x8f45('0xf')][_0x8f45('0x68')]=function(_0x15c5ba){var _0x2080cc=this;rpcDb[_0x8f45('0x7d')](_0x15c5ba['id'],ut[_0x8f45('0x7e')](this['agents']))[_0x8f45('0x7f')](function(_0xdad8a8){if(!_['isNil'](_0xdad8a8)){for(var _0x519dc1=0x0;_0x519dc1<_0xdad8a8[_0x8f45('0x80')];_0x519dc1+=0x1){if(ut[_0x8f45('0x81')](_0xdad8a8[_0x519dc1][_0x8f45('0x82')])<_0x15c5ba[_0x8f45('0x83')]*0x3c){if(_0xdad8a8[_0x519dc1][_0x8f45('0x84')]&&!_0xdad8a8[_0x519dc1][_0x8f45('0x84')][_0x8f45('0x85')]){_0x2080cc[_0x8f45('0x86')](_0xdad8a8[_0x519dc1]['id'])[_0x8f45('0x7f')](ut[_0x8f45('0x87')](_0x8f45('0x88')))[_0x8f45('0x73')](ut[_0x8f45('0x87')](_0x8f45('0x88')));}else{rpcDb[_0x8f45('0x89')](_0xdad8a8[_0x519dc1]['id']);}}else{var _0x2870a8=new Action(_0xdad8a8[_0x519dc1],_0x15c5ba);_0x2870a8[_0x8f45('0x8a')]=moment()[_0x8f45('0x59')](_0x8f45('0x8b'));_0x15c5ba[_0x8f45('0x3d')]+=0x1;ut['logCustomer'](_0x2870a8,0x17,_0x8f45('0x8c'));if(_0x15c5ba[_0x8f45('0x8d')]){rpcDb[_0x8f45('0x8e')](ut[_0x8f45('0x8f')](_0xdad8a8[_0x519dc1]));rpcDb['createCustomerHistory'](_0x2870a8,_0x8f45('0x90'));}else{ut[_0x8f45('0x91')](_0x2870a8,0x16,_0x8f45('0x92'));rpcDb['createCustomerHistory'](_0x2870a8,_0x8f45('0x93'));rpcDb['createCustomerFinal'](_0x2870a8,_0x8f45('0x93'));}}}}})[_0x8f45('0x73')](ut[_0x8f45('0x87')](_0x8f45('0x94')));};Preview[_0x8f45('0xf')][_0x8f45('0x67')]=function(_0x40295f){_0x40295f[_0x8f45('0x5b')]=!![];if(ut[_0x8f45('0x95')](_0x40295f['loggedIn'])){_0x40295f[_0x8f45('0x48')]=_0x8f45('0x96');}else if(!ut[_0x8f45('0x97')](_0x40295f['dialActive'])){_0x40295f[_0x8f45('0x48')]=_0x8f45('0x5d');}else if(!this[_0x8f45('0x98')](_0x40295f[_0x8f45('0x50')])){if(!this[_0x8f45('0x98')](_0x40295f[_0x8f45('0x99')])){_0x40295f[_0x8f45('0x48')]=_0x8f45('0x9a');}else{_0x40295f[_0x8f45('0x48')]=_0x8f45('0x9b');}}else{_0x40295f[_0x8f45('0x48')]='ACTIVE';}emitCampaignPreview(_0x40295f);};Preview[_0x8f45('0xf')]['callProgressDetectingCustomer']=function(_0x304cb4,_0x58b136,_0xd31f15){var _0x415299=this;var _0x21ea1c=this[_0x8f45('0x15')][_0x58b136];var _0x7b8215=this['campaignsPreview'][_0x21ea1c['queue']];var _0xa91a6c;if(_0x7b8215){switch(_0xd31f15){case'1':_0x7b8215[_0x8f45('0x9c')]+=0x1;_0x21ea1c[_0x8f45('0x9d')]+=0x1;_0x21ea1c[_0x8f45('0x9e')]=ut[_0x8f45('0x9f')](_0x21ea1c);ut['logCustomer'](_0x21ea1c,0x0,_0x8f45('0xa0'));ami[_0x8f45('0xa1')](_0x8f45('0xa2'),ut[_0x8f45('0xa3')](_0x21ea1c,_0x8f45('0xa4')));rpcDb[_0x8f45('0xa5')](_0x21ea1c,'[callProgressDetectingCustomer][logNoSuch]');if(ut[_0x8f45('0x9f')](_0x21ea1c)>=_0x7b8215[_0x8f45('0xa6')]){_0xa91a6c=ut[_0x8f45('0xa7')](_0x21ea1c,0xf,_0x8f45('0xa8'));rpcDb[_0x8f45('0xa9')](_0xa91a6c,_0x8f45('0xaa'));}else{if(_0x21ea1c[_0x8f45('0x9d')]>=_0x7b8215[_0x8f45('0xab')]){rpcDb[_0x8f45('0xa9')](_0x21ea1c,_0x8f45('0xaa'));}else{rpcDb[_0x8f45('0xac')](ut[_0x8f45('0xad')](_0x21ea1c,_0x8f45('0x9d'),_0x7b8215[_0x8f45('0xae')]),_0x21ea1c[_0x8f45('0xaf')],_0x21ea1c[_0x8f45('0xb0')]);}}delete this['actions'][_0x304cb4[_0x8f45('0xb1')]];break;case _0x8f45('0xb2'):var _0x1f7bae=moment()[_0x8f45('0x59')]('YYYY-MM-DD\x20HH:mm:ss');_0x21ea1c[_0x8f45('0xb3')]=_0x1f7bae;_0x21ea1c[_0x8f45('0xb4')]=_0x1f7bae;_0x21ea1c[_0x8f45('0x77')]=!![];_0x7b8215[_0x8f45('0x2b')]+=0x1;logger[_0x8f45('0x57')](_0x8f45('0xb5'),_0x21ea1c[_0x8f45('0xb6')],_0x8f45('0xb7'),_0x7b8215[_0x8f45('0x26')],_0x8f45('0x6d'),_0x7b8215['pTalking']);ami[_0x8f45('0xa1')](_0x8f45('0xb8'),ut[_0x8f45('0xa3')](_0x21ea1c,_0x8f45('0xb9')));if(_0x7b8215[_0x8f45('0xba')]){ami['emit'](_0x8f45('0xbb'),ut[_0x8f45('0xbc')](_0x21ea1c));}break;case'16':ami['emit']('custom:agentcomplete',ut[_0x8f45('0xa3')](_0x21ea1c,_0x8f45('0xbd')));emitVoiceQueueChannelRemove(ut['buildObj'](_0x21ea1c,_0x8f45('0xbd')));_0x7b8215[_0x8f45('0xbe')]+=0x1;_0x7b8215[_0x8f45('0x2e')]+=0x1;_0x7b8215[_0x8f45('0x28')]+=0x1;ut[_0x8f45('0xbf')](_0x7b8215,_0x8f45('0xc0'));_0x21ea1c['countglobal']=ut[_0x8f45('0x9f')](_0x21ea1c);ut['logCustomer'](_0x21ea1c,0x4,_0x8f45('0xc1'));rpcDb[_0x8f45('0xa5')](_0x21ea1c,_0x8f45('0xc2'));rpcDb[_0x8f45('0xa9')](_0x21ea1c,_0x8f45('0xc3'));rpcDb[_0x8f45('0xc4')](_0x21ea1c);_0x7b8215['sumDuration']+=_0x21ea1c[_0x8f45('0xc5')];_0x7b8215['sumBillable']+=_0x21ea1c[_0x8f45('0xc5')];logger['info'](_0x8f45('0xc6'),_0x21ea1c[_0x8f45('0xb6')],_0x8f45('0xb7'),_0x7b8215[_0x8f45('0x26')],_0x8f45('0x6d'),_0x7b8215['pTalking']);delete this[_0x8f45('0x15')][_0x304cb4[_0x8f45('0xb1')]];break;case _0x8f45('0xc7'):_0x7b8215[_0x8f45('0x38')]+=0x1;_0x21ea1c[_0x8f45('0xc8')]+=0x1;_0x21ea1c[_0x8f45('0x9e')]=ut[_0x8f45('0x9f')](_0x21ea1c);ut['logCustomer'](_0x21ea1c,0x5,'Busy');ami[_0x8f45('0xa1')](_0x8f45('0xc9'),ut[_0x8f45('0xa3')](_0x21ea1c,'busy'));rpcDb['createCustomerHistory'](_0x21ea1c,'[callProgressDetectingCustomer][logBusy]');if(ut[_0x8f45('0x9f')](_0x21ea1c)>=_0x7b8215[_0x8f45('0xa6')]){_0xa91a6c=ut[_0x8f45('0xa7')](_0x21ea1c,0xf,_0x8f45('0xa8'));rpcDb[_0x8f45('0xa9')](_0xa91a6c,_0x8f45('0xca'));}else{if(_0x21ea1c[_0x8f45('0xc8')]>=_0x7b8215['dialBusyMaxRetry']){rpcDb[_0x8f45('0xa9')](_0x21ea1c,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb[_0x8f45('0xac')](ut[_0x8f45('0xad')](_0x21ea1c,_0x8f45('0xc8'),_0x7b8215[_0x8f45('0xcb')]),_0x21ea1c['unlockAgent'],_0x21ea1c[_0x8f45('0xb0')]);}}break;case'NOANSWER':_0x7b8215['outboundNoAnswerCallsDay']+=0x1;_0x21ea1c['countnoanswerretry']+=0x1;_0x21ea1c['countglobal']=ut['totalGlobal'](_0x21ea1c);ut[_0x8f45('0x91')](_0x21ea1c,0x3,_0x8f45('0xcc'));ami[_0x8f45('0xa1')]('custom:agentnoanswer',ut['buildObj'](_0x21ea1c,_0x8f45('0xcd')));rpcDb[_0x8f45('0xa5')](_0x21ea1c,_0x8f45('0xce'));if(ut[_0x8f45('0x9f')](_0x21ea1c)>=_0x7b8215[_0x8f45('0xa6')]){_0xa91a6c=ut['cloneAction'](_0x21ea1c,0xf,_0x8f45('0xa8'));rpcDb[_0x8f45('0xa9')](_0xa91a6c,_0x8f45('0xcf'));}else{if(_0x21ea1c[_0x8f45('0xd0')]>=_0x7b8215[_0x8f45('0xd1')]){rpcDb[_0x8f45('0xa9')](_0x21ea1c,_0x8f45('0xce'));}else{rpcDb[_0x8f45('0xac')](ut[_0x8f45('0xad')](_0x21ea1c,_0x8f45('0xd0'),_0x7b8215['dialNoAnswerRetryFrequency']),_0x21ea1c[_0x8f45('0xaf')],_0x21ea1c['activeContact']);}}break;case _0x8f45('0xd2'):_0x7b8215['outboundCongestionCallsDay']+=0x1;_0x21ea1c['countcongestionretry']+=0x1;_0x21ea1c[_0x8f45('0x9e')]=ut['totalGlobal'](_0x21ea1c);ut[_0x8f45('0x91')](_0x21ea1c,0x8,_0x8f45('0xd3'));ami[_0x8f45('0xa1')](_0x8f45('0xd4'),ut[_0x8f45('0xa3')](_0x21ea1c,_0x8f45('0xd5')));rpcDb[_0x8f45('0xa5')](_0x21ea1c,_0x8f45('0xd6'));if(ut[_0x8f45('0x9f')](_0x21ea1c)>=_0x7b8215[_0x8f45('0xa6')]){_0xa91a6c=ut[_0x8f45('0xa7')](_0x21ea1c,0xf,_0x8f45('0xa8'));rpcDb[_0x8f45('0xa9')](_0xa91a6c,'[callProgressDetectingCustomer][logCongestionGlobal]');}else{if(_0x21ea1c[_0x8f45('0xd7')]>=_0x7b8215['dialCongestionMaxRetry']){rpcDb[_0x8f45('0xa9')](_0x21ea1c,_0x8f45('0xd6'));}else{rpcDb[_0x8f45('0xac')](ut[_0x8f45('0xad')](_0x21ea1c,'countcongestionretry',_0x7b8215[_0x8f45('0xcb')]),_0x21ea1c['unlockAgent'],_0x21ea1c[_0x8f45('0xb0')]);}}break;case _0x8f45('0xd8'):_0x7b8215[_0x8f45('0x3e')]+=0x1;_0x21ea1c[_0x8f45('0xd9')]+=0x1;_0x21ea1c[_0x8f45('0x9e')]=ut['totalGlobal'](_0x21ea1c);ut[_0x8f45('0x91')](_0x21ea1c,0x14,'AgentReject');ami[_0x8f45('0xa1')](_0x8f45('0xda'),ut[_0x8f45('0xa3')](_0x21ea1c,'agentreject'));rpcDb[_0x8f45('0xa5')](_0x21ea1c,'[syncHangupRequest][logAgentReject]');if(ut['totalGlobal'](_0x21ea1c)>=_0x7b8215['dialGlobalMaxRetry']){_0xa91a6c=ut[_0x8f45('0xa7')](_0x21ea1c,0x14,'AgentReject');rpcDb['createCustomerFinal'](_0xa91a6c,_0x8f45('0xdb'));}else{if(_0x21ea1c['countagentrejectretry']>=_0x7b8215[_0x8f45('0xdc')]){rpcDb[_0x8f45('0xa9')](_0x21ea1c,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0x8f45('0xac')](ut[_0x8f45('0xad')](_0x21ea1c,_0x8f45('0xd9'),_0x7b8215['dialAgentRejectRetryFrequency']),_0x21ea1c['unlockAgent'],_0x21ea1c['activeContact']);}}break;case _0x8f45('0xdd'):_0x7b8215[_0x8f45('0x3f')]+=0x1;_0x21ea1c[_0x8f45('0xde')]+=0x1;_0x21ea1c[_0x8f45('0x9e')]=ut[_0x8f45('0x9f')](_0x21ea1c);ut[_0x8f45('0x91')](_0x21ea1c,0xb,_0x8f45('0xdf'));rpcDb['createCustomerHistory'](_0x21ea1c,_0x8f45('0xe0'));if(ut[_0x8f45('0x9f')](_0x21ea1c)>=_0x7b8215[_0x8f45('0xa6')]){_0xa91a6c=ut[_0x8f45('0xa7')](_0x21ea1c,0xf,'Global');rpcDb['createCustomerFinal'](_0xa91a6c,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0x21ea1c[_0x8f45('0xe1')]>=_0x7b8215[_0x8f45('0xe2')]){rpcDb[_0x8f45('0xa9')](_0x21ea1c,'[callProgressDetectingCustomer][logAbandoned]');}else{rpcDb['rescheduleContact'](ut[_0x8f45('0xad')](_0x21ea1c,'countabandonedretry',_0x7b8215[_0x8f45('0xe3')]),_0x21ea1c[_0x8f45('0xaf')],_0x21ea1c[_0x8f45('0xb0')]);}}break;default:if(_0x21ea1c['dialAnswer']){ut[_0x8f45('0xbf')](_0x7b8215,'[default]');ut[_0x8f45('0x78')]('[Dialer][decrementTalkink][no\x20Hangup][Preview]'+_0x7b8215[_0x8f45('0x26')],_0x304cb4);}_0x7b8215[_0x8f45('0xe4')]+=0x1;_0x21ea1c[_0x8f45('0x9e')]=ut[_0x8f45('0x9f')](_0x21ea1c);ut['logCustomer'](_0x21ea1c,0xc,_0x304cb4['cause-txt']||_0x304cb4[_0x8f45('0xe5')]);rpcDb['createCustomerHistory'](_0x21ea1c,'[callProgressDetectingCustomer][logUnknown]');if(ut[_0x8f45('0x9f')](_0x21ea1c)>=_0x7b8215[_0x8f45('0xa6')]){_0xa91a6c=ut['cloneAction'](_0x21ea1c,0xf,_0x8f45('0xa8'));rpcDb[_0x8f45('0xa9')](_0xa91a6c,_0x8f45('0xe6'));}else{rpcDb[_0x8f45('0xa9')](_0x21ea1c,'[callProgressDetectingCustomer][logUnknownGlobal]');}delete this['actions'][_0x304cb4['linkedid']];}if(!(_0x21ea1c['dialAnswer']&&_0xd31f15==='16')){ut[_0x8f45('0x75')](_0x7b8215,'[callProgressDetectingCustomer]');logger['info']('[originated][decrement][callProgressDetectingCustomer]',_0x21ea1c[_0x8f45('0xb6')],_0x8f45('0xb7'),_0x7b8215['name'],_0x8f45('0x6b'),_0x7b8215[_0x8f45('0x49')]);}if(_0xd31f15!==_0x8f45('0xb2')){delete this[_0x8f45('0x15')][_0x304cb4[_0x8f45('0xb1')]];delete this[_0x8f45('0x15')][_0x304cb4['destlinkedid']];}}};Preview[_0x8f45('0xf')][_0x8f45('0xe7')]=function(_0x25da9a,_0x29549d,_0x3f5a6f){if(_[_0x8f45('0xe8')](_0x29549d)&&_0x8f45('0xe9')!==typeof _0x29549d){return;}if(_[_0x8f45('0xe8')](_0x3f5a6f)&&_0x8f45('0xe9')!==typeof _0x3f5a6f){return;}switch(_0x3f5a6f[_0x8f45('0xea')]){case'0':ut[_0x8f45('0xeb')](_0x25da9a,0x0,'NoSuchNumber');rpcDb['createAgentHistory'](_0x25da9a,_0x8f45('0xec'));break;case'3':ut[_0x8f45('0xeb')](_0x25da9a,0x3,_0x8f45('0xcc'));rpcDb[_0x8f45('0xed')](_0x25da9a,_0x8f45('0xee'));break;case'5':ut['logAgent'](_0x25da9a,0x5,_0x8f45('0xef'));rpcDb[_0x8f45('0xed')](_0x25da9a,_0x8f45('0xf0'));break;case'8':ut['logAgent'](_0x25da9a,0x8,'Congestion');rpcDb[_0x8f45('0xed')](_0x25da9a,_0x8f45('0xf1'));break;case'22':ut[_0x8f45('0xeb')](_0x25da9a,0x16,'AnswerAGI');rpcDb[_0x8f45('0xed')](_0x25da9a,_0x8f45('0xf2'));break;default:ut[_0x8f45('0xeb')](_0x25da9a,0xc,_0x3f5a6f[_0x8f45('0xea')]);rpcDb[_0x8f45('0xed')](_0x25da9a,_0x8f45('0xf1'));}ut[_0x8f45('0x75')](_0x29549d,_0x8f45('0xf3'));logger[_0x8f45('0x57')](_0x8f45('0xf4'),_0x25da9a['uniqueid'],'\x20Queue',_0x29549d[_0x8f45('0x26')],_0x8f45('0x6b'),_0x29549d['originated']);delete this[_0x8f45('0x15')][_0x25da9a[_0x8f45('0xb6')]];};Preview['prototype'][_0x8f45('0xf5')]=function(_0x422446,_0x435100,_0x46188a,_0x4f7a7f,_0x4da3af){var _0x4e8a27=this;return new BPromise(function(_0x3f6a09,_0x5e22a7){if(_['isNil'](_0x435100)||_['isNil'](_0x435100[_0x8f45('0xf6')])||_[_0x8f45('0xf7')](_0x435100['Contact'][_0x8f45('0xf8')])||_[_0x8f45('0xf7')](_0x435100[_0x8f45('0xf9')])){_0x5e22a7(ut[_0x8f45('0x48')](_0x8f45('0xfa'),_0x4f7a7f,_0x4da3af));return;}var _0x1d9b50=uuid['v4']();var _0x166e9c=_0x4e8a27[_0x8f45('0x25')][_0x435100[_0x8f45('0xfb')][_0x8f45('0x26')]];var _0xd6b14b=_0x46188a?_0x4e8a27[_0x8f45('0x16')][_0x46188a]['id']:undefined;_0x4e8a27[_0x8f45('0x15')][_0x1d9b50]=new Action(_0x435100,_0x166e9c,_0x1d9b50,_0x46188a,_0xd6b14b);var _0x4eb250=_0x4e8a27[_0x8f45('0x15')][_0x1d9b50];_0x4eb250[_0x8f45('0xaf')]=_0x4f7a7f;_0x4eb250[_0x8f45('0xb0')]=_0x4da3af;_0x4eb250[_0x8f45('0xfc')]=_0x46188a;if(_[_0x8f45('0xfd')](_0x422446)){_0x4e8a27[_0x8f45('0xfe')](_0x4eb250,_0x166e9c,_0x435100,_0x46188a)['then'](function(_0x103377){logger[_0x8f45('0x57')](_0x8f45('0xff'),_0x8f45('0x100')+_0x4eb250['queue']+_0x8f45('0x101')+_0x4eb250['idContact'],JSON[_0x8f45('0x54')](_0x103377));ami[_0x8f45('0xa1')]('custom:agentcalled',ut[_0x8f45('0xa3')](_0x4eb250,'called'));_0x3f6a09(ut[_0x8f45('0x48')]('Calling'));})['catch'](function(_0x3b722a){ut['logger'](_0x8f45('0x102'),_0x3b722a);_0x5e22a7(ut[_0x8f45('0x48')](_0x8f45('0x103'),_0x4f7a7f,_0x4da3af));});}else{_0x166e9c[_0x8f45('0x37')]+=0x1;ut[_0x8f45('0x104')](_0x4eb250);rpcDb[_0x8f45('0x105')](_0x4eb250,_0x8f45('0x106'));delete _0x4e8a27[_0x8f45('0x15')][_0x1d9b50];_0x5e22a7(ut[_0x8f45('0x48')](_0x8f45('0x107'),_0x4f7a7f,_0x4da3af));}});};Preview[_0x8f45('0xf')]['isTrunkReachable']=function(_0x553858){return!_[_0x8f45('0xf7')](_0x553858)&&!_[_0x8f45('0xf7')](_0x553858[_0x8f45('0x26')])&&!_[_0x8f45('0xf7')](_0x553858[_0x8f45('0x51')])&&_0x553858[_0x8f45('0x51')]&&!_[_0x8f45('0xf7')](this[_0x8f45('0x14')][util[_0x8f45('0x59')](_0x8f45('0x108'),_0x553858[_0x8f45('0x26')])])&&!_[_0x8f45('0xf7')](this['trunks'][util['format'](_0x8f45('0x108'),_0x553858['name'])]['status'])&&(this['trunks'][util[_0x8f45('0x59')]('SIP/%s',_0x553858[_0x8f45('0x26')])][_0x8f45('0x71')]===_0x8f45('0x109')||this[_0x8f45('0x14')][util[_0x8f45('0x59')](_0x8f45('0x108'),_0x553858[_0x8f45('0x26')])][_0x8f45('0x71')]===_0x8f45('0x10a'));};Preview[_0x8f45('0xf')][_0x8f45('0x86')]=function(_0x21bf49,_0x367712){var _0x54bdb5=this;return new BPromise(function(_0x242841,_0x261b13){_0x54bdb5[_0x8f45('0x10b')](_0x21bf49,_0x367712)[_0x8f45('0x7f')](function(_0x54efd3){_0x242841(_[_0x8f45('0x10c')](_0x54efd3,[_0x8f45('0x48')]));})[_0x8f45('0x73')](function(_0x4198eb){if(_0x4198eb[_0x8f45('0x10d')]){rpcDb[_0x8f45('0x10e')](_0x21bf49);}if(_0x4198eb[_0x8f45('0x51')]){rpcDb['disableContact'](_0x21bf49);}_0x261b13(_[_0x8f45('0x10c')](_0x4198eb,[_0x8f45('0x48')]));});});};Preview['prototype'][_0x8f45('0x10b')]=function(_0x3d4fc0,_0x2cb675){var _0x4fa1d2=this;return new BPromise(function(_0xcc7023,_0x326a8f){var _0x13fe54,_0x19de78;rpcDb[_0x8f45('0x10f')](_0x3d4fc0)['then'](function(_0x54f1d1){if(!_[_0x8f45('0xf7')](_0x54f1d1[0x0])){_0x19de78=_0x54f1d1[0x0][_0x8f45('0x110')]?![]:!![];_0x13fe54=_0x54f1d1[0x0][_0x8f45('0x110')]?!![]:![];_0x13fe54=_0x2cb675?!![]:_0x13fe54;}var _0x20737b=_0x4fa1d2['validateContact'](_0x54f1d1);if(_0x20737b[_0x8f45('0x111')]){rpcDb[_0x8f45('0x112')](_[_0x8f45('0x10c')](_0x54f1d1[0x0],['VoiceQueueId',_0x8f45('0x113')]))[_0x8f45('0x7f')](function(_0x36d5d8){_0x4fa1d2['checkInBlack'](_0x36d5d8,_0x54f1d1[0x0],_0x2cb675,_0x19de78,_0x13fe54)[_0x8f45('0x7f')](function(_0x3d3c68){_0xcc7023(_0x3d3c68);})[_0x8f45('0x73')](function(_0xb35c22){_0x326a8f(_0xb35c22);});})['catch'](function(_0x18218d){ut[_0x8f45('0x5e')](_0x8f45('0x114'),_0x18218d);_0x326a8f(ut['message'](_0x8f45('0x115'),_0x19de78,_0x13fe54));});}else{_0x326a8f(ut[_0x8f45('0x48')](_0x20737b[_0x8f45('0x48')],_0x19de78,_0x13fe54));}})[_0x8f45('0x73')](function(_0x53bbd7){ut[_0x8f45('0x5e')](_0x8f45('0x116'),_0x53bbd7);_0x326a8f(ut['message'](_0x8f45('0x115'),![],!![]));});});};Preview[_0x8f45('0xf')][_0x8f45('0x117')]=function(_0x40abde){if(_['isNil'](_0x40abde)||_[_0x8f45('0xfd')](_0x40abde)||!_[_0x8f45('0xf7')](_0x40abde[0x0]['Agent'])&&_[_0x8f45('0xf7')](_0x40abde[0x0][_0x8f45('0x84')]['name'])){ut['logger'](_0x8f45('0x118'),_0x40abde);return{'isValid':![],'message':_0x8f45('0x119')};}var _0xfbcb7b=this['campaignsPreview'][_0x40abde[0x0]['Queue']['name']];_0xfbcb7b[_0x8f45('0x48')]=_0x8f45('0x9b');if(_['isNil'](_0xfbcb7b)){ut['logger'](_0x8f45('0x11a'),_0xfbcb7b);return{'isValid':![],'message':_0x8f45('0x11b')};}if(!this['isTrunkReachable'](_0xfbcb7b[_0x8f45('0x50')])){ut['logger'](_0x8f45('0x11c'),_0x8f45('0x11d')+_0xfbcb7b[_0x8f45('0x26')]+'\x20Trunk\x20is\x20not\x20active');if(!this['isTrunkReachable'](_0xfbcb7b['TrunkBackup'])){ut['logger'](_0x8f45('0x11c'),_0xfbcb7b[_0x8f45('0x26')]+_0x8f45('0x11e'));return{'isValid':![],'message':_0x8f45('0x11f')};}}if(!ut[_0x8f45('0x97')](_0xfbcb7b['dialActive'])){ut[_0x8f45('0x5e')](_0x8f45('0x120'),_0xfbcb7b[_0x8f45('0x26')]+_0x8f45('0x121'));return{'isValid':![],'message':_0x8f45('0x11d')+_0xfbcb7b['name']+_0x8f45('0x121')};}return{'isValid':!![],'message':_0x8f45('0x122')};};Preview[_0x8f45('0xf')][_0x8f45('0xfe')]=function(_0x99a95f,_0x9ab2fe,_0x1ae5d9,_0x5c5398){var _0x1f13dc=this;return new BPromise(function(_0x33e3d1,_0x3f79ff){var _0x575969=_0x99a95f[_0x8f45('0xb6')];var _0x385ed7=_0x1f13dc[_0x8f45('0x98')](_0x9ab2fe[_0x8f45('0x50')])?util[_0x8f45('0x59')]('SIP/%s/%s%s',_0x9ab2fe[_0x8f45('0x50')][_0x8f45('0x26')],_[_0x8f45('0xf7')](_0x9ab2fe[_0x8f45('0x123')])?'':_0x9ab2fe[_0x8f45('0x123')]['trim']()||'',_0x9ab2fe[_0x8f45('0x124')]>0x0?_0x1ae5d9[_0x8f45('0xf6')][_0x8f45('0xf8')]['substring'](_0x9ab2fe[_0x8f45('0x124')]):_0x1ae5d9[_0x8f45('0xf6')][_0x8f45('0xf8')]):util[_0x8f45('0x59')](_0x8f45('0x125'),_[_0x8f45('0xf7')](_0x9ab2fe[_0x8f45('0x99')])?_0x9ab2fe['Trunk'][_0x8f45('0x26')]:_0x9ab2fe[_0x8f45('0x99')][_0x8f45('0x26')],_['isNil'](_0x9ab2fe['dialPrefix'])?'':_0x9ab2fe[_0x8f45('0x123')][_0x8f45('0x126')]()||'',_0x9ab2fe[_0x8f45('0x124')]>0x0?_0x1ae5d9[_0x8f45('0xf6')][_0x8f45('0xf8')]['substring'](_0x9ab2fe[_0x8f45('0x124')]):_0x1ae5d9[_0x8f45('0xf6')][_0x8f45('0xf8')]);var _0x2fd887=_0x1f13dc[_0x8f45('0x98')](_0x9ab2fe[_0x8f45('0x50')])?ut['getCallerId'](_0x9ab2fe['Trunk']['callerid'],_0x9ab2fe[_0x8f45('0x34')],_0x9ab2fe[_0x8f45('0x127')]>0x0?ut['getCallerIdRandom'](_0x9ab2fe[_0x8f45('0x35')],_0x9ab2fe['dialRandomLastDigitCallerIdNumber']):_0x9ab2fe[_0x8f45('0x35')]):ut[_0x8f45('0x128')](_['isNil'](_0x9ab2fe['TrunkBackup'])?_0x9ab2fe[_0x8f45('0x50')][_0x8f45('0x52')]:_0x9ab2fe['TrunkBackup'][_0x8f45('0x52')],_0x9ab2fe[_0x8f45('0x34')],_0x9ab2fe[_0x8f45('0x127')]>0x0?ut[_0x8f45('0x129')](_0x9ab2fe['dialOriginateCallerIdNumber'],_0x9ab2fe[_0x8f45('0x127')]):_0x9ab2fe['dialOriginateCallerIdNumber']);if(_0x2fd887){_0x99a95f['originatecalleridname']=ut[_0x8f45('0x12a')](_0x2fd887);_0x99a95f[_0x8f45('0x12b')]=ut['extractCalleridNumber'](_0x2fd887);}var _0x58ca45=ut[_0x8f45('0x12c')](_0x9ab2fe,_0x1ae5d9,_0x385ed7,_0x2fd887,_0x575969,_0x99a95f);_[_0x8f45('0x12d')](_0x99a95f,ut[_0x8f45('0x12e')](_0x58ca45));_0x99a95f[_0x8f45('0x8a')]=moment()[_0x8f45('0x59')]('YYYY-MM-DD\x20HH:mm:ss');ami['Action'](ut['variablesAction'](_0x99a95f,_0x9ab2fe,_0x58ca45,_0x99a95f[_0x8f45('0xb0')],_0x5c5398))[_0x8f45('0x7f')](function(_0x2c6c28){_0x9ab2fe[_0x8f45('0x49')]+=0x1;logger[_0x8f45('0x57')]('[originated][increment]',_0x575969,_0x8f45('0xb7'),_0x9ab2fe[_0x8f45('0x26')],_0x8f45('0x6b'),_0x9ab2fe[_0x8f45('0x49')]);_0x33e3d1(_0x2c6c28);})[_0x8f45('0x73')](function(_0x565dfd){ut[_0x8f45('0xeb')](_0x99a95f,0xe,_0x8f45('0x12f'));rpcDb[_0x8f45('0xed')](_0x99a95f,'[originateFailure][logOriginateFailure]');_0x3f79ff(_0x565dfd);});});};Preview[_0x8f45('0xf')][_0x8f45('0x21')]=function(_0x211d95){if(this[_0x8f45('0x15')][_0x211d95[_0x8f45('0xb1')]]){this[_0x8f45('0x15')][_0x211d95['linkedid']]['channel']=_0x211d95['channel'];}};Preview['prototype'][_0x8f45('0x19')]=function(_0x2aab44){var _0x1b3044=this;var _0x5ee3be=this[_0x8f45('0x15')][_0x2aab44[_0x8f45('0x130')]];if(_0x5ee3be){if(_0x5ee3be[_0x8f45('0xfc')]&&this[_0x8f45('0x16')][_0x5ee3be[_0x8f45('0xfc')]]){ut[_0x8f45('0x131')](_0x5ee3be,this['agents'][_0x5ee3be[_0x8f45('0xfc')]][_0x8f45('0x26')],this['agents'][_0x5ee3be[_0x8f45('0xfc')]]['id']);}var _0x50740b=_[_0x8f45('0x132')](_0x5ee3be);_0x50740b[_0x8f45('0xb3')]=moment()[_0x8f45('0x59')](_0x8f45('0x8b'));var _0x9020eb=_0x1b3044[_0x8f45('0x25')][_0x5ee3be[_0x8f45('0x6c')]];if(ut[_0x8f45('0x133')](_0x2aab44[_0x8f45('0x134')])){if(_0x5ee3be['unlockAgent']){rpcDb[_0x8f45('0x10e')](_0x5ee3be['idContact']);}if(_0x5ee3be[_0x8f45('0xb0')]){rpcDb[_0x8f45('0x89')](_0x5ee3be[_0x8f45('0x135')]);}ami[_0x8f45('0xa1')]('custom:agentringnoanswer',ut[_0x8f45('0xa3')](_0x5ee3be,_0x8f45('0x136')));this[_0x8f45('0xe7')](_0x50740b,_0x9020eb,_0x2aab44);}else{_0x5ee3be['starttime']=moment()[_0x8f45('0x59')]('YYYY-MM-DD\x20HH:mm:ss');ut[_0x8f45('0xeb')](_0x50740b,0x4,_0x8f45('0xc1'));rpcDb[_0x8f45('0xed')](_0x50740b,'[callProgressDetectingAgent][logAnswer]');}}};Preview['prototype'][_0x8f45('0x1b')]=function(_0x3587c8){var _0x5127ce=this;var _0x3e12f4=this[_0x8f45('0x15')][_0x3587c8['linkedid']];var _0x20b2dc;if(_0x3e12f4){_0x20b2dc=this[_0x8f45('0x25')][_0x3e12f4['queue']];logger[_0x8f45('0x57')](_0x8f45('0x137'),_0x3587c8['linkedid'],_0x8f45('0xb7'),_0x20b2dc['name'],_0x8f45('0x6d'),_0x20b2dc[_0x8f45('0x2b')]);}if(this[_0x8f45('0x15')][_0x3587c8[_0x8f45('0xb1')]]&&_0x3587c8[_0x8f45('0xb1')]!==_0x3587c8['uniqueid']){if(_0x3587c8['cause']==='16'&&this['actions'][_0x3587c8['linkedid']][_0x8f45('0x77')]){this[_0x8f45('0x138')](_0x3587c8,_0x3587c8[_0x8f45('0xb1')],_0x3587c8[_0x8f45('0x139')]);}else if(this[_0x8f45('0x15')][_0x3587c8['linkedid']][_0x8f45('0x77')]){logger['info']('[syncHangup][talking][cause]',_0x3587c8[_0x8f45('0xb1')],_0x3587c8[_0x8f45('0x139')],_0x8f45('0xb7'),_0x20b2dc['name'],_0x8f45('0x6d'),_0x20b2dc[_0x8f45('0x2b')]);this['callProgressDetectingCustomer'](_0x3587c8,_0x3587c8['linkedid'],_0x3587c8[_0x8f45('0x139')]);}}else if(_0x3e12f4&&_[_0x8f45('0xf7')](_0x3e12f4[_0x8f45('0x13a')])&&_0x20b2dc[_0x8f45('0x13b')]&&_0x3587c8[_0x8f45('0xb1')]===_0x3587c8[_0x8f45('0xb6')]&&_['isNil'](_0x3587c8[_0x8f45('0xea')])&&_0x3587c8[_0x8f45('0x139')]==='16'&&_0x3587c8[_0x8f45('0x13c')]==='6'&&_[_0x8f45('0xe8')](_0x3e12f4[_0x8f45('0x13d')])){if(_0x3e12f4[_0x8f45('0xaf')]){rpcDb['unlockContact'](_0x3e12f4[_0x8f45('0x135')]);}if(_0x3e12f4[_0x8f45('0xb0')]){rpcDb[_0x8f45('0x89')](_0x3e12f4[_0x8f45('0x135')]);}_0x3587c8['reason']='22';this['callProgressDetectingAgent'](_0x3e12f4,_0x20b2dc,_0x3587c8);}else if(_0x3e12f4&&_0x3e12f4[_0x8f45('0x13d')]){if(_0x3587c8['cause']==='16'&&this['actions'][_0x3587c8[_0x8f45('0xb1')]]['dialAnswer']){logger[_0x8f45('0x57')](_0x8f45('0x13e'),_0x3587c8[_0x8f45('0xb1')],_0x3587c8[_0x8f45('0x139')],_0x8f45('0xb7'),_0x20b2dc[_0x8f45('0x26')],_0x8f45('0x6d'),_0x20b2dc[_0x8f45('0x2b')]);this[_0x8f45('0x138')](_0x3587c8,_0x3587c8[_0x8f45('0xb1')],_0x3587c8['cause']);}else if(this['actions'][_0x3587c8[_0x8f45('0xb1')]][_0x8f45('0x77')]){logger[_0x8f45('0x57')](_0x8f45('0x13f'),_0x3587c8[_0x8f45('0xb1')],_0x3587c8[_0x8f45('0x139')],_0x8f45('0xb7'),_0x20b2dc[_0x8f45('0x26')],'pTalking:\x20',_0x20b2dc[_0x8f45('0x2b')]);this[_0x8f45('0x138')](_0x3587c8,_0x3587c8['linkedid'],_0x3587c8[_0x8f45('0x139')]);}}};Preview['prototype'][_0x8f45('0x20')]=function(_0x8034f8){if(this['actions'][_0x8034f8['destlinkedid']]&&_0x8034f8[_0x8f45('0x140')]!==_0x8034f8[_0x8f45('0x141')]){this[_0x8f45('0x138')](_0x8034f8,_0x8034f8[_0x8f45('0x140')],_0x8034f8[_0x8f45('0xe5')]);}};Preview[_0x8f45('0xf')][_0x8f45('0x1e')]=function(_0x4a63ae){if(this[_0x8f45('0x15')][_0x4a63ae[_0x8f45('0xb1')]]&&_0x4a63ae[_0x8f45('0xb1')]!==_0x4a63ae[_0x8f45('0xb6')]&&!this[_0x8f45('0x15')][_0x4a63ae[_0x8f45('0xb1')]]['dialAnswer']){if(_0x4a63ae[_0x8f45('0x139')]==='1'){this[_0x8f45('0x138')](_0x4a63ae,_0x4a63ae[_0x8f45('0xb1')],_0x4a63ae[_0x8f45('0x139')]);}}};Preview['prototype'][_0x8f45('0x142')]=function(_0x5d7241,_0x5de9e1,_0x2169e5){if(this['actions'][_0x5d7241]){if(_[_0x8f45('0xf7')](this[_0x8f45('0x15')][_0x5d7241][_0x8f45('0x143')])){this['actions'][_0x5d7241][_0x8f45('0x143')]={};}this[_0x8f45('0x15')][_0x5d7241]['variables'][_0x5de9e1]=_0x2169e5;}};Preview[_0x8f45('0xf')][_0x8f45('0x144')]=function(_0x2140f5){try{if(!_[_0x8f45('0xf7')](_0x2140f5)){if(ut[_0x8f45('0x145')](_[_0x8f45('0x146')](_0x2140f5[_0x8f45('0x147')])[0x0])){this[_0x8f45('0x142')](_0x2140f5[_0x8f45('0xb6')],_[_0x8f45('0x146')](_0x2140f5[_0x8f45('0x147')])[0x0],_0x2140f5[_0x8f45('0x148')]);}}}catch(_0x2017c8){logger[_0x8f45('0x149')]('[syncVarSet][Preview]',util[_0x8f45('0x14a')](_0x2017c8,{'showHidden':![],'depth':null}));}};Preview[_0x8f45('0xf')][_0x8f45('0x23')]=function(_0x13c63c){if(_0x13c63c){if(this[_0x8f45('0x15')][_0x13c63c[_0x8f45('0x14b')]]){this[_0x8f45('0x15')][_0x13c63c[_0x8f45('0x14b')]][_0x8f45('0x13d')]=!![];}}};Preview['prototype'][_0x8f45('0x24')]=function(_0x5cd64e){if(_0x5cd64e){if(this[_0x8f45('0x15')][_0x5cd64e['transfererlinkedid']]){this[_0x8f45('0x15')][_0x5cd64e[_0x8f45('0x14c')]][_0x8f45('0x13d')]=!![];}}};module[_0x8f45('0x14d')]=Preview; \ No newline at end of file +var _0xd50f=['\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20work','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','SIP/%s/%s%s','dialCutDigit','substring','trim','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','toLowerVariables','OriginateError','[originateFailure][logOriginateFailure]','actionid','logLookAgent','isFailure','custom:agentringnoanswer','rejected','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','channelstate','transfer','reason','[syncHangup][talking][transfer]','destuniqueid','addVariable','variables','variable','keys','value','error','inspect','syncBlindTransfer','transfererlinkedid','util','lodash','bluebird','moment','../../../config/environment','../../../config/logger','preview','../ami','./rpcDb','./action','./util/util','redis','defaults','localhost','socket.io-emitter','prototype','enqueue','tail','sequence','campaignsPreview','voiceQueues','trunks','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','hanguprequest','syncHangupRequest','syncDialEnd','syncNewExten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','type','outbound','name','strategy','answered','loggedIn','pTalking','sumDuration','sumHoldTime','unmanaged','abandoned','loggedInDb','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundAbandonedCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','message','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','Trunk','active','callerid','Interval','stringify','md5','format','voice:queue:%s','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','available','paused','NOT_ACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','IS_DISACTIVED','\x20is\x20disactive','loopCampaigns','syncCampaigns','hasOwnProperty','dialMethod','clearZombieChannels','dialActive','setMessage','recallMe','clearZombieChannel','actions','[clearZombieChannels][talking]','Queue','originated:\x20','queue','pTalking:\x20','dialAnswer','pick','UserId','VoiceQueueId','ListId','Action','status','channel','catch','No\x20such\x20channel','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','[action]','size','agentReadyId','then','length','getDiff','scheduledat','dialRecallMeTimeout','Agent','voicePause','run','logger2','disableContact','starttime','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','logCustomer','RecallFailedTimeout','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','IsNotLoggedIn','AGENTS_NOT_LOGGED','isActive','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','emit','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','rescheduleContact','dialNoSuchNumberRetryFrequency','unlockAgent','linkedid','ANSWER','YYYY-MM-DD\x20HH:mm:ss','responsetime','[syncHangup][talking][increment]','uniqueid','\x20Queue','custom:agentconnect','connect','acw','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','total','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','talktime','sumBillable','[syncHangup][talking][decrement]','countbusyretry','Busy','busy','[callProgressDetectingCustomer][logBusy]','[callProgressDetectingCustomer][logBusyGlobal]','scheduledAt','dialBusyRetryFrequency','activeContact','NOANSWER','countnoanswerretry','NoAnswer','custom:agentnoanswer','noanswer','[callProgressDetectingCustomer][logNoAnswerGlobal]','[callProgressDetectingCustomer][logNoAnswer]','CONGESTION','countcongestionretry','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','dialCongestionMaxRetry','CANCEL','outboundRejectCallsDay','countagentrejectretry','AgentReject','agentreject','[syncHangupRequest][logAgentReject]','dialAgentRejectMaxRetry','[callProgressDetectingCustomer][logAgentReject]','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedMaxRety','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','dialstatus','[callProgressDetectingCustomer][logUnknownGlobal]','updateOriginated','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','object','isUndefined','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','AnswerAGI','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','checkInBlack','isNil','Contact','phone','Contact\x20is\x20undefined','agents','lookAgent','execCall','\x20IdHopper:\x20','idContact','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','createHistory','Contact\x20in\x20black\x20List','SIP/%s','reachable','unmonitored','unlock','unlockContact','execRun','getContactPreview','recallme','isValid','checkIsBlackList','Contact.phone','[Preview][checkIsBlackList]','[Preview][getContactPreview]','Call\x20unsuccessful','validateContact','isEmpty','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0xd50f,0x177));var _0xfd50=function(_0x99d9da,_0x1e1d73){_0x99d9da=_0x99d9da-0x0;var _0x571b4f=_0xd50f[_0x99d9da];return _0x571b4f;};'use strict';var util=require(_0xfd50('0x0'));var _=require(_0xfd50('0x1'));var BPromise=require(_0xfd50('0x2'));var uuid=require('uuid');var moment=require(_0xfd50('0x3'));var md5=require('md5');var Redis=require('ioredis');var config=require(_0xfd50('0x4'));var logger=require(_0xfd50('0x5'))(_0xfd50('0x6'));var loggerAction=require(_0xfd50('0x5'))('actionPreview');var ami=require(_0xfd50('0x7'));var rpcDb=require(_0xfd50('0x8'));var Action=require(_0xfd50('0x9'));var ut=require(_0xfd50('0xa'));config[_0xfd50('0xb')]=_[_0xfd50('0xc')](config[_0xfd50('0xb')],{'host':_0xfd50('0xd'),'port':0x18eb});var io=require(_0xfd50('0xe'))(new Redis(config[_0xfd50('0xb')]));var Sequence=function(){};Sequence[_0xfd50('0xf')][_0xfd50('0x10')]=function(_0x249c19){this['tail']=this[_0xfd50('0x11')]?this[_0xfd50('0x11')]['finally'](_0x249c19):_0x249c19();};function Preview(_0x3e72fa){this[_0xfd50('0x12')]=new Sequence();this[_0xfd50('0x13')]=_0x3e72fa[_0xfd50('0x14')];this[_0xfd50('0x15')]=_0x3e72fa[_0xfd50('0x15')];this['actions']={};this['agents']=_0x3e72fa['agents'];this[_0xfd50('0x16')]=0x0;ami['on'](_0xfd50('0x17'),this[_0xfd50('0x18')][_0xfd50('0x19')](this));ami['on'](_0xfd50('0x1a'),this['syncHangup']['bind'](this));ami['on'](_0xfd50('0x1b'),this[_0xfd50('0x1c')]['bind'](this));ami['on']('dialend',this[_0xfd50('0x1d')][_0xfd50('0x19')](this));ami['on']('newexten',this[_0xfd50('0x1e')][_0xfd50('0x19')](this));ami['on'](_0xfd50('0x1f'),this[_0xfd50('0x20')]['bind'](this));ami['on'](_0xfd50('0x21'),this[_0xfd50('0x22')]['bind'](this));ami['on'](_0xfd50('0x23'),this['syncBlindTransfer'][_0xfd50('0x19')](this));this['loopCampaigns'](this['campaignsPreview']);}function emit(_0x231803,_0x3558eb,_0x3f6a4d){io['to'](_0x231803)['emit'](_0x3558eb,_0x3f6a4d);}function emitCampaignPreview(_0x2c9d31){if(_0x2c9d31[_0xfd50('0x24')]===_0xfd50('0x25')){var _0x2b5275={'id':_0x2c9d31['id'],'name':_0x2c9d31[_0xfd50('0x26')],'strategy':_0x2c9d31[_0xfd50('0x27')],'answered':_0x2c9d31[_0xfd50('0x28')],'available':_0x2c9d31['available'],'loggedIn':_0x2c9d31[_0xfd50('0x29')],'pTalking':_0x2c9d31[_0xfd50('0x2a')],'sumBillable':_0x2c9d31['sumBillable'],'sumDuration':_0x2c9d31[_0xfd50('0x2b')],'sumHoldTime':_0x2c9d31[_0xfd50('0x2c')]||0x0,'talking':_0x2c9d31['talking'],'total':_0x2c9d31['total'],'type':_0x2c9d31[_0xfd50('0x24')],'unmanaged':_0x2c9d31[_0xfd50('0x2d')],'abandoned':_0x2c9d31[_0xfd50('0x2e')],'waiting':_0x2c9d31['waiting'],'loggedInDb':_0x2c9d31[_0xfd50('0x2f')],'dialActive':_0x2c9d31['dialActive'],'dialMethod':_0x2c9d31['dialMethod'],'dialOriginateCallerIdName':_0x2c9d31[_0xfd50('0x30')],'dialOriginateCallerIdNumber':_0x2c9d31[_0xfd50('0x31')],'dialOriginateTimeout':_0x2c9d31[_0xfd50('0x32')],'dialPrefix':_0x2c9d31[_0xfd50('0x33')],'outboundAnswerAgiCallsDay':_0x2c9d31[_0xfd50('0x34')],'outboundAnswerCallsDay':_0x2c9d31[_0xfd50('0x35')],'outboundBlacklistCallsDay':_0x2c9d31[_0xfd50('0x36')],'outboundBusyCallsDay':_0x2c9d31[_0xfd50('0x37')],'outboundCongestionCallsDay':_0x2c9d31[_0xfd50('0x38')],'outboundDropCallsDayACS':_0x2c9d31[_0xfd50('0x39')],'outboundDropCallsDayCallersExit':_0x2c9d31[_0xfd50('0x3a')],'outboundDropCallsDayTimeout':_0x2c9d31[_0xfd50('0x3b')],'outboundNoAnswerCallsDay':_0x2c9d31[_0xfd50('0x3c')],'outboundNoSuchCallsDay':_0x2c9d31[_0xfd50('0x3d')],'outboundOriginateFailureCallsDay':_0x2c9d31[_0xfd50('0x3e')],'outboundReCallsDay':_0x2c9d31[_0xfd50('0x3f')],'outboundRejectCallsDay':_0x2c9d31['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0x2c9d31['outboundUnknownCallsDay'],'outboundAbandonedCallsDay':_0x2c9d31[_0xfd50('0x40')],'predictiveIntervalAnsweredCalls':_0x2c9d31['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x2c9d31[_0xfd50('0x41')],'predictiveIntervalAvgTalktime':_0x2c9d31[_0xfd50('0x42')],'predictiveIntervalDroppedCallsCallersExit':_0x2c9d31[_0xfd50('0x43')],'predictiveIntervalDroppedCallsTimeout':_0x2c9d31['predictiveIntervalDroppedCallsTimeout'],'predictiveIntervalErlangCalls':_0x2c9d31[_0xfd50('0x44')],'predictiveIntervalErlangCallsDroppedCalls':_0x2c9d31[_0xfd50('0x45')],'predictiveIntervalHitRate':_0x2c9d31['predictiveIntervalHitRate'],'predictiveIntervalMultiplicativeFactor':_0x2c9d31[_0xfd50('0x46')],'predictiveIntervalPauses':_0x2c9d31[_0xfd50('0x47')],'predictiveIntervalAvailable':_0x2c9d31[_0xfd50('0x48')],'predictiveIntervalTotalCalls':_0x2c9d31[_0xfd50('0x49')],'message':_0x2c9d31[_0xfd50('0x4a')],'originated':_0x2c9d31[_0xfd50('0x4b')],'erlangCalls':_0x2c9d31[_0xfd50('0x4c')],'erlangCallToSecond':_0x2c9d31[_0xfd50('0x4d')],'erlangAbandonmentRate':_0x2c9d31[_0xfd50('0x4e')],'erlangBusyFactor':_0x2c9d31[_0xfd50('0x4f')],'startPredictive':_0x2c9d31['startPredictive'],'startProgressive':_0x2c9d31['startProgressive']};if(_0x2c9d31[_0xfd50('0x50')]){_0x2b5275[_0xfd50('0x50')]={'id':_0x2c9d31['Trunk']['id'],'name':_0x2c9d31[_0xfd50('0x50')][_0xfd50('0x26')],'active':_0x2c9d31[_0xfd50('0x50')][_0xfd50('0x51')],'callerid':_0x2c9d31[_0xfd50('0x50')][_0xfd50('0x52')]};}if(_0x2c9d31[_0xfd50('0x53')]){_0x2b5275[_0xfd50('0x53')]={'id':_0x2c9d31[_0xfd50('0x53')]['id'],'name':_0x2c9d31[_0xfd50('0x53')][_0xfd50('0x26')]};}var _0x3662b1=md5(JSON[_0xfd50('0x54')](_0x2b5275));if(_0x2c9d31[_0xfd50('0x55')]!==_0x3662b1){_0x2c9d31['md5']=_0x3662b1;emit(util[_0xfd50('0x56')](_0xfd50('0x57'),_0x2b5275[_0xfd50('0x26')]),'voice_queue:save',_0x2b5275);}}}function emitVoiceQueueChannelRemove(_0xccb267){logger[_0xfd50('0x58')](_0xfd50('0x59'),JSON[_0xfd50('0x54')](_0xccb267));emit(util[_0xfd50('0x56')](_0xfd50('0x57'),_0xccb267[_0xfd50('0x26')]),'voice_queue_channel:remove',_0xccb267);}function notSendMessagesQueue(_0x41e66f){if(_0x41e66f['sendMessageOneNotActive']){if(_0x41e66f[_0xfd50('0x4b')]===0x0&&_0x41e66f[_0xfd50('0x2a')]===0x0){_0x41e66f['sendMessageOneNotActive']=![];_0x41e66f[_0xfd50('0x5a')]=0x0;_0x41e66f[_0xfd50('0x5b')]=0x0;_0x41e66f[_0xfd50('0x4a')]=_0xfd50('0x5c');ut[_0xfd50('0x5d')](_0xfd50('0x5e'),_0x41e66f[_0xfd50('0x26')]+_0xfd50('0x5f'));}else{_0x41e66f[_0xfd50('0x4a')]=_0xfd50('0x60');ut[_0xfd50('0x5d')](_0xfd50('0x5e'),_0x41e66f[_0xfd50('0x26')]+_0xfd50('0x61'));}emitCampaignPreview(_0x41e66f);}}Preview[_0xfd50('0xf')][_0xfd50('0x62')]=function(){var _0x39a24b=this;setInterval(function(){_0x39a24b[_0xfd50('0x63')]();},0x7cf);};Preview[_0xfd50('0xf')]['syncCampaigns']=function(){var _0x7265ce=this['campaignsPreview'];this['clockClearZombieChannels']+=0x1;for(var _0x539eb7 in _0x7265ce){if(_0x7265ce[_0xfd50('0x64')](_0x539eb7)&&(_0x7265ce[_0x539eb7]['dialMethod']===_0xfd50('0x6')||_0x7265ce[_0x539eb7][_0xfd50('0x65')]==='booked')&&_0x7265ce[_0x539eb7][_0xfd50('0x24')]===_0xfd50('0x25')){if(this[_0xfd50('0x16')]>0x7){this[_0xfd50('0x16')]=0x0;this[_0xfd50('0x66')]();}}if(_0x7265ce[_0xfd50('0x64')](_0x539eb7)&&_0x7265ce[_0x539eb7][_0xfd50('0x65')]==='preview'&&_0x7265ce[_0x539eb7][_0xfd50('0x24')]===_0xfd50('0x25')){if(_0x7265ce[_0x539eb7][_0xfd50('0x67')]){this[_0xfd50('0x68')](_0x7265ce[_0x539eb7]);this[_0xfd50('0x69')](_0x7265ce[_0x539eb7]);}else{notSendMessagesQueue(_0x7265ce[_0x539eb7]);}}}};Preview[_0xfd50('0xf')][_0xfd50('0x6a')]=function(_0x5e7810){var _0x1b76f5=this;this[_0xfd50('0x12')][_0xfd50('0x10')](function(){if(!_['isNil'](_0x1b76f5[_0xfd50('0x6b')][_0x5e7810])){loggerAction[_0xfd50('0x58')](_0xfd50('0x6c'),_0x5e7810,_0xfd50('0x6d'),_0x1b76f5[_0xfd50('0x6b')][_0x5e7810]['queue'],_0xfd50('0x6e'),JSON[_0xfd50('0x54')](_0x1b76f5[_0xfd50('0x13')][_0x1b76f5['actions'][_0x5e7810][_0xfd50('0x6f')]][_0xfd50('0x4b')]),_0xfd50('0x70'),JSON[_0xfd50('0x54')](_0x1b76f5[_0xfd50('0x13')][_0x1b76f5[_0xfd50('0x6b')][_0x5e7810]['queue']]['pTalking']),JSON[_0xfd50('0x54')](_0x1b76f5[_0xfd50('0x6b')][_0x5e7810][_0xfd50('0x71')]),JSON[_0xfd50('0x54')](_[_0xfd50('0x72')](_0x1b76f5[_0xfd50('0x6b')][_0x5e7810],['contactId',_0xfd50('0x73'),_0xfd50('0x74'),_0xfd50('0x75')])));return ami[_0xfd50('0x76')]({'action':_0xfd50('0x77'),'channel':_0x1b76f5[_0xfd50('0x6b')][_0x5e7810][_0xfd50('0x78')]})[_0xfd50('0x79')](function(_0x520d75){if(_0x520d75['message']===_0xfd50('0x7a')){setTimeout(function(){if(_0x1b76f5[_0xfd50('0x6b')][_0x5e7810]){ut['updateOriginated'](_0x1b76f5['campaignsPreview'][_0x1b76f5[_0xfd50('0x6b')][_0x5e7810][_0xfd50('0x6f')]],_0xfd50('0x7b'));if(_0x1b76f5['actions'][_0x5e7810][_0xfd50('0x71')]===!![]){ut[_0xfd50('0x7c')](_0x1b76f5[_0xfd50('0x13')][_0x1b76f5['actions'][_0x5e7810]['queue']],_0xfd50('0x7b'));ut[_0xfd50('0x7d')](_0xfd50('0x7e')+_0x5e7810,_0x1b76f5[_0xfd50('0x6b')][_0x5e7810][_0xfd50('0x6f')]);}ut['loggerError'](_0xfd50('0x7f')+_0x5e7810,_0x1b76f5[_0xfd50('0x6b')][_0x5e7810][_0xfd50('0x6f')]);delete _0x1b76f5[_0xfd50('0x6b')][_0x5e7810];}},0x2328);}});}});};Preview[_0xfd50('0xf')][_0xfd50('0x66')]=function(){var _0x30cbc4=this;loggerAction['info'](_0xfd50('0x80'),_[_0xfd50('0x81')](this['actions']));for(var _0x2e1f07 in this[_0xfd50('0x6b')]){if(_0x30cbc4[_0xfd50('0x6b')][_0xfd50('0x64')](_0x2e1f07)){_0x30cbc4['clearZombieChannel'](_0x2e1f07);}}};Preview[_0xfd50('0xf')]['recallMe']=function(_0x420df8){var _0x456e68=this;rpcDb['getContactRecallMe'](_0x420df8['id'],ut[_0xfd50('0x82')](this['agents']))[_0xfd50('0x83')](function(_0x3f9068){if(!_['isNil'](_0x3f9068)){for(var _0x517a13=0x0;_0x517a13<_0x3f9068[_0xfd50('0x84')];_0x517a13+=0x1){if(ut[_0xfd50('0x85')](_0x3f9068[_0x517a13][_0xfd50('0x86')])<_0x420df8[_0xfd50('0x87')]*0x3c){if(_0x3f9068[_0x517a13][_0xfd50('0x88')]&&!_0x3f9068[_0x517a13]['Agent'][_0xfd50('0x89')]){_0x456e68[_0xfd50('0x8a')](_0x3f9068[_0x517a13]['id'])[_0xfd50('0x83')](ut['logger2']('[RecallMe]'))[_0xfd50('0x79')](ut[_0xfd50('0x8b')]('[RecallMe]'));}else{rpcDb[_0xfd50('0x8c')](_0x3f9068[_0x517a13]['id']);}}else{var _0x36954f=new Action(_0x3f9068[_0x517a13],_0x420df8);_0x36954f[_0xfd50('0x8d')]=moment()[_0xfd50('0x56')]('YYYY-MM-DD\x20HH:mm:ss');_0x420df8[_0xfd50('0x3f')]+=0x1;ut['logCustomer'](_0x36954f,0x17,_0xfd50('0x8e'));if(_0x420df8[_0xfd50('0x8f')]){rpcDb[_0xfd50('0x90')](ut['createBody'](_0x3f9068[_0x517a13]));rpcDb[_0xfd50('0x91')](_0x36954f,_0xfd50('0x92'));}else{ut[_0xfd50('0x93')](_0x36954f,0x16,_0xfd50('0x94'));rpcDb[_0xfd50('0x91')](_0x36954f,_0xfd50('0x95'));rpcDb[_0xfd50('0x96')](_0x36954f,_0xfd50('0x95'));}}}}})[_0xfd50('0x79')](ut['logger2'](_0xfd50('0x97')));};Preview[_0xfd50('0xf')]['setMessage']=function(_0x20873c){_0x20873c['sendMessageOneNotActive']=!![];if(ut[_0xfd50('0x98')](_0x20873c[_0xfd50('0x29')])){_0x20873c[_0xfd50('0x4a')]=_0xfd50('0x99');}else if(!ut[_0xfd50('0x9a')](_0x20873c[_0xfd50('0x67')])){_0x20873c[_0xfd50('0x4a')]=_0xfd50('0x5c');}else if(!this[_0xfd50('0x9b')](_0x20873c[_0xfd50('0x50')])){if(!this['isTrunkReachable'](_0x20873c[_0xfd50('0x9c')])){_0x20873c['message']=_0xfd50('0x9d');}else{_0x20873c[_0xfd50('0x4a')]=_0xfd50('0x9e');}}else{_0x20873c[_0xfd50('0x4a')]='ACTIVE';}emitCampaignPreview(_0x20873c);};Preview[_0xfd50('0xf')][_0xfd50('0x9f')]=function(_0x5e7f28,_0x1f6a77,_0x4c8ff0){var _0x20022f=this;var _0x10012a=this[_0xfd50('0x6b')][_0x1f6a77];var _0x3ae801=this[_0xfd50('0x13')][_0x10012a[_0xfd50('0x6f')]];var _0x572417;if(_0x3ae801){switch(_0x4c8ff0){case'1':_0x3ae801['outboundNoSuchCallsDay']+=0x1;_0x10012a[_0xfd50('0xa0')]+=0x1;_0x10012a[_0xfd50('0xa1')]=ut[_0xfd50('0xa2')](_0x10012a);ut[_0xfd50('0x93')](_0x10012a,0x0,_0xfd50('0xa3'));ami[_0xfd50('0xa4')]('custom:agentnosuchnumber',ut[_0xfd50('0xa5')](_0x10012a,_0xfd50('0xa6')));rpcDb[_0xfd50('0x91')](_0x10012a,_0xfd50('0xa7'));if(ut[_0xfd50('0xa2')](_0x10012a)>=_0x3ae801[_0xfd50('0xa8')]){_0x572417=ut[_0xfd50('0xa9')](_0x10012a,0xf,_0xfd50('0xaa'));rpcDb['createCustomerFinal'](_0x572417,_0xfd50('0xab'));}else{if(_0x10012a['countnosuchnumberretry']>=_0x3ae801[_0xfd50('0xac')]){rpcDb[_0xfd50('0x96')](_0x10012a,_0xfd50('0xab'));}else{rpcDb[_0xfd50('0xad')](ut['scheduledAt'](_0x10012a,_0xfd50('0xa0'),_0x3ae801[_0xfd50('0xae')]),_0x10012a[_0xfd50('0xaf')],_0x10012a['activeContact']);}}delete this[_0xfd50('0x6b')][_0x5e7f28[_0xfd50('0xb0')]];break;case _0xfd50('0xb1'):var _0x54cdf3=moment()[_0xfd50('0x56')](_0xfd50('0xb2'));_0x10012a[_0xfd50('0xb3')]=_0x54cdf3;_0x10012a['answertime']=_0x54cdf3;_0x10012a[_0xfd50('0x71')]=!![];_0x3ae801['pTalking']+=0x1;logger[_0xfd50('0x58')](_0xfd50('0xb4'),_0x10012a[_0xfd50('0xb5')],_0xfd50('0xb6'),_0x3ae801[_0xfd50('0x26')],_0xfd50('0x70'),_0x3ae801['pTalking']);ami[_0xfd50('0xa4')](_0xfd50('0xb7'),ut[_0xfd50('0xa5')](_0x10012a,_0xfd50('0xb8')));if(_0x3ae801[_0xfd50('0xb9')]){ami['emit'](_0xfd50('0xba'),ut[_0xfd50('0xbb')](_0x10012a));}break;case'16':ami['emit'](_0xfd50('0xbc'),ut['buildObj'](_0x10012a,_0xfd50('0xbd')));emitVoiceQueueChannelRemove(ut['buildObj'](_0x10012a,_0xfd50('0xbd')));_0x3ae801[_0xfd50('0x35')]+=0x1;_0x3ae801[_0xfd50('0xbe')]+=0x1;_0x3ae801[_0xfd50('0x28')]+=0x1;ut[_0xfd50('0x7c')](_0x3ae801,_0xfd50('0xbf'));_0x10012a[_0xfd50('0xa1')]=ut[_0xfd50('0xa2')](_0x10012a);ut[_0xfd50('0x93')](_0x10012a,0x4,_0xfd50('0xc0'));rpcDb[_0xfd50('0x91')](_0x10012a,_0xfd50('0xc1'));rpcDb[_0xfd50('0x96')](_0x10012a,_0xfd50('0xc2'));rpcDb['crateCustomerReportQueue'](_0x10012a);_0x3ae801[_0xfd50('0x2b')]+=_0x10012a[_0xfd50('0xc3')];_0x3ae801[_0xfd50('0xc4')]+=_0x10012a[_0xfd50('0xc3')];logger['info'](_0xfd50('0xc5'),_0x10012a[_0xfd50('0xb5')],_0xfd50('0xb6'),_0x3ae801[_0xfd50('0x26')],_0xfd50('0x70'),_0x3ae801[_0xfd50('0x2a')]);delete this[_0xfd50('0x6b')][_0x5e7f28[_0xfd50('0xb0')]];break;case'BUSY':_0x3ae801[_0xfd50('0x37')]+=0x1;_0x10012a[_0xfd50('0xc6')]+=0x1;_0x10012a[_0xfd50('0xa1')]=ut['totalGlobal'](_0x10012a);ut[_0xfd50('0x93')](_0x10012a,0x5,_0xfd50('0xc7'));ami['emit']('custom:agentbusy',ut[_0xfd50('0xa5')](_0x10012a,_0xfd50('0xc8')));rpcDb[_0xfd50('0x91')](_0x10012a,_0xfd50('0xc9'));if(ut[_0xfd50('0xa2')](_0x10012a)>=_0x3ae801[_0xfd50('0xa8')]){_0x572417=ut[_0xfd50('0xa9')](_0x10012a,0xf,_0xfd50('0xaa'));rpcDb['createCustomerFinal'](_0x572417,_0xfd50('0xca'));}else{if(_0x10012a['countbusyretry']>=_0x3ae801['dialBusyMaxRetry']){rpcDb[_0xfd50('0x96')](_0x10012a,_0xfd50('0xc9'));}else{rpcDb[_0xfd50('0xad')](ut[_0xfd50('0xcb')](_0x10012a,_0xfd50('0xc6'),_0x3ae801[_0xfd50('0xcc')]),_0x10012a[_0xfd50('0xaf')],_0x10012a[_0xfd50('0xcd')]);}}break;case _0xfd50('0xce'):_0x3ae801['outboundNoAnswerCallsDay']+=0x1;_0x10012a[_0xfd50('0xcf')]+=0x1;_0x10012a[_0xfd50('0xa1')]=ut['totalGlobal'](_0x10012a);ut[_0xfd50('0x93')](_0x10012a,0x3,_0xfd50('0xd0'));ami[_0xfd50('0xa4')](_0xfd50('0xd1'),ut['buildObj'](_0x10012a,_0xfd50('0xd2')));rpcDb[_0xfd50('0x91')](_0x10012a,'[callProgressDetectingCustomer][logNoAnswer]');if(ut[_0xfd50('0xa2')](_0x10012a)>=_0x3ae801[_0xfd50('0xa8')]){_0x572417=ut['cloneAction'](_0x10012a,0xf,'Global');rpcDb['createCustomerFinal'](_0x572417,_0xfd50('0xd3'));}else{if(_0x10012a[_0xfd50('0xcf')]>=_0x3ae801['dialNoAnswerMaxRetry']){rpcDb['createCustomerFinal'](_0x10012a,_0xfd50('0xd4'));}else{rpcDb[_0xfd50('0xad')](ut['scheduledAt'](_0x10012a,_0xfd50('0xcf'),_0x3ae801['dialNoAnswerRetryFrequency']),_0x10012a[_0xfd50('0xaf')],_0x10012a[_0xfd50('0xcd')]);}}break;case _0xfd50('0xd5'):_0x3ae801[_0xfd50('0x38')]+=0x1;_0x10012a[_0xfd50('0xd6')]+=0x1;_0x10012a[_0xfd50('0xa1')]=ut[_0xfd50('0xa2')](_0x10012a);ut[_0xfd50('0x93')](_0x10012a,0x8,'Congestion');ami['emit'](_0xfd50('0xd7'),ut['buildObj'](_0x10012a,_0xfd50('0xd8')));rpcDb[_0xfd50('0x91')](_0x10012a,_0xfd50('0xd9'));if(ut[_0xfd50('0xa2')](_0x10012a)>=_0x3ae801[_0xfd50('0xa8')]){_0x572417=ut[_0xfd50('0xa9')](_0x10012a,0xf,_0xfd50('0xaa'));rpcDb[_0xfd50('0x96')](_0x572417,'[callProgressDetectingCustomer][logCongestionGlobal]');}else{if(_0x10012a[_0xfd50('0xd6')]>=_0x3ae801[_0xfd50('0xda')]){rpcDb[_0xfd50('0x96')](_0x10012a,_0xfd50('0xd9'));}else{rpcDb[_0xfd50('0xad')](ut[_0xfd50('0xcb')](_0x10012a,_0xfd50('0xd6'),_0x3ae801[_0xfd50('0xcc')]),_0x10012a[_0xfd50('0xaf')],_0x10012a[_0xfd50('0xcd')]);}}break;case _0xfd50('0xdb'):_0x3ae801[_0xfd50('0xdc')]+=0x1;_0x10012a[_0xfd50('0xdd')]+=0x1;_0x10012a['countglobal']=ut[_0xfd50('0xa2')](_0x10012a);ut[_0xfd50('0x93')](_0x10012a,0x14,_0xfd50('0xde'));ami[_0xfd50('0xa4')]('custom:agentreject',ut[_0xfd50('0xa5')](_0x10012a,_0xfd50('0xdf')));rpcDb[_0xfd50('0x91')](_0x10012a,_0xfd50('0xe0'));if(ut['totalGlobal'](_0x10012a)>=_0x3ae801['dialGlobalMaxRetry']){_0x572417=ut['cloneAction'](_0x10012a,0x14,_0xfd50('0xde'));rpcDb[_0xfd50('0x96')](_0x572417,'[callProgressDetectingCustomer][logAgentReject]');}else{if(_0x10012a[_0xfd50('0xdd')]>=_0x3ae801[_0xfd50('0xe1')]){rpcDb[_0xfd50('0x96')](_0x10012a,_0xfd50('0xe2'));}else{rpcDb[_0xfd50('0xad')](ut['scheduledAt'](_0x10012a,_0xfd50('0xdd'),_0x3ae801['dialAgentRejectRetryFrequency']),_0x10012a[_0xfd50('0xaf')],_0x10012a[_0xfd50('0xcd')]);}}break;case'ABANDONED':_0x3ae801['outboundAbandonedCallsDay']+=0x1;_0x10012a[_0xfd50('0xe3')]+=0x1;_0x10012a[_0xfd50('0xa1')]=ut[_0xfd50('0xa2')](_0x10012a);ut[_0xfd50('0x93')](_0x10012a,0xb,_0xfd50('0xe4'));rpcDb['createCustomerHistory'](_0x10012a,_0xfd50('0xe5'));if(ut['totalGlobal'](_0x10012a)>=_0x3ae801['dialGlobalMaxRetry']){_0x572417=ut[_0xfd50('0xa9')](_0x10012a,0xf,'Global');rpcDb[_0xfd50('0x96')](_0x572417,_0xfd50('0xe5'));}else{if(_0x10012a['countabandonedetry']>=_0x3ae801[_0xfd50('0xe6')]){rpcDb[_0xfd50('0x96')](_0x10012a,_0xfd50('0xe5'));}else{rpcDb[_0xfd50('0xad')](ut['scheduledAt'](_0x10012a,_0xfd50('0xe3'),_0x3ae801['dialAbandonedRetryFrequency']),_0x10012a['unlockAgent'],_0x10012a[_0xfd50('0xcd')]);}}break;default:if(_0x10012a[_0xfd50('0x71')]){ut[_0xfd50('0x7c')](_0x3ae801,_0xfd50('0xe7'));ut['loggerError'](_0xfd50('0xe8')+_0x3ae801[_0xfd50('0x26')],_0x5e7f28);}_0x3ae801['outboundUnknownCallsDay']+=0x1;_0x10012a[_0xfd50('0xa1')]=ut['totalGlobal'](_0x10012a);ut[_0xfd50('0x93')](_0x10012a,0xc,_0x5e7f28['cause-txt']||_0x5e7f28[_0xfd50('0xe9')]);rpcDb[_0xfd50('0x91')](_0x10012a,'[callProgressDetectingCustomer][logUnknown]');if(ut['totalGlobal'](_0x10012a)>=_0x3ae801[_0xfd50('0xa8')]){_0x572417=ut[_0xfd50('0xa9')](_0x10012a,0xf,_0xfd50('0xaa'));rpcDb[_0xfd50('0x96')](_0x572417,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0xfd50('0x96')](_0x10012a,_0xfd50('0xea'));}delete this['actions'][_0x5e7f28[_0xfd50('0xb0')]];}if(!(_0x10012a[_0xfd50('0x71')]&&_0x4c8ff0==='16')){ut[_0xfd50('0xeb')](_0x3ae801,_0xfd50('0xec'));logger[_0xfd50('0x58')](_0xfd50('0xed'),_0x10012a[_0xfd50('0xb5')],_0xfd50('0xb6'),_0x3ae801['name'],'originated:\x20',_0x3ae801[_0xfd50('0x4b')]);}if(_0x4c8ff0!==_0xfd50('0xb1')){delete this['actions'][_0x5e7f28[_0xfd50('0xb0')]];delete this[_0xfd50('0x6b')][_0x5e7f28[_0xfd50('0xee')]];}}};Preview[_0xfd50('0xf')][_0xfd50('0xef')]=function(_0x4e561a,_0x30ca95,_0x5d4fe5){if(_['isUndefined'](_0x30ca95)&&_0xfd50('0xf0')!==typeof _0x30ca95){return;}if(_[_0xfd50('0xf1')](_0x5d4fe5)&&_0xfd50('0xf0')!==typeof _0x5d4fe5){return;}switch(_0x5d4fe5['reason']){case'0':ut[_0xfd50('0xf2')](_0x4e561a,0x0,_0xfd50('0xa3'));rpcDb['createAgentHistory'](_0x4e561a,'[callProgressDetectingAgent][logNoSuch]');break;case'3':ut[_0xfd50('0xf2')](_0x4e561a,0x3,'NoAnswer');rpcDb[_0xfd50('0xf3')](_0x4e561a,_0xfd50('0xf4'));break;case'5':ut[_0xfd50('0xf2')](_0x4e561a,0x5,_0xfd50('0xc7'));rpcDb['createAgentHistory'](_0x4e561a,_0xfd50('0xf5'));break;case'8':ut['logAgent'](_0x4e561a,0x8,'Congestion');rpcDb[_0xfd50('0xf3')](_0x4e561a,'[callProgressDetectingAgent][logCongestion]');break;case'22':ut[_0xfd50('0xf2')](_0x4e561a,0x16,_0xfd50('0xf6'));rpcDb['createAgentHistory'](_0x4e561a,'[callProgressDetectingAgent][logAnswerAGI]');break;default:ut[_0xfd50('0xf2')](_0x4e561a,0xc,_0x5d4fe5['reason']);rpcDb[_0xfd50('0xf3')](_0x4e561a,_0xfd50('0xf7'));}ut[_0xfd50('0xeb')](_0x30ca95,_0xfd50('0xf8'));logger['info'](_0xfd50('0xf9'),_0x4e561a[_0xfd50('0xb5')],_0xfd50('0xb6'),_0x30ca95[_0xfd50('0x26')],_0xfd50('0x6e'),_0x30ca95['originated']);delete this[_0xfd50('0x6b')][_0x4e561a['uniqueid']];};Preview[_0xfd50('0xf')][_0xfd50('0xfa')]=function(_0x53d5be,_0x13b0d5,_0x3048e6,_0xf09a3b,_0x10b066){var _0x464516=this;return new BPromise(function(_0x4f871a,_0x522ccc){if(_[_0xfd50('0xfb')](_0x13b0d5)||_[_0xfd50('0xfb')](_0x13b0d5[_0xfd50('0xfc')])||_['isNil'](_0x13b0d5['Contact'][_0xfd50('0xfd')])||_[_0xfd50('0xfb')](_0x13b0d5[_0xfd50('0x74')])){_0x522ccc(ut[_0xfd50('0x4a')](_0xfd50('0xfe'),_0xf09a3b,_0x10b066));return;}var _0x34c883=uuid['v4']();var _0x4575f4=_0x464516[_0xfd50('0x13')][_0x13b0d5[_0xfd50('0x6d')][_0xfd50('0x26')]];var _0x4cf8c4=_0x3048e6?_0x464516[_0xfd50('0xff')][_0x3048e6]['id']:undefined;_0x464516['actions'][_0x34c883]=new Action(_0x13b0d5,_0x4575f4,_0x34c883,_0x3048e6,_0x4cf8c4);var _0x21598e=_0x464516[_0xfd50('0x6b')][_0x34c883];_0x21598e[_0xfd50('0xaf')]=_0xf09a3b;_0x21598e[_0xfd50('0xcd')]=_0x10b066;_0x21598e[_0xfd50('0x100')]=_0x3048e6;if(_['isEmpty'](_0x53d5be)){_0x464516[_0xfd50('0x101')](_0x21598e,_0x4575f4,_0x13b0d5,_0x3048e6)['then'](function(_0x2780fe){logger['info']('[Preview][execCall][success]','Queue:\x20'+_0x21598e[_0xfd50('0x6f')]+_0xfd50('0x102')+_0x21598e[_0xfd50('0x103')],JSON[_0xfd50('0x54')](_0x2780fe));ami[_0xfd50('0xa4')](_0xfd50('0x104'),ut[_0xfd50('0xa5')](_0x21598e,_0xfd50('0x105')));_0x4f871a(ut[_0xfd50('0x4a')](_0xfd50('0x106')));})[_0xfd50('0x79')](function(_0x169e17){ut[_0xfd50('0x5d')](_0xfd50('0x107'),_0x169e17);_0x522ccc(ut[_0xfd50('0x4a')](_0xfd50('0x108'),_0xf09a3b,_0x10b066));});}else{_0x4575f4[_0xfd50('0x36')]+=0x1;ut[_0xfd50('0x109')](_0x21598e);rpcDb[_0xfd50('0x10a')](_0x21598e,'[Blacklist][error]');delete _0x464516[_0xfd50('0x6b')][_0x34c883];_0x522ccc(ut[_0xfd50('0x4a')](_0xfd50('0x10b'),_0xf09a3b,_0x10b066));}});};Preview['prototype'][_0xfd50('0x9b')]=function(_0x2aaa85){return!_['isNil'](_0x2aaa85)&&!_[_0xfd50('0xfb')](_0x2aaa85[_0xfd50('0x26')])&&!_[_0xfd50('0xfb')](_0x2aaa85[_0xfd50('0x51')])&&_0x2aaa85[_0xfd50('0x51')]&&!_[_0xfd50('0xfb')](this[_0xfd50('0x15')][util[_0xfd50('0x56')]('SIP/%s',_0x2aaa85[_0xfd50('0x26')])])&&!_[_0xfd50('0xfb')](this['trunks'][util['format'](_0xfd50('0x10c'),_0x2aaa85[_0xfd50('0x26')])][_0xfd50('0x77')])&&(this[_0xfd50('0x15')][util['format'](_0xfd50('0x10c'),_0x2aaa85[_0xfd50('0x26')])][_0xfd50('0x77')]===_0xfd50('0x10d')||this[_0xfd50('0x15')][util[_0xfd50('0x56')](_0xfd50('0x10c'),_0x2aaa85[_0xfd50('0x26')])][_0xfd50('0x77')]===_0xfd50('0x10e'));};Preview[_0xfd50('0xf')][_0xfd50('0x8a')]=function(_0x359ff3,_0x431a73){var _0x231341=this;return new BPromise(function(_0x5a80ae,_0x47c56b){_0x231341['execRun'](_0x359ff3,_0x431a73)[_0xfd50('0x83')](function(_0x41c023){_0x5a80ae(_[_0xfd50('0x72')](_0x41c023,[_0xfd50('0x4a')]));})[_0xfd50('0x79')](function(_0x554718){if(_0x554718[_0xfd50('0x10f')]){rpcDb[_0xfd50('0x110')](_0x359ff3);}if(_0x554718[_0xfd50('0x51')]){rpcDb['disableContact'](_0x359ff3);}_0x47c56b(_[_0xfd50('0x72')](_0x554718,[_0xfd50('0x4a')]));});});};Preview[_0xfd50('0xf')][_0xfd50('0x111')]=function(_0x2163a2,_0x14a093){var _0x13883d=this;return new BPromise(function(_0x366b5c,_0x225fb0){var _0x5531cf,_0x528bae;rpcDb[_0xfd50('0x112')](_0x2163a2)[_0xfd50('0x83')](function(_0x295452){if(!_[_0xfd50('0xfb')](_0x295452[0x0])){_0x528bae=_0x295452[0x0][_0xfd50('0x113')]?![]:!![];_0x5531cf=_0x295452[0x0][_0xfd50('0x113')]?!![]:![];_0x5531cf=_0x14a093?!![]:_0x5531cf;}var _0x269f1d=_0x13883d['validateContact'](_0x295452);if(_0x269f1d[_0xfd50('0x114')]){rpcDb[_0xfd50('0x115')](_[_0xfd50('0x72')](_0x295452[0x0],['VoiceQueueId',_0xfd50('0x116')]))['then'](function(_0x3e9c72){_0x13883d[_0xfd50('0xfa')](_0x3e9c72,_0x295452[0x0],_0x14a093,_0x528bae,_0x5531cf)[_0xfd50('0x83')](function(_0x4f24a7){_0x366b5c(_0x4f24a7);})[_0xfd50('0x79')](function(_0x3c29cf){_0x225fb0(_0x3c29cf);});})[_0xfd50('0x79')](function(_0x37d0d2){ut['logger'](_0xfd50('0x117'),_0x37d0d2);_0x225fb0(ut[_0xfd50('0x4a')]('Call\x20unsuccessful',_0x528bae,_0x5531cf));});}else{_0x225fb0(ut[_0xfd50('0x4a')](_0x269f1d['message'],_0x528bae,_0x5531cf));}})[_0xfd50('0x79')](function(_0x4e4561){ut[_0xfd50('0x5d')](_0xfd50('0x118'),_0x4e4561);_0x225fb0(ut[_0xfd50('0x4a')](_0xfd50('0x119'),![],!![]));});});};Preview[_0xfd50('0xf')][_0xfd50('0x11a')]=function(_0x980d78){if(_['isNil'](_0x980d78)||_[_0xfd50('0x11b')](_0x980d78)||!_[_0xfd50('0xfb')](_0x980d78[0x0]['Agent'])&&_[_0xfd50('0xfb')](_0x980d78[0x0][_0xfd50('0x88')][_0xfd50('0x26')])){ut[_0xfd50('0x5d')]('[Preview][validateContact][Empty\x20Contact]',_0x980d78);return{'isValid':![],'message':_0xfd50('0x11c')};}var _0xea8ae9=this['campaignsPreview'][_0x980d78[0x0][_0xfd50('0x6d')]['name']];_0xea8ae9[_0xfd50('0x4a')]=_0xfd50('0x9e');if(_['isNil'](_0xea8ae9)){ut[_0xfd50('0x5d')](_0xfd50('0x11d'),_0xea8ae9);return{'isValid':![],'message':_0xfd50('0x11e')};}if(!this[_0xfd50('0x9b')](_0xea8ae9['Trunk'])){ut[_0xfd50('0x5d')](_0xfd50('0x11f'),_0xfd50('0x120')+_0xea8ae9[_0xfd50('0x26')]+_0xfd50('0x121'));if(!this['isTrunkReachable'](_0xea8ae9['TrunkBackup'])){ut[_0xfd50('0x5d')](_0xfd50('0x11f'),_0xea8ae9[_0xfd50('0x26')]+'\x20Trunk\x20Backup\x20is\x20not\x20active');return{'isValid':![],'message':_0xfd50('0x122')};}}if(!ut['isActive'](_0xea8ae9[_0xfd50('0x67')])){ut[_0xfd50('0x5d')](_0xfd50('0x123'),_0xea8ae9[_0xfd50('0x26')]+_0xfd50('0x124'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0xea8ae9[_0xfd50('0x26')]+_0xfd50('0x124')};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0xfd50('0xf')][_0xfd50('0x101')]=function(_0x420ae6,_0x3ac1b7,_0x5797f4,_0x42f11f){var _0x1558aa=this;return new BPromise(function(_0x46deff,_0x328186){var _0x3e9dde=_0x420ae6[_0xfd50('0xb5')];var _0x577b65=_0x1558aa['isTrunkReachable'](_0x3ac1b7[_0xfd50('0x50')])?util[_0xfd50('0x56')](_0xfd50('0x125'),_0x3ac1b7[_0xfd50('0x50')]['name'],_[_0xfd50('0xfb')](_0x3ac1b7['dialPrefix'])?'':_0x3ac1b7[_0xfd50('0x33')]['trim']()||'',_0x3ac1b7[_0xfd50('0x126')]>0x0?_0x5797f4['Contact'][_0xfd50('0xfd')][_0xfd50('0x127')](_0x3ac1b7[_0xfd50('0x126')]):_0x5797f4[_0xfd50('0xfc')]['phone']):util[_0xfd50('0x56')]('SIP/%s/%s%s',_[_0xfd50('0xfb')](_0x3ac1b7[_0xfd50('0x9c')])?_0x3ac1b7['Trunk'][_0xfd50('0x26')]:_0x3ac1b7[_0xfd50('0x9c')][_0xfd50('0x26')],_[_0xfd50('0xfb')](_0x3ac1b7[_0xfd50('0x33')])?'':_0x3ac1b7[_0xfd50('0x33')][_0xfd50('0x128')]()||'',_0x3ac1b7['dialCutDigit']>0x0?_0x5797f4[_0xfd50('0xfc')][_0xfd50('0xfd')][_0xfd50('0x127')](_0x3ac1b7[_0xfd50('0x126')]):_0x5797f4[_0xfd50('0xfc')][_0xfd50('0xfd')]);var _0x57fd85=_0x1558aa[_0xfd50('0x9b')](_0x3ac1b7['Trunk'])?ut['getCallerId'](_0x3ac1b7[_0xfd50('0x50')][_0xfd50('0x52')],_0x3ac1b7[_0xfd50('0x30')],_0x3ac1b7[_0xfd50('0x129')]>0x0?ut['getCallerIdRandom'](_0x3ac1b7['dialOriginateCallerIdNumber'],_0x3ac1b7['dialRandomLastDigitCallerIdNumber']):_0x3ac1b7[_0xfd50('0x31')]):ut['getCallerId'](_['isNil'](_0x3ac1b7[_0xfd50('0x9c')])?_0x3ac1b7[_0xfd50('0x50')][_0xfd50('0x52')]:_0x3ac1b7[_0xfd50('0x9c')][_0xfd50('0x52')],_0x3ac1b7[_0xfd50('0x30')],_0x3ac1b7[_0xfd50('0x129')]>0x0?ut[_0xfd50('0x12a')](_0x3ac1b7[_0xfd50('0x31')],_0x3ac1b7[_0xfd50('0x129')]):_0x3ac1b7[_0xfd50('0x31')]);if(_0x57fd85){_0x420ae6[_0xfd50('0x12b')]=ut[_0xfd50('0x12c')](_0x57fd85);_0x420ae6[_0xfd50('0x12d')]=ut[_0xfd50('0x12e')](_0x57fd85);}var _0x232b25=ut[_0xfd50('0x12f')](_0x3ac1b7,_0x5797f4,_0x577b65,_0x57fd85,_0x3e9dde,_0x420ae6);_['merge'](_0x420ae6,ut[_0xfd50('0x130')](_0x232b25));_0x420ae6['starttime']=moment()[_0xfd50('0x56')](_0xfd50('0xb2'));ami[_0xfd50('0x76')](ut['variablesAction'](_0x420ae6,_0x3ac1b7,_0x232b25,_0x420ae6[_0xfd50('0xcd')],_0x42f11f))[_0xfd50('0x83')](function(_0x10dc14){_0x3ac1b7['originated']+=0x1;logger[_0xfd50('0x58')]('[originated][increment]',_0x3e9dde,_0xfd50('0xb6'),_0x3ac1b7[_0xfd50('0x26')],_0xfd50('0x6e'),_0x3ac1b7[_0xfd50('0x4b')]);_0x46deff(_0x10dc14);})[_0xfd50('0x79')](function(_0x294b22){ut[_0xfd50('0xf2')](_0x420ae6,0xe,_0xfd50('0x131'));rpcDb[_0xfd50('0xf3')](_0x420ae6,_0xfd50('0x132'));_0x328186(_0x294b22);});});};Preview['prototype']['syncNewExten']=function(_0x463c29){if(this[_0xfd50('0x6b')][_0x463c29[_0xfd50('0xb0')]]){this[_0xfd50('0x6b')][_0x463c29[_0xfd50('0xb0')]][_0xfd50('0x78')]=_0x463c29[_0xfd50('0x78')];}};Preview[_0xfd50('0xf')][_0xfd50('0x18')]=function(_0x3e41b4){var _0xdb5680=this;var _0x4036a4=this['actions'][_0x3e41b4[_0xfd50('0x133')]];if(_0x4036a4){if(_0x4036a4['lookAgent']&&this['agents'][_0x4036a4['lookAgent']]){ut[_0xfd50('0x134')](_0x4036a4,this['agents'][_0x4036a4[_0xfd50('0x100')]][_0xfd50('0x26')],this[_0xfd50('0xff')][_0x4036a4[_0xfd50('0x100')]]['id']);}var _0x2f71c3=_['clone'](_0x4036a4);_0x2f71c3['responsetime']=moment()[_0xfd50('0x56')](_0xfd50('0xb2'));var _0x196479=_0xdb5680[_0xfd50('0x13')][_0x4036a4[_0xfd50('0x6f')]];if(ut[_0xfd50('0x135')](_0x3e41b4['response'])){if(_0x4036a4[_0xfd50('0xaf')]){rpcDb['unlockContact'](_0x4036a4[_0xfd50('0x103')]);}if(_0x4036a4[_0xfd50('0xcd')]){rpcDb['disableContact'](_0x4036a4[_0xfd50('0x103')]);}ami[_0xfd50('0xa4')](_0xfd50('0x136'),ut['buildObj'](_0x4036a4,_0xfd50('0x137')));this[_0xfd50('0xef')](_0x2f71c3,_0x196479,_0x3e41b4);}else{_0x4036a4[_0xfd50('0x8d')]=moment()[_0xfd50('0x56')](_0xfd50('0xb2'));ut[_0xfd50('0xf2')](_0x2f71c3,0x4,_0xfd50('0xc0'));rpcDb[_0xfd50('0xf3')](_0x2f71c3,_0xfd50('0x138'));}}};Preview['prototype']['syncHangup']=function(_0x3b842e){var _0x4ff57e=this;var _0x72d2b7=this[_0xfd50('0x6b')][_0x3b842e[_0xfd50('0xb0')]];var _0x4742cb;if(_0x72d2b7){_0x4742cb=this[_0xfd50('0x13')][_0x72d2b7['queue']];logger[_0xfd50('0x58')](_0xfd50('0x139'),_0x3b842e[_0xfd50('0xb0')],_0xfd50('0xb6'),_0x4742cb[_0xfd50('0x26')],_0xfd50('0x70'),_0x4742cb[_0xfd50('0x2a')]);}if(this[_0xfd50('0x6b')][_0x3b842e[_0xfd50('0xb0')]]&&_0x3b842e['linkedid']!==_0x3b842e[_0xfd50('0xb5')]){if(_0x3b842e[_0xfd50('0x13a')]==='16'&&this[_0xfd50('0x6b')][_0x3b842e[_0xfd50('0xb0')]]['dialAnswer']){this['callProgressDetectingCustomer'](_0x3b842e,_0x3b842e[_0xfd50('0xb0')],_0x3b842e[_0xfd50('0x13a')]);}else if(this[_0xfd50('0x6b')][_0x3b842e['linkedid']][_0xfd50('0x71')]){logger[_0xfd50('0x58')](_0xfd50('0x13b'),_0x3b842e[_0xfd50('0xb0')],_0x3b842e[_0xfd50('0x13a')],_0xfd50('0xb6'),_0x4742cb[_0xfd50('0x26')],_0xfd50('0x70'),_0x4742cb[_0xfd50('0x2a')]);this['callProgressDetectingCustomer'](_0x3b842e,_0x3b842e[_0xfd50('0xb0')],_0x3b842e[_0xfd50('0x13a')]);}}else if(_0x72d2b7&&_[_0xfd50('0xfb')](_0x72d2b7[_0xfd50('0x13c')])&&_0x4742cb[_0xfd50('0x13d')]&&_0x3b842e[_0xfd50('0xb0')]===_0x3b842e[_0xfd50('0xb5')]&&_[_0xfd50('0xfb')](_0x3b842e['reason'])&&_0x3b842e['cause']==='16'&&_0x3b842e[_0xfd50('0x13e')]==='6'&&_[_0xfd50('0xf1')](_0x72d2b7[_0xfd50('0x13f')])){if(_0x72d2b7['unlockAgent']){rpcDb[_0xfd50('0x110')](_0x72d2b7['idContact']);}if(_0x72d2b7[_0xfd50('0xcd')]){rpcDb[_0xfd50('0x8c')](_0x72d2b7[_0xfd50('0x103')]);}_0x3b842e[_0xfd50('0x140')]='22';this[_0xfd50('0xef')](_0x72d2b7,_0x4742cb,_0x3b842e);}else if(_0x72d2b7&&_0x72d2b7['transfer']){if(_0x3b842e[_0xfd50('0x13a')]==='16'&&this[_0xfd50('0x6b')][_0x3b842e['linkedid']][_0xfd50('0x71')]){logger[_0xfd50('0x58')](_0xfd50('0x141'),_0x3b842e[_0xfd50('0xb0')],_0x3b842e['cause'],_0xfd50('0xb6'),_0x4742cb[_0xfd50('0x26')],'pTalking:\x20',_0x4742cb[_0xfd50('0x2a')]);this[_0xfd50('0x9f')](_0x3b842e,_0x3b842e['linkedid'],_0x3b842e[_0xfd50('0x13a')]);}else if(this[_0xfd50('0x6b')][_0x3b842e[_0xfd50('0xb0')]][_0xfd50('0x71')]){logger[_0xfd50('0x58')](_0xfd50('0x13b'),_0x3b842e[_0xfd50('0xb0')],_0x3b842e['cause'],_0xfd50('0xb6'),_0x4742cb[_0xfd50('0x26')],_0xfd50('0x70'),_0x4742cb['pTalking']);this[_0xfd50('0x9f')](_0x3b842e,_0x3b842e['linkedid'],_0x3b842e[_0xfd50('0x13a')]);}}};Preview['prototype']['syncDialEnd']=function(_0x3e59c9){if(this[_0xfd50('0x6b')][_0x3e59c9[_0xfd50('0xee')]]&&_0x3e59c9['destlinkedid']!==_0x3e59c9[_0xfd50('0x142')]){this['callProgressDetectingCustomer'](_0x3e59c9,_0x3e59c9['destlinkedid'],_0x3e59c9['dialstatus']);}};Preview[_0xfd50('0xf')][_0xfd50('0x1c')]=function(_0x5e460c){if(this['actions'][_0x5e460c[_0xfd50('0xb0')]]&&_0x5e460c[_0xfd50('0xb0')]!==_0x5e460c[_0xfd50('0xb5')]&&!this['actions'][_0x5e460c[_0xfd50('0xb0')]][_0xfd50('0x71')]){if(_0x5e460c[_0xfd50('0x13a')]==='1'){this[_0xfd50('0x9f')](_0x5e460c,_0x5e460c['linkedid'],_0x5e460c[_0xfd50('0x13a')]);}}};Preview[_0xfd50('0xf')][_0xfd50('0x143')]=function(_0x45d99c,_0xebf366,_0x939f9a){if(this[_0xfd50('0x6b')][_0x45d99c]){if(_[_0xfd50('0xfb')](this['actions'][_0x45d99c][_0xfd50('0x144')])){this[_0xfd50('0x6b')][_0x45d99c][_0xfd50('0x144')]={};}this[_0xfd50('0x6b')][_0x45d99c]['variables'][_0xebf366]=_0x939f9a;}};Preview['prototype']['syncVarSet']=function(_0x305f7e){try{if(!_[_0xfd50('0xfb')](_0x305f7e)){if(ut['filterKey'](_['keys'](_0x305f7e[_0xfd50('0x145')])[0x0])){this[_0xfd50('0x143')](_0x305f7e[_0xfd50('0xb5')],_[_0xfd50('0x146')](_0x305f7e[_0xfd50('0x145')])[0x0],_0x305f7e[_0xfd50('0x147')]);}}}catch(_0x249ee3){logger[_0xfd50('0x148')]('[syncVarSet][Preview]',util[_0xfd50('0x149')](_0x249ee3,{'showHidden':![],'depth':null}));}};Preview[_0xfd50('0xf')][_0xfd50('0x22')]=function(_0x56a0cf){if(_0x56a0cf){if(this[_0xfd50('0x6b')][_0x56a0cf['transfertargetlinkedid']]){this[_0xfd50('0x6b')][_0x56a0cf['transfertargetlinkedid']]['transfer']=!![];}}};Preview[_0xfd50('0xf')][_0xfd50('0x14a')]=function(_0x1474fb){if(_0x1474fb){if(this[_0xfd50('0x6b')][_0x1474fb[_0xfd50('0x14b')]]){this['actions'][_0x1474fb['transfererlinkedid']][_0xfd50('0x13f')]=!![];}}};module['exports']=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 8a7584e..8274b40 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 _0xabce=['catch','[createHistory]\x20','createHistory','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','UserId','active','rescheduleContact','countReScheduled','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','context','from-sip','exten','holdtime','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','create','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','preview','lodash','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','error','resolve','then'];(function(_0x20896e,_0xcea268){var _0x1d11d0=function(_0x4a3b7f){while(--_0x4a3b7f){_0x20896e['push'](_0x20896e['shift']());}};_0x1d11d0(++_0xcea268);}(_0xabce,0x103));var _0xeabc=function(_0x266618,_0x18f637){_0x266618=_0x266618-0x0;var _0x54dbf5=_0xabce[_0x266618];return _0x54dbf5;};'use strict';var util=require(_0xeabc('0x0'));var BPromise=require(_0xeabc('0x1'));var logger=require(_0xeabc('0x2'))(_0xeabc('0x3'));var _=require(_0xeabc('0x4'));var cmHopper=require('../rpc/cmHopper');var cmHopperFinal=require('../rpc/cmHopperFinal');var cmHopperHistory=require(_0xeabc('0x5'));var cmHopperBlack=require(_0xeabc('0x6'));var voiceQueueRt=require(_0xeabc('0x7'));var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require('../rpc/voiceQueueReport');function loggerCatch(_0x1b07a8){return function(_0x52a4d7){logger[_0xeabc('0x8')](_0x1b07a8,util['inspect'](_0x52a4d7,{'showHidden':![],'depth':null}));};}function create(_0x3bdc29){return BPromise[_0xeabc('0x9')]()[_0xeabc('0xa')](cmHopperHistory['createHistory'](_0x3bdc29))[_0xeabc('0xb')](loggerCatch(_0xeabc('0xc')));}function createAgent(_0x2f73e9){return BPromise[_0xeabc('0x9')]()[_0xeabc('0xa')](agentReportPreview[_0xeabc('0xd')](_0x2f73e9))[_0xeabc('0xb')](loggerCatch(_0xeabc('0xc')));}function moveContact(_0xdb5022){return BPromise[_0xeabc('0x9')]()[_0xeabc('0xa')](cmHopper[_0xeabc('0xe')](_0xdb5022,!![]))[_0xeabc('0xb')](loggerCatch(_0xeabc('0xf')));}exports[_0xeabc('0x10')]=function(_0xcfbf06){return BPromise['resolve']()[_0xeabc('0xa')](cmHopperBlack[_0xeabc('0x10')](_0xcfbf06))[_0xeabc('0xb')](loggerCatch('[checkIsBlackList]\x20'));};exports['getContactPreview']=function(_0x3170ea){return BPromise[_0xeabc('0x9')]()[_0xeabc('0xa')](cmHopper['getContactPreview'](_0x3170ea))[_0xeabc('0xb')](loggerCatch(_0xeabc('0x11')));};exports['createHistory']=function(_0x53fe28,_0x10fa8e){create(_0x53fe28)['catch'](loggerCatch(_0x10fa8e));moveContact(_0x53fe28)[_0xeabc('0xb')](loggerCatch(_0x10fa8e));};exports[_0xeabc('0x12')]=function(_0x58a3c0,_0x16f08b){createAgent(_0x58a3c0)[_0xeabc('0xb')](loggerCatch(_0x16f08b));};exports[_0xeabc('0x13')]=function(_0x384be5,_0x5e30ee){create(_0x384be5)['catch'](loggerCatch(_0x5e30ee));};exports[_0xeabc('0x14')]=function(_0x4d68ea,_0x31201a){moveContact(_0x4d68ea)[_0xeabc('0xb')](loggerCatch(_0x31201a));};exports['rescheduleContact']=function(_0x28063a,_0x41d67a,_0x254590){if(_0x41d67a){_0x28063a[_0xeabc('0x15')]=null;}if(_0x254590){_0x28063a[_0xeabc('0x16')]=![];}return BPromise['resolve']()[_0xeabc('0xa')](cmHopper[_0xeabc('0x17')](_0x28063a))[_0xeabc('0xb')](loggerCatch('[rescheduleContact]\x20'));};exports[_0xeabc('0x18')]=function(_0x3854d2){return BPromise[_0xeabc('0x9')]()[_0xeabc('0xa')](cmHopper['countReScheduled'](_0x3854d2))[_0xeabc('0xb')](loggerCatch('[countReScheduled]\x20'));};exports[_0xeabc('0x19')]=function(_0x4d4e29){return BPromise[_0xeabc('0x9')]()[_0xeabc('0xa')](cmHopper[_0xeabc('0x19')]({'UserId':null},_0x4d4e29,0x1))[_0xeabc('0xb')](loggerCatch(_0xeabc('0x1a')));};exports[_0xeabc('0x1b')]=function(_0x131722){return BPromise['resolve']()['then'](cmHopper[_0xeabc('0x19')]({'active':![]},_0x131722,0x1))['catch'](loggerCatch(_0xeabc('0x1c')));};exports[_0xeabc('0x1d')]=function(_0x48fb52){var _0x2163e6={};_0x2163e6[_0xeabc('0x1e')]=_0x48fb52[_0xeabc('0x1e')];_0x2163e6[_0xeabc('0x1f')]=_0x48fb52[_0xeabc('0x1f')];_0x2163e6[_0xeabc('0x20')]=_0x48fb52[_0xeabc('0x20')];_0x2163e6[_0xeabc('0x21')]=_0x48fb52[_0xeabc('0x21')];_0x2163e6['queue']=_0x48fb52[_0xeabc('0x22')];_0x2163e6['queuecallerjoinAt']=_0x48fb52[_0xeabc('0x23')];_0x2163e6[_0xeabc('0x24')]=_0x48fb52[_0xeabc('0x23')];_0x2163e6[_0xeabc('0x25')]=0x1;_0x2163e6[_0xeabc('0x26')]=_0x48fb52[_0xeabc('0x27')];_0x2163e6[_0xeabc('0x28')]=_0x48fb52['membername'];_0x2163e6[_0xeabc('0x29')]=_0xeabc('0x2a');_0x2163e6[_0xeabc('0x2b')]='xcally-motion-preview';_0x2163e6[_0xeabc('0x2c')]=0x0;_0x2163e6[_0xeabc('0x2d')]=0x1;_0x2163e6[_0xeabc('0x2e')]=_0x48fb52['membername'];_0x2163e6[_0xeabc('0x2f')]=_0xeabc('0x30');return BPromise[_0xeabc('0x9')]()['then'](voiceQueueReport[_0xeabc('0x31')](_0x2163e6))[_0xeabc('0xb')](loggerCatch('[voiceQueueReport]\x20'));};exports['getContactRecallMe']=function(_0x254568,_0x3829a9){return BPromise['resolve']()[_0xeabc('0xa')](cmHopper[_0xeabc('0x32')](_0x254568,_0x3829a9))[_0xeabc('0xb')](loggerCatch(_0xeabc('0x33')));};exports[_0xeabc('0x34')]=function(_0x4b7923){return BPromise[_0xeabc('0x9')]()['then'](cmHopper[_0xeabc('0x17')](_0x4b7923,!![],!![]))[_0xeabc('0xb')](loggerCatch(_0xeabc('0x35')));}; \ No newline at end of file +var _0xdb94=['../../../config/logger','lodash','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/agentReportPreview','error','inspect','then','createHistory','catch','[createHistory]\x20','resolve','moveContactManagedDialer','[checkIsBlackList]\x20','getContactPreview','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','active','countReScheduled','unlockContact','[unlockContact]\x20','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','answertime','queuecallerleaveAt','queuecallercomplete','connectedlinename','membername','exten','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','getContactRecallMe','[rescheduleContactInQueue]\x20','bluebird'];(function(_0x4084eb,_0x30c6ad){var _0x4c1f1c=function(_0x1ca12e){while(--_0x1ca12e){_0x4084eb['push'](_0x4084eb['shift']());}};_0x4c1f1c(++_0x30c6ad);}(_0xdb94,0xe5));var _0x4db9=function(_0x23df0a,_0x3aa851){_0x23df0a=_0x23df0a-0x0;var _0xa54d98=_0xdb94[_0x23df0a];return _0xa54d98;};'use strict';var util=require('util');var BPromise=require(_0x4db9('0x0'));var logger=require(_0x4db9('0x1'))('preview');var _=require(_0x4db9('0x2'));var cmHopper=require(_0x4db9('0x3'));var cmHopperFinal=require(_0x4db9('0x4'));var cmHopperHistory=require(_0x4db9('0x5'));var cmHopperBlack=require(_0x4db9('0x6'));var voiceQueueRt=require('../rpc/voiceQueueRt');var agentReportPreview=require(_0x4db9('0x7'));var voiceQueueReport=require('../rpc/voiceQueueReport');function loggerCatch(_0x1d21a8){return function(_0xc76bc1){logger[_0x4db9('0x8')](_0x1d21a8,util[_0x4db9('0x9')](_0xc76bc1,{'showHidden':![],'depth':null}));};}function create(_0x42a857){return BPromise['resolve']()[_0x4db9('0xa')](cmHopperHistory[_0x4db9('0xb')](_0x42a857))[_0x4db9('0xc')](loggerCatch(_0x4db9('0xd')));}function createAgent(_0x402132){return BPromise['resolve']()[_0x4db9('0xa')](agentReportPreview[_0x4db9('0xb')](_0x402132))[_0x4db9('0xc')](loggerCatch(_0x4db9('0xd')));}function moveContact(_0x34147f){return BPromise[_0x4db9('0xe')]()['then'](cmHopper[_0x4db9('0xf')](_0x34147f,!![]))[_0x4db9('0xc')](loggerCatch('[moveContactManagedDialer]\x20'));}exports['checkIsBlackList']=function(_0x19f2d3){return BPromise[_0x4db9('0xe')]()[_0x4db9('0xa')](cmHopperBlack['checkIsBlackList'](_0x19f2d3))[_0x4db9('0xc')](loggerCatch(_0x4db9('0x10')));};exports[_0x4db9('0x11')]=function(_0x1ea47d){return BPromise[_0x4db9('0xe')]()['then'](cmHopper[_0x4db9('0x11')](_0x1ea47d))[_0x4db9('0xc')](loggerCatch('[getContactPreview]\x20'));};exports[_0x4db9('0xb')]=function(_0x7df575,_0x42fbb8){create(_0x7df575)['catch'](loggerCatch(_0x42fbb8));moveContact(_0x7df575)[_0x4db9('0xc')](loggerCatch(_0x42fbb8));};exports[_0x4db9('0x12')]=function(_0x4c5f4f,_0x50f685){createAgent(_0x4c5f4f)['catch'](loggerCatch(_0x50f685));};exports[_0x4db9('0x13')]=function(_0x4235ab,_0x48ff99){create(_0x4235ab)[_0x4db9('0xc')](loggerCatch(_0x48ff99));};exports[_0x4db9('0x14')]=function(_0x353718,_0x192c5d){moveContact(_0x353718)[_0x4db9('0xc')](loggerCatch(_0x192c5d));};exports[_0x4db9('0x15')]=function(_0x34a6ed,_0x111f4a,_0x3256f4){if(_0x111f4a){_0x34a6ed[_0x4db9('0x16')]=null;}if(_0x3256f4){_0x34a6ed[_0x4db9('0x17')]=![];}return BPromise[_0x4db9('0xe')]()['then'](cmHopper[_0x4db9('0x15')](_0x34a6ed))[_0x4db9('0xc')](loggerCatch('[rescheduleContact]\x20'));};exports[_0x4db9('0x18')]=function(_0x3f4931){return BPromise[_0x4db9('0xe')]()[_0x4db9('0xa')](cmHopper['countReScheduled'](_0x3f4931))[_0x4db9('0xc')](loggerCatch('[countReScheduled]\x20'));};exports[_0x4db9('0x19')]=function(_0x1c82b6){return BPromise[_0x4db9('0xe')]()[_0x4db9('0xa')](cmHopper[_0x4db9('0x19')]({'UserId':null},_0x1c82b6,0x1))[_0x4db9('0xc')](loggerCatch(_0x4db9('0x1a')));};exports['disableContact']=function(_0x5f59be){return BPromise[_0x4db9('0xe')]()['then'](cmHopper[_0x4db9('0x19')]({'active':![]},_0x5f59be,0x1))[_0x4db9('0xc')](loggerCatch(_0x4db9('0x1b')));};exports[_0x4db9('0x1c')]=function(_0x384df5){var _0x3c3fcf={};_0x3c3fcf[_0x4db9('0x1d')]=_0x384df5[_0x4db9('0x1d')];_0x3c3fcf['uniqueid']=_0x384df5[_0x4db9('0x1e')];_0x3c3fcf['calleridnum']=_0x384df5[_0x4db9('0x1f')];_0x3c3fcf[_0x4db9('0x20')]=_0x384df5[_0x4db9('0x20')];_0x3c3fcf[_0x4db9('0x21')]=_0x384df5[_0x4db9('0x21')];_0x3c3fcf['queuecallerjoinAt']=_0x384df5[_0x4db9('0x22')];_0x3c3fcf[_0x4db9('0x23')]=_0x384df5[_0x4db9('0x22')];_0x3c3fcf[_0x4db9('0x24')]=0x1;_0x3c3fcf['queuecallercompleteAt']=_0x384df5['endtime'];_0x3c3fcf[_0x4db9('0x25')]=_0x384df5[_0x4db9('0x26')];_0x3c3fcf['context']='from-sip';_0x3c3fcf[_0x4db9('0x27')]='xcally-motion-preview';_0x3c3fcf['holdtime']=0x0;_0x3c3fcf[_0x4db9('0x28')]=0x1;_0x3c3fcf[_0x4db9('0x29')]=_0x384df5['membername'];_0x3c3fcf[_0x4db9('0x2a')]=_0x4db9('0x2b');return BPromise[_0x4db9('0xe')]()[_0x4db9('0xa')](voiceQueueReport['create'](_0x3c3fcf))[_0x4db9('0xc')](loggerCatch('[voiceQueueReport]\x20'));};exports['getContactRecallMe']=function(_0x4999d1,_0x2bc7df){return BPromise[_0x4db9('0xe')]()['then'](cmHopper[_0x4db9('0x2c')](_0x4999d1,_0x2bc7df))[_0x4db9('0xc')](loggerCatch('[GetContactRecallMe]\x20'));};exports['rescheduleContactInQueue']=function(_0x5d1f4d){return BPromise[_0x4db9('0xe')]()['then'](cmHopper[_0x4db9('0x15')](_0x5d1f4d,!![],!![]))['catch'](loggerCatch(_0x4db9('0x2d')));}; \ No newline at end of file diff --git a/server/services/ami/preview/util/util.js b/server/services/ami/preview/util/util.js index 667afbb..1839d1b 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 _0xda81=['rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosbridged','rtpaudioqosjitterbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','random','match','extractCalleridNumber','util','lodash','moment','preview','env','XCALLY_IP_AGI','127.0.0.1','diff','seconds','loggerCatch','error','inspect','logger','info','loggerError','message','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','name','calleridname','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','dialQueueProject2','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','originatecalleridname','xcally-motion-preview','monitor_format','_XCALLY_MIXMONITOR_FORMAT','Contact','hasOwnProperty','tags','createdAt','%s%s','XMD-','toUpper','toLowerVariables','updateOriginated','originated','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','Blacklist','starttime','responsetime','logAgent','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','ringtime','logLookAgent','UserId','logCustomer','endtime','talktime','answertime','isFailure','Failure','RECALL','BOOKED','uniqueid','originate','channelAgent','from-sip','timeout','totalGlobal','countcongestionretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','Global','scheduledAt','active','scheduledat','add','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','buildObj','queue','interface','buildAcw','not_inuse','status','getDiff','milliseconds','createBody','CampaignId','filterKey','idContact','type','campaigntype','dialAnswer','membername','countbusyretry','callback','callbackuniqueid','recallme','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosloss'];(function(_0x3f5c7e,_0x3f9962){var _0x2658d2=function(_0x19a26c){while(--_0x19a26c){_0x3f5c7e['push'](_0x3f5c7e['shift']());}};_0x2658d2(++_0x3f9962);}(_0xda81,0x1c3));var _0x1da8=function(_0x4e8f4f,_0x1b005c){_0x4e8f4f=_0x4e8f4f-0x0;var _0x5ed788=_0xda81[_0x4e8f4f];return _0x5ed788;};'use strict';var util=require(_0x1da8('0x0'));var _=require(_0x1da8('0x1'));var moment=require(_0x1da8('0x2'));var logger=require('../../../../config/logger')(_0x1da8('0x3'));var ipAgi=process[_0x1da8('0x4')][_0x1da8('0x5')]||_0x1da8('0x6');function getSeconds(_0x48421c,_0x3357ac){var _0x2692c1=moment(_0x48421c)['milliseconds'](0x0);var _0x1aef7a=moment(_0x3357ac)['milliseconds'](0x0);return _0x2692c1[_0x1da8('0x7')](_0x1aef7a,_0x1da8('0x8'));}exports[_0x1da8('0x9')]=function(_0x1a3278){return function(_0x11dc1e){logger[_0x1da8('0xa')](_0x1a3278,util[_0x1da8('0xb')](_0x11dc1e,{'showHidden':![],'depth':null}));};};exports[_0x1da8('0xc')]=function(_0x45afb6,_0x5361ef){logger[_0x1da8('0xd')](_0x45afb6,util[_0x1da8('0xb')](_0x5361ef,{'showHidden':![],'depth':null}));};exports[_0x1da8('0xe')]=function(_0x24895e,_0x19543d){logger['error'](_0x24895e,util[_0x1da8('0xb')](_0x19543d,{'showHidden':![],'depth':null}));};exports['logger2']=function(_0x120d54){return function(_0x4127c8){logger[_0x1da8('0xd')](_0x120d54,util[_0x1da8('0xb')](_0x4127c8,{'showHidden':![],'depth':null}));};};exports[_0x1da8('0xf')]=function(_0x5c722d,_0x9d4cd3,_0x491a3f){return{'message':_0x5c722d,'unlock':_0x9d4cd3,'active':_0x491a3f};};exports[_0x1da8('0x10')]=function(_0x283169,_0x126954,_0x4a3025){if(!_[_0x1da8('0x11')](_0x4a3025)&&_0x1da8('0x12')===typeof _0x4a3025&&!_['isEmpty'](_0x4a3025)){if(!_[_0x1da8('0x11')](_0x126954)&&_0x1da8('0x12')===typeof _0x126954&&!_[_0x1da8('0x13')](_0x126954)){return util[_0x1da8('0x14')](_0x1da8('0x15'),_0x126954,_0x4a3025);}return util[_0x1da8('0x14')](_0x1da8('0x15'),_0x4a3025,_0x4a3025);}if(!_[_0x1da8('0x11')](_0x283169)&&_0x1da8('0x12')===typeof _0x283169&&!_['isEmpty'](_0x283169)){return _0x283169;}return _0x1da8('0x16');};exports[_0x1da8('0x17')]=function(_0x313172){if(_[_0x1da8('0x18')](_0x313172)){return![];}return _0x313172;};exports[_0x1da8('0x19')]=function(_0xb85101,_0x5380c7,_0x346662,_0x36f234,_0x3afeb3,_0x3a6ffa){var _0x9f2255={'XMD-QUEUE':_0x5380c7[_0x1da8('0x1a')]?_0x5380c7['Queue'][_0x1da8('0x1b')]:'','XMD-CALLERID':_0x36f234,'XMD-CALLERID-PREVIEW':_0x3a6ffa?util['format'](_0x1da8('0x15'),_0x3a6ffa[_0x1da8('0x1c')],_0x3a6ffa[_0x1da8('0x1d')]):_0x36f234,'XMD-DIALID':_0x3afeb3,'XMD-CONTACTID':_0x5380c7[_0x1da8('0x1e')],'XMD-CDRTYPE':_0x1da8('0x1f'),'CALLERID(all)':_0x36f234,'XMD-VOICEQUEUEID':_0x5380c7[_0x1da8('0x20')],'XMD-DIALCHANNEL':_0x346662,'XMD-DIALTIMEOUT':_0xb85101[_0x1da8('0x21')]||0x1e,'XMD-DIALOPTIONS':util['format']('\x22rtTxX%s%s\x22',_0xb85101[_0x1da8('0x22')]?'g':'',_[_0x1da8('0x13')](_0xb85101['monitor_format'])?'':_0x1da8('0x23')),'XMD-DIALURL':_0xb85101[_0x1da8('0x24')]||'','XMD-AGI':_0xb85101[_0x1da8('0x25')]?util[_0x1da8('0x14')](_0x1da8('0x26'),ipAgi,_0xb85101[_0x1da8('0x25')]):'NONE','XMD-AGIAFTER':_0xb85101[_0x1da8('0x22')]?util[_0x1da8('0x14')](_0x1da8('0x26'),ipAgi,_0xb85101[_0x1da8('0x22')]):_0x1da8('0x27'),'XMD-ORIGINATECALLERIDNUM':_0x3a6ffa?_0x3a6ffa[_0x1da8('0x28')]:'','XMD-ORIGINATECALLERIDNAME':_0x3a6ffa?_0x3a6ffa[_0x1da8('0x29')]:'','XMD-DESTINATION':_0x1da8('0x2a')};if(!_[_0x1da8('0x13')](_0xb85101[_0x1da8('0x2b')])){_0x9f2255[util['format']('%s',_0x1da8('0x2c'))]=_0xb85101['monitor_format'];_0x9f2255[util['format']('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x3afeb3;}if(_0x5380c7&&_0x5380c7['Contact']){for(var _0x3e7c00 in _0x5380c7[_0x1da8('0x2d')]){if(_0x5380c7['Contact'][_0x1da8('0x2e')](_0x3e7c00)){if(!_['isNil'](_0x5380c7[_0x1da8('0x2d')][_0x3e7c00])&&_0x3e7c00!=='id'&&_0x3e7c00!==_0x1da8('0x2f')&&_0x3e7c00!==_0x1da8('0x30')&&_0x3e7c00!=='updatedAt'){_0x9f2255[util[_0x1da8('0x14')](_0x1da8('0x31'),_0x1da8('0x32'),_[_0x1da8('0x33')](_0x3e7c00))]=_0x5380c7['Contact'][_0x3e7c00];}}}}return _0x9f2255;};exports[_0x1da8('0x34')]=function(_0x3e622f){var _0x32b72={};for(var _0x21cc4b in _0x3e622f){if(_0x3e622f[_0x1da8('0x2e')](_0x21cc4b)){_0x32b72[util[_0x1da8('0x14')]('%s',_['toLower'](_0x21cc4b))]=_0x3e622f[_0x21cc4b];}}return{'variables':_0x32b72};};exports[_0x1da8('0x35')]=function(_0x3bffcc,_0x3999b8){if(!_['isNil'](_0x3bffcc)){if(_0x3bffcc[_0x1da8('0x2e')](_0x1da8('0x36'))){if(_0x3bffcc[_0x1da8('0x36')]>0x0){_0x3bffcc[_0x1da8('0x36')]-=0x1;}else{logger[_0x1da8('0xa')]('[updateOriginated]\x20object\x20originated\x20is\x20negative',_0x3999b8);}}}else{logger[_0x1da8('0xa')](_0x1da8('0x37'),_0x3999b8);}};exports[_0x1da8('0x38')]=function(_0x56df54){var _0x4f8291=moment()[_0x1da8('0x14')]('YYYY-MM-DD\x20HH:mm:ss');_0x56df54['state']=0xd;_0x56df54['statedesc']=_0x1da8('0x39');_0x56df54[_0x1da8('0x3a')]=_0x4f8291;_0x56df54[_0x1da8('0x3b')]=_0x4f8291;_0x56df54['endtime']=_0x4f8291;};exports[_0x1da8('0x3c')]=function(_0x49c760,_0x7606ff,_0xd804a5){var _0x4f53fb=moment()[_0x1da8('0x14')](_0x1da8('0x3d'));_0x49c760[_0x1da8('0x3e')]=_0x7606ff;_0x49c760[_0x1da8('0x3f')]=_0xd804a5;_0x49c760[_0x1da8('0x3b')]=_0x4f53fb;_0x49c760[_0x1da8('0x40')]=getSeconds(_0x49c760[_0x1da8('0x3b')],_0x49c760[_0x1da8('0x3a')]);};exports[_0x1da8('0x41')]=function(_0x52f2f4,_0x3df5cb,_0x2431fb){_0x52f2f4['membername']=_0x3df5cb;_0x52f2f4[_0x1da8('0x42')]=_0x2431fb;};exports[_0x1da8('0x43')]=function(_0x3794ff,_0x5be265,_0x453f38){var _0x2b960d=moment()[_0x1da8('0x14')](_0x1da8('0x3d'));_0x3794ff[_0x1da8('0x3e')]=_0x5be265;_0x3794ff['statedesc']=_0x453f38;_0x3794ff[_0x1da8('0x3b')]=_0x3794ff[_0x1da8('0x3b')]?_0x3794ff[_0x1da8('0x3b')]:_0x2b960d;_0x3794ff['endtime']=_0x3794ff[_0x1da8('0x44')]?_0x3794ff['endtime']:_0x2b960d;_0x3794ff[_0x1da8('0x40')]=getSeconds(_0x3794ff[_0x1da8('0x3b')]||0x0,_0x3794ff[_0x1da8('0x3a')]||0x0);_0x3794ff[_0x1da8('0x45')]=_0x3794ff[_0x1da8('0x46')]?getSeconds(_0x3794ff[_0x1da8('0x44')],_0x3794ff[_0x1da8('0x46')]):0x0;};exports[_0x1da8('0x47')]=function(_0x15b10c){return _0x15b10c===_0x1da8('0x48');};exports['variablesAction']=function(_0x438a32,_0x175143,_0x354c75,_0x24e596,_0x2fd920){var _0x47cb29=_0x24e596?_0x1da8('0x49'):_0x438a32[_0x1da8('0x1c')];_0x47cb29=_0x2fd920?_0x1da8('0x4a'):_0x47cb29;return{'actionid':_0x438a32[_0x1da8('0x4b')],'action':_0x1da8('0x4c'),'channel':_0x438a32[_0x1da8('0x4d')],'callerid':util[_0x1da8('0x14')](_0x1da8('0x15'),_0x47cb29,_0x438a32[_0x1da8('0x1d')]),'Exten':_0x1da8('0x2a'),'Context':_0x1da8('0x4e'),'Priority':'1','variable':_0x354c75,'timeout':(_0x175143[_0x1da8('0x4f')]||0x1e)*0x3e8,'async':!![],'channelid':_0x438a32[_0x1da8('0x4b')]};};exports[_0x1da8('0x50')]=function(_0x4e515f){return _0x4e515f['countbusyretry']+_0x4e515f[_0x1da8('0x51')]+_0x4e515f[_0x1da8('0x52')]+_0x4e515f[_0x1da8('0x53')]+_0x4e515f[_0x1da8('0x54')];};exports[_0x1da8('0x55')]=function(_0x1ed191){var _0x502c19=_[_0x1da8('0x56')](_0x1ed191);_0x502c19['state']=0xf;_0x502c19[_0x1da8('0x3f')]=_0x1da8('0x57');return _0x502c19;};exports[_0x1da8('0x58')]=function(_0x5d16cb,_0x319531,_0x3f5dac){var _0x26df80={};_0x26df80[_0x319531]=_0x5d16cb[_0x319531];_0x26df80[_0x1da8('0x59')]=![];_0x26df80[_0x1da8('0x5a')]=moment()[_0x1da8('0x5b')](_0x3f5dac,'minutes')[_0x1da8('0x14')]('YYYY-MM-DD\x20HH:mm:ss');_0x26df80[_0x1da8('0x1e')]=_0x5d16cb['ContactId'];_0x26df80[_0x1da8('0x5c')]=_0x5d16cb['ListId'];_0x26df80[_0x1da8('0x20')]=_0x5d16cb[_0x1da8('0x20')]||undefined;return _0x26df80;};exports[_0x1da8('0x5d')]=function(_0x502192,_0x5454e9){if(!_[_0x1da8('0x18')](_0x502192)){if(_0x502192[_0x1da8('0x5e')]>0x0){_0x502192['pTalking']-=0x1;}else{logger['error'](_0x5454e9,_0x1da8('0x5f'));}}else{logger[_0x1da8('0xa')](_0x5454e9,_0x1da8('0x60'));}};exports[_0x1da8('0x61')]=function(_0xa5dab6){if(_0xa5dab6<=0x0){return!![];}return![];};exports[_0x1da8('0x62')]=function(_0x1d3cbe,_0x602bcd){_0x1d3cbe['lastevent']=_0x602bcd;_0x1d3cbe[_0x1da8('0x1b')]=_0x1d3cbe[_0x1da8('0x63')];_0x1d3cbe[_0x1da8('0x64')]=_0x1d3cbe['channelAgent'];return _0x1d3cbe;};exports[_0x1da8('0x65')]=function(_0x3ce2a6){var _0x2f3d17={};_0x2f3d17['queue']=_0x3ce2a6[_0x1da8('0x63')];_0x2f3d17['interface']=_0x3ce2a6['channelAgent'];_0x2f3d17[_0x1da8('0x4b')]=_0x3ce2a6['uniqueid'];return _0x2f3d17;};exports['agentReadyId']=function(_0x116214){var _0x303efc=[];for(var _0xec831f in _0x116214){if(_0x116214['hasOwnProperty'](_0xec831f)){if(!_['isNil'](_0x116214[_0xec831f])&&_0x116214[_0xec831f]['state']===_0x1da8('0x66')&&_0x116214[_0xec831f][_0x1da8('0x67')]==='reachable'){_0x303efc['push'](_0x116214[_0xec831f]['id']);}}}return _0x303efc;};exports[_0x1da8('0x68')]=function(_0x25a24f){var _0x5d6626=moment()[_0x1da8('0x69')](0x0);var _0x1965cf=moment(_0x25a24f)[_0x1da8('0x69')](0x0);return _0x5d6626[_0x1da8('0x7')](_0x1965cf,'seconds');};exports[_0x1da8('0x6a')]=function(_0x489c4a){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x489c4a[_0x1da8('0x1e')],'ListId':_0x489c4a[_0x1da8('0x5c')],'VoiceQueueId':_0x489c4a['VoiceQueueId']||undefined,'CampaignId':_0x489c4a[_0x1da8('0x6b')]||undefined};};exports[_0x1da8('0x6c')]=function(_0x4b63fb){if(_0x4b63fb===_0x1da8('0x4b')||_0x4b63fb===_0x1da8('0x6d')||_0x4b63fb==='queue'||_0x4b63fb===_0x1da8('0x6e')||_0x4b63fb===_0x1da8('0x6f')||_0x4b63fb===_0x1da8('0x70')||_0x4b63fb===_0x1da8('0x71')||_0x4b63fb===_0x1da8('0x4d')||_0x4b63fb==='calleridname'||_0x4b63fb===_0x1da8('0x59')||_0x4b63fb===_0x1da8('0x1d')||_0x4b63fb===_0x1da8('0x5a')||_0x4b63fb===_0x1da8('0x72')||_0x4b63fb===_0x1da8('0x51')||_0x4b63fb===_0x1da8('0x52')||_0x4b63fb==='countglobal'||_0x4b63fb===_0x1da8('0x73')||_0x4b63fb===_0x1da8('0x74')||_0x4b63fb==='callbackat'||_0x4b63fb===_0x1da8('0x75')||_0x4b63fb===_0x1da8('0x1e')||_0x4b63fb===_0x1da8('0x5c')||_0x4b63fb==='UserId'||_0x4b63fb===_0x1da8('0x20')||_0x4b63fb==='sipcallid'||_0x4b63fb===_0x1da8('0x76')||_0x4b63fb===_0x1da8('0x77')||_0x4b63fb===_0x1da8('0x78')||_0x4b63fb===_0x1da8('0x79')||_0x4b63fb===_0x1da8('0x7a')||_0x4b63fb===_0x1da8('0x7b')||_0x4b63fb===_0x1da8('0x7c')||_0x4b63fb===_0x1da8('0x7d')||_0x4b63fb===_0x1da8('0x7e')||_0x4b63fb==='xmd-contactid'||_0x4b63fb===_0x1da8('0x7f')||_0x4b63fb===_0x1da8('0x80')||_0x4b63fb===_0x1da8('0x81')||_0x4b63fb===_0x1da8('0x82')||_0x4b63fb===_0x1da8('0x83')||_0x4b63fb==='rtpaudioqosbridged'||_0x4b63fb==='rtpaudioqosjitter'||_0x4b63fb==='rtpaudioqosjitterbridged'||_0x4b63fb===_0x1da8('0x84')||_0x4b63fb===_0x1da8('0x85')||_0x4b63fb===_0x1da8('0x86')||_0x4b63fb==='rtpaudioqosrttbridged'||_0x4b63fb===_0x1da8('0x83')||_0x4b63fb===_0x1da8('0x87')||_0x4b63fb==='rtpaudioqosjitter'||_0x4b63fb===_0x1da8('0x88')||_0x4b63fb===_0x1da8('0x84')||_0x4b63fb===_0x1da8('0x85')||_0x4b63fb===_0x1da8('0x86')||_0x4b63fb==='rtpaudioqosrttbridged'||_0x4b63fb===_0x1da8('0x89')||_0x4b63fb===_0x1da8('0x8a')||_0x4b63fb==='state'||_0x4b63fb===_0x1da8('0x3f')){return![];}return!![];};exports[_0x1da8('0x8b')]=function(_0x259721,_0x245fb1){var _0x326919,_0x5d03c8,_0x3ebd2f;if(_0x245fb1<=0x0){_0x245fb1=0x1;}_0x326919=new RegExp(_0x1da8('0x8c')+_0x245fb1+'}$');_0x5d03c8=Math[_0x1da8('0x8d')](0xa,_0x245fb1-0x1);_0x3ebd2f=Math[_0x1da8('0x8d')](0xa,_0x245fb1)-0x1;return util[_0x1da8('0x14')]('%s',_[_0x1da8('0x8e')](_0x259721,_0x326919,_[_0x1da8('0x8f')](_0x5d03c8,_0x3ebd2f)));};exports['extractCalleridName']=function(_0x1d35df){var _0x6b254a=_0x1d35df[_0x1da8('0x90')](/"(.*?)"/);return _0x6b254a?_0x6b254a[0x1]:_0x1d35df;};exports[_0x1da8('0x91')]=function(_0x22e212){var _0x4fed98=_0x22e212[_0x1da8('0x90')](/<(.*?)>/);return _0x4fed98?_0x4fed98[0x1]:_0x22e212;}; \ No newline at end of file +var _0xd290=['YYYY-MM-DD\x20HH:mm:ss','state','Blacklist','starttime','responsetime','logAgent','statedesc','ringtime','membername','UserId','endtime','talktime','answertime','isFailure','Failure','RECALL','BOOKED','uniqueid','channelAgent','from-sip','timeout','totalGlobal','countbusyretry','countnoanswerretry','cloneAction','Global','scheduledAt','scheduledat','add','minutes','ContactId','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','queue','buildAcw','interface','agentReadyId','not_inuse','reachable','push','CampaignId','type','campaigntype','active','countcongestionretry','countglobal','callback','callbackuniqueid','callbackat','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqosjitterbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','random','extractCalleridName','match','extractCalleridNumber','util','lodash','../../../../config/logger','XCALLY_IP_AGI','127.0.0.1','milliseconds','diff','seconds','loggerCatch','error','inspect','loggerError','logger2','info','message','getCallerId','isUndefined','isEmpty','string','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','name','calleridname','calleridnum','dialer','VoiceQueueId','dialOriginateTimeout','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','NONE','originatecalleridname','_XCALLY_MIXMONITOR_FORMAT','Contact','hasOwnProperty','tags','createdAt','updatedAt','%s%s','XMD-','toUpper','toLowerVariables','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined'];(function(_0x5c98ea,_0xa782aa){var _0x51e853=function(_0x57d5b0){while(--_0x57d5b0){_0x5c98ea['push'](_0x5c98ea['shift']());}};_0x51e853(++_0xa782aa);}(_0xd290,0x165));var _0x0d29=function(_0x54c2dd,_0x90197e){_0x54c2dd=_0x54c2dd-0x0;var _0x195ef9=_0xd290[_0x54c2dd];return _0x195ef9;};'use strict';var util=require(_0x0d29('0x0'));var _=require(_0x0d29('0x1'));var moment=require('moment');var logger=require(_0x0d29('0x2'))('preview');var ipAgi=process['env'][_0x0d29('0x3')]||_0x0d29('0x4');function getSeconds(_0x443b00,_0x40f32a){var _0x14abcf=moment(_0x443b00)['milliseconds'](0x0);var _0x1d806d=moment(_0x40f32a)[_0x0d29('0x5')](0x0);return _0x14abcf[_0x0d29('0x6')](_0x1d806d,_0x0d29('0x7'));}exports[_0x0d29('0x8')]=function(_0x4edfcd){return function(_0x3ee63c){logger[_0x0d29('0x9')](_0x4edfcd,util[_0x0d29('0xa')](_0x3ee63c,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x2e3dd7,_0x2da8de){logger['info'](_0x2e3dd7,util[_0x0d29('0xa')](_0x2da8de,{'showHidden':![],'depth':null}));};exports[_0x0d29('0xb')]=function(_0x4a35ed,_0xc5fe66){logger['error'](_0x4a35ed,util[_0x0d29('0xa')](_0xc5fe66,{'showHidden':![],'depth':null}));};exports[_0x0d29('0xc')]=function(_0x259768){return function(_0x87cf36){logger[_0x0d29('0xd')](_0x259768,util['inspect'](_0x87cf36,{'showHidden':![],'depth':null}));};};exports[_0x0d29('0xe')]=function(_0x399d1a,_0x26d2b6,_0x94b2f5){return{'message':_0x399d1a,'unlock':_0x26d2b6,'active':_0x94b2f5};};exports[_0x0d29('0xf')]=function(_0x5f474a,_0x5f2076,_0x49f132){if(!_[_0x0d29('0x10')](_0x49f132)&&'string'===typeof _0x49f132&&!_[_0x0d29('0x11')](_0x49f132)){if(!_['isUndefined'](_0x5f2076)&&_0x0d29('0x12')===typeof _0x5f2076&&!_[_0x0d29('0x11')](_0x5f2076)){return util[_0x0d29('0x13')](_0x0d29('0x14'),_0x5f2076,_0x49f132);}return util[_0x0d29('0x13')](_0x0d29('0x14'),_0x49f132,_0x49f132);}if(!_['isUndefined'](_0x5f474a)&&_0x0d29('0x12')===typeof _0x5f474a&&!_[_0x0d29('0x11')](_0x5f474a)){return _0x5f474a;}return _0x0d29('0x15');};exports[_0x0d29('0x16')]=function(_0xd3ccf3){if(_[_0x0d29('0x17')](_0xd3ccf3)){return![];}return _0xd3ccf3;};exports[_0x0d29('0x18')]=function(_0x5c6607,_0x39722d,_0x11d2ec,_0x215cd7,_0x138465,_0x1538c8){var _0x20b278={'XMD-QUEUE':_0x39722d[_0x0d29('0x19')]?_0x39722d[_0x0d29('0x19')][_0x0d29('0x1a')]:'','XMD-CALLERID':_0x215cd7,'XMD-CALLERID-PREVIEW':_0x1538c8?util[_0x0d29('0x13')](_0x0d29('0x14'),_0x1538c8[_0x0d29('0x1b')],_0x1538c8[_0x0d29('0x1c')]):_0x215cd7,'XMD-DIALID':_0x138465,'XMD-CONTACTID':_0x39722d['ContactId'],'XMD-CDRTYPE':_0x0d29('0x1d'),'CALLERID(all)':_0x215cd7,'XMD-VOICEQUEUEID':_0x39722d[_0x0d29('0x1e')],'XMD-DIALCHANNEL':_0x11d2ec,'XMD-DIALTIMEOUT':_0x5c6607[_0x0d29('0x1f')]||0x1e,'XMD-DIALOPTIONS':util[_0x0d29('0x13')]('\x22rtTxX%s%s\x22',_0x5c6607[_0x0d29('0x20')]?'g':'',_[_0x0d29('0x11')](_0x5c6607[_0x0d29('0x21')])?'':_0x0d29('0x22')),'XMD-DIALURL':_0x5c6607[_0x0d29('0x23')]||'','XMD-AGI':_0x5c6607[_0x0d29('0x24')]?util[_0x0d29('0x13')]('\x22agi://%s/square,%s\x22',ipAgi,_0x5c6607['dialQueueProject']):_0x0d29('0x25'),'XMD-AGIAFTER':_0x5c6607['dialQueueProject2']?util[_0x0d29('0x13')]('\x22agi://%s/square,%s\x22',ipAgi,_0x5c6607['dialQueueProject2']):_0x0d29('0x25'),'XMD-ORIGINATECALLERIDNUM':_0x1538c8?_0x1538c8['originatecalleridnum']:'','XMD-ORIGINATECALLERIDNAME':_0x1538c8?_0x1538c8[_0x0d29('0x26')]:'','XMD-DESTINATION':'xcally-motion-preview'};if(!_[_0x0d29('0x11')](_0x5c6607[_0x0d29('0x21')])){_0x20b278[util['format']('%s',_0x0d29('0x27'))]=_0x5c6607[_0x0d29('0x21')];_0x20b278[util[_0x0d29('0x13')]('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x138465;}if(_0x39722d&&_0x39722d[_0x0d29('0x28')]){for(var _0x3a22a1 in _0x39722d[_0x0d29('0x28')]){if(_0x39722d[_0x0d29('0x28')][_0x0d29('0x29')](_0x3a22a1)){if(!_[_0x0d29('0x17')](_0x39722d[_0x0d29('0x28')][_0x3a22a1])&&_0x3a22a1!=='id'&&_0x3a22a1!==_0x0d29('0x2a')&&_0x3a22a1!==_0x0d29('0x2b')&&_0x3a22a1!==_0x0d29('0x2c')){_0x20b278[util['format'](_0x0d29('0x2d'),_0x0d29('0x2e'),_[_0x0d29('0x2f')](_0x3a22a1))]=_0x39722d[_0x0d29('0x28')][_0x3a22a1];}}}}return _0x20b278;};exports[_0x0d29('0x30')]=function(_0x1ea27d){var _0x5855a2={};for(var _0xcb125 in _0x1ea27d){if(_0x1ea27d[_0x0d29('0x29')](_0xcb125)){_0x5855a2[util[_0x0d29('0x13')]('%s',_[_0x0d29('0x31')](_0xcb125))]=_0x1ea27d[_0xcb125];}}return{'variables':_0x5855a2};};exports[_0x0d29('0x32')]=function(_0x454e9a,_0xc4532b){if(!_['isNil'](_0x454e9a)){if(_0x454e9a[_0x0d29('0x29')](_0x0d29('0x33'))){if(_0x454e9a[_0x0d29('0x33')]>0x0){_0x454e9a[_0x0d29('0x33')]-=0x1;}else{logger[_0x0d29('0x9')](_0x0d29('0x34'),_0xc4532b);}}}else{logger['error'](_0x0d29('0x35'),_0xc4532b);}};exports['logBlacklist']=function(_0x2e9dd1){var _0x9d4cee=moment()[_0x0d29('0x13')](_0x0d29('0x36'));_0x2e9dd1[_0x0d29('0x37')]=0xd;_0x2e9dd1['statedesc']=_0x0d29('0x38');_0x2e9dd1[_0x0d29('0x39')]=_0x9d4cee;_0x2e9dd1[_0x0d29('0x3a')]=_0x9d4cee;_0x2e9dd1['endtime']=_0x9d4cee;};exports[_0x0d29('0x3b')]=function(_0x109372,_0x5c47db,_0x490eda){var _0x543867=moment()[_0x0d29('0x13')](_0x0d29('0x36'));_0x109372[_0x0d29('0x37')]=_0x5c47db;_0x109372[_0x0d29('0x3c')]=_0x490eda;_0x109372['responsetime']=_0x543867;_0x109372[_0x0d29('0x3d')]=getSeconds(_0x109372[_0x0d29('0x3a')],_0x109372[_0x0d29('0x39')]);};exports['logLookAgent']=function(_0x4d3b73,_0x4fe57e,_0x5a1a25){_0x4d3b73[_0x0d29('0x3e')]=_0x4fe57e;_0x4d3b73[_0x0d29('0x3f')]=_0x5a1a25;};exports['logCustomer']=function(_0xf190ce,_0x3c46e9,_0x341b8d){var _0x207324=moment()[_0x0d29('0x13')](_0x0d29('0x36'));_0xf190ce[_0x0d29('0x37')]=_0x3c46e9;_0xf190ce[_0x0d29('0x3c')]=_0x341b8d;_0xf190ce[_0x0d29('0x3a')]=_0xf190ce['responsetime']?_0xf190ce[_0x0d29('0x3a')]:_0x207324;_0xf190ce['endtime']=_0xf190ce[_0x0d29('0x40')]?_0xf190ce[_0x0d29('0x40')]:_0x207324;_0xf190ce[_0x0d29('0x3d')]=getSeconds(_0xf190ce[_0x0d29('0x3a')]||0x0,_0xf190ce[_0x0d29('0x39')]||0x0);_0xf190ce[_0x0d29('0x41')]=_0xf190ce[_0x0d29('0x42')]?getSeconds(_0xf190ce[_0x0d29('0x40')],_0xf190ce[_0x0d29('0x42')]):0x0;};exports[_0x0d29('0x43')]=function(_0x4b522b){return _0x4b522b===_0x0d29('0x44');};exports['variablesAction']=function(_0x5ddac8,_0x1eb823,_0x4f45b1,_0x361e15,_0x4463f5){var _0x36c4c8=_0x361e15?_0x0d29('0x45'):_0x5ddac8[_0x0d29('0x1b')];_0x36c4c8=_0x4463f5?_0x0d29('0x46'):_0x36c4c8;return{'actionid':_0x5ddac8[_0x0d29('0x47')],'action':'originate','channel':_0x5ddac8[_0x0d29('0x48')],'callerid':util['format'](_0x0d29('0x14'),_0x36c4c8,_0x5ddac8['calleridnum']),'Exten':'xcally-motion-preview','Context':_0x0d29('0x49'),'Priority':'1','variable':_0x4f45b1,'timeout':(_0x1eb823[_0x0d29('0x4a')]||0x1e)*0x3e8,'async':!![],'channelid':_0x5ddac8[_0x0d29('0x47')]};};exports[_0x0d29('0x4b')]=function(_0x2c9513){return _0x2c9513[_0x0d29('0x4c')]+_0x2c9513['countcongestionretry']+_0x2c9513[_0x0d29('0x4d')]+_0x2c9513['countagentrejectretry']+_0x2c9513['countnosuchnumberretry'];};exports[_0x0d29('0x4e')]=function(_0x324ee8){var _0x5bcaec=_['clone'](_0x324ee8);_0x5bcaec['state']=0xf;_0x5bcaec[_0x0d29('0x3c')]=_0x0d29('0x4f');return _0x5bcaec;};exports[_0x0d29('0x50')]=function(_0x241ea1,_0x5ea255,_0xa9658d){var _0x2a6779={};_0x2a6779[_0x5ea255]=_0x241ea1[_0x5ea255];_0x2a6779['active']=![];_0x2a6779[_0x0d29('0x51')]=moment()[_0x0d29('0x52')](_0xa9658d,_0x0d29('0x53'))[_0x0d29('0x13')]('YYYY-MM-DD\x20HH:mm:ss');_0x2a6779[_0x0d29('0x54')]=_0x241ea1['ContactId'];_0x2a6779[_0x0d29('0x55')]=_0x241ea1[_0x0d29('0x55')];_0x2a6779[_0x0d29('0x1e')]=_0x241ea1[_0x0d29('0x1e')]||undefined;return _0x2a6779;};exports[_0x0d29('0x56')]=function(_0x1ff630,_0x178cd0){if(!_[_0x0d29('0x17')](_0x1ff630)){if(_0x1ff630[_0x0d29('0x57')]>0x0){_0x1ff630[_0x0d29('0x57')]-=0x1;}else{logger['error'](_0x178cd0,_0x0d29('0x58'));}}else{logger[_0x0d29('0x9')](_0x178cd0,_0x0d29('0x59'));}};exports[_0x0d29('0x5a')]=function(_0x547e87){if(_0x547e87<=0x0){return!![];}return![];};exports['buildObj']=function(_0x1220cf,_0x4d5dac){_0x1220cf['lastevent']=_0x4d5dac;_0x1220cf[_0x0d29('0x1a')]=_0x1220cf[_0x0d29('0x5b')];_0x1220cf['interface']=_0x1220cf[_0x0d29('0x48')];return _0x1220cf;};exports[_0x0d29('0x5c')]=function(_0x5f4397){var _0x3da76a={};_0x3da76a['queue']=_0x5f4397[_0x0d29('0x5b')];_0x3da76a[_0x0d29('0x5d')]=_0x5f4397['channelAgent'];_0x3da76a[_0x0d29('0x47')]=_0x5f4397[_0x0d29('0x47')];return _0x3da76a;};exports[_0x0d29('0x5e')]=function(_0x5afe4f){var _0x3b0cb6=[];for(var _0x5cb03f in _0x5afe4f){if(_0x5afe4f['hasOwnProperty'](_0x5cb03f)){if(!_[_0x0d29('0x17')](_0x5afe4f[_0x5cb03f])&&_0x5afe4f[_0x5cb03f][_0x0d29('0x37')]===_0x0d29('0x5f')&&_0x5afe4f[_0x5cb03f]['status']===_0x0d29('0x60')){_0x3b0cb6[_0x0d29('0x61')](_0x5afe4f[_0x5cb03f]['id']);}}}return _0x3b0cb6;};exports['getDiff']=function(_0x73f596){var _0x159350=moment()[_0x0d29('0x5')](0x0);var _0x4e4e2e=moment(_0x73f596)[_0x0d29('0x5')](0x0);return _0x159350[_0x0d29('0x6')](_0x4e4e2e,_0x0d29('0x7'));};exports['createBody']=function(_0x5f09d2){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x5f09d2[_0x0d29('0x54')],'ListId':_0x5f09d2[_0x0d29('0x55')],'VoiceQueueId':_0x5f09d2['VoiceQueueId']||undefined,'CampaignId':_0x5f09d2[_0x0d29('0x62')]||undefined};};exports['filterKey']=function(_0x2ec6a2){if(_0x2ec6a2===_0x0d29('0x47')||_0x2ec6a2==='idContact'||_0x2ec6a2===_0x0d29('0x5b')||_0x2ec6a2===_0x0d29('0x63')||_0x2ec6a2===_0x0d29('0x64')||_0x2ec6a2==='dialAnswer'||_0x2ec6a2===_0x0d29('0x3e')||_0x2ec6a2==='channelAgent'||_0x2ec6a2===_0x0d29('0x1b')||_0x2ec6a2===_0x0d29('0x65')||_0x2ec6a2===_0x0d29('0x1c')||_0x2ec6a2===_0x0d29('0x51')||_0x2ec6a2==='countbusyretry'||_0x2ec6a2===_0x0d29('0x66')||_0x2ec6a2==='countnoanswerretry'||_0x2ec6a2===_0x0d29('0x67')||_0x2ec6a2===_0x0d29('0x68')||_0x2ec6a2===_0x0d29('0x69')||_0x2ec6a2===_0x0d29('0x6a')||_0x2ec6a2==='recallme'||_0x2ec6a2==='ContactId'||_0x2ec6a2==='ListId'||_0x2ec6a2==='UserId'||_0x2ec6a2===_0x0d29('0x1e')||_0x2ec6a2===_0x0d29('0x6b')||_0x2ec6a2===_0x0d29('0x6c')||_0x2ec6a2===_0x0d29('0x6d')||_0x2ec6a2===_0x0d29('0x6e')||_0x2ec6a2===_0x0d29('0x6f')||_0x2ec6a2===_0x0d29('0x70')||_0x2ec6a2==='xmd-dialtimeout'||_0x2ec6a2===_0x0d29('0x71')||_0x2ec6a2===_0x0d29('0x72')||_0x2ec6a2===_0x0d29('0x73')||_0x2ec6a2==='xmd-contactid'||_0x2ec6a2===_0x0d29('0x74')||_0x2ec6a2===_0x0d29('0x75')||_0x2ec6a2===_0x0d29('0x76')||_0x2ec6a2===_0x0d29('0x77')||_0x2ec6a2===_0x0d29('0x78')||_0x2ec6a2===_0x0d29('0x79')||_0x2ec6a2===_0x0d29('0x7a')||_0x2ec6a2==='rtpaudioqosjitterbridged'||_0x2ec6a2===_0x0d29('0x7b')||_0x2ec6a2==='rtpaudioqoslossbridged'||_0x2ec6a2===_0x0d29('0x7c')||_0x2ec6a2===_0x0d29('0x7d')||_0x2ec6a2===_0x0d29('0x78')||_0x2ec6a2===_0x0d29('0x79')||_0x2ec6a2===_0x0d29('0x7a')||_0x2ec6a2===_0x0d29('0x7e')||_0x2ec6a2==='rtpaudioqosloss'||_0x2ec6a2==='rtpaudioqoslossbridged'||_0x2ec6a2===_0x0d29('0x7c')||_0x2ec6a2===_0x0d29('0x7d')||_0x2ec6a2===_0x0d29('0x7f')||_0x2ec6a2===_0x0d29('0x80')||_0x2ec6a2===_0x0d29('0x37')||_0x2ec6a2===_0x0d29('0x3c')){return![];}return!![];};exports[_0x0d29('0x81')]=function(_0x5f55ff,_0x594f46){var _0x48955d,_0x425f1a,_0x5ae905;if(_0x594f46<=0x0){_0x594f46=0x1;}_0x48955d=new RegExp(_0x0d29('0x82')+_0x594f46+'}$');_0x425f1a=Math[_0x0d29('0x83')](0xa,_0x594f46-0x1);_0x5ae905=Math[_0x0d29('0x83')](0xa,_0x594f46)-0x1;return util[_0x0d29('0x13')]('%s',_[_0x0d29('0x84')](_0x5f55ff,_0x48955d,_[_0x0d29('0x85')](_0x425f1a,_0x5ae905)));};exports[_0x0d29('0x86')]=function(_0x39af72){var _0xc9c784=_0x39af72[_0x0d29('0x87')](/"(.*?)"/);return _0xc9c784?_0xc9c784[0x1]:_0x39af72;};exports[_0x0d29('0x88')]=function(_0x1e343b){var _0xafabf5=_0x1e343b[_0x0d29('0x87')](/<(.*?)>/);return _0xafabf5?_0xafabf5[0x1]:_0x1e343b;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 60a8db0..08d80b1 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 _0x5f2f=['number','boolean','queueremove','reload','voicequeuechannel','voicechannel','voicequeuechannelhangup','queueadd','string'];(function(_0x503816,_0x1bf1ef){var _0x167117=function(_0x26ca67){while(--_0x26ca67){_0x503816['push'](_0x503816['shift']());}};_0x167117(++_0x1bf1ef);}(_0x5f2f,0x73));var _0xf5f2=function(_0x422559,_0x1e4f5c){_0x422559=_0x422559-0x0;var _0x55532c=_0x5f2f[_0x422559];return _0x55532c;};'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 +var _0xb10b=['voicequeuechannelhangup','queueadd','string','number','queueremove','queuepause','boolean','reload','voicechannel'];(function(_0x5e01b4,_0x1e9e18){var _0x50c7fc=function(_0x3fc987){while(--_0x3fc987){_0x5e01b4['push'](_0x5e01b4['shift']());}};_0x50c7fc(++_0x1e9e18);}(_0xb10b,0x12a));var _0xbb10=function(_0x4bbaba,_0x15097c){_0x4bbaba=_0x4bbaba-0x0;var _0x34ff2b=_0xb10b[_0x4bbaba];return _0x34ff2b;};'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 diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 705d7e3..e6c84d2 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 _0xa8b4=['../model/voiceExtension','../model/zendeskAccount','../model/freshdeskAccount','../model/deskAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','agents','telephones','trunks','voiceQueues','triggers','templates','queueChannels','timers','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','format','name','isNil','interface','total','answered','sumHoldTime','sumDuration','sumBillable','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','unmanaged','abandoned','outboundBusyCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','mergeFromDatabase','initAgents','length','isUndefined','initTelephones','SIP/%s','initTrunks','initVoiceQueues','initTemplates','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','initZohoAccounts','zohoAccounts','initDeskAccounts','initSugarcrmAccounts','initServicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','merge','initVoiceQueueReports','groupBy','uniqueid','queue','queuecallerabandon','queuecallerleaveAt','diff','seconds','queuecallercompleteAt','queuecallerexitAt','queuecallercomplete','initVoiceCallReports','outbound','duration','disposition','ANSWERED','billableseconds','initCampaigns','campaigns','dialQueueProject','SquareProject','initVoiceExtensions','voiceExtensions','initCampaignHopperHistory','exports','bluebird','util','lodash','moment','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/campaign'];(function(_0x272d85,_0xce812d){var _0x56cdf8=function(_0x5593f8){while(--_0x5593f8){_0x272d85['push'](_0x272d85['shift']());}};_0x56cdf8(++_0xce812d);}(_0xa8b4,0xcb));var _0x4a8b=function(_0x120b40,_0x4d7000){_0x120b40=_0x120b40-0x0;var _0x337847=_0xa8b4[_0x120b40];return _0x337847;};'use strict';var BPromise=require(_0x4a8b('0x0'));var util=require(_0x4a8b('0x1'));var _=require(_0x4a8b('0x2'));var moment=require(_0x4a8b('0x3'));var Agent=require('../model/agent');var Telephone=require(_0x4a8b('0x4'));var Trunk=require(_0x4a8b('0x5'));var VoiceQueue=require(_0x4a8b('0x6'));var Trigger=require(_0x4a8b('0x7'));var Template=require('../model/template');var Campaign=require(_0x4a8b('0x8'));var VoiceExtension=require(_0x4a8b('0x9'));var ZendeskAccount=require(_0x4a8b('0xa'));var SalesforceAccount=require('../model/salesforceAccount');var FreshdeskAccount=require(_0x4a8b('0xb'));var SugarcrmAccount=require('../model/sugarcrmAccount');var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require(_0x4a8b('0xc'));var VtigerAccount=require('../model/vtigerAccount');var ServicenowAccount=require(_0x4a8b('0xd'));var Dynamics365Account=require(_0x4a8b('0xe'));var FreshsalesAccount=require(_0x4a8b('0xf'));var FaxAccount=require('../model/faxAccount');var Realtime=function(){this[_0x4a8b('0x10')]={};this[_0x4a8b('0x11')]={};this[_0x4a8b('0x12')]={};this[_0x4a8b('0x13')]={};this[_0x4a8b('0x14')]={};this['campaigns']={};this[_0x4a8b('0x15')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this['channels']={};this[_0x4a8b('0x16')]={};this['outboundChannels']={};this[_0x4a8b('0x17')]={};this[_0x4a8b('0x18')]={};this[_0x4a8b('0x19')]={};this[_0x4a8b('0x1a')]={};this[_0x4a8b('0x1b')]={};this['zohoAccounts']={};this[_0x4a8b('0x1c')]={};this[_0x4a8b('0x1d')]={};this[_0x4a8b('0x1e')]={};this[_0x4a8b('0x1f')]={};this[_0x4a8b('0x20')]={};this[_0x4a8b('0x21')]={};};function freeIsNotKey(_0x21812f,_0x346212,_0x21db53){var _0x17c6ad=_[_0x4a8b('0x22')](_0x21812f,function(_0x3edb33,_0x39cc2a){return _0x3edb33[_0x21db53];});for(var _0xffa71f in _0x346212){if(_0x346212[_0x4a8b('0x23')](_0xffa71f)){if(!_0x17c6ad[_0xffa71f]){delete _0x346212[_0xffa71f];}}}}function freeIsNotKeySip(_0x522d0a,_0x44f2ef){var _0x93dce9=_[_0x4a8b('0x22')](_0x522d0a,function(_0x1f1855,_0x3dadba){return util[_0x4a8b('0x24')]('SIP/%s',_0x1f1855[_0x4a8b('0x25')]);});for(var _0x2c0632 in _0x44f2ef){if(_0x44f2ef[_0x4a8b('0x23')](_0x2c0632)){if(!_0x93dce9[_0x2c0632]){delete _0x44f2ef[_0x2c0632];}}}}function freeIsNotKeyAgent(_0x1fc08f,_0x16c2cb){var _0xc853aa=_['mapKeys'](_0x1fc08f,function(_0x554900,_0x1cfede){var _0x25fdca=_[_0x4a8b('0x26')](_0x554900['interface'])?util[_0x4a8b('0x24')]('SIP/%s',_0x554900[_0x4a8b('0x25')]):_0x554900[_0x4a8b('0x27')];return _0x25fdca;});for(var _0x471689 in _0x16c2cb){if(_0x16c2cb[_0x4a8b('0x23')](_0x471689)){if(!_0xc853aa[_0x471689]){delete _0x16c2cb[_0x471689];}}}}function clearVoiceCallReports(_0x255c0e){_0x255c0e[_0x4a8b('0x28')]=0x0;_0x255c0e[_0x4a8b('0x29')]=0x0;_0x255c0e[_0x4a8b('0x2a')]=0x0;_0x255c0e[_0x4a8b('0x2b')]=0x0;_0x255c0e[_0x4a8b('0x2c')]=0x0;}function clearCampaigns(_0x1e642f){if(!_[_0x4a8b('0x2d')](_0x1e642f)){for(var _0x41b988 in _0x1e642f){if(_0x1e642f['hasOwnProperty'](_0x41b988)){_0x1e642f[_0x41b988][_0x4a8b('0x2e')]=0x0;_0x1e642f[_0x41b988][_0x4a8b('0x2f')]=0x0;}}}}function clearVoiceQueues(_0x1c3afa){if(!_['isEmpty'](_0x1c3afa)){for(var _0x1e53c3 in _0x1c3afa){if(_0x1c3afa['hasOwnProperty'](_0x1e53c3)){_0x1c3afa[_0x1e53c3]['total']=0x0;_0x1c3afa[_0x1e53c3]['answered']=0x0;_0x1c3afa[_0x1e53c3][_0x4a8b('0x30')]=0x0;_0x1c3afa[_0x1e53c3][_0x4a8b('0x31')]=0x0;_0x1c3afa[_0x1e53c3][_0x4a8b('0x2a')]=0x0;_0x1c3afa[_0x1e53c3][_0x4a8b('0x2b')]=0x0;_0x1c3afa[_0x1e53c3][_0x4a8b('0x2c')]=0x0;_0x1c3afa[_0x1e53c3]['outboundAnswerAgiCallsDay']=0x0;_0x1c3afa[_0x1e53c3]['outboundNoAnswerCallsDay']=0x0;_0x1c3afa[_0x1e53c3][_0x4a8b('0x32')]=0x0;_0x1c3afa[_0x1e53c3]['outboundCongestionCallsDay']=0x0;_0x1c3afa[_0x1e53c3]['outboundNoSuchCallsDay']=0x0;_0x1c3afa[_0x1e53c3][_0x4a8b('0x33')]=0x0;_0x1c3afa[_0x1e53c3][_0x4a8b('0x34')]=0x0;_0x1c3afa[_0x1e53c3][_0x4a8b('0x35')]=0x0;_0x1c3afa[_0x1e53c3][_0x4a8b('0x36')]=0x0;_0x1c3afa[_0x1e53c3][_0x4a8b('0x37')]=0x0;_0x1c3afa[_0x1e53c3][_0x4a8b('0x38')]=0x0;_0x1c3afa[_0x1e53c3][_0x4a8b('0x39')]=0x0;_0x1c3afa[_0x1e53c3]['outboundAnswerAgiCallsDay']=0x0;_0x1c3afa[_0x1e53c3][_0x4a8b('0x3a')]=0x0;_0x1c3afa[_0x1e53c3][_0x4a8b('0x3b')]=!![];}}}}Realtime[_0x4a8b('0x3c')][_0x4a8b('0x3d')]=function(_0x4b25b6,_0x573973){for(var _0x236454 in _0x573973){if(_0x4b25b6[_0x4a8b('0x23')](_0x236454)){_0x4b25b6[_0x236454]=_0x573973[_0x236454];}}};Realtime['prototype'][_0x4a8b('0x3e')]=function(){var _0x18f5b3=this;return function(_0x1ddff5){if(_0x1ddff5){freeIsNotKeyAgent(_0x1ddff5,_0x18f5b3['agents']);for(var _0x25521a=0x0,_0x163e0b={},_0x4f26e0={};_0x25521a<_0x1ddff5[_0x4a8b('0x3f')];_0x25521a+=0x1){_0x163e0b=_0x1ddff5[_0x25521a];var _0x4120a2=_['isNil'](_0x163e0b['interface'])?util['format']('SIP/%s',_0x163e0b[_0x4a8b('0x25')]):_0x163e0b[_0x4a8b('0x27')];if(_[_0x4a8b('0x40')](_0x18f5b3['agents'][_0x4120a2])){_0x18f5b3[_0x4a8b('0x10')][_0x4120a2]=new Agent(_0x163e0b);}else{_0x18f5b3[_0x4a8b('0x3d')](_0x18f5b3['agents'][_0x4120a2],_0x163e0b);}}}return _0x18f5b3['agents'];};};Realtime[_0x4a8b('0x3c')][_0x4a8b('0x41')]=function(){var _0x19d8aa=this;return function(_0x357fa9){if(_0x357fa9){freeIsNotKeySip(_0x357fa9,_0x19d8aa[_0x4a8b('0x11')]);for(var _0x5dd0a3=0x0,_0x4e88df={},_0x56877b={};_0x5dd0a3<_0x357fa9[_0x4a8b('0x3f')];_0x5dd0a3+=0x1){_0x4e88df=_0x357fa9[_0x5dd0a3];if(_['isUndefined'](_0x19d8aa[_0x4a8b('0x11')][util[_0x4a8b('0x24')]('SIP/%s',_0x4e88df['name'])])){_0x19d8aa['telephones'][util[_0x4a8b('0x24')](_0x4a8b('0x42'),_0x4e88df[_0x4a8b('0x25')])]=new Telephone(_0x4e88df);}else{_0x19d8aa['mergeFromDatabase'](_0x19d8aa[_0x4a8b('0x11')][util[_0x4a8b('0x24')](_0x4a8b('0x42'),_0x4e88df[_0x4a8b('0x25')])],_0x4e88df);}}}return _0x19d8aa[_0x4a8b('0x11')];};};Realtime[_0x4a8b('0x3c')][_0x4a8b('0x43')]=function(){var _0x3a5ed5=this;return function(_0x2ad0a0){if(_0x2ad0a0){freeIsNotKeySip(_0x2ad0a0,_0x3a5ed5[_0x4a8b('0x12')]);for(var _0x283818=0x0,_0x2106ea={},_0x5ee007={};_0x283818<_0x2ad0a0[_0x4a8b('0x3f')];_0x283818+=0x1){_0x2106ea=_0x2ad0a0[_0x283818];if(_[_0x4a8b('0x40')](_0x3a5ed5[_0x4a8b('0x12')][util[_0x4a8b('0x24')]('SIP/%s',_0x2106ea[_0x4a8b('0x25')])])){_0x3a5ed5['trunks'][util[_0x4a8b('0x24')]('SIP/%s',_0x2106ea[_0x4a8b('0x25')])]=new Trunk(_0x2106ea);}else{_0x3a5ed5[_0x4a8b('0x3d')](_0x3a5ed5[_0x4a8b('0x12')][util['format'](_0x4a8b('0x42'),_0x2106ea[_0x4a8b('0x25')])],_0x2106ea);}}}return _0x3a5ed5[_0x4a8b('0x12')];};};Realtime[_0x4a8b('0x3c')][_0x4a8b('0x44')]=function(){var _0x3614e4=this;return function(_0x5dee02){if(_0x5dee02){freeIsNotKey(_0x5dee02,_0x3614e4[_0x4a8b('0x13')],_0x4a8b('0x25'));for(var _0xea10c7=0x0,_0x5cb80e={},_0x1a8547={};_0xea10c7<_0x5dee02[_0x4a8b('0x3f')];_0xea10c7+=0x1){_0x5cb80e=_0x5dee02[_0xea10c7];if(_['isUndefined'](_0x3614e4[_0x4a8b('0x13')][_0x5cb80e['name']])){_0x3614e4[_0x4a8b('0x13')][_0x5cb80e['name']]=new VoiceQueue(_0x5cb80e);}else{_0x3614e4[_0x4a8b('0x3d')](_0x3614e4[_0x4a8b('0x13')][_0x5cb80e[_0x4a8b('0x25')]],_0x5cb80e);}}}return _0x3614e4[_0x4a8b('0x13')];};};Realtime[_0x4a8b('0x3c')]['initTriggers']=function(){var _0x3bd264=this;return function(_0x63a480){if(_0x63a480){freeIsNotKey(_0x63a480,_0x3bd264['triggers'],'id');for(var _0x2fcc84=0x0,_0x3ee85f={},_0x5af20e={};_0x2fcc84<_0x63a480['length'];_0x2fcc84+=0x1){_0x3ee85f=_0x63a480[_0x2fcc84];if(_[_0x4a8b('0x40')](_0x3bd264[_0x4a8b('0x14')][_0x3ee85f['id']])){_0x3bd264['triggers'][_0x3ee85f['id']]=new Trigger(_0x3ee85f);}else{_0x3bd264[_0x4a8b('0x3d')](_0x3bd264[_0x4a8b('0x14')][_0x3ee85f['id']],_0x3ee85f);}}}return _0x3bd264[_0x4a8b('0x14')];};};Realtime[_0x4a8b('0x3c')][_0x4a8b('0x45')]=function(){var _0x443f4c=this;return function(_0x15dd14){if(_0x15dd14){freeIsNotKey(_0x15dd14,_0x443f4c[_0x4a8b('0x15')],'id');for(var _0x37ef88=0x0,_0x219df5={},_0x436ad0={};_0x37ef88<_0x15dd14[_0x4a8b('0x3f')];_0x37ef88+=0x1){_0x219df5=_0x15dd14[_0x37ef88];if(_[_0x4a8b('0x40')](_0x443f4c[_0x4a8b('0x15')][_0x219df5['id']])){_0x443f4c[_0x4a8b('0x15')][_0x219df5['id']]=new Template(_0x219df5);}else{_0x443f4c['mergeFromDatabase'](_0x443f4c[_0x4a8b('0x15')][_0x219df5['id']],_0x219df5);}}}return _0x443f4c[_0x4a8b('0x15')];};};Realtime[_0x4a8b('0x3c')][_0x4a8b('0x46')]=function(){var _0x326c8b=this;return function(_0x4f21a5){if(_0x4f21a5){freeIsNotKey(_0x4f21a5,_0x326c8b['zendeskAccounts'],'id');for(var _0x15b094=0x0,_0x4e779c={},_0x49b5b6={};_0x15b094<_0x4f21a5[_0x4a8b('0x3f')];_0x15b094+=0x1){_0x4e779c=_0x4f21a5[_0x15b094];if(_['isUndefined'](_0x326c8b[_0x4a8b('0x18')][_0x4e779c['id']])){_0x326c8b[_0x4a8b('0x18')][_0x4e779c['id']]=new ZendeskAccount(_0x4e779c);}else{_0x326c8b[_0x4a8b('0x3d')](_0x326c8b['zendeskAccounts'][_0x4e779c['id']],_0x4e779c);}}}return _0x326c8b['zendeskAccounts'];};};Realtime[_0x4a8b('0x3c')][_0x4a8b('0x47')]=function(){var _0x564b6e=this;return function(_0x576d77){if(_0x576d77){freeIsNotKey(_0x576d77,_0x564b6e[_0x4a8b('0x19')],'id');for(var _0x25de43=0x0,_0x2db359={},_0x4420ec={};_0x25de43<_0x576d77[_0x4a8b('0x3f')];_0x25de43+=0x1){_0x2db359=_0x576d77[_0x25de43];if(_[_0x4a8b('0x40')](_0x564b6e[_0x4a8b('0x19')][_0x2db359['id']])){_0x564b6e[_0x4a8b('0x19')][_0x2db359['id']]=new SalesforceAccount(_0x2db359);}else{_0x564b6e['mergeFromDatabase'](_0x564b6e[_0x4a8b('0x19')][_0x2db359['id']],_0x2db359);}}}return _0x564b6e[_0x4a8b('0x19')];};};Realtime['prototype'][_0x4a8b('0x48')]=function(){var _0x46ffb0=this;return function(_0x1f6f95){if(_0x1f6f95){freeIsNotKey(_0x1f6f95,_0x46ffb0[_0x4a8b('0x1b')],'id');for(var _0x27e434=0x0,_0x571e15={},_0x39b130={};_0x27e434<_0x1f6f95['length'];_0x27e434+=0x1){_0x571e15=_0x1f6f95[_0x27e434];if(_['isUndefined'](_0x46ffb0[_0x4a8b('0x1b')][_0x571e15['id']])){_0x46ffb0[_0x4a8b('0x1b')][_0x571e15['id']]=new FreshdeskAccount(_0x571e15);}else{_0x46ffb0['mergeFromDatabase'](_0x46ffb0[_0x4a8b('0x1b')][_0x571e15['id']],_0x571e15);}}}return _0x46ffb0['freshdeskAccounts'];};};Realtime[_0x4a8b('0x3c')][_0x4a8b('0x49')]=function(){var _0xc83b03=this;return function(_0x102f59){if(_0x102f59){freeIsNotKey(_0x102f59,_0xc83b03['zohoAccounts'],'id');for(var _0x556ade=0x0,_0x436e0e={},_0x478773={};_0x556ade<_0x102f59['length'];_0x556ade+=0x1){_0x436e0e=_0x102f59[_0x556ade];if(_['isUndefined'](_0xc83b03['zohoAccounts'][_0x436e0e['id']])){_0xc83b03[_0x4a8b('0x4a')][_0x436e0e['id']]=new ZohoAccount(_0x436e0e);}else{_0xc83b03[_0x4a8b('0x3d')](_0xc83b03[_0x4a8b('0x4a')][_0x436e0e['id']],_0x436e0e);}}}return _0xc83b03[_0x4a8b('0x4a')];};};Realtime['prototype'][_0x4a8b('0x4b')]=function(){var _0x37cf4c=this;return function(_0x4ca260){if(_0x4ca260){freeIsNotKey(_0x4ca260,_0x37cf4c[_0x4a8b('0x1c')],'id');for(var _0x4f5b50=0x0,_0x47885c={},_0x41a432={};_0x4f5b50<_0x4ca260[_0x4a8b('0x3f')];_0x4f5b50+=0x1){_0x47885c=_0x4ca260[_0x4f5b50];if(_[_0x4a8b('0x40')](_0x37cf4c[_0x4a8b('0x1c')][_0x47885c['id']])){_0x37cf4c['deskAccounts'][_0x47885c['id']]=new DeskAccount(_0x47885c);}else{_0x37cf4c['mergeFromDatabase'](_0x37cf4c[_0x4a8b('0x1c')][_0x47885c['id']],_0x47885c);}}}return _0x37cf4c['deskAccounts'];};};Realtime[_0x4a8b('0x3c')][_0x4a8b('0x4c')]=function(){var _0x2eab86=this;return function(_0x1e8ee2){if(_0x1e8ee2){freeIsNotKey(_0x1e8ee2,_0x2eab86[_0x4a8b('0x1a')],'id');for(var _0x2ac08e=0x0,_0x4d26a4={},_0x396373={};_0x2ac08e<_0x1e8ee2[_0x4a8b('0x3f')];_0x2ac08e+=0x1){_0x4d26a4=_0x1e8ee2[_0x2ac08e];if(_[_0x4a8b('0x40')](_0x2eab86[_0x4a8b('0x1a')][_0x4d26a4['id']])){_0x2eab86['sugarcrmAccounts'][_0x4d26a4['id']]=new SugarcrmAccount(_0x4d26a4);}else{_0x2eab86[_0x4a8b('0x3d')](_0x2eab86[_0x4a8b('0x1a')][_0x4d26a4['id']],_0x4d26a4);}}}return _0x2eab86[_0x4a8b('0x1a')];};};Realtime['prototype']['initVtigerAccounts']=function(){var _0x3b0236=this;return function(_0x35193e){if(_0x35193e){freeIsNotKey(_0x35193e,_0x3b0236[_0x4a8b('0x1d')],'id');for(var _0x23d88f=0x0,_0xc66256={},_0x16de19={};_0x23d88f<_0x35193e['length'];_0x23d88f+=0x1){_0xc66256=_0x35193e[_0x23d88f];if(_[_0x4a8b('0x40')](_0x3b0236[_0x4a8b('0x1d')][_0xc66256['id']])){_0x3b0236[_0x4a8b('0x1d')][_0xc66256['id']]=new VtigerAccount(_0xc66256);}else{_0x3b0236[_0x4a8b('0x3d')](_0x3b0236[_0x4a8b('0x1d')][_0xc66256['id']],_0xc66256);}}}return _0x3b0236[_0x4a8b('0x1d')];};};Realtime[_0x4a8b('0x3c')][_0x4a8b('0x4d')]=function(){var _0x536c3c=this;return function(_0x1c5cee){if(_0x1c5cee){freeIsNotKey(_0x1c5cee,_0x536c3c['servicenowAccounts'],'id');for(var _0x5883fb=0x0,_0x4c432f={},_0x1c7c7f={};_0x5883fb<_0x1c5cee[_0x4a8b('0x3f')];_0x5883fb+=0x1){_0x4c432f=_0x1c5cee[_0x5883fb];if(_['isUndefined'](_0x536c3c[_0x4a8b('0x1e')][_0x4c432f['id']])){_0x536c3c[_0x4a8b('0x1e')][_0x4c432f['id']]=new ServicenowAccount(_0x4c432f);}else{_0x536c3c[_0x4a8b('0x3d')](_0x536c3c[_0x4a8b('0x1e')][_0x4c432f['id']],_0x4c432f);}}}return _0x536c3c[_0x4a8b('0x1e')];};};Realtime[_0x4a8b('0x3c')][_0x4a8b('0x4e')]=function(){var _0x36203d=this;return function(_0x2585d6){if(_0x2585d6){freeIsNotKey(_0x2585d6,_0x36203d['dynamics365Accounts'],'id');for(var _0x21dab5=0x0,_0x962ac7={},_0x2a9072={};_0x21dab5<_0x2585d6[_0x4a8b('0x3f')];_0x21dab5+=0x1){_0x962ac7=_0x2585d6[_0x21dab5];if(_['isUndefined'](_0x36203d[_0x4a8b('0x1f')][_0x962ac7['id']])){_0x36203d[_0x4a8b('0x1f')][_0x962ac7['id']]=new Dynamics365Account(_0x962ac7);}else{_0x36203d[_0x4a8b('0x3d')](_0x36203d['dynamics365Accounts'][_0x962ac7['id']],_0x962ac7);}}}return _0x36203d[_0x4a8b('0x1f')];};};Realtime[_0x4a8b('0x3c')][_0x4a8b('0x4f')]=function(){var _0x2ee1d7=this;return function(_0x7cc89d){if(_0x7cc89d){freeIsNotKey(_0x7cc89d,_0x2ee1d7[_0x4a8b('0x20')],'id');for(var _0x564b0d=0x0,_0x1e33f7={},_0x5cd4e9={};_0x564b0d<_0x7cc89d[_0x4a8b('0x3f')];_0x564b0d+=0x1){_0x1e33f7=_0x7cc89d[_0x564b0d];if(_[_0x4a8b('0x40')](_0x2ee1d7['freshsalesAccounts'][_0x1e33f7['id']])){_0x2ee1d7[_0x4a8b('0x20')][_0x1e33f7['id']]=new FreshsalesAccount(_0x1e33f7);}else{_0x2ee1d7[_0x4a8b('0x3d')](_0x2ee1d7[_0x4a8b('0x20')][_0x1e33f7['id']],_0x1e33f7);}}}return _0x2ee1d7['freshsalesAccounts'];};};Realtime[_0x4a8b('0x3c')]['initVoiceQueueHopperHistory']=function(){var _0x17efa8=this;return function(_0x4706a8){for(var _0x3693e8=0x0;_0x3693e8<_0x4706a8[_0x4a8b('0x3f')];_0x3693e8+=0x1){_[_0x4a8b('0x50')](_0x17efa8[_0x4a8b('0x13')][_0x4706a8[_0x3693e8]['name']],_0x4706a8[_0x3693e8]);}return _0x17efa8[_0x4a8b('0x13')];};};Realtime[_0x4a8b('0x3c')][_0x4a8b('0x51')]=function(){var _0x41fdeb=this;return function(_0x367d36){clearVoiceQueues(_0x41fdeb['voiceQueues']);if(_0x367d36){_0x367d36=_[_0x4a8b('0x52')](_0x367d36,_0x4a8b('0x53'));for(var _0x28a925 in _0x367d36){if(_0x367d36[_0x4a8b('0x23')](_0x28a925)){var _0x1280ad={};for(var _0x1571e1=0x0;_0x1571e1<_0x367d36[_0x28a925][_0x4a8b('0x3f')];_0x1571e1+=0x1){var _0x49b004=_0x367d36[_0x28a925][_0x1571e1][_0x4a8b('0x54')];if(_0x41fdeb[_0x4a8b('0x13')][_0x49b004]){if(_0x367d36[_0x28a925][_0x1571e1]['queuecallerexit']){_0x41fdeb[_0x4a8b('0x13')][_0x49b004][_0x4a8b('0x30')]+=0x1;}if(_0x367d36[_0x28a925][_0x1571e1][_0x4a8b('0x55')]){_0x41fdeb[_0x4a8b('0x13')][_0x49b004][_0x4a8b('0x31')]+=0x1;}_0x41fdeb[_0x4a8b('0x13')][_0x49b004][_0x4a8b('0x2a')]+=moment(_0x367d36[_0x28a925][_0x1571e1][_0x4a8b('0x56')])[_0x4a8b('0x57')](moment(_0x367d36[_0x28a925][_0x1571e1]['queuecallerjoinAt']),_0x4a8b('0x58'))||0x0;if(_0x1571e1===_0x367d36[_0x28a925]['length']-0x1){_0x41fdeb[_0x4a8b('0x13')][_0x49b004][_0x4a8b('0x2b')]+=moment(_0x367d36[_0x28a925][_0x1571e1][_0x4a8b('0x59')]||_0x367d36[_0x28a925][_0x1571e1]['queuecallerabandonAt']||_0x367d36[_0x28a925][_0x1571e1][_0x4a8b('0x5a')])[_0x4a8b('0x57')](moment(_0x367d36[_0x28a925][_0x1571e1]['queuecallerjoinAt']),_0x4a8b('0x58'))||0x0;_0x41fdeb[_0x4a8b('0x13')][_0x49b004][_0x4a8b('0x28')]+=0x1;if(_0x367d36[_0x28a925][_0x1571e1][_0x4a8b('0x5b')]){_0x41fdeb['voiceQueues'][_0x49b004][_0x4a8b('0x29')]+=0x1;_0x41fdeb[_0x4a8b('0x13')][_0x49b004][_0x4a8b('0x2c')]+=moment(_0x367d36[_0x28a925][_0x1571e1][_0x4a8b('0x59')])[_0x4a8b('0x57')](moment(_0x367d36[_0x28a925][_0x1571e1][_0x4a8b('0x56')]),_0x4a8b('0x58'))||0x0;}}else{_0x41fdeb['voiceQueues'][_0x49b004][_0x4a8b('0x2b')]+=_0x41fdeb[_0x4a8b('0x13')][_0x49b004][_0x4a8b('0x2a')]||0x0;}}}}}}return _0x41fdeb[_0x4a8b('0x13')];};};Realtime[_0x4a8b('0x3c')][_0x4a8b('0x5c')]=function(){var _0x14277c=this;return function(_0x1aed00){clearVoiceCallReports(_0x14277c[_0x4a8b('0x5d')]);if(_0x1aed00){for(var _0x3391dc=0x0;_0x3391dc<_0x1aed00[_0x4a8b('0x3f')];_0x3391dc+=0x1){_0x14277c[_0x4a8b('0x5d')][_0x4a8b('0x28')]+=0x1;_0x14277c[_0x4a8b('0x5d')][_0x4a8b('0x2b')]+=_0x1aed00[_0x3391dc][_0x4a8b('0x5e')];if(_0x1aed00[_0x3391dc][_0x4a8b('0x5f')]===_0x4a8b('0x60')){_0x14277c[_0x4a8b('0x5d')]['answered']+=0x1;_0x14277c[_0x4a8b('0x5d')][_0x4a8b('0x2a')]+=_0x1aed00[_0x3391dc]['duration']-_0x1aed00[_0x3391dc][_0x4a8b('0x61')]||0x0;_0x14277c[_0x4a8b('0x5d')][_0x4a8b('0x2c')]+=_0x1aed00[_0x3391dc][_0x4a8b('0x61')];}}}return _0x14277c[_0x4a8b('0x5d')];};};Realtime[_0x4a8b('0x3c')][_0x4a8b('0x62')]=function(){var _0x5dae9f=this;return function(_0x191299){if(_0x191299){freeIsNotKey(_0x191299,_0x5dae9f[_0x4a8b('0x63')],_0x4a8b('0x25'));for(var _0xcf931b=0x0,_0x2754fa={};_0xcf931b<_0x191299[_0x4a8b('0x3f')];_0xcf931b+=0x1){_0x2754fa=_0x191299[_0xcf931b];if(_[_0x4a8b('0x40')](_0x5dae9f[_0x4a8b('0x63')][_0x2754fa['name']])){_0x5dae9f[_0x4a8b('0x63')][_0x2754fa[_0x4a8b('0x25')]]=new Campaign(_0x2754fa);}else{_0x5dae9f['mergeFromDatabase'](_0x5dae9f[_0x4a8b('0x63')][_0x2754fa[_0x4a8b('0x25')]],_0x2754fa);_0x5dae9f['campaigns'][_0x2754fa[_0x4a8b('0x25')]][_0x4a8b('0x64')]=_0x2754fa['SquareProject']?_0x2754fa[_0x4a8b('0x65')][_0x4a8b('0x25')]:undefined;}}}return _0x5dae9f[_0x4a8b('0x63')];};};Realtime[_0x4a8b('0x3c')][_0x4a8b('0x66')]=function(){var _0x2957bf=this;return function(_0x114781){if(_0x114781){freeIsNotKey(_0x114781,_0x2957bf[_0x4a8b('0x67')],'id');for(var _0xf85f75=0x0,_0x3e38ad={};_0xf85f75<_0x114781[_0x4a8b('0x3f')];_0xf85f75+=0x1){_0x3e38ad=_0x114781[_0xf85f75];if(_[_0x4a8b('0x40')](_0x2957bf['voiceExtensions'][_0x3e38ad['id']])){_0x2957bf[_0x4a8b('0x67')][_0x3e38ad['id']]=new VoiceExtension(_0x3e38ad);}else{_0x2957bf['mergeFromDatabase'](_0x2957bf[_0x4a8b('0x67')][_0x3e38ad['id']],_0x3e38ad);}}}return _0x2957bf[_0x4a8b('0x67')];};};Realtime[_0x4a8b('0x3c')][_0x4a8b('0x68')]=function(){var _0x12df84=this;return function(_0x9551ca){clearCampaigns(_0x12df84[_0x4a8b('0x63')]);for(var _0x451900=0x0;_0x451900<_0x9551ca['length'];_0x451900+=0x1){_[_0x4a8b('0x50')](_0x12df84[_0x4a8b('0x63')][_0x9551ca[_0x451900][_0x4a8b('0x25')]],_0x9551ca[_0x451900]);}return _0x12df84['campaigns'];};};Realtime['prototype']['initFaxAccounts']=function(){var _0x171cf8=this;return function(_0x2a3f75){if(_0x2a3f75){freeIsNotKey(_0x2a3f75,_0x171cf8['faxAccounts'],'id');for(var _0x396613=0x0,_0x40166d={},_0xe64770={};_0x396613<_0x2a3f75[_0x4a8b('0x3f')];_0x396613+=0x1){_0x40166d=_0x2a3f75[_0x396613];if(_[_0x4a8b('0x40')](_0x171cf8['faxAccounts'][_0x40166d['id']])){_0x171cf8[_0x4a8b('0x21')][_0x40166d['id']]=new FaxAccount(_0x40166d);}else{_0x171cf8[_0x4a8b('0x3d')](_0x171cf8[_0x4a8b('0x21')][_0x40166d['id']],_0x40166d);}}}return _0x171cf8['faxAccounts'];};};module[_0x4a8b('0x69')]=Realtime; \ No newline at end of file +var _0x35e7=['deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','faxAccounts','mapKeys','hasOwnProperty','format','SIP/%s','name','isNil','interface','total','answered','sumBillable','isEmpty','ivrTotalCallsDays','unmanaged','abandoned','sumHoldTime','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','queueStatusComplete','mergeFromDatabase','prototype','initAgents','length','isUndefined','initTelephones','initTrunks','trunks','initVoiceQueues','initTemplates','initZendeskAccounts','initSalesforceAccounts','salesforceAccounts','initFreshdeskAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','freshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','groupBy','uniqueid','queue','queuecallerexit','queuecallerabandon','diff','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerjoinAt','queuecallercomplete','queuecallerleaveAt','sumDuration','initVoiceCallReports','disposition','ANSWERED','duration','billableseconds','initCampaigns','campaigns','dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','exports','bluebird','util','../model/telephone','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/freshsalesAccount','agents','telephones','voiceQueues','triggers','templates','outbound','voiceExtensions','channels','queueChannels','zendeskAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts'];(function(_0x45187d,_0x32acd6){var _0x32f203=function(_0x456466){while(--_0x456466){_0x45187d['push'](_0x45187d['shift']());}};_0x32f203(++_0x32acd6);}(_0x35e7,0xbd));var _0x735e=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0x35e7[_0x3c4737];return _0x2bb926;};'use strict';var BPromise=require(_0x735e('0x0'));var util=require(_0x735e('0x1'));var _=require('lodash');var moment=require('moment');var Agent=require('../model/agent');var Telephone=require(_0x735e('0x2'));var Trunk=require('../model/trunk');var VoiceQueue=require(_0x735e('0x3'));var Trigger=require(_0x735e('0x4'));var Template=require(_0x735e('0x5'));var Campaign=require(_0x735e('0x6'));var VoiceExtension=require(_0x735e('0x7'));var ZendeskAccount=require(_0x735e('0x8'));var SalesforceAccount=require(_0x735e('0x9'));var FreshdeskAccount=require(_0x735e('0xa'));var SugarcrmAccount=require(_0x735e('0xb'));var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require(_0x735e('0xc'));var VtigerAccount=require(_0x735e('0xd'));var ServicenowAccount=require(_0x735e('0xe'));var Dynamics365Account=require('../model/dynamics365Account');var FreshsalesAccount=require(_0x735e('0xf'));var FaxAccount=require('../model/faxAccount');var Realtime=function(){this[_0x735e('0x10')]={};this[_0x735e('0x11')]={};this['trunks']={};this[_0x735e('0x12')]={};this[_0x735e('0x13')]={};this['campaigns']={};this[_0x735e('0x14')]={};this[_0x735e('0x15')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x735e('0x16')]={};this[_0x735e('0x17')]={};this[_0x735e('0x18')]={};this['outboundChannels']={};this['timers']={};this[_0x735e('0x19')]={};this['salesforceAccounts']={};this[_0x735e('0x1a')]={};this[_0x735e('0x1b')]={};this[_0x735e('0x1c')]={};this[_0x735e('0x1d')]={};this[_0x735e('0x1e')]={};this[_0x735e('0x1f')]={};this[_0x735e('0x20')]={};this['freshsalesAccounts']={};this[_0x735e('0x21')]={};};function freeIsNotKey(_0x37d025,_0x3b0832,_0x82127a){var _0x26379c=_[_0x735e('0x22')](_0x37d025,function(_0x469e3e,_0x2ff713){return _0x469e3e[_0x82127a];});for(var _0x4bb5ec in _0x3b0832){if(_0x3b0832[_0x735e('0x23')](_0x4bb5ec)){if(!_0x26379c[_0x4bb5ec]){delete _0x3b0832[_0x4bb5ec];}}}}function freeIsNotKeySip(_0x51584d,_0x160c3c){var _0x2cdf89=_['mapKeys'](_0x51584d,function(_0x5630df,_0x856fa){return util[_0x735e('0x24')](_0x735e('0x25'),_0x5630df[_0x735e('0x26')]);});for(var _0x571260 in _0x160c3c){if(_0x160c3c[_0x735e('0x23')](_0x571260)){if(!_0x2cdf89[_0x571260]){delete _0x160c3c[_0x571260];}}}}function freeIsNotKeyAgent(_0x467274,_0x2a7b59){var _0x46ab36=_[_0x735e('0x22')](_0x467274,function(_0x40077f,_0xb3d524){var _0x2114b8=_[_0x735e('0x27')](_0x40077f[_0x735e('0x28')])?util[_0x735e('0x24')](_0x735e('0x25'),_0x40077f[_0x735e('0x26')]):_0x40077f[_0x735e('0x28')];return _0x2114b8;});for(var _0x38cb6e in _0x2a7b59){if(_0x2a7b59['hasOwnProperty'](_0x38cb6e)){if(!_0x46ab36[_0x38cb6e]){delete _0x2a7b59[_0x38cb6e];}}}}function clearVoiceCallReports(_0x3fd610){_0x3fd610[_0x735e('0x29')]=0x0;_0x3fd610[_0x735e('0x2a')]=0x0;_0x3fd610['sumHoldTime']=0x0;_0x3fd610['sumDuration']=0x0;_0x3fd610[_0x735e('0x2b')]=0x0;}function clearCampaigns(_0xdcc7f9){if(!_[_0x735e('0x2c')](_0xdcc7f9)){for(var _0x441dd7 in _0xdcc7f9){if(_0xdcc7f9[_0x735e('0x23')](_0x441dd7)){_0xdcc7f9[_0x441dd7][_0x735e('0x2d')]=0x0;_0xdcc7f9[_0x441dd7]['ivrAnswerCallsDay']=0x0;}}}}function clearVoiceQueues(_0x249f8a){if(!_[_0x735e('0x2c')](_0x249f8a)){for(var _0x46134c in _0x249f8a){if(_0x249f8a[_0x735e('0x23')](_0x46134c)){_0x249f8a[_0x46134c][_0x735e('0x29')]=0x0;_0x249f8a[_0x46134c][_0x735e('0x2a')]=0x0;_0x249f8a[_0x46134c][_0x735e('0x2e')]=0x0;_0x249f8a[_0x46134c][_0x735e('0x2f')]=0x0;_0x249f8a[_0x46134c][_0x735e('0x30')]=0x0;_0x249f8a[_0x46134c]['sumDuration']=0x0;_0x249f8a[_0x46134c][_0x735e('0x2b')]=0x0;_0x249f8a[_0x46134c]['outboundAnswerAgiCallsDay']=0x0;_0x249f8a[_0x46134c][_0x735e('0x31')]=0x0;_0x249f8a[_0x46134c][_0x735e('0x32')]=0x0;_0x249f8a[_0x46134c]['outboundCongestionCallsDay']=0x0;_0x249f8a[_0x46134c][_0x735e('0x33')]=0x0;_0x249f8a[_0x46134c][_0x735e('0x34')]=0x0;_0x249f8a[_0x46134c][_0x735e('0x35')]=0x0;_0x249f8a[_0x46134c][_0x735e('0x36')]=0x0;_0x249f8a[_0x46134c]['outboundBlacklistCallsDay']=0x0;_0x249f8a[_0x46134c]['outboundOriginateFailureCallsDay']=0x0;_0x249f8a[_0x46134c][_0x735e('0x37')]=0x0;_0x249f8a[_0x46134c][_0x735e('0x38')]=0x0;_0x249f8a[_0x46134c][_0x735e('0x39')]=0x0;_0x249f8a[_0x46134c][_0x735e('0x3a')]=0x0;_0x249f8a[_0x46134c][_0x735e('0x3b')]=!![];}}}}Realtime['prototype'][_0x735e('0x3c')]=function(_0x151ba9,_0x2188ed){for(var _0x48cb2d in _0x2188ed){if(_0x151ba9['hasOwnProperty'](_0x48cb2d)){_0x151ba9[_0x48cb2d]=_0x2188ed[_0x48cb2d];}}};Realtime[_0x735e('0x3d')][_0x735e('0x3e')]=function(){var _0x1afe56=this;return function(_0x39ea45){if(_0x39ea45){freeIsNotKeyAgent(_0x39ea45,_0x1afe56['agents']);for(var _0x63edd1=0x0,_0x5b4857={},_0xc9e29d={};_0x63edd1<_0x39ea45[_0x735e('0x3f')];_0x63edd1+=0x1){_0x5b4857=_0x39ea45[_0x63edd1];var _0x116ee9=_[_0x735e('0x27')](_0x5b4857[_0x735e('0x28')])?util['format'](_0x735e('0x25'),_0x5b4857[_0x735e('0x26')]):_0x5b4857[_0x735e('0x28')];if(_[_0x735e('0x40')](_0x1afe56[_0x735e('0x10')][_0x116ee9])){_0x1afe56['agents'][_0x116ee9]=new Agent(_0x5b4857);}else{_0x1afe56[_0x735e('0x3c')](_0x1afe56[_0x735e('0x10')][_0x116ee9],_0x5b4857);}}}return _0x1afe56['agents'];};};Realtime[_0x735e('0x3d')][_0x735e('0x41')]=function(){var _0x10759a=this;return function(_0x15a985){if(_0x15a985){freeIsNotKeySip(_0x15a985,_0x10759a[_0x735e('0x11')]);for(var _0x3781c3=0x0,_0xa7f45f={},_0x2eaecd={};_0x3781c3<_0x15a985[_0x735e('0x3f')];_0x3781c3+=0x1){_0xa7f45f=_0x15a985[_0x3781c3];if(_[_0x735e('0x40')](_0x10759a[_0x735e('0x11')][util['format'](_0x735e('0x25'),_0xa7f45f['name'])])){_0x10759a[_0x735e('0x11')][util[_0x735e('0x24')](_0x735e('0x25'),_0xa7f45f['name'])]=new Telephone(_0xa7f45f);}else{_0x10759a[_0x735e('0x3c')](_0x10759a[_0x735e('0x11')][util[_0x735e('0x24')](_0x735e('0x25'),_0xa7f45f[_0x735e('0x26')])],_0xa7f45f);}}}return _0x10759a[_0x735e('0x11')];};};Realtime['prototype'][_0x735e('0x42')]=function(){var _0x3fa2ab=this;return function(_0x229443){if(_0x229443){freeIsNotKeySip(_0x229443,_0x3fa2ab[_0x735e('0x43')]);for(var _0x34c9fd=0x0,_0x363e73={},_0x2b66a8={};_0x34c9fd<_0x229443['length'];_0x34c9fd+=0x1){_0x363e73=_0x229443[_0x34c9fd];if(_[_0x735e('0x40')](_0x3fa2ab[_0x735e('0x43')][util['format'](_0x735e('0x25'),_0x363e73['name'])])){_0x3fa2ab['trunks'][util[_0x735e('0x24')]('SIP/%s',_0x363e73[_0x735e('0x26')])]=new Trunk(_0x363e73);}else{_0x3fa2ab[_0x735e('0x3c')](_0x3fa2ab[_0x735e('0x43')][util[_0x735e('0x24')](_0x735e('0x25'),_0x363e73[_0x735e('0x26')])],_0x363e73);}}}return _0x3fa2ab[_0x735e('0x43')];};};Realtime[_0x735e('0x3d')][_0x735e('0x44')]=function(){var _0x24911a=this;return function(_0x371eaf){if(_0x371eaf){freeIsNotKey(_0x371eaf,_0x24911a[_0x735e('0x12')],_0x735e('0x26'));for(var _0x58f2fa=0x0,_0xd92b19={},_0x2280f6={};_0x58f2fa<_0x371eaf[_0x735e('0x3f')];_0x58f2fa+=0x1){_0xd92b19=_0x371eaf[_0x58f2fa];if(_['isUndefined'](_0x24911a[_0x735e('0x12')][_0xd92b19[_0x735e('0x26')]])){_0x24911a['voiceQueues'][_0xd92b19[_0x735e('0x26')]]=new VoiceQueue(_0xd92b19);}else{_0x24911a[_0x735e('0x3c')](_0x24911a[_0x735e('0x12')][_0xd92b19['name']],_0xd92b19);}}}return _0x24911a[_0x735e('0x12')];};};Realtime[_0x735e('0x3d')]['initTriggers']=function(){var _0x179f6d=this;return function(_0x3cf7b7){if(_0x3cf7b7){freeIsNotKey(_0x3cf7b7,_0x179f6d[_0x735e('0x13')],'id');for(var _0x9ea321=0x0,_0x482543={},_0x43346b={};_0x9ea321<_0x3cf7b7[_0x735e('0x3f')];_0x9ea321+=0x1){_0x482543=_0x3cf7b7[_0x9ea321];if(_[_0x735e('0x40')](_0x179f6d[_0x735e('0x13')][_0x482543['id']])){_0x179f6d[_0x735e('0x13')][_0x482543['id']]=new Trigger(_0x482543);}else{_0x179f6d[_0x735e('0x3c')](_0x179f6d[_0x735e('0x13')][_0x482543['id']],_0x482543);}}}return _0x179f6d['triggers'];};};Realtime['prototype'][_0x735e('0x45')]=function(){var _0x146c4e=this;return function(_0x5b74b3){if(_0x5b74b3){freeIsNotKey(_0x5b74b3,_0x146c4e[_0x735e('0x14')],'id');for(var _0x46fe2b=0x0,_0x3ef6fd={},_0x401fd9={};_0x46fe2b<_0x5b74b3[_0x735e('0x3f')];_0x46fe2b+=0x1){_0x3ef6fd=_0x5b74b3[_0x46fe2b];if(_[_0x735e('0x40')](_0x146c4e[_0x735e('0x14')][_0x3ef6fd['id']])){_0x146c4e['templates'][_0x3ef6fd['id']]=new Template(_0x3ef6fd);}else{_0x146c4e[_0x735e('0x3c')](_0x146c4e[_0x735e('0x14')][_0x3ef6fd['id']],_0x3ef6fd);}}}return _0x146c4e['templates'];};};Realtime[_0x735e('0x3d')][_0x735e('0x46')]=function(){var _0x11b4e4=this;return function(_0x10b4db){if(_0x10b4db){freeIsNotKey(_0x10b4db,_0x11b4e4['zendeskAccounts'],'id');for(var _0x1483e6=0x0,_0x30ff4c={},_0x1d9c59={};_0x1483e6<_0x10b4db[_0x735e('0x3f')];_0x1483e6+=0x1){_0x30ff4c=_0x10b4db[_0x1483e6];if(_[_0x735e('0x40')](_0x11b4e4['zendeskAccounts'][_0x30ff4c['id']])){_0x11b4e4[_0x735e('0x19')][_0x30ff4c['id']]=new ZendeskAccount(_0x30ff4c);}else{_0x11b4e4[_0x735e('0x3c')](_0x11b4e4['zendeskAccounts'][_0x30ff4c['id']],_0x30ff4c);}}}return _0x11b4e4[_0x735e('0x19')];};};Realtime[_0x735e('0x3d')][_0x735e('0x47')]=function(){var _0x1f2ae3=this;return function(_0x2ffad6){if(_0x2ffad6){freeIsNotKey(_0x2ffad6,_0x1f2ae3['salesforceAccounts'],'id');for(var _0x56cd7c=0x0,_0x5c0522={},_0x2f8402={};_0x56cd7c<_0x2ffad6[_0x735e('0x3f')];_0x56cd7c+=0x1){_0x5c0522=_0x2ffad6[_0x56cd7c];if(_['isUndefined'](_0x1f2ae3['salesforceAccounts'][_0x5c0522['id']])){_0x1f2ae3[_0x735e('0x48')][_0x5c0522['id']]=new SalesforceAccount(_0x5c0522);}else{_0x1f2ae3[_0x735e('0x3c')](_0x1f2ae3['salesforceAccounts'][_0x5c0522['id']],_0x5c0522);}}}return _0x1f2ae3[_0x735e('0x48')];};};Realtime[_0x735e('0x3d')][_0x735e('0x49')]=function(){var _0x54f015=this;return function(_0x41c0e9){if(_0x41c0e9){freeIsNotKey(_0x41c0e9,_0x54f015[_0x735e('0x1b')],'id');for(var _0x36064e=0x0,_0x4f95e4={},_0x58d683={};_0x36064e<_0x41c0e9[_0x735e('0x3f')];_0x36064e+=0x1){_0x4f95e4=_0x41c0e9[_0x36064e];if(_[_0x735e('0x40')](_0x54f015[_0x735e('0x1b')][_0x4f95e4['id']])){_0x54f015[_0x735e('0x1b')][_0x4f95e4['id']]=new FreshdeskAccount(_0x4f95e4);}else{_0x54f015[_0x735e('0x3c')](_0x54f015[_0x735e('0x1b')][_0x4f95e4['id']],_0x4f95e4);}}}return _0x54f015['freshdeskAccounts'];};};Realtime[_0x735e('0x3d')]['initZohoAccounts']=function(){var _0xc871e3=this;return function(_0x5d515e){if(_0x5d515e){freeIsNotKey(_0x5d515e,_0xc871e3[_0x735e('0x1c')],'id');for(var _0xf6122e=0x0,_0x50bee9={},_0x5eb19f={};_0xf6122e<_0x5d515e['length'];_0xf6122e+=0x1){_0x50bee9=_0x5d515e[_0xf6122e];if(_[_0x735e('0x40')](_0xc871e3[_0x735e('0x1c')][_0x50bee9['id']])){_0xc871e3[_0x735e('0x1c')][_0x50bee9['id']]=new ZohoAccount(_0x50bee9);}else{_0xc871e3[_0x735e('0x3c')](_0xc871e3['zohoAccounts'][_0x50bee9['id']],_0x50bee9);}}}return _0xc871e3[_0x735e('0x1c')];};};Realtime[_0x735e('0x3d')][_0x735e('0x4a')]=function(){var _0x2f60e9=this;return function(_0x2123b6){if(_0x2123b6){freeIsNotKey(_0x2123b6,_0x2f60e9['deskAccounts'],'id');for(var _0x496e95=0x0,_0x45106c={},_0x57a788={};_0x496e95<_0x2123b6[_0x735e('0x3f')];_0x496e95+=0x1){_0x45106c=_0x2123b6[_0x496e95];if(_[_0x735e('0x40')](_0x2f60e9[_0x735e('0x1d')][_0x45106c['id']])){_0x2f60e9['deskAccounts'][_0x45106c['id']]=new DeskAccount(_0x45106c);}else{_0x2f60e9[_0x735e('0x3c')](_0x2f60e9[_0x735e('0x1d')][_0x45106c['id']],_0x45106c);}}}return _0x2f60e9['deskAccounts'];};};Realtime[_0x735e('0x3d')][_0x735e('0x4b')]=function(){var _0x29193c=this;return function(_0x4ba222){if(_0x4ba222){freeIsNotKey(_0x4ba222,_0x29193c[_0x735e('0x1a')],'id');for(var _0x48951d=0x0,_0x33b225={},_0x295cf2={};_0x48951d<_0x4ba222[_0x735e('0x3f')];_0x48951d+=0x1){_0x33b225=_0x4ba222[_0x48951d];if(_[_0x735e('0x40')](_0x29193c[_0x735e('0x1a')][_0x33b225['id']])){_0x29193c[_0x735e('0x1a')][_0x33b225['id']]=new SugarcrmAccount(_0x33b225);}else{_0x29193c[_0x735e('0x3c')](_0x29193c[_0x735e('0x1a')][_0x33b225['id']],_0x33b225);}}}return _0x29193c[_0x735e('0x1a')];};};Realtime[_0x735e('0x3d')][_0x735e('0x4c')]=function(){var _0x257b20=this;return function(_0x51cdc4){if(_0x51cdc4){freeIsNotKey(_0x51cdc4,_0x257b20[_0x735e('0x1e')],'id');for(var _0x24cfcc=0x0,_0x742b3e={},_0x3d21e2={};_0x24cfcc<_0x51cdc4[_0x735e('0x3f')];_0x24cfcc+=0x1){_0x742b3e=_0x51cdc4[_0x24cfcc];if(_[_0x735e('0x40')](_0x257b20[_0x735e('0x1e')][_0x742b3e['id']])){_0x257b20[_0x735e('0x1e')][_0x742b3e['id']]=new VtigerAccount(_0x742b3e);}else{_0x257b20[_0x735e('0x3c')](_0x257b20[_0x735e('0x1e')][_0x742b3e['id']],_0x742b3e);}}}return _0x257b20['vtigerAccounts'];};};Realtime['prototype'][_0x735e('0x4d')]=function(){var _0x14d590=this;return function(_0x329c23){if(_0x329c23){freeIsNotKey(_0x329c23,_0x14d590[_0x735e('0x1f')],'id');for(var _0x550aa3=0x0,_0x5f08bb={},_0xa1bde9={};_0x550aa3<_0x329c23['length'];_0x550aa3+=0x1){_0x5f08bb=_0x329c23[_0x550aa3];if(_[_0x735e('0x40')](_0x14d590[_0x735e('0x1f')][_0x5f08bb['id']])){_0x14d590[_0x735e('0x1f')][_0x5f08bb['id']]=new ServicenowAccount(_0x5f08bb);}else{_0x14d590[_0x735e('0x3c')](_0x14d590[_0x735e('0x1f')][_0x5f08bb['id']],_0x5f08bb);}}}return _0x14d590[_0x735e('0x1f')];};};Realtime['prototype'][_0x735e('0x4e')]=function(){var _0x3c0a2d=this;return function(_0x283e0f){if(_0x283e0f){freeIsNotKey(_0x283e0f,_0x3c0a2d[_0x735e('0x20')],'id');for(var _0x3e67bb=0x0,_0x557eec={},_0x21dac0={};_0x3e67bb<_0x283e0f[_0x735e('0x3f')];_0x3e67bb+=0x1){_0x557eec=_0x283e0f[_0x3e67bb];if(_[_0x735e('0x40')](_0x3c0a2d[_0x735e('0x20')][_0x557eec['id']])){_0x3c0a2d[_0x735e('0x20')][_0x557eec['id']]=new Dynamics365Account(_0x557eec);}else{_0x3c0a2d['mergeFromDatabase'](_0x3c0a2d[_0x735e('0x20')][_0x557eec['id']],_0x557eec);}}}return _0x3c0a2d[_0x735e('0x20')];};};Realtime[_0x735e('0x3d')][_0x735e('0x4f')]=function(){var _0x5976c1=this;return function(_0x54973b){if(_0x54973b){freeIsNotKey(_0x54973b,_0x5976c1[_0x735e('0x50')],'id');for(var _0x1f1949=0x0,_0x38b485={},_0xb5cc5a={};_0x1f1949<_0x54973b[_0x735e('0x3f')];_0x1f1949+=0x1){_0x38b485=_0x54973b[_0x1f1949];if(_[_0x735e('0x40')](_0x5976c1[_0x735e('0x50')][_0x38b485['id']])){_0x5976c1['freshsalesAccounts'][_0x38b485['id']]=new FreshsalesAccount(_0x38b485);}else{_0x5976c1['mergeFromDatabase'](_0x5976c1[_0x735e('0x50')][_0x38b485['id']],_0x38b485);}}}return _0x5976c1['freshsalesAccounts'];};};Realtime[_0x735e('0x3d')][_0x735e('0x51')]=function(){var _0x50b9dc=this;return function(_0x55c5a5){for(var _0x220e6f=0x0;_0x220e6f<_0x55c5a5[_0x735e('0x3f')];_0x220e6f+=0x1){_[_0x735e('0x52')](_0x50b9dc[_0x735e('0x12')][_0x55c5a5[_0x220e6f][_0x735e('0x26')]],_0x55c5a5[_0x220e6f]);}return _0x50b9dc[_0x735e('0x12')];};};Realtime[_0x735e('0x3d')][_0x735e('0x53')]=function(){var _0x1f9ed1=this;return function(_0x5bc646){clearVoiceQueues(_0x1f9ed1['voiceQueues']);if(_0x5bc646){_0x5bc646=_[_0x735e('0x54')](_0x5bc646,_0x735e('0x55'));for(var _0x4dc4b9 in _0x5bc646){if(_0x5bc646['hasOwnProperty'](_0x4dc4b9)){var _0x90d12={};for(var _0x460b21=0x0;_0x460b21<_0x5bc646[_0x4dc4b9][_0x735e('0x3f')];_0x460b21+=0x1){var _0x53b14e=_0x5bc646[_0x4dc4b9][_0x460b21][_0x735e('0x56')];if(_0x1f9ed1[_0x735e('0x12')][_0x53b14e]){if(_0x5bc646[_0x4dc4b9][_0x460b21][_0x735e('0x57')]){_0x1f9ed1[_0x735e('0x12')][_0x53b14e][_0x735e('0x2e')]+=0x1;}if(_0x5bc646[_0x4dc4b9][_0x460b21][_0x735e('0x58')]){_0x1f9ed1[_0x735e('0x12')][_0x53b14e]['abandoned']+=0x1;}_0x1f9ed1[_0x735e('0x12')][_0x53b14e][_0x735e('0x30')]+=moment(_0x5bc646[_0x4dc4b9][_0x460b21]['queuecallerleaveAt'])[_0x735e('0x59')](moment(_0x5bc646[_0x4dc4b9][_0x460b21]['queuecallerjoinAt']),_0x735e('0x5a'))||0x0;if(_0x460b21===_0x5bc646[_0x4dc4b9][_0x735e('0x3f')]-0x1){_0x1f9ed1[_0x735e('0x12')][_0x53b14e]['sumDuration']+=moment(_0x5bc646[_0x4dc4b9][_0x460b21][_0x735e('0x5b')]||_0x5bc646[_0x4dc4b9][_0x460b21][_0x735e('0x5c')]||_0x5bc646[_0x4dc4b9][_0x460b21]['queuecallerexitAt'])[_0x735e('0x59')](moment(_0x5bc646[_0x4dc4b9][_0x460b21][_0x735e('0x5d')]),'seconds')||0x0;_0x1f9ed1['voiceQueues'][_0x53b14e]['total']+=0x1;if(_0x5bc646[_0x4dc4b9][_0x460b21][_0x735e('0x5e')]){_0x1f9ed1['voiceQueues'][_0x53b14e][_0x735e('0x2a')]+=0x1;_0x1f9ed1[_0x735e('0x12')][_0x53b14e][_0x735e('0x2b')]+=moment(_0x5bc646[_0x4dc4b9][_0x460b21][_0x735e('0x5b')])[_0x735e('0x59')](moment(_0x5bc646[_0x4dc4b9][_0x460b21][_0x735e('0x5f')]),_0x735e('0x5a'))||0x0;}}else{_0x1f9ed1[_0x735e('0x12')][_0x53b14e][_0x735e('0x60')]+=_0x1f9ed1['voiceQueues'][_0x53b14e]['sumHoldTime']||0x0;}}}}}}return _0x1f9ed1[_0x735e('0x12')];};};Realtime['prototype'][_0x735e('0x61')]=function(){var _0x3254e5=this;return function(_0x371ca2){clearVoiceCallReports(_0x3254e5[_0x735e('0x15')]);if(_0x371ca2){for(var _0x4cc83b=0x0;_0x4cc83b<_0x371ca2[_0x735e('0x3f')];_0x4cc83b+=0x1){_0x3254e5[_0x735e('0x15')]['total']+=0x1;_0x3254e5[_0x735e('0x15')][_0x735e('0x60')]+=_0x371ca2[_0x4cc83b]['duration'];if(_0x371ca2[_0x4cc83b][_0x735e('0x62')]===_0x735e('0x63')){_0x3254e5[_0x735e('0x15')]['answered']+=0x1;_0x3254e5[_0x735e('0x15')][_0x735e('0x30')]+=_0x371ca2[_0x4cc83b][_0x735e('0x64')]-_0x371ca2[_0x4cc83b][_0x735e('0x65')]||0x0;_0x3254e5[_0x735e('0x15')][_0x735e('0x2b')]+=_0x371ca2[_0x4cc83b][_0x735e('0x65')];}}}return _0x3254e5[_0x735e('0x15')];};};Realtime[_0x735e('0x3d')][_0x735e('0x66')]=function(){var _0xfce209=this;return function(_0x139dc1){if(_0x139dc1){freeIsNotKey(_0x139dc1,_0xfce209[_0x735e('0x67')],_0x735e('0x26'));for(var _0x519310=0x0,_0x2e01df={};_0x519310<_0x139dc1[_0x735e('0x3f')];_0x519310+=0x1){_0x2e01df=_0x139dc1[_0x519310];if(_[_0x735e('0x40')](_0xfce209['campaigns'][_0x2e01df[_0x735e('0x26')]])){_0xfce209[_0x735e('0x67')][_0x2e01df[_0x735e('0x26')]]=new Campaign(_0x2e01df);}else{_0xfce209[_0x735e('0x3c')](_0xfce209[_0x735e('0x67')][_0x2e01df[_0x735e('0x26')]],_0x2e01df);_0xfce209[_0x735e('0x67')][_0x2e01df[_0x735e('0x26')]][_0x735e('0x68')]=_0x2e01df[_0x735e('0x69')]?_0x2e01df[_0x735e('0x69')]['name']:undefined;}}}return _0xfce209[_0x735e('0x67')];};};Realtime[_0x735e('0x3d')][_0x735e('0x6a')]=function(){var _0x2513fd=this;return function(_0x3a23f8){if(_0x3a23f8){freeIsNotKey(_0x3a23f8,_0x2513fd[_0x735e('0x16')],'id');for(var _0xc6ad36=0x0,_0x450f21={};_0xc6ad36<_0x3a23f8['length'];_0xc6ad36+=0x1){_0x450f21=_0x3a23f8[_0xc6ad36];if(_[_0x735e('0x40')](_0x2513fd['voiceExtensions'][_0x450f21['id']])){_0x2513fd[_0x735e('0x16')][_0x450f21['id']]=new VoiceExtension(_0x450f21);}else{_0x2513fd[_0x735e('0x3c')](_0x2513fd[_0x735e('0x16')][_0x450f21['id']],_0x450f21);}}}return _0x2513fd['voiceExtensions'];};};Realtime[_0x735e('0x3d')][_0x735e('0x6b')]=function(){var _0x5c6460=this;return function(_0x5d6960){clearCampaigns(_0x5c6460['campaigns']);for(var _0x3f928b=0x0;_0x3f928b<_0x5d6960[_0x735e('0x3f')];_0x3f928b+=0x1){_[_0x735e('0x52')](_0x5c6460[_0x735e('0x67')][_0x5d6960[_0x3f928b][_0x735e('0x26')]],_0x5d6960[_0x3f928b]);}return _0x5c6460['campaigns'];};};Realtime[_0x735e('0x3d')]['initFaxAccounts']=function(){var _0x3d4a1b=this;return function(_0x2327b3){if(_0x2327b3){freeIsNotKey(_0x2327b3,_0x3d4a1b[_0x735e('0x21')],'id');for(var _0x463492=0x0,_0x2695b1={},_0x1f1cff={};_0x463492<_0x2327b3['length'];_0x463492+=0x1){_0x2695b1=_0x2327b3[_0x463492];if(_[_0x735e('0x40')](_0x3d4a1b[_0x735e('0x21')][_0x2695b1['id']])){_0x3d4a1b[_0x735e('0x21')][_0x2695b1['id']]=new FaxAccount(_0x2695b1);}else{_0x3d4a1b[_0x735e('0x3c')](_0x3d4a1b[_0x735e('0x21')][_0x2695b1['id']],_0x2695b1);}}}return _0x3d4a1b[_0x735e('0x21')];};};module[_0x735e('0x6c')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 9e5ea24..13d6388 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 _0xb0fe=['isArray','startsWith','Local','indexOf','phone','substring','lastIndexOf','exports','bluebird','lodash','moment','../../../config/logger','../ami','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceDialReport','realtime','agents','telephones','sync','custom:voiceQueueReport','bind','voiceCallReport','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindTransfer','attendedtransfer','attendedTransfer','prototype','findAgent','find','name','isNil','interface','format','SIP/%s','voiceQueueReport','connectedlinenum','assigned','queuecallercomplete','queuecallerexit','YYYY-MM-DD\x20HH:mm:ss','create','match','destination','exten','type','dialer','lastapplication','lastdata','queue','context','callerid','from-sip','xcally-motion-preview','originatecalleridnum','destinationchannel','channel','calleridnum','disposition','ANSWERED','\x22%s\x22\x20<%s>','monitor','monitors','length','monitorFilename','filename','createdAt','calleridname','connectedlinename','accountcode','membername','xcally-motion-dialer'];(function(_0x21de89,_0x367053){var _0x290b7e=function(_0x540704){while(--_0x540704){_0x21de89['push'](_0x21de89['shift']());}};_0x290b7e(++_0x367053);}(_0xb0fe,0xa6));var _0xeb0f=function(_0x31506e,_0x1412b2){_0x31506e=_0x31506e-0x0;var _0x316c44=_0xb0fe[_0x31506e];return _0x316c44;};'use strict';var BPromise=require(_0xeb0f('0x0'));var _=require(_0xeb0f('0x1'));var moment=require(_0xeb0f('0x2'));var util=require('util');var config=require('../../../config/environment');var logger=require(_0xeb0f('0x3'))('ami');var ami=require(_0xeb0f('0x4'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require('../rpc/voiceCallReport');var RpcVoiceDialReport=require('../rpc/voiceDialReport');var RpcMemberReport=require(_0xeb0f('0x5'));var RpcVoiceQueueReport=require(_0xeb0f('0x6'));var RpcVoiceRecording=require(_0xeb0f('0x7'));var RpcVoiceTransferReport=require(_0xeb0f('0x8'));var VoiceQueueReport=require(_0xeb0f('0x9'));var VoiceCallReport=require(_0xeb0f('0xa'));var VoiceAgentReport=require('./voiceAgentReport');var VoiceDialReport=require(_0xeb0f('0xb'));var UserReport=require('./userReport');function Report(_0x328f92){this[_0xeb0f('0xc')]=_0x328f92;this['agents']=_0x328f92[_0xeb0f('0xd')];this[_0xeb0f('0xe')]=_0x328f92[_0xeb0f('0xe')];}Report['prototype'][_0xeb0f('0xf')]=function(_0x1dee27){var _0x51629a=new VoiceQueueReport(this[_0xeb0f('0xc')]);var _0x4f1faa=new VoiceAgentReport(this[_0xeb0f('0xc')]);var _0x295c8d=new VoiceDialReport(this[_0xeb0f('0xc')]);var _0x39ac63=new VoiceCallReport(this[_0xeb0f('0xc')]);var _0x356b70=new UserReport(this['realtime']);if(config['xdr']&&config['xdr']['disabled']){ami['on'](_0xeb0f('0x10'),this['voiceQueueReport'][_0xeb0f('0x11')](this));ami['on']('custom:voiceCallReport',this[_0xeb0f('0x12')][_0xeb0f('0x11')](this));ami['on'](_0xeb0f('0x13'),this[_0xeb0f('0x14')][_0xeb0f('0x11')](this));ami['on'](_0xeb0f('0x15'),this[_0xeb0f('0x16')][_0xeb0f('0x11')](this));ami['on']('blindtransfer',this[_0xeb0f('0x17')][_0xeb0f('0x11')](this));ami['on'](_0xeb0f('0x18'),this[_0xeb0f('0x19')][_0xeb0f('0x11')](this));}};Report[_0xeb0f('0x1a')][_0xeb0f('0x1b')]=function(_0x39c602){var _0x438abe=undefined;_0x438abe=_[_0xeb0f('0x1c')](this[_0xeb0f('0xd')],function(_0x5ba18f){return _0x5ba18f['accountcode']==_0x39c602||_0x5ba18f[_0xeb0f('0x1d')]==_0x39c602;});if(_[_0xeb0f('0x1e')](_0x438abe)){var _0x565ae4=_[_0xeb0f('0x1c')](this[_0xeb0f('0xe')],function(_0x3e5771){return _0x3e5771['accountcode']==_0x39c602||_0x3e5771['name']==_0x39c602;});if(_0x565ae4){_0x438abe=_[_0xeb0f('0x1c')](this['agents'],function(_0x33138e){return _0x33138e[_0xeb0f('0x1f')]==util[_0xeb0f('0x20')](_0xeb0f('0x21'),_0x565ae4[_0xeb0f('0x1d')]);});}}return _0x438abe;};Report[_0xeb0f('0x1a')][_0xeb0f('0x22')]=function(_0x4f4ba0){for(var _0x1206e0=0x0;_0x1206e0<_0x4f4ba0['length'];_0x1206e0+=0x1){var _0x1414a8=this[_0xeb0f('0x1b')](_0x4f4ba0[_0x1206e0][_0xeb0f('0x23')]);if(_0x1414a8){_0x4f4ba0[_0x1206e0]['accountcode']=_0x1414a8['accountcode'];_0x4f4ba0[_0x1206e0][_0xeb0f('0x24')]=!![];_0x4f4ba0[_0x1206e0]['lastAssignedTo']=_0x1414a8[_0xeb0f('0x1d')];_0x4f4ba0[_0x1206e0][_0xeb0f('0x1f')]=_[_0xeb0f('0x1e')](_0x1414a8[_0xeb0f('0x1f')])?util[_0xeb0f('0x20')](_0xeb0f('0x21'),_0x1414a8[_0xeb0f('0x1d')]):_0x1414a8['interface'];if(_0x4f4ba0[_0x1206e0][_0xeb0f('0x25')]){_0x4f4ba0[_0x1206e0]['queuecallercompleteAt']=moment()[_0xeb0f('0x20')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x4f4ba0[_0x1206e0][_0xeb0f('0x26')]){_0x4f4ba0[_0x1206e0]['queuecallerexitAt']=moment()['format'](_0xeb0f('0x27'));}RpcMemberReport['voiceQueueReport'](_0x4f4ba0[_0x1206e0]);}RpcVoiceQueueReport[_0xeb0f('0x28')](_0x4f4ba0[_0x1206e0]);}};function extractCalleridNumber(_0x3017ba){var _0x345798=_0x3017ba[_0xeb0f('0x29')](/<(.*?)>/);return _0x345798?_0x345798[0x1]:_0x3017ba;}Report['prototype'][_0xeb0f('0x12')]=function(_0x59e600){_0x59e600[_0xeb0f('0x2a')]=_0x59e600['destination']||_0x59e600[_0xeb0f('0x2b')];if(_0x59e600[_0xeb0f('0x2c')]==_0xeb0f('0x2d')){_0x59e600[_0xeb0f('0x2e')]='queue';_0x59e600[_0xeb0f('0x2f')]=_0x59e600[_0xeb0f('0x30')];if(_0x59e600[_0xeb0f('0x31')]=='from-voip-provider'){_0x59e600['accountcode']='';_0x59e600[_0xeb0f('0x2a')]=extractCalleridNumber(_0x59e600[_0xeb0f('0x32')]);}else if(_0x59e600['context']==_0xeb0f('0x33')){if(_0x59e600[_0xeb0f('0x2a')]==_0xeb0f('0x34')){_0x59e600[_0xeb0f('0x2a')]=extractCalleridNumber(_0x59e600['calleridpreview']);_0x59e600['calleridnum']=_0x59e600[_0xeb0f('0x35')];_0x59e600[_0xeb0f('0x36')]=[_0x59e600[_0xeb0f('0x37')],_0x59e600['channel']=_0x59e600[_0xeb0f('0x36')]][0x0];_0x59e600['callerid']=_0x59e600['calleridpreview'];}else{_0x59e600[_0xeb0f('0x2a')]=_0x59e600['calleridnum'];_0x59e600[_0xeb0f('0x38')]=_0x59e600[_0xeb0f('0x35')];if(_0x59e600[_0xeb0f('0x39')]==_0xeb0f('0x3a')){_0x59e600['accountcode']=_0x59e600[_0xeb0f('0x23')];}else{_0x59e600['accountcode']='';}}}}else{_0x59e600[_0xeb0f('0x32')]=util['format'](_0xeb0f('0x3b'),_0x59e600['calleridname'],_0x59e600[_0xeb0f('0x38')]);}RpcVoiceCallReport[_0xeb0f('0x28')](_0x59e600);if(_0x59e600[_0xeb0f('0x3c')]){for(var _0x164928=0x0;_0x164928<_0x59e600[_0xeb0f('0x3d')][_0xeb0f('0x3e')];_0x164928+=0x1){_0x59e600[_0xeb0f('0x3f')]=_0x59e600[_0xeb0f('0x3d')][_0x164928][_0xeb0f('0x40')];_0x59e600[_0xeb0f('0x41')]=_0x59e600[_0xeb0f('0x3d')][_0x164928][_0xeb0f('0x41')];if(_0x59e600['exten']==_0xeb0f('0x34')){_0x59e600[_0xeb0f('0x38')]=_0x59e600['connectedlinenum'];_0x59e600[_0xeb0f('0x42')]=_0x59e600[_0xeb0f('0x43')];_0x59e600[_0xeb0f('0x23')]=_0x59e600[_0xeb0f('0x44')];_0x59e600[_0xeb0f('0x43')]=_0x59e600[_0xeb0f('0x45')];_0x59e600[_0xeb0f('0x2b')]=_0x59e600[_0xeb0f('0x35')];}else if(_0x59e600['exten']==_0xeb0f('0x46')){_0x59e600[_0xeb0f('0x38')]=_0x59e600['destination'];_0x59e600['exten']=_0x59e600['originatecalleridnum'];}RpcVoiceRecording[_0xeb0f('0x28')](_0x59e600);}}};Report[_0xeb0f('0x1a')][_0xeb0f('0x14')]=function(_0x2dab8a){if(_[_0xeb0f('0x47')](_0x2dab8a)){_0x2dab8a['forEach'](function(_0xd00945){RpcVoiceAgentReport[_0xeb0f('0x28')](_0xd00945);});}else{RpcVoiceAgentReport[_0xeb0f('0x28')](_0x2dab8a);}};Report['prototype'][_0xeb0f('0x16')]=function(_0x3f95f6){RpcVoiceDialReport[_0xeb0f('0x28')](_0x3f95f6);var _0x44d708=undefined;var _0xa12d42=_0x3f95f6['channel'];if(_[_0xeb0f('0x48')](_0xa12d42,_0xeb0f('0x49'))){var _0x2d9e26=_0xa12d42['substring'](_0xa12d42[_0xeb0f('0x4a')]('/')+0x1,_0xa12d42[_0xeb0f('0x4a')]('@'));_0x44d708=_[_0xeb0f('0x1c')](this[_0xeb0f('0xd')],function(_0x2cbe38){return _0x2cbe38['mobile']==_0x2d9e26||_0x2cbe38[_0xeb0f('0x4b')]==_0x2d9e26||_0x2cbe38[_0xeb0f('0x44')]==_0x2d9e26;});}else{var _0x2d9e26=_0xa12d42[_0xeb0f('0x4c')](_0xa12d42[_0xeb0f('0x4a')]('/')+0x1,_0xa12d42[_0xeb0f('0x4d')]('-'));_0x44d708=this[_0xeb0f('0x1b')](_0x2d9e26);}if(_0x44d708){_0x3f95f6['interface']=_[_0xeb0f('0x1e')](_0x44d708[_0xeb0f('0x1f')])?util['format'](_0xeb0f('0x21'),_0x44d708['name']):_0x44d708[_0xeb0f('0x1f')];_0x3f95f6[_0xeb0f('0x45')]=_0x44d708['name'];_0x3f95f6[_0xeb0f('0x44')]=_0x44d708['accountcode'];RpcMemberReport[_0xeb0f('0x16')](_0x3f95f6);}};Report[_0xeb0f('0x1a')][_0xeb0f('0x17')]=function(_0x48d4e5){RpcVoiceTransferReport[_0xeb0f('0x17')](_0x48d4e5);};Report[_0xeb0f('0x1a')][_0xeb0f('0x19')]=function(_0x37aea2){RpcVoiceTransferReport[_0xeb0f('0x19')](_0x37aea2);};module[_0xeb0f('0x4e')]=Report; \ No newline at end of file +var _0xa7ef=['./voiceDialReport','./userReport','agents','telephones','sync','realtime','xdr','disabled','custom:voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','custom:voiceAgentReport','voiceAgentReport','voiceDialReport','blindtransfer','attendedtransfer','attendedTransfer','prototype','find','accountcode','isNil','name','interface','format','SIP/%s','voiceQueueReport','length','findAgent','connectedlinenum','assigned','lastAssignedTo','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','create','match','destination','exten','type','dialer','lastdata','context','from-voip-provider','callerid','from-sip','calleridpreview','calleridnum','originatecalleridnum','destinationchannel','channel','disposition','ANSWERED','\x22%s\x22\x20<%s>','calleridname','monitor','monitors','monitorFilename','filename','createdAt','xcally-motion-preview','connectedlinename','membername','forEach','startsWith','substring','indexOf','mobile','phone','lastIndexOf','blindTransfer','exports','bluebird','lodash','moment','../../../config/environment','../../../config/logger','ami','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','./voiceCallReport','./voiceAgentReport'];(function(_0x4c82f3,_0x1b922c){var _0xba6544=function(_0x3a8f32){while(--_0x3a8f32){_0x4c82f3['push'](_0x4c82f3['shift']());}};_0xba6544(++_0x1b922c);}(_0xa7ef,0x9f));var _0xfa7e=function(_0x3f23e2,_0xa590c0){_0x3f23e2=_0x3f23e2-0x0;var _0x17f7c0=_0xa7ef[_0x3f23e2];return _0x17f7c0;};'use strict';var BPromise=require(_0xfa7e('0x0'));var _=require(_0xfa7e('0x1'));var moment=require(_0xfa7e('0x2'));var util=require('util');var config=require(_0xfa7e('0x3'));var logger=require(_0xfa7e('0x4'))(_0xfa7e('0x5'));var ami=require(_0xfa7e('0x6'));var RpcVoiceAgentReport=require(_0xfa7e('0x7'));var RpcVoiceCallReport=require(_0xfa7e('0x8'));var RpcVoiceDialReport=require(_0xfa7e('0x9'));var RpcMemberReport=require(_0xfa7e('0xa'));var RpcVoiceQueueReport=require(_0xfa7e('0xb'));var RpcVoiceRecording=require(_0xfa7e('0xc'));var RpcVoiceTransferReport=require('../rpc/voiceTransferReport');var VoiceQueueReport=require('./voiceQueueReport');var VoiceCallReport=require(_0xfa7e('0xd'));var VoiceAgentReport=require(_0xfa7e('0xe'));var VoiceDialReport=require(_0xfa7e('0xf'));var UserReport=require(_0xfa7e('0x10'));function Report(_0x583b85){this['realtime']=_0x583b85;this[_0xfa7e('0x11')]=_0x583b85[_0xfa7e('0x11')];this[_0xfa7e('0x12')]=_0x583b85['telephones'];}Report['prototype'][_0xfa7e('0x13')]=function(_0x349de0){var _0x1713e3=new VoiceQueueReport(this[_0xfa7e('0x14')]);var _0x3acc66=new VoiceAgentReport(this[_0xfa7e('0x14')]);var _0x5ae58c=new VoiceDialReport(this[_0xfa7e('0x14')]);var _0x377188=new VoiceCallReport(this[_0xfa7e('0x14')]);var _0x336348=new UserReport(this[_0xfa7e('0x14')]);if(config['xdr']&&config[_0xfa7e('0x15')][_0xfa7e('0x16')]){ami['on'](_0xfa7e('0x17'),this['voiceQueueReport'][_0xfa7e('0x18')](this));ami['on'](_0xfa7e('0x19'),this[_0xfa7e('0x1a')][_0xfa7e('0x18')](this));ami['on'](_0xfa7e('0x1b'),this[_0xfa7e('0x1c')]['bind'](this));ami['on']('custom:voiceDialReport',this[_0xfa7e('0x1d')]['bind'](this));ami['on'](_0xfa7e('0x1e'),this['blindTransfer']['bind'](this));ami['on'](_0xfa7e('0x1f'),this[_0xfa7e('0x20')][_0xfa7e('0x18')](this));}};Report[_0xfa7e('0x21')]['findAgent']=function(_0x1a5489){var _0x54ebe9=undefined;_0x54ebe9=_[_0xfa7e('0x22')](this[_0xfa7e('0x11')],function(_0x2d9b05){return _0x2d9b05[_0xfa7e('0x23')]==_0x1a5489||_0x2d9b05['name']==_0x1a5489;});if(_[_0xfa7e('0x24')](_0x54ebe9)){var _0x286a28=_[_0xfa7e('0x22')](this[_0xfa7e('0x12')],function(_0x1b07fa){return _0x1b07fa[_0xfa7e('0x23')]==_0x1a5489||_0x1b07fa[_0xfa7e('0x25')]==_0x1a5489;});if(_0x286a28){_0x54ebe9=_[_0xfa7e('0x22')](this[_0xfa7e('0x11')],function(_0x4c4d65){return _0x4c4d65[_0xfa7e('0x26')]==util[_0xfa7e('0x27')](_0xfa7e('0x28'),_0x286a28['name']);});}}return _0x54ebe9;};Report[_0xfa7e('0x21')][_0xfa7e('0x29')]=function(_0x1d51dc){for(var _0x5c1962=0x0;_0x5c1962<_0x1d51dc[_0xfa7e('0x2a')];_0x5c1962+=0x1){var _0x516948=this[_0xfa7e('0x2b')](_0x1d51dc[_0x5c1962][_0xfa7e('0x2c')]);if(_0x516948){_0x1d51dc[_0x5c1962]['accountcode']=_0x516948[_0xfa7e('0x23')];_0x1d51dc[_0x5c1962][_0xfa7e('0x2d')]=!![];_0x1d51dc[_0x5c1962][_0xfa7e('0x2e')]=_0x516948['name'];_0x1d51dc[_0x5c1962][_0xfa7e('0x26')]=_['isNil'](_0x516948[_0xfa7e('0x26')])?util[_0xfa7e('0x27')](_0xfa7e('0x28'),_0x516948[_0xfa7e('0x25')]):_0x516948[_0xfa7e('0x26')];if(_0x1d51dc[_0x5c1962][_0xfa7e('0x2f')]){_0x1d51dc[_0x5c1962][_0xfa7e('0x30')]=moment()['format'](_0xfa7e('0x31'));}if(_0x1d51dc[_0x5c1962]['queuecallerexit']){_0x1d51dc[_0x5c1962]['queuecallerexitAt']=moment()[_0xfa7e('0x27')](_0xfa7e('0x31'));}RpcMemberReport[_0xfa7e('0x29')](_0x1d51dc[_0x5c1962]);}RpcVoiceQueueReport[_0xfa7e('0x32')](_0x1d51dc[_0x5c1962]);}};function extractCalleridNumber(_0x321abf){var _0x3efc74=_0x321abf[_0xfa7e('0x33')](/<(.*?)>/);return _0x3efc74?_0x3efc74[0x1]:_0x321abf;}Report[_0xfa7e('0x21')]['voiceCallReport']=function(_0x1ff5b4){_0x1ff5b4[_0xfa7e('0x34')]=_0x1ff5b4[_0xfa7e('0x34')]||_0x1ff5b4[_0xfa7e('0x35')];if(_0x1ff5b4[_0xfa7e('0x36')]==_0xfa7e('0x37')){_0x1ff5b4['lastapplication']='queue';_0x1ff5b4[_0xfa7e('0x38')]=_0x1ff5b4['queue'];if(_0x1ff5b4[_0xfa7e('0x39')]==_0xfa7e('0x3a')){_0x1ff5b4[_0xfa7e('0x23')]='';_0x1ff5b4[_0xfa7e('0x34')]=extractCalleridNumber(_0x1ff5b4[_0xfa7e('0x3b')]);}else if(_0x1ff5b4['context']==_0xfa7e('0x3c')){if(_0x1ff5b4[_0xfa7e('0x34')]=='xcally-motion-preview'){_0x1ff5b4[_0xfa7e('0x34')]=extractCalleridNumber(_0x1ff5b4[_0xfa7e('0x3d')]);_0x1ff5b4[_0xfa7e('0x3e')]=_0x1ff5b4[_0xfa7e('0x3f')];_0x1ff5b4[_0xfa7e('0x40')]=[_0x1ff5b4['channel'],_0x1ff5b4[_0xfa7e('0x41')]=_0x1ff5b4['destinationchannel']][0x0];_0x1ff5b4[_0xfa7e('0x3b')]=_0x1ff5b4[_0xfa7e('0x3d')];}else{_0x1ff5b4[_0xfa7e('0x34')]=_0x1ff5b4[_0xfa7e('0x3e')];_0x1ff5b4[_0xfa7e('0x3e')]=_0x1ff5b4[_0xfa7e('0x3f')];if(_0x1ff5b4[_0xfa7e('0x42')]==_0xfa7e('0x43')){_0x1ff5b4[_0xfa7e('0x23')]=_0x1ff5b4[_0xfa7e('0x2c')];}else{_0x1ff5b4[_0xfa7e('0x23')]='';}}}}else{_0x1ff5b4['callerid']=util[_0xfa7e('0x27')](_0xfa7e('0x44'),_0x1ff5b4[_0xfa7e('0x45')],_0x1ff5b4[_0xfa7e('0x3e')]);}RpcVoiceCallReport[_0xfa7e('0x32')](_0x1ff5b4);if(_0x1ff5b4[_0xfa7e('0x46')]){for(var _0x38ad0d=0x0;_0x38ad0d<_0x1ff5b4[_0xfa7e('0x47')][_0xfa7e('0x2a')];_0x38ad0d+=0x1){_0x1ff5b4[_0xfa7e('0x48')]=_0x1ff5b4[_0xfa7e('0x47')][_0x38ad0d][_0xfa7e('0x49')];_0x1ff5b4[_0xfa7e('0x4a')]=_0x1ff5b4['monitors'][_0x38ad0d][_0xfa7e('0x4a')];if(_0x1ff5b4[_0xfa7e('0x35')]==_0xfa7e('0x4b')){_0x1ff5b4['calleridnum']=_0x1ff5b4[_0xfa7e('0x2c')];_0x1ff5b4[_0xfa7e('0x45')]=_0x1ff5b4['connectedlinename'];_0x1ff5b4[_0xfa7e('0x2c')]=_0x1ff5b4[_0xfa7e('0x23')];_0x1ff5b4[_0xfa7e('0x4c')]=_0x1ff5b4[_0xfa7e('0x4d')];_0x1ff5b4[_0xfa7e('0x35')]=_0x1ff5b4[_0xfa7e('0x3f')];}else if(_0x1ff5b4[_0xfa7e('0x35')]=='xcally-motion-dialer'){_0x1ff5b4[_0xfa7e('0x3e')]=_0x1ff5b4[_0xfa7e('0x34')];_0x1ff5b4[_0xfa7e('0x35')]=_0x1ff5b4[_0xfa7e('0x3f')];}RpcVoiceRecording[_0xfa7e('0x32')](_0x1ff5b4);}}};Report[_0xfa7e('0x21')][_0xfa7e('0x1c')]=function(_0x41d79d){if(_['isArray'](_0x41d79d)){_0x41d79d[_0xfa7e('0x4e')](function(_0x45bebd){RpcVoiceAgentReport[_0xfa7e('0x32')](_0x45bebd);});}else{RpcVoiceAgentReport['create'](_0x41d79d);}};Report[_0xfa7e('0x21')][_0xfa7e('0x1d')]=function(_0x2ac4da){RpcVoiceDialReport[_0xfa7e('0x32')](_0x2ac4da);var _0x42768a=undefined;var _0x172fb5=_0x2ac4da[_0xfa7e('0x41')];if(_[_0xfa7e('0x4f')](_0x172fb5,'Local')){var _0x4812a7=_0x172fb5[_0xfa7e('0x50')](_0x172fb5[_0xfa7e('0x51')]('/')+0x1,_0x172fb5[_0xfa7e('0x51')]('@'));_0x42768a=_['find'](this[_0xfa7e('0x11')],function(_0x1ba3a3){return _0x1ba3a3[_0xfa7e('0x52')]==_0x4812a7||_0x1ba3a3[_0xfa7e('0x53')]==_0x4812a7||_0x1ba3a3[_0xfa7e('0x23')]==_0x4812a7;});}else{var _0x4812a7=_0x172fb5[_0xfa7e('0x50')](_0x172fb5[_0xfa7e('0x51')]('/')+0x1,_0x172fb5[_0xfa7e('0x54')]('-'));_0x42768a=this['findAgent'](_0x4812a7);}if(_0x42768a){_0x2ac4da['interface']=_['isNil'](_0x42768a[_0xfa7e('0x26')])?util[_0xfa7e('0x27')](_0xfa7e('0x28'),_0x42768a['name']):_0x42768a[_0xfa7e('0x26')];_0x2ac4da[_0xfa7e('0x4d')]=_0x42768a['name'];_0x2ac4da[_0xfa7e('0x23')]=_0x42768a[_0xfa7e('0x23')];RpcMemberReport[_0xfa7e('0x1d')](_0x2ac4da);}};Report[_0xfa7e('0x21')][_0xfa7e('0x55')]=function(_0x6e558a){RpcVoiceTransferReport[_0xfa7e('0x55')](_0x6e558a);};Report['prototype'][_0xfa7e('0x20')]=function(_0x5b6a2e){RpcVoiceTransferReport[_0xfa7e('0x20')](_0x5b6a2e);};module[_0xfa7e('0x56')]=Report; \ No newline at end of file diff --git a/server/services/ami/report/userReport.js b/server/services/ami/report/userReport.js index f2b1153..f2e059d 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 _0x9332=['indexOf','phone','accountcode','syncPeerStatus','peer','registered','status','address','exports','lodash','moment','bluebird','ioredis','../../../config/environment','../../../config/logger','redis','defaults','socket.io-emitter','agents','telephones','registryentry','bind','registry','devicestatechange','syncDeviceState','peerstatus','loopSyncRealTimeShow','then','actionSipShowRegistry','actionSipPeerStatus','catch','[loopSyncRealTimeShow]','error','inspect','prototype','resolve','emit','syncRegistry','find','stateRegistry','state','merge','omit','event','actionid','username','trunk:%s','name','trunk:save','[syncRegistry][UserReport]','isNotNull','device','local','toLowerCase','stateTime','toNumber','format','updateStatusRealtime','telephone:%s','telephone:save','trunks','startsWith','Local','substring'];(function(_0x13ba52,_0x102381){var _0x4918c2=function(_0x1bd1f7){while(--_0x1bd1f7){_0x13ba52['push'](_0x13ba52['shift']());}};_0x4918c2(++_0x102381);}(_0x9332,0x1c9));var _0x2933=function(_0x42c20c,_0x31c57d){_0x42c20c=_0x42c20c-0x0;var _0x3d9b1e=_0x9332[_0x42c20c];return _0x3d9b1e;};'use strict';var _=require(_0x2933('0x0'));var moment=require(_0x2933('0x1'));var BPromise=require(_0x2933('0x2'));var util=require('util');var Redis=require(_0x2933('0x3'));var config=require(_0x2933('0x4'));var logger=require(_0x2933('0x5'))('ami');var ami=require('../ami');config[_0x2933('0x6')]=_[_0x2933('0x7')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x2933('0x8'))(new Redis(config[_0x2933('0x6')]));function UserReport(_0x4fea4b){this['trunks']=_0x4fea4b['trunks'];this['agents']=_0x4fea4b[_0x2933('0x9')];this[_0x2933('0xa')]=_0x4fea4b[_0x2933('0xa')];ami['on'](_0x2933('0xb'),this['syncRegistry'][_0x2933('0xc')](this));ami['on'](_0x2933('0xd'),this['syncRegistry'][_0x2933('0xc')](this));ami['on'](_0x2933('0xe'),this[_0x2933('0xf')][_0x2933('0xc')](this));ami['on'](_0x2933('0x10'),this['syncPeerStatus'][_0x2933('0xc')](this));this[_0x2933('0x11')]();return BPromise['resolve']()[_0x2933('0x12')](ami[_0x2933('0x13')]())['then'](ami['actionDeviceStateList']())[_0x2933('0x12')](ami[_0x2933('0x14')]())[_0x2933('0x15')](loggerCatch(_0x2933('0x16')));}function loggerCatch(_0x868d92){return function(_0x53337b){logger[_0x2933('0x17')](_0x868d92,util[_0x2933('0x18')](_0x53337b,{'showHidden':![],'depth':null}));};}UserReport[_0x2933('0x19')][_0x2933('0x11')]=function(){setInterval(function(){BPromise[_0x2933('0x1a')]()['then'](ami[_0x2933('0x13')]())[_0x2933('0x12')](ami['actionDeviceStateList']())[_0x2933('0x12')](ami[_0x2933('0x14')]())[_0x2933('0x15')](loggerCatch(_0x2933('0x16')));},0x32c8);};UserReport[_0x2933('0x19')]['isNotNull']=function(_0x153544){return _0x153544!==null&&!_['isUndefined'](_0x153544);};UserReport[_0x2933('0x19')][_0x2933('0x1b')]=function(_0x410b86,_0x2312af,_0x5c3565){io['to'](_0x410b86)[_0x2933('0x1b')](_0x2312af,_0x5c3565);};UserReport[_0x2933('0x19')][_0x2933('0x1c')]=function(_0x208596){try{if(this['isNotNull'](_0x208596)){var _0x276361=_[_0x2933('0x1d')](this['trunks'],{'registry':_0x208596['username']});if(_0x276361){_0x208596[_0x2933('0x1e')]=_0x208596[_0x2933('0x1f')];_[_0x2933('0x20')](_0x276361,_[_0x2933('0x21')](_0x208596,[_0x2933('0x22'),_0x2933('0x23'),_0x2933('0x24'),_0x2933('0x1f')]));this[_0x2933('0x1b')](util['format'](_0x2933('0x25'),_0x276361[_0x2933('0x26')]),_0x2933('0x27'),_0x276361);}}}catch(_0x386616){logger[_0x2933('0x17')](_0x2933('0x28'),util[_0x2933('0x18')](_0x386616,{'showHidden':![],'depth':null}));}};UserReport[_0x2933('0x19')]['syncDeviceState']=function(_0x2e81cf){try{if(this[_0x2933('0x29')](_0x2e81cf)){if(this[_0x2933('0x9')][_0x2e81cf['device']]){if(!this['agents'][_0x2e81cf[_0x2933('0x2a')]][_0x2933('0x2b')]||_0x2e81cf['state'][_0x2933('0x2c')]()=='inuse'){this[_0x2933('0x9')][_0x2e81cf[_0x2933('0x2a')]]['local']=![];if(this['agents'][_0x2e81cf[_0x2933('0x2a')]][_0x2933('0x1f')]!==_0x2e81cf['state'][_0x2933('0x2c')]()){this[_0x2933('0x9')][_0x2e81cf['device']][_0x2933('0x2d')]=_[_0x2933('0x2e')](moment()[_0x2933('0x2f')]('x'));}this[_0x2933('0x9')][_0x2e81cf[_0x2933('0x2a')]][_0x2933('0x1f')]=_0x2e81cf['state'][_0x2933('0x2c')]();this['agents'][_0x2e81cf[_0x2933('0x2a')]][_0x2933('0x30')](_0x2e81cf);}}else if(this[_0x2933('0xa')][_0x2e81cf[_0x2933('0x2a')]]){if(this['telephones'][_0x2e81cf[_0x2933('0x2a')]]['state']!==_0x2e81cf[_0x2933('0x1f')]['toLowerCase']()){this['telephones'][_0x2e81cf[_0x2933('0x2a')]][_0x2933('0x2d')]=_['toNumber'](moment()[_0x2933('0x2f')]('x'));}this[_0x2933('0xa')][_0x2e81cf[_0x2933('0x2a')]]['state']=_0x2e81cf[_0x2933('0x1f')]['toLowerCase']();this['emit'](util['format'](_0x2933('0x31'),this['telephones'][_0x2e81cf['device']][_0x2933('0x26')]),_0x2933('0x32'),this[_0x2933('0xa')][_0x2e81cf[_0x2933('0x2a')]]);}else if(this[_0x2933('0x33')][_0x2e81cf[_0x2933('0x2a')]]){if(this['trunks'][_0x2e81cf[_0x2933('0x2a')]][_0x2933('0x1f')]!==_0x2e81cf[_0x2933('0x1f')][_0x2933('0x2c')]()){this[_0x2933('0x33')][_0x2e81cf[_0x2933('0x2a')]][_0x2933('0x2d')]=_[_0x2933('0x2e')](moment()[_0x2933('0x2f')]('x'));}this['trunks'][_0x2e81cf[_0x2933('0x2a')]][_0x2933('0x1f')]=_0x2e81cf['state'][_0x2933('0x2c')]();this[_0x2933('0x1b')](util['format'](_0x2933('0x25'),this[_0x2933('0x33')][_0x2e81cf[_0x2933('0x2a')]][_0x2933('0x26')]),_0x2933('0x27'),this[_0x2933('0x33')][_0x2e81cf['device']]);}else if(_[_0x2933('0x34')](_0x2e81cf['device'],'Queue')){}else if(_[_0x2933('0x34')](_0x2e81cf['device'],_0x2933('0x35'))){var _0x4aa17e=_0x2e81cf[_0x2933('0x2a')];var _0x33a7c0=_0x4aa17e[_0x2933('0x36')](_0x4aa17e[_0x2933('0x37')]('/')+0x1,_0x4aa17e[_0x2933('0x37')]('@'));var _0x4086bf=_[_0x2933('0x1d')](this[_0x2933('0x9')],function(_0x52e8b7){return _0x52e8b7['mobile']==_0x33a7c0||_0x52e8b7[_0x2933('0x38')]==_0x33a7c0||_0x52e8b7[_0x2933('0x39')]==_0x33a7c0;});if(_0x4086bf){if(_0x4086bf[_0x2933('0x1f')]!==_0x2e81cf[_0x2933('0x1f')][_0x2933('0x2c')]()){_0x4086bf[_0x2933('0x2d')]=_[_0x2933('0x2e')](moment()[_0x2933('0x2f')]('x'));}_0x4086bf['state']=_0x2e81cf['state'][_0x2933('0x2c')]();_0x4086bf['local']=!![];_0x4086bf['updateStatusRealtime'](_0x2e81cf);}}else{}}}catch(_0x3ba484){logger[_0x2933('0x17')]('[syncDeviceState][UserReport]',util['inspect'](_0x3ba484,{'showHidden':![],'depth':null}));}};UserReport[_0x2933('0x19')][_0x2933('0x3a')]=function(_0x4793e2){try{if(this[_0x2933('0x29')](_0x4793e2)&&this[_0x2933('0x29')](_0x4793e2[_0x2933('0x10')])){if(this[_0x2933('0x9')][_0x4793e2[_0x2933('0x3b')]]){if(!this[_0x2933('0x9')][_0x4793e2[_0x2933('0x3b')]][_0x2933('0x2b')]||_0x4793e2[_0x2933('0x10')]['toLowerCase']()==_0x2933('0x3c')){this[_0x2933('0x9')][_0x4793e2[_0x2933('0x3b')]][_0x2933('0x2b')]=![];this[_0x2933('0x9')][_0x4793e2[_0x2933('0x3b')]][_0x2933('0x3d')]=_0x4793e2[_0x2933('0x10')]['toLowerCase']();this[_0x2933('0x9')][_0x4793e2[_0x2933('0x3b')]][_0x2933('0x3e')]=_0x4793e2[_0x2933('0x3e')];this['agents'][_0x4793e2[_0x2933('0x3b')]]['updateStatusRealtime'](_0x4793e2);}}else if(this[_0x2933('0xa')][_0x4793e2[_0x2933('0x3b')]]){this[_0x2933('0xa')][_0x4793e2[_0x2933('0x3b')]]['status']=_0x4793e2[_0x2933('0x10')][_0x2933('0x2c')]();this[_0x2933('0xa')][_0x4793e2[_0x2933('0x3b')]]['address']=_0x4793e2[_0x2933('0x3e')];this[_0x2933('0x1b')](util[_0x2933('0x2f')](_0x2933('0x31'),this[_0x2933('0xa')][_0x4793e2[_0x2933('0x3b')]][_0x2933('0x26')]),_0x2933('0x32'),this[_0x2933('0xa')][_0x4793e2['peer']]);}else if(this[_0x2933('0x33')][_0x4793e2[_0x2933('0x3b')]]){this[_0x2933('0x33')][_0x4793e2[_0x2933('0x3b')]][_0x2933('0x3d')]=_0x4793e2[_0x2933('0x10')][_0x2933('0x2c')]();this[_0x2933('0x33')][_0x4793e2[_0x2933('0x3b')]]['address']=_0x4793e2[_0x2933('0x3e')];this[_0x2933('0x1b')](util['format'](_0x2933('0x25'),this[_0x2933('0x33')][_0x4793e2[_0x2933('0x3b')]][_0x2933('0x26')]),'trunk:save',this[_0x2933('0x33')][_0x4793e2[_0x2933('0x3b')]]);}else{}}}catch(_0x3b21cd){logger[_0x2933('0x17')]('[syncPeerStatus][UserReport]',util[_0x2933('0x18')](_0x3b21cd,{'showHidden':![],'depth':null}));}};module[_0x2933('0x3f')]=UserReport; \ No newline at end of file +var _0xa016=['registry','syncDeviceState','peerstatus','loopSyncRealTimeShow','resolve','actionSipShowRegistry','then','actionDeviceStateList','actionSipPeerStatus','catch','inspect','prototype','[loopSyncRealTimeShow]','isNotNull','isUndefined','emit','find','stateRegistry','state','omit','actionid','username','format','trunk:%s','name','trunk:save','error','[syncRegistry][UserReport]','device','local','toLowerCase','inuse','stateTime','toNumber','updateStatusRealtime','startsWith','Queue','Local','substring','indexOf','mobile','phone','accountcode','syncPeerStatus','registered','peer','status','address','telephone:%s','telephone:save','[syncPeerStatus][UserReport]','exports','lodash','moment','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','localhost','trunks','agents','telephones','syncRegistry','bind'];(function(_0x38a337,_0x100d1e){var _0x3b0fab=function(_0x5dbec0){while(--_0x5dbec0){_0x38a337['push'](_0x38a337['shift']());}};_0x3b0fab(++_0x100d1e);}(_0xa016,0x78));var _0x6a01=function(_0x614bf,_0x265451){_0x614bf=_0x614bf-0x0;var _0x2b7360=_0xa016[_0x614bf];return _0x2b7360;};'use strict';var _=require(_0x6a01('0x0'));var moment=require(_0x6a01('0x1'));var BPromise=require('bluebird');var util=require(_0x6a01('0x2'));var Redis=require(_0x6a01('0x3'));var config=require(_0x6a01('0x4'));var logger=require(_0x6a01('0x5'))(_0x6a01('0x6'));var ami=require(_0x6a01('0x7'));config[_0x6a01('0x8')]=_[_0x6a01('0x9')](config[_0x6a01('0x8')],{'host':_0x6a01('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x6a01('0x8')]));function UserReport(_0x47c531){this['trunks']=_0x47c531[_0x6a01('0xb')];this['agents']=_0x47c531[_0x6a01('0xc')];this[_0x6a01('0xd')]=_0x47c531[_0x6a01('0xd')];ami['on']('registryentry',this[_0x6a01('0xe')][_0x6a01('0xf')](this));ami['on'](_0x6a01('0x10'),this[_0x6a01('0xe')]['bind'](this));ami['on']('devicestatechange',this[_0x6a01('0x11')][_0x6a01('0xf')](this));ami['on'](_0x6a01('0x12'),this['syncPeerStatus'][_0x6a01('0xf')](this));this[_0x6a01('0x13')]();return BPromise[_0x6a01('0x14')]()['then'](ami[_0x6a01('0x15')]())[_0x6a01('0x16')](ami[_0x6a01('0x17')]())[_0x6a01('0x16')](ami[_0x6a01('0x18')]())[_0x6a01('0x19')](loggerCatch('[loopSyncRealTimeShow]'));}function loggerCatch(_0x5b61a1){return function(_0x1b73f4){logger['error'](_0x5b61a1,util[_0x6a01('0x1a')](_0x1b73f4,{'showHidden':![],'depth':null}));};}UserReport[_0x6a01('0x1b')][_0x6a01('0x13')]=function(){setInterval(function(){BPromise['resolve']()[_0x6a01('0x16')](ami[_0x6a01('0x15')]())[_0x6a01('0x16')](ami[_0x6a01('0x17')]())[_0x6a01('0x16')](ami['actionSipPeerStatus']())['catch'](loggerCatch(_0x6a01('0x1c')));},0x32c8);};UserReport[_0x6a01('0x1b')][_0x6a01('0x1d')]=function(_0x4686a8){return _0x4686a8!==null&&!_[_0x6a01('0x1e')](_0x4686a8);};UserReport['prototype'][_0x6a01('0x1f')]=function(_0x210fe9,_0x372d83,_0x11f655){io['to'](_0x210fe9)[_0x6a01('0x1f')](_0x372d83,_0x11f655);};UserReport[_0x6a01('0x1b')][_0x6a01('0xe')]=function(_0x5e6323){try{if(this['isNotNull'](_0x5e6323)){var _0x2db116=_[_0x6a01('0x20')](this[_0x6a01('0xb')],{'registry':_0x5e6323['username']});if(_0x2db116){_0x5e6323[_0x6a01('0x21')]=_0x5e6323[_0x6a01('0x22')];_['merge'](_0x2db116,_[_0x6a01('0x23')](_0x5e6323,['event',_0x6a01('0x24'),_0x6a01('0x25'),'state']));this['emit'](util[_0x6a01('0x26')](_0x6a01('0x27'),_0x2db116[_0x6a01('0x28')]),_0x6a01('0x29'),_0x2db116);}}}catch(_0x2c8b28){logger[_0x6a01('0x2a')](_0x6a01('0x2b'),util[_0x6a01('0x1a')](_0x2c8b28,{'showHidden':![],'depth':null}));}};UserReport[_0x6a01('0x1b')][_0x6a01('0x11')]=function(_0x5525c5){try{if(this[_0x6a01('0x1d')](_0x5525c5)){if(this[_0x6a01('0xc')][_0x5525c5[_0x6a01('0x2c')]]){if(!this[_0x6a01('0xc')][_0x5525c5[_0x6a01('0x2c')]][_0x6a01('0x2d')]||_0x5525c5[_0x6a01('0x22')][_0x6a01('0x2e')]()==_0x6a01('0x2f')){this[_0x6a01('0xc')][_0x5525c5[_0x6a01('0x2c')]]['local']=![];if(this['agents'][_0x5525c5['device']][_0x6a01('0x22')]!==_0x5525c5['state'][_0x6a01('0x2e')]()){this[_0x6a01('0xc')][_0x5525c5[_0x6a01('0x2c')]][_0x6a01('0x30')]=_[_0x6a01('0x31')](moment()[_0x6a01('0x26')]('x'));}this[_0x6a01('0xc')][_0x5525c5[_0x6a01('0x2c')]][_0x6a01('0x22')]=_0x5525c5[_0x6a01('0x22')][_0x6a01('0x2e')]();this[_0x6a01('0xc')][_0x5525c5[_0x6a01('0x2c')]][_0x6a01('0x32')](_0x5525c5);}}else if(this['telephones'][_0x5525c5['device']]){if(this['telephones'][_0x5525c5['device']][_0x6a01('0x22')]!==_0x5525c5['state']['toLowerCase']()){this[_0x6a01('0xd')][_0x5525c5[_0x6a01('0x2c')]][_0x6a01('0x30')]=_['toNumber'](moment()[_0x6a01('0x26')]('x'));}this[_0x6a01('0xd')][_0x5525c5[_0x6a01('0x2c')]]['state']=_0x5525c5[_0x6a01('0x22')][_0x6a01('0x2e')]();this[_0x6a01('0x1f')](util[_0x6a01('0x26')]('telephone:%s',this[_0x6a01('0xd')][_0x5525c5['device']][_0x6a01('0x28')]),'telephone:save',this[_0x6a01('0xd')][_0x5525c5['device']]);}else if(this[_0x6a01('0xb')][_0x5525c5['device']]){if(this['trunks'][_0x5525c5[_0x6a01('0x2c')]][_0x6a01('0x22')]!==_0x5525c5[_0x6a01('0x22')]['toLowerCase']()){this[_0x6a01('0xb')][_0x5525c5[_0x6a01('0x2c')]][_0x6a01('0x30')]=_[_0x6a01('0x31')](moment()[_0x6a01('0x26')]('x'));}this[_0x6a01('0xb')][_0x5525c5['device']][_0x6a01('0x22')]=_0x5525c5[_0x6a01('0x22')]['toLowerCase']();this[_0x6a01('0x1f')](util['format']('trunk:%s',this['trunks'][_0x5525c5[_0x6a01('0x2c')]]['name']),'trunk:save',this[_0x6a01('0xb')][_0x5525c5[_0x6a01('0x2c')]]);}else if(_[_0x6a01('0x33')](_0x5525c5[_0x6a01('0x2c')],_0x6a01('0x34'))){}else if(_['startsWith'](_0x5525c5[_0x6a01('0x2c')],_0x6a01('0x35'))){var _0x4d9d89=_0x5525c5[_0x6a01('0x2c')];var _0x453a6e=_0x4d9d89[_0x6a01('0x36')](_0x4d9d89[_0x6a01('0x37')]('/')+0x1,_0x4d9d89[_0x6a01('0x37')]('@'));var _0x1d23f4=_[_0x6a01('0x20')](this[_0x6a01('0xc')],function(_0x8a81){return _0x8a81[_0x6a01('0x38')]==_0x453a6e||_0x8a81[_0x6a01('0x39')]==_0x453a6e||_0x8a81[_0x6a01('0x3a')]==_0x453a6e;});if(_0x1d23f4){if(_0x1d23f4[_0x6a01('0x22')]!==_0x5525c5[_0x6a01('0x22')][_0x6a01('0x2e')]()){_0x1d23f4[_0x6a01('0x30')]=_[_0x6a01('0x31')](moment()[_0x6a01('0x26')]('x'));}_0x1d23f4['state']=_0x5525c5[_0x6a01('0x22')][_0x6a01('0x2e')]();_0x1d23f4['local']=!![];_0x1d23f4[_0x6a01('0x32')](_0x5525c5);}}else{}}}catch(_0x7c73ca){logger[_0x6a01('0x2a')]('[syncDeviceState][UserReport]',util[_0x6a01('0x1a')](_0x7c73ca,{'showHidden':![],'depth':null}));}};UserReport[_0x6a01('0x1b')][_0x6a01('0x3b')]=function(_0x1b712f){try{if(this[_0x6a01('0x1d')](_0x1b712f)&&this[_0x6a01('0x1d')](_0x1b712f[_0x6a01('0x12')])){if(this['agents'][_0x1b712f['peer']]){if(!this['agents'][_0x1b712f['peer']][_0x6a01('0x2d')]||_0x1b712f[_0x6a01('0x12')][_0x6a01('0x2e')]()==_0x6a01('0x3c')){this[_0x6a01('0xc')][_0x1b712f[_0x6a01('0x3d')]][_0x6a01('0x2d')]=![];this[_0x6a01('0xc')][_0x1b712f[_0x6a01('0x3d')]][_0x6a01('0x3e')]=_0x1b712f[_0x6a01('0x12')][_0x6a01('0x2e')]();this[_0x6a01('0xc')][_0x1b712f['peer']][_0x6a01('0x3f')]=_0x1b712f['address'];this[_0x6a01('0xc')][_0x1b712f['peer']]['updateStatusRealtime'](_0x1b712f);}}else if(this['telephones'][_0x1b712f[_0x6a01('0x3d')]]){this[_0x6a01('0xd')][_0x1b712f[_0x6a01('0x3d')]][_0x6a01('0x3e')]=_0x1b712f[_0x6a01('0x12')]['toLowerCase']();this[_0x6a01('0xd')][_0x1b712f[_0x6a01('0x3d')]][_0x6a01('0x3f')]=_0x1b712f[_0x6a01('0x3f')];this[_0x6a01('0x1f')](util[_0x6a01('0x26')](_0x6a01('0x40'),this[_0x6a01('0xd')][_0x1b712f[_0x6a01('0x3d')]][_0x6a01('0x28')]),_0x6a01('0x41'),this['telephones'][_0x1b712f[_0x6a01('0x3d')]]);}else if(this['trunks'][_0x1b712f['peer']]){this[_0x6a01('0xb')][_0x1b712f[_0x6a01('0x3d')]][_0x6a01('0x3e')]=_0x1b712f[_0x6a01('0x12')][_0x6a01('0x2e')]();this[_0x6a01('0xb')][_0x1b712f[_0x6a01('0x3d')]][_0x6a01('0x3f')]=_0x1b712f[_0x6a01('0x3f')];this[_0x6a01('0x1f')](util['format'](_0x6a01('0x27'),this[_0x6a01('0xb')][_0x1b712f['peer']][_0x6a01('0x28')]),_0x6a01('0x29'),this['trunks'][_0x1b712f['peer']]);}else{}}}catch(_0x153ec2){logger[_0x6a01('0x2a')](_0x6a01('0x42'),util[_0x6a01('0x1a')](_0x153ec2,{'showHidden':![],'depth':null}));}};module[_0x6a01('0x43')]=UserReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceAgentReport.js b/server/services/ami/report/voiceAgentReport.js index 99b5ff9..3228442 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 _0x636e=['seconds','secondtransfereruniqueid','[syncAttendedTransfer][VoiceAgentReport]','transfereruniqueid','[syncBlindTransfer][VoiceAgentReport]','channel','lastIndexOf','[syncMusicOnHoldStart][VoiceAgentReport]','exports','lodash','moment','ioredis','ami','../ami','redis','defaults','socket.io-emitter','channels','voiceQueues','agents','variables','agentcalled','syncAgentCalled','agentconnect','syncAgentConnect','bind','agentringnoanswer','syncQueueCallerAbandon','syncAgentComplete','syncVarSet','hangup','syncHangup','musiconholdstart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','prototype','emit','isUndefined','uniqueid','destuniqueid','format','YYYY-MM-DD\x20HH:mm:ss','called','queue','type','inbound','merge','event','privilege','custom:agentcalled','membername','user:called','error','[syncAgentCalled][VoiceAgentReport]','inspect','isNotNull','hasOwnProperty','agentconnectAt','lastevent','connect','holdtime','connectedlinenum','connectedlinename','destchannelstate','destchannelstatedesc','interface','pick','destconnectedlinenum','user:agentconnect','custom:agentconnect','agentcomplete','agentringnoanswerAt','reason','answered_elsewhere','answeredelsewheremembername','[syncAgentConnect][VoiceAgentReport]','syncAgentRingNoAnswer','rejected','custom:agentringnoanswer','[syncAgentRingNoAnswer][VoiceAgentReport]','abandoned','custom:agentqueuecallerabandon','[syncQueueCallerAbandon][VoiceAgentReport]','agentcompleteAt','complete','talktime','transfer','acw','agentacw','acwtime','acwTimeout','omit','user:agentcomplete','custom:agentcomplete','[syncAgentComplete][VoiceAgentReport]','addVariable','variable','[syncVarSet][VoiceAgentReport]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqoslossbridged','rtpaudioqosrtt','sipuri','bridgepeer','membercalls','memberdynamic','memberlastcall','memberpenalty','isNil','custom:voiceAgentReport','[syncHangup][VoiceAgentReport]','transfereeuniqueid','diff'];(function(_0x167ef5,_0x392519){var _0x19e646=function(_0x49abd0){while(--_0x49abd0){_0x167ef5['push'](_0x167ef5['shift']());}};_0x19e646(++_0x392519);}(_0x636e,0x16b));var _0xe636=function(_0xc4e0c4,_0x5288f4){_0xc4e0c4=_0xc4e0c4-0x0;var _0x5ee9bc=_0x636e[_0xc4e0c4];return _0x5ee9bc;};'use strict';var _=require(_0xe636('0x0'));var moment=require(_0xe636('0x1'));var util=require('util');var Redis=require(_0xe636('0x2'));var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0xe636('0x3'));var ami=require(_0xe636('0x4'));config[_0xe636('0x5')]=_[_0xe636('0x6')](config[_0xe636('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0xe636('0x7'))(new Redis(config['redis']));function VoiceAgentReport(_0x2dfcf8){this[_0xe636('0x8')]={};this[_0xe636('0x9')]=_0x2dfcf8[_0xe636('0x9')];this[_0xe636('0xa')]=_0x2dfcf8[_0xe636('0xa')];this[_0xe636('0xb')]={};ami['on'](_0xe636('0xc'),this[_0xe636('0xd')]['bind'](this));ami['on'](_0xe636('0xe'),this[_0xe636('0xf')][_0xe636('0x10')](this));ami['on'](_0xe636('0x11'),this['syncAgentRingNoAnswer']['bind'](this));ami['on']('queuecallerabandon',this[_0xe636('0x12')][_0xe636('0x10')](this));ami['on']('agentcomplete',this[_0xe636('0x13')][_0xe636('0x10')](this));ami['on']('varset',this[_0xe636('0x14')][_0xe636('0x10')](this));ami['on'](_0xe636('0x15'),this[_0xe636('0x16')][_0xe636('0x10')](this));ami['on'](_0xe636('0x17'),this['syncMusicOnHoldStart'][_0xe636('0x10')](this));ami['on'](_0xe636('0x18'),this[_0xe636('0x19')][_0xe636('0x10')](this));ami['on'](_0xe636('0x1a'),this[_0xe636('0x1b')][_0xe636('0x10')](this));ami['on'](_0xe636('0x1c'),this[_0xe636('0x1d')]['bind'](this));}VoiceAgentReport[_0xe636('0x1e')][_0xe636('0x1f')]=function(_0x191f98,_0x8184cc,_0x201ffb){io['to'](_0x191f98)[_0xe636('0x1f')](_0x8184cc,_0x201ffb);};VoiceAgentReport[_0xe636('0x1e')]['isNotNull']=function(_0x1d9d58){return _0x1d9d58!==null&&!_[_0xe636('0x20')](_0x1d9d58);};VoiceAgentReport[_0xe636('0x1e')][_0xe636('0xd')]=function(_0x3e8b29){try{if(this['isNotNull'](_0x3e8b29)){if(_['isUndefined'](this['channels'][_0x3e8b29[_0xe636('0x21')]])){this[_0xe636('0x8')][_0x3e8b29['uniqueid']]={};}if(_[_0xe636('0x20')](this[_0xe636('0x8')][_0x3e8b29[_0xe636('0x21')]][_0x3e8b29['destuniqueid']])){this['channels'][_0x3e8b29[_0xe636('0x21')]][_0x3e8b29[_0xe636('0x22')]]={'agentcalledAt':moment()[_0xe636('0x23')](_0xe636('0x24')),'lastevent':_0xe636('0x25'),'variables':this[_0xe636('0xb')][_0x3e8b29['uniqueid']],'type':this[_0xe636('0x9')][_0x3e8b29[_0xe636('0x26')]]?this[_0xe636('0x9')][_0x3e8b29[_0xe636('0x26')]][_0xe636('0x27')]||_0xe636('0x28'):'inbound'};}_[_0xe636('0x29')](this[_0xe636('0x8')][_0x3e8b29['uniqueid']][_0x3e8b29[_0xe636('0x22')]],_['omit'](_0x3e8b29,[_0xe636('0x2a'),_0xe636('0x2b')]));ami[_0xe636('0x1f')](_0xe636('0x2c'),this[_0xe636('0x8')][_0x3e8b29[_0xe636('0x21')]][_0x3e8b29[_0xe636('0x22')]]);this[_0xe636('0x1f')](util['format']('user:%s',_0x3e8b29[_0xe636('0x2d')]),_0xe636('0x2e'),this['channels'][_0x3e8b29[_0xe636('0x21')]][_0x3e8b29['destuniqueid']]);}}catch(_0x568951){logger[_0xe636('0x2f')](_0xe636('0x30'),util[_0xe636('0x31')](_0x568951,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncAgentConnect']=function(_0x2b387b){try{if(this[_0xe636('0x32')](_0x2b387b)){if(this[_0xe636('0x8')][_0x2b387b['uniqueid']]){for(var _0x1ba4f4 in this[_0xe636('0x8')][_0x2b387b[_0xe636('0x21')]]){if(this[_0xe636('0x8')][_0x2b387b[_0xe636('0x21')]][_0xe636('0x33')](_0x1ba4f4)){if(_0x2b387b[_0xe636('0x22')]===_0x1ba4f4){this[_0xe636('0x8')][_0x2b387b[_0xe636('0x21')]][_0x1ba4f4][_0xe636('0x34')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0xe636('0x8')][_0x2b387b['uniqueid']][_0x1ba4f4][_0xe636('0x35')]=_0xe636('0x36');this['channels'][_0x2b387b[_0xe636('0x21')]][_0x1ba4f4][_0xe636('0x37')]=_0x2b387b['holdtime'];this[_0xe636('0x8')][_0x2b387b[_0xe636('0x21')]][_0x1ba4f4][_0xe636('0x38')]=_0x2b387b[_0xe636('0x38')];this[_0xe636('0x8')][_0x2b387b['uniqueid']][_0x1ba4f4][_0xe636('0x39')]=_0x2b387b[_0xe636('0x39')];this[_0xe636('0x8')][_0x2b387b[_0xe636('0x21')]][_0x1ba4f4]['destchannelstate']=_0x2b387b[_0xe636('0x3a')];this[_0xe636('0x8')][_0x2b387b[_0xe636('0x21')]][_0x1ba4f4][_0xe636('0x3b')]=_0x2b387b[_0xe636('0x3b')];_[_0xe636('0x29')](this[_0xe636('0xa')][_0x2b387b[_0xe636('0x3c')]],_[_0xe636('0x3d')](_0x2b387b,[_0xe636('0x26'),_0xe636('0x3e')]));this[_0xe636('0x1f')](util[_0xe636('0x23')]('user:%s',_0x2b387b[_0xe636('0x2d')]),_0xe636('0x3f'),this[_0xe636('0x8')][_0x2b387b[_0xe636('0x21')]][_0x2b387b[_0xe636('0x22')]]);ami[_0xe636('0x1f')](_0xe636('0x40'),this['channels'][_0x2b387b['uniqueid']][_0x1ba4f4]);}else if(!this[_0xe636('0x8')][_0x2b387b['uniqueid']][_0x1ba4f4][_0xe636('0x11')]&&!this[_0xe636('0x8')][_0x2b387b[_0xe636('0x21')]][_0x1ba4f4][_0xe636('0x41')]){this['channels'][_0x2b387b[_0xe636('0x21')]][_0x1ba4f4][_0xe636('0x11')]=!![];this[_0xe636('0x8')][_0x2b387b['uniqueid']][_0x1ba4f4][_0xe636('0x42')]=moment()[_0xe636('0x23')](_0xe636('0x24'));this['channels'][_0x2b387b[_0xe636('0x21')]][_0x1ba4f4][_0xe636('0x43')]='answered_elsewhere';this[_0xe636('0x8')][_0x2b387b[_0xe636('0x21')]][_0x1ba4f4][_0xe636('0x35')]=_0xe636('0x44');this[_0xe636('0x8')][_0x2b387b[_0xe636('0x21')]][_0x1ba4f4]['answeredelsewheredestinationuniqueid']=_0x2b387b['destuniqueid'];this[_0xe636('0x8')][_0x2b387b['uniqueid']][_0x1ba4f4][_0xe636('0x45')]=_0x2b387b[_0xe636('0x2d')];ami[_0xe636('0x1f')]('custom:agentansweredelsewhere',this['channels'][_0x2b387b['uniqueid']][_0x1ba4f4]);}}}}}}catch(_0x3928c4){logger[_0xe636('0x2f')](_0xe636('0x46'),util[_0xe636('0x31')](_0x3928c4,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xe636('0x47')]=function(_0x246017){try{if(this['isNotNull'](_0x246017)){if(this[_0xe636('0x8')][_0x246017[_0xe636('0x21')]]&&this[_0xe636('0x8')][_0x246017[_0xe636('0x21')]][_0x246017['destuniqueid']]){this[_0xe636('0x8')][_0x246017['uniqueid']][_0x246017[_0xe636('0x22')]][_0xe636('0x11')]=!![];this[_0xe636('0x8')][_0x246017[_0xe636('0x21')]][_0x246017['destuniqueid']][_0xe636('0x42')]=moment()[_0xe636('0x23')](_0xe636('0x24'));this['channels'][_0x246017[_0xe636('0x21')]][_0x246017[_0xe636('0x22')]][_0xe636('0x43')]=_0xe636('0x48');this['channels'][_0x246017[_0xe636('0x21')]][_0x246017['destuniqueid']][_0xe636('0x35')]=_0xe636('0x48');ami[_0xe636('0x1f')](_0xe636('0x49'),this[_0xe636('0x8')][_0x246017[_0xe636('0x21')]][_0x246017[_0xe636('0x22')]]);}}}catch(_0x60012d){logger[_0xe636('0x2f')](_0xe636('0x4a'),util[_0xe636('0x31')](_0x60012d,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xe636('0x1e')]['syncQueueCallerAbandon']=function(_0x4f44ae){try{if(this[_0xe636('0x32')](_0x4f44ae)){if(this[_0xe636('0x8')][_0x4f44ae[_0xe636('0x21')]]){for(var _0x239bfe in this['channels'][_0x4f44ae[_0xe636('0x21')]]){if(this[_0xe636('0x8')][_0x4f44ae['uniqueid']][_0xe636('0x33')](_0x239bfe)&&!this['channels'][_0x4f44ae[_0xe636('0x21')]][_0x239bfe][_0xe636('0x11')]&&!this[_0xe636('0x8')][_0x4f44ae[_0xe636('0x21')]][_0x239bfe][_0xe636('0x41')]){this[_0xe636('0x8')][_0x4f44ae[_0xe636('0x21')]][_0x239bfe][_0xe636('0x11')]=!![];this['channels'][_0x4f44ae['uniqueid']][_0x239bfe][_0xe636('0x42')]=moment()[_0xe636('0x23')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xe636('0x8')][_0x4f44ae['uniqueid']][_0x239bfe][_0xe636('0x43')]=_0xe636('0x4b');this[_0xe636('0x8')][_0x4f44ae[_0xe636('0x21')]][_0x239bfe][_0xe636('0x35')]=_0xe636('0x4b');ami[_0xe636('0x1f')](_0xe636('0x4c'),this[_0xe636('0x8')][_0x4f44ae[_0xe636('0x21')]][_0x239bfe]);}}}}}catch(_0x463dde){logger[_0xe636('0x2f')](_0xe636('0x4d'),util[_0xe636('0x31')](_0x463dde,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xe636('0x13')]=function(_0x2192d9){try{if(this[_0xe636('0x32')](_0x2192d9)){if(this[_0xe636('0x8')][_0x2192d9['uniqueid']]){for(var _0x293feb in this['channels'][_0x2192d9['uniqueid']]){if(this[_0xe636('0x8')][_0x2192d9[_0xe636('0x21')]][_0xe636('0x33')](_0x293feb)){if(this['channels'][_0x2192d9[_0xe636('0x21')]][_0x293feb][_0xe636('0x34')]&&!this[_0xe636('0x8')][_0x2192d9[_0xe636('0x21')]][_0x293feb]['agentcomplete']){this['channels'][_0x2192d9['uniqueid']][_0x293feb]['agentcomplete']=!![];this[_0xe636('0x8')][_0x2192d9[_0xe636('0x21')]][_0x293feb][_0xe636('0x4e')]=moment()[_0xe636('0x23')](_0xe636('0x24'));this[_0xe636('0x8')][_0x2192d9[_0xe636('0x21')]][_0x293feb][_0xe636('0x35')]=_0xe636('0x4f');this[_0xe636('0x8')][_0x2192d9[_0xe636('0x21')]][_0x293feb][_0xe636('0x50')]=_0x2192d9[_0xe636('0x50')];this[_0xe636('0x8')][_0x2192d9[_0xe636('0x21')]][_0x293feb][_0xe636('0x43')]=_0x2192d9[_0xe636('0x43')]==_0xe636('0x51')?'agent':_0x2192d9['reason'];if(this[_0xe636('0x9')][_0x2192d9[_0xe636('0x26')]]&&this['voiceQueues'][_0x2192d9['queue']][_0xe636('0x52')]){this['channels'][_0x2192d9[_0xe636('0x21')]][_0x293feb][_0xe636('0x53')]=!![];this[_0xe636('0x8')][_0x2192d9[_0xe636('0x21')]][_0x293feb][_0xe636('0x54')]=this[_0xe636('0x9')][_0x2192d9[_0xe636('0x26')]][_0xe636('0x55')];}this['agents'][_0x2192d9['interface']]=_[_0xe636('0x56')](this[_0xe636('0xa')][_0x2192d9[_0xe636('0x3c')]],[_0xe636('0x26'),_0xe636('0x3e')]);this['emit'](util[_0xe636('0x23')]('user:%s',_0x2192d9[_0xe636('0x2d')]),_0xe636('0x57'),this[_0xe636('0x8')][_0x2192d9[_0xe636('0x21')]][_0x293feb]);ami[_0xe636('0x1f')](_0xe636('0x58'),this['channels'][_0x2192d9['uniqueid']][_0x293feb]);}}}}}}catch(_0x467585){logger[_0xe636('0x2f')](_0xe636('0x59'),util[_0xe636('0x31')](_0x467585,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xe636('0x1e')][_0xe636('0x14')]=function(_0x5da8a5){try{if(this['isNotNull'](_0x5da8a5)){this[_0xe636('0x5a')](_0x5da8a5[_0xe636('0x21')],_['keys'](_0x5da8a5[_0xe636('0x5b')])[0x0],_0x5da8a5['value']);if(this[_0xe636('0x8')][_0x5da8a5[_0xe636('0x21')]]){for(var _0x2200cc in this[_0xe636('0x8')][_0x5da8a5[_0xe636('0x21')]]){if(this[_0xe636('0x8')][_0x5da8a5['uniqueid']][_0xe636('0x33')](_0x2200cc)){if(_[_0xe636('0x20')](this[_0xe636('0x8')][_0x5da8a5[_0xe636('0x21')]][_0x2200cc][_0xe636('0xb')])){this[_0xe636('0x8')][_0x5da8a5['uniqueid']][_0x2200cc][_0xe636('0xb')]={};}this['channels'][_0x5da8a5[_0xe636('0x21')]][_0x2200cc]['variables']=this[_0xe636('0xb')][_0x5da8a5['uniqueid']];}}}}}catch(_0x185530){logger[_0xe636('0x2f')](_0xe636('0x5c'),util[_0xe636('0x31')](_0x185530,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xe636('0x1e')][_0xe636('0x5a')]=function(_0x45665a,_0x12c697,_0x113ed6){var _0x39ea00=[_0xe636('0x5d'),_0xe636('0x5e'),_0xe636('0x5f'),'rtpaudioqosjitterbridged','rtpaudioqosloss',_0xe636('0x60'),_0xe636('0x61'),'rtpaudioqosrttbridged','sipcallid',_0xe636('0x62'),_0xe636('0x63'),'bridgepvtcallid',_0xe636('0x64'),_0xe636('0x65'),'memberinterface',_0xe636('0x66'),_0xe636('0x2d'),_0xe636('0x67'),'memberrealtime'];if(!_[_0xe636('0x68')](_0x12c697)&&!_['includes'](_0x39ea00,_0x12c697)){if(_['isUndefined'](this[_0xe636('0xb')][_0x45665a])){this[_0xe636('0xb')][_0x45665a]={};}this[_0xe636('0xb')][_0x45665a][_0x12c697]=_0x113ed6;}};VoiceAgentReport[_0xe636('0x1e')][_0xe636('0x16')]=function(_0x3ca602){try{if(this[_0xe636('0x32')](_0x3ca602)){if(this[_0xe636('0x8')][_0x3ca602['uniqueid']]){for(var _0x429b6e in this[_0xe636('0x8')][_0x3ca602[_0xe636('0x21')]]){if(this[_0xe636('0x8')][_0x3ca602[_0xe636('0x21')]]['hasOwnProperty'](_0x429b6e)){if(this[_0xe636('0x8')][_0x3ca602[_0xe636('0x21')]][_0x429b6e][_0xe636('0x43')]==_0xe636('0x51')&&this[_0xe636('0x8')][_0x3ca602[_0xe636('0x21')]][_0x429b6e]['agentcomplete']){this[_0xe636('0x8')][_0x3ca602[_0xe636('0x21')]][_0x429b6e][_0xe636('0x4e')]=moment()[_0xe636('0x23')](_0xe636('0x24'));}}}ami['emit'](_0xe636('0x69'),_['values'](this['channels'][_0x3ca602[_0xe636('0x21')]]));delete this[_0xe636('0x8')][_0x3ca602[_0xe636('0x21')]];}if(this[_0xe636('0xb')][_0x3ca602[_0xe636('0x21')]]){delete this['variables'][_0x3ca602[_0xe636('0x21')]];}}}catch(_0x4d42ce){logger[_0xe636('0x2f')](_0xe636('0x6a'),util[_0xe636('0x31')](_0x4d42ce,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xe636('0x1e')][_0xe636('0x1b')]=function(_0x5c2bc7){try{if(this[_0xe636('0x32')](_0x5c2bc7)){if(this[_0xe636('0x8')][_0x5c2bc7[_0xe636('0x6b')]]){for(var _0x5eb86a in this[_0xe636('0x8')][_0x5c2bc7['transfereeuniqueid']]){if(this[_0xe636('0x8')][_0x5c2bc7['transfereeuniqueid']][_0xe636('0x33')](_0x5eb86a)){if(_0x5c2bc7['origtransfereruniqueid']===_0x5eb86a){var _0x4bbeeb=moment();this[_0xe636('0x8')][_0x5c2bc7[_0xe636('0x6b')]][_0x5eb86a][_0xe636('0x41')]=!![];this[_0xe636('0x8')][_0x5c2bc7['transfereeuniqueid']][_0x5eb86a]['agentcompleteAt']=moment()[_0xe636('0x23')](_0xe636('0x24'));this[_0xe636('0x8')][_0x5c2bc7[_0xe636('0x6b')]][_0x5eb86a]['reason']=_0xe636('0x51');this[_0xe636('0x8')][_0x5c2bc7[_0xe636('0x6b')]][_0x5eb86a][_0xe636('0x35')]=_0xe636('0x4f');this[_0xe636('0x8')][_0x5c2bc7[_0xe636('0x6b')]][_0x5eb86a][_0xe636('0x50')]=_0x4bbeeb[_0xe636('0x6c')](this[_0xe636('0x8')][_0x5c2bc7[_0xe636('0x6b')]][_0x5eb86a][_0xe636('0x34')],_0xe636('0x6d'));}}}}if(this[_0xe636('0x8')][_0x5c2bc7['secondtransfereruniqueid']]){var _0x19a7a7=this[_0xe636('0x8')][_0x5c2bc7['secondtransfereruniqueid']];this[_0xe636('0x8')][_0x5c2bc7[_0xe636('0x6e')]]=this['channels'][_0x5c2bc7[_0xe636('0x6b')]];this[_0xe636('0x8')][_0x5c2bc7[_0xe636('0x6b')]]=_0x19a7a7;}}}catch(_0x13a91f){logger['error'](_0xe636('0x6f'),util[_0xe636('0x31')](_0x13a91f,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xe636('0x1e')]['syncBlindTransfer']=function(_0x4eec58){try{if(this['isNotNull'](_0x4eec58)){if(this[_0xe636('0x8')][_0x4eec58[_0xe636('0x6b')]]){for(var _0xaa0993 in this['channels'][_0x4eec58['transfereeuniqueid']]){if(this[_0xe636('0x8')][_0x4eec58[_0xe636('0x6b')]][_0xe636('0x33')](_0xaa0993)){if(_0x4eec58[_0xe636('0x70')]===_0xaa0993){var _0x3770ff=moment();this[_0xe636('0x8')][_0x4eec58[_0xe636('0x6b')]][_0xaa0993][_0xe636('0x41')]=!![];this['channels'][_0x4eec58[_0xe636('0x6b')]][_0xaa0993][_0xe636('0x4e')]=_0x3770ff;this[_0xe636('0x8')][_0x4eec58[_0xe636('0x6b')]][_0xaa0993][_0xe636('0x43')]='transfer';this[_0xe636('0x8')][_0x4eec58['transfereeuniqueid']][_0xaa0993][_0xe636('0x35')]='complete';this[_0xe636('0x8')][_0x4eec58[_0xe636('0x6b')]][_0xaa0993][_0xe636('0x50')]=_0x3770ff[_0xe636('0x6c')](this[_0xe636('0x8')][_0x4eec58['transfereeuniqueid']][_0xaa0993][_0xe636('0x34')],_0xe636('0x6d'));}}}}}}catch(_0x216a23){logger[_0xe636('0x2f')](_0xe636('0x71'),util[_0xe636('0x31')](_0x216a23,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xe636('0x1e')]['syncMusicOnHoldStart']=function(_0x43a5da){var _0x17f468='';try{if(this['isNotNull'](_0x43a5da)){if(_0x43a5da[_0xe636('0x72')]){_0x17f468=_0x43a5da[_0xe636('0x72')]['substring'](0x0,_0x43a5da[_0xe636('0x72')][_0xe636('0x73')]('-'));if(this[_0xe636('0xa')][_0x17f468]){this['agents'][_0x17f468]['onhold']=!![];}}}}catch(_0x4de129){logger[_0xe636('0x2f')](_0xe636('0x74'),util[_0xe636('0x31')](_0x4de129,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xe636('0x1e')][_0xe636('0x19')]=function(_0x49e888){var _0x5cf80a='';try{if(this[_0xe636('0x32')](_0x49e888)){if(_0x49e888[_0xe636('0x72')]){_0x5cf80a=_0x49e888[_0xe636('0x72')]['substring'](0x0,_0x49e888[_0xe636('0x72')][_0xe636('0x73')]('-'));if(this['agents'][_0x5cf80a]){this[_0xe636('0xa')][_0x5cf80a]['onhold']=![];}}}}catch(_0x30aa45){logger[_0xe636('0x2f')]('[syncMusicOnHoldStop][VoiceAgentReport]',util[_0xe636('0x31')](_0x30aa45,{'showHidden':![],'depth':null}));}};module[_0xe636('0x75')]=VoiceAgentReport; \ No newline at end of file +var _0x76ac=['rejected','custom:agentringnoanswer','[syncAgentRingNoAnswer][VoiceAgentReport]','inspect','abandoned','custom:agentqueuecallerabandon','agentconnectAt','complete','talktime','agent','agentacw','acwtime','destconnectedlinenum','[syncAgentComplete][VoiceAgentReport]','addVariable','keys','variable','value','[syncVarSet][VoiceAgentReport]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepvtcallid','memberdynamic','memberpenalty','memberrealtime','includes','values','[syncHangup][VoiceAgentReport]','transfereeuniqueid','origtransfereruniqueid','transfer','diff','seconds','[syncAttendedTransfer][VoiceAgentReport]','syncBlindTransfer','transfereruniqueid','[syncBlindTransfer][VoiceAgentReport]','channel','substring','lastIndexOf','onhold','[syncMusicOnHoldStart][VoiceAgentReport]','[syncMusicOnHoldStop][VoiceAgentReport]','lodash','moment','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','localhost','socket.io-emitter','channels','voiceQueues','agents','variables','agentcalled','bind','agentconnect','syncAgentConnect','syncAgentRingNoAnswer','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','varset','syncVarSet','hangup','syncHangup','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','prototype','emit','isNotNull','isUndefined','syncAgentCalled','uniqueid','destuniqueid','format','YYYY-MM-DD\x20HH:mm:ss','called','queue','inbound','merge','omit','event','privilege','custom:agentcalled','user:%s','user:called','error','[syncAgentCalled][VoiceAgentReport]','hasOwnProperty','lastevent','connect','connectedlinenum','connectedlinename','destchannelstate','destchannelstatedesc','interface','pick','membername','custom:agentconnect','agentringnoanswerAt','reason','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','custom:agentansweredelsewhere','[syncAgentConnect][VoiceAgentReport]','agentringnoanswer'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0x76ac,0x126));var _0xc76a=function(_0x3d6906,_0x576bd4){_0x3d6906=_0x3d6906-0x0;var _0x487fa2=_0x76ac[_0x3d6906];return _0x487fa2;};'use strict';var _=require(_0xc76a('0x0'));var moment=require(_0xc76a('0x1'));var util=require(_0xc76a('0x2'));var Redis=require(_0xc76a('0x3'));var config=require(_0xc76a('0x4'));var logger=require(_0xc76a('0x5'))(_0xc76a('0x6'));var ami=require(_0xc76a('0x7'));config[_0xc76a('0x8')]=_[_0xc76a('0x9')](config[_0xc76a('0x8')],{'host':_0xc76a('0xa'),'port':0x18eb});var io=require(_0xc76a('0xb'))(new Redis(config[_0xc76a('0x8')]));function VoiceAgentReport(_0x57905b){this[_0xc76a('0xc')]={};this[_0xc76a('0xd')]=_0x57905b[_0xc76a('0xd')];this['agents']=_0x57905b[_0xc76a('0xe')];this[_0xc76a('0xf')]={};ami['on'](_0xc76a('0x10'),this['syncAgentCalled'][_0xc76a('0x11')](this));ami['on'](_0xc76a('0x12'),this[_0xc76a('0x13')][_0xc76a('0x11')](this));ami['on']('agentringnoanswer',this[_0xc76a('0x14')][_0xc76a('0x11')](this));ami['on']('queuecallerabandon',this[_0xc76a('0x15')][_0xc76a('0x11')](this));ami['on'](_0xc76a('0x16'),this[_0xc76a('0x17')][_0xc76a('0x11')](this));ami['on'](_0xc76a('0x18'),this[_0xc76a('0x19')][_0xc76a('0x11')](this));ami['on'](_0xc76a('0x1a'),this[_0xc76a('0x1b')]['bind'](this));ami['on'](_0xc76a('0x1c'),this[_0xc76a('0x1d')][_0xc76a('0x11')](this));ami['on'](_0xc76a('0x1e'),this[_0xc76a('0x1f')][_0xc76a('0x11')](this));ami['on'](_0xc76a('0x20'),this[_0xc76a('0x21')][_0xc76a('0x11')](this));ami['on'](_0xc76a('0x22'),this['syncBlindTransfer'][_0xc76a('0x11')](this));}VoiceAgentReport[_0xc76a('0x23')][_0xc76a('0x24')]=function(_0x3159c1,_0x4c2189,_0x5f14e8){io['to'](_0x3159c1)[_0xc76a('0x24')](_0x4c2189,_0x5f14e8);};VoiceAgentReport[_0xc76a('0x23')][_0xc76a('0x25')]=function(_0xe2da15){return _0xe2da15!==null&&!_[_0xc76a('0x26')](_0xe2da15);};VoiceAgentReport['prototype'][_0xc76a('0x27')]=function(_0x692c1){try{if(this['isNotNull'](_0x692c1)){if(_[_0xc76a('0x26')](this[_0xc76a('0xc')][_0x692c1[_0xc76a('0x28')]])){this['channels'][_0x692c1[_0xc76a('0x28')]]={};}if(_[_0xc76a('0x26')](this[_0xc76a('0xc')][_0x692c1[_0xc76a('0x28')]][_0x692c1[_0xc76a('0x29')]])){this[_0xc76a('0xc')][_0x692c1[_0xc76a('0x28')]][_0x692c1[_0xc76a('0x29')]]={'agentcalledAt':moment()[_0xc76a('0x2a')](_0xc76a('0x2b')),'lastevent':_0xc76a('0x2c'),'variables':this[_0xc76a('0xf')][_0x692c1[_0xc76a('0x28')]],'type':this[_0xc76a('0xd')][_0x692c1['queue']]?this[_0xc76a('0xd')][_0x692c1[_0xc76a('0x2d')]]['type']||_0xc76a('0x2e'):_0xc76a('0x2e')};}_[_0xc76a('0x2f')](this[_0xc76a('0xc')][_0x692c1[_0xc76a('0x28')]][_0x692c1[_0xc76a('0x29')]],_[_0xc76a('0x30')](_0x692c1,[_0xc76a('0x31'),_0xc76a('0x32')]));ami['emit'](_0xc76a('0x33'),this['channels'][_0x692c1[_0xc76a('0x28')]][_0x692c1[_0xc76a('0x29')]]);this['emit'](util[_0xc76a('0x2a')](_0xc76a('0x34'),_0x692c1['membername']),_0xc76a('0x35'),this[_0xc76a('0xc')][_0x692c1[_0xc76a('0x28')]][_0x692c1[_0xc76a('0x29')]]);}}catch(_0x209cb7){logger[_0xc76a('0x36')](_0xc76a('0x37'),util['inspect'](_0x209cb7,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xc76a('0x23')][_0xc76a('0x13')]=function(_0x471668){try{if(this[_0xc76a('0x25')](_0x471668)){if(this[_0xc76a('0xc')][_0x471668[_0xc76a('0x28')]]){for(var _0x423ef7 in this[_0xc76a('0xc')][_0x471668['uniqueid']]){if(this[_0xc76a('0xc')][_0x471668[_0xc76a('0x28')]][_0xc76a('0x38')](_0x423ef7)){if(_0x471668[_0xc76a('0x29')]===_0x423ef7){this[_0xc76a('0xc')][_0x471668[_0xc76a('0x28')]][_0x423ef7]['agentconnectAt']=moment()[_0xc76a('0x2a')](_0xc76a('0x2b'));this['channels'][_0x471668[_0xc76a('0x28')]][_0x423ef7][_0xc76a('0x39')]=_0xc76a('0x3a');this[_0xc76a('0xc')][_0x471668[_0xc76a('0x28')]][_0x423ef7]['holdtime']=_0x471668['holdtime'];this[_0xc76a('0xc')][_0x471668[_0xc76a('0x28')]][_0x423ef7][_0xc76a('0x3b')]=_0x471668[_0xc76a('0x3b')];this[_0xc76a('0xc')][_0x471668[_0xc76a('0x28')]][_0x423ef7]['connectedlinename']=_0x471668[_0xc76a('0x3c')];this['channels'][_0x471668[_0xc76a('0x28')]][_0x423ef7][_0xc76a('0x3d')]=_0x471668[_0xc76a('0x3d')];this['channels'][_0x471668['uniqueid']][_0x423ef7][_0xc76a('0x3e')]=_0x471668[_0xc76a('0x3e')];_[_0xc76a('0x2f')](this[_0xc76a('0xe')][_0x471668[_0xc76a('0x3f')]],_[_0xc76a('0x40')](_0x471668,[_0xc76a('0x2d'),'destconnectedlinenum']));this[_0xc76a('0x24')](util[_0xc76a('0x2a')]('user:%s',_0x471668[_0xc76a('0x41')]),'user:agentconnect',this['channels'][_0x471668[_0xc76a('0x28')]][_0x471668[_0xc76a('0x29')]]);ami['emit'](_0xc76a('0x42'),this[_0xc76a('0xc')][_0x471668[_0xc76a('0x28')]][_0x423ef7]);}else if(!this['channels'][_0x471668['uniqueid']][_0x423ef7]['agentringnoanswer']&&!this[_0xc76a('0xc')][_0x471668['uniqueid']][_0x423ef7][_0xc76a('0x16')]){this[_0xc76a('0xc')][_0x471668['uniqueid']][_0x423ef7]['agentringnoanswer']=!![];this[_0xc76a('0xc')][_0x471668[_0xc76a('0x28')]][_0x423ef7][_0xc76a('0x43')]=moment()[_0xc76a('0x2a')](_0xc76a('0x2b'));this[_0xc76a('0xc')][_0x471668[_0xc76a('0x28')]][_0x423ef7][_0xc76a('0x44')]=_0xc76a('0x45');this[_0xc76a('0xc')][_0x471668[_0xc76a('0x28')]][_0x423ef7]['lastevent']=_0xc76a('0x45');this[_0xc76a('0xc')][_0x471668[_0xc76a('0x28')]][_0x423ef7][_0xc76a('0x46')]=_0x471668[_0xc76a('0x29')];this['channels'][_0x471668[_0xc76a('0x28')]][_0x423ef7][_0xc76a('0x47')]=_0x471668[_0xc76a('0x41')];ami[_0xc76a('0x24')](_0xc76a('0x48'),this[_0xc76a('0xc')][_0x471668['uniqueid']][_0x423ef7]);}}}}}}catch(_0xbb9361){logger[_0xc76a('0x36')](_0xc76a('0x49'),util['inspect'](_0xbb9361,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xc76a('0x23')][_0xc76a('0x14')]=function(_0x2adc9b){try{if(this[_0xc76a('0x25')](_0x2adc9b)){if(this['channels'][_0x2adc9b[_0xc76a('0x28')]]&&this['channels'][_0x2adc9b[_0xc76a('0x28')]][_0x2adc9b[_0xc76a('0x29')]]){this[_0xc76a('0xc')][_0x2adc9b['uniqueid']][_0x2adc9b['destuniqueid']][_0xc76a('0x4a')]=!![];this['channels'][_0x2adc9b[_0xc76a('0x28')]][_0x2adc9b[_0xc76a('0x29')]][_0xc76a('0x43')]=moment()[_0xc76a('0x2a')](_0xc76a('0x2b'));this['channels'][_0x2adc9b[_0xc76a('0x28')]][_0x2adc9b['destuniqueid']][_0xc76a('0x44')]='rejected';this[_0xc76a('0xc')][_0x2adc9b['uniqueid']][_0x2adc9b[_0xc76a('0x29')]][_0xc76a('0x39')]=_0xc76a('0x4b');ami[_0xc76a('0x24')](_0xc76a('0x4c'),this[_0xc76a('0xc')][_0x2adc9b['uniqueid']][_0x2adc9b[_0xc76a('0x29')]]);}}}catch(_0x5b40fd){logger[_0xc76a('0x36')](_0xc76a('0x4d'),util[_0xc76a('0x4e')](_0x5b40fd,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xc76a('0x15')]=function(_0x3672f1){try{if(this[_0xc76a('0x25')](_0x3672f1)){if(this[_0xc76a('0xc')][_0x3672f1[_0xc76a('0x28')]]){for(var _0xcd8606 in this[_0xc76a('0xc')][_0x3672f1['uniqueid']]){if(this['channels'][_0x3672f1[_0xc76a('0x28')]][_0xc76a('0x38')](_0xcd8606)&&!this[_0xc76a('0xc')][_0x3672f1['uniqueid']][_0xcd8606][_0xc76a('0x4a')]&&!this[_0xc76a('0xc')][_0x3672f1['uniqueid']][_0xcd8606][_0xc76a('0x16')]){this[_0xc76a('0xc')][_0x3672f1[_0xc76a('0x28')]][_0xcd8606][_0xc76a('0x4a')]=!![];this[_0xc76a('0xc')][_0x3672f1[_0xc76a('0x28')]][_0xcd8606]['agentringnoanswerAt']=moment()['format'](_0xc76a('0x2b'));this['channels'][_0x3672f1['uniqueid']][_0xcd8606][_0xc76a('0x44')]=_0xc76a('0x4f');this[_0xc76a('0xc')][_0x3672f1[_0xc76a('0x28')]][_0xcd8606]['lastevent']=_0xc76a('0x4f');ami[_0xc76a('0x24')](_0xc76a('0x50'),this[_0xc76a('0xc')][_0x3672f1[_0xc76a('0x28')]][_0xcd8606]);}}}}}catch(_0x54f528){logger['error']('[syncQueueCallerAbandon][VoiceAgentReport]',util[_0xc76a('0x4e')](_0x54f528,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xc76a('0x23')][_0xc76a('0x17')]=function(_0x4d2a18){try{if(this[_0xc76a('0x25')](_0x4d2a18)){if(this[_0xc76a('0xc')][_0x4d2a18['uniqueid']]){for(var _0x799e85 in this[_0xc76a('0xc')][_0x4d2a18[_0xc76a('0x28')]]){if(this[_0xc76a('0xc')][_0x4d2a18['uniqueid']]['hasOwnProperty'](_0x799e85)){if(this[_0xc76a('0xc')][_0x4d2a18[_0xc76a('0x28')]][_0x799e85][_0xc76a('0x51')]&&!this[_0xc76a('0xc')][_0x4d2a18[_0xc76a('0x28')]][_0x799e85][_0xc76a('0x16')]){this['channels'][_0x4d2a18[_0xc76a('0x28')]][_0x799e85][_0xc76a('0x16')]=!![];this['channels'][_0x4d2a18[_0xc76a('0x28')]][_0x799e85]['agentcompleteAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0xc76a('0xc')][_0x4d2a18[_0xc76a('0x28')]][_0x799e85][_0xc76a('0x39')]=_0xc76a('0x52');this[_0xc76a('0xc')][_0x4d2a18['uniqueid']][_0x799e85][_0xc76a('0x53')]=_0x4d2a18['talktime'];this[_0xc76a('0xc')][_0x4d2a18[_0xc76a('0x28')]][_0x799e85]['reason']=_0x4d2a18['reason']=='transfer'?_0xc76a('0x54'):_0x4d2a18[_0xc76a('0x44')];if(this[_0xc76a('0xd')][_0x4d2a18['queue']]&&this[_0xc76a('0xd')][_0x4d2a18[_0xc76a('0x2d')]]['acw']){this['channels'][_0x4d2a18[_0xc76a('0x28')]][_0x799e85][_0xc76a('0x55')]=!![];this['channels'][_0x4d2a18[_0xc76a('0x28')]][_0x799e85][_0xc76a('0x56')]=this[_0xc76a('0xd')][_0x4d2a18['queue']]['acwTimeout'];}this[_0xc76a('0xe')][_0x4d2a18[_0xc76a('0x3f')]]=_[_0xc76a('0x30')](this[_0xc76a('0xe')][_0x4d2a18[_0xc76a('0x3f')]],[_0xc76a('0x2d'),_0xc76a('0x57')]);this[_0xc76a('0x24')](util[_0xc76a('0x2a')](_0xc76a('0x34'),_0x4d2a18[_0xc76a('0x41')]),'user:agentcomplete',this['channels'][_0x4d2a18[_0xc76a('0x28')]][_0x799e85]);ami[_0xc76a('0x24')]('custom:agentcomplete',this['channels'][_0x4d2a18[_0xc76a('0x28')]][_0x799e85]);}}}}}}catch(_0x13f361){logger['error'](_0xc76a('0x58'),util[_0xc76a('0x4e')](_0x13f361,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xc76a('0x23')][_0xc76a('0x19')]=function(_0x1224b3){try{if(this[_0xc76a('0x25')](_0x1224b3)){this[_0xc76a('0x59')](_0x1224b3[_0xc76a('0x28')],_[_0xc76a('0x5a')](_0x1224b3[_0xc76a('0x5b')])[0x0],_0x1224b3[_0xc76a('0x5c')]);if(this[_0xc76a('0xc')][_0x1224b3[_0xc76a('0x28')]]){for(var _0xec18f8 in this['channels'][_0x1224b3[_0xc76a('0x28')]]){if(this[_0xc76a('0xc')][_0x1224b3[_0xc76a('0x28')]][_0xc76a('0x38')](_0xec18f8)){if(_[_0xc76a('0x26')](this[_0xc76a('0xc')][_0x1224b3[_0xc76a('0x28')]][_0xec18f8][_0xc76a('0xf')])){this['channels'][_0x1224b3['uniqueid']][_0xec18f8]['variables']={};}this[_0xc76a('0xc')][_0x1224b3['uniqueid']][_0xec18f8]['variables']=this[_0xc76a('0xf')][_0x1224b3[_0xc76a('0x28')]];}}}}}catch(_0x3cd7bf){logger[_0xc76a('0x36')](_0xc76a('0x5d'),util[_0xc76a('0x4e')](_0x3cd7bf,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xc76a('0x23')][_0xc76a('0x59')]=function(_0x306de0,_0x42c77a,_0x2cc1ee){var _0x462f68=[_0xc76a('0x5e'),_0xc76a('0x5f'),_0xc76a('0x60'),_0xc76a('0x61'),'rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt',_0xc76a('0x62'),_0xc76a('0x63'),_0xc76a('0x64'),'bridgepeer',_0xc76a('0x65'),'membercalls',_0xc76a('0x66'),'memberinterface','memberlastcall',_0xc76a('0x41'),_0xc76a('0x67'),_0xc76a('0x68')];if(!_['isNil'](_0x42c77a)&&!_[_0xc76a('0x69')](_0x462f68,_0x42c77a)){if(_[_0xc76a('0x26')](this[_0xc76a('0xf')][_0x306de0])){this[_0xc76a('0xf')][_0x306de0]={};}this['variables'][_0x306de0][_0x42c77a]=_0x2cc1ee;}};VoiceAgentReport[_0xc76a('0x23')][_0xc76a('0x1b')]=function(_0x304f9d){try{if(this[_0xc76a('0x25')](_0x304f9d)){if(this[_0xc76a('0xc')][_0x304f9d[_0xc76a('0x28')]]){for(var _0x40e341 in this[_0xc76a('0xc')][_0x304f9d['uniqueid']]){if(this[_0xc76a('0xc')][_0x304f9d[_0xc76a('0x28')]]['hasOwnProperty'](_0x40e341)){if(this[_0xc76a('0xc')][_0x304f9d[_0xc76a('0x28')]][_0x40e341][_0xc76a('0x44')]=='transfer'&&this[_0xc76a('0xc')][_0x304f9d[_0xc76a('0x28')]][_0x40e341][_0xc76a('0x16')]){this[_0xc76a('0xc')][_0x304f9d[_0xc76a('0x28')]][_0x40e341]['agentcompleteAt']=moment()['format'](_0xc76a('0x2b'));}}}ami['emit']('custom:voiceAgentReport',_[_0xc76a('0x6a')](this[_0xc76a('0xc')][_0x304f9d[_0xc76a('0x28')]]));delete this[_0xc76a('0xc')][_0x304f9d[_0xc76a('0x28')]];}if(this[_0xc76a('0xf')][_0x304f9d[_0xc76a('0x28')]]){delete this[_0xc76a('0xf')][_0x304f9d[_0xc76a('0x28')]];}}}catch(_0x4f03a0){logger[_0xc76a('0x36')](_0xc76a('0x6b'),util[_0xc76a('0x4e')](_0x4f03a0,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xc76a('0x23')][_0xc76a('0x21')]=function(_0x382d32){try{if(this['isNotNull'](_0x382d32)){if(this[_0xc76a('0xc')][_0x382d32[_0xc76a('0x6c')]]){for(var _0xc04c25 in this['channels'][_0x382d32[_0xc76a('0x6c')]]){if(this[_0xc76a('0xc')][_0x382d32[_0xc76a('0x6c')]][_0xc76a('0x38')](_0xc04c25)){if(_0x382d32[_0xc76a('0x6d')]===_0xc04c25){var _0x2f3146=moment();this[_0xc76a('0xc')][_0x382d32[_0xc76a('0x6c')]][_0xc04c25][_0xc76a('0x16')]=!![];this[_0xc76a('0xc')][_0x382d32[_0xc76a('0x6c')]][_0xc04c25]['agentcompleteAt']=moment()[_0xc76a('0x2a')](_0xc76a('0x2b'));this[_0xc76a('0xc')][_0x382d32[_0xc76a('0x6c')]][_0xc04c25]['reason']=_0xc76a('0x6e');this[_0xc76a('0xc')][_0x382d32[_0xc76a('0x6c')]][_0xc04c25][_0xc76a('0x39')]=_0xc76a('0x52');this['channels'][_0x382d32[_0xc76a('0x6c')]][_0xc04c25]['talktime']=_0x2f3146[_0xc76a('0x6f')](this[_0xc76a('0xc')][_0x382d32[_0xc76a('0x6c')]][_0xc04c25][_0xc76a('0x51')],_0xc76a('0x70'));}}}}if(this['channels'][_0x382d32['secondtransfereruniqueid']]){var _0x15e81e=this[_0xc76a('0xc')][_0x382d32['secondtransfereruniqueid']];this[_0xc76a('0xc')][_0x382d32['secondtransfereruniqueid']]=this[_0xc76a('0xc')][_0x382d32[_0xc76a('0x6c')]];this[_0xc76a('0xc')][_0x382d32[_0xc76a('0x6c')]]=_0x15e81e;}}}catch(_0x4981a8){logger[_0xc76a('0x36')](_0xc76a('0x71'),util[_0xc76a('0x4e')](_0x4981a8,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xc76a('0x72')]=function(_0xa4c623){try{if(this[_0xc76a('0x25')](_0xa4c623)){if(this[_0xc76a('0xc')][_0xa4c623['transfereeuniqueid']]){for(var _0x4269bf in this['channels'][_0xa4c623[_0xc76a('0x6c')]]){if(this[_0xc76a('0xc')][_0xa4c623[_0xc76a('0x6c')]]['hasOwnProperty'](_0x4269bf)){if(_0xa4c623[_0xc76a('0x73')]===_0x4269bf){var _0x1b3329=moment();this[_0xc76a('0xc')][_0xa4c623['transfereeuniqueid']][_0x4269bf]['agentcomplete']=!![];this['channels'][_0xa4c623[_0xc76a('0x6c')]][_0x4269bf]['agentcompleteAt']=_0x1b3329;this[_0xc76a('0xc')][_0xa4c623[_0xc76a('0x6c')]][_0x4269bf]['reason']=_0xc76a('0x6e');this[_0xc76a('0xc')][_0xa4c623[_0xc76a('0x6c')]][_0x4269bf][_0xc76a('0x39')]=_0xc76a('0x52');this[_0xc76a('0xc')][_0xa4c623[_0xc76a('0x6c')]][_0x4269bf]['talktime']=_0x1b3329[_0xc76a('0x6f')](this[_0xc76a('0xc')][_0xa4c623[_0xc76a('0x6c')]][_0x4269bf][_0xc76a('0x51')],_0xc76a('0x70'));}}}}}}catch(_0x1934bf){logger['error'](_0xc76a('0x74'),util[_0xc76a('0x4e')](_0x1934bf,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xc76a('0x1d')]=function(_0x482669){var _0x2fed84='';try{if(this[_0xc76a('0x25')](_0x482669)){if(_0x482669['channel']){_0x2fed84=_0x482669[_0xc76a('0x75')][_0xc76a('0x76')](0x0,_0x482669[_0xc76a('0x75')][_0xc76a('0x77')]('-'));if(this['agents'][_0x2fed84]){this[_0xc76a('0xe')][_0x2fed84][_0xc76a('0x78')]=!![];}}}}catch(_0xeea705){logger['error'](_0xc76a('0x79'),util[_0xc76a('0x4e')](_0xeea705,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xc76a('0x23')][_0xc76a('0x1f')]=function(_0x2585f1){var _0x5c69d4='';try{if(this[_0xc76a('0x25')](_0x2585f1)){if(_0x2585f1[_0xc76a('0x75')]){_0x5c69d4=_0x2585f1[_0xc76a('0x75')][_0xc76a('0x76')](0x0,_0x2585f1[_0xc76a('0x75')][_0xc76a('0x77')]('-'));if(this[_0xc76a('0xe')][_0x5c69d4]){this[_0xc76a('0xe')][_0x5c69d4][_0xc76a('0x78')]=![];}}}}catch(_0x573295){logger[_0xc76a('0x36')](_0xc76a('0x7a'),util[_0xc76a('0x4e')](_0x573295,{'showHidden':![],'depth':null}));}};module['exports']=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index 021d3e7..c8ae001 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 _0x1ff8=['type','xmd-queue','xmd-originatecalleridnum','originatecalleridnum','destination','xmd-callerid-preview','calleridpreview','xmcs-queue','sipcallid','sipcalluniqueid','parse','sipcalllinkedid','[syncVarSet][VoiceCallReport]','endtime','user:agentcomplete','custom:voiceCallReport','[syncHangup][VoiceCallReport]','transfereeuniqueid','transfercalleridnum','origtransferercalleridnum','transfertargetcalleridnum','secondtransfereruniqueid','transfertargetuniqueid','transferconnectedlinenum','origtransfereruniqueid','transfereecalleridnum','extension','BlindTransfer','transfererchannel','mohstarttime','[syncMusicOnHoldStart][VoiceCallReport]','mohtime','milliseconds','exports','bluebird','moment','util','path','../../../config/logger','unknown','inuse','invalid','unavailable','ringing','ringinuse','set','queue','agi','dial','playback','voicemail','NO\x20ANSWER','FAILED','ANSWERED','BUSY','redis','defaults','localhost','socket.io-emitter','channels','agents','coreshowchannel','syncNewExten','bind','newexten','newchannel','syncNewChannel','newstate','syncNewState','varset','hangup','syncHangup','newcallerid','syncAttendedTransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','resolve','then','catch','log','isNotNull','isUndefined','prototype','emit','syncNewCallerId','uniqueid','pick','error','[syncNewCallerId][VoiceCallReport]','linkedid','channel','OutgoingSpoolFailed','starttime','format','YYYY-MM-DD\x20HH:mm:ss','disposition','toNumber','channelstate','merge','keys','context','from-sip','split','destconnectedlinenum','user:%s','accountcode','exten','[syncNewChannel][VoiceCallReport]','inspect','application','toLowerCase','appdata','applicationdata','subtract','duration','seconds','includes','lastapplication','lastdata','startsWith','[syncNewExten][VoiceCallReport]','answered','answertime','holdtime','diff','calleridnum','xcally-motion-preview','connectedlinename','calleridname','destinationchannel','membername','name','syncMixMonitorFilename','monitor','endsWith','.wav49','replace','.WAV','monitorFilename','monitors','isNil','push','rec','variable','mixmonitor_filename','xmd-phone','value','xmd-callerid','callerid','xmd-cdrtype'];(function(_0x2c8272,_0x2ff02f){var _0x11490c=function(_0x173c69){while(--_0x173c69){_0x2c8272['push'](_0x2c8272['shift']());}};_0x11490c(++_0x2ff02f);}(_0x1ff8,0x154));var _0x81ff=function(_0x413426,_0x4f7814){_0x413426=_0x413426-0x0;var _0x5576e2=_0x1ff8[_0x413426];return _0x5576e2;};'use strict';var BPromise=require(_0x81ff('0x0'));var _=require('lodash');var moment=require(_0x81ff('0x1'));var util=require(_0x81ff('0x2'));var path=require(_0x81ff('0x3'));var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require(_0x81ff('0x4'))('ami');var ami=require('../ami');var Channel=require('../model/channel');var statusDesc=[_0x81ff('0x5'),'not_inuse',_0x81ff('0x6'),'busy',_0x81ff('0x7'),_0x81ff('0x8'),_0x81ff('0x9'),_0x81ff('0xa'),'onhold'];var applications=[_0x81ff('0xb'),_0x81ff('0xc'),_0x81ff('0xd'),_0x81ff('0xe'),_0x81ff('0xf'),_0x81ff('0x10')];var dispositions=[_0x81ff('0x11'),_0x81ff('0x12'),_0x81ff('0x12'),_0x81ff('0x11'),_0x81ff('0x11'),_0x81ff('0x11'),_0x81ff('0x13'),_0x81ff('0x14'),'FAILED',_0x81ff('0x12'),'FAILED'];var actions={};config[_0x81ff('0x15')]=_[_0x81ff('0x16')](config['redis'],{'host':_0x81ff('0x17'),'port':0x18eb});var io=require(_0x81ff('0x18'))(new Redis(config[_0x81ff('0x15')]));function VoiceCallReport(_0x160ec2){this[_0x81ff('0x19')]=_0x160ec2[_0x81ff('0x19')];this[_0x81ff('0x1a')]=_0x160ec2[_0x81ff('0x1a')];ami['on'](_0x81ff('0x1b'),this[_0x81ff('0x1c')][_0x81ff('0x1d')](this));ami['on'](_0x81ff('0x1e'),this['syncNewExten'][_0x81ff('0x1d')](this));ami['on'](_0x81ff('0x1f'),this[_0x81ff('0x20')][_0x81ff('0x1d')](this));ami['on'](_0x81ff('0x21'),this[_0x81ff('0x22')]['bind'](this));ami['on'](_0x81ff('0x23'),this['syncVarSet'][_0x81ff('0x1d')](this));ami['on'](_0x81ff('0x24'),this[_0x81ff('0x25')][_0x81ff('0x1d')](this));ami['on'](_0x81ff('0x26'),this['syncNewCallerId'][_0x81ff('0x1d')](this));ami['on']('attendedtransfer',this[_0x81ff('0x27')]['bind'](this));ami['on']('blindtransfer',this[_0x81ff('0x28')][_0x81ff('0x1d')](this));ami['on'](_0x81ff('0x29'),this[_0x81ff('0x2a')][_0x81ff('0x1d')](this));ami['on'](_0x81ff('0x2b'),this[_0x81ff('0x2c')][_0x81ff('0x1d')](this));return BPromise[_0x81ff('0x2d')]()[_0x81ff('0x2e')](ami['actionCoreShowChannels']())[_0x81ff('0x2f')](function(_0x1e1a4a){console[_0x81ff('0x30')](_0x1e1a4a);});}VoiceCallReport['prototype'][_0x81ff('0x31')]=function(_0x88e313){return _0x88e313!==null&&!_[_0x81ff('0x32')](_0x88e313);};VoiceCallReport[_0x81ff('0x33')][_0x81ff('0x34')]=function(_0x5f10bc,_0x4ff860,_0x387eed){io['to'](_0x5f10bc)[_0x81ff('0x34')](_0x4ff860,_0x387eed);};VoiceCallReport[_0x81ff('0x33')][_0x81ff('0x35')]=function(_0x48859e){try{if(this[_0x81ff('0x31')](_0x48859e)){if(_0x48859e['uniqueid']===_0x48859e['linkedid']){if(!_[_0x81ff('0x32')](this['channels'][_0x48859e['uniqueid']])){_['merge'](this[_0x81ff('0x19')][_0x48859e[_0x81ff('0x36')]],_[_0x81ff('0x37')](_0x48859e,_['keys'](this[_0x81ff('0x19')][_0x48859e[_0x81ff('0x36')]])));}}}}catch(_0x1fc112){logger[_0x81ff('0x38')](_0x81ff('0x39'),util['inspect'](_0x1fc112,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x81ff('0x33')]['syncNewChannel']=function(_0x167845){try{if(this[_0x81ff('0x31')](_0x167845)){if(_0x167845[_0x81ff('0x36')]===_0x167845[_0x81ff('0x3a')]&&_0x167845[_0x81ff('0x3b')]!=_0x81ff('0x3c')){if(_[_0x81ff('0x32')](this[_0x81ff('0x19')][_0x167845[_0x81ff('0x36')]])){this[_0x81ff('0x19')][_0x167845[_0x81ff('0x36')]]=new Channel();this['channels'][_0x167845['uniqueid']][_0x81ff('0x3d')]=moment()[_0x81ff('0x3e')](_0x81ff('0x3f'));this[_0x81ff('0x19')][_0x167845['uniqueid']][_0x81ff('0x40')]=dispositions[_[_0x81ff('0x41')](_0x167845[_0x81ff('0x42')])];_[_0x81ff('0x43')](this[_0x81ff('0x19')][_0x167845[_0x81ff('0x36')]],_[_0x81ff('0x37')](_0x167845,_[_0x81ff('0x44')](this[_0x81ff('0x19')][_0x167845['uniqueid']])));if(_0x167845[_0x81ff('0x45')]===_0x81ff('0x46')){if(this[_0x81ff('0x1a')][_0x167845[_0x81ff('0x3b')][_0x81ff('0x47')]('-')[0x0]]){this['agents'][_0x167845['channel'][_0x81ff('0x47')]('-')[0x0]][_0x81ff('0x48')]=_0x167845['exten'];this[_0x81ff('0x34')](util[_0x81ff('0x3e')](_0x81ff('0x49'),this['agents'][_0x167845['channel'][_0x81ff('0x47')]('-')[0x0]]['name']),'user:agentconnect',{'destaccountcode':this[_0x81ff('0x1a')][_0x167845[_0x81ff('0x3b')][_0x81ff('0x47')]('-')[0x0]][_0x81ff('0x4a')],'destconnectedlinenum':_0x167845[_0x81ff('0x4b')]});}}}}}}catch(_0x4de881){logger[_0x81ff('0x38')](_0x81ff('0x4c'),util[_0x81ff('0x4d')](_0x4de881,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x81ff('0x1c')]=function(_0x1b7d9e){try{if(this['isNotNull'](_0x1b7d9e)){if(_0x1b7d9e['uniqueid']===_0x1b7d9e['linkedid']&&_0x1b7d9e['exten']!='h'&&_0x1b7d9e['channel']!=_0x81ff('0x3c')){_0x1b7d9e[_0x81ff('0x4e')]=_0x1b7d9e[_0x81ff('0x4e')][_0x81ff('0x4f')]();_0x1b7d9e['applicationdata']=(_0x1b7d9e[_0x81ff('0x50')]||_0x1b7d9e[_0x81ff('0x51')])[_0x81ff('0x4f')]();if(_[_0x81ff('0x32')](this[_0x81ff('0x19')][_0x1b7d9e['uniqueid']])){this[_0x81ff('0x19')][_0x1b7d9e[_0x81ff('0x36')]]=new Channel();this[_0x81ff('0x19')][_0x1b7d9e[_0x81ff('0x36')]][_0x81ff('0x3d')]=_0x1b7d9e['duration']?moment()[_0x81ff('0x52')](moment[_0x81ff('0x53')](_0x1b7d9e[_0x81ff('0x53')])[_0x81ff('0x54')](),_0x81ff('0x54'))[_0x81ff('0x3e')](_0x81ff('0x3f')):moment()[_0x81ff('0x3e')](_0x81ff('0x3f'));this[_0x81ff('0x19')][_0x1b7d9e[_0x81ff('0x36')]][_0x81ff('0x40')]='NO\x20ANSWER';}_['merge'](this[_0x81ff('0x19')][_0x1b7d9e[_0x81ff('0x36')]],_['pick'](_0x1b7d9e,_[_0x81ff('0x44')](this[_0x81ff('0x19')][_0x1b7d9e[_0x81ff('0x36')]])));if(_[_0x81ff('0x55')](applications,_0x1b7d9e[_0x81ff('0x4e')])){this[_0x81ff('0x19')][_0x1b7d9e[_0x81ff('0x36')]][_0x81ff('0x56')]=_0x1b7d9e[_0x81ff('0x4e')];this['channels'][_0x1b7d9e[_0x81ff('0x36')]][_0x81ff('0x57')]=_0x1b7d9e[_0x81ff('0x51')];if(_0x1b7d9e[_0x81ff('0x4e')]===_0x81ff('0xb')&&_[_0x81ff('0x58')](_0x1b7d9e[_0x81ff('0x51')],'cdr(')){var _0x30d756=_0x1b7d9e[_0x81ff('0x51')]['split']('=');var _0x76dbb9=_0x30d756[0x0]['match'](/cdr\((.*)\)/);if(_0x76dbb9){this[_0x81ff('0x19')][_0x1b7d9e['uniqueid']][_0x76dbb9[0x1]]=_0x30d756[0x1];}}else if(_0x1b7d9e[_0x81ff('0x4e')]===_0x81ff('0xc')){this[_0x81ff('0x19')][_0x1b7d9e[_0x81ff('0x36')]][_0x81ff('0xc')]=_0x1b7d9e[_0x81ff('0x51')]['split'](',')[0x0];}}}}}catch(_0x339737){logger[_0x81ff('0x38')](_0x81ff('0x59'),util[_0x81ff('0x4d')](_0x339737,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x81ff('0x33')]['syncNewState']=function(_0xd07ac5){try{if(this[_0x81ff('0x31')](_0xd07ac5)){if(_0xd07ac5[_0x81ff('0x36')]!==_0xd07ac5['linkedid']){if(this['channels'][_0xd07ac5[_0x81ff('0x3a')]]){if(_0xd07ac5[_0x81ff('0x42')]==='6'){if(!this[_0x81ff('0x19')][_0xd07ac5[_0x81ff('0x3a')]][_0x81ff('0x5a')]){var _0x544b8f=moment();this[_0x81ff('0x19')][_0xd07ac5[_0x81ff('0x3a')]]['answered']=!![];this[_0x81ff('0x19')][_0xd07ac5[_0x81ff('0x3a')]][_0x81ff('0x5b')]=_0x544b8f['format'](_0x81ff('0x3f'));if(this[_0x81ff('0x19')][_0xd07ac5[_0x81ff('0x3a')]][_0x81ff('0x3d')]){this[_0x81ff('0x19')][_0xd07ac5[_0x81ff('0x3a')]][_0x81ff('0x5c')]=_0x544b8f[_0x81ff('0x5d')](this[_0x81ff('0x19')][_0xd07ac5[_0x81ff('0x3a')]][_0x81ff('0x3d')],_0x81ff('0x54'));}}this[_0x81ff('0x19')][_0xd07ac5[_0x81ff('0x3a')]][_0x81ff('0x3a')]=_0xd07ac5[_0x81ff('0x36')];if(_0xd07ac5[_0x81ff('0x5e')]!==_0x81ff('0x5f')){this[_0x81ff('0x19')][_0xd07ac5['linkedid']]['connectedlinenum']=_0xd07ac5[_0x81ff('0x5e')];}this['channels'][_0xd07ac5[_0x81ff('0x3a')]][_0x81ff('0x60')]=_0xd07ac5[_0x81ff('0x61')];this[_0x81ff('0x19')][_0xd07ac5[_0x81ff('0x3a')]][_0x81ff('0x62')]=_0xd07ac5[_0x81ff('0x3b')];this['channels'][_0xd07ac5[_0x81ff('0x3a')]]['disposition']=dispositions[_[_0x81ff('0x41')](_0xd07ac5[_0x81ff('0x42')])];if(this['agents'][_0xd07ac5[_0x81ff('0x3b')]['split']('-')[0x0]]){this[_0x81ff('0x19')][_0xd07ac5[_0x81ff('0x3a')]]['UserId']=this[_0x81ff('0x1a')][_0xd07ac5['channel'][_0x81ff('0x47')]('-')[0x0]]['id'];this['channels'][_0xd07ac5[_0x81ff('0x3a')]][_0x81ff('0x63')]=this[_0x81ff('0x1a')][_0xd07ac5[_0x81ff('0x3b')][_0x81ff('0x47')]('-')[0x0]][_0x81ff('0x64')];}}}}else{if(this['channels'][_0xd07ac5['uniqueid']]){if(_0xd07ac5[_0x81ff('0x42')]==='6'){if(this[_0x81ff('0x1a')][_0xd07ac5[_0x81ff('0x3b')][_0x81ff('0x47')]('-')[0x0]]){this[_0x81ff('0x19')][_0xd07ac5[_0x81ff('0x36')]]['UserId']=this[_0x81ff('0x1a')][_0xd07ac5[_0x81ff('0x3b')]['split']('-')[0x0]]['id'];this[_0x81ff('0x19')][_0xd07ac5[_0x81ff('0x36')]]['membername']=this[_0x81ff('0x1a')][_0xd07ac5[_0x81ff('0x3b')][_0x81ff('0x47')]('-')[0x0]]['name'];}}}}}}catch(_0x43f1e2){logger[_0x81ff('0x38')]('[syncNewState][VoiceCallReport]',util[_0x81ff('0x4d')](_0x43f1e2,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x81ff('0x33')][_0x81ff('0x65')]=function(_0x5a4393,_0x4e9f78){if(this[_0x81ff('0x19')][_0x5a4393]){this['channels'][_0x5a4393][_0x81ff('0x66')]=!![];if(_[_0x81ff('0x67')](_0x4e9f78,_0x81ff('0x68'))){_0x4e9f78=_0x4e9f78[_0x81ff('0x69')](_0x81ff('0x68'),_0x81ff('0x6a'));}this[_0x81ff('0x19')][_0x5a4393][_0x81ff('0x6b')]=_0x4e9f78;var _0xfd8d08=_['find'](this['channels'][_0x5a4393][_0x81ff('0x6c')],{'filename':_0x4e9f78});if(_[_0x81ff('0x6d')](_0xfd8d08)){this['channels'][_0x5a4393][_0x81ff('0x6c')][_0x81ff('0x6e')]({'filename':_0x4e9f78,'createdAt':moment()['format'](_0x81ff('0x3f')),'mixmonitorid':'','status':_0x81ff('0x6f')});}}};VoiceCallReport[_0x81ff('0x33')]['syncVarSet']=function(_0x26038e){try{if(this[_0x81ff('0x31')](_0x26038e)){if(this[_0x81ff('0x19')][_0x26038e['uniqueid']]&&_0x26038e['channel']!='OutgoingSpoolFailed'){if(this[_0x81ff('0x31')](_0x26038e[_0x81ff('0x70')])){if(this['isNotNull'](_0x26038e[_0x81ff('0x70')][_0x81ff('0x71')])){this[_0x81ff('0x65')](_0x26038e[_0x81ff('0x36')],_0x26038e['value']);}else if(this[_0x81ff('0x31')](_0x26038e['variable'][_0x81ff('0x72')])){this[_0x81ff('0x19')][_0x26038e['uniqueid']]['calleridnum']=_0x26038e[_0x81ff('0x73')];}else if(this['isNotNull'](_0x26038e[_0x81ff('0x70')][_0x81ff('0x74')])){this[_0x81ff('0x19')][_0x26038e['uniqueid']][_0x81ff('0x75')]=_0x26038e[_0x81ff('0x73')];}else if(this[_0x81ff('0x31')](_0x26038e[_0x81ff('0x70')][_0x81ff('0x76')])){this[_0x81ff('0x19')][_0x26038e[_0x81ff('0x36')]][_0x81ff('0x77')]=_0x26038e[_0x81ff('0x73')];}else if(this[_0x81ff('0x31')](_0x26038e[_0x81ff('0x70')][_0x81ff('0x78')])){this['channels'][_0x26038e[_0x81ff('0x36')]][_0x81ff('0xc')]=_0x26038e['value'][_0x81ff('0x47')](',')[0x0];}else if(this[_0x81ff('0x31')](_0x26038e['variable'][_0x81ff('0x79')])){this[_0x81ff('0x19')][_0x26038e[_0x81ff('0x36')]][_0x81ff('0x7a')]=_0x26038e['value'];}else if(this[_0x81ff('0x31')](_0x26038e[_0x81ff('0x70')]['xmd-destination'])){this[_0x81ff('0x19')][_0x26038e['uniqueid']][_0x81ff('0x7b')]=_0x26038e[_0x81ff('0x73')];}else if(this[_0x81ff('0x31')](_0x26038e[_0x81ff('0x70')][_0x81ff('0x7c')])){this[_0x81ff('0x19')][_0x26038e['uniqueid']][_0x81ff('0x7d')]=_0x26038e[_0x81ff('0x73')];}else if(this[_0x81ff('0x31')](_0x26038e[_0x81ff('0x70')][_0x81ff('0x7e')])){this[_0x81ff('0x19')][_0x26038e[_0x81ff('0x36')]]['queue']=_0x26038e[_0x81ff('0x73')];}else if(this[_0x81ff('0x31')](_0x26038e['variable'][_0x81ff('0x7f')])){this[_0x81ff('0x19')][_0x26038e[_0x81ff('0x36')]][_0x81ff('0x80')]=_0x26038e[_0x81ff('0x73')];}}}else if(this[_0x81ff('0x31')](_0x26038e[_0x81ff('0x70')]['mixmonitor_filename'])){if(_0x26038e[_0x81ff('0x73')]){var _0x4d6cac=path[_0x81ff('0x81')](_0x26038e['value'])[_0x81ff('0x64')];this[_0x81ff('0x65')](_0x4d6cac,_0x26038e[_0x81ff('0x73')]);}}else if(this[_0x81ff('0x19')][_0x26038e[_0x81ff('0x3a')]]){if(this[_0x81ff('0x31')](_0x26038e[_0x81ff('0x70')])){if(this[_0x81ff('0x31')](_0x26038e[_0x81ff('0x70')][_0x81ff('0x7f')])){this['channels'][_0x26038e['linkedid']][_0x81ff('0x82')]=_0x26038e['value'];}}}}}catch(_0x2364c4){logger['error'](_0x81ff('0x83'),util[_0x81ff('0x4d')](_0x2364c4,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x81ff('0x33')][_0x81ff('0x25')]=function(_0x43a977){try{if(this[_0x81ff('0x31')](_0x43a977)){if(this['channels'][_0x43a977[_0x81ff('0x36')]]){var _0x2cdc14=moment();this[_0x81ff('0x19')][_0x43a977[_0x81ff('0x36')]][_0x81ff('0x84')]=_0x2cdc14[_0x81ff('0x3e')](_0x81ff('0x3f'));this[_0x81ff('0x19')][_0x43a977[_0x81ff('0x36')]][_0x81ff('0x53')]=_0x2cdc14['diff'](this[_0x81ff('0x19')][_0x43a977[_0x81ff('0x36')]][_0x81ff('0x3d')],_0x81ff('0x54'));if(this[_0x81ff('0x19')][_0x43a977[_0x81ff('0x36')]][_0x81ff('0x5a')]){this[_0x81ff('0x19')][_0x43a977['uniqueid']]['billableseconds']=_0x2cdc14[_0x81ff('0x5d')](this[_0x81ff('0x19')][_0x43a977[_0x81ff('0x36')]][_0x81ff('0x5b')],_0x81ff('0x54'));this[_0x81ff('0x19')][_0x43a977['uniqueid']][_0x81ff('0x5c')]=this[_0x81ff('0x19')][_0x43a977[_0x81ff('0x36')]][_0x81ff('0x53')]-this[_0x81ff('0x19')][_0x43a977[_0x81ff('0x36')]]['billableseconds'];}if(_0x43a977['context']===_0x81ff('0x46')){if(this[_0x81ff('0x1a')][_0x43a977[_0x81ff('0x3b')][_0x81ff('0x47')]('-')[0x0]]){this[_0x81ff('0x1a')][_0x43a977[_0x81ff('0x3b')][_0x81ff('0x47')]('-')[0x0]]=_['omit'](this[_0x81ff('0x1a')][_0x43a977['channel'][_0x81ff('0x47')]('-')[0x0]],[_0x81ff('0x48')]);this[_0x81ff('0x34')](util[_0x81ff('0x3e')](_0x81ff('0x49'),this[_0x81ff('0x1a')][_0x43a977['channel'][_0x81ff('0x47')]('-')[0x0]]['name']),_0x81ff('0x85'),{'destaccountcode':this['agents'][_0x43a977[_0x81ff('0x3b')][_0x81ff('0x47')]('-')[0x0]]['accountcode']});}}ami[_0x81ff('0x34')](_0x81ff('0x86'),this[_0x81ff('0x19')][_0x43a977['uniqueid']]);delete this[_0x81ff('0x19')][_0x43a977[_0x81ff('0x36')]];}}}catch(_0x2229d2){logger[_0x81ff('0x38')](_0x81ff('0x87'),util[_0x81ff('0x4d')](_0x2229d2,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x81ff('0x33')][_0x81ff('0x27')]=function(_0x2d4b79){try{if(this[_0x81ff('0x31')](_0x2d4b79)){if(this[_0x81ff('0x19')][_0x2d4b79[_0x81ff('0x88')]]){this[_0x81ff('0x19')][_0x2d4b79[_0x81ff('0x88')]][_0x81ff('0x89')]=_0x2d4b79[_0x81ff('0x8a')];this[_0x81ff('0x19')][_0x2d4b79[_0x81ff('0x88')]]['transferconnectedlinenum']=_0x2d4b79[_0x81ff('0x8b')];if(this[_0x81ff('0x19')][_0x2d4b79['secondtransfereruniqueid']]){var _0x53fbcf=this[_0x81ff('0x19')][_0x2d4b79[_0x81ff('0x8c')]];this[_0x81ff('0x19')][_0x2d4b79[_0x81ff('0x8c')]]=this['channels'][_0x2d4b79[_0x81ff('0x88')]];this[_0x81ff('0x19')][_0x2d4b79[_0x81ff('0x88')]]=_0x53fbcf;}}else if(this[_0x81ff('0x19')][_0x2d4b79[_0x81ff('0x8d')]]){this[_0x81ff('0x19')][_0x2d4b79[_0x81ff('0x8d')]]['transfercalleridnum']=_0x2d4b79[_0x81ff('0x8a')];this[_0x81ff('0x19')][_0x2d4b79[_0x81ff('0x8d')]][_0x81ff('0x8e')]=_0x2d4b79[_0x81ff('0x8b')];if(this[_0x81ff('0x19')][_0x2d4b79['origtransfereruniqueid']]){var _0x53fbcf=this[_0x81ff('0x19')][_0x2d4b79[_0x81ff('0x8f')]];this[_0x81ff('0x19')][_0x2d4b79[_0x81ff('0x8f')]]=this['channels'][_0x2d4b79['transfertargetuniqueid']];this[_0x81ff('0x19')][_0x2d4b79[_0x81ff('0x8d')]]=_0x53fbcf;}}}}catch(_0x519e6b){logger['error']('[syncAttendedTransfer][VoiceCallReport]',util[_0x81ff('0x4d')](_0x519e6b,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x81ff('0x33')][_0x81ff('0x28')]=function(_0x54efb9){try{if(this[_0x81ff('0x31')](_0x54efb9)){if(this['channels'][_0x54efb9[_0x81ff('0x88')]]){this[_0x81ff('0x19')][_0x54efb9[_0x81ff('0x88')]]['transfercalleridnum']=_0x54efb9[_0x81ff('0x90')];this[_0x81ff('0x19')][_0x54efb9[_0x81ff('0x88')]]['transferconnectedlinenum']=_0x54efb9[_0x81ff('0x91')];this[_0x81ff('0x25')]({'event':_0x81ff('0x92'),'uniqueid':_0x54efb9[_0x81ff('0x88')],'context':_0x54efb9[_0x81ff('0x45')],'channel':_0x54efb9[_0x81ff('0x93')]});}}}catch(_0x40ff70){logger[_0x81ff('0x38')]('[syncBlindTransfer][VoiceCallReport]',util[_0x81ff('0x4d')](_0x40ff70,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x81ff('0x33')]['syncMusicOnHoldStart']=function(_0x373181){try{if(this[_0x81ff('0x31')](_0x373181)){if(this[_0x81ff('0x19')][_0x373181[_0x81ff('0x36')]]){if(!_['isNil'](this[_0x81ff('0x19')][_0x373181[_0x81ff('0x36')]][_0x81ff('0x5b')])){this[_0x81ff('0x19')][_0x373181[_0x81ff('0x36')]][_0x81ff('0x94')]=moment()[_0x81ff('0x3e')](_0x81ff('0x3f'));}}}}catch(_0x1795bf){logger[_0x81ff('0x38')](_0x81ff('0x95'),util['inspect'](_0x1795bf,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x81ff('0x33')][_0x81ff('0x2c')]=function(_0x368368){try{if(this['isNotNull'](_0x368368)){if(this[_0x81ff('0x19')][_0x368368[_0x81ff('0x36')]]){if(!_['isNil'](this[_0x81ff('0x19')][_0x368368['uniqueid']][_0x81ff('0x94')])){this[_0x81ff('0x19')][_0x368368[_0x81ff('0x36')]][_0x81ff('0x96')]+=moment()[_0x81ff('0x97')](0x0)['diff'](this[_0x81ff('0x19')][_0x368368['uniqueid']][_0x81ff('0x94')],_0x81ff('0x54'));delete this[_0x81ff('0x19')][_0x368368[_0x81ff('0x36')]][_0x81ff('0x94')];}}}}catch(_0x1934db){logger[_0x81ff('0x38')]('[syncMusicOnHoldStop][VoiceCallReport]',util['inspect'](_0x1934db,{'showHidden':![],'depth':null}));}};module[_0x81ff('0x98')]=VoiceCallReport; \ No newline at end of file +var _0x94ac=['accountcode','custom:voiceCallReport','transfereeuniqueid','origtransferercalleridnum','transferconnectedlinenum','transfertargetcalleridnum','secondtransfereruniqueid','transfertargetuniqueid','transfercalleridnum','origtransfereruniqueid','extension','BlindTransfer','mohstarttime','[syncMusicOnHoldStart][VoiceCallReport]','mohtime','[syncMusicOnHoldStop][VoiceCallReport]','exports','bluebird','lodash','moment','util','path','ioredis','../../../config/environment','ami','../ami','inuse','busy','unavailable','ringinuse','queue','agi','dial','playback','voicemail','NO\x20ANSWER','ANSWERED','BUSY','FAILED','redis','defaults','localhost','socket.io-emitter','channels','agents','coreshowchannel','syncNewExten','bind','newexten','syncNewChannel','newstate','syncNewState','varset','syncVarSet','newcallerid','syncNewCallerId','attendedtransfer','blindtransfer','syncBlindTransfer','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','then','actionCoreShowChannels','catch','prototype','isNotNull','isUndefined','emit','linkedid','uniqueid','keys','error','[syncNewCallerId][VoiceCallReport]','inspect','OutgoingSpoolFailed','starttime','format','disposition','toNumber','channelstate','pick','context','from-sip','channel','split','destconnectedlinenum','exten','user:%s','name','user:agentconnect','application','toLowerCase','applicationdata','appdata','duration','subtract','seconds','YYYY-MM-DD\x20HH:mm:ss','merge','includes','lastapplication','lastdata','set','startsWith','cdr(','match','[syncNewExten][VoiceCallReport]','answered','answertime','diff','calleridnum','xcally-motion-preview','connectedlinename','destinationchannel','UserId','membername','[syncNewState][VoiceCallReport]','monitor','endsWith','.wav49','replace','.WAV','monitorFilename','find','monitors','isNil','push','rec','mixmonitor_filename','syncMixMonitorFilename','value','xmd-phone','variable','xmd-callerid','callerid','type','xmd-queue','xmd-originatecalleridnum','originatecalleridnum','calleridpreview','sipcallid','sipcalluniqueid','sipcalllinkedid','[syncVarSet][VoiceCallReport]','endtime','billableseconds','holdtime'];(function(_0x457304,_0x16de13){var _0x394fd0=function(_0x133d6e){while(--_0x133d6e){_0x457304['push'](_0x457304['shift']());}};_0x394fd0(++_0x16de13);}(_0x94ac,0x139));var _0xc94a=function(_0x170c4a,_0x3ab3b1){_0x170c4a=_0x170c4a-0x0;var _0x2db2b4=_0x94ac[_0x170c4a];return _0x2db2b4;};'use strict';var BPromise=require(_0xc94a('0x0'));var _=require(_0xc94a('0x1'));var moment=require(_0xc94a('0x2'));var util=require(_0xc94a('0x3'));var path=require(_0xc94a('0x4'));var Redis=require(_0xc94a('0x5'));var config=require(_0xc94a('0x6'));var logger=require('../../../config/logger')(_0xc94a('0x7'));var ami=require(_0xc94a('0x8'));var Channel=require('../model/channel');var statusDesc=['unknown','not_inuse',_0xc94a('0x9'),_0xc94a('0xa'),'invalid',_0xc94a('0xb'),'ringing',_0xc94a('0xc'),'onhold'];var applications=['set',_0xc94a('0xd'),_0xc94a('0xe'),_0xc94a('0xf'),_0xc94a('0x10'),_0xc94a('0x11')];var dispositions=[_0xc94a('0x12'),'FAILED','FAILED','NO\x20ANSWER','NO\x20ANSWER','NO\x20ANSWER',_0xc94a('0x13'),_0xc94a('0x14'),_0xc94a('0x15'),_0xc94a('0x15'),_0xc94a('0x15')];var actions={};config[_0xc94a('0x16')]=_[_0xc94a('0x17')](config[_0xc94a('0x16')],{'host':_0xc94a('0x18'),'port':0x18eb});var io=require(_0xc94a('0x19'))(new Redis(config['redis']));function VoiceCallReport(_0xbfd406){this[_0xc94a('0x1a')]=_0xbfd406['channels'];this[_0xc94a('0x1b')]=_0xbfd406[_0xc94a('0x1b')];ami['on'](_0xc94a('0x1c'),this[_0xc94a('0x1d')][_0xc94a('0x1e')](this));ami['on'](_0xc94a('0x1f'),this[_0xc94a('0x1d')][_0xc94a('0x1e')](this));ami['on']('newchannel',this[_0xc94a('0x20')]['bind'](this));ami['on'](_0xc94a('0x21'),this[_0xc94a('0x22')]['bind'](this));ami['on'](_0xc94a('0x23'),this[_0xc94a('0x24')]['bind'](this));ami['on']('hangup',this['syncHangup'][_0xc94a('0x1e')](this));ami['on'](_0xc94a('0x25'),this[_0xc94a('0x26')][_0xc94a('0x1e')](this));ami['on'](_0xc94a('0x27'),this['syncAttendedTransfer'][_0xc94a('0x1e')](this));ami['on'](_0xc94a('0x28'),this[_0xc94a('0x29')]['bind'](this));ami['on']('musiconholdstart',this[_0xc94a('0x2a')][_0xc94a('0x1e')](this));ami['on'](_0xc94a('0x2b'),this[_0xc94a('0x2c')][_0xc94a('0x1e')](this));return BPromise['resolve']()[_0xc94a('0x2d')](ami[_0xc94a('0x2e')]())[_0xc94a('0x2f')](function(_0x52a48e){console['log'](_0x52a48e);});}VoiceCallReport[_0xc94a('0x30')][_0xc94a('0x31')]=function(_0x208512){return _0x208512!==null&&!_[_0xc94a('0x32')](_0x208512);};VoiceCallReport[_0xc94a('0x30')][_0xc94a('0x33')]=function(_0x4a3741,_0x5167a7,_0x22d3f9){io['to'](_0x4a3741)[_0xc94a('0x33')](_0x5167a7,_0x22d3f9);};VoiceCallReport[_0xc94a('0x30')][_0xc94a('0x26')]=function(_0x4d63b4){try{if(this[_0xc94a('0x31')](_0x4d63b4)){if(_0x4d63b4['uniqueid']===_0x4d63b4[_0xc94a('0x34')]){if(!_['isUndefined'](this[_0xc94a('0x1a')][_0x4d63b4[_0xc94a('0x35')]])){_['merge'](this['channels'][_0x4d63b4['uniqueid']],_['pick'](_0x4d63b4,_[_0xc94a('0x36')](this[_0xc94a('0x1a')][_0x4d63b4['uniqueid']])));}}}}catch(_0x4b9470){logger[_0xc94a('0x37')](_0xc94a('0x38'),util[_0xc94a('0x39')](_0x4b9470,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xc94a('0x30')][_0xc94a('0x20')]=function(_0x19c20b){try{if(this[_0xc94a('0x31')](_0x19c20b)){if(_0x19c20b[_0xc94a('0x35')]===_0x19c20b[_0xc94a('0x34')]&&_0x19c20b['channel']!=_0xc94a('0x3a')){if(_[_0xc94a('0x32')](this[_0xc94a('0x1a')][_0x19c20b['uniqueid']])){this['channels'][_0x19c20b[_0xc94a('0x35')]]=new Channel();this['channels'][_0x19c20b[_0xc94a('0x35')]][_0xc94a('0x3b')]=moment()[_0xc94a('0x3c')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xc94a('0x1a')][_0x19c20b[_0xc94a('0x35')]][_0xc94a('0x3d')]=dispositions[_[_0xc94a('0x3e')](_0x19c20b[_0xc94a('0x3f')])];_['merge'](this[_0xc94a('0x1a')][_0x19c20b['uniqueid']],_[_0xc94a('0x40')](_0x19c20b,_[_0xc94a('0x36')](this[_0xc94a('0x1a')][_0x19c20b['uniqueid']])));if(_0x19c20b[_0xc94a('0x41')]===_0xc94a('0x42')){if(this[_0xc94a('0x1b')][_0x19c20b[_0xc94a('0x43')][_0xc94a('0x44')]('-')[0x0]]){this['agents'][_0x19c20b['channel'][_0xc94a('0x44')]('-')[0x0]][_0xc94a('0x45')]=_0x19c20b[_0xc94a('0x46')];this[_0xc94a('0x33')](util[_0xc94a('0x3c')](_0xc94a('0x47'),this[_0xc94a('0x1b')][_0x19c20b[_0xc94a('0x43')][_0xc94a('0x44')]('-')[0x0]][_0xc94a('0x48')]),_0xc94a('0x49'),{'destaccountcode':this[_0xc94a('0x1b')][_0x19c20b[_0xc94a('0x43')]['split']('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x19c20b[_0xc94a('0x46')]});}}}}}}catch(_0x3cfc2f){logger[_0xc94a('0x37')]('[syncNewChannel][VoiceCallReport]',util['inspect'](_0x3cfc2f,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xc94a('0x30')]['syncNewExten']=function(_0x20aa12){try{if(this[_0xc94a('0x31')](_0x20aa12)){if(_0x20aa12[_0xc94a('0x35')]===_0x20aa12[_0xc94a('0x34')]&&_0x20aa12[_0xc94a('0x46')]!='h'&&_0x20aa12['channel']!='OutgoingSpoolFailed'){_0x20aa12[_0xc94a('0x4a')]=_0x20aa12[_0xc94a('0x4a')][_0xc94a('0x4b')]();_0x20aa12[_0xc94a('0x4c')]=(_0x20aa12[_0xc94a('0x4d')]||_0x20aa12[_0xc94a('0x4c')])[_0xc94a('0x4b')]();if(_[_0xc94a('0x32')](this[_0xc94a('0x1a')][_0x20aa12['uniqueid']])){this[_0xc94a('0x1a')][_0x20aa12[_0xc94a('0x35')]]=new Channel();this[_0xc94a('0x1a')][_0x20aa12[_0xc94a('0x35')]][_0xc94a('0x3b')]=_0x20aa12[_0xc94a('0x4e')]?moment()[_0xc94a('0x4f')](moment[_0xc94a('0x4e')](_0x20aa12[_0xc94a('0x4e')])[_0xc94a('0x50')](),_0xc94a('0x50'))['format'](_0xc94a('0x51')):moment()[_0xc94a('0x3c')](_0xc94a('0x51'));this[_0xc94a('0x1a')][_0x20aa12[_0xc94a('0x35')]][_0xc94a('0x3d')]=_0xc94a('0x12');}_[_0xc94a('0x52')](this['channels'][_0x20aa12[_0xc94a('0x35')]],_[_0xc94a('0x40')](_0x20aa12,_[_0xc94a('0x36')](this[_0xc94a('0x1a')][_0x20aa12[_0xc94a('0x35')]])));if(_[_0xc94a('0x53')](applications,_0x20aa12[_0xc94a('0x4a')])){this['channels'][_0x20aa12[_0xc94a('0x35')]][_0xc94a('0x54')]=_0x20aa12[_0xc94a('0x4a')];this[_0xc94a('0x1a')][_0x20aa12['uniqueid']][_0xc94a('0x55')]=_0x20aa12['applicationdata'];if(_0x20aa12[_0xc94a('0x4a')]===_0xc94a('0x56')&&_[_0xc94a('0x57')](_0x20aa12[_0xc94a('0x4c')],_0xc94a('0x58'))){var _0xabffa=_0x20aa12[_0xc94a('0x4c')][_0xc94a('0x44')]('=');var _0x278205=_0xabffa[0x0][_0xc94a('0x59')](/cdr\((.*)\)/);if(_0x278205){this[_0xc94a('0x1a')][_0x20aa12[_0xc94a('0x35')]][_0x278205[0x1]]=_0xabffa[0x1];}}else if(_0x20aa12[_0xc94a('0x4a')]===_0xc94a('0xd')){this['channels'][_0x20aa12[_0xc94a('0x35')]][_0xc94a('0xd')]=_0x20aa12[_0xc94a('0x4c')][_0xc94a('0x44')](',')[0x0];}}}}}catch(_0x314467){logger[_0xc94a('0x37')](_0xc94a('0x5a'),util[_0xc94a('0x39')](_0x314467,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xc94a('0x30')][_0xc94a('0x22')]=function(_0x34021f){try{if(this[_0xc94a('0x31')](_0x34021f)){if(_0x34021f[_0xc94a('0x35')]!==_0x34021f[_0xc94a('0x34')]){if(this['channels'][_0x34021f['linkedid']]){if(_0x34021f[_0xc94a('0x3f')]==='6'){if(!this[_0xc94a('0x1a')][_0x34021f[_0xc94a('0x34')]][_0xc94a('0x5b')]){var _0x28ffd6=moment();this[_0xc94a('0x1a')][_0x34021f[_0xc94a('0x34')]][_0xc94a('0x5b')]=!![];this[_0xc94a('0x1a')][_0x34021f[_0xc94a('0x34')]][_0xc94a('0x5c')]=_0x28ffd6[_0xc94a('0x3c')](_0xc94a('0x51'));if(this[_0xc94a('0x1a')][_0x34021f['linkedid']][_0xc94a('0x3b')]){this[_0xc94a('0x1a')][_0x34021f['linkedid']]['holdtime']=_0x28ffd6[_0xc94a('0x5d')](this[_0xc94a('0x1a')][_0x34021f[_0xc94a('0x34')]]['starttime'],_0xc94a('0x50'));}}this['channels'][_0x34021f[_0xc94a('0x34')]]['linkedid']=_0x34021f[_0xc94a('0x35')];if(_0x34021f[_0xc94a('0x5e')]!==_0xc94a('0x5f')){this[_0xc94a('0x1a')][_0x34021f['linkedid']]['connectedlinenum']=_0x34021f[_0xc94a('0x5e')];}this[_0xc94a('0x1a')][_0x34021f['linkedid']][_0xc94a('0x60')]=_0x34021f['calleridname'];this[_0xc94a('0x1a')][_0x34021f['linkedid']][_0xc94a('0x61')]=_0x34021f[_0xc94a('0x43')];this[_0xc94a('0x1a')][_0x34021f['linkedid']][_0xc94a('0x3d')]=dispositions[_[_0xc94a('0x3e')](_0x34021f[_0xc94a('0x3f')])];if(this[_0xc94a('0x1b')][_0x34021f[_0xc94a('0x43')][_0xc94a('0x44')]('-')[0x0]]){this[_0xc94a('0x1a')][_0x34021f[_0xc94a('0x34')]]['UserId']=this[_0xc94a('0x1b')][_0x34021f[_0xc94a('0x43')]['split']('-')[0x0]]['id'];this[_0xc94a('0x1a')][_0x34021f[_0xc94a('0x34')]]['membername']=this[_0xc94a('0x1b')][_0x34021f[_0xc94a('0x43')]['split']('-')[0x0]][_0xc94a('0x48')];}}}}else{if(this['channels'][_0x34021f[_0xc94a('0x35')]]){if(_0x34021f[_0xc94a('0x3f')]==='6'){if(this[_0xc94a('0x1b')][_0x34021f['channel'][_0xc94a('0x44')]('-')[0x0]]){this['channels'][_0x34021f[_0xc94a('0x35')]][_0xc94a('0x62')]=this[_0xc94a('0x1b')][_0x34021f['channel'][_0xc94a('0x44')]('-')[0x0]]['id'];this[_0xc94a('0x1a')][_0x34021f[_0xc94a('0x35')]][_0xc94a('0x63')]=this[_0xc94a('0x1b')][_0x34021f['channel'][_0xc94a('0x44')]('-')[0x0]][_0xc94a('0x48')];}}}}}}catch(_0xca194d){logger[_0xc94a('0x37')](_0xc94a('0x64'),util[_0xc94a('0x39')](_0xca194d,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncMixMonitorFilename']=function(_0x54f6f8,_0x59f73d){if(this['channels'][_0x54f6f8]){this[_0xc94a('0x1a')][_0x54f6f8][_0xc94a('0x65')]=!![];if(_[_0xc94a('0x66')](_0x59f73d,_0xc94a('0x67'))){_0x59f73d=_0x59f73d[_0xc94a('0x68')](_0xc94a('0x67'),_0xc94a('0x69'));}this[_0xc94a('0x1a')][_0x54f6f8][_0xc94a('0x6a')]=_0x59f73d;var _0xd98139=_[_0xc94a('0x6b')](this[_0xc94a('0x1a')][_0x54f6f8][_0xc94a('0x6c')],{'filename':_0x59f73d});if(_[_0xc94a('0x6d')](_0xd98139)){this[_0xc94a('0x1a')][_0x54f6f8][_0xc94a('0x6c')][_0xc94a('0x6e')]({'filename':_0x59f73d,'createdAt':moment()[_0xc94a('0x3c')](_0xc94a('0x51')),'mixmonitorid':'','status':_0xc94a('0x6f')});}}};VoiceCallReport['prototype'][_0xc94a('0x24')]=function(_0x10f402){try{if(this['isNotNull'](_0x10f402)){if(this['channels'][_0x10f402[_0xc94a('0x35')]]&&_0x10f402[_0xc94a('0x43')]!='OutgoingSpoolFailed'){if(this[_0xc94a('0x31')](_0x10f402['variable'])){if(this['isNotNull'](_0x10f402['variable'][_0xc94a('0x70')])){this[_0xc94a('0x71')](_0x10f402[_0xc94a('0x35')],_0x10f402[_0xc94a('0x72')]);}else if(this[_0xc94a('0x31')](_0x10f402['variable'][_0xc94a('0x73')])){this[_0xc94a('0x1a')][_0x10f402['uniqueid']]['calleridnum']=_0x10f402[_0xc94a('0x72')];}else if(this[_0xc94a('0x31')](_0x10f402[_0xc94a('0x74')][_0xc94a('0x75')])){this[_0xc94a('0x1a')][_0x10f402['uniqueid']][_0xc94a('0x76')]=_0x10f402[_0xc94a('0x72')];}else if(this[_0xc94a('0x31')](_0x10f402[_0xc94a('0x74')]['xmd-cdrtype'])){this['channels'][_0x10f402[_0xc94a('0x35')]][_0xc94a('0x77')]=_0x10f402[_0xc94a('0x72')];}else if(this[_0xc94a('0x31')](_0x10f402['variable'][_0xc94a('0x78')])){this[_0xc94a('0x1a')][_0x10f402[_0xc94a('0x35')]][_0xc94a('0xd')]=_0x10f402[_0xc94a('0x72')]['split'](',')[0x0];}else if(this[_0xc94a('0x31')](_0x10f402[_0xc94a('0x74')][_0xc94a('0x79')])){this[_0xc94a('0x1a')][_0x10f402['uniqueid']][_0xc94a('0x7a')]=_0x10f402['value'];}else if(this['isNotNull'](_0x10f402[_0xc94a('0x74')]['xmd-destination'])){this[_0xc94a('0x1a')][_0x10f402['uniqueid']]['destination']=_0x10f402['value'];}else if(this[_0xc94a('0x31')](_0x10f402[_0xc94a('0x74')]['xmd-callerid-preview'])){this[_0xc94a('0x1a')][_0x10f402[_0xc94a('0x35')]][_0xc94a('0x7b')]=_0x10f402[_0xc94a('0x72')];}else if(this['isNotNull'](_0x10f402[_0xc94a('0x74')]['xmcs-queue'])){this[_0xc94a('0x1a')][_0x10f402[_0xc94a('0x35')]][_0xc94a('0xd')]=_0x10f402['value'];}else if(this[_0xc94a('0x31')](_0x10f402['variable'][_0xc94a('0x7c')])){this['channels'][_0x10f402[_0xc94a('0x35')]][_0xc94a('0x7d')]=_0x10f402[_0xc94a('0x72')];}}}else if(this[_0xc94a('0x31')](_0x10f402['variable'][_0xc94a('0x70')])){if(_0x10f402['value']){var _0x5b4194=path['parse'](_0x10f402[_0xc94a('0x72')])[_0xc94a('0x48')];this['syncMixMonitorFilename'](_0x5b4194,_0x10f402['value']);}}else if(this[_0xc94a('0x1a')][_0x10f402[_0xc94a('0x34')]]){if(this[_0xc94a('0x31')](_0x10f402[_0xc94a('0x74')])){if(this[_0xc94a('0x31')](_0x10f402[_0xc94a('0x74')][_0xc94a('0x7c')])){this[_0xc94a('0x1a')][_0x10f402[_0xc94a('0x34')]][_0xc94a('0x7e')]=_0x10f402[_0xc94a('0x72')];}}}}}catch(_0x4f51df){logger['error'](_0xc94a('0x7f'),util['inspect'](_0x4f51df,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xc94a('0x30')]['syncHangup']=function(_0x118898){try{if(this[_0xc94a('0x31')](_0x118898)){if(this[_0xc94a('0x1a')][_0x118898[_0xc94a('0x35')]]){var _0x1ab356=moment();this[_0xc94a('0x1a')][_0x118898[_0xc94a('0x35')]][_0xc94a('0x80')]=_0x1ab356[_0xc94a('0x3c')](_0xc94a('0x51'));this[_0xc94a('0x1a')][_0x118898[_0xc94a('0x35')]][_0xc94a('0x4e')]=_0x1ab356[_0xc94a('0x5d')](this[_0xc94a('0x1a')][_0x118898[_0xc94a('0x35')]][_0xc94a('0x3b')],_0xc94a('0x50'));if(this[_0xc94a('0x1a')][_0x118898[_0xc94a('0x35')]][_0xc94a('0x5b')]){this[_0xc94a('0x1a')][_0x118898[_0xc94a('0x35')]][_0xc94a('0x81')]=_0x1ab356['diff'](this['channels'][_0x118898[_0xc94a('0x35')]][_0xc94a('0x5c')],_0xc94a('0x50'));this[_0xc94a('0x1a')][_0x118898[_0xc94a('0x35')]][_0xc94a('0x82')]=this[_0xc94a('0x1a')][_0x118898[_0xc94a('0x35')]][_0xc94a('0x4e')]-this['channels'][_0x118898['uniqueid']][_0xc94a('0x81')];}if(_0x118898[_0xc94a('0x41')]===_0xc94a('0x42')){if(this['agents'][_0x118898[_0xc94a('0x43')][_0xc94a('0x44')]('-')[0x0]]){this['agents'][_0x118898[_0xc94a('0x43')][_0xc94a('0x44')]('-')[0x0]]=_['omit'](this['agents'][_0x118898[_0xc94a('0x43')][_0xc94a('0x44')]('-')[0x0]],[_0xc94a('0x45')]);this[_0xc94a('0x33')](util['format'](_0xc94a('0x47'),this[_0xc94a('0x1b')][_0x118898[_0xc94a('0x43')][_0xc94a('0x44')]('-')[0x0]][_0xc94a('0x48')]),'user:agentcomplete',{'destaccountcode':this[_0xc94a('0x1b')][_0x118898[_0xc94a('0x43')][_0xc94a('0x44')]('-')[0x0]][_0xc94a('0x83')]});}}ami[_0xc94a('0x33')](_0xc94a('0x84'),this[_0xc94a('0x1a')][_0x118898[_0xc94a('0x35')]]);delete this[_0xc94a('0x1a')][_0x118898['uniqueid']];}}}catch(_0x1f0420){logger[_0xc94a('0x37')]('[syncHangup][VoiceCallReport]',util[_0xc94a('0x39')](_0x1f0420,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncAttendedTransfer']=function(_0xccee4f){try{if(this[_0xc94a('0x31')](_0xccee4f)){if(this[_0xc94a('0x1a')][_0xccee4f[_0xc94a('0x85')]]){this[_0xc94a('0x1a')][_0xccee4f[_0xc94a('0x85')]]['transfercalleridnum']=_0xccee4f[_0xc94a('0x86')];this['channels'][_0xccee4f[_0xc94a('0x85')]][_0xc94a('0x87')]=_0xccee4f[_0xc94a('0x88')];if(this['channels'][_0xccee4f[_0xc94a('0x89')]]){var _0x7be837=this[_0xc94a('0x1a')][_0xccee4f['secondtransfereruniqueid']];this[_0xc94a('0x1a')][_0xccee4f[_0xc94a('0x89')]]=this[_0xc94a('0x1a')][_0xccee4f[_0xc94a('0x85')]];this['channels'][_0xccee4f[_0xc94a('0x85')]]=_0x7be837;}}else if(this[_0xc94a('0x1a')][_0xccee4f['transfertargetuniqueid']]){this[_0xc94a('0x1a')][_0xccee4f[_0xc94a('0x8a')]][_0xc94a('0x8b')]=_0xccee4f['origtransferercalleridnum'];this['channels'][_0xccee4f[_0xc94a('0x8a')]][_0xc94a('0x87')]=_0xccee4f[_0xc94a('0x88')];if(this[_0xc94a('0x1a')][_0xccee4f[_0xc94a('0x8c')]]){var _0x7be837=this['channels'][_0xccee4f[_0xc94a('0x8c')]];this[_0xc94a('0x1a')][_0xccee4f[_0xc94a('0x8c')]]=this[_0xc94a('0x1a')][_0xccee4f[_0xc94a('0x8a')]];this['channels'][_0xccee4f[_0xc94a('0x8a')]]=_0x7be837;}}}}catch(_0x3a61e0){logger[_0xc94a('0x37')]('[syncAttendedTransfer][VoiceCallReport]',util[_0xc94a('0x39')](_0x3a61e0,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xc94a('0x30')][_0xc94a('0x29')]=function(_0x1f2e5c){try{if(this['isNotNull'](_0x1f2e5c)){if(this[_0xc94a('0x1a')][_0x1f2e5c['transfereeuniqueid']]){this[_0xc94a('0x1a')][_0x1f2e5c['transfereeuniqueid']][_0xc94a('0x8b')]=_0x1f2e5c['transfereecalleridnum'];this[_0xc94a('0x1a')][_0x1f2e5c[_0xc94a('0x85')]]['transferconnectedlinenum']=_0x1f2e5c[_0xc94a('0x8d')];this['syncHangup']({'event':_0xc94a('0x8e'),'uniqueid':_0x1f2e5c[_0xc94a('0x85')],'context':_0x1f2e5c[_0xc94a('0x41')],'channel':_0x1f2e5c['transfererchannel']});}}}catch(_0x1b7daa){logger[_0xc94a('0x37')]('[syncBlindTransfer][VoiceCallReport]',util[_0xc94a('0x39')](_0x1b7daa,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncMusicOnHoldStart']=function(_0x48d5dc){try{if(this[_0xc94a('0x31')](_0x48d5dc)){if(this[_0xc94a('0x1a')][_0x48d5dc[_0xc94a('0x35')]]){if(!_[_0xc94a('0x6d')](this[_0xc94a('0x1a')][_0x48d5dc[_0xc94a('0x35')]]['answertime'])){this[_0xc94a('0x1a')][_0x48d5dc[_0xc94a('0x35')]][_0xc94a('0x8f')]=moment()[_0xc94a('0x3c')](_0xc94a('0x51'));}}}}catch(_0x189c9b){logger[_0xc94a('0x37')](_0xc94a('0x90'),util[_0xc94a('0x39')](_0x189c9b,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xc94a('0x30')][_0xc94a('0x2c')]=function(_0x4dd2fe){try{if(this[_0xc94a('0x31')](_0x4dd2fe)){if(this['channels'][_0x4dd2fe[_0xc94a('0x35')]]){if(!_[_0xc94a('0x6d')](this[_0xc94a('0x1a')][_0x4dd2fe['uniqueid']][_0xc94a('0x8f')])){this[_0xc94a('0x1a')][_0x4dd2fe[_0xc94a('0x35')]][_0xc94a('0x91')]+=moment()['milliseconds'](0x0)[_0xc94a('0x5d')](this[_0xc94a('0x1a')][_0x4dd2fe['uniqueid']][_0xc94a('0x8f')],'seconds');delete this['channels'][_0x4dd2fe[_0xc94a('0x35')]][_0xc94a('0x8f')];}}}}catch(_0x4c78a1){logger['error'](_0xc94a('0x92'),util['inspect'](_0x4c78a1,{'showHidden':![],'depth':null}));}};module[_0xc94a('0x93')]=VoiceCallReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceDialReport.js b/server/services/ami/report/voiceDialReport.js index 6664e73..da29135 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 _0x4e5d=['syncDialBegin','bind','dialend','syncDialEnd','syncVarSet','syncHangup','prototype','emit','uniqueid','merge','format','called','substring','channel','lastIndexOf','event','custom:dialbegin','[syncDialBegin][VoiceDialReport]','inspect','dialstatus','ANSWER','connectedlinenum','connectedlinename','answertime','YYYY-MM-DD\x20HH:mm:ss','lastevent','connect','custom:dialconnect','voice:outbound','voice_outbound_channel:save','isNotNull','addVariable','keys','variable','value','outboundrouteid','error','[syncVarSet][VoiceDialReport]','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','membername','memberpenalty','memberrealtime','isNil','includes','isUndefined','endtime','duration','diff','starttime','seconds','total','answered','holdtime','sumBillable','billableseconds','sumDuration','voice_outbound:save','info','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','stringify','voice_outbound_channel:remove','exports','lodash','util','ioredis','../../../config/environment','ami','../ami','defaults','redis','socket.io-emitter','channels','outboundChannels','outbound','variables','dialbegin'];(function(_0x10a94d,_0x3bf30f){var _0x33b351=function(_0x10277c){while(--_0x10277c){_0x10a94d['push'](_0x10a94d['shift']());}};_0x33b351(++_0x3bf30f);}(_0x4e5d,0x152));var _0xd4e5=function(_0x29ce14,_0x334166){_0x29ce14=_0x29ce14-0x0;var _0x48f289=_0x4e5d[_0x29ce14];return _0x48f289;};'use strict';var _=require(_0xd4e5('0x0'));var moment=require('moment');var util=require(_0xd4e5('0x1'));var Redis=require(_0xd4e5('0x2'));var config=require(_0xd4e5('0x3'));var logger=require('../../../config/logger')(_0xd4e5('0x4'));var ami=require(_0xd4e5('0x5'));config['redis']=_[_0xd4e5('0x6')](config[_0xd4e5('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0xd4e5('0x8'))(new Redis(config['redis']));function VoiceDialReport(_0x3ccbf3){this[_0xd4e5('0x9')]=_0x3ccbf3[_0xd4e5('0xa')];this['outbound']=_0x3ccbf3[_0xd4e5('0xb')];this[_0xd4e5('0xc')]={};ami['on'](_0xd4e5('0xd'),this[_0xd4e5('0xe')][_0xd4e5('0xf')](this));ami['on'](_0xd4e5('0x10'),this[_0xd4e5('0x11')][_0xd4e5('0xf')](this));ami['on']('varset',this[_0xd4e5('0x12')][_0xd4e5('0xf')](this));ami['on']('hangup',this[_0xd4e5('0x13')][_0xd4e5('0xf')](this));}VoiceDialReport['prototype']['isNotNull']=function(_0x13278e){return _0x13278e!==null&&!_['isUndefined'](_0x13278e);};VoiceDialReport[_0xd4e5('0x14')][_0xd4e5('0x15')]=function(_0x18befc,_0x37f386,_0x345ffb){io['to'](_0x18befc)['emit'](_0x37f386,_0x345ffb);};VoiceDialReport[_0xd4e5('0x14')][_0xd4e5('0xe')]=function(_0x338966){try{if(this['isNotNull'](_0x338966)){if(this[_0xd4e5('0x9')][_0x338966[_0xd4e5('0x16')]]){_[_0xd4e5('0x17')](this[_0xd4e5('0x9')][_0x338966[_0xd4e5('0x16')]],{'starttime':moment()[_0xd4e5('0x18')]('YYYY-MM-DD\x20HH:mm:ss'),'lastevent':_0xd4e5('0x19'),'interface':_0x338966['channel'][_0xd4e5('0x1a')](0x0,_0x338966[_0xd4e5('0x1b')][_0xd4e5('0x1c')]('-')),'membername':_0x338966['channel']['substring'](_0x338966['channel']['lastIndexOf']('/')+0x1,_0x338966['channel'][_0xd4e5('0x1c')]('-'))},_['omit'](_0x338966,[_0xd4e5('0x1d'),'privilege']));this[_0xd4e5('0x15')]('voice:outbound','voice_outbound_channel:save',this[_0xd4e5('0x9')][_0x338966[_0xd4e5('0x16')]]);ami['emit'](_0xd4e5('0x1e'),this[_0xd4e5('0x9')][_0x338966[_0xd4e5('0x16')]]);}}}catch(_0x273a3d){logger['error'](_0xd4e5('0x1f'),util[_0xd4e5('0x20')](_0x273a3d,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xd4e5('0x14')][_0xd4e5('0x11')]=function(_0xedce99){try{if(this['isNotNull'](_0xedce99)){if(this[_0xd4e5('0x9')][_0xedce99[_0xd4e5('0x16')]]){this['channels'][_0xedce99[_0xd4e5('0x16')]]['dialstatus']=_0xedce99[_0xd4e5('0x21')];if(_0xedce99['dialstatus']===_0xd4e5('0x22')){this[_0xd4e5('0x9')][_0xedce99[_0xd4e5('0x16')]][_0xd4e5('0x23')]=_0xedce99[_0xd4e5('0x23')];this[_0xd4e5('0x9')][_0xedce99['uniqueid']][_0xd4e5('0x24')]=_0xedce99[_0xd4e5('0x24')];this['channels'][_0xedce99['uniqueid']][_0xd4e5('0x25')]=moment()[_0xd4e5('0x18')](_0xd4e5('0x26'));this[_0xd4e5('0x9')][_0xedce99[_0xd4e5('0x16')]][_0xd4e5('0x27')]=_0xd4e5('0x28');ami[_0xd4e5('0x15')](_0xd4e5('0x29'),this[_0xd4e5('0x9')][_0xedce99[_0xd4e5('0x16')]]);}this[_0xd4e5('0x15')](_0xd4e5('0x2a'),_0xd4e5('0x2b'),this[_0xd4e5('0x9')][_0xedce99[_0xd4e5('0x16')]]);}}}catch(_0x4e871d){logger['error']('[syncDialEnd][VoiceDialReport]',util[_0xd4e5('0x20')](_0x4e871d,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xd4e5('0x14')][_0xd4e5('0x12')]=function(_0x220fe6){try{if(this[_0xd4e5('0x2c')](_0x220fe6)){this[_0xd4e5('0x2d')](_0x220fe6[_0xd4e5('0x16')],_[_0xd4e5('0x2e')](_0x220fe6[_0xd4e5('0x2f')])[0x0],_0x220fe6[_0xd4e5('0x30')]);if(this[_0xd4e5('0x2c')](_0x220fe6[_0xd4e5('0x2f')])&&this[_0xd4e5('0x2c')](_0x220fe6[_0xd4e5('0x2f')][_0xd4e5('0x31')])){if(_['isUndefined'](this['channels'][_0x220fe6[_0xd4e5('0x16')]])){this[_0xd4e5('0x9')][_0x220fe6[_0xd4e5('0x16')]]={'routeId':_0x220fe6[_0xd4e5('0x30')],'variables':this[_0xd4e5('0xc')][_0x220fe6[_0xd4e5('0x16')]]};this['emit'](_0xd4e5('0x2a'),'voice_outbound_channel:save',this['channels'][_0x220fe6[_0xd4e5('0x16')]]);}}}}catch(_0x5a3703){logger[_0xd4e5('0x32')](_0xd4e5('0x33'),util[_0xd4e5('0x20')](_0x5a3703,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xd4e5('0x14')][_0xd4e5('0x2d')]=function(_0x203886,_0x5d2f30,_0x393b61){var _0x17ffd1=['rtpaudioqos',_0xd4e5('0x34'),_0xd4e5('0x35'),'rtpaudioqosjitterbridged',_0xd4e5('0x36'),_0xd4e5('0x37'),_0xd4e5('0x38'),_0xd4e5('0x39'),_0xd4e5('0x3a'),'sipuri',_0xd4e5('0x3b'),_0xd4e5('0x3c'),_0xd4e5('0x3d'),_0xd4e5('0x3e'),_0xd4e5('0x3f'),_0xd4e5('0x40'),_0xd4e5('0x41'),_0xd4e5('0x42'),_0xd4e5('0x43')];if(!_[_0xd4e5('0x44')](_0x5d2f30)&&!_[_0xd4e5('0x45')](_0x17ffd1,_0x5d2f30)){if(_[_0xd4e5('0x46')](this[_0xd4e5('0xc')][_0x203886])){this[_0xd4e5('0xc')][_0x203886]={};}this['variables'][_0x203886][_0x5d2f30]=_0x393b61;}};VoiceDialReport['prototype'][_0xd4e5('0x13')]=function(_0x4e7f0c){try{if(this[_0xd4e5('0x2c')](_0x4e7f0c)){if(this[_0xd4e5('0x9')][_0x4e7f0c[_0xd4e5('0x16')]]){this[_0xd4e5('0x9')][_0x4e7f0c[_0xd4e5('0x16')]][_0xd4e5('0x47')]=moment()[_0xd4e5('0x18')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xd4e5('0x9')][_0x4e7f0c['uniqueid']][_0xd4e5('0x48')]=moment(this[_0xd4e5('0x9')][_0x4e7f0c[_0xd4e5('0x16')]][_0xd4e5('0x47')])[_0xd4e5('0x49')](this[_0xd4e5('0x9')][_0x4e7f0c[_0xd4e5('0x16')]][_0xd4e5('0x4a')],_0xd4e5('0x4b'));this[_0xd4e5('0x9')][_0x4e7f0c[_0xd4e5('0x16')]][_0xd4e5('0x27')]='complete';this[_0xd4e5('0xb')][_0xd4e5('0x4c')]+=0x1;if(this[_0xd4e5('0x9')][_0x4e7f0c[_0xd4e5('0x16')]][_0xd4e5('0x25')]){this[_0xd4e5('0xb')][_0xd4e5('0x4d')]+=0x1;this[_0xd4e5('0x9')][_0x4e7f0c[_0xd4e5('0x16')]][_0xd4e5('0x4e')]=moment(this['channels'][_0x4e7f0c['uniqueid']]['answertime'])[_0xd4e5('0x49')](this[_0xd4e5('0x9')][_0x4e7f0c[_0xd4e5('0x16')]][_0xd4e5('0x4a')],_0xd4e5('0x4b'));this['channels'][_0x4e7f0c[_0xd4e5('0x16')]]['billableseconds']=moment(this[_0xd4e5('0x9')][_0x4e7f0c[_0xd4e5('0x16')]][_0xd4e5('0x47')])[_0xd4e5('0x49')](this[_0xd4e5('0x9')][_0x4e7f0c[_0xd4e5('0x16')]]['answertime'],_0xd4e5('0x4b'));this[_0xd4e5('0xb')]['sumHoldTime']+=this['channels'][_0x4e7f0c[_0xd4e5('0x16')]][_0xd4e5('0x4e')]||0x0;this[_0xd4e5('0xb')][_0xd4e5('0x4f')]+=this[_0xd4e5('0x9')][_0x4e7f0c[_0xd4e5('0x16')]][_0xd4e5('0x50')];}this[_0xd4e5('0xb')][_0xd4e5('0x51')]+=this[_0xd4e5('0x9')][_0x4e7f0c['uniqueid']][_0xd4e5('0x48')];ami[_0xd4e5('0x15')]('custom:voiceDialReport',this['channels'][_0x4e7f0c[_0xd4e5('0x16')]]);ami['emit']('custom:dialend',this[_0xd4e5('0x9')][_0x4e7f0c['uniqueid']]);this[_0xd4e5('0x15')](_0xd4e5('0x2a'),_0xd4e5('0x52'),this[_0xd4e5('0xb')]);logger[_0xd4e5('0x53')](_0xd4e5('0x54'),JSON[_0xd4e5('0x55')](this['channels'][_0x4e7f0c[_0xd4e5('0x16')]]));this[_0xd4e5('0x15')](_0xd4e5('0x2a'),_0xd4e5('0x56'),this[_0xd4e5('0x9')][_0x4e7f0c[_0xd4e5('0x16')]]);delete this[_0xd4e5('0x9')][_0x4e7f0c[_0xd4e5('0x16')]];}if(this[_0xd4e5('0xc')][_0x4e7f0c[_0xd4e5('0x16')]]){delete this[_0xd4e5('0xc')][_0x4e7f0c[_0xd4e5('0x16')]];}}}catch(_0x6d0ec1){logger['error']('[syncHangup][VoiceDialReport]',util[_0xd4e5('0x20')](_0x6d0ec1,{'showHidden':![],'depth':null}));}};module[_0xd4e5('0x57')]=VoiceDialReport; \ No newline at end of file +var _0x6b6d=['answered','holdtime','billableseconds','sumHoldTime','sumBillable','custom:voiceDialReport','custom:dialend','voice_outbound:save','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','stringify','voice_outbound_channel:remove','[syncHangup][VoiceDialReport]','exports','lodash','moment','util','ioredis','../../../config/logger','ami','../ami','redis','localhost','socket.io-emitter','channels','outboundChannels','outbound','variables','bind','dialend','varset','syncVarSet','hangup','syncHangup','prototype','isNotNull','isUndefined','emit','syncDialBegin','uniqueid','merge','format','YYYY-MM-DD\x20HH:mm:ss','called','channel','lastIndexOf','substring','omit','event','privilege','voice:outbound','voice_outbound_channel:save','[syncDialBegin][VoiceDialReport]','dialstatus','connectedlinenum','connectedlinename','lastevent','connect','custom:dialconnect','error','[syncDialEnd][VoiceDialReport]','inspect','addVariable','keys','variable','outboundrouteid','value','[syncVarSet][VoiceDialReport]','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipuri','bridgepeer','bridgepvtcallid','memberdynamic','memberinterface','memberlastcall','membername','isNil','includes','duration','endtime','diff','starttime','seconds','answertime'];(function(_0x5a620b,_0x16b2c0){var _0x3a2ba4=function(_0x2ac57b){while(--_0x2ac57b){_0x5a620b['push'](_0x5a620b['shift']());}};_0x3a2ba4(++_0x16b2c0);}(_0x6b6d,0xbd));var _0xd6b6=function(_0x54edc9,_0x345f01){_0x54edc9=_0x54edc9-0x0;var _0x2ae7a9=_0x6b6d[_0x54edc9];return _0x2ae7a9;};'use strict';var _=require(_0xd6b6('0x0'));var moment=require(_0xd6b6('0x1'));var util=require(_0xd6b6('0x2'));var Redis=require(_0xd6b6('0x3'));var config=require('../../../config/environment');var logger=require(_0xd6b6('0x4'))(_0xd6b6('0x5'));var ami=require(_0xd6b6('0x6'));config[_0xd6b6('0x7')]=_['defaults'](config[_0xd6b6('0x7')],{'host':_0xd6b6('0x8'),'port':0x18eb});var io=require(_0xd6b6('0x9'))(new Redis(config['redis']));function VoiceDialReport(_0x1d4fa7){this[_0xd6b6('0xa')]=_0x1d4fa7[_0xd6b6('0xb')];this[_0xd6b6('0xc')]=_0x1d4fa7[_0xd6b6('0xc')];this[_0xd6b6('0xd')]={};ami['on']('dialbegin',this['syncDialBegin'][_0xd6b6('0xe')](this));ami['on'](_0xd6b6('0xf'),this['syncDialEnd'][_0xd6b6('0xe')](this));ami['on'](_0xd6b6('0x10'),this[_0xd6b6('0x11')][_0xd6b6('0xe')](this));ami['on'](_0xd6b6('0x12'),this[_0xd6b6('0x13')][_0xd6b6('0xe')](this));}VoiceDialReport[_0xd6b6('0x14')][_0xd6b6('0x15')]=function(_0x4c423a){return _0x4c423a!==null&&!_[_0xd6b6('0x16')](_0x4c423a);};VoiceDialReport[_0xd6b6('0x14')][_0xd6b6('0x17')]=function(_0x121e6d,_0x4fa74c,_0x427410){io['to'](_0x121e6d)[_0xd6b6('0x17')](_0x4fa74c,_0x427410);};VoiceDialReport[_0xd6b6('0x14')][_0xd6b6('0x18')]=function(_0x3f0d23){try{if(this[_0xd6b6('0x15')](_0x3f0d23)){if(this[_0xd6b6('0xa')][_0x3f0d23[_0xd6b6('0x19')]]){_[_0xd6b6('0x1a')](this[_0xd6b6('0xa')][_0x3f0d23[_0xd6b6('0x19')]],{'starttime':moment()[_0xd6b6('0x1b')](_0xd6b6('0x1c')),'lastevent':_0xd6b6('0x1d'),'interface':_0x3f0d23[_0xd6b6('0x1e')]['substring'](0x0,_0x3f0d23[_0xd6b6('0x1e')][_0xd6b6('0x1f')]('-')),'membername':_0x3f0d23[_0xd6b6('0x1e')][_0xd6b6('0x20')](_0x3f0d23['channel'][_0xd6b6('0x1f')]('/')+0x1,_0x3f0d23['channel']['lastIndexOf']('-'))},_[_0xd6b6('0x21')](_0x3f0d23,[_0xd6b6('0x22'),_0xd6b6('0x23')]));this[_0xd6b6('0x17')](_0xd6b6('0x24'),_0xd6b6('0x25'),this[_0xd6b6('0xa')][_0x3f0d23[_0xd6b6('0x19')]]);ami[_0xd6b6('0x17')]('custom:dialbegin',this[_0xd6b6('0xa')][_0x3f0d23['uniqueid']]);}}}catch(_0x5626da){logger['error'](_0xd6b6('0x26'),util['inspect'](_0x5626da,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xd6b6('0x14')]['syncDialEnd']=function(_0x10c2d9){try{if(this[_0xd6b6('0x15')](_0x10c2d9)){if(this[_0xd6b6('0xa')][_0x10c2d9[_0xd6b6('0x19')]]){this[_0xd6b6('0xa')][_0x10c2d9[_0xd6b6('0x19')]][_0xd6b6('0x27')]=_0x10c2d9[_0xd6b6('0x27')];if(_0x10c2d9[_0xd6b6('0x27')]==='ANSWER'){this[_0xd6b6('0xa')][_0x10c2d9['uniqueid']]['connectedlinenum']=_0x10c2d9[_0xd6b6('0x28')];this[_0xd6b6('0xa')][_0x10c2d9[_0xd6b6('0x19')]][_0xd6b6('0x29')]=_0x10c2d9[_0xd6b6('0x29')];this['channels'][_0x10c2d9['uniqueid']]['answertime']=moment()[_0xd6b6('0x1b')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xd6b6('0xa')][_0x10c2d9['uniqueid']][_0xd6b6('0x2a')]=_0xd6b6('0x2b');ami[_0xd6b6('0x17')](_0xd6b6('0x2c'),this[_0xd6b6('0xa')][_0x10c2d9[_0xd6b6('0x19')]]);}this['emit'](_0xd6b6('0x24'),'voice_outbound_channel:save',this[_0xd6b6('0xa')][_0x10c2d9[_0xd6b6('0x19')]]);}}}catch(_0x3a2009){logger[_0xd6b6('0x2d')](_0xd6b6('0x2e'),util[_0xd6b6('0x2f')](_0x3a2009,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xd6b6('0x14')][_0xd6b6('0x11')]=function(_0xb7e9a4){try{if(this['isNotNull'](_0xb7e9a4)){this[_0xd6b6('0x30')](_0xb7e9a4[_0xd6b6('0x19')],_[_0xd6b6('0x31')](_0xb7e9a4[_0xd6b6('0x32')])[0x0],_0xb7e9a4['value']);if(this[_0xd6b6('0x15')](_0xb7e9a4['variable'])&&this[_0xd6b6('0x15')](_0xb7e9a4['variable'][_0xd6b6('0x33')])){if(_[_0xd6b6('0x16')](this[_0xd6b6('0xa')][_0xb7e9a4[_0xd6b6('0x19')]])){this[_0xd6b6('0xa')][_0xb7e9a4[_0xd6b6('0x19')]]={'routeId':_0xb7e9a4[_0xd6b6('0x34')],'variables':this[_0xd6b6('0xd')][_0xb7e9a4['uniqueid']]};this[_0xd6b6('0x17')](_0xd6b6('0x24'),'voice_outbound_channel:save',this[_0xd6b6('0xa')][_0xb7e9a4['uniqueid']]);}}}}catch(_0x5b25c3){logger[_0xd6b6('0x2d')](_0xd6b6('0x35'),util[_0xd6b6('0x2f')](_0x5b25c3,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0xd6b6('0x30')]=function(_0x5a9cdc,_0x1e91c1,_0x299a25){var _0x4a1883=[_0xd6b6('0x36'),'rtpaudioqosbridged',_0xd6b6('0x37'),'rtpaudioqosjitterbridged',_0xd6b6('0x38'),_0xd6b6('0x39'),_0xd6b6('0x3a'),_0xd6b6('0x3b'),'sipcallid',_0xd6b6('0x3c'),_0xd6b6('0x3d'),_0xd6b6('0x3e'),'membercalls',_0xd6b6('0x3f'),_0xd6b6('0x40'),_0xd6b6('0x41'),_0xd6b6('0x42'),'memberpenalty','memberrealtime'];if(!_[_0xd6b6('0x43')](_0x1e91c1)&&!_[_0xd6b6('0x44')](_0x4a1883,_0x1e91c1)){if(_['isUndefined'](this[_0xd6b6('0xd')][_0x5a9cdc])){this['variables'][_0x5a9cdc]={};}this[_0xd6b6('0xd')][_0x5a9cdc][_0x1e91c1]=_0x299a25;}};VoiceDialReport['prototype'][_0xd6b6('0x13')]=function(_0x492f0d){try{if(this[_0xd6b6('0x15')](_0x492f0d)){if(this[_0xd6b6('0xa')][_0x492f0d[_0xd6b6('0x19')]]){this[_0xd6b6('0xa')][_0x492f0d['uniqueid']]['endtime']=moment()[_0xd6b6('0x1b')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xd6b6('0xa')][_0x492f0d[_0xd6b6('0x19')]][_0xd6b6('0x45')]=moment(this['channels'][_0x492f0d[_0xd6b6('0x19')]][_0xd6b6('0x46')])[_0xd6b6('0x47')](this[_0xd6b6('0xa')][_0x492f0d[_0xd6b6('0x19')]][_0xd6b6('0x48')],_0xd6b6('0x49'));this[_0xd6b6('0xa')][_0x492f0d['uniqueid']][_0xd6b6('0x2a')]='complete';this['outbound']['total']+=0x1;if(this[_0xd6b6('0xa')][_0x492f0d[_0xd6b6('0x19')]][_0xd6b6('0x4a')]){this['outbound'][_0xd6b6('0x4b')]+=0x1;this[_0xd6b6('0xa')][_0x492f0d[_0xd6b6('0x19')]][_0xd6b6('0x4c')]=moment(this[_0xd6b6('0xa')][_0x492f0d[_0xd6b6('0x19')]][_0xd6b6('0x4a')])[_0xd6b6('0x47')](this[_0xd6b6('0xa')][_0x492f0d[_0xd6b6('0x19')]][_0xd6b6('0x48')],_0xd6b6('0x49'));this[_0xd6b6('0xa')][_0x492f0d['uniqueid']][_0xd6b6('0x4d')]=moment(this[_0xd6b6('0xa')][_0x492f0d[_0xd6b6('0x19')]][_0xd6b6('0x46')])[_0xd6b6('0x47')](this[_0xd6b6('0xa')][_0x492f0d[_0xd6b6('0x19')]]['answertime'],'seconds');this[_0xd6b6('0xc')][_0xd6b6('0x4e')]+=this[_0xd6b6('0xa')][_0x492f0d[_0xd6b6('0x19')]][_0xd6b6('0x4c')]||0x0;this[_0xd6b6('0xc')][_0xd6b6('0x4f')]+=this[_0xd6b6('0xa')][_0x492f0d[_0xd6b6('0x19')]]['billableseconds'];}this[_0xd6b6('0xc')]['sumDuration']+=this[_0xd6b6('0xa')][_0x492f0d[_0xd6b6('0x19')]]['duration'];ami[_0xd6b6('0x17')](_0xd6b6('0x50'),this[_0xd6b6('0xa')][_0x492f0d[_0xd6b6('0x19')]]);ami['emit'](_0xd6b6('0x51'),this[_0xd6b6('0xa')][_0x492f0d['uniqueid']]);this[_0xd6b6('0x17')](_0xd6b6('0x24'),_0xd6b6('0x52'),this[_0xd6b6('0xc')]);logger['info'](_0xd6b6('0x53'),JSON[_0xd6b6('0x54')](this['channels'][_0x492f0d[_0xd6b6('0x19')]]));this[_0xd6b6('0x17')](_0xd6b6('0x24'),_0xd6b6('0x55'),this[_0xd6b6('0xa')][_0x492f0d[_0xd6b6('0x19')]]);delete this[_0xd6b6('0xa')][_0x492f0d[_0xd6b6('0x19')]];}if(this[_0xd6b6('0xd')][_0x492f0d[_0xd6b6('0x19')]]){delete this['variables'][_0x492f0d[_0xd6b6('0x19')]];}}}catch(_0x4a86f6){logger[_0xd6b6('0x2d')](_0xd6b6('0x56'),util[_0xd6b6('0x2f')](_0x4a86f6,{'showHidden':![],'depth':null}));}};module[_0xd6b6('0x57')]=VoiceDialReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceQueueReport.js b/server/services/ami/report/voiceQueueReport.js index f2d86e8..d88560b 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 _0x1da6=['connectedlinename','[syncQueueCallerLeave][VoiceQueueReport]','assigned','queuecallerexitAt','transfer','reason','COMPLETED','toLowerCase','local/','linkedid','queuecallerexit','queuecallerjoinAt','add','seconds','FORWARDTRANSFER','FORWARD','transferexten','destexten','COMPLETEDBY','toUpperCase','[syncAgentComplete][VoiceQueueReport]','addVariable','variable','value','queuestatus','TIMEOUT','lastevent','timeout','custom:timeout','queueposition','EXITWITHKEY','[syncVarSet][VoiceQueueReport]','rtpaudioqos','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipuri','bridgepeer','bridgepvtcallid','memberdynamic','memberinterface','memberlastcall','membername','memberpenalty','memberrealtime','includes','length','unmanaged','milliseconds','diff','answered','sumBillable','queuecallercompleteAt','custom:queuecallerunmanaged','custom:queuecallerabandon','sumHoldTime','custom:voiceQueueReport','transfereeuniqueid','secondtransfererexten','transferuniqueid','secondtransfereruniqueid','ATTENDEDTRANSFER','transfertype','transfertargetuniqueid','origtransfereruniqueid','ATTENDED','BLINDTRANSFER','BLIND','BlindTransfer','context','mohstarttime','[syncMusicOnHoldStart][VoiceQueueReport]','[syncMusicOnHoldStop][VoiceQueueReport]','lodash','moment','bluebird','util','ioredis','../../../config/logger','ami','../model/queueReport','redis','defaults','localhost','socket.io-emitter','prototype','enqueue','tail','finally','sequence','agents','queueChannels','voiceQueues','flagQueueSummary','campaigns','queuesummary','syncQueueSummary','queuesummarycomplete','syncQueueSummaryComplete','bind','queuecallerjoin','syncQueueCallerJoin','queuecallerabandon','queuecallerleave','syncQueueCallerLeave','syncAgentComplete','syncAgentConnect','varset','syncVarSet','hangup','syncHangup','fullybooted','syncFullyBooted','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopQueueSummary','loopQueueShow','isUndefined','hasOwnProperty','isEmpty','originated','pTalking','waiting','queueStatusComplete','unlockRR','channels','isNil','Action','channel','message','No\x20such\x20channel','error','[voiceQueueReport][checkChannel]','queueReports','[voiceQueueReport][checkQueueReport]','variables','[voiceQueueReport][checkVariables]','[FullyBooted]\x20clear\x20realtime','clearQueueReport','inspect','emit','emitVoiceQueueChannelSave','format','voice:queue:%s','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','voice_queue_channel:remove','type','inbound','name','strategy','available','sumDuration','talking','total','abandoned','Trunk','active','Interval','md5','voice_queue:save','isNotNull','clearZombieChannels','catch','[queues]','then','queue','toNumber','loggedin','loggedIn','emitVoiceQueueSummary','custom:queuesummary','[syncQueueSummary][VoiceQueueReport]','syncNewExten','uniqueid','position','count','merge','pick','keys','push','[syncQueueCallerJoin][VoiceQueueReport]','syncQueueCallerAbandon','queuecallercomplete','holdtime','originalposition','queuecallerabandonAt','queuecallerexitreason','ABANDONED','lastAssignedTo','emitVoiceQueueChannelRemove','[syncQueueCallerAbandon][VoiceQueueReport]','last','queuecallerleaveAt','YYYY-MM-DD\x20HH:mm:ss','connectedlinenum'];(function(_0x1d2a1c,_0x16431c){var _0x5cbd69=function(_0x2fb543){while(--_0x2fb543){_0x1d2a1c['push'](_0x1d2a1c['shift']());}};_0x5cbd69(++_0x16431c);}(_0x1da6,0x117));var _0x61da=function(_0x5aaf93,_0x5c0001){_0x5aaf93=_0x5aaf93-0x0;var _0x17d307=_0x1da6[_0x5aaf93];return _0x17d307;};'use strict';var _=require(_0x61da('0x0'));var moment=require(_0x61da('0x1'));var BPromise=require(_0x61da('0x2'));var util=require(_0x61da('0x3'));var md5=require('md5');var Redis=require(_0x61da('0x4'));var config=require('../../../config/environment');var logger=require(_0x61da('0x5'))(_0x61da('0x6'));var ami=require('../ami');var QueueReport=require(_0x61da('0x7'));config[_0x61da('0x8')]=_[_0x61da('0x9')](config[_0x61da('0x8')],{'host':_0x61da('0xa'),'port':0x18eb});var io=require(_0x61da('0xb'))(new Redis(config[_0x61da('0x8')]));var Sequence=function(){};Sequence[_0x61da('0xc')][_0x61da('0xd')]=function(_0xec9112){this[_0x61da('0xe')]=this[_0x61da('0xe')]?this[_0x61da('0xe')][_0x61da('0xf')](_0xec9112):_0xec9112();};function VoiceQueueReport(_0x30c10a){this[_0x61da('0x10')]=new Sequence();this['queueReports']={};this[_0x61da('0x11')]=_0x30c10a['agents'];this['channels']=_0x30c10a[_0x61da('0x12')];this[_0x61da('0x13')]=_0x30c10a[_0x61da('0x13')];this[_0x61da('0x14')]=!![];this[_0x61da('0x15')]=_0x30c10a[_0x61da('0x15')];this['variables']={};ami['on'](_0x61da('0x16'),this[_0x61da('0x17')]['bind'](this));ami['on'](_0x61da('0x18'),this[_0x61da('0x19')][_0x61da('0x1a')](this));ami['on'](_0x61da('0x1b'),this[_0x61da('0x1c')]['bind'](this));ami['on'](_0x61da('0x1d'),this['syncQueueCallerAbandon'][_0x61da('0x1a')](this));ami['on'](_0x61da('0x1e'),this[_0x61da('0x1f')]['bind'](this));ami['on']('agentcomplete',this[_0x61da('0x20')]['bind'](this));ami['on']('agentconnect',this[_0x61da('0x21')]['bind'](this));ami['on'](_0x61da('0x22'),this[_0x61da('0x23')][_0x61da('0x1a')](this));ami['on'](_0x61da('0x24'),this[_0x61da('0x25')][_0x61da('0x1a')](this));ami['on'](_0x61da('0x26'),this[_0x61da('0x27')][_0x61da('0x1a')](this));ami['on']('musiconholdstart',this[_0x61da('0x28')][_0x61da('0x1a')](this));ami['on'](_0x61da('0x29'),this[_0x61da('0x2a')][_0x61da('0x1a')](this));ami['on'](_0x61da('0x2b'),this[_0x61da('0x2c')]['bind'](this));ami['on'](_0x61da('0x2d'),this[_0x61da('0x2e')][_0x61da('0x1a')](this));this[_0x61da('0x2f')]();this[_0x61da('0x30')]();}function isNotNull(_0x1cbc6a){return _0x1cbc6a!==null&&!_[_0x61da('0x31')](_0x1cbc6a);}function clearChannels(_0x1e429e){if(!_['isEmpty'](_0x1e429e)){for(var _0x5b05cd in _0x1e429e){if(_0x1e429e[_0x61da('0x32')](_0x5b05cd)){delete _0x1e429e[_0x5b05cd];}}}}function clearCampaigns(_0x56486b){if(!_[_0x61da('0x33')](_0x56486b)){for(var _0x309f70 in _0x56486b){if(_0x56486b[_0x61da('0x32')](_0x309f70)){_0x56486b[_0x309f70][_0x61da('0x34')]=0x0;}}}}function clearVoiceQueues(_0x394a0d){if(!_[_0x61da('0x33')](_0x394a0d)){for(var _0x38666a in _0x394a0d){if(_0x394a0d['hasOwnProperty'](_0x38666a)){_0x394a0d[_0x38666a][_0x61da('0x34')]=0x0;_0x394a0d[_0x38666a]['talking']=0x0;_0x394a0d[_0x38666a][_0x61da('0x35')]=0x0;_0x394a0d[_0x38666a][_0x61da('0x36')]=0x0;_0x394a0d[_0x38666a][_0x61da('0x37')]=!![];}}}}function clearAgentBooked(_0x1a5859){if(!_[_0x61da('0x33')](_0x1a5859)){for(var _0x7a1702 in _0x1a5859){if(_0x1a5859['hasOwnProperty'](_0x7a1702)){_0x1a5859[_0x7a1702][_0x61da('0x38')]=!![];}}}}VoiceQueueReport[_0x61da('0xc')]['clearZombieChannels']=function(){var _0x41e08b=this;for(var _0x2e552d in this[_0x61da('0x39')]){if(this[_0x61da('0x39')][_0x61da('0x32')](_0x2e552d)&&!this[_0x61da('0x39')][_0x2e552d]['switch']){this[_0x61da('0x10')][_0x61da('0xd')](function(){if(!_[_0x61da('0x3a')](_0x41e08b[_0x61da('0x39')][_0x2e552d])){return ami[_0x61da('0x3b')]({'action':'status','channel':_0x41e08b[_0x61da('0x39')][_0x2e552d][_0x61da('0x3c')]})['catch'](function(_0x79ab7a){if(_0x79ab7a[_0x61da('0x3d')]===_0x61da('0x3e')){setTimeout(function(){if(_0x41e08b[_0x61da('0x39')][_0x2e552d]){delete _0x41e08b[_0x61da('0x39')][_0x2e552d];logger[_0x61da('0x3f')](_0x61da('0x40'),_0x2e552d);}if(_0x41e08b[_0x61da('0x41')][_0x2e552d]){delete _0x41e08b[_0x61da('0x41')][_0x2e552d];logger[_0x61da('0x3f')](_0x61da('0x42'),_0x2e552d);}if(_0x41e08b[_0x61da('0x43')][_0x2e552d]){delete _0x41e08b[_0x61da('0x43')][_0x2e552d];logger['error'](_0x61da('0x44'),_0x2e552d);}},0x1f40);}});}});}}};VoiceQueueReport['prototype'][_0x61da('0x27')]=function(){logger[_0x61da('0x3f')](_0x61da('0x45'));clearChannels(this[_0x61da('0x39')]);this[_0x61da('0x46')](this[_0x61da('0x41')]);clearAgentBooked(this[_0x61da('0x11')]);clearVoiceQueues(this[_0x61da('0x13')]);clearCampaigns(this[_0x61da('0x15')]);};VoiceQueueReport[_0x61da('0xc')][_0x61da('0x46')]=function(_0x44bd14){var _0x1aaa4d=this;if(!_[_0x61da('0x33')](_0x44bd14)){for(var _0x18ddab in _0x44bd14){if(_0x44bd14['hasOwnProperty'](_0x18ddab)){_0x1aaa4d['emitVoiceQueueChannelRemove'](_0x44bd14[_0x18ddab]);delete _0x44bd14[_0x18ddab];}}}};function loggerCatch(_0x4b5c25){return function(_0x3825fe){logger[_0x61da('0x3f')](_0x4b5c25,util[_0x61da('0x47')](_0x3825fe,{'showHidden':![],'depth':null}));};}VoiceQueueReport['prototype'][_0x61da('0x48')]=function(_0x3d7ca5,_0x56ec3a,_0x4ad9a0){io['to'](_0x3d7ca5)[_0x61da('0x48')](_0x56ec3a,_0x4ad9a0);};VoiceQueueReport[_0x61da('0xc')][_0x61da('0x49')]=function(_0x34c56b){this[_0x61da('0x48')](util[_0x61da('0x4a')](_0x61da('0x4b'),_0x34c56b['name']),'voice_queue_channel:save',_0x34c56b);};VoiceQueueReport['prototype']['emitVoiceQueueChannelRemove']=function(_0x11b3e4){logger[_0x61da('0x4c')](_0x61da('0x4d'),JSON[_0x61da('0x4e')](_0x11b3e4));this[_0x61da('0x48')](util[_0x61da('0x4a')]('voice:queue:%s',_0x11b3e4['name']),_0x61da('0x4f'),_0x11b3e4);};VoiceQueueReport[_0x61da('0xc')]['emitVoiceQueueSummary']=function(_0x116eb5){if(_0x116eb5[_0x61da('0x50')]===_0x61da('0x51')){var _0x27f00d={'id':_0x116eb5['id'],'name':_0x116eb5[_0x61da('0x52')],'strategy':_0x116eb5[_0x61da('0x53')],'answered':_0x116eb5['answered'],'available':_0x116eb5[_0x61da('0x54')],'loggedIn':_0x116eb5['loggedIn'],'pTalking':_0x116eb5[_0x61da('0x35')],'sumBillable':_0x116eb5['sumBillable'],'sumDuration':_0x116eb5[_0x61da('0x55')],'sumHoldTime':_0x116eb5['sumHoldTime']||0x0,'talking':_0x116eb5[_0x61da('0x56')],'total':_0x116eb5[_0x61da('0x57')],'type':_0x116eb5[_0x61da('0x50')],'unmanaged':_0x116eb5['unmanaged'],'abandoned':_0x116eb5[_0x61da('0x58')],'waiting':_0x116eb5[_0x61da('0x36')]};if(_0x116eb5[_0x61da('0x59')]){_0x27f00d[_0x61da('0x59')]={'id':_0x116eb5[_0x61da('0x59')]['id'],'name':_0x116eb5['Trunk'][_0x61da('0x52')],'active':_0x116eb5[_0x61da('0x59')][_0x61da('0x5a')],'callerid':_0x116eb5['Trunk']['callerid']};}if(_0x116eb5['Interval']){_0x27f00d[_0x61da('0x5b')]={'id':_0x116eb5[_0x61da('0x5b')]['id'],'name':_0x116eb5[_0x61da('0x5b')][_0x61da('0x52')]};}var _0x8a26bc=md5(JSON[_0x61da('0x4e')](_0x27f00d));if(_0x116eb5[_0x61da('0x5c')]!==_0x8a26bc){_0x116eb5['md5']=_0x8a26bc;this['emit'](util[_0x61da('0x4a')](_0x61da('0x4b'),_0x27f00d['name']),_0x61da('0x5d'),_0x27f00d);}}};VoiceQueueReport[_0x61da('0xc')][_0x61da('0x5e')]=function(_0x3cc362){return _0x3cc362!==null&&!_['isUndefined'](_0x3cc362);};VoiceQueueReport[_0x61da('0xc')][_0x61da('0x30')]=function(){var _0x43e0dc=this;setInterval(function(){_0x43e0dc[_0x61da('0x5f')]();ami[_0x61da('0x3b')]({'action':'queues'})[_0x61da('0x60')](loggerCatch(_0x61da('0x61')));},0x2710);};VoiceQueueReport[_0x61da('0xc')]['loopQueueSummary']=function(){var _0xf83492=this;setInterval(function(){if(_0xf83492[_0x61da('0x14')]){return ami['Action']({'action':'queuesummary'})[_0x61da('0x62')](function(_0x134d7d){_0xf83492[_0x61da('0x14')]=![];})[_0x61da('0x60')](loggerCatch('[queuesummary]'));}},0x3e8);};VoiceQueueReport[_0x61da('0xc')][_0x61da('0x17')]=function(_0x31a1c3){try{if(this['isNotNull'](_0x31a1c3)&&this[_0x61da('0x5e')](_0x31a1c3[_0x61da('0x63')])){if(this['voiceQueues'][_0x31a1c3[_0x61da('0x63')]]){var _0x51c9b9=_['countBy'](this[_0x61da('0x39')],_0x61da('0x63'))[_0x31a1c3['queue']]||0x0;var _0x580072=_0x51c9b9-_0x31a1c3['callers'];if(this[_0x61da('0x13')][_0x31a1c3[_0x61da('0x63')]][_0x61da('0x36')]!==_[_0x61da('0x64')](_0x31a1c3['callers'])||this[_0x61da('0x13')][_0x31a1c3[_0x61da('0x63')]]['loggedIn']!==_[_0x61da('0x64')](_0x31a1c3[_0x61da('0x65')])||this[_0x61da('0x13')][_0x31a1c3[_0x61da('0x63')]][_0x61da('0x54')]!==_[_0x61da('0x64')](_0x31a1c3[_0x61da('0x54')])||this[_0x61da('0x13')][_0x31a1c3[_0x61da('0x63')]]['talking']!==_0x580072){this[_0x61da('0x13')][_0x31a1c3[_0x61da('0x63')]]['waiting']=_['toNumber'](_0x31a1c3['callers']);this[_0x61da('0x13')][_0x31a1c3[_0x61da('0x63')]][_0x61da('0x66')]=_[_0x61da('0x64')](_0x31a1c3[_0x61da('0x65')]);this[_0x61da('0x13')][_0x31a1c3[_0x61da('0x63')]][_0x61da('0x54')]=_[_0x61da('0x64')](_0x31a1c3[_0x61da('0x54')]);this['voiceQueues'][_0x31a1c3[_0x61da('0x63')]][_0x61da('0x56')]=_0x580072>0x0?_0x580072:0x0;this[_0x61da('0x13')][_0x31a1c3[_0x61da('0x63')]][_0x61da('0x56')]=this['voiceQueues'][_0x31a1c3['queue']]['talking']>_[_0x61da('0x64')](_0x31a1c3['loggedin'])?_[_0x61da('0x64')](_0x31a1c3[_0x61da('0x65')]):this[_0x61da('0x13')][_0x31a1c3[_0x61da('0x63')]]['talking'];this[_0x61da('0x67')](this['voiceQueues'][_0x31a1c3[_0x61da('0x63')]]);}ami[_0x61da('0x48')](_0x61da('0x68'),this[_0x61da('0x13')][_0x31a1c3[_0x61da('0x63')]]);}}}catch(_0x2bf9a3){logger[_0x61da('0x3f')](_0x61da('0x69'),util[_0x61da('0x47')](_0x2bf9a3,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x61da('0xc')][_0x61da('0x19')]=function(_0x325bc4){this[_0x61da('0x14')]=!![];};VoiceQueueReport[_0x61da('0xc')][_0x61da('0x6a')]=function(_0x5b580b){};VoiceQueueReport[_0x61da('0xc')]['syncQueueCallerJoin']=function(_0x54674f){try{if(this['isNotNull'](_0x54674f)){if(_[_0x61da('0x31')](this['queueReports'][_0x54674f['uniqueid']])){this['queueReports'][_0x54674f[_0x61da('0x6b')]]=[];this[_0x61da('0x39')][_0x54674f[_0x61da('0x6b')]]={};}var _0x459355=new QueueReport();_0x459355['name']=_0x54674f[_0x61da('0x63')];_0x459355[_0x61da('0x50')]=this[_0x61da('0x13')][_0x459355[_0x61da('0x52')]]&&this[_0x61da('0x13')][_0x459355[_0x61da('0x52')]][_0x61da('0x50')]?this[_0x61da('0x13')][_0x459355['name']][_0x61da('0x50')]||_0x61da('0x51'):_0x61da('0x51');_0x459355[_0x61da('0x63')]=_0x54674f['queue'];_0x459355['queuecallerjoinAt']=moment()[_0x61da('0x4a')]('YYYY-MM-DD\x20HH:mm:ss');_0x459355[_0x61da('0x6c')]=_0x54674f[_0x61da('0x6c')];_0x459355[_0x61da('0x6d')]=_0x54674f[_0x61da('0x6d')];_[_0x61da('0x6e')](_0x459355,_[_0x61da('0x6f')](_0x54674f,_[_0x61da('0x70')](_0x459355)));this[_0x61da('0x41')][_0x54674f[_0x61da('0x6b')]][_0x61da('0x71')](_0x459355);this['channels'][_0x54674f[_0x61da('0x6b')]]=_0x459355;this[_0x61da('0x49')](_0x459355);}}catch(_0x42be71){logger[_0x61da('0x3f')](_0x61da('0x72'),util[_0x61da('0x47')](_0x42be71,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x61da('0xc')][_0x61da('0x73')]=function(_0x47d70d){try{if(this['isNotNull'](_0x47d70d)){if(this[_0x61da('0x41')][_0x47d70d[_0x61da('0x6b')]]){var _0x35a509=_['last'](this[_0x61da('0x41')][_0x47d70d[_0x61da('0x6b')]]);_0x35a509[_0x61da('0x74')]=![];_0x35a509['queuecallercompleteAt']=null;_0x35a509[_0x61da('0x75')]=_0x47d70d['holdtime'];_0x35a509[_0x61da('0x76')]=_0x47d70d[_0x61da('0x76')];_0x35a509[_0x61da('0x1d')]=!![];_0x35a509[_0x61da('0x77')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x35a509[_0x61da('0x78')]=_0x61da('0x79');_0x35a509[_0x61da('0x7a')]=null;this[_0x61da('0x39')][_0x47d70d['uniqueid']]=_0x35a509;this[_0x61da('0x7b')](_0x35a509);}}}catch(_0x5c0fe5){logger[_0x61da('0x3f')](_0x61da('0x7c'),util[_0x61da('0x47')](_0x5c0fe5,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x61da('0xc')][_0x61da('0x1f')]=function(_0x3d839e){try{if(this[_0x61da('0x5e')](_0x3d839e)){if(this[_0x61da('0x41')][_0x3d839e[_0x61da('0x6b')]]){var _0x394156=_[_0x61da('0x7d')](this['queueReports'][_0x3d839e[_0x61da('0x6b')]]);_0x394156[_0x61da('0x7e')]=moment()[_0x61da('0x4a')](_0x61da('0x7f'));_0x394156[_0x61da('0x80')]=_0x3d839e[_0x61da('0x80')];_0x394156[_0x61da('0x81')]=_0x3d839e[_0x61da('0x81')];this['channels'][_0x3d839e[_0x61da('0x6b')]]=_0x394156;this[_0x61da('0x49')](_0x394156);}}}catch(_0x4e76dc){logger[_0x61da('0x3f')](_0x61da('0x82'),util[_0x61da('0x47')](_0x4e76dc,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x61da('0xc')][_0x61da('0x21')]=function(_0x31a237){try{if(this[_0x61da('0x5e')](_0x31a237)){if(this[_0x61da('0x41')][_0x31a237[_0x61da('0x6b')]]){var _0x1f6622=_['last'](this['queueReports'][_0x31a237[_0x61da('0x6b')]]);_0x1f6622[_0x61da('0x74')]=!![];_0x1f6622[_0x61da('0x78')]='COMPLETEDBYAGENT';}}}catch(_0x5e85b5){logger[_0x61da('0x3f')]('[syncAgentConnect][VoiceQueueReport]',util['inspect'](_0x5e85b5,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x61da('0xc')][_0x61da('0x20')]=function(_0x1e78d2){try{if(this[_0x61da('0x5e')](_0x1e78d2)){if(this['queueReports'][_0x1e78d2[_0x61da('0x6b')]]){var _0x35ed2f=_['last'](this['queueReports'][_0x1e78d2[_0x61da('0x6b')]]);_0x35ed2f[_0x61da('0x1d')]=![];_0x35ed2f['queuecallerabandonAt']=null;_0x35ed2f[_0x61da('0x83')]=!![];_0x35ed2f[_0x61da('0x7a')]=_0x1e78d2['membername'];_0x35ed2f['holdtime']=_0x1e78d2[_0x61da('0x75')];_0x35ed2f[_0x61da('0x74')]=!![];_0x35ed2f['queuecallerexit']=![];_0x35ed2f[_0x61da('0x84')]=null;if(!_0x35ed2f[_0x61da('0x85')]){if(_0x1e78d2[_0x61da('0x86')]==_0x61da('0x85')){_0x35ed2f[_0x61da('0x78')]=_0x61da('0x87');}else{if(_['startsWith'](_0x1e78d2[_0x61da('0x3c')][_0x61da('0x88')](),_0x61da('0x89'))){if(this[_0x61da('0x41')][_0x1e78d2['linkedid']]){var _0x47824f=_['last'](this[_0x61da('0x41')][_0x1e78d2[_0x61da('0x8a')]]);_0x47824f['queuecallercomplete']=![];_0x47824f[_0x61da('0x8b')]=!![];_0x47824f[_0x61da('0x84')]=moment(_0x35ed2f[_0x61da('0x8c')])[_0x61da('0x8d')](_0x1e78d2[_0x61da('0x75')],_0x61da('0x8e'))[_0x61da('0x4a')](_0x61da('0x7f'));_0x47824f['queuecallerexitreason']=_0x61da('0x8f');_0x47824f[_0x61da('0x85')]=!![];_0x47824f['transfertype']=_0x61da('0x90');_0x47824f[_0x61da('0x91')]=_0x1e78d2[_0x61da('0x92')];_0x47824f['transferuniqueid']=_0x1e78d2[_0x61da('0x6b')];var _0x412974=this[_0x61da('0x41')][_0x1e78d2[_0x61da('0x8a')]];this[_0x61da('0x41')][_0x1e78d2[_0x61da('0x8a')]]=this[_0x61da('0x41')][_0x1e78d2[_0x61da('0x6b')]];this[_0x61da('0x41')][_0x1e78d2['uniqueid']]=_0x412974;}}else{_0x35ed2f[_0x61da('0x78')]=_0x61da('0x93')+_0x1e78d2['reason'][_0x61da('0x94')]();}}}this[_0x61da('0x39')][_0x1e78d2[_0x61da('0x6b')]]=_0x35ed2f;this[_0x61da('0x7b')](_0x35ed2f);}}}catch(_0x403565){logger['error'](_0x61da('0x95'),util[_0x61da('0x47')](_0x403565,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x61da('0x23')]=function(_0x5539bb){try{if(this[_0x61da('0x5e')](_0x5539bb)){this[_0x61da('0x96')](_0x5539bb['uniqueid'],_[_0x61da('0x70')](_0x5539bb[_0x61da('0x97')])[0x0],_0x5539bb[_0x61da('0x98')]);if(this[_0x61da('0x41')][_0x5539bb['uniqueid']]){var _0x555f84=_[_0x61da('0x7d')](this[_0x61da('0x41')][_0x5539bb[_0x61da('0x6b')]]);if(_0x555f84){if(this[_0x61da('0x5e')](_0x5539bb[_0x61da('0x97')])&&this[_0x61da('0x5e')](_0x5539bb[_0x61da('0x97')][_0x61da('0x99')])){switch(_0x5539bb[_0x61da('0x98')]){case'CONTINUE':_0x555f84['queuecallerexit']=![];_0x555f84[_0x61da('0x84')]=null;break;case _0x61da('0x9a'):_0x555f84[_0x61da('0x9b')]=_0x61da('0x9c');ami[_0x61da('0x48')](_0x61da('0x9d'),_0x555f84);break;default:_0x555f84[_0x61da('0x8b')]=!![];_0x555f84[_0x61da('0x84')]=moment()[_0x61da('0x4a')](_0x61da('0x7f'));_0x555f84[_0x61da('0x7e')]=moment()[_0x61da('0x4a')](_0x61da('0x7f'));}_0x555f84[_0x61da('0x1d')]=![];_0x555f84[_0x61da('0x77')]=null;_0x555f84['queuecallerexitreason']=_0x5539bb[_0x61da('0x98')];this[_0x61da('0x39')][_0x5539bb[_0x61da('0x6b')]]=_0x555f84;this[_0x61da('0x7b')](_0x555f84);}else if(this[_0x61da('0x5e')](_0x5539bb[_0x61da('0x97')])&&this[_0x61da('0x5e')](_0x5539bb[_0x61da('0x97')][_0x61da('0x9e')])){if(!_0x555f84['queuecallerabandon']){_0x555f84['queuecallerexit']=!![];_0x555f84['queuecallerexitAt']=moment()[_0x61da('0x4a')]('YYYY-MM-DD\x20HH:mm:ss');_0x555f84['queuecallerexitreason']=_0x61da('0x9f');_0x555f84[_0x61da('0x7e')]=moment()['format'](_0x61da('0x7f'));this[_0x61da('0x39')][_0x5539bb[_0x61da('0x6b')]]=_0x555f84;}}_0x555f84[_0x61da('0x43')]=this['variables'][_0x5539bb['uniqueid']];}}}}catch(_0x172a59){logger[_0x61da('0x3f')](_0x61da('0xa0'),util[_0x61da('0x47')](_0x172a59,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x61da('0xc')][_0x61da('0x96')]=function(_0x43ddf6,_0x246c1d,_0x84e4a8){var _0x1c44be=[_0x61da('0xa1'),'rtpaudioqosbridged','rtpaudioqosjitter',_0x61da('0xa2'),_0x61da('0xa3'),_0x61da('0xa4'),_0x61da('0xa5'),_0x61da('0xa6'),'sipcallid',_0x61da('0xa7'),_0x61da('0xa8'),_0x61da('0xa9'),'membercalls',_0x61da('0xaa'),_0x61da('0xab'),_0x61da('0xac'),_0x61da('0xad'),_0x61da('0xae'),_0x61da('0xaf')];if(!_['isNil'](_0x246c1d)&&!_[_0x61da('0xb0')](_0x1c44be,_0x246c1d)){if(_['isUndefined'](this['variables'][_0x43ddf6])){this[_0x61da('0x43')][_0x43ddf6]={};}this[_0x61da('0x43')][_0x43ddf6][_0x246c1d]=_0x84e4a8;}};VoiceQueueReport[_0x61da('0xc')][_0x61da('0x25')]=function(_0x10cb3d){try{if(this[_0x61da('0x5e')](_0x10cb3d)){if(this[_0x61da('0x41')][_0x10cb3d['uniqueid']]){for(var _0xe081=0x0,_0x2283bf={};_0xe0810x0?_0x2d8346:0x0;this['voiceQueues'][_0x397cd3[_0x05c4('0x64')]][_0x05c4('0x32')]=this[_0x05c4('0x12')][_0x397cd3[_0x05c4('0x64')]][_0x05c4('0x32')]>_[_0x05c4('0x67')](_0x397cd3[_0x05c4('0x68')])?_[_0x05c4('0x67')](_0x397cd3[_0x05c4('0x68')]):this[_0x05c4('0x12')][_0x397cd3[_0x05c4('0x64')]][_0x05c4('0x32')];this[_0x05c4('0x4e')](this[_0x05c4('0x12')][_0x397cd3[_0x05c4('0x64')]]);}ami[_0x05c4('0x47')](_0x05c4('0x69'),this[_0x05c4('0x12')][_0x397cd3[_0x05c4('0x64')]]);}}}catch(_0x44d8c0){logger[_0x05c4('0x3f')]('[syncQueueSummary][VoiceQueueReport]',util[_0x05c4('0x46')](_0x44d8c0,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x05c4('0x9')][_0x05c4('0x17')]=function(_0x25c4da){this[_0x05c4('0x13')]=!![];};VoiceQueueReport[_0x05c4('0x9')]['syncNewExten']=function(_0x3bcb3f){};VoiceQueueReport[_0x05c4('0x9')][_0x05c4('0x6a')]=function(_0x5ea7bd){try{if(this['isNotNull'](_0x5ea7bd)){if(_['isUndefined'](this[_0x05c4('0xe')][_0x5ea7bd[_0x05c4('0x6b')]])){this[_0x05c4('0xe')][_0x5ea7bd[_0x05c4('0x6b')]]=[];this[_0x05c4('0x10')][_0x5ea7bd[_0x05c4('0x6b')]]={};}var _0x1cf37f=new QueueReport();_0x1cf37f[_0x05c4('0x4b')]=_0x5ea7bd[_0x05c4('0x64')];_0x1cf37f['type']=this[_0x05c4('0x12')][_0x1cf37f[_0x05c4('0x4b')]]&&this[_0x05c4('0x12')][_0x1cf37f[_0x05c4('0x4b')]][_0x05c4('0x4f')]?this[_0x05c4('0x12')][_0x1cf37f[_0x05c4('0x4b')]][_0x05c4('0x4f')]||_0x05c4('0x50'):_0x05c4('0x50');_0x1cf37f['queue']=_0x5ea7bd[_0x05c4('0x64')];_0x1cf37f[_0x05c4('0x6c')]=moment()[_0x05c4('0x49')](_0x05c4('0x6d'));_0x1cf37f[_0x05c4('0x6e')]=_0x5ea7bd[_0x05c4('0x6e')];_0x1cf37f[_0x05c4('0x6f')]=_0x5ea7bd[_0x05c4('0x6f')];_[_0x05c4('0x70')](_0x1cf37f,_['pick'](_0x5ea7bd,_[_0x05c4('0x71')](_0x1cf37f)));this[_0x05c4('0xe')][_0x5ea7bd[_0x05c4('0x6b')]][_0x05c4('0x72')](_0x1cf37f);this[_0x05c4('0x10')][_0x5ea7bd['uniqueid']]=_0x1cf37f;this['emitVoiceQueueChannelSave'](_0x1cf37f);}}catch(_0x43e99a){logger[_0x05c4('0x3f')](_0x05c4('0x73'),util[_0x05c4('0x46')](_0x43e99a,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x05c4('0x9')][_0x05c4('0x1b')]=function(_0xe1cbef){try{if(this[_0x05c4('0x63')](_0xe1cbef)){if(this[_0x05c4('0xe')][_0xe1cbef[_0x05c4('0x6b')]]){var _0x2ef0f8=_[_0x05c4('0x74')](this[_0x05c4('0xe')][_0xe1cbef[_0x05c4('0x6b')]]);_0x2ef0f8[_0x05c4('0x75')]=![];_0x2ef0f8[_0x05c4('0x76')]=null;_0x2ef0f8[_0x05c4('0x77')]=_0xe1cbef[_0x05c4('0x77')];_0x2ef0f8[_0x05c4('0x78')]=_0xe1cbef[_0x05c4('0x78')];_0x2ef0f8[_0x05c4('0x1a')]=!![];_0x2ef0f8[_0x05c4('0x79')]=moment()[_0x05c4('0x49')](_0x05c4('0x6d'));_0x2ef0f8[_0x05c4('0x7a')]=_0x05c4('0x7b');_0x2ef0f8['lastAssignedTo']=null;this[_0x05c4('0x10')][_0xe1cbef[_0x05c4('0x6b')]]=_0x2ef0f8;this['emitVoiceQueueChannelRemove'](_0x2ef0f8);}}}catch(_0x51896d){logger[_0x05c4('0x3f')](_0x05c4('0x7c'),util[_0x05c4('0x46')](_0x51896d,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x05c4('0x9')][_0x05c4('0x1d')]=function(_0x12badc){try{if(this[_0x05c4('0x63')](_0x12badc)){if(this['queueReports'][_0x12badc[_0x05c4('0x6b')]]){var _0x2d9c16=_[_0x05c4('0x74')](this[_0x05c4('0xe')][_0x12badc[_0x05c4('0x6b')]]);_0x2d9c16[_0x05c4('0x7d')]=moment()[_0x05c4('0x49')](_0x05c4('0x6d'));_0x2d9c16[_0x05c4('0x7e')]=_0x12badc[_0x05c4('0x7e')];_0x2d9c16[_0x05c4('0x7f')]=_0x12badc['connectedlinename'];this['channels'][_0x12badc[_0x05c4('0x6b')]]=_0x2d9c16;this[_0x05c4('0x48')](_0x2d9c16);}}}catch(_0x276acf){logger[_0x05c4('0x3f')]('[syncQueueCallerLeave][VoiceQueueReport]',util[_0x05c4('0x46')](_0x276acf,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x05c4('0x9')][_0x05c4('0x80')]=function(_0x6e11b1){try{if(this[_0x05c4('0x63')](_0x6e11b1)){if(this[_0x05c4('0xe')][_0x6e11b1[_0x05c4('0x6b')]]){var _0x7a4047=_[_0x05c4('0x74')](this[_0x05c4('0xe')][_0x6e11b1['uniqueid']]);_0x7a4047['queuecallercomplete']=!![];_0x7a4047[_0x05c4('0x7a')]='COMPLETEDBYAGENT';}}}catch(_0x57f886){logger[_0x05c4('0x3f')](_0x05c4('0x81'),util['inspect'](_0x57f886,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x05c4('0x9')]['syncAgentComplete']=function(_0x350fb0){try{if(this['isNotNull'](_0x350fb0)){if(this[_0x05c4('0xe')][_0x350fb0['uniqueid']]){var _0x146efc=_[_0x05c4('0x74')](this[_0x05c4('0xe')][_0x350fb0[_0x05c4('0x6b')]]);_0x146efc['queuecallerabandon']=![];_0x146efc[_0x05c4('0x79')]=null;_0x146efc[_0x05c4('0x82')]=!![];_0x146efc[_0x05c4('0x83')]=_0x350fb0['membername'];_0x146efc[_0x05c4('0x77')]=_0x350fb0[_0x05c4('0x77')];_0x146efc[_0x05c4('0x75')]=!![];_0x146efc[_0x05c4('0x84')]=![];_0x146efc['queuecallerexitAt']=null;if(!_0x146efc['transfer']){if(_0x350fb0[_0x05c4('0x85')]==_0x05c4('0x86')){_0x146efc[_0x05c4('0x7a')]='COMPLETED';}else{if(_['startsWith'](_0x350fb0[_0x05c4('0x3c')][_0x05c4('0x87')](),_0x05c4('0x88'))){if(this['queueReports'][_0x350fb0['linkedid']]){var _0x479668=_[_0x05c4('0x74')](this[_0x05c4('0xe')][_0x350fb0[_0x05c4('0x89')]]);_0x479668[_0x05c4('0x75')]=![];_0x479668[_0x05c4('0x84')]=!![];_0x479668[_0x05c4('0x8a')]=moment(_0x146efc[_0x05c4('0x6c')])[_0x05c4('0x8b')](_0x350fb0[_0x05c4('0x77')],'seconds')[_0x05c4('0x49')]('YYYY-MM-DD\x20HH:mm:ss');_0x479668[_0x05c4('0x7a')]=_0x05c4('0x8c');_0x479668['transfer']=!![];_0x479668[_0x05c4('0x8d')]=_0x05c4('0x8e');_0x479668[_0x05c4('0x8f')]=_0x350fb0[_0x05c4('0x90')];_0x479668['transferuniqueid']=_0x350fb0['uniqueid'];var _0x18859e=this['queueReports'][_0x350fb0[_0x05c4('0x89')]];this['queueReports'][_0x350fb0['linkedid']]=this[_0x05c4('0xe')][_0x350fb0['uniqueid']];this['queueReports'][_0x350fb0[_0x05c4('0x6b')]]=_0x18859e;}}else{_0x146efc[_0x05c4('0x7a')]=_0x05c4('0x91')+_0x350fb0[_0x05c4('0x85')][_0x05c4('0x92')]();}}}this[_0x05c4('0x10')][_0x350fb0[_0x05c4('0x6b')]]=_0x146efc;this['emitVoiceQueueChannelRemove'](_0x146efc);}}}catch(_0x5895c0){logger[_0x05c4('0x3f')](_0x05c4('0x93'),util[_0x05c4('0x46')](_0x5895c0,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x05c4('0x9')]['syncVarSet']=function(_0x8f71c5){try{if(this[_0x05c4('0x63')](_0x8f71c5)){this[_0x05c4('0x94')](_0x8f71c5[_0x05c4('0x6b')],_[_0x05c4('0x71')](_0x8f71c5[_0x05c4('0x95')])[0x0],_0x8f71c5[_0x05c4('0x96')]);if(this[_0x05c4('0xe')][_0x8f71c5[_0x05c4('0x6b')]]){var _0x23013b=_[_0x05c4('0x74')](this[_0x05c4('0xe')][_0x8f71c5[_0x05c4('0x6b')]]);if(_0x23013b){if(this['isNotNull'](_0x8f71c5[_0x05c4('0x95')])&&this[_0x05c4('0x63')](_0x8f71c5[_0x05c4('0x95')][_0x05c4('0x97')])){switch(_0x8f71c5[_0x05c4('0x96')]){case'CONTINUE':_0x23013b['queuecallerexit']=![];_0x23013b['queuecallerexitAt']=null;break;case _0x05c4('0x98'):_0x23013b[_0x05c4('0x99')]=_0x05c4('0x9a');ami['emit']('custom:timeout',_0x23013b);break;default:_0x23013b[_0x05c4('0x84')]=!![];_0x23013b[_0x05c4('0x8a')]=moment()[_0x05c4('0x49')](_0x05c4('0x6d'));_0x23013b[_0x05c4('0x7d')]=moment()[_0x05c4('0x49')]('YYYY-MM-DD\x20HH:mm:ss');}_0x23013b[_0x05c4('0x1a')]=![];_0x23013b['queuecallerabandonAt']=null;_0x23013b[_0x05c4('0x7a')]=_0x8f71c5[_0x05c4('0x96')];this['channels'][_0x8f71c5['uniqueid']]=_0x23013b;this[_0x05c4('0x45')](_0x23013b);}else if(this[_0x05c4('0x63')](_0x8f71c5[_0x05c4('0x95')])&&this['isNotNull'](_0x8f71c5[_0x05c4('0x95')][_0x05c4('0x9b')])){if(!_0x23013b[_0x05c4('0x1a')]){_0x23013b[_0x05c4('0x84')]=!![];_0x23013b['queuecallerexitAt']=moment()['format'](_0x05c4('0x6d'));_0x23013b[_0x05c4('0x7a')]=_0x05c4('0x9c');_0x23013b[_0x05c4('0x7d')]=moment()[_0x05c4('0x49')](_0x05c4('0x6d'));this[_0x05c4('0x10')][_0x8f71c5[_0x05c4('0x6b')]]=_0x23013b;}}_0x23013b[_0x05c4('0x14')]=this[_0x05c4('0x14')][_0x8f71c5[_0x05c4('0x6b')]];}}}}catch(_0x4af093){logger[_0x05c4('0x3f')]('[syncVarSet][VoiceQueueReport]',util['inspect'](_0x4af093,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x05c4('0x9')][_0x05c4('0x94')]=function(_0x4655ec,_0x52f919,_0x4131c7){var _0x2925a4=[_0x05c4('0x9d'),_0x05c4('0x9e'),_0x05c4('0x9f'),_0x05c4('0xa0'),'rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt',_0x05c4('0xa1'),_0x05c4('0xa2'),'sipuri',_0x05c4('0xa3'),_0x05c4('0xa4'),_0x05c4('0xa5'),'memberdynamic',_0x05c4('0xa6'),'memberlastcall','membername',_0x05c4('0xa7'),'memberrealtime'];if(!_[_0x05c4('0x39')](_0x52f919)&&!_[_0x05c4('0xa8')](_0x2925a4,_0x52f919)){if(_[_0x05c4('0x2e')](this[_0x05c4('0x14')][_0x4655ec])){this[_0x05c4('0x14')][_0x4655ec]={};}this[_0x05c4('0x14')][_0x4655ec][_0x52f919]=_0x4131c7;}};VoiceQueueReport[_0x05c4('0x9')][_0x05c4('0x23')]=function(_0xa6bd6f){try{if(this[_0x05c4('0x63')](_0xa6bd6f)){if(this[_0x05c4('0xe')][_0xa6bd6f[_0x05c4('0x6b')]]){for(var _0x3ee702=0x0,_0x4f65a1={};_0x3ee702=0x0?moment(_0x56704f['endtime'])[_0xe383('0xb')](_0x56704f[_0xe383('0x16')],_0xe383('0x18')):null,'data1':'outbound','data2':_0x56704f[_0xe383('0xf')],'data3':_0x56704f[_0xe383('0x19')],'data4':_0x56704f[_0xe383('0x1a')]||null,'role':_0xe383('0x1b'),'internal':_0x56704f[_0xe383('0xf')]?_['toNumber'](_0x56704f[_0xe383('0xf')]):undefined,'uniqueid':_0x56704f[_0xe383('0x11')]},'log':_0xe383('0x6')});}; \ No newline at end of file +var _0x3e18=['lodash','voiceQueueReport','queuecallerexitAt','Request','CreateMemberReport','voice','isNil','interface','format','lastAssignedTo','TALKING','queuecallerleaveAt','diff','seconds','inbound','calleridnum','queue','accountcode','toNumber','uniqueid','voiceDialReport','membername','starttime','endtime','outbound','exten','dialstring','moment'];(function(_0x101e7b,_0x4ef05b){var _0x4995c0=function(_0x1a6488){while(--_0x1a6488){_0x101e7b['push'](_0x101e7b['shift']());}};_0x4995c0(++_0x4ef05b);}(_0x3e18,0x187));var _0x83e1=function(_0x4af6fb,_0x39cc5d){_0x4af6fb=_0x4af6fb-0x0;var _0x497616=_0x3e18[_0x4af6fb];return _0x497616;};'use strict';var moment=require(_0x83e1('0x0'));var _=require(_0x83e1('0x1'));var util=require('util');var client=require('../client');exports[_0x83e1('0x2')]=function(_0x25fa2a){var _0x41f6ba=_0x25fa2a['queuecallercompleteAt']||_0x25fa2a[_0x83e1('0x3')];return client[_0x83e1('0x4')](_0x83e1('0x5'),{'body':{'channel':_0x83e1('0x6'),'membername':_0x25fa2a['lastAssignedTo'],'interface':_[_0x83e1('0x7')](_0x25fa2a[_0x83e1('0x8')])?util[_0x83e1('0x9')]('SIP/%s',_0x25fa2a[_0x83e1('0xa')]):_0x25fa2a[_0x83e1('0x8')],'type':_0x83e1('0xb'),'enterAt':_0x25fa2a[_0x83e1('0xc')],'exitAt':_0x41f6ba,'duration':moment(_0x41f6ba)[_0x83e1('0xd')](_0x25fa2a[_0x83e1('0xc')],_0x83e1('0xe')),'data1':_0x83e1('0xf'),'data2':_0x25fa2a[_0x83e1('0x10')],'data3':_0x25fa2a['exten'],'data4':null,'data5':_0x25fa2a[_0x83e1('0x11')],'role':'agent','internal':_0x25fa2a[_0x83e1('0x12')]?_[_0x83e1('0x13')](_0x25fa2a[_0x83e1('0x12')]):undefined,'uniqueid':_0x25fa2a[_0x83e1('0x14')]},'log':_0x83e1('0x5')});};exports[_0x83e1('0x15')]=function(_0x47c3f1){return client[_0x83e1('0x4')](_0x83e1('0x5'),{'body':{'channel':'voice','membername':_0x47c3f1[_0x83e1('0x16')],'interface':_0x47c3f1[_0x83e1('0x8')],'type':_0x83e1('0xb'),'enterAt':_0x47c3f1[_0x83e1('0x17')],'exitAt':_0x47c3f1[_0x83e1('0x18')],'duration':moment(_0x47c3f1['endtime'])[_0x83e1('0xd')](_0x47c3f1['starttime'],_0x83e1('0xe'))>=0x0?moment(_0x47c3f1[_0x83e1('0x18')])[_0x83e1('0xd')](_0x47c3f1['starttime'],_0x83e1('0xe')):null,'data1':_0x83e1('0x19'),'data2':_0x47c3f1['accountcode'],'data3':_0x47c3f1[_0x83e1('0x1a')],'data4':_0x47c3f1[_0x83e1('0x1b')]||null,'role':'agent','internal':_0x47c3f1['accountcode']?_['toNumber'](_0x47c3f1['accountcode']):undefined,'uniqueid':_0x47c3f1['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 2a2ce83..69cce91 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 _0x7d98=['Request','GetTemplate','html','../client'];(function(_0x4b9bcd,_0x1bdc36){var _0xaa4780=function(_0x1dbdce){while(--_0x1dbdce){_0x4b9bcd['push'](_0x4b9bcd['shift']());}};_0xaa4780(++_0x1bdc36);}(_0x7d98,0xe7));var _0x87d9=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x7d98[_0x1ac595];return _0x455fff;};'use strict';var client=require(_0x87d9('0x0'));exports['getTemplates']=function(_0x450298){return function(_0x11bc33){return client[_0x87d9('0x1')](_0x87d9('0x2'),{'options':{'raw':!![],'attributes':['id','name',_0x87d9('0x3')]},'log':_0x87d9('0x2')});};}; \ No newline at end of file +var _0xb469=['../client','getTemplates','Request','GetTemplate','name'];(function(_0x22243a,_0x41dbcb){var _0x36b8cd=function(_0x33e4d9){while(--_0x33e4d9){_0x22243a['push'](_0x22243a['shift']());}};_0x36b8cd(++_0x41dbcb);}(_0xb469,0x13b));var _0x9b46=function(_0x2f790f,_0x3d47fc){_0x2f790f=_0x2f790f-0x0;var _0x24cc76=_0xb469[_0x2f790f];return _0x24cc76;};'use strict';var client=require(_0x9b46('0x0'));exports[_0x9b46('0x1')]=function(_0x2d18d9){return function(_0x34f477){return client[_0x9b46('0x2')](_0x9b46('0x3'),{'options':{'raw':!![],'attributes':['id',_0x9b46('0x4'),'html']},'log':_0x9b46('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 8cd461e..950144d 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 _0x901c=['Condition','operator','value','AnyConditions','field','Action','Actions','action','data1','data3','data4','data5','data6','data7','GetTrigger','name','channel','status'];(function(_0x37bd46,_0x2cd9de){var _0x560101=function(_0x447878){while(--_0x447878){_0x37bd46['push'](_0x37bd46['shift']());}};_0x560101(++_0x2cd9de);}(_0x901c,0x11c));var _0xc901=function(_0x57d27a,_0xc4e9c4){_0x57d27a=_0x57d27a-0x0;var _0x5d467a=_0x901c[_0x57d27a];return _0x5d467a;};'use strict';var client=require('../client');exports['getTriggers']=function(_0x2bb628){return function(_0x49c51f){return client['Request'](_0xc901('0x0'),{'options':{'raw':![],'attributes':['id',_0xc901('0x1'),_0xc901('0x2'),_0xc901('0x3')],'include':[{'model':_0xc901('0x4'),'as':'AllConditions','attributes':['id','field',_0xc901('0x5'),_0xc901('0x6')]},{'model':'Condition','as':_0xc901('0x7'),'attributes':['id',_0xc901('0x8'),_0xc901('0x5'),'value']},{'model':_0xc901('0x9'),'as':_0xc901('0xa'),'attributes':['id',_0xc901('0xb'),_0xc901('0xc'),'data2',_0xc901('0xd'),_0xc901('0xe'),_0xc901('0xf'),_0xc901('0x10'),_0xc901('0x11')]}]},'log':'GetTrigger'});};}; \ No newline at end of file +var _0xd00c=['Actions','data4','data6','../client','name','Condition','AllConditions','field','operator','value','AnyConditions','Action'];(function(_0x270e85,_0x3ae0be){var _0x23ce8c=function(_0x3a8f2a){while(--_0x3a8f2a){_0x270e85['push'](_0x270e85['shift']());}};_0x23ce8c(++_0x3ae0be);}(_0xd00c,0x15f));var _0xcd00=function(_0x4390fc,_0x2e3cd5){_0x4390fc=_0x4390fc-0x0;var _0x27fd1a=_0xd00c[_0x4390fc];return _0x27fd1a;};'use strict';var client=require(_0xcd00('0x0'));exports['getTriggers']=function(_0xc9a5fd){return function(_0x14a103){return client['Request']('GetTrigger',{'options':{'raw':![],'attributes':['id',_0xcd00('0x1'),'channel','status'],'include':[{'model':_0xcd00('0x2'),'as':_0xcd00('0x3'),'attributes':['id',_0xcd00('0x4'),_0xcd00('0x5'),_0xcd00('0x6')]},{'model':_0xcd00('0x2'),'as':_0xcd00('0x7'),'attributes':['id','field','operator','value']},{'model':_0xcd00('0x8'),'as':_0xcd00('0x9'),'attributes':['id','action','data1','data2','data3',_0xcd00('0xa'),'data5',_0xcd00('0xb'),'data7']}]},'log':'GetTrigger'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index c76ff7c..41959bc 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 _0x3272=['Request','GetTrunk','name','registry','../client','getTrunks'];(function(_0xd0965,_0x1f94fc){var _0x3f5839=function(_0x28492c){while(--_0x28492c){_0xd0965['push'](_0xd0965['shift']());}};_0x3f5839(++_0x1f94fc);}(_0x3272,0x9a));var _0x2327=function(_0x33ecb4,_0x4a554b){_0x33ecb4=_0x33ecb4-0x0;var _0x1699c3=_0x3272[_0x33ecb4];return _0x1699c3;};'use strict';var client=require(_0x2327('0x0'));exports[_0x2327('0x1')]=function(_0x18be35){return function(_0x4b92b7){return client[_0x2327('0x2')](_0x2327('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x2327('0x4'),_0x2327('0x5')]},'log':_0x2327('0x3')});};}; \ No newline at end of file +var _0x62ab=['../client','getTrunks','Request','GetTrunk'];(function(_0x382987,_0x58058b){var _0x29eb57=function(_0x646f43){while(--_0x646f43){_0x382987['push'](_0x382987['shift']());}};_0x29eb57(++_0x58058b);}(_0x62ab,0xcc));var _0xb62a=function(_0x2c4259,_0x38ea69){_0x2c4259=_0x2c4259-0x0;var _0x5c63e6=_0x62ab[_0x2c4259];return _0x5c63e6;};'use strict';var client=require(_0xb62a('0x0'));exports[_0xb62a('0x1')]=function(_0xfc5dea){return function(_0x168577){return client[_0xb62a('0x2')](_0xb62a('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id','name','registry']},'log':_0xb62a('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 4f70318..2ef3973 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 _0xf7da=['pauseType','lastPauseAt','phone','mobile','interface','getTelephones','telephone','internal','savePause','PauseUser','saveUnpause','UnpauseUser','getAgent','agent','online','lastLoginAt','getAgents','Request','GetUser','name','email','accountcode','fullname'];(function(_0x1d5001,_0x2e6fdb){var _0x42ede1=function(_0x355cdf){while(--_0x355cdf){_0x1d5001['push'](_0x1d5001['shift']());}};_0x42ede1(++_0x2e6fdb);}(_0xf7da,0x169));var _0xaf7d=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xf7da[_0x3947c9];return _0x2e7871;};'use strict';var client=require('../client');exports[_0xaf7d('0x0')]=function(){return function(){return client[_0xaf7d('0x1')](_0xaf7d('0x2'),{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id',_0xaf7d('0x3'),_0xaf7d('0x4'),_0xaf7d('0x5'),_0xaf7d('0x6'),'online','lastLoginAt',_0xaf7d('0x7'),_0xaf7d('0x8'),'voicePause',_0xaf7d('0x9'),_0xaf7d('0xa'),_0xaf7d('0xb')]},'log':_0xaf7d('0x0')});};};exports[_0xaf7d('0xc')]=function(){return function(){return client[_0xaf7d('0x1')](_0xaf7d('0x2'),{'options':{'raw':!![],'where':{'role':_0xaf7d('0xd')},'attributes':['id',_0xaf7d('0x3'),'accountcode',_0xaf7d('0xe')]},'log':_0xaf7d('0xc')});};};exports[_0xaf7d('0xf')]=function(_0x301bb3,_0x715cd0,_0x3e486f){return client[_0xaf7d('0x1')](_0xaf7d('0x10'),{'body':{'type':_0x715cd0,'uniqueid':_0x3e486f},'options':{'where':{'id':_0x301bb3['id']}},'log':_0xaf7d('0xf')});};exports[_0xaf7d('0x11')]=function(_0x5aa5f8){return client['Request'](_0xaf7d('0x12'),{'body':{},'options':{'where':{'id':_0x5aa5f8['id']}},'log':_0xaf7d('0xf')});};exports[_0xaf7d('0x13')]=function(_0x2c563f){return client['Request']('ShowUser',{'options':{'raw':![],'where':{'role':_0xaf7d('0x14'),'id':_0x2c563f},'attributes':['id',_0xaf7d('0x3'),_0xaf7d('0x4'),_0xaf7d('0x5'),_0xaf7d('0x6'),_0xaf7d('0x15'),_0xaf7d('0x16'),_0xaf7d('0x7'),'lastPauseAt','voicePause',_0xaf7d('0xb')]},'log':_0xaf7d('0x13')});}; \ No newline at end of file +var _0xc808=['pauseType','lastPauseAt','voicePause','phone','mobile','getTelephones','name','internal','PauseUser','savePause','saveUnpause','UnpauseUser','lastLoginAt','interface','../client','getAgents','Request','GetUser','agent','email','accountcode','fullname','online'];(function(_0x376b45,_0x5964fb){var _0x2341b3=function(_0x5a7f01){while(--_0x5a7f01){_0x376b45['push'](_0x376b45['shift']());}};_0x2341b3(++_0x5964fb);}(_0xc808,0xdd));var _0x8c80=function(_0x2e6c19,_0x131233){_0x2e6c19=_0x2e6c19-0x0;var _0x52885d=_0xc808[_0x2e6c19];return _0x52885d;};'use strict';var client=require(_0x8c80('0x0'));exports[_0x8c80('0x1')]=function(){return function(){return client[_0x8c80('0x2')](_0x8c80('0x3'),{'options':{'raw':![],'where':{'role':_0x8c80('0x4')},'attributes':['id','name',_0x8c80('0x5'),_0x8c80('0x6'),_0x8c80('0x7'),_0x8c80('0x8'),'lastLoginAt',_0x8c80('0x9'),_0x8c80('0xa'),_0x8c80('0xb'),_0x8c80('0xc'),_0x8c80('0xd'),'interface']},'log':_0x8c80('0x1')});};};exports[_0x8c80('0xe')]=function(){return function(){return client[_0x8c80('0x2')]('GetUser',{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x8c80('0xf'),_0x8c80('0x6'),_0x8c80('0x10')]},'log':_0x8c80('0xe')});};};exports['savePause']=function(_0x4f42b5,_0x1edb98,_0x172320){return client[_0x8c80('0x2')](_0x8c80('0x11'),{'body':{'type':_0x1edb98,'uniqueid':_0x172320},'options':{'where':{'id':_0x4f42b5['id']}},'log':_0x8c80('0x12')});};exports[_0x8c80('0x13')]=function(_0x2c01f0){return client[_0x8c80('0x2')](_0x8c80('0x14'),{'body':{},'options':{'where':{'id':_0x2c01f0['id']}},'log':_0x8c80('0x12')});};exports['getAgent']=function(_0x120879){return client[_0x8c80('0x2')]('ShowUser',{'options':{'raw':![],'where':{'role':_0x8c80('0x4'),'id':_0x120879},'attributes':['id','name',_0x8c80('0x5'),'accountcode',_0x8c80('0x7'),'online',_0x8c80('0x15'),'pauseType','lastPauseAt',_0x8c80('0xb'),_0x8c80('0x16')]},'log':'getAgent'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index 2fa3a99..bf4e364 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 _0x2aaa=['update','UpdateVoiceAgentReport','../client','Request','CreateVoiceAgentReport'];(function(_0x2140a3,_0x5805f1){var _0x1ab35c=function(_0x5687b7){while(--_0x5687b7){_0x2140a3['push'](_0x2140a3['shift']());}};_0x1ab35c(++_0x5805f1);}(_0x2aaa,0x1d8));var _0xa2aa=function(_0x3acda2,_0x7798e){_0x3acda2=_0x3acda2-0x0;var _0x127156=_0x2aaa[_0x3acda2];return _0x127156;};'use strict';var client=require(_0xa2aa('0x0'));exports['create']=function(_0x2ef98c){return client[_0xa2aa('0x1')](_0xa2aa('0x2'),{'body':_0x2ef98c,'log':'CreateVoiceAgentReport'});};exports[_0xa2aa('0x3')]=function(_0x1ee084,_0x441603,_0x58066a){return client['Request'](_0xa2aa('0x4'),{'body':_0x1ee084,'options':{'where':{'uniqueid':_0x441603,'interface':_0x58066a,'agentcomplete':!![]}},'log':_0xa2aa('0x4')});}; \ No newline at end of file +var _0xe829=['CreateVoiceAgentReport','update','Request','UpdateVoiceAgentReport','../client','create'];(function(_0x2aa433,_0x3b4476){var _0x265de6=function(_0x5c20c){while(--_0x5c20c){_0x2aa433['push'](_0x2aa433['shift']());}};_0x265de6(++_0x3b4476);}(_0xe829,0x1d8));var _0x9e82=function(_0x51d22e,_0x276640){_0x51d22e=_0x51d22e-0x0;var _0x275be3=_0xe829[_0x51d22e];return _0x275be3;};'use strict';var client=require(_0x9e82('0x0'));exports[_0x9e82('0x1')]=function(_0x221edd){return client['Request']('CreateVoiceAgentReport',{'body':_0x221edd,'log':_0x9e82('0x2')});};exports[_0x9e82('0x3')]=function(_0x1b47d8,_0x168d3e,_0x31591a){return client[_0x9e82('0x4')]('UpdateVoiceAgentReport',{'body':_0x1b47d8,'options':{'where':{'uniqueid':_0x168d3e,'interface':_0x31591a,'agentcomplete':!![]}},'log':_0x9e82('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index b30b0fb..02ae328 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 _0x7a69=['format','YYYY-MM-DD\x20HH:mm:ss','type','disposition','duration','GetVoiceCallReports','moment','util','lodash','../client','create','Request','CreateVoiceCallReport','merge','calleridnum','DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport','outbound','startOf','day'];(function(_0x265ab5,_0x494f68){var _0x4936de=function(_0x3b95ac){while(--_0x3b95ac){_0x265ab5['push'](_0x265ab5['shift']());}};_0x4936de(++_0x494f68);}(_0x7a69,0x141));var _0x97a6=function(_0x5e8e2c,_0x252225){_0x5e8e2c=_0x5e8e2c-0x0;var _0x1e765b=_0x7a69[_0x5e8e2c];return _0x1e765b;};'use strict';var moment=require(_0x97a6('0x0'));var util=require(_0x97a6('0x1'));var _=require(_0x97a6('0x2'));var client=require(_0x97a6('0x3'));exports[_0x97a6('0x4')]=function(_0x4cde7a){return client[_0x97a6('0x5')](_0x97a6('0x6'),{'body':_[_0x97a6('0x7')](_0x4cde7a,{'source':_0x4cde7a[_0x97a6('0x8')],'destinationcontext':_0x4cde7a['context'],'callerid':_0x4cde7a['callerid'],'amaflags':_0x97a6('0x9')}),'log':_0x97a6('0x6')});};exports[_0x97a6('0xa')]=function(){return function(){return client[_0x97a6('0x5')](_0x97a6('0xb'),{'options':{'where':{'type':[_0x97a6('0xc')],'createdAt':{'$between':[moment()[_0x97a6('0xd')](_0x97a6('0xe'))['format']('YYYY-MM-DD\x20HH:mm:ss'),moment()['endOf']('day')[_0x97a6('0xf')](_0x97a6('0x10'))]}},'attributes':[_0x97a6('0x11'),_0x97a6('0x12'),_0x97a6('0x13'),'billableseconds']},'log':_0x97a6('0x14')});};}; \ No newline at end of file +var _0xa124=['CreateVoiceCallReport','getVoiceCallReports','Request','GetVoiceCallReport','outbound','day','format','YYYY-MM-DD\x20HH:mm:ss','type','disposition','duration','billableseconds','GetVoiceCallReports','moment','util','lodash','../client','merge','context','callerid','DOCUMENTATION'];(function(_0x5abb82,_0x34327e){var _0x30b7eb=function(_0x416f0d){while(--_0x416f0d){_0x5abb82['push'](_0x5abb82['shift']());}};_0x30b7eb(++_0x34327e);}(_0xa124,0x1f0));var _0x4a12=function(_0x503cd5,_0x57774a){_0x503cd5=_0x503cd5-0x0;var _0x1fdf1e=_0xa124[_0x503cd5];return _0x1fdf1e;};'use strict';var moment=require(_0x4a12('0x0'));var util=require(_0x4a12('0x1'));var _=require(_0x4a12('0x2'));var client=require(_0x4a12('0x3'));exports['create']=function(_0x51077f){return client['Request']('CreateVoiceCallReport',{'body':_[_0x4a12('0x4')](_0x51077f,{'source':_0x51077f['calleridnum'],'destinationcontext':_0x51077f[_0x4a12('0x5')],'callerid':_0x51077f[_0x4a12('0x6')],'amaflags':_0x4a12('0x7')}),'log':_0x4a12('0x8')});};exports[_0x4a12('0x9')]=function(){return function(){return client[_0x4a12('0xa')](_0x4a12('0xb'),{'options':{'where':{'type':[_0x4a12('0xc')],'createdAt':{'$between':[moment()['startOf'](_0x4a12('0xd'))[_0x4a12('0xe')](_0x4a12('0xf')),moment()['endOf'](_0x4a12('0xd'))[_0x4a12('0xe')]('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':[_0x4a12('0x10'),_0x4a12('0x11'),_0x4a12('0x12'),_0x4a12('0x13')]},'log':_0x4a12('0x14')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 3c125eb..79adf05 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 _0xc819=['CreateVoiceDialReport','Request'];(function(_0x21fd61,_0x3ce7ae){var _0x2f2480=function(_0x26aa39){while(--_0x26aa39){_0x21fd61['push'](_0x21fd61['shift']());}};_0x2f2480(++_0x3ce7ae);}(_0xc819,0xed));var _0x9c81=function(_0x9d2e33,_0xf0ddda){_0x9d2e33=_0x9d2e33-0x0;var _0x16860a=_0xc819[_0x9d2e33];return _0x16860a;};'use strict';var client=require('../client');exports['create']=function(_0x2693e9){return client[_0x9c81('0x0')](_0x9c81('0x1'),{'body':_0x2693e9,'log':_0x9c81('0x1')});}; \ No newline at end of file +var _0x3897=['Request','CreateVoiceDialReport','../client','create'];(function(_0xaf8f29,_0x5754cf){var _0x391fed=function(_0x322809){while(--_0x322809){_0xaf8f29['push'](_0xaf8f29['shift']());}};_0x391fed(++_0x5754cf);}(_0x3897,0xe6));var _0x7389=function(_0x22789a,_0x4a1c8c){_0x22789a=_0x22789a-0x0;var _0xede88=_0x3897[_0x22789a];return _0xede88;};'use strict';var client=require(_0x7389('0x0'));exports[_0x7389('0x1')]=function(_0x5d1d2c){return client[_0x7389('0x2')]('CreateVoiceDialReport',{'body':_0x5d1d2c,'log':_0x7389('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index b627dc9..c41dc57 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 _0xe3db=['../client','getVoiceExtensions','GetVoiceExtension','exten','recordingFormat'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0xe3db,0xc8));var _0xbe3d=function(_0xda6d4,_0x284ca1){_0xda6d4=_0xda6d4-0x0;var _0x627bf1=_0xe3db[_0xda6d4];return _0x627bf1;};'use strict';var client=require(_0xbe3d('0x0'));exports[_0xbe3d('0x1')]=function(){return function(){return client['Request'](_0xbe3d('0x2'),{'options':{'raw':!![],'attributes':['id',_0xbe3d('0x3'),_0xbe3d('0x4')],'where':{'VoiceExtensionId':null}},'log':_0xbe3d('0x1')});};}; \ No newline at end of file +var _0x8b6f=['../client','getVoiceExtensions','Request','GetVoiceExtension','recordingFormat'];(function(_0x5d7622,_0x49cb59){var _0x30b38c=function(_0x21c52d){while(--_0x21c52d){_0x5d7622['push'](_0x5d7622['shift']());}};_0x30b38c(++_0x49cb59);}(_0x8b6f,0x177));var _0xf8b6=function(_0x312b06,_0x5ad05e){_0x312b06=_0x312b06-0x0;var _0x54dd60=_0x8b6f[_0x312b06];return _0x54dd60;};'use strict';var client=require(_0xf8b6('0x0'));exports[_0xf8b6('0x1')]=function(){return function(){return client[_0xf8b6('0x2')](_0xf8b6('0x3'),{'options':{'raw':!![],'attributes':['id','exten',_0xf8b6('0x4')],'where':{'VoiceExtensionId':null}},'log':_0xf8b6('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index e185054..31fbcb8 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 _0x925f=['dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','Trunk','active','mandatoryDispositionPause','TrunkBackup','callerid','Interval','Intervals','interval','../client','getVoiceQueues','GetVoiceQueue','name','monitor_format','dialActive','dialLimitChannel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialGlobalMaxRetry','dialGlobalInterval','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','timeout','dialRecallMeTimeout','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectMaxRetry'];(function(_0xd9ed0b,_0x3be903){var _0x5c9b4a=function(_0x176810){while(--_0x176810){_0xd9ed0b['push'](_0xd9ed0b['shift']());}};_0x5c9b4a(++_0x3be903);}(_0x925f,0x1cc));var _0xf925=function(_0x1a595a,_0x263824){_0x1a595a=_0x1a595a-0x0;var _0x33f008=_0x925f[_0x1a595a];return _0x33f008;};'use strict';var client=require(_0xf925('0x0'));exports[_0xf925('0x1')]=function(){return function(){return client['Request'](_0xf925('0x2'),{'options':{'raw':![],'attributes':['id',_0xf925('0x3'),'acw','acwTimeout','autopause',_0xf925('0x4'),'type',_0xf925('0x5'),'dialMethod',_0xf925('0x6'),'dialLimitQueue','dialPowerLevel',_0xf925('0x7'),_0xf925('0x8'),'dialPredictiveInterval',_0xf925('0x9'),_0xf925('0xa'),_0xf925('0xb'),_0xf925('0xc'),'dialQueueTimeout',_0xf925('0xd'),_0xf925('0xe'),_0xf925('0xf'),_0xf925('0x10'),_0xf925('0x11'),_0xf925('0x12'),'dialNoAnswerRetryFrequency',_0xf925('0x13'),'dialTimezone',_0xf925('0x14'),'dialPrefix',_0xf925('0x15'),_0xf925('0x16'),_0xf925('0x17'),_0xf925('0x18'),_0xf925('0x19'),_0xf925('0x1a'),_0xf925('0x1b'),_0xf925('0x1c'),_0xf925('0x1d'),_0xf925('0x1e'),'dialAMDMaximumWordLength',_0xf925('0x1f'),_0xf925('0x20'),'dialRecallInQueue',_0xf925('0x21'),_0xf925('0x22'),'dialAgiAfterHangupClient',_0xf925('0x23'),_0xf925('0x4'),_0xf925('0x24'),_0xf925('0x25'),'dialCutDigit','dialNoSuchNumberMaxRetry',_0xf925('0x26'),_0xf925('0x27'),_0xf925('0x28'),'dialAbandonedMaxRetry',_0xf925('0x29'),'dialMachineMaxRetry',_0xf925('0x2a'),_0xf925('0x2b'),_0xf925('0x2c'),_0xf925('0x2d'),_0xf925('0x2e'),_0xf925('0x2f')],'include':[{'model':'Trunk','as':_0xf925('0x30'),'attributes':['id','name','callerid',_0xf925('0x31')]},{'model':'Pause','as':_0xf925('0x32'),'attributes':['id',_0xf925('0x3')]},{'model':_0xf925('0x30'),'as':_0xf925('0x33'),'attributes':['id',_0xf925('0x3'),_0xf925('0x34'),_0xf925('0x31')]},{'model':_0xf925('0x35'),'as':_0xf925('0x35'),'attributes':['id','name'],'include':[{'model':_0xf925('0x35'),'as':_0xf925('0x36'),'attributes':['id',_0xf925('0x3'),_0xf925('0x37')]}]}]},'log':_0xf925('0x1')});};}; \ No newline at end of file +var _0x798b=['monitor_format','dialActive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialAMDActive','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','Trunk','active','Pause','TrunkBackup','callerid','Interval','Intervals','interval','getVoiceQueues','Request','GetVoiceQueue','name','acw','acwTimeout','autopause'];(function(_0x209c59,_0x2e4118){var _0x1daf63=function(_0x1f493b){while(--_0x1f493b){_0x209c59['push'](_0x209c59['shift']());}};_0x1daf63(++_0x2e4118);}(_0x798b,0xaa));var _0xb798=function(_0x53be11,_0x1a5a2b){_0x53be11=_0x53be11-0x0;var _0x5ba8da=_0x798b[_0x53be11];return _0x5ba8da;};'use strict';var client=require('../client');exports[_0xb798('0x0')]=function(){return function(){return client[_0xb798('0x1')](_0xb798('0x2'),{'options':{'raw':![],'attributes':['id',_0xb798('0x3'),_0xb798('0x4'),_0xb798('0x5'),_0xb798('0x6'),_0xb798('0x7'),'type',_0xb798('0x8'),'dialMethod',_0xb798('0x9'),_0xb798('0xa'),_0xb798('0xb'),_0xb798('0xc'),'dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName',_0xb798('0xd'),_0xb798('0xe'),'dialQueueOptions','dialQueueTimeout','dialQueueProject',_0xb798('0xf'),_0xb798('0x10'),_0xb798('0x11'),_0xb798('0x12'),_0xb798('0x13'),_0xb798('0x14'),_0xb798('0x15'),_0xb798('0x16'),_0xb798('0x17'),_0xb798('0x18'),'dialCheckDuplicateType',_0xb798('0x19'),'dialAMDInitialSilence','dialAMDGreeting',_0xb798('0x1a'),_0xb798('0x1b'),_0xb798('0x1c'),_0xb798('0x1d'),_0xb798('0x1e'),_0xb798('0x1f'),_0xb798('0x20'),_0xb798('0x21'),'dialRecallMeTimeout','dialRecallInQueue',_0xb798('0x22'),_0xb798('0x23'),_0xb798('0x24'),_0xb798('0x25'),_0xb798('0x7'),_0xb798('0x26'),'dialRandomLastDigitCallerIdNumber',_0xb798('0x27'),_0xb798('0x28'),_0xb798('0x29'),_0xb798('0x2a'),_0xb798('0x2b'),_0xb798('0x2c'),_0xb798('0x2d'),_0xb798('0x2e'),_0xb798('0x2f'),'dialAgentRejectMaxRetry',_0xb798('0x30'),'mandatoryDisposition',_0xb798('0x31'),_0xb798('0x32')],'include':[{'model':'Trunk','as':_0xb798('0x33'),'attributes':['id',_0xb798('0x3'),'callerid',_0xb798('0x34')]},{'model':_0xb798('0x35'),'as':'mandatoryDispositionPause','attributes':['id',_0xb798('0x3')]},{'model':_0xb798('0x33'),'as':_0xb798('0x36'),'attributes':['id',_0xb798('0x3'),_0xb798('0x37'),'active']},{'model':'Interval','as':_0xb798('0x38'),'attributes':['id',_0xb798('0x3')],'include':[{'model':_0xb798('0x38'),'as':_0xb798('0x39'),'attributes':['id',_0xb798('0x3'),_0xb798('0x3a')]}]}]},'log':_0xb798('0x0')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 6d6e4a4..dbee53f 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 _0xcc90=['queuecallerexit','queuecallerexitAt','queuecallerabandonAt','GetVoiceQueueReports','moment','../client','CreateVoiceQueueReport','Request','GetVoiceQueueReport','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','queue','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt'];(function(_0x576d8a,_0x2d7bde){var _0x3dc3ef=function(_0xc76758){while(--_0xc76758){_0x576d8a['push'](_0x576d8a['shift']());}};_0x3dc3ef(++_0x2d7bde);}(_0xcc90,0x148));var _0x0cc9=function(_0x1de822,_0x58cf0c){_0x1de822=_0x1de822-0x0;var _0x48fba9=_0xcc90[_0x1de822];return _0x48fba9;};'use strict';var moment=require(_0x0cc9('0x0'));var _=require('lodash');var client=require(_0x0cc9('0x1'));exports['create']=function(_0x223004){return client['Request']('CreateVoiceQueueReport',{'body':_0x223004,'log':_0x0cc9('0x2')});};exports['getVoiceQueueReports']=function(){return function(){return client[_0x0cc9('0x3')](_0x0cc9('0x4'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x0cc9('0x5')](_0x0cc9('0x6'))[_0x0cc9('0x7')](_0x0cc9('0x8')),moment()[_0x0cc9('0x9')](_0x0cc9('0x6'))[_0x0cc9('0x7')]('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':['uniqueid',_0x0cc9('0xa'),'queuecallerjoinAt',_0x0cc9('0xb'),_0x0cc9('0xc'),_0x0cc9('0xd'),_0x0cc9('0xe'),_0x0cc9('0xf'),'queuecallerabandon',_0x0cc9('0x10')]},'log':_0x0cc9('0x11')});};}; \ No newline at end of file +var _0x0118=['create','Request','CreateVoiceQueueReport','getVoiceQueueReports','GetVoiceQueueReport','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','queue','queuecallerjoinAt','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','queuecallerabandon','queuecallerabandonAt','GetVoiceQueueReports','moment','lodash','../client'];(function(_0x4295c5,_0x59c739){var _0x12f03=function(_0x24958c){while(--_0x24958c){_0x4295c5['push'](_0x4295c5['shift']());}};_0x12f03(++_0x59c739);}(_0x0118,0x131));var _0x8011=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0118[_0x20a584];return _0x4b41a8;};'use strict';var moment=require(_0x8011('0x0'));var _=require(_0x8011('0x1'));var client=require(_0x8011('0x2'));exports[_0x8011('0x3')]=function(_0x3555c3){return client[_0x8011('0x4')](_0x8011('0x5'),{'body':_0x3555c3,'log':_0x8011('0x5')});};exports[_0x8011('0x6')]=function(){return function(){return client[_0x8011('0x4')](_0x8011('0x7'),{'options':{'where':{'createdAt':{'$between':[moment()['startOf'](_0x8011('0x8'))[_0x8011('0x9')](_0x8011('0xa')),moment()[_0x8011('0xb')]('day')[_0x8011('0x9')](_0x8011('0xa'))]}},'attributes':['uniqueid',_0x8011('0xc'),_0x8011('0xd'),_0x8011('0xe'),_0x8011('0xf'),_0x8011('0x10'),_0x8011('0x11'),_0x8011('0x12'),_0x8011('0x13'),_0x8011('0x14')]},'log':_0x8011('0x15')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueRt.js b/server/services/ami/rpc/voiceQueueRt.js index 3ed6712..45a3cb3 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 _0x54f1=['Request','GetVoiceQueueRtPauses','getVoiceQueueRtPauses'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x54f1,0x170));var _0x154f=function(_0x1016d0,_0x407e20){_0x1016d0=_0x1016d0-0x0;var _0x53ade5=_0x54f1[_0x1016d0];return _0x53ade5;};'use strict';var client=require('../client');exports[_0x154f('0x0')]=function(_0x14e4bc){return function(){return client[_0x154f('0x1')](_0x154f('0x2'),{'options':{'where':{'VoiceQueueId':_0x14e4bc,'paused':!![]},'raw':!![]},'log':'getVoiceQueueRtPauses'});};}; \ No newline at end of file +var _0x709d=['getVoiceQueueRtPauses','Request','GetVoiceQueueRtPauses','../client'];(function(_0x1acf31,_0x23bc75){var _0x338804=function(_0x5a416a){while(--_0x5a416a){_0x1acf31['push'](_0x1acf31['shift']());}};_0x338804(++_0x23bc75);}(_0x709d,0x157));var _0xd709=function(_0x50fffc,_0x131334){_0x50fffc=_0x50fffc-0x0;var _0x4c1995=_0x709d[_0x50fffc];return _0x4c1995;};'use strict';var client=require(_0xd709('0x0'));exports[_0xd709('0x1')]=function(_0x2004a6){return function(){return client[_0xd709('0x2')](_0xd709('0x3'),{'options':{'where':{'VoiceQueueId':_0x2004a6,'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 edcb408..efb6d3d 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 _0xe7aa=['CreateVoiceRecording','merge','monitorFilename','lodash','../client','create','Request'];(function(_0x165508,_0x2c0a81){var _0x151872=function(_0x44d448){while(--_0x44d448){_0x165508['push'](_0x165508['shift']());}};_0x151872(++_0x2c0a81);}(_0xe7aa,0xff));var _0xae7a=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0xe7aa[_0x2d7f0e];return _0x110b07;};'use strict';var _=require(_0xae7a('0x0'));var client=require(_0xae7a('0x1'));exports[_0xae7a('0x2')]=function(_0x48df34){return client[_0xae7a('0x3')](_0xae7a('0x4'),{'body':_[_0xae7a('0x5')](_0x48df34,{'value':_0x48df34[_0xae7a('0x6')]}),'log':_0xae7a('0x4')});}; \ No newline at end of file +var _0xab42=['monitorFilename','lodash','../client','Request','CreateVoiceRecording','merge'];(function(_0x153c10,_0x125c51){var _0x5c9235=function(_0x3db4ae){while(--_0x3db4ae){_0x153c10['push'](_0x153c10['shift']());}};_0x5c9235(++_0x125c51);}(_0xab42,0x1bd));var _0x2ab4=function(_0x3bc99a,_0xa825ac){_0x3bc99a=_0x3bc99a-0x0;var _0x42c0ca=_0xab42[_0x3bc99a];return _0x42c0ca;};'use strict';var _=require(_0x2ab4('0x0'));var client=require(_0x2ab4('0x1'));exports['create']=function(_0x512682){return client[_0x2ab4('0x2')](_0x2ab4('0x3'),{'body':_[_0x2ab4('0x4')](_0x512682,{'value':_0x512682[_0x2ab4('0x5')]}),'log':_0x2ab4('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index e3c4284..bc40dc8 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 _0xa741=['transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','origtransferercontext','origtransfererexten','../client','Request','CreateVoiceTransferReport','result','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereecontext','transfereelinkedid','context','blind','attendedTransfer','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridname'];(function(_0x1cd094,_0x4288cc){var _0xf8ec77=function(_0x20ebc8){while(--_0x20ebc8){_0x1cd094['push'](_0x1cd094['shift']());}};_0xf8ec77(++_0x4288cc);}(_0xa741,0xbf));var _0x1a74=function(_0x44bcde,_0x386fb5){_0x44bcde=_0x44bcde-0x0;var _0x3f1e9c=_0xa741[_0x44bcde];return _0x3f1e9c;};'use strict';var client=require(_0x1a74('0x0'));exports['blindTransfer']=function(_0x423389){return client[_0x1a74('0x1')](_0x1a74('0x2'),{'body':{'result':_0x423389[_0x1a74('0x3')],'transfererchannel':_0x423389['transfererchannel'],'transferercalleridnum':_0x423389[_0x1a74('0x4')],'transferercalleridname':_0x423389[_0x1a74('0x5')],'transfererconnectedlinenum':_0x423389[_0x1a74('0x6')],'transfererconnectedlinename':_0x423389['transfererconnectedlinename'],'transfereraccountcode':_0x423389[_0x1a74('0x7')],'transferercontext':_0x423389[_0x1a74('0x8')],'transfererexten':_0x423389[_0x1a74('0x9')],'transfererlinkedid':_0x423389[_0x1a74('0xa')],'transfereechannel':_0x423389[_0x1a74('0xb')],'transfereecalleridnum':_0x423389[_0x1a74('0xc')],'transfereecalleridname':_0x423389[_0x1a74('0xd')],'transfereeconnectedlinenum':_0x423389[_0x1a74('0xe')],'transfereeconnectedlinename':_0x423389[_0x1a74('0xf')],'transfereeaccountcode':_0x423389['transfereeaccountcode'],'transfereecontext':_0x423389[_0x1a74('0x10')],'transfereeexten':_0x423389['transfereeexten'],'transfereelinkedid':_0x423389[_0x1a74('0x11')],'isexternal':_0x423389['isexternal'],'context':_0x423389[_0x1a74('0x12')],'extension':_0x423389['extension'],'type':_0x1a74('0x13')},'log':'CreateVoiceTransferReport'});};exports[_0x1a74('0x14')]=function(_0x3470b5){return client[_0x1a74('0x1')](_0x1a74('0x2'),{'body':{'result':_0x3470b5[_0x1a74('0x3')],'transfererchannel':_0x3470b5['origtransfererchannel'],'transferercalleridnum':_0x3470b5[_0x1a74('0x15')],'transferercalleridname':_0x3470b5[_0x1a74('0x16')],'transfererconnectedlinenum':_0x3470b5[_0x1a74('0x17')],'transfererconnectedlinename':_0x3470b5[_0x1a74('0x18')],'transfereraccountcode':_0x3470b5[_0x1a74('0x19')],'transferercontext':_0x3470b5[_0x1a74('0x1a')],'transfererexten':_0x3470b5[_0x1a74('0x1b')],'transfererlinkedid':_0x3470b5[_0x1a74('0x1c')],'transfereechannel':_0x3470b5[_0x1a74('0x1d')],'transfereecalleridnum':_0x3470b5['transfertargetcalleridnum'],'transfereecalleridname':_0x3470b5[_0x1a74('0x1e')],'transfereeconnectedlinenum':_0x3470b5['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x3470b5[_0x1a74('0x1f')],'transfereeaccountcode':_0x3470b5[_0x1a74('0x20')],'transfereecontext':_0x3470b5[_0x1a74('0x21')],'transfereeexten':_0x3470b5[_0x1a74('0x22')],'transfereelinkedid':_0x3470b5['transfertargetlinkedid'],'isexternal':_0x3470b5['isexternal'],'context':_0x3470b5[_0x1a74('0x23')],'extension':_0x3470b5[_0x1a74('0x24')],'type':'attended'},'log':_0x1a74('0x2')});}; \ No newline at end of file +var _0x240c=['secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','transfertargetchannel','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetcontext','transfertargetexten','origtransferercontext','origtransfererexten','attended','../client','blindTransfer','Request','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfererexten','transfererlinkedid','transfereechannel','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','isexternal','context','extension','blind','attendedTransfer','origtransfererchannel','origtransferercalleridname'];(function(_0x38b14f,_0xd08fa8){var _0x22a324=function(_0x4bbb05){while(--_0x4bbb05){_0x38b14f['push'](_0x38b14f['shift']());}};_0x22a324(++_0xd08fa8);}(_0x240c,0xa4));var _0xc240=function(_0x2d4751,_0x5b46a9){_0x2d4751=_0x2d4751-0x0;var _0xaf3151=_0x240c[_0x2d4751];return _0xaf3151;};'use strict';var client=require(_0xc240('0x0'));exports[_0xc240('0x1')]=function(_0x1b953d){return client[_0xc240('0x2')](_0xc240('0x3'),{'body':{'result':_0x1b953d[_0xc240('0x4')],'transfererchannel':_0x1b953d[_0xc240('0x5')],'transferercalleridnum':_0x1b953d[_0xc240('0x6')],'transferercalleridname':_0x1b953d[_0xc240('0x7')],'transfererconnectedlinenum':_0x1b953d[_0xc240('0x8')],'transfererconnectedlinename':_0x1b953d[_0xc240('0x9')],'transfereraccountcode':_0x1b953d['transfereraccountcode'],'transferercontext':_0x1b953d['transferercontext'],'transfererexten':_0x1b953d[_0xc240('0xa')],'transfererlinkedid':_0x1b953d[_0xc240('0xb')],'transfereechannel':_0x1b953d[_0xc240('0xc')],'transfereecalleridnum':_0x1b953d['transfereecalleridnum'],'transfereecalleridname':_0x1b953d['transfereecalleridname'],'transfereeconnectedlinenum':_0x1b953d[_0xc240('0xd')],'transfereeconnectedlinename':_0x1b953d[_0xc240('0xe')],'transfereeaccountcode':_0x1b953d[_0xc240('0xf')],'transfereecontext':_0x1b953d[_0xc240('0x10')],'transfereeexten':_0x1b953d[_0xc240('0x11')],'transfereelinkedid':_0x1b953d[_0xc240('0x12')],'isexternal':_0x1b953d[_0xc240('0x13')],'context':_0x1b953d[_0xc240('0x14')],'extension':_0x1b953d[_0xc240('0x15')],'type':_0xc240('0x16')},'log':_0xc240('0x3')});};exports[_0xc240('0x17')]=function(_0x57f6ca){return client['Request']('CreateVoiceTransferReport',{'body':{'result':_0x57f6ca[_0xc240('0x4')],'transfererchannel':_0x57f6ca[_0xc240('0x18')],'transferercalleridnum':_0x57f6ca['origtransferercalleridnum'],'transferercalleridname':_0x57f6ca[_0xc240('0x19')],'transfererconnectedlinenum':_0x57f6ca['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x57f6ca[_0xc240('0x1a')],'transfereraccountcode':_0x57f6ca[_0xc240('0x1b')],'transferercontext':_0x57f6ca[_0xc240('0x1c')],'transfererexten':_0x57f6ca[_0xc240('0x1d')],'transfererlinkedid':_0x57f6ca['origtransfererlinkedid'],'transfereechannel':_0x57f6ca[_0xc240('0x1e')],'transfereecalleridnum':_0x57f6ca['transfertargetcalleridnum'],'transfereecalleridname':_0x57f6ca[_0xc240('0x1f')],'transfereeconnectedlinenum':_0x57f6ca[_0xc240('0x20')],'transfereeconnectedlinename':_0x57f6ca['transfertargetconnectedlinename'],'transfereeaccountcode':_0x57f6ca['transfertargetaccountcode'],'transfereecontext':_0x57f6ca[_0xc240('0x21')],'transfereeexten':_0x57f6ca[_0xc240('0x22')],'transfereelinkedid':_0x57f6ca['transfertargetlinkedid'],'isexternal':_0x57f6ca[_0xc240('0x13')],'context':_0x57f6ca[_0xc240('0x23')],'extension':_0x57f6ca[_0xc240('0x24')],'type':_0xc240('0x25')},'log':_0xc240('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index fb2897e..9763b75 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 _0xde6a=['map','uniqueid','channel','format','%s.%s','filename','ai(mixmonitorid)','find','/var/spool/asterisk/monitor/','toLowerCase','isNil','YYYY-MM-DD\x20HH:mm:ss','rec','mixmonitorid','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','resolve','StopMixMonitor','destinationchannel','stop','monitors','StopMixMonitor\x20Success','voicequeuechannel','queueChannels','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','exten','context','telephones','outboundChannels','campaigns','run','event','Event\x20name\x20mandatory','emit','custom:','server','http','log','RPC\x20listening\x20on\x20port:','jayson/promise','validate','bluebird','../../../config/environment','../properties','../ami','listen','SIP','name','timers','updateAcw','agents','updateStatusRealtime','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','pick','keys','action','Reload','Action','catch','command','Command','then','content','voiceQueues','hasOwnProperty','answered','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','type','unmanaged','waiting','loggedInDb','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','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','predictiveIntervalTotalCalls','message','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','push','length','values','channels','voicechannel'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xde6a,0xb0));var _0xade6=function(_0x2ad2b9,_0x1a8c53){_0x2ad2b9=_0x2ad2b9-0x0;var _0x5e5edc=_0xde6a[_0x2ad2b9];return _0x5e5edc;};'use strict';var _=require('lodash');var util=require('util');var jayson=require(_0xade6('0x0'));var schema=require(_0xade6('0x1'));var BPromise=require(_0xade6('0x2'));var moment=require('moment');var config=require(_0xade6('0x3'));var properties=require(_0xade6('0x4'));var ami=require(_0xade6('0x5'));exports[_0xade6('0x6')]=function(_0xd19a9f,_0x26daf5,_0x5845a7){return new BPromise(function(_0x127f95,_0x4f11eb){var _0x41c129={'QueuePause':function(_0x1a935e){return new Promise(function(_0x361590,_0x336dd7){var _0x209797=util['format']('%s/%s',_0xade6('0x7'),_0x1a935e[_0xade6('0x8')]);if(_0xd19a9f[_0xade6('0x9')]&&_0xd19a9f[_0xade6('0x9')][_0x209797]&&_0xd19a9f[_0xade6('0x9')][_0x209797]['timer']){_0xd19a9f[_0xade6('0x9')][_0x209797][_0xade6('0xa')]();}if(_0xd19a9f['agents'][_0x209797]){_0xd19a9f[_0xade6('0xb')][_0x209797][_0xade6('0xc')]({'statePause':_0x1a935e[_0xade6('0xd')]?!![]:![]});}_0x361590({'code':0xc8,'message':_0xade6('0xe')});});},'Reload':function(_0x29a4db){var _0x4aee48=this;return new Promise(function(_0x5d81a7,_0x4c2f5f){if(ami[_0xade6('0xf')]()==![]){return _0x4c2f5f(_0x4aee48[_0xade6('0x10')](0x1f4,[config['asterisk']['ip'],config[_0xade6('0x11')][_0xade6('0x12')],_0xade6('0x13')][_0xade6('0x14')]('\x20')));}_0x29a4db=_[_0xade6('0x15')](_0x29a4db,_[_0xade6('0x16')](properties['module']));_0x29a4db[_0xade6('0x17')]=_0xade6('0x18');return ami[_0xade6('0x19')](_0x29a4db)['then'](function(_0x1836cd){_0x5d81a7({'code':0xc8,'message':_0x1836cd['message']});})[_0xade6('0x1a')](function(_0x44d496){_0x4c2f5f(_0x4aee48['error'](0x1f5,_0x44d496['message']));});});},'Command':function(_0x5decf4){var _0x60fb52=this;return new Promise(function(_0x249e0d,_0x1ce0df){if(ami[_0xade6('0xf')]()==![]){return _0x1ce0df(_0x60fb52['error'](0x1f4,[config[_0xade6('0x11')]['ip'],config[_0xade6('0x11')]['username'],_0xade6('0x13')][_0xade6('0x14')]('\x20')));}_0x5decf4=_[_0xade6('0x15')](_0x5decf4,_0xade6('0x1b'));_0x5decf4[_0xade6('0x17')]=_0xade6('0x1c');return ami[_0xade6('0x19')](_0x5decf4)[_0xade6('0x1d')](function(_0x58bea0){_0x249e0d({'code':0xc8,'message':_0x58bea0[_0xade6('0x1e')]});})['catch'](function(_0x326cea){_0x1ce0df(_0x60fb52['error'](0x1f5,_0x326cea['message']));});});},'VoiceQueues':function(_0x3c9d29){return new Promise(function(_0x34db65,_0x1dbaa1){var _0x3699e2=[];for(var _0x31320b in _0xd19a9f['voiceQueues']){if(_0xd19a9f[_0xade6('0x1f')][_0xade6('0x20')](_0x31320b)){var _0x231563=_0xd19a9f['voiceQueues'][_0x31320b];var _0x3b3331={'id':_0x231563['id'],'name':_0x231563[_0xade6('0x8')],'strategy':_0x231563['strategy'],'answered':_0x231563[_0xade6('0x21')],'available':_0x231563['available'],'loggedIn':_0x231563[_0xade6('0x22')],'pTalking':_0x231563[_0xade6('0x23')],'sumBillable':_0x231563[_0xade6('0x24')],'sumDuration':_0x231563[_0xade6('0x25')],'sumHoldTime':_0x231563[_0xade6('0x26')]||0x0,'talking':_0x231563['talking'],'total':_0x231563['total'],'type':_0x231563[_0xade6('0x27')],'unmanaged':_0x231563[_0xade6('0x28')],'abandoned':_0x231563['abandoned'],'waiting':_0x231563[_0xade6('0x29')],'loggedInDb':_0x231563[_0xade6('0x2a')]};if(_0x231563['type']===_0xade6('0x2b')){_0x3b3331[_0xade6('0x2c')]=_0x231563[_0xade6('0x2c')];_0x3b3331[_0xade6('0x2d')]=_0x231563[_0xade6('0x2d')];_0x3b3331[_0xade6('0x2e')]=_0x231563[_0xade6('0x2e')];_0x3b3331[_0xade6('0x2f')]=_0x231563[_0xade6('0x2f')];_0x3b3331[_0xade6('0x30')]=_0x231563[_0xade6('0x30')];_0x3b3331[_0xade6('0x31')]=_0x231563[_0xade6('0x31')];_0x3b3331[_0xade6('0x32')]=_0x231563[_0xade6('0x32')];_0x3b3331[_0xade6('0x33')]=_0x231563['outboundAnswerCallsDay'];_0x3b3331[_0xade6('0x34')]=_0x231563[_0xade6('0x34')];_0x3b3331['outboundBusyCallsDay']=_0x231563[_0xade6('0x35')];_0x3b3331[_0xade6('0x36')]=_0x231563[_0xade6('0x36')];_0x3b3331[_0xade6('0x37')]=_0x231563[_0xade6('0x37')];_0x3b3331[_0xade6('0x38')]=_0x231563[_0xade6('0x38')];_0x3b3331['outboundDropCallsDayTimeout']=_0x231563[_0xade6('0x39')];_0x3b3331['outboundNoAnswerCallsDay']=_0x231563[_0xade6('0x3a')];_0x3b3331[_0xade6('0x3b')]=_0x231563['outboundNoSuchCallsDay'];_0x3b3331[_0xade6('0x3c')]=_0x231563[_0xade6('0x3c')];_0x3b3331['outboundReCallsDay']=_0x231563[_0xade6('0x3d')];_0x3b3331[_0xade6('0x3e')]=_0x231563[_0xade6('0x3e')];_0x3b3331[_0xade6('0x3f')]=_0x231563['outboundUnknownCallsDay'];_0x3b3331['predictiveIntervalAnsweredCalls']=_0x231563[_0xade6('0x40')];_0x3b3331[_0xade6('0x41')]=_0x231563[_0xade6('0x41')];_0x3b3331[_0xade6('0x42')]=_0x231563[_0xade6('0x42')];_0x3b3331['predictiveIntervalDroppedCallsCallersExit']=_0x231563[_0xade6('0x43')];_0x3b3331[_0xade6('0x44')]=_0x231563[_0xade6('0x44')];_0x3b3331[_0xade6('0x45')]=_0x231563[_0xade6('0x45')];_0x3b3331[_0xade6('0x46')]=_0x231563['predictiveIntervalErlangCallsDroppedCalls'];_0x3b3331[_0xade6('0x47')]=_0x231563[_0xade6('0x47')];_0x3b3331[_0xade6('0x48')]=_0x231563[_0xade6('0x48')];_0x3b3331[_0xade6('0x49')]=_0x231563[_0xade6('0x49')];_0x3b3331['predictiveIntervalAvailable']=_0x231563['predictiveIntervalAvailable'];_0x3b3331[_0xade6('0x4a')]=_0x231563[_0xade6('0x4a')];_0x3b3331[_0xade6('0x4b')]=_0x231563['message'];_0x3b3331[_0xade6('0x4c')]=_0x231563[_0xade6('0x4c')];_0x3b3331[_0xade6('0x4d')]=_0x231563[_0xade6('0x4d')];_0x3b3331[_0xade6('0x4e')]=_0x231563[_0xade6('0x4e')];_0x3b3331[_0xade6('0x4f')]=_0x231563[_0xade6('0x4f')];_0x3b3331['erlangBusyFactor']=_0x231563[_0xade6('0x50')];_0x3b3331['startPredictive']=_0x231563[_0xade6('0x51')];_0x3b3331[_0xade6('0x52')]=_0x231563[_0xade6('0x52')];}if(_0x231563[_0xade6('0x53')]){_0x3b3331['Trunk']={'id':_0x231563['Trunk']['id'],'name':_0x231563[_0xade6('0x53')][_0xade6('0x8')],'active':_0x231563[_0xade6('0x53')][_0xade6('0x54')],'callerid':_0x231563[_0xade6('0x53')][_0xade6('0x55')]};}if(_0x231563[_0xade6('0x56')]){_0x3b3331[_0xade6('0x56')]={'id':_0x231563[_0xade6('0x56')]['id'],'name':_0x231563[_0xade6('0x56')][_0xade6('0x8')]};}_0x3699e2[_0xade6('0x57')](_0x3b3331);}}_0x34db65({'count':_0x3699e2[_0xade6('0x58')],'rows':_0x3699e2});});},'VoiceChannels':function(_0x3323a7){return new Promise(function(_0x4a33ee,_0xe48950){var _0x27072b=_[_0xade6('0x59')](_0xd19a9f[_0xade6('0x5a')]);_0x4a33ee({'count':_0x27072b[_0xade6('0x58')],'rows':_0x27072b});});},'VoiceChannelMixMonitor':function(_0x382756){var _0x208894=this;return new Promise(function(_0x3dd11c,_0x4726ce){if(ami[_0xade6('0xf')]()==![]){return _0x4726ce(_0x208894['error'](0x1f4,[config['asterisk']['ip'],config[_0xade6('0x11')]['username'],_0xade6('0x13')][_0xade6('0x14')]('\x20')));}var _0x35d19c=schema(properties[_0xade6('0x5b')])[_0xade6('0x1')](_0x382756);if(_0x35d19c[_0xade6('0x58')]>0x0){return _0x4726ce(_0x208894[_0xade6('0x10')](0x1f4,_[_0xade6('0x5c')](_0x35d19c,'message')['join'](',\x20')));}var _0x2eaf77=_['find'](_0xd19a9f['channels'],{'uniqueid':_0x382756[_0xade6('0x5d')]});if(_0x2eaf77&&_0x2eaf77[_0xade6('0x5e')]){var _0x1679d3=util[_0xade6('0x5f')](_0xade6('0x60'),_0x382756[_0xade6('0x61')]||_0x382756[_0xade6('0x5d')],_0x382756[_0xade6('0x5f')]||'wav');return ami[_0xade6('0x19')]({'action':'MixMonitor','channel':_0x2eaf77['channel'],'file':_0x1679d3,'options':_0xade6('0x62')})[_0xade6('0x1d')](function(_0x4aacc1){var _0x1fd7b0=_[_0xade6('0x63')](_0x2eaf77['monitors'],{'filename':_0xade6('0x64')+_0x1679d3[_0xade6('0x65')]()});if(_[_0xade6('0x66')](_0x1fd7b0)){_0x2eaf77['monitors'][_0xade6('0x57')]({'filename':'/var/spool/asterisk/monitor/'+_0x1679d3[_0xade6('0x65')](),'createdAt':moment()[_0xade6('0x5f')](_0xade6('0x67')),'mixmonitorid':_0x4aacc1['mixmonitorid'],'status':_0xade6('0x68')});}else{_0x1fd7b0[_0xade6('0x69')]=_0x4aacc1[_0xade6('0x69')];_0x1fd7b0[_0xade6('0x6a')]=_0xade6('0x68');}_0x3dd11c({'code':0xc8,'message':[_0x382756[_0xade6('0x5d')],_0xade6('0x6b'),_0x4aacc1[_0xade6('0x69')]][_0xade6('0x14')]('\x20'),'mixmonitorid':_0x4aacc1[_0xade6('0x69')]});})[_0xade6('0x1a')](function(_0x2a84f2){_0x4726ce(_0x208894[_0xade6('0x10')](0x1f5,[_0x382756['uniqueid'],_0x2a84f2[_0xade6('0x4b')]['toLowerCase']()]['join']('\x20')));});}else{return _0x4726ce(_0x208894[_0xade6('0x10')](0x1f5,_0xade6('0x6c')));}});},'VoiceChannelStopMixMonitor':function(_0x4dcdcb){var _0x2b58cb=this;return new Promise(function(_0x225640,_0x31a289){if(ami[_0xade6('0xf')]()==![]){return _0x31a289(_0x2b58cb[_0xade6('0x10')](0x1f4,[config[_0xade6('0x11')]['ip'],config['asterisk'][_0xade6('0x12')],'ami\x20disconnected'][_0xade6('0x14')]('\x20')));}var _0x3021ae=schema(properties['voicechannel'])[_0xade6('0x1')](_0x4dcdcb);if(_0x3021ae[_0xade6('0x58')]>0x0){return _0x31a289(_0x2b58cb['error'](0x1f4,_['map'](_0x3021ae,_0xade6('0x4b'))[_0xade6('0x14')](',\x20')));}var _0x4a4498=_[_0xade6('0x63')](_0xd19a9f[_0xade6('0x5a')],{'uniqueid':_0x4dcdcb['uniqueid']});if(_0x4a4498){return BPromise[_0xade6('0x6d')]()[_0xade6('0x1d')](function(){if(_0x4a4498[_0xade6('0x5e')]){return ami[_0xade6('0x19')]({'action':_0xade6('0x6e'),'channel':_0x4a4498[_0xade6('0x5e')],'mixmonitorid':_0x4dcdcb[_0xade6('0x69')]})[_0xade6('0x1a')](function(_0x3a6b44){});}})[_0xade6('0x1d')](function(){if(_0x4a4498[_0xade6('0x6f')]){return ami[_0xade6('0x19')]({'action':'StopMixMonitor','channel':_0x4a4498['destinationchannel'],'mixmonitorid':_0x4dcdcb[_0xade6('0x69')]})[_0xade6('0x1a')](function(_0x5140cf){});}})[_0xade6('0x1d')](function(_0xd7541d){var _0x1cfadb=_['find'](_0x4a4498['monitors'],{'mixmonitorid':_0x4dcdcb[_0xade6('0x69')]});if(_0x1cfadb){_0x1cfadb['status']=_0xade6('0x70');}})[_0xade6('0x1d')](function(){var _0x248feb=util['format'](_0xade6('0x60'),_0x4dcdcb[_0xade6('0x61')]||_0x4dcdcb['uniqueid'],_0x4dcdcb[_0xade6('0x5f')]||'wav');var _0x4880b0=_[_0xade6('0x63')](_0x4a4498[_0xade6('0x71')],{'filename':_0xade6('0x64')+_0x248feb[_0xade6('0x65')]()});if(_0x4880b0){_0x4880b0[_0xade6('0x6a')]=_0xade6('0x70');}})[_0xade6('0x1d')](function(){_0x225640({'code':0xc8,'message':[_0x4dcdcb[_0xade6('0x5d')],_0xade6('0x72')][_0xade6('0x14')]('\x20')});})[_0xade6('0x1a')](function(_0x2cef1c){_0x31a289(_0x2b58cb[_0xade6('0x10')](0x1f5,[_0x4dcdcb[_0xade6('0x5d')],_0x2cef1c[_0xade6('0x4b')][_0xade6('0x65')]()][_0xade6('0x14')]('\x20')));});}else{return _0x31a289(_0x2b58cb[_0xade6('0x10')](0x1f5,_0xade6('0x6c')));}});},'VoiceQueuesChannels':function(_0x4fd347){return new Promise(function(_0x15594e,_0x2b0223){var _0x38ebfe=_['values'](_0xd19a9f['queueChannels']);_0x15594e({'count':_0x38ebfe['length'],'rows':_0x38ebfe});});},'VoiceQueuesChannel':function(_0x1dc438){var _0xbb4b96=this;return new Promise(function(_0xcd7864,_0x3e16a5){var _0x3de1ee=schema(properties[_0xade6('0x73')])[_0xade6('0x1')](_0x1dc438);if(_0x3de1ee[_0xade6('0x58')]>0x0){return _0x3e16a5(_0xbb4b96[_0xade6('0x10')](0x1f4,_[_0xade6('0x5c')](_0x3de1ee,_0xade6('0x4b'))[_0xade6('0x14')](',\x20')));}var _0x2e29b8=_[_0xade6('0x63')](_0xd19a9f[_0xade6('0x74')],{'uniqueid':_0x1dc438[_0xade6('0x5d')]});if(_0x2e29b8){_0xcd7864(_0x2e29b8);}else{return _0x3e16a5(_0xbb4b96[_0xade6('0x10')](0x1f5,_0xade6('0x6c')));}});},'VoiceQueuesChannelHangup':function(_0x48ab53){var _0x1fa60b=this;return new Promise(function(_0x56fae4,_0xa9772b){if(ami[_0xade6('0xf')]()==![]){return _0xa9772b(_0x1fa60b[_0xade6('0x10')](0x1f4,[config[_0xade6('0x11')]['ip'],config[_0xade6('0x11')][_0xade6('0x12')],_0xade6('0x13')]['join']('\x20')));}var _0xeb58b2=schema(properties[_0xade6('0x75')])['validate'](_0x48ab53);if(_0xeb58b2[_0xade6('0x58')]>0x0){return _0xa9772b(_0x1fa60b['error'](0x1f4,_['map'](_0xeb58b2,_0xade6('0x4b'))[_0xade6('0x14')](',\x20')));}var _0x35a7e8=_['find'](_0xd19a9f[_0xade6('0x74')],{'uniqueid':_0x48ab53[_0xade6('0x5d')]});if(_0x35a7e8&&_0x35a7e8[_0xade6('0x5e')]){return ami['Action']({'action':_0xade6('0x76'),'channel':_0x35a7e8['channel']})['then'](function(_0x4a5aa4){_0x56fae4({'code':0xc8,'message':[_0x48ab53[_0xade6('0x5d')],_0x4a5aa4['message'][_0xade6('0x65')]()]['join']('\x20')});})['catch'](function(_0x44d88d){_0xa9772b(_0x1fa60b[_0xade6('0x10')](0x1f5,[_0x48ab53[_0xade6('0x5d')],_0x44d88d[_0xade6('0x4b')][_0xade6('0x65')]()][_0xade6('0x14')]('\x20')));});}else{return _0xa9772b(_0x1fa60b['error'](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0x485493){var _0x3cb4ae=this;return new Promise(function(_0x18dcdd,_0x4ce415){if(ami[_0xade6('0xf')]()==![]){return _0x4ce415(_0x3cb4ae[_0xade6('0x10')](0x1f4,[config[_0xade6('0x11')]['ip'],config[_0xade6('0x11')][_0xade6('0x12')],_0xade6('0x13')][_0xade6('0x14')]('\x20')));}var _0x366dc1=schema(properties[_0xade6('0x77')])['validate'](_0x485493);if(_0x366dc1[_0xade6('0x58')]>0x0){return _0x4ce415(_0x3cb4ae[_0xade6('0x10')](0x1f4,_[_0xade6('0x5c')](_0x366dc1,_0xade6('0x4b'))[_0xade6('0x14')](',\x20')));}var _0x5695da=_[_0xade6('0x63')](_0xd19a9f[_0xade6('0x74')],{'uniqueid':_0x485493[_0xade6('0x5d')]});if(_0x5695da&&_0x5695da[_0xade6('0x5e')]){return ami['Action']({'action':'Redirect','channel':_0x5695da['channel'],'exten':_0x485493[_0xade6('0x78')],'context':_0x485493[_0xade6('0x79')]||_0x5695da[_0xade6('0x79')],'priority':0x1})[_0xade6('0x1d')](function(_0x1a955d){_0x18dcdd({'code':0xc8,'message':[_0x485493[_0xade6('0x5d')],_0x1a955d[_0xade6('0x4b')][_0xade6('0x65')]()]['join']('\x20')});})[_0xade6('0x1a')](function(_0x18445d){_0x4ce415(_0x3cb4ae['error'](0x1f5,[_0x485493[_0xade6('0x5d')],_0x18445d[_0xade6('0x4b')][_0xade6('0x65')]()][_0xade6('0x14')]('\x20')));});}else{return _0x4ce415(_0x3cb4ae[_0xade6('0x10')](0x1f5,_0xade6('0x6c')));}});},'Agents':function(_0xcc1d42){return new Promise(function(_0x4690d4,_0x3a0f2b){var _0x87e5d3=_[_0xade6('0x59')](_0xd19a9f[_0xade6('0xb')]);_0x4690d4({'count':_0x87e5d3[_0xade6('0x58')],'rows':_0x87e5d3});});},'Telephones':function(_0x17275c){return new Promise(function(_0x27d91c,_0x5c739a){var _0x433c52=_['values'](_0xd19a9f[_0xade6('0x7a')]);_0x27d91c({'count':_0x433c52[_0xade6('0x58')],'rows':_0x433c52});});},'Trunks':function(_0x44a1b2){return new Promise(function(_0x26f560,_0x3ceeaa){var _0x3e12af=_[_0xade6('0x59')](_0xd19a9f['trunks']);_0x26f560({'count':_0x3e12af[_0xade6('0x58')],'rows':_0x3e12af});});},'OutboundChannels':function(_0xbb32ab){return new Promise(function(_0xfe2157,_0x200bfe){var _0x17e791=_[_0xade6('0x59')](_0xd19a9f[_0xade6('0x7b')]);_0xfe2157({'count':_0x17e791['length'],'rows':_0x17e791});});},'Outbound':function(_0x4c8c11){return new Promise(function(_0x229d2f,_0x28792d){_0x229d2f(_0xd19a9f[_0xade6('0x2b')]);});},'Campaigns':function(_0x2907f7){return new Promise(function(_0x2c8575,_0x1348be){var _0x4dc3c1=_[_0xade6('0x59')](_0xd19a9f[_0xade6('0x7c')]);_0x2c8575({'count':_0x4dc3c1['length'],'rows':_0x4dc3c1});});},'VoiceQueuesPreview':function(_0x12dca4){var _0x96118e=this;return new Promise(function(_0x55ecf7,_0x1bb3fd){_0x26daf5[_0xade6('0x7d')](_0x12dca4['id'])[_0xade6('0x1d')](function(_0x1a8466){_0x55ecf7({'code':0xc8,'message':_0x1a8466[_0xade6('0x4b')]});})['catch'](function(_0xc76fec){_0x1bb3fd(_0x96118e[_0xade6('0x10')](0x1f4,_0xc76fec[_0xade6('0x4b')]));});});},'EventManager':function(_0x3ed49a){var _0x11d812=this;return new Promise(function(_0x338d8f,_0x1d042b){if(!_0x3ed49a[_0xade6('0x7e')]){return _0x1d042b(_0x11d812[_0xade6('0x10')](0x1f4,_0xade6('0x7f')));}ami[_0xade6('0x80')](_0xade6('0x81')+_0x3ed49a[_0xade6('0x7e')],_0x3ed49a[_0xade6('0x4b')]);_0x338d8f({'code':0xc8,'message':_0x3ed49a});});},'FaxAccounts':function(_0x5444d3){return new Promise(function(_0x24b9ab,_0x150f87){var _0x2a26ed=_[_0xade6('0x59')](_0xd19a9f['faxAccounts']);_0x24b9ab({'count':_0x2a26ed[_0xade6('0x58')],'rows':_0x2a26ed});});},'SendFax':function(_0xd620){var _0x48bff9=this;return new Promise(function(_0x541d03,_0x3ed863){_0x5845a7['send'](_0xd620)['then'](function(_0x2d0555){_0x541d03({'code':0xc8,'message':_0x2d0555[_0xade6('0x4b')]});})[_0xade6('0x1a')](function(_0x4ac601){_0x3ed863(_0x48bff9['error'](0x1f4,_0x4ac601[_0xade6('0x4b')]));});});},'CheckAfterSend':function(_0x3640af){var _0x38db7b=this;return new Promise(function(_0x303985,_0x3184ef){_0x5845a7['checkAfterSend'](_0x3640af)['then'](function(_0xccae25){_0x303985({'code':0xc8,'message':_0xccae25[_0xade6('0x4b')]});})['catch'](function(_0x5e6981){_0x3184ef(_0x38db7b[_0xade6('0x10')](0x1f4,_0x5e6981['message']));});});}};var _0x5b525a=jayson[_0xade6('0x82')](_0x41c129)[_0xade6('0x83')]();_0x5b525a['on'](_0xade6('0x10'),function(_0x46f216){return _0x4f11eb(_0x46f216);});_0x5b525a['listen'](0x232a,'127.0.0.1',function(){console[_0xade6('0x84')]('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x127f95(_0xade6('0x85')+0x232a);});});}; \ No newline at end of file +var _0xd876=['rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','StopMixMonitor','destinationchannel','stop','monitors','StopMixMonitor\x20Success','values','queueChannels','voicequeuechannel','Hangup','voicequeuechannelredirect','Redirect','exten','context','telephones','trunks','outboundChannels','campaigns','run','event','Event\x20name\x20mandatory','emit','custom:','send','checkAfterSend','http','127.0.0.1','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','validate','bluebird','moment','../../../config/environment','../properties','listen','format','SIP','name','timers','updateAcw','agents','isConnected','error','asterisk','username','ami\x20disconnected','join','pick','module','action','then','message','catch','Command','Action','content','voiceQueues','hasOwnProperty','strategy','answered','available','loggedIn','pTalking','sumBillable','sumDuration','total','type','unmanaged','abandoned','waiting','loggedInDb','outbound','dialActive','dialMethod','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','callerid','Interval','push','length','channels','voicechannel','map','uniqueid','channel','%s.%s','filename','wav','MixMonitor','find','/var/spool/asterisk/monitor/','isNil','toLowerCase','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid'];(function(_0x25819f,_0x400f96){var _0x140283=function(_0x423774){while(--_0x423774){_0x25819f['push'](_0x25819f['shift']());}};_0x140283(++_0x400f96);}(_0xd876,0xa2));var _0x6d87=function(_0x2d2910,_0x55ecfb){_0x2d2910=_0x2d2910-0x0;var _0x14eb73=_0xd876[_0x2d2910];return _0x14eb73;};'use strict';var _=require(_0x6d87('0x0'));var util=require('util');var jayson=require('jayson/promise');var schema=require(_0x6d87('0x1'));var BPromise=require(_0x6d87('0x2'));var moment=require(_0x6d87('0x3'));var config=require(_0x6d87('0x4'));var properties=require(_0x6d87('0x5'));var ami=require('../ami');exports[_0x6d87('0x6')]=function(_0x55303b,_0x57f84e,_0x4a8eeb){return new BPromise(function(_0xbe798f,_0x592f2f){var _0x9cd691={'QueuePause':function(_0x492686){return new Promise(function(_0x404490,_0x65e650){var _0x4c62c7=util[_0x6d87('0x7')]('%s/%s',_0x6d87('0x8'),_0x492686[_0x6d87('0x9')]);if(_0x55303b[_0x6d87('0xa')]&&_0x55303b[_0x6d87('0xa')][_0x4c62c7]&&_0x55303b[_0x6d87('0xa')][_0x4c62c7]['timer']){_0x55303b[_0x6d87('0xa')][_0x4c62c7][_0x6d87('0xb')]();}if(_0x55303b[_0x6d87('0xc')][_0x4c62c7]){_0x55303b['agents'][_0x4c62c7]['updateStatusRealtime']({'statePause':_0x492686['pause']?!![]:![]});}_0x404490({'code':0xc8,'message':'QueuePause'});});},'Reload':function(_0x413325){var _0xfb1672=this;return new Promise(function(_0x5e6d8b,_0x2791fb){if(ami[_0x6d87('0xd')]()==![]){return _0x2791fb(_0xfb1672[_0x6d87('0xe')](0x1f4,[config[_0x6d87('0xf')]['ip'],config[_0x6d87('0xf')][_0x6d87('0x10')],_0x6d87('0x11')][_0x6d87('0x12')]('\x20')));}_0x413325=_[_0x6d87('0x13')](_0x413325,_['keys'](properties[_0x6d87('0x14')]));_0x413325[_0x6d87('0x15')]='Reload';return ami['Action'](_0x413325)[_0x6d87('0x16')](function(_0x5167e9){_0x5e6d8b({'code':0xc8,'message':_0x5167e9[_0x6d87('0x17')]});})[_0x6d87('0x18')](function(_0x3881f0){_0x2791fb(_0xfb1672[_0x6d87('0xe')](0x1f5,_0x3881f0[_0x6d87('0x17')]));});});},'Command':function(_0x57885a){var _0x3a1a6b=this;return new Promise(function(_0x3c3c17,_0x2db533){if(ami[_0x6d87('0xd')]()==![]){return _0x2db533(_0x3a1a6b['error'](0x1f4,[config[_0x6d87('0xf')]['ip'],config['asterisk'][_0x6d87('0x10')],_0x6d87('0x11')][_0x6d87('0x12')]('\x20')));}_0x57885a=_['pick'](_0x57885a,'command');_0x57885a[_0x6d87('0x15')]=_0x6d87('0x19');return ami[_0x6d87('0x1a')](_0x57885a)[_0x6d87('0x16')](function(_0xa4d3d7){_0x3c3c17({'code':0xc8,'message':_0xa4d3d7[_0x6d87('0x1b')]});})['catch'](function(_0xf52c4f){_0x2db533(_0x3a1a6b[_0x6d87('0xe')](0x1f5,_0xf52c4f[_0x6d87('0x17')]));});});},'VoiceQueues':function(_0x326a9c){return new Promise(function(_0xe828f2,_0xa53cae){var _0x26c36b=[];for(var _0x5a282d in _0x55303b[_0x6d87('0x1c')]){if(_0x55303b[_0x6d87('0x1c')][_0x6d87('0x1d')](_0x5a282d)){var _0x5bff02=_0x55303b[_0x6d87('0x1c')][_0x5a282d];var _0x4d6e02={'id':_0x5bff02['id'],'name':_0x5bff02[_0x6d87('0x9')],'strategy':_0x5bff02[_0x6d87('0x1e')],'answered':_0x5bff02[_0x6d87('0x1f')],'available':_0x5bff02[_0x6d87('0x20')],'loggedIn':_0x5bff02[_0x6d87('0x21')],'pTalking':_0x5bff02[_0x6d87('0x22')],'sumBillable':_0x5bff02[_0x6d87('0x23')],'sumDuration':_0x5bff02[_0x6d87('0x24')],'sumHoldTime':_0x5bff02['sumHoldTime']||0x0,'talking':_0x5bff02['talking'],'total':_0x5bff02[_0x6d87('0x25')],'type':_0x5bff02[_0x6d87('0x26')],'unmanaged':_0x5bff02[_0x6d87('0x27')],'abandoned':_0x5bff02[_0x6d87('0x28')],'waiting':_0x5bff02[_0x6d87('0x29')],'loggedInDb':_0x5bff02[_0x6d87('0x2a')]};if(_0x5bff02[_0x6d87('0x26')]===_0x6d87('0x2b')){_0x4d6e02[_0x6d87('0x2c')]=_0x5bff02['dialActive'];_0x4d6e02['dialMethod']=_0x5bff02[_0x6d87('0x2d')];_0x4d6e02['dialOriginateCallerIdName']=_0x5bff02['dialOriginateCallerIdName'];_0x4d6e02[_0x6d87('0x2e')]=_0x5bff02['dialOriginateCallerIdNumber'];_0x4d6e02['dialOriginateTimeout']=_0x5bff02[_0x6d87('0x2f')];_0x4d6e02[_0x6d87('0x30')]=_0x5bff02[_0x6d87('0x30')];_0x4d6e02[_0x6d87('0x31')]=_0x5bff02[_0x6d87('0x31')];_0x4d6e02[_0x6d87('0x32')]=_0x5bff02['outboundAnswerCallsDay'];_0x4d6e02[_0x6d87('0x33')]=_0x5bff02[_0x6d87('0x33')];_0x4d6e02[_0x6d87('0x34')]=_0x5bff02['outboundBusyCallsDay'];_0x4d6e02[_0x6d87('0x35')]=_0x5bff02[_0x6d87('0x35')];_0x4d6e02[_0x6d87('0x36')]=_0x5bff02[_0x6d87('0x36')];_0x4d6e02[_0x6d87('0x37')]=_0x5bff02[_0x6d87('0x37')];_0x4d6e02['outboundDropCallsDayTimeout']=_0x5bff02[_0x6d87('0x38')];_0x4d6e02['outboundNoAnswerCallsDay']=_0x5bff02[_0x6d87('0x39')];_0x4d6e02[_0x6d87('0x3a')]=_0x5bff02[_0x6d87('0x3a')];_0x4d6e02[_0x6d87('0x3b')]=_0x5bff02[_0x6d87('0x3b')];_0x4d6e02[_0x6d87('0x3c')]=_0x5bff02['outboundReCallsDay'];_0x4d6e02[_0x6d87('0x3d')]=_0x5bff02[_0x6d87('0x3d')];_0x4d6e02[_0x6d87('0x3e')]=_0x5bff02[_0x6d87('0x3e')];_0x4d6e02[_0x6d87('0x3f')]=_0x5bff02[_0x6d87('0x3f')];_0x4d6e02['predictiveIntervalAvgHoldtime']=_0x5bff02['predictiveIntervalAvgHoldtime'];_0x4d6e02['predictiveIntervalAvgTalktime']=_0x5bff02[_0x6d87('0x40')];_0x4d6e02['predictiveIntervalDroppedCallsCallersExit']=_0x5bff02['predictiveIntervalDroppedCallsCallersExit'];_0x4d6e02[_0x6d87('0x41')]=_0x5bff02['predictiveIntervalDroppedCallsTimeout'];_0x4d6e02[_0x6d87('0x42')]=_0x5bff02['predictiveIntervalErlangCalls'];_0x4d6e02['predictiveIntervalErlangCallsDroppedCalls']=_0x5bff02['predictiveIntervalErlangCallsDroppedCalls'];_0x4d6e02['predictiveIntervalHitRate']=_0x5bff02[_0x6d87('0x43')];_0x4d6e02[_0x6d87('0x44')]=_0x5bff02[_0x6d87('0x44')];_0x4d6e02['predictiveIntervalPauses']=_0x5bff02['predictiveIntervalPauses'];_0x4d6e02['predictiveIntervalAvailable']=_0x5bff02[_0x6d87('0x45')];_0x4d6e02[_0x6d87('0x46')]=_0x5bff02['predictiveIntervalTotalCalls'];_0x4d6e02[_0x6d87('0x17')]=_0x5bff02[_0x6d87('0x17')];_0x4d6e02[_0x6d87('0x47')]=_0x5bff02[_0x6d87('0x47')];_0x4d6e02['erlangCalls']=_0x5bff02[_0x6d87('0x48')];_0x4d6e02[_0x6d87('0x49')]=_0x5bff02[_0x6d87('0x49')];_0x4d6e02[_0x6d87('0x4a')]=_0x5bff02['erlangAbandonmentRate'];_0x4d6e02[_0x6d87('0x4b')]=_0x5bff02['erlangBusyFactor'];_0x4d6e02[_0x6d87('0x4c')]=_0x5bff02['startPredictive'];_0x4d6e02['startProgressive']=_0x5bff02[_0x6d87('0x4d')];}if(_0x5bff02[_0x6d87('0x4e')]){_0x4d6e02['Trunk']={'id':_0x5bff02[_0x6d87('0x4e')]['id'],'name':_0x5bff02[_0x6d87('0x4e')][_0x6d87('0x9')],'active':_0x5bff02[_0x6d87('0x4e')]['active'],'callerid':_0x5bff02['Trunk'][_0x6d87('0x4f')]};}if(_0x5bff02['Interval']){_0x4d6e02[_0x6d87('0x50')]={'id':_0x5bff02[_0x6d87('0x50')]['id'],'name':_0x5bff02[_0x6d87('0x50')][_0x6d87('0x9')]};}_0x26c36b[_0x6d87('0x51')](_0x4d6e02);}}_0xe828f2({'count':_0x26c36b[_0x6d87('0x52')],'rows':_0x26c36b});});},'VoiceChannels':function(_0x7de28b){return new Promise(function(_0x5a921b,_0x174856){var _0x1d1179=_['values'](_0x55303b[_0x6d87('0x53')]);_0x5a921b({'count':_0x1d1179[_0x6d87('0x52')],'rows':_0x1d1179});});},'VoiceChannelMixMonitor':function(_0x5f3bfb){var _0x279642=this;return new Promise(function(_0x16c95b,_0x4104f6){if(ami[_0x6d87('0xd')]()==![]){return _0x4104f6(_0x279642[_0x6d87('0xe')](0x1f4,[config[_0x6d87('0xf')]['ip'],config[_0x6d87('0xf')][_0x6d87('0x10')],_0x6d87('0x11')]['join']('\x20')));}var _0x5bc8bc=schema(properties[_0x6d87('0x54')])['validate'](_0x5f3bfb);if(_0x5bc8bc['length']>0x0){return _0x4104f6(_0x279642[_0x6d87('0xe')](0x1f4,_[_0x6d87('0x55')](_0x5bc8bc,'message')[_0x6d87('0x12')](',\x20')));}var _0x3a6c30=_['find'](_0x55303b[_0x6d87('0x53')],{'uniqueid':_0x5f3bfb[_0x6d87('0x56')]});if(_0x3a6c30&&_0x3a6c30[_0x6d87('0x57')]){var _0x52ec26=util['format'](_0x6d87('0x58'),_0x5f3bfb[_0x6d87('0x59')]||_0x5f3bfb['uniqueid'],_0x5f3bfb[_0x6d87('0x7')]||_0x6d87('0x5a'));return ami[_0x6d87('0x1a')]({'action':_0x6d87('0x5b'),'channel':_0x3a6c30['channel'],'file':_0x52ec26,'options':'ai(mixmonitorid)'})[_0x6d87('0x16')](function(_0x42c4fe){var _0x12341a=_[_0x6d87('0x5c')](_0x3a6c30['monitors'],{'filename':_0x6d87('0x5d')+_0x52ec26['toLowerCase']()});if(_[_0x6d87('0x5e')](_0x12341a)){_0x3a6c30['monitors']['push']({'filename':_0x6d87('0x5d')+_0x52ec26[_0x6d87('0x5f')](),'createdAt':moment()[_0x6d87('0x7')](_0x6d87('0x60')),'mixmonitorid':_0x42c4fe[_0x6d87('0x61')],'status':_0x6d87('0x62')});}else{_0x12341a['mixmonitorid']=_0x42c4fe[_0x6d87('0x61')];_0x12341a[_0x6d87('0x63')]='rec';}_0x16c95b({'code':0xc8,'message':[_0x5f3bfb[_0x6d87('0x56')],_0x6d87('0x64'),_0x42c4fe['mixmonitorid']]['join']('\x20'),'mixmonitorid':_0x42c4fe[_0x6d87('0x61')]});})['catch'](function(_0x5ec045){_0x4104f6(_0x279642[_0x6d87('0xe')](0x1f5,[_0x5f3bfb['uniqueid'],_0x5ec045[_0x6d87('0x17')][_0x6d87('0x5f')]()][_0x6d87('0x12')]('\x20')));});}else{return _0x4104f6(_0x279642[_0x6d87('0xe')](0x1f5,_0x6d87('0x65')));}});},'VoiceChannelStopMixMonitor':function(_0x4fe7b3){var _0x55bf35=this;return new Promise(function(_0x4ec392,_0x481906){if(ami['isConnected']()==![]){return _0x481906(_0x55bf35[_0x6d87('0xe')](0x1f4,[config[_0x6d87('0xf')]['ip'],config[_0x6d87('0xf')][_0x6d87('0x10')],_0x6d87('0x11')][_0x6d87('0x12')]('\x20')));}var _0x1b6744=schema(properties[_0x6d87('0x54')])[_0x6d87('0x1')](_0x4fe7b3);if(_0x1b6744['length']>0x0){return _0x481906(_0x55bf35[_0x6d87('0xe')](0x1f4,_[_0x6d87('0x55')](_0x1b6744,_0x6d87('0x17'))[_0x6d87('0x12')](',\x20')));}var _0xa6e261=_[_0x6d87('0x5c')](_0x55303b[_0x6d87('0x53')],{'uniqueid':_0x4fe7b3[_0x6d87('0x56')]});if(_0xa6e261){return BPromise['resolve']()[_0x6d87('0x16')](function(){if(_0xa6e261[_0x6d87('0x57')]){return ami[_0x6d87('0x1a')]({'action':_0x6d87('0x66'),'channel':_0xa6e261['channel'],'mixmonitorid':_0x4fe7b3[_0x6d87('0x61')]})[_0x6d87('0x18')](function(_0x3a292b){});}})[_0x6d87('0x16')](function(){if(_0xa6e261[_0x6d87('0x67')]){return ami[_0x6d87('0x1a')]({'action':_0x6d87('0x66'),'channel':_0xa6e261[_0x6d87('0x67')],'mixmonitorid':_0x4fe7b3[_0x6d87('0x61')]})[_0x6d87('0x18')](function(_0x5660fe){});}})[_0x6d87('0x16')](function(_0x24e4bf){var _0x42cf39=_['find'](_0xa6e261['monitors'],{'mixmonitorid':_0x4fe7b3['mixmonitorid']});if(_0x42cf39){_0x42cf39['status']=_0x6d87('0x68');}})[_0x6d87('0x16')](function(){var _0x5a1234=util[_0x6d87('0x7')](_0x6d87('0x58'),_0x4fe7b3[_0x6d87('0x59')]||_0x4fe7b3[_0x6d87('0x56')],_0x4fe7b3[_0x6d87('0x7')]||_0x6d87('0x5a'));var _0x2556e2=_[_0x6d87('0x5c')](_0xa6e261[_0x6d87('0x69')],{'filename':_0x6d87('0x5d')+_0x5a1234[_0x6d87('0x5f')]()});if(_0x2556e2){_0x2556e2[_0x6d87('0x63')]=_0x6d87('0x68');}})[_0x6d87('0x16')](function(){_0x4ec392({'code':0xc8,'message':[_0x4fe7b3['uniqueid'],_0x6d87('0x6a')][_0x6d87('0x12')]('\x20')});})[_0x6d87('0x18')](function(_0x5ea900){_0x481906(_0x55bf35['error'](0x1f5,[_0x4fe7b3[_0x6d87('0x56')],_0x5ea900[_0x6d87('0x17')]['toLowerCase']()][_0x6d87('0x12')]('\x20')));});}else{return _0x481906(_0x55bf35['error'](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannels':function(_0x5e18cc){return new Promise(function(_0x538b9a,_0x5450bb){var _0x1abd0f=_[_0x6d87('0x6b')](_0x55303b[_0x6d87('0x6c')]);_0x538b9a({'count':_0x1abd0f['length'],'rows':_0x1abd0f});});},'VoiceQueuesChannel':function(_0x50d302){var _0x40c3a8=this;return new Promise(function(_0x695e2a,_0x379f08){var _0x403e0c=schema(properties[_0x6d87('0x6d')])[_0x6d87('0x1')](_0x50d302);if(_0x403e0c[_0x6d87('0x52')]>0x0){return _0x379f08(_0x40c3a8[_0x6d87('0xe')](0x1f4,_[_0x6d87('0x55')](_0x403e0c,_0x6d87('0x17'))[_0x6d87('0x12')](',\x20')));}var _0x31fbec=_[_0x6d87('0x5c')](_0x55303b[_0x6d87('0x6c')],{'uniqueid':_0x50d302['uniqueid']});if(_0x31fbec){_0x695e2a(_0x31fbec);}else{return _0x379f08(_0x40c3a8[_0x6d87('0xe')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelHangup':function(_0x4b140c){var _0xa388cf=this;return new Promise(function(_0x19bf12,_0x6efebb){if(ami[_0x6d87('0xd')]()==![]){return _0x6efebb(_0xa388cf[_0x6d87('0xe')](0x1f4,[config[_0x6d87('0xf')]['ip'],config[_0x6d87('0xf')]['username'],_0x6d87('0x11')][_0x6d87('0x12')]('\x20')));}var _0x495568=schema(properties['voicequeuechannelhangup'])[_0x6d87('0x1')](_0x4b140c);if(_0x495568[_0x6d87('0x52')]>0x0){return _0x6efebb(_0xa388cf[_0x6d87('0xe')](0x1f4,_[_0x6d87('0x55')](_0x495568,_0x6d87('0x17'))['join'](',\x20')));}var _0xcc6616=_[_0x6d87('0x5c')](_0x55303b[_0x6d87('0x6c')],{'uniqueid':_0x4b140c[_0x6d87('0x56')]});if(_0xcc6616&&_0xcc6616[_0x6d87('0x57')]){return ami[_0x6d87('0x1a')]({'action':_0x6d87('0x6e'),'channel':_0xcc6616[_0x6d87('0x57')]})[_0x6d87('0x16')](function(_0x489401){_0x19bf12({'code':0xc8,'message':[_0x4b140c[_0x6d87('0x56')],_0x489401['message'][_0x6d87('0x5f')]()][_0x6d87('0x12')]('\x20')});})[_0x6d87('0x18')](function(_0x564b66){_0x6efebb(_0xa388cf['error'](0x1f5,[_0x4b140c['uniqueid'],_0x564b66[_0x6d87('0x17')][_0x6d87('0x5f')]()][_0x6d87('0x12')]('\x20')));});}else{return _0x6efebb(_0xa388cf[_0x6d87('0xe')](0x1f5,_0x6d87('0x65')));}});},'VoiceQueuesChannelRedirect':function(_0x498933){var _0xa6246e=this;return new Promise(function(_0x579a46,_0x38ef1e){if(ami[_0x6d87('0xd')]()==![]){return _0x38ef1e(_0xa6246e[_0x6d87('0xe')](0x1f4,[config[_0x6d87('0xf')]['ip'],config[_0x6d87('0xf')][_0x6d87('0x10')],_0x6d87('0x11')]['join']('\x20')));}var _0x216581=schema(properties[_0x6d87('0x6f')])[_0x6d87('0x1')](_0x498933);if(_0x216581['length']>0x0){return _0x38ef1e(_0xa6246e[_0x6d87('0xe')](0x1f4,_['map'](_0x216581,_0x6d87('0x17'))[_0x6d87('0x12')](',\x20')));}var _0x4a1556=_[_0x6d87('0x5c')](_0x55303b[_0x6d87('0x6c')],{'uniqueid':_0x498933[_0x6d87('0x56')]});if(_0x4a1556&&_0x4a1556[_0x6d87('0x57')]){return ami[_0x6d87('0x1a')]({'action':_0x6d87('0x70'),'channel':_0x4a1556['channel'],'exten':_0x498933[_0x6d87('0x71')],'context':_0x498933[_0x6d87('0x72')]||_0x4a1556[_0x6d87('0x72')],'priority':0x1})['then'](function(_0x1851e7){_0x579a46({'code':0xc8,'message':[_0x498933['uniqueid'],_0x1851e7['message'][_0x6d87('0x5f')]()][_0x6d87('0x12')]('\x20')});})[_0x6d87('0x18')](function(_0x1c0763){_0x38ef1e(_0xa6246e[_0x6d87('0xe')](0x1f5,[_0x498933[_0x6d87('0x56')],_0x1c0763[_0x6d87('0x17')][_0x6d87('0x5f')]()][_0x6d87('0x12')]('\x20')));});}else{return _0x38ef1e(_0xa6246e[_0x6d87('0xe')](0x1f5,_0x6d87('0x65')));}});},'Agents':function(_0x5d84b5){return new Promise(function(_0x2a9feb,_0x38eea7){var _0x279fc5=_[_0x6d87('0x6b')](_0x55303b[_0x6d87('0xc')]);_0x2a9feb({'count':_0x279fc5[_0x6d87('0x52')],'rows':_0x279fc5});});},'Telephones':function(_0x5c1656){return new Promise(function(_0x17e580,_0x20937d){var _0x3f22ab=_[_0x6d87('0x6b')](_0x55303b[_0x6d87('0x73')]);_0x17e580({'count':_0x3f22ab[_0x6d87('0x52')],'rows':_0x3f22ab});});},'Trunks':function(_0x5393df){return new Promise(function(_0x5e02d1,_0x5d12eb){var _0xf6533d=_[_0x6d87('0x6b')](_0x55303b[_0x6d87('0x74')]);_0x5e02d1({'count':_0xf6533d['length'],'rows':_0xf6533d});});},'OutboundChannels':function(_0x22e7ee){return new Promise(function(_0x13d45e,_0xef5026){var _0x2a8dbb=_[_0x6d87('0x6b')](_0x55303b[_0x6d87('0x75')]);_0x13d45e({'count':_0x2a8dbb[_0x6d87('0x52')],'rows':_0x2a8dbb});});},'Outbound':function(_0x196914){return new Promise(function(_0x2e9830,_0x3f73b2){_0x2e9830(_0x55303b['outbound']);});},'Campaigns':function(_0x9fcfb4){return new Promise(function(_0x3b8c97,_0x4e4ef3){var _0x1d31b7=_[_0x6d87('0x6b')](_0x55303b[_0x6d87('0x76')]);_0x3b8c97({'count':_0x1d31b7[_0x6d87('0x52')],'rows':_0x1d31b7});});},'VoiceQueuesPreview':function(_0x2ef087){var _0x1a2070=this;return new Promise(function(_0x306ae9,_0x690bf2){_0x57f84e[_0x6d87('0x77')](_0x2ef087['id'])['then'](function(_0x5cbbb4){_0x306ae9({'code':0xc8,'message':_0x5cbbb4['message']});})[_0x6d87('0x18')](function(_0x2dfab2){_0x690bf2(_0x1a2070['error'](0x1f4,_0x2dfab2[_0x6d87('0x17')]));});});},'EventManager':function(_0x367750){var _0x20055a=this;return new Promise(function(_0x11865b,_0x15ae47){if(!_0x367750[_0x6d87('0x78')]){return _0x15ae47(_0x20055a[_0x6d87('0xe')](0x1f4,_0x6d87('0x79')));}ami[_0x6d87('0x7a')](_0x6d87('0x7b')+_0x367750[_0x6d87('0x78')],_0x367750[_0x6d87('0x17')]);_0x11865b({'code':0xc8,'message':_0x367750});});},'FaxAccounts':function(_0x53f893){return new Promise(function(_0x35fc08,_0x3a1876){var _0x127247=_[_0x6d87('0x6b')](_0x55303b['faxAccounts']);_0x35fc08({'count':_0x127247[_0x6d87('0x52')],'rows':_0x127247});});},'SendFax':function(_0x46c509){var _0x33841d=this;return new Promise(function(_0x239172,_0x22cd28){_0x4a8eeb[_0x6d87('0x7c')](_0x46c509)[_0x6d87('0x16')](function(_0x3148f8){_0x239172({'code':0xc8,'message':_0x3148f8[_0x6d87('0x17')]});})[_0x6d87('0x18')](function(_0x264b3e){_0x22cd28(_0x33841d[_0x6d87('0xe')](0x1f4,_0x264b3e[_0x6d87('0x17')]));});});},'CheckAfterSend':function(_0x1710b2){var _0x3cef01=this;return new Promise(function(_0x48f81d,_0x9abee4){_0x4a8eeb[_0x6d87('0x7d')](_0x1710b2)['then'](function(_0x34a12c){_0x48f81d({'code':0xc8,'message':_0x34a12c[_0x6d87('0x17')]});})['catch'](function(_0x28dd8c){_0x9abee4(_0x3cef01['error'](0x1f4,_0x28dd8c[_0x6d87('0x17')]));});});}};var _0x288c1c=jayson['server'](_0x9cd691)[_0x6d87('0x7e')]();_0x288c1c['on']('error',function(_0x40751e){return _0x592f2f(_0x40751e);});_0x288c1c[_0x6d87('0x6')](0x232a,_0x6d87('0x7f'),function(){console['log'](_0x6d87('0x80'),0x232a);return _0xbe798f(_0x6d87('0x81')+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 2e69331..c833611 100644 --- a/server/services/ami/trigger/cmContact/index.js +++ b/server/services/ami/trigger/cmContact/index.js @@ -1,18 +1,102 @@ -// ************************************************************************* -// * * -// * xCALLY Motion - The Omnichannel Contact Center * -// * Copyright (c) Xenialab s.r.l. All Rights Reserved * -// * * -// ************************************************************************* -// * * -// * Email: info@xcally.com * -// * Website: https://www.xcally.com * -// * * -// ************************************************************************* -// * * -// * The SOFTWARE PRODUCT is protected by copyright laws and international * -// * copyright treaties, as well as other intellectual property laws and * -// * treaties. The SOFTWARE PRODUCT is licensed, not sold. * -// * * -// ************************************************************************* -var _0x2a9a=['destcalleridname','then','createContact','[CM][%s][%s]\x20Autocreate\x20disabled','user:%s','trigger:%s','action','toLowerCase','lodash','ioredis','../../../../config/logger','trigger','../../rpc/cmContact','redis','defaults','localhost','socket.io-emitter','info','[CM][%s][%s]','stringify','emit','data1','data2','xmd-contactid2','isEmpty','ListId','data3','phone','map','routeId','destcalleridnum','resolve','getContacts','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','[CM][%s][%s]\x20Autocreate\x20enabled','data4','calleridnum','isNil','firstName','calleridname','','Unknown'];(function(_0x53e70c,_0x310fed){var _0x3e8443=function(_0x1b85e5){while(--_0x1b85e5){_0x53e70c['push'](_0x53e70c['shift']());}};_0x3e8443(++_0x310fed);}(_0x2a9a,0x64));var _0xa2a9=function(_0x4ffccc,_0x2576e6){_0x4ffccc=_0x4ffccc-0x0;var _0x349f01=_0x2a9a[_0x4ffccc];return _0x349f01;};'use strict';var _=require(_0xa2a9('0x0'));var BPromise=require('bluebird');var Redis=require(_0xa2a9('0x1'));var util=require('util');var config=require('../../../../config/environment');var logger=require(_0xa2a9('0x2'))(_0xa2a9('0x3'));var cmContactRpc=require(_0xa2a9('0x4'));config[_0xa2a9('0x5')]=_[_0xa2a9('0x6')](config['redis'],{'host':_0xa2a9('0x7'),'port':0x18eb});var io=require(_0xa2a9('0x8'))(new Redis(config[_0xa2a9('0x5')]));function emit(_0x2bd1f3,_0x5c1fb2,_0x5d933f,_0x540979,_0x523164){logger[_0xa2a9('0x9')](_0xa2a9('0xa'),_0x2bd1f3,_0x5c1fb2['id'],_0x5d933f,_0x540979,JSON[_0xa2a9('0xb')](_0x523164));io['to'](_0x5d933f)[_0xa2a9('0xc')](_0x540979,_0x523164);}exports['exec']=function(_0x2daf1c,_0x375682,_0x5e9222,_0x149ebe){var _0x77ffee,_0x312aa9;var _0x302ca3={};var _0x4fb822=Number(_0x5e9222[_0xa2a9('0xd')]);var _0x252808=_0x5e9222[_0xa2a9('0xe')]?Boolean(Number(_0x5e9222[_0xa2a9('0xe')])):![];if(_0x149ebe[_0xa2a9('0xf')]&&!_[_0xa2a9('0x10')](_0x149ebe['xmd-contactid2']))_0x302ca3['id']=_0x149ebe[_0xa2a9('0xf')];if(!_0x302ca3['id']){_0x302ca3[_0xa2a9('0x11')]=_0x4fb822;var _0x4e4078=_0x5e9222['data3']&&_0x5e9222['data3']!=='0'?_0x5e9222[_0xa2a9('0x12')]['split'](','):[_0xa2a9('0x13')];_0x302ca3['$or']=_[_0xa2a9('0x14')](_0x4e4078,function(_0x11838f){return{['field']:_0x149ebe[_0xa2a9('0x15')]?_0x149ebe[_0xa2a9('0x16')]:_0x149ebe['calleridnum']};});}BPromise[_0xa2a9('0x17')]()['then'](cmContactRpc[_0xa2a9('0x18')]({'where':_0x302ca3}))['then'](function(_0x398419){_0x312aa9=_0x398419;if(!_['isEmpty'](_0x312aa9)){if(_0x312aa9[_0xa2a9('0x19')]===0x1){_0x77ffee=_0x312aa9[0x0];logger[_0xa2a9('0x9')](_0xa2a9('0x1a'),_0x149ebe[_0xa2a9('0x1b')],_0x375682['id'],_0x77ffee['id']);}else{logger[_0xa2a9('0x9')](_0xa2a9('0x1c'),_0x149ebe[_0xa2a9('0x1b')],_0x375682['id'],_[_0xa2a9('0x14')](_0x312aa9,'id')[_0xa2a9('0x1d')](','));}return;}else{logger[_0xa2a9('0x9')]('[CM][%s][%s]\x20Contact\x20not\x20found',_0x149ebe[_0xa2a9('0x1b')],_0x375682['id']);if(_0x252808){logger[_0xa2a9('0x9')](_0xa2a9('0x1e'),_0x149ebe[_0xa2a9('0x1b')],_0x375682['id']);var _0x313c59=_0x5e9222[_0xa2a9('0x1f')]&&_0x5e9222['data4']!=='0'?_0x5e9222[_0xa2a9('0x1f')]:'phone';var _0x4de5fd={'ListId':_0x4fb822,['creationField']:_['isNil'](_0x149ebe[_0xa2a9('0x15')])?_0x149ebe[_0xa2a9('0x20')]:_0x149ebe['destcalleridnum']};if(_[_0xa2a9('0x21')](_0x149ebe[_0xa2a9('0x15')])){_0x4de5fd[_0xa2a9('0x22')]=_0x149ebe[_0xa2a9('0x23')]&&_0x149ebe['calleridname']!==_0xa2a9('0x24')?_0x149ebe[_0xa2a9('0x23')]:_0xa2a9('0x25');}else{_0x4de5fd['firstName']=_0x149ebe[_0xa2a9('0x26')]&&_0x149ebe[_0xa2a9('0x26')]!==_0xa2a9('0x24')?_0x149ebe['destcalleridname']:'Unknown';}return BPromise['resolve']()[_0xa2a9('0x27')](cmContactRpc[_0xa2a9('0x28')](_0x4de5fd))[_0xa2a9('0x27')](function(_0xca45e8){_0x77ffee=_0xca45e8;if(_0x77ffee){logger[_0xa2a9('0x9')]('[CM][%s][%s]\x20Contact\x20created:%s',_0x149ebe[_0xa2a9('0x1b')],_0x375682['id'],_0x77ffee['id']);}return;});}else{logger[_0xa2a9('0x9')](_0xa2a9('0x29'),_0x149ebe[_0xa2a9('0x1b')],_0x375682['id']);return;}}})[_0xa2a9('0x27')](function(){if(_0x2daf1c){emit(_0x149ebe['uniqueid'],_0x375682,util['format'](_0xa2a9('0x2a'),_0x2daf1c['name']),util['format'](_0xa2a9('0x2b'),_0x5e9222[_0xa2a9('0x2c')][_0xa2a9('0x2d')]()),{'evt':_['merge'](_0x149ebe,{'autoCreate':_0x252808}),'contact':_0x77ffee,'contacts':!_0x77ffee?_0x312aa9:undefined});}});}; \ No newline at end of file +'use strict'; + +var _ = require('lodash'); +var BPromise = require('bluebird'); +var Redis = require('ioredis'); +var util = require('util'); + +var config = require('../../../../config/environment'); +var logger = require('../../../../config/logger')('trigger'); +var cmContactRpc = require('../../rpc/cmContact'); + +config.redis = _.defaults(config.redis, { + host: 'localhost', + port: 6379 +}); + +var io = require('socket.io-emitter')(new Redis(config.redis)); + +function emit(uniqueid, trigger, room, evt, obj) { + logger.info('[CM][%s][%s]', uniqueid, trigger.id, room, evt, JSON.stringify(obj)); + io.to(room).emit(evt, obj); +} + +exports.exec = function (agent, trigger, action, evt) { + var contact, contacts; + var options = {}; + var listId = Number(action.data1); + var autoCreate = action.data2 ? Boolean(Number(action.data2)) : false; + + // Checking if the contact's id is defined + if (evt['xmd-contactid2'] && !_.isEmpty(evt['xmd-contactid2'])) options.id = evt['xmd-contactid2']; + + if (!options.id) { + options.ListId = listId; + // Retrieves the fields selected for searching the contact + var searchFields = action.data3 && action.data3 !== '0' ? action.data3.split(',') : ['phone']; + options.$or = _.map(searchFields, function (field) { + return { + [field]: evt.routeId ? evt.destcalleridnum : evt.calleridnum + }; + }); + } + + // Searching the contact + BPromise.resolve() + .then( + cmContactRpc.getContacts({ + where: options + }) + ) + .then(function (result) { + contacts = result; + if (!_.isEmpty(contacts)) { + if (contacts.length === 1) { + contact = contacts[0]; + logger.info('[CM][%s][%s] Contact found:%s', evt.uniqueid, trigger.id, contact.id); + } else { + logger.info('[CM][%s][%s] Multiple contacts found:[%s]', evt.uniqueid, trigger.id, _.map(contacts, 'id').join(',')); + } + return; + } else { + logger.info('[CM][%s][%s] Contact not found', evt.uniqueid, trigger.id); + if (autoCreate) { + logger.info('[CM][%s][%s] Autocreate enabled', evt.uniqueid, trigger.id); + var creationField = action.data4 && action.data4 !== '0' ? action.data4 : 'phone'; + var newContact = { + ListId: listId, + [creationField]: _.isNil(evt.routeId) ? evt.calleridnum : evt.destcalleridnum + }; + + if (_.isNil(evt.routeId)) { + newContact.firstName = evt.calleridname && evt.calleridname !== '' ? evt.calleridname : 'Unknown'; + } else { + newContact.firstName = evt.destcalleridname && evt.destcalleridname !== '' ? evt.destcalleridname : 'Unknown'; + } + + return BPromise.resolve() + .then(cmContactRpc.createContact(newContact)) + .then(function (result) { + contact = result; + if (contact) { + logger.info('[CM][%s][%s] Contact created:%s', evt.uniqueid, trigger.id, contact.id); + } + return; + }); + } else { + logger.info('[CM][%s][%s] Autocreate disabled', evt.uniqueid, trigger.id); + return; + } + } + }) + .then(function () { + // Emitting the event + if (agent) { + emit(evt.uniqueid, trigger, util.format('user:%s', agent.name), util.format('trigger:%s', action.action.toLowerCase()), { + evt: _.merge(evt, { autoCreate: autoCreate }), + contact: contact, + contacts: !contact ? contacts : undefined + }); + } + }); +}; diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index fc6daf0..f721981 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 _0xe0e7=['data3','data4','location','uriLocation','windowWidth','isNil','800','data5','windowHeight','data6','winApplication','winArguments','emit','user:%s','trigger:%s:%s','action','merge','jscripty','format','trigger:%s','name','integration','exec','queue','routeId','urlforward','script','parse','query','search','replace','AllConditions','checkConditions','AnyConditions','some','channel','field','chat','upperFirst','AccountId','operator','value','interaction','message','event','agent','membername','lastevent','exports','lodash','url','mustache','ioredis','./urlforward','./integration','./script','../../../config/environment','../../../config/logger','trigger','redis','defaults','socket.io-emitter','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','dynamics365Accounts','freshsalesAccounts','accounts','servicenowAccounts','custom:agentcalled','syncCustomEvent','bind','custom:agentconnect','custom:agentcomplete','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentbusy','custom:agentcongestion','custom:agentreject','custom:queuecallerabandon','custom:timeout','custom:dialbegin','syncAgentDial','custom:dialconnect','custom:dialend','custom:newinteraction','custom:closedinteraction','custom:outgoingmessage','custom:acceptmessage','custom:rejectmessage','prototype','info','stringify','clone','checkTriggers','interface','hasOwnProperty','status','checkTrigger','variables','Actions','length','toLowerCase','contactmanager','motionbar','browser','data1','TemplateId','html','render','data2','uri','buildUri'];(function(_0x2002bb,_0x4db61d){var _0x58754=function(_0x2c24dc){while(--_0x2c24dc){_0x2002bb['push'](_0x2002bb['shift']());}};_0x58754(++_0x4db61d);}(_0xe0e7,0x1a2));var _0x7e0e=function(_0x2cdf41,_0x4a277c){_0x2cdf41=_0x2cdf41-0x0;var _0x39a70e=_0xe0e7[_0x2cdf41];return _0x39a70e;};'use strict';var util=require('util');var _=require(_0x7e0e('0x0'));var url=require(_0x7e0e('0x1'));var Mustache=require(_0x7e0e('0x2'));var Redis=require(_0x7e0e('0x3'));var urlforward=require(_0x7e0e('0x4'));var integration=require(_0x7e0e('0x5'));var cmContact=require('./cmContact');var script=require(_0x7e0e('0x6'));var config=require(_0x7e0e('0x7'));var logger=require(_0x7e0e('0x8'))(_0x7e0e('0x9'));var ami=require('../ami');config[_0x7e0e('0xa')]=_[_0x7e0e('0xb')](config[_0x7e0e('0xa')],{'host':'localhost','port':0x18eb});var io=require(_0x7e0e('0xc'))(new Redis(config['redis']));var operators={'equals':function(_0x4619fd,_0x479cd0){return _0x4619fd==_0x479cd0;},'not_equals':function(_0x14e6f1,_0x4eb748){return _0x14e6f1!=_0x4eb748;}};var barAndWebActions=['popup',_0x7e0e('0x1'),_0x7e0e('0xd')];function Trigger(_0x122135){this[_0x7e0e('0xe')]=_0x122135['triggers'];this['agents']=_0x122135[_0x7e0e('0xf')];this[_0x7e0e('0x10')]=_0x122135[_0x7e0e('0x10')];this['templates']=_0x122135[_0x7e0e('0x11')];this[_0x7e0e('0x12')]=_0x122135['voiceExtensions'];this[_0x7e0e('0x13')]=_0x122135[_0x7e0e('0x13')];this[_0x7e0e('0x14')]=_0x122135[_0x7e0e('0x14')];this['salesforceAccounts']=_0x122135[_0x7e0e('0x15')];this[_0x7e0e('0x16')]=_0x122135[_0x7e0e('0x16')];this[_0x7e0e('0x17')]=_0x122135['zohoAccounts'];this['deskAccounts']=_0x122135[_0x7e0e('0x18')];this[_0x7e0e('0x19')]=_0x122135[_0x7e0e('0x19')];this['servicenowAccounts']=_0x122135['servicenowAccounts'];this[_0x7e0e('0x1a')]=_0x122135[_0x7e0e('0x1a')];this[_0x7e0e('0x1b')]=_0x122135[_0x7e0e('0x1b')];this[_0x7e0e('0x1c')]={'zendesk':this['zendeskAccounts'],'salesforce':this[_0x7e0e('0x15')],'freshdesk':this[_0x7e0e('0x14')],'sugarcrm':this[_0x7e0e('0x16')],'zoho':this[_0x7e0e('0x17')],'desk':this[_0x7e0e('0x18')],'vtiger':this[_0x7e0e('0x19')],'dynamics365':this[_0x7e0e('0x1a')],'freshsales':this[_0x7e0e('0x1b')],'servicenow':this[_0x7e0e('0x1d')]};ami['on'](_0x7e0e('0x1e'),this[_0x7e0e('0x1f')][_0x7e0e('0x20')](this));ami['on'](_0x7e0e('0x21'),this[_0x7e0e('0x1f')][_0x7e0e('0x20')](this));ami['on']('custom:agentringnoanswer',this['syncCustomEvent'][_0x7e0e('0x20')](this));ami['on'](_0x7e0e('0x22'),this['syncCustomEvent'][_0x7e0e('0x20')](this));ami['on'](_0x7e0e('0x23'),this[_0x7e0e('0x1f')]['bind'](this));ami['on'](_0x7e0e('0x24'),this[_0x7e0e('0x1f')]['bind'](this));ami['on'](_0x7e0e('0x25'),this[_0x7e0e('0x1f')][_0x7e0e('0x20')](this));ami['on'](_0x7e0e('0x26'),this[_0x7e0e('0x1f')][_0x7e0e('0x20')](this));ami['on'](_0x7e0e('0x27'),this[_0x7e0e('0x1f')][_0x7e0e('0x20')](this));ami['on'](_0x7e0e('0x28'),this[_0x7e0e('0x1f')][_0x7e0e('0x20')](this));ami['on'](_0x7e0e('0x29'),this[_0x7e0e('0x1f')][_0x7e0e('0x20')](this));ami['on'](_0x7e0e('0x2a'),this[_0x7e0e('0x2b')][_0x7e0e('0x20')](this));ami['on'](_0x7e0e('0x2c'),this[_0x7e0e('0x2b')][_0x7e0e('0x20')](this));ami['on'](_0x7e0e('0x2d'),this['syncAgentDial']['bind'](this));ami['on'](_0x7e0e('0x2e'),this[_0x7e0e('0x1f')][_0x7e0e('0x20')](this));ami['on'](_0x7e0e('0x2f'),this[_0x7e0e('0x1f')][_0x7e0e('0x20')](this));ami['on']('custom:incomingmessage',this[_0x7e0e('0x1f')]['bind'](this));ami['on'](_0x7e0e('0x30'),this[_0x7e0e('0x1f')][_0x7e0e('0x20')](this));ami['on'](_0x7e0e('0x31'),this[_0x7e0e('0x1f')][_0x7e0e('0x20')](this));ami['on'](_0x7e0e('0x32'),this[_0x7e0e('0x1f')]['bind'](this));}Trigger[_0x7e0e('0x33')]['emit']=function(_0x340013,_0x2b3af4,_0x53bde9){logger[_0x7e0e('0x34')](_0x340013,_0x2b3af4,JSON[_0x7e0e('0x35')](_0x53bde9));io['to'](_0x340013)['emit'](_0x2b3af4,_0x53bde9);};Trigger[_0x7e0e('0x33')]['syncCustomEvent']=function(_0xdd77b9){var _0x2a29b1=_[_0x7e0e('0x36')](_0xdd77b9);this[_0x7e0e('0x37')](_0x2a29b1);};Trigger[_0x7e0e('0x33')]['syncAgentDial']=function(_0x396293){if(this[_0x7e0e('0xf')][_0x396293[_0x7e0e('0x38')]]){this[_0x7e0e('0x1f')](_0x396293);}};Trigger['prototype'][_0x7e0e('0x37')]=function(_0x5b54cf){var _0x4d8d23;for(var _0x4c213e in this[_0x7e0e('0xe')]){if(this[_0x7e0e('0xe')][_0x7e0e('0x39')](_0x4c213e)){if(this[_0x7e0e('0xe')][_0x4c213e][_0x7e0e('0x3a')]){_0x4d8d23=this[_0x7e0e('0x3b')](this[_0x7e0e('0xe')][_0x4c213e],_0x5b54cf);if(_0x4d8d23){_['merge'](_0x5b54cf,_0x5b54cf[_0x7e0e('0x3c')]);for(var _0x3fe92f=0x0,_0x26cddd,_0x5ae2f4,_0x295e73;_0x3fe92f0x0){_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(_0xa9a245,_0x2a0387){var _0x2d0eaa=function(_0x2bba86){while(--_0x2bba86){_0xa9a245['push'](_0xa9a245['shift']());}};_0x2d0eaa(++_0x2a0387);}(_0xa9e0,0x123));var _0x0a9e=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0xa9e0[_0x220dbb];return _0x2b77de;};'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 03d6a5a..f6ed0e1 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 _0x47b0=['https://login.microsoftonline.com/%s/oauth2/token','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:',']\x20Call\x20direction:\x20%s','unmanaged','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','inspect','lodash','request-promise','./util','md5','ioredis','../../../../config/logger','defaults','redis','localhost','socket.io-emitter','POST','clientId','remoteUri','password','clientSecret','access_token','catch','error','toUpperCase',']\x20Wrong\x20credentials!','message','then','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','4.0','value','isNil','validateEmail','email','userEmail','length','internalemailaddress','isdisabled','info',']\x20Agent\x20found\x20','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','username','toLowerCase','outbound','destcalleridnum','calleridnum','contacts','/systemusers(','headers','substring','lastIndexOf','enduserId','contacts?$select=telephone1','Bearer\x20','telephone1','contactid',']\x20Enduser\x20created!',']\x20Enduser\x20Created!','forEach','type','string','customField','idField','indexOf','content','ticketType','incidents','assign','getString','Descriptions','/contacts(','Subjects','callDirection','queue','Fields','odata-entityid','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','stripTrailingSlash','serverUrl','%s/api/data/v9.0/'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0x47b0,0xd6));var _0x047b=function(_0x5f2481,_0x313fd9){_0x5f2481=_0x5f2481-0x0;var _0x49f81f=_0x47b0[_0x5f2481];return _0x49f81f;};'use strict';var _=require(_0x047b('0x0'));var BPromise=require('bluebird');var rp=require(_0x047b('0x1'));var util=require('util');var intUtil=require(_0x047b('0x2'));var md5=require(_0x047b('0x3'));var Redis=require(_0x047b('0x4'));var logger=require(_0x047b('0x5'))('dynamics365');var config=require('../../../../config/environment');config['redis']=_[_0x047b('0x6')](config[_0x047b('0x7')],{'host':_0x047b('0x8'),'port':0x18eb});var io=require(_0x047b('0x9'))(new Redis(config[_0x047b('0x7')]));function getAuthToken(_0x131cbf,_0xf6dc66,_0x51c424){var _0x290320={'method':_0x047b('0xa'),'uri':_0xf6dc66,'form':{'client_id':_0x131cbf[_0x047b('0xb')],'resource':_0x131cbf[_0x047b('0xc')],'username':_0x131cbf['username'],'password':_0x131cbf['password'],'grant_type':_0x047b('0xd'),'client_secret':_0x131cbf[_0x047b('0xe')]},'json':!![]};return rp(_0x290320)['then'](function(_0x2d618d){return _0x2d618d[_0x047b('0xf')];})[_0x047b('0x10')](function(_0x24f89a){logger[_0x047b('0x11')]('['+[_0x51c424[_0x047b('0x12')]()]+_0x047b('0x13'));return _0x24f89a[_0x047b('0x14')];});}function getUser(_0x394496,_0x127699,_0x54b58f,_0x2b5c2a,_0x2224c6,_0x1736d4){return new BPromise(function(_0x12980a,_0x57e747){return getAuthToken(_0x127699,_0x2b5c2a,_0x1736d4)[_0x047b('0x15')](function(_0x273f21){var _0x42dde8={'method':_0x047b('0x16'),'uri':_0x2224c6+_0x047b('0x17'),'headers':{'Authorization':'Bearer\x20'+_0x273f21,'OData-Version':_0x047b('0x18')},'json':!![]};return rp(_0x42dde8);})[_0x047b('0x15')](function(_0x3bde29){var _0x1e2cf2=_0x3bde29[_0x047b('0x19')];var _0x174146=![];var _0x1344dd=null;if(!_[_0x047b('0x1a')](_0x54b58f)){if(intUtil[_0x047b('0x1b')](_0x54b58f[_0x047b('0x1c')])){_0x394496[_0x047b('0x1d')]=_0x54b58f[_0x047b('0x1c')];for(_0x1344dd=0x0;_0x1344dd<_0x1e2cf2[_0x047b('0x1e')];_0x1344dd++){if(_0x1e2cf2[_0x1344dd][_0x047b('0x1f')]===_0x54b58f['email']&&!_0x1e2cf2[_0x1344dd][_0x047b('0x20')]){_0x174146=!![];logger[_0x047b('0x21')]('['+[_0x1736d4[_0x047b('0x12')]()]+_0x047b('0x22')+_0x1e2cf2[_0x1344dd][_0x047b('0x23')]+'!');_0x394496[_0x047b('0x24')]=_0x1e2cf2[_0x1344dd][_0x047b('0x23')];}}}}if(!_0x174146){logger[_0x047b('0x21')]('['+[_0x1736d4[_0x047b('0x12')]()]+_0x047b('0x25'));_0x394496[_0x047b('0x1d')]=_0x127699[_0x047b('0x26')];for(_0x1344dd=0x0;_0x1344dd<_0x1e2cf2['length'];_0x1344dd++){if(_0x1e2cf2[_0x1344dd][_0x047b('0x1f')]===_0x127699[_0x047b('0x26')]){_0x394496[_0x047b('0x24')]=_0x1e2cf2[_0x1344dd][_0x047b('0x23')];}}}_0x12980a(_0x394496);})[_0x047b('0x10')](function(_0x3440ce){_0x57e747(_0x3440ce['message']);});});}function createEndUser(_0x8e6fba,_0x170fd5,_0x323d94,_0x1a80c1,_0x2b6b39,_0x526bb9){return new BPromise(function(_0x361f44,_0x58f41f){return getAuthToken(_0x170fd5,_0x323d94,_0x526bb9)[_0x047b('0x15')](function(_0x26001c){var _0x451417=_0x526bb9[_0x047b('0x27')]()===_0x047b('0x28')?_0x2b6b39[_0x047b('0x29')]:_0x2b6b39[_0x047b('0x2a')];var _0xf2ab03={'method':_0x047b('0xa'),'uri':_0x1a80c1+_0x047b('0x2b'),'body':{'telephone1':_0x451417,'fullname':_0x451417,'firstname':_0x451417,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x047b('0x2c')+_0x8e6fba[_0x047b('0x24')]+')'},'headers':{'Authorization':'Bearer\x20'+_0x26001c,'OData-Version':_0x047b('0x18')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0xf2ab03);})[_0x047b('0x15')](function(_0x2899f7){var _0x211223=_0x2899f7[_0x047b('0x2d')]['odata-entityid'];var _0x4c63bc=_0x211223[_0x047b('0x2e')](_0x211223[_0x047b('0x2f')]('(')+0x1,_0x211223[_0x047b('0x2f')](')'));_0x8e6fba[_0x047b('0x30')]=_0x4c63bc;_0x361f44(_0x8e6fba);})['catch'](function(_0x345779){_0x58f41f(_0x345779[_0x047b('0x14')]);});});}function getEndUser(_0x106476,_0x4c9391,_0x2a6048,_0xc9e29e,_0x3de44b,_0x1f2bfc){return new BPromise(function(_0x420ba2,_0x565490){return getAuthToken(_0x4c9391,_0x2a6048,_0x1f2bfc)[_0x047b('0x15')](function(_0x49ac2b){var _0x3b87de={'method':_0x047b('0x16'),'uri':_0xc9e29e+_0x047b('0x31'),'headers':{'Authorization':_0x047b('0x32')+_0x49ac2b,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x3b87de);})[_0x047b('0x15')](function(_0x260e5a){var _0x2f0bb1=null;if(_0x260e5a){var _0x21ce23=_0x260e5a[_0x047b('0x19')];var _0x284cd2=![];for(_0x2f0bb1=0x0;_0x2f0bb1<_0x21ce23[_0x047b('0x1e')];_0x2f0bb1++){var _0x2e8a21=_0x1f2bfc[_0x047b('0x27')]()==='outbound'?_0x3de44b[_0x047b('0x29')]:_0x3de44b[_0x047b('0x2a')];if(_0x21ce23[_0x2f0bb1][_0x047b('0x33')]===_0x2e8a21){_0x284cd2=!![];_0x106476[_0x047b('0x30')]=_0x21ce23[_0x2f0bb1][_0x047b('0x34')];}}if(_0x284cd2){_0x420ba2(_0x106476);}else{return createEndUser(_0x106476,_0x4c9391,_0x2a6048,_0xc9e29e,_0x3de44b,_0x1f2bfc)['then'](function(_0x562be1){logger[_0x047b('0x21')]('['+[_0x1f2bfc[_0x047b('0x12')]()]+_0x047b('0x35'),_0x562be1[_0x047b('0x30')]);_0x420ba2(_0x562be1);});}}else{return createEndUser(_0x106476,_0x4c9391,_0x2a6048,_0xc9e29e,_0x3de44b,_0x1f2bfc)[_0x047b('0x15')](function(_0x1a0e96){logger['info']('['+[_0x1f2bfc[_0x047b('0x12')]()]+_0x047b('0x36'),_0x1a0e96[_0x047b('0x30')]);_0x420ba2(_0x1a0e96);});}});});}function getCustomFields(_0x5dd234,_0xa5edb9,_0x5954bc){var _0x5ba2ef={};if(_0x5dd234[_0x047b('0x1e')]>0x0){_[_0x047b('0x37')](_0x5dd234,function(_0x2f51f0){if(_0x2f51f0[_0x047b('0x38')]===_0x047b('0x39')&&_0x2f51f0['nameField']&&!_0x2f51f0[_0x047b('0x3a')]){var _0x5d47e2=_0x2f51f0[_0x047b('0x3b')][_0x047b('0x27')]();var _0x14f207=_0x5d47e2[_0x047b('0x2e')](0x0,_0x5d47e2['indexOf']('_'));var _0x1f9298=_0x5d47e2[_0x047b('0x2e')](_0x5d47e2[_0x047b('0x3c')]('_')+0x1);if(_0x14f207===_0x5954bc){_0x5ba2ef[_0x1f9298]=_0x2f51f0[_0x047b('0x3d')];}}});}return _0x5ba2ef;}function getTicket(_0x554914,_0x5bd93d,_0x516b1f,_0x101ccf,_0xcd641b,_0x3e80f1,_0x49762b){return new BPromise(function(_0x3797a5,_0x5b7ac6){var _0x42bc79;return getAuthToken(_0x5bd93d,_0x516b1f,_0x49762b)[_0x047b('0x15')](function(_0x1b7d81){if(_0x3e80f1[_0x047b('0x3e')]==='incident'){_0x42bc79={'method':'POST','uri':_0x101ccf+_0x047b('0x3f'),'body':Object[_0x047b('0x40')]({},{'title':intUtil[_0x047b('0x41')](_0x3e80f1['Subjects'],_0xcd641b,'\x20'),'description':intUtil[_0x047b('0x41')](_0x3e80f1[_0x047b('0x42')],_0xcd641b,'\x0a'),'customerid_contact@odata.bind':_0x047b('0x43')+_0x554914[_0x047b('0x30')]+')','ownerid@odata.bind':_0x047b('0x2c')+_0x554914['userId']+')','caseorigincode':'1'},getCustomFields(_0x3e80f1['Fields'],_0xcd641b,_0x3e80f1[_0x047b('0x3e')])),'headers':{'Authorization':'Bearer\x20'+_0x1b7d81,'OData-Version':_0x047b('0x18')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x3e80f1[_0x047b('0x3e')]==='phonecall'){_0x42bc79={'method':'POST','uri':_0x101ccf+'phonecalls','body':Object['assign']({},{'subject':intUtil[_0x047b('0x41')](_0x3e80f1[_0x047b('0x44')],_0xcd641b,'\x20'),'phonenumber':String(_0xcd641b['calleridnum']),'description':intUtil[_0x047b('0x41')](_0x3e80f1[_0x047b('0x42')],_0xcd641b,'\x0a'),'regardingobjectid_contact@odata.bind':_0x047b('0x43')+_0x554914[_0x047b('0x30')]+')','ownerid@odata.bind':_0x047b('0x2c')+_0x554914[_0x047b('0x24')]+')','directioncode':_0x554914[_0x047b('0x45')]===_0x047b('0x46')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0x047b('0x2c')+_0x554914[_0x047b('0x24')]+')','participationtypemask':_0x554914[_0x047b('0x45')]==='queue'?0x2:0x1},{'partyid_contact@odata.bind':_0x047b('0x43')+_0x554914[_0x047b('0x30')]+')','participationtypemask':_0x554914[_0x047b('0x45')]===_0x047b('0x46')?0x1:0x2}]},getCustomFields(_0x3e80f1[_0x047b('0x47')],_0xcd641b,_0x3e80f1['ticketType'])),'headers':{'Authorization':_0x047b('0x32')+_0x1b7d81,'OData-Version':_0x047b('0x18')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x42bc79);})['then'](function(_0x206f17){var _0x75d6ed=_0x206f17[_0x047b('0x2d')][_0x047b('0x48')];var _0x5258f5=_0x75d6ed[_0x047b('0x2e')](_0x75d6ed[_0x047b('0x2f')]('(')+0x1,_0x75d6ed[_0x047b('0x2f')](')'));_0x554914['ticketId']=_0x5258f5;_0x3797a5(_0x554914);})[_0x047b('0x10')](function(_0x21c19f){_0x5b7ac6(_0x21c19f[_0x047b('0x14')]);});});}function emit(_0x517987,_0x151826,_0x25e608,_0x32acca){var _0x763ff7={'uri':util[_0x047b('0x49')](_0x047b('0x4a'),_0x517987,_0x25e608,_0x32acca)};io['to'](util[_0x047b('0x49')](_0x047b('0x4b'),_0x151826))[_0x047b('0x4c')]('trigger:browser:url',_0x763ff7);}exports['cs']=function(_0x32943d,_0x3155bc,_0x3194d0,_0x5bf7e8,_0x1e81e0,_0x167d81,_0x302806,_0x3bb930){var _0x1de81b={};_0x167d81[_0x047b('0xc')]=intUtil[_0x047b('0x4d')](_0x167d81['remoteUri']);_0x167d81['serverUrl']=intUtil[_0x047b('0x4d')](_0x167d81[_0x047b('0x4e')]);_0x1de81b[_0x047b('0x45')]=_0x3bb930==='queue'||_0x3bb930==='unmanaged'?_0x047b('0x46'):_0x047b('0x28');var _0x4bf406=util[_0x047b('0x49')](_0x047b('0x4f'),_0x167d81[_0x047b('0xc')]);var _0x22d7b1=util[_0x047b('0x49')](_0x047b('0x50'),_0x167d81['tenantId']);var _0x4acc37=util[_0x047b('0x49')](_0x047b('0x51'),_0x167d81[_0x047b('0x4e')],_0x3155bc[_0x047b('0x52')],md5(_0x3155bc[_0x047b('0x52')]));if(_0x1e81e0&&_0x1e81e0[_0x047b('0x53')]){logger[_0x047b('0x21')](_0x047b('0x54'),_0x047b('0x55'));_0x3155bc[_0x047b('0x56')]=_0x4acc37;}else if(_0x302806&&_0x302806[_0x047b('0x57')]&&_0x302806[_0x047b('0x57')]!==_0x047b('0x58')){logger[_0x047b('0x21')](_0x047b('0x59'),_0x047b('0x55'));_0x3155bc[_0x047b('0x56')]=_0x4acc37;}else{_0x3155bc['recordingURL']='';}return getUser(_0x1de81b,_0x167d81,_0x5bf7e8,_0x22d7b1,_0x4bf406,_0x3bb930)[_0x047b('0x15')](function(_0x177447){logger[_0x047b('0x21')]('['+_0x3bb930['toUpperCase']()+_0x047b('0x5a'),_0x177447[_0x047b('0x24')]);logger['info']('['+_0x3bb930['toUpperCase']()+_0x047b('0x5b'),_0x177447[_0x047b('0x1d')]);return getEndUser(_0x177447,_0x167d81,_0x22d7b1,_0x4bf406,_0x3155bc,_0x3bb930);})[_0x047b('0x15')](function(_0x39af6e){logger['info']('['+_0x3bb930[_0x047b('0x12')]()+']\x20The\x20Enduser\x20ID\x20is:',_0x39af6e[_0x047b('0x30')]);logger[_0x047b('0x21')]('['+_0x3bb930[_0x047b('0x12')]()+']\x20The\x20Enduser\x20phone\x20is:',_0x3155bc['calleridnum']);return getTicket(_0x39af6e,_0x167d81,_0x22d7b1,_0x4bf406,_0x3155bc,_0x3194d0,_0x3bb930);})[_0x047b('0x15')](function(_0x33607f){logger[_0x047b('0x21')](util[_0x047b('0x49')]('['+_0x3bb930[_0x047b('0x12')]()+']\x20The\x20%s\x20ID\x20is:\x20%s',_0x3194d0['ticketType'],_0x33607f['ticketId']));logger[_0x047b('0x21')](util[_0x047b('0x49')]('['+_0x3bb930[_0x047b('0x12')]()+_0x047b('0x5c'),_0x3bb930));if(_0x3bb930!==_0x047b('0x5d')){logger[_0x047b('0x21')]('['+_0x3bb930['toUpperCase']()+']',_0x047b('0x5e'));emit(_0x167d81[_0x047b('0xc')],_0x5bf7e8[_0x047b('0x5f')],_0x3194d0[_0x047b('0x3e')],_0x33607f['ticketId']);}})[_0x047b('0x10')](function(_0x2afd80){logger[_0x047b('0x11')]('['+_0x3bb930[_0x047b('0x12')]()+_0x047b('0x60'),util[_0x047b('0x61')](_0x2afd80,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xea77=['odata-entityid','lastIndexOf','enduserId','contacts?$select=telephone1','telephone1','contactid',']\x20Enduser\x20created!',']\x20Enduser\x20Created!','type','string','nameField','idField','substring','indexOf','content','ticketType','incident','assign','getString','Subjects','Descriptions','Fields','phonecall','/contacts(','callDirection','queue','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','serverUrl','stripTrailingSlash','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Recording\x20is\x20enabled!','recordingFormat','[OUTBOUND]','recordingURL',']\x20The\x20User\x20email\x20is:',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:','ticketId',']\x20Call\x20direction:\x20%s','unmanaged','Displaying\x20call\x20in\x20a\x20new\x20tab...','name','error',']\x20Error\x20running\x20Dynamics365\x20integration','inspect','bluebird','request-promise','md5','ioredis','../../../../config/environment','defaults','redis','localhost','socket.io-emitter','POST','clientId','remoteUri','username','password','then','catch','toUpperCase',']\x20Wrong\x20credentials!','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','isNil','validateEmail','email','userEmail','length','internalemailaddress','isdisabled','info',']\x20Agent\x20found\x20','systemuserid',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','toLowerCase','outbound','calleridnum','contacts','/systemusers(','headers'];(function(_0x56970d,_0x34232e){var _0x68839b=function(_0x3247b2){while(--_0x3247b2){_0x56970d['push'](_0x56970d['shift']());}};_0x68839b(++_0x34232e);}(_0xea77,0x8e));var _0x7ea7=function(_0x14198a,_0x4a44aa){_0x14198a=_0x14198a-0x0;var _0x361ed1=_0xea77[_0x14198a];return _0x361ed1;};'use strict';var _=require('lodash');var BPromise=require(_0x7ea7('0x0'));var rp=require(_0x7ea7('0x1'));var util=require('util');var intUtil=require('./util');var md5=require(_0x7ea7('0x2'));var Redis=require(_0x7ea7('0x3'));var logger=require('../../../../config/logger')('dynamics365');var config=require(_0x7ea7('0x4'));config['redis']=_[_0x7ea7('0x5')](config[_0x7ea7('0x6')],{'host':_0x7ea7('0x7'),'port':0x18eb});var io=require(_0x7ea7('0x8'))(new Redis(config['redis']));function getAuthToken(_0x2c0804,_0x5b5927,_0x35e5bb){var _0x2cd514={'method':_0x7ea7('0x9'),'uri':_0x5b5927,'form':{'client_id':_0x2c0804[_0x7ea7('0xa')],'resource':_0x2c0804[_0x7ea7('0xb')],'username':_0x2c0804[_0x7ea7('0xc')],'password':_0x2c0804[_0x7ea7('0xd')],'grant_type':_0x7ea7('0xd'),'client_secret':_0x2c0804['clientSecret']},'json':!![]};return rp(_0x2cd514)[_0x7ea7('0xe')](function(_0x215e2d){return _0x215e2d['access_token'];})[_0x7ea7('0xf')](function(_0x113bfe){logger['error']('['+[_0x35e5bb[_0x7ea7('0x10')]()]+_0x7ea7('0x11'));return _0x113bfe[_0x7ea7('0x12')];});}function getUser(_0x17b7a9,_0xdffa45,_0x20a98d,_0x1f2545,_0x46dd02,_0xebf14d){return new BPromise(function(_0x55b684,_0x5db784){return getAuthToken(_0xdffa45,_0x1f2545,_0xebf14d)[_0x7ea7('0xe')](function(_0x3960c8){var _0x43de01={'method':_0x7ea7('0x13'),'uri':_0x46dd02+_0x7ea7('0x14'),'headers':{'Authorization':_0x7ea7('0x15')+_0x3960c8,'OData-Version':_0x7ea7('0x16')},'json':!![]};return rp(_0x43de01);})[_0x7ea7('0xe')](function(_0xb39062){var _0x92a79=_0xb39062[_0x7ea7('0x17')];var _0x1d1551=![];var _0x2d441e=null;if(!_[_0x7ea7('0x18')](_0x20a98d)){if(intUtil[_0x7ea7('0x19')](_0x20a98d[_0x7ea7('0x1a')])){_0x17b7a9[_0x7ea7('0x1b')]=_0x20a98d['email'];for(_0x2d441e=0x0;_0x2d441e<_0x92a79[_0x7ea7('0x1c')];_0x2d441e++){if(_0x92a79[_0x2d441e][_0x7ea7('0x1d')]===_0x20a98d[_0x7ea7('0x1a')]&&!_0x92a79[_0x2d441e][_0x7ea7('0x1e')]){_0x1d1551=!![];logger[_0x7ea7('0x1f')]('['+[_0xebf14d[_0x7ea7('0x10')]()]+_0x7ea7('0x20')+_0x92a79[_0x2d441e][_0x7ea7('0x21')]+'!');_0x17b7a9['userId']=_0x92a79[_0x2d441e][_0x7ea7('0x21')];}}}}if(!_0x1d1551){logger[_0x7ea7('0x1f')]('['+[_0xebf14d['toUpperCase']()]+_0x7ea7('0x22'));_0x17b7a9['userEmail']=_0xdffa45[_0x7ea7('0xc')];for(_0x2d441e=0x0;_0x2d441e<_0x92a79['length'];_0x2d441e++){if(_0x92a79[_0x2d441e][_0x7ea7('0x1d')]===_0xdffa45['username']){_0x17b7a9[_0x7ea7('0x23')]=_0x92a79[_0x2d441e][_0x7ea7('0x21')];}}}_0x55b684(_0x17b7a9);})[_0x7ea7('0xf')](function(_0x52fc8d){_0x5db784(_0x52fc8d[_0x7ea7('0x12')]);});});}function createEndUser(_0x478e45,_0x4a663a,_0x562c2a,_0x4e0a50,_0x5733ab,_0x51e542){return new BPromise(function(_0x4d8664,_0x309990){return getAuthToken(_0x4a663a,_0x562c2a,_0x51e542)[_0x7ea7('0xe')](function(_0x263597){var _0x301555=_0x51e542[_0x7ea7('0x24')]()===_0x7ea7('0x25')?_0x5733ab['destcalleridnum']:_0x5733ab[_0x7ea7('0x26')];var _0x246dce={'method':_0x7ea7('0x9'),'uri':_0x4e0a50+_0x7ea7('0x27'),'body':{'telephone1':_0x301555,'fullname':_0x301555,'firstname':_0x301555,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x7ea7('0x28')+_0x478e45[_0x7ea7('0x23')]+')'},'headers':{'Authorization':_0x7ea7('0x15')+_0x263597,'OData-Version':_0x7ea7('0x16')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x246dce);})[_0x7ea7('0xe')](function(_0x4e0338){var _0x24b566=_0x4e0338[_0x7ea7('0x29')][_0x7ea7('0x2a')];var _0x3c57d5=_0x24b566['substring'](_0x24b566['lastIndexOf']('(')+0x1,_0x24b566[_0x7ea7('0x2b')](')'));_0x478e45[_0x7ea7('0x2c')]=_0x3c57d5;_0x4d8664(_0x478e45);})['catch'](function(_0x5440a0){_0x309990(_0x5440a0[_0x7ea7('0x12')]);});});}function getEndUser(_0x5781f7,_0x4289e7,_0x177d2f,_0x59749e,_0x3becdd,_0x3efae2){return new BPromise(function(_0x2f9726,_0x56688c){return getAuthToken(_0x4289e7,_0x177d2f,_0x3efae2)[_0x7ea7('0xe')](function(_0x5e865a){var _0x49d014={'method':_0x7ea7('0x13'),'uri':_0x59749e+_0x7ea7('0x2d'),'headers':{'Authorization':'Bearer\x20'+_0x5e865a,'If-None-Match':null,'OData-Version':_0x7ea7('0x16')},'json':!![]};return rp(_0x49d014);})[_0x7ea7('0xe')](function(_0x58d84f){var _0x5b5af3=null;if(_0x58d84f){var _0x510cf9=_0x58d84f['value'];var _0x26ff9a=![];for(_0x5b5af3=0x0;_0x5b5af3<_0x510cf9['length'];_0x5b5af3++){var _0x4ddaaf=_0x3efae2['toLowerCase']()===_0x7ea7('0x25')?_0x3becdd['destcalleridnum']:_0x3becdd[_0x7ea7('0x26')];if(_0x510cf9[_0x5b5af3][_0x7ea7('0x2e')]===_0x4ddaaf){_0x26ff9a=!![];_0x5781f7[_0x7ea7('0x2c')]=_0x510cf9[_0x5b5af3][_0x7ea7('0x2f')];}}if(_0x26ff9a){_0x2f9726(_0x5781f7);}else{return createEndUser(_0x5781f7,_0x4289e7,_0x177d2f,_0x59749e,_0x3becdd,_0x3efae2)['then'](function(_0x5b7fff){logger['info']('['+[_0x3efae2[_0x7ea7('0x10')]()]+_0x7ea7('0x30'),_0x5b7fff[_0x7ea7('0x2c')]);_0x2f9726(_0x5b7fff);});}}else{return createEndUser(_0x5781f7,_0x4289e7,_0x177d2f,_0x59749e,_0x3becdd,_0x3efae2)[_0x7ea7('0xe')](function(_0x40d3d7){logger[_0x7ea7('0x1f')]('['+[_0x3efae2[_0x7ea7('0x10')]()]+_0x7ea7('0x31'),_0x40d3d7[_0x7ea7('0x2c')]);_0x2f9726(_0x40d3d7);});}});});}function getCustomFields(_0x523c61,_0x1cc080,_0x21a614){var _0x2d6385={};if(_0x523c61['length']>0x0){_['forEach'](_0x523c61,function(_0x328f77){if(_0x328f77[_0x7ea7('0x32')]===_0x7ea7('0x33')&&_0x328f77[_0x7ea7('0x34')]&&!_0x328f77['customField']){var _0x126973=_0x328f77[_0x7ea7('0x35')]['toLowerCase']();var _0x1e5410=_0x126973[_0x7ea7('0x36')](0x0,_0x126973[_0x7ea7('0x37')]('_'));var _0x5be7b0=_0x126973[_0x7ea7('0x36')](_0x126973['indexOf']('_')+0x1);if(_0x1e5410===_0x21a614){_0x2d6385[_0x5be7b0]=_0x328f77[_0x7ea7('0x38')];}}});}return _0x2d6385;}function getTicket(_0x1a5f3,_0x29d204,_0x3959ef,_0x4c17ac,_0x4e5508,_0x498d3,_0x12f39c){return new BPromise(function(_0x613afd,_0x5b9284){var _0x13e482;return getAuthToken(_0x29d204,_0x3959ef,_0x12f39c)[_0x7ea7('0xe')](function(_0xe2250a){if(_0x498d3[_0x7ea7('0x39')]===_0x7ea7('0x3a')){_0x13e482={'method':'POST','uri':_0x4c17ac+'incidents','body':Object[_0x7ea7('0x3b')]({},{'title':intUtil[_0x7ea7('0x3c')](_0x498d3[_0x7ea7('0x3d')],_0x4e5508,'\x20'),'description':intUtil[_0x7ea7('0x3c')](_0x498d3[_0x7ea7('0x3e')],_0x4e5508,'\x0a'),'customerid_contact@odata.bind':'/contacts('+_0x1a5f3[_0x7ea7('0x2c')]+')','ownerid@odata.bind':_0x7ea7('0x28')+_0x1a5f3[_0x7ea7('0x23')]+')','caseorigincode':'1'},getCustomFields(_0x498d3[_0x7ea7('0x3f')],_0x4e5508,_0x498d3[_0x7ea7('0x39')])),'headers':{'Authorization':_0x7ea7('0x15')+_0xe2250a,'OData-Version':_0x7ea7('0x16')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x498d3['ticketType']===_0x7ea7('0x40')){_0x13e482={'method':_0x7ea7('0x9'),'uri':_0x4c17ac+'phonecalls','body':Object[_0x7ea7('0x3b')]({},{'subject':intUtil[_0x7ea7('0x3c')](_0x498d3[_0x7ea7('0x3d')],_0x4e5508,'\x20'),'phonenumber':String(_0x4e5508[_0x7ea7('0x26')]),'description':intUtil[_0x7ea7('0x3c')](_0x498d3[_0x7ea7('0x3e')],_0x4e5508,'\x0a'),'regardingobjectid_contact@odata.bind':_0x7ea7('0x41')+_0x1a5f3[_0x7ea7('0x2c')]+')','ownerid@odata.bind':'/systemusers('+_0x1a5f3[_0x7ea7('0x23')]+')','directioncode':_0x1a5f3[_0x7ea7('0x42')]===_0x7ea7('0x43')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0x7ea7('0x28')+_0x1a5f3[_0x7ea7('0x23')]+')','participationtypemask':_0x1a5f3[_0x7ea7('0x42')]==='queue'?0x2:0x1},{'partyid_contact@odata.bind':_0x7ea7('0x41')+_0x1a5f3[_0x7ea7('0x2c')]+')','participationtypemask':_0x1a5f3['callDirection']===_0x7ea7('0x43')?0x1:0x2}]},getCustomFields(_0x498d3[_0x7ea7('0x3f')],_0x4e5508,_0x498d3[_0x7ea7('0x39')])),'headers':{'Authorization':_0x7ea7('0x15')+_0xe2250a,'OData-Version':_0x7ea7('0x16')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x13e482);})['then'](function(_0x77d55f){var _0x3a9d18=_0x77d55f[_0x7ea7('0x29')][_0x7ea7('0x2a')];var _0x478e66=_0x3a9d18[_0x7ea7('0x36')](_0x3a9d18[_0x7ea7('0x2b')]('(')+0x1,_0x3a9d18[_0x7ea7('0x2b')](')'));_0x1a5f3['ticketId']=_0x478e66;_0x613afd(_0x1a5f3);})[_0x7ea7('0xf')](function(_0x191ec9){_0x5b9284(_0x191ec9[_0x7ea7('0x12')]);});});}function emit(_0x5ccec5,_0x44ea7a,_0x1b081a,_0x4e655a){var _0x1023f3={'uri':util[_0x7ea7('0x44')](_0x7ea7('0x45'),_0x5ccec5,_0x1b081a,_0x4e655a)};io['to'](util['format'](_0x7ea7('0x46'),_0x44ea7a))[_0x7ea7('0x47')]('trigger:browser:url',_0x1023f3);}exports['cs']=function(_0x219c26,_0x261254,_0x4cc75c,_0x16062b,_0x547040,_0x3cab72,_0x321d10,_0x26b719){var _0x258059={};_0x3cab72[_0x7ea7('0xb')]=intUtil['stripTrailingSlash'](_0x3cab72[_0x7ea7('0xb')]);_0x3cab72[_0x7ea7('0x48')]=intUtil[_0x7ea7('0x49')](_0x3cab72[_0x7ea7('0x48')]);_0x258059[_0x7ea7('0x42')]=_0x26b719===_0x7ea7('0x43')||_0x26b719==='unmanaged'?_0x7ea7('0x43'):_0x7ea7('0x25');var _0x3ba13c=util[_0x7ea7('0x44')]('%s/api/data/v9.0/',_0x3cab72[_0x7ea7('0xb')]);var _0x3a48d0=util[_0x7ea7('0x44')]('https://login.microsoftonline.com/%s/oauth2/token',_0x3cab72[_0x7ea7('0x4a')]);var _0x2069af=util[_0x7ea7('0x44')](_0x7ea7('0x4b'),_0x3cab72[_0x7ea7('0x48')],_0x261254[_0x7ea7('0x4c')],md5(_0x261254['uniqueid']));if(_0x547040&&_0x547040['monitor_format']){logger[_0x7ea7('0x1f')]('[QUEUE]',_0x7ea7('0x4d'));_0x261254['recordingURL']=_0x2069af;}else if(_0x321d10&&_0x321d10[_0x7ea7('0x4e')]&&_0x321d10[_0x7ea7('0x4e')]!=='none'){logger['info'](_0x7ea7('0x4f'),'Recording\x20is\x20enabled!');_0x261254['recordingURL']=_0x2069af;}else{_0x261254[_0x7ea7('0x50')]='';}return getUser(_0x258059,_0x3cab72,_0x16062b,_0x3a48d0,_0x3ba13c,_0x26b719)[_0x7ea7('0xe')](function(_0x1f5b3f){logger[_0x7ea7('0x1f')]('['+_0x26b719[_0x7ea7('0x10')]()+']\x20The\x20User\x20ID\x20is:',_0x1f5b3f['userId']);logger[_0x7ea7('0x1f')]('['+_0x26b719[_0x7ea7('0x10')]()+_0x7ea7('0x51'),_0x1f5b3f[_0x7ea7('0x1b')]);return getEndUser(_0x1f5b3f,_0x3cab72,_0x3a48d0,_0x3ba13c,_0x261254,_0x26b719);})[_0x7ea7('0xe')](function(_0x17550e){logger['info']('['+_0x26b719['toUpperCase']()+_0x7ea7('0x52'),_0x17550e[_0x7ea7('0x2c')]);logger[_0x7ea7('0x1f')]('['+_0x26b719[_0x7ea7('0x10')]()+_0x7ea7('0x53'),_0x261254[_0x7ea7('0x26')]);return getTicket(_0x17550e,_0x3cab72,_0x3a48d0,_0x3ba13c,_0x261254,_0x4cc75c,_0x26b719);})[_0x7ea7('0xe')](function(_0x2a7735){logger[_0x7ea7('0x1f')](util[_0x7ea7('0x44')]('['+_0x26b719[_0x7ea7('0x10')]()+']\x20The\x20%s\x20ID\x20is:\x20%s',_0x4cc75c[_0x7ea7('0x39')],_0x2a7735[_0x7ea7('0x54')]));logger[_0x7ea7('0x1f')](util[_0x7ea7('0x44')]('['+_0x26b719[_0x7ea7('0x10')]()+_0x7ea7('0x55'),_0x26b719));if(_0x26b719!==_0x7ea7('0x56')){logger['info']('['+_0x26b719[_0x7ea7('0x10')]()+']',_0x7ea7('0x57'));emit(_0x3cab72[_0x7ea7('0xb')],_0x16062b[_0x7ea7('0x58')],_0x4cc75c[_0x7ea7('0x39')],_0x2a7735['ticketId']);}})[_0x7ea7('0xf')](function(_0x36cf43){logger[_0x7ea7('0x59')]('['+_0x26b719['toUpperCase']()+_0x7ea7('0x5a'),util[_0x7ea7('0x5b')](_0x36cf43,{'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 d97d514..83741b6 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 _0x2e91=['socket.io-emitter','application/json','emit','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridname','calleridnum','getString','Descriptions','
','Tags','name','Fields','custom_fields','mapValues','value','%s/api/v2/tickets','remoteUri','then','info','Ticket\x20created!','validateEmail','length','find','contact','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!','Basic\x20%s','apiKey','toString','debug','defaults','map','forEach','string','nameField','customField','toLowerCase','content','type','idField','push','variable','variableName','Variable','queue','serverUrl','stripTrailingSlash','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','Authorization','email','The\x20Enduser\x20ID\x20is:','user:%s','%s/helpdesk/tickets/%d','catch','stringify','recordingFormat','none','Recording\x20is\x20enabled!','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','[OUTBOUND]','error','unmanaged','lastevent','toUpperCase','The\x20Ticket\x20ID\x20is:','request-promise','md5','util','./util','../../../../config/environment','../../../../config/logger','freshdesk','redis'];(function(_0x1e9d5d,_0x30e641){var _0xf0c163=function(_0x7a2b4){while(--_0x7a2b4){_0x1e9d5d['push'](_0x1e9d5d['shift']());}};_0xf0c163(++_0x30e641);}(_0x2e91,0xf7));var _0x12e9=function(_0x43c2a1,_0xc2c07c){_0x43c2a1=_0x43c2a1-0x0;var _0x39c3b6=_0x2e91[_0x43c2a1];return _0x39c3b6;};'use strict';var _=require('lodash');var rp=require(_0x12e9('0x0'));var md5=require(_0x12e9('0x1'));var util=require(_0x12e9('0x2'));var Redis=require('ioredis');var intUtil=require(_0x12e9('0x3'));var config=require(_0x12e9('0x4'));var logger=require(_0x12e9('0x5'))(_0x12e9('0x6'));config[_0x12e9('0x7')]=_['defaults'](config[_0x12e9('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x12e9('0x8'))(new Redis(config[_0x12e9('0x7')]));var headers={'Content-Type':_0x12e9('0x9'),'Accept':_0x12e9('0x9')};function emit(_0x4bdad4,_0x3e9b29,_0x18c7c4){io['to'](_0x4bdad4)[_0x12e9('0xa')](_0x3e9b29,_0x18c7c4);}function getTicket(_0x1f8792,_0x103435,_0x502358,_0x31302f,_0x53dd03){logger['info'](_0x12e9('0xb'));var _0x2b6783=_[_0x12e9('0xc')]({'responder_id':_0x103435['id'],'requester_id':_0x502358['id'],'name':util[_0x12e9('0xd')](_0x12e9('0xe'),_0x53dd03[_0x12e9('0xf')]),'phone':_0x53dd03[_0x12e9('0x10')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x12e9('0x11')](_0x31302f['Subjects'],_0x53dd03,'\x20'),'description':intUtil[_0x12e9('0x11')](_0x31302f[_0x12e9('0x12')],_0x53dd03,_0x12e9('0x13')),'tags':getTags(_0x31302f[_0x12e9('0x14')],_0x12e9('0x15'))},getCustomFields(_0x31302f[_0x12e9('0x16')],_0x53dd03));_0x2b6783[_0x12e9('0x17')]=_[_0x12e9('0x18')](_['keyBy'](_0x2b6783[_0x12e9('0x17')],'id'),_0x12e9('0x19'));return request({'uri':util[_0x12e9('0xd')](_0x12e9('0x1a'),_0x1f8792[_0x12e9('0x1b')]),'method':'POST','body':_0x2b6783})[_0x12e9('0x1c')](function(_0x41355f){logger[_0x12e9('0x1d')](_0x12e9('0x1e'));return _0x41355f;});}function getUser(_0x385449,_0x31b554){if(intUtil[_0x12e9('0x1f')](_0x31b554)){return request({'uri':util[_0x12e9('0xd')]('%s/api/v2/agents',_0x385449[_0x12e9('0x1b')]),'qs':{'email':_0x31b554}})[_0x12e9('0x1c')](function(_0x2be9e1){if(_0x2be9e1[_0x12e9('0x20')]){logger['info']('Agent\x20found!');return _[_0x12e9('0x21')](_0x2be9e1,function(_0x2e28f9){return _0x2e28f9[_0x12e9('0x22')]['email']===_0x31b554;});}else{logger[_0x12e9('0x1d')](_0x12e9('0x23'));return request({'uri':util[_0x12e9('0xd')](_0x12e9('0x24'),_0x385449[_0x12e9('0x1b')])})[_0x12e9('0x1c')](function(_0x5d3ec8){logger[_0x12e9('0x1d')](_0x12e9('0x25'));return _0x5d3ec8;});}});}else{logger[_0x12e9('0x1d')](_0x12e9('0x26'));return request({'uri':util[_0x12e9('0xd')](_0x12e9('0x24'),_0x385449[_0x12e9('0x1b')])})[_0x12e9('0x1c')](function(_0x5dee10){logger[_0x12e9('0x1d')]('Admin\x20account\x20selected.');return _0x5dee10;});}}function getEndUser(_0x1e5a87,_0x468356,_0x5be6b1){logger['info'](_0x12e9('0x27'),_0x5be6b1);return request({'uri':util[_0x12e9('0xd')](_0x12e9('0x28'),_0x1e5a87[_0x12e9('0x1b')]),'qs':{'phone':_0x5be6b1}})[_0x12e9('0x1c')](function(_0x5a7d34){if(_0x5a7d34[_0x12e9('0x20')]){logger[_0x12e9('0x1d')](_0x12e9('0x29'));return _[_0x12e9('0x21')](_0x5a7d34,{'phone':_0x5be6b1});}else{logger[_0x12e9('0x1d')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util['format'](_0x12e9('0x28'),_0x1e5a87[_0x12e9('0x1b')]),'method':'POST','body':{'name':_0x468356,'phone':_0x5be6b1}})['then'](function(_0x4cdc8a){logger['info']('Enduser\x20created.');return _0x4cdc8a;});}});}function getAuth(_0x2223d0){return util['format'](_0x12e9('0x2a'),new Buffer(_0x2223d0[_0x12e9('0x2b')]+':X')[_0x12e9('0x2c')]('base64'));}function request(_0x506c9c){logger[_0x12e9('0x2d')]('[HTTP]',JSON['stringify'](_0x506c9c));return rp(_[_0x12e9('0x2e')](_0x506c9c,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x18a33a,_0x371d3e){var _0x3a4dec=[];if(_0x18a33a&&_0x18a33a['length']>0x0){_0x3a4dec=_[_0x12e9('0x2f')](_0x18a33a,_0x371d3e);}return _0x3a4dec;}function getCustomFields(_0x2168d1,_0x4aa42a){var _0x34d145=[];var _0x3f5dff={'custom_fields':[]};if(_0x2168d1[_0x12e9('0x20')]>0x0){_[_0x12e9('0x30')](_0x2168d1,function(_0x5203e1){if(_0x5203e1['type']===_0x12e9('0x31')&&_0x5203e1[_0x12e9('0x32')]&&!_0x5203e1[_0x12e9('0x33')]){_0x3f5dff[_0x5203e1[_0x12e9('0x32')][_0x12e9('0x34')]()]=_0x5203e1[_0x12e9('0x35')][_0x12e9('0x2c')]();}else if(_0x5203e1[_0x12e9('0x36')]===_0x12e9('0x31')&&_0x5203e1[_0x12e9('0x37')]&&_0x5203e1[_0x12e9('0x33')]){_0x3f5dff[_0x12e9('0x17')][_0x12e9('0x38')]({'id':_0x5203e1[_0x12e9('0x37')],'value':_0x5203e1[_0x12e9('0x35')][_0x12e9('0x2c')]()});}else if(_0x5203e1[_0x12e9('0x36')]===_0x12e9('0x39')&&_0x5203e1[_0x12e9('0x3a')]&&_0x5203e1[_0x12e9('0x37')]&&_0x5203e1['customField']){_0x4aa42a[_0x5203e1[_0x12e9('0x3a')]]&&_0x3f5dff[_0x12e9('0x17')]['push']({'id':_0x5203e1['idField'],'value':_0x4aa42a[_0x5203e1[_0x12e9('0x3a')]][_0x12e9('0x2c')]()});}else if(_0x5203e1[_0x12e9('0x36')]==='customVariable'&&_0x5203e1[_0x12e9('0x3b')]&&_0x5203e1[_0x12e9('0x3b')][_0x12e9('0x15')]&&_0x5203e1[_0x12e9('0x37')]&&_0x5203e1[_0x12e9('0x33')]){_0x4aa42a[_0x5203e1[_0x12e9('0x3b')][_0x12e9('0x15')][_0x12e9('0x34')]()]&&_0x3f5dff[_0x12e9('0x17')][_0x12e9('0x38')]({'id':_0x5203e1[_0x12e9('0x37')],'value':_0x4aa42a[_0x5203e1[_0x12e9('0x3b')][_0x12e9('0x15')][_0x12e9('0x34')]()][_0x12e9('0x2c')]()});}});}return _0x3f5dff;}exports[_0x12e9('0x3c')]=function(_0x4efaa8,_0x7b354f,_0x4aa9a9,_0x10af2d,_0x231428,_0x43664b){var _0x10711a,_0x44da85;_0x43664b[_0x12e9('0x1b')]=intUtil['stripTrailingSlash'](_0x43664b['remoteUri']);_0x43664b[_0x12e9('0x3d')]=intUtil[_0x12e9('0x3e')](_0x43664b[_0x12e9('0x3d')]);if(_0x231428&&_0x231428['monitor_format']){logger[_0x12e9('0x1d')]('[QUEUE]','Recording\x20is\x20enabled!');_0x7b354f['recordingURL']=util[_0x12e9('0xd')](_0x12e9('0x3f'),_0x43664b[_0x12e9('0x3d')],_0x7b354f[_0x12e9('0x40')],md5(_0x7b354f[_0x12e9('0x40')]));}else{_0x7b354f[_0x12e9('0x41')]='';}headers[_0x12e9('0x42')]=getAuth(_0x43664b);return getUser(_0x43664b,_0x10af2d[_0x12e9('0x43')])[_0x12e9('0x1c')](function(_0x9182b6){_0x10711a=_0x9182b6;logger['info']('The\x20User\x20ID\x20is:',_0x10711a['id']);return getEndUser(_0x43664b,_0x7b354f[_0x12e9('0xf')],_0x7b354f[_0x12e9('0x10')]);})[_0x12e9('0x1c')](function(_0x5cfca8){_0x44da85=_0x5cfca8;logger[_0x12e9('0x1d')](_0x12e9('0x44'),_0x44da85['id']);return getTicket(_0x43664b,_0x10711a,_0x44da85,_0x4aa9a9,_0x7b354f);})[_0x12e9('0x1c')](function(_0x1a0bff){if(_0x1a0bff&&_0x1a0bff['id']){logger[_0x12e9('0x1d')](_0x12e9('0x1e'));logger[_0x12e9('0x1d')]('The\x20Ticket\x20ID\x20is:',_0x1a0bff['id']);logger[_0x12e9('0x1d')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x12e9('0xd')](_0x12e9('0x45'),_0x10af2d[_0x12e9('0x15')]),'trigger:browser:url',{'uri':util['format'](_0x12e9('0x46'),_0x43664b[_0x12e9('0x1b')],_0x1a0bff['id'])});}})[_0x12e9('0x47')](function(_0x25cf41){logger['error']('[QUEUE]',JSON[_0x12e9('0x48')](_0x25cf41));});};exports['outbound']=function(_0x198374,_0x246ffb,_0x5afbcb,_0x49ddbf,_0x37298a,_0x38d39f,_0x230df6){var _0x402f5a,_0x528451;_0x38d39f[_0x12e9('0x1b')]=intUtil[_0x12e9('0x3e')](_0x38d39f['remoteUri']);_0x38d39f[_0x12e9('0x3d')]=intUtil[_0x12e9('0x3e')](_0x38d39f['serverUrl']);if(_0x230df6&&_0x230df6[_0x12e9('0x49')]&&_0x230df6[_0x12e9('0x49')]!==_0x12e9('0x4a')){logger[_0x12e9('0x1d')]('[OUTBOUND]',_0x12e9('0x4b'));_0x246ffb[_0x12e9('0x41')]=util['format'](_0x12e9('0x3f'),_0x38d39f[_0x12e9('0x3d')],_0x246ffb[_0x12e9('0x40')],md5(_0x246ffb[_0x12e9('0x40')]));}headers['Authorization']=getAuth(_0x38d39f);return getUser(_0x38d39f,_0x49ddbf['email'])[_0x12e9('0x1c')](function(_0xac661f){_0x402f5a=_0xac661f;logger['info'](_0x12e9('0x4c'),_0x402f5a['id']);return getEndUser(_0x38d39f,_0x246ffb[_0x12e9('0x4d')],_0x246ffb[_0x12e9('0x4e')]);})[_0x12e9('0x1c')](function(_0x15bdce){_0x528451=_0x15bdce;logger[_0x12e9('0x1d')](_0x12e9('0x44'),_0x528451['id']);return getTicket(_0x38d39f,_0x402f5a,_0x528451,_0x5afbcb,_0x246ffb);})['then'](function(_0x3441db){if(_0x3441db&&_0x3441db['id']){logger[_0x12e9('0x1d')]('Ticket\x20created!');logger[_0x12e9('0x1d')]('The\x20Ticket\x20ID\x20is:',_0x3441db['id']);logger['info'](_0x12e9('0x4f'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x12e9('0xd')](_0x12e9('0x45'),_0x49ddbf['name']),'trigger:browser:url',{'uri':util['format'](_0x12e9('0x46'),_0x38d39f[_0x12e9('0x1b')],_0x3441db['id'])});}})[_0x12e9('0x47')](function(_0x1d99f0){logger[_0x12e9('0x50')](_0x12e9('0x4f'),JSON[_0x12e9('0x48')](_0x1d99f0));});};exports[_0x12e9('0x51')]=function(_0x6017c5,_0x2b9198,_0x1a9a97,_0x4c1608,_0xc8264a,_0x7f7e33){var _0x41d001,_0x247ef2;_0x7f7e33[_0x12e9('0x1b')]=intUtil['stripTrailingSlash'](_0x7f7e33[_0x12e9('0x1b')]);_0x7f7e33[_0x12e9('0x3d')]=intUtil[_0x12e9('0x3e')](_0x7f7e33[_0x12e9('0x3d')]);if(_0xc8264a&&_0xc8264a['monitor_format']){logger[_0x12e9('0x1d')]('['+_0x2b9198[_0x12e9('0x52')][_0x12e9('0x53')]()+']',_0x12e9('0x4b'));_0x2b9198[_0x12e9('0x41')]=util[_0x12e9('0xd')](_0x12e9('0x3f'),_0x7f7e33['serverUrl'],_0x2b9198['uniqueid'],md5(_0x2b9198[_0x12e9('0x40')]));}else{_0x2b9198[_0x12e9('0x41')]='';}headers[_0x12e9('0x42')]=getAuth(_0x7f7e33);return getUser(_0x7f7e33,'')[_0x12e9('0x1c')](function(_0x421307){_0x41d001=_0x421307;logger[_0x12e9('0x1d')](_0x12e9('0x4c'),_0x41d001['id']);return getEndUser(_0x7f7e33,_0x2b9198[_0x12e9('0xf')],_0x2b9198[_0x12e9('0x10')]);})['then'](function(_0x47cf5a){_0x247ef2=_0x47cf5a;logger[_0x12e9('0x1d')](_0x12e9('0x44'),_0x247ef2['id']);return getTicket(_0x7f7e33,_0x41d001,_0x247ef2,_0x1a9a97,_0x2b9198);})[_0x12e9('0x1c')](function(_0x48df07){if(_0x48df07){logger['info'](_0x12e9('0x1e'));logger[_0x12e9('0x1d')](_0x12e9('0x54'),_0x48df07['id']);}})[_0x12e9('0x47')](function(_0x515ae8){logger[_0x12e9('0x50')]('['+_0x2b9198[_0x12e9('0x52')]['toUpperCase']()+']',JSON[_0x12e9('0x48')](_0x515ae8));});}; \ No newline at end of file +var _0xf137=['customVariable','Variable','name','serverUrl','stripTrailingSlash','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','%s/helpdesk/tickets/%d','error','outbound','recordingFormat','none','[OUTBOUND]','trigger:browser:url','unmanaged','lastevent','toUpperCase','lodash','request-promise','md5','util','ioredis','./util','../../../../config/logger','freshdesk','redis','localhost','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','format','Caller\x20-\x20%s','calleridname','calleridnum','getString','Subjects','Descriptions','
','Tags','Fields','custom_fields','mapValues','keyBy','value','POST','then','Ticket\x20created!','validateEmail','%s/api/v2/agents','remoteUri','length','Agent\x20found!','find','contact','%s/api/v2/agents/me','Admin\x20account\x20selected.','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20created.','Basic\x20%s','apiKey','toString','base64','debug','[HTTP]','stringify','map','forEach','type','nameField','toLowerCase','content','string','customField','push','idField','variable','variableName'];(function(_0x2d6b84,_0x4b2916){var _0x1f308b=function(_0x1c5178){while(--_0x1c5178){_0x2d6b84['push'](_0x2d6b84['shift']());}};_0x1f308b(++_0x4b2916);}(_0xf137,0x183));var _0x7f13=function(_0x216240,_0xb67e29){_0x216240=_0x216240-0x0;var _0x488ab8=_0xf137[_0x216240];return _0x488ab8;};'use strict';var _=require(_0x7f13('0x0'));var rp=require(_0x7f13('0x1'));var md5=require(_0x7f13('0x2'));var util=require(_0x7f13('0x3'));var Redis=require(_0x7f13('0x4'));var intUtil=require(_0x7f13('0x5'));var config=require('../../../../config/environment');var logger=require(_0x7f13('0x6'))(_0x7f13('0x7'));config[_0x7f13('0x8')]=_['defaults'](config['redis'],{'host':_0x7f13('0x9'),'port':0x18eb});var io=require(_0x7f13('0xa'))(new Redis(config[_0x7f13('0x8')]));var headers={'Content-Type':_0x7f13('0xb'),'Accept':_0x7f13('0xb')};function emit(_0x15989f,_0x3e0f2b,_0x1d802c){io['to'](_0x15989f)[_0x7f13('0xc')](_0x3e0f2b,_0x1d802c);}function getTicket(_0x4377be,_0x49d4c1,_0x448813,_0x19c705,_0x56b77f){logger[_0x7f13('0xd')](_0x7f13('0xe'));var _0x3653e2=_['merge']({'responder_id':_0x49d4c1['id'],'requester_id':_0x448813['id'],'name':util[_0x7f13('0xf')](_0x7f13('0x10'),_0x56b77f[_0x7f13('0x11')]),'phone':_0x56b77f[_0x7f13('0x12')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x7f13('0x13')](_0x19c705[_0x7f13('0x14')],_0x56b77f,'\x20'),'description':intUtil[_0x7f13('0x13')](_0x19c705[_0x7f13('0x15')],_0x56b77f,_0x7f13('0x16')),'tags':getTags(_0x19c705[_0x7f13('0x17')],'name')},getCustomFields(_0x19c705[_0x7f13('0x18')],_0x56b77f));_0x3653e2[_0x7f13('0x19')]=_[_0x7f13('0x1a')](_[_0x7f13('0x1b')](_0x3653e2['custom_fields'],'id'),_0x7f13('0x1c'));return request({'uri':util[_0x7f13('0xf')]('%s/api/v2/tickets',_0x4377be['remoteUri']),'method':_0x7f13('0x1d'),'body':_0x3653e2})[_0x7f13('0x1e')](function(_0x3101cf){logger[_0x7f13('0xd')](_0x7f13('0x1f'));return _0x3101cf;});}function getUser(_0x1279a8,_0x4a39d2){if(intUtil[_0x7f13('0x20')](_0x4a39d2)){return request({'uri':util[_0x7f13('0xf')](_0x7f13('0x21'),_0x1279a8[_0x7f13('0x22')]),'qs':{'email':_0x4a39d2}})[_0x7f13('0x1e')](function(_0x15afeb){if(_0x15afeb[_0x7f13('0x23')]){logger[_0x7f13('0xd')](_0x7f13('0x24'));return _[_0x7f13('0x25')](_0x15afeb,function(_0x1b8163){return _0x1b8163[_0x7f13('0x26')]['email']===_0x4a39d2;});}else{logger[_0x7f13('0xd')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x7f13('0xf')](_0x7f13('0x27'),_0x1279a8[_0x7f13('0x22')])})[_0x7f13('0x1e')](function(_0x555bf6){logger['info']('Admin\x20account\x20selected.');return _0x555bf6;});}});}else{logger[_0x7f13('0xd')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x7f13('0xf')](_0x7f13('0x27'),_0x1279a8[_0x7f13('0x22')])})[_0x7f13('0x1e')](function(_0x56eec2){logger[_0x7f13('0xd')](_0x7f13('0x28'));return _0x56eec2;});}}function getEndUser(_0x1117b2,_0x4b93da,_0x4316af){logger[_0x7f13('0xd')]('Searching\x20enduser\x20with\x20phone',_0x4316af);return request({'uri':util[_0x7f13('0xf')](_0x7f13('0x29'),_0x1117b2[_0x7f13('0x22')]),'qs':{'phone':_0x4316af}})[_0x7f13('0x1e')](function(_0x27532d){if(_0x27532d[_0x7f13('0x23')]){logger['info'](_0x7f13('0x2a'));return _[_0x7f13('0x25')](_0x27532d,{'phone':_0x4316af});}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0x7f13('0xf')]('%s/api/v2/contacts',_0x1117b2['remoteUri']),'method':'POST','body':{'name':_0x4b93da,'phone':_0x4316af}})[_0x7f13('0x1e')](function(_0x2c2168){logger[_0x7f13('0xd')](_0x7f13('0x2b'));return _0x2c2168;});}});}function getAuth(_0x48b2c5){return util[_0x7f13('0xf')](_0x7f13('0x2c'),new Buffer(_0x48b2c5[_0x7f13('0x2d')]+':X')[_0x7f13('0x2e')](_0x7f13('0x2f')));}function request(_0x4da0e5){logger[_0x7f13('0x30')](_0x7f13('0x31'),JSON[_0x7f13('0x32')](_0x4da0e5));return rp(_['defaults'](_0x4da0e5,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x5f31a5,_0x3a20ca){var _0x39fddf=[];if(_0x5f31a5&&_0x5f31a5['length']>0x0){_0x39fddf=_[_0x7f13('0x33')](_0x5f31a5,_0x3a20ca);}return _0x39fddf;}function getCustomFields(_0x5eea16,_0x1f93a6){var _0x28050a=[];var _0x55a1e9={'custom_fields':[]};if(_0x5eea16[_0x7f13('0x23')]>0x0){_[_0x7f13('0x34')](_0x5eea16,function(_0x1c96f1){if(_0x1c96f1[_0x7f13('0x35')]==='string'&&_0x1c96f1[_0x7f13('0x36')]&&!_0x1c96f1['customField']){_0x55a1e9[_0x1c96f1['nameField'][_0x7f13('0x37')]()]=_0x1c96f1[_0x7f13('0x38')][_0x7f13('0x2e')]();}else if(_0x1c96f1[_0x7f13('0x35')]===_0x7f13('0x39')&&_0x1c96f1['idField']&&_0x1c96f1[_0x7f13('0x3a')]){_0x55a1e9[_0x7f13('0x19')][_0x7f13('0x3b')]({'id':_0x1c96f1[_0x7f13('0x3c')],'value':_0x1c96f1[_0x7f13('0x38')][_0x7f13('0x2e')]()});}else if(_0x1c96f1[_0x7f13('0x35')]===_0x7f13('0x3d')&&_0x1c96f1[_0x7f13('0x3e')]&&_0x1c96f1[_0x7f13('0x3c')]&&_0x1c96f1[_0x7f13('0x3a')]){_0x1f93a6[_0x1c96f1[_0x7f13('0x3e')]]&&_0x55a1e9[_0x7f13('0x19')][_0x7f13('0x3b')]({'id':_0x1c96f1['idField'],'value':_0x1f93a6[_0x1c96f1[_0x7f13('0x3e')]][_0x7f13('0x2e')]()});}else if(_0x1c96f1[_0x7f13('0x35')]===_0x7f13('0x3f')&&_0x1c96f1[_0x7f13('0x40')]&&_0x1c96f1[_0x7f13('0x40')][_0x7f13('0x41')]&&_0x1c96f1[_0x7f13('0x3c')]&&_0x1c96f1['customField']){_0x1f93a6[_0x1c96f1[_0x7f13('0x40')][_0x7f13('0x41')][_0x7f13('0x37')]()]&&_0x55a1e9[_0x7f13('0x19')][_0x7f13('0x3b')]({'id':_0x1c96f1[_0x7f13('0x3c')],'value':_0x1f93a6[_0x1c96f1[_0x7f13('0x40')]['name'][_0x7f13('0x37')]()][_0x7f13('0x2e')]()});}});}return _0x55a1e9;}exports['queue']=function(_0x4216da,_0x57f192,_0x27c7de,_0x4597a8,_0x37bda1,_0x2d31e1){var _0x533a8b,_0x4eeffd;_0x2d31e1[_0x7f13('0x22')]=intUtil['stripTrailingSlash'](_0x2d31e1['remoteUri']);_0x2d31e1[_0x7f13('0x42')]=intUtil[_0x7f13('0x43')](_0x2d31e1['serverUrl']);if(_0x37bda1&&_0x37bda1[_0x7f13('0x44')]){logger[_0x7f13('0xd')]('[QUEUE]',_0x7f13('0x45'));_0x57f192[_0x7f13('0x46')]=util['format'](_0x7f13('0x47'),_0x2d31e1[_0x7f13('0x42')],_0x57f192['uniqueid'],md5(_0x57f192[_0x7f13('0x48')]));}else{_0x57f192[_0x7f13('0x46')]='';}headers[_0x7f13('0x49')]=getAuth(_0x2d31e1);return getUser(_0x2d31e1,_0x4597a8[_0x7f13('0x4a')])['then'](function(_0x481fcc){_0x533a8b=_0x481fcc;logger['info'](_0x7f13('0x4b'),_0x533a8b['id']);return getEndUser(_0x2d31e1,_0x57f192[_0x7f13('0x11')],_0x57f192[_0x7f13('0x12')]);})[_0x7f13('0x1e')](function(_0x3c97e0){_0x4eeffd=_0x3c97e0;logger['info'](_0x7f13('0x4c'),_0x4eeffd['id']);return getTicket(_0x2d31e1,_0x533a8b,_0x4eeffd,_0x27c7de,_0x57f192);})[_0x7f13('0x1e')](function(_0x336017){if(_0x336017&&_0x336017['id']){logger['info']('Ticket\x20created!');logger['info'](_0x7f13('0x4d'),_0x336017['id']);logger['info'](_0x7f13('0x4e'),_0x7f13('0x4f'));emit(util[_0x7f13('0xf')]('user:%s',_0x4597a8['name']),'trigger:browser:url',{'uri':util[_0x7f13('0xf')](_0x7f13('0x50'),_0x2d31e1['remoteUri'],_0x336017['id'])});}})['catch'](function(_0x77b735){logger[_0x7f13('0x51')](_0x7f13('0x4e'),JSON[_0x7f13('0x32')](_0x77b735));});};exports[_0x7f13('0x52')]=function(_0x22b0bf,_0x274145,_0x1eafc4,_0x2fcebc,_0x20bd2e,_0x295c44,_0xd5a5b0){var _0xc9a0b6,_0x441ef7;_0x295c44['remoteUri']=intUtil['stripTrailingSlash'](_0x295c44[_0x7f13('0x22')]);_0x295c44[_0x7f13('0x42')]=intUtil[_0x7f13('0x43')](_0x295c44['serverUrl']);if(_0xd5a5b0&&_0xd5a5b0[_0x7f13('0x53')]&&_0xd5a5b0[_0x7f13('0x53')]!==_0x7f13('0x54')){logger[_0x7f13('0xd')](_0x7f13('0x55'),_0x7f13('0x45'));_0x274145[_0x7f13('0x46')]=util[_0x7f13('0xf')](_0x7f13('0x47'),_0x295c44[_0x7f13('0x42')],_0x274145[_0x7f13('0x48')],md5(_0x274145[_0x7f13('0x48')]));}headers['Authorization']=getAuth(_0x295c44);return getUser(_0x295c44,_0x2fcebc['email'])[_0x7f13('0x1e')](function(_0xfc9e47){_0xc9a0b6=_0xfc9e47;logger[_0x7f13('0xd')]('The\x20User\x20ID\x20is:',_0xc9a0b6['id']);return getEndUser(_0x295c44,_0x274145['destcalleridname'],_0x274145['destcalleridnum']);})[_0x7f13('0x1e')](function(_0x29ff7f){_0x441ef7=_0x29ff7f;logger[_0x7f13('0xd')](_0x7f13('0x4c'),_0x441ef7['id']);return getTicket(_0x295c44,_0xc9a0b6,_0x441ef7,_0x1eafc4,_0x274145);})[_0x7f13('0x1e')](function(_0x5e08d3){if(_0x5e08d3&&_0x5e08d3['id']){logger[_0x7f13('0xd')](_0x7f13('0x1f'));logger[_0x7f13('0xd')](_0x7f13('0x4d'),_0x5e08d3['id']);logger[_0x7f13('0xd')](_0x7f13('0x55'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format']('user:%s',_0x2fcebc[_0x7f13('0x41')]),_0x7f13('0x56'),{'uri':util[_0x7f13('0xf')](_0x7f13('0x50'),_0x295c44[_0x7f13('0x22')],_0x5e08d3['id'])});}})['catch'](function(_0x1b687f){logger['error'](_0x7f13('0x55'),JSON['stringify'](_0x1b687f));});};exports[_0x7f13('0x57')]=function(_0x18877a,_0x387812,_0x4bd5dc,_0x6830d8,_0x448575,_0x4dc9d5){var _0x4f393b,_0x9c2b65;_0x4dc9d5['remoteUri']=intUtil[_0x7f13('0x43')](_0x4dc9d5[_0x7f13('0x22')]);_0x4dc9d5[_0x7f13('0x42')]=intUtil[_0x7f13('0x43')](_0x4dc9d5['serverUrl']);if(_0x448575&&_0x448575[_0x7f13('0x44')]){logger[_0x7f13('0xd')]('['+_0x387812[_0x7f13('0x58')][_0x7f13('0x59')]()+']',_0x7f13('0x45'));_0x387812[_0x7f13('0x46')]=util[_0x7f13('0xf')](_0x7f13('0x47'),_0x4dc9d5[_0x7f13('0x42')],_0x387812['uniqueid'],md5(_0x387812[_0x7f13('0x48')]));}else{_0x387812['recordingURL']='';}headers[_0x7f13('0x49')]=getAuth(_0x4dc9d5);return getUser(_0x4dc9d5,'')[_0x7f13('0x1e')](function(_0x106103){_0x4f393b=_0x106103;logger[_0x7f13('0xd')]('The\x20User\x20ID\x20is:',_0x4f393b['id']);return getEndUser(_0x4dc9d5,_0x387812[_0x7f13('0x11')],_0x387812[_0x7f13('0x12')]);})[_0x7f13('0x1e')](function(_0x55b121){_0x9c2b65=_0x55b121;logger['info'](_0x7f13('0x4c'),_0x9c2b65['id']);return getTicket(_0x4dc9d5,_0x4f393b,_0x9c2b65,_0x4bd5dc,_0x387812);})[_0x7f13('0x1e')](function(_0x3b661b){if(_0x3b661b){logger['info'](_0x7f13('0x1f'));logger['info'](_0x7f13('0x4d'),_0x3b661b['id']);}})['catch'](function(_0x112b74){logger[_0x7f13('0x51')]('['+_0x387812[_0x7f13('0x58')][_0x7f13('0x59')]()+']',JSON['stringify'](_0x112b74));});}; \ 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 597b0cf..832d5e4 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 _0x1967=['toLowerCase','outbound','destcalleridnum','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL','ticketId','Displaying\x20task\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Freshsales\x20integration','inspect','request-promise','md5','util','moment','bluebird','ioredis','./util','../../../../config/environment','../../../../config/logger','freshsales','defaults','redis','localhost','socket.io-emitter','/api/selector/owners','headers','info','Getting\x20admin\x20information','then','users','length','email','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','error','toUpperCase','message','Getting\x20user\x20list','agentEmail','userEmail','userId','Admin\x20selected','adminEmail','/api/contacts/filters','filters','forEach','name','All\x20Contacts','Getting\x20contact\x20list','GET','/api/contacts/view/','Searching\x20contact\x20with\x20phone','contacts','find','work_number','contactNumber','mobile_number','Contact\x20found:','endUserId','Contact\x20created:','catch','/api/contacts','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','/api/tasks','getString','format','add','YYYY-MM-DDTHH:mm:ss','task','Task\x20created:','/contacts/','trigger:browser:url','Token\x20token=','remoteUri','stripTrailingSlash','username'];(function(_0x36cfcb,_0x5969fd){var _0x51631b=function(_0x9c096e){while(--_0x9c096e){_0x36cfcb['push'](_0x36cfcb['shift']());}};_0x51631b(++_0x5969fd);}(_0x1967,0x173));var _0x7196=function(_0x4eb7af,_0x355fb7){_0x4eb7af=_0x4eb7af-0x0;var _0x3fc764=_0x1967[_0x4eb7af];return _0x3fc764;};'use strict';var _=require('lodash');var rp=require(_0x7196('0x0'));var md5=require(_0x7196('0x1'));var util=require(_0x7196('0x2'));var moment=require(_0x7196('0x3'));var Promise=require(_0x7196('0x4'));var Redis=require(_0x7196('0x5'));var intUtil=require(_0x7196('0x6'));var config=require(_0x7196('0x7'));var logger=require(_0x7196('0x8'))(_0x7196('0x9'));config['redis']=_[_0x7196('0xa')](config[_0x7196('0xb')],{'host':_0x7196('0xc'),'port':0x18eb});var io=require(_0x7196('0xd'))(new Redis(config[_0x7196('0xb')]));function getAdminId(_0xad78a,_0x510c72,_0x218520,_0xc6366f){return new Promise(function(_0x3f846e,_0x259b18){var _0x1e862d=![];var _0x503070={'method':'GET','uri':_0xc6366f+_0x7196('0xe'),'json':!![]};_0x503070[_0x7196('0xf')]=_0x218520;logger[_0x7196('0x10')](_0x7196('0x11'));return rp(_0x503070)[_0x7196('0x12')](function(_0x46f26c){if(_0x46f26c){var _0x1bf0a5=_0x46f26c[_0x7196('0x13')];var _0x24f1c3=null;for(_0x24f1c3=0x0;_0x24f1c3<_0x1bf0a5[_0x7196('0x14')];_0x24f1c3++){if(_0x1bf0a5[_0x24f1c3][_0x7196('0x15')]===_0xad78a['adminEmail']){_0xad78a[_0x7196('0x16')]=_0x1bf0a5[_0x24f1c3]['id'];_0x1e862d=!![];}}if(_0x1e862d){logger[_0x7196('0x10')](_0x7196('0x17'),_0xad78a[_0x7196('0x16')]);_0x3f846e(_0xad78a);}else{_0x259b18({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x259b18({'statusCode':0x194,'message':_0x7196('0x18')});}})['catch'](function(_0xe32933){logger[_0x7196('0x19')]('['+[_0x510c72[_0x7196('0x1a')]()]+']',_0xe32933[_0x7196('0x1b')]);_0x259b18(_0xe32933);});});}function getUser(_0x12dce7,_0x2e3e0e,_0x22bd62){return function(_0x1ed296){return new Promise(function(_0x3e4e69,_0x32fe2b){var _0x385f2d={'method':'GET','uri':_0x22bd62+'/api/selector/owners','json':!![]};_0x385f2d[_0x7196('0xf')]=_0x2e3e0e;logger[_0x7196('0x10')](_0x7196('0x1c'));return rp(_0x385f2d)['then'](function(_0x39b944){if(_0x39b944){var _0x539d8b=_0x39b944['users'];var _0x296e07=![];var _0x627223=null;if(_0x1ed296[_0x7196('0x1d')]!==null){logger['info']('Getting\x20user\x20with\x20email',_0x1ed296[_0x7196('0x1d')]);_0x1ed296[_0x7196('0x1e')]=_0x1ed296['agentEmail'];for(_0x627223=0x0;_0x627223<_0x539d8b[_0x7196('0x14')];_0x627223++){if(_0x539d8b[_0x627223][_0x7196('0x15')]===_0x1ed296[_0x7196('0x1d')]){_0x296e07=!![];_0x1ed296[_0x7196('0x1f')]=_0x539d8b[_0x627223]['id'];logger[_0x7196('0x10')]('User\x20found:',_0x1ed296[_0x7196('0x1f')]);}}}if(!_0x296e07){logger['info'](_0x7196('0x20'));_0x1ed296[_0x7196('0x1e')]=_0x1ed296[_0x7196('0x21')];_0x1ed296[_0x7196('0x1f')]=_0x1ed296[_0x7196('0x16')];_0x296e07=!![];}if(_0x296e07){_0x3e4e69(_0x1ed296);}else{_0x32fe2b({'statusCode':0x194,'message':_0x7196('0x18')});}}else{_0x32fe2b({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})['catch'](function(_0x1482e5){logger[_0x7196('0x19')]('['+[_0x12dce7[_0x7196('0x1a')]()]+']',_0x1482e5['message']);_0x32fe2b(_0x1482e5);});});};}function getEndUser(_0x5aa538,_0x41cfd2,_0x162cfc){return function(_0x675e64){return new Promise(function(_0x4c6006,_0x35eef9){var _0x4ecea1=0x0;var _0x4fd339={'method':'GET','uri':_0x162cfc+_0x7196('0x22'),'json':!![]};_0x4fd339[_0x7196('0xf')]=_0x41cfd2;logger[_0x7196('0x10')]('Getting\x20contacts\x20filter');return rp(_0x4fd339)[_0x7196('0x12')](function(_0x45d567){_0x45d567[_0x7196('0x23')][_0x7196('0x24')](function(_0x50c386){if(_0x50c386[_0x7196('0x25')]===_0x7196('0x26')){_0x4ecea1=_0x50c386['id'];}});})[_0x7196('0x12')](function(){logger[_0x7196('0x10')](_0x7196('0x27'));var _0x2786f3={'method':_0x7196('0x28'),'uri':_0x162cfc+_0x7196('0x29')+_0x4ecea1,'json':!![]};_0x2786f3[_0x7196('0xf')]=_0x41cfd2;return rp(_0x2786f3);})[_0x7196('0x12')](function(_0x1ff4b4){logger['info'](_0x7196('0x2a'),_0x675e64['contactNumber']);if(_0x1ff4b4[_0x7196('0x2b')]['length']>0x0){var _0x372ddc=_[_0x7196('0x2c')](_0x1ff4b4['contacts'],function(_0x628e7d){if(_0x628e7d[_0x7196('0x2d')]===_0x675e64[_0x7196('0x2e')]||_0x628e7d[_0x7196('0x2f')]===_0x675e64[_0x7196('0x2e')]){return _0x628e7d;}});if(_0x372ddc){_0x675e64['endUserId']=_0x372ddc['id'];logger[_0x7196('0x10')](_0x7196('0x30'),_0x675e64[_0x7196('0x31')]);_0x4c6006(_0x675e64);}else{return createEndUser(_0x675e64,_0x5aa538,_0x41cfd2,_0x162cfc)[_0x7196('0x12')](function(_0x3e8f98){logger[_0x7196('0x10')]('Contact\x20created:',_0x675e64[_0x7196('0x31')]);_0x4c6006(_0x3e8f98);});}}else{return createEndUser(_0x675e64,_0x5aa538,_0x41cfd2,_0x162cfc)[_0x7196('0x12')](function(_0x191df2){logger['info'](_0x7196('0x32'),_0x675e64[_0x7196('0x31')]);_0x4c6006(_0x191df2);});}})[_0x7196('0x33')](function(_0xa24847){throw new Error(_0xa24847[_0x7196('0x1b')]);});});};}function createEndUser(_0x31fca7,_0x938e49,_0x1ab720,_0x92cfb1){return new Promise(function(_0x3ee114,_0x5354d3){var _0x257754=moment();var _0x17cefd={'method':'POST','uri':_0x92cfb1+_0x7196('0x34'),'body':{'contact':{'last_name':_0x31fca7['contactNumber'],'work_number':_0x31fca7['contactNumber'],'mobile_number':_0x31fca7[_0x7196('0x2e')],'owner_id':_0x31fca7[_0x7196('0x1f')],'created_at':_0x257754['format']('YYYY-MM-DDTHH:mm:ss')}},'json':!![]};_0x17cefd[_0x7196('0xf')]=_0x1ab720;logger[_0x7196('0x10')](_0x7196('0x35'));return rp(_0x17cefd)['then'](function(_0x36a990){_0x31fca7[_0x7196('0x31')]=_0x36a990[_0x7196('0x36')]['id'];_0x3ee114(_0x31fca7);})[_0x7196('0x33')](function(_0x16da09){logger[_0x7196('0x19')]('['+[_0x938e49[_0x7196('0x1a')]()]+']',_0x16da09[_0x7196('0x1b')]);_0x5354d3(_0x16da09['message']);});});}function getTicket(_0x89c8ea,_0xa852e1,_0x4f8b4a,_0x266bd7,_0x43d4c0){return function(_0x48178f){logger[_0x7196('0x10')](_0x7196('0x37'));return new Promise(function(_0x3b78c8,_0x5749e2){var _0x455fea=moment();var _0x4713d3={'method':'POST','uri':_0x4f8b4a+_0x7196('0x38'),'body':{'title':intUtil[_0x7196('0x39')](_0x266bd7['Subjects'],_0x43d4c0,'\x20'),'description':intUtil[_0x7196('0x39')](_0x266bd7['Descriptions'],_0x43d4c0,'\x0a'),'owner_id':_0x48178f['userId'],'creater_id':_0x48178f['adminId'],'targetable_id':_0x48178f['endUserId'],'targetable_type':'Contact','created_at':_0x455fea[_0x7196('0x3a')]('YYYY-MM-DDTHH:mm:ss'),'due_date':_0x455fea[_0x7196('0x3b')](0x1e,'m')[_0x7196('0x3a')](_0x7196('0x3c'))},'json':!![]};_0x4713d3[_0x7196('0xf')]=_0xa852e1;return rp(_0x4713d3)['then'](function(_0x3f3171){_0x48178f['ticketId']=_0x3f3171[_0x7196('0x3d')]['id'];logger[_0x7196('0x10')](_0x7196('0x3e'),_0x48178f['ticketId']);_0x3b78c8(_0x48178f);})[_0x7196('0x33')](function(_0x44d8e5){logger[_0x7196('0x19')]('['+[_0x89c8ea['toUpperCase']()]+']',_0x44d8e5['message']);_0x5749e2(_0x44d8e5[_0x7196('0x1b')]);});});};}function emit(_0x5a7896,_0x29c7e8,_0x582884){var _0x53b4c7={'uri':_0x5a7896+_0x7196('0x3f')+_0x582884};io['to'](util['format']('user:%s',_0x29c7e8))['emit'](_0x7196('0x40'),_0x53b4c7);}exports['cs']=function(_0x5052ee,_0x48e3b5,_0x28591e,_0x182c8b,_0x2262d8,_0x1786fa,_0x55de40,_0x50cc66){var _0x564688={};var _0x36844f={'Authorization':_0x7196('0x41')+_0x1786fa['apiKey']};_0x1786fa[_0x7196('0x42')]=intUtil[_0x7196('0x43')](_0x1786fa[_0x7196('0x42')]);_0x1786fa['serverUrl']=intUtil[_0x7196('0x43')](_0x1786fa['serverUrl']);var _0x44f7cc=_0x1786fa[_0x7196('0x42')];_0x564688[_0x7196('0x21')]=_0x1786fa[_0x7196('0x44')];_0x564688[_0x7196('0x2e')]=_0x50cc66[_0x7196('0x45')]()===_0x7196('0x46')?_0x48e3b5[_0x7196('0x47')]:_0x48e3b5['calleridnum'];_0x564688['callDirection']=_0x50cc66===_0x7196('0x48')||_0x50cc66===_0x7196('0x49')?_0x7196('0x48'):_0x7196('0x46');if(_0x182c8b){_0x564688['agentEmail']=_0x182c8b[_0x7196('0x15')];}var _0x6948a=util[_0x7196('0x3a')](_0x7196('0x4a'),_0x1786fa[_0x7196('0x4b')],_0x48e3b5[_0x7196('0x4c')],md5(_0x48e3b5[_0x7196('0x4c')]));if(_0x2262d8&&_0x2262d8[_0x7196('0x4d')]){logger[_0x7196('0x10')](_0x7196('0x4e'),_0x7196('0x4f'));_0x48e3b5['recordingURL']=_0x6948a;}else if(_0x55de40&&_0x55de40[_0x7196('0x50')]&&_0x55de40[_0x7196('0x50')]!==_0x7196('0x51')){logger['info'](_0x7196('0x52'),'Recording\x20is\x20enabled!');_0x48e3b5[_0x7196('0x53')]=_0x6948a;}else{_0x48e3b5[_0x7196('0x53')]='';}return getAdminId(_0x564688,_0x50cc66,_0x36844f,_0x44f7cc)[_0x7196('0x12')](getUser(_0x50cc66,_0x36844f,_0x44f7cc))[_0x7196('0x12')](getEndUser(_0x50cc66,_0x36844f,_0x44f7cc))[_0x7196('0x12')](getTicket(_0x50cc66,_0x36844f,_0x44f7cc,_0x28591e,_0x48e3b5))['then'](function(_0x3ece9f){logger['info'](util['format']('The\x20ticket\x20ID\x20is:\x20%s',_0x3ece9f[_0x7196('0x54')]));if(_0x50cc66!==_0x7196('0x49')){logger[_0x7196('0x10')]('['+[_0x50cc66[_0x7196('0x1a')]()]+']',_0x7196('0x55'));emit(_0x44f7cc,_0x182c8b[_0x7196('0x25')],_0x3ece9f[_0x7196('0x31')]);}})['catch'](function(_0x293467){logger[_0x7196('0x19')]('['+[_0x50cc66[_0x7196('0x1a')]()]+_0x7196('0x56'),util[_0x7196('0x57')](_0x293467,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x068a=['error','toUpperCase','message','Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email','length','userId','User\x20found:','Admin\x20selected','userEmail','adminEmail','/api/contacts/filters','Getting\x20contacts\x20filter','filters','forEach','name','All\x20Contacts','Getting\x20contact\x20list','/api/contacts/view/','Searching\x20contact\x20with\x20phone','contacts','find','contactNumber','endUserId','Contact\x20found:','Contact\x20created:','POST','/api/contacts','format','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','Creating\x20new\x20task','/api/tasks','getString','Descriptions','Contact','ticketId','Task\x20created:','/contacts/','user:%s','emit','trigger:browser:url','Token\x20token=','apiKey','stripTrailingSlash','remoteUri','serverUrl','username','toLowerCase','outbound','destcalleridnum','callDirection','queue','unmanaged','uniqueid','monitor_format','recordingFormat','none','The\x20ticket\x20ID\x20is:\x20%s',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','md5','util','moment','ioredis','../../../../config/environment','../../../../config/logger','freshsales','redis','defaults','localhost','GET','/api/selector/owners','headers','info','Getting\x20admin\x20information','then','users','email','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch'];(function(_0x316b1e,_0x204427){var _0x3c6e6b=function(_0x5dfd4d){while(--_0x5dfd4d){_0x316b1e['push'](_0x316b1e['shift']());}};_0x3c6e6b(++_0x204427);}(_0x068a,0x140));var _0xa068=function(_0x5a2226,_0x248b4b){_0x5a2226=_0x5a2226-0x0;var _0x43d447=_0x068a[_0x5a2226];return _0x43d447;};'use strict';var _=require(_0xa068('0x0'));var rp=require(_0xa068('0x1'));var md5=require(_0xa068('0x2'));var util=require(_0xa068('0x3'));var moment=require(_0xa068('0x4'));var Promise=require('bluebird');var Redis=require(_0xa068('0x5'));var intUtil=require('./util');var config=require(_0xa068('0x6'));var logger=require(_0xa068('0x7'))(_0xa068('0x8'));config[_0xa068('0x9')]=_[_0xa068('0xa')](config[_0xa068('0x9')],{'host':_0xa068('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xa068('0x9')]));function getAdminId(_0x2d3868,_0x138883,_0x222d9d,_0x363051){return new Promise(function(_0x3c8d07,_0x3716a0){var _0x45ff1e=![];var _0x15bb35={'method':_0xa068('0xc'),'uri':_0x363051+_0xa068('0xd'),'json':!![]};_0x15bb35[_0xa068('0xe')]=_0x222d9d;logger[_0xa068('0xf')](_0xa068('0x10'));return rp(_0x15bb35)[_0xa068('0x11')](function(_0x4409a3){if(_0x4409a3){var _0x2dee96=_0x4409a3[_0xa068('0x12')];var _0x59d6d5=null;for(_0x59d6d5=0x0;_0x59d6d5<_0x2dee96['length'];_0x59d6d5++){if(_0x2dee96[_0x59d6d5][_0xa068('0x13')]===_0x2d3868['adminEmail']){_0x2d3868[_0xa068('0x14')]=_0x2dee96[_0x59d6d5]['id'];_0x45ff1e=!![];}}if(_0x45ff1e){logger[_0xa068('0xf')](_0xa068('0x15'),_0x2d3868[_0xa068('0x14')]);_0x3c8d07(_0x2d3868);}else{_0x3716a0({'statusCode':0x194,'message':_0xa068('0x16')});}}else{_0x3716a0({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0xa068('0x17')](function(_0x52af4e){logger[_0xa068('0x18')]('['+[_0x138883[_0xa068('0x19')]()]+']',_0x52af4e[_0xa068('0x1a')]);_0x3716a0(_0x52af4e);});});}function getUser(_0x289de6,_0x38cb93,_0x34581d){return function(_0x2365c2){return new Promise(function(_0x451a53,_0x33e39a){var _0x407137={'method':_0xa068('0xc'),'uri':_0x34581d+'/api/selector/owners','json':!![]};_0x407137[_0xa068('0xe')]=_0x38cb93;logger[_0xa068('0xf')](_0xa068('0x1b'));return rp(_0x407137)[_0xa068('0x11')](function(_0x36f702){if(_0x36f702){var _0x5498cd=_0x36f702['users'];var _0x571783=![];var _0x487c22=null;if(_0x2365c2[_0xa068('0x1c')]!==null){logger[_0xa068('0xf')](_0xa068('0x1d'),_0x2365c2['agentEmail']);_0x2365c2['userEmail']=_0x2365c2[_0xa068('0x1c')];for(_0x487c22=0x0;_0x487c22<_0x5498cd[_0xa068('0x1e')];_0x487c22++){if(_0x5498cd[_0x487c22][_0xa068('0x13')]===_0x2365c2[_0xa068('0x1c')]){_0x571783=!![];_0x2365c2[_0xa068('0x1f')]=_0x5498cd[_0x487c22]['id'];logger[_0xa068('0xf')](_0xa068('0x20'),_0x2365c2[_0xa068('0x1f')]);}}}if(!_0x571783){logger[_0xa068('0xf')](_0xa068('0x21'));_0x2365c2[_0xa068('0x22')]=_0x2365c2[_0xa068('0x23')];_0x2365c2[_0xa068('0x1f')]=_0x2365c2[_0xa068('0x14')];_0x571783=!![];}if(_0x571783){_0x451a53(_0x2365c2);}else{_0x33e39a({'statusCode':0x194,'message':_0xa068('0x16')});}}else{_0x33e39a({'statusCode':0x194,'message':_0xa068('0x16')});}})[_0xa068('0x17')](function(_0x21b54e){logger[_0xa068('0x18')]('['+[_0x289de6[_0xa068('0x19')]()]+']',_0x21b54e['message']);_0x33e39a(_0x21b54e);});});};}function getEndUser(_0x3e13c7,_0x433e36,_0x3774e8){return function(_0x408452){return new Promise(function(_0x58608d,_0xf0d003){var _0x131783=0x0;var _0x1618f1={'method':_0xa068('0xc'),'uri':_0x3774e8+_0xa068('0x24'),'json':!![]};_0x1618f1['headers']=_0x433e36;logger[_0xa068('0xf')](_0xa068('0x25'));return rp(_0x1618f1)[_0xa068('0x11')](function(_0x5c9376){_0x5c9376[_0xa068('0x26')][_0xa068('0x27')](function(_0x282b4b){if(_0x282b4b[_0xa068('0x28')]===_0xa068('0x29')){_0x131783=_0x282b4b['id'];}});})[_0xa068('0x11')](function(){logger['info'](_0xa068('0x2a'));var _0x5239ba={'method':_0xa068('0xc'),'uri':_0x3774e8+_0xa068('0x2b')+_0x131783,'json':!![]};_0x5239ba['headers']=_0x433e36;return rp(_0x5239ba);})[_0xa068('0x11')](function(_0x319474){logger[_0xa068('0xf')](_0xa068('0x2c'),_0x408452['contactNumber']);if(_0x319474[_0xa068('0x2d')][_0xa068('0x1e')]>0x0){var _0x1fed0d=_[_0xa068('0x2e')](_0x319474['contacts'],function(_0x1013c7){if(_0x1013c7['work_number']===_0x408452[_0xa068('0x2f')]||_0x1013c7['mobile_number']===_0x408452[_0xa068('0x2f')]){return _0x1013c7;}});if(_0x1fed0d){_0x408452[_0xa068('0x30')]=_0x1fed0d['id'];logger[_0xa068('0xf')](_0xa068('0x31'),_0x408452['endUserId']);_0x58608d(_0x408452);}else{return createEndUser(_0x408452,_0x3e13c7,_0x433e36,_0x3774e8)[_0xa068('0x11')](function(_0x12172a){logger['info'](_0xa068('0x32'),_0x408452[_0xa068('0x30')]);_0x58608d(_0x12172a);});}}else{return createEndUser(_0x408452,_0x3e13c7,_0x433e36,_0x3774e8)['then'](function(_0x2f5135){logger[_0xa068('0xf')](_0xa068('0x32'),_0x408452[_0xa068('0x30')]);_0x58608d(_0x2f5135);});}})[_0xa068('0x17')](function(_0x44fcb7){throw new Error(_0x44fcb7['message']);});});};}function createEndUser(_0x1c4f0b,_0x3c1bdf,_0x21e719,_0x33ddc4){return new Promise(function(_0x2dc990,_0x59073c){var _0x14ec47=moment();var _0x5ee7e7={'method':_0xa068('0x33'),'uri':_0x33ddc4+_0xa068('0x34'),'body':{'contact':{'last_name':_0x1c4f0b[_0xa068('0x2f')],'work_number':_0x1c4f0b['contactNumber'],'mobile_number':_0x1c4f0b['contactNumber'],'owner_id':_0x1c4f0b[_0xa068('0x1f')],'created_at':_0x14ec47[_0xa068('0x35')](_0xa068('0x36'))}},'json':!![]};_0x5ee7e7['headers']=_0x21e719;logger['info'](_0xa068('0x37'));return rp(_0x5ee7e7)['then'](function(_0x47b4fd){_0x1c4f0b[_0xa068('0x30')]=_0x47b4fd['contact']['id'];_0x2dc990(_0x1c4f0b);})[_0xa068('0x17')](function(_0x19ab8f){logger['error']('['+[_0x3c1bdf[_0xa068('0x19')]()]+']',_0x19ab8f['message']);_0x59073c(_0x19ab8f[_0xa068('0x1a')]);});});}function getTicket(_0x33b36e,_0x49c200,_0x18b862,_0x2f3e4a,_0x5069aa){return function(_0x2494fe){logger['info'](_0xa068('0x38'));return new Promise(function(_0x4e0f03,_0x29efc3){var _0x44bf70=moment();var _0x132780={'method':_0xa068('0x33'),'uri':_0x18b862+_0xa068('0x39'),'body':{'title':intUtil[_0xa068('0x3a')](_0x2f3e4a['Subjects'],_0x5069aa,'\x20'),'description':intUtil[_0xa068('0x3a')](_0x2f3e4a[_0xa068('0x3b')],_0x5069aa,'\x0a'),'owner_id':_0x2494fe['userId'],'creater_id':_0x2494fe['adminId'],'targetable_id':_0x2494fe[_0xa068('0x30')],'targetable_type':_0xa068('0x3c'),'created_at':_0x44bf70[_0xa068('0x35')](_0xa068('0x36')),'due_date':_0x44bf70['add'](0x1e,'m')['format'](_0xa068('0x36'))},'json':!![]};_0x132780[_0xa068('0xe')]=_0x49c200;return rp(_0x132780)['then'](function(_0x1f47ec){_0x2494fe[_0xa068('0x3d')]=_0x1f47ec['task']['id'];logger[_0xa068('0xf')](_0xa068('0x3e'),_0x2494fe[_0xa068('0x3d')]);_0x4e0f03(_0x2494fe);})[_0xa068('0x17')](function(_0x465449){logger['error']('['+[_0x33b36e[_0xa068('0x19')]()]+']',_0x465449[_0xa068('0x1a')]);_0x29efc3(_0x465449['message']);});});};}function emit(_0x384aed,_0x51d9ed,_0x5ae0f4){var _0x1104ed={'uri':_0x384aed+_0xa068('0x3f')+_0x5ae0f4};io['to'](util[_0xa068('0x35')](_0xa068('0x40'),_0x51d9ed))[_0xa068('0x41')](_0xa068('0x42'),_0x1104ed);}exports['cs']=function(_0x53cf3c,_0x2b2af6,_0x5e0a65,_0x40eaab,_0x4654f5,_0x3d41df,_0x1aadbd,_0x566d1e){var _0x41ca14={};var _0x3edf5d={'Authorization':_0xa068('0x43')+_0x3d41df[_0xa068('0x44')]};_0x3d41df['remoteUri']=intUtil[_0xa068('0x45')](_0x3d41df[_0xa068('0x46')]);_0x3d41df[_0xa068('0x47')]=intUtil[_0xa068('0x45')](_0x3d41df[_0xa068('0x47')]);var _0x57067a=_0x3d41df[_0xa068('0x46')];_0x41ca14[_0xa068('0x23')]=_0x3d41df[_0xa068('0x48')];_0x41ca14[_0xa068('0x2f')]=_0x566d1e[_0xa068('0x49')]()===_0xa068('0x4a')?_0x2b2af6[_0xa068('0x4b')]:_0x2b2af6['calleridnum'];_0x41ca14[_0xa068('0x4c')]=_0x566d1e===_0xa068('0x4d')||_0x566d1e===_0xa068('0x4e')?'queue':_0xa068('0x4a');if(_0x40eaab){_0x41ca14[_0xa068('0x1c')]=_0x40eaab[_0xa068('0x13')];}var _0x107e46=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3d41df[_0xa068('0x47')],_0x2b2af6['uniqueid'],md5(_0x2b2af6[_0xa068('0x4f')]));if(_0x4654f5&&_0x4654f5[_0xa068('0x50')]){logger[_0xa068('0xf')]('[QUEUE]','Recording\x20is\x20enabled!');_0x2b2af6['recordingURL']=_0x107e46;}else if(_0x1aadbd&&_0x1aadbd[_0xa068('0x51')]&&_0x1aadbd[_0xa068('0x51')]!==_0xa068('0x52')){logger[_0xa068('0xf')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x2b2af6['recordingURL']=_0x107e46;}else{_0x2b2af6['recordingURL']='';}return getAdminId(_0x41ca14,_0x566d1e,_0x3edf5d,_0x57067a)['then'](getUser(_0x566d1e,_0x3edf5d,_0x57067a))[_0xa068('0x11')](getEndUser(_0x566d1e,_0x3edf5d,_0x57067a))[_0xa068('0x11')](getTicket(_0x566d1e,_0x3edf5d,_0x57067a,_0x5e0a65,_0x2b2af6))[_0xa068('0x11')](function(_0x30a3c5){logger[_0xa068('0xf')](util[_0xa068('0x35')](_0xa068('0x53'),_0x30a3c5[_0xa068('0x3d')]));if(_0x566d1e!==_0xa068('0x4e')){logger['info']('['+[_0x566d1e[_0xa068('0x19')]()]+']','Displaying\x20task\x20in\x20a\x20new\x20tab...');emit(_0x57067a,_0x40eaab['name'],_0x30a3c5[_0xa068('0x30')]);}})['catch'](function(_0x40aea4){logger[_0xa068('0x18')]('['+[_0x566d1e['toUpperCase']()]+_0xa068('0x54'),util[_0xa068('0x55')](_0x40aea4,{'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 aa0a7cf..97c4975 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 _0x34b7=['desk','vtiger','exec','includes','data1','toLowerCase','find','Configurations','data3','queue','routeId','outbound','log','EVENT\x20UNKNOWN','unmanaged','freshsales','servicenow','dynamics365','unknown\x20integration','../../../../config/logger','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','%s\x20account\x20#%s\x20not\x20found','data2','./zendesk','./salesforce','./sugarcrm','./freshdesk','./zoho','./desk','./dynamics365','./freshsales','zendesk','salesforce','sugarcrm','freshdesk'];(function(_0x28947d,_0x4cc9c6){var _0x12d2ee=function(_0x3f38fc){while(--_0x3f38fc){_0x28947d['push'](_0x28947d['shift']());}};_0x12d2ee(++_0x4cc9c6);}(_0x34b7,0x196));var _0x734b=function(_0xe3bbea,_0x3ae4d3){_0xe3bbea=_0xe3bbea-0x0;var _0x18713d=_0x34b7[_0xe3bbea];return _0x18713d;};'use strict';var _=require('lodash');var util=require('util');var zendesk=require(_0x734b('0x0'));var salesforce=require(_0x734b('0x1'));var sugarcrm=require(_0x734b('0x2'));var freshdesk=require(_0x734b('0x3'));var zoho=require(_0x734b('0x4'));var desk=require(_0x734b('0x5'));var vtiger=require('./vtiger');var servicenow=require('./servicenow');var dynamics365=require(_0x734b('0x6'));var freshsales=require(_0x734b('0x7'));var integrations=[_0x734b('0x8'),_0x734b('0x9'),_0x734b('0xa'),_0x734b('0xb'),'zoho',_0x734b('0xc'),_0x734b('0xd'),'dynamics365','freshsales','servicenow'];exports[_0x734b('0xe')]=function(_0x598dee,_0x43c5e0,_0x333738,_0x2860a2,_0x222dc7,_0x3a442b){if(_0x333738){if(_[_0x734b('0xf')](integrations,_0x598dee[_0x734b('0x10')][_0x734b('0x11')]())){try{var _0x257657=null;var _0x1e0fca='';var _0x189a82=_0x333738[_0x598dee[_0x734b('0x10')][_0x734b('0x11')]()];if(_0x189a82){var _0x1c893d=_0x189a82[_0x598dee['data2']];if(_0x1c893d){var _0x18fc18=_[_0x734b('0x12')](_0x1c893d[_0x734b('0x13')],{'id':parseInt(_0x598dee[_0x734b('0x14')],0xa)});if(_0x18fc18){if(_0x2860a2){if(_0x222dc7&&_0x43c5e0[_0x734b('0x15')]){_0x1e0fca=_0x734b('0x15');}else if(_0x43c5e0[_0x734b('0x16')]){_0x1e0fca=_0x734b('0x17');}else{console[_0x734b('0x18')](_0x734b('0x19'),_0x43c5e0);}}else{_0x1e0fca=_0x734b('0x1a');}switch(_0x598dee['data1'][_0x734b('0x11')]()){case _0x734b('0x8'):zendesk[_0x1e0fca](_0x598dee,_0x43c5e0,_0x18fc18,_0x2860a2,_0x222dc7,_0x1c893d,_0x3a442b);break;case _0x734b('0x9'):salesforce[_0x1e0fca](_0x598dee,_0x43c5e0,_0x18fc18,_0x2860a2,_0x222dc7,_0x1c893d,_0x3a442b);break;case _0x734b('0xa'):sugarcrm[_0x1e0fca](_0x598dee,_0x43c5e0,_0x18fc18,_0x2860a2,_0x222dc7,_0x1c893d,_0x3a442b);break;case'freshdesk':freshdesk[_0x1e0fca](_0x598dee,_0x43c5e0,_0x18fc18,_0x2860a2,_0x222dc7,_0x1c893d,_0x3a442b);break;case'zoho':zoho[_0x1e0fca](_0x598dee,_0x43c5e0,_0x18fc18,_0x2860a2,_0x222dc7,_0x1c893d,_0x3a442b);break;case _0x734b('0xc'):desk[_0x1e0fca](_0x598dee,_0x43c5e0,_0x18fc18,_0x2860a2,_0x222dc7,_0x1c893d,_0x3a442b);break;case _0x734b('0xd'):vtiger[_0x1e0fca](_0x598dee,_0x43c5e0,_0x18fc18,_0x2860a2,_0x222dc7,_0x1c893d,_0x3a442b);break;case _0x734b('0x1b'):freshsales['cs'](_0x598dee,_0x43c5e0,_0x18fc18,_0x2860a2,_0x222dc7,_0x1c893d,_0x3a442b,_0x1e0fca);break;case _0x734b('0x1c'):servicenow['cs'](_0x598dee,_0x43c5e0,_0x18fc18,_0x2860a2,_0x222dc7,_0x1c893d,_0x3a442b,_0x1e0fca);break;case _0x734b('0x1d'):dynamics365['cs'](_0x598dee,_0x43c5e0,_0x18fc18,_0x2860a2,_0x222dc7,_0x1c893d,_0x3a442b,_0x1e0fca);break;default:console[_0x734b('0x18')](_0x734b('0x1e'));}}else{_0x257657=require(_0x734b('0x1f'))(_0x598dee[_0x734b('0x10')][_0x734b('0x11')]());_0x257657[_0x734b('0x20')](_0x734b('0x21'),util[_0x734b('0x22')](_0x734b('0x23'),_0x598dee['data1'][_0x734b('0x11')](),_0x598dee[_0x734b('0x14')]));}}else{_0x257657=require('../../../../config/logger')(_0x598dee[_0x734b('0x10')][_0x734b('0x11')]());_0x257657[_0x734b('0x20')](_0x734b('0x21'),util[_0x734b('0x22')](_0x734b('0x24'),_0x598dee[_0x734b('0x10')][_0x734b('0x11')](),_0x598dee[_0x734b('0x25')]));}}else{}}catch(_0x3abbe6){console[_0x734b('0x20')](_0x3abbe6);}}}}; \ No newline at end of file +var _0x955f=['%s\x20account\x20#%s\x20not\x20found','lodash','util','./zendesk','./salesforce','./sugarcrm','./zoho','./servicenow','./freshsales','zendesk','salesforce','freshdesk','zoho','vtiger','dynamics365','freshsales','servicenow','exec','includes','data1','toLowerCase','data2','find','Configurations','data3','queue','routeId','log','unmanaged','desk','unknown\x20integration','error','format','../../../../config/logger','[EXEC]'];(function(_0x5aa5ac,_0x2a3dc6){var _0x993034=function(_0xf5b1cb){while(--_0xf5b1cb){_0x5aa5ac['push'](_0x5aa5ac['shift']());}};_0x993034(++_0x2a3dc6);}(_0x955f,0x1eb));var _0xf955=function(_0x414aff,_0x347f0f){_0x414aff=_0x414aff-0x0;var _0xc18faa=_0x955f[_0x414aff];return _0xc18faa;};'use strict';var _=require(_0xf955('0x0'));var util=require(_0xf955('0x1'));var zendesk=require(_0xf955('0x2'));var salesforce=require(_0xf955('0x3'));var sugarcrm=require(_0xf955('0x4'));var freshdesk=require('./freshdesk');var zoho=require(_0xf955('0x5'));var desk=require('./desk');var vtiger=require('./vtiger');var servicenow=require(_0xf955('0x6'));var dynamics365=require('./dynamics365');var freshsales=require(_0xf955('0x7'));var integrations=[_0xf955('0x8'),_0xf955('0x9'),'sugarcrm',_0xf955('0xa'),_0xf955('0xb'),'desk',_0xf955('0xc'),_0xf955('0xd'),_0xf955('0xe'),_0xf955('0xf')];exports[_0xf955('0x10')]=function(_0x421e4a,_0x186719,_0x4d213a,_0xf7e3e,_0x5b0afa,_0x2d59e9){if(_0x4d213a){if(_[_0xf955('0x11')](integrations,_0x421e4a[_0xf955('0x12')]['toLowerCase']())){try{var _0x2f61b8=null;var _0x542347='';var _0x23e0c6=_0x4d213a[_0x421e4a['data1'][_0xf955('0x13')]()];if(_0x23e0c6){var _0x2ff7e5=_0x23e0c6[_0x421e4a[_0xf955('0x14')]];if(_0x2ff7e5){var _0x109bc5=_[_0xf955('0x15')](_0x2ff7e5[_0xf955('0x16')],{'id':parseInt(_0x421e4a[_0xf955('0x17')],0xa)});if(_0x109bc5){if(_0xf7e3e){if(_0x5b0afa&&_0x186719[_0xf955('0x18')]){_0x542347=_0xf955('0x18');}else if(_0x186719[_0xf955('0x19')]){_0x542347='outbound';}else{console[_0xf955('0x1a')]('EVENT\x20UNKNOWN',_0x186719);}}else{_0x542347=_0xf955('0x1b');}switch(_0x421e4a[_0xf955('0x12')][_0xf955('0x13')]()){case _0xf955('0x8'):zendesk[_0x542347](_0x421e4a,_0x186719,_0x109bc5,_0xf7e3e,_0x5b0afa,_0x2ff7e5,_0x2d59e9);break;case'salesforce':salesforce[_0x542347](_0x421e4a,_0x186719,_0x109bc5,_0xf7e3e,_0x5b0afa,_0x2ff7e5,_0x2d59e9);break;case'sugarcrm':sugarcrm[_0x542347](_0x421e4a,_0x186719,_0x109bc5,_0xf7e3e,_0x5b0afa,_0x2ff7e5,_0x2d59e9);break;case _0xf955('0xa'):freshdesk[_0x542347](_0x421e4a,_0x186719,_0x109bc5,_0xf7e3e,_0x5b0afa,_0x2ff7e5,_0x2d59e9);break;case _0xf955('0xb'):zoho[_0x542347](_0x421e4a,_0x186719,_0x109bc5,_0xf7e3e,_0x5b0afa,_0x2ff7e5,_0x2d59e9);break;case _0xf955('0x1c'):desk[_0x542347](_0x421e4a,_0x186719,_0x109bc5,_0xf7e3e,_0x5b0afa,_0x2ff7e5,_0x2d59e9);break;case'vtiger':vtiger[_0x542347](_0x421e4a,_0x186719,_0x109bc5,_0xf7e3e,_0x5b0afa,_0x2ff7e5,_0x2d59e9);break;case _0xf955('0xe'):freshsales['cs'](_0x421e4a,_0x186719,_0x109bc5,_0xf7e3e,_0x5b0afa,_0x2ff7e5,_0x2d59e9,_0x542347);break;case _0xf955('0xf'):servicenow['cs'](_0x421e4a,_0x186719,_0x109bc5,_0xf7e3e,_0x5b0afa,_0x2ff7e5,_0x2d59e9,_0x542347);break;case _0xf955('0xd'):dynamics365['cs'](_0x421e4a,_0x186719,_0x109bc5,_0xf7e3e,_0x5b0afa,_0x2ff7e5,_0x2d59e9,_0x542347);break;default:console[_0xf955('0x1a')](_0xf955('0x1d'));}}else{_0x2f61b8=require('../../../../config/logger')(_0x421e4a[_0xf955('0x12')][_0xf955('0x13')]());_0x2f61b8[_0xf955('0x1e')]('[EXEC]',util[_0xf955('0x1f')]('%s\x20configuration\x20#%s\x20not\x20found',_0x421e4a[_0xf955('0x12')][_0xf955('0x13')](),_0x421e4a[_0xf955('0x17')]));}}else{_0x2f61b8=require(_0xf955('0x20'))(_0x421e4a[_0xf955('0x12')]['toLowerCase']());_0x2f61b8[_0xf955('0x1e')](_0xf955('0x21'),util[_0xf955('0x1f')](_0xf955('0x22'),_0x421e4a[_0xf955('0x12')][_0xf955('0x13')](),_0x421e4a[_0xf955('0x14')]));}}else{}}catch(_0x552cf3){console[_0xf955('0x1e')](_0x552cf3);}}}}; \ 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 bb83039..b593a18 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 _0x4823=['type','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','Connection','remoteUri','https://login.salesforce.com','clientSecret','login','username','Connection\x20established.','queue','serverUrl','Recording\x20is\x20enabled!','recordingURL','uniqueid','calleridname','calleridnum','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','trigger:salesforce:display','newTab','user:%s','trigger:browser:url','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','stringify','recordingFormat','none','destcalleridname','destcalleridnum','outbound','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','[OUTBOUND]','Salesforce\x20account\x20type\x20not\x20recognized','monitor_format','toUpperCase','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','lastevent',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','emit','ticketType','assign','utc','getString','WhoId','Case','Subjects','Descriptions','ContactId','sobject','create','isNil','validateEmail','User','find','execute','then','Agent\x20%s\x20found.','resolve','Name','info','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','Contact','Lead','length','Phone','Enduser\x20with\x20phone\x20%s\x20found.','Enduser\x20with\x20phone\x20%s\x20not\x20found.','format','Caller\x20-\x20%s','moduleCreate','contact','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','lead','Task','Company','No\x20Company','forEach'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x4823,0xa0));var _0x3482=function(_0x1d426f,_0x37e919){_0x1d426f=_0x1d426f-0x0;var _0x17f71a=_0x4823[_0x1d426f];return _0x17f71a;};'use strict';var _=require(_0x3482('0x0'));var rp=require(_0x3482('0x1'));var moment=require(_0x3482('0x2'));var BPromise=require('bluebird');var md5=require(_0x3482('0x3'));var jsforce=require('jsforce');var util=require(_0x3482('0x4'));var Redis=require(_0x3482('0x5'));var intUtil=require(_0x3482('0x6'));var config=require(_0x3482('0x7'));var logger=require(_0x3482('0x8'))('salesforce');config[_0x3482('0x9')]=_[_0x3482('0xa')](config[_0x3482('0x9')],{'host':_0x3482('0xb'),'port':0x18eb});var io=require(_0x3482('0xc'))(new Redis(config[_0x3482('0x9')]));function emit(_0x3a368f,_0x4956f9,_0x295ece){io['to'](_0x3a368f)[_0x3482('0xd')](_0x4956f9,_0x295ece);}function getTicket(_0x54a98d,_0xf3e927,_0x3417ab,_0x1cce53,_0x25f63b,_0x57f419,_0x167934,_0x48bd8b){var _0x249ed6={};if(_0x1cce53[_0x3482('0xe')]==='Task'){_0x249ed6=Object[_0x3482('0xf')]({},{'OwnerId':_0xf3e927['id'],'ActivityDate':moment[_0x3482('0x10')](),'IsReminderSet':![],'IsRecurrence':![],'Subject':intUtil[_0x3482('0x11')](_0x1cce53['Subjects'],_0x25f63b,'\x20'),'Description':intUtil[_0x3482('0x11')](_0x1cce53['Descriptions'],_0x25f63b,'\x0a')},getCustomFields(_0x57f419,_0x25f63b));if(_0x3417ab){_0x249ed6[_0x3482('0x12')]=_0x3417ab['id'];}}else if(_0x1cce53[_0x3482('0xe')]===_0x3482('0x13')){_0x249ed6=Object[_0x3482('0xf')]({},{'OwnerId':_0xf3e927['id'],'Subject':intUtil[_0x3482('0x11')](_0x1cce53[_0x3482('0x14')],_0x25f63b,'\x20'),'Description':intUtil[_0x3482('0x11')](_0x1cce53[_0x3482('0x15')],_0x25f63b,'\x0a')},getCustomFields(_0x57f419,_0x25f63b));if(_0x3417ab){_0x249ed6[_0x3482('0x16')]=_0x3417ab['id'];}}return _0x167934[_0x3482('0x17')](_0x1cce53[_0x3482('0xe')])[_0x3482('0x18')](_0x249ed6);}function getUser(_0x2bc2a3,_0x362ee7,_0x339338){if(!_[_0x3482('0x19')](_0x362ee7)&&intUtil[_0x3482('0x1a')](_0x362ee7)){var _0x2aeaeb={'Email':_0x362ee7};var _0x13f98f={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x339338[_0x3482('0x17')](_0x3482('0x1b'))[_0x3482('0x1c')](_0x2aeaeb,_0x13f98f)[_0x3482('0x1d')]()[_0x3482('0x1e')](function(_0x2d5657){if(_0x2d5657['length']){var _0x381098=_['find'](_0x2d5657,function(_0x45d048){return _0x45d048['Email']===_0x362ee7;});if(_0x381098){logger['info'](_0x3482('0x1f'),_0x362ee7);return BPromise[_0x3482('0x20')]({'id':_0x381098['Id'],'name':_0x381098[_0x3482('0x21')]});}}else{logger[_0x3482('0x22')](_0x3482('0x23'),_0x362ee7);return _0x339338[_0x3482('0x24')]()[_0x3482('0x1e')](function(_0x3b5487){return BPromise[_0x3482('0x20')]({'id':_0x3b5487[_0x3482('0x25')],'name':_0x3b5487['display_name']});});}});}else{logger[_0x3482('0x22')](_0x3482('0x23'),_0x362ee7);return _0x339338['identity']()[_0x3482('0x1e')](function(_0x4a0a5c){return BPromise['resolve']({'id':_0x4a0a5c[_0x3482('0x25')],'name':_0x4a0a5c[_0x3482('0x26')]});});}}function getEndUser(_0x588c90,_0x4aabe7,_0x28f479,_0x20ee16,_0x5a0b3b){var _0x5aeb9a={'Phone':_0x20ee16};var _0x4dacc9={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x3482('0x20')]()['then'](function(){if(_0x4aabe7[_0x3482('0xe')]==='Task'){logger['info'](_0x3482('0x27'),_0x20ee16,_0x4aabe7['moduleSearch']);switch(_0x4aabe7['moduleSearch']){case'contact_lead':return _0x5a0b3b['sobject'](_0x3482('0x28'))['find'](_0x5aeb9a,_0x4dacc9)[_0x3482('0x1d')]()[_0x3482('0x1e')](function(_0x4db71d){if(_0x4db71d&&_0x4db71d['length']){return _0x4db71d;}else{return _0x5a0b3b[_0x3482('0x17')](_0x3482('0x29'))[_0x3482('0x1c')](_0x5aeb9a,_0x4dacc9);}});case'contact':return _0x5a0b3b[_0x3482('0x17')]('Contact')['find'](_0x5aeb9a,_0x4dacc9)['execute']();case'lead':return _0x5a0b3b[_0x3482('0x17')]('Lead')[_0x3482('0x1c')](_0x5aeb9a,_0x4dacc9);default:return null;}}else if(_0x4aabe7[_0x3482('0xe')]==='Case'){logger['info']('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x20ee16,'contact');return _0x5a0b3b[_0x3482('0x17')](_0x3482('0x28'))[_0x3482('0x1c')](_0x5aeb9a,_0x4dacc9)[_0x3482('0x1d')]();}})[_0x3482('0x1e')](function(_0x2777e8){if(_0x2777e8&&_0x2777e8[_0x3482('0x2a')]){var _0x516875=_['find'](_0x2777e8,function(_0x56f942){return _0x56f942[_0x3482('0x2b')]===_0x20ee16;});if(_0x516875){return BPromise['resolve']({'id':_0x516875['Id'],'name':_0x516875['Name'],'phone':_0x516875['Phone']});}}})[_0x3482('0x1e')](function(_0x5b94e8){if(_0x5b94e8){logger[_0x3482('0x22')](_0x3482('0x2c'),_0x20ee16);return BPromise['resolve'](_0x5b94e8);}else{logger[_0x3482('0x22')](_0x3482('0x2d'),_0x20ee16);var _0xbac07c={'LastName':_0x28f479!==''?_0x28f479:util[_0x3482('0x2e')](_0x3482('0x2f'),_0x20ee16),'Phone':_0x20ee16};if(_0x4aabe7[_0x3482('0x30')]){if(_0x4aabe7[_0x3482('0x30')]===_0x3482('0x31')){logger[_0x3482('0x22')](_0x3482('0x32'),_0x20ee16,_0x4aabe7[_0x3482('0x30')]);}else if(_0x4aabe7[_0x3482('0x30')]===_0x3482('0x33')&&_0x4aabe7[_0x3482('0xe')]===_0x3482('0x34')){logger[_0x3482('0x22')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x20ee16,_0x4aabe7[_0x3482('0x30')]);_0xbac07c[_0x3482('0x35')]=_0x3482('0x36');}else{return null;}}return _0x5a0b3b[_0x3482('0x17')](_['upperFirst'](_0x4aabe7[_0x3482('0x30')]))[_0x3482('0x18')](_0xbac07c);}});}function getCustomFields(_0x38630d,_0x4553b6){var _0x1d7796={};if(_0x38630d[_0x3482('0x2a')]>0x0){_[_0x3482('0x37')](_0x38630d,function(_0xfda152){if(_0xfda152[_0x3482('0x38')]==='string'&&_0xfda152[_0x3482('0x39')]){_0x1d7796[_0xfda152[_0x3482('0x39')]]=_0xfda152[_0x3482('0x3a')][_0x3482('0x3b')]();}else if(_0xfda152[_0x3482('0x38')]===_0x3482('0x3c')&&_0xfda152[_0x3482('0x3d')]&&_0xfda152[_0x3482('0x39')]){_0x4553b6[_0xfda152['variableName']]&&(_0x1d7796[_0xfda152[_0x3482('0x39')]]=_0x4553b6[_0xfda152[_0x3482('0x3d')]][_0x3482('0x3b')]());}else if(_0xfda152[_0x3482('0x38')]===_0x3482('0x3e')&&_0xfda152[_0x3482('0x3f')]&&_0xfda152[_0x3482('0x3f')]['name']&&_0xfda152[_0x3482('0x39')]){_0x4553b6[_0xfda152[_0x3482('0x3f')][_0x3482('0x40')][_0x3482('0x41')]()]&&(_0x1d7796[_0xfda152[_0x3482('0x39')]]=_0x4553b6[_0xfda152['Variable'][_0x3482('0x40')][_0x3482('0x41')]()][_0x3482('0x3b')]());}});}return _0x1d7796;}function getConnection(_0x5b46ca){var _0x5abb5b=_0x5b46ca['password']['concat'](_0x5b46ca['securityToken']);var _0x462d46=new jsforce[(_0x3482('0x42'))]({'oauth2':{'loginUrl':_0x5b46ca[_0x3482('0x43')]||_0x3482('0x44'),'clientId':_0x5b46ca['clientId'],'clientSecret':_0x5b46ca[_0x3482('0x45')]}});return _0x462d46[_0x3482('0x46')](_0x5b46ca[_0x3482('0x47')],_0x5abb5b)[_0x3482('0x1e')](function(){logger[_0x3482('0x22')](_0x3482('0x48'));return _0x462d46;});}exports[_0x3482('0x49')]=function(_0x4453a0,_0x139945,_0x43dd82,_0x35a583,_0x5d2149,_0x3f64af){var _0x3d7d09,_0x486f0b,_0x96a28d,_0x36262a;_0x3f64af['serverUrl']=intUtil['stripTrailingSlash'](_0x3f64af[_0x3482('0x4a')]);_0x3f64af[_0x3482('0x43')]=intUtil['stripTrailingSlash'](_0x3f64af['remoteUri']);if(_0x5d2149&&_0x5d2149['monitor_format']){logger[_0x3482('0x22')]('[QUEUE]',_0x3482('0x4b'));_0x139945[_0x3482('0x4c')]=util[_0x3482('0x2e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3f64af[_0x3482('0x4a')],_0x139945[_0x3482('0x4d')],md5(_0x139945[_0x3482('0x4d')]));}else{_0x139945[_0x3482('0x4c')]='';}return getConnection(_0x3f64af)[_0x3482('0x1e')](function(_0x3d5a15){_0x36262a=_0x3d5a15;return getUser(_0x3f64af,_0x35a583['email'],_0x36262a);})[_0x3482('0x1e')](function(_0x162136){_0x3d7d09=_0x162136;return getEndUser(_0x3f64af,_0x43dd82,_0x139945[_0x3482('0x4e')],_0x139945[_0x3482('0x4f')],_0x36262a);})[_0x3482('0x1e')](function(_0x5ed907){_0x486f0b=_0x5ed907;return getTicket(_0x3f64af,_0x3d7d09,_0x486f0b,_0x43dd82,_0x139945,_0x43dd82[_0x3482('0x50')],_0x36262a,_0x3482('0x49'));})[_0x3482('0x1e')](function(_0x54d427){_0x96a28d=_0x54d427;logger[_0x3482('0x22')](_0x3482('0x51'),_0x96a28d['id']);logger['info'](_0x3482('0x52'),_0x96a28d['id'],_0x35a583[_0x3482('0x40')],_0x3f64af[_0x3482('0x38')]);switch(_0x3f64af['type']){case _0x3482('0x53'):emit(util[_0x3482('0x2e')]('user:%s',_0x35a583[_0x3482('0x40')]),_0x3482('0x54'),{'recordId':_0x96a28d['id']});break;case _0x3482('0x55'):emit(util[_0x3482('0x2e')](_0x3482('0x56'),_0x35a583['name']),_0x3482('0x57'),{'uri':util['format'](_0x3482('0x58'),_0x36262a[_0x3482('0x59')],_0x96a28d['id'])});break;default:logger[_0x3482('0x5a')](_0x3482('0x5b'));}})[_0x3482('0x5c')](function(_0x3b2159){logger[_0x3482('0x5a')]('[QUEUE]',JSON[_0x3482('0x5d')](_0x3b2159));});};exports['outbound']=function(_0x473afc,_0x2f3e23,_0x5ab34f,_0x1053ac,_0x5cf315,_0x2f57c3,_0x4f68e5){var _0x25b5ee,_0x2dc918,_0x10e3aa,_0x530572;_0x2f57c3[_0x3482('0x4a')]=intUtil['stripTrailingSlash'](_0x2f57c3[_0x3482('0x4a')]);_0x2f57c3[_0x3482('0x43')]=intUtil['stripTrailingSlash'](_0x2f57c3[_0x3482('0x43')]);if(_0x4f68e5&&_0x4f68e5[_0x3482('0x5e')]&&_0x4f68e5[_0x3482('0x5e')]!==_0x3482('0x5f')){logger[_0x3482('0x22')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x2f3e23['recordingURL']=util[_0x3482('0x2e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2f57c3['serverUrl'],_0x2f3e23[_0x3482('0x4d')],md5(_0x2f3e23[_0x3482('0x4d')]));}return getConnection(_0x2f57c3)['then'](function(_0x5ca74b){_0x530572=_0x5ca74b;return getUser(_0x2f57c3,_0x1053ac['email'],_0x530572);})[_0x3482('0x1e')](function(_0xe8e720){_0x25b5ee=_0xe8e720;return getEndUser(_0x2f57c3,_0x5ab34f,_0x2f3e23[_0x3482('0x60')],_0x2f3e23[_0x3482('0x61')],_0x530572);})[_0x3482('0x1e')](function(_0x163b13){_0x2dc918=_0x163b13;return getTicket(_0x2f57c3,_0x25b5ee,_0x2dc918,_0x5ab34f,_0x2f3e23,_0x5ab34f[_0x3482('0x50')],_0x530572,_0x3482('0x62'));})[_0x3482('0x1e')](function(_0x568bf4){_0x10e3aa=_0x568bf4;logger[_0x3482('0x22')]('[OUTBOUND]\x20Ticket\x20%s\x20created.',_0x10e3aa['id']);logger['info'](_0x3482('0x63'),_0x10e3aa['id'],_0x1053ac[_0x3482('0x40')],_0x2f57c3[_0x3482('0x38')]);switch(_0x2f57c3[_0x3482('0x38')]){case _0x3482('0x53'):emit(util['format'](_0x3482('0x56'),_0x1053ac[_0x3482('0x40')]),_0x3482('0x54'),{'recordId':_0x10e3aa['id']});break;case _0x3482('0x55'):emit(util[_0x3482('0x2e')](_0x3482('0x56'),_0x1053ac[_0x3482('0x40')]),_0x3482('0x57'),{'uri':util[_0x3482('0x2e')](_0x3482('0x58'),_0x530572['instanceUrl'],_0x10e3aa['id'])});break;default:logger[_0x3482('0x5a')](_0x3482('0x64'),_0x3482('0x65'));}})[_0x3482('0x5c')](function(_0x529b56){logger[_0x3482('0x5a')](_0x3482('0x64'),JSON[_0x3482('0x5d')](_0x529b56));});};exports['unmanaged']=function(_0x4ce974,_0x1ba0db,_0x1c15dc,_0x1db01b,_0x5829df,_0x2df438){var _0xb1cda2,_0x49eb9f,_0x54f583,_0x59cec4;_0x2df438['serverUrl']=intUtil['stripTrailingSlash'](_0x2df438[_0x3482('0x4a')]);_0x2df438[_0x3482('0x43')]=intUtil['stripTrailingSlash'](_0x2df438['remoteUri']);if(_0x5829df&&_0x5829df[_0x3482('0x66')]){logger['info']('['+_0x1ba0db['lastevent'][_0x3482('0x67')]()+']','Recording\x20is\x20enabled!');_0x1ba0db[_0x3482('0x4c')]=util[_0x3482('0x2e')](_0x3482('0x68'),_0x2df438[_0x3482('0x4a')],_0x1ba0db['uniqueid'],md5(_0x1ba0db[_0x3482('0x4d')]));}else{_0x1ba0db[_0x3482('0x4c')]='';}return getConnection(_0x2df438)[_0x3482('0x1e')](function(_0x326c7d){_0x59cec4=_0x326c7d;if(!_['isNil'](_0x1db01b)){return getUser(_0x2df438,_0x1db01b[_0x3482('0x40')],_0x59cec4);}else{return getUser(_0x2df438,null,_0x59cec4);}})[_0x3482('0x1e')](function(_0x1b9e86){_0xb1cda2=_0x1b9e86;return getEndUser(_0x2df438,_0x1c15dc,_0x1ba0db[_0x3482('0x4e')],_0x1ba0db[_0x3482('0x4f')],_0x59cec4);})[_0x3482('0x1e')](function(_0x45d84d){_0x49eb9f=_0x45d84d;return getTicket(_0x2df438,_0xb1cda2,_0x49eb9f,_0x1c15dc,_0x1ba0db,_0x1c15dc['Fields'],_0x59cec4);})[_0x3482('0x1e')](function(_0x1d4584){_0x54f583=_0x1d4584;logger[_0x3482('0x22')]('['+_0x1ba0db[_0x3482('0x69')][_0x3482('0x67')]()+_0x3482('0x6a'),_0x54f583['id']);logger[_0x3482('0x22')]('['+_0x1ba0db['lastevent'][_0x3482('0x67')]()+_0x3482('0x6b'),_0x2df438[_0x3482('0x38')]);})['catch'](function(_0x19d6b8){logger[_0x3482('0x5a')]('['+_0x1ba0db[_0x3482('0x69')][_0x3482('0x67')]()+']',JSON[_0x3482('0x5d')](_0x19d6b8));});}; \ No newline at end of file +var _0x9f99=['lead','Phone','Enduser\x20with\x20phone\x20%s\x20found.','Enduser\x20with\x20phone\x20%s\x20not\x20found.','format','Caller\x20-\x20%s','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','moduleCreate','No\x20Company','upperFirst','forEach','type','string','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','concat','https://login.salesforce.com','clientId','login','username','Connection\x20established.','serverUrl','remoteUri','stripTrailingSlash','recordingURL','uniqueid','email','calleridname','calleridnum','queue','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','newTab','%s/%s/e','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','[QUEUE]','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','Fields','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','trigger:browser:url','instanceUrl','Salesforce\x20account\x20type\x20not\x20recognized','stringify','unmanaged','monitor_format','toUpperCase','lastevent',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','bluebird','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','Task','assign','utc','getString','Subjects','Descriptions','WhoId','ticketType','Case','ContactId','sobject','isNil','validateEmail','User','find','execute','then','length','Email','info','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','Contact','Lead','contact'];(function(_0x47ccbb,_0x596840){var _0x393c9c=function(_0xae926a){while(--_0xae926a){_0x47ccbb['push'](_0x47ccbb['shift']());}};_0x393c9c(++_0x596840);}(_0x9f99,0x197));var _0x99f9=function(_0x546135,_0x336db2){_0x546135=_0x546135-0x0;var _0xb8d0ea=_0x9f99[_0x546135];return _0xb8d0ea;};'use strict';var _=require(_0x99f9('0x0'));var rp=require(_0x99f9('0x1'));var moment=require(_0x99f9('0x2'));var BPromise=require(_0x99f9('0x3'));var md5=require(_0x99f9('0x4'));var jsforce=require('jsforce');var util=require(_0x99f9('0x5'));var Redis=require(_0x99f9('0x6'));var intUtil=require(_0x99f9('0x7'));var config=require(_0x99f9('0x8'));var logger=require(_0x99f9('0x9'))('salesforce');config[_0x99f9('0xa')]=_[_0x99f9('0xb')](config[_0x99f9('0xa')],{'host':_0x99f9('0xc'),'port':0x18eb});var io=require(_0x99f9('0xd'))(new Redis(config['redis']));function emit(_0x40c9c7,_0x34fc8b,_0x468b1a){io['to'](_0x40c9c7)['emit'](_0x34fc8b,_0x468b1a);}function getTicket(_0x1d65fc,_0xa3610b,_0x30987d,_0x34e1c5,_0x4dc7a2,_0x14a0ee,_0xf1aa5b,_0x43bd17){var _0x248735={};if(_0x34e1c5['ticketType']===_0x99f9('0xe')){_0x248735=Object[_0x99f9('0xf')]({},{'OwnerId':_0xa3610b['id'],'ActivityDate':moment[_0x99f9('0x10')](),'IsReminderSet':![],'IsRecurrence':![],'Subject':intUtil[_0x99f9('0x11')](_0x34e1c5[_0x99f9('0x12')],_0x4dc7a2,'\x20'),'Description':intUtil['getString'](_0x34e1c5[_0x99f9('0x13')],_0x4dc7a2,'\x0a')},getCustomFields(_0x14a0ee,_0x4dc7a2));if(_0x30987d){_0x248735[_0x99f9('0x14')]=_0x30987d['id'];}}else if(_0x34e1c5[_0x99f9('0x15')]===_0x99f9('0x16')){_0x248735=Object[_0x99f9('0xf')]({},{'OwnerId':_0xa3610b['id'],'Subject':intUtil['getString'](_0x34e1c5[_0x99f9('0x12')],_0x4dc7a2,'\x20'),'Description':intUtil[_0x99f9('0x11')](_0x34e1c5[_0x99f9('0x13')],_0x4dc7a2,'\x0a')},getCustomFields(_0x14a0ee,_0x4dc7a2));if(_0x30987d){_0x248735[_0x99f9('0x17')]=_0x30987d['id'];}}return _0xf1aa5b[_0x99f9('0x18')](_0x34e1c5[_0x99f9('0x15')])['create'](_0x248735);}function getUser(_0x41974d,_0x446346,_0x4cc4ee){if(!_[_0x99f9('0x19')](_0x446346)&&intUtil[_0x99f9('0x1a')](_0x446346)){var _0x516592={'Email':_0x446346};var _0x428f19={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x4cc4ee[_0x99f9('0x18')](_0x99f9('0x1b'))[_0x99f9('0x1c')](_0x516592,_0x428f19)[_0x99f9('0x1d')]()[_0x99f9('0x1e')](function(_0x28e343){if(_0x28e343[_0x99f9('0x1f')]){var _0x13f0f7=_[_0x99f9('0x1c')](_0x28e343,function(_0x15f589){return _0x15f589[_0x99f9('0x20')]===_0x446346;});if(_0x13f0f7){logger[_0x99f9('0x21')]('Agent\x20%s\x20found.',_0x446346);return BPromise[_0x99f9('0x22')]({'id':_0x13f0f7['Id'],'name':_0x13f0f7[_0x99f9('0x23')]});}}else{logger[_0x99f9('0x21')](_0x99f9('0x24'),_0x446346);return _0x4cc4ee[_0x99f9('0x25')]()[_0x99f9('0x1e')](function(_0x326f31){return BPromise[_0x99f9('0x22')]({'id':_0x326f31[_0x99f9('0x26')],'name':_0x326f31[_0x99f9('0x27')]});});}});}else{logger[_0x99f9('0x21')](_0x99f9('0x24'),_0x446346);return _0x4cc4ee[_0x99f9('0x25')]()['then'](function(_0x4e66a2){return BPromise['resolve']({'id':_0x4e66a2[_0x99f9('0x26')],'name':_0x4e66a2['display_name']});});}}function getEndUser(_0x31a235,_0x264f5e,_0x16a5f6,_0x2181be,_0x29f6cd){var _0x380434={'Phone':_0x2181be};var _0x4b3ca1={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x99f9('0x22')]()[_0x99f9('0x1e')](function(){if(_0x264f5e['ticketType']===_0x99f9('0xe')){logger[_0x99f9('0x21')](_0x99f9('0x28'),_0x2181be,_0x264f5e[_0x99f9('0x29')]);switch(_0x264f5e[_0x99f9('0x29')]){case'contact_lead':return _0x29f6cd[_0x99f9('0x18')](_0x99f9('0x2a'))[_0x99f9('0x1c')](_0x380434,_0x4b3ca1)['execute']()[_0x99f9('0x1e')](function(_0x225ced){if(_0x225ced&&_0x225ced['length']){return _0x225ced;}else{return _0x29f6cd[_0x99f9('0x18')](_0x99f9('0x2b'))[_0x99f9('0x1c')](_0x380434,_0x4b3ca1);}});case _0x99f9('0x2c'):return _0x29f6cd['sobject'](_0x99f9('0x2a'))['find'](_0x380434,_0x4b3ca1)['execute']();case _0x99f9('0x2d'):return _0x29f6cd[_0x99f9('0x18')](_0x99f9('0x2b'))[_0x99f9('0x1c')](_0x380434,_0x4b3ca1);default:return null;}}else if(_0x264f5e[_0x99f9('0x15')]===_0x99f9('0x16')){logger['info'](_0x99f9('0x28'),_0x2181be,_0x99f9('0x2c'));return _0x29f6cd[_0x99f9('0x18')](_0x99f9('0x2a'))[_0x99f9('0x1c')](_0x380434,_0x4b3ca1)[_0x99f9('0x1d')]();}})[_0x99f9('0x1e')](function(_0x568a8a){if(_0x568a8a&&_0x568a8a[_0x99f9('0x1f')]){var _0x443608=_[_0x99f9('0x1c')](_0x568a8a,function(_0x1ed8e9){return _0x1ed8e9[_0x99f9('0x2e')]===_0x2181be;});if(_0x443608){return BPromise[_0x99f9('0x22')]({'id':_0x443608['Id'],'name':_0x443608[_0x99f9('0x23')],'phone':_0x443608[_0x99f9('0x2e')]});}}})[_0x99f9('0x1e')](function(_0xd91f89){if(_0xd91f89){logger[_0x99f9('0x21')](_0x99f9('0x2f'),_0x2181be);return BPromise[_0x99f9('0x22')](_0xd91f89);}else{logger[_0x99f9('0x21')](_0x99f9('0x30'),_0x2181be);var _0x2f77f9={'LastName':_0x16a5f6!==''?_0x16a5f6:util[_0x99f9('0x31')](_0x99f9('0x32'),_0x2181be),'Phone':_0x2181be};if(_0x264f5e['moduleCreate']){if(_0x264f5e['moduleCreate']===_0x99f9('0x2c')){logger['info'](_0x99f9('0x33'),_0x2181be,_0x264f5e[_0x99f9('0x34')]);}else if(_0x264f5e[_0x99f9('0x34')]==='lead'&&_0x264f5e['ticketType']===_0x99f9('0xe')){logger[_0x99f9('0x21')](_0x99f9('0x33'),_0x2181be,_0x264f5e[_0x99f9('0x34')]);_0x2f77f9['Company']=_0x99f9('0x35');}else{return null;}}return _0x29f6cd[_0x99f9('0x18')](_[_0x99f9('0x36')](_0x264f5e[_0x99f9('0x34')]))['create'](_0x2f77f9);}});}function getCustomFields(_0x3d2a30,_0x3b8455){var _0xb089a3={};if(_0x3d2a30['length']>0x0){_[_0x99f9('0x37')](_0x3d2a30,function(_0x5119e5){if(_0x5119e5[_0x99f9('0x38')]===_0x99f9('0x39')&&_0x5119e5[_0x99f9('0x3a')]){_0xb089a3[_0x5119e5[_0x99f9('0x3a')]]=_0x5119e5[_0x99f9('0x3b')][_0x99f9('0x3c')]();}else if(_0x5119e5['type']===_0x99f9('0x3d')&&_0x5119e5['variableName']&&_0x5119e5[_0x99f9('0x3a')]){_0x3b8455[_0x5119e5[_0x99f9('0x3e')]]&&(_0xb089a3[_0x5119e5[_0x99f9('0x3a')]]=_0x3b8455[_0x5119e5[_0x99f9('0x3e')]][_0x99f9('0x3c')]());}else if(_0x5119e5['type']===_0x99f9('0x3f')&&_0x5119e5[_0x99f9('0x40')]&&_0x5119e5['Variable'][_0x99f9('0x41')]&&_0x5119e5['idField']){_0x3b8455[_0x5119e5[_0x99f9('0x40')][_0x99f9('0x41')][_0x99f9('0x42')]()]&&(_0xb089a3[_0x5119e5[_0x99f9('0x3a')]]=_0x3b8455[_0x5119e5['Variable'][_0x99f9('0x41')][_0x99f9('0x42')]()][_0x99f9('0x3c')]());}});}return _0xb089a3;}function getConnection(_0x39da2f){var _0x570a8d=_0x39da2f['password'][_0x99f9('0x43')](_0x39da2f['securityToken']);var _0x5757df=new jsforce['Connection']({'oauth2':{'loginUrl':_0x39da2f['remoteUri']||_0x99f9('0x44'),'clientId':_0x39da2f[_0x99f9('0x45')],'clientSecret':_0x39da2f['clientSecret']}});return _0x5757df[_0x99f9('0x46')](_0x39da2f[_0x99f9('0x47')],_0x570a8d)[_0x99f9('0x1e')](function(){logger['info'](_0x99f9('0x48'));return _0x5757df;});}exports['queue']=function(_0x7b041a,_0x406171,_0x4c6ffb,_0x2b8ce3,_0x971360,_0x55431a){var _0x186b90,_0x170f45,_0x25e76,_0x21333c;_0x55431a['serverUrl']=intUtil['stripTrailingSlash'](_0x55431a[_0x99f9('0x49')]);_0x55431a[_0x99f9('0x4a')]=intUtil[_0x99f9('0x4b')](_0x55431a['remoteUri']);if(_0x971360&&_0x971360['monitor_format']){logger[_0x99f9('0x21')]('[QUEUE]','Recording\x20is\x20enabled!');_0x406171[_0x99f9('0x4c')]=util[_0x99f9('0x31')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x55431a[_0x99f9('0x49')],_0x406171[_0x99f9('0x4d')],md5(_0x406171['uniqueid']));}else{_0x406171[_0x99f9('0x4c')]='';}return getConnection(_0x55431a)['then'](function(_0x255777){_0x21333c=_0x255777;return getUser(_0x55431a,_0x2b8ce3[_0x99f9('0x4e')],_0x21333c);})['then'](function(_0x950055){_0x186b90=_0x950055;return getEndUser(_0x55431a,_0x4c6ffb,_0x406171[_0x99f9('0x4f')],_0x406171[_0x99f9('0x50')],_0x21333c);})['then'](function(_0x2e02cf){_0x170f45=_0x2e02cf;return getTicket(_0x55431a,_0x186b90,_0x170f45,_0x4c6ffb,_0x406171,_0x4c6ffb['Fields'],_0x21333c,_0x99f9('0x51'));})['then'](function(_0xb24d51){_0x25e76=_0xb24d51;logger['info'](_0x99f9('0x52'),_0x25e76['id']);logger['info'](_0x99f9('0x53'),_0x25e76['id'],_0x2b8ce3[_0x99f9('0x41')],_0x55431a[_0x99f9('0x38')]);switch(_0x55431a['type']){case _0x99f9('0x54'):emit(util[_0x99f9('0x31')](_0x99f9('0x55'),_0x2b8ce3['name']),'trigger:salesforce:display',{'recordId':_0x25e76['id']});break;case _0x99f9('0x56'):emit(util[_0x99f9('0x31')]('user:%s',_0x2b8ce3[_0x99f9('0x41')]),'trigger:browser:url',{'uri':util[_0x99f9('0x31')](_0x99f9('0x57'),_0x21333c['instanceUrl'],_0x25e76['id'])});break;default:logger[_0x99f9('0x58')](_0x99f9('0x59'));}})[_0x99f9('0x5a')](function(_0x278f9d){logger[_0x99f9('0x58')](_0x99f9('0x5b'),JSON['stringify'](_0x278f9d));});};exports[_0x99f9('0x5c')]=function(_0x58ce4e,_0x26805e,_0x2c42f9,_0xde74cc,_0x470d31,_0x1b695f,_0x3aa018){var _0x5712f0,_0x2c3cff,_0x365d82,_0x1f7dab;_0x1b695f['serverUrl']=intUtil['stripTrailingSlash'](_0x1b695f['serverUrl']);_0x1b695f[_0x99f9('0x4a')]=intUtil[_0x99f9('0x4b')](_0x1b695f[_0x99f9('0x4a')]);if(_0x3aa018&&_0x3aa018[_0x99f9('0x5d')]&&_0x3aa018[_0x99f9('0x5d')]!==_0x99f9('0x5e')){logger[_0x99f9('0x21')](_0x99f9('0x5f'),_0x99f9('0x60'));_0x26805e[_0x99f9('0x4c')]=util[_0x99f9('0x31')](_0x99f9('0x61'),_0x1b695f['serverUrl'],_0x26805e[_0x99f9('0x4d')],md5(_0x26805e[_0x99f9('0x4d')]));}return getConnection(_0x1b695f)[_0x99f9('0x1e')](function(_0x3320ed){_0x1f7dab=_0x3320ed;return getUser(_0x1b695f,_0xde74cc[_0x99f9('0x4e')],_0x1f7dab);})[_0x99f9('0x1e')](function(_0xf71dbb){_0x5712f0=_0xf71dbb;return getEndUser(_0x1b695f,_0x2c42f9,_0x26805e[_0x99f9('0x62')],_0x26805e[_0x99f9('0x63')],_0x1f7dab);})[_0x99f9('0x1e')](function(_0x593220){_0x2c3cff=_0x593220;return getTicket(_0x1b695f,_0x5712f0,_0x2c3cff,_0x2c42f9,_0x26805e,_0x2c42f9[_0x99f9('0x64')],_0x1f7dab,'outbound');})[_0x99f9('0x1e')](function(_0x41c7f9){_0x365d82=_0x41c7f9;logger[_0x99f9('0x21')](_0x99f9('0x65'),_0x365d82['id']);logger[_0x99f9('0x21')](_0x99f9('0x66'),_0x365d82['id'],_0xde74cc[_0x99f9('0x41')],_0x1b695f[_0x99f9('0x38')]);switch(_0x1b695f[_0x99f9('0x38')]){case _0x99f9('0x54'):emit(util[_0x99f9('0x31')]('user:%s',_0xde74cc[_0x99f9('0x41')]),'trigger:salesforce:display',{'recordId':_0x365d82['id']});break;case _0x99f9('0x56'):emit(util['format'](_0x99f9('0x55'),_0xde74cc[_0x99f9('0x41')]),_0x99f9('0x67'),{'uri':util[_0x99f9('0x31')](_0x99f9('0x57'),_0x1f7dab[_0x99f9('0x68')],_0x365d82['id'])});break;default:logger[_0x99f9('0x58')](_0x99f9('0x5f'),_0x99f9('0x69'));}})[_0x99f9('0x5a')](function(_0x3534c4){logger[_0x99f9('0x58')](_0x99f9('0x5f'),JSON[_0x99f9('0x6a')](_0x3534c4));});};exports[_0x99f9('0x6b')]=function(_0x58c264,_0x1eaf35,_0x1c7ffa,_0x5e2fcd,_0x2b4f41,_0xdd7e7c){var _0x50b2a8,_0x439c10,_0x15488a,_0x202da0;_0xdd7e7c[_0x99f9('0x49')]=intUtil['stripTrailingSlash'](_0xdd7e7c['serverUrl']);_0xdd7e7c['remoteUri']=intUtil['stripTrailingSlash'](_0xdd7e7c[_0x99f9('0x4a')]);if(_0x2b4f41&&_0x2b4f41[_0x99f9('0x6c')]){logger[_0x99f9('0x21')]('['+_0x1eaf35['lastevent'][_0x99f9('0x6d')]()+']',_0x99f9('0x60'));_0x1eaf35[_0x99f9('0x4c')]=util[_0x99f9('0x31')](_0x99f9('0x61'),_0xdd7e7c['serverUrl'],_0x1eaf35[_0x99f9('0x4d')],md5(_0x1eaf35['uniqueid']));}else{_0x1eaf35[_0x99f9('0x4c')]='';}return getConnection(_0xdd7e7c)[_0x99f9('0x1e')](function(_0x5542b2){_0x202da0=_0x5542b2;if(!_[_0x99f9('0x19')](_0x5e2fcd)){return getUser(_0xdd7e7c,_0x5e2fcd[_0x99f9('0x41')],_0x202da0);}else{return getUser(_0xdd7e7c,null,_0x202da0);}})['then'](function(_0x5d9b8c){_0x50b2a8=_0x5d9b8c;return getEndUser(_0xdd7e7c,_0x1c7ffa,_0x1eaf35[_0x99f9('0x4f')],_0x1eaf35[_0x99f9('0x50')],_0x202da0);})['then'](function(_0x17432c){_0x439c10=_0x17432c;return getTicket(_0xdd7e7c,_0x50b2a8,_0x439c10,_0x1c7ffa,_0x1eaf35,_0x1c7ffa['Fields'],_0x202da0);})[_0x99f9('0x1e')](function(_0x5687ef){_0x15488a=_0x5687ef;logger[_0x99f9('0x21')]('['+_0x1eaf35[_0x99f9('0x6e')][_0x99f9('0x6d')]()+_0x99f9('0x6f'),_0x15488a['id']);logger['info']('['+_0x1eaf35[_0x99f9('0x6e')][_0x99f9('0x6d')]()+_0x99f9('0x70'),_0xdd7e7c[_0x99f9('0x38')]);})['catch'](function(_0x281554){logger[_0x99f9('0x58')]('['+_0x1eaf35['lastevent'][_0x99f9('0x6d')]()+']',JSON[_0x99f9('0x6a')](_0x281554));});}; \ 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 d89bb07..cdf9d2e 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 _0x2ef3=['userEmail','GET','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','length','true','userId','adminEmail','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','user','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','type','nameField','customField','idField','toLowerCase','content','toString','variable','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','assign','getString','Subjects','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number','catch','label','?sysparm_query=name%3D','label_entry','Incident','push','all','Tags','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','format','emit','trigger:browser:url','username','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','isNil','calleridnum','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','recordingURL','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','call\x20direction:\x20%s',']\x20Error\x20running\x20ServiceNow\x20integration','lodash','bluebird','request-promise','util','md5','ioredis','../../../../config/environment','../../../../config/logger','redis','defaults','socket.io-emitter','sys_user?sysparm_query=user_name%3Dadmin','then','result','adminId','sys_id','toUpperCase','],\x20getAdminUser\x20crm','error','message','info','validateEmail'];(function(_0x35d4f4,_0x23bd5b){var _0x3c095f=function(_0x5ea2c6){while(--_0x5ea2c6){_0x35d4f4['push'](_0x35d4f4['shift']());}};_0x3c095f(++_0x23bd5b);}(_0x2ef3,0xba));var _0x32ef=function(_0x2b2990,_0x39232a){_0x2b2990=_0x2b2990-0x0;var _0x385d79=_0x2ef3[_0x2b2990];return _0x385d79;};'use strict';var _=require(_0x32ef('0x0'));var Promise=require(_0x32ef('0x1'));var rp=require(_0x32ef('0x2'));var util=require(_0x32ef('0x3'));var md5=require(_0x32ef('0x4'));var Redis=require(_0x32ef('0x5'));var intUtil=require('./util');var config=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('servicenow');config[_0x32ef('0x8')]=_[_0x32ef('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x32ef('0xa'))(new Redis(config[_0x32ef('0x8')]));function getAdminUser(_0x367c39,_0x2fb8eb,_0x234863,_0x298066,_0x2484a0,_0x2bbb50){return new Promise(function(_0x28275c,_0x77df79){var _0x56eb42={'method':'GET','uri':_0x298066+_0x32ef('0xb')+'&'+_0x2484a0+'&'+_0x2bbb50,'auth':_0x2fb8eb,'json':!![]};return rp(_0x56eb42)[_0x32ef('0xc')](function(_0x45bfd5){if(_0x45bfd5[_0x32ef('0xd')]['length']>0x0){_0x234863[_0x32ef('0xe')]=_0x45bfd5['result'][0x0][_0x32ef('0xf')];}logger['info']('['+[_0x367c39[_0x32ef('0x10')]()]+_0x32ef('0x11'),_0x234863);_0x28275c(_0x234863);})['catch'](function(_0x539d18){logger[_0x32ef('0x12')]('['+[_0x367c39['toUpperCase']()]+']',_0x539d18[_0x32ef('0x13')]);_0x77df79(_0x539d18[_0x32ef('0x13')]);});});}function getUser(_0x93d492,_0x54c7f5,_0x57aff1,_0x55bf0b,_0x531e30){return function(_0x13db1a){logger[_0x32ef('0x14')]('['+[_0x93d492[_0x32ef('0x10')]()]+'],\x20getUser\x20input\x20crm',_0x13db1a);return new Promise(function(_0x5d559b,_0x1eb468){if(intUtil[_0x32ef('0x15')](_0x13db1a[_0x32ef('0x16')])){var _0x57863c={'method':_0x32ef('0x17'),'uri':_0x57aff1+_0x32ef('0x18')+_0x13db1a['userEmail']+'&'+_0x55bf0b+'&'+_0x531e30,'auth':_0x54c7f5,'json':!![]};logger[_0x32ef('0x14')]('['+[_0x93d492[_0x32ef('0x10')]()]+_0x32ef('0x19'),_0x57863c);return rp(_0x57863c)[_0x32ef('0xc')](function(_0x445cda){logger[_0x32ef('0x14')]('['+[_0x93d492['toUpperCase']()]+_0x32ef('0x1a'),_0x445cda);if(_0x445cda['result'][_0x32ef('0x1b')]>0x0&&String(_0x445cda[_0x32ef('0xd')][0x0]['active'])===_0x32ef('0x1c')){_0x13db1a[_0x32ef('0x1d')]=_0x445cda[_0x32ef('0xd')][0x0]['sys_id'];}else{_0x13db1a['userId']=_0x13db1a[_0x32ef('0xe')];_0x13db1a[_0x32ef('0x16')]=_0x13db1a[_0x32ef('0x1e')];}logger['info']('['+[_0x93d492['toUpperCase']()]+_0x32ef('0x1f'),_0x13db1a);_0x5d559b(_0x13db1a);})['catch'](function(_0x51a412){logger[_0x32ef('0x12')]('['+[_0x93d492[_0x32ef('0x10')]()]+']',_0x51a412[_0x32ef('0x13')]);_0x1eb468(_0x51a412[_0x32ef('0x13')]);});}else{logger[_0x32ef('0x14')]('['+[_0x93d492[_0x32ef('0x10')]()]+_0x32ef('0x20'));_0x13db1a[_0x32ef('0x1d')]=_0x13db1a[_0x32ef('0xe')];_0x13db1a[_0x32ef('0x16')]=_0x13db1a[_0x32ef('0x1e')];_0x5d559b(_0x13db1a);}});};}function createEndUser(_0xba4b3f,_0x5a88a5,_0xd65fde,_0x2f5d06,_0x5a04cd){logger[_0x32ef('0x14')]('['+[_0xba4b3f[_0x32ef('0x10')]()]+_0x32ef('0x21'),_0xd65fde);return new Promise(function(_0x26e207,_0x50a95b){var _0x10e38c={'method':_0x32ef('0x22'),'uri':_0x2f5d06+_0x32ef('0x23')+_0x5a04cd,'body':{'user_name':_0xd65fde[_0x32ef('0x24')],'roles':_0x32ef('0x25'),'first_name':_0xd65fde[_0x32ef('0x24')],'active':_0x32ef('0x1c'),'date_format':'System','phone':_0xd65fde[_0x32ef('0x24')]},'auth':_0x5a88a5,'json':!![]};return rp(_0x10e38c)['then'](function(_0x38bf73){logger[_0x32ef('0x14')]('['+[_0xba4b3f['toUpperCase']()]+_0x32ef('0x26'),_0x38bf73[_0x32ef('0xd')]);_0xd65fde[_0x32ef('0x27')]=_0x38bf73[_0x32ef('0xd')][_0x32ef('0xf')];_0x26e207(_0xd65fde);})['catch'](function(_0x50ecd6){logger[_0x32ef('0x12')]('['+[_0xba4b3f['toUpperCase']()]+']',_0x50ecd6[_0x32ef('0x13')]);_0x50a95b(_0x50ecd6[_0x32ef('0x13')]);});});}function getEndUser(_0x2f1349,_0x390670,_0x389583,_0x22fa1a,_0x566b56){return function(_0x482d3a){logger['info']('['+[_0x2f1349[_0x32ef('0x10')]()]+_0x32ef('0x28'),_0x482d3a);return new Promise(function(_0x136b02,_0x5f2443){var _0x4fb402={'method':_0x32ef('0x17'),'uri':_0x389583+_0x32ef('0x29')+_0x482d3a[_0x32ef('0x24')]+'&'+_0x22fa1a+'&'+_0x566b56,'auth':_0x390670,'json':!![]};return rp(_0x4fb402)['then'](function(_0x4abbd6){if(_0x4abbd6[_0x32ef('0xd')][_0x32ef('0x1b')]>0x0){_0x482d3a[_0x32ef('0x27')]=_0x4abbd6[_0x32ef('0xd')][0x0][_0x32ef('0xf')];logger[_0x32ef('0x14')]('['+[_0x2f1349[_0x32ef('0x10')]()]+_0x32ef('0x2a'),_0x482d3a);_0x136b02(_0x482d3a);}else{return createEndUser(_0x2f1349,_0x390670,_0x482d3a,_0x389583,_0x22fa1a)[_0x32ef('0xc')](function(_0x4de939){logger[_0x32ef('0x14')]('['+[_0x2f1349[_0x32ef('0x10')]()]+_0x32ef('0x2b'),_0x4de939);_0x136b02(_0x4de939);});}})['catch'](function(_0x365125){logger[_0x32ef('0x12')]('['+[_0x2f1349[_0x32ef('0x10')]()]+']',_0x365125[_0x32ef('0x13')]);_0x5f2443(_0x365125[_0x32ef('0x13')]);});});};}function getCustomFields(_0x33a0fb,_0x256c40){var _0x1cebed={};if(_0x33a0fb[_0x32ef('0x1b')]>0x0){_[_0x32ef('0x2c')](_0x33a0fb,function(_0xb4db74){if(_0xb4db74[_0x32ef('0x2d')]==='string'&&_0xb4db74[_0x32ef('0x2e')]&&!_0xb4db74[_0x32ef('0x2f')]){_0x1cebed[_0xb4db74[_0x32ef('0x30')][_0x32ef('0x31')]()]=_0xb4db74[_0x32ef('0x32')][_0x32ef('0x33')]();}else if(_0xb4db74[_0x32ef('0x2d')]==='string'&&_0xb4db74['idField']&&_0xb4db74[_0x32ef('0x2f')]){_0x1cebed[_0xb4db74[_0x32ef('0x30')][_0x32ef('0x31')]()]=_0xb4db74[_0x32ef('0x32')]['toString']();}else if(_0xb4db74[_0x32ef('0x2d')]===_0x32ef('0x34')&&_0xb4db74['variableName']&&_0xb4db74[_0x32ef('0x30')]&&_0xb4db74['customField']){_0x1cebed[_0xb4db74[_0x32ef('0x30')][_0x32ef('0x31')]()]=_0x256c40[_0xb4db74[_0x32ef('0x35')]][_0x32ef('0x33')]();}else if(_0xb4db74[_0x32ef('0x2d')]===_0x32ef('0x36')&&_0xb4db74[_0x32ef('0x37')]&&_0xb4db74[_0x32ef('0x37')][_0x32ef('0x38')]&&_0xb4db74[_0x32ef('0x30')]&&_0xb4db74['customField']){_0x1cebed[_0xb4db74[_0x32ef('0x30')]['toLowerCase']()]=_0x256c40[_0xb4db74[_0x32ef('0x37')][_0x32ef('0x38')][_0x32ef('0x31')]()]['toString']();}});}return _0x1cebed;}function getTicket(_0x502113,_0x230ac9,_0x37b954,_0x241f82,_0x35b4e0,_0x40bf12){return function(_0x12c9e6){logger['info']('['+[_0x502113['toUpperCase']()]+_0x32ef('0x39'),_0x12c9e6);return new Promise(function(_0x270826,_0x27d65b){var _0x13b270=_0x502113[_0x32ef('0x31')]()===_0x32ef('0x3a')?_0x12c9e6[_0x32ef('0x1d')]:_0x12c9e6[_0x32ef('0x27')];var _0xc10e7={'method':_0x32ef('0x22'),'uri':_0x37b954+_0x32ef('0x3b')+'?'+_0x40bf12,'body':Object[_0x32ef('0x3c')]({},{'active':_0x32ef('0x1c'),'caller_id':_0x13b270,'assigned_to':_0x12c9e6['userId'],'short_description':intUtil[_0x32ef('0x3d')](_0x241f82[_0x32ef('0x3e')],_0x35b4e0,'\x20'),'description':intUtil[_0x32ef('0x3d')](_0x241f82[_0x32ef('0x3f')],_0x35b4e0,'\x0a')},getCustomFields(_0x241f82[_0x32ef('0x40')],_0x35b4e0)),'auth':_0x230ac9,'json':!![]};return rp(_0xc10e7)[_0x32ef('0xc')](function(_0x278696){logger[_0x32ef('0x14')]('['+[_0x502113[_0x32ef('0x10')]()]+_0x32ef('0x41'),_0x278696[_0x32ef('0xd')]);_0x12c9e6[_0x32ef('0x42')]=_0x278696[_0x32ef('0xd')][_0x32ef('0xf')];_0x12c9e6[_0x32ef('0x43')]=_0x278696[_0x32ef('0xd')][_0x32ef('0x44')];logger[_0x32ef('0x14')]('['+[_0x502113['toUpperCase']()]+']\x20getTicket\x20crm',_0x12c9e6);_0x270826(_0x12c9e6);})[_0x32ef('0x45')](function(_0x259c32){logger[_0x32ef('0x12')]('['+[_0x502113[_0x32ef('0x10')]()]+']',_0x259c32[_0x32ef('0x13')]);_0x27d65b(_0x259c32[_0x32ef('0x13')]);});});};}function createRemoteTag(_0x1572d9,_0x1f105a,_0x15b640,_0x368bf1){return new Promise(function(_0x3697a7,_0x4a6fd2){var _0x21216d={'method':_0x32ef('0x22'),'uri':_0x15b640+_0x32ef('0x46')+'?'+_0x368bf1,'body':{'short_description':_0x1572d9,'global':!![],'active':!![],'name':_0x1572d9},'auth':_0x1f105a,'json':!![]};return rp(_0x21216d)[_0x32ef('0xc')](function(_0x38314a){var _0x387cf0=_0x38314a['result'][_0x32ef('0xf')];_0x3697a7(_0x387cf0);});});}function getRemoteTag(_0x1eeb3e,_0x31d5d8,_0x56b7ce,_0x1b0faa,_0x52692a){return new Promise(function(_0x2ee3dd,_0xbe35b){var _0x579bc1={'method':_0x32ef('0x17'),'uri':_0x56b7ce+'label'+_0x32ef('0x47')+_0x1eeb3e+'&'+_0x1b0faa,'auth':_0x31d5d8,'json':!![]};return rp(_0x579bc1)[_0x32ef('0xc')](function(_0x2bff39){if(_0x2bff39[_0x32ef('0xd')][_0x32ef('0x1b')]>0x0){var _0x30e377=_0x2bff39[_0x32ef('0xd')][0x0]['sys_id'];_0x2ee3dd(_0x30e377);}else{return createRemoteTag(_0x1eeb3e,_0x31d5d8,_0x56b7ce,_0x1b0faa)['then'](function(_0xdfa103){_0x2ee3dd(_0xdfa103);});}});});}function assignTagToIncident(_0x52232a,_0x4fbab6,_0xb519e9,_0x89d0b3,_0x2ef0f8){return new Promise(function(_0x6aae59,_0x2468e6){var _0x356704={'method':_0x32ef('0x22'),'uri':_0xb519e9+_0x32ef('0x48')+'?'+_0x2ef0f8,'body':{'label':_0x52232a,'table':_0x32ef('0x3b'),'id_type':_0x32ef('0x49'),'table_key':_0x89d0b3['ticketId'],'title':'Incident\x20-\x20'+_0x89d0b3[_0x32ef('0x43')],'id_display':_0x89d0b3[_0x32ef('0x43')]},'auth':_0x4fbab6,'json':!![]};return rp(_0x356704)['then'](function(_0xda1d1){_0x6aae59();})[_0x32ef('0x45')](function(){_0x6aae59();});});}function manageTags(_0x2b5703,_0x49c245,_0x2ac877,_0x3c31d0,_0x20dcc5,_0x52dfe0,_0x5e6030){return new Promise(function(_0x13ea1a,_0x47d8bf){var _0x17f447=[];_0x49c245['forEach'](function(_0x58b652){_0x17f447[_0x32ef('0x4a')](getRemoteTag(_0x58b652,_0x2ac877,_0x3c31d0,_0x52dfe0,_0x5e6030));});return Promise[_0x32ef('0x4b')](_0x17f447)[_0x32ef('0xc')](function(_0x5dca6a){if(_0x5dca6a[_0x32ef('0x1b')]){logger[_0x32ef('0x14')]('['+[_0x2b5703[_0x32ef('0x10')]()]+']\x20arrayPromises:\x20IDs\x20in\x20table\x20label',_0x5dca6a);var _0x4557ce=[];_0x5dca6a[_0x32ef('0x2c')](function(_0x4c3bab){_0x4557ce['push'](assignTagToIncident(_0x4c3bab,_0x2ac877,_0x3c31d0,_0x20dcc5,_0x52dfe0));});return Promise[_0x32ef('0x4b')](_0x4557ce)[_0x32ef('0xc')](function(){_0x13ea1a();})[_0x32ef('0x45')](function(){_0x13ea1a();});}else{_0x13ea1a();}});});}function getTags(_0x339625,_0x4c4df8,_0x40700e,_0x4c89e8,_0x285330,_0x63b65){return function(_0x25b6d6){return new Promise(function(_0x36ed97,_0x21e930){var _0x340861=[];var _0x1dc755=_0x4c89e8[_0x32ef('0x4c')];if(_0x1dc755&&_0x1dc755[_0x32ef('0x1b')]>0x0){_0x340861=_['map'](_0x1dc755,_0x32ef('0x38'));}if(_0x340861[_0x32ef('0x1b')]>0x0){return manageTags(_0x339625,_0x340861,_0x4c4df8,_0x40700e,_0x25b6d6,_0x285330,_0x63b65)[_0x32ef('0xc')](function(){_0x36ed97(_0x25b6d6);});}else{_0x36ed97(_0x25b6d6);}});};}function emit(_0x1c629d,_0x79ae28,_0x5ad75c){var _0x47c0ed=_0x32ef('0x4d')+_0x32ef('0x4e')+_0x32ef('0x4f')+_0x32ef('0x50');var _0x1a8bad={'uri':_0x1c629d+'/nav_to.do?uri=incident.do?sys_id%3D'+_0x5ad75c+_0x47c0ed};io['to'](util[_0x32ef('0x51')]('user:%s',_0x79ae28))[_0x32ef('0x52')](_0x32ef('0x53'),_0x1a8bad);}exports['cs']=function(_0x48b6f4,_0x5402b4,_0x2c9f7a,_0x1538d0,_0x2e0873,_0x5b378b,_0x52b63b,_0x3b4a8e){var _0x5edd29={};var _0x7d2c3a={'user':_0x5b378b[_0x32ef('0x54')],'pass':_0x5b378b['password']};var _0x476bbf=_0x32ef('0x55');var _0x974974=_0x32ef('0x56');_0x5b378b[_0x32ef('0x57')]=intUtil[_0x32ef('0x58')](_0x5b378b[_0x32ef('0x57')]);_0x5b378b[_0x32ef('0x59')]=intUtil[_0x32ef('0x58')](_0x5b378b[_0x32ef('0x59')]);var _0x132d9f=util[_0x32ef('0x51')]('%s/api/now/table/',_0x5b378b['remoteUri']);_0x5edd29[_0x32ef('0x16')]=!_[_0x32ef('0x5a')](_0x1538d0)?_0x1538d0['email']:null;_0x5edd29[_0x32ef('0x1e')]=_0x5b378b['email'];_0x5edd29[_0x32ef('0x24')]=_0x3b4a8e[_0x32ef('0x31')]()===_0x32ef('0x3a')?_0x5402b4['destcalleridnum']:_0x5402b4[_0x32ef('0x5b')];_0x5edd29['callDirection']=_0x3b4a8e===_0x32ef('0x5c')||_0x3b4a8e===_0x32ef('0x5d')?'queue':'outbound';var _0x3c9039=util['format'](_0x32ef('0x5e'),_0x5b378b['serverUrl'],_0x5402b4[_0x32ef('0x5f')],md5(_0x5402b4[_0x32ef('0x5f')]));if(_0x2e0873&&_0x2e0873[_0x32ef('0x60')]){logger['info']('[QUEUE]','Recording\x20is\x20enabled!');_0x5402b4[_0x32ef('0x61')]=_0x3c9039;}else if(_0x52b63b&&_0x52b63b['recordingFormat']&&_0x52b63b[_0x32ef('0x62')]!==_0x32ef('0x63')){logger[_0x32ef('0x14')](_0x32ef('0x64'),_0x32ef('0x65'));_0x5402b4[_0x32ef('0x61')]=_0x3c9039;}else{_0x5402b4['recordingURL']='';}return getAdminUser(_0x3b4a8e,_0x7d2c3a,_0x5edd29,_0x132d9f,_0x974974,_0x476bbf)[_0x32ef('0xc')](getUser(_0x3b4a8e,_0x7d2c3a,_0x132d9f,_0x974974,_0x476bbf))['then'](getEndUser(_0x3b4a8e,_0x7d2c3a,_0x132d9f,_0x974974,_0x476bbf))['then'](getTicket(_0x3b4a8e,_0x7d2c3a,_0x132d9f,_0x2c9f7a,_0x5402b4,_0x974974))[_0x32ef('0xc')](function(_0x5c4f2a){logger[_0x32ef('0x14')](util[_0x32ef('0x51')]('The\x20ticket\x20ID\x20is:\x20%s',_0x5c4f2a[_0x32ef('0x42')]));logger[_0x32ef('0x14')](util[_0x32ef('0x51')](_0x32ef('0x66'),_0x3b4a8e));if(_0x3b4a8e!==_0x32ef('0x5d')){logger[_0x32ef('0x14')]('['+[_0x3b4a8e['toUpperCase']()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x5b378b[_0x32ef('0x57')],_0x1538d0['name'],_0x5c4f2a[_0x32ef('0x42')]);}})[_0x32ef('0x45')](function(_0x114d8e){logger[_0x32ef('0x12')]('['+[_0x3b4a8e[_0x32ef('0x10')]()]+_0x32ef('0x67'),util['inspect'](_0x114d8e,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x326f=['%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','inspect','lodash','util','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','socket.io-emitter','GET','then','result','adminId','sys_id','info','],\x20getAdminUser\x20crm','catch','error','message','toUpperCase','],\x20getUser\x20input\x20crm','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','length','userId','adminEmail','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','user','true','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','type','nameField','customField','idField','toLowerCase','toString','string','content','variable','variableName','Variable',']\x20getTicket\x20input\x20crm','outbound','incident','assign','getString','Subjects','Descriptions','ticketId','ticketNumber',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','Incident\x20-\x20','forEach','push','all','Tags','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','emit','password','sysparm_limit=1','sysparm_display_value=true','stripTrailingSlash','remoteUri','serverUrl','email','destcalleridnum','callDirection','queue','unmanaged'];(function(_0x5b1c50,_0x56e694){var _0x2d379b=function(_0x981b9c){while(--_0x981b9c){_0x5b1c50['push'](_0x5b1c50['shift']());}};_0x2d379b(++_0x56e694);}(_0x326f,0xd1));var _0xf326=function(_0x567b4c,_0x50bc7c){_0x567b4c=_0x567b4c-0x0;var _0x4ef6a0=_0x326f[_0x567b4c];return _0x4ef6a0;};'use strict';var _=require(_0xf326('0x0'));var Promise=require('bluebird');var rp=require('request-promise');var util=require(_0xf326('0x1'));var md5=require(_0xf326('0x2'));var Redis=require(_0xf326('0x3'));var intUtil=require(_0xf326('0x4'));var config=require(_0xf326('0x5'));var logger=require(_0xf326('0x6'))(_0xf326('0x7'));config[_0xf326('0x8')]=_[_0xf326('0x9')](config[_0xf326('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0xf326('0xa'))(new Redis(config[_0xf326('0x8')]));function getAdminUser(_0x165f95,_0x1e7b8a,_0x515bfa,_0x4c206c,_0x592975,_0x3bacf2){return new Promise(function(_0x1fc80e,_0x163416){var _0x2686e1={'method':_0xf326('0xb'),'uri':_0x4c206c+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0x592975+'&'+_0x3bacf2,'auth':_0x1e7b8a,'json':!![]};return rp(_0x2686e1)[_0xf326('0xc')](function(_0x53cbcd){if(_0x53cbcd[_0xf326('0xd')]['length']>0x0){_0x515bfa[_0xf326('0xe')]=_0x53cbcd['result'][0x0][_0xf326('0xf')];}logger[_0xf326('0x10')]('['+[_0x165f95['toUpperCase']()]+_0xf326('0x11'),_0x515bfa);_0x1fc80e(_0x515bfa);})[_0xf326('0x12')](function(_0x3504eb){logger[_0xf326('0x13')]('['+[_0x165f95['toUpperCase']()]+']',_0x3504eb[_0xf326('0x14')]);_0x163416(_0x3504eb['message']);});});}function getUser(_0x54bd1a,_0xdf21d9,_0x11f6d2,_0x1f2e5a,_0xa63d1a){return function(_0x292f4b){logger[_0xf326('0x10')]('['+[_0x54bd1a[_0xf326('0x15')]()]+_0xf326('0x16'),_0x292f4b);return new Promise(function(_0x5a682a,_0x3ad7da){if(intUtil[_0xf326('0x17')](_0x292f4b[_0xf326('0x18')])){var _0x31ffb9={'method':_0xf326('0xb'),'uri':_0x11f6d2+_0xf326('0x19')+_0x292f4b['userEmail']+'&'+_0x1f2e5a+'&'+_0xa63d1a,'auth':_0xdf21d9,'json':!![]};logger['info']('['+[_0x54bd1a['toUpperCase']()]+_0xf326('0x1a'),_0x31ffb9);return rp(_0x31ffb9)[_0xf326('0xc')](function(_0x484cbe){logger['info']('['+[_0x54bd1a[_0xf326('0x15')]()]+'],\x20getUser\x20entity',_0x484cbe);if(_0x484cbe['result'][_0xf326('0x1b')]>0x0&&String(_0x484cbe[_0xf326('0xd')][0x0]['active'])==='true'){_0x292f4b[_0xf326('0x1c')]=_0x484cbe[_0xf326('0xd')][0x0]['sys_id'];}else{_0x292f4b[_0xf326('0x1c')]=_0x292f4b[_0xf326('0xe')];_0x292f4b[_0xf326('0x18')]=_0x292f4b[_0xf326('0x1d')];}logger[_0xf326('0x10')]('['+[_0x54bd1a[_0xf326('0x15')]()]+'],\x20getUser\x20crm',_0x292f4b);_0x5a682a(_0x292f4b);})['catch'](function(_0x4f31f6){logger[_0xf326('0x13')]('['+[_0x54bd1a[_0xf326('0x15')]()]+']',_0x4f31f6[_0xf326('0x14')]);_0x3ad7da(_0x4f31f6[_0xf326('0x14')]);});}else{logger[_0xf326('0x10')]('['+[_0x54bd1a[_0xf326('0x15')]()]+']\x20using\x20admin\x20profile');_0x292f4b[_0xf326('0x1c')]=_0x292f4b[_0xf326('0xe')];_0x292f4b[_0xf326('0x18')]=_0x292f4b['adminEmail'];_0x5a682a(_0x292f4b);}});};}function createEndUser(_0x1617d2,_0x55ad0f,_0x4a9abf,_0x6a8e89,_0x1ae23a){logger[_0xf326('0x10')]('['+[_0x1617d2['toUpperCase']()]+_0xf326('0x1e'),_0x4a9abf);return new Promise(function(_0x292500,_0x55790d){var _0x225776={'method':_0xf326('0x1f'),'uri':_0x6a8e89+_0xf326('0x20')+_0x1ae23a,'body':{'user_name':_0x4a9abf[_0xf326('0x21')],'roles':_0xf326('0x22'),'first_name':_0x4a9abf[_0xf326('0x21')],'active':_0xf326('0x23'),'date_format':_0xf326('0x24'),'phone':_0x4a9abf[_0xf326('0x21')]},'auth':_0x55ad0f,'json':!![]};return rp(_0x225776)[_0xf326('0xc')](function(_0x4b52f2){logger[_0xf326('0x10')]('['+[_0x1617d2[_0xf326('0x15')]()]+_0xf326('0x25'),_0x4b52f2['result']);_0x4a9abf[_0xf326('0x26')]=_0x4b52f2[_0xf326('0xd')][_0xf326('0xf')];_0x292500(_0x4a9abf);})['catch'](function(_0x5b101d){logger[_0xf326('0x13')]('['+[_0x1617d2[_0xf326('0x15')]()]+']',_0x5b101d[_0xf326('0x14')]);_0x55790d(_0x5b101d[_0xf326('0x14')]);});});}function getEndUser(_0x30694f,_0x2e8a64,_0x62585a,_0x2d5f20,_0x580374){return function(_0x461e93){logger[_0xf326('0x10')]('['+[_0x30694f['toUpperCase']()]+_0xf326('0x27'),_0x461e93);return new Promise(function(_0x4e5d7c,_0xce1cbb){var _0x481b64={'method':'GET','uri':_0x62585a+_0xf326('0x28')+_0x461e93['endUserNumber']+'&'+_0x2d5f20+'&'+_0x580374,'auth':_0x2e8a64,'json':!![]};return rp(_0x481b64)[_0xf326('0xc')](function(_0x57aa27){if(_0x57aa27[_0xf326('0xd')][_0xf326('0x1b')]>0x0){_0x461e93[_0xf326('0x26')]=_0x57aa27['result'][0x0][_0xf326('0xf')];logger[_0xf326('0x10')]('['+[_0x30694f['toUpperCase']()]+_0xf326('0x29'),_0x461e93);_0x4e5d7c(_0x461e93);}else{return createEndUser(_0x30694f,_0x2e8a64,_0x461e93,_0x62585a,_0x2d5f20)[_0xf326('0xc')](function(_0x40fa7a){logger[_0xf326('0x10')]('['+[_0x30694f['toUpperCase']()]+_0xf326('0x2a'),_0x40fa7a);_0x4e5d7c(_0x40fa7a);});}})[_0xf326('0x12')](function(_0x1e69b1){logger[_0xf326('0x13')]('['+[_0x30694f[_0xf326('0x15')]()]+']',_0x1e69b1['message']);_0xce1cbb(_0x1e69b1[_0xf326('0x14')]);});});};}function getCustomFields(_0x1b7bf6,_0x5cfb97){var _0x4dd361={};if(_0x1b7bf6[_0xf326('0x1b')]>0x0){_['forEach'](_0x1b7bf6,function(_0x55dfa8){if(_0x55dfa8[_0xf326('0x2b')]==='string'&&_0x55dfa8[_0xf326('0x2c')]&&!_0x55dfa8[_0xf326('0x2d')]){_0x4dd361[_0x55dfa8[_0xf326('0x2e')][_0xf326('0x2f')]()]=_0x55dfa8['content'][_0xf326('0x30')]();}else if(_0x55dfa8[_0xf326('0x2b')]===_0xf326('0x31')&&_0x55dfa8[_0xf326('0x2e')]&&_0x55dfa8[_0xf326('0x2d')]){_0x4dd361[_0x55dfa8[_0xf326('0x2e')][_0xf326('0x2f')]()]=_0x55dfa8[_0xf326('0x32')][_0xf326('0x30')]();}else if(_0x55dfa8[_0xf326('0x2b')]===_0xf326('0x33')&&_0x55dfa8[_0xf326('0x34')]&&_0x55dfa8['idField']&&_0x55dfa8[_0xf326('0x2d')]){_0x4dd361[_0x55dfa8[_0xf326('0x2e')][_0xf326('0x2f')]()]=_0x5cfb97[_0x55dfa8[_0xf326('0x34')]][_0xf326('0x30')]();}else if(_0x55dfa8[_0xf326('0x2b')]==='customVariable'&&_0x55dfa8[_0xf326('0x35')]&&_0x55dfa8[_0xf326('0x35')]['name']&&_0x55dfa8[_0xf326('0x2e')]&&_0x55dfa8[_0xf326('0x2d')]){_0x4dd361[_0x55dfa8[_0xf326('0x2e')][_0xf326('0x2f')]()]=_0x5cfb97[_0x55dfa8[_0xf326('0x35')]['name']['toLowerCase']()][_0xf326('0x30')]();}});}return _0x4dd361;}function getTicket(_0x44e101,_0x5ed62e,_0x4bd865,_0x8e318d,_0x269e89,_0x21c98e){return function(_0x5b3705){logger[_0xf326('0x10')]('['+[_0x44e101[_0xf326('0x15')]()]+_0xf326('0x36'),_0x5b3705);return new Promise(function(_0xc43507,_0xc99be){var _0x2d9bba=_0x44e101[_0xf326('0x2f')]()===_0xf326('0x37')?_0x5b3705[_0xf326('0x1c')]:_0x5b3705[_0xf326('0x26')];var _0x1c76c8={'method':_0xf326('0x1f'),'uri':_0x4bd865+_0xf326('0x38')+'?'+_0x21c98e,'body':Object[_0xf326('0x39')]({},{'active':_0xf326('0x23'),'caller_id':_0x2d9bba,'assigned_to':_0x5b3705['userId'],'short_description':intUtil[_0xf326('0x3a')](_0x8e318d[_0xf326('0x3b')],_0x269e89,'\x20'),'description':intUtil[_0xf326('0x3a')](_0x8e318d[_0xf326('0x3c')],_0x269e89,'\x0a')},getCustomFields(_0x8e318d['Fields'],_0x269e89)),'auth':_0x5ed62e,'json':!![]};return rp(_0x1c76c8)[_0xf326('0xc')](function(_0x2f5511){logger[_0xf326('0x10')]('['+[_0x44e101[_0xf326('0x15')]()]+']\x20POST\x20incident\x20entity\x20schema',_0x2f5511[_0xf326('0xd')]);_0x5b3705[_0xf326('0x3d')]=_0x2f5511[_0xf326('0xd')][_0xf326('0xf')];_0x5b3705[_0xf326('0x3e')]=_0x2f5511['result']['number'];logger[_0xf326('0x10')]('['+[_0x44e101[_0xf326('0x15')]()]+_0xf326('0x3f'),_0x5b3705);_0xc43507(_0x5b3705);})['catch'](function(_0x102fba){logger[_0xf326('0x13')]('['+[_0x44e101[_0xf326('0x15')]()]+']',_0x102fba['message']);_0xc99be(_0x102fba['message']);});});};}function createRemoteTag(_0x36ef89,_0x5b4832,_0x1cf58f,_0x554277){return new Promise(function(_0x458e5f,_0x7ee57){var _0x28c959={'method':_0xf326('0x1f'),'uri':_0x1cf58f+_0xf326('0x40')+'?'+_0x554277,'body':{'short_description':_0x36ef89,'global':!![],'active':!![],'name':_0x36ef89},'auth':_0x5b4832,'json':!![]};return rp(_0x28c959)[_0xf326('0xc')](function(_0x7f7ece){var _0x495a16=_0x7f7ece[_0xf326('0xd')][_0xf326('0xf')];_0x458e5f(_0x495a16);});});}function getRemoteTag(_0x424d24,_0x4b0d8e,_0x208ba4,_0x3a832f,_0x3b8635){return new Promise(function(_0x16c578,_0x1159e){var _0x58fcf0={'method':_0xf326('0xb'),'uri':_0x208ba4+_0xf326('0x40')+_0xf326('0x41')+_0x424d24+'&'+_0x3a832f,'auth':_0x4b0d8e,'json':!![]};return rp(_0x58fcf0)[_0xf326('0xc')](function(_0x50690e){if(_0x50690e[_0xf326('0xd')][_0xf326('0x1b')]>0x0){var _0x227850=_0x50690e[_0xf326('0xd')][0x0]['sys_id'];_0x16c578(_0x227850);}else{return createRemoteTag(_0x424d24,_0x4b0d8e,_0x208ba4,_0x3a832f)['then'](function(_0x18b46e){_0x16c578(_0x18b46e);});}});});}function assignTagToIncident(_0x44d2ed,_0x55ca96,_0x3cf6fa,_0x29de71,_0x316609){return new Promise(function(_0x1258d1,_0x5765b0){var _0xb1c18c={'method':'POST','uri':_0x3cf6fa+'label_entry'+'?'+_0x316609,'body':{'label':_0x44d2ed,'table':_0xf326('0x38'),'id_type':'Incident','table_key':_0x29de71[_0xf326('0x3d')],'title':_0xf326('0x42')+_0x29de71[_0xf326('0x3e')],'id_display':_0x29de71['ticketNumber']},'auth':_0x55ca96,'json':!![]};return rp(_0xb1c18c)['then'](function(_0x1fd9c9){_0x1258d1();})[_0xf326('0x12')](function(){_0x1258d1();});});}function manageTags(_0x33b259,_0x5d0177,_0x2759d7,_0x487020,_0xe4a00d,_0x40929c,_0x131184){return new Promise(function(_0x217897,_0xbd3a01){var _0x18dbfc=[];_0x5d0177[_0xf326('0x43')](function(_0x3aeb20){_0x18dbfc[_0xf326('0x44')](getRemoteTag(_0x3aeb20,_0x2759d7,_0x487020,_0x40929c,_0x131184));});return Promise[_0xf326('0x45')](_0x18dbfc)[_0xf326('0xc')](function(_0x1e56fb){if(_0x1e56fb[_0xf326('0x1b')]){logger['info']('['+[_0x33b259[_0xf326('0x15')]()]+']\x20arrayPromises:\x20IDs\x20in\x20table\x20label',_0x1e56fb);var _0x6ac6=[];_0x1e56fb[_0xf326('0x43')](function(_0x5e858d){_0x6ac6[_0xf326('0x44')](assignTagToIncident(_0x5e858d,_0x2759d7,_0x487020,_0xe4a00d,_0x40929c));});return Promise['all'](_0x6ac6)[_0xf326('0xc')](function(){_0x217897();})[_0xf326('0x12')](function(){_0x217897();});}else{_0x217897();}});});}function getTags(_0x28f3cb,_0x2d45c9,_0x31b6dd,_0x51ff5e,_0x4ec099,_0x1209ca){return function(_0x32fe3a){return new Promise(function(_0x15a538,_0x21b3cc){var _0x1fc586=[];var _0x579d2c=_0x51ff5e[_0xf326('0x46')];if(_0x579d2c&&_0x579d2c[_0xf326('0x1b')]>0x0){_0x1fc586=_['map'](_0x579d2c,'name');}if(_0x1fc586['length']>0x0){return manageTags(_0x28f3cb,_0x1fc586,_0x2d45c9,_0x31b6dd,_0x32fe3a,_0x4ec099,_0x1209ca)[_0xf326('0xc')](function(){_0x15a538(_0x32fe3a);});}else{_0x15a538(_0x32fe3a);}});};}function emit(_0x7edf5,_0x4150fa,_0x235525){var _0x240ce5=_0xf326('0x47')+_0xf326('0x48')+'%26sysparm_record_list%3Dactive%253Dtrue'+_0xf326('0x49');var _0x588d26={'uri':_0x7edf5+_0xf326('0x4a')+_0x235525+_0x240ce5};io['to'](util[_0xf326('0x4b')]('user:%s',_0x4150fa))[_0xf326('0x4c')]('trigger:browser:url',_0x588d26);}exports['cs']=function(_0x499b59,_0x2dd9e4,_0x540fa0,_0x78ba34,_0x3411a4,_0x461059,_0x2ea5a2,_0x17cd36){var _0x541491={};var _0x4a053c={'user':_0x461059['username'],'pass':_0x461059[_0xf326('0x4d')]};var _0x307441=_0xf326('0x4e');var _0x180616=_0xf326('0x4f');_0x461059['remoteUri']=intUtil[_0xf326('0x50')](_0x461059[_0xf326('0x51')]);_0x461059[_0xf326('0x52')]=intUtil['stripTrailingSlash'](_0x461059['serverUrl']);var _0x830c9f=util[_0xf326('0x4b')]('%s/api/now/table/',_0x461059['remoteUri']);_0x541491[_0xf326('0x18')]=!_['isNil'](_0x78ba34)?_0x78ba34[_0xf326('0x53')]:null;_0x541491['adminEmail']=_0x461059['email'];_0x541491['endUserNumber']=_0x17cd36[_0xf326('0x2f')]()===_0xf326('0x37')?_0x2dd9e4[_0xf326('0x54')]:_0x2dd9e4['calleridnum'];_0x541491[_0xf326('0x55')]=_0x17cd36===_0xf326('0x56')||_0x17cd36===_0xf326('0x57')?_0xf326('0x56'):_0xf326('0x37');var _0x39e73d=util[_0xf326('0x4b')](_0xf326('0x58'),_0x461059[_0xf326('0x52')],_0x2dd9e4['uniqueid'],md5(_0x2dd9e4[_0xf326('0x59')]));if(_0x3411a4&&_0x3411a4['monitor_format']){logger[_0xf326('0x10')](_0xf326('0x5a'),_0xf326('0x5b'));_0x2dd9e4['recordingURL']=_0x39e73d;}else if(_0x2ea5a2&&_0x2ea5a2[_0xf326('0x5c')]&&_0x2ea5a2[_0xf326('0x5c')]!==_0xf326('0x5d')){logger['info'](_0xf326('0x5e'),_0xf326('0x5b'));_0x2dd9e4[_0xf326('0x5f')]=_0x39e73d;}else{_0x2dd9e4[_0xf326('0x5f')]='';}return getAdminUser(_0x17cd36,_0x4a053c,_0x541491,_0x830c9f,_0x180616,_0x307441)['then'](getUser(_0x17cd36,_0x4a053c,_0x830c9f,_0x180616,_0x307441))[_0xf326('0xc')](getEndUser(_0x17cd36,_0x4a053c,_0x830c9f,_0x180616,_0x307441))['then'](getTicket(_0x17cd36,_0x4a053c,_0x830c9f,_0x540fa0,_0x2dd9e4,_0x180616))['then'](function(_0x32d9c5){logger[_0xf326('0x10')](util['format']('The\x20ticket\x20ID\x20is:\x20%s',_0x32d9c5['ticketId']));logger[_0xf326('0x10')](util['format'](_0xf326('0x60'),_0x17cd36));if(_0x17cd36!==_0xf326('0x57')){logger[_0xf326('0x10')]('['+[_0x17cd36[_0xf326('0x15')]()]+']',_0xf326('0x61'));emit(_0x461059[_0xf326('0x51')],_0x78ba34['name'],_0x32d9c5[_0xf326('0x3d')]);}})[_0xf326('0x12')](function(_0x5f1724){logger['error']('['+[_0x17cd36[_0xf326('0x15')]()]+']\x20Error\x20running\x20ServiceNow\x20integration',util[_0xf326('0x62')](_0x5f1724,{'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 6a8ffab..7271ff7 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 _0x0adf=['../../../../config/environment','../../../../config/logger','sugarcrm','redis','socket.io-emitter','POST','emit','name','getString','assigned_user_id','created_by','date_start','slice','replace','duration_hours','duration_minutes','parent_id','Contacts','parent_name','direction','variableName','idField','set_entry','JSON','Calls','format','Basic\x20%s','apiKey','toString','get_server_info','stringify','isNil','info','Getting\x20agent\x20with\x20name','get_entry_list','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','length','find','entry_list','name_value_list','value','Agent\x20found!','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Caller\x20-\x20%s','Enduser\x20created.','first_name','debug','merge','map','forEach','type','string','nameField','customField','content','custom_fields','push','customVariable','Variable','toLowerCase','login','username','password','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','queue','remoteUri','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','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...','trigger:browser:url','catch','error','outbound','uri','%s/service/v4_1/rest.php','recordingFormat','[OUTBOUND]','destcalleridname','destcalleridnum','version','unmanaged','lastevent','toUpperCase','The\x20User\x20ID\x20is:','lodash','request-promise','bluebird','util','ioredis','./util'];(function(_0x28edbc,_0x180c07){var _0x4b665f=function(_0xb060ec){while(--_0xb060ec){_0x28edbc['push'](_0x28edbc['shift']());}};_0x4b665f(++_0x180c07);}(_0x0adf,0x1d2));var _0xf0ad=function(_0x42191b,_0x4865c8){_0x42191b=_0x42191b-0x0;var _0x56fcf3=_0x0adf[_0x42191b];return _0x56fcf3;};'use strict';var _=require(_0xf0ad('0x0'));var rp=require(_0xf0ad('0x1'));var BPromise=require(_0xf0ad('0x2'));var md5=require('md5');var util=require(_0xf0ad('0x3'));var Redis=require(_0xf0ad('0x4'));var intUtil=require(_0xf0ad('0x5'));var config=require(_0xf0ad('0x6'));var logger=require(_0xf0ad('0x7'))(_0xf0ad('0x8'));config[_0xf0ad('0x9')]=_['defaults'](config[_0xf0ad('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0xf0ad('0xa'))(new Redis(config[_0xf0ad('0x9')]));var def={'method':_0xf0ad('0xb'),'json':!![]};function emit(_0x41c99d,_0xa9a315,_0x3bc706){io['to'](_0x41c99d)[_0xf0ad('0xc')](_0xa9a315,_0x3bc706);}function getTicket(_0x5bdf69,_0x2ab4eb,_0x53c81a,_0x24db70,_0x1f2952,_0x43fb01,_0x2a5d0e,_0x3daf42){logger['info']('Creating\x20new\x20ticket...');var _0x13ed94=new Date();var _0x19892c=[{'name':_0xf0ad('0xd'),'value':intUtil[_0xf0ad('0xe')](_0x24db70['Subjects'],_0x1f2952,'\x20')},{'name':_0xf0ad('0xf'),'value':_0x2ab4eb['id']},{'name':_0xf0ad('0x10'),'value':_0x2ab4eb['id']},{'name':'description','value':intUtil['getString'](_0x24db70['Descriptions'],_0x1f2952,'\x0a')},{'name':_0xf0ad('0x11'),'value':_0x13ed94['toISOString']()[_0xf0ad('0x12')](0x0,0x13)[_0xf0ad('0x13')]('T','\x20')},{'name':_0xf0ad('0x14'),'value':'0'},{'name':_0xf0ad('0x15'),'value':'15'},{'name':_0xf0ad('0x16'),'value':_0x53c81a['id']},{'name':'parent_type','value':_0xf0ad('0x17')},{'name':_0xf0ad('0x18'),'value':_0x53c81a[_0xf0ad('0xd')]},{'name':_0xf0ad('0x19'),'value':_0x3daf42}];if(_0x43fb01['length']){_['forEach'](_0x43fb01,function(_0x2466e8){if(_0x1f2952[_0x2466e8[_0xf0ad('0x1a')]]){_0x19892c['push']({'name':_0x2466e8[_0xf0ad('0x1b')],'value':_0x1f2952[_0x2466e8[_0xf0ad('0x1a')]]});}});}return request({'form':{'method':_0xf0ad('0x1c'),'input_type':_0xf0ad('0x1d'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x2a5d0e['id'],'module_name':_0xf0ad('0x1e'),'name_value_list':_0x19892c})}});}function getAuth(_0x2da425){return util[_0xf0ad('0x1f')](_0xf0ad('0x20'),new Buffer(_0x2da425[_0xf0ad('0x21')]+':X')[_0xf0ad('0x22')]('base64'));}function getServerInfo(_0x33c95d){return request({'form':{'method':_0xf0ad('0x23'),'input_type':_0xf0ad('0x1d'),'response_type':_0xf0ad('0x1d'),'rest_data':JSON[_0xf0ad('0x24')]({'session':_0x33c95d['id']})}});}function getUser(_0x88b47b,_0xb91769,_0x276322){if(!_[_0xf0ad('0x25')](_0xb91769)){logger[_0xf0ad('0x26')](_0xf0ad('0x27'),_0xb91769);return request({'form':{'method':_0xf0ad('0x28'),'input_type':_0xf0ad('0x1d'),'response_type':_0xf0ad('0x1d'),'rest_data':JSON[_0xf0ad('0x24')]({'session':_0x276322['id'],'module_name':'Employees','query':util[_0xf0ad('0x1f')](_0xf0ad('0x29'),_0xb91769),'order_by':'','offset':'0','select_fields':['id',_0xf0ad('0xd'),_0xf0ad('0x2a')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xf0ad('0x2b')](function(_0x30f8ee){if(_0x30f8ee['entry_list'][_0xf0ad('0x2c')]){var _0x19a32a=_[_0xf0ad('0x2d')](_0x30f8ee[_0xf0ad('0x2e')],function(_0x1b6880){return _0x1b6880[_0xf0ad('0x2f')][_0xf0ad('0x2a')][_0xf0ad('0x30')]===_0xb91769;});if(_0x19a32a){logger[_0xf0ad('0x26')](_0xf0ad('0x31'));return BPromise[_0xf0ad('0x32')]({'id':_0x19a32a['name_value_list']['id'][_0xf0ad('0x30')],'name':_0x19a32a['name_value_list'][_0xf0ad('0xd')]['value']});}}logger[_0xf0ad('0x26')](_0xf0ad('0x33'));return BPromise[_0xf0ad('0x32')]({'id':_0x276322[_0xf0ad('0x2f')][_0xf0ad('0x34')][_0xf0ad('0x30')],'name':_0x276322[_0xf0ad('0x2f')][_0xf0ad('0x2a')]['value']});});}else{logger['info'](_0xf0ad('0x35'));return BPromise[_0xf0ad('0x32')]({'id':_0x276322[_0xf0ad('0x2f')][_0xf0ad('0x34')]['value'],'name':_0x276322[_0xf0ad('0x2f')]['user_name'][_0xf0ad('0x30')]});}}function getEndUser(_0x4c83c7,_0x4136b9,_0x4846b1,_0x3d9e48){logger[_0xf0ad('0x26')](_0xf0ad('0x36'),_0x4846b1);return request({'form':{'method':_0xf0ad('0x28'),'input_type':_0xf0ad('0x1d'),'response_type':_0xf0ad('0x1d'),'rest_data':JSON[_0xf0ad('0x24')]({'session':_0x3d9e48['id'],'module_name':_0xf0ad('0x17'),'query':util['format'](_0xf0ad('0x37'),_0x4846b1),'order_by':'','offset':'0','select_fields':['id','name',_0xf0ad('0x38')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x3f7e2b){if(_0x3f7e2b[_0xf0ad('0x2e')][_0xf0ad('0x2c')]){var _0x2eeb3f=_[_0xf0ad('0x2d')](_0x3f7e2b['entry_list'],function(_0x4721d3){return _0x4721d3[_0xf0ad('0x2f')][_0xf0ad('0x38')][_0xf0ad('0x30')]===_0x4846b1;});if(_0x2eeb3f){logger[_0xf0ad('0x26')](_0xf0ad('0x39'));return BPromise[_0xf0ad('0x32')]({'id':_0x2eeb3f['name_value_list']['id'][_0xf0ad('0x30')],'name':_0x2eeb3f[_0xf0ad('0x2f')][_0xf0ad('0xd')][_0xf0ad('0x30')],'phone':_0x2eeb3f[_0xf0ad('0x2f')][_0xf0ad('0x38')][_0xf0ad('0x30')]});}}else{logger[_0xf0ad('0x26')](_0xf0ad('0x3a'));return request({'form':{'method':'set_entry','input_type':_0xf0ad('0x1d'),'response_type':_0xf0ad('0x1d'),'rest_data':JSON[_0xf0ad('0x24')]({'session':_0x3d9e48['id'],'module_name':'Contacts','name_value_list':[{'name':'first_name','value':_0x4136b9!==''?_0x4136b9:util[_0xf0ad('0x1f')](_0xf0ad('0x3b'),_0x4846b1)},{'name':_0xf0ad('0x38'),'value':_0x4846b1}]})}})[_0xf0ad('0x2b')](function(_0x383633){logger[_0xf0ad('0x26')](_0xf0ad('0x3c'));return BPromise[_0xf0ad('0x32')]({'id':_0x383633['id'],'name':_0x383633[_0xf0ad('0x2e')][_0xf0ad('0x3d')][_0xf0ad('0x30')],'phone':_0x383633['entry_list']['phone_home']['value']});});}});}function request(_0x1c0609){logger[_0xf0ad('0x3e')]('[HTTP]',JSON[_0xf0ad('0x24')](_0x1c0609));return rp(_[_0xf0ad('0x3f')](def,_0x1c0609));}function getTags(_0x52438c,_0x29fc6b){var _0x2372bb=[];if(_0x52438c&&_0x52438c[_0xf0ad('0x2c')]>0x0){_0x2372bb=_[_0xf0ad('0x40')](_0x52438c,_0x29fc6b);}return _0x2372bb;}function getCustomFields(_0x50ede2,_0x33feab){var _0x10d58b=[];var _0x172e14={'custom_fields':[]};if(_0x50ede2[_0xf0ad('0x2c')]>0x0){_[_0xf0ad('0x41')](_0x50ede2,function(_0x317757){if(_0x317757[_0xf0ad('0x42')]===_0xf0ad('0x43')&&_0x317757[_0xf0ad('0x44')]&&!_0x317757[_0xf0ad('0x45')]){_0x172e14[_0x317757[_0xf0ad('0x44')]['toLowerCase']()]=_0x317757[_0xf0ad('0x46')][_0xf0ad('0x22')]();}else if(_0x317757[_0xf0ad('0x42')]==='string'&&_0x317757['idField']&&_0x317757[_0xf0ad('0x45')]){_0x172e14[_0xf0ad('0x47')][_0xf0ad('0x48')]({'id':_0x317757[_0xf0ad('0x1b')],'value':_0x317757[_0xf0ad('0x46')][_0xf0ad('0x22')]()});}else if(_0x317757[_0xf0ad('0x42')]==='variable'&&_0x317757[_0xf0ad('0x1a')]&&_0x317757['idField']&&_0x317757[_0xf0ad('0x45')]){_0x33feab[_0x317757[_0xf0ad('0x1a')]]&&_0x172e14[_0xf0ad('0x47')][_0xf0ad('0x48')]({'id':_0x317757[_0xf0ad('0x1b')],'value':_0x33feab[_0x317757['variableName']]['toString']()});}else if(_0x317757[_0xf0ad('0x42')]===_0xf0ad('0x49')&&_0x317757[_0xf0ad('0x4a')]&&_0x317757[_0xf0ad('0x4a')][_0xf0ad('0xd')]&&_0x317757[_0xf0ad('0x1b')]&&_0x317757[_0xf0ad('0x45')]){_0x33feab[_0x317757['Variable'][_0xf0ad('0xd')][_0xf0ad('0x4b')]()]&&_0x172e14[_0xf0ad('0x47')][_0xf0ad('0x48')]({'id':_0x317757[_0xf0ad('0x1b')],'value':_0x33feab[_0x317757['Variable'][_0xf0ad('0xd')][_0xf0ad('0x4b')]()][_0xf0ad('0x22')]()});}});}return _0x172e14;}function getConnection(_0x3b3b50){return request({'method':_0xf0ad('0xb'),'form':{'method':_0xf0ad('0x4c'),'input_type':_0xf0ad('0x1d'),'response_type':'JSON','rest_data':JSON[_0xf0ad('0x24')]({'user_auth':{'user_name':_0x3b3b50[_0xf0ad('0x4d')],'password':_0x3b3b50[_0xf0ad('0x4e')],'encryption':'PLAIN'},'application':_0xf0ad('0x4f')})}})[_0xf0ad('0x2b')](function(_0x2f2fae){var _0xc708ba=_0x2f2fae;if(_0xc708ba['id']){def[_0xf0ad('0x50')]=_0xc708ba['id'];return BPromise[_0xf0ad('0x32')](_0xc708ba);}else{throw new Error(util[_0xf0ad('0x1f')](_0xf0ad('0x51'),_0x3b3b50['id']));}});}function setRelationship(_0x7e2a23,_0x3d78a2,_0x273ba4,_0x55a261){return request({'form':{'method':'set_relationship','input_type':_0xf0ad('0x1d'),'response_type':_0xf0ad('0x1d'),'rest_data':JSON['stringify']({'session':_0x7e2a23['id'],'module_name':_0xf0ad('0x1e'),'module_id':_0x273ba4['id'],'link_field_name':_0x55a261,'related_ids':[_0x3d78a2['id']]})}});}exports[_0xf0ad('0x52')]=function(_0x57a83b,_0x4eb299,_0x326aa7,_0x529201,_0x4e00aa,_0x57d216){var _0x476853,_0x5aa270,_0x56c8aa,_0x16f29d;_0x57d216[_0xf0ad('0x53')]=intUtil[_0xf0ad('0x54')](_0x57d216[_0xf0ad('0x53')]);_0x57d216[_0xf0ad('0x55')]=intUtil[_0xf0ad('0x54')](_0x57d216[_0xf0ad('0x55')]);def['uri']=util[_0xf0ad('0x1f')]('%s/service/v4_1/rest.php',_0x57d216['remoteUri']);if(_0x4e00aa&&_0x4e00aa['monitor_format']){logger['info'](_0xf0ad('0x56'),_0xf0ad('0x57'));_0x4eb299[_0xf0ad('0x58')]=util[_0xf0ad('0x1f')](_0xf0ad('0x59'),_0x57d216[_0xf0ad('0x55')],_0x4eb299[_0xf0ad('0x5a')],md5(_0x4eb299[_0xf0ad('0x5a')]));}else{_0x4eb299[_0xf0ad('0x58')]='';}return getConnection(_0x57d216)[_0xf0ad('0x2b')](function(_0x3e5b8c){_0x16f29d=_0x3e5b8c;return getUser(_0x57d216,_0x529201['name'],_0x16f29d);})['then'](function(_0x2baccb){_0x476853=_0x2baccb;logger[_0xf0ad('0x26')]('The\x20User\x20ID\x20is:',_0x476853['id']);return getEndUser(_0x57d216,_0x4eb299[_0xf0ad('0x5b')],_0x4eb299[_0xf0ad('0x5c')],_0x16f29d);})['then'](function(_0xecfee9){_0x5aa270=_0xecfee9;logger[_0xf0ad('0x26')](_0xf0ad('0x5d'),_0x5aa270['id']);return getTicket(_0x57d216,_0x476853,_0x5aa270,_0x326aa7,_0x4eb299,_0x326aa7['Fields'],_0x16f29d,_0xf0ad('0x5e'));})[_0xf0ad('0x2b')](function(_0x384e2a){_0x56c8aa=_0x384e2a;logger[_0xf0ad('0x26')](_0xf0ad('0x5f'));logger[_0xf0ad('0x26')](_0xf0ad('0x60'),_0x56c8aa['id']);return setRelationship(_0x16f29d,_0x476853,_0x56c8aa,_0xf0ad('0x61'));})['then'](function(){return setRelationship(_0x16f29d,_0x5aa270,_0x56c8aa,_0xf0ad('0x62'));})['then'](function(){return getServerInfo(_0x16f29d);})[_0xf0ad('0x2b')](function(_0x83769d){var _0x1e59ab=parseInt(_0x83769d['version'][_0xf0ad('0x63')](0x0));var _0x5d1bc0=util[_0xf0ad('0x1f')](_0xf0ad('0x64'),_0x57d216[_0xf0ad('0x53')],_0x56c8aa['id']);if(_0x1e59ab>0x6){_0x5d1bc0=util[_0xf0ad('0x1f')](_0xf0ad('0x65'),_0x57d216[_0xf0ad('0x53')],_0x56c8aa['id']);}logger[_0xf0ad('0x26')]('[QUEUE]',_0xf0ad('0x66'));emit(util[_0xf0ad('0x1f')]('user:%s',_0x529201[_0xf0ad('0xd')]),_0xf0ad('0x67'),{'uri':_0x5d1bc0});})[_0xf0ad('0x68')](function(_0x2b8907){logger[_0xf0ad('0x69')](_0xf0ad('0x56'),JSON[_0xf0ad('0x24')](_0x2b8907));});};exports[_0xf0ad('0x6a')]=function(_0x8e1333,_0x3b56d3,_0x2463cd,_0x391eea,_0x47021c,_0x51eb6d,_0x19429d){var _0x3402b0,_0x46a4cd,_0x232c6b,_0x4e48df;_0x51eb6d[_0xf0ad('0x53')]=intUtil[_0xf0ad('0x54')](_0x51eb6d[_0xf0ad('0x53')]);_0x51eb6d['serverUrl']=intUtil[_0xf0ad('0x54')](_0x51eb6d['serverUrl']);def[_0xf0ad('0x6b')]=util[_0xf0ad('0x1f')](_0xf0ad('0x6c'),_0x51eb6d[_0xf0ad('0x53')]);if(_0x19429d&&_0x19429d['recordingFormat']&&_0x19429d[_0xf0ad('0x6d')]!=='none'){logger['info'](_0xf0ad('0x6e'),_0xf0ad('0x57'));_0x3b56d3[_0xf0ad('0x58')]=util[_0xf0ad('0x1f')](_0xf0ad('0x59'),_0x51eb6d['serverUrl'],_0x3b56d3['uniqueid'],md5(_0x3b56d3[_0xf0ad('0x5a')]));}return getConnection(_0x51eb6d)[_0xf0ad('0x2b')](function(_0xba7a26){_0x4e48df=_0xba7a26;return getUser(_0x51eb6d,_0x391eea[_0xf0ad('0xd')],_0x4e48df);})[_0xf0ad('0x2b')](function(_0x1d9e1f){_0x3402b0=_0x1d9e1f;logger[_0xf0ad('0x26')]('The\x20User\x20ID\x20is:',_0x3402b0['id']);return getEndUser(_0x51eb6d,_0x3b56d3[_0xf0ad('0x6f')],_0x3b56d3[_0xf0ad('0x70')],_0x4e48df);})[_0xf0ad('0x2b')](function(_0x2e247f){_0x46a4cd=_0x2e247f;logger[_0xf0ad('0x26')](_0xf0ad('0x5d'),_0x46a4cd['id']);return getTicket(_0x51eb6d,_0x3402b0,_0x46a4cd,_0x2463cd,_0x3b56d3,_0x2463cd['Fields'],_0x4e48df,'Outbound');})[_0xf0ad('0x2b')](function(_0x2bb959){_0x232c6b=_0x2bb959;logger[_0xf0ad('0x26')](_0xf0ad('0x5f'));logger['info'](_0xf0ad('0x60'),_0x232c6b['id']);return setRelationship(_0x4e48df,_0x3402b0,_0x232c6b,'users');})['then'](function(){return setRelationship(_0x4e48df,_0x46a4cd,_0x232c6b,_0xf0ad('0x62'));})['then'](function(){return getServerInfo(_0x4e48df);})[_0xf0ad('0x2b')](function(_0x54c72b){var _0x559e92=parseInt(_0x54c72b[_0xf0ad('0x71')][_0xf0ad('0x63')](0x0));var _0x3511a4=util[_0xf0ad('0x1f')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x51eb6d[_0xf0ad('0x53')],_0x232c6b['id']);if(_0x559e92>0x6){_0x3511a4=util[_0xf0ad('0x1f')](_0xf0ad('0x65'),_0x51eb6d['remoteUri'],_0x232c6b['id']);}logger['info']('[OUTBOUND]',_0xf0ad('0x66'));emit(util[_0xf0ad('0x1f')]('user:%s',_0x391eea[_0xf0ad('0xd')]),_0xf0ad('0x67'),{'uri':_0x3511a4});})[_0xf0ad('0x68')](function(_0x21710b){logger[_0xf0ad('0x69')](_0xf0ad('0x6e'),JSON[_0xf0ad('0x24')](_0x21710b));});};exports[_0xf0ad('0x72')]=function(_0x3bd86a,_0x56bda2,_0x244333,_0x30d0fd,_0x540124,_0x2cd0ce){var _0x2ec429,_0x13c804,_0xbc45c4,_0x20ad7b;_0x2cd0ce[_0xf0ad('0x53')]=intUtil[_0xf0ad('0x54')](_0x2cd0ce[_0xf0ad('0x53')]);_0x2cd0ce[_0xf0ad('0x55')]=intUtil[_0xf0ad('0x54')](_0x2cd0ce['serverUrl']);def[_0xf0ad('0x6b')]=util[_0xf0ad('0x1f')](_0xf0ad('0x6c'),_0x2cd0ce[_0xf0ad('0x53')]);if(_0x540124&&_0x540124['monitor_format']){logger[_0xf0ad('0x26')]('['+_0x56bda2[_0xf0ad('0x73')][_0xf0ad('0x74')]()+']',_0xf0ad('0x57'));_0x56bda2[_0xf0ad('0x58')]=util[_0xf0ad('0x1f')](_0xf0ad('0x59'),_0x2cd0ce[_0xf0ad('0x55')],_0x56bda2[_0xf0ad('0x5a')],md5(_0x56bda2[_0xf0ad('0x5a')]));}else{_0x56bda2['recordingURL']='';}return getConnection(_0x2cd0ce)[_0xf0ad('0x2b')](function(_0x2bdf7a){_0x20ad7b=_0x2bdf7a;if(!_['isNil'](_0x30d0fd)){return getUser(_0x2cd0ce,_0x30d0fd[_0xf0ad('0xd')],_0x20ad7b);}else{return getUser(_0x2cd0ce,null,_0x20ad7b);}})[_0xf0ad('0x2b')](function(_0x4e186e){_0x2ec429=_0x4e186e;logger[_0xf0ad('0x26')](_0xf0ad('0x75'),_0x2ec429['id']);return getEndUser(_0x2cd0ce,_0x56bda2[_0xf0ad('0x5b')],_0x56bda2[_0xf0ad('0x5c')],_0x20ad7b);})[_0xf0ad('0x2b')](function(_0x408bce){_0x13c804=_0x408bce;logger[_0xf0ad('0x26')](_0xf0ad('0x5d'),_0x13c804['id']);return getTicket(_0x2cd0ce,_0x2ec429,_0x13c804,_0x244333,_0x56bda2,_0x244333['Fields'],_0x20ad7b,_0xf0ad('0x5e'));})[_0xf0ad('0x2b')](function(_0x578631){_0xbc45c4=_0x578631;logger[_0xf0ad('0x26')](_0xf0ad('0x5f'));logger[_0xf0ad('0x26')](_0xf0ad('0x60'),_0xbc45c4['id']);return setRelationship(_0x20ad7b,_0x2ec429,_0xbc45c4,_0xf0ad('0x61'));})[_0xf0ad('0x2b')](function(){return setRelationship(_0x20ad7b,_0x13c804,_0xbc45c4,_0xf0ad('0x62'));})['then'](function(){return getServerInfo(_0x20ad7b);})[_0xf0ad('0x68')](function(_0x118ac2){logger['error']('['+_0x56bda2[_0xf0ad('0x73')][_0xf0ad('0x74')]()+']',JSON[_0xf0ad('0x24')](_0x118ac2));});}; \ No newline at end of file +var _0x15c6=['date_start','toISOString','slice','replace','duration_hours','parent_id','parent_type','Contacts','name','direction','length','forEach','variableName','push','idField','JSON','stringify','Calls','apiKey','base64','get_server_info','isNil','Getting\x20agent\x20with\x20name','get_entry_list','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','entry_list','name_value_list','value','Agent\x20found!','resolve','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','format','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','then','find','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','set_entry','first_name','','Caller\x20-\x20%s','Enduser\x20created.','debug','[HTTP]','merge','map','type','nameField','toLowerCase','toString','string','customField','custom_fields','content','variable','customVariable','Variable','login','password','PLAIN','xCALLY\x20Motion\x20integration','Account\x20%d\x20is\x20not\x20valid','set_relationship','remoteUri','stripTrailingSlash','serverUrl','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','%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','user:%s','trigger:browser:url','catch','outbound','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridnum','The\x20Enduser\x20ID\x20is:','Outbound','charAt','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','error','unmanaged','lastevent','toUpperCase','calleridname','Inbound','lodash','request-promise','bluebird','md5','util','ioredis','./util','../../../../config/environment','defaults','redis','localhost','POST','emit','info','Creating\x20new\x20ticket...','getString','Subjects','created_by','Descriptions'];(function(_0x243b59,_0x3f9495){var _0x3e1676=function(_0x354052){while(--_0x354052){_0x243b59['push'](_0x243b59['shift']());}};_0x3e1676(++_0x3f9495);}(_0x15c6,0x1cd));var _0x615c=function(_0x3cb86b,_0x3c75f6){_0x3cb86b=_0x3cb86b-0x0;var _0x3c10a0=_0x15c6[_0x3cb86b];return _0x3c10a0;};'use strict';var _=require(_0x615c('0x0'));var rp=require(_0x615c('0x1'));var BPromise=require(_0x615c('0x2'));var md5=require(_0x615c('0x3'));var util=require(_0x615c('0x4'));var Redis=require(_0x615c('0x5'));var intUtil=require(_0x615c('0x6'));var config=require(_0x615c('0x7'));var logger=require('../../../../config/logger')('sugarcrm');config['redis']=_[_0x615c('0x8')](config[_0x615c('0x9')],{'host':_0x615c('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x615c('0x9')]));var def={'method':_0x615c('0xb'),'json':!![]};function emit(_0x44642f,_0x7f7001,_0x483c5e){io['to'](_0x44642f)[_0x615c('0xc')](_0x7f7001,_0x483c5e);}function getTicket(_0x5dc15a,_0x3df139,_0x19f033,_0x2af037,_0x8f4a1e,_0x51f114,_0x5d1b1c,_0x2f5a17){logger[_0x615c('0xd')](_0x615c('0xe'));var _0xb88fd9=new Date();var _0x5a0c3e=[{'name':'name','value':intUtil[_0x615c('0xf')](_0x2af037[_0x615c('0x10')],_0x8f4a1e,'\x20')},{'name':'assigned_user_id','value':_0x3df139['id']},{'name':_0x615c('0x11'),'value':_0x3df139['id']},{'name':'description','value':intUtil['getString'](_0x2af037[_0x615c('0x12')],_0x8f4a1e,'\x0a')},{'name':_0x615c('0x13'),'value':_0xb88fd9[_0x615c('0x14')]()[_0x615c('0x15')](0x0,0x13)[_0x615c('0x16')]('T','\x20')},{'name':_0x615c('0x17'),'value':'0'},{'name':'duration_minutes','value':'15'},{'name':_0x615c('0x18'),'value':_0x19f033['id']},{'name':_0x615c('0x19'),'value':_0x615c('0x1a')},{'name':'parent_name','value':_0x19f033[_0x615c('0x1b')]},{'name':_0x615c('0x1c'),'value':_0x2f5a17}];if(_0x51f114[_0x615c('0x1d')]){_[_0x615c('0x1e')](_0x51f114,function(_0x1badec){if(_0x8f4a1e[_0x1badec[_0x615c('0x1f')]]){_0x5a0c3e[_0x615c('0x20')]({'name':_0x1badec[_0x615c('0x21')],'value':_0x8f4a1e[_0x1badec['variableName']]});}});}return request({'form':{'method':'set_entry','input_type':'JSON','response_type':_0x615c('0x22'),'rest_data':JSON[_0x615c('0x23')]({'session':_0x5d1b1c['id'],'module_name':_0x615c('0x24'),'name_value_list':_0x5a0c3e})}});}function getAuth(_0x146c58){return util['format']('Basic\x20%s',new Buffer(_0x146c58[_0x615c('0x25')]+':X')['toString'](_0x615c('0x26')));}function getServerInfo(_0x53638f){return request({'form':{'method':_0x615c('0x27'),'input_type':'JSON','response_type':_0x615c('0x22'),'rest_data':JSON[_0x615c('0x23')]({'session':_0x53638f['id']})}});}function getUser(_0x5d148b,_0x4cca36,_0x5bba2f){if(!_[_0x615c('0x28')](_0x4cca36)){logger[_0x615c('0xd')](_0x615c('0x29'),_0x4cca36);return request({'form':{'method':_0x615c('0x2a'),'input_type':'JSON','response_type':_0x615c('0x22'),'rest_data':JSON[_0x615c('0x23')]({'session':_0x5bba2f['id'],'module_name':'Employees','query':util['format'](_0x615c('0x2b'),_0x4cca36),'order_by':'','offset':'0','select_fields':['id',_0x615c('0x1b'),_0x615c('0x2c')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x32ce76){if(_0x32ce76[_0x615c('0x2d')][_0x615c('0x1d')]){var _0x63e725=_['find'](_0x32ce76[_0x615c('0x2d')],function(_0x174259){return _0x174259[_0x615c('0x2e')][_0x615c('0x2c')][_0x615c('0x2f')]===_0x4cca36;});if(_0x63e725){logger[_0x615c('0xd')](_0x615c('0x30'));return BPromise[_0x615c('0x31')]({'id':_0x63e725[_0x615c('0x2e')]['id'][_0x615c('0x2f')],'name':_0x63e725[_0x615c('0x2e')][_0x615c('0x1b')][_0x615c('0x2f')]});}}logger[_0x615c('0xd')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x615c('0x31')]({'id':_0x5bba2f[_0x615c('0x2e')][_0x615c('0x32')][_0x615c('0x2f')],'name':_0x5bba2f[_0x615c('0x2e')][_0x615c('0x2c')]['value']});});}else{logger[_0x615c('0xd')](_0x615c('0x33'));return BPromise[_0x615c('0x31')]({'id':_0x5bba2f[_0x615c('0x2e')][_0x615c('0x32')]['value'],'name':_0x5bba2f[_0x615c('0x2e')]['user_name'][_0x615c('0x2f')]});}}function getEndUser(_0x33349c,_0x1a5407,_0x248423,_0x14926e){logger[_0x615c('0xd')]('Searching\x20enduser\x20with\x20phone',_0x248423);return request({'form':{'method':_0x615c('0x2a'),'input_type':_0x615c('0x22'),'response_type':_0x615c('0x22'),'rest_data':JSON[_0x615c('0x23')]({'session':_0x14926e['id'],'module_name':_0x615c('0x1a'),'query':util[_0x615c('0x34')](_0x615c('0x35'),_0x248423),'order_by':'','offset':'0','select_fields':['id','name',_0x615c('0x36')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x615c('0x37')](function(_0x4163af){if(_0x4163af[_0x615c('0x2d')]['length']){var _0x253cc8=_[_0x615c('0x38')](_0x4163af[_0x615c('0x2d')],function(_0x4330ed){return _0x4330ed['name_value_list']['phone_home'][_0x615c('0x2f')]===_0x248423;});if(_0x253cc8){logger[_0x615c('0xd')](_0x615c('0x39'));return BPromise['resolve']({'id':_0x253cc8[_0x615c('0x2e')]['id'][_0x615c('0x2f')],'name':_0x253cc8[_0x615c('0x2e')][_0x615c('0x1b')]['value'],'phone':_0x253cc8['name_value_list'][_0x615c('0x36')]['value']});}}else{logger[_0x615c('0xd')](_0x615c('0x3a'));return request({'form':{'method':_0x615c('0x3b'),'input_type':'JSON','response_type':_0x615c('0x22'),'rest_data':JSON[_0x615c('0x23')]({'session':_0x14926e['id'],'module_name':_0x615c('0x1a'),'name_value_list':[{'name':_0x615c('0x3c'),'value':_0x1a5407!==_0x615c('0x3d')?_0x1a5407:util['format'](_0x615c('0x3e'),_0x248423)},{'name':_0x615c('0x36'),'value':_0x248423}]})}})['then'](function(_0x4d7ad5){logger['info'](_0x615c('0x3f'));return BPromise[_0x615c('0x31')]({'id':_0x4d7ad5['id'],'name':_0x4d7ad5['entry_list']['first_name'][_0x615c('0x2f')],'phone':_0x4d7ad5[_0x615c('0x2d')][_0x615c('0x36')][_0x615c('0x2f')]});});}});}function request(_0x1f1d55){logger[_0x615c('0x40')](_0x615c('0x41'),JSON[_0x615c('0x23')](_0x1f1d55));return rp(_[_0x615c('0x42')](def,_0x1f1d55));}function getTags(_0x43920f,_0x4b2a4b){var _0x38519c=[];if(_0x43920f&&_0x43920f[_0x615c('0x1d')]>0x0){_0x38519c=_[_0x615c('0x43')](_0x43920f,_0x4b2a4b);}return _0x38519c;}function getCustomFields(_0x4720f7,_0x50b756){var _0xde7342=[];var _0x441b41={'custom_fields':[]};if(_0x4720f7[_0x615c('0x1d')]>0x0){_[_0x615c('0x1e')](_0x4720f7,function(_0x33a4b3){if(_0x33a4b3[_0x615c('0x44')]==='string'&&_0x33a4b3[_0x615c('0x45')]&&!_0x33a4b3['customField']){_0x441b41[_0x33a4b3['nameField'][_0x615c('0x46')]()]=_0x33a4b3['content'][_0x615c('0x47')]();}else if(_0x33a4b3[_0x615c('0x44')]===_0x615c('0x48')&&_0x33a4b3[_0x615c('0x21')]&&_0x33a4b3[_0x615c('0x49')]){_0x441b41[_0x615c('0x4a')][_0x615c('0x20')]({'id':_0x33a4b3['idField'],'value':_0x33a4b3[_0x615c('0x4b')][_0x615c('0x47')]()});}else if(_0x33a4b3['type']===_0x615c('0x4c')&&_0x33a4b3[_0x615c('0x1f')]&&_0x33a4b3[_0x615c('0x21')]&&_0x33a4b3['customField']){_0x50b756[_0x33a4b3[_0x615c('0x1f')]]&&_0x441b41[_0x615c('0x4a')][_0x615c('0x20')]({'id':_0x33a4b3['idField'],'value':_0x50b756[_0x33a4b3[_0x615c('0x1f')]]['toString']()});}else if(_0x33a4b3[_0x615c('0x44')]===_0x615c('0x4d')&&_0x33a4b3[_0x615c('0x4e')]&&_0x33a4b3[_0x615c('0x4e')][_0x615c('0x1b')]&&_0x33a4b3['idField']&&_0x33a4b3[_0x615c('0x49')]){_0x50b756[_0x33a4b3[_0x615c('0x4e')]['name'][_0x615c('0x46')]()]&&_0x441b41['custom_fields'][_0x615c('0x20')]({'id':_0x33a4b3[_0x615c('0x21')],'value':_0x50b756[_0x33a4b3[_0x615c('0x4e')][_0x615c('0x1b')][_0x615c('0x46')]()][_0x615c('0x47')]()});}});}return _0x441b41;}function getConnection(_0x71a8d7){return request({'method':_0x615c('0xb'),'form':{'method':_0x615c('0x4f'),'input_type':'JSON','response_type':_0x615c('0x22'),'rest_data':JSON[_0x615c('0x23')]({'user_auth':{'user_name':_0x71a8d7['username'],'password':_0x71a8d7[_0x615c('0x50')],'encryption':_0x615c('0x51')},'application':_0x615c('0x52')})}})[_0x615c('0x37')](function(_0x132919){var _0x51b134=_0x132919;if(_0x51b134['id']){def['sessionID']=_0x51b134['id'];return BPromise[_0x615c('0x31')](_0x51b134);}else{throw new Error(util[_0x615c('0x34')](_0x615c('0x53'),_0x71a8d7['id']));}});}function setRelationship(_0x19fe59,_0xd02b68,_0x4015bc,_0x3900ba){return request({'form':{'method':_0x615c('0x54'),'input_type':_0x615c('0x22'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x19fe59['id'],'module_name':'Calls','module_id':_0x4015bc['id'],'link_field_name':_0x3900ba,'related_ids':[_0xd02b68['id']]})}});}exports['queue']=function(_0x119cfc,_0x4102ca,_0x42583c,_0x3ce3bc,_0x2de737,_0x404074){var _0xa8a088,_0x4c20f3,_0x174ba1,_0x26aaeb;_0x404074[_0x615c('0x55')]=intUtil[_0x615c('0x56')](_0x404074['remoteUri']);_0x404074[_0x615c('0x57')]=intUtil['stripTrailingSlash'](_0x404074['serverUrl']);def['uri']=util[_0x615c('0x34')](_0x615c('0x58'),_0x404074['remoteUri']);if(_0x2de737&&_0x2de737[_0x615c('0x59')]){logger[_0x615c('0xd')](_0x615c('0x5a'),'Recording\x20is\x20enabled!');_0x4102ca[_0x615c('0x5b')]=util[_0x615c('0x34')](_0x615c('0x5c'),_0x404074[_0x615c('0x57')],_0x4102ca[_0x615c('0x5d')],md5(_0x4102ca[_0x615c('0x5d')]));}else{_0x4102ca[_0x615c('0x5b')]='';}return getConnection(_0x404074)[_0x615c('0x37')](function(_0x2920c7){_0x26aaeb=_0x2920c7;return getUser(_0x404074,_0x3ce3bc[_0x615c('0x1b')],_0x26aaeb);})[_0x615c('0x37')](function(_0x1e1e5e){_0xa8a088=_0x1e1e5e;logger[_0x615c('0xd')](_0x615c('0x5e'),_0xa8a088['id']);return getEndUser(_0x404074,_0x4102ca['calleridname'],_0x4102ca['calleridnum'],_0x26aaeb);})['then'](function(_0x4b650a){_0x4c20f3=_0x4b650a;logger['info']('The\x20Enduser\x20ID\x20is:',_0x4c20f3['id']);return getTicket(_0x404074,_0xa8a088,_0x4c20f3,_0x42583c,_0x4102ca,_0x42583c[_0x615c('0x5f')],_0x26aaeb,'Inbound');})[_0x615c('0x37')](function(_0xc3d440){_0x174ba1=_0xc3d440;logger['info'](_0x615c('0x60'));logger['info'](_0x615c('0x61'),_0x174ba1['id']);return setRelationship(_0x26aaeb,_0xa8a088,_0x174ba1,_0x615c('0x62'));})[_0x615c('0x37')](function(){return setRelationship(_0x26aaeb,_0x4c20f3,_0x174ba1,_0x615c('0x63'));})[_0x615c('0x37')](function(){return getServerInfo(_0x26aaeb);})['then'](function(_0x7894b6){var _0x158bdf=parseInt(_0x7894b6['version']['charAt'](0x0));var _0x3c7ec0=util[_0x615c('0x34')](_0x615c('0x64'),_0x404074[_0x615c('0x55')],_0x174ba1['id']);if(_0x158bdf>0x6){_0x3c7ec0=util['format'](_0x615c('0x65'),_0x404074[_0x615c('0x55')],_0x174ba1['id']);}logger[_0x615c('0xd')](_0x615c('0x5a'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x615c('0x34')](_0x615c('0x66'),_0x3ce3bc[_0x615c('0x1b')]),_0x615c('0x67'),{'uri':_0x3c7ec0});})[_0x615c('0x68')](function(_0x44bcbd){logger['error']('[QUEUE]',JSON[_0x615c('0x23')](_0x44bcbd));});};exports[_0x615c('0x69')]=function(_0x40df4d,_0x29e5b7,_0x54be2d,_0x22c717,_0x272430,_0x88e48,_0x51edaf){var _0x14405d,_0x4a7fdd,_0x147281,_0x1341b2;_0x88e48['remoteUri']=intUtil[_0x615c('0x56')](_0x88e48['remoteUri']);_0x88e48[_0x615c('0x57')]=intUtil['stripTrailingSlash'](_0x88e48[_0x615c('0x57')]);def['uri']=util[_0x615c('0x34')](_0x615c('0x58'),_0x88e48[_0x615c('0x55')]);if(_0x51edaf&&_0x51edaf[_0x615c('0x6a')]&&_0x51edaf[_0x615c('0x6a')]!=='none'){logger['info'](_0x615c('0x6b'),_0x615c('0x6c'));_0x29e5b7[_0x615c('0x5b')]=util[_0x615c('0x34')](_0x615c('0x5c'),_0x88e48[_0x615c('0x57')],_0x29e5b7['uniqueid'],md5(_0x29e5b7[_0x615c('0x5d')]));}return getConnection(_0x88e48)[_0x615c('0x37')](function(_0x5aa1ba){_0x1341b2=_0x5aa1ba;return getUser(_0x88e48,_0x22c717['name'],_0x1341b2);})[_0x615c('0x37')](function(_0x565c50){_0x14405d=_0x565c50;logger[_0x615c('0xd')](_0x615c('0x5e'),_0x14405d['id']);return getEndUser(_0x88e48,_0x29e5b7['destcalleridname'],_0x29e5b7[_0x615c('0x6d')],_0x1341b2);})[_0x615c('0x37')](function(_0xa6fc68){_0x4a7fdd=_0xa6fc68;logger[_0x615c('0xd')](_0x615c('0x6e'),_0x4a7fdd['id']);return getTicket(_0x88e48,_0x14405d,_0x4a7fdd,_0x54be2d,_0x29e5b7,_0x54be2d['Fields'],_0x1341b2,_0x615c('0x6f'));})['then'](function(_0x5192cd){_0x147281=_0x5192cd;logger['info'](_0x615c('0x60'));logger['info'](_0x615c('0x61'),_0x147281['id']);return setRelationship(_0x1341b2,_0x14405d,_0x147281,_0x615c('0x62'));})[_0x615c('0x37')](function(){return setRelationship(_0x1341b2,_0x4a7fdd,_0x147281,'contacts');})[_0x615c('0x37')](function(){return getServerInfo(_0x1341b2);})[_0x615c('0x37')](function(_0x2c7380){var _0x8c235e=parseInt(_0x2c7380['version'][_0x615c('0x70')](0x0));var _0x5dc506=util[_0x615c('0x34')](_0x615c('0x64'),_0x88e48[_0x615c('0x55')],_0x147281['id']);if(_0x8c235e>0x6){_0x5dc506=util[_0x615c('0x34')](_0x615c('0x65'),_0x88e48[_0x615c('0x55')],_0x147281['id']);}logger[_0x615c('0xd')](_0x615c('0x6b'),_0x615c('0x71'));emit(util[_0x615c('0x34')](_0x615c('0x66'),_0x22c717[_0x615c('0x1b')]),_0x615c('0x67'),{'uri':_0x5dc506});})[_0x615c('0x68')](function(_0x5ccb7c){logger[_0x615c('0x72')](_0x615c('0x6b'),JSON['stringify'](_0x5ccb7c));});};exports[_0x615c('0x73')]=function(_0x1a0410,_0xe11482,_0x20c489,_0x237db3,_0x30280,_0x43c84e){var _0x5202c4,_0x55f96f,_0x272247,_0xf345a;_0x43c84e[_0x615c('0x55')]=intUtil[_0x615c('0x56')](_0x43c84e[_0x615c('0x55')]);_0x43c84e[_0x615c('0x57')]=intUtil[_0x615c('0x56')](_0x43c84e[_0x615c('0x57')]);def['uri']=util[_0x615c('0x34')](_0x615c('0x58'),_0x43c84e[_0x615c('0x55')]);if(_0x30280&&_0x30280[_0x615c('0x59')]){logger[_0x615c('0xd')]('['+_0xe11482[_0x615c('0x74')][_0x615c('0x75')]()+']',_0x615c('0x6c'));_0xe11482[_0x615c('0x5b')]=util[_0x615c('0x34')](_0x615c('0x5c'),_0x43c84e[_0x615c('0x57')],_0xe11482[_0x615c('0x5d')],md5(_0xe11482[_0x615c('0x5d')]));}else{_0xe11482['recordingURL']='';}return getConnection(_0x43c84e)[_0x615c('0x37')](function(_0x4f1bbc){_0xf345a=_0x4f1bbc;if(!_['isNil'](_0x237db3)){return getUser(_0x43c84e,_0x237db3[_0x615c('0x1b')],_0xf345a);}else{return getUser(_0x43c84e,null,_0xf345a);}})[_0x615c('0x37')](function(_0x19e3cf){_0x5202c4=_0x19e3cf;logger[_0x615c('0xd')](_0x615c('0x5e'),_0x5202c4['id']);return getEndUser(_0x43c84e,_0xe11482[_0x615c('0x76')],_0xe11482['calleridnum'],_0xf345a);})[_0x615c('0x37')](function(_0x3336be){_0x55f96f=_0x3336be;logger[_0x615c('0xd')](_0x615c('0x6e'),_0x55f96f['id']);return getTicket(_0x43c84e,_0x5202c4,_0x55f96f,_0x20c489,_0xe11482,_0x20c489['Fields'],_0xf345a,_0x615c('0x77'));})[_0x615c('0x37')](function(_0x5eb7a2){_0x272247=_0x5eb7a2;logger['info'](_0x615c('0x60'));logger[_0x615c('0xd')](_0x615c('0x61'),_0x272247['id']);return setRelationship(_0xf345a,_0x5202c4,_0x272247,_0x615c('0x62'));})[_0x615c('0x37')](function(){return setRelationship(_0xf345a,_0x55f96f,_0x272247,_0x615c('0x63'));})['then'](function(){return getServerInfo(_0xf345a);})[_0x615c('0x68')](function(_0x2b5f86){logger[_0x615c('0x72')]('['+_0xe11482[_0x615c('0x74')][_0x615c('0x75')]()+']',JSON[_0x615c('0x23')](_0x2b5f86));});}; \ 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 087594a..eeda245 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 _0xa078=['stripTrailingSlash','substring','validateEmail','isNil','test','getString','length','sortBy','type','string','push','content','variableName','toString','Variable','name','toLowerCase','keyValue','keyType','key','format','%s:\x20%s','keyContent','variable','customVariable'];(function(_0x1b1520,_0x393506){var _0x8092cb=function(_0x329b22){while(--_0x329b22){_0x1b1520['push'](_0x1b1520['shift']());}};_0x8092cb(++_0x393506);}(_0xa078,0x9b));var _0x8a07=function(_0x18a613,_0x5a62a3){_0x18a613=_0x18a613-0x0;var _0x2e9268=_0xa078[_0x18a613];return _0x2e9268;};'use strict';var _=require('lodash');var util=require('util');exports[_0x8a07('0x0')]=function(_0x4d7501,_0x4a7958,_0x29ac00){var _0x38f16e=[];if(_0x4d7501[_0x8a07('0x1')]>0x0){var _0x1b8d2c=_[_0x8a07('0x2')](_0x4d7501,['id']);for(var _0x4fa670=0x0;_0x4fa670<_0x1b8d2c[_0x8a07('0x1')];_0x4fa670++){var _0xa3fa5=_0x1b8d2c[_0x4fa670];if(_0xa3fa5[_0x8a07('0x3')]===_0x8a07('0x4')){_0x38f16e[_0x8a07('0x5')](_0xa3fa5[_0x8a07('0x6')]);}else if(_0xa3fa5['type']==='variable'&&_0xa3fa5[_0x8a07('0x7')]){_0x4a7958[_0xa3fa5[_0x8a07('0x7')]]&&_0x38f16e['push'](_0x4a7958[_0xa3fa5['variableName']][_0x8a07('0x8')]());}else if(_0xa3fa5[_0x8a07('0x3')]==='customVariable'&&_0xa3fa5[_0x8a07('0x9')]&&_0xa3fa5['Variable'][_0x8a07('0xa')]){_0x4a7958[_0xa3fa5['Variable']['name'][_0x8a07('0xb')]()]&&_0x38f16e[_0x8a07('0x5')](_0x4a7958[_0xa3fa5['Variable'][_0x8a07('0xa')][_0x8a07('0xb')]()][_0x8a07('0x8')]());}else if(_0xa3fa5[_0x8a07('0x3')]===_0x8a07('0xc')){if(_0xa3fa5[_0x8a07('0xd')]===_0x8a07('0x4')&&_0xa3fa5[_0x8a07('0xe')]){_0x38f16e['push'](util[_0x8a07('0xf')](_0x8a07('0x10'),_0xa3fa5[_0x8a07('0xe')],_0xa3fa5[_0x8a07('0x11')]));}else if(_0xa3fa5[_0x8a07('0xd')]===_0x8a07('0x12')&&_0xa3fa5[_0x8a07('0x7')]&&_0xa3fa5[_0x8a07('0xe')]){_0x4a7958[_0xa3fa5[_0x8a07('0x7')]]&&_0x38f16e['push'](util[_0x8a07('0xf')](_0x8a07('0x10'),_0xa3fa5[_0x8a07('0xe')],_0x4a7958[_0xa3fa5[_0x8a07('0x7')]]));}else if(_0xa3fa5[_0x8a07('0xd')]===_0x8a07('0x13')&&_0xa3fa5[_0x8a07('0x9')]&&_0xa3fa5[_0x8a07('0x9')]['name']&&_0xa3fa5[_0x8a07('0xe')]){_0x4a7958[_0xa3fa5['Variable']['name'][_0x8a07('0xb')]()]&&_0x38f16e[_0x8a07('0x5')](util[_0x8a07('0xf')](_0x8a07('0x10'),_0xa3fa5[_0x8a07('0xe')],_0x4a7958[_0xa3fa5[_0x8a07('0x9')]['name'][_0x8a07('0xb')]()]));}}}}return _0x38f16e['join'](_0x29ac00);};exports[_0x8a07('0x14')]=function(_0x4c48a3){var _0x365499=_0x4c48a3['slice'](-0x1);if(_0x365499==='/'){_0x4c48a3=_0x4c48a3[_0x8a07('0x15')](0x0,_0x4c48a3['lastIndexOf'](_0x365499));}return _0x4c48a3;};exports[_0x8a07('0x16')]=function(_0x46fe0f){if(!_[_0x8a07('0x17')](_0x46fe0f)&&_0x46fe0f!==''){var _0x48d09a=/^(([^<>()\[\]\\.,;:\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 _0x48d09a[_0x8a07('0x18')](String(_0x46fe0f)['toLowerCase']());}else{return![];}}; \ No newline at end of file +var _0x1532=['content','variable','variableName','customVariable','Variable','name','toLowerCase','keyValue','keyType','key','format','%s:\x20%s','keyContent','join','slice','substring','validateEmail','isNil','test','lodash','util','sortBy','length','type','string','push'];(function(_0xa50c39,_0x57e569){var _0x20831d=function(_0x16adf0){while(--_0x16adf0){_0xa50c39['push'](_0xa50c39['shift']());}};_0x20831d(++_0x57e569);}(_0x1532,0x17f));var _0x2153=function(_0x2c0ffc,_0x4b2b53){_0x2c0ffc=_0x2c0ffc-0x0;var _0x41c26e=_0x1532[_0x2c0ffc];return _0x41c26e;};'use strict';var _=require(_0x2153('0x0'));var util=require(_0x2153('0x1'));exports['getString']=function(_0x56e68a,_0x4066f,_0x13e4aa){var _0x305f89=[];if(_0x56e68a['length']>0x0){var _0xe9f0e8=_[_0x2153('0x2')](_0x56e68a,['id']);for(var _0x180d99=0x0;_0x180d99<_0xe9f0e8[_0x2153('0x3')];_0x180d99++){var _0x28d715=_0xe9f0e8[_0x180d99];if(_0x28d715[_0x2153('0x4')]===_0x2153('0x5')){_0x305f89[_0x2153('0x6')](_0x28d715[_0x2153('0x7')]);}else if(_0x28d715[_0x2153('0x4')]===_0x2153('0x8')&&_0x28d715[_0x2153('0x9')]){_0x4066f[_0x28d715[_0x2153('0x9')]]&&_0x305f89[_0x2153('0x6')](_0x4066f[_0x28d715['variableName']]['toString']());}else if(_0x28d715[_0x2153('0x4')]===_0x2153('0xa')&&_0x28d715[_0x2153('0xb')]&&_0x28d715[_0x2153('0xb')][_0x2153('0xc')]){_0x4066f[_0x28d715['Variable'][_0x2153('0xc')][_0x2153('0xd')]()]&&_0x305f89['push'](_0x4066f[_0x28d715[_0x2153('0xb')][_0x2153('0xc')][_0x2153('0xd')]()]['toString']());}else if(_0x28d715[_0x2153('0x4')]===_0x2153('0xe')){if(_0x28d715[_0x2153('0xf')]===_0x2153('0x5')&&_0x28d715[_0x2153('0x10')]){_0x305f89[_0x2153('0x6')](util[_0x2153('0x11')](_0x2153('0x12'),_0x28d715[_0x2153('0x10')],_0x28d715[_0x2153('0x13')]));}else if(_0x28d715[_0x2153('0xf')]===_0x2153('0x8')&&_0x28d715[_0x2153('0x9')]&&_0x28d715[_0x2153('0x10')]){_0x4066f[_0x28d715[_0x2153('0x9')]]&&_0x305f89['push'](util[_0x2153('0x11')]('%s:\x20%s',_0x28d715[_0x2153('0x10')],_0x4066f[_0x28d715[_0x2153('0x9')]]));}else if(_0x28d715[_0x2153('0xf')]===_0x2153('0xa')&&_0x28d715[_0x2153('0xb')]&&_0x28d715[_0x2153('0xb')][_0x2153('0xc')]&&_0x28d715['key']){_0x4066f[_0x28d715[_0x2153('0xb')][_0x2153('0xc')][_0x2153('0xd')]()]&&_0x305f89['push'](util['format'](_0x2153('0x12'),_0x28d715[_0x2153('0x10')],_0x4066f[_0x28d715[_0x2153('0xb')]['name'][_0x2153('0xd')]()]));}}}}return _0x305f89[_0x2153('0x14')](_0x13e4aa);};exports['stripTrailingSlash']=function(_0x554e36){var _0x2c23ff=_0x554e36[_0x2153('0x15')](-0x1);if(_0x2c23ff==='/'){_0x554e36=_0x554e36[_0x2153('0x16')](0x0,_0x554e36['lastIndexOf'](_0x2c23ff));}return _0x554e36;};exports[_0x2153('0x17')]=function(_0x561495){if(!_[_0x2153('0x18')](_0x561495)&&_0x561495!==''){var _0x37a763=/^(([^<>()\[\]\\.,;:\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 _0x37a763[_0x2153('0x19')](String(_0x561495)[_0x2153('0xd')]());}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 0b838f6..befa341 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 _0x64d7=['Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','outbound','recordingFormat','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','email','destcalleridname','destcalleridnum','Fields','user:%s','unmanaged','lastevent','toUpperCase','calleridnum','Ticket\x20created!','lodash','request-promise','md5','util','ioredis','./util','../../../../config/logger','vTiger','defaults','localhost','socket.io-emitter','emit','length','type','idField','content','toString','variable','variableName','customVariable','name','Variable','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','getString','Subjects','Descriptions','POST','%s/webservice.php','username','sessionName','HelpDesk','stringify','then','result','format','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','error','catch','statusCode','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','validateEmail','Getting\x20agent\x20with\x20email','GET','remoteUri','query','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','Agent\x20found!','email1','first_name','last_name','resolve','userId','admin','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Searching\x20end\x20user\x20with\x20phone','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','phone','getEndUser','accessKey','token','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','stripTrailingSlash','monitor_format','Recording\x20is\x20enabled!','recordingURL','serverUrl','uniqueid','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','[QUEUE]'];(function(_0x39b4bd,_0x4e355f){var _0x502467=function(_0x232c3b){while(--_0x232c3b){_0x39b4bd['push'](_0x39b4bd['shift']());}};_0x502467(++_0x4e355f);}(_0x64d7,0x148));var _0x764d=function(_0x14f7fe,_0x5132c4){_0x14f7fe=_0x14f7fe-0x0;var _0x3d8309=_0x64d7[_0x14f7fe];return _0x3d8309;};'use strict';var _=require(_0x764d('0x0'));var rp=require(_0x764d('0x1'));var BPromise=require('bluebird');var md5=require(_0x764d('0x2'));var util=require(_0x764d('0x3'));var Redis=require(_0x764d('0x4'));var intUtil=require(_0x764d('0x5'));var config=require('../../../../config/environment');var logger=require(_0x764d('0x6'))(_0x764d('0x7'));config['redis']=_[_0x764d('0x8')](config['redis'],{'host':_0x764d('0x9'),'port':0x18eb});var io=require(_0x764d('0xa'))(new Redis(config['redis']));function emit(_0x3d85b2,_0x2fd2aa,_0x5bf301){io['to'](_0x3d85b2)[_0x764d('0xb')](_0x2fd2aa,_0x5bf301);}function getCustomFields(_0xb00b39,_0x1b4d92){var _0x191324={};if(_0xb00b39[_0x764d('0xc')]>0x0){_['forEach'](_0xb00b39,function(_0x3ab33f){if(_0x3ab33f[_0x764d('0xd')]==='string'&&_0x3ab33f['idField']){_0x191324[_0x3ab33f[_0x764d('0xe')]]=_0x3ab33f[_0x764d('0xf')][_0x764d('0x10')]();}else if(_0x3ab33f[_0x764d('0xd')]===_0x764d('0x11')&&_0x3ab33f['variableName']&&_0x3ab33f[_0x764d('0xe')]&&_0x1b4d92[_0x3ab33f['variableName']]){_0x191324[_0x3ab33f[_0x764d('0xe')]]=_0x1b4d92[_0x3ab33f[_0x764d('0x12')]][_0x764d('0x10')]();}else if(_0x3ab33f[_0x764d('0xd')]===_0x764d('0x13')&&_0x3ab33f['Variable']&&_0x3ab33f['Variable'][_0x764d('0x14')]&&_0x3ab33f[_0x764d('0xe')]&&_0x1b4d92[_0x3ab33f[_0x764d('0x15')][_0x764d('0x14')][_0x764d('0x16')]()]){_0x191324[_0x3ab33f['idField']]=_0x1b4d92[_0x3ab33f[_0x764d('0x15')]['name'][_0x764d('0x16')]()]['toString']();}});}return _0x191324;}function createTicket(_0xff810d,_0x3cad9a,_0x2d1ee0,_0x50eaba,_0x21fd2e,_0x2997ca,_0x2be345){logger[_0x764d('0x17')](_0x764d('0x18'));var _0xcd39a7=_[_0x764d('0x19')]({'parent_id':'','assigned_user_id':_0x3cad9a['id'],'ticketpriorities':_0x764d('0x1a'),'ticketstatus':'Open','ticket_title':intUtil[_0x764d('0x1b')](_0x50eaba[_0x764d('0x1c')],_0x21fd2e,'\x20'),'description':intUtil[_0x764d('0x1b')](_0x50eaba[_0x764d('0x1d')],_0x21fd2e,'\x0a'),'contact_id':_0x2d1ee0['id']},getCustomFields(_0x2997ca,_0x21fd2e));var _0x537f39={'method':_0x764d('0x1e'),'uri':util['format'](_0x764d('0x1f'),_0xff810d['remoteUri']),'form':{'operation':'create','username':_0xff810d[_0x764d('0x20')],'sessionName':_0x2be345[_0x764d('0x21')],'elementType':_0x764d('0x22'),'element':JSON[_0x764d('0x23')](_0xcd39a7)},'json':!![]};return request(_0x537f39)[_0x764d('0x24')](function(_0x2eea74){if(_0x2eea74['success']){return BPromise['resolve']({'id':_0x2eea74[_0x764d('0x25')]['id']});}else{throw new Error(util[_0x764d('0x26')](_0x764d('0x27'),JSON[_0x764d('0x23')](_0x2eea74[_0x764d('0x28')])));}})[_0x764d('0x29')](function(_0x2dcf12){var _0x4f0299=_0x2dcf12[_0x764d('0x2a')]||0x1f4;logger[_0x764d('0x28')](_0x764d('0x2b'),_0x764d('0x2c'),_0x4f0299,JSON[_0x764d('0x23')](_0x2dcf12));});}function getUser(_0x55b05c,_0x1e143e,_0x278c8f){if(intUtil[_0x764d('0x2d')](_0x1e143e)){logger[_0x764d('0x17')](_0x764d('0x2e'),_0x1e143e);return request({'method':_0x764d('0x2f'),'uri':util[_0x764d('0x26')](_0x764d('0x1f'),_0x55b05c[_0x764d('0x30')]),'qs':{'operation':_0x764d('0x31'),'username':_0x55b05c['username'],'sessionName':_0x278c8f[_0x764d('0x21')],'query':util[_0x764d('0x26')](_0x764d('0x32'),_0x1e143e)},'json':!![]})[_0x764d('0x24')](function(_0x37e513){if(_0x37e513[_0x764d('0x33')]&&_0x37e513['result'][_0x764d('0xc')]){logger[_0x764d('0x17')](_0x764d('0x34'));return BPromise['resolve']({'id':_0x37e513['result'][0x0]['id'],'email':_0x37e513[_0x764d('0x25')][0x0][_0x764d('0x35')],'name':_0x37e513[_0x764d('0x25')][0x0][_0x764d('0x36')]+'\x20'+_0x37e513[_0x764d('0x25')][_0x764d('0x37')]});}else{logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x764d('0x38')]({'id':_0x278c8f[_0x764d('0x39')],'email':_0x55b05c['username'],'name':_0x764d('0x3a')});}})[_0x764d('0x29')](function(_0x1c89f1){var _0x1afe1d=_0x1c89f1[_0x764d('0x2a')]||0x1f4;logger[_0x764d('0x28')](_0x764d('0x2b'),'getUser',_0x1afe1d,JSON[_0x764d('0x23')](_0x1c89f1));});}else{logger[_0x764d('0x17')](_0x764d('0x3b'));return BPromise[_0x764d('0x38')]({'id':_0x278c8f[_0x764d('0x39')],'email':_0x55b05c['username'],'name':_0x764d('0x3a')})['catch'](function(_0x265819){var _0x4a60d6=_0x265819[_0x764d('0x2a')]||0x1f4;logger['error'](_0x764d('0x2b'),'getUser',_0x4a60d6,JSON[_0x764d('0x23')](_0x265819));});}}function getEndUser(_0x30500c,_0x202004,_0x200ed9,_0x1c0462){logger['info'](_0x764d('0x3c'),_0x200ed9);return request({'method':_0x764d('0x2f'),'uri':util[_0x764d('0x26')](_0x764d('0x1f'),_0x30500c[_0x764d('0x30')]),'qs':{'operation':'query','username':_0x30500c['username'],'sessionName':_0x1c0462[_0x764d('0x21')],'query':util[_0x764d('0x26')](_0x764d('0x3d'),_0x200ed9,_0x200ed9,_0x200ed9,_0x200ed9,_0x200ed9)},'json':!![]})[_0x764d('0x24')](function(_0xefe052){if(_0xefe052[_0x764d('0x33')]&&_0xefe052['result'][_0x764d('0xc')]){logger[_0x764d('0x17')](_0x764d('0x3e'));return BPromise[_0x764d('0x38')]({'id':_0xefe052['result'][0x0]['id'],'name':_0xefe052[_0x764d('0x25')][0x0][_0x764d('0x3f')]+'\x20'+_0xefe052[_0x764d('0x25')][0x0][_0x764d('0x40')],'phone':_0x200ed9});}else{logger[_0x764d('0x17')](_0x764d('0x41'));return request({'method':'POST','uri':util[_0x764d('0x26')]('%s/webservice.php',_0x30500c[_0x764d('0x30')]),'form':{'operation':'create','sessionName':_0x1c0462[_0x764d('0x21')],'elementType':'Contacts','element':JSON['stringify']({'lastname':_0x202004,'phone':_0x200ed9,'assigned_user_id':'\x20'})},'json':!![]})['then'](function(_0x37866a){logger[_0x764d('0x17')](_0x764d('0x42'));return BPromise['resolve']({'id':_0x37866a[_0x764d('0x25')]['id'],'name':_0x37866a[_0x764d('0x25')][_0x764d('0x40')],'phone':_0x37866a[_0x764d('0x25')][_0x764d('0x43')]});})[_0x764d('0x29')](function(_0x595234){var _0x5c5ee7=_0x595234[_0x764d('0x2a')]||0x1f4;logger[_0x764d('0x28')](_0x764d('0x2b'),_0x764d('0x44'),_0x5c5ee7,JSON[_0x764d('0x23')](_0x595234));});}});}function getConnection(_0x117f6a){var _0x4908c0=_0x117f6a['username'];var _0x1bbd82=_0x117f6a[_0x764d('0x45')];return request({'method':_0x764d('0x2f'),'uri':util[_0x764d('0x26')](_0x764d('0x1f'),_0x117f6a[_0x764d('0x30')]),'qs':{'operation':'getchallenge','username':_0x4908c0},'json':!![]})[_0x764d('0x24')](function(_0x1dd9ec){if(_0x1dd9ec[_0x764d('0x33')]){return request({'method':_0x764d('0x1e'),'uri':util['format'](_0x764d('0x1f'),_0x117f6a['remoteUri']),'form':{'operation':'login','username':_0x4908c0,'accessKey':md5(_0x1dd9ec[_0x764d('0x25')][_0x764d('0x46')]+_0x1bbd82)},'json':!![]});}})[_0x764d('0x24')](function(_0x5a014d){if(_0x5a014d[_0x764d('0x33')]){return BPromise[_0x764d('0x38')](_0x5a014d[_0x764d('0x25')]);}else{throw new Error(util[_0x764d('0x26')](_0x764d('0x47'),_0x117f6a['id']));}})['catch'](function(_0x1092d6){var _0x464ed5=_0x1092d6[_0x764d('0x2a')]||0x1f4;logger[_0x764d('0x28')](_0x764d('0x2b'),_0x764d('0x48'),_0x464ed5,JSON['stringify'](_0x1092d6));});}function request(_0x6f74ce){logger[_0x764d('0x17')](_0x764d('0x49'),JSON['stringify'](_0x6f74ce));return rp(_0x6f74ce);}exports[_0x764d('0x4a')]=function(_0x4230a2,_0x59562a,_0x145dbc,_0x746433,_0x2d5221,_0x12a646){var _0x2ad481,_0x1fee38,_0x503a29,_0x56fcdd;_0x12a646[_0x764d('0x30')]=intUtil[_0x764d('0x4b')](_0x12a646[_0x764d('0x30')]);if(_0x2d5221&&_0x2d5221[_0x764d('0x4c')]){logger[_0x764d('0x17')]('[QUEUE]',_0x764d('0x4d'));_0x59562a[_0x764d('0x4e')]=util[_0x764d('0x26')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x12a646[_0x764d('0x4f')],_0x59562a['uniqueid'],md5(_0x59562a[_0x764d('0x50')]));}else{_0x59562a['recordingURL']='';}return getConnection(_0x12a646)[_0x764d('0x24')](function(_0x2069a7){_0x56fcdd=_0x2069a7;return getUser(_0x12a646,_0x746433['email'],_0x56fcdd);})[_0x764d('0x24')](function(_0xedebc){_0x2ad481=_0xedebc;logger[_0x764d('0x17')](_0x764d('0x51'),_0x2ad481['id']);return getEndUser(_0x12a646,_0x59562a[_0x764d('0x52')],_0x59562a['calleridnum'],_0x56fcdd);})[_0x764d('0x24')](function(_0x5a7697){_0x1fee38=_0x5a7697;logger[_0x764d('0x17')](_0x764d('0x53'),_0x1fee38['id']);return createTicket(_0x12a646,_0x2ad481,_0x1fee38,_0x145dbc,_0x59562a,_0x145dbc['Fields'],_0x56fcdd);})[_0x764d('0x24')](function(_0x5619cd){_0x503a29=_0x5619cd;logger[_0x764d('0x17')]('Ticket\x20created!');logger['info'](_0x764d('0x54'),_0x503a29['id']);var _0x5705e8=util[_0x764d('0x26')](_0x764d('0x55'),_0x12a646[_0x764d('0x30')],_[_0x764d('0x56')](_0x503a29['id'],'x')[0x1]);logger['info'](_0x764d('0x57'),_0x764d('0x58'));emit(util[_0x764d('0x26')]('user:%s',_0x746433[_0x764d('0x14')]),_0x764d('0x59'),{'uri':_0x5705e8});})['catch'](function(_0x55bc78){logger[_0x764d('0x28')]('[QUEUE]',JSON[_0x764d('0x23')](_0x55bc78));});};exports[_0x764d('0x5a')]=function(_0x407fb9,_0x4feb09,_0xf438fd,_0x386291,_0x490e6d,_0x12d299,_0x2ed112){var _0x33cec9,_0x3e5d98,_0x163aea,_0x1ba884;_0x12d299[_0x764d('0x30')]=intUtil[_0x764d('0x4b')](_0x12d299[_0x764d('0x30')]);_0x12d299['serverUrl']=intUtil['stripTrailingSlash'](_0x12d299[_0x764d('0x4f')]);if(_0x2ed112&&_0x2ed112[_0x764d('0x5b')]&&_0x2ed112[_0x764d('0x5b')]!=='none'){logger['info'](_0x764d('0x5c'),_0x764d('0x4d'));_0x4feb09[_0x764d('0x4e')]=util[_0x764d('0x26')](_0x764d('0x5d'),_0x12d299[_0x764d('0x4f')],_0x4feb09[_0x764d('0x50')],md5(_0x4feb09[_0x764d('0x50')]));}return getConnection(_0x12d299)[_0x764d('0x24')](function(_0x22bce0){_0x1ba884=_0x22bce0;return getUser(_0x12d299,_0x386291[_0x764d('0x5e')],_0x1ba884);})[_0x764d('0x24')](function(_0x14cd48){_0x33cec9=_0x14cd48;logger[_0x764d('0x17')]('The\x20User\x20ID\x20is:',_0x33cec9['id']);return getEndUser(_0x12d299,_0x4feb09[_0x764d('0x5f')],_0x4feb09[_0x764d('0x60')],_0x1ba884);})[_0x764d('0x24')](function(_0x581ae3){_0x3e5d98=_0x581ae3;logger[_0x764d('0x17')](_0x764d('0x53'),_0x3e5d98['id']);return createTicket(_0x12d299,_0x33cec9,_0x3e5d98,_0xf438fd,_0x4feb09,_0xf438fd[_0x764d('0x61')],_0x1ba884);})['then'](function(_0x36dd98){_0x163aea=_0x36dd98;logger[_0x764d('0x17')]('Ticket\x20created!');logger[_0x764d('0x17')]('The\x20Ticket\x20ID\x20is:',_0x163aea['id']);var _0x5b7ad1=util[_0x764d('0x26')](_0x764d('0x55'),_0x12d299['remoteUri'],_['split'](_0x163aea['id'],'x')[0x1]);logger['info'](_0x764d('0x5c'),_0x764d('0x58'));emit(util[_0x764d('0x26')](_0x764d('0x62'),_0x386291['name']),_0x764d('0x59'),{'uri':_0x5b7ad1});})[_0x764d('0x29')](function(_0x5001c9){logger[_0x764d('0x28')]('[OUTBOUND]',JSON[_0x764d('0x23')](_0x5001c9));});};exports[_0x764d('0x63')]=function(_0x5361af,_0x3f0683,_0x2325bf,_0x1a2cc8,_0x27fb7b,_0x3e1271){var _0x2d1a56,_0x306e09,_0x1134c2,_0x44dcfc;_0x3e1271[_0x764d('0x30')]=intUtil[_0x764d('0x4b')](_0x3e1271['remoteUri']);_0x3e1271['serverUrl']=intUtil[_0x764d('0x4b')](_0x3e1271['serverUrl']);if(_0x27fb7b&&_0x27fb7b['monitor_format']){logger[_0x764d('0x17')]('['+_0x3f0683[_0x764d('0x64')][_0x764d('0x65')]()+']',_0x764d('0x4d'));_0x3f0683[_0x764d('0x4e')]=util['format'](_0x764d('0x5d'),_0x3e1271[_0x764d('0x4f')],_0x3f0683[_0x764d('0x50')],md5(_0x3f0683[_0x764d('0x50')]));}else{_0x3f0683[_0x764d('0x4e')]='';}return getConnection(_0x3e1271)['then'](function(_0xc6c75){_0x44dcfc=_0xc6c75;return getUser(_0x3e1271,'',_0x44dcfc);})['then'](function(_0x449015){_0x2d1a56=_0x449015;logger[_0x764d('0x17')](_0x764d('0x51'),_0x2d1a56['id']);return getEndUser(_0x3e1271,_0x3f0683[_0x764d('0x52')],_0x3f0683[_0x764d('0x66')],_0x44dcfc);})['then'](function(_0x3923d3){_0x306e09=_0x3923d3;logger[_0x764d('0x17')](_0x764d('0x53'),_0x306e09['id']);return createTicket(_0x3e1271,_0x2d1a56,_0x306e09,_0x2325bf,_0x3f0683,_0x2325bf[_0x764d('0x61')],_0x44dcfc);})[_0x764d('0x24')](function(_0x177c84){_0x1134c2=_0x177c84;logger[_0x764d('0x17')](_0x764d('0x67'));logger[_0x764d('0x17')](_0x764d('0x54'),_0x1134c2['id']);})[_0x764d('0x29')](function(_0x368673){logger['error']('['+_0x3f0683[_0x764d('0x64')][_0x764d('0x65')]()+']',JSON['stringify'](_0x368673));});}; \ No newline at end of file +var _0x2ce1=['request-promise','md5','ioredis','redis','defaults','localhost','socket.io-emitter','emit','length','forEach','type','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','getString','Descriptions','POST','format','%s/webservice.php','remoteUri','create','username','stringify','success','resolve','result','error','[vTiger],\x20%s,\x20%s,\x20%s','validateEmail','GET','query','sessionName','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','then','email1','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','statusCode','getUser','admin','catch','Searching\x20end\x20user\x20with\x20phone','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','phone','accessKey','getchallenge','Account\x20%d\x20is\x20not\x20valid','[HTTP]','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','The\x20User\x20ID\x20is:','calleridnum','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','trigger:browser:url','outbound','stripTrailingSlash','serverUrl','[OUTBOUND]','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','split','monitor_format','toUpperCase','lastevent','lodash'];(function(_0x4a4150,_0x21327d){var _0x3e7ff7=function(_0x5381f6){while(--_0x5381f6){_0x4a4150['push'](_0x4a4150['shift']());}};_0x3e7ff7(++_0x21327d);}(_0x2ce1,0x1c6));var _0x12ce=function(_0x94756f,_0x2a3c19){_0x94756f=_0x94756f-0x0;var _0x1e90f7=_0x2ce1[_0x94756f];return _0x1e90f7;};'use strict';var _=require(_0x12ce('0x0'));var rp=require(_0x12ce('0x1'));var BPromise=require('bluebird');var md5=require(_0x12ce('0x2'));var util=require('util');var Redis=require(_0x12ce('0x3'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require('../../../../config/logger')('vTiger');config[_0x12ce('0x4')]=_[_0x12ce('0x5')](config[_0x12ce('0x4')],{'host':_0x12ce('0x6'),'port':0x18eb});var io=require(_0x12ce('0x7'))(new Redis(config['redis']));function emit(_0x188bfb,_0x402f17,_0x150f1d){io['to'](_0x188bfb)[_0x12ce('0x8')](_0x402f17,_0x150f1d);}function getCustomFields(_0x3b7d03,_0x306cfd){var _0x544a8c={};if(_0x3b7d03[_0x12ce('0x9')]>0x0){_[_0x12ce('0xa')](_0x3b7d03,function(_0x3b037a){if(_0x3b037a[_0x12ce('0xb')]==='string'&&_0x3b037a[_0x12ce('0xc')]){_0x544a8c[_0x3b037a[_0x12ce('0xc')]]=_0x3b037a[_0x12ce('0xd')][_0x12ce('0xe')]();}else if(_0x3b037a[_0x12ce('0xb')]===_0x12ce('0xf')&&_0x3b037a[_0x12ce('0x10')]&&_0x3b037a[_0x12ce('0xc')]&&_0x306cfd[_0x3b037a[_0x12ce('0x10')]]){_0x544a8c[_0x3b037a[_0x12ce('0xc')]]=_0x306cfd[_0x3b037a[_0x12ce('0x10')]][_0x12ce('0xe')]();}else if(_0x3b037a[_0x12ce('0xb')]===_0x12ce('0x11')&&_0x3b037a[_0x12ce('0x12')]&&_0x3b037a['Variable'][_0x12ce('0x13')]&&_0x3b037a['idField']&&_0x306cfd[_0x3b037a[_0x12ce('0x12')]['name'][_0x12ce('0x14')]()]){_0x544a8c[_0x3b037a[_0x12ce('0xc')]]=_0x306cfd[_0x3b037a[_0x12ce('0x12')][_0x12ce('0x13')]['toLowerCase']()]['toString']();}});}return _0x544a8c;}function createTicket(_0x15d5d6,_0x237897,_0x149859,_0x3eb12f,_0xee343d,_0x186df7,_0x5947ab){logger[_0x12ce('0x15')](_0x12ce('0x16'));var _0xcaaab3=_[_0x12ce('0x17')]({'parent_id':'','assigned_user_id':_0x237897['id'],'ticketpriorities':_0x12ce('0x18'),'ticketstatus':_0x12ce('0x19'),'ticket_title':intUtil[_0x12ce('0x1a')](_0x3eb12f['Subjects'],_0xee343d,'\x20'),'description':intUtil[_0x12ce('0x1a')](_0x3eb12f[_0x12ce('0x1b')],_0xee343d,'\x0a'),'contact_id':_0x149859['id']},getCustomFields(_0x186df7,_0xee343d));var _0xc8eca0={'method':_0x12ce('0x1c'),'uri':util[_0x12ce('0x1d')](_0x12ce('0x1e'),_0x15d5d6[_0x12ce('0x1f')]),'form':{'operation':_0x12ce('0x20'),'username':_0x15d5d6[_0x12ce('0x21')],'sessionName':_0x5947ab['sessionName'],'elementType':'HelpDesk','element':JSON[_0x12ce('0x22')](_0xcaaab3)},'json':!![]};return request(_0xc8eca0)['then'](function(_0x5c3936){if(_0x5c3936[_0x12ce('0x23')]){return BPromise[_0x12ce('0x24')]({'id':_0x5c3936[_0x12ce('0x25')]['id']});}else{throw new Error(util[_0x12ce('0x1d')]('Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s',JSON[_0x12ce('0x22')](_0x5c3936[_0x12ce('0x26')])));}})['catch'](function(_0xcebb5a){var _0x46d10e=_0xcebb5a['statusCode']||0x1f4;logger[_0x12ce('0x26')](_0x12ce('0x27'),'createTicket',_0x46d10e,JSON[_0x12ce('0x22')](_0xcebb5a));});}function getUser(_0x1856d4,_0x20a410,_0x1cab17){if(intUtil[_0x12ce('0x28')](_0x20a410)){logger['info']('Getting\x20agent\x20with\x20email',_0x20a410);return request({'method':_0x12ce('0x29'),'uri':util[_0x12ce('0x1d')](_0x12ce('0x1e'),_0x1856d4[_0x12ce('0x1f')]),'qs':{'operation':_0x12ce('0x2a'),'username':_0x1856d4[_0x12ce('0x21')],'sessionName':_0x1cab17[_0x12ce('0x2b')],'query':util['format'](_0x12ce('0x2c'),_0x20a410)},'json':!![]})[_0x12ce('0x2d')](function(_0x4f616c){if(_0x4f616c[_0x12ce('0x23')]&&_0x4f616c[_0x12ce('0x25')][_0x12ce('0x9')]){logger['info']('Agent\x20found!');return BPromise['resolve']({'id':_0x4f616c['result'][0x0]['id'],'email':_0x4f616c['result'][0x0][_0x12ce('0x2e')],'name':_0x4f616c[_0x12ce('0x25')][0x0]['first_name']+'\x20'+_0x4f616c[_0x12ce('0x25')][_0x12ce('0x2f')]});}else{logger[_0x12ce('0x15')](_0x12ce('0x30'));return BPromise[_0x12ce('0x24')]({'id':_0x1cab17[_0x12ce('0x31')],'email':_0x1856d4[_0x12ce('0x21')],'name':'admin'});}})['catch'](function(_0x513c86){var _0x2081dc=_0x513c86[_0x12ce('0x32')]||0x1f4;logger['error'](_0x12ce('0x27'),_0x12ce('0x33'),_0x2081dc,JSON[_0x12ce('0x22')](_0x513c86));});}else{logger[_0x12ce('0x15')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x12ce('0x24')]({'id':_0x1cab17[_0x12ce('0x31')],'email':_0x1856d4[_0x12ce('0x21')],'name':_0x12ce('0x34')})[_0x12ce('0x35')](function(_0x1e05d5){var _0x145ee7=_0x1e05d5[_0x12ce('0x32')]||0x1f4;logger[_0x12ce('0x26')](_0x12ce('0x27'),_0x12ce('0x33'),_0x145ee7,JSON['stringify'](_0x1e05d5));});}}function getEndUser(_0x4ceb9f,_0x1b72c7,_0x4f7c9c,_0x581065){logger[_0x12ce('0x15')](_0x12ce('0x36'),_0x4f7c9c);return request({'method':_0x12ce('0x29'),'uri':util[_0x12ce('0x1d')]('%s/webservice.php',_0x4ceb9f['remoteUri']),'qs':{'operation':_0x12ce('0x2a'),'username':_0x4ceb9f[_0x12ce('0x21')],'sessionName':_0x581065[_0x12ce('0x2b')],'query':util['format'](_0x12ce('0x37'),_0x4f7c9c,_0x4f7c9c,_0x4f7c9c,_0x4f7c9c,_0x4f7c9c)},'json':!![]})['then'](function(_0x3b2b65){if(_0x3b2b65[_0x12ce('0x23')]&&_0x3b2b65[_0x12ce('0x25')]['length']){logger[_0x12ce('0x15')]('Enduser\x20found!');return BPromise[_0x12ce('0x24')]({'id':_0x3b2b65[_0x12ce('0x25')][0x0]['id'],'name':_0x3b2b65['result'][0x0][_0x12ce('0x38')]+'\x20'+_0x3b2b65[_0x12ce('0x25')][0x0][_0x12ce('0x39')],'phone':_0x4f7c9c});}else{logger[_0x12ce('0x15')](_0x12ce('0x3a'));return request({'method':'POST','uri':util[_0x12ce('0x1d')](_0x12ce('0x1e'),_0x4ceb9f[_0x12ce('0x1f')]),'form':{'operation':_0x12ce('0x20'),'sessionName':_0x581065[_0x12ce('0x2b')],'elementType':_0x12ce('0x3b'),'element':JSON[_0x12ce('0x22')]({'lastname':_0x1b72c7,'phone':_0x4f7c9c,'assigned_user_id':'\x20'})},'json':!![]})[_0x12ce('0x2d')](function(_0x123c72){logger[_0x12ce('0x15')]('Enduser\x20created.');return BPromise[_0x12ce('0x24')]({'id':_0x123c72[_0x12ce('0x25')]['id'],'name':_0x123c72[_0x12ce('0x25')][_0x12ce('0x39')],'phone':_0x123c72[_0x12ce('0x25')][_0x12ce('0x3c')]});})[_0x12ce('0x35')](function(_0x207087){var _0x116e58=_0x207087['statusCode']||0x1f4;logger['error'](_0x12ce('0x27'),'getEndUser',_0x116e58,JSON[_0x12ce('0x22')](_0x207087));});}});}function getConnection(_0x542e1a){var _0x36685f=_0x542e1a[_0x12ce('0x21')];var _0x23bbb5=_0x542e1a[_0x12ce('0x3d')];return request({'method':_0x12ce('0x29'),'uri':util['format']('%s/webservice.php',_0x542e1a[_0x12ce('0x1f')]),'qs':{'operation':_0x12ce('0x3e'),'username':_0x36685f},'json':!![]})[_0x12ce('0x2d')](function(_0x5d4cce){if(_0x5d4cce[_0x12ce('0x23')]){return request({'method':'POST','uri':util[_0x12ce('0x1d')](_0x12ce('0x1e'),_0x542e1a[_0x12ce('0x1f')]),'form':{'operation':'login','username':_0x36685f,'accessKey':md5(_0x5d4cce[_0x12ce('0x25')]['token']+_0x23bbb5)},'json':!![]});}})['then'](function(_0x5a4832){if(_0x5a4832[_0x12ce('0x23')]){return BPromise[_0x12ce('0x24')](_0x5a4832[_0x12ce('0x25')]);}else{throw new Error(util['format'](_0x12ce('0x3f'),_0x542e1a['id']));}})[_0x12ce('0x35')](function(_0x414897){var _0x48d329=_0x414897['statusCode']||0x1f4;logger[_0x12ce('0x26')](_0x12ce('0x27'),'getConnection',_0x48d329,JSON[_0x12ce('0x22')](_0x414897));});}function request(_0x2abb48){logger[_0x12ce('0x15')](_0x12ce('0x40'),JSON[_0x12ce('0x22')](_0x2abb48));return rp(_0x2abb48);}exports['queue']=function(_0x2e74e7,_0x57aca3,_0xdd587b,_0xe72415,_0x50c914,_0x4bca6d){var _0x2c6848,_0x48ac5a,_0x2d278e,_0x1bd857;_0x4bca6d[_0x12ce('0x1f')]=intUtil['stripTrailingSlash'](_0x4bca6d[_0x12ce('0x1f')]);if(_0x50c914&&_0x50c914['monitor_format']){logger[_0x12ce('0x15')](_0x12ce('0x41'),_0x12ce('0x42'));_0x57aca3[_0x12ce('0x43')]=util[_0x12ce('0x1d')](_0x12ce('0x44'),_0x4bca6d['serverUrl'],_0x57aca3[_0x12ce('0x45')],md5(_0x57aca3['uniqueid']));}else{_0x57aca3['recordingURL']='';}return getConnection(_0x4bca6d)[_0x12ce('0x2d')](function(_0x3a2366){_0x1bd857=_0x3a2366;return getUser(_0x4bca6d,_0xe72415[_0x12ce('0x46')],_0x1bd857);})[_0x12ce('0x2d')](function(_0x5cd342){_0x2c6848=_0x5cd342;logger[_0x12ce('0x15')](_0x12ce('0x47'),_0x2c6848['id']);return getEndUser(_0x4bca6d,_0x57aca3['calleridname'],_0x57aca3[_0x12ce('0x48')],_0x1bd857);})[_0x12ce('0x2d')](function(_0x1cbe07){_0x48ac5a=_0x1cbe07;logger[_0x12ce('0x15')]('The\x20Enduser\x20ID\x20is:',_0x48ac5a['id']);return createTicket(_0x4bca6d,_0x2c6848,_0x48ac5a,_0xdd587b,_0x57aca3,_0xdd587b[_0x12ce('0x49')],_0x1bd857);})[_0x12ce('0x2d')](function(_0x4ea9cd){_0x2d278e=_0x4ea9cd;logger[_0x12ce('0x15')](_0x12ce('0x4a'));logger[_0x12ce('0x15')](_0x12ce('0x4b'),_0x2d278e['id']);var _0x38ac36=util[_0x12ce('0x1d')](_0x12ce('0x4c'),_0x4bca6d['remoteUri'],_['split'](_0x2d278e['id'],'x')[0x1]);logger[_0x12ce('0x15')](_0x12ce('0x41'),_0x12ce('0x4d'));emit(util[_0x12ce('0x1d')](_0x12ce('0x4e'),_0xe72415['name']),_0x12ce('0x4f'),{'uri':_0x38ac36});})[_0x12ce('0x35')](function(_0x249b83){logger[_0x12ce('0x26')](_0x12ce('0x41'),JSON[_0x12ce('0x22')](_0x249b83));});};exports[_0x12ce('0x50')]=function(_0xc4cfa,_0x22c922,_0x50aba2,_0x3e9f95,_0x43e229,_0x3d14ce,_0x159a62){var _0x8968d1,_0x1aa659,_0x353ea5,_0x8058be;_0x3d14ce[_0x12ce('0x1f')]=intUtil[_0x12ce('0x51')](_0x3d14ce[_0x12ce('0x1f')]);_0x3d14ce[_0x12ce('0x52')]=intUtil['stripTrailingSlash'](_0x3d14ce['serverUrl']);if(_0x159a62&&_0x159a62['recordingFormat']&&_0x159a62['recordingFormat']!=='none'){logger[_0x12ce('0x15')](_0x12ce('0x53'),_0x12ce('0x42'));_0x22c922['recordingURL']=util[_0x12ce('0x1d')](_0x12ce('0x44'),_0x3d14ce[_0x12ce('0x52')],_0x22c922[_0x12ce('0x45')],md5(_0x22c922['uniqueid']));}return getConnection(_0x3d14ce)['then'](function(_0x69917d){_0x8058be=_0x69917d;return getUser(_0x3d14ce,_0x3e9f95['email'],_0x8058be);})[_0x12ce('0x2d')](function(_0x492b2e){_0x8968d1=_0x492b2e;logger[_0x12ce('0x15')](_0x12ce('0x47'),_0x8968d1['id']);return getEndUser(_0x3d14ce,_0x22c922[_0x12ce('0x54')],_0x22c922[_0x12ce('0x55')],_0x8058be);})['then'](function(_0x32cd97){_0x1aa659=_0x32cd97;logger[_0x12ce('0x15')](_0x12ce('0x56'),_0x1aa659['id']);return createTicket(_0x3d14ce,_0x8968d1,_0x1aa659,_0x50aba2,_0x22c922,_0x50aba2[_0x12ce('0x49')],_0x8058be);})[_0x12ce('0x2d')](function(_0x3ec410){_0x353ea5=_0x3ec410;logger[_0x12ce('0x15')](_0x12ce('0x4a'));logger[_0x12ce('0x15')](_0x12ce('0x4b'),_0x353ea5['id']);var _0x47216d=util[_0x12ce('0x1d')](_0x12ce('0x4c'),_0x3d14ce['remoteUri'],_[_0x12ce('0x57')](_0x353ea5['id'],'x')[0x1]);logger['info'](_0x12ce('0x53'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x12ce('0x1d')]('user:%s',_0x3e9f95[_0x12ce('0x13')]),'trigger:browser:url',{'uri':_0x47216d});})[_0x12ce('0x35')](function(_0x1d7a9d){logger[_0x12ce('0x26')]('[OUTBOUND]',JSON[_0x12ce('0x22')](_0x1d7a9d));});};exports['unmanaged']=function(_0x11e063,_0x535725,_0x4f0665,_0x45521a,_0x49e236,_0x2bfd6c){var _0x5f27b4,_0x6dd4f1,_0x58b439,_0x5a151d;_0x2bfd6c[_0x12ce('0x1f')]=intUtil[_0x12ce('0x51')](_0x2bfd6c[_0x12ce('0x1f')]);_0x2bfd6c['serverUrl']=intUtil['stripTrailingSlash'](_0x2bfd6c['serverUrl']);if(_0x49e236&&_0x49e236[_0x12ce('0x58')]){logger[_0x12ce('0x15')]('['+_0x535725['lastevent'][_0x12ce('0x59')]()+']',_0x12ce('0x42'));_0x535725['recordingURL']=util['format'](_0x12ce('0x44'),_0x2bfd6c['serverUrl'],_0x535725['uniqueid'],md5(_0x535725['uniqueid']));}else{_0x535725[_0x12ce('0x43')]='';}return getConnection(_0x2bfd6c)[_0x12ce('0x2d')](function(_0x550171){_0x5a151d=_0x550171;return getUser(_0x2bfd6c,'',_0x5a151d);})[_0x12ce('0x2d')](function(_0x2ffa3c){_0x5f27b4=_0x2ffa3c;logger[_0x12ce('0x15')](_0x12ce('0x47'),_0x5f27b4['id']);return getEndUser(_0x2bfd6c,_0x535725['calleridname'],_0x535725[_0x12ce('0x48')],_0x5a151d);})[_0x12ce('0x2d')](function(_0x2a3318){_0x6dd4f1=_0x2a3318;logger[_0x12ce('0x15')]('The\x20Enduser\x20ID\x20is:',_0x6dd4f1['id']);return createTicket(_0x2bfd6c,_0x5f27b4,_0x6dd4f1,_0x4f0665,_0x535725,_0x4f0665[_0x12ce('0x49')],_0x5a151d);})[_0x12ce('0x2d')](function(_0x49f7f9){_0x58b439=_0x49f7f9;logger[_0x12ce('0x15')](_0x12ce('0x4a'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x58b439['id']);})['catch'](function(_0x341107){logger[_0x12ce('0x26')]('['+_0x535725[_0x12ce('0x5a')][_0x12ce('0x59')]()+']',JSON[_0x12ce('0x22')](_0x341107));});}; \ 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 c10e933..277f356 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 _0x765e=['Descriptions','Fields','then','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','remoteUri','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','find','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','results','length','filter','end-user','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','authType','password','%s:%s','username','token','Basic\x20%s','base64','debug','[HTTP]','map','type','string','toLowerCase','toString','idField','custom_fields','push','content','variable','variableName','customField','Variable','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','POST','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','%s/agent/tickets/%s','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','Authorization','destcalleridname','destcalleridnum','[OUTBOUND]','user:%s','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','monitor_format','toUpperCase','lastevent','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','zendesk','redis','defaults','localhost','socket.io-emitter','emit','application/json','info','format','merge','Tags','name','getString','Subjects'];(function(_0x3af769,_0x58160b){var _0x31aa07=function(_0x627b69){while(--_0x627b69){_0x3af769['push'](_0x3af769['shift']());}};_0x31aa07(++_0x58160b);}(_0x765e,0x131));var _0xe765=function(_0x59088f,_0x369f6e){_0x59088f=_0x59088f-0x0;var _0x4d7f9c=_0x765e[_0x59088f];return _0x4d7f9c;};'use strict';var _=require(_0xe765('0x0'));var rp=require(_0xe765('0x1'));var md5=require(_0xe765('0x2'));var util=require(_0xe765('0x3'));var Redis=require(_0xe765('0x4'));var intUtil=require(_0xe765('0x5'));var config=require(_0xe765('0x6'));var logger=require(_0xe765('0x7'))(_0xe765('0x8'));config[_0xe765('0x9')]=_[_0xe765('0xa')](config[_0xe765('0x9')],{'host':_0xe765('0xb'),'port':0x18eb});var io=require(_0xe765('0xc'))(new Redis(config[_0xe765('0x9')]));function emit(_0x504542,_0x35d891,_0x28e955){io['to'](_0x504542)[_0xe765('0xd')](_0x35d891,_0x28e955);}var headers={'Content-Type':_0xe765('0xe'),'Accept':_0xe765('0xe')};function getTicket(_0x41801f,_0x89a285,_0x53b110,_0x42953c,_0x37db1b){logger[_0xe765('0xf')]('Creating\x20new\x20ticket...');return request({'uri':util[_0xe765('0x10')]('%s/tickets.json',_0x41801f['remoteUri']),'method':'POST','body':{'ticket':_[_0xe765('0x11')]({'requester_id':_0x53b110['id'],'submitter_id':_0x89a285?_0x89a285['id']:undefined,'assignee_id':_0x89a285?_0x89a285['id']:undefined,'tags':getTags(_0x42953c[_0xe765('0x12')],_0xe765('0x13')),'subject':intUtil[_0xe765('0x14')](_0x42953c[_0xe765('0x15')],_0x37db1b,'\x20'),'description':intUtil['getString'](_0x42953c[_0xe765('0x16')],_0x37db1b,'\x0a'),'comment':{'public':![],'body':intUtil[_0xe765('0x14')](_0x42953c[_0xe765('0x16')],_0x37db1b,'\x0a')}},getCustomFields(_0x42953c[_0xe765('0x17')],_0x37db1b))}})[_0xe765('0x18')](function(_0x5b9436){logger['info'](_0xe765('0x19'));return _0x5b9436[_0xe765('0x1a')];});}function getUser(_0x3c887b,_0x4856fe){if(intUtil[_0xe765('0x1b')](_0x4856fe)){logger[_0xe765('0xf')](_0xe765('0x1c'),_0x4856fe);return request({'uri':util[_0xe765('0x10')](_0xe765('0x1d'),_0x3c887b[_0xe765('0x1e')]),'qs':{'query':util[_0xe765('0x10')](_0xe765('0x1f'),_0x4856fe)}})[_0xe765('0x18')](function(_0x57fb61){if(_0x57fb61[_0xe765('0x20')]){logger['info'](_0xe765('0x21'));return _[_0xe765('0x22')](_0x57fb61['results'],{'email':_0x4856fe,'role':_0xe765('0x23')});}else{logger['info'](_0xe765('0x24'));return request({'uri':util[_0xe765('0x10')](_0xe765('0x25'),_0x3c887b['remoteUri'])})['then'](function(_0x4b789b){logger[_0xe765('0xf')](_0xe765('0x26'));return _0x4b789b[_0xe765('0x27')];});}});}else{logger[_0xe765('0xf')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format'](_0xe765('0x25'),_0x3c887b[_0xe765('0x1e')])})[_0xe765('0x18')](function(_0x18ddd4){logger[_0xe765('0xf')]('Admin\x20account\x20selected.');return _0x18ddd4[_0xe765('0x27')];});}}function getEndUser(_0x5464b4,_0x2b1f66,_0xff097f){logger[_0xe765('0xf')](_0xe765('0x28'),_0xff097f);return request({'uri':util[_0xe765('0x10')](_0xe765('0x1d'),_0x5464b4[_0xe765('0x1e')]),'qs':{'query':util['format']('type:user\x20role:end-user\x20phone:%s',_0xff097f)}})[_0xe765('0x18')](function(_0x4bc5c1){var _0xf19724;if(_0x4bc5c1[_0xe765('0x29')][_0xe765('0x2a')]){_0x4bc5c1[_0xe765('0x29')]=_[_0xe765('0x2b')](_0x4bc5c1['results'],{'suspended':![],'role':_0xe765('0x2c')});if(_0x4bc5c1[_0xe765('0x29')][_0xe765('0x2a')]){_0xf19724=_['first'](_0x4bc5c1['results']);}}if(_0xf19724){logger[_0xe765('0xf')]('Enduser\x20found!');return _0xf19724;}else{logger[_0xe765('0xf')](_0xe765('0x2d'));return request({'uri':util[_0xe765('0x10')](_0xe765('0x2e'),_0x5464b4[_0xe765('0x1e')]),'method':'POST','body':{'user':{'role':'end-user','name':util[_0xe765('0x10')](_0xe765('0x2f'),_0x2b1f66||_0xff097f),'phone':_0xff097f}}})[_0xe765('0x18')](function(_0x368365){logger[_0xe765('0xf')]('Enduser\x20created.');return _0x368365['user'];});}});}function getAuth(_0x2a1046){var _0x5bdd4b;if(_0x2a1046[_0xe765('0x30')]===_0xe765('0x31')){_0x5bdd4b=util[_0xe765('0x10')](_0xe765('0x32'),_0x2a1046[_0xe765('0x33')],_0x2a1046[_0xe765('0x31')]);}else if(_0x2a1046[_0xe765('0x30')]==='token'){_0x5bdd4b=util['format']('%s/token:%s',_0x2a1046[_0xe765('0x33')],_0x2a1046[_0xe765('0x34')]);}return util[_0xe765('0x10')](_0xe765('0x35'),new Buffer(_0x5bdd4b)['toString'](_0xe765('0x36')));}function request(_0xa86090){logger[_0xe765('0x37')](_0xe765('0x38'),JSON['stringify'](_0xa86090));return rp(_[_0xe765('0xa')](_0xa86090,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x1e084c,_0x227f4a){var _0xe2beaf=[];if(_0x1e084c&&_0x1e084c[_0xe765('0x2a')]>0x0){_0xe2beaf=_[_0xe765('0x39')](_0x1e084c,_0x227f4a);}return _0xe2beaf;}function getCustomFields(_0x18bd22,_0xcc4e48){var _0x1be1fc=[];var _0xc6618c={'custom_fields':[]};if(_0x18bd22[_0xe765('0x2a')]>0x0){_['forEach'](_0x18bd22,function(_0x1f7da2){if(_0x1f7da2[_0xe765('0x3a')]===_0xe765('0x3b')&&_0x1f7da2['nameField']&&!_0x1f7da2['customField']){_0xc6618c[_0x1f7da2['nameField'][_0xe765('0x3c')]()]=_0x1f7da2['content'][_0xe765('0x3d')]();}else if(_0x1f7da2[_0xe765('0x3a')]===_0xe765('0x3b')&&_0x1f7da2[_0xe765('0x3e')]&&_0x1f7da2['customField']){_0xc6618c[_0xe765('0x3f')][_0xe765('0x40')]({'id':_0x1f7da2[_0xe765('0x3e')],'value':_0x1f7da2[_0xe765('0x41')][_0xe765('0x3d')]()});}else if(_0x1f7da2[_0xe765('0x3a')]===_0xe765('0x42')&&_0x1f7da2[_0xe765('0x43')]&&_0x1f7da2[_0xe765('0x3e')]&&_0x1f7da2[_0xe765('0x44')]){_0xcc4e48[_0x1f7da2['variableName']]&&_0xc6618c[_0xe765('0x3f')]['push']({'id':_0x1f7da2[_0xe765('0x3e')],'value':_0xcc4e48[_0x1f7da2[_0xe765('0x43')]]['toString']()});}else if(_0x1f7da2[_0xe765('0x3a')]==='customVariable'&&_0x1f7da2['Variable']&&_0x1f7da2['Variable'][_0xe765('0x13')]&&_0x1f7da2[_0xe765('0x3e')]&&_0x1f7da2[_0xe765('0x44')]){_0xcc4e48[_0x1f7da2['Variable'][_0xe765('0x13')][_0xe765('0x3c')]()]&&_0xc6618c[_0xe765('0x3f')][_0xe765('0x40')]({'id':_0x1f7da2[_0xe765('0x3e')],'value':_0xcc4e48[_0x1f7da2[_0xe765('0x45')][_0xe765('0x13')][_0xe765('0x3c')]()][_0xe765('0x3d')]()});}});}return _0xc6618c;}exports['queue']=function(_0x374a32,_0x5d0a15,_0x57405f,_0x33eac6,_0x4d4d13,_0x1b9580){var _0xc3ed99,_0x1707aa;_0x1b9580['remoteUri']=intUtil[_0xe765('0x46')](_0x1b9580['remoteUri']);_0x1b9580[_0xe765('0x47')]=intUtil[_0xe765('0x46')](_0x1b9580[_0xe765('0x47')]);if(_0x4d4d13&&_0x4d4d13['monitor_format']){logger[_0xe765('0xf')](_0xe765('0x48'),_0xe765('0x49'));_0x5d0a15[_0xe765('0x4a')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1b9580['serverUrl'],_0x5d0a15[_0xe765('0x4b')],md5(_0x5d0a15[_0xe765('0x4b')]));}else{_0x5d0a15[_0xe765('0x4a')]='';}headers['Authorization']=getAuth(_0x1b9580);return getUser(_0x1b9580,_0x33eac6[_0xe765('0x4c')])['then'](function(_0x10fb48){_0xc3ed99=_0x10fb48;logger[_0xe765('0xf')](_0xe765('0x4d'),_0xc3ed99['id']);return getEndUser(_0x1b9580,_0x5d0a15[_0xe765('0x4e')],_0x5d0a15[_0xe765('0x4f')]);})[_0xe765('0x18')](function(_0x4a7c2a){_0x1707aa=_0x4a7c2a;logger[_0xe765('0xf')](_0xe765('0x50'),_0x1707aa['id']);return getTicket(_0x1b9580,_0xc3ed99,_0x1707aa,_0x57405f,_0x5d0a15);})[_0xe765('0x18')](function(_0x1214a8){if(_0x1214a8){logger[_0xe765('0xf')](_0xe765('0x51'),_0x1214a8['id']);switch(_0x1b9580['type']){case'integrationTab':logger[_0xe765('0xf')](_0xe765('0x48'),_0xe765('0x52'));return request({'uri':util['format'](_0xe765('0x53'),_0x1b9580[_0xe765('0x1e')],_0xc3ed99['id'],_0x1214a8['id']),'method':_0xe765('0x54')});case _0xe765('0x55'):logger[_0xe765('0xf')](_0xe765('0x48'),_0xe765('0x56'));emit(util[_0xe765('0x10')]('user:%s',_0x33eac6['name']),_0xe765('0x57'),{'uri':util['format'](_0xe765('0x58'),_0x1b9580[_0xe765('0x1e')],_0x1214a8['id'])});break;default:logger[_0xe765('0x59')]('[QUEUE]',_0xe765('0x5a'));}}})[_0xe765('0x5b')](function(_0x5dd192){logger[_0xe765('0x59')](_0xe765('0x5c'),util[_0xe765('0x5d')](_0x5dd192,{'showHidden':!![],'depth':null}));});};exports[_0xe765('0x5e')]=function(_0xabbaa1,_0x1de0af,_0x3fa5df,_0x361e36,_0x45be53,_0x1f6da3,_0x2e122d){var _0x2763f7,_0x333929;_0x1f6da3['remoteUri']=intUtil[_0xe765('0x46')](_0x1f6da3[_0xe765('0x1e')]);_0x1f6da3[_0xe765('0x47')]=intUtil[_0xe765('0x46')](_0x1f6da3[_0xe765('0x47')]);if(_0x2e122d&&_0x2e122d[_0xe765('0x5f')]&&_0x2e122d[_0xe765('0x5f')]!==_0xe765('0x60')){logger[_0xe765('0xf')]('[OUTBOUND]',_0xe765('0x49'));_0x1de0af['recordingURL']=util[_0xe765('0x10')](_0xe765('0x61'),_0x1f6da3['serverUrl'],_0x1de0af[_0xe765('0x4b')],md5(_0x1de0af[_0xe765('0x4b')]));}headers[_0xe765('0x62')]=getAuth(_0x1f6da3);return getUser(_0x1f6da3,_0x361e36[_0xe765('0x4c')])[_0xe765('0x18')](function(_0x1c2d34){_0x2763f7=_0x1c2d34;logger[_0xe765('0xf')]('The\x20User\x20ID\x20is:',_0x2763f7['id']);return getEndUser(_0x1f6da3,_0x1de0af[_0xe765('0x63')],_0x1de0af[_0xe765('0x64')]);})['then'](function(_0x413849){_0x333929=_0x413849;logger[_0xe765('0xf')](_0xe765('0x50'),_0x333929['id']);return getTicket(_0x1f6da3,_0x2763f7,_0x333929,_0x3fa5df,_0x1de0af);})['then'](function(_0x4e3e9a){if(_0x4e3e9a){logger[_0xe765('0xf')](_0xe765('0x51'),_0x4e3e9a['id']);switch(_0x1f6da3['type']){case'integrationTab':logger['info'](_0xe765('0x65'),_0xe765('0x52'));return request({'uri':util['format']('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x1f6da3[_0xe765('0x1e')],_0x2763f7['id'],_0x4e3e9a['id']),'method':'POST'});case _0xe765('0x55'):logger[_0xe765('0xf')](_0xe765('0x65'),_0xe765('0x56'));emit(util[_0xe765('0x10')](_0xe765('0x66'),_0x361e36[_0xe765('0x13')]),_0xe765('0x57'),{'uri':util[_0xe765('0x10')](_0xe765('0x58'),_0x1f6da3[_0xe765('0x1e')],_0x4e3e9a['id'])});break;default:logger['error'](_0xe765('0x65'),_0xe765('0x5a'));}}})[_0xe765('0x5b')](function(_0x2b30cd){logger['error'](_0xe765('0x67'),util[_0xe765('0x5d')](_0x2b30cd,{'showHidden':!![],'depth':null}));});};exports[_0xe765('0x68')]=function(_0x4c5d81,_0x20ad2a,_0x4a9673,_0x46f77b,_0x129468,_0x349c56){var _0x41a96d,_0x394aea;_0x349c56[_0xe765('0x1e')]=intUtil[_0xe765('0x46')](_0x349c56[_0xe765('0x1e')]);_0x349c56[_0xe765('0x47')]=intUtil[_0xe765('0x46')](_0x349c56['serverUrl']);if(_0x129468&&_0x129468[_0xe765('0x69')]){logger[_0xe765('0xf')]('['+_0x20ad2a['lastevent'][_0xe765('0x6a')]()+']',_0xe765('0x49'));_0x20ad2a[_0xe765('0x4a')]=util[_0xe765('0x10')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x349c56[_0xe765('0x47')],_0x20ad2a[_0xe765('0x4b')],md5(_0x20ad2a[_0xe765('0x4b')]));}else{_0x20ad2a[_0xe765('0x4a')]='';}headers[_0xe765('0x62')]=getAuth(_0x349c56);return getUser(_0x349c56)[_0xe765('0x18')](function(_0x77e081){_0x41a96d=_0x77e081;logger[_0xe765('0xf')]('The\x20User\x20ID\x20is:',_0x41a96d['id']);return getEndUser(_0x349c56,_0x20ad2a['calleridname'],_0x20ad2a[_0xe765('0x4f')]);})[_0xe765('0x18')](function(_0x529aaf){_0x394aea=_0x529aaf;logger[_0xe765('0xf')](_0xe765('0x50'),_0x394aea['id']);return getTicket(_0x349c56,_0x41a96d,_0x394aea,_0x4a9673,_0x20ad2a);})[_0xe765('0x18')](function(_0x4cd09a){if(_0x4cd09a){logger[_0xe765('0xf')](_0xe765('0x51'),_0x4cd09a['id']);}})[_0xe765('0x5b')](function(_0x9dfef3){logger[_0xe765('0x59')]('['+_0x20ad2a[_0xe765('0x6b')][_0xe765('0x6a')]()+']'+_0xe765('0x6c'),util[_0xe765('0x5d')](_0x9dfef3,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x7af2=['string','customField','nameField','toLowerCase','content','idField','custom_fields','push','variable','variableName','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','POST','newTab','user:%s','trigger:browser:url','%s/agent/tickets/%s','error','Zendesk\x20account\x20type\x20not\x20recognized','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','catch','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','inspect','unmanaged','lastevent','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','request-promise','md5','util','ioredis','../../../../config/environment','../../../../config/logger','zendesk','redis','defaults','localhost','socket.io-emitter','emit','application/json','Creating\x20new\x20ticket...','remoteUri','merge','name','getString','Subjects','Descriptions','Fields','then','info','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','count','Agent\x20found!','results','agent','format','%s/users/me.json','Admin\x20account\x20selected.','user','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','length','filter','end-user','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Enduser\x20created.','authType','password','%s:%s','token','%s/token:%s','username','Basic\x20%s','toString','base64','[HTTP]','stringify','map','forEach','type'];(function(_0x1305ab,_0x38c3aa){var _0x387c88=function(_0x4fbcd7){while(--_0x4fbcd7){_0x1305ab['push'](_0x1305ab['shift']());}};_0x387c88(++_0x38c3aa);}(_0x7af2,0x119));var _0x27af=function(_0x5c41e9,_0x435daf){_0x5c41e9=_0x5c41e9-0x0;var _0x2dcb5c=_0x7af2[_0x5c41e9];return _0x2dcb5c;};'use strict';var _=require('lodash');var rp=require(_0x27af('0x0'));var md5=require(_0x27af('0x1'));var util=require(_0x27af('0x2'));var Redis=require(_0x27af('0x3'));var intUtil=require('./util');var config=require(_0x27af('0x4'));var logger=require(_0x27af('0x5'))(_0x27af('0x6'));config[_0x27af('0x7')]=_[_0x27af('0x8')](config[_0x27af('0x7')],{'host':_0x27af('0x9'),'port':0x18eb});var io=require(_0x27af('0xa'))(new Redis(config[_0x27af('0x7')]));function emit(_0x572219,_0x1e2509,_0x366868){io['to'](_0x572219)[_0x27af('0xb')](_0x1e2509,_0x366868);}var headers={'Content-Type':'application/json','Accept':_0x27af('0xc')};function getTicket(_0xfa1882,_0x5841aa,_0x4e27bf,_0x1617c0,_0x582a9e){logger['info'](_0x27af('0xd'));return request({'uri':util['format']('%s/tickets.json',_0xfa1882[_0x27af('0xe')]),'method':'POST','body':{'ticket':_[_0x27af('0xf')]({'requester_id':_0x4e27bf['id'],'submitter_id':_0x5841aa?_0x5841aa['id']:undefined,'assignee_id':_0x5841aa?_0x5841aa['id']:undefined,'tags':getTags(_0x1617c0['Tags'],_0x27af('0x10')),'subject':intUtil[_0x27af('0x11')](_0x1617c0[_0x27af('0x12')],_0x582a9e,'\x20'),'description':intUtil[_0x27af('0x11')](_0x1617c0[_0x27af('0x13')],_0x582a9e,'\x0a'),'comment':{'public':![],'body':intUtil[_0x27af('0x11')](_0x1617c0[_0x27af('0x13')],_0x582a9e,'\x0a')}},getCustomFields(_0x1617c0[_0x27af('0x14')],_0x582a9e))}})[_0x27af('0x15')](function(_0x4724e0){logger[_0x27af('0x16')](_0x27af('0x17'));return _0x4724e0[_0x27af('0x18')];});}function getUser(_0x3102c4,_0x2bfc9){if(intUtil[_0x27af('0x19')](_0x2bfc9)){logger[_0x27af('0x16')](_0x27af('0x1a'),_0x2bfc9);return request({'uri':util['format'](_0x27af('0x1b'),_0x3102c4[_0x27af('0xe')]),'qs':{'query':util['format']('type:user\x20role:agent\x20email:%s',_0x2bfc9)}})[_0x27af('0x15')](function(_0x478572){if(_0x478572[_0x27af('0x1c')]){logger[_0x27af('0x16')](_0x27af('0x1d'));return _['find'](_0x478572[_0x27af('0x1e')],{'email':_0x2bfc9,'role':_0x27af('0x1f')});}else{logger[_0x27af('0x16')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x27af('0x20')](_0x27af('0x21'),_0x3102c4[_0x27af('0xe')])})['then'](function(_0x2dce2b){logger[_0x27af('0x16')](_0x27af('0x22'));return _0x2dce2b[_0x27af('0x23')];});}});}else{logger[_0x27af('0x16')](_0x27af('0x24'));return request({'uri':util[_0x27af('0x20')](_0x27af('0x21'),_0x3102c4[_0x27af('0xe')])})['then'](function(_0x50c3ab){logger['info'](_0x27af('0x22'));return _0x50c3ab['user'];});}}function getEndUser(_0x12625c,_0x396326,_0x4ba49f){logger[_0x27af('0x16')](_0x27af('0x25'),_0x4ba49f);return request({'uri':util[_0x27af('0x20')](_0x27af('0x1b'),_0x12625c[_0x27af('0xe')]),'qs':{'query':util[_0x27af('0x20')](_0x27af('0x26'),_0x4ba49f)}})['then'](function(_0x14d5fc){var _0x250d5b;if(_0x14d5fc[_0x27af('0x1e')][_0x27af('0x27')]){_0x14d5fc[_0x27af('0x1e')]=_[_0x27af('0x28')](_0x14d5fc[_0x27af('0x1e')],{'suspended':![],'role':_0x27af('0x29')});if(_0x14d5fc[_0x27af('0x1e')][_0x27af('0x27')]){_0x250d5b=_[_0x27af('0x2a')](_0x14d5fc['results']);}}if(_0x250d5b){logger[_0x27af('0x16')](_0x27af('0x2b'));return _0x250d5b;}else{logger[_0x27af('0x16')](_0x27af('0x2c'));return request({'uri':util[_0x27af('0x20')](_0x27af('0x2d'),_0x12625c['remoteUri']),'method':'POST','body':{'user':{'role':_0x27af('0x29'),'name':util[_0x27af('0x20')]('Caller\x20-\x20%s',_0x396326||_0x4ba49f),'phone':_0x4ba49f}}})[_0x27af('0x15')](function(_0x46ba86){logger[_0x27af('0x16')](_0x27af('0x2e'));return _0x46ba86[_0x27af('0x23')];});}});}function getAuth(_0x212983){var _0x469ab4;if(_0x212983[_0x27af('0x2f')]===_0x27af('0x30')){_0x469ab4=util[_0x27af('0x20')](_0x27af('0x31'),_0x212983['username'],_0x212983['password']);}else if(_0x212983[_0x27af('0x2f')]===_0x27af('0x32')){_0x469ab4=util['format'](_0x27af('0x33'),_0x212983[_0x27af('0x34')],_0x212983['token']);}return util[_0x27af('0x20')](_0x27af('0x35'),new Buffer(_0x469ab4)[_0x27af('0x36')](_0x27af('0x37')));}function request(_0x411205){logger['debug'](_0x27af('0x38'),JSON[_0x27af('0x39')](_0x411205));return rp(_['defaults'](_0x411205,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x86975,_0x42fda8){var _0xee2157=[];if(_0x86975&&_0x86975[_0x27af('0x27')]>0x0){_0xee2157=_[_0x27af('0x3a')](_0x86975,_0x42fda8);}return _0xee2157;}function getCustomFields(_0xd58131,_0x53144b){var _0x16eff4=[];var _0x506474={'custom_fields':[]};if(_0xd58131[_0x27af('0x27')]>0x0){_[_0x27af('0x3b')](_0xd58131,function(_0x2a6b14){if(_0x2a6b14[_0x27af('0x3c')]===_0x27af('0x3d')&&_0x2a6b14['nameField']&&!_0x2a6b14[_0x27af('0x3e')]){_0x506474[_0x2a6b14[_0x27af('0x3f')][_0x27af('0x40')]()]=_0x2a6b14[_0x27af('0x41')][_0x27af('0x36')]();}else if(_0x2a6b14[_0x27af('0x3c')]===_0x27af('0x3d')&&_0x2a6b14[_0x27af('0x42')]&&_0x2a6b14[_0x27af('0x3e')]){_0x506474[_0x27af('0x43')][_0x27af('0x44')]({'id':_0x2a6b14[_0x27af('0x42')],'value':_0x2a6b14[_0x27af('0x41')][_0x27af('0x36')]()});}else if(_0x2a6b14['type']===_0x27af('0x45')&&_0x2a6b14[_0x27af('0x46')]&&_0x2a6b14[_0x27af('0x42')]&&_0x2a6b14[_0x27af('0x3e')]){_0x53144b[_0x2a6b14['variableName']]&&_0x506474[_0x27af('0x43')]['push']({'id':_0x2a6b14['idField'],'value':_0x53144b[_0x2a6b14[_0x27af('0x46')]][_0x27af('0x36')]()});}else if(_0x2a6b14[_0x27af('0x3c')]===_0x27af('0x47')&&_0x2a6b14[_0x27af('0x48')]&&_0x2a6b14[_0x27af('0x48')][_0x27af('0x10')]&&_0x2a6b14[_0x27af('0x42')]&&_0x2a6b14[_0x27af('0x3e')]){_0x53144b[_0x2a6b14[_0x27af('0x48')][_0x27af('0x10')][_0x27af('0x40')]()]&&_0x506474['custom_fields'][_0x27af('0x44')]({'id':_0x2a6b14[_0x27af('0x42')],'value':_0x53144b[_0x2a6b14['Variable']['name'][_0x27af('0x40')]()][_0x27af('0x36')]()});}});}return _0x506474;}exports[_0x27af('0x49')]=function(_0x3e7c52,_0x1bd775,_0x562961,_0x4b7e7e,_0x483c8e,_0x2df0ac){var _0x24b191,_0x200c2b;_0x2df0ac[_0x27af('0xe')]=intUtil[_0x27af('0x4a')](_0x2df0ac[_0x27af('0xe')]);_0x2df0ac[_0x27af('0x4b')]=intUtil['stripTrailingSlash'](_0x2df0ac['serverUrl']);if(_0x483c8e&&_0x483c8e[_0x27af('0x4c')]){logger['info'](_0x27af('0x4d'),_0x27af('0x4e'));_0x1bd775[_0x27af('0x4f')]=util[_0x27af('0x20')](_0x27af('0x50'),_0x2df0ac[_0x27af('0x4b')],_0x1bd775[_0x27af('0x51')],md5(_0x1bd775['uniqueid']));}else{_0x1bd775[_0x27af('0x4f')]='';}headers[_0x27af('0x52')]=getAuth(_0x2df0ac);return getUser(_0x2df0ac,_0x4b7e7e[_0x27af('0x53')])[_0x27af('0x15')](function(_0x1418c9){_0x24b191=_0x1418c9;logger['info'](_0x27af('0x54'),_0x24b191['id']);return getEndUser(_0x2df0ac,_0x1bd775[_0x27af('0x55')],_0x1bd775[_0x27af('0x56')]);})['then'](function(_0x4e95be){_0x200c2b=_0x4e95be;logger[_0x27af('0x16')](_0x27af('0x57'),_0x200c2b['id']);return getTicket(_0x2df0ac,_0x24b191,_0x200c2b,_0x562961,_0x1bd775);})[_0x27af('0x15')](function(_0x5be44f){if(_0x5be44f){logger['info'](_0x27af('0x58'),_0x5be44f['id']);switch(_0x2df0ac['type']){case _0x27af('0x59'):logger[_0x27af('0x16')](_0x27af('0x4d'),_0x27af('0x5a'));return request({'uri':util[_0x27af('0x20')](_0x27af('0x5b'),_0x2df0ac[_0x27af('0xe')],_0x24b191['id'],_0x5be44f['id']),'method':_0x27af('0x5c')});case _0x27af('0x5d'):logger[_0x27af('0x16')](_0x27af('0x4d'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x27af('0x20')](_0x27af('0x5e'),_0x4b7e7e[_0x27af('0x10')]),_0x27af('0x5f'),{'uri':util[_0x27af('0x20')](_0x27af('0x60'),_0x2df0ac[_0x27af('0xe')],_0x5be44f['id'])});break;default:logger[_0x27af('0x61')]('[QUEUE]',_0x27af('0x62'));}}})['catch'](function(_0x424dff){logger[_0x27af('0x61')](_0x27af('0x63'),util['inspect'](_0x424dff,{'showHidden':!![],'depth':null}));});};exports[_0x27af('0x64')]=function(_0x58be3a,_0x199fd6,_0x232715,_0x4769ff,_0x5bf8b0,_0x1104f2,_0x4c4044){var _0x2e44a8,_0x58d731;_0x1104f2[_0x27af('0xe')]=intUtil[_0x27af('0x4a')](_0x1104f2[_0x27af('0xe')]);_0x1104f2['serverUrl']=intUtil['stripTrailingSlash'](_0x1104f2[_0x27af('0x4b')]);if(_0x4c4044&&_0x4c4044[_0x27af('0x65')]&&_0x4c4044[_0x27af('0x65')]!==_0x27af('0x66')){logger['info'](_0x27af('0x67'),_0x27af('0x4e'));_0x199fd6[_0x27af('0x4f')]=util[_0x27af('0x20')](_0x27af('0x50'),_0x1104f2[_0x27af('0x4b')],_0x199fd6['uniqueid'],md5(_0x199fd6[_0x27af('0x51')]));}headers[_0x27af('0x52')]=getAuth(_0x1104f2);return getUser(_0x1104f2,_0x4769ff[_0x27af('0x53')])[_0x27af('0x15')](function(_0x49eb46){_0x2e44a8=_0x49eb46;logger[_0x27af('0x16')]('The\x20User\x20ID\x20is:',_0x2e44a8['id']);return getEndUser(_0x1104f2,_0x199fd6[_0x27af('0x68')],_0x199fd6[_0x27af('0x69')]);})['then'](function(_0x2bcae1){_0x58d731=_0x2bcae1;logger[_0x27af('0x16')]('The\x20Enduser\x20ID\x20is:',_0x58d731['id']);return getTicket(_0x1104f2,_0x2e44a8,_0x58d731,_0x232715,_0x199fd6);})['then'](function(_0x38773e){if(_0x38773e){logger[_0x27af('0x16')](_0x27af('0x58'),_0x38773e['id']);switch(_0x1104f2['type']){case _0x27af('0x59'):logger[_0x27af('0x16')]('[OUTBOUND]',_0x27af('0x5a'));return request({'uri':util[_0x27af('0x20')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x1104f2['remoteUri'],_0x2e44a8['id'],_0x38773e['id']),'method':_0x27af('0x5c')});case _0x27af('0x5d'):logger['info']('[OUTBOUND]',_0x27af('0x6a'));emit(util[_0x27af('0x20')](_0x27af('0x5e'),_0x4769ff[_0x27af('0x10')]),_0x27af('0x5f'),{'uri':util[_0x27af('0x20')](_0x27af('0x60'),_0x1104f2['remoteUri'],_0x38773e['id'])});break;default:logger['error'](_0x27af('0x67'),_0x27af('0x62'));}}})[_0x27af('0x6b')](function(_0x881c59){logger[_0x27af('0x61')](_0x27af('0x6c'),util[_0x27af('0x6d')](_0x881c59,{'showHidden':!![],'depth':null}));});};exports[_0x27af('0x6e')]=function(_0x1a7c0e,_0x13c9ff,_0x444f21,_0x37c44d,_0x12fa65,_0x2c6bbc){var _0x3bfd28,_0x4932b8;_0x2c6bbc[_0x27af('0xe')]=intUtil['stripTrailingSlash'](_0x2c6bbc[_0x27af('0xe')]);_0x2c6bbc[_0x27af('0x4b')]=intUtil['stripTrailingSlash'](_0x2c6bbc[_0x27af('0x4b')]);if(_0x12fa65&&_0x12fa65[_0x27af('0x4c')]){logger[_0x27af('0x16')]('['+_0x13c9ff[_0x27af('0x6f')][_0x27af('0x70')]()+']',_0x27af('0x4e'));_0x13c9ff['recordingURL']=util[_0x27af('0x20')](_0x27af('0x50'),_0x2c6bbc[_0x27af('0x4b')],_0x13c9ff['uniqueid'],md5(_0x13c9ff['uniqueid']));}else{_0x13c9ff[_0x27af('0x4f')]='';}headers['Authorization']=getAuth(_0x2c6bbc);return getUser(_0x2c6bbc)[_0x27af('0x15')](function(_0x3f1f9f){_0x3bfd28=_0x3f1f9f;logger[_0x27af('0x16')](_0x27af('0x54'),_0x3bfd28['id']);return getEndUser(_0x2c6bbc,_0x13c9ff[_0x27af('0x55')],_0x13c9ff['calleridnum']);})[_0x27af('0x15')](function(_0x30ec84){_0x4932b8=_0x30ec84;logger['info'](_0x27af('0x57'),_0x4932b8['id']);return getTicket(_0x2c6bbc,_0x3bfd28,_0x4932b8,_0x444f21,_0x13c9ff);})[_0x27af('0x15')](function(_0x52208b){if(_0x52208b){logger['info'](_0x27af('0x58'),_0x52208b['id']);}})[_0x27af('0x6b')](function(_0x3e8b56){logger[_0x27af('0x61')]('['+_0x13c9ff[_0x27af('0x6f')][_0x27af('0x70')]()+']'+_0x27af('0x71'),util['inspect'](_0x3e8b56,{'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 52a9427..9cbf969 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 _0xa49b=['https://crm.','unmanaged','toUpperCase','calleridname','request-promise','md5','util','./util','ioredis','bluebird','../../../../config/environment','zoho','redis','defaults','localhost','emit','debug','[HTTP]','idField','type','variable','variableName','customVariable','Variable','name','toLowerCase','toString','indexOf','split','isNil','access_token','isBefore','expires_in','https://accounts.zoho.com.au','https://accounts.zoho.eu','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','then','add','seconds','catch','error','stack','info','Search\x20user','GET','format','ActiveUsers','users','isArrayLikeObject','Agent\x20found!','profile','Administrator','stringify','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','The\x20failing\x20result\x20is','enduserType','https://www.zohoapis.','startCase','moduleCreate','role','first_name','last_name','Zoho-oauthtoken\x20','data','code','SUCCESS','details','Error:\x20','log','moduleSearch','contact_lead','uri','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','contact','/crm/v2/Contacts/search?criteria=((Phone:equals:','Creating\x20new\x20call...','Owner','administrator','Subject','Subjects','Description','getString','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','$se_module','talktime','utc','mm:ss','answertime','Call_Duration','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','lastevent','Call_Result','Called','complete','Answered','rejected','Rejected','abandoned','Abandoned','timeout','Timeout','outbound','Call_Type','Inbound','Fields','/crm/v2/Calls','err','queue','host','stripTrailingSlash','serverUrl','recordingURL','/api/voice/recordings/','/downloads?type=uniqueid&token=','zoho.eu','The\x20User\x20ID\x20is:','calleridnum','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','/crm/EntityInfo.do?module=Calls&id=','[QUEUE]','recordingFormat','none','Recording\x20is\x20enabled!','uniqueid','com','destcalleridnum','[OUTBOUND]'];(function(_0xed8e74,_0x17b96d){var _0x5b7826=function(_0x50cd09){while(--_0x50cd09){_0xed8e74['push'](_0xed8e74['shift']());}};_0x5b7826(++_0x17b96d);}(_0xa49b,0x126));var _0xba49=function(_0x24d9ec,_0x4e7855){_0x24d9ec=_0x24d9ec-0x0;var _0x529bf8=_0xa49b[_0x24d9ec];return _0x529bf8;};'use strict';var _=require('lodash');var rp=require(_0xba49('0x0'));var md5=require(_0xba49('0x1'));var util=require(_0xba49('0x2'));var intUtil=require(_0xba49('0x3'));var moment=require('moment');var Redis=require(_0xba49('0x4'));var BPromise=require(_0xba49('0x5'));var config=require(_0xba49('0x6'));var logger=require('../../../../config/logger')(_0xba49('0x7'));config[_0xba49('0x8')]=_[_0xba49('0x9')](config['redis'],{'host':_0xba49('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xba49('0x8')]));function emit(_0x47340c,_0x2bfae5,_0x4f0b8c){io['to'](_0x47340c)[_0xba49('0xb')](_0x2bfae5,_0x4f0b8c);}function request(_0x249dd6){logger[_0xba49('0xc')](_0xba49('0xd'),JSON['stringify'](_0x249dd6));return rp(_0x249dd6);}function getCustomFields(_0x27ec37,_0x1c26a0){var _0x1e5a50={};if(_0x27ec37['length']>0x0){_['forEach'](_0x27ec37,function(_0x19d2f8){if(_0x19d2f8['type']==='string'&&_0x19d2f8['idField']){_0x1e5a50[_0x19d2f8[_0xba49('0xe')]]=_0x19d2f8['content']['toString']();}else if(_0x19d2f8[_0xba49('0xf')]===_0xba49('0x10')&&_0x19d2f8[_0xba49('0x11')]&&_0x19d2f8[_0xba49('0xe')]&&_0x1c26a0[_0x19d2f8['variableName']]){_0x1e5a50[_0x19d2f8[_0xba49('0xe')]]=_0x1c26a0[_0x19d2f8[_0xba49('0x11')]]['toString']();}else if(_0x19d2f8['type']===_0xba49('0x12')&&_0x19d2f8[_0xba49('0x13')]&&_0x19d2f8[_0xba49('0x13')][_0xba49('0x14')]&&_0x19d2f8['idField']&&_0x1c26a0[_0x19d2f8[_0xba49('0x13')][_0xba49('0x14')][_0xba49('0x15')]()]){_0x1e5a50[_0x19d2f8['idField']]=_0x1c26a0[_0x19d2f8[_0xba49('0x13')][_0xba49('0x14')][_0xba49('0x15')]()][_0xba49('0x16')]();}});}return _0x1e5a50;}function getName(_0x5d9f45){if(_0x5d9f45[_0xba49('0x17')]('\x20')>0x0){var _0x59af33=_0x5d9f45[_0xba49('0x18')](/ (.+)/);if(_0x59af33[0x1]){return _0x59af33;}}return[_0x5d9f45,_0x5d9f45];}var accountsTokens={};function getAccessToken(_0x5cd475){return new Promise(function(_0x2c6617,_0x36b21b){if(!_[_0xba49('0x19')](accountsTokens[_0x5cd475['id']])&&!_[_0xba49('0x19')](accountsTokens[_0x5cd475['id']][_0xba49('0x1a')])){if(moment()[_0xba49('0x1b')](accountsTokens[_0x5cd475['id']][_0xba49('0x1c')])){_0x2c6617(accountsTokens[_0x5cd475['id']][_0xba49('0x1a')]);}}var _0x2abc3b;switch(_0x5cd475['zone']){case'US':_0x2abc3b='https://accounts.zoho.com';break;case'AU':_0x2abc3b=_0xba49('0x1d');break;case'EU':_0x2abc3b=_0xba49('0x1e');break;case'IN':_0x2abc3b='https://accounts.zoho.in';break;case'CN':_0x2abc3b='https://accounts.zoho.com.cn';break;default:_0x2abc3b='https://accounts.zoho.eu';break;}var _0x4e65c4={'method':_0xba49('0x1f'),'uri':_0x2abc3b+_0xba49('0x20'),'qs':{'refresh_token':_0x5cd475[_0xba49('0x21')],'client_id':_0x5cd475[_0xba49('0x22')],'client_secret':_0x5cd475[_0xba49('0x23')],'grant_type':_0xba49('0x24')},'json':!![]};return rp(_0x4e65c4)[_0xba49('0x25')](function(_0x216e1e){accountsTokens[_0x5cd475['id']]={'access_token':_0x216e1e['access_token'],'expires_in':moment()[_0xba49('0x26')](_0x216e1e[_0xba49('0x1c')],_0xba49('0x27'))};_0x2c6617(_0x216e1e['access_token']);})[_0xba49('0x28')](function(_0xf4d76c){logger[_0xba49('0x29')]('Failing\x20creating\x20the\x20access_token',_0xf4d76c[_0xba49('0x2a')]);_0x36b21b(_0xf4d76c);});});}function getUser(_0x15f9ac,_0x529415,_0x2c0854,_0x3d62af){logger[_0xba49('0x2b')](_0xba49('0x2c'));return request({'method':_0xba49('0x2d'),'uri':util[_0xba49('0x2e')]('https://www.zohoapis.%s/crm/v2/users',_0x529415),'qs':{'type':_0xba49('0x2f')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x15f9ac},'json':!![]})[_0xba49('0x25')](function(_0x3a1ef4){if(_0x3a1ef4[_0xba49('0x30')]){var _0x47d776=-0x1;if(_[_0xba49('0x31')](_0x3a1ef4[_0xba49('0x30')])){if(!_[_0xba49('0x19')](_0x3d62af)){_0x47d776=_['findIndex'](_0x3a1ef4[_0xba49('0x30')],function(_0x1fe99c){return _0x1fe99c['email']===_0x3d62af;});}if(_0x47d776>=0x0){logger[_0xba49('0x2b')](_0xba49('0x32'));}else{logger[_0xba49('0x2b')]('Using\x20the\x20admin\x20account!');_0x47d776=_['findIndex'](_0x3a1ef4[_0xba49('0x30')],function(_0x3fdb3c){return _0x3fdb3c[_0xba49('0x33')][_0xba49('0x14')]===_0xba49('0x34');});}return _0x3a1ef4[_0xba49('0x30')][_0x47d776];}else{if(_0x3a1ef4['user'][_0xba49('0x33')][_0xba49('0x14')]==='Administrator'){logger[_0xba49('0x2b')]('Using\x20the\x20admin\x20account!');user=_0x3a1ef4['user'];return user;}else{logger[_0xba49('0x29')]('The\x20failing\x20result\x20is',JSON[_0xba49('0x35')](_0x3a1ef4));throw new Error(_0xba49('0x36')+JSON[_0xba49('0x35')](_0x3a1ef4));}}}else{logger[_0xba49('0x29')](_0xba49('0x37'),JSON[_0xba49('0x35')](_0x3a1ef4));throw new Error(_0xba49('0x36')+JSON[_0xba49('0x35')](_0x3a1ef4));}})[_0xba49('0x28')](function(_0x1e23b9){console['error'](_0x1e23b9);});}function getZohoUser(_0x219cdf,_0xda87d6){return new BPromise(function(_0x257a97,_0x115168){request(_0x219cdf)[_0xba49('0x25')](function(_0x38ad63){var _0x1a438f=null;if(_0x38ad63){_0x1a438f=_0x38ad63['data'][0x0];_0x1a438f[_0xba49('0x38')]=_0xda87d6;}_0x257a97(_0x1a438f);})['catch'](function(_0x1fe48e){_0x115168(_0x1fe48e);});});}function createEndUser(_0x532c40,_0x51b3e4,_0x2f47ae,_0xd14a74,_0x28e5fa,_0x484295){var _0x2f47ae=getName(_0x2f47ae);return request({'method':'POST','uri':_0xba49('0x39')+_0x51b3e4+'/crm/v2/'+_[_0xba49('0x3a')](_0x484295[_0xba49('0x3b')])+'s','body':{'data':[{'Last_Name':_0x2f47ae[0x1],'First_Name':_0x2f47ae[0x0],'Phone':_0xd14a74,'Owner':{'name':!_['isNil'](_0x28e5fa[_0xba49('0x3c')][_0xba49('0x14')])?_0x28e5fa[_0xba49('0x3c')][_0xba49('0x14')]:!_[_0xba49('0x19')](_0x28e5fa[_0xba49('0x3d')])?_0x28e5fa['first_name']+'\x20'+_0x28e5fa['last_name']:_0x28e5fa[_0xba49('0x3e')],'id':_0x28e5fa['id']}}]},'headers':{'Authorization':_0xba49('0x3f')+_0x532c40},'json':!![]})[_0xba49('0x25')](function(_0x1d61af){if(_0x1d61af&&_0x1d61af[_0xba49('0x40')][0x0][_0xba49('0x41')]===_0xba49('0x42')){var _0x1f69e2=_0x1d61af[_0xba49('0x40')][0x0][_0xba49('0x43')];_0x1f69e2[_0xba49('0x38')]=_[_0xba49('0x3a')](_0x484295[_0xba49('0x3b')])+'s';return _0x1f69e2;}logger[_0xba49('0x29')]('The\x20failing\x20result\x20is',JSON[_0xba49('0x35')](data));throw new Error(_0xba49('0x44')+JSON[_0xba49('0x35')](data));})['catch'](function(_0x2fca2e){console[_0xba49('0x45')]('CREATE\x20ERROR',_0x2fca2e);});}function getEndUser(_0x480949,_0x12dee5,_0x59a556,_0x2688ca,_0xa077b7,_0x3ef36f,_0x16f005){var _0x10e0a8={'method':_0xba49('0x2d'),'uri':'','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x480949},'json':!![]};switch(_0x16f005[_0xba49('0x46')]){case _0xba49('0x47'):_0x10e0a8[_0xba49('0x48')]=_0xba49('0x39')+_0x12dee5+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0xa077b7+'))';return getZohoUser(_0x10e0a8,_0xba49('0x49'))[_0xba49('0x25')](function(_0xd899bb){if(_0xd899bb)return _0xd899bb;_0x10e0a8['uri']='https://www.zohoapis.'+_0x12dee5+_0xba49('0x4a')+_0xa077b7+'))';return getZohoUser(_0x10e0a8,_0xba49('0x4b'))[_0xba49('0x25')](function(_0x4f5d27){if(_0x4f5d27)return _0x4f5d27;if(_0x16f005[_0xba49('0x3b')]!=_0xba49('0x4c')){return createEndUser(_0x480949,_0x12dee5,_0x2688ca,_0xa077b7,_0x3ef36f,_0x16f005);}else{return{};}});});break;case _0xba49('0x4d'):_0x10e0a8['uri']=_0xba49('0x39')+_0x12dee5+_0xba49('0x4e')+_0xa077b7+'))';return getZohoUser(_0x10e0a8,_0xba49('0x49'))[_0xba49('0x25')](function(_0xb1d7f3){if(_0xb1d7f3)return _0xb1d7f3;if(_0x16f005[_0xba49('0x3b')]!='nothing'){return createEndUser(_0x480949,_0x12dee5,_0x2688ca,_0xa077b7,_0x3ef36f,_0x16f005);}else{return{};}});break;case'lead':_0x10e0a8['uri']=_0xba49('0x39')+_0x12dee5+_0xba49('0x4a')+_0xa077b7+'))';return getZohoUser(_0x10e0a8,'Leads')[_0xba49('0x25')](function(_0x4061d6){if(_0x4061d6)return _0x4061d6;if(_0x16f005[_0xba49('0x3b')]!=_0xba49('0x4c')){return createEndUser(_0x480949,_0x12dee5,_0x2688ca,_0xa077b7,_0x3ef36f,_0x16f005);}else{return{};}});break;}}function getCall(_0x5b0e7f,_0x28c063,_0xa230ca,_0x57ab99,_0x1a5501,_0x4efab4,_0x56fc82,_0x3c87a2){logger['info'](_0xba49('0x4f'));var _0x137355={};_0x137355[_0xba49('0x50')]={'name':!_[_0xba49('0x19')](_0x57ab99[_0xba49('0x3c')][_0xba49('0x14')])&&!_['isNil'](_0x57ab99[_0xba49('0x33')][_0xba49('0x14')])&&_0x57ab99['profile']['name']===_0xba49('0x51')?_0x57ab99[_0xba49('0x3c')][_0xba49('0x14')]:!_[_0xba49('0x19')](_0x57ab99[_0xba49('0x3d')])?_0x57ab99[_0xba49('0x3d')]+'\x20'+_0x57ab99[_0xba49('0x3e')]:_0x57ab99[_0xba49('0x3e')],'id':_0x57ab99['id']};_0x137355[_0xba49('0x52')]=intUtil['getString'](_0x4efab4[_0xba49('0x53')],_0x56fc82,'\x20');_0x137355[_0xba49('0x54')]=intUtil[_0xba49('0x55')](_0x4efab4[_0xba49('0x56')],_0x56fc82,'\x0a');if(_0x1a5501[_0xba49('0x38')]===_0xba49('0x49')){_0x137355[_0xba49('0x57')]={'name':!_[_0xba49('0x19')](_0x1a5501[_0xba49('0x58')])?_0x1a5501[_0xba49('0x58')]:!_[_0xba49('0x19')](_0x1a5501['First_Name'])?_0x1a5501[_0xba49('0x59')]+'\x20'+_0x1a5501['Last_Name']:_0x1a5501['Last_Name'],'id':_0x1a5501['id']};}if(_0x1a5501[_0xba49('0x38')]===_0xba49('0x4b')){_0x137355['What_Id']={'name':!_['isNil'](_0x1a5501[_0xba49('0x58')])?_0x1a5501[_0xba49('0x58')]:!_['isNil'](_0x1a5501['First_Name'])?_0x1a5501[_0xba49('0x59')]+'\x20'+_0x1a5501[_0xba49('0x5a')]:_0x1a5501[_0xba49('0x5a')],'id':_0x1a5501['id']};_0x137355[_0xba49('0x5b')]=_[_0xba49('0x3a')](_0x1a5501['enduserType']);}if(_0x56fc82[_0xba49('0x5c')]){_0x137355['Call_Duration']=moment[_0xba49('0x5d')](parseInt(_0x56fc82['talktime'])*0x3e8)['format'](_0xba49('0x5e'));}else if(_0x56fc82[_0xba49('0x5f')]&&_0x56fc82['endtime']){_0x137355[_0xba49('0x60')]=moment[_0xba49('0x5d')](moment(_0x56fc82[_0xba49('0x61')],_0xba49('0x62'))[_0xba49('0x63')](moment(_0x56fc82[_0xba49('0x64')],_0xba49('0x62'))))['format'](_0xba49('0x5e'));}switch(_0x56fc82[_0xba49('0x65')]){case'called':_0x137355[_0xba49('0x66')]=_0xba49('0x67');break;case _0xba49('0x68'):case'connect':_0x137355[_0xba49('0x66')]=_0xba49('0x69');break;case _0xba49('0x6a'):_0x137355['Call_Result']=_0xba49('0x6b');break;case _0xba49('0x6c'):_0x137355['Call_Result']=_0xba49('0x6d');break;case _0xba49('0x6e'):_0x137355[_0xba49('0x66')]=_0xba49('0x6f');default:}_0x137355['Call_Start_Time']=(_0x3c87a2===_0xba49('0x70')?moment(_0x56fc82[_0xba49('0x64')])[_0xba49('0x2e')](_0xba49('0x62')):moment(_0x56fc82['agentcalledAt'])['format']('YYYY-MM-DDTHH:mm:ss'))||moment()[_0xba49('0x2e')]('YYYY-MM-DDTHH:mm:ss');_0x137355[_0xba49('0x71')]=_0x3c87a2||_0xba49('0x72');_0x137355=_['merge'](_0x137355,getCustomFields(_0x4efab4[_0xba49('0x73')],_0x56fc82));return request({'method':_0xba49('0x1f'),'uri':'https://www.zohoapis.'+_0x28c063+_0xba49('0x74'),'headers':{'Authorization':_0xba49('0x3f')+_0x5b0e7f},'body':{'data':[_0x137355]},'json':!![]})['then'](function(_0x2d64b4){if(_0x2d64b4&&_0x2d64b4[_0xba49('0x40')][0x0]['code']===_0xba49('0x42')){logger[_0xba49('0x2b')]('Call\x20created!');return{'id':_0x2d64b4[_0xba49('0x40')][0x0][_0xba49('0x43')]['id']};}})[_0xba49('0x28')](function(_0x3f1a43){logger[_0xba49('0x2b')]('err',_0x3f1a43[_0xba49('0x2a')]);console[_0xba49('0x45')](_0xba49('0x75'),_0x3f1a43);});}exports[_0xba49('0x76')]=function(_0x22d4e3,_0x51c167,_0x27b43e,_0x5b0200,_0x162c0a,_0x29ca82){var _0x53e6b0,_0x5b7b61,_0x2d582b;_0x29ca82[_0xba49('0x77')]=intUtil[_0xba49('0x78')](_0x29ca82[_0xba49('0x77')]);_0x29ca82[_0xba49('0x79')]=intUtil['stripTrailingSlash'](_0x29ca82[_0xba49('0x79')]);if(_0x162c0a&&_0x162c0a['monitor_format']){logger['info']('[QUEUE]','Recording\x20is\x20enabled!');_0x51c167[_0xba49('0x7a')]=_0x29ca82[_0xba49('0x79')]+_0xba49('0x7b')+_0x51c167['uniqueid']+_0xba49('0x7c')+md5(_0x51c167['uniqueid']);}else{_0x51c167[_0xba49('0x7a')]='';}var _0x3536fc=_0x29ca82[_0xba49('0x77')]===_0xba49('0x7d')?'eu':'com';return getAccessToken(_0x29ca82)[_0xba49('0x25')](function(_0x240c45){_0x2d582b=_0x240c45;return getUser(_0x2d582b,_0x3536fc,_0x29ca82,_0x5b0200['email']);})[_0xba49('0x25')](function(_0x442115){_0x53e6b0=_0x442115;logger[_0xba49('0x2b')](_0xba49('0x7e'),_0x53e6b0['id']);return getEndUser(_0x2d582b,_0x3536fc,_0x29ca82,_0x51c167['calleridname'],_0x51c167[_0xba49('0x7f')],_0x53e6b0,_0x27b43e);})['then'](function(_0x513087){_0x5b7b61=_0x513087;return getCall(_0x2d582b,_0x3536fc,_0x29ca82,_0x53e6b0,_0x5b7b61,_0x27b43e,_0x51c167,_0xba49('0x72'));})['then'](function(_0x30d5cf){if(_0x30d5cf){logger[_0xba49('0x2b')](_0xba49('0x80'),_0x30d5cf['id']);logger['info']('[QUEUE]',_0xba49('0x81'));emit(util[_0xba49('0x2e')](_0xba49('0x82'),_0x5b0200['name']),_0xba49('0x83'),{'uri':'https://crm.'+_0x29ca82[_0xba49('0x77')]+_0xba49('0x84')+_0x30d5cf['id']});}})['catch'](function(_0x441b47){logger[_0xba49('0x29')](_0xba49('0x85'),JSON[_0xba49('0x35')](_0x441b47));});};exports[_0xba49('0x70')]=function(_0x5bbd53,_0x1f0045,_0x10bde4,_0x2970cc,_0x258c14,_0x40da98,_0x28de5c){var _0x37d4e3,_0x509736,_0x1333f1;_0x40da98['host']=intUtil[_0xba49('0x78')](_0x40da98['host']);_0x40da98['serverUrl']=intUtil[_0xba49('0x78')](_0x40da98[_0xba49('0x79')]);if(_0x28de5c&&_0x28de5c[_0xba49('0x86')]&&_0x28de5c['recordingFormat']!==_0xba49('0x87')){logger[_0xba49('0x2b')]('[OUTBOUND]',_0xba49('0x88'));_0x1f0045[_0xba49('0x7a')]=_0x40da98[_0xba49('0x79')]+_0xba49('0x7b')+_0x1f0045[_0xba49('0x89')]+_0xba49('0x7c')+md5(_0x1f0045[_0xba49('0x89')]);}var _0x452b47=_0x40da98[_0xba49('0x77')]===_0xba49('0x7d')?'eu':_0xba49('0x8a');return getAccessToken(_0x40da98)['then'](function(_0x54b740){_0x1333f1=_0x54b740;return getUser(_0x1333f1,_0x452b47,_0x40da98,_0x2970cc['email']);})[_0xba49('0x25')](function(_0x23eac0){_0x37d4e3=_0x23eac0;logger[_0xba49('0x2b')](_0xba49('0x7e'),_0x37d4e3['id']);return getEndUser(_0x1333f1,_0x452b47,_0x40da98,_0x1f0045['destcalleridname'],_0x1f0045[_0xba49('0x8b')],_0x37d4e3,_0x10bde4);})['then'](function(_0x1a25f0){_0x509736=_0x1a25f0;return getCall(_0x1333f1,_0x452b47,_0x40da98,_0x37d4e3,_0x509736,_0x10bde4,_0x1f0045,'Outbound');})[_0xba49('0x25')](function(_0x207467){if(_0x207467){logger[_0xba49('0x2b')]('The\x20Call\x20ID\x20is:',_0x207467['id']);logger[_0xba49('0x2b')](_0xba49('0x8c'),_0xba49('0x81'));emit(util[_0xba49('0x2e')](_0xba49('0x82'),_0x2970cc[_0xba49('0x14')]),_0xba49('0x83'),{'uri':_0xba49('0x8d')+_0x40da98['host']+_0xba49('0x84')+_0x207467['id']});}})['catch'](function(_0x135738){logger[_0xba49('0x29')]('[OUTBOUND]',JSON['stringify'](_0x135738));});};exports[_0xba49('0x8e')]=function(_0x1a4ba4,_0x27ab7c,_0x5c2734,_0x25c771,_0x1f9b21,_0x41af30){var _0x31ef88,_0x1a349b,_0x18ccf5;_0x41af30[_0xba49('0x77')]=intUtil[_0xba49('0x78')](_0x41af30[_0xba49('0x77')]);_0x41af30[_0xba49('0x79')]=intUtil[_0xba49('0x78')](_0x41af30[_0xba49('0x79')]);if(_0x1f9b21&&_0x1f9b21['monitor_format']){logger[_0xba49('0x2b')]('['+_0x27ab7c[_0xba49('0x65')][_0xba49('0x8f')]()+']','Recording\x20is\x20enabled!');_0x27ab7c[_0xba49('0x7a')]=_0x41af30['serverUrl']+'/api/voice/recordings/'+_0x27ab7c[_0xba49('0x89')]+'/downloads?type=uniqueid&token='+md5(_0x27ab7c[_0xba49('0x89')]);}else{_0x27ab7c[_0xba49('0x7a')]='';}var _0x32d57f=_0x41af30[_0xba49('0x77')]===_0xba49('0x7d')?'eu':_0xba49('0x8a');return getAccessToken(_0x41af30)[_0xba49('0x25')](function(_0xcd9a93){_0x18ccf5=_0xcd9a93;return getUser(_0x18ccf5,_0x32d57f,_0x41af30);})['then'](function(_0x54aaa1){_0x31ef88=_0x54aaa1;logger['info'](_0xba49('0x7e'),_0x31ef88['id']);return getEndUser(_0x18ccf5,_0x32d57f,_0x41af30,_0x27ab7c[_0xba49('0x90')],_0x27ab7c[_0xba49('0x7f')],_0x31ef88,_0x5c2734);})[_0xba49('0x25')](function(_0x4a4d50){_0x1a349b=_0x4a4d50;return getCall(_0x18ccf5,_0x32d57f,_0x41af30,_0x31ef88,_0x1a349b,_0x5c2734,_0x27ab7c,_0xba49('0x72'));})['then'](function(_0x444cfd){if(_0x444cfd){logger[_0xba49('0x2b')]('The\x20Call\x20ID\x20is:',_0x444cfd['id']);}})[_0xba49('0x28')](function(_0x108a21){logger['error']('['+_0x27ab7c[_0xba49('0x65')][_0xba49('0x8f')]()+']',JSON[_0xba49('0x35')](_0x108a21));});}; \ No newline at end of file +var _0xd732=['enduserType','https://www.zohoapis.','/crm/v2/','startCase','role','first_name','last_name','code','SUCCESS','details','moduleCreate','Error:\x20','log','CREATE\x20ERROR','moduleSearch','uri','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','contact','/crm/v2/Contacts/search?criteria=((Phone:equals:','Creating\x20new\x20call...','Owner','administrator','Subject','getString','Subjects','Description','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','talktime','utc','format','mm:ss','answertime','endtime','diff','lastevent','called','Call_Result','complete','connect','Answered','rejected','Rejected','abandoned','timeout','Timeout','Call_Start_Time','agentcalledAt','YYYY-MM-DDTHH:mm:ss','Call_Type','Inbound','merge','Fields','/crm/v2/Calls','err','stack','queue','host','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','recordingURL','zoho.eu','com','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]','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','Outbound','trigger:browser:url','unmanaged','calleridname','calleridnum','toUpperCase','lodash','md5','moment','ioredis','../../../../config/logger','redis','defaults','socket.io-emitter','emit','debug','[HTTP]','stringify','length','forEach','type','string','idField','content','toString','variable','customVariable','Variable','name','toLowerCase','split','isNil','access_token','isBefore','zone','https://accounts.zoho.com','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','then','add','expires_in','seconds','catch','error','info','Search\x20user','GET','ActiveUsers','Zoho-oauthtoken\x20','users','findIndex','email','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','Administrator','user','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','The\x20failing\x20result\x20is','data'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd732,0x18e));var _0x2d73=function(_0x3324d2,_0x1c434d){_0x3324d2=_0x3324d2-0x0;var _0x50c226=_0xd732[_0x3324d2];return _0x50c226;};'use strict';var _=require(_0x2d73('0x0'));var rp=require('request-promise');var md5=require(_0x2d73('0x1'));var util=require('util');var intUtil=require('./util');var moment=require(_0x2d73('0x2'));var Redis=require(_0x2d73('0x3'));var BPromise=require('bluebird');var config=require('../../../../config/environment');var logger=require(_0x2d73('0x4'))('zoho');config[_0x2d73('0x5')]=_[_0x2d73('0x6')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x2d73('0x7'))(new Redis(config['redis']));function emit(_0x26be01,_0x301b50,_0x28ad42){io['to'](_0x26be01)[_0x2d73('0x8')](_0x301b50,_0x28ad42);}function request(_0x56f52d){logger[_0x2d73('0x9')](_0x2d73('0xa'),JSON[_0x2d73('0xb')](_0x56f52d));return rp(_0x56f52d);}function getCustomFields(_0x2655b1,_0x5b6b1f){var _0x3a8c79={};if(_0x2655b1[_0x2d73('0xc')]>0x0){_[_0x2d73('0xd')](_0x2655b1,function(_0x441b32){if(_0x441b32[_0x2d73('0xe')]===_0x2d73('0xf')&&_0x441b32[_0x2d73('0x10')]){_0x3a8c79[_0x441b32[_0x2d73('0x10')]]=_0x441b32[_0x2d73('0x11')][_0x2d73('0x12')]();}else if(_0x441b32[_0x2d73('0xe')]===_0x2d73('0x13')&&_0x441b32['variableName']&&_0x441b32[_0x2d73('0x10')]&&_0x5b6b1f[_0x441b32['variableName']]){_0x3a8c79[_0x441b32[_0x2d73('0x10')]]=_0x5b6b1f[_0x441b32['variableName']][_0x2d73('0x12')]();}else if(_0x441b32[_0x2d73('0xe')]===_0x2d73('0x14')&&_0x441b32[_0x2d73('0x15')]&&_0x441b32[_0x2d73('0x15')]['name']&&_0x441b32['idField']&&_0x5b6b1f[_0x441b32['Variable'][_0x2d73('0x16')][_0x2d73('0x17')]()]){_0x3a8c79[_0x441b32[_0x2d73('0x10')]]=_0x5b6b1f[_0x441b32['Variable'][_0x2d73('0x16')][_0x2d73('0x17')]()][_0x2d73('0x12')]();}});}return _0x3a8c79;}function getName(_0x2f5478){if(_0x2f5478['indexOf']('\x20')>0x0){var _0x53e565=_0x2f5478[_0x2d73('0x18')](/ (.+)/);if(_0x53e565[0x1]){return _0x53e565;}}return[_0x2f5478,_0x2f5478];}var accountsTokens={};function getAccessToken(_0x24066c){return new Promise(function(_0x1ae947,_0x350d7d){if(!_[_0x2d73('0x19')](accountsTokens[_0x24066c['id']])&&!_[_0x2d73('0x19')](accountsTokens[_0x24066c['id']][_0x2d73('0x1a')])){if(moment()[_0x2d73('0x1b')](accountsTokens[_0x24066c['id']]['expires_in'])){_0x1ae947(accountsTokens[_0x24066c['id']][_0x2d73('0x1a')]);}}var _0x233f57;switch(_0x24066c[_0x2d73('0x1c')]){case'US':_0x233f57=_0x2d73('0x1d');break;case'AU':_0x233f57='https://accounts.zoho.com.au';break;case'EU':_0x233f57=_0x2d73('0x1e');break;case'IN':_0x233f57=_0x2d73('0x1f');break;case'CN':_0x233f57=_0x2d73('0x20');break;default:_0x233f57=_0x2d73('0x1e');break;}var _0x1899d6={'method':_0x2d73('0x21'),'uri':_0x233f57+_0x2d73('0x22'),'qs':{'refresh_token':_0x24066c[_0x2d73('0x23')],'client_id':_0x24066c[_0x2d73('0x24')],'client_secret':_0x24066c[_0x2d73('0x25')],'grant_type':_0x2d73('0x26')},'json':!![]};return rp(_0x1899d6)[_0x2d73('0x27')](function(_0x2c97f2){accountsTokens[_0x24066c['id']]={'access_token':_0x2c97f2[_0x2d73('0x1a')],'expires_in':moment()[_0x2d73('0x28')](_0x2c97f2[_0x2d73('0x29')],_0x2d73('0x2a'))};_0x1ae947(_0x2c97f2['access_token']);})[_0x2d73('0x2b')](function(_0x59b4cf){logger[_0x2d73('0x2c')]('Failing\x20creating\x20the\x20access_token',_0x59b4cf['stack']);_0x350d7d(_0x59b4cf);});});}function getUser(_0x1458b7,_0x133c2a,_0x494a49,_0x5aa9ea){logger[_0x2d73('0x2d')](_0x2d73('0x2e'));return request({'method':_0x2d73('0x2f'),'uri':util['format']('https://www.zohoapis.%s/crm/v2/users',_0x133c2a),'qs':{'type':_0x2d73('0x30')},'headers':{'Authorization':_0x2d73('0x31')+_0x1458b7},'json':!![]})[_0x2d73('0x27')](function(_0x4b22b6){if(_0x4b22b6['users']){var _0x100bca=-0x1;if(_['isArrayLikeObject'](_0x4b22b6[_0x2d73('0x32')])){if(!_[_0x2d73('0x19')](_0x5aa9ea)){_0x100bca=_[_0x2d73('0x33')](_0x4b22b6[_0x2d73('0x32')],function(_0x2587ec){return _0x2587ec[_0x2d73('0x34')]===_0x5aa9ea;});}if(_0x100bca>=0x0){logger[_0x2d73('0x2d')](_0x2d73('0x35'));}else{logger[_0x2d73('0x2d')](_0x2d73('0x36'));_0x100bca=_['findIndex'](_0x4b22b6[_0x2d73('0x32')],function(_0x537e64){return _0x537e64[_0x2d73('0x37')]['name']===_0x2d73('0x38');});}return _0x4b22b6[_0x2d73('0x32')][_0x100bca];}else{if(_0x4b22b6[_0x2d73('0x39')][_0x2d73('0x37')][_0x2d73('0x16')]===_0x2d73('0x38')){logger[_0x2d73('0x2d')](_0x2d73('0x36'));user=_0x4b22b6['user'];return user;}else{logger[_0x2d73('0x2c')]('The\x20failing\x20result\x20is',JSON[_0x2d73('0xb')](_0x4b22b6));throw new Error(_0x2d73('0x3a')+JSON[_0x2d73('0xb')](_0x4b22b6));}}}else{logger[_0x2d73('0x2c')](_0x2d73('0x3b'),JSON[_0x2d73('0xb')](_0x4b22b6));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON['stringify'](_0x4b22b6));}})[_0x2d73('0x2b')](function(_0x403f36){console['error'](_0x403f36);});}function getZohoUser(_0x1b7666,_0x334149){return new BPromise(function(_0x2efb2d,_0x572b2e){request(_0x1b7666)[_0x2d73('0x27')](function(_0x14c169){var _0x5c3462=null;if(_0x14c169){_0x5c3462=_0x14c169[_0x2d73('0x3c')][0x0];_0x5c3462[_0x2d73('0x3d')]=_0x334149;}_0x2efb2d(_0x5c3462);})['catch'](function(_0x3a6ed1){_0x572b2e(_0x3a6ed1);});});}function createEndUser(_0x5c6304,_0x27cddd,_0x25608b,_0x39244b,_0x40edb7,_0x2f7064){var _0x25608b=getName(_0x25608b);return request({'method':_0x2d73('0x21'),'uri':_0x2d73('0x3e')+_0x27cddd+_0x2d73('0x3f')+_[_0x2d73('0x40')](_0x2f7064['moduleCreate'])+'s','body':{'data':[{'Last_Name':_0x25608b[0x1],'First_Name':_0x25608b[0x0],'Phone':_0x39244b,'Owner':{'name':!_['isNil'](_0x40edb7['role'][_0x2d73('0x16')])?_0x40edb7[_0x2d73('0x41')][_0x2d73('0x16')]:!_['isNil'](_0x40edb7[_0x2d73('0x42')])?_0x40edb7[_0x2d73('0x42')]+'\x20'+_0x40edb7[_0x2d73('0x43')]:_0x40edb7[_0x2d73('0x43')],'id':_0x40edb7['id']}}]},'headers':{'Authorization':_0x2d73('0x31')+_0x5c6304},'json':!![]})['then'](function(_0x446aeb){if(_0x446aeb&&_0x446aeb[_0x2d73('0x3c')][0x0][_0x2d73('0x44')]===_0x2d73('0x45')){var _0x4c7518=_0x446aeb['data'][0x0][_0x2d73('0x46')];_0x4c7518[_0x2d73('0x3d')]=_[_0x2d73('0x40')](_0x2f7064[_0x2d73('0x47')])+'s';return _0x4c7518;}logger['error'](_0x2d73('0x3b'),JSON[_0x2d73('0xb')](data));throw new Error(_0x2d73('0x48')+JSON[_0x2d73('0xb')](data));})['catch'](function(_0x331491){console[_0x2d73('0x49')](_0x2d73('0x4a'),_0x331491);});}function getEndUser(_0x528547,_0x4918c4,_0x5f2e35,_0x1c2243,_0x40db79,_0x3c5f73,_0xbc8f9c){var _0x588043={'method':_0x2d73('0x2f'),'uri':'','headers':{'Authorization':_0x2d73('0x31')+_0x528547},'json':!![]};switch(_0xbc8f9c[_0x2d73('0x4b')]){case'contact_lead':_0x588043[_0x2d73('0x4c')]=_0x2d73('0x3e')+_0x4918c4+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x40db79+'))';return getZohoUser(_0x588043,_0x2d73('0x4d'))[_0x2d73('0x27')](function(_0x364aa8){if(_0x364aa8)return _0x364aa8;_0x588043[_0x2d73('0x4c')]='https://www.zohoapis.'+_0x4918c4+_0x2d73('0x4e')+_0x40db79+'))';return getZohoUser(_0x588043,_0x2d73('0x4f'))[_0x2d73('0x27')](function(_0x150856){if(_0x150856)return _0x150856;if(_0xbc8f9c[_0x2d73('0x47')]!='nothing'){return createEndUser(_0x528547,_0x4918c4,_0x1c2243,_0x40db79,_0x3c5f73,_0xbc8f9c);}else{return{};}});});break;case _0x2d73('0x50'):_0x588043['uri']='https://www.zohoapis.'+_0x4918c4+_0x2d73('0x51')+_0x40db79+'))';return getZohoUser(_0x588043,_0x2d73('0x4d'))[_0x2d73('0x27')](function(_0x5190b3){if(_0x5190b3)return _0x5190b3;if(_0xbc8f9c[_0x2d73('0x47')]!='nothing'){return createEndUser(_0x528547,_0x4918c4,_0x1c2243,_0x40db79,_0x3c5f73,_0xbc8f9c);}else{return{};}});break;case'lead':_0x588043[_0x2d73('0x4c')]=_0x2d73('0x3e')+_0x4918c4+_0x2d73('0x4e')+_0x40db79+'))';return getZohoUser(_0x588043,_0x2d73('0x4f'))['then'](function(_0xdfb674){if(_0xdfb674)return _0xdfb674;if(_0xbc8f9c[_0x2d73('0x47')]!='nothing'){return createEndUser(_0x528547,_0x4918c4,_0x1c2243,_0x40db79,_0x3c5f73,_0xbc8f9c);}else{return{};}});break;}}function getCall(_0x13dbd3,_0x4a65b0,_0x458848,_0x31e052,_0x29ce8a,_0x2a4b9f,_0x546d7c,_0x180934){logger['info'](_0x2d73('0x52'));var _0x4e9bad={};_0x4e9bad[_0x2d73('0x53')]={'name':!_[_0x2d73('0x19')](_0x31e052[_0x2d73('0x41')]['name'])&&!_[_0x2d73('0x19')](_0x31e052[_0x2d73('0x37')][_0x2d73('0x16')])&&_0x31e052[_0x2d73('0x37')]['name']===_0x2d73('0x54')?_0x31e052['role'][_0x2d73('0x16')]:!_['isNil'](_0x31e052[_0x2d73('0x42')])?_0x31e052['first_name']+'\x20'+_0x31e052[_0x2d73('0x43')]:_0x31e052[_0x2d73('0x43')],'id':_0x31e052['id']};_0x4e9bad[_0x2d73('0x55')]=intUtil[_0x2d73('0x56')](_0x2a4b9f[_0x2d73('0x57')],_0x546d7c,'\x20');_0x4e9bad[_0x2d73('0x58')]=intUtil[_0x2d73('0x56')](_0x2a4b9f[_0x2d73('0x59')],_0x546d7c,'\x0a');if(_0x29ce8a[_0x2d73('0x3d')]===_0x2d73('0x4d')){_0x4e9bad[_0x2d73('0x5a')]={'name':!_[_0x2d73('0x19')](_0x29ce8a['Full_Name'])?_0x29ce8a[_0x2d73('0x5b')]:!_[_0x2d73('0x19')](_0x29ce8a['First_Name'])?_0x29ce8a[_0x2d73('0x5c')]+'\x20'+_0x29ce8a[_0x2d73('0x5d')]:_0x29ce8a[_0x2d73('0x5d')],'id':_0x29ce8a['id']};}if(_0x29ce8a[_0x2d73('0x3d')]===_0x2d73('0x4f')){_0x4e9bad[_0x2d73('0x5e')]={'name':!_[_0x2d73('0x19')](_0x29ce8a[_0x2d73('0x5b')])?_0x29ce8a['Full_Name']:!_[_0x2d73('0x19')](_0x29ce8a['First_Name'])?_0x29ce8a[_0x2d73('0x5c')]+'\x20'+_0x29ce8a[_0x2d73('0x5d')]:_0x29ce8a[_0x2d73('0x5d')],'id':_0x29ce8a['id']};_0x4e9bad['$se_module']=_[_0x2d73('0x40')](_0x29ce8a[_0x2d73('0x3d')]);}if(_0x546d7c[_0x2d73('0x5f')]){_0x4e9bad['Call_Duration']=moment[_0x2d73('0x60')](parseInt(_0x546d7c[_0x2d73('0x5f')])*0x3e8)[_0x2d73('0x61')](_0x2d73('0x62'));}else if(_0x546d7c[_0x2d73('0x63')]&&_0x546d7c[_0x2d73('0x64')]){_0x4e9bad['Call_Duration']=moment[_0x2d73('0x60')](moment(_0x546d7c[_0x2d73('0x64')],'YYYY-MM-DDTHH:mm:ss')[_0x2d73('0x65')](moment(_0x546d7c['starttime'],'YYYY-MM-DDTHH:mm:ss')))[_0x2d73('0x61')](_0x2d73('0x62'));}switch(_0x546d7c[_0x2d73('0x66')]){case _0x2d73('0x67'):_0x4e9bad[_0x2d73('0x68')]='Called';break;case _0x2d73('0x69'):case _0x2d73('0x6a'):_0x4e9bad[_0x2d73('0x68')]=_0x2d73('0x6b');break;case _0x2d73('0x6c'):_0x4e9bad[_0x2d73('0x68')]=_0x2d73('0x6d');break;case _0x2d73('0x6e'):_0x4e9bad[_0x2d73('0x68')]='Abandoned';break;case _0x2d73('0x6f'):_0x4e9bad['Call_Result']=_0x2d73('0x70');default:}_0x4e9bad[_0x2d73('0x71')]=(_0x180934==='outbound'?moment(_0x546d7c['starttime'])[_0x2d73('0x61')]('YYYY-MM-DDTHH:mm:ss'):moment(_0x546d7c[_0x2d73('0x72')])['format'](_0x2d73('0x73')))||moment()[_0x2d73('0x61')](_0x2d73('0x73'));_0x4e9bad[_0x2d73('0x74')]=_0x180934||_0x2d73('0x75');_0x4e9bad=_[_0x2d73('0x76')](_0x4e9bad,getCustomFields(_0x2a4b9f[_0x2d73('0x77')],_0x546d7c));return request({'method':'POST','uri':_0x2d73('0x3e')+_0x4a65b0+_0x2d73('0x78'),'headers':{'Authorization':_0x2d73('0x31')+_0x13dbd3},'body':{'data':[_0x4e9bad]},'json':!![]})['then'](function(_0x55e8fb){if(_0x55e8fb&&_0x55e8fb[_0x2d73('0x3c')][0x0][_0x2d73('0x44')]===_0x2d73('0x45')){logger[_0x2d73('0x2d')]('Call\x20created!');return{'id':_0x55e8fb[_0x2d73('0x3c')][0x0][_0x2d73('0x46')]['id']};}})[_0x2d73('0x2b')](function(_0x3a749c){logger[_0x2d73('0x2d')](_0x2d73('0x79'),_0x3a749c[_0x2d73('0x7a')]);console['log'](_0x2d73('0x79'),_0x3a749c);});}exports[_0x2d73('0x7b')]=function(_0x36659d,_0x2ae6ab,_0x35ffc8,_0x2c3591,_0x5cfaa3,_0x212211){var _0x357222,_0x538e1f,_0x4e2edb;_0x212211[_0x2d73('0x7c')]=intUtil['stripTrailingSlash'](_0x212211[_0x2d73('0x7c')]);_0x212211[_0x2d73('0x7d')]=intUtil[_0x2d73('0x7e')](_0x212211[_0x2d73('0x7d')]);if(_0x5cfaa3&&_0x5cfaa3[_0x2d73('0x7f')]){logger[_0x2d73('0x2d')](_0x2d73('0x80'),_0x2d73('0x81'));_0x2ae6ab['recordingURL']=_0x212211[_0x2d73('0x7d')]+_0x2d73('0x82')+_0x2ae6ab[_0x2d73('0x83')]+_0x2d73('0x84')+md5(_0x2ae6ab[_0x2d73('0x83')]);}else{_0x2ae6ab[_0x2d73('0x85')]='';}var _0x49185a=_0x212211[_0x2d73('0x7c')]===_0x2d73('0x86')?'eu':_0x2d73('0x87');return getAccessToken(_0x212211)[_0x2d73('0x27')](function(_0x4c173e){_0x4e2edb=_0x4c173e;return getUser(_0x4e2edb,_0x49185a,_0x212211,_0x2c3591[_0x2d73('0x34')]);})[_0x2d73('0x27')](function(_0x199dd6){_0x357222=_0x199dd6;logger[_0x2d73('0x2d')]('The\x20User\x20ID\x20is:',_0x357222['id']);return getEndUser(_0x4e2edb,_0x49185a,_0x212211,_0x2ae6ab['calleridname'],_0x2ae6ab['calleridnum'],_0x357222,_0x35ffc8);})[_0x2d73('0x27')](function(_0x5a568c){_0x538e1f=_0x5a568c;return getCall(_0x4e2edb,_0x49185a,_0x212211,_0x357222,_0x538e1f,_0x35ffc8,_0x2ae6ab,_0x2d73('0x75'));})[_0x2d73('0x27')](function(_0x504a93){if(_0x504a93){logger['info'](_0x2d73('0x88'),_0x504a93['id']);logger[_0x2d73('0x2d')](_0x2d73('0x80'),_0x2d73('0x89'));emit(util[_0x2d73('0x61')](_0x2d73('0x8a'),_0x2c3591[_0x2d73('0x16')]),'trigger:browser:url',{'uri':_0x2d73('0x8b')+_0x212211[_0x2d73('0x7c')]+_0x2d73('0x8c')+_0x504a93['id']});}})[_0x2d73('0x2b')](function(_0x17270b){logger[_0x2d73('0x2c')](_0x2d73('0x80'),JSON[_0x2d73('0xb')](_0x17270b));});};exports['outbound']=function(_0x5b2cb7,_0x11d5be,_0x4cea3c,_0x5e16ad,_0x3d7797,_0x408862,_0x49419f){var _0x18297e,_0x4b904c,_0x4a6812;_0x408862[_0x2d73('0x7c')]=intUtil['stripTrailingSlash'](_0x408862[_0x2d73('0x7c')]);_0x408862[_0x2d73('0x7d')]=intUtil['stripTrailingSlash'](_0x408862[_0x2d73('0x7d')]);if(_0x49419f&&_0x49419f[_0x2d73('0x8d')]&&_0x49419f[_0x2d73('0x8d')]!==_0x2d73('0x8e')){logger[_0x2d73('0x2d')](_0x2d73('0x8f'),_0x2d73('0x81'));_0x11d5be['recordingURL']=_0x408862[_0x2d73('0x7d')]+_0x2d73('0x82')+_0x11d5be[_0x2d73('0x83')]+_0x2d73('0x84')+md5(_0x11d5be[_0x2d73('0x83')]);}var _0x11c174=_0x408862[_0x2d73('0x7c')]===_0x2d73('0x86')?'eu':_0x2d73('0x87');return getAccessToken(_0x408862)['then'](function(_0x19d8bb){_0x4a6812=_0x19d8bb;return getUser(_0x4a6812,_0x11c174,_0x408862,_0x5e16ad[_0x2d73('0x34')]);})['then'](function(_0x1eff8b){_0x18297e=_0x1eff8b;logger[_0x2d73('0x2d')](_0x2d73('0x90'),_0x18297e['id']);return getEndUser(_0x4a6812,_0x11c174,_0x408862,_0x11d5be[_0x2d73('0x91')],_0x11d5be[_0x2d73('0x92')],_0x18297e,_0x4cea3c);})[_0x2d73('0x27')](function(_0x227dda){_0x4b904c=_0x227dda;return getCall(_0x4a6812,_0x11c174,_0x408862,_0x18297e,_0x4b904c,_0x4cea3c,_0x11d5be,_0x2d73('0x93'));})[_0x2d73('0x27')](function(_0xf62d8){if(_0xf62d8){logger[_0x2d73('0x2d')]('The\x20Call\x20ID\x20is:',_0xf62d8['id']);logger[_0x2d73('0x2d')]('[OUTBOUND]',_0x2d73('0x89'));emit(util[_0x2d73('0x61')](_0x2d73('0x8a'),_0x5e16ad[_0x2d73('0x16')]),_0x2d73('0x94'),{'uri':_0x2d73('0x8b')+_0x408862[_0x2d73('0x7c')]+_0x2d73('0x8c')+_0xf62d8['id']});}})['catch'](function(_0x2049db){logger['error'](_0x2d73('0x8f'),JSON['stringify'](_0x2049db));});};exports[_0x2d73('0x95')]=function(_0x2bc1cf,_0xd7422,_0x228b4e,_0x114f1f,_0x53edd2,_0x1d6c9b){var _0x36a6a2,_0x339a52,_0x1fe253;_0x1d6c9b[_0x2d73('0x7c')]=intUtil['stripTrailingSlash'](_0x1d6c9b[_0x2d73('0x7c')]);_0x1d6c9b[_0x2d73('0x7d')]=intUtil[_0x2d73('0x7e')](_0x1d6c9b[_0x2d73('0x7d')]);if(_0x53edd2&&_0x53edd2['monitor_format']){logger['info']('['+_0xd7422[_0x2d73('0x66')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0xd7422[_0x2d73('0x85')]=_0x1d6c9b[_0x2d73('0x7d')]+_0x2d73('0x82')+_0xd7422[_0x2d73('0x83')]+_0x2d73('0x84')+md5(_0xd7422[_0x2d73('0x83')]);}else{_0xd7422[_0x2d73('0x85')]='';}var _0xb2cf3c=_0x1d6c9b['host']===_0x2d73('0x86')?'eu':_0x2d73('0x87');return getAccessToken(_0x1d6c9b)[_0x2d73('0x27')](function(_0x2e1056){_0x1fe253=_0x2e1056;return getUser(_0x1fe253,_0xb2cf3c,_0x1d6c9b);})['then'](function(_0x47927f){_0x36a6a2=_0x47927f;logger[_0x2d73('0x2d')](_0x2d73('0x90'),_0x36a6a2['id']);return getEndUser(_0x1fe253,_0xb2cf3c,_0x1d6c9b,_0xd7422[_0x2d73('0x96')],_0xd7422[_0x2d73('0x97')],_0x36a6a2,_0x228b4e);})[_0x2d73('0x27')](function(_0x3f82e5){_0x339a52=_0x3f82e5;return getCall(_0x1fe253,_0xb2cf3c,_0x1d6c9b,_0x36a6a2,_0x339a52,_0x228b4e,_0xd7422,_0x2d73('0x75'));})[_0x2d73('0x27')](function(_0x3cc48b){if(_0x3cc48b){logger['info'](_0x2d73('0x88'),_0x3cc48b['id']);}})[_0x2d73('0x2b')](function(_0x39c550){logger[_0x2d73('0x2c')]('['+_0xd7422[_0x2d73('0x66')][_0x2d73('0x98')]()+']',JSON[_0x2d73('0xb')](_0x39c550));});}; \ 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 262de89..0568e94 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(_0x43d7b2,_0x5d8dd6){var _0x1561a5=function(_0x7b8443){while(--_0x7b8443){_0x43d7b2['push'](_0x43d7b2['shift']());}};_0x1561a5(++_0x5d8dd6);}(_0x7a54,0x106));var _0x47a5=function(_0x2cd649,_0x154ea7){_0x2cd649=_0x2cd649-0x0;var _0x4316ce=_0x7a54[_0x2cd649];return _0x4316ce;};'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(_0x371508,_0x40f37d){var _0x3e20c9=function(_0x31b23a){while(--_0x31b23a){_0x371508['push'](_0x371508['shift']());}};_0x3e20c9(++_0x40f37d);}(_0x7a54,0x106));var _0x47a5=function(_0x4ea495,_0x2f8092){_0x4ea495=_0x4ea495-0x0;var _0x3bc3c7=_0x7a54[_0x4ea495];return _0x3bc3c7;};'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 8edce47..56b81c7 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 _0xb10b=['number','headers','data6','parse','error','stack','DELETE','POST','PUT','data7','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','data2','stringify','then','isNil',',\x20request\x20body:\x20','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','data1','statusCode','name','message','request-promise','lodash','mustache','../../../../config/logger','exec','toUpperCase','render','data5'];(function(_0x30a67d,_0x1525cf){var _0x25faaf=function(_0xe44325){while(--_0xe44325){_0x30a67d['push'](_0x30a67d['shift']());}};_0x25faaf(++_0x1525cf);}(_0xb10b,0x12a));var _0xbb10=function(_0x4ac4a1,_0x2e9361){_0x4ac4a1=_0x4ac4a1-0x0;var _0x5d5bb1=_0xb10b[_0x4ac4a1];return _0x5d5bb1;};'use strict';var rp=require(_0xbb10('0x0'));var util=require('util');var _=require(_0xbb10('0x1'));var Mustache=require(_0xbb10('0x2'));var logger=require(_0xbb10('0x3'))('trigger');exports[_0xbb10('0x4')]=function(_0x9bbed,_0x460981){var _0x22320e,_0x49baf4;var _0x312b72={'method':_0x9bbed['data1'][_0xbb10('0x5')](),'uri':Mustache[_0xbb10('0x6')](_0x9bbed['data2'],_0x460981),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x9bbed[_0xbb10('0x7')])===_0xbb10('0x8')&&parseInt(_0x9bbed[_0xbb10('0x7')])>=0x1&&parseInt(_0x9bbed[_0xbb10('0x7')])<=0xa?parseInt(_0x9bbed[_0xbb10('0x7')])*0x3e8:0x5*0x3e8};try{_0x312b72[_0xbb10('0x9')]=_0x9bbed[_0xbb10('0xa')]?JSON[_0xbb10('0xb')](Mustache['render'](_0x9bbed['data6'],_0x460981)):{};}catch(_0x20bd61){logger[_0xbb10('0xc')](_0x20bd61[_0xbb10('0xd')]);}switch(_0x9bbed['data1'][_0xbb10('0x5')]()){case'GET':case _0xbb10('0xe'):_0x22320e=null;_0x312b72['qs']=_0x460981;break;case _0xbb10('0xf'):case _0xbb10('0x10'):if(_0x9bbed[_0xbb10('0x11')]){try{_0x22320e=JSON[_0xbb10('0xb')](Mustache[_0xbb10('0x6')](_0x9bbed['data7'],_0x460981));_0x312b72[_0xbb10('0x12')]=_0x22320e;}catch(_0x42d7e4){logger[_0xbb10('0xc')](_0x42d7e4[_0xbb10('0xd')]);logger[_0xbb10('0xc')](_0xbb10('0x13'));}}else{_0x22320e=_0x460981;_0x312b72[_0xbb10('0x12')]=_0x22320e;}break;}logger[_0xbb10('0x14')](util[_0xbb10('0x15')](_0xbb10('0x16'),_0x9bbed['data1'],_0x9bbed[_0xbb10('0x17')],JSON[_0xbb10('0x18')](_0x312b72)));rp(_0x312b72)[_0xbb10('0x19')](function(_0x42db98){_0x22320e=!_[_0xbb10('0x1a')](_0x22320e)?_0xbb10('0x1b')+_0x22320e:'';_0x49baf4=typeof _0x42db98[_0xbb10('0x12')]===_0xbb10('0x1c')?JSON[_0xbb10('0x18')](_0x42db98[_0xbb10('0x12')]):_0x42db98['body'];logger[_0xbb10('0x14')](util[_0xbb10('0x15')](_0xbb10('0x1d'),_0x9bbed[_0xbb10('0x1e')],_0x9bbed[_0xbb10('0x17')],_0x42db98[_0xbb10('0x1f')],_0x49baf4));})['catch'](function(_0x12f888){logger[_0xbb10('0xc')](util['format']('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0x9bbed[_0xbb10('0x1e')],_0x9bbed[_0xbb10('0x17')],_0x12f888[_0xbb10('0x1f')],_0x12f888[_0xbb10('0x20')],_0x12f888[_0xbb10('0x21')]));});}; \ No newline at end of file +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(_0x312ef5,_0x42b547){var _0x23046f=function(_0x1d53da){while(--_0x1d53da){_0x312ef5['push'](_0x312ef5['shift']());}};_0x23046f(++_0x42b547);}(_0x7a54,0x106));var _0x47a5=function(_0xc90884,_0x1ebbd7){_0xc90884=_0xc90884-0x0;var _0x50ecd2=_0x7a54[_0xc90884];return _0x50ecd2;};'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 diff --git a/server/services/email/client.js b/server/services/email/client.js index 397364b..1262f8e 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 _0xb5bb=['jayson/promise','bluebird','../../config/logger','client','http','then','rpc','routing','error','message','result','catch','exports'];(function(_0x4858ba,_0x784f06){var _0x5ee0c3=function(_0x33d81b){while(--_0x33d81b){_0x4858ba['push'](_0x4858ba['shift']());}};_0x5ee0c3(++_0x784f06);}(_0xb5bb,0x1ba));var _0xbb5b=function(_0x2a3ac4,_0x5a1994){_0x2a3ac4=_0x2a3ac4-0x0;var _0x159fe4=_0xb5bb[_0x2a3ac4];return _0x159fe4;};'use strict';var jayson=require(_0xbb5b('0x0'));var BPromise=require(_0xbb5b('0x1'));var logger=require(_0xbb5b('0x2'))('routing');var client=jayson[_0xbb5b('0x3')][_0xbb5b('0x4')]({'port':0x2329});client['Request']=function(_0x5d0b8a,_0x51fd39){return new BPromise(function(_0x5dfa85,_0x509dc0){return client['request'](_0x5d0b8a,_0x51fd39)[_0xbb5b('0x5')](function(_0x161047){logger['debug'](_0xbb5b('0x6'),_0xbb5b('0x7'),_0x5d0b8a,_0x51fd39,_0x161047);if(_0x161047[_0xbb5b('0x8')]){logger[_0xbb5b('0x8')](_0xbb5b('0x6'),_0xbb5b('0x7'),_0x5d0b8a,_0x161047[_0xbb5b('0x8')][_0xbb5b('0x9')],_0x51fd39);return _0x509dc0(_0x161047[_0xbb5b('0x8')][_0xbb5b('0x9')]);}else{return _0x5dfa85(_0x161047[_0xbb5b('0xa')]);}})[_0xbb5b('0xb')](function(_0x6d71ad){logger[_0xbb5b('0x8')](_0xbb5b('0x6'),_0xbb5b('0x7'),_0x5d0b8a,_0x6d71ad,_0x51fd39);return _0x509dc0(_0x6d71ad);});});};module[_0xbb5b('0xc')]=client; \ No newline at end of file +var _0xa3e6=['request','then','debug','routing','error','result','rpc','exports','jayson/promise','../../config/logger','client','http','Request'];(function(_0x1ba7e9,_0x4ce1c1){var _0x3b4a72=function(_0x335f32){while(--_0x335f32){_0x1ba7e9['push'](_0x1ba7e9['shift']());}};_0x3b4a72(++_0x4ce1c1);}(_0xa3e6,0xbe));var _0x6a3e=function(_0x7706a,_0x46e81a){_0x7706a=_0x7706a-0x0;var _0x6cad87=_0xa3e6[_0x7706a];return _0x6cad87;};'use strict';var jayson=require(_0x6a3e('0x0'));var BPromise=require('bluebird');var logger=require(_0x6a3e('0x1'))('routing');var client=jayson[_0x6a3e('0x2')][_0x6a3e('0x3')]({'port':0x2329});client[_0x6a3e('0x4')]=function(_0x56e3f4,_0xe03261){return new BPromise(function(_0x5e9a85,_0x281f8e){return client[_0x6a3e('0x5')](_0x56e3f4,_0xe03261)[_0x6a3e('0x6')](function(_0x315ed8){logger[_0x6a3e('0x7')]('rpc',_0x6a3e('0x8'),_0x56e3f4,_0xe03261,_0x315ed8);if(_0x315ed8[_0x6a3e('0x9')]){logger['error']('rpc',_0x6a3e('0x8'),_0x56e3f4,_0x315ed8['error']['message'],_0xe03261);return _0x281f8e(_0x315ed8[_0x6a3e('0x9')]['message']);}else{return _0x5e9a85(_0x315ed8[_0x6a3e('0xa')]);}})['catch'](function(_0xd21a09){logger[_0x6a3e('0x9')](_0x6a3e('0xb'),_0x6a3e('0x8'),_0x56e3f4,_0xd21a09,_0xe03261);return _0x281f8e(_0xd21a09);});});};module[_0x6a3e('0xc')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 4b0c18c..291146a 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 _0x41f2=['./rpc/mailAccount','../../mysqldb','resolve','getMailAccounts','then','refresh','mailAccounts','listen','loginMailFrequency','catch','bluebird','./server','./lib/email'];(function(_0x2ab633,_0x16e847){var _0x3f2202=function(_0x5c34f0){while(--_0x5c34f0){_0x2ab633['push'](_0x2ab633['shift']());}};_0x3f2202(++_0x16e847);}(_0x41f2,0x14f));var _0x241f=function(_0x27a3f0,_0x49e36b){_0x27a3f0=_0x27a3f0-0x0;var _0x2848b1=_0x41f2[_0x27a3f0];return _0x2848b1;};'use strict';var BPromise=require(_0x241f('0x0'));var server=require(_0x241f('0x1'));var Realtime=require('./realtime');var EmailChannel=require(_0x241f('0x2'));var mailAccount=require(_0x241f('0x3'));var realtime=new Realtime();var email=new EmailChannel(realtime);var db=require(_0x241f('0x4'))['db'];function initRealtime(){return BPromise[_0x241f('0x5')]()['then'](mailAccount[_0x241f('0x6')]())[_0x241f('0x7')](realtime['initMailAccounts']())[_0x241f('0x7')](function(){email[_0x241f('0x8')](realtime[_0x241f('0x9')]);return realtime;});}function main(){return server[_0x241f('0xa')](realtime,email)[_0x241f('0x7')](function(_0x4e7af6){return initRealtime();})[_0x241f('0x7')](function(_0x41f672){return db['Setting']['findOne']({'attributes':['id','loginMailFrequency'],'raw':!![]});})[_0x241f('0x7')](function(_0x481686){return setInterval(initRealtime,_0x481686[_0x241f('0xb')]*0x3e8);})[_0x241f('0xc')](function(_0xdabda7){console['log'](_0xdabda7);});}main(); \ No newline at end of file +var _0x15c6=['then','refresh','mailAccounts','findOne','loginMailFrequency','catch','bluebird','./server','./realtime','./lib/email','./rpc/mailAccount','../../mysqldb','resolve'];(function(_0x2f4afc,_0x1d0f82){var _0x47490c=function(_0x597cb0){while(--_0x597cb0){_0x2f4afc['push'](_0x2f4afc['shift']());}};_0x47490c(++_0x1d0f82);}(_0x15c6,0x1cd));var _0x615c=function(_0x347399,_0x42bbda){_0x347399=_0x347399-0x0;var _0x24e7be=_0x15c6[_0x347399];return _0x24e7be;};'use strict';var BPromise=require(_0x615c('0x0'));var server=require(_0x615c('0x1'));var Realtime=require(_0x615c('0x2'));var EmailChannel=require(_0x615c('0x3'));var mailAccount=require(_0x615c('0x4'));var realtime=new Realtime();var email=new EmailChannel(realtime);var db=require(_0x615c('0x5'))['db'];function initRealtime(){return BPromise[_0x615c('0x6')]()[_0x615c('0x7')](mailAccount['getMailAccounts']())['then'](realtime['initMailAccounts']())[_0x615c('0x7')](function(){email[_0x615c('0x8')](realtime[_0x615c('0x9')]);return realtime;});}function main(){return server['listen'](realtime,email)[_0x615c('0x7')](function(_0x623eb8){return initRealtime();})[_0x615c('0x7')](function(_0x7f7001){return db['Setting'][_0x615c('0xa')]({'attributes':['id','loginMailFrequency'],'raw':!![]});})[_0x615c('0x7')](function(_0x19f033){return setInterval(initRealtime,_0x19f033[_0x615c('0xb')]*0x3e8);})[_0x615c('0xc')](function(_0x51f114){console['log'](_0x51f114);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 21677f8..356b945 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 _0x9622=['redis','localhost','socket.io-emitter','./imap','./smtp','../rpc/mailAccount','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','emit','name','key','active','Imap','status','messageStatus','total','isNil','stringify','refresh','hasOwnProperty','handleImapBox','handleImapEmail','bind','end','handleImapEnd','error','connected','messages','info','firstName','lastName','from','notify','then','catch','lastSync','sendMail','send','verifySmtp','Smtp','verify','verified','exports','lodash','moment','md5','../../../config/environment','email'];(function(_0x442843,_0x47e470){var _0x1d0650=function(_0x3c627c){while(--_0x3c627c){_0x442843['push'](_0x442843['shift']());}};_0x1d0650(++_0x47e470);}(_0x9622,0x160));var _0x2962=function(_0x4a3fbb,_0x567e57){_0x4a3fbb=_0x4a3fbb-0x0;var _0x10c7c1=_0x9622[_0x4a3fbb];return _0x10c7c1;};'use strict';var _=require(_0x2962('0x0'));var moment=require(_0x2962('0x1'));var BPromise=require('bluebird');var md5=require(_0x2962('0x2'));var Redis=require('ioredis');var config=require(_0x2962('0x3'));var logger=require('../../../config/logger')(_0x2962('0x4'));config[_0x2962('0x5')]=_['defaults'](config[_0x2962('0x5')],{'host':_0x2962('0x6'),'port':0x18eb});var io=require(_0x2962('0x7'))(new Redis(config[_0x2962('0x5')]));var EmailImap=require(_0x2962('0x8'));var EmailSmtp=require(_0x2962('0x9'));var mailAccount=require(_0x2962('0xa'));var md5Accounts={};function EmailChannel(_0x55fd0c){logger['info'](_0x2962('0xb'));this[_0x2962('0xc')]=_0x55fd0c[_0x2962('0xc')];this[_0x2962('0xd')]={};this[_0x2962('0xe')]=new EmailSmtp();}EmailChannel[_0x2962('0xf')][_0x2962('0x10')]=function(_0x448357){var _0xca2503=this[_0x2962('0xc')][_0x448357];var _0xd2b972={'id':_0xca2503['id'],'name':_0xca2503[_0x2962('0x11')],'key':_0xca2503[_0x2962('0x12')],'active':_0xca2503[_0x2962('0x13')],'Imap':{'status':_0xca2503[_0x2962('0x14')][_0x2962('0x15')],'messageStatus':_0xca2503[_0x2962('0x14')][_0x2962('0x16')],'total':_0xca2503['Imap'][_0x2962('0x17')]}};if(_[_0x2962('0x18')](md5Accounts[_0x448357])){md5Accounts[_0x448357]={};}var _0x21ddcc=md5(JSON[_0x2962('0x19')](_0xd2b972));if(md5Accounts[_0x448357][_0x2962('0x2')]!==_0x21ddcc){md5Accounts[_0x448357][_0x2962('0x2')]=_0x21ddcc;io[_0x2962('0x10')]('mailAccount:update',_0xd2b972);}};EmailChannel[_0x2962('0xf')][_0x2962('0x1a')]=function(_0x57eea5){for(var _0x392a28 in _0x57eea5){if(_0x57eea5[_0x2962('0x1b')](_0x392a28)){if(_0x57eea5[_0x392a28][_0x2962('0x14')]&&_0x57eea5[_0x392a28]['active']){var _0x2e65ec=_0x57eea5[_0x392a28][_0x2962('0x14')];if(!this[_0x2962('0xd')][_0x2962('0x1b')](_0x2e65ec['id'])){this[_0x2962('0xd')][_0x2e65ec['id']]=new EmailImap(_0x2e65ec,_0x57eea5[_0x392a28]['email']);this['imapAccounts'][_0x2e65ec['id']]['on']('box',this[_0x2962('0x1c')]['bind'](this,_0x392a28));this['imapAccounts'][_0x2e65ec['id']]['on'](_0x2962('0x4'),this[_0x2962('0x1d')][_0x2962('0x1e')](this,_0x392a28));this[_0x2962('0xd')][_0x2e65ec['id']]['on'](_0x2962('0x1f'),this[_0x2962('0x20')][_0x2962('0x1e')](this,_0x392a28));this[_0x2962('0xd')][_0x2e65ec['id']]['on'](_0x2962('0x21'),this['handleImapError']['bind'](this,_0x392a28));}}else{if(_[_0x2962('0x18')](this[_0x2962('0xc')][_0x392a28][_0x2962('0x14')])){this['mailAccounts'][_0x392a28][_0x2962('0x14')]={};}this[_0x2962('0xc')][_0x392a28][_0x2962('0x14')][_0x2962('0x15')]='disabled';this[_0x2962('0xc')][_0x392a28][_0x2962('0x14')][_0x2962('0x16')]='';this[_0x2962('0x10')](_0x392a28);}}}};EmailChannel[_0x2962('0xf')][_0x2962('0x1c')]=function(_0x4bab79,_0x223eaf){if(this[_0x2962('0xc')][_0x4bab79]){this[_0x2962('0xc')][_0x4bab79][_0x2962('0x14')][_0x2962('0x15')]=_0x2962('0x22');this['mailAccounts'][_0x4bab79][_0x2962('0x14')][_0x2962('0x16')]=_0x223eaf['name'];if(_0x223eaf[_0x2962('0x23')]){this[_0x2962('0xc')][_0x4bab79][_0x2962('0x14')]['total']=_0x223eaf[_0x2962('0x23')][_0x2962('0x17')];}return this[_0x2962('0x10')](_0x4bab79);}};EmailChannel[_0x2962('0xf')][_0x2962('0x1d')]=function(_0x126bdd,_0x3dd7cf){logger[_0x2962('0x24')]('New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s',_0x3dd7cf[_0x2962('0x25')],_0x3dd7cf[_0x2962('0x26')],_0x3dd7cf[_0x2962('0x27')],_0x126bdd);if(this[_0x2962('0xc')][_0x126bdd]){return mailAccount[_0x2962('0x28')](_0x126bdd,_0x3dd7cf)[_0x2962('0x29')](function(_0x184464){if(_0x184464){logger[_0x2962('0x24')]('Mail\x20accepted\x20from\x20routing');}})[_0x2962('0x2a')](function(_0x1fabcd){logger[_0x2962('0x21')]('Mail\x20not\x20accepted\x20from\x20routing\x20%s',JSON[_0x2962('0x19')](_0x1fabcd));});}};EmailChannel[_0x2962('0xf')][_0x2962('0x20')]=function(_0xc1e208){if(this[_0x2962('0xc')][_0xc1e208]&&this['mailAccounts'][_0xc1e208][_0x2962('0x14')]){if(this[_0x2962('0xd')][this[_0x2962('0xc')][_0xc1e208][_0x2962('0x14')]['id']]){delete this[_0x2962('0xd')][this['mailAccounts'][_0xc1e208][_0x2962('0x14')]['id']];}this[_0x2962('0xc')][_0xc1e208][_0x2962('0x14')][_0x2962('0x2b')]=moment();this[_0x2962('0x10')](_0xc1e208);}};EmailChannel[_0x2962('0xf')]['handleImapError']=function(_0x2cfd74,_0x3c6c82){if(this[_0x2962('0xc')][_0x2cfd74]){this['mailAccounts'][_0x2cfd74][_0x2962('0x14')]['status']=_0x2962('0x21');this['mailAccounts'][_0x2cfd74][_0x2962('0x14')][_0x2962('0x16')]=_0x3c6c82;return this['emit'](_0x2cfd74);}};EmailChannel[_0x2962('0xf')][_0x2962('0x2c')]=function(_0x45d835,_0xaa7c42){return this[_0x2962('0xe')][_0x2962('0x2d')](_0x45d835,_0xaa7c42);};EmailChannel['prototype'][_0x2962('0x2e')]=function(_0x8d6f03){var _0x28b1fe=this;if(this[_0x2962('0xc')][_0x8d6f03['id']]){if(_[_0x2962('0x18')](this[_0x2962('0xc')][_0x8d6f03['id']][_0x2962('0x2f')])){this[_0x2962('0xc')][_0x8d6f03['id']]['Smtp']={};}this['mailAccounts'][_0x8d6f03['id']][_0x2962('0x2f')][_0x2962('0x2b')]=moment();return new BPromise(function(_0x4e6b54,_0x28c30a){return _0x28b1fe[_0x2962('0xe')][_0x2962('0x30')](_0x8d6f03)[_0x2962('0x29')](function(_0x4f8c1b){_0x28b1fe['mailAccounts'][_0x8d6f03['id']][_0x2962('0x2f')][_0x2962('0x15')]=_0x2962('0x31');_0x28b1fe['mailAccounts'][_0x8d6f03['id']][_0x2962('0x2f')]['messageStatus']='';_0x28b1fe['emit'](_0x8d6f03['id']);_0x4e6b54(_0x4f8c1b);})['catch'](function(_0x4de6d2){_0x28b1fe[_0x2962('0xc')][_0x8d6f03['id']][_0x2962('0x2f')]['status']=_0x2962('0x21');_0x28b1fe[_0x2962('0xc')][_0x8d6f03['id']][_0x2962('0x2f')][_0x2962('0x16')]=_0x4de6d2;_0x28b1fe['emit'](_0x8d6f03['id']);_0x28c30a(_0x4de6d2);});});}return this[_0x2962('0xe')]['verify'](_0x8d6f03);};module[_0x2962('0x32')]=EmailChannel; \ No newline at end of file +var _0xaeaf=['smtp','prototype','name','key','active','Imap','status','total','isNil','md5','refresh','hasOwnProperty','box','handleImapBox','bind','handleImapEmail','error','handleImapError','disabled','messageStatus','emit','connected','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','lastName','from','notify','then','Mail\x20accepted\x20from\x20routing','Mail\x20not\x20accepted\x20from\x20routing\x20%s','stringify','handleImapEnd','send','verifySmtp','Smtp','lastSync','verified','catch','exports','lodash','moment','bluebird','ioredis','../../../config/environment','email','redis','defaults','localhost','socket.io-emitter','./smtp','../rpc/mailAccount','info','mailAccounts','imapAccounts'];(function(_0x40c849,_0xbc22a1){var _0x7d3bef=function(_0x23df0c){while(--_0x23df0c){_0x40c849['push'](_0x40c849['shift']());}};_0x7d3bef(++_0xbc22a1);}(_0xaeaf,0x93));var _0xfaea=function(_0x19a5d8,_0x347207){_0x19a5d8=_0x19a5d8-0x0;var _0x30104a=_0xaeaf[_0x19a5d8];return _0x30104a;};'use strict';var _=require(_0xfaea('0x0'));var moment=require(_0xfaea('0x1'));var BPromise=require(_0xfaea('0x2'));var md5=require('md5');var Redis=require(_0xfaea('0x3'));var config=require(_0xfaea('0x4'));var logger=require('../../../config/logger')(_0xfaea('0x5'));config[_0xfaea('0x6')]=_[_0xfaea('0x7')](config[_0xfaea('0x6')],{'host':_0xfaea('0x8'),'port':0x18eb});var io=require(_0xfaea('0x9'))(new Redis(config[_0xfaea('0x6')]));var EmailImap=require('./imap');var EmailSmtp=require(_0xfaea('0xa'));var mailAccount=require(_0xfaea('0xb'));var md5Accounts={};function EmailChannel(_0x468c8e){logger[_0xfaea('0xc')]('start\x20email\x20channel');this['mailAccounts']=_0x468c8e[_0xfaea('0xd')];this[_0xfaea('0xe')]={};this[_0xfaea('0xf')]=new EmailSmtp();}EmailChannel[_0xfaea('0x10')]['emit']=function(_0x357587){var _0x257c20=this['mailAccounts'][_0x357587];var _0x1abf82={'id':_0x257c20['id'],'name':_0x257c20[_0xfaea('0x11')],'key':_0x257c20[_0xfaea('0x12')],'active':_0x257c20[_0xfaea('0x13')],'Imap':{'status':_0x257c20[_0xfaea('0x14')][_0xfaea('0x15')],'messageStatus':_0x257c20[_0xfaea('0x14')]['messageStatus'],'total':_0x257c20[_0xfaea('0x14')][_0xfaea('0x16')]}};if(_[_0xfaea('0x17')](md5Accounts[_0x357587])){md5Accounts[_0x357587]={};}var _0x6f16a8=md5(JSON['stringify'](_0x1abf82));if(md5Accounts[_0x357587][_0xfaea('0x18')]!==_0x6f16a8){md5Accounts[_0x357587][_0xfaea('0x18')]=_0x6f16a8;io['emit']('mailAccount:update',_0x1abf82);}};EmailChannel[_0xfaea('0x10')][_0xfaea('0x19')]=function(_0x1d5004){for(var _0x20930e in _0x1d5004){if(_0x1d5004['hasOwnProperty'](_0x20930e)){if(_0x1d5004[_0x20930e][_0xfaea('0x14')]&&_0x1d5004[_0x20930e]['active']){var _0x182c91=_0x1d5004[_0x20930e][_0xfaea('0x14')];if(!this[_0xfaea('0xe')][_0xfaea('0x1a')](_0x182c91['id'])){this['imapAccounts'][_0x182c91['id']]=new EmailImap(_0x182c91,_0x1d5004[_0x20930e][_0xfaea('0x5')]);this[_0xfaea('0xe')][_0x182c91['id']]['on'](_0xfaea('0x1b'),this[_0xfaea('0x1c')][_0xfaea('0x1d')](this,_0x20930e));this['imapAccounts'][_0x182c91['id']]['on'](_0xfaea('0x5'),this[_0xfaea('0x1e')][_0xfaea('0x1d')](this,_0x20930e));this[_0xfaea('0xe')][_0x182c91['id']]['on']('end',this['handleImapEnd'][_0xfaea('0x1d')](this,_0x20930e));this[_0xfaea('0xe')][_0x182c91['id']]['on'](_0xfaea('0x1f'),this[_0xfaea('0x20')][_0xfaea('0x1d')](this,_0x20930e));}}else{if(_['isNil'](this['mailAccounts'][_0x20930e][_0xfaea('0x14')])){this['mailAccounts'][_0x20930e][_0xfaea('0x14')]={};}this[_0xfaea('0xd')][_0x20930e][_0xfaea('0x14')][_0xfaea('0x15')]=_0xfaea('0x21');this[_0xfaea('0xd')][_0x20930e]['Imap'][_0xfaea('0x22')]='';this[_0xfaea('0x23')](_0x20930e);}}}};EmailChannel[_0xfaea('0x10')][_0xfaea('0x1c')]=function(_0x3271ba,_0x192bb1){if(this[_0xfaea('0xd')][_0x3271ba]){this[_0xfaea('0xd')][_0x3271ba][_0xfaea('0x14')]['status']=_0xfaea('0x24');this[_0xfaea('0xd')][_0x3271ba]['Imap'][_0xfaea('0x22')]=_0x192bb1[_0xfaea('0x11')];if(_0x192bb1['messages']){this['mailAccounts'][_0x3271ba][_0xfaea('0x14')][_0xfaea('0x16')]=_0x192bb1[_0xfaea('0x25')][_0xfaea('0x16')];}return this[_0xfaea('0x23')](_0x3271ba);}};EmailChannel[_0xfaea('0x10')][_0xfaea('0x1e')]=function(_0x3a4f4b,_0xcfb938){logger[_0xfaea('0xc')](_0xfaea('0x26'),_0xcfb938['firstName'],_0xcfb938[_0xfaea('0x27')],_0xcfb938[_0xfaea('0x28')],_0x3a4f4b);if(this[_0xfaea('0xd')][_0x3a4f4b]){return mailAccount[_0xfaea('0x29')](_0x3a4f4b,_0xcfb938)[_0xfaea('0x2a')](function(_0x2059db){if(_0x2059db){logger[_0xfaea('0xc')](_0xfaea('0x2b'));}})['catch'](function(_0x24f75c){logger[_0xfaea('0x1f')](_0xfaea('0x2c'),JSON[_0xfaea('0x2d')](_0x24f75c));});}};EmailChannel[_0xfaea('0x10')][_0xfaea('0x2e')]=function(_0x33c6a2){if(this[_0xfaea('0xd')][_0x33c6a2]&&this[_0xfaea('0xd')][_0x33c6a2]['Imap']){if(this[_0xfaea('0xe')][this[_0xfaea('0xd')][_0x33c6a2][_0xfaea('0x14')]['id']]){delete this[_0xfaea('0xe')][this[_0xfaea('0xd')][_0x33c6a2]['Imap']['id']];}this[_0xfaea('0xd')][_0x33c6a2][_0xfaea('0x14')]['lastSync']=moment();this['emit'](_0x33c6a2);}};EmailChannel['prototype'][_0xfaea('0x20')]=function(_0x597b8a,_0x54eff5){if(this[_0xfaea('0xd')][_0x597b8a]){this[_0xfaea('0xd')][_0x597b8a][_0xfaea('0x14')][_0xfaea('0x15')]=_0xfaea('0x1f');this['mailAccounts'][_0x597b8a][_0xfaea('0x14')][_0xfaea('0x22')]=_0x54eff5;return this['emit'](_0x597b8a);}};EmailChannel[_0xfaea('0x10')]['sendMail']=function(_0x4ffcb6,_0x399800){return this[_0xfaea('0xf')][_0xfaea('0x2f')](_0x4ffcb6,_0x399800);};EmailChannel[_0xfaea('0x10')][_0xfaea('0x30')]=function(_0x3e50fa){var _0x201fca=this;if(this[_0xfaea('0xd')][_0x3e50fa['id']]){if(_['isNil'](this['mailAccounts'][_0x3e50fa['id']]['Smtp'])){this[_0xfaea('0xd')][_0x3e50fa['id']]['Smtp']={};}this[_0xfaea('0xd')][_0x3e50fa['id']][_0xfaea('0x31')][_0xfaea('0x32')]=moment();return new BPromise(function(_0x1e74f0,_0x438792){return _0x201fca[_0xfaea('0xf')]['verify'](_0x3e50fa)[_0xfaea('0x2a')](function(_0x275877){_0x201fca['mailAccounts'][_0x3e50fa['id']]['Smtp'][_0xfaea('0x15')]=_0xfaea('0x33');_0x201fca[_0xfaea('0xd')][_0x3e50fa['id']]['Smtp'][_0xfaea('0x22')]='';_0x201fca[_0xfaea('0x23')](_0x3e50fa['id']);_0x1e74f0(_0x275877);})[_0xfaea('0x34')](function(_0x3a2038){_0x201fca[_0xfaea('0xd')][_0x3e50fa['id']][_0xfaea('0x31')]['status']=_0xfaea('0x1f');_0x201fca[_0xfaea('0xd')][_0x3e50fa['id']]['Smtp']['messageStatus']=_0x3a2038;_0x201fca[_0xfaea('0x23')](_0x3e50fa['id']);_0x438792(_0x3a2038);});});}return this[_0xfaea('0xf')]['verify'](_0x3e50fa);};module[_0xfaea('0x35')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 4b3faff..2304f56 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 _0xdd9a=['required','getHost','email','anonymous@xcally.com','openBox','mailbox','handleOpenBox','handleError','emit','box','readUnseen','UNSEEN','handleReadUnseen','length','fetch','handleFetchMessage','handleFetchError','handleFetchEnd','closeBox','body','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','account','handleCloseBox','textCode','hasOwnProperty','upperFirst','exports','path','imap','randomstring','mailparser','simpleParser','Iconv','EventEmitter','./utils','INBOX','getAccount','once','handleReady','bind','end','handleEnd','error','connect','inherits','prototype','authTimeout','isNil','authentication','user','password','host','port','tls','autotls'];(function(_0x3399d8,_0x4d6da7){var _0x1a14b1=function(_0x141d18){while(--_0x141d18){_0x3399d8['push'](_0x3399d8['shift']());}};_0x1a14b1(++_0x4d6da7);}(_0xdd9a,0x95));var _0xadd9=function(_0x5867b2,_0x476123){_0x5867b2=_0x5867b2-0x0;var _0x388cc1=_0xdd9a[_0x5867b2];return _0x388cc1;};'use strict';var fs=require('fs');var path=require(_0xadd9('0x0'));var util=require('util');var Imap=require(_0xadd9('0x1'));var _=require('lodash');var rs=require(_0xadd9('0x2'));var simpleParser=require(_0xadd9('0x3'))[_0xadd9('0x4')];var Iconv=require('iconv')[_0xadd9('0x5')];var EventEmitter=require('events')[_0xadd9('0x6')];var utils=require(_0xadd9('0x7'));var logger=require('../../../config/logger')('email');function EmailImap(_0x1dc781,_0x297bd3){this['mailbox']=_0xadd9('0x8');this['account']=this[_0xadd9('0x9')](_0x1dc781,_0x297bd3);this['imap']=new Imap(this['account']);this[_0xadd9('0x1')][_0xadd9('0xa')]('ready',this[_0xadd9('0xb')][_0xadd9('0xc')](this));this[_0xadd9('0x1')][_0xadd9('0xa')](_0xadd9('0xd'),this[_0xadd9('0xe')]['bind'](this));this[_0xadd9('0x1')]['on'](_0xadd9('0xf'),this['handleError']['bind'](this));this['imap'][_0xadd9('0x10')]();}util[_0xadd9('0x11')](EmailImap,EventEmitter);EmailImap[_0xadd9('0x12')][_0xadd9('0x9')]=function(_0x29f16a,_0x4aea21){var _0x570e94={'connTimeout':_0x29f16a['connTimeout']?_0x29f16a['connTimeout']*0x3e8:0x2710,'authTimeout':_0x29f16a['authTimeout']?_0x29f16a[_0xadd9('0x13')]*0x3e8:0x1388};if(_[_0xadd9('0x14')](_0x29f16a['service'])){if(_0x29f16a[_0xadd9('0x15')]){_0x570e94[_0xadd9('0x16')]=_0x29f16a['user'];_0x570e94[_0xadd9('0x17')]=_0x29f16a[_0xadd9('0x17')];}_0x570e94['host']=_0x29f16a[_0xadd9('0x18')];_0x570e94[_0xadd9('0x19')]=_0x29f16a[_0xadd9('0x19')]||0x3e1;if(_0x29f16a[_0xadd9('0x1a')]){_0x570e94[_0xadd9('0x1a')]=!![];}else{_0x570e94[_0xadd9('0x1a')]=![];_0x570e94[_0xadd9('0x1b')]=_0xadd9('0x1c');}}else{_0x570e94[_0xadd9('0x16')]=_0x29f16a['user'];_0x570e94[_0xadd9('0x17')]=_0x29f16a['password'];_0x570e94[_0xadd9('0x18')]=utils[_0xadd9('0x1d')](_0x29f16a['service']);_0x570e94['port']=0x3e1;_0x570e94[_0xadd9('0x1a')]=!![];}_0x570e94[_0xadd9('0x1e')]=_0x4aea21||_0x29f16a[_0xadd9('0x16')]||_0xadd9('0x1f');return _0x570e94;};EmailImap[_0xadd9('0x12')][_0xadd9('0xb')]=function(){this[_0xadd9('0x1')][_0xadd9('0x20')](this[_0xadd9('0x21')],![],this[_0xadd9('0x22')][_0xadd9('0xc')](this));};EmailImap[_0xadd9('0x12')]['handleOpenBox']=function(_0x294807,_0x1bc539){if(_0x294807){this[_0xadd9('0x23')](_0x294807,!![]);}else{this[_0xadd9('0x24')](_0xadd9('0x25'),_0x1bc539);this['readUnseen']();}};EmailImap['prototype']['handleCloseBox']=function(_0x1f45b9){if(_0x1f45b9){this[_0xadd9('0x23')](_0x1f45b9,!![]);}else{this['imap']['end']();}};EmailImap[_0xadd9('0x12')][_0xadd9('0x26')]=function(){this[_0xadd9('0x1')]['search']([_0xadd9('0x27')],this[_0xadd9('0x28')][_0xadd9('0xc')](this));};EmailImap[_0xadd9('0x12')][_0xadd9('0x28')]=function(_0x2ba18b,_0x5d7af5){if(_0x2ba18b){this['handleError'](_0x2ba18b,!![]);}else{if(_0x5d7af5[_0xadd9('0x29')]){try{var _0x3cd6d0=this[_0xadd9('0x1')][_0xadd9('0x2a')](_0x5d7af5,{'bodies':'','markSeen':!![]});_0x3cd6d0['on']('message',this[_0xadd9('0x2b')]['bind'](this));_0x3cd6d0[_0xadd9('0xa')](_0xadd9('0xf'),this[_0xadd9('0x2c')][_0xadd9('0xc')](this));_0x3cd6d0[_0xadd9('0xa')]('end',this[_0xadd9('0x2d')][_0xadd9('0xc')](this));}catch(_0xad1b85){logger[_0xadd9('0xf')](_0xad1b85);}}else{this['imap'][_0xadd9('0x2e')](!![],this['handleCloseBox'][_0xadd9('0xc')](this));}}};EmailImap[_0xadd9('0x12')][_0xadd9('0x2b')]=function(_0x7d4501,_0x539b05){_0x7d4501['on'](_0xadd9('0x2f'),this[_0xadd9('0x30')][_0xadd9('0xc')](this));_0x7d4501[_0xadd9('0xa')](_0xadd9('0x31'),this[_0xadd9('0x32')]['bind'](this));_0x7d4501[_0xadd9('0xa')](_0xadd9('0xd'),this[_0xadd9('0x33')]['bind'](this));};EmailImap[_0xadd9('0x12')][_0xadd9('0x30')]=function(_0x54eeb1,_0x45c2f6){simpleParser(_0x54eeb1,{'Iconv':Iconv},this[_0xadd9('0x34')][_0xadd9('0xc')](this));};EmailImap['prototype']['handleMessageAttributes']=function(_0x5a768d){};EmailImap[_0xadd9('0x12')]['handleMessageEnd']=function(){};EmailImap[_0xadd9('0x12')][_0xadd9('0x34')]=function(_0x279fce,_0x3c2ce8){if(_0x279fce){logger['error'](_0x279fce);}else{var _0x1b3550=this;utils['parser'](this[_0xadd9('0x35')],_0x3c2ce8,function(_0x2ff82c){_0x1b3550[_0xadd9('0x24')]('email',_0x2ff82c);});}};EmailImap[_0xadd9('0x12')][_0xadd9('0x2d')]=function(){this['imap'][_0xadd9('0x2e')](!![],this[_0xadd9('0x36')]['bind'](this));};EmailImap[_0xadd9('0x12')]['handleFetchError']=function(_0xddccd4){this['handleError'](_0xddccd4);this[_0xadd9('0x1')][_0xadd9('0x2e')](!![],this['handleCloseBox']['bind'](this));};EmailImap[_0xadd9('0x12')][_0xadd9('0xe')]=function(){this['emit']('end');};EmailImap[_0xadd9('0x12')]['handleError']=function(_0x39dbde,_0x39b5ef){logger[_0xadd9('0xf')](_0xadd9('0x23'),this[_0xadd9('0x35')][_0xadd9('0x1e')],JSON['stringify'](_0x39dbde));var _0x55b166='';if(_0x39dbde){if(_0x39dbde[_0xadd9('0x37')]){_0x55b166=_0x39dbde['textCode'];}else{for(var _0xb0f0dd in _0x39dbde){if(_0x39dbde[_0xadd9('0x38')](_0xb0f0dd)){_0x55b166+=_[_0xadd9('0x39')](_0xb0f0dd)+':\x20'+_0x39dbde[_0xb0f0dd]+'\x0a';}}}}if(_0x39b5ef){this['imap']['end']();}else{this[_0xadd9('0x24')]('error',_0x55b166);this[_0xadd9('0x24')](_0xadd9('0xd'));}};module[_0xadd9('0x3a')]=EmailImap; \ No newline at end of file +var _0x8002=['handleFetchMessage','end','handleFetchEnd','body','handleMessageBody','attributes','handleMessageEnd','handleSimpleParser','handleMessageAttributes','handleFetchError','closeBox','stringify','textCode','hasOwnProperty','upperFirst','exports','util','lodash','randomstring','mailparser','simpleParser','iconv','Iconv','events','./utils','../../../config/logger','email','mailbox','INBOX','getAccount','imap','account','once','ready','bind','handleEnd','error','connect','connTimeout','authTimeout','isNil','authentication','user','password','host','port','tls','autotls','required','getHost','service','handleReady','openBox','handleOpenBox','prototype','emit','box','readUnseen','handleCloseBox','search','UNSEEN','handleReadUnseen','handleError','fetch'];(function(_0x35e768,_0xbe0d60){var _0x58cc5f=function(_0x1b12fb){while(--_0x1b12fb){_0x35e768['push'](_0x35e768['shift']());}};_0x58cc5f(++_0xbe0d60);}(_0x8002,0x150));var _0x2800=function(_0x324c7a,_0x1db1ac){_0x324c7a=_0x324c7a-0x0;var _0x12bb2e=_0x8002[_0x324c7a];return _0x12bb2e;};'use strict';var fs=require('fs');var path=require('path');var util=require(_0x2800('0x0'));var Imap=require('imap');var _=require(_0x2800('0x1'));var rs=require(_0x2800('0x2'));var simpleParser=require(_0x2800('0x3'))[_0x2800('0x4')];var Iconv=require(_0x2800('0x5'))[_0x2800('0x6')];var EventEmitter=require(_0x2800('0x7'))['EventEmitter'];var utils=require(_0x2800('0x8'));var logger=require(_0x2800('0x9'))(_0x2800('0xa'));function EmailImap(_0x5dba89,_0x2b4050){this[_0x2800('0xb')]=_0x2800('0xc');this['account']=this[_0x2800('0xd')](_0x5dba89,_0x2b4050);this[_0x2800('0xe')]=new Imap(this[_0x2800('0xf')]);this[_0x2800('0xe')][_0x2800('0x10')](_0x2800('0x11'),this['handleReady'][_0x2800('0x12')](this));this[_0x2800('0xe')][_0x2800('0x10')]('end',this[_0x2800('0x13')][_0x2800('0x12')](this));this['imap']['on'](_0x2800('0x14'),this['handleError'][_0x2800('0x12')](this));this[_0x2800('0xe')][_0x2800('0x15')]();}util['inherits'](EmailImap,EventEmitter);EmailImap['prototype'][_0x2800('0xd')]=function(_0x3380e0,_0x1bdef4){var _0x3c38e5={'connTimeout':_0x3380e0[_0x2800('0x16')]?_0x3380e0[_0x2800('0x16')]*0x3e8:0x2710,'authTimeout':_0x3380e0[_0x2800('0x17')]?_0x3380e0[_0x2800('0x17')]*0x3e8:0x1388};if(_[_0x2800('0x18')](_0x3380e0['service'])){if(_0x3380e0[_0x2800('0x19')]){_0x3c38e5['user']=_0x3380e0[_0x2800('0x1a')];_0x3c38e5[_0x2800('0x1b')]=_0x3380e0['password'];}_0x3c38e5['host']=_0x3380e0[_0x2800('0x1c')];_0x3c38e5[_0x2800('0x1d')]=_0x3380e0[_0x2800('0x1d')]||0x3e1;if(_0x3380e0[_0x2800('0x1e')]){_0x3c38e5[_0x2800('0x1e')]=!![];}else{_0x3c38e5['tls']=![];_0x3c38e5[_0x2800('0x1f')]=_0x2800('0x20');}}else{_0x3c38e5['user']=_0x3380e0[_0x2800('0x1a')];_0x3c38e5[_0x2800('0x1b')]=_0x3380e0[_0x2800('0x1b')];_0x3c38e5[_0x2800('0x1c')]=utils[_0x2800('0x21')](_0x3380e0[_0x2800('0x22')]);_0x3c38e5[_0x2800('0x1d')]=0x3e1;_0x3c38e5[_0x2800('0x1e')]=!![];}_0x3c38e5[_0x2800('0xa')]=_0x1bdef4||_0x3380e0['user']||'anonymous@xcally.com';return _0x3c38e5;};EmailImap['prototype'][_0x2800('0x23')]=function(){this['imap'][_0x2800('0x24')](this[_0x2800('0xb')],![],this[_0x2800('0x25')]['bind'](this));};EmailImap[_0x2800('0x26')][_0x2800('0x25')]=function(_0xa1d032,_0x4e4ac0){if(_0xa1d032){this['handleError'](_0xa1d032,!![]);}else{this[_0x2800('0x27')](_0x2800('0x28'),_0x4e4ac0);this[_0x2800('0x29')]();}};EmailImap[_0x2800('0x26')][_0x2800('0x2a')]=function(_0x4f1137){if(_0x4f1137){this['handleError'](_0x4f1137,!![]);}else{this['imap']['end']();}};EmailImap[_0x2800('0x26')]['readUnseen']=function(){this[_0x2800('0xe')][_0x2800('0x2b')]([_0x2800('0x2c')],this[_0x2800('0x2d')][_0x2800('0x12')](this));};EmailImap[_0x2800('0x26')][_0x2800('0x2d')]=function(_0x585074,_0x307b5a){if(_0x585074){this[_0x2800('0x2e')](_0x585074,!![]);}else{if(_0x307b5a['length']){try{var _0x514538=this[_0x2800('0xe')][_0x2800('0x2f')](_0x307b5a,{'bodies':'','markSeen':!![]});_0x514538['on']('message',this[_0x2800('0x30')][_0x2800('0x12')](this));_0x514538[_0x2800('0x10')](_0x2800('0x14'),this['handleFetchError'][_0x2800('0x12')](this));_0x514538['once'](_0x2800('0x31'),this[_0x2800('0x32')][_0x2800('0x12')](this));}catch(_0x1b03e5){logger[_0x2800('0x14')](_0x1b03e5);}}else{this[_0x2800('0xe')]['closeBox'](!![],this['handleCloseBox'][_0x2800('0x12')](this));}}};EmailImap[_0x2800('0x26')]['handleFetchMessage']=function(_0x366c7a,_0xcfab9b){_0x366c7a['on'](_0x2800('0x33'),this[_0x2800('0x34')]['bind'](this));_0x366c7a['once'](_0x2800('0x35'),this['handleMessageAttributes']['bind'](this));_0x366c7a['once'](_0x2800('0x31'),this[_0x2800('0x36')]['bind'](this));};EmailImap[_0x2800('0x26')][_0x2800('0x34')]=function(_0x43a41f,_0x5d164e){simpleParser(_0x43a41f,{'Iconv':Iconv},this[_0x2800('0x37')][_0x2800('0x12')](this));};EmailImap[_0x2800('0x26')][_0x2800('0x38')]=function(_0x3e5a19){};EmailImap[_0x2800('0x26')][_0x2800('0x36')]=function(){};EmailImap[_0x2800('0x26')][_0x2800('0x37')]=function(_0x529d91,_0x39f7b7){if(_0x529d91){logger[_0x2800('0x14')](_0x529d91);}else{var _0x3e37a4=this;utils['parser'](this[_0x2800('0xf')],_0x39f7b7,function(_0x3bee00){_0x3e37a4[_0x2800('0x27')](_0x2800('0xa'),_0x3bee00);});}};EmailImap[_0x2800('0x26')]['handleFetchEnd']=function(){this['imap']['closeBox'](!![],this[_0x2800('0x2a')]['bind'](this));};EmailImap['prototype'][_0x2800('0x39')]=function(_0x15bdd5){this[_0x2800('0x2e')](_0x15bdd5);this[_0x2800('0xe')][_0x2800('0x3a')](!![],this['handleCloseBox'][_0x2800('0x12')](this));};EmailImap['prototype'][_0x2800('0x13')]=function(){this[_0x2800('0x27')](_0x2800('0x31'));};EmailImap[_0x2800('0x26')][_0x2800('0x2e')]=function(_0xdf04e0,_0x2a1e00){logger[_0x2800('0x14')](_0x2800('0x2e'),this[_0x2800('0xf')][_0x2800('0xa')],JSON[_0x2800('0x3b')](_0xdf04e0));var _0xc7daaf='';if(_0xdf04e0){if(_0xdf04e0['textCode']){_0xc7daaf=_0xdf04e0[_0x2800('0x3c')];}else{for(var _0x30f300 in _0xdf04e0){if(_0xdf04e0[_0x2800('0x3d')](_0x30f300)){_0xc7daaf+=_[_0x2800('0x3e')](_0x30f300)+':\x20'+_0xdf04e0[_0x30f300]+'\x0a';}}}}if(_0x2a1e00){this[_0x2800('0xe')]['end']();}else{this[_0x2800('0x27')](_0x2800('0x14'),_0xc7daaf);this[_0x2800('0x27')](_0x2800('0x31'));}};module[_0x2800('0x3f')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 0ea4fc1..3ed68d0 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 _0x5f43=['use','compile','sendMail','toString','verify','Not\x20verifired','exports','nodemailer','bluebird','nodemailer-plugin-inline-base64','prototype','send','createTransport'];(function(_0x42cdc3,_0xf611af){var _0x38caa0=function(_0x126cd5){while(--_0x126cd5){_0x42cdc3['push'](_0x42cdc3['shift']());}};_0x38caa0(++_0xf611af);}(_0x5f43,0x14c));var _0x35f4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5f43[_0x3dd15e];return _0x231fd0;};'use strict';var nodemailer=require(_0x35f4('0x0'));var BPromise=require(_0x35f4('0x1'));var inlineBase64=require(_0x35f4('0x2'));function EmailSmtp(){}EmailSmtp[_0x35f4('0x3')][_0x35f4('0x4')]=function(_0x5230f4,_0x19dd08){return new BPromise(function(_0x17306e,_0x3b830c){var _0x24bfec=nodemailer[_0x35f4('0x5')](_0x5230f4);_0x24bfec[_0x35f4('0x6')](_0x35f4('0x7'),inlineBase64());_0x24bfec[_0x35f4('0x8')](_0x19dd08,function(_0x1d6cb6,_0x155c4c){if(_0x1d6cb6){_0x3b830c(_0x1d6cb6[_0x35f4('0x9')]());}else{_0x17306e(_0x155c4c);}});});};EmailSmtp['prototype']['verify']=function(_0x320368){return new BPromise(function(_0xcd7ed8,_0x1926af){var _0x1fc915=nodemailer[_0x35f4('0x5')](_0x320368);_0x1fc915[_0x35f4('0xa')](function(_0x35a0f6,_0x2c2b37){if(_0x35a0f6){_0x1926af(_0x35a0f6[_0x35f4('0x9')]());}else{if(_0x2c2b37){_0xcd7ed8(_0x2c2b37);}else{_0x1926af(_0x35f4('0xb'));}}});});};module[_0x35f4('0xc')]=EmailSmtp; \ No newline at end of file +var _0x9dd1=['prototype','send','createTransport','use','compile','verify','toString','Not\x20verifired','nodemailer-plugin-inline-base64'];(function(_0x472a93,_0x1b8ad7){var _0x1b888c=function(_0x51515d){while(--_0x51515d){_0x472a93['push'](_0x472a93['shift']());}};_0x1b888c(++_0x1b8ad7);}(_0x9dd1,0x7d));var _0x19dd=function(_0x561f25,_0x2d95c1){_0x561f25=_0x561f25-0x0;var _0x150e4c=_0x9dd1[_0x561f25];return _0x150e4c;};'use strict';var nodemailer=require('nodemailer');var BPromise=require('bluebird');var inlineBase64=require(_0x19dd('0x0'));function EmailSmtp(){}EmailSmtp[_0x19dd('0x1')][_0x19dd('0x2')]=function(_0x3b11c2,_0x183ca5){return new BPromise(function(_0x330244,_0xe78e59){var _0x134abd=nodemailer[_0x19dd('0x3')](_0x3b11c2);_0x134abd[_0x19dd('0x4')](_0x19dd('0x5'),inlineBase64());_0x134abd['sendMail'](_0x183ca5,function(_0x69cb53,_0x664eca){if(_0x69cb53){_0xe78e59(_0x69cb53['toString']());}else{_0x330244(_0x664eca);}});});};EmailSmtp[_0x19dd('0x1')][_0x19dd('0x6')]=function(_0x175485){return new BPromise(function(_0x5357a7,_0x5d7964){var _0x1afeec=nodemailer[_0x19dd('0x3')](_0x175485);_0x1afeec[_0x19dd('0x6')](function(_0x452d63,_0x2f94b7){if(_0x452d63){_0x5d7964(_0x452d63[_0x19dd('0x7')]());}else{if(_0x2f94b7){_0x5357a7(_0x2f94b7);}else{_0x5d7964(_0x19dd('0x8'));}}});});};module['exports']=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index 5fd8826..afbb770 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 _0x655e=['type','attachment-','format','%s-%s','now','root','server/files/attachments/','writeFileSync','push','contentType','parser','from','subject','messageId','inReplyTo','YYYY-MM-DD\x20HH:mm:ss','filter','application/ms-tnef','info','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','parseBuffer','first','BodyHTML','

Empty\x20message

','Attachments','Title','Data','getHost','gmail','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','127.0.0.1','lodash','moment','randomstring','path','util','node-tnef','email','../../../config/environment','head','address','@xcally.com','value','name','length','slice','join','Anonymous','split','pop','isEmpty','anonymous','html','test','body','textAsHtml','replace','0x1?_0x5a49a4[_0xe655('0x12')]():'';}return'';}function getMails(_0x478b3c,_0x25a4ae){var _0x3ea548='';for(var _0x4b9e74=0x0;_0x4b9e74<_0x25a4ae[_0xe655('0xb')]['length'];_0x4b9e74+=0x1){if(_0x25a4ae['value'][_0x4b9e74][_0xe655('0x9')]!==_0x478b3c){if(!_[_0xe655('0x13')](_0x3ea548)){_0x3ea548+=',';}_0x3ea548+=_0x25a4ae[_0xe655('0xb')][_0x4b9e74][_0xe655('0xc')]||_0x25a4ae[_0xe655('0xb')][_0x4b9e74][_0xe655('0x9')]||'';_0x3ea548+='\x20<';_0x3ea548+=_0x25a4ae[_0xe655('0xb')][_0x4b9e74]['address']?_0x25a4ae[_0xe655('0xb')][_0x4b9e74]['address']:_0xe655('0x14')+random['generate'](0x6)+_0xe655('0xa');_0x3ea548+='>';}}return _0x3ea548;}function parseEmail(_0x5b2170,_0x1131e1,_0x67bb4d){if(_0x1131e1[_0xe655('0x15')]){var _0x1d3f13=/)<[^<]*)*<\/script>/gi;while(_0x1d3f13[_0xe655('0x16')](_0x1131e1[_0xe655('0x15')])){_0x1131e1[_0xe655('0x15')]=_0x1131e1[_0xe655('0x15')]['replace'](_0x1d3f13,'');}_0x67bb4d[_0xe655('0x17')]=_0x1131e1[_0xe655('0x15')];}else{_0x67bb4d[_0xe655('0x17')]=_0x1131e1[_0xe655('0x18')];}if(_0x67bb4d[_0xe655('0x17')]){_0x67bb4d['body']=_0x67bb4d[_0xe655('0x17')][_0xe655('0x19')](/Empty\x20message

','Attachments','Data','getHost','gmail','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','lodash','moment','randomstring','path','util','node-tnef','../../../config/logger','../../../config/environment','value','address','@xcally.com','head','split','length','slice','join','name','Anonymous','anonymous','generate','html','replace','body','textAsHtml','0x1?_0x5a1f9c['pop']():'';}return'';}function getMails(_0x16a93b,_0x1c1678){var _0x22445b='';for(var _0x461ac9=0x0;_0x461ac9<_0x1c1678[_0xb7a2('0x8')][_0xb7a2('0xd')];_0x461ac9+=0x1){if(_0x1c1678[_0xb7a2('0x8')][_0x461ac9]['address']!==_0x16a93b){if(!_['isEmpty'](_0x22445b)){_0x22445b+=',';}_0x22445b+=_0x1c1678[_0xb7a2('0x8')][_0x461ac9][_0xb7a2('0x10')]||_0x1c1678['value'][_0x461ac9][_0xb7a2('0x9')]||'';_0x22445b+='\x20<';_0x22445b+=_0x1c1678[_0xb7a2('0x8')][_0x461ac9][_0xb7a2('0x9')]?_0x1c1678[_0xb7a2('0x8')][_0x461ac9]['address']:_0xb7a2('0x12')+random[_0xb7a2('0x13')](0x6)+'@xcally.com';_0x22445b+='>';}}return _0x22445b;}function parseEmail(_0x41774e,_0x3fb393,_0x354463){if(_0x3fb393[_0xb7a2('0x14')]){var _0x3108a7=/)<[^<]*)*<\/script>/gi;while(_0x3108a7['test'](_0x3fb393[_0xb7a2('0x14')])){_0x3fb393[_0xb7a2('0x14')]=_0x3fb393['html'][_0xb7a2('0x15')](_0x3108a7,'');}_0x354463[_0xb7a2('0x16')]=_0x3fb393[_0xb7a2('0x14')];}else{_0x354463['body']=_0x3fb393[_0xb7a2('0x17')];}if(_0x354463[_0xb7a2('0x16')]){_0x354463[_0xb7a2('0x16')]=_0x354463[_0xb7a2('0x16')][_0xb7a2('0x15')](/0x0){if(this[_0x2a15b8+'Capacity']>0x0&&this[_0x2a15b8+_0x9bb5('0x26')]>=this[_0x2a15b8+_0x9bb5('0x27')]){return'maxcapacity';}else{return _0x9bb5('0x28');}}else{return'idle';}};Agent[_0x9bb5('0x24')]['updateRealtime']=function(){var _0x4be52b=[_0x9bb5('0x29'),_0x9bb5('0x2a'),'openchannel',_0x9bb5('0x2b'),_0x9bb5('0x2c'),_0x9bb5('0x2d')];for(var _0x5cf6ef=0x0;_0x5cf6ef<_0x4be52b['length'];_0x5cf6ef+=0x1){var _0x12b230=this[_0x9bb5('0x25')](_0x4be52b[_0x5cf6ef]);if(this[_0x4be52b[_0x5cf6ef]+_0x9bb5('0x2e')]!==_0x12b230){this[_0x4be52b[_0x5cf6ef]+'StatusTime']=_[_0x9bb5('0x2f')](moment()[_0x9bb5('0x30')]('x'));}this[_0x4be52b[_0x5cf6ef]+_0x9bb5('0x2e')]=_0x12b230;}var _0x4b38d5={'id':this['id'],'name':this['name'],'online':this['online'],'voicePause':this[_0x9bb5('0x9')],'chatPause':this[_0x9bb5('0xa')],'mailPause':this[_0x9bb5('0xb')],'smsPause':this[_0x9bb5('0xd')],'faxPause':this[_0x9bb5('0xc')],'openchannelPause':this['openchannelPause'],'chatStatus':this['chatStatus'],'chatStatusTime':this['chatStatusTime'],'chatCapacity':this[_0x9bb5('0x12')],'chatCurrentCapacity':this[_0x9bb5('0x13')],'mailStatus':this[_0x9bb5('0x14')],'mailStatusTime':this['mailStatusTime'],'mailCapacity':this['mailCapacity'],'mailCurrentCapacity':this['mailCurrentCapacity'],'faxStatus':this[_0x9bb5('0x31')],'faxStatusTime':this[_0x9bb5('0x32')],'faxCapacity':this[_0x9bb5('0x17')],'faxCurrentCapacity':this['faxCurrentCapacity'],'smsStatus':this['smsStatus'],'smsStatusTime':this[_0x9bb5('0x19')],'smsCapacity':this[_0x9bb5('0x1a')],'smsCurrentCapacity':this[_0x9bb5('0x1b')],'whatsappStatus':this[_0x9bb5('0x1c')],'whatsappStatusTime':this['whatsappStatusTime'],'whatsappCapacity':this[_0x9bb5('0x1e')],'whatsappCurrentCapacity':this[_0x9bb5('0x1f')],'openchannelStatus':this[_0x9bb5('0x33')],'openchannelStatusTime':this[_0x9bb5('0x20')],'openchannelCapacity':this[_0x9bb5('0x21')],'openchannelCurrentCapacity':this[_0x9bb5('0x34')],'busy':this[_0x9bb5('0x22')],'busyQueue':this['busyQueue']};var _0x5d7841=md5(JSON[_0x9bb5('0x35')](_0x4b38d5));if(this[_0x9bb5('0x2')]!==_0x5d7841){this['md5']=_0x5d7841;io[_0x9bb5('0x36')]('user:save',_0x4b38d5);}};module[_0x9bb5('0x37')]=Agent; \ No newline at end of file +var _0x1f92=['mailStatus','mailCapacity','faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','prototype','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','idle','updateRealtime','mail','chat','openchannel','fax','sms','whatsapp','length','Status','StatusTime','toNumber','format','faxPause','mailStatusTime','mailCurrentCapacity','stringify','emit','user:save','exports','lodash','md5','ioredis','defaults','redis','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity'];(function(_0x2a0a38,_0x4a6de5){var _0x4a200e=function(_0x2ef26b){while(--_0x2ef26b){_0x2a0a38['push'](_0x2a0a38['shift']());}};_0x4a200e(++_0x4a6de5);}(_0x1f92,0x1ad));var _0x21f9=function(_0x248298,_0x5b7198){_0x248298=_0x248298-0x0;var _0x36a5b5=_0x1f92[_0x248298];return _0x36a5b5;};'use strict';var _=require(_0x21f9('0x0'));var moment=require('moment');var md5=require(_0x21f9('0x1'));var Redis=require(_0x21f9('0x2'));var config=require('../../../config/environment');config['redis']=_[_0x21f9('0x3')](config[_0x21f9('0x4')],{'host':_0x21f9('0x5'),'port':0x18eb});var io=require(_0x21f9('0x6'))(new Redis(config[_0x21f9('0x4')]));function Agent(_0x3c618b){this['id']=_0x3c618b['id']||0x0;this[_0x21f9('0x7')]=_0x3c618b[_0x21f9('0x7')]||'';this[_0x21f9('0x8')]=_0x3c618b[_0x21f9('0x8')]||!![];this[_0x21f9('0x9')]=_0x3c618b[_0x21f9('0x9')]||![];this['chatPause']=_0x3c618b[_0x21f9('0xa')]||![];this[_0x21f9('0xb')]=_0x3c618b[_0x21f9('0xb')]||![];this['faxPause']=_0x3c618b['faxPause']||![];this[_0x21f9('0xc')]=_0x3c618b[_0x21f9('0xc')]||![];this['openchannelPause']=_0x3c618b[_0x21f9('0xd')]||![];this[_0x21f9('0xe')]=_0x21f9('0xf');this[_0x21f9('0x10')]=0x0;this[_0x21f9('0x11')]=_0x3c618b[_0x21f9('0x11')]||0x0;this[_0x21f9('0x12')]=0x0;this[_0x21f9('0x13')]=_0x21f9('0xf');this['mailStatusTime']=0x0;this['mailCapacity']=_0x3c618b[_0x21f9('0x14')]||0x0;this['mailCurrentCapacity']=0x0;this[_0x21f9('0x15')]=_0x21f9('0xf');this[_0x21f9('0x16')]=0x0;this[_0x21f9('0x17')]=_0x3c618b[_0x21f9('0x17')]||0x0;this[_0x21f9('0x18')]=0x0;this[_0x21f9('0x19')]='unknown';this[_0x21f9('0x1a')]=0x0;this[_0x21f9('0x1b')]=_0x3c618b[_0x21f9('0x1b')]||0x0;this[_0x21f9('0x1c')]=0x0;this[_0x21f9('0x1d')]=_0x21f9('0xf');this[_0x21f9('0x1e')]=0x0;this[_0x21f9('0x1f')]=_0x3c618b[_0x21f9('0x1f')]||0x0;this[_0x21f9('0x20')]=0x0;this[_0x21f9('0x21')]=_0x21f9('0xf');this[_0x21f9('0x22')]=0x0;this[_0x21f9('0x23')]=_0x3c618b[_0x21f9('0x23')]||0x0;this[_0x21f9('0x24')]=0x0;this[_0x21f9('0x25')]=![];this[_0x21f9('0x26')]=undefined;this[_0x21f9('0x1')]='';this['updateRealtime']();}Agent[_0x21f9('0x27')][_0x21f9('0x28')]=function(_0x2b6058){if(this[_0x2b6058+'CurrentCapacity']>0x0){if(this[_0x2b6058+'Capacity']>0x0&&this[_0x2b6058+_0x21f9('0x29')]>=this[_0x2b6058+_0x21f9('0x2a')]){return _0x21f9('0x2b');}else{return'working';}}else{return _0x21f9('0x2c');}};Agent[_0x21f9('0x27')][_0x21f9('0x2d')]=function(){var _0x4fab42=[_0x21f9('0x2e'),_0x21f9('0x2f'),_0x21f9('0x30'),_0x21f9('0x31'),_0x21f9('0x32'),_0x21f9('0x33')];for(var _0x48d725=0x0;_0x48d725<_0x4fab42[_0x21f9('0x34')];_0x48d725+=0x1){var _0x62e29f=this[_0x21f9('0x28')](_0x4fab42[_0x48d725]);if(this[_0x4fab42[_0x48d725]+_0x21f9('0x35')]!==_0x62e29f){this[_0x4fab42[_0x48d725]+_0x21f9('0x36')]=_[_0x21f9('0x37')](moment()[_0x21f9('0x38')]('x'));}this[_0x4fab42[_0x48d725]+'Status']=_0x62e29f;}var _0x5b22ce={'id':this['id'],'name':this[_0x21f9('0x7')],'online':this[_0x21f9('0x8')],'voicePause':this['voicePause'],'chatPause':this[_0x21f9('0xa')],'mailPause':this[_0x21f9('0xb')],'smsPause':this[_0x21f9('0xc')],'faxPause':this[_0x21f9('0x39')],'openchannelPause':this[_0x21f9('0xd')],'chatStatus':this['chatStatus'],'chatStatusTime':this[_0x21f9('0x10')],'chatCapacity':this[_0x21f9('0x11')],'chatCurrentCapacity':this[_0x21f9('0x12')],'mailStatus':this[_0x21f9('0x13')],'mailStatusTime':this[_0x21f9('0x3a')],'mailCapacity':this[_0x21f9('0x14')],'mailCurrentCapacity':this[_0x21f9('0x3b')],'faxStatus':this[_0x21f9('0x15')],'faxStatusTime':this[_0x21f9('0x16')],'faxCapacity':this[_0x21f9('0x17')],'faxCurrentCapacity':this[_0x21f9('0x18')],'smsStatus':this[_0x21f9('0x19')],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this[_0x21f9('0x1b')],'smsCurrentCapacity':this[_0x21f9('0x1c')],'whatsappStatus':this[_0x21f9('0x1d')],'whatsappStatusTime':this[_0x21f9('0x1e')],'whatsappCapacity':this[_0x21f9('0x1f')],'whatsappCurrentCapacity':this[_0x21f9('0x20')],'openchannelStatus':this[_0x21f9('0x21')],'openchannelStatusTime':this['openchannelStatusTime'],'openchannelCapacity':this[_0x21f9('0x23')],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this[_0x21f9('0x25')],'busyQueue':this[_0x21f9('0x26')]};var _0x5b9bbb=md5(JSON[_0x21f9('0x3c')](_0x5b22ce));if(this[_0x21f9('0x1')]!==_0x5b9bbb){this['md5']=_0x5b9bbb;io[_0x21f9('0x3d')](_0x21f9('0x3e'),_0x5b22ce);}};module[_0x21f9('0x3f')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index a01d844..c2fd0fa 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 _0x4a55=['socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','chatPause','available','stringify','chat:queue:%s','emit','chat_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','defaults','localhost'];(function(_0x5a280a,_0xd1c6e8){var _0x20a1df=function(_0x2bfee9){while(--_0x2bfee9){_0x5a280a['push'](_0x5a280a['shift']());}};_0x20a1df(++_0xd1c6e8);}(_0x4a55,0x107));var _0x54a5=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x4a55[_0x2be8c2];return _0x97f531;};'use strict';var _=require(_0x54a5('0x0'));var md5=require(_0x54a5('0x1'));var util=require(_0x54a5('0x2'));var Redis=require(_0x54a5('0x3'));var config=require(_0x54a5('0x4'));config['redis']=_[_0x54a5('0x5')](config['redis'],{'host':_0x54a5('0x6'),'port':0x18eb});var io=require(_0x54a5('0x7'))(new Redis(config['redis']));function ChatQueue(_0x55ac78){this['id']=_0x55ac78['id']||0x0;this[_0x54a5('0x8')]=_0x55ac78[_0x54a5('0x8')]||'';this[_0x54a5('0x9')]=_0x55ac78[_0x54a5('0x9')]||0xa;this['strategy']=_0x55ac78[_0x54a5('0xa')]||_0x54a5('0xb');this[_0x54a5('0xc')]=_0x55ac78[_0x54a5('0xc')];this[_0x54a5('0xd')]={};this[_0x54a5('0xe')]=0x0;this[_0x54a5('0x1')]='';this[_0x54a5('0xf')]();this[_0x54a5('0x10')]();}ChatQueue[_0x54a5('0x11')][_0x54a5('0xf')]=function(){var _0x3335da=this[_0x54a5('0xd')][_0x54a5('0x12')];this[_0x54a5('0xd')]=_[_0x54a5('0x13')](this[_0x54a5('0xc')],'id');this[_0x54a5('0xd')][_0x54a5('0x12')]=_0x3335da;};ChatQueue[_0x54a5('0x11')][_0x54a5('0x10')]=function(){this[_0x54a5('0x14')]=0x0;this[_0x54a5('0x15')]=0x0;for(var _0x318d06=0x0;_0x318d06=0x0?this[_0x54a5('0x18')]:0x0;var _0x4fbfba={'id':this['id'],'available':this[_0x54a5('0x18')],'loggedIn':this['loggedIn'],'name':this[_0x54a5('0x8')],'paused':this['paused'],'waiting':this[_0x54a5('0xe')]};var _0x5b540a=md5(JSON[_0x54a5('0x19')](_0x4fbfba));if(this[_0x54a5('0x1')]!==_0x5b540a){this[_0x54a5('0x1')]=_0x5b540a;io['to'](util['format'](_0x54a5('0x1a'),_0x4fbfba[_0x54a5('0x8')]))[_0x54a5('0x1b')](_0x54a5('0x1c'),_0x4fbfba);}};module[_0x54a5('0x1d')]=ChatQueue; \ No newline at end of file +var _0x1894=['exports','lodash','util','ioredis','../../../config/environment','redis','defaults','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','online','available','format','chat:queue:%s','emit','chat_queue:save'];(function(_0xf5bbc2,_0x49e6c5){var _0x3d9a7b=function(_0x2c5e32){while(--_0x2c5e32){_0xf5bbc2['push'](_0xf5bbc2['shift']());}};_0x3d9a7b(++_0x49e6c5);}(_0x1894,0x1a5));var _0x4189=function(_0x44ca6e,_0x5e2c91){_0x44ca6e=_0x44ca6e-0x0;var _0x2edab2=_0x1894[_0x44ca6e];return _0x2edab2;};'use strict';var _=require(_0x4189('0x0'));var md5=require('md5');var util=require(_0x4189('0x1'));var Redis=require(_0x4189('0x2'));var config=require(_0x4189('0x3'));config[_0x4189('0x4')]=_[_0x4189('0x5')](config[_0x4189('0x4')],{'host':_0x4189('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x4189('0x4')]));function ChatQueue(_0x46e76a){this['id']=_0x46e76a['id']||0x0;this[_0x4189('0x7')]=_0x46e76a[_0x4189('0x7')]||'';this[_0x4189('0x8')]=_0x46e76a[_0x4189('0x8')]||0xa;this[_0x4189('0x9')]=_0x46e76a[_0x4189('0x9')]||_0x4189('0xa');this[_0x4189('0xb')]=_0x46e76a[_0x4189('0xb')];this[_0x4189('0xc')]={};this[_0x4189('0xd')]=0x0;this[_0x4189('0xe')]='';this[_0x4189('0xf')]();this[_0x4189('0x10')]();}ChatQueue[_0x4189('0x11')]['updateRouting']=function(){var _0x1d05c4=this['mapAgentsId'][_0x4189('0x12')];this[_0x4189('0xc')]=_[_0x4189('0x13')](this[_0x4189('0xb')],'id');this[_0x4189('0xc')][_0x4189('0x12')]=_0x1d05c4;};ChatQueue[_0x4189('0x11')][_0x4189('0x10')]=function(){this[_0x4189('0x14')]=0x0;this[_0x4189('0x15')]=0x0;for(var _0x1b502e=0x0;_0x1b502e=0x0?this[_0x4189('0x18')]:0x0;var _0x36c579={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this['paused'],'waiting':this['waiting']};var _0x11ca0d=md5(JSON['stringify'](_0x36c579));if(this[_0x4189('0xe')]!==_0x11ca0d){this[_0x4189('0xe')]=_0x11ca0d;io['to'](util[_0x4189('0x19')](_0x4189('0x1a'),_0x36c579[_0x4189('0x7')]))[_0x4189('0x1b')](_0x4189('0x1c'),_0x36c579);}};module[_0x4189('0x1d')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 4c46ce0..d5eed30 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(_0x3b6fb8,_0x28c172){var _0x5c16e0=function(_0x67d693){while(--_0x67d693){_0x3b6fb8['push'](_0x3b6fb8['shift']());}};_0x5c16e0(++_0x28c172);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0xa9e0[_0x5037ab];return _0x512adb;};'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(_0x3d0471,_0xcbebc){var _0x3c181d=function(_0x24e2ad){while(--_0x24e2ad){_0x3d0471['push'](_0x3d0471['shift']());}};_0x3c181d(++_0xcbebc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xa9e0[_0x4cf98e];return _0x1623ac;};'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 2f070bd..f62870e 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 _0x1387=['Intervals','exports','name'];(function(_0x271fb2,_0x2a55e1){var _0x802dc8=function(_0x3ae7e8){while(--_0x3ae7e8){_0x271fb2['push'](_0x271fb2['shift']());}};_0x802dc8(++_0x2a55e1);}(_0x1387,0x65));var _0x7138=function(_0x1f6875,_0x6859db){_0x1f6875=_0x1f6875-0x0;var _0x5860b9=_0x1387[_0x1f6875];return _0x5860b9;};'use strict';function Interval(_0x2c3baf){this['id']=_0x2c3baf['id']||0x0;this[_0x7138('0x0')]=_0x2c3baf[_0x7138('0x0')]||'';this[_0x7138('0x1')]=_0x2c3baf[_0x7138('0x1')]||{};}module[_0x7138('0x2')]=Interval; \ No newline at end of file +var _0x6c06=['Intervals','exports','name'];(function(_0xd0a847,_0x72562b){var _0x2536ec=function(_0x20e4db){while(--_0x20e4db){_0xd0a847['push'](_0xd0a847['shift']());}};_0x2536ec(++_0x72562b);}(_0x6c06,0x13d));var _0x66c0=function(_0xa0b83c,_0x313d89){_0xa0b83c=_0xa0b83c-0x0;var _0xb7dac8=_0x6c06[_0xa0b83c];return _0xb7dac8;};'use strict';function Interval(_0x1dea57){this['id']=_0x1dea57['id']||0x0;this[_0x66c0('0x0')]=_0x1dea57['name']||'';this[_0x66c0('0x1')]=_0x1dea57[_0x66c0('0x1')]||{};}module[_0x66c0('0x2')]=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index 8e0043e..1c6448d 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 _0x49c1=['lodash','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','md5','updateRouting','prototype','map','_rr','updateRealtime','loggedIn','paused','length','online','mailPause','available','waiting','stringify','format','emit'];(function(_0x292b04,_0x4526f9){var _0x392195=function(_0x498e8e){while(--_0x498e8e){_0x292b04['push'](_0x292b04['shift']());}};_0x392195(++_0x4526f9);}(_0x49c1,0x16c));var _0x149c=function(_0x35187d,_0x1bcc56){_0x35187d=_0x35187d-0x0;var _0x2b4ceb=_0x49c1[_0x35187d];return _0x2b4ceb;};'use strict';var _=require(_0x149c('0x0'));var md5=require('md5');var util=require('util');var Redis=require(_0x149c('0x1'));var config=require(_0x149c('0x2'));config[_0x149c('0x3')]=_['defaults'](config[_0x149c('0x3')],{'host':_0x149c('0x4'),'port':0x18eb});var io=require(_0x149c('0x5'))(new Redis(config[_0x149c('0x3')]));function MailQueue(_0x35cd29){this['id']=_0x35cd29['id']||0x0;this[_0x149c('0x6')]=_0x35cd29[_0x149c('0x6')]||'';this['timeout']=_0x35cd29[_0x149c('0x7')]||0xa;this['strategy']=_0x35cd29[_0x149c('0x8')]||_0x149c('0x9');this['Agents']=_0x35cd29[_0x149c('0xa')];this[_0x149c('0xb')]={};this['waiting']=0x0;this[_0x149c('0xc')]='';this[_0x149c('0xd')]();this['updateRealtime']();}MailQueue[_0x149c('0xe')]['updateRouting']=function(){var _0x4ffc70=this[_0x149c('0xb')]['_rr'];this[_0x149c('0xb')]=_[_0x149c('0xf')](this[_0x149c('0xa')],'id');this['mapAgentsId'][_0x149c('0x10')]=_0x4ffc70;};MailQueue[_0x149c('0xe')][_0x149c('0x11')]=function(){this[_0x149c('0x12')]=0x0;this[_0x149c('0x13')]=0x0;for(var _0x5359fb=0x0;_0x5359fb=0x0?this[_0x149c('0x17')]:0x0;var _0xa2f9e4={'id':this['id'],'available':this[_0x149c('0x17')],'loggedIn':this[_0x149c('0x12')],'name':this[_0x149c('0x6')],'paused':this[_0x149c('0x13')],'waiting':this[_0x149c('0x18')]};var _0x59526a=md5(JSON[_0x149c('0x19')](_0xa2f9e4));if(this[_0x149c('0xc')]!==_0x59526a){this['md5']=_0x59526a;io['to'](util[_0x149c('0x1a')]('mail:queue:%s',_0xa2f9e4[_0x149c('0x6')]))[_0x149c('0x1b')]('mail_queue:save',_0xa2f9e4);}};module['exports']=MailQueue; \ No newline at end of file +var _0x3186=['available','mail_queue:save','md5','util','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','prototype','_rr','map','loggedIn','paused','length','online','mailPause'];(function(_0x8dd7b0,_0x414f93){var _0x9cce9a=function(_0x28ce34){while(--_0x28ce34){_0x8dd7b0['push'](_0x8dd7b0['shift']());}};_0x9cce9a(++_0x414f93);}(_0x3186,0x1ca));var _0x6318=function(_0x408112,_0x3a765d){_0x408112=_0x408112-0x0;var _0x1c375f=_0x3186[_0x408112];return _0x1c375f;};'use strict';var _=require('lodash');var md5=require(_0x6318('0x0'));var util=require(_0x6318('0x1'));var Redis=require('ioredis');var config=require(_0x6318('0x2'));config['redis']=_[_0x6318('0x3')](config[_0x6318('0x4')],{'host':_0x6318('0x5'),'port':0x18eb});var io=require(_0x6318('0x6'))(new Redis(config[_0x6318('0x4')]));function MailQueue(_0x46528d){this['id']=_0x46528d['id']||0x0;this['name']=_0x46528d[_0x6318('0x7')]||'';this[_0x6318('0x8')]=_0x46528d[_0x6318('0x8')]||0xa;this[_0x6318('0x9')]=_0x46528d['strategy']||'beepall';this[_0x6318('0xa')]=_0x46528d[_0x6318('0xa')];this[_0x6318('0xb')]={};this[_0x6318('0xc')]=0x0;this['md5']='';this[_0x6318('0xd')]();this['updateRealtime']();}MailQueue[_0x6318('0xe')][_0x6318('0xd')]=function(){var _0x1b98d5=this[_0x6318('0xb')][_0x6318('0xf')];this[_0x6318('0xb')]=_[_0x6318('0x10')](this['Agents'],'id');this['mapAgentsId'][_0x6318('0xf')]=_0x1b98d5;};MailQueue[_0x6318('0xe')]['updateRealtime']=function(){this[_0x6318('0x11')]=0x0;this[_0x6318('0x12')]=0x0;for(var _0x21024b=0x0;_0x21024b=0x0?this[_0x6318('0x16')]:0x0;var _0x5a65b5={'id':this['id'],'available':this[_0x6318('0x16')],'loggedIn':this[_0x6318('0x11')],'name':this[_0x6318('0x7')],'paused':this[_0x6318('0x12')],'waiting':this[_0x6318('0xc')]};var _0x1358de=md5(JSON['stringify'](_0x5a65b5));if(this[_0x6318('0x0')]!==_0x1358de){this[_0x6318('0x0')]=_0x1358de;io['to'](util['format']('mail:queue:%s',_0x5a65b5[_0x6318('0x7')]))['emit'](_0x6318('0x17'),_0x5a65b5);}};module['exports']=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index 9c68086..ff95499 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 _0x6b06=['name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','prototype','updateRealtime','loggedIn','paused','length','online','openchannelPause','available','stringify','openchannel:queue:%s','emit','openchannel_queue:save','exports','md5','ioredis','redis','localhost','socket.io-emitter'];(function(_0x2dbbe5,_0xb7c79b){var _0x3af882=function(_0x190eb6){while(--_0x190eb6){_0x2dbbe5['push'](_0x2dbbe5['shift']());}};_0x3af882(++_0xb7c79b);}(_0x6b06,0x14d));var _0x66b0=function(_0x15ee34,_0x1633db){_0x15ee34=_0x15ee34-0x0;var _0x277a9d=_0x6b06[_0x15ee34];return _0x277a9d;};'use strict';var _=require('lodash');var md5=require(_0x66b0('0x0'));var util=require('util');var Redis=require(_0x66b0('0x1'));var config=require('../../../config/environment');config[_0x66b0('0x2')]=_['defaults'](config[_0x66b0('0x2')],{'host':_0x66b0('0x3'),'port':0x18eb});var io=require(_0x66b0('0x4'))(new Redis(config[_0x66b0('0x2')]));function OpenchannelQueue(_0x326c32){this['id']=_0x326c32['id']||0x0;this[_0x66b0('0x5')]=_0x326c32['name']||'';this[_0x66b0('0x6')]=_0x326c32['timeout']||0xa;this[_0x66b0('0x7')]=_0x326c32[_0x66b0('0x7')]||_0x66b0('0x8');this['Agents']=_0x326c32[_0x66b0('0x9')];this[_0x66b0('0xa')]={};this[_0x66b0('0xb')]=0x0;this[_0x66b0('0x0')]='';this[_0x66b0('0xc')]();this['updateRealtime']();}OpenchannelQueue[_0x66b0('0xd')][_0x66b0('0xc')]=function(){var _0x3a40d7=this['mapAgentsId']['_rr'];this[_0x66b0('0xa')]=_['map'](this['Agents'],'id');this['mapAgentsId']['_rr']=_0x3a40d7;};OpenchannelQueue[_0x66b0('0xd')][_0x66b0('0xe')]=function(){this[_0x66b0('0xf')]=0x0;this[_0x66b0('0x10')]=0x0;for(var _0x3e5bc1=0x0;_0x3e5bc1=0x0?this[_0x66b0('0x14')]:0x0;var _0x78afcd={'id':this['id'],'available':this[_0x66b0('0x14')],'loggedIn':this[_0x66b0('0xf')],'name':this[_0x66b0('0x5')],'paused':this[_0x66b0('0x10')],'waiting':this[_0x66b0('0xb')]};var _0x1bc4ae=md5(JSON[_0x66b0('0x15')](_0x78afcd));if(this[_0x66b0('0x0')]!==_0x1bc4ae){this[_0x66b0('0x0')]=_0x1bc4ae;io['to'](util['format'](_0x66b0('0x16'),_0x78afcd[_0x66b0('0x5')]))[_0x66b0('0x17')](_0x66b0('0x18'),_0x78afcd);}};module[_0x66b0('0x19')]=OpenchannelQueue; \ No newline at end of file +var _0xa3d0=['map','loggedIn','paused','length','online','available','stringify','format','emit','openchannel_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','prototype','_rr','mapAgentsId'];(function(_0x2ee4f5,_0x5b790e){var _0x276d6b=function(_0x1516c8){while(--_0x1516c8){_0x2ee4f5['push'](_0x2ee4f5['shift']());}};_0x276d6b(++_0x5b790e);}(_0xa3d0,0x107));var _0x0a3d=function(_0x12f66b,_0x14e808){_0x12f66b=_0x12f66b-0x0;var _0x1e7cf6=_0xa3d0[_0x12f66b];return _0x1e7cf6;};'use strict';var _=require(_0x0a3d('0x0'));var md5=require(_0x0a3d('0x1'));var util=require(_0x0a3d('0x2'));var Redis=require(_0x0a3d('0x3'));var config=require(_0x0a3d('0x4'));config['redis']=_[_0x0a3d('0x5')](config['redis'],{'host':_0x0a3d('0x6'),'port':0x18eb});var io=require(_0x0a3d('0x7'))(new Redis(config['redis']));function OpenchannelQueue(_0x3938ed){this['id']=_0x3938ed['id']||0x0;this[_0x0a3d('0x8')]=_0x3938ed['name']||'';this[_0x0a3d('0x9')]=_0x3938ed[_0x0a3d('0x9')]||0xa;this['strategy']=_0x3938ed[_0x0a3d('0xa')]||_0x0a3d('0xb');this[_0x0a3d('0xc')]=_0x3938ed[_0x0a3d('0xc')];this['mapAgentsId']={};this[_0x0a3d('0xd')]=0x0;this['md5']='';this['updateRouting']();this['updateRealtime']();}OpenchannelQueue[_0x0a3d('0xe')]['updateRouting']=function(){var _0xd74d3=this['mapAgentsId'][_0x0a3d('0xf')];this[_0x0a3d('0x10')]=_[_0x0a3d('0x11')](this[_0x0a3d('0xc')],'id');this[_0x0a3d('0x10')]['_rr']=_0xd74d3;};OpenchannelQueue[_0x0a3d('0xe')]['updateRealtime']=function(){this[_0x0a3d('0x12')]=0x0;this[_0x0a3d('0x13')]=0x0;for(var _0xab621b=0x0;_0xab621b=0x0?this['available']:0x0;var _0x125180={'id':this['id'],'available':this[_0x0a3d('0x16')],'loggedIn':this[_0x0a3d('0x12')],'name':this[_0x0a3d('0x8')],'paused':this[_0x0a3d('0x13')],'waiting':this[_0x0a3d('0xd')]};var _0x2f4f2c=md5(JSON[_0x0a3d('0x17')](_0x125180));if(this[_0x0a3d('0x1')]!==_0x2f4f2c){this[_0x0a3d('0x1')]=_0x2f4f2c;io['to'](util[_0x0a3d('0x18')]('openchannel:queue:%s',_0x125180[_0x0a3d('0x8')]))[_0x0a3d('0x19')](_0x0a3d('0x1a'),_0x125180);}};module[_0x0a3d('0x1b')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index 4145591..3660ced 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 _0xd8b0=['Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','smsPause','available','stringify','format','sms:queue:%s','exports','lodash','md5','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy'];(function(_0x1042d8,_0x44f71c){var _0x3da9f3=function(_0x553b1d){while(--_0x553b1d){_0x1042d8['push'](_0x1042d8['shift']());}};_0x3da9f3(++_0x44f71c);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var md5=require(_0x0d8b('0x1'));var util=require('util');var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x0d8b('0x2')]=_[_0x0d8b('0x3')](config[_0x0d8b('0x2')],{'host':_0x0d8b('0x4'),'port':0x18eb});var io=require(_0x0d8b('0x5'))(new Redis(config['redis']));function SmsQueue(_0x5e15e6){this['id']=_0x5e15e6['id']||0x0;this[_0x0d8b('0x6')]=_0x5e15e6[_0x0d8b('0x6')]||'';this[_0x0d8b('0x7')]=_0x5e15e6['timeout']||0xa;this[_0x0d8b('0x8')]=_0x5e15e6[_0x0d8b('0x8')]||'beepall';this[_0x0d8b('0x9')]=_0x5e15e6[_0x0d8b('0x9')];this[_0x0d8b('0xa')]={};this[_0x0d8b('0xb')]=0x0;this[_0x0d8b('0x1')]='';this[_0x0d8b('0xc')]();this[_0x0d8b('0xd')]();}SmsQueue[_0x0d8b('0xe')]['updateRouting']=function(){var _0x3c4bfa=this['mapAgentsId'][_0x0d8b('0xf')];this[_0x0d8b('0xa')]=_[_0x0d8b('0x10')](this[_0x0d8b('0x9')],'id');this[_0x0d8b('0xa')][_0x0d8b('0xf')]=_0x3c4bfa;};SmsQueue[_0x0d8b('0xe')][_0x0d8b('0xd')]=function(){this[_0x0d8b('0x11')]=0x0;this[_0x0d8b('0x12')]=0x0;for(var _0x5ad086=0x0;_0x5ad086=0x0?this[_0x0d8b('0x15')]:0x0;var _0x333674={'id':this['id'],'available':this[_0x0d8b('0x15')],'loggedIn':this[_0x0d8b('0x11')],'name':this[_0x0d8b('0x6')],'paused':this['paused'],'waiting':this[_0x0d8b('0xb')]};var _0x23d58f=md5(JSON[_0x0d8b('0x16')](_0x333674));if(this[_0x0d8b('0x1')]!==_0x23d58f){this[_0x0d8b('0x1')]=_0x23d58f;io['to'](util[_0x0d8b('0x17')](_0x0d8b('0x18'),_0x333674[_0x0d8b('0x6')]))['emit']('sms_queue:save',_0x333674);}};module[_0x0d8b('0x19')]=SmsQueue; \ No newline at end of file +var _0xb7e7=['util','../../../config/environment','defaults','localhost','socket.io-emitter','redis','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRealtime','prototype','updateRouting','_rr','map','loggedIn','length','online','paused','available','stringify','sms:queue:%s','emit','exports','lodash'];(function(_0x4fefc5,_0x48f520){var _0x4cdef8=function(_0x5c4a6a){while(--_0x5c4a6a){_0x4fefc5['push'](_0x4fefc5['shift']());}};_0x4cdef8(++_0x48f520);}(_0xb7e7,0x121));var _0x7b7e=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xb7e7[_0x34bf97];return _0x292719;};'use strict';var _=require(_0x7b7e('0x0'));var md5=require('md5');var util=require(_0x7b7e('0x1'));var Redis=require('ioredis');var config=require(_0x7b7e('0x2'));config['redis']=_[_0x7b7e('0x3')](config['redis'],{'host':_0x7b7e('0x4'),'port':0x18eb});var io=require(_0x7b7e('0x5'))(new Redis(config[_0x7b7e('0x6')]));function SmsQueue(_0x52047f){this['id']=_0x52047f['id']||0x0;this['name']=_0x52047f[_0x7b7e('0x7')]||'';this[_0x7b7e('0x8')]=_0x52047f[_0x7b7e('0x8')]||0xa;this['strategy']=_0x52047f[_0x7b7e('0x9')]||_0x7b7e('0xa');this[_0x7b7e('0xb')]=_0x52047f[_0x7b7e('0xb')];this[_0x7b7e('0xc')]={};this[_0x7b7e('0xd')]=0x0;this[_0x7b7e('0xe')]='';this['updateRouting']();this[_0x7b7e('0xf')]();}SmsQueue[_0x7b7e('0x10')][_0x7b7e('0x11')]=function(){var _0x29b622=this[_0x7b7e('0xc')][_0x7b7e('0x12')];this[_0x7b7e('0xc')]=_[_0x7b7e('0x13')](this[_0x7b7e('0xb')],'id');this['mapAgentsId'][_0x7b7e('0x12')]=_0x29b622;};SmsQueue[_0x7b7e('0x10')]['updateRealtime']=function(){this[_0x7b7e('0x14')]=0x0;this['paused']=0x0;for(var _0x4c6011=0x0;_0x4c6011=0x0?this[_0x7b7e('0x18')]:0x0;var _0x200ef7={'id':this['id'],'available':this[_0x7b7e('0x18')],'loggedIn':this[_0x7b7e('0x14')],'name':this[_0x7b7e('0x7')],'paused':this[_0x7b7e('0x17')],'waiting':this[_0x7b7e('0xd')]};var _0x3bec7d=md5(JSON[_0x7b7e('0x19')](_0x200ef7));if(this[_0x7b7e('0xe')]!==_0x3bec7d){this[_0x7b7e('0xe')]=_0x3bec7d;io['to'](util['format'](_0x7b7e('0x1a'),_0x200ef7[_0x7b7e('0x7')]))[_0x7b7e('0x1b')]('sms_queue:save',_0x200ef7);}};module[_0x7b7e('0x1c')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 90f0886..23d9dc0 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 _0x8e20=['Agents','mapAgentsId','prototype','updateRouting','map','_rr','updateRealtime','paused','online','loggedIn','available','waiting','stringify','whatsapp:queue:%s','whatsapp_queue:save','lodash','md5','util','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall'];(function(_0x13fa3a,_0x3783f7){var _0x4ae7c5=function(_0x379a88){while(--_0x379a88){_0x13fa3a['push'](_0x13fa3a['shift']());}};_0x4ae7c5(++_0x3783f7);}(_0x8e20,0x1af));var _0x08e2=function(_0x585d09,_0x1274bc){_0x585d09=_0x585d09-0x0;var _0x7d9a14=_0x8e20[_0x585d09];return _0x7d9a14;};'use strict';var _=require(_0x08e2('0x0'));var md5=require(_0x08e2('0x1'));var util=require(_0x08e2('0x2'));var Redis=require('ioredis');var config=require(_0x08e2('0x3'));config[_0x08e2('0x4')]=_['defaults'](config[_0x08e2('0x4')],{'host':_0x08e2('0x5'),'port':0x18eb});var io=require(_0x08e2('0x6'))(new Redis(config[_0x08e2('0x4')]));function WhatsappQueue(_0x32f1ba){this['id']=_0x32f1ba['id']||0x0;this['name']=_0x32f1ba[_0x08e2('0x7')]||'';this[_0x08e2('0x8')]=_0x32f1ba['timeout']||0xa;this[_0x08e2('0x9')]=_0x32f1ba[_0x08e2('0x9')]||_0x08e2('0xa');this[_0x08e2('0xb')]=_0x32f1ba[_0x08e2('0xb')];this[_0x08e2('0xc')]={};this['waiting']=0x0;this[_0x08e2('0x1')]='';this['updateRouting']();this['updateRealtime']();}WhatsappQueue[_0x08e2('0xd')][_0x08e2('0xe')]=function(){var _0x3ab530=this[_0x08e2('0xc')]['_rr'];this['mapAgentsId']=_[_0x08e2('0xf')](this['Agents'],'id');this['mapAgentsId'][_0x08e2('0x10')]=_0x3ab530;};WhatsappQueue['prototype'][_0x08e2('0x11')]=function(){this['loggedIn']=0x0;this[_0x08e2('0x12')]=0x0;for(var _0x4cffce=0x0;_0x4cffce=0x0?this[_0x08e2('0x15')]:0x0;var _0x90db85={'id':this['id'],'available':this[_0x08e2('0x15')],'loggedIn':this[_0x08e2('0x14')],'name':this[_0x08e2('0x7')],'paused':this[_0x08e2('0x12')],'waiting':this[_0x08e2('0x16')]};var _0x3ebd09=md5(JSON[_0x08e2('0x17')](_0x90db85));if(this['md5']!==_0x3ebd09){this['md5']=_0x3ebd09;io['to'](util['format'](_0x08e2('0x18'),_0x90db85[_0x08e2('0x7')]))['emit'](_0x08e2('0x19'),_0x90db85);}};module['exports']=WhatsappQueue; \ No newline at end of file +var _0x2925=['format','emit','whatsapp_queue:save','exports','lodash','md5','util','ioredis','redis','defaults','localhost','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','loggedIn','paused','length','online','whatsappPause','available','stringify'];(function(_0x496df9,_0x14d47c){var _0x5de1dc=function(_0x5a626b){while(--_0x5a626b){_0x496df9['push'](_0x496df9['shift']());}};_0x5de1dc(++_0x14d47c);}(_0x2925,0x1cf));var _0x5292=function(_0x240926,_0x1aab68){_0x240926=_0x240926-0x0;var _0x4e6120=_0x2925[_0x240926];return _0x4e6120;};'use strict';var _=require(_0x5292('0x0'));var md5=require(_0x5292('0x1'));var util=require(_0x5292('0x2'));var Redis=require(_0x5292('0x3'));var config=require('../../../config/environment');config[_0x5292('0x4')]=_[_0x5292('0x5')](config['redis'],{'host':_0x5292('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x5292('0x4')]));function WhatsappQueue(_0x578bfe){this['id']=_0x578bfe['id']||0x0;this[_0x5292('0x7')]=_0x578bfe['name']||'';this[_0x5292('0x8')]=_0x578bfe[_0x5292('0x8')]||0xa;this[_0x5292('0x9')]=_0x578bfe['strategy']||'beepall';this[_0x5292('0xa')]=_0x578bfe[_0x5292('0xa')];this[_0x5292('0xb')]={};this[_0x5292('0xc')]=0x0;this[_0x5292('0x1')]='';this[_0x5292('0xd')]();this[_0x5292('0xe')]();}WhatsappQueue[_0x5292('0xf')][_0x5292('0xd')]=function(){var _0x505107=this[_0x5292('0xb')]['_rr'];this[_0x5292('0xb')]=_['map'](this[_0x5292('0xa')],'id');this[_0x5292('0xb')]['_rr']=_0x505107;};WhatsappQueue[_0x5292('0xf')][_0x5292('0xe')]=function(){this[_0x5292('0x10')]=0x0;this[_0x5292('0x11')]=0x0;for(var _0x23a561=0x0;_0x23a561=0x0?this['available']:0x0;var _0x5145c2={'id':this['id'],'available':this[_0x5292('0x15')],'loggedIn':this[_0x5292('0x10')],'name':this['name'],'paused':this[_0x5292('0x11')],'waiting':this['waiting']};var _0x4ea82d=md5(JSON[_0x5292('0x16')](_0x5145c2));if(this[_0x5292('0x1')]!==_0x4ea82d){this['md5']=_0x4ea82d;io['to'](util[_0x5292('0x17')]('whatsapp:queue:%s',_0x5145c2[_0x5292('0x7')]))[_0x5292('0x18')](_0x5292('0x19'),_0x5145c2);}};module[_0x5292('0x1a')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 3254753..e77190b 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(_0x528748,_0x1a259d){var _0x571df2=function(_0x5ca768){while(--_0x5ca768){_0x528748['push'](_0x528748['shift']());}};_0x571df2(++_0x1a259d);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x11aee5,_0x27fa94){_0x11aee5=_0x11aee5-0x0;var _0x2e8c9d=_0x7fbe[_0x11aee5];return _0x2e8c9d;};'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(_0x158217,_0x1930e1){var _0x262c7e=function(_0x43150c){while(--_0x43150c){_0x158217['push'](_0x158217['shift']());}};_0x262c7e(++_0x1930e1);}(_0x34e8,0x12c));var _0x834e=function(_0x18bf7d,_0x3f93c2){_0x18bf7d=_0x18bf7d-0x0;var _0x4ec283=_0x34e8[_0x18bf7d];return _0x4ec283;};'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 29aa256..9d08af8 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 _0xc10e=['AddTagsToChatInteraction','addTagsToChatInteraction','../client','update','Request'];(function(_0x466d81,_0x5afd36){var _0x35cff4=function(_0x4c208c){while(--_0x4c208c){_0x466d81['push'](_0x466d81['shift']());}};_0x35cff4(++_0x5afd36);}(_0xc10e,0x133));var _0xec10=function(_0xcd32e1,_0x20fbed){_0xcd32e1=_0xcd32e1-0x0;var _0x5821d8=_0xc10e[_0xcd32e1];return _0x5821d8;};'use strict';var client=require(_0xec10('0x0'));exports[_0xec10('0x1')]=function(_0x3123d1,_0x430509){return client[_0xec10('0x2')]('UpdateChatInteraction',{'body':_0x430509,'options':{'where':{'id':_0x3123d1}},'log':'updateChatInteraction'});};exports['addTags']=function(_0x52d261,_0x254d72){return client[_0xec10('0x2')](_0xec10('0x3'),{'body':_0x254d72,'options':{'where':{'id':_0x52d261}},'log':_0xec10('0x4')});}; \ No newline at end of file +var _0x13d8=['update','Request','UpdateChatInteraction','updateChatInteraction','AddTagsToChatInteraction','addTagsToChatInteraction'];(function(_0x57c5e0,_0x3309ee){var _0x197613=function(_0x320249){while(--_0x320249){_0x57c5e0['push'](_0x57c5e0['shift']());}};_0x197613(++_0x3309ee);}(_0x13d8,0x9c));var _0x813d=function(_0x430471,_0x25b312){_0x430471=_0x430471-0x0;var _0x344585=_0x13d8[_0x430471];return _0x344585;};'use strict';var client=require('../client');exports[_0x813d('0x0')]=function(_0x28efb2,_0x4dec8a){return client[_0x813d('0x1')](_0x813d('0x2'),{'body':_0x4dec8a,'options':{'where':{'id':_0x28efb2}},'log':_0x813d('0x3')});};exports['addTags']=function(_0x4f83c2,_0x3e723d){return client[_0x813d('0x1')](_0x813d('0x4'),{'body':_0x3e723d,'options':{'where':{'id':_0x4f83c2}},'log':_0x813d('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 7fd3478..45db67f 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 _0x0704=['../client','CreateChatMessage'];(function(_0x4756eb,_0x5d6d44){var _0xab57d7=function(_0x4b53a4){while(--_0x4b53a4){_0x4756eb['push'](_0x4756eb['shift']());}};_0xab57d7(++_0x5d6d44);}(_0x0704,0x7e));var _0x4070=function(_0x30d4cb,_0x200058){_0x30d4cb=_0x30d4cb-0x0;var _0x2759f1=_0x0704[_0x30d4cb];return _0x2759f1;};'use strict';var client=require(_0x4070('0x0'));exports['create']=function(_0x3f5788){return client['Request'](_0x4070('0x1'),{'body':_0x3f5788,'log':'createChatMessage'});}; \ No newline at end of file +var _0xe02c=['../client','Request','CreateChatMessage','createChatMessage'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe02c,0x1a8));var _0xce02=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe02c[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xce02('0x0'));exports['create']=function(_0x4cea4e){return client[_0xce02('0x1')](_0xce02('0x2'),{'body':_0x4cea4e,'log':_0xce02('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index d3007d3..83b91ff 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 _0xdd7c=['Agents','online','chatPause','getChatQueues','name','timeout','strategy','User'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0xdd7c,0xfb));var _0xcdd7=function(_0x4f2c3a,_0x6bde90){_0x4f2c3a=_0x4f2c3a-0x0;var _0x17d91c=_0xdd7c[_0x4f2c3a];return _0x17d91c;};'use strict';var client=require('../client');exports[_0xcdd7('0x0')]=function(){return function(){return client['Request']('GetChatQueue',{'options':{'raw':![],'attributes':['id',_0xcdd7('0x1'),_0xcdd7('0x2'),_0xcdd7('0x3')],'include':[{'model':_0xcdd7('0x4'),'as':_0xcdd7('0x5'),'attributes':['id',_0xcdd7('0x1'),_0xcdd7('0x6'),_0xcdd7('0x7')]}]},'log':_0xcdd7('0x0')});};}; \ No newline at end of file +var _0xa2f4=['Agents','online','chatPause','../client','Request','name','User'];(function(_0x559bee,_0x17547a){var _0x628f46=function(_0xb37cc1){while(--_0xb37cc1){_0x559bee['push'](_0x559bee['shift']());}};_0x628f46(++_0x17547a);}(_0xa2f4,0x10d));var _0x4a2f=function(_0x1a63c8,_0x2596c9){_0x1a63c8=_0x1a63c8-0x0;var _0x26d5a3=_0xa2f4[_0x1a63c8];return _0x26d5a3;};'use strict';var client=require(_0x4a2f('0x0'));exports['getChatQueues']=function(){return function(){return client[_0x4a2f('0x1')]('GetChatQueue',{'options':{'raw':![],'attributes':['id',_0x4a2f('0x2'),'timeout','strategy'],'include':[{'model':_0x4a2f('0x3'),'as':_0x4a2f('0x4'),'attributes':['id',_0x4a2f('0x2'),_0x4a2f('0x5'),_0x4a2f('0x6')]}]},'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 8451e98..d866f24 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 _0x867f=['create','Request','CreateChatQueueReport','update','DESC','UpdateChatQueueReport','../client'];(function(_0x1e3a0a,_0x49cd48){var _0x284267=function(_0x279223){while(--_0x279223){_0x1e3a0a['push'](_0x1e3a0a['shift']());}};_0x284267(++_0x49cd48);}(_0x867f,0xe6));var _0xf867=function(_0x2f163c,_0x27bd79){_0x2f163c=_0x2f163c-0x0;var _0x3dd996=_0x867f[_0x2f163c];return _0x3dd996;};'use strict';var client=require(_0xf867('0x0'));exports[_0xf867('0x1')]=function(_0x419241){return client[_0xf867('0x2')](_0xf867('0x3'),{'body':_0x419241,'log':_0xf867('0x3')});};exports[_0xf867('0x4')]=function(_0x394856,_0x333d91){return client['Request']('UpdateChatQueueReport',{'body':_0x333d91,'options':{'where':{'uniqueid':_0x394856},'order':[['id',_0xf867('0x5')]],'limit':0x1},'log':_0xf867('0x6')});}; \ No newline at end of file +var _0x295f=['create','Request','CreateChatQueueReport','update','UpdateChatQueueReport','DESC'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x295f,0x168));var _0xf295=function(_0x372683,_0x3da8ee){_0x372683=_0x372683-0x0;var _0x4dad22=_0x295f[_0x372683];return _0x4dad22;};'use strict';var client=require('../client');exports[_0xf295('0x0')]=function(_0x2a126a){return client[_0xf295('0x1')]('CreateChatQueueReport',{'body':_0x2a126a,'log':_0xf295('0x2')});};exports[_0xf295('0x3')]=function(_0x59a1c5,_0x511ab5){return client[_0xf295('0x1')](_0xf295('0x4'),{'body':_0x511ab5,'options':{'where':{'uniqueid':_0x59a1c5},'order':[['id',_0xf295('0x5')]],'limit':0x1},'log':_0xf295('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 0f1babc..7395efd 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 _0x50db=['UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','Request'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x50db,0x154));var _0xb50d=function(_0x498796,_0x2a9b20){_0x498796=_0x498796-0x0;var _0x4e168a=_0x50db[_0x498796];return _0x4e168a;};'use strict';var client=require(_0xb50d('0x0'));exports['update']=function(_0x1c4976,_0x4e9a65){return client[_0xb50d('0x1')](_0xb50d('0x2'),{'body':_0x4e9a65,'options':{'where':{'id':_0x1c4976}},'log':'updateFaxInteraction'});};exports[_0xb50d('0x3')]=function(_0x17944f,_0x38b0d6){return client['Request'](_0xb50d('0x4'),{'body':_0x38b0d6,'options':{'where':{'id':_0x17944f}},'log':_0xb50d('0x5')});}; \ No newline at end of file +var _0x0ee6=['updateFaxInteraction','addTags','AddTagsToFaxInteraction','update','Request','UpdateFaxInteraction'];(function(_0x2b2b22,_0x2829c1){var _0x4e668d=function(_0x25f4f5){while(--_0x25f4f5){_0x2b2b22['push'](_0x2b2b22['shift']());}};_0x4e668d(++_0x2829c1);}(_0x0ee6,0xb1));var _0x60ee=function(_0xab1cb,_0x2b77a4){_0xab1cb=_0xab1cb-0x0;var _0x147a39=_0x0ee6[_0xab1cb];return _0x147a39;};'use strict';var client=require('../client');exports[_0x60ee('0x0')]=function(_0x3d09e5,_0x38c26e){return client[_0x60ee('0x1')](_0x60ee('0x2'),{'body':_0x38c26e,'options':{'where':{'id':_0x3d09e5}},'log':_0x60ee('0x3')});};exports[_0x60ee('0x4')]=function(_0x2867d9,_0x30525a){return client[_0x60ee('0x1')](_0x60ee('0x5'),{'body':_0x30525a,'options':{'where':{'id':_0x2867d9}},'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 f6acaeb..fb81e9f 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 _0x5088=['../client','create','CreateFaxMessage','createFaxMessage'];(function(_0x2e8721,_0x4f2eaa){var _0x4b092c=function(_0x10d12c){while(--_0x10d12c){_0x2e8721['push'](_0x2e8721['shift']());}};_0x4b092c(++_0x4f2eaa);}(_0x5088,0x14c));var _0x8508=function(_0x57e00e,_0x36e79a){_0x57e00e=_0x57e00e-0x0;var _0x415e60=_0x5088[_0x57e00e];return _0x415e60;};'use strict';var client=require(_0x8508('0x0'));exports[_0x8508('0x1')]=function(_0x395e00){return client['Request'](_0x8508('0x2'),{'body':_0x395e00,'log':_0x8508('0x3')});}; \ No newline at end of file +var _0xe2f6=['create','createFaxMessage','../client'];(function(_0x51bdcd,_0x24b0e0){var _0x10c67c=function(_0xc2a2a2){while(--_0xc2a2a2){_0x51bdcd['push'](_0x51bdcd['shift']());}};_0x10c67c(++_0x24b0e0);}(_0xe2f6,0x155));var _0x6e2f=function(_0x4e1da5,_0x6589b){_0x4e1da5=_0x4e1da5-0x0;var _0x4272e7=_0xe2f6[_0x4e1da5];return _0x4272e7;};'use strict';var client=require(_0x6e2f('0x0'));exports[_0x6e2f('0x1')]=function(_0x1caf8d){return client['Request']('CreateFaxMessage',{'body':_0x1caf8d,'log':_0x6e2f('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index d0ce5b6..2b5a7e0 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 _0x4387=['name','timeout','strategy','User','Agents','getFaxQueues','Request'];(function(_0x249f6e,_0xf58756){var _0xaa9e42=function(_0x57c159){while(--_0x57c159){_0x249f6e['push'](_0x249f6e['shift']());}};_0xaa9e42(++_0xf58756);}(_0x4387,0x6e));var _0x7438=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4387[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports[_0x7438('0x0')]=function(){return function(){return client[_0x7438('0x1')]('GetFaxQueue',{'options':{'raw':![],'attributes':['id',_0x7438('0x2'),_0x7438('0x3'),_0x7438('0x4')],'include':[{'model':_0x7438('0x5'),'as':_0x7438('0x6'),'attributes':['id',_0x7438('0x2'),'online','faxPause']}]},'log':_0x7438('0x0')});};}; \ No newline at end of file +var _0x2eff=['name','online','faxPause','../client','getFaxQueues','Request','timeout','strategy','User','Agents'];(function(_0x396841,_0x258e1e){var _0x1ae4fe=function(_0x4d81ca){while(--_0x4d81ca){_0x396841['push'](_0x396841['shift']());}};_0x1ae4fe(++_0x258e1e);}(_0x2eff,0x14d));var _0xf2ef=function(_0x295bc0,_0x1903af){_0x295bc0=_0x295bc0-0x0;var _0x300115=_0x2eff[_0x295bc0];return _0x300115;};'use strict';var client=require(_0xf2ef('0x0'));exports[_0xf2ef('0x1')]=function(){return function(){return client[_0xf2ef('0x2')]('GetFaxQueue',{'options':{'raw':![],'attributes':['id','name',_0xf2ef('0x3'),_0xf2ef('0x4')],'include':[{'model':_0xf2ef('0x5'),'as':_0xf2ef('0x6'),'attributes':['id',_0xf2ef('0x7'),_0xf2ef('0x8'),_0xf2ef('0x9')]}]},'log':_0xf2ef('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index fae8c6b..7144973 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 _0x88ac=['UpdateFaxQueueReport','../client','Request','CreateFaxQueueReport','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x88ac,0x12d));var _0xc88a=function(_0x21efd3,_0x445165){_0x21efd3=_0x21efd3-0x0;var _0x3898f5=_0x88ac[_0x21efd3];return _0x3898f5;};'use strict';var client=require(_0xc88a('0x0'));exports['create']=function(_0x4bb45c){return client[_0xc88a('0x1')]('CreateFaxQueueReport',{'body':_0x4bb45c,'log':_0xc88a('0x2')});};exports[_0xc88a('0x3')]=function(_0x3c1a94,_0x5e751c){return client['Request'](_0xc88a('0x4'),{'body':_0x5e751c,'options':{'where':{'uniqueid':_0x3c1a94},'order':[['id','DESC']],'limit':0x1},'log':_0xc88a('0x4')});}; \ No newline at end of file +var _0x043a=['Request','CreateFaxQueueReport','update','UpdateFaxQueueReport','../client','create'];(function(_0x456233,_0x408a58){var _0x4a51f0=function(_0x2c297a){while(--_0x2c297a){_0x456233['push'](_0x456233['shift']());}};_0x4a51f0(++_0x408a58);}(_0x043a,0x1e4));var _0xa043=function(_0x242f82,_0x33f0f6){_0x242f82=_0x242f82-0x0;var _0x2666b9=_0x043a[_0x242f82];return _0x2666b9;};'use strict';var client=require(_0xa043('0x0'));exports[_0xa043('0x1')]=function(_0x25aaa8){return client[_0xa043('0x2')]('CreateFaxQueueReport',{'body':_0x25aaa8,'log':_0xa043('0x3')});};exports[_0xa043('0x4')]=function(_0x101840,_0x472e2b){return client['Request'](_0xa043('0x5'),{'body':_0x472e2b,'options':{'where':{'uniqueid':_0x101840},'order':[['id','DESC']],'limit':0x1},'log':_0xa043('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index c362a84..8a03891 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 _0x7462=['interval','../client','getIntervals','name'];(function(_0x558cf7,_0xaac786){var _0x2c1d0d=function(_0x53b30d){while(--_0x53b30d){_0x558cf7['push'](_0x558cf7['shift']());}};_0x2c1d0d(++_0xaac786);}(_0x7462,0x165));var _0x2746=function(_0x39e164,_0x2cb93b){_0x39e164=_0x39e164-0x0;var _0x13fa6b=_0x7462[_0x39e164];return _0x13fa6b;};'use strict';var client=require(_0x2746('0x0'));exports[_0x2746('0x1')]=function(){return function(){return client['Request']('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x2746('0x2')],'include':[{'model':'Interval','as':'Intervals','attributes':['id',_0x2746('0x2'),_0x2746('0x3')]}]},'log':'getIntervals'});};}; \ No newline at end of file +var _0x7d98=['name','Interval','interval','../client','Request','GetInterval'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7d98,0xe7));var _0x87d9=function(_0x2df724,_0x411382){_0x2df724=_0x2df724-0x0;var _0x1b2504=_0x7d98[_0x2df724];return _0x1b2504;};'use strict';var client=require(_0x87d9('0x0'));exports['getIntervals']=function(){return function(){return client[_0x87d9('0x1')](_0x87d9('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x87d9('0x3')],'include':[{'model':_0x87d9('0x4'),'as':'Intervals','attributes':['id',_0x87d9('0x3'),_0x87d9('0x5')]}]},'log':'getIntervals'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 410ec60..02f7903 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 _0xceae=['AddTagsToMailInteraction','addTagsToChatInteraction','../client','update','Request','UpdateMailInteraction','updateMailInteraction','addTags'];(function(_0x4dd269,_0x4b8f0c){var _0x27473b=function(_0x1723e5){while(--_0x1723e5){_0x4dd269['push'](_0x4dd269['shift']());}};_0x27473b(++_0x4b8f0c);}(_0xceae,0xe2));var _0xecea=function(_0x31c6b6,_0xdd33b7){_0x31c6b6=_0x31c6b6-0x0;var _0x32b27b=_0xceae[_0x31c6b6];return _0x32b27b;};'use strict';var client=require(_0xecea('0x0'));exports[_0xecea('0x1')]=function(_0x412b49,_0x4d914d){return client[_0xecea('0x2')](_0xecea('0x3'),{'body':_0x4d914d,'options':{'where':{'id':_0x412b49}},'log':_0xecea('0x4')});};exports[_0xecea('0x5')]=function(_0x722a67,_0x46a24a){return client[_0xecea('0x2')](_0xecea('0x6'),{'body':_0x46a24a,'options':{'where':{'id':_0x722a67}},'log':_0xecea('0x7')});}; \ No newline at end of file +var _0x0e18=['../client','update','Request','UpdateMailInteraction','updateMailInteraction','addTags'];(function(_0x140a46,_0x5d93ae){var _0x2fa1c2=function(_0x2785ed){while(--_0x2785ed){_0x140a46['push'](_0x140a46['shift']());}};_0x2fa1c2(++_0x5d93ae);}(_0x0e18,0x1c2));var _0x80e1=function(_0xd05fe6,_0x519679){_0xd05fe6=_0xd05fe6-0x0;var _0x34c9ea=_0x0e18[_0xd05fe6];return _0x34c9ea;};'use strict';var client=require(_0x80e1('0x0'));exports[_0x80e1('0x1')]=function(_0x3c38b5,_0x31e62d){return client[_0x80e1('0x2')](_0x80e1('0x3'),{'body':_0x31e62d,'options':{'where':{'id':_0x3c38b5}},'log':_0x80e1('0x4')});};exports[_0x80e1('0x5')]=function(_0x5ed9e9,_0x3ed743){return client[_0x80e1('0x2')]('AddTagsToMailInteraction',{'body':_0x3ed743,'options':{'where':{'id':_0x5ed9e9}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index ca2e3cf..c64b566 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 _0x29b3=['../client','create','CreateMailMessage','createMailMessage'];(function(_0x20f25f,_0x3b5bee){var _0x3bcb18=function(_0x55a600){while(--_0x55a600){_0x20f25f['push'](_0x20f25f['shift']());}};_0x3bcb18(++_0x3b5bee);}(_0x29b3,0x1c8));var _0x329b=function(_0x406c93,_0x570ebf){_0x406c93=_0x406c93-0x0;var _0x3bb74f=_0x29b3[_0x406c93];return _0x3bb74f;};'use strict';var client=require(_0x329b('0x0'));exports[_0x329b('0x1')]=function(_0x1f4085){return client['Request'](_0x329b('0x2'),{'body':_0x1f4085,'log':_0x329b('0x3')});}; \ No newline at end of file +var _0xcb46=['createMailMessage','../client','create','Request'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xcb46,0xc5));var _0x6cb4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcb46[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x6cb4('0x0'));exports[_0x6cb4('0x1')]=function(_0x4bc3ea){return client[_0x6cb4('0x2')]('CreateMailMessage',{'body':_0x4bc3ea,'log':_0x6cb4('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index cffa44c..14ae817 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 _0xbe00=['Request','GetMailQueue','name','timeout','strategy','User','Agents','online','mailPause','getMailQueues','../client'];(function(_0x5f5eb2,_0x3868f5){var _0x58df87=function(_0x91d228){while(--_0x91d228){_0x5f5eb2['push'](_0x5f5eb2['shift']());}};_0x58df87(++_0x3868f5);}(_0xbe00,0xaf));var _0x0be0=function(_0x225e15,_0x209074){_0x225e15=_0x225e15-0x0;var _0x108e03=_0xbe00[_0x225e15];return _0x108e03;};'use strict';var client=require(_0x0be0('0x0'));exports['getMailQueues']=function(){return function(){return client[_0x0be0('0x1')](_0x0be0('0x2'),{'options':{'raw':![],'attributes':['id',_0x0be0('0x3'),_0x0be0('0x4'),_0x0be0('0x5')],'include':[{'model':_0x0be0('0x6'),'as':_0x0be0('0x7'),'attributes':['id',_0x0be0('0x3'),_0x0be0('0x8'),_0x0be0('0x9')]}]},'log':_0x0be0('0xa')});};}; \ No newline at end of file +var _0x422e=['online','../client','Request','GetMailQueue','timeout','strategy','User','Agents'];(function(_0x212d38,_0x177028){var _0x2a2e03=function(_0x3ace7c){while(--_0x3ace7c){_0x212d38['push'](_0x212d38['shift']());}};_0x2a2e03(++_0x177028);}(_0x422e,0x1a9));var _0xe422=function(_0x38cc06,_0x1b2230){_0x38cc06=_0x38cc06-0x0;var _0xe58c30=_0x422e[_0x38cc06];return _0xe58c30;};'use strict';var client=require(_0xe422('0x0'));exports['getMailQueues']=function(){return function(){return client[_0xe422('0x1')](_0xe422('0x2'),{'options':{'raw':![],'attributes':['id','name',_0xe422('0x3'),_0xe422('0x4')],'include':[{'model':_0xe422('0x5'),'as':_0xe422('0x6'),'attributes':['id','name',_0xe422('0x7'),'mailPause']}]},'log':'getMailQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 4af4cfe..5c52c03 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 _0xd362=['UpdateMailQueueReport','DESC','../client','create','Request','CreateMailQueueReport'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xd362,0x110));var _0x2d36=function(_0xc611b1,_0x52b4bd){_0xc611b1=_0xc611b1-0x0;var _0xad5709=_0xd362[_0xc611b1];return _0xad5709;};'use strict';var client=require(_0x2d36('0x0'));exports[_0x2d36('0x1')]=function(_0x10d71f){return client[_0x2d36('0x2')](_0x2d36('0x3'),{'body':_0x10d71f,'log':_0x2d36('0x3')});};exports['update']=function(_0x2ff7c6,_0x33b093){return client[_0x2d36('0x2')](_0x2d36('0x4'),{'body':_0x33b093,'options':{'where':{'uniqueid':_0x2ff7c6},'order':[['id',_0x2d36('0x5')]],'limit':0x1},'log':_0x2d36('0x4')});}; \ No newline at end of file +var _0xbf2e=['CreateMailQueueReport','update','UpdateMailQueueReport','../client','create','Request'];(function(_0x4bb66f,_0x3cd682){var _0xf2772f=function(_0x2e3698){while(--_0x2e3698){_0x4bb66f['push'](_0x4bb66f['shift']());}};_0xf2772f(++_0x3cd682);}(_0xbf2e,0x129));var _0xebf2=function(_0x5c82e6,_0x3183f4){_0x5c82e6=_0x5c82e6-0x0;var _0x2c01f6=_0xbf2e[_0x5c82e6];return _0x2c01f6;};'use strict';var client=require(_0xebf2('0x0'));exports[_0xebf2('0x1')]=function(_0x2594ba){return client[_0xebf2('0x2')](_0xebf2('0x3'),{'body':_0x2594ba,'log':_0xebf2('0x3')});};exports[_0xebf2('0x4')]=function(_0x33c8c6,_0x29b9a0){return client[_0xebf2('0x2')](_0xebf2('0x5'),{'body':_0x29b9a0,'options':{'where':{'uniqueid':_0x33c8c6},'order':[['id','DESC']],'limit':0x1},'log':_0xebf2('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index b46b01f..6d416b4 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 _0x3062=['addTagsToChatInteraction','../client','Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction'];(function(_0x20a558,_0x160e0e){var _0x53d3f7=function(_0x259bd8){while(--_0x259bd8){_0x20a558['push'](_0x20a558['shift']());}};_0x53d3f7(++_0x160e0e);}(_0x3062,0x120));var _0x2306=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0x3062[_0x4a53d];return _0x27410e;};'use strict';var client=require(_0x2306('0x0'));exports['update']=function(_0xb18f37,_0x50d23e){return client[_0x2306('0x1')](_0x2306('0x2'),{'body':_0x50d23e,'options':{'where':{'id':_0xb18f37}},'log':_0x2306('0x3')});};exports[_0x2306('0x4')]=function(_0x308545,_0x5b64c0){return client[_0x2306('0x1')](_0x2306('0x5'),{'body':_0x5b64c0,'options':{'where':{'id':_0x308545}},'log':_0x2306('0x6')});}; \ No newline at end of file +var _0xff41=['addTags','Request','UpdateOpenchannelInteraction'];(function(_0x1b64dd,_0x2cf769){var _0xeb464c=function(_0x38272c){while(--_0x38272c){_0x1b64dd['push'](_0x1b64dd['shift']());}};_0xeb464c(++_0x2cf769);}(_0xff41,0x12d));var _0x1ff4=function(_0x53aafa,_0x137763){_0x53aafa=_0x53aafa-0x0;var _0x4a9ca1=_0xff41[_0x53aafa];return _0x4a9ca1;};'use strict';var client=require('../client');exports['update']=function(_0xfcae49,_0x33be36){return client[_0x1ff4('0x0')](_0x1ff4('0x1'),{'body':_0x33be36,'options':{'where':{'id':_0xfcae49}},'log':'updateOpenchannelInteraction'});};exports[_0x1ff4('0x2')]=function(_0x431880,_0x3a7727){return client[_0x1ff4('0x0')]('AddTagsToOpenchannelInteraction',{'body':_0x3a7727,'options':{'where':{'id':_0x431880}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 425c1c2..8c460e0 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 _0xedd9=['create','Request','CreateOpenchannelMessage','createOpenchannelMessage'];(function(_0x3c51d4,_0x36ba53){var _0x53c45f=function(_0x3d6683){while(--_0x3d6683){_0x3c51d4['push'](_0x3c51d4['shift']());}};_0x53c45f(++_0x36ba53);}(_0xedd9,0xfc));var _0x9edd=function(_0x38761b,_0x31cbdf){_0x38761b=_0x38761b-0x0;var _0x28b740=_0xedd9[_0x38761b];return _0x28b740;};'use strict';var client=require('../client');exports[_0x9edd('0x0')]=function(_0x2d7989){return client[_0x9edd('0x1')](_0x9edd('0x2'),{'body':_0x2d7989,'log':_0x9edd('0x3')});}; \ No newline at end of file +var _0x9a19=['../client','create','CreateOpenchannelMessage','createOpenchannelMessage'];(function(_0x38d4ac,_0x19cf87){var _0x3497fb=function(_0x5dc7a0){while(--_0x5dc7a0){_0x38d4ac['push'](_0x38d4ac['shift']());}};_0x3497fb(++_0x19cf87);}(_0x9a19,0x114));var _0x99a1=function(_0x5ae8f7,_0x330d91){_0x5ae8f7=_0x5ae8f7-0x0;var _0x54c636=_0x9a19[_0x5ae8f7];return _0x54c636;};'use strict';var client=require(_0x99a1('0x0'));exports[_0x99a1('0x1')]=function(_0x3d860b){return client['Request'](_0x99a1('0x2'),{'body':_0x3d860b,'log':_0x99a1('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 450ccde..57420c6 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 _0xb1d8=['getOpenchannelQueues','Request','GetOpenchannelQueue','timeout','strategy','User','Agents','name','online','openchannelPause'];(function(_0x30641c,_0x826474){var _0x50a008=function(_0x2247ae){while(--_0x2247ae){_0x30641c['push'](_0x30641c['shift']());}};_0x50a008(++_0x826474);}(_0xb1d8,0xe6));var _0x8b1d=function(_0x143c79,_0x3cae40){_0x143c79=_0x143c79-0x0;var _0x8de9d9=_0xb1d8[_0x143c79];return _0x8de9d9;};'use strict';var client=require('../client');exports[_0x8b1d('0x0')]=function(){return function(){return client[_0x8b1d('0x1')](_0x8b1d('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x8b1d('0x3'),_0x8b1d('0x4')],'include':[{'model':_0x8b1d('0x5'),'as':_0x8b1d('0x6'),'attributes':['id',_0x8b1d('0x7'),_0x8b1d('0x8'),_0x8b1d('0x9')]}]},'log':_0x8b1d('0x0')});};}; \ No newline at end of file +var _0xb1d6=['getOpenchannelQueues','Request','name','timeout','User','Agents','openchannelPause'];(function(_0x44e13e,_0x20ec44){var _0x268ff8=function(_0x469769){while(--_0x469769){_0x44e13e['push'](_0x44e13e['shift']());}};_0x268ff8(++_0x20ec44);}(_0xb1d6,0x165));var _0x6b1d=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xb1d6[_0x2f5ac5];return _0x37c9a8;};'use strict';var client=require('../client');exports[_0x6b1d('0x0')]=function(){return function(){return client[_0x6b1d('0x1')]('GetOpenchannelQueue',{'options':{'raw':![],'attributes':['id',_0x6b1d('0x2'),_0x6b1d('0x3'),'strategy'],'include':[{'model':_0x6b1d('0x4'),'as':_0x6b1d('0x5'),'attributes':['id',_0x6b1d('0x2'),'online',_0x6b1d('0x6')]}]},'log':_0x6b1d('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index cca3966..33b4fbb 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 _0x9396=['../client','Request','CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','DESC'];(function(_0x4c9c5f,_0x72b841){var _0x48c866=function(_0xecc3a5){while(--_0xecc3a5){_0x4c9c5f['push'](_0x4c9c5f['shift']());}};_0x48c866(++_0x72b841);}(_0x9396,0x1e6));var _0x6939=function(_0x3579a9,_0x4728cb){_0x3579a9=_0x3579a9-0x0;var _0x9a342b=_0x9396[_0x3579a9];return _0x9a342b;};'use strict';var client=require(_0x6939('0x0'));exports['create']=function(_0x164f8c){return client[_0x6939('0x1')](_0x6939('0x2'),{'body':_0x164f8c,'log':_0x6939('0x2')});};exports[_0x6939('0x3')]=function(_0x42b0ce,_0x69ca8a){return client[_0x6939('0x1')](_0x6939('0x4'),{'body':_0x69ca8a,'options':{'where':{'uniqueid':_0x42b0ce},'order':[['id',_0x6939('0x5')]],'limit':0x1},'log':_0x6939('0x4')});}; \ No newline at end of file +var _0xf524=['../client','Request','CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport'];(function(_0x2c6a98,_0x508a80){var _0x58b9b5=function(_0x71f2ec){while(--_0x71f2ec){_0x2c6a98['push'](_0x2c6a98['shift']());}};_0x58b9b5(++_0x508a80);}(_0xf524,0x188));var _0x4f52=function(_0x2e1b41,_0x17914a){_0x2e1b41=_0x2e1b41-0x0;var _0x163368=_0xf524[_0x2e1b41];return _0x163368;};'use strict';var client=require(_0x4f52('0x0'));exports['create']=function(_0x1218df){return client[_0x4f52('0x1')](_0x4f52('0x2'),{'body':_0x1218df,'log':_0x4f52('0x2')});};exports['update']=function(_0x5e5c7b,_0x261014){return client[_0x4f52('0x1')](_0x4f52('0x3'),{'body':_0x261014,'options':{'where':{'uniqueid':_0x5e5c7b},'order':[['id','DESC']],'limit':0x1},'log':_0x4f52('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index e04d0f5..1a4325f 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 _0x2c30=['update','UpdateSmsInteraction','addTags','Request','AddTagsToSmsInteraction','../client'];(function(_0x14c8eb,_0xa648fa){var _0x476a1d=function(_0x431b37){while(--_0x431b37){_0x14c8eb['push'](_0x14c8eb['shift']());}};_0x476a1d(++_0xa648fa);}(_0x2c30,0x6b));var _0x02c3=function(_0x116b62,_0x21ea26){_0x116b62=_0x116b62-0x0;var _0x110fd6=_0x2c30[_0x116b62];return _0x110fd6;};'use strict';var client=require(_0x02c3('0x0'));exports[_0x02c3('0x1')]=function(_0x56274f,_0x31d62c){return client['Request'](_0x02c3('0x2'),{'body':_0x31d62c,'options':{'where':{'id':_0x56274f}},'log':'updateSmsInteraction'});};exports[_0x02c3('0x3')]=function(_0x75a6db,_0x17e525){return client[_0x02c3('0x4')](_0x02c3('0x5'),{'body':_0x17e525,'options':{'where':{'id':_0x75a6db}},'log':'addTagsToSmsInteraction'});}; \ No newline at end of file +var _0x527b=['AddTagsToSmsInteraction','../client','update','Request','UpdateSmsInteraction','updateSmsInteraction','addTags'];(function(_0x4d934b,_0x52f8e9){var _0xc0338b=function(_0x1a356c){while(--_0x1a356c){_0x4d934b['push'](_0x4d934b['shift']());}};_0xc0338b(++_0x52f8e9);}(_0x527b,0xb7));var _0xb527=function(_0x307d86,_0x9264f2){_0x307d86=_0x307d86-0x0;var _0x361745=_0x527b[_0x307d86];return _0x361745;};'use strict';var client=require(_0xb527('0x0'));exports[_0xb527('0x1')]=function(_0x882cae,_0x43752e){return client[_0xb527('0x2')](_0xb527('0x3'),{'body':_0x43752e,'options':{'where':{'id':_0x882cae}},'log':_0xb527('0x4')});};exports[_0xb527('0x5')]=function(_0x4672da,_0x441392){return client['Request'](_0xb527('0x6'),{'body':_0x441392,'options':{'where':{'id':_0x4672da}},'log':'addTagsToSmsInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 7246ff4..6d90546 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 _0x692a=['create','Request','CreateSmsMessage','createSmsMessage','../client'];(function(_0xe6466f,_0x43337e){var _0x4fb15b=function(_0x43f655){while(--_0x43f655){_0xe6466f['push'](_0xe6466f['shift']());}};_0x4fb15b(++_0x43337e);}(_0x692a,0x171));var _0xa692=function(_0x25092c,_0x115577){_0x25092c=_0x25092c-0x0;var _0xe4fe3f=_0x692a[_0x25092c];return _0xe4fe3f;};'use strict';var client=require(_0xa692('0x0'));exports[_0xa692('0x1')]=function(_0x5670c7){return client[_0xa692('0x2')](_0xa692('0x3'),{'body':_0x5670c7,'log':_0xa692('0x4')});}; \ No newline at end of file +var _0xd859=['CreateSmsMessage','createSmsMessage','../client','create','Request'];(function(_0x5bfb78,_0x22e3ff){var _0x4efd00=function(_0x5c9496){while(--_0x5c9496){_0x5bfb78['push'](_0x5bfb78['shift']());}};_0x4efd00(++_0x22e3ff);}(_0xd859,0x16a));var _0x9d85=function(_0x548467,_0x5ef1f2){_0x548467=_0x548467-0x0;var _0x53c1b0=_0xd859[_0x548467];return _0x53c1b0;};'use strict';var client=require(_0x9d85('0x0'));exports[_0x9d85('0x1')]=function(_0x15677f){return client[_0x9d85('0x2')](_0x9d85('0x3'),{'body':_0x15677f,'log':_0x9d85('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 6a8b099..93349c7 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 _0x9eac=['name','timeout','strategy','online','smsPause','getSmsQueues','Request','GetSmsQueue'];(function(_0x5ee391,_0x3c62c0){var _0x4fdb0c=function(_0x226ff3){while(--_0x226ff3){_0x5ee391['push'](_0x5ee391['shift']());}};_0x4fdb0c(++_0x3c62c0);}(_0x9eac,0x14d));var _0xc9ea=function(_0x4f6d08,_0x1b3dd0){_0x4f6d08=_0x4f6d08-0x0;var _0x53a9c6=_0x9eac[_0x4f6d08];return _0x53a9c6;};'use strict';var client=require('../client');exports[_0xc9ea('0x0')]=function(){return function(){return client[_0xc9ea('0x1')](_0xc9ea('0x2'),{'options':{'raw':![],'attributes':['id',_0xc9ea('0x3'),_0xc9ea('0x4'),_0xc9ea('0x5')],'include':[{'model':'User','as':'Agents','attributes':['id',_0xc9ea('0x3'),_0xc9ea('0x6'),_0xc9ea('0x7')]}]},'log':'getSmsQueues'});};}; \ No newline at end of file +var _0x407c=['getSmsQueues','Request','GetSmsQueue','name','timeout','User','Agents','online','../client'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x407c,0xce));var _0xc407=function(_0x55d339,_0x4a26aa){_0x55d339=_0x55d339-0x0;var _0x295b47=_0x407c[_0x55d339];return _0x295b47;};'use strict';var client=require(_0xc407('0x0'));exports[_0xc407('0x1')]=function(){return function(){return client[_0xc407('0x2')](_0xc407('0x3'),{'options':{'raw':![],'attributes':['id',_0xc407('0x4'),_0xc407('0x5'),'strategy'],'include':[{'model':_0xc407('0x6'),'as':_0xc407('0x7'),'attributes':['id',_0xc407('0x4'),_0xc407('0x8'),'smsPause']}]},'log':_0xc407('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 44e053c..149a890 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 _0xcd3b=['CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC','../client','Request'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xcd3b,0x19c));var _0xbcd3=function(_0x118085,_0x363df9){_0x118085=_0x118085-0x0;var _0x496ca3=_0xcd3b[_0x118085];return _0x496ca3;};'use strict';var client=require(_0xbcd3('0x0'));exports['create']=function(_0x30db39){return client[_0xbcd3('0x1')](_0xbcd3('0x2'),{'body':_0x30db39,'log':_0xbcd3('0x2')});};exports[_0xbcd3('0x3')]=function(_0x4ab5fb,_0x263b28){return client[_0xbcd3('0x1')](_0xbcd3('0x4'),{'body':_0x263b28,'options':{'where':{'uniqueid':_0x4ab5fb},'order':[['id',_0xbcd3('0x5')]],'limit':0x1},'log':_0xbcd3('0x4')});}; \ No newline at end of file +var _0x9f12=['Request','CreateSmsQueueReport','UpdateSmsQueueReport','DESC'];(function(_0x94d7c7,_0x51bcf8){var _0x51813f=function(_0x1de3d7){while(--_0x1de3d7){_0x94d7c7['push'](_0x94d7c7['shift']());}};_0x51813f(++_0x51bcf8);}(_0x9f12,0xe8));var _0x29f1=function(_0x515e9f,_0xff9586){_0x515e9f=_0x515e9f-0x0;var _0x19cbf0=_0x9f12[_0x515e9f];return _0x19cbf0;};'use strict';var client=require('../client');exports['create']=function(_0x3ed197){return client[_0x29f1('0x0')](_0x29f1('0x1'),{'body':_0x3ed197,'log':_0x29f1('0x1')});};exports['update']=function(_0x36399e,_0x4248c6){return client[_0x29f1('0x0')](_0x29f1('0x2'),{'body':_0x4248c6,'options':{'where':{'uniqueid':_0x36399e},'order':[['id',_0x29f1('0x3')]],'limit':0x1},'log':_0x29f1('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 14d1c50..2a696ec 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 _0xa9a4=['openchannelPause','chatCapacity','mailCapacity','faxCapacity','smsCapacity','openchannelCapacity','getAgents','../client','GetUser','agent','name','pauseType','lastPauseAt','voicePause','mailPause','faxPause','whatsappPause'];(function(_0x52a1a7,_0x64af9d){var _0x3c0843=function(_0x596456){while(--_0x596456){_0x52a1a7['push'](_0x52a1a7['shift']());}};_0x3c0843(++_0x64af9d);}(_0xa9a4,0xd3));var _0x4a9a=function(_0x56fce8,_0xe21b15){_0x56fce8=_0x56fce8-0x0;var _0x44ad12=_0xa9a4[_0x56fce8];return _0x44ad12;};'use strict';var client=require(_0x4a9a('0x0'));exports['getAgents']=function(){return function(){return client['Request'](_0x4a9a('0x1'),{'options':{'raw':!![],'where':{'role':_0x4a9a('0x2')},'attributes':['id',_0x4a9a('0x3'),'online',_0x4a9a('0x4'),_0x4a9a('0x5'),_0x4a9a('0x6'),'chatPause',_0x4a9a('0x7'),_0x4a9a('0x8'),'smsPause',_0x4a9a('0x9'),_0x4a9a('0xa'),_0x4a9a('0xb'),_0x4a9a('0xc'),_0x4a9a('0xd'),_0x4a9a('0xe'),'whatsappCapacity',_0x4a9a('0xf')]},'log':_0x4a9a('0x10')});};}; \ No newline at end of file +var _0x6f53=['chatPause','smsPause','whatsappPause','openchannelPause','chatCapacity','faxCapacity','whatsappCapacity','getAgents','Request','GetUser','agent','name','online','pauseType','lastPauseAt'];(function(_0x338ead,_0xebf209){var _0x61690c=function(_0x1738e9){while(--_0x1738e9){_0x338ead['push'](_0x338ead['shift']());}};_0x61690c(++_0xebf209);}(_0x6f53,0xf7));var _0x36f5=function(_0x583819,_0x2921df){_0x583819=_0x583819-0x0;var _0x2ebb13=_0x6f53[_0x583819];return _0x2ebb13;};'use strict';var client=require('../client');exports[_0x36f5('0x0')]=function(){return function(){return client[_0x36f5('0x1')](_0x36f5('0x2'),{'options':{'raw':!![],'where':{'role':_0x36f5('0x3')},'attributes':['id',_0x36f5('0x4'),_0x36f5('0x5'),_0x36f5('0x6'),_0x36f5('0x7'),'voicePause',_0x36f5('0x8'),'mailPause','faxPause',_0x36f5('0x9'),_0x36f5('0xa'),_0x36f5('0xb'),_0x36f5('0xc'),'mailCapacity',_0x36f5('0xd'),'smsCapacity',_0x36f5('0xe'),'openchannelCapacity']},'log':_0x36f5('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappInteraction.js b/server/services/routing/rpc/whatsappInteraction.js index 5c83062..7aea87e 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 _0x1542=['addTags','AddTagsToWhatsappInteraction','../client','update','Request','updateWhatsappInteraction'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x1542,0x116));var _0x2154=function(_0x4c096e,_0x507afb){_0x4c096e=_0x4c096e-0x0;var _0x3a5398=_0x1542[_0x4c096e];return _0x3a5398;};'use strict';var client=require(_0x2154('0x0'));exports[_0x2154('0x1')]=function(_0x24448e,_0x2dd755){return client[_0x2154('0x2')]('UpdateWhatsappInteraction',{'body':_0x2dd755,'options':{'where':{'id':_0x24448e}},'log':_0x2154('0x3')});};exports[_0x2154('0x4')]=function(_0x13e41b,_0x4ded8a){return client[_0x2154('0x2')](_0x2154('0x5'),{'body':_0x4ded8a,'options':{'where':{'id':_0x13e41b}},'log':'addTagsToWhatsappInteraction'});}; \ No newline at end of file +var _0x3fec=['AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','Request','updateWhatsappInteraction'];(function(_0x1e3c16,_0x372caa){var _0x47a0c9=function(_0x47f81d){while(--_0x47f81d){_0x1e3c16['push'](_0x1e3c16['shift']());}};_0x47a0c9(++_0x372caa);}(_0x3fec,0x1ba));var _0xc3fe=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x3fec[_0x14add3];return _0x4a174f;};'use strict';var client=require(_0xc3fe('0x0'));exports['update']=function(_0x502342,_0x3096c1){return client[_0xc3fe('0x1')]('UpdateWhatsappInteraction',{'body':_0x3096c1,'options':{'where':{'id':_0x502342}},'log':_0xc3fe('0x2')});};exports['addTags']=function(_0x53a208,_0x1cdef8){return client['Request'](_0xc3fe('0x3'),{'body':_0x1cdef8,'options':{'where':{'id':_0x53a208}},'log':_0xc3fe('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index 5880405..83ba4b3 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 _0x0ed4=['CreateWhatsappMessage','../client','create','Request'];(function(_0x5cf1f5,_0x4326bb){var _0x3db23b=function(_0x2cbfd0){while(--_0x2cbfd0){_0x5cf1f5['push'](_0x5cf1f5['shift']());}};_0x3db23b(++_0x4326bb);}(_0x0ed4,0x16d));var _0x40ed=function(_0x1a9eb8,_0x32c795){_0x1a9eb8=_0x1a9eb8-0x0;var _0xe8be84=_0x0ed4[_0x1a9eb8];return _0xe8be84;};'use strict';var client=require(_0x40ed('0x0'));exports[_0x40ed('0x1')]=function(_0x267467){return client[_0x40ed('0x2')](_0x40ed('0x3'),{'body':_0x267467,'log':'createWhatsappMessage'});}; \ No newline at end of file +var _0x7b3a=['create','CreateWhatsappMessage'];(function(_0x10cb68,_0x59582a){var _0x252e77=function(_0x4dd748){while(--_0x4dd748){_0x10cb68['push'](_0x10cb68['shift']());}};_0x252e77(++_0x59582a);}(_0x7b3a,0x98));var _0xa7b3=function(_0x2670ed,_0x1e9e2b){_0x2670ed=_0x2670ed-0x0;var _0x282b27=_0x7b3a[_0x2670ed];return _0x282b27;};'use strict';var client=require('../client');exports[_0xa7b3('0x0')]=function(_0x343b2e){return client['Request'](_0xa7b3('0x1'),{'body':_0x343b2e,'log':'createWhatsappMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 2437edc..e1b1911 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 _0x5ec6=['online','../client','getWhatsappQueues','Request','name','strategy','Agents'];(function(_0x28947d,_0x4cc9c6){var _0x12d2ee=function(_0x3f38fc){while(--_0x3f38fc){_0x28947d['push'](_0x28947d['shift']());}};_0x12d2ee(++_0x4cc9c6);}(_0x5ec6,0x7f));var _0x65ec=function(_0x1344d1,_0x1b6b7f){_0x1344d1=_0x1344d1-0x0;var _0x45cd36=_0x5ec6[_0x1344d1];return _0x45cd36;};'use strict';var client=require(_0x65ec('0x0'));exports[_0x65ec('0x1')]=function(){return function(){return client[_0x65ec('0x2')]('GetWhatsappQueue',{'options':{'raw':![],'attributes':['id',_0x65ec('0x3'),'timeout',_0x65ec('0x4')],'include':[{'model':'User','as':_0x65ec('0x5'),'attributes':['id','name',_0x65ec('0x6'),'whatsappPause']}]},'log':_0x65ec('0x1')});};}; \ No newline at end of file +var _0x63a5=['getWhatsappQueues','Request','name','strategy','User','Agents','../client'];(function(_0x820843,_0x4b6f7e){var _0x2077c2=function(_0x26e103){while(--_0x26e103){_0x820843['push'](_0x820843['shift']());}};_0x2077c2(++_0x4b6f7e);}(_0x63a5,0x18e));var _0x563a=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x63a5[_0x321bb2];return _0x9c12ed;};'use strict';var client=require(_0x563a('0x0'));exports[_0x563a('0x1')]=function(){return function(){return client[_0x563a('0x2')]('GetWhatsappQueue',{'options':{'raw':![],'attributes':['id',_0x563a('0x3'),'timeout',_0x563a('0x4')],'include':[{'model':_0x563a('0x5'),'as':_0x563a('0x6'),'attributes':['id',_0x563a('0x3'),'online','whatsappPause']}]},'log':_0x563a('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 81b1f53..dc7e203 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 _0x868e=['update','../client','Request','CreateWhatsappQueueReport'];(function(_0x173f10,_0x35db61){var _0x53142d=function(_0x37bbef){while(--_0x37bbef){_0x173f10['push'](_0x173f10['shift']());}};_0x53142d(++_0x35db61);}(_0x868e,0x1dd));var _0xe868=function(_0x468104,_0x487820){_0x468104=_0x468104-0x0;var _0x2130e9=_0x868e[_0x468104];return _0x2130e9;};'use strict';var client=require(_0xe868('0x0'));exports['create']=function(_0x539551){return client[_0xe868('0x1')](_0xe868('0x2'),{'body':_0x539551,'log':_0xe868('0x2')});};exports[_0xe868('0x3')]=function(_0x448bff,_0x21d03c){return client[_0xe868('0x1')]('UpdateWhatsappQueueReport',{'body':_0x21d03c,'options':{'where':{'uniqueid':_0x448bff},'order':[['id','DESC']],'limit':0x1},'log':'UpdateWhatsappQueueReport'});}; \ No newline at end of file +var _0xfbac=['DESC','UpdateWhatsappQueueReport','../client','create','Request','CreateWhatsappQueueReport','update'];(function(_0x5921e4,_0x1b7bd2){var _0x4100c5=function(_0xf966f7){while(--_0xf966f7){_0x5921e4['push'](_0x5921e4['shift']());}};_0x4100c5(++_0x1b7bd2);}(_0xfbac,0x1c2));var _0xcfba=function(_0x2472c1,_0x3be61b){_0x2472c1=_0x2472c1-0x0;var _0x5a52ac=_0xfbac[_0x2472c1];return _0x5a52ac;};'use strict';var client=require(_0xcfba('0x0'));exports[_0xcfba('0x1')]=function(_0x907b0){return client[_0xcfba('0x2')](_0xcfba('0x3'),{'body':_0x907b0,'log':_0xcfba('0x3')});};exports[_0xcfba('0x4')]=function(_0x17c0e4,_0x63cc43){return client[_0xcfba('0x2')]('UpdateWhatsappQueueReport',{'body':_0x63cc43,'options':{'where':{'uniqueid':_0x17c0e4},'order':[['id',_0xcfba('0x5')]],'limit':0x1},'log':_0xcfba('0x6')});}; \ 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 c3ed284..1a241a0 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 _0xd67a=['channel','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','[%s][AGENT]\x20ROUTING\x20END','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','validate','util','../../../../config/logger','routing','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','message','stop','timeout','createQueue'];(function(_0x11ef11,_0x40ac2c){var _0x28c3e6=function(_0x2641d0){while(--_0x2641d0){_0x11ef11['push'](_0x11ef11['shift']());}};_0x28c3e6(++_0x40ac2c);}(_0xd67a,0x160));var _0xad67=function(_0x5f171b,_0x33d11a){_0x5f171b=_0x5f171b-0x0;var _0x2303d8=_0xd67a[_0x5f171b];return _0x2303d8;};'use strict';var schema=require(_0xad67('0x0'));var _=require('lodash');var util=require(_0xad67('0x1'));var seqqueue=require('seq-queue');var logger=require(_0xad67('0x2'))(_0xad67('0x3'));var strategy=require('./strategy');var queue=schema({'name':{'type':_0xad67('0x4'),'required':!![],'message':_0xad67('0x5')},'timeout':{'type':_0xad67('0x6'),'message':_0xad67('0x7')}});function writeLog(_0x238d78,_0x17112a,_0x3fc6e6){return logger[_0xad67('0x8')](util[_0xad67('0x9')](_0xad67('0xa'),_0x238d78,_0x17112a['name'],_0x3fc6e6));}function handleFindAgent(_0x577408){return function(_0x55c8a0){return _0x55c8a0[_0xad67('0xb')][_0xad67('0xc')]()===_0x577408[_0xad67('0xc')]();};}exports[_0xad67('0xd')]=function(_0x36b939,_0x50fe5d,_0x3a262c,_0x4b70fd){return function(_0x3cae99){try{var _0x132f0e={'name':_0x50fe5d[0x0],'timeout':_0x50fe5d[0x1]};var _0xa179d9=queue[_0xad67('0x0')](_0x132f0e,{'typecast':!![]});if(_0xa179d9[_0xad67('0xe')]){logger[_0xad67('0xf')]('[%s][AGENT]\x20%s',_0x36b939,_['map'](_0xa179d9,_0xad67('0x10'))['join'](',\x20'));_0x3cae99[_0xad67('0x11')]();}else{var _0xab4d79=_['find'](_0x3a262c['agents'],handleFindAgent(_0x132f0e[_0xad67('0xb')]));if(_0xab4d79){var _0xf79e3c=(_0x132f0e[_0xad67('0x12')]||0xa)*0x3e8;var _0x53fa60,_0x366855;var _0x48cd40=seqqueue[_0xad67('0x13')](_0xf79e3c);_0x48cd40['id']=_0x36b939;_0x48cd40['atimeout']=_0xf79e3c;_0x48cd40['channel']=_0x4b70fd[_0xad67('0x14')];writeLog(_0x36b939,_0xab4d79,util[_0xad67('0x9')](_0xad67('0x15'),_0xf79e3c));_0x3a262c[_0xad67('0x16')][_0x36b939]['on'](_0xad67('0x17'),function(){logger[_0xad67('0x8')](_0xad67('0x18'),_0x36b939);clearTimeout(_0x366855);_0x366855=undefined;_0x48cd40['close']();if(_0x3a262c[_0xad67('0x16')][_0x36b939]){delete _0x3a262c['rules'][_0x36b939];}_0x3cae99[_0xad67('0x11')]();});_0x3a262c[_0xad67('0x16')][_0x36b939]['on']('complete',function(){if(_0x3a262c[_0xad67('0x16')][_0x36b939]){delete _0x3a262c[_0xad67('0x16')][_0x36b939];}});_0x366855=setTimeout(function(){logger[_0xad67('0x8')](_0xad67('0x19'),_0x36b939);clearTimeout(_0x366855);_0x48cd40['close']();_0x3cae99[_0xad67('0x1a')]();},_0xf79e3c);strategy[_0xad67('0x1b')](_0x48cd40,_0xab4d79,_0x3a262c,_0x4b70fd);}else{logger[_0xad67('0xf')](_0xad67('0x1c'),_0x36b939,_0x132f0e[_0xad67('0xb')]);_0x3cae99[_0xad67('0x11')]();}}}catch(_0x17d519){console[_0xad67('0x1d')](_0x17d519);logger[_0xad67('0xf')](_0xad67('0x1e'),_0x36b939,_0x17d519['stack']);_0x3cae99['stop']();}};}; \ No newline at end of file +var _0xc951=['close','complete','[%s][AGENT]\x20ROUTING\x20END','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','stack','lodash','util','seq-queue','../../../../config/logger','routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','info','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','validate','length','error','stop','timeout','createQueue','atimeout','channel','format','rules','[%s][AGENT]\x20ROUTING\x20STOPPED'];(function(_0x16ea87,_0x378d8b){var _0x6e7b1c=function(_0x26306e){while(--_0x26306e){_0x16ea87['push'](_0x16ea87['shift']());}};_0x6e7b1c(++_0x378d8b);}(_0xc951,0x108));var _0x1c95=function(_0x1be6ca,_0x5f01e9){_0x1be6ca=_0x1be6ca-0x0;var _0x174b72=_0xc951[_0x1be6ca];return _0x174b72;};'use strict';var schema=require('validate');var _=require(_0x1c95('0x0'));var util=require(_0x1c95('0x1'));var seqqueue=require(_0x1c95('0x2'));var logger=require(_0x1c95('0x3'))(_0x1c95('0x4'));var strategy=require(_0x1c95('0x5'));var queue=schema({'name':{'type':_0x1c95('0x6'),'required':!![],'message':_0x1c95('0x7')},'timeout':{'type':'number','message':_0x1c95('0x8')}});function writeLog(_0x27b7c1,_0x4bdf58,_0x1aa934){return logger[_0x1c95('0x9')](util['format'](_0x1c95('0xa'),_0x27b7c1,_0x4bdf58[_0x1c95('0xb')],_0x1aa934));}function handleFindAgent(_0x17109a){return function(_0x2ae966){return _0x2ae966['name']['toLowerCase']()===_0x17109a[_0x1c95('0xc')]();};}exports['consequence']=function(_0x2418ce,_0xcd49e3,_0x3a9b71,_0x2575be){return function(_0x28058a){try{var _0x5859c5={'name':_0xcd49e3[0x0],'timeout':_0xcd49e3[0x1]};var _0x140b75=queue[_0x1c95('0xd')](_0x5859c5,{'typecast':!![]});if(_0x140b75[_0x1c95('0xe')]){logger[_0x1c95('0xf')]('[%s][AGENT]\x20%s',_0x2418ce,_['map'](_0x140b75,'message')['join'](',\x20'));_0x28058a[_0x1c95('0x10')]();}else{var _0x138416=_['find'](_0x3a9b71['agents'],handleFindAgent(_0x5859c5[_0x1c95('0xb')]));if(_0x138416){var _0x41868c=(_0x5859c5[_0x1c95('0x11')]||0xa)*0x3e8;var _0x1fe475,_0x56dceb;var _0x1a078c=seqqueue[_0x1c95('0x12')](_0x41868c);_0x1a078c['id']=_0x2418ce;_0x1a078c[_0x1c95('0x13')]=_0x41868c;_0x1a078c[_0x1c95('0x14')]=_0x2575be['channel'];writeLog(_0x2418ce,_0x138416,util[_0x1c95('0x15')]('START:%s',_0x41868c));_0x3a9b71[_0x1c95('0x16')][_0x2418ce]['on']('end',function(){logger[_0x1c95('0x9')](_0x1c95('0x17'),_0x2418ce);clearTimeout(_0x56dceb);_0x56dceb=undefined;_0x1a078c[_0x1c95('0x18')]();if(_0x3a9b71[_0x1c95('0x16')][_0x2418ce]){delete _0x3a9b71[_0x1c95('0x16')][_0x2418ce];}_0x28058a[_0x1c95('0x10')]();});_0x3a9b71[_0x1c95('0x16')][_0x2418ce]['on'](_0x1c95('0x19'),function(){if(_0x3a9b71[_0x1c95('0x16')][_0x2418ce]){delete _0x3a9b71[_0x1c95('0x16')][_0x2418ce];}});_0x56dceb=setTimeout(function(){logger['info'](_0x1c95('0x1a'),_0x2418ce);clearTimeout(_0x56dceb);_0x1a078c[_0x1c95('0x18')]();_0x28058a[_0x1c95('0x1b')]();},_0x41868c);strategy[_0x1c95('0x1c')](_0x1a078c,_0x138416,_0x3a9b71,_0x2575be);}else{logger['error'](_0x1c95('0x1d'),_0x2418ce,_0x5859c5[_0x1c95('0xb')]);_0x28058a[_0x1c95('0x10')]();}}}catch(_0xeebc63){console[_0x1c95('0x1e')](_0xeebc63);logger[_0x1c95('0xf')]('[%s][QUEUE]\x20%s',_0x2418ce,_0xeebc63[_0x1c95('0x1f')]);_0x28058a[_0x1c95('0x10')]();}};}; \ 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 82c1c5e..72eec40 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 _0xdbf5=['$LATEST','channel','interaction','toString','postText','message','amazonlex','dialogState','Failed','moment','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','UserId','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','format','ChatWebsiteId','upperFirst','AccountId','account','InteractionId','created','body','getMustacheRender','Message','create','then','info','catch','error','stringify','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','LexRuntime'];(function(_0x3087a5,_0x522072){var _0x3ca976=function(_0x43c70e){while(--_0x43c70e){_0x3087a5['push'](_0x3087a5['shift']());}};_0x3ca976(++_0x522072);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x42da3c,_0x310d92){_0x42da3c=_0x42da3c-0x0;var _0x28f9a9=_0xdbf5[_0x42da3c];return _0x28f9a9;};'use strict';var _=require('lodash');var moment=require(_0x5dbf('0x0'));var AWS=require('aws-sdk');var utils=require('./utils');var logger=require(_0x5dbf('0x1'))(_0x5dbf('0x2'));var rpc={'chatMessage':require(_0x5dbf('0x3')),'openchannelMessage':require(_0x5dbf('0x4')),'mailMessage':require(_0x5dbf('0x5')),'smsMessage':require(_0x5dbf('0x6')),'faxMessage':require(_0x5dbf('0x7')),'whatsappMessage':require(_0x5dbf('0x8'))};exports[_0x5dbf('0x9')]=function(_0x3f8222,_0x209b7d){return function(_0x88128e){try{if(!_[_0x5dbf('0xa')](this['interaction'][_0x5dbf('0xb')])){logger['info'](_0x5dbf('0xc'),_0x3f8222,_0x5dbf('0xd'));return _0x88128e[_0x5dbf('0xe')]();}var _0x1813bb={'ContactId':this['contact']['id'],'sentAt':moment()[_0x5dbf('0xf')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':'out'};var _0x1c7389=this['channel'];if(_0x1c7389==='chat'){_0x1813bb[_0x5dbf('0x10')]=this['account']['id'];}else{_0x1813bb[_[_0x5dbf('0x11')](_0x1c7389)+_0x5dbf('0x12')]=this[_0x5dbf('0x13')]['id'];}_0x1813bb[_[_0x5dbf('0x11')](_0x1c7389)+_0x5dbf('0x14')]=this['interaction']['id'];if(this['interaction'][_0x5dbf('0x15')]){var _0x3480c8=_0x209b7d[0x4];if(!_['isEmpty'](_0x3480c8)){_0x1813bb[_0x5dbf('0x16')]=utils[_0x5dbf('0x17')](_0x3480c8,this);return rpc[_0x1c7389+_0x5dbf('0x18')][_0x5dbf('0x19')](_0x1813bb)[_0x5dbf('0x1a')](function(_0x472eb9){logger[_0x5dbf('0x1b')]('[%s][AMAZONLEX]\x20%s',_0x3f8222,_0x1813bb['body']);})[_0x5dbf('0x1c')](function(_0xc4cb1c){logger[_0x5dbf('0x1d')](_0x5dbf('0xc'),_0x3f8222,JSON[_0x5dbf('0x1e')](_0xc4cb1c));})['finally'](function(){logger[_0x5dbf('0x1b')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x3f8222);_0x88128e['stop']();});}else{logger['info'](_0x5dbf('0x1f'),_0x3f8222);_0x88128e[_0x5dbf('0x20')]();}}else{var _0x358d46=this;var _0x2ab57c=new AWS[(_0x5dbf('0x21'))]({'accessKeyId':_0x209b7d[0x0],'secretAccessKey':_0x209b7d[0x1],'region':_0x209b7d[0x2]});var _0x5b2518={'botAlias':_0x5dbf('0x22'),'botName':_0x209b7d[0x3],'inputText':this['message'][_0x5dbf('0x16')],'userId':this[_0x5dbf('0x23')]+':'+this[_0x5dbf('0x24')]['id'][_0x5dbf('0x25')]()};_0x2ab57c[_0x5dbf('0x26')](_0x5b2518,function(_0x2f154e,_0x58085e){if(_0x2f154e){logger[_0x5dbf('0x1d')](_0x5dbf('0xc'),_0x3f8222,_0x2f154e[_0x5dbf('0x27')]);_0x88128e[_0x5dbf('0xe')]();}else if(_0x58085e&&_0x58085e[_0x5dbf('0x27')]){_0x358d46[_0x5dbf('0x16')][_0x5dbf('0x28')]=_0x58085e;_0x1813bb[_0x5dbf('0x16')]=_0x58085e[_0x5dbf('0x27')];return rpc[_0x1c7389+_0x5dbf('0x18')][_0x5dbf('0x19')](_0x1813bb)[_0x5dbf('0x1a')](function(_0x3f9e60){logger[_0x5dbf('0x1b')](_0x5dbf('0xc'),_0x3f8222,_0x1813bb[_0x5dbf('0x16')]);if(_0x58085e[_0x5dbf('0x29')]==_0x5dbf('0x2a')){_0x88128e[_0x5dbf('0xe')]();}else{_0x88128e[_0x5dbf('0x20')]();}})[_0x5dbf('0x1c')](function(_0x471027){logger[_0x5dbf('0x1d')]('[%s][AMAZONLEX]\x20%s',_0x3f8222,JSON[_0x5dbf('0x1e')](_0x471027));_0x88128e[_0x5dbf('0xe')]();});}else{_0x88128e[_0x5dbf('0xe')]();}});}}catch(_0x1fb9a7){logger[_0x5dbf('0x1d')](_0x5dbf('0xc'),_0x3f8222,JSON[_0x5dbf('0x1e')](_0x1fb9a7));_0x88128e[_0x5dbf('0x20')]();}};}; \ No newline at end of file +var _0xe2fe=['info','[%s][AMAZONLEX]\x20%s','next','account','upperFirst','AccountId','InteractionId','isEmpty','getMustacheRender','Message','create','then','catch','stringify','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','message','body','channel','toString','postText','error','amazonlex','Failed','lodash','./utils','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','interaction'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe2fe,0x86));var _0xee2f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe2fe[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xee2f('0x0'));var moment=require('moment');var AWS=require('aws-sdk');var utils=require(_0xee2f('0x1'));var logger=require('../../../../config/logger')(_0xee2f('0x2'));var rpc={'chatMessage':require(_0xee2f('0x3')),'openchannelMessage':require(_0xee2f('0x4')),'mailMessage':require(_0xee2f('0x5')),'smsMessage':require(_0xee2f('0x6')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xee2f('0x7'))};exports[_0xee2f('0x8')]=function(_0x49926b,_0x1533a0){return function(_0x2e1c8c){try{if(!_['isNil'](this[_0xee2f('0x9')]['UserId'])){logger[_0xee2f('0xa')](_0xee2f('0xb'),_0x49926b,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x2e1c8c[_0xee2f('0xc')]();}var _0x43f451={'ContactId':this['contact']['id'],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'direction':'out'};var _0x2b8fb1=this['channel'];if(_0x2b8fb1==='chat'){_0x43f451['ChatWebsiteId']=this[_0xee2f('0xd')]['id'];}else{_0x43f451[_[_0xee2f('0xe')](_0x2b8fb1)+_0xee2f('0xf')]=this[_0xee2f('0xd')]['id'];}_0x43f451[_[_0xee2f('0xe')](_0x2b8fb1)+_0xee2f('0x10')]=this['interaction']['id'];if(this[_0xee2f('0x9')]['created']){var _0x36db10=_0x1533a0[0x4];if(!_[_0xee2f('0x11')](_0x36db10)){_0x43f451['body']=utils[_0xee2f('0x12')](_0x36db10,this);return rpc[_0x2b8fb1+_0xee2f('0x13')][_0xee2f('0x14')](_0x43f451)[_0xee2f('0x15')](function(_0x390c2c){logger['info'](_0xee2f('0xb'),_0x49926b,_0x43f451['body']);})[_0xee2f('0x16')](function(_0x3359ff){logger['error']('[%s][AMAZONLEX]\x20%s',_0x49926b,JSON[_0xee2f('0x17')](_0x3359ff));})['finally'](function(){logger[_0xee2f('0xa')](_0xee2f('0x18'),_0x49926b);_0x2e1c8c[_0xee2f('0x19')]();});}else{logger['info'](_0xee2f('0x1a'),_0x49926b);_0x2e1c8c[_0xee2f('0x19')]();}}else{var _0x4db2cc=this;var _0x21fdf4=new AWS[(_0xee2f('0x1b'))]({'accessKeyId':_0x1533a0[0x0],'secretAccessKey':_0x1533a0[0x1],'region':_0x1533a0[0x2]});var _0x5d36d4={'botAlias':'$LATEST','botName':_0x1533a0[0x3],'inputText':this[_0xee2f('0x1c')][_0xee2f('0x1d')],'userId':this[_0xee2f('0x1e')]+':'+this[_0xee2f('0x9')]['id'][_0xee2f('0x1f')]()};_0x21fdf4[_0xee2f('0x20')](_0x5d36d4,function(_0x39a39c,_0x4d68d3){if(_0x39a39c){logger[_0xee2f('0x21')](_0xee2f('0xb'),_0x49926b,_0x39a39c[_0xee2f('0x1c')]);_0x2e1c8c[_0xee2f('0xc')]();}else if(_0x4d68d3&&_0x4d68d3[_0xee2f('0x1c')]){_0x4db2cc[_0xee2f('0x1d')][_0xee2f('0x22')]=_0x4d68d3;_0x43f451[_0xee2f('0x1d')]=_0x4d68d3[_0xee2f('0x1c')];return rpc[_0x2b8fb1+_0xee2f('0x13')][_0xee2f('0x14')](_0x43f451)[_0xee2f('0x15')](function(_0x1c8454){logger[_0xee2f('0xa')]('[%s][AMAZONLEX]\x20%s',_0x49926b,_0x43f451['body']);if(_0x4d68d3['dialogState']==_0xee2f('0x23')){_0x2e1c8c[_0xee2f('0xc')]();}else{_0x2e1c8c[_0xee2f('0x19')]();}})[_0xee2f('0x16')](function(_0x892a4e){logger[_0xee2f('0x21')]('[%s][AMAZONLEX]\x20%s',_0x49926b,JSON[_0xee2f('0x17')](_0x892a4e));_0x2e1c8c['next']();});}else{_0x2e1c8c[_0xee2f('0xc')]();}});}}catch(_0x180429){logger[_0xee2f('0x21')](_0xee2f('0xb'),_0x49926b,JSON[_0xee2f('0x17')](_0x180429));_0x2e1c8c['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/autoreply.js b/server/services/routing/server/applications/autoreply.js index fe5377b..5998668 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 _0xb1dc=['../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','created','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20already\x20sent','getMustacheRender','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','message','from','phone','subject','startsWith','Re:','ChatWebsiteId','account','upperFirst','channel','AccountId','InteractionId','Message','mail','service','host','Smtp','secure','authentication','auth','user','inReplyTo','messageId','','';return mailRpc['sendMailMessage'](_0x96b5e1,_0x386d4f)[_0xcb1d('0x2e')](function(_0x4ea0a5){logger[_0xcb1d('0xd')]('[%s][AUTOREPLY]\x20SMTP\x20SENT',_0x3bf356);_0x386d4f[_0xcb1d('0x2b')]=_0x4ea0a5[_0xcb1d('0x15')][_0xcb1d('0x2b')];return rpc[_0x4efa15+_0xcb1d('0x21')]['create'](_0x386d4f);})['then'](function(_0x1a9342){logger[_0xcb1d('0xd')]('[%s][AUTOREPLY]\x20%s',_0x3bf356,JSON[_0xcb1d('0x2f')](_0x1a9342));})['catch'](function(_0xfcfbe4){logger['error'](_0xcb1d('0x30'),_0x3bf356,JSON['stringify'](_0xfcfbe4));})['finally'](function(){_0x15c492[_0xcb1d('0x31')]();});}else{return rpc[this[_0xcb1d('0x1e')]+_0xcb1d('0x21')]['create'](_0x386d4f)[_0xcb1d('0x2e')](function(_0x5d1b8d){logger[_0xcb1d('0xd')](_0xcb1d('0xe'),_0x3bf356,_0x386d4f['body']);})[_0xcb1d('0x32')](function(_0x212081){logger['error'](_0xcb1d('0xe'),_0x3bf356,JSON['stringify'](_0x212081));})[_0xcb1d('0x33')](function(){_0x15c492['next']();});}}}catch(_0x17486b){logger['error'](_0xcb1d('0xe'),_0x3bf356,JSON[_0xcb1d('0x2f')](_0x17486b));_0x15c492['stop']();}};}; \ No newline at end of file +var _0x38f8=['read','subject','startsWith','Re:','Re:\x20','channel','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','Message','Smtp','service','host','port','secure','auth','user','pass','inReplyTo','html','replace','body','','sendMailMessage','info','[%s][AUTOREPLY]\x20SMTP\x20SENT','messageId','then','stringify','catch','error','[RPC][%s][AUTOREPLY]\x20%s','finally','next','stop','lodash','moment','./utils','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../mailRpc','consequence','isNil','created','interaction','[%s][AUTOREPLY]\x20%s','Autoreply\x20already\x20sent','getMustacheRender','contact','out','message','from','phone'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x38f8,0x64));var _0x838f=function(_0x576ae0,_0x3dd587){_0x576ae0=_0x576ae0-0x0;var _0x562938=_0x38f8[_0x576ae0];return _0x562938;};'use strict';var _=require(_0x838f('0x0'));var moment=require(_0x838f('0x1'));var utils=require(_0x838f('0x2'));var logger=require(_0x838f('0x3'))(_0x838f('0x4'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x838f('0x5')),'mailMessage':require(_0x838f('0x6')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x838f('0x7')),'whatsappMessage':require(_0x838f('0x8'))};var mailRpc=require(_0x838f('0x9'));exports[_0x838f('0xa')]=function(_0x2571ed,_0x5e8918){return function(_0x2607ab){try{if(_0x5e8918[0x0]==='1'&&(_[_0x838f('0xb')](this['interaction'][_0x838f('0xc')])||!this[_0x838f('0xd')][_0x838f('0xc')])){logger['info'](_0x838f('0xe'),_0x2571ed,_0x838f('0xf'));return _0x2607ab['next']();}var _0x7e87be=this['channel'];var _0x26eda7={'body':utils[_0x838f('0x10')](_0x5e8918[0x1],this),'ContactId':this[_0x838f('0x11')]['id'],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x838f('0x12')};if(this[_0x838f('0x13')]){_0x26eda7['to']=this['message'][_0x838f('0x14')]||'';_0x26eda7['cc']=this[_0x838f('0x13')]['cc']||'';_0x26eda7[_0x838f('0x14')]=this[_0x838f('0x13')]['to']||'';_0x26eda7[_0x838f('0x15')]=this[_0x838f('0x13')][_0x838f('0x15')]||'';_0x26eda7[_0x838f('0x16')]=!![];if(this[_0x838f('0x13')][_0x838f('0x17')]){_0x26eda7[_0x838f('0x17')]='';_0x26eda7[_0x838f('0x17')]+=_[_0x838f('0x18')](this[_0x838f('0x13')][_0x838f('0x17')],_0x838f('0x19'))?'':_0x838f('0x1a');_0x26eda7[_0x838f('0x17')]+=this[_0x838f('0x13')][_0x838f('0x17')];}}if(this[_0x838f('0x1b')]==='chat'){_0x26eda7[_0x838f('0x1c')]=this[_0x838f('0x1d')]['id'];}else{_0x26eda7[_[_0x838f('0x1e')](this[_0x838f('0x1b')])+_0x838f('0x1f')]=this[_0x838f('0x1d')]['id'];}_0x26eda7[_[_0x838f('0x1e')](this[_0x838f('0x1b')])+_0x838f('0x20')]=this['interaction']['id'];if(rpc[this[_0x838f('0x1b')]+_0x838f('0x21')]){if(this['channel']==='mail'){var _0xff2971={'tls':{'rejectUnauthorized':![]}};if(this[_0x838f('0x1d')][_0x838f('0x22')][_0x838f('0x23')]){_0xff2971[_0x838f('0x23')]=this[_0x838f('0x1d')][_0x838f('0x22')][_0x838f('0x23')];}else{_0xff2971[_0x838f('0x24')]=this[_0x838f('0x1d')]['Smtp'][_0x838f('0x24')];_0xff2971[_0x838f('0x25')]=this[_0x838f('0x1d')][_0x838f('0x22')][_0x838f('0x25')];_0xff2971[_0x838f('0x26')]=this['account'][_0x838f('0x22')][_0x838f('0x26')];}if(this['account'][_0x838f('0x22')]['authentication']){_0xff2971[_0x838f('0x27')]={'user':this['account']['Smtp'][_0x838f('0x28')],'pass':this[_0x838f('0x1d')][_0x838f('0x22')][_0x838f('0x29')]};}_0x26eda7[_0x838f('0x2a')]=this[_0x838f('0x13')]['messageId'];_0x26eda7[_0x838f('0x2b')]=''+_[_0x838f('0x2c')](_0x26eda7[_0x838f('0x2d')],_0x838f('0x2e'),_0x838f('0x2f'))+_0x838f('0x30');return mailRpc[_0x838f('0x31')](_0xff2971,_0x26eda7)['then'](function(_0x8b9db){logger[_0x838f('0x32')](_0x838f('0x33'),_0x2571ed);_0x26eda7[_0x838f('0x34')]=_0x8b9db[_0x838f('0x13')][_0x838f('0x34')];return rpc[_0x7e87be+_0x838f('0x21')]['create'](_0x26eda7);})[_0x838f('0x35')](function(_0x1a0c71){logger[_0x838f('0x32')](_0x838f('0xe'),_0x2571ed,JSON[_0x838f('0x36')](_0x1a0c71));})[_0x838f('0x37')](function(_0x182a11){logger[_0x838f('0x38')](_0x838f('0x39'),_0x2571ed,JSON[_0x838f('0x36')](_0x182a11));})[_0x838f('0x3a')](function(){_0x2607ab['next']();});}else{return rpc[this[_0x838f('0x1b')]+_0x838f('0x21')]['create'](_0x26eda7)[_0x838f('0x35')](function(_0x49a0d1){logger[_0x838f('0x32')](_0x838f('0xe'),_0x2571ed,_0x26eda7['body']);})[_0x838f('0x37')](function(_0xb0c667){logger['error']('[%s][AUTOREPLY]\x20%s',_0x2571ed,JSON['stringify'](_0xb0c667));})['finally'](function(){_0x2607ab[_0x838f('0x3b')]();});}}}catch(_0x43facf){logger[_0x838f('0x38')]('[%s][AUTOREPLY]\x20%s',_0x2571ed,JSON[_0x838f('0x36')](_0x43facf));_0x2607ab[_0x838f('0x3c')]();}};}; \ 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 242de34..738be02 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 _0x4489=['../../rpc/smsInteraction','../../rpc/mailInteraction','[%s][CLOSE]\x20reason\x20%s','format','Interaction','channel','update','interaction','info','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','error','[%s][CLOSE]\x20%s','finally','stringify','stop','moment','../../../../config/logger','../../rpc/chatInteraction','../../rpc/openchannelInteraction'];(function(_0xa9b067,_0x2047eb){var _0x492156=function(_0x32a056){while(--_0x32a056){_0xa9b067['push'](_0xa9b067['shift']());}};_0x492156(++_0x2047eb);}(_0x4489,0x164));var _0x9448=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4489[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require(_0x9448('0x0'));var logger=require(_0x9448('0x1'))('routing');var rpc={'chatInteraction':require(_0x9448('0x2')),'openchannelInteraction':require(_0x9448('0x3')),'smsInteraction':require(_0x9448('0x4')),'mailInteraction':require(_0x9448('0x5')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require('../../rpc/whatsappInteraction')};exports['consequence']=function(_0x5333bf,_0x541cbe,_0x117d3a,_0x59f0d7){return function(_0x302cae){try{logger['info'](_0x9448('0x6'),_0x5333bf,_0x541cbe[0x0]);var _0x3996a1={'closed':0x1,'closedAt':moment()[_0x9448('0x7')]('YYYY-MM-DD\x20HH:mm:ss'),'closeReason':'system','disposition':_0x541cbe[0x0]};if(rpc[_0x59f0d7['channel']+_0x9448('0x8')]){rpc[_0x59f0d7[_0x9448('0x9')]+_0x9448('0x8')][_0x9448('0xa')](_0x59f0d7[_0x9448('0xb')]['id'],_0x3996a1)['then'](function(_0x389647){logger[_0x9448('0xc')](_0x9448('0xd'),_0x5333bf,_0x59f0d7[_0x9448('0xb')]['id']);})[_0x9448('0xe')](function(_0x3a9c09){logger[_0x9448('0xf')](_0x9448('0x10'),_0x5333bf,JSON['stringify'](_0x3a9c09));})[_0x9448('0x11')](function(){_0x302cae['stop']();});}}catch(_0x323fd2){logger[_0x9448('0xf')]('[%s][CLOSE]\x20%s',_0x5333bf,JSON[_0x9448('0x12')](_0x323fd2));_0x302cae[_0x9448('0x13')]();}};}; \ No newline at end of file +var _0x2d72=['../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','update','interaction','then','error','stringify','finally','stop','[%s][CLOSE]\x20%s','moment','../../../../config/logger','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction'];(function(_0x4a4685,_0xcfca6b){var _0xacb9e2=function(_0x29d07d){while(--_0x29d07d){_0x4a4685['push'](_0x4a4685['shift']());}};_0xacb9e2(++_0xcfca6b);}(_0x2d72,0xa8));var _0x22d7=function(_0x3f2dd9,_0x217c28){_0x3f2dd9=_0x3f2dd9-0x0;var _0x102909=_0x2d72[_0x3f2dd9];return _0x102909;};'use strict';var moment=require(_0x22d7('0x0'));var logger=require(_0x22d7('0x1'))(_0x22d7('0x2'));var rpc={'chatInteraction':require(_0x22d7('0x3')),'openchannelInteraction':require(_0x22d7('0x4')),'smsInteraction':require(_0x22d7('0x5')),'mailInteraction':require(_0x22d7('0x6')),'faxInteraction':require(_0x22d7('0x7')),'whatsappInteraction':require(_0x22d7('0x8'))};exports[_0x22d7('0x9')]=function(_0x17cfba,_0x3f5982,_0x208b5b,_0x100426){return function(_0x52a3e3){try{logger[_0x22d7('0xa')](_0x22d7('0xb'),_0x17cfba,_0x3f5982[0x0]);var _0x492ca8={'closed':0x1,'closedAt':moment()[_0x22d7('0xc')](_0x22d7('0xd')),'closeReason':_0x22d7('0xe'),'disposition':_0x3f5982[0x0]};if(rpc[_0x100426[_0x22d7('0xf')]+'Interaction']){rpc[_0x100426['channel']+_0x22d7('0x10')][_0x22d7('0x11')](_0x100426[_0x22d7('0x12')]['id'],_0x492ca8)[_0x22d7('0x13')](function(_0x2697c7){logger['info']('[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!',_0x17cfba,_0x100426[_0x22d7('0x12')]['id']);})['catch'](function(_0x3b725c){logger[_0x22d7('0x14')]('[%s][CLOSE]\x20%s',_0x17cfba,JSON[_0x22d7('0x15')](_0x3b725c));})[_0x22d7('0x16')](function(){_0x52a3e3[_0x22d7('0x17')]();});}}catch(_0x3c443c){logger[_0x22d7('0x14')](_0x22d7('0x18'),_0x17cfba,JSON[_0x22d7('0x15')](_0x3c443c));_0x52a3e3[_0x22d7('0x17')]();}};}; \ 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 4af8b2d..55885c6 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 _0x6fde=['AccountId','account','InteractionId','isEmpty','Message','create','body','catch','stringify','finally','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','then','dialogflow','result','fulfillment','speech','metadata','error','moment','apiai-promise','md5','./utils','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','info','[%s][DIALOGFLOW]\x20%s','next','format','out','chat','ChatWebsiteId'];(function(_0x2c10d1,_0x9a1e2b){var _0x119b4a=function(_0xcee1a5){while(--_0xcee1a5){_0x2c10d1['push'](_0x2c10d1['shift']());}};_0x119b4a(++_0x9a1e2b);}(_0x6fde,0x8f));var _0xe6fd=function(_0x1dc7f0,_0x50a883){_0x1dc7f0=_0x1dc7f0-0x0;var _0x505485=_0x6fde[_0x1dc7f0];return _0x505485;};'use strict';var _=require('lodash');var moment=require(_0xe6fd('0x0'));var apiai=require(_0xe6fd('0x1'));var md5=require(_0xe6fd('0x2'));var utils=require(_0xe6fd('0x3'));var logger=require(_0xe6fd('0x4'))(_0xe6fd('0x5'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xe6fd('0x6')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xe6fd('0x7')),'faxMessage':require(_0xe6fd('0x8')),'whatsappMessage':require(_0xe6fd('0x9'))};exports[_0xe6fd('0xa')]=function(_0x5836f0,_0x5711e8){return function(_0x2d52e4){try{if(!_[_0xe6fd('0xb')](this[_0xe6fd('0xc')][_0xe6fd('0xd')])){logger[_0xe6fd('0xe')](_0xe6fd('0xf'),_0x5836f0,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x2d52e4[_0xe6fd('0x10')]();}var _0x356b03={'ContactId':this['contact']['id'],'sentAt':moment()[_0xe6fd('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0xe6fd('0x12')};var _0x1e283c=this['channel'];if(_0x1e283c===_0xe6fd('0x13')){_0x356b03[_0xe6fd('0x14')]=this['account']['id'];}else{_0x356b03[_['upperFirst'](_0x1e283c)+_0xe6fd('0x15')]=this[_0xe6fd('0x16')]['id'];}_0x356b03[_['upperFirst'](_0x1e283c)+_0xe6fd('0x17')]=this[_0xe6fd('0xc')]['id'];if(this[_0xe6fd('0xc')]['created']){var _0x34231e=_0x5711e8[0x2];if(!_[_0xe6fd('0x18')](_0x34231e)){_0x356b03['body']=utils['getMustacheRender'](_0x34231e,this);return rpc[_0x1e283c+_0xe6fd('0x19')][_0xe6fd('0x1a')](_0x356b03)['then'](function(_0x53a149){logger[_0xe6fd('0xe')](_0xe6fd('0xf'),_0x5836f0,_0x356b03[_0xe6fd('0x1b')]);})[_0xe6fd('0x1c')](function(_0x59546d){logger['error'](_0xe6fd('0xf'),_0x5836f0,JSON[_0xe6fd('0x1d')](_0x59546d));})[_0xe6fd('0x1e')](function(){logger['info']('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x5836f0);_0x2d52e4[_0xe6fd('0x1f')]();});}else{logger[_0xe6fd('0xe')](_0xe6fd('0x20'),_0x5836f0);_0x2d52e4[_0xe6fd('0x1f')]();}}else{var _0x47c400=this;var _0xc6c12b=apiai(_0x5711e8[0x0],{'language':_0x5711e8[0x1]||'en'});return _0xc6c12b[_0xe6fd('0x21')](this['message']['body'],{'sessionId':md5(this[_0xe6fd('0xc')]['id'])})[_0xe6fd('0x22')](function(_0x1821a2){_0x47c400['body'][_0xe6fd('0x23')]=_0x1821a2;_0x356b03[_0xe6fd('0x1b')]=_0x1821a2[_0xe6fd('0x24')][_0xe6fd('0x25')][_0xe6fd('0x26')];return rpc[_0x1e283c+_0xe6fd('0x19')][_0xe6fd('0x1a')](_0x356b03)[_0xe6fd('0x22')](function(_0x49524a){logger['info'](_0xe6fd('0xf'),_0x5836f0,_0x356b03['body']);if(_0x1821a2[_0xe6fd('0x24')][_0xe6fd('0x27')]['endConversation']){_0x2d52e4[_0xe6fd('0x10')]();}else{_0x2d52e4[_0xe6fd('0x1f')]();}})[_0xe6fd('0x1c')](function(_0x448c15){logger[_0xe6fd('0x28')](_0xe6fd('0xf'),_0x5836f0,JSON[_0xe6fd('0x1d')](_0x448c15));_0x2d52e4[_0xe6fd('0x10')]();});})[_0xe6fd('0x1c')](function(_0x50383d){logger[_0xe6fd('0x28')](_0xe6fd('0xf'),_0x5836f0,_0x50383d['message']);_0x2d52e4[_0xe6fd('0x10')]();});}}catch(_0x550a99){logger['error'](_0xe6fd('0xf'),_0x5836f0,JSON[_0xe6fd('0x1d')](_0x550a99));_0x2d52e4[_0xe6fd('0x1f')]();}};}; \ No newline at end of file +var _0x98ff=['interaction','UserId','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','chat','ChatWebsiteId','upperFirst','AccountId','account','InteractionId','isEmpty','body','getMustacheRender','Message','create','then','[%s][DIALOGFLOW]\x20%s','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','message','dialogflow','result','speech','metadata','catch','error','stringify','lodash','moment','md5','./utils','../../../../config/logger','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil'];(function(_0xb8c98a,_0x5f2d03){var _0xe0087b=function(_0x460591){while(--_0x460591){_0xb8c98a['push'](_0xb8c98a['shift']());}};_0xe0087b(++_0x5f2d03);}(_0x98ff,0x12f));var _0xf98f=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0x98ff[_0x36dfbd];return _0x4ecad9;};'use strict';var _=require(_0xf98f('0x0'));var moment=require(_0xf98f('0x1'));var apiai=require('apiai-promise');var md5=require(_0xf98f('0x2'));var utils=require(_0xf98f('0x3'));var logger=require(_0xf98f('0x4'))('routing');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xf98f('0x5')),'mailMessage':require(_0xf98f('0x6')),'smsMessage':require(_0xf98f('0x7')),'faxMessage':require(_0xf98f('0x8')),'whatsappMessage':require(_0xf98f('0x9'))};exports[_0xf98f('0xa')]=function(_0x13d262,_0x33c2bc){return function(_0x894ade){try{if(!_[_0xf98f('0xb')](this[_0xf98f('0xc')][_0xf98f('0xd')])){logger[_0xf98f('0xe')]('[%s][DIALOGFLOW]\x20%s',_0x13d262,_0xf98f('0xf'));return _0x894ade[_0xf98f('0x10')]();}var _0x430614={'ContactId':this['contact']['id'],'sentAt':moment()[_0xf98f('0x11')](_0xf98f('0x12')),'direction':_0xf98f('0x13')};var _0x59dcd5=this[_0xf98f('0x14')];if(_0x59dcd5===_0xf98f('0x15')){_0x430614[_0xf98f('0x16')]=this['account']['id'];}else{_0x430614[_[_0xf98f('0x17')](_0x59dcd5)+_0xf98f('0x18')]=this[_0xf98f('0x19')]['id'];}_0x430614[_[_0xf98f('0x17')](_0x59dcd5)+_0xf98f('0x1a')]=this[_0xf98f('0xc')]['id'];if(this[_0xf98f('0xc')]['created']){var _0x5ef69a=_0x33c2bc[0x2];if(!_[_0xf98f('0x1b')](_0x5ef69a)){_0x430614[_0xf98f('0x1c')]=utils[_0xf98f('0x1d')](_0x5ef69a,this);return rpc[_0x59dcd5+_0xf98f('0x1e')][_0xf98f('0x1f')](_0x430614)[_0xf98f('0x20')](function(_0x5d919e){logger['info']('[%s][DIALOGFLOW]\x20%s',_0x13d262,_0x430614[_0xf98f('0x1c')]);})['catch'](function(_0x982f52){logger['error'](_0xf98f('0x21'),_0x13d262,JSON['stringify'](_0x982f52));})['finally'](function(){logger[_0xf98f('0xe')](_0xf98f('0x22'),_0x13d262);_0x894ade['stop']();});}else{logger[_0xf98f('0xe')](_0xf98f('0x23'),_0x13d262);_0x894ade[_0xf98f('0x24')]();}}else{var _0x4be3da=this;var _0x57e003=apiai(_0x33c2bc[0x0],{'language':_0x33c2bc[0x1]||'en'});return _0x57e003['textRequest'](this[_0xf98f('0x25')][_0xf98f('0x1c')],{'sessionId':md5(this[_0xf98f('0xc')]['id'])})['then'](function(_0x4dda57){_0x4be3da[_0xf98f('0x1c')][_0xf98f('0x26')]=_0x4dda57;_0x430614['body']=_0x4dda57[_0xf98f('0x27')]['fulfillment'][_0xf98f('0x28')];return rpc[_0x59dcd5+'Message'][_0xf98f('0x1f')](_0x430614)[_0xf98f('0x20')](function(_0x49415c){logger[_0xf98f('0xe')](_0xf98f('0x21'),_0x13d262,_0x430614[_0xf98f('0x1c')]);if(_0x4dda57['result'][_0xf98f('0x29')]['endConversation']){_0x894ade[_0xf98f('0x10')]();}else{_0x894ade[_0xf98f('0x24')]();}})[_0xf98f('0x2a')](function(_0x51bd71){logger[_0xf98f('0x2b')](_0xf98f('0x21'),_0x13d262,JSON[_0xf98f('0x2c')](_0x51bd71));_0x894ade[_0xf98f('0x10')]();});})['catch'](function(_0x5a757f){logger[_0xf98f('0x2b')](_0xf98f('0x21'),_0x13d262,_0x5a757f['message']);_0x894ade[_0xf98f('0x10')]();});}}catch(_0x407936){logger[_0xf98f('0x2b')](_0xf98f('0x21'),_0x13d262,JSON[_0xf98f('0x2c')](_0x407936));_0x894ade[_0xf98f('0x24')]();}};}; \ 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 a16de6d..ef6f5d4 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 _0x1ae5=['message','join','stop','condition','priorityFalse','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','stringify','validate','lodash','html-to-text','./utils','../../../../config/logger','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','consequence','fromString','replace','length','error','[%s][GOTOIF]\x20%s','map'];(function(_0x819464,_0x46fc91){var _0x49dcc0=function(_0x36b2b2){while(--_0x36b2b2){_0x819464['push'](_0x819464['shift']());}};_0x49dcc0(++_0x46fc91);}(_0x1ae5,0x12f));var _0x51ae=function(_0x22c3ce,_0x55e6c0){_0x22c3ce=_0x22c3ce-0x0;var _0x459157=_0x1ae5[_0x22c3ce];return _0x459157;};'use strict';var schema=require(_0x51ae('0x0'));var _=require(_0x51ae('0x1'));var htmlToText=require(_0x51ae('0x2'));var utils=require(_0x51ae('0x3'));var logger=require(_0x51ae('0x4'))('routing');var gotoif=schema({'condition':{'type':_0x51ae('0x5'),'required':!![],'message':_0x51ae('0x6')},'priorityTrue':{'type':_0x51ae('0x7'),'message':_0x51ae('0x8')},'priorityFalse':{'type':_0x51ae('0x7'),'message':'priority\x20false\x20is\x20a\x20number'}});exports[_0x51ae('0x9')]=function(_0x129756,_0x384f14){return function(_0x38c3a3){try{var _0x3da6bd={'condition':htmlToText[_0x51ae('0xa')](utils['getMustacheRender'](_0x384f14[0x0],this),{'wordwrap':![]})[_0x51ae('0xb')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x384f14[0x1],'priorityFalse':_0x384f14[0x2]};var _0x4e773a=gotoif[_0x51ae('0x0')](_0x3da6bd,{'typecast':!![]});if(_0x4e773a[_0x51ae('0xc')]){logger[_0x51ae('0xd')](_0x51ae('0xe'),_0x129756,_[_0x51ae('0xf')](_0x4e773a,_0x51ae('0x10'))[_0x51ae('0x11')](',\x20'));_0x38c3a3[_0x51ae('0x12')]();}else{try{var _0x20088b=eval('('+_0x3da6bd[_0x51ae('0x13')]+')');var _0x3e5ad5=_0x20088b?_0x3da6bd['priorityTrue']:_0x3da6bd[_0x51ae('0x14')];logger['info'](_0x51ae('0x15'),_0x129756,_0x3da6bd['condition'],_0x20088b,_0x3e5ad5||_0x51ae('0x16'));if(_0x3e5ad5){var _0x5f53ce=_[_0x51ae('0x17')](_0x38c3a3[_0x51ae('0x18')](),{'p':_0x3e5ad5});if(_0x5f53ce>=0x0){logger['info'](_0x51ae('0x19'),_0x129756,_0x3e5ad5||_0x51ae('0x16'),_0x5f53ce);_0x38c3a3[_0x51ae('0x16')](_0x5f53ce);}else{logger['info'](_0x51ae('0x1a'),_0x129756,_0x3e5ad5||_0x51ae('0x16'));_0x38c3a3[_0x51ae('0x12')]();}}else{_0x38c3a3['next']();}}catch(_0x5e3bcb){logger[_0x51ae('0xd')](_0x51ae('0x1b'),_0x129756,_0x5e3bcb[_0x51ae('0x10')]);_0x38c3a3['stop']();}}}catch(_0x32257c){logger[_0x51ae('0xd')](_0x51ae('0xe'),_0x129756,JSON[_0x51ae('0x1c')](_0x32257c));_0x38c3a3['stop']();}};}; \ No newline at end of file +var _0x3e29=['[%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','./utils','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','consequence','fromString','getMustacheRender','replace','length','[%s][GOTOIF]\x20%s','map','message','condition','priorityTrue','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next'];(function(_0x16e3c4,_0x4a3dfc){var _0x1c2362=function(_0x547fed){while(--_0x547fed){_0x16e3c4['push'](_0x16e3c4['shift']());}};_0x1c2362(++_0x4a3dfc);}(_0x3e29,0x1eb));var _0x93e2=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x3e29[_0x17d9e3];return _0x14192d;};'use strict';var schema=require(_0x93e2('0x0'));var _=require(_0x93e2('0x1'));var htmlToText=require('html-to-text');var utils=require(_0x93e2('0x2'));var logger=require('../../../../config/logger')('routing');var gotoif=schema({'condition':{'type':_0x93e2('0x3'),'required':!![],'message':_0x93e2('0x4')},'priorityTrue':{'type':_0x93e2('0x5'),'message':_0x93e2('0x6')},'priorityFalse':{'type':_0x93e2('0x5'),'message':_0x93e2('0x7')}});exports[_0x93e2('0x8')]=function(_0x1884f7,_0x66513){return function(_0x2b0d78){try{var _0x19e1bd={'condition':htmlToText[_0x93e2('0x9')](utils[_0x93e2('0xa')](_0x66513[0x0],this),{'wordwrap':![]})[_0x93e2('0xb')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x66513[0x1],'priorityFalse':_0x66513[0x2]};var _0x532a1c=gotoif[_0x93e2('0x0')](_0x19e1bd,{'typecast':!![]});if(_0x532a1c[_0x93e2('0xc')]){logger['error'](_0x93e2('0xd'),_0x1884f7,_[_0x93e2('0xe')](_0x532a1c,_0x93e2('0xf'))['join'](',\x20'));_0x2b0d78['stop']();}else{try{var _0xa1e50c=eval('('+_0x19e1bd[_0x93e2('0x10')]+')');var _0x23c931=_0xa1e50c?_0x19e1bd[_0x93e2('0x11')]:_0x19e1bd[_0x93e2('0x12')];logger[_0x93e2('0x13')](_0x93e2('0x14'),_0x1884f7,_0x19e1bd[_0x93e2('0x10')],_0xa1e50c,_0x23c931||_0x93e2('0x15'));if(_0x23c931){var _0x308a2d=_['findIndex'](_0x2b0d78['rules'](),{'p':_0x23c931});if(_0x308a2d>=0x0){logger[_0x93e2('0x13')](_0x93e2('0x16'),_0x1884f7,_0x23c931||_0x93e2('0x15'),_0x308a2d);_0x2b0d78[_0x93e2('0x15')](_0x308a2d);}else{logger[_0x93e2('0x13')](_0x93e2('0x17'),_0x1884f7,_0x23c931||_0x93e2('0x15'));_0x2b0d78[_0x93e2('0x18')]();}}else{_0x2b0d78[_0x93e2('0x15')]();}}catch(_0x287c79){logger['error'](_0x93e2('0x19'),_0x1884f7,_0x287c79[_0x93e2('0xf')]);_0x2b0d78[_0x93e2('0x18')]();}}}catch(_0x51ae76){logger['error']('[%s][GOTOIF]\x20%s',_0x1884f7,JSON[_0x93e2('0x1a')](_0x51ae76));_0x2b0d78[_0x93e2('0x18')]();}};}; \ 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 2965f78..434924a 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 _0xb27c=['routing','number','consequence','error','map','message','join','stop','info','priority','findIndex','next','[%s][GOTOP]\x20%s','stringify','validate','../../../../config/logger'];(function(_0x536f9f,_0x50116a){var _0x2012bc=function(_0x18256a){while(--_0x18256a){_0x536f9f['push'](_0x536f9f['shift']());}};_0x2012bc(++_0x50116a);}(_0xb27c,0x18e));var _0xcb27=function(_0x4b6830,_0x2bf6fb){_0x4b6830=_0x4b6830-0x0;var _0x239e4a=_0xb27c[_0x4b6830];return _0x239e4a;};'use strict';var schema=require(_0xcb27('0x0'));var _=require('lodash');var logger=require(_0xcb27('0x1'))(_0xcb27('0x2'));var gotop=schema({'priority':{'type':_0xcb27('0x3'),'required':!![],'message':'priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'}});exports[_0xcb27('0x4')]=function(_0x22aeda,_0x1ee3a4){return function(_0xbecefd){try{var _0x1b38da={'priority':_0x1ee3a4[0x0]};var _0x3acb21=gotop[_0xcb27('0x0')](_0x1b38da,{'typecast':!![]});if(_0x3acb21['length']){logger[_0xcb27('0x5')]('[%s][GOTOP]\x20%s',_0x22aeda,_[_0xcb27('0x6')](_0x3acb21,_0xcb27('0x7'))[_0xcb27('0x8')](',\x20'));_0xbecefd[_0xcb27('0x9')]();}else{logger[_0xcb27('0xa')]('[%s][GOTOP]\x20priority\x20%s',_0x22aeda,_0x1b38da[_0xcb27('0xb')]);if(_0x1b38da[_0xcb27('0xb')]){var _0x4b8d03=_[_0xcb27('0xc')](_0xbecefd['rules'](),{'p':_0x1b38da['priority']});if(_0x4b8d03>=0x0){logger[_0xcb27('0xa')]('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x22aeda,_0x1b38da[_0xcb27('0xb')]||_0xcb27('0xd'),_0x4b8d03);_0xbecefd['next'](_0x4b8d03);}else{logger[_0xcb27('0xa')]('[%s][GOTOP]\x20priority\x20%s\x20not\x20found',_0x22aeda,_0x1b38da['priority']||'next');_0xbecefd[_0xcb27('0x9')]();}}else{_0xbecefd['next']();}}}catch(_0x4fcc73){logger[_0xcb27('0x5')](_0xcb27('0xe'),_0x22aeda,JSON[_0xcb27('0xf')](_0x4fcc73));_0xbecefd[_0xcb27('0x9')]();}};}; \ No newline at end of file +var _0x8539=['number','consequence','length','error','[%s][GOTOP]\x20%s','message','join','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','validate','lodash','routing'];(function(_0x4e9274,_0x49576e){var _0x8b474c=function(_0x204cca){while(--_0x204cca){_0x4e9274['push'](_0x4e9274['shift']());}};_0x8b474c(++_0x49576e);}(_0x8539,0x8d));var _0x9853=function(_0x5366c2,_0x5364f6){_0x5366c2=_0x5366c2-0x0;var _0x4e16f8=_0x8539[_0x5366c2];return _0x4e16f8;};'use strict';var schema=require(_0x9853('0x0'));var _=require(_0x9853('0x1'));var logger=require('../../../../config/logger')(_0x9853('0x2'));var gotop=schema({'priority':{'type':_0x9853('0x3'),'required':!![],'message':'priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'}});exports[_0x9853('0x4')]=function(_0x24c2b6,_0x12e643){return function(_0x24f14c){try{var _0x484f0c={'priority':_0x12e643[0x0]};var _0x49fd07=gotop[_0x9853('0x0')](_0x484f0c,{'typecast':!![]});if(_0x49fd07[_0x9853('0x5')]){logger[_0x9853('0x6')](_0x9853('0x7'),_0x24c2b6,_['map'](_0x49fd07,_0x9853('0x8'))[_0x9853('0x9')](',\x20'));_0x24f14c[_0x9853('0xa')]();}else{logger[_0x9853('0xb')](_0x9853('0xc'),_0x24c2b6,_0x484f0c[_0x9853('0xd')]);if(_0x484f0c[_0x9853('0xd')]){var _0x206550=_[_0x9853('0xe')](_0x24f14c['rules'](),{'p':_0x484f0c[_0x9853('0xd')]});if(_0x206550>=0x0){logger['info'](_0x9853('0xf'),_0x24c2b6,_0x484f0c['priority']||_0x9853('0x10'),_0x206550);_0x24f14c['next'](_0x206550);}else{logger[_0x9853('0xb')](_0x9853('0x11'),_0x24c2b6,_0x484f0c[_0x9853('0xd')]||_0x9853('0x10'));_0x24f14c['stop']();}}else{_0x24f14c['next']();}}}catch(_0xc564f3){logger[_0x9853('0x6')](_0x9853('0x7'),_0x24c2b6,JSON['stringify'](_0xc564f3));_0x24f14c['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/message.js b/server/services/routing/server/applications/message.js index 63ca066..45a6a40 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 _0xf288=['next','catch','error','stringify','stop','lodash','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','getMustacheRender','contact','chat','ChatWebsiteId','account','upperFirst','channel','AccountId','Message','create','info','[%s][MESSAGE]\x20%s'];(function(_0x311909,_0x414bf7){var _0x8d3163=function(_0x226f55){while(--_0x226f55){_0x311909['push'](_0x311909['shift']());}};_0x8d3163(++_0x414bf7);}(_0xf288,0x163));var _0x8f28=function(_0x16cf9e,_0x3d3cfd){_0x16cf9e=_0x16cf9e-0x0;var _0x56aefd=_0xf288[_0x16cf9e];return _0x56aefd;};'use strict';var _=require(_0x8f28('0x0'));var utils=require(_0x8f28('0x1'));var logger=require(_0x8f28('0x2'))(_0x8f28('0x3'));var rpc={'chatMessage':require(_0x8f28('0x4')),'openchannelMessage':require(_0x8f28('0x5')),'mailMessage':require(_0x8f28('0x6')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x8f28('0x7')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports['consequence']=function(_0x20d63c,_0xe2086e){return function(_0x1ff991){try{var _0x55a529={'body':utils[_0x8f28('0x8')](_0xe2086e[0x0],this),'ContactId':this[_0x8f28('0x9')]['id']};if(this['channel']===_0x8f28('0xa')){_0x55a529[_0x8f28('0xb')]=this[_0x8f28('0xc')]['id'];}else{_0x55a529[_[_0x8f28('0xd')](this[_0x8f28('0xe')])+_0x8f28('0xf')]=this[_0x8f28('0xc')]['id'];}_0x55a529[_[_0x8f28('0xd')](this[_0x8f28('0xe')])+'InteractionId']=this['interaction']['id'];if(rpc[this[_0x8f28('0xe')]+_0x8f28('0x10')]){return rpc[this[_0x8f28('0xe')]+_0x8f28('0x10')][_0x8f28('0x11')](_0x55a529)['then'](function(_0x4ca222){logger[_0x8f28('0x12')](_0x8f28('0x13'),_0x20d63c,_0x55a529['body']);_0x1ff991[_0x8f28('0x14')]();})[_0x8f28('0x15')](function(_0x47242b){logger[_0x8f28('0x16')](_0x8f28('0x13'),_0x20d63c,JSON[_0x8f28('0x17')](_0x47242b));_0x1ff991[_0x8f28('0x18')]();});}}catch(_0x39ea6d){logger[_0x8f28('0x16')](_0x8f28('0x13'),_0x20d63c,JSON[_0x8f28('0x17')](_0x39ea6d));_0x1ff991[_0x8f28('0x18')]();}};}; \ No newline at end of file +var _0xa8a8=['chat','upperFirst','channel','AccountId','InteractionId','interaction','Message','create','then','info','[%s][MESSAGE]\x20%s','body','next','catch','error','stringify','stop','lodash','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','contact'];(function(_0x660c8c,_0x212774){var _0x10a0e4=function(_0x5d44a0){while(--_0x5d44a0){_0x660c8c['push'](_0x660c8c['shift']());}};_0x10a0e4(++_0x212774);}(_0xa8a8,0x1c1));var _0x8a8a=function(_0x2c318d,_0x5a782e){_0x2c318d=_0x2c318d-0x0;var _0x952bda=_0xa8a8[_0x2c318d];return _0x952bda;};'use strict';var _=require(_0x8a8a('0x0'));var utils=require('./utils');var logger=require(_0x8a8a('0x1'))(_0x8a8a('0x2'));var rpc={'chatMessage':require(_0x8a8a('0x3')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x8a8a('0x4')),'smsMessage':require(_0x8a8a('0x5')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x8a8a('0x6'))};exports[_0x8a8a('0x7')]=function(_0x5c4421,_0x42a281){return function(_0x2d030b){try{var _0x25b9ac={'body':utils[_0x8a8a('0x8')](_0x42a281[0x0],this),'ContactId':this[_0x8a8a('0x9')]['id']};if(this['channel']===_0x8a8a('0xa')){_0x25b9ac['ChatWebsiteId']=this['account']['id'];}else{_0x25b9ac[_[_0x8a8a('0xb')](this[_0x8a8a('0xc')])+_0x8a8a('0xd')]=this['account']['id'];}_0x25b9ac[_[_0x8a8a('0xb')](this[_0x8a8a('0xc')])+_0x8a8a('0xe')]=this[_0x8a8a('0xf')]['id'];if(rpc[this[_0x8a8a('0xc')]+_0x8a8a('0x10')]){return rpc[this[_0x8a8a('0xc')]+'Message'][_0x8a8a('0x11')](_0x25b9ac)[_0x8a8a('0x12')](function(_0x537691){logger[_0x8a8a('0x13')](_0x8a8a('0x14'),_0x5c4421,_0x25b9ac[_0x8a8a('0x15')]);_0x2d030b[_0x8a8a('0x16')]();})[_0x8a8a('0x17')](function(_0x35dce6){logger[_0x8a8a('0x18')](_0x8a8a('0x14'),_0x5c4421,JSON[_0x8a8a('0x19')](_0x35dce6));_0x2d030b[_0x8a8a('0x1a')]();});}}catch(_0x5f3ebc){logger[_0x8a8a('0x18')](_0x8a8a('0x14'),_0x5c4421,JSON['stringify'](_0x5f3ebc));_0x2d030b['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/noop.js b/server/services/routing/server/applications/noop.js index 31d035d..2dd0082 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 _0x5b14=['stringify','stop','./utils','../../../../config/logger','routing','consequence','getMustacheRender','next','error','[%s][NOOP]\x20%s'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x5b14,0xfc));var _0x45b1=function(_0x43c8b8,_0x5e8934){_0x43c8b8=_0x43c8b8-0x0;var _0x413be3=_0x5b14[_0x43c8b8];return _0x413be3;};'use strict';var utils=require(_0x45b1('0x0'));var logger=require(_0x45b1('0x1'))(_0x45b1('0x2'));exports[_0x45b1('0x3')]=function(_0x345189,_0x28237f){return function(_0x2e6eeb){try{logger['info']('[%s][NOOP]\x20%s',_0x345189,utils[_0x45b1('0x4')](_0x28237f[0x0],this));_0x2e6eeb[_0x45b1('0x5')]();}catch(_0x13382f){logger[_0x45b1('0x6')](_0x45b1('0x7'),_0x345189,JSON[_0x45b1('0x8')](_0x13382f));_0x2e6eeb[_0x45b1('0x9')]();}};}; \ No newline at end of file +var _0x70df=['next','error','stringify','./utils','consequence','[%s][NOOP]\x20%s'];(function(_0x52341a,_0x4b6a81){var _0xa1bfdf=function(_0xcc77dc){while(--_0xcc77dc){_0x52341a['push'](_0x52341a['shift']());}};_0xa1bfdf(++_0x4b6a81);}(_0x70df,0x1c5));var _0xf70d=function(_0x12c07d,_0x381298){_0x12c07d=_0x12c07d-0x0;var _0x19d10c=_0x70df[_0x12c07d];return _0x19d10c;};'use strict';var utils=require(_0xf70d('0x0'));var logger=require('../../../../config/logger')('routing');exports[_0xf70d('0x1')]=function(_0x5d47e8,_0x16d4c6){return function(_0x35ec98){try{logger['info'](_0xf70d('0x2'),_0x5d47e8,utils['getMustacheRender'](_0x16d4c6[0x0],this));_0x35ec98[_0xf70d('0x3')]();}catch(_0x19d381){logger[_0xf70d('0x4')](_0xf70d('0x2'),_0x5d47e8,JSON[_0xf70d('0x5')](_0x19d381));_0x35ec98['stop']();}};}; \ 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 e7e0dfc..cb351f7 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 _0x9957=['seq-queue','ioredis','../../../../config/environment','../../../../config/logger','routing','redis','defaults','localhost','socket.io-emitter','account','queue','joinAt','emit','clone','queue_id','pick','format','%sQueuesWaitingInteractions','%s:queue:%s','%s_queue_waiting_interaction:%s','save','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','string','timeout\x20is\x20a\x20number','from','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','QueueId','InteractionId','interaction','MessageId','message','chat','WebsiteId','info','name','QueueReport','create','catch','error','waiting','accepted','body','[%s][END:QUEUE][NAME:%s]','update','update\x20queue\x20report','toLowerCase','length','[%s][QUEUE]\x20%s','join','stop','find','Queues','timeout','atimeout','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','rules','[%s][QUEUE]\x20APPLICATION\x20END','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','validate','lodash','util'];(function(_0x25d3cf,_0x2bc676){var _0x574a12=function(_0x25325f){while(--_0x25325f){_0x25d3cf['push'](_0x25d3cf['shift']());}};_0x574a12(++_0x2bc676);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var schema=require(_0x7995('0x0'));var _=require(_0x7995('0x1'));var util=require(_0x7995('0x2'));var seqqueue=require(_0x7995('0x3'));var moment=require('moment');var Redis=require(_0x7995('0x4'));var config=require(_0x7995('0x5'));var logger=require(_0x7995('0x6'))(_0x7995('0x7'));var strategy=require('./strategy');config[_0x7995('0x8')]=_[_0x7995('0x9')](config[_0x7995('0x8')],{'host':_0x7995('0xa'),'port':0x18eb});var io=require(_0x7995('0xb'))(new Redis(config[_0x7995('0x8')]));var attributes=['id','queue_id',_0x7995('0xc'),_0x7995('0xd'),'from',_0x7995('0xe')];function emit(_0x3116fb,_0x18c8a3,_0x35b5fe){io['to'](_0x3116fb)[_0x7995('0xf')](_0x18c8a3,_0x35b5fe);}function emitChannelQueueInteraction(_0x1e400a,_0x341672,_0x524f7b,_0x245143,_0x41c652,_0x581f22,_0xb0c872,_0x2cb37a){var _0x19a27e=_[_0x7995('0x10')](_0x524f7b);_0x19a27e[_0x7995('0x11')]=_0x2cb37a;_0x19a27e[_0x7995('0xd')]=_0x341672;_0x19a27e[_0x7995('0xc')]=_0x245143;_0x19a27e['id']=_0x41c652;if(_0x581f22){_0xb0c872[util['format']('%sQueuesWaitingInteractions',_0x1e400a)][_0x41c652]=_[_0x7995('0x12')](_0x19a27e,attributes);}else{delete _0xb0c872[util[_0x7995('0x13')](_0x7995('0x14'),_0x1e400a)][_0x41c652];}emit(util[_0x7995('0x13')](_0x7995('0x15'),_0x1e400a,_0x341672),util[_0x7995('0x13')](_0x7995('0x16'),_0x1e400a,_0x581f22?_0x7995('0x17'):'remove'),_[_0x7995('0x12')](_0x19a27e,attributes));}var rpc={'openchannelQueueReport':require('../../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x7995('0x18')),'chatQueueReport':require(_0x7995('0x19')),'smsQueueReport':require(_0x7995('0x1a')),'faxQueueReport':require(_0x7995('0x1b')),'whatsappQueueReport':require(_0x7995('0x1c'))};var queue=schema({'name':{'type':_0x7995('0x1d'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':'number','message':_0x7995('0x1e')}});function startRouting(_0x5e6f90,_0x555f74,_0x3ec178,_0x3d463e){if(_0x5e6f90&&_0x555f74&&_0x3ec178){_0x555f74['waiting']+=0x1;var _0x3a9b54={'uniqueid':_0x5e6f90,'from':_0x3ec178['body']?_0x3ec178['body'][_0x7995('0x1f')]:'','joinAt':moment()[_0x7995('0x13')](_0x7995('0x20')),'ContactId':_0x3ec178[_0x7995('0x21')]?_0x3ec178[_0x7995('0x21')]['id']:null,'ListId':_0x3ec178[_0x7995('0x22')]?_0x3ec178['list']['id']:null};_0x3a9b54[_[_0x7995('0x23')](_0x3ec178[_0x7995('0x24')])+_0x7995('0x25')]=_0x555f74['id']||null;_0x3a9b54[_[_0x7995('0x23')](_0x3ec178[_0x7995('0x24')])+_0x7995('0x26')]=_0x3ec178[_0x7995('0x27')]?_0x3ec178[_0x7995('0x27')]['id']:null;_0x3a9b54[_['upperFirst'](_0x3ec178[_0x7995('0x24')])+_0x7995('0x28')]=_0x3ec178[_0x7995('0x29')]?_0x3ec178[_0x7995('0x29')]['id']:null;_0x3a9b54[_[_0x7995('0x23')](_0x3ec178[_0x7995('0x24')])+(_0x3ec178['channel']!==_0x7995('0x2a')?'AccountId':_0x7995('0x2b'))]=_0x3ec178[_0x7995('0xc')]?_0x3ec178[_0x7995('0xc')]['id']:null;logger[_0x7995('0x2c')](util[_0x7995('0x13')]('[%s][START:QUEUE][NAME:%s]',_0x5e6f90,_0x555f74[_0x7995('0x2d')]));emitChannelQueueInteraction(_0x3ec178['channel'],_0x555f74[_0x7995('0x2d')],_0x3a9b54,_0x3ec178[_0x7995('0xc')][_0x7995('0x2d')],_0x3ec178['message']['id'],!![],_0x3d463e,_0x555f74['id']);if(rpc[_0x3ec178['channel']+'QueueReport']){return rpc[_0x3ec178[_0x7995('0x24')]+_0x7995('0x2e')][_0x7995('0x2f')](_0x3a9b54)[_0x7995('0x30')](function(_0x2e3493){logger[_0x7995('0x31')]('create\x20queue\x20report');});}}}function stopRouting(_0x481c74,_0xfa8f15,_0x5524af,_0x553671){if(_0x481c74&&_0xfa8f15){_0xfa8f15[_0x7995('0x32')]-=0x1;var _0x29fac5={'leaveAt':moment()[_0x7995('0x13')](_0x7995('0x20')),'acceptAt':moment()['format'](_0x7995('0x20')),'reason':_0x7995('0x33')};logger['info'](util['format']('[%s][STOP:QUEUE][NAME:%s]',_0x481c74,_0xfa8f15[_0x7995('0x2d')]));emitChannelQueueInteraction(_0x5524af[_0x7995('0x24')],_0xfa8f15['name'],_0x5524af[_0x7995('0x34')],_0x5524af['account'][_0x7995('0x2d')],_0x5524af[_0x7995('0x29')]['id'],![],_0x553671,_0xfa8f15['id']);if(rpc[_0x5524af[_0x7995('0x24')]+'QueueReport']){return rpc[_0x5524af['channel']+_0x7995('0x2e')]['update'](_0x481c74,_0x29fac5)['catch'](function(_0x3e99cd){logger[_0x7995('0x31')]('update\x20queue\x20report');});}}}function endRouting(_0x1baa15,_0x1922b4,_0x2b772f,_0x18667c){if(_0x1baa15&&_0x1922b4){_0x1922b4[_0x7995('0x32')]-=0x1;var _0x53002a={'leaveAt':moment()[_0x7995('0x13')](_0x7995('0x20')),'exitAt':moment()[_0x7995('0x13')](_0x7995('0x20')),'reason':'timeout'};logger[_0x7995('0x2c')](util[_0x7995('0x13')](_0x7995('0x35'),_0x1baa15,_0x1922b4[_0x7995('0x2d')]));emitChannelQueueInteraction(_0x2b772f[_0x7995('0x24')],_0x1922b4[_0x7995('0x2d')],_0x2b772f['body'],_0x2b772f[_0x7995('0xc')][_0x7995('0x2d')],_0x2b772f[_0x7995('0x29')]['id'],![],_0x18667c);if(rpc[_0x2b772f[_0x7995('0x24')]+_0x7995('0x2e')]){return rpc[_0x2b772f[_0x7995('0x24')]+_0x7995('0x2e')][_0x7995('0x36')](_0x1baa15,_0x53002a)[_0x7995('0x30')](function(_0x447981){logger[_0x7995('0x31')](_0x7995('0x37'));});}}}function handleFindQueue(_0x7b4e67){return function(_0x53cda2){return _0x53cda2['name'][_0x7995('0x38')]()===_0x7b4e67[_0x7995('0x38')]();};}exports['consequence']=function(_0x4b0855,_0x3f8522,_0x4a9fef,_0x504a33){return function(_0x23da6b){try{var _0x36e28b={'name':_0x3f8522[0x0],'timeout':_0x3f8522[0x1]};var _0x35c8ff=queue['validate'](_0x36e28b,{'typecast':!![]});if(_0x35c8ff[_0x7995('0x39')]){logger['error'](_0x7995('0x3a'),_0x4b0855,_['map'](_0x35c8ff,'message')[_0x7995('0x3b')](',\x20'));_0x23da6b[_0x7995('0x3c')]();}else{var _0xc04e5=_[_0x7995('0x3d')](_0x4a9fef[_0x504a33['channel']+_0x7995('0x3e')],handleFindQueue(_0x36e28b[_0x7995('0x2d')]));if(_0xc04e5){startRouting(_0x4b0855,_0xc04e5,_0x504a33,_0x4a9fef);var _0x31b347=(_0xc04e5[_0x7995('0x3f')]||0xa)*0x3e8;var _0x4e09b7=(_0x36e28b['timeout']||0x14)*0x3e8;var _0x1c37c6,_0x55791b;if(_0x31b347>_0x4e09b7){_0x4e09b7=_0x31b347;}var _0x23c41d=seqqueue['createQueue'](_0x31b347);_0x23c41d['id']=_0x4b0855;_0x23c41d[_0x7995('0x40')]=_0x31b347;_0x23c41d['qtimeout']=_0x4e09b7;_0x23c41d[_0x7995('0x24')]=_0x504a33[_0x7995('0x24')];_0x4a9fef['rules'][_0x4b0855]['on'](_0x7995('0x41'),function(){logger[_0x7995('0x2c')](_0x7995('0x42'),_0x4b0855);stopRouting(_0x4b0855,_0xc04e5,_0x504a33,_0x4a9fef);clearTimeout(_0x1c37c6);_0x1c37c6=undefined;_0x23c41d[_0x7995('0x43')](!![]);if(_0x4a9fef['rules'][_0x4b0855]){delete _0x4a9fef[_0x7995('0x44')][_0x4b0855];}_0x23da6b[_0x7995('0x3c')]();});_0x4a9fef[_0x7995('0x44')][_0x4b0855]['on']('complete',function(){if(_0x4a9fef[_0x7995('0x44')][_0x4b0855]){delete _0x4a9fef[_0x7995('0x44')][_0x4b0855];}});_0x1c37c6=setTimeout(function(){logger[_0x7995('0x2c')](_0x7995('0x45'),_0x4b0855);endRouting(_0x4b0855,_0xc04e5,_0x504a33,_0x4a9fef);clearTimeout(_0x1c37c6);_0x23c41d[_0x7995('0x43')](!![]);_0x23da6b['next']();},_0x4e09b7);switch(_0xc04e5[_0x7995('0x46')]){case _0x7995('0x47'):strategy['rrmemory'](_0x23c41d,_0xc04e5,_0x4a9fef,_0x504a33);break;default:strategy[_0x7995('0x48')](_0x23c41d,_0xc04e5,_0x4a9fef,_0x504a33);}}else{logger['error'](_0x7995('0x49'),_0x4b0855,_0x36e28b[_0x7995('0x2d')]);_0x23da6b[_0x7995('0x3c')]();}}}catch(_0x30e220){console[_0x7995('0x4a')](_0x30e220);logger[_0x7995('0x31')](_0x7995('0x3a'),_0x4b0855,_0x30e220['stack']);_0x23da6b[_0x7995('0x3c')]();}};}; \ No newline at end of file +var _0x3e74=['beepall','log','stack','validate','util','seq-queue','moment','../../../../config/logger','./strategy','redis','defaults','localhost','queue_id','account','queue','from','emit','clone','format','%sQueuesWaitingInteractions','pick','%s:queue:%s','%s_queue_waiting_interaction:%s','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../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','MessageId','message','channel','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','error','create\x20queue\x20report','accepted','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','update','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','map','stop','find','atimeout','qtimeout','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','rules','complete','next','strategy','rrmemory'];(function(_0x5783f4,_0x4a9e0a){var _0x28e380=function(_0x1ffc49){while(--_0x1ffc49){_0x5783f4['push'](_0x5783f4['shift']());}};_0x28e380(++_0x4a9e0a);}(_0x3e74,0x175));var _0x43e7=function(_0x4932b8,_0x4a2136){_0x4932b8=_0x4932b8-0x0;var _0x53bdee=_0x3e74[_0x4932b8];return _0x53bdee;};'use strict';var schema=require(_0x43e7('0x0'));var _=require('lodash');var util=require(_0x43e7('0x1'));var seqqueue=require(_0x43e7('0x2'));var moment=require(_0x43e7('0x3'));var Redis=require('ioredis');var config=require('../../../../config/environment');var logger=require(_0x43e7('0x4'))('routing');var strategy=require(_0x43e7('0x5'));config[_0x43e7('0x6')]=_[_0x43e7('0x7')](config[_0x43e7('0x6')],{'host':_0x43e7('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x43e7('0x6')]));var attributes=['id',_0x43e7('0x9'),_0x43e7('0xa'),_0x43e7('0xb'),_0x43e7('0xc'),'joinAt'];function emit(_0x212c6c,_0x554d44,_0x54948c){io['to'](_0x212c6c)[_0x43e7('0xd')](_0x554d44,_0x54948c);}function emitChannelQueueInteraction(_0x4139c9,_0x5c34f4,_0x2803d9,_0x513707,_0xf7c520,_0x37302c,_0x4ebc8e,_0x3eb206){var _0xc960ea=_[_0x43e7('0xe')](_0x2803d9);_0xc960ea[_0x43e7('0x9')]=_0x3eb206;_0xc960ea['queue']=_0x5c34f4;_0xc960ea['account']=_0x513707;_0xc960ea['id']=_0xf7c520;if(_0x37302c){_0x4ebc8e[util[_0x43e7('0xf')](_0x43e7('0x10'),_0x4139c9)][_0xf7c520]=_[_0x43e7('0x11')](_0xc960ea,attributes);}else{delete _0x4ebc8e[util['format']('%sQueuesWaitingInteractions',_0x4139c9)][_0xf7c520];}emit(util[_0x43e7('0xf')](_0x43e7('0x12'),_0x4139c9,_0x5c34f4),util[_0x43e7('0xf')](_0x43e7('0x13'),_0x4139c9,_0x37302c?'save':'remove'),_[_0x43e7('0x11')](_0xc960ea,attributes));}var rpc={'openchannelQueueReport':require(_0x43e7('0x14')),'mailQueueReport':require(_0x43e7('0x15')),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require('../../rpc/smsQueueReport'),'faxQueueReport':require(_0x43e7('0x16')),'whatsappQueueReport':require(_0x43e7('0x17'))};var queue=schema({'name':{'type':_0x43e7('0x18'),'required':!![],'message':_0x43e7('0x19')},'timeout':{'type':_0x43e7('0x1a'),'message':_0x43e7('0x1b')}});function startRouting(_0x619236,_0x1441ef,_0x2377a3,_0xab63cf){if(_0x619236&&_0x1441ef&&_0x2377a3){_0x1441ef[_0x43e7('0x1c')]+=0x1;var _0x177ee1={'uniqueid':_0x619236,'from':_0x2377a3['body']?_0x2377a3[_0x43e7('0x1d')][_0x43e7('0xc')]:'','joinAt':moment()['format'](_0x43e7('0x1e')),'ContactId':_0x2377a3[_0x43e7('0x1f')]?_0x2377a3[_0x43e7('0x1f')]['id']:null,'ListId':_0x2377a3[_0x43e7('0x20')]?_0x2377a3[_0x43e7('0x20')]['id']:null};_0x177ee1[_[_0x43e7('0x21')](_0x2377a3['channel'])+_0x43e7('0x22')]=_0x1441ef['id']||null;_0x177ee1[_['upperFirst'](_0x2377a3['channel'])+_0x43e7('0x23')]=_0x2377a3[_0x43e7('0x24')]?_0x2377a3['interaction']['id']:null;_0x177ee1[_[_0x43e7('0x21')](_0x2377a3['channel'])+_0x43e7('0x25')]=_0x2377a3['message']?_0x2377a3[_0x43e7('0x26')]['id']:null;_0x177ee1[_[_0x43e7('0x21')](_0x2377a3[_0x43e7('0x27')])+(_0x2377a3[_0x43e7('0x27')]!=='chat'?'AccountId':_0x43e7('0x28'))]=_0x2377a3['account']?_0x2377a3[_0x43e7('0xa')]['id']:null;logger[_0x43e7('0x29')](util[_0x43e7('0xf')](_0x43e7('0x2a'),_0x619236,_0x1441ef['name']));emitChannelQueueInteraction(_0x2377a3[_0x43e7('0x27')],_0x1441ef[_0x43e7('0x2b')],_0x177ee1,_0x2377a3[_0x43e7('0xa')][_0x43e7('0x2b')],_0x2377a3[_0x43e7('0x26')]['id'],!![],_0xab63cf,_0x1441ef['id']);if(rpc[_0x2377a3[_0x43e7('0x27')]+_0x43e7('0x2c')]){return rpc[_0x2377a3[_0x43e7('0x27')]+_0x43e7('0x2c')][_0x43e7('0x2d')](_0x177ee1)[_0x43e7('0x2e')](function(_0x19725a){logger[_0x43e7('0x2f')](_0x43e7('0x30'));});}}}function stopRouting(_0x4bdb17,_0x238321,_0x44f6b0,_0x3b8f78){if(_0x4bdb17&&_0x238321){_0x238321[_0x43e7('0x1c')]-=0x1;var _0x4251c8={'leaveAt':moment()['format'](_0x43e7('0x1e')),'acceptAt':moment()[_0x43e7('0xf')](_0x43e7('0x1e')),'reason':_0x43e7('0x31')};logger['info'](util['format']('[%s][STOP:QUEUE][NAME:%s]',_0x4bdb17,_0x238321[_0x43e7('0x2b')]));emitChannelQueueInteraction(_0x44f6b0[_0x43e7('0x27')],_0x238321[_0x43e7('0x2b')],_0x44f6b0[_0x43e7('0x1d')],_0x44f6b0[_0x43e7('0xa')][_0x43e7('0x2b')],_0x44f6b0['message']['id'],![],_0x3b8f78,_0x238321['id']);if(rpc[_0x44f6b0['channel']+'QueueReport']){return rpc[_0x44f6b0['channel']+'QueueReport']['update'](_0x4bdb17,_0x4251c8)['catch'](function(_0x14d888){logger['error'](_0x43e7('0x32'));});}}}function endRouting(_0x8e9f40,_0x31bc78,_0x50a2d0,_0x40f72f){if(_0x8e9f40&&_0x31bc78){_0x31bc78[_0x43e7('0x1c')]-=0x1;var _0x101d45={'leaveAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()['format'](_0x43e7('0x1e')),'reason':_0x43e7('0x33')};logger[_0x43e7('0x29')](util[_0x43e7('0xf')](_0x43e7('0x34'),_0x8e9f40,_0x31bc78[_0x43e7('0x2b')]));emitChannelQueueInteraction(_0x50a2d0[_0x43e7('0x27')],_0x31bc78[_0x43e7('0x2b')],_0x50a2d0['body'],_0x50a2d0[_0x43e7('0xa')][_0x43e7('0x2b')],_0x50a2d0['message']['id'],![],_0x40f72f);if(rpc[_0x50a2d0[_0x43e7('0x27')]+'QueueReport']){return rpc[_0x50a2d0[_0x43e7('0x27')]+_0x43e7('0x2c')][_0x43e7('0x35')](_0x8e9f40,_0x101d45)[_0x43e7('0x2e')](function(_0x35ac85){logger[_0x43e7('0x2f')]('update\x20queue\x20report');});}}}function handleFindQueue(_0x574a93){return function(_0x30dfa9){return _0x30dfa9[_0x43e7('0x2b')][_0x43e7('0x36')]()===_0x574a93[_0x43e7('0x36')]();};}exports[_0x43e7('0x37')]=function(_0x4a4a85,_0x32a451,_0x4227c4,_0x575439){return function(_0x3628e0){try{var _0x51a69c={'name':_0x32a451[0x0],'timeout':_0x32a451[0x1]};var _0x2ad8ef=queue['validate'](_0x51a69c,{'typecast':!![]});if(_0x2ad8ef[_0x43e7('0x38')]){logger[_0x43e7('0x2f')](_0x43e7('0x39'),_0x4a4a85,_[_0x43e7('0x3a')](_0x2ad8ef,'message')['join'](',\x20'));_0x3628e0[_0x43e7('0x3b')]();}else{var _0x40c509=_[_0x43e7('0x3c')](_0x4227c4[_0x575439[_0x43e7('0x27')]+'Queues'],handleFindQueue(_0x51a69c['name']));if(_0x40c509){startRouting(_0x4a4a85,_0x40c509,_0x575439,_0x4227c4);var _0x5dd988=(_0x40c509[_0x43e7('0x33')]||0xa)*0x3e8;var _0x57f5d0=(_0x51a69c[_0x43e7('0x33')]||0x14)*0x3e8;var _0x4b3a59,_0x5b28db;if(_0x5dd988>_0x57f5d0){_0x57f5d0=_0x5dd988;}var _0x46b2e6=seqqueue['createQueue'](_0x5dd988);_0x46b2e6['id']=_0x4a4a85;_0x46b2e6[_0x43e7('0x3d')]=_0x5dd988;_0x46b2e6[_0x43e7('0x3e')]=_0x57f5d0;_0x46b2e6[_0x43e7('0x27')]=_0x575439[_0x43e7('0x27')];_0x4227c4['rules'][_0x4a4a85]['on'](_0x43e7('0x3f'),function(){logger[_0x43e7('0x29')](_0x43e7('0x40'),_0x4a4a85);stopRouting(_0x4a4a85,_0x40c509,_0x575439,_0x4227c4);clearTimeout(_0x4b3a59);_0x4b3a59=undefined;_0x46b2e6[_0x43e7('0x41')](!![]);if(_0x4227c4[_0x43e7('0x42')][_0x4a4a85]){delete _0x4227c4[_0x43e7('0x42')][_0x4a4a85];}_0x3628e0['stop']();});_0x4227c4['rules'][_0x4a4a85]['on'](_0x43e7('0x43'),function(){if(_0x4227c4[_0x43e7('0x42')][_0x4a4a85]){delete _0x4227c4[_0x43e7('0x42')][_0x4a4a85];}});_0x4b3a59=setTimeout(function(){logger['info']('[%s][QUEUE]\x20APPLICATION\x20END',_0x4a4a85);endRouting(_0x4a4a85,_0x40c509,_0x575439,_0x4227c4);clearTimeout(_0x4b3a59);_0x46b2e6['close'](!![]);_0x3628e0[_0x43e7('0x44')]();},_0x57f5d0);switch(_0x40c509[_0x43e7('0x45')]){case'rrmemory':strategy[_0x43e7('0x46')](_0x46b2e6,_0x40c509,_0x4227c4,_0x575439);break;default:strategy[_0x43e7('0x47')](_0x46b2e6,_0x40c509,_0x4227c4,_0x575439);}}else{logger[_0x43e7('0x2f')]('[%s][QUEUE]\x20queue\x20not\x20found\x20%s',_0x4a4a85,_0x51a69c['name']);_0x3628e0['stop']();}}}catch(_0x4de644){console[_0x43e7('0x48')](_0x4de644);logger[_0x43e7('0x2f')]('[%s][QUEUE]\x20%s',_0x4a4a85,_0x4de644[_0x43e7('0x49')]);_0x3628e0[_0x43e7('0x3b')]();}};}; \ 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 8314ec8..1baec04 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 _0x52a6=['isNil','realtime','forcedOwnership','isAgentAvailable','agents','channel','busy','busyQueue','showNotification','writeLog','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','STOP','TIMEOUT','exports','lodash','uuid','./util','../../../../../config/logger','routing','notificationId','squeue','agent','handleTimeout','bind','timeout','drained','handleDrained','prototype','push','handleRun','info','[%s][AGENT]\x20try\x20with\x20%s'];(function(_0x4ed1d4,_0x512d9a){var _0x28e363=function(_0x2bdfb7){while(--_0x2bdfb7){_0x4ed1d4['push'](_0x4ed1d4['shift']());}};_0x28e363(++_0x512d9a);}(_0x52a6,0x19e));var _0x652a=function(_0x92706d,_0x5e096c){_0x92706d=_0x92706d-0x0;var _0x15a7eb=_0x52a6[_0x92706d];return _0x15a7eb;};'use strict';var _=require(_0x652a('0x0'));var uuid=require(_0x652a('0x1'));var util=require(_0x652a('0x2'));var logger=require(_0x652a('0x3'))(_0x652a('0x4'));var Agent=function(_0x180d2e,_0x3631cc,_0x3c3457,_0x303c9b){this[_0x652a('0x5')]=uuid['v4']();this[_0x652a('0x6')]=_0x180d2e;this[_0x652a('0x7')]=_0x3631cc;this['realtime']=_0x3c3457;this['routing']=_0x303c9b;this[_0x652a('0x6')]['push'](this['handleRun']['bind'](this),this[_0x652a('0x8')][_0x652a('0x9')](this));this[_0x652a('0x6')]['on'](_0x652a('0xa'),this[_0x652a('0x8')][_0x652a('0x9')](this));this['squeue']['on'](_0x652a('0xb'),this[_0x652a('0xc')][_0x652a('0x9')](this));};Agent[_0x652a('0xd')][_0x652a('0xe')]=function(){this[_0x652a('0x6')][_0x652a('0xe')](this['handleRun']['bind'](this),this[_0x652a('0x8')][_0x652a('0x9')](this));};Agent['prototype'][_0x652a('0xc')]=function(){this['handleTimeout'](!![]);};Agent[_0x652a('0xd')][_0x652a('0xf')]=function(_0x1e9ad6){logger[_0x652a('0x10')](_0x652a('0x11'),this[_0x652a('0x6')]['id'],this[_0x652a('0x7')]['id']);if(_[_0x652a('0x12')](this[_0x652a('0x13')]['agents'][this[_0x652a('0x7')]['id']])){logger[_0x652a('0x10')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this['squeue']['id'],this[_0x652a('0x7')]['id']);setTimeout(this[_0x652a('0xe')][_0x652a('0x9')](this),0x3e8);}else{if(this[_0x652a('0x4')][_0x652a('0x14')]||util[_0x652a('0x15')](this[_0x652a('0x6')]['id'],this[_0x652a('0x13')][_0x652a('0x16')][this[_0x652a('0x7')]['id']],this[_0x652a('0x6')][_0x652a('0x17')],![])){this[_0x652a('0x13')]['agents'][this[_0x652a('0x7')]['id']][_0x652a('0x18')]=!![];this['realtime'][_0x652a('0x16')][this[_0x652a('0x7')]['id']][_0x652a('0x19')]=undefined;util[_0x652a('0x1a')](this['notificationId'],this['squeue']['id'],this[_0x652a('0x13')][_0x652a('0x16')][this[_0x652a('0x7')]['id']],null,this[_0x652a('0x4')]);util[_0x652a('0x1b')](this['squeue']['id'],this[_0x652a('0x13')][_0x652a('0x16')][this['agent']['id']],_0x652a('0x1c')+(this[_0x652a('0x4')][_0x652a('0x14')]?_0x652a('0x1d'):''));}else{logger[_0x652a('0x10')](_0x652a('0x1e'),this['squeue']['id'],this[_0x652a('0x7')]['id']);setTimeout(this[_0x652a('0xe')][_0x652a('0x9')](this),0x3e8);}}};Agent[_0x652a('0xd')][_0x652a('0x8')]=function(_0x16b985){if(_[_0x652a('0x12')](this[_0x652a('0x13')][_0x652a('0x16')][this['agent']['id']])){return logger[_0x652a('0x10')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x652a('0x6')]['id'],this[_0x652a('0x7')]['id']);}else{logger[_0x652a('0x10')](_0x652a('0x1f'),this[_0x652a('0x6')]['id'],this[_0x652a('0x7')]['id']);util[_0x652a('0x20')](this[_0x652a('0x5')],this['squeue']['id'],this[_0x652a('0x13')][_0x652a('0x16')][this[_0x652a('0x7')]['id']],null,this[_0x652a('0x4')]);this[_0x652a('0x13')]['agents'][this[_0x652a('0x7')]['id']][_0x652a('0x18')]=![];this[_0x652a('0x13')][_0x652a('0x16')][this[_0x652a('0x7')]['id']][_0x652a('0x19')]=undefined;util[_0x652a('0x1b')](this[_0x652a('0x6')]['id'],this['realtime'][_0x652a('0x16')][this['agent']['id']],_0x16b985?_0x652a('0x21'):_0x652a('0x22'));}if(!_0x16b985){setTimeout(this[_0x652a('0xe')]['bind'](this),0x3e8);}};function agent(_0x159d26,_0x1724ac,_0x4549db,_0xbeedd9){return new Agent(_0x159d26,_0x1724ac,_0x4549db,_0xbeedd9);}module[_0x652a('0x23')]=agent; \ No newline at end of file +var _0x76b9=['hideNotification','writeLog','TIMEOUT','uuid','./util','../../../../../config/logger','routing','notificationId','squeue','agent','push','bind','handleTimeout','drained','handleDrained','handleRun','prototype','info','[%s][AGENT]\x20try\x20with\x20%s','isNil','realtime','agents','forcedOwnership','isAgentAvailable','busy','busyQueue','showNotification','RINGING',':FORCED','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s'];(function(_0x2b5eae,_0x55010d){var _0x5f3ac9=function(_0x397bfc){while(--_0x397bfc){_0x2b5eae['push'](_0x2b5eae['shift']());}};_0x5f3ac9(++_0x55010d);}(_0x76b9,0x12f));var _0x976b=function(_0x5e8979,_0xdb0cbf){_0x5e8979=_0x5e8979-0x0;var _0x5ecdc2=_0x76b9[_0x5e8979];return _0x5ecdc2;};'use strict';var _=require('lodash');var uuid=require(_0x976b('0x0'));var util=require(_0x976b('0x1'));var logger=require(_0x976b('0x2'))(_0x976b('0x3'));var Agent=function(_0x40b062,_0x5b7152,_0x176ca8,_0x22d723){this[_0x976b('0x4')]=uuid['v4']();this[_0x976b('0x5')]=_0x40b062;this[_0x976b('0x6')]=_0x5b7152;this['realtime']=_0x176ca8;this[_0x976b('0x3')]=_0x22d723;this['squeue'][_0x976b('0x7')](this['handleRun'][_0x976b('0x8')](this),this[_0x976b('0x9')][_0x976b('0x8')](this));this[_0x976b('0x5')]['on']('timeout',this[_0x976b('0x9')][_0x976b('0x8')](this));this[_0x976b('0x5')]['on'](_0x976b('0xa'),this[_0x976b('0xb')][_0x976b('0x8')](this));};Agent['prototype'][_0x976b('0x7')]=function(){this['squeue'][_0x976b('0x7')](this[_0x976b('0xc')][_0x976b('0x8')](this),this[_0x976b('0x9')][_0x976b('0x8')](this));};Agent[_0x976b('0xd')][_0x976b('0xb')]=function(){this[_0x976b('0x9')](!![]);};Agent[_0x976b('0xd')][_0x976b('0xc')]=function(_0x2933d9){logger[_0x976b('0xe')](_0x976b('0xf'),this[_0x976b('0x5')]['id'],this['agent']['id']);if(_[_0x976b('0x10')](this[_0x976b('0x11')][_0x976b('0x12')][this['agent']['id']])){logger['info']('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x976b('0x5')]['id'],this[_0x976b('0x6')]['id']);setTimeout(this['push']['bind'](this),0x3e8);}else{if(this[_0x976b('0x3')][_0x976b('0x13')]||util[_0x976b('0x14')](this['squeue']['id'],this[_0x976b('0x11')][_0x976b('0x12')][this[_0x976b('0x6')]['id']],this[_0x976b('0x5')]['channel'],![])){this[_0x976b('0x11')][_0x976b('0x12')][this[_0x976b('0x6')]['id']][_0x976b('0x15')]=!![];this[_0x976b('0x11')][_0x976b('0x12')][this['agent']['id']][_0x976b('0x16')]=undefined;util[_0x976b('0x17')](this[_0x976b('0x4')],this[_0x976b('0x5')]['id'],this[_0x976b('0x11')][_0x976b('0x12')][this[_0x976b('0x6')]['id']],null,this[_0x976b('0x3')]);util['writeLog'](this[_0x976b('0x5')]['id'],this[_0x976b('0x11')][_0x976b('0x12')][this['agent']['id']],_0x976b('0x18')+(this['routing'][_0x976b('0x13')]?_0x976b('0x19'):''));}else{logger[_0x976b('0xe')]('[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available',this['squeue']['id'],this[_0x976b('0x6')]['id']);setTimeout(this['push']['bind'](this),0x3e8);}}};Agent[_0x976b('0xd')][_0x976b('0x9')]=function(_0x2ca95f){if(_['isNil'](this['realtime'][_0x976b('0x12')][this[_0x976b('0x6')]['id']])){return logger[_0x976b('0xe')](_0x976b('0x1a'),this[_0x976b('0x5')]['id'],this[_0x976b('0x6')]['id']);}else{logger['info']('[%s][AGENT]\x20timeout\x20with\x20%s',this[_0x976b('0x5')]['id'],this[_0x976b('0x6')]['id']);util[_0x976b('0x1b')](this['notificationId'],this[_0x976b('0x5')]['id'],this[_0x976b('0x11')][_0x976b('0x12')][this['agent']['id']],null,this['routing']);this['realtime'][_0x976b('0x12')][this['agent']['id']]['busy']=![];this[_0x976b('0x11')][_0x976b('0x12')][this[_0x976b('0x6')]['id']][_0x976b('0x16')]=undefined;util[_0x976b('0x1c')](this[_0x976b('0x5')]['id'],this['realtime']['agents'][this[_0x976b('0x6')]['id']],_0x2ca95f?'STOP':_0x976b('0x1d'));}if(!_0x2ca95f){setTimeout(this['push'][_0x976b('0x8')](this),0x3e8);}};function agent(_0x305bc6,_0x4f541d,_0x492c34,_0x3e062e){return new Agent(_0x305bc6,_0x4f541d,_0x492c34,_0x3e062e);}module['exports']=agent; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/beepall.js b/server/services/routing/server/applications/strategy/beepall.js index 36e3830..f08bf93 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 _0x7cc1=['exports','./util','../../../../../config/logger','routing','notificationId','queue','realtime','squeue','push','bind','timeout','handleTimeout','drained','handleDrained','prototype','handleRun','isNil','Agents','length','agents','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','writeLog','busy','busyQueue','info','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','hideNotification','STOP','TIMEOUT'];(function(_0x4c5c71,_0xbabb66){var _0x1b7913=function(_0x1da1b3){while(--_0x1da1b3){_0x4c5c71['push'](_0x4c5c71['shift']());}};_0x1b7913(++_0xbabb66);}(_0x7cc1,0x118));var _0x17cc=function(_0x1acc65,_0x341cb6){_0x1acc65=_0x1acc65-0x0;var _0x5b48ec=_0x7cc1[_0x1acc65];return _0x5b48ec;};'use strict';var _=require('lodash');var uuid=require('uuid');var util=require(_0x17cc('0x0'));var logger=require(_0x17cc('0x1'))(_0x17cc('0x2'));var Beepall=function(_0x5dfa4a,_0x218b19,_0x239b97,_0x4dd676){this[_0x17cc('0x3')]=uuid['v4']();this['squeue']=_0x5dfa4a;this[_0x17cc('0x4')]=_0x218b19;this[_0x17cc('0x5')]=_0x239b97;this[_0x17cc('0x2')]=_0x4dd676;this[_0x17cc('0x6')][_0x17cc('0x7')](this['handleRun'][_0x17cc('0x8')](this),this['handleTimeout']['bind'](this));this[_0x17cc('0x6')]['on'](_0x17cc('0x9'),this[_0x17cc('0xa')][_0x17cc('0x8')](this));this[_0x17cc('0x6')]['on'](_0x17cc('0xb'),this[_0x17cc('0xc')][_0x17cc('0x8')](this));};Beepall[_0x17cc('0xd')][_0x17cc('0x7')]=function(){this[_0x17cc('0x6')][_0x17cc('0x7')](this[_0x17cc('0xe')]['bind'](this),this[_0x17cc('0xa')][_0x17cc('0x8')](this));};Beepall[_0x17cc('0xd')]['handleDrained']=function(_0x3f1265){this[_0x17cc('0xa')](!![]);};Beepall[_0x17cc('0xd')][_0x17cc('0xe')]=function(_0x1f1c75){var _0x59c3bd=!![];if(!_[_0x17cc('0xf')](this[_0x17cc('0x4')])&&!_[_0x17cc('0xf')](this[_0x17cc('0x4')][_0x17cc('0x10')])&&this[_0x17cc('0x4')]['Agents']['length']>0x0){for(var _0x10e62b=0x0,_0x4b1e5f;_0x10e62b0x0){for(var _0x3c0d56=0x0,_0x111ea4;_0x3c0d560x0&&_0xa7b8e3[_0x1a0643+_0x4733('0x27')]>=_0xa7b8e3[_0x1a0643+_0x4733('0x26')]){writeLog(_0x115ce4,_0xa7b8e3,_0x1a0643[_0x4733('0x28')]()+'\x20MAXCAPACITY');return![];}}return!![];};exports[_0x4733('0x29')]=function(_0x4c91bc,_0x5b6fc0,_0x24e975,_0x49c516,_0xcde4f4){return sendNotification(!![],_0x4c91bc,_0x5b6fc0,_0x24e975,_0x49c516,_0xcde4f4);};exports['hideNotification']=function(_0x4abc0d,_0x517c73,_0x2976b0,_0x3bfe53,_0x29621e){return sendNotification(![],_0x4abc0d,_0x517c73,_0x2976b0,_0x3bfe53,_0x29621e);};exports[_0x4733('0x2a')]=writeLog; \ No newline at end of file +var _0xfbe6=['info','[%s][QUEUE][AGENT:%s][STATUS:%s]','isAgentAvailable','busy','BUSY','online','OFFLINE','PAUSE','hasOwnProperty','Capacity','toUpperCase','\x20MAXCAPACITY','showNotification','hideNotification','writeLog','lodash','util','../utils','ioredis','../../../../../config/environment','../../../../../config/logger','routing','redis','defaults','localhost','socket.io-emitter','emit','format','user:%s','name','user:save','split','\x20interaction','account','notificationSound','body','queue','msg','getMustacheRender','notificationTemplate','I\x20can\x27t\x20render\x20your\x20template','error','[%s][QUEUE]\x20%s','message','notification:%s','save','remove'];(function(_0x18ae56,_0x4fa3b0){var _0x25e241=function(_0x52275e){while(--_0x52275e){_0x18ae56['push'](_0x18ae56['shift']());}};_0x25e241(++_0x4fa3b0);}(_0xfbe6,0x6d));var _0x6fbe=function(_0x1b8dbd,_0x2b5144){_0x1b8dbd=_0x1b8dbd-0x0;var _0x1aca00=_0xfbe6[_0x1b8dbd];return _0x1aca00;};'use strict';var _=require(_0x6fbe('0x0'));var util=require(_0x6fbe('0x1'));var utils=require(_0x6fbe('0x2'));var Mustache=require('mustache');var Redis=require(_0x6fbe('0x3'));var config=require(_0x6fbe('0x4'));var logger=require(_0x6fbe('0x5'))(_0x6fbe('0x6'));config[_0x6fbe('0x7')]=_[_0x6fbe('0x8')](config[_0x6fbe('0x7')],{'host':_0x6fbe('0x9'),'port':0x18eb});var io=require(_0x6fbe('0xa'))(new Redis(config[_0x6fbe('0x7')]));function emit(_0x533992,_0x1b4712,_0x1be794){io['to'](_0x533992)[_0x6fbe('0xb')](_0x1b4712,_0x1be794);}function sendNotification(_0x5532b3,_0x2ab238,_0x2b4489,_0x348ba5,_0xf52557,_0x156d44){io['to'](util[_0x6fbe('0xc')](_0x6fbe('0xd'),_0x348ba5[_0x6fbe('0xe')]))[_0x6fbe('0xb')](_0x6fbe('0xf'),_0x348ba5);var _0x57ba06=_0x156d44||{};var _0x42a736=_0x2b4489[_0x6fbe('0x10')]('.');var _0x419c77={'uniqueid':_0x2ab238,'channel':_0x42a736[0x0],'id':_0x42a736[0x1],'title':_0x42a736[0x0]+_0x6fbe('0x11'),'interactionId':_0x42a736[0x2],'queue':_0xf52557?_0xf52557[_0x6fbe('0xe')]:null,'sound':_0x57ba06[_0x6fbe('0x12')][_0x6fbe('0x13')],'shake':_0x57ba06[_0x6fbe('0x12')]['notificationShake']};try{if(!_0x57ba06['body']){_0x57ba06[_0x6fbe('0x14')]={};}if(_0xf52557){_0x57ba06[_0x6fbe('0x14')][_0x6fbe('0x15')]=_0xf52557;}else if(_0x57ba06['body'][_0x6fbe('0x15')]){delete _0x57ba06[_0x6fbe('0x14')][_0x6fbe('0x15')];}_0x419c77[_0x6fbe('0x16')]=utils[_0x6fbe('0x17')](_0x57ba06[_0x6fbe('0x12')][_0x6fbe('0x18')],_0x57ba06);}catch(_0x11f9ae){_0x419c77['msg']=_0x6fbe('0x19');logger[_0x6fbe('0x1a')](util[_0x6fbe('0xc')](_0x6fbe('0x1b'),_0x2ab238,_0x11f9ae[_0x6fbe('0x1c')]));}io['to'](util[_0x6fbe('0xc')]('user:%s',_0x348ba5[_0x6fbe('0xe')]))[_0x6fbe('0xb')](util[_0x6fbe('0xc')](_0x6fbe('0x1d'),_0x5532b3?_0x6fbe('0x1e'):_0x6fbe('0x1f')),_0x419c77);}function writeLog(_0x4d7997,_0x1c594a,_0x4040c0){return logger[_0x6fbe('0x20')](util[_0x6fbe('0xc')](_0x6fbe('0x21'),_0x4d7997,_0x1c594a[_0x6fbe('0xe')],_0x4040c0));}exports[_0x6fbe('0x22')]=function(_0x12aee6,_0x34e13a,_0x1e38df,_0x591549){if(_0x34e13a[_0x6fbe('0x23')]){writeLog(_0x12aee6,_0x34e13a,_0x6fbe('0x24'));return![];}if(!_0x34e13a[_0x6fbe('0x25')]){writeLog(_0x12aee6,_0x34e13a,_0x6fbe('0x26'));return![];}if(_0x34e13a[_0x1e38df+'Pause']){writeLog(_0x12aee6,_0x34e13a,_0x6fbe('0x27'));return![];}if(_0x591549&&_0x34e13a[_0x6fbe('0x28')](_0x1e38df+_0x6fbe('0x29'))&&_0x34e13a[_0x6fbe('0x28')](_0x1e38df+'CurrentCapacity')){if(_0x34e13a[_0x1e38df+_0x6fbe('0x29')]>0x0&&_0x34e13a[_0x1e38df+'CurrentCapacity']>=_0x34e13a[_0x1e38df+_0x6fbe('0x29')]){writeLog(_0x12aee6,_0x34e13a,_0x1e38df[_0x6fbe('0x2a')]()+_0x6fbe('0x2b'));return![];}}return!![];};exports[_0x6fbe('0x2c')]=function(_0x1d6c7b,_0x5f38fa,_0x198ddb,_0x51409c,_0x102555){return sendNotification(!![],_0x1d6c7b,_0x5f38fa,_0x198ddb,_0x51409c,_0x102555);};exports[_0x6fbe('0x2d')]=function(_0x5af201,_0x318818,_0x1d8e33,_0x20baca,_0x11aea3){return sendNotification(![],_0x5af201,_0x318818,_0x1d8e33,_0x20baca,_0x11aea3);};exports[_0x6fbe('0x2e')]=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 487e51a..ce8869f 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 _0x74c6=['isObject','stringify','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','validate','shelljs','./utils','../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][SYSTEM]\x20%s','message','join','info','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body'];(function(_0x1cb701,_0xaebc06){var _0x2ac38d=function(_0x33003b){while(--_0x33003b){_0x1cb701['push'](_0x1cb701['shift']());}};_0x2ac38d(++_0xaebc06);}(_0x74c6,0x17d));var _0x674c=function(_0x150c78,_0x2a95a3){_0x150c78=_0x150c78-0x0;var _0x92575b=_0x74c6[_0x150c78];return _0x92575b;};'use strict';var schema=require(_0x674c('0x0'));var sh=require(_0x674c('0x1'));var _=require('lodash');var utils=require(_0x674c('0x2'));var logger=require(_0x674c('0x3'))(_0x674c('0x4'));var system=schema({'command':{'type':_0x674c('0x5'),'required':!![],'message':_0x674c('0x6')}});exports[_0x674c('0x7')]=function(_0x59647d,_0x3adebe){return function(_0x402628){try{var _0x535891={'command':_0x3adebe[0x0]};var _0x49bff4=system[_0x674c('0x0')](_0x535891,{'typecast':!![]});if(_0x49bff4[_0x674c('0x8')]){logger[_0x674c('0x9')](_0x674c('0xa'),_0x59647d,_['map'](_0x49bff4,_0x674c('0xb'))[_0x674c('0xc')](',\x20'));logger[_0x674c('0xd')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x59647d);_0x402628[_0x674c('0xe')]();}else{var _0x1823c3=this;var _0x3b78fa=utils[_0x674c('0xf')](_0x3adebe[0x0],this);logger[_0x674c('0xd')](_0x674c('0x10'),_0x59647d,_0x3b78fa);sh['exec'](_[_0x674c('0x11')](_0x3b78fa),function(_0x3852ce,_0x250525){logger[_0x674c('0xd')](_0x674c('0x12'),_0x59647d,_0x3852ce);if(_0x3852ce==0x0){var _0x57e514=_0x250525[_0x674c('0x13')](/(\r\n|\n|\r)/gm,'');if(_[_0x674c('0x14')](_0x3adebe[0x1])||_[_0x674c('0x15')](_0x3adebe[0x1])){logger[_0x674c('0xd')](_0x674c('0x16'),_0x59647d);_0x1823c3[_0x674c('0x17')][_0x3adebe[0x1]]=_0x57e514;}else{logger[_0x674c('0xd')]('[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s',_0x59647d,_0x3adebe[0x1],_0x57e514);_0x1823c3[_0x674c('0x17')][_0x3adebe[0x1]]=_0x57e514;}}_0x402628[_0x674c('0xe')]();});}}catch(_0x573273){logger['error']('[%s][SYSTEM]\x20%s',_0x59647d,_[_0x674c('0x18')](_0x573273)?JSON[_0x674c('0x19')](_0x573273):_0x573273);logger['info'](_0x674c('0x1a'),_0x59647d);_0x402628[_0x674c('0xe')]();}};}; \ No newline at end of file +var _0x2243=['[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','[%s][SYSTEM]\x20%s','stringify','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','validate','shelljs','lodash','../../../../config/logger','routing','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','length','error','map','message','join','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','info','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil'];(function(_0x437bb4,_0x1e5e6b){var _0x53e6f7=function(_0x24f95a){while(--_0x24f95a){_0x437bb4['push'](_0x437bb4['shift']());}};_0x53e6f7(++_0x1e5e6b);}(_0x2243,0x196));var _0x3224=function(_0x25dfb3,_0x182da7){_0x25dfb3=_0x25dfb3-0x0;var _0x320871=_0x2243[_0x25dfb3];return _0x320871;};'use strict';var schema=require(_0x3224('0x0'));var sh=require(_0x3224('0x1'));var _=require(_0x3224('0x2'));var utils=require('./utils');var logger=require(_0x3224('0x3'))(_0x3224('0x4'));var system=schema({'command':{'type':'string','required':!![],'message':_0x3224('0x5')}});exports['consequence']=function(_0x3b144c,_0x542e05){return function(_0xb60517){try{var _0x5d3ee5={'command':_0x542e05[0x0]};var _0x36191d=system[_0x3224('0x0')](_0x5d3ee5,{'typecast':!![]});if(_0x36191d[_0x3224('0x6')]){logger[_0x3224('0x7')]('[%s][SYSTEM]\x20%s',_0x3b144c,_[_0x3224('0x8')](_0x36191d,_0x3224('0x9'))[_0x3224('0xa')](',\x20'));logger['info']('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x3b144c);_0xb60517[_0x3224('0xb')]();}else{var _0x45914a=this;var _0x2cc796=utils[_0x3224('0xc')](_0x542e05[0x0],this);logger['info'](_0x3224('0xd'),_0x3b144c,_0x2cc796);sh[_0x3224('0xe')](_['trim'](_0x2cc796),function(_0x45359d,_0x3bc628){logger[_0x3224('0xf')](_0x3224('0x10'),_0x3b144c,_0x45359d);if(_0x45359d==0x0){var _0x382064=_0x3bc628[_0x3224('0x11')](/(\r\n|\n|\r)/gm,'');if(_[_0x3224('0x12')](_0x542e05[0x1])||_['isEmpty'](_0x542e05[0x1])){logger[_0x3224('0xf')](_0x3224('0x13'),_0x3b144c);_0x45914a[_0x3224('0x14')][_0x542e05[0x1]]=_0x382064;}else{logger[_0x3224('0xf')](_0x3224('0x15'),_0x3b144c,_0x542e05[0x1],_0x382064);_0x45914a[_0x3224('0x14')][_0x542e05[0x1]]=_0x382064;}}_0xb60517[_0x3224('0xb')]();});}}catch(_0x48f68c){logger[_0x3224('0x7')](_0x3224('0x16'),_0x3b144c,_['isObject'](_0x48f68c)?JSON[_0x3224('0x17')](_0x48f68c):_0x48f68c);logger[_0x3224('0xf')](_0x3224('0x18'),_0x3b144c);_0xb60517[_0x3224('0xb')]();}};}; \ 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 e0b3300..a19b615 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 _0xb51b=['lodash','../../rpc/chatInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','consequence','length','error','map','message','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','channel','interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','[%s][TAG]\x20%s','finally','isObject','stringify','next','validate'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xb51b,0x194));var _0xbb51=function(_0x1e4430,_0x4613a1){_0x1e4430=_0x1e4430-0x0;var _0x5ca16b=_0xb51b[_0x1e4430];return _0x5ca16b;};'use strict';var schema=require(_0xbb51('0x0'));var _=require(_0xbb51('0x1'));var rpc={'chatInteraction':require(_0xbb51('0x2')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0xbb51('0x3')),'mailInteraction':require(_0xbb51('0x4')),'faxInteraction':require(_0xbb51('0x5')),'whatsappInteraction':require(_0xbb51('0x6'))};var logger=require(_0xbb51('0x7'))(_0xbb51('0x8'));var tag=schema({'tag':{'type':'number','required':!![],'message':'TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0xbb51('0x9')]=function(_0x1bca93,_0x4c652d,_0x2822f9,_0x102575){return function(_0x31a373){try{var _0x6c66fc={'tag':_0x4c652d[0x0]};var _0x52b5d2=tag[_0xbb51('0x0')](_0x6c66fc,{'typecast':!![]});if(_0x52b5d2[_0xbb51('0xa')]){logger[_0xbb51('0xb')]('[%s][TAG]\x20%s',_0x1bca93,_[_0xbb51('0xc')](_0x52b5d2,_0xbb51('0xd'))[_0xbb51('0xe')](',\x20'));logger[_0xbb51('0xf')](_0xbb51('0x10'),_0x1bca93);_0x31a373['next']();}else{var _0x4c12d0={'ids':[_0x4c652d[0x0]]};if(rpc[_0x102575[_0xbb51('0x11')]+'Interaction']){rpc[_0x102575['channel']+'Interaction']['addTags'](_0x102575[_0xbb51('0x12')]['id'],_0x4c12d0)[_0xbb51('0x13')](function(_0x4ae221){logger[_0xbb51('0xf')](_0xbb51('0x14'),_0x1bca93,_0x4c652d[0x1],_0x102575['channel'],_0x102575[_0xbb51('0x12')]['id']);})[_0xbb51('0x15')](function(_0x5d2947){logger['error'](_0xbb51('0x16'),_0x1bca93,JSON['stringify'](_0x5d2947));logger[_0xbb51('0xf')](_0xbb51('0x10'),_0x1bca93);})[_0xbb51('0x17')](function(){_0x31a373['next']();});}}}catch(_0x2443b8){logger[_0xbb51('0xb')](_0xbb51('0x16'),_0x1bca93,_[_0xbb51('0x18')](_0x2443b8)?JSON[_0xbb51('0x19')](_0x2443b8):_0x2443b8);logger[_0xbb51('0xf')](_0xbb51('0x10'),_0x1bca93);_0x31a373[_0xbb51('0x1a')]();}};}; \ No newline at end of file +var _0xb0e2=['number','consequence','validate','[%s][TAG]\x20%s','message','join','info','next','channel','Interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','interaction','catch','stringify','finally','error','isObject','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing'];(function(_0x41e137,_0x3ba118){var _0x3d4b5e=function(_0x5554d8){while(--_0x5554d8){_0x41e137['push'](_0x41e137['shift']());}};_0x3d4b5e(++_0x3ba118);}(_0xb0e2,0x157));var _0x2b0e=function(_0x37ce26,_0x1b7e9d){_0x37ce26=_0x37ce26-0x0;var _0x197e59=_0xb0e2[_0x37ce26];return _0x197e59;};'use strict';var schema=require('validate');var _=require(_0x2b0e('0x0'));var rpc={'chatInteraction':require(_0x2b0e('0x1')),'openchannelInteraction':require(_0x2b0e('0x2')),'smsInteraction':require(_0x2b0e('0x3')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0x2b0e('0x4')),'whatsappInteraction':require(_0x2b0e('0x5'))};var logger=require(_0x2b0e('0x6'))(_0x2b0e('0x7'));var tag=schema({'tag':{'type':_0x2b0e('0x8'),'required':!![],'message':'TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0x2b0e('0x9')]=function(_0x4e5d89,_0x562274,_0x72caf2,_0x404434){return function(_0x127f6b){try{var _0x13c4a5={'tag':_0x562274[0x0]};var _0x5fb737=tag[_0x2b0e('0xa')](_0x13c4a5,{'typecast':!![]});if(_0x5fb737['length']){logger['error'](_0x2b0e('0xb'),_0x4e5d89,_['map'](_0x5fb737,_0x2b0e('0xc'))[_0x2b0e('0xd')](',\x20'));logger[_0x2b0e('0xe')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x4e5d89);_0x127f6b[_0x2b0e('0xf')]();}else{var _0x47cd17={'ids':[_0x562274[0x0]]};if(rpc[_0x404434[_0x2b0e('0x10')]+_0x2b0e('0x11')]){rpc[_0x404434[_0x2b0e('0x10')]+_0x2b0e('0x11')]['addTags'](_0x404434['interaction']['id'],_0x47cd17)[_0x2b0e('0x12')](function(_0x15e889){logger[_0x2b0e('0xe')](_0x2b0e('0x13'),_0x4e5d89,_0x562274[0x1],_0x404434[_0x2b0e('0x10')],_0x404434[_0x2b0e('0x14')]['id']);})[_0x2b0e('0x15')](function(_0x47fd21){logger['error'](_0x2b0e('0xb'),_0x4e5d89,JSON[_0x2b0e('0x16')](_0x47fd21));logger[_0x2b0e('0xe')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x4e5d89);})[_0x2b0e('0x17')](function(){_0x127f6b['next']();});}}}catch(_0xc2ff94){logger[_0x2b0e('0x18')](_0x2b0e('0xb'),_0x4e5d89,_[_0x2b0e('0x19')](_0xc2ff94)?JSON[_0x2b0e('0x16')](_0xc2ff94):_0xc2ff94);logger['info'](_0x2b0e('0x1a'),_0x4e5d89);_0x127f6b[_0x2b0e('0xf')]();}};}; \ 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 ad380f0..6f63775 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 _0xe13a=['merge','body','contact','message','account','interaction','list','lodash','exports'];(function(_0x508660,_0x6ae4fa){var _0x3f1cda=function(_0x543ccc){while(--_0x543ccc){_0x508660['push'](_0x508660['shift']());}};_0x3f1cda(++_0x6ae4fa);}(_0xe13a,0x178));var _0xae13=function(_0x428e14,_0x389802){_0x428e14=_0x428e14-0x0;var _0x46e969=_0xe13a[_0x428e14];return _0x46e969;};'use strict';var Mustache=require('mustache');var _=require(_0xae13('0x0'));module[_0xae13('0x1')]={'getMustacheRender':function(_0x3dd3e8,_0x6066c0){return Mustache['render'](_0x3dd3e8,_[_0xae13('0x2')](_0x6066c0[_0xae13('0x3')],{'contact':_0x6066c0[_0xae13('0x4')],'message':_0x6066c0[_0xae13('0x5')],'account':_0x6066c0[_0xae13('0x6')],'interaction':_0x6066c0[_0xae13('0x7')],'list':_0x6066c0[_0xae13('0x8')]}))||'';}}; \ No newline at end of file +var _0xa4db=['list','render','merge','body','contact','account'];(function(_0x78d9ed,_0x54c591){var _0x40254e=function(_0x1bb879){while(--_0x1bb879){_0x78d9ed['push'](_0x78d9ed['shift']());}};_0x40254e(++_0x54c591);}(_0xa4db,0x139));var _0xba4d=function(_0x44625a,_0x4f726a){_0x44625a=_0x44625a-0x0;var _0x5678ad=_0xa4db[_0x44625a];return _0x5678ad;};'use strict';var Mustache=require('mustache');var _=require('lodash');module['exports']={'getMustacheRender':function(_0x1aee67,_0x46aae0){return Mustache[_0xba4d('0x0')](_0x1aee67,_[_0xba4d('0x1')](_0x46aae0[_0xba4d('0x2')],{'contact':_0x46aae0[_0xba4d('0x3')],'message':_0x46aae0['message'],'account':_0x46aae0[_0xba4d('0x4')],'interaction':_0x46aae0['interaction'],'list':_0x46aae0[_0xba4d('0x5')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 28048aa..deef798 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 _0x23ea=['../lib/rule-engine','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','listen','rules','channel','message','interaction','applications','isArray','length','join','app','toLowerCase','autoreply','appdata','split','push','slice','dialogflow','amazonlex','tag','%s:%s:%s','./interval','condition','./applications/','consequence','priority','Push\x20new\x20rule','on\x20interval','intervals','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','info','Applications\x20executed','stringify','emit','routing\x20is\x20empty','QueueReport','update','UserId','stack','message\x20is\x20empty','agent','agents','busy','busyQueue','hasOwnProperty','CurrentCapacity','capacity','updateRealtime','agent\x20not\x20found','values','chatQueues','available','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','lodash','util','path','bluebird','uuid','../../../config/logger','../rpc/openchannelQueueReport','../rpc/chatQueueReport','../rpc/whatsappQueueReport'];(function(_0x37813e,_0x15a7d1){var _0x407630=function(_0x4a24fd){while(--_0x4a24fd){_0x37813e['push'](_0x37813e['shift']());}};_0x407630(++_0x15a7d1);}(_0x23ea,0xa7));var _0xa23e=function(_0x4d6453,_0x4dfc5a){_0x4d6453=_0x4d6453-0x0;var _0x14d362=_0x23ea[_0x4d6453];return _0x14d362;};'use strict';var _=require(_0xa23e('0x0'));var util=require(_0xa23e('0x1'));var path=require(_0xa23e('0x2'));var fs=require('fs');var jayson=require('jayson/promise');var BPromise=require(_0xa23e('0x3'));var uuid=require(_0xa23e('0x4'));var config=require('../../../config/environment');var logger=require(_0xa23e('0x5'))('routing');var rpc={'openchannelQueueReport':require(_0xa23e('0x6')),'mailQueueReport':require('../rpc/mailQueueReport'),'chatQueueReport':require(_0xa23e('0x7')),'smsQueueReport':require('../rpc/smsQueueReport'),'faxQueueReport':require('../rpc/faxQueueReport'),'whatsappQueueReport':require(_0xa23e('0x8'))};var RuleEngine=require(_0xa23e('0x9'));function getId(_0x19fb1c,_0x3c3021,_0x16d383){return util['format'](_0xa23e('0xa'),_0x19fb1c,_0x3c3021||0x0,_0x16d383||0x0);}function getIntervals(_0x3dd707,_0x28025d){var _0x1b0d64=[];if(!_[_0xa23e('0xb')](_0x28025d[_0xa23e('0xc')])&&!_[_0xa23e('0xb')](_0x3dd707[_0x28025d[_0xa23e('0xc')]])&&!_[_0xa23e('0xb')](_0x3dd707[_0x28025d[_0xa23e('0xc')]][_0xa23e('0xd')])){_0x1b0d64=_[_0xa23e('0xe')](_0x3dd707[_0x28025d[_0xa23e('0xc')]][_0xa23e('0xd')],_0xa23e('0xf'));}else if(!_[_0xa23e('0xb')](_0x28025d[_0xa23e('0xf')])){_0x1b0d64=[_0x28025d[_0xa23e('0xf')]];}return _0x1b0d64;}exports[_0xa23e('0x10')]=function(_0x2f85a4){_0x2f85a4[_0xa23e('0x11')]={};return new BPromise(function(_0x5258ef,_0xd889ce){var _0x3749b3={'Start':function(_0x1ea932){var _0x2a6214=this;return new Promise(function(_0x493082,_0x18a0a8){if(_0x1ea932){try{var _0x241738=[];var _0x2f8911=getId(_0x1ea932[_0xa23e('0x12')],_0x1ea932['message']?_0x1ea932[_0xa23e('0x13')]['id']:0x0,_0x1ea932[_0xa23e('0x14')]?_0x1ea932[_0xa23e('0x14')]['id']:0x0);if(_0x1ea932[_0xa23e('0x15')]&&_[_0xa23e('0x16')](_0x1ea932[_0xa23e('0x15')])&&_0x1ea932[_0xa23e('0x15')][_0xa23e('0x17')]){for(var _0x16bd65=0x0;_0x16bd65<_0x1ea932['applications'][_0xa23e('0x17')];_0x16bd65+=0x1){var _0x27c1f8=_0x1ea932[_0xa23e('0x15')][_0x16bd65];if(fs['existsSync'](path[_0xa23e('0x18')](__dirname,_0xa23e('0x15'),_0x27c1f8[_0xa23e('0x19')]+'.js'))){var _0x1d6a0a=[];switch(_0x27c1f8[_0xa23e('0x19')][_0xa23e('0x1a')]()){case _0xa23e('0x1b'):var _0x972d3=_0x27c1f8[_0xa23e('0x1c')][_0xa23e('0x1d')](',');_0x1d6a0a['push'](_0x972d3[0x0]);_0x1d6a0a[_0xa23e('0x1e')](_0x972d3[_0xa23e('0x1f')](0x1,_0x972d3[_0xa23e('0x17')])[_0xa23e('0x18')](','));break;case _0xa23e('0x20'):var _0x103f1e=_0x27c1f8['appdata'][_0xa23e('0x1d')](',');_0x1d6a0a['push'](_0x103f1e[0x0]);_0x1d6a0a[_0xa23e('0x1e')](_0x103f1e[0x1]);_0x1d6a0a['push'](_0x103f1e[_0xa23e('0x1f')](0x2,_0x103f1e[_0xa23e('0x17')])['join'](','));break;case _0xa23e('0x21'):var _0x2cc662=_0x27c1f8[_0xa23e('0x1c')][_0xa23e('0x1d')](',');_0x1d6a0a[_0xa23e('0x1e')](_0x2cc662[0x0]);_0x1d6a0a[_0xa23e('0x1e')](_0x2cc662[0x1]);_0x1d6a0a[_0xa23e('0x1e')](_0x2cc662[0x2]);_0x1d6a0a[_0xa23e('0x1e')](_0x2cc662[0x3]);_0x1d6a0a[_0xa23e('0x1e')](_0x2cc662[_0xa23e('0x1f')](0x4,_0x2cc662[_0xa23e('0x17')])[_0xa23e('0x18')](','));break;case _0xa23e('0x13'):_0x1d6a0a[_0xa23e('0x1e')](_0x27c1f8[_0xa23e('0x1c')]);break;case _0xa23e('0x22'):_0x1d6a0a[_0xa23e('0x1e')](_0x27c1f8['TagId']);_0x1d6a0a[_0xa23e('0x1e')](_0x27c1f8[_0xa23e('0x1c')]);break;default:_0x1d6a0a=_[_0xa23e('0xb')](_0x27c1f8[_0xa23e('0x1c')])?[]:_0x27c1f8[_0xa23e('0x1c')][_0xa23e('0x1d')](',');}var _0x1cc0aa={'id':util['format'](_0xa23e('0x23'),_0x2f8911,_0x27c1f8['id'],_0x27c1f8[_0xa23e('0x19')]),'condition':require(_0xa23e('0x24'))[_0xa23e('0x25')](_0x2f8911,getIntervals(_0x2f85a4['intervals'],_0x27c1f8),_0x2f85a4),'consequence':require(_0xa23e('0x26')+_0x27c1f8['app'])[_0xa23e('0x27')](_0x2f8911,_0x1d6a0a,_0x2f85a4,_0x1ea932),'p':_0x27c1f8[_0xa23e('0x28')]||0x0};logger['info'](_0xa23e('0x29'),_0x1cc0aa['id'],_0xa23e('0x2a'),getIntervals(_0x2f85a4[_0xa23e('0x2b')],_0x27c1f8)[_0xa23e('0x18')](_0xa23e('0x2c')));_0x241738[_0xa23e('0x1e')](_0x1cc0aa);}else{logger[_0xa23e('0x2d')](_0xa23e('0x2e'),path[_0xa23e('0x18')](__dirname,'applications',_0x27c1f8[_0xa23e('0x19')]+'.js'));}}_0x2f85a4[_0xa23e('0x11')][_0x2f8911]=new RuleEngine(_0x241738);_0x2f85a4['rules'][_0x2f8911]['execute'](_0x1ea932,function(_0x1d22a1){logger[_0xa23e('0x2f')](_0xa23e('0x30'),JSON[_0xa23e('0x31')](_0x1d22a1['matchPath']));if(_0x2f85a4[_0xa23e('0x11')][_0x2f8911]){_0x2f85a4[_0xa23e('0x11')][_0x2f8911][_0xa23e('0x32')]('complete');}});return _0x493082({'code':0xc8,'message':_0x1ea932});}else{logger['info']('No\x20applications\x20to\x20execute');return _0x493082({'code':0xc8,'message':_0x1ea932});}}catch(_0x32913f){logger[_0xa23e('0x2d')](_0x32913f['stack']);return _0x18a0a8(_0x2a6214['error'](0x1f4,_0x32913f));}}return _0x18a0a8(_0xa23e('0x33'));});},'AcceptMessage':function(_0xec2878){var _0x2f1c0c=this;return new Promise(function(_0x5d1091,_0xf8731b){if(_0xec2878[_0xa23e('0x13')]&&_0xec2878['message']['id']){try{var _0x436fdb=getId(_0xec2878[_0xa23e('0x12')],_0xec2878['message']?_0xec2878[_0xa23e('0x13')]['id']:0x0,_0xec2878['interaction']?_0xec2878[_0xa23e('0x14')]['id']:0x0);if(_0x2f85a4[_0xa23e('0x11')][_0x436fdb]){_0x2f85a4['rules'][_0x436fdb][_0xa23e('0x32')]('end');if(rpc[_0xec2878['channel']+_0xa23e('0x34')]){rpc[_0xec2878[_0xa23e('0x12')]+_0xa23e('0x34')][_0xa23e('0x35')](_0x436fdb,{'UserId':_0xec2878[_0xa23e('0x13')][_0xa23e('0x36')]})['catch'](function(_0x2e0eb4){logger[_0xa23e('0x2d')]('error\x20update\x20queue\x20report');});}}return _0x5d1091({'code':0xc8,'message':_0xec2878});}catch(_0x2b4fac){logger[_0xa23e('0x2d')](_0x2b4fac[_0xa23e('0x37')]);return _0xf8731b(_0x2f1c0c[_0xa23e('0x2d')](0x1f4,_0x2b4fac));}}logger[_0xa23e('0x2d')](_0xa23e('0x38'));return _0xf8731b(_0x2f1c0c[_0xa23e('0x2d')](0x1f4,_0xa23e('0x38')));});},'RejectMessage':function(_0x1ed59d){var _0x376052=this;return new Promise(function(_0x4e4f94,_0x2badcf){if(_0x1ed59d[_0xa23e('0x39')]&&_0x1ed59d[_0xa23e('0x39')]['id']){try{if(_0x2f85a4[_0xa23e('0x3a')][_0x1ed59d[_0xa23e('0x39')]['id']]){_0x2f85a4[_0xa23e('0x3a')][_0x1ed59d[_0xa23e('0x39')]['id']][_0xa23e('0x3b')]=![];_0x2f85a4[_0xa23e('0x3a')][_0x1ed59d['agent']['id']][_0xa23e('0x3c')]=undefined;}return _0x4e4f94({'code':0xc8,'message':_0x1ed59d});}catch(_0x3ae39b){logger['error'](_0x3ae39b['stack']);return _0x2badcf(_0x376052[_0xa23e('0x2d')](0x1f4,_0x3ae39b));}}logger['error'](_0xa23e('0x38'));return _0x2badcf(_0x376052['error'](0x1f4,_0xa23e('0x38')));});},'AbandonInteraction':function(_0x374198){var _0x1ed51b=this;return new Promise(function(_0xc05634,_0x4fb6c1){if(_0x374198['channel']&&_0x374198[_0xa23e('0x14')]&&_0x374198[_0xa23e('0x14')]['id']){try{var _0xb9f5ef=getId(_0x374198['channel'],_0x374198['message']?_0x374198[_0xa23e('0x13')]['id']:0x0,_0x374198[_0xa23e('0x14')]?_0x374198[_0xa23e('0x14')]['id']:0x0);if(_0x2f85a4['rules'][_0xb9f5ef]){_0x2f85a4[_0xa23e('0x11')][_0xb9f5ef][_0xa23e('0x32')]('end');}return _0xc05634({'code':0xc8,'message':_0x374198});}catch(_0x5be03a){logger[_0xa23e('0x2d')](_0x5be03a[_0xa23e('0x37')]);return _0x4fb6c1(_0x1ed51b[_0xa23e('0x2d')](0x1f4,_0x5be03a));}}logger['error'](_0xa23e('0x38'));return _0x4fb6c1(_0x1ed51b[_0xa23e('0x2d')](0x1f4,_0xa23e('0x38')));});},'AgentCapacity':function(_0x4ac8f7){var _0x5729b7=this;return new Promise(function(_0x3aa0ad,_0x4fa205){if(_0x2f85a4[_0xa23e('0x3a')][_0xa23e('0x3d')](_0x4ac8f7['id'])){for(var _0x1818cc in _0x4ac8f7['capacity']){if(_0x4ac8f7['capacity'][_0xa23e('0x3d')](_0x1818cc)){if(_0x2f85a4[_0xa23e('0x3a')][_0x4ac8f7['id']][_0xa23e('0x3d')](_0x1818cc+_0xa23e('0x3e'))){_0x2f85a4[_0xa23e('0x3a')][_0x4ac8f7['id']][_0x1818cc+_0xa23e('0x3e')]=parseInt(_0x4ac8f7[_0xa23e('0x3f')][_0x1818cc],0xa);}}}_0x2f85a4[_0xa23e('0x3a')][_0x4ac8f7['id']][_0xa23e('0x40')]();return _0x3aa0ad({'code':0xc8,'message':_0x2f85a4[_0xa23e('0x3a')][_0x4ac8f7['id']]});}else{return _0x4fa205(_0x5729b7[_0xa23e('0x2d')](0x1f4,_0xa23e('0x41')));}});},'Agents':function(_0x2a9648){return new Promise(function(_0x477dfe,_0x268197){var _0x10cbad=_[_0xa23e('0x42')](_0x2f85a4[_0xa23e('0x3a')]);_0x477dfe({'count':_0x10cbad[_0xa23e('0x17')],'rows':_0x10cbad});});},'ChatQueues':function(_0xeee6a8){return new Promise(function(_0x4795fe,_0x481920){var _0x27d520=[];for(var _0x364df7 in _0x2f85a4[_0xa23e('0x43')]){if(_0x2f85a4[_0xa23e('0x43')][_0xa23e('0x3d')](_0x364df7)){var _0x5e2601=_0x2f85a4[_0xa23e('0x43')][_0x364df7];var _0x4ce344={'id':_0x5e2601['id'],'available':_0x5e2601[_0xa23e('0x44')],'loggedIn':_0x5e2601[_0xa23e('0x45')],'name':_0x5e2601[_0xa23e('0x46')],'paused':_0x5e2601[_0xa23e('0x47')],'waiting':_0x5e2601[_0xa23e('0x48')]};_0x27d520['push'](_0x4ce344);}}_0x4795fe({'count':_0x27d520[_0xa23e('0x17')],'rows':_0x27d520});});},'MailQueues':function(_0x340b27){return new Promise(function(_0x5e8bcf,_0x47cb46){var _0x5e8177=[];for(var _0x3403c4 in _0x2f85a4[_0xa23e('0x49')]){if(_0x2f85a4['mailQueues'][_0xa23e('0x3d')](_0x3403c4)){var _0x2f66e0=_0x2f85a4[_0xa23e('0x49')][_0x3403c4];var _0x24a9b5={'id':_0x2f66e0['id'],'available':_0x2f66e0['available'],'loggedIn':_0x2f66e0['loggedIn'],'name':_0x2f66e0[_0xa23e('0x46')],'paused':_0x2f66e0['paused'],'waiting':_0x2f66e0[_0xa23e('0x48')]};_0x5e8177[_0xa23e('0x1e')](_0x24a9b5);}}_0x5e8bcf({'count':_0x5e8177[_0xa23e('0x17')],'rows':_0x5e8177});});},'OpenchannelQueues':function(_0x1850c5){return new Promise(function(_0x185a59,_0x19abdb){var _0x2ed815=[];for(var _0x34172e in _0x2f85a4[_0xa23e('0x4a')]){if(_0x2f85a4[_0xa23e('0x4a')][_0xa23e('0x3d')](_0x34172e)){var _0x412e90=_0x2f85a4[_0xa23e('0x4a')][_0x34172e];var _0x45541b={'id':_0x412e90['id'],'available':_0x412e90[_0xa23e('0x44')],'loggedIn':_0x412e90[_0xa23e('0x45')],'name':_0x412e90['name'],'paused':_0x412e90[_0xa23e('0x47')],'waiting':_0x412e90['waiting']};_0x2ed815['push'](_0x45541b);}}_0x185a59({'count':_0x2ed815['length'],'rows':_0x2ed815});});},'SmsQueues':function(_0x3ceaea){return new Promise(function(_0x2b43e8,_0x2d24f2){var _0x38a5ad=[];for(var _0x26784c in _0x2f85a4['smsQueues']){if(_0x2f85a4[_0xa23e('0x4b')][_0xa23e('0x3d')](_0x26784c)){var _0x55ba87=_0x2f85a4['smsQueues'][_0x26784c];var _0x2ad1d4={'id':_0x55ba87['id'],'available':_0x55ba87[_0xa23e('0x44')],'loggedIn':_0x55ba87[_0xa23e('0x45')],'name':_0x55ba87['name'],'paused':_0x55ba87[_0xa23e('0x47')],'waiting':_0x55ba87[_0xa23e('0x48')]};_0x38a5ad[_0xa23e('0x1e')](_0x2ad1d4);}}_0x2b43e8({'count':_0x38a5ad['length'],'rows':_0x38a5ad});});},'FaxQueues':function(_0x4ec6e3){return new Promise(function(_0x3c60e2,_0x2a1508){var _0x5d0114=[];for(var _0x5a09e4 in _0x2f85a4['faxQueues']){if(_0x2f85a4[_0xa23e('0x4c')][_0xa23e('0x3d')](_0x5a09e4)){var _0x100e92=_0x2f85a4[_0xa23e('0x4c')][_0x5a09e4];var _0x4ac397={'id':_0x100e92['id'],'available':_0x100e92['available'],'loggedIn':_0x100e92[_0xa23e('0x45')],'name':_0x100e92[_0xa23e('0x46')],'paused':_0x100e92['paused'],'waiting':_0x100e92['waiting']};_0x5d0114['push'](_0x4ac397);}}_0x3c60e2({'count':_0x5d0114[_0xa23e('0x17')],'rows':_0x5d0114});});},'WhatsappQueues':function(_0x410d5f){return new Promise(function(_0x1bdc1b,_0x341df1){var _0x2f91b8=[];for(var _0x1323c4 in _0x2f85a4[_0xa23e('0x4d')]){if(_0x2f85a4[_0xa23e('0x4d')]['hasOwnProperty'](_0x1323c4)){var _0x34e37c=_0x2f85a4[_0xa23e('0x4d')][_0x1323c4];var _0xf0a6cf={'id':_0x34e37c['id'],'available':_0x34e37c['available'],'loggedIn':_0x34e37c[_0xa23e('0x45')],'name':_0x34e37c[_0xa23e('0x46')],'paused':_0x34e37c['paused'],'waiting':_0x34e37c[_0xa23e('0x48')]};_0x2f91b8['push'](_0xf0a6cf);}}_0x1bdc1b({'count':_0x2f91b8[_0xa23e('0x17')],'rows':_0x2f91b8});});},'ChatQueuesWaitingInteractions':function(_0xe57b59){return new Promise(function(_0x12b232,_0x32bdd4){var _0x1ec513=_['values'](_0x2f85a4[_0xa23e('0x4e')]);_0x12b232({'count':_0x1ec513[_0xa23e('0x17')],'rows':_0x1ec513});});},'MailQueuesWaitingInteractions':function(_0x3b101b){return new Promise(function(_0x14d01b,_0x2d58cd){var _0x32bd90=_['values'](_0x2f85a4[_0xa23e('0x4f')]);_0x14d01b({'count':_0x32bd90[_0xa23e('0x17')],'rows':_0x32bd90});});},'OpenchannelQueuesWaitingInteractions':function(_0x4045d4){return new Promise(function(_0x572393,_0x146eca){var _0x2746ab=_['values'](_0x2f85a4[_0xa23e('0x50')]);_0x572393({'count':_0x2746ab[_0xa23e('0x17')],'rows':_0x2746ab});});},'SmsQueuesWaitingInteractions':function(_0x368e17){return new Promise(function(_0x1b7ff3,_0x6240df){var _0x396b98=_[_0xa23e('0x42')](_0x2f85a4[_0xa23e('0x51')]);_0x1b7ff3({'count':_0x396b98[_0xa23e('0x17')],'rows':_0x396b98});});},'FaxQueuesWaitingInteractions':function(_0x5c8f94){return new Promise(function(_0x15b33c,_0x37f242){var _0x55af8a=_[_0xa23e('0x42')](_0x2f85a4[_0xa23e('0x52')]);_0x15b33c({'count':_0x55af8a[_0xa23e('0x17')],'rows':_0x55af8a});});},'WhatsappQueuesWaitingInteractions':function(_0x2199f2){return new Promise(function(_0x574de1,_0x5a7ac2){var _0x8c738b=_[_0xa23e('0x42')](_0x2f85a4[_0xa23e('0x53')]);_0x574de1({'count':_0x8c738b['length'],'rows':_0x8c738b});});}};var _0x19754c=jayson[_0xa23e('0x54')](_0x3749b3)['http']();_0x19754c['on']('error',function(_0xe64a65){logger[_0xa23e('0x2d')](JSON[_0xa23e('0x31')](_0xe64a65));return _0xd889ce(_0xe64a65);});_0x19754c[_0xa23e('0x10')](0x232c,_0xa23e('0x55'),function(){console[_0xa23e('0x56')](_0xa23e('0x57'),0x232c);return _0x5258ef('RPC\x20listening\x20on\x20port:'+0x232c);});});}; \ No newline at end of file +var _0x0c5f=['toLowerCase','autoreply','split','push','join','dialogflow','slice','appdata','tag','TagId','./interval','condition','intervals','./applications/','consequence','info','on\x20interval','error','Please\x20create\x20a\x20new\x20file\x20under','.js','rules','execute','Applications\x20executed','matchPath','emit','No\x20applications\x20to\x20execute','routing\x20is\x20empty','end','QueueReport','UserId','catch','error\x20update\x20queue\x20report','stack','message\x20is\x20empty','agent','agents','busy','busyQueue','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','chatQueues','available','loggedIn','name','paused','mailQueues','waiting','smsQueues','faxQueues','whatsappQueues','values','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','faxQueuesWaitingInteractions','server','http','stringify','127.0.0.1','log','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','bluebird','uuid','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','IntervalId','isNil','Intervals','map','interval','listen','channel','message','interaction','applications','isArray','length','existsSync','app'];(function(_0x3a4838,_0x5eb63c){var _0x10fc53=function(_0x23e650){while(--_0x23e650){_0x3a4838['push'](_0x3a4838['shift']());}};_0x10fc53(++_0x5eb63c);}(_0x0c5f,0xf5));var _0xf0c5=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0c5f[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xf0c5('0x0'));var util=require(_0xf0c5('0x1'));var path=require('path');var fs=require('fs');var jayson=require(_0xf0c5('0x2'));var BPromise=require(_0xf0c5('0x3'));var uuid=require(_0xf0c5('0x4'));var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0xf0c5('0x5'));var rpc={'openchannelQueueReport':require(_0xf0c5('0x6')),'mailQueueReport':require(_0xf0c5('0x7')),'chatQueueReport':require(_0xf0c5('0x8')),'smsQueueReport':require('../rpc/smsQueueReport'),'faxQueueReport':require(_0xf0c5('0x9')),'whatsappQueueReport':require(_0xf0c5('0xa'))};var RuleEngine=require(_0xf0c5('0xb'));function getId(_0x1fee9d,_0x2d451e,_0x57cf10){return util[_0xf0c5('0xc')](_0xf0c5('0xd'),_0x1fee9d,_0x2d451e||0x0,_0x57cf10||0x0);}function getIntervals(_0x6975e7,_0x4ab103){var _0x4e739e=[];if(!_['isNil'](_0x4ab103[_0xf0c5('0xe')])&&!_['isNil'](_0x6975e7[_0x4ab103[_0xf0c5('0xe')]])&&!_[_0xf0c5('0xf')](_0x6975e7[_0x4ab103[_0xf0c5('0xe')]][_0xf0c5('0x10')])){_0x4e739e=_[_0xf0c5('0x11')](_0x6975e7[_0x4ab103['IntervalId']][_0xf0c5('0x10')],'interval');}else if(!_['isNil'](_0x4ab103[_0xf0c5('0x12')])){_0x4e739e=[_0x4ab103[_0xf0c5('0x12')]];}return _0x4e739e;}exports[_0xf0c5('0x13')]=function(_0x4b9886){_0x4b9886['rules']={};return new BPromise(function(_0x1d900d,_0x25f80b){var _0x52ecfe={'Start':function(_0x4ce963){var _0x30273f=this;return new Promise(function(_0xe6e867,_0x55ff79){if(_0x4ce963){try{var _0x2417ab=[];var _0x4b2e71=getId(_0x4ce963[_0xf0c5('0x14')],_0x4ce963[_0xf0c5('0x15')]?_0x4ce963['message']['id']:0x0,_0x4ce963[_0xf0c5('0x16')]?_0x4ce963[_0xf0c5('0x16')]['id']:0x0);if(_0x4ce963[_0xf0c5('0x17')]&&_[_0xf0c5('0x18')](_0x4ce963['applications'])&&_0x4ce963[_0xf0c5('0x17')][_0xf0c5('0x19')]){for(var _0x16424d=0x0;_0x16424d<_0x4ce963[_0xf0c5('0x17')][_0xf0c5('0x19')];_0x16424d+=0x1){var _0x50c827=_0x4ce963[_0xf0c5('0x17')][_0x16424d];if(fs[_0xf0c5('0x1a')](path['join'](__dirname,_0xf0c5('0x17'),_0x50c827[_0xf0c5('0x1b')]+'.js'))){var _0x2efbaf=[];switch(_0x50c827[_0xf0c5('0x1b')][_0xf0c5('0x1c')]()){case _0xf0c5('0x1d'):var _0x2b1dac=_0x50c827['appdata'][_0xf0c5('0x1e')](',');_0x2efbaf[_0xf0c5('0x1f')](_0x2b1dac[0x0]);_0x2efbaf['push'](_0x2b1dac['slice'](0x1,_0x2b1dac['length'])[_0xf0c5('0x20')](','));break;case _0xf0c5('0x21'):var _0x499a1=_0x50c827['appdata']['split'](',');_0x2efbaf['push'](_0x499a1[0x0]);_0x2efbaf['push'](_0x499a1[0x1]);_0x2efbaf[_0xf0c5('0x1f')](_0x499a1[_0xf0c5('0x22')](0x2,_0x499a1[_0xf0c5('0x19')])[_0xf0c5('0x20')](','));break;case'amazonlex':var _0x455f39=_0x50c827[_0xf0c5('0x23')][_0xf0c5('0x1e')](',');_0x2efbaf[_0xf0c5('0x1f')](_0x455f39[0x0]);_0x2efbaf[_0xf0c5('0x1f')](_0x455f39[0x1]);_0x2efbaf[_0xf0c5('0x1f')](_0x455f39[0x2]);_0x2efbaf[_0xf0c5('0x1f')](_0x455f39[0x3]);_0x2efbaf[_0xf0c5('0x1f')](_0x455f39[_0xf0c5('0x22')](0x4,_0x455f39[_0xf0c5('0x19')])[_0xf0c5('0x20')](','));break;case'message':_0x2efbaf[_0xf0c5('0x1f')](_0x50c827[_0xf0c5('0x23')]);break;case _0xf0c5('0x24'):_0x2efbaf[_0xf0c5('0x1f')](_0x50c827[_0xf0c5('0x25')]);_0x2efbaf[_0xf0c5('0x1f')](_0x50c827['appdata']);break;default:_0x2efbaf=_['isNil'](_0x50c827[_0xf0c5('0x23')])?[]:_0x50c827[_0xf0c5('0x23')][_0xf0c5('0x1e')](',');}var _0x5d24f7={'id':util['format']('%s:%s:%s',_0x4b2e71,_0x50c827['id'],_0x50c827['app']),'condition':require(_0xf0c5('0x26'))[_0xf0c5('0x27')](_0x4b2e71,getIntervals(_0x4b9886[_0xf0c5('0x28')],_0x50c827),_0x4b9886),'consequence':require(_0xf0c5('0x29')+_0x50c827[_0xf0c5('0x1b')])[_0xf0c5('0x2a')](_0x4b2e71,_0x2efbaf,_0x4b9886,_0x4ce963),'p':_0x50c827['priority']||0x0};logger[_0xf0c5('0x2b')]('Push\x20new\x20rule',_0x5d24f7['id'],_0xf0c5('0x2c'),getIntervals(_0x4b9886[_0xf0c5('0x28')],_0x50c827)[_0xf0c5('0x20')]('\x20|\x20'));_0x2417ab[_0xf0c5('0x1f')](_0x5d24f7);}else{logger[_0xf0c5('0x2d')](_0xf0c5('0x2e'),path[_0xf0c5('0x20')](__dirname,_0xf0c5('0x17'),_0x50c827[_0xf0c5('0x1b')]+_0xf0c5('0x2f')));}}_0x4b9886['rules'][_0x4b2e71]=new RuleEngine(_0x2417ab);_0x4b9886[_0xf0c5('0x30')][_0x4b2e71][_0xf0c5('0x31')](_0x4ce963,function(_0x26d2fd){logger[_0xf0c5('0x2b')](_0xf0c5('0x32'),JSON['stringify'](_0x26d2fd[_0xf0c5('0x33')]));if(_0x4b9886['rules'][_0x4b2e71]){_0x4b9886['rules'][_0x4b2e71][_0xf0c5('0x34')]('complete');}});return _0xe6e867({'code':0xc8,'message':_0x4ce963});}else{logger[_0xf0c5('0x2b')](_0xf0c5('0x35'));return _0xe6e867({'code':0xc8,'message':_0x4ce963});}}catch(_0x47a6e4){logger[_0xf0c5('0x2d')](_0x47a6e4['stack']);return _0x55ff79(_0x30273f[_0xf0c5('0x2d')](0x1f4,_0x47a6e4));}}return _0x55ff79(_0xf0c5('0x36'));});},'AcceptMessage':function(_0x5e2ed3){var _0x3a779d=this;return new Promise(function(_0x5b1ed4,_0x28437c){if(_0x5e2ed3[_0xf0c5('0x15')]&&_0x5e2ed3[_0xf0c5('0x15')]['id']){try{var _0x4a7305=getId(_0x5e2ed3['channel'],_0x5e2ed3[_0xf0c5('0x15')]?_0x5e2ed3['message']['id']:0x0,_0x5e2ed3[_0xf0c5('0x16')]?_0x5e2ed3[_0xf0c5('0x16')]['id']:0x0);if(_0x4b9886[_0xf0c5('0x30')][_0x4a7305]){_0x4b9886['rules'][_0x4a7305]['emit'](_0xf0c5('0x37'));if(rpc[_0x5e2ed3[_0xf0c5('0x14')]+'QueueReport']){rpc[_0x5e2ed3[_0xf0c5('0x14')]+_0xf0c5('0x38')]['update'](_0x4a7305,{'UserId':_0x5e2ed3['message'][_0xf0c5('0x39')]})[_0xf0c5('0x3a')](function(_0x233be6){logger[_0xf0c5('0x2d')](_0xf0c5('0x3b'));});}}return _0x5b1ed4({'code':0xc8,'message':_0x5e2ed3});}catch(_0x421873){logger[_0xf0c5('0x2d')](_0x421873[_0xf0c5('0x3c')]);return _0x28437c(_0x3a779d[_0xf0c5('0x2d')](0x1f4,_0x421873));}}logger[_0xf0c5('0x2d')](_0xf0c5('0x3d'));return _0x28437c(_0x3a779d[_0xf0c5('0x2d')](0x1f4,'message\x20is\x20empty'));});},'RejectMessage':function(_0x11740c){var _0x223ef1=this;return new Promise(function(_0x47142a,_0x3f5804){if(_0x11740c[_0xf0c5('0x3e')]&&_0x11740c['agent']['id']){try{if(_0x4b9886[_0xf0c5('0x3f')][_0x11740c[_0xf0c5('0x3e')]['id']]){_0x4b9886[_0xf0c5('0x3f')][_0x11740c[_0xf0c5('0x3e')]['id']][_0xf0c5('0x40')]=![];_0x4b9886[_0xf0c5('0x3f')][_0x11740c['agent']['id']][_0xf0c5('0x41')]=undefined;}return _0x47142a({'code':0xc8,'message':_0x11740c});}catch(_0x461e6d){logger[_0xf0c5('0x2d')](_0x461e6d[_0xf0c5('0x3c')]);return _0x3f5804(_0x223ef1[_0xf0c5('0x2d')](0x1f4,_0x461e6d));}}logger[_0xf0c5('0x2d')](_0xf0c5('0x3d'));return _0x3f5804(_0x223ef1[_0xf0c5('0x2d')](0x1f4,_0xf0c5('0x3d')));});},'AbandonInteraction':function(_0x82d733){var _0xf28c89=this;return new Promise(function(_0x50c2df,_0x54524a){if(_0x82d733[_0xf0c5('0x14')]&&_0x82d733[_0xf0c5('0x16')]&&_0x82d733[_0xf0c5('0x16')]['id']){try{var _0x3396c9=getId(_0x82d733['channel'],_0x82d733[_0xf0c5('0x15')]?_0x82d733[_0xf0c5('0x15')]['id']:0x0,_0x82d733[_0xf0c5('0x16')]?_0x82d733[_0xf0c5('0x16')]['id']:0x0);if(_0x4b9886[_0xf0c5('0x30')][_0x3396c9]){_0x4b9886[_0xf0c5('0x30')][_0x3396c9][_0xf0c5('0x34')](_0xf0c5('0x37'));}return _0x50c2df({'code':0xc8,'message':_0x82d733});}catch(_0x37d574){logger[_0xf0c5('0x2d')](_0x37d574['stack']);return _0x54524a(_0xf28c89[_0xf0c5('0x2d')](0x1f4,_0x37d574));}}logger[_0xf0c5('0x2d')](_0xf0c5('0x3d'));return _0x54524a(_0xf28c89[_0xf0c5('0x2d')](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0x57db62){var _0x27b348=this;return new Promise(function(_0x9d616e,_0x1c105d){if(_0x4b9886[_0xf0c5('0x3f')][_0xf0c5('0x42')](_0x57db62['id'])){for(var _0x4338bb in _0x57db62['capacity']){if(_0x57db62[_0xf0c5('0x43')][_0xf0c5('0x42')](_0x4338bb)){if(_0x4b9886['agents'][_0x57db62['id']][_0xf0c5('0x42')](_0x4338bb+_0xf0c5('0x44'))){_0x4b9886[_0xf0c5('0x3f')][_0x57db62['id']][_0x4338bb+_0xf0c5('0x44')]=parseInt(_0x57db62[_0xf0c5('0x43')][_0x4338bb],0xa);}}}_0x4b9886[_0xf0c5('0x3f')][_0x57db62['id']][_0xf0c5('0x45')]();return _0x9d616e({'code':0xc8,'message':_0x4b9886[_0xf0c5('0x3f')][_0x57db62['id']]});}else{return _0x1c105d(_0x27b348[_0xf0c5('0x2d')](0x1f4,'agent\x20not\x20found'));}});},'Agents':function(_0x5f10ed){return new Promise(function(_0x549c61,_0x35a555){var _0x2fb76d=_['values'](_0x4b9886[_0xf0c5('0x3f')]);_0x549c61({'count':_0x2fb76d[_0xf0c5('0x19')],'rows':_0x2fb76d});});},'ChatQueues':function(_0x3e1196){return new Promise(function(_0x33d0dc,_0x5d3e6b){var _0x4913f4=[];for(var _0x44e70d in _0x4b9886[_0xf0c5('0x46')]){if(_0x4b9886[_0xf0c5('0x46')][_0xf0c5('0x42')](_0x44e70d)){var _0x547599=_0x4b9886[_0xf0c5('0x46')][_0x44e70d];var _0x209118={'id':_0x547599['id'],'available':_0x547599[_0xf0c5('0x47')],'loggedIn':_0x547599[_0xf0c5('0x48')],'name':_0x547599[_0xf0c5('0x49')],'paused':_0x547599[_0xf0c5('0x4a')],'waiting':_0x547599['waiting']};_0x4913f4[_0xf0c5('0x1f')](_0x209118);}}_0x33d0dc({'count':_0x4913f4['length'],'rows':_0x4913f4});});},'MailQueues':function(_0x47a2ae){return new Promise(function(_0x5c470a,_0x163a73){var _0x165f30=[];for(var _0x16f141 in _0x4b9886[_0xf0c5('0x4b')]){if(_0x4b9886[_0xf0c5('0x4b')][_0xf0c5('0x42')](_0x16f141)){var _0x34d824=_0x4b9886[_0xf0c5('0x4b')][_0x16f141];var _0x4e1185={'id':_0x34d824['id'],'available':_0x34d824[_0xf0c5('0x47')],'loggedIn':_0x34d824['loggedIn'],'name':_0x34d824[_0xf0c5('0x49')],'paused':_0x34d824[_0xf0c5('0x4a')],'waiting':_0x34d824[_0xf0c5('0x4c')]};_0x165f30[_0xf0c5('0x1f')](_0x4e1185);}}_0x5c470a({'count':_0x165f30['length'],'rows':_0x165f30});});},'OpenchannelQueues':function(_0x39a77f){return new Promise(function(_0x3c2cfa,_0x110e33){var _0x782c59=[];for(var _0x588097 in _0x4b9886['openchannelQueues']){if(_0x4b9886['openchannelQueues'][_0xf0c5('0x42')](_0x588097)){var _0x2139d2=_0x4b9886['openchannelQueues'][_0x588097];var _0x3b812a={'id':_0x2139d2['id'],'available':_0x2139d2[_0xf0c5('0x47')],'loggedIn':_0x2139d2['loggedIn'],'name':_0x2139d2[_0xf0c5('0x49')],'paused':_0x2139d2[_0xf0c5('0x4a')],'waiting':_0x2139d2[_0xf0c5('0x4c')]};_0x782c59[_0xf0c5('0x1f')](_0x3b812a);}}_0x3c2cfa({'count':_0x782c59['length'],'rows':_0x782c59});});},'SmsQueues':function(_0x3ef79d){return new Promise(function(_0x4cd46e,_0x3a9d3b){var _0x375881=[];for(var _0x365391 in _0x4b9886[_0xf0c5('0x4d')]){if(_0x4b9886[_0xf0c5('0x4d')][_0xf0c5('0x42')](_0x365391)){var _0x11bde2=_0x4b9886[_0xf0c5('0x4d')][_0x365391];var _0x3f0bf7={'id':_0x11bde2['id'],'available':_0x11bde2[_0xf0c5('0x47')],'loggedIn':_0x11bde2['loggedIn'],'name':_0x11bde2[_0xf0c5('0x49')],'paused':_0x11bde2['paused'],'waiting':_0x11bde2[_0xf0c5('0x4c')]};_0x375881[_0xf0c5('0x1f')](_0x3f0bf7);}}_0x4cd46e({'count':_0x375881[_0xf0c5('0x19')],'rows':_0x375881});});},'FaxQueues':function(_0x3a28a3){return new Promise(function(_0x584666,_0x6650c9){var _0x3e1a12=[];for(var _0x5af208 in _0x4b9886[_0xf0c5('0x4e')]){if(_0x4b9886[_0xf0c5('0x4e')][_0xf0c5('0x42')](_0x5af208)){var _0x5e170f=_0x4b9886['faxQueues'][_0x5af208];var _0x332772={'id':_0x5e170f['id'],'available':_0x5e170f[_0xf0c5('0x47')],'loggedIn':_0x5e170f['loggedIn'],'name':_0x5e170f['name'],'paused':_0x5e170f['paused'],'waiting':_0x5e170f['waiting']};_0x3e1a12[_0xf0c5('0x1f')](_0x332772);}}_0x584666({'count':_0x3e1a12['length'],'rows':_0x3e1a12});});},'WhatsappQueues':function(_0x41c2d3){return new Promise(function(_0x29be60,_0x4ebf58){var _0x279f65=[];for(var _0x26ceff in _0x4b9886[_0xf0c5('0x4f')]){if(_0x4b9886[_0xf0c5('0x4f')]['hasOwnProperty'](_0x26ceff)){var _0xe4de50=_0x4b9886[_0xf0c5('0x4f')][_0x26ceff];var _0x3be27f={'id':_0xe4de50['id'],'available':_0xe4de50[_0xf0c5('0x47')],'loggedIn':_0xe4de50[_0xf0c5('0x48')],'name':_0xe4de50[_0xf0c5('0x49')],'paused':_0xe4de50[_0xf0c5('0x4a')],'waiting':_0xe4de50[_0xf0c5('0x4c')]};_0x279f65[_0xf0c5('0x1f')](_0x3be27f);}}_0x29be60({'count':_0x279f65[_0xf0c5('0x19')],'rows':_0x279f65});});},'ChatQueuesWaitingInteractions':function(_0x35a90e){return new Promise(function(_0x1d7843,_0x161526){var _0x3ea497=_[_0xf0c5('0x50')](_0x4b9886[_0xf0c5('0x51')]);_0x1d7843({'count':_0x3ea497[_0xf0c5('0x19')],'rows':_0x3ea497});});},'MailQueuesWaitingInteractions':function(_0x51593c){return new Promise(function(_0x219264,_0x1afd98){var _0xc87cfd=_[_0xf0c5('0x50')](_0x4b9886[_0xf0c5('0x52')]);_0x219264({'count':_0xc87cfd[_0xf0c5('0x19')],'rows':_0xc87cfd});});},'OpenchannelQueuesWaitingInteractions':function(_0x4e5d37){return new Promise(function(_0x3c0c6b,_0xa83fe6){var _0x20fd1d=_[_0xf0c5('0x50')](_0x4b9886[_0xf0c5('0x53')]);_0x3c0c6b({'count':_0x20fd1d[_0xf0c5('0x19')],'rows':_0x20fd1d});});},'SmsQueuesWaitingInteractions':function(_0x48866f){return new Promise(function(_0x5844db,_0x32f132){var _0x2509c6=_[_0xf0c5('0x50')](_0x4b9886['smsQueuesWaitingInteractions']);_0x5844db({'count':_0x2509c6['length'],'rows':_0x2509c6});});},'FaxQueuesWaitingInteractions':function(_0x4513c7){return new Promise(function(_0x43e267,_0x138687){var _0x2bef3b=_['values'](_0x4b9886[_0xf0c5('0x54')]);_0x43e267({'count':_0x2bef3b[_0xf0c5('0x19')],'rows':_0x2bef3b});});},'WhatsappQueuesWaitingInteractions':function(_0x96a746){return new Promise(function(_0x1b77d1,_0xdc5263){var _0x26764e=_[_0xf0c5('0x50')](_0x4b9886['whatsappQueuesWaitingInteractions']);_0x1b77d1({'count':_0x26764e[_0xf0c5('0x19')],'rows':_0x26764e});});}};var _0x586d13=jayson[_0xf0c5('0x55')](_0x52ecfe)[_0xf0c5('0x56')]();_0x586d13['on'](_0xf0c5('0x2d'),function(_0x363075){logger[_0xf0c5('0x2d')](JSON[_0xf0c5('0x57')](_0x363075));return _0x25f80b(_0x363075);});_0x586d13[_0xf0c5('0x13')](0x232c,_0xf0c5('0x58'),function(){console[_0xf0c5('0x59')]('Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232c);return _0x1d900d(_0xf0c5('0x5a')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index ac6d2d0..54c8cda 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 _0x8ff3=['../../../config/logger','client','http','request','then','error','message','catch','condition','rules','stop','Command','format','iftime\x20%s','indexOf','true','[%s][INTERVAL]\x20%s','[%s][INTERVAL]\x20%s\x20%s','when','log','join','\x20|\x20','stack','util','bluebird'];(function(_0x4af2ad,_0x53ca39){var _0x1a55f8=function(_0x4634a3){while(--_0x4634a3){_0x4af2ad['push'](_0x4af2ad['shift']());}};_0x1a55f8(++_0x53ca39);}(_0x8ff3,0x1a7));var _0x38ff=function(_0x27b423,_0x312583){_0x27b423=_0x27b423-0x0;var _0x5c11b8=_0x8ff3[_0x27b423];return _0x5c11b8;};'use strict';var util=require(_0x38ff('0x0'));var BPromise=require(_0x38ff('0x1'));var jayson=require('jayson/promise');var _=require('lodash');var logger=require(_0x38ff('0x2'))('routing');var client=jayson[_0x38ff('0x3')][_0x38ff('0x4')]({'port':0x232a});function request(_0x269ad9,_0x21c8a4){return new BPromise(function(_0x11959c,_0x2cb01e){return client[_0x38ff('0x5')](_0x269ad9,_0x21c8a4)[_0x38ff('0x6')](function(_0x4d948f){if(_0x4d948f[_0x38ff('0x7')]){return _0x2cb01e(_0x4d948f[_0x38ff('0x7')][_0x38ff('0x8')]);}else{return _0x11959c(_0x4d948f['result']);}})[_0x38ff('0x9')](function(_0x386a71){return _0x2cb01e(_0x386a71);});});}exports[_0x38ff('0xa')]=function(_0x43dbbf,_0x519523,_0x5d850c){return function(_0x1ca786){if(_0x5d850c[_0x38ff('0xb')]&&!_0x5d850c[_0x38ff('0xb')][_0x43dbbf]){logger['info']('[%s][INTERVAL]\x20ROUTING\x20STOPPED',_0x43dbbf);return _0x1ca786[_0x38ff('0xc')]();}var _0x52500b=[];for(var _0x35bc95=0x0;_0x35bc95<_0x519523['length'];_0x35bc95+=0x1){_0x52500b['push'](request(_0x38ff('0xd'),{'command':util[_0x38ff('0xe')](_0x38ff('0xf'),_0x519523[_0x35bc95])})[_0x38ff('0x6')](function(_0x333257){return _0x333257&&_0x333257[_0x38ff('0x8')]&&_0x333257[_0x38ff('0x8')][_0x38ff('0x10')](_0x38ff('0x11'))>=0x0?!![]:![];})[_0x38ff('0x9')](function(_0x31ef5a){logger[_0x38ff('0x7')](_0x38ff('0x12'),_0x43dbbf,_0x519523[_0x35bc95]);}));}BPromise['all'](_0x52500b)[_0x38ff('0x6')](function(_0x17519b){var _0x261032=_['some'](_0x17519b);logger['info'](_0x38ff('0x13'),_0x43dbbf,_0x519523['join']('\x20|\x20'),_0x261032);_0x1ca786[_0x38ff('0x14')](_0x261032);})[_0x38ff('0x9')](function(_0x42c8a3){console[_0x38ff('0x15')](_0x42c8a3);logger[_0x38ff('0x7')](_0x38ff('0x13'),_0x43dbbf,_0x519523[_0x38ff('0x16')](_0x38ff('0x17')),_0x42c8a3[_0x38ff('0x18')]);_0x1ca786[_0x38ff('0xc')]();});};}; \ No newline at end of file +var _0xbb0d=['stop','push','Command','iftime\x20%s','indexOf','[%s][INTERVAL]\x20%s','all','some','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','log','error','stack','util','jayson/promise','../../../config/logger','routing','client','http','request','then','message','result','catch','condition','rules','info'];(function(_0x59987a,_0x399e11){var _0x460646=function(_0x32c3c0){while(--_0x32c3c0){_0x59987a['push'](_0x59987a['shift']());}};_0x460646(++_0x399e11);}(_0xbb0d,0x188));var _0xdbb0=function(_0x1cdbff,_0x26125c){_0x1cdbff=_0x1cdbff-0x0;var _0x1c9201=_0xbb0d[_0x1cdbff];return _0x1c9201;};'use strict';var util=require(_0xdbb0('0x0'));var BPromise=require('bluebird');var jayson=require(_0xdbb0('0x1'));var _=require('lodash');var logger=require(_0xdbb0('0x2'))(_0xdbb0('0x3'));var client=jayson[_0xdbb0('0x4')][_0xdbb0('0x5')]({'port':0x232a});function request(_0xdb7075,_0x521df3){return new BPromise(function(_0x60030c,_0x2fd6e1){return client[_0xdbb0('0x6')](_0xdb7075,_0x521df3)[_0xdbb0('0x7')](function(_0x79f57c){if(_0x79f57c['error']){return _0x2fd6e1(_0x79f57c['error'][_0xdbb0('0x8')]);}else{return _0x60030c(_0x79f57c[_0xdbb0('0x9')]);}})[_0xdbb0('0xa')](function(_0x222e51){return _0x2fd6e1(_0x222e51);});});}exports[_0xdbb0('0xb')]=function(_0x23bf4c,_0x42a6b2,_0xd1ceb){return function(_0x2793c3){if(_0xd1ceb[_0xdbb0('0xc')]&&!_0xd1ceb[_0xdbb0('0xc')][_0x23bf4c]){logger[_0xdbb0('0xd')]('[%s][INTERVAL]\x20ROUTING\x20STOPPED',_0x23bf4c);return _0x2793c3[_0xdbb0('0xe')]();}var _0x129027=[];for(var _0x5c7323=0x0;_0x5c7323<_0x42a6b2['length'];_0x5c7323+=0x1){_0x129027[_0xdbb0('0xf')](request(_0xdbb0('0x10'),{'command':util['format'](_0xdbb0('0x11'),_0x42a6b2[_0x5c7323])})[_0xdbb0('0x7')](function(_0x13b9d1){return _0x13b9d1&&_0x13b9d1['message']&&_0x13b9d1['message'][_0xdbb0('0x12')]('true')>=0x0?!![]:![];})[_0xdbb0('0xa')](function(_0x3205b8){logger['error'](_0xdbb0('0x13'),_0x23bf4c,_0x42a6b2[_0x5c7323]);}));}BPromise[_0xdbb0('0x14')](_0x129027)[_0xdbb0('0x7')](function(_0x4087d1){var _0x5f025a=_[_0xdbb0('0x15')](_0x4087d1);logger['info'](_0xdbb0('0x16'),_0x23bf4c,_0x42a6b2[_0xdbb0('0x17')](_0xdbb0('0x18')),_0x5f025a);_0x2793c3[_0xdbb0('0x19')](_0x5f025a);})[_0xdbb0('0xa')](function(_0x3451db){console[_0xdbb0('0x1a')](_0x3451db);logger[_0xdbb0('0x1b')]('[%s][INTERVAL]\x20%s\x20%s',_0x23bf4c,_0x42a6b2[_0xdbb0('0x17')](_0xdbb0('0x18')),_0x3451db[_0xdbb0('0x1c')]);_0x2793c3[_0xdbb0('0xe')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 816923c..72c54fb 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 _0x49d9=['queue','getVoiceQueueByName','type','agentacw','acw','acwtime','CreateVoiceAgentReport','request','destuniqueid','agentcalled','agentcalledAt','now','called','connectedlinename','error','agentringnoanswer','isNil','agentringnoanswerAt','timeout','reason','holdtime','ringtime','talktime','push','stack','queuecallerabandon','abandoned','agentconnect','connect','forIn','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','agentcomplete','agentconnectAt','blindtransfer','transfereruniqueid','transfer','transfertype','blind','transferexten','transferuniqueid','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','transfereeuniqueid','agententerreason','clone','calleridnum','calleridname','secondtransfererlinkedid','ATTENDED','secondtransfererexten','transfertargetuniqueid','cause','rejected','splice','agent','complete','agentcompleteAt','diffTime','util','./utils','format','uniqueid','channel','membername','connectedlinenum','lastevent'];(function(_0x2f6054,_0x2be213){var _0x333803=function(_0x151fa1){while(--_0x151fa1){_0x2f6054['push'](_0x2f6054['shift']());}};_0x333803(++_0x2be213);}(_0x49d9,0x10c));var _0x949d=function(_0x1a2dac,_0x25dad6){_0x1a2dac=_0x1a2dac-0x0;var _0x289351=_0x49d9[_0x1a2dac];return _0x289351;};'use strict';var _=require('lodash');var util=require(_0x949d('0x0'));var utils=require(_0x949d('0x1'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x409ebf,_0xbc1f79){utils['info'](util[_0x949d('0x2')]('AGENT|%s|%s|%s|%s|%s|%s|%s|%s',_0x409ebf[_0x949d('0x3')],_0x409ebf[_0x949d('0x4')],_0x409ebf['queue'],_0x409ebf[_0x949d('0x5')],_0x409ebf['interface'],_0x409ebf['calleridnum'],_0x409ebf[_0x949d('0x6')],_0x409ebf[_0x949d('0x7')]));if(_0x409ebf[_0x949d('0x8')]){utils[_0x949d('0x9')](_0x409ebf['queue'])['then'](function(_0x3f6d08){if(_0x3f6d08){_0x409ebf[_0x949d('0xa')]=_0x3f6d08[_0x949d('0xa')];_0x409ebf[_0x949d('0xb')]=_0x409ebf['agentcomplete']?_0x3f6d08[_0x949d('0xc')]:![];_0x409ebf[_0x949d('0xd')]=_0x409ebf['agentacw']?_0x3f6d08['acwTimeout']:0x0;}utils['request'](_0x949d('0xe'),_0x409ebf);});}else{utils[_0x949d('0xf')](_0x949d('0xe'),_0x409ebf);}if(_0xbc1f79){delete transfers[_0x409ebf[_0x949d('0x3')]];}else{delete agents[_0x409ebf[_0x949d('0x10')]];}}exports[_0x949d('0x11')]=function(_0x59b494){try{agents[_0x59b494[_0x949d('0x10')]]=_0x59b494;agents[_0x59b494['destuniqueid']][_0x949d('0x12')]=utils[_0x949d('0x13')]();agents[_0x59b494[_0x949d('0x10')]][_0x949d('0x7')]=_0x949d('0x14');agents[_0x59b494['destuniqueid']][_0x949d('0x6')]=null;agents[_0x59b494['destuniqueid']][_0x949d('0x15')]=null;}catch(_0x459a87){utils[_0x949d('0x16')](_0x459a87['stack']);}};exports[_0x949d('0x17')]=function(_0x541ecc){try{if(!_[_0x949d('0x18')](agents[_0x541ecc[_0x949d('0x10')]])){agents[_0x541ecc[_0x949d('0x10')]]['agentringnoanswer']=!![];agents[_0x541ecc[_0x949d('0x10')]][_0x949d('0x19')]=utils[_0x949d('0x13')]();agents[_0x541ecc[_0x949d('0x10')]][_0x949d('0x7')]=_0x949d('0x1a');agents[_0x541ecc['destuniqueid']][_0x949d('0x1b')]=_0x949d('0x1a');agents[_0x541ecc['destuniqueid']][_0x949d('0x1c')]=_0x541ecc[_0x949d('0x1d')]?parseInt(_0x541ecc[_0x949d('0x1d')])/0x3e8:0x0;agents[_0x541ecc[_0x949d('0x10')]][_0x949d('0x1e')]=0x0;unanswered[_0x949d('0x1f')](_0x541ecc[_0x949d('0x10')]);}}catch(_0x971aa9){utils[_0x949d('0x16')](_0x971aa9[_0x949d('0x20')]);}};exports[_0x949d('0x21')]=function(_0x5d50c6){try{_['forIn'](agents,function(_0x108e28,_0x28a700){if(_0x108e28[_0x949d('0x3')]==_0x5d50c6[_0x949d('0x3')]&&!_['includes'](unanswered,_0x108e28[_0x949d('0x10')])){_0x108e28[_0x949d('0x17')]=!![];_0x108e28[_0x949d('0x19')]=utils[_0x949d('0x13')]();_0x108e28[_0x949d('0x7')]=_0x949d('0x22');_0x108e28[_0x949d('0x1b')]=_0x949d('0x22');_0x108e28[_0x949d('0x1c')]=_0x5d50c6[_0x949d('0x1c')];_0x108e28[_0x949d('0x1e')]=0x0;writeDB(_0x108e28);}});}catch(_0x159f02){utils[_0x949d('0x16')](_0x159f02[_0x949d('0x20')]);}};exports[_0x949d('0x23')]=function(_0x517688){try{if(agents[_0x517688['destuniqueid']]){agents[_0x517688[_0x949d('0x10')]]['agentconnectAt']=utils['now']();agents[_0x517688['destuniqueid']][_0x949d('0x6')]=_0x517688[_0x949d('0x6')];agents[_0x517688[_0x949d('0x10')]][_0x949d('0x15')]=_0x517688[_0x949d('0x15')];agents[_0x517688[_0x949d('0x10')]]['holdtime']=_0x517688['ringtime'];agents[_0x517688[_0x949d('0x10')]]['lastevent']=_0x949d('0x24');_[_0x949d('0x25')](agents,function(_0x3424cb,_0x2610b0){if(_0x3424cb[_0x949d('0x10')]!=_0x517688[_0x949d('0x10')]&&_0x3424cb[_0x949d('0x3')]==_0x517688['uniqueid']){_0x3424cb['talktime']=0x0;_0x3424cb[_0x949d('0x1c')]=_0x517688[_0x949d('0x1d')];_0x3424cb['agentringnoanswer']=!![];_0x3424cb[_0x949d('0x19')]=utils[_0x949d('0x13')]();_0x3424cb[_0x949d('0x7')]='answered_elsewhere';_0x3424cb[_0x949d('0x1b')]=_0x949d('0x26');_0x3424cb[_0x949d('0x27')]=_0x517688[_0x949d('0x10')];_0x3424cb[_0x949d('0x28')]=_0x517688[_0x949d('0x5')];writeDB(_0x3424cb);}});}}catch(_0x4a97d5){utils[_0x949d('0x16')](_0x4a97d5[_0x949d('0x20')]);}};exports[_0x949d('0x29')]=function(_0x4f8016){try{if(!_[_0x949d('0x18')](agents[_0x4f8016[_0x949d('0x10')]])){agents[_0x4f8016[_0x949d('0x10')]][_0x949d('0x29')]=!![];agents[_0x4f8016[_0x949d('0x10')]]['agentcompleteAt']=utils[_0x949d('0x13')]();agents[_0x4f8016[_0x949d('0x10')]][_0x949d('0x1e')]=utils['diffTime'](agents[_0x4f8016[_0x949d('0x10')]]['agentcompleteAt'],agents[_0x4f8016[_0x949d('0x10')]][_0x949d('0x2a')]);agents[_0x4f8016['destuniqueid']][_0x949d('0x1b')]=_0x4f8016[_0x949d('0x1b')];agents[_0x4f8016[_0x949d('0x10')]][_0x949d('0x7')]='complete';writeDB(agents[_0x4f8016[_0x949d('0x10')]]);}}catch(_0x4768c3){utils[_0x949d('0x16')](_0x4768c3[_0x949d('0x20')]);}};exports[_0x949d('0x2b')]=function(_0x5e17c4){try{if(!_[_0x949d('0x18')](agents[_0x5e17c4[_0x949d('0x2c')]])){agents[_0x5e17c4[_0x949d('0x2c')]][_0x949d('0x2d')]=!![];agents[_0x5e17c4[_0x949d('0x2c')]][_0x949d('0x2e')]=_0x949d('0x2f');agents[_0x5e17c4[_0x949d('0x2c')]][_0x949d('0x30')]=_0x5e17c4['extension'];agents[_0x5e17c4[_0x949d('0x2c')]][_0x949d('0x31')]=agents[_0x5e17c4['transfereruniqueid']][_0x949d('0x3')];}}catch(_0x49db0f){utils[_0x949d('0x16')](_0x49db0f[_0x949d('0x20')]);}};exports['attendedtransfer']=function(_0x3f25a7){try{if(_0x3f25a7[_0x949d('0x32')]==_0x3f25a7[_0x949d('0x33')]){if(!_[_0x949d('0x18')](agents[_0x3f25a7[_0x949d('0x34')]])){agents[_0x3f25a7[_0x949d('0x34')]]['transfer']=!![];agents[_0x3f25a7['secondtransfereruniqueid']][_0x949d('0x2e')]='ATTENDED';agents[_0x3f25a7[_0x949d('0x34')]][_0x949d('0x30')]=_0x3f25a7['origtransfererexten'];agents[_0x3f25a7['secondtransfereruniqueid']][_0x949d('0x31')]=_0x3f25a7[_0x949d('0x32')];}if(_0x3f25a7[_0x949d('0x35')]&&agents[_0x3f25a7['transfereeuniqueid']]){agents[_0x3f25a7[_0x949d('0x35')]][_0x949d('0x36')]=0x1;transfers[_0x3f25a7[_0x949d('0x35')]]=_[_0x949d('0x37')](agents[_0x3f25a7[_0x949d('0x35')]]);transfers[_0x3f25a7[_0x949d('0x35')]][_0x949d('0x38')]=agents[_0x3f25a7['secondtransfereruniqueid']][_0x949d('0x38')];transfers[_0x3f25a7[_0x949d('0x35')]]['calleridname']=agents[_0x3f25a7[_0x949d('0x34')]][_0x949d('0x39')];transfers[_0x3f25a7[_0x949d('0x35')]][_0x949d('0x12')]=utils['now']();transfers[_0x3f25a7['transfereeuniqueid']]['agentconnectAt']=utils[_0x949d('0x13')]();transfers[_0x3f25a7[_0x949d('0x35')]][_0x949d('0x1c')]=0x0;transfers[_0x3f25a7[_0x949d('0x35')]][_0x949d('0x36')]=0x2;}}else if(_0x3f25a7[_0x949d('0x34')]==_0x3f25a7[_0x949d('0x3a')]){if(!_['isNil'](agents[_0x3f25a7[_0x949d('0x32')]])){agents[_0x3f25a7['origtransfereruniqueid']][_0x949d('0x2d')]=!![];agents[_0x3f25a7[_0x949d('0x32')]][_0x949d('0x2e')]=_0x949d('0x3b');agents[_0x3f25a7[_0x949d('0x32')]][_0x949d('0x30')]=_0x3f25a7[_0x949d('0x3c')];agents[_0x3f25a7[_0x949d('0x32')]]['transferuniqueid']=_0x3f25a7[_0x949d('0x34')];}if(_0x3f25a7[_0x949d('0x3d')]&&agents[_0x3f25a7[_0x949d('0x3d')]]){agents[_0x3f25a7[_0x949d('0x3d')]][_0x949d('0x36')]=0x1;transfers[_0x3f25a7[_0x949d('0x3d')]]=_['clone'](agents[_0x3f25a7['transfertargetuniqueid']]);transfers[_0x3f25a7['transfertargetuniqueid']][_0x949d('0x38')]=agents[_0x3f25a7[_0x949d('0x32')]][_0x949d('0x38')];transfers[_0x3f25a7[_0x949d('0x3d')]][_0x949d('0x39')]=agents[_0x3f25a7[_0x949d('0x32')]][_0x949d('0x39')];transfers[_0x3f25a7[_0x949d('0x3d')]][_0x949d('0x12')]=utils['now']();transfers[_0x3f25a7[_0x949d('0x3d')]][_0x949d('0x2a')]=utils['now']();transfers[_0x3f25a7['transfertargetuniqueid']][_0x949d('0x1c')]=0x0;transfers[_0x3f25a7['transfertargetuniqueid']][_0x949d('0x36')]=0x2;}}}catch(_0x2b4e4d){utils[_0x949d('0x16')](_0x2b4e4d[_0x949d('0x20')]);}};exports['hangup']=function(_0x290439){try{if(agents[_0x290439['uniqueid']]&&agents[_0x290439[_0x949d('0x3')]]['reason']===_0x949d('0x1a')){if(_0x290439[_0x949d('0x3e')]==='21'){agents[_0x290439[_0x949d('0x3')]]['reason']=_0x949d('0x3f');agents[_0x290439['uniqueid']]['lastevent']=_0x949d('0x3f');}writeDB(agents[_0x290439[_0x949d('0x3')]]);var _0x59cadb=unanswered['indexOf'](_0x290439[_0x949d('0x3')]);if(_0x59cadb>-0x1)unanswered[_0x949d('0x40')](_0x59cadb,0x1);}if(transfers[_0x290439[_0x949d('0x3')]]){transfers[_0x290439[_0x949d('0x3')]][_0x949d('0x29')]=!![];transfers[_0x290439[_0x949d('0x3')]]['agentcompleteAt']=utils['now']();transfers[_0x290439[_0x949d('0x3')]][_0x949d('0x1e')]=utils['diffTime'](transfers[_0x290439[_0x949d('0x3')]]['agentcompleteAt'],transfers[_0x290439['uniqueid']][_0x949d('0x2a')]);transfers[_0x290439[_0x949d('0x3')]][_0x949d('0x1b')]=_0x949d('0x41');transfers[_0x290439[_0x949d('0x3')]][_0x949d('0x7')]=_0x949d('0x42');writeDB(transfers[_0x290439[_0x949d('0x3')]],!![]);}if(agents[_0x290439[_0x949d('0x3')]]&&agents[_0x290439[_0x949d('0x3')]][_0x949d('0x2a')]){agents[_0x290439[_0x949d('0x3')]]['agentcomplete']=!![];agents[_0x290439['uniqueid']][_0x949d('0x43')]=utils[_0x949d('0x13')]();agents[_0x290439[_0x949d('0x3')]][_0x949d('0x1e')]=utils[_0x949d('0x44')](agents[_0x290439[_0x949d('0x3')]][_0x949d('0x43')],agents[_0x290439['uniqueid']][_0x949d('0x2a')]);agents[_0x290439[_0x949d('0x3')]][_0x949d('0x1b')]=agents[_0x290439[_0x949d('0x3')]][_0x949d('0x2d')]?_0x949d('0x2d'):_0x949d('0x41');agents[_0x290439['uniqueid']][_0x949d('0x7')]=_0x949d('0x42');writeDB(agents[_0x290439['uniqueid']]);}}catch(_0x306196){utils[_0x949d('0x16')](_0x306196['stack']);}}; \ No newline at end of file +var _0x521d=['transfertype','blind','transferexten','extension','attendedtransfer','origtransfereruniqueid','secondtransfereruniqueid','ATTENDED','transferuniqueid','transfereeuniqueid','agententerreason','clone','calleridname','transfertargetuniqueid','cause','rejected','splice','agent','util','./utils','info','format','AGENT|%s|%s|%s|%s|%s|%s|%s|%s','uniqueid','channel','queue','interface','calleridnum','connectedlinenum','lastevent','getVoiceQueueByName','then','agentacw','agentcomplete','acwtime','request','CreateVoiceAgentReport','destuniqueid','agentcalled','agentcalledAt','now','called','connectedlinename','error','agentringnoanswer','isNil','timeout','reason','holdtime','ringtime','talktime','push','stack','queuecallerabandon','includes','agentringnoanswerAt','abandoned','agentconnect','agentconnectAt','forIn','answered_elsewhere','answeredelsewheredestinationuniqueid','membername','agentcompleteAt','diffTime','complete','blindtransfer','transfereruniqueid','transfer'];(function(_0x32f5af,_0x8ed3f1){var _0x290ebe=function(_0x17d947){while(--_0x17d947){_0x32f5af['push'](_0x32f5af['shift']());}};_0x290ebe(++_0x8ed3f1);}(_0x521d,0x16b));var _0xd521=function(_0xf20b6,_0x49ddbb){_0xf20b6=_0xf20b6-0x0;var _0x4ff567=_0x521d[_0xf20b6];return _0x4ff567;};'use strict';var _=require('lodash');var util=require(_0xd521('0x0'));var utils=require(_0xd521('0x1'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x32417c,_0x16f860){utils[_0xd521('0x2')](util[_0xd521('0x3')](_0xd521('0x4'),_0x32417c[_0xd521('0x5')],_0x32417c[_0xd521('0x6')],_0x32417c[_0xd521('0x7')],_0x32417c['membername'],_0x32417c[_0xd521('0x8')],_0x32417c[_0xd521('0x9')],_0x32417c[_0xd521('0xa')],_0x32417c[_0xd521('0xb')]));if(_0x32417c[_0xd521('0x7')]){utils[_0xd521('0xc')](_0x32417c[_0xd521('0x7')])[_0xd521('0xd')](function(_0x2b5846){if(_0x2b5846){_0x32417c['type']=_0x2b5846['type'];_0x32417c[_0xd521('0xe')]=_0x32417c[_0xd521('0xf')]?_0x2b5846['acw']:![];_0x32417c[_0xd521('0x10')]=_0x32417c[_0xd521('0xe')]?_0x2b5846['acwTimeout']:0x0;}utils[_0xd521('0x11')](_0xd521('0x12'),_0x32417c);});}else{utils[_0xd521('0x11')](_0xd521('0x12'),_0x32417c);}if(_0x16f860){delete transfers[_0x32417c[_0xd521('0x5')]];}else{delete agents[_0x32417c[_0xd521('0x13')]];}}exports[_0xd521('0x14')]=function(_0x250f9f){try{agents[_0x250f9f['destuniqueid']]=_0x250f9f;agents[_0x250f9f[_0xd521('0x13')]][_0xd521('0x15')]=utils[_0xd521('0x16')]();agents[_0x250f9f['destuniqueid']]['lastevent']=_0xd521('0x17');agents[_0x250f9f[_0xd521('0x13')]][_0xd521('0xa')]=null;agents[_0x250f9f[_0xd521('0x13')]][_0xd521('0x18')]=null;}catch(_0x40ccd3){utils[_0xd521('0x19')](_0x40ccd3['stack']);}};exports[_0xd521('0x1a')]=function(_0x2a24db){try{if(!_[_0xd521('0x1b')](agents[_0x2a24db[_0xd521('0x13')]])){agents[_0x2a24db[_0xd521('0x13')]]['agentringnoanswer']=!![];agents[_0x2a24db[_0xd521('0x13')]]['agentringnoanswerAt']=utils[_0xd521('0x16')]();agents[_0x2a24db['destuniqueid']][_0xd521('0xb')]=_0xd521('0x1c');agents[_0x2a24db['destuniqueid']][_0xd521('0x1d')]=_0xd521('0x1c');agents[_0x2a24db[_0xd521('0x13')]][_0xd521('0x1e')]=_0x2a24db[_0xd521('0x1f')]?parseInt(_0x2a24db[_0xd521('0x1f')])/0x3e8:0x0;agents[_0x2a24db[_0xd521('0x13')]][_0xd521('0x20')]=0x0;unanswered[_0xd521('0x21')](_0x2a24db['destuniqueid']);}}catch(_0x29ce0f){utils[_0xd521('0x19')](_0x29ce0f[_0xd521('0x22')]);}};exports[_0xd521('0x23')]=function(_0x4ec004){try{_['forIn'](agents,function(_0x48bbd4,_0x1126fe){if(_0x48bbd4[_0xd521('0x5')]==_0x4ec004[_0xd521('0x5')]&&!_[_0xd521('0x24')](unanswered,_0x48bbd4['destuniqueid'])){_0x48bbd4[_0xd521('0x1a')]=!![];_0x48bbd4[_0xd521('0x25')]=utils['now']();_0x48bbd4[_0xd521('0xb')]='abandoned';_0x48bbd4[_0xd521('0x1d')]=_0xd521('0x26');_0x48bbd4[_0xd521('0x1e')]=_0x4ec004[_0xd521('0x1e')];_0x48bbd4[_0xd521('0x20')]=0x0;writeDB(_0x48bbd4);}});}catch(_0x46ebbd){utils[_0xd521('0x19')](_0x46ebbd[_0xd521('0x22')]);}};exports[_0xd521('0x27')]=function(_0x56b518){try{if(agents[_0x56b518[_0xd521('0x13')]]){agents[_0x56b518[_0xd521('0x13')]][_0xd521('0x28')]=utils[_0xd521('0x16')]();agents[_0x56b518[_0xd521('0x13')]][_0xd521('0xa')]=_0x56b518['connectedlinenum'];agents[_0x56b518[_0xd521('0x13')]]['connectedlinename']=_0x56b518[_0xd521('0x18')];agents[_0x56b518[_0xd521('0x13')]]['holdtime']=_0x56b518[_0xd521('0x1f')];agents[_0x56b518['destuniqueid']][_0xd521('0xb')]='connect';_[_0xd521('0x29')](agents,function(_0xc8ced6,_0x1f1450){if(_0xc8ced6[_0xd521('0x13')]!=_0x56b518[_0xd521('0x13')]&&_0xc8ced6[_0xd521('0x5')]==_0x56b518[_0xd521('0x5')]){_0xc8ced6[_0xd521('0x20')]=0x0;_0xc8ced6[_0xd521('0x1e')]=_0x56b518['ringtime'];_0xc8ced6[_0xd521('0x1a')]=!![];_0xc8ced6[_0xd521('0x25')]=utils['now']();_0xc8ced6['lastevent']='answered_elsewhere';_0xc8ced6[_0xd521('0x1d')]=_0xd521('0x2a');_0xc8ced6[_0xd521('0x2b')]=_0x56b518[_0xd521('0x13')];_0xc8ced6['answeredelsewheremembername']=_0x56b518[_0xd521('0x2c')];writeDB(_0xc8ced6);}});}}catch(_0x2c637c){utils[_0xd521('0x19')](_0x2c637c[_0xd521('0x22')]);}};exports[_0xd521('0xf')]=function(_0x206487){try{if(!_[_0xd521('0x1b')](agents[_0x206487['destuniqueid']])){agents[_0x206487[_0xd521('0x13')]][_0xd521('0xf')]=!![];agents[_0x206487[_0xd521('0x13')]][_0xd521('0x2d')]=utils[_0xd521('0x16')]();agents[_0x206487[_0xd521('0x13')]][_0xd521('0x20')]=utils[_0xd521('0x2e')](agents[_0x206487[_0xd521('0x13')]]['agentcompleteAt'],agents[_0x206487['destuniqueid']][_0xd521('0x28')]);agents[_0x206487[_0xd521('0x13')]]['reason']=_0x206487[_0xd521('0x1d')];agents[_0x206487[_0xd521('0x13')]]['lastevent']=_0xd521('0x2f');writeDB(agents[_0x206487['destuniqueid']]);}}catch(_0x4479a2){utils[_0xd521('0x19')](_0x4479a2[_0xd521('0x22')]);}};exports[_0xd521('0x30')]=function(_0x3df22c){try{if(!_[_0xd521('0x1b')](agents[_0x3df22c[_0xd521('0x31')]])){agents[_0x3df22c['transfereruniqueid']][_0xd521('0x32')]=!![];agents[_0x3df22c[_0xd521('0x31')]][_0xd521('0x33')]=_0xd521('0x34');agents[_0x3df22c['transfereruniqueid']][_0xd521('0x35')]=_0x3df22c[_0xd521('0x36')];agents[_0x3df22c[_0xd521('0x31')]]['transferuniqueid']=agents[_0x3df22c[_0xd521('0x31')]][_0xd521('0x5')];}}catch(_0x3d63f9){utils[_0xd521('0x19')](_0x3d63f9[_0xd521('0x22')]);}};exports[_0xd521('0x37')]=function(_0x4bace2){try{if(_0x4bace2[_0xd521('0x38')]==_0x4bace2['origtransfererlinkedid']){if(!_['isNil'](agents[_0x4bace2[_0xd521('0x39')]])){agents[_0x4bace2[_0xd521('0x39')]]['transfer']=!![];agents[_0x4bace2[_0xd521('0x39')]][_0xd521('0x33')]=_0xd521('0x3a');agents[_0x4bace2[_0xd521('0x39')]][_0xd521('0x35')]=_0x4bace2['origtransfererexten'];agents[_0x4bace2['secondtransfereruniqueid']][_0xd521('0x3b')]=_0x4bace2['origtransfereruniqueid'];}if(_0x4bace2[_0xd521('0x3c')]&&agents[_0x4bace2[_0xd521('0x3c')]]){agents[_0x4bace2[_0xd521('0x3c')]][_0xd521('0x3d')]=0x1;transfers[_0x4bace2[_0xd521('0x3c')]]=_[_0xd521('0x3e')](agents[_0x4bace2['transfereeuniqueid']]);transfers[_0x4bace2[_0xd521('0x3c')]]['calleridnum']=agents[_0x4bace2[_0xd521('0x39')]][_0xd521('0x9')];transfers[_0x4bace2['transfereeuniqueid']][_0xd521('0x3f')]=agents[_0x4bace2[_0xd521('0x39')]][_0xd521('0x3f')];transfers[_0x4bace2['transfereeuniqueid']][_0xd521('0x15')]=utils[_0xd521('0x16')]();transfers[_0x4bace2[_0xd521('0x3c')]][_0xd521('0x28')]=utils[_0xd521('0x16')]();transfers[_0x4bace2[_0xd521('0x3c')]]['holdtime']=0x0;transfers[_0x4bace2[_0xd521('0x3c')]]['agententerreason']=0x2;}}else if(_0x4bace2[_0xd521('0x39')]==_0x4bace2['secondtransfererlinkedid']){if(!_['isNil'](agents[_0x4bace2['origtransfereruniqueid']])){agents[_0x4bace2['origtransfereruniqueid']]['transfer']=!![];agents[_0x4bace2['origtransfereruniqueid']][_0xd521('0x33')]='ATTENDED';agents[_0x4bace2['origtransfereruniqueid']][_0xd521('0x35')]=_0x4bace2['secondtransfererexten'];agents[_0x4bace2['origtransfereruniqueid']][_0xd521('0x3b')]=_0x4bace2['secondtransfereruniqueid'];}if(_0x4bace2['transfertargetuniqueid']&&agents[_0x4bace2[_0xd521('0x40')]]){agents[_0x4bace2[_0xd521('0x40')]][_0xd521('0x3d')]=0x1;transfers[_0x4bace2[_0xd521('0x40')]]=_[_0xd521('0x3e')](agents[_0x4bace2[_0xd521('0x40')]]);transfers[_0x4bace2[_0xd521('0x40')]]['calleridnum']=agents[_0x4bace2[_0xd521('0x38')]][_0xd521('0x9')];transfers[_0x4bace2[_0xd521('0x40')]]['calleridname']=agents[_0x4bace2[_0xd521('0x38')]][_0xd521('0x3f')];transfers[_0x4bace2['transfertargetuniqueid']][_0xd521('0x15')]=utils[_0xd521('0x16')]();transfers[_0x4bace2['transfertargetuniqueid']]['agentconnectAt']=utils[_0xd521('0x16')]();transfers[_0x4bace2[_0xd521('0x40')]][_0xd521('0x1e')]=0x0;transfers[_0x4bace2[_0xd521('0x40')]][_0xd521('0x3d')]=0x2;}}}catch(_0x529ea4){utils[_0xd521('0x19')](_0x529ea4[_0xd521('0x22')]);}};exports['hangup']=function(_0x42ab29){try{if(agents[_0x42ab29[_0xd521('0x5')]]&&agents[_0x42ab29[_0xd521('0x5')]][_0xd521('0x1d')]==='timeout'){if(_0x42ab29[_0xd521('0x41')]==='21'){agents[_0x42ab29['uniqueid']][_0xd521('0x1d')]=_0xd521('0x42');agents[_0x42ab29[_0xd521('0x5')]]['lastevent']=_0xd521('0x42');}writeDB(agents[_0x42ab29['uniqueid']]);var _0x2ed6b2=unanswered['indexOf'](_0x42ab29[_0xd521('0x5')]);if(_0x2ed6b2>-0x1)unanswered[_0xd521('0x43')](_0x2ed6b2,0x1);}if(transfers[_0x42ab29[_0xd521('0x5')]]){transfers[_0x42ab29[_0xd521('0x5')]][_0xd521('0xf')]=!![];transfers[_0x42ab29['uniqueid']][_0xd521('0x2d')]=utils[_0xd521('0x16')]();transfers[_0x42ab29[_0xd521('0x5')]][_0xd521('0x20')]=utils[_0xd521('0x2e')](transfers[_0x42ab29['uniqueid']]['agentcompleteAt'],transfers[_0x42ab29[_0xd521('0x5')]][_0xd521('0x28')]);transfers[_0x42ab29[_0xd521('0x5')]][_0xd521('0x1d')]=_0xd521('0x44');transfers[_0x42ab29[_0xd521('0x5')]][_0xd521('0xb')]=_0xd521('0x2f');writeDB(transfers[_0x42ab29[_0xd521('0x5')]],!![]);}if(agents[_0x42ab29['uniqueid']]&&agents[_0x42ab29[_0xd521('0x5')]][_0xd521('0x28')]){agents[_0x42ab29[_0xd521('0x5')]][_0xd521('0xf')]=!![];agents[_0x42ab29[_0xd521('0x5')]][_0xd521('0x2d')]=utils[_0xd521('0x16')]();agents[_0x42ab29[_0xd521('0x5')]][_0xd521('0x20')]=utils[_0xd521('0x2e')](agents[_0x42ab29[_0xd521('0x5')]]['agentcompleteAt'],agents[_0x42ab29[_0xd521('0x5')]][_0xd521('0x28')]);agents[_0x42ab29[_0xd521('0x5')]]['reason']=agents[_0x42ab29[_0xd521('0x5')]]['transfer']?'transfer':_0xd521('0x44');agents[_0x42ab29['uniqueid']][_0xd521('0xb')]=_0xd521('0x2f');writeDB(agents[_0x42ab29[_0xd521('0x5')]]);}}catch(_0x584aa8){utils[_0xd521('0x19')](_0x584aa8[_0xd521('0x22')]);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index bdd32bf..18bd39d 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 _0x75c8=['musiconholdstartAt','mohtime','xmd-originatecalleridnum','source','value','xmd-phone','\x22\x20<','variable','xmd-callerid','xmd-queue','xmcs-queue','lastapplication','Queue','lastdata','xmd-contactid','ContactId','xmd-cdrtype','outboundrouteid','routeid','sipcallid','newexten','application','toLowerCase','set','startsWith','appdata','cdr','split','substring','lastIndexOf','noop','execif','gotoif','lodash','util','./utils','NO\x20ANSWER','FAILED','BUSY','CALL|%s|%s|%s|%s|%s|%s|%s|%s','uniqueid','channel','type','accountcode','destination','callerid','disposition','getUserByInternal','then','UserId','request','CreateVoiceCallReport','newchannel','linkedid','OutgoingSpoolFailed','calleridnum','exten','context','DOCUMENTATION','error','stack','isNil','channelstate','transfer','destinationchannel','answertime','now','toNumber','ANSWERED','hangup','calleridname','endtime','duration','diffTime','starttime','localtwolinkedid','transfereechannel','userfield','_attended','transfertargetchannel'];(function(_0x318840,_0x561b1e){var _0x223da4=function(_0x510071){while(--_0x510071){_0x318840['push'](_0x318840['shift']());}};_0x223da4(++_0x561b1e);}(_0x75c8,0x1b1));var _0x875c=function(_0x551393,_0x4ef62b){_0x551393=_0x551393-0x0;var _0x2c0e03=_0x75c8[_0x551393];return _0x2c0e03;};'use strict';var _=require(_0x875c('0x0'));var util=require(_0x875c('0x1'));var utils=require(_0x875c('0x2'));var dispositions=[_0x875c('0x3'),'FAILED',_0x875c('0x4'),_0x875c('0x3'),_0x875c('0x3'),_0x875c('0x3'),'ANSWERED',_0x875c('0x5'),_0x875c('0x4'),_0x875c('0x4'),_0x875c('0x4')];var channels={};function writeDB(_0xa996d3){utils['info'](util['format'](_0x875c('0x6'),_0xa996d3[_0x875c('0x7')],_0xa996d3[_0x875c('0x8')],_0xa996d3[_0x875c('0x9')],_0xa996d3[_0x875c('0xa')],_0xa996d3['source'],_0xa996d3[_0x875c('0xb')],_0xa996d3[_0x875c('0xc')],_0xa996d3[_0x875c('0xd')]));if(_0xa996d3[_0x875c('0xa')]){utils[_0x875c('0xe')](_0xa996d3[_0x875c('0xa')])[_0x875c('0xf')](function(_0x2be696){if(_0x2be696){_0xa996d3[_0x875c('0x10')]=_0x2be696['id'];}utils[_0x875c('0x11')](_0x875c('0x12'),_0xa996d3);});}else{utils[_0x875c('0x11')](_0x875c('0x12'),_0xa996d3);}if(channels[_0xa996d3[_0x875c('0x7')]]){delete channels[_0xa996d3[_0x875c('0x7')]];}}exports[_0x875c('0x13')]=function(_0x496045){try{if(_0x496045[_0x875c('0x7')]==_0x496045[_0x875c('0x14')]&&_0x496045[_0x875c('0x8')]!=_0x875c('0x15')){channels[_0x496045[_0x875c('0x7')]]={'uniqueid':_0x496045['uniqueid'],'accountcode':_0x496045[_0x875c('0xa')],'source':_0x496045[_0x875c('0x16')],'destination':_0x496045[_0x875c('0x17')],'destinationcontext':_0x496045[_0x875c('0x18')],'channel':_0x496045['channel'],'starttime':utils['now'](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x875c('0x3'),'amaflags':_0x875c('0x19')};}}catch(_0x29ee55){utils[_0x875c('0x1a')](_0x29ee55[_0x875c('0x1b')]);}};exports['newstate']=function(_0xa0708b){try{if(!_[_0x875c('0x1c')](channels[_0xa0708b['uniqueid']])&&_0xa0708b['channelstate']==0x6){if(_[_0x875c('0x1c')](channels[_0xa0708b[_0x875c('0x7')]]['systemanswertime'])){channels[_0xa0708b[_0x875c('0x7')]]['systemanswertime']=utils['now']();}}else if(!_[_0x875c('0x1c')](channels[_0xa0708b[_0x875c('0x14')]])&&_0xa0708b[_0x875c('0x1d')]==0x6&&_0xa0708b['context']!=_0x875c('0x1e')){channels[_0xa0708b['linkedid']]['accountcode']=_0xa0708b[_0x875c('0xa')];channels[_0xa0708b[_0x875c('0x14')]][_0x875c('0x1f')]=_0xa0708b[_0x875c('0x8')];if(_[_0x875c('0x1c')](channels[_0xa0708b[_0x875c('0x14')]][_0x875c('0x20')])){channels[_0xa0708b[_0x875c('0x14')]][_0x875c('0x20')]=utils[_0x875c('0x21')]();}channels[_0xa0708b[_0x875c('0x14')]][_0x875c('0xd')]=dispositions[_[_0x875c('0x22')](_0xa0708b[_0x875c('0x1d')])]||_0x875c('0x23');}}catch(_0xa2767b){utils[_0x875c('0x1a')](_0xa2767b[_0x875c('0x1b')]);}};exports[_0x875c('0x24')]=function(_0x62807d){try{if(!_[_0x875c('0x1c')](channels[_0x62807d[_0x875c('0x7')]])){if(_[_0x875c('0x1c')](channels[_0x62807d[_0x875c('0x7')]][_0x875c('0xc')])){channels[_0x62807d['uniqueid']][_0x875c('0xc')]=_0x62807d[_0x875c('0x25')]+'\x20<'+_0x62807d[_0x875c('0x16')]+'>';}channels[_0x62807d[_0x875c('0x7')]][_0x875c('0x26')]=utils[_0x875c('0x21')]();channels[_0x62807d[_0x875c('0x7')]][_0x875c('0x27')]=utils[_0x875c('0x28')](channels[_0x62807d[_0x875c('0x7')]][_0x875c('0x26')],channels[_0x62807d[_0x875c('0x7')]][_0x875c('0x29')]);channels[_0x62807d[_0x875c('0x7')]]['billableseconds']=channels[_0x62807d[_0x875c('0x7')]][_0x875c('0x20')]?utils[_0x875c('0x28')](channels[_0x62807d[_0x875c('0x7')]][_0x875c('0x26')],channels[_0x62807d[_0x875c('0x7')]][_0x875c('0x20')]):0x0;writeDB(channels[_0x62807d['uniqueid']]);}}catch(_0x708a2e){utils[_0x875c('0x1a')](_0x708a2e['stack']);}};exports['attendedtransfer']=function(_0x1b8d15){try{if(!_['isNil'](channels[_0x1b8d15[_0x875c('0x2a')]])){if(channels[_0x1b8d15['localtwolinkedid']]['channel']==_0x1b8d15[_0x875c('0x2b')]){channels[_0x1b8d15[_0x875c('0x2a')]]['destinationchannel']=_0x1b8d15['secondtransfererchannel'];channels[_0x1b8d15[_0x875c('0x2a')]][_0x875c('0x2c')]=_0x875c('0x2d');}else if(channels[_0x1b8d15[_0x875c('0x2a')]][_0x875c('0x8')]=_0x1b8d15[_0x875c('0x2e')]){channels[_0x1b8d15[_0x875c('0x2a')]][_0x875c('0x1f')]=_0x1b8d15['origtransfererchannel'];channels[_0x1b8d15[_0x875c('0x2a')]][_0x875c('0x2c')]=_0x875c('0x2d');}}}catch(_0x1fcb13){utils[_0x875c('0x1a')](_0x1fcb13[_0x875c('0x1b')]);}};exports['musiconholdstart']=function(_0x50b15a){try{if(!_[_0x875c('0x1c')](channels[_0x50b15a['uniqueid']])){channels[_0x50b15a[_0x875c('0x7')]][_0x875c('0x2f')]=utils[_0x875c('0x21')]();}}catch(_0x2e7813){utils['error'](_0x2e7813[_0x875c('0x1b')]);}};exports['musiconholdstop']=function(_0x286b45){try{if(!_['isNil'](channels[_0x286b45['uniqueid']])){if(!_[_0x875c('0x1c')](channels[_0x286b45[_0x875c('0x7')]][_0x875c('0x2f')])){channels[_0x286b45[_0x875c('0x7')]][_0x875c('0x30')]+=utils[_0x875c('0x28')](utils[_0x875c('0x21')](),channels[_0x286b45[_0x875c('0x7')]][_0x875c('0x2f')]);delete channels[_0x286b45[_0x875c('0x7')]]['musiconholdstartAt'];}}}catch(_0x5c3da2){utils[_0x875c('0x1a')](_0x5c3da2[_0x875c('0x1b')]);}};exports['varset']=function(_0x5c3457){try{if(!_[_0x875c('0x1c')](channels[_0x5c3457[_0x875c('0x7')]])){if(!_[_0x875c('0x1c')](_0x5c3457['variable'][_0x875c('0x31')])){channels[_0x5c3457[_0x875c('0x7')]][_0x875c('0x32')]=_0x5c3457[_0x875c('0x33')];}if(!_['isNil'](_0x5c3457['variable'][_0x875c('0x34')])){channels[_0x5c3457[_0x875c('0x7')]][_0x875c('0xb')]=_0x5c3457[_0x875c('0x33')];channels[_0x5c3457[_0x875c('0x7')]][_0x875c('0xc')]='\x22'+_0x5c3457['value']+_0x875c('0x35')+_0x5c3457[_0x875c('0x33')]+'>';}if(!_['isNil'](_0x5c3457['variable']['xmd-callerid-preview'])||!_[_0x875c('0x1c')](_0x5c3457[_0x875c('0x36')][_0x875c('0x37')])){channels[_0x5c3457[_0x875c('0x7')]]['callerid']=_0x5c3457[_0x875c('0x33')];}if(!_['isNil'](_0x5c3457[_0x875c('0x36')][_0x875c('0x38')])||!_[_0x875c('0x1c')](_0x5c3457[_0x875c('0x36')][_0x875c('0x39')])){channels[_0x5c3457[_0x875c('0x7')]][_0x875c('0x3a')]=_0x875c('0x3b');channels[_0x5c3457[_0x875c('0x7')]][_0x875c('0x3c')]=_0x5c3457[_0x875c('0x33')];channels[_0x5c3457[_0x875c('0x7')]]['queue']=!![];}if(!_[_0x875c('0x1c')](_0x5c3457[_0x875c('0x36')][_0x875c('0x3d')])){channels[_0x5c3457[_0x875c('0x7')]][_0x875c('0x3e')]=_0x5c3457[_0x875c('0x33')];}if(!_[_0x875c('0x1c')](_0x5c3457['variable'][_0x875c('0x3f')])){channels[_0x5c3457[_0x875c('0x7')]][_0x875c('0x9')]=_0x5c3457[_0x875c('0x33')];}if(!_[_0x875c('0x1c')](_0x5c3457[_0x875c('0x36')][_0x875c('0x40')])){channels[_0x5c3457[_0x875c('0x7')]][_0x875c('0x41')]=_0x5c3457[_0x875c('0x33')];}if(!_['isNil'](_0x5c3457[_0x875c('0x36')][_0x875c('0x42')])){channels[_0x5c3457[_0x875c('0x7')]]['sipcallid']=_0x5c3457['value'];}}}catch(_0x10806c){utils['error'](_0x10806c[_0x875c('0x1b')]);}};exports[_0x875c('0x43')]=function(_0xc6395d){try{if(!_[_0x875c('0x1c')](channels[_0xc6395d['uniqueid']])){if(_0xc6395d[_0x875c('0x44')][_0x875c('0x45')]()==_0x875c('0x46')&&_[_0x875c('0x47')](_0xc6395d[_0x875c('0x48')][_0x875c('0x45')](),_0x875c('0x49'))){var _0x2bfc04=_0xc6395d[_0x875c('0x48')][_0x875c('0x4a')]('=');var _0x201e85=_0x2bfc04[0x0][_0x875c('0x4b')](_0x2bfc04[0x0][_0x875c('0x4c')]('(')+0x1,_0x2bfc04[0x0][_0x875c('0x4c')](')'));var _0xe4609e=_0x2bfc04[0x1];channels[_0xc6395d[_0x875c('0x7')]][_0x201e85]=_0xe4609e;}if(!_['includes'](['hangup',_0x875c('0x4d'),_0x875c('0x4e'),'set',_0x875c('0x4f')],_0xc6395d[_0x875c('0x44')][_0x875c('0x45')]())){channels[_0xc6395d[_0x875c('0x7')]]['lastapplication']=_0xc6395d[_0x875c('0x44')];channels[_0xc6395d[_0x875c('0x7')]][_0x875c('0x3c')]=_0xc6395d[_0x875c('0x48')];}}}catch(_0x4245cd){utils['error'](_0x4245cd[_0x875c('0x1b')]);}}; \ No newline at end of file +var _0x78f9=['error','isNil','channelstate','systemanswertime','transfer','destinationchannel','answertime','toNumber','stack','hangup','calleridnum','endtime','duration','starttime','billableseconds','attendedtransfer','localtwolinkedid','transfereechannel','secondtransfererchannel','_attended','musiconholdstart','musiconholdstartAt','musiconholdstop','diffTime','varset','variable','xmd-originatecalleridnum','source','value','xmd-phone','xmd-queue','xmcs-queue','lastdata','xmd-contactid','ContactId','xmd-cdrtype','outboundrouteid','routeid','sipcallid','newexten','application','set','startsWith','appdata','cdr','substring','lastIndexOf','includes','noop','execif','toLowerCase','lastapplication','util','NO\x20ANSWER','FAILED','ANSWERED','BUSY','CALL|%s|%s|%s|%s|%s|%s|%s|%s','uniqueid','channel','type','accountcode','callerid','disposition','then','UserId','request','CreateVoiceCallReport','linkedid','OutgoingSpoolFailed','context','now','DOCUMENTATION'];(function(_0x3feb60,_0x3c5847){var _0x15b391=function(_0x5ac8cb){while(--_0x5ac8cb){_0x3feb60['push'](_0x3feb60['shift']());}};_0x15b391(++_0x3c5847);}(_0x78f9,0x10f));var _0x978f=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0x78f9[_0x55e08b];return _0xd1a7ff;};'use strict';var _=require('lodash');var util=require(_0x978f('0x0'));var utils=require('./utils');var dispositions=[_0x978f('0x1'),_0x978f('0x2'),_0x978f('0x2'),_0x978f('0x1'),_0x978f('0x1'),'NO\x20ANSWER',_0x978f('0x3'),_0x978f('0x4'),_0x978f('0x2'),_0x978f('0x2'),'FAILED'];var channels={};function writeDB(_0x2b6add){utils['info'](util['format'](_0x978f('0x5'),_0x2b6add[_0x978f('0x6')],_0x2b6add[_0x978f('0x7')],_0x2b6add[_0x978f('0x8')],_0x2b6add[_0x978f('0x9')],_0x2b6add['source'],_0x2b6add['destination'],_0x2b6add[_0x978f('0xa')],_0x2b6add[_0x978f('0xb')]));if(_0x2b6add[_0x978f('0x9')]){utils['getUserByInternal'](_0x2b6add[_0x978f('0x9')])[_0x978f('0xc')](function(_0x1cb969){if(_0x1cb969){_0x2b6add[_0x978f('0xd')]=_0x1cb969['id'];}utils[_0x978f('0xe')](_0x978f('0xf'),_0x2b6add);});}else{utils[_0x978f('0xe')]('CreateVoiceCallReport',_0x2b6add);}if(channels[_0x2b6add[_0x978f('0x6')]]){delete channels[_0x2b6add[_0x978f('0x6')]];}}exports['newchannel']=function(_0x13b593){try{if(_0x13b593['uniqueid']==_0x13b593[_0x978f('0x10')]&&_0x13b593[_0x978f('0x7')]!=_0x978f('0x11')){channels[_0x13b593['uniqueid']]={'uniqueid':_0x13b593[_0x978f('0x6')],'accountcode':_0x13b593['accountcode'],'source':_0x13b593['calleridnum'],'destination':_0x13b593['exten'],'destinationcontext':_0x13b593[_0x978f('0x12')],'channel':_0x13b593[_0x978f('0x7')],'starttime':utils[_0x978f('0x13')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x978f('0x1'),'amaflags':_0x978f('0x14')};}}catch(_0x257bd9){utils[_0x978f('0x15')](_0x257bd9['stack']);}};exports['newstate']=function(_0x5bc165){try{if(!_[_0x978f('0x16')](channels[_0x5bc165[_0x978f('0x6')]])&&_0x5bc165[_0x978f('0x17')]==0x6){if(_[_0x978f('0x16')](channels[_0x5bc165['uniqueid']][_0x978f('0x18')])){channels[_0x5bc165[_0x978f('0x6')]]['systemanswertime']=utils[_0x978f('0x13')]();}}else if(!_[_0x978f('0x16')](channels[_0x5bc165[_0x978f('0x10')]])&&_0x5bc165[_0x978f('0x17')]==0x6&&_0x5bc165[_0x978f('0x12')]!=_0x978f('0x19')){channels[_0x5bc165[_0x978f('0x10')]][_0x978f('0x9')]=_0x5bc165[_0x978f('0x9')];channels[_0x5bc165[_0x978f('0x10')]][_0x978f('0x1a')]=_0x5bc165[_0x978f('0x7')];if(_['isNil'](channels[_0x5bc165[_0x978f('0x10')]][_0x978f('0x1b')])){channels[_0x5bc165[_0x978f('0x10')]][_0x978f('0x1b')]=utils[_0x978f('0x13')]();}channels[_0x5bc165['linkedid']]['disposition']=dispositions[_[_0x978f('0x1c')](_0x5bc165[_0x978f('0x17')])]||_0x978f('0x3');}}catch(_0x323d94){utils[_0x978f('0x15')](_0x323d94[_0x978f('0x1d')]);}};exports[_0x978f('0x1e')]=function(_0x352361){try{if(!_[_0x978f('0x16')](channels[_0x352361[_0x978f('0x6')]])){if(_[_0x978f('0x16')](channels[_0x352361[_0x978f('0x6')]][_0x978f('0xa')])){channels[_0x352361['uniqueid']][_0x978f('0xa')]=_0x352361['calleridname']+'\x20<'+_0x352361[_0x978f('0x1f')]+'>';}channels[_0x352361[_0x978f('0x6')]][_0x978f('0x20')]=utils['now']();channels[_0x352361['uniqueid']][_0x978f('0x21')]=utils['diffTime'](channels[_0x352361['uniqueid']][_0x978f('0x20')],channels[_0x352361[_0x978f('0x6')]][_0x978f('0x22')]);channels[_0x352361[_0x978f('0x6')]][_0x978f('0x23')]=channels[_0x352361[_0x978f('0x6')]][_0x978f('0x1b')]?utils['diffTime'](channels[_0x352361[_0x978f('0x6')]]['endtime'],channels[_0x352361[_0x978f('0x6')]][_0x978f('0x1b')]):0x0;writeDB(channels[_0x352361[_0x978f('0x6')]]);}}catch(_0x9125ab){utils[_0x978f('0x15')](_0x9125ab[_0x978f('0x1d')]);}};exports[_0x978f('0x24')]=function(_0x17b5e3){try{if(!_[_0x978f('0x16')](channels[_0x17b5e3[_0x978f('0x25')]])){if(channels[_0x17b5e3[_0x978f('0x25')]][_0x978f('0x7')]==_0x17b5e3[_0x978f('0x26')]){channels[_0x17b5e3[_0x978f('0x25')]][_0x978f('0x1a')]=_0x17b5e3[_0x978f('0x27')];channels[_0x17b5e3['localtwolinkedid']]['userfield']=_0x978f('0x28');}else if(channels[_0x17b5e3['localtwolinkedid']][_0x978f('0x7')]=_0x17b5e3['transfertargetchannel']){channels[_0x17b5e3[_0x978f('0x25')]][_0x978f('0x1a')]=_0x17b5e3['origtransfererchannel'];channels[_0x17b5e3[_0x978f('0x25')]]['userfield']=_0x978f('0x28');}}}catch(_0x49915f){utils[_0x978f('0x15')](_0x49915f['stack']);}};exports[_0x978f('0x29')]=function(_0x37ae88){try{if(!_[_0x978f('0x16')](channels[_0x37ae88[_0x978f('0x6')]])){channels[_0x37ae88[_0x978f('0x6')]][_0x978f('0x2a')]=utils[_0x978f('0x13')]();}}catch(_0x2cbffc){utils[_0x978f('0x15')](_0x2cbffc[_0x978f('0x1d')]);}};exports[_0x978f('0x2b')]=function(_0x46f935){try{if(!_['isNil'](channels[_0x46f935[_0x978f('0x6')]])){if(!_[_0x978f('0x16')](channels[_0x46f935['uniqueid']][_0x978f('0x2a')])){channels[_0x46f935['uniqueid']]['mohtime']+=utils[_0x978f('0x2c')](utils[_0x978f('0x13')](),channels[_0x46f935['uniqueid']][_0x978f('0x2a')]);delete channels[_0x46f935[_0x978f('0x6')]][_0x978f('0x2a')];}}}catch(_0x55420d){utils[_0x978f('0x15')](_0x55420d[_0x978f('0x1d')]);}};exports[_0x978f('0x2d')]=function(_0x2a31f4){try{if(!_[_0x978f('0x16')](channels[_0x2a31f4[_0x978f('0x6')]])){if(!_[_0x978f('0x16')](_0x2a31f4[_0x978f('0x2e')][_0x978f('0x2f')])){channels[_0x2a31f4['uniqueid']][_0x978f('0x30')]=_0x2a31f4[_0x978f('0x31')];}if(!_[_0x978f('0x16')](_0x2a31f4[_0x978f('0x2e')][_0x978f('0x32')])){channels[_0x2a31f4[_0x978f('0x6')]]['destination']=_0x2a31f4[_0x978f('0x31')];channels[_0x2a31f4[_0x978f('0x6')]][_0x978f('0xa')]='\x22'+_0x2a31f4[_0x978f('0x31')]+'\x22\x20<'+_0x2a31f4[_0x978f('0x31')]+'>';}if(!_[_0x978f('0x16')](_0x2a31f4['variable']['xmd-callerid-preview'])||!_[_0x978f('0x16')](_0x2a31f4['variable']['xmd-callerid'])){channels[_0x2a31f4['uniqueid']]['callerid']=_0x2a31f4[_0x978f('0x31')];}if(!_['isNil'](_0x2a31f4[_0x978f('0x2e')][_0x978f('0x33')])||!_[_0x978f('0x16')](_0x2a31f4[_0x978f('0x2e')][_0x978f('0x34')])){channels[_0x2a31f4[_0x978f('0x6')]]['lastapplication']='Queue';channels[_0x2a31f4['uniqueid']][_0x978f('0x35')]=_0x2a31f4[_0x978f('0x31')];channels[_0x2a31f4[_0x978f('0x6')]]['queue']=!![];}if(!_[_0x978f('0x16')](_0x2a31f4['variable'][_0x978f('0x36')])){channels[_0x2a31f4['uniqueid']][_0x978f('0x37')]=_0x2a31f4[_0x978f('0x31')];}if(!_[_0x978f('0x16')](_0x2a31f4[_0x978f('0x2e')][_0x978f('0x38')])){channels[_0x2a31f4[_0x978f('0x6')]][_0x978f('0x8')]=_0x2a31f4[_0x978f('0x31')];}if(!_[_0x978f('0x16')](_0x2a31f4['variable'][_0x978f('0x39')])){channels[_0x2a31f4[_0x978f('0x6')]][_0x978f('0x3a')]=_0x2a31f4[_0x978f('0x31')];}if(!_[_0x978f('0x16')](_0x2a31f4['variable']['sipcallid'])){channels[_0x2a31f4[_0x978f('0x6')]][_0x978f('0x3b')]=_0x2a31f4[_0x978f('0x31')];}}}catch(_0x38a525){utils[_0x978f('0x15')](_0x38a525[_0x978f('0x1d')]);}};exports[_0x978f('0x3c')]=function(_0x11a48e){try{if(!_[_0x978f('0x16')](channels[_0x11a48e[_0x978f('0x6')]])){if(_0x11a48e[_0x978f('0x3d')]['toLowerCase']()==_0x978f('0x3e')&&_[_0x978f('0x3f')](_0x11a48e[_0x978f('0x40')]['toLowerCase'](),_0x978f('0x41'))){var _0x5d9c92=_0x11a48e[_0x978f('0x40')]['split']('=');var _0x1af99d=_0x5d9c92[0x0][_0x978f('0x42')](_0x5d9c92[0x0][_0x978f('0x43')]('(')+0x1,_0x5d9c92[0x0]['lastIndexOf'](')'));var _0xfacf01=_0x5d9c92[0x1];channels[_0x11a48e[_0x978f('0x6')]][_0x1af99d]=_0xfacf01;}if(!_[_0x978f('0x44')]([_0x978f('0x1e'),_0x978f('0x45'),_0x978f('0x46'),_0x978f('0x3e'),'gotoif'],_0x11a48e[_0x978f('0x3d')][_0x978f('0x47')]())){channels[_0x11a48e[_0x978f('0x6')]][_0x978f('0x48')]=_0x11a48e[_0x978f('0x3d')];channels[_0x11a48e[_0x978f('0x6')]][_0x978f('0x35')]=_0x11a48e['appdata'];}}}catch(_0x565f2d){utils[_0x978f('0x15')](_0x565f2d[_0x978f('0x1d')]);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 3743763..950e412 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 _0x1261=['lodash','connect','info','CONNECTED','shutdown','SHUTDOWN','fullybooted','FULLYBOOTED','error','close','CLOSE','managerevent'];(function(_0xa9d458,_0x41d203){var _0x246c8c=function(_0x4c7fbb){while(--_0x4c7fbb){_0xa9d458['push'](_0xa9d458['shift']());}};_0x246c8c(++_0x41d203);}(_0x1261,0x144));var _0x1126=function(_0x3060e3,_0x14f2c6){_0x3060e3=_0x3060e3-0x0;var _0x497d2c=_0x1261[_0x3060e3];return _0x497d2c;};'use strict';var utils=require('./utils');var _=require(_0x1126('0x0'));exports[_0x1126('0x1')]=function(){utils[_0x1126('0x2')](_0x1126('0x3'));};exports[_0x1126('0x4')]=function(){utils[_0x1126('0x2')](_0x1126('0x5'));};exports[_0x1126('0x6')]=function(){utils[_0x1126('0x2')](_0x1126('0x7'));};exports['error']=function(_0x5c68c8){utils[_0x1126('0x8')](_0x5c68c8);};exports[_0x1126('0x9')]=function(){utils['info'](_0x1126('0xa'));};exports[_0x1126('0xb')]=function(_0x245be9){}; \ No newline at end of file +var _0x5fab=['managerevent','./utils','lodash','info','CONNECTED','shutdown','SHUTDOWN','fullybooted','FULLYBOOTED','error','CLOSE'];(function(_0x3a7935,_0x53bb36){var _0x22b4f1=function(_0x33c340){while(--_0x33c340){_0x3a7935['push'](_0x3a7935['shift']());}};_0x22b4f1(++_0x53bb36);}(_0x5fab,0x177));var _0xb5fa=function(_0x3ec1da,_0x1e36f5){_0x3ec1da=_0x3ec1da-0x0;var _0x472358=_0x5fab[_0x3ec1da];return _0x472358;};'use strict';var utils=require(_0xb5fa('0x0'));var _=require(_0xb5fa('0x1'));exports['connect']=function(){utils[_0xb5fa('0x2')](_0xb5fa('0x3'));};exports[_0xb5fa('0x4')]=function(){utils[_0xb5fa('0x2')](_0xb5fa('0x5'));};exports[_0xb5fa('0x6')]=function(){utils[_0xb5fa('0x2')](_0xb5fa('0x7'));};exports[_0xb5fa('0x8')]=function(_0x44df89){utils['error'](_0x44df89);};exports['close']=function(){utils[_0xb5fa('0x2')](_0xb5fa('0x9'));};exports[_0xb5fa('0xa')]=function(_0x56d018){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 1491ed8..2002ece 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 _0x56a8=['CreateVoiceDialReport','newexten','set','startsWith','appdata','toLowerCase','cdr(routeid)','error','varset','isNil','variable','outboundrouteid','stack','assign','now','lastevent','called','answertime','connect','complete','duration','diffTime','endtime','starttime','holdtime','billableseconds','util','info','format','DIAL|%s|%s|%s|%s|%s|%s','uniqueid','channel','calleridnum','connectedlinenum','dialstatus','request'];(function(_0xaee011,_0x4a2cce){var _0x30eff6=function(_0x811d50){while(--_0x811d50){_0xaee011['push'](_0xaee011['shift']());}};_0x30eff6(++_0x4a2cce);}(_0x56a8,0x13a));var _0x856a=function(_0x59f312,_0xf60bb8){_0x59f312=_0x59f312-0x0;var _0x469ad2=_0x56a8[_0x59f312];return _0x469ad2;};'use strict';var _=require('lodash');var util=require(_0x856a('0x0'));var utils=require('./utils');var dials={};function writeDB(_0x2bd869){utils[_0x856a('0x1')](util[_0x856a('0x2')](_0x856a('0x3'),_0x2bd869[_0x856a('0x4')],_0x2bd869[_0x856a('0x5')],_0x2bd869['dialstring'],_0x2bd869[_0x856a('0x6')],_0x2bd869[_0x856a('0x7')],_0x2bd869[_0x856a('0x8')]));utils[_0x856a('0x9')](_0x856a('0xa'),_0x2bd869);delete dials[_0x2bd869[_0x856a('0x4')]];}exports[_0x856a('0xb')]=function(_0x301c96){try{if(_0x301c96['application']['toLowerCase']()==_0x856a('0xc')&&_[_0x856a('0xd')](_0x301c96[_0x856a('0xe')][_0x856a('0xf')](),_0x856a('0x10'))){var _0x583333=_0x301c96[_0x856a('0xe')]['split']('=');dials[_0x301c96[_0x856a('0x4')]]={'routeId':_0x583333[0x1]};}}catch(_0x119453){utils[_0x856a('0x11')](_0x119453['stack']);}};exports[_0x856a('0x12')]=function(_0x5b0a55){try{if(!_[_0x856a('0x13')](_0x5b0a55[_0x856a('0x14')][_0x856a('0x15')])){dials[_0x5b0a55[_0x856a('0x4')]]={'routeId':_0x5b0a55['value']};}}catch(_0x277bd7){utils['error'](_0x277bd7[_0x856a('0x16')]);}};exports['dialbegin']=function(_0x52a6e6){try{if(!_['isNil'](dials[_0x52a6e6[_0x856a('0x4')]])){dials[_0x52a6e6['uniqueid']]=_[_0x856a('0x17')](dials[_0x52a6e6['uniqueid']],_0x52a6e6);dials[_0x52a6e6[_0x856a('0x4')]]['starttime']=utils[_0x856a('0x18')]();dials[_0x52a6e6[_0x856a('0x4')]][_0x856a('0x19')]=_0x856a('0x1a');}}catch(_0x576e9c){utils[_0x856a('0x11')](_0x576e9c[_0x856a('0x16')]);}};exports['dialend']=function(_0x324038){try{if(!_['isNil'](dials[_0x324038[_0x856a('0x4')]])){dials[_0x324038[_0x856a('0x4')]][_0x856a('0x8')]=_0x324038[_0x856a('0x8')];if(_0x324038[_0x856a('0x8')]=='ANSWER'){dials[_0x324038[_0x856a('0x4')]]=_[_0x856a('0x17')](dials[_0x324038['uniqueid']],_0x324038);dials[_0x324038[_0x856a('0x4')]][_0x856a('0x1b')]=utils[_0x856a('0x18')]();dials[_0x324038[_0x856a('0x4')]]['lastevent']=_0x856a('0x1c');}}}catch(_0x4ede26){utils[_0x856a('0x11')](_0x4ede26['stack']);}};exports['hangup']=function(_0xec7cc2){try{if(!_['isNil'](dials[_0xec7cc2[_0x856a('0x4')]])){dials[_0xec7cc2[_0x856a('0x4')]]=_[_0x856a('0x17')](dials[_0xec7cc2[_0x856a('0x4')]],{'endtime':utils[_0x856a('0x18')](),'lastevent':_0x856a('0x1d')});dials[_0xec7cc2[_0x856a('0x4')]][_0x856a('0x1e')]=utils[_0x856a('0x1f')](dials[_0xec7cc2[_0x856a('0x4')]][_0x856a('0x20')],dials[_0xec7cc2[_0x856a('0x4')]][_0x856a('0x21')]);dials[_0xec7cc2['uniqueid']][_0x856a('0x22')]=utils[_0x856a('0x1f')](dials[_0xec7cc2[_0x856a('0x4')]][_0x856a('0x1b')]||dials[_0xec7cc2[_0x856a('0x4')]][_0x856a('0x20')],dials[_0xec7cc2[_0x856a('0x4')]]['starttime']);dials[_0xec7cc2[_0x856a('0x4')]][_0x856a('0x23')]=dials[_0xec7cc2[_0x856a('0x4')]]['answertime']?utils['diffTime'](dials[_0xec7cc2[_0x856a('0x4')]][_0x856a('0x20')],dials[_0xec7cc2[_0x856a('0x4')]]['answertime']):0x0;writeDB(dials[_0xec7cc2[_0x856a('0x4')]]);}}catch(_0x5f4284){utils['error'](_0x5f4284[_0x856a('0x16')]);}}; \ No newline at end of file +var _0x98ad=['hangup','isNil','complete','duration','diffTime','endtime','holdtime','answertime','billableseconds','lodash','./utils','info','format','uniqueid','channel','dialstring','calleridnum','connectedlinenum','request','CreateVoiceDialReport','newexten','application','set','appdata','toLowerCase','cdr(routeid)','stack','varset','variable','outboundrouteid','value','dialbegin','assign','starttime','now','lastevent','dialend','dialstatus','ANSWER','error'];(function(_0x29b729,_0x30f838){var _0x3d2aad=function(_0x1aa06b){while(--_0x1aa06b){_0x29b729['push'](_0x29b729['shift']());}};_0x3d2aad(++_0x30f838);}(_0x98ad,0x1c1));var _0xd98a=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x98ad[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0xd98a('0x0'));var util=require('util');var utils=require(_0xd98a('0x1'));var dials={};function writeDB(_0x541be5){utils[_0xd98a('0x2')](util[_0xd98a('0x3')]('DIAL|%s|%s|%s|%s|%s|%s',_0x541be5[_0xd98a('0x4')],_0x541be5[_0xd98a('0x5')],_0x541be5[_0xd98a('0x6')],_0x541be5[_0xd98a('0x7')],_0x541be5[_0xd98a('0x8')],_0x541be5['dialstatus']));utils[_0xd98a('0x9')](_0xd98a('0xa'),_0x541be5);delete dials[_0x541be5[_0xd98a('0x4')]];}exports[_0xd98a('0xb')]=function(_0x56d62b){try{if(_0x56d62b[_0xd98a('0xc')]['toLowerCase']()==_0xd98a('0xd')&&_['startsWith'](_0x56d62b[_0xd98a('0xe')][_0xd98a('0xf')](),_0xd98a('0x10'))){var _0x14537e=_0x56d62b[_0xd98a('0xe')]['split']('=');dials[_0x56d62b[_0xd98a('0x4')]]={'routeId':_0x14537e[0x1]};}}catch(_0x514925){utils['error'](_0x514925[_0xd98a('0x11')]);}};exports[_0xd98a('0x12')]=function(_0x21de4e){try{if(!_['isNil'](_0x21de4e[_0xd98a('0x13')][_0xd98a('0x14')])){dials[_0x21de4e[_0xd98a('0x4')]]={'routeId':_0x21de4e[_0xd98a('0x15')]};}}catch(_0x3a24a7){utils['error'](_0x3a24a7[_0xd98a('0x11')]);}};exports[_0xd98a('0x16')]=function(_0x274e58){try{if(!_['isNil'](dials[_0x274e58[_0xd98a('0x4')]])){dials[_0x274e58[_0xd98a('0x4')]]=_[_0xd98a('0x17')](dials[_0x274e58[_0xd98a('0x4')]],_0x274e58);dials[_0x274e58[_0xd98a('0x4')]][_0xd98a('0x18')]=utils[_0xd98a('0x19')]();dials[_0x274e58['uniqueid']][_0xd98a('0x1a')]='called';}}catch(_0xe991e1){utils['error'](_0xe991e1[_0xd98a('0x11')]);}};exports[_0xd98a('0x1b')]=function(_0x267419){try{if(!_['isNil'](dials[_0x267419[_0xd98a('0x4')]])){dials[_0x267419[_0xd98a('0x4')]]['dialstatus']=_0x267419[_0xd98a('0x1c')];if(_0x267419[_0xd98a('0x1c')]==_0xd98a('0x1d')){dials[_0x267419[_0xd98a('0x4')]]=_['assign'](dials[_0x267419[_0xd98a('0x4')]],_0x267419);dials[_0x267419[_0xd98a('0x4')]]['answertime']=utils[_0xd98a('0x19')]();dials[_0x267419['uniqueid']][_0xd98a('0x1a')]='connect';}}}catch(_0x46a69d){utils[_0xd98a('0x1e')](_0x46a69d[_0xd98a('0x11')]);}};exports[_0xd98a('0x1f')]=function(_0x3ba738){try{if(!_[_0xd98a('0x20')](dials[_0x3ba738[_0xd98a('0x4')]])){dials[_0x3ba738['uniqueid']]=_[_0xd98a('0x17')](dials[_0x3ba738[_0xd98a('0x4')]],{'endtime':utils[_0xd98a('0x19')](),'lastevent':_0xd98a('0x21')});dials[_0x3ba738['uniqueid']][_0xd98a('0x22')]=utils[_0xd98a('0x23')](dials[_0x3ba738[_0xd98a('0x4')]][_0xd98a('0x24')],dials[_0x3ba738[_0xd98a('0x4')]]['starttime']);dials[_0x3ba738[_0xd98a('0x4')]][_0xd98a('0x25')]=utils[_0xd98a('0x23')](dials[_0x3ba738[_0xd98a('0x4')]][_0xd98a('0x26')]||dials[_0x3ba738[_0xd98a('0x4')]][_0xd98a('0x24')],dials[_0x3ba738['uniqueid']][_0xd98a('0x18')]);dials[_0x3ba738[_0xd98a('0x4')]][_0xd98a('0x27')]=dials[_0x3ba738[_0xd98a('0x4')]][_0xd98a('0x26')]?utils['diffTime'](dials[_0x3ba738[_0xd98a('0x4')]][_0xd98a('0x24')],dials[_0x3ba738[_0xd98a('0x4')]][_0xd98a('0x26')]):0x0;writeDB(dials[_0x3ba738[_0xd98a('0x4')]]);}}catch(_0x2cd810){utils['error'](_0x2cd810[_0xd98a('0x11')]);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 54336e2..807a830 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 _0xe54e=['port','keepConnected','xdr','disabled','info','XDR\x20DISABLED','./agents.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','agentcalled','agentringnoanswer','agentconnect','agentcomplete','queuecallerabandon','queuecallerjoin','queuecallerleave','musiconholdstart','musiconholdstop','newstate','hangup','cdr','blindtransfer','attendedtransfer','varset','newexten','newchannel','dialend','asterisk-manager','../../config/environment','./utils','asterisk'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xe54e,0x1e8));var _0xee54=function(_0x3fc428,_0x5232c6){_0x3fc428=_0x3fc428-0x0;var _0x598897=_0xe54e[_0x3fc428];return _0x598897;};var AsteriskManager=require(_0xee54('0x0'));var config=require(_0xee54('0x1'));var utils=require(_0xee54('0x2'));var ami=new AsteriskManager(config[_0xee54('0x3')][_0xee54('0x4')],config[_0xee54('0x3')]['ip'],config[_0xee54('0x3')]['username'],config[_0xee54('0x3')]['password'],!![]);ami[_0xee54('0x5')]();if(config[_0xee54('0x6')]&&config[_0xee54('0x6')][_0xee54('0x7')]){utils[_0xee54('0x8')](_0xee54('0x9'));}else{var agents=require(_0xee54('0xa'));var calls=require('./calls.controller');var queues=require(_0xee54('0xb'));var recordings=require(_0xee54('0xc'));var members=require(_0xee54('0xd'));var dials=require(_0xee54('0xe'));var transfers=require(_0xee54('0xf'));var core=require('./core.controller');ami['on'](_0xee54('0x10'),core[_0xee54('0x10')]);ami['on']('shutdown',core[_0xee54('0x11')]);ami['on'](_0xee54('0x12'),core[_0xee54('0x12')]);ami['on']('error',core[_0xee54('0x13')]);ami['on'](_0xee54('0x14'),core['close']);ami['on']('managerevent',core[_0xee54('0x15')]);ami['on'](_0xee54('0x16'),function(_0x396356){try{members[_0xee54('0x16')](_0x396356);}catch(_0x98914){utils[_0xee54('0x13')](_0x98914);}});ami['on'](_0xee54('0x17'),function(_0xddf235){try{agents['agentcalled'](_0xddf235);}catch(_0x59af3f){utils['error'](_0x59af3f);}});ami['on'](_0xee54('0x18'),function(_0x511c01){try{agents[_0xee54('0x18')](_0x511c01);}catch(_0x1ddd56){utils[_0xee54('0x13')](_0x1ddd56);}});ami['on']('agentconnect',function(_0x42182b){try{agents[_0xee54('0x19')](_0x42182b);queues[_0xee54('0x19')](_0x42182b);}catch(_0x302d29){utils[_0xee54('0x13')](_0x302d29);}});ami['on']('agentcomplete',function(_0x58a292){try{agents[_0xee54('0x1a')](_0x58a292);queues[_0xee54('0x1a')](_0x58a292);members[_0xee54('0x1a')](_0x58a292);}catch(_0x4c048a){utils[_0xee54('0x13')](_0x4c048a);}});ami['on'](_0xee54('0x1b'),function(_0x55db09){try{agents[_0xee54('0x1b')](_0x55db09);queues[_0xee54('0x1b')](_0x55db09);}catch(_0x47b407){utils[_0xee54('0x13')](_0x47b407);}});ami['on'](_0xee54('0x1c'),function(_0x258fbb){try{queues['queuecallerjoin'](_0x258fbb);recordings[_0xee54('0x1c')](_0x258fbb);}catch(_0x494d49){utils['error'](_0x494d49);}});ami['on'](_0xee54('0x1d'),function(_0x51f7c0){try{queues[_0xee54('0x1d')](_0x51f7c0);}catch(_0x56b6ec){utils[_0xee54('0x13')](_0x56b6ec);}});ami['on'](_0xee54('0x1e'),function(_0x12874d){try{queues['musiconholdstart'](_0x12874d);calls[_0xee54('0x1e')](_0x12874d);}catch(_0x2a8963){utils[_0xee54('0x13')](_0x2a8963);}});ami['on'](_0xee54('0x1f'),function(_0x368afc){try{queues[_0xee54('0x1f')](_0x368afc);calls[_0xee54('0x1f')](_0x368afc);}catch(_0x540de5){utils[_0xee54('0x13')](_0x540de5);}});ami['on'](_0xee54('0x20'),function(_0x1132df){try{calls['newstate'](_0x1132df);recordings[_0xee54('0x20')](_0x1132df);}catch(_0x5b380c){utils['error'](_0x5b380c);}});ami['on'](_0xee54('0x21'),function(_0x1d092e){try{calls[_0xee54('0x21')](_0x1d092e);recordings[_0xee54('0x21')](_0x1d092e);dials['hangup'](_0x1d092e);agents[_0xee54('0x21')](_0x1d092e);queues['hangup'](_0x1d092e);}catch(_0x1dcdfa){utils['error'](_0x1dcdfa);}});ami['on']('cdr',function(_0xac1a30){try{members[_0xee54('0x22')](_0xac1a30);}catch(_0x27bf9b){utils['error'](_0x27bf9b);}});ami['on'](_0xee54('0x23'),function(_0x24ff57){try{queues['blindtransfer'](_0x24ff57);agents[_0xee54('0x23')](_0x24ff57);transfers['blindtransfer'](_0x24ff57);}catch(_0x3c3984){utils[_0xee54('0x13')](_0x3c3984);}});ami['on'](_0xee54('0x24'),function(_0x114bec){try{queues['attendedtransfer'](_0x114bec);transfers[_0xee54('0x24')](_0x114bec);agents[_0xee54('0x24')](_0x114bec);calls[_0xee54('0x24')](_0x114bec);}catch(_0x220e7e){utils['error'](_0x220e7e);}});ami['on'](_0xee54('0x25'),function(_0x38bdb0){try{queues[_0xee54('0x25')](_0x38bdb0);recordings[_0xee54('0x25')](_0x38bdb0);calls[_0xee54('0x25')](_0x38bdb0);dials['varset'](_0x38bdb0);}catch(_0x312ee1){utils['error'](_0x312ee1);}});ami['on'](_0xee54('0x26'),function(_0x26a8a){try{calls[_0xee54('0x26')](_0x26a8a);recordings[_0xee54('0x26')](_0x26a8a);dials[_0xee54('0x26')](_0x26a8a);}catch(_0xfa0a27){utils['error'](_0xfa0a27);}});ami['on'](_0xee54('0x27'),function(_0x3c034a){try{calls[_0xee54('0x27')](_0x3c034a);recordings[_0xee54('0x27')](_0x3c034a);}catch(_0x3e4652){utils[_0xee54('0x13')](_0x3e4652);}});ami['on']('dialbegin',function(_0x29646a){try{dials['dialbegin'](_0x29646a);}catch(_0x4b09fd){utils[_0xee54('0x13')](_0x4b09fd);}});ami['on']('dialend',function(_0x195343){try{dials[_0xee54('0x28')](_0x195343);}catch(_0x1fc8d3){utils[_0xee54('0x13')](_0x1fc8d3);}});} \ No newline at end of file +var _0xe7a3=['cdr','blindtransfer','attendedtransfer','varset','newexten','newchannel','dialbegin','dialend','asterisk-manager','../../config/environment','./utils','asterisk','username','keepConnected','xdr','info','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','managerevent','devicestatechange','agentcalled','agentringnoanswer','agentconnect','agentcomplete','queuecallerabandon','queuecallerjoin','queuecallerleave','musiconholdstart','musiconholdstop','newstate','hangup'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xe7a3,0x198));var _0x3e7a=function(_0x14bc42,_0xff057a){_0x14bc42=_0x14bc42-0x0;var _0x50c8ae=_0xe7a3[_0x14bc42];return _0x50c8ae;};var AsteriskManager=require(_0x3e7a('0x0'));var config=require(_0x3e7a('0x1'));var utils=require(_0x3e7a('0x2'));var ami=new AsteriskManager(config[_0x3e7a('0x3')]['port'],config[_0x3e7a('0x3')]['ip'],config[_0x3e7a('0x3')][_0x3e7a('0x4')],config[_0x3e7a('0x3')]['password'],!![]);ami[_0x3e7a('0x5')]();if(config['xdr']&&config[_0x3e7a('0x6')]['disabled']){utils[_0x3e7a('0x7')]('XDR\x20DISABLED');}else{var agents=require('./agents.controller');var calls=require(_0x3e7a('0x8'));var queues=require(_0x3e7a('0x9'));var recordings=require(_0x3e7a('0xa'));var members=require(_0x3e7a('0xb'));var dials=require(_0x3e7a('0xc'));var transfers=require(_0x3e7a('0xd'));var core=require(_0x3e7a('0xe'));ami['on']('connect',core[_0x3e7a('0xf')]);ami['on']('shutdown',core[_0x3e7a('0x10')]);ami['on'](_0x3e7a('0x11'),core[_0x3e7a('0x11')]);ami['on']('error',core[_0x3e7a('0x12')]);ami['on']('close',core['close']);ami['on'](_0x3e7a('0x13'),core['managerevent']);ami['on'](_0x3e7a('0x14'),function(_0x164a46){try{members[_0x3e7a('0x14')](_0x164a46);}catch(_0x270954){utils[_0x3e7a('0x12')](_0x270954);}});ami['on'](_0x3e7a('0x15'),function(_0x35a2dd){try{agents['agentcalled'](_0x35a2dd);}catch(_0x2b8e48){utils['error'](_0x2b8e48);}});ami['on']('agentringnoanswer',function(_0x2312ab){try{agents[_0x3e7a('0x16')](_0x2312ab);}catch(_0x98fd69){utils[_0x3e7a('0x12')](_0x98fd69);}});ami['on'](_0x3e7a('0x17'),function(_0x5f5354){try{agents[_0x3e7a('0x17')](_0x5f5354);queues[_0x3e7a('0x17')](_0x5f5354);}catch(_0x283f4f){utils[_0x3e7a('0x12')](_0x283f4f);}});ami['on'](_0x3e7a('0x18'),function(_0x3177ae){try{agents[_0x3e7a('0x18')](_0x3177ae);queues[_0x3e7a('0x18')](_0x3177ae);members[_0x3e7a('0x18')](_0x3177ae);}catch(_0xdfe22){utils[_0x3e7a('0x12')](_0xdfe22);}});ami['on']('queuecallerabandon',function(_0x1bff6b){try{agents[_0x3e7a('0x19')](_0x1bff6b);queues[_0x3e7a('0x19')](_0x1bff6b);}catch(_0x45ff82){utils[_0x3e7a('0x12')](_0x45ff82);}});ami['on'](_0x3e7a('0x1a'),function(_0x3f8aca){try{queues[_0x3e7a('0x1a')](_0x3f8aca);recordings['queuecallerjoin'](_0x3f8aca);}catch(_0x3b8eca){utils[_0x3e7a('0x12')](_0x3b8eca);}});ami['on'](_0x3e7a('0x1b'),function(_0x37bc78){try{queues[_0x3e7a('0x1b')](_0x37bc78);}catch(_0x18643b){utils['error'](_0x18643b);}});ami['on'](_0x3e7a('0x1c'),function(_0x1422f8){try{queues['musiconholdstart'](_0x1422f8);calls[_0x3e7a('0x1c')](_0x1422f8);}catch(_0x38dc2d){utils[_0x3e7a('0x12')](_0x38dc2d);}});ami['on'](_0x3e7a('0x1d'),function(_0x527192){try{queues[_0x3e7a('0x1d')](_0x527192);calls[_0x3e7a('0x1d')](_0x527192);}catch(_0x136f3e){utils[_0x3e7a('0x12')](_0x136f3e);}});ami['on'](_0x3e7a('0x1e'),function(_0x3b267b){try{calls[_0x3e7a('0x1e')](_0x3b267b);recordings['newstate'](_0x3b267b);}catch(_0x68dc2e){utils[_0x3e7a('0x12')](_0x68dc2e);}});ami['on'](_0x3e7a('0x1f'),function(_0x585f82){try{calls[_0x3e7a('0x1f')](_0x585f82);recordings[_0x3e7a('0x1f')](_0x585f82);dials[_0x3e7a('0x1f')](_0x585f82);agents[_0x3e7a('0x1f')](_0x585f82);queues[_0x3e7a('0x1f')](_0x585f82);}catch(_0x515460){utils[_0x3e7a('0x12')](_0x515460);}});ami['on']('cdr',function(_0xfd611d){try{members[_0x3e7a('0x20')](_0xfd611d);}catch(_0x57673d){utils[_0x3e7a('0x12')](_0x57673d);}});ami['on']('blindtransfer',function(_0x1f4cfd){try{queues[_0x3e7a('0x21')](_0x1f4cfd);agents[_0x3e7a('0x21')](_0x1f4cfd);transfers[_0x3e7a('0x21')](_0x1f4cfd);}catch(_0x535ad4){utils[_0x3e7a('0x12')](_0x535ad4);}});ami['on'](_0x3e7a('0x22'),function(_0x21d7e6){try{queues[_0x3e7a('0x22')](_0x21d7e6);transfers[_0x3e7a('0x22')](_0x21d7e6);agents[_0x3e7a('0x22')](_0x21d7e6);calls[_0x3e7a('0x22')](_0x21d7e6);}catch(_0xb559f2){utils[_0x3e7a('0x12')](_0xb559f2);}});ami['on'](_0x3e7a('0x23'),function(_0x4bb70c){try{queues['varset'](_0x4bb70c);recordings[_0x3e7a('0x23')](_0x4bb70c);calls[_0x3e7a('0x23')](_0x4bb70c);dials[_0x3e7a('0x23')](_0x4bb70c);}catch(_0x28c6b9){utils[_0x3e7a('0x12')](_0x28c6b9);}});ami['on'](_0x3e7a('0x24'),function(_0x13093e){try{calls[_0x3e7a('0x24')](_0x13093e);recordings['newexten'](_0x13093e);dials['newexten'](_0x13093e);}catch(_0x3d4c01){utils[_0x3e7a('0x12')](_0x3d4c01);}});ami['on'](_0x3e7a('0x25'),function(_0x12dc19){try{calls[_0x3e7a('0x25')](_0x12dc19);recordings['newchannel'](_0x12dc19);}catch(_0x8c326f){utils[_0x3e7a('0x12')](_0x8c326f);}});ami['on'](_0x3e7a('0x26'),function(_0x5ad73a){try{dials[_0x3e7a('0x26')](_0x5ad73a);}catch(_0x39a0d4){utils['error'](_0x39a0d4);}});ami['on'](_0x3e7a('0x27'),function(_0x154065){try{dials[_0x3e7a('0x27')](_0x154065);}catch(_0x4d2bd3){utils['error'](_0x4d2bd3);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 3408693..a2816a4 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 _0x7d28=['internal','request','CreateMemberReport','getUserByName','name','catch','INUSE','BUSY','device','voice','now','NOT_INUSE','isNil','duration','diffTime','exitAt','enterAt','agentcomplete','assign','queue','cdr','channel','data1','source','data3','destination','destinationchannel','lodash','util','./utils','Local/_attended@transfer','Queue:','info','MEMBER|%s|%s|%s|%s|%s|%s','uniqueid','interface','data2','membername','type','then'];(function(_0x10afee,_0xed7b17){var _0x2ab1da=function(_0x438ae3){while(--_0x438ae3){_0x10afee['push'](_0x10afee['shift']());}};_0x2ab1da(++_0xed7b17);}(_0x7d28,0x1d3));var _0x87d2=function(_0x17d1a2,_0x2650e4){_0x17d1a2=_0x17d1a2-0x0;var _0x24c998=_0x7d28[_0x17d1a2];return _0x24c998;};'use strict';var _=require(_0x87d2('0x0'));var util=require(_0x87d2('0x1'));var utils=require(_0x87d2('0x2'));var members={};var exclude=[_0x87d2('0x3'),_0x87d2('0x4')];function writeDB(_0x3957f5){utils[_0x87d2('0x5')](util['format'](_0x87d2('0x6'),_0x3957f5[_0x87d2('0x7')],_0x3957f5[_0x87d2('0x8')],_0x3957f5['channel'],_0x3957f5[_0x87d2('0x9')],_0x3957f5[_0x87d2('0xa')],_0x3957f5[_0x87d2('0xb')]));if(_0x3957f5[_0x87d2('0x8')]){utils['getUserByInterface'](_0x3957f5[_0x87d2('0x8')])[_0x87d2('0xc')](function(_0x4cda73){if(_0x4cda73){_0x3957f5['membername']=_0x4cda73['name'];_0x3957f5['internal']=_0x4cda73[_0x87d2('0xd')];utils[_0x87d2('0xe')](_0x87d2('0xf'),_0x3957f5);}else{utils[_0x87d2('0x10')](_0x3957f5[_0x87d2('0x8')]['split']('/')[0x1])[_0x87d2('0xc')](function(_0x4b99bf){if(_0x4b99bf){_0x3957f5[_0x87d2('0xa')]=_0x4b99bf[_0x87d2('0x11')];_0x3957f5[_0x87d2('0xd')]=_0x4b99bf[_0x87d2('0xd')];utils[_0x87d2('0xe')](_0x87d2('0xf'),_0x3957f5);}});}})[_0x87d2('0x12')](function(_0x19cbf4){utils['error'](_0x19cbf4);});}delete members[_0x3957f5['interface']];}function startsWith(_0x128957,_0x3e35dc){return _['some'](_0x128957,function(_0x8f9e77){return _['startsWith'](_0x3e35dc,_0x8f9e77);});}exports['devicestatechange']=function(_0x7895ac){switch(_0x7895ac['state']){case _0x87d2('0x13'):case _0x87d2('0x14'):if(!startsWith(exclude,_0x7895ac[_0x87d2('0x15')])){members[_0x7895ac[_0x87d2('0x15')]]={'channel':_0x87d2('0x16'),'interface':_0x7895ac[_0x87d2('0x15')],'type':'TALKING','enterAt':utils[_0x87d2('0x17')](),'role':'agent'};}break;case _0x87d2('0x18'):if(!_[_0x87d2('0x19')](members[_0x7895ac[_0x87d2('0x15')]])){members[_0x7895ac[_0x87d2('0x15')]]['exitAt']=utils['now']();members[_0x7895ac[_0x87d2('0x15')]][_0x87d2('0x1a')]=utils[_0x87d2('0x1b')](members[_0x7895ac[_0x87d2('0x15')]][_0x87d2('0x1c')],members[_0x7895ac[_0x87d2('0x15')]][_0x87d2('0x1d')]);if(members[_0x7895ac[_0x87d2('0x15')]][_0x87d2('0x7')]){writeDB(members[_0x7895ac[_0x87d2('0x15')]]);}}default:break;}};exports[_0x87d2('0x1e')]=function(_0x21fdff){if(!_[_0x87d2('0x19')](members[_0x21fdff[_0x87d2('0x8')]])){members[_0x21fdff[_0x87d2('0x8')]]=_[_0x87d2('0x1f')](members[_0x21fdff[_0x87d2('0x8')]],{'data4':_0x21fdff[_0x87d2('0x20')],'uniqueid':_0x21fdff[_0x87d2('0x7')]});}};exports[_0x87d2('0x21')]=function(_0x5f272b){if(_0x5f272b[_0x87d2('0x22')]){var _0x146352=_0x5f272b[_0x87d2('0x22')]['split']('-')[0x0];if(!_[_0x87d2('0x19')](members[_0x146352])){members[_0x146352]=_[_0x87d2('0x1f')](members[_0x146352],{'data1':members[_0x146352][_0x87d2('0x23')]||_0x5f272b['type'],'data2':members[_0x146352]['data2']||_0x5f272b[_0x87d2('0x24')],'data3':members[_0x146352][_0x87d2('0x25')]||_0x5f272b[_0x87d2('0x26')],'uniqueid':members[_0x146352][_0x87d2('0x7')]||_0x5f272b[_0x87d2('0x7')]});if(members[_0x146352][_0x87d2('0x1c')]){writeDB(members[_0x146352]);}}}if(_0x5f272b[_0x87d2('0x27')]){var _0x5bcf92=_0x5f272b[_0x87d2('0x27')]['split']('-')[0x0];if(!_[_0x87d2('0x19')](members[_0x5bcf92])){members[_0x5bcf92]=_['assign'](members[_0x5bcf92],{'data1':members[_0x5bcf92]['data1']||_0x5f272b[_0x87d2('0xb')],'data2':members[_0x5bcf92]['data2']||_0x5f272b['source'],'data3':members[_0x5bcf92][_0x87d2('0x25')]||_0x5f272b[_0x87d2('0x26')],'uniqueid':members[_0x5bcf92]['uniqueid']||_0x5f272b['uniqueid']});if(members[_0x5bcf92]['exitAt']){writeDB(members[_0x5bcf92]);}}}}; \ No newline at end of file +var _0xdfe9=['enterAt','uniqueid','agentcomplete','queue','split','assign','data1','type','data2','source','data3','destinationchannel','destination','util','Local/_attended@transfer','Queue:','info','format','MEMBER|%s|%s|%s|%s|%s|%s','interface','channel','membername','internal','request','CreateMemberReport','getUserByName','then','catch','startsWith','devicestatechange','state','INUSE','BUSY','device','voice','TALKING','agent','NOT_INUSE','isNil','exitAt','now','duration','diffTime'];(function(_0x286764,_0x17ab8a){var _0x9f63b5=function(_0x4496f1){while(--_0x4496f1){_0x286764['push'](_0x286764['shift']());}};_0x9f63b5(++_0x17ab8a);}(_0xdfe9,0xb9));var _0x9dfe=function(_0x448c54,_0x319b91){_0x448c54=_0x448c54-0x0;var _0x19e9fe=_0xdfe9[_0x448c54];return _0x19e9fe;};'use strict';var _=require('lodash');var util=require(_0x9dfe('0x0'));var utils=require('./utils');var members={};var exclude=[_0x9dfe('0x1'),_0x9dfe('0x2')];function writeDB(_0x586016){utils[_0x9dfe('0x3')](util[_0x9dfe('0x4')](_0x9dfe('0x5'),_0x586016['uniqueid'],_0x586016[_0x9dfe('0x6')],_0x586016[_0x9dfe('0x7')],_0x586016['data2'],_0x586016['membername'],_0x586016['type']));if(_0x586016[_0x9dfe('0x6')]){utils['getUserByInterface'](_0x586016[_0x9dfe('0x6')])['then'](function(_0x55afc6){if(_0x55afc6){_0x586016[_0x9dfe('0x8')]=_0x55afc6['name'];_0x586016[_0x9dfe('0x9')]=_0x55afc6[_0x9dfe('0x9')];utils[_0x9dfe('0xa')](_0x9dfe('0xb'),_0x586016);}else{utils[_0x9dfe('0xc')](_0x586016[_0x9dfe('0x6')]['split']('/')[0x1])[_0x9dfe('0xd')](function(_0x5edc1c){if(_0x5edc1c){_0x586016[_0x9dfe('0x8')]=_0x5edc1c['name'];_0x586016[_0x9dfe('0x9')]=_0x5edc1c[_0x9dfe('0x9')];utils['request'](_0x9dfe('0xb'),_0x586016);}});}})[_0x9dfe('0xe')](function(_0x51f08a){utils['error'](_0x51f08a);});}delete members[_0x586016[_0x9dfe('0x6')]];}function startsWith(_0x1d9bee,_0x5e089d){return _['some'](_0x1d9bee,function(_0x2c9cc9){return _[_0x9dfe('0xf')](_0x5e089d,_0x2c9cc9);});}exports[_0x9dfe('0x10')]=function(_0xd8ebb2){switch(_0xd8ebb2[_0x9dfe('0x11')]){case _0x9dfe('0x12'):case _0x9dfe('0x13'):if(!startsWith(exclude,_0xd8ebb2[_0x9dfe('0x14')])){members[_0xd8ebb2['device']]={'channel':_0x9dfe('0x15'),'interface':_0xd8ebb2[_0x9dfe('0x14')],'type':_0x9dfe('0x16'),'enterAt':utils['now'](),'role':_0x9dfe('0x17')};}break;case _0x9dfe('0x18'):if(!_[_0x9dfe('0x19')](members[_0xd8ebb2[_0x9dfe('0x14')]])){members[_0xd8ebb2[_0x9dfe('0x14')]][_0x9dfe('0x1a')]=utils[_0x9dfe('0x1b')]();members[_0xd8ebb2[_0x9dfe('0x14')]][_0x9dfe('0x1c')]=utils[_0x9dfe('0x1d')](members[_0xd8ebb2[_0x9dfe('0x14')]][_0x9dfe('0x1a')],members[_0xd8ebb2[_0x9dfe('0x14')]][_0x9dfe('0x1e')]);if(members[_0xd8ebb2[_0x9dfe('0x14')]][_0x9dfe('0x1f')]){writeDB(members[_0xd8ebb2[_0x9dfe('0x14')]]);}}default:break;}};exports[_0x9dfe('0x20')]=function(_0x422cc0){if(!_['isNil'](members[_0x422cc0[_0x9dfe('0x6')]])){members[_0x422cc0[_0x9dfe('0x6')]]=_['assign'](members[_0x422cc0[_0x9dfe('0x6')]],{'data4':_0x422cc0[_0x9dfe('0x21')],'uniqueid':_0x422cc0[_0x9dfe('0x1f')]});}};exports['cdr']=function(_0x13c122){if(_0x13c122[_0x9dfe('0x7')]){var _0x44156d=_0x13c122[_0x9dfe('0x7')][_0x9dfe('0x22')]('-')[0x0];if(!_[_0x9dfe('0x19')](members[_0x44156d])){members[_0x44156d]=_[_0x9dfe('0x23')](members[_0x44156d],{'data1':members[_0x44156d][_0x9dfe('0x24')]||_0x13c122[_0x9dfe('0x25')],'data2':members[_0x44156d][_0x9dfe('0x26')]||_0x13c122[_0x9dfe('0x27')],'data3':members[_0x44156d][_0x9dfe('0x28')]||_0x13c122['destination'],'uniqueid':members[_0x44156d][_0x9dfe('0x1f')]||_0x13c122[_0x9dfe('0x1f')]});if(members[_0x44156d]['exitAt']){writeDB(members[_0x44156d]);}}}if(_0x13c122[_0x9dfe('0x29')]){var _0x3a13bf=_0x13c122[_0x9dfe('0x29')][_0x9dfe('0x22')]('-')[0x0];if(!_[_0x9dfe('0x19')](members[_0x3a13bf])){members[_0x3a13bf]=_['assign'](members[_0x3a13bf],{'data1':members[_0x3a13bf]['data1']||_0x13c122[_0x9dfe('0x25')],'data2':members[_0x3a13bf][_0x9dfe('0x26')]||_0x13c122['source'],'data3':members[_0x3a13bf][_0x9dfe('0x28')]||_0x13c122[_0x9dfe('0x2a')],'uniqueid':members[_0x3a13bf][_0x9dfe('0x1f')]||_0x13c122[_0x9dfe('0x1f')]});if(members[_0x3a13bf][_0x9dfe('0x1a')]){writeDB(members[_0x3a13bf]);}}}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 286051f..5861fc4 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 _0xd162=['position','now','hangup','isNil','queuecallerleaveAt','queuecallerabandon','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','queuecallerenterreason','variable','value','toUpperCase','CONTINUE','queuecallerabandonAt','queuecallerexit','queuecallerexitAt','EXITWITHKEY','holdtime','diffTime','queuecallerjoinAt','count','connectedlinenum','agentconnect','assigned','membername','agentcomplete','reason','transfer','TRANSFER','COMPLETEDBY','blindtransfer','transfereeuniqueid','transfertype','BLIND','transferexten','extension','transferuniqueid','BLINDTRANSFER','attendedtransfer','origtransfererlinkedid','secondtransfererlinkedid','ATTENDED','origtransfererexten','origtransfereruniqueid','transfereelinkedid','clone','transfertargetuniqueid','mohtime','secondtransfereruniqueid','secondtransfererexten','ATTENDEDTRANSFER','transfertargetlinkedid','calleridname','error','stack','musiconholdstartAt','musiconholdstop','lodash','util','./utils','info','QUEUE|%s|%s|%s|%s|%s|%s|%s','uniqueid','channel','queue','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','then','type','request','CreateVoiceQueueReport','transfereduniqueid','assign'];(function(_0x4dd4f5,_0x19dcfc){var _0x19543e=function(_0x202ca1){while(--_0x202ca1){_0x4dd4f5['push'](_0x4dd4f5['shift']());}};_0x19543e(++_0x19dcfc);}(_0xd162,0x16a));var _0x2d16=function(_0x23b1d5,_0x3043fa){_0x23b1d5=_0x23b1d5-0x0;var _0x3f5702=_0xd162[_0x23b1d5];return _0x3f5702;};'use strict';var _=require(_0x2d16('0x0'));var util=require(_0x2d16('0x1'));var utils=require(_0x2d16('0x2'));var queues={};function writeDB(_0xe74d24){utils[_0x2d16('0x3')](util['format'](_0x2d16('0x4'),_0xe74d24[_0x2d16('0x5')],_0xe74d24[_0x2d16('0x6')],_0xe74d24[_0x2d16('0x7')],_0xe74d24[_0x2d16('0x8')],_0xe74d24[_0x2d16('0x9')],_0xe74d24[_0x2d16('0xa')],_0xe74d24[_0x2d16('0xb')]));if(_0xe74d24['queue']){utils['getVoiceQueueByName'](_0xe74d24[_0x2d16('0x7')])[_0x2d16('0xc')](function(_0x37a230){if(_0x37a230){_0xe74d24['type']=_0x37a230[_0x2d16('0xd')];}utils[_0x2d16('0xe')](_0x2d16('0xf'),_0xe74d24);});}else{utils[_0x2d16('0xe')](_0x2d16('0xf'),_0xe74d24);}if(_0xe74d24[_0x2d16('0x10')]){delete queues[_0xe74d24[_0x2d16('0x10')]];}else{delete queues[_0xe74d24['uniqueid']];}}exports['queuecallerjoin']=function(_0x57a8b6){queues[_0x57a8b6[_0x2d16('0x5')]]=_[_0x2d16('0x11')](_0x57a8b6,{'originalposition':_0x57a8b6[_0x2d16('0x12')],'queuecallerjoinAt':utils[_0x2d16('0x13')](),'mohtime':0x0});};exports[_0x2d16('0x14')]=function(_0x237a7f){if(!_[_0x2d16('0x15')](queues[_0x237a7f[_0x2d16('0x5')]])){if(queues[_0x237a7f[_0x2d16('0x5')]][_0x2d16('0x16')]){if(!queues[_0x237a7f['uniqueid']][_0x2d16('0x17')]&&!queues[_0x237a7f[_0x2d16('0x5')]]['queuecallerexit']){queues[_0x237a7f[_0x2d16('0x5')]][_0x2d16('0x18')]=!![];queues[_0x237a7f['uniqueid']][_0x2d16('0x19')]=utils[_0x2d16('0x13')]();queues[_0x237a7f[_0x2d16('0x5')]]['queuecallerexitreason']=_0x2d16('0x1a');}writeDB(queues[_0x237a7f[_0x2d16('0x5')]]);}else{if(queues[_0x237a7f[_0x2d16('0x5')]][_0x2d16('0x10')]){queues[queues[_0x237a7f[_0x2d16('0x5')]][_0x2d16('0x10')]]=queues[_0x237a7f[_0x2d16('0x5')]];queues[queues[_0x237a7f[_0x2d16('0x5')]][_0x2d16('0x10')]][_0x2d16('0x1b')]=0x2;delete queues[_0x237a7f[_0x2d16('0x5')]];}}}};exports['varset']=function(_0x23370f){if(!_[_0x2d16('0x15')](_0x23370f[_0x2d16('0x1c')]['queuestatus'])&&_0x23370f[_0x2d16('0x1d')][_0x2d16('0x1e')]()!==_0x2d16('0x1f')){if(!_[_0x2d16('0x15')](queues[_0x23370f['uniqueid']])){queues[_0x23370f[_0x2d16('0x5')]][_0x2d16('0x17')]=![];queues[_0x23370f[_0x2d16('0x5')]][_0x2d16('0x20')]=null;queues[_0x23370f['uniqueid']][_0x2d16('0x21')]=!![];queues[_0x23370f[_0x2d16('0x5')]][_0x2d16('0x22')]=utils[_0x2d16('0x13')]();queues[_0x23370f[_0x2d16('0x5')]]['queuecallerexitreason']=_0x23370f['value'][_0x2d16('0x1e')]();writeDB(queues[_0x23370f[_0x2d16('0x5')]]);}}else if(!_[_0x2d16('0x15')](_0x23370f['variable']['queueposition'])){if(!_[_0x2d16('0x15')](queues[_0x23370f[_0x2d16('0x5')]])&&!queues[_0x23370f['uniqueid']][_0x2d16('0x17')]){queues[_0x23370f['uniqueid']][_0x2d16('0x17')]=![];queues[_0x23370f['uniqueid']][_0x2d16('0x20')]=null;queues[_0x23370f[_0x2d16('0x5')]][_0x2d16('0x21')]=!![];queues[_0x23370f[_0x2d16('0x5')]][_0x2d16('0x22')]=utils[_0x2d16('0x13')]();queues[_0x23370f[_0x2d16('0x5')]]['queuecallerexitreason']=_0x2d16('0x23');}}};exports['queuecallerabandon']=function(_0x1a1bdc){if(!_[_0x2d16('0x15')](queues[_0x1a1bdc[_0x2d16('0x5')]])){queues[_0x1a1bdc['uniqueid']][_0x2d16('0x21')]=![];queues[_0x1a1bdc[_0x2d16('0x5')]][_0x2d16('0x22')]=null;queues[_0x1a1bdc['uniqueid']][_0x2d16('0x17')]=!![];queues[_0x1a1bdc['uniqueid']]['queuecallerabandonAt']=utils[_0x2d16('0x13')]();queues[_0x1a1bdc[_0x2d16('0x5')]]['queuecallerexitreason']='ABANDONED';}};exports['queuecallerleave']=function(_0x43a172){if(!_[_0x2d16('0x15')](queues[_0x43a172['uniqueid']])){queues[_0x43a172[_0x2d16('0x5')]]['queuecallerleave']=!![];queues[_0x43a172[_0x2d16('0x5')]]['queuecallerleaveAt']=utils[_0x2d16('0x13')]();queues[_0x43a172['uniqueid']][_0x2d16('0x24')]=utils[_0x2d16('0x25')](queues[_0x43a172[_0x2d16('0x5')]][_0x2d16('0x16')],queues[_0x43a172[_0x2d16('0x5')]][_0x2d16('0x26')]);queues[_0x43a172['uniqueid']]['position']=_0x43a172[_0x2d16('0x12')];queues[_0x43a172[_0x2d16('0x5')]]['count']=_0x43a172[_0x2d16('0x27')];queues[_0x43a172[_0x2d16('0x5')]]['connectedlinenum']=_0x43a172[_0x2d16('0x28')];queues[_0x43a172[_0x2d16('0x5')]]['connectedlinename']=_0x43a172['connectedlinename'];}};exports[_0x2d16('0x29')]=function(_0x455570){if(!_[_0x2d16('0x15')](queues[_0x455570['uniqueid']])){queues[_0x455570['uniqueid']][_0x2d16('0x17')]=![];queues[_0x455570['uniqueid']]['queuecallerabandon']=![];queues[_0x455570[_0x2d16('0x5')]]['queuecallerabandonAt']=null;queues[_0x455570[_0x2d16('0x5')]][_0x2d16('0x21')]=![];queues[_0x455570[_0x2d16('0x5')]][_0x2d16('0xb')]=null;queues[_0x455570[_0x2d16('0x5')]]['queuecallerexitAt']=null;queues[_0x455570[_0x2d16('0x5')]][_0x2d16('0x2a')]=!![];queues[_0x455570[_0x2d16('0x5')]][_0x2d16('0xa')]=_0x455570['destaccountcode'];queues[_0x455570['uniqueid']][_0x2d16('0x8')]=_0x455570[_0x2d16('0x2b')];}};exports[_0x2d16('0x2c')]=function(_0x3f9d26){if(!_[_0x2d16('0x15')](queues[_0x3f9d26[_0x2d16('0x5')]])){if(queues[_0x3f9d26[_0x2d16('0x5')]]['queuecallerleaveAt']){queues[_0x3f9d26[_0x2d16('0x5')]][_0x2d16('0x17')]=![];queues[_0x3f9d26[_0x2d16('0x5')]][_0x2d16('0x17')]=![];queues[_0x3f9d26[_0x2d16('0x5')]][_0x2d16('0x20')]=null;queues[_0x3f9d26[_0x2d16('0x5')]][_0x2d16('0x21')]=![];queues[_0x3f9d26[_0x2d16('0x5')]][_0x2d16('0x22')]=null;queues[_0x3f9d26[_0x2d16('0x5')]][_0x2d16('0x2a')]=!![];queues[_0x3f9d26[_0x2d16('0x5')]][_0x2d16('0x8')]=_0x3f9d26[_0x2d16('0x2b')];queues[_0x3f9d26[_0x2d16('0x5')]][_0x2d16('0x18')]=!![];queues[_0x3f9d26[_0x2d16('0x5')]][_0x2d16('0x19')]=utils[_0x2d16('0x13')]();if(_0x3f9d26[_0x2d16('0x2d')]==_0x2d16('0x2e')){if(!queues[_0x3f9d26['uniqueid']][_0x2d16('0x2e')]){queues[_0x3f9d26['uniqueid']][_0x2d16('0xb')]=_0x2d16('0x2f');}}else{queues[_0x3f9d26[_0x2d16('0x5')]]['queuecallerexitreason']=_0x2d16('0x30')+_0x3f9d26[_0x2d16('0x2d')][_0x2d16('0x1e')]();}writeDB(queues[_0x3f9d26[_0x2d16('0x5')]]);}}};exports[_0x2d16('0x31')]=function(_0x36fb83){if(!_[_0x2d16('0x15')](queues[_0x36fb83[_0x2d16('0x32')]])){queues[_0x36fb83[_0x2d16('0x32')]][_0x2d16('0x2e')]=!![];queues[_0x36fb83[_0x2d16('0x32')]][_0x2d16('0x33')]=_0x2d16('0x34');queues[_0x36fb83[_0x2d16('0x32')]][_0x2d16('0x35')]=_0x36fb83[_0x2d16('0x36')];queues[_0x36fb83[_0x2d16('0x32')]][_0x2d16('0x37')]=_0x36fb83[_0x2d16('0x32')];queues[_0x36fb83[_0x2d16('0x32')]][_0x2d16('0xb')]=_0x2d16('0x38');}};exports[_0x2d16('0x39')]=function(_0x40d5a1){try{if(_0x40d5a1['origtransfereruniqueid']==_0x40d5a1[_0x2d16('0x3a')]){if(!_[_0x2d16('0x15')](queues[_0x40d5a1[_0x2d16('0x3b')]])){queues[_0x40d5a1[_0x2d16('0x3b')]][_0x2d16('0x2e')]=!![];queues[_0x40d5a1[_0x2d16('0x3b')]][_0x2d16('0x33')]=_0x2d16('0x3c');queues[_0x40d5a1[_0x2d16('0x3b')]][_0x2d16('0x35')]=_0x40d5a1[_0x2d16('0x3d')];queues[_0x40d5a1[_0x2d16('0x3b')]][_0x2d16('0x37')]=_0x40d5a1[_0x2d16('0x3e')];queues[_0x40d5a1['secondtransfererlinkedid']][_0x2d16('0xb')]='ATTENDEDTRANSFER';}if(!_[_0x2d16('0x15')](queues[_0x40d5a1[_0x2d16('0x3a')]])){if(_0x40d5a1[_0x2d16('0x3f')]&&queues[_0x40d5a1['transfereelinkedid']]){queues[_0x40d5a1[_0x2d16('0x3f')]]['queuecallerenterreason']=0x1;queues[_0x40d5a1['transfereeuniqueid']]=_[_0x2d16('0x40')](queues[_0x40d5a1[_0x2d16('0x3f')]]);queues[_0x40d5a1[_0x2d16('0x32')]][_0x2d16('0x10')]=_0x40d5a1[_0x2d16('0x41')];queues[_0x40d5a1[_0x2d16('0x32')]][_0x2d16('0x1b')]=0x2;queues[_0x40d5a1[_0x2d16('0x32')]][_0x2d16('0x9')]=queues[_0x40d5a1['secondtransfererlinkedid']][_0x2d16('0x9')];queues[_0x40d5a1[_0x2d16('0x32')]]['calleridname']=queues[_0x40d5a1['secondtransfererlinkedid']]['calleridname'];queues[_0x40d5a1[_0x2d16('0x32')]][_0x2d16('0x26')]=utils[_0x2d16('0x13')]();queues[_0x40d5a1[_0x2d16('0x32')]][_0x2d16('0x16')]=utils[_0x2d16('0x13')]();queues[_0x40d5a1[_0x2d16('0x32')]][_0x2d16('0x24')]=0x0;queues[_0x40d5a1[_0x2d16('0x32')]][_0x2d16('0x42')]=0x0;}else{queues[_0x40d5a1[_0x2d16('0x3a')]]['transfereduniqueid']=_0x40d5a1['secondtransfererlinkedid'];}}}else if(_0x40d5a1[_0x2d16('0x43')]==_0x40d5a1[_0x2d16('0x3b')]){if(!_[_0x2d16('0x15')](queues[_0x40d5a1[_0x2d16('0x3a')]])){queues[_0x40d5a1['origtransfererlinkedid']][_0x2d16('0x2e')]=!![];queues[_0x40d5a1[_0x2d16('0x3a')]][_0x2d16('0x33')]=_0x2d16('0x3c');queues[_0x40d5a1[_0x2d16('0x3a')]][_0x2d16('0x35')]=_0x40d5a1[_0x2d16('0x44')];queues[_0x40d5a1[_0x2d16('0x3a')]][_0x2d16('0x37')]=_0x40d5a1['secondtransfereruniqueid'];queues[_0x40d5a1[_0x2d16('0x3a')]][_0x2d16('0xb')]=_0x2d16('0x45');}if(!_['isNil'](queues[_0x40d5a1[_0x2d16('0x3b')]])){if(_0x40d5a1[_0x2d16('0x46')]&&queues[_0x40d5a1[_0x2d16('0x46')]]){queues[_0x40d5a1[_0x2d16('0x46')]][_0x2d16('0x1b')]=0x1;queues[_0x40d5a1[_0x2d16('0x41')]]=_[_0x2d16('0x40')](queues[_0x40d5a1['transfertargetlinkedid']]);queues[_0x40d5a1['transfertargetuniqueid']]['transfereduniqueid']=_0x40d5a1[_0x2d16('0x41')];queues[_0x40d5a1[_0x2d16('0x41')]]['queuecallerenterreason']=0x2;queues[_0x40d5a1['transfertargetuniqueid']][_0x2d16('0x9')]=queues[_0x40d5a1[_0x2d16('0x3a')]][_0x2d16('0x9')];queues[_0x40d5a1[_0x2d16('0x41')]][_0x2d16('0x47')]=queues[_0x40d5a1[_0x2d16('0x3a')]]['calleridname'];queues[_0x40d5a1[_0x2d16('0x41')]][_0x2d16('0x26')]=utils[_0x2d16('0x13')]();queues[_0x40d5a1[_0x2d16('0x41')]][_0x2d16('0x16')]=utils['now']();queues[_0x40d5a1['transfertargetuniqueid']][_0x2d16('0x24')]=0x0;queues[_0x40d5a1[_0x2d16('0x41')]]['mohtime']=0x0;}else{queues[_0x40d5a1[_0x2d16('0x3b')]][_0x2d16('0x10')]=_0x40d5a1[_0x2d16('0x3a')];}}}}catch(_0x438054){utils[_0x2d16('0x48')](_0x438054[_0x2d16('0x49')]);}};exports['musiconholdstart']=function(_0x5f14cb){if(!_['isNil'](queues[_0x5f14cb['uniqueid']])){queues[_0x5f14cb[_0x2d16('0x5')]][_0x2d16('0x4a')]=utils[_0x2d16('0x13')]();}};exports[_0x2d16('0x4b')]=function(_0x9abc){if(!_[_0x2d16('0x15')](queues[_0x9abc[_0x2d16('0x5')]])){if(!_[_0x2d16('0x15')](queues[_0x9abc[_0x2d16('0x5')]][_0x2d16('0x4a')])){queues[_0x9abc[_0x2d16('0x5')]][_0x2d16('0x42')]+=utils['diffTime'](utils['now'](),queues[_0x9abc[_0x2d16('0x5')]][_0x2d16('0x4a')]);delete queues[_0x9abc['uniqueid']][_0x2d16('0x4a')];}}}; \ No newline at end of file +var _0x0125=['musiconholdstartAt','musiconholdstop','lodash','./utils','info','format','QUEUE|%s|%s|%s|%s|%s|%s|%s','channel','queue','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','getVoiceQueueByName','then','type','CreateVoiceQueueReport','request','transfereduniqueid','uniqueid','queuecallerjoin','position','now','hangup','queuecallerexit','queuecallercomplete','COMPLETEDBYAGENT','queuecallerenterreason','varset','isNil','variable','toUpperCase','CONTINUE','queuecallerabandon','queuecallerabandonAt','value','queueposition','queuecallerexitAt','EXITWITHKEY','ABANDONED','queuecallerleave','queuecallerleaveAt','queuecallerjoinAt','count','connectedlinenum','connectedlinename','agentconnect','assigned','destaccountcode','membername','agentcomplete','transfer','TRANSFER','COMPLETEDBY','reason','transfereeuniqueid','transfertype','BLIND','transferexten','extension','transferuniqueid','BLINDTRANSFER','secondtransfererlinkedid','ATTENDED','ATTENDEDTRANSFER','origtransfererlinkedid','transfereelinkedid','clone','calleridname','holdtime','mohtime','secondtransfereruniqueid','secondtransfererexten','transfertargetlinkedid','transfertargetuniqueid','error','stack'];(function(_0x3ed1ab,_0xf97d1c){var _0x1c9697=function(_0x4b7845){while(--_0x4b7845){_0x3ed1ab['push'](_0x3ed1ab['shift']());}};_0x1c9697(++_0xf97d1c);}(_0x0125,0xe9));var _0x5012=function(_0x483d8b,_0x526c52){_0x483d8b=_0x483d8b-0x0;var _0x6500f1=_0x0125[_0x483d8b];return _0x6500f1;};'use strict';var _=require(_0x5012('0x0'));var util=require('util');var utils=require(_0x5012('0x1'));var queues={};function writeDB(_0x535064){utils[_0x5012('0x2')](util[_0x5012('0x3')](_0x5012('0x4'),_0x535064['uniqueid'],_0x535064[_0x5012('0x5')],_0x535064[_0x5012('0x6')],_0x535064[_0x5012('0x7')],_0x535064[_0x5012('0x8')],_0x535064[_0x5012('0x9')],_0x535064[_0x5012('0xa')]));if(_0x535064[_0x5012('0x6')]){utils[_0x5012('0xb')](_0x535064[_0x5012('0x6')])[_0x5012('0xc')](function(_0x2b3eda){if(_0x2b3eda){_0x535064[_0x5012('0xd')]=_0x2b3eda[_0x5012('0xd')];}utils['request'](_0x5012('0xe'),_0x535064);});}else{utils[_0x5012('0xf')](_0x5012('0xe'),_0x535064);}if(_0x535064[_0x5012('0x10')]){delete queues[_0x535064[_0x5012('0x10')]];}else{delete queues[_0x535064[_0x5012('0x11')]];}}exports[_0x5012('0x12')]=function(_0x53b311){queues[_0x53b311[_0x5012('0x11')]]=_['assign'](_0x53b311,{'originalposition':_0x53b311[_0x5012('0x13')],'queuecallerjoinAt':utils[_0x5012('0x14')](),'mohtime':0x0});};exports[_0x5012('0x15')]=function(_0x28432d){if(!_['isNil'](queues[_0x28432d[_0x5012('0x11')]])){if(queues[_0x28432d['uniqueid']]['queuecallerleaveAt']){if(!queues[_0x28432d[_0x5012('0x11')]]['queuecallerabandon']&&!queues[_0x28432d[_0x5012('0x11')]][_0x5012('0x16')]){queues[_0x28432d[_0x5012('0x11')]][_0x5012('0x17')]=!![];queues[_0x28432d[_0x5012('0x11')]]['queuecallercompleteAt']=utils[_0x5012('0x14')]();queues[_0x28432d[_0x5012('0x11')]][_0x5012('0xa')]=_0x5012('0x18');}writeDB(queues[_0x28432d[_0x5012('0x11')]]);}else{if(queues[_0x28432d[_0x5012('0x11')]]['transfereduniqueid']){queues[queues[_0x28432d[_0x5012('0x11')]][_0x5012('0x10')]]=queues[_0x28432d['uniqueid']];queues[queues[_0x28432d[_0x5012('0x11')]][_0x5012('0x10')]][_0x5012('0x19')]=0x2;delete queues[_0x28432d[_0x5012('0x11')]];}}}};exports[_0x5012('0x1a')]=function(_0x3b1ab3){if(!_[_0x5012('0x1b')](_0x3b1ab3[_0x5012('0x1c')]['queuestatus'])&&_0x3b1ab3['value'][_0x5012('0x1d')]()!==_0x5012('0x1e')){if(!_['isNil'](queues[_0x3b1ab3[_0x5012('0x11')]])){queues[_0x3b1ab3[_0x5012('0x11')]][_0x5012('0x1f')]=![];queues[_0x3b1ab3[_0x5012('0x11')]][_0x5012('0x20')]=null;queues[_0x3b1ab3['uniqueid']][_0x5012('0x16')]=!![];queues[_0x3b1ab3[_0x5012('0x11')]]['queuecallerexitAt']=utils[_0x5012('0x14')]();queues[_0x3b1ab3[_0x5012('0x11')]]['queuecallerexitreason']=_0x3b1ab3[_0x5012('0x21')][_0x5012('0x1d')]();writeDB(queues[_0x3b1ab3[_0x5012('0x11')]]);}}else if(!_[_0x5012('0x1b')](_0x3b1ab3[_0x5012('0x1c')][_0x5012('0x22')])){if(!_[_0x5012('0x1b')](queues[_0x3b1ab3[_0x5012('0x11')]])&&!queues[_0x3b1ab3['uniqueid']]['queuecallerabandon']){queues[_0x3b1ab3[_0x5012('0x11')]][_0x5012('0x1f')]=![];queues[_0x3b1ab3['uniqueid']][_0x5012('0x20')]=null;queues[_0x3b1ab3[_0x5012('0x11')]][_0x5012('0x16')]=!![];queues[_0x3b1ab3[_0x5012('0x11')]][_0x5012('0x23')]=utils[_0x5012('0x14')]();queues[_0x3b1ab3['uniqueid']]['queuecallerexitreason']=_0x5012('0x24');}}};exports['queuecallerabandon']=function(_0x2567b4){if(!_['isNil'](queues[_0x2567b4[_0x5012('0x11')]])){queues[_0x2567b4[_0x5012('0x11')]][_0x5012('0x16')]=![];queues[_0x2567b4[_0x5012('0x11')]][_0x5012('0x23')]=null;queues[_0x2567b4[_0x5012('0x11')]][_0x5012('0x1f')]=!![];queues[_0x2567b4[_0x5012('0x11')]][_0x5012('0x20')]=utils[_0x5012('0x14')]();queues[_0x2567b4[_0x5012('0x11')]][_0x5012('0xa')]=_0x5012('0x25');}};exports[_0x5012('0x26')]=function(_0x4f0d56){if(!_[_0x5012('0x1b')](queues[_0x4f0d56[_0x5012('0x11')]])){queues[_0x4f0d56['uniqueid']][_0x5012('0x26')]=!![];queues[_0x4f0d56[_0x5012('0x11')]][_0x5012('0x27')]=utils['now']();queues[_0x4f0d56['uniqueid']]['holdtime']=utils['diffTime'](queues[_0x4f0d56[_0x5012('0x11')]][_0x5012('0x27')],queues[_0x4f0d56[_0x5012('0x11')]][_0x5012('0x28')]);queues[_0x4f0d56['uniqueid']][_0x5012('0x13')]=_0x4f0d56[_0x5012('0x13')];queues[_0x4f0d56[_0x5012('0x11')]][_0x5012('0x29')]=_0x4f0d56[_0x5012('0x29')];queues[_0x4f0d56[_0x5012('0x11')]]['connectedlinenum']=_0x4f0d56[_0x5012('0x2a')];queues[_0x4f0d56[_0x5012('0x11')]]['connectedlinename']=_0x4f0d56[_0x5012('0x2b')];}};exports[_0x5012('0x2c')]=function(_0x168ce4){if(!_['isNil'](queues[_0x168ce4[_0x5012('0x11')]])){queues[_0x168ce4[_0x5012('0x11')]]['queuecallerabandon']=![];queues[_0x168ce4['uniqueid']]['queuecallerabandon']=![];queues[_0x168ce4[_0x5012('0x11')]][_0x5012('0x20')]=null;queues[_0x168ce4[_0x5012('0x11')]]['queuecallerexit']=![];queues[_0x168ce4[_0x5012('0x11')]][_0x5012('0xa')]=null;queues[_0x168ce4[_0x5012('0x11')]][_0x5012('0x23')]=null;queues[_0x168ce4[_0x5012('0x11')]][_0x5012('0x2d')]=!![];queues[_0x168ce4['uniqueid']][_0x5012('0x9')]=_0x168ce4[_0x5012('0x2e')];queues[_0x168ce4[_0x5012('0x11')]]['lastAssignedTo']=_0x168ce4[_0x5012('0x2f')];}};exports[_0x5012('0x30')]=function(_0x3378ec){if(!_[_0x5012('0x1b')](queues[_0x3378ec[_0x5012('0x11')]])){if(queues[_0x3378ec[_0x5012('0x11')]]['queuecallerleaveAt']){queues[_0x3378ec[_0x5012('0x11')]][_0x5012('0x1f')]=![];queues[_0x3378ec[_0x5012('0x11')]][_0x5012('0x1f')]=![];queues[_0x3378ec['uniqueid']][_0x5012('0x20')]=null;queues[_0x3378ec[_0x5012('0x11')]]['queuecallerexit']=![];queues[_0x3378ec[_0x5012('0x11')]][_0x5012('0x23')]=null;queues[_0x3378ec[_0x5012('0x11')]]['assigned']=!![];queues[_0x3378ec['uniqueid']][_0x5012('0x7')]=_0x3378ec['membername'];queues[_0x3378ec[_0x5012('0x11')]]['queuecallercomplete']=!![];queues[_0x3378ec[_0x5012('0x11')]]['queuecallercompleteAt']=utils[_0x5012('0x14')]();if(_0x3378ec['reason']==_0x5012('0x31')){if(!queues[_0x3378ec[_0x5012('0x11')]][_0x5012('0x31')]){queues[_0x3378ec[_0x5012('0x11')]][_0x5012('0xa')]=_0x5012('0x32');}}else{queues[_0x3378ec[_0x5012('0x11')]][_0x5012('0xa')]=_0x5012('0x33')+_0x3378ec[_0x5012('0x34')][_0x5012('0x1d')]();}writeDB(queues[_0x3378ec['uniqueid']]);}}};exports['blindtransfer']=function(_0x2eb59b){if(!_[_0x5012('0x1b')](queues[_0x2eb59b[_0x5012('0x35')]])){queues[_0x2eb59b[_0x5012('0x35')]]['transfer']=!![];queues[_0x2eb59b[_0x5012('0x35')]][_0x5012('0x36')]=_0x5012('0x37');queues[_0x2eb59b['transfereeuniqueid']][_0x5012('0x38')]=_0x2eb59b[_0x5012('0x39')];queues[_0x2eb59b[_0x5012('0x35')]][_0x5012('0x3a')]=_0x2eb59b['transfereeuniqueid'];queues[_0x2eb59b[_0x5012('0x35')]][_0x5012('0xa')]=_0x5012('0x3b');}};exports['attendedtransfer']=function(_0x55096e){try{if(_0x55096e['origtransfereruniqueid']==_0x55096e['origtransfererlinkedid']){if(!_[_0x5012('0x1b')](queues[_0x55096e[_0x5012('0x3c')]])){queues[_0x55096e[_0x5012('0x3c')]][_0x5012('0x31')]=!![];queues[_0x55096e['secondtransfererlinkedid']][_0x5012('0x36')]=_0x5012('0x3d');queues[_0x55096e[_0x5012('0x3c')]]['transferexten']=_0x55096e['origtransfererexten'];queues[_0x55096e[_0x5012('0x3c')]]['transferuniqueid']=_0x55096e['origtransfereruniqueid'];queues[_0x55096e[_0x5012('0x3c')]][_0x5012('0xa')]=_0x5012('0x3e');}if(!_[_0x5012('0x1b')](queues[_0x55096e[_0x5012('0x3f')]])){if(_0x55096e['transfereelinkedid']&&queues[_0x55096e[_0x5012('0x40')]]){queues[_0x55096e[_0x5012('0x40')]][_0x5012('0x19')]=0x1;queues[_0x55096e[_0x5012('0x35')]]=_[_0x5012('0x41')](queues[_0x55096e['transfereelinkedid']]);queues[_0x55096e[_0x5012('0x35')]]['transfereduniqueid']=_0x55096e['transfertargetuniqueid'];queues[_0x55096e[_0x5012('0x35')]][_0x5012('0x19')]=0x2;queues[_0x55096e[_0x5012('0x35')]][_0x5012('0x8')]=queues[_0x55096e['secondtransfererlinkedid']][_0x5012('0x8')];queues[_0x55096e[_0x5012('0x35')]][_0x5012('0x42')]=queues[_0x55096e[_0x5012('0x3c')]]['calleridname'];queues[_0x55096e[_0x5012('0x35')]][_0x5012('0x28')]=utils[_0x5012('0x14')]();queues[_0x55096e[_0x5012('0x35')]][_0x5012('0x27')]=utils[_0x5012('0x14')]();queues[_0x55096e[_0x5012('0x35')]][_0x5012('0x43')]=0x0;queues[_0x55096e[_0x5012('0x35')]][_0x5012('0x44')]=0x0;}else{queues[_0x55096e[_0x5012('0x3f')]][_0x5012('0x10')]=_0x55096e[_0x5012('0x3c')];}}}else if(_0x55096e[_0x5012('0x45')]==_0x55096e[_0x5012('0x3c')]){if(!_[_0x5012('0x1b')](queues[_0x55096e['origtransfererlinkedid']])){queues[_0x55096e[_0x5012('0x3f')]]['transfer']=!![];queues[_0x55096e['origtransfererlinkedid']][_0x5012('0x36')]=_0x5012('0x3d');queues[_0x55096e[_0x5012('0x3f')]]['transferexten']=_0x55096e[_0x5012('0x46')];queues[_0x55096e[_0x5012('0x3f')]]['transferuniqueid']=_0x55096e[_0x5012('0x45')];queues[_0x55096e['origtransfererlinkedid']][_0x5012('0xa')]='ATTENDEDTRANSFER';}if(!_[_0x5012('0x1b')](queues[_0x55096e['secondtransfererlinkedid']])){if(_0x55096e[_0x5012('0x47')]&&queues[_0x55096e['transfertargetlinkedid']]){queues[_0x55096e['transfertargetlinkedid']][_0x5012('0x19')]=0x1;queues[_0x55096e[_0x5012('0x48')]]=_[_0x5012('0x41')](queues[_0x55096e[_0x5012('0x47')]]);queues[_0x55096e[_0x5012('0x48')]]['transfereduniqueid']=_0x55096e[_0x5012('0x48')];queues[_0x55096e[_0x5012('0x48')]][_0x5012('0x19')]=0x2;queues[_0x55096e['transfertargetuniqueid']][_0x5012('0x8')]=queues[_0x55096e[_0x5012('0x3f')]][_0x5012('0x8')];queues[_0x55096e['transfertargetuniqueid']][_0x5012('0x42')]=queues[_0x55096e[_0x5012('0x3f')]][_0x5012('0x42')];queues[_0x55096e[_0x5012('0x48')]]['queuecallerjoinAt']=utils[_0x5012('0x14')]();queues[_0x55096e[_0x5012('0x48')]][_0x5012('0x27')]=utils[_0x5012('0x14')]();queues[_0x55096e[_0x5012('0x48')]][_0x5012('0x43')]=0x0;queues[_0x55096e[_0x5012('0x48')]][_0x5012('0x44')]=0x0;}else{queues[_0x55096e[_0x5012('0x3c')]][_0x5012('0x10')]=_0x55096e[_0x5012('0x3f')];}}}}catch(_0x1edf23){utils[_0x5012('0x49')](_0x1edf23[_0x5012('0x4a')]);}};exports['musiconholdstart']=function(_0x204b04){if(!_['isNil'](queues[_0x204b04[_0x5012('0x11')]])){queues[_0x204b04[_0x5012('0x11')]][_0x5012('0x4b')]=utils[_0x5012('0x14')]();}};exports[_0x5012('0x4c')]=function(_0x4b3f0a){if(!_[_0x5012('0x1b')](queues[_0x4b3f0a[_0x5012('0x11')]])){if(!_['isNil'](queues[_0x4b3f0a[_0x5012('0x11')]]['musiconholdstartAt'])){queues[_0x4b3f0a[_0x5012('0x11')]][_0x5012('0x44')]+=utils['diffTime'](utils[_0x5012('0x14')](),queues[_0x4b3f0a[_0x5012('0x11')]][_0x5012('0x4b')]);delete queues[_0x4b3f0a[_0x5012('0x11')]][_0x5012('0x4b')];}}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 3618412..102b3ba 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 _0xcb91=['uniqueid','channelstate','transfer','error','varset','variable','mixmonitor_filename','endsWith','value','.wav49','replace','.WAV','find','monitors','push','hangup','calleridnum','calleridname','connectedlinenum','connectedlinename','type','outbound','clone','newexten','toLowerCase','startsWith','appdata','cdr','split','substring','lastIndexOf','queuecallerjoin','queue','debug','accountcode','getUserByInternal','then','name','UserId','CreateVoiceRecording','request','newchannel','linkedid','exten','context','channel','stack','newstate','isNil'];(function(_0x3a9f05,_0x4920ae){var _0x542061=function(_0x22a55b){while(--_0x22a55b){_0x3a9f05['push'](_0x3a9f05['shift']());}};_0x542061(++_0x4920ae);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x30cd7e,_0x4db10a){_0x30cd7e=_0x30cd7e-0x0;var _0x462a02=_0xcb91[_0x30cd7e];return _0x462a02;};'use strict';var _=require('lodash');var utils=require('./utils');var recordings={};function writeDB(_0x26fe42){utils[_0x1cb9('0x0')](_0x26fe42);if(_0x26fe42[_0x1cb9('0x1')]){utils[_0x1cb9('0x2')](_0x26fe42['accountcode'])[_0x1cb9('0x3')](function(_0x2c17b8){if(_0x2c17b8){_0x26fe42['membername']=_0x2c17b8[_0x1cb9('0x4')];_0x26fe42[_0x1cb9('0x5')]=_0x2c17b8['id'];}utils['request'](_0x1cb9('0x6'),_0x26fe42);});}else{utils[_0x1cb9('0x7')]('CreateVoiceRecording',_0x26fe42);}}exports[_0x1cb9('0x8')]=function(_0x12567c){try{if(_0x12567c['uniqueid']==_0x12567c[_0x1cb9('0x9')]){recordings[_0x12567c['uniqueid']]={'uniqueid':_0x12567c['uniqueid'],'accountcode':_0x12567c[_0x1cb9('0x1')],'exten':_0x12567c[_0x1cb9('0xa')],'context':_0x12567c[_0x1cb9('0xb')],'channel':_0x12567c[_0x1cb9('0xc')],'monitors':[]};}}catch(_0x2fc627){utils['error'](_0x2fc627[_0x1cb9('0xd')]);}};exports[_0x1cb9('0xe')]=function(_0x3af35f){try{if(!_[_0x1cb9('0xf')](recordings[_0x3af35f[_0x1cb9('0x10')]])&&_0x3af35f['channelstate']==0x6){}else if(!_['isNil'](recordings[_0x3af35f['linkedid']])&&_0x3af35f[_0x1cb9('0x11')]==0x6&&_0x3af35f[_0x1cb9('0xb')]!=_0x1cb9('0x12')){recordings[_0x3af35f[_0x1cb9('0x9')]]['accountcode']=_0x3af35f[_0x1cb9('0x1')];}}catch(_0x6ef389){utils[_0x1cb9('0x13')](_0x6ef389[_0x1cb9('0xd')]);}};exports[_0x1cb9('0x14')]=function(_0x5806d8){try{if(!_['isNil'](_0x5806d8[_0x1cb9('0x15')])&&!_[_0x1cb9('0xf')](_0x5806d8[_0x1cb9('0x15')][_0x1cb9('0x16')])){if(_[_0x1cb9('0x17')](_0x5806d8[_0x1cb9('0x18')],_0x1cb9('0x19'))){_0x5806d8['value']=_0x5806d8['value'][_0x1cb9('0x1a')](_0x1cb9('0x19'),_0x1cb9('0x1b'));}if(recordings[_0x5806d8[_0x1cb9('0x9')]]){var _0x280a84=_[_0x1cb9('0x1c')](recordings[_0x5806d8[_0x1cb9('0x9')]]['monitors'],{'value':_0x5806d8['value']});if(_[_0x1cb9('0xf')](_0x280a84)){recordings[_0x5806d8['linkedid']][_0x1cb9('0x1d')][_0x1cb9('0x1e')]({'value':_0x5806d8['value']});}}}}catch(_0x599275){utils[_0x1cb9('0x13')](_0x599275[_0x1cb9('0xd')]);}};exports[_0x1cb9('0x1f')]=function(_0x4601b8){try{if(!_[_0x1cb9('0xf')](recordings[_0x4601b8[_0x1cb9('0x10')]])){recordings[_0x4601b8['uniqueid']]['calleridnum']=_0x4601b8[_0x1cb9('0x20')];recordings[_0x4601b8['uniqueid']][_0x1cb9('0x21')]=_0x4601b8[_0x1cb9('0x21')];recordings[_0x4601b8[_0x1cb9('0x10')]][_0x1cb9('0x22')]=_0x4601b8[_0x1cb9('0x22')];recordings[_0x4601b8['uniqueid']][_0x1cb9('0x23')]=_0x4601b8[_0x1cb9('0x23')];if(recordings[_0x4601b8['uniqueid']][_0x1cb9('0x24')]==_0x1cb9('0x25')&&recordings[_0x4601b8[_0x1cb9('0x10')]][_0x1cb9('0x1')]){recordings[_0x4601b8[_0x1cb9('0x10')]][_0x1cb9('0x22')]=recordings[_0x4601b8[_0x1cb9('0x10')]][_0x1cb9('0x1')];recordings[_0x4601b8[_0x1cb9('0x10')]][_0x1cb9('0x23')]='';}recordings[_0x4601b8['uniqueid']][_0x1cb9('0x1d')]['forEach'](_0x110282=>{var _0x4efebc=_[_0x1cb9('0x26')](recordings[_0x4601b8[_0x1cb9('0x10')]]);_0x4efebc[_0x1cb9('0x18')]=_0x110282[_0x1cb9('0x18')];writeDB(_0x4efebc);});delete recordings[_0x4601b8['uniqueid']];}}catch(_0x1c701f){utils['error'](_0x1c701f[_0x1cb9('0xd')]);}};exports[_0x1cb9('0x27')]=function(_0x4220d7){try{if(!_['isNil'](recordings[_0x4220d7[_0x1cb9('0x10')]])){if(_0x4220d7['application'][_0x1cb9('0x28')]()=='set'&&_[_0x1cb9('0x29')](_0x4220d7[_0x1cb9('0x2a')][_0x1cb9('0x28')](),_0x1cb9('0x2b'))){var _0x56c3e0=_0x4220d7[_0x1cb9('0x2a')][_0x1cb9('0x2c')]('=');var _0x3467d5=_0x56c3e0[0x0][_0x1cb9('0x2d')](_0x56c3e0[0x0][_0x1cb9('0x2e')]('(')+0x1,_0x56c3e0[0x0][_0x1cb9('0x2e')](')'));var _0xc6d5fd=_0x56c3e0[0x1];recordings[_0x4220d7[_0x1cb9('0x10')]][_0x3467d5]=_0xc6d5fd;}}}catch(_0x386e8b){utils[_0x1cb9('0x13')](_0x386e8b[_0x1cb9('0xd')]);}};exports[_0x1cb9('0x2f')]=function(_0x29f149){try{if(!_['isNil'](recordings[_0x29f149['uniqueid']])){recordings[_0x29f149[_0x1cb9('0x10')]][_0x1cb9('0x30')]=_0x29f149[_0x1cb9('0x30')];}}catch(_0x29f451){utils[_0x1cb9('0x13')](_0x29f451[_0x1cb9('0xd')]);}}; \ No newline at end of file +var _0xedd9=['UserId','request','CreateVoiceRecording','uniqueid','linkedid','context','channel','error','stack','isNil','channelstate','varset','variable','endsWith','value','.wav49','.WAV','find','monitors','calleridnum','calleridname','connectedlinenum','connectedlinename','type','outbound','clone','newexten','application','set','startsWith','appdata','cdr','split','substring','lastIndexOf','queuecallerjoin','queue','./utils','debug','accountcode','getUserByInternal','then','name'];(function(_0x5494b4,_0x5c3528){var _0x1fb474=function(_0x29a92e){while(--_0x29a92e){_0x5494b4['push'](_0x5494b4['shift']());}};_0x1fb474(++_0x5c3528);}(_0xedd9,0xfc));var _0x9edd=function(_0x3f5705,_0x16e789){_0x3f5705=_0x3f5705-0x0;var _0x43e2e6=_0xedd9[_0x3f5705];return _0x43e2e6;};'use strict';var _=require('lodash');var utils=require(_0x9edd('0x0'));var recordings={};function writeDB(_0x2d7989){utils[_0x9edd('0x1')](_0x2d7989);if(_0x2d7989[_0x9edd('0x2')]){utils[_0x9edd('0x3')](_0x2d7989[_0x9edd('0x2')])[_0x9edd('0x4')](function(_0x36b53f){if(_0x36b53f){_0x2d7989['membername']=_0x36b53f[_0x9edd('0x5')];_0x2d7989[_0x9edd('0x6')]=_0x36b53f['id'];}utils[_0x9edd('0x7')](_0x9edd('0x8'),_0x2d7989);});}else{utils['request'](_0x9edd('0x8'),_0x2d7989);}}exports['newchannel']=function(_0x172522){try{if(_0x172522[_0x9edd('0x9')]==_0x172522[_0x9edd('0xa')]){recordings[_0x172522[_0x9edd('0x9')]]={'uniqueid':_0x172522['uniqueid'],'accountcode':_0x172522[_0x9edd('0x2')],'exten':_0x172522['exten'],'context':_0x172522[_0x9edd('0xb')],'channel':_0x172522[_0x9edd('0xc')],'monitors':[]};}}catch(_0x523026){utils[_0x9edd('0xd')](_0x523026[_0x9edd('0xe')]);}};exports['newstate']=function(_0x30c0d7){try{if(!_[_0x9edd('0xf')](recordings[_0x30c0d7[_0x9edd('0x9')]])&&_0x30c0d7[_0x9edd('0x10')]==0x6){}else if(!_[_0x9edd('0xf')](recordings[_0x30c0d7[_0x9edd('0xa')]])&&_0x30c0d7[_0x9edd('0x10')]==0x6&&_0x30c0d7[_0x9edd('0xb')]!='transfer'){recordings[_0x30c0d7[_0x9edd('0xa')]][_0x9edd('0x2')]=_0x30c0d7[_0x9edd('0x2')];}}catch(_0x4d9a7){utils[_0x9edd('0xd')](_0x4d9a7[_0x9edd('0xe')]);}};exports[_0x9edd('0x11')]=function(_0x75a4ab){try{if(!_['isNil'](_0x75a4ab[_0x9edd('0x12')])&&!_[_0x9edd('0xf')](_0x75a4ab[_0x9edd('0x12')]['mixmonitor_filename'])){if(_[_0x9edd('0x13')](_0x75a4ab[_0x9edd('0x14')],_0x9edd('0x15'))){_0x75a4ab['value']=_0x75a4ab[_0x9edd('0x14')]['replace'](_0x9edd('0x15'),_0x9edd('0x16'));}if(recordings[_0x75a4ab['linkedid']]){var _0x498977=_[_0x9edd('0x17')](recordings[_0x75a4ab['linkedid']][_0x9edd('0x18')],{'value':_0x75a4ab['value']});if(_['isNil'](_0x498977)){recordings[_0x75a4ab[_0x9edd('0xa')]][_0x9edd('0x18')]['push']({'value':_0x75a4ab['value']});}}}}catch(_0x341d67){utils[_0x9edd('0xd')](_0x341d67[_0x9edd('0xe')]);}};exports['hangup']=function(_0x3741c8){try{if(!_[_0x9edd('0xf')](recordings[_0x3741c8[_0x9edd('0x9')]])){recordings[_0x3741c8[_0x9edd('0x9')]][_0x9edd('0x19')]=_0x3741c8['calleridnum'];recordings[_0x3741c8[_0x9edd('0x9')]][_0x9edd('0x1a')]=_0x3741c8[_0x9edd('0x1a')];recordings[_0x3741c8[_0x9edd('0x9')]][_0x9edd('0x1b')]=_0x3741c8['connectedlinenum'];recordings[_0x3741c8['uniqueid']][_0x9edd('0x1c')]=_0x3741c8[_0x9edd('0x1c')];if(recordings[_0x3741c8[_0x9edd('0x9')]][_0x9edd('0x1d')]==_0x9edd('0x1e')&&recordings[_0x3741c8['uniqueid']]['accountcode']){recordings[_0x3741c8[_0x9edd('0x9')]][_0x9edd('0x1b')]=recordings[_0x3741c8[_0x9edd('0x9')]]['accountcode'];recordings[_0x3741c8[_0x9edd('0x9')]][_0x9edd('0x1c')]='';}recordings[_0x3741c8[_0x9edd('0x9')]][_0x9edd('0x18')]['forEach'](_0x2155a1=>{var _0x3fb556=_[_0x9edd('0x1f')](recordings[_0x3741c8[_0x9edd('0x9')]]);_0x3fb556[_0x9edd('0x14')]=_0x2155a1[_0x9edd('0x14')];writeDB(_0x3fb556);});delete recordings[_0x3741c8[_0x9edd('0x9')]];}}catch(_0x1fba7b){utils[_0x9edd('0xd')](_0x1fba7b[_0x9edd('0xe')]);}};exports[_0x9edd('0x20')]=function(_0x138002){try{if(!_[_0x9edd('0xf')](recordings[_0x138002[_0x9edd('0x9')]])){if(_0x138002[_0x9edd('0x21')]['toLowerCase']()==_0x9edd('0x22')&&_[_0x9edd('0x23')](_0x138002[_0x9edd('0x24')]['toLowerCase'](),_0x9edd('0x25'))){var _0x3990fb=_0x138002[_0x9edd('0x24')][_0x9edd('0x26')]('=');var _0x21bc30=_0x3990fb[0x0][_0x9edd('0x27')](_0x3990fb[0x0][_0x9edd('0x28')]('(')+0x1,_0x3990fb[0x0][_0x9edd('0x28')](')'));var _0xd0fd74=_0x3990fb[0x1];recordings[_0x138002[_0x9edd('0x9')]][_0x21bc30]=_0xd0fd74;}}}catch(_0x29e789){utils[_0x9edd('0xd')](_0x29e789[_0x9edd('0xe')]);}};exports[_0x9edd('0x29')]=function(_0x5757fc){try{if(!_[_0x9edd('0xf')](recordings[_0x5757fc['uniqueid']])){recordings[_0x5757fc[_0x9edd('0x9')]][_0x9edd('0x2a')]=_0x5757fc[_0x9edd('0x2a')];}}catch(_0x434d26){utils[_0x9edd('0xd')](_0x434d26['stack']);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 9880c0d..182c26d 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 _0xf3be=['blind','error','stack','attendedtransfer','origtransferercalleridnum','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransfererexten','origtransferercontext','origtransfererexten','attended','isNil','transfereechannel','assign','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetcontext','transfertargetexten','transfertargetlinkedid','lodash','util','./utils','format','blindtransfer'];(function(_0xd0b415,_0x149675){var _0x2bdf2c=function(_0x59fbfa){while(--_0x59fbfa){_0xd0b415['push'](_0xd0b415['shift']());}};_0x2bdf2c(++_0x149675);}(_0xf3be,0x1e1));var _0xef3b=function(_0x3bd66c,_0x240b3c){_0x3bd66c=_0x3bd66c-0x0;var _0x59624b=_0xf3be[_0x3bd66c];return _0x59624b;};'use strict';var _=require(_0xef3b('0x0'));var util=require(_0xef3b('0x1'));var utils=require(_0xef3b('0x2'));function writeDB(_0x17b458){utils['info'](util[_0xef3b('0x3')]('TRANSFER|%s',_0x17b458['type']));utils['request']('CreateVoiceTransferReport',_0x17b458);}exports[_0xef3b('0x4')]=function(_0x40dd26){try{_0x40dd26['type']=_0xef3b('0x5');writeDB(_0x40dd26);}catch(_0x3f7873){utils[_0xef3b('0x6')](_0x3f7873[_0xef3b('0x7')]);}};exports[_0xef3b('0x8')]=function(_0x3a36db){try{_0x3a36db=_['assign'](_0x3a36db,{'transfererchannel':_0x3a36db['origtransfererchannel'],'transferercalleridnum':_0x3a36db[_0xef3b('0x9')],'transferercalleridname':_0x3a36db['origtransferercalleridname'],'transfererconnectedlinenum':_0x3a36db[_0xef3b('0xa')],'transfererconnectedlinename':_0x3a36db[_0xef3b('0xb')],'transfereraccountcode':_0x3a36db[_0xef3b('0xc')],'transferercontext':_0x3a36db['secondtransferercontext'],'transfererexten':_0x3a36db[_0xef3b('0xd')],'transfererlinkedid':_0x3a36db['origtransfererlinkedid'],'context':_0x3a36db[_0xef3b('0xe')],'extension':_0x3a36db[_0xef3b('0xf')],'type':_0xef3b('0x10')});if(_[_0xef3b('0x11')](_0x3a36db[_0xef3b('0x12')])){_0x3a36db=_[_0xef3b('0x13')](_0x3a36db,{'transfereechannel':_0x3a36db[_0xef3b('0x14')],'transfereecalleridnum':_0x3a36db[_0xef3b('0x15')],'transfereecalleridname':_0x3a36db[_0xef3b('0x16')],'transfereeconnectedlinenum':_0x3a36db[_0xef3b('0x17')],'transfereeconnectedlinename':_0x3a36db['transfertargetconnectedlinename'],'transfereeaccountcode':_0x3a36db['transfertargetaccountcode'],'transfereecontext':_0x3a36db[_0xef3b('0x18')],'transfereeexten':_0x3a36db[_0xef3b('0x19')],'transfereelinkedid':_0x3a36db[_0xef3b('0x1a')]});}writeDB(_0x3a36db);}catch(_0x118a31){utils[_0xef3b('0x6')](_0x118a31['stack']);}}; \ No newline at end of file +var _0x6bff=['stack','attendedtransfer','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransfererexten','origtransfererlinkedid','attended','isNil','assign','transfertargetcalleridnum','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetexten','lodash','util','format','TRANSFER|%s','type','request','blindtransfer','blind','error'];(function(_0x453295,_0x569a3c){var _0x341103=function(_0x233a4d){while(--_0x233a4d){_0x453295['push'](_0x453295['shift']());}};_0x341103(++_0x569a3c);}(_0x6bff,0xa6));var _0xf6bf=function(_0x29115c,_0x1f4a06){_0x29115c=_0x29115c-0x0;var _0x55caee=_0x6bff[_0x29115c];return _0x55caee;};'use strict';var _=require(_0xf6bf('0x0'));var util=require(_0xf6bf('0x1'));var utils=require('./utils');function writeDB(_0x2b0dc9){utils['info'](util[_0xf6bf('0x2')](_0xf6bf('0x3'),_0x2b0dc9[_0xf6bf('0x4')]));utils[_0xf6bf('0x5')]('CreateVoiceTransferReport',_0x2b0dc9);}exports[_0xf6bf('0x6')]=function(_0x39bf4e){try{_0x39bf4e[_0xf6bf('0x4')]=_0xf6bf('0x7');writeDB(_0x39bf4e);}catch(_0x9cf3a4){utils[_0xf6bf('0x8')](_0x9cf3a4[_0xf6bf('0x9')]);}};exports[_0xf6bf('0xa')]=function(_0x5e135f){try{_0x5e135f=_['assign'](_0x5e135f,{'transfererchannel':_0x5e135f['origtransfererchannel'],'transferercalleridnum':_0x5e135f[_0xf6bf('0xb')],'transferercalleridname':_0x5e135f[_0xf6bf('0xc')],'transfererconnectedlinenum':_0x5e135f[_0xf6bf('0xd')],'transfererconnectedlinename':_0x5e135f[_0xf6bf('0xe')],'transfereraccountcode':_0x5e135f[_0xf6bf('0xf')],'transferercontext':_0x5e135f['secondtransferercontext'],'transfererexten':_0x5e135f[_0xf6bf('0x10')],'transfererlinkedid':_0x5e135f[_0xf6bf('0x11')],'context':_0x5e135f['origtransferercontext'],'extension':_0x5e135f['origtransfererexten'],'type':_0xf6bf('0x12')});if(_[_0xf6bf('0x13')](_0x5e135f['transfereechannel'])){_0x5e135f=_[_0xf6bf('0x14')](_0x5e135f,{'transfereechannel':_0x5e135f['transfertargetchannel'],'transfereecalleridnum':_0x5e135f[_0xf6bf('0x15')],'transfereecalleridname':_0x5e135f['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x5e135f[_0xf6bf('0x16')],'transfereeconnectedlinename':_0x5e135f[_0xf6bf('0x17')],'transfereeaccountcode':_0x5e135f['transfertargetaccountcode'],'transfereecontext':_0x5e135f['transfertargetcontext'],'transfereeexten':_0x5e135f[_0xf6bf('0x18')],'transfereelinkedid':_0x5e135f['transfertargetlinkedid']});}writeDB(_0x5e135f);}catch(_0xe55dd5){utils[_0xf6bf('0x8')](_0xe55dd5[_0xf6bf('0x9')]);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 4687c87..96dcb47 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 _0x033d=['interface','result','length','FOUND','NOTFOUND','getUserByInternal','getUserByInterface','getUserByName','getVoiceQueueByName','acw','acwTimeout','GETVOICEQUEUEBYNAME|','add','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','seconds','diffTime','diff','sumTime','now','isAfter','isBefore','bluebird','client','http','../../config/logger','xdr','info','debug','stringify','error','stack','request','then','catch','GetUser','name'];(function(_0x3b4725,_0x5601a7){var _0x553153=function(_0xbfb93c){while(--_0xbfb93c){_0x3b4725['push'](_0x3b4725['shift']());}};_0x553153(++_0x5601a7);}(_0x033d,0xd5));var _0xd033=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x033d[_0x2dafbe];return _0x58a45a;};'use strict';var jayson=require('jayson/promise');var moment=require('moment');var BPromise=require(_0xd033('0x0'));var client=jayson[_0xd033('0x1')][_0xd033('0x2')]({'port':0x2329});var logger=require(_0xd033('0x3'))(_0xd033('0x4'));exports[_0xd033('0x5')]=function(_0x3db9cf){logger[_0xd033('0x5')](_0x3db9cf);};exports[_0xd033('0x6')]=function(_0x2a9b8a){logger[_0xd033('0x6')](JSON[_0xd033('0x7')](_0x2a9b8a));};exports[_0xd033('0x8')]=function(_0x3ec5f1){logger[_0xd033('0x8')](_0x3ec5f1[_0xd033('0x9')]);};exports[_0xd033('0xa')]=function(_0x434da4,_0x1ade95){return client['request'](_0x434da4,{'body':_0x1ade95})[_0xd033('0xb')](function(_0x160e41){logger['debug'](JSON[_0xd033('0x7')](_0x160e41));})[_0xd033('0xc')](function(_0x592b4a){logger['error'](_0x592b4a[_0xd033('0x9')]);});};function getUser(_0x2fe763){return client[_0xd033('0xa')](_0xd033('0xd'),{'options':{'raw':!![],'attributes':['id','internal',_0xd033('0xe'),_0xd033('0xf')],'where':_0x2fe763,'limit':0x1}})[_0xd033('0xb')](function(_0x20734e){logger[_0xd033('0x5')]('GETUSER|'+JSON['stringify'](_0x2fe763)+'|'+(_0x20734e[_0xd033('0x10')][_0xd033('0x11')]?_0xd033('0x12'):_0xd033('0x13')));return _0x20734e[_0xd033('0x10')][_0xd033('0x11')]?_0x20734e[_0xd033('0x10')][0x0]:null;});}exports[_0xd033('0x14')]=function(_0x2da59d){return new BPromise(function(_0x3374ed,_0x59730d){if(_0x2da59d){return getUser({'internal':_0x2da59d})[_0xd033('0xb')](function(_0x402318){return _0x3374ed(_0x402318);})[_0xd033('0xc')](function(_0x519d9b){logger[_0xd033('0x8')](_0x519d9b[_0xd033('0x9')]);return _0x3374ed(null);});}else{return _0x3374ed(null);}});};exports[_0xd033('0x15')]=function(_0x4aefbf){return new BPromise(function(_0x58c960,_0x27b246){if(_0x4aefbf){return getUser({'interface':_0x4aefbf})['then'](function(_0x497981){return _0x58c960(_0x497981);})[_0xd033('0xc')](function(_0x4702cb){logger[_0xd033('0x8')](_0x4702cb[_0xd033('0x9')]);return _0x58c960(null);});}else{return _0x58c960(null);}});};exports[_0xd033('0x16')]=function(_0x29d2ef){return new BPromise(function(_0x447ff7,_0x586d1c){if(_0x29d2ef){return getUser({'name':_0x29d2ef})[_0xd033('0xb')](function(_0x5ed3b2){return _0x447ff7(_0x5ed3b2);})[_0xd033('0xc')](function(_0x5b81cd){logger['error'](_0x5b81cd[_0xd033('0x9')]);return _0x447ff7(null);});}else{return _0x447ff7(null);}});};exports[_0xd033('0x17')]=function(_0x4d7976){return new BPromise(function(_0x5b2d70,_0x1317a3){if(_0x4d7976){return client[_0xd033('0xa')]('GetVoiceQueue',{'options':{'raw':!![],'attributes':['id',_0xd033('0xe'),'type',_0xd033('0x18'),_0xd033('0x19')],'where':{'name':_0x4d7976},'limit':0x1}})[_0xd033('0xb')](function(_0x301cdb){logger[_0xd033('0x5')](_0xd033('0x1a')+_0x4d7976+'|'+(_0x301cdb[_0xd033('0x10')][_0xd033('0x11')]?'FOUND':_0xd033('0x13')));return _0x5b2d70(_0x301cdb[_0xd033('0x10')][_0xd033('0x11')]?_0x301cdb[_0xd033('0x10')][0x0]:null);})[_0xd033('0xc')](function(_0x9cc69a){logger['error'](_0x9cc69a['stack']);return _0x5b2d70(null);});}else{return _0x5b2d70(null);}});};exports['addTime']=function(_0x7d67f,_0x1d3f58){return moment(_0x7d67f)[_0xd033('0x1b')](_0x1d3f58,'seconds')[_0xd033('0x1c')](_0xd033('0x1d'));};exports[_0xd033('0x1e')]=function(_0x6d7b19,_0x48ce76){return moment(_0x6d7b19)['subtract'](_0x48ce76,_0xd033('0x1f'))[_0xd033('0x1c')](_0xd033('0x1d'));};exports[_0xd033('0x20')]=function(_0x2f3aec,_0x41b0cd){return moment(_0x2f3aec)[_0xd033('0x21')](moment(_0x41b0cd),_0xd033('0x1f'));};exports[_0xd033('0x22')]=function(_0x4440bc,_0xf4768f){return parseInt(_0x4440bc,0xa)+parseInt(_0xf4768f,0xa);};exports[_0xd033('0x23')]=function(){return moment()[_0xd033('0x1c')](_0xd033('0x1d'));};exports[_0xd033('0x24')]=function(_0x1dc40a,_0x5f41dd){if(_0x5f41dd){return moment(_0x1dc40a)[_0xd033('0x24')](_0x5f41dd);}else{return!![];}};exports[_0xd033('0x25')]=function(_0x821c67,_0x393ee2){if(_0x393ee2){return moment(_0x821c67)[_0xd033('0x25')](_0x393ee2);}else if(_0x821c67){return!![];}else{return![];}}; \ No newline at end of file +var _0x62e1=['getUserByInternal','getUserByInterface','getUserByName','GetVoiceQueue','name','type','acwTimeout','GETVOICEQUEUEBYNAME|','addTime','add','seconds','format','subtractTime','YYYY-MM-DD\x20HH:mm:ss','diff','sumTime','now','isAfter','isBefore','moment','client','../../config/logger','xdr','debug','stringify','error','request','catch','stack','interface','then','info','GETUSER|','result','length','FOUND','NOTFOUND'];(function(_0xe73080,_0x24c56d){var _0x12cbc4=function(_0x1377e2){while(--_0x1377e2){_0xe73080['push'](_0xe73080['shift']());}};_0x12cbc4(++_0x24c56d);}(_0x62e1,0x1aa));var _0x162e=function(_0x20c9b2,_0x55d7b1){_0x20c9b2=_0x20c9b2-0x0;var _0x2c6030=_0x62e1[_0x20c9b2];return _0x2c6030;};'use strict';var jayson=require('jayson/promise');var moment=require(_0x162e('0x0'));var BPromise=require('bluebird');var client=jayson[_0x162e('0x1')]['http']({'port':0x2329});var logger=require(_0x162e('0x2'))(_0x162e('0x3'));exports['info']=function(_0x9471ae){logger['info'](_0x9471ae);};exports[_0x162e('0x4')]=function(_0x52ab04){logger[_0x162e('0x4')](JSON[_0x162e('0x5')](_0x52ab04));};exports[_0x162e('0x6')]=function(_0x2c6470){logger[_0x162e('0x6')](_0x2c6470['stack']);};exports[_0x162e('0x7')]=function(_0x220edf,_0x5ccb27){return client[_0x162e('0x7')](_0x220edf,{'body':_0x5ccb27})['then'](function(_0x59289d){logger[_0x162e('0x4')](JSON[_0x162e('0x5')](_0x59289d));})[_0x162e('0x8')](function(_0x20ab83){logger[_0x162e('0x6')](_0x20ab83[_0x162e('0x9')]);});};function getUser(_0x526a1d){return client[_0x162e('0x7')]('GetUser',{'options':{'raw':!![],'attributes':['id','internal','name',_0x162e('0xa')],'where':_0x526a1d,'limit':0x1}})[_0x162e('0xb')](function(_0x3f96f7){logger[_0x162e('0xc')](_0x162e('0xd')+JSON['stringify'](_0x526a1d)+'|'+(_0x3f96f7[_0x162e('0xe')][_0x162e('0xf')]?_0x162e('0x10'):_0x162e('0x11')));return _0x3f96f7[_0x162e('0xe')][_0x162e('0xf')]?_0x3f96f7[_0x162e('0xe')][0x0]:null;});}exports[_0x162e('0x12')]=function(_0x5cca2b){return new BPromise(function(_0x1461d0,_0x1c5d90){if(_0x5cca2b){return getUser({'internal':_0x5cca2b})[_0x162e('0xb')](function(_0x540a23){return _0x1461d0(_0x540a23);})[_0x162e('0x8')](function(_0x25a820){logger[_0x162e('0x6')](_0x25a820['stack']);return _0x1461d0(null);});}else{return _0x1461d0(null);}});};exports[_0x162e('0x13')]=function(_0x217b35){return new BPromise(function(_0xc1da75,_0x17b08b){if(_0x217b35){return getUser({'interface':_0x217b35})['then'](function(_0x127617){return _0xc1da75(_0x127617);})[_0x162e('0x8')](function(_0x231360){logger['error'](_0x231360[_0x162e('0x9')]);return _0xc1da75(null);});}else{return _0xc1da75(null);}});};exports[_0x162e('0x14')]=function(_0x5b9ae7){return new BPromise(function(_0x150e00,_0x387c63){if(_0x5b9ae7){return getUser({'name':_0x5b9ae7})[_0x162e('0xb')](function(_0x2d17fc){return _0x150e00(_0x2d17fc);})['catch'](function(_0x3f6ab7){logger['error'](_0x3f6ab7[_0x162e('0x9')]);return _0x150e00(null);});}else{return _0x150e00(null);}});};exports['getVoiceQueueByName']=function(_0x5bffff){return new BPromise(function(_0x18298f,_0x4aac42){if(_0x5bffff){return client[_0x162e('0x7')](_0x162e('0x15'),{'options':{'raw':!![],'attributes':['id',_0x162e('0x16'),_0x162e('0x17'),'acw',_0x162e('0x18')],'where':{'name':_0x5bffff},'limit':0x1}})['then'](function(_0x5f238c){logger[_0x162e('0xc')](_0x162e('0x19')+_0x5bffff+'|'+(_0x5f238c[_0x162e('0xe')][_0x162e('0xf')]?_0x162e('0x10'):_0x162e('0x11')));return _0x18298f(_0x5f238c[_0x162e('0xe')][_0x162e('0xf')]?_0x5f238c[_0x162e('0xe')][0x0]:null);})[_0x162e('0x8')](function(_0xb00d54){logger[_0x162e('0x6')](_0xb00d54[_0x162e('0x9')]);return _0x18298f(null);});}else{return _0x18298f(null);}});};exports[_0x162e('0x1a')]=function(_0xc7fc46,_0x279024){return moment(_0xc7fc46)[_0x162e('0x1b')](_0x279024,_0x162e('0x1c'))[_0x162e('0x1d')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x162e('0x1e')]=function(_0x472d71,_0x53f786){return moment(_0x472d71)['subtract'](_0x53f786,_0x162e('0x1c'))[_0x162e('0x1d')](_0x162e('0x1f'));};exports['diffTime']=function(_0x19d61d,_0x2fbf53){return moment(_0x19d61d)[_0x162e('0x20')](moment(_0x2fbf53),'seconds');};exports[_0x162e('0x21')]=function(_0xc4cf98,_0x525353){return parseInt(_0xc4cf98,0xa)+parseInt(_0x525353,0xa);};exports[_0x162e('0x22')]=function(){return moment()['format'](_0x162e('0x1f'));};exports[_0x162e('0x23')]=function(_0x1e4cc3,_0x3c9844){if(_0x3c9844){return moment(_0x1e4cc3)[_0x162e('0x23')](_0x3c9844);}else{return!![];}};exports[_0x162e('0x24')]=function(_0x40f21f,_0x2f1583){if(_0x2f1583){return moment(_0x40f21f)[_0x162e('0x24')](_0x2f1583);}else if(_0x40f21f){return!![];}else{return![];}}; \ No newline at end of file